diff --git a/go.mod b/go.mod index cec56d8b..f05fed1d 100644 --- a/go.mod +++ b/go.mod @@ -3,28 +3,28 @@ module github.com/umputun/spot go 1.22 require ( - github.com/aws/aws-sdk-go-v2/config v1.27.8 - github.com/aws/aws-sdk-go-v2/credentials v1.17.8 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.4 + github.com/aws/aws-sdk-go-v2/config v1.27.12 + github.com/aws/aws-sdk-go-v2/credentials v1.17.12 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.7 github.com/fatih/color v1.16.0 github.com/go-pkgz/fileutils v0.2.0 github.com/go-pkgz/lgr v0.11.1 github.com/go-pkgz/stringutils v1.1.0 github.com/go-pkgz/syncs v1.3.2 - github.com/go-sql-driver/mysql v1.8.0 + github.com/go-sql-driver/mysql v1.8.1 github.com/google/uuid v1.6.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/hashicorp/vault/api v1.12.2 + github.com/hashicorp/vault/api v1.13.0 github.com/jessevdk/go-flags v1.5.0 github.com/lib/pq v1.10.9 - github.com/pelletier/go-toml/v2 v2.2.0 + github.com/pelletier/go-toml/v2 v2.2.2 github.com/pkg/sftp v1.13.6 github.com/sosedoff/ansible-vault-go v0.2.0 github.com/stretchr/testify v1.9.0 - github.com/testcontainers/testcontainers-go v0.22.0 - golang.org/x/crypto v0.21.0 + github.com/testcontainers/testcontainers-go v0.30.0 + golang.org/x/crypto v0.23.0 gopkg.in/yaml.v3 v3.0.1 - modernc.org/sqlite v1.29.5 + modernc.org/sqlite v1.29.9 ) require ( @@ -33,29 +33,33 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Microsoft/hcsshim v0.11.4 // indirect - github.com/aws/aws-sdk-go-v2 v1.26.0 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect + github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect - github.com/aws/smithy-go v1.20.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 // indirect + github.com/aws/smithy-go v1.20.2 // indirect github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/containerd/containerd v1.7.11 // indirect + github.com/containerd/containerd v1.7.12 // indirect github.com/containerd/log v0.1.0 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/docker v24.0.9+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/distribution/reference v0.5.0 // indirect + github.com/docker/docker v25.0.5+incompatible // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/go-jose/go-jose/v3 v3.0.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-jose/go-jose/v4 v4.0.1 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -70,38 +74,49 @@ require ( github.com/klauspost/compress v1.16.7 // indirect github.com/kr/fs v0.1.0 // indirect github.com/kr/pretty v0.3.1 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/sys/user v0.1.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc4 // indirect - github.com/opencontainers/runc v1.1.12 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/shirou/gopsutil/v3 v3.23.12 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect golang.org/x/mod v0.16.0 // indirect golang.org/x/net v0.23.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect google.golang.org/protobuf v1.33.0 // indirect modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect - modernc.org/libc v1.46.0 // indirect + modernc.org/libc v1.49.3 // indirect modernc.org/mathutil v1.6.0 // indirect - modernc.org/memory v1.7.2 // indirect + modernc.org/memory v1.8.0 // indirect modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index a3b17703..07d32efc 100644 --- a/go.sum +++ b/go.sum @@ -10,40 +10,40 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= -github.com/aws/aws-sdk-go-v2 v1.26.0 h1:/Ce4OCiM3EkpW7Y+xUnfAFpchU78K7/Ug01sZni9PgA= -github.com/aws/aws-sdk-go-v2 v1.26.0/go.mod h1:35hUlJVYd+M++iLI3ALmVwMOyRYMmRqUXpTtRGW+K9I= -github.com/aws/aws-sdk-go-v2/config v1.27.8 h1:0r8epOsiJ7YJz65MGcb8i91ehFp4kvvFe2qkq5oYeRI= -github.com/aws/aws-sdk-go-v2/config v1.27.8/go.mod h1:XsmYKxYNuIhLsFddpNds+j9H5XKzjWDdg/SZngiwFio= -github.com/aws/aws-sdk-go-v2/credentials v1.17.8 h1:WUdNLXbyNbU07V/WFrSOBXqZTDgmmMNMgUFzpYOKJhw= -github.com/aws/aws-sdk-go-v2/credentials v1.17.8/go.mod h1:iPZzLpaBIfhyvVS/XGD3JvR1GP3YdHTqpySKDlqkfs8= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.4 h1:S+L2QSKhUuShih3aq9P/mkzDBiOO5tTyVg+vXREfsfg= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.4/go.mod h1:nQ3how7DMnFMWiU1SpECohgC82fpn4cKZ875NDMmwtA= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 h1:0ScVK/4qZ8CIW0k8jOeFVsyS/sAiXpYxRBLolMkuLQM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4/go.mod h1:84KyjNZdHC6QZW08nfHI6yZgPd+qRgaWcYsyLUo3QY8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 h1:sHmMWWX5E7guWEFQ9SVo6A3S4xpPrWnd77a6y4WM6PU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4/go.mod h1:WjpDrhWisWOIoS9n3nk67A3Ll1vfULJ9Kq6h29HTD48= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= +github.com/aws/aws-sdk-go-v2/config v1.27.12 h1:vq88mBaZI4NGLXk8ierArwSILmYHDJZGJOeAc/pzEVQ= +github.com/aws/aws-sdk-go-v2/config v1.27.12/go.mod h1:IOrsf4IiN68+CgzyuyGUYTpCrtUQTbbMEAtR/MR/4ZU= +github.com/aws/aws-sdk-go-v2/credentials v1.17.12 h1:PVbKQ0KjDosI5+nEdRMU8ygEQDmkJTSHBqPjEX30lqc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.12/go.mod h1:jlWtGFRtKsqc5zqerHZYmKmRkUXo3KPM14YJ13ZEjwE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.4 h1:5GYToReUFSGP6/zqvG3fv8qNqeetyfsSiPHduHShjAc= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.4/go.mod h1:slgOMs1CQu8UVgwoFqEvCi71L4HVoZgM0r8MtcNP6Mc= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3/go.mod h1:b+qdhjnxj8GSR6t5YfphOffeoQSQ1KmpoVVuBn+PWxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 h1:J/PpTf/hllOjx8Xu9DMflff3FajfLxqM5+tepvVXmxg= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5/go.mod h1:0ih0Z83YDH/QeQ6Ori2yGE2XvWYv/Xm+cZc01LC6oK0= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/gxJBcSWDMZlgyFUM962F51A5CRhDLbxLdmo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.7 h1:4cziOtpDwtgcb+wTYRzz8C+GoH1XySy0p7j4oBbqPQE= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.7/go.mod h1:3Ba++UwWd154xtP4FRX5pUK3Gt4up5sDHCve6kVfE+g= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.5 h1:Ciiz/plN+Z+pPO1G0W2zJoYIIl0KtKzY0LJ78NXYTws= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.5/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 h1:et3Ta53gotFR4ERLXXHIHl/Uuk1qYpP5uU7cvNql8ns= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/containerd/containerd v1.7.11 h1:lfGKw3eU35sjV0aG2eYZTiwFEY1pCzxdzicHP3SZILw= -github.com/containerd/containerd v1.7.11/go.mod h1:5UluHxHTX2rdvYuZ5OJTC5m/KJNs0Zs9wVoJm9zf5ZE= +github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0= +github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= @@ -54,20 +54,29 @@ github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= -github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= +github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k= -github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-jose/go-jose/v4 v4.0.1 h1:QVEPDE3OluqXBQZDcnNvQrInro2h0e4eqNbnZSWqS6U= +github.com/go-jose/go-jose/v4 v4.0.1/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-pkgz/fileutils v0.2.0 h1:TyCYD02ESjG+5rPVBMydmyWYaGdMEbjbvG6kNRuW60w= github.com/go-pkgz/fileutils v0.2.0/go.mod h1:8J7iLe7WensJoQ/WjqODxoAI9ju8jXR/3iVWCDtyZWY= github.com/go-pkgz/lgr v0.11.1 h1:hXFhZcznehI6imLhEa379oMOKFz7TQUmisAqb3oLOSM= @@ -76,8 +85,8 @@ github.com/go-pkgz/stringutils v1.1.0 h1:+EJPrIY4JQNWXwdudv0QBXHChdVzKRtSYG6fb3M github.com/go-pkgz/stringutils v1.1.0/go.mod h1:p5XLM6BpFFOhtJYdUAbeE8a41vBsEqj4BFHbklNI5mo= github.com/go-pkgz/syncs v1.3.2 h1:gmioASlJNy3gNosPlgvWOM2QP0Hdjzn2u+/sUShgd8E= github.com/go-pkgz/syncs v1.3.2/go.mod h1:qjgzpp7OpuhDf7BWsW/FHCu9DLjE32NPy6/vXAXT/Cw= -github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4= -github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -86,12 +95,16 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo= +github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -116,8 +129,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/vault/api v1.12.2 h1:7YkCTE5Ni90TcmYHDBExdt4WGJxhpzaHqR6uGbQb/rE= -github.com/hashicorp/vault/api v1.12.2/go.mod h1:LSGf1NGT1BnvFFnKVtnvcaLBM2Lz+gJdpL6HUYed8KE= +github.com/hashicorp/vault/api v1.13.0 h1:RTCGpE2Rgkn9jyPcFlc7YmNocomda44k5ck8FKMH41Y= +github.com/hashicorp/vault/api v1.13.0/go.mod h1:0cb/uZUv1w2cVu9DIvuW1SMlXXC6qtATJt+LXJRx+kg= github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -132,6 +145,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -139,16 +154,16 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= -github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= +github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= +github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= @@ -157,12 +172,10 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= -github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= -github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= -github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -170,12 +183,20 @@ github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sosedoff/ansible-vault-go v0.2.0 h1:XqkBdqbXgTuFQ++NdrZvSdUTNozeb6S3V5x7FVs17vg= @@ -191,25 +212,45 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/testcontainers/testcontainers-go v0.22.0 h1:hOK4NzNu82VZcKEB1aP9LO1xYssVFMvlfeuDW9JMmV0= -github.com/testcontainers/testcontainers-go v0.22.0/go.mod h1:k0YiPa26xJCRUbUkYqy5rY6NGvSbVCeUBXCvucscBR4= +github.com/testcontainers/testcontainers-go v0.30.0 h1:jmn/XS22q4YRrcMwWg0pAwlClzs/abopbsBzrepyc4E= +github.com/testcontainers/testcontainers-go v0.30.0/go.mod h1:K+kHNGiM5zjklKjgTtcrEetF3uhWbMUyqAQoyoh8Pf0= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w= golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -219,21 +260,20 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -242,28 +282,23 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -271,13 +306,15 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= @@ -294,28 +331,28 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -modernc.org/cc/v4 v4.19.3 h1:vE9kmJqUcyvNOf8F2Hn8od14SOMq34BiqcZ2tMzLk5c= -modernc.org/cc/v4 v4.19.3/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= -modernc.org/ccgo/v4 v4.12.0 h1:Y1CjG4RQm05crWQyoIbPGWzceIRsnLR0tXXCVzElPc8= -modernc.org/ccgo/v4 v4.12.0/go.mod h1:Z7hlXhyi8XyPPF+keSagePGdmUKwX+HNtp4h6+0DfaU= +modernc.org/cc/v4 v4.20.0 h1:45Or8mQfbUqJOG9WaxvlFYOAQO0lQ5RvqBcFCXngjxk= +modernc.org/cc/v4 v4.20.0/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= +modernc.org/ccgo/v4 v4.16.0 h1:ofwORa6vx2FMm0916/CkZjpFPSR70VwTjUCe2Eg5BnA= +modernc.org/ccgo/v4 v4.16.0/go.mod h1:dkNyWIjFrVIZ68DTo36vHK+6/ShBn4ysU61So6PIqCI= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8= modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= -modernc.org/libc v1.46.0 h1:6Bgun/6X1rFufESfGSZ6iRJ2KqWj3zbwXoCSVnIv0Jc= -modernc.org/libc v1.46.0/go.mod h1:eDI/RWXV8yvnoJ8Ddg/UaoSIIvvGgeq3ciBtRvh7i9A= +modernc.org/libc v1.49.3 h1:j2MRCRdwJI2ls/sGbeSk0t2bypOG/uvPZUsGQFDulqg= +modernc.org/libc v1.49.3/go.mod h1:yMZuGkn7pXbKfoT/M35gFJOAEdSKdxL0q64sF7KqCDo= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= -modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= -modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= +modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= +modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss= -modernc.org/sqlite v1.29.5 h1:8l/SQKAjDtZFo9lkJLdk8g9JEOeYRG4/ghStDCCTiTE= -modernc.org/sqlite v1.29.5/go.mod h1:S02dvcmm7TnTRvGhv8IGYyLnIt7AS2KPaB1F/71p75U= +modernc.org/sqlite v1.29.9 h1:9RhNMklxJs+1596GNuAX+O/6040bvOwacTxuFcRuQow= +modernc.org/sqlite v1.29.9/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go index 847cc51a..639ba763 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go @@ -3,4 +3,4 @@ package aws // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.26.0" +const goModuleVersion = "1.26.1" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md index 8bdbfd5c..808e13ab 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md @@ -1,3 +1,19 @@ +# v1.27.12 (2024-05-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.27.11 (2024-04-05) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.27.10 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.27.9 (2024-03-21) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.27.8 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go index 9efd9487..2ec19a2d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go @@ -3,4 +3,4 @@ package config // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.27.8" +const goModuleVersion = "1.27.12" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md index 1e91e624..bbef7178 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md @@ -1,3 +1,19 @@ +# v1.17.12 (2024-05-08) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.17.11 (2024-04-05) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.17.10 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.17.9 (2024-03-21) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.17.8 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go index dc1f43de..863674dd 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go @@ -3,4 +3,4 @@ package credentials // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.17.8" +const goModuleVersion = "1.17.12" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md index 76b26d73..3807833d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.16.1 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.16.0 (2024-03-21) + +* **Feature**: Add config switch `DisableDefaultTimeout` that allows you to disable the default operation timeout (5 seconds) for IMDS calls. + # v1.15.4 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/api_client.go index 46e144d9..3f4a10e2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/api_client.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/api_client.go @@ -185,6 +185,10 @@ type Options struct { // [configuring IMDS]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html EnableFallback aws.Ternary + // By default, all IMDS client operations enforce a 5-second timeout. You + // can disable that behavior with this setting. + DisableDefaultTimeout bool + // provides the caching of API tokens used for operation calls. If unset, // the API token will not be retrieved for the operation. tokenProvider *tokenProvider diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/doc.go index bacdb5d2..d5765c36 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/doc.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/doc.go @@ -3,8 +3,9 @@ // // All Client operation calls have a default timeout. If the operation is not // completed before this timeout expires, the operation will be canceled. This -// timeout can be overridden by providing Context with a timeout or deadline -// with calling the client's operations. +// timeout can be overridden through the following: +// - Set the options flag DisableDefaultTimeout +// - Provide a Context with a timeout or deadline with calling the client's operations. // // See the EC2 IMDS user guide for more information on using the API. // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go index 257eaec9..5642306f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go @@ -3,4 +3,4 @@ package imds // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.15.4" +const goModuleVersion = "1.16.1" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/request_middleware.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/request_middleware.go index fc948c27..90cf4aeb 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/request_middleware.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/request_middleware.go @@ -56,6 +56,7 @@ func addRequestMiddleware(stack *middleware.Stack, // Operation timeout err = stack.Initialize.Add(&operationTimeout{ + Disabled: options.DisableDefaultTimeout, DefaultTimeout: defaultOperationTimeout, }, middleware.Before) if err != nil { @@ -260,6 +261,7 @@ const ( // Otherwise the timeout cleanup will race the resource being consumed // upstream. type operationTimeout struct { + Disabled bool DefaultTimeout time.Duration } @@ -270,6 +272,10 @@ func (m *operationTimeout) HandleInitialize( ) ( output middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { + if m.Disabled { + return next.HandleInitialize(ctx, input) + } + if _, ok := ctx.Deadline(); !ok && m.DefaultTimeout != 0 { var cancelFn func() ctx, cancelFn = context.WithTimeout(ctx, m.DefaultTimeout) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md index 86f5b137..72e196dd 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.3.5 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.3.4 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go index d25782e9..faf71cac 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go @@ -3,4 +3,4 @@ package configsources // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.3.4" +const goModuleVersion = "1.3.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md index 5bb02f57..6f6dafa8 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md @@ -1,3 +1,7 @@ +# v2.6.5 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v2.6.4 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go index bb857bcb..27981631 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go @@ -3,4 +3,4 @@ package endpoints // goModuleVersion is the tagged release for this module -const goModuleVersion = "2.6.4" +const goModuleVersion = "2.6.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md index cac6f926..9cf6cf22 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.11.2 (2024-03-29) + +* No change notes available for this release. + # v1.11.1 (2024-02-21) * No change notes available for this release. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go index c5ae0f87..6339b541 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go @@ -3,4 +3,4 @@ package acceptencoding // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.11.1" +const goModuleVersion = "1.11.2" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md index ead169d5..35c7050d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.11.7 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.11.6 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go index 98bea53b..daf77b5c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go @@ -3,4 +3,4 @@ package presignedurl // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.11.6" +const goModuleVersion = "1.11.7" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/CHANGELOG.md index ff35a763..cf31787b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.28.7 (2024-05-08) + +* **Bug Fix**: GoDoc improvement + +# v1.28.6 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + +# v1.28.5 (2024-03-27) + +* **Documentation**: Documentation updates for Secrets Manager + # v1.28.4 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_BatchGetSecretValue.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_BatchGetSecretValue.go index 8aa4456d..6aaf0d80 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_BatchGetSecretValue.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_BatchGetSecretValue.go @@ -12,23 +12,27 @@ import ( ) // Retrieves the contents of the encrypted fields SecretString or SecretBinary for -// up to 20 secrets. To retrieve a single secret, call GetSecretValue . To choose -// which secrets to retrieve, you can specify a list of secrets by name or ARN, or -// you can use filters. If Secrets Manager encounters errors such as +// up to 20 secrets. To retrieve a single secret, call GetSecretValue. +// +// To choose which secrets to retrieve, you can specify a list of secrets by name +// or ARN, or you can use filters. If Secrets Manager encounters errors such as // AccessDeniedException while attempting to retrieve any of the secrets, you can -// see the errors in Errors in the response. Secrets Manager generates CloudTrail -// GetSecretValue log entries for each secret you request when you call this -// action. Do not include sensitive information in request parameters because it -// might be logged. For more information, see Logging Secrets Manager events with -// CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:BatchGetSecretValue , and you must have +// see the errors in Errors in the response. +// +// Secrets Manager generates CloudTrail GetSecretValue log entries for each secret +// you request when you call this action. Do not include sensitive information in +// request parameters because it might be logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:BatchGetSecretValue , and you must have // secretsmanager:GetSecretValue for each secret. If you use filters, you must also // have secretsmanager:ListSecrets . If the secrets are encrypted using // customer-managed keys instead of the Amazon Web Services managed key // aws/secretsmanager , then you also need kms:Decrypt permissions for the keys. -// For more information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// For more information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) BatchGetSecretValue(ctx context.Context, params *BatchGetSecretValueInput, optFns ...func(*Options)) (*BatchGetSecretValueOutput, error) { if params == nil { params = &BatchGetSecretValueInput{} @@ -50,10 +54,12 @@ type BatchGetSecretValueInput struct { // SecretIdList , but not both. Filters []types.Filter - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call BatchGetSecretValue again with the value from NextToken . To use - // this parameter, you must also use the Filters parameter. + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call BatchGetSecretValue again with the + // value from NextToken . To use this parameter, you must also use the Filters + // parameter. MaxResults *int32 // A token that indicates where the output should continue from, if a previous @@ -176,10 +182,12 @@ var _ BatchGetSecretValueAPIClient = (*Client)(nil) // BatchGetSecretValuePaginatorOptions is the paginator options for // BatchGetSecretValue type BatchGetSecretValuePaginatorOptions struct { - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call BatchGetSecretValue again with the value from NextToken . To use - // this parameter, you must also use the Filters parameter. + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call BatchGetSecretValue again with the + // value from NextToken . To use this parameter, you must also use the Filters + // parameter. Limit int32 // Set to true if pagination should stop if the service returns a pagination token diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CancelRotateSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CancelRotateSecret.go index 18edf0d2..42ce02ce 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CancelRotateSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CancelRotateSecret.go @@ -11,22 +11,29 @@ import ( ) // Turns off automatic rotation, and if a rotation is currently in progress, -// cancels the rotation. If you cancel a rotation in progress, it can leave the -// VersionStage labels in an unexpected state. You might need to remove the staging -// label AWSPENDING from the partially created version. You also need to determine -// whether to roll back to the previous version of the secret by moving the staging -// label AWSCURRENT to the version that has AWSPENDING . To determine which version -// has a specific staging label, call ListSecretVersionIds . Then use -// UpdateSecretVersionStage to change staging labels. For more information, see -// How rotation works (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) -// . To turn on automatic rotation again, call RotateSecret . Secrets Manager -// generates a CloudTrail log entry when you call this action. Do not include -// sensitive information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:CancelRotateSecret . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// cancels the rotation. +// +// If you cancel a rotation in progress, it can leave the VersionStage labels in +// an unexpected state. You might need to remove the staging label AWSPENDING from +// the partially created version. You also need to determine whether to roll back +// to the previous version of the secret by moving the staging label AWSCURRENT to +// the version that has AWSPENDING . To determine which version has a specific +// staging label, call ListSecretVersionIds. Then use UpdateSecretVersionStage to change staging labels. For more information, +// see [How rotation works]. +// +// To turn on automatic rotation again, call RotateSecret. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:CancelRotateSecret . For more information, +// see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [How rotation works]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) CancelRotateSecret(ctx context.Context, params *CancelRotateSecretInput, optFns ...func(*Options)) (*CancelRotateSecretOutput, error) { if params == nil { params = &CancelRotateSecretInput{} @@ -44,9 +51,12 @@ func (c *Client) CancelRotateSecret(ctx context.Context, params *CancelRotateSec type CancelRotateSecretInput struct { - // The ARN or name of the secret. For an ARN, we recommend that you specify a - // complete ARN rather than a partial ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CreateSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CreateSecret.go index 46d984e0..b25d5d17 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CreateSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_CreateSecret.go @@ -17,35 +17,49 @@ import ( // connection information to access a database or other service, which Secrets // Manager doesn't encrypt. A secret in Secrets Manager consists of both the // protected secret data and the important information needed to manage the secret. -// For secrets that use managed rotation, you need to create the secret through the -// managing service. For more information, see Secrets Manager secrets managed by -// other Amazon Web Services services (https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html) -// . For information about creating a secret in the console, see Create a secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html) -// . To create a secret, you can provide the secret value to be encrypted in either +// +// For secrets that use managed rotation, you need to create the secret through +// the managing service. For more information, see [Secrets Manager secrets managed by other Amazon Web Services services]. +// +// For information about creating a secret in the console, see [Create a secret]. +// +// To create a secret, you can provide the secret value to be encrypted in either // the SecretString parameter or the SecretBinary parameter, but not both. If you // include SecretString or SecretBinary then Secrets Manager creates an initial // secret version and automatically attaches the staging label AWSCURRENT to it. +// // For database credentials you want to rotate, for Secrets Manager to be able to // rotate the secret, you must make sure the JSON you store in the SecretString -// matches the JSON structure of a database secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_secret_json_structure.html) -// . If you don't specify an KMS encryption key, Secrets Manager uses the Amazon -// Web Services managed key aws/secretsmanager . If this key doesn't already exist -// in your account, then Secrets Manager creates it for you automatically. All -// users and roles in the Amazon Web Services account automatically have access to -// use aws/secretsmanager . Creating aws/secretsmanager can result in a one-time -// significant delay in returning the result. If the secret is in a different -// Amazon Web Services account from the credentials calling the API, then you can't -// use aws/secretsmanager to encrypt the secret, and you must create and use a -// customer managed KMS key. Secrets Manager generates a CloudTrail log entry when -// you call this action. Do not include sensitive information in request parameters -// except SecretBinary or SecretString because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:CreateSecret . If you include tags in the -// secret, you also need secretsmanager:TagResource . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . To encrypt the secret with a KMS key other than aws/secretsmanager , you need +// matches the [JSON structure of a database secret]. +// +// If you don't specify an KMS encryption key, Secrets Manager uses the Amazon Web +// Services managed key aws/secretsmanager . If this key doesn't already exist in +// your account, then Secrets Manager creates it for you automatically. All users +// and roles in the Amazon Web Services account automatically have access to use +// aws/secretsmanager . Creating aws/secretsmanager can result in a one-time +// significant delay in returning the result. +// +// If the secret is in a different Amazon Web Services account from the +// credentials calling the API, then you can't use aws/secretsmanager to encrypt +// the secret, and you must create and use a customer managed KMS key. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters except SecretBinary or +// SecretString because it might be logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:CreateSecret . If you include tags in the +// secret, you also need secretsmanager:TagResource . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// To encrypt the secret with a KMS key other than aws/secretsmanager , you need // kms:GenerateDataKey and kms:Decrypt permission to the key. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Secrets Manager secrets managed by other Amazon Web Services services]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html +// [Create a secret]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [JSON structure of a database secret]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_secret_json_structure.html func (c *Client) CreateSecret(ctx context.Context, params *CreateSecretInput, optFns ...func(*Options)) (*CreateSecretOutput, error) { if params == nil { params = &CreateSecretInput{} @@ -63,12 +77,15 @@ func (c *Client) CreateSecret(ctx context.Context, params *CreateSecretInput, op type CreateSecretInput struct { - // The name of the new secret. The secret name can contain ASCII letters, numbers, - // and the following characters: /_+=.@- Do not end your secret name with a hyphen - // followed by six characters. If you do so, you risk confusion and unexpected - // results when searching for a secret by partial ARN. Secrets Manager - // automatically adds a hyphen and six random characters after the secret name at - // the end of the ARN. + // The name of the new secret. + // + // The secret name can contain ASCII letters, numbers, and the following + // characters: /_+=.@- + // + // Do not end your secret name with a hyphen followed by six characters. If you do + // so, you risk confusion and unexpected results when searching for a secret by + // partial ARN. Secrets Manager automatically adds a hyphen and six random + // characters after the secret name at the end of the ARN. // // This member is required. Name *string @@ -78,26 +95,36 @@ type CreateSecretInput struct { // If you include SecretString or SecretBinary , then Secrets Manager creates an // initial version for the secret, and this parameter specifies the unique - // identifier for the new version. If you use the Amazon Web Services CLI or one of - // the Amazon Web Services SDKs to call this operation, then you can leave this - // parameter empty. The CLI or SDK generates a random UUID for you and includes it - // as the value for this parameter in the request. If you generate a raw HTTP - // request to the Secrets Manager service endpoint, then you must generate a - // ClientRequestToken and include it in the request. This value helps ensure - // idempotency. Secrets Manager uses this value to prevent the accidental creation - // of duplicate versions if there are failures and retries during a rotation. We - // recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) - // value to ensure uniqueness of your versions within the specified secret. + // identifier for the new version. + // + // If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs + // to call this operation, then you can leave this parameter empty. The CLI or SDK + // generates a random UUID for you and includes it as the value for this parameter + // in the request. + // + // If you generate a raw HTTP request to the Secrets Manager service endpoint, + // then you must generate a ClientRequestToken and include it in the request. + // + // This value helps ensure idempotency. Secrets Manager uses this value to prevent + // the accidental creation of duplicate versions if there are failures and retries + // during a rotation. We recommend that you generate a [UUID-type]value to ensure uniqueness + // of your versions within the specified secret. + // // - If the ClientRequestToken value isn't already associated with a version of // the secret then a new version of the secret is created. + // // - If a version with this value already exists and the version SecretString and // SecretBinary values are the same as those in the request, then the request is // ignored. + // // - If a version with this value already exists and that version's SecretString // and SecretBinary values are different from those in the request, then the - // request fails because you cannot modify an existing version. Instead, use - // PutSecretValue to create a new version. + // request fails because you cannot modify an existing version. Instead, use PutSecretValueto + // create a new version. + // // This value becomes the VersionId of the new version. + // + // [UUID-type]: https://wikipedia.org/wiki/Universally_unique_identifier ClientRequestToken *string // The description of the secret. @@ -109,50 +136,67 @@ type CreateSecretInput struct { // The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt // the secret value in the secret. An alias is always prefixed by alias/ , for - // example alias/aws/secretsmanager . For more information, see About aliases (https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html) - // . To use a KMS key in a different account, use the key ARN or the alias ARN. If - // you don't specify this value, then Secrets Manager uses the key + // example alias/aws/secretsmanager . For more information, see [About aliases]. + // + // To use a KMS key in a different account, use the key ARN or the alias ARN. + // + // If you don't specify this value, then Secrets Manager uses the key // aws/secretsmanager . If that key doesn't yet exist, then Secrets Manager creates - // it for you automatically the first time it encrypts the secret value. If the - // secret is in a different Amazon Web Services account from the credentials - // calling the API, then you can't use aws/secretsmanager to encrypt the secret, - // and you must create and use a customer managed KMS key. + // it for you automatically the first time it encrypts the secret value. + // + // If the secret is in a different Amazon Web Services account from the + // credentials calling the API, then you can't use aws/secretsmanager to encrypt + // the secret, and you must create and use a customer managed KMS key. + // + // [About aliases]: https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html KmsKeyId *string // The binary data to encrypt and store in the new version of the secret. We // recommend that you store your binary data in a file and then pass the contents - // of the file as a parameter. Either SecretString or SecretBinary must have a - // value, but not both. This parameter is not available in the Secrets Manager - // console. + // of the file as a parameter. + // + // Either SecretString or SecretBinary must have a value, but not both. + // + // This parameter is not available in the Secrets Manager console. SecretBinary []byte // The text data to encrypt and store in this new version of the secret. We // recommend you use a JSON structure of key/value pairs for your secret value. - // Either SecretString or SecretBinary must have a value, but not both. If you - // create a secret by using the Secrets Manager console then Secrets Manager puts - // the protected secret text in only the SecretString parameter. The Secrets - // Manager console stores the information as a JSON structure of key/value pairs - // that a Lambda rotation function can parse. + // + // Either SecretString or SecretBinary must have a value, but not both. + // + // If you create a secret by using the Secrets Manager console then Secrets + // Manager puts the protected secret text in only the SecretString parameter. The + // Secrets Manager console stores the information as a JSON structure of key/value + // pairs that a Lambda rotation function can parse. SecretString *string // A list of tags to attach to the secret. Each tag is a key and value pair of // strings in a JSON text string, for example: - // [{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}] + // + // [{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}] + // // Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a - // different tag from one with key "abc". If you check tags in permissions policies - // as part of your security strategy, then adding or removing a tag can change - // permissions. If the completion of this operation would result in you losing your - // permissions for this secret, then Secrets Manager blocks the operation and - // returns an Access Denied error. For more information, see Control access to - // secrets using tags (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac) - // and Limit access to identities with tags that match secrets' tags (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2) - // . For information about how to format a JSON parameter for the various command - // line tool environments, see Using JSON for Parameters (https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json) - // . If your command-line tool or SDK requires quotation marks around the - // parameter, you should use single quotes to avoid confusion with the double - // quotes required in the JSON text. For tag quotas and naming restrictions, see - // Service quotas for Tagging (https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas) - // in the Amazon Web Services General Reference guide. + // different tag from one with key "abc". + // + // If you check tags in permissions policies as part of your security strategy, + // then adding or removing a tag can change permissions. If the completion of this + // operation would result in you losing your permissions for this secret, then + // Secrets Manager blocks the operation and returns an Access Denied error. For + // more information, see [Control access to secrets using tags]and [Limit access to identities with tags that match secrets' tags]. + // + // For information about how to format a JSON parameter for the various command + // line tool environments, see [Using JSON for Parameters]. If your command-line tool or SDK requires + // quotation marks around the parameter, you should use single quotes to avoid + // confusion with the double quotes required in the JSON text. + // + // For tag quotas and naming restrictions, see [Service quotas for Tagging] in the Amazon Web Services General + // Reference guide. + // + // [Limit access to identities with tags that match secrets' tags]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2 + // [Using JSON for Parameters]: https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json + // [Service quotas for Tagging]: https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas + // [Control access to secrets using tags]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac Tags []types.Tag noSmithyDocumentSerde @@ -170,9 +214,12 @@ type CreateSecretOutput struct { Name *string // A list of the replicas of this secret and their status: + // // - Failed , which indicates that the replica was not created. + // // - InProgress , which indicates that Secrets Manager is in the process of // creating the replica. + // // - InSync , which indicates that the replica was created. ReplicationStatus []types.ReplicationStatusType diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteResourcePolicy.go index 46e5b479..4d8772a4 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteResourcePolicy.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteResourcePolicy.go @@ -11,14 +11,18 @@ import ( ) // Deletes the resource-based permission policy attached to the secret. To attach -// a policy to a secret, use PutResourcePolicy . Secrets Manager generates a -// CloudTrail log entry when you call this action. Do not include sensitive -// information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:DeleteResourcePolicy . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// a policy to a secret, use PutResourcePolicy. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:DeleteResourcePolicy . For more +// information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) DeleteResourcePolicy(ctx context.Context, params *DeleteResourcePolicyInput, optFns ...func(*Options)) (*DeleteResourcePolicyOutput, error) { if params == nil { params = &DeleteResourcePolicyInput{} @@ -37,9 +41,11 @@ func (c *Client) DeleteResourcePolicy(ctx context.Context, params *DeleteResourc type DeleteResourcePolicyInput struct { // The ARN or name of the secret to delete the attached resource-based policy for. + // // For an ARN, we recommend that you specify a complete ARN rather than a partial - // ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteSecret.go index f34999b0..153f42b7 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DeleteSecret.go @@ -15,31 +15,41 @@ import ( // during which you can restore the secret. The minimum recovery window is 7 days. // The default recovery window is 30 days. Secrets Manager attaches a DeletionDate // stamp to the secret that specifies the end of the recovery window. At the end of -// the recovery window, Secrets Manager deletes the secret permanently. You can't -// delete a primary secret that is replicated to other Regions. You must first -// delete the replicas using RemoveRegionsFromReplication , and then delete the -// primary secret. When you delete a replica, it is deleted immediately. You can't -// directly delete a version of a secret. Instead, you remove all staging labels -// from the version using UpdateSecretVersionStage . This marks the version as -// deprecated, and then Secrets Manager can automatically delete the version in the -// background. To determine whether an application still uses a secret, you can -// create an Amazon CloudWatch alarm to alert you to any attempts to access a -// secret during the recovery window. For more information, see Monitor secrets -// scheduled for deletion (https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring_cloudwatch_deleted-secrets.html) -// . Secrets Manager performs the permanent secret deletion at the end of the +// the recovery window, Secrets Manager deletes the secret permanently. +// +// You can't delete a primary secret that is replicated to other Regions. You must +// first delete the replicas using RemoveRegionsFromReplication, and then delete the primary secret. When you +// delete a replica, it is deleted immediately. +// +// You can't directly delete a version of a secret. Instead, you remove all +// staging labels from the version using UpdateSecretVersionStage. This marks the version as deprecated, +// and then Secrets Manager can automatically delete the version in the background. +// +// To determine whether an application still uses a secret, you can create an +// Amazon CloudWatch alarm to alert you to any attempts to access a secret during +// the recovery window. For more information, see [Monitor secrets scheduled for deletion]. +// +// Secrets Manager performs the permanent secret deletion at the end of the // waiting period as a background task with low priority. There is no guarantee of -// a specific time after the recovery window for the permanent delete to occur. At -// any time before recovery window ends, you can use RestoreSecret to remove the -// DeletionDate and cancel the deletion of the secret. When a secret is scheduled -// for deletion, you cannot retrieve the secret value. You must first cancel the -// deletion with RestoreSecret and then you can retrieve the secret. Secrets -// Manager generates a CloudTrail log entry when you call this action. Do not -// include sensitive information in request parameters because it might be logged. -// For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:DeleteSecret . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// a specific time after the recovery window for the permanent delete to occur. +// +// At any time before recovery window ends, you can use RestoreSecret to remove the DeletionDate +// and cancel the deletion of the secret. +// +// When a secret is scheduled for deletion, you cannot retrieve the secret value. +// You must first cancel the deletion with RestoreSecretand then you can retrieve the secret. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:DeleteSecret . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Monitor secrets scheduled for deletion]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring_cloudwatch_deleted-secrets.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) DeleteSecret(ctx context.Context, params *DeleteSecretInput, optFns ...func(*Options)) (*DeleteSecretOutput, error) { if params == nil { params = &DeleteSecretInput{} @@ -57,10 +67,12 @@ func (c *Client) DeleteSecret(ctx context.Context, params *DeleteSecretInput, op type DeleteSecretInput struct { - // The ARN or name of the secret to delete. For an ARN, we recommend that you - // specify a complete ARN rather than a partial ARN. See Finding a secret from a - // partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret to delete. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -68,17 +80,20 @@ type DeleteSecretInput struct { // Specifies whether to delete the secret without any recovery window. You can't // use both this parameter and RecoveryWindowInDays in the same call. If you don't // use either, then by default Secrets Manager uses a 30 day recovery window. + // // Secrets Manager performs the actual deletion with an asynchronous background // process, so there might be a short delay before the secret is permanently // deleted. If you delete a secret and then immediately create a secret with the - // same name, use appropriate back off and retry logic. If you forcibly delete an - // already deleted or nonexistent secret, the operation does not return - // ResourceNotFoundException . Use this parameter with caution. This parameter - // causes the operation to skip the normal recovery window before the permanent - // deletion that Secrets Manager would normally impose with the - // RecoveryWindowInDays parameter. If you delete a secret with the - // ForceDeleteWithoutRecovery parameter, then you have no opportunity to recover - // the secret. You lose the secret permanently. + // same name, use appropriate back off and retry logic. + // + // If you forcibly delete an already deleted or nonexistent secret, the operation + // does not return ResourceNotFoundException . + // + // Use this parameter with caution. This parameter causes the operation to skip + // the normal recovery window before the permanent deletion that Secrets Manager + // would normally impose with the RecoveryWindowInDays parameter. If you delete a + // secret with the ForceDeleteWithoutRecovery parameter, then you have no + // opportunity to recover the secret. You lose the secret permanently. ForceDeleteWithoutRecovery *bool // The number of days from 7 to 30 that Secrets Manager waits before permanently diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DescribeSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DescribeSecret.go index 0eb7526c..be73019d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DescribeSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_DescribeSecret.go @@ -14,13 +14,17 @@ import ( // Retrieves the details of a secret. It does not include the encrypted secret // value. Secrets Manager only returns fields that have a value in the response. +// // Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:DescribeSecret . For more information, -// see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:DescribeSecret . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) DescribeSecret(ctx context.Context, params *DescribeSecretInput, optFns ...func(*Options)) (*DescribeSecretOutput, error) { if params == nil { params = &DescribeSecretInput{} @@ -38,9 +42,12 @@ func (c *Client) DescribeSecret(ctx context.Context, params *DescribeSecretInput type DescribeSecretInput struct { - // The ARN or name of the secret. For an ARN, we recommend that you specify a - // complete ARN rather than a partial ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -60,9 +67,11 @@ type DescribeSecretOutput struct { // deletion, this field is omitted. When you delete a secret, Secrets Manager // requires a recovery window of at least 7 days before deleting the secret. Some // time after the deleted date, Secrets Manager deletes the secret, including all - // of its versions. If a secret is scheduled for deletion, then its details, - // including the encrypted secret value, is not accessible. To cancel a scheduled - // deletion and restore access to the secret, use RestoreSecret . + // of its versions. + // + // If a secret is scheduled for deletion, then its details, including the + // encrypted secret value, is not accessible. To cancel a scheduled deletion and + // restore access to the secret, use RestoreSecret. DeletedDate *time.Time // The description of the secret. @@ -93,15 +102,17 @@ type DescribeSecretOutput struct { // isn't configured for rotation or rotation has been disabled, Secrets Manager // returns null. If rotation fails, Secrets Manager retries the entire rotation // process multiple times. If rotation is unsuccessful, this date may be in the - // past. This date represents the latest date that rotation will occur, but it is - // not an approximate rotation date. In some cases, for example if you turn off - // automatic rotation and then turn it back on, the next rotation may occur much - // sooner than this date. + // past. + // + // This date represents the latest date that rotation will occur, but it is not an + // approximate rotation date. In some cases, for example if you turn off automatic + // rotation and then turn it back on, the next rotation may occur much sooner than + // this date. NextRotationDate *time.Time - // The ID of the service that created this secret. For more information, see - // Secrets managed by other Amazon Web Services services (https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html) - // . + // The ID of the service that created this secret. For more information, see [Secrets managed by other Amazon Web Services services]. + // + // [Secrets managed by other Amazon Web Services services]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html OwningService *string // The Region the secret is in. If a secret is replicated to other Regions, the @@ -109,14 +120,18 @@ type DescribeSecretOutput struct { PrimaryRegion *string // A list of the replicas of this secret and their status: + // // - Failed , which indicates that the replica was not created. + // // - InProgress , which indicates that Secrets Manager is in the process of // creating the replica. + // // - InSync , which indicates that the replica was created. ReplicationStatus []types.ReplicationStatusType - // Specifies whether automatic rotation is turned on for this secret. To turn on - // rotation, use RotateSecret . To turn off rotation, use CancelRotateSecret . + // Specifies whether automatic rotation is turned on for this secret. + // + // To turn on rotation, use RotateSecret. To turn off rotation, use CancelRotateSecret. RotationEnabled *bool // The ARN of the Lambda function that Secrets Manager invokes to rotate the @@ -129,25 +144,32 @@ type DescribeSecretOutput struct { // rotation turned on, this field is omitted. RotationRules *types.RotationRulesType - // The list of tags attached to the secret. To add tags to a secret, use - // TagResource . To remove tags, use UntagResource . + // The list of tags attached to the secret. To add tags to a secret, use TagResource. To + // remove tags, use UntagResource. Tags []types.Tag // A list of the versions of the secret that have staging labels attached. // Versions that don't have staging labels are considered deprecated and Secrets - // Manager can delete them. Secrets Manager uses staging labels to indicate the - // status of a secret version during rotation. The three staging labels for - // rotation are: + // Manager can delete them. + // + // Secrets Manager uses staging labels to indicate the status of a secret version + // during rotation. The three staging labels for rotation are: + // // - AWSCURRENT , which indicates the current version of the secret. + // // - AWSPENDING , which indicates the version of the secret that contains new // secret information that will become the next current version when rotation - // finishes. During rotation, Secrets Manager creates an AWSPENDING version ID - // before creating the new secret version. To check if a secret version exists, - // call GetSecretValue . + // finishes. + // + // During rotation, Secrets Manager creates an AWSPENDING version ID before + // creating the new secret version. To check if a secret version exists, call GetSecretValue. + // // - AWSPREVIOUS , which indicates the previous current version of the secret. // You can use this as the last known good version. - // For more information about rotation and staging labels, see How rotation works (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) - // . + // + // For more information about rotation and staging labels, see [How rotation works]. + // + // [How rotation works]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html VersionIdsToStages map[string][]string // Metadata pertaining to the operation's result. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetRandomPassword.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetRandomPassword.go index f310b6e0..857fe52d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetRandomPassword.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetRandomPassword.go @@ -14,12 +14,15 @@ import ( // and include every character type that the system you are generating a password // for can support. By default, Secrets Manager uses uppercase and lowercase // letters, numbers, and the following characters in passwords: -// !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ Secrets Manager generates a CloudTrail log -// entry when you call this action. Required permissions: -// secretsmanager:GetRandomPassword . For more information, see IAM policy -// actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ +// +// Secrets Manager generates a CloudTrail log entry when you call this action. +// +// Required permissions: secretsmanager:GetRandomPassword . For more information, +// see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) GetRandomPassword(ctx context.Context, params *GetRandomPasswordInput, optFns ...func(*Options)) (*GetRandomPasswordOutput, error) { if params == nil { params = &GetRandomPasswordInput{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetResourcePolicy.go index ce67c7e1..3a2e6c68 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetResourcePolicy.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetResourcePolicy.go @@ -12,14 +12,19 @@ import ( // Retrieves the JSON text of the resource-based policy document attached to the // secret. For more information about permissions policies attached to a secret, -// see Permissions policies attached to a secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-policies.html) -// . Secrets Manager generates a CloudTrail log entry when you call this action. Do +// see [Permissions policies attached to a secret]. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:GetResourcePolicy . For more information, -// see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:GetResourcePolicy . For more information, +// see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Permissions policies attached to a secret]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-policies.html func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolicyInput, optFns ...func(*Options)) (*GetResourcePolicyOutput, error) { if params == nil { params = &GetResourcePolicyInput{} @@ -38,9 +43,12 @@ func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolic type GetResourcePolicyInput struct { // The ARN or name of the secret to retrieve the attached resource-based policy - // for. For an ARN, we recommend that you specify a complete ARN rather than a - // partial ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // for. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -57,9 +65,9 @@ type GetResourcePolicyOutput struct { Name *string // A JSON-formatted string that contains the permissions policy attached to the - // secret. For more information about permissions policies, see Authentication and - // access control for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) - // . + // secret. For more information about permissions policies, see [Authentication and access control for Secrets Manager]. + // + // [Authentication and access control for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html ResourcePolicy *string // Metadata pertaining to the operation's result. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetSecretValue.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetSecretValue.go index 5f099252..16a7f98d 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetSecretValue.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_GetSecretValue.go @@ -12,23 +12,31 @@ import ( ) // Retrieves the contents of the encrypted fields SecretString or SecretBinary -// from the specified version of a secret, whichever contains content. To retrieve -// the values for a group of secrets, call BatchGetSecretValue . We recommend that -// you cache your secret values by using client-side caching. Caching secrets -// improves speed and reduces your costs. For more information, see Cache secrets -// for your applications (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets.html) -// . To retrieve the previous version of a secret, use VersionStage and specify -// AWSPREVIOUS. To revert to the previous version of a secret, call -// UpdateSecretVersionStage (https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/update-secret-version-stage.html) -// . Secrets Manager generates a CloudTrail log entry when you call this action. Do +// from the specified version of a secret, whichever contains content. +// +// To retrieve the values for a group of secrets, call BatchGetSecretValue. +// +// We recommend that you cache your secret values by using client-side caching. +// Caching secrets improves speed and reduces your costs. For more information, see +// [Cache secrets for your applications]. +// +// To retrieve the previous version of a secret, use VersionStage and specify +// AWSPREVIOUS. To revert to the previous version of a secret, call [UpdateSecretVersionStage]. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:GetSecretValue . If the secret is -// encrypted using a customer-managed key instead of the Amazon Web Services -// managed key aws/secretsmanager , then you also need kms:Decrypt permissions for -// that key. For more information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:GetSecretValue . If the secret is encrypted +// using a customer-managed key instead of the Amazon Web Services managed key +// aws/secretsmanager , then you also need kms:Decrypt permissions for that key. +// For more information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [UpdateSecretVersionStage]: https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/update-secret-version-stage.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Cache secrets for your applications]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets.html func (c *Client) GetSecretValue(ctx context.Context, params *GetSecretValueInput, optFns ...func(*Options)) (*GetSecretValueOutput, error) { if params == nil { params = &GetSecretValueInput{} @@ -46,10 +54,12 @@ func (c *Client) GetSecretValue(ctx context.Context, params *GetSecretValueInput type GetSecretValueInput struct { - // The ARN or name of the secret to retrieve. For an ARN, we recommend that you - // specify a complete ARN rather than a partial ARN. See Finding a secret from a - // partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret to retrieve. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -57,15 +67,18 @@ type GetSecretValueInput struct { // The unique identifier of the version of the secret to retrieve. If you include // both this parameter and VersionStage , the two parameters must refer to the same // secret version. If you don't specify either a VersionStage or VersionId , then - // Secrets Manager returns the AWSCURRENT version. This value is typically a - // UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) value with - // 32 hexadecimal digits. + // Secrets Manager returns the AWSCURRENT version. + // + // This value is typically a [UUID-type] value with 32 hexadecimal digits. + // + // [UUID-type]: https://wikipedia.org/wiki/Universally_unique_identifier VersionId *string - // The staging label of the version of the secret to retrieve. Secrets Manager - // uses staging labels to keep track of different versions during the rotation - // process. If you include both this parameter and VersionId , the two parameters - // must refer to the same secret version. If you don't specify either a + // The staging label of the version of the secret to retrieve. + // + // Secrets Manager uses staging labels to keep track of different versions during + // the rotation process. If you include both this parameter and VersionId , the two + // parameters must refer to the same secret version. If you don't specify either a // VersionStage or VersionId , Secrets Manager returns the AWSCURRENT version. VersionStage *string @@ -88,16 +101,18 @@ type GetSecretValueOutput struct { // The decrypted secret value, if the secret value was originally provided as // binary data in the form of a byte array. When you retrieve a SecretBinary using // the HTTP API, the Python SDK, or the Amazon Web Services CLI, the value is - // Base64-encoded. Otherwise, it is not encoded. If the secret was created by using - // the Secrets Manager console, or if the secret value was originally provided as a - // string, then this field is omitted. The secret value appears in SecretString - // instead. + // Base64-encoded. Otherwise, it is not encoded. + // + // If the secret was created by using the Secrets Manager console, or if the + // secret value was originally provided as a string, then this field is omitted. + // The secret value appears in SecretString instead. SecretBinary []byte // The decrypted secret value, if the secret value was originally provided as a - // string or through the Secrets Manager console. If this secret was created by - // using the console, then Secrets Manager stores the information as a JSON - // structure of key/value pairs. + // string or through the Secrets Manager console. + // + // If this secret was created by using the console, then Secrets Manager stores + // the information as a JSON structure of key/value pairs. SecretString *string // The unique identifier of this version of the secret. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecretVersionIds.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecretVersionIds.go index 53ff4c41..0cb7f524 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecretVersionIds.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecretVersionIds.go @@ -12,16 +12,21 @@ import ( ) // Lists the versions of a secret. Secrets Manager uses staging labels to indicate -// the different versions of a secret. For more information, see Secrets Manager -// concepts: Versions (https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version) -// . To list the secrets in the account, use ListSecrets . Secrets Manager -// generates a CloudTrail log entry when you call this action. Do not include -// sensitive information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:ListSecretVersionIds . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// the different versions of a secret. For more information, see [Secrets Manager concepts: Versions]. +// +// To list the secrets in the account, use ListSecrets. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:ListSecretVersionIds . For more +// information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Secrets Manager concepts: Versions]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) ListSecretVersionIds(ctx context.Context, params *ListSecretVersionIdsInput, optFns ...func(*Options)) (*ListSecretVersionIdsOutput, error) { if params == nil { params = &ListSecretVersionIdsInput{} @@ -39,10 +44,12 @@ func (c *Client) ListSecretVersionIds(ctx context.Context, params *ListSecretVer type ListSecretVersionIdsInput struct { - // The ARN or name of the secret whose versions you want to list. For an ARN, we - // recommend that you specify a complete ARN rather than a partial ARN. See - // Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret whose versions you want to list. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -53,9 +60,11 @@ type ListSecretVersionIdsInput struct { // without staging labels aren't included. IncludeDeprecated *bool - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call ListSecretVersionIds again with the value from NextToken . + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call ListSecretVersionIds again with the + // value from NextToken . MaxResults *int32 // A token that indicates where the output should continue from, if a previous @@ -179,9 +188,11 @@ var _ ListSecretVersionIdsAPIClient = (*Client)(nil) // ListSecretVersionIdsPaginatorOptions is the paginator options for // ListSecretVersionIds type ListSecretVersionIdsPaginatorOptions struct { - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call ListSecretVersionIds again with the value from NextToken . + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call ListSecretVersionIds again with the + // value from NextToken . Limit int32 // Set to true if pagination should stop if the service returns a pagination token diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecrets.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecrets.go index 318cda1b..7ebdc309 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecrets.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ListSecrets.go @@ -13,20 +13,29 @@ import ( // Lists the secrets that are stored by Secrets Manager in the Amazon Web Services // account, not including secrets that are marked for deletion. To see secrets -// marked for deletion, use the Secrets Manager console. All Secrets Manager -// operations are eventually consistent. ListSecrets might not reflect changes from -// the last five minutes. You can get more recent information for a specific secret -// by calling DescribeSecret . To list the versions of a secret, use -// ListSecretVersionIds . To retrieve the values for the secrets, call -// BatchGetSecretValue or GetSecretValue . For information about finding secrets in -// the console, see Find secrets in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html) -// . Secrets Manager generates a CloudTrail log entry when you call this action. Do +// marked for deletion, use the Secrets Manager console. +// +// All Secrets Manager operations are eventually consistent. ListSecrets might not +// reflect changes from the last five minutes. You can get more recent information +// for a specific secret by calling DescribeSecret. +// +// To list the versions of a secret, use ListSecretVersionIds. +// +// To retrieve the values for the secrets, call BatchGetSecretValue or GetSecretValue. +// +// For information about finding secrets in the console, see [Find secrets in Secrets Manager]. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:ListSecrets . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:ListSecrets . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Find secrets in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html func (c *Client) ListSecrets(ctx context.Context, params *ListSecretsInput, optFns ...func(*Options)) (*ListSecretsOutput, error) { if params == nil { params = &ListSecretsInput{} @@ -51,9 +60,11 @@ type ListSecretsInput struct { // secrets scheduled for deletion aren't included. IncludePlannedDeletion *bool - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call ListSecrets again with the value from NextToken . + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call ListSecrets again with the value from + // NextToken . MaxResults *int32 // A token that indicates where the output should continue from, if a previous @@ -169,9 +180,11 @@ var _ ListSecretsAPIClient = (*Client)(nil) // ListSecretsPaginatorOptions is the paginator options for ListSecrets type ListSecretsPaginatorOptions struct { - // The number of results to include in the response. If there are more results - // available, in the response, Secrets Manager includes NextToken . To get the next - // results, call ListSecrets again with the value from NextToken . + // The number of results to include in the response. + // + // If there are more results available, in the response, Secrets Manager includes + // NextToken . To get the next results, call ListSecrets again with the value from + // NextToken . Limit int32 // Set to true if pagination should stop if the service returns a pagination token diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutResourcePolicy.go index 5351e284..a3e36689 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutResourcePolicy.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutResourcePolicy.go @@ -11,17 +11,22 @@ import ( ) // Attaches a resource-based permission policy to a secret. A resource-based -// policy is optional. For more information, see Authentication and access control -// for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// For information about attaching a policy in the console, see Attach a -// permissions policy to a secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html) -// . Secrets Manager generates a CloudTrail log entry when you call this action. Do +// policy is optional. For more information, see [Authentication and access control for Secrets Manager] +// +// For information about attaching a policy in the console, see [Attach a permissions policy to a secret]. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:PutResourcePolicy . For more information, -// see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:PutResourcePolicy . For more information, +// see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Attach a permissions policy to a secret]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Authentication and access control for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolicyInput, optFns ...func(*Options)) (*PutResourcePolicyOutput, error) { if params == nil { params = &PutResourcePolicyInput{} @@ -40,16 +45,19 @@ func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolic type PutResourcePolicyInput struct { // A JSON-formatted string for an Amazon Web Services resource-based policy. For - // example policies, see Permissions policy examples (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html) - // . + // example policies, see [Permissions policy examples]. + // + // [Permissions policy examples]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html // // This member is required. ResourcePolicy *string - // The ARN or name of the secret to attach the resource-based policy. For an ARN, - // we recommend that you specify a complete ARN rather than a partial ARN. See - // Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret to attach the resource-based policy. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -57,6 +65,22 @@ type PutResourcePolicyInput struct { // Specifies whether to block resource-based policies that allow broad access to // the secret, for example those that use a wildcard for the principal. By default, // public policies aren't blocked. + // + // Resource policy validation and the BlockPublicPolicy parameter help protect + // your resources by preventing public access from being granted through the + // resource policies that are directly attached to your secrets. In addition to + // using these features, carefully inspect the following policies to confirm that + // they do not grant public access: + // + // - Identity-based policies attached to associated Amazon Web Services + // principals (for example, IAM roles) + // + // - Resource-based policies attached to associated Amazon Web Services + // resources (for example, Key Management Service (KMS) keys) + // + // To review permissions to your secrets, see [Determine who has permissions to your secrets]. + // + // [Determine who has permissions to your secrets]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/determine-acccess_examine-iam-policies.html BlockPublicPolicy *bool noSmithyDocumentSerde diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutSecretValue.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutSecretValue.go index 0304d3bb..b82eb6c1 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutSecretValue.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_PutSecretValue.go @@ -12,32 +12,41 @@ import ( // Creates a new version with a new encrypted secret value and attaches it to the // secret. The version can contain a new SecretString value or a new SecretBinary -// value. We recommend you avoid calling PutSecretValue at a sustained rate of -// more than once every 10 minutes. When you update the secret value, Secrets -// Manager creates a new version of the secret. Secrets Manager removes outdated -// versions when there are more than 100, but it does not remove versions created -// less than 24 hours ago. If you call PutSecretValue more than once every 10 -// minutes, you create more versions than Secrets Manager removes, and you will -// reach the quota for secret versions. You can specify the staging labels to -// attach to the new version in VersionStages . If you don't include VersionStages -// , then Secrets Manager automatically moves the staging label AWSCURRENT to this -// version. If this operation creates the first version for the secret, then -// Secrets Manager automatically attaches the staging label AWSCURRENT to it. If -// this operation moves the staging label AWSCURRENT from another version to this -// version, then Secrets Manager also automatically moves the staging label -// AWSPREVIOUS to the version that AWSCURRENT was removed from. This operation is -// idempotent. If you call this operation with a ClientRequestToken that matches -// an existing version's VersionId, and you specify the same secret data, the -// operation succeeds but does nothing. However, if the secret data is different, -// then the operation fails because you can't modify an existing version; you can -// only create new ones. Secrets Manager generates a CloudTrail log entry when you -// call this action. Do not include sensitive information in request parameters -// except SecretBinary or SecretString because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:PutSecretValue . For more information, -// see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// value. +// +// We recommend you avoid calling PutSecretValue at a sustained rate of more than +// once every 10 minutes. When you update the secret value, Secrets Manager creates +// a new version of the secret. Secrets Manager removes outdated versions when +// there are more than 100, but it does not remove versions created less than 24 +// hours ago. If you call PutSecretValue more than once every 10 minutes, you +// create more versions than Secrets Manager removes, and you will reach the quota +// for secret versions. +// +// You can specify the staging labels to attach to the new version in VersionStages +// . If you don't include VersionStages , then Secrets Manager automatically moves +// the staging label AWSCURRENT to this version. If this operation creates the +// first version for the secret, then Secrets Manager automatically attaches the +// staging label AWSCURRENT to it. If this operation moves the staging label +// AWSCURRENT from another version to this version, then Secrets Manager also +// automatically moves the staging label AWSPREVIOUS to the version that AWSCURRENT +// was removed from. +// +// This operation is idempotent. If you call this operation with a +// ClientRequestToken that matches an existing version's VersionId, and you specify +// the same secret data, the operation succeeds but does nothing. However, if the +// secret data is different, then the operation fails because you can't modify an +// existing version; you can only create new ones. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters except SecretBinary or +// SecretString because it might be logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:PutSecretValue . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) PutSecretValue(ctx context.Context, params *PutSecretValueInput, optFns ...func(*Options)) (*PutSecretValueOutput, error) { if params == nil { params = &PutSecretValueInput{} @@ -55,57 +64,79 @@ func (c *Client) PutSecretValue(ctx context.Context, params *PutSecretValueInput type PutSecretValueInput struct { - // The ARN or name of the secret to add a new version to. For an ARN, we recommend - // that you specify a complete ARN rather than a partial ARN. See Finding a secret - // from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . If the secret doesn't already exist, use CreateSecret instead. + // The ARN or name of the secret to add a new version to. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // If the secret doesn't already exist, use CreateSecret instead. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string - // A unique identifier for the new version of the secret. If you use the Amazon - // Web Services CLI or one of the Amazon Web Services SDKs to call this operation, - // then you can leave this parameter empty. The CLI or SDK generates a random UUID - // for you and includes it as the value for this parameter in the request. If you - // generate a raw HTTP request to the Secrets Manager service endpoint, then you - // must generate a ClientRequestToken and include it in the request. This value - // helps ensure idempotency. Secrets Manager uses this value to prevent the - // accidental creation of duplicate versions if there are failures and retries - // during a rotation. We recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) - // value to ensure uniqueness of your versions within the specified secret. + // A unique identifier for the new version of the secret. + // + // If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs + // to call this operation, then you can leave this parameter empty. The CLI or SDK + // generates a random UUID for you and includes it as the value for this parameter + // in the request. + // + // If you generate a raw HTTP request to the Secrets Manager service endpoint, + // then you must generate a ClientRequestToken and include it in the request. + // + // This value helps ensure idempotency. Secrets Manager uses this value to prevent + // the accidental creation of duplicate versions if there are failures and retries + // during a rotation. We recommend that you generate a [UUID-type]value to ensure uniqueness + // of your versions within the specified secret. + // // - If the ClientRequestToken value isn't already associated with a version of // the secret then a new version of the secret is created. + // // - If a version with this value already exists and that version's SecretString // or SecretBinary values are the same as those in the request then the request // is ignored. The operation is idempotent. + // // - If a version with this value already exists and the version of the // SecretString and SecretBinary values are different from those in the request, // then the request fails because you can't modify a secret version. You can only // create new versions to store new secret values. + // // This value becomes the VersionId of the new version. + // + // [UUID-type]: https://wikipedia.org/wiki/Universally_unique_identifier ClientRequestToken *string // The binary data to encrypt and store in the new version of the secret. To use // this parameter in the command-line tools, we recommend that you store your - // binary data in a file and then pass the contents of the file as a parameter. You - // must include SecretBinary or SecretString , but not both. You can't access this - // value from the Secrets Manager console. + // binary data in a file and then pass the contents of the file as a parameter. + // + // You must include SecretBinary or SecretString , but not both. + // + // You can't access this value from the Secrets Manager console. SecretBinary []byte - // The text to encrypt and store in the new version of the secret. You must - // include SecretBinary or SecretString , but not both. We recommend you create the - // secret string as JSON key/value pairs, as shown in the example. + // The text to encrypt and store in the new version of the secret. + // + // You must include SecretBinary or SecretString , but not both. + // + // We recommend you create the secret string as JSON key/value pairs, as shown in + // the example. SecretString *string // A list of staging labels to attach to this version of the secret. Secrets // Manager uses staging labels to track versions of a secret through the rotation - // process. If you specify a staging label that's already associated with a - // different version of the same secret, then Secrets Manager removes the label - // from the other version and attaches it to this version. If you specify - // AWSCURRENT , and it is already attached to another version, then Secrets Manager - // also moves the staging label AWSPREVIOUS to the version that AWSCURRENT was - // removed from. If you don't include VersionStages , then Secrets Manager - // automatically moves the staging label AWSCURRENT to this version. + // process. + // + // If you specify a staging label that's already associated with a different + // version of the same secret, then Secrets Manager removes the label from the + // other version and attaches it to this version. If you specify AWSCURRENT , and + // it is already attached to another version, then Secrets Manager also moves the + // staging label AWSPREVIOUS to the version that AWSCURRENT was removed from. + // + // If you don't include VersionStages , then Secrets Manager automatically moves + // the staging label AWSCURRENT to this version. VersionStages []string noSmithyDocumentSerde diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RemoveRegionsFromReplication.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RemoveRegionsFromReplication.go index 404d3e4a..44950e25 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RemoveRegionsFromReplication.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RemoveRegionsFromReplication.go @@ -12,14 +12,18 @@ import ( ) // For a secret that is replicated to other Regions, deletes the secret replicas -// from the Regions you specify. Secrets Manager generates a CloudTrail log entry -// when you call this action. Do not include sensitive information in request -// parameters because it might be logged. For more information, see Logging -// Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:RemoveRegionsFromReplication . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// from the Regions you specify. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:RemoveRegionsFromReplication . For more +// information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) RemoveRegionsFromReplication(ctx context.Context, params *RemoveRegionsFromReplicationInput, optFns ...func(*Options)) (*RemoveRegionsFromReplicationOutput, error) { if params == nil { params = &RemoveRegionsFromReplicationInput{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ReplicateSecretToRegions.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ReplicateSecretToRegions.go index 896017c3..e6115da0 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ReplicateSecretToRegions.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ReplicateSecretToRegions.go @@ -11,17 +11,22 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Replicates the secret to a new Regions. See Multi-Region secrets (https://docs.aws.amazon.com/secretsmanager/latest/userguide/create-manage-multi-region-secrets.html) -// . Secrets Manager generates a CloudTrail log entry when you call this action. Do +// Replicates the secret to a new Regions. See [Multi-Region secrets]. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:ReplicateSecretToRegions . If the primary +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:ReplicateSecretToRegions . If the primary // secret is encrypted with a KMS key other than aws/secretsmanager , you also need // kms:Decrypt permission to the key. To encrypt the replicated secret with a KMS // key other than aws/secretsmanager , you need kms:GenerateDataKey and kms:Encrypt -// to the key. For more information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// to the key. For more information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Multi-Region secrets]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/create-manage-multi-region-secrets.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) ReplicateSecretToRegions(ctx context.Context, params *ReplicateSecretToRegionsInput, optFns ...func(*Options)) (*ReplicateSecretToRegionsOutput, error) { if params == nil { params = &ReplicateSecretToRegionsInput{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RestoreSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RestoreSecret.go index db3b6622..adcd8ce4 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RestoreSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RestoreSecret.go @@ -11,14 +11,18 @@ import ( ) // Cancels the scheduled deletion of a secret by removing the DeletedDate time -// stamp. You can access a secret again after it has been restored. Secrets Manager -// generates a CloudTrail log entry when you call this action. Do not include -// sensitive information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:RestoreSecret . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// stamp. You can access a secret again after it has been restored. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:RestoreSecret . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) RestoreSecret(ctx context.Context, params *RestoreSecretInput, optFns ...func(*Options)) (*RestoreSecretOutput, error) { if params == nil { params = &RestoreSecretInput{} @@ -36,10 +40,12 @@ func (c *Client) RestoreSecret(ctx context.Context, params *RestoreSecretInput, type RestoreSecretInput struct { - // The ARN or name of the secret to restore. For an ARN, we recommend that you - // specify a complete ARN rather than a partial ARN. See Finding a secret from a - // partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret to restore. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RotateSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RotateSecret.go index f5ea3c9b..7d11126c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RotateSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_RotateSecret.go @@ -12,28 +12,35 @@ import ( ) // Configures and starts the asynchronous process of rotating the secret. For -// information about rotation, see Rotate secrets (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html) -// in the Secrets Manager User Guide. If you include the configuration parameters, -// the operation sets the values for the secret and then immediately starts a -// rotation. If you don't include the configuration parameters, the operation -// starts a rotation with the values already stored in the secret. When rotation is -// successful, the AWSPENDING staging label might be attached to the same version -// as the AWSCURRENT version, or it might not be attached to any version. If the -// AWSPENDING staging label is present but not attached to the same version as -// AWSCURRENT , then any later invocation of RotateSecret assumes that a previous -// rotation request is still in progress and returns an error. When rotation is -// unsuccessful, the AWSPENDING staging label might be attached to an empty secret -// version. For more information, see Troubleshoot rotation (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot_rotation.html) -// in the Secrets Manager User Guide. Secrets Manager generates a CloudTrail log -// entry when you call this action. Do not include sensitive information in request -// parameters because it might be logged. For more information, see Logging -// Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:RotateSecret . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . You also need lambda:InvokeFunction permissions on the rotation function. For -// more information, see Permissions for rotation (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html) -// . +// information about rotation, see [Rotate secrets]in the Secrets Manager User Guide. If you +// include the configuration parameters, the operation sets the values for the +// secret and then immediately starts a rotation. If you don't include the +// configuration parameters, the operation starts a rotation with the values +// already stored in the secret. +// +// When rotation is successful, the AWSPENDING staging label might be attached to +// the same version as the AWSCURRENT version, or it might not be attached to any +// version. If the AWSPENDING staging label is present but not attached to the +// same version as AWSCURRENT , then any later invocation of RotateSecret assumes +// that a previous rotation request is still in progress and returns an error. When +// rotation is unsuccessful, the AWSPENDING staging label might be attached to an +// empty secret version. For more information, see [Troubleshoot rotation]in the Secrets Manager User +// Guide. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:RotateSecret . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. You also need lambda:InvokeFunction permissions on the rotation function. +// For more information, see [Permissions for rotation]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Permissions for rotation]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html +// [Rotate secrets]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Troubleshoot rotation]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot_rotation.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) RotateSecret(ctx context.Context, params *RotateSecretInput, optFns ...func(*Options)) (*RotateSecretOutput, error) { if params == nil { params = &RotateSecretInput{} @@ -51,42 +58,56 @@ func (c *Client) RotateSecret(ctx context.Context, params *RotateSecretInput, op type RotateSecretInput struct { - // The ARN or name of the secret to rotate. For an ARN, we recommend that you - // specify a complete ARN rather than a partial ARN. See Finding a secret from a - // partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret to rotate. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string // A unique identifier for the new version of the secret. You only need to specify // this value if you implement your own retry logic and you want to ensure that - // Secrets Manager doesn't attempt to create a secret version twice. If you use the - // Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this - // operation, then you can leave this parameter empty. The CLI or SDK generates a - // random UUID for you and includes it as the value for this parameter in the - // request. If you generate a raw HTTP request to the Secrets Manager service - // endpoint, then you must generate a ClientRequestToken and include it in the - // request. This value helps ensure idempotency. Secrets Manager uses this value to - // prevent the accidental creation of duplicate versions if there are failures and - // retries during a rotation. We recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) - // value to ensure uniqueness of your versions within the specified secret. + // Secrets Manager doesn't attempt to create a secret version twice. + // + // If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs + // to call this operation, then you can leave this parameter empty. The CLI or SDK + // generates a random UUID for you and includes it as the value for this parameter + // in the request. + // + // If you generate a raw HTTP request to the Secrets Manager service endpoint, + // then you must generate a ClientRequestToken and include it in the request. + // + // This value helps ensure idempotency. Secrets Manager uses this value to prevent + // the accidental creation of duplicate versions if there are failures and retries + // during a rotation. We recommend that you generate a [UUID-type]value to ensure uniqueness + // of your versions within the specified secret. + // + // [UUID-type]: https://wikipedia.org/wiki/Universally_unique_identifier ClientRequestToken *string // Specifies whether to rotate the secret immediately or wait until the next - // scheduled rotation window. The rotation schedule is defined in - // RotateSecretRequest$RotationRules . For secrets that use a Lambda rotation - // function to rotate, if you don't immediately rotate the secret, Secrets Manager - // tests the rotation configuration by running the testSecret step (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) - // of the Lambda rotation function. The test creates an AWSPENDING version of the - // secret and then removes it. By default, Secrets Manager rotates the secret - // immediately. + // scheduled rotation window. The rotation schedule is defined in RotateSecretRequest$RotationRules. + // + // For secrets that use a Lambda rotation function to rotate, if you don't + // immediately rotate the secret, Secrets Manager tests the rotation configuration + // by running the [testSecret step]testSecret of the Lambda rotation function. The test creates an + // AWSPENDING version of the secret and then removes it. + // + // By default, Secrets Manager rotates the secret immediately. + // + // [testSecret step]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html RotateImmediately *bool // For secrets that use a Lambda rotation function to rotate, the ARN of the - // Lambda rotation function. For secrets that use managed rotation, omit this - // field. For more information, see Managed rotation (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_managed.html) - // in the Secrets Manager User Guide. + // Lambda rotation function. + // + // For secrets that use managed rotation, omit this field. For more information, + // see [Managed rotation]in the Secrets Manager User Guide. + // + // [Managed rotation]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_managed.html RotationLambdaARN *string // A structure that defines the rotation configuration for this secret. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_StopReplicationToReplica.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_StopReplicationToReplica.go index 8f1a14f1..b32fc01e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_StopReplicationToReplica.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_StopReplicationToReplica.go @@ -11,16 +11,21 @@ import ( ) // Removes the link between the replica secret and the primary secret and promotes -// the replica to a primary secret in the replica Region. You must call this -// operation from the Region in which you want to promote the replica to a primary -// secret. Secrets Manager generates a CloudTrail log entry when you call this -// action. Do not include sensitive information in request parameters because it -// might be logged. For more information, see Logging Secrets Manager events with -// CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:StopReplicationToReplica . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// the replica to a primary secret in the replica Region. +// +// You must call this operation from the Region in which you want to promote the +// replica to a primary secret. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:StopReplicationToReplica . For more +// information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) StopReplicationToReplica(ctx context.Context, params *StopReplicationToReplicaInput, optFns ...func(*Options)) (*StopReplicationToReplicaOutput, error) { if params == nil { params = &StopReplicationToReplicaInput{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_TagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_TagResource.go index 774df63f..a59d84f2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_TagResource.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_TagResource.go @@ -13,20 +13,27 @@ import ( // Attaches tags to a secret. Tags consist of a key name and a value. Tags are // part of the secret's metadata. They are not associated with specific versions of -// the secret. This operation appends tags to the existing list of tags. For tag -// quotas and naming restrictions, see Service quotas for Tagging (https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas) -// in the Amazon Web Services General Reference guide. If you use tags as part of -// your security strategy, then adding or removing a tag can change permissions. If -// successfully completing this operation would result in you losing your -// permissions for this secret, then the operation is blocked and returns an Access -// Denied error. Secrets Manager generates a CloudTrail log entry when you call -// this action. Do not include sensitive information in request parameters because -// it might be logged. For more information, see Logging Secrets Manager events -// with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:TagResource . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// the secret. This operation appends tags to the existing list of tags. +// +// For tag quotas and naming restrictions, see [Service quotas for Tagging] in the Amazon Web Services General +// Reference guide. +// +// If you use tags as part of your security strategy, then adding or removing a +// tag can change permissions. If successfully completing this operation would +// result in you losing your permissions for this secret, then the operation is +// blocked and returns an Access Denied error. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:TagResource . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Service quotas for Tagging]: https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { if params == nil { params = &TagResourceInput{} @@ -45,20 +52,24 @@ func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optF type TagResourceInput struct { // The identifier for the secret to attach tags to. You can specify either the - // Amazon Resource Name (ARN) or the friendly name of the secret. For an ARN, we - // recommend that you specify a complete ARN rather than a partial ARN. See - // Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // Amazon Resource Name (ARN) or the friendly name of the secret. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string // The tags to attach to the secret as a JSON text string argument. Each element - // in the list consists of a Key and a Value . For storing multiple values, we - // recommend that you use a JSON text string argument and specify key/value pairs. - // For more information, see Specifying parameter values for the Amazon Web - // Services CLI (https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html) - // in the Amazon Web Services CLI User Guide. + // in the list consists of a Key and a Value . + // + // For storing multiple values, we recommend that you use a JSON text string + // argument and specify key/value pairs. For more information, see [Specifying parameter values for the Amazon Web Services CLI]in the Amazon + // Web Services CLI User Guide. + // + // [Specifying parameter values for the Amazon Web Services CLI]: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html // // This member is required. Tags []types.Tag diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UntagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UntagResource.go index faabca5e..f089be8e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UntagResource.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UntagResource.go @@ -10,19 +10,26 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Removes specific tags from a secret. This operation is idempotent. If a -// requested tag is not attached to the secret, no error is returned and the secret -// metadata is unchanged. If you use tags as part of your security strategy, then -// removing a tag can change permissions. If successfully completing this operation -// would result in you losing your permissions for this secret, then the operation -// is blocked and returns an Access Denied error. Secrets Manager generates a -// CloudTrail log entry when you call this action. Do not include sensitive -// information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:UntagResource . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// Removes specific tags from a secret. +// +// This operation is idempotent. If a requested tag is not attached to the secret, +// no error is returned and the secret metadata is unchanged. +// +// If you use tags as part of your security strategy, then removing a tag can +// change permissions. If successfully completing this operation would result in +// you losing your permissions for this secret, then the operation is blocked and +// returns an Access Denied error. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:UntagResource . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { if params == nil { params = &UntagResourceInput{} @@ -40,19 +47,26 @@ func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, type UntagResourceInput struct { - // The ARN or name of the secret. For an ARN, we recommend that you specify a - // complete ARN rather than a partial ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string // A list of tag key names to remove from the secret. You don't specify the value. - // Both the key and its associated value are removed. This parameter requires a - // JSON text string argument. For storing multiple values, we recommend that you - // use a JSON text string argument and specify key/value pairs. For more - // information, see Specifying parameter values for the Amazon Web Services CLI (https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html) - // in the Amazon Web Services CLI User Guide. + // Both the key and its associated value are removed. + // + // This parameter requires a JSON text string argument. + // + // For storing multiple values, we recommend that you use a JSON text string + // argument and specify key/value pairs. For more information, see [Specifying parameter values for the Amazon Web Services CLI]in the Amazon + // Web Services CLI User Guide. + // + // [Specifying parameter values for the Amazon Web Services CLI]: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters.html // // This member is required. TagKeys []string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecret.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecret.go index a18d0335..336e9ab1 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecret.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecret.go @@ -11,37 +11,47 @@ import ( ) // Modifies the details of a secret, including metadata and the secret value. To -// change the secret value, you can also use PutSecretValue . To change the -// rotation configuration of a secret, use RotateSecret instead. To change a -// secret so that it is managed by another service, you need to recreate the secret -// in that service. See Secrets Manager secrets managed by other Amazon Web -// Services services (https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html) -// . We recommend you avoid calling UpdateSecret at a sustained rate of more than +// change the secret value, you can also use PutSecretValue. +// +// To change the rotation configuration of a secret, use RotateSecret instead. +// +// To change a secret so that it is managed by another service, you need to +// recreate the secret in that service. See [Secrets Manager secrets managed by other Amazon Web Services services]. +// +// We recommend you avoid calling UpdateSecret at a sustained rate of more than // once every 10 minutes. When you call UpdateSecret to update the secret value, // Secrets Manager creates a new version of the secret. Secrets Manager removes // outdated versions when there are more than 100, but it does not remove versions // created less than 24 hours ago. If you update the secret value more than once // every 10 minutes, you create more versions than Secrets Manager removes, and you -// will reach the quota for secret versions. If you include SecretString or -// SecretBinary to create a new secret version, Secrets Manager automatically moves -// the staging label AWSCURRENT to the new version. Then it attaches the label -// AWSPREVIOUS to the version that AWSCURRENT was removed from. If you call this -// operation with a ClientRequestToken that matches an existing version's VersionId -// , the operation results in an error. You can't modify an existing version, you -// can only create a new version. To remove a version, remove all staging labels -// from it. See UpdateSecretVersionStage . Secrets Manager generates a CloudTrail -// log entry when you call this action. Do not include sensitive information in -// request parameters except SecretBinary or SecretString because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:UpdateSecret . For more information, see -// IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . If you use a customer managed key, you must also have kms:GenerateDataKey , -// kms:Encrypt , and kms:Decrypt permissions on the key. If you change the KMS key -// and you don't have kms:Encrypt permission to the new key, Secrets Manager does -// not re-ecrypt existing secret versions with the new key. For more information, -// see Secret encryption and decryption (https://docs.aws.amazon.com/secretsmanager/latest/userguide/security-encryption.html) -// . +// will reach the quota for secret versions. +// +// If you include SecretString or SecretBinary to create a new secret version, +// Secrets Manager automatically moves the staging label AWSCURRENT to the new +// version. Then it attaches the label AWSPREVIOUS to the version that AWSCURRENT +// was removed from. +// +// If you call this operation with a ClientRequestToken that matches an existing +// version's VersionId , the operation results in an error. You can't modify an +// existing version, you can only create a new version. To remove a version, remove +// all staging labels from it. See UpdateSecretVersionStage. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters except SecretBinary or +// SecretString because it might be logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:UpdateSecret . For more information, see [IAM policy actions for Secrets Manager] +// and [Authentication and access control in Secrets Manager]. If you use a customer managed key, you must also have kms:GenerateDataKey +// , kms:Encrypt , and kms:Decrypt permissions on the key. If you change the KMS +// key and you don't have kms:Encrypt permission to the new key, Secrets Manager +// does not re-ecrypt existing secret versions with the new key. For more +// information, see [Secret encryption and decryption]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Secret encryption and decryption]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/security-encryption.html +// [Secrets Manager secrets managed by other Amazon Web Services services]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) UpdateSecret(ctx context.Context, params *UpdateSecretInput, optFns ...func(*Options)) (*UpdateSecretOutput, error) { if params == nil { params = &UpdateSecretInput{} @@ -59,25 +69,34 @@ func (c *Client) UpdateSecret(ctx context.Context, params *UpdateSecretInput, op type UpdateSecretInput struct { - // The ARN or name of the secret. For an ARN, we recommend that you specify a - // complete ARN rather than a partial ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // The ARN or name of the secret. + // + // For an ARN, we recommend that you specify a complete ARN rather than a partial + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string // If you include SecretString or SecretBinary , then Secrets Manager creates a new // version for the secret, and this parameter specifies the unique identifier for - // the new version. If you use the Amazon Web Services CLI or one of the Amazon Web - // Services SDKs to call this operation, then you can leave this parameter empty. - // The CLI or SDK generates a random UUID for you and includes it as the value for - // this parameter in the request. If you generate a raw HTTP request to the Secrets - // Manager service endpoint, then you must generate a ClientRequestToken and - // include it in the request. This value helps ensure idempotency. Secrets Manager - // uses this value to prevent the accidental creation of duplicate versions if - // there are failures and retries during a rotation. We recommend that you generate - // a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) value to - // ensure uniqueness of your versions within the specified secret. + // the new version. + // + // If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs + // to call this operation, then you can leave this parameter empty. The CLI or SDK + // generates a random UUID for you and includes it as the value for this parameter + // in the request. + // + // If you generate a raw HTTP request to the Secrets Manager service endpoint, + // then you must generate a ClientRequestToken and include it in the request. + // + // This value helps ensure idempotency. Secrets Manager uses this value to prevent + // the accidental creation of duplicate versions if there are failures and retries + // during a rotation. We recommend that you generate a [UUID-type]value to ensure uniqueness + // of your versions within the specified secret. + // + // [UUID-type]: https://wikipedia.org/wiki/Universally_unique_identifier ClientRequestToken *string // The description of the secret. @@ -88,32 +107,41 @@ type UpdateSecretInput struct { // AWSCURRENT , AWSPENDING , or AWSPREVIOUS . If you don't have kms:Encrypt // permission to the new key, Secrets Manager does not re-ecrypt existing secret // versions with the new key. For more information about versions and staging - // labels, see Concepts: Version (https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version) - // . A key alias is always prefixed by alias/ , for example - // alias/aws/secretsmanager . For more information, see About aliases (https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html) - // . If you set this to an empty string, Secrets Manager uses the Amazon Web + // labels, see [Concepts: Version]. + // + // A key alias is always prefixed by alias/ , for example alias/aws/secretsmanager + // . For more information, see [About aliases]. + // + // If you set this to an empty string, Secrets Manager uses the Amazon Web // Services managed key aws/secretsmanager . If this key doesn't already exist in // your account, then Secrets Manager creates it for you automatically. All users // and roles in the Amazon Web Services account automatically have access to use // aws/secretsmanager . Creating aws/secretsmanager can result in a one-time - // significant delay in returning the result. You can only use the Amazon Web - // Services managed key aws/secretsmanager if you call this operation using - // credentials from the same Amazon Web Services account that owns the secret. If - // the secret is in a different account, then you must use a customer managed key - // and provide the ARN of that KMS key in this field. The user making the call must - // have permissions to both the secret and the KMS key in their respective - // accounts. + // significant delay in returning the result. + // + // You can only use the Amazon Web Services managed key aws/secretsmanager if you + // call this operation using credentials from the same Amazon Web Services account + // that owns the secret. If the secret is in a different account, then you must use + // a customer managed key and provide the ARN of that KMS key in this field. The + // user making the call must have permissions to both the secret and the KMS key in + // their respective accounts. + // + // [Concepts: Version]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version + // [About aliases]: https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html KmsKeyId *string // The binary data to encrypt and store in the new version of the secret. We // recommend that you store your binary data in a file and then pass the contents - // of the file as a parameter. Either SecretBinary or SecretString must have a - // value, but not both. You can't access this parameter in the Secrets Manager - // console. + // of the file as a parameter. + // + // Either SecretBinary or SecretString must have a value, but not both. + // + // You can't access this parameter in the Secrets Manager console. SecretBinary []byte // The text data to encrypt and store in the new version of the secret. We // recommend you use a JSON structure of key/value pairs for your secret value. + // // Either SecretBinary or SecretString must have a value, but not both. SecretString *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecretVersionStage.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecretVersionStage.go index 922bb7fe..cf266679 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecretVersionStage.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_UpdateSecretVersionStage.go @@ -16,21 +16,31 @@ import ( // time. To add a staging label to a version when it is already attached to another // version, Secrets Manager first removes it from the other version first and then // attaches it to this one. For more information about versions and staging labels, -// see Concepts: Version (https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version) -// . The staging labels that you specify in the VersionStage parameter are added -// to the existing list of staging labels for the version. You can move the -// AWSCURRENT staging label to this version by including it in this call. Whenever -// you move AWSCURRENT , Secrets Manager automatically moves the label AWSPREVIOUS -// to the version that AWSCURRENT was removed from. If this action results in the -// last label being removed from a version, then the version is considered to be -// 'deprecated' and can be deleted by Secrets Manager. Secrets Manager generates a -// CloudTrail log entry when you call this action. Do not include sensitive -// information in request parameters because it might be logged. For more -// information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:UpdateSecretVersionStage . For more -// information, see IAM policy actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// see [Concepts: Version]. +// +// The staging labels that you specify in the VersionStage parameter are added to +// the existing list of staging labels for the version. +// +// You can move the AWSCURRENT staging label to this version by including it in +// this call. +// +// Whenever you move AWSCURRENT , Secrets Manager automatically moves the label +// AWSPREVIOUS to the version that AWSCURRENT was removed from. +// +// If this action results in the last label being removed from a version, then the +// version is considered to be 'deprecated' and can be deleted by Secrets Manager. +// +// Secrets Manager generates a CloudTrail log entry when you call this action. Do +// not include sensitive information in request parameters because it might be +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:UpdateSecretVersionStage . For more +// information, see [IAM policy actions for Secrets Manager]and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [Concepts: Version]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/getting-started.html#term_version +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions func (c *Client) UpdateSecretVersionStage(ctx context.Context, params *UpdateSecretVersionStageInput, optFns ...func(*Options)) (*UpdateSecretVersionStageOutput, error) { if params == nil { params = &UpdateSecretVersionStageInput{} @@ -49,9 +59,11 @@ func (c *Client) UpdateSecretVersionStage(ctx context.Context, params *UpdateSec type UpdateSecretVersionStageInput struct { // The ARN or the name of the secret with the version and staging labelsto modify. + // // For an ARN, we recommend that you specify a complete ARN rather than a partial - // ARN. See Finding a secret from a partial ARN (https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen) - // . + // ARN. See [Finding a secret from a partial ARN]. + // + // [Finding a secret from a partial ARN]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen // // This member is required. SecretId *string @@ -62,9 +74,10 @@ type UpdateSecretVersionStageInput struct { VersionStage *string // The ID of the version to add the staging label to. To remove a label from a - // version, then do not specify this parameter. If the staging label is already - // attached to a different version of the secret, then you must also specify the - // RemoveFromVersionId parameter. + // version, then do not specify this parameter. + // + // If the staging label is already attached to a different version of the secret, + // then you must also specify the RemoveFromVersionId parameter. MoveToVersionId *string // The ID of the version that the staging label is to be removed from. If the diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ValidateResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ValidateResourcePolicy.go index ac161518..eef801a0 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ValidateResourcePolicy.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/api_op_ValidateResourcePolicy.go @@ -12,23 +12,29 @@ import ( ) // Validates that a resource policy does not grant a wide range of principals -// access to your secret. A resource-based policy is optional for secrets. The API -// performs three checks when validating the policy: -// - Sends a call to Zelkova (https://aws.amazon.com/blogs/security/protect-sensitive-data-in-the-cloud-with-automated-reasoning-zelkova/) -// , an automated reasoning engine, to ensure your resource policy does not allow -// broad access to your secret, for example policies that use a wildcard for the -// principal. +// access to your secret. A resource-based policy is optional for secrets. +// +// The API performs three checks when validating the policy: +// +// - Sends a call to [Zelkova], an automated reasoning engine, to ensure your resource +// policy does not allow broad access to your secret, for example policies that use +// a wildcard for the principal. +// // - Checks for correct syntax in a policy. +// // - Verifies the policy does not lock out a caller. // // Secrets Manager generates a CloudTrail log entry when you call this action. Do // not include sensitive information in request parameters because it might be -// logged. For more information, see Logging Secrets Manager events with CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html) -// . Required permissions: secretsmanager:ValidateResourcePolicy and -// secretsmanager:PutResourcePolicy . For more information, see IAM policy -// actions for Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions) -// and Authentication and access control in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html) -// . +// logged. For more information, see [Logging Secrets Manager events with CloudTrail]. +// +// Required permissions: secretsmanager:ValidateResourcePolicy and +// secretsmanager:PutResourcePolicy . For more information, see [IAM policy actions for Secrets Manager] and [Authentication and access control in Secrets Manager]. +// +// [Authentication and access control in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html +// [Logging Secrets Manager events with CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html +// [IAM policy actions for Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions +// [Zelkova]: https://aws.amazon.com/blogs/security/protect-sensitive-data-in-the-cloud-with-automated-reasoning-zelkova/ func (c *Client) ValidateResourcePolicy(ctx context.Context, params *ValidateResourcePolicyInput, optFns ...func(*Options)) (*ValidateResourcePolicyOutput, error) { if params == nil { params = &ValidateResourcePolicyInput{} @@ -48,8 +54,9 @@ type ValidateResourcePolicyInput struct { // A JSON-formatted string that contains an Amazon Web Services resource-based // policy. The policy in the string identifies who can access or manage this secret - // and its versions. For example policies, see Permissions policy examples (https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html) - // . + // and its versions. For example policies, see [Permissions policy examples]. + // + // [Permissions policy examples]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html // // This member is required. ResourcePolicy *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/doc.go index e3e68d83..2d0ba2e6 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/doc.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/doc.go @@ -3,29 +3,43 @@ // Package secretsmanager provides the API client, operations, and parameter types // for AWS Secrets Manager. // -// Amazon Web Services Secrets Manager Amazon Web Services Secrets Manager -// provides a service to enable you to store, manage, and retrieve, secrets. This -// guide provides descriptions of the Secrets Manager API. For more information -// about using this service, see the Amazon Web Services Secrets Manager User Guide (https://docs.aws.amazon.com/secretsmanager/latest/userguide/introduction.html) -// . API Version This version of the Secrets Manager API Reference documents the -// Secrets Manager API version 2017-10-17. For a list of endpoints, see Amazon Web -// Services Secrets Manager endpoints (https://docs.aws.amazon.com/secretsmanager/latest/userguide/asm_access.html#endpoints) -// . Support and Feedback for Amazon Web Services Secrets Manager We welcome your -// feedback. Send your comments to awssecretsmanager-feedback@amazon.com (mailto:awssecretsmanager-feedback@amazon.com) -// , or post your feedback and questions in the Amazon Web Services Secrets -// Manager Discussion Forum (http://forums.aws.amazon.com/forum.jspa?forumID=296) . -// For more information about the Amazon Web Services Discussion Forums, see -// Forums Help (http://forums.aws.amazon.com/help.jspa) . Logging API Requests +// # Amazon Web Services Secrets Manager +// +// Amazon Web Services Secrets Manager provides a service to enable you to store, +// manage, and retrieve, secrets. +// +// This guide provides descriptions of the Secrets Manager API. For more +// information about using this service, see the [Amazon Web Services Secrets Manager User Guide]. +// +// # API Version +// +// This version of the Secrets Manager API Reference documents the Secrets Manager +// API version 2017-10-17. +// +// For a list of endpoints, see [Amazon Web Services Secrets Manager endpoints]. +// +// # Support and Feedback for Amazon Web Services Secrets Manager +// +// We welcome your feedback. Send your comments to awssecretsmanager-feedback@amazon.com, or post your feedback and +// questions in the [Amazon Web Services Secrets Manager Discussion Forum]. For more information about the Amazon Web Services +// Discussion Forums, see [Forums Help]. +// +// # Logging API Requests +// // Amazon Web Services Secrets Manager supports Amazon Web Services CloudTrail, a // service that records Amazon Web Services API calls for your Amazon Web Services // account and delivers log files to an Amazon S3 bucket. By using information // that's collected by Amazon Web Services CloudTrail, you can determine the // requests successfully made to Secrets Manager, who made the request, when it was // made, and so on. For more about Amazon Web Services Secrets Manager and support -// for Amazon Web Services CloudTrail, see Logging Amazon Web Services Secrets -// Manager Events with Amazon Web Services CloudTrail (https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring.html#monitoring_cloudtrail) -// in the Amazon Web Services Secrets Manager User Guide. To learn more about -// CloudTrail, including enabling it and find your log files, see the Amazon Web -// Services CloudTrail User Guide (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html) -// . +// for Amazon Web Services CloudTrail, see [Logging Amazon Web Services Secrets Manager Events with Amazon Web Services CloudTrail]in the Amazon Web Services Secrets +// Manager User Guide. To learn more about CloudTrail, including enabling it and +// find your log files, see the [Amazon Web Services CloudTrail User Guide]. +// +// [Forums Help]: http://forums.aws.amazon.com/help.jspa +// [Amazon Web Services CloudTrail User Guide]: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html +// [Amazon Web Services Secrets Manager endpoints]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/asm_access.html#endpoints +// [Amazon Web Services Secrets Manager User Guide]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/introduction.html +// [Amazon Web Services Secrets Manager Discussion Forum]: http://forums.aws.amazon.com/forum.jspa?forumID=296 +// [Logging Amazon Web Services Secrets Manager Events with Amazon Web Services CloudTrail]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring.html#monitoring_cloudtrail package secretsmanager diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/go_module_metadata.go index fb0c1009..163f9edf 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/go_module_metadata.go @@ -3,4 +3,4 @@ package secretsmanager // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.28.4" +const goModuleVersion = "1.28.7" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/options.go index a8817523..7f022a39 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/options.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/options.go @@ -50,8 +50,10 @@ type Options struct { // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a // value for this field will likely prevent you from using any endpoint-related // service features released after the introduction of EndpointResolverV2 and - // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom - // endpoint, set the client option BaseEndpoint instead. + // BaseEndpoint. + // + // To migrate an EndpointResolver implementation that uses a custom endpoint, set + // the client option BaseEndpoint instead. EndpointResolver EndpointResolver // Resolves the endpoint used for a particular service operation. This should be @@ -74,17 +76,20 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. If specified in an operation call's - // functional options with a value that is different than the constructed client's - // Options, the Client's Retryer will be wrapped to use the operation's specific - // RetryMaxAttempts value. + // per operation call's retry max attempts. + // + // If specified in an operation call's functional options with a value that is + // different than the constructed client's Options, the Client's Retryer will be + // wrapped to use the operation's specific RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if - // Retryer option is not also specified. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. Currently does not support per operation call - // overrides, may in the future. + // Retryer option is not also specified. + // + // When creating a new API Clients this member will only be used if the Retryer + // Options member is nil. This value will be ignored if Retryer is not nil. + // + // Currently does not support per operation call overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable @@ -101,8 +106,9 @@ type Options struct { // The initial DefaultsMode used when the client options were constructed. If the // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved - // value was at that point in time. Currently does not support per operation call - // overrides, may in the future. + // value was at that point in time. + // + // Currently does not support per operation call overrides, may in the future. resolvedDefaultsMode aws.DefaultsMode // The HTTP client to invoke API calls with. Defaults to client's default HTTP @@ -147,6 +153,7 @@ func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { // Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for // this field will likely prevent you from using any endpoint-related service // features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// // To migrate an EndpointResolver implementation that uses a custom endpoint, set // the client option BaseEndpoint instead. func WithEndpointResolver(v EndpointResolver) func(*Options) { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/enums.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/enums.go index 84f46d0b..e458ec8f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/enums.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/enums.go @@ -16,8 +16,9 @@ const ( ) // Values returns all known values for FilterNameStringType. Note that this can be -// expanded in the future, and so it is only as up to date as the client. The -// ordering of this slice is not guaranteed to be stable across updates. +// expanded in the future, and so it is only as up to date as the client. +// +// The ordering of this slice is not guaranteed to be stable across updates. func (FilterNameStringType) Values() []FilterNameStringType { return []FilterNameStringType{ "description", @@ -39,8 +40,9 @@ const ( ) // Values returns all known values for SortOrderType. Note that this can be -// expanded in the future, and so it is only as up to date as the client. The -// ordering of this slice is not guaranteed to be stable across updates. +// expanded in the future, and so it is only as up to date as the client. +// +// The ordering of this slice is not guaranteed to be stable across updates. func (SortOrderType) Values() []SortOrderType { return []SortOrderType{ "asc", @@ -58,8 +60,9 @@ const ( ) // Values returns all known values for StatusType. Note that this can be expanded -// in the future, and so it is only as up to date as the client. The ordering of -// this slice is not guaranteed to be stable across updates. +// in the future, and so it is only as up to date as the client. +// +// The ordering of this slice is not guaranteed to be stable across updates. func (StatusType) Values() []StatusType { return []StatusType{ "InSync", diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/errors.go index aff130bb..09c59ed1 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/errors.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/errors.go @@ -36,8 +36,9 @@ func (e *DecryptionFailure) ErrorFault() smithy.ErrorFault { return smithy.Fault // Secrets Manager can't encrypt the protected secret text using the provided KMS // key. Check that the KMS key is available, enabled, and not in an invalid state. -// For more information, see Key state: Effect on your KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// . +// For more information, see [Key state: Effect on your KMS key]. +// +// [Key state: Effect on your KMS key]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html type EncryptionFailure struct { Message *string @@ -141,16 +142,20 @@ func (e *InvalidParameterException) ErrorCode() string { } func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// A parameter value is not valid for the current state of the resource. Possible -// causes: +// A parameter value is not valid for the current state of the resource. +// +// Possible causes: +// // - The secret is scheduled for deletion. +// // - You tried to enable rotation on a secret that doesn't already have a Lambda // function ARN configured and you didn't include such an ARN as a parameter in // this call. +// // - The secret is managed by another service, and you must use that service to -// update it. For more information, see Secrets managed by other Amazon Web -// Services services (https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html) -// . +// update it. For more information, see [Secrets managed by other Amazon Web Services services]. +// +// [Secrets managed by other Amazon Web Services services]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html type InvalidRequestException struct { Message *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/types.go b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/types.go index e04e17e7..7b848975 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/types.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/secretsmanager/types/types.go @@ -8,13 +8,12 @@ import ( ) // The error Secrets Manager encountered while retrieving an individual secret as -// part of BatchGetSecretValue . +// part of BatchGetSecretValue. type APIErrorType struct { // The error Secrets Manager encountered while retrieving an individual secret as - // part of BatchGetSecretValue , for example ResourceNotFoundException , - // InvalidParameterException , InvalidRequestException , DecryptionFailure , or - // AccessDeniedException . + // part of BatchGetSecretValue, for example ResourceNotFoundException , InvalidParameterException , + // InvalidRequestException , DecryptionFailure , or AccessDeniedException . ErrorCode *string // A message describing the error. @@ -27,23 +26,33 @@ type APIErrorType struct { } // Allows you to add filters when you use the search function in Secrets Manager. -// For more information, see Find secrets in Secrets Manager (https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html) -// . +// For more information, see [Find secrets in Secrets Manager]. +// +// [Find secrets in Secrets Manager]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html type Filter struct { // The following are keys you can use: + // // - description: Prefix match, not case-sensitive. + // // - name: Prefix match, case-sensitive. + // // - tag-key: Prefix match, case-sensitive. + // // - tag-value: Prefix match, case-sensitive. + // // - primary-region: Prefix match, case-sensitive. + // // - owning-service: Prefix match, case-sensitive. + // // - all: Breaks the filter value string into words and then searches all // attributes for matches. Not case-sensitive. Key FilterNameStringType - // The keyword to filter for. You can prefix your search value with an exclamation - // mark ( ! ) in order to perform negation filters. + // The keyword to filter for. + // + // You can prefix your search value with an exclamation mark ( ! ) in order to + // perform negation filters. Values []string noSmithyDocumentSerde @@ -56,8 +65,9 @@ type ReplicaRegionType struct { // include this field, Secrets Manager uses aws/secretsmanager . KmsKeyId *string - // A Region code. For a list of Region codes, see Name and code of Regions (https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints) - // . + // A Region code. For a list of Region codes, see [Name and code of Regions]. + // + // [Name and code of Regions]: https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints Region *string noSmithyDocumentSerde @@ -94,11 +104,13 @@ type RotationRulesType struct { // must be rotated. If you use this field to set the rotation schedule, Secrets // Manager calculates the next rotation date based on the previous rotation. // Manually updating the secret value by calling PutSecretValue or UpdateSecret is - // considered a valid rotation. In DescribeSecret and ListSecrets , this value is - // calculated from the rotation schedule after every successful rotation. In - // RotateSecret , you can set the rotation schedule in RotationRules with - // AutomaticallyAfterDays or ScheduleExpression , but not both. To set a rotation - // schedule in hours, use ScheduleExpression . + // considered a valid rotation. + // + // In DescribeSecret and ListSecrets , this value is calculated from the rotation + // schedule after every successful rotation. In RotateSecret , you can set the + // rotation schedule in RotationRules with AutomaticallyAfterDays or + // ScheduleExpression , but not both. To set a rotation schedule in hours, use + // ScheduleExpression . AutomaticallyAfterDays *int64 // The length of the rotation window in hours, for example 3h for a three hour @@ -107,39 +119,44 @@ type RotationRulesType struct { // window starts according to the ScheduleExpression . If you don't specify a // Duration , for a ScheduleExpression in hours, the window automatically closes // after one hour. For a ScheduleExpression in days, the window automatically - // closes at the end of the UTC day. For more information, including examples, see - // Schedule expressions in Secrets Manager rotation (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html) + // closes at the end of the UTC day. For more information, including examples, see [Schedule expressions in Secrets Manager rotation] // in the Secrets Manager Users Guide. + // + // [Schedule expressions in Secrets Manager rotation]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Duration *string // A cron() or rate() expression that defines the schedule for rotating your // secret. Secrets Manager rotation schedules use UTC time zone. Secrets Manager - // rotates your secret any time during a rotation window. Secrets Manager rate() - // expressions represent the interval in hours or days that you want to rotate your - // secret, for example rate(12 hours) or rate(10 days) . You can rotate a secret as - // often as every four hours. If you use a rate() expression, the rotation window - // starts at midnight. For a rate in hours, the default rotation window closes - // after one hour. For a rate in days, the default rotation window closes at the - // end of the day. You can set the Duration to change the rotation window. The - // rotation window must not extend into the next UTC day or into the next rotation - // window. You can use a cron() expression to create a rotation schedule that is - // more detailed than a rotation interval. For more information, including - // examples, see Schedule expressions in Secrets Manager rotation (https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html) - // in the Secrets Manager Users Guide. For a cron expression that represents a + // rotates your secret any time during a rotation window. + // + // Secrets Manager rate() expressions represent the interval in hours or days that + // you want to rotate your secret, for example rate(12 hours) or rate(10 days) . + // You can rotate a secret as often as every four hours. If you use a rate() + // expression, the rotation window starts at midnight. For a rate in hours, the + // default rotation window closes after one hour. For a rate in days, the default + // rotation window closes at the end of the day. You can set the Duration to + // change the rotation window. The rotation window must not extend into the next + // UTC day or into the next rotation window. + // + // You can use a cron() expression to create a rotation schedule that is more + // detailed than a rotation interval. For more information, including examples, see + // [Schedule expressions in Secrets Manager rotation]in the Secrets Manager Users Guide. For a cron expression that represents a // schedule in hours, the default rotation window closes after one hour. For a cron // expression that represents a schedule in days, the default rotation window // closes at the end of the day. You can set the Duration to change the rotation // window. The rotation window must not extend into the next UTC day or into the // next rotation window. + // + // [Schedule expressions in Secrets Manager rotation]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html ScheduleExpression *string noSmithyDocumentSerde } // A structure that contains the details about a secret. It does not include the -// encrypted SecretString and SecretBinary values. To get those values, use -// GetSecretValue (https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html) -// . +// encrypted SecretString and SecretBinary values. To get those values, use [GetSecretValue] . +// +// [GetSecretValue]: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html type SecretListEntry struct { // The Amazon Resource Name (ARN) of the secret. @@ -150,9 +167,10 @@ type SecretListEntry struct { // The date and time the deletion of the secret occurred. Not present on active // secrets. The secret can be recovered until the number of days in the recovery - // window has passed, as specified in the RecoveryWindowInDays parameter of the - // DeleteSecret (https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_DeleteSecret.html) - // operation. + // window has passed, as specified in the RecoveryWindowInDays parameter of the [DeleteSecret] + // DeleteSecret operation. + // + // [DeleteSecret]: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_DeleteSecret.html DeletedDate *time.Time // The user-provided description of the secret. @@ -193,8 +211,9 @@ type SecretListEntry struct { // The ARN of an Amazon Web Services Lambda function invoked by Secrets Manager to // rotate and expire the secret either automatically per the schedule or manually - // by a call to RotateSecret (https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_RotateSecret.html) - // . + // by a call to [RotateSecret]RotateSecret . + // + // [RotateSecret]: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_RotateSecret.html RotationLambdaARN *string // A structure that defines the rotation configuration for the secret. @@ -202,15 +221,17 @@ type SecretListEntry struct { // A list of all of the currently assigned SecretVersionStage staging labels and // the SecretVersionId attached to each one. Staging labels are used to keep track - // of the different versions during the rotation process. A version that does not - // have any SecretVersionStage is considered deprecated and subject to deletion. - // Such versions are not included in this list. + // of the different versions during the rotation process. + // + // A version that does not have any SecretVersionStage is considered deprecated + // and subject to deletion. Such versions are not included in this list. SecretVersionsToStages map[string][]string // The list of user-defined tags associated with the secret. To add tags to a - // secret, use TagResource (https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_TagResource.html) - // . To remove tags, use UntagResource (https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_UntagResource.html) - // . + // secret, use [TagResource]TagResource . To remove tags, use [UntagResource]UntagResource . + // + // [TagResource]: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_TagResource.html + // [UntagResource]: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_UntagResource.html Tags []Tag noSmithyDocumentSerde @@ -230,7 +251,9 @@ type SecretValueEntry struct { // The decrypted secret value, if the secret value was originally provided as // binary data in the form of a byte array. The parameter represents the binary - // data as a base64-encoded (https://tools.ietf.org/html/rfc4648#section-4) string. + // data as a [base64-encoded]string. + // + // [base64-encoded]: https://tools.ietf.org/html/rfc4648#section-4 SecretBinary []byte // The decrypted secret value, if the secret value was originally provided as a diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md index 5a508309..1f03ead9 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.20.6 (2024-05-08) + +* **Bug Fix**: GoDoc improvement + +# v1.20.5 (2024-04-05) + +* No change notes available for this release. + +# v1.20.4 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.20.3 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go index 4b21e8b0..44ad9ff1 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go @@ -30,9 +30,10 @@ func (c *Client) GetRoleCredentials(ctx context.Context, params *GetRoleCredenti type GetRoleCredentialsInput struct { - // The token issued by the CreateToken API call. For more information, see - // CreateToken (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) - // in the IAM Identity Center OIDC API Reference Guide. + // The token issued by the CreateToken API call. For more information, see [CreateToken] in the + // IAM Identity Center OIDC API Reference Guide. + // + // [CreateToken]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html // // This member is required. AccessToken *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go index e44da697..5861c9bb 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go @@ -29,9 +29,10 @@ func (c *Client) ListAccountRoles(ctx context.Context, params *ListAccountRolesI type ListAccountRolesInput struct { - // The token issued by the CreateToken API call. For more information, see - // CreateToken (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) - // in the IAM Identity Center OIDC API Reference Guide. + // The token issued by the CreateToken API call. For more information, see [CreateToken] in the + // IAM Identity Center OIDC API Reference Guide. + // + // [CreateToken]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html // // This member is required. AccessToken *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go index 2d7add06..7f2b2397 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go @@ -12,9 +12,10 @@ import ( ) // Lists all AWS accounts assigned to the user. These AWS accounts are assigned by -// the administrator of the account. For more information, see Assign User Access (https://docs.aws.amazon.com/singlesignon/latest/userguide/useraccess.html#assignusers) -// in the IAM Identity Center User Guide. This operation returns a paginated -// response. +// the administrator of the account. For more information, see [Assign User Access]in the IAM Identity +// Center User Guide. This operation returns a paginated response. +// +// [Assign User Access]: https://docs.aws.amazon.com/singlesignon/latest/userguide/useraccess.html#assignusers func (c *Client) ListAccounts(ctx context.Context, params *ListAccountsInput, optFns ...func(*Options)) (*ListAccountsOutput, error) { if params == nil { params = &ListAccountsInput{} @@ -32,9 +33,10 @@ func (c *Client) ListAccounts(ctx context.Context, params *ListAccountsInput, op type ListAccountsInput struct { - // The token issued by the CreateToken API call. For more information, see - // CreateToken (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) - // in the IAM Identity Center OIDC API Reference Guide. + // The token issued by the CreateToken API call. For more information, see [CreateToken] in the + // IAM Identity Center OIDC API Reference Guide. + // + // [CreateToken]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html // // This member is required. AccessToken *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go index 3ee682d1..65f582a8 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go @@ -12,16 +12,20 @@ import ( // Removes the locally stored SSO tokens from the client-side cache and sends an // API call to the IAM Identity Center service to invalidate the corresponding -// server-side IAM Identity Center sign in session. If a user uses IAM Identity -// Center to access the AWS CLI, the user’s IAM Identity Center sign in session is -// used to obtain an IAM session, as specified in the corresponding IAM Identity -// Center permission set. More specifically, IAM Identity Center assumes an IAM -// role in the target account on behalf of the user, and the corresponding -// temporary AWS credentials are returned to the client. After user logout, any -// existing IAM role sessions that were created by using IAM Identity Center -// permission sets continue based on the duration configured in the permission set. -// For more information, see User authentications (https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html) -// in the IAM Identity Center User Guide. +// server-side IAM Identity Center sign in session. +// +// If a user uses IAM Identity Center to access the AWS CLI, the user’s IAM +// Identity Center sign in session is used to obtain an IAM session, as specified +// in the corresponding IAM Identity Center permission set. More specifically, IAM +// Identity Center assumes an IAM role in the target account on behalf of the user, +// and the corresponding temporary AWS credentials are returned to the client. +// +// After user logout, any existing IAM role sessions that were created by using +// IAM Identity Center permission sets continue based on the duration configured in +// the permission set. For more information, see [User authentications]in the IAM Identity Center User +// Guide. +// +// [User authentications]: https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html func (c *Client) Logout(ctx context.Context, params *LogoutInput, optFns ...func(*Options)) (*LogoutOutput, error) { if params == nil { params = &LogoutInput{} @@ -39,9 +43,10 @@ func (c *Client) Logout(ctx context.Context, params *LogoutInput, optFns ...func type LogoutInput struct { - // The token issued by the CreateToken API call. For more information, see - // CreateToken (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) - // in the IAM Identity Center OIDC API Reference Guide. + // The token issued by the CreateToken API call. For more information, see [CreateToken] in the + // IAM Identity Center OIDC API Reference Guide. + // + // [CreateToken]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html // // This member is required. AccessToken *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/doc.go index 59456d5d..7f6e429f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/doc.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/doc.go @@ -6,16 +6,22 @@ // AWS IAM Identity Center (successor to AWS Single Sign-On) Portal is a web // service that makes it easy for you to assign user access to IAM Identity Center // resources such as the AWS access portal. Users can get AWS account applications -// and roles assigned to them and get federated into the application. Although AWS -// Single Sign-On was renamed, the sso and identitystore API namespaces will -// continue to retain their original name for backward compatibility purposes. For -// more information, see IAM Identity Center rename (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed) -// . This reference guide describes the IAM Identity Center Portal operations that +// and roles assigned to them and get federated into the application. +// +// Although AWS Single Sign-On was renamed, the sso and identitystore API +// namespaces will continue to retain their original name for backward +// compatibility purposes. For more information, see [IAM Identity Center rename]. +// +// This reference guide describes the IAM Identity Center Portal operations that // you can call programatically and includes detailed information on data types and -// errors. AWS provides SDKs that consist of libraries and sample code for various +// errors. +// +// AWS provides SDKs that consist of libraries and sample code for various // programming languages and platforms, such as Java, Ruby, .Net, iOS, or Android. // The SDKs provide a convenient way to create programmatic access to IAM Identity // Center and other AWS services. For more information about the AWS SDKs, -// including how to download and install them, see Tools for Amazon Web Services (http://aws.amazon.com/tools/) -// . +// including how to download and install them, see [Tools for Amazon Web Services]. +// +// [Tools for Amazon Web Services]: http://aws.amazon.com/tools/ +// [IAM Identity Center rename]: https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed package sso diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go index e98c0f32..41c5f154 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go @@ -3,4 +3,4 @@ package sso // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.20.3" +const goModuleVersion = "1.20.6" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints/endpoints.go index 0a00b256..2c3a77ce 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints/endpoints.go @@ -187,6 +187,14 @@ var defaultPartitions = endpoints.Partitions{ Region: "ap-south-1", }, }, + endpoints.EndpointKey{ + Region: "ap-south-2", + }: endpoints.Endpoint{ + Hostname: "portal.sso.ap-south-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ap-south-2", + }, + }, endpoints.EndpointKey{ Region: "ap-southeast-1", }: endpoints.Endpoint{ @@ -259,6 +267,14 @@ var defaultPartitions = endpoints.Partitions{ Region: "eu-south-1", }, }, + endpoints.EndpointKey{ + Region: "eu-south-2", + }: endpoints.Endpoint{ + Hostname: "portal.sso.eu-south-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "eu-south-2", + }, + }, endpoints.EndpointKey{ Region: "eu-west-1", }: endpoints.Endpoint{ diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/options.go index 5dee7e53..3561c443 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/options.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/options.go @@ -50,8 +50,10 @@ type Options struct { // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a // value for this field will likely prevent you from using any endpoint-related // service features released after the introduction of EndpointResolverV2 and - // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom - // endpoint, set the client option BaseEndpoint instead. + // BaseEndpoint. + // + // To migrate an EndpointResolver implementation that uses a custom endpoint, set + // the client option BaseEndpoint instead. EndpointResolver EndpointResolver // Resolves the endpoint used for a particular service operation. This should be @@ -70,17 +72,20 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. If specified in an operation call's - // functional options with a value that is different than the constructed client's - // Options, the Client's Retryer will be wrapped to use the operation's specific - // RetryMaxAttempts value. + // per operation call's retry max attempts. + // + // If specified in an operation call's functional options with a value that is + // different than the constructed client's Options, the Client's Retryer will be + // wrapped to use the operation's specific RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if - // Retryer option is not also specified. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. Currently does not support per operation call - // overrides, may in the future. + // Retryer option is not also specified. + // + // When creating a new API Clients this member will only be used if the Retryer + // Options member is nil. This value will be ignored if Retryer is not nil. + // + // Currently does not support per operation call overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable @@ -97,8 +102,9 @@ type Options struct { // The initial DefaultsMode used when the client options were constructed. If the // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved - // value was at that point in time. Currently does not support per operation call - // overrides, may in the future. + // value was at that point in time. + // + // Currently does not support per operation call overrides, may in the future. resolvedDefaultsMode aws.DefaultsMode // The HTTP client to invoke API calls with. Defaults to client's default HTTP @@ -143,6 +149,7 @@ func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { // Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for // this field will likely prevent you from using any endpoint-related service // features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// // To migrate an EndpointResolver implementation that uses a custom endpoint, set // the client option BaseEndpoint instead. func WithEndpointResolver(v EndpointResolver) func(*Options) { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/types/types.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/types/types.go index 8dc02296..07ac468e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/types/types.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/types/types.go @@ -25,22 +25,24 @@ type AccountInfo struct { type RoleCredentials struct { // The identifier used for the temporary security credentials. For more - // information, see Using Temporary Security Credentials to Request Access to AWS - // Resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html) - // in the AWS IAM User Guide. + // information, see [Using Temporary Security Credentials to Request Access to AWS Resources]in the AWS IAM User Guide. + // + // [Using Temporary Security Credentials to Request Access to AWS Resources]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html AccessKeyId *string // The date on which temporary security credentials expire. Expiration int64 - // The key that is used to sign the request. For more information, see Using - // Temporary Security Credentials to Request Access to AWS Resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html) - // in the AWS IAM User Guide. + // The key that is used to sign the request. For more information, see [Using Temporary Security Credentials to Request Access to AWS Resources] in the AWS + // IAM User Guide. + // + // [Using Temporary Security Credentials to Request Access to AWS Resources]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html SecretAccessKey *string - // The token used for temporary credentials. For more information, see Using - // Temporary Security Credentials to Request Access to AWS Resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html) - // in the AWS IAM User Guide. + // The token used for temporary credentials. For more information, see [Using Temporary Security Credentials to Request Access to AWS Resources] in the AWS + // IAM User Guide. + // + // [Using Temporary Security Credentials to Request Access to AWS Resources]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html SessionToken *string noSmithyDocumentSerde diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md index c6d5ae92..05ad36f9 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.23.5 (2024-05-08) + +* **Bug Fix**: GoDoc improvement + +# v1.23.4 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.23.3 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go index 63f1eeb1..40d44ebd 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go @@ -32,34 +32,38 @@ func (c *Client) CreateToken(ctx context.Context, params *CreateTokenInput, optF type CreateTokenInput struct { // The unique identifier string for the client or application. This value comes - // from the result of the RegisterClient API. + // from the result of the RegisterClientAPI. // // This member is required. ClientId *string // A secret string generated for the client. This value should come from the - // persisted result of the RegisterClient API. + // persisted result of the RegisterClientAPI. // // This member is required. ClientSecret *string // Supports the following OAuth grant types: Device Code and Refresh Token. // Specify either of the following values, depending on the grant type that you - // want: * Device Code - urn:ietf:params:oauth:grant-type:device_code * Refresh - // Token - refresh_token For information about how to obtain the device code, see - // the StartDeviceAuthorization topic. + // want: + // + // * Device Code - urn:ietf:params:oauth:grant-type:device_code + // + // * Refresh Token - refresh_token + // + // For information about how to obtain the device code, see the StartDeviceAuthorization topic. // // This member is required. GrantType *string // Used only when calling this API for the Authorization Code grant type. The // short-term code is used to identify this authorization request. This grant type - // is currently unsupported for the CreateToken API. + // is currently unsupported for the CreateTokenAPI. Code *string // Used only when calling this API for the Device Code grant type. This short-term // code is used to identify this authorization request. This comes from the result - // of the StartDeviceAuthorization API. + // of the StartDeviceAuthorizationAPI. DeviceCode *string // Used only when calling this API for the Authorization Code grant type. This @@ -69,16 +73,18 @@ type CreateTokenInput struct { // Used only when calling this API for the Refresh Token grant type. This token is // used to refresh short-term tokens, such as the access token, that might expire. + // // For more information about the features and limitations of the current IAM // Identity Center OIDC implementation, see Considerations for Using this Guide in - // the IAM Identity Center OIDC API Reference (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html) - // . + // the [IAM Identity Center OIDC API Reference]. + // + // [IAM Identity Center OIDC API Reference]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html RefreshToken *string // The list of scopes for which authorization is requested. The access token that // is issued is limited to the scopes that are granted. If this value is not // specified, IAM Identity Center authorizes all scopes that are configured for the - // client during the call to RegisterClient . + // client during the call to RegisterClient. Scope []string noSmithyDocumentSerde @@ -94,18 +100,22 @@ type CreateTokenOutput struct { // The idToken is not implemented or supported. For more information about the // features and limitations of the current IAM Identity Center OIDC implementation, - // see Considerations for Using this Guide in the IAM Identity Center OIDC API - // Reference (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html) - // . A JSON Web Token (JWT) that identifies who is associated with the issued - // access token. + // see Considerations for Using this Guide in the [IAM Identity Center OIDC API Reference]. + // + // A JSON Web Token (JWT) that identifies who is associated with the issued access + // token. + // + // [IAM Identity Center OIDC API Reference]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html IdToken *string // A token that, if present, can be used to refresh a previously issued access - // token that might have expired. For more information about the features and - // limitations of the current IAM Identity Center OIDC implementation, see - // Considerations for Using this Guide in the IAM Identity Center OIDC API - // Reference (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html) - // . + // token that might have expired. + // + // For more information about the features and limitations of the current IAM + // Identity Center OIDC implementation, see Considerations for Using this Guide in + // the [IAM Identity Center OIDC API Reference]. + // + // [IAM Identity Center OIDC API Reference]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html RefreshToken *string // Used to notify the client that the returned token is an access token. The diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go index 63409538..df87ed5a 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go @@ -39,10 +39,15 @@ type CreateTokenWithIAMInput struct { // Supports the following OAuth grant types: Authorization Code, Refresh Token, // JWT Bearer, and Token Exchange. Specify one of the following values, depending - // on the grant type that you want: * Authorization Code - authorization_code * - // Refresh Token - refresh_token * JWT Bearer - - // urn:ietf:params:oauth:grant-type:jwt-bearer * Token Exchange - - // urn:ietf:params:oauth:grant-type:token-exchange + // on the grant type that you want: + // + // * Authorization Code - authorization_code + // + // * Refresh Token - refresh_token + // + // * JWT Bearer - urn:ietf:params:oauth:grant-type:jwt-bearer + // + // * Token Exchange - urn:ietf:params:oauth:grant-type:token-exchange // // This member is required. GrantType *string @@ -66,16 +71,21 @@ type CreateTokenWithIAMInput struct { // Used only when calling this API for the Refresh Token grant type. This token is // used to refresh short-term tokens, such as the access token, that might expire. + // // For more information about the features and limitations of the current IAM // Identity Center OIDC implementation, see Considerations for Using this Guide in - // the IAM Identity Center OIDC API Reference (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html) - // . + // the [IAM Identity Center OIDC API Reference]. + // + // [IAM Identity Center OIDC API Reference]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html RefreshToken *string // Used only when calling this API for the Token Exchange grant type. This value // specifies the type of token that the requester can receive. The following values - // are supported: * Access Token - urn:ietf:params:oauth:token-type:access_token * - // Refresh Token - urn:ietf:params:oauth:token-type:refresh_token + // are supported: + // + // * Access Token - urn:ietf:params:oauth:token-type:access_token + // + // * Refresh Token - urn:ietf:params:oauth:token-type:refresh_token RequestedTokenType *string // The list of scopes for which authorization is requested. The access token that @@ -94,8 +104,9 @@ type CreateTokenWithIAMInput struct { // Used only when calling this API for the Token Exchange grant type. This value // specifies the type of token that is passed as the subject of the exchange. The - // following value is supported: * Access Token - - // urn:ietf:params:oauth:token-type:access_token + // following value is supported: + // + // * Access Token - urn:ietf:params:oauth:token-type:access_token SubjectTokenType *string noSmithyDocumentSerde @@ -114,17 +125,21 @@ type CreateTokenWithIAMOutput struct { IdToken *string // Indicates the type of tokens that are issued by IAM Identity Center. The - // following values are supported: * Access Token - - // urn:ietf:params:oauth:token-type:access_token * Refresh Token - - // urn:ietf:params:oauth:token-type:refresh_token + // following values are supported: + // + // * Access Token - urn:ietf:params:oauth:token-type:access_token + // + // * Refresh Token - urn:ietf:params:oauth:token-type:refresh_token IssuedTokenType *string // A token that, if present, can be used to refresh a previously issued access - // token that might have expired. For more information about the features and - // limitations of the current IAM Identity Center OIDC implementation, see - // Considerations for Using this Guide in the IAM Identity Center OIDC API - // Reference (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html) - // . + // token that might have expired. + // + // For more information about the features and limitations of the current IAM + // Identity Center OIDC implementation, see Considerations for Using this Guide in + // the [IAM Identity Center OIDC API Reference]. + // + // [IAM Identity Center OIDC API Reference]: https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html RefreshToken *string // The list of scopes for which authorization is granted. The access token that is diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go index c568805b..0b727e38 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go @@ -30,22 +30,23 @@ func (c *Client) StartDeviceAuthorization(ctx context.Context, params *StartDevi type StartDeviceAuthorizationInput struct { // The unique identifier string for the client that is registered with IAM - // Identity Center. This value should come from the persisted result of the - // RegisterClient API operation. + // Identity Center. This value should come from the persisted result of the RegisterClientAPI + // operation. // // This member is required. ClientId *string // A secret string that is generated for the client. This value should come from - // the persisted result of the RegisterClient API operation. + // the persisted result of the RegisterClientAPI operation. // // This member is required. ClientSecret *string - // The URL for the Amazon Web Services access portal. For more information, see - // Using the Amazon Web Services access portal (https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html) + // The URL for the Amazon Web Services access portal. For more information, see [Using the Amazon Web Services access portal] // in the IAM Identity Center User Guide. // + // [Using the Amazon Web Services access portal]: https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html + // // This member is required. StartUrl *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/doc.go index 53cd4f55..1d258e56 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/doc.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/doc.go @@ -6,33 +6,41 @@ // IAM Identity Center OpenID Connect (OIDC) is a web service that enables a // client (such as CLI or a native application) to register with IAM Identity // Center. The service also enables the client to fetch the user’s access token -// upon successful authentication and authorization with IAM Identity Center. IAM -// Identity Center uses the sso and identitystore API namespaces. Considerations -// for Using This Guide Before you begin using this guide, we recommend that you -// first review the following important information about how the IAM Identity -// Center OIDC service works. +// upon successful authentication and authorization with IAM Identity Center. +// +// IAM Identity Center uses the sso and identitystore API namespaces. +// +// # Considerations for Using This Guide +// +// Before you begin using this guide, we recommend that you first review the +// following important information about how the IAM Identity Center OIDC service +// works. +// // - The IAM Identity Center OIDC service currently implements only the portions -// of the OAuth 2.0 Device Authorization Grant standard ( -// https://tools.ietf.org/html/rfc8628 (https://tools.ietf.org/html/rfc8628) ) -// that are necessary to enable single sign-on authentication with the CLI. +// of the OAuth 2.0 Device Authorization Grant standard ([https://tools.ietf.org/html/rfc8628] ) that are necessary to +// enable single sign-on authentication with the CLI. +// // - With older versions of the CLI, the service only emits OIDC access tokens, // so to obtain a new token, users must explicitly re-authenticate. To access the // OIDC flow that supports token refresh and doesn’t require re-authentication, // update to the latest CLI version (1.27.10 for CLI V1 and 2.9.0 for CLI V2) with // support for OIDC token refresh and configurable IAM Identity Center session -// durations. For more information, see Configure Amazon Web Services access -// portal session duration (https://docs.aws.amazon.com/singlesignon/latest/userguide/configure-user-session.html) -// . +// durations. For more information, see [Configure Amazon Web Services access portal session duration]. +// // - The access tokens provided by this service grant access to all Amazon Web // Services account entitlements assigned to an IAM Identity Center user, not just // a particular application. +// // - The documentation in this guide does not describe the mechanism to convert // the access token into Amazon Web Services Auth (“sigv4”) credentials for use // with IAM-protected Amazon Web Services service endpoints. For more information, -// see GetRoleCredentials (https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html) -// in the IAM Identity Center Portal API Reference Guide. +// see [GetRoleCredentials]in the IAM Identity Center Portal API Reference Guide. +// +// For general information about IAM Identity Center, see [What is IAM Identity Center?] in the IAM Identity +// Center User Guide. // -// For general information about IAM Identity Center, see What is IAM Identity -// Center? (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html) -// in the IAM Identity Center User Guide. +// [Configure Amazon Web Services access portal session duration]: https://docs.aws.amazon.com/singlesignon/latest/userguide/configure-user-session.html +// [GetRoleCredentials]: https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html +// [https://tools.ietf.org/html/rfc8628]: https://tools.ietf.org/html/rfc8628 +// [What is IAM Identity Center?]: https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html package ssooidc diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go index e81f202f..391d4e69 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go @@ -3,4 +3,4 @@ package ssooidc // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.23.3" +const goModuleVersion = "1.23.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints/endpoints.go index aa207253..843edb07 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints/endpoints.go @@ -187,6 +187,14 @@ var defaultPartitions = endpoints.Partitions{ Region: "ap-south-1", }, }, + endpoints.EndpointKey{ + Region: "ap-south-2", + }: endpoints.Endpoint{ + Hostname: "oidc.ap-south-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ap-south-2", + }, + }, endpoints.EndpointKey{ Region: "ap-southeast-1", }: endpoints.Endpoint{ @@ -259,6 +267,14 @@ var defaultPartitions = endpoints.Partitions{ Region: "eu-south-1", }, }, + endpoints.EndpointKey{ + Region: "eu-south-2", + }: endpoints.Endpoint{ + Hostname: "oidc.eu-south-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "eu-south-2", + }, + }, endpoints.EndpointKey{ Region: "eu-west-1", }: endpoints.Endpoint{ diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/options.go index b964e7e1..69ded47c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/options.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/options.go @@ -50,8 +50,10 @@ type Options struct { // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a // value for this field will likely prevent you from using any endpoint-related // service features released after the introduction of EndpointResolverV2 and - // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom - // endpoint, set the client option BaseEndpoint instead. + // BaseEndpoint. + // + // To migrate an EndpointResolver implementation that uses a custom endpoint, set + // the client option BaseEndpoint instead. EndpointResolver EndpointResolver // Resolves the endpoint used for a particular service operation. This should be @@ -70,17 +72,20 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. If specified in an operation call's - // functional options with a value that is different than the constructed client's - // Options, the Client's Retryer will be wrapped to use the operation's specific - // RetryMaxAttempts value. + // per operation call's retry max attempts. + // + // If specified in an operation call's functional options with a value that is + // different than the constructed client's Options, the Client's Retryer will be + // wrapped to use the operation's specific RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if - // Retryer option is not also specified. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. Currently does not support per operation call - // overrides, may in the future. + // Retryer option is not also specified. + // + // When creating a new API Clients this member will only be used if the Retryer + // Options member is nil. This value will be ignored if Retryer is not nil. + // + // Currently does not support per operation call overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable @@ -97,8 +102,9 @@ type Options struct { // The initial DefaultsMode used when the client options were constructed. If the // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved - // value was at that point in time. Currently does not support per operation call - // overrides, may in the future. + // value was at that point in time. + // + // Currently does not support per operation call overrides, may in the future. resolvedDefaultsMode aws.DefaultsMode // The HTTP client to invoke API calls with. Defaults to client's default HTTP @@ -143,6 +149,7 @@ func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { // Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for // this field will likely prevent you from using any endpoint-related service // features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// // To migrate an EndpointResolver implementation that uses a custom endpoint, set // the client option BaseEndpoint instead. func WithEndpointResolver(v EndpointResolver) func(*Options) { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/types/errors.go index 86b62049..54faa9c5 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/types/errors.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/types/errors.go @@ -188,7 +188,7 @@ func (e *InvalidClientMetadataException) ErrorCode() string { func (e *InvalidClientMetadataException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // Indicates that a request contains an invalid grant. This can occur if a client -// makes a CreateToken request with an invalid grant type. +// makes a CreateTokenrequest with an invalid grant type. type InvalidGrantException struct { Message *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md index 1c503194..9d324f2f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.28.7 (2024-05-08) + +* **Bug Fix**: GoDoc improvement + +# v1.28.6 (2024-03-29) + +* **Dependency Update**: Updated to the latest SDK module versions + # v1.28.5 (2024-03-18) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go index e0e2c9c2..936f917b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go @@ -16,69 +16,99 @@ import ( // Amazon Web Services resources. These temporary credentials consist of an access // key ID, a secret access key, and a security token. Typically, you use AssumeRole // within your account or for cross-account access. For a comparison of AssumeRole -// with other API operations that produce temporary credentials, see Requesting -// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. Permissions The temporary security credentials created by -// AssumeRole can be used to make API calls to any Amazon Web Services service -// with the following exception: You cannot call the Amazon Web Services STS -// GetFederationToken or GetSessionToken API operations. (Optional) You can pass -// inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policy Amazon -// Resource Names (ARNs) to use as managed session policies. The plaintext that you -// use for both inline and managed session policies can't exceed 2,048 characters. -// Passing policies to this operation returns new temporary credentials. The -// resulting session's permissions are the intersection of the role's -// identity-based policy and the session policies. You can use the role's temporary -// credentials in subsequent Amazon Web Services API calls to access resources in -// the account that owns the role. You cannot use session policies to grant more -// permissions than those allowed by the identity-based policy of the role that is -// being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. When you create a role, you create two policies: a role -// trust policy that specifies who can assume the role, and a permissions policy -// that specifies what can be done with the role. You specify the trusted principal -// that is allowed to assume the role in the role trust policy. To assume a role -// from a different account, your Amazon Web Services account must be trusted by -// the role. The trust relationship is defined in the role's trust policy when the -// role is created. That trust policy states which accounts are allowed to delegate -// that access to users in the account. A user who wants to access a role in a -// different account must also have permissions that are delegated from the account -// administrator. The administrator must attach a policy that allows the user to -// call AssumeRole for the ARN of the role in the other account. To allow a user -// to assume a role in the same account, you can do either of the following: +// with other API operations that produce temporary credentials, see [Requesting Temporary Security Credentials]and [Comparing the Amazon Web Services STS API operations] in the +// IAM User Guide. +// +// # Permissions +// +// The temporary security credentials created by AssumeRole can be used to make +// API calls to any Amazon Web Services service with the following exception: You +// cannot call the Amazon Web Services STS GetFederationToken or GetSessionToken +// API operations. +// +// (Optional) You can pass inline or managed [session policies] to this operation. You can pass a +// single JSON policy document to use as an inline session policy. You can also +// specify up to 10 managed policy Amazon Resource Names (ARNs) to use as managed +// session policies. The plaintext that you use for both inline and managed session +// policies can't exceed 2,048 characters. Passing policies to this operation +// returns new temporary credentials. The resulting session's permissions are the +// intersection of the role's identity-based policy and the session policies. You +// can use the role's temporary credentials in subsequent Amazon Web Services API +// calls to access resources in the account that owns the role. You cannot use +// session policies to grant more permissions than those allowed by the +// identity-based policy of the role that is being assumed. For more information, +// see [Session Policies]in the IAM User Guide. +// +// When you create a role, you create two policies: a role trust policy that +// specifies who can assume the role, and a permissions policy that specifies what +// can be done with the role. You specify the trusted principal that is allowed to +// assume the role in the role trust policy. +// +// To assume a role from a different account, your Amazon Web Services account +// must be trusted by the role. The trust relationship is defined in the role's +// trust policy when the role is created. That trust policy states which accounts +// are allowed to delegate that access to users in the account. +// +// A user who wants to access a role in a different account must also have +// permissions that are delegated from the account administrator. The administrator +// must attach a policy that allows the user to call AssumeRole for the ARN of the +// role in the other account. +// +// To allow a user to assume a role in the same account, you can do either of the +// following: +// // - Attach a policy to the user that allows the user to call AssumeRole (as long // as the role's trust policy trusts the account). +// // - Add the user as a principal directly in the role's trust policy. // // You can do either because the role’s trust policy acts as an IAM resource-based // policy. When a resource-based policy grants access to a principal in the same // account, no additional identity-based policy is required. For more information -// about trust policies and resource-based policies, see IAM Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) -// in the IAM User Guide. Tags (Optional) You can pass tag key-value pairs to your -// session. These tags are called session tags. For more information about session -// tags, see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. An administrator must grant you the permissions necessary -// to pass session tags. The administrator can also create granular permissions to -// allow you to pass only specific session tags. For more information, see -// Tutorial: Using Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. You can set the session tags as transitive. Transitive -// tags persist during role chaining. For more information, see Chaining Roles -// with Session Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. Using MFA with AssumeRole (Optional) You can include -// multi-factor authentication (MFA) information when you call AssumeRole . This is -// useful for cross-account scenarios to ensure that the user that assumes the role -// has been authenticated with an Amazon Web Services MFA device. In that scenario, -// the trust policy of the role being assumed includes a condition that tests for -// MFA authentication. If the caller does not include valid MFA information, the -// request to assume the role is denied. The condition in a trust policy that tests -// for MFA authentication might look like the following example. "Condition": -// {"Bool": {"aws:MultiFactorAuthPresent": true}} For more information, see -// Configuring MFA-Protected API Access (https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) -// in the IAM User Guide guide. To use MFA with AssumeRole , you pass values for -// the SerialNumber and TokenCode parameters. The SerialNumber value identifies -// the user's hardware or virtual MFA device. The TokenCode is the time-based -// one-time password (TOTP) that the MFA device produces. +// about trust policies and resource-based policies, see [IAM Policies]in the IAM User Guide. +// +// # Tags +// +// (Optional) You can pass tag key-value pairs to your session. These tags are +// called session tags. For more information about session tags, see [Passing Session Tags in STS]in the IAM +// User Guide. +// +// An administrator must grant you the permissions necessary to pass session tags. +// The administrator can also create granular permissions to allow you to pass only +// specific session tags. For more information, see [Tutorial: Using Tags for Attribute-Based Access Control]in the IAM User Guide. +// +// You can set the session tags as transitive. Transitive tags persist during role +// chaining. For more information, see [Chaining Roles with Session Tags]in the IAM User Guide. +// +// # Using MFA with AssumeRole +// +// (Optional) You can include multi-factor authentication (MFA) information when +// you call AssumeRole . This is useful for cross-account scenarios to ensure that +// the user that assumes the role has been authenticated with an Amazon Web +// Services MFA device. In that scenario, the trust policy of the role being +// assumed includes a condition that tests for MFA authentication. If the caller +// does not include valid MFA information, the request to assume the role is +// denied. The condition in a trust policy that tests for MFA authentication might +// look like the following example. +// +// "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} +// +// For more information, see [Configuring MFA-Protected API Access] in the IAM User Guide guide. +// +// To use MFA with AssumeRole , you pass values for the SerialNumber and TokenCode +// parameters. The SerialNumber value identifies the user's hardware or virtual +// MFA device. The TokenCode is the time-based one-time password (TOTP) that the +// MFA device produces. +// +// [Configuring MFA-Protected API Access]: https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html +// [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html +// [Chaining Roles with Session Tags]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining +// [Comparing the Amazon Web Services STS API operations]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison +// [session policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [IAM Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html +// [Requesting Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html +// [Tutorial: Using Tags for Attribute-Based Access Control]: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html func (c *Client) AssumeRole(ctx context.Context, params *AssumeRoleInput, optFns ...func(*Options)) (*AssumeRoleOutput, error) { if params == nil { params = &AssumeRoleInput{} @@ -101,17 +131,19 @@ type AssumeRoleInput struct { // This member is required. RoleArn *string - // An identifier for the assumed role session. Use the role session name to - // uniquely identify a session when the same role is assumed by different - // principals or for different reasons. In cross-account scenarios, the role - // session name is visible to, and can be logged by the account that owns the role. - // The role session name is also used in the ARN of the assumed role principal. - // This means that subsequent cross-account API requests that use the temporary - // security credentials will expose the role session name to the external account - // in their CloudTrail logs. The regex used to validate this parameter is a string - // of characters consisting of upper- and lower-case alphanumeric characters with - // no spaces. You can also include underscores or any of the following characters: - // =,.@- + // An identifier for the assumed role session. + // + // Use the role session name to uniquely identify a session when the same role is + // assumed by different principals or for different reasons. In cross-account + // scenarios, the role session name is visible to, and can be logged by the account + // that owns the role. The role session name is also used in the ARN of the assumed + // role principal. This means that subsequent cross-account API requests that use + // the temporary security credentials will expose the role session name to the + // external account in their CloudTrail logs. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- // // This member is required. RoleSessionName *string @@ -122,23 +154,27 @@ type AssumeRoleInput struct { // hours. If you specify a value higher than this setting or the administrator // setting (whichever is lower), the operation fails. For example, if you specify a // session duration of 12 hours, but your administrator set the maximum session - // duration to 6 hours, your operation fails. Role chaining limits your Amazon Web - // Services CLI or Amazon Web Services API role session to a maximum of one hour. - // When you use the AssumeRole API operation to assume a role, you can specify the - // duration of your role session with the DurationSeconds parameter. You can - // specify a parameter value of up to 43200 seconds (12 hours), depending on the - // maximum session duration setting for your role. However, if you assume a role - // using role chaining and provide a DurationSeconds parameter value greater than - // one hour, the operation fails. To learn how to view the maximum value for your - // role, see View the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. By default, the value is set to 3600 seconds. The - // DurationSeconds parameter is separate from the duration of a console session - // that you might request using the returned credentials. The request to the - // federation endpoint for a console sign-in token takes a SessionDuration + // duration to 6 hours, your operation fails. + // + // Role chaining limits your Amazon Web Services CLI or Amazon Web Services API + // role session to a maximum of one hour. When you use the AssumeRole API + // operation to assume a role, you can specify the duration of your role session + // with the DurationSeconds parameter. You can specify a parameter value of up to + // 43200 seconds (12 hours), depending on the maximum session duration setting for + // your role. However, if you assume a role using role chaining and provide a + // DurationSeconds parameter value greater than one hour, the operation fails. To + // learn how to view the maximum value for your role, see [View the Maximum Session Duration Setting for a Role]in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request to + // the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // Amazon Web Services Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. + // information, see [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]in the IAM User Guide. + // + // [View the Maximum Session Duration Setting for a Role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session + // [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html DurationSeconds *int32 // A unique identifier that might be required when you assume a role in another @@ -149,63 +185,79 @@ type AssumeRoleInput struct { // the administrator of the trusting account might send an external ID to the // administrator of the trusted account. That way, only someone with the ID can // assume the role, rather than everyone in the account. For more information about - // the external ID, see How to Use an External ID When Granting Access to Your - // Amazon Web Services Resources to a Third Party (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) - // in the IAM User Guide. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@:/- + // the external ID, see [How to Use an External ID When Granting Access to Your Amazon Web Services Resources to a Third Party]in the IAM User Guide. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@:/- + // + // [How to Use an External ID When Granting Access to Your Amazon Web Services Resources to a Third Party]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html ExternalId *string // An IAM policy in JSON format that you want to use as an inline session policy. + // // This parameter is optional. Passing policies to this operation returns new // temporary credentials. The resulting session's permissions are the intersection // of the role's identity-based policy and the session policies. You can use the // role's temporary credentials in subsequent Amazon Web Services API calls to // access resources in the account that owns the role. You cannot use session // policies to grant more permissions than those allowed by the identity-based - // policy of the role that is being assumed. For more information, see Session - // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. The plaintext that you use for both inline and managed - // session policies can't exceed 2,048 characters. The JSON policy characters can - // be any ASCII character from the space character to the end of the valid - // character list (\u0020 through \u00FF). It can also include the tab (\u0009), - // linefeed (\u000A), and carriage return (\u000D) characters. An Amazon Web - // Services conversion compresses the passed inline session policy, managed policy - // ARNs, and session tags into a packed binary format that has a separate limit. - // Your request can fail for this limit even if your plaintext meets the other - // requirements. The PackedPolicySize response element indicates by percentage how - // close the policies and tags for your request are to the upper size limit. + // policy of the role that is being assumed. For more information, see [Session Policies]in the IAM + // User Guide. + // + // The plaintext that you use for both inline and managed session policies can't + // exceed 2,048 characters. The JSON policy characters can be any ASCII character + // from the space character to the end of the valid character list (\u0020 through + // \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage + // return (\u000D) characters. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session Policy *string // The Amazon Resource Names (ARNs) of the IAM managed policies that you want to // use as managed session policies. The policies must exist in the same account as - // the role. This parameter is optional. You can provide up to 10 managed policy - // ARNs. However, the plaintext that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, see - // Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. An Amazon Web Services conversion - // compresses the passed inline session policy, managed policy ARNs, and session - // tags into a packed binary format that has a separate limit. Your request can - // fail for this limit even if your plaintext meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. Passing policies to this - // operation returns new temporary credentials. The resulting session's permissions - // are the intersection of the role's identity-based policy and the session - // policies. You can use the role's temporary credentials in subsequent Amazon Web - // Services API calls to access resources in the account that owns the role. You - // cannot use session policies to grant more permissions than those allowed by the - // identity-based policy of the role that is being assumed. For more information, - // see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. + // the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plaintext that you use for both inline and managed session policies + // can't exceed 2,048 characters. For more information about ARNs, see [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]in the + // Amazon Web Services General Reference. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's + // identity-based policy and the session policies. You can use the role's temporary + // credentials in subsequent Amazon Web Services API calls to access resources in + // the account that owns the role. You cannot use session policies to grant more + // permissions than those allowed by the identity-based policy of the role that is + // being assumed. For more information, see [Session Policies]in the IAM User Guide. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html PolicyArns []types.PolicyDescriptorType // A list of previously acquired trusted context assertions in the format of a // JSON array. The trusted context assertion is signed and encrypted by Amazon Web - // Services STS. The following is an example of a ProvidedContext value that - // includes a single trusted context assertion and the ARN of the context provider - // from which the trusted context assertion was generated. - // [{"ProviderArn":"arn:aws:iam::aws:contextProvider/IdentityCenter","ContextAssertion":"trusted-context-assertion"}] + // Services STS. + // + // The following is an example of a ProvidedContext value that includes a single + // trusted context assertion and the ARN of the context provider from which the + // trusted context assertion was generated. + // + // [{"ProviderArn":"arn:aws:iam::aws:contextProvider/IdentityCenter","ContextAssertion":"trusted-context-assertion"}] ProvidedContexts []types.ProvidedContext // The identification number of the MFA device that is associated with the user @@ -213,79 +265,97 @@ type AssumeRoleInput struct { // the role being assumed includes a condition that requires MFA authentication. // The value is either the serial number for a hardware device (such as // GAHT12345678 ) or an Amazon Resource Name (ARN) for a virtual device (such as - // arn:aws:iam::123456789012:mfa/user ). The regex used to validate this parameter - // is a string of characters consisting of upper- and lower-case alphanumeric - // characters with no spaces. You can also include underscores or any of the - // following characters: =,.@- + // arn:aws:iam::123456789012:mfa/user ). + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- SerialNumber *string // The source identity specified by the principal that is calling the AssumeRole - // operation. You can require users to specify a source identity when they assume a - // role. You do this by using the sts:SourceIdentity condition key in a role trust - // policy. You can use source identity information in CloudTrail logs to determine - // who took actions with a role. You can use the aws:SourceIdentity condition key - // to further control access to Amazon Web Services resources based on the value of - // source identity. For more information about using source identity, see Monitor - // and control actions taken with assumed roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html) - // in the IAM User Guide. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@-. You cannot use a value that begins with the text aws: . This prefix is - // reserved for Amazon Web Services internal use. + // operation. + // + // You can require users to specify a source identity when they assume a role. You + // do this by using the sts:SourceIdentity condition key in a role trust policy. + // You can use source identity information in CloudTrail logs to determine who took + // actions with a role. You can use the aws:SourceIdentity condition key to + // further control access to Amazon Web Services resources based on the value of + // source identity. For more information about using source identity, see [Monitor and control actions taken with assumed roles]in the + // IAM User Guide. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@-. You cannot use a + // value that begins with the text aws: . This prefix is reserved for Amazon Web + // Services internal use. + // + // [Monitor and control actions taken with assumed roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html SourceIdentity *string // A list of session tags that you want to pass. Each session tag consists of a - // key name and an associated value. For more information about session tags, see - // Tagging Amazon Web Services STS Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) - // in the IAM User Guide. This parameter is optional. You can pass up to 50 session - // tags. The plaintext session tag keys can’t exceed 128 characters, and the values - // can’t exceed 256 characters. For these and additional limits, see IAM and STS - // Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. An Amazon Web Services conversion compresses the passed - // inline session policy, managed policy ARNs, and session tags into a packed - // binary format that has a separate limit. Your request can fail for this limit - // even if your plaintext meets the other requirements. The PackedPolicySize - // response element indicates by percentage how close the policies and tags for - // your request are to the upper size limit. You can pass a session tag with the - // same key as a tag that is already attached to the role. When you do, session - // tags override a role tag with the same key. Tag key–value pairs are not case - // sensitive, but case is preserved. This means that you cannot have separate - // Department and department tag keys. Assume that the role has the Department = - // Marketing tag and you pass the department = engineering session tag. Department - // and department are not saved as separate tags, and the session tag passed in - // the request takes precedence over the role tag. Additionally, if you used - // temporary credentials to perform this operation, the new session inherits any - // transitive session tags from the calling session. If you pass a session tag with - // the same key as an inherited tag, the operation fails. To view the inherited - // tags for a session, see the CloudTrail logs. For more information, see Viewing - // Session Tags in CloudTrail (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_ctlogs) + // key name and an associated value. For more information about session tags, see [Tagging Amazon Web Services STS Sessions] // in the IAM User Guide. + // + // This parameter is optional. You can pass up to 50 session tags. The plaintext + // session tag keys can’t exceed 128 characters, and the values can’t exceed 256 + // characters. For these and additional limits, see [IAM and STS Character Limits]in the IAM User Guide. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // You can pass a session tag with the same key as a tag that is already attached + // to the role. When you do, session tags override a role tag with the same key. + // + // Tag key–value pairs are not case sensitive, but case is preserved. This means + // that you cannot have separate Department and department tag keys. Assume that + // the role has the Department = Marketing tag and you pass the department = + // engineering session tag. Department and department are not saved as separate + // tags, and the session tag passed in the request takes precedence over the role + // tag. + // + // Additionally, if you used temporary credentials to perform this operation, the + // new session inherits any transitive session tags from the calling session. If + // you pass a session tag with the same key as an inherited tag, the operation + // fails. To view the inherited tags for a session, see the CloudTrail logs. For + // more information, see [Viewing Session Tags in CloudTrail]in the IAM User Guide. + // + // [Tagging Amazon Web Services STS Sessions]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html + // [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length + // [Viewing Session Tags in CloudTrail]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_ctlogs Tags []types.Tag // The value provided by the MFA device, if the trust policy of the role being // assumed requires MFA. (In other words, if the policy includes a condition that // tests for MFA). If the role being assumed requires MFA and if the TokenCode // value is missing or expired, the AssumeRole call returns an "access denied" - // error. The format for this parameter, as described by its regex pattern, is a - // sequence of six numeric digits. + // error. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. TokenCode *string // A list of keys for session tags that you want to set as transitive. If you set // a tag key as transitive, the corresponding key and value passes to subsequent - // sessions in a role chain. For more information, see Chaining Roles with Session - // Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) - // in the IAM User Guide. This parameter is optional. When you set session tags as - // transitive, the session policy and session tags packed binary limit is not - // affected. If you choose not to specify a transitive tag key, then no tags are - // passed from this session to any subsequent sessions. + // sessions in a role chain. For more information, see [Chaining Roles with Session Tags]in the IAM User Guide. + // + // This parameter is optional. When you set session tags as transitive, the + // session policy and session tags packed binary limit is not affected. + // + // If you choose not to specify a transitive tag key, then no tags are passed from + // this session to any subsequent sessions. + // + // [Chaining Roles with Session Tags]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining TransitiveTagKeys []string noSmithyDocumentSerde } -// Contains the response to a successful AssumeRole request, including temporary -// Amazon Web Services credentials that can be used to make Amazon Web Services -// requests. +// Contains the response to a successful AssumeRole request, including temporary Amazon Web +// Services credentials that can be used to make Amazon Web Services requests. type AssumeRoleOutput struct { // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers @@ -296,9 +366,10 @@ type AssumeRoleOutput struct { AssumedRoleUser *types.AssumedRoleUser // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. The size of the security token - // that STS API operations return is not fixed. We strongly recommend that you make - // no assumptions about the maximum size. + // access key, and a security (or session) token. + // + // The size of the security token that STS API operations return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. Credentials *types.Credentials // A percentage value that indicates the packed size of the session policies and @@ -308,17 +379,21 @@ type AssumeRoleOutput struct { PackedPolicySize *int32 // The source identity specified by the principal that is calling the AssumeRole - // operation. You can require users to specify a source identity when they assume a - // role. You do this by using the sts:SourceIdentity condition key in a role trust - // policy. You can use source identity information in CloudTrail logs to determine - // who took actions with a role. You can use the aws:SourceIdentity condition key - // to further control access to Amazon Web Services resources based on the value of - // source identity. For more information about using source identity, see Monitor - // and control actions taken with assumed roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html) - // in the IAM User Guide. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@- + // operation. + // + // You can require users to specify a source identity when they assume a role. You + // do this by using the sts:SourceIdentity condition key in a role trust policy. + // You can use source identity information in CloudTrail logs to determine who took + // actions with a role. You can use the aws:SourceIdentity condition key to + // further control access to Amazon Web Services resources based on the value of + // source identity. For more information about using source identity, see [Monitor and control actions taken with assumed roles]in the + // IAM User Guide. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- + // + // [Monitor and control actions taken with assumed roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html SourceIdentity *string // Metadata pertaining to the operation's result. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go index 2a57b72a..f88ab4a2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go @@ -16,92 +16,132 @@ import ( // mechanism for tying an enterprise identity store or directory to role-based // Amazon Web Services access without user-specific credentials or configuration. // For a comparison of AssumeRoleWithSAML with the other API operations that -// produce temporary credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. The temporary security credentials returned by this -// operation consist of an access key ID, a secret access key, and a security -// token. Applications can use these temporary security credentials to sign calls -// to Amazon Web Services services. Session Duration By default, the temporary -// security credentials created by AssumeRoleWithSAML last for one hour. However, -// you can use the optional DurationSeconds parameter to specify the duration of -// your session. Your role session lasts for the duration that you specify, or -// until the time specified in the SAML authentication response's -// SessionNotOnOrAfter value, whichever is shorter. You can provide a -// DurationSeconds value from 900 seconds (15 minutes) up to the maximum session -// duration setting for the role. This setting can have a value from 1 hour to 12 -// hours. To learn how to view the maximum value for your role, see View the -// Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) -// in the IAM User Guide. The maximum session duration limit applies when you use -// the AssumeRole* API operations or the assume-role* CLI commands. However the -// limit does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) -// in the IAM User Guide. Role chaining (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-role-chaining) -// limits your CLI or Amazon Web Services API role session to a maximum of one +// produce temporary credentials, see [Requesting Temporary Security Credentials]and [Comparing the Amazon Web Services STS API operations] in the IAM User Guide. +// +// The temporary security credentials returned by this operation consist of an +// access key ID, a secret access key, and a security token. Applications can use +// these temporary security credentials to sign calls to Amazon Web Services +// services. +// +// # Session Duration +// +// By default, the temporary security credentials created by AssumeRoleWithSAML +// last for one hour. However, you can use the optional DurationSeconds parameter +// to specify the duration of your session. Your role session lasts for the +// duration that you specify, or until the time specified in the SAML +// authentication response's SessionNotOnOrAfter value, whichever is shorter. You +// can provide a DurationSeconds value from 900 seconds (15 minutes) up to the +// maximum session duration setting for the role. This setting can have a value +// from 1 hour to 12 hours. To learn how to view the maximum value for your role, +// see [View the Maximum Session Duration Setting for a Role]in the IAM User Guide. The maximum session duration limit applies when you +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console URL. +// For more information, see [Using IAM Roles]in the IAM User Guide. +// +// [Role chaining]limits your CLI or Amazon Web Services API role session to a maximum of one // hour. When you use the AssumeRole API operation to assume a role, you can // specify the duration of your role session with the DurationSeconds parameter. // You can specify a parameter value of up to 43200 seconds (12 hours), depending // on the maximum session duration setting for your role. However, if you assume a // role using role chaining and provide a DurationSeconds parameter value greater -// than one hour, the operation fails. Permissions The temporary security -// credentials created by AssumeRoleWithSAML can be used to make API calls to any -// Amazon Web Services service with the following exception: you cannot call the -// STS GetFederationToken or GetSessionToken API operations. (Optional) You can -// pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policy Amazon -// Resource Names (ARNs) to use as managed session policies. The plaintext that you -// use for both inline and managed session policies can't exceed 2,048 characters. -// Passing policies to this operation returns new temporary credentials. The -// resulting session's permissions are the intersection of the role's -// identity-based policy and the session policies. You can use the role's temporary -// credentials in subsequent Amazon Web Services API calls to access resources in -// the account that owns the role. You cannot use session policies to grant more -// permissions than those allowed by the identity-based policy of the role that is -// being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. Calling AssumeRoleWithSAML does not require the use of -// Amazon Web Services security credentials. The identity of the caller is -// validated by using keys in the metadata document that is uploaded for the SAML -// provider entity for your identity provider. Calling AssumeRoleWithSAML can -// result in an entry in your CloudTrail logs. The entry includes the value in the -// NameID element of the SAML assertion. We recommend that you use a NameIDType -// that is not associated with any personally identifiable information (PII). For -// example, you could instead use the persistent identifier ( -// urn:oasis:names:tc:SAML:2.0:nameid-format:persistent ). Tags (Optional) You can -// configure your IdP to pass attributes into your SAML assertion as session tags. -// Each session tag consists of a key name and an associated value. For more -// information about session tags, see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. You can pass up to 50 session tags. The plaintext session -// tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. -// For these and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) -// in the IAM User Guide. An Amazon Web Services conversion compresses the passed -// inline session policy, managed policy ARNs, and session tags into a packed -// binary format that has a separate limit. Your request can fail for this limit -// even if your plaintext meets the other requirements. The PackedPolicySize -// response element indicates by percentage how close the policies and tags for -// your request are to the upper size limit. You can pass a session tag with the -// same key as a tag that is attached to the role. When you do, session tags -// override the role's tags with the same key. An administrator must grant you the -// permissions necessary to pass session tags. The administrator can also create -// granular permissions to allow you to pass only specific session tags. For more -// information, see Tutorial: Using Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. You can set the session tags as transitive. Transitive -// tags persist during role chaining. For more information, see Chaining Roles -// with Session Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. SAML Configuration Before your application can call -// AssumeRoleWithSAML , you must configure your SAML identity provider (IdP) to -// issue the claims required by Amazon Web Services. Additionally, you must use -// Identity and Access Management (IAM) to create a SAML provider entity in your -// Amazon Web Services account that represents your identity provider. You must -// also create an IAM role that specifies this SAML provider in its trust policy. +// than one hour, the operation fails. +// +// # Permissions +// +// The temporary security credentials created by AssumeRoleWithSAML can be used to +// make API calls to any Amazon Web Services service with the following exception: +// you cannot call the STS GetFederationToken or GetSessionToken API operations. +// +// (Optional) You can pass inline or managed [session policies] to this operation. You can pass a +// single JSON policy document to use as an inline session policy. You can also +// specify up to 10 managed policy Amazon Resource Names (ARNs) to use as managed +// session policies. The plaintext that you use for both inline and managed session +// policies can't exceed 2,048 characters. Passing policies to this operation +// returns new temporary credentials. The resulting session's permissions are the +// intersection of the role's identity-based policy and the session policies. You +// can use the role's temporary credentials in subsequent Amazon Web Services API +// calls to access resources in the account that owns the role. You cannot use +// session policies to grant more permissions than those allowed by the +// identity-based policy of the role that is being assumed. For more information, +// see [Session Policies]in the IAM User Guide. +// +// Calling AssumeRoleWithSAML does not require the use of Amazon Web Services +// security credentials. The identity of the caller is validated by using keys in +// the metadata document that is uploaded for the SAML provider entity for your +// identity provider. +// +// Calling AssumeRoleWithSAML can result in an entry in your CloudTrail logs. The +// entry includes the value in the NameID element of the SAML assertion. We +// recommend that you use a NameIDType that is not associated with any personally +// identifiable information (PII). For example, you could instead use the +// persistent identifier ( urn:oasis:names:tc:SAML:2.0:nameid-format:persistent ). +// +// # Tags +// +// (Optional) You can configure your IdP to pass attributes into your SAML +// assertion as session tags. Each session tag consists of a key name and an +// associated value. For more information about session tags, see [Passing Session Tags in STS]in the IAM User +// Guide. +// +// You can pass up to 50 session tags. The plaintext session tag keys can’t exceed +// 128 characters and the values can’t exceed 256 characters. For these and +// additional limits, see [IAM and STS Character Limits]in the IAM User Guide. +// +// An Amazon Web Services conversion compresses the passed inline session policy, +// managed policy ARNs, and session tags into a packed binary format that has a +// separate limit. Your request can fail for this limit even if your plaintext +// meets the other requirements. The PackedPolicySize response element indicates +// by percentage how close the policies and tags for your request are to the upper +// size limit. +// +// You can pass a session tag with the same key as a tag that is attached to the +// role. When you do, session tags override the role's tags with the same key. +// +// An administrator must grant you the permissions necessary to pass session tags. +// The administrator can also create granular permissions to allow you to pass only +// specific session tags. For more information, see [Tutorial: Using Tags for Attribute-Based Access Control]in the IAM User Guide. +// +// You can set the session tags as transitive. Transitive tags persist during role +// chaining. For more information, see [Chaining Roles with Session Tags]in the IAM User Guide. +// +// # SAML Configuration +// +// Before your application can call AssumeRoleWithSAML , you must configure your +// SAML identity provider (IdP) to issue the claims required by Amazon Web +// Services. Additionally, you must use Identity and Access Management (IAM) to +// create a SAML provider entity in your Amazon Web Services account that +// represents your identity provider. You must also create an IAM role that +// specifies this SAML provider in its trust policy. +// // For more information, see the following resources: -// - About SAML 2.0-based Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) -// in the IAM User Guide. -// - Creating SAML Identity Providers (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) -// in the IAM User Guide. -// - Configuring a Relying Party and Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) -// in the IAM User Guide. -// - Creating a Role for SAML 2.0 Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) -// in the IAM User Guide. +// +// [About SAML 2.0-based Federation] +// - in the IAM User Guide. +// +// [Creating SAML Identity Providers] +// - in the IAM User Guide. +// +// [Configuring a Relying Party and Claims] +// - in the IAM User Guide. +// +// [Creating a Role for SAML 2.0 Federation] +// - in the IAM User Guide. +// +// [View the Maximum Session Duration Setting for a Role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session +// [Creating a Role for SAML 2.0 Federation]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html +// [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length +// [Comparing the Amazon Web Services STS API operations]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison +// [Creating SAML Identity Providers]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html +// [session policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Requesting Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html +// [Tutorial: Using Tags for Attribute-Based Access Control]: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html +// [Configuring a Relying Party and Claims]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html +// [Role chaining]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-role-chaining +// [Using IAM Roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html +// [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html +// [About SAML 2.0-based Federation]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html +// [Chaining Roles with Session Tags]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining func (c *Client) AssumeRoleWithSAML(ctx context.Context, params *AssumeRoleWithSAMLInput, optFns ...func(*Options)) (*AssumeRoleWithSAMLOutput, error) { if params == nil { params = &AssumeRoleWithSAMLInput{} @@ -130,9 +170,11 @@ type AssumeRoleWithSAMLInput struct { // This member is required. RoleArn *string - // The base64 encoded SAML authentication response provided by the IdP. For more - // information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) - // in the IAM User Guide. + // The base64 encoded SAML authentication response provided by the IdP. + // + // For more information, see [Configuring a Relying Party and Adding Claims] in the IAM User Guide. + // + // [Configuring a Relying Party and Adding Claims]: https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html // // This member is required. SAMLAssertion *string @@ -146,92 +188,114 @@ type AssumeRoleWithSAMLInput struct { // than this setting, the operation fails. For example, if you specify a session // duration of 12 hours, but your administrator set the maximum session duration to // 6 hours, your operation fails. To learn how to view the maximum value for your - // role, see View the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. By default, the value is set to 3600 seconds. The - // DurationSeconds parameter is separate from the duration of a console session - // that you might request using the returned credentials. The request to the - // federation endpoint for a console sign-in token takes a SessionDuration + // role, see [View the Maximum Session Duration Setting for a Role]in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request to + // the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // Amazon Web Services Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. + // information, see [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]in the IAM User Guide. + // + // [View the Maximum Session Duration Setting for a Role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session + // [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html DurationSeconds *int32 // An IAM policy in JSON format that you want to use as an inline session policy. + // // This parameter is optional. Passing policies to this operation returns new // temporary credentials. The resulting session's permissions are the intersection // of the role's identity-based policy and the session policies. You can use the // role's temporary credentials in subsequent Amazon Web Services API calls to // access resources in the account that owns the role. You cannot use session // policies to grant more permissions than those allowed by the identity-based - // policy of the role that is being assumed. For more information, see Session - // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. The plaintext that you use for both inline and managed - // session policies can't exceed 2,048 characters. The JSON policy characters can - // be any ASCII character from the space character to the end of the valid - // character list (\u0020 through \u00FF). It can also include the tab (\u0009), - // linefeed (\u000A), and carriage return (\u000D) characters. An Amazon Web - // Services conversion compresses the passed inline session policy, managed policy - // ARNs, and session tags into a packed binary format that has a separate limit. - // Your request can fail for this limit even if your plaintext meets the other - // requirements. The PackedPolicySize response element indicates by percentage how - // close the policies and tags for your request are to the upper size limit. + // policy of the role that is being assumed. For more information, see [Session Policies]in the IAM + // User Guide. + // + // The plaintext that you use for both inline and managed session policies can't + // exceed 2,048 characters. The JSON policy characters can be any ASCII character + // from the space character to the end of the valid character list (\u0020 through + // \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage + // return (\u000D) characters. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session Policy *string // The Amazon Resource Names (ARNs) of the IAM managed policies that you want to // use as managed session policies. The policies must exist in the same account as - // the role. This parameter is optional. You can provide up to 10 managed policy - // ARNs. However, the plaintext that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, see - // Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. An Amazon Web Services conversion - // compresses the passed inline session policy, managed policy ARNs, and session - // tags into a packed binary format that has a separate limit. Your request can - // fail for this limit even if your plaintext meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. Passing policies to this - // operation returns new temporary credentials. The resulting session's permissions - // are the intersection of the role's identity-based policy and the session - // policies. You can use the role's temporary credentials in subsequent Amazon Web - // Services API calls to access resources in the account that owns the role. You - // cannot use session policies to grant more permissions than those allowed by the - // identity-based policy of the role that is being assumed. For more information, - // see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. + // the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plaintext that you use for both inline and managed session policies + // can't exceed 2,048 characters. For more information about ARNs, see [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]in the + // Amazon Web Services General Reference. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's + // identity-based policy and the session policies. You can use the role's temporary + // credentials in subsequent Amazon Web Services API calls to access resources in + // the account that owns the role. You cannot use session policies to grant more + // permissions than those allowed by the identity-based policy of the role that is + // being assumed. For more information, see [Session Policies]in the IAM User Guide. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html PolicyArns []types.PolicyDescriptorType noSmithyDocumentSerde } -// Contains the response to a successful AssumeRoleWithSAML request, including -// temporary Amazon Web Services credentials that can be used to make Amazon Web -// Services requests. +// Contains the response to a successful AssumeRoleWithSAML request, including temporary Amazon Web +// Services credentials that can be used to make Amazon Web Services requests. type AssumeRoleWithSAMLOutput struct { // The identifiers for the temporary security credentials that the operation // returns. AssumedRoleUser *types.AssumedRoleUser - // The value of the Recipient attribute of the SubjectConfirmationData element of + // The value of the Recipient attribute of the SubjectConfirmationData element of // the SAML assertion. Audience *string // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. The size of the security token - // that STS API operations return is not fixed. We strongly recommend that you make - // no assumptions about the maximum size. + // access key, and a security (or session) token. + // + // The size of the security token that STS API operations return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. Credentials *types.Credentials // The value of the Issuer element of the SAML assertion. Issuer *string // A hash value based on the concatenation of the following: + // // - The Issuer response value. + // // - The Amazon Web Services account ID. + // // - The friendly name (the last part of the ARN) of the SAML provider in IAM. + // // The combination of NameQualifier and Subject can be used to uniquely identify a - // user. The following pseudocode shows how the hash value is calculated: BASE64 ( - // SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" ) ) + // user. + // + // The following pseudocode shows how the hash value is calculated: + // + // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" ) ) NameQualifier *string // A percentage value that indicates the packed size of the session policies and @@ -240,31 +304,36 @@ type AssumeRoleWithSAMLOutput struct { // allowed space. PackedPolicySize *int32 - // The value in the SourceIdentity attribute in the SAML assertion. You can - // require users to set a source identity value when they assume a role. You do - // this by using the sts:SourceIdentity condition key in a role trust policy. That - // way, actions that are taken with the role are associated with that user. After - // the source identity is set, the value cannot be changed. It is present in the - // request for all actions that are taken by the role and persists across chained - // role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining) - // sessions. You can configure your SAML identity provider to use an attribute - // associated with your users, like user name or email, as the source identity when - // calling AssumeRoleWithSAML . You do this by adding an attribute to the SAML - // assertion. For more information about using source identity, see Monitor and - // control actions taken with assumed roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html) - // in the IAM User Guide. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@- + // The value in the SourceIdentity attribute in the SAML assertion. + // + // You can require users to set a source identity value when they assume a role. + // You do this by using the sts:SourceIdentity condition key in a role trust + // policy. That way, actions that are taken with the role are associated with that + // user. After the source identity is set, the value cannot be changed. It is + // present in the request for all actions that are taken by the role and persists + // across [chained role]sessions. You can configure your SAML identity provider to use an + // attribute associated with your users, like user name or email, as the source + // identity when calling AssumeRoleWithSAML . You do this by adding an attribute to + // the SAML assertion. For more information about using source identity, see [Monitor and control actions taken with assumed roles]in + // the IAM User Guide. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- + // + // [chained role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining + // [Monitor and control actions taken with assumed roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html SourceIdentity *string // The value of the NameID element in the Subject element of the SAML assertion. Subject *string - // The format of the name ID, as defined by the Format attribute in the NameID + // The format of the name ID, as defined by the Format attribute in the NameID // element of the SAML assertion. Typical examples of the format are transient or - // persistent . If the format includes the prefix - // urn:oasis:names:tc:SAML:2.0:nameid-format , that prefix is removed. For example, + // persistent . + // + // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format , + // that prefix is removed. For example, // urn:oasis:names:tc:SAML:2.0:nameid-format:transient is returned as transient . // If the format includes any other prefix, the format is returned with no // modifications. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go index 98108ce6..6c8cf43e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go @@ -14,105 +14,143 @@ import ( // Returns a set of temporary security credentials for users who have been // authenticated in a mobile or web application with a web identity provider. // Example providers include the OAuth 2.0 providers Login with Amazon and -// Facebook, or any OpenID Connect-compatible identity provider such as Google or -// Amazon Cognito federated identities (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html) -// . For mobile applications, we recommend that you use Amazon Cognito. You can use -// Amazon Cognito with the Amazon Web Services SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) -// and the Amazon Web Services SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/) -// to uniquely identify a user. You can also supply the user with a consistent -// identity throughout the lifetime of an application. To learn more about Amazon -// Cognito, see Amazon Cognito identity pools (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html) -// in Amazon Cognito Developer Guide. Calling AssumeRoleWithWebIdentity does not -// require the use of Amazon Web Services security credentials. Therefore, you can -// distribute an application (for example, on mobile devices) that requests -// temporary security credentials without including long-term Amazon Web Services -// credentials in the application. You also don't need to deploy server-based proxy -// services that use long-term Amazon Web Services credentials. Instead, the -// identity of the caller is validated by using a token from the web identity -// provider. For a comparison of AssumeRoleWithWebIdentity with the other API -// operations that produce temporary credentials, see Requesting Temporary -// Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. The temporary security credentials returned by this API -// consist of an access key ID, a secret access key, and a security token. -// Applications can use these temporary security credentials to sign calls to -// Amazon Web Services service API operations. Session Duration By default, the -// temporary security credentials created by AssumeRoleWithWebIdentity last for -// one hour. However, you can use the optional DurationSeconds parameter to -// specify the duration of your session. You can provide a value from 900 seconds -// (15 minutes) up to the maximum session duration setting for the role. This -// setting can have a value from 1 hour to 12 hours. To learn how to view the -// maximum value for your role, see View the Maximum Session Duration Setting for -// a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) -// in the IAM User Guide. The maximum session duration limit applies when you use -// the AssumeRole* API operations or the assume-role* CLI commands. However the -// limit does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) -// in the IAM User Guide. Permissions The temporary security credentials created by -// AssumeRoleWithWebIdentity can be used to make API calls to any Amazon Web -// Services service with the following exception: you cannot call the STS -// GetFederationToken or GetSessionToken API operations. (Optional) You can pass -// inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policy Amazon -// Resource Names (ARNs) to use as managed session policies. The plaintext that you -// use for both inline and managed session policies can't exceed 2,048 characters. -// Passing policies to this operation returns new temporary credentials. The -// resulting session's permissions are the intersection of the role's -// identity-based policy and the session policies. You can use the role's temporary -// credentials in subsequent Amazon Web Services API calls to access resources in -// the account that owns the role. You cannot use session policies to grant more -// permissions than those allowed by the identity-based policy of the role that is -// being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. Tags (Optional) You can configure your IdP to pass -// attributes into your web identity token as session tags. Each session tag -// consists of a key name and an associated value. For more information about -// session tags, see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. You can pass up to 50 session tags. The plaintext session -// tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. -// For these and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) -// in the IAM User Guide. An Amazon Web Services conversion compresses the passed -// inline session policy, managed policy ARNs, and session tags into a packed -// binary format that has a separate limit. Your request can fail for this limit -// even if your plaintext meets the other requirements. The PackedPolicySize -// response element indicates by percentage how close the policies and tags for -// your request are to the upper size limit. You can pass a session tag with the -// same key as a tag that is attached to the role. When you do, the session tag -// overrides the role tag with the same key. An administrator must grant you the -// permissions necessary to pass session tags. The administrator can also create -// granular permissions to allow you to pass only specific session tags. For more -// information, see Tutorial: Using Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. You can set the session tags as transitive. Transitive -// tags persist during role chaining. For more information, see Chaining Roles -// with Session Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. Identities Before your application can call -// AssumeRoleWithWebIdentity , you must have an identity token from a supported -// identity provider and create a role that the application can assume. The role -// that your application assumes must trust the identity provider that is -// associated with the identity token. In other words, the identity provider must -// be specified in the role's trust policy. Calling AssumeRoleWithWebIdentity can -// result in an entry in your CloudTrail logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims) -// of the provided web identity token. We recommend that you avoid using any -// personally identifiable information (PII) in this field. For example, you could -// instead use a GUID or a pairwise identifier, as suggested in the OIDC -// specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes) -// . For more information about how to use web identity federation and the +// Facebook, or any OpenID Connect-compatible identity provider such as Google or [Amazon Cognito federated identities]. +// +// For mobile applications, we recommend that you use Amazon Cognito. You can use +// Amazon Cognito with the [Amazon Web Services SDK for iOS Developer Guide]and the [Amazon Web Services SDK for Android Developer Guide] to uniquely identify a user. You can also +// supply the user with a consistent identity throughout the lifetime of an +// application. +// +// To learn more about Amazon Cognito, see [Amazon Cognito identity pools] in Amazon Cognito Developer Guide. +// +// Calling AssumeRoleWithWebIdentity does not require the use of Amazon Web +// Services security credentials. Therefore, you can distribute an application (for +// example, on mobile devices) that requests temporary security credentials without +// including long-term Amazon Web Services credentials in the application. You also +// don't need to deploy server-based proxy services that use long-term Amazon Web +// Services credentials. Instead, the identity of the caller is validated by using +// a token from the web identity provider. For a comparison of +// AssumeRoleWithWebIdentity with the other API operations that produce temporary +// credentials, see [Requesting Temporary Security Credentials]and [Comparing the Amazon Web Services STS API operations] in the IAM User Guide. +// +// The temporary security credentials returned by this API consist of an access +// key ID, a secret access key, and a security token. Applications can use these +// temporary security credentials to sign calls to Amazon Web Services service API +// operations. +// +// # Session Duration +// +// By default, the temporary security credentials created by +// AssumeRoleWithWebIdentity last for one hour. However, you can use the optional +// DurationSeconds parameter to specify the duration of your session. You can +// provide a value from 900 seconds (15 minutes) up to the maximum session duration +// setting for the role. This setting can have a value from 1 hour to 12 hours. To +// learn how to view the maximum value for your role, see [View the Maximum Session Duration Setting for a Role]in the IAM User Guide. +// The maximum session duration limit applies when you use the AssumeRole* API +// operations or the assume-role* CLI commands. However the limit does not apply +// when you use those operations to create a console URL. For more information, see +// [Using IAM Roles]in the IAM User Guide. +// +// # Permissions +// +// The temporary security credentials created by AssumeRoleWithWebIdentity can be +// used to make API calls to any Amazon Web Services service with the following +// exception: you cannot call the STS GetFederationToken or GetSessionToken API +// operations. +// +// (Optional) You can pass inline or managed [session policies] to this operation. You can pass a +// single JSON policy document to use as an inline session policy. You can also +// specify up to 10 managed policy Amazon Resource Names (ARNs) to use as managed +// session policies. The plaintext that you use for both inline and managed session +// policies can't exceed 2,048 characters. Passing policies to this operation +// returns new temporary credentials. The resulting session's permissions are the +// intersection of the role's identity-based policy and the session policies. You +// can use the role's temporary credentials in subsequent Amazon Web Services API +// calls to access resources in the account that owns the role. You cannot use +// session policies to grant more permissions than those allowed by the +// identity-based policy of the role that is being assumed. For more information, +// see [Session Policies]in the IAM User Guide. +// +// # Tags +// +// (Optional) You can configure your IdP to pass attributes into your web identity +// token as session tags. Each session tag consists of a key name and an associated +// value. For more information about session tags, see [Passing Session Tags in STS]in the IAM User Guide. +// +// You can pass up to 50 session tags. The plaintext session tag keys can’t exceed +// 128 characters and the values can’t exceed 256 characters. For these and +// additional limits, see [IAM and STS Character Limits]in the IAM User Guide. +// +// An Amazon Web Services conversion compresses the passed inline session policy, +// managed policy ARNs, and session tags into a packed binary format that has a +// separate limit. Your request can fail for this limit even if your plaintext +// meets the other requirements. The PackedPolicySize response element indicates +// by percentage how close the policies and tags for your request are to the upper +// size limit. +// +// You can pass a session tag with the same key as a tag that is attached to the +// role. When you do, the session tag overrides the role tag with the same key. +// +// An administrator must grant you the permissions necessary to pass session tags. +// The administrator can also create granular permissions to allow you to pass only +// specific session tags. For more information, see [Tutorial: Using Tags for Attribute-Based Access Control]in the IAM User Guide. +// +// You can set the session tags as transitive. Transitive tags persist during role +// chaining. For more information, see [Chaining Roles with Session Tags]in the IAM User Guide. +// +// # Identities +// +// Before your application can call AssumeRoleWithWebIdentity , you must have an +// identity token from a supported identity provider and create a role that the +// application can assume. The role that your application assumes must trust the +// identity provider that is associated with the identity token. In other words, +// the identity provider must be specified in the role's trust policy. +// +// Calling AssumeRoleWithWebIdentity can result in an entry in your CloudTrail +// logs. The entry includes the [Subject]of the provided web identity token. We recommend +// that you avoid using any personally identifiable information (PII) in this +// field. For example, you could instead use a GUID or a pairwise identifier, as [suggested in the OIDC specification]. +// +// For more information about how to use web identity federation and the // AssumeRoleWithWebIdentity API, see the following resources: -// - Using Web Identity Federation API Operations for Mobile Apps (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) -// and Federation Through a Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity) -// . -// - Web Identity Federation Playground (https://aws.amazon.com/blogs/aws/the-aws-web-identity-federation-playground/) -// . Walk through the process of authenticating through Login with Amazon, +// +// [Using Web Identity Federation API Operations for Mobile Apps] +// - and [Federation Through a Web-based Identity Provider]. +// +// [Web Identity Federation Playground] +// - . Walk through the process of authenticating through Login with Amazon, // Facebook, or Google, getting temporary security credentials, and then using // those credentials to make a request to Amazon Web Services. -// - Amazon Web Services SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) -// and Amazon Web Services SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/) -// . These toolkits contain sample apps that show how to invoke the identity -// providers. The toolkits then show how to use the information from these +// +// [Amazon Web Services SDK for iOS Developer Guide] +// - and [Amazon Web Services SDK for Android Developer Guide]. These toolkits contain sample apps that show how to invoke the +// identity providers. The toolkits then show how to use the information from these // providers to get and use temporary security credentials. -// - Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications) -// . This article discusses web identity federation and shows an example of how to -// use web identity federation to get access to content in Amazon S3. +// +// [Web Identity Federation with Mobile Applications] +// - . This article discusses web identity federation and shows an example of +// how to use web identity federation to get access to content in Amazon S3. +// +// [Amazon Web Services SDK for iOS Developer Guide]: http://aws.amazon.com/sdkforios/ +// [View the Maximum Session Duration Setting for a Role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session +// [Web Identity Federation Playground]: https://aws.amazon.com/blogs/aws/the-aws-web-identity-federation-playground/ +// [Amazon Web Services SDK for Android Developer Guide]: http://aws.amazon.com/sdkforandroid/ +// [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length +// [Comparing the Amazon Web Services STS API operations]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison +// [session policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Requesting Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html +// [Subject]: http://openid.net/specs/openid-connect-core-1_0.html#Claims +// [Tutorial: Using Tags for Attribute-Based Access Control]: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html +// [Amazon Cognito identity pools]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html +// [Federation Through a Web-based Identity Provider]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity +// [Using IAM Roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html +// [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Amazon Cognito federated identities]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html +// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html +// [Chaining Roles with Session Tags]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining +// [Web Identity Federation with Mobile Applications]: http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications +// [Using Web Identity Federation API Operations for Mobile Apps]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html +// [suggested in the OIDC specification]: http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes func (c *Client) AssumeRoleWithWebIdentity(ctx context.Context, params *AssumeRoleWithWebIdentityInput, optFns ...func(*Options)) (*AssumeRoleWithWebIdentityOutput, error) { if params == nil { params = &AssumeRoleWithWebIdentityInput{} @@ -139,10 +177,11 @@ type AssumeRoleWithWebIdentityInput struct { // identifier that is associated with the user who is using your application. That // way, the temporary security credentials that your application will use are // associated with that user. This session name is included as part of the ARN and - // assumed role ID in the AssumedRoleUser response element. The regex used to - // validate this parameter is a string of characters consisting of upper- and - // lower-case alphanumeric characters with no spaces. You can also include - // underscores or any of the following characters: =,.@- + // assumed role ID in the AssumedRoleUser response element. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- // // This member is required. RoleSessionName *string @@ -162,73 +201,90 @@ type AssumeRoleWithWebIdentityInput struct { // higher than this setting, the operation fails. For example, if you specify a // session duration of 12 hours, but your administrator set the maximum session // duration to 6 hours, your operation fails. To learn how to view the maximum - // value for your role, see View the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. By default, the value is set to 3600 seconds. The - // DurationSeconds parameter is separate from the duration of a console session - // that you might request using the returned credentials. The request to the - // federation endpoint for a console sign-in token takes a SessionDuration + // value for your role, see [View the Maximum Session Duration Setting for a Role]in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request to + // the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // Amazon Web Services Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. + // information, see [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]in the IAM User Guide. + // + // [View the Maximum Session Duration Setting for a Role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session + // [Creating a URL that Enables Federated Users to Access the Amazon Web Services Management Console]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html DurationSeconds *int32 // An IAM policy in JSON format that you want to use as an inline session policy. + // // This parameter is optional. Passing policies to this operation returns new // temporary credentials. The resulting session's permissions are the intersection // of the role's identity-based policy and the session policies. You can use the // role's temporary credentials in subsequent Amazon Web Services API calls to // access resources in the account that owns the role. You cannot use session // policies to grant more permissions than those allowed by the identity-based - // policy of the role that is being assumed. For more information, see Session - // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. The plaintext that you use for both inline and managed - // session policies can't exceed 2,048 characters. The JSON policy characters can - // be any ASCII character from the space character to the end of the valid - // character list (\u0020 through \u00FF). It can also include the tab (\u0009), - // linefeed (\u000A), and carriage return (\u000D) characters. An Amazon Web - // Services conversion compresses the passed inline session policy, managed policy - // ARNs, and session tags into a packed binary format that has a separate limit. - // Your request can fail for this limit even if your plaintext meets the other - // requirements. The PackedPolicySize response element indicates by percentage how - // close the policies and tags for your request are to the upper size limit. + // policy of the role that is being assumed. For more information, see [Session Policies]in the IAM + // User Guide. + // + // The plaintext that you use for both inline and managed session policies can't + // exceed 2,048 characters. The JSON policy characters can be any ASCII character + // from the space character to the end of the valid character list (\u0020 through + // \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage + // return (\u000D) characters. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session Policy *string // The Amazon Resource Names (ARNs) of the IAM managed policies that you want to // use as managed session policies. The policies must exist in the same account as - // the role. This parameter is optional. You can provide up to 10 managed policy - // ARNs. However, the plaintext that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, see - // Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. An Amazon Web Services conversion - // compresses the passed inline session policy, managed policy ARNs, and session - // tags into a packed binary format that has a separate limit. Your request can - // fail for this limit even if your plaintext meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. Passing policies to this - // operation returns new temporary credentials. The resulting session's permissions - // are the intersection of the role's identity-based policy and the session - // policies. You can use the role's temporary credentials in subsequent Amazon Web - // Services API calls to access resources in the account that owns the role. You - // cannot use session policies to grant more permissions than those allowed by the - // identity-based policy of the role that is being assumed. For more information, - // see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. + // the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plaintext that you use for both inline and managed session policies + // can't exceed 2,048 characters. For more information about ARNs, see [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]in the + // Amazon Web Services General Reference. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's + // identity-based policy and the session policies. You can use the role's temporary + // credentials in subsequent Amazon Web Services API calls to access resources in + // the account that owns the role. You cannot use session policies to grant more + // permissions than those allowed by the identity-based policy of the role that is + // being assumed. For more information, see [Session Policies]in the IAM User Guide. + // + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html PolicyArns []types.PolicyDescriptorType // The fully qualified host component of the domain name of the OAuth 2.0 identity // provider. Do not specify this value for an OpenID Connect identity provider. + // // Currently www.amazon.com and graph.facebook.com are the only supported identity // providers for OAuth 2.0 access tokens. Do not include URL schemes and port - // numbers. Do not specify this value for OpenID Connect ID tokens. + // numbers. + // + // Do not specify this value for OpenID Connect ID tokens. ProviderId *string noSmithyDocumentSerde } -// Contains the response to a successful AssumeRoleWithWebIdentity request, -// including temporary Amazon Web Services credentials that can be used to make -// Amazon Web Services requests. +// Contains the response to a successful AssumeRoleWithWebIdentity request, including temporary Amazon Web +// Services credentials that can be used to make Amazon Web Services requests. type AssumeRoleWithWebIdentityOutput struct { // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers @@ -244,9 +300,10 @@ type AssumeRoleWithWebIdentityOutput struct { Audience *string // The temporary security credentials, which include an access key ID, a secret - // access key, and a security token. The size of the security token that STS API - // operations return is not fixed. We strongly recommend that you make no - // assumptions about the maximum size. + // access key, and a security token. + // + // The size of the security token that STS API operations return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. Credentials *types.Credentials // A percentage value that indicates the packed size of the session policies and @@ -255,30 +312,34 @@ type AssumeRoleWithWebIdentityOutput struct { // allowed space. PackedPolicySize *int32 - // The issuing authority of the web identity token presented. For OpenID Connect + // The issuing authority of the web identity token presented. For OpenID Connect // ID tokens, this contains the value of the iss field. For OAuth 2.0 access // tokens, this contains the value of the ProviderId parameter that was passed in // the AssumeRoleWithWebIdentity request. Provider *string // The value of the source identity that is returned in the JSON web token (JWT) - // from the identity provider. You can require users to set a source identity value - // when they assume a role. You do this by using the sts:SourceIdentity condition - // key in a role trust policy. That way, actions that are taken with the role are - // associated with that user. After the source identity is set, the value cannot be - // changed. It is present in the request for all actions that are taken by the role - // and persists across chained role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining) - // sessions. You can configure your identity provider to use an attribute + // from the identity provider. + // + // You can require users to set a source identity value when they assume a role. + // You do this by using the sts:SourceIdentity condition key in a role trust + // policy. That way, actions that are taken with the role are associated with that + // user. After the source identity is set, the value cannot be changed. It is + // present in the request for all actions that are taken by the role and persists + // across [chained role]sessions. You can configure your identity provider to use an attribute // associated with your users, like user name or email, as the source identity when // calling AssumeRoleWithWebIdentity . You do this by adding a claim to the JSON - // web token. To learn more about OIDC tokens and claims, see Using Tokens with - // User Pools (https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html) - // in the Amazon Cognito Developer Guide. For more information about using source - // identity, see Monitor and control actions taken with assumed roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html) - // in the IAM User Guide. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@- + // web token. To learn more about OIDC tokens and claims, see [Using Tokens with User Pools]in the Amazon + // Cognito Developer Guide. For more information about using source identity, see [Monitor and control actions taken with assumed roles] + // in the IAM User Guide. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- + // + // [chained role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining + // [Monitor and control actions taken with assumed roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html + // [Using Tokens with User Pools]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html SourceIdentity *string // The unique user identifier that is returned by the identity provider. This diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go index b4ad54ab..186a8cb5 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go @@ -11,28 +11,39 @@ import ( ) // Decodes additional information about the authorization status of a request from -// an encoded message returned in response to an Amazon Web Services request. For -// example, if a user is not authorized to perform an operation that he or she has -// requested, the request returns a Client.UnauthorizedOperation response (an HTTP -// 403 response). Some Amazon Web Services operations additionally return an -// encoded message that can provide details about this authorization failure. Only -// certain Amazon Web Services operations return an encoded authorization message. -// The documentation for an individual operation indicates whether that operation -// returns an encoded message in addition to returning an HTTP code. The message is -// encoded because the details of the authorization status can contain privileged -// information that the user who requested the operation should not see. To decode -// an authorization status message, a user must be granted permissions through an -// IAM policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) -// to request the DecodeAuthorizationMessage ( sts:DecodeAuthorizationMessage ) -// action. The decoded message includes the following type of information: +// an encoded message returned in response to an Amazon Web Services request. +// +// For example, if a user is not authorized to perform an operation that he or she +// has requested, the request returns a Client.UnauthorizedOperation response (an +// HTTP 403 response). Some Amazon Web Services operations additionally return an +// encoded message that can provide details about this authorization failure. +// +// Only certain Amazon Web Services operations return an encoded authorization +// message. The documentation for an individual operation indicates whether that +// operation returns an encoded message in addition to returning an HTTP code. +// +// The message is encoded because the details of the authorization status can +// contain privileged information that the user who requested the operation should +// not see. To decode an authorization status message, a user must be granted +// permissions through an IAM [policy]to request the DecodeAuthorizationMessage ( +// sts:DecodeAuthorizationMessage ) action. +// +// The decoded message includes the following type of information: +// // - Whether the request was denied due to an explicit deny or due to the -// absence of an explicit allow. For more information, see Determining Whether a -// Request is Allowed or Denied (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) -// in the IAM User Guide. +// absence of an explicit allow. For more information, see [Determining Whether a Request is Allowed or Denied]in the IAM User +// Guide. +// // - The principal who made the request. +// // - The requested action. +// // - The requested resource. +// // - The values of condition keys in the context of the user's request. +// +// [Determining Whether a Request is Allowed or Denied]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow +// [policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html func (c *Client) DecodeAuthorizationMessage(ctx context.Context, params *DecodeAuthorizationMessageInput, optFns ...func(*Options)) (*DecodeAuthorizationMessageOutput, error) { if params == nil { params = &DecodeAuthorizationMessageInput{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go index 1f7cbcc2..b6eb6401 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go @@ -10,23 +10,31 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Returns the account identifier for the specified access key ID. Access keys -// consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE ) and -// a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ). -// For more information about access keys, see Managing Access Keys for IAM Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) -// in the IAM User Guide. When you pass an access key ID to this operation, it -// returns the ID of the Amazon Web Services account to which the keys belong. -// Access key IDs beginning with AKIA are long-term credentials for an IAM user or -// the Amazon Web Services account root user. Access key IDs beginning with ASIA -// are temporary credentials that are created using STS operations. If the account -// in the response belongs to you, you can sign in as the root user and review your -// root user access keys. Then, you can pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html) -// to learn which IAM user owns the keys. To learn who requested the temporary -// credentials for an ASIA access key, view the STS events in your CloudTrail logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html) -// in the IAM User Guide. This operation does not indicate the state of the access -// key. The key might be active, inactive, or deleted. Active keys might not have -// permissions to perform an operation. Providing a deleted access key might return -// an error that the key doesn't exist. +// Returns the account identifier for the specified access key ID. +// +// Access keys consist of two parts: an access key ID (for example, +// AKIAIOSFODNN7EXAMPLE ) and a secret access key (for example, +// wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ). For more information about access +// keys, see [Managing Access Keys for IAM Users]in the IAM User Guide. +// +// When you pass an access key ID to this operation, it returns the ID of the +// Amazon Web Services account to which the keys belong. Access key IDs beginning +// with AKIA are long-term credentials for an IAM user or the Amazon Web Services +// account root user. Access key IDs beginning with ASIA are temporary credentials +// that are created using STS operations. If the account in the response belongs to +// you, you can sign in as the root user and review your root user access keys. +// Then, you can pull a [credentials report]to learn which IAM user owns the keys. To learn who +// requested the temporary credentials for an ASIA access key, view the STS events +// in your [CloudTrail logs]in the IAM User Guide. +// +// This operation does not indicate the state of the access key. The key might be +// active, inactive, or deleted. Active keys might not have permissions to perform +// an operation. Providing a deleted access key might return an error that the key +// doesn't exist. +// +// [credentials report]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html +// [CloudTrail logs]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html +// [Managing Access Keys for IAM Users]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html func (c *Client) GetAccessKeyInfo(ctx context.Context, params *GetAccessKeyInfoInput, optFns ...func(*Options)) (*GetAccessKeyInfoOutput, error) { if params == nil { params = &GetAccessKeyInfoInput{} @@ -44,9 +52,10 @@ func (c *Client) GetAccessKeyInfo(ctx context.Context, params *GetAccessKeyInfoI type GetAccessKeyInfoInput struct { - // The identifier of an access key. This parameter allows (through its regex - // pattern) a string of characters that can consist of any upper- or lowercase - // letter or digit. + // The identifier of an access key. + // + // This parameter allows (through its regex pattern) a string of characters that + // can consist of any upper- or lowercase letter or digit. // // This member is required. AccessKeyId *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go index acb7ede4..ed4c8283 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go @@ -12,13 +12,15 @@ import ( ) // Returns details about the IAM user or role whose credentials are used to call -// the operation. No permissions are required to perform this operation. If an -// administrator attaches a policy to your identity that explicitly denies access -// to the sts:GetCallerIdentity action, you can still perform this operation. -// Permissions are not required because the same information is returned when -// access is denied. To view an example response, see I Am Not Authorized to -// Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa) -// in the IAM User Guide. +// the operation. +// +// No permissions are required to perform this operation. If an administrator +// attaches a policy to your identity that explicitly denies access to the +// sts:GetCallerIdentity action, you can still perform this operation. Permissions +// are not required because the same information is returned when access is denied. +// To view an example response, see [I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice]in the IAM User Guide. +// +// [I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice]: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa func (c *Client) GetCallerIdentity(ctx context.Context, params *GetCallerIdentityInput, optFns ...func(*Options)) (*GetCallerIdentityOutput, error) { if params == nil { params = &GetCallerIdentityInput{} @@ -38,8 +40,8 @@ type GetCallerIdentityInput struct { noSmithyDocumentSerde } -// Contains the response to a successful GetCallerIdentity request, including -// information about the entity making the request. +// Contains the response to a successful GetCallerIdentity request, including information about the +// entity making the request. type GetCallerIdentityOutput struct { // The Amazon Web Services account ID number of the account that owns or contains @@ -51,8 +53,10 @@ type GetCallerIdentityOutput struct { // The unique identifier of the calling entity. The exact value depends on the // type of entity that is making the call. The values returned are those listed in - // the aws:userid column in the Principal table (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) - // found on the Policy Variables reference page in the IAM User Guide. + // the aws:userid column in the [Principal table]found on the Policy Variables reference page in + // the IAM User Guide. + // + // [Principal table]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable UserId *string // Metadata pertaining to the operation's result. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go index 3679618c..37bde0cc 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go @@ -14,74 +14,100 @@ import ( // Returns a set of temporary security credentials (consisting of an access key // ID, a secret access key, and a security token) for a user. A typical use is in a // proxy application that gets temporary security credentials on behalf of -// distributed applications inside a corporate network. You must call the -// GetFederationToken operation using the long-term security credentials of an IAM -// user. As a result, this call is appropriate in contexts where those credentials -// can be safeguarded, usually in a server-based application. For a comparison of -// GetFederationToken with the other API operations that produce temporary -// credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. Although it is possible to call GetFederationToken using -// the security credentials of an Amazon Web Services account root user rather than -// an IAM user that you create for the purpose of a proxy application, we do not -// recommend it. For more information, see Safeguard your root user credentials -// and don't use them for everyday tasks (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials) -// in the IAM User Guide. You can create a mobile-based or browser-based app that -// can authenticate users using a web identity provider like Login with Amazon, -// Facebook, Google, or an OpenID Connect-compatible identity provider. In this -// case, we recommend that you use Amazon Cognito (http://aws.amazon.com/cognito/) -// or AssumeRoleWithWebIdentity . For more information, see Federation Through a -// Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity) -// in the IAM User Guide. Session duration The temporary credentials are valid for -// the specified duration, from 900 seconds (15 minutes) up to a maximum of 129,600 -// seconds (36 hours). The default session duration is 43,200 seconds (12 hours). -// Temporary credentials obtained by using the root user credentials have a maximum -// duration of 3,600 seconds (1 hour). Permissions You can use the temporary -// credentials created by GetFederationToken in any Amazon Web Services service -// with the following exceptions: +// distributed applications inside a corporate network. +// +// You must call the GetFederationToken operation using the long-term security +// credentials of an IAM user. As a result, this call is appropriate in contexts +// where those credentials can be safeguarded, usually in a server-based +// application. For a comparison of GetFederationToken with the other API +// operations that produce temporary credentials, see [Requesting Temporary Security Credentials]and [Comparing the Amazon Web Services STS API operations] in the IAM User Guide. +// +// Although it is possible to call GetFederationToken using the security +// credentials of an Amazon Web Services account root user rather than an IAM user +// that you create for the purpose of a proxy application, we do not recommend it. +// For more information, see [Safeguard your root user credentials and don't use them for everyday tasks]in the IAM User Guide. +// +// You can create a mobile-based or browser-based app that can authenticate users +// using a web identity provider like Login with Amazon, Facebook, Google, or an +// OpenID Connect-compatible identity provider. In this case, we recommend that you +// use [Amazon Cognito]or AssumeRoleWithWebIdentity . For more information, see [Federation Through a Web-based Identity Provider] in the IAM User +// Guide. +// +// # Session duration +// +// The temporary credentials are valid for the specified duration, from 900 +// seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default +// session duration is 43,200 seconds (12 hours). Temporary credentials obtained by +// using the root user credentials have a maximum duration of 3,600 seconds (1 +// hour). +// +// # Permissions +// +// You can use the temporary credentials created by GetFederationToken in any +// Amazon Web Services service with the following exceptions: +// // - You cannot call any IAM operations using the CLI or the Amazon Web Services // API. This limitation does not apply to console sessions. +// // - You cannot call any STS operations except GetCallerIdentity . // -// You can use temporary credentials for single sign-on (SSO) to the console. You -// must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policy Amazon -// Resource Names (ARNs) to use as managed session policies. The plaintext that you -// use for both inline and managed session policies can't exceed 2,048 characters. +// You can use temporary credentials for single sign-on (SSO) to the console. +// +// You must pass an inline or managed [session policy] to this operation. You can pass a single +// JSON policy document to use as an inline session policy. You can also specify up +// to 10 managed policy Amazon Resource Names (ARNs) to use as managed session +// policies. The plaintext that you use for both inline and managed session +// policies can't exceed 2,048 characters. +// // Though the session policy parameters are optional, if you do not pass a policy, // then the resulting federated user session has no permissions. When you pass // session policies, the session permissions are the intersection of the IAM user // policies and the session policies that you pass. This gives you a way to further // restrict the permissions for a federated user. You cannot use session policies // to grant more permissions than those that are defined in the permissions policy -// of the IAM user. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. For information about using GetFederationToken to create -// temporary security credentials, see GetFederationToken—Federation Through a -// Custom Identity Broker (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken) -// . You can use the credentials to access a resource that has a resource-based +// of the IAM user. For more information, see [Session Policies]in the IAM User Guide. For +// information about using GetFederationToken to create temporary security +// credentials, see [GetFederationToken—Federation Through a Custom Identity Broker]. +// +// You can use the credentials to access a resource that has a resource-based // policy. If that policy specifically references the federated user session in the // Principal element of the policy, the session has the permissions allowed by the // policy. These permissions are granted in addition to the permissions granted by -// the session policies. Tags (Optional) You can pass tag key-value pairs to your -// session. These are called session tags. For more information about session tags, -// see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. You can create a mobile-based or browser-based app that -// can authenticate users using a web identity provider like Login with Amazon, -// Facebook, Google, or an OpenID Connect-compatible identity provider. In this -// case, we recommend that you use Amazon Cognito (http://aws.amazon.com/cognito/) -// or AssumeRoleWithWebIdentity . For more information, see Federation Through a -// Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity) -// in the IAM User Guide. An administrator must grant you the permissions necessary -// to pass session tags. The administrator can also create granular permissions to -// allow you to pass only specific session tags. For more information, see -// Tutorial: Using Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. Tag key–value pairs are not case sensitive, but case is -// preserved. This means that you cannot have separate Department and department -// tag keys. Assume that the user that you are federating has the Department = -// Marketing tag and you pass the department = engineering session tag. Department -// and department are not saved as separate tags, and the session tag passed in -// the request takes precedence over the user tag. +// the session policies. +// +// # Tags +// +// (Optional) You can pass tag key-value pairs to your session. These are called +// session tags. For more information about session tags, see [Passing Session Tags in STS]in the IAM User +// Guide. +// +// You can create a mobile-based or browser-based app that can authenticate users +// using a web identity provider like Login with Amazon, Facebook, Google, or an +// OpenID Connect-compatible identity provider. In this case, we recommend that you +// use [Amazon Cognito]or AssumeRoleWithWebIdentity . For more information, see [Federation Through a Web-based Identity Provider] in the IAM User +// Guide. +// +// An administrator must grant you the permissions necessary to pass session tags. +// The administrator can also create granular permissions to allow you to pass only +// specific session tags. For more information, see [Tutorial: Using Tags for Attribute-Based Access Control]in the IAM User Guide. +// +// Tag key–value pairs are not case sensitive, but case is preserved. This means +// that you cannot have separate Department and department tag keys. Assume that +// the user that you are federating has the Department = Marketing tag and you +// pass the department = engineering session tag. Department and department are +// not saved as separate tags, and the session tag passed in the request takes +// precedence over the user tag. +// +// [Federation Through a Web-based Identity Provider]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity +// [session policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Amazon Cognito]: http://aws.amazon.com/cognito/ +// [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session +// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html +// [GetFederationToken—Federation Through a Custom Identity Broker]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken +// [Comparing the Amazon Web Services STS API operations]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison +// [Safeguard your root user credentials and don't use them for everyday tasks]: https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials +// [Requesting Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html +// [Tutorial: Using Tags for Attribute-Based Access Control]: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html func (c *Client) GetFederationToken(ctx context.Context, params *GetFederationTokenInput, optFns ...func(*Options)) (*GetFederationTokenOutput, error) { if params == nil { params = &GetFederationTokenInput{} @@ -102,10 +128,11 @@ type GetFederationTokenInput struct { // The name of the federated user. The name is used as an identifier for the // temporary security credentials (such as Bob ). For example, you can reference // the federated user name in a resource-based policy, such as in an Amazon S3 - // bucket policy. The regex used to validate this parameter is a string of - // characters consisting of upper- and lower-case alphanumeric characters with no - // spaces. You can also include underscores or any of the following characters: - // =,.@- + // bucket policy. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@- // // This member is required. Name *string @@ -119,99 +146,127 @@ type GetFederationTokenInput struct { DurationSeconds *int32 // An IAM policy in JSON format that you want to use as an inline session policy. - // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // to this operation. You can pass a single JSON policy document to use as an - // inline session policy. You can also specify up to 10 managed policy Amazon - // Resource Names (ARNs) to use as managed session policies. This parameter is - // optional. However, if you do not pass any session policies, then the resulting - // federated user session has no permissions. When you pass session policies, the - // session permissions are the intersection of the IAM user policies and the - // session policies that you pass. This gives you a way to further restrict the - // permissions for a federated user. You cannot use session policies to grant more - // permissions than those that are defined in the permissions policy of the IAM - // user. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. The resulting credentials can be used to access a - // resource that has a resource-based policy. If that policy specifically - // references the federated user session in the Principal element of the policy, - // the session has the permissions allowed by the policy. These permissions are - // granted in addition to the permissions that are granted by the session policies. + // + // You must pass an inline or managed [session policy] to this operation. You can pass a single + // JSON policy document to use as an inline session policy. You can also specify up + // to 10 managed policy Amazon Resource Names (ARNs) to use as managed session + // policies. + // + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. + // + // When you pass session policies, the session permissions are the intersection of + // the IAM user policies and the session policies that you pass. This gives you a + // way to further restrict the permissions for a federated user. You cannot use + // session policies to grant more permissions than those that are defined in the + // permissions policy of the IAM user. For more information, see [Session Policies]in the IAM User + // Guide. + // + // The resulting credentials can be used to access a resource that has a + // resource-based policy. If that policy specifically references the federated user + // session in the Principal element of the policy, the session has the permissions + // allowed by the policy. These permissions are granted in addition to the + // permissions that are granted by the session policies. + // // The plaintext that you use for both inline and managed session policies can't // exceed 2,048 characters. The JSON policy characters can be any ASCII character // from the space character to the end of the valid character list (\u0020 through // \u00FF). It can also include the tab (\u0009), linefeed (\u000A), and carriage - // return (\u000D) characters. An Amazon Web Services conversion compresses the - // passed inline session policy, managed policy ARNs, and session tags into a - // packed binary format that has a separate limit. Your request can fail for this - // limit even if your plaintext meets the other requirements. The PackedPolicySize - // response element indicates by percentage how close the policies and tags for - // your request are to the upper size limit. + // return (\u000D) characters. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // [session policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session Policy *string // The Amazon Resource Names (ARNs) of the IAM managed policies that you want to // use as a managed session policy. The policies must exist in the same account as - // the IAM user that is requesting federated access. You must pass an inline or - // managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // to this operation. You can pass a single JSON policy document to use as an - // inline session policy. You can also specify up to 10 managed policy Amazon - // Resource Names (ARNs) to use as managed session policies. The plaintext that you - // use for both inline and managed session policies can't exceed 2,048 characters. - // You can provide up to 10 managed policy ARNs. For more information about ARNs, - // see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. This parameter is optional. - // However, if you do not pass any session policies, then the resulting federated - // user session has no permissions. When you pass session policies, the session - // permissions are the intersection of the IAM user policies and the session - // policies that you pass. This gives you a way to further restrict the permissions - // for a federated user. You cannot use session policies to grant more permissions - // than those that are defined in the permissions policy of the IAM user. For more - // information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. The resulting credentials can be used to access a - // resource that has a resource-based policy. If that policy specifically - // references the federated user session in the Principal element of the policy, - // the session has the permissions allowed by the policy. These permissions are - // granted in addition to the permissions that are granted by the session policies. + // the IAM user that is requesting federated access. + // + // You must pass an inline or managed [session policy] to this operation. You can pass a single + // JSON policy document to use as an inline session policy. You can also specify up + // to 10 managed policy Amazon Resource Names (ARNs) to use as managed session + // policies. The plaintext that you use for both inline and managed session + // policies can't exceed 2,048 characters. You can provide up to 10 managed policy + // ARNs. For more information about ARNs, see [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]in the Amazon Web Services General + // Reference. + // + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. + // + // When you pass session policies, the session permissions are the intersection of + // the IAM user policies and the session policies that you pass. This gives you a + // way to further restrict the permissions for a federated user. You cannot use + // session policies to grant more permissions than those that are defined in the + // permissions policy of the IAM user. For more information, see [Session Policies]in the IAM User + // Guide. + // + // The resulting credentials can be used to access a resource that has a + // resource-based policy. If that policy specifically references the federated user + // session in the Principal element of the policy, the session has the permissions + // allowed by the policy. These permissions are granted in addition to the + // permissions that are granted by the session policies. + // // An Amazon Web Services conversion compresses the passed inline session policy, // managed policy ARNs, and session tags into a packed binary format that has a // separate limit. Your request can fail for this limit even if your plaintext // meets the other requirements. The PackedPolicySize response element indicates // by percentage how close the policies and tags for your request are to the upper // size limit. + // + // [session policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session + // [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html PolicyArns []types.PolicyDescriptorType // A list of session tags. Each session tag consists of a key name and an - // associated value. For more information about session tags, see Passing Session - // Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) - // in the IAM User Guide. This parameter is optional. You can pass up to 50 session - // tags. The plaintext session tag keys can’t exceed 128 characters and the values - // can’t exceed 256 characters. For these and additional limits, see IAM and STS - // Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. An Amazon Web Services conversion compresses the passed - // inline session policy, managed policy ARNs, and session tags into a packed - // binary format that has a separate limit. Your request can fail for this limit - // even if your plaintext meets the other requirements. The PackedPolicySize - // response element indicates by percentage how close the policies and tags for - // your request are to the upper size limit. You can pass a session tag with the - // same key as a tag that is already attached to the user you are federating. When - // you do, session tags override a user tag with the same key. Tag key–value pairs - // are not case sensitive, but case is preserved. This means that you cannot have - // separate Department and department tag keys. Assume that the role has the - // Department = Marketing tag and you pass the department = engineering session - // tag. Department and department are not saved as separate tags, and the session - // tag passed in the request takes precedence over the role tag. + // associated value. For more information about session tags, see [Passing Session Tags in STS]in the IAM User + // Guide. + // + // This parameter is optional. You can pass up to 50 session tags. The plaintext + // session tag keys can’t exceed 128 characters and the values can’t exceed 256 + // characters. For these and additional limits, see [IAM and STS Character Limits]in the IAM User Guide. + // + // An Amazon Web Services conversion compresses the passed inline session policy, + // managed policy ARNs, and session tags into a packed binary format that has a + // separate limit. Your request can fail for this limit even if your plaintext + // meets the other requirements. The PackedPolicySize response element indicates + // by percentage how close the policies and tags for your request are to the upper + // size limit. + // + // You can pass a session tag with the same key as a tag that is already attached + // to the user you are federating. When you do, session tags override a user tag + // with the same key. + // + // Tag key–value pairs are not case sensitive, but case is preserved. This means + // that you cannot have separate Department and department tag keys. Assume that + // the role has the Department = Marketing tag and you pass the department = + // engineering session tag. Department and department are not saved as separate + // tags, and the session tag passed in the request takes precedence over the role + // tag. + // + // [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html + // [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length Tags []types.Tag noSmithyDocumentSerde } -// Contains the response to a successful GetFederationToken request, including -// temporary Amazon Web Services credentials that can be used to make Amazon Web -// Services requests. +// Contains the response to a successful GetFederationToken request, including temporary Amazon Web +// Services credentials that can be used to make Amazon Web Services requests. type GetFederationTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. The size of the security token - // that STS API operations return is not fixed. We strongly recommend that you make - // no assumptions about the maximum size. + // access key, and a security (or session) token. + // + // The size of the security token that STS API operations return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. Credentials *types.Credentials // Identifiers for the federated user associated with the credentials (such as diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go index 751fb147..097ccd84 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go @@ -15,43 +15,58 @@ import ( // IAM user. The credentials consist of an access key ID, a secret access key, and // a security token. Typically, you use GetSessionToken if you want to use MFA to // protect programmatic calls to specific Amazon Web Services API operations like -// Amazon EC2 StopInstances . MFA-enabled IAM users must call GetSessionToken and -// submit an MFA code that is associated with their MFA device. Using the temporary -// security credentials that the call returns, IAM users can then make programmatic -// calls to API operations that require MFA authentication. An incorrect MFA code -// causes the API to return an access denied error. For a comparison of -// GetSessionToken with the other API operations that produce temporary -// credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. No permissions are required for users to perform this -// operation. The purpose of the sts:GetSessionToken operation is to authenticate -// the user using MFA. You cannot use policies to control authentication -// operations. For more information, see Permissions for GetSessionToken (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getsessiontoken.html) -// in the IAM User Guide. Session Duration The GetSessionToken operation must be -// called by using the long-term Amazon Web Services security credentials of an IAM -// user. Credentials that are created by IAM users are valid for the duration that -// you specify. This duration can range from 900 seconds (15 minutes) up to a -// maximum of 129,600 seconds (36 hours), with a default of 43,200 seconds (12 -// hours). Credentials based on account credentials can range from 900 seconds (15 -// minutes) up to 3,600 seconds (1 hour), with a default of 1 hour. Permissions The -// temporary security credentials created by GetSessionToken can be used to make -// API calls to any Amazon Web Services service with the following exceptions: +// Amazon EC2 StopInstances . +// +// MFA-enabled IAM users must call GetSessionToken and submit an MFA code that is +// associated with their MFA device. Using the temporary security credentials that +// the call returns, IAM users can then make programmatic calls to API operations +// that require MFA authentication. An incorrect MFA code causes the API to return +// an access denied error. For a comparison of GetSessionToken with the other API +// operations that produce temporary credentials, see [Requesting Temporary Security Credentials]and [Comparing the Amazon Web Services STS API operations] in the IAM User Guide. +// +// No permissions are required for users to perform this operation. The purpose of +// the sts:GetSessionToken operation is to authenticate the user using MFA. You +// cannot use policies to control authentication operations. For more information, +// see [Permissions for GetSessionToken]in the IAM User Guide. +// +// # Session Duration +// +// The GetSessionToken operation must be called by using the long-term Amazon Web +// Services security credentials of an IAM user. Credentials that are created by +// IAM users are valid for the duration that you specify. This duration can range +// from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), +// with a default of 43,200 seconds (12 hours). Credentials based on account +// credentials can range from 900 seconds (15 minutes) up to 3,600 seconds (1 +// hour), with a default of 1 hour. +// +// # Permissions +// +// The temporary security credentials created by GetSessionToken can be used to +// make API calls to any Amazon Web Services service with the following exceptions: +// // - You cannot call any IAM API operations unless MFA authentication // information is included in the request. +// // - You cannot call any STS API except AssumeRole or GetCallerIdentity . // // The credentials that GetSessionToken returns are based on permissions // associated with the IAM user whose credentials were used to call the operation. -// The temporary credentials have the same permissions as the IAM user. Although it -// is possible to call GetSessionToken using the security credentials of an Amazon -// Web Services account root user rather than an IAM user, we do not recommend it. -// If GetSessionToken is called using root user credentials, the temporary -// credentials have root user permissions. For more information, see Safeguard -// your root user credentials and don't use them for everyday tasks (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials) -// in the IAM User Guide For more information about using GetSessionToken to -// create temporary credentials, see Temporary Credentials for Users in Untrusted -// Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) -// in the IAM User Guide. +// The temporary credentials have the same permissions as the IAM user. +// +// Although it is possible to call GetSessionToken using the security credentials +// of an Amazon Web Services account root user rather than an IAM user, we do not +// recommend it. If GetSessionToken is called using root user credentials, the +// temporary credentials have root user permissions. For more information, see [Safeguard your root user credentials and don't use them for everyday tasks]in +// the IAM User Guide +// +// For more information about using GetSessionToken to create temporary +// credentials, see [Temporary Credentials for Users in Untrusted Environments]in the IAM User Guide. +// +// [Permissions for GetSessionToken]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getsessiontoken.html +// [Comparing the Amazon Web Services STS API operations]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison +// [Temporary Credentials for Users in Untrusted Environments]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken +// [Safeguard your root user credentials and don't use them for everyday tasks]: https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials +// [Requesting Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html func (c *Client) GetSessionToken(ctx context.Context, params *GetSessionTokenInput, optFns ...func(*Options)) (*GetSessionTokenOutput, error) { if params == nil { params = &GetSessionTokenInput{} @@ -83,10 +98,11 @@ type GetSessionTokenInput struct { // number for a hardware device (such as GAHT12345678 ) or an Amazon Resource Name // (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user ). You // can find the device for an IAM user by going to the Amazon Web Services - // Management Console and viewing the user's security credentials. The regex used - // to validate this parameter is a string of characters consisting of upper- and - // lower-case alphanumeric characters with no spaces. You can also include - // underscores or any of the following characters: =,.@:/- + // Management Console and viewing the user's security credentials. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can also + // include underscores or any of the following characters: =,.@:/- SerialNumber *string // The value provided by the MFA device, if MFA is required. If any policy @@ -94,22 +110,24 @@ type GetSessionTokenInput struct { // authentication is required, the user must provide a code when requesting a set // of temporary security credentials. A user who fails to provide the code receives // an "access denied" response when requesting resources that require MFA - // authentication. The format for this parameter, as described by its regex - // pattern, is a sequence of six numeric digits. + // authentication. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. TokenCode *string noSmithyDocumentSerde } -// Contains the response to a successful GetSessionToken request, including -// temporary Amazon Web Services credentials that can be used to make Amazon Web -// Services requests. +// Contains the response to a successful GetSessionToken request, including temporary Amazon Web +// Services credentials that can be used to make Amazon Web Services requests. type GetSessionTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. The size of the security token - // that STS API operations return is not fixed. We strongly recommend that you make - // no assumptions about the maximum size. + // access key, and a security (or session) token. + // + // The size of the security token that STS API operations return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. Credentials *types.Credentials // Metadata pertaining to the operation's result. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go index d963fd8d..cbb19c7f 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go @@ -3,9 +3,11 @@ // Package sts provides the API client, operations, and parameter types for AWS // Security Token Service. // -// Security Token Service Security Token Service (STS) enables you to request -// temporary, limited-privilege credentials for users. This guide provides -// descriptions of the STS API. For more information about using this service, see -// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) -// . +// # Security Token Service +// +// Security Token Service (STS) enables you to request temporary, +// limited-privilege credentials for users. This guide provides descriptions of the +// STS API. For more information about using this service, see [Temporary Security Credentials]. +// +// [Temporary Security Credentials]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html package sts diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go index 8bba9b7d..c042a716 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go @@ -3,4 +3,4 @@ package sts // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.28.5" +const goModuleVersion = "1.28.7" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/options.go index 5c1be79f..bb291161 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/options.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/options.go @@ -50,8 +50,10 @@ type Options struct { // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a // value for this field will likely prevent you from using any endpoint-related // service features released after the introduction of EndpointResolverV2 and - // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom - // endpoint, set the client option BaseEndpoint instead. + // BaseEndpoint. + // + // To migrate an EndpointResolver implementation that uses a custom endpoint, set + // the client option BaseEndpoint instead. EndpointResolver EndpointResolver // Resolves the endpoint used for a particular service operation. This should be @@ -70,17 +72,20 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. If specified in an operation call's - // functional options with a value that is different than the constructed client's - // Options, the Client's Retryer will be wrapped to use the operation's specific - // RetryMaxAttempts value. + // per operation call's retry max attempts. + // + // If specified in an operation call's functional options with a value that is + // different than the constructed client's Options, the Client's Retryer will be + // wrapped to use the operation's specific RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if - // Retryer option is not also specified. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. Currently does not support per operation call - // overrides, may in the future. + // Retryer option is not also specified. + // + // When creating a new API Clients this member will only be used if the Retryer + // Options member is nil. This value will be ignored if Retryer is not nil. + // + // Currently does not support per operation call overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable @@ -97,8 +102,9 @@ type Options struct { // The initial DefaultsMode used when the client options were constructed. If the // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved - // value was at that point in time. Currently does not support per operation call - // overrides, may in the future. + // value was at that point in time. + // + // Currently does not support per operation call overrides, may in the future. resolvedDefaultsMode aws.DefaultsMode // The HTTP client to invoke API calls with. Defaults to client's default HTTP @@ -143,6 +149,7 @@ func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { // Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for // this field will likely prevent you from using any endpoint-related service // features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// // To migrate an EndpointResolver implementation that uses a custom endpoint, set // the client option BaseEndpoint instead. func WithEndpointResolver(v EndpointResolver) func(*Options) { diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go index 097875b2..9573a4b6 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go @@ -65,9 +65,10 @@ func (e *IDPCommunicationErrorException) ErrorCode() string { func (e *IDPCommunicationErrorException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The identity provider (IdP) reported that authentication failed. This might be -// because the claim is invalid. If this error is returned for the -// AssumeRoleWithWebIdentity operation, it can also mean that the claim has expired -// or has been explicitly revoked. +// because the claim is invalid. +// +// If this error is returned for the AssumeRoleWithWebIdentity operation, it can +// also mean that the claim has expired or has been explicitly revoked. type IDPRejectedClaimException struct { Message *string @@ -183,11 +184,13 @@ func (e *MalformedPolicyDocumentException) ErrorFault() smithy.ErrorFault { retu // compresses the session policy document, session policy ARNs, and session tags // into a packed binary format that has a separate limit. The error message // indicates by percentage how close the policies and tags are to the upper size -// limit. For more information, see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. You could receive this error even though you meet other -// defined session policy and session tag limits. For more information, see IAM -// and STS Entity Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-limits-entity-length) -// in the IAM User Guide. +// limit. For more information, see [Passing Session Tags in STS]in the IAM User Guide. +// +// You could receive this error even though you meet other defined session policy +// and session tag limits. For more information, see [IAM and STS Entity Character Limits]in the IAM User Guide. +// +// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html +// [IAM and STS Entity Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-limits-entity-length type PackedPolicyTooLargeException struct { Message *string @@ -215,9 +218,10 @@ func (e *PackedPolicyTooLargeException) ErrorFault() smithy.ErrorFault { return // STS is not activated in the requested region for the account that is being // asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating Amazon Web Services STS in an Amazon Web Services Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. +// console to activate STS in that region. For more information, see [Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region]in the IAM +// User Guide. +// +// [Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html type RegionDisabledException struct { Message *string diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/types.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/types.go index e3701d11..dff7a3c2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/types.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/types.go @@ -11,10 +11,11 @@ import ( // returns. type AssumedRoleUser struct { - // The ARN of the temporary security credentials that are returned from the - // AssumeRole action. For more information about ARNs and how to use them in - // policies, see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in the IAM User Guide. + // The ARN of the temporary security credentials that are returned from the AssumeRole + // action. For more information about ARNs and how to use them in policies, see [IAM Identifiers]in + // the IAM User Guide. + // + // [IAM Identifiers]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html // // This member is required. Arn *string @@ -61,8 +62,9 @@ type FederatedUser struct { // The ARN that specifies the federated user that is associated with the // credentials. For more information about ARNs and how to use them in policies, - // see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in the IAM User Guide. + // see [IAM Identifiers]in the IAM User Guide. + // + // [IAM Identifiers]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html // // This member is required. Arn *string @@ -81,9 +83,10 @@ type FederatedUser struct { type PolicyDescriptorType struct { // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session - // policy for the role. For more information about ARNs, see Amazon Resource Names - // (ARNs) and Amazon Web Services Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. + // policy for the role. For more information about ARNs, see [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]in the Amazon Web + // Services General Reference. + // + // [Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Arn *string noSmithyDocumentSerde @@ -107,23 +110,30 @@ type ProvidedContext struct { // You can pass custom key-value pair attributes when you assume a role or // federate a user. These are called session tags. You can then use the session -// tags to control access to resources. For more information, see Tagging Amazon -// Web Services STS Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. +// tags to control access to resources. For more information, see [Tagging Amazon Web Services STS Sessions]in the IAM User +// Guide. +// +// [Tagging Amazon Web Services STS Sessions]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html type Tag struct { - // The key for a session tag. You can pass up to 50 session tags. The plain text - // session tag keys can’t exceed 128 characters. For these and additional limits, - // see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. + // The key for a session tag. + // + // You can pass up to 50 session tags. The plain text session tag keys can’t + // exceed 128 characters. For these and additional limits, see [IAM and STS Character Limits]in the IAM User + // Guide. + // + // [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length // // This member is required. Key *string - // The value for a session tag. You can pass up to 50 session tags. The plain text - // session tag values can’t exceed 256 characters. For these and additional limits, - // see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. + // The value for a session tag. + // + // You can pass up to 50 session tags. The plain text session tag values can’t + // exceed 256 characters. For these and additional limits, see [IAM and STS Character Limits]in the IAM User + // Guide. + // + // [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length // // This member is required. Value *string diff --git a/vendor/github.com/aws/smithy-go/CHANGELOG.md b/vendor/github.com/aws/smithy-go/CHANGELOG.md index b8d6561a..39ffae99 100644 --- a/vendor/github.com/aws/smithy-go/CHANGELOG.md +++ b/vendor/github.com/aws/smithy-go/CHANGELOG.md @@ -1,3 +1,7 @@ +# Release (2024-03-29) + +* No change notes available for this release. + # Release (2024-02-21) ## Module Highlights diff --git a/vendor/github.com/aws/smithy-go/go_module_metadata.go b/vendor/github.com/aws/smithy-go/go_module_metadata.go index 341392e1..a6b22f35 100644 --- a/vendor/github.com/aws/smithy-go/go_module_metadata.go +++ b/vendor/github.com/aws/smithy-go/go_module_metadata.go @@ -3,4 +3,4 @@ package smithy // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.20.1" +const goModuleVersion = "1.20.2" diff --git a/vendor/github.com/distribution/reference/.gitattributes b/vendor/github.com/distribution/reference/.gitattributes new file mode 100644 index 00000000..d207b180 --- /dev/null +++ b/vendor/github.com/distribution/reference/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/distribution/reference/.gitignore b/vendor/github.com/distribution/reference/.gitignore new file mode 100644 index 00000000..dc07e6b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/.gitignore @@ -0,0 +1,2 @@ +# Cover profiles +*.out diff --git a/vendor/github.com/distribution/reference/.golangci.yml b/vendor/github.com/distribution/reference/.golangci.yml new file mode 100644 index 00000000..793f0bb7 --- /dev/null +++ b/vendor/github.com/distribution/reference/.golangci.yml @@ -0,0 +1,18 @@ +linters: + enable: + - bodyclose + - dupword # Checks for duplicate words in the source code + - gofmt + - goimports + - ineffassign + - misspell + - revive + - staticcheck + - unconvert + - unused + - vet + disable: + - errcheck + +run: + deadline: 2m diff --git a/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md b/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md new file mode 100644 index 00000000..48f6704c --- /dev/null +++ b/vendor/github.com/distribution/reference/CODE-OF-CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). + +Please contact the [CNCF Code of Conduct Committee](mailto:conduct@cncf.io) in order to report violations of the Code of Conduct. diff --git a/vendor/github.com/distribution/reference/CONTRIBUTING.md b/vendor/github.com/distribution/reference/CONTRIBUTING.md new file mode 100644 index 00000000..ab219466 --- /dev/null +++ b/vendor/github.com/distribution/reference/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing to the reference library + +## Community help + +If you need help, please ask in the [#distribution](https://cloud-native.slack.com/archives/C01GVR8SY4R) channel on CNCF community slack. +[Click here for an invite to the CNCF community slack](https://slack.cncf.io/) + +## Reporting security issues + +The maintainers take security seriously. If you discover a security +issue, please bring it to their attention right away! + +Please **DO NOT** file a public issue, instead send your report privately to +[cncf-distribution-security@lists.cncf.io](mailto:cncf-distribution-security@lists.cncf.io). + +## Reporting an issue properly + +By following these simple rules you will get better and faster feedback on your issue. + + - search the bugtracker for an already reported issue + +### If you found an issue that describes your problem: + + - please read other user comments first, and confirm this is the same issue: a given error condition might be indicative of different problems - you may also find a workaround in the comments + - please refrain from adding "same thing here" or "+1" comments + - you don't need to comment on an issue to get notified of updates: just hit the "subscribe" button + - comment if you have some new, technical and relevant information to add to the case + - __DO NOT__ comment on closed issues or merged PRs. If you think you have a related problem, open up a new issue and reference the PR or issue. + +### If you have not found an existing issue that describes your problem: + + 1. create a new issue, with a succinct title that describes your issue: + - bad title: "It doesn't work with my docker" + - good title: "Private registry push fail: 400 error with E_INVALID_DIGEST" + 2. copy the output of (or similar for other container tools): + - `docker version` + - `docker info` + - `docker exec registry --version` + 3. copy the command line you used to launch your Registry + 4. restart your docker daemon in debug mode (add `-D` to the daemon launch arguments) + 5. reproduce your problem and get your docker daemon logs showing the error + 6. if relevant, copy your registry logs that show the error + 7. provide any relevant detail about your specific Registry configuration (e.g., storage backend used) + 8. indicate if you are using an enterprise proxy, Nginx, or anything else between you and your Registry + +## Contributing Code + +Contributions should be made via pull requests. Pull requests will be reviewed +by one or more maintainers or reviewers and merged when acceptable. + +You should follow the basic GitHub workflow: + + 1. Use your own [fork](https://help.github.com/en/articles/about-forks) + 2. Create your [change](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#successful-changes) + 3. Test your code + 4. [Commit](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#commit-messages) your work, always [sign your commits](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#commit-messages) + 5. Push your change to your fork and create a [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) + +Refer to [containerd's contribution guide](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#successful-changes) +for tips on creating a successful contribution. + +## Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/vendor/github.com/distribution/reference/GOVERNANCE.md b/vendor/github.com/distribution/reference/GOVERNANCE.md new file mode 100644 index 00000000..200045b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/GOVERNANCE.md @@ -0,0 +1,144 @@ +# distribution/reference Project Governance + +Distribution [Code of Conduct](./CODE-OF-CONDUCT.md) can be found here. + +For specific guidance on practical contribution steps please +see our [CONTRIBUTING.md](./CONTRIBUTING.md) guide. + +## Maintainership + +There are different types of maintainers, with different responsibilities, but +all maintainers have 3 things in common: + +1) They share responsibility in the project's success. +2) They have made a long-term, recurring time investment to improve the project. +3) They spend that time doing whatever needs to be done, not necessarily what +is the most interesting or fun. + +Maintainers are often under-appreciated, because their work is harder to appreciate. +It's easy to appreciate a really cool and technically advanced feature. It's harder +to appreciate the absence of bugs, the slow but steady improvement in stability, +or the reliability of a release process. But those things distinguish a good +project from a great one. + +## Reviewers + +A reviewer is a core role within the project. +They share in reviewing issues and pull requests and their LGTM counts towards the +required LGTM count to merge a code change into the project. + +Reviewers are part of the organization but do not have write access. +Becoming a reviewer is a core aspect in the journey to becoming a maintainer. + +## Adding maintainers + +Maintainers are first and foremost contributors that have shown they are +committed to the long term success of a project. Contributors wanting to become +maintainers are expected to be deeply involved in contributing code, pull +request review, and triage of issues in the project for more than three months. + +Just contributing does not make you a maintainer, it is about building trust +with the current maintainers of the project and being a person that they can +depend on and trust to make decisions in the best interest of the project. + +Periodically, the existing maintainers curate a list of contributors that have +shown regular activity on the project over the prior months. From this list, +maintainer candidates are selected and proposed in a pull request or a +maintainers communication channel. + +After a candidate has been announced to the maintainers, the existing +maintainers are given five business days to discuss the candidate, raise +objections and cast their vote. Votes may take place on the communication +channel or via pull request comment. Candidates must be approved by at least 66% +of the current maintainers by adding their vote on the mailing list. The +reviewer role has the same process but only requires 33% of current maintainers. +Only maintainers of the repository that the candidate is proposed for are +allowed to vote. + +If a candidate is approved, a maintainer will contact the candidate to invite +the candidate to open a pull request that adds the contributor to the +MAINTAINERS file. The voting process may take place inside a pull request if a +maintainer has already discussed the candidacy with the candidate and a +maintainer is willing to be a sponsor by opening the pull request. The candidate +becomes a maintainer once the pull request is merged. + +## Stepping down policy + +Life priorities, interests, and passions can change. If you're a maintainer but +feel you must remove yourself from the list, inform other maintainers that you +intend to step down, and if possible, help find someone to pick up your work. +At the very least, ensure your work can be continued where you left off. + +After you've informed other maintainers, create a pull request to remove +yourself from the MAINTAINERS file. + +## Removal of inactive maintainers + +Similar to the procedure for adding new maintainers, existing maintainers can +be removed from the list if they do not show significant activity on the +project. Periodically, the maintainers review the list of maintainers and their +activity over the last three months. + +If a maintainer has shown insufficient activity over this period, a neutral +person will contact the maintainer to ask if they want to continue being +a maintainer. If the maintainer decides to step down as a maintainer, they +open a pull request to be removed from the MAINTAINERS file. + +If the maintainer wants to remain a maintainer, but is unable to perform the +required duties they can be removed with a vote of at least 66% of the current +maintainers. In this case, maintainers should first propose the change to +maintainers via the maintainers communication channel, then open a pull request +for voting. The voting period is five business days. The voting pull request +should not come as a surpise to any maintainer and any discussion related to +performance must not be discussed on the pull request. + +## How are decisions made? + +Docker distribution is an open-source project with an open design philosophy. +This means that the repository is the source of truth for EVERY aspect of the +project, including its philosophy, design, road map, and APIs. *If it's part of +the project, it's in the repo. If it's in the repo, it's part of the project.* + +As a result, all decisions can be expressed as changes to the repository. An +implementation change is a change to the source code. An API change is a change +to the API specification. A philosophy change is a change to the philosophy +manifesto, and so on. + +All decisions affecting distribution, big and small, follow the same 3 steps: + +* Step 1: Open a pull request. Anyone can do this. + +* Step 2: Discuss the pull request. Anyone can do this. + +* Step 3: Merge or refuse the pull request. Who does this depends on the nature +of the pull request and which areas of the project it affects. + +## Helping contributors with the DCO + +The [DCO or `Sign your work`](./CONTRIBUTING.md#sign-your-work) +requirement is not intended as a roadblock or speed bump. + +Some contributors are not as familiar with `git`, or have used a web +based editor, and thus asking them to `git commit --amend -s` is not the best +way forward. + +In this case, maintainers can update the commits based on clause (c) of the DCO. +The most trivial way for a contributor to allow the maintainer to do this, is to +add a DCO signature in a pull requests's comment, or a maintainer can simply +note that the change is sufficiently trivial that it does not substantially +change the existing contribution - i.e., a spelling change. + +When you add someone's DCO, please also add your own to keep a log. + +## I'm a maintainer. Should I make pull requests too? + +Yes. Nobody should ever push to master directly. All changes should be +made through a pull request. + +## Conflict Resolution + +If you have a technical dispute that you feel has reached an impasse with a +subset of the community, any contributor may open an issue, specifically +calling for a resolution vote of the current core maintainers to resolve the +dispute. The same voting quorums required (2/3) for adding and removing +maintainers will apply to conflict resolution. diff --git a/vendor/github.com/docker/distribution/LICENSE b/vendor/github.com/distribution/reference/LICENSE similarity index 100% rename from vendor/github.com/docker/distribution/LICENSE rename to vendor/github.com/distribution/reference/LICENSE diff --git a/vendor/github.com/distribution/reference/MAINTAINERS b/vendor/github.com/distribution/reference/MAINTAINERS new file mode 100644 index 00000000..9e0a60c8 --- /dev/null +++ b/vendor/github.com/distribution/reference/MAINTAINERS @@ -0,0 +1,26 @@ +# Distribution project maintainers & reviewers +# +# See GOVERNANCE.md for maintainer versus reviewer roles +# +# MAINTAINERS (cncf-distribution-maintainers@lists.cncf.io) +# GitHub ID, Name, Email address +"chrispat","Chris Patterson","chrispat@github.com" +"clarkbw","Bryan Clark","clarkbw@github.com" +"corhere","Cory Snider","csnider@mirantis.com" +"deleteriousEffect","Hayley Swimelar","hswimelar@gitlab.com" +"heww","He Weiwei","hweiwei@vmware.com" +"joaodrp","João Pereira","jpereira@gitlab.com" +"justincormack","Justin Cormack","justin.cormack@docker.com" +"squizzi","Kyle Squizzato","ksquizzato@mirantis.com" +"milosgajdos","Milos Gajdos","milosthegajdos@gmail.com" +"sargun","Sargun Dhillon","sargun@sargun.me" +"wy65701436","Wang Yan","wangyan@vmware.com" +"stevelasker","Steve Lasker","steve.lasker@microsoft.com" +# +# REVIEWERS +# GitHub ID, Name, Email address +"dmcgowan","Derek McGowan","derek@mcgstyle.net" +"stevvooe","Stephen Day","stevvooe@gmail.com" +"thajeztah","Sebastiaan van Stijn","github@gone.nl" +"DavidSpek", "David van der Spek", "vanderspek.david@gmail.com" +"Jamstah", "James Hewitt", "james.hewitt@gmail.com" diff --git a/vendor/github.com/distribution/reference/Makefile b/vendor/github.com/distribution/reference/Makefile new file mode 100644 index 00000000..c78576b7 --- /dev/null +++ b/vendor/github.com/distribution/reference/Makefile @@ -0,0 +1,25 @@ +# Project packages. +PACKAGES=$(shell go list ./...) + +# Flags passed to `go test` +BUILDFLAGS ?= +TESTFLAGS ?= + +.PHONY: all build test coverage +.DEFAULT: all + +all: build + +build: ## no binaries to build, so just check compilation suceeds + go build ${BUILDFLAGS} ./... + +test: ## run tests + go test ${TESTFLAGS} ./... + +coverage: ## generate coverprofiles from the unit tests + rm -f coverage.txt + go test ${TESTFLAGS} -cover -coverprofile=cover.out ./... + +.PHONY: help +help: + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\/%-]+:.*?##/ { printf " \033[36m%-27s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/vendor/github.com/distribution/reference/README.md b/vendor/github.com/distribution/reference/README.md new file mode 100644 index 00000000..e2531e49 --- /dev/null +++ b/vendor/github.com/distribution/reference/README.md @@ -0,0 +1,30 @@ +# Distribution reference + +Go library to handle references to container images. + + + +[![Build Status](https://github.com/distribution/reference/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/distribution/reference/actions?query=workflow%3ACI) +[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/distribution/reference) +[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE) +[![codecov](https://codecov.io/gh/distribution/reference/branch/main/graph/badge.svg)](https://codecov.io/gh/distribution/reference) +[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference.svg?type=shield)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fdistribution%2Freference?ref=badge_shield) + +This repository contains a library for handling refrences to container images held in container registries. Please see [godoc](https://pkg.go.dev/github.com/distribution/reference) for details. + +## Contribution + +Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute +issues, fixes, and patches to this project. + +## Communication + +For async communication and long running discussions please use issues and pull requests on the github repo. +This will be the best place to discuss design and implementation. + +For sync communication we have a #distribution channel in the [CNCF Slack](https://slack.cncf.io/) +that everyone is welcome to join and chat about development. + +## Licenses + +The distribution codebase is released under the [Apache 2.0 license](LICENSE). diff --git a/vendor/github.com/distribution/reference/SECURITY.md b/vendor/github.com/distribution/reference/SECURITY.md new file mode 100644 index 00000000..aaf983c0 --- /dev/null +++ b/vendor/github.com/distribution/reference/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +## Reporting a Vulnerability + +The maintainers take security seriously. If you discover a security issue, please bring it to their attention right away! + +Please DO NOT file a public issue, instead send your report privately to cncf-distribution-security@lists.cncf.io. diff --git a/vendor/github.com/distribution/reference/distribution-logo.svg b/vendor/github.com/distribution/reference/distribution-logo.svg new file mode 100644 index 00000000..cc9f4073 --- /dev/null +++ b/vendor/github.com/distribution/reference/distribution-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/github.com/docker/distribution/reference/helpers.go b/vendor/github.com/distribution/reference/helpers.go similarity index 94% rename from vendor/github.com/docker/distribution/reference/helpers.go rename to vendor/github.com/distribution/reference/helpers.go index 978df7ea..d10c7ef8 100644 --- a/vendor/github.com/docker/distribution/reference/helpers.go +++ b/vendor/github.com/distribution/reference/helpers.go @@ -32,7 +32,7 @@ func FamiliarString(ref Reference) string { } // FamiliarMatch reports whether ref matches the specified pattern. -// See https://godoc.org/path#Match for supported patterns. +// See [path.Match] for supported patterns. func FamiliarMatch(pattern string, ref Reference) (bool, error) { matched, err := path.Match(pattern, FamiliarString(ref)) if namedRef, isNamed := ref.(Named); isNamed && !matched { diff --git a/vendor/github.com/docker/distribution/reference/normalize.go b/vendor/github.com/distribution/reference/normalize.go similarity index 52% rename from vendor/github.com/docker/distribution/reference/normalize.go rename to vendor/github.com/distribution/reference/normalize.go index b3dfb7a6..a30229d0 100644 --- a/vendor/github.com/docker/distribution/reference/normalize.go +++ b/vendor/github.com/distribution/reference/normalize.go @@ -1,19 +1,42 @@ package reference import ( - "errors" "fmt" "strings" - "github.com/docker/distribution/digestset" "github.com/opencontainers/go-digest" ) -var ( +const ( + // legacyDefaultDomain is the legacy domain for Docker Hub (which was + // originally named "the Docker Index"). This domain is still used for + // authentication and image search, which were part of the "v1" Docker + // registry specification. + // + // This domain will continue to be supported, but there are plans to consolidate + // legacy domains to new "canonical" domains. Once those domains are decided + // on, we must update the normalization functions, but preserve compatibility + // with existing installs, clients, and user configuration. legacyDefaultDomain = "index.docker.io" - defaultDomain = "docker.io" - officialRepoName = "library" - defaultTag = "latest" + + // defaultDomain is the default domain used for images on Docker Hub. + // It is used to normalize "familiar" names to canonical names, for example, + // to convert "ubuntu" to "docker.io/library/ubuntu:latest". + // + // Note that actual domain of Docker Hub's registry is registry-1.docker.io. + // This domain will continue to be supported, but there are plans to consolidate + // legacy domains to new "canonical" domains. Once those domains are decided + // on, we must update the normalization functions, but preserve compatibility + // with existing installs, clients, and user configuration. + defaultDomain = "docker.io" + + // officialRepoPrefix is the namespace used for official images on Docker Hub. + // It is used to normalize "familiar" names to canonical names, for example, + // to convert "ubuntu" to "docker.io/library/ubuntu:latest". + officialRepoPrefix = "library/" + + // defaultTag is the default tag if no tag is provided. + defaultTag = "latest" ) // normalizedNamed represents a name which has been @@ -35,14 +58,14 @@ func ParseNormalizedNamed(s string) (Named, error) { return nil, fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings", s) } domain, remainder := splitDockerDomain(s) - var remoteName string + var remote string if tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 { - remoteName = remainder[:tagSep] + remote = remainder[:tagSep] } else { - remoteName = remainder + remote = remainder } - if strings.ToLower(remoteName) != remoteName { - return nil, errors.New("invalid reference format: repository name must be lowercase") + if strings.ToLower(remote) != remote { + return nil, fmt.Errorf("invalid reference format: repository name (%s) must be lowercase", remote) } ref, err := Parse(domain + "/" + remainder) @@ -56,41 +79,53 @@ func ParseNormalizedNamed(s string) (Named, error) { return named, nil } -// ParseDockerRef normalizes the image reference following the docker convention. This is added -// mainly for backward compatibility. -// The reference returned can only be either tagged or digested. For reference contains both tag -// and digest, the function returns digested reference, e.g. docker.io/library/busybox:latest@ -// sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa will be returned as -// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa. +// namedTaggedDigested is a reference that has both a tag and a digest. +type namedTaggedDigested interface { + NamedTagged + Digested +} + +// ParseDockerRef normalizes the image reference following the docker convention, +// which allows for references to contain both a tag and a digest. It returns a +// reference that is either tagged or digested. For references containing both +// a tag and a digest, it returns a digested reference. For example, the following +// reference: +// +// docker.io/library/busybox:latest@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// Is returned as a digested reference (with the ":latest" tag removed): +// +// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// References that are already "tagged" or "digested" are returned unmodified: +// +// // Already a digested reference +// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa +// +// // Already a named reference +// docker.io/library/busybox:latest func ParseDockerRef(ref string) (Named, error) { named, err := ParseNormalizedNamed(ref) if err != nil { return nil, err } - if _, ok := named.(NamedTagged); ok { - if canonical, ok := named.(Canonical); ok { - // The reference is both tagged and digested, only - // return digested. - newNamed, err := WithName(canonical.Name()) - if err != nil { - return nil, err - } - newCanonical, err := WithDigest(newNamed, canonical.Digest()) - if err != nil { - return nil, err - } - return newCanonical, nil + if canonical, ok := named.(namedTaggedDigested); ok { + // The reference is both tagged and digested; only return digested. + newNamed, err := WithName(canonical.Name()) + if err != nil { + return nil, err } + return WithDigest(newNamed, canonical.Digest()) } return TagNameOnly(named), nil } -// splitDockerDomain splits a repository name to domain and remotename string. +// splitDockerDomain splits a repository name to domain and remote-name. // If no valid domain is found, the default domain is used. Repository name // needs to be already validated before. func splitDockerDomain(name string) (domain, remainder string) { i := strings.IndexRune(name, '/') - if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost") { + if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != localhost && strings.ToLower(name[:i]) == name[:i]) { domain, remainder = defaultDomain, name } else { domain, remainder = name[:i], name[i+1:] @@ -99,13 +134,13 @@ func splitDockerDomain(name string) (domain, remainder string) { domain = defaultDomain } if domain == defaultDomain && !strings.ContainsRune(remainder, '/') { - remainder = officialRepoName + "/" + remainder + remainder = officialRepoPrefix + remainder } return } // familiarizeName returns a shortened version of the name familiar -// to to the Docker UI. Familiar names have the default domain +// to the Docker UI. Familiar names have the default domain // "docker.io" and "library/" repository prefix removed. // For example, "docker.io/library/redis" will have the familiar // name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp". @@ -119,8 +154,15 @@ func familiarizeName(named namedRepository) repository { if repo.domain == defaultDomain { repo.domain = "" // Handle official repositories which have the pattern "library/" - if split := strings.Split(repo.path, "/"); len(split) == 2 && split[0] == officialRepoName { - repo.path = split[1] + if strings.HasPrefix(repo.path, officialRepoPrefix) { + // TODO(thaJeztah): this check may be too strict, as it assumes the + // "library/" namespace does not have nested namespaces. While this + // is true (currently), technically it would be possible for Docker + // Hub to use those (e.g. "library/distros/ubuntu:latest"). + // See https://github.com/distribution/distribution/pull/3769#issuecomment-1302031785. + if remainder := strings.TrimPrefix(repo.path, officialRepoPrefix); !strings.ContainsRune(remainder, '/') { + repo.path = remainder + } } } return repo @@ -180,20 +222,3 @@ func ParseAnyReference(ref string) (Reference, error) { return ParseNormalizedNamed(ref) } - -// ParseAnyReferenceWithSet parses a reference string as a possible short -// identifier to be matched in a digest set, a full digest, or familiar name. -func ParseAnyReferenceWithSet(ref string, ds *digestset.Set) (Reference, error) { - if ok := anchoredShortIdentifierRegexp.MatchString(ref); ok { - dgst, err := ds.Lookup(ref) - if err == nil { - return digestReference(dgst), nil - } - } else { - if dgst, err := digest.Parse(ref); err == nil { - return digestReference(dgst), nil - } - } - - return ParseNormalizedNamed(ref) -} diff --git a/vendor/github.com/docker/distribution/reference/reference.go b/vendor/github.com/distribution/reference/reference.go similarity index 93% rename from vendor/github.com/docker/distribution/reference/reference.go rename to vendor/github.com/distribution/reference/reference.go index b7cd00b0..e98c44da 100644 --- a/vendor/github.com/docker/distribution/reference/reference.go +++ b/vendor/github.com/distribution/reference/reference.go @@ -4,11 +4,14 @@ // Grammar // // reference := name [ ":" tag ] [ "@" digest ] -// name := [domain '/'] path-component ['/' path-component]* -// domain := domain-component ['.' domain-component]* [':' port-number] +// name := [domain '/'] remote-name +// domain := host [':' port-number] +// host := domain-name | IPv4address | \[ IPv6address \] ; rfc3986 appendix-A +// domain-name := domain-component ['.' domain-component]* // domain-component := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/ // port-number := /[0-9]+/ // path-component := alpha-numeric [separator alpha-numeric]* +// path (or "remote-name") := path-component ['/' path-component]* // alpha-numeric := /[a-z0-9]+/ // separator := /[_.]|__|[-]*/ // @@ -21,7 +24,6 @@ // digest-hex := /[0-9a-fA-F]{32,}/ ; At least 128 bit digest value // // identifier := /[a-f0-9]{64}/ -// short-identifier := /[a-f0-9]{6,64}/ package reference import ( @@ -145,7 +147,7 @@ type namedRepository interface { Path() string } -// Domain returns the domain part of the Named reference +// Domain returns the domain part of the [Named] reference. func Domain(named Named) string { if r, ok := named.(namedRepository); ok { return r.Domain() @@ -154,7 +156,7 @@ func Domain(named Named) string { return domain } -// Path returns the name without the domain part of the Named reference +// Path returns the name without the domain part of the [Named] reference. func Path(named Named) (name string) { if r, ok := named.(namedRepository); ok { return r.Path() @@ -175,7 +177,8 @@ func splitDomain(name string) (string, string) { // hostname and name string. If no valid hostname is // found, the hostname is empty and the full value // is returned as name -// DEPRECATED: Use Domain or Path +// +// Deprecated: Use [Domain] or [Path]. func SplitHostname(named Named) (string, string) { if r, ok := named.(namedRepository); ok { return r.Domain(), r.Path() @@ -185,7 +188,6 @@ func SplitHostname(named Named) (string, string) { // Parse parses s and returns a syntactically valid Reference. // If an error was encountered it is returned, along with a nil Reference. -// NOTE: Parse will not handle short digests. func Parse(s string) (Reference, error) { matches := ReferenceRegexp.FindStringSubmatch(s) if matches == nil { @@ -237,7 +239,6 @@ func Parse(s string) (Reference, error) { // the Named interface. The reference must have a name and be in the canonical // form, otherwise an error is returned. // If an error was encountered it is returned, along with a nil Reference. -// NOTE: ParseNamed will not handle short digests. func ParseNamed(s string) (Named, error) { named, err := ParseNormalizedNamed(s) if err != nil { @@ -320,11 +321,13 @@ func WithDigest(name Named, digest digest.Digest) (Canonical, error) { // TrimNamed removes any tag or digest from the named reference. func TrimNamed(ref Named) Named { - domain, path := SplitHostname(ref) - return repository{ - domain: domain, - path: path, + repo := repository{} + if r, ok := ref.(namedRepository); ok { + repo.domain, repo.path = r.Domain(), r.Path() + } else { + repo.domain, repo.path = splitDomain(ref.Name()) } + return repo } func getBestReferenceType(ref reference) Reference { diff --git a/vendor/github.com/distribution/reference/regexp.go b/vendor/github.com/distribution/reference/regexp.go new file mode 100644 index 00000000..65bc49d7 --- /dev/null +++ b/vendor/github.com/distribution/reference/regexp.go @@ -0,0 +1,163 @@ +package reference + +import ( + "regexp" + "strings" +) + +// DigestRegexp matches well-formed digests, including algorithm (e.g. "sha256:"). +var DigestRegexp = regexp.MustCompile(digestPat) + +// DomainRegexp matches hostname or IP-addresses, optionally including a port +// number. It defines the structure of potential domain components that may be +// part of image names. This is purposely a subset of what is allowed by DNS to +// ensure backwards compatibility with Docker image names. It may be a subset of +// DNS domain name, an IPv4 address in decimal format, or an IPv6 address between +// square brackets (excluding zone identifiers as defined by [RFC 6874] or special +// addresses such as IPv4-Mapped). +// +// [RFC 6874]: https://www.rfc-editor.org/rfc/rfc6874. +var DomainRegexp = regexp.MustCompile(domainAndPort) + +// IdentifierRegexp is the format for string identifier used as a +// content addressable identifier using sha256. These identifiers +// are like digests without the algorithm, since sha256 is used. +var IdentifierRegexp = regexp.MustCompile(identifier) + +// NameRegexp is the format for the name component of references, including +// an optional domain and port, but without tag or digest suffix. +var NameRegexp = regexp.MustCompile(namePat) + +// ReferenceRegexp is the full supported format of a reference. The regexp +// is anchored and has capturing groups for name, tag, and digest +// components. +var ReferenceRegexp = regexp.MustCompile(referencePat) + +// TagRegexp matches valid tag names. From [docker/docker:graph/tags.go]. +// +// [docker/docker:graph/tags.go]: https://github.com/moby/moby/blob/v1.6.0/graph/tags.go#L26-L28 +var TagRegexp = regexp.MustCompile(tag) + +const ( + // alphanumeric defines the alphanumeric atom, typically a + // component of names. This only allows lower case characters and digits. + alphanumeric = `[a-z0-9]+` + + // separator defines the separators allowed to be embedded in name + // components. This allows one period, one or two underscore and multiple + // dashes. Repeated dashes and underscores are intentionally treated + // differently. In order to support valid hostnames as name components, + // supporting repeated dash was added. Additionally double underscore is + // now allowed as a separator to loosen the restriction for previously + // supported names. + separator = `(?:[._]|__|[-]+)` + + // localhost is treated as a special value for domain-name. Any other + // domain-name without a "." or a ":port" are considered a path component. + localhost = `localhost` + + // domainNameComponent restricts the registry domain component of a + // repository name to start with a component as defined by DomainRegexp. + domainNameComponent = `(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])` + + // optionalPort matches an optional port-number including the port separator + // (e.g. ":80"). + optionalPort = `(?::[0-9]+)?` + + // tag matches valid tag names. From docker/docker:graph/tags.go. + tag = `[\w][\w.-]{0,127}` + + // digestPat matches well-formed digests, including algorithm (e.g. "sha256:"). + // + // TODO(thaJeztah): this should follow the same rules as https://pkg.go.dev/github.com/opencontainers/go-digest@v1.0.0#DigestRegexp + // so that go-digest defines the canonical format. Note that the go-digest is + // more relaxed: + // - it allows multiple algorithms (e.g. "sha256+b64:") to allow + // future expansion of supported algorithms. + // - it allows the "" value to use urlsafe base64 encoding as defined + // in [rfc4648, section 5]. + // + // [rfc4648, section 5]: https://www.rfc-editor.org/rfc/rfc4648#section-5. + digestPat = `[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}` + + // identifier is the format for a content addressable identifier using sha256. + // These identifiers are like digests without the algorithm, since sha256 is used. + identifier = `([a-f0-9]{64})` + + // ipv6address are enclosed between square brackets and may be represented + // in many ways, see rfc5952. Only IPv6 in compressed or uncompressed format + // are allowed, IPv6 zone identifiers (rfc6874) or Special addresses such as + // IPv4-Mapped are deliberately excluded. + ipv6address = `\[(?:[a-fA-F0-9:]+)\]` +) + +var ( + // domainName defines the structure of potential domain components + // that may be part of image names. This is purposely a subset of what is + // allowed by DNS to ensure backwards compatibility with Docker image + // names. This includes IPv4 addresses on decimal format. + domainName = domainNameComponent + anyTimes(`\.`+domainNameComponent) + + // host defines the structure of potential domains based on the URI + // Host subcomponent on rfc3986. It may be a subset of DNS domain name, + // or an IPv4 address in decimal format, or an IPv6 address between square + // brackets (excluding zone identifiers as defined by rfc6874 or special + // addresses such as IPv4-Mapped). + host = `(?:` + domainName + `|` + ipv6address + `)` + + // allowed by the URI Host subcomponent on rfc3986 to ensure backwards + // compatibility with Docker image names. + domainAndPort = host + optionalPort + + // anchoredTagRegexp matches valid tag names, anchored at the start and + // end of the matched string. + anchoredTagRegexp = regexp.MustCompile(anchored(tag)) + + // anchoredDigestRegexp matches valid digests, anchored at the start and + // end of the matched string. + anchoredDigestRegexp = regexp.MustCompile(anchored(digestPat)) + + // pathComponent restricts path-components to start with an alphanumeric + // character, with following parts able to be separated by a separator + // (one period, one or two underscore and multiple dashes). + pathComponent = alphanumeric + anyTimes(separator+alphanumeric) + + // remoteName matches the remote-name of a repository. It consists of one + // or more forward slash (/) delimited path-components: + // + // pathComponent[[/pathComponent] ...] // e.g., "library/ubuntu" + remoteName = pathComponent + anyTimes(`/`+pathComponent) + namePat = optional(domainAndPort+`/`) + remoteName + + // anchoredNameRegexp is used to parse a name value, capturing the + // domain and trailing components. + anchoredNameRegexp = regexp.MustCompile(anchored(optional(capture(domainAndPort), `/`), capture(remoteName))) + + referencePat = anchored(capture(namePat), optional(`:`, capture(tag)), optional(`@`, capture(digestPat))) + + // anchoredIdentifierRegexp is used to check or match an + // identifier value, anchored at start and end of string. + anchoredIdentifierRegexp = regexp.MustCompile(anchored(identifier)) +) + +// optional wraps the expression in a non-capturing group and makes the +// production optional. +func optional(res ...string) string { + return `(?:` + strings.Join(res, "") + `)?` +} + +// anyTimes wraps the expression in a non-capturing group that can occur +// any number of times. +func anyTimes(res ...string) string { + return `(?:` + strings.Join(res, "") + `)*` +} + +// capture wraps the expression in a capturing group. +func capture(res ...string) string { + return `(` + strings.Join(res, "") + `)` +} + +// anchored anchors the regular expression by adding start and end delimiters. +func anchored(res ...string) string { + return `^` + strings.Join(res, "") + `$` +} diff --git a/vendor/github.com/distribution/reference/sort.go b/vendor/github.com/distribution/reference/sort.go new file mode 100644 index 00000000..416c37b0 --- /dev/null +++ b/vendor/github.com/distribution/reference/sort.go @@ -0,0 +1,75 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package reference + +import ( + "sort" +) + +// Sort sorts string references preferring higher information references. +// +// The precedence is as follows: +// +// 1. [Named] + [Tagged] + [Digested] (e.g., "docker.io/library/busybox:latest@sha256:") +// 2. [Named] + [Tagged] (e.g., "docker.io/library/busybox:latest") +// 3. [Named] + [Digested] (e.g., "docker.io/library/busybo@sha256:") +// 4. [Named] (e.g., "docker.io/library/busybox") +// 5. [Digested] (e.g., "docker.io@sha256:") +// 6. Parse error +func Sort(references []string) []string { + var prefs []Reference + var bad []string + + for _, ref := range references { + pref, err := ParseAnyReference(ref) + if err != nil { + bad = append(bad, ref) + } else { + prefs = append(prefs, pref) + } + } + sort.Slice(prefs, func(a, b int) bool { + ar := refRank(prefs[a]) + br := refRank(prefs[b]) + if ar == br { + return prefs[a].String() < prefs[b].String() + } + return ar < br + }) + sort.Strings(bad) + var refs []string + for _, pref := range prefs { + refs = append(refs, pref.String()) + } + return append(refs, bad...) +} + +func refRank(ref Reference) uint8 { + if _, ok := ref.(Named); ok { + if _, ok = ref.(Tagged); ok { + if _, ok = ref.(Digested); ok { + return 1 + } + return 2 + } + if _, ok = ref.(Digested); ok { + return 3 + } + return 4 + } + return 5 +} diff --git a/vendor/github.com/docker/distribution/digestset/set.go b/vendor/github.com/docker/distribution/digestset/set.go deleted file mode 100644 index 71327dca..00000000 --- a/vendor/github.com/docker/distribution/digestset/set.go +++ /dev/null @@ -1,247 +0,0 @@ -package digestset - -import ( - "errors" - "sort" - "strings" - "sync" - - digest "github.com/opencontainers/go-digest" -) - -var ( - // ErrDigestNotFound is used when a matching digest - // could not be found in a set. - ErrDigestNotFound = errors.New("digest not found") - - // ErrDigestAmbiguous is used when multiple digests - // are found in a set. None of the matching digests - // should be considered valid matches. - ErrDigestAmbiguous = errors.New("ambiguous digest string") -) - -// Set is used to hold a unique set of digests which -// may be easily referenced by easily referenced by a string -// representation of the digest as well as short representation. -// The uniqueness of the short representation is based on other -// digests in the set. If digests are omitted from this set, -// collisions in a larger set may not be detected, therefore it -// is important to always do short representation lookups on -// the complete set of digests. To mitigate collisions, an -// appropriately long short code should be used. -type Set struct { - mutex sync.RWMutex - entries digestEntries -} - -// NewSet creates an empty set of digests -// which may have digests added. -func NewSet() *Set { - return &Set{ - entries: digestEntries{}, - } -} - -// checkShortMatch checks whether two digests match as either whole -// values or short values. This function does not test equality, -// rather whether the second value could match against the first -// value. -func checkShortMatch(alg digest.Algorithm, hex, shortAlg, shortHex string) bool { - if len(hex) == len(shortHex) { - if hex != shortHex { - return false - } - if len(shortAlg) > 0 && string(alg) != shortAlg { - return false - } - } else if !strings.HasPrefix(hex, shortHex) { - return false - } else if len(shortAlg) > 0 && string(alg) != shortAlg { - return false - } - return true -} - -// Lookup looks for a digest matching the given string representation. -// If no digests could be found ErrDigestNotFound will be returned -// with an empty digest value. If multiple matches are found -// ErrDigestAmbiguous will be returned with an empty digest value. -func (dst *Set) Lookup(d string) (digest.Digest, error) { - dst.mutex.RLock() - defer dst.mutex.RUnlock() - if len(dst.entries) == 0 { - return "", ErrDigestNotFound - } - var ( - searchFunc func(int) bool - alg digest.Algorithm - hex string - ) - dgst, err := digest.Parse(d) - if err == digest.ErrDigestInvalidFormat { - hex = d - searchFunc = func(i int) bool { - return dst.entries[i].val >= d - } - } else { - hex = dgst.Hex() - alg = dgst.Algorithm() - searchFunc = func(i int) bool { - if dst.entries[i].val == hex { - return dst.entries[i].alg >= alg - } - return dst.entries[i].val >= hex - } - } - idx := sort.Search(len(dst.entries), searchFunc) - if idx == len(dst.entries) || !checkShortMatch(dst.entries[idx].alg, dst.entries[idx].val, string(alg), hex) { - return "", ErrDigestNotFound - } - if dst.entries[idx].alg == alg && dst.entries[idx].val == hex { - return dst.entries[idx].digest, nil - } - if idx+1 < len(dst.entries) && checkShortMatch(dst.entries[idx+1].alg, dst.entries[idx+1].val, string(alg), hex) { - return "", ErrDigestAmbiguous - } - - return dst.entries[idx].digest, nil -} - -// Add adds the given digest to the set. An error will be returned -// if the given digest is invalid. If the digest already exists in the -// set, this operation will be a no-op. -func (dst *Set) Add(d digest.Digest) error { - if err := d.Validate(); err != nil { - return err - } - dst.mutex.Lock() - defer dst.mutex.Unlock() - entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d} - searchFunc := func(i int) bool { - if dst.entries[i].val == entry.val { - return dst.entries[i].alg >= entry.alg - } - return dst.entries[i].val >= entry.val - } - idx := sort.Search(len(dst.entries), searchFunc) - if idx == len(dst.entries) { - dst.entries = append(dst.entries, entry) - return nil - } else if dst.entries[idx].digest == d { - return nil - } - - entries := append(dst.entries, nil) - copy(entries[idx+1:], entries[idx:len(entries)-1]) - entries[idx] = entry - dst.entries = entries - return nil -} - -// Remove removes the given digest from the set. An err will be -// returned if the given digest is invalid. If the digest does -// not exist in the set, this operation will be a no-op. -func (dst *Set) Remove(d digest.Digest) error { - if err := d.Validate(); err != nil { - return err - } - dst.mutex.Lock() - defer dst.mutex.Unlock() - entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d} - searchFunc := func(i int) bool { - if dst.entries[i].val == entry.val { - return dst.entries[i].alg >= entry.alg - } - return dst.entries[i].val >= entry.val - } - idx := sort.Search(len(dst.entries), searchFunc) - // Not found if idx is after or value at idx is not digest - if idx == len(dst.entries) || dst.entries[idx].digest != d { - return nil - } - - entries := dst.entries - copy(entries[idx:], entries[idx+1:]) - entries = entries[:len(entries)-1] - dst.entries = entries - - return nil -} - -// All returns all the digests in the set -func (dst *Set) All() []digest.Digest { - dst.mutex.RLock() - defer dst.mutex.RUnlock() - retValues := make([]digest.Digest, len(dst.entries)) - for i := range dst.entries { - retValues[i] = dst.entries[i].digest - } - - return retValues -} - -// ShortCodeTable returns a map of Digest to unique short codes. The -// length represents the minimum value, the maximum length may be the -// entire value of digest if uniqueness cannot be achieved without the -// full value. This function will attempt to make short codes as short -// as possible to be unique. -func ShortCodeTable(dst *Set, length int) map[digest.Digest]string { - dst.mutex.RLock() - defer dst.mutex.RUnlock() - m := make(map[digest.Digest]string, len(dst.entries)) - l := length - resetIdx := 0 - for i := 0; i < len(dst.entries); i++ { - var short string - extended := true - for extended { - extended = false - if len(dst.entries[i].val) <= l { - short = dst.entries[i].digest.String() - } else { - short = dst.entries[i].val[:l] - for j := i + 1; j < len(dst.entries); j++ { - if checkShortMatch(dst.entries[j].alg, dst.entries[j].val, "", short) { - if j > resetIdx { - resetIdx = j - } - extended = true - } else { - break - } - } - if extended { - l++ - } - } - } - m[dst.entries[i].digest] = short - if i >= resetIdx { - l = length - } - } - return m -} - -type digestEntry struct { - alg digest.Algorithm - val string - digest digest.Digest -} - -type digestEntries []*digestEntry - -func (d digestEntries) Len() int { - return len(d) -} - -func (d digestEntries) Less(i, j int) bool { - if d[i].val != d[j].val { - return d[i].val < d[j].val - } - return d[i].alg < d[j].alg -} - -func (d digestEntries) Swap(i, j int) { - d[i], d[j] = d[j], d[i] -} diff --git a/vendor/github.com/docker/distribution/reference/regexp.go b/vendor/github.com/docker/distribution/reference/regexp.go deleted file mode 100644 index 78603493..00000000 --- a/vendor/github.com/docker/distribution/reference/regexp.go +++ /dev/null @@ -1,143 +0,0 @@ -package reference - -import "regexp" - -var ( - // alphaNumericRegexp defines the alpha numeric atom, typically a - // component of names. This only allows lower case characters and digits. - alphaNumericRegexp = match(`[a-z0-9]+`) - - // separatorRegexp defines the separators allowed to be embedded in name - // components. This allow one period, one or two underscore and multiple - // dashes. - separatorRegexp = match(`(?:[._]|__|[-]*)`) - - // nameComponentRegexp restricts registry path component names to start - // with at least one letter or number, with following parts able to be - // separated by one period, one or two underscore and multiple dashes. - nameComponentRegexp = expression( - alphaNumericRegexp, - optional(repeated(separatorRegexp, alphaNumericRegexp))) - - // domainComponentRegexp restricts the registry domain component of a - // repository name to start with a component as defined by DomainRegexp - // and followed by an optional port. - domainComponentRegexp = match(`(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])`) - - // DomainRegexp defines the structure of potential domain components - // that may be part of image names. This is purposely a subset of what is - // allowed by DNS to ensure backwards compatibility with Docker image - // names. - DomainRegexp = expression( - domainComponentRegexp, - optional(repeated(literal(`.`), domainComponentRegexp)), - optional(literal(`:`), match(`[0-9]+`))) - - // TagRegexp matches valid tag names. From docker/docker:graph/tags.go. - TagRegexp = match(`[\w][\w.-]{0,127}`) - - // anchoredTagRegexp matches valid tag names, anchored at the start and - // end of the matched string. - anchoredTagRegexp = anchored(TagRegexp) - - // DigestRegexp matches valid digests. - DigestRegexp = match(`[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}`) - - // anchoredDigestRegexp matches valid digests, anchored at the start and - // end of the matched string. - anchoredDigestRegexp = anchored(DigestRegexp) - - // NameRegexp is the format for the name component of references. The - // regexp has capturing groups for the domain and name part omitting - // the separating forward slash from either. - NameRegexp = expression( - optional(DomainRegexp, literal(`/`)), - nameComponentRegexp, - optional(repeated(literal(`/`), nameComponentRegexp))) - - // anchoredNameRegexp is used to parse a name value, capturing the - // domain and trailing components. - anchoredNameRegexp = anchored( - optional(capture(DomainRegexp), literal(`/`)), - capture(nameComponentRegexp, - optional(repeated(literal(`/`), nameComponentRegexp)))) - - // ReferenceRegexp is the full supported format of a reference. The regexp - // is anchored and has capturing groups for name, tag, and digest - // components. - ReferenceRegexp = anchored(capture(NameRegexp), - optional(literal(":"), capture(TagRegexp)), - optional(literal("@"), capture(DigestRegexp))) - - // IdentifierRegexp is the format for string identifier used as a - // content addressable identifier using sha256. These identifiers - // are like digests without the algorithm, since sha256 is used. - IdentifierRegexp = match(`([a-f0-9]{64})`) - - // ShortIdentifierRegexp is the format used to represent a prefix - // of an identifier. A prefix may be used to match a sha256 identifier - // within a list of trusted identifiers. - ShortIdentifierRegexp = match(`([a-f0-9]{6,64})`) - - // anchoredIdentifierRegexp is used to check or match an - // identifier value, anchored at start and end of string. - anchoredIdentifierRegexp = anchored(IdentifierRegexp) - - // anchoredShortIdentifierRegexp is used to check if a value - // is a possible identifier prefix, anchored at start and end - // of string. - anchoredShortIdentifierRegexp = anchored(ShortIdentifierRegexp) -) - -// match compiles the string to a regular expression. -var match = regexp.MustCompile - -// literal compiles s into a literal regular expression, escaping any regexp -// reserved characters. -func literal(s string) *regexp.Regexp { - re := match(regexp.QuoteMeta(s)) - - if _, complete := re.LiteralPrefix(); !complete { - panic("must be a literal") - } - - return re -} - -// expression defines a full expression, where each regular expression must -// follow the previous. -func expression(res ...*regexp.Regexp) *regexp.Regexp { - var s string - for _, re := range res { - s += re.String() - } - - return match(s) -} - -// optional wraps the expression in a non-capturing group and makes the -// production optional. -func optional(res ...*regexp.Regexp) *regexp.Regexp { - return match(group(expression(res...)).String() + `?`) -} - -// repeated wraps the regexp in a non-capturing group to get one or more -// matches. -func repeated(res ...*regexp.Regexp) *regexp.Regexp { - return match(group(expression(res...)).String() + `+`) -} - -// group wraps the regexp in a non-capturing group. -func group(res ...*regexp.Regexp) *regexp.Regexp { - return match(`(?:` + expression(res...).String() + `)`) -} - -// capture wraps the expression in a capturing group. -func capture(res ...*regexp.Regexp) *regexp.Regexp { - return match(`(` + expression(res...).String() + `)`) -} - -// anchored anchors the regular expression by adding start and end delimiters. -func anchored(res ...*regexp.Regexp) *regexp.Regexp { - return match(`^` + expression(res...).String() + `$`) -} diff --git a/vendor/github.com/docker/docker/AUTHORS b/vendor/github.com/docker/docker/AUTHORS index b3141819..48d04f9a 100644 --- a/vendor/github.com/docker/docker/AUTHORS +++ b/vendor/github.com/docker/docker/AUTHORS @@ -27,6 +27,7 @@ Adam Miller Adam Mills Adam Pointer Adam Singer +Adam Thornton Adam Walz Adam Williams AdamKorcz @@ -173,6 +174,7 @@ Andy Rothfusz Andy Smith Andy Wilson Andy Zhang +Aneesh Kulkarni Anes Hasicic Angel Velazquez Anil Belur @@ -236,6 +238,7 @@ Ben Golub Ben Gould Ben Hall Ben Langfeld +Ben Lovy Ben Sargent Ben Severson Ben Toews @@ -262,7 +265,7 @@ Billy Ridgway Bily Zhang Bin Liu Bingshen Wang -Bjorn Neergaard +Bjorn Neergaard Blake Geno Boaz Shuster bobby abbott @@ -279,6 +282,7 @@ Brandon Liu Brandon Philips Brandon Rhodes Brendan Dixon +Brennan Kinney <5098581+polarathene@users.noreply.github.com> Brent Salisbury Brett Higgins Brett Kochendorfer @@ -363,6 +367,7 @@ chenyuzhu Chetan Birajdar Chewey Chia-liang Kao +Chiranjeevi Tirunagari chli Cholerae Hu Chris Alfonso @@ -433,8 +438,8 @@ Cristian Staretu cristiano balducci Cristina Yenyxe Gonzalez Garcia Cruceru Calin-Cristian +cui fliter CUI Wei -cuishuang Cuong Manh Le Cyprian Gracz Cyril F @@ -513,6 +518,7 @@ David Dooling David Gageot David Gebler David Glasser +David Karlsson <35727626+dvdksn@users.noreply.github.com> David Lawrence David Lechner David M. Karr @@ -602,6 +608,7 @@ Donald Huang Dong Chen Donghwa Kim Donovan Jones +Dorin Geman Doron Podoleanu Doug Davis Doug MacEachern @@ -636,6 +643,7 @@ Emily Rose Emir Ozer Eng Zer Jun Enguerran +Enrico Weigelt, metux IT consult Eohyung Lee epeterso er0k @@ -676,6 +684,7 @@ Evan Allrich Evan Carmi Evan Hazlett Evan Krall +Evan Lezar Evan Phoenix Evan Wies Evelyn Xu @@ -744,6 +753,7 @@ Frank Groeneveld Frank Herrmann Frank Macreery Frank Rosquin +Frank Villaro-Dixon Frank Yang Fred Lifton Frederick F. Kautz IV @@ -983,6 +993,7 @@ Jean Rouge Jean-Baptiste Barth Jean-Baptiste Dalido Jean-Christophe Berthon +Jean-Michel Rouet Jean-Paul Calderone Jean-Pierre Huynh Jean-Tiare Le Bigot @@ -1013,6 +1024,7 @@ Jeroen Jacobs Jesse Dearing Jesse Dubay Jessica Frazelle +Jeyanthinath Muthuram Jezeniel Zapanta Jhon Honce Ji.Zhilong @@ -1141,6 +1153,7 @@ junxu Jussi Nummelin Justas Brazauskas Justen Martin +Justin Chadwell Justin Cormack Justin Force Justin Keller <85903732+jk-vb@users.noreply.github.com> @@ -1183,6 +1196,7 @@ Ke Xu Kei Ohmura Keith Hudgins Keli Hu +Ken Bannister Ken Cochrane Ken Herner Ken ICHIKAWA @@ -1192,7 +1206,7 @@ Kenjiro Nakayama Kent Johnson Kenta Tada Kevin "qwazerty" Houdebert -Kevin Alvarez +Kevin Alvarez Kevin Burke Kevin Clark Kevin Feyrer @@ -1225,6 +1239,7 @@ Konstantin Gribov Konstantin L Konstantin Pelykh Kostadin Plachkov +kpcyrd Krasi Georgiev Krasimir Georgiev Kris-Mikael Krister @@ -1306,6 +1321,7 @@ Lorenzo Fontana Lotus Fenn Louis Delossantos Louis Opter +Luboslav Pivarc Luca Favatella Luca Marturana Luca Orlandi @@ -1344,6 +1360,7 @@ Manuel Meurer Manuel Rüger Manuel Woelker mapk0y +Marat Radchenko Marc Abramowitz Marc Kuo Marc Tamsky @@ -1383,6 +1400,7 @@ Martijn van Oosterhout Martin Braun Martin Dojcak Martin Honermeyer +Martin Jirku Martin Kelly Martin Mosegaard Amdisen Martin Muzatko @@ -1461,6 +1479,7 @@ Michael Holzheu Michael Hudson-Doyle Michael Huettermann Michael Irwin +Michael Kebe Michael Kuehn Michael Käufl Michael Neale @@ -1509,10 +1528,11 @@ Mike Lundy Mike MacCana Mike Naberezny Mike Snitzer +Mike Sul mikelinjie <294893458@qq.com> Mikhail Sobolev Miklos Szegedi -Milas Bowman +Milas Bowman Milind Chawre Miloslav Trmač mingqing @@ -1524,6 +1544,7 @@ mlarcher Mohammad Banikazemi Mohammad Nasirifar Mohammed Aaqib Ansari +Mohd Sadiq Mohit Soni Moorthy RS Morgan Bauer @@ -1606,6 +1627,7 @@ Noah Treuhaft NobodyOnSE noducks Nolan Darilek +Nolan Miles Noriki Nakamura nponeccop Nurahmadie @@ -1661,6 +1683,7 @@ Paul Lietar Paul Liljenberg Paul Morie Paul Nasrat +Paul Seiffert Paul Weaver Paulo Gomes Paulo Ribeiro @@ -1674,6 +1697,7 @@ Pavlos Ratis Pavol Vargovcik Pawel Konczalski Paweł Gronowski +payall4u Peeyush Gupta Peggy Li Pei Su @@ -1703,7 +1727,9 @@ Phil Estes Phil Sphicas Phil Spitler Philip Alexander Etling +Philip K. Warren Philip Monroe +Philipp Fruck Philipp Gillé Philipp Wahala Philipp Weissensteiner @@ -1741,6 +1767,7 @@ Quentin Brossard Quentin Perez Quentin Tayssier r0n22 +Rachit Sharma Radostin Stoyanov Rafal Jeczalik Rafe Colton @@ -1773,6 +1800,7 @@ Rich Horwood Rich Moyse Rich Seymour Richard Burnison +Richard Hansen Richard Harvey Richard Mathie Richard Metzler @@ -1788,6 +1816,7 @@ Ritesh H Shukla Riyaz Faizullabhoy Rob Cowsill <42620235+rcowsill@users.noreply.github.com> Rob Gulewich +Rob Murray Rob Vesse Robert Bachmann Robert Bittle @@ -1869,6 +1898,7 @@ ryancooper7 RyanDeng Ryo Nakao Ryoga Saito +Régis Behmo Rémy Greinhofer s. rannou Sabin Basyal @@ -1885,6 +1915,7 @@ Sam J Sharpe Sam Neirinck Sam Reis Sam Rijs +Sam Thibault Sam Whited Sambuddha Basu Sami Wagiaalla @@ -1908,6 +1939,7 @@ Satoshi Tagomori Scott Bessler Scott Collier Scott Johnston +Scott Moser Scott Percival Scott Stamp Scott Walls @@ -1923,6 +1955,7 @@ Sebastiaan van Steenis Sebastiaan van Stijn Sebastian Höffner Sebastian Radloff +Sebastian Thomschke Sebastien Goasguen Senthil Kumar Selvaraj Senthil Kumaran @@ -1996,6 +2029,7 @@ Stanislav Bondarenko Stanislav Levin Steeve Morin Stefan Berger +Stefan Gehrig Stefan J. Wernli Stefan Praszalowicz Stefan S. @@ -2003,6 +2037,7 @@ Stefan Scherer Stefan Staudenmeyer Stefan Weil Steffen Butzer +Stephan Henningsen Stephan Spindler Stephen Benjamin Stephen Crosby @@ -2204,6 +2239,7 @@ Vinod Kulkarni Vishal Doshi Vishnu Kannan Vitaly Ostrosablin +Vitor Anjos Vitor Monteiro Vivek Agarwal Vivek Dasgupta @@ -2250,6 +2286,7 @@ Wenxuan Zhao Wenyu You <21551128@zju.edu.cn> Wenzhi Liang Wes Morgan +Wesley Pettit Wewang Xiaorenfine Wiktor Kwapisiewicz Will Dietz @@ -2289,7 +2326,7 @@ xiekeyang Ximo Guanter Gonzálbez xin.li Xinbo Weng -Xinfeng Liu +Xinfeng Liu Xinzi Zhou Xiuming Chen Xuecong Liao @@ -2355,6 +2392,7 @@ Zen Lin(Zhinan Lin) Zhang Kun Zhang Wei Zhang Wentao +zhangguanzhang ZhangHang zhangxianwei Zhenan Ye <21551168@zju.edu.cn> @@ -2381,6 +2419,7 @@ Zuhayr Elahi Zunayed Ali Álvaro Lázaro Átila Camurça Alves +吴小白 <296015668@qq.com> 尹吉峰 屈骏 徐俊杰 diff --git a/vendor/github.com/docker/docker/api/README.md b/vendor/github.com/docker/docker/api/README.md index f136c343..381f1988 100644 --- a/vendor/github.com/docker/docker/api/README.md +++ b/vendor/github.com/docker/docker/api/README.md @@ -37,6 +37,6 @@ There is hopefully enough example material in the file for you to copy a similar When you make edits to `swagger.yaml`, you may want to check the generated API documentation to ensure it renders correctly. -Run `make swagger-docs` and a preview will be running at `http://localhost`. Some of the styling may be incorrect, but you'll be able to ensure that it is generating the correct documentation. +Run `make swagger-docs` and a preview will be running at `http://localhost:9000`. Some of the styling may be incorrect, but you'll be able to ensure that it is generating the correct documentation. The production documentation is generated by vendoring `swagger.yaml` into [docker/docker.github.io](https://github.com/docker/docker.github.io). diff --git a/vendor/github.com/docker/docker/api/common.go b/vendor/github.com/docker/docker/api/common.go index cba66bc4..37e553d4 100644 --- a/vendor/github.com/docker/docker/api/common.go +++ b/vendor/github.com/docker/docker/api/common.go @@ -3,7 +3,7 @@ package api // import "github.com/docker/docker/api" // Common constants for daemon and client. const ( // DefaultVersion of Current REST API - DefaultVersion = "1.43" + DefaultVersion = "1.44" // NoBaseImageSpecifier is the symbol used by the FROM // command to specify that no base image is to be used. diff --git a/vendor/github.com/docker/docker/api/common_unix.go b/vendor/github.com/docker/docker/api/common_unix.go deleted file mode 100644 index 19fc63d6..00000000 --- a/vendor/github.com/docker/docker/api/common_unix.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build !windows -// +build !windows - -package api // import "github.com/docker/docker/api" - -// MinVersion represents Minimum REST API version supported -const MinVersion = "1.12" diff --git a/vendor/github.com/docker/docker/api/common_windows.go b/vendor/github.com/docker/docker/api/common_windows.go deleted file mode 100644 index 590ba547..00000000 --- a/vendor/github.com/docker/docker/api/common_windows.go +++ /dev/null @@ -1,8 +0,0 @@ -package api // import "github.com/docker/docker/api" - -// MinVersion represents Minimum REST API version supported -// Technically the first daemon API version released on Windows is v1.25 in -// engine version 1.13. However, some clients are explicitly using downlevel -// APIs (e.g. docker-compose v2.1 file format) and that is just too restrictive. -// Hence also allowing 1.24 on Windows. -const MinVersion string = "1.24" diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index d98bc1bf..201b5490 100644 --- a/vendor/github.com/docker/docker/api/swagger.yaml +++ b/vendor/github.com/docker/docker/api/swagger.yaml @@ -19,10 +19,10 @@ produces: consumes: - "application/json" - "text/plain" -basePath: "/v1.43" +basePath: "/v1.44" info: title: "Docker Engine API" - version: "1.43" + version: "1.44" x-logo: url: "https://docs.docker.com/assets/images/logo-docker-main.png" description: | @@ -55,8 +55,8 @@ info: the URL is not supported by the daemon, a HTTP `400 Bad Request` error message is returned. - If you omit the version-prefix, the current version of the API (v1.43) is used. - For example, calling `/info` is the same as calling `/v1.43/info`. Using the + If you omit the version-prefix, the current version of the API (v1.44) is used. + For example, calling `/info` is the same as calling `/v1.44/info`. Using the API without a version-prefix is deprecated and will be removed in a future release. Engine releases in the near future should support this version of the API, @@ -388,6 +388,20 @@ definitions: description: "Create mount point on host if missing" type: "boolean" default: false + ReadOnlyNonRecursive: + description: | + Make the mount non-recursively read-only, but still leave the mount recursive + (unless NonRecursive is set to `true` in conjunction). + + Addded in v1.44, before that version all read-only mounts were + non-recursive by default. To match the previous behaviour this + will default to `true` for clients on versions prior to v1.44. + type: "boolean" + default: false + ReadOnlyForceRecursive: + description: "Raise an error if the mount cannot be made recursively read-only." + type: "boolean" + default: false VolumeOptions: description: "Optional configuration for the `volume` type." type: "object" @@ -794,6 +808,12 @@ definitions: 1000000 (1 ms). 0 means inherit. type: "integer" format: "int64" + StartInterval: + description: | + The time to wait between checks in nanoseconds during the start period. + It should be 0 or at least 1000000 (1 ms). 0 means inherit. + type: "integer" + format: "int64" Health: description: | @@ -1297,7 +1317,10 @@ definitions: type: "boolean" x-nullable: true MacAddress: - description: "MAC address of the container." + description: | + MAC address of the container. + + Deprecated: this field is deprecated in API v1.44 and up. Use EndpointSettings.MacAddress instead. type: "string" x-nullable: true OnBuild: @@ -1347,16 +1370,16 @@ definitions: EndpointsConfig: description: | A mapping of network name to endpoint configuration for that network. + The endpoint configuration can be left empty to connect to that + network with no particular endpoint configuration. type: "object" additionalProperties: $ref: "#/definitions/EndpointSettings" example: # putting an example here, instead of using the example values from - # /definitions/EndpointSettings, because containers/create currently - # does not support attaching to multiple networks, so the example request - # would be confusing if it showed that multiple networks can be contained - # in the EndpointsConfig. - # TODO remove once we support multiple networks on container create (see https://github.com/moby/moby/blob/07e6b843594e061f82baa5fa23c2ff7d536c2a05/daemon/create.go#L323) + # /definitions/EndpointSettings, because EndpointSettings contains + # operational data returned when inspecting a container that we don't + # accept here. EndpointsConfig: isolated_nw: IPAMConfig: @@ -1365,19 +1388,22 @@ definitions: LinkLocalIPs: - "169.254.34.68" - "fe80::3468" + MacAddress: "02:42:ac:12:05:02" Links: - "container_1" - "container_2" Aliases: - "server_x" - "server_y" + database_nw: {} NetworkSettings: description: "NetworkSettings exposes the network settings in the API" type: "object" properties: Bridge: - description: Name of the network's bridge (for example, `docker0`). + description: | + Name of the default bridge interface when dockerd's --bridge flag is set. type: "string" example: "docker0" SandboxID: @@ -1387,34 +1413,40 @@ definitions: HairpinMode: description: | Indicates if hairpin NAT should be enabled on the virtual interface. + + Deprecated: This field is never set and will be removed in a future release. type: "boolean" example: false LinkLocalIPv6Address: - description: IPv6 unicast address using the link-local prefix. + description: | + IPv6 unicast address using the link-local prefix. + + Deprecated: This field is never set and will be removed in a future release. type: "string" - example: "fe80::42:acff:fe11:1" + example: "" LinkLocalIPv6PrefixLen: - description: Prefix length of the IPv6 unicast address. + description: | + Prefix length of the IPv6 unicast address. + + Deprecated: This field is never set and will be removed in a future release. type: "integer" - example: "64" + example: "" Ports: $ref: "#/definitions/PortMap" SandboxKey: - description: SandboxKey identifies the sandbox + description: SandboxKey is the full path of the netns handle type: "string" example: "/var/run/docker/netns/8ab54b426c38" - # TODO is SecondaryIPAddresses actually used? SecondaryIPAddresses: - description: "" + description: "Deprecated: This field is never set and will be removed in a future release." type: "array" items: $ref: "#/definitions/Address" x-nullable: true - # TODO is SecondaryIPv6Addresses actually used? SecondaryIPv6Addresses: - description: "" + description: "Deprecated: This field is never set and will be removed in a future release." type: "array" items: $ref: "#/definitions/Address" @@ -1715,18 +1747,27 @@ definitions: description: | Date and time at which the image was created, formatted in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + + This information is only available if present in the image, + and omitted otherwise. type: "string" - x-nullable: false + format: "dateTime" + x-nullable: true example: "2022-02-04T21:20:12.497794809Z" Container: description: | The ID of the container that was used to create the image. Depending on how the image was created, this field may be empty. + + **Deprecated**: this field is kept for backward compatibility, but + will be removed in API v1.45. type: "string" - x-nullable: false example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735" ContainerConfig: + description: | + **Deprecated**: this field is kept for backward compatibility, but + will be removed in API v1.45. $ref: "#/definitions/ContainerConfig" DockerVersion: description: | @@ -1781,13 +1822,7 @@ definitions: description: | Total size of the image including all layers it is composed of. - In versions of Docker before v1.10, this field was calculated from - the image itself and all of its parent images. Images are now stored - self-contained, and no longer use a parent-chain, making this field - an equivalent of the Size field. - - > **Deprecated**: this field is kept for backward compatibility, but - > will be removed in API v1.44. + Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. type: "integer" format: "int64" example: 1239828 @@ -1829,6 +1864,7 @@ definitions: x-nullable: true ImageSummary: type: "object" + x-go-name: "Summary" required: - Id - ParentId @@ -1925,12 +1961,7 @@ definitions: description: |- Total size of the image including all layers it is composed of. - In versions of Docker before v1.10, this field was calculated from - the image itself and all of its parent images. Images are now stored - self-contained, and no longer use a parent-chain, making this field - an equivalent of the Size field. - - Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44. + Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. type: "integer" format: "int64" example: 172064416 @@ -2448,6 +2479,11 @@ definitions: example: - "container_1" - "container_2" + MacAddress: + description: | + MAC address for the endpoint on this network. The network driver might ignore this parameter. + type: "string" + example: "02:42:ac:11:00:04" Aliases: type: "array" items: @@ -2498,11 +2534,6 @@ definitions: type: "integer" format: "int64" example: 64 - MacAddress: - description: | - MAC address for the endpoint on this network. - type: "string" - example: "02:42:ac:11:00:04" DriverOpts: description: | DriverOpts is a mapping of driver options and values. These options @@ -2514,6 +2545,21 @@ definitions: example: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" + DNSNames: + description: | + List of all DNS names an endpoint has on a specific network. This + list is based on the container name, network aliases, container short + ID, and hostname. + + These DNS names are non-fully qualified but can contain several dots. + You can get fully qualified DNS names by appending `.`. + For instance, if container name is `my.ctr` and the network is named + `testnet`, `DNSNames` will contain `my.ctr` and the FQDN will be + `my.ctr.testnet`. + type: array + items: + type: string + example: ["foobar", "server_x", "server_y", "my.ctr"] EndpointIPAMConfig: description: | @@ -3545,6 +3591,32 @@ definitions: Level: type: "string" description: "SELinux level label" + Seccomp: + type: "object" + description: "Options for configuring seccomp on the container" + properties: + Mode: + type: "string" + enum: + - "default" + - "unconfined" + - "custom" + Profile: + description: "The custom seccomp profile as a json object" + type: "string" + AppArmor: + type: "object" + description: "Options for configuring AppArmor on the container" + properties: + Mode: + type: "string" + enum: + - "default" + - "disabled" + NoNewPrivileges: + type: "boolean" + description: "Configuration of the no_new_privs bit in the container" + TTY: description: "Whether a pseudo-TTY should be allocated." type: "boolean" @@ -3939,6 +4011,44 @@ definitions: - "remove" - "orphaned" + ContainerStatus: + type: "object" + description: "represents the status of a container." + properties: + ContainerID: + type: "string" + PID: + type: "integer" + ExitCode: + type: "integer" + + PortStatus: + type: "object" + description: "represents the port status of a task's host ports whose service has published host ports" + properties: + Ports: + type: "array" + items: + $ref: "#/definitions/EndpointPortConfig" + + TaskStatus: + type: "object" + description: "represents the status of a task." + properties: + Timestamp: + type: "string" + format: "dateTime" + State: + $ref: "#/definitions/TaskState" + Message: + type: "string" + Err: + type: "string" + ContainerStatus: + $ref: "#/definitions/ContainerStatus" + PortStatus: + $ref: "#/definitions/PortStatus" + Task: type: "object" properties: @@ -3974,26 +4084,7 @@ definitions: AssignedGenericResources: $ref: "#/definitions/GenericResources" Status: - type: "object" - properties: - Timestamp: - type: "string" - format: "dateTime" - State: - $ref: "#/definitions/TaskState" - Message: - type: "string" - Err: - type: "string" - ContainerStatus: - type: "object" - properties: - ContainerID: - type: "string" - PID: - type: "integer" - ExitCode: - type: "integer" + $ref: "#/definitions/TaskStatus" DesiredState: $ref: "#/definitions/TaskState" JobIteration: @@ -4209,7 +4300,10 @@ definitions: - "stop-first" - "start-first" Networks: - description: "Specifies which networks the service should attach to." + description: | + Specifies which networks the service should attach to. + + Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec should be used instead. type: "array" items: $ref: "#/definitions/NetworkAttachmentConfig" @@ -4443,6 +4537,7 @@ definitions: ImageDeleteResponseItem: type: "object" + x-go-name: "DeleteResponse" properties: Untagged: description: "The image ID of an image that was untagged" @@ -4451,6 +4546,29 @@ definitions: description: "The image ID of an image that was deleted" type: "string" + ServiceCreateResponse: + type: "object" + description: | + contains the information returned to a client on the + creation of a new service. + properties: + ID: + description: "The ID of the created service." + type: "string" + x-nullable: false + example: "ak7w3gjqoa3kuz8xcpnyy0pvl" + Warnings: + description: | + Optional warning message. + + FIXME(thaJeztah): this should have "omitempty" in the generated type. + type: "array" + x-nullable: true + items: + type: "string" + example: + - "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + ServiceUpdateResponse: type: "object" properties: @@ -4460,7 +4578,8 @@ definitions: items: type: "string" example: - Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + Warnings: + - "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" ContainerSummary: type: "object" @@ -5294,7 +5413,25 @@ definitions: - "WARNING: No memory limit support" - "WARNING: bridge-nf-call-iptables is disabled" - "WARNING: bridge-nf-call-ip6tables is disabled" + CDISpecDirs: + description: | + List of directories where (Container Device Interface) CDI + specifications are located. + + These specifications define vendor-specific modifications to an OCI + runtime specification for a container being created. + An empty list indicates that CDI device injection is disabled. + + Note that since using CDI device injection requires the daemon to have + experimental enabled. For non-experimental daemons an empty list will + always be returned. + type: "array" + items: + type: "string" + example: + - "/etc/cdi" + - "/var/run/cdi" # PluginsInfo is a temp struct holding Plugins name # registered with docker daemon. It is used by Info struct @@ -5530,6 +5667,28 @@ definitions: items: type: "string" example: ["--debug", "--systemd-cgroup=false"] + status: + description: | + Information specific to the runtime. + + While this API specification does not define data provided by runtimes, + the following well-known properties may be provided by runtimes: + + `org.opencontainers.runtime-spec.features`: features structure as defined + in the [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/main/features.md), + in a JSON string representation. + +


+ + > **Note**: The information returned in this field, including the + > formatting of values and labels, should not be considered stable, + > and may change without notice. + type: "object" + x-nullable: true + additionalProperties: + type: "string" + example: + "org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",\"ociVersionMax\":\"1.1.0\",\"...\":\"...\"}" Commit: description: | @@ -6414,6 +6573,7 @@ paths: Aliases: - "server_x" - "server_y" + database_nw: {} required: true responses: @@ -6561,7 +6721,7 @@ paths: StopSignal: "SIGTERM" StopTimeout: 10 Created: "2015-01-06T15:47:31.485331387Z" - Driver: "devicemapper" + Driver: "overlay2" ExecIDs: - "b35395de42bc8abd327f9dd65d913b9ba28c74d2f0734eeeae84fa1c616a0fca" - "3fc1232e5cd20c8de182ed81178503dc6437f4e7ef12b52cc5e8de020652f1c4" @@ -7992,6 +8152,7 @@ paths: - `label=key` or `label="key=value"` of an image label - `reference`=(`[:]`) - `since`=(`[:]`, `` or ``) + - `until=` type: "string" - name: "shared-size" in: "query" @@ -8174,6 +8335,16 @@ paths: description: "BuildKit output configuration" type: "string" default: "" + - name: "version" + in: "query" + type: "string" + default: "1" + enum: ["1", "2"] + description: | + Version of the builder backend to use. + + - `1` is the first generation classic (deprecated) builder in the Docker daemon (default) + - `2` is [BuildKit](https://github.com/moby/buildkit) responses: 200: description: "no error" @@ -8243,7 +8414,7 @@ paths: /images/create: post: summary: "Create an image" - description: "Create an image by either pulling it from a registry or importing it." + description: "Pull or import an image." operationId: "ImageCreate" consumes: - "text/plain" @@ -8594,28 +8765,36 @@ paths: is_official: type: "boolean" is_automated: + description: | + Whether this repository has automated builds enabled. + +


+ + > **Deprecated**: This field is deprecated and will always + > be "false" in future. type: "boolean" + example: false name: type: "string" star_count: type: "integer" examples: application/json: - - description: "" - is_official: false + - description: "A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size!" + is_official: true is_automated: false - name: "wma55/u1210sshd" - star_count: 0 - - description: "" - is_official: false + name: "alpine" + star_count: 10093 + - description: "Busybox base image." + is_official: true is_automated: false - name: "jdswinbank/sshd" - star_count: 0 - - description: "" - is_official: false + name: "Busybox base image." + star_count: 3037 + - description: "The PostgreSQL object-relational database system provides reliability and data integrity." + is_official: true is_automated: false - name: "vgauthier/sshd" - star_count: 0 + name: "postgres" + star_count: 12408 500: description: "Server error" schema: @@ -8635,9 +8814,13 @@ paths: description: | A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: - - `is-automated=(true|false)` + - `is-automated=(true|false)` (deprecated, see below) - `is-official=(true|false)` - `stars=` Matches images that has at least 'number' stars. + + The `is-automated` filter is deprecated. The `is_automated` field has + been deprecated by Docker Hub's search API. Consequently, searching + for `is-automated=true` will yield no results. type: "string" tags: ["Image"] /images/prune: @@ -9030,7 +9213,6 @@ paths: Created: 1466724217 Size: 1092588 SharedSize: 0 - VirtualSize: 1092588 Labels: {} Containers: 1 Containers: @@ -9893,6 +10075,10 @@ paths: example: Id: "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30" Warning: "" + 400: + description: "bad parameter" + schema: + $ref: "#/definitions/ErrorResponse" 403: description: | Forbidden operation. This happens when trying to create a network named after a pre-defined network, @@ -9922,13 +10108,7 @@ paths: type: "string" CheckDuplicate: description: | - Check for networks with duplicate names. Since Network is - primarily keyed based on a random ID and not on the name, and - network name is strictly a user-friendly alias to the network - which is uniquely identified using ID, there is no guaranteed - way to check for duplicates. CheckDuplicate is there to provide - a best effort checking of any networks which has the same name - but it is not guaranteed to catch all name collisions. + Deprecated: CheckDuplicate is now always enabled. type: "boolean" Driver: description: "Name of the network driver plugin to use." @@ -9996,14 +10176,19 @@ paths: /networks/{id}/connect: post: summary: "Connect a container to a network" + description: "The network must be either a local-scoped network or a swarm-scoped network with the `attachable` option set. A network cannot be re-attached to a running container" operationId: "NetworkConnect" consumes: - "application/json" responses: 200: description: "No error" + 400: + description: "bad parameter" + schema: + $ref: "#/definitions/ErrorResponse" 403: - description: "Operation not supported for swarm scoped networks" + description: "Operation forbidden" schema: $ref: "#/definitions/ErrorResponse" 404: @@ -10038,6 +10223,7 @@ paths: IPAMConfig: IPv4Address: "172.24.56.89" IPv6Address: "2001:db8::5689" + MacAddress: "02:42:ac:12:05:02" tags: ["Network"] /networks/{id}/disconnect: @@ -11031,18 +11217,7 @@ paths: 201: description: "no error" schema: - type: "object" - title: "ServiceCreateResponse" - properties: - ID: - description: "The ID of the created service." - type: "string" - Warning: - description: "Optional warning message" - type: "string" - example: - ID: "ak7w3gjqoa3kuz8xcpnyy0pvl" - Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found" + $ref: "#/definitions/ServiceCreateResponse" 400: description: "bad parameter" schema: diff --git a/vendor/github.com/docker/docker/api/types/auth.go b/vendor/github.com/docker/docker/api/types/auth.go deleted file mode 100644 index 9ee329a2..00000000 --- a/vendor/github.com/docker/docker/api/types/auth.go +++ /dev/null @@ -1,7 +0,0 @@ -package types // import "github.com/docker/docker/api/types" -import "github.com/docker/docker/api/types/registry" - -// AuthConfig contains authorization information for connecting to a Registry. -// -// Deprecated: use github.com/docker/docker/api/types/registry.AuthConfig -type AuthConfig = registry.AuthConfig diff --git a/vendor/github.com/docker/docker/api/types/checkpoint/list.go b/vendor/github.com/docker/docker/api/types/checkpoint/list.go new file mode 100644 index 00000000..94a9c0a4 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/checkpoint/list.go @@ -0,0 +1,7 @@ +package checkpoint + +// Summary represents the details of a checkpoint when listing endpoints. +type Summary struct { + // Name is the name of the checkpoint. + Name string +} diff --git a/vendor/github.com/docker/docker/api/types/checkpoint/options.go b/vendor/github.com/docker/docker/api/types/checkpoint/options.go new file mode 100644 index 00000000..9477458c --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/checkpoint/options.go @@ -0,0 +1,19 @@ +package checkpoint + +// CreateOptions holds parameters to create a checkpoint from a container. +type CreateOptions struct { + CheckpointID string + CheckpointDir string + Exit bool +} + +// ListOptions holds parameters to list checkpoints for a container. +type ListOptions struct { + CheckpointDir string +} + +// DeleteOptions holds parameters to delete a checkpoint from a container. +type DeleteOptions struct { + CheckpointID string + CheckpointDir string +} diff --git a/vendor/github.com/docker/docker/api/types/client.go b/vendor/github.com/docker/docker/api/types/client.go index d8cd3061..24b00a27 100644 --- a/vendor/github.com/docker/docker/api/types/client.go +++ b/vendor/github.com/docker/docker/api/types/client.go @@ -11,44 +11,6 @@ import ( units "github.com/docker/go-units" ) -// CheckpointCreateOptions holds parameters to create a checkpoint from a container -type CheckpointCreateOptions struct { - CheckpointID string - CheckpointDir string - Exit bool -} - -// CheckpointListOptions holds parameters to list checkpoints for a container -type CheckpointListOptions struct { - CheckpointDir string -} - -// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container -type CheckpointDeleteOptions struct { - CheckpointID string - CheckpointDir string -} - -// ContainerAttachOptions holds parameters to attach to a container. -type ContainerAttachOptions struct { - Stream bool - Stdin bool - Stdout bool - Stderr bool - DetachKeys string - Logs bool -} - -// ContainerCommitOptions holds parameters to commit changes into a container. -type ContainerCommitOptions struct { - Reference string - Comment string - Author string - Changes []string - Pause bool - Config *container.Config -} - // ContainerExecInspect holds information returned by exec inspect. type ContainerExecInspect struct { ExecID string `json:"ID"` @@ -58,42 +20,6 @@ type ContainerExecInspect struct { Pid int } -// ContainerListOptions holds parameters to list containers with. -type ContainerListOptions struct { - Size bool - All bool - Latest bool - Since string - Before string - Limit int - Filters filters.Args -} - -// ContainerLogsOptions holds parameters to filter logs with. -type ContainerLogsOptions struct { - ShowStdout bool - ShowStderr bool - Since string - Until string - Timestamps bool - Follow bool - Tail string - Details bool -} - -// ContainerRemoveOptions holds parameters to remove containers. -type ContainerRemoveOptions struct { - RemoveVolumes bool - RemoveLinks bool - Force bool -} - -// ContainerStartOptions holds parameters to start containers. -type ContainerStartOptions struct { - CheckpointID string - CheckpointDir string -} - // CopyToContainerOptions holds information // about files to copy into a container type CopyToContainerOptions struct { @@ -307,14 +233,6 @@ type ImageSearchOptions struct { Limit int } -// ResizeOptions holds parameters to resize a tty. -// It can be used to resize container ttys and -// exec process ttys too. -type ResizeOptions struct { - Height uint - Width uint -} - // NodeListOptions holds parameters to list nodes with. type NodeListOptions struct { Filters filters.Args @@ -340,15 +258,6 @@ type ServiceCreateOptions struct { QueryRegistry bool } -// ServiceCreateResponse contains the information returned to a client -// on the creation of a new service. -type ServiceCreateResponse struct { - // ID is the ID of the created service. - ID string - // Warnings is a set of non-fatal warning messages to pass on to the user. - Warnings []string `json:",omitempty"` -} - // Values for RegistryAuthFrom in ServiceUpdateOptions const ( RegistryAuthFromSpec = "spec" diff --git a/vendor/github.com/docker/docker/api/types/configs.go b/vendor/github.com/docker/docker/api/types/configs.go index 7d5930bb..945b6efa 100644 --- a/vendor/github.com/docker/docker/api/types/configs.go +++ b/vendor/github.com/docker/docker/api/types/configs.go @@ -1,32 +1,5 @@ package types // import "github.com/docker/docker/api/types" -import ( - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" - ocispec "github.com/opencontainers/image-spec/specs-go/v1" -) - -// configs holds structs used for internal communication between the -// frontend (such as an http server) and the backend (such as the -// docker daemon). - -// ContainerCreateConfig is the parameter set to ContainerCreate() -type ContainerCreateConfig struct { - Name string - Config *container.Config - HostConfig *container.HostConfig - NetworkingConfig *network.NetworkingConfig - Platform *ocispec.Platform - AdjustCPUShares bool -} - -// ContainerRmConfig holds arguments for the container remove -// operation. This struct is used to tell the backend what operations -// to perform. -type ContainerRmConfig struct { - ForceRemove, RemoveVolume, RemoveLink bool -} - // ExecConfig is a small subset of the Config struct that holds the configuration // for the exec feature of docker. type ExecConfig struct { @@ -43,25 +16,3 @@ type ExecConfig struct { WorkingDir string // Working directory Cmd []string // Execution commands and args } - -// PluginRmConfig holds arguments for plugin remove. -type PluginRmConfig struct { - ForceRemove bool -} - -// PluginEnableConfig holds arguments for plugin enable -type PluginEnableConfig struct { - Timeout int -} - -// PluginDisableConfig holds arguments for plugin disable. -type PluginDisableConfig struct { - ForceDisable bool -} - -// NetworkListConfig stores the options available for listing networks -type NetworkListConfig struct { - // TODO(@cpuguy83): naming is hard, this is pulled from what was being used in the router before moving here - Detailed bool - Verbose bool -} diff --git a/vendor/github.com/docker/docker/api/types/container/change_response_deprecated.go b/vendor/github.com/docker/docker/api/types/container/change_response_deprecated.go deleted file mode 100644 index 6b4b4739..00000000 --- a/vendor/github.com/docker/docker/api/types/container/change_response_deprecated.go +++ /dev/null @@ -1,6 +0,0 @@ -package container - -// ContainerChangeResponseItem change item in response to ContainerChanges operation -// -// Deprecated: use [FilesystemChange]. -type ContainerChangeResponseItem = FilesystemChange diff --git a/vendor/github.com/docker/docker/api/types/container/config.go b/vendor/github.com/docker/docker/api/types/container/config.go index 077583e6..be41d631 100644 --- a/vendor/github.com/docker/docker/api/types/container/config.go +++ b/vendor/github.com/docker/docker/api/types/container/config.go @@ -5,6 +5,7 @@ import ( "time" "github.com/docker/docker/api/types/strslice" + dockerspec "github.com/docker/docker/image/spec/specs-go/v1" "github.com/docker/go-connections/nat" ) @@ -33,25 +34,7 @@ type StopOptions struct { } // HealthConfig holds configuration settings for the HEALTHCHECK feature. -type HealthConfig struct { - // Test is the test to perform to check that the container is healthy. - // An empty slice means to inherit the default. - // The options are: - // {} : inherit healthcheck - // {"NONE"} : disable healthcheck - // {"CMD", args...} : exec arguments directly - // {"CMD-SHELL", command} : run command with system's default shell - Test []string `json:",omitempty"` - - // Zero means to inherit. Durations are expressed as integer nanoseconds. - Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. - Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. - StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down. - - // Retries is the number of consecutive failures needed to consider a container as unhealthy. - // Zero means inherit. - Retries int `json:",omitempty"` -} +type HealthConfig = dockerspec.HealthcheckConfig // ExecStartOptions holds the options to start container's exec. type ExecStartOptions struct { @@ -87,10 +70,13 @@ type Config struct { WorkingDir string // Current directory (PWD) in the command will be launched Entrypoint strslice.StrSlice // Entrypoint to run when starting the container NetworkDisabled bool `json:",omitempty"` // Is network disabled - MacAddress string `json:",omitempty"` // Mac Address of the container - OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile - Labels map[string]string // List of labels set to this container - StopSignal string `json:",omitempty"` // Signal to stop a container - StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container - Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT + // Mac Address of the container. + // + // Deprecated: this field is deprecated since API v1.44. Use EndpointSettings.MacAddress instead. + MacAddress string `json:",omitempty"` + OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile + Labels map[string]string // List of labels set to this container + StopSignal string `json:",omitempty"` // Signal to stop a container + StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container + Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT } diff --git a/vendor/github.com/docker/docker/api/types/container/errors.go b/vendor/github.com/docker/docker/api/types/container/errors.go new file mode 100644 index 00000000..32c97803 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/container/errors.go @@ -0,0 +1,9 @@ +package container + +type errInvalidParameter struct{ error } + +func (e *errInvalidParameter) InvalidParameter() {} + +func (e *errInvalidParameter) Unwrap() error { + return e.error +} diff --git a/vendor/github.com/docker/docker/api/types/container/hostconfig.go b/vendor/github.com/docker/docker/api/types/container/hostconfig.go index d4e6f553..efb96266 100644 --- a/vendor/github.com/docker/docker/api/types/container/hostconfig.go +++ b/vendor/github.com/docker/docker/api/types/container/hostconfig.go @@ -1,10 +1,12 @@ package container // import "github.com/docker/docker/api/types/container" import ( + "fmt" "strings" "github.com/docker/docker/api/types/blkiodev" "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" "github.com/docker/go-connections/nat" units "github.com/docker/go-units" @@ -132,12 +134,12 @@ type NetworkMode string // IsNone indicates whether container isn't using a network stack. func (n NetworkMode) IsNone() bool { - return n == "none" + return n == network.NetworkNone } // IsDefault indicates whether container uses the default network stack. func (n NetworkMode) IsDefault() bool { - return n == "default" + return n == network.NetworkDefault } // IsPrivate indicates whether container uses its private network stack. @@ -271,33 +273,42 @@ type DeviceMapping struct { // RestartPolicy represents the restart policies of the container. type RestartPolicy struct { - Name string + Name RestartPolicyMode MaximumRetryCount int } +type RestartPolicyMode string + +const ( + RestartPolicyDisabled RestartPolicyMode = "no" + RestartPolicyAlways RestartPolicyMode = "always" + RestartPolicyOnFailure RestartPolicyMode = "on-failure" + RestartPolicyUnlessStopped RestartPolicyMode = "unless-stopped" +) + // IsNone indicates whether the container has the "no" restart policy. // This means the container will not automatically restart when exiting. func (rp *RestartPolicy) IsNone() bool { - return rp.Name == "no" || rp.Name == "" + return rp.Name == RestartPolicyDisabled || rp.Name == "" } // IsAlways indicates whether the container has the "always" restart policy. // This means the container will automatically restart regardless of the exit status. func (rp *RestartPolicy) IsAlways() bool { - return rp.Name == "always" + return rp.Name == RestartPolicyAlways } // IsOnFailure indicates whether the container has the "on-failure" restart policy. // This means the container will automatically restart of exiting with a non-zero exit status. func (rp *RestartPolicy) IsOnFailure() bool { - return rp.Name == "on-failure" + return rp.Name == RestartPolicyOnFailure } // IsUnlessStopped indicates whether the container has the // "unless-stopped" restart policy. This means the container will // automatically restart unless user has put it to stopped state. func (rp *RestartPolicy) IsUnlessStopped() bool { - return rp.Name == "unless-stopped" + return rp.Name == RestartPolicyUnlessStopped } // IsSame compares two RestartPolicy to see if they are the same @@ -305,6 +316,33 @@ func (rp *RestartPolicy) IsSame(tp *RestartPolicy) bool { return rp.Name == tp.Name && rp.MaximumRetryCount == tp.MaximumRetryCount } +// ValidateRestartPolicy validates the given RestartPolicy. +func ValidateRestartPolicy(policy RestartPolicy) error { + switch policy.Name { + case RestartPolicyAlways, RestartPolicyUnlessStopped, RestartPolicyDisabled: + if policy.MaximumRetryCount != 0 { + msg := "invalid restart policy: maximum retry count can only be used with 'on-failure'" + if policy.MaximumRetryCount < 0 { + msg += " and cannot be negative" + } + return &errInvalidParameter{fmt.Errorf(msg)} + } + return nil + case RestartPolicyOnFailure: + if policy.MaximumRetryCount < 0 { + return &errInvalidParameter{fmt.Errorf("invalid restart policy: maximum retry count cannot be negative")} + } + return nil + case "": + // Versions before v25.0.0 created an empty restart-policy "name" as + // default. Allow an empty name with "any" MaximumRetryCount for + // backward-compatibility. + return nil + default: + return &errInvalidParameter{fmt.Errorf("invalid restart policy: unknown policy '%s'; use one of '%s', '%s', '%s', or '%s'", policy.Name, RestartPolicyDisabled, RestartPolicyAlways, RestartPolicyOnFailure, RestartPolicyUnlessStopped)} + } +} + // LogMode is a type to define the available modes for logging // These modes affect how logs are handled when log messages start piling up. type LogMode string diff --git a/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go b/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go index 24c4fa8d..42132923 100644 --- a/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go +++ b/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go @@ -1,8 +1,9 @@ //go:build !windows -// +build !windows package container // import "github.com/docker/docker/api/types/container" +import "github.com/docker/docker/api/types/network" + // IsValid indicates if an isolation technology is valid func (i Isolation) IsValid() bool { return i.IsDefault() @@ -11,15 +12,15 @@ func (i Isolation) IsValid() bool { // NetworkName returns the name of the network stack. func (n NetworkMode) NetworkName() string { if n.IsBridge() { - return "bridge" + return network.NetworkBridge } else if n.IsHost() { - return "host" + return network.NetworkHost } else if n.IsContainer() { return "container" } else if n.IsNone() { - return "none" + return network.NetworkNone } else if n.IsDefault() { - return "default" + return network.NetworkDefault } else if n.IsUserDefined() { return n.UserDefined() } @@ -28,12 +29,12 @@ func (n NetworkMode) NetworkName() string { // IsBridge indicates whether container uses the bridge network stack func (n NetworkMode) IsBridge() bool { - return n == "bridge" + return n == network.NetworkBridge } // IsHost indicates whether container uses the host network stack. func (n NetworkMode) IsHost() bool { - return n == "host" + return n == network.NetworkHost } // IsUserDefined indicates user-created network diff --git a/vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go b/vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go index 99f803a5..154667f4 100644 --- a/vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go +++ b/vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go @@ -1,9 +1,11 @@ package container // import "github.com/docker/docker/api/types/container" +import "github.com/docker/docker/api/types/network" + // IsBridge indicates whether container uses the bridge network stack // in windows it is given the name NAT func (n NetworkMode) IsBridge() bool { - return n == "nat" + return n == network.NetworkNat } // IsHost indicates whether container uses the host network stack. @@ -25,11 +27,11 @@ func (i Isolation) IsValid() bool { // NetworkName returns the name of the network stack. func (n NetworkMode) NetworkName() string { if n.IsDefault() { - return "default" + return network.NetworkDefault } else if n.IsBridge() { - return "nat" + return network.NetworkNat } else if n.IsNone() { - return "none" + return network.NetworkNone } else if n.IsContainer() { return "container" } else if n.IsUserDefined() { diff --git a/vendor/github.com/docker/docker/api/types/container/options.go b/vendor/github.com/docker/docker/api/types/container/options.go new file mode 100644 index 00000000..7a230057 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/container/options.go @@ -0,0 +1,67 @@ +package container + +import "github.com/docker/docker/api/types/filters" + +// ResizeOptions holds parameters to resize a TTY. +// It can be used to resize container TTYs and +// exec process TTYs too. +type ResizeOptions struct { + Height uint + Width uint +} + +// AttachOptions holds parameters to attach to a container. +type AttachOptions struct { + Stream bool + Stdin bool + Stdout bool + Stderr bool + DetachKeys string + Logs bool +} + +// CommitOptions holds parameters to commit changes into a container. +type CommitOptions struct { + Reference string + Comment string + Author string + Changes []string + Pause bool + Config *Config +} + +// RemoveOptions holds parameters to remove containers. +type RemoveOptions struct { + RemoveVolumes bool + RemoveLinks bool + Force bool +} + +// StartOptions holds parameters to start containers. +type StartOptions struct { + CheckpointID string + CheckpointDir string +} + +// ListOptions holds parameters to list containers with. +type ListOptions struct { + Size bool + All bool + Latest bool + Since string + Before string + Limit int + Filters filters.Args +} + +// LogsOptions holds parameters to filter logs with. +type LogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} diff --git a/vendor/github.com/docker/docker/api/types/events/events.go b/vendor/github.com/docker/docker/api/types/events/events.go index 9fe07e26..6dbcd922 100644 --- a/vendor/github.com/docker/docker/api/types/events/events.go +++ b/vendor/github.com/docker/docker/api/types/events/events.go @@ -1,7 +1,7 @@ package events // import "github.com/docker/docker/api/types/events" // Type is used for event-types. -type Type = string +type Type string // List of known event types. const ( @@ -18,6 +18,86 @@ const ( VolumeEventType Type = "volume" // VolumeEventType is the event type that volumes generate. ) +// Action is used for event-actions. +type Action string + +const ( + ActionCreate Action = "create" + ActionStart Action = "start" + ActionRestart Action = "restart" + ActionStop Action = "stop" + ActionCheckpoint Action = "checkpoint" + ActionPause Action = "pause" + ActionUnPause Action = "unpause" + ActionAttach Action = "attach" + ActionDetach Action = "detach" + ActionResize Action = "resize" + ActionUpdate Action = "update" + ActionRename Action = "rename" + ActionKill Action = "kill" + ActionDie Action = "die" + ActionOOM Action = "oom" + ActionDestroy Action = "destroy" + ActionRemove Action = "remove" + ActionCommit Action = "commit" + ActionTop Action = "top" + ActionCopy Action = "copy" + ActionArchivePath Action = "archive-path" + ActionExtractToDir Action = "extract-to-dir" + ActionExport Action = "export" + ActionImport Action = "import" + ActionSave Action = "save" + ActionLoad Action = "load" + ActionTag Action = "tag" + ActionUnTag Action = "untag" + ActionPush Action = "push" + ActionPull Action = "pull" + ActionPrune Action = "prune" + ActionDelete Action = "delete" + ActionEnable Action = "enable" + ActionDisable Action = "disable" + ActionConnect Action = "connect" + ActionDisconnect Action = "disconnect" + ActionReload Action = "reload" + ActionMount Action = "mount" + ActionUnmount Action = "unmount" + + // ActionExecCreate is the prefix used for exec_create events. These + // event-actions are commonly followed by a colon and space (": "), + // and the command that's defined for the exec, for example: + // + // exec_create: /bin/sh -c 'echo hello' + // + // This is far from ideal; it's a compromise to allow filtering and + // to preserve backward-compatibility. + ActionExecCreate Action = "exec_create" + // ActionExecStart is the prefix used for exec_create events. These + // event-actions are commonly followed by a colon and space (": "), + // and the command that's defined for the exec, for example: + // + // exec_start: /bin/sh -c 'echo hello' + // + // This is far from ideal; it's a compromise to allow filtering and + // to preserve backward-compatibility. + ActionExecStart Action = "exec_start" + ActionExecDie Action = "exec_die" + ActionExecDetach Action = "exec_detach" + + // ActionHealthStatus is the prefix to use for health_status events. + // + // Health-status events can either have a pre-defined status, in which + // case the "health_status" action is followed by a colon, or can be + // "free-form", in which case they're followed by the output of the + // health-check output. + // + // This is far form ideal, and a compromise to allow filtering, and + // to preserve backward-compatibility. + ActionHealthStatus Action = "health_status" + ActionHealthStatusRunning Action = "health_status: running" + ActionHealthStatusHealthy Action = "health_status: healthy" + ActionHealthStatusUnhealthy Action = "health_status: unhealthy" +) + // Actor describes something that generates events, // like a container, or a network, or a volume. // It has a defined name and a set of attributes. @@ -37,7 +117,7 @@ type Message struct { From string `json:"from,omitempty"` // Deprecated: use Actor.Attributes["image"] instead. Type Type - Action string + Action Action Actor Actor // Engine events are local scope. Cluster events are swarm scope. Scope string `json:"scope,omitempty"` diff --git a/vendor/github.com/docker/docker/api/types/image_delete_response_item.go b/vendor/github.com/docker/docker/api/types/image/delete_response.go similarity index 68% rename from vendor/github.com/docker/docker/api/types/image_delete_response_item.go rename to vendor/github.com/docker/docker/api/types/image/delete_response.go index b9a65a0d..998620dc 100644 --- a/vendor/github.com/docker/docker/api/types/image_delete_response_item.go +++ b/vendor/github.com/docker/docker/api/types/image/delete_response.go @@ -1,11 +1,11 @@ -package types +package image // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// ImageDeleteResponseItem image delete response item -// swagger:model ImageDeleteResponseItem -type ImageDeleteResponseItem struct { +// DeleteResponse delete response +// swagger:model DeleteResponse +type DeleteResponse struct { // The image ID of an image that was deleted Deleted string `json:"Deleted,omitempty"` diff --git a/vendor/github.com/docker/docker/api/types/image/image.go b/vendor/github.com/docker/docker/api/types/image/image.go new file mode 100644 index 00000000..167df28c --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/image/image.go @@ -0,0 +1,9 @@ +package image + +import "time" + +// Metadata contains engine-local data about the image. +type Metadata struct { + // LastTagTime is the date and time at which the image was last tagged. + LastTagTime time.Time `json:",omitempty"` +} diff --git a/vendor/github.com/docker/docker/api/types/image_summary.go b/vendor/github.com/docker/docker/api/types/image/summary.go similarity index 85% rename from vendor/github.com/docker/docker/api/types/image_summary.go rename to vendor/github.com/docker/docker/api/types/image/summary.go index 0f6f1448..f1e3e2ef 100644 --- a/vendor/github.com/docker/docker/api/types/image_summary.go +++ b/vendor/github.com/docker/docker/api/types/image/summary.go @@ -1,11 +1,11 @@ -package types +package image // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// ImageSummary image summary -// swagger:model ImageSummary -type ImageSummary struct { +// Summary summary +// swagger:model Summary +type Summary struct { // Number of containers using this image. Includes both stopped and running // containers. @@ -84,11 +84,6 @@ type ImageSummary struct { // Total size of the image including all layers it is composed of. // - // In versions of Docker before v1.10, this field was calculated from - // the image itself and all of its parent images. Images are now stored - // self-contained, and no longer use a parent-chain, making this field - // an equivalent of the Size field. - // - // Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44. + // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. VirtualSize int64 `json:"VirtualSize,omitempty"` } diff --git a/vendor/github.com/docker/docker/api/types/mount/mount.go b/vendor/github.com/docker/docker/api/types/mount/mount.go index ac4ce622..57edf2ef 100644 --- a/vendor/github.com/docker/docker/api/types/mount/mount.go +++ b/vendor/github.com/docker/docker/api/types/mount/mount.go @@ -29,7 +29,7 @@ type Mount struct { // Source is not supported for tmpfs (must be an empty value) Source string `json:",omitempty"` Target string `json:",omitempty"` - ReadOnly bool `json:",omitempty"` + ReadOnly bool `json:",omitempty"` // attempts recursive read-only if possible Consistency Consistency `json:",omitempty"` BindOptions *BindOptions `json:",omitempty"` @@ -85,6 +85,11 @@ type BindOptions struct { Propagation Propagation `json:",omitempty"` NonRecursive bool `json:",omitempty"` CreateMountpoint bool `json:",omitempty"` + // ReadOnlyNonRecursive makes the mount non-recursively read-only, but still leaves the mount recursive + // (unless NonRecursive is set to true in conjunction). + ReadOnlyNonRecursive bool `json:",omitempty"` + // ReadOnlyForceRecursive raises an error if the mount cannot be made recursively read-only. + ReadOnlyForceRecursive bool `json:",omitempty"` } // VolumeOptions represents the options for a mount of type volume. diff --git a/vendor/github.com/docker/docker/api/types/network/endpoint.go b/vendor/github.com/docker/docker/api/types/network/endpoint.go new file mode 100644 index 00000000..9edd1c38 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/network/endpoint.go @@ -0,0 +1,147 @@ +package network + +import ( + "errors" + "fmt" + "net" + + "github.com/docker/docker/internal/multierror" +) + +// EndpointSettings stores the network endpoint details +type EndpointSettings struct { + // Configurations + IPAMConfig *EndpointIPAMConfig + Links []string + Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint. + // MacAddress may be used to specify a MAC address when the container is created. + // Once the container is running, it becomes operational data (it may contain a + // generated address). + MacAddress string + // Operational data + NetworkID string + EndpointID string + Gateway string + IPAddress string + IPPrefixLen int + IPv6Gateway string + GlobalIPv6Address string + GlobalIPv6PrefixLen int + DriverOpts map[string]string + // DNSNames holds all the (non fully qualified) DNS names associated to this endpoint. First entry is used to + // generate PTR records. + DNSNames []string +} + +// Copy makes a deep copy of `EndpointSettings` +func (es *EndpointSettings) Copy() *EndpointSettings { + epCopy := *es + if es.IPAMConfig != nil { + epCopy.IPAMConfig = es.IPAMConfig.Copy() + } + + if es.Links != nil { + links := make([]string, 0, len(es.Links)) + epCopy.Links = append(links, es.Links...) + } + + if es.Aliases != nil { + aliases := make([]string, 0, len(es.Aliases)) + epCopy.Aliases = append(aliases, es.Aliases...) + } + + if len(es.DNSNames) > 0 { + epCopy.DNSNames = make([]string, len(es.DNSNames)) + copy(epCopy.DNSNames, es.DNSNames) + } + + return &epCopy +} + +// EndpointIPAMConfig represents IPAM configurations for the endpoint +type EndpointIPAMConfig struct { + IPv4Address string `json:",omitempty"` + IPv6Address string `json:",omitempty"` + LinkLocalIPs []string `json:",omitempty"` +} + +// Copy makes a copy of the endpoint ipam config +func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig { + cfgCopy := *cfg + cfgCopy.LinkLocalIPs = make([]string, 0, len(cfg.LinkLocalIPs)) + cfgCopy.LinkLocalIPs = append(cfgCopy.LinkLocalIPs, cfg.LinkLocalIPs...) + return &cfgCopy +} + +// NetworkSubnet describes a user-defined subnet for a specific network. It's only used to validate if an +// EndpointIPAMConfig is valid for a specific network. +type NetworkSubnet interface { + // Contains checks whether the NetworkSubnet contains [addr]. + Contains(addr net.IP) bool + // IsStatic checks whether the subnet was statically allocated (ie. user-defined). + IsStatic() bool +} + +// IsInRange checks whether static IP addresses are valid in a specific network. +func (cfg *EndpointIPAMConfig) IsInRange(v4Subnets []NetworkSubnet, v6Subnets []NetworkSubnet) error { + var errs []error + + if err := validateEndpointIPAddress(cfg.IPv4Address, v4Subnets); err != nil { + errs = append(errs, err) + } + if err := validateEndpointIPAddress(cfg.IPv6Address, v6Subnets); err != nil { + errs = append(errs, err) + } + + return multierror.Join(errs...) +} + +func validateEndpointIPAddress(epAddr string, ipamSubnets []NetworkSubnet) error { + if epAddr == "" { + return nil + } + + var staticSubnet bool + parsedAddr := net.ParseIP(epAddr) + for _, subnet := range ipamSubnets { + if subnet.IsStatic() { + staticSubnet = true + if subnet.Contains(parsedAddr) { + return nil + } + } + } + + if staticSubnet { + return fmt.Errorf("no configured subnet or ip-range contain the IP address %s", epAddr) + } + + return errors.New("user specified IP address is supported only when connecting to networks with user configured subnets") +} + +// Validate checks whether cfg is valid. +func (cfg *EndpointIPAMConfig) Validate() error { + if cfg == nil { + return nil + } + + var errs []error + + if cfg.IPv4Address != "" { + if addr := net.ParseIP(cfg.IPv4Address); addr == nil || addr.To4() == nil || addr.IsUnspecified() { + errs = append(errs, fmt.Errorf("invalid IPv4 address: %s", cfg.IPv4Address)) + } + } + if cfg.IPv6Address != "" { + if addr := net.ParseIP(cfg.IPv6Address); addr == nil || addr.To4() != nil || addr.IsUnspecified() { + errs = append(errs, fmt.Errorf("invalid IPv6 address: %s", cfg.IPv6Address)) + } + } + for _, addr := range cfg.LinkLocalIPs { + if parsed := net.ParseIP(addr); parsed == nil || parsed.IsUnspecified() { + errs = append(errs, fmt.Errorf("invalid link-local IP address: %s", addr)) + } + } + + return multierror.Join(errs...) +} diff --git a/vendor/github.com/docker/docker/api/types/network/ipam.go b/vendor/github.com/docker/docker/api/types/network/ipam.go new file mode 100644 index 00000000..f319e140 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/network/ipam.go @@ -0,0 +1,134 @@ +package network + +import ( + "errors" + "fmt" + "net/netip" + + "github.com/docker/docker/internal/multierror" +) + +// IPAM represents IP Address Management +type IPAM struct { + Driver string + Options map[string]string // Per network IPAM driver options + Config []IPAMConfig +} + +// IPAMConfig represents IPAM configurations +type IPAMConfig struct { + Subnet string `json:",omitempty"` + IPRange string `json:",omitempty"` + Gateway string `json:",omitempty"` + AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` +} + +type ipFamily string + +const ( + ip4 ipFamily = "IPv4" + ip6 ipFamily = "IPv6" +) + +// ValidateIPAM checks whether the network's IPAM passed as argument is valid. It returns a joinError of the list of +// errors found. +func ValidateIPAM(ipam *IPAM, enableIPv6 bool) error { + if ipam == nil { + return nil + } + + var errs []error + for _, cfg := range ipam.Config { + subnet, err := netip.ParsePrefix(cfg.Subnet) + if err != nil { + errs = append(errs, fmt.Errorf("invalid subnet %s: invalid CIDR block notation", cfg.Subnet)) + continue + } + subnetFamily := ip4 + if subnet.Addr().Is6() { + subnetFamily = ip6 + } + + if !enableIPv6 && subnetFamily == ip6 { + continue + } + + if subnet != subnet.Masked() { + errs = append(errs, fmt.Errorf("invalid subnet %s: it should be %s", subnet, subnet.Masked())) + } + + if ipRangeErrs := validateIPRange(cfg.IPRange, subnet, subnetFamily); len(ipRangeErrs) > 0 { + errs = append(errs, ipRangeErrs...) + } + + if err := validateAddress(cfg.Gateway, subnet, subnetFamily); err != nil { + errs = append(errs, fmt.Errorf("invalid gateway %s: %w", cfg.Gateway, err)) + } + + for auxName, aux := range cfg.AuxAddress { + if err := validateAddress(aux, subnet, subnetFamily); err != nil { + errs = append(errs, fmt.Errorf("invalid auxiliary address %s: %w", auxName, err)) + } + } + } + + if err := multierror.Join(errs...); err != nil { + return fmt.Errorf("invalid network config:\n%w", err) + } + + return nil +} + +func validateIPRange(ipRange string, subnet netip.Prefix, subnetFamily ipFamily) []error { + if ipRange == "" { + return nil + } + prefix, err := netip.ParsePrefix(ipRange) + if err != nil { + return []error{fmt.Errorf("invalid ip-range %s: invalid CIDR block notation", ipRange)} + } + family := ip4 + if prefix.Addr().Is6() { + family = ip6 + } + + if family != subnetFamily { + return []error{fmt.Errorf("invalid ip-range %s: parent subnet is an %s block", ipRange, subnetFamily)} + } + + var errs []error + if prefix.Bits() < subnet.Bits() { + errs = append(errs, fmt.Errorf("invalid ip-range %s: CIDR block is bigger than its parent subnet %s", ipRange, subnet)) + } + if prefix != prefix.Masked() { + errs = append(errs, fmt.Errorf("invalid ip-range %s: it should be %s", prefix, prefix.Masked())) + } + if !subnet.Overlaps(prefix) { + errs = append(errs, fmt.Errorf("invalid ip-range %s: parent subnet %s doesn't contain ip-range", ipRange, subnet)) + } + + return errs +} + +func validateAddress(address string, subnet netip.Prefix, subnetFamily ipFamily) error { + if address == "" { + return nil + } + addr, err := netip.ParseAddr(address) + if err != nil { + return errors.New("invalid address") + } + family := ip4 + if addr.Is6() { + family = ip6 + } + + if family != subnetFamily { + return fmt.Errorf("parent subnet is an %s block", subnetFamily) + } + if !subnet.Contains(addr) { + return fmt.Errorf("parent subnet %s doesn't contain this address", subnet) + } + + return nil +} diff --git a/vendor/github.com/docker/docker/api/types/network/network.go b/vendor/github.com/docker/docker/api/types/network/network.go index 437b184c..f1f300f3 100644 --- a/vendor/github.com/docker/docker/api/types/network/network.go +++ b/vendor/github.com/docker/docker/api/types/network/network.go @@ -1,69 +1,34 @@ package network // import "github.com/docker/docker/api/types/network" + import ( "github.com/docker/docker/api/types/filters" ) +const ( + // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. + NetworkDefault = "default" + // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) + NetworkHost = "host" + // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) + NetworkNone = "none" + // NetworkBridge is the name of the default network on Linux + NetworkBridge = "bridge" + // NetworkNat is the name of the default network on Windows + NetworkNat = "nat" +) + // Address represents an IP address type Address struct { Addr string PrefixLen int } -// IPAM represents IP Address Management -type IPAM struct { - Driver string - Options map[string]string // Per network IPAM driver options - Config []IPAMConfig -} - -// IPAMConfig represents IPAM configurations -type IPAMConfig struct { - Subnet string `json:",omitempty"` - IPRange string `json:",omitempty"` - Gateway string `json:",omitempty"` - AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` -} - -// EndpointIPAMConfig represents IPAM configurations for the endpoint -type EndpointIPAMConfig struct { - IPv4Address string `json:",omitempty"` - IPv6Address string `json:",omitempty"` - LinkLocalIPs []string `json:",omitempty"` -} - -// Copy makes a copy of the endpoint ipam config -func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig { - cfgCopy := *cfg - cfgCopy.LinkLocalIPs = make([]string, 0, len(cfg.LinkLocalIPs)) - cfgCopy.LinkLocalIPs = append(cfgCopy.LinkLocalIPs, cfg.LinkLocalIPs...) - return &cfgCopy -} - // PeerInfo represents one peer of an overlay network type PeerInfo struct { Name string IP string } -// EndpointSettings stores the network endpoint details -type EndpointSettings struct { - // Configurations - IPAMConfig *EndpointIPAMConfig - Links []string - Aliases []string - // Operational data - NetworkID string - EndpointID string - Gateway string - IPAddress string - IPPrefixLen int - IPv6Gateway string - GlobalIPv6Address string - GlobalIPv6PrefixLen int - MacAddress string - DriverOpts map[string]string -} - // Task carries the information about one backend task type Task struct { Name string @@ -80,25 +45,6 @@ type ServiceInfo struct { Tasks []Task } -// Copy makes a deep copy of `EndpointSettings` -func (es *EndpointSettings) Copy() *EndpointSettings { - epCopy := *es - if es.IPAMConfig != nil { - epCopy.IPAMConfig = es.IPAMConfig.Copy() - } - - if es.Links != nil { - links := make([]string, 0, len(es.Links)) - epCopy.Links = append(links, es.Links...) - } - - if es.Aliases != nil { - aliases := make([]string, 0, len(es.Aliases)) - epCopy.Aliases = append(aliases, es.Aliases...) - } - return &epCopy -} - // NetworkingConfig represents the container's networking configuration for each of its interfaces // Carries the networking configs specified in the `docker run` and `docker network connect` commands type NetworkingConfig struct { diff --git a/vendor/github.com/docker/docker/api/types/registry/registry.go b/vendor/github.com/docker/docker/api/types/registry/registry.go index b83f5d7b..05cb3107 100644 --- a/vendor/github.com/docker/docker/api/types/registry/registry.go +++ b/vendor/github.com/docker/docker/api/types/registry/registry.go @@ -92,7 +92,9 @@ type SearchResult struct { IsOfficial bool `json:"is_official"` // Name is the name of the repository Name string `json:"name"` - // IsAutomated indicates whether the result is automated + // IsAutomated indicates whether the result is automated. + // + // Deprecated: the "is_automated" field is deprecated and will always be "false" in the future. IsAutomated bool `json:"is_automated"` // Description is a textual description of the repository Description string `json:"description"` diff --git a/vendor/github.com/docker/docker/api/types/swarm/container.go b/vendor/github.com/docker/docker/api/types/swarm/container.go index af5e1c0b..65f61d2d 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/container.go +++ b/vendor/github.com/docker/docker/api/types/swarm/container.go @@ -32,6 +32,42 @@ type SELinuxContext struct { Level string } +// SeccompMode is the type used for the enumeration of possible seccomp modes +// in SeccompOpts +type SeccompMode string + +const ( + SeccompModeDefault SeccompMode = "default" + SeccompModeUnconfined SeccompMode = "unconfined" + SeccompModeCustom SeccompMode = "custom" +) + +// SeccompOpts defines the options for configuring seccomp on a swarm-managed +// container. +type SeccompOpts struct { + // Mode is the SeccompMode used for the container. + Mode SeccompMode `json:",omitempty"` + // Profile is the custom seccomp profile as a json object to be used with + // the container. Mode should be set to SeccompModeCustom when using a + // custom profile in this manner. + Profile []byte `json:",omitempty"` +} + +// AppArmorMode is type used for the enumeration of possible AppArmor modes in +// AppArmorOpts +type AppArmorMode string + +const ( + AppArmorModeDefault AppArmorMode = "default" + AppArmorModeDisabled AppArmorMode = "disabled" +) + +// AppArmorOpts defines the options for configuring AppArmor on a swarm-managed +// container. Currently, custom AppArmor profiles are not supported. +type AppArmorOpts struct { + Mode AppArmorMode `json:",omitempty"` +} + // CredentialSpec for managed service account (Windows only) type CredentialSpec struct { Config string @@ -41,8 +77,11 @@ type CredentialSpec struct { // Privileges defines the security options for the container. type Privileges struct { - CredentialSpec *CredentialSpec - SELinuxContext *SELinuxContext + CredentialSpec *CredentialSpec + SELinuxContext *SELinuxContext + Seccomp *SeccompOpts `json:",omitempty"` + AppArmor *AppArmorOpts `json:",omitempty"` + NoNewPrivileges bool } // ContainerSpec represents the spec of a container. diff --git a/vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go b/vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go index 98c2806c..292bd7af 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go +++ b/vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go @@ -1,3 +1,3 @@ -//go:generate protoc -I . --gogofast_out=import_path=github.com/docker/docker/api/types/swarm/runtime:. plugin.proto +//go:generate protoc --gogofaster_out=import_path=github.com/docker/docker/api/types/swarm/runtime:. plugin.proto package runtime // import "github.com/docker/docker/api/types/swarm/runtime" diff --git a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go index e4504586..32aaf0d5 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go +++ b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go @@ -1,23 +1,15 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: plugin.proto -/* - Package runtime is a generated protocol buffer package. - - It is generated from these files: - plugin.proto - - It has these top-level messages: - PluginSpec - PluginPrivilege -*/ package runtime -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -28,22 +20,50 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // PluginSpec defines the base payload which clients can specify for creating // a service with the plugin runtime. type PluginSpec struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Remote string `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"` - Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges" json:"privileges,omitempty"` + Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges,proto3" json:"privileges,omitempty"` Disabled bool `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"` - Env []string `protobuf:"bytes,5,rep,name=env" json:"env,omitempty"` + Env []string `protobuf:"bytes,5,rep,name=env,proto3" json:"env,omitempty"` +} + +func (m *PluginSpec) Reset() { *m = PluginSpec{} } +func (m *PluginSpec) String() string { return proto.CompactTextString(m) } +func (*PluginSpec) ProtoMessage() {} +func (*PluginSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_22a625af4bc1cc87, []int{0} +} +func (m *PluginSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PluginSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PluginSpec.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PluginSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_PluginSpec.Merge(m, src) +} +func (m *PluginSpec) XXX_Size() int { + return m.Size() +} +func (m *PluginSpec) XXX_DiscardUnknown() { + xxx_messageInfo_PluginSpec.DiscardUnknown(m) } -func (m *PluginSpec) Reset() { *m = PluginSpec{} } -func (m *PluginSpec) String() string { return proto.CompactTextString(m) } -func (*PluginSpec) ProtoMessage() {} -func (*PluginSpec) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{0} } +var xxx_messageInfo_PluginSpec proto.InternalMessageInfo func (m *PluginSpec) GetName() string { if m != nil { @@ -85,13 +105,41 @@ func (m *PluginSpec) GetEnv() []string { type PluginPrivilege struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Value []string `protobuf:"bytes,3,rep,name=value" json:"value,omitempty"` + Value []string `protobuf:"bytes,3,rep,name=value,proto3" json:"value,omitempty"` } -func (m *PluginPrivilege) Reset() { *m = PluginPrivilege{} } -func (m *PluginPrivilege) String() string { return proto.CompactTextString(m) } -func (*PluginPrivilege) ProtoMessage() {} -func (*PluginPrivilege) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{1} } +func (m *PluginPrivilege) Reset() { *m = PluginPrivilege{} } +func (m *PluginPrivilege) String() string { return proto.CompactTextString(m) } +func (*PluginPrivilege) ProtoMessage() {} +func (*PluginPrivilege) Descriptor() ([]byte, []int) { + return fileDescriptor_22a625af4bc1cc87, []int{1} +} +func (m *PluginPrivilege) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PluginPrivilege) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PluginPrivilege.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PluginPrivilege) XXX_Merge(src proto.Message) { + xxx_messageInfo_PluginPrivilege.Merge(m, src) +} +func (m *PluginPrivilege) XXX_Size() int { + return m.Size() +} +func (m *PluginPrivilege) XXX_DiscardUnknown() { + xxx_messageInfo_PluginPrivilege.DiscardUnknown(m) +} + +var xxx_messageInfo_PluginPrivilege proto.InternalMessageInfo func (m *PluginPrivilege) GetName() string { if m != nil { @@ -118,10 +166,32 @@ func init() { proto.RegisterType((*PluginSpec)(nil), "PluginSpec") proto.RegisterType((*PluginPrivilege)(nil), "PluginPrivilege") } + +func init() { proto.RegisterFile("plugin.proto", fileDescriptor_22a625af4bc1cc87) } + +var fileDescriptor_22a625af4bc1cc87 = []byte{ + // 225 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0xc8, 0x29, 0x4d, + 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x9a, 0xc1, 0xc8, 0xc5, 0x15, 0x00, 0x16, + 0x08, 0x2e, 0x48, 0x4d, 0x16, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, + 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0xc4, 0xb8, 0xd8, 0x8a, 0x52, 0x73, 0xf3, 0x4b, 0x52, 0x25, + 0x98, 0xc0, 0xa2, 0x50, 0x9e, 0x90, 0x01, 0x17, 0x57, 0x41, 0x51, 0x66, 0x59, 0x66, 0x4e, 0x6a, + 0x7a, 0x6a, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x80, 0x1e, 0xc4, 0xb0, 0x00, 0x98, + 0x44, 0x10, 0x92, 0x1a, 0x21, 0x29, 0x2e, 0x8e, 0x94, 0xcc, 0xe2, 0xc4, 0xa4, 0x9c, 0xd4, 0x14, + 0x09, 0x16, 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x38, 0x5f, 0x48, 0x80, 0x8b, 0x39, 0x35, 0xaf, 0x4c, + 0x82, 0x55, 0x81, 0x59, 0x83, 0x33, 0x08, 0xc4, 0x54, 0x8a, 0xe5, 0xe2, 0x47, 0x33, 0x0c, 0xab, + 0xf3, 0x14, 0xb8, 0xb8, 0x53, 0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0xa0, + 0x6e, 0x44, 0x16, 0x12, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xbb, 0x91, 0x33, + 0x08, 0xc2, 0x71, 0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, + 0x70, 0xd0, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xea, 0xe2, 0xca, 0x2a, 0x01, 0x00, + 0x00, +} + func (m *PluginSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -129,66 +199,69 @@ func (m *PluginSpec) Marshal() (dAtA []byte, err error) { } func (m *PluginSpec) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PluginSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Remote) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Remote))) - i += copy(dAtA[i:], m.Remote) - } - if len(m.Privileges) > 0 { - for _, msg := range m.Privileges { - dAtA[i] = 0x1a - i++ - i = encodeVarintPlugin(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if len(m.Env) > 0 { + for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Env[iNdEx]) + copy(dAtA[i:], m.Env[iNdEx]) + i = encodeVarintPlugin(dAtA, i, uint64(len(m.Env[iNdEx]))) + i-- + dAtA[i] = 0x2a } } if m.Disabled { - dAtA[i] = 0x20 - i++ + i-- if m.Disabled { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 } - if len(m.Env) > 0 { - for _, s := range m.Env { - dAtA[i] = 0x2a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) + if len(m.Privileges) > 0 { + for iNdEx := len(m.Privileges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Privileges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPlugin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } } - return i, nil + if len(m.Remote) > 0 { + i -= len(m.Remote) + copy(dAtA[i:], m.Remote) + i = encodeVarintPlugin(dAtA, i, uint64(len(m.Remote))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *PluginPrivilege) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -196,50 +269,56 @@ func (m *PluginPrivilege) Marshal() (dAtA []byte, err error) { } func (m *PluginPrivilege) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PluginPrivilege) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Value[iNdEx]) + copy(dAtA[i:], m.Value[iNdEx]) + i = encodeVarintPlugin(dAtA, i, uint64(len(m.Value[iNdEx]))) + i-- + dAtA[i] = 0x1a + } } if len(m.Description) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Description) + copy(dAtA[i:], m.Description) i = encodeVarintPlugin(dAtA, i, uint64(len(m.Description))) - i += copy(dAtA[i:], m.Description) + i-- + dAtA[i] = 0x12 } - if len(m.Value) > 0 { - for _, s := range m.Value { - dAtA[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintPlugin(dAtA []byte, offset int, v uint64) int { + offset -= sovPlugin(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *PluginSpec) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -269,6 +348,9 @@ func (m *PluginSpec) Size() (n int) { } func (m *PluginPrivilege) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -289,14 +371,7 @@ func (m *PluginPrivilege) Size() (n int) { } func sovPlugin(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozPlugin(x uint64) (n int) { return sovPlugin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -316,7 +391,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -344,7 +419,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -354,6 +429,9 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -373,7 +451,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -383,6 +461,9 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -402,7 +483,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -411,6 +492,9 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -433,7 +517,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -453,7 +537,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -463,6 +547,9 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -474,7 +561,7 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPlugin } if (iNdEx + skippy) > l { @@ -504,7 +591,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -532,7 +619,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -542,6 +629,9 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -561,7 +651,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -571,6 +661,9 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -590,7 +683,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -600,6 +693,9 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { return ErrInvalidLengthPlugin } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPlugin + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -611,7 +707,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPlugin } if (iNdEx + skippy) > l { @@ -629,6 +725,7 @@ func (m *PluginPrivilege) Unmarshal(dAtA []byte) error { func skipPlugin(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -660,10 +757,8 @@ func skipPlugin(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -680,75 +775,34 @@ func skipPlugin(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthPlugin } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlugin - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipPlugin(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPlugin + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthPlugin + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthPlugin = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPlugin = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthPlugin = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPlugin = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPlugin = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("plugin.proto", fileDescriptorPlugin) } - -var fileDescriptorPlugin = []byte{ - // 256 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4d, 0x4b, 0xc3, 0x30, - 0x18, 0xc7, 0x89, 0xdd, 0xc6, 0xfa, 0x4c, 0x70, 0x04, 0x91, 0xe2, 0xa1, 0x94, 0x9d, 0x7a, 0x6a, - 0x45, 0x2f, 0x82, 0x37, 0x0f, 0x9e, 0x47, 0xbc, 0x09, 0x1e, 0xd2, 0xf6, 0xa1, 0x06, 0x9b, 0x17, - 0x92, 0xb4, 0xe2, 0x37, 0xf1, 0x23, 0x79, 0xf4, 0x23, 0x48, 0x3f, 0x89, 0x98, 0x75, 0x32, 0x64, - 0xa7, 0xff, 0x4b, 0xc2, 0x9f, 0x1f, 0x0f, 0x9c, 0x9a, 0xae, 0x6f, 0x85, 0x2a, 0x8c, 0xd5, 0x5e, - 0x6f, 0x3e, 0x08, 0xc0, 0x36, 0x14, 0x8f, 0x06, 0x6b, 0x4a, 0x61, 0xa6, 0xb8, 0xc4, 0x84, 0x64, - 0x24, 0x8f, 0x59, 0xf0, 0xf4, 0x02, 0x16, 0x16, 0xa5, 0xf6, 0x98, 0x9c, 0x84, 0x76, 0x4a, 0xf4, - 0x0a, 0xc0, 0x58, 0x31, 0x88, 0x0e, 0x5b, 0x74, 0x49, 0x94, 0x45, 0xf9, 0xea, 0x7a, 0x5d, 0xec, - 0xc6, 0xb6, 0xfb, 0x07, 0x76, 0xf0, 0x87, 0x5e, 0xc2, 0xb2, 0x11, 0x8e, 0x57, 0x1d, 0x36, 0xc9, - 0x2c, 0x23, 0xf9, 0x92, 0xfd, 0x65, 0xba, 0x86, 0x08, 0xd5, 0x90, 0xcc, 0xb3, 0x28, 0x8f, 0xd9, - 0xaf, 0xdd, 0x3c, 0xc3, 0xd9, 0xbf, 0xb1, 0xa3, 0x78, 0x19, 0xac, 0x1a, 0x74, 0xb5, 0x15, 0xc6, - 0x0b, 0xad, 0x26, 0xc6, 0xc3, 0x8a, 0x9e, 0xc3, 0x7c, 0xe0, 0x5d, 0x8f, 0x81, 0x31, 0x66, 0xbb, - 0x70, 0xff, 0xf0, 0x39, 0xa6, 0xe4, 0x6b, 0x4c, 0xc9, 0xf7, 0x98, 0x92, 0xa7, 0xdb, 0x56, 0xf8, - 0x97, 0xbe, 0x2a, 0x6a, 0x2d, 0xcb, 0x46, 0xd7, 0xaf, 0x68, 0xf7, 0xc2, 0x8d, 0x28, 0xfd, 0xbb, - 0x41, 0x57, 0xba, 0x37, 0x6e, 0x65, 0x69, 0x7b, 0xe5, 0x85, 0xc4, 0xbb, 0x49, 0xab, 0x45, 0x38, - 0xe4, 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xa8, 0xd9, 0x9b, 0x58, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto index 9ef16904..e311b36b 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto +++ b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto @@ -1,7 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/docker/docker/api/types/swarm/runtime;runtime"; - // PluginSpec defines the base payload which clients can specify for creating // a service with the plugin runtime. message PluginSpec { diff --git a/vendor/github.com/docker/docker/api/types/swarm/service.go b/vendor/github.com/docker/docker/api/types/swarm/service.go index 6eb452d2..5b6d5ec1 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/service.go +++ b/vendor/github.com/docker/docker/api/types/swarm/service.go @@ -34,9 +34,9 @@ type ServiceSpec struct { UpdateConfig *UpdateConfig `json:",omitempty"` RollbackConfig *UpdateConfig `json:",omitempty"` - // Networks field in ServiceSpec is deprecated. The - // same field in TaskSpec should be used instead. - // This field will be removed in a future release. + // Networks specifies which networks the service should attach to. + // + // Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec should be used instead. Networks []NetworkAttachmentConfig `json:",omitempty"` EndpointSpec *EndpointSpec `json:",omitempty"` } diff --git a/vendor/github.com/docker/docker/api/types/swarm/service_create_response.go b/vendor/github.com/docker/docker/api/types/swarm/service_create_response.go new file mode 100644 index 00000000..9a268ff1 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/swarm/service_create_response.go @@ -0,0 +1,20 @@ +package swarm + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// ServiceCreateResponse contains the information returned to a client on the +// creation of a new service. +// +// swagger:model ServiceCreateResponse +type ServiceCreateResponse struct { + + // The ID of the created service. + ID string `json:"ID,omitempty"` + + // Optional warning message. + // + // FIXME(thaJeztah): this should have "omitempty" in the generated type. + // + Warnings []string `json:"Warnings"` +} diff --git a/vendor/github.com/docker/docker/api/types/service_update_response.go b/vendor/github.com/docker/docker/api/types/swarm/service_update_response.go similarity index 95% rename from vendor/github.com/docker/docker/api/types/service_update_response.go rename to vendor/github.com/docker/docker/api/types/swarm/service_update_response.go index 74ea64b1..0417467d 100644 --- a/vendor/github.com/docker/docker/api/types/service_update_response.go +++ b/vendor/github.com/docker/docker/api/types/swarm/service_update_response.go @@ -1,4 +1,4 @@ -package types +package swarm // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/vendor/github.com/docker/docker/api/types/system/info.go b/vendor/github.com/docker/docker/api/types/system/info.go new file mode 100644 index 00000000..89d4a009 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/system/info.go @@ -0,0 +1,116 @@ +package system + +import ( + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/registry" + "github.com/docker/docker/api/types/swarm" +) + +// Info contains response of Engine API: +// GET "/info" +type Info struct { + ID string + Containers int + ContainersRunning int + ContainersPaused int + ContainersStopped int + Images int + Driver string + DriverStatus [][2]string + SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API + Plugins PluginsInfo + MemoryLimit bool + SwapLimit bool + KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes + KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2. + CPUCfsPeriod bool `json:"CpuCfsPeriod"` + CPUCfsQuota bool `json:"CpuCfsQuota"` + CPUShares bool + CPUSet bool + PidsLimit bool + IPv4Forwarding bool + BridgeNfIptables bool + BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` + Debug bool + NFd int + OomKillDisable bool + NGoroutines int + SystemTime string + LoggingDriver string + CgroupDriver string + CgroupVersion string `json:",omitempty"` + NEventsListener int + KernelVersion string + OperatingSystem string + OSVersion string + OSType string + Architecture string + IndexServerAddress string + RegistryConfig *registry.ServiceConfig + NCPU int + MemTotal int64 + GenericResources []swarm.GenericResource + DockerRootDir string + HTTPProxy string `json:"HttpProxy"` + HTTPSProxy string `json:"HttpsProxy"` + NoProxy string + Name string + Labels []string + ExperimentalBuild bool + ServerVersion string + Runtimes map[string]RuntimeWithStatus + DefaultRuntime string + Swarm swarm.Info + // LiveRestoreEnabled determines whether containers should be kept + // running when the daemon is shutdown or upon daemon start if + // running containers are detected + LiveRestoreEnabled bool + Isolation container.Isolation + InitBinary string + ContainerdCommit Commit + RuncCommit Commit + InitCommit Commit + SecurityOptions []string + ProductLicense string `json:",omitempty"` + DefaultAddressPools []NetworkAddressPool `json:",omitempty"` + CDISpecDirs []string + + // Legacy API fields for older API versions. + legacyFields + + // Warnings contains a slice of warnings that occurred while collecting + // system information. These warnings are intended to be informational + // messages for the user, and are not intended to be parsed / used for + // other purposes, as they do not have a fixed format. + Warnings []string +} + +type legacyFields struct { + ExecutionDriver string `json:",omitempty"` // Deprecated: deprecated since API v1.25, but returned for older versions. +} + +// PluginsInfo is a temp struct holding Plugins name +// registered with docker daemon. It is used by [Info] struct +type PluginsInfo struct { + // List of Volume plugins registered + Volume []string + // List of Network plugins registered + Network []string + // List of Authorization plugins registered + Authorization []string + // List of Log plugins registered + Log []string +} + +// Commit holds the Git-commit (SHA1) that a binary was built from, as reported +// in the version-string of external tools, such as containerd, or runC. +type Commit struct { + ID string // ID is the actual commit ID of external tool. + Expected string // Expected is the commit ID of external tool expected by dockerd as set at build time. +} + +// NetworkAddressPool is a temp struct used by [Info] struct. +type NetworkAddressPool struct { + Base string + Size int +} diff --git a/vendor/github.com/docker/docker/api/types/system/runtime.go b/vendor/github.com/docker/docker/api/types/system/runtime.go new file mode 100644 index 00000000..d077295a --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/system/runtime.go @@ -0,0 +1,20 @@ +package system + +// Runtime describes an OCI runtime +type Runtime struct { + // "Legacy" runtime configuration for runc-compatible runtimes. + + Path string `json:"path,omitempty"` + Args []string `json:"runtimeArgs,omitempty"` + + // Shimv2 runtime configuration. Mutually exclusive with the legacy config above. + + Type string `json:"runtimeType,omitempty"` + Options map[string]interface{} `json:"options,omitempty"` +} + +// RuntimeWithStatus extends [Runtime] to hold [RuntimeStatus]. +type RuntimeWithStatus struct { + Runtime + Status map[string]string `json:"status,omitempty"` +} diff --git a/vendor/github.com/docker/docker/api/types/system/security_opts.go b/vendor/github.com/docker/docker/api/types/system/security_opts.go new file mode 100644 index 00000000..edff3eb1 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/system/security_opts.go @@ -0,0 +1,48 @@ +package system + +import ( + "errors" + "fmt" + "strings" +) + +// SecurityOpt contains the name and options of a security option +type SecurityOpt struct { + Name string + Options []KeyValue +} + +// DecodeSecurityOptions decodes a security options string slice to a +// type-safe [SecurityOpt]. +func DecodeSecurityOptions(opts []string) ([]SecurityOpt, error) { + so := []SecurityOpt{} + for _, opt := range opts { + // support output from a < 1.13 docker daemon + if !strings.Contains(opt, "=") { + so = append(so, SecurityOpt{Name: opt}) + continue + } + secopt := SecurityOpt{} + for _, s := range strings.Split(opt, ",") { + k, v, ok := strings.Cut(s, "=") + if !ok { + return nil, fmt.Errorf("invalid security option %q", s) + } + if k == "" || v == "" { + return nil, errors.New("invalid empty security option") + } + if k == "name" { + secopt.Name = v + continue + } + secopt.Options = append(secopt.Options, KeyValue{Key: k, Value: v}) + } + so = append(so, secopt) + } + return so, nil +} + +// KeyValue holds a key/value pair. +type KeyValue struct { + Key, Value string +} diff --git a/vendor/github.com/docker/docker/api/types/types.go b/vendor/github.com/docker/docker/api/types/types.go index b413e020..56a8b77d 100644 --- a/vendor/github.com/docker/docker/api/types/types.go +++ b/vendor/github.com/docker/docker/api/types/types.go @@ -1,18 +1,15 @@ package types // import "github.com/docker/docker/api/types" import ( - "errors" - "fmt" "io" "os" - "strings" "time" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/volume" "github.com/docker/go-connections/nat" @@ -75,11 +72,16 @@ type ImageInspect struct { // Created is the date and time at which the image was created, formatted in // RFC 3339 nano-seconds (time.RFC3339Nano). - Created string + // + // This information is only available if present in the image, + // and omitted otherwise. + Created string `json:",omitempty"` // Container is the ID of the container that was used to create the image. // // Depending on how the image was created, this field may be empty. + // + // Deprecated: this field is omitted in API v1.45, but kept for backward compatibility. Container string // ContainerConfig is an optional field containing the configuration of the @@ -87,6 +89,8 @@ type ImageInspect struct { // // Previous versions of Docker builder used this field to store build cache, // and it is not in active use anymore. + // + // Deprecated: this field is omitted in API v1.45, but kept for backward compatibility. ContainerConfig *container.Config // DockerVersion is the version of Docker that was used to build the image. @@ -118,12 +122,7 @@ type ImageInspect struct { // VirtualSize is the total size of the image including all layers it is // composed of. // - // In versions of Docker before v1.10, this field was calculated from - // the image itself and all of its parent images. Docker v1.10 and up - // store images self-contained, and no longer use a parent-chain, making - // this field an equivalent of the Size field. - // - // Deprecated: Unused in API 1.43 and up, but kept for backward compatibility with older API versions. + // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. VirtualSize int64 `json:"VirtualSize,omitempty"` // GraphDriver holds information about the storage driver used to store the @@ -137,13 +136,7 @@ type ImageInspect struct { // Metadata of the image in the local cache. // // This information is local to the daemon, and not part of the image itself. - Metadata ImageMetadata -} - -// ImageMetadata contains engine-local data about the image -type ImageMetadata struct { - // LastTagTime is the date and time at which the image was last tagged. - LastTagTime time.Time `json:",omitempty"` + Metadata image.Metadata } // Container contains response of Engine API: @@ -237,148 +230,6 @@ type Version struct { BuildTime string `json:",omitempty"` } -// Commit holds the Git-commit (SHA1) that a binary was built from, as reported -// in the version-string of external tools, such as containerd, or runC. -type Commit struct { - ID string // ID is the actual commit ID of external tool. - Expected string // Expected is the commit ID of external tool expected by dockerd as set at build time. -} - -// Info contains response of Engine API: -// GET "/info" -type Info struct { - ID string - Containers int - ContainersRunning int - ContainersPaused int - ContainersStopped int - Images int - Driver string - DriverStatus [][2]string - SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API - Plugins PluginsInfo - MemoryLimit bool - SwapLimit bool - KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes - KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2. - CPUCfsPeriod bool `json:"CpuCfsPeriod"` - CPUCfsQuota bool `json:"CpuCfsQuota"` - CPUShares bool - CPUSet bool - PidsLimit bool - IPv4Forwarding bool - BridgeNfIptables bool - BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` - Debug bool - NFd int - OomKillDisable bool - NGoroutines int - SystemTime string - LoggingDriver string - CgroupDriver string - CgroupVersion string `json:",omitempty"` - NEventsListener int - KernelVersion string - OperatingSystem string - OSVersion string - OSType string - Architecture string - IndexServerAddress string - RegistryConfig *registry.ServiceConfig - NCPU int - MemTotal int64 - GenericResources []swarm.GenericResource - DockerRootDir string - HTTPProxy string `json:"HttpProxy"` - HTTPSProxy string `json:"HttpsProxy"` - NoProxy string - Name string - Labels []string - ExperimentalBuild bool - ServerVersion string - Runtimes map[string]Runtime - DefaultRuntime string - Swarm swarm.Info - // LiveRestoreEnabled determines whether containers should be kept - // running when the daemon is shutdown or upon daemon start if - // running containers are detected - LiveRestoreEnabled bool - Isolation container.Isolation - InitBinary string - ContainerdCommit Commit - RuncCommit Commit - InitCommit Commit - SecurityOptions []string - ProductLicense string `json:",omitempty"` - DefaultAddressPools []NetworkAddressPool `json:",omitempty"` - - // Warnings contains a slice of warnings that occurred while collecting - // system information. These warnings are intended to be informational - // messages for the user, and are not intended to be parsed / used for - // other purposes, as they do not have a fixed format. - Warnings []string -} - -// KeyValue holds a key/value pair -type KeyValue struct { - Key, Value string -} - -// NetworkAddressPool is a temp struct used by Info struct -type NetworkAddressPool struct { - Base string - Size int -} - -// SecurityOpt contains the name and options of a security option -type SecurityOpt struct { - Name string - Options []KeyValue -} - -// DecodeSecurityOptions decodes a security options string slice to a type safe -// SecurityOpt -func DecodeSecurityOptions(opts []string) ([]SecurityOpt, error) { - so := []SecurityOpt{} - for _, opt := range opts { - // support output from a < 1.13 docker daemon - if !strings.Contains(opt, "=") { - so = append(so, SecurityOpt{Name: opt}) - continue - } - secopt := SecurityOpt{} - for _, s := range strings.Split(opt, ",") { - k, v, ok := strings.Cut(s, "=") - if !ok { - return nil, fmt.Errorf("invalid security option %q", s) - } - if k == "" || v == "" { - return nil, errors.New("invalid empty security option") - } - if k == "name" { - secopt.Name = v - continue - } - secopt.Options = append(secopt.Options, KeyValue{Key: k, Value: v}) - } - so = append(so, secopt) - } - return so, nil -} - -// PluginsInfo is a temp struct holding Plugins name -// registered with docker daemon. It is used by Info struct -type PluginsInfo struct { - // List of Volume plugins registered - Volume []string - // List of Network plugins registered - Network []string - // List of Authorization plugins registered - Authorization []string - // List of Log plugins registered - Log []string -} - // ExecStartCheck is a temp struct used by execStart // Config fields is part of ExecConfig in runconfig package type ExecStartCheck struct { @@ -491,17 +342,27 @@ type SummaryNetworkSettings struct { Networks map[string]*network.EndpointSettings } -// NetworkSettingsBase holds basic information about networks +// NetworkSettingsBase holds networking state for a container when inspecting it. type NetworkSettingsBase struct { - Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`) - SandboxID string // SandboxID uniquely represents a container's network stack - HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface - LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix - LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address - Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port - SandboxKey string // SandboxKey identifies the sandbox - SecondaryIPAddresses []network.Address - SecondaryIPv6Addresses []network.Address + Bridge string // Bridge contains the name of the default bridge interface iff it was set through the daemon --bridge flag. + SandboxID string // SandboxID uniquely represents a container's network stack + SandboxKey string // SandboxKey identifies the sandbox + Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port + + // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface + // + // Deprecated: This field is never set and will be removed in a future release. + HairpinMode bool + // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix + // + // Deprecated: This field is never set and will be removed in a future release. + LinkLocalIPv6Address string + // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address + // + // Deprecated: This field is never set and will be removed in a future release. + LinkLocalIPv6PrefixLen int + SecondaryIPAddresses []network.Address // Deprecated: This field is never set and will be removed in a future release. + SecondaryIPv6Addresses []network.Address // Deprecated: This field is never set and will be removed in a future release. } // DefaultNetworkSettings holds network information @@ -594,14 +455,9 @@ type EndpointResource struct { // NetworkCreate is the expected body of the "create network" http request message type NetworkCreate struct { - // Check for networks with duplicate names. - // Network is primarily keyed based on a random ID and not on the name. - // Network name is strictly a user-friendly alias to the network - // which is uniquely identified using ID. - // And there is no guaranteed way to check for duplicates. - // Option CheckDuplicate is there to provide a best effort checking of any networks - // which has the same name but it is not guaranteed to catch all name collisions. - CheckDuplicate bool + // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client + // package to older daemons. + CheckDuplicate bool `json:",omitempty"` Driver string Scope string EnableIPv6 bool @@ -645,33 +501,6 @@ type NetworkInspectOptions struct { Verbose bool } -// Checkpoint represents the details of a checkpoint -type Checkpoint struct { - Name string // Name is the name of the checkpoint -} - -// Runtime describes an OCI runtime -type Runtime struct { - // "Legacy" runtime configuration for runc-compatible runtimes. - - Path string `json:"path,omitempty"` - Args []string `json:"runtimeArgs,omitempty"` - - // Shimv2 runtime configuration. Mutually exclusive with the legacy config above. - - Type string `json:"runtimeType,omitempty"` - Options map[string]interface{} `json:"options,omitempty"` - - // This is exposed here only for internal use - ShimConfig *ShimConfig `json:"-"` -} - -// ShimConfig is used by runtime to configure containerd shims -type ShimConfig struct { - Binary string - Opts interface{} -} - // DiskUsageObject represents an object type used for disk usage query filtering. type DiskUsageObject string @@ -697,7 +526,7 @@ type DiskUsageOptions struct { // GET "/system/df" type DiskUsage struct { LayersSize int64 - Images []*ImageSummary + Images []*image.Summary Containers []*Container Volumes []*volume.Volume BuildCache []*BuildCache @@ -721,7 +550,7 @@ type VolumesPruneReport struct { // ImagesPruneReport contains the response for Engine API: // POST "/images/prune" type ImagesPruneReport struct { - ImagesDeleted []ImageDeleteResponseItem + ImagesDeleted []image.DeleteResponse SpaceReclaimed uint64 } diff --git a/vendor/github.com/docker/docker/api/types/types_deprecated.go b/vendor/github.com/docker/docker/api/types/types_deprecated.go new file mode 100644 index 00000000..e332a7bb --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -0,0 +1,138 @@ +package types + +import ( + "github.com/docker/docker/api/types/checkpoint" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" + "github.com/docker/docker/api/types/swarm" + "github.com/docker/docker/api/types/system" +) + +// CheckpointCreateOptions holds parameters to create a checkpoint from a container. +// +// Deprecated: use [checkpoint.CreateOptions]. +type CheckpointCreateOptions = checkpoint.CreateOptions + +// CheckpointListOptions holds parameters to list checkpoints for a container +// +// Deprecated: use [checkpoint.ListOptions]. +type CheckpointListOptions = checkpoint.ListOptions + +// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container +// +// Deprecated: use [checkpoint.DeleteOptions]. +type CheckpointDeleteOptions = checkpoint.DeleteOptions + +// Checkpoint represents the details of a checkpoint when listing endpoints. +// +// Deprecated: use [checkpoint.Summary]. +type Checkpoint = checkpoint.Summary + +// Info contains response of Engine API: +// GET "/info" +// +// Deprecated: use [system.Info]. +type Info = system.Info + +// Commit holds the Git-commit (SHA1) that a binary was built from, as reported +// in the version-string of external tools, such as containerd, or runC. +// +// Deprecated: use [system.Commit]. +type Commit = system.Commit + +// PluginsInfo is a temp struct holding Plugins name +// registered with docker daemon. It is used by [system.Info] struct +// +// Deprecated: use [system.PluginsInfo]. +type PluginsInfo = system.PluginsInfo + +// NetworkAddressPool is a temp struct used by [system.Info] struct. +// +// Deprecated: use [system.NetworkAddressPool]. +type NetworkAddressPool = system.NetworkAddressPool + +// Runtime describes an OCI runtime. +// +// Deprecated: use [system.Runtime]. +type Runtime = system.Runtime + +// SecurityOpt contains the name and options of a security option. +// +// Deprecated: use [system.SecurityOpt]. +type SecurityOpt = system.SecurityOpt + +// KeyValue holds a key/value pair. +// +// Deprecated: use [system.KeyValue]. +type KeyValue = system.KeyValue + +// ImageDeleteResponseItem image delete response item. +// +// Deprecated: use [image.DeleteResponse]. +type ImageDeleteResponseItem = image.DeleteResponse + +// ImageSummary image summary. +// +// Deprecated: use [image.Summary]. +type ImageSummary = image.Summary + +// ImageMetadata contains engine-local data about the image. +// +// Deprecated: use [image.Metadata]. +type ImageMetadata = image.Metadata + +// ServiceCreateResponse contains the information returned to a client +// on the creation of a new service. +// +// Deprecated: use [swarm.ServiceCreateResponse]. +type ServiceCreateResponse = swarm.ServiceCreateResponse + +// ServiceUpdateResponse service update response. +// +// Deprecated: use [swarm.ServiceUpdateResponse]. +type ServiceUpdateResponse = swarm.ServiceUpdateResponse + +// ContainerStartOptions holds parameters to start containers. +// +// Deprecated: use [container.StartOptions]. +type ContainerStartOptions = container.StartOptions + +// ResizeOptions holds parameters to resize a TTY. +// It can be used to resize container TTYs and +// exec process TTYs too. +// +// Deprecated: use [container.ResizeOptions]. +type ResizeOptions = container.ResizeOptions + +// ContainerAttachOptions holds parameters to attach to a container. +// +// Deprecated: use [container.AttachOptions]. +type ContainerAttachOptions = container.AttachOptions + +// ContainerCommitOptions holds parameters to commit changes into a container. +// +// Deprecated: use [container.CommitOptions]. +type ContainerCommitOptions = container.CommitOptions + +// ContainerListOptions holds parameters to list containers with. +// +// Deprecated: use [container.ListOptions]. +type ContainerListOptions = container.ListOptions + +// ContainerLogsOptions holds parameters to filter logs with. +// +// Deprecated: use [container.LogsOptions]. +type ContainerLogsOptions = container.LogsOptions + +// ContainerRemoveOptions holds parameters to remove containers. +// +// Deprecated: use [container.RemoveOptions]. +type ContainerRemoveOptions = container.RemoveOptions + +// DecodeSecurityOptions decodes a security options string slice to a type safe +// [system.SecurityOpt]. +// +// Deprecated: use [system.DecodeSecurityOptions]. +func DecodeSecurityOptions(opts []string) ([]system.SecurityOpt, error) { + return system.DecodeSecurityOptions(opts) +} diff --git a/vendor/github.com/docker/docker/client/README.md b/vendor/github.com/docker/docker/client/README.md index 992f1811..f8af3ab9 100644 --- a/vendor/github.com/docker/docker/client/README.md +++ b/vendor/github.com/docker/docker/client/README.md @@ -1,8 +1,10 @@ # Go client for the Docker Engine API -The `docker` command uses this package to communicate with the daemon. It can also be used by your own Go applications to do anything the command-line interface does – running containers, pulling images, managing swarms, etc. +The `docker` command uses this package to communicate with the daemon. It can +also be used by your own Go applications to do anything the command-line +interface does – running containers, pulling images, managing swarms, etc. -For example, to list running containers (the equivalent of `docker ps`): +For example, to list all containers (the equivalent of `docker ps --all`): ```go package main @@ -11,25 +13,26 @@ import ( "context" "fmt" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" ) func main() { - cli, err := client.NewClientWithOpts(client.FromEnv) + apiClient, err := client.NewClientWithOpts(client.FromEnv) if err != nil { panic(err) } + defer apiClient.Close() - containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{}) + containers, err := apiClient.ContainerList(context.Background(), container.ListOptions{All: true}) if err != nil { panic(err) } - for _, container := range containers { - fmt.Printf("%s %s\n", container.ID[:10], container.Image) + for _, ctr := range containers { + fmt.Printf("%s %s (status: %s)\n", ctr.ID, ctr.Image, ctr.Status) } } ``` -[Full documentation is available on GoDoc.](https://godoc.org/github.com/docker/docker/client) +[Full documentation is available on pkg.go.dev.](https://pkg.go.dev/github.com/docker/docker/client) diff --git a/vendor/github.com/docker/docker/client/build_prune.go b/vendor/github.com/docker/docker/client/build_prune.go index 2b660623..1a830f41 100644 --- a/vendor/github.com/docker/docker/client/build_prune.go +++ b/vendor/github.com/docker/docker/client/build_prune.go @@ -13,7 +13,7 @@ import ( // BuildCachePrune requests the daemon to delete unused cache data func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { - if err := cli.NewVersionError("1.31", "build prune"); err != nil { + if err := cli.NewVersionError(ctx, "1.31", "build prune"); err != nil { return nil, err } diff --git a/vendor/github.com/docker/docker/client/checkpoint_create.go b/vendor/github.com/docker/docker/client/checkpoint_create.go index 921024fe..9746d288 100644 --- a/vendor/github.com/docker/docker/client/checkpoint_create.go +++ b/vendor/github.com/docker/docker/client/checkpoint_create.go @@ -3,11 +3,11 @@ package client // import "github.com/docker/docker/client" import ( "context" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/checkpoint" ) // CheckpointCreate creates a checkpoint from the given container with the given name -func (cli *Client) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error { +func (cli *Client) CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error { resp, err := cli.post(ctx, "/containers/"+container+"/checkpoints", nil, options, nil) ensureReaderClosed(resp) return err diff --git a/vendor/github.com/docker/docker/client/checkpoint_delete.go b/vendor/github.com/docker/docker/client/checkpoint_delete.go index 54f55fa7..b968c2b2 100644 --- a/vendor/github.com/docker/docker/client/checkpoint_delete.go +++ b/vendor/github.com/docker/docker/client/checkpoint_delete.go @@ -4,11 +4,11 @@ import ( "context" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/checkpoint" ) // CheckpointDelete deletes the checkpoint with the given name from the given container -func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options types.CheckpointDeleteOptions) error { +func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options checkpoint.DeleteOptions) error { query := url.Values{} if options.CheckpointDir != "" { query.Set("dir", options.CheckpointDir) diff --git a/vendor/github.com/docker/docker/client/checkpoint_list.go b/vendor/github.com/docker/docker/client/checkpoint_list.go index 39cfb959..8feb1f3f 100644 --- a/vendor/github.com/docker/docker/client/checkpoint_list.go +++ b/vendor/github.com/docker/docker/client/checkpoint_list.go @@ -5,12 +5,12 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/checkpoint" ) // CheckpointList returns the checkpoints of the given container in the docker host -func (cli *Client) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) { - var checkpoints []types.Checkpoint +func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) { + var checkpoints []checkpoint.Summary query := url.Values{} if options.CheckpointDir != "" { diff --git a/vendor/github.com/docker/docker/client/client.go b/vendor/github.com/docker/docker/client/client.go index 54fa36cc..f2eeb6c5 100644 --- a/vendor/github.com/docker/docker/client/client.go +++ b/vendor/github.com/docker/docker/client/client.go @@ -19,7 +19,7 @@ For example, to list running containers (the equivalent of "docker ps"): "context" "fmt" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" ) @@ -29,13 +29,13 @@ For example, to list running containers (the equivalent of "docker ps"): panic(err) } - containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{}) + containers, err := cli.ContainerList(context.Background(), container.ListOptions{}) if err != nil { panic(err) } - for _, container := range containers { - fmt.Printf("%s %s\n", container.ID[:10], container.Image) + for _, ctr := range containers { + fmt.Printf("%s %s\n", ctr.ID, ctr.Image) } } */ @@ -43,17 +43,21 @@ package client // import "github.com/docker/docker/client" import ( "context" + "crypto/tls" "net" "net/http" "net/url" "path" "strings" + "time" "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" "github.com/docker/go-connections/sockets" "github.com/pkg/errors" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/otel/trace" ) // DummyHost is a hostname used for local communication. @@ -86,8 +90,12 @@ import ( // [Go stdlib]: https://github.com/golang/go/blob/6244b1946bc2101b01955468f1be502dbadd6807/src/net/http/transport.go#L558-L569 const DummyHost = "api.moby.localhost" -// ErrRedirect is the error returned by checkRedirect when the request is non-GET. -var ErrRedirect = errors.New("unexpected redirect in response") +// fallbackAPIVersion is the version to fallback to if API-version negotiation +// fails. This version is the highest version of the API before API-version +// negotiation was introduced. If negotiation fails (or no API version was +// included in the API response), we assume the API server uses the most +// recent version before negotiation was introduced. +const fallbackAPIVersion = "1.24" // Client is the API client that performs all operations // against a docker server. @@ -106,7 +114,12 @@ type Client struct { client *http.Client // version of the server to talk to. version string - // custom http headers configured by users. + // userAgent is the User-Agent header to use for HTTP requests. It takes + // precedence over User-Agent headers set in customHTTPHeaders, and other + // header variables. When set to an empty string, the User-Agent header + // is removed, and no header is sent. + userAgent *string + // custom HTTP headers configured by users. customHTTPHeaders map[string]string // manualOverride is set to true when the version was set by users. manualOverride bool @@ -119,22 +132,33 @@ type Client struct { // negotiated indicates that API version negotiation took place negotiated bool + + tp trace.TracerProvider + + // When the client transport is an *http.Transport (default) we need to do some extra things (like closing idle connections). + // Store the original transport as the http.Client transport will be wrapped with tracing libs. + baseTransport *http.Transport } -// CheckRedirect specifies the policy for dealing with redirect responses: -// If the request is non-GET return ErrRedirect, otherwise use the last response. +// ErrRedirect is the error returned by checkRedirect when the request is non-GET. +var ErrRedirect = errors.New("unexpected redirect in response") + +// CheckRedirect specifies the policy for dealing with redirect responses. It +// can be set on [http.Client.CheckRedirect] to prevent HTTP redirects for +// non-GET requests. It returns an [ErrRedirect] for non-GET request, otherwise +// returns a [http.ErrUseLastResponse], which is special-cased by http.Client +// to use the last response. // -// Go 1.8 changes behavior for HTTP redirects (specifically 301, 307, and 308) -// in the client. The Docker client (and by extension docker API client) can be -// made to send a request like POST /containers//start where what would normally -// be in the name section of the URL is empty. This triggers an HTTP 301 from -// the daemon. +// Go 1.8 changed behavior for HTTP redirects (specifically 301, 307, and 308) +// in the client. The client (and by extension API client) can be made to send +// a request like "POST /containers//start" where what would normally be in the +// name section of the URL is empty. This triggers an HTTP 301 from the daemon. // -// In go 1.8 this 301 will be converted to a GET request, and ends up getting +// In go 1.8 this 301 is converted to a GET request, and ends up getting // a 404 from the daemon. This behavior change manifests in the client in that // before, the 301 was not followed and the client did not generate an error, -// but now results in a message like Error response from daemon: page not found. -func CheckRedirect(req *http.Request, via []*http.Request) error { +// but now results in a message like "Error response from daemon: page not found". +func CheckRedirect(_ *http.Request, via []*http.Request) error { if via[0].Method == http.MethodGet { return http.ErrUseLastResponse } @@ -145,11 +169,11 @@ func CheckRedirect(req *http.Request, via []*http.Request) error { // default API host and version. It also initializes the custom HTTP headers to // add to each request. // -// It takes an optional list of Opt functional arguments, which are applied in +// It takes an optional list of [Opt] functional arguments, which are applied in // the order they're provided, which allows modifying the defaults when creating // the client. For example, the following initializes a client that configures -// itself with values from environment variables (client.FromEnv), and has -// automatic API version negotiation enabled (client.WithAPIVersionNegotiation()). +// itself with values from environment variables ([FromEnv]), and has automatic +// API version negotiation enabled ([WithAPIVersionNegotiation]). // // cli, err := client.NewClientWithOpts( // client.FromEnv, @@ -179,23 +203,43 @@ func NewClientWithOpts(ops ...Opt) (*Client, error) { } } + if tr, ok := c.client.Transport.(*http.Transport); ok { + // Store the base transport before we wrap it in tracing libs below + // This is used, as an example, to close idle connections when the client is closed + c.baseTransport = tr + } + if c.scheme == "" { - c.scheme = "http" - - tlsConfig := resolveTLSConfig(c.client.Transport) - if tlsConfig != nil { - // TODO(stevvooe): This isn't really the right way to write clients in Go. - // `NewClient` should probably only take an `*http.Client` and work from there. - // Unfortunately, the model of having a host-ish/url-thingy as the connection - // string has us confusing protocol and transport layers. We continue doing - // this to avoid breaking existing clients but this should be addressed. + // TODO(stevvooe): This isn't really the right way to write clients in Go. + // `NewClient` should probably only take an `*http.Client` and work from there. + // Unfortunately, the model of having a host-ish/url-thingy as the connection + // string has us confusing protocol and transport layers. We continue doing + // this to avoid breaking existing clients but this should be addressed. + if c.tlsConfig() != nil { c.scheme = "https" + } else { + c.scheme = "http" } } + c.client.Transport = otelhttp.NewTransport( + c.client.Transport, + otelhttp.WithTracerProvider(c.tp), + otelhttp.WithSpanNameFormatter(func(_ string, req *http.Request) string { + return req.Method + " " + req.URL.Path + }), + ) + return c, nil } +func (cli *Client) tlsConfig() *tls.Config { + if cli.baseTransport == nil { + return nil + } + return cli.baseTransport.TLSClientConfig +} + func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) { transport := &http.Transport{} err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host) @@ -210,19 +254,33 @@ func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) { // Close the transport used by the client func (cli *Client) Close() error { - if t, ok := cli.client.Transport.(*http.Transport); ok { - t.CloseIdleConnections() + if cli.baseTransport != nil { + cli.baseTransport.CloseIdleConnections() + return nil + } + return nil +} + +// checkVersion manually triggers API version negotiation (if configured). +// This allows for version-dependent code to use the same version as will +// be negotiated when making the actual requests, and for which cases +// we cannot do the negotiation lazily. +func (cli *Client) checkVersion(ctx context.Context) error { + if !cli.manualOverride && cli.negotiateVersion && !cli.negotiated { + ping, err := cli.Ping(ctx) + if err != nil { + return err + } + cli.negotiateAPIVersionPing(ping) } return nil } -// getAPIPath returns the versioned request path to call the api. +// getAPIPath returns the versioned request path to call the API. // It appends the query parameters to the path if they are not empty. func (cli *Client) getAPIPath(ctx context.Context, p string, query url.Values) string { var apiPath string - if cli.negotiateVersion && !cli.negotiated { - cli.NegotiateAPIVersion(ctx) - } + _ = cli.checkVersion(ctx) if cli.version != "" { v := strings.TrimPrefix(cli.version, "v") apiPath = path.Join(cli.basePath, "/v"+v, p) @@ -244,8 +302,8 @@ func (cli *Client) ClientVersion() string { // by the client, it uses the client's maximum version. // // If a manual override is in place, either through the "DOCKER_API_VERSION" -// (EnvOverrideAPIVersion) environment variable, or if the client is initialized -// with a fixed version (WithVersion(xx)), no negotiation is performed. +// ([EnvOverrideAPIVersion]) environment variable, or if the client is initialized +// with a fixed version ([WithVersion]), no negotiation is performed. // // If the API server's ping response does not contain an API version, or if the // client did not get a successful ping response, it assumes it is connected with @@ -254,7 +312,11 @@ func (cli *Client) ClientVersion() string { // added (1.24). func (cli *Client) NegotiateAPIVersion(ctx context.Context) { if !cli.manualOverride { - ping, _ := cli.Ping(ctx) + ping, err := cli.Ping(ctx) + if err != nil { + // FIXME(thaJeztah): Ping returns an error when failing to connect to the API; we should not swallow the error here, and instead returning it. + return + } cli.negotiateAPIVersionPing(ping) } } @@ -265,8 +327,8 @@ func (cli *Client) NegotiateAPIVersion(ctx context.Context) { // version. // // If a manual override is in place, either through the "DOCKER_API_VERSION" -// (EnvOverrideAPIVersion) environment variable, or if the client is initialized -// with a fixed version (WithVersion(xx)), no negotiation is performed. +// ([EnvOverrideAPIVersion]) environment variable, or if the client is initialized +// with a fixed version ([WithVersion]), no negotiation is performed. // // If the API server's ping response does not contain an API version, we assume // we are connected with an old daemon without API version negotiation support, @@ -283,7 +345,7 @@ func (cli *Client) NegotiateAPIVersionPing(pingResponse types.Ping) { func (cli *Client) negotiateAPIVersionPing(pingResponse types.Ping) { // default to the latest version before versioning headers existed if pingResponse.APIVersion == "" { - pingResponse.APIVersion = "1.24" + pingResponse.APIVersion = fallbackAPIVersion } // if the client is not initialized with a version, start with the latest supported version @@ -338,17 +400,40 @@ func ParseHostURL(host string) (*url.URL, error) { }, nil } +func (cli *Client) dialerFromTransport() func(context.Context, string, string) (net.Conn, error) { + if cli.baseTransport == nil || cli.baseTransport.DialContext == nil { + return nil + } + + if cli.baseTransport.TLSClientConfig != nil { + // When using a tls config we don't use the configured dialer but instead a fallback dialer... + // Note: It seems like this should use the normal dialer and wrap the returned net.Conn in a tls.Conn + // I honestly don't know why it doesn't do that, but it doesn't and such a change is entirely unrelated to the change in this commit. + return nil + } + return cli.baseTransport.DialContext +} + // Dialer returns a dialer for a raw stream connection, with an HTTP/1.1 header, -// that can be used for proxying the daemon connection. +// that can be used for proxying the daemon connection. It is used by +// ["docker dial-stdio"]. // -// Used by `docker dial-stdio` (docker/cli#889). +// ["docker dial-stdio"]: https://github.com/docker/cli/pull/1014 func (cli *Client) Dialer() func(context.Context) (net.Conn, error) { return func(ctx context.Context) (net.Conn, error) { - if transport, ok := cli.client.Transport.(*http.Transport); ok { - if transport.DialContext != nil && transport.TLSClientConfig == nil { - return transport.DialContext(ctx, cli.proto, cli.addr) + if dialFn := cli.dialerFromTransport(); dialFn != nil { + return dialFn(ctx, cli.proto, cli.addr) + } + switch cli.proto { + case "unix": + return net.Dial(cli.proto, cli.addr) + case "npipe": + return sockets.DialPipe(cli.addr, 32*time.Second) + default: + if tlsConfig := cli.tlsConfig(); tlsConfig != nil { + return tls.Dial(cli.proto, cli.addr, tlsConfig) } + return net.Dial(cli.proto, cli.addr) } - return fallbackDial(cli.proto, cli.addr, resolveTLSConfig(cli.client.Transport)) } } diff --git a/vendor/github.com/docker/docker/client/client_unix.go b/vendor/github.com/docker/docker/client/client_unix.go index 319b738d..9fe78ea4 100644 --- a/vendor/github.com/docker/docker/client/client_unix.go +++ b/vendor/github.com/docker/docker/client/client_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package client // import "github.com/docker/docker/client" diff --git a/vendor/github.com/docker/docker/client/config_create.go b/vendor/github.com/docker/docker/client/config_create.go index f6b1881f..3deb4a8e 100644 --- a/vendor/github.com/docker/docker/client/config_create.go +++ b/vendor/github.com/docker/docker/client/config_create.go @@ -11,7 +11,7 @@ import ( // ConfigCreate creates a new config. func (cli *Client) ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error) { var response types.ConfigCreateResponse - if err := cli.NewVersionError("1.30", "config create"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "config create"); err != nil { return response, err } resp, err := cli.post(ctx, "/configs/create", nil, config, nil) diff --git a/vendor/github.com/docker/docker/client/config_inspect.go b/vendor/github.com/docker/docker/client/config_inspect.go index 9be7882c..2c6c7cb3 100644 --- a/vendor/github.com/docker/docker/client/config_inspect.go +++ b/vendor/github.com/docker/docker/client/config_inspect.go @@ -14,7 +14,7 @@ func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.C if id == "" { return swarm.Config{}, nil, objectNotFoundError{object: "config", id: id} } - if err := cli.NewVersionError("1.30", "config inspect"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "config inspect"); err != nil { return swarm.Config{}, nil, err } resp, err := cli.get(ctx, "/configs/"+id, nil, nil) diff --git a/vendor/github.com/docker/docker/client/config_list.go b/vendor/github.com/docker/docker/client/config_list.go index 565acc6e..14dd3813 100644 --- a/vendor/github.com/docker/docker/client/config_list.go +++ b/vendor/github.com/docker/docker/client/config_list.go @@ -12,7 +12,7 @@ import ( // ConfigList returns the list of configs. func (cli *Client) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) { - if err := cli.NewVersionError("1.30", "config list"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "config list"); err != nil { return nil, err } query := url.Values{} diff --git a/vendor/github.com/docker/docker/client/config_remove.go b/vendor/github.com/docker/docker/client/config_remove.go index 24b94e9c..d05b0113 100644 --- a/vendor/github.com/docker/docker/client/config_remove.go +++ b/vendor/github.com/docker/docker/client/config_remove.go @@ -4,7 +4,7 @@ import "context" // ConfigRemove removes a config. func (cli *Client) ConfigRemove(ctx context.Context, id string) error { - if err := cli.NewVersionError("1.30", "config remove"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "config remove"); err != nil { return err } resp, err := cli.delete(ctx, "/configs/"+id, nil, nil) diff --git a/vendor/github.com/docker/docker/client/config_update.go b/vendor/github.com/docker/docker/client/config_update.go index 1ac29854..6995861d 100644 --- a/vendor/github.com/docker/docker/client/config_update.go +++ b/vendor/github.com/docker/docker/client/config_update.go @@ -9,7 +9,7 @@ import ( // ConfigUpdate attempts to update a config func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error { - if err := cli.NewVersionError("1.30", "config update"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "config update"); err != nil { return err } query := url.Values{} diff --git a/vendor/github.com/docker/docker/client/container_attach.go b/vendor/github.com/docker/docker/client/container_attach.go index ba92117d..6a32e5f6 100644 --- a/vendor/github.com/docker/docker/client/container_attach.go +++ b/vendor/github.com/docker/docker/client/container_attach.go @@ -2,9 +2,11 @@ package client // import "github.com/docker/docker/client" import ( "context" + "net/http" "net/url" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerAttach attaches a connection to a container in the server. @@ -31,7 +33,7 @@ import ( // // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this // stream. -func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) { +func (cli *Client) ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error) { query := url.Values{} if options.Stream { query.Set("stream", "1") @@ -52,8 +54,7 @@ func (cli *Client) ContainerAttach(ctx context.Context, container string, option query.Set("logs", "1") } - headers := map[string][]string{ + return cli.postHijacked(ctx, "/containers/"+container+"/attach", query, nil, http.Header{ "Content-Type": {"text/plain"}, - } - return cli.postHijacked(ctx, "/containers/"+container+"/attach", query, nil, headers) + }) } diff --git a/vendor/github.com/docker/docker/client/container_commit.go b/vendor/github.com/docker/docker/client/container_commit.go index cd7f7634..26b3f091 100644 --- a/vendor/github.com/docker/docker/client/container_commit.go +++ b/vendor/github.com/docker/docker/client/container_commit.go @@ -6,12 +6,13 @@ import ( "errors" "net/url" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerCommit applies changes to a container and creates a new tagged image. -func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) { +func (cli *Client) ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error) { var repository, tag string if options.Reference != "" { ref, err := reference.ParseNormalizedNamed(options.Reference) diff --git a/vendor/github.com/docker/docker/client/container_create.go b/vendor/github.com/docker/docker/client/container_create.go index 193a2bb5..5442d426 100644 --- a/vendor/github.com/docker/docker/client/container_create.go +++ b/vendor/github.com/docker/docker/client/container_create.go @@ -23,10 +23,25 @@ type configWrapper struct { func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) { var response container.CreateResponse - if err := cli.NewVersionError("1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { return response, err } - if err := cli.NewVersionError("1.41", "specify container image platform"); platform != nil && err != nil { + + if err := cli.NewVersionError(ctx, "1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil { + return response, err + } + if err := cli.NewVersionError(ctx, "1.41", "specify container image platform"); platform != nil && err != nil { + return response, err + } + if err := cli.NewVersionError(ctx, "1.44", "specify health-check start interval"); config != nil && config.Healthcheck != nil && config.Healthcheck.StartInterval != 0 && err != nil { + return response, err + } + if err := cli.NewVersionError(ctx, "1.44", "specify mac-address per network"); hasEndpointSpecificMacAddress(networkingConfig) && err != nil { return response, err } @@ -45,6 +60,11 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config } } + // Since API 1.44, the container-wide MacAddress is deprecated and will trigger a WARNING if it's specified. + if versions.GreaterThanOrEqualTo(cli.ClientVersion(), "1.44") { + config.MacAddress = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44. + } + query := url.Values{} if p := formatPlatform(platform); p != "" { query.Set("platform", p) @@ -81,3 +101,16 @@ func formatPlatform(platform *ocispec.Platform) string { } return path.Join(platform.OS, platform.Architecture, platform.Variant) } + +// hasEndpointSpecificMacAddress checks whether one of the endpoint in networkingConfig has a MacAddress defined. +func hasEndpointSpecificMacAddress(networkingConfig *network.NetworkingConfig) bool { + if networkingConfig == nil { + return false + } + for _, endpoint := range networkingConfig.EndpointsConfig { + if endpoint.MacAddress != "" { + return true + } + } + return false +} diff --git a/vendor/github.com/docker/docker/client/container_exec.go b/vendor/github.com/docker/docker/client/container_exec.go index 6a2cb006..526a3876 100644 --- a/vendor/github.com/docker/docker/client/container_exec.go +++ b/vendor/github.com/docker/docker/client/container_exec.go @@ -3,6 +3,7 @@ package client // import "github.com/docker/docker/client" import ( "context" "encoding/json" + "net/http" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" @@ -12,7 +13,16 @@ import ( func (cli *Client) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) { var response types.IDResponse - if err := cli.NewVersionError("1.25", "env"); len(config.Env) != 0 && err != nil { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return response, err + } + + if err := cli.NewVersionError(ctx, "1.25", "env"); len(config.Env) != 0 && err != nil { return response, err } if versions.LessThan(cli.ClientVersion(), "1.42") { @@ -46,10 +56,9 @@ func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, confi if versions.LessThan(cli.ClientVersion(), "1.42") { config.ConsoleSize = nil } - headers := map[string][]string{ + return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, http.Header{ "Content-Type": {"application/json"}, - } - return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers) + }) } // ContainerExecInspect returns information about a specific exec process on the docker host. diff --git a/vendor/github.com/docker/docker/client/container_list.go b/vendor/github.com/docker/docker/client/container_list.go index bd491b3d..782e1b3c 100644 --- a/vendor/github.com/docker/docker/client/container_list.go +++ b/vendor/github.com/docker/docker/client/container_list.go @@ -7,11 +7,12 @@ import ( "strconv" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" ) // ContainerList returns the list of containers in the docker host. -func (cli *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) { +func (cli *Client) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) { query := url.Values{} if options.All { @@ -37,7 +38,6 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis if options.Filters.Len() > 0 { //nolint:staticcheck // ignore SA1019 for old code filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) - if err != nil { return nil, err } diff --git a/vendor/github.com/docker/docker/client/container_logs.go b/vendor/github.com/docker/docker/client/container_logs.go index 9bdf2b0f..61197d84 100644 --- a/vendor/github.com/docker/docker/client/container_logs.go +++ b/vendor/github.com/docker/docker/client/container_logs.go @@ -6,7 +6,7 @@ import ( "net/url" "time" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" timetypes "github.com/docker/docker/api/types/time" "github.com/pkg/errors" ) @@ -33,7 +33,7 @@ import ( // // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this // stream. -func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) { +func (cli *Client) ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) { query := url.Values{} if options.ShowStdout { query.Set("stdout", "1") diff --git a/vendor/github.com/docker/docker/client/container_prune.go b/vendor/github.com/docker/docker/client/container_prune.go index 04383dea..ca509238 100644 --- a/vendor/github.com/docker/docker/client/container_prune.go +++ b/vendor/github.com/docker/docker/client/container_prune.go @@ -13,7 +13,7 @@ import ( func (cli *Client) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error) { var report types.ContainersPruneReport - if err := cli.NewVersionError("1.25", "container prune"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "container prune"); err != nil { return report, err } diff --git a/vendor/github.com/docker/docker/client/container_remove.go b/vendor/github.com/docker/docker/client/container_remove.go index c21de609..39f7b106 100644 --- a/vendor/github.com/docker/docker/client/container_remove.go +++ b/vendor/github.com/docker/docker/client/container_remove.go @@ -4,11 +4,11 @@ import ( "context" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerRemove kills and removes a container from the docker host. -func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error { +func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error { query := url.Values{} if options.RemoveVolumes { query.Set("v", "1") diff --git a/vendor/github.com/docker/docker/client/container_resize.go b/vendor/github.com/docker/docker/client/container_resize.go index a9d4c0c7..5cfd01d4 100644 --- a/vendor/github.com/docker/docker/client/container_resize.go +++ b/vendor/github.com/docker/docker/client/container_resize.go @@ -5,16 +5,16 @@ import ( "net/url" "strconv" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerResize changes the size of the tty for a container. -func (cli *Client) ContainerResize(ctx context.Context, containerID string, options types.ResizeOptions) error { +func (cli *Client) ContainerResize(ctx context.Context, containerID string, options container.ResizeOptions) error { return cli.resize(ctx, "/containers/"+containerID, options.Height, options.Width) } // ContainerExecResize changes the size of the tty for an exec process running inside a container. -func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error { +func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error { return cli.resize(ctx, "/exec/"+execID, options.Height, options.Width) } diff --git a/vendor/github.com/docker/docker/client/container_restart.go b/vendor/github.com/docker/docker/client/container_restart.go index 1e0ad999..02b5079b 100644 --- a/vendor/github.com/docker/docker/client/container_restart.go +++ b/vendor/github.com/docker/docker/client/container_restart.go @@ -17,8 +17,18 @@ func (cli *Client) ContainerRestart(ctx context.Context, containerID string, opt if options.Timeout != nil { query.Set("t", strconv.Itoa(*options.Timeout)) } - if options.Signal != "" && versions.GreaterThanOrEqualTo(cli.version, "1.42") { - query.Set("signal", options.Signal) + if options.Signal != "" { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } + if versions.GreaterThanOrEqualTo(cli.version, "1.42") { + query.Set("signal", options.Signal) + } } resp, err := cli.post(ctx, "/containers/"+containerID+"/restart", query, nil, nil) ensureReaderClosed(resp) diff --git a/vendor/github.com/docker/docker/client/container_start.go b/vendor/github.com/docker/docker/client/container_start.go index c2e0b15d..33ba85f2 100644 --- a/vendor/github.com/docker/docker/client/container_start.go +++ b/vendor/github.com/docker/docker/client/container_start.go @@ -4,11 +4,11 @@ import ( "context" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerStart sends a request to the docker daemon to start a container. -func (cli *Client) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error { +func (cli *Client) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error { query := url.Values{} if len(options.CheckpointID) != 0 { query.Set("checkpoint", options.CheckpointID) diff --git a/vendor/github.com/docker/docker/client/container_stats.go b/vendor/github.com/docker/docker/client/container_stats.go index 0a6488dd..3fabb75f 100644 --- a/vendor/github.com/docker/docker/client/container_stats.go +++ b/vendor/github.com/docker/docker/client/container_stats.go @@ -21,8 +21,10 @@ func (cli *Client) ContainerStats(ctx context.Context, containerID string, strea return types.ContainerStats{}, err } - osType := getDockerOS(resp.header.Get("Server")) - return types.ContainerStats{Body: resp.body, OSType: osType}, err + return types.ContainerStats{ + Body: resp.body, + OSType: getDockerOS(resp.header.Get("Server")), + }, nil } // ContainerStatsOneShot gets a single stat entry from a container. @@ -37,6 +39,8 @@ func (cli *Client) ContainerStatsOneShot(ctx context.Context, containerID string return types.ContainerStats{}, err } - osType := getDockerOS(resp.header.Get("Server")) - return types.ContainerStats{Body: resp.body, OSType: osType}, err + return types.ContainerStats{ + Body: resp.body, + OSType: getDockerOS(resp.header.Get("Server")), + }, nil } diff --git a/vendor/github.com/docker/docker/client/container_stop.go b/vendor/github.com/docker/docker/client/container_stop.go index 2a43ce22..7c98a354 100644 --- a/vendor/github.com/docker/docker/client/container_stop.go +++ b/vendor/github.com/docker/docker/client/container_stop.go @@ -21,8 +21,18 @@ func (cli *Client) ContainerStop(ctx context.Context, containerID string, option if options.Timeout != nil { query.Set("t", strconv.Itoa(*options.Timeout)) } - if options.Signal != "" && versions.GreaterThanOrEqualTo(cli.version, "1.42") { - query.Set("signal", options.Signal) + if options.Signal != "" { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } + if versions.GreaterThanOrEqualTo(cli.version, "1.42") { + query.Set("signal", options.Signal) + } } resp, err := cli.post(ctx, "/containers/"+containerID+"/stop", query, nil, nil) ensureReaderClosed(resp) diff --git a/vendor/github.com/docker/docker/client/container_wait.go b/vendor/github.com/docker/docker/client/container_wait.go index b7d80542..8bb6be0a 100644 --- a/vendor/github.com/docker/docker/client/container_wait.go +++ b/vendor/github.com/docker/docker/client/container_wait.go @@ -30,13 +30,22 @@ const containerWaitErrorMsgLimit = 2 * 1024 /* Max: 2KiB */ // synchronize ContainerWait with other calls, such as specifying a // "next-exit" condition before issuing a ContainerStart request. func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) { + resultC := make(chan container.WaitResponse) + errC := make(chan error, 1) + + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + errC <- err + return resultC, errC + } if versions.LessThan(cli.ClientVersion(), "1.30") { return cli.legacyContainerWait(ctx, containerID) } - resultC := make(chan container.WaitResponse) - errC := make(chan error, 1) - query := url.Values{} if condition != "" { query.Set("condition", string(condition)) diff --git a/vendor/github.com/docker/docker/client/distribution_inspect.go b/vendor/github.com/docker/docker/client/distribution_inspect.go index efab066d..68ef31b7 100644 --- a/vendor/github.com/docker/docker/client/distribution_inspect.go +++ b/vendor/github.com/docker/docker/client/distribution_inspect.go @@ -3,6 +3,7 @@ package client // import "github.com/docker/docker/client" import ( "context" "encoding/json" + "net/http" "net/url" "github.com/docker/docker/api/types/registry" @@ -16,13 +17,13 @@ func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegist return distributionInspect, objectNotFoundError{object: "distribution", id: image} } - if err := cli.NewVersionError("1.30", "distribution inspect"); err != nil { + if err := cli.NewVersionError(ctx, "1.30", "distribution inspect"); err != nil { return distributionInspect, err } - var headers map[string][]string + var headers http.Header if encodedRegistryAuth != "" { - headers = map[string][]string{ + headers = http.Header{ registry.AuthHeader: {encodedRegistryAuth}, } } diff --git a/vendor/github.com/docker/docker/client/errors.go b/vendor/github.com/docker/docker/client/errors.go index 6878144c..0d01e243 100644 --- a/vendor/github.com/docker/docker/client/errors.go +++ b/vendor/github.com/docker/docker/client/errors.go @@ -1,6 +1,7 @@ package client // import "github.com/docker/docker/client" import ( + "context" "fmt" "github.com/docker/docker/api/types/versions" @@ -10,15 +11,16 @@ import ( // errConnectionFailed implements an error returned when connection failed. type errConnectionFailed struct { - host string + error } // Error returns a string representation of an errConnectionFailed -func (err errConnectionFailed) Error() string { - if err.host == "" { - return "Cannot connect to the Docker daemon. Is the docker daemon running on this host?" - } - return fmt.Sprintf("Cannot connect to the Docker daemon at %s. Is the docker daemon running?", err.host) +func (e errConnectionFailed) Error() string { + return e.error.Error() +} + +func (e errConnectionFailed) Unwrap() error { + return e.error } // IsErrConnectionFailed returns true if the error is caused by connection failed. @@ -28,23 +30,19 @@ func IsErrConnectionFailed(err error) bool { // ErrorConnectionFailed returns an error with host in the error message when connection to docker daemon failed. func ErrorConnectionFailed(host string) error { - return errConnectionFailed{host: host} -} - -// Deprecated: use the errdefs.NotFound() interface instead. Kept for backward compatibility -type notFound interface { - error - NotFound() bool + var err error + if host == "" { + err = fmt.Errorf("Cannot connect to the Docker daemon. Is the docker daemon running on this host?") + } else { + err = fmt.Errorf("Cannot connect to the Docker daemon at %s. Is the docker daemon running?", host) + } + return errConnectionFailed{error: err} } // IsErrNotFound returns true if the error is a NotFound error, which is returned -// by the API when some object is not found. +// by the API when some object is not found. It is an alias for [errdefs.IsNotFound]. func IsErrNotFound(err error) bool { - if errdefs.IsNotFound(err) { - return true - } - var e notFound - return errors.As(err, &e) + return errdefs.IsNotFound(err) } type objectNotFoundError struct { @@ -58,9 +56,20 @@ func (e objectNotFoundError) Error() string { return fmt.Sprintf("Error: No such %s: %s", e.object, e.id) } -// NewVersionError returns an error if the APIVersion required -// if less than the current supported version -func (cli *Client) NewVersionError(APIrequired, feature string) error { +// NewVersionError returns an error if the APIVersion required is less than the +// current supported version. +// +// It performs API-version negotiation if the Client is configured with this +// option, otherwise it assumes the latest API version is used. +func (cli *Client) NewVersionError(ctx context.Context, APIrequired, feature string) error { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } if cli.version != "" && versions.LessThan(cli.version, APIrequired) { return fmt.Errorf("%q requires API version %s, but the Docker daemon API version is %s", feature, APIrequired, cli.version) } diff --git a/vendor/github.com/docker/docker/client/hijack.go b/vendor/github.com/docker/docker/client/hijack.go index 7e84865f..839d4c5c 100644 --- a/vendor/github.com/docker/docker/client/hijack.go +++ b/vendor/github.com/docker/docker/client/hijack.go @@ -3,18 +3,16 @@ package client // import "github.com/docker/docker/client" import ( "bufio" "context" - "crypto/tls" "fmt" "net" "net/http" - "net/http/httputil" "net/url" "time" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" - "github.com/docker/go-connections/sockets" "github.com/pkg/errors" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) // postHijacked sends a POST request and hijacks the connection. @@ -23,11 +21,11 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu if err != nil { return types.HijackedResponse{}, err } - req, err := cli.buildRequest(http.MethodPost, cli.getAPIPath(ctx, path, query), bodyEncoded, headers) + req, err := cli.buildRequest(ctx, http.MethodPost, cli.getAPIPath(ctx, path, query), bodyEncoded, headers) if err != nil { return types.HijackedResponse{}, err } - conn, mediaType, err := cli.setupHijackConn(ctx, req, "tcp") + conn, mediaType, err := cli.setupHijackConn(req, "tcp") if err != nil { return types.HijackedResponse{}, err } @@ -37,29 +35,18 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu // DialHijack returns a hijacked connection with negotiated protocol proto. func (cli *Client) DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error) { - req, err := http.NewRequest(http.MethodPost, url, nil) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, nil) if err != nil { return nil, err } req = cli.addHeaders(req, meta) - conn, _, err := cli.setupHijackConn(ctx, req, proto) + conn, _, err := cli.setupHijackConn(req, proto) return conn, err } -// fallbackDial is used when WithDialer() was not called. -// See cli.Dialer(). -func fallbackDial(proto, addr string, tlsConfig *tls.Config) (net.Conn, error) { - if tlsConfig != nil && proto != "unix" && proto != "npipe" { - return tls.Dial(proto, addr, tlsConfig) - } - if proto == "npipe" { - return sockets.DialPipe(addr, 32*time.Second) - } - return net.Dial(proto, addr) -} - -func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto string) (net.Conn, string, error) { +func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn, _ string, retErr error) { + ctx := req.Context() req.Header.Set("Connection", "Upgrade") req.Header.Set("Upgrade", proto) @@ -68,6 +55,11 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto if err != nil { return nil, "", errors.Wrap(err, "cannot connect to the Docker daemon. Is 'docker daemon' running on this host?") } + defer func() { + if retErr != nil { + conn.Close() + } + }() // When we set up a TCP connection for hijack, there could be long periods // of inactivity (a long running command with no output) that in certain @@ -79,35 +71,29 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto _ = tcpConn.SetKeepAlivePeriod(30 * time.Second) } - clientconn := httputil.NewClientConn(conn, nil) - defer clientconn.Close() + hc := &hijackedConn{conn, bufio.NewReader(conn)} // Server hijacks the connection, error 'connection closed' expected - resp, err := clientconn.Do(req) - - //nolint:staticcheck // ignore SA1019 for connecting to old (pre go1.8) daemons - if err != httputil.ErrPersistEOF { - if err != nil { - return nil, "", err - } - if resp.StatusCode != http.StatusSwitchingProtocols { - _ = resp.Body.Close() - return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) - } + resp, err := otelhttp.NewTransport(hc).RoundTrip(req) + if err != nil { + return nil, "", err + } + if resp.StatusCode != http.StatusSwitchingProtocols { + _ = resp.Body.Close() + return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) } - c, br := clientconn.Hijack() - if br.Buffered() > 0 { + if hc.r.Buffered() > 0 { // If there is buffered content, wrap the connection. We return an // object that implements CloseWrite if the underlying connection // implements it. - if _, ok := c.(types.CloseWriter); ok { - c = &hijackedConnCloseWriter{&hijackedConn{c, br}} + if _, ok := hc.Conn.(types.CloseWriter); ok { + conn = &hijackedConnCloseWriter{hc} } else { - c = &hijackedConn{c, br} + conn = hc } } else { - br.Reset(nil) + hc.r.Reset(nil) } var mediaType string @@ -116,7 +102,7 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto mediaType = resp.Header.Get("Content-Type") } - return c, mediaType, nil + return conn, mediaType, nil } // hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case @@ -128,6 +114,13 @@ type hijackedConn struct { r *bufio.Reader } +func (c *hijackedConn) RoundTrip(req *http.Request) (*http.Response, error) { + if err := req.Write(c.Conn); err != nil { + return nil, err + } + return http.ReadResponse(c.r, req) +} + func (c *hijackedConn) Read(b []byte) (int, error) { return c.r.Read(b) } diff --git a/vendor/github.com/docker/docker/client/image_build.go b/vendor/github.com/docker/docker/client/image_build.go index d16e1d8e..d294ddc8 100644 --- a/vendor/github.com/docker/docker/client/image_build.go +++ b/vendor/github.com/docker/docker/client/image_build.go @@ -18,18 +18,18 @@ import ( // The Body in the response implements an io.ReadCloser and it's up to the caller to // close it. func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) { - query, err := cli.imageBuildOptionsToQuery(options) + query, err := cli.imageBuildOptionsToQuery(ctx, options) if err != nil { return types.ImageBuildResponse{}, err } - headers := http.Header(make(map[string][]string)) buf, err := json.Marshal(options.AuthConfigs) if err != nil { return types.ImageBuildResponse{}, err } - headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf)) + headers := http.Header{} + headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf)) headers.Set("Content-Type", "application/x-tar") serverResp, err := cli.postRaw(ctx, "/build", query, buildContext, headers) @@ -37,15 +37,13 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio return types.ImageBuildResponse{}, err } - osType := getDockerOS(serverResp.header.Get("Server")) - return types.ImageBuildResponse{ Body: serverResp.body, - OSType: osType, + OSType: getDockerOS(serverResp.header.Get("Server")), }, nil } -func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (url.Values, error) { +func (cli *Client) imageBuildOptionsToQuery(ctx context.Context, options types.ImageBuildOptions) (url.Values, error) { query := url.Values{ "t": options.Tags, "securityopt": options.SecurityOpt, @@ -75,7 +73,7 @@ func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (ur } if options.Squash { - if err := cli.NewVersionError("1.25", "squash"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "squash"); err != nil { return query, err } query.Set("squash", "1") @@ -125,7 +123,7 @@ func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (ur query.Set("session", options.SessionID) } if options.Platform != "" { - if err := cli.NewVersionError("1.32", "platform"); err != nil { + if err := cli.NewVersionError(ctx, "1.32", "platform"); err != nil { return query, err } query.Set("platform", strings.ToLower(options.Platform)) diff --git a/vendor/github.com/docker/docker/client/image_create.go b/vendor/github.com/docker/docker/client/image_create.go index 6a9b708f..29cd0b43 100644 --- a/vendor/github.com/docker/docker/client/image_create.go +++ b/vendor/github.com/docker/docker/client/image_create.go @@ -3,10 +3,11 @@ package client // import "github.com/docker/docker/client" import ( "context" "io" + "net/http" "net/url" "strings" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" ) @@ -33,6 +34,7 @@ func (cli *Client) ImageCreate(ctx context.Context, parentReference string, opti } func (cli *Client) tryImageCreate(ctx context.Context, query url.Values, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.post(ctx, "/images/create", query, nil, headers) + return cli.post(ctx, "/images/create", query, nil, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } diff --git a/vendor/github.com/docker/docker/client/image_import.go b/vendor/github.com/docker/docker/client/image_import.go index c5de42cb..cd376a14 100644 --- a/vendor/github.com/docker/docker/client/image_import.go +++ b/vendor/github.com/docker/docker/client/image_import.go @@ -6,7 +6,7 @@ import ( "net/url" "strings" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" ) diff --git a/vendor/github.com/docker/docker/client/image_list.go b/vendor/github.com/docker/docker/client/image_list.go index 950d5133..fa6aecfc 100644 --- a/vendor/github.com/docker/docker/client/image_list.go +++ b/vendor/github.com/docker/docker/client/image_list.go @@ -7,12 +7,23 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/versions" ) // ImageList returns a list of images in the docker host. -func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) { - var images []types.ImageSummary +func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) { + var images []image.Summary + + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return images, err + } + query := url.Values{} optionFilters := options.Filters diff --git a/vendor/github.com/docker/docker/client/image_load.go b/vendor/github.com/docker/docker/client/image_load.go index 91016e49..c825206e 100644 --- a/vendor/github.com/docker/docker/client/image_load.go +++ b/vendor/github.com/docker/docker/client/image_load.go @@ -3,6 +3,7 @@ package client // import "github.com/docker/docker/client" import ( "context" "io" + "net/http" "net/url" "github.com/docker/docker/api/types" @@ -17,8 +18,9 @@ func (cli *Client) ImageLoad(ctx context.Context, input io.Reader, quiet bool) ( if quiet { v.Set("quiet", "1") } - headers := map[string][]string{"Content-Type": {"application/x-tar"}} - resp, err := cli.postRaw(ctx, "/images/load", v, input, headers) + resp, err := cli.postRaw(ctx, "/images/load", v, input, http.Header{ + "Content-Type": {"application/x-tar"}, + }) if err != nil { return types.ImageLoadResponse{}, err } diff --git a/vendor/github.com/docker/docker/client/image_prune.go b/vendor/github.com/docker/docker/client/image_prune.go index 56af6d7f..6b82d6ab 100644 --- a/vendor/github.com/docker/docker/client/image_prune.go +++ b/vendor/github.com/docker/docker/client/image_prune.go @@ -13,7 +13,7 @@ import ( func (cli *Client) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (types.ImagesPruneReport, error) { var report types.ImagesPruneReport - if err := cli.NewVersionError("1.25", "image prune"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "image prune"); err != nil { return report, err } diff --git a/vendor/github.com/docker/docker/client/image_pull.go b/vendor/github.com/docker/docker/client/image_pull.go index a2397559..d92049d5 100644 --- a/vendor/github.com/docker/docker/client/image_pull.go +++ b/vendor/github.com/docker/docker/client/image_pull.go @@ -6,7 +6,7 @@ import ( "net/url" "strings" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/errdefs" ) diff --git a/vendor/github.com/docker/docker/client/image_push.go b/vendor/github.com/docker/docker/client/image_push.go index dd1b8f34..6839a89e 100644 --- a/vendor/github.com/docker/docker/client/image_push.go +++ b/vendor/github.com/docker/docker/client/image_push.go @@ -4,9 +4,10 @@ import ( "context" "errors" "io" + "net/http" "net/url" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/errdefs" @@ -50,6 +51,7 @@ func (cli *Client) ImagePush(ctx context.Context, image string, options types.Im } func (cli *Client) tryImagePush(ctx context.Context, imageID string, query url.Values, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.post(ctx, "/images/"+imageID+"/push", query, nil, headers) + return cli.post(ctx, "/images/"+imageID+"/push", query, nil, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } diff --git a/vendor/github.com/docker/docker/client/image_remove.go b/vendor/github.com/docker/docker/client/image_remove.go index 6a9fb3f4..b936d208 100644 --- a/vendor/github.com/docker/docker/client/image_remove.go +++ b/vendor/github.com/docker/docker/client/image_remove.go @@ -6,10 +6,11 @@ import ( "net/url" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" ) // ImageRemove removes an image from the docker host. -func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { +func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { query := url.Values{} if options.Force { @@ -19,7 +20,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type query.Set("noprune", "1") } - var dels []types.ImageDeleteResponseItem + var dels []image.DeleteResponse resp, err := cli.delete(ctx, "/images/"+imageID, query, nil) defer ensureReaderClosed(resp) if err != nil { diff --git a/vendor/github.com/docker/docker/client/image_search.go b/vendor/github.com/docker/docker/client/image_search.go index 5f0c49ed..8971b139 100644 --- a/vendor/github.com/docker/docker/client/image_search.go +++ b/vendor/github.com/docker/docker/client/image_search.go @@ -3,6 +3,7 @@ package client // import "github.com/docker/docker/client" import ( "context" "encoding/json" + "net/http" "net/url" "strconv" @@ -48,6 +49,7 @@ func (cli *Client) ImageSearch(ctx context.Context, term string, options types.I } func (cli *Client) tryImageSearch(ctx context.Context, query url.Values, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.get(ctx, "/images/search", query, headers) + return cli.get(ctx, "/images/search", query, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } diff --git a/vendor/github.com/docker/docker/client/image_tag.go b/vendor/github.com/docker/docker/client/image_tag.go index 5652bfc2..ea6b4a1e 100644 --- a/vendor/github.com/docker/docker/client/image_tag.go +++ b/vendor/github.com/docker/docker/client/image_tag.go @@ -4,7 +4,7 @@ import ( "context" "net/url" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/pkg/errors" ) diff --git a/vendor/github.com/docker/docker/client/info.go b/vendor/github.com/docker/docker/client/info.go index c856704e..cc3fcc46 100644 --- a/vendor/github.com/docker/docker/client/info.go +++ b/vendor/github.com/docker/docker/client/info.go @@ -6,12 +6,12 @@ import ( "fmt" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/system" ) // Info returns information about the docker server. -func (cli *Client) Info(ctx context.Context) (types.Info, error) { - var info types.Info +func (cli *Client) Info(ctx context.Context) (system.Info, error) { + var info system.Info serverResp, err := cli.get(ctx, "/info", url.Values{}, nil) defer ensureReaderClosed(serverResp) if err != nil { diff --git a/vendor/github.com/docker/docker/client/interface.go b/vendor/github.com/docker/docker/client/interface.go index 7993c5a4..302f5fb1 100644 --- a/vendor/github.com/docker/docker/client/interface.go +++ b/vendor/github.com/docker/docker/client/interface.go @@ -14,6 +14,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" + "github.com/docker/docker/api/types/system" "github.com/docker/docker/api/types/volume" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -45,30 +46,30 @@ type CommonAPIClient interface { // ContainerAPIClient defines API client methods for the containers type ContainerAPIClient interface { - ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) - ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) + ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error) + ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) - ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error + ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error ContainerExport(ctx context.Context, container string) (io.ReadCloser, error) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error) ContainerKill(ctx context.Context, container, signal string) error - ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) - ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) + ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) + ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) ContainerPause(ctx context.Context, container string) error - ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error + ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error ContainerRename(ctx context.Context, container, newContainerName string) error - ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error + ContainerResize(ctx context.Context, container string, options container.ResizeOptions) error ContainerRestart(ctx context.Context, container string, options container.StopOptions) error ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error) ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error) ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error) - ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error + ContainerStart(ctx context.Context, container string, options container.StartOptions) error ContainerStop(ctx context.Context, container string, options container.StopOptions) error ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error) ContainerUnpause(ctx context.Context, container string) error @@ -93,11 +94,11 @@ type ImageAPIClient interface { ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) - ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) + ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) - ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) + ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) ImageTag(ctx context.Context, image, ref string) error @@ -140,13 +141,13 @@ type PluginAPIClient interface { // ServiceAPIClient defines API client methods for the services type ServiceAPIClient interface { - ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) + ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) ServiceRemove(ctx context.Context, serviceID string) error - ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) - ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error) - TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error) + ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error) + TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) } @@ -165,7 +166,7 @@ type SwarmAPIClient interface { // SystemAPIClient defines API client methods for the system type SystemAPIClient interface { Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) - Info(ctx context.Context) (types.Info, error) + Info(ctx context.Context) (system.Info, error) RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) Ping(ctx context.Context) (types.Ping, error) diff --git a/vendor/github.com/docker/docker/client/interface_experimental.go b/vendor/github.com/docker/docker/client/interface_experimental.go index 402ffb51..c585c104 100644 --- a/vendor/github.com/docker/docker/client/interface_experimental.go +++ b/vendor/github.com/docker/docker/client/interface_experimental.go @@ -3,7 +3,7 @@ package client // import "github.com/docker/docker/client" import ( "context" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/checkpoint" ) type apiClientExperimental interface { @@ -12,7 +12,7 @@ type apiClientExperimental interface { // CheckpointAPIClient defines API client methods for the checkpoints type CheckpointAPIClient interface { - CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error - CheckpointDelete(ctx context.Context, container string, options types.CheckpointDeleteOptions) error - CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) + CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error + CheckpointDelete(ctx context.Context, container string, options checkpoint.DeleteOptions) error + CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) } diff --git a/vendor/github.com/docker/docker/client/network_create.go b/vendor/github.com/docker/docker/client/network_create.go index 278d9383..d510feb3 100644 --- a/vendor/github.com/docker/docker/client/network_create.go +++ b/vendor/github.com/docker/docker/client/network_create.go @@ -5,15 +5,30 @@ import ( "encoding/json" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/versions" ) // NetworkCreate creates a new network in the docker host. func (cli *Client) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) { + var response types.NetworkCreateResponse + + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return response, err + } + networkCreateRequest := types.NetworkCreateRequest{ NetworkCreate: options, Name: name, } - var response types.NetworkCreateResponse + if versions.LessThan(cli.version, "1.44") { + networkCreateRequest.CheckDuplicate = true //nolint:staticcheck // ignore SA1019: CheckDuplicate is deprecated since API v1.44. + } + serverResp, err := cli.post(ctx, "/networks/create", nil, networkCreateRequest, nil) defer ensureReaderClosed(serverResp) if err != nil { diff --git a/vendor/github.com/docker/docker/client/network_prune.go b/vendor/github.com/docker/docker/client/network_prune.go index cebb1882..7b5f831e 100644 --- a/vendor/github.com/docker/docker/client/network_prune.go +++ b/vendor/github.com/docker/docker/client/network_prune.go @@ -13,7 +13,7 @@ import ( func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) { var report types.NetworksPruneReport - if err := cli.NewVersionError("1.25", "network prune"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "network prune"); err != nil { return report, err } diff --git a/vendor/github.com/docker/docker/client/node_list.go b/vendor/github.com/docker/docker/client/node_list.go index c212906b..1a9e6bfb 100644 --- a/vendor/github.com/docker/docker/client/node_list.go +++ b/vendor/github.com/docker/docker/client/node_list.go @@ -16,7 +16,6 @@ func (cli *Client) NodeList(ctx context.Context, options types.NodeListOptions) if options.Filters.Len() > 0 { filterJSON, err := filters.ToJSON(options.Filters) - if err != nil { return nil, err } diff --git a/vendor/github.com/docker/docker/client/options.go b/vendor/github.com/docker/docker/client/options.go index 099ad418..ddb0ca39 100644 --- a/vendor/github.com/docker/docker/client/options.go +++ b/vendor/github.com/docker/docker/client/options.go @@ -11,25 +11,25 @@ import ( "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" "github.com/pkg/errors" + "go.opentelemetry.io/otel/trace" ) -// Opt is a configuration option to initialize a client +// Opt is a configuration option to initialize a [Client]. type Opt func(*Client) error -// FromEnv configures the client with values from environment variables. +// FromEnv configures the client with values from environment variables. It +// is the equivalent of using the [WithTLSClientConfigFromEnv], [WithHostFromEnv], +// and [WithVersionFromEnv] options. // // FromEnv uses the following environment variables: // -// DOCKER_HOST (EnvOverrideHost) to set the URL to the docker server. -// -// DOCKER_API_VERSION (EnvOverrideAPIVersion) to set the version of the API to -// use, leave empty for latest. -// -// DOCKER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to -// load the TLS certificates (ca.pem, cert.pem, key.pem). -// -// DOCKER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by -// default). +// - DOCKER_HOST ([EnvOverrideHost]) to set the URL to the docker server. +// - DOCKER_API_VERSION ([EnvOverrideAPIVersion]) to set the version of the +// API to use, leave empty for latest. +// - DOCKER_CERT_PATH ([EnvOverrideCertPath]) to specify the directory from +// which to load the TLS certificates ("ca.pem", "cert.pem", "key.pem'). +// - DOCKER_TLS_VERIFY ([EnvTLSVerify]) to enable or disable TLS verification +// (off by default). func FromEnv(c *Client) error { ops := []Opt{ WithTLSClientConfigFromEnv(), @@ -45,7 +45,8 @@ func FromEnv(c *Client) error { } // WithDialContext applies the dialer to the client transport. This can be -// used to set the Timeout and KeepAlive settings of the client. +// used to set the Timeout and KeepAlive settings of the client. It returns +// an error if the client does not have a [http.Transport] configured. func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt { return func(c *Client) error { if transport, ok := c.client.Transport.(*http.Transport); ok { @@ -75,7 +76,7 @@ func WithHost(host string) Opt { } // WithHostFromEnv overrides the client host with the host specified in the -// DOCKER_HOST (EnvOverrideHost) environment variable. If DOCKER_HOST is not set, +// DOCKER_HOST ([EnvOverrideHost]) environment variable. If DOCKER_HOST is not set, // or set to an empty value, the host is not modified. func WithHostFromEnv() Opt { return func(c *Client) error { @@ -86,7 +87,7 @@ func WithHostFromEnv() Opt { } } -// WithHTTPClient overrides the client http client with the specified one +// WithHTTPClient overrides the client's HTTP client with the specified one. func WithHTTPClient(client *http.Client) Opt { return func(c *Client) error { if client != nil { @@ -96,7 +97,7 @@ func WithHTTPClient(client *http.Client) Opt { } } -// WithTimeout configures the time limit for requests made by the HTTP client +// WithTimeout configures the time limit for requests made by the HTTP client. func WithTimeout(timeout time.Duration) Opt { return func(c *Client) error { c.client.Timeout = timeout @@ -104,7 +105,19 @@ func WithTimeout(timeout time.Duration) Opt { } } -// WithHTTPHeaders overrides the client default http headers +// WithUserAgent configures the User-Agent header to use for HTTP requests. +// It overrides any User-Agent set in headers. When set to an empty string, +// the User-Agent header is removed, and no header is sent. +func WithUserAgent(ua string) Opt { + return func(c *Client) error { + c.userAgent = &ua + return nil + } +} + +// WithHTTPHeaders appends custom HTTP headers to the client's default headers. +// It does not allow for built-in headers (such as "User-Agent", if set) to +// be overridden. Also see [WithUserAgent]. func WithHTTPHeaders(headers map[string]string) Opt { return func(c *Client) error { c.customHTTPHeaders = headers @@ -112,7 +125,7 @@ func WithHTTPHeaders(headers map[string]string) Opt { } } -// WithScheme overrides the client scheme with the specified one +// WithScheme overrides the client scheme with the specified one. func WithScheme(scheme string) Opt { return func(c *Client) error { c.scheme = scheme @@ -120,51 +133,50 @@ func WithScheme(scheme string) Opt { } } -// WithTLSClientConfig applies a tls config to the client transport. +// WithTLSClientConfig applies a TLS config to the client transport. func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt { return func(c *Client) error { - opts := tlsconfig.Options{ + transport, ok := c.client.Transport.(*http.Transport) + if !ok { + return errors.Errorf("cannot apply tls config to transport: %T", c.client.Transport) + } + config, err := tlsconfig.Client(tlsconfig.Options{ CAFile: cacertPath, CertFile: certPath, KeyFile: keyPath, ExclusiveRootPools: true, - } - config, err := tlsconfig.Client(opts) + }) if err != nil { return errors.Wrap(err, "failed to create tls config") } - if transport, ok := c.client.Transport.(*http.Transport); ok { - transport.TLSClientConfig = config - return nil - } - return errors.Errorf("cannot apply tls config to transport: %T", c.client.Transport) + transport.TLSClientConfig = config + return nil } } // WithTLSClientConfigFromEnv configures the client's TLS settings with the -// settings in the DOCKER_CERT_PATH and DOCKER_TLS_VERIFY environment variables. -// If DOCKER_CERT_PATH is not set or empty, TLS configuration is not modified. +// settings in the DOCKER_CERT_PATH ([EnvOverrideCertPath]) and DOCKER_TLS_VERIFY +// ([EnvTLSVerify]) environment variables. If DOCKER_CERT_PATH is not set or empty, +// TLS configuration is not modified. // // WithTLSClientConfigFromEnv uses the following environment variables: // -// DOCKER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to -// load the TLS certificates (ca.pem, cert.pem, key.pem). -// -// DOCKER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by -// default). +// - DOCKER_CERT_PATH ([EnvOverrideCertPath]) to specify the directory from +// which to load the TLS certificates ("ca.pem", "cert.pem", "key.pem"). +// - DOCKER_TLS_VERIFY ([EnvTLSVerify]) to enable or disable TLS verification +// (off by default). func WithTLSClientConfigFromEnv() Opt { return func(c *Client) error { dockerCertPath := os.Getenv(EnvOverrideCertPath) if dockerCertPath == "" { return nil } - options := tlsconfig.Options{ + tlsc, err := tlsconfig.Client(tlsconfig.Options{ CAFile: filepath.Join(dockerCertPath, "ca.pem"), CertFile: filepath.Join(dockerCertPath, "cert.pem"), KeyFile: filepath.Join(dockerCertPath, "key.pem"), InsecureSkipVerify: os.Getenv(EnvTLSVerify) == "", - } - tlsc, err := tlsconfig.Client(options) + }) if err != nil { return err } @@ -178,7 +190,8 @@ func WithTLSClientConfigFromEnv() Opt { } // WithVersion overrides the client version with the specified one. If an empty -// version is specified, the value will be ignored to allow version negotiation. +// version is provided, the value is ignored to allow version negotiation +// (see [WithAPIVersionNegotiation]). func WithVersion(version string) Opt { return func(c *Client) error { if version != "" { @@ -190,8 +203,9 @@ func WithVersion(version string) Opt { } // WithVersionFromEnv overrides the client version with the version specified in -// the DOCKER_API_VERSION environment variable. If DOCKER_API_VERSION is not set, -// the version is not modified. +// the DOCKER_API_VERSION ([EnvOverrideAPIVersion]) environment variable. +// If DOCKER_API_VERSION is not set, or set to an empty value, the version +// is not modified. func WithVersionFromEnv() Opt { return func(c *Client) error { return WithVersion(os.Getenv(EnvOverrideAPIVersion))(c) @@ -201,10 +215,19 @@ func WithVersionFromEnv() Opt { // WithAPIVersionNegotiation enables automatic API version negotiation for the client. // With this option enabled, the client automatically negotiates the API version // to use when making requests. API version negotiation is performed on the first -// request; subsequent requests will not re-negotiate. +// request; subsequent requests do not re-negotiate. func WithAPIVersionNegotiation() Opt { return func(c *Client) error { c.negotiateVersion = true return nil } } + +// WithTraceProvider sets the trace provider for the client. +// If this is not set then the global trace provider will be used. +func WithTraceProvider(provider trace.TracerProvider) Opt { + return func(c *Client) error { + c.tp = provider + return nil + } +} diff --git a/vendor/github.com/docker/docker/client/ping.go b/vendor/github.com/docker/docker/client/ping.go index 347ae71e..bf3e9b1c 100644 --- a/vendor/github.com/docker/docker/client/ping.go +++ b/vendor/github.com/docker/docker/client/ping.go @@ -14,18 +14,21 @@ import ( // Ping pings the server and returns the value of the "Docker-Experimental", // "Builder-Version", "OS-Type" & "API-Version" headers. It attempts to use // a HEAD request on the endpoint, but falls back to GET if HEAD is not supported -// by the daemon. +// by the daemon. It ignores internal server errors returned by the API, which +// may be returned if the daemon is in an unhealthy state, but returns errors +// for other non-success status codes, failing to connect to the API, or failing +// to parse the API response. func (cli *Client) Ping(ctx context.Context) (types.Ping, error) { var ping types.Ping // Using cli.buildRequest() + cli.doRequest() instead of cli.sendRequest() // because ping requests are used during API version negotiation, so we want // to hit the non-versioned /_ping endpoint, not /v1.xx/_ping - req, err := cli.buildRequest(http.MethodHead, path.Join(cli.basePath, "/_ping"), nil, nil) + req, err := cli.buildRequest(ctx, http.MethodHead, path.Join(cli.basePath, "/_ping"), nil, nil) if err != nil { return ping, err } - serverResp, err := cli.doRequest(ctx, req) + serverResp, err := cli.doRequest(req) if err == nil { defer ensureReaderClosed(serverResp) switch serverResp.statusCode { @@ -37,11 +40,9 @@ func (cli *Client) Ping(ctx context.Context) (types.Ping, error) { return ping, err } - req, err = cli.buildRequest(http.MethodGet, path.Join(cli.basePath, "/_ping"), nil, nil) - if err != nil { - return ping, err - } - serverResp, err = cli.doRequest(ctx, req) + // HEAD failed; fallback to GET. + req.Method = http.MethodGet + serverResp, err = cli.doRequest(req) defer ensureReaderClosed(serverResp) if err != nil { return ping, err diff --git a/vendor/github.com/docker/docker/client/plugin_install.go b/vendor/github.com/docker/docker/client/plugin_install.go index 3a740ec4..69184619 100644 --- a/vendor/github.com/docker/docker/client/plugin_install.go +++ b/vendor/github.com/docker/docker/client/plugin_install.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "io" + "net/http" "net/url" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/errdefs" @@ -68,13 +69,15 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types } func (cli *Client) tryPluginPrivileges(ctx context.Context, query url.Values, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.get(ctx, "/plugins/privileges", query, headers) + return cli.get(ctx, "/plugins/privileges", query, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } func (cli *Client) tryPluginPull(ctx context.Context, query url.Values, privileges types.PluginPrivileges, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.post(ctx, "/plugins/pull", query, privileges, headers) + return cli.post(ctx, "/plugins/pull", query, privileges, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values, options types.PluginInstallOptions) (types.PluginPrivileges, error) { diff --git a/vendor/github.com/docker/docker/client/plugin_push.go b/vendor/github.com/docker/docker/client/plugin_push.go index 18f9754c..8f68a86e 100644 --- a/vendor/github.com/docker/docker/client/plugin_push.go +++ b/vendor/github.com/docker/docker/client/plugin_push.go @@ -3,14 +3,16 @@ package client // import "github.com/docker/docker/client" import ( "context" "io" + "net/http" "github.com/docker/docker/api/types/registry" ) // PluginPush pushes a plugin to a registry func (cli *Client) PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - resp, err := cli.post(ctx, "/plugins/"+name+"/push", nil, nil, headers) + resp, err := cli.post(ctx, "/plugins/"+name+"/push", nil, nil, http.Header{ + registry.AuthHeader: {registryAuth}, + }) if err != nil { return nil, err } diff --git a/vendor/github.com/docker/docker/client/plugin_upgrade.go b/vendor/github.com/docker/docker/client/plugin_upgrade.go index 995d1fd2..5cade450 100644 --- a/vendor/github.com/docker/docker/client/plugin_upgrade.go +++ b/vendor/github.com/docker/docker/client/plugin_upgrade.go @@ -3,9 +3,10 @@ package client // import "github.com/docker/docker/client" import ( "context" "io" + "net/http" "net/url" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/pkg/errors" @@ -13,7 +14,7 @@ import ( // PluginUpgrade upgrades a plugin func (cli *Client) PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) { - if err := cli.NewVersionError("1.26", "plugin upgrade"); err != nil { + if err := cli.NewVersionError(ctx, "1.26", "plugin upgrade"); err != nil { return nil, err } query := url.Values{} @@ -35,6 +36,7 @@ func (cli *Client) PluginUpgrade(ctx context.Context, name string, options types } func (cli *Client) tryPluginUpgrade(ctx context.Context, query url.Values, privileges types.PluginPrivileges, name, registryAuth string) (serverResponse, error) { - headers := map[string][]string{registry.AuthHeader: {registryAuth}} - return cli.post(ctx, "/plugins/"+name+"/upgrade", query, privileges, headers) + return cli.post(ctx, "/plugins/"+name+"/upgrade", query, privileges, http.Header{ + registry.AuthHeader: {registryAuth}, + }) } diff --git a/vendor/github.com/docker/docker/client/request.go b/vendor/github.com/docker/docker/client/request.go index bcedcf3b..50e213b5 100644 --- a/vendor/github.com/docker/docker/client/request.go +++ b/vendor/github.com/docker/docker/client/request.go @@ -10,6 +10,7 @@ import ( "net/http" "net/url" "os" + "reflect" "strings" "github.com/docker/docker/api/types" @@ -27,17 +28,17 @@ type serverResponse struct { } // head sends an http request to the docker API using the method HEAD. -func (cli *Client) head(ctx context.Context, path string, query url.Values, headers map[string][]string) (serverResponse, error) { +func (cli *Client) head(ctx context.Context, path string, query url.Values, headers http.Header) (serverResponse, error) { return cli.sendRequest(ctx, http.MethodHead, path, query, nil, headers) } // get sends an http request to the docker API using the method GET with a specific Go context. -func (cli *Client) get(ctx context.Context, path string, query url.Values, headers map[string][]string) (serverResponse, error) { +func (cli *Client) get(ctx context.Context, path string, query url.Values, headers http.Header) (serverResponse, error) { return cli.sendRequest(ctx, http.MethodGet, path, query, nil, headers) } // post sends an http request to the docker API using the method POST with a specific Go context. -func (cli *Client) post(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) { +func (cli *Client) post(ctx context.Context, path string, query url.Values, obj interface{}, headers http.Header) (serverResponse, error) { body, headers, err := encodeBody(obj, headers) if err != nil { return serverResponse{}, err @@ -45,34 +46,44 @@ func (cli *Client) post(ctx context.Context, path string, query url.Values, obj return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers) } -func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) { +func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers http.Header) (serverResponse, error) { return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers) } -func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) { +func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers http.Header) (serverResponse, error) { body, headers, err := encodeBody(obj, headers) if err != nil { return serverResponse{}, err } - return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers) + return cli.putRaw(ctx, path, query, body, headers) } // putRaw sends an http request to the docker API using the method PUT. -func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) { +func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers http.Header) (serverResponse, error) { + // PUT requests are expected to always have a body (apparently) + // so explicitly pass an empty body to sendRequest to signal that + // it should set the Content-Type header if not already present. + if body == nil { + body = http.NoBody + } return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers) } // delete sends an http request to the docker API using the method DELETE. -func (cli *Client) delete(ctx context.Context, path string, query url.Values, headers map[string][]string) (serverResponse, error) { +func (cli *Client) delete(ctx context.Context, path string, query url.Values, headers http.Header) (serverResponse, error) { return cli.sendRequest(ctx, http.MethodDelete, path, query, nil, headers) } -type headers map[string][]string - -func encodeBody(obj interface{}, headers headers) (io.Reader, headers, error) { +func encodeBody(obj interface{}, headers http.Header) (io.Reader, http.Header, error) { if obj == nil { return nil, headers, nil } + // encoding/json encodes a nil pointer as the JSON document `null`, + // irrespective of whether the type implements json.Marshaler or encoding.TextMarshaler. + // That is almost certainly not what the caller intended as the request body. + if reflect.TypeOf(obj).Kind() == reflect.Ptr && reflect.ValueOf(obj).IsNil() { + return nil, headers, nil + } body, err := encodeData(obj) if err != nil { @@ -85,13 +96,8 @@ func encodeBody(obj interface{}, headers headers) (io.Reader, headers, error) { return body, headers, nil } -func (cli *Client) buildRequest(method, path string, body io.Reader, headers headers) (*http.Request, error) { - expectedPayload := (method == http.MethodPost || method == http.MethodPut) - if expectedPayload && body == nil { - body = bytes.NewReader([]byte{}) - } - - req, err := http.NewRequest(method, path, body) +func (cli *Client) buildRequest(ctx context.Context, method, path string, body io.Reader, headers http.Header) (*http.Request, error) { + req, err := http.NewRequestWithContext(ctx, method, path, body) if err != nil { return nil, err } @@ -104,19 +110,19 @@ func (cli *Client) buildRequest(method, path string, body io.Reader, headers hea req.Host = DummyHost } - if expectedPayload && req.Header.Get("Content-Type") == "" { + if body != nil && req.Header.Get("Content-Type") == "" { req.Header.Set("Content-Type", "text/plain") } return req, nil } -func (cli *Client) sendRequest(ctx context.Context, method, path string, query url.Values, body io.Reader, headers headers) (serverResponse, error) { - req, err := cli.buildRequest(method, cli.getAPIPath(ctx, path, query), body, headers) +func (cli *Client) sendRequest(ctx context.Context, method, path string, query url.Values, body io.Reader, headers http.Header) (serverResponse, error) { + req, err := cli.buildRequest(ctx, method, cli.getAPIPath(ctx, path, query), body, headers) if err != nil { return serverResponse{}, err } - resp, err := cli.doRequest(ctx, req) + resp, err := cli.doRequest(req) switch { case errors.Is(err, context.Canceled): return serverResponse{}, errdefs.Cancelled(err) @@ -128,18 +134,18 @@ func (cli *Client) sendRequest(ctx context.Context, method, path string, query u return resp, errdefs.FromStatusCode(err, resp.statusCode) } -func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResponse, error) { +// FIXME(thaJeztah): Should this actually return a serverResp when a connection error occurred? +func (cli *Client) doRequest(req *http.Request) (serverResponse, error) { serverResp := serverResponse{statusCode: -1, reqURL: req.URL} - req = req.WithContext(ctx) resp, err := cli.client.Do(req) if err != nil { if cli.scheme != "https" && strings.Contains(err.Error(), "malformed HTTP response") { - return serverResp, fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err) + return serverResp, errConnectionFailed{fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err)} } if cli.scheme == "https" && strings.Contains(err.Error(), "bad certificate") { - return serverResp, errors.Wrap(err, "the server probably has client authentication (--tlsverify) enabled; check your TLS client certification settings") + return serverResp, errConnectionFailed{errors.Wrap(err, "the server probably has client authentication (--tlsverify) enabled; check your TLS client certification settings")} } // Don't decorate context sentinel errors; users may be comparing to @@ -148,19 +154,20 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp return serverResp, err } - if nErr, ok := err.(*url.Error); ok { - if nErr, ok := nErr.Err.(*net.OpError); ok { + if uErr, ok := err.(*url.Error); ok { + if nErr, ok := uErr.Err.(*net.OpError); ok { if os.IsPermission(nErr.Err) { - return serverResp, errors.Wrapf(err, "permission denied while trying to connect to the Docker daemon socket at %v", cli.host) + return serverResp, errConnectionFailed{errors.Wrapf(err, "permission denied while trying to connect to the Docker daemon socket at %v", cli.host)} } } } - if err, ok := err.(net.Error); ok { - if err.Timeout() { + if nErr, ok := err.(net.Error); ok { + // FIXME(thaJeztah): any net.Error should be considered a connection error (but we should include the original error)? + if nErr.Timeout() { return serverResp, ErrorConnectionFailed(cli.host) } - if strings.Contains(err.Error(), "connection refused") || strings.Contains(err.Error(), "dial unix") { + if strings.Contains(nErr.Error(), "connection refused") || strings.Contains(nErr.Error(), "dial unix") { return serverResp, ErrorConnectionFailed(cli.host) } } @@ -185,7 +192,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp } } - return serverResp, errors.Wrap(err, "error during connect") + return serverResp, errConnectionFailed{errors.Wrap(err, "error during connect")} } if resp != nil { @@ -221,26 +228,20 @@ func (cli *Client) checkResponseErr(serverResp serverResponse) error { return fmt.Errorf("request returned %s for API route and version %s, check if the server supports the requested API version", http.StatusText(serverResp.statusCode), serverResp.reqURL) } - var ct string - if serverResp.header != nil { - ct = serverResp.header.Get("Content-Type") - } - - var errorMessage string - if (cli.version == "" || versions.GreaterThan(cli.version, "1.23")) && ct == "application/json" { + var daemonErr error + if serverResp.header.Get("Content-Type") == "application/json" && (cli.version == "" || versions.GreaterThan(cli.version, "1.23")) { var errorResponse types.ErrorResponse if err := json.Unmarshal(body, &errorResponse); err != nil { return errors.Wrap(err, "Error reading JSON") } - errorMessage = strings.TrimSpace(errorResponse.Message) + daemonErr = errors.New(strings.TrimSpace(errorResponse.Message)) } else { - errorMessage = strings.TrimSpace(string(body)) + daemonErr = errors.New(strings.TrimSpace(string(body))) } - - return errors.Wrap(errors.New(errorMessage), "Error response from daemon") + return errors.Wrap(daemonErr, "Error response from daemon") } -func (cli *Client) addHeaders(req *http.Request, headers headers) *http.Request { +func (cli *Client) addHeaders(req *http.Request, headers http.Header) *http.Request { // Add CLI Config's HTTP Headers BEFORE we set the Docker headers // then the user can't change OUR headers for k, v := range cli.customHTTPHeaders { @@ -253,6 +254,14 @@ func (cli *Client) addHeaders(req *http.Request, headers headers) *http.Request for k, v := range headers { req.Header[http.CanonicalHeaderKey(k)] = v } + + if cli.userAgent != nil { + if *cli.userAgent == "" { + req.Header.Del("User-Agent") + } else { + req.Header.Set("User-Agent", *cli.userAgent) + } + } return req } diff --git a/vendor/github.com/docker/docker/client/secret_create.go b/vendor/github.com/docker/docker/client/secret_create.go index c65d38a1..7b7f1ba7 100644 --- a/vendor/github.com/docker/docker/client/secret_create.go +++ b/vendor/github.com/docker/docker/client/secret_create.go @@ -11,7 +11,7 @@ import ( // SecretCreate creates a new secret. func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error) { var response types.SecretCreateResponse - if err := cli.NewVersionError("1.25", "secret create"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "secret create"); err != nil { return response, err } resp, err := cli.post(ctx, "/secrets/create", nil, secret, nil) diff --git a/vendor/github.com/docker/docker/client/secret_inspect.go b/vendor/github.com/docker/docker/client/secret_inspect.go index 5906874b..a9cb5988 100644 --- a/vendor/github.com/docker/docker/client/secret_inspect.go +++ b/vendor/github.com/docker/docker/client/secret_inspect.go @@ -11,7 +11,7 @@ import ( // SecretInspectWithRaw returns the secret information with raw data func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.Secret, []byte, error) { - if err := cli.NewVersionError("1.25", "secret inspect"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "secret inspect"); err != nil { return swarm.Secret{}, nil, err } if id == "" { diff --git a/vendor/github.com/docker/docker/client/secret_list.go b/vendor/github.com/docker/docker/client/secret_list.go index a0289c9f..4d21639e 100644 --- a/vendor/github.com/docker/docker/client/secret_list.go +++ b/vendor/github.com/docker/docker/client/secret_list.go @@ -12,7 +12,7 @@ import ( // SecretList returns the list of secrets. func (cli *Client) SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error) { - if err := cli.NewVersionError("1.25", "secret list"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "secret list"); err != nil { return nil, err } query := url.Values{} diff --git a/vendor/github.com/docker/docker/client/secret_remove.go b/vendor/github.com/docker/docker/client/secret_remove.go index f47f68b6..079ed673 100644 --- a/vendor/github.com/docker/docker/client/secret_remove.go +++ b/vendor/github.com/docker/docker/client/secret_remove.go @@ -4,7 +4,7 @@ import "context" // SecretRemove removes a secret. func (cli *Client) SecretRemove(ctx context.Context, id string) error { - if err := cli.NewVersionError("1.25", "secret remove"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "secret remove"); err != nil { return err } resp, err := cli.delete(ctx, "/secrets/"+id, nil, nil) diff --git a/vendor/github.com/docker/docker/client/secret_update.go b/vendor/github.com/docker/docker/client/secret_update.go index 2e939e8c..9dfe6719 100644 --- a/vendor/github.com/docker/docker/client/secret_update.go +++ b/vendor/github.com/docker/docker/client/secret_update.go @@ -9,7 +9,7 @@ import ( // SecretUpdate attempts to update a secret. func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error { - if err := cli.NewVersionError("1.25", "secret update"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "secret update"); err != nil { return err } query := url.Values{} diff --git a/vendor/github.com/docker/docker/client/service_create.go b/vendor/github.com/docker/docker/client/service_create.go index b6065b8e..b72cb420 100644 --- a/vendor/github.com/docker/docker/client/service_create.go +++ b/vendor/github.com/docker/docker/client/service_create.go @@ -4,25 +4,29 @@ import ( "context" "encoding/json" "fmt" + "net/http" "strings" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" + "github.com/docker/docker/api/types/versions" "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) // ServiceCreate creates a new service. -func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) { - var response types.ServiceCreateResponse - headers := map[string][]string{ - "version": {cli.version}, - } - - if options.EncodedRegistryAuth != "" { - headers[registry.AuthHeader] = []string{options.EncodedRegistryAuth} +func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) { + var response swarm.ServiceCreateResponse + + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return response, err } // Make sure containerSpec is not nil when no runtime is set or the runtime is set to container @@ -53,6 +57,16 @@ func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, } } + headers := http.Header{} + if versions.LessThan(cli.version, "1.30") { + // the custom "version" header was used by engine API before 20.10 + // (API 1.30) to switch between client- and server-side lookup of + // image digests. + headers["version"] = []string{cli.version} + } + if options.EncodedRegistryAuth != "" { + headers[registry.AuthHeader] = []string{options.EncodedRegistryAuth} + } resp, err := cli.post(ctx, "/services/create", nil, service, headers) defer ensureReaderClosed(resp) if err != nil { diff --git a/vendor/github.com/docker/docker/client/service_logs.go b/vendor/github.com/docker/docker/client/service_logs.go index 906fd405..e9e30a2a 100644 --- a/vendor/github.com/docker/docker/client/service_logs.go +++ b/vendor/github.com/docker/docker/client/service_logs.go @@ -6,14 +6,14 @@ import ( "net/url" "time" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" timetypes "github.com/docker/docker/api/types/time" "github.com/pkg/errors" ) // ServiceLogs returns the logs generated by a service in an io.ReadCloser. // It's up to the caller to close the stream. -func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error) { +func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error) { query := url.Values{} if options.ShowStdout { query.Set("stdout", "1") diff --git a/vendor/github.com/docker/docker/client/service_update.go b/vendor/github.com/docker/docker/client/service_update.go index ff8cded8..d2f03f02 100644 --- a/vendor/github.com/docker/docker/client/service_update.go +++ b/vendor/github.com/docker/docker/client/service_update.go @@ -3,30 +3,31 @@ package client // import "github.com/docker/docker/client" import ( "context" "encoding/json" + "net/http" "net/url" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" + "github.com/docker/docker/api/types/versions" ) // ServiceUpdate updates a Service. The version number is required to avoid conflicting writes. // It should be the value as set *before* the update. You can find this value in the Meta field // of swarm.Service, which can be found using ServiceInspectWithRaw. -func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) { - var ( - query = url.Values{} - response = types.ServiceUpdateResponse{} - ) +func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { + response := swarm.ServiceUpdateResponse{} - headers := map[string][]string{ - "version": {cli.version}, - } - - if options.EncodedRegistryAuth != "" { - headers[registry.AuthHeader] = []string{options.EncodedRegistryAuth} + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return response, err } + query := url.Values{} if options.RegistryAuthFrom != "" { query.Set("registryAuthFrom", options.RegistryAuthFrom) } @@ -60,6 +61,16 @@ func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version } } + headers := http.Header{} + if versions.LessThan(cli.version, "1.30") { + // the custom "version" header was used by engine API before 20.10 + // (API 1.30) to switch between client- and server-side lookup of + // image digests. + headers["version"] = []string{cli.version} + } + if options.EncodedRegistryAuth != "" { + headers[registry.AuthHeader] = []string{options.EncodedRegistryAuth} + } resp, err := cli.post(ctx, "/services/"+serviceID+"/update", query, service, headers) defer ensureReaderClosed(resp) if err != nil { diff --git a/vendor/github.com/docker/docker/client/task_logs.go b/vendor/github.com/docker/docker/client/task_logs.go index 6222fab5..b8c20e71 100644 --- a/vendor/github.com/docker/docker/client/task_logs.go +++ b/vendor/github.com/docker/docker/client/task_logs.go @@ -6,13 +6,13 @@ import ( "net/url" "time" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" timetypes "github.com/docker/docker/api/types/time" ) // TaskLogs returns the logs generated by a task in an io.ReadCloser. // It's up to the caller to close the stream. -func (cli *Client) TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error) { +func (cli *Client) TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error) { query := url.Values{} if options.ShowStdout { query.Set("stdout", "1") diff --git a/vendor/github.com/docker/docker/client/transport.go b/vendor/github.com/docker/docker/client/transport.go deleted file mode 100644 index 55413443..00000000 --- a/vendor/github.com/docker/docker/client/transport.go +++ /dev/null @@ -1,17 +0,0 @@ -package client // import "github.com/docker/docker/client" - -import ( - "crypto/tls" - "net/http" -) - -// resolveTLSConfig attempts to resolve the TLS configuration from the -// RoundTripper. -func resolveTLSConfig(transport http.RoundTripper) *tls.Config { - switch tr := transport.(type) { - case *http.Transport: - return tr.TLSClientConfig - default: - return nil - } -} diff --git a/vendor/github.com/docker/docker/client/volume_prune.go b/vendor/github.com/docker/docker/client/volume_prune.go index 6e324708..9333f6ee 100644 --- a/vendor/github.com/docker/docker/client/volume_prune.go +++ b/vendor/github.com/docker/docker/client/volume_prune.go @@ -13,7 +13,7 @@ import ( func (cli *Client) VolumesPrune(ctx context.Context, pruneFilters filters.Args) (types.VolumesPruneReport, error) { var report types.VolumesPruneReport - if err := cli.NewVersionError("1.25", "volume prune"); err != nil { + if err := cli.NewVersionError(ctx, "1.25", "volume prune"); err != nil { return report, err } diff --git a/vendor/github.com/docker/docker/client/volume_remove.go b/vendor/github.com/docker/docker/client/volume_remove.go index 1f264383..b8bdc5ae 100644 --- a/vendor/github.com/docker/docker/client/volume_remove.go +++ b/vendor/github.com/docker/docker/client/volume_remove.go @@ -10,8 +10,16 @@ import ( // VolumeRemove removes a volume from the docker host. func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, force bool) error { query := url.Values{} - if versions.GreaterThanOrEqualTo(cli.version, "1.25") { - if force { + if force { + // Make sure we negotiated (if the client is configured to do so), + // as code below contains API-version specific handling of options. + // + // Normally, version-negotiation (if enabled) would not happen until + // the API request is made. + if err := cli.checkVersion(ctx); err != nil { + return err + } + if versions.GreaterThanOrEqualTo(cli.version, "1.25") { query.Set("force", "1") } } diff --git a/vendor/github.com/docker/docker/client/volume_update.go b/vendor/github.com/docker/docker/client/volume_update.go index 33bd31e5..151863f0 100644 --- a/vendor/github.com/docker/docker/client/volume_update.go +++ b/vendor/github.com/docker/docker/client/volume_update.go @@ -11,7 +11,7 @@ import ( // VolumeUpdate updates a volume. This only works for Cluster Volumes, and // only some fields can be updated. func (cli *Client) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error { - if err := cli.NewVersionError("1.42", "volume update"); err != nil { + if err := cli.NewVersionError(ctx, "1.42", "volume update"); err != nil { return err } diff --git a/vendor/github.com/docker/docker/errdefs/defs.go b/vendor/github.com/docker/docker/errdefs/defs.go index 61e7456b..a5523c3e 100644 --- a/vendor/github.com/docker/docker/errdefs/defs.go +++ b/vendor/github.com/docker/docker/errdefs/defs.go @@ -1,4 +1,4 @@ -package errdefs // import "github.com/docker/docker/errdefs" +package errdefs // ErrNotFound signals that the requested object doesn't exist type ErrNotFound interface { diff --git a/vendor/github.com/docker/docker/errdefs/helpers.go b/vendor/github.com/docker/docker/errdefs/helpers.go index fe06fb6f..042de4b7 100644 --- a/vendor/github.com/docker/docker/errdefs/helpers.go +++ b/vendor/github.com/docker/docker/errdefs/helpers.go @@ -1,4 +1,4 @@ -package errdefs // import "github.com/docker/docker/errdefs" +package errdefs import "context" diff --git a/vendor/github.com/docker/docker/errdefs/http_helpers.go b/vendor/github.com/docker/docker/errdefs/http_helpers.go index 77bda389..ebcd7893 100644 --- a/vendor/github.com/docker/docker/errdefs/http_helpers.go +++ b/vendor/github.com/docker/docker/errdefs/http_helpers.go @@ -1,4 +1,4 @@ -package errdefs // import "github.com/docker/docker/errdefs" +package errdefs import ( "net/http" diff --git a/vendor/github.com/docker/docker/errdefs/is.go b/vendor/github.com/docker/docker/errdefs/is.go index 3abf07d0..f94034cb 100644 --- a/vendor/github.com/docker/docker/errdefs/is.go +++ b/vendor/github.com/docker/docker/errdefs/is.go @@ -1,9 +1,18 @@ -package errdefs // import "github.com/docker/docker/errdefs" +package errdefs + +import ( + "context" + "errors" +) type causer interface { Cause() error } +type wrapErr interface { + Unwrap() error +} + func getImplementer(err error) error { switch e := err.(type) { case @@ -23,6 +32,8 @@ func getImplementer(err error) error { return err case causer: return getImplementer(e.Cause()) + case wrapErr: + return getImplementer(e.Unwrap()) default: return err } @@ -105,3 +116,8 @@ func IsDataLoss(err error) bool { _, ok := getImplementer(err).(ErrDataLoss) return ok } + +// IsContext returns if the passed in error is due to context cancellation or deadline exceeded. +func IsContext(err error) bool { + return errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) +} diff --git a/vendor/github.com/docker/docker/image/spec/specs-go/v1/image.go b/vendor/github.com/docker/docker/image/spec/specs-go/v1/image.go new file mode 100644 index 00000000..16726176 --- /dev/null +++ b/vendor/github.com/docker/docker/image/spec/specs-go/v1/image.go @@ -0,0 +1,54 @@ +package v1 + +import ( + "time" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json" + +// DockerOCIImage is a ocispec.Image extended with Docker specific Config. +type DockerOCIImage struct { + ocispec.Image + + // Shadow ocispec.Image.Config + Config DockerOCIImageConfig `json:"config,omitempty"` +} + +// DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields. +type DockerOCIImageConfig struct { + ocispec.ImageConfig + + DockerOCIImageConfigExt +} + +// DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig. +type DockerOCIImageConfigExt struct { + Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy + + OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile + Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT +} + +// HealthcheckConfig holds configuration settings for the HEALTHCHECK feature. +type HealthcheckConfig struct { + // Test is the test to perform to check that the container is healthy. + // An empty slice means to inherit the default. + // The options are: + // {} : inherit healthcheck + // {"NONE"} : disable healthcheck + // {"CMD", args...} : exec arguments directly + // {"CMD-SHELL", command} : run command with system's default shell + Test []string `json:",omitempty"` + + // Zero means to inherit. Durations are expressed as integer nanoseconds. + Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. + Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. + StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down. + StartInterval time.Duration `json:",omitempty"` // The interval to attempt healthchecks at during the start period + + // Retries is the number of consecutive failures needed to consider a container as unhealthy. + // Zero means inherit. + Retries int `json:",omitempty"` +} diff --git a/vendor/github.com/docker/docker/internal/multierror/multierror.go b/vendor/github.com/docker/docker/internal/multierror/multierror.go new file mode 100644 index 00000000..cf4d6a59 --- /dev/null +++ b/vendor/github.com/docker/docker/internal/multierror/multierror.go @@ -0,0 +1,46 @@ +package multierror + +import ( + "strings" +) + +// Join is a drop-in replacement for errors.Join with better formatting. +func Join(errs ...error) error { + n := 0 + for _, err := range errs { + if err != nil { + n++ + } + } + if n == 0 { + return nil + } + e := &joinError{ + errs: make([]error, 0, n), + } + for _, err := range errs { + if err != nil { + e.errs = append(e.errs, err) + } + } + return e +} + +type joinError struct { + errs []error +} + +func (e *joinError) Error() string { + if len(e.errs) == 1 { + return strings.TrimSpace(e.errs[0].Error()) + } + stringErrs := make([]string, 0, len(e.errs)) + for _, subErr := range e.errs { + stringErrs = append(stringErrs, strings.Replace(subErr.Error(), "\n", "\n\t", -1)) + } + return "* " + strings.Join(stringErrs, "\n* ") +} + +func (e *joinError) Unwrap() []error { + return e.errs +} diff --git a/vendor/github.com/docker/docker/pkg/archive/archive.go b/vendor/github.com/docker/docker/pkg/archive/archive.go index 34361a24..43133a09 100644 --- a/vendor/github.com/docker/docker/pkg/archive/archive.go +++ b/vendor/github.com/docker/docker/pkg/archive/archive.go @@ -21,6 +21,7 @@ import ( "time" "github.com/containerd/containerd/pkg/userns" + "github.com/containerd/log" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/pools" @@ -29,7 +30,6 @@ import ( "github.com/moby/patternmatcher" "github.com/moby/sys/sequential" "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // ImpliedDirectoryMode represents the mode (Unix permissions) applied to directories that are implied by files in a @@ -42,7 +42,7 @@ import ( // This value is currently implementation-defined, and not captured in any cross-runtime specification. Thus, it is // subject to change in Moby at any time -- image authors who require consistent or known directory permissions // should explicitly control them by ensuring that header entries exist for any applicable path. -const ImpliedDirectoryMode = 0755 +const ImpliedDirectoryMode = 0o755 type ( // Compression is the state represents if compressed or not. @@ -70,6 +70,12 @@ type ( // replaced with the matching name from this map. RebaseNames map[string]string InUserNS bool + // Allow unpacking to succeed in spite of failures to set extended + // attributes on the unpacked files due to the destination filesystem + // not supporting them or a lack of permissions. Extended attributes + // were probably in the archive for a reason, so set this option at + // your own peril. + BestEffortXattrs bool } ) @@ -199,21 +205,21 @@ func gzDecompress(ctx context.Context, buf io.Reader) (io.ReadCloser, error) { if noPigzEnv := os.Getenv("MOBY_DISABLE_PIGZ"); noPigzEnv != "" { noPigz, err := strconv.ParseBool(noPigzEnv) if err != nil { - logrus.WithError(err).Warn("invalid value in MOBY_DISABLE_PIGZ env var") + log.G(ctx).WithError(err).Warn("invalid value in MOBY_DISABLE_PIGZ env var") } if noPigz { - logrus.Debugf("Use of pigz is disabled due to MOBY_DISABLE_PIGZ=%s", noPigzEnv) + log.G(ctx).Debugf("Use of pigz is disabled due to MOBY_DISABLE_PIGZ=%s", noPigzEnv) return gzip.NewReader(buf) } } unpigzPath, err := exec.LookPath("unpigz") if err != nil { - logrus.Debugf("unpigz binary not found, falling back to go gzip library") + log.G(ctx).Debugf("unpigz binary not found, falling back to go gzip library") return gzip.NewReader(buf) } - logrus.Debugf("Using %s to decompress", unpigzPath) + log.G(ctx).Debugf("Using %s to decompress", unpigzPath) return cmdStream(exec.CommandContext(ctx, unpigzPath, "-d", "-c"), buf) } @@ -475,6 +481,8 @@ func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, erro return hdr, nil } +const paxSchilyXattr = "SCHILY.xattr." + // ReadSecurityXattrToTarHeader reads security.capability xattr from filesystem // to a tar header func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error { @@ -487,15 +495,16 @@ func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error { ) capability, _ := system.Lgetxattr(path, "security.capability") if capability != nil { - length := len(capability) if capability[versionOffset] == vfsCapRevision3 { // Convert VFS_CAP_REVISION_3 to VFS_CAP_REVISION_2 as root UID makes no // sense outside the user namespace the archive is built in. capability[versionOffset] = vfsCapRevision2 - length = xattrCapsSz2 + capability = capability[:xattrCapsSz2] + } + if hdr.PAXRecords == nil { + hdr.PAXRecords = make(map[string]string) } - hdr.Xattrs = make(map[string]string) - hdr.Xattrs["security.capability"] = string(capability[:length]) + hdr.PAXRecords[paxSchilyXattr+"security.capability"] = string(capability) } return nil } @@ -666,7 +675,19 @@ func (ta *tarAppender) addTarFile(path, name string) error { return nil } -func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, Lchown bool, chownOpts *idtools.Identity, inUserns bool) error { +func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, opts *TarOptions) error { + var ( + Lchown = true + inUserns, bestEffortXattrs bool + chownOpts *idtools.Identity + ) + if opts != nil { + Lchown = !opts.NoLchown + inUserns = opts.InUserNS + chownOpts = opts.ChownOpts + bestEffortXattrs = opts.BestEffortXattrs + } + // hdr.Mode is in linux format, which we can use for sycalls, // but for os.Foo() calls we need the mode converted to os.FileMode, // so use hdrInfo.Mode() (they differ for e.g. setuid bits) @@ -736,7 +757,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L } case tar.TypeXGlobalHeader: - logrus.Debug("PAX Global Extended Headers found and ignored") + log.G(context.TODO()).Debug("PAX Global Extended Headers found and ignored") return nil default: @@ -757,26 +778,26 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L } } - var errors []string - for key, value := range hdr.Xattrs { - if err := system.Lsetxattr(path, key, []byte(value), 0); err != nil { - if err == syscall.ENOTSUP || err == syscall.EPERM { - // We ignore errors here because not all graphdrivers support - // xattrs *cough* old versions of AUFS *cough*. However only - // ENOTSUP should be emitted in that case, otherwise we still - // bail. + var xattrErrs []string + for key, value := range hdr.PAXRecords { + xattr, ok := strings.CutPrefix(key, paxSchilyXattr) + if !ok { + continue + } + if err := system.Lsetxattr(path, xattr, []byte(value), 0); err != nil { + if bestEffortXattrs && errors.Is(err, syscall.ENOTSUP) || errors.Is(err, syscall.EPERM) { // EPERM occurs if modifying xattrs is not allowed. This can // happen when running in userns with restrictions (ChromeOS). - errors = append(errors, err.Error()) + xattrErrs = append(xattrErrs, err.Error()) continue } return err } } - if len(errors) > 0 { - logrus.WithFields(logrus.Fields{ - "errors": errors, + if len(xattrErrs) > 0 { + log.G(context.TODO()).WithFields(log.Fields{ + "errors": xattrErrs, }).Warn("ignored xattrs in archive: underlying filesystem doesn't support them") } @@ -893,13 +914,13 @@ func (t *Tarballer) Do() { defer func() { // Make sure to check the error on Close. if err := ta.TarWriter.Close(); err != nil { - logrus.Errorf("Can't close tar writer: %s", err) + log.G(context.TODO()).Errorf("Can't close tar writer: %s", err) } if err := t.compressWriter.Close(); err != nil { - logrus.Errorf("Can't close compress writer: %s", err) + log.G(context.TODO()).Errorf("Can't close compress writer: %s", err) } if err := t.pipeWriter.Close(); err != nil { - logrus.Errorf("Can't close pipe writer: %s", err) + log.G(context.TODO()).Errorf("Can't close pipe writer: %s", err) } }() @@ -922,7 +943,7 @@ func (t *Tarballer) Do() { // directory. So, we must split the source path and use the // basename as the include. if len(t.options.IncludeFiles) > 0 { - logrus.Warn("Tar: Can't archive a file with includes") + log.G(context.TODO()).Warn("Tar: Can't archive a file with includes") } dir, base := SplitPathDirEntry(t.srcPath) @@ -947,7 +968,7 @@ func (t *Tarballer) Do() { walkRoot := getWalkRoot(t.srcPath, include) filepath.WalkDir(walkRoot, func(filePath string, f os.DirEntry, err error) error { if err != nil { - logrus.Errorf("Tar: Can't stat file %s to tar: %s", t.srcPath, err) + log.G(context.TODO()).Errorf("Tar: Can't stat file %s to tar: %s", t.srcPath, err) return nil } @@ -986,7 +1007,7 @@ func (t *Tarballer) Do() { skip, matchInfo, err = t.pm.MatchesUsingParentResults(relFilePath, patternmatcher.MatchInfo{}) } if err != nil { - logrus.Errorf("Error matching %s: %v", relFilePath, err) + log.G(context.TODO()).Errorf("Error matching %s: %v", relFilePath, err) return err } @@ -1047,7 +1068,7 @@ func (t *Tarballer) Do() { } if err := ta.addTarFile(filePath, relFilePath); err != nil { - logrus.Errorf("Can't add file %s to tar: %s", filePath, err) + log.G(context.TODO()).Errorf("Can't add file %s to tar: %s", filePath, err) // if pipe is broken, stop writing tar stream to it if err == io.ErrClosedPipe { return err @@ -1084,7 +1105,7 @@ loop: // ignore XGlobalHeader early to avoid creating parent directories for them if hdr.Typeflag == tar.TypeXGlobalHeader { - logrus.Debugf("PAX Global Extended Headers found for %s and ignored", hdr.Name) + log.G(context.TODO()).Debugf("PAX Global Extended Headers found for %s and ignored", hdr.Name) continue } @@ -1158,7 +1179,7 @@ loop: } } - if err := createTarFile(path, dest, hdr, trBuf, !options.NoLchown, options.ChownOpts, options.InUserNS); err != nil { + if err := createTarFile(path, dest, hdr, trBuf, options); err != nil { return err } @@ -1297,7 +1318,7 @@ func (archiver *Archiver) CopyWithTar(src, dst string) error { // as owner rootIDs := archiver.IDMapping.RootPair() // Create dst, copy src's content into it - if err := idtools.MkdirAllAndChownNew(dst, 0755, rootIDs); err != nil { + if err := idtools.MkdirAllAndChownNew(dst, 0o755, rootIDs); err != nil { return err } return archiver.TarUntar(src, dst) @@ -1322,7 +1343,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) { dst = filepath.Join(dst, filepath.Base(src)) } // Create the holding directory if necessary - if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil { + if err := system.MkdirAll(filepath.Dir(dst), 0o700); err != nil { return err } diff --git a/vendor/github.com/docker/docker/pkg/archive/archive_linux.go b/vendor/github.com/docker/docker/pkg/archive/archive_linux.go index 76321a35..2c3786cd 100644 --- a/vendor/github.com/docker/docker/pkg/archive/archive_linux.go +++ b/vendor/github.com/docker/docker/pkg/archive/archive_linux.go @@ -21,8 +21,7 @@ func getWhiteoutConverter(format WhiteoutFormat, inUserNS bool) (tarWhiteoutConv return nil, nil } -type overlayWhiteoutConverter struct { -} +type overlayWhiteoutConverter struct{} func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os.FileInfo) (wo *tar.Header, err error) { // convert whiteouts to AUFS format @@ -30,7 +29,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os // we just rename the file and make it normal dir, filename := filepath.Split(hdr.Name) hdr.Name = filepath.Join(dir, WhiteoutPrefix+filename) - hdr.Mode = 0600 + hdr.Mode = 0o600 hdr.Typeflag = tar.TypeReg hdr.Size = 0 } @@ -42,9 +41,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os return nil, err } if len(opaque) == 1 && opaque[0] == 'y' { - if hdr.Xattrs != nil { - delete(hdr.Xattrs, "trusted.overlay.opaque") - } + delete(hdr.PAXRecords, paxSchilyXattr+"trusted.overlay.opaque") // create a header for the whiteout file // it should inherit some properties from the parent, but be a regular file diff --git a/vendor/github.com/docker/docker/pkg/archive/archive_other.go b/vendor/github.com/docker/docker/pkg/archive/archive_other.go index 28ae2769..3de1d64c 100644 --- a/vendor/github.com/docker/docker/pkg/archive/archive_other.go +++ b/vendor/github.com/docker/docker/pkg/archive/archive_other.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package archive // import "github.com/docker/docker/pkg/archive" diff --git a/vendor/github.com/docker/docker/pkg/archive/archive_unix.go b/vendor/github.com/docker/docker/pkg/archive/archive_unix.go index 92d8e23d..ff59d019 100644 --- a/vendor/github.com/docker/docker/pkg/archive/archive_unix.go +++ b/vendor/github.com/docker/docker/pkg/archive/archive_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package archive // import "github.com/docker/docker/pkg/archive" @@ -8,6 +7,7 @@ import ( "errors" "os" "path/filepath" + "runtime" "strings" "syscall" @@ -44,6 +44,20 @@ func chmodTarEntry(perm os.FileMode) os.FileMode { // statUnix populates hdr from system-dependent fields of fi without performing // any OS lookups. func statUnix(fi os.FileInfo, hdr *tar.Header) error { + // Devmajor and Devminor are only needed for special devices. + + // In FreeBSD, RDev for regular files is -1 (unless overridden by FS): + // https://cgit.freebsd.org/src/tree/sys/kern/vfs_default.c?h=stable/13#n1531 + // (NODEV is -1: https://cgit.freebsd.org/src/tree/sys/sys/param.h?h=stable/13#n241). + + // ZFS in particular does not override the default: + // https://cgit.freebsd.org/src/tree/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c?h=stable/13#n2027 + + // Since `Stat_t.Rdev` is uint64, the cast turns -1 into (2^64 - 1). + // Such large values cannot be encoded in a tar header. + if runtime.GOOS == "freebsd" && hdr.Typeflag != tar.TypeBlock && hdr.Typeflag != tar.TypeChar { + return nil + } s, ok := fi.Sys().(*syscall.Stat_t) if !ok { return nil @@ -83,7 +97,7 @@ func getFileUIDGID(stat interface{}) (idtools.Identity, error) { // handleTarTypeBlockCharFifo is an OS-specific helper function used by // createTarFile to handle the following types of header: Block; Char; Fifo func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { - mode := uint32(hdr.Mode & 07777) + mode := uint32(hdr.Mode & 0o7777) switch hdr.Typeflag { case tar.TypeBlock: mode |= unix.S_IFBLK diff --git a/vendor/github.com/docker/docker/pkg/archive/changes.go b/vendor/github.com/docker/docker/pkg/archive/changes.go index 7f7242be..f9f16c92 100644 --- a/vendor/github.com/docker/docker/pkg/archive/changes.go +++ b/vendor/github.com/docker/docker/pkg/archive/changes.go @@ -3,6 +3,7 @@ package archive // import "github.com/docker/docker/pkg/archive" import ( "archive/tar" "bytes" + "context" "fmt" "io" "os" @@ -12,10 +13,10 @@ import ( "syscall" "time" + "github.com/containerd/log" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/system" - "github.com/sirupsen/logrus" ) // ChangeType represents the change type. @@ -107,8 +108,10 @@ func aufsDeletedFile(root, path string, fi os.FileInfo) (string, error) { return "", nil } -type skipChange func(string) (bool, error) -type deleteChange func(string, string, os.FileInfo) (string, error) +type ( + skipChange func(string) (bool, error) + deleteChange func(string, string, os.FileInfo) (string, error) +) func changes(layers []string, rw string, dc deleteChange, sc skipChange) ([]Change, error) { var ( @@ -341,9 +344,7 @@ func newRootFileInfo() *FileInfo { // ChangesDirs compares two directories and generates an array of Change objects describing the changes. // If oldDir is "", then all files in newDir will be Add-Changes. func ChangesDirs(newDir, oldDir string) ([]Change, error) { - var ( - oldRoot, newRoot *FileInfo - ) + var oldRoot, newRoot *FileInfo if oldDir == "" { emptyDir, err := os.MkdirTemp("", "empty") if err != nil { @@ -371,7 +372,7 @@ func ChangesSize(newDir string, changes []Change) int64 { file := filepath.Join(newDir, change.Path) fileInfo, err := os.Lstat(file) if err != nil { - logrus.Errorf("Can not stat %q: %s", file, err) + log.G(context.TODO()).Errorf("Can not stat %q: %s", file, err) continue } @@ -420,22 +421,22 @@ func ExportChanges(dir string, changes []Change, idMap idtools.IdentityMapping) ChangeTime: timestamp, } if err := ta.TarWriter.WriteHeader(hdr); err != nil { - logrus.Debugf("Can't write whiteout header: %s", err) + log.G(context.TODO()).Debugf("Can't write whiteout header: %s", err) } } else { path := filepath.Join(dir, change.Path) if err := ta.addTarFile(path, change.Path[1:]); err != nil { - logrus.Debugf("Can't add file %s to tar: %s", path, err) + log.G(context.TODO()).Debugf("Can't add file %s to tar: %s", path, err) } } } // Make sure to check the error on Close. if err := ta.TarWriter.Close(); err != nil { - logrus.Debugf("Can't close layer: %s", err) + log.G(context.TODO()).Debugf("Can't close layer: %s", err) } if err := writer.Close(); err != nil { - logrus.Debugf("failed close Changes writer: %s", err) + log.G(context.TODO()).Debugf("failed close Changes writer: %s", err) } }() return reader, nil diff --git a/vendor/github.com/docker/docker/pkg/archive/changes_linux.go b/vendor/github.com/docker/docker/pkg/archive/changes_linux.go index f8792b3d..81fcbc5b 100644 --- a/vendor/github.com/docker/docker/pkg/archive/changes_linux.go +++ b/vendor/github.com/docker/docker/pkg/archive/changes_linux.go @@ -267,7 +267,7 @@ func parseDirent(buf []byte, names []nameIno) (consumed int, newnames []nameIno) continue } bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0])) - var name = string(bytes[0:clen(bytes[:])]) + name := string(bytes[0:clen(bytes[:])]) if name == "." || name == ".." { // Useless names continue } diff --git a/vendor/github.com/docker/docker/pkg/archive/changes_other.go b/vendor/github.com/docker/docker/pkg/archive/changes_other.go index 833798bd..13a7d3c0 100644 --- a/vendor/github.com/docker/docker/pkg/archive/changes_other.go +++ b/vendor/github.com/docker/docker/pkg/archive/changes_other.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package archive // import "github.com/docker/docker/pkg/archive" diff --git a/vendor/github.com/docker/docker/pkg/archive/changes_unix.go b/vendor/github.com/docker/docker/pkg/archive/changes_unix.go index 54aace97..853c73ee 100644 --- a/vendor/github.com/docker/docker/pkg/archive/changes_unix.go +++ b/vendor/github.com/docker/docker/pkg/archive/changes_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package archive // import "github.com/docker/docker/pkg/archive" diff --git a/vendor/github.com/docker/docker/pkg/archive/copy.go b/vendor/github.com/docker/docker/pkg/archive/copy.go index 0ea15962..01eadc30 100644 --- a/vendor/github.com/docker/docker/pkg/archive/copy.go +++ b/vendor/github.com/docker/docker/pkg/archive/copy.go @@ -2,14 +2,15 @@ package archive // import "github.com/docker/docker/pkg/archive" import ( "archive/tar" + "context" "errors" "io" "os" "path/filepath" "strings" + "github.com/containerd/log" "github.com/docker/docker/pkg/system" - "github.com/sirupsen/logrus" ) // Errors used or returned by this file. @@ -107,7 +108,7 @@ func TarResourceRebase(sourcePath, rebaseName string) (content io.ReadCloser, er sourceDir, sourceBase := SplitPathDirEntry(sourcePath) opts := TarResourceRebaseOpts(sourceBase, rebaseName) - logrus.Debugf("copying %q from %q", sourceBase, sourceDir) + log.G(context.TODO()).Debugf("copying %q from %q", sourceBase, sourceDir) return TarWithOptions(sourceDir, opts) } diff --git a/vendor/github.com/docker/docker/pkg/archive/copy_unix.go b/vendor/github.com/docker/docker/pkg/archive/copy_unix.go index 2ac7729f..065bd4ad 100644 --- a/vendor/github.com/docker/docker/pkg/archive/copy_unix.go +++ b/vendor/github.com/docker/docker/pkg/archive/copy_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package archive // import "github.com/docker/docker/pkg/archive" diff --git a/vendor/github.com/docker/docker/pkg/archive/diff.go b/vendor/github.com/docker/docker/pkg/archive/diff.go index 1a2fb971..318f5942 100644 --- a/vendor/github.com/docker/docker/pkg/archive/diff.go +++ b/vendor/github.com/docker/docker/pkg/archive/diff.go @@ -2,6 +2,7 @@ package archive // import "github.com/docker/docker/pkg/archive" import ( "archive/tar" + "context" "fmt" "io" "os" @@ -9,9 +10,9 @@ import ( "runtime" "strings" + "github.com/containerd/log" "github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/system" - "github.com/sirupsen/logrus" ) // UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be @@ -67,7 +68,7 @@ func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, // image but have it tagged as Windows inadvertently. if runtime.GOOS == "windows" { if strings.Contains(hdr.Name, ":") { - logrus.Warnf("Windows: Ignoring %s (is this a Linux image?)", hdr.Name) + log.G(context.TODO()).Warnf("Windows: Ignoring %s (is this a Linux image?)", hdr.Name) continue } } @@ -92,7 +93,7 @@ func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, } defer os.RemoveAll(aufsTempdir) } - if err := createTarFile(filepath.Join(aufsTempdir, basename), dest, hdr, tr, true, nil, options.InUserNS); err != nil { + if err := createTarFile(filepath.Join(aufsTempdir, basename), dest, hdr, tr, options); err != nil { return 0, err } } @@ -183,7 +184,7 @@ func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, return 0, err } - if err := createTarFile(path, dest, srcHdr, srcData, !options.NoLchown, nil, options.InUserNS); err != nil { + if err := createTarFile(path, dest, srcHdr, srcData, options); err != nil { return 0, err } diff --git a/vendor/github.com/docker/docker/pkg/archive/diff_unix.go b/vendor/github.com/docker/docker/pkg/archive/diff_unix.go index d7f80644..7216f2f4 100644 --- a/vendor/github.com/docker/docker/pkg/archive/diff_unix.go +++ b/vendor/github.com/docker/docker/pkg/archive/diff_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package archive diff --git a/vendor/github.com/docker/docker/pkg/archive/path_unix.go b/vendor/github.com/docker/docker/pkg/archive/path_unix.go index 0b135aea..390264bf 100644 --- a/vendor/github.com/docker/docker/pkg/archive/path_unix.go +++ b/vendor/github.com/docker/docker/pkg/archive/path_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package archive diff --git a/vendor/github.com/docker/docker/pkg/archive/time_unsupported.go b/vendor/github.com/docker/docker/pkg/archive/time_unsupported.go index d0877968..14c4ceb1 100644 --- a/vendor/github.com/docker/docker/pkg/archive/time_unsupported.go +++ b/vendor/github.com/docker/docker/pkg/archive/time_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package archive // import "github.com/docker/docker/pkg/archive" diff --git a/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go b/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go index 2194c47d..cd621bdc 100644 --- a/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go +++ b/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package idtools // import "github.com/docker/docker/pkg/idtools" @@ -13,7 +12,7 @@ import ( "strconv" "syscall" - "github.com/opencontainers/runc/libcontainer/user" + "github.com/moby/sys/user" ) func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error { diff --git a/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go b/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go index 5e24577e..6a9311c4 100644 --- a/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go +++ b/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package idtools // import "github.com/docker/docker/pkg/idtools" diff --git a/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go b/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go index 05cc6963..517a2f52 100644 --- a/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go +++ b/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package idtools // import "github.com/docker/docker/pkg/idtools" diff --git a/vendor/github.com/docker/docker/pkg/ioutils/readers.go b/vendor/github.com/docker/docker/pkg/ioutils/readers.go index d82ae930..e03d3fee 100644 --- a/vendor/github.com/docker/docker/pkg/ioutils/readers.go +++ b/vendor/github.com/docker/docker/pkg/ioutils/readers.go @@ -11,7 +11,7 @@ import ( _ "crypto/sha256" _ "crypto/sha512" - "github.com/sirupsen/logrus" + "github.com/containerd/log" ) // ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser @@ -165,8 +165,8 @@ func (p *cancelReadCloser) Close() error { } func subsequentCloseWarn(name string) { - logrus.Error("subsequent attempt to close " + name) - if logrus.GetLevel() >= logrus.DebugLevel { - logrus.Errorf("stack trace: %s", string(debug.Stack())) + log.G(context.TODO()).Error("subsequent attempt to close " + name) + if log.GetLevel() >= log.DebugLevel { + log.G(context.TODO()).Errorf("stack trace: %s", string(debug.Stack())) } } diff --git a/vendor/github.com/docker/docker/pkg/ioutils/tempdir_deprecated.go b/vendor/github.com/docker/docker/pkg/ioutils/tempdir_deprecated.go deleted file mode 100644 index b3321602..00000000 --- a/vendor/github.com/docker/docker/pkg/ioutils/tempdir_deprecated.go +++ /dev/null @@ -1,10 +0,0 @@ -package ioutils - -import "github.com/docker/docker/pkg/longpath" - -// TempDir is the equivalent of [os.MkdirTemp], except that on Windows -// the result is in Windows longpath format. On Unix systems it is -// equivalent to [os.MkdirTemp]. -// -// Deprecated: use [longpath.MkdirTemp]. -var TempDir = longpath.MkdirTemp diff --git a/vendor/github.com/docker/docker/pkg/meminfo/meminfo.go b/vendor/github.com/docker/docker/pkg/meminfo/meminfo.go deleted file mode 100644 index 4f33ad26..00000000 --- a/vendor/github.com/docker/docker/pkg/meminfo/meminfo.go +++ /dev/null @@ -1,26 +0,0 @@ -// Package meminfo provides utilites to retrieve memory statistics of -// the host system. -package meminfo - -// Read retrieves memory statistics of the host system and returns a -// Memory type. It is only supported on Linux and Windows, and returns an -// error on other platforms. -func Read() (*Memory, error) { - return readMemInfo() -} - -// Memory contains memory statistics of the host system. -type Memory struct { - // Total usable RAM (i.e. physical RAM minus a few reserved bits and the - // kernel binary code). - MemTotal int64 - - // Amount of free memory. - MemFree int64 - - // Total amount of swap space available. - SwapTotal int64 - - // Amount of swap space that is currently unused. - SwapFree int64 -} diff --git a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_linux.go b/vendor/github.com/docker/docker/pkg/meminfo/meminfo_linux.go deleted file mode 100644 index 0c1cd21d..00000000 --- a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_linux.go +++ /dev/null @@ -1,69 +0,0 @@ -package meminfo - -import ( - "bufio" - "io" - "os" - "strconv" - "strings" -) - -// readMemInfo retrieves memory statistics of the host system and returns a -// Memory type. -func readMemInfo() (*Memory, error) { - file, err := os.Open("/proc/meminfo") - if err != nil { - return nil, err - } - defer file.Close() - return parseMemInfo(file) -} - -// parseMemInfo parses the /proc/meminfo file into -// a Memory object given an io.Reader to the file. -// Throws error if there are problems reading from the file -func parseMemInfo(reader io.Reader) (*Memory, error) { - meminfo := &Memory{} - scanner := bufio.NewScanner(reader) - memAvailable := int64(-1) - for scanner.Scan() { - // Expected format: ["MemTotal:", "1234", "kB"] - parts := strings.Fields(scanner.Text()) - - // Sanity checks: Skip malformed entries. - if len(parts) < 3 || parts[2] != "kB" { - continue - } - - // Convert to bytes. - size, err := strconv.Atoi(parts[1]) - if err != nil { - continue - } - // Convert to KiB - bytes := int64(size) * 1024 - - switch parts[0] { - case "MemTotal:": - meminfo.MemTotal = bytes - case "MemFree:": - meminfo.MemFree = bytes - case "MemAvailable:": - memAvailable = bytes - case "SwapTotal:": - meminfo.SwapTotal = bytes - case "SwapFree:": - meminfo.SwapFree = bytes - } - } - if memAvailable != -1 { - meminfo.MemFree = memAvailable - } - - // Handle errors that may have occurred during the reading of the file. - if err := scanner.Err(); err != nil { - return nil, err - } - - return meminfo, nil -} diff --git a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_unsupported.go b/vendor/github.com/docker/docker/pkg/meminfo/meminfo_unsupported.go deleted file mode 100644 index ebfadd53..00000000 --- a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_unsupported.go +++ /dev/null @@ -1,11 +0,0 @@ -//go:build !linux && !windows -// +build !linux,!windows - -package meminfo - -import "errors" - -// readMemInfo is not supported on platforms other than linux and windows. -func readMemInfo() (*Memory, error) { - return nil, errors.New("platform and architecture is not supported") -} diff --git a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_windows.go b/vendor/github.com/docker/docker/pkg/meminfo/meminfo_windows.go deleted file mode 100644 index aa7d9375..00000000 --- a/vendor/github.com/docker/docker/pkg/meminfo/meminfo_windows.go +++ /dev/null @@ -1,45 +0,0 @@ -package meminfo - -import ( - "unsafe" - - "golang.org/x/sys/windows" -) - -var ( - modkernel32 = windows.NewLazySystemDLL("kernel32.dll") - - procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") -) - -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx -type memorystatusex struct { - dwLength uint32 - dwMemoryLoad uint32 - ullTotalPhys uint64 - ullAvailPhys uint64 - ullTotalPageFile uint64 - ullAvailPageFile uint64 - ullTotalVirtual uint64 - ullAvailVirtual uint64 - ullAvailExtendedVirtual uint64 -} - -// readMemInfo retrieves memory statistics of the host system and returns a -// Memory type. -func readMemInfo() (*Memory, error) { - msi := &memorystatusex{ - dwLength: 64, - } - r1, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(msi))) - if r1 == 0 { - return &Memory{}, nil - } - return &Memory{ - MemTotal: int64(msi.ullTotalPhys), - MemFree: int64(msi.ullAvailPhys), - SwapTotal: int64(msi.ullTotalPageFile), - SwapFree: int64(msi.ullAvailPageFile), - }, nil -} diff --git a/vendor/github.com/docker/docker/pkg/process/doc.go b/vendor/github.com/docker/docker/pkg/process/doc.go deleted file mode 100644 index dae536d7..00000000 --- a/vendor/github.com/docker/docker/pkg/process/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package process provides a set of basic functions to manage individual -// processes. -package process diff --git a/vendor/github.com/docker/docker/pkg/process/process_unix.go b/vendor/github.com/docker/docker/pkg/process/process_unix.go deleted file mode 100644 index daf39236..00000000 --- a/vendor/github.com/docker/docker/pkg/process/process_unix.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build !windows -// +build !windows - -package process - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - "runtime" - "strconv" - - "golang.org/x/sys/unix" -) - -// Alive returns true if process with a given pid is running. It only considers -// positive PIDs; 0 (all processes in the current process group), -1 (all processes -// with a PID larger than 1), and negative (-n, all processes in process group -// "n") values for pid are never considered to be alive. -func Alive(pid int) bool { - if pid < 1 { - return false - } - switch runtime.GOOS { - case "darwin": - // OS X does not have a proc filesystem. Use kill -0 pid to judge if the - // process exists. From KILL(2): https://www.freebsd.org/cgi/man.cgi?query=kill&sektion=2&manpath=OpenDarwin+7.2.1 - // - // Sig may be one of the signals specified in sigaction(2) or it may - // be 0, in which case error checking is performed but no signal is - // actually sent. This can be used to check the validity of pid. - err := unix.Kill(pid, 0) - - // Either the PID was found (no error) or we get an EPERM, which means - // the PID exists, but we don't have permissions to signal it. - return err == nil || err == unix.EPERM - default: - _, err := os.Stat(filepath.Join("/proc", strconv.Itoa(pid))) - return err == nil - } -} - -// Kill force-stops a process. It only considers positive PIDs; 0 (all processes -// in the current process group), -1 (all processes with a PID larger than 1), -// and negative (-n, all processes in process group "n") values for pid are -// ignored. Refer to [KILL(2)] for details. -// -// [KILL(2)]: https://man7.org/linux/man-pages/man2/kill.2.html -func Kill(pid int) error { - if pid < 1 { - return fmt.Errorf("invalid PID (%d): only positive PIDs are allowed", pid) - } - err := unix.Kill(pid, unix.SIGKILL) - if err != nil && err != unix.ESRCH { - return err - } - return nil -} - -// Zombie return true if process has a state with "Z". It only considers positive -// PIDs; 0 (all processes in the current process group), -1 (all processes with -// a PID larger than 1), and negative (-n, all processes in process group "n") -// values for pid are ignored. Refer to [PROC(5)] for details. -// -// [PROC(5)]: https://man7.org/linux/man-pages/man5/proc.5.html -func Zombie(pid int) (bool, error) { - if pid < 1 { - return false, nil - } - data, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid)) - if err != nil { - if os.IsNotExist(err) { - return false, nil - } - return false, err - } - if cols := bytes.SplitN(data, []byte(" "), 4); len(cols) >= 3 && string(cols[2]) == "Z" { - return true, nil - } - return false, nil -} diff --git a/vendor/github.com/docker/docker/pkg/process/process_windows.go b/vendor/github.com/docker/docker/pkg/process/process_windows.go deleted file mode 100644 index 26158d09..00000000 --- a/vendor/github.com/docker/docker/pkg/process/process_windows.go +++ /dev/null @@ -1,52 +0,0 @@ -package process - -import ( - "os" - - "golang.org/x/sys/windows" -) - -// Alive returns true if process with a given pid is running. -func Alive(pid int) bool { - h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid)) - if err != nil { - return false - } - var c uint32 - err = windows.GetExitCodeProcess(h, &c) - _ = windows.CloseHandle(h) - if err != nil { - // From the GetExitCodeProcess function (processthreadsapi.h) API docs: - // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess - // - // The GetExitCodeProcess function returns a valid error code defined by the - // application only after the thread terminates. Therefore, an application should - // not use STILL_ACTIVE (259) as an error code (STILL_ACTIVE is a macro for - // STATUS_PENDING (minwinbase.h)). If a thread returns STILL_ACTIVE (259) as - // an error code, then applications that test for that value could interpret it - // to mean that the thread is still running, and continue to test for the - // completion of the thread after the thread has terminated, which could put - // the application into an infinite loop. - return c == uint32(windows.STATUS_PENDING) - } - return true -} - -// Kill force-stops a process. -func Kill(pid int) error { - p, err := os.FindProcess(pid) - if err == nil { - err = p.Kill() - if err != nil && err != os.ErrProcessDone { - return err - } - } - return nil -} - -// Zombie is not supported on Windows. -// -// TODO(thaJeztah): remove once we remove the stubs from pkg/system. -func Zombie(_ int) (bool, error) { - return false, nil -} diff --git a/vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go b/vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go index 84ae1570..92ff0209 100644 --- a/vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go +++ b/vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/errors.go b/vendor/github.com/docker/docker/pkg/system/errors.go index 2573d716..f4bbcce7 100644 --- a/vendor/github.com/docker/docker/pkg/system/errors.go +++ b/vendor/github.com/docker/docker/pkg/system/errors.go @@ -1,13 +1,6 @@ package system // import "github.com/docker/docker/pkg/system" -import ( - "errors" -) +import "errors" -var ( - // ErrNotSupportedPlatform means the platform is not supported. - ErrNotSupportedPlatform = errors.New("platform and architecture is not supported") - - // ErrNotSupportedOperatingSystem means the operating system is not supported. - ErrNotSupportedOperatingSystem = errors.New("operating system is not supported") -) +// ErrNotSupportedPlatform means the platform is not supported. +var ErrNotSupportedPlatform = errors.New("platform and architecture is not supported") diff --git a/vendor/github.com/docker/docker/pkg/system/filesys_unix.go b/vendor/github.com/docker/docker/pkg/system/filesys_unix.go index 38011294..f01f9385 100644 --- a/vendor/github.com/docker/docker/pkg/system/filesys_unix.go +++ b/vendor/github.com/docker/docker/pkg/system/filesys_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/image_os.go b/vendor/github.com/docker/docker/pkg/system/image_os.go deleted file mode 100644 index e3de86be..00000000 --- a/vendor/github.com/docker/docker/pkg/system/image_os.go +++ /dev/null @@ -1,10 +0,0 @@ -package system // import "github.com/docker/docker/pkg/system" -import ( - "runtime" - "strings" -) - -// IsOSSupported determines if an operating system is supported by the host. -func IsOSSupported(os string) bool { - return strings.EqualFold(runtime.GOOS, os) -} diff --git a/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go b/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go new file mode 100644 index 00000000..afb57dae --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go @@ -0,0 +1,19 @@ +package system + +import ( + "errors" + "runtime" + "strings" +) + +// ErrNotSupportedOperatingSystem means the operating system is not supported. +// +// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned. +var ErrNotSupportedOperatingSystem = errors.New("operating system is not supported") + +// IsOSSupported determines if an operating system is supported by the host. +// +// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned. +func IsOSSupported(os string) bool { + return strings.EqualFold(runtime.GOOS, os) +} diff --git a/vendor/github.com/docker/docker/pkg/system/init_windows.go b/vendor/github.com/docker/docker/pkg/system/init_windows.go index 3c2a43dd..7603efbb 100644 --- a/vendor/github.com/docker/docker/pkg/system/init_windows.go +++ b/vendor/github.com/docker/docker/pkg/system/init_windows.go @@ -1,9 +1,7 @@ package system // import "github.com/docker/docker/pkg/system" -var ( - // containerdRuntimeSupported determines if containerd should be the runtime. - containerdRuntimeSupported = false -) +// containerdRuntimeSupported determines if containerd should be the runtime. +var containerdRuntimeSupported = false // InitContainerdRuntime sets whether to use containerd for runtime on Windows. func InitContainerdRuntime(cdPath string) { diff --git a/vendor/github.com/docker/docker/pkg/system/lstat_unix.go b/vendor/github.com/docker/docker/pkg/system/lstat_unix.go index 654b9f2c..5e29a6b3 100644 --- a/vendor/github.com/docker/docker/pkg/system/lstat_unix.go +++ b/vendor/github.com/docker/docker/pkg/system/lstat_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/meminfo_deprecated.go b/vendor/github.com/docker/docker/pkg/system/meminfo_deprecated.go deleted file mode 100644 index 21651992..00000000 --- a/vendor/github.com/docker/docker/pkg/system/meminfo_deprecated.go +++ /dev/null @@ -1,16 +0,0 @@ -package system - -import "github.com/docker/docker/pkg/meminfo" - -// MemInfo contains memory statistics of the host system. -// -// Deprecated: use [meminfo.Memory]. -type MemInfo = meminfo.Memory - -// ReadMemInfo retrieves memory statistics of the host system and returns a -// MemInfo type. -// -// Deprecated: use [meminfo.Read]. -func ReadMemInfo() (*meminfo.Memory, error) { - return meminfo.Read() -} diff --git a/vendor/github.com/docker/docker/pkg/system/mknod.go b/vendor/github.com/docker/docker/pkg/system/mknod.go index d27152c0..2a62237a 100644 --- a/vendor/github.com/docker/docker/pkg/system/mknod.go +++ b/vendor/github.com/docker/docker/pkg/system/mknod.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go b/vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go index c890be11..e218e742 100644 --- a/vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go +++ b/vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go @@ -1,5 +1,4 @@ //go:build freebsd -// +build freebsd package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/mknod_unix.go b/vendor/github.com/docker/docker/pkg/system/mknod_unix.go index 4586aad1..34df0b92 100644 --- a/vendor/github.com/docker/docker/pkg/system/mknod_unix.go +++ b/vendor/github.com/docker/docker/pkg/system/mknod_unix.go @@ -1,5 +1,4 @@ //go:build !freebsd && !windows -// +build !freebsd,!windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/mknod_windows.go b/vendor/github.com/docker/docker/pkg/system/mknod_windows.go deleted file mode 100644 index ec89d7a1..00000000 --- a/vendor/github.com/docker/docker/pkg/system/mknod_windows.go +++ /dev/null @@ -1,11 +0,0 @@ -package system // import "github.com/docker/docker/pkg/system" - -// Mknod is not implemented on Windows. -func Mknod(path string, mode uint32, dev int) error { - return ErrNotSupportedPlatform -} - -// Mkdev is not implemented on Windows. -func Mkdev(major int64, minor int64) uint32 { - panic("Mkdev not implemented on Windows.") -} diff --git a/vendor/github.com/docker/docker/pkg/system/path_deprecated.go b/vendor/github.com/docker/docker/pkg/system/path_deprecated.go deleted file mode 100644 index 5c95026c..00000000 --- a/vendor/github.com/docker/docker/pkg/system/path_deprecated.go +++ /dev/null @@ -1,18 +0,0 @@ -package system - -const defaultUnixPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -// DefaultPathEnv is unix style list of directories to search for -// executables. Each directory is separated from the next by a colon -// ':' character . -// For Windows containers, an empty string is returned as the default -// path will be set by the container, and Docker has no context of what the -// default path should be. -// -// Deprecated: use oci.DefaultPathEnv -func DefaultPathEnv(os string) string { - if os == "windows" { - return "" - } - return defaultUnixPathEnv -} diff --git a/vendor/github.com/docker/docker/pkg/system/process_deprecated.go b/vendor/github.com/docker/docker/pkg/system/process_deprecated.go deleted file mode 100644 index 7b9f19ac..00000000 --- a/vendor/github.com/docker/docker/pkg/system/process_deprecated.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build linux || freebsd || darwin || windows -// +build linux freebsd darwin windows - -package system - -import "github.com/docker/docker/pkg/process" - -var ( - // IsProcessAlive returns true if process with a given pid is running. - // - // Deprecated: use [process.Alive]. - IsProcessAlive = process.Alive - - // IsProcessZombie return true if process has a state with "Z" - // - // Deprecated: use [process.Zombie]. - // - // TODO(thaJeztah): remove the Windows implementation in process once we remove this stub. - IsProcessZombie = process.Zombie -) - -// KillProcess force-stops a process. -// -// Deprecated: use [process.Kill]. -func KillProcess(pid int) { - _ = process.Kill(pid) -} diff --git a/vendor/github.com/docker/docker/pkg/system/stat_bsd.go b/vendor/github.com/docker/docker/pkg/system/stat_bsd.go index 8e61d820..435b776e 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_bsd.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_bsd.go @@ -1,5 +1,4 @@ //go:build freebsd || netbsd -// +build freebsd netbsd package system // import "github.com/docker/docker/pkg/system" @@ -7,10 +6,12 @@ import "syscall" // fromStatT converts a syscall.Stat_t type to a system.Stat_t type func fromStatT(s *syscall.Stat_t) (*StatT, error) { - return &StatT{size: s.Size, + return &StatT{ + size: s.Size, mode: uint32(s.Mode), uid: s.Uid, gid: s.Gid, rdev: uint64(s.Rdev), - mtim: s.Mtimespec}, nil + mtim: s.Mtimespec, + }, nil } diff --git a/vendor/github.com/docker/docker/pkg/system/stat_darwin.go b/vendor/github.com/docker/docker/pkg/system/stat_darwin.go index c1c0ee9f..e0b629df 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_darwin.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_darwin.go @@ -4,10 +4,12 @@ import "syscall" // fromStatT converts a syscall.Stat_t type to a system.Stat_t type func fromStatT(s *syscall.Stat_t) (*StatT, error) { - return &StatT{size: s.Size, + return &StatT{ + size: s.Size, mode: uint32(s.Mode), uid: s.Uid, gid: s.Gid, rdev: uint64(s.Rdev), - mtim: s.Mtimespec}, nil + mtim: s.Mtimespec, + }, nil } diff --git a/vendor/github.com/docker/docker/pkg/system/stat_linux.go b/vendor/github.com/docker/docker/pkg/system/stat_linux.go index 3ac02393..4309d42b 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_linux.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_linux.go @@ -4,13 +4,15 @@ import "syscall" // fromStatT converts a syscall.Stat_t type to a system.Stat_t type func fromStatT(s *syscall.Stat_t) (*StatT, error) { - return &StatT{size: s.Size, + return &StatT{ + size: s.Size, mode: s.Mode, uid: s.Uid, gid: s.Gid, // the type is 32bit on mips rdev: uint64(s.Rdev), //nolint: unconvert - mtim: s.Mtim}, nil + mtim: s.Mtim, + }, nil } // FromStatT converts a syscall.Stat_t type to a system.Stat_t type diff --git a/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go b/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go index 756b92d1..851374e5 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go @@ -4,10 +4,12 @@ import "syscall" // fromStatT converts a syscall.Stat_t type to a system.Stat_t type func fromStatT(s *syscall.Stat_t) (*StatT, error) { - return &StatT{size: s.Size, + return &StatT{ + size: s.Size, mode: uint32(s.Mode), uid: s.Uid, gid: s.Gid, rdev: uint64(s.Rdev), - mtim: s.Mtim}, nil + mtim: s.Mtim, + }, nil } diff --git a/vendor/github.com/docker/docker/pkg/system/stat_unix.go b/vendor/github.com/docker/docker/pkg/system/stat_unix.go index a45ffddf..205e5467 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_unix.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/stat_windows.go b/vendor/github.com/docker/docker/pkg/system/stat_windows.go index 0ff3af2f..10876cd7 100644 --- a/vendor/github.com/docker/docker/pkg/system/stat_windows.go +++ b/vendor/github.com/docker/docker/pkg/system/stat_windows.go @@ -45,5 +45,6 @@ func fromStatT(fi *os.FileInfo) (*StatT, error) { return &StatT{ size: (*fi).Size(), mode: (*fi).Mode(), - mtim: (*fi).ModTime()}, nil + mtim: (*fi).ModTime(), + }, nil } diff --git a/vendor/github.com/docker/docker/pkg/system/utimes_unix.go b/vendor/github.com/docker/docker/pkg/system/utimes_unix.go index 2768750a..f3a079f8 100644 --- a/vendor/github.com/docker/docker/pkg/system/utimes_unix.go +++ b/vendor/github.com/docker/docker/pkg/system/utimes_unix.go @@ -1,5 +1,4 @@ //go:build linux || freebsd -// +build linux freebsd package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go b/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go index bfed4af0..7c19d591 100644 --- a/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go +++ b/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux && !freebsd -// +build !linux,!freebsd package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/docker/pkg/system/xattrs.go b/vendor/github.com/docker/docker/pkg/system/xattrs.go new file mode 100644 index 00000000..b3f4e8a2 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/system/xattrs.go @@ -0,0 +1,18 @@ +package system // import "github.com/docker/docker/pkg/system" + +type XattrError struct { + Op string + Attr string + Path string + Err error +} + +func (e *XattrError) Error() string { return e.Op + " " + e.Attr + " " + e.Path + ": " + e.Err.Error() } + +func (e *XattrError) Unwrap() error { return e.Err } + +// Timeout reports whether this error represents a timeout. +func (e *XattrError) Timeout() bool { + t, ok := e.Err.(interface{ Timeout() bool }) + return ok && t.Timeout() +} diff --git a/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go b/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go index 95b609fe..facfbb31 100644 --- a/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go +++ b/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go @@ -1,11 +1,17 @@ package system // import "github.com/docker/docker/pkg/system" -import "golang.org/x/sys/unix" +import ( + "golang.org/x/sys/unix" +) // Lgetxattr retrieves the value of the extended attribute identified by attr // and associated with the given path in the file system. // It will returns a nil slice and nil error if the xattr is not set. func Lgetxattr(path string, attr string) ([]byte, error) { + sysErr := func(err error) ([]byte, error) { + return nil, &XattrError{Op: "lgetxattr", Attr: attr, Path: path, Err: err} + } + // Start with a 128 length byte array dest := make([]byte, 128) sz, errno := unix.Lgetxattr(path, attr, dest) @@ -14,7 +20,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) { // Buffer too small, use zero-sized buffer to get the actual size sz, errno = unix.Lgetxattr(path, attr, []byte{}) if errno != nil { - return nil, errno + return sysErr(errno) } dest = make([]byte, sz) sz, errno = unix.Lgetxattr(path, attr, dest) @@ -24,7 +30,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) { case errno == unix.ENODATA: return nil, nil case errno != nil: - return nil, errno + return sysErr(errno) } return dest[:sz], nil @@ -33,5 +39,9 @@ func Lgetxattr(path string, attr string) ([]byte, error) { // Lsetxattr sets the value of the extended attribute identified by attr // and associated with the given path in the file system. func Lsetxattr(path string, attr string, data []byte, flags int) error { - return unix.Lsetxattr(path, attr, data, flags) + err := unix.Lsetxattr(path, attr, data, flags) + if err != nil { + return &XattrError{Op: "lsetxattr", Attr: attr, Path: path, Err: err} + } + return nil } diff --git a/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go b/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go index b165a5db..2a3698f1 100644 --- a/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go +++ b/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package system // import "github.com/docker/docker/pkg/system" diff --git a/vendor/github.com/docker/go-connections/nat/nat.go b/vendor/github.com/docker/go-connections/nat/nat.go index bb7e4e33..4049d780 100644 --- a/vendor/github.com/docker/go-connections/nat/nat.go +++ b/vendor/github.com/docker/go-connections/nat/nat.go @@ -8,11 +8,6 @@ import ( "strings" ) -const ( - // portSpecTemplate is the expected format for port specifications - portSpecTemplate = "ip:hostPort:containerPort" -) - // PortBinding represents a binding between a Host IP address and a Host Port type PortBinding struct { // HostIP is the host IP Address @@ -158,48 +153,51 @@ type PortMapping struct { func splitParts(rawport string) (string, string, string) { parts := strings.Split(rawport, ":") n := len(parts) - containerport := parts[n-1] + containerPort := parts[n-1] switch n { case 1: - return "", "", containerport + return "", "", containerPort case 2: - return "", parts[0], containerport + return "", parts[0], containerPort case 3: - return parts[0], parts[1], containerport + return parts[0], parts[1], containerPort default: - return strings.Join(parts[:n-2], ":"), parts[n-2], containerport + return strings.Join(parts[:n-2], ":"), parts[n-2], containerPort } } // ParsePortSpec parses a port specification string into a slice of PortMappings func ParsePortSpec(rawPort string) ([]PortMapping, error) { var proto string - rawIP, hostPort, containerPort := splitParts(rawPort) + ip, hostPort, containerPort := splitParts(rawPort) proto, containerPort = SplitProtoPort(containerPort) - // Strip [] from IPV6 addresses - ip, _, err := net.SplitHostPort(rawIP + ":") - if err != nil { - return nil, fmt.Errorf("Invalid ip address %v: %s", rawIP, err) + if ip != "" && ip[0] == '[' { + // Strip [] from IPV6 addresses + rawIP, _, err := net.SplitHostPort(ip + ":") + if err != nil { + return nil, fmt.Errorf("invalid IP address %v: %w", ip, err) + } + ip = rawIP } if ip != "" && net.ParseIP(ip) == nil { - return nil, fmt.Errorf("Invalid ip address: %s", ip) + return nil, fmt.Errorf("invalid IP address: %s", ip) } if containerPort == "" { - return nil, fmt.Errorf("No port specified: %s", rawPort) + return nil, fmt.Errorf("no port specified: %s", rawPort) } startPort, endPort, err := ParsePortRange(containerPort) if err != nil { - return nil, fmt.Errorf("Invalid containerPort: %s", containerPort) + return nil, fmt.Errorf("invalid containerPort: %s", containerPort) } var startHostPort, endHostPort uint64 = 0, 0 if len(hostPort) > 0 { startHostPort, endHostPort, err = ParsePortRange(hostPort) if err != nil { - return nil, fmt.Errorf("Invalid hostPort: %s", hostPort) + return nil, fmt.Errorf("invalid hostPort: %s", hostPort) } } @@ -208,12 +206,12 @@ func ParsePortSpec(rawPort string) ([]PortMapping, error) { // In this case, use the host port range as the dynamic // host port range to allocate into. if endPort != startPort { - return nil, fmt.Errorf("Invalid ranges specified for container and host Ports: %s and %s", containerPort, hostPort) + return nil, fmt.Errorf("invalid ranges specified for container and host Ports: %s and %s", containerPort, hostPort) } } if !validateProto(strings.ToLower(proto)) { - return nil, fmt.Errorf("Invalid proto: %s", proto) + return nil, fmt.Errorf("invalid proto: %s", proto) } ports := []PortMapping{} diff --git a/vendor/github.com/docker/go-connections/nat/parse.go b/vendor/github.com/docker/go-connections/nat/parse.go index 892adf8c..e4b53e8a 100644 --- a/vendor/github.com/docker/go-connections/nat/parse.go +++ b/vendor/github.com/docker/go-connections/nat/parse.go @@ -6,34 +6,10 @@ import ( "strings" ) -// PartParser parses and validates the specified string (data) using the specified template -// e.g. ip:public:private -> 192.168.0.1:80:8000 -// DEPRECATED: do not use, this function may be removed in a future version -func PartParser(template, data string) (map[string]string, error) { - // ip:public:private - var ( - templateParts = strings.Split(template, ":") - parts = strings.Split(data, ":") - out = make(map[string]string, len(templateParts)) - ) - if len(parts) != len(templateParts) { - return nil, fmt.Errorf("Invalid format to parse. %s should match template %s", data, template) - } - - for i, t := range templateParts { - value := "" - if len(parts) > i { - value = parts[i] - } - out[t] = value - } - return out, nil -} - // ParsePortRange parses and validates the specified string as a port-range (8000-9000) func ParsePortRange(ports string) (uint64, uint64, error) { if ports == "" { - return 0, 0, fmt.Errorf("Empty string specified for ports.") + return 0, 0, fmt.Errorf("empty string specified for ports") } if !strings.Contains(ports, "-") { start, err := strconv.ParseUint(ports, 10, 16) @@ -51,7 +27,7 @@ func ParsePortRange(ports string) (uint64, uint64, error) { return 0, 0, err } if end < start { - return 0, 0, fmt.Errorf("Invalid range specified for the Port: %s", ports) + return 0, 0, fmt.Errorf("invalid range specified for port: %s", ports) } return start, end, nil } diff --git a/vendor/github.com/docker/go-connections/nat/sort.go b/vendor/github.com/docker/go-connections/nat/sort.go index ce950171..b6eed145 100644 --- a/vendor/github.com/docker/go-connections/nat/sort.go +++ b/vendor/github.com/docker/go-connections/nat/sort.go @@ -43,7 +43,7 @@ type portMapSorter []portMapEntry func (s portMapSorter) Len() int { return len(s) } func (s portMapSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -// sort the port so that the order is: +// Less sorts the port so that the order is: // 1. port with larger specified bindings // 2. larger port // 3. port with tcp protocol @@ -58,7 +58,7 @@ func (s portMapSorter) Less(i, j int) bool { func SortPortMap(ports []Port, bindings PortMap) { s := portMapSorter{} for _, p := range ports { - if binding, ok := bindings[p]; ok { + if binding, ok := bindings[p]; ok && len(binding) > 0 { for _, b := range binding { s = append(s, portMapEntry{port: p, binding: b}) } diff --git a/vendor/github.com/docker/go-connections/sockets/proxy.go b/vendor/github.com/docker/go-connections/sockets/proxy.go index 98e9a1dc..c897cb02 100644 --- a/vendor/github.com/docker/go-connections/sockets/proxy.go +++ b/vendor/github.com/docker/go-connections/sockets/proxy.go @@ -2,11 +2,8 @@ package sockets import ( "net" - "net/url" "os" "strings" - - "golang.org/x/net/proxy" ) // GetProxyEnv allows access to the uppercase and the lowercase forms of @@ -20,32 +17,12 @@ func GetProxyEnv(key string) string { return proxyValue } -// DialerFromEnvironment takes in a "direct" *net.Dialer and returns a -// proxy.Dialer which will route the connections through the proxy using the -// given dialer. -func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) { - allProxy := GetProxyEnv("all_proxy") - if len(allProxy) == 0 { - return direct, nil - } - - proxyURL, err := url.Parse(allProxy) - if err != nil { - return direct, err - } - - proxyFromURL, err := proxy.FromURL(proxyURL, direct) - if err != nil { - return direct, err - } - - noProxy := GetProxyEnv("no_proxy") - if len(noProxy) == 0 { - return proxyFromURL, nil - } - - perHost := proxy.NewPerHost(proxyFromURL, direct) - perHost.AddFromString(noProxy) - - return perHost, nil +// DialerFromEnvironment was previously used to configure a net.Dialer to route +// connections through a SOCKS proxy. +// DEPRECATED: SOCKS proxies are now supported by configuring only +// http.Transport.Proxy, and no longer require changing http.Transport.Dial. +// Therefore, only sockets.ConfigureTransport() needs to be called, and any +// sockets.DialerFromEnvironment() calls can be dropped. +func DialerFromEnvironment(direct *net.Dialer) (*net.Dialer, error) { + return direct, nil } diff --git a/vendor/github.com/docker/go-connections/sockets/sockets.go b/vendor/github.com/docker/go-connections/sockets/sockets.go index a1d7beb4..b0eae239 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets.go @@ -8,16 +8,18 @@ import ( "time" ) -// Why 32? See https://github.com/docker/docker/pull/8035. -const defaultTimeout = 32 * time.Second +const defaultTimeout = 10 * time.Second // ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system. var ErrProtocolNotAvailable = errors.New("protocol not available") -// ConfigureTransport configures the specified Transport according to the -// specified proto and addr. -// If the proto is unix (using a unix socket to communicate) or npipe the -// compression is disabled. +// ConfigureTransport configures the specified [http.Transport] according to the specified proto +// and addr. +// +// If the proto is unix (using a unix socket to communicate) or npipe the compression is disabled. +// For other protos, compression is enabled. If you want to manually enable/disable compression, +// make sure you do it _after_ any subsequent calls to ConfigureTransport is made against the same +// [http.Transport]. func ConfigureTransport(tr *http.Transport, proto, addr string) error { switch proto { case "unix": @@ -26,13 +28,10 @@ func ConfigureTransport(tr *http.Transport, proto, addr string) error { return configureNpipeTransport(tr, proto, addr) default: tr.Proxy = http.ProxyFromEnvironment - dialer, err := DialerFromEnvironment(&net.Dialer{ + tr.DisableCompression = false + tr.DialContext = (&net.Dialer{ Timeout: defaultTimeout, - }) - if err != nil { - return err - } - tr.Dial = dialer.Dial + }).DialContext } return nil } diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go index 386cf0db..78a34a98 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go @@ -1,8 +1,9 @@ -// +build !windows +//go:build !windows package sockets import ( + "context" "fmt" "net" "net/http" @@ -14,12 +15,15 @@ const maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path) func configureUnixTransport(tr *http.Transport, proto, addr string) error { if len(addr) > maxUnixSocketPathSize { - return fmt.Errorf("Unix socket path %q is too long", addr) + return fmt.Errorf("unix socket path %q is too long", addr) } // No need for compression in local communications. tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { - return net.DialTimeout(proto, addr, defaultTimeout) + dialer := &net.Dialer{ + Timeout: defaultTimeout, + } + tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { + return dialer.DialContext(ctx, proto, addr) } return nil } diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go index 5c21644e..7acafc5a 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go @@ -1,6 +1,7 @@ package sockets import ( + "context" "net" "net/http" "time" @@ -15,8 +16,8 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error { func configureNpipeTransport(tr *http.Transport, proto, addr string) error { // No need for compression in local communications. tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { - return DialPipe(addr, defaultTimeout) + tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { + return winio.DialPipeContext(ctx, addr) } return nil } diff --git a/vendor/github.com/docker/go-connections/sockets/unix_socket.go b/vendor/github.com/docker/go-connections/sockets/unix_socket.go index a8b5dbb6..b9233521 100644 --- a/vendor/github.com/docker/go-connections/sockets/unix_socket.go +++ b/vendor/github.com/docker/go-connections/sockets/unix_socket.go @@ -1,5 +1,51 @@ -// +build !windows +//go:build !windows +/* +Package sockets is a simple unix domain socket wrapper. + +# Usage + +For example: + + import( + "fmt" + "net" + "os" + "github.com/docker/go-connections/sockets" + ) + + func main() { + l, err := sockets.NewUnixSocketWithOpts("/path/to/sockets", + sockets.WithChown(0,0),sockets.WithChmod(0660)) + if err != nil { + panic(err) + } + echoStr := "hello" + + go func() { + for { + conn, err := l.Accept() + if err != nil { + return + } + conn.Write([]byte(echoStr)) + conn.Close() + } + }() + + conn, err := net.Dial("unix", path) + if err != nil { + t.Fatal(err) + } + + buf := make([]byte, 5) + if _, err := conn.Read(buf); err != nil { + panic(err) + } else if string(buf) != echoStr { + panic(fmt.Errorf("msg may lost")) + } + } +*/ package sockets import ( @@ -8,25 +54,73 @@ import ( "syscall" ) -// NewUnixSocket creates a unix socket with the specified path and group. -func NewUnixSocket(path string, gid int) (net.Listener, error) { +// SockOption sets up socket file's creating option +type SockOption func(string) error + +// WithChown modifies the socket file's uid and gid +func WithChown(uid, gid int) SockOption { + return func(path string) error { + if err := os.Chown(path, uid, gid); err != nil { + return err + } + return nil + } +} + +// WithChmod modifies socket file's access mode. +func WithChmod(mask os.FileMode) SockOption { + return func(path string) error { + if err := os.Chmod(path, mask); err != nil { + return err + } + return nil + } +} + +// NewUnixSocketWithOpts creates a unix socket with the specified options. +// By default, socket permissions are 0000 (i.e.: no access for anyone); pass +// WithChmod() and WithChown() to set the desired ownership and permissions. +// +// This function temporarily changes the system's "umask" to 0777 to work around +// a race condition between creating the socket and setting its permissions. While +// this should only be for a short duration, it may affect other processes that +// create files/directories during that period. +func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error) { if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { return nil, err } - mask := syscall.Umask(0777) - defer syscall.Umask(mask) + // net.Listen does not allow for permissions to be set. As a result, when + // specifying custom permissions ("WithChmod()"), there is a short time + // between creating the socket and applying the permissions, during which + // the socket permissions are Less restrictive than desired. + // + // To work around this limitation of net.Listen(), we temporarily set the + // umask to 0777, which forces the socket to be created with 000 permissions + // (i.e.: no access for anyone). After that, WithChmod() must be used to set + // the desired permissions. + // + // We don't use "defer" here, to reset the umask to its original value as soon + // as possible. Ideally we'd be able to detect if WithChmod() was passed as + // an option, and skip changing umask if default permissions are used. + origUmask := syscall.Umask(0o777) l, err := net.Listen("unix", path) + syscall.Umask(origUmask) if err != nil { return nil, err } - if err := os.Chown(path, 0, gid); err != nil { - l.Close() - return nil, err - } - if err := os.Chmod(path, 0660); err != nil { - l.Close() - return nil, err + + for _, op := range opts { + if err := op(path); err != nil { + _ = l.Close() + return nil, err + } } + return l, nil } + +// NewUnixSocket creates a unix socket with the specified path and group. +func NewUnixSocket(path string, gid int) (net.Listener, error) { + return NewUnixSocketWithOpts(path, WithChown(0, gid), WithChmod(0o660)) +} diff --git a/vendor/github.com/docker/go-connections/tlsconfig/certpool_go17.go b/vendor/github.com/docker/go-connections/tlsconfig/certpool.go similarity index 95% rename from vendor/github.com/docker/go-connections/tlsconfig/certpool_go17.go rename to vendor/github.com/docker/go-connections/tlsconfig/certpool.go index 1ca0965e..f84c624b 100644 --- a/vendor/github.com/docker/go-connections/tlsconfig/certpool_go17.go +++ b/vendor/github.com/docker/go-connections/tlsconfig/certpool.go @@ -1,5 +1,3 @@ -// +build go1.7 - package tlsconfig import ( diff --git a/vendor/github.com/docker/go-connections/tlsconfig/certpool_other.go b/vendor/github.com/docker/go-connections/tlsconfig/certpool_other.go deleted file mode 100644 index 1ff81c33..00000000 --- a/vendor/github.com/docker/go-connections/tlsconfig/certpool_other.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !go1.7 - -package tlsconfig - -import ( - "crypto/x509" -) - -// SystemCertPool returns an new empty cert pool, -// accessing system cert pool is supported in go 1.7 -func SystemCertPool() (*x509.CertPool, error) { - return x509.NewCertPool(), nil -} diff --git a/vendor/github.com/docker/go-connections/tlsconfig/config.go b/vendor/github.com/docker/go-connections/tlsconfig/config.go index 0ef3fdcb..606c98a3 100644 --- a/vendor/github.com/docker/go-connections/tlsconfig/config.go +++ b/vendor/github.com/docker/go-connections/tlsconfig/config.go @@ -1,6 +1,7 @@ // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. // // As a reminder from https://golang.org/pkg/crypto/tls/#Config: +// // A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified. // A Config may be reused; the tls package will also not modify it. package tlsconfig @@ -9,11 +10,9 @@ import ( "crypto/tls" "crypto/x509" "encoding/pem" + "errors" "fmt" - "io/ioutil" "os" - - "github.com/pkg/errors" ) // Options represents the information needed to create client and server TLS configurations. @@ -36,7 +35,12 @@ type Options struct { ExclusiveRootPools bool MinVersion uint16 // If Passphrase is set, it will be used to decrypt a TLS private key - // if the key is encrypted + // if the key is encrypted. + // + // Deprecated: Use of encrypted TLS private keys has been deprecated, and + // will be removed in a future release. Golang has deprecated support for + // legacy PEM encryption (as specified in RFC 1423), as it is insecure by + // design (see https://go-review.googlesource.com/c/go/+/264159). Passphrase string } @@ -53,18 +57,9 @@ var acceptedCBCCiphers = []uint16{ // known weak algorithms removed. var DefaultServerAcceptedCiphers = append(clientCipherSuites, acceptedCBCCiphers...) -// allTLSVersions lists all the TLS versions and is used by the code that validates -// a uint16 value as a TLS version. -var allTLSVersions = map[uint16]struct{}{ - tls.VersionSSL30: {}, - tls.VersionTLS10: {}, - tls.VersionTLS11: {}, - tls.VersionTLS12: {}, -} - // ServerDefault returns a secure-enough TLS configuration for the server TLS configuration. func ServerDefault(ops ...func(*tls.Config)) *tls.Config { - tlsconfig := &tls.Config{ + tlsConfig := &tls.Config{ // Avoid fallback by default to SSL protocols < TLS1.2 MinVersion: tls.VersionTLS12, PreferServerCipherSuites: true, @@ -72,25 +67,25 @@ func ServerDefault(ops ...func(*tls.Config)) *tls.Config { } for _, op := range ops { - op(tlsconfig) + op(tlsConfig) } - return tlsconfig + return tlsConfig } // ClientDefault returns a secure-enough TLS configuration for the client TLS configuration. func ClientDefault(ops ...func(*tls.Config)) *tls.Config { - tlsconfig := &tls.Config{ + tlsConfig := &tls.Config{ // Prefer TLS1.2 as the client minimum MinVersion: tls.VersionTLS12, CipherSuites: clientCipherSuites, } for _, op := range ops { - op(tlsconfig) + op(tlsConfig) } - return tlsconfig + return tlsConfig } // certPool returns an X.509 certificate pool from `caFile`, the certificate file. @@ -108,16 +103,25 @@ func certPool(caFile string, exclusivePool bool) (*x509.CertPool, error) { return nil, fmt.Errorf("failed to read system certificates: %v", err) } } - pem, err := ioutil.ReadFile(caFile) + pemData, err := os.ReadFile(caFile) if err != nil { return nil, fmt.Errorf("could not read CA certificate %q: %v", caFile, err) } - if !certPool.AppendCertsFromPEM(pem) { + if !certPool.AppendCertsFromPEM(pemData) { return nil, fmt.Errorf("failed to append certificates from PEM file: %q", caFile) } return certPool, nil } +// allTLSVersions lists all the TLS versions and is used by the code that validates +// a uint16 value as a TLS version. +var allTLSVersions = map[uint16]struct{}{ + tls.VersionTLS10: {}, + tls.VersionTLS11: {}, + tls.VersionTLS12: {}, + tls.VersionTLS13: {}, +} + // isValidMinVersion checks that the input value is a valid tls minimum version func isValidMinVersion(version uint16) bool { _, ok := allTLSVersions[version] @@ -129,10 +133,10 @@ func isValidMinVersion(version uint16) bool { func adjustMinVersion(options Options, config *tls.Config) error { if options.MinVersion > 0 { if !isValidMinVersion(options.MinVersion) { - return fmt.Errorf("Invalid minimum TLS version: %x", options.MinVersion) + return fmt.Errorf("invalid minimum TLS version: %x", options.MinVersion) } if options.MinVersion < config.MinVersion { - return fmt.Errorf("Requested minimum TLS version is too low. Should be at-least: %x", config.MinVersion) + return fmt.Errorf("requested minimum TLS version is too low. Should be at-least: %x", config.MinVersion) } config.MinVersion = options.MinVersion } @@ -141,9 +145,14 @@ func adjustMinVersion(options Options, config *tls.Config) error { } // IsErrEncryptedKey returns true if the 'err' is an error of incorrect -// password when tryin to decrypt a TLS private key +// password when trying to decrypt a TLS private key. +// +// Deprecated: Use of encrypted TLS private keys has been deprecated, and +// will be removed in a future release. Golang has deprecated support for +// legacy PEM encryption (as specified in RFC 1423), as it is insecure by +// design (see https://go-review.googlesource.com/c/go/+/264159). func IsErrEncryptedKey(err error) bool { - return errors.Cause(err) == x509.IncorrectPasswordError + return errors.Is(err, x509.IncorrectPasswordError) } // getPrivateKey returns the private key in 'keyBytes', in PEM-encoded format. @@ -157,10 +166,10 @@ func getPrivateKey(keyBytes []byte, passphrase string) ([]byte, error) { } var err error - if x509.IsEncryptedPEMBlock(pemBlock) { - keyBytes, err = x509.DecryptPEMBlock(pemBlock, []byte(passphrase)) + if x509.IsEncryptedPEMBlock(pemBlock) { //nolint:staticcheck // Ignore SA1019 (IsEncryptedPEMBlock is deprecated) + keyBytes, err = x509.DecryptPEMBlock(pemBlock, []byte(passphrase)) //nolint:staticcheck // Ignore SA1019 (DecryptPEMBlock is deprecated) if err != nil { - return nil, errors.Wrap(err, "private key is encrypted, but could not decrypt it") + return nil, fmt.Errorf("private key is encrypted, but could not decrypt it: %w", err) } keyBytes = pem.EncodeToMemory(&pem.Block{Type: pemBlock.Type, Bytes: keyBytes}) } @@ -176,26 +185,24 @@ func getCert(options Options) ([]tls.Certificate, error) { return nil, nil } - errMessage := "Could not load X509 key pair" - - cert, err := ioutil.ReadFile(options.CertFile) + cert, err := os.ReadFile(options.CertFile) if err != nil { - return nil, errors.Wrap(err, errMessage) + return nil, err } - prKeyBytes, err := ioutil.ReadFile(options.KeyFile) + prKeyBytes, err := os.ReadFile(options.KeyFile) if err != nil { - return nil, errors.Wrap(err, errMessage) + return nil, err } prKeyBytes, err = getPrivateKey(prKeyBytes, options.Passphrase) if err != nil { - return nil, errors.Wrap(err, errMessage) + return nil, err } tlsCert, err := tls.X509KeyPair(cert, prKeyBytes) if err != nil { - return nil, errors.Wrap(err, errMessage) + return nil, err } return []tls.Certificate{tlsCert}, nil @@ -215,7 +222,7 @@ func Client(options Options) (*tls.Config, error) { tlsCerts, err := getCert(options) if err != nil { - return nil, err + return nil, fmt.Errorf("could not load X509 key pair: %w", err) } tlsConfig.Certificates = tlsCerts @@ -233,9 +240,9 @@ func Server(options Options) (*tls.Config, error) { tlsCert, err := tls.LoadX509KeyPair(options.CertFile, options.KeyFile) if err != nil { if os.IsNotExist(err) { - return nil, fmt.Errorf("Could not load X509 key pair (cert: %q, key: %q): %v", options.CertFile, options.KeyFile, err) + return nil, fmt.Errorf("could not load X509 key pair (cert: %q, key: %q): %v", options.CertFile, options.KeyFile, err) } - return nil, fmt.Errorf("Error reading X509 key pair (cert: %q, key: %q): %v. Make sure the key is not encrypted.", options.CertFile, options.KeyFile, err) + return nil, fmt.Errorf("error reading X509 key pair - make sure the key is not encrypted (cert: %q, key: %q): %v", options.CertFile, options.KeyFile, err) } tlsConfig.Certificates = []tls.Certificate{tlsCert} if options.ClientAuth >= tls.VerifyClientCertIfGiven && options.CAFile != "" { diff --git a/vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go b/vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go index 6b4c6a7c..a82f9fa5 100644 --- a/vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go +++ b/vendor/github.com/docker/go-connections/tlsconfig/config_client_ciphers.go @@ -1,7 +1,4 @@ -// +build go1.5 - // Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. -// package tlsconfig import ( diff --git a/vendor/github.com/docker/go-connections/tlsconfig/config_legacy_client_ciphers.go b/vendor/github.com/docker/go-connections/tlsconfig/config_legacy_client_ciphers.go deleted file mode 100644 index ee22df47..00000000 --- a/vendor/github.com/docker/go-connections/tlsconfig/config_legacy_client_ciphers.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build !go1.5 - -// Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers. -// -package tlsconfig - -import ( - "crypto/tls" -) - -// Client TLS cipher suites (dropping CBC ciphers for client preferred suite set) -var clientCipherSuites = []uint16{ - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, -} diff --git a/vendor/github.com/felixge/httpsnoop/.gitignore b/vendor/github.com/felixge/httpsnoop/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/vendor/github.com/felixge/httpsnoop/LICENSE.txt b/vendor/github.com/felixge/httpsnoop/LICENSE.txt new file mode 100644 index 00000000..e028b46a --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016 Felix Geisendörfer (felix@debuggable.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/vendor/github.com/felixge/httpsnoop/Makefile b/vendor/github.com/felixge/httpsnoop/Makefile new file mode 100644 index 00000000..4e12afdd --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/Makefile @@ -0,0 +1,10 @@ +.PHONY: ci generate clean + +ci: clean generate + go test -race -v ./... + +generate: + go generate . + +clean: + rm -rf *_generated*.go diff --git a/vendor/github.com/felixge/httpsnoop/README.md b/vendor/github.com/felixge/httpsnoop/README.md new file mode 100644 index 00000000..cf6b42f3 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/README.md @@ -0,0 +1,95 @@ +# httpsnoop + +Package httpsnoop provides an easy way to capture http related metrics (i.e. +response time, bytes written, and http status code) from your application's +http.Handlers. + +Doing this requires non-trivial wrapping of the http.ResponseWriter interface, +which is also exposed for users interested in a more low-level API. + +[![Go Reference](https://pkg.go.dev/badge/github.com/felixge/httpsnoop.svg)](https://pkg.go.dev/github.com/felixge/httpsnoop) +[![Build Status](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml/badge.svg)](https://github.com/felixge/httpsnoop/actions/workflows/main.yaml) + +## Usage Example + +```go +// myH is your app's http handler, perhaps a http.ServeMux or similar. +var myH http.Handler +// wrappedH wraps myH in order to log every request. +wrappedH := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + m := httpsnoop.CaptureMetrics(myH, w, r) + log.Printf( + "%s %s (code=%d dt=%s written=%d)", + r.Method, + r.URL, + m.Code, + m.Duration, + m.Written, + ) +}) +http.ListenAndServe(":8080", wrappedH) +``` + +## Why this package exists + +Instrumenting an application's http.Handler is surprisingly difficult. + +However if you google for e.g. "capture ResponseWriter status code" you'll find +lots of advise and code examples that suggest it to be a fairly trivial +undertaking. Unfortunately everything I've seen so far has a high chance of +breaking your application. + +The main problem is that a `http.ResponseWriter` often implements additional +interfaces such as `http.Flusher`, `http.CloseNotifier`, `http.Hijacker`, `http.Pusher`, and +`io.ReaderFrom`. So the naive approach of just wrapping `http.ResponseWriter` +in your own struct that also implements the `http.ResponseWriter` interface +will hide the additional interfaces mentioned above. This has a high change of +introducing subtle bugs into any non-trivial application. + +Another approach I've seen people take is to return a struct that implements +all of the interfaces above. However, that's also problematic, because it's +difficult to fake some of these interfaces behaviors when the underlying +`http.ResponseWriter` doesn't have an implementation. It's also dangerous, +because an application may choose to operate differently, merely because it +detects the presence of these additional interfaces. + +This package solves this problem by checking which additional interfaces a +`http.ResponseWriter` implements, returning a wrapped version implementing the +exact same set of interfaces. + +Additionally this package properly handles edge cases such as `WriteHeader` not +being called, or called more than once, as well as concurrent calls to +`http.ResponseWriter` methods, and even calls happening after the wrapped +`ServeHTTP` has already returned. + +Unfortunately this package is not perfect either. It's possible that it is +still missing some interfaces provided by the go core (let me know if you find +one), and it won't work for applications adding their own interfaces into the +mix. You can however use `httpsnoop.Unwrap(w)` to access the underlying +`http.ResponseWriter` and type-assert the result to its other interfaces. + +However, hopefully the explanation above has sufficiently scared you of rolling +your own solution to this problem. httpsnoop may still break your application, +but at least it tries to avoid it as much as possible. + +Anyway, the real problem here is that smuggling additional interfaces inside +`http.ResponseWriter` is a problematic design choice, but it probably goes as +deep as the Go language specification itself. But that's okay, I still prefer +Go over the alternatives ;). + +## Performance + +``` +BenchmarkBaseline-8 20000 94912 ns/op +BenchmarkCaptureMetrics-8 20000 95461 ns/op +``` + +As you can see, using `CaptureMetrics` on a vanilla http.Handler introduces an +overhead of ~500 ns per http request on my machine. However, the margin of +error appears to be larger than that, therefor it should be reasonable to +assume that the overhead introduced by `CaptureMetrics` is absolutely +negligible. + +## License + +MIT diff --git a/vendor/github.com/felixge/httpsnoop/capture_metrics.go b/vendor/github.com/felixge/httpsnoop/capture_metrics.go new file mode 100644 index 00000000..bec7b71b --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/capture_metrics.go @@ -0,0 +1,86 @@ +package httpsnoop + +import ( + "io" + "net/http" + "time" +) + +// Metrics holds metrics captured from CaptureMetrics. +type Metrics struct { + // Code is the first http response code passed to the WriteHeader func of + // the ResponseWriter. If no such call is made, a default code of 200 is + // assumed instead. + Code int + // Duration is the time it took to execute the handler. + Duration time.Duration + // Written is the number of bytes successfully written by the Write or + // ReadFrom function of the ResponseWriter. ResponseWriters may also write + // data to their underlaying connection directly (e.g. headers), but those + // are not tracked. Therefor the number of Written bytes will usually match + // the size of the response body. + Written int64 +} + +// CaptureMetrics wraps the given hnd, executes it with the given w and r, and +// returns the metrics it captured from it. +func CaptureMetrics(hnd http.Handler, w http.ResponseWriter, r *http.Request) Metrics { + return CaptureMetricsFn(w, func(ww http.ResponseWriter) { + hnd.ServeHTTP(ww, r) + }) +} + +// CaptureMetricsFn wraps w and calls fn with the wrapped w and returns the +// resulting metrics. This is very similar to CaptureMetrics (which is just +// sugar on top of this func), but is a more usable interface if your +// application doesn't use the Go http.Handler interface. +func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metrics { + m := Metrics{Code: http.StatusOK} + m.CaptureMetrics(w, fn) + return m +} + +// CaptureMetrics wraps w and calls fn with the wrapped w and updates +// Metrics m with the resulting metrics. This is similar to CaptureMetricsFn, +// but allows one to customize starting Metrics object. +func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWriter)) { + var ( + start = time.Now() + headerWritten bool + hooks = Hooks{ + WriteHeader: func(next WriteHeaderFunc) WriteHeaderFunc { + return func(code int) { + next(code) + + if !(code >= 100 && code <= 199) && !headerWritten { + m.Code = code + headerWritten = true + } + } + }, + + Write: func(next WriteFunc) WriteFunc { + return func(p []byte) (int, error) { + n, err := next(p) + + m.Written += int64(n) + headerWritten = true + return n, err + } + }, + + ReadFrom: func(next ReadFromFunc) ReadFromFunc { + return func(src io.Reader) (int64, error) { + n, err := next(src) + + headerWritten = true + m.Written += n + return n, err + } + }, + } + ) + + fn(Wrap(w, hooks)) + m.Duration += time.Since(start) +} diff --git a/vendor/github.com/felixge/httpsnoop/docs.go b/vendor/github.com/felixge/httpsnoop/docs.go new file mode 100644 index 00000000..203c35b3 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/docs.go @@ -0,0 +1,10 @@ +// Package httpsnoop provides an easy way to capture http related metrics (i.e. +// response time, bytes written, and http status code) from your application's +// http.Handlers. +// +// Doing this requires non-trivial wrapping of the http.ResponseWriter +// interface, which is also exposed for users interested in a more low-level +// API. +package httpsnoop + +//go:generate go run codegen/main.go diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go new file mode 100644 index 00000000..101cedde --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go @@ -0,0 +1,436 @@ +// +build go1.8 +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. + +package httpsnoop + +import ( + "bufio" + "io" + "net" + "net/http" +) + +// HeaderFunc is part of the http.ResponseWriter interface. +type HeaderFunc func() http.Header + +// WriteHeaderFunc is part of the http.ResponseWriter interface. +type WriteHeaderFunc func(code int) + +// WriteFunc is part of the http.ResponseWriter interface. +type WriteFunc func(b []byte) (int, error) + +// FlushFunc is part of the http.Flusher interface. +type FlushFunc func() + +// CloseNotifyFunc is part of the http.CloseNotifier interface. +type CloseNotifyFunc func() <-chan bool + +// HijackFunc is part of the http.Hijacker interface. +type HijackFunc func() (net.Conn, *bufio.ReadWriter, error) + +// ReadFromFunc is part of the io.ReaderFrom interface. +type ReadFromFunc func(src io.Reader) (int64, error) + +// PushFunc is part of the http.Pusher interface. +type PushFunc func(target string, opts *http.PushOptions) error + +// Hooks defines a set of method interceptors for methods included in +// http.ResponseWriter as well as some others. You can think of them as +// middleware for the function calls they target. See Wrap for more details. +type Hooks struct { + Header func(HeaderFunc) HeaderFunc + WriteHeader func(WriteHeaderFunc) WriteHeaderFunc + Write func(WriteFunc) WriteFunc + Flush func(FlushFunc) FlushFunc + CloseNotify func(CloseNotifyFunc) CloseNotifyFunc + Hijack func(HijackFunc) HijackFunc + ReadFrom func(ReadFromFunc) ReadFromFunc + Push func(PushFunc) PushFunc +} + +// Wrap returns a wrapped version of w that provides the exact same interface +// as w. Specifically if w implements any combination of: +// +// - http.Flusher +// - http.CloseNotifier +// - http.Hijacker +// - io.ReaderFrom +// - http.Pusher +// +// The wrapped version will implement the exact same combination. If no hooks +// are set, the wrapped version also behaves exactly as w. Hooks targeting +// methods not supported by w are ignored. Any other hooks will intercept the +// method they target and may modify the call's arguments and/or return values. +// The CaptureMetrics implementation serves as a working example for how the +// hooks can be used. +func Wrap(w http.ResponseWriter, hooks Hooks) http.ResponseWriter { + rw := &rw{w: w, h: hooks} + _, i0 := w.(http.Flusher) + _, i1 := w.(http.CloseNotifier) + _, i2 := w.(http.Hijacker) + _, i3 := w.(io.ReaderFrom) + _, i4 := w.(http.Pusher) + switch { + // combination 1/32 + case !i0 && !i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + }{rw, rw} + // combination 2/32 + case !i0 && !i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Pusher + }{rw, rw, rw} + // combination 3/32 + case !i0 && !i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + }{rw, rw, rw} + // combination 4/32 + case !i0 && !i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw} + // combination 5/32 + case !i0 && !i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + }{rw, rw, rw} + // combination 6/32 + case !i0 && !i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + http.Pusher + }{rw, rw, rw, rw} + // combination 7/32 + case !i0 && !i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 8/32 + case !i0 && !i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 9/32 + case !i0 && i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + }{rw, rw, rw} + // combination 10/32 + case !i0 && i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Pusher + }{rw, rw, rw, rw} + // combination 11/32 + case !i0 && i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 12/32 + case !i0 && i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 13/32 + case !i0 && i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw} + // combination 14/32 + case !i0 && i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 15/32 + case !i0 && i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 16/32 + case !i0 && i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 17/32 + case i0 && !i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + }{rw, rw, rw} + // combination 18/32 + case i0 && !i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Pusher + }{rw, rw, rw, rw} + // combination 19/32 + case i0 && !i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 20/32 + case i0 && !i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 21/32 + case i0 && !i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + }{rw, rw, rw, rw} + // combination 22/32 + case i0 && !i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 23/32 + case i0 && !i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 24/32 + case i0 && !i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 25/32 + case i0 && i1 && !i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + }{rw, rw, rw, rw} + // combination 26/32 + case i0 && i1 && !i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Pusher + }{rw, rw, rw, rw, rw} + // combination 27/32 + case i0 && i1 && !i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 28/32 + case i0 && i1 && !i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 29/32 + case i0 && i1 && i2 && !i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw, rw} + // combination 30/32 + case i0 && i1 && i2 && !i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + http.Pusher + }{rw, rw, rw, rw, rw, rw} + // combination 31/32 + case i0 && i1 && i2 && i3 && !i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw, rw} + // combination 32/32 + case i0 && i1 && i2 && i3 && i4: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + http.Pusher + }{rw, rw, rw, rw, rw, rw, rw} + } + panic("unreachable") +} + +type rw struct { + w http.ResponseWriter + h Hooks +} + +func (w *rw) Unwrap() http.ResponseWriter { + return w.w +} + +func (w *rw) Header() http.Header { + f := w.w.(http.ResponseWriter).Header + if w.h.Header != nil { + f = w.h.Header(f) + } + return f() +} + +func (w *rw) WriteHeader(code int) { + f := w.w.(http.ResponseWriter).WriteHeader + if w.h.WriteHeader != nil { + f = w.h.WriteHeader(f) + } + f(code) +} + +func (w *rw) Write(b []byte) (int, error) { + f := w.w.(http.ResponseWriter).Write + if w.h.Write != nil { + f = w.h.Write(f) + } + return f(b) +} + +func (w *rw) Flush() { + f := w.w.(http.Flusher).Flush + if w.h.Flush != nil { + f = w.h.Flush(f) + } + f() +} + +func (w *rw) CloseNotify() <-chan bool { + f := w.w.(http.CloseNotifier).CloseNotify + if w.h.CloseNotify != nil { + f = w.h.CloseNotify(f) + } + return f() +} + +func (w *rw) Hijack() (net.Conn, *bufio.ReadWriter, error) { + f := w.w.(http.Hijacker).Hijack + if w.h.Hijack != nil { + f = w.h.Hijack(f) + } + return f() +} + +func (w *rw) ReadFrom(src io.Reader) (int64, error) { + f := w.w.(io.ReaderFrom).ReadFrom + if w.h.ReadFrom != nil { + f = w.h.ReadFrom(f) + } + return f(src) +} + +func (w *rw) Push(target string, opts *http.PushOptions) error { + f := w.w.(http.Pusher).Push + if w.h.Push != nil { + f = w.h.Push(f) + } + return f(target, opts) +} + +type Unwrapper interface { + Unwrap() http.ResponseWriter +} + +// Unwrap returns the underlying http.ResponseWriter from within zero or more +// layers of httpsnoop wrappers. +func Unwrap(w http.ResponseWriter) http.ResponseWriter { + if rw, ok := w.(Unwrapper); ok { + // recurse until rw.Unwrap() returns a non-Unwrapper + return Unwrap(rw.Unwrap()) + } else { + return w + } +} diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go new file mode 100644 index 00000000..e0951df1 --- /dev/null +++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go @@ -0,0 +1,278 @@ +// +build !go1.8 +// Code generated by "httpsnoop/codegen"; DO NOT EDIT. + +package httpsnoop + +import ( + "bufio" + "io" + "net" + "net/http" +) + +// HeaderFunc is part of the http.ResponseWriter interface. +type HeaderFunc func() http.Header + +// WriteHeaderFunc is part of the http.ResponseWriter interface. +type WriteHeaderFunc func(code int) + +// WriteFunc is part of the http.ResponseWriter interface. +type WriteFunc func(b []byte) (int, error) + +// FlushFunc is part of the http.Flusher interface. +type FlushFunc func() + +// CloseNotifyFunc is part of the http.CloseNotifier interface. +type CloseNotifyFunc func() <-chan bool + +// HijackFunc is part of the http.Hijacker interface. +type HijackFunc func() (net.Conn, *bufio.ReadWriter, error) + +// ReadFromFunc is part of the io.ReaderFrom interface. +type ReadFromFunc func(src io.Reader) (int64, error) + +// Hooks defines a set of method interceptors for methods included in +// http.ResponseWriter as well as some others. You can think of them as +// middleware for the function calls they target. See Wrap for more details. +type Hooks struct { + Header func(HeaderFunc) HeaderFunc + WriteHeader func(WriteHeaderFunc) WriteHeaderFunc + Write func(WriteFunc) WriteFunc + Flush func(FlushFunc) FlushFunc + CloseNotify func(CloseNotifyFunc) CloseNotifyFunc + Hijack func(HijackFunc) HijackFunc + ReadFrom func(ReadFromFunc) ReadFromFunc +} + +// Wrap returns a wrapped version of w that provides the exact same interface +// as w. Specifically if w implements any combination of: +// +// - http.Flusher +// - http.CloseNotifier +// - http.Hijacker +// - io.ReaderFrom +// +// The wrapped version will implement the exact same combination. If no hooks +// are set, the wrapped version also behaves exactly as w. Hooks targeting +// methods not supported by w are ignored. Any other hooks will intercept the +// method they target and may modify the call's arguments and/or return values. +// The CaptureMetrics implementation serves as a working example for how the +// hooks can be used. +func Wrap(w http.ResponseWriter, hooks Hooks) http.ResponseWriter { + rw := &rw{w: w, h: hooks} + _, i0 := w.(http.Flusher) + _, i1 := w.(http.CloseNotifier) + _, i2 := w.(http.Hijacker) + _, i3 := w.(io.ReaderFrom) + switch { + // combination 1/16 + case !i0 && !i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + }{rw, rw} + // combination 2/16 + case !i0 && !i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + io.ReaderFrom + }{rw, rw, rw} + // combination 3/16 + case !i0 && !i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + }{rw, rw, rw} + // combination 4/16 + case !i0 && !i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 5/16 + case !i0 && i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + }{rw, rw, rw} + // combination 6/16 + case !i0 && i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 7/16 + case !i0 && i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw} + // combination 8/16 + case !i0 && i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 9/16 + case i0 && !i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + }{rw, rw, rw} + // combination 10/16 + case i0 && !i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + io.ReaderFrom + }{rw, rw, rw, rw} + // combination 11/16 + case i0 && !i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + }{rw, rw, rw, rw} + // combination 12/16 + case i0 && !i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 13/16 + case i0 && i1 && !i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + }{rw, rw, rw, rw} + // combination 14/16 + case i0 && i1 && !i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + io.ReaderFrom + }{rw, rw, rw, rw, rw} + // combination 15/16 + case i0 && i1 && i2 && !i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + }{rw, rw, rw, rw, rw} + // combination 16/16 + case i0 && i1 && i2 && i3: + return struct { + Unwrapper + http.ResponseWriter + http.Flusher + http.CloseNotifier + http.Hijacker + io.ReaderFrom + }{rw, rw, rw, rw, rw, rw} + } + panic("unreachable") +} + +type rw struct { + w http.ResponseWriter + h Hooks +} + +func (w *rw) Unwrap() http.ResponseWriter { + return w.w +} + +func (w *rw) Header() http.Header { + f := w.w.(http.ResponseWriter).Header + if w.h.Header != nil { + f = w.h.Header(f) + } + return f() +} + +func (w *rw) WriteHeader(code int) { + f := w.w.(http.ResponseWriter).WriteHeader + if w.h.WriteHeader != nil { + f = w.h.WriteHeader(f) + } + f(code) +} + +func (w *rw) Write(b []byte) (int, error) { + f := w.w.(http.ResponseWriter).Write + if w.h.Write != nil { + f = w.h.Write(f) + } + return f(b) +} + +func (w *rw) Flush() { + f := w.w.(http.Flusher).Flush + if w.h.Flush != nil { + f = w.h.Flush(f) + } + f() +} + +func (w *rw) CloseNotify() <-chan bool { + f := w.w.(http.CloseNotifier).CloseNotify + if w.h.CloseNotify != nil { + f = w.h.CloseNotify(f) + } + return f() +} + +func (w *rw) Hijack() (net.Conn, *bufio.ReadWriter, error) { + f := w.w.(http.Hijacker).Hijack + if w.h.Hijack != nil { + f = w.h.Hijack(f) + } + return f() +} + +func (w *rw) ReadFrom(src io.Reader) (int64, error) { + f := w.w.(io.ReaderFrom).ReadFrom + if w.h.ReadFrom != nil { + f = w.h.ReadFrom(f) + } + return f(src) +} + +type Unwrapper interface { + Unwrap() http.ResponseWriter +} + +// Unwrap returns the underlying http.ResponseWriter from within zero or more +// layers of httpsnoop wrappers. +func Unwrap(w http.ResponseWriter) http.ResponseWriter { + if rw, ok := w.(Unwrapper); ok { + // recurse until rw.Unwrap() returns a non-Unwrapper + return Unwrap(rw.Unwrap()) + } else { + return w + } +} diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/jwt.go b/vendor/github.com/go-jose/go-jose/v3/jwt/jwt.go deleted file mode 100644 index 8553fc50..00000000 --- a/vendor/github.com/go-jose/go-jose/v3/jwt/jwt.go +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * Copyright 2016 Zbigniew Mandziejewicz - * Copyright 2016 Square, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package jwt - -import ( - "fmt" - "strings" - - jose "github.com/go-jose/go-jose/v3" - "github.com/go-jose/go-jose/v3/json" -) - -// JSONWebToken represents a JSON Web Token (as specified in RFC7519). -type JSONWebToken struct { - payload func(k interface{}) ([]byte, error) - unverifiedPayload func() []byte - Headers []jose.Header -} - -type NestedJSONWebToken struct { - enc *jose.JSONWebEncryption - Headers []jose.Header -} - -// Claims deserializes a JSONWebToken into dest using the provided key. -func (t *JSONWebToken) Claims(key interface{}, dest ...interface{}) error { - b, err := t.payload(key) - if err != nil { - return err - } - - for _, d := range dest { - if err := json.Unmarshal(b, d); err != nil { - return err - } - } - - return nil -} - -// UnsafeClaimsWithoutVerification deserializes the claims of a -// JSONWebToken into the dests. For signed JWTs, the claims are not -// verified. This function won't work for encrypted JWTs. -func (t *JSONWebToken) UnsafeClaimsWithoutVerification(dest ...interface{}) error { - if t.unverifiedPayload == nil { - return fmt.Errorf("go-jose/go-jose: Cannot get unverified claims") - } - claims := t.unverifiedPayload() - for _, d := range dest { - if err := json.Unmarshal(claims, d); err != nil { - return err - } - } - return nil -} - -func (t *NestedJSONWebToken) Decrypt(decryptionKey interface{}) (*JSONWebToken, error) { - b, err := t.enc.Decrypt(decryptionKey) - if err != nil { - return nil, err - } - - sig, err := ParseSigned(string(b)) - if err != nil { - return nil, err - } - - return sig, nil -} - -// ParseSigned parses token from JWS form. -func ParseSigned(s string) (*JSONWebToken, error) { - sig, err := jose.ParseSigned(s) - if err != nil { - return nil, err - } - headers := make([]jose.Header, len(sig.Signatures)) - for i, signature := range sig.Signatures { - headers[i] = signature.Header - } - - return &JSONWebToken{ - payload: sig.Verify, - unverifiedPayload: sig.UnsafePayloadWithoutVerification, - Headers: headers, - }, nil -} - -// ParseEncrypted parses token from JWE form. -func ParseEncrypted(s string) (*JSONWebToken, error) { - enc, err := jose.ParseEncrypted(s) - if err != nil { - return nil, err - } - - return &JSONWebToken{ - payload: enc.Decrypt, - Headers: []jose.Header{enc.Header}, - }, nil -} - -// ParseSignedAndEncrypted parses signed-then-encrypted token from JWE form. -func ParseSignedAndEncrypted(s string) (*NestedJSONWebToken, error) { - enc, err := jose.ParseEncrypted(s) - if err != nil { - return nil, err - } - - contentType, _ := enc.Header.ExtraHeaders[jose.HeaderContentType].(string) - if strings.ToUpper(contentType) != "JWT" { - return nil, ErrInvalidContentType - } - - return &NestedJSONWebToken{ - enc: enc, - Headers: []jose.Header{enc.Header}, - }, nil -} diff --git a/vendor/github.com/go-jose/go-jose/v3/.gitignore b/vendor/github.com/go-jose/go-jose/v4/.gitignore similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/.gitignore rename to vendor/github.com/go-jose/go-jose/v4/.gitignore diff --git a/vendor/github.com/go-jose/go-jose/v3/.golangci.yml b/vendor/github.com/go-jose/go-jose/v4/.golangci.yml similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/.golangci.yml rename to vendor/github.com/go-jose/go-jose/v4/.golangci.yml diff --git a/vendor/github.com/go-jose/go-jose/v3/.travis.yml b/vendor/github.com/go-jose/go-jose/v4/.travis.yml similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/.travis.yml rename to vendor/github.com/go-jose/go-jose/v4/.travis.yml diff --git a/vendor/github.com/go-jose/go-jose/v3/CHANGELOG.md b/vendor/github.com/go-jose/go-jose/v4/CHANGELOG.md similarity index 96% rename from vendor/github.com/go-jose/go-jose/v3/CHANGELOG.md rename to vendor/github.com/go-jose/go-jose/v4/CHANGELOG.md index ce2a54eb..28bdd2fc 100644 --- a/vendor/github.com/go-jose/go-jose/v3/CHANGELOG.md +++ b/vendor/github.com/go-jose/go-jose/v4/CHANGELOG.md @@ -45,12 +45,6 @@ token". [1]: https://i.blackhat.com/BH-US-23/Presentations/US-23-Tervoort-Three-New-Attacks-Against-JSON-Web-Tokens.pdf -# v3.0.3 - -## Fixed - - - Limit decompression output size to prevent a DoS. Backport from v4.0.1. - # v3.0.2 ## Fixed diff --git a/vendor/github.com/go-jose/go-jose/v3/CONTRIBUTING.md b/vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/CONTRIBUTING.md rename to vendor/github.com/go-jose/go-jose/v4/CONTRIBUTING.md diff --git a/vendor/github.com/go-jose/go-jose/v3/LICENSE b/vendor/github.com/go-jose/go-jose/v4/LICENSE similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/LICENSE rename to vendor/github.com/go-jose/go-jose/v4/LICENSE diff --git a/vendor/github.com/go-jose/go-jose/v3/README.md b/vendor/github.com/go-jose/go-jose/v4/README.md similarity index 82% rename from vendor/github.com/go-jose/go-jose/v3/README.md rename to vendor/github.com/go-jose/go-jose/v4/README.md index 282cd9e1..79a7c5ec 100644 --- a/vendor/github.com/go-jose/go-jose/v3/README.md +++ b/vendor/github.com/go-jose/go-jose/v4/README.md @@ -1,17 +1,9 @@ # Go JOSE -### Versions - -[Version 4](https://github.com/go-jose/go-jose) -([branch](https://github.com/go-jose/go-jose/), -[doc](https://pkg.go.dev/github.com/go-jose/go-jose/v4), [releases](https://github.com/go-jose/go-jose/releases)) is the current stable version: - - import "github.com/go-jose/go-jose/v4" - -The old [square/go-jose](https://github.com/square/go-jose) repo contains the prior v1 and v2 versions, which -are deprecated. - -### Summary +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4) +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4/jwt.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4/jwt) +[![license](https://img.shields.io/badge/license-apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/go-jose/go-jose/master/LICENSE) +[![test](https://img.shields.io/github/checks-status/go-jose/go-jose/v4)](https://github.com/go-jose/go-jose/actions) Package jose aims to provide an implementation of the Javascript Object Signing and Encryption set of standards. This includes support for JSON Web Encryption, @@ -43,6 +35,20 @@ of [case-insensitive matching](https://www.ietf.org/mail-archive/web/json/curren This is to avoid differences in interpretation of messages between go-jose and libraries in other languages. +### Versions + +[Version 4](https://github.com/go-jose/go-jose) +([branch](https://github.com/go-jose/go-jose/tree/main), +[doc](https://pkg.go.dev/github.com/go-jose/go-jose/v4), [releases](https://github.com/go-jose/go-jose/releases)) is the current stable version: + + import "github.com/go-jose/go-jose/v4" + +The old [square/go-jose](https://github.com/square/go-jose) repo contains the prior v1 and v2 versions, which +are still useable but not actively developed anymore. + +Version 3, in this repo, is still receiving security fixes but not functionality +updates. + ### Supported algorithms See below for a table of supported algorithms. Algorithm identifiers match @@ -98,11 +104,11 @@ allows attaching a key id. ## Examples -[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v3.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v3) -[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v3/jwt.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v3/jwt) +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4) +[![godoc](https://pkg.go.dev/badge/github.com/go-jose/go-jose/v4/jwt.svg)](https://pkg.go.dev/github.com/go-jose/go-jose/v4/jwt) Examples can be found in the Godoc reference for this package. The -[`jose-util`](https://github.com/go-jose/go-jose/tree/v3/jose-util) +[`jose-util`](https://github.com/go-jose/go-jose/tree/v4/jose-util) subdirectory also contains a small command-line utility which might be useful as an example as well. diff --git a/vendor/github.com/go-jose/go-jose/v3/SECURITY.md b/vendor/github.com/go-jose/go-jose/v4/SECURITY.md similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/SECURITY.md rename to vendor/github.com/go-jose/go-jose/v4/SECURITY.md diff --git a/vendor/github.com/go-jose/go-jose/v3/asymmetric.go b/vendor/github.com/go-jose/go-jose/v4/asymmetric.go similarity index 99% rename from vendor/github.com/go-jose/go-jose/v3/asymmetric.go rename to vendor/github.com/go-jose/go-jose/v4/asymmetric.go index d4d4961b..f8d5774e 100644 --- a/vendor/github.com/go-jose/go-jose/v3/asymmetric.go +++ b/vendor/github.com/go-jose/go-jose/v4/asymmetric.go @@ -29,8 +29,8 @@ import ( "fmt" "math/big" - josecipher "github.com/go-jose/go-jose/v3/cipher" - "github.com/go-jose/go-jose/v3/json" + josecipher "github.com/go-jose/go-jose/v4/cipher" + "github.com/go-jose/go-jose/v4/json" ) // A generic RSA-based encrypter/verifier diff --git a/vendor/github.com/go-jose/go-jose/v3/cipher/cbc_hmac.go b/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/cipher/cbc_hmac.go rename to vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go diff --git a/vendor/github.com/go-jose/go-jose/v3/cipher/concat_kdf.go b/vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/cipher/concat_kdf.go rename to vendor/github.com/go-jose/go-jose/v4/cipher/concat_kdf.go diff --git a/vendor/github.com/go-jose/go-jose/v3/cipher/ecdh_es.go b/vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/cipher/ecdh_es.go rename to vendor/github.com/go-jose/go-jose/v4/cipher/ecdh_es.go diff --git a/vendor/github.com/go-jose/go-jose/v3/cipher/key_wrap.go b/vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/cipher/key_wrap.go rename to vendor/github.com/go-jose/go-jose/v4/cipher/key_wrap.go diff --git a/vendor/github.com/go-jose/go-jose/v3/crypter.go b/vendor/github.com/go-jose/go-jose/v4/crypter.go similarity index 99% rename from vendor/github.com/go-jose/go-jose/v3/crypter.go rename to vendor/github.com/go-jose/go-jose/v4/crypter.go index 8870e890..aba08424 100644 --- a/vendor/github.com/go-jose/go-jose/v3/crypter.go +++ b/vendor/github.com/go-jose/go-jose/v4/crypter.go @@ -22,7 +22,7 @@ import ( "errors" "fmt" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // Encrypter represents an encrypter which produces an encrypted JWE object. diff --git a/vendor/github.com/go-jose/go-jose/v3/doc.go b/vendor/github.com/go-jose/go-jose/v4/doc.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/doc.go rename to vendor/github.com/go-jose/go-jose/v4/doc.go diff --git a/vendor/github.com/go-jose/go-jose/v3/encoding.go b/vendor/github.com/go-jose/go-jose/v4/encoding.go similarity index 92% rename from vendor/github.com/go-jose/go-jose/v3/encoding.go rename to vendor/github.com/go-jose/go-jose/v4/encoding.go index 9f07cfdc..4f6e0d4a 100644 --- a/vendor/github.com/go-jose/go-jose/v3/encoding.go +++ b/vendor/github.com/go-jose/go-jose/v4/encoding.go @@ -27,7 +27,7 @@ import ( "strings" "unicode" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // Helper function to serialize known-good objects. @@ -106,10 +106,7 @@ func inflate(input []byte) ([]byte, error) { output := new(bytes.Buffer) reader := flate.NewReader(bytes.NewBuffer(input)) - maxCompressedSize := 10 * int64(len(input)) - if maxCompressedSize < 250000 { - maxCompressedSize = 250000 - } + maxCompressedSize := max(250_000, 10*int64(len(input))) limit := maxCompressedSize + 1 n, err := io.CopyN(output, reader, limit) @@ -167,7 +164,7 @@ func (b *byteBuffer) UnmarshalJSON(data []byte) error { return nil } - decoded, err := base64URLDecode(encoded) + decoded, err := base64.RawURLEncoding.DecodeString(encoded) if err != nil { return err } @@ -197,12 +194,6 @@ func (b byteBuffer) toInt() int { return int(b.bigInt().Int64()) } -// base64URLDecode is implemented as defined in https://www.rfc-editor.org/rfc/rfc7515.html#appendix-C -func base64URLDecode(value string) ([]byte, error) { - value = strings.TrimRight(value, "=") - return base64.RawURLEncoding.DecodeString(value) -} - func base64EncodeLen(sl []byte) int { return base64.RawURLEncoding.EncodedLen(len(sl)) } diff --git a/vendor/github.com/go-jose/go-jose/v3/json/LICENSE b/vendor/github.com/go-jose/go-jose/v4/json/LICENSE similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/LICENSE rename to vendor/github.com/go-jose/go-jose/v4/json/LICENSE diff --git a/vendor/github.com/go-jose/go-jose/v3/json/README.md b/vendor/github.com/go-jose/go-jose/v4/json/README.md similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/README.md rename to vendor/github.com/go-jose/go-jose/v4/json/README.md diff --git a/vendor/github.com/go-jose/go-jose/v3/json/decode.go b/vendor/github.com/go-jose/go-jose/v4/json/decode.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/decode.go rename to vendor/github.com/go-jose/go-jose/v4/json/decode.go diff --git a/vendor/github.com/go-jose/go-jose/v3/json/encode.go b/vendor/github.com/go-jose/go-jose/v4/json/encode.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/encode.go rename to vendor/github.com/go-jose/go-jose/v4/json/encode.go diff --git a/vendor/github.com/go-jose/go-jose/v3/json/indent.go b/vendor/github.com/go-jose/go-jose/v4/json/indent.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/indent.go rename to vendor/github.com/go-jose/go-jose/v4/json/indent.go diff --git a/vendor/github.com/go-jose/go-jose/v3/json/scanner.go b/vendor/github.com/go-jose/go-jose/v4/json/scanner.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/scanner.go rename to vendor/github.com/go-jose/go-jose/v4/json/scanner.go diff --git a/vendor/github.com/go-jose/go-jose/v3/json/stream.go b/vendor/github.com/go-jose/go-jose/v4/json/stream.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/stream.go rename to vendor/github.com/go-jose/go-jose/v4/json/stream.go diff --git a/vendor/github.com/go-jose/go-jose/v3/json/tags.go b/vendor/github.com/go-jose/go-jose/v4/json/tags.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/json/tags.go rename to vendor/github.com/go-jose/go-jose/v4/json/tags.go diff --git a/vendor/github.com/go-jose/go-jose/v3/jwe.go b/vendor/github.com/go-jose/go-jose/v4/jwe.go similarity index 63% rename from vendor/github.com/go-jose/go-jose/v3/jwe.go rename to vendor/github.com/go-jose/go-jose/v4/jwe.go index 4267ac75..89f03ee3 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jwe.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwe.go @@ -18,10 +18,11 @@ package jose import ( "encoding/base64" + "errors" "fmt" "strings" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // rawJSONWebEncryption represents a raw JWE JSON object. Used for parsing/serializing. @@ -104,29 +105,75 @@ func (obj JSONWebEncryption) computeAuthData() []byte { return output } -// ParseEncrypted parses an encrypted message in compact or JWE JSON Serialization format. -func ParseEncrypted(input string) (*JSONWebEncryption, error) { +func containsKeyAlgorithm(haystack []KeyAlgorithm, needle KeyAlgorithm) bool { + for _, algorithm := range haystack { + if algorithm == needle { + return true + } + } + return false +} + +func containsContentEncryption(haystack []ContentEncryption, needle ContentEncryption) bool { + for _, algorithm := range haystack { + if algorithm == needle { + return true + } + } + return false +} + +// ParseEncrypted parses an encrypted message in JWE Compact or JWE JSON Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7516#section-3.1 +// https://datatracker.ietf.org/doc/html/rfc7516#section-3.2 +// +// The keyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" +// header parameters respectively. They must be nonempty, and each "alg" or "enc" header in +// parsed data must contain a value that is present in the corresponding parameter. That +// includes the protected and unprotected headers as well as all recipients. To accept +// multiple algorithms, pass a slice of all the algorithms you want to accept. +func ParseEncrypted(input string, + keyEncryptionAlgorithms []KeyAlgorithm, + contentEncryption []ContentEncryption, +) (*JSONWebEncryption, error) { input = stripWhitespace(input) if strings.HasPrefix(input, "{") { - return parseEncryptedFull(input) + return ParseEncryptedJSON(input, keyEncryptionAlgorithms, contentEncryption) } - return parseEncryptedCompact(input) + return ParseEncryptedCompact(input, keyEncryptionAlgorithms, contentEncryption) } -// parseEncryptedFull parses a message in compact format. -func parseEncryptedFull(input string) (*JSONWebEncryption, error) { +// ParseEncryptedJSON parses a message in JWE JSON Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7516#section-3.2 +func ParseEncryptedJSON( + input string, + keyEncryptionAlgorithms []KeyAlgorithm, + contentEncryption []ContentEncryption, +) (*JSONWebEncryption, error) { var parsed rawJSONWebEncryption err := json.Unmarshal([]byte(input), &parsed) if err != nil { return nil, err } - return parsed.sanitized() + return parsed.sanitized(keyEncryptionAlgorithms, contentEncryption) } // sanitized produces a cleaned-up JWE object from the raw JSON. -func (parsed *rawJSONWebEncryption) sanitized() (*JSONWebEncryption, error) { +func (parsed *rawJSONWebEncryption) sanitized( + keyEncryptionAlgorithms []KeyAlgorithm, + contentEncryption []ContentEncryption, +) (*JSONWebEncryption, error) { + if len(keyEncryptionAlgorithms) == 0 { + return nil, errors.New("go-jose/go-jose: no key algorithms provided") + } + if len(contentEncryption) == 0 { + return nil, errors.New("go-jose/go-jose: no content encryption algorithms provided") + } + obj := &JSONWebEncryption{ original: parsed, unprotected: parsed.Unprotected, @@ -170,7 +217,7 @@ func (parsed *rawJSONWebEncryption) sanitized() (*JSONWebEncryption, error) { } else { obj.recipients = make([]recipientInfo, len(parsed.Recipients)) for r := range parsed.Recipients { - encryptedKey, err := base64URLDecode(parsed.Recipients[r].EncryptedKey) + encryptedKey, err := base64.RawURLEncoding.DecodeString(parsed.Recipients[r].EncryptedKey) if err != nil { return nil, err } @@ -185,10 +232,31 @@ func (parsed *rawJSONWebEncryption) sanitized() (*JSONWebEncryption, error) { } } - for _, recipient := range obj.recipients { + for i, recipient := range obj.recipients { headers := obj.mergedHeaders(&recipient) - if headers.getAlgorithm() == "" || headers.getEncryption() == "" { - return nil, fmt.Errorf("go-jose/go-jose: message is missing alg/enc headers") + if headers.getAlgorithm() == "" { + return nil, fmt.Errorf(`go-jose/go-jose: recipient %d: missing header "alg"`, i) + } + if headers.getEncryption() == "" { + return nil, fmt.Errorf(`go-jose/go-jose: recipient %d: missing header "enc"`, i) + } + err := validateAlgEnc(headers, keyEncryptionAlgorithms, contentEncryption) + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: recipient %d: %s", i, err) + } + + } + + if obj.protected != nil { + err := validateAlgEnc(*obj.protected, keyEncryptionAlgorithms, contentEncryption) + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: protected header: %s", err) + } + } + if obj.unprotected != nil { + err := validateAlgEnc(*obj.unprotected, keyEncryptionAlgorithms, contentEncryption) + if err != nil { + return nil, fmt.Errorf("go-jose/go-jose: unprotected header: %s", err) } } @@ -200,34 +268,52 @@ func (parsed *rawJSONWebEncryption) sanitized() (*JSONWebEncryption, error) { return obj, nil } -// parseEncryptedCompact parses a message in compact format. -func parseEncryptedCompact(input string) (*JSONWebEncryption, error) { +func validateAlgEnc(headers rawHeader, keyAlgorithms []KeyAlgorithm, contentEncryption []ContentEncryption) error { + alg := headers.getAlgorithm() + enc := headers.getEncryption() + if alg != "" && !containsKeyAlgorithm(keyAlgorithms, alg) { + return fmt.Errorf("unexpected key algorithm %q; expected %q", alg, keyAlgorithms) + } + if alg != "" && !containsContentEncryption(contentEncryption, enc) { + return fmt.Errorf("unexpected content encryption algorithm %q; expected %q", enc, contentEncryption) + } + return nil +} + +// ParseEncryptedCompact parses a message in JWE Compact Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7516#section-3.1 +func ParseEncryptedCompact( + input string, + keyAlgorithms []KeyAlgorithm, + contentEncryption []ContentEncryption, +) (*JSONWebEncryption, error) { parts := strings.Split(input, ".") if len(parts) != 5 { return nil, fmt.Errorf("go-jose/go-jose: compact JWE format must have five parts") } - rawProtected, err := base64URLDecode(parts[0]) + rawProtected, err := base64.RawURLEncoding.DecodeString(parts[0]) if err != nil { return nil, err } - encryptedKey, err := base64URLDecode(parts[1]) + encryptedKey, err := base64.RawURLEncoding.DecodeString(parts[1]) if err != nil { return nil, err } - iv, err := base64URLDecode(parts[2]) + iv, err := base64.RawURLEncoding.DecodeString(parts[2]) if err != nil { return nil, err } - ciphertext, err := base64URLDecode(parts[3]) + ciphertext, err := base64.RawURLEncoding.DecodeString(parts[3]) if err != nil { return nil, err } - tag, err := base64URLDecode(parts[4]) + tag, err := base64.RawURLEncoding.DecodeString(parts[4]) if err != nil { return nil, err } @@ -240,7 +326,7 @@ func parseEncryptedCompact(input string) (*JSONWebEncryption, error) { Tag: newBuffer(tag), } - return raw.sanitized() + return raw.sanitized(keyAlgorithms, contentEncryption) } // CompactSerialize serializes an object using the compact serialization format. diff --git a/vendor/github.com/go-jose/go-jose/v3/jwk.go b/vendor/github.com/go-jose/go-jose/v4/jwk.go similarity index 99% rename from vendor/github.com/go-jose/go-jose/v3/jwk.go rename to vendor/github.com/go-jose/go-jose/v4/jwk.go index e4021959..a565aaab 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jwk.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwk.go @@ -35,7 +35,7 @@ import ( "reflect" "strings" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // rawJSONWebKey represents a public or private key in JWK format, used for parsing/serializing. @@ -266,7 +266,7 @@ func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) { // x5t parameters are base64url-encoded SHA thumbprints // See RFC 7517, Section 4.8, https://tools.ietf.org/html/rfc7517#section-4.8 - x5tSHA1bytes, err := base64URLDecode(raw.X5tSHA1) + x5tSHA1bytes, err := base64.RawURLEncoding.DecodeString(raw.X5tSHA1) if err != nil { return errors.New("go-jose/go-jose: invalid JWK, x5t header has invalid encoding") } @@ -286,7 +286,7 @@ func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) { k.CertificateThumbprintSHA1 = x5tSHA1bytes - x5tSHA256bytes, err := base64URLDecode(raw.X5tSHA256) + x5tSHA256bytes, err := base64.RawURLEncoding.DecodeString(raw.X5tSHA256) if err != nil { return errors.New("go-jose/go-jose: invalid JWK, x5t#S256 header has invalid encoding") } diff --git a/vendor/github.com/go-jose/go-jose/v3/jws.go b/vendor/github.com/go-jose/go-jose/v4/jws.go similarity index 80% rename from vendor/github.com/go-jose/go-jose/v3/jws.go rename to vendor/github.com/go-jose/go-jose/v4/jws.go index e37007db..3a912301 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jws.go +++ b/vendor/github.com/go-jose/go-jose/v4/jws.go @@ -23,7 +23,7 @@ import ( "fmt" "strings" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // rawJSONWebSignature represents a raw JWS JSON object. Used for parsing/serializing. @@ -75,22 +75,41 @@ type Signature struct { original *rawSignatureInfo } -// ParseSigned parses a signed message in compact or JWS JSON Serialization format. -func ParseSigned(signature string) (*JSONWebSignature, error) { +// ParseSigned parses a signed message in JWS Compact or JWS JSON Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7515#section-7 +func ParseSigned( + signature string, + signatureAlgorithms []SignatureAlgorithm, +) (*JSONWebSignature, error) { signature = stripWhitespace(signature) if strings.HasPrefix(signature, "{") { - return parseSignedFull(signature) + return ParseSignedJSON(signature, signatureAlgorithms) } - return parseSignedCompact(signature, nil) + return parseSignedCompact(signature, nil, signatureAlgorithms) +} + +// ParseSignedCompact parses a message in JWS Compact Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7515#section-7.1 +func ParseSignedCompact( + signature string, + signatureAlgorithms []SignatureAlgorithm, +) (*JSONWebSignature, error) { + return parseSignedCompact(signature, nil, signatureAlgorithms) } // ParseDetached parses a signed message in compact serialization format with detached payload. -func ParseDetached(signature string, payload []byte) (*JSONWebSignature, error) { +func ParseDetached( + signature string, + payload []byte, + signatureAlgorithms []SignatureAlgorithm, +) (*JSONWebSignature, error) { if payload == nil { return nil, errors.New("go-jose/go-jose: nil payload") } - return parseSignedCompact(stripWhitespace(signature), payload) + return parseSignedCompact(stripWhitespace(signature), payload, signatureAlgorithms) } // Get a header value @@ -137,19 +156,36 @@ func (obj JSONWebSignature) computeAuthData(payload []byte, signature *Signature return authData.Bytes(), nil } -// parseSignedFull parses a message in full format. -func parseSignedFull(input string) (*JSONWebSignature, error) { +// ParseSignedJSON parses a message in JWS JSON Serialization. +// +// https://datatracker.ietf.org/doc/html/rfc7515#section-7.2 +func ParseSignedJSON( + input string, + signatureAlgorithms []SignatureAlgorithm, +) (*JSONWebSignature, error) { var parsed rawJSONWebSignature err := json.Unmarshal([]byte(input), &parsed) if err != nil { return nil, err } - return parsed.sanitized() + return parsed.sanitized(signatureAlgorithms) +} + +func containsSignatureAlgorithm(haystack []SignatureAlgorithm, needle SignatureAlgorithm) bool { + for _, algorithm := range haystack { + if algorithm == needle { + return true + } + } + return false } // sanitized produces a cleaned-up JWS object from the raw JSON. -func (parsed *rawJSONWebSignature) sanitized() (*JSONWebSignature, error) { +func (parsed *rawJSONWebSignature) sanitized(signatureAlgorithms []SignatureAlgorithm) (*JSONWebSignature, error) { + if len(signatureAlgorithms) == 0 { + return nil, errors.New("go-jose/go-jose: no signature algorithms specified") + } if parsed.Payload == nil { return nil, fmt.Errorf("go-jose/go-jose: missing payload in JWS message") } @@ -198,6 +234,12 @@ func (parsed *rawJSONWebSignature) sanitized() (*JSONWebSignature, error) { return nil, err } + alg := SignatureAlgorithm(signature.Header.Algorithm) + if !containsSignatureAlgorithm(signatureAlgorithms, alg) { + return nil, fmt.Errorf("go-jose/go-jose: unexpected signature algorithm %q; expected %q", + alg, signatureAlgorithms) + } + if signature.header != nil { signature.Unprotected, err = signature.header.sanitized() if err != nil { @@ -241,6 +283,12 @@ func (parsed *rawJSONWebSignature) sanitized() (*JSONWebSignature, error) { return nil, err } + alg := SignatureAlgorithm(obj.Signatures[i].Header.Algorithm) + if !containsSignatureAlgorithm(signatureAlgorithms, alg) { + return nil, fmt.Errorf("go-jose/go-jose: unexpected signature algorithm %q; expected %q", + alg, signatureAlgorithms) + } + if obj.Signatures[i].header != nil { obj.Signatures[i].Unprotected, err = obj.Signatures[i].header.sanitized() if err != nil { @@ -274,7 +322,11 @@ func (parsed *rawJSONWebSignature) sanitized() (*JSONWebSignature, error) { } // parseSignedCompact parses a message in compact format. -func parseSignedCompact(input string, payload []byte) (*JSONWebSignature, error) { +func parseSignedCompact( + input string, + payload []byte, + signatureAlgorithms []SignatureAlgorithm, +) (*JSONWebSignature, error) { parts := strings.Split(input, ".") if len(parts) != 3 { return nil, fmt.Errorf("go-jose/go-jose: compact JWS format must have three parts") @@ -284,19 +336,19 @@ func parseSignedCompact(input string, payload []byte) (*JSONWebSignature, error) return nil, fmt.Errorf("go-jose/go-jose: payload is not detached") } - rawProtected, err := base64URLDecode(parts[0]) + rawProtected, err := base64.RawURLEncoding.DecodeString(parts[0]) if err != nil { return nil, err } if payload == nil { - payload, err = base64URLDecode(parts[1]) + payload, err = base64.RawURLEncoding.DecodeString(parts[1]) if err != nil { return nil, err } } - signature, err := base64URLDecode(parts[2]) + signature, err := base64.RawURLEncoding.DecodeString(parts[2]) if err != nil { return nil, err } @@ -306,7 +358,7 @@ func parseSignedCompact(input string, payload []byte) (*JSONWebSignature, error) Protected: newBuffer(rawProtected), Signature: newBuffer(signature), } - return raw.sanitized() + return raw.sanitized(signatureAlgorithms) } func (obj JSONWebSignature) compactSerialize(detached bool) (string, error) { diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/builder.go b/vendor/github.com/go-jose/go-jose/v4/jwt/builder.go similarity index 83% rename from vendor/github.com/go-jose/go-jose/v3/jwt/builder.go rename to vendor/github.com/go-jose/go-jose/v4/jwt/builder.go index 7df270cc..d68bb372 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jwt/builder.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/builder.go @@ -21,13 +21,13 @@ import ( "bytes" "reflect" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" - "github.com/go-jose/go-jose/v3" + "github.com/go-jose/go-jose/v4" ) // Builder is a utility for making JSON Web Tokens. Calls can be chained, and -// errors are accumulated until the final call to CompactSerialize/FullSerialize. +// errors are accumulated until the final call to Serialize. type Builder interface { // Claims encodes claims into JWE/JWS form. Multiple calls will merge claims // into single JSON object. If you are passing private claims, make sure to set @@ -36,15 +36,13 @@ type Builder interface { Claims(i interface{}) Builder // Token builds a JSONWebToken from provided data. Token() (*JSONWebToken, error) - // FullSerialize serializes a token using the JWS/JWE JSON Serialization format. - FullSerialize() (string, error) - // CompactSerialize serializes a token using the compact serialization format. - CompactSerialize() (string, error) + // Serialize serializes a token. + Serialize() (string, error) } // NestedBuilder is a utility for making Signed-Then-Encrypted JSON Web Tokens. // Calls can be chained, and errors are accumulated until final call to -// CompactSerialize/FullSerialize. +// Serialize. type NestedBuilder interface { // Claims encodes claims into JWE/JWS form. Multiple calls will merge claims // into single JSON object. If you are passing private claims, make sure to set @@ -53,10 +51,8 @@ type NestedBuilder interface { Claims(i interface{}) NestedBuilder // Token builds a NestedJSONWebToken from provided data. Token() (*NestedJSONWebToken, error) - // FullSerialize serializes a token using the JSON Serialization format. - FullSerialize() (string, error) - // CompactSerialize serializes a token using the compact serialization format. - CompactSerialize() (string, error) + // Serialize serializes a token. + Serialize() (string, error) } type builder struct { @@ -194,7 +190,7 @@ func (b *signedBuilder) Token() (*JSONWebToken, error) { return b.builder.token(sig.Verify, h) } -func (b *signedBuilder) CompactSerialize() (string, error) { +func (b *signedBuilder) Serialize() (string, error) { sig, err := b.sign() if err != nil { return "", err @@ -203,15 +199,6 @@ func (b *signedBuilder) CompactSerialize() (string, error) { return sig.CompactSerialize() } -func (b *signedBuilder) FullSerialize() (string, error) { - sig, err := b.sign() - if err != nil { - return "", err - } - - return sig.FullSerialize(), nil -} - func (b *signedBuilder) sign() (*jose.JSONWebSignature, error) { if b.err != nil { return nil, b.err @@ -232,7 +219,7 @@ func (b *encryptedBuilder) Claims(i interface{}) Builder { } } -func (b *encryptedBuilder) CompactSerialize() (string, error) { +func (b *encryptedBuilder) Serialize() (string, error) { enc, err := b.encrypt() if err != nil { return "", err @@ -241,15 +228,6 @@ func (b *encryptedBuilder) CompactSerialize() (string, error) { return enc.CompactSerialize() } -func (b *encryptedBuilder) FullSerialize() (string, error) { - enc, err := b.encrypt() - if err != nil { - return "", err - } - - return enc.FullSerialize(), nil -} - func (b *encryptedBuilder) Token() (*JSONWebToken, error) { enc, err := b.encrypt() if err != nil { @@ -280,6 +258,8 @@ func (b *nestedBuilder) Claims(i interface{}) NestedBuilder { } } +// Token produced a token suitable for serialization. It cannot be decrypted +// without serializing and then deserializing. func (b *nestedBuilder) Token() (*NestedJSONWebToken, error) { enc, err := b.signAndEncrypt() if err != nil { @@ -287,12 +267,13 @@ func (b *nestedBuilder) Token() (*NestedJSONWebToken, error) { } return &NestedJSONWebToken{ - enc: enc, - Headers: []jose.Header{enc.Header}, + allowedSignatureAlgorithms: nil, + enc: enc, + Headers: []jose.Header{enc.Header}, }, nil } -func (b *nestedBuilder) CompactSerialize() (string, error) { +func (b *nestedBuilder) Serialize() (string, error) { enc, err := b.signAndEncrypt() if err != nil { return "", err diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/claims.go b/vendor/github.com/go-jose/go-jose/v4/jwt/claims.go similarity index 98% rename from vendor/github.com/go-jose/go-jose/v3/jwt/claims.go rename to vendor/github.com/go-jose/go-jose/v4/jwt/claims.go index b2a8dc8d..e73412a3 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jwt/claims.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/claims.go @@ -21,7 +21,7 @@ import ( "strconv" "time" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // Claims represents public claim values (as specified in RFC 7519). diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/doc.go b/vendor/github.com/go-jose/go-jose/v4/jwt/doc.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/jwt/doc.go rename to vendor/github.com/go-jose/go-jose/v4/jwt/doc.go diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/errors.go b/vendor/github.com/go-jose/go-jose/v4/jwt/errors.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/jwt/errors.go rename to vendor/github.com/go-jose/go-jose/v4/jwt/errors.go diff --git a/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go b/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go new file mode 100644 index 00000000..c4998d78 --- /dev/null +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/jwt.go @@ -0,0 +1,198 @@ +/*- + * Copyright 2016 Zbigniew Mandziejewicz + * Copyright 2016 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jwt + +import ( + "fmt" + "strings" + + jose "github.com/go-jose/go-jose/v4" + "github.com/go-jose/go-jose/v4/json" +) + +// JSONWebToken represents a JSON Web Token (as specified in RFC7519). +type JSONWebToken struct { + payload func(k interface{}) ([]byte, error) + unverifiedPayload func() []byte + Headers []jose.Header +} + +type NestedJSONWebToken struct { + enc *jose.JSONWebEncryption + Headers []jose.Header + // Used when parsing and decrypting an input + allowedSignatureAlgorithms []jose.SignatureAlgorithm +} + +// Claims deserializes a JSONWebToken into dest using the provided key. +func (t *JSONWebToken) Claims(key interface{}, dest ...interface{}) error { + b, err := t.payload(key) + if err != nil { + return err + } + + for _, d := range dest { + if err := json.Unmarshal(b, d); err != nil { + return err + } + } + + return nil +} + +// UnsafeClaimsWithoutVerification deserializes the claims of a +// JSONWebToken into the dests. For signed JWTs, the claims are not +// verified. This function won't work for encrypted JWTs. +func (t *JSONWebToken) UnsafeClaimsWithoutVerification(dest ...interface{}) error { + if t.unverifiedPayload == nil { + return fmt.Errorf("go-jose/go-jose: Cannot get unverified claims") + } + claims := t.unverifiedPayload() + for _, d := range dest { + if err := json.Unmarshal(claims, d); err != nil { + return err + } + } + return nil +} + +func (t *NestedJSONWebToken) Decrypt(decryptionKey interface{}) (*JSONWebToken, error) { + b, err := t.enc.Decrypt(decryptionKey) + if err != nil { + return nil, err + } + + sig, err := ParseSigned(string(b), t.allowedSignatureAlgorithms) + if err != nil { + return nil, err + } + + return sig, nil +} + +// ParseSigned parses token from JWS form. +func ParseSigned(s string, signatureAlgorithms []jose.SignatureAlgorithm) (*JSONWebToken, error) { + sig, err := jose.ParseSignedCompact(s, signatureAlgorithms) + if err != nil { + return nil, err + } + headers := make([]jose.Header, len(sig.Signatures)) + for i, signature := range sig.Signatures { + headers[i] = signature.Header + } + + return &JSONWebToken{ + payload: sig.Verify, + unverifiedPayload: sig.UnsafePayloadWithoutVerification, + Headers: headers, + }, nil +} + +func validateKeyEncryptionAlgorithm(algs []jose.KeyAlgorithm) error { + for _, alg := range algs { + switch alg { + case jose.ED25519, + jose.RSA1_5, + jose.RSA_OAEP, + jose.RSA_OAEP_256, + jose.ECDH_ES, + jose.ECDH_ES_A128KW, + jose.ECDH_ES_A192KW, + jose.ECDH_ES_A256KW: + return fmt.Errorf("asymmetric encryption algorithms not supported for JWT: "+ + "invalid key encryption algorithm: %s", alg) + case jose.PBES2_HS256_A128KW, + jose.PBES2_HS384_A192KW, + jose.PBES2_HS512_A256KW: + return fmt.Errorf("password-based encryption not supported for JWT: "+ + "invalid key encryption algorithm: %s", alg) + } + } + return nil +} + +func parseEncryptedCompact( + s string, + keyAlgorithms []jose.KeyAlgorithm, + contentEncryption []jose.ContentEncryption, +) (*jose.JSONWebEncryption, error) { + err := validateKeyEncryptionAlgorithm(keyAlgorithms) + if err != nil { + return nil, err + } + enc, err := jose.ParseEncryptedCompact(s, keyAlgorithms, contentEncryption) + if err != nil { + return nil, err + } + return enc, nil +} + +// ParseEncrypted parses token from JWE form. +// +// The keyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" +// header parameters respectively. They must be nonempty, and each "alg" or "enc" header in +// parsed data must contain a value that is present in the corresponding parameter. That +// includes the protected and unprotected headers as well as all recipients. To accept +// multiple algorithms, pass a slice of all the algorithms you want to accept. +func ParseEncrypted(s string, + keyAlgorithms []jose.KeyAlgorithm, + contentEncryption []jose.ContentEncryption, +) (*JSONWebToken, error) { + enc, err := parseEncryptedCompact(s, keyAlgorithms, contentEncryption) + if err != nil { + return nil, err + } + + return &JSONWebToken{ + payload: enc.Decrypt, + Headers: []jose.Header{enc.Header}, + }, nil +} + +// ParseSignedAndEncrypted parses signed-then-encrypted token from JWE form. +// +// The encryptionKeyAlgorithms and contentEncryption parameters are used to validate the "alg" and "enc" +// header parameters, respectively, of the outer JWE. They must be nonempty, and each "alg" or "enc" +// header in parsed data must contain a value that is present in the corresponding parameter. That +// includes the protected and unprotected headers as well as all recipients. To accept +// multiple algorithms, pass a slice of all the algorithms you want to accept. +// +// The signatureAlgorithms parameter is used to validate the "alg" header parameter of the +// inner JWS. It must be nonempty, and the "alg" header in the inner JWS must contain a value +// that is present in the parameter. +func ParseSignedAndEncrypted(s string, + encryptionKeyAlgorithms []jose.KeyAlgorithm, + contentEncryption []jose.ContentEncryption, + signatureAlgorithms []jose.SignatureAlgorithm, +) (*NestedJSONWebToken, error) { + enc, err := parseEncryptedCompact(s, encryptionKeyAlgorithms, contentEncryption) + if err != nil { + return nil, err + } + + contentType, _ := enc.Header.ExtraHeaders[jose.HeaderContentType].(string) + if strings.ToUpper(contentType) != "JWT" { + return nil, ErrInvalidContentType + } + + return &NestedJSONWebToken{ + allowedSignatureAlgorithms: signatureAlgorithms, + enc: enc, + Headers: []jose.Header{enc.Header}, + }, nil +} diff --git a/vendor/github.com/go-jose/go-jose/v3/jwt/validation.go b/vendor/github.com/go-jose/go-jose/v4/jwt/validation.go similarity index 91% rename from vendor/github.com/go-jose/go-jose/v3/jwt/validation.go rename to vendor/github.com/go-jose/go-jose/v4/jwt/validation.go index 09d8541f..841a93ee 100644 --- a/vendor/github.com/go-jose/go-jose/v3/jwt/validation.go +++ b/vendor/github.com/go-jose/go-jose/v4/jwt/validation.go @@ -33,8 +33,9 @@ type Expected struct { Issuer string // Subject matches the "sub" claim exactly. Subject string - // Audience matches the values in "aud" claim, regardless of their order. - Audience Audience + // AnyAudience matches if there is a non-empty intersection between + // its values and the values in the "aud" claim. + AnyAudience Audience // ID matches the "jti" claim exactly. ID string // Time matches the "exp", "nbf" and "iat" claims with leeway. @@ -88,12 +89,18 @@ func (c Claims) ValidateWithLeeway(e Expected, leeway time.Duration) error { return ErrInvalidID } - if len(e.Audience) != 0 { - for _, v := range e.Audience { - if !c.Audience.Contains(v) { - return ErrInvalidAudience + if len(e.AnyAudience) != 0 { + var intersection bool + for _, v := range e.AnyAudience { + if c.Audience.Contains(v) { + intersection = true + break } } + + if !intersection { + return ErrInvalidAudience + } } // validate using the e.Time, or time.Now if not provided diff --git a/vendor/github.com/go-jose/go-jose/v3/opaque.go b/vendor/github.com/go-jose/go-jose/v4/opaque.go similarity index 100% rename from vendor/github.com/go-jose/go-jose/v3/opaque.go rename to vendor/github.com/go-jose/go-jose/v4/opaque.go diff --git a/vendor/github.com/go-jose/go-jose/v3/shared.go b/vendor/github.com/go-jose/go-jose/v4/shared.go similarity index 99% rename from vendor/github.com/go-jose/go-jose/v3/shared.go rename to vendor/github.com/go-jose/go-jose/v4/shared.go index 489a04e3..b485e43b 100644 --- a/vendor/github.com/go-jose/go-jose/v3/shared.go +++ b/vendor/github.com/go-jose/go-jose/v4/shared.go @@ -23,7 +23,7 @@ import ( "errors" "fmt" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // KeyAlgorithm represents a key management algorithm. diff --git a/vendor/github.com/go-jose/go-jose/v3/signing.go b/vendor/github.com/go-jose/go-jose/v4/signing.go similarity index 97% rename from vendor/github.com/go-jose/go-jose/v3/signing.go rename to vendor/github.com/go-jose/go-jose/v4/signing.go index 52f3d856..f0b0294f 100644 --- a/vendor/github.com/go-jose/go-jose/v3/signing.go +++ b/vendor/github.com/go-jose/go-jose/v4/signing.go @@ -25,7 +25,7 @@ import ( "errors" "fmt" - "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v4/json" ) // NonceSource represents a source of random nonces to go into JWS objects @@ -49,6 +49,11 @@ type Signer interface { // - JSONWebKey // - []byte (an HMAC key) // - Any type that satisfies the OpaqueSigner interface +// +// If the key is an HMAC key, it must have at least as many bytes as the relevant hash output: +// - HS256: 32 bytes +// - HS384: 48 bytes +// - HS512: 64 bytes type SigningKey struct { Algorithm SignatureAlgorithm Key interface{} @@ -355,6 +360,11 @@ func (ctx *genericSigner) Options() SignerOptions { // - JSONWebKey // - []byte (an HMAC key) // - Any type that implements the OpaqueVerifier interface. +// +// If the key is an HMAC key, it must have at least as many bytes as the relevant hash output: +// - HS256: 32 bytes +// - HS384: 48 bytes +// - HS512: 64 bytes func (obj JSONWebSignature) Verify(verificationKey interface{}) ([]byte, error) { err := obj.DetachedVerify(obj.payload, verificationKey) if err != nil { diff --git a/vendor/github.com/go-jose/go-jose/v3/symmetric.go b/vendor/github.com/go-jose/go-jose/v4/symmetric.go similarity index 96% rename from vendor/github.com/go-jose/go-jose/v3/symmetric.go rename to vendor/github.com/go-jose/go-jose/v4/symmetric.go index 10d8e19f..a69103b0 100644 --- a/vendor/github.com/go-jose/go-jose/v3/symmetric.go +++ b/vendor/github.com/go-jose/go-jose/v4/symmetric.go @@ -32,7 +32,7 @@ import ( "golang.org/x/crypto/pbkdf2" - josecipher "github.com/go-jose/go-jose/v3/cipher" + josecipher "github.com/go-jose/go-jose/v4/cipher" ) // RandReader is a cryptographically secure random number generator (stubbed out in tests). @@ -454,7 +454,7 @@ func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipien func (ctx symmetricMac) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) { mac, err := ctx.hmac(payload, alg) if err != nil { - return Signature{}, errors.New("go-jose/go-jose: failed to compute hmac") + return Signature{}, err } return Signature{ @@ -486,12 +486,24 @@ func (ctx symmetricMac) verifyPayload(payload []byte, mac []byte, alg SignatureA func (ctx symmetricMac) hmac(payload []byte, alg SignatureAlgorithm) ([]byte, error) { var hash func() hash.Hash + // https://datatracker.ietf.org/doc/html/rfc7518#section-3.2 + // A key of the same size as the hash output (for instance, 256 bits for + // "HS256") or larger MUST be used switch alg { case HS256: + if len(ctx.key)*8 < 256 { + return nil, ErrInvalidKeySize + } hash = sha256.New case HS384: + if len(ctx.key)*8 < 384 { + return nil, ErrInvalidKeySize + } hash = sha512.New384 case HS512: + if len(ctx.key)*8 < 512 { + return nil, ErrInvalidKeySize + } hash = sha512.New default: return nil, ErrUnsupportedAlgorithm diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml new file mode 100644 index 00000000..0cffafa7 --- /dev/null +++ b/vendor/github.com/go-logr/logr/.golangci.yaml @@ -0,0 +1,26 @@ +run: + timeout: 1m + tests: true + +linters: + disable-all: true + enable: + - asciicheck + - errcheck + - forcetypeassert + - gocritic + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - misspell + - revive + - staticcheck + - typecheck + - unused + +issues: + exclude-use-default: false + max-issues-per-linter: 0 + max-same-issues: 10 diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md new file mode 100644 index 00000000..c3569600 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +## v1.0.0-rc1 + +This is the first logged release. Major changes (including breaking changes) +have occurred since earlier tags. diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md new file mode 100644 index 00000000..5d37e294 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# Contributing + +Logr is open to pull-requests, provided they fit within the intended scope of +the project. Specifically, this library aims to be VERY small and minimalist, +with no external dependencies. + +## Compatibility + +This project intends to follow [semantic versioning](http://semver.org) and +is very strict about compatibility. Any proposed changes MUST follow those +rules. + +## Performance + +As a logging library, logr must be as light-weight as possible. Any proposed +code change must include results of running the [benchmark](./benchmark) +before and after the change. diff --git a/vendor/github.com/opencontainers/runc/LICENSE b/vendor/github.com/go-logr/logr/LICENSE similarity index 94% rename from vendor/github.com/opencontainers/runc/LICENSE rename to vendor/github.com/go-logr/logr/LICENSE index 27448585..8dada3ed 100644 --- a/vendor/github.com/opencontainers/runc/LICENSE +++ b/vendor/github.com/go-logr/logr/LICENSE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -176,7 +175,18 @@ END OF TERMS AND CONDITIONS - Copyright 2014 Docker, Inc. + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md new file mode 100644 index 00000000..8969526a --- /dev/null +++ b/vendor/github.com/go-logr/logr/README.md @@ -0,0 +1,406 @@ +# A minimal logging API for Go + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr) + +logr offers an(other) opinion on how Go programs and libraries can do logging +without becoming coupled to a particular logging implementation. This is not +an implementation of logging - it is an API. In fact it is two APIs with two +different sets of users. + +The `Logger` type is intended for application and library authors. It provides +a relatively small API which can be used everywhere you want to emit logs. It +defers the actual act of writing logs (to files, to stdout, or whatever) to the +`LogSink` interface. + +The `LogSink` interface is intended for logging library implementers. It is a +pure interface which can be implemented by logging frameworks to provide the actual logging +functionality. + +This decoupling allows application and library developers to write code in +terms of `logr.Logger` (which has very low dependency fan-out) while the +implementation of logging is managed "up stack" (e.g. in or near `main()`.) +Application developers can then switch out implementations as necessary. + +Many people assert that libraries should not be logging, and as such efforts +like this are pointless. Those people are welcome to convince the authors of +the tens-of-thousands of libraries that *DO* write logs that they are all +wrong. In the meantime, logr takes a more practical approach. + +## Typical usage + +Somewhere, early in an application's life, it will make a decision about which +logging library (implementation) it actually wants to use. Something like: + +``` + func main() { + // ... other setup code ... + + // Create the "root" logger. We have chosen the "logimpl" implementation, + // which takes some initial parameters and returns a logr.Logger. + logger := logimpl.New(param1, param2) + + // ... other setup code ... +``` + +Most apps will call into other libraries, create structures to govern the flow, +etc. The `logr.Logger` object can be passed to these other libraries, stored +in structs, or even used as a package-global variable, if needed. For example: + +``` + app := createTheAppObject(logger) + app.Run() +``` + +Outside of this early setup, no other packages need to know about the choice of +implementation. They write logs in terms of the `logr.Logger` that they +received: + +``` + type appObject struct { + // ... other fields ... + logger logr.Logger + // ... other fields ... + } + + func (app *appObject) Run() { + app.logger.Info("starting up", "timestamp", time.Now()) + + // ... app code ... +``` + +## Background + +If the Go standard library had defined an interface for logging, this project +probably would not be needed. Alas, here we are. + +When the Go developers started developing such an interface with +[slog](https://github.com/golang/go/issues/56345), they adopted some of the +logr design but also left out some parts and changed others: + +| Feature | logr | slog | +|---------|------|------| +| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) | +| Low-level API | `LogSink` | `Handler` | +| Stack unwinding | done by `LogSink` | done by `Logger` | +| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) | +| Generating a value for logging on demand | `Marshaler` | `LogValuer` | +| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" | +| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` | +| Passing logger via context | `NewContext`, `FromContext` | no API | +| Adding a name to a logger | `WithName` | no API | +| Modify verbosity of log entries in a call chain | `V` | no API | +| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` | +| Pass context for extracting additional values | no API | API variants like `InfoCtx` | + +The high-level slog API is explicitly meant to be one of many different APIs +that can be layered on top of a shared `slog.Handler`. logr is one such +alternative API, with [interoperability](#slog-interoperability) provided by +some conversion functions. + +### Inspiration + +Before you consider this package, please read [this blog post by the +inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what +he has to say, and it largely aligns with our own experiences. + +### Differences from Dave's ideas + +The main differences are: + +1. Dave basically proposes doing away with the notion of a logging API in favor +of `fmt.Printf()`. We disagree, especially when you consider things like output +locations, timestamps, file and line decorations, and structured logging. This +package restricts the logging API to just 2 types of logs: info and error. + +Info logs are things you want to tell the user which are not errors. Error +logs are, well, errors. If your code receives an `error` from a subordinate +function call and is logging that `error` *and not returning it*, use error +logs. + +2. Verbosity-levels on info logs. This gives developers a chance to indicate +arbitrary grades of importance for info logs, without assigning names with +semantic meaning such as "warning", "trace", and "debug." Superficially this +may feel very similar, but the primary difference is the lack of semantics. +Because verbosity is a numerical value, it's safe to assume that an app running +with higher verbosity means more (and less important) logs will be generated. + +## Implementations (non-exhaustive) + +There are implementations for the following logging libraries: + +- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr) +- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr) +- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) +- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr) +- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting) +- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) +- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr) +- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) +- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) +- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) +- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr) +- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) +- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) + +## slog interoperability + +Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler` +and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and +`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`. +As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level +slog API. + +### Using a `logr.LogSink` as backend for slog + +Ideally, a logr sink implementation should support both logr and slog by +implementing both the normal logr interface(s) and `SlogSink`. Because +of a conflict in the parameters of the common `Enabled` method, it is [not +possible to implement both slog.Handler and logr.Sink in the same +type](https://github.com/golang/go/issues/59110). + +If both are supported, log calls can go from the high-level APIs to the backend +without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can +convert back and forth without adding additional wrappers, with one exception: +when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then +`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future +log calls. + +Such an implementation should also support values that implement specific +interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`, +`slog.GroupValue`). logr does not convert those. + +Not supporting slog has several drawbacks: +- Recording source code locations works correctly if the handler gets called + through `slog.Logger`, but may be wrong in other cases. That's because a + `logr.Sink` does its own stack unwinding instead of using the program counter + provided by the high-level API. +- slog levels <= 0 can be mapped to logr levels by negating the level without a + loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as + used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink + because logr does not support "more important than info" levels. +- The slog group concept is supported by prefixing each key in a key/value + pair with the group names, separated by a dot. For structured output like + JSON it would be better to group the key/value pairs inside an object. +- Special slog values and interfaces don't work as expected. +- The overhead is likely to be higher. + +These drawbacks are severe enough that applications using a mixture of slog and +logr should switch to a different backend. + +### Using a `slog.Handler` as backend for logr + +Using a plain `slog.Handler` without support for logr works better than the +other direction: +- All logr verbosity levels can be mapped 1:1 to their corresponding slog level + by negating them. +- Stack unwinding is done by the `SlogSink` and the resulting program + counter is passed to the `slog.Handler`. +- Names added via `Logger.WithName` are gathered and recorded in an additional + attribute with `logger` as key and the names separated by slash as value. +- `Logger.Error` is turned into a log record with `slog.LevelError` as level + and an additional attribute with `err` as key, if an error was provided. + +The main drawback is that `logr.Marshaler` will not be supported. Types should +ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility +with logr implementations without slog support is not important, then +`slog.Valuer` is sufficient. + +### Context support for slog + +Storing a logger in a `context.Context` is not supported by +slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be +used to fill this gap. They store and retrieve a `slog.Logger` pointer +under the same context key that is also used by `NewContext` and +`FromContext` for `logr.Logger` value. + +When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will +automatically convert the `slog.Logger` to a +`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction. + +With this approach, binaries which use either slog or logr are as efficient as +possible with no unnecessary allocations. This is also why the API stores a +`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger` +on retrieval would need to allocate one. + +The downside is that switching back and forth needs more allocations. Because +logr is the API that is already in use by different packages, in particular +Kubernetes, the recommendation is to use the `logr.Logger` API in code which +uses contextual logging. + +An alternative to adding values to a logger and storing that logger in the +context is to store the values in the context and to configure a logging +backend to extract those values when emitting log entries. This only works when +log calls are passed the context, which is not supported by the logr API. + +With the slog API, it is possible, but not +required. https://github.com/veqryn/slog-context is a package for slog which +provides additional support code for this approach. It also contains wrappers +for the context functions in logr, so developers who prefer to not use the logr +APIs directly can use those instead and the resulting code will still be +interoperable with logr. + +## FAQ + +### Conceptual + +#### Why structured logging? + +- **Structured logs are more easily queryable**: Since you've got + key-value pairs, it's much easier to query your structured logs for + particular values by filtering on the contents of a particular key -- + think searching request logs for error codes, Kubernetes reconcilers for + the name and namespace of the reconciled object, etc. + +- **Structured logging makes it easier to have cross-referenceable logs**: + Similarly to searchability, if you maintain conventions around your + keys, it becomes easy to gather all log lines related to a particular + concept. + +- **Structured logs allow better dimensions of filtering**: if you have + structure to your logs, you've got more precise control over how much + information is logged -- you might choose in a particular configuration + to log certain keys but not others, only log lines where a certain key + matches a certain value, etc., instead of just having v-levels and names + to key off of. + +- **Structured logs better represent structured data**: sometimes, the + data that you want to log is inherently structured (think tuple-link + objects.) Structured logs allow you to preserve that structure when + outputting. + +#### Why V-levels? + +**V-levels give operators an easy way to control the chattiness of log +operations**. V-levels provide a way for a given package to distinguish +the relative importance or verbosity of a given log message. Then, if +a particular logger or package is logging too many messages, the user +of the package can simply change the v-levels for that library. + +#### Why not named levels, like Info/Warning/Error? + +Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences +from Dave's ideas](#differences-from-daves-ideas). + +#### Why not allow format strings, too? + +**Format strings negate many of the benefits of structured logs**: + +- They're not easily searchable without resorting to fuzzy searching, + regular expressions, etc. + +- They don't store structured data well, since contents are flattened into + a string. + +- They're not cross-referenceable. + +- They don't compress easily, since the message is not constant. + +(Unless you turn positional parameters into key-value pairs with numerical +keys, at which point you've gotten key-value logging with meaningless +keys.) + +### Practical + +#### Why key-value pairs, and not a map? + +Key-value pairs are *much* easier to optimize, especially around +allocations. Zap (a structured logger that inspired logr's interface) has +[performance measurements](https://github.com/uber-go/zap#performance) +that show this quite nicely. + +While the interface ends up being a little less obvious, you get +potentially better performance, plus avoid making users type +`map[string]string{}` every time they want to log. + +#### What if my V-levels differ between libraries? + +That's fine. Control your V-levels on a per-logger basis, and use the +`WithName` method to pass different loggers to different libraries. + +Generally, you should take care to ensure that you have relatively +consistent V-levels within a given logger, however, as this makes deciding +on what verbosity of logs to request easier. + +#### But I really want to use a format string! + +That's not actually a question. Assuming your question is "how do +I convert my mental model of logging with format strings to logging with +constant messages": + +1. Figure out what the error actually is, as you'd write in a TL;DR style, + and use that as a message. + +2. For every place you'd write a format specifier, look to the word before + it, and add that as a key value pair. + +For instance, consider the following examples (all taken from spots in the +Kubernetes codebase): + +- `klog.V(4).Infof("Client is returning errors: code %v, error %v", + responseCode, err)` becomes `logger.Error(err, "client returned an + error", "code", responseCode)` + +- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", + seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after + response when requesting url", "attempt", retries, "after + seconds", seconds, "url", url)` + +If you *really* must use a format string, use it in a key's value, and +call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to +reflect over type %T")` becomes `logger.Info("unable to reflect over +type", "type", fmt.Sprintf("%T"))`. In general though, the cases where +this is necessary should be few and far between. + +#### How do I choose my V-levels? + +This is basically the only hard constraint: increase V-levels to denote +more verbose or more debug-y logs. + +Otherwise, you can start out with `0` as "you always want to see this", +`1` as "common logging that you might *possibly* want to turn off", and +`10` as "I would like to performance-test your log collection stack." + +Then gradually choose levels in between as you need them, working your way +down from 10 (for debug and trace style logs) and up from 1 (for chattier +info-type logs). For reference, slog pre-defines -4 for debug logs +(corresponds to 4 in logr), which matches what is +[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use). + +#### How do I choose my keys? + +Keys are fairly flexible, and can hold more or less any string +value. For best compatibility with implementations and consistency +with existing code in other projects, there are a few conventions you +should consider. + +- Make your keys human-readable. +- Constant keys are generally a good idea. +- Be consistent across your codebase. +- Keys should naturally match parts of the message string. +- Use lower case for simple keys and + [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for + more complex ones. Kubernetes is one example of a project that has + [adopted that + convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments). + +While key names are mostly unrestricted (and spaces are acceptable), +it's generally a good idea to stick to printable ascii characters, or at +least match the general character set of your log lines. + +#### Why should keys be constant values? + +The point of structured logging is to make later log processing easier. Your +keys are, effectively, the schema of each log message. If you use different +keys across instances of the same log line, you will make your structured logs +much harder to use. `Sprintf()` is for values, not for keys! + +#### Why is this not a pure interface? + +The Logger type is implemented as a struct in order to allow the Go compiler to +optimize things like high-V `Info` logs that are not triggered. Not all of +these implementations are implemented yet, but this structure was suggested as +a way to ensure they *can* be implemented. All of the real work is behind the +`LogSink` interface. + +[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md new file mode 100644 index 00000000..1ca756fc --- /dev/null +++ b/vendor/github.com/go-logr/logr/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +If you have discovered a security vulnerability in this project, please report it +privately. **Do not disclose it as a public issue.** This gives us time to work with you +to fix the issue before public exposure, reducing the chance that the exploit will be +used before a patch is released. + +You may submit the report in the following ways: + +- send an email to go-logr-security@googlegroups.com +- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new) + +Please provide the following information in your report: + +- A description of the vulnerability and its impact +- How to reproduce the issue + +We ask that you give us 90 days to work on a fix before public exposure. diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go new file mode 100644 index 00000000..de8bcc3a --- /dev/null +++ b/vendor/github.com/go-logr/logr/context.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// contextKey is how we find Loggers in a context.Context. With Go < 1.21, +// the value is always a Logger value. With Go >= 1.21, the value can be a +// Logger value or a slog.Logger pointer. +type contextKey struct{} + +// notFoundError exists to carry an IsNotFound method. +type notFoundError struct{} + +func (notFoundError) Error() string { + return "no logr.Logger was present" +} + +func (notFoundError) IsNotFound() bool { + return true +} diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go new file mode 100644 index 00000000..f012f9a1 --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_noslog.go @@ -0,0 +1,49 @@ +//go:build !go1.21 +// +build !go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v, nil + } + + return Logger{}, notFoundError{} +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v + } + + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go new file mode 100644 index 00000000..065ef0b8 --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_slog.go @@ -0,0 +1,83 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "fmt" + "log/slog" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + v := ctx.Value(contextKey{}) + if v == nil { + return Logger{}, notFoundError{} + } + + switch v := v.(type) { + case Logger: + return v, nil + case *slog.Logger: + return FromSlogHandler(v.Handler()), nil + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found. +func FromContextAsSlogLogger(ctx context.Context) *slog.Logger { + v := ctx.Value(contextKey{}) + if v == nil { + return nil + } + + switch v := v.(type) { + case Logger: + return slog.New(ToSlogHandler(v)) + case *slog.Logger: + return v + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if logger, err := FromContext(ctx); err == nil { + return logger + } + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} + +// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the +// provided slog.Logger. +func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go new file mode 100644 index 00000000..99fe8be9 --- /dev/null +++ b/vendor/github.com/go-logr/logr/discard.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// Discard returns a Logger that discards all messages logged to it. It can be +// used whenever the caller is not interested in the logs. Logger instances +// produced by this function always compare as equal. +func Discard() Logger { + return New(nil) +} diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go new file mode 100644 index 00000000..fb2f866f --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -0,0 +1,911 @@ +/* +Copyright 2021 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package funcr implements formatting of structured log messages and +// optionally captures the call site and timestamp. +// +// The simplest way to use it is via its implementation of a +// github.com/go-logr/logr.LogSink with output through an arbitrary +// "write" function. See New and NewJSON for details. +// +// # Custom LogSinks +// +// For users who need more control, a funcr.Formatter can be embedded inside +// your own custom LogSink implementation. This is useful when the LogSink +// needs to implement additional methods, for example. +// +// # Formatting +// +// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for +// values which are being logged. When rendering a struct, funcr will use Go's +// standard JSON tags (all except "string"). +package funcr + +import ( + "bytes" + "encoding" + "encoding/json" + "fmt" + "path/filepath" + "reflect" + "runtime" + "strconv" + "strings" + "time" + + "github.com/go-logr/logr" +) + +// New returns a logr.Logger which is implemented by an arbitrary function. +func New(fn func(prefix, args string), opts Options) logr.Logger { + return logr.New(newSink(fn, NewFormatter(opts))) +} + +// NewJSON returns a logr.Logger which is implemented by an arbitrary function +// and produces JSON output. +func NewJSON(fn func(obj string), opts Options) logr.Logger { + fnWrapper := func(_, obj string) { + fn(obj) + } + return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) +} + +// Underlier exposes access to the underlying logging function. Since +// callers only have a logr.Logger, they have to know which +// implementation is in use, so this interface is less of an +// abstraction and more of a way to test type conversion. +type Underlier interface { + GetUnderlying() func(prefix, args string) +} + +func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { + l := &fnlogger{ + Formatter: formatter, + write: fn, + } + // For skipping fnlogger.Info and fnlogger.Error. + l.Formatter.AddCallDepth(1) + return l +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // LogCaller tells funcr to add a "caller" key to some or all log lines. + // This has some overhead, so some users might not want it. + LogCaller MessageClass + + // LogCallerFunc tells funcr to also log the calling function name. This + // has no effect if caller logging is not enabled (see Options.LogCaller). + LogCallerFunc bool + + // LogTimestamp tells funcr to add a "ts" key to log lines. This has some + // overhead, so some users might not want it. + LogTimestamp bool + + // TimestampFormat tells funcr how to render timestamps when LogTimestamp + // is enabled. If not specified, a default format will be used. For more + // details, see docs for Go's time.Layout. + TimestampFormat string + + // LogInfoLevel tells funcr what key to use to log the info level. + // If not specified, the info level will be logged as "level". + // If this is set to "", the info level will not be logged at all. + LogInfoLevel *string + + // Verbosity tells funcr which V logs to produce. Higher values enable + // more logs. Info logs at or below this level will be written, while logs + // above this level will be discarded. + Verbosity int + + // RenderBuiltinsHook allows users to mutate the list of key-value pairs + // while a log line is being rendered. The kvList argument follows logr + // conventions - each pair of slice elements is comprised of a string key + // and an arbitrary value (verified and sanitized before calling this + // hook). The value returned must follow the same conventions. This hook + // can be used to audit or modify logged data. For example, you might want + // to prefix all of funcr's built-in keys with some string. This hook is + // only called for built-in (provided by funcr itself) key-value pairs. + // Equivalent hooks are offered for key-value pairs saved via + // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and + // for user-provided pairs (see RenderArgsHook). + RenderBuiltinsHook func(kvList []any) []any + + // RenderValuesHook is the same as RenderBuiltinsHook, except that it is + // only called for key-value pairs saved via logr.Logger.WithValues. See + // RenderBuiltinsHook for more details. + RenderValuesHook func(kvList []any) []any + + // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only + // called for key-value pairs passed directly to Info and Error. See + // RenderBuiltinsHook for more details. + RenderArgsHook func(kvList []any) []any + + // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct + // that contains a struct, etc.) it may log. Every time it finds a struct, + // slice, array, or map the depth is increased by one. When the maximum is + // reached, the value will be converted to a string indicating that the max + // depth has been exceeded. If this field is not specified, a default + // value will be used. + MaxLogDepth int +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// fnlogger inherits some of its LogSink implementation from Formatter +// and just needs to add some glue code. +type fnlogger struct { + Formatter + write func(prefix, args string) +} + +func (l fnlogger) WithName(name string) logr.LogSink { + l.Formatter.AddName(name) + return &l +} + +func (l fnlogger) WithValues(kvList ...any) logr.LogSink { + l.Formatter.AddValues(kvList) + return &l +} + +func (l fnlogger) WithCallDepth(depth int) logr.LogSink { + l.Formatter.AddCallDepth(depth) + return &l +} + +func (l fnlogger) Info(level int, msg string, kvList ...any) { + prefix, args := l.FormatInfo(level, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) Error(err error, msg string, kvList ...any) { + prefix, args := l.FormatError(err, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) GetUnderlying() func(prefix, args string) { + return l.write +} + +// Assert conformance to the interfaces. +var _ logr.LogSink = &fnlogger{} +var _ logr.CallDepthLogSink = &fnlogger{} +var _ Underlier = &fnlogger{} + +// NewFormatter constructs a Formatter which emits a JSON-like key=value format. +func NewFormatter(opts Options) Formatter { + return newFormatter(opts, outputKeyValue) +} + +// NewFormatterJSON constructs a Formatter which emits strict JSON. +func NewFormatterJSON(opts Options) Formatter { + return newFormatter(opts, outputJSON) +} + +// Defaults for Options. +const defaultTimestampFormat = "2006-01-02 15:04:05.000000" +const defaultMaxLogDepth = 16 + +func newFormatter(opts Options, outfmt outputFormat) Formatter { + if opts.TimestampFormat == "" { + opts.TimestampFormat = defaultTimestampFormat + } + if opts.MaxLogDepth == 0 { + opts.MaxLogDepth = defaultMaxLogDepth + } + if opts.LogInfoLevel == nil { + opts.LogInfoLevel = new(string) + *opts.LogInfoLevel = "level" + } + f := Formatter{ + outputFormat: outfmt, + prefix: "", + values: nil, + depth: 0, + opts: &opts, + } + return f +} + +// Formatter is an opaque struct which can be embedded in a LogSink +// implementation. It should be constructed with NewFormatter. Some of +// its methods directly implement logr.LogSink. +type Formatter struct { + outputFormat outputFormat + prefix string + values []any + valuesStr string + parentValuesStr string + depth int + opts *Options + group string // for slog groups + groupDepth int +} + +// outputFormat indicates which outputFormat to use. +type outputFormat int + +const ( + // outputKeyValue emits a JSON-like key=value format, but not strict JSON. + outputKeyValue outputFormat = iota + // outputJSON emits strict JSON. + outputJSON +) + +// PseudoStruct is a list of key-value pairs that gets logged as a struct. +type PseudoStruct []any + +// render produces a log line, ready to use. +func (f Formatter) render(builtins, args []any) string { + // Empirically bytes.Buffer is faster than strings.Builder for this. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + if f.outputFormat == outputJSON { + buf.WriteByte('{') // for the whole line + } + + vals := builtins + if hook := f.opts.RenderBuiltinsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, false, false) // keys are ours, no need to escape + continuing := len(builtins) > 0 + + if f.parentValuesStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(f.parentValuesStr) + continuing = true + } + + groupDepth := f.groupDepth + if f.group != "" { + if f.valuesStr != "" || len(args) != 0 { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys + buf.WriteByte(f.colon()) + buf.WriteByte('{') // for the group + continuing = false + } else { + // The group was empty + groupDepth-- + } + } + + if f.valuesStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(f.valuesStr) + continuing = true + } + + vals = args + if hook := f.opts.RenderArgsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, continuing, true) // escape user-provided keys + + for i := 0; i < groupDepth; i++ { + buf.WriteByte('}') // for the groups + } + + if f.outputFormat == outputJSON { + buf.WriteByte('}') // for the whole line + } + + return buf.String() +} + +// flatten renders a list of key-value pairs into a buffer. If continuing is +// true, it assumes that the buffer has previous values and will emit a +// separator (which depends on the output format) before the first pair it +// writes. If escapeKeys is true, the keys are assumed to have +// non-JSON-compatible characters in them and must be evaluated for escapes. +// +// This function returns a potentially modified version of kvList, which +// ensures that there is a value for every key (adding a value if needed) and +// that each key is a string (substituting a key if needed). +func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { + // This logic overlaps with sanitize() but saves one type-cast per key, + // which can be measurable. + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + copied := false + for i := 0; i < len(kvList); i += 2 { + k, ok := kvList[i].(string) + if !ok { + if !copied { + newList := make([]any, len(kvList)) + copy(newList, kvList) + kvList = newList + copied = true + } + k = f.nonStringKey(kvList[i]) + kvList[i] = k + } + v := kvList[i+1] + + if i > 0 || continuing { + if f.outputFormat == outputJSON { + buf.WriteByte(f.comma()) + } else { + // In theory the format could be something we don't understand. In + // practice, we control it, so it won't be. + buf.WriteByte(' ') + } + } + + buf.WriteString(f.quoted(k, escapeKeys)) + buf.WriteByte(f.colon()) + buf.WriteString(f.pretty(v)) + } + return kvList +} + +func (f Formatter) quoted(str string, escape bool) string { + if escape { + return prettyString(str) + } + // this is faster + return `"` + str + `"` +} + +func (f Formatter) comma() byte { + if f.outputFormat == outputJSON { + return ',' + } + return ' ' +} + +func (f Formatter) colon() byte { + if f.outputFormat == outputJSON { + return ':' + } + return '=' +} + +func (f Formatter) pretty(value any) string { + return f.prettyWithFlags(value, 0, 0) +} + +const ( + flagRawStruct = 0x1 // do not print braces on structs +) + +// TODO: This is not fast. Most of the overhead goes here. +func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { + if depth > f.opts.MaxLogDepth { + return `""` + } + + // Handle types that take full control of logging. + if v, ok := value.(logr.Marshaler); ok { + // Replace the value with what the type wants to get logged. + // That then gets handled below via reflection. + value = invokeMarshaler(v) + } + + // Handle types that want to format themselves. + switch v := value.(type) { + case fmt.Stringer: + value = invokeStringer(v) + case error: + value = invokeError(v) + } + + // Handling the most common types without reflect is a small perf win. + switch v := value.(type) { + case bool: + return strconv.FormatBool(v) + case string: + return prettyString(v) + case int: + return strconv.FormatInt(int64(v), 10) + case int8: + return strconv.FormatInt(int64(v), 10) + case int16: + return strconv.FormatInt(int64(v), 10) + case int32: + return strconv.FormatInt(int64(v), 10) + case int64: + return strconv.FormatInt(int64(v), 10) + case uint: + return strconv.FormatUint(uint64(v), 10) + case uint8: + return strconv.FormatUint(uint64(v), 10) + case uint16: + return strconv.FormatUint(uint64(v), 10) + case uint32: + return strconv.FormatUint(uint64(v), 10) + case uint64: + return strconv.FormatUint(v, 10) + case uintptr: + return strconv.FormatUint(uint64(v), 10) + case float32: + return strconv.FormatFloat(float64(v), 'f', -1, 32) + case float64: + return strconv.FormatFloat(v, 'f', -1, 64) + case complex64: + return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` + case complex128: + return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` + case PseudoStruct: + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + v = f.sanitize(v) + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + for i := 0; i < len(v); i += 2 { + if i > 0 { + buf.WriteByte(f.comma()) + } + k, _ := v[i].(string) // sanitize() above means no need to check success + // arbitrary keys might need escaping + buf.WriteString(prettyString(k)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + } + + buf := bytes.NewBuffer(make([]byte, 0, 256)) + t := reflect.TypeOf(value) + if t == nil { + return "null" + } + v := reflect.ValueOf(value) + switch t.Kind() { + case reflect.Bool: + return strconv.FormatBool(v.Bool()) + case reflect.String: + return prettyString(v.String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(int64(v.Int()), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return strconv.FormatUint(uint64(v.Uint()), 10) + case reflect.Float32: + return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) + case reflect.Float64: + return strconv.FormatFloat(v.Float(), 'f', -1, 64) + case reflect.Complex64: + return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` + case reflect.Complex128: + return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` + case reflect.Struct: + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + printComma := false // testing i>0 is not enough because of JSON omitted fields + for i := 0; i < t.NumField(); i++ { + fld := t.Field(i) + if fld.PkgPath != "" { + // reflect says this field is only defined for non-exported fields. + continue + } + if !v.Field(i).CanInterface() { + // reflect isn't clear exactly what this means, but we can't use it. + continue + } + name := "" + omitempty := false + if tag, found := fld.Tag.Lookup("json"); found { + if tag == "-" { + continue + } + if comma := strings.Index(tag, ","); comma != -1 { + if n := tag[:comma]; n != "" { + name = n + } + rest := tag[comma:] + if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { + omitempty = true + } + } else { + name = tag + } + } + if omitempty && isEmpty(v.Field(i)) { + continue + } + if printComma { + buf.WriteByte(f.comma()) + } + printComma = true // if we got here, we are rendering a field + if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) + continue + } + if name == "" { + name = fld.Name + } + // field names can't contain characters which need escaping + buf.WriteString(f.quoted(name, false)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + case reflect.Slice, reflect.Array: + // If this is outputing as JSON make sure this isn't really a json.RawMessage. + // If so just emit "as-is" and don't pretty it as that will just print + // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. + if f.outputFormat == outputJSON { + if rm, ok := value.(json.RawMessage); ok { + // If it's empty make sure we emit an empty value as the array style would below. + if len(rm) > 0 { + buf.Write(rm) + } else { + buf.WriteString("null") + } + return buf.String() + } + } + buf.WriteByte('[') + for i := 0; i < v.Len(); i++ { + if i > 0 { + buf.WriteByte(f.comma()) + } + e := v.Index(i) + buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) + } + buf.WriteByte(']') + return buf.String() + case reflect.Map: + buf.WriteByte('{') + // This does not sort the map keys, for best perf. + it := v.MapRange() + i := 0 + for it.Next() { + if i > 0 { + buf.WriteByte(f.comma()) + } + // If a map key supports TextMarshaler, use it. + keystr := "" + if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { + txt, err := m.MarshalText() + if err != nil { + keystr = fmt.Sprintf("", err.Error()) + } else { + keystr = string(txt) + } + keystr = prettyString(keystr) + } else { + // prettyWithFlags will produce already-escaped values + keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) + if t.Key().Kind() != reflect.String { + // JSON only does string keys. Unlike Go's standard JSON, we'll + // convert just about anything to a string. + keystr = prettyString(keystr) + } + } + buf.WriteString(keystr) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) + i++ + } + buf.WriteByte('}') + return buf.String() + case reflect.Ptr, reflect.Interface: + if v.IsNil() { + return "null" + } + return f.prettyWithFlags(v.Elem().Interface(), 0, depth) + } + return fmt.Sprintf(`""`, t.Kind().String()) +} + +func prettyString(s string) string { + // Avoid escaping (which does allocations) if we can. + if needsEscape(s) { + return strconv.Quote(s) + } + b := bytes.NewBuffer(make([]byte, 0, 1024)) + b.WriteByte('"') + b.WriteString(s) + b.WriteByte('"') + return b.String() +} + +// needsEscape determines whether the input string needs to be escaped or not, +// without doing any allocations. +func needsEscape(s string) bool { + for _, r := range s { + if !strconv.IsPrint(r) || r == '\\' || r == '"' { + return true + } + } + return false +} + +func isEmpty(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Complex64, reflect.Complex128: + return v.Complex() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func invokeMarshaler(m logr.Marshaler) (ret any) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return m.MarshalLog() +} + +func invokeStringer(s fmt.Stringer) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return s.String() +} + +func invokeError(e error) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return e.Error() +} + +// Caller represents the original call site for a log line, after considering +// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and +// Line fields will always be provided, while the Func field is optional. +// Users can set the render hook fields in Options to examine logged key-value +// pairs, one of which will be {"caller", Caller} if the Options.LogCaller +// field is enabled for the given MessageClass. +type Caller struct { + // File is the basename of the file for this call site. + File string `json:"file"` + // Line is the line number in the file for this call site. + Line int `json:"line"` + // Func is the function name for this call site, or empty if + // Options.LogCallerFunc is not enabled. + Func string `json:"function,omitempty"` +} + +func (f Formatter) caller() Caller { + // +1 for this frame, +1 for Info/Error. + pc, file, line, ok := runtime.Caller(f.depth + 2) + if !ok { + return Caller{"", 0, ""} + } + fn := "" + if f.opts.LogCallerFunc { + if fp := runtime.FuncForPC(pc); fp != nil { + fn = fp.Name() + } + } + + return Caller{filepath.Base(file), line, fn} +} + +const noValue = "" + +func (f Formatter) nonStringKey(v any) string { + return fmt.Sprintf("", f.snippet(v)) +} + +// snippet produces a short snippet string of an arbitrary value. +func (f Formatter) snippet(v any) string { + const snipLen = 16 + + snip := f.pretty(v) + if len(snip) > snipLen { + snip = snip[:snipLen] + } + return snip +} + +// sanitize ensures that a list of key-value pairs has a value for every key +// (adding a value if needed) and that each key is a string (substituting a key +// if needed). +func (f Formatter) sanitize(kvList []any) []any { + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + for i := 0; i < len(kvList); i += 2 { + _, ok := kvList[i].(string) + if !ok { + kvList[i] = f.nonStringKey(kvList[i]) + } + } + return kvList +} + +// startGroup opens a new group scope (basically a sub-struct), which locks all +// the current saved values and starts them anew. This is needed to satisfy +// slog. +func (f *Formatter) startGroup(group string) { + // Unnamed groups are just inlined. + if group == "" { + return + } + + // Any saved values can no longer be changed. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + continuing := false + + if f.parentValuesStr != "" { + buf.WriteString(f.parentValuesStr) + continuing = true + } + + if f.group != "" && f.valuesStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys + buf.WriteByte(f.colon()) + buf.WriteByte('{') // for the group + continuing = false + } + + if f.valuesStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(f.valuesStr) + } + + // NOTE: We don't close the scope here - that's done later, when a log line + // is actually rendered (because we have N scopes to close). + + f.parentValuesStr = buf.String() + + // Start collecting new values. + f.group = group + f.groupDepth++ + f.valuesStr = "" + f.values = nil +} + +// Init configures this Formatter from runtime info, such as the call depth +// imposed by logr itself. +// Note that this receiver is a pointer, so depth can be saved. +func (f *Formatter) Init(info logr.RuntimeInfo) { + f.depth += info.CallDepth +} + +// Enabled checks whether an info message at the given level should be logged. +func (f Formatter) Enabled(level int) bool { + return level <= f.opts.Verbosity +} + +// GetDepth returns the current depth of this Formatter. This is useful for +// implementations which do their own caller attribution. +func (f Formatter) GetDepth() int { + return f.depth +} + +// FormatInfo renders an Info log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Info { + args = append(args, "caller", f.caller()) + } + if key := *f.opts.LogInfoLevel; key != "" { + args = append(args, key, level) + } + args = append(args, "msg", msg) + return prefix, f.render(args, kvList) +} + +// FormatError renders an Error log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Error { + args = append(args, "caller", f.caller()) + } + args = append(args, "msg", msg) + var loggableErr any + if err != nil { + loggableErr = err.Error() + } + args = append(args, "error", loggableErr) + return prefix, f.render(args, kvList) +} + +// AddName appends the specified name. funcr uses '/' characters to separate +// name elements. Callers should not pass '/' in the provided name string, but +// this library does not actually enforce that. +func (f *Formatter) AddName(name string) { + if len(f.prefix) > 0 { + f.prefix += "/" + } + f.prefix += name +} + +// AddValues adds key-value pairs to the set of saved values to be logged with +// each log line. +func (f *Formatter) AddValues(kvList []any) { + // Three slice args forces a copy. + n := len(f.values) + f.values = append(f.values[:n:n], kvList...) + + vals := f.values + if hook := f.opts.RenderValuesHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + + // Pre-render values, so we don't have to do it on each Info/Error call. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + f.flatten(buf, vals, false, true) // escape user-provided keys + f.valuesStr = buf.String() +} + +// AddCallDepth increases the number of stack-frames to skip when attributing +// the log line to a file and line. +func (f *Formatter) AddCallDepth(depth int) { + f.depth += depth +} diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go new file mode 100644 index 00000000..7bd84761 --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/slogsink.go @@ -0,0 +1,105 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package funcr + +import ( + "context" + "log/slog" + + "github.com/go-logr/logr" +) + +var _ logr.SlogSink = &fnlogger{} + +const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink + +func (l fnlogger) Handle(_ context.Context, record slog.Record) error { + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, kvList) + return true + }) + + if record.Level >= slog.LevelError { + l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) + } + return nil +} + +func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, kvList) + } + l.AddValues(kvList) + return &l +} + +func (l fnlogger) WithGroup(name string) logr.SlogSink { + l.startGroup(name) + return &l +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, grpKVs) + } + if attr.Key == "" { + // slog says we have to inline these + kvList = append(kvList, grpKVs...) + } else { + kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) + } + } else if attr.Key != "" { + kvList = append(kvList, attr.Key, attrVal.Any()) + } + + return kvList +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l fnlogger) levelFromSlog(level slog.Level) int { + result := -level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go new file mode 100644 index 00000000..b4428e10 --- /dev/null +++ b/vendor/github.com/go-logr/logr/logr.go @@ -0,0 +1,520 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This design derives from Dave Cheney's blog: +// http://dave.cheney.net/2015/11/05/lets-talk-about-logging + +// Package logr defines a general-purpose logging API and abstract interfaces +// to back that API. Packages in the Go ecosystem can depend on this package, +// while callers can implement logging with whatever backend is appropriate. +// +// # Usage +// +// Logging is done using a Logger instance. Logger is a concrete type with +// methods, which defers the actual logging to a LogSink interface. The main +// methods of Logger are Info() and Error(). Arguments to Info() and Error() +// are key/value pairs rather than printf-style formatted strings, emphasizing +// "structured logging". +// +// With Go's standard log package, we might write: +// +// log.Printf("setting target value %s", targetValue) +// +// With logr's structured logging, we'd write: +// +// logger.Info("setting target", "value", targetValue) +// +// Errors are much the same. Instead of: +// +// log.Printf("failed to open the pod bay door for user %s: %v", user, err) +// +// We'd write: +// +// logger.Error(err, "failed to open the pod bay door", "user", user) +// +// Info() and Error() are very similar, but they are separate methods so that +// LogSink implementations can choose to do things like attach additional +// information (such as stack traces) on calls to Error(). Error() messages are +// always logged, regardless of the current verbosity. If there is no error +// instance available, passing nil is valid. +// +// # Verbosity +// +// Often we want to log information only when the application in "verbose +// mode". To write log lines that are more verbose, Logger has a V() method. +// The higher the V-level of a log line, the less critical it is considered. +// Log-lines with V-levels that are not enabled (as per the LogSink) will not +// be written. Level V(0) is the default, and logger.V(0).Info() has the same +// meaning as logger.Info(). Negative V-levels have the same meaning as V(0). +// Error messages do not have a verbosity level and are always logged. +// +// Where we might have written: +// +// if flVerbose >= 2 { +// log.Printf("an unusual thing happened") +// } +// +// We can write: +// +// logger.V(2).Info("an unusual thing happened") +// +// # Logger Names +// +// Logger instances can have name strings so that all messages logged through +// that instance have additional context. For example, you might want to add +// a subsystem name: +// +// logger.WithName("compactor").Info("started", "time", time.Now()) +// +// The WithName() method returns a new Logger, which can be passed to +// constructors or other functions for further use. Repeated use of WithName() +// will accumulate name "segments". These name segments will be joined in some +// way by the LogSink implementation. It is strongly recommended that name +// segments contain simple identifiers (letters, digits, and hyphen), and do +// not contain characters that could muddle the log output or confuse the +// joining operation (e.g. whitespace, commas, periods, slashes, brackets, +// quotes, etc). +// +// # Saved Values +// +// Logger instances can store any number of key/value pairs, which will be +// logged alongside all messages logged through that instance. For example, +// you might want to create a Logger instance per managed object: +// +// With the standard log package, we might write: +// +// log.Printf("decided to set field foo to value %q for object %s/%s", +// targetValue, object.Namespace, object.Name) +// +// With logr we'd write: +// +// // Elsewhere: set up the logger to log the object name. +// obj.logger = mainLogger.WithValues( +// "name", obj.name, "namespace", obj.namespace) +// +// // later on... +// obj.logger.Info("setting foo", "value", targetValue) +// +// # Best Practices +// +// Logger has very few hard rules, with the goal that LogSink implementations +// might have a lot of freedom to differentiate. There are, however, some +// things to consider. +// +// The log message consists of a constant message attached to the log line. +// This should generally be a simple description of what's occurring, and should +// never be a format string. Variable information can then be attached using +// named values. +// +// Keys are arbitrary strings, but should generally be constant values. Values +// may be any Go value, but how the value is formatted is determined by the +// LogSink implementation. +// +// Logger instances are meant to be passed around by value. Code that receives +// such a value can call its methods without having to check whether the +// instance is ready for use. +// +// The zero logger (= Logger{}) is identical to Discard() and discards all log +// entries. Code that receives a Logger by value can simply call it, the methods +// will never crash. For cases where passing a logger is optional, a pointer to Logger +// should be used. +// +// # Key Naming Conventions +// +// Keys are not strictly required to conform to any specification or regex, but +// it is recommended that they: +// - be human-readable and meaningful (not auto-generated or simple ordinals) +// - be constant (not dependent on input data) +// - contain only printable characters +// - not contain whitespace or punctuation +// - use lower case for simple keys and lowerCamelCase for more complex ones +// +// These guidelines help ensure that log data is processed properly regardless +// of the log implementation. For example, log implementations will try to +// output JSON data or will store data for later database (e.g. SQL) queries. +// +// While users are generally free to use key names of their choice, it's +// generally best to avoid using the following keys, as they're frequently used +// by implementations: +// - "caller": the calling information (file/line) of a particular log line +// - "error": the underlying error value in the `Error` method +// - "level": the log level +// - "logger": the name of the associated logger +// - "msg": the log message +// - "stacktrace": the stack trace associated with a particular log line or +// error (often from the `Error` message) +// - "ts": the timestamp for a log line +// +// Implementations are encouraged to make use of these keys to represent the +// above concepts, when necessary (for example, in a pure-JSON output form, it +// would be necessary to represent at least message and timestamp as ordinary +// named values). +// +// # Break Glass +// +// Implementations may choose to give callers access to the underlying +// logging implementation. The recommended pattern for this is: +// +// // Underlier exposes access to the underlying logging implementation. +// // Since callers only have a logr.Logger, they have to know which +// // implementation is in use, so this interface is less of an abstraction +// // and more of way to test type conversion. +// type Underlier interface { +// GetUnderlying() +// } +// +// Logger grants access to the sink to enable type assertions like this: +// +// func DoSomethingWithImpl(log logr.Logger) { +// if underlier, ok := log.GetSink().(impl.Underlier); ok { +// implLogger := underlier.GetUnderlying() +// ... +// } +// } +// +// Custom `With*` functions can be implemented by copying the complete +// Logger struct and replacing the sink in the copy: +// +// // WithFooBar changes the foobar parameter in the log sink and returns a +// // new logger with that modified sink. It does nothing for loggers where +// // the sink doesn't support that parameter. +// func WithFoobar(log logr.Logger, foobar int) logr.Logger { +// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok { +// log = log.WithSink(foobarLogSink.WithFooBar(foobar)) +// } +// return log +// } +// +// Don't use New to construct a new Logger with a LogSink retrieved from an +// existing Logger. Source code attribution might not work correctly and +// unexported fields in Logger get lost. +// +// Beware that the same LogSink instance may be shared by different logger +// instances. Calling functions that modify the LogSink will affect all of +// those. +package logr + +// New returns a new Logger instance. This is primarily used by libraries +// implementing LogSink, rather than end users. Passing a nil sink will create +// a Logger which discards all log lines. +func New(sink LogSink) Logger { + logger := Logger{} + logger.setSink(sink) + if sink != nil { + sink.Init(runtimeInfo) + } + return logger +} + +// setSink stores the sink and updates any related fields. It mutates the +// logger and thus is only safe to use for loggers that are not currently being +// used concurrently. +func (l *Logger) setSink(sink LogSink) { + l.sink = sink +} + +// GetSink returns the stored sink. +func (l Logger) GetSink() LogSink { + return l.sink +} + +// WithSink returns a copy of the logger with the new sink. +func (l Logger) WithSink(sink LogSink) Logger { + l.setSink(sink) + return l +} + +// Logger is an interface to an abstract logging implementation. This is a +// concrete type for performance reasons, but all the real work is passed on to +// a LogSink. Implementations of LogSink should provide their own constructors +// that return Logger, not LogSink. +// +// The underlying sink can be accessed through GetSink and be modified through +// WithSink. This enables the implementation of custom extensions (see "Break +// Glass" in the package documentation). Normally the sink should be used only +// indirectly. +type Logger struct { + sink LogSink + level int +} + +// Enabled tests whether this Logger is enabled. For example, commandline +// flags might be used to set the logging verbosity and disable some info logs. +func (l Logger) Enabled() bool { + // Some implementations of LogSink look at the caller in Enabled (e.g. + // different verbosity levels per package or file), but we only pass one + // CallDepth in (via Init). This means that all calls from Logger to the + // LogSink's Enabled, Info, and Error methods must have the same number of + // frames. In other words, Logger methods can't call other Logger methods + // which call these LogSink methods unless we do it the same in all paths. + return l.sink != nil && l.sink.Enabled(l.level) +} + +// Info logs a non-error message with the given key/value pairs as context. +// +// The msg argument should be used to add some constant description to the log +// line. The key/value pairs can then be used to add additional variable +// information. The key/value pairs must alternate string keys and arbitrary +// values. +func (l Logger) Info(msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if l.sink.Enabled(l.level) { // see comment in Enabled + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Info(l.level, msg, keysAndValues...) + } +} + +// Error logs an error, with the given message and key/value pairs as context. +// It functions similarly to Info, but may have unique behavior, and should be +// preferred for logging errors (see the package documentations for more +// information). The log message will always be emitted, regardless of +// verbosity level. +// +// The msg argument should be used to add context to any underlying error, +// while the err argument should be used to attach the actual error that +// triggered this log line, if present. The err parameter is optional +// and nil may be passed instead of an error instance. +func (l Logger) Error(err error, msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Error(err, msg, keysAndValues...) +} + +// V returns a new Logger instance for a specific verbosity level, relative to +// this Logger. In other words, V-levels are additive. A higher verbosity +// level means a log message is less important. Negative V-levels are treated +// as 0. +func (l Logger) V(level int) Logger { + if l.sink == nil { + return l + } + if level < 0 { + level = 0 + } + l.level += level + return l +} + +// GetV returns the verbosity level of the logger. If the logger's LogSink is +// nil as in the Discard logger, this will always return 0. +func (l Logger) GetV() int { + // 0 if l.sink nil because of the if check in V above. + return l.level +} + +// WithValues returns a new Logger instance with additional key/value pairs. +// See Info for documentation on how key/value pairs work. +func (l Logger) WithValues(keysAndValues ...any) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithValues(keysAndValues...)) + return l +} + +// WithName returns a new Logger instance with the specified name element added +// to the Logger's name. Successive calls with WithName append additional +// suffixes to the Logger's name. It's strongly recommended that name segments +// contain only letters, digits, and hyphens (see the package documentation for +// more information). +func (l Logger) WithName(name string) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithName(name)) + return l +} + +// WithCallDepth returns a Logger instance that offsets the call stack by the +// specified number of frames when logging call site information, if possible. +// This is useful for users who have helper functions between the "real" call +// site and the actual calls to Logger methods. If depth is 0 the attribution +// should be to the direct caller of this function. If depth is 1 the +// attribution should skip 1 call frame, and so on. Successive calls to this +// are additive. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// it will be called and the result returned. If the implementation does not +// support CallDepthLogSink, the original Logger will be returned. +// +// To skip one level, WithCallStackHelper() should be used instead of +// WithCallDepth(1) because it works with implementions that support the +// CallDepthLogSink and/or CallStackHelperLogSink interfaces. +func (l Logger) WithCallDepth(depth int) Logger { + if l.sink == nil { + return l + } + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(depth)) + } + return l +} + +// WithCallStackHelper returns a new Logger instance that skips the direct +// caller when logging call site information, if possible. This is useful for +// users who have helper functions between the "real" call site and the actual +// calls to Logger methods and want to support loggers which depend on marking +// each individual helper function, like loggers based on testing.T. +// +// In addition to using that new logger instance, callers also must call the +// returned function. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// WithCallDepth(1) will be called to produce a new logger. If it supports a +// WithCallStackHelper() method, that will be also called. If the +// implementation does not support either of these, the original Logger will be +// returned. +func (l Logger) WithCallStackHelper() (func(), Logger) { + if l.sink == nil { + return func() {}, l + } + var helper func() + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(1)) + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + helper = withHelper.GetCallStackHelper() + } else { + helper = func() {} + } + return helper, l +} + +// IsZero returns true if this logger is an uninitialized zero value +func (l Logger) IsZero() bool { + return l.sink == nil +} + +// RuntimeInfo holds information that the logr "core" library knows which +// LogSinks might want to know. +type RuntimeInfo struct { + // CallDepth is the number of call frames the logr library adds between the + // end-user and the LogSink. LogSink implementations which choose to print + // the original logging site (e.g. file & line) should climb this many + // additional frames to find it. + CallDepth int +} + +// runtimeInfo is a static global. It must not be changed at run time. +var runtimeInfo = RuntimeInfo{ + CallDepth: 1, +} + +// LogSink represents a logging implementation. End-users will generally not +// interact with this type. +type LogSink interface { + // Init receives optional information about the logr library for LogSink + // implementations that need it. + Init(info RuntimeInfo) + + // Enabled tests whether this LogSink is enabled at the specified V-level. + // For example, commandline flags might be used to set the logging + // verbosity and disable some info logs. + Enabled(level int) bool + + // Info logs a non-error message with the given key/value pairs as context. + // The level argument is provided for optional logging. This method will + // only be called when Enabled(level) is true. See Logger.Info for more + // details. + Info(level int, msg string, keysAndValues ...any) + + // Error logs an error, with the given message and key/value pairs as + // context. See Logger.Error for more details. + Error(err error, msg string, keysAndValues ...any) + + // WithValues returns a new LogSink with additional key/value pairs. See + // Logger.WithValues for more details. + WithValues(keysAndValues ...any) LogSink + + // WithName returns a new LogSink with the specified name appended. See + // Logger.WithName for more details. + WithName(name string) LogSink +} + +// CallDepthLogSink represents a LogSink that knows how to climb the call stack +// to identify the original call site and can offset the depth by a specified +// number of frames. This is useful for users who have helper functions +// between the "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as file, +// function, or line) would otherwise log information about the intermediate +// helper functions. +// +// This is an optional interface and implementations are not required to +// support it. +type CallDepthLogSink interface { + // WithCallDepth returns a LogSink that will offset the call + // stack by the specified number of frames when logging call + // site information. + // + // If depth is 0, the LogSink should skip exactly the number + // of call frames defined in RuntimeInfo.CallDepth when Info + // or Error are called, i.e. the attribution should be to the + // direct caller of Logger.Info or Logger.Error. + // + // If depth is 1 the attribution should skip 1 call frame, and so on. + // Successive calls to this are additive. + WithCallDepth(depth int) LogSink +} + +// CallStackHelperLogSink represents a LogSink that knows how to climb +// the call stack to identify the original call site and can skip +// intermediate helper functions if they mark themselves as +// helper. Go's testing package uses that approach. +// +// This is useful for users who have helper functions between the +// "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as +// file, function, or line) would otherwise log information about the +// intermediate helper functions. +// +// This is an optional interface and implementations are not required +// to support it. Implementations that choose to support this must not +// simply implement it as WithCallDepth(1), because +// Logger.WithCallStackHelper will call both methods if they are +// present. This should only be implemented for LogSinks that actually +// need it, as with testing.T. +type CallStackHelperLogSink interface { + // GetCallStackHelper returns a function that must be called + // to mark the direct caller as helper function when logging + // call site information. + GetCallStackHelper() func() +} + +// Marshaler is an optional interface that logged values may choose to +// implement. Loggers with structured output, such as JSON, should +// log the object return by the MarshalLog method instead of the +// original value. +type Marshaler interface { + // MarshalLog can be used to: + // - ensure that structs are not logged as strings when the original + // value has a String method: return a different type without a + // String method + // - select which fields of a complex type should get logged: + // return a simpler struct with fewer fields + // - log unexported fields: return a different struct + // with exported fields + // + // It may return any value of any type. + MarshalLog() any +} diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go new file mode 100644 index 00000000..82d1ba49 --- /dev/null +++ b/vendor/github.com/go-logr/logr/sloghandler.go @@ -0,0 +1,192 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +type slogHandler struct { + // May be nil, in which case all logs get discarded. + sink LogSink + // Non-nil if sink is non-nil and implements SlogSink. + slogSink SlogSink + + // groupPrefix collects values from WithGroup calls. It gets added as + // prefix to value keys when handling a log record. + groupPrefix string + + // levelBias can be set when constructing the handler to influence the + // slog.Level of log records. A positive levelBias reduces the + // slog.Level value. slog has no API to influence this value after the + // handler got created, so it can only be set indirectly through + // Logger.V. + levelBias slog.Level +} + +var _ slog.Handler = &slogHandler{} + +// groupSeparator is used to concatenate WithGroup names and attribute keys. +const groupSeparator = "." + +// GetLevel is used for black box unit testing. +func (l *slogHandler) GetLevel() slog.Level { + return l.levelBias +} + +func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool { + return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) +} + +func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { + if l.slogSink != nil { + // Only adjust verbosity level of log entries < slog.LevelError. + if record.Level < slog.LevelError { + record.Level -= l.levelBias + } + return l.slogSink.Handle(ctx, record) + } + + // No need to check for nil sink here because Handle will only be called + // when Enabled returned true. + + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + return true + }) + if record.Level >= slog.LevelError { + l.sinkWithCallDepth().Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.sinkWithCallDepth().Info(level, record.Message, kvList...) + } + return nil +} + +// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info +// are called by Handle, code in slog gets skipped. +// +// This offset currently (Go 1.21.0) works for calls through +// slog.New(ToSlogHandler(...)). There's no guarantee that the call +// chain won't change. Wrapping the handler will also break unwinding. It's +// still better than not adjusting at all.... +// +// This cannot be done when constructing the handler because FromSlogHandler needs +// access to the original sink without this adjustment. A second copy would +// work, but then WithAttrs would have to be called for both of them. +func (l *slogHandler) sinkWithCallDepth() LogSink { + if sink, ok := l.sink.(CallDepthLogSink); ok { + return sink.WithCallDepth(2) + } + return l.sink +} + +func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { + if l.sink == nil || len(attrs) == 0 { + return l + } + + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithAttrs(attrs) + clone.sink = clone.slogSink + } else { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + } + clone.sink = l.sink.WithValues(kvList...) + } + return &clone +} + +func (l *slogHandler) WithGroup(name string) slog.Handler { + if l.sink == nil { + return l + } + if name == "" { + // slog says to inline empty groups + return l + } + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithGroup(name) + clone.sink = clone.slogSink + } else { + clone.groupPrefix = addPrefix(clone.groupPrefix, name) + } + return &clone +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + prefix := groupPrefix + if attr.Key != "" { + prefix = addPrefix(groupPrefix, attr.Key) + } + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, prefix, grpKVs) + } + kvList = append(kvList, grpKVs...) + } else if attr.Key != "" { + kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any()) + } + + return kvList +} + +func addPrefix(prefix, name string) string { + if prefix == "" { + return name + } + if name == "" { + return prefix + } + return prefix + groupSeparator + name +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l *slogHandler) levelFromSlog(level slog.Level) int { + result := -level + result += l.levelBias // in case the original Logger had a V level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go new file mode 100644 index 00000000..28a83d02 --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr.go @@ -0,0 +1,100 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +// FromSlogHandler returns a Logger which writes to the slog.Handler. +// +// The logr verbosity level is mapped to slog levels such that V(0) becomes +// slog.LevelInfo and V(4) becomes slog.LevelDebug. +func FromSlogHandler(handler slog.Handler) Logger { + if handler, ok := handler.(*slogHandler); ok { + if handler.sink == nil { + return Discard() + } + return New(handler.sink).V(int(handler.levelBias)) + } + return New(&slogSink{handler: handler}) +} + +// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. +// +// The returned logger writes all records with level >= slog.LevelError as +// error log entries with LogSink.Error, regardless of the verbosity level of +// the Logger: +// +// logger := +// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) +// +// The level of all other records gets reduced by the verbosity +// level of the Logger and the result is negated. If it happens +// to be negative, then it gets replaced by zero because a LogSink +// is not expected to handled negative levels: +// +// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) +// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) +func ToSlogHandler(logger Logger) slog.Handler { + if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { + return sink.handler + } + + handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} + if slogSink, ok := handler.sink.(SlogSink); ok { + handler.slogSink = slogSink + } + return handler +} + +// SlogSink is an optional interface that a LogSink can implement to support +// logging through the slog.Logger or slog.Handler APIs better. It then should +// also support special slog values like slog.Group. When used as a +// slog.Handler, the advantages are: +// +// - stack unwinding gets avoided in favor of logging the pre-recorded PC, +// as intended by slog +// - proper grouping of key/value pairs via WithGroup +// - verbosity levels > slog.LevelInfo can be recorded +// - less overhead +// +// Both APIs (Logger and slog.Logger/Handler) then are supported equally +// well. Developers can pick whatever API suits them better and/or mix +// packages which use either API in the same binary with a common logging +// implementation. +// +// This interface is necessary because the type implementing the LogSink +// interface cannot also implement the slog.Handler interface due to the +// different prototype of the common Enabled method. +// +// An implementation could support both interfaces in two different types, but then +// additional interfaces would be needed to convert between those types in FromSlogHandler +// and ToSlogHandler. +type SlogSink interface { + LogSink + + Handle(ctx context.Context, record slog.Record) error + WithAttrs(attrs []slog.Attr) SlogSink + WithGroup(name string) SlogSink +} diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go new file mode 100644 index 00000000..4060fcbc --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogsink.go @@ -0,0 +1,120 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" + "runtime" + "time" +) + +var ( + _ LogSink = &slogSink{} + _ CallDepthLogSink = &slogSink{} + _ Underlier = &slogSink{} +) + +// Underlier is implemented by the LogSink returned by NewFromLogHandler. +type Underlier interface { + // GetUnderlying returns the Handler used by the LogSink. + GetUnderlying() slog.Handler +} + +const ( + // nameKey is used to log the `WithName` values as an additional attribute. + nameKey = "logger" + + // errKey is used to log the error parameter of Error as an additional attribute. + errKey = "err" +) + +type slogSink struct { + callDepth int + name string + handler slog.Handler +} + +func (l *slogSink) Init(info RuntimeInfo) { + l.callDepth = info.CallDepth +} + +func (l *slogSink) GetUnderlying() slog.Handler { + return l.handler +} + +func (l *slogSink) WithCallDepth(depth int) LogSink { + newLogger := *l + newLogger.callDepth += depth + return &newLogger +} + +func (l *slogSink) Enabled(level int) bool { + return l.handler.Enabled(context.Background(), slog.Level(-level)) +} + +func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { + l.log(nil, msg, slog.Level(-level), kvList...) +} + +func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { + l.log(err, msg, slog.LevelError, kvList...) +} + +func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { + var pcs [1]uintptr + // skip runtime.Callers, this function, Info/Error, and all helper functions above that. + runtime.Callers(3+l.callDepth, pcs[:]) + + record := slog.NewRecord(time.Now(), level, msg, pcs[0]) + if l.name != "" { + record.AddAttrs(slog.String(nameKey, l.name)) + } + if err != nil { + record.AddAttrs(slog.Any(errKey, err)) + } + record.Add(kvList...) + _ = l.handler.Handle(context.Background(), record) +} + +func (l slogSink) WithName(name string) LogSink { + if l.name != "" { + l.name += "/" + } + l.name += name + return &l +} + +func (l slogSink) WithValues(kvList ...interface{}) LogSink { + l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) + return &l +} + +func kvListToAttrs(kvList ...interface{}) []slog.Attr { + // We don't need the record itself, only its Add method. + record := slog.NewRecord(time.Time{}, 0, "", 0) + record.Add(kvList...) + attrs := make([]slog.Attr, 0, record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + attrs = append(attrs, attr) + return true + }) + return attrs +} diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/go-logr/stdr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md new file mode 100644 index 00000000..51586678 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/README.md @@ -0,0 +1,6 @@ +# Minimal Go logging using logr and Go's standard library + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/stdr.svg)](https://pkg.go.dev/github.com/go-logr/stdr) + +This package implements the [logr interface](https://github.com/go-logr/logr) +in terms of Go's standard log package(https://pkg.go.dev/log). diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go new file mode 100644 index 00000000..93a8aab5 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/stdr.go @@ -0,0 +1,170 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package stdr implements github.com/go-logr/logr.Logger in terms of +// Go's standard log package. +package stdr + +import ( + "log" + "os" + + "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" +) + +// The global verbosity level. See SetVerbosity(). +var globalVerbosity int + +// SetVerbosity sets the global level against which all info logs will be +// compared. If this is greater than or equal to the "V" of the logger, the +// message will be logged. A higher value here means more logs will be written. +// The previous verbosity value is returned. This is not concurrent-safe - +// callers must be sure to call it from only one goroutine. +func SetVerbosity(v int) int { + old := globalVerbosity + globalVerbosity = v + return old +} + +// New returns a logr.Logger which is implemented by Go's standard log package, +// or something like it. If std is nil, this will use a default logger +// instead. +// +// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +func New(std StdLogger) logr.Logger { + return NewWithOptions(std, Options{}) +} + +// NewWithOptions returns a logr.Logger which is implemented by Go's standard +// log package, or something like it. See New for details. +func NewWithOptions(std StdLogger, opts Options) logr.Logger { + if std == nil { + // Go's log.Default() is only available in 1.16 and higher. + std = log.New(os.Stderr, "", log.LstdFlags) + } + + if opts.Depth < 0 { + opts.Depth = 0 + } + + fopts := funcr.Options{ + LogCaller: funcr.MessageClass(opts.LogCaller), + } + + sl := &logger{ + Formatter: funcr.NewFormatter(fopts), + std: std, + } + + // For skipping our own logger.Info/Error. + sl.Formatter.AddCallDepth(1 + opts.Depth) + + return logr.New(sl) +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // Depth biases the assumed number of call frames to the "true" caller. + // This is useful when the calling code calls a function which then calls + // stdr (e.g. a logging shim to another API). Values less than zero will + // be treated as zero. + Depth int + + // LogCaller tells stdr to add a "caller" key to some or all log lines. + // Go's log package has options to log this natively, too. + LogCaller MessageClass + + // TODO: add an option to log the date/time +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// StdLogger is the subset of the Go stdlib log.Logger API that is needed for +// this adapter. +type StdLogger interface { + // Output is the same as log.Output and log.Logger.Output. + Output(calldepth int, logline string) error +} + +type logger struct { + funcr.Formatter + std StdLogger +} + +var _ logr.LogSink = &logger{} +var _ logr.CallDepthLogSink = &logger{} + +func (l logger) Enabled(level int) bool { + return globalVerbosity >= level +} + +func (l logger) Info(level int, msg string, kvList ...interface{}) { + prefix, args := l.FormatInfo(level, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) Error(err error, msg string, kvList ...interface{}) { + prefix, args := l.FormatError(err, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) WithName(name string) logr.LogSink { + l.Formatter.AddName(name) + return &l +} + +func (l logger) WithValues(kvList ...interface{}) logr.LogSink { + l.Formatter.AddValues(kvList) + return &l +} + +func (l logger) WithCallDepth(depth int) logr.LogSink { + l.Formatter.AddCallDepth(depth) + return &l +} + +// Underlier exposes access to the underlying logging implementation. Since +// callers only have a logr.Logger, they have to know which implementation is +// in use, so this interface is less of an abstraction and more of way to test +// type conversion. +type Underlier interface { + GetUnderlying() StdLogger +} + +// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger +// is itself an interface, the result may or may not be a Go log.Logger. +func (l logger) GetUnderlying() StdLogger { + return l.std +} diff --git a/vendor/github.com/go-ole/go-ole/.travis.yml b/vendor/github.com/go-ole/go-ole/.travis.yml new file mode 100644 index 00000000..28f740cd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/.travis.yml @@ -0,0 +1,8 @@ +language: go +sudo: false + +go: + - 1.9.x + - 1.10.x + - 1.11.x + - tip diff --git a/vendor/github.com/go-ole/go-ole/ChangeLog.md b/vendor/github.com/go-ole/go-ole/ChangeLog.md new file mode 100644 index 00000000..4ba6a8c6 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ChangeLog.md @@ -0,0 +1,49 @@ +# Version 1.x.x + +* **Add more test cases and reference new test COM server project.** (Placeholder for future additions) + +# Version 1.2.0-alphaX + +**Minimum supported version is now Go 1.4. Go 1.1 support is deprecated, but should still build.** + + * Added CI configuration for Travis-CI and AppVeyor. + * Added test InterfaceID and ClassID for the COM Test Server project. + * Added more inline documentation (#83). + * Added IEnumVARIANT implementation (#88). + * Added IEnumVARIANT test cases (#99, #100, #101). + * Added support for retrieving `time.Time` from VARIANT (#92). + * Added test case for IUnknown (#64). + * Added test case for IDispatch (#64). + * Added test cases for scalar variants (#64, #76). + +# Version 1.1.1 + + * Fixes for Linux build. + * Fixes for Windows build. + +# Version 1.1.0 + +The change to provide building on all platforms is a new feature. The increase in minor version reflects that and allows those who wish to stay on 1.0.x to continue to do so. Support for 1.0.x will be limited to bug fixes. + + * Move GUID out of variables.go into its own file to make new documentation available. + * Move OleError out of ole.go into its own file to make new documentation available. + * Add documentation to utility functions. + * Add documentation to variant receiver functions. + * Add documentation to ole structures. + * Make variant available to other systems outside of Windows. + * Make OLE structures available to other systems outside of Windows. + +## New Features + + * Library should now be built on all platforms supported by Go. Library will NOOP on any platform that is not Windows. + * More functions are now documented and available on godoc.org. + +# Version 1.0.1 + + 1. Fix package references from repository location change. + +# Version 1.0.0 + +This version is stable enough for use. The COM API is still incomplete, but provides enough functionality for accessing COM servers using IDispatch interface. + +There is no changelog for this version. Check commits for history. diff --git a/vendor/github.com/go-ole/go-ole/LICENSE b/vendor/github.com/go-ole/go-ole/LICENSE new file mode 100644 index 00000000..623ec06f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2013-2017 Yasuhiro Matsumoto, + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/go-ole/go-ole/README.md b/vendor/github.com/go-ole/go-ole/README.md new file mode 100644 index 00000000..7b577558 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/README.md @@ -0,0 +1,46 @@ +# Go OLE + +[![Build status](https://ci.appveyor.com/api/projects/status/qr0u2sf7q43us9fj?svg=true)](https://ci.appveyor.com/project/jacobsantos/go-ole-jgs28) +[![Build Status](https://travis-ci.org/go-ole/go-ole.svg?branch=master)](https://travis-ci.org/go-ole/go-ole) +[![GoDoc](https://godoc.org/github.com/go-ole/go-ole?status.svg)](https://godoc.org/github.com/go-ole/go-ole) + +Go bindings for Windows COM using shared libraries instead of cgo. + +By Yasuhiro Matsumoto. + +## Install + +To experiment with go-ole, you can just compile and run the example program: + +``` +go get github.com/go-ole/go-ole +cd /path/to/go-ole/ +go test + +cd /path/to/go-ole/example/excel +go run excel.go +``` + +## Continuous Integration + +Continuous integration configuration has been added for both Travis-CI and AppVeyor. You will have to add these to your own account for your fork in order for it to run. + +**Travis-CI** + +Travis-CI was added to check builds on Linux to ensure that `go get` works when cross building. Currently, Travis-CI is not used to test cross-building, but this may be changed in the future. It is also not currently possible to test the library on Linux, since COM API is specific to Windows and it is not currently possible to run a COM server on Linux or even connect to a remote COM server. + +**AppVeyor** + +AppVeyor is used to build on Windows using the (in-development) test COM server. It is currently only used to test the build and ensure that the code works on Windows. It will be used to register a COM server and then run the test cases based on the test COM server. + +The tests currently do run and do pass and this should be maintained with commits. + +## Versioning + +Go OLE uses [semantic versioning](http://semver.org) for version numbers, which is similar to the version contract of the Go language. Which means that the major version will always maintain backwards compatibility with minor versions. Minor versions will only add new additions and changes. Fixes will always be in patch. + +This contract should allow you to upgrade to new minor and patch versions without breakage or modifications to your existing code. Leave a ticket, if there is breakage, so that it could be fixed. + +## LICENSE + +Under the MIT License: http://mattn.mit-license.org/2013 diff --git a/vendor/github.com/go-ole/go-ole/appveyor.yml b/vendor/github.com/go-ole/go-ole/appveyor.yml new file mode 100644 index 00000000..0d557ac2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/appveyor.yml @@ -0,0 +1,54 @@ +# Notes: +# - Minimal appveyor.yml file is an empty file. All sections are optional. +# - Indent each level of configuration with 2 spaces. Do not use tabs! +# - All section names are case-sensitive. +# - Section names should be unique on each level. + +version: "1.3.0.{build}-alpha-{branch}" + +os: Windows Server 2012 R2 + +branches: + only: + - master + - v1.2 + - v1.1 + - v1.0 + +skip_tags: true + +clone_folder: c:\gopath\src\github.com\go-ole\go-ole + +environment: + GOPATH: c:\gopath + matrix: + - GOARCH: amd64 + GOVERSION: 1.5 + GOROOT: c:\go + DOWNLOADPLATFORM: "x64" + +install: + - choco install mingw + - SET PATH=c:\tools\mingw64\bin;%PATH% + # - Download COM Server + - ps: Start-FileDownload "https://github.com/go-ole/test-com-server/releases/download/v1.0.2/test-com-server-${env:DOWNLOADPLATFORM}.zip" + - 7z e test-com-server-%DOWNLOADPLATFORM%.zip -oc:\gopath\src\github.com\go-ole\go-ole > NUL + - c:\gopath\src\github.com\go-ole\go-ole\build\register-assembly.bat + # - set + - go version + - go env + - go get -u golang.org/x/tools/cmd/cover + - go get -u golang.org/x/tools/cmd/godoc + - go get -u golang.org/x/tools/cmd/stringer + +build_script: + - cd c:\gopath\src\github.com\go-ole\go-ole + - go get -v -t ./... + - go build + - go test -v -cover ./... + +# disable automatic tests +test: off + +# disable deployment +deploy: off diff --git a/vendor/github.com/go-ole/go-ole/com.go b/vendor/github.com/go-ole/go-ole/com.go new file mode 100644 index 00000000..a9bef150 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/com.go @@ -0,0 +1,344 @@ +// +build windows + +package ole + +import ( + "syscall" + "unicode/utf16" + "unsafe" +) + +var ( + procCoInitialize = modole32.NewProc("CoInitialize") + procCoInitializeEx = modole32.NewProc("CoInitializeEx") + procCoUninitialize = modole32.NewProc("CoUninitialize") + procCoCreateInstance = modole32.NewProc("CoCreateInstance") + procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") + procCLSIDFromProgID = modole32.NewProc("CLSIDFromProgID") + procCLSIDFromString = modole32.NewProc("CLSIDFromString") + procStringFromCLSID = modole32.NewProc("StringFromCLSID") + procStringFromIID = modole32.NewProc("StringFromIID") + procIIDFromString = modole32.NewProc("IIDFromString") + procCoGetObject = modole32.NewProc("CoGetObject") + procGetUserDefaultLCID = modkernel32.NewProc("GetUserDefaultLCID") + procCopyMemory = modkernel32.NewProc("RtlMoveMemory") + procVariantInit = modoleaut32.NewProc("VariantInit") + procVariantClear = modoleaut32.NewProc("VariantClear") + procVariantTimeToSystemTime = modoleaut32.NewProc("VariantTimeToSystemTime") + procSysAllocString = modoleaut32.NewProc("SysAllocString") + procSysAllocStringLen = modoleaut32.NewProc("SysAllocStringLen") + procSysFreeString = modoleaut32.NewProc("SysFreeString") + procSysStringLen = modoleaut32.NewProc("SysStringLen") + procCreateDispTypeInfo = modoleaut32.NewProc("CreateDispTypeInfo") + procCreateStdDispatch = modoleaut32.NewProc("CreateStdDispatch") + procGetActiveObject = modoleaut32.NewProc("GetActiveObject") + + procGetMessageW = moduser32.NewProc("GetMessageW") + procDispatchMessageW = moduser32.NewProc("DispatchMessageW") +) + +// coInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func coInitialize() (err error) { + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms678543(v=vs.85).aspx + // Suggests that no value should be passed to CoInitialized. + // Could just be Call() since the parameter is optional. <-- Needs testing to be sure. + hr, _, _ := procCoInitialize.Call(uintptr(0)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// coInitializeEx initializes COM library with concurrency model. +func coInitializeEx(coinit uint32) (err error) { + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms695279(v=vs.85).aspx + // Suggests that the first parameter is not only optional but should always be NULL. + hr, _, _ := procCoInitializeEx.Call(uintptr(0), uintptr(coinit)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// CoInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func CoInitialize(p uintptr) (err error) { + // p is ignored and won't be used. + // Avoid any variable not used errors. + p = uintptr(0) + return coInitialize() +} + +// CoInitializeEx initializes COM library with concurrency model. +func CoInitializeEx(p uintptr, coinit uint32) (err error) { + // Avoid any variable not used errors. + p = uintptr(0) + return coInitializeEx(coinit) +} + +// CoUninitialize uninitializes COM Library. +func CoUninitialize() { + procCoUninitialize.Call() +} + +// CoTaskMemFree frees memory pointer. +func CoTaskMemFree(memptr uintptr) { + procCoTaskMemFree.Call(memptr) +} + +// CLSIDFromProgID retrieves Class Identifier with the given Program Identifier. +// +// The Programmatic Identifier must be registered, because it will be looked up +// in the Windows Registry. The registry entry has the following keys: CLSID, +// Insertable, Protocol and Shell +// (https://msdn.microsoft.com/en-us/library/dd542719(v=vs.85).aspx). +// +// programID identifies the class id with less precision and is not guaranteed +// to be unique. These are usually found in the registry under +// HKEY_LOCAL_MACHINE\SOFTWARE\Classes, usually with the format of +// "Program.Component.Version" with version being optional. +// +// CLSIDFromProgID in Windows API. +func CLSIDFromProgID(progId string) (clsid *GUID, err error) { + var guid GUID + lpszProgID := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(progId))) + hr, _, _ := procCLSIDFromProgID.Call(lpszProgID, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// CLSIDFromString retrieves Class ID from string representation. +// +// This is technically the string version of the GUID and will convert the +// string to object. +// +// CLSIDFromString in Windows API. +func CLSIDFromString(str string) (clsid *GUID, err error) { + var guid GUID + lpsz := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(str))) + hr, _, _ := procCLSIDFromString.Call(lpsz, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// StringFromCLSID returns GUID formated string from GUID object. +func StringFromCLSID(clsid *GUID) (str string, err error) { + var p *uint16 + hr, _, _ := procStringFromCLSID.Call(uintptr(unsafe.Pointer(clsid)), uintptr(unsafe.Pointer(&p))) + if hr != 0 { + err = NewError(hr) + } + str = LpOleStrToString(p) + return +} + +// IIDFromString returns GUID from program ID. +func IIDFromString(progId string) (clsid *GUID, err error) { + var guid GUID + lpsz := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(progId))) + hr, _, _ := procIIDFromString.Call(lpsz, uintptr(unsafe.Pointer(&guid))) + if hr != 0 { + err = NewError(hr) + } + clsid = &guid + return +} + +// StringFromIID returns GUID formatted string from GUID object. +func StringFromIID(iid *GUID) (str string, err error) { + var p *uint16 + hr, _, _ := procStringFromIID.Call(uintptr(unsafe.Pointer(iid)), uintptr(unsafe.Pointer(&p))) + if hr != 0 { + err = NewError(hr) + } + str = LpOleStrToString(p) + return +} + +// CreateInstance of single uninitialized object with GUID. +func CreateInstance(clsid *GUID, iid *GUID) (unk *IUnknown, err error) { + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procCoCreateInstance.Call( + uintptr(unsafe.Pointer(clsid)), + 0, + CLSCTX_SERVER, + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// GetActiveObject retrieves pointer to active object. +func GetActiveObject(clsid *GUID, iid *GUID) (unk *IUnknown, err error) { + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procGetActiveObject.Call( + uintptr(unsafe.Pointer(clsid)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +type BindOpts struct { + CbStruct uint32 + GrfFlags uint32 + GrfMode uint32 + TickCountDeadline uint32 +} + +// GetObject retrieves pointer to active object. +func GetObject(programID string, bindOpts *BindOpts, iid *GUID) (unk *IUnknown, err error) { + if bindOpts != nil { + bindOpts.CbStruct = uint32(unsafe.Sizeof(BindOpts{})) + } + if iid == nil { + iid = IID_IUnknown + } + hr, _, _ := procCoGetObject.Call( + uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(programID))), + uintptr(unsafe.Pointer(bindOpts)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&unk))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// VariantInit initializes variant. +func VariantInit(v *VARIANT) (err error) { + hr, _, _ := procVariantInit.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// VariantClear clears value in Variant settings to VT_EMPTY. +func VariantClear(v *VARIANT) (err error) { + hr, _, _ := procVariantClear.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// SysAllocString allocates memory for string and copies string into memory. +func SysAllocString(v string) (ss *int16) { + pss, _, _ := procSysAllocString.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(v)))) + ss = (*int16)(unsafe.Pointer(pss)) + return +} + +// SysAllocStringLen copies up to length of given string returning pointer. +func SysAllocStringLen(v string) (ss *int16) { + utf16 := utf16.Encode([]rune(v + "\x00")) + ptr := &utf16[0] + + pss, _, _ := procSysAllocStringLen.Call(uintptr(unsafe.Pointer(ptr)), uintptr(len(utf16)-1)) + ss = (*int16)(unsafe.Pointer(pss)) + return +} + +// SysFreeString frees string system memory. This must be called with SysAllocString. +func SysFreeString(v *int16) (err error) { + hr, _, _ := procSysFreeString.Call(uintptr(unsafe.Pointer(v))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// SysStringLen is the length of the system allocated string. +func SysStringLen(v *int16) uint32 { + l, _, _ := procSysStringLen.Call(uintptr(unsafe.Pointer(v))) + return uint32(l) +} + +// CreateStdDispatch provides default IDispatch implementation for IUnknown. +// +// This handles default IDispatch implementation for objects. It haves a few +// limitations with only supporting one language. It will also only return +// default exception codes. +func CreateStdDispatch(unk *IUnknown, v uintptr, ptinfo *IUnknown) (disp *IDispatch, err error) { + hr, _, _ := procCreateStdDispatch.Call( + uintptr(unsafe.Pointer(unk)), + v, + uintptr(unsafe.Pointer(ptinfo)), + uintptr(unsafe.Pointer(&disp))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// CreateDispTypeInfo provides default ITypeInfo implementation for IDispatch. +// +// This will not handle the full implementation of the interface. +func CreateDispTypeInfo(idata *INTERFACEDATA) (pptinfo *IUnknown, err error) { + hr, _, _ := procCreateDispTypeInfo.Call( + uintptr(unsafe.Pointer(idata)), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&pptinfo))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// copyMemory moves location of a block of memory. +func copyMemory(dest unsafe.Pointer, src unsafe.Pointer, length uint32) { + procCopyMemory.Call(uintptr(dest), uintptr(src), uintptr(length)) +} + +// GetUserDefaultLCID retrieves current user default locale. +func GetUserDefaultLCID() (lcid uint32) { + ret, _, _ := procGetUserDefaultLCID.Call() + lcid = uint32(ret) + return +} + +// GetMessage in message queue from runtime. +// +// This function appears to block. PeekMessage does not block. +func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error) { + r0, _, err := procGetMessageW.Call(uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax)) + ret = int32(r0) + return +} + +// DispatchMessage to window procedure. +func DispatchMessage(msg *Msg) (ret int32) { + r0, _, _ := procDispatchMessageW.Call(uintptr(unsafe.Pointer(msg))) + ret = int32(r0) + return +} diff --git a/vendor/github.com/go-ole/go-ole/com_func.go b/vendor/github.com/go-ole/go-ole/com_func.go new file mode 100644 index 00000000..cef539d9 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/com_func.go @@ -0,0 +1,174 @@ +// +build !windows + +package ole + +import ( + "time" + "unsafe" +) + +// coInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func coInitialize() error { + return NewError(E_NOTIMPL) +} + +// coInitializeEx initializes COM library with concurrency model. +func coInitializeEx(coinit uint32) error { + return NewError(E_NOTIMPL) +} + +// CoInitialize initializes COM library on current thread. +// +// MSDN documentation suggests that this function should not be called. Call +// CoInitializeEx() instead. The reason has to do with threading and this +// function is only for single-threaded apartments. +// +// That said, most users of the library have gotten away with just this +// function. If you are experiencing threading issues, then use +// CoInitializeEx(). +func CoInitialize(p uintptr) error { + return NewError(E_NOTIMPL) +} + +// CoInitializeEx initializes COM library with concurrency model. +func CoInitializeEx(p uintptr, coinit uint32) error { + return NewError(E_NOTIMPL) +} + +// CoUninitialize uninitializes COM Library. +func CoUninitialize() {} + +// CoTaskMemFree frees memory pointer. +func CoTaskMemFree(memptr uintptr) {} + +// CLSIDFromProgID retrieves Class Identifier with the given Program Identifier. +// +// The Programmatic Identifier must be registered, because it will be looked up +// in the Windows Registry. The registry entry has the following keys: CLSID, +// Insertable, Protocol and Shell +// (https://msdn.microsoft.com/en-us/library/dd542719(v=vs.85).aspx). +// +// programID identifies the class id with less precision and is not guaranteed +// to be unique. These are usually found in the registry under +// HKEY_LOCAL_MACHINE\SOFTWARE\Classes, usually with the format of +// "Program.Component.Version" with version being optional. +// +// CLSIDFromProgID in Windows API. +func CLSIDFromProgID(progId string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// CLSIDFromString retrieves Class ID from string representation. +// +// This is technically the string version of the GUID and will convert the +// string to object. +// +// CLSIDFromString in Windows API. +func CLSIDFromString(str string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// StringFromCLSID returns GUID formated string from GUID object. +func StringFromCLSID(clsid *GUID) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// IIDFromString returns GUID from program ID. +func IIDFromString(progId string) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// StringFromIID returns GUID formatted string from GUID object. +func StringFromIID(iid *GUID) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// CreateInstance of single uninitialized object with GUID. +func CreateInstance(clsid *GUID, iid *GUID) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// GetActiveObject retrieves pointer to active object. +func GetActiveObject(clsid *GUID, iid *GUID) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// VariantInit initializes variant. +func VariantInit(v *VARIANT) error { + return NewError(E_NOTIMPL) +} + +// VariantClear clears value in Variant settings to VT_EMPTY. +func VariantClear(v *VARIANT) error { + return NewError(E_NOTIMPL) +} + +// SysAllocString allocates memory for string and copies string into memory. +func SysAllocString(v string) *int16 { + u := int16(0) + return &u +} + +// SysAllocStringLen copies up to length of given string returning pointer. +func SysAllocStringLen(v string) *int16 { + u := int16(0) + return &u +} + +// SysFreeString frees string system memory. This must be called with SysAllocString. +func SysFreeString(v *int16) error { + return NewError(E_NOTIMPL) +} + +// SysStringLen is the length of the system allocated string. +func SysStringLen(v *int16) uint32 { + return uint32(0) +} + +// CreateStdDispatch provides default IDispatch implementation for IUnknown. +// +// This handles default IDispatch implementation for objects. It haves a few +// limitations with only supporting one language. It will also only return +// default exception codes. +func CreateStdDispatch(unk *IUnknown, v uintptr, ptinfo *IUnknown) (*IDispatch, error) { + return nil, NewError(E_NOTIMPL) +} + +// CreateDispTypeInfo provides default ITypeInfo implementation for IDispatch. +// +// This will not handle the full implementation of the interface. +func CreateDispTypeInfo(idata *INTERFACEDATA) (*IUnknown, error) { + return nil, NewError(E_NOTIMPL) +} + +// copyMemory moves location of a block of memory. +func copyMemory(dest unsafe.Pointer, src unsafe.Pointer, length uint32) {} + +// GetUserDefaultLCID retrieves current user default locale. +func GetUserDefaultLCID() uint32 { + return uint32(0) +} + +// GetMessage in message queue from runtime. +// +// This function appears to block. PeekMessage does not block. +func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// DispatchMessage to window procedure. +func DispatchMessage(msg *Msg) int32 { + return int32(0) +} + +func GetVariantDate(value uint64) (time.Time, error) { + return time.Now(), NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/connect.go b/vendor/github.com/go-ole/go-ole/connect.go new file mode 100644 index 00000000..b2ac2ec6 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/connect.go @@ -0,0 +1,192 @@ +package ole + +// Connection contains IUnknown for fluent interface interaction. +// +// Deprecated. Use oleutil package instead. +type Connection struct { + Object *IUnknown // Access COM +} + +// Initialize COM. +func (*Connection) Initialize() (err error) { + return coInitialize() +} + +// Uninitialize COM. +func (*Connection) Uninitialize() { + CoUninitialize() +} + +// Create IUnknown object based first on ProgId and then from String. +func (c *Connection) Create(progId string) (err error) { + var clsid *GUID + clsid, err = CLSIDFromProgID(progId) + if err != nil { + clsid, err = CLSIDFromString(progId) + if err != nil { + return + } + } + + unknown, err := CreateInstance(clsid, IID_IUnknown) + if err != nil { + return + } + c.Object = unknown + + return +} + +// Release IUnknown object. +func (c *Connection) Release() { + c.Object.Release() +} + +// Load COM object from list of programIDs or strings. +func (c *Connection) Load(names ...string) (errors []error) { + var tempErrors []error = make([]error, len(names)) + var numErrors int = 0 + for _, name := range names { + err := c.Create(name) + if err != nil { + tempErrors = append(tempErrors, err) + numErrors += 1 + continue + } + break + } + + copy(errors, tempErrors[0:numErrors]) + return +} + +// Dispatch returns Dispatch object. +func (c *Connection) Dispatch() (object *Dispatch, err error) { + dispatch, err := c.Object.QueryInterface(IID_IDispatch) + if err != nil { + return + } + object = &Dispatch{dispatch} + return +} + +// Dispatch stores IDispatch object. +type Dispatch struct { + Object *IDispatch // Dispatch object. +} + +// Call method on IDispatch with parameters. +func (d *Dispatch) Call(method string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(method) + if err != nil { + return + } + + result, err = d.Invoke(id, DISPATCH_METHOD, params) + return +} + +// MustCall method on IDispatch with parameters. +func (d *Dispatch) MustCall(method string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(method) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_METHOD, params) + if err != nil { + panic(err) + } + + return +} + +// Get property on IDispatch with parameters. +func (d *Dispatch) Get(name string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(name) + if err != nil { + return + } + result, err = d.Invoke(id, DISPATCH_PROPERTYGET, params) + return +} + +// MustGet property on IDispatch with parameters. +func (d *Dispatch) MustGet(name string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(name) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_PROPERTYGET, params) + if err != nil { + panic(err) + } + return +} + +// Set property on IDispatch with parameters. +func (d *Dispatch) Set(name string, params ...interface{}) (result *VARIANT, err error) { + id, err := d.GetId(name) + if err != nil { + return + } + result, err = d.Invoke(id, DISPATCH_PROPERTYPUT, params) + return +} + +// MustSet property on IDispatch with parameters. +func (d *Dispatch) MustSet(name string, params ...interface{}) (result *VARIANT) { + id, err := d.GetId(name) + if err != nil { + panic(err) + } + + result, err = d.Invoke(id, DISPATCH_PROPERTYPUT, params) + if err != nil { + panic(err) + } + return +} + +// GetId retrieves ID of name on IDispatch. +func (d *Dispatch) GetId(name string) (id int32, err error) { + var dispid []int32 + dispid, err = d.Object.GetIDsOfName([]string{name}) + if err != nil { + return + } + id = dispid[0] + return +} + +// GetIds retrieves all IDs of names on IDispatch. +func (d *Dispatch) GetIds(names ...string) (dispid []int32, err error) { + dispid, err = d.Object.GetIDsOfName(names) + return +} + +// Invoke IDispatch on DisplayID of dispatch type with parameters. +// +// There have been problems where if send cascading params..., it would error +// out because the parameters would be empty. +func (d *Dispatch) Invoke(id int32, dispatch int16, params []interface{}) (result *VARIANT, err error) { + if len(params) < 1 { + result, err = d.Object.Invoke(id, dispatch) + } else { + result, err = d.Object.Invoke(id, dispatch, params...) + } + return +} + +// Release IDispatch object. +func (d *Dispatch) Release() { + d.Object.Release() +} + +// Connect initializes COM and attempts to load IUnknown based on given names. +func Connect(names ...string) (connection *Connection) { + connection.Initialize() + connection.Load(names...) + return +} diff --git a/vendor/github.com/go-ole/go-ole/constants.go b/vendor/github.com/go-ole/go-ole/constants.go new file mode 100644 index 00000000..fd0c6d74 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/constants.go @@ -0,0 +1,153 @@ +package ole + +const ( + CLSCTX_INPROC_SERVER = 1 + CLSCTX_INPROC_HANDLER = 2 + CLSCTX_LOCAL_SERVER = 4 + CLSCTX_INPROC_SERVER16 = 8 + CLSCTX_REMOTE_SERVER = 16 + CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER + CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER + CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER +) + +const ( + COINIT_APARTMENTTHREADED = 0x2 + COINIT_MULTITHREADED = 0x0 + COINIT_DISABLE_OLE1DDE = 0x4 + COINIT_SPEED_OVER_MEMORY = 0x8 +) + +const ( + DISPATCH_METHOD = 1 + DISPATCH_PROPERTYGET = 2 + DISPATCH_PROPERTYPUT = 4 + DISPATCH_PROPERTYPUTREF = 8 +) + +const ( + S_OK = 0x00000000 + E_UNEXPECTED = 0x8000FFFF + E_NOTIMPL = 0x80004001 + E_OUTOFMEMORY = 0x8007000E + E_INVALIDARG = 0x80070057 + E_NOINTERFACE = 0x80004002 + E_POINTER = 0x80004003 + E_HANDLE = 0x80070006 + E_ABORT = 0x80004004 + E_FAIL = 0x80004005 + E_ACCESSDENIED = 0x80070005 + E_PENDING = 0x8000000A + + CO_E_CLASSSTRING = 0x800401F3 +) + +const ( + CC_FASTCALL = iota + CC_CDECL + CC_MSCPASCAL + CC_PASCAL = CC_MSCPASCAL + CC_MACPASCAL + CC_STDCALL + CC_FPFASTCALL + CC_SYSCALL + CC_MPWCDECL + CC_MPWPASCAL + CC_MAX = CC_MPWPASCAL +) + +type VT uint16 + +const ( + VT_EMPTY VT = 0x0 + VT_NULL VT = 0x1 + VT_I2 VT = 0x2 + VT_I4 VT = 0x3 + VT_R4 VT = 0x4 + VT_R8 VT = 0x5 + VT_CY VT = 0x6 + VT_DATE VT = 0x7 + VT_BSTR VT = 0x8 + VT_DISPATCH VT = 0x9 + VT_ERROR VT = 0xa + VT_BOOL VT = 0xb + VT_VARIANT VT = 0xc + VT_UNKNOWN VT = 0xd + VT_DECIMAL VT = 0xe + VT_I1 VT = 0x10 + VT_UI1 VT = 0x11 + VT_UI2 VT = 0x12 + VT_UI4 VT = 0x13 + VT_I8 VT = 0x14 + VT_UI8 VT = 0x15 + VT_INT VT = 0x16 + VT_UINT VT = 0x17 + VT_VOID VT = 0x18 + VT_HRESULT VT = 0x19 + VT_PTR VT = 0x1a + VT_SAFEARRAY VT = 0x1b + VT_CARRAY VT = 0x1c + VT_USERDEFINED VT = 0x1d + VT_LPSTR VT = 0x1e + VT_LPWSTR VT = 0x1f + VT_RECORD VT = 0x24 + VT_INT_PTR VT = 0x25 + VT_UINT_PTR VT = 0x26 + VT_FILETIME VT = 0x40 + VT_BLOB VT = 0x41 + VT_STREAM VT = 0x42 + VT_STORAGE VT = 0x43 + VT_STREAMED_OBJECT VT = 0x44 + VT_STORED_OBJECT VT = 0x45 + VT_BLOB_OBJECT VT = 0x46 + VT_CF VT = 0x47 + VT_CLSID VT = 0x48 + VT_BSTR_BLOB VT = 0xfff + VT_VECTOR VT = 0x1000 + VT_ARRAY VT = 0x2000 + VT_BYREF VT = 0x4000 + VT_RESERVED VT = 0x8000 + VT_ILLEGAL VT = 0xffff + VT_ILLEGALMASKED VT = 0xfff + VT_TYPEMASK VT = 0xfff +) + +const ( + DISPID_UNKNOWN = -1 + DISPID_VALUE = 0 + DISPID_PROPERTYPUT = -3 + DISPID_NEWENUM = -4 + DISPID_EVALUATE = -5 + DISPID_CONSTRUCTOR = -6 + DISPID_DESTRUCTOR = -7 + DISPID_COLLECT = -8 +) + +const ( + TKIND_ENUM = 1 + TKIND_RECORD = 2 + TKIND_MODULE = 3 + TKIND_INTERFACE = 4 + TKIND_DISPATCH = 5 + TKIND_COCLASS = 6 + TKIND_ALIAS = 7 + TKIND_UNION = 8 + TKIND_MAX = 9 +) + +// Safe Array Feature Flags + +const ( + FADF_AUTO = 0x0001 + FADF_STATIC = 0x0002 + FADF_EMBEDDED = 0x0004 + FADF_FIXEDSIZE = 0x0010 + FADF_RECORD = 0x0020 + FADF_HAVEIID = 0x0040 + FADF_HAVEVARTYPE = 0x0080 + FADF_BSTR = 0x0100 + FADF_UNKNOWN = 0x0200 + FADF_DISPATCH = 0x0400 + FADF_VARIANT = 0x0800 + FADF_RESERVED = 0xF008 +) diff --git a/vendor/github.com/go-ole/go-ole/error.go b/vendor/github.com/go-ole/go-ole/error.go new file mode 100644 index 00000000..096b456d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error.go @@ -0,0 +1,51 @@ +package ole + +// OleError stores COM errors. +type OleError struct { + hr uintptr + description string + subError error +} + +// NewError creates new error with HResult. +func NewError(hr uintptr) *OleError { + return &OleError{hr: hr} +} + +// NewErrorWithDescription creates new COM error with HResult and description. +func NewErrorWithDescription(hr uintptr, description string) *OleError { + return &OleError{hr: hr, description: description} +} + +// NewErrorWithSubError creates new COM error with parent error. +func NewErrorWithSubError(hr uintptr, description string, err error) *OleError { + return &OleError{hr: hr, description: description, subError: err} +} + +// Code is the HResult. +func (v *OleError) Code() uintptr { + return uintptr(v.hr) +} + +// String description, either manually set or format message with error code. +func (v *OleError) String() string { + if v.description != "" { + return errstr(int(v.hr)) + " (" + v.description + ")" + } + return errstr(int(v.hr)) +} + +// Error implements error interface. +func (v *OleError) Error() string { + return v.String() +} + +// Description retrieves error summary, if there is one. +func (v *OleError) Description() string { + return v.description +} + +// SubError returns parent error, if there is one. +func (v *OleError) SubError() error { + return v.subError +} diff --git a/vendor/github.com/go-ole/go-ole/error_func.go b/vendor/github.com/go-ole/go-ole/error_func.go new file mode 100644 index 00000000..8a2ffaa2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error_func.go @@ -0,0 +1,8 @@ +// +build !windows + +package ole + +// errstr converts error code to string. +func errstr(errno int) string { + return "" +} diff --git a/vendor/github.com/go-ole/go-ole/error_windows.go b/vendor/github.com/go-ole/go-ole/error_windows.go new file mode 100644 index 00000000..d0e8e685 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/error_windows.go @@ -0,0 +1,24 @@ +// +build windows + +package ole + +import ( + "fmt" + "syscall" + "unicode/utf16" +) + +// errstr converts error code to string. +func errstr(errno int) string { + // ask windows for the remaining errors + var flags uint32 = syscall.FORMAT_MESSAGE_FROM_SYSTEM | syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY | syscall.FORMAT_MESSAGE_IGNORE_INSERTS + b := make([]uint16, 300) + n, err := syscall.FormatMessage(flags, 0, uint32(errno), 0, b, nil) + if err != nil { + return fmt.Sprintf("error %d (FormatMessage failed with: %v)", errno, err) + } + // trim terminating \r and \n + for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { + } + return string(utf16.Decode(b[:n])) +} diff --git a/vendor/github.com/go-ole/go-ole/guid.go b/vendor/github.com/go-ole/go-ole/guid.go new file mode 100644 index 00000000..8d20f68f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/guid.go @@ -0,0 +1,284 @@ +package ole + +var ( + // IID_NULL is null Interface ID, used when no other Interface ID is known. + IID_NULL = NewGUID("{00000000-0000-0000-0000-000000000000}") + + // IID_IUnknown is for IUnknown interfaces. + IID_IUnknown = NewGUID("{00000000-0000-0000-C000-000000000046}") + + // IID_IDispatch is for IDispatch interfaces. + IID_IDispatch = NewGUID("{00020400-0000-0000-C000-000000000046}") + + // IID_IEnumVariant is for IEnumVariant interfaces + IID_IEnumVariant = NewGUID("{00020404-0000-0000-C000-000000000046}") + + // IID_IConnectionPointContainer is for IConnectionPointContainer interfaces. + IID_IConnectionPointContainer = NewGUID("{B196B284-BAB4-101A-B69C-00AA00341D07}") + + // IID_IConnectionPoint is for IConnectionPoint interfaces. + IID_IConnectionPoint = NewGUID("{B196B286-BAB4-101A-B69C-00AA00341D07}") + + // IID_IInspectable is for IInspectable interfaces. + IID_IInspectable = NewGUID("{AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90}") + + // IID_IProvideClassInfo is for IProvideClassInfo interfaces. + IID_IProvideClassInfo = NewGUID("{B196B283-BAB4-101A-B69C-00AA00341D07}") +) + +// These are for testing and not part of any library. +var ( + // IID_ICOMTestString is for ICOMTestString interfaces. + // + // {E0133EB4-C36F-469A-9D3D-C66B84BE19ED} + IID_ICOMTestString = NewGUID("{E0133EB4-C36F-469A-9D3D-C66B84BE19ED}") + + // IID_ICOMTestInt8 is for ICOMTestInt8 interfaces. + // + // {BEB06610-EB84-4155-AF58-E2BFF53680B4} + IID_ICOMTestInt8 = NewGUID("{BEB06610-EB84-4155-AF58-E2BFF53680B4}") + + // IID_ICOMTestInt16 is for ICOMTestInt16 interfaces. + // + // {DAA3F9FA-761E-4976-A860-8364CE55F6FC} + IID_ICOMTestInt16 = NewGUID("{DAA3F9FA-761E-4976-A860-8364CE55F6FC}") + + // IID_ICOMTestInt32 is for ICOMTestInt32 interfaces. + // + // {E3DEDEE7-38A2-4540-91D1-2EEF1D8891B0} + IID_ICOMTestInt32 = NewGUID("{E3DEDEE7-38A2-4540-91D1-2EEF1D8891B0}") + + // IID_ICOMTestInt64 is for ICOMTestInt64 interfaces. + // + // {8D437CBC-B3ED-485C-BC32-C336432A1623} + IID_ICOMTestInt64 = NewGUID("{8D437CBC-B3ED-485C-BC32-C336432A1623}") + + // IID_ICOMTestFloat is for ICOMTestFloat interfaces. + // + // {BF1ED004-EA02-456A-AA55-2AC8AC6B054C} + IID_ICOMTestFloat = NewGUID("{BF1ED004-EA02-456A-AA55-2AC8AC6B054C}") + + // IID_ICOMTestDouble is for ICOMTestDouble interfaces. + // + // {BF908A81-8687-4E93-999F-D86FAB284BA0} + IID_ICOMTestDouble = NewGUID("{BF908A81-8687-4E93-999F-D86FAB284BA0}") + + // IID_ICOMTestBoolean is for ICOMTestBoolean interfaces. + // + // {D530E7A6-4EE8-40D1-8931-3D63B8605010} + IID_ICOMTestBoolean = NewGUID("{D530E7A6-4EE8-40D1-8931-3D63B8605010}") + + // IID_ICOMEchoTestObject is for ICOMEchoTestObject interfaces. + // + // {6485B1EF-D780-4834-A4FE-1EBB51746CA3} + IID_ICOMEchoTestObject = NewGUID("{6485B1EF-D780-4834-A4FE-1EBB51746CA3}") + + // IID_ICOMTestTypes is for ICOMTestTypes interfaces. + // + // {CCA8D7AE-91C0-4277-A8B3-FF4EDF28D3C0} + IID_ICOMTestTypes = NewGUID("{CCA8D7AE-91C0-4277-A8B3-FF4EDF28D3C0}") + + // CLSID_COMEchoTestObject is for COMEchoTestObject class. + // + // {3C24506A-AE9E-4D50-9157-EF317281F1B0} + CLSID_COMEchoTestObject = NewGUID("{3C24506A-AE9E-4D50-9157-EF317281F1B0}") + + // CLSID_COMTestScalarClass is for COMTestScalarClass class. + // + // {865B85C5-0334-4AC6-9EF6-AACEC8FC5E86} + CLSID_COMTestScalarClass = NewGUID("{865B85C5-0334-4AC6-9EF6-AACEC8FC5E86}") +) + +const hextable = "0123456789ABCDEF" +const emptyGUID = "{00000000-0000-0000-0000-000000000000}" + +// GUID is Windows API specific GUID type. +// +// This exists to match Windows GUID type for direct passing for COM. +// Format is in xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx. +type GUID struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} + +// NewGUID converts the given string into a globally unique identifier that is +// compliant with the Windows API. +// +// The supplied string may be in any of these formats: +// +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// +// The conversion of the supplied string is not case-sensitive. +func NewGUID(guid string) *GUID { + d := []byte(guid) + var d1, d2, d3, d4a, d4b []byte + + switch len(d) { + case 38: + if d[0] != '{' || d[37] != '}' { + return nil + } + d = d[1:37] + fallthrough + case 36: + if d[8] != '-' || d[13] != '-' || d[18] != '-' || d[23] != '-' { + return nil + } + d1 = d[0:8] + d2 = d[9:13] + d3 = d[14:18] + d4a = d[19:23] + d4b = d[24:36] + case 32: + d1 = d[0:8] + d2 = d[8:12] + d3 = d[12:16] + d4a = d[16:20] + d4b = d[20:32] + default: + return nil + } + + var g GUID + var ok1, ok2, ok3, ok4 bool + g.Data1, ok1 = decodeHexUint32(d1) + g.Data2, ok2 = decodeHexUint16(d2) + g.Data3, ok3 = decodeHexUint16(d3) + g.Data4, ok4 = decodeHexByte64(d4a, d4b) + if ok1 && ok2 && ok3 && ok4 { + return &g + } + return nil +} + +func decodeHexUint32(src []byte) (value uint32, ok bool) { + var b1, b2, b3, b4 byte + var ok1, ok2, ok3, ok4 bool + b1, ok1 = decodeHexByte(src[0], src[1]) + b2, ok2 = decodeHexByte(src[2], src[3]) + b3, ok3 = decodeHexByte(src[4], src[5]) + b4, ok4 = decodeHexByte(src[6], src[7]) + value = (uint32(b1) << 24) | (uint32(b2) << 16) | (uint32(b3) << 8) | uint32(b4) + ok = ok1 && ok2 && ok3 && ok4 + return +} + +func decodeHexUint16(src []byte) (value uint16, ok bool) { + var b1, b2 byte + var ok1, ok2 bool + b1, ok1 = decodeHexByte(src[0], src[1]) + b2, ok2 = decodeHexByte(src[2], src[3]) + value = (uint16(b1) << 8) | uint16(b2) + ok = ok1 && ok2 + return +} + +func decodeHexByte64(s1 []byte, s2 []byte) (value [8]byte, ok bool) { + var ok1, ok2, ok3, ok4, ok5, ok6, ok7, ok8 bool + value[0], ok1 = decodeHexByte(s1[0], s1[1]) + value[1], ok2 = decodeHexByte(s1[2], s1[3]) + value[2], ok3 = decodeHexByte(s2[0], s2[1]) + value[3], ok4 = decodeHexByte(s2[2], s2[3]) + value[4], ok5 = decodeHexByte(s2[4], s2[5]) + value[5], ok6 = decodeHexByte(s2[6], s2[7]) + value[6], ok7 = decodeHexByte(s2[8], s2[9]) + value[7], ok8 = decodeHexByte(s2[10], s2[11]) + ok = ok1 && ok2 && ok3 && ok4 && ok5 && ok6 && ok7 && ok8 + return +} + +func decodeHexByte(c1, c2 byte) (value byte, ok bool) { + var n1, n2 byte + var ok1, ok2 bool + n1, ok1 = decodeHexChar(c1) + n2, ok2 = decodeHexChar(c2) + value = (n1 << 4) | n2 + ok = ok1 && ok2 + return +} + +func decodeHexChar(c byte) (byte, bool) { + switch { + case '0' <= c && c <= '9': + return c - '0', true + case 'a' <= c && c <= 'f': + return c - 'a' + 10, true + case 'A' <= c && c <= 'F': + return c - 'A' + 10, true + } + + return 0, false +} + +// String converts the GUID to string form. It will adhere to this pattern: +// +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// +// If the GUID is nil, the string representation of an empty GUID is returned: +// +// {00000000-0000-0000-0000-000000000000} +func (guid *GUID) String() string { + if guid == nil { + return emptyGUID + } + + var c [38]byte + c[0] = '{' + putUint32Hex(c[1:9], guid.Data1) + c[9] = '-' + putUint16Hex(c[10:14], guid.Data2) + c[14] = '-' + putUint16Hex(c[15:19], guid.Data3) + c[19] = '-' + putByteHex(c[20:24], guid.Data4[0:2]) + c[24] = '-' + putByteHex(c[25:37], guid.Data4[2:8]) + c[37] = '}' + return string(c[:]) +} + +func putUint32Hex(b []byte, v uint32) { + b[0] = hextable[byte(v>>24)>>4] + b[1] = hextable[byte(v>>24)&0x0f] + b[2] = hextable[byte(v>>16)>>4] + b[3] = hextable[byte(v>>16)&0x0f] + b[4] = hextable[byte(v>>8)>>4] + b[5] = hextable[byte(v>>8)&0x0f] + b[6] = hextable[byte(v)>>4] + b[7] = hextable[byte(v)&0x0f] +} + +func putUint16Hex(b []byte, v uint16) { + b[0] = hextable[byte(v>>8)>>4] + b[1] = hextable[byte(v>>8)&0x0f] + b[2] = hextable[byte(v)>>4] + b[3] = hextable[byte(v)&0x0f] +} + +func putByteHex(dst, src []byte) { + for i := 0; i < len(src); i++ { + dst[i*2] = hextable[src[i]>>4] + dst[i*2+1] = hextable[src[i]&0x0f] + } +} + +// IsEqualGUID compares two GUID. +// +// Not constant time comparison. +func IsEqualGUID(guid1 *GUID, guid2 *GUID) bool { + return guid1.Data1 == guid2.Data1 && + guid1.Data2 == guid2.Data2 && + guid1.Data3 == guid2.Data3 && + guid1.Data4[0] == guid2.Data4[0] && + guid1.Data4[1] == guid2.Data4[1] && + guid1.Data4[2] == guid2.Data4[2] && + guid1.Data4[3] == guid2.Data4[3] && + guid1.Data4[4] == guid2.Data4[4] && + guid1.Data4[5] == guid2.Data4[5] && + guid1.Data4[6] == guid2.Data4[6] && + guid1.Data4[7] == guid2.Data4[7] +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint.go new file mode 100644 index 00000000..9e6c49f4 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint.go @@ -0,0 +1,20 @@ +package ole + +import "unsafe" + +type IConnectionPoint struct { + IUnknown +} + +type IConnectionPointVtbl struct { + IUnknownVtbl + GetConnectionInterface uintptr + GetConnectionPointContainer uintptr + Advise uintptr + Unadvise uintptr + EnumConnections uintptr +} + +func (v *IConnectionPoint) VTable() *IConnectionPointVtbl { + return (*IConnectionPointVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go new file mode 100644 index 00000000..5414dc3c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go @@ -0,0 +1,21 @@ +// +build !windows + +package ole + +import "unsafe" + +func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32 { + return int32(0) +} + +func (v *IConnectionPoint) Advise(unknown *IUnknown) (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} + +func (v *IConnectionPoint) Unadvise(cookie uint32) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) (err error) { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go b/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go new file mode 100644 index 00000000..32bc1832 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go @@ -0,0 +1,43 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32 { + // XXX: This doesn't look like it does what it's supposed to + return release((*IUnknown)(unsafe.Pointer(v))) +} + +func (v *IConnectionPoint) Advise(unknown *IUnknown) (cookie uint32, err error) { + hr, _, _ := syscall.Syscall( + v.VTable().Advise, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(unknown)), + uintptr(unsafe.Pointer(&cookie))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (v *IConnectionPoint) Unadvise(cookie uint32) (err error) { + hr, _, _ := syscall.Syscall( + v.VTable().Unadvise, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(cookie), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go new file mode 100644 index 00000000..165860d1 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer.go @@ -0,0 +1,17 @@ +package ole + +import "unsafe" + +type IConnectionPointContainer struct { + IUnknown +} + +type IConnectionPointContainerVtbl struct { + IUnknownVtbl + EnumConnectionPoints uintptr + FindConnectionPoint uintptr +} + +func (v *IConnectionPointContainer) VTable() *IConnectionPointContainerVtbl { + return (*IConnectionPointContainerVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go new file mode 100644 index 00000000..5dfa42aa --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go @@ -0,0 +1,11 @@ +// +build !windows + +package ole + +func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go new file mode 100644 index 00000000..ad30d79e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go @@ -0,0 +1,25 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) error { + return NewError(E_NOTIMPL) +} + +func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) (err error) { + hr, _, _ := syscall.Syscall( + v.VTable().FindConnectionPoint, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(point))) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch.go b/vendor/github.com/go-ole/go-ole/idispatch.go new file mode 100644 index 00000000..d4af1240 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch.go @@ -0,0 +1,94 @@ +package ole + +import "unsafe" + +type IDispatch struct { + IUnknown +} + +type IDispatchVtbl struct { + IUnknownVtbl + GetTypeInfoCount uintptr + GetTypeInfo uintptr + GetIDsOfNames uintptr + Invoke uintptr +} + +func (v *IDispatch) VTable() *IDispatchVtbl { + return (*IDispatchVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IDispatch) GetIDsOfName(names []string) (dispid []int32, err error) { + dispid, err = getIDsOfName(v, names) + return +} + +func (v *IDispatch) Invoke(dispid int32, dispatch int16, params ...interface{}) (result *VARIANT, err error) { + result, err = invoke(v, dispid, dispatch, params...) + return +} + +func (v *IDispatch) GetTypeInfoCount() (c uint32, err error) { + c, err = getTypeInfoCount(v) + return +} + +func (v *IDispatch) GetTypeInfo() (tinfo *ITypeInfo, err error) { + tinfo, err = getTypeInfo(v) + return +} + +// GetSingleIDOfName is a helper that returns single display ID for IDispatch name. +// +// This replaces the common pattern of attempting to get a single name from the list of available +// IDs. It gives the first ID, if it is available. +func (v *IDispatch) GetSingleIDOfName(name string) (displayID int32, err error) { + var displayIDs []int32 + displayIDs, err = v.GetIDsOfName([]string{name}) + if err != nil { + return + } + displayID = displayIDs[0] + return +} + +// InvokeWithOptionalArgs accepts arguments as an array, works like Invoke. +// +// Accepts name and will attempt to retrieve Display ID to pass to Invoke. +// +// Passing params as an array is a workaround that could be fixed in later versions of Go that +// prevent passing empty params. During testing it was discovered that this is an acceptable way of +// getting around not being able to pass params normally. +func (v *IDispatch) InvokeWithOptionalArgs(name string, dispatch int16, params []interface{}) (result *VARIANT, err error) { + displayID, err := v.GetSingleIDOfName(name) + if err != nil { + return + } + + if len(params) < 1 { + result, err = v.Invoke(displayID, dispatch) + } else { + result, err = v.Invoke(displayID, dispatch, params...) + } + + return +} + +// CallMethod invokes named function with arguments on object. +func (v *IDispatch) CallMethod(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_METHOD, params) +} + +// GetProperty retrieves the property with the name with the ability to pass arguments. +// +// Most of the time you will not need to pass arguments as most objects do not allow for this +// feature. Or at least, should not allow for this feature. Some servers don't follow best practices +// and this is provided for those edge cases. +func (v *IDispatch) GetProperty(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_PROPERTYGET, params) +} + +// PutProperty attempts to mutate a property in the object. +func (v *IDispatch) PutProperty(name string, params ...interface{}) (*VARIANT, error) { + return v.InvokeWithOptionalArgs(name, DISPATCH_PROPERTYPUT, params) +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch_func.go b/vendor/github.com/go-ole/go-ole/idispatch_func.go new file mode 100644 index 00000000..b8fbbe31 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func getIDsOfName(disp *IDispatch, names []string) ([]int32, error) { + return []int32{}, NewError(E_NOTIMPL) +} + +func getTypeInfoCount(disp *IDispatch) (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} + +func getTypeInfo(disp *IDispatch) (*ITypeInfo, error) { + return nil, NewError(E_NOTIMPL) +} + +func invoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{}) (*VARIANT, error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/idispatch_windows.go b/vendor/github.com/go-ole/go-ole/idispatch_windows.go new file mode 100644 index 00000000..b399f047 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/idispatch_windows.go @@ -0,0 +1,202 @@ +// +build windows + +package ole + +import ( + "math/big" + "syscall" + "time" + "unsafe" +) + +func getIDsOfName(disp *IDispatch, names []string) (dispid []int32, err error) { + wnames := make([]*uint16, len(names)) + for i := 0; i < len(names); i++ { + wnames[i] = syscall.StringToUTF16Ptr(names[i]) + } + dispid = make([]int32, len(names)) + namelen := uint32(len(names)) + hr, _, _ := syscall.Syscall6( + disp.VTable().GetIDsOfNames, + 6, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(IID_NULL)), + uintptr(unsafe.Pointer(&wnames[0])), + uintptr(namelen), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&dispid[0]))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func getTypeInfoCount(disp *IDispatch) (c uint32, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetTypeInfoCount, + 2, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(&c)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func getTypeInfo(disp *IDispatch) (tinfo *ITypeInfo, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetTypeInfo, + 3, + uintptr(unsafe.Pointer(disp)), + uintptr(GetUserDefaultLCID()), + uintptr(unsafe.Pointer(&tinfo))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func invoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{}) (result *VARIANT, err error) { + var dispparams DISPPARAMS + + if dispatch&DISPATCH_PROPERTYPUT != 0 { + dispnames := [1]int32{DISPID_PROPERTYPUT} + dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) + dispparams.cNamedArgs = 1 + } else if dispatch&DISPATCH_PROPERTYPUTREF != 0 { + dispnames := [1]int32{DISPID_PROPERTYPUT} + dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) + dispparams.cNamedArgs = 1 + } + var vargs []VARIANT + if len(params) > 0 { + vargs = make([]VARIANT, len(params)) + for i, v := range params { + //n := len(params)-i-1 + n := len(params) - i - 1 + VariantInit(&vargs[n]) + switch vv := v.(type) { + case bool: + if vv { + vargs[n] = NewVariant(VT_BOOL, 0xffff) + } else { + vargs[n] = NewVariant(VT_BOOL, 0) + } + case *bool: + vargs[n] = NewVariant(VT_BOOL|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*bool))))) + case uint8: + vargs[n] = NewVariant(VT_I1, int64(v.(uint8))) + case *uint8: + vargs[n] = NewVariant(VT_I1|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint8))))) + case int8: + vargs[n] = NewVariant(VT_I1, int64(v.(int8))) + case *int8: + vargs[n] = NewVariant(VT_I1|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint8))))) + case int16: + vargs[n] = NewVariant(VT_I2, int64(v.(int16))) + case *int16: + vargs[n] = NewVariant(VT_I2|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int16))))) + case uint16: + vargs[n] = NewVariant(VT_UI2, int64(v.(uint16))) + case *uint16: + vargs[n] = NewVariant(VT_UI2|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint16))))) + case int32: + vargs[n] = NewVariant(VT_I4, int64(v.(int32))) + case *int32: + vargs[n] = NewVariant(VT_I4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int32))))) + case uint32: + vargs[n] = NewVariant(VT_UI4, int64(v.(uint32))) + case *uint32: + vargs[n] = NewVariant(VT_UI4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint32))))) + case int64: + vargs[n] = NewVariant(VT_I8, int64(v.(int64))) + case *int64: + vargs[n] = NewVariant(VT_I8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int64))))) + case uint64: + vargs[n] = NewVariant(VT_UI8, int64(uintptr(v.(uint64)))) + case *uint64: + vargs[n] = NewVariant(VT_UI8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint64))))) + case int: + vargs[n] = NewVariant(VT_I4, int64(v.(int))) + case *int: + vargs[n] = NewVariant(VT_I4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*int))))) + case uint: + vargs[n] = NewVariant(VT_UI4, int64(v.(uint))) + case *uint: + vargs[n] = NewVariant(VT_UI4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*uint))))) + case float32: + vargs[n] = NewVariant(VT_R4, *(*int64)(unsafe.Pointer(&vv))) + case *float32: + vargs[n] = NewVariant(VT_R4|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*float32))))) + case float64: + vargs[n] = NewVariant(VT_R8, *(*int64)(unsafe.Pointer(&vv))) + case *float64: + vargs[n] = NewVariant(VT_R8|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*float64))))) + case *big.Int: + vargs[n] = NewVariant(VT_DECIMAL, v.(*big.Int).Int64()) + case string: + vargs[n] = NewVariant(VT_BSTR, int64(uintptr(unsafe.Pointer(SysAllocStringLen(v.(string)))))) + case *string: + vargs[n] = NewVariant(VT_BSTR|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*string))))) + case time.Time: + s := vv.Format("2006-01-02 15:04:05") + vargs[n] = NewVariant(VT_BSTR, int64(uintptr(unsafe.Pointer(SysAllocStringLen(s))))) + case *time.Time: + s := vv.Format("2006-01-02 15:04:05") + vargs[n] = NewVariant(VT_BSTR|VT_BYREF, int64(uintptr(unsafe.Pointer(&s)))) + case *IDispatch: + vargs[n] = NewVariant(VT_DISPATCH, int64(uintptr(unsafe.Pointer(v.(*IDispatch))))) + case **IDispatch: + vargs[n] = NewVariant(VT_DISPATCH|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(**IDispatch))))) + case nil: + vargs[n] = NewVariant(VT_NULL, 0) + case *VARIANT: + vargs[n] = NewVariant(VT_VARIANT|VT_BYREF, int64(uintptr(unsafe.Pointer(v.(*VARIANT))))) + case []byte: + safeByteArray := safeArrayFromByteSlice(v.([]byte)) + vargs[n] = NewVariant(VT_ARRAY|VT_UI1, int64(uintptr(unsafe.Pointer(safeByteArray)))) + defer VariantClear(&vargs[n]) + case []string: + safeByteArray := safeArrayFromStringSlice(v.([]string)) + vargs[n] = NewVariant(VT_ARRAY|VT_BSTR, int64(uintptr(unsafe.Pointer(safeByteArray)))) + defer VariantClear(&vargs[n]) + default: + panic("unknown type") + } + } + dispparams.rgvarg = uintptr(unsafe.Pointer(&vargs[0])) + dispparams.cArgs = uint32(len(params)) + } + + result = new(VARIANT) + var excepInfo EXCEPINFO + VariantInit(result) + hr, _, _ := syscall.Syscall9( + disp.VTable().Invoke, + 9, + uintptr(unsafe.Pointer(disp)), + uintptr(dispid), + uintptr(unsafe.Pointer(IID_NULL)), + uintptr(GetUserDefaultLCID()), + uintptr(dispatch), + uintptr(unsafe.Pointer(&dispparams)), + uintptr(unsafe.Pointer(result)), + uintptr(unsafe.Pointer(&excepInfo)), + 0) + if hr != 0 { + excepInfo.renderStrings() + excepInfo.Clear() + err = NewErrorWithSubError(hr, excepInfo.description, excepInfo) + } + for i, varg := range vargs { + n := len(params) - i - 1 + if varg.VT == VT_BSTR && varg.Val != 0 { + SysFreeString(((*int16)(unsafe.Pointer(uintptr(varg.Val))))) + } + if varg.VT == (VT_BSTR|VT_BYREF) && varg.Val != 0 { + *(params[n].(*string)) = LpOleStrToString(*(**uint16)(unsafe.Pointer(uintptr(varg.Val)))) + } + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant.go b/vendor/github.com/go-ole/go-ole/ienumvariant.go new file mode 100644 index 00000000..24338975 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant.go @@ -0,0 +1,19 @@ +package ole + +import "unsafe" + +type IEnumVARIANT struct { + IUnknown +} + +type IEnumVARIANTVtbl struct { + IUnknownVtbl + Next uintptr + Skip uintptr + Reset uintptr + Clone uintptr +} + +func (v *IEnumVARIANT) VTable() *IEnumVARIANTVtbl { + return (*IEnumVARIANTVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant_func.go b/vendor/github.com/go-ole/go-ole/ienumvariant_func.go new file mode 100644 index 00000000..c1484819 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func (enum *IEnumVARIANT) Clone() (*IEnumVARIANT, error) { + return nil, NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Reset() error { + return NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Skip(celt uint) error { + return NewError(E_NOTIMPL) +} + +func (enum *IEnumVARIANT) Next(celt uint) (VARIANT, uint, error) { + return NewVariant(VT_NULL, int64(0)), 0, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go b/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go new file mode 100644 index 00000000..4781f3b8 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go @@ -0,0 +1,63 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (enum *IEnumVARIANT) Clone() (cloned *IEnumVARIANT, err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Clone, + 2, + uintptr(unsafe.Pointer(enum)), + uintptr(unsafe.Pointer(&cloned)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Reset() (err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Reset, + 1, + uintptr(unsafe.Pointer(enum)), + 0, + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Skip(celt uint) (err error) { + hr, _, _ := syscall.Syscall( + enum.VTable().Skip, + 2, + uintptr(unsafe.Pointer(enum)), + uintptr(celt), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} + +func (enum *IEnumVARIANT) Next(celt uint) (array VARIANT, length uint, err error) { + hr, _, _ := syscall.Syscall6( + enum.VTable().Next, + 4, + uintptr(unsafe.Pointer(enum)), + uintptr(celt), + uintptr(unsafe.Pointer(&array)), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable.go b/vendor/github.com/go-ole/go-ole/iinspectable.go new file mode 100644 index 00000000..f4a19e25 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable.go @@ -0,0 +1,18 @@ +package ole + +import "unsafe" + +type IInspectable struct { + IUnknown +} + +type IInspectableVtbl struct { + IUnknownVtbl + GetIIds uintptr + GetRuntimeClassName uintptr + GetTrustLevel uintptr +} + +func (v *IInspectable) VTable() *IInspectableVtbl { + return (*IInspectableVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable_func.go b/vendor/github.com/go-ole/go-ole/iinspectable_func.go new file mode 100644 index 00000000..348829bf --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable_func.go @@ -0,0 +1,15 @@ +// +build !windows + +package ole + +func (v *IInspectable) GetIids() ([]*GUID, error) { + return []*GUID{}, NewError(E_NOTIMPL) +} + +func (v *IInspectable) GetRuntimeClassName() (string, error) { + return "", NewError(E_NOTIMPL) +} + +func (v *IInspectable) GetTrustLevel() (uint32, error) { + return uint32(0), NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iinspectable_windows.go b/vendor/github.com/go-ole/go-ole/iinspectable_windows.go new file mode 100644 index 00000000..4519a4aa --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iinspectable_windows.go @@ -0,0 +1,72 @@ +// +build windows + +package ole + +import ( + "bytes" + "encoding/binary" + "reflect" + "syscall" + "unsafe" +) + +func (v *IInspectable) GetIids() (iids []*GUID, err error) { + var count uint32 + var array uintptr + hr, _, _ := syscall.Syscall( + v.VTable().GetIIds, + 3, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&count)), + uintptr(unsafe.Pointer(&array))) + if hr != 0 { + err = NewError(hr) + return + } + defer CoTaskMemFree(array) + + iids = make([]*GUID, count) + byteCount := count * uint32(unsafe.Sizeof(GUID{})) + slicehdr := reflect.SliceHeader{Data: array, Len: int(byteCount), Cap: int(byteCount)} + byteSlice := *(*[]byte)(unsafe.Pointer(&slicehdr)) + reader := bytes.NewReader(byteSlice) + for i := range iids { + guid := GUID{} + err = binary.Read(reader, binary.LittleEndian, &guid) + if err != nil { + return + } + iids[i] = &guid + } + return +} + +func (v *IInspectable) GetRuntimeClassName() (s string, err error) { + var hstring HString + hr, _, _ := syscall.Syscall( + v.VTable().GetRuntimeClassName, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&hstring)), + 0) + if hr != 0 { + err = NewError(hr) + return + } + s = hstring.String() + DeleteHString(hstring) + return +} + +func (v *IInspectable) GetTrustLevel() (level uint32, err error) { + hr, _, _ := syscall.Syscall( + v.VTable().GetTrustLevel, + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&level)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go new file mode 100644 index 00000000..25f3a6f2 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo.go @@ -0,0 +1,21 @@ +package ole + +import "unsafe" + +type IProvideClassInfo struct { + IUnknown +} + +type IProvideClassInfoVtbl struct { + IUnknownVtbl + GetClassInfo uintptr +} + +func (v *IProvideClassInfo) VTable() *IProvideClassInfoVtbl { + return (*IProvideClassInfoVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IProvideClassInfo) GetClassInfo() (cinfo *ITypeInfo, err error) { + cinfo, err = getClassInfo(v) + return +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go new file mode 100644 index 00000000..7e3cb63e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go @@ -0,0 +1,7 @@ +// +build !windows + +package ole + +func getClassInfo(disp *IProvideClassInfo) (tinfo *ITypeInfo, err error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go new file mode 100644 index 00000000..2ad01639 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go @@ -0,0 +1,21 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func getClassInfo(disp *IProvideClassInfo) (tinfo *ITypeInfo, err error) { + hr, _, _ := syscall.Syscall( + disp.VTable().GetClassInfo, + 2, + uintptr(unsafe.Pointer(disp)), + uintptr(unsafe.Pointer(&tinfo)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo.go b/vendor/github.com/go-ole/go-ole/itypeinfo.go new file mode 100644 index 00000000..dd3c5e21 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo.go @@ -0,0 +1,34 @@ +package ole + +import "unsafe" + +type ITypeInfo struct { + IUnknown +} + +type ITypeInfoVtbl struct { + IUnknownVtbl + GetTypeAttr uintptr + GetTypeComp uintptr + GetFuncDesc uintptr + GetVarDesc uintptr + GetNames uintptr + GetRefTypeOfImplType uintptr + GetImplTypeFlags uintptr + GetIDsOfNames uintptr + Invoke uintptr + GetDocumentation uintptr + GetDllEntry uintptr + GetRefTypeInfo uintptr + AddressOfMember uintptr + CreateInstance uintptr + GetMops uintptr + GetContainingTypeLib uintptr + ReleaseTypeAttr uintptr + ReleaseFuncDesc uintptr + ReleaseVarDesc uintptr +} + +func (v *ITypeInfo) VTable() *ITypeInfoVtbl { + return (*ITypeInfoVtbl)(unsafe.Pointer(v.RawVTable)) +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo_func.go b/vendor/github.com/go-ole/go-ole/itypeinfo_func.go new file mode 100644 index 00000000..8364a659 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo_func.go @@ -0,0 +1,7 @@ +// +build !windows + +package ole + +func (v *ITypeInfo) GetTypeAttr() (*TYPEATTR, error) { + return nil, NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go b/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go new file mode 100644 index 00000000..54782b3d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go @@ -0,0 +1,21 @@ +// +build windows + +package ole + +import ( + "syscall" + "unsafe" +) + +func (v *ITypeInfo) GetTypeAttr() (tattr *TYPEATTR, err error) { + hr, _, _ := syscall.Syscall( + uintptr(v.VTable().GetTypeAttr), + 2, + uintptr(unsafe.Pointer(v)), + uintptr(unsafe.Pointer(&tattr)), + 0) + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown.go b/vendor/github.com/go-ole/go-ole/iunknown.go new file mode 100644 index 00000000..108f28ea --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown.go @@ -0,0 +1,57 @@ +package ole + +import "unsafe" + +type IUnknown struct { + RawVTable *interface{} +} + +type IUnknownVtbl struct { + QueryInterface uintptr + AddRef uintptr + Release uintptr +} + +type UnknownLike interface { + QueryInterface(iid *GUID) (disp *IDispatch, err error) + AddRef() int32 + Release() int32 +} + +func (v *IUnknown) VTable() *IUnknownVtbl { + return (*IUnknownVtbl)(unsafe.Pointer(v.RawVTable)) +} + +func (v *IUnknown) PutQueryInterface(interfaceID *GUID, obj interface{}) error { + return reflectQueryInterface(v, v.VTable().QueryInterface, interfaceID, obj) +} + +func (v *IUnknown) IDispatch(interfaceID *GUID) (dispatch *IDispatch, err error) { + err = v.PutQueryInterface(interfaceID, &dispatch) + return +} + +func (v *IUnknown) IEnumVARIANT(interfaceID *GUID) (enum *IEnumVARIANT, err error) { + err = v.PutQueryInterface(interfaceID, &enum) + return +} + +func (v *IUnknown) QueryInterface(iid *GUID) (*IDispatch, error) { + return queryInterface(v, iid) +} + +func (v *IUnknown) MustQueryInterface(iid *GUID) (disp *IDispatch) { + unk, err := queryInterface(v, iid) + if err != nil { + panic(err) + } + return unk +} + +func (v *IUnknown) AddRef() int32 { + return addRef(v) +} + +func (v *IUnknown) Release() int32 { + return release(v) +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown_func.go b/vendor/github.com/go-ole/go-ole/iunknown_func.go new file mode 100644 index 00000000..d0a62cfd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown_func.go @@ -0,0 +1,19 @@ +// +build !windows + +package ole + +func reflectQueryInterface(self interface{}, method uintptr, interfaceID *GUID, obj interface{}) (err error) { + return NewError(E_NOTIMPL) +} + +func queryInterface(unk *IUnknown, iid *GUID) (disp *IDispatch, err error) { + return nil, NewError(E_NOTIMPL) +} + +func addRef(unk *IUnknown) int32 { + return 0 +} + +func release(unk *IUnknown) int32 { + return 0 +} diff --git a/vendor/github.com/go-ole/go-ole/iunknown_windows.go b/vendor/github.com/go-ole/go-ole/iunknown_windows.go new file mode 100644 index 00000000..ede5bb8c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/iunknown_windows.go @@ -0,0 +1,58 @@ +// +build windows + +package ole + +import ( + "reflect" + "syscall" + "unsafe" +) + +func reflectQueryInterface(self interface{}, method uintptr, interfaceID *GUID, obj interface{}) (err error) { + selfValue := reflect.ValueOf(self).Elem() + objValue := reflect.ValueOf(obj).Elem() + + hr, _, _ := syscall.Syscall( + method, + 3, + selfValue.UnsafeAddr(), + uintptr(unsafe.Pointer(interfaceID)), + objValue.Addr().Pointer()) + if hr != 0 { + err = NewError(hr) + } + return +} + +func queryInterface(unk *IUnknown, iid *GUID) (disp *IDispatch, err error) { + hr, _, _ := syscall.Syscall( + unk.VTable().QueryInterface, + 3, + uintptr(unsafe.Pointer(unk)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&disp))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func addRef(unk *IUnknown) int32 { + ret, _, _ := syscall.Syscall( + unk.VTable().AddRef, + 1, + uintptr(unsafe.Pointer(unk)), + 0, + 0) + return int32(ret) +} + +func release(unk *IUnknown) int32 { + ret, _, _ := syscall.Syscall( + unk.VTable().Release, + 1, + uintptr(unsafe.Pointer(unk)), + 0, + 0) + return int32(ret) +} diff --git a/vendor/github.com/go-ole/go-ole/ole.go b/vendor/github.com/go-ole/go-ole/ole.go new file mode 100644 index 00000000..dbd132bb --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/ole.go @@ -0,0 +1,190 @@ +package ole + +import ( + "fmt" + "strings" + "unsafe" +) + +// DISPPARAMS are the arguments that passed to methods or property. +type DISPPARAMS struct { + rgvarg uintptr + rgdispidNamedArgs uintptr + cArgs uint32 + cNamedArgs uint32 +} + +// EXCEPINFO defines exception info. +type EXCEPINFO struct { + wCode uint16 + wReserved uint16 + bstrSource *uint16 + bstrDescription *uint16 + bstrHelpFile *uint16 + dwHelpContext uint32 + pvReserved uintptr + pfnDeferredFillIn uintptr + scode uint32 + + // Go-specific part. Don't move upper cos it'll break structure layout for native code. + rendered bool + source string + description string + helpFile string +} + +// renderStrings translates BSTR strings to Go ones so `.Error` and `.String` +// could be safely called after `.Clear`. We need this when we can't rely on +// a caller to call `.Clear`. +func (e *EXCEPINFO) renderStrings() { + e.rendered = true + if e.bstrSource == nil { + e.source = "" + } else { + e.source = BstrToString(e.bstrSource) + } + if e.bstrDescription == nil { + e.description = "" + } else { + e.description = BstrToString(e.bstrDescription) + } + if e.bstrHelpFile == nil { + e.helpFile = "" + } else { + e.helpFile = BstrToString(e.bstrHelpFile) + } +} + +// Clear frees BSTR strings inside an EXCEPINFO and set it to NULL. +func (e *EXCEPINFO) Clear() { + freeBSTR := func(s *uint16) { + // SysFreeString don't return errors and is safe for call's on NULL. + // https://docs.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-sysfreestring + _ = SysFreeString((*int16)(unsafe.Pointer(s))) + } + + if e.bstrSource != nil { + freeBSTR(e.bstrSource) + e.bstrSource = nil + } + if e.bstrDescription != nil { + freeBSTR(e.bstrDescription) + e.bstrDescription = nil + } + if e.bstrHelpFile != nil { + freeBSTR(e.bstrHelpFile) + e.bstrHelpFile = nil + } +} + +// WCode return wCode in EXCEPINFO. +func (e EXCEPINFO) WCode() uint16 { + return e.wCode +} + +// SCODE return scode in EXCEPINFO. +func (e EXCEPINFO) SCODE() uint32 { + return e.scode +} + +// String convert EXCEPINFO to string. +func (e EXCEPINFO) String() string { + if !e.rendered { + e.renderStrings() + } + return fmt.Sprintf( + "wCode: %#x, bstrSource: %v, bstrDescription: %v, bstrHelpFile: %v, dwHelpContext: %#x, scode: %#x", + e.wCode, e.source, e.description, e.helpFile, e.dwHelpContext, e.scode, + ) +} + +// Error implements error interface and returns error string. +func (e EXCEPINFO) Error() string { + if !e.rendered { + e.renderStrings() + } + + if e.description != "" { + return strings.TrimSpace(e.description) + } + + code := e.scode + if e.wCode != 0 { + code = uint32(e.wCode) + } + return fmt.Sprintf("%v: %#x", e.source, code) +} + +// PARAMDATA defines parameter data type. +type PARAMDATA struct { + Name *int16 + Vt uint16 +} + +// METHODDATA defines method info. +type METHODDATA struct { + Name *uint16 + Data *PARAMDATA + Dispid int32 + Meth uint32 + CC int32 + CArgs uint32 + Flags uint16 + VtReturn uint32 +} + +// INTERFACEDATA defines interface info. +type INTERFACEDATA struct { + MethodData *METHODDATA + CMembers uint32 +} + +// Point is 2D vector type. +type Point struct { + X int32 + Y int32 +} + +// Msg is message between processes. +type Msg struct { + Hwnd uint32 + Message uint32 + Wparam int32 + Lparam int32 + Time uint32 + Pt Point +} + +// TYPEDESC defines data type. +type TYPEDESC struct { + Hreftype uint32 + VT uint16 +} + +// IDLDESC defines IDL info. +type IDLDESC struct { + DwReserved uint32 + WIDLFlags uint16 +} + +// TYPEATTR defines type info. +type TYPEATTR struct { + Guid GUID + Lcid uint32 + dwReserved uint32 + MemidConstructor int32 + MemidDestructor int32 + LpstrSchema *uint16 + CbSizeInstance uint32 + Typekind int32 + CFuncs uint16 + CVars uint16 + CImplTypes uint16 + CbSizeVft uint16 + CbAlignment uint16 + WTypeFlags uint16 + WMajorVerNum uint16 + WMinorVerNum uint16 + TdescAlias TYPEDESC + IdldescType IDLDESC +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection.go b/vendor/github.com/go-ole/go-ole/oleutil/connection.go new file mode 100644 index 00000000..60df73cd --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection.go @@ -0,0 +1,100 @@ +// +build windows + +package oleutil + +import ( + "reflect" + "unsafe" + + ole "github.com/go-ole/go-ole" +) + +type stdDispatch struct { + lpVtbl *stdDispatchVtbl + ref int32 + iid *ole.GUID + iface interface{} + funcMap map[string]int32 +} + +type stdDispatchVtbl struct { + pQueryInterface uintptr + pAddRef uintptr + pRelease uintptr + pGetTypeInfoCount uintptr + pGetTypeInfo uintptr + pGetIDsOfNames uintptr + pInvoke uintptr +} + +func dispQueryInterface(this *ole.IUnknown, iid *ole.GUID, punk **ole.IUnknown) uint32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + *punk = nil + if ole.IsEqualGUID(iid, ole.IID_IUnknown) || + ole.IsEqualGUID(iid, ole.IID_IDispatch) { + dispAddRef(this) + *punk = this + return ole.S_OK + } + if ole.IsEqualGUID(iid, pthis.iid) { + dispAddRef(this) + *punk = this + return ole.S_OK + } + return ole.E_NOINTERFACE +} + +func dispAddRef(this *ole.IUnknown) int32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + pthis.ref++ + return pthis.ref +} + +func dispRelease(this *ole.IUnknown) int32 { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + pthis.ref-- + return pthis.ref +} + +func dispGetIDsOfNames(this *ole.IUnknown, iid *ole.GUID, wnames []*uint16, namelen int, lcid int, pdisp []int32) uintptr { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + names := make([]string, len(wnames)) + for i := 0; i < len(names); i++ { + names[i] = ole.LpOleStrToString(wnames[i]) + } + for n := 0; n < namelen; n++ { + if id, ok := pthis.funcMap[names[n]]; ok { + pdisp[n] = id + } + } + return ole.S_OK +} + +func dispGetTypeInfoCount(pcount *int) uintptr { + if pcount != nil { + *pcount = 0 + } + return ole.S_OK +} + +func dispGetTypeInfo(ptypeif *uintptr) uintptr { + return ole.E_NOTIMPL +} + +func dispInvoke(this *ole.IDispatch, dispid int32, riid *ole.GUID, lcid int, flags int16, dispparams *ole.DISPPARAMS, result *ole.VARIANT, pexcepinfo *ole.EXCEPINFO, nerr *uint) uintptr { + pthis := (*stdDispatch)(unsafe.Pointer(this)) + found := "" + for name, id := range pthis.funcMap { + if id == dispid { + found = name + } + } + if found != "" { + rv := reflect.ValueOf(pthis.iface).Elem() + rm := rv.MethodByName(found) + rr := rm.Call([]reflect.Value{}) + println(len(rr)) + return ole.S_OK + } + return ole.E_NOTIMPL +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go b/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go new file mode 100644 index 00000000..8818fb82 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go @@ -0,0 +1,10 @@ +// +build !windows + +package oleutil + +import ole "github.com/go-ole/go-ole" + +// ConnectObject creates a connection point between two services for communication. +func ConnectObject(disp *ole.IDispatch, iid *ole.GUID, idisp interface{}) (uint32, error) { + return 0, ole.NewError(ole.E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go new file mode 100644 index 00000000..ab9c0d8d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go @@ -0,0 +1,58 @@ +// +build windows + +package oleutil + +import ( + "reflect" + "syscall" + "unsafe" + + ole "github.com/go-ole/go-ole" +) + +// ConnectObject creates a connection point between two services for communication. +func ConnectObject(disp *ole.IDispatch, iid *ole.GUID, idisp interface{}) (cookie uint32, err error) { + unknown, err := disp.QueryInterface(ole.IID_IConnectionPointContainer) + if err != nil { + return + } + + container := (*ole.IConnectionPointContainer)(unsafe.Pointer(unknown)) + var point *ole.IConnectionPoint + err = container.FindConnectionPoint(iid, &point) + if err != nil { + return + } + if edisp, ok := idisp.(*ole.IUnknown); ok { + cookie, err = point.Advise(edisp) + container.Release() + if err != nil { + return + } + } + rv := reflect.ValueOf(disp).Elem() + if rv.Type().Kind() == reflect.Struct { + dest := &stdDispatch{} + dest.lpVtbl = &stdDispatchVtbl{} + dest.lpVtbl.pQueryInterface = syscall.NewCallback(dispQueryInterface) + dest.lpVtbl.pAddRef = syscall.NewCallback(dispAddRef) + dest.lpVtbl.pRelease = syscall.NewCallback(dispRelease) + dest.lpVtbl.pGetTypeInfoCount = syscall.NewCallback(dispGetTypeInfoCount) + dest.lpVtbl.pGetTypeInfo = syscall.NewCallback(dispGetTypeInfo) + dest.lpVtbl.pGetIDsOfNames = syscall.NewCallback(dispGetIDsOfNames) + dest.lpVtbl.pInvoke = syscall.NewCallback(dispInvoke) + dest.iface = disp + dest.iid = iid + cookie, err = point.Advise((*ole.IUnknown)(unsafe.Pointer(dest))) + container.Release() + if err != nil { + point.Release() + return + } + return + } + + container.Release() + + return 0, ole.NewError(ole.E_INVALIDARG) +} diff --git a/vendor/github.com/go-ole/go-ole/oleutil/go-get.go b/vendor/github.com/go-ole/go-ole/oleutil/go-get.go new file mode 100644 index 00000000..58347628 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/go-get.go @@ -0,0 +1,6 @@ +// This file is here so go get succeeds as without it errors with: +// no buildable Go source files in ... +// +// +build !windows + +package oleutil diff --git a/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go new file mode 100644 index 00000000..f7803c1e --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go @@ -0,0 +1,127 @@ +package oleutil + +import ole "github.com/go-ole/go-ole" + +// ClassIDFrom retrieves class ID whether given is program ID or application string. +func ClassIDFrom(programID string) (classID *ole.GUID, err error) { + return ole.ClassIDFrom(programID) +} + +// CreateObject creates object from programID based on interface type. +// +// Only supports IUnknown. +// +// Program ID can be either program ID or application string. +func CreateObject(programID string) (unknown *ole.IUnknown, err error) { + classID, err := ole.ClassIDFrom(programID) + if err != nil { + return + } + + unknown, err = ole.CreateInstance(classID, ole.IID_IUnknown) + if err != nil { + return + } + + return +} + +// GetActiveObject retrieves active object for program ID and interface ID based +// on interface type. +// +// Only supports IUnknown. +// +// Program ID can be either program ID or application string. +func GetActiveObject(programID string) (unknown *ole.IUnknown, err error) { + classID, err := ole.ClassIDFrom(programID) + if err != nil { + return + } + + unknown, err = ole.GetActiveObject(classID, ole.IID_IUnknown) + if err != nil { + return + } + + return +} + +// CallMethod calls method on IDispatch with parameters. +func CallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_METHOD, params) +} + +// MustCallMethod calls method on IDispatch with parameters or panics. +func MustCallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := CallMethod(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// GetProperty retrieves property from IDispatch. +func GetProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYGET, params) +} + +// MustGetProperty retrieves property from IDispatch or panics. +func MustGetProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := GetProperty(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// PutProperty mutates property. +func PutProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUT, params) +} + +// MustPutProperty mutates property or panics. +func MustPutProperty(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := PutProperty(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +// PutPropertyRef mutates property reference. +func PutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUTREF, params) +} + +// MustPutPropertyRef mutates property reference or panics. +func MustPutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := PutPropertyRef(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +func ForEach(disp *ole.IDispatch, f func(v *ole.VARIANT) error) error { + newEnum, err := disp.GetProperty("_NewEnum") + if err != nil { + return err + } + defer newEnum.Clear() + + enum, err := newEnum.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + defer enum.Release() + + for item, length, err := enum.Next(1); length > 0; item, length, err = enum.Next(1) { + if err != nil { + return err + } + if ferr := f(&item); ferr != nil { + return ferr + } + } + return nil +} diff --git a/vendor/github.com/go-ole/go-ole/safearray.go b/vendor/github.com/go-ole/go-ole/safearray.go new file mode 100644 index 00000000..a5201b56 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray.go @@ -0,0 +1,27 @@ +// Package is meant to retrieve and process safe array data returned from COM. + +package ole + +// SafeArrayBound defines the SafeArray boundaries. +type SafeArrayBound struct { + Elements uint32 + LowerBound int32 +} + +// SafeArray is how COM handles arrays. +type SafeArray struct { + Dimensions uint16 + FeaturesFlag uint16 + ElementsSize uint32 + LocksAmount uint32 + Data uint32 + Bounds [16]byte +} + +// SAFEARRAY is obsolete, exists for backwards compatibility. +// Use SafeArray +type SAFEARRAY SafeArray + +// SAFEARRAYBOUND is obsolete, exists for backwards compatibility. +// Use SafeArrayBound +type SAFEARRAYBOUND SafeArrayBound diff --git a/vendor/github.com/go-ole/go-ole/safearray_func.go b/vendor/github.com/go-ole/go-ole/safearray_func.go new file mode 100644 index 00000000..0dee670c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray_func.go @@ -0,0 +1,211 @@ +// +build !windows + +package ole + +import ( + "unsafe" +) + +// safeArrayAccessData returns raw array pointer. +// +// AKA: SafeArrayAccessData in Windows API. +func safeArrayAccessData(safearray *SafeArray) (uintptr, error) { + return uintptr(0), NewError(E_NOTIMPL) +} + +// safeArrayUnaccessData releases raw array. +// +// AKA: SafeArrayUnaccessData in Windows API. +func safeArrayUnaccessData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayAllocData allocates SafeArray. +// +// AKA: SafeArrayAllocData in Windows API. +func safeArrayAllocData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayAllocDescriptor allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptor in Windows API. +func safeArrayAllocDescriptor(dimensions uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayAllocDescriptorEx allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptorEx in Windows API. +func safeArrayAllocDescriptorEx(variantType VT, dimensions uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCopy returns copy of SafeArray. +// +// AKA: SafeArrayCopy in Windows API. +func safeArrayCopy(original *SafeArray) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCopyData duplicates SafeArray into another SafeArray object. +// +// AKA: SafeArrayCopyData in Windows API. +func safeArrayCopyData(original *SafeArray, duplicate *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayCreate creates SafeArray. +// +// AKA: SafeArrayCreate in Windows API. +func safeArrayCreate(variantType VT, dimensions uint32, bounds *SafeArrayBound) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateEx creates SafeArray. +// +// AKA: SafeArrayCreateEx in Windows API. +func safeArrayCreateEx(variantType VT, dimensions uint32, bounds *SafeArrayBound, extra uintptr) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateVector creates SafeArray. +// +// AKA: SafeArrayCreateVector in Windows API. +func safeArrayCreateVector(variantType VT, lowerBound int32, length uint32) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayCreateVectorEx creates SafeArray. +// +// AKA: SafeArrayCreateVectorEx in Windows API. +func safeArrayCreateVectorEx(variantType VT, lowerBound int32, length uint32, extra uintptr) (*SafeArray, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayDestroy destroys SafeArray object. +// +// AKA: SafeArrayDestroy in Windows API. +func safeArrayDestroy(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayDestroyData destroys SafeArray object. +// +// AKA: SafeArrayDestroyData in Windows API. +func safeArrayDestroyData(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayDestroyDescriptor destroys SafeArray object. +// +// AKA: SafeArrayDestroyDescriptor in Windows API. +func safeArrayDestroyDescriptor(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetDim is the amount of dimensions in the SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetDim in Windows API. +func safeArrayGetDim(safearray *SafeArray) (*uint32, error) { + u := uint32(0) + return &u, NewError(E_NOTIMPL) +} + +// safeArrayGetElementSize is the element size in bytes. +// +// AKA: SafeArrayGetElemsize in Windows API. +func safeArrayGetElementSize(safearray *SafeArray) (*uint32, error) { + u := uint32(0) + return &u, NewError(E_NOTIMPL) +} + +// safeArrayGetElement retrieves element at given index. +func safeArrayGetElement(safearray *SafeArray, index int32, pv unsafe.Pointer) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetElement retrieves element at given index and converts to string. +func safeArrayGetElementString(safearray *SafeArray, index int32) (string, error) { + return "", NewError(E_NOTIMPL) +} + +// safeArrayGetIID is the InterfaceID of the elements in the SafeArray. +// +// AKA: SafeArrayGetIID in Windows API. +func safeArrayGetIID(safearray *SafeArray) (*GUID, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArrayGetLBound returns lower bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetLBound in Windows API. +func safeArrayGetLBound(safearray *SafeArray, dimension uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// safeArrayGetUBound returns upper bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetUBound in Windows API. +func safeArrayGetUBound(safearray *SafeArray, dimension uint32) (int32, error) { + return int32(0), NewError(E_NOTIMPL) +} + +// safeArrayGetVartype returns data type of SafeArray. +// +// AKA: SafeArrayGetVartype in Windows API. +func safeArrayGetVartype(safearray *SafeArray) (uint16, error) { + return uint16(0), NewError(E_NOTIMPL) +} + +// safeArrayLock locks SafeArray for reading to modify SafeArray. +// +// This must be called during some calls to ensure that another process does not +// read or write to the SafeArray during editing. +// +// AKA: SafeArrayLock in Windows API. +func safeArrayLock(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayUnlock unlocks SafeArray for reading. +// +// AKA: SafeArrayUnlock in Windows API. +func safeArrayUnlock(safearray *SafeArray) error { + return NewError(E_NOTIMPL) +} + +// safeArrayPutElement stores the data element at the specified location in the +// array. +// +// AKA: SafeArrayPutElement in Windows API. +func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) error { + return NewError(E_NOTIMPL) +} + +// safeArrayGetRecordInfo accesses IRecordInfo info for custom types. +// +// AKA: SafeArrayGetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArrayGetRecordInfo(safearray *SafeArray) (interface{}, error) { + return nil, NewError(E_NOTIMPL) +} + +// safeArraySetRecordInfo mutates IRecordInfo info for custom types. +// +// AKA: SafeArraySetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArraySetRecordInfo(safearray *SafeArray, recordInfo interface{}) error { + return NewError(E_NOTIMPL) +} diff --git a/vendor/github.com/go-ole/go-ole/safearray_windows.go b/vendor/github.com/go-ole/go-ole/safearray_windows.go new file mode 100644 index 00000000..0c1b3a10 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearray_windows.go @@ -0,0 +1,337 @@ +// +build windows + +package ole + +import ( + "unsafe" +) + +var ( + procSafeArrayAccessData = modoleaut32.NewProc("SafeArrayAccessData") + procSafeArrayAllocData = modoleaut32.NewProc("SafeArrayAllocData") + procSafeArrayAllocDescriptor = modoleaut32.NewProc("SafeArrayAllocDescriptor") + procSafeArrayAllocDescriptorEx = modoleaut32.NewProc("SafeArrayAllocDescriptorEx") + procSafeArrayCopy = modoleaut32.NewProc("SafeArrayCopy") + procSafeArrayCopyData = modoleaut32.NewProc("SafeArrayCopyData") + procSafeArrayCreate = modoleaut32.NewProc("SafeArrayCreate") + procSafeArrayCreateEx = modoleaut32.NewProc("SafeArrayCreateEx") + procSafeArrayCreateVector = modoleaut32.NewProc("SafeArrayCreateVector") + procSafeArrayCreateVectorEx = modoleaut32.NewProc("SafeArrayCreateVectorEx") + procSafeArrayDestroy = modoleaut32.NewProc("SafeArrayDestroy") + procSafeArrayDestroyData = modoleaut32.NewProc("SafeArrayDestroyData") + procSafeArrayDestroyDescriptor = modoleaut32.NewProc("SafeArrayDestroyDescriptor") + procSafeArrayGetDim = modoleaut32.NewProc("SafeArrayGetDim") + procSafeArrayGetElement = modoleaut32.NewProc("SafeArrayGetElement") + procSafeArrayGetElemsize = modoleaut32.NewProc("SafeArrayGetElemsize") + procSafeArrayGetIID = modoleaut32.NewProc("SafeArrayGetIID") + procSafeArrayGetLBound = modoleaut32.NewProc("SafeArrayGetLBound") + procSafeArrayGetUBound = modoleaut32.NewProc("SafeArrayGetUBound") + procSafeArrayGetVartype = modoleaut32.NewProc("SafeArrayGetVartype") + procSafeArrayLock = modoleaut32.NewProc("SafeArrayLock") + procSafeArrayPtrOfIndex = modoleaut32.NewProc("SafeArrayPtrOfIndex") + procSafeArrayUnaccessData = modoleaut32.NewProc("SafeArrayUnaccessData") + procSafeArrayUnlock = modoleaut32.NewProc("SafeArrayUnlock") + procSafeArrayPutElement = modoleaut32.NewProc("SafeArrayPutElement") + //procSafeArrayRedim = modoleaut32.NewProc("SafeArrayRedim") // TODO + //procSafeArraySetIID = modoleaut32.NewProc("SafeArraySetIID") // TODO + procSafeArrayGetRecordInfo = modoleaut32.NewProc("SafeArrayGetRecordInfo") + procSafeArraySetRecordInfo = modoleaut32.NewProc("SafeArraySetRecordInfo") +) + +// safeArrayAccessData returns raw array pointer. +// +// AKA: SafeArrayAccessData in Windows API. +// Todo: Test +func safeArrayAccessData(safearray *SafeArray) (element uintptr, err error) { + err = convertHresultToError( + procSafeArrayAccessData.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&element)))) + return +} + +// safeArrayUnaccessData releases raw array. +// +// AKA: SafeArrayUnaccessData in Windows API. +func safeArrayUnaccessData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayUnaccessData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayAllocData allocates SafeArray. +// +// AKA: SafeArrayAllocData in Windows API. +func safeArrayAllocData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayAllocData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayAllocDescriptor allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptor in Windows API. +func safeArrayAllocDescriptor(dimensions uint32) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayAllocDescriptor.Call(uintptr(dimensions), uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayAllocDescriptorEx allocates SafeArray. +// +// AKA: SafeArrayAllocDescriptorEx in Windows API. +func safeArrayAllocDescriptorEx(variantType VT, dimensions uint32) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayAllocDescriptorEx.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayCopy returns copy of SafeArray. +// +// AKA: SafeArrayCopy in Windows API. +func safeArrayCopy(original *SafeArray) (safearray *SafeArray, err error) { + err = convertHresultToError( + procSafeArrayCopy.Call( + uintptr(unsafe.Pointer(original)), + uintptr(unsafe.Pointer(&safearray)))) + return +} + +// safeArrayCopyData duplicates SafeArray into another SafeArray object. +// +// AKA: SafeArrayCopyData in Windows API. +func safeArrayCopyData(original *SafeArray, duplicate *SafeArray) (err error) { + err = convertHresultToError( + procSafeArrayCopyData.Call( + uintptr(unsafe.Pointer(original)), + uintptr(unsafe.Pointer(duplicate)))) + return +} + +// safeArrayCreate creates SafeArray. +// +// AKA: SafeArrayCreate in Windows API. +func safeArrayCreate(variantType VT, dimensions uint32, bounds *SafeArrayBound) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreate.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(bounds))) + safearray = (*SafeArray)(unsafe.Pointer(&sa)) + return +} + +// safeArrayCreateEx creates SafeArray. +// +// AKA: SafeArrayCreateEx in Windows API. +func safeArrayCreateEx(variantType VT, dimensions uint32, bounds *SafeArrayBound, extra uintptr) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateEx.Call( + uintptr(variantType), + uintptr(dimensions), + uintptr(unsafe.Pointer(bounds)), + extra) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayCreateVector creates SafeArray. +// +// AKA: SafeArrayCreateVector in Windows API. +func safeArrayCreateVector(variantType VT, lowerBound int32, length uint32) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateVector.Call( + uintptr(variantType), + uintptr(lowerBound), + uintptr(length)) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayCreateVectorEx creates SafeArray. +// +// AKA: SafeArrayCreateVectorEx in Windows API. +func safeArrayCreateVectorEx(variantType VT, lowerBound int32, length uint32, extra uintptr) (safearray *SafeArray, err error) { + sa, _, err := procSafeArrayCreateVectorEx.Call( + uintptr(variantType), + uintptr(lowerBound), + uintptr(length), + extra) + safearray = (*SafeArray)(unsafe.Pointer(sa)) + return +} + +// safeArrayDestroy destroys SafeArray object. +// +// AKA: SafeArrayDestroy in Windows API. +func safeArrayDestroy(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroy.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayDestroyData destroys SafeArray object. +// +// AKA: SafeArrayDestroyData in Windows API. +func safeArrayDestroyData(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroyData.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayDestroyDescriptor destroys SafeArray object. +// +// AKA: SafeArrayDestroyDescriptor in Windows API. +func safeArrayDestroyDescriptor(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayDestroyDescriptor.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayGetDim is the amount of dimensions in the SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetDim in Windows API. +func safeArrayGetDim(safearray *SafeArray) (dimensions *uint32, err error) { + l, _, err := procSafeArrayGetDim.Call(uintptr(unsafe.Pointer(safearray))) + dimensions = (*uint32)(unsafe.Pointer(l)) + return +} + +// safeArrayGetElementSize is the element size in bytes. +// +// AKA: SafeArrayGetElemsize in Windows API. +func safeArrayGetElementSize(safearray *SafeArray) (length *uint32, err error) { + l, _, err := procSafeArrayGetElemsize.Call(uintptr(unsafe.Pointer(safearray))) + length = (*uint32)(unsafe.Pointer(l)) + return +} + +// safeArrayGetElement retrieves element at given index. +func safeArrayGetElement(safearray *SafeArray, index int32, pv unsafe.Pointer) error { + return convertHresultToError( + procSafeArrayGetElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(pv))) +} + +// safeArrayGetElementString retrieves element at given index and converts to string. +func safeArrayGetElementString(safearray *SafeArray, index int32) (str string, err error) { + var element *int16 + err = convertHresultToError( + procSafeArrayGetElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(unsafe.Pointer(&element)))) + str = BstrToString(*(**uint16)(unsafe.Pointer(&element))) + SysFreeString(element) + return +} + +// safeArrayGetIID is the InterfaceID of the elements in the SafeArray. +// +// AKA: SafeArrayGetIID in Windows API. +func safeArrayGetIID(safearray *SafeArray) (guid *GUID, err error) { + err = convertHresultToError( + procSafeArrayGetIID.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&guid)))) + return +} + +// safeArrayGetLBound returns lower bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetLBound in Windows API. +func safeArrayGetLBound(safearray *SafeArray, dimension uint32) (lowerBound int32, err error) { + err = convertHresultToError( + procSafeArrayGetLBound.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(dimension), + uintptr(unsafe.Pointer(&lowerBound)))) + return +} + +// safeArrayGetUBound returns upper bounds of SafeArray. +// +// SafeArrays may have multiple dimensions. Meaning, it could be +// multidimensional array. +// +// AKA: SafeArrayGetUBound in Windows API. +func safeArrayGetUBound(safearray *SafeArray, dimension uint32) (upperBound int32, err error) { + err = convertHresultToError( + procSafeArrayGetUBound.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(dimension), + uintptr(unsafe.Pointer(&upperBound)))) + return +} + +// safeArrayGetVartype returns data type of SafeArray. +// +// AKA: SafeArrayGetVartype in Windows API. +func safeArrayGetVartype(safearray *SafeArray) (varType uint16, err error) { + err = convertHresultToError( + procSafeArrayGetVartype.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&varType)))) + return +} + +// safeArrayLock locks SafeArray for reading to modify SafeArray. +// +// This must be called during some calls to ensure that another process does not +// read or write to the SafeArray during editing. +// +// AKA: SafeArrayLock in Windows API. +func safeArrayLock(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayLock.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayUnlock unlocks SafeArray for reading. +// +// AKA: SafeArrayUnlock in Windows API. +func safeArrayUnlock(safearray *SafeArray) (err error) { + err = convertHresultToError(procSafeArrayUnlock.Call(uintptr(unsafe.Pointer(safearray)))) + return +} + +// safeArrayPutElement stores the data element at the specified location in the +// array. +// +// AKA: SafeArrayPutElement in Windows API. +func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) (err error) { + err = convertHresultToError( + procSafeArrayPutElement.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&index)), + uintptr(unsafe.Pointer(element)))) + return +} + +// safeArrayGetRecordInfo accesses IRecordInfo info for custom types. +// +// AKA: SafeArrayGetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArrayGetRecordInfo(safearray *SafeArray) (recordInfo interface{}, err error) { + err = convertHresultToError( + procSafeArrayGetRecordInfo.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&recordInfo)))) + return +} + +// safeArraySetRecordInfo mutates IRecordInfo info for custom types. +// +// AKA: SafeArraySetRecordInfo in Windows API. +// +// XXX: Must implement IRecordInfo interface for this to return. +func safeArraySetRecordInfo(safearray *SafeArray, recordInfo interface{}) (err error) { + err = convertHresultToError( + procSafeArraySetRecordInfo.Call( + uintptr(unsafe.Pointer(safearray)), + uintptr(unsafe.Pointer(&recordInfo)))) + return +} diff --git a/vendor/github.com/go-ole/go-ole/safearrayconversion.go b/vendor/github.com/go-ole/go-ole/safearrayconversion.go new file mode 100644 index 00000000..da737293 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearrayconversion.go @@ -0,0 +1,140 @@ +// Helper for converting SafeArray to array of objects. + +package ole + +import ( + "unsafe" +) + +type SafeArrayConversion struct { + Array *SafeArray +} + +func (sac *SafeArrayConversion) ToStringArray() (strings []string) { + totalElements, _ := sac.TotalElements(0) + strings = make([]string, totalElements) + + for i := int32(0); i < totalElements; i++ { + strings[int32(i)], _ = safeArrayGetElementString(sac.Array, i) + } + + return +} + +func (sac *SafeArrayConversion) ToByteArray() (bytes []byte) { + totalElements, _ := sac.TotalElements(0) + bytes = make([]byte, totalElements) + + for i := int32(0); i < totalElements; i++ { + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&bytes[int32(i)])) + } + + return +} + +func (sac *SafeArrayConversion) ToValueArray() (values []interface{}) { + totalElements, _ := sac.TotalElements(0) + values = make([]interface{}, totalElements) + vt, _ := safeArrayGetVartype(sac.Array) + + for i := int32(0); i < totalElements; i++ { + switch VT(vt) { + case VT_BOOL: + var v bool + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I1: + var v int8 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I2: + var v int16 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I4: + var v int32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_I8: + var v int64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI1: + var v uint8 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI2: + var v uint16 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI4: + var v uint32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_UI8: + var v uint64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_R4: + var v float32 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_R8: + var v float64 + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v + case VT_BSTR: + v , _ := safeArrayGetElementString(sac.Array, i) + values[i] = v + case VT_VARIANT: + var v VARIANT + safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) + values[i] = v.Value() + v.Clear() + default: + // TODO + } + } + + return +} + +func (sac *SafeArrayConversion) GetType() (varType uint16, err error) { + return safeArrayGetVartype(sac.Array) +} + +func (sac *SafeArrayConversion) GetDimensions() (dimensions *uint32, err error) { + return safeArrayGetDim(sac.Array) +} + +func (sac *SafeArrayConversion) GetSize() (length *uint32, err error) { + return safeArrayGetElementSize(sac.Array) +} + +func (sac *SafeArrayConversion) TotalElements(index uint32) (totalElements int32, err error) { + if index < 1 { + index = 1 + } + + // Get array bounds + var LowerBounds int32 + var UpperBounds int32 + + LowerBounds, err = safeArrayGetLBound(sac.Array, index) + if err != nil { + return + } + + UpperBounds, err = safeArrayGetUBound(sac.Array, index) + if err != nil { + return + } + + totalElements = UpperBounds - LowerBounds + 1 + return +} + +// Release Safe Array memory +func (sac *SafeArrayConversion) Release() { + safeArrayDestroy(sac.Array) +} diff --git a/vendor/github.com/go-ole/go-ole/safearrayslices.go b/vendor/github.com/go-ole/go-ole/safearrayslices.go new file mode 100644 index 00000000..a9fa885f --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/safearrayslices.go @@ -0,0 +1,33 @@ +// +build windows + +package ole + +import ( + "unsafe" +) + +func safeArrayFromByteSlice(slice []byte) *SafeArray { + array, _ := safeArrayCreateVector(VT_UI1, 0, uint32(len(slice))) + + if array == nil { + panic("Could not convert []byte to SAFEARRAY") + } + + for i, v := range slice { + safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(&v))) + } + return array +} + +func safeArrayFromStringSlice(slice []string) *SafeArray { + array, _ := safeArrayCreateVector(VT_BSTR, 0, uint32(len(slice))) + + if array == nil { + panic("Could not convert []string to SAFEARRAY") + } + // SysAllocStringLen(s) + for i, v := range slice { + safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(SysAllocStringLen(v)))) + } + return array +} diff --git a/vendor/github.com/go-ole/go-ole/utility.go b/vendor/github.com/go-ole/go-ole/utility.go new file mode 100644 index 00000000..99ee82dc --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/utility.go @@ -0,0 +1,101 @@ +package ole + +import ( + "unicode/utf16" + "unsafe" +) + +// ClassIDFrom retrieves class ID whether given is program ID or application string. +// +// Helper that provides check against both Class ID from Program ID and Class ID from string. It is +// faster, if you know which you are using, to use the individual functions, but this will check +// against available functions for you. +func ClassIDFrom(programID string) (classID *GUID, err error) { + classID, err = CLSIDFromProgID(programID) + if err != nil { + classID, err = CLSIDFromString(programID) + if err != nil { + return + } + } + return +} + +// BytePtrToString converts byte pointer to a Go string. +func BytePtrToString(p *byte) string { + a := (*[10000]uint8)(unsafe.Pointer(p)) + i := 0 + for a[i] != 0 { + i++ + } + return string(a[:i]) +} + +// UTF16PtrToString is alias for LpOleStrToString. +// +// Kept for compatibility reasons. +func UTF16PtrToString(p *uint16) string { + return LpOleStrToString(p) +} + +// LpOleStrToString converts COM Unicode to Go string. +func LpOleStrToString(p *uint16) string { + if p == nil { + return "" + } + + length := lpOleStrLen(p) + a := make([]uint16, length) + + ptr := unsafe.Pointer(p) + + for i := 0; i < int(length); i++ { + a[i] = *(*uint16)(ptr) + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + + return string(utf16.Decode(a)) +} + +// BstrToString converts COM binary string to Go string. +func BstrToString(p *uint16) string { + if p == nil { + return "" + } + length := SysStringLen((*int16)(unsafe.Pointer(p))) + a := make([]uint16, length) + + ptr := unsafe.Pointer(p) + + for i := 0; i < int(length); i++ { + a[i] = *(*uint16)(ptr) + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + return string(utf16.Decode(a)) +} + +// lpOleStrLen returns the length of Unicode string. +func lpOleStrLen(p *uint16) (length int64) { + if p == nil { + return 0 + } + + ptr := unsafe.Pointer(p) + + for i := 0; ; i++ { + if 0 == *(*uint16)(ptr) { + length = int64(i) + break + } + ptr = unsafe.Pointer(uintptr(ptr) + 2) + } + return +} + +// convertHresultToError converts syscall to error, if call is unsuccessful. +func convertHresultToError(hr uintptr, r2 uintptr, ignore error) (err error) { + if hr != 0 { + err = NewError(hr) + } + return +} diff --git a/vendor/github.com/go-ole/go-ole/variables.go b/vendor/github.com/go-ole/go-ole/variables.go new file mode 100644 index 00000000..a6add1b0 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variables.go @@ -0,0 +1,15 @@ +// +build windows + +package ole + +import ( + "golang.org/x/sys/windows" +) + +var ( + modcombase = windows.NewLazySystemDLL("combase.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + modole32 = windows.NewLazySystemDLL("ole32.dll") + modoleaut32 = windows.NewLazySystemDLL("oleaut32.dll") + moduser32 = windows.NewLazySystemDLL("user32.dll") +) diff --git a/vendor/github.com/go-ole/go-ole/variant.go b/vendor/github.com/go-ole/go-ole/variant.go new file mode 100644 index 00000000..967a23fe --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant.go @@ -0,0 +1,105 @@ +package ole + +import "unsafe" + +// NewVariant returns new variant based on type and value. +func NewVariant(vt VT, val int64) VARIANT { + return VARIANT{VT: vt, Val: val} +} + +// ToIUnknown converts Variant to Unknown object. +func (v *VARIANT) ToIUnknown() *IUnknown { + if v.VT != VT_UNKNOWN { + return nil + } + return (*IUnknown)(unsafe.Pointer(uintptr(v.Val))) +} + +// ToIDispatch converts variant to dispatch object. +func (v *VARIANT) ToIDispatch() *IDispatch { + if v.VT != VT_DISPATCH { + return nil + } + return (*IDispatch)(unsafe.Pointer(uintptr(v.Val))) +} + +// ToArray converts variant to SafeArray helper. +func (v *VARIANT) ToArray() *SafeArrayConversion { + if v.VT != VT_SAFEARRAY { + if v.VT&VT_ARRAY == 0 { + return nil + } + } + var safeArray *SafeArray = (*SafeArray)(unsafe.Pointer(uintptr(v.Val))) + return &SafeArrayConversion{safeArray} +} + +// ToString converts variant to Go string. +func (v *VARIANT) ToString() string { + if v.VT != VT_BSTR { + return "" + } + return BstrToString(*(**uint16)(unsafe.Pointer(&v.Val))) +} + +// Clear the memory of variant object. +func (v *VARIANT) Clear() error { + return VariantClear(v) +} + +// Value returns variant value based on its type. +// +// Currently supported types: 2- and 4-byte integers, strings, bools. +// Note that 64-bit integers, datetimes, and other types are stored as strings +// and will be returned as strings. +// +// Needs to be further converted, because this returns an interface{}. +func (v *VARIANT) Value() interface{} { + switch v.VT { + case VT_I1: + return int8(v.Val) + case VT_UI1: + return uint8(v.Val) + case VT_I2: + return int16(v.Val) + case VT_UI2: + return uint16(v.Val) + case VT_I4: + return int32(v.Val) + case VT_UI4: + return uint32(v.Val) + case VT_I8: + return int64(v.Val) + case VT_UI8: + return uint64(v.Val) + case VT_INT: + return int(v.Val) + case VT_UINT: + return uint(v.Val) + case VT_INT_PTR: + return uintptr(v.Val) // TODO + case VT_UINT_PTR: + return uintptr(v.Val) + case VT_R4: + return *(*float32)(unsafe.Pointer(&v.Val)) + case VT_R8: + return *(*float64)(unsafe.Pointer(&v.Val)) + case VT_BSTR: + return v.ToString() + case VT_DATE: + // VT_DATE type will either return float64 or time.Time. + d := uint64(v.Val) + date, err := GetVariantDate(d) + if err != nil { + return float64(v.Val) + } + return date + case VT_UNKNOWN: + return v.ToIUnknown() + case VT_DISPATCH: + return v.ToIDispatch() + case VT_BOOL: + return v.Val != 0 + } + return nil +} diff --git a/vendor/github.com/go-ole/go-ole/variant_386.go b/vendor/github.com/go-ole/go-ole/variant_386.go new file mode 100644 index 00000000..e73736bf --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_386.go @@ -0,0 +1,11 @@ +// +build 386 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_amd64.go b/vendor/github.com/go-ole/go-ole/variant_amd64.go new file mode 100644 index 00000000..dccdde13 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_amd64.go @@ -0,0 +1,12 @@ +// +build amd64 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_arm.go b/vendor/github.com/go-ole/go-ole/variant_arm.go new file mode 100644 index 00000000..d4724544 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_arm.go @@ -0,0 +1,11 @@ +// +build arm + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_arm64.go b/vendor/github.com/go-ole/go-ole/variant_arm64.go new file mode 100644 index 00000000..78473cec --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_arm64.go @@ -0,0 +1,13 @@ +//go:build arm64 +// +build arm64 + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_386.go b/vendor/github.com/go-ole/go-ole/variant_date_386.go new file mode 100644 index 00000000..1b970f63 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_386.go @@ -0,0 +1,22 @@ +// +build windows,386 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_amd64.go b/vendor/github.com/go-ole/go-ole/variant_date_amd64.go new file mode 100644 index 00000000..6952f1f0 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_amd64.go @@ -0,0 +1,20 @@ +// +build windows,amd64 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_arm.go b/vendor/github.com/go-ole/go-ole/variant_date_arm.go new file mode 100644 index 00000000..09ec7b5c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_arm.go @@ -0,0 +1,22 @@ +// +build windows,arm + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_date_arm64.go b/vendor/github.com/go-ole/go-ole/variant_date_arm64.go new file mode 100644 index 00000000..02b04a0d --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_date_arm64.go @@ -0,0 +1,23 @@ +//go:build windows && arm64 +// +build windows,arm64 + +package ole + +import ( + "errors" + "syscall" + "time" + "unsafe" +) + +// GetVariantDate converts COM Variant Time value to Go time.Time. +func GetVariantDate(value uint64) (time.Time, error) { + var st syscall.Systemtime + v1 := uint32(value) + v2 := uint32(value >> 32) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(v1), uintptr(v2), uintptr(unsafe.Pointer(&st))) + if r != 0 { + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil + } + return time.Now(), errors.New("Could not convert to time, passing current time.") +} diff --git a/vendor/github.com/go-ole/go-ole/variant_ppc64le.go b/vendor/github.com/go-ole/go-ole/variant_ppc64le.go new file mode 100644 index 00000000..326427a7 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_ppc64le.go @@ -0,0 +1,12 @@ +// +build ppc64le + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/variant_s390x.go b/vendor/github.com/go-ole/go-ole/variant_s390x.go new file mode 100644 index 00000000..9874ca66 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/variant_s390x.go @@ -0,0 +1,12 @@ +// +build s390x + +package ole + +type VARIANT struct { + VT VT // 2 + wReserved1 uint16 // 4 + wReserved2 uint16 // 6 + wReserved3 uint16 // 8 + Val int64 // 16 + _ [8]byte // 24 +} diff --git a/vendor/github.com/go-ole/go-ole/vt_string.go b/vendor/github.com/go-ole/go-ole/vt_string.go new file mode 100644 index 00000000..729b4a04 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/vt_string.go @@ -0,0 +1,58 @@ +// generated by stringer -output vt_string.go -type VT; DO NOT EDIT + +package ole + +import "fmt" + +const ( + _VT_name_0 = "VT_EMPTYVT_NULLVT_I2VT_I4VT_R4VT_R8VT_CYVT_DATEVT_BSTRVT_DISPATCHVT_ERRORVT_BOOLVT_VARIANTVT_UNKNOWNVT_DECIMAL" + _VT_name_1 = "VT_I1VT_UI1VT_UI2VT_UI4VT_I8VT_UI8VT_INTVT_UINTVT_VOIDVT_HRESULTVT_PTRVT_SAFEARRAYVT_CARRAYVT_USERDEFINEDVT_LPSTRVT_LPWSTR" + _VT_name_2 = "VT_RECORDVT_INT_PTRVT_UINT_PTR" + _VT_name_3 = "VT_FILETIMEVT_BLOBVT_STREAMVT_STORAGEVT_STREAMED_OBJECTVT_STORED_OBJECTVT_BLOB_OBJECTVT_CFVT_CLSID" + _VT_name_4 = "VT_BSTR_BLOBVT_VECTOR" + _VT_name_5 = "VT_ARRAY" + _VT_name_6 = "VT_BYREF" + _VT_name_7 = "VT_RESERVED" + _VT_name_8 = "VT_ILLEGAL" +) + +var ( + _VT_index_0 = [...]uint8{0, 8, 15, 20, 25, 30, 35, 40, 47, 54, 65, 73, 80, 90, 100, 110} + _VT_index_1 = [...]uint8{0, 5, 11, 17, 23, 28, 34, 40, 47, 54, 64, 70, 82, 91, 105, 113, 122} + _VT_index_2 = [...]uint8{0, 9, 19, 30} + _VT_index_3 = [...]uint8{0, 11, 18, 27, 37, 55, 71, 85, 90, 98} + _VT_index_4 = [...]uint8{0, 12, 21} + _VT_index_5 = [...]uint8{0, 8} + _VT_index_6 = [...]uint8{0, 8} + _VT_index_7 = [...]uint8{0, 11} + _VT_index_8 = [...]uint8{0, 10} +) + +func (i VT) String() string { + switch { + case 0 <= i && i <= 14: + return _VT_name_0[_VT_index_0[i]:_VT_index_0[i+1]] + case 16 <= i && i <= 31: + i -= 16 + return _VT_name_1[_VT_index_1[i]:_VT_index_1[i+1]] + case 36 <= i && i <= 38: + i -= 36 + return _VT_name_2[_VT_index_2[i]:_VT_index_2[i+1]] + case 64 <= i && i <= 72: + i -= 64 + return _VT_name_3[_VT_index_3[i]:_VT_index_3[i+1]] + case 4095 <= i && i <= 4096: + i -= 4095 + return _VT_name_4[_VT_index_4[i]:_VT_index_4[i+1]] + case i == 8192: + return _VT_name_5 + case i == 16384: + return _VT_name_6 + case i == 32768: + return _VT_name_7 + case i == 65535: + return _VT_name_8 + default: + return fmt.Sprintf("VT(%d)", i) + } +} diff --git a/vendor/github.com/go-ole/go-ole/winrt.go b/vendor/github.com/go-ole/go-ole/winrt.go new file mode 100644 index 00000000..4e9eca73 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/winrt.go @@ -0,0 +1,99 @@ +// +build windows + +package ole + +import ( + "reflect" + "syscall" + "unicode/utf8" + "unsafe" +) + +var ( + procRoInitialize = modcombase.NewProc("RoInitialize") + procRoActivateInstance = modcombase.NewProc("RoActivateInstance") + procRoGetActivationFactory = modcombase.NewProc("RoGetActivationFactory") + procWindowsCreateString = modcombase.NewProc("WindowsCreateString") + procWindowsDeleteString = modcombase.NewProc("WindowsDeleteString") + procWindowsGetStringRawBuffer = modcombase.NewProc("WindowsGetStringRawBuffer") +) + +func RoInitialize(thread_type uint32) (err error) { + hr, _, _ := procRoInitialize.Call(uintptr(thread_type)) + if hr != 0 { + err = NewError(hr) + } + return +} + +func RoActivateInstance(clsid string) (ins *IInspectable, err error) { + hClsid, err := NewHString(clsid) + if err != nil { + return nil, err + } + defer DeleteHString(hClsid) + + hr, _, _ := procRoActivateInstance.Call( + uintptr(unsafe.Pointer(hClsid)), + uintptr(unsafe.Pointer(&ins))) + if hr != 0 { + err = NewError(hr) + } + return +} + +func RoGetActivationFactory(clsid string, iid *GUID) (ins *IInspectable, err error) { + hClsid, err := NewHString(clsid) + if err != nil { + return nil, err + } + defer DeleteHString(hClsid) + + hr, _, _ := procRoGetActivationFactory.Call( + uintptr(unsafe.Pointer(hClsid)), + uintptr(unsafe.Pointer(iid)), + uintptr(unsafe.Pointer(&ins))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// HString is handle string for pointers. +type HString uintptr + +// NewHString returns a new HString for Go string. +func NewHString(s string) (hstring HString, err error) { + u16 := syscall.StringToUTF16Ptr(s) + len := uint32(utf8.RuneCountInString(s)) + hr, _, _ := procWindowsCreateString.Call( + uintptr(unsafe.Pointer(u16)), + uintptr(len), + uintptr(unsafe.Pointer(&hstring))) + if hr != 0 { + err = NewError(hr) + } + return +} + +// DeleteHString deletes HString. +func DeleteHString(hstring HString) (err error) { + hr, _, _ := procWindowsDeleteString.Call(uintptr(hstring)) + if hr != 0 { + err = NewError(hr) + } + return +} + +// String returns Go string value of HString. +func (h HString) String() string { + var u16buf uintptr + var u16len uint32 + u16buf, _, _ = procWindowsGetStringRawBuffer.Call( + uintptr(h), + uintptr(unsafe.Pointer(&u16len))) + + u16hdr := reflect.SliceHeader{Data: u16buf, Len: int(u16len), Cap: int(u16len)} + u16 := *(*[]uint16)(unsafe.Pointer(&u16hdr)) + return syscall.UTF16ToString(u16) +} diff --git a/vendor/github.com/go-ole/go-ole/winrt_doc.go b/vendor/github.com/go-ole/go-ole/winrt_doc.go new file mode 100644 index 00000000..52e6d74c --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/winrt_doc.go @@ -0,0 +1,36 @@ +// +build !windows + +package ole + +// RoInitialize +func RoInitialize(thread_type uint32) (err error) { + return NewError(E_NOTIMPL) +} + +// RoActivateInstance +func RoActivateInstance(clsid string) (ins *IInspectable, err error) { + return nil, NewError(E_NOTIMPL) +} + +// RoGetActivationFactory +func RoGetActivationFactory(clsid string, iid *GUID) (ins *IInspectable, err error) { + return nil, NewError(E_NOTIMPL) +} + +// HString is handle string for pointers. +type HString uintptr + +// NewHString returns a new HString for Go string. +func NewHString(s string) (hstring HString, err error) { + return HString(uintptr(0)), NewError(E_NOTIMPL) +} + +// DeleteHString deletes HString. +func DeleteHString(hstring HString) (err error) { + return NewError(E_NOTIMPL) +} + +// String returns Go string value of HString. +func (h HString) String() string { + return "" +} diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md index 213215c8..0c9bd9b1 100644 --- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md +++ b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md @@ -1,3 +1,45 @@ +## Version 1.8.1 (2024-03-26) + +Bugfixes: + +- fix race condition when context is canceled in [#1562](https://github.com/go-sql-driver/mysql/pull/1562) and [#1570](https://github.com/go-sql-driver/mysql/pull/1570) + +## Version 1.8.0 (2024-03-09) + +Major Changes: + +- Use `SET NAMES charset COLLATE collation`. by @methane in [#1437](https://github.com/go-sql-driver/mysql/pull/1437) + - Older go-mysql-driver used `collation_id` in the handshake packet. But it caused collation mismatch in some situation. + - If you don't specify charset nor collation, go-mysql-driver sends `SET NAMES utf8mb4` for new connection. This uses server's default collation for utf8mb4. + - If you specify charset, go-mysql-driver sends `SET NAMES `. This uses the server's default collation for ``. + - If you specify collation and/or charset, go-mysql-driver sends `SET NAMES charset COLLATE collation`. +- PathEscape dbname in DSN. by @methane in [#1432](https://github.com/go-sql-driver/mysql/pull/1432) + - This is backward incompatible in rare case. Check your DSN. +- Drop Go 1.13-17 support by @methane in [#1420](https://github.com/go-sql-driver/mysql/pull/1420) + - Use Go 1.18+ +- Parse numbers on text protocol too by @methane in [#1452](https://github.com/go-sql-driver/mysql/pull/1452) + - When text protocol is used, go-mysql-driver passed bare `[]byte` to database/sql for avoid unnecessary allocation and conversion. + - If user specified `*any` to `Scan()`, database/sql passed the `[]byte` into the target variable. + - This confused users because most user doesn't know when text/binary protocol used. + - go-mysql-driver 1.8 converts integer/float values into int64/double even in text protocol. This doesn't increase allocation compared to `[]byte` and conversion cost is negatable. +- New options start using the Functional Option Pattern to avoid increasing technical debt in the Config object. Future version may introduce Functional Option for existing options, but not for now. + - Make TimeTruncate functional option by @methane in [1552](https://github.com/go-sql-driver/mysql/pull/1552) + - Add BeforeConnect callback to configuration object by @ItalyPaleAle in [#1469](https://github.com/go-sql-driver/mysql/pull/1469) + + +Other changes: + +- Adding DeregisterDialContext to prevent memory leaks with dialers we don't need anymore by @jypelle in https://github.com/go-sql-driver/mysql/pull/1422 +- Make logger configurable per connection by @frozenbonito in https://github.com/go-sql-driver/mysql/pull/1408 +- Fix ColumnType.DatabaseTypeName for mediumint unsigned by @evanelias in https://github.com/go-sql-driver/mysql/pull/1428 +- Add connection attributes by @Daemonxiao in https://github.com/go-sql-driver/mysql/pull/1389 +- Stop `ColumnTypeScanType()` from returning `sql.RawBytes` by @methane in https://github.com/go-sql-driver/mysql/pull/1424 +- Exec() now provides access to status of multiple statements. by @mherr-google in https://github.com/go-sql-driver/mysql/pull/1309 +- Allow to change (or disable) the default driver name for registration by @dolmen in https://github.com/go-sql-driver/mysql/pull/1499 +- Add default connection attribute '_server_host' by @oblitorum in https://github.com/go-sql-driver/mysql/pull/1506 +- QueryUnescape DSN ConnectionAttribute value by @zhangyangyu in https://github.com/go-sql-driver/mysql/pull/1470 +- Add client_ed25519 authentication by @Gusted in https://github.com/go-sql-driver/mysql/pull/1518 + ## Version 1.7.1 (2023-04-25) Changes: diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md index 9d0d806e..4968cb06 100644 --- a/vendor/github.com/go-sql-driver/mysql/README.md +++ b/vendor/github.com/go-sql-driver/mysql/README.md @@ -326,7 +326,7 @@ It's possible to access the last inserted ID and number of affected rows for mul ```go conn, _ := db.Conn(ctx) -conn.Raw(func(conn interface{}) error { +conn.Raw(func(conn any) error { ex := conn.(driver.Execer) res, err := ex.Exec(` UPDATE point SET x = 1 WHERE y = 2; diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go index 658259b2..74e1bd03 100644 --- a/vendor/github.com/go-sql-driver/mysql/auth.go +++ b/vendor/github.com/go-sql-driver/mysql/auth.go @@ -338,7 +338,7 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) { return authEd25519(authData, mc.cfg.Passwd) default: - mc.cfg.Logger.Print("unknown auth plugin:", plugin) + mc.log("unknown auth plugin:", plugin) return nil, ErrUnknownPlugin } } diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go index c170114f..eff978d9 100644 --- a/vendor/github.com/go-sql-driver/mysql/connection.go +++ b/vendor/github.com/go-sql-driver/mysql/connection.go @@ -44,6 +44,11 @@ type mysqlConn struct { closed atomicBool // set when conn is closed, before closech is closed } +// Helper function to call per-connection logger. +func (mc *mysqlConn) log(v ...any) { + mc.cfg.Logger.Print(v...) +} + // Handles parameters set in DSN after the connection is established func (mc *mysqlConn) handleParams() (err error) { var cmdSet strings.Builder @@ -109,7 +114,7 @@ func (mc *mysqlConn) Begin() (driver.Tx, error) { func (mc *mysqlConn) begin(readOnly bool) (driver.Tx, error) { if mc.closed.Load() { - mc.cfg.Logger.Print(ErrInvalidConn) + mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } var q string @@ -132,7 +137,7 @@ func (mc *mysqlConn) Close() (err error) { } mc.cleanup() - + mc.clearResult() return } @@ -147,13 +152,16 @@ func (mc *mysqlConn) cleanup() { // Makes cleanup idempotent close(mc.closech) - if mc.netConn == nil { + conn := mc.rawConn + if conn == nil { return } - if err := mc.netConn.Close(); err != nil { - mc.cfg.Logger.Print(err) + if err := conn.Close(); err != nil { + mc.log(err) } - mc.clearResult() + // This function can be called from multiple goroutines. + // So we can not mc.clearResult() here. + // Caller should do it if they are in safe goroutine. } func (mc *mysqlConn) error() error { @@ -168,14 +176,14 @@ func (mc *mysqlConn) error() error { func (mc *mysqlConn) Prepare(query string) (driver.Stmt, error) { if mc.closed.Load() { - mc.cfg.Logger.Print(ErrInvalidConn) + mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } // Send command err := mc.writeCommandPacketStr(comStmtPrepare, query) if err != nil { // STMT_PREPARE is safe to retry. So we can return ErrBadConn here. - mc.cfg.Logger.Print(err) + mc.log(err) return nil, driver.ErrBadConn } @@ -209,7 +217,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin buf, err := mc.buf.takeCompleteBuffer() if err != nil { // can not take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return "", ErrInvalidConn } buf = buf[:0] @@ -301,7 +309,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, error) { if mc.closed.Load() { - mc.cfg.Logger.Print(ErrInvalidConn) + mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } if len(args) != 0 { @@ -361,7 +369,7 @@ func (mc *mysqlConn) query(query string, args []driver.Value) (*textRows, error) handleOk := mc.clearResult() if mc.closed.Load() { - mc.cfg.Logger.Print(ErrInvalidConn) + mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } if len(args) != 0 { @@ -456,7 +464,7 @@ func (mc *mysqlConn) finish() { // Ping implements driver.Pinger interface func (mc *mysqlConn) Ping(ctx context.Context) (err error) { if mc.closed.Load() { - mc.cfg.Logger.Print(ErrInvalidConn) + mc.log(ErrInvalidConn) return driver.ErrBadConn } @@ -665,7 +673,7 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error { err = connCheck(conn) } if err != nil { - mc.cfg.Logger.Print("closing bad idle connection: ", err) + mc.log("closing bad idle connection: ", err) return driver.ErrBadConn } } diff --git a/vendor/github.com/go-sql-driver/mysql/connector.go b/vendor/github.com/go-sql-driver/mysql/connector.go index a0ee6283..b6707759 100644 --- a/vendor/github.com/go-sql-driver/mysql/connector.go +++ b/vendor/github.com/go-sql-driver/mysql/connector.go @@ -102,10 +102,10 @@ func (c *connector) Connect(ctx context.Context) (driver.Conn, error) { nd := net.Dialer{Timeout: mc.cfg.Timeout} mc.netConn, err = nd.DialContext(ctx, mc.cfg.Net, mc.cfg.Addr) } - if err != nil { return nil, err } + mc.rawConn = mc.netConn // Enable TCP Keepalives on TCP connections if tc, ok := mc.netConn.(*net.TCPConn); ok { diff --git a/vendor/github.com/go-sql-driver/mysql/errors.go b/vendor/github.com/go-sql-driver/mysql/errors.go index a9a3060c..a7ef8890 100644 --- a/vendor/github.com/go-sql-driver/mysql/errors.go +++ b/vendor/github.com/go-sql-driver/mysql/errors.go @@ -41,14 +41,14 @@ var defaultLogger = Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime|lo // Logger is used to log critical error messages. type Logger interface { - Print(v ...interface{}) + Print(v ...any) } // NopLogger is a nop implementation of the Logger interface. type NopLogger struct{} // Print implements Logger interface. -func (nl *NopLogger) Print(_ ...interface{}) {} +func (nl *NopLogger) Print(_ ...any) {} // SetLogger is used to set the default logger for critical errors. // The initial logger is os.Stderr. diff --git a/vendor/github.com/go-sql-driver/mysql/fields.go b/vendor/github.com/go-sql-driver/mysql/fields.go index 2a397b24..28608424 100644 --- a/vendor/github.com/go-sql-driver/mysql/fields.go +++ b/vendor/github.com/go-sql-driver/mysql/fields.go @@ -134,7 +134,7 @@ var ( scanTypeString = reflect.TypeOf("") scanTypeNullString = reflect.TypeOf(sql.NullString{}) scanTypeBytes = reflect.TypeOf([]byte{}) - scanTypeUnknown = reflect.TypeOf(new(interface{})) + scanTypeUnknown = reflect.TypeOf(new(any)) ) type mysqlField struct { diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime.go b/vendor/github.com/go-sql-driver/mysql/nulltime.go index 7d381d5c..316a48aa 100644 --- a/vendor/github.com/go-sql-driver/mysql/nulltime.go +++ b/vendor/github.com/go-sql-driver/mysql/nulltime.go @@ -38,7 +38,7 @@ type NullTime sql.NullTime // Scan implements the Scanner interface. // The value type must be time.Time or string / []byte (formatted time-string), // otherwise Scan fails. -func (nt *NullTime) Scan(value interface{}) (err error) { +func (nt *NullTime) Scan(value any) (err error) { if value == nil { nt.Time, nt.Valid = time.Time{}, false return diff --git a/vendor/github.com/go-sql-driver/mysql/packets.go b/vendor/github.com/go-sql-driver/mysql/packets.go index 3d6e5308..90a34728 100644 --- a/vendor/github.com/go-sql-driver/mysql/packets.go +++ b/vendor/github.com/go-sql-driver/mysql/packets.go @@ -34,7 +34,7 @@ func (mc *mysqlConn) readPacket() ([]byte, error) { if cerr := mc.canceled.Value(); cerr != nil { return nil, cerr } - mc.cfg.Logger.Print(err) + mc.log(err) mc.Close() return nil, ErrInvalidConn } @@ -57,7 +57,7 @@ func (mc *mysqlConn) readPacket() ([]byte, error) { if pktLen == 0 { // there was no previous packet if prevData == nil { - mc.cfg.Logger.Print(ErrMalformPkt) + mc.log(ErrMalformPkt) mc.Close() return nil, ErrInvalidConn } @@ -71,7 +71,7 @@ func (mc *mysqlConn) readPacket() ([]byte, error) { if cerr := mc.canceled.Value(); cerr != nil { return nil, cerr } - mc.cfg.Logger.Print(err) + mc.log(err) mc.Close() return nil, ErrInvalidConn } @@ -134,7 +134,7 @@ func (mc *mysqlConn) writePacket(data []byte) error { // Handle error if err == nil { // n != len(data) mc.cleanup() - mc.cfg.Logger.Print(ErrMalformPkt) + mc.log(ErrMalformPkt) } else { if cerr := mc.canceled.Value(); cerr != nil { return cerr @@ -144,7 +144,7 @@ func (mc *mysqlConn) writePacket(data []byte) error { return errBadConnNoWrite } mc.cleanup() - mc.cfg.Logger.Print(err) + mc.log(err) } return ErrInvalidConn } @@ -302,7 +302,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string data, err := mc.buf.takeBuffer(pktLen + 4) if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -351,7 +351,6 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string if err := tlsConn.Handshake(); err != nil { return err } - mc.rawConn = mc.netConn mc.netConn = tlsConn mc.buf.nc = tlsConn } @@ -392,7 +391,7 @@ func (mc *mysqlConn) writeAuthSwitchPacket(authData []byte) error { data, err := mc.buf.takeSmallBuffer(pktLen) if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -412,7 +411,7 @@ func (mc *mysqlConn) writeCommandPacket(command byte) error { data, err := mc.buf.takeSmallBuffer(4 + 1) if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -431,7 +430,7 @@ func (mc *mysqlConn) writeCommandPacketStr(command byte, arg string) error { data, err := mc.buf.takeBuffer(pktLen + 4) if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -452,7 +451,7 @@ func (mc *mysqlConn) writeCommandPacketUint32(command byte, arg uint32) error { data, err := mc.buf.takeSmallBuffer(4 + 1 + 4) if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -994,7 +993,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error { } if err != nil { // cannot take the buffer. Something must be wrong with the connection - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } @@ -1193,7 +1192,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error { if valuesCap != cap(paramValues) { data = append(data[:pos], paramValues...) if err = mc.buf.store(data); err != nil { - mc.cfg.Logger.Print(err) + mc.log(err) return errBadConnNoWrite } } diff --git a/vendor/github.com/go-sql-driver/mysql/statement.go b/vendor/github.com/go-sql-driver/mysql/statement.go index 31e7799c..0436f224 100644 --- a/vendor/github.com/go-sql-driver/mysql/statement.go +++ b/vendor/github.com/go-sql-driver/mysql/statement.go @@ -51,7 +51,7 @@ func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) { func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) { if stmt.mc.closed.Load() { - stmt.mc.cfg.Logger.Print(ErrInvalidConn) + stmt.mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } // Send command @@ -95,7 +95,7 @@ func (stmt *mysqlStmt) Query(args []driver.Value) (driver.Rows, error) { func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) { if stmt.mc.closed.Load() { - stmt.mc.cfg.Logger.Print(ErrInvalidConn) + stmt.mc.log(ErrInvalidConn) return nil, driver.ErrBadConn } // Send command @@ -141,7 +141,7 @@ type converter struct{} // implementation does not. This function should be kept in sync with // database/sql/driver defaultConverter.ConvertValue() except for that // deliberate difference. -func (c converter) ConvertValue(v interface{}) (driver.Value, error) { +func (c converter) ConvertValue(v any) (driver.Value, error) { if driver.IsValue(v) { return v, nil } diff --git a/vendor/github.com/hashicorp/vault/api/lifetime_watcher.go b/vendor/github.com/hashicorp/vault/api/lifetime_watcher.go index 5c060e5a..7070445c 100644 --- a/vendor/github.com/hashicorp/vault/api/lifetime_watcher.go +++ b/vendor/github.com/hashicorp/vault/api/lifetime_watcher.go @@ -31,6 +31,7 @@ var ( DefaultRenewerRenewBuffer = 5 ) +//go:generate enumer -type=RenewBehavior -trimprefix=RenewBehavior type RenewBehavior uint const ( @@ -349,8 +350,11 @@ func (r *LifetimeWatcher) doRenewWithOptions(tokenMode bool, nonRenewable bool, if errorBackoff == nil { sleepDuration = r.calculateSleepDuration(remainingLeaseDuration, priorDuration) - } else if errorBackoff.NextBackOff() == backoff.Stop { - return err + } else { + sleepDuration = errorBackoff.NextBackOff() + if sleepDuration == backoff.Stop { + return err + } } // remainingLeaseDuration becomes the priorDuration for the next loop diff --git a/vendor/github.com/hashicorp/vault/api/plugin_helpers.go b/vendor/github.com/hashicorp/vault/api/plugin_helpers.go index 5d259366..d330478f 100644 --- a/vendor/github.com/hashicorp/vault/api/plugin_helpers.go +++ b/vendor/github.com/hashicorp/vault/api/plugin_helpers.go @@ -13,7 +13,8 @@ import ( "net/url" "os" - "github.com/go-jose/go-jose/v3/jwt" + jose "github.com/go-jose/go-jose/v4" + "github.com/go-jose/go-jose/v4/jwt" "github.com/hashicorp/errwrap" ) @@ -40,6 +41,11 @@ const ( // PluginUnwrapTokenEnv is the ENV name used to pass unwrap tokens to the // plugin. PluginUnwrapTokenEnv = "VAULT_UNWRAP_TOKEN" + + // CubbyHoleJWTSignatureAlgorithm is the signature algorithm used for + // the unwrap token that Vault passes to a plugin when auto-mTLS is + // not enabled. + CubbyHoleJWTSignatureAlgorithm = jose.ES512 ) // PluginAPIClientMeta is a helper that plugins can use to configure TLS connections @@ -102,7 +108,7 @@ func VaultPluginTLSProviderContext(ctx context.Context, apiTLSConfig *TLSConfig) return func() (*tls.Config, error) { unwrapToken := os.Getenv(PluginUnwrapTokenEnv) - parsedJWT, err := jwt.ParseSigned(unwrapToken) + parsedJWT, err := jwt.ParseSigned(unwrapToken, []jose.SignatureAlgorithm{CubbyHoleJWTSignatureAlgorithm}) if err != nil { return nil, errwrap.Wrapf("error parsing wrapping token: {{err}}", err) } diff --git a/vendor/github.com/hashicorp/vault/api/plugin_runtime_types.go b/vendor/github.com/hashicorp/vault/api/plugin_runtime_types.go index d3acd0d0..2514f127 100644 --- a/vendor/github.com/hashicorp/vault/api/plugin_runtime_types.go +++ b/vendor/github.com/hashicorp/vault/api/plugin_runtime_types.go @@ -9,11 +9,9 @@ package api import "fmt" -var PluginRuntimeTypes = []PluginRuntimeType{ - PluginRuntimeTypeUnsupported, - PluginRuntimeTypeContainer, -} +var PluginRuntimeTypes = _PluginRuntimeTypeValues +//go:generate enumer -type=PluginRuntimeType -trimprefix=PluginRuntimeType -transform=snake type PluginRuntimeType uint32 // This is a list of PluginRuntimeTypes used by Vault. @@ -22,20 +20,11 @@ const ( PluginRuntimeTypeContainer ) -func (r PluginRuntimeType) String() string { - switch r { - case PluginRuntimeTypeContainer: - return "container" - default: - return "unsupported" - } -} - +// ParsePluginRuntimeType is a wrapper around PluginRuntimeTypeString kept for backwards compatibility. func ParsePluginRuntimeType(PluginRuntimeType string) (PluginRuntimeType, error) { - switch PluginRuntimeType { - case "container": - return PluginRuntimeTypeContainer, nil - default: + t, err := PluginRuntimeTypeString(PluginRuntimeType) + if err != nil { return PluginRuntimeTypeUnsupported, fmt.Errorf("%q is not a supported plugin runtime type", PluginRuntimeType) } + return t, nil } diff --git a/vendor/github.com/hashicorp/vault/api/pluginruntimetype_enumer.go b/vendor/github.com/hashicorp/vault/api/pluginruntimetype_enumer.go new file mode 100644 index 00000000..663f440f --- /dev/null +++ b/vendor/github.com/hashicorp/vault/api/pluginruntimetype_enumer.go @@ -0,0 +1,49 @@ +// Code generated by "enumer -type=PluginRuntimeType -trimprefix=PluginRuntimeType -transform=snake"; DO NOT EDIT. + +package api + +import ( + "fmt" +) + +const _PluginRuntimeTypeName = "unsupportedcontainer" + +var _PluginRuntimeTypeIndex = [...]uint8{0, 11, 20} + +func (i PluginRuntimeType) String() string { + if i >= PluginRuntimeType(len(_PluginRuntimeTypeIndex)-1) { + return fmt.Sprintf("PluginRuntimeType(%d)", i) + } + return _PluginRuntimeTypeName[_PluginRuntimeTypeIndex[i]:_PluginRuntimeTypeIndex[i+1]] +} + +var _PluginRuntimeTypeValues = []PluginRuntimeType{0, 1} + +var _PluginRuntimeTypeNameToValueMap = map[string]PluginRuntimeType{ + _PluginRuntimeTypeName[0:11]: 0, + _PluginRuntimeTypeName[11:20]: 1, +} + +// PluginRuntimeTypeString retrieves an enum value from the enum constants string name. +// Throws an error if the param is not part of the enum. +func PluginRuntimeTypeString(s string) (PluginRuntimeType, error) { + if val, ok := _PluginRuntimeTypeNameToValueMap[s]; ok { + return val, nil + } + return 0, fmt.Errorf("%s does not belong to PluginRuntimeType values", s) +} + +// PluginRuntimeTypeValues returns all values of the enum +func PluginRuntimeTypeValues() []PluginRuntimeType { + return _PluginRuntimeTypeValues +} + +// IsAPluginRuntimeType returns "true" if the value is listed in the enum definition. "false" otherwise +func (i PluginRuntimeType) IsAPluginRuntimeType() bool { + for _, v := range _PluginRuntimeTypeValues { + if i == v { + return true + } + } + return false +} diff --git a/vendor/github.com/hashicorp/vault/api/renewbehavior_enumer.go b/vendor/github.com/hashicorp/vault/api/renewbehavior_enumer.go new file mode 100644 index 00000000..9b272e3e --- /dev/null +++ b/vendor/github.com/hashicorp/vault/api/renewbehavior_enumer.go @@ -0,0 +1,50 @@ +// Code generated by "enumer -type=RenewBehavior -trimprefix=RenewBehavior"; DO NOT EDIT. + +package api + +import ( + "fmt" +) + +const _RenewBehaviorName = "IgnoreErrorsRenewDisabledErrorOnErrors" + +var _RenewBehaviorIndex = [...]uint8{0, 12, 25, 38} + +func (i RenewBehavior) String() string { + if i >= RenewBehavior(len(_RenewBehaviorIndex)-1) { + return fmt.Sprintf("RenewBehavior(%d)", i) + } + return _RenewBehaviorName[_RenewBehaviorIndex[i]:_RenewBehaviorIndex[i+1]] +} + +var _RenewBehaviorValues = []RenewBehavior{0, 1, 2} + +var _RenewBehaviorNameToValueMap = map[string]RenewBehavior{ + _RenewBehaviorName[0:12]: 0, + _RenewBehaviorName[12:25]: 1, + _RenewBehaviorName[25:38]: 2, +} + +// RenewBehaviorString retrieves an enum value from the enum constants string name. +// Throws an error if the param is not part of the enum. +func RenewBehaviorString(s string) (RenewBehavior, error) { + if val, ok := _RenewBehaviorNameToValueMap[s]; ok { + return val, nil + } + return 0, fmt.Errorf("%s does not belong to RenewBehavior values", s) +} + +// RenewBehaviorValues returns all values of the enum +func RenewBehaviorValues() []RenewBehavior { + return _RenewBehaviorValues +} + +// IsARenewBehavior returns "true" if the value is listed in the enum definition. "false" otherwise +func (i RenewBehavior) IsARenewBehavior() bool { + for _, v := range _RenewBehaviorValues { + if i == v { + return true + } + } + return false +} diff --git a/vendor/github.com/hashicorp/vault/api/replication_status.go b/vendor/github.com/hashicorp/vault/api/replication_status.go index 9bc02d53..d7224ff1 100644 --- a/vendor/github.com/hashicorp/vault/api/replication_status.go +++ b/vendor/github.com/hashicorp/vault/api/replication_status.go @@ -19,13 +19,14 @@ const ( ) type ClusterInfo struct { - APIAddr string `json:"api_address,omitempty" mapstructure:"api_address"` - ClusterAddress string `json:"cluster_address,omitempty" mapstructure:"cluster_address"` - ConnectionStatus string `json:"connection_status,omitempty" mapstructure:"connection_status"` - LastHeartBeat string `json:"last_heartbeat,omitempty" mapstructure:"last_heartbeat"` - LastHeartBeatDurationMillis string `json:"last_heartbeat_duration_ms,omitempty" mapstructure:"last_heartbeat_duration_ms"` - ClockSkewMillis string `json:"clock_skew_ms,omitempty" mapstructure:"clock_skew_ms"` - NodeID string `json:"node_id,omitempty" mapstructure:"node_id"` + APIAddr string `json:"api_address,omitempty" mapstructure:"api_address"` + ClusterAddress string `json:"cluster_address,omitempty" mapstructure:"cluster_address"` + ConnectionStatus string `json:"connection_status,omitempty" mapstructure:"connection_status"` + LastHeartBeat string `json:"last_heartbeat,omitempty" mapstructure:"last_heartbeat"` + LastHeartBeatDurationMillis string `json:"last_heartbeat_duration_ms,omitempty" mapstructure:"last_heartbeat_duration_ms"` + ClockSkewMillis string `json:"clock_skew_ms,omitempty" mapstructure:"clock_skew_ms"` + NodeID string `json:"node_id,omitempty" mapstructure:"node_id"` + ReplicationPrimaryCanaryAgeMillis string `json:"replication_primary_canary_age_ms,omitempty" mapstructure:"replication_primary_canary_age_ms"` } type ReplicationStatusGenericResponse struct { diff --git a/vendor/github.com/hashicorp/vault/api/sys_hastatus.go b/vendor/github.com/hashicorp/vault/api/sys_hastatus.go index 58a73b89..2e54651e 100644 --- a/vendor/github.com/hashicorp/vault/api/sys_hastatus.go +++ b/vendor/github.com/hashicorp/vault/api/sys_hastatus.go @@ -35,14 +35,15 @@ type HAStatusResponse struct { } type HANode struct { - Hostname string `json:"hostname"` - APIAddress string `json:"api_address"` - ClusterAddress string `json:"cluster_address"` - ActiveNode bool `json:"active_node"` - LastEcho *time.Time `json:"last_echo"` - EchoDurationMillis int64 `json:"echo_duration_ms"` - ClockSkewMillis int64 `json:"clock_skew_ms"` - Version string `json:"version"` - UpgradeVersion string `json:"upgrade_version,omitempty"` - RedundancyZone string `json:"redundancy_zone,omitempty"` + Hostname string `json:"hostname"` + APIAddress string `json:"api_address"` + ClusterAddress string `json:"cluster_address"` + ActiveNode bool `json:"active_node"` + LastEcho *time.Time `json:"last_echo"` + EchoDurationMillis int64 `json:"echo_duration_ms"` + ClockSkewMillis int64 `json:"clock_skew_ms"` + Version string `json:"version"` + UpgradeVersion string `json:"upgrade_version,omitempty"` + RedundancyZone string `json:"redundancy_zone,omitempty"` + ReplicationPrimaryCanaryAgeMillis int64 `json:"replication_primary_canary_age_ms"` } diff --git a/vendor/github.com/hashicorp/vault/api/sys_health.go b/vendor/github.com/hashicorp/vault/api/sys_health.go index 0dc84988..6868b96d 100644 --- a/vendor/github.com/hashicorp/vault/api/sys_health.go +++ b/vendor/github.com/hashicorp/vault/api/sys_health.go @@ -38,18 +38,19 @@ func (c *Sys) HealthWithContext(ctx context.Context) (*HealthResponse, error) { } type HealthResponse struct { - Initialized bool `json:"initialized"` - Sealed bool `json:"sealed"` - Standby bool `json:"standby"` - PerformanceStandby bool `json:"performance_standby"` - ReplicationPerformanceMode string `json:"replication_performance_mode"` - ReplicationDRMode string `json:"replication_dr_mode"` - ServerTimeUTC int64 `json:"server_time_utc"` - Version string `json:"version"` - ClusterName string `json:"cluster_name,omitempty"` - ClusterID string `json:"cluster_id,omitempty"` - LastWAL uint64 `json:"last_wal,omitempty"` - Enterprise bool `json:"enterprise"` - EchoDurationMillis int64 `json:"echo_duration_ms"` - ClockSkewMillis int64 `json:"clock_skew_ms"` + Initialized bool `json:"initialized"` + Sealed bool `json:"sealed"` + Standby bool `json:"standby"` + PerformanceStandby bool `json:"performance_standby"` + ReplicationPerformanceMode string `json:"replication_performance_mode"` + ReplicationDRMode string `json:"replication_dr_mode"` + ServerTimeUTC int64 `json:"server_time_utc"` + Version string `json:"version"` + ClusterName string `json:"cluster_name,omitempty"` + ClusterID string `json:"cluster_id,omitempty"` + LastWAL uint64 `json:"last_wal,omitempty"` + Enterprise bool `json:"enterprise"` + EchoDurationMillis int64 `json:"echo_duration_ms"` + ClockSkewMillis int64 `json:"clock_skew_ms"` + ReplicationPrimaryCanaryAgeMillis int64 `json:"replication_primary_canary_age_ms"` } diff --git a/vendor/github.com/hashicorp/vault/api/sys_raft.go b/vendor/github.com/hashicorp/vault/api/sys_raft.go index 4b9487c6..699f6e9f 100644 --- a/vendor/github.com/hashicorp/vault/api/sys_raft.go +++ b/vendor/github.com/hashicorp/vault/api/sys_raft.go @@ -9,6 +9,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "io" "io/ioutil" "net/http" @@ -100,6 +101,23 @@ type AutopilotState struct { OptimisticFailureTolerance int `mapstructure:"optimistic_failure_tolerance,omitempty"` } +func (a *AutopilotState) String() string { + var result string + result += fmt.Sprintf("Healthy: %t. FailureTolerance: %d. Leader: %s. OptimisticFailureTolerance: %d\n", a.Healthy, a.FailureTolerance, a.Leader, a.OptimisticFailureTolerance) + for _, s := range a.Servers { + result += fmt.Sprintf("Server: %s\n", s) + } + result += fmt.Sprintf("Voters: %v\n", a.Voters) + result += fmt.Sprintf("NonVoters: %v\n", a.NonVoters) + + for name, zone := range a.RedundancyZones { + result += fmt.Sprintf("RedundancyZone %s: %s\n", name, &zone) + } + + result += fmt.Sprintf("Upgrade: %s", a.Upgrade) + return result +} + // AutopilotServer represents the server blocks in the response of the raft // autopilot state API. type AutopilotServer struct { @@ -119,12 +137,21 @@ type AutopilotServer struct { NodeType string `mapstructure:"node_type,omitempty"` } +func (a *AutopilotServer) String() string { + return fmt.Sprintf("ID: %s. Name: %s. Address: %s. NodeStatus: %s. LastContact: %s. LastTerm: %d. LastIndex: %d. Healthy: %t. StableSince: %s. Status: %s. Version: %s. UpgradeVersion: %s. RedundancyZone: %s. NodeType: %s", + a.ID, a.Name, a.Address, a.NodeStatus, a.LastContact, a.LastTerm, a.LastIndex, a.Healthy, a.StableSince, a.Status, a.Version, a.UpgradeVersion, a.RedundancyZone, a.NodeType) +} + type AutopilotZone struct { Servers []string `mapstructure:"servers,omitempty"` Voters []string `mapstructure:"voters,omitempty"` FailureTolerance int `mapstructure:"failure_tolerance,omitempty"` } +func (a *AutopilotZone) String() string { + return fmt.Sprintf("Servers: %v. Voters: %v. FailureTolerance: %d", a.Servers, a.Voters, a.FailureTolerance) +} + type AutopilotUpgrade struct { Status string `mapstructure:"status"` TargetVersion string `mapstructure:"target_version,omitempty"` @@ -137,6 +164,17 @@ type AutopilotUpgrade struct { RedundancyZones map[string]AutopilotZoneUpgradeVersions `mapstructure:"redundancy_zones,omitempty"` } +func (a *AutopilotUpgrade) String() string { + result := fmt.Sprintf("Status: %s. TargetVersion: %s. TargetVersionVoters: %v. TargetVersionNonVoters: %v. TargetVersionReadReplicas: %v. OtherVersionVoters: %v. OtherVersionNonVoters: %v. OtherVersionReadReplicas: %v", + a.Status, a.TargetVersion, a.TargetVersionVoters, a.TargetVersionNonVoters, a.TargetVersionReadReplicas, a.OtherVersionVoters, a.OtherVersionNonVoters, a.OtherVersionReadReplicas) + + for name, zone := range a.RedundancyZones { + result += fmt.Sprintf("Redundancy Zone %s: %s", name, zone) + } + + return result +} + type AutopilotZoneUpgradeVersions struct { TargetVersionVoters []string `mapstructure:"target_version_voters,omitempty"` TargetVersionNonVoters []string `mapstructure:"target_version_non_voters,omitempty"` @@ -144,6 +182,11 @@ type AutopilotZoneUpgradeVersions struct { OtherVersionNonVoters []string `mapstructure:"other_version_non_voters,omitempty"` } +func (a *AutopilotZoneUpgradeVersions) String() string { + return fmt.Sprintf("TargetVersionVoters: %v. TargetVersionNonVoters: %v. OtherVersionVoters: %v. OtherVersionNonVoters: %v", + a.TargetVersionVoters, a.TargetVersionNonVoters, a.OtherVersionVoters, a.OtherVersionNonVoters) +} + // RaftJoin wraps RaftJoinWithContext using context.Background. func (c *Sys) RaftJoin(opts *RaftJoinRequest) (*RaftJoinResponse, error) { return c.RaftJoinWithContext(context.Background(), opts) diff --git a/vendor/github.com/lufia/plan9stats/.gitignore b/vendor/github.com/lufia/plan9stats/.gitignore new file mode 100644 index 00000000..f1c181ec --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/.gitignore @@ -0,0 +1,12 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/vendor/github.com/lufia/plan9stats/LICENSE b/vendor/github.com/lufia/plan9stats/LICENSE new file mode 100644 index 00000000..a6d47e80 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, KADOTA, Kyohei +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/lufia/plan9stats/README.md b/vendor/github.com/lufia/plan9stats/README.md new file mode 100644 index 00000000..a21700c0 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/README.md @@ -0,0 +1,2 @@ +# plan9stats +A module for retrieving statistics of Plan 9 diff --git a/vendor/github.com/lufia/plan9stats/cpu.go b/vendor/github.com/lufia/plan9stats/cpu.go new file mode 100644 index 00000000..a101b911 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/cpu.go @@ -0,0 +1,288 @@ +package stats + +import ( + "bufio" + "bytes" + "context" + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + "time" +) + +// CPUType represents /dev/cputype. +type CPUType struct { + Name string + Clock int // clock rate in MHz +} + +func ReadCPUType(ctx context.Context, opts ...Option) (*CPUType, error) { + cfg := newConfig(opts...) + var c CPUType + if err := readCPUType(cfg.rootdir, &c); err != nil { + return nil, err + } + return &c, nil +} + +type SysStats struct { + ID int + NumCtxSwitch int64 + NumInterrupt int64 + NumSyscall int64 + NumFault int64 + NumTLBFault int64 + NumTLBPurge int64 + LoadAvg int64 // in units of milli-CPUs and is decayed over time + Idle int // percentage + Interrupt int // percentage +} + +// ReadSysStats reads system statistics from /dev/sysstat. +func ReadSysStats(ctx context.Context, opts ...Option) ([]*SysStats, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "/dev/sysstat") + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + scanner := bufio.NewScanner(f) + var stats []*SysStats + for scanner.Scan() { + a := strings.Fields(scanner.Text()) + if len(a) != 10 { + continue + } + var ( + p intParser + stat SysStats + ) + stat.ID = p.ParseInt(a[0], 10) + stat.NumCtxSwitch = p.ParseInt64(a[1], 10) + stat.NumInterrupt = p.ParseInt64(a[2], 10) + stat.NumSyscall = p.ParseInt64(a[3], 10) + stat.NumFault = p.ParseInt64(a[4], 10) + stat.NumTLBFault = p.ParseInt64(a[5], 10) + stat.NumTLBPurge = p.ParseInt64(a[6], 10) + stat.LoadAvg = p.ParseInt64(a[7], 10) + stat.Idle = p.ParseInt(a[8], 10) + stat.Interrupt = p.ParseInt(a[9], 10) + if err := p.Err(); err != nil { + return nil, err + } + stats = append(stats, &stat) + } + if err := scanner.Err(); err != nil { + return nil, err + } + return stats, nil +} + +func readCPUType(rootdir string, c *CPUType) error { + file := filepath.Join(rootdir, "/dev/cputype") + b, err := ioutil.ReadFile(file) + if err != nil { + return err + } + b = bytes.TrimSpace(b) + i := bytes.LastIndexByte(b, ' ') + if i < 0 { + return fmt.Errorf("%s: invalid format", file) + } + clock, err := strconv.Atoi(string(b[i+1:])) + if err != nil { + return err + } + c.Name = string(b[:i]) + c.Clock = clock + return nil +} + +// Time represents /dev/time. +type Time struct { + Unix time.Duration + UnixNano time.Duration + Ticks int64 // clock ticks + Freq int64 //cloc frequency +} + +// Uptime returns uptime. +func (t *Time) Uptime() time.Duration { + v := float64(t.Ticks) / float64(t.Freq) + return time.Duration(v*1000_000_000) * time.Nanosecond +} + +func ReadTime(ctx context.Context, opts ...Option) (*Time, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "/dev/time") + var t Time + if err := readTime(file, &t); err != nil { + return nil, err + } + return &t, nil +} + +// ProcStatus represents a /proc/n/status. +type ProcStatus struct { + Name string + User string + State string + Times CPUTime + MemUsed int64 // in units of 1024 bytes + BasePriority uint32 // 0(low) to 19(high) + Priority uint32 // 0(low) to 19(high) +} + +// CPUTime represents /dev/cputime or a part of /proc/n/status. +type CPUTime struct { + User time.Duration // the time in user mode (millisecconds) + Sys time.Duration + Real time.Duration + ChildUser time.Duration // exited children and descendants time in user mode + ChildSys time.Duration + ChildReal time.Duration +} + +// CPUStats emulates Linux's /proc/stat. +type CPUStats struct { + User time.Duration + Sys time.Duration + Idle time.Duration +} + +func ReadCPUStats(ctx context.Context, opts ...Option) (*CPUStats, error) { + cfg := newConfig(opts...) + a, err := ReadSysStats(ctx, opts...) + if err != nil { + return nil, err + } + + dir := filepath.Join(cfg.rootdir, "/proc") + d, err := os.Open(dir) + if err != nil { + return nil, err + } + defer d.Close() + + names, err := d.Readdirnames(0) + if err != nil { + return nil, err + } + var up uint32parser + pids := make([]uint32, len(names)) + for i, s := range names { + pids[i] = up.Parse(s) + } + if up.err != nil { + return nil, err + } + sort.Slice(pids, func(i, j int) bool { + return pids[i] < pids[j] + }) + + var stat CPUStats + for _, pid := range pids { + s := strconv.FormatUint(uint64(pid), 10) + file := filepath.Join(dir, s, "status") + var p ProcStatus + if err := readProcStatus(file, &p); err != nil { + return nil, err + } + stat.User += p.Times.User + stat.Sys += p.Times.Sys + } + + var t Time + file := filepath.Join(cfg.rootdir, "/dev/time") + if err := readTime(file, &t); err != nil { + return nil, err + } + // In multi-processor host, Idle should multiple by number of cores. + u := t.Uptime() * time.Duration(len(a)) + stat.Idle = u - stat.User - stat.Sys + return &stat, nil +} + +func readProcStatus(file string, p *ProcStatus) error { + b, err := ioutil.ReadFile(file) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + fields := strings.Fields(string(b)) + if len(fields) != 12 { + return errors.New("invalid format") + } + p.Name = string(fields[0]) + p.User = string(fields[1]) + p.State = string(fields[2]) + var up uint32parser + p.Times.User = time.Duration(up.Parse(fields[3])) * time.Millisecond + p.Times.Sys = time.Duration(up.Parse(fields[4])) * time.Millisecond + p.Times.Real = time.Duration(up.Parse(fields[5])) * time.Millisecond + p.Times.ChildUser = time.Duration(up.Parse(fields[6])) * time.Millisecond + p.Times.ChildSys = time.Duration(up.Parse(fields[7])) * time.Millisecond + p.Times.ChildReal = time.Duration(up.Parse(fields[8])) * time.Millisecond + p.MemUsed, err = strconv.ParseInt(fields[9], 10, 64) + if err != nil { + return err + } + p.BasePriority = up.Parse(fields[10]) + p.Priority = up.Parse(fields[11]) + return up.err +} + +func readTime(file string, t *Time) error { + b, err := ioutil.ReadFile(file) + if err != nil { + return err + } + fields := strings.Fields(string(b)) + if len(fields) != 4 { + return errors.New("invalid format") + } + n, err := strconv.ParseInt(fields[0], 10, 32) + if err != nil { + return err + } + t.Unix = time.Duration(n) * time.Second + v, err := strconv.ParseInt(fields[1], 10, 64) + if err != nil { + return err + } + t.UnixNano = time.Duration(v) * time.Nanosecond + t.Ticks, err = strconv.ParseInt(fields[2], 10, 64) + if err != nil { + return err + } + t.Freq, err = strconv.ParseInt(fields[3], 10, 64) + if err != nil { + return err + } + return nil +} + +type uint32parser struct { + err error +} + +func (p *uint32parser) Parse(s string) uint32 { + if p.err != nil { + return 0 + } + n, err := strconv.ParseUint(s, 10, 32) + if err != nil { + p.err = err + return 0 + } + return uint32(n) +} diff --git a/vendor/github.com/lufia/plan9stats/doc.go b/vendor/github.com/lufia/plan9stats/doc.go new file mode 100644 index 00000000..10e398e7 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/doc.go @@ -0,0 +1,2 @@ +// Package stats provides statistic utilities for Plan 9. +package stats diff --git a/vendor/github.com/lufia/plan9stats/host.go b/vendor/github.com/lufia/plan9stats/host.go new file mode 100644 index 00000000..957e9034 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/host.go @@ -0,0 +1,303 @@ +package stats + +import ( + "bufio" + "bytes" + "context" + "fmt" + "io/ioutil" + "net" + "os" + "path/filepath" + "strconv" + "strings" +) + +var ( + delim = []byte{' '} +) + +// Host represents host status. +type Host struct { + Sysname string + Storages []*Storage + Interfaces []*Interface +} + +// MemStats represents the memory statistics. +type MemStats struct { + Total int64 // total memory in byte + PageSize int64 // a page size in byte + KernelPages int64 + UserPages Gauge + SwapPages Gauge + + Malloced Gauge // kernel malloced data in byte + Graphics Gauge // kernel graphics data in byte +} + +// Gauge is used/available gauge. +type Gauge struct { + Used int64 + Avail int64 +} + +func (g Gauge) Free() int64 { + return g.Avail - g.Used +} + +// ReadMemStats reads memory statistics from /dev/swap. +func ReadMemStats(ctx context.Context, opts ...Option) (*MemStats, error) { + cfg := newConfig(opts...) + swap := filepath.Join(cfg.rootdir, "/dev/swap") + f, err := os.Open(swap) + if err != nil { + return nil, err + } + defer f.Close() + + var stat MemStats + m := map[string]interface{}{ + "memory": &stat.Total, + "pagesize": &stat.PageSize, + "kernel": &stat.KernelPages, + "user": &stat.UserPages, + "swap": &stat.SwapPages, + "kernel malloc": &stat.Malloced, + "kernel draw": &stat.Graphics, + } + scanner := bufio.NewScanner(f) + for scanner.Scan() { + fields := bytes.SplitN(scanner.Bytes(), delim, 2) + if len(fields) < 2 { + continue + } + switch key := string(fields[1]); key { + case "memory", "pagesize", "kernel": + v := m[key].(*int64) + n, err := strconv.ParseInt(string(fields[0]), 10, 64) + if err != nil { + return nil, err + } + *v = n + case "user", "swap", "kernel malloc", "kernel draw": + v := m[key].(*Gauge) + if err := parseGauge(string(fields[0]), v); err != nil { + return nil, err + } + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &stat, nil +} + +func parseGauge(s string, r *Gauge) error { + a := strings.SplitN(s, "/", 2) + if len(a) != 2 { + return fmt.Errorf("can't parse ratio: %s", s) + } + var p intParser + u := p.ParseInt64(a[0], 10) + n := p.ParseInt64(a[1], 10) + if err := p.Err(); err != nil { + return err + } + r.Used = u + r.Avail = n + return nil +} + +type Storage struct { + Name string + Model string + Capacity int64 +} + +type Interface struct { + Name string + Addr string +} + +const ( + numEther = 8 // see ether(3) + numIpifc = 16 // see ip(3) +) + +// ReadInterfaces reads network interfaces from etherN. +func ReadInterfaces(ctx context.Context, opts ...Option) ([]*Interface, error) { + cfg := newConfig(opts...) + var a []*Interface + for i := 0; i < numEther; i++ { + p, err := readInterface(cfg.rootdir, i) + if os.IsNotExist(err) { + continue + } + if err != nil { + return nil, err + } + a = append(a, p) + } + return a, nil +} + +func readInterface(netroot string, i int) (*Interface, error) { + ether := fmt.Sprintf("ether%d", i) + dir := filepath.Join(netroot, ether) + info, err := os.Stat(dir) + if err != nil { + return nil, err + } + if !info.IsDir() { + return nil, fmt.Errorf("%s: is not directory", dir) + } + + addr, err := ioutil.ReadFile(filepath.Join(dir, "addr")) + if err != nil { + return nil, err + } + return &Interface{ + Name: ether, + Addr: string(addr), + }, nil +} + +var ( + netdirs = []string{"/net", "/net.alt"} +) + +// ReadHost reads host status. +func ReadHost(ctx context.Context, opts ...Option) (*Host, error) { + cfg := newConfig(opts...) + var h Host + name, err := readSysname(cfg.rootdir) + if err != nil { + return nil, err + } + h.Sysname = name + + a, err := readStorages(cfg.rootdir) + if err != nil { + return nil, err + } + h.Storages = a + + for _, s := range netdirs { + netroot := filepath.Join(cfg.rootdir, s) + ifaces, err := ReadInterfaces(ctx, WithRootDir(netroot)) + if err != nil { + return nil, err + } + h.Interfaces = append(h.Interfaces, ifaces...) + } + return &h, nil +} + +func readSysname(rootdir string) (string, error) { + file := filepath.Join(rootdir, "/dev/sysname") + b, err := ioutil.ReadFile(file) + if err != nil { + return "", err + } + return string(bytes.TrimSpace(b)), nil +} + +func readStorages(rootdir string) ([]*Storage, error) { + sdctl := filepath.Join(rootdir, "/dev/sdctl") + f, err := os.Open(sdctl) + if err != nil { + return nil, err + } + defer f.Close() + + var a []*Storage + scanner := bufio.NewScanner(f) + for scanner.Scan() { + fields := bytes.Split(scanner.Bytes(), delim) + if len(fields) == 0 { + continue + } + exp := string(fields[0]) + "*" + if !strings.HasPrefix(exp, "sd") { + continue + } + dir := filepath.Join(rootdir, "/dev", exp) + m, err := filepath.Glob(dir) + if err != nil { + return nil, err + } + for _, dir := range m { + s, err := readStorage(dir) + if err != nil { + return nil, err + } + a = append(a, s) + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return a, nil +} + +func readStorage(dir string) (*Storage, error) { + ctl := filepath.Join(dir, "ctl") + f, err := os.Open(ctl) + if err != nil { + return nil, err + } + defer f.Close() + + var s Storage + s.Name = filepath.Base(dir) + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := scanner.Bytes() + switch { + case bytes.HasPrefix(line, []byte("inquiry")): + s.Model = string(bytes.TrimSpace(line[7:])) + case bytes.HasPrefix(line, []byte("geometry")): + fields := bytes.Split(line, delim) + if len(fields) < 3 { + continue + } + var p intParser + sec := p.ParseInt64(string(fields[1]), 10) + size := p.ParseInt64(string(fields[2]), 10) + if err := p.Err(); err != nil { + return nil, err + } + s.Capacity = sec * size + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &s, nil +} + +type IPStats struct { + ID int // number of interface in ipifc dir + Device string // associated physical device + MTU int // max transfer unit + Sendra6 uint8 // on == send router adv + Recvra6 uint8 // on == recv router adv + + Pktin int64 // packets read + Pktout int64 // packets written + Errin int64 // read errors + Errout int64 // write errors +} + +type Iplifc struct { + IP net.IP + Mask net.IPMask + Net net.IP // ip & mask + PerfLifetime int64 // preferred lifetime + ValidLifetime int64 // valid lifetime +} + +type Ipv6rp struct { + // TODO(lufia): see ip(2) +} diff --git a/vendor/github.com/lufia/plan9stats/int.go b/vendor/github.com/lufia/plan9stats/int.go new file mode 100644 index 00000000..db133c43 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/int.go @@ -0,0 +1,31 @@ +package stats + +import ( + "strconv" +) + +type intParser struct { + err error +} + +func (p *intParser) ParseInt(s string, base int) int { + if p.err != nil { + return 0 + } + var n int64 + n, p.err = strconv.ParseInt(s, base, 0) + return int(n) +} + +func (p *intParser) ParseInt64(s string, base int) int64 { + if p.err != nil { + return 0 + } + var n int64 + n, p.err = strconv.ParseInt(s, base, 64) + return n +} + +func (p *intParser) Err() error { + return p.err +} diff --git a/vendor/github.com/lufia/plan9stats/opts.go b/vendor/github.com/lufia/plan9stats/opts.go new file mode 100644 index 00000000..05b7d036 --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/opts.go @@ -0,0 +1,21 @@ +package stats + +type Config struct { + rootdir string +} + +type Option func(*Config) + +func newConfig(opts ...Option) *Config { + var cfg Config + for _, opt := range opts { + opt(&cfg) + } + return &cfg +} + +func WithRootDir(dir string) Option { + return func(cfg *Config) { + cfg.rootdir = dir + } +} diff --git a/vendor/github.com/lufia/plan9stats/stats.go b/vendor/github.com/lufia/plan9stats/stats.go new file mode 100644 index 00000000..d4ecdcfa --- /dev/null +++ b/vendor/github.com/lufia/plan9stats/stats.go @@ -0,0 +1,88 @@ +package stats + +import ( + "bufio" + "context" + "os" + "path/filepath" + "strings" +) + +type InterfaceStats struct { + PacketsReceived int64 // in packets + Link int // link status + PacketsSent int64 // out packets + NumCRCErr int // input CRC errors + NumOverflows int // packet overflows + NumSoftOverflows int // software overflow + NumFramingErr int // framing errors + NumBufferingErr int // buffering errors + NumOutputErr int // output errors + Promiscuous int // number of promiscuous opens + Mbps int // megabits per sec + Addr string +} + +func ReadInterfaceStats(ctx context.Context, opts ...Option) (*InterfaceStats, error) { + cfg := newConfig(opts...) + file := filepath.Join(cfg.rootdir, "stats") + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + var stats InterfaceStats + scanner := bufio.NewScanner(f) + for scanner.Scan() { + s := strings.TrimSpace(scanner.Text()) + a := strings.SplitN(s, ":", 2) + if len(a) != 2 { + continue + } + var p intParser + v := strings.TrimSpace(a[1]) + switch a[0] { + case "in": + stats.PacketsReceived = p.ParseInt64(v, 10) + case "link": + stats.Link = p.ParseInt(v, 10) + case "out": + stats.PacketsSent = p.ParseInt64(v, 10) + case "crc": + stats.NumCRCErr = p.ParseInt(v, 10) + case "overflows": + stats.NumOverflows = p.ParseInt(v, 10) + case "soft overflows": + stats.NumSoftOverflows = p.ParseInt(v, 10) + case "framing errs": + stats.NumFramingErr = p.ParseInt(v, 10) + case "buffer errs": + stats.NumBufferingErr = p.ParseInt(v, 10) + case "output errs": + stats.NumOutputErr = p.ParseInt(v, 10) + case "prom": + stats.Promiscuous = p.ParseInt(v, 10) + case "mbps": + stats.Mbps = p.ParseInt(v, 10) + case "addr": + stats.Addr = v + } + if err := p.Err(); err != nil { + return nil, err + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + return &stats, nil +} + +type TCPStats struct { + MaxConn int + MaxSegment int + ActiveOpens int + PassiveOpens int + EstablishedResets int + CurrentEstablished int +} diff --git a/vendor/github.com/moby/patternmatcher/ignorefile/ignorefile.go b/vendor/github.com/moby/patternmatcher/ignorefile/ignorefile.go new file mode 100644 index 00000000..94ea5a0e --- /dev/null +++ b/vendor/github.com/moby/patternmatcher/ignorefile/ignorefile.go @@ -0,0 +1,73 @@ +package ignorefile + +import ( + "bufio" + "bytes" + "io" + "path/filepath" + "strings" +) + +// ReadAll reads an ignore file from a reader and returns the list of file +// patterns to ignore, applying the following rules: +// +// - An UTF8 BOM header (if present) is stripped. +// - Lines starting with "#" are considered comments and are skipped. +// +// For remaining lines: +// +// - Leading and trailing whitespace is removed from each ignore pattern. +// - It uses [filepath.Clean] to get the shortest/cleanest path for +// ignore patterns. +// - Leading forward-slashes ("/") are removed from ignore patterns, +// so "/some/path" and "some/path" are considered equivalent. +func ReadAll(reader io.Reader) ([]string, error) { + if reader == nil { + return nil, nil + } + + var excludes []string + currentLine := 0 + utf8bom := []byte{0xEF, 0xBB, 0xBF} + + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + scannedBytes := scanner.Bytes() + // We trim UTF8 BOM + if currentLine == 0 { + scannedBytes = bytes.TrimPrefix(scannedBytes, utf8bom) + } + pattern := string(scannedBytes) + currentLine++ + // Lines starting with # (comments) are ignored before processing + if strings.HasPrefix(pattern, "#") { + continue + } + pattern = strings.TrimSpace(pattern) + if pattern == "" { + continue + } + // normalize absolute paths to paths relative to the context + // (taking care of '!' prefix) + invert := pattern[0] == '!' + if invert { + pattern = strings.TrimSpace(pattern[1:]) + } + if len(pattern) > 0 { + pattern = filepath.Clean(pattern) + pattern = filepath.ToSlash(pattern) + if len(pattern) > 1 && pattern[0] == '/' { + pattern = pattern[1:] + } + } + if invert { + pattern = "!" + pattern + } + + excludes = append(excludes, pattern) + } + if err := scanner.Err(); err != nil { + return nil, err + } + return excludes, nil +} diff --git a/vendor/github.com/moby/sys/user/LICENSE b/vendor/github.com/moby/sys/user/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/moby/sys/user/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go b/vendor/github.com/moby/sys/user/lookup_unix.go similarity index 100% rename from vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go rename to vendor/github.com/moby/sys/user/lookup_unix.go diff --git a/vendor/github.com/opencontainers/runc/libcontainer/user/user.go b/vendor/github.com/moby/sys/user/user.go similarity index 100% rename from vendor/github.com/opencontainers/runc/libcontainer/user/user.go rename to vendor/github.com/moby/sys/user/user.go diff --git a/vendor/github.com/opencontainers/runc/libcontainer/user/user_fuzzer.go b/vendor/github.com/moby/sys/user/user_fuzzer.go similarity index 100% rename from vendor/github.com/opencontainers/runc/libcontainer/user/user_fuzzer.go rename to vendor/github.com/moby/sys/user/user_fuzzer.go diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go index 3004e9a4..1881b118 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go @@ -21,7 +21,7 @@ import digest "github.com/opencontainers/go-digest" // when marshalled to JSON. type Descriptor struct { // MediaType is the media type of the object this schema refers to. - MediaType string `json:"mediaType,omitempty"` + MediaType string `json:"mediaType"` // Digest is the digest of the targeted content. Digest digest.Digest `json:"digest"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go index fc79e9e0..c5503cb3 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go @@ -15,10 +15,14 @@ package v1 const ( - // ImageLayoutFile is the file name of oci image layout file + // ImageLayoutFile is the file name containing ImageLayout in an OCI Image Layout ImageLayoutFile = "oci-layout" // ImageLayoutVersion is the version of ImageLayout ImageLayoutVersion = "1.0.0" + // ImageIndexFile is the file name of the entry point for references and descriptors in an OCI Image Layout + ImageIndexFile = "index.json" + // ImageBlobsDir is the directory name containing content addressable blobs in an OCI Image Layout + ImageBlobsDir = "blobs" ) // ImageLayout is the structure in the "oci-layout" file, found in the root diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go index 892ba3de..ce8313e7 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go @@ -21,12 +21,20 @@ const ( // MediaTypeLayoutHeader specifies the media type for the oci-layout. MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json" + // MediaTypeImageIndex specifies the media type for an image index. + MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" + // MediaTypeImageManifest specifies the media type for an image manifest. MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json" - // MediaTypeImageIndex specifies the media type for an image index. - MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" + // MediaTypeImageConfig specifies the media type for the image configuration. + MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" + + // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value "{}". + MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" +) +const ( // MediaTypeImageLayer is the media type used for layers referenced by the manifest. MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar" @@ -37,7 +45,15 @@ const ( // MediaTypeImageLayerZstd is the media type used for zstd compressed // layers referenced by the manifest. MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd" +) +// Non-distributable layer media-types. +// +// Deprecated: Non-distributable layers are deprecated, and not recommended +// for future use. Implementations SHOULD NOT produce new non-distributable +// layers. +// https://github.com/opencontainers/image-spec/pull/965 +const ( // MediaTypeImageLayerNonDistributable is the media type for layers referenced by // the manifest but with distribution restrictions. // @@ -66,10 +82,4 @@ const ( // layers. // https://github.com/opencontainers/image-spec/pull/965 MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd" - - // MediaTypeImageConfig specifies the media type for the image configuration. - MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" - - // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value `{}` - MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" ) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index e3b7ac03..7069ae44 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -25,7 +25,7 @@ const ( VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. - VersionDev = "-rc.4" + VersionDev = "" ) // Version is the specification version that the package types support. diff --git a/vendor/github.com/opencontainers/runc/NOTICE b/vendor/github.com/opencontainers/runc/NOTICE deleted file mode 100644 index 5c97abce..00000000 --- a/vendor/github.com/opencontainers/runc/NOTICE +++ /dev/null @@ -1,17 +0,0 @@ -runc - -Copyright 2012-2015 Docker, Inc. - -This product includes software developed at Docker, Inc. (http://www.docker.com). - -The following is courtesy of our legal counsel: - - -Use and transfer of Docker may be subject to certain restrictions by the -United States and other governments. -It is your responsibility to ensure that your use and/or transfer does not -violate applicable laws. - -For more information, please see http://www.bis.doc.gov - -See also http://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go index ce7dd4af..76df2d5b 100644 --- a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go +++ b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go @@ -57,7 +57,11 @@ type SeenTracker struct { currentIdx int } -var pool sync.Pool +var pool = sync.Pool{ + New: func() interface{} { + return &SeenTracker{} + }, +} func (s *SeenTracker) reset() { // Always contains a root element at index 0. @@ -331,12 +335,6 @@ func (s *SeenTracker) checkArray(node *unstable.Node) (first bool, err error) { } func (s *SeenTracker) checkInlineTable(node *unstable.Node) (first bool, err error) { - if pool.New == nil { - pool.New = func() interface{} { - return &SeenTracker{} - } - } - s = pool.Get().(*SeenTracker) s.reset() diff --git a/vendor/github.com/pelletier/go-toml/v2/marshaler.go b/vendor/github.com/pelletier/go-toml/v2/marshaler.go index ffc99272..7f4e20c1 100644 --- a/vendor/github.com/pelletier/go-toml/v2/marshaler.go +++ b/vendor/github.com/pelletier/go-toml/v2/marshaler.go @@ -1025,6 +1025,10 @@ func (enc *Encoder) encodeSliceAsArrayTable(b []byte, ctx encoderCtx, v reflect. scratch = enc.commented(ctx.commented, scratch) + if enc.indentTables { + scratch = enc.indent(ctx.indent, scratch) + } + scratch = append(scratch, "[["...) for i, k := range ctx.parentKey { diff --git a/vendor/github.com/power-devops/perfstat/LICENSE b/vendor/github.com/power-devops/perfstat/LICENSE new file mode 100644 index 00000000..ec4e5d39 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/LICENSE @@ -0,0 +1,23 @@ +MIT License + +Copyright (c) 2020 Power DevOps + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/vendor/github.com/power-devops/perfstat/c_helpers.c b/vendor/github.com/power-devops/perfstat/c_helpers.c new file mode 100644 index 00000000..49ba1ad7 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/c_helpers.c @@ -0,0 +1,159 @@ +#include "c_helpers.h" + +GETFUNC(cpu) +GETFUNC(disk) +GETFUNC(diskadapter) +GETFUNC(diskpath) +GETFUNC(fcstat) +GETFUNC(logicalvolume) +GETFUNC(memory_page) +GETFUNC(netadapter) +GETFUNC(netbuffer) +GETFUNC(netinterface) +GETFUNC(pagingspace) +GETFUNC(process) +GETFUNC(thread) +GETFUNC(volumegroup) + +double get_partition_mhz(perfstat_partition_config_t pinfo) { + return pinfo.processorMHz; +} + +char *get_ps_hostname(perfstat_pagingspace_t *ps) { + return ps->u.nfs_paging.hostname; +} + +char *get_ps_filename(perfstat_pagingspace_t *ps) { + return ps->u.nfs_paging.filename; +} + +char *get_ps_vgname(perfstat_pagingspace_t *ps) { + return ps->u.lv_paging.vgname; +} + +time_t boottime() +{ + register struct utmpx *utmp; + + setutxent(); + while ( (utmp = getutxent()) != NULL ) { + if (utmp->ut_type == BOOT_TIME) { + return utmp->ut_tv.tv_sec; + } + } + endutxent(); + return -1; +} + +struct fsinfo *get_filesystem_stat(struct fsinfo *fs_all, int n) { + if (!fs_all) return NULL; + return &(fs_all[n]); +} + +int get_mounts(struct vmount **vmountpp) { + int size; + struct vmount *vm; + int nmounts; + + size = BUFSIZ; + + while (1) { + if ((vm = (struct vmount *)malloc((size_t)size)) == NULL) { + perror("malloc failed"); + exit(-1); + } + if ((nmounts = mntctl(MCTL_QUERY, size, (caddr_t)vm)) > 0) { + *vmountpp = vm; + return nmounts; + } else if (nmounts == 0) { + size = *(int *)vm; + free((void *)vm); + } else { + free((void *)vm); + return -1; + } + } +} + +void fill_fsinfo(struct statfs statbuf, struct fsinfo *fs) { + fsblkcnt_t freeblks, totblks, usedblks; + fsblkcnt_t tinodes, ninodes, ifree; + uint cfactor; + + if (statbuf.f_blocks == -1) { + fs->totalblks = 0; + fs->freeblks = 0; + fs->totalinodes = 0; + fs->freeinodes = 0; + return; + } + + cfactor = statbuf.f_bsize / 512; + fs->freeblks = statbuf.f_bavail * cfactor; + fs->totalblks = statbuf.f_blocks * cfactor; + + fs->freeinodes = statbuf.f_ffree; + fs->totalinodes = statbuf.f_files; + + if (fs->freeblks < 0) + fs->freeblks = 0; +} + +int getfsinfo(char *fsname, char *devname, char *host, char *options, int flags, int fstype, struct fsinfo *fs) { + struct statfs statbuf; + int devname_size = strlen(devname); + int fsname_size = strlen(fsname); + char buf[BUFSIZ]; + char *p; + + if (fs == NULL) { + return 1; + } + + for (p = strtok(options, ","); p != NULL; p = strtok(NULL, ",")) + if (strcmp(p, "ignore") == 0) + return 0; + + if (*host != 0 && strcmp(host, "-") != 0) { + sprintf(buf, "%s:%s", host, devname); + devname = buf; + } + fs->devname = (char *)calloc(devname_size+1, 1); + fs->fsname = (char *)calloc(fsname_size+1, 1); + strncpy(fs->devname, devname, devname_size); + strncpy(fs->fsname, fsname, fsname_size); + fs->flags = flags; + fs->fstype = fstype; + + if (statfs(fsname,&statbuf) < 0) { + return 1; + } + + fill_fsinfo(statbuf, fs); + return 0; +} + +struct fsinfo *get_all_fs(int *rc) { + struct vmount *mnt; + struct fsinfo *fs_all; + int nmounts; + + *rc = -1; + if ((nmounts = get_mounts(&mnt)) <= 0) { + perror("Can't get mount table info"); + return NULL; + } + + fs_all = (struct fsinfo *)calloc(sizeof(struct fsinfo), nmounts); + while ((*rc)++, nmounts--) { + getfsinfo(vmt2dataptr(mnt, VMT_STUB), + vmt2dataptr(mnt, VMT_OBJECT), + vmt2dataptr(mnt, VMT_HOST), + vmt2dataptr(mnt, VMT_ARGS), + mnt->vmt_flags, + mnt->vmt_gfstype, + &fs_all[*rc]); + mnt = (struct vmount *)((char *)mnt + mnt->vmt_length); + } + return fs_all; +} diff --git a/vendor/github.com/power-devops/perfstat/c_helpers.h b/vendor/github.com/power-devops/perfstat/c_helpers.h new file mode 100644 index 00000000..b66bc53c --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/c_helpers.h @@ -0,0 +1,58 @@ +#ifndef C_HELPERS_H +#define C_HELPERS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GETFUNC(TYPE) perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *b, int n) { \ + if (!b) return NULL; \ + return &(b[n]); \ +} + +#define GETFUNC_EXT(TYPE) extern perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *, int); + +GETFUNC_EXT(cpu) +GETFUNC_EXT(disk) +GETFUNC_EXT(diskadapter) +GETFUNC_EXT(diskpath) +GETFUNC_EXT(fcstat) +GETFUNC_EXT(logicalvolume) +GETFUNC_EXT(memory_page) +GETFUNC_EXT(netadapter) +GETFUNC_EXT(netbuffer) +GETFUNC_EXT(netinterface) +GETFUNC_EXT(pagingspace) +GETFUNC_EXT(process) +GETFUNC_EXT(thread) +GETFUNC_EXT(volumegroup) + +struct fsinfo { + char *devname; + char *fsname; + int flags; + int fstype; + unsigned long totalblks; + unsigned long freeblks; + unsigned long totalinodes; + unsigned long freeinodes; +}; + +extern double get_partition_mhz(perfstat_partition_config_t); +extern char *get_ps_hostname(perfstat_pagingspace_t *); +extern char *get_ps_filename(perfstat_pagingspace_t *); +extern char *get_ps_vgname(perfstat_pagingspace_t *); +extern time_t boottime(); +struct fsinfo *get_filesystem_stat(struct fsinfo *, int); +int get_mounts(struct vmount **); +void fill_statfs(struct statfs, struct fsinfo *); +int getfsinfo(char *, char *, char *, char *, int, int, struct fsinfo *); +struct fsinfo *get_all_fs(int *); + +#endif diff --git a/vendor/github.com/power-devops/perfstat/config.go b/vendor/github.com/power-devops/perfstat/config.go new file mode 100644 index 00000000..de7230d2 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/config.go @@ -0,0 +1,18 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +*/ +import "C" + +func EnableLVMStat() { + C.perfstat_config(C.PERFSTAT_ENABLE|C.PERFSTAT_LV|C.PERFSTAT_VG, nil) +} + +func DisableLVMStat() { + C.perfstat_config(C.PERFSTAT_DISABLE|C.PERFSTAT_LV|C.PERFSTAT_VG, nil) +} diff --git a/vendor/github.com/power-devops/perfstat/cpustat.go b/vendor/github.com/power-devops/perfstat/cpustat.go new file mode 100644 index 00000000..902727fb --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/cpustat.go @@ -0,0 +1,98 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "runtime" + "time" + "unsafe" +) + +func CpuStat() ([]CPU, error) { + var cpustat *C.perfstat_cpu_t + var cpu C.perfstat_id_t + + ncpu := runtime.NumCPU() + + cpustat_len := C.sizeof_perfstat_cpu_t * C.ulong(ncpu) + cpustat = (*C.perfstat_cpu_t)(C.malloc(cpustat_len)) + defer C.free(unsafe.Pointer(cpustat)) + C.strcpy(&cpu.name[0], C.CString(C.FIRST_CPU)) + r := C.perfstat_cpu(&cpu, cpustat, C.sizeof_perfstat_cpu_t, C.int(ncpu)) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu()") + } + c := make([]CPU, r) + for i := 0; i < int(r); i++ { + n := C.get_cpu_stat(cpustat, C.int(i)) + if n != nil { + c[i] = perfstatcpu2cpu(n) + } + } + return c, nil +} + +func CpuTotalStat() (*CPUTotal, error) { + var cpustat *C.perfstat_cpu_total_t + + cpustat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + defer C.free(unsafe.Pointer(cpustat)) + r := C.perfstat_cpu_total(nil, cpustat, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + c := perfstatcputotal2cputotal(cpustat) + return &c, nil +} + +func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { + var cpuutil *C.perfstat_cpu_util_t + var newt *C.perfstat_cpu_total_t + var oldt *C.perfstat_cpu_total_t + var data C.perfstat_rawdata_t + + oldt = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + newt = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t)) + cpuutil = (*C.perfstat_cpu_util_t)(C.malloc(C.sizeof_perfstat_cpu_util_t)) + defer C.free(unsafe.Pointer(oldt)) + defer C.free(unsafe.Pointer(newt)) + defer C.free(unsafe.Pointer(cpuutil)) + + r := C.perfstat_cpu_total(nil, oldt, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + + time.Sleep(intvl) + + r = C.perfstat_cpu_total(nil, newt, C.sizeof_perfstat_cpu_total_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_total()") + } + + data._type = C.UTIL_CPU_TOTAL + data.curstat = unsafe.Pointer(newt) + data.prevstat = unsafe.Pointer(oldt) + data.sizeof_data = C.sizeof_perfstat_cpu_total_t + data.cur_elems = 1 + data.prev_elems = 1 + + r = C.perfstat_cpu_util(&data, cpuutil, C.sizeof_perfstat_cpu_util_t, 1) + if r <= 0 { + return nil, fmt.Errorf("error perfstat_cpu_util()") + } + u := perfstatcpuutil2cpuutil(cpuutil) + return &u, nil +} diff --git a/vendor/github.com/power-devops/perfstat/diskstat.go b/vendor/github.com/power-devops/perfstat/diskstat.go new file mode 100644 index 00000000..fc70dfaa --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/diskstat.go @@ -0,0 +1,137 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func DiskTotalStat() (*DiskTotal, error) { + var disk C.perfstat_disk_total_t + + rc := C.perfstat_disk_total(nil, &disk, C.sizeof_perfstat_disk_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_disk_total() error") + } + d := perfstatdisktotal2disktotal(disk) + return &d, nil +} + +func DiskAdapterStat() ([]DiskAdapter, error) { + var adapter *C.perfstat_diskadapter_t + var adptname C.perfstat_id_t + + numadpt := C.perfstat_diskadapter(nil, nil, C.sizeof_perfstat_diskadapter_t, 0) + if numadpt <= 0 { + return nil, fmt.Errorf("perfstat_diskadapter() error") + } + + adapter_len := C.sizeof_perfstat_diskadapter_t * C.ulong(numadpt) + adapter = (*C.perfstat_diskadapter_t)(C.malloc(adapter_len)) + defer C.free(unsafe.Pointer(adapter)) + C.strcpy(&adptname.name[0], C.CString(C.FIRST_DISKADAPTER)) + r := C.perfstat_diskadapter(&adptname, adapter, C.sizeof_perfstat_diskadapter_t, numadpt) + if r < 0 { + return nil, fmt.Errorf("perfstat_diskadapter() error") + } + da := make([]DiskAdapter, r) + for i := 0; i < int(r); i++ { + d := C.get_diskadapter_stat(adapter, C.int(i)) + if d != nil { + da[i] = perfstatdiskadapter2diskadapter(d) + } + } + return da, nil +} + +func DiskStat() ([]Disk, error) { + var disk *C.perfstat_disk_t + var diskname C.perfstat_id_t + + numdisk := C.perfstat_disk(nil, nil, C.sizeof_perfstat_disk_t, 0) + if numdisk <= 0 { + return nil, fmt.Errorf("perfstat_disk() error") + } + + disk_len := C.sizeof_perfstat_disk_t * C.ulong(numdisk) + disk = (*C.perfstat_disk_t)(C.malloc(disk_len)) + defer C.free(unsafe.Pointer(disk)) + C.strcpy(&diskname.name[0], C.CString(C.FIRST_DISK)) + r := C.perfstat_disk(&diskname, disk, C.sizeof_perfstat_disk_t, numdisk) + if r < 0 { + return nil, fmt.Errorf("perfstat_disk() error") + } + d := make([]Disk, r) + for i := 0; i < int(r); i++ { + ds := C.get_disk_stat(disk, C.int(i)) + if ds != nil { + d[i] = perfstatdisk2disk(ds) + } + } + return d, nil +} + +func DiskPathStat() ([]DiskPath, error) { + var diskpath *C.perfstat_diskpath_t + var pathname C.perfstat_id_t + + numpaths := C.perfstat_diskpath(nil, nil, C.sizeof_perfstat_diskpath_t, 0) + if numpaths <= 0 { + return nil, fmt.Errorf("perfstat_diskpath() error") + } + + path_len := C.sizeof_perfstat_diskpath_t * C.ulong(numpaths) + diskpath = (*C.perfstat_diskpath_t)(C.malloc(path_len)) + defer C.free(unsafe.Pointer(diskpath)) + C.strcpy(&pathname.name[0], C.CString(C.FIRST_DISKPATH)) + r := C.perfstat_diskpath(&pathname, diskpath, C.sizeof_perfstat_diskpath_t, numpaths) + if r < 0 { + return nil, fmt.Errorf("perfstat_diskpath() error") + } + d := make([]DiskPath, r) + for i := 0; i < int(r); i++ { + p := C.get_diskpath_stat(diskpath, C.int(i)) + if p != nil { + d[i] = perfstatdiskpath2diskpath(p) + } + } + return d, nil +} + +func FCAdapterStat() ([]FCAdapter, error) { + var fcstat *C.perfstat_fcstat_t + var fcname C.perfstat_id_t + + numadpt := C.perfstat_fcstat(nil, nil, C.sizeof_perfstat_fcstat_t, 0) + if numadpt <= 0 { + return nil, fmt.Errorf("perfstat_fcstat() error") + } + + fcstat_len := C.sizeof_perfstat_fcstat_t * C.ulong(numadpt) + fcstat = (*C.perfstat_fcstat_t)(C.malloc(fcstat_len)) + defer C.free(unsafe.Pointer(fcstat)) + C.strcpy(&fcname.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_fcstat(&fcname, fcstat, C.sizeof_perfstat_fcstat_t, numadpt) + if r < 0 { + return nil, fmt.Errorf("perfstat_fcstat() error") + } + fca := make([]FCAdapter, r) + for i := 0; i < int(r); i++ { + f := C.get_fcstat_stat(fcstat, C.int(i)) + if f != nil { + fca[i] = perfstatfcstat2fcadapter(f) + } + } + return fca, nil +} diff --git a/vendor/github.com/power-devops/perfstat/doc.go b/vendor/github.com/power-devops/perfstat/doc.go new file mode 100644 index 00000000..85eaf3e7 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/doc.go @@ -0,0 +1,315 @@ +// +build !aix + +// Copyright 2020 Power-Devops.com. All rights reserved. +// Use of this source code is governed by the license +// that can be found in the LICENSE file. +/* +Package perfstat is Go interface to IBM AIX libperfstat. +To use it you need AIX with installed bos.perf.libperfstat. You can check, if is installed using the following command: + + $ lslpp -L bos.perf.perfstat + +The package is written using Go 1.14.7 and AIX 7.2 TL5. It should work with earlier TLs of AIX 7.2, but I +can't guarantee that perfstat structures in the TLs have all the same fields as the structures in AIX 7.2 TL5. + +For documentation of perfstat on AIX and using it in programs refer to the official IBM documentation: +https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat.html +*/ +package perfstat + +import ( + "fmt" + "time" +) + +// EnableLVMStat() switches on LVM (logical volumes and volume groups) performance statistics. +// With this enabled you can use fields KBReads, KBWrites, and IOCnt +// in LogicalVolume and VolumeGroup data types. +func EnableLVMStat() {} + +// DisableLVMStat() switchess of LVM (logical volumes and volume groups) performance statistics. +// This is the default state. In this case LogicalVolume and VolumeGroup data types are +// populated with informations about LVM structures, but performance statistics fields +// (KBReads, KBWrites, IOCnt) are empty. +func DisableLVMStat() {} + +// CpuStat() returns array of CPU structures with information about +// logical CPUs on the system. +// IBM documentation: +// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html +// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html +func CpuStat() ([]CPU, error) { + return nil, fmt.Errorf("not implemented") +} + +// CpuTotalStat() returns general information about CPUs on the system. +// IBM documentation: +// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html +// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html +func CpuTotalStat() (*CPUTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +// CpuUtilStat() calculates CPU utilization. +// IBM documentation: +// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html +// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html +func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskTotalStat() (*DiskTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskAdapterStat() ([]DiskAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskStat() ([]Disk, error) { + return nil, fmt.Errorf("not implemented") +} + +func DiskPathStat() ([]DiskPath, error) { + return nil, fmt.Errorf("not implemented") +} + +func FCAdapterStat() ([]FCAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func PartitionStat() (*PartitionConfig, error) { + return nil, fmt.Errorf("not implemented") +} + +func LogicalVolumeStat() ([]LogicalVolume, error) { + return nil, fmt.Errorf("not implemented") +} + +func VolumeGroupStat() ([]VolumeGroup, error) { + return nil, fmt.Errorf("not implemented") +} + +func MemoryTotalStat() (*MemoryTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func MemoryPageStat() ([]MemoryPage, error) { + return nil, fmt.Errorf("not implemented") +} + +func PagingSpaceStat() ([]PagingSpace, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetIfaceTotalStat() (*NetIfaceTotal, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetBufferStat() ([]NetBuffer, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetIfaceStat() ([]NetIface, error) { + return nil, fmt.Errorf("not implemented") +} + +func NetAdapterStat() ([]NetAdapter, error) { + return nil, fmt.Errorf("not implemented") +} + +func ProcessStat() ([]Process, error) { + return nil, fmt.Errorf("not implemented") +} + +func ThreadStat() ([]Thread, error) { + return nil, fmt.Errorf("not implemented") +} + +func Sysconf(name int32) (int64, error) { + return 0, fmt.Errorf("not implemented") +} + +func GetCPUImplementation() string { + return "" +} + +func POWER9OrNewer() bool { + return false +} + +func POWER9() bool { + return false +} + +func POWER8OrNewer() bool { + return false +} + +func POWER8() bool { + return false +} + +func POWER7OrNewer() bool { + return false +} + +func POWER7() bool { + return false +} + +func HasTransactionalMemory() bool { + return false +} + +func Is64Bit() bool { + return false +} + +func IsSMP() bool { + return false +} + +func HasVMX() bool { + return false +} + +func HasVSX() bool { + return false +} + +func HasDFP() bool { + return false +} + +func HasNxGzip() bool { + return false +} + +func PksCapable() bool { + return false +} + +func PksEnabled() bool { + return false +} + +func CPUMode() string { + return "" +} + +func KernelBits() int { + return 0 +} + +func IsLPAR() bool { + return false +} + +func CpuAddCapable() bool { + return false +} + +func CpuRemoveCapable() bool { + return false +} + +func MemoryAddCapable() bool { + return false +} + +func MemoryRemoveCapable() bool { + return false +} + +func DLparCapable() bool { + return false +} + +func IsNUMA() bool { + return false +} + +func KernelKeys() bool { + return false +} + +func RecoveryMode() bool { + return false +} + +func EnhancedAffinity() bool { + return false +} + +func VTpmEnabled() bool { + return false +} + +func IsVIOS() bool { + return false +} + +func MLSEnabled() bool { + return false +} + +func SPLparCapable() bool { + return false +} + +func SPLparEnabled() bool { + return false +} + +func DedicatedLpar() bool { + return false +} + +func SPLparCapped() bool { + return false +} + +func SPLparDonating() bool { + return false +} + +func SmtCapable() bool { + return false +} + +func SmtEnabled() bool { + return false +} + +func VrmCapable() bool { + return false +} + +func VrmEnabled() bool { + return false +} + +func AmeEnabled() bool { + return false +} + +func EcoCapable() bool { + return false +} + +func EcoEnabled() bool { + return false +} + +func BootTime() (uint64, error) { + return 0, fmt.Errorf("Not implemented") +} + +func UptimeSeconds() (uint64, error) { + return 0, fmt.Errorf("Not implemented") +} + +func FileSystemStat() ([]FileSystem, error) { + return nil, fmt.Errorf("Not implemented") +} diff --git a/vendor/github.com/power-devops/perfstat/fsstat.go b/vendor/github.com/power-devops/perfstat/fsstat.go new file mode 100644 index 00000000..27f4c06c --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/fsstat.go @@ -0,0 +1,31 @@ +// +build aix + +package perfstat + +/* +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" +) + +func FileSystemStat() ([]FileSystem, error) { + var fsinfo *C.struct_fsinfo + var nmounts C.int + + fsinfo = C.get_all_fs(&nmounts) + if nmounts <= 0 { + return nil, fmt.Errorf("No mounts found") + } + + fs := make([]FileSystem, nmounts) + for i := 0; i < int(nmounts); i++ { + f := C.get_filesystem_stat(fsinfo, C.int(i)) + if f != nil { + fs[i] = fsinfo2filesystem(f) + } + } + return fs, nil +} diff --git a/vendor/github.com/power-devops/perfstat/helpers.go b/vendor/github.com/power-devops/perfstat/helpers.go new file mode 100644 index 00000000..e8d69976 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/helpers.go @@ -0,0 +1,764 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +func perfstatcpu2cpu(n *C.perfstat_cpu_t) CPU { + var c CPU + c.Name = C.GoString(&n.name[0]) + c.User = int64(n.user) + c.Sys = int64(n.sys) + c.Idle = int64(n.idle) + c.Wait = int64(n.wait) + c.PSwitch = int64(n.pswitch) + c.Syscall = int64(n.syscall) + c.Sysread = int64(n.sysread) + c.Syswrite = int64(n.syswrite) + c.Sysfork = int64(n.sysfork) + c.Sysexec = int64(n.sysexec) + c.Readch = int64(n.readch) + c.Writech = int64(n.writech) + c.Bread = int64(n.bread) + c.Bwrite = int64(n.bwrite) + c.Lread = int64(n.lread) + c.Lwrite = int64(n.lwrite) + c.Phread = int64(n.phread) + c.Phwrite = int64(n.phwrite) + c.Iget = int64(n.iget) + c.Namei = int64(n.namei) + c.Dirblk = int64(n.dirblk) + c.Msg = int64(n.msg) + c.Sema = int64(n.sema) + c.MinFaults = int64(n.minfaults) + c.MajFaults = int64(n.majfaults) + c.PUser = int64(n.puser) + c.PSys = int64(n.psys) + c.PIdle = int64(n.pidle) + c.PWait = int64(n.pwait) + c.RedispSD0 = int64(n.redisp_sd0) + c.RedispSD1 = int64(n.redisp_sd1) + c.RedispSD2 = int64(n.redisp_sd2) + c.RedispSD3 = int64(n.redisp_sd3) + c.RedispSD4 = int64(n.redisp_sd4) + c.RedispSD5 = int64(n.redisp_sd5) + c.MigrationPush = int64(n.migration_push) + c.MigrationS3grq = int64(n.migration_S3grq) + c.MigrationS3pul = int64(n.migration_S3pul) + c.InvolCSwitch = int64(n.invol_cswitch) + c.VolCSwitch = int64(n.vol_cswitch) + c.RunQueue = int64(n.runque) + c.Bound = int64(n.bound) + c.DecrIntrs = int64(n.decrintrs) + c.MpcRIntrs = int64(n.mpcrintrs) + c.MpcSIntrs = int64(n.mpcsintrs) + c.SoftIntrs = int64(n.softintrs) + c.DevIntrs = int64(n.devintrs) + c.PhantIntrs = int64(n.phantintrs) + c.IdleDonatedPurr = int64(n.idle_donated_purr) + c.IdleDonatedSpurr = int64(n.idle_donated_spurr) + c.BusyDonatedPurr = int64(n.busy_donated_purr) + c.BusyDonatedSpurr = int64(n.busy_donated_spurr) + c.IdleStolenPurr = int64(n.idle_stolen_purr) + c.IdleStolenSpurr = int64(n.idle_stolen_spurr) + c.BusyStolenPurr = int64(n.busy_stolen_purr) + c.BusyStolenSpurr = int64(n.busy_stolen_spurr) + c.Hpi = int64(n.hpi) + c.Hpit = int64(n.hpit) + c.PUserSpurr = int64(n.puser_spurr) + c.PSysSpurr = int64(n.psys_spurr) + c.PIdleSpurr = int64(n.pidle_spurr) + c.PWaitSpurr = int64(n.pwait_spurr) + c.SpurrFlag = int32(n.spurrflag) + c.LocalDispatch = int64(n.localdispatch) + c.NearDispatch = int64(n.neardispatch) + c.FarDispatch = int64(n.fardispatch) + c.CSwitches = int64(n.cswitches) + c.Version = int64(n.version) + c.TbLast = int64(n.tb_last) + c.State = int(n.state) + c.VtbLast = int64(n.vtb_last) + c.ICountLast = int64(n.icount_last) + return c +} + +func perfstatcputotal2cputotal(n *C.perfstat_cpu_total_t) CPUTotal { + var c CPUTotal + c.NCpus = int(n.ncpus) + c.NCpusCfg = int(n.ncpus_cfg) + c.Description = C.GoString(&n.description[0]) + c.ProcessorHz = int64(n.processorHZ) + c.User = int64(n.user) + c.Sys = int64(n.sys) + c.Idle = int64(n.idle) + c.Wait = int64(n.wait) + c.PSwitch = int64(n.pswitch) + c.Syscall = int64(n.syscall) + c.Sysread = int64(n.sysread) + c.Syswrite = int64(n.syswrite) + c.Sysfork = int64(n.sysfork) + c.Sysexec = int64(n.sysexec) + c.Readch = int64(n.readch) + c.Writech = int64(n.writech) + c.DevIntrs = int64(n.devintrs) + c.SoftIntrs = int64(n.softintrs) + c.Lbolt = int64(n.lbolt) + c.LoadAvg1 = (float32(n.loadavg[0]) / (1 << C.SBITS)) + c.LoadAvg5 = (float32(n.loadavg[1]) / (1 << C.SBITS)) + c.LoadAvg15 = (float32(n.loadavg[2]) / (1 << C.SBITS)) + c.RunQueue = int64(n.runque) + c.SwpQueue = int64(n.swpque) + c.Bread = int64(n.bread) + c.Bwrite = int64(n.bwrite) + c.Lread = int64(n.lread) + c.Lwrite = int64(n.lwrite) + c.Phread = int64(n.phread) + c.Phwrite = int64(n.phwrite) + c.RunOcc = int64(n.runocc) + c.SwpOcc = int64(n.swpocc) + c.Iget = int64(n.iget) + c.Namei = int64(n.namei) + c.Dirblk = int64(n.dirblk) + c.Msg = int64(n.msg) + c.Sema = int64(n.sema) + c.RcvInt = int64(n.rcvint) + c.XmtInt = int64(n.xmtint) + c.MdmInt = int64(n.mdmint) + c.TtyRawInch = int64(n.tty_rawinch) + c.TtyCanInch = int64(n.tty_caninch) + c.TtyRawOutch = int64(n.tty_rawoutch) + c.Ksched = int64(n.ksched) + c.Koverf = int64(n.koverf) + c.Kexit = int64(n.kexit) + c.Rbread = int64(n.rbread) + c.Rcread = int64(n.rcread) + c.Rbwrt = int64(n.rbwrt) + c.Rcwrt = int64(n.rcwrt) + c.Traps = int64(n.traps) + c.NCpusHigh = int64(n.ncpus_high) + c.PUser = int64(n.puser) + c.PSys = int64(n.psys) + c.PIdle = int64(n.pidle) + c.PWait = int64(n.pwait) + c.DecrIntrs = int64(n.decrintrs) + c.MpcRIntrs = int64(n.mpcrintrs) + c.MpcSIntrs = int64(n.mpcsintrs) + c.PhantIntrs = int64(n.phantintrs) + c.IdleDonatedPurr = int64(n.idle_donated_purr) + c.IdleDonatedSpurr = int64(n.idle_donated_spurr) + c.BusyDonatedPurr = int64(n.busy_donated_purr) + c.BusyDonatedSpurr = int64(n.busy_donated_spurr) + c.IdleStolenPurr = int64(n.idle_stolen_purr) + c.IdleStolenSpurr = int64(n.idle_stolen_spurr) + c.BusyStolenPurr = int64(n.busy_stolen_purr) + c.BusyStolenSpurr = int64(n.busy_stolen_spurr) + c.IOWait = int32(n.iowait) + c.PhysIO = int32(n.physio) + c.TWait = int64(n.twait) + c.Hpi = int64(n.hpi) + c.Hpit = int64(n.hpit) + c.PUserSpurr = int64(n.puser_spurr) + c.PSysSpurr = int64(n.psys_spurr) + c.PIdleSpurr = int64(n.pidle_spurr) + c.PWaitSpurr = int64(n.pwait_spurr) + c.SpurrFlag = int(n.spurrflag) + c.Version = int64(n.version) + c.TbLast = int64(n.tb_last) + c.PurrCoalescing = int64(n.purr_coalescing) + c.SpurrCoalescing = int64(n.spurr_coalescing) + return c +} + +func perfstatcpuutil2cpuutil(n *C.perfstat_cpu_util_t) CPUUtil { + var c CPUUtil + + c.Version = int64(n.version) + c.CpuID = C.GoString(&n.cpu_id[0]) + c.Entitlement = float32(n.entitlement) + c.UserPct = float32(n.user_pct) + c.KernPct = float32(n.kern_pct) + c.IdlePct = float32(n.idle_pct) + c.WaitPct = float32(n.wait_pct) + c.PhysicalBusy = float32(n.physical_busy) + c.PhysicalConsumed = float32(n.physical_consumed) + c.FreqPct = float32(n.freq_pct) + c.EntitlementPct = float32(n.entitlement_pct) + c.BusyPct = float32(n.busy_pct) + c.IdleDonatedPct = float32(n.idle_donated_pct) + c.BusyDonatedPct = float32(n.busy_donated_pct) + c.IdleStolenPct = float32(n.idle_stolen_pct) + c.BusyStolenPct = float32(n.busy_stolen_pct) + c.LUserPct = float32(n.l_user_pct) + c.LKernPct = float32(n.l_kern_pct) + c.LIdlePct = float32(n.l_idle_pct) + c.LWaitPct = float32(n.l_wait_pct) + c.DeltaTime = int64(n.delta_time) + + return c +} + +func perfstatdisktotal2disktotal(n C.perfstat_disk_total_t) DiskTotal { + var d DiskTotal + + d.Number = int32(n.number) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Wblks = int64(n.wblks) + d.Rblks = int64(n.rblks) + d.Time = int64(n.time) + d.Version = int64(n.version) + d.Rserv = int64(n.rserv) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.RTimeOut = int64(n.rtimeout) + d.RFailed = int64(n.rfailed) + d.Wserv = int64(n.wserv) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WTimeOut = int64(n.wtimeout) + d.WFailed = int64(n.wfailed) + d.WqDepth = int64(n.wq_depth) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + + return d +} + +func perfstatdiskadapter2diskadapter(n *C.perfstat_diskadapter_t) DiskAdapter { + var d DiskAdapter + + d.Name = C.GoString(&n.name[0]) + d.Description = C.GoString(&n.description[0]) + d.Number = int32(n.number) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Rblks = int64(n.rblks) + d.Wblks = int64(n.wblks) + d.Time = int64(n.time) + d.Version = int64(n.version) + d.AdapterType = int64(n.adapter_type) + d.DkBSize = int64(n.dk_bsize) + d.DkRserv = int64(n.dk_rserv) + d.DkWserv = int64(n.dk_wserv) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QFull = int64(n.q_full) + d.QSampled = int64(n.q_sampled) + + return d +} + +func perfstatpartitionconfig2partitionconfig(n C.perfstat_partition_config_t) PartitionConfig { + var p PartitionConfig + p.Version = int64(n.version) + p.Name = C.GoString(&n.partitionname[0]) + p.Node = C.GoString(&n.nodename[0]) + p.Conf.SmtCapable = (n.conf[0] & (1 << 7)) > 0 + p.Conf.SmtEnabled = (n.conf[0] & (1 << 6)) > 0 + p.Conf.LparCapable = (n.conf[0] & (1 << 5)) > 0 + p.Conf.LparEnabled = (n.conf[0] & (1 << 4)) > 0 + p.Conf.SharedCapable = (n.conf[0] & (1 << 3)) > 0 + p.Conf.SharedEnabled = (n.conf[0] & (1 << 2)) > 0 + p.Conf.DLparCapable = (n.conf[0] & (1 << 1)) > 0 + p.Conf.Capped = (n.conf[0] & (1 << 0)) > 0 + p.Conf.Kernel64bit = (n.conf[1] & (1 << 7)) > 0 + p.Conf.PoolUtilAuthority = (n.conf[1] & (1 << 6)) > 0 + p.Conf.DonateCapable = (n.conf[1] & (1 << 5)) > 0 + p.Conf.DonateEnabled = (n.conf[1] & (1 << 4)) > 0 + p.Conf.AmsCapable = (n.conf[1] & (1 << 3)) > 0 + p.Conf.AmsEnabled = (n.conf[1] & (1 << 2)) > 0 + p.Conf.PowerSave = (n.conf[1] & (1 << 1)) > 0 + p.Conf.AmeEnabled = (n.conf[1] & (1 << 0)) > 0 + p.Conf.SharedExtended = (n.conf[2] & (1 << 7)) > 0 + p.Number = int32(n.partitionnum) + p.GroupID = int32(n.groupid) + p.ProcessorFamily = C.GoString(&n.processorFamily[0]) + p.ProcessorModel = C.GoString(&n.processorModel[0]) + p.MachineID = C.GoString(&n.machineID[0]) + p.ProcessorMhz = float64(C.get_partition_mhz(n)) + p.NumProcessors.Online = int64(n.numProcessors.online) + p.NumProcessors.Max = int64(n.numProcessors.max) + p.NumProcessors.Min = int64(n.numProcessors.min) + p.NumProcessors.Desired = int64(n.numProcessors.desired) + p.OSName = C.GoString(&n.OSName[0]) + p.OSVersion = C.GoString(&n.OSVersion[0]) + p.OSBuild = C.GoString(&n.OSBuild[0]) + p.LCpus = int32(n.lcpus) + p.SmtThreads = int32(n.smtthreads) + p.Drives = int32(n.drives) + p.NetworkAdapters = int32(n.nw_adapters) + p.CpuCap.Online = int64(n.cpucap.online) + p.CpuCap.Max = int64(n.cpucap.max) + p.CpuCap.Min = int64(n.cpucap.min) + p.CpuCap.Desired = int64(n.cpucap.desired) + p.Weightage = int32(n.cpucap_weightage) + p.EntCapacity = int32(n.entitled_proc_capacity) + p.VCpus.Online = int64(n.vcpus.online) + p.VCpus.Max = int64(n.vcpus.max) + p.VCpus.Min = int64(n.vcpus.min) + p.VCpus.Desired = int64(n.vcpus.desired) + p.PoolID = int32(n.processor_poolid) + p.ActiveCpusInPool = int32(n.activecpusinpool) + p.PoolWeightage = int32(n.cpupool_weightage) + p.SharedPCpu = int32(n.sharedpcpu) + p.MaxPoolCap = int32(n.maxpoolcap) + p.EntPoolCap = int32(n.entpoolcap) + p.Mem.Online = int64(n.mem.online) + p.Mem.Max = int64(n.mem.max) + p.Mem.Min = int64(n.mem.min) + p.Mem.Desired = int64(n.mem.desired) + p.MemWeightage = int32(n.mem_weightage) + p.TotalIOMemoryEntitlement = int64(n.totiomement) + p.MemPoolID = int32(n.mempoolid) + p.HyperPgSize = int64(n.hyperpgsize) + p.ExpMem.Online = int64(n.exp_mem.online) + p.ExpMem.Max = int64(n.exp_mem.max) + p.ExpMem.Min = int64(n.exp_mem.min) + p.ExpMem.Desired = int64(n.exp_mem.desired) + p.TargetMemExpFactor = int64(n.targetmemexpfactor) + p.TargetMemExpSize = int64(n.targetmemexpsize) + p.SubProcessorMode = int32(n.subprocessor_mode) + return p +} + +func perfstatmemorytotal2memorytotal(n C.perfstat_memory_total_t) MemoryTotal { + var m MemoryTotal + m.VirtualTotal = int64(n.virt_total) + m.RealTotal = int64(n.real_total) + m.RealFree = int64(n.real_free) + m.RealPinned = int64(n.real_pinned) + m.RealInUse = int64(n.real_inuse) + m.BadPages = int64(n.pgbad) + m.PageFaults = int64(n.pgexct) + m.PageIn = int64(n.pgins) + m.PageOut = int64(n.pgouts) + m.PgSpIn = int64(n.pgspins) + m.PgSpOut = int64(n.pgspouts) + m.Scans = int64(n.scans) + m.Cycles = int64(n.cycles) + m.PgSteals = int64(n.pgsteals) + m.NumPerm = int64(n.numperm) + m.PgSpTotal = int64(n.pgsp_total) + m.PgSpFree = int64(n.pgsp_free) + m.PgSpRsvd = int64(n.pgsp_rsvd) + m.RealSystem = int64(n.real_system) + m.RealUser = int64(n.real_user) + m.RealProcess = int64(n.real_process) + m.VirtualActive = int64(n.virt_active) + m.IOME = int64(n.iome) + m.IOMU = int64(n.iomu) + m.IOHWM = int64(n.iohwm) + m.PMem = int64(n.pmem) + m.CompressedTotal = int64(n.comprsd_total) + m.CompressedWSegPg = int64(n.comprsd_wseg_pgs) + m.CPgIn = int64(n.cpgins) + m.CPgOut = int64(n.cpgouts) + m.TrueSize = int64(n.true_size) + m.ExpandedMemory = int64(n.expanded_memory) + m.CompressedWSegSize = int64(n.comprsd_wseg_size) + m.TargetCPoolSize = int64(n.target_cpool_size) + m.MaxCPoolSize = int64(n.max_cpool_size) + m.MinUCPoolSize = int64(n.min_ucpool_size) + m.CPoolSize = int64(n.cpool_size) + m.UCPoolSize = int64(n.ucpool_size) + m.CPoolInUse = int64(n.cpool_inuse) + m.UCPoolInUse = int64(n.ucpool_inuse) + m.Version = int64(n.version) + m.RealAvailable = int64(n.real_avail) + m.BytesCoalesced = int64(n.bytes_coalesced) + m.BytesCoalescedMemPool = int64(n.bytes_coalesced_mempool) + + return m +} + +func perfstatnetinterfacetotal2netifacetotal(n C.perfstat_netinterface_total_t) NetIfaceTotal { + var i NetIfaceTotal + + i.Number = int32(n.number) + i.IPackets = int64(n.ipackets) + i.IBytes = int64(n.ibytes) + i.IErrors = int64(n.ierrors) + i.OPackets = int64(n.opackets) + i.OBytes = int64(n.obytes) + i.OErrors = int64(n.oerrors) + i.Collisions = int64(n.collisions) + i.XmitDrops = int64(n.xmitdrops) + i.Version = int64(n.version) + + return i +} + +func perfstatdisk2disk(n *C.perfstat_disk_t) Disk { + var d Disk + + d.Name = C.GoString(&n.name[0]) + d.Description = C.GoString(&n.description[0]) + d.VGName = C.GoString(&n.vgname[0]) + d.Size = int64(n.size) + d.Free = int64(n.free) + d.BSize = int64(n.bsize) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Wblks = int64(n.wblks) + d.Rblks = int64(n.rblks) + d.QDepth = int64(n.qdepth) + d.Time = int64(n.time) + d.Adapter = C.GoString(&n.adapter[0]) + d.PathsCount = int32(n.paths_count) + d.QFull = int64(n.q_full) + d.Rserv = int64(n.rserv) + d.RTimeOut = int64(n.rtimeout) + d.Rfailed = int64(n.rfailed) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.Wserv = int64(n.wserv) + d.WTimeOut = int64(n.wtimeout) + d.Wfailed = int64(n.wfailed) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QSampled = int64(n.q_sampled) + d.Version = int64(n.version) + d.PseudoDisk = (n.dk_type[0] & (1 << 7)) > 0 + d.VTDisk = (n.dk_type[0] & (1 << 6)) > 0 + + return d +} + +func perfstatdiskpath2diskpath(n *C.perfstat_diskpath_t) DiskPath { + var d DiskPath + + d.Name = C.GoString(&n.name[0]) + d.XRate = int64(n.xrate) + d.Xfers = int64(n.xfers) + d.Rblks = int64(n.rblks) + d.Wblks = int64(n.wblks) + d.Time = int64(n.time) + d.Adapter = C.GoString(&n.adapter[0]) + d.QFull = int64(n.q_full) + d.Rserv = int64(n.rserv) + d.RTimeOut = int64(n.rtimeout) + d.Rfailed = int64(n.rfailed) + d.MinRserv = int64(n.min_rserv) + d.MaxRserv = int64(n.max_rserv) + d.Wserv = int64(n.wserv) + d.WTimeOut = int64(n.wtimeout) + d.Wfailed = int64(n.wfailed) + d.MinWserv = int64(n.min_wserv) + d.MaxWserv = int64(n.max_wserv) + d.WqDepth = int64(n.wq_depth) + d.WqSampled = int64(n.wq_sampled) + d.WqTime = int64(n.wq_time) + d.WqMinTime = int64(n.wq_min_time) + d.WqMaxTime = int64(n.wq_max_time) + d.QSampled = int64(n.q_sampled) + d.Version = int64(n.version) + + return d +} + +func perfstatfcstat2fcadapter(n *C.perfstat_fcstat_t) FCAdapter { + var f FCAdapter + + f.Version = int64(n.version) + f.Name = C.GoString(&n.name[0]) + f.State = int32(n.state) + f.InputRequests = int64(n.InputRequests) + f.OutputRequests = int64(n.OutputRequests) + f.InputBytes = int64(n.InputBytes) + f.OutputBytes = int64(n.OutputBytes) + f.EffMaxTransfer = int64(n.EffMaxTransfer) + f.NoDMAResourceCnt = int64(n.NoDMAResourceCnt) + f.NoCmdResourceCnt = int64(n.NoCmdResourceCnt) + f.AttentionType = int32(n.AttentionType) + f.SecondsSinceLastReset = int64(n.SecondsSinceLastReset) + f.TxFrames = int64(n.TxFrames) + f.TxWords = int64(n.TxWords) + f.RxFrames = int64(n.RxFrames) + f.RxWords = int64(n.RxWords) + f.LIPCount = int64(n.LIPCount) + f.NOSCount = int64(n.NOSCount) + f.ErrorFrames = int64(n.ErrorFrames) + f.DumpedFrames = int64(n.DumpedFrames) + f.LinkFailureCount = int64(n.LinkFailureCount) + f.LossofSyncCount = int64(n.LossofSyncCount) + f.LossofSignal = int64(n.LossofSignal) + f.PrimitiveSeqProtocolErrCount = int64(n.PrimitiveSeqProtocolErrCount) + f.InvalidTxWordCount = int64(n.InvalidTxWordCount) + f.InvalidCRCCount = int64(n.InvalidCRCCount) + f.PortFcId = int64(n.PortFcId) + f.PortSpeed = int64(n.PortSpeed) + f.PortType = C.GoString(&n.PortType[0]) + f.PortWWN = int64(n.PortWWN) + f.PortSupportedSpeed = int64(n.PortSupportedSpeed) + f.AdapterType = int(n.adapter_type) + f.VfcName = C.GoString(&n.vfc_name[0]) + f.ClientPartName = C.GoString(&n.client_part_name[0]) + + return f +} + +func perfstatlogicalvolume2logicalvolume(n *C.perfstat_logicalvolume_t) LogicalVolume { + var l LogicalVolume + + l.Name = C.GoString(&n.name[0]) + l.VGName = C.GoString(&n.vgname[0]) + l.OpenClose = int64(n.open_close) + l.State = int64(n.state) + l.MirrorPolicy = int64(n.mirror_policy) + l.MirrorWriteConsistency = int64(n.mirror_write_consistency) + l.WriteVerify = int64(n.write_verify) + l.PPsize = int64(n.ppsize) + l.LogicalPartitions = int64(n.logical_partitions) + l.Mirrors = int32(n.mirrors) + l.IOCnt = int64(n.iocnt) + l.KBReads = int64(n.kbreads) + l.KBWrites = int64(n.kbwrites) + l.Version = int64(n.version) + + return l +} + +func perfstatvolumegroup2volumegroup(n *C.perfstat_volumegroup_t) VolumeGroup { + var v VolumeGroup + + v.Name = C.GoString(&n.name[0]) + v.TotalDisks = int64(n.total_disks) + v.ActiveDisks = int64(n.active_disks) + v.TotalLogicalVolumes = int64(n.total_logical_volumes) + v.OpenedLogicalVolumes = int64(n.opened_logical_volumes) + v.IOCnt = int64(n.iocnt) + v.KBReads = int64(n.kbreads) + v.KBWrites = int64(n.kbwrites) + v.Version = int64(n.version) + v.VariedState = int(n.variedState) + + return v +} + +func perfstatmemorypage2memorypage(n *C.perfstat_memory_page_t) MemoryPage { + var m MemoryPage + + m.PSize = int64(n.psize) + m.RealTotal = int64(n.real_total) + m.RealFree = int64(n.real_free) + m.RealPinned = int64(n.real_pinned) + m.RealInUse = int64(n.real_inuse) + m.PgExct = int64(n.pgexct) + m.PgIns = int64(n.pgins) + m.PgOuts = int64(n.pgouts) + m.PgSpIns = int64(n.pgspins) + m.PgSpOuts = int64(n.pgspouts) + m.Scans = int64(n.scans) + m.Cycles = int64(n.cycles) + m.PgSteals = int64(n.pgsteals) + m.NumPerm = int64(n.numperm) + m.NumPgSp = int64(n.numpgsp) + m.RealSystem = int64(n.real_system) + m.RealUser = int64(n.real_user) + m.RealProcess = int64(n.real_process) + m.VirtActive = int64(n.virt_active) + m.ComprsdTotal = int64(n.comprsd_total) + m.ComprsdWsegPgs = int64(n.comprsd_wseg_pgs) + m.CPgIns = int64(n.cpgins) + m.CPgOuts = int64(n.cpgouts) + m.CPoolInUse = int64(n.cpool_inuse) + m.UCPoolSize = int64(n.ucpool_size) + m.ComprsdWsegSize = int64(n.comprsd_wseg_size) + m.Version = int64(n.version) + m.RealAvail = int64(n.real_avail) + + return m +} + +func perfstatnetbuffer2netbuffer(n *C.perfstat_netbuffer_t) NetBuffer { + var b NetBuffer + + b.Name = C.GoString(&n.name[0]) + b.InUse = int64(n.inuse) + b.Calls = int64(n.calls) + b.Delayed = int64(n.delayed) + b.Free = int64(n.free) + b.Failed = int64(n.failed) + b.HighWatermark = int64(n.highwatermark) + b.Freed = int64(n.freed) + b.Version = int64(n.version) + + return b +} + +func perfstatnetinterface2netiface(n *C.perfstat_netinterface_t) NetIface { + var i NetIface + + i.Name = C.GoString(&n.name[0]) + i.Description = C.GoString(&n.description[0]) + i.Type = uint8(n._type) + i.MTU = int64(n.mtu) + i.IPackets = int64(n.ipackets) + i.IBytes = int64(n.ibytes) + i.IErrors = int64(n.ierrors) + i.OPackets = int64(n.opackets) + i.OBytes = int64(n.obytes) + i.OErrors = int64(n.oerrors) + i.Collisions = int64(n.collisions) + i.Bitrate = int64(n.bitrate) + i.XmitDrops = int64(n.xmitdrops) + i.Version = int64(n.version) + i.IfIqDrops = int64(n.if_iqdrops) + i.IfArpDrops = int64(n.if_arpdrops) + + return i +} + +func perfstatnetadapter2netadapter(n *C.perfstat_netadapter_t) NetAdapter { + var i NetAdapter + + i.Version = int64(n.version) + i.Name = C.GoString(&n.name[0]) + i.TxPackets = int64(n.tx_packets) + i.TxBytes = int64(n.tx_bytes) + i.TxInterrupts = int64(n.tx_interrupts) + i.TxErrors = int64(n.tx_errors) + i.TxPacketsDropped = int64(n.tx_packets_dropped) + i.TxQueueSize = int64(n.tx_queue_size) + i.TxQueueLen = int64(n.tx_queue_len) + i.TxQueueOverflow = int64(n.tx_queue_overflow) + i.TxBroadcastPackets = int64(n.tx_broadcast_packets) + i.TxMulticastPackets = int64(n.tx_multicast_packets) + i.TxCarrierSense = int64(n.tx_carrier_sense) + i.TxDMAUnderrun = int64(n.tx_DMA_underrun) + i.TxLostCTSErrors = int64(n.tx_lost_CTS_errors) + i.TxMaxCollisionErrors = int64(n.tx_max_collision_errors) + i.TxLateCollisionErrors = int64(n.tx_late_collision_errors) + i.TxDeferred = int64(n.tx_deferred) + i.TxTimeoutErrors = int64(n.tx_timeout_errors) + i.TxSingleCollisionCount = int64(n.tx_single_collision_count) + i.TxMultipleCollisionCount = int64(n.tx_multiple_collision_count) + i.RxPackets = int64(n.rx_packets) + i.RxBytes = int64(n.rx_bytes) + i.RxInterrupts = int64(n.rx_interrupts) + i.RxErrors = int64(n.rx_errors) + i.RxPacketsDropped = int64(n.rx_packets_dropped) + i.RxBadPackets = int64(n.rx_bad_packets) + i.RxMulticastPackets = int64(n.rx_multicast_packets) + i.RxBroadcastPackets = int64(n.rx_broadcast_packets) + i.RxCRCErrors = int64(n.rx_CRC_errors) + i.RxDMAOverrun = int64(n.rx_DMA_overrun) + i.RxAlignmentErrors = int64(n.rx_alignment_errors) + i.RxNoResourceErrors = int64(n.rx_noresource_errors) + i.RxCollisionErrors = int64(n.rx_collision_errors) + i.RxPacketTooShortErrors = int64(n.rx_packet_tooshort_errors) + i.RxPacketTooLongErrors = int64(n.rx_packet_toolong_errors) + i.RxPacketDiscardedByAdapter = int64(n.rx_packets_discardedbyadapter) + i.AdapterType = int32(n.adapter_type) + + return i +} + +func perfstatpagingspace2pagingspace(n *C.perfstat_pagingspace_t) PagingSpace { + var i PagingSpace + + i.Name = C.GoString(&n.name[0]) + i.Type = uint8(n._type) + i.VGName = C.GoString(C.get_ps_vgname(n)) + i.Hostname = C.GoString(C.get_ps_hostname(n)) + i.Filename = C.GoString(C.get_ps_filename(n)) + i.LPSize = int64(n.lp_size) + i.MBSize = int64(n.mb_size) + i.MBUsed = int64(n.mb_used) + i.IOPending = int64(n.io_pending) + i.Active = uint8(n.active) + i.Automatic = uint8(n.automatic) + i.Version = int64(n.version) + + return i +} + +func perfstatprocess2process(n *C.perfstat_process_t) Process { + var i Process + + i.Version = int64(n.version) + i.PID = int64(n.pid) + i.ProcessName = C.GoString(&n.proc_name[0]) + i.Priority = int32(n.proc_priority) + i.NumThreads = int64(n.num_threads) + i.UID = int64(n.proc_uid) + i.ClassID = int64(n.proc_classid) + i.Size = int64(n.proc_size) + i.RealMemData = int64(n.proc_real_mem_data) + i.RealMemText = int64(n.proc_real_mem_text) + i.VirtMemData = int64(n.proc_virt_mem_data) + i.VirtMemText = int64(n.proc_virt_mem_text) + i.SharedLibDataSize = int64(n.shared_lib_data_size) + i.HeapSize = int64(n.heap_size) + i.RealInUse = int64(n.real_inuse) + i.VirtInUse = int64(n.virt_inuse) + i.Pinned = int64(n.pinned) + i.PgSpInUse = int64(n.pgsp_inuse) + i.FilePages = int64(n.filepages) + i.RealInUseMap = int64(n.real_inuse_map) + i.VirtInUseMap = int64(n.virt_inuse_map) + i.PinnedInUseMap = int64(n.pinned_inuse_map) + i.UCpuTime = float64(n.ucpu_time) + i.SCpuTime = float64(n.scpu_time) + i.LastTimeBase = int64(n.last_timebase) + i.InBytes = int64(n.inBytes) + i.OutBytes = int64(n.outBytes) + i.InOps = int64(n.inOps) + i.OutOps = int64(n.outOps) + + return i +} + +func perfstatthread2thread(n *C.perfstat_thread_t) Thread { + var i Thread + + i.TID = int64(n.tid) + i.PID = int64(n.pid) + i.CpuID = int64(n.cpuid) + i.UCpuTime = float64(n.ucpu_time) + i.SCpuTime = float64(n.scpu_time) + i.LastTimeBase = int64(n.last_timebase) + i.Version = int64(n.version) + + return i +} + +func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem { + var i FileSystem + + i.Device = C.GoString(n.devname) + i.MountPoint = C.GoString(n.fsname) + i.FSType = int(n.fstype) + i.Flags = int(n.flags) + i.TotalBlocks = int64(n.totalblks) + i.FreeBlocks = int64(n.freeblks) + i.TotalInodes = int64(n.totalinodes) + i.FreeInodes = int64(n.freeinodes) + + return i +} diff --git a/vendor/github.com/power-devops/perfstat/lparstat.go b/vendor/github.com/power-devops/perfstat/lparstat.go new file mode 100644 index 00000000..0ce35e3c --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/lparstat.go @@ -0,0 +1,26 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +*/ +import "C" + +import ( + "fmt" +) + +func PartitionStat() (*PartitionConfig, error) { + var part C.perfstat_partition_config_t + + rc := C.perfstat_partition_config(nil, &part, C.sizeof_perfstat_partition_config_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_partition_config() error") + } + p := perfstatpartitionconfig2partitionconfig(part) + return &p, nil + +} diff --git a/vendor/github.com/power-devops/perfstat/lvmstat.go b/vendor/github.com/power-devops/perfstat/lvmstat.go new file mode 100644 index 00000000..eb2064c8 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/lvmstat.go @@ -0,0 +1,72 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func LogicalVolumeStat() ([]LogicalVolume, error) { + var lv *C.perfstat_logicalvolume_t + var lvname C.perfstat_id_t + + numlvs := C.perfstat_logicalvolume(nil, nil, C.sizeof_perfstat_logicalvolume_t, 0) + if numlvs <= 0 { + return nil, fmt.Errorf("perfstat_logicalvolume() error") + } + + lv_len := C.sizeof_perfstat_logicalvolume_t * C.ulong(numlvs) + lv = (*C.perfstat_logicalvolume_t)(C.malloc(lv_len)) + defer C.free(unsafe.Pointer(lv)) + C.strcpy(&lvname.name[0], C.CString("")) + r := C.perfstat_logicalvolume(&lvname, lv, C.sizeof_perfstat_logicalvolume_t, numlvs) + if r < 0 { + return nil, fmt.Errorf("perfstat_logicalvolume() error") + } + lvs := make([]LogicalVolume, r) + for i := 0; i < int(r); i++ { + l := C.get_logicalvolume_stat(lv, C.int(i)) + if l != nil { + lvs[i] = perfstatlogicalvolume2logicalvolume(l) + } + } + return lvs, nil +} + +func VolumeGroupStat() ([]VolumeGroup, error) { + var vg *C.perfstat_volumegroup_t + var vgname C.perfstat_id_t + + numvgs := C.perfstat_volumegroup(nil, nil, C.sizeof_perfstat_volumegroup_t, 0) + if numvgs <= 0 { + return nil, fmt.Errorf("perfstat_volumegroup() error") + } + + vg_len := C.sizeof_perfstat_volumegroup_t * C.ulong(numvgs) + vg = (*C.perfstat_volumegroup_t)(C.malloc(vg_len)) + defer C.free(unsafe.Pointer(vg)) + C.strcpy(&vgname.name[0], C.CString("")) + r := C.perfstat_volumegroup(&vgname, vg, C.sizeof_perfstat_volumegroup_t, numvgs) + if r < 0 { + return nil, fmt.Errorf("perfstat_volumegroup() error") + } + vgs := make([]VolumeGroup, r) + for i := 0; i < int(r); i++ { + v := C.get_volumegroup_stat(vg, C.int(i)) + if v != nil { + vgs[i] = perfstatvolumegroup2volumegroup(v) + } + } + return vgs, nil +} diff --git a/vendor/github.com/power-devops/perfstat/memstat.go b/vendor/github.com/power-devops/perfstat/memstat.go new file mode 100644 index 00000000..d211a73a --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/memstat.go @@ -0,0 +1,84 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func MemoryTotalStat() (*MemoryTotal, error) { + var memory C.perfstat_memory_total_t + + rc := C.perfstat_memory_total(nil, &memory, C.sizeof_perfstat_memory_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_memory_total() error") + } + m := perfstatmemorytotal2memorytotal(memory) + return &m, nil +} + +func MemoryPageStat() ([]MemoryPage, error) { + var mempage *C.perfstat_memory_page_t + var fps C.perfstat_psize_t + + numps := C.perfstat_memory_page(nil, nil, C.sizeof_perfstat_memory_page_t, 0) + if numps < 1 { + return nil, fmt.Errorf("perfstat_memory_page() error") + } + + mp_len := C.sizeof_perfstat_memory_page_t * C.ulong(numps) + mempage = (*C.perfstat_memory_page_t)(C.malloc(mp_len)) + defer C.free(unsafe.Pointer(mempage)) + fps.psize = C.FIRST_PSIZE + r := C.perfstat_memory_page(&fps, mempage, C.sizeof_perfstat_memory_page_t, numps) + if r < 1 { + return nil, fmt.Errorf("perfstat_memory_page() error") + } + ps := make([]MemoryPage, r) + for i := 0; i < int(r); i++ { + p := C.get_memory_page_stat(mempage, C.int(i)) + if p != nil { + ps[i] = perfstatmemorypage2memorypage(p) + } + } + return ps, nil +} + +func PagingSpaceStat() ([]PagingSpace, error) { + var pspace *C.perfstat_pagingspace_t + var fps C.perfstat_id_t + + numps := C.perfstat_pagingspace(nil, nil, C.sizeof_perfstat_pagingspace_t, 0) + if numps <= 0 { + return nil, fmt.Errorf("perfstat_pagingspace() error") + } + + ps_len := C.sizeof_perfstat_pagingspace_t * C.ulong(numps) + pspace = (*C.perfstat_pagingspace_t)(C.malloc(ps_len)) + defer C.free(unsafe.Pointer(pspace)) + C.strcpy(&fps.name[0], C.CString(C.FIRST_PAGINGSPACE)) + r := C.perfstat_pagingspace(&fps, pspace, C.sizeof_perfstat_pagingspace_t, numps) + if r < 1 { + return nil, fmt.Errorf("perfstat_pagingspace() error") + } + ps := make([]PagingSpace, r) + for i := 0; i < int(r); i++ { + p := C.get_pagingspace_stat(pspace, C.int(i)) + if p != nil { + ps[i] = perfstatpagingspace2pagingspace(p) + } + } + return ps, nil +} diff --git a/vendor/github.com/power-devops/perfstat/netstat.go b/vendor/github.com/power-devops/perfstat/netstat.go new file mode 100644 index 00000000..4070da21 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/netstat.go @@ -0,0 +1,117 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func NetIfaceTotalStat() (*NetIfaceTotal, error) { + var nif C.perfstat_netinterface_total_t + + rc := C.perfstat_netinterface_total(nil, &nif, C.sizeof_perfstat_netinterface_total_t, 1) + if rc != 1 { + return nil, fmt.Errorf("perfstat_netinterface_total() error") + } + n := perfstatnetinterfacetotal2netifacetotal(nif) + return &n, nil +} + +func NetBufferStat() ([]NetBuffer, error) { + var nbuf *C.perfstat_netbuffer_t + var first C.perfstat_id_t + + numbuf := C.perfstat_netbuffer(nil, nil, C.sizeof_perfstat_netbuffer_t, 0) + if numbuf < 1 { + return nil, fmt.Errorf("perfstat_netbuffer() error") + } + + nblen := C.sizeof_perfstat_netbuffer_t * C.ulong(numbuf) + nbuf = (*C.perfstat_netbuffer_t)(C.malloc(nblen)) + defer C.free(unsafe.Pointer(nbuf)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETBUFFER)) + r := C.perfstat_netbuffer(&first, nbuf, C.sizeof_perfstat_netbuffer_t, numbuf) + if r < 0 { + return nil, fmt.Errorf("perfstat_netbuffer() error") + } + nb := make([]NetBuffer, r) + for i := 0; i < int(r); i++ { + b := C.get_netbuffer_stat(nbuf, C.int(i)) + if b != nil { + nb[i] = perfstatnetbuffer2netbuffer(b) + } + } + return nb, nil +} + +func NetIfaceStat() ([]NetIface, error) { + var nif *C.perfstat_netinterface_t + var first C.perfstat_id_t + + numif := C.perfstat_netinterface(nil, nil, C.sizeof_perfstat_netinterface_t, 0) + if numif < 0 { + return nil, fmt.Errorf("perfstat_netinterface() error") + } + if numif == 0 { + return []NetIface{}, fmt.Errorf("no network interfaces found") + } + + iflen := C.sizeof_perfstat_netinterface_t * C.ulong(numif) + nif = (*C.perfstat_netinterface_t)(C.malloc(iflen)) + defer C.free(unsafe.Pointer(nif)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_netinterface(&first, nif, C.sizeof_perfstat_netinterface_t, numif) + if r < 0 { + return nil, fmt.Errorf("perfstat_netinterface() error") + } + ifs := make([]NetIface, r) + for i := 0; i < int(r); i++ { + b := C.get_netinterface_stat(nif, C.int(i)) + if b != nil { + ifs[i] = perfstatnetinterface2netiface(b) + } + } + return ifs, nil +} + +func NetAdapterStat() ([]NetAdapter, error) { + var adapters *C.perfstat_netadapter_t + var first C.perfstat_id_t + + numad := C.perfstat_netadapter(nil, nil, C.sizeof_perfstat_netadapter_t, 0) + if numad < 0 { + return nil, fmt.Errorf("perfstat_netadater() error") + } + if numad == 0 { + return []NetAdapter{}, fmt.Errorf("no network adapters found") + } + + adplen := C.sizeof_perfstat_netadapter_t * C.ulong(numad) + adapters = (*C.perfstat_netadapter_t)(C.malloc(adplen)) + defer C.free(unsafe.Pointer(adapters)) + C.strcpy(&first.name[0], C.CString(C.FIRST_NETINTERFACE)) + r := C.perfstat_netadapter(&first, adapters, C.sizeof_perfstat_netadapter_t, numad) + if r < 0 { + return nil, fmt.Errorf("perfstat_netadapter() error") + } + ads := make([]NetAdapter, r) + for i := 0; i < int(r); i++ { + b := C.get_netadapter_stat(adapters, C.int(i)) + if b != nil { + ads[i] = perfstatnetadapter2netadapter(b) + } + } + return ads, nil +} diff --git a/vendor/github.com/power-devops/perfstat/procstat.go b/vendor/github.com/power-devops/perfstat/procstat.go new file mode 100644 index 00000000..ecafebd8 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/procstat.go @@ -0,0 +1,75 @@ +// +build aix + +package perfstat + +/* +#cgo LDFLAGS: -lperfstat + +#include +#include +#include + +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "unsafe" +) + +func ProcessStat() ([]Process, error) { + var proc *C.perfstat_process_t + var first C.perfstat_id_t + + numproc := C.perfstat_process(nil, nil, C.sizeof_perfstat_process_t, 0) + if numproc < 1 { + return nil, fmt.Errorf("perfstat_process() error") + } + + plen := C.sizeof_perfstat_process_t * C.ulong(numproc) + proc = (*C.perfstat_process_t)(C.malloc(plen)) + defer C.free(unsafe.Pointer(proc)) + C.strcpy(&first.name[0], C.CString("")) + r := C.perfstat_process(&first, proc, C.sizeof_perfstat_process_t, numproc) + if r < 0 { + return nil, fmt.Errorf("perfstat_process() error") + } + + ps := make([]Process, r) + for i := 0; i < int(r); i++ { + p := C.get_process_stat(proc, C.int(i)) + if p != nil { + ps[i] = perfstatprocess2process(p) + } + } + return ps, nil +} + +func ThreadStat() ([]Thread, error) { + var thread *C.perfstat_thread_t + var first C.perfstat_id_t + + numthr := C.perfstat_thread(nil, nil, C.sizeof_perfstat_thread_t, 0) + if numthr < 1 { + return nil, fmt.Errorf("perfstat_thread() error") + } + + thlen := C.sizeof_perfstat_thread_t * C.ulong(numthr) + thread = (*C.perfstat_thread_t)(C.malloc(thlen)) + defer C.free(unsafe.Pointer(thread)) + C.strcpy(&first.name[0], C.CString("")) + r := C.perfstat_thread(&first, thread, C.sizeof_perfstat_thread_t, numthr) + if r < 0 { + return nil, fmt.Errorf("perfstat_thread() error") + } + + th := make([]Thread, r) + for i := 0; i < int(r); i++ { + t := C.get_thread_stat(thread, C.int(i)) + if t != nil { + th[i] = perfstatthread2thread(t) + } + } + return th, nil +} diff --git a/vendor/github.com/power-devops/perfstat/sysconf.go b/vendor/github.com/power-devops/perfstat/sysconf.go new file mode 100644 index 00000000..c7454d03 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/sysconf.go @@ -0,0 +1,195 @@ +// +build aix + +package perfstat + +/* +#include +*/ +import "C" + +import "fmt" + +const ( + SC_ARG_MAX = 0 + SC_CHILD_MAX = 1 + SC_CLK_TCK = 2 + SC_NGROUPS_MAX = 3 + SC_OPEN_MAX = 4 + SC_STREAM_MAX = 5 + SC_TZNAME_MAX = 6 + SC_JOB_CONTROL = 7 + SC_SAVED_IDS = 8 + SC_VERSION = 9 + SC_POSIX_ARG_MAX = 10 + SC_POSIX_CHILD_MAX = 11 + SC_POSIX_LINK_MAX = 12 + SC_POSIX_MAX_CANON = 13 + SC_POSIX_MAX_INPUT = 14 + SC_POSIX_NAME_MAX = 15 + SC_POSIX_NGROUPS_MAX = 16 + SC_POSIX_OPEN_MAX = 17 + SC_POSIX_PATH_MAX = 18 + SC_POSIX_PIPE_BUF = 19 + SC_POSIX_SSIZE_MAX = 20 + SC_POSIX_STREAM_MAX = 21 + SC_POSIX_TZNAME_MAX = 22 + SC_BC_BASE_MAX = 23 + SC_BC_DIM_MAX = 24 + SC_BC_SCALE_MAX = 25 + SC_BC_STRING_MAX = 26 + SC_EQUIV_CLASS_MAX = 27 + SC_EXPR_NEST_MAX = 28 + SC_LINE_MAX = 29 + SC_RE_DUP_MAX = 30 + SC_2_VERSION = 31 + SC_2_C_DEV = 32 + SC_2_FORT_DEV = 33 + SC_2_FORT_RUN = 34 + SC_2_LOCALEDEF = 35 + SC_2_SW_DEV = 36 + SC_POSIX2_BC_BASE_MAX = 37 + SC_POSIX2_BC_DIM_MAX = 38 + SC_POSIX2_BC_SCALE_MAX = 39 + SC_POSIX2_BC_STRING_MAX = 40 + SC_POSIX2_BC_EQUIV_CLASS_MAX = 41 + SC_POSIX2_BC_EXPR_NEST_MAX = 42 + SC_POSIX2_BC_LINE_MAX = 43 + SC_POSIX2_BC_RE_DUP_MAX = 44 + SC_PASS_MAX = 45 + SC_XOPEN_VERSION = 46 + SC_ATEXIT_MAX = 47 + SC_PAGE_SIZE = 48 + SC_PAGESIZE = SC_PAGE_SIZE + SC_AES_OS_VERSION = 49 + SC_COLL_WEIGHTS_MAX = 50 + SC_2_C_WIND = 51 + SC_2_C_VERSION = 52 + SC_2_UPE = 53 + SC_2_CHAR_TERM = 54 + SC_XOPEN_SHM = 55 + SC_XOPEN_CRYPT = 56 + SC_XOPEN_ENH_I18N = 57 + SC_IOV_MAX = 58 + SC_THREAD_SAFE_FUNCTIONS = 59 + SC_THREADS = 60 + SC_THREAD_ATTR_STACKADDR = 61 + SC_THREAD_ATTR_STACKSIZE = 62 + SC_THREAD_FORKALL = 63 + SC_THREAD_PRIORITY_SCHEDULING = 64 + SC_THREAD_PRIO_INHERIT = 65 + SC_THREAD_PRIO_PROTECT = 66 + SC_THREAD_PROCESS_SHARED = 67 + SC_THREAD_KEYS_MAX = 68 + SC_THREAD_DATAKEYS_MAX = SC_THREAD_KEYS_MAX + SC_THREAD_STACK_MIN = 69 + SC_THREAD_THREADS_MAX = 70 + SC_NPROCESSORS_CONF = 71 + SC_NPROCESSORS_ONLN = 72 + SC_XOPEN_UNIX = 73 + SC_AIO_LISTIO_MAX = 75 + SC_AIO_MAX = 76 + SC_AIO_PRIO_DELTA_MAX = 77 + SC_ASYNCHRONOUS_IO = 78 + SC_DELAYTIMER_MAX = 79 + SC_FSYNC = 80 + SC_GETGR_R_SIZE_MAX = 81 + SC_GETPW_R_SIZE_MAX = 82 + SC_LOGIN_NAME_MAX = 83 + SC_MAPPED_FILES = 84 + SC_MEMLOCK = 85 + SC_MEMLOCK_RANGE = 86 + SC_MEMORY_PROTECTION = 87 + SC_MESSAGE_PASSING = 88 + SC_MQ_OPEN_MAX = 89 + SC_MQ_PRIO_MAX = 90 + SC_PRIORITIZED_IO = 91 + SC_PRIORITY_SCHEDULING = 92 + SC_REALTIME_SIGNALS = 93 + SC_RTSIG_MAX = 94 + SC_SEMAPHORES = 95 + SC_SEM_NSEMS_MAX = 96 + SC_SEM_VALUE_MAX = 97 + SC_SHARED_MEMORY_OBJECTS = 98 + SC_SIGQUEUE_MAX = 99 + SC_SYNCHRONIZED_IO = 100 + SC_THREAD_DESTRUCTOR_ITERATIONS = 101 + SC_TIMERS = 102 + SC_TIMER_MAX = 103 + SC_TTY_NAME_MAX = 104 + SC_XBS5_ILP32_OFF32 = 105 + SC_XBS5_ILP32_OFFBIG = 106 + SC_XBS5_LP64_OFF64 = 107 + SC_XBS5_LPBIG_OFFBIG = 108 + SC_XOPEN_XCU_VERSION = 109 + SC_XOPEN_REALTIME = 110 + SC_XOPEN_REALTIME_THREADS = 111 + SC_XOPEN_LEGACY = 112 + SC_REENTRANT_FUNCTIONS = SC_THREAD_SAFE_FUNCTIONS + SC_PHYS_PAGES = 113 + SC_AVPHYS_PAGES = 114 + SC_LPAR_ENABLED = 115 + SC_LARGE_PAGESIZE = 116 + SC_AIX_KERNEL_BITMODE = 117 + SC_AIX_REALMEM = 118 + SC_AIX_HARDWARE_BITMODE = 119 + SC_AIX_MP_CAPABLE = 120 + SC_V6_ILP32_OFF32 = 121 + SC_V6_ILP32_OFFBIG = 122 + SC_V6_LP64_OFF64 = 123 + SC_V6_LPBIG_OFFBIG = 124 + SC_XOPEN_STREAMS = 125 + SC_HOST_NAME_MAX = 126 + SC_REGEXP = 127 + SC_SHELL = 128 + SC_SYMLOOP_MAX = 129 + SC_ADVISORY_INFO = 130 + SC_FILE_LOCKING = 131 + SC_2_PBS = 132 + SC_2_PBS_ACCOUNTING = 133 + SC_2_PBS_CHECKPOINT = 134 + SC_2_PBS_LOCATE = 135 + SC_2_PBS_MESSAGE = 136 + SC_2_PBS_TRACK = 137 + SC_BARRIERS = 138 + SC_CLOCK_SELECTION = 139 + SC_CPUTIME = 140 + SC_MONOTONIC_CLOCK = 141 + SC_READER_WRITER_LOCKS = 142 + SC_SPAWN = 143 + SC_SPIN_LOCKS = 144 + SC_SPORADIC_SERVER = 145 + SC_THREAD_CPUTIME = 146 + SC_THREAD_SPORADIC_SERVER = 147 + SC_TIMEOUTS = 148 + SC_TRACE = 149 + SC_TRACE_EVENT_FILTER = 150 + SC_TRACE_INHERIT = 151 + SC_TRACE_LOG = 152 + SC_TYPED_MEMORY_OBJECTS = 153 + SC_IPV6 = 154 + SC_RAW_SOCKETS = 155 + SC_SS_REPL_MAX = 156 + SC_TRACE_EVENT_NAME_MAX = 157 + SC_TRACE_NAME_MAX = 158 + SC_TRACE_SYS_MAX = 159 + SC_TRACE_USER_EVENT_MAX = 160 + SC_AIX_UKEYS = 161 + SC_AIX_ENHANCED_AFFINITY = 162 + SC_V7_ILP32_OFF32 = 163 + SC_V7_ILP32_OFFBIG = 164 + SC_V7_LP64_OFF64 = 165 + SC_V7_LPBIG_OFFBIG = 166 + SC_THREAD_ROBUST_PRIO_INHERIT = 167 + SC_THREAD_ROBUST_PRIO_PROTECT = 168 + SC_XOPEN_UUCP = 169 + SC_XOPEN_ARMOR = 170 +) + +func Sysconf(name int32) (int64, error) { + r := C.sysconf(C.int(name)) + if r == -1 { + return 0, fmt.Errorf("sysconf error") + } else { + return int64(r), nil + } +} diff --git a/vendor/github.com/power-devops/perfstat/systemcfg.go b/vendor/github.com/power-devops/perfstat/systemcfg.go new file mode 100644 index 00000000..6287eb46 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/systemcfg.go @@ -0,0 +1,635 @@ +// +build aix + +package perfstat + +import "golang.org/x/sys/unix" + +// function Getsystemcfg() is defined in golang.org/x/sys/unix +// we define here just missing constants for the function and some helpers + +// Calls to getsystemcfg() +const ( + SC_ARCH = 1 /* processor architecture */ + SC_IMPL = 2 /* processor implementation */ + SC_VERS = 3 /* processor version */ + SC_WIDTH = 4 /* width (32 || 64) */ + SC_NCPUS = 5 /* 1 = UP, n = n-way MP */ + SC_L1C_ATTR = 6 /* L1 cache attributes (bit flags) */ + SC_L1C_ISZ = 7 /* size of L1 instruction cache */ + SC_L1C_DSZ = 8 /* size of L1 data cache */ + SC_L1C_ICA = 9 /* L1 instruction cache associativity */ + SC_L1C_DCA = 10 /* L1 data cache associativity */ + SC_L1C_IBS = 11 /* L1 instruction cache block size */ + SC_L1C_DBS = 12 /* L1 data cache block size */ + SC_L1C_ILS = 13 /* L1 instruction cache line size */ + SC_L1C_DLS = 14 /* L1 data cache line size */ + SC_L2C_SZ = 15 /* size of L2 cache, 0 = No L2 cache */ + SC_L2C_AS = 16 /* L2 cache associativity */ + SC_TLB_ATTR = 17 /* TLB attributes (bit flags) */ + SC_ITLB_SZ = 18 /* entries in instruction TLB */ + SC_DTLB_SZ = 19 /* entries in data TLB */ + SC_ITLB_ATT = 20 /* instruction tlb associativity */ + SC_DTLB_ATT = 21 /* data tlb associativity */ + SC_RESRV_SZ = 22 /* size of reservation */ + SC_PRI_LC = 23 /* spin lock count in supevisor mode */ + SC_PRO_LC = 24 /* spin lock count in problem state */ + SC_RTC_TYPE = 25 /* RTC type */ + SC_VIRT_AL = 26 /* 1 if hardware aliasing is supported */ + SC_CAC_CONG = 27 /* number of page bits for cache synonym */ + SC_MOD_ARCH = 28 /* used by system for model determination */ + SC_MOD_IMPL = 29 /* used by system for model determination */ + SC_XINT = 30 /* used by system for time base conversion */ + SC_XFRAC = 31 /* used by system for time base conversion */ + SC_KRN_ATTR = 32 /* kernel attributes, see below */ + SC_PHYSMEM = 33 /* bytes of OS available memory */ + SC_SLB_ATTR = 34 /* SLB attributes */ + SC_SLB_SZ = 35 /* size of slb (0 = no slb) */ + SC_ORIG_NCPUS = 36 /* original number of CPUs */ + SC_MAX_NCPUS = 37 /* max cpus supported by this AIX image */ + SC_MAX_REALADDR = 38 /* max supported real memory address +1 */ + SC_ORIG_ENT_CAP = 39 /* configured entitled processor capacity at boot required by cross-partition LPAR tools. */ + SC_ENT_CAP = 40 /* entitled processor capacity */ + SC_DISP_WHE = 41 /* Dispatch wheel time period (TB units) */ + SC_CAPINC = 42 /* delta by which capacity can change */ + SC_VCAPW = 43 /* priority weight for idle capacity distribution */ + SC_SPLP_STAT = 44 /* State of SPLPAR enablement: 0x1 => 1=SPLPAR capable; 0=not, 0x2 => SPLPAR enabled 0=dedicated, 1=shared */ + SC_SMT_STAT = 45 /* State of SMT enablement: 0x1 = SMT Capable 0=no/1=yes, 0x2 = SMT Enabled 0=no/1=yes, 0x4 = SMT threads bound true 0=no/1=yes */ + SC_SMT_TC = 46 /* Number of SMT Threads per Physical CPU */ + SC_VMX_VER = 47 /* RPA defined VMX version: 0 = VMX not available or disabled, 1 = VMX capable, 2 = VMX and VSX capable */ + SC_LMB_SZ = 48 /* Size of an LMB on this system. */ + SC_MAX_XCPU = 49 /* Number of exclusive cpus on line */ + SC_EC_LVL = 50 /* Kernel error checking level */ + SC_AME_STAT = 51 /* AME status */ + SC_ECO_STAT = 52 /* extended cache options */ + SC_DFP_STAT = 53 /* RPA defined DFP version, 0=none/disabled */ + SC_VRM_STAT = 54 /* VRM Capable/enabled */ + SC_PHYS_IMP = 55 /* physical processor implementation */ + SC_PHYS_VER = 56 /* physical processor version */ + SC_SPCM_STATUS = 57 + SC_SPCM_MAX = 58 + SC_TM_VER = 59 /* Transaction Memory version, 0 - not capable */ + SC_NX_CAP = 60 /* NX GZIP capable */ + SC_PKS_STATE = 61 /* Platform KeyStore */ +) + +/* kernel attributes */ +/* bit 0/1 meaning */ +/* -----------------------------------------*/ +/* 31 32-bit kernel / 64-bit kernel */ +/* 30 non-LPAR / LPAR */ +/* 29 old 64bit ABI / 64bit Large ABI */ +/* 28 non-NUMA / NUMA */ +/* 27 UP / MP */ +/* 26 no DR CPU add / DR CPU add support */ +/* 25 no DR CPU rm / DR CPU rm support */ +/* 24 no DR MEM add / DR MEM add support */ +/* 23 no DR MEM rm / DR MEM rm support */ +/* 22 kernel keys disabled / enabled */ +/* 21 no recovery / recovery enabled */ +/* 20 non-MLS / MLS enabled */ +/* 19 enhanced affinity indicator */ +/* 18 non-vTPM / vTPM enabled */ +/* 17 non-VIOS / VIOS */ + +// Values for architecture field +const ( + ARCH_POWER_RS = 0x0001 /* Power Classic architecture */ + ARCH_POWER_PC = 0x0002 /* Power PC architecture */ + ARCH_IA64 = 0x0003 /* Intel IA64 architecture */ +) + +// Values for implementation field for POWER_PC Architectures +const ( + IMPL_POWER_RS1 = 0x00001 /* RS1 class CPU */ + IMPL_POWER_RSC = 0x00002 /* RSC class CPU */ + IMPL_POWER_RS2 = 0x00004 /* RS2 class CPU */ + IMPL_POWER_601 = 0x00008 /* 601 class CPU */ + IMPL_POWER_603 = 0x00020 /* 603 class CPU */ + IMPL_POWER_604 = 0x00010 /* 604 class CPU */ + IMPL_POWER_620 = 0x00040 /* 620 class CPU */ + IMPL_POWER_630 = 0x00080 /* 630 class CPU */ + IMPL_POWER_A35 = 0x00100 /* A35 class CPU */ + IMPL_POWER_RS64II = 0x0200 /* RS64-II class CPU */ + IMPL_POWER_RS64III = 0x0400 /* RS64-III class CPU */ + IMPL_POWER4 = 0x0800 /* 4 class CPU */ + IMPL_POWER_RS64IV = IMPL_POWER4 /* 4 class CPU */ + IMPL_POWER_MPC7450 = 0x1000 /* MPC7450 class CPU */ + IMPL_POWER5 = 0x2000 /* 5 class CPU */ + IMPL_POWER6 = 0x4000 /* 6 class CPU */ + IMPL_POWER7 = 0x8000 /* 7 class CPU */ + IMPL_POWER8 = 0x10000 /* 8 class CPU */ + IMPL_POWER9 = 0x20000 /* 9 class CPU */ +) + +// Values for implementation field for IA64 Architectures +const ( + IMPL_IA64_M1 = 0x0001 /* IA64 M1 class CPU (Itanium) */ + IMPL_IA64_M2 = 0x0002 /* IA64 M2 class CPU */ +) + +// Values for the version field +const ( + PV_601 = 0x010001 /* Power PC 601 */ + PV_601A = 0x010002 /* Power PC 601 */ + PV_603 = 0x060000 /* Power PC 603 */ + PV_604 = 0x050000 /* Power PC 604 */ + PV_620 = 0x070000 /* Power PC 620 */ + PV_630 = 0x080000 /* Power PC 630 */ + PV_A35 = 0x090000 /* Power PC A35 */ + PV_RS64II = 0x0A0000 /* Power PC RS64II */ + PV_RS64III = 0x0B0000 /* Power PC RS64III */ + PV_4 = 0x0C0000 /* Power PC 4 */ + PV_RS64IV = PV_4 /* Power PC 4 */ + PV_MPC7450 = 0x0D0000 /* Power PC MPC7450 */ + PV_4_2 = 0x0E0000 /* Power PC 4 */ + PV_4_3 = 0x0E0001 /* Power PC 4 */ + PV_5 = 0x0F0000 /* Power PC 5 */ + PV_5_2 = 0x0F0001 /* Power PC 5 */ + PV_5_3 = 0x0F0002 /* Power PC 5 */ + PV_6 = 0x100000 /* Power PC 6 */ + PV_6_1 = 0x100001 /* Power PC 6 DD1.x */ + PV_7 = 0x200000 /* Power PC 7 */ + PV_8 = 0x300000 /* Power PC 8 */ + PV_9 = 0x400000 /* Power PC 9 */ + PV_5_Compat = 0x0F8000 /* Power PC 5 */ + PV_6_Compat = 0x108000 /* Power PC 6 */ + PV_7_Compat = 0x208000 /* Power PC 7 */ + PV_8_Compat = 0x308000 /* Power PC 8 */ + PV_9_Compat = 0x408000 /* Power PC 9 */ + PV_RESERVED_2 = 0x0A0000 /* source compatability */ + PV_RESERVED_3 = 0x0B0000 /* source compatability */ + PV_RS2 = 0x040000 /* Power RS2 */ + PV_RS1 = 0x020000 /* Power RS1 */ + PV_RSC = 0x030000 /* Power RSC */ + PV_M1 = 0x008000 /* Intel IA64 M1 */ + PV_M2 = 0x008001 /* Intel IA64 M2 */ +) + +// Values for rtc_type +const ( + RTC_POWER = 1 /* rtc as defined by Power Arch. */ + RTC_POWER_PC = 2 /* rtc as defined by Power PC Arch. */ + RTC_IA64 = 3 /* rtc as defined by IA64 Arch. */ +) + +const NX_GZIP_PRESENT = 0x00000001 + +const ( + PKS_STATE_CAPABLE = 1 + PKS_STATE_ENABLED = 2 +) + +// Macros for identifying physical processor +const ( + PPI4_1 = 0x35 + PPI4_2 = 0x38 + PPI4_3 = 0x39 + PPI4_4 = 0x3C + PPI4_5 = 0x44 + PPI5_1 = 0x3A + PPI5_2 = 0x3B + PPI6_1 = 0x3E + PPI7_1 = 0x3F + PPI7_2 = 0x4A + PPI8_1 = 0x4B + PPI8_2 = 0x4D + PPI9 = 0x4E +) + +// Macros for kernel attributes +const ( + KERN_TYPE = 0x1 + KERN_LPAR = 0x2 + KERN_64BIT_LARGE_ABI = 0x4 + KERN_NUMA = 0x8 + KERN_UPMP = 0x10 + KERN_DR_CPU_ADD = 0x20 + KERN_DR_CPU_RM = 0x40 + KERN_DR_MEM_ADD = 0x80 + KERN_DR_MEM_RM = 0x100 + KERN_KKEY_ENABLED = 0x200 + KERN_RECOVERY = 0x400 + KERN_MLS = 0x800 + KERN_ENH_AFFINITY = 0x1000 + KERN_VTPM = 0x2000 + KERN_VIOS = 0x4000 +) + +// macros for SPLPAR environment. +const ( + SPLPAR_CAPABLE = 0x1 + SPLPAR_ENABLED = 0x2 + SPLPAR_DONATE_CAPABLE = 0x4 +) + +// Macros for SMT status determination +const ( + SMT_CAPABLE = 0x1 + SMT_ENABLE = 0x2 + SMT_BOUND = 0x4 + SMT_ORDER = 0x8 +) + +// Macros for VRM status determination +const ( + VRM_CAPABLE = 0x1 + VRM_ENABLE = 0x2 + CMOX_CAPABLE = 0x4 +) + +// Macros for AME status determination +const AME_ENABLE = 0x1 + +// Macros for extended cache options +const ( + ECO_CAPABLE = 0x1 + ECO_ENABLE = 0x2 +) + +// These define blocks of values for model_arch and model_impl that are reserved for OEM use. +const ( + MODEL_ARCH_RSPC = 2 + MODEL_ARCH_CHRP = 3 + MODEL_ARCH_IA64 = 4 + MODEL_ARCH_OEM_START = 1024 + MODEL_ARCH_OEM_END = 2047 + MODEL_IMPL_RS6K_UP_MCA = 1 + MODEL_IMPL_RS6K_SMP_MCA = 2 + MODEL_IMPL_RSPC_UP_PCI = 3 + MODEL_IMPL_RSPC_SMP_PCI = 4 + MODEL_IMPL_CHRP_UP_PCI = 5 + MODEL_IMPL_CHRP_SMP_PCI = 6 + MODEL_IMPL_IA64_COM = 7 + MODEL_IMPL_IA64_SOFTSDV = 8 + MODEL_IMPL_MAMBO_SIM = 9 + MODEL_IMPL_POWER_KVM = 10 + MODEL_IMPL_OEM_START = 1024 + MODEL_IMPL_OEM_END = 2047 +) + +// example determining processor compatibilty mode on AIX: +// impl := unix.Getsystemcfg(SC_IMPL) +// if impl&IMPL_POWER8 != 0 { +// // we are running on POWER8 +// } +// if impl&IMPL_POWER9 != 0 { +// // we are running on POWER9 +// } + +func GetCPUImplementation() string { + impl := unix.Getsystemcfg(SC_IMPL) + switch { + case impl&IMPL_POWER4 != 0: + return "POWER4" + case impl&IMPL_POWER5 != 0: + return "POWER5" + case impl&IMPL_POWER6 != 0: + return "POWER6" + case impl&IMPL_POWER7 != 0: + return "POWER7" + case impl&IMPL_POWER8 != 0: + return "POWER8" + case impl&IMPL_POWER9 != 0: + return "POWER9" + default: + return "Unknown" + } +} + +func POWER9OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER9 != 0 { + return true + } + return false +} + +func POWER9() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER9 != 0 { + return true + } + return false +} + +func POWER8OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 { + return true + } + return false +} + +func POWER8() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER8 != 0 { + return true + } + return false +} + +func POWER7OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 { + return true + } + return false +} + +func POWER7() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER7 != 0 { + return true + } + return false +} + +func HasTransactionalMemory() bool { + impl := unix.Getsystemcfg(SC_TM_VER) + if impl > 0 { + return true + } + return false +} + +func Is64Bit() bool { + impl := unix.Getsystemcfg(SC_WIDTH) + if impl == 64 { + return true + } + return false +} + +func IsSMP() bool { + impl := unix.Getsystemcfg(SC_NCPUS) + if impl > 1 { + return true + } + return false +} + +func HasVMX() bool { + impl := unix.Getsystemcfg(SC_VMX_VER) + if impl > 0 { + return true + } + return false +} + +func HasVSX() bool { + impl := unix.Getsystemcfg(SC_VMX_VER) + if impl > 1 { + return true + } + return false +} + +func HasDFP() bool { + impl := unix.Getsystemcfg(SC_DFP_STAT) + if impl > 1 { + return true + } + return false +} + +func HasNxGzip() bool { + impl := unix.Getsystemcfg(SC_NX_CAP) + if impl&NX_GZIP_PRESENT > 0 { + return true + } + return false +} + +func PksCapable() bool { + impl := unix.Getsystemcfg(SC_PKS_STATE) + if impl&PKS_STATE_CAPABLE > 0 { + return true + } + return false +} + +func PksEnabled() bool { + impl := unix.Getsystemcfg(SC_PKS_STATE) + if impl&PKS_STATE_ENABLED > 0 { + return true + } + return false +} + +func CPUMode() string { + impl := unix.Getsystemcfg(SC_VERS) + switch impl { + case PV_9, PV_9_Compat: + return "POWER9" + case PV_8, PV_8_Compat: + return "POWER8" + case PV_7, PV_7_Compat: + return "POWER7" + default: + return "Unknown" + } +} + +func KernelBits() int { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_TYPE == KERN_TYPE { + return 64 + } + return 32 +} + +func IsLPAR() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_LPAR == KERN_LPAR { + return true + } + return false +} + +func CpuAddCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_CPU_ADD == KERN_DR_CPU_ADD { + return true + } + return false +} + +func CpuRemoveCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_CPU_RM == KERN_DR_CPU_RM { + return true + } + return false +} + +func MemoryAddCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_MEM_ADD == KERN_DR_MEM_ADD { + return true + } + return false +} + +func MemoryRemoveCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_DR_MEM_RM == KERN_DR_MEM_RM { + return true + } + return false +} + +func DLparCapable() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&(KERN_DR_CPU_ADD|KERN_DR_CPU_RM|KERN_DR_MEM_ADD|KERN_DR_MEM_RM) > 0 { + return true + } + return false +} + +func IsNUMA() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_NUMA > 0 { + return true + } + return false +} + +func KernelKeys() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_KKEY_ENABLED > 0 { + return true + } + return false +} + +func RecoveryMode() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_RECOVERY > 0 { + return true + } + return false +} + +func EnhancedAffinity() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_ENH_AFFINITY > 0 { + return true + } + return false +} + +func VTpmEnabled() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_VTPM > 0 { + return true + } + return false +} + +func IsVIOS() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_VIOS > 0 { + return true + } + return false +} + +func MLSEnabled() bool { + impl := unix.Getsystemcfg(SC_KRN_ATTR) + if impl&KERN_MLS > 0 { + return true + } + return false +} + +func SPLparCapable() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_CAPABLE > 0 { + return true + } + return false +} + +func SPLparEnabled() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_ENABLED > 0 { + return true + } + return false +} + +func DedicatedLpar() bool { + return !SPLparEnabled() +} + +func SPLparCapped() bool { + impl := unix.Getsystemcfg(SC_VCAPW) + if impl == 0 { + return true + } + return false +} + +func SPLparDonating() bool { + impl := unix.Getsystemcfg(SC_SPLP_STAT) + if impl&SPLPAR_DONATE_CAPABLE > 0 { + return true + } + return false +} + +func SmtCapable() bool { + impl := unix.Getsystemcfg(SC_SMT_STAT) + if impl&SMT_CAPABLE > 0 { + return true + } + return false +} + +func SmtEnabled() bool { + impl := unix.Getsystemcfg(SC_SMT_STAT) + if impl&SMT_ENABLE > 0 { + return true + } + return false +} + +func VrmCapable() bool { + impl := unix.Getsystemcfg(SC_VRM_STAT) + if impl&VRM_CAPABLE > 0 { + return true + } + return false +} + +func VrmEnabled() bool { + impl := unix.Getsystemcfg(SC_VRM_STAT) + if impl&VRM_ENABLE > 0 { + return true + } + return false +} + +func AmeEnabled() bool { + impl := unix.Getsystemcfg(SC_AME_STAT) + if impl&AME_ENABLE > 0 { + return true + } + return false +} + +func EcoCapable() bool { + impl := unix.Getsystemcfg(SC_ECO_STAT) + if impl&ECO_CAPABLE > 0 { + return true + } + return false +} + +func EcoEnabled() bool { + impl := unix.Getsystemcfg(SC_ECO_STAT) + if impl&ECO_ENABLE > 0 { + return true + } + return false +} diff --git a/vendor/github.com/power-devops/perfstat/types_cpu.go b/vendor/github.com/power-devops/perfstat/types_cpu.go new file mode 100644 index 00000000..84425e92 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_cpu.go @@ -0,0 +1,186 @@ +package perfstat + +type CPU struct { + Name string /* logical processor name (cpu0, cpu1, ..) */ + User int64 /* raw number of clock ticks spent in user mode */ + Sys int64 /* raw number of clock ticks spent in system mode */ + Idle int64 /* raw number of clock ticks spent idle */ + Wait int64 /* raw number of clock ticks spent waiting for I/O */ + PSwitch int64 /* number of context switches (changes of currently running process) */ + Syscall int64 /* number of system calls executed */ + Sysread int64 /* number of read system calls executed */ + Syswrite int64 /* number of write system calls executed */ + Sysfork int64 /* number of fork system call executed */ + Sysexec int64 /* number of exec system call executed */ + Readch int64 /* number of characters tranferred with read system call */ + Writech int64 /* number of characters tranferred with write system call */ + Bread int64 /* number of block reads */ + Bwrite int64 /* number of block writes */ + Lread int64 /* number of logical read requests */ + Lwrite int64 /* number of logical write requests */ + Phread int64 /* number of physical reads (reads on raw device) */ + Phwrite int64 /* number of physical writes (writes on raw device) */ + Iget int64 /* number of inode lookups */ + Namei int64 /* number of vnode lookup from a path name */ + Dirblk int64 /* number of 512-byte block reads by the directory search routine to locate an entry for a file */ + Msg int64 /* number of IPC message operations */ + Sema int64 /* number of IPC semaphore operations */ + MinFaults int64 /* number of page faults with no I/O */ + MajFaults int64 /* number of page faults with disk I/O */ + PUser int64 /* raw number of physical processor tics in user mode */ + PSys int64 /* raw number of physical processor tics in system mode */ + PIdle int64 /* raw number of physical processor tics idle */ + PWait int64 /* raw number of physical processor tics waiting for I/O */ + RedispSD0 int64 /* number of thread redispatches within the scheduler affinity domain 0 */ + RedispSD1 int64 /* number of thread redispatches within the scheduler affinity domain 1 */ + RedispSD2 int64 /* number of thread redispatches within the scheduler affinity domain 2 */ + RedispSD3 int64 /* number of thread redispatches within the scheduler affinity domain 3 */ + RedispSD4 int64 /* number of thread redispatches within the scheduler affinity domain 4 */ + RedispSD5 int64 /* number of thread redispatches within the scheduler affinity domain 5 */ + MigrationPush int64 /* number of thread migrations from the local runque to another queue due to starvation load balancing */ + MigrationS3grq int64 /* number of thread migrations from the global runque to the local runque resulting in a move accross scheduling domain 3 */ + MigrationS3pul int64 /* number of thread migrations from another processor's runque resulting in a move accross scheduling domain 3 */ + InvolCSwitch int64 /* number of involuntary thread context switches */ + VolCSwitch int64 /* number of voluntary thread context switches */ + RunQueue int64 /* number of threads on the runque */ + Bound int64 /* number of bound threads */ + DecrIntrs int64 /* number of decrementer tics interrupts */ + MpcRIntrs int64 /* number of mpc's received interrupts */ + MpcSIntrs int64 /* number of mpc's sent interrupts */ + DevIntrs int64 /* number of device interrupts */ + SoftIntrs int64 /* number of offlevel handlers called */ + PhantIntrs int64 /* number of phantom interrupts */ + IdleDonatedPurr int64 /* number of idle cycles donated by a dedicated partition enabled for donation */ + IdleDonatedSpurr int64 /* number of idle spurr cycles donated by a dedicated partition enabled for donation */ + BusyDonatedPurr int64 /* number of busy cycles donated by a dedicated partition enabled for donation */ + BusyDonatedSpurr int64 /* number of busy spurr cycles donated by a dedicated partition enabled for donation */ + IdleStolenPurr int64 /* number of idle cycles stolen by the hypervisor from a dedicated partition */ + IdleStolenSpurr int64 /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenPurr int64 /* number of busy cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenSpurr int64 /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */ + Hpi int64 /* number of hypervisor page-ins */ + Hpit int64 /* Time spent in hypervisor page-ins (in nanoseconds)*/ + PUserSpurr int64 /* number of spurr cycles spent in user mode */ + PSysSpurr int64 /* number of spurr cycles spent in kernel mode */ + PIdleSpurr int64 /* number of spurr cycles spent in idle mode */ + PWaitSpurr int64 /* number of spurr cycles spent in wait mode */ + SpurrFlag int32 /* set if running in spurr mode */ + LocalDispatch int64 /* number of local thread dispatches on this logical CPU */ + NearDispatch int64 /* number of near thread dispatches on this logical CPU */ + FarDispatch int64 /* number of far thread dispatches on this logical CPU */ + CSwitches int64 /* Context switches */ + Version int64 /* version number (1, 2, etc.,) */ + TbLast int64 /* timebase counter */ + State int /* Show whether the CPU is offline or online */ + VtbLast int64 /* Last virtual timebase read */ + ICountLast int64 /* Last instruction count read */ +} + +type CPUTotal struct { + NCpus int /* number of active logical processors */ + NCpusCfg int /* number of configured processors */ + Description string /* processor description (type/official name) */ + ProcessorHz int64 /* processor speed in Hz */ + User int64 /* raw total number of clock ticks spent in user mode */ + Sys int64 /* raw total number of clock ticks spent in system mode */ + Idle int64 /* raw total number of clock ticks spent idle */ + Wait int64 /* raw total number of clock ticks spent waiting for I/O */ + PSwitch int64 /* number of process switches (change in currently running process) */ + Syscall int64 /* number of system calls executed */ + Sysread int64 /* number of read system calls executed */ + Syswrite int64 /* number of write system calls executed */ + Sysfork int64 /* number of forks system calls executed */ + Sysexec int64 /* number of execs system calls executed */ + Readch int64 /* number of characters tranferred with read system call */ + Writech int64 /* number of characters tranferred with write system call */ + DevIntrs int64 /* number of device interrupts */ + SoftIntrs int64 /* number of software interrupts */ + Lbolt int64 /* number of ticks since last reboot */ + LoadAvg1 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + LoadAvg5 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + LoadAvg15 float32 /* times the average number of runnables processes during the last 1, 5 and 15 minutes. */ + RunQueue int64 /* length of the run queue (processes ready) */ + SwpQueue int64 /* length of the swap queue (processes waiting to be paged in) */ + Bread int64 /* number of blocks read */ + Bwrite int64 /* number of blocks written */ + Lread int64 /* number of logical read requests */ + Lwrite int64 /* number of logical write requests */ + Phread int64 /* number of physical reads (reads on raw devices) */ + Phwrite int64 /* number of physical writes (writes on raw devices) */ + RunOcc int64 /* updated whenever runque is updated, i.e. the runqueue is occupied. This can be used to compute the simple average of ready processes */ + SwpOcc int64 /* updated whenever swpque is updated. i.e. the swpqueue is occupied. This can be used to compute the simple average processes waiting to be paged in */ + Iget int64 /* number of inode lookups */ + Namei int64 /* number of vnode lookup from a path name */ + Dirblk int64 /* number of 512-byte block reads by the directory search routine to locate an entry for a file */ + Msg int64 /* number of IPC message operations */ + Sema int64 /* number of IPC semaphore operations */ + RcvInt int64 /* number of tty receive interrupts */ + XmtInt int64 /* number of tyy transmit interrupts */ + MdmInt int64 /* number of modem interrupts */ + TtyRawInch int64 /* number of raw input characters */ + TtyCanInch int64 /* number of canonical input characters (always zero) */ + TtyRawOutch int64 /* number of raw output characters */ + Ksched int64 /* number of kernel processes created */ + Koverf int64 /* kernel process creation attempts where: -the user has forked to their maximum limit -the configuration limit of processes has been reached */ + Kexit int64 /* number of kernel processes that became zombies */ + Rbread int64 /* number of remote read requests */ + Rcread int64 /* number of cached remote reads */ + Rbwrt int64 /* number of remote writes */ + Rcwrt int64 /* number of cached remote writes */ + Traps int64 /* number of traps */ + NCpusHigh int64 /* index of highest processor online */ + PUser int64 /* raw number of physical processor tics in user mode */ + PSys int64 /* raw number of physical processor tics in system mode */ + PIdle int64 /* raw number of physical processor tics idle */ + PWait int64 /* raw number of physical processor tics waiting for I/O */ + DecrIntrs int64 /* number of decrementer tics interrupts */ + MpcRIntrs int64 /* number of mpc's received interrupts */ + MpcSIntrs int64 /* number of mpc's sent interrupts */ + PhantIntrs int64 /* number of phantom interrupts */ + IdleDonatedPurr int64 /* number of idle cycles donated by a dedicated partition enabled for donation */ + IdleDonatedSpurr int64 /* number of idle spurr cycles donated by a dedicated partition enabled for donation */ + BusyDonatedPurr int64 /* number of busy cycles donated by a dedicated partition enabled for donation */ + BusyDonatedSpurr int64 /* number of busy spurr cycles donated by a dedicated partition enabled for donation */ + IdleStolenPurr int64 /* number of idle cycles stolen by the hypervisor from a dedicated partition */ + IdleStolenSpurr int64 /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenPurr int64 /* number of busy cycles stolen by the hypervisor from a dedicated partition */ + BusyStolenSpurr int64 /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */ + IOWait int32 /* number of processes that are asleep waiting for buffered I/O */ + PhysIO int32 /* number of processes waiting for raw I/O */ + TWait int64 /* number of threads that are waiting for filesystem direct(cio) */ + Hpi int64 /* number of hypervisor page-ins */ + Hpit int64 /* Time spent in hypervisor page-ins (in nanoseconds) */ + PUserSpurr int64 /* number of spurr cycles spent in user mode */ + PSysSpurr int64 /* number of spurr cycles spent in kernel mode */ + PIdleSpurr int64 /* number of spurr cycles spent in idle mode */ + PWaitSpurr int64 /* number of spurr cycles spent in wait mode */ + SpurrFlag int /* set if running in spurr mode */ + Version int64 /* version number (1, 2, etc.,) */ + TbLast int64 /*time base counter */ + PurrCoalescing int64 /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/ + SpurrCoalescing int64 /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero. */ +} + +type CPUUtil struct { + Version int64 + CpuID string /* holds the id of the cpu */ + Entitlement float32 /* Partition's entitlement */ + UserPct float32 /* % of utilization in user mode */ + KernPct float32 /* % of utilization in kernel mode */ + IdlePct float32 /* % of utilization in idle mode */ + WaitPct float32 /* % of utilization in wait mode */ + PhysicalBusy float32 /* physical cpus busy */ + PhysicalConsumed float32 /* total cpus consumed by the partition */ + FreqPct float32 /* Average freq% over the last interval */ + EntitlementPct float32 /* % of entitlement used */ + BusyPct float32 /* % of entitlement busy */ + IdleDonatedPct float32 /* % idle cycles donated */ + BusyDonatedPct float32 /* % of busy cycles donated */ + IdleStolenPct float32 /* % idle cycles stolen */ + BusyStolenPct float32 /* % busy cycles stolen */ + LUserPct float32 /* % of utilization in user mode, in terms of logical processor ticks */ + LKernPct float32 /* % of utilization in kernel mode, in terms of logical processor ticks*/ + LIdlePct float32 /* % of utilization in idle mode, in terms of logical processor ticks */ + LWaitPct float32 /* % of utilization in wait mode, in terms of logical processor ticks */ + DeltaTime int64 /* delta time in milliseconds, for which utilization is evaluated */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_disk.go b/vendor/github.com/power-devops/perfstat/types_disk.go new file mode 100644 index 00000000..ca1493d8 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_disk.go @@ -0,0 +1,176 @@ +package perfstat + +type DiskTotal struct { + Number int32 /* total number of disks */ + Size int64 /* total size of all disks (in MB) */ + Free int64 /* free portion of all disks (in MB) */ + XRate int64 /* __rxfers: total number of transfers from disk */ + Xfers int64 /* total number of transfers to/from disk */ + Wblks int64 /* 512 bytes blocks written to all disks */ + Rblks int64 /* 512 bytes blocks read from all disks */ + Time int64 /* amount of time disks are active */ + Version int64 /* version number (1, 2, etc.,) */ + Rserv int64 /* Average read or receive service time */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + RFailed int64 /* number of failed read requests */ + Wserv int64 /* Average write or send service time */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + WFailed int64 /* number of failed write requests */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ +} + +// Disk Adapter Types +const ( + DA_SCSI = 0 /* 0 ==> SCSI, SAS, other legacy adapter types */ + DA_VSCSI /* 1 ==> Virtual SCSI/SAS Adapter */ + DA_FCA /* 2 ==> Fiber Channel Adapter */ +) + +type DiskAdapter struct { + Name string /* name of the adapter (from ODM) */ + Description string /* adapter description (from ODM) */ + Number int32 /* number of disks connected to adapter */ + Size int64 /* total size of all disks (in MB) */ + Free int64 /* free portion of all disks (in MB) */ + XRate int64 /* __rxfers: total number of reads via adapter */ + Xfers int64 /* total number of transfers via adapter */ + Rblks int64 /* 512 bytes blocks written via adapter */ + Wblks int64 /* 512 bytes blocks read via adapter */ + Time int64 /* amount of time disks are active */ + Version int64 /* version number (1, 2, etc.,) */ + AdapterType int64 /* 0 ==> SCSI, SAS, other legacy adapter types, 1 ==> Virtual SCSI/SAS Adapter, 2 ==> Fiber Channel Adapter */ + DkBSize int64 /* Number of Bytes in a block for this disk*/ + DkRxfers int64 /* Number of transfers from disk */ + DkRserv int64 /* read or receive service time */ + DkWserv int64 /* write or send service time */ + MinRserv int64 /* Minimum read service time */ + MaxRserv int64 /* Maximum read service time */ + MinWserv int64 /* Minimum Write service time */ + MaxWserv int64 /* Maximum write service time */ + WqDepth int64 /* driver wait queue depth */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* minimum wait queueing time */ + WqMaxTime int64 /* maximum wait queueing time */ + QFull int64 /* "Service" queue full occurrence count (number of times the adapter/devices connected to the adapter is not accepting any more request) */ + QSampled int64 /* accumulated sampled */ +} + +type Disk struct { + Name string /* name of the disk */ + Description string /* disk description (from ODM) */ + VGName string /* volume group name (from ODM) */ + Size int64 /* size of the disk (in MB) */ + Free int64 /* free portion of the disk (in MB) */ + BSize int64 /* disk block size (in bytes) */ + XRate int64 /* number of transfers from disk */ + Xfers int64 /* number of transfers to/from disk */ + Wblks int64 /* number of blocks written to disk */ + Rblks int64 /* number of blocks read from disk */ + QDepth int64 /* instantaneous "service" queue depth (number of requests sent to disk and not completed yet) */ + Time int64 /* amount of time disk is active */ + Adapter string /* disk adapter name */ + PathsCount int32 /* number of paths to this disk */ + QFull int64 /* "service" queue full occurrence count (number of times the disk is not accepting any more request) */ + Rserv int64 /* read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + Rfailed int64 /* number of failed read requests */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + Wserv int64 /* write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + Wfailed int64 /* number of failed write requests */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ + QSampled int64 /* accumulated sampled dk_q_depth */ + Version int64 /* version number (1, 2, etc.,) */ + PseudoDisk bool /*Indicates whether pseudo or physical disk */ + VTDisk bool /* 1- Virtual Target Disk, 0 - Others */ +} + +type DiskPath struct { + Name string /* name of the path */ + XRate int64 /* __rxfers: number of reads via the path */ + Xfers int64 /* number of transfers via the path */ + Rblks int64 /* 512 bytes blocks written via the path */ + Wblks int64 /* 512 bytes blocks read via the path */ + Time int64 /* amount of time disks are active */ + Adapter string /* disk adapter name (from ODM) */ + QFull int64 /* "service" queue full occurrence count (number of times the disk is not accepting any more request) */ + Rserv int64 /* read or receive service time */ + RTimeOut int64 /* number of read request timeouts */ + Rfailed int64 /* number of failed read requests */ + MinRserv int64 /* min read or receive service time */ + MaxRserv int64 /* max read or receive service time */ + Wserv int64 /* write or send service time */ + WTimeOut int64 /* number of write request timeouts */ + Wfailed int64 /* number of failed write requests */ + MinWserv int64 /* min write or send service time */ + MaxWserv int64 /* max write or send service time */ + WqDepth int64 /* instantaneous wait queue depth (number of requests waiting to be sent to disk) */ + WqSampled int64 /* accumulated sampled dk_wq_depth */ + WqTime int64 /* accumulated wait queueing time */ + WqMinTime int64 /* min wait queueing time */ + WqMaxTime int64 /* max wait queueing time */ + QSampled int64 /* accumulated sampled dk_q_depth */ + Version int64 /* version number (1, 2, etc.,) */ +} + +const ( + FC_DOWN = 0 // FC Adapter state is DOWN + FC_UP = 1 // FC Adapter state is UP +) + +const ( + FCT_FCHBA = 0 // FC type - real Fiber Channel Adapter + FCT_VFC = 1 // FC type - virtual Fiber Channel +) + +type FCAdapter struct { + Version int64 /* version number (1, 2, etc.,) */ + Name string /* name of the adapter */ + State int32 /* FC Adapter state UP or DOWN */ + InputRequests int64 /* Number of Input Requests*/ + OutputRequests int64 /* Number of Output Requests */ + InputBytes int64 /* Number of Input Bytes */ + OutputBytes int64 /* Number of Output Bytes */ + EffMaxTransfer int64 /* Adapter's Effective Maximum Transfer Value */ + NoDMAResourceCnt int64 /* Count of DMA failures due to no DMA Resource available */ + NoCmdResourceCnt int64 /* Count of failures to allocate a command due to no command resource available */ + AttentionType int32 /* Link up or down Indicator */ + SecondsSinceLastReset int64 /* Displays the seconds since last reset of the statistics on the adapter */ + TxFrames int64 /* Number of frames transmitted */ + TxWords int64 /* Fiber Channel Kbytes transmitted */ + RxFrames int64 /* Number of Frames Received */ + RxWords int64 /* Fiber Channel Kbytes Received */ + LIPCount int64 /* Count of LIP (Loop Initialization Protocol) Events received in case we have FC-AL */ + NOSCount int64 /* Count of NOS (Not_Operational) Events. This indicates a link failure state. */ + ErrorFrames int64 /* Number of frames received with the CRC Error */ + DumpedFrames int64 /* Number of lost frames */ + LinkFailureCount int64 /* Count of Link failures */ + LossofSyncCount int64 /* Count of loss of sync */ + LossofSignal int64 /* Count of loss of Signal */ + PrimitiveSeqProtocolErrCount int64 /* number of times a primitive sequence was in error */ + InvalidTxWordCount int64 /* Count of Invalid Transmission words received */ + InvalidCRCCount int64 /* Count of CRC Errors in a Received Frame */ + PortFcId int64 /* SCSI Id of the adapter */ + PortSpeed int64 /* Speed of Adapter in GBIT */ + PortType string /* Type of connection. The Possible Values are Fabric, Private Loop, Point-to-Point, unknown */ + PortWWN int64 /* World Wide Port name */ + PortSupportedSpeed int64 /* Supported Port Speed in GBIT */ + AdapterType int /* 0 - Fiber Chanel, 1 - Virtual Fiber Chanel Adapter */ + VfcName string /* name of the Virtual Fiber Chanel(VFC) adapter */ + ClientPartName string /* name of the client partition */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_fs.go b/vendor/github.com/power-devops/perfstat/types_fs.go new file mode 100644 index 00000000..0be048a3 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_fs.go @@ -0,0 +1,195 @@ +package perfstat + +import ( + "strings" +) + +type FileSystem struct { + Device string /* name of the mounted device */ + MountPoint string /* where the device is mounted */ + FSType int /* File system type, see the constants below */ + Flags int /* Flags of the file system */ + TotalBlocks int64 /* number of 512 bytes blocks in the filesystem */ + FreeBlocks int64 /* number of free 512 bytes block in the filesystem */ + TotalInodes int64 /* total number of inodes in the filesystem */ + FreeInodes int64 /* number of free inodes in the filesystem */ +} + +func (f *FileSystem) TypeString() string { + switch f.FSType { + case FS_JFS2: + return "jfs2" + case FS_NAMEFS: + return "namefs" + case FS_NFS: + return "nfs" + case FS_JFS: + return "jfs" + case FS_CDROM: + return "cdrfs" + case FS_PROCFS: + return "procfs" + case FS_SFS: + return "sfs" + case FS_CACHEFS: + return "cachefs" + case FS_NFS3: + return "nfs3" + case FS_AUTOFS: + return "autofs" + case FS_POOLFS: + return "poolfs" + case FS_VXFS: + return "vxfs" + case FS_VXODM: + return "vxodm" + case FS_UDF: + return "udfs" + case FS_NFS4: + return "nfs4" + case FS_RFS4: + return "rfs4" + case FS_CIFS: + return "cifs" + case FS_PMEMFS: + return "pmemfs" + case FS_AHAFS: + return "ahafs" + case FS_STNFS: + return "stnfs" + case FS_ASMFS: + return "asmfs" + } + return "unknown" +} + +func (f *FileSystem) FlagsString() string { + var flags []string + + switch { + case f.Flags&VFS_READONLY != 0: + flags = append(flags, "ro") + case f.Flags&VFS_REMOVABLE != 0: + flags = append(flags, "removable") + case f.Flags&VFS_DEVMOUNT != 0: + flags = append(flags, "local") + case f.Flags&VFS_REMOTE != 0: + flags = append(flags, "remote") + case f.Flags&VFS_SYSV_MOUNT != 0: + flags = append(flags, "sysv") + case f.Flags&VFS_UNMOUNTING != 0: + flags = append(flags, "unmounting") + case f.Flags&VFS_NOSUID != 0: + flags = append(flags, "nosuid") + case f.Flags&VFS_NODEV != 0: + flags = append(flags, "nodev") + case f.Flags&VFS_NOINTEG != 0: + flags = append(flags, "nointeg") + case f.Flags&VFS_NOMANAGER != 0: + flags = append(flags, "nomanager") + case f.Flags&VFS_NOCASE != 0: + flags = append(flags, "nocase") + case f.Flags&VFS_UPCASE != 0: + flags = append(flags, "upcase") + case f.Flags&VFS_NBC != 0: + flags = append(flags, "nbc") + case f.Flags&VFS_MIND != 0: + flags = append(flags, "mind") + case f.Flags&VFS_RBR != 0: + flags = append(flags, "rbr") + case f.Flags&VFS_RBW != 0: + flags = append(flags, "rbw") + case f.Flags&VFS_DISCONNECTED != 0: + flags = append(flags, "disconnected") + case f.Flags&VFS_SHUTDOWN != 0: + flags = append(flags, "shutdown") + case f.Flags&VFS_VMOUNTOK != 0: + flags = append(flags, "vmountok") + case f.Flags&VFS_SUSER != 0: + flags = append(flags, "suser") + case f.Flags&VFS_SOFT_MOUNT != 0: + flags = append(flags, "soft") + case f.Flags&VFS_UNMOUNTED != 0: + flags = append(flags, "unmounted") + case f.Flags&VFS_DEADMOUNT != 0: + flags = append(flags, "deadmount") + case f.Flags&VFS_SNAPSHOT != 0: + flags = append(flags, "snapshot") + case f.Flags&VFS_VCM_ON != 0: + flags = append(flags, "vcm_on") + case f.Flags&VFS_VCM_MONITOR != 0: + flags = append(flags, "vcm_monitor") + case f.Flags&VFS_ATIMEOFF != 0: + flags = append(flags, "noatime") + case f.Flags&VFS_READMOSTLY != 0: + flags = append(flags, "readmostly") + case f.Flags&VFS_CIOR != 0: + flags = append(flags, "cior") + case f.Flags&VFS_CIO != 0: + flags = append(flags, "cio") + case f.Flags&VFS_DIO != 0: + flags = append(flags, "dio") + } + + return strings.Join(flags, ",") +} + +// Filesystem types +const ( + FS_JFS2 = 0 /* AIX physical fs "jfs2" */ + FS_NAMEFS = 1 /* AIX pseudo fs "namefs" */ + FS_NFS = 2 /* SUN Network File System "nfs" */ + FS_JFS = 3 /* AIX R3 physical fs "jfs" */ + FS_CDROM = 5 /* CDROM File System "cdrom" */ + FS_PROCFS = 6 /* PROCFS File System "proc" */ + FS_SFS = 16 /* AIX Special FS (STREAM mounts) */ + FS_CACHEFS = 17 /* Cachefs file system */ + FS_NFS3 = 18 /* NFSv3 file system */ + FS_AUTOFS = 19 /* Automount file system */ + FS_POOLFS = 20 /* Pool file system */ + FS_VXFS = 32 /* THRPGIO File System "vxfs" */ + FS_VXODM = 33 /* For Veritas File System */ + FS_UDF = 34 /* UDFS file system */ + FS_NFS4 = 35 /* NFSv4 file system */ + FS_RFS4 = 36 /* NFSv4 Pseudo file system */ + FS_CIFS = 37 /* AIX SMBFS (CIFS client) */ + FS_PMEMFS = 38 /* MCR Async Mobility pseudo file system */ + FS_AHAFS = 39 /* AHAFS File System "aha" */ + FS_STNFS = 40 /* Short-Term NFS */ + FS_ASMFS = 41 /* Oracle ASM FS */ +) + +// Filesystem flags +const ( + VFS_READONLY = 0x00000001 /* rdonly access to vfs */ + VFS_REMOVABLE = 0x00000002 /* removable (diskette) media */ + VFS_DEVMOUNT = 0x00000004 /* physical device mount */ + VFS_REMOTE = 0x00000008 /* file system is on network */ + VFS_SYSV_MOUNT = 0x00000010 /* System V style mount */ + VFS_UNMOUNTING = 0x00000020 /* originated by unmount() */ + VFS_NOSUID = 0x00000040 /* don't maintain suid-ness across this mount */ + VFS_NODEV = 0x00000080 /* don't allow device access across this mount */ + VFS_NOINTEG = 0x00000100 /* no integrity mount option */ + VFS_NOMANAGER = 0x00000200 /* mount managed fs w/o manager */ + VFS_NOCASE = 0x00000400 /* do not map dir names */ + VFS_UPCASE = 0x00000800 /* map dir names to uppercase */ + VFS_NBC = 0x00001000 /* NBC cached file in this vfs */ + VFS_MIND = 0x00002000 /* multi-segment .indirect */ + VFS_RBR = 0x00004000 /* Release-behind when reading */ + VFS_RBW = 0x00008000 /* Release-behind when writing */ + VFS_DISCONNECTED = 0x00010000 /* file mount not in use */ + VFS_SHUTDOWN = 0x00020000 /* forced unmount for shutdown */ + VFS_VMOUNTOK = 0x00040000 /* dir/file mnt permission flag */ + VFS_SUSER = 0x00080000 /* client-side suser perm. flag */ + VFS_SOFT_MOUNT = 0x00100000 /* file-over-file or directory over directory "soft" mount */ + VFS_UNMOUNTED = 0x00200000 /* unmount completed, stale vnodes are left in the vfs */ + VFS_DEADMOUNT = 0x00400000 /* softmount vfs should be disconnected at last vnode free */ + VFS_SNAPSHOT = 0x00800000 /* snapshot mount */ + VFS_VCM_ON = 0x01000000 /* VCM is currently active */ + VFS_VCM_MONITOR = 0x02000000 /* VCM monitoring is active */ + VFS_ATIMEOFF = 0x04000000 /* no atime updates during i/o */ + VFS_READMOSTLY = 0x10000000 /* ROFS allows open for write */ + VFS_CIOR = 0x20000000 /* O_CIOR mount */ + VFS_CIO = 0x40000000 /* O_CIO mount */ + VFS_DIO = 0x80000000 /* O_DIRECT mount */ +) diff --git a/vendor/github.com/power-devops/perfstat/types_lpar.go b/vendor/github.com/power-devops/perfstat/types_lpar.go new file mode 100644 index 00000000..2d3c32fa --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_lpar.go @@ -0,0 +1,68 @@ +package perfstat + +type PartitionType struct { + SmtCapable bool /* OS supports SMT mode */ + SmtEnabled bool /* SMT mode is on */ + LparCapable bool /* OS supports logical partitioning */ + LparEnabled bool /* logical partitioning is on */ + SharedCapable bool /* OS supports shared processor LPAR */ + SharedEnabled bool /* partition runs in shared mode */ + DLparCapable bool /* OS supports dynamic LPAR */ + Capped bool /* partition is capped */ + Kernel64bit bool /* kernel is 64 bit */ + PoolUtilAuthority bool /* pool utilization available */ + DonateCapable bool /* capable of donating cycles */ + DonateEnabled bool /* enabled for donating cycles */ + AmsCapable bool /* 1 = AMS(Active Memory Sharing) capable, 0 = Not AMS capable */ + AmsEnabled bool /* 1 = AMS(Active Memory Sharing) enabled, 0 = Not AMS enabled */ + PowerSave bool /*1= Power saving mode is enabled*/ + AmeEnabled bool /* Active Memory Expansion is enabled */ + SharedExtended bool +} + +type PartitionValue struct { + Online int64 + Max int64 + Min int64 + Desired int64 +} + +type PartitionConfig struct { + Version int64 /* Version number */ + Name string /* Partition Name */ + Node string /* Node Name */ + Conf PartitionType /* Partition Properties */ + Number int32 /* Partition Number */ + GroupID int32 /* Group ID */ + ProcessorFamily string /* Processor Type */ + ProcessorModel string /* Processor Model */ + MachineID string /* Machine ID */ + ProcessorMhz float64 /* Processor Clock Speed in MHz */ + NumProcessors PartitionValue /* Number of Configured Physical Processors in frame*/ + OSName string /* Name of Operating System */ + OSVersion string /* Version of operating System */ + OSBuild string /* Build of Operating System */ + LCpus int32 /* Number of Logical CPUs */ + SmtThreads int32 /* Number of SMT Threads */ + Drives int32 /* Total Number of Drives */ + NetworkAdapters int32 /* Total Number of Network Adapters */ + CpuCap PartitionValue /* Min, Max and Online CPU Capacity */ + Weightage int32 /* Variable Processor Capacity Weightage */ + EntCapacity int32 /* number of processor units this partition is entitled to receive */ + VCpus PartitionValue /* Min, Max and Online Virtual CPUs */ + PoolID int32 /* Shared Pool ID of physical processors, to which this partition belongs*/ + ActiveCpusInPool int32 /* Count of physical CPUs in the shared processor pool, to which this partition belongs */ + PoolWeightage int32 /* Pool Weightage */ + SharedPCpu int32 /* Number of physical processors allocated for shared processor use */ + MaxPoolCap int32 /* Maximum processor capacity of partition's pool */ + EntPoolCap int32 /* Entitled processor capacity of partition's pool */ + Mem PartitionValue /* Min, Max and Online Memory */ + MemWeightage int32 /* Variable Memory Capacity Weightage */ + TotalIOMemoryEntitlement int64 /* I/O Memory Entitlement of the partition in bytes */ + MemPoolID int32 /* AMS pool id of the pool the LPAR belongs to */ + HyperPgSize int64 /* Hypervisor page size in KB*/ + ExpMem PartitionValue /* Min, Max and Online Expanded Memory */ + TargetMemExpFactor int64 /* Target Memory Expansion Factor scaled by 100 */ + TargetMemExpSize int64 /* Expanded Memory Size in MB */ + SubProcessorMode int32 /* Split core mode, its value can be 0,1,2 or 4. 0 for unsupported, 1 for capable but not enabled, 2 or 4 for enabled*/ +} diff --git a/vendor/github.com/power-devops/perfstat/types_lvm.go b/vendor/github.com/power-devops/perfstat/types_lvm.go new file mode 100644 index 00000000..8f7176a6 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_lvm.go @@ -0,0 +1,31 @@ +package perfstat + +type LogicalVolume struct { + Name string /* logical volume name */ + VGName string /* volume group name */ + OpenClose int64 /* LVM_QLVOPEN, etc. (see lvm.h) */ + State int64 /* LVM_UNDEF, etc. (see lvm.h) */ + MirrorPolicy int64 /* LVM_PARALLEL, etc. (see lvm.h) */ + MirrorWriteConsistency int64 /* LVM_CONSIST, etc. (see lvm.h) */ + WriteVerify int64 /* LVM_VERIFY, etc. (see lvm.h) */ + PPsize int64 /* physical partition size in MB */ + LogicalPartitions int64 /* total number of logical paritions configured for this logical volume */ + Mirrors int32 /* number of physical mirrors for each logical partition */ + IOCnt int64 /* Number of read and write requests */ + KBReads int64 /* Number of Kilobytes read */ + KBWrites int64 /* Number of Kilobytes written */ + Version int64 /* version number (1, 2, etc.,) */ +} + +type VolumeGroup struct { + Name string /* volume group name */ + TotalDisks int64 /* number of physical volumes in the volume group */ + ActiveDisks int64 /* number of active physical volumes in the volume group */ + TotalLogicalVolumes int64 /* number of logical volumes in the volume group */ + OpenedLogicalVolumes int64 /* number of logical volumes opened in the volume group */ + IOCnt int64 /* Number of read and write requests */ + KBReads int64 /* Number of Kilobytes read */ + KBWrites int64 /* Number of Kilobytes written */ + Version int64 /* version number (1, 2, etc.,) */ + VariedState int /* Indicates volume group available or not */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_memory.go b/vendor/github.com/power-devops/perfstat/types_memory.go new file mode 100644 index 00000000..096d29ad --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_memory.go @@ -0,0 +1,101 @@ +package perfstat + +type MemoryTotal struct { + VirtualTotal int64 /* total virtual memory (in 4KB pages) */ + RealTotal int64 /* total real memory (in 4KB pages) */ + RealFree int64 /* free real memory (in 4KB pages) */ + RealPinned int64 /* real memory which is pinned (in 4KB pages) */ + RealInUse int64 /* real memory which is in use (in 4KB pages) */ + BadPages int64 /* number of bad pages */ + PageFaults int64 /* number of page faults */ + PageIn int64 /* number of pages paged in */ + PageOut int64 /* number of pages paged out */ + PgSpIn int64 /* number of page ins from paging space */ + PgSpOut int64 /* number of page outs from paging space */ + Scans int64 /* number of page scans by clock */ + Cycles int64 /* number of page replacement cycles */ + PgSteals int64 /* number of page steals */ + NumPerm int64 /* number of frames used for files (in 4KB pages) */ + PgSpTotal int64 /* total paging space (in 4KB pages) */ + PgSpFree int64 /* free paging space (in 4KB pages) */ + PgSpRsvd int64 /* reserved paging space (in 4KB pages) */ + RealSystem int64 /* real memory used by system segments (in 4KB pages). */ + RealUser int64 /* real memory used by non-system segments (in 4KB pages). */ + RealProcess int64 /* real memory used by process segments (in 4KB pages). */ + VirtualActive int64 /* Active virtual pages. Virtual pages are considered active if they have been accessed */ + IOME int64 /* I/O memory entitlement of the partition in bytes*/ + IOMU int64 /* I/O memory entitlement of the partition in use in bytes*/ + IOHWM int64 /* High water mark of I/O memory entitlement used in bytes*/ + PMem int64 /* Amount of physical mmeory currently backing partition's logical memory in bytes*/ + CompressedTotal int64 /* Total numbers of pages in compressed pool (in 4KB pages) */ + CompressedWSegPg int64 /* Number of compressed working storage pages */ + CPgIn int64 /* number of page ins to compressed pool */ + CPgOut int64 /* number of page outs from compressed pool */ + TrueSize int64 /* True Memory Size in 4KB pages */ + ExpandedMemory int64 /* Expanded Memory Size in 4KB pages */ + CompressedWSegSize int64 /* Total size of the compressed working storage pages in the pool */ + TargetCPoolSize int64 /* Target Compressed Pool Size in bytes */ + MaxCPoolSize int64 /* Max Size of Compressed Pool in bytes */ + MinUCPoolSize int64 /* Min Size of Uncompressed Pool in bytes */ + CPoolSize int64 /* Compressed Pool size in bytes */ + UCPoolSize int64 /* Uncompressed Pool size in bytes */ + CPoolInUse int64 /* Compressed Pool Used in bytes */ + UCPoolInUse int64 /* Uncompressed Pool Used in bytes */ + Version int64 /* version number (1, 2, etc.,) */ + RealAvailable int64 /* number of pages (in 4KB pages) of memory available without paging out working segments */ + BytesCoalesced int64 /* The number of bytes of the calling partition.s logical real memory coalesced because they contained duplicated data */ + BytesCoalescedMemPool int64 /* number of bytes of logical real memory coalesced because they contained duplicated data in the calling partition.s memory */ +} + +type MemoryPage struct { + PSize int64 /* page size in bytes */ + RealTotal int64 /* number of real memory frames of this page size */ + RealFree int64 /* number of pages on free list */ + RealPinned int64 /* number of pages pinned */ + RealInUse int64 /* number of pages in use */ + PgExct int64 /* number of page faults */ + PgIns int64 /* number of pages paged in */ + PgOuts int64 /* number of pages paged out */ + PgSpIns int64 /* number of page ins from paging space */ + PgSpOuts int64 /* number of page outs from paging space */ + Scans int64 /* number of page scans by clock */ + Cycles int64 /* number of page replacement cycles */ + PgSteals int64 /* number of page steals */ + NumPerm int64 /* number of frames used for files */ + NumPgSp int64 /* number of pages with allocated paging space */ + RealSystem int64 /* number of pages used by system segments. */ + RealUser int64 /* number of pages used by non-system segments. */ + RealProcess int64 /* number of pages used by process segments. */ + VirtActive int64 /* Active virtual pages. */ + ComprsdTotal int64 /* Number of pages of this size compressed */ + ComprsdWsegPgs int64 /* Number of compressed working storage pages */ + CPgIns int64 /* number of page ins of this page size to compressed pool */ + CPgOuts int64 /* number of page outs of this page size from compressed pool */ + CPoolInUse int64 /* Compressed Size of this page size in Compressed Pool */ + UCPoolSize int64 /* Uncompressed Pool size in bytes of this page size */ + ComprsdWsegSize int64 /* Total size of the compressed working storage pages in the pool */ + Version int64 /* version number (1, 2, etc.,) */ + RealAvail int64 /* number of pages (in 4KB pages) of memory available without paging out working segments */ +} + +// paging space types +const ( + LV_PAGING = 1 + NFS_PAGING = 2 + UNKNOWN_PAGING = 3 +) + +type PagingSpace struct { + Name string /* Paging space name */ + Type uint8 /* type of paging device (LV_PAGING or NFS_PAGING) */ + VGName string /* volume group name */ + Hostname string /* host name of paging server */ + Filename string /* swap file name on server */ + LPSize int64 /* size in number of logical partitions */ + MBSize int64 /* size in megabytes */ + MBUsed int64 /* portion used in megabytes */ + IOPending int64 /* number of pending I/O */ + Active uint8 /* indicates if active (1 if so, 0 if not) */ + Automatic uint8 /* indicates if automatic (1 if so, 0 if not) */ + Version int64 /* version number (1, 2, etc.,) */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_network.go b/vendor/github.com/power-devops/perfstat/types_network.go new file mode 100644 index 00000000..e69d0041 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_network.go @@ -0,0 +1,163 @@ +package perfstat + +// Network Interface types +const ( + IFT_OTHER = 0x1 + IFT_1822 = 0x2 /* old-style arpanet imp */ + IFT_HDH1822 = 0x3 /* HDH arpanet imp */ + IFT_X25DDN = 0x4 /* x25 to imp */ + IFT_X25 = 0x5 /* PDN X25 interface (RFC877) */ + IFT_ETHER = 0x6 /* Ethernet CSMACD */ + IFT_ISO88023 = 0x7 /* CMSA CD */ + IFT_ISO88024 = 0x8 /* Token Bus */ + IFT_ISO88025 = 0x9 /* Token Ring */ + IFT_ISO88026 = 0xa /* MAN */ + IFT_STARLAN = 0xb + IFT_P10 = 0xc /* Proteon 10MBit ring */ + IFT_P80 = 0xd /* Proteon 10MBit ring */ + IFT_HY = 0xe /* Hyperchannel */ + IFT_FDDI = 0xf + IFT_LAPB = 0x10 + IFT_SDLC = 0x11 + IFT_T1 = 0x12 + IFT_CEPT = 0x13 /* E1 - european T1 */ + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_PTPSERIAL = 0x16 /* Proprietary PTP serial */ + IFT_PPP = 0x17 /* RFC 1331 */ + IFT_LOOP = 0x18 /* loopback */ + IFT_EON = 0x19 /* ISO over IP */ + IFT_XETHER = 0x1a /* obsolete 3MB experimental ethernet */ + IFT_NSIP = 0x1b /* XNS over IP */ + IFT_SLIP = 0x1c /* IP over generic TTY */ + IFT_ULTRA = 0x1d /* Ultra Technologies */ + IFT_DS3 = 0x1e /* Generic T3 */ + IFT_SIP = 0x1f /* SMDS */ + IFT_FRELAY = 0x20 /* Frame Relay DTE only */ + IFT_RS232 = 0x21 + IFT_PARA = 0x22 /* parallel-port */ + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 /* ATM cells */ + IFT_MIOX25 = 0x26 + IFT_SONET = 0x27 /* SONET or SDH */ + IFT_X25PLE = 0x28 + IFT_ISO88022LLC = 0x29 + IFT_LOCALTALK = 0x2a + IFT_SMDSDXI = 0x2b + IFT_FRELAYDCE = 0x2c /* Frame Relay DCE */ + IFT_V35 = 0x2d + IFT_HSSI = 0x2e + IFT_HIPPI = 0x2f + IFT_MODEM = 0x30 /* Generic Modem */ + IFT_AAL5 = 0x31 /* AAL5 over ATM */ + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SMDSICIP = 0x34 /* SMDS InterCarrier Interface */ + IFT_PROPVIRTUAL = 0x35 /* Proprietary Virtual/internal */ + IFT_PROPMUX = 0x36 /* Proprietary Multiplexing */ + IFT_VIPA = 0x37 /* Virtual Interface */ + IFT_SN = 0x38 /* Federation Switch */ + IFT_SP = 0x39 /* SP switch */ + IFT_FCS = 0x3a /* IP over Fiber Channel */ + IFT_TUNNEL = 0x3b + IFT_GIFTUNNEL = 0x3c /* IPv4 over IPv6 tunnel */ + IFT_HF = 0x3d /* Support for PERCS HFI*/ + IFT_CLUSTER = 0x3e /* cluster pseudo network interface */ + IFT_FB = 0xc7 /* IP over Infiniband. Number by IANA */ +) + +type NetIfaceTotal struct { + Number int32 /* number of network interfaces */ + IPackets int64 /* number of packets received on interface */ + IBytes int64 /* number of bytes received on interface */ + IErrors int64 /* number of input errors on interface */ + OPackets int64 /* number of packets sent on interface */ + OBytes int64 /* number of bytes sent on interface */ + OErrors int64 /* number of output errors on interface */ + Collisions int64 /* number of collisions on csma interface */ + XmitDrops int64 /* number of packets not transmitted */ + Version int64 /* version number (1, 2, etc.,) */ +} + +type NetIface struct { + Name string /* name of the interface */ + Description string /* interface description (from ODM, similar to lscfg output) */ + Type uint8 /* ethernet, tokenring, etc. interpretation can be done using /usr/include/net/if_types.h */ + MTU int64 /* network frame size */ + IPackets int64 /* number of packets received on interface */ + IBytes int64 /* number of bytes received on interface */ + IErrors int64 /* number of input errors on interface */ + OPackets int64 /* number of packets sent on interface */ + OBytes int64 /* number of bytes sent on interface */ + OErrors int64 /* number of output errors on interface */ + Collisions int64 /* number of collisions on csma interface */ + Bitrate int64 /* adapter rating in bit per second */ + XmitDrops int64 /* number of packets not transmitted */ + Version int64 /* version number (1, 2, etc.,) */ + IfIqDrops int64 /* Dropped on input, this interface */ + IfArpDrops int64 /* Dropped because no arp response */ +} + +type NetBuffer struct { + Name string /* size in ascii, always power of 2 (ex: "32", "64", "128") */ + InUse int64 /* number of buffer currently allocated */ + Calls int64 /* number of buffer allocations since last reset */ + Delayed int64 /* number of delayed allocations */ + Free int64 /* number of free calls */ + Failed int64 /* number of failed allocations */ + HighWatermark int64 /* high threshold for number of buffer allocated */ + Freed int64 /* number of buffers freed */ + Version int64 /* version number (1, 2, etc.,) */ +} + +// Network adapter types +const ( + NET_PHY = 0 /* physical device */ + NET_SEA = 1 /* shared ethernet adapter */ + NET_VIR = 2 /* virtual device */ + NET_HEA = 3 /* host ethernet adapter */ + NET_EC = 4 /* etherchannel */ + NET_VLAN = 5 /* vlan pseudo device */ +) + +type NetAdapter struct { + Version int64 /* version number (1,2, etc) */ + Name string /* name of the adapter */ + TxPackets int64 /* Transmit Packets on interface */ + TxBytes int64 /* Transmit Bytes on interface */ + TxInterrupts int64 /* Transfer Interrupts */ + TxErrors int64 /* Transmit Errors */ + TxPacketsDropped int64 /* Packets Dropped at the time of Data Transmission */ + TxQueueSize int64 /* Maximum Packets on Software Transmit Queue */ + TxQueueLen int64 /* Transmission Queue Length */ + TxQueueOverflow int64 /* Transmission Queue Overflow */ + TxBroadcastPackets int64 /* Number of Broadcast Packets Transmitted */ + TxMulticastPackets int64 /* Number of Multicast packets Transmitted */ + TxCarrierSense int64 /* Lost Carrier Sense signal count */ + TxDMAUnderrun int64 /* Count of DMA Under-runs for Transmission */ + TxLostCTSErrors int64 /* The number of unsuccessful transmissions due to the loss of the Clear-to-Send signal error */ + TxMaxCollisionErrors int64 /* Maximum Collision Errors at Transmission */ + TxLateCollisionErrors int64 /* Late Collision Errors at Transmission */ + TxDeferred int64 /* The number of packets deferred for Transmission. */ + TxTimeoutErrors int64 /* Time Out Errors for Transmission */ + TxSingleCollisionCount int64 /* Count of Single Collision error at Transmission */ + TxMultipleCollisionCount int64 /* Count of Multiple Collision error at Transmission */ + RxPackets int64 /* Receive Packets on interface */ + RxBytes int64 /* Receive Bytes on interface */ + RxInterrupts int64 /* Receive Interrupts */ + RxErrors int64 /* Input errors on interface */ + RxPacketsDropped int64 /* The number of packets accepted by the device driver for transmission which were not (for any reason) given to the device. */ + RxBadPackets int64 /* Count of Bad Packets Received. */ + RxMulticastPackets int64 /* Number of MultiCast Packets Received */ + RxBroadcastPackets int64 /* Number of Broadcast Packets Received */ + RxCRCErrors int64 /* Count of Packets Received with CRC errors */ + RxDMAOverrun int64 /* Count of DMA over-runs for Data Receival. */ + RxAlignmentErrors int64 /* Packets Received with Alignment Error */ + RxNoResourceErrors int64 /* Packets Received with No Resource Errors */ + RxCollisionErrors int64 /* Packets Received with Collision errors */ + RxPacketTooShortErrors int64 /* Count of Short Packets Received. */ + RxPacketTooLongErrors int64 /* Count of Too Long Packets Received. */ + RxPacketDiscardedByAdapter int64 /* Count of Received Packets discarded by Adapter. */ + AdapterType int32 /* 0 - Physical, 1 - SEA, 2 - Virtual, 3 -HEA */ +} diff --git a/vendor/github.com/power-devops/perfstat/types_process.go b/vendor/github.com/power-devops/perfstat/types_process.go new file mode 100644 index 00000000..325c70b0 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/types_process.go @@ -0,0 +1,43 @@ +package perfstat + +type Process struct { + Version int64 /* version number (1, 2, etc.,) */ + PID int64 /* Process ID */ + ProcessName string /* Name of The Process */ + Priority int32 /* Process Priority */ + NumThreads int64 /* Thread Count */ + UID int64 /* Owner Info */ + ClassID int64 /* WLM Class Name */ + Size int64 /* Virtual Size of the Process in KB(Exclusive Usage, Leaving all Shared Library Text & Shared File Pages, Shared Memory, Memory Mapped) */ + RealMemData int64 /* Real Memory used for Data in KB */ + RealMemText int64 /* Real Memory used for Text in KB */ + VirtMemData int64 /* Virtual Memory used to Data in KB */ + VirtMemText int64 /* Virtual Memory used for Text in KB */ + SharedLibDataSize int64 /* Data Size from Shared Library in KB */ + HeapSize int64 /* Heap Size in KB */ + RealInUse int64 /* The Real memory in use(in KB) by the process including all kind of segments (excluding system segments). This includes Text, Data, Shared Library Text, Shared Library Data, File Pages, Shared Memory & Memory Mapped */ + VirtInUse int64 /* The Virtual memory in use(in KB) by the process including all kind of segments (excluding system segments). This includes Text, Data, Shared Library Text, Shared Library Data, File Pages, Shared Memory & Memory Mapped */ + Pinned int64 /* Pinned Memory(in KB) for this process inclusive of all segments */ + PgSpInUse int64 /* Paging Space used(in KB) inclusive of all segments */ + FilePages int64 /* File Pages used(in KB) including shared pages */ + RealInUseMap int64 /* Real memory used(in KB) for Shared Memory and Memory Mapped regions */ + VirtInUseMap int64 /* Virtual Memory used(in KB) for Shared Memory and Memory Mapped regions */ + PinnedInUseMap int64 /* Pinned memory(in KB) for Shared Memory and Memory Mapped regions */ + UCpuTime float64 /* User Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_process_util or perfstat_process respectively. */ + SCpuTime float64 /* System Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_process_util or perfstat_process respectively. */ + LastTimeBase int64 /* Timebase Counter */ + InBytes int64 /* Bytes Read from Disk */ + OutBytes int64 /* Bytes Written to Disk */ + InOps int64 /* In Operations from Disk */ + OutOps int64 /* Out Operations from Disk */ +} + +type Thread struct { + TID int64 /* thread identifier */ + PID int64 /* process identifier */ + CpuID int64 /* processor on which I'm bound */ + UCpuTime float64 /* User Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_thread_util or perfstat_thread respectively. */ + SCpuTime float64 /* System Mode CPU time will be in percentage or milliseconds based on, whether it is filled by perfstat_thread_util or perfstat_thread respectively. */ + LastTimeBase int64 /* Timebase Counter */ + Version int64 +} diff --git a/vendor/github.com/power-devops/perfstat/uptime.go b/vendor/github.com/power-devops/perfstat/uptime.go new file mode 100644 index 00000000..2bd3e568 --- /dev/null +++ b/vendor/github.com/power-devops/perfstat/uptime.go @@ -0,0 +1,35 @@ +// +build aix + +package perfstat + +/* +#include "c_helpers.h" +*/ +import "C" + +import ( + "fmt" + "time" +) + +func timeSince(ts uint64) uint64 { + return uint64(time.Now().Unix()) - ts +} + +// BootTime() returns the time of the last boot in UNIX seconds +func BootTime() (uint64, error) { + sec := C.boottime() + if sec == -1 { + return 0, fmt.Errorf("Can't determine boot time") + } + return uint64(sec), nil +} + +// UptimeSeconds() calculates uptime in seconds +func UptimeSeconds() (uint64, error) { + boot, err := BootTime() + if err != nil { + return 0, err + } + return timeSince(boot), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/LICENSE b/vendor/github.com/shirou/gopsutil/v3/LICENSE new file mode 100644 index 00000000..6f06adcb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/LICENSE @@ -0,0 +1,61 @@ +gopsutil is distributed under BSD license reproduced below. + +Copyright (c) 2014, WAKAYAMA Shirou +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the gopsutil authors nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +------- +internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. + + + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/github.com/shirou/gopsutil/v3/common/env.go b/vendor/github.com/shirou/gopsutil/v3/common/env.go new file mode 100644 index 00000000..4b5f4980 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/common/env.go @@ -0,0 +1,23 @@ +package common + +type EnvKeyType string + +// EnvKey is a context key that can be used to set programmatically the environment +// gopsutil relies on to perform calls against the OS. +// Example of use: +// +// ctx := context.WithValue(context.Background(), common.EnvKey, EnvMap{common.HostProcEnvKey: "/myproc"}) +// avg, err := load.AvgWithContext(ctx) +var EnvKey = EnvKeyType("env") + +const ( + HostProcEnvKey EnvKeyType = "HOST_PROC" + HostSysEnvKey EnvKeyType = "HOST_SYS" + HostEtcEnvKey EnvKeyType = "HOST_ETC" + HostVarEnvKey EnvKeyType = "HOST_VAR" + HostRunEnvKey EnvKeyType = "HOST_RUN" + HostDevEnvKey EnvKeyType = "HOST_DEV" + HostRootEnvKey EnvKeyType = "HOST_ROOT" +) + +type EnvMap map[EnvKeyType]string diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go new file mode 100644 index 00000000..83bc23d4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go @@ -0,0 +1,200 @@ +package cpu + +import ( + "context" + "encoding/json" + "fmt" + "math" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +// TimesStat contains the amounts of time the CPU has spent performing different +// kinds of work. Time units are in seconds. It is based on linux /proc/stat file. +type TimesStat struct { + CPU string `json:"cpu"` + User float64 `json:"user"` + System float64 `json:"system"` + Idle float64 `json:"idle"` + Nice float64 `json:"nice"` + Iowait float64 `json:"iowait"` + Irq float64 `json:"irq"` + Softirq float64 `json:"softirq"` + Steal float64 `json:"steal"` + Guest float64 `json:"guest"` + GuestNice float64 `json:"guestNice"` +} + +type InfoStat struct { + CPU int32 `json:"cpu"` + VendorID string `json:"vendorId"` + Family string `json:"family"` + Model string `json:"model"` + Stepping int32 `json:"stepping"` + PhysicalID string `json:"physicalId"` + CoreID string `json:"coreId"` + Cores int32 `json:"cores"` + ModelName string `json:"modelName"` + Mhz float64 `json:"mhz"` + CacheSize int32 `json:"cacheSize"` + Flags []string `json:"flags"` + Microcode string `json:"microcode"` +} + +type lastPercent struct { + sync.Mutex + lastCPUTimes []TimesStat + lastPerCPUTimes []TimesStat +} + +var ( + lastCPUPercent lastPercent + invoke common.Invoker = common.Invoke{} +) + +func init() { + lastCPUPercent.Lock() + lastCPUPercent.lastCPUTimes, _ = Times(false) + lastCPUPercent.lastPerCPUTimes, _ = Times(true) + lastCPUPercent.Unlock() +} + +// Counts returns the number of physical or logical cores in the system +func Counts(logical bool) (int, error) { + return CountsWithContext(context.Background(), logical) +} + +func (c TimesStat) String() string { + v := []string{ + `"cpu":"` + c.CPU + `"`, + `"user":` + strconv.FormatFloat(c.User, 'f', 1, 64), + `"system":` + strconv.FormatFloat(c.System, 'f', 1, 64), + `"idle":` + strconv.FormatFloat(c.Idle, 'f', 1, 64), + `"nice":` + strconv.FormatFloat(c.Nice, 'f', 1, 64), + `"iowait":` + strconv.FormatFloat(c.Iowait, 'f', 1, 64), + `"irq":` + strconv.FormatFloat(c.Irq, 'f', 1, 64), + `"softirq":` + strconv.FormatFloat(c.Softirq, 'f', 1, 64), + `"steal":` + strconv.FormatFloat(c.Steal, 'f', 1, 64), + `"guest":` + strconv.FormatFloat(c.Guest, 'f', 1, 64), + `"guestNice":` + strconv.FormatFloat(c.GuestNice, 'f', 1, 64), + } + + return `{` + strings.Join(v, ",") + `}` +} + +// Deprecated: Total returns the total number of seconds in a CPUTimesStat +// Please do not use this internal function. +func (c TimesStat) Total() float64 { + total := c.User + c.System + c.Idle + c.Nice + c.Iowait + c.Irq + + c.Softirq + c.Steal + c.Guest + c.GuestNice + + return total +} + +func (c InfoStat) String() string { + s, _ := json.Marshal(c) + return string(s) +} + +func getAllBusy(t TimesStat) (float64, float64) { + tot := t.Total() + if runtime.GOOS == "linux" { + tot -= t.Guest // Linux 2.6.24+ + tot -= t.GuestNice // Linux 3.2.0+ + } + + busy := tot - t.Idle - t.Iowait + + return tot, busy +} + +func calculateBusy(t1, t2 TimesStat) float64 { + t1All, t1Busy := getAllBusy(t1) + t2All, t2Busy := getAllBusy(t2) + + if t2Busy <= t1Busy { + return 0 + } + if t2All <= t1All { + return 100 + } + return math.Min(100, math.Max(0, (t2Busy-t1Busy)/(t2All-t1All)*100)) +} + +func calculateAllBusy(t1, t2 []TimesStat) ([]float64, error) { + // Make sure the CPU measurements have the same length. + if len(t1) != len(t2) { + return nil, fmt.Errorf( + "received two CPU counts: %d != %d", + len(t1), len(t2), + ) + } + + ret := make([]float64, len(t1)) + for i, t := range t2 { + ret[i] = calculateBusy(t1[i], t) + } + return ret, nil +} + +// Percent calculates the percentage of cpu used either per CPU or combined. +// If an interval of 0 is given it will compare the current cpu times against the last call. +// Returns one value per cpu, or a single value if percpu is set to false. +func Percent(interval time.Duration, percpu bool) ([]float64, error) { + return PercentWithContext(context.Background(), interval, percpu) +} + +func PercentWithContext(ctx context.Context, interval time.Duration, percpu bool) ([]float64, error) { + if interval <= 0 { + return percentUsedFromLastCallWithContext(ctx, percpu) + } + + // Get CPU usage at the start of the interval. + cpuTimes1, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + + if err := common.Sleep(ctx, interval); err != nil { + return nil, err + } + + // And at the end of the interval. + cpuTimes2, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + + return calculateAllBusy(cpuTimes1, cpuTimes2) +} + +func percentUsedFromLastCall(percpu bool) ([]float64, error) { + return percentUsedFromLastCallWithContext(context.Background(), percpu) +} + +func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool) ([]float64, error) { + cpuTimes, err := TimesWithContext(ctx, percpu) + if err != nil { + return nil, err + } + lastCPUPercent.Lock() + defer lastCPUPercent.Unlock() + var lastTimes []TimesStat + if percpu { + lastTimes = lastCPUPercent.lastPerCPUTimes + lastCPUPercent.lastPerCPUTimes = cpuTimes + } else { + lastTimes = lastCPUPercent.lastCPUTimes + lastCPUPercent.lastCPUTimes = cpuTimes + } + + if lastTimes == nil { + return nil, fmt.Errorf("error getting times for cpu percent. lastTimes was nil") + } + return calculateAllBusy(lastTimes, cpuTimes) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix.go new file mode 100644 index 00000000..1439d1d7 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix.go @@ -0,0 +1,16 @@ +//go:build aix +// +build aix + +package cpu + +import ( + "context" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_cgo.go new file mode 100644 index 00000000..9c1e70b1 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_cgo.go @@ -0,0 +1,66 @@ +//go:build aix && cgo +// +build aix,cgo + +package cpu + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + var ret []TimesStat + if percpu { + cpus, err := perfstat.CpuStat() + if err != nil { + return nil, err + } + for _, c := range cpus { + ct := &TimesStat{ + CPU: c.Name, + Idle: float64(c.Idle), + User: float64(c.User), + System: float64(c.Sys), + Iowait: float64(c.Wait), + } + ret = append(ret, *ct) + } + } else { + c, err := perfstat.CpuUtilTotalStat() + if err != nil { + return nil, err + } + ct := &TimesStat{ + CPU: "cpu-total", + Idle: float64(c.IdlePct), + User: float64(c.UserPct), + System: float64(c.KernPct), + Iowait: float64(c.WaitPct), + } + ret = append(ret, *ct) + } + return ret, nil +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + c, err := perfstat.CpuTotalStat() + if err != nil { + return nil, err + } + info := InfoStat{ + CPU: 0, + Mhz: float64(c.ProcessorHz / 1000000), + Cores: int32(c.NCpusCfg), + } + result := []InfoStat{info} + return result, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + c, err := perfstat.CpuTotalStat() + if err != nil { + return 0, err + } + return c.NCpusCfg, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go new file mode 100644 index 00000000..a77b4dbb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go @@ -0,0 +1,92 @@ +//go:build aix && !cgo +// +build aix,!cgo + +package cpu + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + return []TimesStat{}, common.ErrNotImplementedError + } else { + out, err := invoke.CommandWithContext(ctx, "sar", "-u", "10", "1") + if err != nil { + return nil, err + } + lines := strings.Split(string(out), "\n") + if len(lines) < 5 { + return []TimesStat{}, common.ErrNotImplementedError + } + + ret := TimesStat{CPU: "cpu-total"} + h := strings.Fields(lines[len(lines)-3]) // headers + v := strings.Fields(lines[len(lines)-2]) // values + for i, header := range h { + if t, err := strconv.ParseFloat(v[i], 64); err == nil { + switch header { + case `%usr`: + ret.User = t + case `%sys`: + ret.System = t + case `%wio`: + ret.Iowait = t + case `%idle`: + ret.Idle = t + } + } + } + + return []TimesStat{ret}, nil + } +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + out, err := invoke.CommandWithContext(ctx, "prtconf") + if err != nil { + return nil, err + } + + ret := InfoStat{} + for _, line := range strings.Split(string(out), "\n") { + if strings.HasPrefix(line, "Number Of Processors:") { + p := strings.Fields(line) + if len(p) > 3 { + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + ret.Cores = int32(t) + } + } + } else if strings.HasPrefix(line, "Processor Clock Speed:") { + p := strings.Fields(line) + if len(p) > 4 { + if t, err := strconv.ParseFloat(p[3], 64); err == nil { + switch strings.ToUpper(p[4]) { + case "MHZ": + ret.Mhz = t + case "GHZ": + ret.Mhz = t * 1000.0 + case "KHZ": + ret.Mhz = t / 1000.0 + default: + ret.Mhz = t + } + } + } + break + } + } + return []InfoStat{ret}, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + info, err := InfoWithContext(ctx) + if err == nil { + return int(info[0].Cores), nil + } + return 0, err +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin.go new file mode 100644 index 00000000..41f395e5 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin.go @@ -0,0 +1,117 @@ +//go:build darwin +// +build darwin + +package cpu + +import ( + "context" + "strconv" + "strings" + + "github.com/shoenig/go-m1cpu" + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" +) + +// sys/resource.h +const ( + CPUser = 0 + cpNice = 1 + cpSys = 2 + cpIntr = 3 + cpIdle = 4 + cpUStates = 5 +) + +// default value. from time.h +var ClocksPerSec = float64(128) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + return perCPUTimes() + } + + return allCPUTimes() +} + +// Returns only one CPUInfoStat on FreeBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + var ret []InfoStat + + c := InfoStat{} + c.ModelName, _ = unix.Sysctl("machdep.cpu.brand_string") + family, _ := unix.SysctlUint32("machdep.cpu.family") + c.Family = strconv.FormatUint(uint64(family), 10) + model, _ := unix.SysctlUint32("machdep.cpu.model") + c.Model = strconv.FormatUint(uint64(model), 10) + stepping, _ := unix.SysctlUint32("machdep.cpu.stepping") + c.Stepping = int32(stepping) + features, err := unix.Sysctl("machdep.cpu.features") + if err == nil { + for _, v := range strings.Fields(features) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + leaf7Features, err := unix.Sysctl("machdep.cpu.leaf7_features") + if err == nil { + for _, v := range strings.Fields(leaf7Features) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + extfeatures, err := unix.Sysctl("machdep.cpu.extfeatures") + if err == nil { + for _, v := range strings.Fields(extfeatures) { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + cores, _ := unix.SysctlUint32("machdep.cpu.core_count") + c.Cores = int32(cores) + cacheSize, _ := unix.SysctlUint32("machdep.cpu.cache.size") + c.CacheSize = int32(cacheSize) + c.VendorID, _ = unix.Sysctl("machdep.cpu.vendor") + + if m1cpu.IsAppleSilicon() { + c.Mhz = float64(m1cpu.PCoreHz() / 1_000_000) + } else { + // Use the rated frequency of the CPU. This is a static value and does not + // account for low power or Turbo Boost modes. + cpuFrequency, err := unix.SysctlUint64("hw.cpufrequency") + if err == nil { + c.Mhz = float64(cpuFrequency) / 1000000.0 + } + } + + return append(ret, c), nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + var cpuArgument string + if logical { + cpuArgument = "hw.logicalcpu" + } else { + cpuArgument = "hw.physicalcpu" + } + + count, err := unix.SysctlUint32(cpuArgument) + if err != nil { + return 0, err + } + + return int(count), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_cgo.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_cgo.go new file mode 100644 index 00000000..1d5f0772 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_cgo.go @@ -0,0 +1,111 @@ +//go:build darwin && cgo +// +build darwin,cgo + +package cpu + +/* +#include +#include +#include +#include +#include +#include +#include +#if TARGET_OS_MAC +#include +#endif +#include +#include +*/ +import "C" + +import ( + "bytes" + "encoding/binary" + "fmt" + "unsafe" +) + +// these CPU times for darwin is borrowed from influxdb/telegraf. + +func perCPUTimes() ([]TimesStat, error) { + var ( + count C.mach_msg_type_number_t + cpuload *C.processor_cpu_load_info_data_t + ncpu C.natural_t + ) + + status := C.host_processor_info(C.host_t(C.mach_host_self()), + C.PROCESSOR_CPU_LOAD_INFO, + &ncpu, + (*C.processor_info_array_t)(unsafe.Pointer(&cpuload)), + &count) + + if status != C.KERN_SUCCESS { + return nil, fmt.Errorf("host_processor_info error=%d", status) + } + + // jump through some cgo casting hoops and ensure we properly free + // the memory that cpuload points to + target := C.vm_map_t(C.mach_task_self_) + address := C.vm_address_t(uintptr(unsafe.Pointer(cpuload))) + defer C.vm_deallocate(target, address, C.vm_size_t(ncpu)) + + // the body of struct processor_cpu_load_info + // aka processor_cpu_load_info_data_t + var cpu_ticks [C.CPU_STATE_MAX]uint32 + + // copy the cpuload array to a []byte buffer + // where we can binary.Read the data + size := int(ncpu) * binary.Size(cpu_ticks) + buf := (*[1 << 30]byte)(unsafe.Pointer(cpuload))[:size:size] + + bbuf := bytes.NewBuffer(buf) + + var ret []TimesStat + + for i := 0; i < int(ncpu); i++ { + err := binary.Read(bbuf, binary.LittleEndian, &cpu_ticks) + if err != nil { + return nil, err + } + + c := TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(cpu_ticks[C.CPU_STATE_USER]) / ClocksPerSec, + System: float64(cpu_ticks[C.CPU_STATE_SYSTEM]) / ClocksPerSec, + Nice: float64(cpu_ticks[C.CPU_STATE_NICE]) / ClocksPerSec, + Idle: float64(cpu_ticks[C.CPU_STATE_IDLE]) / ClocksPerSec, + } + + ret = append(ret, c) + } + + return ret, nil +} + +func allCPUTimes() ([]TimesStat, error) { + var count C.mach_msg_type_number_t + var cpuload C.host_cpu_load_info_data_t + + count = C.HOST_CPU_LOAD_INFO_COUNT + + status := C.host_statistics(C.host_t(C.mach_host_self()), + C.HOST_CPU_LOAD_INFO, + C.host_info_t(unsafe.Pointer(&cpuload)), + &count) + + if status != C.KERN_SUCCESS { + return nil, fmt.Errorf("host_statistics error=%d", status) + } + + c := TimesStat{ + CPU: "cpu-total", + User: float64(cpuload.cpu_ticks[C.CPU_STATE_USER]) / ClocksPerSec, + System: float64(cpuload.cpu_ticks[C.CPU_STATE_SYSTEM]) / ClocksPerSec, + Nice: float64(cpuload.cpu_ticks[C.CPU_STATE_NICE]) / ClocksPerSec, + Idle: float64(cpuload.cpu_ticks[C.CPU_STATE_IDLE]) / ClocksPerSec, + } + + return []TimesStat{c}, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_nocgo.go new file mode 100644 index 00000000..e067e99f --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_nocgo.go @@ -0,0 +1,14 @@ +//go:build darwin && !cgo +// +build darwin,!cgo + +package cpu + +import "github.com/shirou/gopsutil/v3/internal/common" + +func perCPUTimes() ([]TimesStat, error) { + return []TimesStat{}, common.ErrNotImplementedError +} + +func allCPUTimes() ([]TimesStat, error) { + return []TimesStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly.go new file mode 100644 index 00000000..fef53e5d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly.go @@ -0,0 +1,156 @@ +package cpu + +import ( + "context" + "fmt" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" +) + +var ( + ClocksPerSec = float64(128) + cpuMatch = regexp.MustCompile(`^CPU:`) + originMatch = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`) + featuresMatch = regexp.MustCompile(`Features=.+<(.+)>`) + featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`) + cpuEnd = regexp.MustCompile(`^Trying to mount root`) + cpuTimesSize int + emptyTimes cpuTimes +) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func timeStat(name string, t *cpuTimes) *TimesStat { + return &TimesStat{ + User: float64(t.User) / ClocksPerSec, + Nice: float64(t.Nice) / ClocksPerSec, + System: float64(t.Sys) / ClocksPerSec, + Idle: float64(t.Idle) / ClocksPerSec, + Irq: float64(t.Intr) / ClocksPerSec, + CPU: name, + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + buf, err := unix.SysctlRaw("kern.cp_times") + if err != nil { + return nil, err + } + + // We can't do this in init due to the conflict with cpu.init() + if cpuTimesSize == 0 { + cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size()) + } + + ncpus := len(buf) / cpuTimesSize + ret := make([]TimesStat, 0, ncpus) + for i := 0; i < ncpus; i++ { + times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize])) + if *times == emptyTimes { + // CPU not present + continue + } + ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times)) + } + return ret, nil + } + + buf, err := unix.SysctlRaw("kern.cp_time") + if err != nil { + return nil, err + } + + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + return []TimesStat{*timeStat("cpu-total", times)}, nil +} + +// Returns only one InfoStat on DragonflyBSD. The information regarding core +// count, however is accurate and it is assumed that all InfoStat attributes +// are the same across CPUs. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + const dmesgBoot = "/var/run/dmesg.boot" + + c, err := parseDmesgBoot(dmesgBoot) + if err != nil { + return nil, err + } + + var u32 uint32 + if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil { + return nil, err + } + c.Mhz = float64(u32) + + var num int + var buf string + if buf, err = unix.Sysctl("hw.cpu_topology.tree"); err != nil { + return nil, err + } + num = strings.Count(buf, "CHIP") + c.Cores = int32(strings.Count(string(buf), "CORE") / num) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + ret := make([]InfoStat, num) + for i := 0; i < num; i++ { + ret[i] = c + } + + return ret, nil +} + +func parseDmesgBoot(fileName string) (InfoStat, error) { + c := InfoStat{} + lines, _ := common.ReadLines(fileName) + for _, line := range lines { + if matches := cpuEnd.FindStringSubmatch(line); matches != nil { + break + } else if matches := originMatch.FindStringSubmatch(line); matches != nil { + c.VendorID = matches[1] + t, err := strconv.ParseInt(matches[2], 10, 32) + if err != nil { + return c, fmt.Errorf("unable to parse DragonflyBSD CPU stepping information from %q: %v", line, err) + } + c.Stepping = int32(t) + } else if matches := featuresMatch.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } + } + + return c, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly_amd64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly_amd64.go new file mode 100644 index 00000000..57e14528 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_dragonfly_amd64.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_fallback.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_fallback.go new file mode 100644 index 00000000..089f603c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_fallback.go @@ -0,0 +1,31 @@ +//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && !windows && !dragonfly && !plan9 && !aix +// +build !darwin,!linux,!freebsd,!openbsd,!netbsd,!solaris,!windows,!dragonfly,!plan9,!aix + +package cpu + +import ( + "context" + "runtime" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + return []TimesStat{}, common.ErrNotImplementedError +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + return []InfoStat{}, common.ErrNotImplementedError +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd.go new file mode 100644 index 00000000..d3f47353 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd.go @@ -0,0 +1,168 @@ +package cpu + +import ( + "context" + "fmt" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" +) + +var ( + ClocksPerSec = float64(128) + cpuMatch = regexp.MustCompile(`^CPU:`) + originMatch = regexp.MustCompile(`Origin\s*=\s*"(.+)"\s+Id\s*=\s*(.+)\s+Family\s*=\s*(.+)\s+Model\s*=\s*(.+)\s+Stepping\s*=\s*(.+)`) + featuresMatch = regexp.MustCompile(`Features=.+<(.+)>`) + featuresMatch2 = regexp.MustCompile(`Features2=[a-f\dx]+<(.+)>`) + cpuEnd = regexp.MustCompile(`^Trying to mount root`) + cpuCores = regexp.MustCompile(`FreeBSD/SMP: (\d*) package\(s\) x (\d*) core\(s\)`) + cpuTimesSize int + emptyTimes cpuTimes +) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func timeStat(name string, t *cpuTimes) *TimesStat { + return &TimesStat{ + User: float64(t.User) / ClocksPerSec, + Nice: float64(t.Nice) / ClocksPerSec, + System: float64(t.Sys) / ClocksPerSec, + Idle: float64(t.Idle) / ClocksPerSec, + Irq: float64(t.Intr) / ClocksPerSec, + CPU: name, + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + buf, err := unix.SysctlRaw("kern.cp_times") + if err != nil { + return nil, err + } + + // We can't do this in init due to the conflict with cpu.init() + if cpuTimesSize == 0 { + cpuTimesSize = int(reflect.TypeOf(cpuTimes{}).Size()) + } + + ncpus := len(buf) / cpuTimesSize + ret := make([]TimesStat, 0, ncpus) + for i := 0; i < ncpus; i++ { + times := (*cpuTimes)(unsafe.Pointer(&buf[i*cpuTimesSize])) + if *times == emptyTimes { + // CPU not present + continue + } + ret = append(ret, *timeStat(fmt.Sprintf("cpu%d", len(ret)), times)) + } + return ret, nil + } + + buf, err := unix.SysctlRaw("kern.cp_time") + if err != nil { + return nil, err + } + + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + return []TimesStat{*timeStat("cpu-total", times)}, nil +} + +// Returns only one InfoStat on FreeBSD. The information regarding core +// count, however is accurate and it is assumed that all InfoStat attributes +// are the same across CPUs. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + const dmesgBoot = "/var/run/dmesg.boot" + + c, num, err := parseDmesgBoot(dmesgBoot) + if err != nil { + return nil, err + } + + var u32 uint32 + if u32, err = unix.SysctlUint32("hw.clockrate"); err != nil { + return nil, err + } + c.Mhz = float64(u32) + + if u32, err = unix.SysctlUint32("hw.ncpu"); err != nil { + return nil, err + } + c.Cores = int32(u32) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + ret := make([]InfoStat, num) + for i := 0; i < num; i++ { + ret[i] = c + } + + return ret, nil +} + +func parseDmesgBoot(fileName string) (InfoStat, int, error) { + c := InfoStat{} + lines, _ := common.ReadLines(fileName) + cpuNum := 1 // default cpu num is 1 + for _, line := range lines { + if matches := cpuEnd.FindStringSubmatch(line); matches != nil { + break + } else if matches := originMatch.FindStringSubmatch(line); matches != nil { + c.VendorID = matches[1] + c.Family = matches[3] + c.Model = matches[4] + t, err := strconv.ParseInt(matches[5], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU stepping information from %q: %v", line, err) + } + c.Stepping = int32(t) + } else if matches := featuresMatch.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := featuresMatch2.FindStringSubmatch(line); matches != nil { + for _, v := range strings.Split(matches[1], ",") { + c.Flags = append(c.Flags, strings.ToLower(v)) + } + } else if matches := cpuCores.FindStringSubmatch(line); matches != nil { + t, err := strconv.ParseInt(matches[1], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU Nums from %q: %v", line, err) + } + cpuNum = int(t) + t2, err := strconv.ParseInt(matches[2], 10, 32) + if err != nil { + return c, 0, fmt.Errorf("unable to parse FreeBSD CPU cores from %q: %v", line, err) + } + c.Cores = int32(t2) + } + } + + return c, cpuNum, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_386.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_386.go new file mode 100644 index 00000000..8b7f4c32 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_386.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_amd64.go new file mode 100644 index 00000000..57e14528 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_amd64.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm.go new file mode 100644 index 00000000..8b7f4c32 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm64.go new file mode 100644 index 00000000..57e14528 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_freebsd_arm64.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_linux.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_linux.go new file mode 100644 index 00000000..da467e2d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_linux.go @@ -0,0 +1,479 @@ +//go:build linux +// +build linux + +package cpu + +import ( + "context" + "errors" + "fmt" + "path/filepath" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +var ClocksPerSec = float64(100) + +var armModelToModelName = map[uint64]string{ + 0x810: "ARM810", + 0x920: "ARM920", + 0x922: "ARM922", + 0x926: "ARM926", + 0x940: "ARM940", + 0x946: "ARM946", + 0x966: "ARM966", + 0xa20: "ARM1020", + 0xa22: "ARM1022", + 0xa26: "ARM1026", + 0xb02: "ARM11 MPCore", + 0xb36: "ARM1136", + 0xb56: "ARM1156", + 0xb76: "ARM1176", + 0xc05: "Cortex-A5", + 0xc07: "Cortex-A7", + 0xc08: "Cortex-A8", + 0xc09: "Cortex-A9", + 0xc0d: "Cortex-A17", + 0xc0f: "Cortex-A15", + 0xc0e: "Cortex-A17", + 0xc14: "Cortex-R4", + 0xc15: "Cortex-R5", + 0xc17: "Cortex-R7", + 0xc18: "Cortex-R8", + 0xc20: "Cortex-M0", + 0xc21: "Cortex-M1", + 0xc23: "Cortex-M3", + 0xc24: "Cortex-M4", + 0xc27: "Cortex-M7", + 0xc60: "Cortex-M0+", + 0xd01: "Cortex-A32", + 0xd02: "Cortex-A34", + 0xd03: "Cortex-A53", + 0xd04: "Cortex-A35", + 0xd05: "Cortex-A55", + 0xd06: "Cortex-A65", + 0xd07: "Cortex-A57", + 0xd08: "Cortex-A72", + 0xd09: "Cortex-A73", + 0xd0a: "Cortex-A75", + 0xd0b: "Cortex-A76", + 0xd0c: "Neoverse-N1", + 0xd0d: "Cortex-A77", + 0xd0e: "Cortex-A76AE", + 0xd13: "Cortex-R52", + 0xd20: "Cortex-M23", + 0xd21: "Cortex-M33", + 0xd40: "Neoverse-V1", + 0xd41: "Cortex-A78", + 0xd42: "Cortex-A78AE", + 0xd43: "Cortex-A65AE", + 0xd44: "Cortex-X1", + 0xd46: "Cortex-A510", + 0xd47: "Cortex-A710", + 0xd48: "Cortex-X2", + 0xd49: "Neoverse-N2", + 0xd4a: "Neoverse-E1", + 0xd4b: "Cortex-A78C", + 0xd4c: "Cortex-X1C", + 0xd4d: "Cortex-A715", + 0xd4e: "Cortex-X3", +} + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + filename := common.HostProcWithContext(ctx, "stat") + lines := []string{} + if percpu { + statlines, err := common.ReadLines(filename) + if err != nil || len(statlines) < 2 { + return []TimesStat{}, nil + } + for _, line := range statlines[1:] { + if !strings.HasPrefix(line, "cpu") { + break + } + lines = append(lines, line) + } + } else { + lines, _ = common.ReadLinesOffsetN(filename, 0, 1) + } + + ret := make([]TimesStat, 0, len(lines)) + + for _, line := range lines { + ct, err := parseStatLine(line) + if err != nil { + continue + } + ret = append(ret, *ct) + + } + return ret, nil +} + +func sysCPUPath(ctx context.Context, cpu int32, relPath string) string { + return common.HostSysWithContext(ctx, fmt.Sprintf("devices/system/cpu/cpu%d", cpu), relPath) +} + +func finishCPUInfo(ctx context.Context, c *InfoStat) { + var lines []string + var err error + var value float64 + + if len(c.CoreID) == 0 { + lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "topology/core_id")) + if err == nil { + c.CoreID = lines[0] + } + } + + // override the value of c.Mhz with cpufreq/cpuinfo_max_freq regardless + // of the value from /proc/cpuinfo because we want to report the maximum + // clock-speed of the CPU for c.Mhz, matching the behaviour of Windows + lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "cpufreq/cpuinfo_max_freq")) + // if we encounter errors below such as there are no cpuinfo_max_freq file, + // we just ignore. so let Mhz is 0. + if err != nil || len(lines) == 0 { + return + } + value, err = strconv.ParseFloat(lines[0], 64) + if err != nil { + return + } + c.Mhz = value / 1000.0 // value is in kHz + if c.Mhz > 9999 { + c.Mhz = c.Mhz / 1000.0 // value in Hz + } +} + +// CPUInfo on linux will return 1 item per physical thread. +// +// CPUs have three levels of counting: sockets, cores, threads. +// Cores with HyperThreading count as having 2 threads per core. +// Sockets often come with many physical CPU cores. +// For example a single socket board with two cores each with HT will +// return 4 CPUInfoStat structs on Linux and the "Cores" field set to 1. +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + filename := common.HostProcWithContext(ctx, "cpuinfo") + lines, _ := common.ReadLines(filename) + + var ret []InfoStat + var processorName string + + c := InfoStat{CPU: -1, Cores: 1} + for _, line := range lines { + fields := strings.Split(line, ":") + if len(fields) < 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.TrimSpace(fields[1]) + + switch key { + case "Processor": + processorName = value + case "processor", "cpu number": + if c.CPU >= 0 { + finishCPUInfo(ctx, &c) + ret = append(ret, c) + } + c = InfoStat{Cores: 1, ModelName: processorName} + t, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return ret, err + } + c.CPU = int32(t) + case "vendorId", "vendor_id": + c.VendorID = value + if strings.Contains(value, "S390") { + processorName = "S390" + } + case "CPU implementer": + if v, err := strconv.ParseUint(value, 0, 8); err == nil { + switch v { + case 0x41: + c.VendorID = "ARM" + case 0x42: + c.VendorID = "Broadcom" + case 0x43: + c.VendorID = "Cavium" + case 0x44: + c.VendorID = "DEC" + case 0x46: + c.VendorID = "Fujitsu" + case 0x48: + c.VendorID = "HiSilicon" + case 0x49: + c.VendorID = "Infineon" + case 0x4d: + c.VendorID = "Motorola/Freescale" + case 0x4e: + c.VendorID = "NVIDIA" + case 0x50: + c.VendorID = "APM" + case 0x51: + c.VendorID = "Qualcomm" + case 0x56: + c.VendorID = "Marvell" + case 0x61: + c.VendorID = "Apple" + case 0x69: + c.VendorID = "Intel" + case 0xc0: + c.VendorID = "Ampere" + } + } + case "cpu family": + c.Family = value + case "model", "CPU part": + c.Model = value + // if CPU is arm based, model name is found via model number. refer to: arch/arm64/kernel/cpuinfo.c + if c.VendorID == "ARM" { + if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil { + modelName, exist := armModelToModelName[v] + if exist { + c.ModelName = modelName + } else { + c.ModelName = "Undefined" + } + } + } + case "Model Name", "model name", "cpu": + c.ModelName = value + if strings.Contains(value, "POWER") { + c.Model = strings.Split(value, " ")[0] + c.Family = "POWER" + c.VendorID = "IBM" + } + case "stepping", "revision", "CPU revision": + val := value + + if key == "revision" { + val = strings.Split(value, ".")[0] + } + + t, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return ret, err + } + c.Stepping = int32(t) + case "cpu MHz", "clock", "cpu MHz dynamic": + // treat this as the fallback value, thus we ignore error + if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil { + c.Mhz = t + } + case "cache size": + t, err := strconv.ParseInt(strings.Replace(value, " KB", "", 1), 10, 64) + if err != nil { + return ret, err + } + c.CacheSize = int32(t) + case "physical id": + c.PhysicalID = value + case "core id": + c.CoreID = value + case "flags", "Features": + c.Flags = strings.FieldsFunc(value, func(r rune) bool { + return r == ',' || r == ' ' + }) + case "microcode": + c.Microcode = value + } + } + if c.CPU >= 0 { + finishCPUInfo(ctx, &c) + ret = append(ret, c) + } + return ret, nil +} + +func parseStatLine(line string) (*TimesStat, error) { + fields := strings.Fields(line) + + if len(fields) < 8 { + return nil, errors.New("stat does not contain cpu info") + } + + if !strings.HasPrefix(fields[0], "cpu") { + return nil, errors.New("not contain cpu") + } + + cpu := fields[0] + if cpu == "cpu" { + cpu = "cpu-total" + } + user, err := strconv.ParseFloat(fields[1], 64) + if err != nil { + return nil, err + } + nice, err := strconv.ParseFloat(fields[2], 64) + if err != nil { + return nil, err + } + system, err := strconv.ParseFloat(fields[3], 64) + if err != nil { + return nil, err + } + idle, err := strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, err + } + iowait, err := strconv.ParseFloat(fields[5], 64) + if err != nil { + return nil, err + } + irq, err := strconv.ParseFloat(fields[6], 64) + if err != nil { + return nil, err + } + softirq, err := strconv.ParseFloat(fields[7], 64) + if err != nil { + return nil, err + } + + ct := &TimesStat{ + CPU: cpu, + User: user / ClocksPerSec, + Nice: nice / ClocksPerSec, + System: system / ClocksPerSec, + Idle: idle / ClocksPerSec, + Iowait: iowait / ClocksPerSec, + Irq: irq / ClocksPerSec, + Softirq: softirq / ClocksPerSec, + } + if len(fields) > 8 { // Linux >= 2.6.11 + steal, err := strconv.ParseFloat(fields[8], 64) + if err != nil { + return nil, err + } + ct.Steal = steal / ClocksPerSec + } + if len(fields) > 9 { // Linux >= 2.6.24 + guest, err := strconv.ParseFloat(fields[9], 64) + if err != nil { + return nil, err + } + ct.Guest = guest / ClocksPerSec + } + if len(fields) > 10 { // Linux >= 3.2.0 + guestNice, err := strconv.ParseFloat(fields[10], 64) + if err != nil { + return nil, err + } + ct.GuestNice = guestNice / ClocksPerSec + } + + return ct, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + if logical { + ret := 0 + // https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_pslinux.py#L599 + procCpuinfo := common.HostProcWithContext(ctx, "cpuinfo") + lines, err := common.ReadLines(procCpuinfo) + if err == nil { + for _, line := range lines { + line = strings.ToLower(line) + if strings.HasPrefix(line, "processor") { + _, err = strconv.Atoi(strings.TrimSpace(line[strings.IndexByte(line, ':')+1:])) + if err == nil { + ret++ + } + } + } + } + if ret == 0 { + procStat := common.HostProcWithContext(ctx, "stat") + lines, err = common.ReadLines(procStat) + if err != nil { + return 0, err + } + for _, line := range lines { + if len(line) >= 4 && strings.HasPrefix(line, "cpu") && '0' <= line[3] && line[3] <= '9' { // `^cpu\d` regexp matching + ret++ + } + } + } + return ret, nil + } + // physical cores + // https://github.com/giampaolo/psutil/blob/8415355c8badc9c94418b19bdf26e622f06f0cce/psutil/_pslinux.py#L615-L628 + threadSiblingsLists := make(map[string]bool) + // These 2 files are the same but */core_cpus_list is newer while */thread_siblings_list is deprecated and may disappear in the future. + // https://www.kernel.org/doc/Documentation/admin-guide/cputopology.rst + // https://github.com/giampaolo/psutil/pull/1727#issuecomment-707624964 + // https://lkml.org/lkml/2019/2/26/41 + for _, glob := range []string{"devices/system/cpu/cpu[0-9]*/topology/core_cpus_list", "devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list"} { + if files, err := filepath.Glob(common.HostSysWithContext(ctx, glob)); err == nil { + for _, file := range files { + lines, err := common.ReadLines(file) + if err != nil || len(lines) != 1 { + continue + } + threadSiblingsLists[lines[0]] = true + } + ret := len(threadSiblingsLists) + if ret != 0 { + return ret, nil + } + } + } + // https://github.com/giampaolo/psutil/blob/122174a10b75c9beebe15f6c07dcf3afbe3b120d/psutil/_pslinux.py#L631-L652 + filename := common.HostProcWithContext(ctx, "cpuinfo") + lines, err := common.ReadLines(filename) + if err != nil { + return 0, err + } + mapping := make(map[int]int) + currentInfo := make(map[string]int) + for _, line := range lines { + line = strings.ToLower(strings.TrimSpace(line)) + if line == "" { + // new section + id, okID := currentInfo["physical id"] + cores, okCores := currentInfo["cpu cores"] + if okID && okCores { + mapping[id] = cores + } + currentInfo = make(map[string]int) + continue + } + fields := strings.Split(line, ":") + if len(fields) < 2 { + continue + } + fields[0] = strings.TrimSpace(fields[0]) + if fields[0] == "physical id" || fields[0] == "cpu cores" { + val, err := strconv.Atoi(strings.TrimSpace(fields[1])) + if err != nil { + continue + } + currentInfo[fields[0]] = val + } + } + ret := 0 + for _, v := range mapping { + ret += v + } + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd.go new file mode 100644 index 00000000..1f66be34 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd.go @@ -0,0 +1,119 @@ +//go:build netbsd +// +build netbsd + +package cpu + +import ( + "context" + "fmt" + "runtime" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" +) + +const ( + // sys/sysctl.h + ctlKern = 1 // "high kernel": proc, limits + ctlHw = 6 // CTL_HW + kernCpTime = 51 // KERN_CPTIME +) + +var ClocksPerSec = float64(100) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { + if !percpu { + mib := []int32{ctlKern, kernCpTime} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + stat := TimesStat{ + CPU: "cpu-total", + User: float64(times.User), + Nice: float64(times.Nice), + System: float64(times.Sys), + Idle: float64(times.Idle), + Irq: float64(times.Intr), + } + return []TimesStat{stat}, nil + } + + ncpu, err := unix.SysctlUint32("hw.ncpu") + if err != nil { + return + } + + var i uint32 + for i = 0; i < ncpu; i++ { + mib := []int32{ctlKern, kernCpTime, int32(i)} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + + stats := (*cpuTimes)(unsafe.Pointer(&buf[0])) + ret = append(ret, TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(stats.User), + Nice: float64(stats.Nice), + System: float64(stats.Sys), + Idle: float64(stats.Idle), + Irq: float64(stats.Intr), + }) + } + + return ret, nil +} + +// Returns only one (minimal) CPUInfoStat on NetBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + var ret []InfoStat + var err error + + c := InfoStat{} + + mhz, err := unix.Sysctl("machdep.dmi.processor-frequency") + if err != nil { + return nil, err + } + _, err = fmt.Sscanf(mhz, "%f", &c.Mhz) + if err != nil { + return nil, err + } + + ncpu, err := unix.SysctlUint32("hw.ncpuonline") + if err != nil { + return nil, err + } + c.Cores = int32(ncpu) + + if c.ModelName, err = unix.Sysctl("machdep.dmi.processor-version"); err != nil { + return nil, err + } + + return append(ret, c), nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_amd64.go new file mode 100644 index 00000000..57e14528 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_amd64.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_arm64.go new file mode 100644 index 00000000..57e14528 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_netbsd_arm64.go @@ -0,0 +1,9 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd.go new file mode 100644 index 00000000..fe332903 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd.go @@ -0,0 +1,137 @@ +//go:build openbsd +// +build openbsd + +package cpu + +import ( + "context" + "fmt" + "runtime" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" +) + +const ( + // sys/sched.h + cpuOnline = 0x0001 // CPUSTATS_ONLINE + + // sys/sysctl.h + ctlKern = 1 // "high kernel": proc, limits + ctlHw = 6 // CTL_HW + smt = 24 // HW_SMT + kernCpTime = 40 // KERN_CPTIME + kernCPUStats = 85 // KERN_CPUSTATS +) + +var ClocksPerSec = float64(128) + +type cpuStats struct { + // cs_time[CPUSTATES] + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 + + // cs_flags + Flags uint64 +} + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { + if !percpu { + mib := []int32{ctlKern, kernCpTime} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + times := (*cpuTimes)(unsafe.Pointer(&buf[0])) + stat := TimesStat{ + CPU: "cpu-total", + User: float64(times.User) / ClocksPerSec, + Nice: float64(times.Nice) / ClocksPerSec, + System: float64(times.Sys) / ClocksPerSec, + Idle: float64(times.Idle) / ClocksPerSec, + Irq: float64(times.Intr) / ClocksPerSec, + } + return []TimesStat{stat}, nil + } + + ncpu, err := unix.SysctlUint32("hw.ncpu") + if err != nil { + return + } + + var i uint32 + for i = 0; i < ncpu; i++ { + mib := []int32{ctlKern, kernCPUStats, int32(i)} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return ret, err + } + + stats := (*cpuStats)(unsafe.Pointer(&buf[0])) + if (stats.Flags & cpuOnline) == 0 { + continue + } + ret = append(ret, TimesStat{ + CPU: fmt.Sprintf("cpu%d", i), + User: float64(stats.User) / ClocksPerSec, + Nice: float64(stats.Nice) / ClocksPerSec, + System: float64(stats.Sys) / ClocksPerSec, + Idle: float64(stats.Idle) / ClocksPerSec, + Irq: float64(stats.Intr) / ClocksPerSec, + }) + } + + return ret, nil +} + +// Returns only one (minimal) CPUInfoStat on OpenBSD +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + var ret []InfoStat + var err error + + c := InfoStat{} + + mhz, err := unix.SysctlUint32("hw.cpuspeed") + if err != nil { + return nil, err + } + c.Mhz = float64(mhz) + + ncpu, err := unix.SysctlUint32("hw.ncpuonline") + if err != nil { + return nil, err + } + c.Cores = int32(ncpu) + + if c.ModelName, err = unix.Sysctl("hw.model"); err != nil { + return nil, err + } + + return append(ret, c), nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_386.go new file mode 100644 index 00000000..5e878399 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_386.go @@ -0,0 +1,10 @@ +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Spin uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_amd64.go new file mode 100644 index 00000000..d659058c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_amd64.go @@ -0,0 +1,10 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm.go new file mode 100644 index 00000000..5e878399 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm.go @@ -0,0 +1,10 @@ +package cpu + +type cpuTimes struct { + User uint32 + Nice uint32 + Sys uint32 + Spin uint32 + Intr uint32 + Idle uint32 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm64.go new file mode 100644 index 00000000..d659058c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_openbsd_arm64.go @@ -0,0 +1,10 @@ +package cpu + +type cpuTimes struct { + User uint64 + Nice uint64 + Sys uint64 + Spin uint64 + Intr uint64 + Idle uint64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_plan9.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_plan9.go new file mode 100644 index 00000000..a2e99d8c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_plan9.go @@ -0,0 +1,50 @@ +//go:build plan9 +// +build plan9 + +package cpu + +import ( + "context" + "os" + "runtime" + + stats "github.com/lufia/plan9stats" + "github.com/shirou/gopsutil/v3/internal/common" +) + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + // BUG: percpu flag is not supported yet. + root := os.Getenv("HOST_ROOT") + c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + s, err := stats.ReadCPUStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + return []TimesStat{ + { + CPU: c.Name, + User: s.User.Seconds(), + System: s.Sys.Seconds(), + Idle: s.Idle.Seconds(), + }, + }, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + return []InfoStat{}, common.ErrNotImplementedError +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go new file mode 100644 index 00000000..4231ad16 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_solaris.go @@ -0,0 +1,269 @@ +package cpu + +import ( + "context" + "errors" + "fmt" + "regexp" + "runtime" + "sort" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" +) + +var ClocksPerSec = float64(128) + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + ClocksPerSec = float64(clkTck) + } +} + +// sum all values in a float64 map with float64 keys +func msum(x map[float64]float64) float64 { + total := 0.0 + for _, y := range x { + total += y + } + return total +} + +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +var kstatSplit = regexp.MustCompile(`[:\s]+`) + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/") + if err != nil { + return nil, fmt.Errorf("cannot execute kstat: %s", err) + } + cpu := make(map[float64]float64) + idle := make(map[float64]float64) + user := make(map[float64]float64) + kern := make(map[float64]float64) + iowt := make(map[float64]float64) + // swap := make(map[float64]float64) + for _, line := range strings.Split(string(kstatSysOut), "\n") { + fields := kstatSplit.Split(line, -1) + if fields[0] != "cpu_stat" { + continue + } + cpuNumber, err := strconv.ParseFloat(fields[1], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse cpu number: %s", err) + } + cpu[cpuNumber] = cpuNumber + switch fields[3] { + case "idle": + idle[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse idle: %s", err) + } + case "user": + user[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse user: %s", err) + } + case "kernel": + kern[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse kernel: %s", err) + } + case "iowait": + iowt[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse iowait: %s", err) + } + //not sure how this translates, don't report, add to kernel, something else? + /*case "swap": + swap[cpuNumber], err = strconv.ParseFloat(fields[4], 64) + if err != nil { + return nil, fmt.Errorf("cannot parse swap: %s", err) + } */ + } + } + ret := make([]TimesStat, 0, len(cpu)) + if percpu { + for _, c := range cpu { + ct := &TimesStat{ + CPU: fmt.Sprintf("cpu%d", int(cpu[c])), + Idle: idle[c] / ClocksPerSec, + User: user[c] / ClocksPerSec, + System: kern[c] / ClocksPerSec, + Iowait: iowt[c] / ClocksPerSec, + } + ret = append(ret, *ct) + } + } else { + ct := &TimesStat{ + CPU: "cpu-total", + Idle: msum(idle) / ClocksPerSec, + User: msum(user) / ClocksPerSec, + System: msum(kern) / ClocksPerSec, + Iowait: msum(iowt) / ClocksPerSec, + } + ret = append(ret, *ct) + } + return ret, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + psrInfoOut, err := invoke.CommandWithContext(ctx, "psrinfo", "-p", "-v") + if err != nil { + return nil, fmt.Errorf("cannot execute psrinfo: %s", err) + } + + procs, err := parseProcessorInfo(string(psrInfoOut)) + if err != nil { + return nil, fmt.Errorf("error parsing psrinfo output: %s", err) + } + + isaInfoOut, err := invoke.CommandWithContext(ctx, "isainfo", "-b", "-v") + if err != nil { + return nil, fmt.Errorf("cannot execute isainfo: %s", err) + } + + flags, err := parseISAInfo(string(isaInfoOut)) + if err != nil { + return nil, fmt.Errorf("error parsing isainfo output: %s", err) + } + + result := make([]InfoStat, 0, len(flags)) + for _, proc := range procs { + procWithFlags := proc + procWithFlags.Flags = flags + result = append(result, procWithFlags) + } + + return result, nil +} + +var flagsMatch = regexp.MustCompile(`[\w\.]+`) + +func parseISAInfo(cmdOutput string) ([]string, error) { + words := flagsMatch.FindAllString(cmdOutput, -1) + + // Sanity check the output + if len(words) < 4 || words[1] != "bit" || words[3] != "applications" { + return nil, errors.New("attempted to parse invalid isainfo output") + } + + flags := make([]string, len(words)-4) + for i, val := range words[4:] { + flags[i] = val + } + sort.Strings(flags) + + return flags, nil +} + +var psrInfoMatch = regexp.MustCompile(`The physical processor has (?:([\d]+) virtual processors? \(([\d-]+)\)|([\d]+) cores and ([\d]+) virtual processors[^\n]+)\n(?:\s+ The core has.+\n)*\s+.+ \((\w+) ([\S]+) family (.+) model (.+) step (.+) clock (.+) MHz\)\n[\s]*(.*)`) + +const ( + psrNumCoresOffset = 1 + psrNumCoresHTOffset = 3 + psrNumHTOffset = 4 + psrVendorIDOffset = 5 + psrFamilyOffset = 7 + psrModelOffset = 8 + psrStepOffset = 9 + psrClockOffset = 10 + psrModelNameOffset = 11 +) + +func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) { + matches := psrInfoMatch.FindAllStringSubmatch(cmdOutput, -1) + + var infoStatCount int32 + result := make([]InfoStat, 0, len(matches)) + for physicalIndex, physicalCPU := range matches { + var step int32 + var clock float64 + + if physicalCPU[psrStepOffset] != "" { + stepParsed, err := strconv.ParseInt(physicalCPU[psrStepOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for step as 32-bit integer: %s", physicalCPU[9], err) + } + step = int32(stepParsed) + } + + if physicalCPU[psrClockOffset] != "" { + clockParsed, err := strconv.ParseInt(physicalCPU[psrClockOffset], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for clock as 32-bit integer: %s", physicalCPU[10], err) + } + clock = float64(clockParsed) + } + + var err error + var numCores int64 + var numHT int64 + switch { + case physicalCPU[psrNumCoresOffset] != "": + numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %s", physicalCPU[1], err) + } + + for i := 0; i < int(numCores); i++ { + result = append(result, InfoStat{ + CPU: infoStatCount, + PhysicalID: strconv.Itoa(physicalIndex), + CoreID: strconv.Itoa(i), + Cores: 1, + VendorID: physicalCPU[psrVendorIDOffset], + ModelName: physicalCPU[psrModelNameOffset], + Family: physicalCPU[psrFamilyOffset], + Model: physicalCPU[psrModelOffset], + Stepping: step, + Mhz: clock, + }) + infoStatCount++ + } + case physicalCPU[psrNumCoresHTOffset] != "": + numCores, err = strconv.ParseInt(physicalCPU[psrNumCoresHTOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for core count as 32-bit integer: %s", physicalCPU[3], err) + } + + numHT, err = strconv.ParseInt(physicalCPU[psrNumHTOffset], 10, 32) + if err != nil { + return nil, fmt.Errorf("cannot parse value %q for hyperthread count as 32-bit integer: %s", physicalCPU[4], err) + } + + for i := 0; i < int(numCores); i++ { + result = append(result, InfoStat{ + CPU: infoStatCount, + PhysicalID: strconv.Itoa(physicalIndex), + CoreID: strconv.Itoa(i), + Cores: int32(numHT) / int32(numCores), + VendorID: physicalCPU[psrVendorIDOffset], + ModelName: physicalCPU[psrModelNameOffset], + Family: physicalCPU[psrFamilyOffset], + Model: physicalCPU[psrModelOffset], + Stepping: step, + Mhz: clock, + }) + infoStatCount++ + } + default: + return nil, errors.New("values for cores with and without hyperthreading are both set") + } + } + return result, nil +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + return runtime.NumCPU(), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_windows.go b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_windows.go new file mode 100644 index 00000000..e10612fd --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/cpu/cpu_windows.go @@ -0,0 +1,229 @@ +//go:build windows +// +build windows + +package cpu + +import ( + "context" + "fmt" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/yusufpapurcu/wmi" + "golang.org/x/sys/windows" +) + +var ( + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") +) + +type win32_Processor struct { + Family uint16 + Manufacturer string + Name string + NumberOfLogicalProcessors uint32 + NumberOfCores uint32 + ProcessorID *string + Stepping *string + MaxClockSpeed uint32 +} + +// SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION +// defined in windows api doc with the following +// https://docs.microsoft.com/en-us/windows/desktop/api/winternl/nf-winternl-ntquerysysteminformation#system_processor_performance_information +// additional fields documented here +// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/processor_performance.htm +type win32_SystemProcessorPerformanceInformation struct { + IdleTime int64 // idle time in 100ns (this is not a filetime). + KernelTime int64 // kernel time in 100ns. kernel time includes idle time. (this is not a filetime). + UserTime int64 // usertime in 100ns (this is not a filetime). + DpcTime int64 // dpc time in 100ns (this is not a filetime). + InterruptTime int64 // interrupt time in 100ns + InterruptCount uint32 +} + +const ( + ClocksPerSec = 10000000.0 + + // systemProcessorPerformanceInformationClass information class to query with NTQuerySystemInformation + // https://processhacker.sourceforge.io/doc/ntexapi_8h.html#ad5d815b48e8f4da1ef2eb7a2f18a54e0 + win32_SystemProcessorPerformanceInformationClass = 8 + + // size of systemProcessorPerformanceInfoSize in memory + win32_SystemProcessorPerformanceInfoSize = uint32(unsafe.Sizeof(win32_SystemProcessorPerformanceInformation{})) +) + +// Times returns times stat per cpu and combined for all CPUs +func Times(percpu bool) ([]TimesStat, error) { + return TimesWithContext(context.Background(), percpu) +} + +func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { + if percpu { + return perCPUTimes() + } + + var ret []TimesStat + var lpIdleTime common.FILETIME + var lpKernelTime common.FILETIME + var lpUserTime common.FILETIME + r, _, _ := common.ProcGetSystemTimes.Call( + uintptr(unsafe.Pointer(&lpIdleTime)), + uintptr(unsafe.Pointer(&lpKernelTime)), + uintptr(unsafe.Pointer(&lpUserTime))) + if r == 0 { + return ret, windows.GetLastError() + } + + LOT := float64(0.0000001) + HIT := (LOT * 4294967296.0) + idle := ((HIT * float64(lpIdleTime.DwHighDateTime)) + (LOT * float64(lpIdleTime.DwLowDateTime))) + user := ((HIT * float64(lpUserTime.DwHighDateTime)) + (LOT * float64(lpUserTime.DwLowDateTime))) + kernel := ((HIT * float64(lpKernelTime.DwHighDateTime)) + (LOT * float64(lpKernelTime.DwLowDateTime))) + system := (kernel - idle) + + ret = append(ret, TimesStat{ + CPU: "cpu-total", + Idle: float64(idle), + User: float64(user), + System: float64(system), + }) + return ret, nil +} + +func Info() ([]InfoStat, error) { + return InfoWithContext(context.Background()) +} + +func InfoWithContext(ctx context.Context) ([]InfoStat, error) { + var ret []InfoStat + var dst []win32_Processor + q := wmi.CreateQuery(&dst, "") + if err := common.WMIQueryWithContext(ctx, q, &dst); err != nil { + return ret, err + } + + var procID string + for i, l := range dst { + procID = "" + if l.ProcessorID != nil { + procID = *l.ProcessorID + } + + cpu := InfoStat{ + CPU: int32(i), + Family: fmt.Sprintf("%d", l.Family), + VendorID: l.Manufacturer, + ModelName: l.Name, + Cores: int32(l.NumberOfLogicalProcessors), + PhysicalID: procID, + Mhz: float64(l.MaxClockSpeed), + Flags: []string{}, + } + ret = append(ret, cpu) + } + + return ret, nil +} + +// perCPUTimes returns times stat per cpu, per core and overall for all CPUs +func perCPUTimes() ([]TimesStat, error) { + var ret []TimesStat + stats, err := perfInfo() + if err != nil { + return nil, err + } + for core, v := range stats { + c := TimesStat{ + CPU: fmt.Sprintf("cpu%d", core), + User: float64(v.UserTime) / ClocksPerSec, + System: float64(v.KernelTime-v.IdleTime) / ClocksPerSec, + Idle: float64(v.IdleTime) / ClocksPerSec, + Irq: float64(v.InterruptTime) / ClocksPerSec, + } + ret = append(ret, c) + } + return ret, nil +} + +// makes call to Windows API function to retrieve performance information for each core +func perfInfo() ([]win32_SystemProcessorPerformanceInformation, error) { + // Make maxResults large for safety. + // We can't invoke the api call with a results array that's too small. + // If we have more than 2056 cores on a single host, then it's probably the future. + maxBuffer := 2056 + // buffer for results from the windows proc + resultBuffer := make([]win32_SystemProcessorPerformanceInformation, maxBuffer) + // size of the buffer in memory + bufferSize := uintptr(win32_SystemProcessorPerformanceInfoSize) * uintptr(maxBuffer) + // size of the returned response + var retSize uint32 + + // Invoke windows api proc. + // The returned err from the windows dll proc will always be non-nil even when successful. + // See https://godoc.org/golang.org/x/sys/windows#LazyProc.Call for more information + retCode, _, err := common.ProcNtQuerySystemInformation.Call( + win32_SystemProcessorPerformanceInformationClass, // System Information Class -> SystemProcessorPerformanceInformation + uintptr(unsafe.Pointer(&resultBuffer[0])), // pointer to first element in result buffer + bufferSize, // size of the buffer in memory + uintptr(unsafe.Pointer(&retSize)), // pointer to the size of the returned results the windows proc will set this + ) + + // check return code for errors + if retCode != 0 { + return nil, fmt.Errorf("call to NtQuerySystemInformation returned %d. err: %s", retCode, err.Error()) + } + + // calculate the number of returned elements based on the returned size + numReturnedElements := retSize / win32_SystemProcessorPerformanceInfoSize + + // trim results to the number of returned elements + resultBuffer = resultBuffer[:numReturnedElements] + + return resultBuffer, nil +} + +// SystemInfo is an equivalent representation of SYSTEM_INFO in the Windows API. +// https://msdn.microsoft.com/en-us/library/ms724958%28VS.85%29.aspx?f=255&MSPPError=-2147217396 +// https://github.com/elastic/go-windows/blob/bb1581babc04d5cb29a2bfa7a9ac6781c730c8dd/kernel32.go#L43 +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwPageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +func CountsWithContext(ctx context.Context, logical bool) (int, error) { + if logical { + // https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L97 + ret := windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS) + if ret != 0 { + return int(ret), nil + } + var systemInfo systemInfo + _, _, err := procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&systemInfo))) + if systemInfo.dwNumberOfProcessors == 0 { + return 0, err + } + return int(systemInfo.dwNumberOfProcessors), nil + } + // physical cores https://github.com/giampaolo/psutil/blob/d01a9eaa35a8aadf6c519839e987a49d8be2d891/psutil/_psutil_windows.c#L499 + // for the time being, try with unreliable and slow WMI call… + var dst []win32_Processor + q := wmi.CreateQuery(&dst, "") + if err := common.WMIQueryWithContext(ctx, q, &dst); err != nil { + return 0, err + } + var count uint32 + for _, d := range dst { + count += d.NumberOfCores + } + return int(count), nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/binary.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/binary.go new file mode 100644 index 00000000..5e8d43db --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/binary.go @@ -0,0 +1,637 @@ +package common + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package binary implements simple translation between numbers and byte +// sequences and encoding and decoding of varints. +// +// Numbers are translated by reading and writing fixed-size values. +// A fixed-size value is either a fixed-size arithmetic +// type (int8, uint8, int16, float32, complex64, ...) +// or an array or struct containing only fixed-size values. +// +// The varint functions encode and decode single integer values using +// a variable-length encoding; smaller values require fewer bytes. +// For a specification, see +// http://code.google.com/apis/protocolbuffers/docs/encoding.html. +// +// This package favors simplicity over efficiency. Clients that require +// high-performance serialization, especially for large data structures, +// should look at more advanced solutions such as the encoding/gob +// package or protocol buffers. + +import ( + "errors" + "io" + "math" + "reflect" +) + +// A ByteOrder specifies how to convert byte sequences into +// 16-, 32-, or 64-bit unsigned integers. +type ByteOrder interface { + Uint16([]byte) uint16 + Uint32([]byte) uint32 + Uint64([]byte) uint64 + PutUint16([]byte, uint16) + PutUint32([]byte, uint32) + PutUint64([]byte, uint64) + String() string +} + +// LittleEndian is the little-endian implementation of ByteOrder. +var LittleEndian littleEndian + +// BigEndian is the big-endian implementation of ByteOrder. +var BigEndian bigEndian + +type littleEndian struct{} + +func (littleEndian) Uint16(b []byte) uint16 { return uint16(b[0]) | uint16(b[1])<<8 } + +func (littleEndian) PutUint16(b []byte, v uint16) { + b[0] = byte(v) + b[1] = byte(v >> 8) +} + +func (littleEndian) Uint32(b []byte) uint32 { + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func (littleEndian) PutUint32(b []byte, v uint32) { + b[0] = byte(v) + b[1] = byte(v >> 8) + b[2] = byte(v >> 16) + b[3] = byte(v >> 24) +} + +func (littleEndian) Uint64(b []byte) uint64 { + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +func (littleEndian) PutUint64(b []byte, v uint64) { + b[0] = byte(v) + b[1] = byte(v >> 8) + b[2] = byte(v >> 16) + b[3] = byte(v >> 24) + b[4] = byte(v >> 32) + b[5] = byte(v >> 40) + b[6] = byte(v >> 48) + b[7] = byte(v >> 56) +} + +func (littleEndian) String() string { return "LittleEndian" } + +func (littleEndian) GoString() string { return "binary.LittleEndian" } + +type bigEndian struct{} + +func (bigEndian) Uint16(b []byte) uint16 { return uint16(b[1]) | uint16(b[0])<<8 } + +func (bigEndian) PutUint16(b []byte, v uint16) { + b[0] = byte(v >> 8) + b[1] = byte(v) +} + +func (bigEndian) Uint32(b []byte) uint32 { + return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 +} + +func (bigEndian) PutUint32(b []byte, v uint32) { + b[0] = byte(v >> 24) + b[1] = byte(v >> 16) + b[2] = byte(v >> 8) + b[3] = byte(v) +} + +func (bigEndian) Uint64(b []byte) uint64 { + return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | + uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 +} + +func (bigEndian) PutUint64(b []byte, v uint64) { + b[0] = byte(v >> 56) + b[1] = byte(v >> 48) + b[2] = byte(v >> 40) + b[3] = byte(v >> 32) + b[4] = byte(v >> 24) + b[5] = byte(v >> 16) + b[6] = byte(v >> 8) + b[7] = byte(v) +} + +func (bigEndian) String() string { return "BigEndian" } + +func (bigEndian) GoString() string { return "binary.BigEndian" } + +// Read reads structured binary data from r into data. +// Data must be a pointer to a fixed-size value or a slice +// of fixed-size values. +// Bytes read from r are decoded using the specified byte order +// and written to successive fields of the data. +// When reading into structs, the field data for fields with +// blank (_) field names is skipped; i.e., blank field names +// may be used for padding. +// When reading into a struct, all non-blank fields must be exported. +func Read(r io.Reader, order ByteOrder, data interface{}) error { + // Fast path for basic types and slices. + if n := intDataSize(data); n != 0 { + var b [8]byte + var bs []byte + if n > len(b) { + bs = make([]byte, n) + } else { + bs = b[:n] + } + if _, err := io.ReadFull(r, bs); err != nil { + return err + } + switch data := data.(type) { + case *int8: + *data = int8(b[0]) + case *uint8: + *data = b[0] + case *int16: + *data = int16(order.Uint16(bs)) + case *uint16: + *data = order.Uint16(bs) + case *int32: + *data = int32(order.Uint32(bs)) + case *uint32: + *data = order.Uint32(bs) + case *int64: + *data = int64(order.Uint64(bs)) + case *uint64: + *data = order.Uint64(bs) + case []int8: + for i, x := range bs { // Easier to loop over the input for 8-bit values. + data[i] = int8(x) + } + case []uint8: + copy(data, bs) + case []int16: + for i := range data { + data[i] = int16(order.Uint16(bs[2*i:])) + } + case []uint16: + for i := range data { + data[i] = order.Uint16(bs[2*i:]) + } + case []int32: + for i := range data { + data[i] = int32(order.Uint32(bs[4*i:])) + } + case []uint32: + for i := range data { + data[i] = order.Uint32(bs[4*i:]) + } + case []int64: + for i := range data { + data[i] = int64(order.Uint64(bs[8*i:])) + } + case []uint64: + for i := range data { + data[i] = order.Uint64(bs[8*i:]) + } + } + return nil + } + + // Fallback to reflect-based decoding. + v := reflect.ValueOf(data) + size := -1 + switch v.Kind() { + case reflect.Ptr: + v = v.Elem() + size = dataSize(v) + case reflect.Slice: + size = dataSize(v) + } + if size < 0 { + return errors.New("binary.Read: invalid type " + reflect.TypeOf(data).String()) + } + d := &decoder{order: order, buf: make([]byte, size)} + if _, err := io.ReadFull(r, d.buf); err != nil { + return err + } + d.value(v) + return nil +} + +// Write writes the binary representation of data into w. +// Data must be a fixed-size value or a slice of fixed-size +// values, or a pointer to such data. +// Bytes written to w are encoded using the specified byte order +// and read from successive fields of the data. +// When writing structs, zero values are written for fields +// with blank (_) field names. +func Write(w io.Writer, order ByteOrder, data interface{}) error { + // Fast path for basic types and slices. + if n := intDataSize(data); n != 0 { + var b [8]byte + var bs []byte + if n > len(b) { + bs = make([]byte, n) + } else { + bs = b[:n] + } + switch v := data.(type) { + case *int8: + bs = b[:1] + b[0] = byte(*v) + case int8: + bs = b[:1] + b[0] = byte(v) + case []int8: + for i, x := range v { + bs[i] = byte(x) + } + case *uint8: + bs = b[:1] + b[0] = *v + case uint8: + bs = b[:1] + b[0] = byte(v) + case []uint8: + bs = v + case *int16: + bs = b[:2] + order.PutUint16(bs, uint16(*v)) + case int16: + bs = b[:2] + order.PutUint16(bs, uint16(v)) + case []int16: + for i, x := range v { + order.PutUint16(bs[2*i:], uint16(x)) + } + case *uint16: + bs = b[:2] + order.PutUint16(bs, *v) + case uint16: + bs = b[:2] + order.PutUint16(bs, v) + case []uint16: + for i, x := range v { + order.PutUint16(bs[2*i:], x) + } + case *int32: + bs = b[:4] + order.PutUint32(bs, uint32(*v)) + case int32: + bs = b[:4] + order.PutUint32(bs, uint32(v)) + case []int32: + for i, x := range v { + order.PutUint32(bs[4*i:], uint32(x)) + } + case *uint32: + bs = b[:4] + order.PutUint32(bs, *v) + case uint32: + bs = b[:4] + order.PutUint32(bs, v) + case []uint32: + for i, x := range v { + order.PutUint32(bs[4*i:], x) + } + case *int64: + bs = b[:8] + order.PutUint64(bs, uint64(*v)) + case int64: + bs = b[:8] + order.PutUint64(bs, uint64(v)) + case []int64: + for i, x := range v { + order.PutUint64(bs[8*i:], uint64(x)) + } + case *uint64: + bs = b[:8] + order.PutUint64(bs, *v) + case uint64: + bs = b[:8] + order.PutUint64(bs, v) + case []uint64: + for i, x := range v { + order.PutUint64(bs[8*i:], x) + } + } + _, err := w.Write(bs) + return err + } + + // Fallback to reflect-based encoding. + v := reflect.Indirect(reflect.ValueOf(data)) + size := dataSize(v) + if size < 0 { + return errors.New("binary.Write: invalid type " + reflect.TypeOf(data).String()) + } + buf := make([]byte, size) + e := &encoder{order: order, buf: buf} + e.value(v) + _, err := w.Write(buf) + return err +} + +// Size returns how many bytes Write would generate to encode the value v, which +// must be a fixed-size value or a slice of fixed-size values, or a pointer to such data. +// If v is neither of these, Size returns -1. +func Size(v interface{}) int { + return dataSize(reflect.Indirect(reflect.ValueOf(v))) +} + +// dataSize returns the number of bytes the actual data represented by v occupies in memory. +// For compound structures, it sums the sizes of the elements. Thus, for instance, for a slice +// it returns the length of the slice times the element size and does not count the memory +// occupied by the header. If the type of v is not acceptable, dataSize returns -1. +func dataSize(v reflect.Value) int { + if v.Kind() == reflect.Slice { + if s := sizeof(v.Type().Elem()); s >= 0 { + return s * v.Len() + } + return -1 + } + return sizeof(v.Type()) +} + +// sizeof returns the size >= 0 of variables for the given type or -1 if the type is not acceptable. +func sizeof(t reflect.Type) int { + switch t.Kind() { + case reflect.Array: + if s := sizeof(t.Elem()); s >= 0 { + return s * t.Len() + } + + case reflect.Struct: + sum := 0 + for i, n := 0, t.NumField(); i < n; i++ { + s := sizeof(t.Field(i).Type) + if s < 0 { + return -1 + } + sum += s + } + return sum + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.Ptr: + return int(t.Size()) + } + + return -1 +} + +type coder struct { + order ByteOrder + buf []byte +} + +type ( + decoder coder + encoder coder +) + +func (d *decoder) uint8() uint8 { + x := d.buf[0] + d.buf = d.buf[1:] + return x +} + +func (e *encoder) uint8(x uint8) { + e.buf[0] = x + e.buf = e.buf[1:] +} + +func (d *decoder) uint16() uint16 { + x := d.order.Uint16(d.buf[0:2]) + d.buf = d.buf[2:] + return x +} + +func (e *encoder) uint16(x uint16) { + e.order.PutUint16(e.buf[0:2], x) + e.buf = e.buf[2:] +} + +func (d *decoder) uint32() uint32 { + x := d.order.Uint32(d.buf[0:4]) + d.buf = d.buf[4:] + return x +} + +func (e *encoder) uint32(x uint32) { + e.order.PutUint32(e.buf[0:4], x) + e.buf = e.buf[4:] +} + +func (d *decoder) uint64() uint64 { + x := d.order.Uint64(d.buf[0:8]) + d.buf = d.buf[8:] + return x +} + +func (e *encoder) uint64(x uint64) { + e.order.PutUint64(e.buf[0:8], x) + e.buf = e.buf[8:] +} + +func (d *decoder) int8() int8 { return int8(d.uint8()) } + +func (e *encoder) int8(x int8) { e.uint8(uint8(x)) } + +func (d *decoder) int16() int16 { return int16(d.uint16()) } + +func (e *encoder) int16(x int16) { e.uint16(uint16(x)) } + +func (d *decoder) int32() int32 { return int32(d.uint32()) } + +func (e *encoder) int32(x int32) { e.uint32(uint32(x)) } + +func (d *decoder) int64() int64 { return int64(d.uint64()) } + +func (e *encoder) int64(x int64) { e.uint64(uint64(x)) } + +func (d *decoder) value(v reflect.Value) { + switch v.Kind() { + case reflect.Array: + l := v.Len() + for i := 0; i < l; i++ { + d.value(v.Index(i)) + } + + case reflect.Struct: + t := v.Type() + l := v.NumField() + for i := 0; i < l; i++ { + // Note: Calling v.CanSet() below is an optimization. + // It would be sufficient to check the field name, + // but creating the StructField info for each field is + // costly (run "go test -bench=ReadStruct" and compare + // results when making changes to this code). + if v := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { + d.value(v) + } else { + d.skip(v) + } + } + + case reflect.Slice: + l := v.Len() + for i := 0; i < l; i++ { + d.value(v.Index(i)) + } + + case reflect.Int8: + v.SetInt(int64(d.int8())) + case reflect.Int16: + v.SetInt(int64(d.int16())) + case reflect.Int32: + v.SetInt(int64(d.int32())) + case reflect.Int64: + v.SetInt(d.int64()) + + case reflect.Uint8: + v.SetUint(uint64(d.uint8())) + case reflect.Uint16: + v.SetUint(uint64(d.uint16())) + case reflect.Uint32: + v.SetUint(uint64(d.uint32())) + case reflect.Uint64: + v.SetUint(d.uint64()) + + case reflect.Float32: + v.SetFloat(float64(math.Float32frombits(d.uint32()))) + case reflect.Float64: + v.SetFloat(math.Float64frombits(d.uint64())) + + case reflect.Complex64: + v.SetComplex(complex( + float64(math.Float32frombits(d.uint32())), + float64(math.Float32frombits(d.uint32())), + )) + case reflect.Complex128: + v.SetComplex(complex( + math.Float64frombits(d.uint64()), + math.Float64frombits(d.uint64()), + )) + } +} + +func (e *encoder) value(v reflect.Value) { + switch v.Kind() { + case reflect.Array: + l := v.Len() + for i := 0; i < l; i++ { + e.value(v.Index(i)) + } + + case reflect.Struct: + t := v.Type() + l := v.NumField() + for i := 0; i < l; i++ { + // see comment for corresponding code in decoder.value() + if v := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { + e.value(v) + } else { + e.skip(v) + } + } + + case reflect.Slice: + l := v.Len() + for i := 0; i < l; i++ { + e.value(v.Index(i)) + } + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + switch v.Type().Kind() { + case reflect.Int8: + e.int8(int8(v.Int())) + case reflect.Int16: + e.int16(int16(v.Int())) + case reflect.Int32: + e.int32(int32(v.Int())) + case reflect.Int64: + e.int64(v.Int()) + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch v.Type().Kind() { + case reflect.Uint8: + e.uint8(uint8(v.Uint())) + case reflect.Uint16: + e.uint16(uint16(v.Uint())) + case reflect.Uint32: + e.uint32(uint32(v.Uint())) + case reflect.Uint64: + e.uint64(v.Uint()) + } + + case reflect.Float32, reflect.Float64: + switch v.Type().Kind() { + case reflect.Float32: + e.uint32(math.Float32bits(float32(v.Float()))) + case reflect.Float64: + e.uint64(math.Float64bits(v.Float())) + } + + case reflect.Complex64, reflect.Complex128: + switch v.Type().Kind() { + case reflect.Complex64: + x := v.Complex() + e.uint32(math.Float32bits(float32(real(x)))) + e.uint32(math.Float32bits(float32(imag(x)))) + case reflect.Complex128: + x := v.Complex() + e.uint64(math.Float64bits(real(x))) + e.uint64(math.Float64bits(imag(x))) + } + } +} + +func (d *decoder) skip(v reflect.Value) { + d.buf = d.buf[dataSize(v):] +} + +func (e *encoder) skip(v reflect.Value) { + n := dataSize(v) + for i := range e.buf[0:n] { + e.buf[i] = 0 + } + e.buf = e.buf[n:] +} + +// intDataSize returns the size of the data required to represent the data when encoded. +// It returns zero if the type cannot be implemented by the fast path in Read or Write. +func intDataSize(data interface{}) int { + switch data := data.(type) { + case int8, *int8, *uint8: + return 1 + case []int8: + return len(data) + case []uint8: + return len(data) + case int16, *int16, *uint16: + return 2 + case []int16: + return 2 * len(data) + case []uint16: + return 2 * len(data) + case int32, *int32, *uint32: + return 4 + case []int32: + return 4 * len(data) + case []uint32: + return 4 * len(data) + case int64, *int64, *uint64: + return 8 + case []int64: + return 8 * len(data) + case []uint64: + return 8 * len(data) + } + return 0 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go new file mode 100644 index 00000000..99ed6a58 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go @@ -0,0 +1,464 @@ +package common + +// +// gopsutil is a port of psutil(http://pythonhosted.org/psutil/). +// This covers these architectures. +// - linux (amd64, arm) +// - freebsd (amd64) +// - windows (amd64) + +import ( + "bufio" + "bytes" + "context" + "errors" + "fmt" + "io" + "net/url" + "os" + "os/exec" + "path" + "path/filepath" + "reflect" + "runtime" + "strconv" + "strings" + "time" + + "github.com/shirou/gopsutil/v3/common" +) + +var ( + Timeout = 3 * time.Second + ErrTimeout = errors.New("command timed out") +) + +type Invoker interface { + Command(string, ...string) ([]byte, error) + CommandWithContext(context.Context, string, ...string) ([]byte, error) +} + +type Invoke struct{} + +func (i Invoke) Command(name string, arg ...string) ([]byte, error) { + ctx, cancel := context.WithTimeout(context.Background(), Timeout) + defer cancel() + return i.CommandWithContext(ctx, name, arg...) +} + +func (i Invoke) CommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error) { + cmd := exec.CommandContext(ctx, name, arg...) + + var buf bytes.Buffer + cmd.Stdout = &buf + cmd.Stderr = &buf + + if err := cmd.Start(); err != nil { + return buf.Bytes(), err + } + + if err := cmd.Wait(); err != nil { + return buf.Bytes(), err + } + + return buf.Bytes(), nil +} + +type FakeInvoke struct { + Suffix string // Suffix species expected file name suffix such as "fail" + Error error // If Error specified, return the error. +} + +// Command in FakeInvoke returns from expected file if exists. +func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) { + if i.Error != nil { + return []byte{}, i.Error + } + + arch := runtime.GOOS + + commandName := filepath.Base(name) + + fname := strings.Join(append([]string{commandName}, arg...), "") + fname = url.QueryEscape(fname) + fpath := path.Join("testdata", arch, fname) + if i.Suffix != "" { + fpath += "_" + i.Suffix + } + if PathExists(fpath) { + return os.ReadFile(fpath) + } + return []byte{}, fmt.Errorf("could not find testdata: %s", fpath) +} + +func (i FakeInvoke) CommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error) { + return i.Command(name, arg...) +} + +var ErrNotImplementedError = errors.New("not implemented yet") + +// ReadFile reads contents from a file +func ReadFile(filename string) (string, error) { + content, err := os.ReadFile(filename) + if err != nil { + return "", err + } + + return string(content), nil +} + +// ReadLines reads contents from a file and splits them by new lines. +// A convenience wrapper to ReadLinesOffsetN(filename, 0, -1). +func ReadLines(filename string) ([]string, error) { + return ReadLinesOffsetN(filename, 0, -1) +} + +// ReadLine reads a file and returns the first occurrence of a line that is prefixed with prefix. +func ReadLine(filename string, prefix string) (string, error) { + f, err := os.Open(filename) + if err != nil { + return "", err + } + defer f.Close() + r := bufio.NewReader(f) + for { + line, err := r.ReadString('\n') + if err != nil { + if err == io.EOF { + break + } + return "", err + } + if strings.HasPrefix(line, prefix) { + return line, nil + } + } + + return "", nil +} + +// ReadLinesOffsetN reads contents from file and splits them by new line. +// The offset tells at which line number to start. +// The count determines the number of lines to read (starting from offset): +// n >= 0: at most n lines +// n < 0: whole file +func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error) { + f, err := os.Open(filename) + if err != nil { + return []string{""}, err + } + defer f.Close() + + var ret []string + + r := bufio.NewReader(f) + for i := 0; i < n+int(offset) || n < 0; i++ { + line, err := r.ReadString('\n') + if err != nil { + if err == io.EOF && len(line) > 0 { + ret = append(ret, strings.Trim(line, "\n")) + } + break + } + if i < int(offset) { + continue + } + ret = append(ret, strings.Trim(line, "\n")) + } + + return ret, nil +} + +func IntToString(orig []int8) string { + ret := make([]byte, len(orig)) + size := -1 + for i, o := range orig { + if o == 0 { + size = i + break + } + ret[i] = byte(o) + } + if size == -1 { + size = len(orig) + } + + return string(ret[0:size]) +} + +func UintToString(orig []uint8) string { + ret := make([]byte, len(orig)) + size := -1 + for i, o := range orig { + if o == 0 { + size = i + break + } + ret[i] = byte(o) + } + if size == -1 { + size = len(orig) + } + + return string(ret[0:size]) +} + +func ByteToString(orig []byte) string { + n := -1 + l := -1 + for i, b := range orig { + // skip left side null + if l == -1 && b == 0 { + continue + } + if l == -1 { + l = i + } + + if b == 0 { + break + } + n = i + 1 + } + if n == -1 { + return string(orig) + } + return string(orig[l:n]) +} + +// ReadInts reads contents from single line file and returns them as []int32. +func ReadInts(filename string) ([]int64, error) { + f, err := os.Open(filename) + if err != nil { + return []int64{}, err + } + defer f.Close() + + var ret []int64 + + r := bufio.NewReader(f) + + // The int files that this is concerned with should only be one liners. + line, err := r.ReadString('\n') + if err != nil { + return []int64{}, err + } + + i, err := strconv.ParseInt(strings.Trim(line, "\n"), 10, 32) + if err != nil { + return []int64{}, err + } + ret = append(ret, i) + + return ret, nil +} + +// Parse Hex to uint32 without error +func HexToUint32(hex string) uint32 { + vv, _ := strconv.ParseUint(hex, 16, 32) + return uint32(vv) +} + +// Parse to int32 without error +func mustParseInt32(val string) int32 { + vv, _ := strconv.ParseInt(val, 10, 32) + return int32(vv) +} + +// Parse to uint64 without error +func mustParseUint64(val string) uint64 { + vv, _ := strconv.ParseInt(val, 10, 64) + return uint64(vv) +} + +// Parse to Float64 without error +func mustParseFloat64(val string) float64 { + vv, _ := strconv.ParseFloat(val, 64) + return vv +} + +// StringsHas checks the target string slice contains src or not +func StringsHas(target []string, src string) bool { + for _, t := range target { + if strings.TrimSpace(t) == src { + return true + } + } + return false +} + +// StringsContains checks the src in any string of the target string slice +func StringsContains(target []string, src string) bool { + for _, t := range target { + if strings.Contains(t, src) { + return true + } + } + return false +} + +// IntContains checks the src in any int of the target int slice. +func IntContains(target []int, src int) bool { + for _, t := range target { + if src == t { + return true + } + } + return false +} + +// get struct attributes. +// This method is used only for debugging platform dependent code. +func attributes(m interface{}) map[string]reflect.Type { + typ := reflect.TypeOf(m) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + + attrs := make(map[string]reflect.Type) + if typ.Kind() != reflect.Struct { + return nil + } + + for i := 0; i < typ.NumField(); i++ { + p := typ.Field(i) + if !p.Anonymous { + attrs[p.Name] = p.Type + } + } + + return attrs +} + +func PathExists(filename string) bool { + if _, err := os.Stat(filename); err == nil { + return true + } + return false +} + +// PathExistsWithContents returns the filename exists and it is not empty +func PathExistsWithContents(filename string) bool { + info, err := os.Stat(filename) + if err != nil { + return false + } + return info.Size() > 4 // at least 4 bytes +} + +// GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default. +// The context may optionally contain a map superseding os.EnvKey. +func GetEnvWithContext(ctx context.Context, key string, dfault string, combineWith ...string) string { + var value string + if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok { + value = env[common.EnvKeyType(key)] + } + if value == "" { + value = os.Getenv(key) + } + if value == "" { + value = dfault + } + + return combine(value, combineWith) +} + +// GetEnv retrieves the environment variable key. If it does not exist it returns the default. +func GetEnv(key string, dfault string, combineWith ...string) string { + value := os.Getenv(key) + if value == "" { + value = dfault + } + + return combine(value, combineWith) +} + +func combine(value string, combineWith []string) string { + switch len(combineWith) { + case 0: + return value + case 1: + return filepath.Join(value, combineWith[0]) + default: + all := make([]string, len(combineWith)+1) + all[0] = value + copy(all[1:], combineWith) + return filepath.Join(all...) + } +} + +func HostProc(combineWith ...string) string { + return GetEnv("HOST_PROC", "/proc", combineWith...) +} + +func HostSys(combineWith ...string) string { + return GetEnv("HOST_SYS", "/sys", combineWith...) +} + +func HostEtc(combineWith ...string) string { + return GetEnv("HOST_ETC", "/etc", combineWith...) +} + +func HostVar(combineWith ...string) string { + return GetEnv("HOST_VAR", "/var", combineWith...) +} + +func HostRun(combineWith ...string) string { + return GetEnv("HOST_RUN", "/run", combineWith...) +} + +func HostDev(combineWith ...string) string { + return GetEnv("HOST_DEV", "/dev", combineWith...) +} + +func HostRoot(combineWith ...string) string { + return GetEnv("HOST_ROOT", "/", combineWith...) +} + +func HostProcWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_PROC", "/proc", combineWith...) +} + +func HostProcMountInfoWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_PROC_MOUNTINFO", "", combineWith...) +} + +func HostSysWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_SYS", "/sys", combineWith...) +} + +func HostEtcWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_ETC", "/etc", combineWith...) +} + +func HostVarWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_VAR", "/var", combineWith...) +} + +func HostRunWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_RUN", "/run", combineWith...) +} + +func HostDevWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_DEV", "/dev", combineWith...) +} + +func HostRootWithContext(ctx context.Context, combineWith ...string) string { + return GetEnvWithContext(ctx, "HOST_ROOT", "/", combineWith...) +} + +// getSysctrlEnv sets LC_ALL=C in a list of env vars for use when running +// sysctl commands (see DoSysctrl). +func getSysctrlEnv(env []string) []string { + foundLC := false + for i, line := range env { + if strings.HasPrefix(line, "LC_ALL") { + env[i] = "LC_ALL=C" + foundLC = true + } + } + if !foundLC { + env = append(env, "LC_ALL=C") + } + return env +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_darwin.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_darwin.go new file mode 100644 index 00000000..f1a78459 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_darwin.go @@ -0,0 +1,66 @@ +//go:build darwin +// +build darwin + +package common + +import ( + "context" + "os" + "os/exec" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +func DoSysctrlWithContext(ctx context.Context, mib string) ([]string, error) { + cmd := exec.CommandContext(ctx, "sysctl", "-n", mib) + cmd.Env = getSysctrlEnv(os.Environ()) + out, err := cmd.Output() + if err != nil { + return []string{}, err + } + v := strings.Replace(string(out), "{ ", "", 1) + v = strings.Replace(string(v), " }", "", 1) + values := strings.Fields(string(v)) + + return values, nil +} + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + 202, // unix.SYS___SYSCTL https://github.com/golang/sys/blob/76b94024e4b621e672466e8db3d7f084e7ddcad2/unix/zsysnum_darwin_amd64.go#L146 + uintptr(unsafe.Pointer(&mib[0])), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + 202, // unix.SYS___SYSCTL https://github.com/golang/sys/blob/76b94024e4b621e672466e8db3d7f084e7ddcad2/unix/zsysnum_darwin_amd64.go#L146 + uintptr(unsafe.Pointer(&mib[0])), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_freebsd.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_freebsd.go new file mode 100644 index 00000000..f590e2e6 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_freebsd.go @@ -0,0 +1,82 @@ +//go:build freebsd || openbsd +// +build freebsd openbsd + +package common + +import ( + "fmt" + "os" + "os/exec" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +func SysctlUint(mib string) (uint64, error) { + buf, err := unix.SysctlRaw(mib) + if err != nil { + return 0, err + } + if len(buf) == 8 { // 64 bit + return *(*uint64)(unsafe.Pointer(&buf[0])), nil + } + if len(buf) == 4 { // 32bit + t := *(*uint32)(unsafe.Pointer(&buf[0])) + return uint64(t), nil + } + return 0, fmt.Errorf("unexpected size: %s, %d", mib, len(buf)) +} + +func DoSysctrl(mib string) ([]string, error) { + cmd := exec.Command("sysctl", "-n", mib) + cmd.Env = getSysctrlEnv(os.Environ()) + out, err := cmd.Output() + if err != nil { + return []string{}, err + } + v := strings.Replace(string(out), "{ ", "", 1) + v = strings.Replace(string(v), " }", "", 1) + values := strings.Fields(string(v)) + + return values, nil +} + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go new file mode 100644 index 00000000..a644687b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go @@ -0,0 +1,331 @@ +//go:build linux +// +build linux + +package common + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "sync" + "syscall" + "time" +) + +func DoSysctrl(mib string) ([]string, error) { + cmd := exec.Command("sysctl", "-n", mib) + cmd.Env = getSysctrlEnv(os.Environ()) + out, err := cmd.Output() + if err != nil { + return []string{}, err + } + v := strings.Replace(string(out), "{ ", "", 1) + v = strings.Replace(string(v), " }", "", 1) + values := strings.Fields(string(v)) + + return values, nil +} + +func NumProcs() (uint64, error) { + return NumProcsWithContext(context.Background()) +} + +func NumProcsWithContext(ctx context.Context) (uint64, error) { + f, err := os.Open(HostProcWithContext(ctx)) + if err != nil { + return 0, err + } + defer f.Close() + + list, err := f.Readdirnames(-1) + if err != nil { + return 0, err + } + var cnt uint64 + + for _, v := range list { + if _, err = strconv.ParseUint(v, 10, 64); err == nil { + cnt++ + } + } + + return cnt, nil +} + +func BootTimeWithContext(ctx context.Context) (uint64, error) { + system, role, err := VirtualizationWithContext(ctx) + if err != nil { + return 0, err + } + + useStatFile := true + if system == "lxc" && role == "guest" { + // if lxc, /proc/uptime is used. + useStatFile = false + } else if system == "docker" && role == "guest" { + // also docker, guest + useStatFile = false + } + + if useStatFile { + return readBootTimeStat(ctx) + } + + filename := HostProcWithContext(ctx, "uptime") + lines, err := ReadLines(filename) + if err != nil { + return handleBootTimeFileReadErr(err) + } + if len(lines) != 1 { + return 0, fmt.Errorf("wrong uptime format") + } + f := strings.Fields(lines[0]) + b, err := strconv.ParseFloat(f[0], 64) + if err != nil { + return 0, err + } + currentTime := float64(time.Now().UnixNano()) / float64(time.Second) + t := currentTime - b + return uint64(t), nil +} + +func handleBootTimeFileReadErr(err error) (uint64, error) { + if os.IsPermission(err) { + var info syscall.Sysinfo_t + err := syscall.Sysinfo(&info) + if err != nil { + return 0, err + } + + currentTime := time.Now().UnixNano() / int64(time.Second) + t := currentTime - int64(info.Uptime) + return uint64(t), nil + } + return 0, err +} + +func readBootTimeStat(ctx context.Context) (uint64, error) { + filename := HostProcWithContext(ctx, "stat") + line, err := ReadLine(filename, "btime") + if err != nil { + return handleBootTimeFileReadErr(err) + } + if strings.HasPrefix(line, "btime") { + f := strings.Fields(line) + if len(f) != 2 { + return 0, fmt.Errorf("wrong btime format") + } + b, err := strconv.ParseInt(f[1], 10, 64) + if err != nil { + return 0, err + } + t := uint64(b) + return t, nil + } + return 0, fmt.Errorf("could not find btime") +} + +func Virtualization() (string, string, error) { + return VirtualizationWithContext(context.Background()) +} + +// required variables for concurrency safe virtualization caching +var ( + cachedVirtMap map[string]string + cachedVirtMutex sync.RWMutex + cachedVirtOnce sync.Once +) + +func VirtualizationWithContext(ctx context.Context) (string, string, error) { + var system, role string + + // if cached already, return from cache + cachedVirtMutex.RLock() // unlock won't be deferred so concurrent reads don't wait for long + if cachedVirtMap != nil { + cachedSystem, cachedRole := cachedVirtMap["system"], cachedVirtMap["role"] + cachedVirtMutex.RUnlock() + return cachedSystem, cachedRole, nil + } + cachedVirtMutex.RUnlock() + + filename := HostProcWithContext(ctx, "xen") + if PathExists(filename) { + system = "xen" + role = "guest" // assume guest + + if PathExists(filepath.Join(filename, "capabilities")) { + contents, err := ReadLines(filepath.Join(filename, "capabilities")) + if err == nil { + if StringsContains(contents, "control_d") { + role = "host" + } + } + } + } + + filename = HostProcWithContext(ctx, "modules") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + if StringsContains(contents, "kvm") { + system = "kvm" + role = "host" + } else if StringsContains(contents, "hv_util") { + system = "hyperv" + role = "guest" + } else if StringsContains(contents, "vboxdrv") { + system = "vbox" + role = "host" + } else if StringsContains(contents, "vboxguest") { + system = "vbox" + role = "guest" + } else if StringsContains(contents, "vmware") { + system = "vmware" + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx, "cpuinfo") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + if StringsContains(contents, "QEMU Virtual CPU") || + StringsContains(contents, "Common KVM processor") || + StringsContains(contents, "Common 32-bit KVM processor") { + system = "kvm" + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx, "bus/pci/devices") + if PathExists(filename) { + contents, err := ReadLines(filename) + if err == nil { + if StringsContains(contents, "virtio-pci") { + role = "guest" + } + } + } + + filename = HostProcWithContext(ctx) + if PathExists(filepath.Join(filename, "bc", "0")) { + system = "openvz" + role = "host" + } else if PathExists(filepath.Join(filename, "vz")) { + system = "openvz" + role = "guest" + } + + // not use dmidecode because it requires root + if PathExists(filepath.Join(filename, "self", "status")) { + contents, err := ReadLines(filepath.Join(filename, "self", "status")) + if err == nil { + if StringsContains(contents, "s_context:") || + StringsContains(contents, "VxID:") { + system = "linux-vserver" + } + // TODO: guest or host + } + } + + if PathExists(filepath.Join(filename, "1", "environ")) { + contents, err := ReadFile(filepath.Join(filename, "1", "environ")) + + if err == nil { + if strings.Contains(contents, "container=lxc") { + system = "lxc" + role = "guest" + } + } + } + + if PathExists(filepath.Join(filename, "self", "cgroup")) { + contents, err := ReadLines(filepath.Join(filename, "self", "cgroup")) + if err == nil { + if StringsContains(contents, "lxc") { + system = "lxc" + role = "guest" + } else if StringsContains(contents, "docker") { + system = "docker" + role = "guest" + } else if StringsContains(contents, "machine-rkt") { + system = "rkt" + role = "guest" + } else if PathExists("/usr/bin/lxc-version") { + system = "lxc" + role = "host" + } + } + } + + if PathExists(HostEtcWithContext(ctx, "os-release")) { + p, _, err := GetOSReleaseWithContext(ctx) + if err == nil && p == "coreos" { + system = "rkt" // Is it true? + role = "host" + } + } + + if PathExists(HostRootWithContext(ctx, ".dockerenv")) { + system = "docker" + role = "guest" + } + + // before returning for the first time, cache the system and role + cachedVirtOnce.Do(func() { + cachedVirtMutex.Lock() + defer cachedVirtMutex.Unlock() + cachedVirtMap = map[string]string{ + "system": system, + "role": role, + } + }) + + return system, role, nil +} + +func GetOSRelease() (platform string, version string, err error) { + return GetOSReleaseWithContext(context.Background()) +} + +func GetOSReleaseWithContext(ctx context.Context) (platform string, version string, err error) { + contents, err := ReadLines(HostEtcWithContext(ctx, "os-release")) + if err != nil { + return "", "", nil // return empty + } + for _, line := range contents { + field := strings.Split(line, "=") + if len(field) < 2 { + continue + } + switch field[0] { + case "ID": // use ID for lowercase + platform = trimQuotes(field[1]) + case "VERSION": + version = trimQuotes(field[1]) + } + } + + // cleanup amazon ID + if platform == "amzn" { + platform = "amazon" + } + + return platform, version, nil +} + +// Remove quotes of the source string +func trimQuotes(s string) string { + if len(s) >= 2 { + if s[0] == '"' && s[len(s)-1] == '"' { + return s[1 : len(s)-1] + } + } + return s +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_netbsd.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_netbsd.go new file mode 100644 index 00000000..efbc710a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_netbsd.go @@ -0,0 +1,66 @@ +//go:build netbsd +// +build netbsd + +package common + +import ( + "os" + "os/exec" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +func DoSysctrl(mib string) ([]string, error) { + cmd := exec.Command("sysctl", "-n", mib) + cmd.Env = getSysctrlEnv(os.Environ()) + out, err := cmd.Output() + if err != nil { + return []string{}, err + } + v := strings.Replace(string(out), "{ ", "", 1) + v = strings.Replace(string(v), " }", "", 1) + values := strings.Fields(string(v)) + + return values, nil +} + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_openbsd.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_openbsd.go new file mode 100644 index 00000000..58d76f33 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_openbsd.go @@ -0,0 +1,66 @@ +//go:build openbsd +// +build openbsd + +package common + +import ( + "os" + "os/exec" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +func DoSysctrl(mib string) ([]string, error) { + cmd := exec.Command("sysctl", "-n", mib) + cmd.Env = getSysctrlEnv(os.Environ()) + out, err := cmd.Output() + if err != nil { + return []string{}, err + } + v := strings.Replace(string(out), "{ ", "", 1) + v = strings.Replace(string(v), " }", "", 1) + values := strings.Fields(string(v)) + + return values, nil +} + +func CallSyscall(mib []int32) ([]byte, uint64, error) { + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + + // get required buffer size + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + var b []byte + return b, length, err + } + if length == 0 { + var b []byte + return b, length, err + } + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_unix.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_unix.go new file mode 100644 index 00000000..4af7e5c2 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_unix.go @@ -0,0 +1,62 @@ +//go:build linux || freebsd || darwin || openbsd +// +build linux freebsd darwin openbsd + +package common + +import ( + "context" + "errors" + "os/exec" + "strconv" + "strings" +) + +func CallLsofWithContext(ctx context.Context, invoke Invoker, pid int32, args ...string) ([]string, error) { + var cmd []string + if pid == 0 { // will get from all processes. + cmd = []string{"-a", "-n", "-P"} + } else { + cmd = []string{"-a", "-n", "-P", "-p", strconv.Itoa(int(pid))} + } + cmd = append(cmd, args...) + out, err := invoke.CommandWithContext(ctx, "lsof", cmd...) + if err != nil { + if errors.Is(err, exec.ErrNotFound) { + return []string{}, err + } + // if no pid found, lsof returns code 1. + if err.Error() == "exit status 1" && len(out) == 0 { + return []string{}, nil + } + } + lines := strings.Split(string(out), "\n") + + var ret []string + for _, l := range lines[1:] { + if len(l) == 0 { + continue + } + ret = append(ret, l) + } + return ret, nil +} + +func CallPgrepWithContext(ctx context.Context, invoke Invoker, pid int32) ([]int32, error) { + out, err := invoke.CommandWithContext(ctx, "pgrep", "-P", strconv.Itoa(int(pid))) + if err != nil { + return []int32{}, err + } + lines := strings.Split(string(out), "\n") + ret := make([]int32, 0, len(lines)) + for _, l := range lines { + if len(l) == 0 { + continue + } + i, err := strconv.ParseInt(l, 10, 32) + if err != nil { + continue + } + ret = append(ret, int32(i)) + } + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_windows.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_windows.go new file mode 100644 index 00000000..301b2315 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_windows.go @@ -0,0 +1,304 @@ +//go:build windows +// +build windows + +package common + +import ( + "context" + "fmt" + "path/filepath" + "reflect" + "strings" + "syscall" + "unsafe" + + "github.com/yusufpapurcu/wmi" + "golang.org/x/sys/windows" +) + +// for double values +type PDH_FMT_COUNTERVALUE_DOUBLE struct { + CStatus uint32 + DoubleValue float64 +} + +// for 64 bit integer values +type PDH_FMT_COUNTERVALUE_LARGE struct { + CStatus uint32 + LargeValue int64 +} + +// for long values +type PDH_FMT_COUNTERVALUE_LONG struct { + CStatus uint32 + LongValue int32 + padding [4]byte +} + +// windows system const +const ( + ERROR_SUCCESS = 0 + ERROR_FILE_NOT_FOUND = 2 + DRIVE_REMOVABLE = 2 + DRIVE_FIXED = 3 + HKEY_LOCAL_MACHINE = 0x80000002 + RRF_RT_REG_SZ = 0x00000002 + RRF_RT_REG_DWORD = 0x00000010 + PDH_FMT_LONG = 0x00000100 + PDH_FMT_DOUBLE = 0x00000200 + PDH_FMT_LARGE = 0x00000400 + PDH_INVALID_DATA = 0xc0000bc6 + PDH_INVALID_HANDLE = 0xC0000bbc + PDH_NO_DATA = 0x800007d5 + + STATUS_BUFFER_OVERFLOW = 0x80000005 + STATUS_BUFFER_TOO_SMALL = 0xC0000023 + STATUS_INFO_LENGTH_MISMATCH = 0xC0000004 +) + +const ( + ProcessBasicInformation = 0 + ProcessWow64Information = 26 + ProcessQueryInformation = windows.PROCESS_DUP_HANDLE | windows.PROCESS_QUERY_INFORMATION + + SystemExtendedHandleInformationClass = 64 +) + +var ( + Modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + ModNt = windows.NewLazySystemDLL("ntdll.dll") + ModPdh = windows.NewLazySystemDLL("pdh.dll") + ModPsapi = windows.NewLazySystemDLL("psapi.dll") + + ProcGetSystemTimes = Modkernel32.NewProc("GetSystemTimes") + ProcNtQuerySystemInformation = ModNt.NewProc("NtQuerySystemInformation") + ProcRtlGetNativeSystemInformation = ModNt.NewProc("RtlGetNativeSystemInformation") + ProcRtlNtStatusToDosError = ModNt.NewProc("RtlNtStatusToDosError") + ProcNtQueryInformationProcess = ModNt.NewProc("NtQueryInformationProcess") + ProcNtReadVirtualMemory = ModNt.NewProc("NtReadVirtualMemory") + ProcNtWow64QueryInformationProcess64 = ModNt.NewProc("NtWow64QueryInformationProcess64") + ProcNtWow64ReadVirtualMemory64 = ModNt.NewProc("NtWow64ReadVirtualMemory64") + + PdhOpenQuery = ModPdh.NewProc("PdhOpenQuery") + PdhAddEnglishCounterW = ModPdh.NewProc("PdhAddEnglishCounterW") + PdhCollectQueryData = ModPdh.NewProc("PdhCollectQueryData") + PdhGetFormattedCounterValue = ModPdh.NewProc("PdhGetFormattedCounterValue") + PdhCloseQuery = ModPdh.NewProc("PdhCloseQuery") + + procQueryDosDeviceW = Modkernel32.NewProc("QueryDosDeviceW") +) + +type FILETIME struct { + DwLowDateTime uint32 + DwHighDateTime uint32 +} + +// borrowed from net/interface_windows.go +func BytePtrToString(p *uint8) string { + a := (*[10000]uint8)(unsafe.Pointer(p)) + i := 0 + for a[i] != 0 { + i++ + } + return string(a[:i]) +} + +// CounterInfo struct is used to track a windows performance counter +// copied from https://github.com/mackerelio/mackerel-agent/ +type CounterInfo struct { + PostName string + CounterName string + Counter windows.Handle +} + +// CreateQuery with a PdhOpenQuery call +// copied from https://github.com/mackerelio/mackerel-agent/ +func CreateQuery() (windows.Handle, error) { + var query windows.Handle + r, _, err := PdhOpenQuery.Call(0, 0, uintptr(unsafe.Pointer(&query))) + if r != 0 { + return 0, err + } + return query, nil +} + +// CreateCounter with a PdhAddEnglishCounterW call +func CreateCounter(query windows.Handle, pname, cname string) (*CounterInfo, error) { + var counter windows.Handle + r, _, err := PdhAddEnglishCounterW.Call( + uintptr(query), + uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(cname))), + 0, + uintptr(unsafe.Pointer(&counter))) + if r != 0 { + return nil, err + } + return &CounterInfo{ + PostName: pname, + CounterName: cname, + Counter: counter, + }, nil +} + +// GetCounterValue get counter value from handle +// adapted from https://github.com/mackerelio/mackerel-agent/ +func GetCounterValue(counter windows.Handle) (float64, error) { + var value PDH_FMT_COUNTERVALUE_DOUBLE + r, _, err := PdhGetFormattedCounterValue.Call(uintptr(counter), PDH_FMT_DOUBLE, uintptr(0), uintptr(unsafe.Pointer(&value))) + if r != 0 && r != PDH_INVALID_DATA { + return 0.0, err + } + return value.DoubleValue, nil +} + +type Win32PerformanceCounter struct { + PostName string + CounterName string + Query windows.Handle + Counter windows.Handle +} + +func NewWin32PerformanceCounter(postName, counterName string) (*Win32PerformanceCounter, error) { + query, err := CreateQuery() + if err != nil { + return nil, err + } + counter := Win32PerformanceCounter{ + Query: query, + PostName: postName, + CounterName: counterName, + } + r, _, err := PdhAddEnglishCounterW.Call( + uintptr(counter.Query), + uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(counter.CounterName))), + 0, + uintptr(unsafe.Pointer(&counter.Counter)), + ) + if r != 0 { + return nil, err + } + return &counter, nil +} + +func (w *Win32PerformanceCounter) GetValue() (float64, error) { + r, _, err := PdhCollectQueryData.Call(uintptr(w.Query)) + if r != 0 && err != nil { + if r == PDH_NO_DATA { + return 0.0, fmt.Errorf("%w: this counter has not data", err) + } + return 0.0, err + } + + return GetCounterValue(w.Counter) +} + +func ProcessorQueueLengthCounter() (*Win32PerformanceCounter, error) { + return NewWin32PerformanceCounter("processor_queue_length", `\System\Processor Queue Length`) +} + +// WMIQueryWithContext - wraps wmi.Query with a timed-out context to avoid hanging +func WMIQueryWithContext(ctx context.Context, query string, dst interface{}, connectServerArgs ...interface{}) error { + if _, ok := ctx.Deadline(); !ok { + ctxTimeout, cancel := context.WithTimeout(ctx, Timeout) + defer cancel() + ctx = ctxTimeout + } + + errChan := make(chan error, 1) + go func() { + errChan <- wmi.Query(query, dst, connectServerArgs...) + }() + + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-errChan: + return err + } +} + +// Convert paths using native DOS format like: +// +// "\Device\HarddiskVolume1\Windows\systemew\file.txt" +// +// into: +// +// "C:\Windows\systemew\file.txt" +func ConvertDOSPath(p string) string { + rawDrive := strings.Join(strings.Split(p, `\`)[:3], `\`) + + for d := 'A'; d <= 'Z'; d++ { + szDeviceName := string(d) + ":" + szTarget := make([]uint16, 512) + ret, _, _ := procQueryDosDeviceW.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(szDeviceName))), + uintptr(unsafe.Pointer(&szTarget[0])), + uintptr(len(szTarget))) + if ret != 0 && windows.UTF16ToString(szTarget[:]) == rawDrive { + return filepath.Join(szDeviceName, p[len(rawDrive):]) + } + } + return p +} + +type NtStatus uint32 + +func (s NtStatus) Error() error { + if s == 0 { + return nil + } + return fmt.Errorf("NtStatus 0x%08x", uint32(s)) +} + +func (s NtStatus) IsError() bool { + return s>>30 == 3 +} + +type SystemExtendedHandleTableEntryInformation struct { + Object uintptr + UniqueProcessId uintptr + HandleValue uintptr + GrantedAccess uint32 + CreatorBackTraceIndex uint16 + ObjectTypeIndex uint16 + HandleAttributes uint32 + Reserved uint32 +} + +type SystemExtendedHandleInformation struct { + NumberOfHandles uintptr + Reserved uintptr + Handles [1]SystemExtendedHandleTableEntryInformation +} + +// CallWithExpandingBuffer https://github.com/hillu/go-ntdll +func CallWithExpandingBuffer(fn func() NtStatus, buf *[]byte, resultLength *uint32) NtStatus { + for { + if st := fn(); st == STATUS_BUFFER_OVERFLOW || st == STATUS_BUFFER_TOO_SMALL || st == STATUS_INFO_LENGTH_MISMATCH { + if int(*resultLength) <= cap(*buf) { + (*reflect.SliceHeader)(unsafe.Pointer(buf)).Len = int(*resultLength) + } else { + *buf = make([]byte, int(*resultLength)) + } + continue + } else { + if !st.IsError() { + *buf = (*buf)[:int(*resultLength)] + } + return st + } + } +} + +func NtQuerySystemInformation( + SystemInformationClass uint32, + SystemInformation *byte, + SystemInformationLength uint32, + ReturnLength *uint32, +) NtStatus { + r0, _, _ := ProcNtQuerySystemInformation.Call( + uintptr(SystemInformationClass), + uintptr(unsafe.Pointer(SystemInformation)), + uintptr(SystemInformationLength), + uintptr(unsafe.Pointer(ReturnLength))) + return NtStatus(r0) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/endian.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/endian.go new file mode 100644 index 00000000..147cfdc4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/endian.go @@ -0,0 +1,10 @@ +package common + +import "unsafe" + +// IsLittleEndian checks if the current platform uses little-endian. +// copied from https://github.com/ntrrg/ntgo/blob/v0.8.0/runtime/infrastructure.go#L16 (MIT License) +func IsLittleEndian() bool { + var x int16 = 0x0011 + return *(*byte)(unsafe.Pointer(&x)) == 0x11 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go new file mode 100644 index 00000000..9bed2419 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go @@ -0,0 +1,21 @@ +package common + +import ( + "context" + "time" +) + +// Sleep awaits for provided interval. +// Can be interrupted by context cancelation. +func Sleep(ctx context.Context, interval time.Duration) error { + timer := time.NewTimer(interval) + select { + case <-ctx.Done(): + if !timer.Stop() { + <-timer.C + } + return ctx.Err() + case <-timer.C: + return nil + } +} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/warnings.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/warnings.go new file mode 100644 index 00000000..a4aaadaf --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/warnings.go @@ -0,0 +1,30 @@ +package common + +import "fmt" + +type Warnings struct { + List []error + Verbose bool +} + +func (w *Warnings) Add(err error) { + w.List = append(w.List, err) +} + +func (w *Warnings) Reference() error { + if len(w.List) > 0 { + return w + } + return nil +} + +func (w *Warnings) Error() string { + if w.Verbose { + str := "" + for i, e := range w.List { + str += fmt.Sprintf("\tError %d: %s\n", i, e.Error()) + } + return str + } + return fmt.Sprintf("Number of warnings: %v", len(w.List)) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem.go new file mode 100644 index 00000000..edaf268b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem.go @@ -0,0 +1,120 @@ +package mem + +import ( + "encoding/json" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +var invoke common.Invoker = common.Invoke{} + +// Memory usage statistics. Total, Available and Used contain numbers of bytes +// for human consumption. +// +// The other fields in this struct contain kernel specific values. +type VirtualMemoryStat struct { + // Total amount of RAM on this system + Total uint64 `json:"total"` + + // RAM available for programs to allocate + // + // This value is computed from the kernel specific values. + Available uint64 `json:"available"` + + // RAM used by programs + // + // This value is computed from the kernel specific values. + Used uint64 `json:"used"` + + // Percentage of RAM used by programs + // + // This value is computed from the kernel specific values. + UsedPercent float64 `json:"usedPercent"` + + // This is the kernel's notion of free memory; RAM chips whose bits nobody + // cares about the value of right now. For a human consumable number, + // Available is what you really want. + Free uint64 `json:"free"` + + // OS X / BSD specific numbers: + // http://www.macyourself.com/2010/02/17/what-is-free-wired-active-and-inactive-system-memory-ram/ + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + + // FreeBSD specific numbers: + // https://reviews.freebsd.org/D8467 + Laundry uint64 `json:"laundry"` + + // Linux specific numbers + // https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html + // https://www.kernel.org/doc/Documentation/filesystems/proc.txt + // https://www.kernel.org/doc/Documentation/vm/overcommit-accounting + // https://www.kernel.org/doc/Documentation/vm/transhuge.txt + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` + AnonHugePages uint64 `json:"anonHugePages"` +} + +type SwapMemoryStat struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + + // Linux specific numbers + // https://www.kernel.org/doc/Documentation/cgroup-v2.txt + PgMajFault uint64 `json:"pgMajFault"` +} + +func (m VirtualMemoryStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (m SwapMemoryStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +type SwapDevice struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` +} + +func (m SwapDevice) String() string { + s, _ := json.Marshal(m) + return string(s) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix.go new file mode 100644 index 00000000..22a6a4e9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix.go @@ -0,0 +1,16 @@ +//go:build aix +// +build aix + +package mem + +import ( + "context" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_cgo.go new file mode 100644 index 00000000..67e11dff --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_cgo.go @@ -0,0 +1,51 @@ +//go:build aix && cgo +// +build aix,cgo + +package mem + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + m, err := perfstat.MemoryTotalStat() + if err != nil { + return nil, err + } + pagesize := uint64(4096) + ret := VirtualMemoryStat{ + Total: uint64(m.RealTotal) * pagesize, + Available: uint64(m.RealAvailable) * pagesize, + Free: uint64(m.RealFree) * pagesize, + Used: uint64(m.RealInUse) * pagesize, + UsedPercent: 100 * float64(m.RealInUse) / float64(m.RealTotal), + Active: uint64(m.VirtualActive) * pagesize, + SwapTotal: uint64(m.PgSpTotal) * pagesize, + SwapFree: uint64(m.PgSpFree) * pagesize, + } + return &ret, nil +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + m, err := perfstat.MemoryTotalStat() + if err != nil { + return nil, err + } + pagesize := uint64(4096) + swapUsed := uint64(m.PgSpTotal-m.PgSpFree-m.PgSpRsvd) * pagesize + swapTotal := uint64(m.PgSpTotal) * pagesize + ret := SwapMemoryStat{ + Total: swapTotal, + Free: uint64(m.PgSpFree) * pagesize, + Used: swapUsed, + UsedPercent: float64(100*swapUsed) / float64(swapTotal), + Sin: uint64(m.PgSpIn), + Sout: uint64(m.PgSpOut), + PgIn: uint64(m.PageIn), + PgOut: uint64(m.PageOut), + PgFault: uint64(m.PageFaults), + } + return &ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go new file mode 100644 index 00000000..cc6a76d2 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go @@ -0,0 +1,78 @@ +//go:build aix && !cgo +// +build aix,!cgo + +package mem + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + vmem, swap, err := callSVMon(ctx) + if err != nil { + return nil, err + } + if vmem.Total == 0 { + return nil, common.ErrNotImplementedError + } + vmem.SwapTotal = swap.Total + vmem.SwapFree = swap.Free + return vmem, nil +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + _, swap, err := callSVMon(ctx) + if err != nil { + return nil, err + } + if swap.Total == 0 { + return nil, common.ErrNotImplementedError + } + return swap, nil +} + +func callSVMon(ctx context.Context) (*VirtualMemoryStat, *SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "svmon", "-G") + if err != nil { + return nil, nil, err + } + + pagesize := uint64(4096) + vmem := &VirtualMemoryStat{} + swap := &SwapMemoryStat{} + for _, line := range strings.Split(string(out), "\n") { + if strings.HasPrefix(line, "memory") { + p := strings.Fields(line) + if len(p) > 2 { + if t, err := strconv.ParseUint(p[1], 10, 64); err == nil { + vmem.Total = t * pagesize + } + if t, err := strconv.ParseUint(p[2], 10, 64); err == nil { + vmem.Used = t * pagesize + if vmem.Total > 0 { + vmem.UsedPercent = 100 * float64(vmem.Used) / float64(vmem.Total) + } + } + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + vmem.Free = t * pagesize + } + } + } else if strings.HasPrefix(line, "pg space") { + p := strings.Fields(line) + if len(p) > 3 { + if t, err := strconv.ParseUint(p[2], 10, 64); err == nil { + swap.Total = t * pagesize + } + if t, err := strconv.ParseUint(p[3], 10, 64); err == nil { + swap.Free = swap.Total - t*pagesize + } + } + break + } + } + return vmem, swap, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_bsd.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_bsd.go new file mode 100644 index 00000000..ef867d74 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_bsd.go @@ -0,0 +1,87 @@ +//go:build freebsd || openbsd || netbsd +// +build freebsd openbsd netbsd + +package mem + +import ( + "context" + "fmt" + "strconv" + "strings" +) + +const swapCommand = "swapctl" + +// swapctl column indexes +const ( + nameCol = 0 + totalKiBCol = 1 + usedKiBCol = 2 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + output, err := invoke.CommandWithContext(ctx, swapCommand, "-lk") + if err != nil { + return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) + } + + return parseSwapctlOutput(string(output)) +} + +func parseSwapctlOutput(output string) ([]*SwapDevice, error) { + lines := strings.Split(output, "\n") + if len(lines) == 0 { + return nil, fmt.Errorf("could not parse output of %q: no lines in %q", swapCommand, output) + } + + // Check header headerFields are as expected. + header := lines[0] + header = strings.ToLower(header) + header = strings.ReplaceAll(header, ":", "") + headerFields := strings.Fields(header) + if len(headerFields) < usedKiBCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header %q", swapCommand, header) + } + if headerFields[nameCol] != "device" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[nameCol], "device") + } + if headerFields[totalKiBCol] != "1kb-blocks" && headerFields[totalKiBCol] != "1k-blocks" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[totalKiBCol], "1kb-blocks") + } + if headerFields[usedKiBCol] != "used" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[usedKiBCol], "used") + } + + var swapDevices []*SwapDevice + for _, line := range lines[1:] { + if line == "" { + continue // the terminal line is typically empty + } + fields := strings.Fields(line) + if len(fields) < usedKiBCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapCommand) + } + + totalKiB, err := strconv.ParseUint(fields[totalKiBCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapCommand, err) + } + + usedKiB, err := strconv.ParseUint(fields[usedKiBCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapCommand, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: usedKiB * 1024, + FreeBytes: (totalKiB - usedKiB) * 1024, + }) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin.go new file mode 100644 index 00000000..a05a0fab --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin.go @@ -0,0 +1,72 @@ +//go:build darwin +// +build darwin + +package mem + +import ( + "context" + "fmt" + "unsafe" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func getHwMemsize() (uint64, error) { + total, err := unix.SysctlUint64("hw.memsize") + if err != nil { + return 0, err + } + return total, nil +} + +// xsw_usage in sys/sysctl.h +type swapUsage struct { + Total uint64 + Avail uint64 + Used uint64 + Pagesize int32 + Encrypted bool +} + +// SwapMemory returns swapinfo. +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + // https://github.com/yanllearnn/go-osstat/blob/ae8a279d26f52ec946a03698c7f50a26cfb427e3/memory/memory_darwin.go + var ret *SwapMemoryStat + + value, err := unix.SysctlRaw("vm.swapusage") + if err != nil { + return ret, err + } + if len(value) != 32 { + return ret, fmt.Errorf("unexpected output of sysctl vm.swapusage: %v (len: %d)", value, len(value)) + } + swap := (*swapUsage)(unsafe.Pointer(&value[0])) + + u := float64(0) + if swap.Total != 0 { + u = ((float64(swap.Total) - float64(swap.Avail)) / float64(swap.Total)) * 100.0 + } + + ret = &SwapMemoryStat{ + Total: swap.Total, + Used: swap.Used, + Free: swap.Avail, + UsedPercent: u, + } + + return ret, nil +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go new file mode 100644 index 00000000..e5da7dcd --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go @@ -0,0 +1,58 @@ +//go:build darwin && cgo +// +build darwin,cgo + +package mem + +/* +#include +#include +*/ +import "C" + +import ( + "context" + "fmt" + "unsafe" +) + +// VirtualMemory returns VirtualmemoryStat. +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + count := C.mach_msg_type_number_t(C.HOST_VM_INFO_COUNT) + var vmstat C.vm_statistics_data_t + + status := C.host_statistics(C.host_t(C.mach_host_self()), + C.HOST_VM_INFO, + C.host_info_t(unsafe.Pointer(&vmstat)), + &count) + + if status != C.KERN_SUCCESS { + return nil, fmt.Errorf("host_statistics error=%d", status) + } + + pageSize := uint64(C.vm_kernel_page_size) + total, err := getHwMemsize() + if err != nil { + return nil, err + } + totalCount := C.natural_t(total / pageSize) + + availableCount := vmstat.inactive_count + vmstat.free_count + usedPercent := 100 * float64(totalCount-availableCount) / float64(totalCount) + + usedCount := totalCount - availableCount + + return &VirtualMemoryStat{ + Total: total, + Available: pageSize * uint64(availableCount), + Used: pageSize * uint64(usedCount), + UsedPercent: usedPercent, + Free: pageSize * uint64(vmstat.free_count), + Active: pageSize * uint64(vmstat.active_count), + Inactive: pageSize * uint64(vmstat.inactive_count), + Wired: pageSize * uint64(vmstat.wire_count), + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_nocgo.go new file mode 100644 index 00000000..c9393168 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_nocgo.go @@ -0,0 +1,89 @@ +//go:build darwin && !cgo +// +build darwin,!cgo + +package mem + +import ( + "context" + "strconv" + "strings" + + "golang.org/x/sys/unix" +) + +// Runs vm_stat and returns Free and inactive pages +func getVMStat(vms *VirtualMemoryStat) error { + out, err := invoke.Command("vm_stat") + if err != nil { + return err + } + return parseVMStat(string(out), vms) +} + +func parseVMStat(out string, vms *VirtualMemoryStat) error { + var err error + + lines := strings.Split(out, "\n") + pagesize := uint64(unix.Getpagesize()) + for _, line := range lines { + fields := strings.Split(line, ":") + if len(fields) < 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.Trim(fields[1], " .") + switch key { + case "Pages free": + free, e := strconv.ParseUint(value, 10, 64) + if e != nil { + err = e + } + vms.Free = free * pagesize + case "Pages inactive": + inactive, e := strconv.ParseUint(value, 10, 64) + if e != nil { + err = e + } + vms.Inactive = inactive * pagesize + case "Pages active": + active, e := strconv.ParseUint(value, 10, 64) + if e != nil { + err = e + } + vms.Active = active * pagesize + case "Pages wired down": + wired, e := strconv.ParseUint(value, 10, 64) + if e != nil { + err = e + } + vms.Wired = wired * pagesize + } + } + return err +} + +// VirtualMemory returns VirtualmemoryStat. +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + ret := &VirtualMemoryStat{} + + total, err := getHwMemsize() + if err != nil { + return nil, err + } + err = getVMStat(ret) + if err != nil { + return nil, err + } + + ret.Available = ret.Free + ret.Inactive + ret.Total = total + + ret.Used = ret.Total - ret.Available + ret.UsedPercent = 100 * float64(ret.Used) / float64(ret.Total) + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_fallback.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_fallback.go new file mode 100644 index 00000000..697fd870 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_fallback.go @@ -0,0 +1,34 @@ +//go:build !darwin && !linux && !freebsd && !openbsd && !solaris && !windows && !plan9 && !aix && !netbsd +// +build !darwin,!linux,!freebsd,!openbsd,!solaris,!windows,!plan9,!aix,!netbsd + +package mem + +import ( + "context" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_freebsd.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_freebsd.go new file mode 100644 index 00000000..9a56785b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_freebsd.go @@ -0,0 +1,167 @@ +//go:build freebsd +// +build freebsd + +package mem + +import ( + "context" + "errors" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/unix" +) + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + pageSize, err := common.SysctlUint("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + physmem, err := common.SysctlUint("hw.physmem") + if err != nil { + return nil, err + } + + free, err := common.SysctlUint("vm.stats.vm.v_free_count") + if err != nil { + return nil, err + } + active, err := common.SysctlUint("vm.stats.vm.v_active_count") + if err != nil { + return nil, err + } + inactive, err := common.SysctlUint("vm.stats.vm.v_inactive_count") + if err != nil { + return nil, err + } + buffers, err := common.SysctlUint("vfs.bufspace") + if err != nil { + return nil, err + } + wired, err := common.SysctlUint("vm.stats.vm.v_wire_count") + if err != nil { + return nil, err + } + var cached, laundry uint64 + osreldate, _ := common.SysctlUint("kern.osreldate") + if osreldate < 1102000 { + cached, err = common.SysctlUint("vm.stats.vm.v_cache_count") + if err != nil { + return nil, err + } + } else { + laundry, err = common.SysctlUint("vm.stats.vm.v_laundry_count") + if err != nil { + return nil, err + } + } + + p := pageSize + ret := &VirtualMemoryStat{ + Total: physmem, + Free: free * p, + Active: active * p, + Inactive: inactive * p, + Cached: cached * p, + Buffers: buffers, + Wired: wired * p, + Laundry: laundry * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Laundry + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + return ret, nil +} + +// Return swapinfo +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +// Constants from vm/vm_param.h +// nolint: golint +const ( + XSWDEV_VERSION11 = 1 + XSWDEV_VERSION = 2 +) + +// Types from vm/vm_param.h +type xswdev struct { + Version uint32 // Version is the version + Dev uint64 // Dev is the device identifier + Flags int32 // Flags is the swap flags applied to the device + NBlks int32 // NBlks is the total number of blocks + Used int32 // Used is the number of blocks used +} + +// xswdev11 is a compatibility for under FreeBSD 11 +// sys/vm/swap_pager.c +type xswdev11 struct { + Version uint32 // Version is the version + Dev uint32 // Dev is the device identifier + Flags int32 // Flags is the swap flags applied to the device + NBlks int32 // NBlks is the total number of blocks + Used int32 // Used is the number of blocks used +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + // FreeBSD can have multiple swap devices so we total them up + i, err := common.SysctlUint("vm.nswapdev") + if err != nil { + return nil, err + } + + if i == 0 { + return nil, errors.New("no swap devices found") + } + + c := int(i) + + i, err = common.SysctlUint("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + pageSize := i + + var buf []byte + s := &SwapMemoryStat{} + for n := 0; n < c; n++ { + buf, err = unix.SysctlRaw("vm.swap_info", n) + if err != nil { + return nil, err + } + + // first, try to parse with version 2 + xsw := (*xswdev)(unsafe.Pointer(&buf[0])) + if xsw.Version == XSWDEV_VERSION11 { + // this is version 1, so try to parse again + xsw := (*xswdev11)(unsafe.Pointer(&buf[0])) + if xsw.Version != XSWDEV_VERSION11 { + return nil, errors.New("xswdev version mismatch(11)") + } + s.Total += uint64(xsw.NBlks) + s.Used += uint64(xsw.Used) + } else if xsw.Version != XSWDEV_VERSION { + return nil, errors.New("xswdev version mismatch") + } else { + s.Total += uint64(xsw.NBlks) + s.Used += uint64(xsw.Used) + } + + } + + if s.Total != 0 { + s.UsedPercent = float64(s.Used) / float64(s.Total) * 100 + } + s.Total *= pageSize + s.Used *= pageSize + s.Free = s.Total - s.Used + + return s, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_linux.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_linux.go new file mode 100644 index 00000000..214a91e4 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_linux.go @@ -0,0 +1,532 @@ +//go:build linux +// +build linux + +package mem + +import ( + "bufio" + "context" + "encoding/json" + "fmt" + "io" + "math" + "os" + "strconv" + "strings" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +type VirtualMemoryExStat struct { + ActiveFile uint64 `json:"activefile"` + InactiveFile uint64 `json:"inactivefile"` + ActiveAnon uint64 `json:"activeanon"` + InactiveAnon uint64 `json:"inactiveanon"` + Unevictable uint64 `json:"unevictable"` +} + +func (v VirtualMemoryExStat) String() string { + s, _ := json.Marshal(v) + return string(s) +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + vm, _, err := fillFromMeminfoWithContext(ctx) + if err != nil { + return nil, err + } + return vm, nil +} + +func VirtualMemoryEx() (*VirtualMemoryExStat, error) { + return VirtualMemoryExWithContext(context.Background()) +} + +func VirtualMemoryExWithContext(ctx context.Context) (*VirtualMemoryExStat, error) { + _, vmEx, err := fillFromMeminfoWithContext(ctx) + if err != nil { + return nil, err + } + return vmEx, nil +} + +func fillFromMeminfoWithContext(ctx context.Context) (*VirtualMemoryStat, *VirtualMemoryExStat, error) { + filename := common.HostProcWithContext(ctx, "meminfo") + lines, _ := common.ReadLines(filename) + + // flag if MemAvailable is in /proc/meminfo (kernel 3.14+) + memavail := false + activeFile := false // "Active(file)" not available: 2.6.28 / Dec 2008 + inactiveFile := false // "Inactive(file)" not available: 2.6.28 / Dec 2008 + sReclaimable := false // "Sreclaimable:" not available: 2.6.19 / Nov 2006 + + ret := &VirtualMemoryStat{} + retEx := &VirtualMemoryExStat{} + + for _, line := range lines { + fields := strings.Split(line, ":") + if len(fields) != 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.TrimSpace(fields[1]) + value = strings.Replace(value, " kB", "", -1) + + switch key { + case "MemTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Total = t * 1024 + case "MemFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Free = t * 1024 + case "MemAvailable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + memavail = true + ret.Available = t * 1024 + case "Buffers": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Buffers = t * 1024 + case "Cached": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Cached = t * 1024 + case "Active": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Active = t * 1024 + case "Inactive": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Inactive = t * 1024 + case "Active(anon)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.ActiveAnon = t * 1024 + case "Inactive(anon)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.InactiveAnon = t * 1024 + case "Active(file)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + activeFile = true + retEx.ActiveFile = t * 1024 + case "Inactive(file)": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + inactiveFile = true + retEx.InactiveFile = t * 1024 + case "Unevictable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + retEx.Unevictable = t * 1024 + case "Writeback": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.WriteBack = t * 1024 + case "WritebackTmp": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.WriteBackTmp = t * 1024 + case "Dirty": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Dirty = t * 1024 + case "Shmem": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Shared = t * 1024 + case "Slab": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Slab = t * 1024 + case "SReclaimable": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + sReclaimable = true + ret.Sreclaimable = t * 1024 + case "SUnreclaim": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Sunreclaim = t * 1024 + case "PageTables": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.PageTables = t * 1024 + case "SwapCached": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapCached = t * 1024 + case "CommitLimit": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.CommitLimit = t * 1024 + case "Committed_AS": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.CommittedAS = t * 1024 + case "HighTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HighTotal = t * 1024 + case "HighFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HighFree = t * 1024 + case "LowTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.LowTotal = t * 1024 + case "LowFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.LowFree = t * 1024 + case "SwapTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapTotal = t * 1024 + case "SwapFree": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.SwapFree = t * 1024 + case "Mapped": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.Mapped = t * 1024 + case "VmallocTotal": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocTotal = t * 1024 + case "VmallocUsed": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocUsed = t * 1024 + case "VmallocChunk": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.VmallocChunk = t * 1024 + case "HugePages_Total": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesTotal = t + case "HugePages_Free": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesFree = t + case "HugePages_Rsvd": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesRsvd = t + case "HugePages_Surp": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePagesSurp = t + case "Hugepagesize": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.HugePageSize = t * 1024 + case "AnonHugePages": + t, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return ret, retEx, err + } + ret.AnonHugePages = t * 1024 + } + } + + ret.Cached += ret.Sreclaimable + + if !memavail { + if activeFile && inactiveFile && sReclaimable { + ret.Available = calculateAvailVmem(ctx, ret, retEx) + } else { + ret.Available = ret.Cached + ret.Free + } + } + + ret.Used = ret.Total - ret.Free - ret.Buffers - ret.Cached + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + return ret, retEx, nil +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + sysinfo := &unix.Sysinfo_t{} + + if err := unix.Sysinfo(sysinfo); err != nil { + return nil, err + } + ret := &SwapMemoryStat{ + Total: uint64(sysinfo.Totalswap) * uint64(sysinfo.Unit), + Free: uint64(sysinfo.Freeswap) * uint64(sysinfo.Unit), + } + ret.Used = ret.Total - ret.Free + // check Infinity + if ret.Total != 0 { + ret.UsedPercent = float64(ret.Total-ret.Free) / float64(ret.Total) * 100.0 + } else { + ret.UsedPercent = 0 + } + filename := common.HostProcWithContext(ctx, "vmstat") + lines, _ := common.ReadLines(filename) + for _, l := range lines { + fields := strings.Fields(l) + if len(fields) < 2 { + continue + } + switch fields[0] { + case "pswpin": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.Sin = value * 4 * 1024 + case "pswpout": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.Sout = value * 4 * 1024 + case "pgpgin": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgIn = value * 4 * 1024 + case "pgpgout": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgOut = value * 4 * 1024 + case "pgfault": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgFault = value * 4 * 1024 + case "pgmajfault": + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + continue + } + ret.PgMajFault = value * 4 * 1024 + } + } + return ret, nil +} + +// calculateAvailVmem is a fallback under kernel 3.14 where /proc/meminfo does not provide +// "MemAvailable:" column. It reimplements an algorithm from the link below +// https://github.com/giampaolo/psutil/pull/890 +func calculateAvailVmem(ctx context.Context, ret *VirtualMemoryStat, retEx *VirtualMemoryExStat) uint64 { + var watermarkLow uint64 + + fn := common.HostProcWithContext(ctx, "zoneinfo") + lines, err := common.ReadLines(fn) + if err != nil { + return ret.Free + ret.Cached // fallback under kernel 2.6.13 + } + + pagesize := uint64(os.Getpagesize()) + watermarkLow = 0 + + for _, line := range lines { + fields := strings.Fields(line) + + if strings.HasPrefix(fields[0], "low") { + lowValue, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + lowValue = 0 + } + watermarkLow += lowValue + } + } + + watermarkLow *= pagesize + + availMemory := ret.Free - watermarkLow + pageCache := retEx.ActiveFile + retEx.InactiveFile + pageCache -= uint64(math.Min(float64(pageCache/2), float64(watermarkLow))) + availMemory += pageCache + availMemory += ret.Sreclaimable - uint64(math.Min(float64(ret.Sreclaimable/2.0), float64(watermarkLow))) + + if availMemory < 0 { + availMemory = 0 + } + + return availMemory +} + +const swapsFilename = "swaps" + +// swaps file column indexes +const ( + nameCol = 0 + // typeCol = 1 + totalCol = 2 + usedCol = 3 + // priorityCol = 4 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + swapsFilePath := common.HostProcWithContext(ctx, swapsFilename) + f, err := os.Open(swapsFilePath) + if err != nil { + return nil, err + } + defer f.Close() + + return parseSwapsFile(ctx, f) +} + +func parseSwapsFile(ctx context.Context, r io.Reader) ([]*SwapDevice, error) { + swapsFilePath := common.HostProcWithContext(ctx, swapsFilename) + scanner := bufio.NewScanner(r) + if !scanner.Scan() { + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("couldn't read file %q: %w", swapsFilePath, err) + } + return nil, fmt.Errorf("unexpected end-of-file in %q", swapsFilePath) + + } + + // Check header headerFields are as expected + headerFields := strings.Fields(scanner.Text()) + if len(headerFields) < usedCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header", swapsFilePath) + } + if headerFields[nameCol] != "Filename" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[nameCol], "Filename") + } + if headerFields[totalCol] != "Size" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[totalCol], "Size") + } + if headerFields[usedCol] != "Used" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapsFilePath, headerFields[usedCol], "Used") + } + + var swapDevices []*SwapDevice + for scanner.Scan() { + fields := strings.Fields(scanner.Text()) + if len(fields) < usedCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapsFilePath) + } + + totalKiB, err := strconv.ParseUint(fields[totalCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapsFilePath, err) + } + + usedKiB, err := strconv.ParseUint(fields[usedCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapsFilePath, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: usedKiB * 1024, + FreeBytes: (totalKiB - usedKiB) * 1024, + }) + } + + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("couldn't read file %q: %w", swapsFilePath, err) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_netbsd.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_netbsd.go new file mode 100644 index 00000000..d1f54eca --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_netbsd.go @@ -0,0 +1,87 @@ +//go:build netbsd +// +build netbsd + +package mem + +import ( + "context" + "errors" + "fmt" + + "golang.org/x/sys/unix" +) + +func GetPageSize() (uint64, error) { + return GetPageSizeWithContext(context.Background()) +} + +func GetPageSizeWithContext(ctx context.Context) (uint64, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") + if err != nil { + return 0, err + } + return uint64(uvmexp.Pagesize), nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") + if err != nil { + return nil, err + } + p := uint64(uvmexp.Pagesize) + + ret := &VirtualMemoryStat{ + Total: uint64(uvmexp.Npages) * p, + Free: uint64(uvmexp.Free) * p, + Active: uint64(uvmexp.Active) * p, + Inactive: uint64(uvmexp.Inactive) * p, + Cached: 0, // not available + Wired: uint64(uvmexp.Wired) * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + // Get buffers from vm.bufmem sysctl + ret.Buffers, err = unix.SysctlUint64("vm.bufmem") + if err != nil { + return nil, err + } + + return ret, nil +} + +// Return swapctl summary info +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "swapctl", "-sk") + if err != nil { + return &SwapMemoryStat{}, nil + } + + line := string(out) + var total, used, free uint64 + + _, err = fmt.Sscanf(line, + "total: %d 1K-blocks allocated, %d used, %d available", + &total, &used, &free) + if err != nil { + return nil, errors.New("failed to parse swapctl output") + } + + percent := float64(used) / float64(total) * 100 + return &SwapMemoryStat{ + Total: total * 1024, + Used: used * 1024, + Free: free * 1024, + UsedPercent: percent, + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd.go new file mode 100644 index 00000000..e37d5abe --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd.go @@ -0,0 +1,100 @@ +//go:build openbsd +// +build openbsd + +package mem + +import ( + "bytes" + "context" + "encoding/binary" + "errors" + "fmt" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/unix" +) + +func GetPageSize() (uint64, error) { + return GetPageSizeWithContext(context.Background()) +} + +func GetPageSizeWithContext(ctx context.Context) (uint64, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") + if err != nil { + return 0, err + } + return uint64(uvmexp.Pagesize), nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") + if err != nil { + return nil, err + } + p := uint64(uvmexp.Pagesize) + + ret := &VirtualMemoryStat{ + Total: uint64(uvmexp.Npages) * p, + Free: uint64(uvmexp.Free) * p, + Active: uint64(uvmexp.Active) * p, + Inactive: uint64(uvmexp.Inactive) * p, + Cached: 0, // not available + Wired: uint64(uvmexp.Wired) * p, + } + + ret.Available = ret.Inactive + ret.Cached + ret.Free + ret.Used = ret.Total - ret.Available + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 + + mib := []int32{CTLVfs, VfsGeneric, VfsBcacheStat} + buf, length, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if length < sizeOfBcachestats { + return nil, fmt.Errorf("short syscall ret %d bytes", length) + } + var bcs Bcachestats + br := bytes.NewReader(buf) + err = common.Read(br, binary.LittleEndian, &bcs) + if err != nil { + return nil, err + } + ret.Buffers = uint64(bcs.Numbufpages) * p + + return ret, nil +} + +// Return swapctl summary info +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + out, err := invoke.CommandWithContext(ctx, "swapctl", "-sk") + if err != nil { + return &SwapMemoryStat{}, nil + } + + line := string(out) + var total, used, free uint64 + + _, err = fmt.Sscanf(line, + "total: %d 1K-blocks allocated, %d used, %d available", + &total, &used, &free) + if err != nil { + return nil, errors.New("failed to parse swapctl output") + } + + percent := float64(used) / float64(total) * 100 + return &SwapMemoryStat{ + Total: total * 1024, + Used: used * 1024, + Free: free * 1024, + UsedPercent: percent, + }, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_386.go new file mode 100644 index 00000000..de2b26ca --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_386.go @@ -0,0 +1,38 @@ +//go:build openbsd && 386 +// +build openbsd,386 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_amd64.go new file mode 100644 index 00000000..d187abf0 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_amd64.go @@ -0,0 +1,32 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x78 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm.go new file mode 100644 index 00000000..2488f185 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm.go @@ -0,0 +1,38 @@ +//go:build openbsd && arm +// +build openbsd,arm + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm64.go new file mode 100644 index 00000000..3661b16f --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_openbsd_arm64.go @@ -0,0 +1,38 @@ +//go:build openbsd && arm64 +// +build openbsd,arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs mem/types_openbsd.go + +package mem + +const ( + CTLVfs = 10 + VfsGeneric = 0 + VfsBcacheStat = 3 +) + +const ( + sizeOfBcachestats = 0x90 +) + +type Bcachestats struct { + Numbufs int64 + Numbufpages int64 + Numdirtypages int64 + Numcleanpages int64 + Pendingwrites int64 + Pendingreads int64 + Numwrites int64 + Numreads int64 + Cachehits int64 + Busymapped int64 + Dmapages int64 + Highpages int64 + Delwribufs int64 + Kvaslots int64 + Avail int64 + Highflips int64 + Highflops int64 + Dmaflips int64 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_plan9.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_plan9.go new file mode 100644 index 00000000..b5259f84 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_plan9.go @@ -0,0 +1,68 @@ +//go:build plan9 +// +build plan9 + +package mem + +import ( + "context" + "os" + + stats "github.com/lufia/plan9stats" + "github.com/shirou/gopsutil/v3/internal/common" +) + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + root := os.Getenv("HOST_ROOT") + m, err := stats.ReadMemStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + u := 0.0 + if m.SwapPages.Avail != 0 { + u = float64(m.SwapPages.Used) / float64(m.SwapPages.Avail) * 100.0 + } + return &SwapMemoryStat{ + Total: uint64(m.SwapPages.Avail * m.PageSize), + Used: uint64(m.SwapPages.Used * m.PageSize), + Free: uint64(m.SwapPages.Free() * m.PageSize), + UsedPercent: u, + }, nil +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + root := os.Getenv("HOST_ROOT") + m, err := stats.ReadMemStats(ctx, stats.WithRootDir(root)) + if err != nil { + return nil, err + } + u := 0.0 + if m.UserPages.Avail != 0 { + u = float64(m.UserPages.Used) / float64(m.UserPages.Avail) * 100.0 + } + return &VirtualMemoryStat{ + Total: uint64(m.Total), + Available: uint64(m.UserPages.Free() * m.PageSize), + Used: uint64(m.UserPages.Used * m.PageSize), + UsedPercent: u, + Free: uint64(m.UserPages.Free() * m.PageSize), + + SwapTotal: uint64(m.SwapPages.Avail * m.PageSize), + SwapFree: uint64(m.SwapPages.Free() * m.PageSize), + }, nil +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_solaris.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_solaris.go new file mode 100644 index 00000000..c911267e --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_solaris.go @@ -0,0 +1,213 @@ +//go:build solaris +// +build solaris + +package mem + +import ( + "context" + "errors" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/tklauser/go-sysconf" +) + +// VirtualMemory for Solaris is a minimal implementation which only returns +// what Nomad needs. It does take into account global vs zone, however. +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + result := &VirtualMemoryStat{} + + zoneName, err := zoneName() + if err != nil { + return nil, err + } + + if zoneName == "global" { + cap, err := globalZoneMemoryCapacity() + if err != nil { + return nil, err + } + result.Total = cap + freemem, err := globalZoneFreeMemory(ctx) + if err != nil { + return nil, err + } + result.Available = freemem + result.Free = freemem + result.Used = result.Total - result.Free + } else { + cap, err := nonGlobalZoneMemoryCapacity() + if err != nil { + return nil, err + } + result.Total = cap + } + + return result, nil +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + return nil, common.ErrNotImplementedError +} + +func zoneName() (string, error) { + ctx := context.Background() + out, err := invoke.CommandWithContext(ctx, "zonename") + if err != nil { + return "", err + } + + return strings.TrimSpace(string(out)), nil +} + +var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`) + +func globalZoneMemoryCapacity() (uint64, error) { + ctx := context.Background() + out, err := invoke.CommandWithContext(ctx, "prtconf") + if err != nil { + return 0, err + } + + match := globalZoneMemoryCapacityMatch.FindAllStringSubmatch(string(out), -1) + if len(match) != 1 { + return 0, errors.New("memory size not contained in output of prtconf") + } + + totalMB, err := strconv.ParseUint(match[0][1], 10, 64) + if err != nil { + return 0, err + } + + return totalMB * 1024 * 1024, nil +} + +func globalZoneFreeMemory(ctx context.Context) (uint64, error) { + output, err := invoke.CommandWithContext(ctx, "pagesize") + if err != nil { + return 0, err + } + + pagesize, err := strconv.ParseUint(strings.TrimSpace(string(output)), 10, 64) + if err != nil { + return 0, err + } + + free, err := sysconf.Sysconf(sysconf.SC_AVPHYS_PAGES) + if err != nil { + return 0, err + } + + return uint64(free) * pagesize, nil +} + +var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`) + +func nonGlobalZoneMemoryCapacity() (uint64, error) { + ctx := context.Background() + out, err := invoke.CommandWithContext(ctx, "kstat", "-p", "-c", "zone_memory_cap", "memory_cap:*:*:physcap") + if err != nil { + return 0, err + } + + kstats := kstatMatch.FindAllStringSubmatch(string(out), -1) + if len(kstats) != 1 { + return 0, fmt.Errorf("expected 1 kstat, found %d", len(kstats)) + } + + memSizeBytes, err := strconv.ParseUint(kstats[0][2], 10, 64) + if err != nil { + return 0, err + } + + return memSizeBytes, nil +} + +const swapCommand = "swap" + +// The blockSize as reported by `swap -l`. See https://docs.oracle.com/cd/E23824_01/html/821-1459/fsswap-52195.html +const blockSize = 512 + +// swapctl column indexes +const ( + nameCol = 0 + // devCol = 1 + // swaploCol = 2 + totalBlocksCol = 3 + freeBlocksCol = 4 +) + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + output, err := invoke.CommandWithContext(ctx, swapCommand, "-l") + if err != nil { + return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) + } + + return parseSwapsCommandOutput(string(output)) +} + +func parseSwapsCommandOutput(output string) ([]*SwapDevice, error) { + lines := strings.Split(output, "\n") + if len(lines) == 0 { + return nil, fmt.Errorf("could not parse output of %q: no lines in %q", swapCommand, output) + } + + // Check header headerFields are as expected. + headerFields := strings.Fields(lines[0]) + if len(headerFields) < freeBlocksCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields in header %q", swapCommand, lines[0]) + } + if headerFields[nameCol] != "swapfile" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[nameCol], "swapfile") + } + if headerFields[totalBlocksCol] != "blocks" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[totalBlocksCol], "blocks") + } + if headerFields[freeBlocksCol] != "free" { + return nil, fmt.Errorf("couldn't parse %q: expected %q to be %q", swapCommand, headerFields[freeBlocksCol], "free") + } + + var swapDevices []*SwapDevice + for _, line := range lines[1:] { + if line == "" { + continue // the terminal line is typically empty + } + fields := strings.Fields(line) + if len(fields) < freeBlocksCol { + return nil, fmt.Errorf("couldn't parse %q: too few fields", swapCommand) + } + + totalBlocks, err := strconv.ParseUint(fields[totalBlocksCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Size' column in %q: %w", swapCommand, err) + } + + freeBlocks, err := strconv.ParseUint(fields[freeBlocksCol], 10, 64) + if err != nil { + return nil, fmt.Errorf("couldn't parse 'Used' column in %q: %w", swapCommand, err) + } + + swapDevices = append(swapDevices, &SwapDevice{ + Name: fields[nameCol], + UsedBytes: (totalBlocks - freeBlocks) * blockSize, + FreeBytes: freeBlocks * blockSize, + }) + } + + return swapDevices, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/mem/mem_windows.go b/vendor/github.com/shirou/gopsutil/v3/mem/mem_windows.go new file mode 100644 index 00000000..8c7fb1a1 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/mem/mem_windows.go @@ -0,0 +1,166 @@ +//go:build windows +// +build windows + +package mem + +import ( + "context" + "sync" + "syscall" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/windows" +) + +var ( + procEnumPageFilesW = common.ModPsapi.NewProc("EnumPageFilesW") + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") + procGetPerformanceInfo = common.ModPsapi.NewProc("GetPerformanceInfo") + procGlobalMemoryStatusEx = common.Modkernel32.NewProc("GlobalMemoryStatusEx") +) + +type memoryStatusEx struct { + cbSize uint32 + dwMemoryLoad uint32 + ullTotalPhys uint64 // in bytes + ullAvailPhys uint64 + ullTotalPageFile uint64 + ullAvailPageFile uint64 + ullTotalVirtual uint64 + ullAvailVirtual uint64 + ullAvailExtendedVirtual uint64 +} + +func VirtualMemory() (*VirtualMemoryStat, error) { + return VirtualMemoryWithContext(context.Background()) +} + +func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { + var memInfo memoryStatusEx + memInfo.cbSize = uint32(unsafe.Sizeof(memInfo)) + mem, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo))) + if mem == 0 { + return nil, windows.GetLastError() + } + + ret := &VirtualMemoryStat{ + Total: memInfo.ullTotalPhys, + Available: memInfo.ullAvailPhys, + Free: memInfo.ullAvailPhys, + UsedPercent: float64(memInfo.dwMemoryLoad), + } + + ret.Used = ret.Total - ret.Available + return ret, nil +} + +type performanceInformation struct { + cb uint32 + commitTotal uint64 + commitLimit uint64 + commitPeak uint64 + physicalTotal uint64 + physicalAvailable uint64 + systemCache uint64 + kernelTotal uint64 + kernelPaged uint64 + kernelNonpaged uint64 + pageSize uint64 + handleCount uint32 + processCount uint32 + threadCount uint32 +} + +func SwapMemory() (*SwapMemoryStat, error) { + return SwapMemoryWithContext(context.Background()) +} + +func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { + var perfInfo performanceInformation + perfInfo.cb = uint32(unsafe.Sizeof(perfInfo)) + mem, _, _ := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&perfInfo)), uintptr(perfInfo.cb)) + if mem == 0 { + return nil, windows.GetLastError() + } + tot := perfInfo.commitLimit * perfInfo.pageSize + used := perfInfo.commitTotal * perfInfo.pageSize + free := tot - used + var usedPercent float64 + if tot == 0 { + usedPercent = 0 + } else { + usedPercent = float64(used) / float64(tot) * 100 + } + ret := &SwapMemoryStat{ + Total: tot, + Used: used, + Free: free, + UsedPercent: usedPercent, + } + + return ret, nil +} + +var ( + pageSize uint64 + pageSizeOnce sync.Once +) + +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwPageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +// system type as defined in https://docs.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-enum_page_file_information +type enumPageFileInformation struct { + cb uint32 + reserved uint32 + totalSize uint64 + totalInUse uint64 + peakUsage uint64 +} + +func SwapDevices() ([]*SwapDevice, error) { + return SwapDevicesWithContext(context.Background()) +} + +func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { + pageSizeOnce.Do(func() { + var sysInfo systemInfo + procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) + pageSize = uint64(sysInfo.dwPageSize) + }) + + // the following system call invokes the supplied callback function once for each page file before returning + // see https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumpagefilesw + var swapDevices []*SwapDevice + result, _, _ := procEnumPageFilesW.Call(windows.NewCallback(pEnumPageFileCallbackW), uintptr(unsafe.Pointer(&swapDevices))) + if result == 0 { + return nil, windows.GetLastError() + } + + return swapDevices, nil +} + +// system callback as defined in https://docs.microsoft.com/en-us/windows/win32/api/psapi/nc-psapi-penum_page_file_callbackw +func pEnumPageFileCallbackW(swapDevices *[]*SwapDevice, enumPageFileInfo *enumPageFileInformation, lpFilenamePtr *[syscall.MAX_LONG_PATH]uint16) *bool { + *swapDevices = append(*swapDevices, &SwapDevice{ + Name: syscall.UTF16ToString((*lpFilenamePtr)[:]), + UsedBytes: enumPageFileInfo.totalInUse * pageSize, + FreeBytes: (enumPageFileInfo.totalSize - enumPageFileInfo.totalInUse) * pageSize, + }) + + // return true to continue enumerating page files + ret := true + return &ret +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net.go b/vendor/github.com/shirou/gopsutil/v3/net/net.go new file mode 100644 index 00000000..0f3a62f3 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net.go @@ -0,0 +1,273 @@ +package net + +import ( + "context" + "encoding/json" + "net" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +var invoke common.Invoker = common.Invoke{} + +type IOCountersStat struct { + Name string `json:"name"` // interface name + BytesSent uint64 `json:"bytesSent"` // number of bytes sent + BytesRecv uint64 `json:"bytesRecv"` // number of bytes received + PacketsSent uint64 `json:"packetsSent"` // number of packets sent + PacketsRecv uint64 `json:"packetsRecv"` // number of packets received + Errin uint64 `json:"errin"` // total number of errors while receiving + Errout uint64 `json:"errout"` // total number of errors while sending + Dropin uint64 `json:"dropin"` // total number of incoming packets which were dropped + Dropout uint64 `json:"dropout"` // total number of outgoing packets which were dropped (always 0 on OSX and BSD) + Fifoin uint64 `json:"fifoin"` // total number of FIFO buffers errors while receiving + Fifoout uint64 `json:"fifoout"` // total number of FIFO buffers errors while sending +} + +// Addr is implemented compatibility to psutil +type Addr struct { + IP string `json:"ip"` + Port uint32 `json:"port"` +} + +type ConnectionStat struct { + Fd uint32 `json:"fd"` + Family uint32 `json:"family"` + Type uint32 `json:"type"` + Laddr Addr `json:"localaddr"` + Raddr Addr `json:"remoteaddr"` + Status string `json:"status"` + Uids []int32 `json:"uids"` + Pid int32 `json:"pid"` +} + +// System wide stats about different network protocols +type ProtoCountersStat struct { + Protocol string `json:"protocol"` + Stats map[string]int64 `json:"stats"` +} + +// NetInterfaceAddr is designed for represent interface addresses +type InterfaceAddr struct { + Addr string `json:"addr"` +} + +// InterfaceAddrList is a list of InterfaceAddr +type InterfaceAddrList []InterfaceAddr + +type InterfaceStat struct { + Index int `json:"index"` + MTU int `json:"mtu"` // maximum transmission unit + Name string `json:"name"` // e.g., "en0", "lo0", "eth0.100" + HardwareAddr string `json:"hardwareAddr"` // IEEE MAC-48, EUI-48 and EUI-64 form + Flags []string `json:"flags"` // e.g., FlagUp, FlagLoopback, FlagMulticast + Addrs InterfaceAddrList `json:"addrs"` +} + +// InterfaceStatList is a list of InterfaceStat +type InterfaceStatList []InterfaceStat + +type FilterStat struct { + ConnTrackCount int64 `json:"connTrackCount"` + ConnTrackMax int64 `json:"connTrackMax"` +} + +// ConntrackStat has conntrack summary info +type ConntrackStat struct { + Entries uint32 `json:"entries"` // Number of entries in the conntrack table + Searched uint32 `json:"searched"` // Number of conntrack table lookups performed + Found uint32 `json:"found"` // Number of searched entries which were successful + New uint32 `json:"new"` // Number of entries added which were not expected before + Invalid uint32 `json:"invalid"` // Number of packets seen which can not be tracked + Ignore uint32 `json:"ignore"` // Packets seen which are already connected to an entry + Delete uint32 `json:"delete"` // Number of entries which were removed + DeleteList uint32 `json:"deleteList"` // Number of entries which were put to dying list + Insert uint32 `json:"insert"` // Number of entries inserted into the list + InsertFailed uint32 `json:"insertFailed"` // # insertion attempted but failed (same entry exists) + Drop uint32 `json:"drop"` // Number of packets dropped due to conntrack failure. + EarlyDrop uint32 `json:"earlyDrop"` // Dropped entries to make room for new ones, if maxsize reached + IcmpError uint32 `json:"icmpError"` // Subset of invalid. Packets that can't be tracked d/t error + ExpectNew uint32 `json:"expectNew"` // Entries added after an expectation was already present + ExpectCreate uint32 `json:"expectCreate"` // Expectations added + ExpectDelete uint32 `json:"expectDelete"` // Expectations deleted + SearchRestart uint32 `json:"searchRestart"` // Conntrack table lookups restarted due to hashtable resizes +} + +func NewConntrackStat(e uint32, s uint32, f uint32, n uint32, inv uint32, ign uint32, del uint32, dlst uint32, ins uint32, insfail uint32, drop uint32, edrop uint32, ie uint32, en uint32, ec uint32, ed uint32, sr uint32) *ConntrackStat { + return &ConntrackStat{ + Entries: e, + Searched: s, + Found: f, + New: n, + Invalid: inv, + Ignore: ign, + Delete: del, + DeleteList: dlst, + Insert: ins, + InsertFailed: insfail, + Drop: drop, + EarlyDrop: edrop, + IcmpError: ie, + ExpectNew: en, + ExpectCreate: ec, + ExpectDelete: ed, + SearchRestart: sr, + } +} + +type ConntrackStatList struct { + items []*ConntrackStat +} + +func NewConntrackStatList() *ConntrackStatList { + return &ConntrackStatList{ + items: []*ConntrackStat{}, + } +} + +func (l *ConntrackStatList) Append(c *ConntrackStat) { + l.items = append(l.items, c) +} + +func (l *ConntrackStatList) Items() []ConntrackStat { + items := make([]ConntrackStat, len(l.items)) + for i, el := range l.items { + items[i] = *el + } + return items +} + +// Summary returns a single-element list with totals from all list items. +func (l *ConntrackStatList) Summary() []ConntrackStat { + summary := NewConntrackStat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + for _, cs := range l.items { + summary.Entries += cs.Entries + summary.Searched += cs.Searched + summary.Found += cs.Found + summary.New += cs.New + summary.Invalid += cs.Invalid + summary.Ignore += cs.Ignore + summary.Delete += cs.Delete + summary.DeleteList += cs.DeleteList + summary.Insert += cs.Insert + summary.InsertFailed += cs.InsertFailed + summary.Drop += cs.Drop + summary.EarlyDrop += cs.EarlyDrop + summary.IcmpError += cs.IcmpError + summary.ExpectNew += cs.ExpectNew + summary.ExpectCreate += cs.ExpectCreate + summary.ExpectDelete += cs.ExpectDelete + summary.SearchRestart += cs.SearchRestart + } + return []ConntrackStat{*summary} +} + +func (n IOCountersStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ConnectionStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ProtoCountersStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (a Addr) String() string { + s, _ := json.Marshal(a) + return string(s) +} + +func (n InterfaceStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (l InterfaceStatList) String() string { + s, _ := json.Marshal(l) + return string(s) +} + +func (n InterfaceAddr) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func (n ConntrackStat) String() string { + s, _ := json.Marshal(n) + return string(s) +} + +func Interfaces() (InterfaceStatList, error) { + return InterfacesWithContext(context.Background()) +} + +func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error) { + is, err := net.Interfaces() + if err != nil { + return nil, err + } + ret := make(InterfaceStatList, 0, len(is)) + for _, ifi := range is { + + var flags []string + if ifi.Flags&net.FlagUp != 0 { + flags = append(flags, "up") + } + if ifi.Flags&net.FlagBroadcast != 0 { + flags = append(flags, "broadcast") + } + if ifi.Flags&net.FlagLoopback != 0 { + flags = append(flags, "loopback") + } + if ifi.Flags&net.FlagPointToPoint != 0 { + flags = append(flags, "pointtopoint") + } + if ifi.Flags&net.FlagMulticast != 0 { + flags = append(flags, "multicast") + } + + r := InterfaceStat{ + Index: ifi.Index, + Name: ifi.Name, + MTU: ifi.MTU, + HardwareAddr: ifi.HardwareAddr.String(), + Flags: flags, + } + addrs, err := ifi.Addrs() + if err == nil { + r.Addrs = make(InterfaceAddrList, 0, len(addrs)) + for _, addr := range addrs { + r.Addrs = append(r.Addrs, InterfaceAddr{ + Addr: addr.String(), + }) + } + + } + ret = append(ret, r) + } + + return ret, nil +} + +func getIOCountersAll(n []IOCountersStat) ([]IOCountersStat, error) { + r := IOCountersStat{ + Name: "all", + } + for _, nic := range n { + r.BytesRecv += nic.BytesRecv + r.PacketsRecv += nic.PacketsRecv + r.Errin += nic.Errin + r.Dropin += nic.Dropin + r.BytesSent += nic.BytesSent + r.PacketsSent += nic.PacketsSent + r.Errout += nic.Errout + r.Dropout += nic.Dropout + } + + return []IOCountersStat{r}, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_aix.go b/vendor/github.com/shirou/gopsutil/v3/net/net_aix.go new file mode 100644 index 00000000..81feaa8d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_aix.go @@ -0,0 +1,330 @@ +//go:build aix +// +build aix + +package net + +import ( + "context" + "fmt" + "regexp" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +// IOCountersByFile exists just for compatibility with Linux. +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + return IOCounters(pernic) +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func parseNetstatNetLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 5 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + var netType, netFamily uint32 + switch f[0] { + case "tcp", "tcp4": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET + case "udp", "udp4": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET + case "tcp6": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET6 + case "udp6": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET6 + default: + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[0]) + } + + laddr, raddr, err := parseNetstatAddr(f[3], f[4], netFamily) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s %s", f[3], f[4]) + } + + n := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(0), // not supported + } + if len(f) == 6 { + n.Status = f[5] + } + + return n, nil +} + +var portMatch = regexp.MustCompile(`(.*)\.(\d+)$`) + +// This function only works for netstat returning addresses with a "." +// before the port (0.0.0.0.22 instead of 0.0.0.0:22). +func parseNetstatAddr(local string, remote string, family uint32) (laddr Addr, raddr Addr, err error) { + parse := func(l string) (Addr, error) { + matches := portMatch.FindStringSubmatch(l) + if matches == nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + host := matches[1] + port := matches[2] + if host == "*" { + switch family { + case syscall.AF_INET: + host = "0.0.0.0" + case syscall.AF_INET6: + host = "::" + default: + return Addr{}, fmt.Errorf("unknown family, %d", family) + } + } + lport, err := strconv.Atoi(port) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil + } + + laddr, err = parse(local) + if remote != "*.*" { // remote addr exists + raddr, err = parse(remote) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +func parseNetstatUnixLine(f []string) (ConnectionStat, error) { + if len(f) < 8 { + return ConnectionStat{}, fmt.Errorf("wrong number of fields: expected >=8 got %d", len(f)) + } + + var netType uint32 + + switch f[1] { + case "dgram": + netType = syscall.SOCK_DGRAM + case "stream": + netType = syscall.SOCK_STREAM + default: + return ConnectionStat{}, fmt.Errorf("unknown type: %s", f[1]) + } + + // Some Unix Socket don't have any address associated + addr := "" + if len(f) == 9 { + addr = f[8] + } + + c := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(syscall.AF_UNIX), + Type: uint32(netType), + Laddr: Addr{ + IP: addr, + }, + Status: "NONE", + Pid: int32(0), // not supported + } + + return c, nil +} + +// Return true if proto is the corresponding to the kind parameter +// Only for Inet lines +func hasCorrectInetProto(kind, proto string) bool { + switch kind { + case "all", "inet": + return true + case "unix": + return false + case "inet4": + return !strings.HasSuffix(proto, "6") + case "inet6": + return strings.HasSuffix(proto, "6") + case "tcp": + return proto == "tcp" || proto == "tcp4" || proto == "tcp6" + case "tcp4": + return proto == "tcp" || proto == "tcp4" + case "tcp6": + return proto == "tcp6" + case "udp": + return proto == "udp" || proto == "udp4" || proto == "udp6" + case "udp4": + return proto == "udp" || proto == "udp4" + case "udp6": + return proto == "udp6" + } + return false +} + +func parseNetstatA(output string, kind string) ([]ConnectionStat, error) { + var ret []ConnectionStat + lines := strings.Split(string(output), "\n") + + for _, line := range lines { + fields := strings.Fields(line) + if len(fields) < 1 { + continue + } + + if strings.HasPrefix(fields[0], "f1") { + // Unix lines + if len(fields) < 2 { + // every unix connections have two lines + continue + } + + c, err := parseNetstatUnixLine(fields) + if err != nil { + return nil, fmt.Errorf("failed to parse Unix Address (%s): %s", line, err) + } + + ret = append(ret, c) + + } else if strings.HasPrefix(fields[0], "tcp") || strings.HasPrefix(fields[0], "udp") { + // Inet lines + if !hasCorrectInetProto(kind, fields[0]) { + continue + } + + // On AIX, netstat display some connections with "*.*" as local addresses + // Skip them as they aren't real connections. + if fields[3] == "*.*" { + continue + } + + c, err := parseNetstatNetLine(line) + if err != nil { + return nil, fmt.Errorf("failed to parse Inet Address (%s): %s", line, err) + } + + ret = append(ret, c) + } else { + // Header lines + continue + } + } + + return ret, nil +} + +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + args := []string{"-na"} + switch strings.ToLower(kind) { + default: + fallthrough + case "": + kind = "all" + case "all": + // nothing to add + case "inet", "inet4", "inet6": + args = append(args, "-finet") + case "tcp", "tcp4", "tcp6": + args = append(args, "-finet") + case "udp", "udp4", "udp6": + args = append(args, "-finet") + case "unix": + args = append(args, "-funix") + } + + out, err := invoke.CommandWithContext(ctx, "netstat", args...) + if err != nil { + return nil, err + } + + ret, err := parseNetstatA(string(out), kind) + if err != nil { + return nil, err + } + + return ret, nil +} + +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, max) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max) +} + +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_aix_cgo.go b/vendor/github.com/shirou/gopsutil/v3/net/net_aix_cgo.go new file mode 100644 index 00000000..8c34f881 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_aix_cgo.go @@ -0,0 +1,36 @@ +//go:build aix && cgo +// +build aix,cgo + +package net + +import ( + "context" + + "github.com/power-devops/perfstat" +) + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + ifs, err := perfstat.NetIfaceStat() + if err != nil { + return nil, err + } + + iocounters := make([]IOCountersStat, 0, len(ifs)) + for _, netif := range ifs { + n := IOCountersStat{ + Name: netif.Name, + BytesSent: uint64(netif.OBytes), + BytesRecv: uint64(netif.IBytes), + PacketsSent: uint64(netif.OPackets), + PacketsRecv: uint64(netif.IPackets), + Errin: uint64(netif.OErrors), + Errout: uint64(netif.IErrors), + Dropout: uint64(netif.XmitDrops), + } + iocounters = append(iocounters, n) + } + if pernic == false { + return getIOCountersAll(iocounters) + } + return iocounters, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_aix_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/net/net_aix_nocgo.go new file mode 100644 index 00000000..e3fce902 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_aix_nocgo.go @@ -0,0 +1,95 @@ +//go:build aix && !cgo +// +build aix,!cgo + +package net + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func parseNetstatI(output string) ([]IOCountersStat, error) { + lines := strings.Split(string(output), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + exists := make([]string, 0, len(ret)) + + // Check first line is header + if len(lines) > 0 && strings.Fields(lines[0])[0] != "Name" { + return nil, fmt.Errorf("not a 'netstat -i' output") + } + + for _, line := range lines[1:] { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + exists = append(exists, values[0]) + + if len(values) < 9 { + continue + } + + base := 1 + // sometimes Address is omitted + if len(values) < 10 { + base = 0 + } + + parsed := make([]uint64, 0, 5) + vv := []string{ + values[base+3], // Ipkts == PacketsRecv + values[base+4], // Ierrs == Errin + values[base+5], // Opkts == PacketsSent + values[base+6], // Oerrs == Errout + values[base+8], // Drops == Dropout + } + + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return nil, err + } + parsed = append(parsed, t) + } + + n := IOCountersStat{ + Name: values[0], + PacketsRecv: parsed[0], + Errin: parsed[1], + PacketsSent: parsed[2], + Errout: parsed[3], + Dropout: parsed[4], + } + ret = append(ret, n) + } + return ret, nil +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + out, err := invoke.CommandWithContext(ctx, "netstat", "-idn") + if err != nil { + return nil, err + } + + iocounters, err := parseNetstatI(string(out)) + if err != nil { + return nil, err + } + if pernic == false { + return getIOCountersAll(iocounters) + } + return iocounters, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_darwin.go b/vendor/github.com/shirou/gopsutil/v3/net/net_darwin.go new file mode 100644 index 00000000..8a7b6374 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_darwin.go @@ -0,0 +1,291 @@ +//go:build darwin +// +build darwin + +package net + +import ( + "context" + "errors" + "fmt" + "os/exec" + "regexp" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +var ( + errNetstatHeader = errors.New("Can't parse header of netstat output") + netstatLinkRegexp = regexp.MustCompile(`^$`) +) + +const endOfLine = "\n" + +func parseNetstatLine(line string) (stat *IOCountersStat, linkID *uint, err error) { + var ( + numericValue uint64 + columns = strings.Fields(line) + ) + + if columns[0] == "Name" { + err = errNetstatHeader + return + } + + // try to extract the numeric value from + if subMatch := netstatLinkRegexp.FindStringSubmatch(columns[2]); len(subMatch) == 2 { + numericValue, err = strconv.ParseUint(subMatch[1], 10, 64) + if err != nil { + return + } + linkIDUint := uint(numericValue) + linkID = &linkIDUint + } + + base := 1 + numberColumns := len(columns) + // sometimes Address is omitted + if numberColumns < 12 { + base = 0 + } + if numberColumns < 11 || numberColumns > 13 { + err = fmt.Errorf("Line %q do have an invalid number of columns %d", line, numberColumns) + return + } + + parsed := make([]uint64, 0, 7) + vv := []string{ + columns[base+3], // Ipkts == PacketsRecv + columns[base+4], // Ierrs == Errin + columns[base+5], // Ibytes == BytesRecv + columns[base+6], // Opkts == PacketsSent + columns[base+7], // Oerrs == Errout + columns[base+8], // Obytes == BytesSent + } + if len(columns) == 12 { + vv = append(vv, columns[base+10]) + } + + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + if numericValue, err = strconv.ParseUint(target, 10, 64); err != nil { + return + } + parsed = append(parsed, numericValue) + } + + stat = &IOCountersStat{ + Name: strings.Trim(columns[0], "*"), // remove the * that sometimes is on right on interface + PacketsRecv: parsed[0], + Errin: parsed[1], + BytesRecv: parsed[2], + PacketsSent: parsed[3], + Errout: parsed[4], + BytesSent: parsed[5], + } + if len(parsed) == 7 { + stat.Dropout = parsed[6] + } + return +} + +type netstatInterface struct { + linkID *uint + stat *IOCountersStat +} + +func parseNetstatOutput(output string) ([]netstatInterface, error) { + var ( + err error + lines = strings.Split(strings.Trim(output, endOfLine), endOfLine) + ) + + // number of interfaces is number of lines less one for the header + numberInterfaces := len(lines) - 1 + + interfaces := make([]netstatInterface, numberInterfaces) + // no output beside header + if numberInterfaces == 0 { + return interfaces, nil + } + + for index := 0; index < numberInterfaces; index++ { + nsIface := netstatInterface{} + if nsIface.stat, nsIface.linkID, err = parseNetstatLine(lines[index+1]); err != nil { + return nil, err + } + interfaces[index] = nsIface + } + return interfaces, nil +} + +// map that hold the name of a network interface and the number of usage +type mapInterfaceNameUsage map[string]uint + +func newMapInterfaceNameUsage(ifaces []netstatInterface) mapInterfaceNameUsage { + output := make(mapInterfaceNameUsage) + for index := range ifaces { + if ifaces[index].linkID != nil { + ifaceName := ifaces[index].stat.Name + usage, ok := output[ifaceName] + if ok { + output[ifaceName] = usage + 1 + } else { + output[ifaceName] = 1 + } + } + } + return output +} + +func (min mapInterfaceNameUsage) isTruncated() bool { + for _, usage := range min { + if usage > 1 { + return true + } + } + return false +} + +func (min mapInterfaceNameUsage) notTruncated() []string { + output := make([]string, 0) + for ifaceName, usage := range min { + if usage == 1 { + output = append(output, ifaceName) + } + } + return output +} + +// example of `netstat -ibdnW` output on yosemite +// Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll Drop +// lo0 16384 869107 0 169411755 869107 0 169411755 0 0 +// lo0 16384 ::1/128 ::1 869107 - 169411755 869107 - 169411755 - - +// lo0 16384 127 127.0.0.1 869107 - 169411755 869107 - 169411755 - - +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + var ( + ret []IOCountersStat + retIndex int + ) + + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + + // try to get all interface metrics, and hope there won't be any truncated + out, err := invoke.CommandWithContext(ctx, netstat, "-ibdnW") + if err != nil { + return nil, err + } + + nsInterfaces, err := parseNetstatOutput(string(out)) + if err != nil { + return nil, err + } + + ifaceUsage := newMapInterfaceNameUsage(nsInterfaces) + notTruncated := ifaceUsage.notTruncated() + ret = make([]IOCountersStat, len(notTruncated)) + + if !ifaceUsage.isTruncated() { + // no truncated interface name, return stats of all interface with + for index := range nsInterfaces { + if nsInterfaces[index].linkID != nil { + ret[retIndex] = *nsInterfaces[index].stat + retIndex++ + } + } + } else { + // duplicated interface, list all interfaces + if out, err = invoke.CommandWithContext(ctx, "ifconfig", "-l"); err != nil { + return nil, err + } + interfaceNames := strings.Fields(strings.TrimRight(string(out), endOfLine)) + + // for each of the interface name, run netstat if we don't have any stats yet + for _, interfaceName := range interfaceNames { + truncated := true + for index := range nsInterfaces { + if nsInterfaces[index].linkID != nil && nsInterfaces[index].stat.Name == interfaceName { + // handle the non truncated name to avoid execute netstat for them again + ret[retIndex] = *nsInterfaces[index].stat + retIndex++ + truncated = false + break + } + } + if truncated { + // run netstat with -I$ifacename + if out, err = invoke.CommandWithContext(ctx, netstat, "-ibdnWI"+interfaceName); err != nil { + return nil, err + } + parsedIfaces, err := parseNetstatOutput(string(out)) + if err != nil { + return nil, err + } + if len(parsedIfaces) == 0 { + // interface had been removed since `ifconfig -l` had been executed + continue + } + for index := range parsedIfaces { + if parsedIfaces[index].linkID != nil { + ret = append(ret, *parsedIfaces[index].stat) + break + } + } + } + } + } + + if pernic == false { + return getIOCountersAll(ret) + } + return ret, nil +} + +// IOCountersByFile exists just for compatibility with Linux. +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersWithContext(ctx, pernic) +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Not Implemented for Darwin +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_fallback.go b/vendor/github.com/shirou/gopsutil/v3/net/net_fallback.go new file mode 100644 index 00000000..e136be1b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_fallback.go @@ -0,0 +1,93 @@ +//go:build !aix && !darwin && !linux && !freebsd && !openbsd && !windows && !solaris +// +build !aix,!darwin,!linux,!freebsd,!openbsd,!windows,!solaris + +package net + +import ( + "context" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + return []IOCountersStat{}, common.ErrNotImplementedError +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return []FilterStat{}, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return []ProtoCountersStat{}, common.ErrNotImplementedError +} + +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, max) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max) +} + +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_freebsd.go b/vendor/github.com/shirou/gopsutil/v3/net/net_freebsd.go new file mode 100644 index 00000000..bf8baf09 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_freebsd.go @@ -0,0 +1,128 @@ +//go:build freebsd +// +build freebsd + +package net + +import ( + "context" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + out, err := invoke.CommandWithContext(ctx, "netstat", "-ibdnW") + if err != nil { + return nil, err + } + + lines := strings.Split(string(out), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + exists := make([]string, 0, len(ret)) + + for _, line := range lines { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + exists = append(exists, values[0]) + + if len(values) < 12 { + continue + } + base := 1 + // sometimes Address is omitted + if len(values) < 13 { + base = 0 + } + + parsed := make([]uint64, 0, 8) + vv := []string{ + values[base+3], // PacketsRecv + values[base+4], // Errin + values[base+5], // Dropin + values[base+6], // BytesRecvn + values[base+7], // PacketSent + values[base+8], // Errout + values[base+9], // BytesSent + values[base+11], // Dropout + } + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return nil, err + } + parsed = append(parsed, t) + } + + n := IOCountersStat{ + Name: values[0], + PacketsRecv: parsed[0], + Errin: parsed[1], + Dropin: parsed[2], + BytesRecv: parsed[3], + PacketsSent: parsed[4], + Errout: parsed[5], + BytesSent: parsed[6], + Dropout: parsed[7], + } + ret = append(ret, n) + } + + if pernic == false { + return getIOCountersAll(ret) + } + + return ret, nil +} + +// IOCountersByFile exists just for compatibility with Linux. +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + return IOCounters(pernic) +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Not Implemented for FreeBSD +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_linux.go b/vendor/github.com/shirou/gopsutil/v3/net/net_linux.go new file mode 100644 index 00000000..6e8ce67f --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_linux.go @@ -0,0 +1,910 @@ +//go:build linux +// +build linux + +package net + +import ( + "bytes" + "context" + "encoding/hex" + "errors" + "fmt" + "io" + "net" + "os" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +const ( // Conntrack Column numbers + ctENTRIES = iota + ctSEARCHED + ctFOUND + ctNEW + ctINVALID + ctIGNORE + ctDELETE + ctDELETE_LIST + ctINSERT + ctINSERT_FAILED + ctDROP + ctEARLY_DROP + ctICMP_ERROR + CT_EXPEctNEW + ctEXPECT_CREATE + CT_EXPEctDELETE + ctSEARCH_RESTART +) + +// NetIOCounters returns network I/O statistics for every network +// interface installed on the system. If pernic argument is false, +// return only sum of all information (which name is 'all'). If true, +// every network interface installed on the system is returned +// separately. +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + filename := common.HostProcWithContext(ctx, "net/dev") + return IOCountersByFileWithContext(ctx, pernic, filename) +} + +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + parts := make([]string, 2) + + statlen := len(lines) - 1 + + ret := make([]IOCountersStat, 0, statlen) + + for _, line := range lines[2:] { + separatorPos := strings.LastIndex(line, ":") + if separatorPos == -1 { + continue + } + parts[0] = line[0:separatorPos] + parts[1] = line[separatorPos+1:] + + interfaceName := strings.TrimSpace(parts[0]) + if interfaceName == "" { + continue + } + + fields := strings.Fields(strings.TrimSpace(parts[1])) + bytesRecv, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return ret, err + } + packetsRecv, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return ret, err + } + errIn, err := strconv.ParseUint(fields[2], 10, 64) + if err != nil { + return ret, err + } + dropIn, err := strconv.ParseUint(fields[3], 10, 64) + if err != nil { + return ret, err + } + fifoIn, err := strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return ret, err + } + bytesSent, err := strconv.ParseUint(fields[8], 10, 64) + if err != nil { + return ret, err + } + packetsSent, err := strconv.ParseUint(fields[9], 10, 64) + if err != nil { + return ret, err + } + errOut, err := strconv.ParseUint(fields[10], 10, 64) + if err != nil { + return ret, err + } + dropOut, err := strconv.ParseUint(fields[11], 10, 64) + if err != nil { + return ret, err + } + fifoOut, err := strconv.ParseUint(fields[12], 10, 64) + if err != nil { + return ret, err + } + + nic := IOCountersStat{ + Name: interfaceName, + BytesRecv: bytesRecv, + PacketsRecv: packetsRecv, + Errin: errIn, + Dropin: dropIn, + Fifoin: fifoIn, + BytesSent: bytesSent, + PacketsSent: packetsSent, + Errout: errOut, + Dropout: dropOut, + Fifoout: fifoOut, + } + ret = append(ret, nic) + } + + if !pernic { + return getIOCountersAll(ret) + } + + return ret, nil +} + +var netProtocols = []string{ + "ip", + "icmp", + "icmpmsg", + "tcp", + "udp", + "udplite", +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Available protocols: +// [ip,icmp,icmpmsg,tcp,udp,udplite] +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + if len(protocols) == 0 { + protocols = netProtocols + } + + stats := make([]ProtoCountersStat, 0, len(protocols)) + protos := make(map[string]bool, len(protocols)) + for _, p := range protocols { + protos[p] = true + } + + filename := common.HostProcWithContext(ctx, "net/snmp") + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + linecount := len(lines) + for i := 0; i < linecount; i++ { + line := lines[i] + r := strings.IndexRune(line, ':') + if r == -1 { + return nil, errors.New(filename + " is not formatted correctly, expected ':'.") + } + proto := strings.ToLower(line[:r]) + if !protos[proto] { + // skip protocol and data line + i++ + continue + } + + // Read header line + statNames := strings.Split(line[r+2:], " ") + + // Read data line + i++ + statValues := strings.Split(lines[i][r+2:], " ") + if len(statNames) != len(statValues) { + return nil, errors.New(filename + " is not formatted correctly, expected same number of columns.") + } + stat := ProtoCountersStat{ + Protocol: proto, + Stats: make(map[string]int64, len(statNames)), + } + for j := range statNames { + value, err := strconv.ParseInt(statValues[j], 10, 64) + if err != nil { + return nil, err + } + stat.Stats[statNames[j]] = value + } + stats = append(stats, stat) + } + return stats, nil +} + +// NetFilterCounters returns iptables conntrack statistics +// the currently in use conntrack count and the max. +// If the file does not exist or is invalid it will return nil. +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + countfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_count") + maxfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_max") + + count, err := common.ReadInts(countfile) + if err != nil { + return nil, err + } + stats := make([]FilterStat, 0, 1) + + max, err := common.ReadInts(maxfile) + if err != nil { + return nil, err + } + + payload := FilterStat{ + ConnTrackCount: count[0], + ConnTrackMax: max[0], + } + + stats = append(stats, payload) + return stats, nil +} + +// ConntrackStats returns more detailed info about the conntrack table +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +// ConntrackStatsWithContext returns more detailed info about the conntrack table +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return conntrackStatsFromFile(common.HostProcWithContext(ctx, "net/stat/nf_conntrack"), percpu) +} + +// conntrackStatsFromFile returns more detailed info about the conntrack table +// from `filename` +// If 'percpu' is false, the result will contain exactly one item with totals/summary +func conntrackStatsFromFile(filename string, percpu bool) ([]ConntrackStat, error) { + lines, err := common.ReadLines(filename) + if err != nil { + return nil, err + } + + statlist := NewConntrackStatList() + + for _, line := range lines { + fields := strings.Fields(line) + if len(fields) == 17 && fields[0] != "entries" { + statlist.Append(NewConntrackStat( + common.HexToUint32(fields[ctENTRIES]), + common.HexToUint32(fields[ctSEARCHED]), + common.HexToUint32(fields[ctFOUND]), + common.HexToUint32(fields[ctNEW]), + common.HexToUint32(fields[ctINVALID]), + common.HexToUint32(fields[ctIGNORE]), + common.HexToUint32(fields[ctDELETE]), + common.HexToUint32(fields[ctDELETE_LIST]), + common.HexToUint32(fields[ctINSERT]), + common.HexToUint32(fields[ctINSERT_FAILED]), + common.HexToUint32(fields[ctDROP]), + common.HexToUint32(fields[ctEARLY_DROP]), + common.HexToUint32(fields[ctICMP_ERROR]), + common.HexToUint32(fields[CT_EXPEctNEW]), + common.HexToUint32(fields[ctEXPECT_CREATE]), + common.HexToUint32(fields[CT_EXPEctDELETE]), + common.HexToUint32(fields[ctSEARCH_RESTART]), + )) + } + } + + if percpu { + return statlist.Items(), nil + } + return statlist.Summary(), nil +} + +// http://students.mimuw.edu.pl/lxr/source/include/net/tcp_states.h +var tcpStatuses = map[string]string{ + "01": "ESTABLISHED", + "02": "SYN_SENT", + "03": "SYN_RECV", + "04": "FIN_WAIT1", + "05": "FIN_WAIT2", + "06": "TIME_WAIT", + "07": "CLOSE", + "08": "CLOSE_WAIT", + "09": "LAST_ACK", + "0A": "LISTEN", + "0B": "CLOSING", +} + +type netConnectionKindType struct { + family uint32 + sockType uint32 + filename string +} + +var kindTCP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_STREAM, + filename: "tcp", +} + +var kindTCP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_STREAM, + filename: "tcp6", +} + +var kindUDP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_DGRAM, + filename: "udp", +} + +var kindUDP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_DGRAM, + filename: "udp6", +} + +var kindUNIX = netConnectionKindType{ + family: syscall.AF_UNIX, + filename: "unix", +} + +var netConnectionKindMap = map[string][]netConnectionKindType{ + "all": {kindTCP4, kindTCP6, kindUDP4, kindUDP6, kindUNIX}, + "tcp": {kindTCP4, kindTCP6}, + "tcp4": {kindTCP4}, + "tcp6": {kindTCP6}, + "udp": {kindUDP4, kindUDP6}, + "udp4": {kindUDP4}, + "udp6": {kindUDP6}, + "unix": {kindUNIX}, + "inet": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "inet4": {kindTCP4, kindUDP4}, + "inet6": {kindTCP6, kindUDP6}, +} + +type inodeMap struct { + pid int32 + fd uint32 +} + +type connTmp struct { + fd uint32 + family uint32 + sockType uint32 + laddr Addr + raddr Addr + status string + pid int32 + boundPid int32 + path string +} + +// Return a list of network connections opened. +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, max) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, 0, max) +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max) +} + +// Return a list of network connections opened by a process. +func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +// Return up to `max` network connections opened by a process. +func ConnectionsPidMax(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max, false) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max, true) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int, skipUids bool) ([]ConnectionStat, error) { + tmap, ok := netConnectionKindMap[kind] + if !ok { + return nil, fmt.Errorf("invalid kind, %s", kind) + } + root := common.HostProcWithContext(ctx) + var err error + var inodes map[string][]inodeMap + if pid == 0 { + inodes, err = getProcInodesAllWithContext(ctx, root, max) + } else { + inodes, err = getProcInodes(root, pid, max) + if len(inodes) == 0 { + // no connection for the pid + return []ConnectionStat{}, nil + } + } + if err != nil { + return nil, fmt.Errorf("cound not get pid(s), %d: %w", pid, err) + } + return statsFromInodesWithContext(ctx, root, pid, tmap, inodes, skipUids) +} + +func statsFromInodes(root string, pid int32, tmap []netConnectionKindType, inodes map[string][]inodeMap, skipUids bool) ([]ConnectionStat, error) { + return statsFromInodesWithContext(context.Background(), root, pid, tmap, inodes, skipUids) +} + +func statsFromInodesWithContext(ctx context.Context, root string, pid int32, tmap []netConnectionKindType, inodes map[string][]inodeMap, skipUids bool) ([]ConnectionStat, error) { + dupCheckMap := make(map[string]struct{}) + var ret []ConnectionStat + + var err error + for _, t := range tmap { + var path string + var connKey string + var ls []connTmp + if pid == 0 { + path = fmt.Sprintf("%s/net/%s", root, t.filename) + } else { + path = fmt.Sprintf("%s/%d/net/%s", root, pid, t.filename) + } + switch t.family { + case syscall.AF_INET, syscall.AF_INET6: + ls, err = processInetWithContext(ctx, path, t, inodes, pid) + case syscall.AF_UNIX: + ls, err = processUnix(path, t, inodes, pid) + } + if err != nil { + return nil, err + } + for _, c := range ls { + // Build TCP key to id the connection uniquely + // socket type, src ip, src port, dst ip, dst port and state should be enough + // to prevent duplications. + connKey = fmt.Sprintf("%d-%s:%d-%s:%d-%s", c.sockType, c.laddr.IP, c.laddr.Port, c.raddr.IP, c.raddr.Port, c.status) + if _, ok := dupCheckMap[connKey]; ok { + continue + } + + conn := ConnectionStat{ + Fd: c.fd, + Family: c.family, + Type: c.sockType, + Laddr: c.laddr, + Raddr: c.raddr, + Status: c.status, + Pid: c.pid, + } + if c.pid == 0 { + conn.Pid = c.boundPid + } else { + conn.Pid = c.pid + } + + if !skipUids { + // fetch process owner Real, effective, saved set, and filesystem UIDs + proc := process{Pid: conn.Pid} + conn.Uids, _ = proc.getUids(ctx) + } + + ret = append(ret, conn) + dupCheckMap[connKey] = struct{}{} + } + + } + + return ret, nil +} + +// getProcInodes returns fd of the pid. +func getProcInodes(root string, pid int32, max int) (map[string][]inodeMap, error) { + ret := make(map[string][]inodeMap) + + dir := fmt.Sprintf("%s/%d/fd", root, pid) + f, err := os.Open(dir) + if err != nil { + return ret, err + } + defer f.Close() + dirEntries, err := readDir(f, max) + if err != nil { + return ret, err + } + for _, dirEntry := range dirEntries { + inodePath := fmt.Sprintf("%s/%d/fd/%s", root, pid, dirEntry.Name()) + + inode, err := os.Readlink(inodePath) + if err != nil { + continue + } + if !strings.HasPrefix(inode, "socket:[") { + continue + } + // the process is using a socket + l := len(inode) + inode = inode[8 : l-1] + _, ok := ret[inode] + if !ok { + ret[inode] = make([]inodeMap, 0) + } + fd, err := strconv.Atoi(dirEntry.Name()) + if err != nil { + continue + } + + i := inodeMap{ + pid: pid, + fd: uint32(fd), + } + ret[inode] = append(ret[inode], i) + } + return ret, nil +} + +// Pids retunres all pids. +// Note: this is a copy of process_linux.Pids() +// FIXME: Import process occures import cycle. +// move to common made other platform breaking. Need consider. +func Pids() ([]int32, error) { + return PidsWithContext(context.Background()) +} + +func PidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + + d, err := os.Open(common.HostProcWithContext(ctx)) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} + +// Note: the following is based off process_linux structs and methods +// we need these to fetch the owner of a process ID +// FIXME: Import process occures import cycle. +// see remarks on pids() +type process struct { + Pid int32 `json:"pid"` + uids []int32 +} + +// Uids returns user ids of the process as a slice of the int +func (p *process) getUids(ctx context.Context) ([]int32, error) { + err := p.fillFromStatus(ctx) + if err != nil { + return []int32{}, err + } + return p.uids, nil +} + +// Get status from /proc/(pid)/status +func (p *process) fillFromStatus(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "status") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + lines := strings.Split(string(contents), "\n") + for _, line := range lines { + tabParts := strings.SplitN(line, "\t", 2) + if len(tabParts) < 2 { + continue + } + value := tabParts[1] + switch strings.TrimRight(tabParts[0], ":") { + case "Uid": + p.uids = make([]int32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseInt(i, 10, 32) + if err != nil { + return err + } + p.uids = append(p.uids, int32(v)) + } + } + } + return nil +} + +func getProcInodesAll(root string, max int) (map[string][]inodeMap, error) { + return getProcInodesAllWithContext(context.Background(), root, max) +} + +func getProcInodesAllWithContext(ctx context.Context, root string, max int) (map[string][]inodeMap, error) { + pids, err := PidsWithContext(ctx) + if err != nil { + return nil, err + } + ret := make(map[string][]inodeMap) + + for _, pid := range pids { + t, err := getProcInodes(root, pid, max) + if err != nil { + // skip if permission error or no longer exists + if os.IsPermission(err) || os.IsNotExist(err) || errors.Is(err, io.EOF) { + continue + } + return ret, err + } + if len(t) == 0 { + continue + } + // TODO: update ret. + ret = updateMap(ret, t) + } + return ret, nil +} + +// decodeAddress decode addresse represents addr in proc/net/* +// ex: +// "0500000A:0016" -> "10.0.0.5", 22 +// "0085002452100113070057A13F025401:0035" -> "2400:8500:1301:1052:a157:7:154:23f", 53 +func decodeAddress(family uint32, src string) (Addr, error) { + return decodeAddressWithContext(context.Background(), family, src) +} + +func decodeAddressWithContext(ctx context.Context, family uint32, src string) (Addr, error) { + t := strings.Split(src, ":") + if len(t) != 2 { + return Addr{}, fmt.Errorf("does not contain port, %s", src) + } + addr := t[0] + port, err := strconv.ParseUint(t[1], 16, 16) + if err != nil { + return Addr{}, fmt.Errorf("invalid port, %s", src) + } + decoded, err := hex.DecodeString(addr) + if err != nil { + return Addr{}, fmt.Errorf("decode error, %w", err) + } + var ip net.IP + + if family == syscall.AF_INET { + if common.IsLittleEndian() { + ip = net.IP(ReverseWithContext(ctx, decoded)) + } else { + ip = net.IP(decoded) + } + } else { // IPv6 + ip, err = parseIPv6HexStringWithContext(ctx, decoded) + if err != nil { + return Addr{}, err + } + } + return Addr{ + IP: ip.String(), + Port: uint32(port), + }, nil +} + +// Reverse reverses array of bytes. +func Reverse(s []byte) []byte { + return ReverseWithContext(context.Background(), s) +} + +func ReverseWithContext(ctx context.Context, s []byte) []byte { + for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { + s[i], s[j] = s[j], s[i] + } + return s +} + +// parseIPv6HexString parse array of bytes to IPv6 string +func parseIPv6HexString(src []byte) (net.IP, error) { + return parseIPv6HexStringWithContext(context.Background(), src) +} + +func parseIPv6HexStringWithContext(ctx context.Context, src []byte) (net.IP, error) { + if len(src) != 16 { + return nil, fmt.Errorf("invalid IPv6 string") + } + + buf := make([]byte, 0, 16) + for i := 0; i < len(src); i += 4 { + r := ReverseWithContext(ctx, src[i:i+4]) + buf = append(buf, r...) + } + return net.IP(buf), nil +} + +func processInet(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + return processInetWithContext(context.Background(), file, kind, inodes, filterPid) +} + +func processInetWithContext(ctx context.Context, file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + if strings.HasSuffix(file, "6") && !common.PathExists(file) { + // IPv6 not supported, return empty. + return []connTmp{}, nil + } + + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 + contents, err := os.ReadFile(file) + if err != nil { + return nil, err + } + + lines := bytes.Split(contents, []byte("\n")) + + var ret []connTmp + // skip first line + for _, line := range lines[1:] { + l := strings.Fields(string(line)) + if len(l) < 10 { + continue + } + laddr := l[1] + raddr := l[2] + status := l[3] + inode := l[9] + pid := int32(0) + fd := uint32(0) + i, exists := inodes[inode] + if exists { + pid = i[0].pid + fd = i[0].fd + } + if filterPid > 0 && filterPid != pid { + continue + } + if kind.sockType == syscall.SOCK_STREAM { + status = tcpStatuses[status] + } else { + status = "NONE" + } + la, err := decodeAddressWithContext(ctx, kind.family, laddr) + if err != nil { + continue + } + ra, err := decodeAddressWithContext(ctx, kind.family, raddr) + if err != nil { + continue + } + + ret = append(ret, connTmp{ + fd: fd, + family: kind.family, + sockType: kind.sockType, + laddr: la, + raddr: ra, + status: status, + pid: pid, + }) + } + + return ret, nil +} + +func processUnix(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 + contents, err := os.ReadFile(file) + if err != nil { + return nil, err + } + + lines := bytes.Split(contents, []byte("\n")) + + var ret []connTmp + // skip first line + for _, line := range lines[1:] { + tokens := strings.Fields(string(line)) + if len(tokens) < 6 { + continue + } + st, err := strconv.Atoi(tokens[4]) + if err != nil { + return nil, err + } + + inode := tokens[6] + + var pairs []inodeMap + pairs, exists := inodes[inode] + if !exists { + pairs = []inodeMap{ + {}, + } + } + for _, pair := range pairs { + if filterPid > 0 && filterPid != pair.pid { + continue + } + var path string + if len(tokens) == 8 { + path = tokens[len(tokens)-1] + } + ret = append(ret, connTmp{ + fd: pair.fd, + family: kind.family, + sockType: uint32(st), + laddr: Addr{ + IP: path, + }, + pid: pair.pid, + status: "NONE", + path: path, + }) + } + } + + return ret, nil +} + +func updateMap(src map[string][]inodeMap, add map[string][]inodeMap) map[string][]inodeMap { + for key, value := range add { + a, exists := src[key] + if !exists { + src[key] = value + continue + } + src[key] = append(a, value...) + } + return src +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_linux_111.go b/vendor/github.com/shirou/gopsutil/v3/net/net_linux_111.go new file mode 100644 index 00000000..bd5c9587 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_linux_111.go @@ -0,0 +1,12 @@ +//go:build !go1.16 +// +build !go1.16 + +package net + +import ( + "os" +) + +func readDir(f *os.File, max int) ([]os.FileInfo, error) { + return f.Readdir(max) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_linux_116.go b/vendor/github.com/shirou/gopsutil/v3/net/net_linux_116.go new file mode 100644 index 00000000..a45072e9 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_linux_116.go @@ -0,0 +1,12 @@ +//go:build go1.16 +// +build go1.16 + +package net + +import ( + "os" +) + +func readDir(f *os.File, max int) ([]os.DirEntry, error) { + return f.ReadDir(max) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_openbsd.go b/vendor/github.com/shirou/gopsutil/v3/net/net_openbsd.go new file mode 100644 index 00000000..cf48f53e --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_openbsd.go @@ -0,0 +1,319 @@ +//go:build openbsd +// +build openbsd + +package net + +import ( + "context" + "fmt" + "os/exec" + "regexp" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +var portMatch = regexp.MustCompile(`(.*)\.(\d+)$`) + +func ParseNetstat(output string, mode string, + iocs map[string]IOCountersStat) error { + lines := strings.Split(output, "\n") + + exists := make([]string, 0, len(lines)-1) + + columns := 6 + if mode == "ind" { + columns = 10 + } + for _, line := range lines { + values := strings.Fields(line) + if len(values) < 1 || values[0] == "Name" { + continue + } + if common.StringsHas(exists, values[0]) { + // skip if already get + continue + } + + if len(values) < columns { + continue + } + base := 1 + // sometimes Address is omitted + if len(values) < columns { + base = 0 + } + + parsed := make([]uint64, 0, 8) + var vv []string + if mode == "inb" { + vv = []string{ + values[base+3], // BytesRecv + values[base+4], // BytesSent + } + } else { + vv = []string{ + values[base+3], // Ipkts + values[base+4], // Ierrs + values[base+5], // Opkts + values[base+6], // Oerrs + values[base+8], // Drops + } + } + for _, target := range vv { + if target == "-" { + parsed = append(parsed, 0) + continue + } + + t, err := strconv.ParseUint(target, 10, 64) + if err != nil { + return err + } + parsed = append(parsed, t) + } + exists = append(exists, values[0]) + + n, present := iocs[values[0]] + if !present { + n = IOCountersStat{Name: values[0]} + } + if mode == "inb" { + n.BytesRecv = parsed[0] + n.BytesSent = parsed[1] + } else { + n.PacketsRecv = parsed[0] + n.Errin = parsed[1] + n.PacketsSent = parsed[2] + n.Errout = parsed[3] + n.Dropin = parsed[4] + n.Dropout = parsed[4] + } + + iocs[n.Name] = n + } + return nil +} + +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + out, err := invoke.CommandWithContext(ctx, netstat, "-inb") + if err != nil { + return nil, err + } + out2, err := invoke.CommandWithContext(ctx, netstat, "-ind") + if err != nil { + return nil, err + } + iocs := make(map[string]IOCountersStat) + + lines := strings.Split(string(out), "\n") + ret := make([]IOCountersStat, 0, len(lines)-1) + + err = ParseNetstat(string(out), "inb", iocs) + if err != nil { + return nil, err + } + err = ParseNetstat(string(out2), "ind", iocs) + if err != nil { + return nil, err + } + + for _, ioc := range iocs { + ret = append(ret, ioc) + } + + if pernic == false { + return getIOCountersAll(ret) + } + + return ret, nil +} + +// IOCountersByFile exists just for compatibility with Linux. +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + return IOCounters(pernic) +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Not Implemented for OpenBSD +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func parseNetstatLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 5 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + var netType, netFamily uint32 + switch f[0] { + case "tcp": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET + case "udp": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET + case "tcp6": + netType = syscall.SOCK_STREAM + netFamily = syscall.AF_INET6 + case "udp6": + netType = syscall.SOCK_DGRAM + netFamily = syscall.AF_INET6 + default: + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[0]) + } + + laddr, raddr, err := parseNetstatAddr(f[3], f[4], netFamily) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s %s", f[3], f[4]) + } + + n := ConnectionStat{ + Fd: uint32(0), // not supported + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(0), // not supported + } + if len(f) == 6 { + n.Status = f[5] + } + + return n, nil +} + +func parseNetstatAddr(local string, remote string, family uint32) (laddr Addr, raddr Addr, err error) { + parse := func(l string) (Addr, error) { + matches := portMatch.FindStringSubmatch(l) + if matches == nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + host := matches[1] + port := matches[2] + if host == "*" { + switch family { + case syscall.AF_INET: + host = "0.0.0.0" + case syscall.AF_INET6: + host = "::" + default: + return Addr{}, fmt.Errorf("unknown family, %d", family) + } + } + lport, err := strconv.Atoi(port) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil + } + + laddr, err = parse(local) + if remote != "*.*" { // remote addr exists + raddr, err = parse(remote) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +// Return a list of network connections opened. +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + var ret []ConnectionStat + + args := []string{"-na"} + switch strings.ToLower(kind) { + default: + fallthrough + case "": + fallthrough + case "all": + fallthrough + case "inet": + // nothing to add + case "inet4": + args = append(args, "-finet") + case "inet6": + args = append(args, "-finet6") + case "tcp": + args = append(args, "-ptcp") + case "tcp4": + args = append(args, "-ptcp", "-finet") + case "tcp6": + args = append(args, "-ptcp", "-finet6") + case "udp": + args = append(args, "-pudp") + case "udp4": + args = append(args, "-pudp", "-finet") + case "udp6": + args = append(args, "-pudp", "-finet6") + case "unix": + return ret, common.ErrNotImplementedError + } + + netstat, err := exec.LookPath("netstat") + if err != nil { + return nil, err + } + out, err := invoke.CommandWithContext(ctx, netstat, args...) + if err != nil { + return nil, err + } + lines := strings.Split(string(out), "\n") + for _, line := range lines { + if !(strings.HasPrefix(line, "tcp") || strings.HasPrefix(line, "udp")) { + continue + } + n, err := parseNetstatLine(line) + if err != nil { + continue + } + + ret = append(ret, n) + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go b/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go new file mode 100644 index 00000000..79d8ac30 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_solaris.go @@ -0,0 +1,144 @@ +//go:build solaris +// +build solaris + +package net + +import ( + "context" + "fmt" + "regexp" + "runtime" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +// NetIOCounters returnes network I/O statistics for every network +// interface installed on the system. If pernic argument is false, +// return only sum of all information (which name is 'all'). If true, +// every network interface installed on the system is returned +// separately. +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +var kstatSplit = regexp.MustCompile(`[:\s]+`) + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + // collect all the net class's links with below statistics + filterstr := "/^(?!vnic)/::phys:/^rbytes64$|^ipackets64$|^idrops64$|^ierrors$|^obytes64$|^opackets64$|^odrops64$|^oerrors$/" + if runtime.GOOS == "illumos" { + filterstr = "/[^vnic]/::mac:/^rbytes64$|^ipackets64$|^idrops64$|^ierrors$|^obytes64$|^opackets64$|^odrops64$|^oerrors$/" + } + kstatSysOut, err := invoke.CommandWithContext(ctx, "kstat", "-c", "net", "-p", filterstr) + if err != nil { + return nil, fmt.Errorf("cannot execute kstat: %w", err) + } + + lines := strings.Split(strings.TrimSpace(string(kstatSysOut)), "\n") + if len(lines) == 0 { + return nil, fmt.Errorf("no interface found") + } + rbytes64arr := make(map[string]uint64) + ipackets64arr := make(map[string]uint64) + idrops64arr := make(map[string]uint64) + ierrorsarr := make(map[string]uint64) + obytes64arr := make(map[string]uint64) + opackets64arr := make(map[string]uint64) + odrops64arr := make(map[string]uint64) + oerrorsarr := make(map[string]uint64) + + for _, line := range lines { + fields := kstatSplit.Split(line, -1) + interfaceName := fields[0] + instance := fields[1] + switch fields[3] { + case "rbytes64": + rbytes64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse rbytes64: %w", err) + } + case "ipackets64": + ipackets64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse ipackets64: %w", err) + } + case "idrops64": + idrops64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse idrops64: %w", err) + } + case "ierrors": + ierrorsarr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse ierrors: %w", err) + } + case "obytes64": + obytes64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse obytes64: %w", err) + } + case "opackets64": + opackets64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse opackets64: %w", err) + } + case "odrops64": + odrops64arr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse odrops64: %w", err) + } + case "oerrors": + oerrorsarr[interfaceName+instance], err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, fmt.Errorf("cannot parse oerrors: %w", err) + } + } + } + ret := make([]IOCountersStat, 0) + for k := range rbytes64arr { + nic := IOCountersStat{ + Name: k, + BytesRecv: rbytes64arr[k], + PacketsRecv: ipackets64arr[k], + Errin: ierrorsarr[k], + Dropin: idrops64arr[k], + BytesSent: obytes64arr[k], + PacketsSent: opackets64arr[k], + Errout: oerrorsarr[k], + Dropout: odrops64arr[k], + } + ret = append(ret, nic) + } + + if !pernic { + return getIOCountersAll(ret) + } + + return ret, nil +} + +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return []FilterStat{}, common.ErrNotImplementedError +} + +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return []ProtoCountersStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_unix.go b/vendor/github.com/shirou/gopsutil/v3/net/net_unix.go new file mode 100644 index 00000000..cb846e28 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_unix.go @@ -0,0 +1,224 @@ +//go:build freebsd || darwin +// +build freebsd darwin + +package net + +import ( + "context" + "fmt" + "net" + "strconv" + "strings" + "syscall" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +// Return a list of network connections opened. +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, max) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +// Return a list of network connections opened by a process. +func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + var ret []ConnectionStat + + args := []string{"-i"} + switch strings.ToLower(kind) { + default: + fallthrough + case "": + fallthrough + case "all": + fallthrough + case "inet": + args = append(args, "tcp", "-i", "udp") + case "inet4": + args = append(args, "4") + case "inet6": + args = append(args, "6") + case "tcp": + args = append(args, "tcp") + case "tcp4": + args = append(args, "4tcp") + case "tcp6": + args = append(args, "6tcp") + case "udp": + args = append(args, "udp") + case "udp4": + args = append(args, "4udp") + case "udp6": + args = append(args, "6udp") + case "unix": + args = []string{"-U"} + } + + r, err := common.CallLsofWithContext(ctx, invoke, pid, args...) + if err != nil { + return nil, err + } + for _, rr := range r { + if strings.HasPrefix(rr, "COMMAND") { + continue + } + n, err := parseNetLine(rr) + if err != nil { + continue + } + + ret = append(ret, n) + } + + return ret, nil +} + +var constMap = map[string]int{ + "unix": syscall.AF_UNIX, + "TCP": syscall.SOCK_STREAM, + "UDP": syscall.SOCK_DGRAM, + "IPv4": syscall.AF_INET, + "IPv6": syscall.AF_INET6, +} + +func parseNetLine(line string) (ConnectionStat, error) { + f := strings.Fields(line) + if len(f) < 8 { + return ConnectionStat{}, fmt.Errorf("wrong line,%s", line) + } + + if len(f) == 8 { + f = append(f, f[7]) + f[7] = "unix" + } + + pid, err := strconv.Atoi(f[1]) + if err != nil { + return ConnectionStat{}, err + } + fd, err := strconv.Atoi(strings.Trim(f[3], "u")) + if err != nil { + return ConnectionStat{}, fmt.Errorf("unknown fd, %s", f[3]) + } + netFamily, ok := constMap[f[4]] + if !ok { + return ConnectionStat{}, fmt.Errorf("unknown family, %s", f[4]) + } + netType, ok := constMap[f[7]] + if !ok { + return ConnectionStat{}, fmt.Errorf("unknown type, %s", f[7]) + } + + var laddr, raddr Addr + if f[7] == "unix" { + laddr.IP = f[8] + } else { + laddr, raddr, err = parseNetAddr(f[8]) + if err != nil { + return ConnectionStat{}, fmt.Errorf("failed to parse netaddr, %s", f[8]) + } + } + + n := ConnectionStat{ + Fd: uint32(fd), + Family: uint32(netFamily), + Type: uint32(netType), + Laddr: laddr, + Raddr: raddr, + Pid: int32(pid), + } + if len(f) == 10 { + n.Status = strings.Trim(f[9], "()") + } + + return n, nil +} + +func parseNetAddr(line string) (laddr Addr, raddr Addr, err error) { + parse := func(l string) (Addr, error) { + host, port, err := net.SplitHostPort(l) + if err != nil { + return Addr{}, fmt.Errorf("wrong addr, %s", l) + } + lport, err := strconv.Atoi(port) + if err != nil { + return Addr{}, err + } + return Addr{IP: host, Port: uint32(lport)}, nil + } + + addrs := strings.Split(line, "->") + if len(addrs) == 0 { + return laddr, raddr, fmt.Errorf("wrong netaddr, %s", line) + } + laddr, err = parse(addrs[0]) + if len(addrs) == 2 { // remote addr exists + raddr, err = parse(addrs[1]) + if err != nil { + return laddr, raddr, err + } + } + + return laddr, raddr, err +} + +// Return up to `max` network connections opened by a process. +func ConnectionsPidMax(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max) +} + +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/net/net_windows.go b/vendor/github.com/shirou/gopsutil/v3/net/net_windows.go new file mode 100644 index 00000000..5d384342 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/net/net_windows.go @@ -0,0 +1,779 @@ +//go:build windows +// +build windows + +package net + +import ( + "context" + "fmt" + "net" + "os" + "syscall" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/windows" +) + +var ( + modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll") + procGetExtendedTCPTable = modiphlpapi.NewProc("GetExtendedTcpTable") + procGetExtendedUDPTable = modiphlpapi.NewProc("GetExtendedUdpTable") + procGetIfEntry2 = modiphlpapi.NewProc("GetIfEntry2") +) + +const ( + TCPTableBasicListener = iota + TCPTableBasicConnections + TCPTableBasicAll + TCPTableOwnerPIDListener + TCPTableOwnerPIDConnections + TCPTableOwnerPIDAll + TCPTableOwnerModuleListener + TCPTableOwnerModuleConnections + TCPTableOwnerModuleAll +) + +type netConnectionKindType struct { + family uint32 + sockType uint32 + filename string +} + +var kindTCP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_STREAM, + filename: "tcp", +} + +var kindTCP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_STREAM, + filename: "tcp6", +} + +var kindUDP4 = netConnectionKindType{ + family: syscall.AF_INET, + sockType: syscall.SOCK_DGRAM, + filename: "udp", +} + +var kindUDP6 = netConnectionKindType{ + family: syscall.AF_INET6, + sockType: syscall.SOCK_DGRAM, + filename: "udp6", +} + +var netConnectionKindMap = map[string][]netConnectionKindType{ + "all": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "tcp": {kindTCP4, kindTCP6}, + "tcp4": {kindTCP4}, + "tcp6": {kindTCP6}, + "udp": {kindUDP4, kindUDP6}, + "udp4": {kindUDP4}, + "udp6": {kindUDP6}, + "inet": {kindTCP4, kindTCP6, kindUDP4, kindUDP6}, + "inet4": {kindTCP4, kindUDP4}, + "inet6": {kindTCP6, kindUDP6}, +} + +// https://github.com/microsoft/ethr/blob/aecdaf923970e5a9b4c461b4e2e3963d781ad2cc/plt_windows.go#L114-L170 +type guid struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4 [8]byte +} + +const ( + maxStringSize = 256 + maxPhysAddressLength = 32 + pad0for64_4for32 = 0 +) + +type mibIfRow2 struct { + InterfaceLuid uint64 + InterfaceIndex uint32 + InterfaceGuid guid + Alias [maxStringSize + 1]uint16 + Description [maxStringSize + 1]uint16 + PhysicalAddressLength uint32 + PhysicalAddress [maxPhysAddressLength]uint8 + PermanentPhysicalAddress [maxPhysAddressLength]uint8 + Mtu uint32 + Type uint32 + TunnelType uint32 + MediaType uint32 + PhysicalMediumType uint32 + AccessType uint32 + DirectionType uint32 + InterfaceAndOperStatusFlags uint32 + OperStatus uint32 + AdminStatus uint32 + MediaConnectState uint32 + NetworkGuid guid + ConnectionType uint32 + padding1 [pad0for64_4for32]byte + TransmitLinkSpeed uint64 + ReceiveLinkSpeed uint64 + InOctets uint64 + InUcastPkts uint64 + InNUcastPkts uint64 + InDiscards uint64 + InErrors uint64 + InUnknownProtos uint64 + InUcastOctets uint64 + InMulticastOctets uint64 + InBroadcastOctets uint64 + OutOctets uint64 + OutUcastPkts uint64 + OutNUcastPkts uint64 + OutDiscards uint64 + OutErrors uint64 + OutUcastOctets uint64 + OutMulticastOctets uint64 + OutBroadcastOctets uint64 + OutQLen uint64 +} + +func IOCounters(pernic bool) ([]IOCountersStat, error) { + return IOCountersWithContext(context.Background(), pernic) +} + +func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { + ifs, err := net.Interfaces() + if err != nil { + return nil, err + } + var counters []IOCountersStat + + err = procGetIfEntry2.Find() + if err == nil { // Vista+, uint64 values (issue#693) + for _, ifi := range ifs { + c := IOCountersStat{ + Name: ifi.Name, + } + + row := mibIfRow2{InterfaceIndex: uint32(ifi.Index)} + ret, _, err := procGetIfEntry2.Call(uintptr(unsafe.Pointer(&row))) + if ret != 0 { + return nil, os.NewSyscallError("GetIfEntry2", err) + } + c.BytesSent = uint64(row.OutOctets) + c.BytesRecv = uint64(row.InOctets) + c.PacketsSent = uint64(row.OutUcastPkts) + c.PacketsRecv = uint64(row.InUcastPkts) + c.Errin = uint64(row.InErrors) + c.Errout = uint64(row.OutErrors) + c.Dropin = uint64(row.InDiscards) + c.Dropout = uint64(row.OutDiscards) + + counters = append(counters, c) + } + } else { // WinXP fallback, uint32 values + for _, ifi := range ifs { + c := IOCountersStat{ + Name: ifi.Name, + } + + row := windows.MibIfRow{Index: uint32(ifi.Index)} + err = windows.GetIfEntry(&row) + if err != nil { + return nil, os.NewSyscallError("GetIfEntry", err) + } + c.BytesSent = uint64(row.OutOctets) + c.BytesRecv = uint64(row.InOctets) + c.PacketsSent = uint64(row.OutUcastPkts) + c.PacketsRecv = uint64(row.InUcastPkts) + c.Errin = uint64(row.InErrors) + c.Errout = uint64(row.OutErrors) + c.Dropin = uint64(row.InDiscards) + c.Dropout = uint64(row.OutDiscards) + + counters = append(counters, c) + } + } + + if !pernic { + return getIOCountersAll(counters) + } + return counters, nil +} + +// IOCountersByFile exists just for compatibility with Linux. +func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) { + return IOCountersByFileWithContext(context.Background(), pernic, filename) +} + +func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { + return IOCounters(pernic) +} + +// Return a list of network connections +// Available kind: +// +// reference to netConnectionKindMap +func Connections(kind string) ([]ConnectionStat, error) { + return ConnectionsWithContext(context.Background(), kind) +} + +func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(ctx, kind, 0) +} + +// ConnectionsPid Return a list of network connections opened by a process +func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + tmap, ok := netConnectionKindMap[kind] + if !ok { + return nil, fmt.Errorf("invalid kind, %s", kind) + } + return getProcInet(tmap, pid) +} + +func getProcInet(kinds []netConnectionKindType, pid int32) ([]ConnectionStat, error) { + stats := make([]ConnectionStat, 0) + + for _, kind := range kinds { + s, err := getNetStatWithKind(kind) + if err != nil { + continue + } + + if pid == 0 { + stats = append(stats, s...) + } else { + for _, ns := range s { + if ns.Pid != pid { + continue + } + stats = append(stats, ns) + } + } + } + + return stats, nil +} + +func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionStat, error) { + if kindType.filename == "" { + return nil, fmt.Errorf("kind filename must be required") + } + + switch kindType.filename { + case kindTCP4.filename: + return getTCPConnections(kindTCP4.family) + case kindTCP6.filename: + return getTCPConnections(kindTCP6.family) + case kindUDP4.filename: + return getUDPConnections(kindUDP4.family) + case kindUDP6.filename: + return getUDPConnections(kindUDP6.family) + } + + return nil, fmt.Errorf("invalid kind filename, %s", kindType.filename) +} + +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return ConnectionsMaxWithContext(context.Background(), kind, max) +} + +func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +// Return a list of network connections opened, omitting `Uids`. +// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be +// removed from the API in the future. +func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) { + return ConnectionsWithoutUidsWithContext(context.Background(), kind) +} + +func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { + return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0) +} + +func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max) +} + +func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid) +} + +func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0) +} + +func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) { + return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max) +} + +func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max) +} + +func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + +func FilterCounters() ([]FilterStat, error) { + return FilterCountersWithContext(context.Background()) +} + +func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { + return nil, common.ErrNotImplementedError +} + +func ConntrackStats(percpu bool) ([]ConntrackStat, error) { + return ConntrackStatsWithContext(context.Background(), percpu) +} + +func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { + return nil, common.ErrNotImplementedError +} + +// ProtoCounters returns network statistics for the entire system +// If protocols is empty then all protocols are returned, otherwise +// just the protocols in the list are returned. +// Not Implemented for Windows +func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { + return ProtoCountersWithContext(context.Background(), protocols) +} + +func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func getTableUintptr(family uint32, buf []byte) uintptr { + var ( + pmibTCPTable pmibTCPTableOwnerPidAll + pmibTCP6Table pmibTCP6TableOwnerPidAll + + p uintptr + ) + switch family { + case kindTCP4.family: + if len(buf) > 0 { + pmibTCPTable = (*mibTCPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } + case kindTCP6.family: + if len(buf) > 0 { + pmibTCP6Table = (*mibTCP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } + } + return p +} + +func getTableInfo(filename string, table interface{}) (index, step, length int) { + switch filename { + case kindTCP4.filename: + index = int(unsafe.Sizeof(table.(pmibTCPTableOwnerPidAll).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibTCPTableOwnerPidAll).Table)) + length = int(table.(pmibTCPTableOwnerPidAll).DwNumEntries) + case kindTCP6.filename: + index = int(unsafe.Sizeof(table.(pmibTCP6TableOwnerPidAll).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibTCP6TableOwnerPidAll).Table)) + length = int(table.(pmibTCP6TableOwnerPidAll).DwNumEntries) + case kindUDP4.filename: + index = int(unsafe.Sizeof(table.(pmibUDPTableOwnerPid).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibUDPTableOwnerPid).Table)) + length = int(table.(pmibUDPTableOwnerPid).DwNumEntries) + case kindUDP6.filename: + index = int(unsafe.Sizeof(table.(pmibUDP6TableOwnerPid).DwNumEntries)) + step = int(unsafe.Sizeof(table.(pmibUDP6TableOwnerPid).Table)) + length = int(table.(pmibUDP6TableOwnerPid).DwNumEntries) + } + + return +} + +func getTCPConnections(family uint32) ([]ConnectionStat, error) { + var ( + p uintptr + buf []byte + size uint32 + + pmibTCPTable pmibTCPTableOwnerPidAll + pmibTCP6Table pmibTCP6TableOwnerPidAll + ) + + if family == 0 { + return nil, fmt.Errorf("faimly must be required") + } + + for { + switch family { + case kindTCP4.family: + if len(buf) > 0 { + pmibTCPTable = (*mibTCPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibTCPTable)) + } + case kindTCP6.family: + if len(buf) > 0 { + pmibTCP6Table = (*mibTCP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibTCP6Table)) + } + } + + err := getExtendedTcpTable(p, + &size, + true, + family, + tcpTableOwnerPidAll, + 0) + if err == nil { + break + } + if err != windows.ERROR_INSUFFICIENT_BUFFER { + return nil, err + } + buf = make([]byte, size) + } + + var ( + index, step int + length int + ) + + stats := make([]ConnectionStat, 0) + switch family { + case kindTCP4.family: + index, step, length = getTableInfo(kindTCP4.filename, pmibTCPTable) + case kindTCP6.family: + index, step, length = getTableInfo(kindTCP6.filename, pmibTCP6Table) + } + + if length == 0 { + return nil, nil + } + + for i := 0; i < length; i++ { + switch family { + case kindTCP4.family: + mibs := (*mibTCPRowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + case kindTCP6.family: + mibs := (*mibTCP6RowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + } + + index += step + } + return stats, nil +} + +func getUDPConnections(family uint32) ([]ConnectionStat, error) { + var ( + p uintptr + buf []byte + size uint32 + + pmibUDPTable pmibUDPTableOwnerPid + pmibUDP6Table pmibUDP6TableOwnerPid + ) + + if family == 0 { + return nil, fmt.Errorf("faimly must be required") + } + + for { + switch family { + case kindUDP4.family: + if len(buf) > 0 { + pmibUDPTable = (*mibUDPTableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibUDPTable)) + } else { + p = uintptr(unsafe.Pointer(pmibUDPTable)) + } + case kindUDP6.family: + if len(buf) > 0 { + pmibUDP6Table = (*mibUDP6TableOwnerPid)(unsafe.Pointer(&buf[0])) + p = uintptr(unsafe.Pointer(pmibUDP6Table)) + } else { + p = uintptr(unsafe.Pointer(pmibUDP6Table)) + } + } + + err := getExtendedUdpTable( + p, + &size, + true, + family, + udpTableOwnerPid, + 0, + ) + if err == nil { + break + } + if err != windows.ERROR_INSUFFICIENT_BUFFER { + return nil, err + } + buf = make([]byte, size) + } + + var index, step, length int + + stats := make([]ConnectionStat, 0) + switch family { + case kindUDP4.family: + index, step, length = getTableInfo(kindUDP4.filename, pmibUDPTable) + case kindUDP6.family: + index, step, length = getTableInfo(kindUDP6.filename, pmibUDP6Table) + } + + if length == 0 { + return nil, nil + } + + for i := 0; i < length; i++ { + switch family { + case kindUDP4.family: + mibs := (*mibUDPRowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + case kindUDP6.family: + mibs := (*mibUDP6RowOwnerPid)(unsafe.Pointer(&buf[index])) + ns := mibs.convertToConnectionStat() + stats = append(stats, ns) + } + + index += step + } + return stats, nil +} + +// tcpStatuses https://msdn.microsoft.com/en-us/library/windows/desktop/bb485761(v=vs.85).aspx +var tcpStatuses = map[mibTCPState]string{ + 1: "CLOSED", + 2: "LISTEN", + 3: "SYN_SENT", + 4: "SYN_RECEIVED", + 5: "ESTABLISHED", + 6: "FIN_WAIT_1", + 7: "FIN_WAIT_2", + 8: "CLOSE_WAIT", + 9: "CLOSING", + 10: "LAST_ACK", + 11: "TIME_WAIT", + 12: "DELETE", +} + +func getExtendedTcpTable(pTcpTable uintptr, pdwSize *uint32, bOrder bool, ulAf uint32, tableClass tcpTableClass, reserved uint32) (errcode error) { + r1, _, _ := syscall.Syscall6(procGetExtendedTCPTable.Addr(), 6, pTcpTable, uintptr(unsafe.Pointer(pdwSize)), getUintptrFromBool(bOrder), uintptr(ulAf), uintptr(tableClass), uintptr(reserved)) + if r1 != 0 { + errcode = syscall.Errno(r1) + } + return +} + +func getExtendedUdpTable(pUdpTable uintptr, pdwSize *uint32, bOrder bool, ulAf uint32, tableClass udpTableClass, reserved uint32) (errcode error) { + r1, _, _ := syscall.Syscall6(procGetExtendedUDPTable.Addr(), 6, pUdpTable, uintptr(unsafe.Pointer(pdwSize)), getUintptrFromBool(bOrder), uintptr(ulAf), uintptr(tableClass), uintptr(reserved)) + if r1 != 0 { + errcode = syscall.Errno(r1) + } + return +} + +func getUintptrFromBool(b bool) uintptr { + if b { + return 1 + } + return 0 +} + +const anySize = 1 + +// type MIB_TCP_STATE int32 +type mibTCPState int32 + +type tcpTableClass int32 + +const ( + tcpTableBasicListener tcpTableClass = iota + tcpTableBasicConnections + tcpTableBasicAll + tcpTableOwnerPidListener + tcpTableOwnerPidConnections + tcpTableOwnerPidAll + tcpTableOwnerModuleListener + tcpTableOwnerModuleConnections + tcpTableOwnerModuleAll +) + +type udpTableClass int32 + +const ( + udpTableBasic udpTableClass = iota + udpTableOwnerPid + udpTableOwnerModule +) + +// TCP + +type mibTCPRowOwnerPid struct { + DwState uint32 + DwLocalAddr uint32 + DwLocalPort uint32 + DwRemoteAddr uint32 + DwRemotePort uint32 + DwOwningPid uint32 +} + +func (m *mibTCPRowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindTCP4.family, + Type: kindTCP4.sockType, + Laddr: Addr{ + IP: parseIPv4HexString(m.DwLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Raddr: Addr{ + IP: parseIPv4HexString(m.DwRemoteAddr), + Port: uint32(decodePort(m.DwRemotePort)), + }, + Pid: int32(m.DwOwningPid), + Status: tcpStatuses[mibTCPState(m.DwState)], + } + + return ns +} + +type mibTCPTableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibTCPRowOwnerPid +} + +type mibTCP6RowOwnerPid struct { + UcLocalAddr [16]byte + DwLocalScopeId uint32 + DwLocalPort uint32 + UcRemoteAddr [16]byte + DwRemoteScopeId uint32 + DwRemotePort uint32 + DwState uint32 + DwOwningPid uint32 +} + +func (m *mibTCP6RowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindTCP6.family, + Type: kindTCP6.sockType, + Laddr: Addr{ + IP: parseIPv6HexString(m.UcLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Raddr: Addr{ + IP: parseIPv6HexString(m.UcRemoteAddr), + Port: uint32(decodePort(m.DwRemotePort)), + }, + Pid: int32(m.DwOwningPid), + Status: tcpStatuses[mibTCPState(m.DwState)], + } + + return ns +} + +type mibTCP6TableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibTCP6RowOwnerPid +} + +type ( + pmibTCPTableOwnerPidAll *mibTCPTableOwnerPid + pmibTCP6TableOwnerPidAll *mibTCP6TableOwnerPid +) + +// UDP + +type mibUDPRowOwnerPid struct { + DwLocalAddr uint32 + DwLocalPort uint32 + DwOwningPid uint32 +} + +func (m *mibUDPRowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindUDP4.family, + Type: kindUDP4.sockType, + Laddr: Addr{ + IP: parseIPv4HexString(m.DwLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Pid: int32(m.DwOwningPid), + } + + return ns +} + +type mibUDPTableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibUDPRowOwnerPid +} + +type mibUDP6RowOwnerPid struct { + UcLocalAddr [16]byte + DwLocalScopeId uint32 + DwLocalPort uint32 + DwOwningPid uint32 +} + +func (m *mibUDP6RowOwnerPid) convertToConnectionStat() ConnectionStat { + ns := ConnectionStat{ + Family: kindUDP6.family, + Type: kindUDP6.sockType, + Laddr: Addr{ + IP: parseIPv6HexString(m.UcLocalAddr), + Port: uint32(decodePort(m.DwLocalPort)), + }, + Pid: int32(m.DwOwningPid), + } + + return ns +} + +type mibUDP6TableOwnerPid struct { + DwNumEntries uint32 + Table [anySize]mibUDP6RowOwnerPid +} + +type ( + pmibUDPTableOwnerPid *mibUDPTableOwnerPid + pmibUDP6TableOwnerPid *mibUDP6TableOwnerPid +) + +func decodePort(port uint32) uint16 { + return syscall.Ntohs(uint16(port)) +} + +func parseIPv4HexString(addr uint32) string { + return fmt.Sprintf("%d.%d.%d.%d", addr&255, addr>>8&255, addr>>16&255, addr>>24&255) +} + +func parseIPv6HexString(addr [16]byte) string { + var ret [16]byte + for i := 0; i < 16; i++ { + ret[i] = uint8(addr[i]) + } + + // convert []byte to net.IP + ip := net.IP(ret[:]) + return ip.String() +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process.go b/vendor/github.com/shirou/gopsutil/v3/process/process.go new file mode 100644 index 00000000..1a7fe1b8 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process.go @@ -0,0 +1,620 @@ +package process + +import ( + "context" + "encoding/json" + "errors" + "runtime" + "sort" + "sync" + "time" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/mem" + "github.com/shirou/gopsutil/v3/net" +) + +var ( + invoke common.Invoker = common.Invoke{} + ErrorNoChildren = errors.New("process does not have children") + ErrorProcessNotRunning = errors.New("process does not exist") + ErrorNotPermitted = errors.New("operation not permitted") +) + +type Process struct { + Pid int32 `json:"pid"` + name string + status string + parent int32 + parentMutex sync.RWMutex // for windows ppid cache + numCtxSwitches *NumCtxSwitchesStat + uids []int32 + gids []int32 + groups []int32 + numThreads int32 + memInfo *MemoryInfoStat + sigInfo *SignalInfoStat + createTime int64 + + lastCPUTimes *cpu.TimesStat + lastCPUTime time.Time + + tgid int32 +} + +// Process status +const ( + // Running marks a task a running or runnable (on the run queue) + Running = "running" + // Blocked marks a task waiting on a short, uninterruptible operation (usually I/O) + Blocked = "blocked" + // Idle marks a task sleeping for more than about 20 seconds + Idle = "idle" + // Lock marks a task waiting to acquire a lock + Lock = "lock" + // Sleep marks task waiting for short, interruptible operation + Sleep = "sleep" + // Stop marks a stopped process + Stop = "stop" + // Wait marks an idle interrupt thread (or paging in pre 2.6.xx Linux) + Wait = "wait" + // Zombie marks a defunct process, terminated but not reaped by its parent + Zombie = "zombie" + + // Solaris states. See https://github.com/collectd/collectd/blob/1da3305c10c8ff9a63081284cf3d4bb0f6daffd8/src/processes.c#L2115 + Daemon = "daemon" + Detached = "detached" + System = "system" + Orphan = "orphan" + + UnknownState = "" +) + +type OpenFilesStat struct { + Path string `json:"path"` + Fd uint64 `json:"fd"` +} + +type MemoryInfoStat struct { + RSS uint64 `json:"rss"` // bytes + VMS uint64 `json:"vms"` // bytes + HWM uint64 `json:"hwm"` // bytes + Data uint64 `json:"data"` // bytes + Stack uint64 `json:"stack"` // bytes + Locked uint64 `json:"locked"` // bytes + Swap uint64 `json:"swap"` // bytes +} + +type SignalInfoStat struct { + PendingProcess uint64 `json:"pending_process"` + PendingThread uint64 `json:"pending_thread"` + Blocked uint64 `json:"blocked"` + Ignored uint64 `json:"ignored"` + Caught uint64 `json:"caught"` +} + +type RlimitStat struct { + Resource int32 `json:"resource"` + Soft uint64 `json:"soft"` + Hard uint64 `json:"hard"` + Used uint64 `json:"used"` +} + +type IOCountersStat struct { + ReadCount uint64 `json:"readCount"` + WriteCount uint64 `json:"writeCount"` + ReadBytes uint64 `json:"readBytes"` + WriteBytes uint64 `json:"writeBytes"` +} + +type NumCtxSwitchesStat struct { + Voluntary int64 `json:"voluntary"` + Involuntary int64 `json:"involuntary"` +} + +type PageFaultsStat struct { + MinorFaults uint64 `json:"minorFaults"` + MajorFaults uint64 `json:"majorFaults"` + ChildMinorFaults uint64 `json:"childMinorFaults"` + ChildMajorFaults uint64 `json:"childMajorFaults"` +} + +// Resource limit constants are from /usr/include/x86_64-linux-gnu/bits/resource.h +// from libc6-dev package in Ubuntu 16.10 +const ( + RLIMIT_CPU int32 = 0 + RLIMIT_FSIZE int32 = 1 + RLIMIT_DATA int32 = 2 + RLIMIT_STACK int32 = 3 + RLIMIT_CORE int32 = 4 + RLIMIT_RSS int32 = 5 + RLIMIT_NPROC int32 = 6 + RLIMIT_NOFILE int32 = 7 + RLIMIT_MEMLOCK int32 = 8 + RLIMIT_AS int32 = 9 + RLIMIT_LOCKS int32 = 10 + RLIMIT_SIGPENDING int32 = 11 + RLIMIT_MSGQUEUE int32 = 12 + RLIMIT_NICE int32 = 13 + RLIMIT_RTPRIO int32 = 14 + RLIMIT_RTTIME int32 = 15 +) + +func (p Process) String() string { + s, _ := json.Marshal(p) + return string(s) +} + +func (o OpenFilesStat) String() string { + s, _ := json.Marshal(o) + return string(s) +} + +func (m MemoryInfoStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (r RlimitStat) String() string { + s, _ := json.Marshal(r) + return string(s) +} + +func (i IOCountersStat) String() string { + s, _ := json.Marshal(i) + return string(s) +} + +func (p NumCtxSwitchesStat) String() string { + s, _ := json.Marshal(p) + return string(s) +} + +// Pids returns a slice of process ID list which are running now. +func Pids() ([]int32, error) { + return PidsWithContext(context.Background()) +} + +func PidsWithContext(ctx context.Context) ([]int32, error) { + pids, err := pidsWithContext(ctx) + sort.Slice(pids, func(i, j int) bool { return pids[i] < pids[j] }) + return pids, err +} + +// Processes returns a slice of pointers to Process structs for all +// currently running processes. +func Processes() ([]*Process, error) { + return ProcessesWithContext(context.Background()) +} + +// NewProcess creates a new Process instance, it only stores the pid and +// checks that the process exists. Other method on Process can be used +// to get more information about the process. An error will be returned +// if the process does not exist. +func NewProcess(pid int32) (*Process, error) { + return NewProcessWithContext(context.Background(), pid) +} + +func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) { + p := &Process{ + Pid: pid, + } + + exists, err := PidExistsWithContext(ctx, pid) + if err != nil { + return p, err + } + if !exists { + return p, ErrorProcessNotRunning + } + p.CreateTimeWithContext(ctx) + return p, nil +} + +func PidExists(pid int32) (bool, error) { + return PidExistsWithContext(context.Background(), pid) +} + +// Background returns true if the process is in background, false otherwise. +func (p *Process) Background() (bool, error) { + return p.BackgroundWithContext(context.Background()) +} + +func (p *Process) BackgroundWithContext(ctx context.Context) (bool, error) { + fg, err := p.ForegroundWithContext(ctx) + if err != nil { + return false, err + } + return !fg, err +} + +// If interval is 0, return difference from last call(non-blocking). +// If interval > 0, wait interval sec and return difference between start and end. +func (p *Process) Percent(interval time.Duration) (float64, error) { + return p.PercentWithContext(context.Background(), interval) +} + +func (p *Process) PercentWithContext(ctx context.Context, interval time.Duration) (float64, error) { + cpuTimes, err := p.TimesWithContext(ctx) + if err != nil { + return 0, err + } + now := time.Now() + + if interval > 0 { + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + if err := common.Sleep(ctx, interval); err != nil { + return 0, err + } + cpuTimes, err = p.TimesWithContext(ctx) + now = time.Now() + if err != nil { + return 0, err + } + } else { + if p.lastCPUTimes == nil { + // invoked first time + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + return 0, nil + } + } + + numcpu := runtime.NumCPU() + delta := (now.Sub(p.lastCPUTime).Seconds()) * float64(numcpu) + ret := calculatePercent(p.lastCPUTimes, cpuTimes, delta, numcpu) + p.lastCPUTimes = cpuTimes + p.lastCPUTime = now + return ret, nil +} + +// IsRunning returns whether the process is still running or not. +func (p *Process) IsRunning() (bool, error) { + return p.IsRunningWithContext(context.Background()) +} + +func (p *Process) IsRunningWithContext(ctx context.Context) (bool, error) { + createTime, err := p.CreateTimeWithContext(ctx) + if err != nil { + return false, err + } + p2, err := NewProcessWithContext(ctx, p.Pid) + if errors.Is(err, ErrorProcessNotRunning) { + return false, nil + } + createTime2, err := p2.CreateTimeWithContext(ctx) + if err != nil { + return false, err + } + return createTime == createTime2, nil +} + +// CreateTime returns created time of the process in milliseconds since the epoch, in UTC. +func (p *Process) CreateTime() (int64, error) { + return p.CreateTimeWithContext(context.Background()) +} + +func (p *Process) CreateTimeWithContext(ctx context.Context) (int64, error) { + if p.createTime != 0 { + return p.createTime, nil + } + createTime, err := p.createTimeWithContext(ctx) + p.createTime = createTime + return p.createTime, err +} + +func calculatePercent(t1, t2 *cpu.TimesStat, delta float64, numcpu int) float64 { + if delta == 0 { + return 0 + } + delta_proc := t2.Total() - t1.Total() + overall_percent := ((delta_proc / delta) * 100) * float64(numcpu) + return overall_percent +} + +// MemoryPercent returns how many percent of the total RAM this process uses +func (p *Process) MemoryPercent() (float32, error) { + return p.MemoryPercentWithContext(context.Background()) +} + +func (p *Process) MemoryPercentWithContext(ctx context.Context) (float32, error) { + machineMemory, err := mem.VirtualMemoryWithContext(ctx) + if err != nil { + return 0, err + } + total := machineMemory.Total + + processMemory, err := p.MemoryInfoWithContext(ctx) + if err != nil { + return 0, err + } + used := processMemory.RSS + + return (100 * float32(used) / float32(total)), nil +} + +// CPUPercent returns how many percent of the CPU time this process uses +func (p *Process) CPUPercent() (float64, error) { + return p.CPUPercentWithContext(context.Background()) +} + +func (p *Process) CPUPercentWithContext(ctx context.Context) (float64, error) { + crt_time, err := p.createTimeWithContext(ctx) + if err != nil { + return 0, err + } + + cput, err := p.TimesWithContext(ctx) + if err != nil { + return 0, err + } + + created := time.Unix(0, crt_time*int64(time.Millisecond)) + totalTime := time.Since(created).Seconds() + if totalTime <= 0 { + return 0, nil + } + + return 100 * cput.Total() / totalTime, nil +} + +// Groups returns all group IDs(include supplementary groups) of the process as a slice of the int +func (p *Process) Groups() ([]int32, error) { + return p.GroupsWithContext(context.Background()) +} + +// Ppid returns Parent Process ID of the process. +func (p *Process) Ppid() (int32, error) { + return p.PpidWithContext(context.Background()) +} + +// Name returns name of the process. +func (p *Process) Name() (string, error) { + return p.NameWithContext(context.Background()) +} + +// Exe returns executable path of the process. +func (p *Process) Exe() (string, error) { + return p.ExeWithContext(context.Background()) +} + +// Cmdline returns the command line arguments of the process as a string with +// each argument separated by 0x20 ascii character. +func (p *Process) Cmdline() (string, error) { + return p.CmdlineWithContext(context.Background()) +} + +// CmdlineSlice returns the command line arguments of the process as a slice with each +// element being an argument. +func (p *Process) CmdlineSlice() ([]string, error) { + return p.CmdlineSliceWithContext(context.Background()) +} + +// Cwd returns current working directory of the process. +func (p *Process) Cwd() (string, error) { + return p.CwdWithContext(context.Background()) +} + +// Parent returns parent Process of the process. +func (p *Process) Parent() (*Process, error) { + return p.ParentWithContext(context.Background()) +} + +// ParentWithContext returns parent Process of the process. +func (p *Process) ParentWithContext(ctx context.Context) (*Process, error) { + ppid, err := p.PpidWithContext(ctx) + if err != nil { + return nil, err + } + return NewProcessWithContext(ctx, ppid) +} + +// Status returns the process status. +// Return value could be one of these. +// R: Running S: Sleep T: Stop I: Idle +// Z: Zombie W: Wait L: Lock +// The character is same within all supported platforms. +func (p *Process) Status() ([]string, error) { + return p.StatusWithContext(context.Background()) +} + +// Foreground returns true if the process is in foreground, false otherwise. +func (p *Process) Foreground() (bool, error) { + return p.ForegroundWithContext(context.Background()) +} + +// Uids returns user ids of the process as a slice of the int +func (p *Process) Uids() ([]int32, error) { + return p.UidsWithContext(context.Background()) +} + +// Gids returns group ids of the process as a slice of the int +func (p *Process) Gids() ([]int32, error) { + return p.GidsWithContext(context.Background()) +} + +// Terminal returns a terminal which is associated with the process. +func (p *Process) Terminal() (string, error) { + return p.TerminalWithContext(context.Background()) +} + +// Nice returns a nice value (priority). +func (p *Process) Nice() (int32, error) { + return p.NiceWithContext(context.Background()) +} + +// IOnice returns process I/O nice value (priority). +func (p *Process) IOnice() (int32, error) { + return p.IOniceWithContext(context.Background()) +} + +// Rlimit returns Resource Limits. +func (p *Process) Rlimit() ([]RlimitStat, error) { + return p.RlimitWithContext(context.Background()) +} + +// RlimitUsage returns Resource Limits. +// If gatherUsed is true, the currently used value will be gathered and added +// to the resulting RlimitStat. +func (p *Process) RlimitUsage(gatherUsed bool) ([]RlimitStat, error) { + return p.RlimitUsageWithContext(context.Background(), gatherUsed) +} + +// IOCounters returns IO Counters. +func (p *Process) IOCounters() (*IOCountersStat, error) { + return p.IOCountersWithContext(context.Background()) +} + +// NumCtxSwitches returns the number of the context switches of the process. +func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) { + return p.NumCtxSwitchesWithContext(context.Background()) +} + +// NumFDs returns the number of File Descriptors used by the process. +func (p *Process) NumFDs() (int32, error) { + return p.NumFDsWithContext(context.Background()) +} + +// NumThreads returns the number of threads used by the process. +func (p *Process) NumThreads() (int32, error) { + return p.NumThreadsWithContext(context.Background()) +} + +func (p *Process) Threads() (map[int32]*cpu.TimesStat, error) { + return p.ThreadsWithContext(context.Background()) +} + +// Times returns CPU times of the process. +func (p *Process) Times() (*cpu.TimesStat, error) { + return p.TimesWithContext(context.Background()) +} + +// CPUAffinity returns CPU affinity of the process. +func (p *Process) CPUAffinity() ([]int32, error) { + return p.CPUAffinityWithContext(context.Background()) +} + +// MemoryInfo returns generic process memory information, +// such as RSS and VMS. +func (p *Process) MemoryInfo() (*MemoryInfoStat, error) { + return p.MemoryInfoWithContext(context.Background()) +} + +// MemoryInfoEx returns platform-specific process memory information. +func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) { + return p.MemoryInfoExWithContext(context.Background()) +} + +// PageFaults returns the process's page fault counters. +func (p *Process) PageFaults() (*PageFaultsStat, error) { + return p.PageFaultsWithContext(context.Background()) +} + +// Children returns the children of the process represented as a slice +// of pointers to Process type. +func (p *Process) Children() ([]*Process, error) { + return p.ChildrenWithContext(context.Background()) +} + +// OpenFiles returns a slice of OpenFilesStat opend by the process. +// OpenFilesStat includes a file path and file descriptor. +func (p *Process) OpenFiles() ([]OpenFilesStat, error) { + return p.OpenFilesWithContext(context.Background()) +} + +// Connections returns a slice of net.ConnectionStat used by the process. +// This returns all kind of the connection. This means TCP, UDP or UNIX. +func (p *Process) Connections() ([]net.ConnectionStat, error) { + return p.ConnectionsWithContext(context.Background()) +} + +// ConnectionsMax returns a slice of net.ConnectionStat used by the process at most `max`. +func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) { + return p.ConnectionsMaxWithContext(context.Background(), max) +} + +// MemoryMaps get memory maps from /proc/(pid)/smaps +func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) { + return p.MemoryMapsWithContext(context.Background(), grouped) +} + +// Tgid returns thread group id of the process. +func (p *Process) Tgid() (int32, error) { + return p.TgidWithContext(context.Background()) +} + +// SendSignal sends a unix.Signal to the process. +func (p *Process) SendSignal(sig Signal) error { + return p.SendSignalWithContext(context.Background(), sig) +} + +// Suspend sends SIGSTOP to the process. +func (p *Process) Suspend() error { + return p.SuspendWithContext(context.Background()) +} + +// Resume sends SIGCONT to the process. +func (p *Process) Resume() error { + return p.ResumeWithContext(context.Background()) +} + +// Terminate sends SIGTERM to the process. +func (p *Process) Terminate() error { + return p.TerminateWithContext(context.Background()) +} + +// Kill sends SIGKILL to the process. +func (p *Process) Kill() error { + return p.KillWithContext(context.Background()) +} + +// Username returns a username of the process. +func (p *Process) Username() (string, error) { + return p.UsernameWithContext(context.Background()) +} + +// Environ returns the environment variables of the process. +func (p *Process) Environ() ([]string, error) { + return p.EnvironWithContext(context.Background()) +} + +// convertStatusChar as reported by the ps command across different platforms. +func convertStatusChar(letter string) string { + // Sources + // Darwin: http://www.mywebuniversity.com/Man_Pages/Darwin/man_ps.html + // FreeBSD: https://www.freebsd.org/cgi/man.cgi?ps + // Linux https://man7.org/linux/man-pages/man1/ps.1.html + // OpenBSD: https://man.openbsd.org/ps.1#state + // Solaris: https://github.com/collectd/collectd/blob/1da3305c10c8ff9a63081284cf3d4bb0f6daffd8/src/processes.c#L2115 + switch letter { + case "A": + return Daemon + case "D", "U": + return Blocked + case "E": + return Detached + case "I": + return Idle + case "L": + return Lock + case "O": + return Orphan + case "R": + return Running + case "S": + return Sleep + case "T", "t": + // "t" is used by Linux to signal stopped by the debugger during tracing + return Stop + case "W": + return Wait + case "Y": + return System + case "Z": + return Zombie + default: + return UnknownState + } +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_bsd.go b/vendor/github.com/shirou/gopsutil/v3/process/process_bsd.go new file mode 100644 index 00000000..263829ff --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_bsd.go @@ -0,0 +1,76 @@ +//go:build darwin || freebsd || openbsd +// +build darwin freebsd openbsd + +package process + +import ( + "bytes" + "context" + "encoding/binary" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" +) + +type MemoryInfoExStat struct{} + +type MemoryMapsStat struct{} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func parseKinfoProc(buf []byte) (KinfoProc, error) { + var k KinfoProc + br := bytes.NewReader(buf) + err := common.Read(br, binary.LittleEndian, &k) + return k, err +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_darwin.go b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin.go new file mode 100644 index 00000000..176661cb --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin.go @@ -0,0 +1,325 @@ +//go:build darwin +// +build darwin + +package process + +import ( + "context" + "fmt" + "path/filepath" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" +) + +// copied from sys/sysctl.h +const ( + CTLKern = 1 // "high kernel": proc, limits + KernProc = 14 // struct: process entries + KernProcPID = 1 // by process id + KernProcProc = 8 // only return procs + KernProcAll = 0 // everything + KernProcPathname = 12 // path to executable +) + +var clockTicks = 100 // default value + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + clockTicks = int(clkTck) + } +} + +type _Ctype_struct___0 struct { + Pad uint64 +} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + + kprocs, err := unix.SysctlKinfoProcSlice("kern.proc.all") + if err != nil { + return ret, err + } + + for _, proc := range kprocs { + ret = append(ret, int32(proc.Proc.P_pid)) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Eproc.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + name := common.ByteToString(k.Proc.P_comm[:]) + + if len(name) >= 15 { + cmdName, err := p.cmdNameWithContext(ctx) + if err != nil { + return "", err + } + if len(cmdName) > 0 { + extendedName := filepath.Base(cmdName) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Proc.P_starttime.Sec*1000 + int64(k.Proc.P_starttime.Usec)/1000, nil +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + r, err := callPsWithContext(ctx, "state", p.Pid, false, false) + if err != nil { + return []string{""}, err + } + status := convertStatusChar(r[0][0][0:1]) + return []string{status}, err +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + // See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/ucred.h.html + userEffectiveUID := int32(k.Eproc.Ucred.Uid) + + return []int32{userEffectiveUID}, nil +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]int32, 0, 3) + gids = append(gids, int32(k.Eproc.Pcred.P_rgid), int32(k.Eproc.Pcred.P_rgid), int32(k.Eproc.Pcred.P_svgid)) + + return gids, nil +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError + // k, err := p.getKProc() + // if err != nil { + // return nil, err + // } + + // groups := make([]int32, k.Eproc.Ucred.Ngroups) + // for i := int16(0); i < k.Eproc.Ucred.Ngroups; i++ { + // groups[i] = int32(k.Eproc.Ucred.Groups[i]) + // } + + // return groups, nil +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError + /* + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Eproc.Tdev) + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil + */ +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Proc.P_nice), nil +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func convertCPUTimes(s string) (ret float64, err error) { + var t int + var _tmp string + if strings.Contains(s, ":") { + _t := strings.Split(s, ":") + switch len(_t) { + case 3: + hour, err := strconv.Atoi(_t[0]) + if err != nil { + return ret, err + } + t += hour * 60 * 60 * clockTicks + + mins, err := strconv.Atoi(_t[1]) + if err != nil { + return ret, err + } + t += mins * 60 * clockTicks + _tmp = _t[2] + case 2: + mins, err := strconv.Atoi(_t[0]) + if err != nil { + return ret, err + } + t += mins * 60 * clockTicks + _tmp = _t[1] + case 1, 0: + _tmp = s + default: + return ret, fmt.Errorf("wrong cpu time string") + } + } else { + _tmp = s + } + + _t := strings.Split(_tmp, ".") + if err != nil { + return ret, err + } + h, err := strconv.Atoi(_t[0]) + t += h * clockTicks + h, err = strconv.Atoi(_t[1]) + t += h + return float64(t) / float64(clockTicks), nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid) + if err != nil { + return nil, err + } + ret := make([]*Process, 0, len(pids)) + for _, pid := range pids { + np, err := NewProcessWithContext(ctx, pid) + if err != nil { + return nil, err + } + ret = append(ret, np) + } + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, max) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +// Returns a proc as defined here: +// http://unix.superglobalmegacorp.com/Net2/newsrc/sys/kinfo_proc.h.html +func (p *Process) getKProc() (*unix.KinfoProc, error) { + return unix.SysctlKinfoProc("kern.proc.pid", int(p.Pid)) +} + +// call ps command. +// Return value deletes Header line(you must not input wrong arg). +// And splited by Space. Caller have responsibility to manage. +// If passed arg pid is 0, get information from all process. +func callPsWithContext(ctx context.Context, arg string, pid int32, threadOption bool, nameOption bool) ([][]string, error) { + var cmd []string + if pid == 0 { // will get from all processes. + cmd = []string{"-ax", "-o", arg} + } else if threadOption { + cmd = []string{"-x", "-o", arg, "-M", "-p", strconv.Itoa(int(pid))} + } else { + cmd = []string{"-x", "-o", arg, "-p", strconv.Itoa(int(pid))} + } + if nameOption { + cmd = append(cmd, "-c") + } + out, err := invoke.CommandWithContext(ctx, "ps", cmd...) + if err != nil { + return [][]string{}, err + } + lines := strings.Split(string(out), "\n") + + var ret [][]string + for _, l := range lines[1:] { + var lr []string + if nameOption { + lr = append(lr, l) + } else { + for _, r := range strings.Split(l, " ") { + if r == "" { + continue + } + lr = append(lr, strings.TrimSpace(r)) + } + } + if len(lr) != 0 { + ret = append(ret, lr) + } + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_amd64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_amd64.go new file mode 100644 index 00000000..b353e5ea --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_amd64.go @@ -0,0 +1,236 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_darwin.go + +package process + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type UGid_t uint32 + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Eproc struct { + Paddr *uint64 + Sess *Session + Pcred Upcred + Ucred Uucred + Pad_cgo_0 [4]byte + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Pad_cgo_1 [2]byte + Tdev int32 + Tpgid int32 + Pad_cgo_2 [4]byte + Tsess *Session + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Pad_cgo_3 [2]byte + Flag int32 + Login [12]int8 + Spare [4]int32 + Pad_cgo_4 [4]byte +} + +type Proc struct{} + +type Session struct{} + +type ucred struct { + Link _Ctype_struct___0 + Ref uint64 + Posix Posix_cred + Label *Label + Audit Au_session +} + +type Uucred struct { + Ref int32 + UID uint32 + Ngroups int16 + Pad_cgo_0 [2]byte + Groups [16]uint32 +} + +type Upcred struct { + Pc_lock [72]int8 + Pc_ucred *ucred + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + Pad_cgo_0 [4]byte +} + +type Vmspace struct { + Dummy int32 + Pad_cgo_0 [4]byte + Dummy2 *int8 + Dummy3 [5]int32 + Pad_cgo_1 [4]byte + Dummy4 [3]*int8 +} + +type Sigacts struct{} + +type ExternProc struct { + P_un [16]byte + P_vmspace uint64 + P_sigacts uint64 + Pad_cgo_0 [3]byte + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + Pad_cgo_1 [4]byte + User_stack uint64 + Exit_thread uint64 + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + Pad_cgo_2 [4]byte + P_wchan uint64 + P_wmesg uint64 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + Pad_cgo_3 [4]byte + P_tracep uint64 + P_siglist int32 + Pad_cgo_4 [4]byte + P_textvp uint64 + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + Pad_cgo_5 [4]byte + P_pgrp uint64 + P_addr uint64 + P_xstat uint16 + P_acflag uint16 + Pad_cgo_6 [4]byte + P_ru uint64 +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type Vnode struct{} + +type Pgrp struct{} + +type UserStruct struct{} + +type Au_session struct { + Aia_p *AuditinfoAddr + Mask AuMask +} + +type Posix_cred struct { + UID uint32 + Ruid uint32 + Svuid uint32 + Ngroups int16 + Pad_cgo_0 [2]byte + Groups [16]uint32 + Rgid uint32 + Svgid uint32 + Gmuid uint32 + Flags int32 +} + +type Label struct{} + +type AuditinfoAddr struct { + Auid uint32 + Mask AuMask + Termid AuTidAddr + Asid int32 + Flags uint64 +} + +type AuMask struct { + Success uint32 + Failure uint32 +} + +type AuTidAddr struct { + Port int32 + Type uint32 + Addr [4]uint32 +} + +type UcredQueue struct { + Next *ucred + Prev **ucred +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_arm64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_arm64.go new file mode 100644 index 00000000..cbd6bdc7 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_arm64.go @@ -0,0 +1,213 @@ +//go:build darwin && arm64 +// +build darwin,arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_darwin.go + +package process + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type UGid_t uint32 + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Eproc struct { + Paddr *Proc + Sess *Session + Pcred Upcred + Ucred Uucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess *Session + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + Pad_cgo_0 [4]byte +} + +type Proc struct{} + +type Session struct{} + +type ucred struct{} + +type Uucred struct { + Ref int32 + UID uint32 + Ngroups int16 + Groups [16]uint32 +} + +type Upcred struct { + Pc_lock [72]int8 + Pc_ucred *ucred + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + Pad_cgo_0 [4]byte +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Sigacts struct{} + +type ExternProc struct { + P_un [16]byte + P_vmspace uint64 + P_sigacts uint64 + Pad_cgo_0 [3]byte + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + Pad_cgo_1 [4]byte + User_stack uint64 + Exit_thread uint64 + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + Pad_cgo_2 [4]byte + P_wchan uint64 + P_wmesg uint64 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + Pad_cgo_3 [4]byte + P_tracep uint64 + P_siglist int32 + Pad_cgo_4 [4]byte + P_textvp uint64 + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + Pad_cgo_5 [4]byte + P_pgrp uint64 + P_addr uint64 + P_xstat uint16 + P_acflag uint16 + Pad_cgo_6 [4]byte + P_ru uint64 +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type Vnode struct{} + +type Pgrp struct{} + +type UserStruct struct{} + +type Au_session struct { + Aia_p *AuditinfoAddr + Mask AuMask +} + +type Posix_cred struct{} + +type Label struct{} + +type AuditinfoAddr struct { + Auid uint32 + Mask AuMask + Termid AuTidAddr + Asid int32 + Flags uint64 +} +type AuMask struct { + Success uint32 + Failure uint32 +} +type AuTidAddr struct { + Port int32 + Type uint32 + Addr [4]uint32 +} + +type UcredQueue struct { + Next *ucred + Prev **ucred +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_cgo.go b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_cgo.go new file mode 100644 index 00000000..858f08e7 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_cgo.go @@ -0,0 +1,222 @@ +//go:build darwin && cgo +// +build darwin,cgo + +package process + +// #include +// #include +// #include +// #include +// #include +// #include +// #include +import "C" + +import ( + "bytes" + "context" + "fmt" + "strings" + "syscall" + "unsafe" + + "github.com/shirou/gopsutil/v3/cpu" +) + +var ( + argMax int + timescaleToNanoSeconds float64 +) + +func init() { + argMax = getArgMax() + timescaleToNanoSeconds = getTimeScaleToNanoSeconds() +} + +func getArgMax() int { + var ( + mib = [...]C.int{C.CTL_KERN, C.KERN_ARGMAX} + argmax C.int + size C.size_t = C.ulong(unsafe.Sizeof(argmax)) + ) + retval := C.sysctl(&mib[0], 2, unsafe.Pointer(&argmax), &size, C.NULL, 0) + if retval == 0 { + return int(argmax) + } + return 0 +} + +func getTimeScaleToNanoSeconds() float64 { + var timeBaseInfo C.struct_mach_timebase_info + + C.mach_timebase_info(&timeBaseInfo) + + return float64(timeBaseInfo.numer) / float64(timeBaseInfo.denom) +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + var c C.char // need a var for unsafe.Sizeof need a var + const bufsize = C.PROC_PIDPATHINFO_MAXSIZE * unsafe.Sizeof(c) + buffer := (*C.char)(C.malloc(C.size_t(bufsize))) + defer C.free(unsafe.Pointer(buffer)) + + ret, err := C.proc_pidpath(C.int(p.Pid), unsafe.Pointer(buffer), C.uint32_t(bufsize)) + if err != nil { + return "", err + } + if ret <= 0 { + return "", fmt.Errorf("unknown error: proc_pidpath returned %d", ret) + } + + return C.GoString(buffer), nil +} + +// CwdWithContext retrieves the Current Working Directory for the given process. +// It uses the proc_pidinfo from libproc and will only work for processes the +// EUID can access. Otherwise "operation not permitted" will be returned as the +// error. +// Note: This might also work for other *BSD OSs. +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + const vpiSize = C.sizeof_struct_proc_vnodepathinfo + vpi := (*C.struct_proc_vnodepathinfo)(C.malloc(vpiSize)) + defer C.free(unsafe.Pointer(vpi)) + ret, err := C.proc_pidinfo(C.int(p.Pid), C.PROC_PIDVNODEPATHINFO, 0, unsafe.Pointer(vpi), vpiSize) + if err != nil { + // fmt.Printf("ret: %d %T\n", ret, err) + if err == syscall.EPERM { + return "", ErrorNotPermitted + } + return "", err + } + if ret <= 0 { + return "", fmt.Errorf("unknown error: proc_pidinfo returned %d", ret) + } + if ret != C.sizeof_struct_proc_vnodepathinfo { + return "", fmt.Errorf("too few bytes; expected %d, got %d", vpiSize, ret) + } + return C.GoString(&vpi.pvi_cdir.vip_path[0]), err +} + +func procArgs(pid int32) ([]byte, int, error) { + var ( + mib = [...]C.int{C.CTL_KERN, C.KERN_PROCARGS2, C.int(pid)} + size C.size_t = C.ulong(argMax) + nargs C.int + result []byte + ) + procargs := (*C.char)(C.malloc(C.ulong(argMax))) + defer C.free(unsafe.Pointer(procargs)) + retval, err := C.sysctl(&mib[0], 3, unsafe.Pointer(procargs), &size, C.NULL, 0) + if retval == 0 { + C.memcpy(unsafe.Pointer(&nargs), unsafe.Pointer(procargs), C.sizeof_int) + result = C.GoBytes(unsafe.Pointer(procargs), C.int(size)) + // fmt.Printf("size: %d %d\n%s\n", size, nargs, hex.Dump(result)) + return result, int(nargs), nil + } + return nil, 0, err +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return p.cmdlineSliceWithContext(ctx, true) +} + +func (p *Process) cmdlineSliceWithContext(ctx context.Context, fallback bool) ([]string, error) { + pargs, nargs, err := procArgs(p.Pid) + if err != nil { + return nil, err + } + // The first bytes hold the nargs int, skip it. + args := bytes.Split((pargs)[C.sizeof_int:], []byte{0}) + var argStr string + // The first element is the actual binary/command path. + // command := args[0] + var argSlice []string + // var envSlice []string + // All other, non-zero elements are arguments. The first "nargs" elements + // are the arguments. Everything else in the slice is then the environment + // of the process. + for _, arg := range args[1:] { + argStr = string(arg[:]) + if len(argStr) > 0 { + if nargs > 0 { + argSlice = append(argSlice, argStr) + nargs-- + continue + } + break + // envSlice = append(envSlice, argStr) + } + } + return argSlice, err +} + +// cmdNameWithContext returns the command name (including spaces) without any arguments +func (p *Process) cmdNameWithContext(ctx context.Context) (string, error) { + r, err := p.cmdlineSliceWithContext(ctx, false) + if err != nil { + return "", err + } + + if len(r) == 0 { + return "", nil + } + + return r[0], err +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + r, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + return strings.Join(r, " "), err +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + const tiSize = C.sizeof_struct_proc_taskinfo + ti := (*C.struct_proc_taskinfo)(C.malloc(tiSize)) + defer C.free(unsafe.Pointer(ti)) + + _, err := C.proc_pidinfo(C.int(p.Pid), C.PROC_PIDTASKINFO, 0, unsafe.Pointer(ti), tiSize) + if err != nil { + return 0, err + } + + return int32(ti.pti_threadnum), nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + const tiSize = C.sizeof_struct_proc_taskinfo + ti := (*C.struct_proc_taskinfo)(C.malloc(tiSize)) + defer C.free(unsafe.Pointer(ti)) + + _, err := C.proc_pidinfo(C.int(p.Pid), C.PROC_PIDTASKINFO, 0, unsafe.Pointer(ti), tiSize) + if err != nil { + return nil, err + } + + ret := &cpu.TimesStat{ + CPU: "cpu", + User: float64(ti.pti_total_user) * timescaleToNanoSeconds / 1e9, + System: float64(ti.pti_total_system) * timescaleToNanoSeconds / 1e9, + } + return ret, nil +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + const tiSize = C.sizeof_struct_proc_taskinfo + ti := (*C.struct_proc_taskinfo)(C.malloc(tiSize)) + defer C.free(unsafe.Pointer(ti)) + + _, err := C.proc_pidinfo(C.int(p.Pid), C.PROC_PIDTASKINFO, 0, unsafe.Pointer(ti), tiSize) + if err != nil { + return nil, err + } + + ret := &MemoryInfoStat{ + RSS: uint64(ti.pti_resident_size), + VMS: uint64(ti.pti_virtual_size), + Swap: uint64(ti.pti_pageins), + } + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_nocgo.go b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_nocgo.go new file mode 100644 index 00000000..bc1d357d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_darwin_nocgo.go @@ -0,0 +1,127 @@ +//go:build darwin && !cgo +// +build darwin,!cgo + +package process + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" +) + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + out, err := invoke.CommandWithContext(ctx, "lsof", "-p", strconv.Itoa(int(p.Pid)), "-Fpfn") + if err != nil { + return "", fmt.Errorf("bad call to lsof: %s", err) + } + txtFound := 0 + lines := strings.Split(string(out), "\n") + for i := 1; i < len(lines); i++ { + if lines[i] == "ftxt" { + txtFound++ + if txtFound == 2 { + return lines[i-1][1:], nil + } + } + } + return "", fmt.Errorf("missing txt data returned by lsof") +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + r, err := callPsWithContext(ctx, "command", p.Pid, false, false) + if err != nil { + return "", err + } + return strings.Join(r[0], " "), err +} + +func (p *Process) cmdNameWithContext(ctx context.Context) (string, error) { + r, err := callPsWithContext(ctx, "command", p.Pid, false, true) + if err != nil { + return "", err + } + if len(r) > 0 && len(r[0]) > 0 { + return r[0][0], err + } + + return "", err +} + +// CmdlineSliceWithContext returns the command line arguments of the process as a slice with each +// element being an argument. Because of current deficiencies in the way that the command +// line arguments are found, single arguments that have spaces in the will actually be +// reported as two separate items. In order to do something better CGO would be needed +// to use the native darwin functions. +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + r, err := callPsWithContext(ctx, "command", p.Pid, false, false) + if err != nil { + return nil, err + } + return r[0], err +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + r, err := callPsWithContext(ctx, "utime,stime", p.Pid, true, false) + if err != nil { + return 0, err + } + return int32(len(r)), nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + r, err := callPsWithContext(ctx, "utime,stime", p.Pid, false, false) + if err != nil { + return nil, err + } + + utime, err := convertCPUTimes(r[0][0]) + if err != nil { + return nil, err + } + stime, err := convertCPUTimes(r[0][1]) + if err != nil { + return nil, err + } + + ret := &cpu.TimesStat{ + CPU: "cpu", + User: utime, + System: stime, + } + return ret, nil +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + r, err := callPsWithContext(ctx, "rss,vsize,pagein", p.Pid, false, false) + if err != nil { + return nil, err + } + rss, err := strconv.Atoi(r[0][0]) + if err != nil { + return nil, err + } + vms, err := strconv.Atoi(r[0][1]) + if err != nil { + return nil, err + } + pagein, err := strconv.Atoi(r[0][2]) + if err != nil { + return nil, err + } + + ret := &MemoryInfoStat{ + RSS: uint64(rss) * 1024, + VMS: uint64(vms) * 1024, + Swap: uint64(pagein), + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_fallback.go b/vendor/github.com/shirou/gopsutil/v3/process/process_fallback.go new file mode 100644 index 00000000..1a5d0c4b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_fallback.go @@ -0,0 +1,203 @@ +//go:build !darwin && !linux && !freebsd && !openbsd && !windows && !solaris && !plan9 +// +build !darwin,!linux,!freebsd,!openbsd,!windows,!solaris,!plan9 + +package process + +import ( + "context" + "syscall" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" +) + +type Signal = syscall.Signal + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { + return common.ErrNotImplementedError +} + +func (p *Process) SuspendWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) ResumeWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) TerminateWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) KillWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd.go b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd.go new file mode 100644 index 00000000..40b10e14 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd.go @@ -0,0 +1,342 @@ +//go:build freebsd +// +build freebsd + +package process + +import ( + "bytes" + "context" + "path/filepath" + "strconv" + "strings" + + cpu "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + net "github.com/shirou/gopsutil/v3/net" + "golang.org/x/sys/unix" +) + +func pidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + procs, err := ProcessesWithContext(ctx) + if err != nil { + return ret, nil + } + + for _, p := range procs { + ret = append(ret, p.Pid) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + name := common.IntToString(k.Comm[:]) + + if len(name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + + return strings.Trim(string(buf), "\x00"), nil +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(buf), func(r rune) bool { + if r == '\u0000' { + return true + } + return false + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if len(buf) == 0 { + return nil, nil + } + if buf[len(buf)-1] == 0 { + buf = buf[:len(buf)-1] + } + parts := bytes.Split(buf, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int64(k.Start.Sec)*1000 + int64(k.Start.Usec)/1000, nil +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + k, err := p.getKProc() + if err != nil { + return []string{""}, err + } + var s string + switch k.Stat { + case SIDL: + s = Idle + case SRUN: + s = Running + case SSLEEP: + s = Sleep + case SSTOP: + s = Stop + case SZOMB: + s = Zombie + case SWAIT: + s = Wait + case SLOCK: + s = Lock + } + + return []string{s}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + uids := make([]int32, 0, 3) + + uids = append(uids, int32(k.Ruid), int32(k.Uid), int32(k.Svuid)) + + return uids, nil +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]int32, 0, 3) + gids = append(gids, int32(k.Rgid), int32(k.Ngroups), int32(k.Svgid)) + + return gids, nil +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + groups := make([]int32, k.Ngroups) + for i := int16(0); i < k.Ngroups; i++ { + groups[i] = int32(k.Groups[i]) + } + + return groups, nil +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Tdev) + + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Nice), nil +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &IOCountersStat{ + ReadCount: uint64(k.Rusage.Inblock), + WriteCount: uint64(k.Rusage.Oublock), + }, nil +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Numthreads, nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &cpu.TimesStat{ + CPU: "cpu", + User: float64(k.Rusage.Utime.Sec) + float64(k.Rusage.Utime.Usec)/1000000, + System: float64(k.Rusage.Stime.Sec) + float64(k.Rusage.Stime.Usec)/1000000, + }, nil +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + v, err := unix.Sysctl("vm.stats.vm.v_page_size") + if err != nil { + return nil, err + } + pageSize := common.LittleEndian.Uint16([]byte(v)) + + return &MemoryInfoStat{ + RSS: uint64(k.Rssize) * uint64(pageSize), + VMS: uint64(k.Size), + }, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid) + if err != nil { + return nil, err + } + ret := make([]*Process, 0, len(pids)) + for _, pid := range pids { + np, err := NewProcessWithContext(ctx, pid) + if err != nil { + return nil, err + } + ret = append(ret, np) + } + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, max) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + results := []*Process{} + + mib := []int32{CTLKern, KernProc, KernProcProc, 0} + buf, length, err := common.CallSyscall(mib) + if err != nil { + return results, err + } + + // get kinfo_proc size + count := int(length / uint64(sizeOfKinfoProc)) + + // parse buf to procs + for i := 0; i < count; i++ { + b := buf[i*sizeOfKinfoProc : (i+1)*sizeOfKinfoProc] + k, err := parseKinfoProc(b) + if err != nil { + continue + } + p, err := NewProcessWithContext(ctx, int32(k.Pid)) + if err != nil { + continue + } + + results = append(results, p) + } + + return results, nil +} + +func (p *Process) getKProc() (*KinfoProc, error) { + mib := []int32{CTLKern, KernProc, KernProcPID, p.Pid} + + buf, length, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + if length != sizeOfKinfoProc { + return nil, err + } + + k, err := parseKinfoProc(buf) + if err != nil { + return nil, err + } + return &k, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_386.go b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_386.go new file mode 100644 index 00000000..08ab333b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_386.go @@ -0,0 +1,192 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x300 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int32 + Nsec int32 +} + +type Timeval struct { + Sec int32 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int32 /* pargs */ + Paddr int32 /* proc */ + Addr int32 /* user */ + Tracep int32 /* vnode */ + Textvp int32 /* vnode */ + Fd int32 /* filedesc */ + Vmspace int32 /* vmspace */ + Wchan int32 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint32 + Rssize int32 + Swrss int32 + Tsize int32 + Dsize int32 + Ssize int32 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int32 + Kiflag int32 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu uint8 + Lastcpu uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Sparestrings [50]int8 + Spareints [7]int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int32 /* pcb */ + Kstack int32 + Udata int32 + Tdaddr int32 /* thread */ + Spareptrs [6]int32 + Sparelongs [12]int32 + Sflag int32 + Tdflags int32 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev uint32 + Vn_mode uint16 + Status uint16 + X_kve_ispare [12]int32 + Path [1024]int8 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_amd64.go new file mode 100644 index 00000000..560e627d --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_amd64.go @@ -0,0 +1,192 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int64 /* pargs */ + Paddr int64 /* proc */ + Addr int64 /* user */ + Tracep int64 /* vnode */ + Textvp int64 /* vnode */ + Fd int64 /* filedesc */ + Vmspace int64 /* vmspace */ + Wchan int64 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint64 + Rssize int64 + Swrss int64 + Tsize int64 + Dsize int64 + Ssize int64 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int64 + Kiflag int64 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu uint8 + Lastcpu uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Sparestrings [50]int8 + Spareints [7]int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int64 /* pcb */ + Kstack int64 + Udata int64 + Tdaddr int64 /* thread */ + Spareptrs [6]int64 + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev uint32 + Vn_mode uint16 + Status uint16 + X_kve_ispare [12]int32 + Path [1024]int8 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm.go b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm.go new file mode 100644 index 00000000..81ae0b9a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm.go @@ -0,0 +1,192 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur int32 + Max int32 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args int32 /* pargs */ + Paddr int32 /* proc */ + Addr int32 /* user */ + Tracep int32 /* vnode */ + Textvp int32 /* vnode */ + Fd int32 /* filedesc */ + Vmspace int32 /* vmspace */ + Wchan int32 + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint32 + Rssize int32 + Swrss int32 + Tsize int32 + Dsize int32 + Ssize int32 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int32 + Kiflag int32 + Traceflag int32 + Stat int8 + Nice int8 + Lock int8 + Rqindex int8 + Oncpu uint8 + Lastcpu uint8 + Tdname [17]int8 + Wmesg [9]int8 + Login [18]int8 + Lockname [9]int8 + Comm [20]int8 + Emul [17]int8 + Loginclass [18]int8 + Sparestrings [50]int8 + Spareints [4]int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb int32 /* pcb */ + Kstack int32 + Udata int32 + Tdaddr int32 /* thread */ + Spareptrs [6]int64 + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev uint32 + Vn_mode uint16 + Status uint16 + X_kve_ispare [12]int32 + Path [1024]int8 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm64.go new file mode 100644 index 00000000..effd470a --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_arm64.go @@ -0,0 +1,202 @@ +//go:build freebsd && arm64 +// +build freebsd,arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_freebsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 14 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 7 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x488 + sizeOfKinfoProc = 0x440 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SWAIT = 6 + SLOCK = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type KinfoProc struct { + Structsize int32 + Layout int32 + Args *int64 /* pargs */ + Paddr *int64 /* proc */ + Addr *int64 /* user */ + Tracep *int64 /* vnode */ + Textvp *int64 /* vnode */ + Fd *int64 /* filedesc */ + Vmspace *int64 /* vmspace */ + Wchan *byte + Pid int32 + Ppid int32 + Pgid int32 + Tpgid int32 + Sid int32 + Tsid int32 + Jobc int16 + Spare_short1 int16 + Tdev_freebsd11 uint32 + Siglist [16]byte /* sigset */ + Sigmask [16]byte /* sigset */ + Sigignore [16]byte /* sigset */ + Sigcatch [16]byte /* sigset */ + Uid uint32 + Ruid uint32 + Svuid uint32 + Rgid uint32 + Svgid uint32 + Ngroups int16 + Spare_short2 int16 + Groups [16]uint32 + Size uint64 + Rssize int64 + Swrss int64 + Tsize int64 + Dsize int64 + Ssize int64 + Xstat uint16 + Acflag uint16 + Pctcpu uint32 + Estcpu uint32 + Slptime uint32 + Swtime uint32 + Cow uint32 + Runtime uint64 + Start Timeval + Childtime Timeval + Flag int64 + Kiflag int64 + Traceflag int32 + Stat uint8 + Nice int8 + Lock uint8 + Rqindex uint8 + Oncpu_old uint8 + Lastcpu_old uint8 + Tdname [17]uint8 + Wmesg [9]uint8 + Login [18]uint8 + Lockname [9]uint8 + Comm [20]int8 + Emul [17]uint8 + Loginclass [18]uint8 + Moretdname [4]uint8 + Sparestrings [46]uint8 + Spareints [2]int32 + Tdev uint64 + Oncpu int32 + Lastcpu int32 + Tracer int32 + Flag2 int32 + Fibnum int32 + Cr_flags uint32 + Jid int32 + Numthreads int32 + Tid int32 + Pri Priority + Rusage Rusage + Rusage_ch Rusage + Pcb *int64 /* pcb */ + Kstack *byte + Udata *byte + Tdaddr *int64 /* thread */ + Spareptrs [6]*byte + Sparelongs [12]int64 + Sflag int64 + Tdflags int64 +} + +type Priority struct { + Class uint8 + Level uint8 + Native uint8 + User uint8 +} + +type KinfoVmentry struct { + Structsize int32 + Type int32 + Start uint64 + End uint64 + Offset uint64 + Vn_fileid uint64 + Vn_fsid_freebsd11 uint32 + Flags int32 + Resident int32 + Private_resident int32 + Protection int32 + Ref_count int32 + Shadow_count int32 + Vn_type int32 + Vn_size uint64 + Vn_rdev_freebsd11 uint32 + Vn_mode uint16 + Status uint16 + Vn_fsid uint64 + Vn_rdev uint64 + X_kve_ispare [8]int32 + Path [1024]uint8 +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go b/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go new file mode 100644 index 00000000..f7989cd2 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go @@ -0,0 +1,1187 @@ +//go:build linux +// +build linux + +package process + +import ( + "bufio" + "bytes" + "context" + "encoding/json" + "fmt" + "math" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/tklauser/go-sysconf" + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" +) + +var pageSize = uint64(os.Getpagesize()) + +const prioProcess = 0 // linux/resource.h + +var clockTicks = 100 // default value + +func init() { + clkTck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + // ignore errors + if err == nil { + clockTicks = int(clkTck) + } +} + +// MemoryInfoExStat is different between OSes +type MemoryInfoExStat struct { + RSS uint64 `json:"rss"` // bytes + VMS uint64 `json:"vms"` // bytes + Shared uint64 `json:"shared"` // bytes + Text uint64 `json:"text"` // bytes + Lib uint64 `json:"lib"` // bytes + Data uint64 `json:"data"` // bytes + Dirty uint64 `json:"dirty"` // bytes +} + +func (m MemoryInfoExStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +// String returns JSON value of the process. +func (m MemoryMapsStat) String() string { + s, _ := json.Marshal(m) + return string(s) +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + _, ppid, _, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return -1, err + } + return ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + if p.name == "" { + if err := p.fillNameWithContext(ctx); err != nil { + return "", err + } + } + return p.name, nil +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + if p.tgid == 0 { + if err := p.fillFromStatusWithContext(ctx); err != nil { + return 0, err + } + } + return p.tgid, nil +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + return p.fillFromExeWithContext(ctx) +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return p.fillFromCmdlineWithContext(ctx) +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return p.fillSliceFromCmdlineWithContext(ctx) +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + _, _, _, createTime, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return 0, err + } + return createTime, nil +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return p.fillFromCwdWithContext(ctx) +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []string{""}, err + } + return []string{p.status}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "stat") + contents, err := os.ReadFile(statPath) + if err != nil { + return false, err + } + fields := strings.Fields(string(contents)) + if len(fields) < 8 { + return false, fmt.Errorf("insufficient data in %s", statPath) + } + pgid := fields[4] + tpgid := fields[7] + return pgid == tpgid, nil +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []int32{}, err + } + return p.uids, nil +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []int32{}, err + } + return p.gids, nil +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return []int32{}, err + } + return p.groups, nil +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + t, _, _, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return "", err + } + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + terminal := termmap[t] + return terminal, nil +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + _, _, _, _, _, nice, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return 0, err + } + return nice, nil +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return p.RlimitUsageWithContext(ctx, false) +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + rlimits, err := p.fillFromLimitsWithContext(ctx) + if !gatherUsed || err != nil { + return rlimits, err + } + + _, _, _, _, rtprio, nice, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + if err := p.fillFromStatusWithContext(ctx); err != nil { + return nil, err + } + + for i := range rlimits { + rs := &rlimits[i] + switch rs.Resource { + case RLIMIT_CPU: + times, err := p.TimesWithContext(ctx) + if err != nil { + return nil, err + } + rs.Used = uint64(times.User + times.System) + case RLIMIT_DATA: + rs.Used = uint64(p.memInfo.Data) + case RLIMIT_STACK: + rs.Used = uint64(p.memInfo.Stack) + case RLIMIT_RSS: + rs.Used = uint64(p.memInfo.RSS) + case RLIMIT_NOFILE: + n, err := p.NumFDsWithContext(ctx) + if err != nil { + return nil, err + } + rs.Used = uint64(n) + case RLIMIT_MEMLOCK: + rs.Used = uint64(p.memInfo.Locked) + case RLIMIT_AS: + rs.Used = uint64(p.memInfo.VMS) + case RLIMIT_LOCKS: + // TODO we can get the used value from /proc/$pid/locks. But linux doesn't enforce it, so not a high priority. + case RLIMIT_SIGPENDING: + rs.Used = p.sigInfo.PendingProcess + case RLIMIT_NICE: + // The rlimit for nice is a little unusual, in that 0 means the niceness cannot be decreased beyond the current value, but it can be increased. + // So effectively: if rs.Soft == 0 { rs.Soft = rs.Used } + rs.Used = uint64(nice) + case RLIMIT_RTPRIO: + rs.Used = uint64(rtprio) + } + } + + return rlimits, err +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return p.fillFromIOWithContext(ctx) +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return nil, err + } + return p.numCtxSwitches, nil +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + _, fnames, err := p.fillFromfdListWithContext(ctx) + return int32(len(fnames)), err +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + err := p.fillFromStatusWithContext(ctx) + if err != nil { + return 0, err + } + return p.numThreads, nil +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + ret := make(map[int32]*cpu.TimesStat) + taskPath := common.HostProcWithContext(ctx, strconv.Itoa(int(p.Pid)), "task") + + tids, err := readPidsFromDir(taskPath) + if err != nil { + return nil, err + } + + for _, tid := range tids { + _, _, cpuTimes, _, _, _, _, err := p.fillFromTIDStatWithContext(ctx, tid) + if err != nil { + return nil, err + } + ret[tid] = cpuTimes + } + + return ret, nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + _, _, cpuTimes, _, _, _, _, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + return cpuTimes, nil +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + meminfo, _, err := p.fillFromStatmWithContext(ctx) + if err != nil { + return nil, err + } + return meminfo, nil +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + _, memInfoEx, err := p.fillFromStatmWithContext(ctx) + if err != nil { + return nil, err + } + return memInfoEx, nil +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + _, _, _, _, _, _, pageFaults, err := p.fillFromStatWithContext(ctx) + if err != nil { + return nil, err + } + return pageFaults, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid) + if err != nil { + return nil, err + } + if len(pids) == 0 { + return nil, ErrorNoChildren + } + ret := make([]*Process, 0, len(pids)) + for _, pid := range pids { + np, err := NewProcessWithContext(ctx, pid) + if err != nil { + return nil, err + } + ret = append(ret, np) + } + return ret, nil +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + _, ofs, err := p.fillFromfdWithContext(ctx) + if err != nil { + return nil, err + } + ret := make([]OpenFilesStat, len(ofs)) + for i, o := range ofs { + ret[i] = *o + } + + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return net.ConnectionsPidMaxWithContext(ctx, "all", p.Pid, max) +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + pid := p.Pid + var ret []MemoryMapsStat + smapsPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "smaps") + if grouped { + ret = make([]MemoryMapsStat, 1) + // If smaps_rollup exists (require kernel >= 4.15), then we will use it + // for pre-summed memory information for a process. + smapsRollupPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "smaps_rollup") + if _, err := os.Stat(smapsRollupPath); !os.IsNotExist(err) { + smapsPath = smapsRollupPath + } + } + contents, err := os.ReadFile(smapsPath) + if err != nil { + return nil, err + } + lines := strings.Split(string(contents), "\n") + + // function of parsing a block + getBlock := func(firstLine []string, block []string) (MemoryMapsStat, error) { + m := MemoryMapsStat{} + m.Path = firstLine[len(firstLine)-1] + + for _, line := range block { + if strings.Contains(line, "VmFlags") { + continue + } + field := strings.Split(line, ":") + if len(field) < 2 { + continue + } + v := strings.Trim(field[1], "kB") // remove last "kB" + v = strings.TrimSpace(v) + t, err := strconv.ParseUint(v, 10, 64) + if err != nil { + return m, err + } + + switch field[0] { + case "Size": + m.Size = t + case "Rss": + m.Rss = t + case "Pss": + m.Pss = t + case "Shared_Clean": + m.SharedClean = t + case "Shared_Dirty": + m.SharedDirty = t + case "Private_Clean": + m.PrivateClean = t + case "Private_Dirty": + m.PrivateDirty = t + case "Referenced": + m.Referenced = t + case "Anonymous": + m.Anonymous = t + case "Swap": + m.Swap = t + } + } + return m, nil + } + + var firstLine []string + blocks := make([]string, 0, 16) + + for i, line := range lines { + fields := strings.Fields(line) + if (len(fields) > 0 && !strings.HasSuffix(fields[0], ":")) || i == len(lines)-1 { + // new block section + if len(firstLine) > 0 && len(blocks) > 0 { + g, err := getBlock(firstLine, blocks) + if err != nil { + return &ret, err + } + if grouped { + ret[0].Size += g.Size + ret[0].Rss += g.Rss + ret[0].Pss += g.Pss + ret[0].SharedClean += g.SharedClean + ret[0].SharedDirty += g.SharedDirty + ret[0].PrivateClean += g.PrivateClean + ret[0].PrivateDirty += g.PrivateDirty + ret[0].Referenced += g.Referenced + ret[0].Anonymous += g.Anonymous + ret[0].Swap += g.Swap + } else { + ret = append(ret, g) + } + } + // starts new block + blocks = make([]string, 0, 16) + firstLine = fields + } else { + blocks = append(blocks, line) + } + } + + return &ret, nil +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + environPath := common.HostProcWithContext(ctx, strconv.Itoa(int(p.Pid)), "environ") + + environContent, err := os.ReadFile(environPath) + if err != nil { + return nil, err + } + + return strings.Split(string(environContent), "\000"), nil +} + +/** +** Internal functions +**/ + +func limitToUint(val string) (uint64, error) { + if val == "unlimited" { + return math.MaxUint64, nil + } + res, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return 0, err + } + return res, nil +} + +// Get num_fds from /proc/(pid)/limits +func (p *Process) fillFromLimitsWithContext(ctx context.Context) ([]RlimitStat, error) { + pid := p.Pid + limitsFile := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "limits") + d, err := os.Open(limitsFile) + if err != nil { + return nil, err + } + defer d.Close() + + var limitStats []RlimitStat + + limitsScanner := bufio.NewScanner(d) + for limitsScanner.Scan() { + var statItem RlimitStat + + str := strings.Fields(limitsScanner.Text()) + + // Remove the header line + if strings.Contains(str[len(str)-1], "Units") { + continue + } + + // Assert that last item is a Hard limit + statItem.Hard, err = limitToUint(str[len(str)-1]) + if err != nil { + // On error remove last item and try once again since it can be unit or header line + str = str[:len(str)-1] + statItem.Hard, err = limitToUint(str[len(str)-1]) + if err != nil { + return nil, err + } + } + // Remove last item from string + str = str[:len(str)-1] + + // Now last item is a Soft limit + statItem.Soft, err = limitToUint(str[len(str)-1]) + if err != nil { + return nil, err + } + // Remove last item from string + str = str[:len(str)-1] + + // The rest is a stats name + resourceName := strings.Join(str, " ") + switch resourceName { + case "Max cpu time": + statItem.Resource = RLIMIT_CPU + case "Max file size": + statItem.Resource = RLIMIT_FSIZE + case "Max data size": + statItem.Resource = RLIMIT_DATA + case "Max stack size": + statItem.Resource = RLIMIT_STACK + case "Max core file size": + statItem.Resource = RLIMIT_CORE + case "Max resident set": + statItem.Resource = RLIMIT_RSS + case "Max processes": + statItem.Resource = RLIMIT_NPROC + case "Max open files": + statItem.Resource = RLIMIT_NOFILE + case "Max locked memory": + statItem.Resource = RLIMIT_MEMLOCK + case "Max address space": + statItem.Resource = RLIMIT_AS + case "Max file locks": + statItem.Resource = RLIMIT_LOCKS + case "Max pending signals": + statItem.Resource = RLIMIT_SIGPENDING + case "Max msgqueue size": + statItem.Resource = RLIMIT_MSGQUEUE + case "Max nice priority": + statItem.Resource = RLIMIT_NICE + case "Max realtime priority": + statItem.Resource = RLIMIT_RTPRIO + case "Max realtime timeout": + statItem.Resource = RLIMIT_RTTIME + default: + continue + } + + limitStats = append(limitStats, statItem) + } + + if err := limitsScanner.Err(); err != nil { + return nil, err + } + + return limitStats, nil +} + +// Get list of /proc/(pid)/fd files +func (p *Process) fillFromfdListWithContext(ctx context.Context) (string, []string, error) { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "fd") + d, err := os.Open(statPath) + if err != nil { + return statPath, []string{}, err + } + defer d.Close() + fnames, err := d.Readdirnames(-1) + return statPath, fnames, err +} + +// Get num_fds from /proc/(pid)/fd +func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []*OpenFilesStat, error) { + statPath, fnames, err := p.fillFromfdListWithContext(ctx) + if err != nil { + return 0, nil, err + } + numFDs := int32(len(fnames)) + + var openfiles []*OpenFilesStat + for _, fd := range fnames { + fpath := filepath.Join(statPath, fd) + filepath, err := os.Readlink(fpath) + if err != nil { + continue + } + t, err := strconv.ParseUint(fd, 10, 64) + if err != nil { + return numFDs, openfiles, err + } + o := &OpenFilesStat{ + Path: filepath, + Fd: t, + } + openfiles = append(openfiles, o) + } + + return numFDs, openfiles, nil +} + +// Get cwd from /proc/(pid)/cwd +func (p *Process) fillFromCwdWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cwd") + cwd, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return string(cwd), nil +} + +// Get exe from /proc/(pid)/exe +func (p *Process) fillFromExeWithContext(ctx context.Context) (string, error) { + pid := p.Pid + exePath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "exe") + exe, err := os.Readlink(exePath) + if err != nil { + return "", err + } + return string(exe), nil +} + +// Get cmdline from /proc/(pid)/cmdline +func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(cmdline), func(r rune) bool { + return r == '\u0000' + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return nil, err + } + if len(cmdline) == 0 { + return nil, nil + } + + cmdline = bytes.TrimRight(cmdline, "\x00") + + parts := bytes.Split(cmdline, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +// Get IO status from /proc/(pid)/io +func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, error) { + pid := p.Pid + ioPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "io") + ioline, err := os.ReadFile(ioPath) + if err != nil { + return nil, err + } + lines := strings.Split(string(ioline), "\n") + ret := &IOCountersStat{} + + for _, line := range lines { + field := strings.Fields(line) + if len(field) < 2 { + continue + } + t, err := strconv.ParseUint(field[1], 10, 64) + if err != nil { + return nil, err + } + param := strings.TrimSuffix(field[0], ":") + switch param { + case "syscr": + ret.ReadCount = t + case "syscw": + ret.WriteCount = t + case "read_bytes": + ret.ReadBytes = t + case "write_bytes": + ret.WriteBytes = t + } + } + + return ret, nil +} + +// Get memory info from /proc/(pid)/statm +func (p *Process) fillFromStatmWithContext(ctx context.Context) (*MemoryInfoStat, *MemoryInfoExStat, error) { + pid := p.Pid + memPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "statm") + contents, err := os.ReadFile(memPath) + if err != nil { + return nil, nil, err + } + fields := strings.Split(string(contents), " ") + + vms, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return nil, nil, err + } + rss, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return nil, nil, err + } + memInfo := &MemoryInfoStat{ + RSS: rss * pageSize, + VMS: vms * pageSize, + } + + shared, err := strconv.ParseUint(fields[2], 10, 64) + if err != nil { + return nil, nil, err + } + text, err := strconv.ParseUint(fields[3], 10, 64) + if err != nil { + return nil, nil, err + } + lib, err := strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, nil, err + } + dirty, err := strconv.ParseUint(fields[5], 10, 64) + if err != nil { + return nil, nil, err + } + + memInfoEx := &MemoryInfoExStat{ + RSS: rss * pageSize, + VMS: vms * pageSize, + Shared: shared * pageSize, + Text: text * pageSize, + Lib: lib * pageSize, + Dirty: dirty * pageSize, + } + + return memInfo, memInfoEx, nil +} + +// Get name from /proc/(pid)/comm or /proc/(pid)/status +func (p *Process) fillNameWithContext(ctx context.Context) error { + err := p.fillFromCommWithContext(ctx) + if err == nil && p.name != "" && len(p.name) < 15 { + return nil + } + return p.fillFromStatusWithContext(ctx) +} + +// Get name from /proc/(pid)/comm +func (p *Process) fillFromCommWithContext(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "comm") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + + p.name = strings.TrimSuffix(string(contents), "\n") + return nil +} + +// Get various status from /proc/(pid)/status +func (p *Process) fillFromStatus() error { + return p.fillFromStatusWithContext(context.Background()) +} + +func (p *Process) fillFromStatusWithContext(ctx context.Context) error { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "status") + contents, err := os.ReadFile(statPath) + if err != nil { + return err + } + lines := strings.Split(string(contents), "\n") + p.numCtxSwitches = &NumCtxSwitchesStat{} + p.memInfo = &MemoryInfoStat{} + p.sigInfo = &SignalInfoStat{} + for _, line := range lines { + tabParts := strings.SplitN(line, "\t", 2) + if len(tabParts) < 2 { + continue + } + value := tabParts[1] + switch strings.TrimRight(tabParts[0], ":") { + case "Name": + p.name = strings.Trim(value, " \t") + if len(p.name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + p.name = extendedName + } + } + } + // Ensure we have a copy and not reference into slice + p.name = string([]byte(p.name)) + case "State": + p.status = convertStatusChar(value[0:1]) + // Ensure we have a copy and not reference into slice + p.status = string([]byte(p.status)) + case "PPid", "Ppid": + pval, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.parent = int32(pval) + case "Tgid": + pval, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.tgid = int32(pval) + case "Uid": + p.uids = make([]int32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseInt(i, 10, 32) + if err != nil { + return err + } + p.uids = append(p.uids, int32(v)) + } + case "Gid": + p.gids = make([]int32, 0, 4) + for _, i := range strings.Split(value, "\t") { + v, err := strconv.ParseInt(i, 10, 32) + if err != nil { + return err + } + p.gids = append(p.gids, int32(v)) + } + case "Groups": + groups := strings.Fields(value) + p.groups = make([]int32, 0, len(groups)) + for _, i := range groups { + v, err := strconv.ParseInt(i, 10, 32) + if err != nil { + return err + } + p.groups = append(p.groups, int32(v)) + } + case "Threads": + v, err := strconv.ParseInt(value, 10, 32) + if err != nil { + return err + } + p.numThreads = int32(v) + case "voluntary_ctxt_switches": + v, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return err + } + p.numCtxSwitches.Voluntary = v + case "nonvoluntary_ctxt_switches": + v, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return err + } + p.numCtxSwitches.Involuntary = v + case "VmRSS": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.RSS = v * 1024 + case "VmSize": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.VMS = v * 1024 + case "VmSwap": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Swap = v * 1024 + case "VmHWM": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.HWM = v * 1024 + case "VmData": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Data = v * 1024 + case "VmStk": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Stack = v * 1024 + case "VmLck": + value := strings.Trim(value, " kB") // remove last "kB" + v, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return err + } + p.memInfo.Locked = v * 1024 + case "SigPnd": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.PendingThread = v + case "ShdPnd": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.PendingProcess = v + case "SigBlk": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Blocked = v + case "SigIgn": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Ignored = v + case "SigCgt": + if len(value) > 16 { + value = value[len(value)-16:] + } + v, err := strconv.ParseUint(value, 16, 64) + if err != nil { + return err + } + p.sigInfo.Caught = v + } + + } + return nil +} + +func (p *Process) fillFromTIDStat(tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + return p.fillFromTIDStatWithContext(context.Background(), tid) +} + +func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + pid := p.Pid + var statPath string + + if tid == -1 { + statPath = common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "stat") + } else { + statPath = common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "task", strconv.Itoa(int(tid)), "stat") + } + + contents, err := os.ReadFile(statPath) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + // Indexing from one, as described in `man proc` about the file /proc/[pid]/stat + fields := splitProcStat(contents) + + terminal, err := strconv.ParseUint(fields[7], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + ppid, err := strconv.ParseInt(fields[4], 10, 32) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + utime, err := strconv.ParseFloat(fields[14], 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + stime, err := strconv.ParseFloat(fields[15], 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + // There is no such thing as iotime in stat file. As an approximation, we + // will use delayacct_blkio_ticks (aggregated block I/O delays, as per Linux + // docs). Note: I am assuming at least Linux 2.6.18 + var iotime float64 + if len(fields) > 42 { + iotime, err = strconv.ParseFloat(fields[42], 64) + if err != nil { + iotime = 0 // Ancient linux version, most likely + } + } else { + iotime = 0 // e.g. SmartOS containers + } + + cpuTimes := &cpu.TimesStat{ + CPU: "cpu", + User: utime / float64(clockTicks), + System: stime / float64(clockTicks), + Iowait: iotime / float64(clockTicks), + } + + bootTime, _ := common.BootTimeWithContext(ctx) + t, err := strconv.ParseUint(fields[22], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + ctime := (t / uint64(clockTicks)) + uint64(bootTime) + createTime := int64(ctime * 1000) + + rtpriority, err := strconv.ParseInt(fields[18], 10, 32) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + if rtpriority < 0 { + rtpriority = rtpriority*-1 - 1 + } else { + rtpriority = 0 + } + + // p.Nice = mustParseInt32(fields[18]) + // use syscall instead of parse Stat file + snice, _ := unix.Getpriority(prioProcess, int(pid)) + nice := int32(snice) // FIXME: is this true? + + minFault, err := strconv.ParseUint(fields[10], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + cMinFault, err := strconv.ParseUint(fields[11], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + majFault, err := strconv.ParseUint(fields[12], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + cMajFault, err := strconv.ParseUint(fields[13], 10, 64) + if err != nil { + return 0, 0, nil, 0, 0, 0, nil, err + } + + faults := &PageFaultsStat{ + MinorFaults: minFault, + MajorFaults: majFault, + ChildMinorFaults: cMinFault, + ChildMajorFaults: cMajFault, + } + + return terminal, int32(ppid), cpuTimes, createTime, uint32(rtpriority), nice, faults, nil +} + +func (p *Process) fillFromStatWithContext(ctx context.Context) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) { + return p.fillFromTIDStatWithContext(ctx, -1) +} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return readPidsFromDir(common.HostProcWithContext(ctx)) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func readPidsFromDir(path string) ([]int32, error) { + var ret []int32 + + d, err := os.Open(path) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} + +func splitProcStat(content []byte) []string { + nameStart := bytes.IndexByte(content, '(') + nameEnd := bytes.LastIndexByte(content, ')') + restFields := strings.Fields(string(content[nameEnd+2:])) // +2 skip ') ' + name := content[nameStart+1 : nameEnd] + pid := strings.TrimSpace(string(content[:nameStart])) + fields := make([]string, 3, len(restFields)+3) + fields[1] = string(pid) + fields[2] = string(name) + fields = append(fields, restFields...) + return fields +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd.go b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd.go new file mode 100644 index 00000000..a58c5eb1 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd.go @@ -0,0 +1,387 @@ +//go:build openbsd +// +build openbsd + +package process + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "io" + "path/filepath" + "strconv" + "strings" + "unsafe" + + cpu "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + mem "github.com/shirou/gopsutil/v3/mem" + net "github.com/shirou/gopsutil/v3/net" + "golang.org/x/sys/unix" +) + +func pidsWithContext(ctx context.Context) ([]int32, error) { + var ret []int32 + procs, err := ProcessesWithContext(ctx) + if err != nil { + return ret, nil + } + + for _, p := range procs { + ret = append(ret, p.Pid) + } + + return ret, nil +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + + return k.Ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + name := common.IntToString(k.Comm[:]) + + if len(name) >= 15 { + cmdlineSlice, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + if len(cmdlineSlice) > 0 { + extendedName := filepath.Base(cmdlineSlice[0]) + if strings.HasPrefix(extendedName, p.name) { + name = extendedName + } + } + } + + return name, nil +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + mib := []int32{CTLKern, KernProcArgs, p.Pid, KernProcArgv} + buf, _, err := common.CallSyscall(mib) + if err != nil { + return nil, err + } + + /* From man sysctl(2): + The buffer pointed to by oldp is filled with an array of char + pointers followed by the strings themselves. The last char + pointer is a NULL pointer. */ + var strParts []string + r := bytes.NewReader(buf) + baseAddr := uintptr(unsafe.Pointer(&buf[0])) + for { + argvp, err := readPtr(r) + if err != nil { + return nil, err + } + if argvp == 0 { // check for a NULL pointer + break + } + offset := argvp - baseAddr + length := uintptr(bytes.IndexByte(buf[offset:], 0)) + str := string(buf[offset : offset+length]) + strParts = append(strParts, str) + } + + return strParts, nil +} + +// readPtr reads a pointer data from a given reader. WARNING: only little +// endian architectures are supported. +func readPtr(r io.Reader) (uintptr, error) { + switch sizeofPtr { + case 4: + var p uint32 + if err := binary.Read(r, binary.LittleEndian, &p); err != nil { + return 0, err + } + return uintptr(p), nil + case 8: + var p uint64 + if err := binary.Read(r, binary.LittleEndian, &p); err != nil { + return 0, err + } + return uintptr(p), nil + default: + return 0, fmt.Errorf("unsupported pointer size") + } +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + argv, err := p.CmdlineSliceWithContext(ctx) + if err != nil { + return "", err + } + return strings.Join(argv, " "), nil +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + k, err := p.getKProc() + if err != nil { + return []string{""}, err + } + var s string + switch k.Stat { + case SIDL: + case SRUN: + case SONPROC: + s = Running + case SSLEEP: + s = Sleep + case SSTOP: + s = Stop + case SDEAD: + s = Zombie + } + + return []string{s}, nil +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + // see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details + pid := p.Pid + out, err := invoke.CommandWithContext(ctx, "ps", "-o", "stat=", "-p", strconv.Itoa(int(pid))) + if err != nil { + return false, err + } + return strings.IndexByte(string(out), '+') != -1, nil +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + uids := make([]int32, 0, 3) + + uids = append(uids, int32(k.Ruid), int32(k.Uid), int32(k.Svuid)) + + return uids, nil +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + gids := make([]int32, 0, 3) + gids = append(gids, int32(k.Rgid), int32(k.Ngroups), int32(k.Svgid)) + + return gids, nil +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + + groups := make([]int32, k.Ngroups) + for i := int16(0); i < k.Ngroups; i++ { + groups[i] = int32(k.Groups[i]) + } + + return groups, nil +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + k, err := p.getKProc() + if err != nil { + return "", err + } + + ttyNr := uint64(k.Tdev) + + termmap, err := getTerminalMap() + if err != nil { + return "", err + } + + return termmap[ttyNr], nil +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + k, err := p.getKProc() + if err != nil { + return 0, err + } + return int32(k.Nice), nil +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &IOCountersStat{ + ReadCount: uint64(k.Uru_inblock), + WriteCount: uint64(k.Uru_oublock), + }, nil +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + /* not supported, just return 1 */ + return 1, nil +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + return &cpu.TimesStat{ + CPU: "cpu", + User: float64(k.Uutime_sec) + float64(k.Uutime_usec)/1000000, + System: float64(k.Ustime_sec) + float64(k.Ustime_usec)/1000000, + }, nil +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + k, err := p.getKProc() + if err != nil { + return nil, err + } + pageSize, err := mem.GetPageSizeWithContext(ctx) + if err != nil { + return nil, err + } + + return &MemoryInfoStat{ + RSS: uint64(k.Vm_rssize) * pageSize, + VMS: uint64(k.Vm_tsize) + uint64(k.Vm_dsize) + + uint64(k.Vm_ssize), + }, nil +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid) + if err != nil { + return nil, err + } + ret := make([]*Process, 0, len(pids)) + for _, pid := range pids { + np, err := NewProcessWithContext(ctx, pid) + if err != nil { + return nil, err + } + ret = append(ret, np) + } + return ret, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + results := []*Process{} + + buf, length, err := callKernProcSyscall(KernProcAll, 0) + if err != nil { + return results, err + } + + // get kinfo_proc size + count := int(length / uint64(sizeOfKinfoProc)) + + // parse buf to procs + for i := 0; i < count; i++ { + b := buf[i*sizeOfKinfoProc : (i+1)*sizeOfKinfoProc] + k, err := parseKinfoProc(b) + if err != nil { + continue + } + p, err := NewProcessWithContext(ctx, int32(k.Pid)) + if err != nil { + continue + } + + results = append(results, p) + } + + return results, nil +} + +func (p *Process) getKProc() (*KinfoProc, error) { + buf, length, err := callKernProcSyscall(KernProcPID, p.Pid) + if err != nil { + return nil, err + } + if length != sizeOfKinfoProc { + return nil, err + } + + k, err := parseKinfoProc(buf) + if err != nil { + return nil, err + } + return &k, nil +} + +func callKernProcSyscall(op int32, arg int32) ([]byte, uint64, error) { + mib := []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, 0} + mibptr := unsafe.Pointer(&mib[0]) + miblen := uint64(len(mib)) + length := uint64(0) + _, _, err := unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + 0, + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return nil, length, err + } + + count := int32(length / uint64(sizeOfKinfoProc)) + mib = []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, count} + mibptr = unsafe.Pointer(&mib[0]) + miblen = uint64(len(mib)) + // get proc info itself + buf := make([]byte, length) + _, _, err = unix.Syscall6( + unix.SYS___SYSCTL, + uintptr(mibptr), + uintptr(miblen), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&length)), + 0, + 0) + if err != 0 { + return buf, length, err + } + + return buf, length, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_386.go b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_386.go new file mode 100644 index 00000000..f4ed0249 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_386.go @@ -0,0 +1,202 @@ +//go:build openbsd && 386 +// +build openbsd,386 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x38 + sizeOfKinfoProc = 0x264 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int32 +} + +type Timeval struct { + Sec int64 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint32 + End uint32 + Guard uint32 + Fspace uint32 + Fspace_augment uint32 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [3]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_amd64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_amd64.go new file mode 100644 index 00000000..8607422b --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_amd64.go @@ -0,0 +1,200 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x50 + sizeOfKinfoProc = 0x268 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Pad_cgo_0 [4]byte + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint64 + End uint64 + Guard uint64 + Fspace uint64 + Fspace_augment uint64 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [7]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm.go b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm.go new file mode 100644 index 00000000..b94429f2 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm.go @@ -0,0 +1,202 @@ +//go:build openbsd && arm +// +build openbsd,arm + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x38 + sizeOfKinfoProc = 0x264 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int32 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int32 +} + +type Timeval struct { + Sec int64 + Usec int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]int8 + Wchan uint64 + Login [32]int8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags int32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]int8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint32 + End uint32 + Guard uint32 + Fspace uint32 + Fspace_augment uint32 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [3]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm64.go b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm64.go new file mode 100644 index 00000000..a3291b8c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_openbsd_arm64.go @@ -0,0 +1,203 @@ +//go:build openbsd && arm64 +// +build openbsd,arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs process/types_openbsd.go + +package process + +const ( + CTLKern = 1 + KernProc = 66 + KernProcAll = 0 + KernProcPID = 1 + KernProcProc = 8 + KernProcPathname = 12 + KernProcArgs = 55 + KernProcArgv = 1 + KernProcEnv = 3 +) + +const ( + ArgMax = 256 * 1024 +) + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +const ( + sizeOfKinfoVmentry = 0x50 + sizeOfKinfoProc = 0x270 +) + +const ( + SIDL = 1 + SRUN = 2 + SSLEEP = 3 + SSTOP = 4 + SZOMB = 5 + SDEAD = 6 + SONPROC = 7 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type KinfoProc struct { + Forw uint64 + Back uint64 + Paddr uint64 + Addr uint64 + Fd uint64 + Stats uint64 + Limit uint64 + Vmspace uint64 + Sigacts uint64 + Sess uint64 + Tsess uint64 + Ru uint64 + Eflag int32 + Exitsig int32 + Flag int32 + Pid int32 + Ppid int32 + Sid int32 + X_pgid int32 + Tpgid int32 + Uid uint32 + Ruid uint32 + Gid uint32 + Rgid uint32 + Groups [16]uint32 + Ngroups int16 + Jobc int16 + Tdev uint32 + Estcpu uint32 + Rtime_sec uint32 + Rtime_usec uint32 + Cpticks int32 + Pctcpu uint32 + Swtime uint32 + Slptime uint32 + Schedflags int32 + Uticks uint64 + Sticks uint64 + Iticks uint64 + Tracep uint64 + Traceflag int32 + Holdcnt int32 + Siglist int32 + Sigmask uint32 + Sigignore uint32 + Sigcatch uint32 + Stat int8 + Priority uint8 + Usrpri uint8 + Nice uint8 + Xstat uint16 + Acflag uint16 + Comm [24]int8 + Wmesg [8]uint8 + Wchan uint64 + Login [32]uint8 + Vm_rssize int32 + Vm_tsize int32 + Vm_dsize int32 + Vm_ssize int32 + Uvalid int64 + Ustart_sec uint64 + Ustart_usec uint32 + Uutime_sec uint32 + Uutime_usec uint32 + Ustime_sec uint32 + Ustime_usec uint32 + Uru_maxrss uint64 + Uru_ixrss uint64 + Uru_idrss uint64 + Uru_isrss uint64 + Uru_minflt uint64 + Uru_majflt uint64 + Uru_nswap uint64 + Uru_inblock uint64 + Uru_oublock uint64 + Uru_msgsnd uint64 + Uru_msgrcv uint64 + Uru_nsignals uint64 + Uru_nvcsw uint64 + Uru_nivcsw uint64 + Uctime_sec uint32 + Uctime_usec uint32 + Psflags uint32 + Spare int32 + Svuid uint32 + Svgid uint32 + Emul [8]uint8 + Rlim_rss_cur uint64 + Cpuid uint64 + Vm_map_size uint64 + Tid int32 + Rtableid uint32 + Pledge uint64 +} + +type Priority struct{} + +type KinfoVmentry struct { + Start uint64 + End uint64 + Guard uint64 + Fspace uint64 + Fspace_augment uint64 + Offset uint64 + Wired_count int32 + Etype int32 + Protection int32 + Max_protection int32 + Advice int32 + Inheritance int32 + Flags uint8 + Pad_cgo_0 [7]byte +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_plan9.go b/vendor/github.com/shirou/gopsutil/v3/process/process_plan9.go new file mode 100644 index 00000000..bc4bc062 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_plan9.go @@ -0,0 +1,203 @@ +//go:build plan9 +// +build plan9 + +package process + +import ( + "context" + "syscall" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" +) + +type Signal = syscall.Note + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { + return common.ErrNotImplementedError +} + +func (p *Process) SuspendWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) ResumeWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) TerminateWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) KillWithContext(ctx context.Context) error { + return common.ErrNotImplementedError +} + +func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_posix.go b/vendor/github.com/shirou/gopsutil/v3/process/process_posix.go new file mode 100644 index 00000000..a01f9ecf --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_posix.go @@ -0,0 +1,185 @@ +//go:build linux || freebsd || openbsd || darwin || solaris +// +build linux freebsd openbsd darwin solaris + +package process + +import ( + "context" + "errors" + "fmt" + "os" + "os/user" + "path/filepath" + "strconv" + "strings" + "syscall" + + "golang.org/x/sys/unix" + + "github.com/shirou/gopsutil/v3/internal/common" +) + +type Signal = syscall.Signal + +// POSIX +func getTerminalMap() (map[uint64]string, error) { + ret := make(map[uint64]string) + var termfiles []string + + d, err := os.Open("/dev") + if err != nil { + return nil, err + } + defer d.Close() + + devnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, devname := range devnames { + if strings.HasPrefix(devname, "/dev/tty") { + termfiles = append(termfiles, "/dev/tty/"+devname) + } + } + + var ptsnames []string + ptsd, err := os.Open("/dev/pts") + if err != nil { + ptsnames, _ = filepath.Glob("/dev/ttyp*") + if ptsnames == nil { + return nil, err + } + } + defer ptsd.Close() + + if ptsnames == nil { + defer ptsd.Close() + ptsnames, err = ptsd.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, ptsname := range ptsnames { + termfiles = append(termfiles, "/dev/pts/"+ptsname) + } + } else { + termfiles = ptsnames + } + + for _, name := range termfiles { + stat := unix.Stat_t{} + if err = unix.Stat(name, &stat); err != nil { + return nil, err + } + rdev := uint64(stat.Rdev) + ret[rdev] = strings.Replace(name, "/dev", "", -1) + } + return ret, nil +} + +// isMount is a port of python's os.path.ismount() +// https://github.com/python/cpython/blob/08ff4369afca84587b1c82034af4e9f64caddbf2/Lib/posixpath.py#L186-L216 +// https://docs.python.org/3/library/os.path.html#os.path.ismount +func isMount(path string) bool { + // Check symlinkness with os.Lstat; unix.DT_LNK is not portable + fileInfo, err := os.Lstat(path) + if err != nil { + return false + } + if fileInfo.Mode()&os.ModeSymlink != 0 { + return false + } + var stat1 unix.Stat_t + if err := unix.Lstat(path, &stat1); err != nil { + return false + } + parent := filepath.Join(path, "..") + var stat2 unix.Stat_t + if err := unix.Lstat(parent, &stat2); err != nil { + return false + } + return stat1.Dev != stat2.Dev || stat1.Ino == stat2.Ino +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + if pid <= 0 { + return false, fmt.Errorf("invalid pid %v", pid) + } + proc, err := os.FindProcess(int(pid)) + if err != nil { + return false, err + } + + if isMount(common.HostProcWithContext(ctx)) { // if //proc exists and is mounted, check if //proc/ folder exists + _, err := os.Stat(common.HostProcWithContext(ctx, strconv.Itoa(int(pid)))) + if os.IsNotExist(err) { + return false, nil + } + return err == nil, err + } + + // procfs does not exist or is not mounted, check PID existence by signalling the pid + err = proc.Signal(syscall.Signal(0)) + if err == nil { + return true, nil + } + if errors.Is(err, os.ErrProcessDone) { + return false, nil + } + var errno syscall.Errno + if !errors.As(err, &errno) { + return false, err + } + switch errno { + case syscall.ESRCH: + return false, nil + case syscall.EPERM: + return true, nil + } + + return false, err +} + +func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { + process, err := os.FindProcess(int(p.Pid)) + if err != nil { + return err + } + + err = process.Signal(sig) + if err != nil { + return err + } + + return nil +} + +func (p *Process) SuspendWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGSTOP) +} + +func (p *Process) ResumeWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGCONT) +} + +func (p *Process) TerminateWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGTERM) +} + +func (p *Process) KillWithContext(ctx context.Context) error { + return p.SendSignalWithContext(ctx, unix.SIGKILL) +} + +func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { + uids, err := p.UidsWithContext(ctx) + if err != nil { + return "", err + } + if len(uids) > 0 { + u, err := user.LookupId(strconv.Itoa(int(uids[0]))) + if err != nil { + return "", err + } + return u.Username, nil + } + return "", nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_solaris.go b/vendor/github.com/shirou/gopsutil/v3/process/process_solaris.go new file mode 100644 index 00000000..dd4bd476 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_solaris.go @@ -0,0 +1,303 @@ +package process + +import ( + "bytes" + "context" + "os" + "strconv" + "strings" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" +) + +type MemoryMapsStat struct { + Path string `json:"path"` + Rss uint64 `json:"rss"` + Size uint64 `json:"size"` + Pss uint64 `json:"pss"` + SharedClean uint64 `json:"sharedClean"` + SharedDirty uint64 `json:"sharedDirty"` + PrivateClean uint64 `json:"privateClean"` + PrivateDirty uint64 `json:"privateDirty"` + Referenced uint64 `json:"referenced"` + Anonymous uint64 `json:"anonymous"` + Swap uint64 `json:"swap"` +} + +type MemoryInfoExStat struct{} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + return readPidsFromDir(common.HostProcWithContext(ctx)) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, err + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + exe, err := p.fillFromPathAOutWithContext(ctx) + if os.IsNotExist(err) { + exe, err = p.fillFromExecnameWithContext(ctx) + } + return exe, err +} + +func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { + return p.fillFromCmdlineWithContext(ctx) +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + return p.fillSliceFromCmdlineWithContext(ctx) +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) CwdWithContext(ctx context.Context) (string, error) { + return p.fillFromPathCwdWithContext(ctx) +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + _, fnames, err := p.fillFromfdListWithContext(ctx) + return int32(len(fnames)), err +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + return nil, common.ErrNotImplementedError +} + +/** +** Internal functions +**/ + +func (p *Process) fillFromfdListWithContext(ctx context.Context) (string, []string, error) { + pid := p.Pid + statPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "fd") + d, err := os.Open(statPath) + if err != nil { + return statPath, []string{}, err + } + defer d.Close() + fnames, err := d.Readdirnames(-1) + return statPath, fnames, err +} + +func (p *Process) fillFromPathCwdWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "path", "cwd") + cwd, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return cwd, nil +} + +func (p *Process) fillFromPathAOutWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cwdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "path", "a.out") + exe, err := os.Readlink(cwdPath) + if err != nil { + return "", err + } + return exe, nil +} + +func (p *Process) fillFromExecnameWithContext(ctx context.Context) (string, error) { + pid := p.Pid + execNamePath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "execname") + exe, err := os.ReadFile(execNamePath) + if err != nil { + return "", err + } + return string(exe), nil +} + +func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return "", err + } + ret := strings.FieldsFunc(string(cmdline), func(r rune) bool { + if r == '\u0000' { + return true + } + return false + }) + + return strings.Join(ret, " "), nil +} + +func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string, error) { + pid := p.Pid + cmdPath := common.HostProcWithContext(ctx, strconv.Itoa(int(pid)), "cmdline") + cmdline, err := os.ReadFile(cmdPath) + if err != nil { + return nil, err + } + if len(cmdline) == 0 { + return nil, nil + } + if cmdline[len(cmdline)-1] == 0 { + cmdline = cmdline[:len(cmdline)-1] + } + parts := bytes.Split(cmdline, []byte{0}) + var strParts []string + for _, p := range parts { + strParts = append(strParts, string(p)) + } + + return strParts, nil +} + +func readPidsFromDir(path string) ([]int32, error) { + var ret []int32 + + d, err := os.Open(path) + if err != nil { + return nil, err + } + defer d.Close() + + fnames, err := d.Readdirnames(-1) + if err != nil { + return nil, err + } + for _, fname := range fnames { + pid, err := strconv.ParseInt(fname, 10, 32) + if err != nil { + // if not numeric name, just skip + continue + } + ret = append(ret, int32(pid)) + } + + return ret, nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go b/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go new file mode 100644 index 00000000..14ed0309 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go @@ -0,0 +1,1165 @@ +//go:build windows +// +build windows + +package process + +import ( + "bufio" + "context" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "reflect" + "strings" + "syscall" + "time" + "unicode/utf16" + "unsafe" + + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/internal/common" + "github.com/shirou/gopsutil/v3/net" + "golang.org/x/sys/windows" +) + +type Signal = syscall.Signal + +var ( + modntdll = windows.NewLazySystemDLL("ntdll.dll") + procNtResumeProcess = modntdll.NewProc("NtResumeProcess") + procNtSuspendProcess = modntdll.NewProc("NtSuspendProcess") + + modpsapi = windows.NewLazySystemDLL("psapi.dll") + procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo") + procGetProcessImageFileNameW = modpsapi.NewProc("GetProcessImageFileNameW") + + advapi32 = windows.NewLazySystemDLL("advapi32.dll") + procLookupPrivilegeValue = advapi32.NewProc("LookupPrivilegeValueW") + procAdjustTokenPrivileges = advapi32.NewProc("AdjustTokenPrivileges") + + procQueryFullProcessImageNameW = common.Modkernel32.NewProc("QueryFullProcessImageNameW") + procGetPriorityClass = common.Modkernel32.NewProc("GetPriorityClass") + procGetProcessIoCounters = common.Modkernel32.NewProc("GetProcessIoCounters") + procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") + + processorArchitecture uint +) + +const processQueryInformation = windows.PROCESS_QUERY_LIMITED_INFORMATION + +type systemProcessorInformation struct { + ProcessorArchitecture uint16 + ProcessorLevel uint16 + ProcessorRevision uint16 + Reserved uint16 + ProcessorFeatureBits uint16 +} + +type systemInfo struct { + wProcessorArchitecture uint16 + wReserved uint16 + dwpageSize uint32 + lpMinimumApplicationAddress uintptr + lpMaximumApplicationAddress uintptr + dwActiveProcessorMask uintptr + dwNumberOfProcessors uint32 + dwProcessorType uint32 + dwAllocationGranularity uint32 + wProcessorLevel uint16 + wProcessorRevision uint16 +} + +// Memory_info_ex is different between OSes +type MemoryInfoExStat struct{} + +type MemoryMapsStat struct{} + +// ioCounters is an equivalent representation of IO_COUNTERS in the Windows API. +// https://docs.microsoft.com/windows/win32/api/winnt/ns-winnt-io_counters +type ioCounters struct { + ReadOperationCount uint64 + WriteOperationCount uint64 + OtherOperationCount uint64 + ReadTransferCount uint64 + WriteTransferCount uint64 + OtherTransferCount uint64 +} + +type processBasicInformation32 struct { + Reserved1 uint32 + PebBaseAddress uint32 + Reserved2 uint32 + Reserved3 uint32 + UniqueProcessId uint32 + Reserved4 uint32 +} + +type processBasicInformation64 struct { + Reserved1 uint64 + PebBaseAddress uint64 + Reserved2 uint64 + Reserved3 uint64 + UniqueProcessId uint64 + Reserved4 uint64 +} + +type processEnvironmentBlock32 struct { + Reserved1 [2]uint8 + BeingDebugged uint8 + Reserved2 uint8 + Reserved3 [2]uint32 + Ldr uint32 + ProcessParameters uint32 + // More fields which we don't use so far +} + +type processEnvironmentBlock64 struct { + Reserved1 [2]uint8 + BeingDebugged uint8 + Reserved2 uint8 + _ [4]uint8 // padding, since we are 64 bit, the next pointer is 64 bit aligned (when compiling for 32 bit, this is not the case without manual padding) + Reserved3 [2]uint64 + Ldr uint64 + ProcessParameters uint64 + // More fields which we don't use so far +} + +type rtlUserProcessParameters32 struct { + Reserved1 [16]uint8 + ConsoleHandle uint32 + ConsoleFlags uint32 + StdInputHandle uint32 + StdOutputHandle uint32 + StdErrorHandle uint32 + CurrentDirectoryPathNameLength uint16 + _ uint16 // Max Length + CurrentDirectoryPathAddress uint32 + CurrentDirectoryHandle uint32 + DllPathNameLength uint16 + _ uint16 // Max Length + DllPathAddress uint32 + ImagePathNameLength uint16 + _ uint16 // Max Length + ImagePathAddress uint32 + CommandLineLength uint16 + _ uint16 // Max Length + CommandLineAddress uint32 + EnvironmentAddress uint32 + // More fields which we don't use so far +} + +type rtlUserProcessParameters64 struct { + Reserved1 [16]uint8 + ConsoleHandle uint64 + ConsoleFlags uint64 + StdInputHandle uint64 + StdOutputHandle uint64 + StdErrorHandle uint64 + CurrentDirectoryPathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + CurrentDirectoryPathAddress uint64 + CurrentDirectoryHandle uint64 + DllPathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + DllPathAddress uint64 + ImagePathNameLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + ImagePathAddress uint64 + CommandLineLength uint16 + _ uint16 // Max Length + _ uint32 // Padding + CommandLineAddress uint64 + EnvironmentAddress uint64 + // More fields which we don't use so far +} + +type winLUID struct { + LowPart winDWord + HighPart winLong +} + +// LUID_AND_ATTRIBUTES +type winLUIDAndAttributes struct { + Luid winLUID + Attributes winDWord +} + +// TOKEN_PRIVILEGES +type winTokenPrivileges struct { + PrivilegeCount winDWord + Privileges [1]winLUIDAndAttributes +} + +type ( + winLong int32 + winDWord uint32 +) + +func init() { + var systemInfo systemInfo + + procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&systemInfo))) + processorArchitecture = uint(systemInfo.wProcessorArchitecture) + + // enable SeDebugPrivilege https://github.com/midstar/proci/blob/6ec79f57b90ba3d9efa2a7b16ef9c9369d4be875/proci_windows.go#L80-L119 + handle, err := syscall.GetCurrentProcess() + if err != nil { + return + } + + var token syscall.Token + err = syscall.OpenProcessToken(handle, 0x0028, &token) + if err != nil { + return + } + defer token.Close() + + tokenPrivileges := winTokenPrivileges{PrivilegeCount: 1} + lpName := syscall.StringToUTF16("SeDebugPrivilege") + ret, _, _ := procLookupPrivilegeValue.Call( + 0, + uintptr(unsafe.Pointer(&lpName[0])), + uintptr(unsafe.Pointer(&tokenPrivileges.Privileges[0].Luid))) + if ret == 0 { + return + } + + tokenPrivileges.Privileges[0].Attributes = 0x00000002 // SE_PRIVILEGE_ENABLED + + procAdjustTokenPrivileges.Call( + uintptr(token), + 0, + uintptr(unsafe.Pointer(&tokenPrivileges)), + uintptr(unsafe.Sizeof(tokenPrivileges)), + 0, + 0) +} + +func pidsWithContext(ctx context.Context) ([]int32, error) { + // inspired by https://gist.github.com/henkman/3083408 + // and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329 + var ret []int32 + var read uint32 = 0 + var psSize uint32 = 1024 + const dwordSize uint32 = 4 + + for { + ps := make([]uint32, psSize) + if err := windows.EnumProcesses(ps, &read); err != nil { + return nil, err + } + if uint32(len(ps)) == read { // ps buffer was too small to host every results, retry with a bigger one + psSize += 1024 + continue + } + for _, pid := range ps[:read/dwordSize] { + ret = append(ret, int32(pid)) + } + return ret, nil + + } +} + +func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { + if pid == 0 { // special case for pid 0 System Idle Process + return true, nil + } + if pid < 0 { + return false, fmt.Errorf("invalid pid %v", pid) + } + if pid%4 != 0 { + // OpenProcess will succeed even on non-existing pid here https://devblogs.microsoft.com/oldnewthing/20080606-00/?p=22043 + // so we list every pid just to be sure and be future-proof + pids, err := PidsWithContext(ctx) + if err != nil { + return false, err + } + for _, i := range pids { + if i == pid { + return true, err + } + } + return false, err + } + h, err := windows.OpenProcess(windows.SYNCHRONIZE, false, uint32(pid)) + if err == windows.ERROR_ACCESS_DENIED { + return true, nil + } + if err == windows.ERROR_INVALID_PARAMETER { + return false, nil + } + if err != nil { + return false, err + } + defer windows.CloseHandle(h) + event, err := windows.WaitForSingleObject(h, 0) + return event == uint32(windows.WAIT_TIMEOUT), err +} + +func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { + // if cached already, return from cache + cachedPpid := p.getPpid() + if cachedPpid != 0 { + return cachedPpid, nil + } + + ppid, _, _, err := getFromSnapProcess(p.Pid) + if err != nil { + return 0, err + } + + // no errors and not cached already, so cache it + p.setPpid(ppid) + + return ppid, nil +} + +func (p *Process) NameWithContext(ctx context.Context) (string, error) { + if p.Pid == 0 { + return "System Idle Process", nil + } + if p.Pid == 4 { + return "System", nil + } + + exe, err := p.ExeWithContext(ctx) + if err != nil { + return "", fmt.Errorf("could not get Name: %s", err) + } + + return filepath.Base(exe), nil +} + +func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) ExeWithContext(ctx context.Context) (string, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return "", err + } + defer windows.CloseHandle(c) + buf := make([]uint16, syscall.MAX_LONG_PATH) + size := uint32(syscall.MAX_LONG_PATH) + if err := procQueryFullProcessImageNameW.Find(); err == nil { // Vista+ + ret, _, err := procQueryFullProcessImageNameW.Call( + uintptr(c), + uintptr(0), + uintptr(unsafe.Pointer(&buf[0])), + uintptr(unsafe.Pointer(&size))) + if ret == 0 { + return "", err + } + return windows.UTF16ToString(buf[:]), nil + } + // XP fallback + ret, _, err := procGetProcessImageFileNameW.Call(uintptr(c), uintptr(unsafe.Pointer(&buf[0])), uintptr(size)) + if ret == 0 { + return "", err + } + return common.ConvertDOSPath(windows.UTF16ToString(buf[:])), nil +} + +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { + cmdline, err := getProcessCommandLine(p.Pid) + if err != nil { + return "", fmt.Errorf("could not get CommandLine: %s", err) + } + return cmdline, nil +} + +func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { + cmdline, err := p.CmdlineWithContext(ctx) + if err != nil { + return nil, err + } + return strings.Split(cmdline, " "), nil +} + +func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { + ru, err := getRusage(p.Pid) + if err != nil { + return 0, fmt.Errorf("could not get CreationDate: %s", err) + } + + return ru.CreationTime.Nanoseconds() / 1000000, nil +} + +func (p *Process) CwdWithContext(_ context.Context) (string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(p.Pid)) + if err == windows.ERROR_ACCESS_DENIED || err == windows.ERROR_INVALID_PARAMETER { + return "", nil + } + if err != nil { + return "", err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + if procIs32Bits { + userProcParams, err := getUserProcessParams32(h) + if err != nil { + return "", err + } + if userProcParams.CurrentDirectoryPathNameLength > 0 { + cwd := readProcessMemory(syscall.Handle(h), procIs32Bits, uint64(userProcParams.CurrentDirectoryPathAddress), uint(userProcParams.CurrentDirectoryPathNameLength)) + if len(cwd) != int(userProcParams.CurrentDirectoryPathNameLength) { + return "", errors.New("cannot read current working directory") + } + + return convertUTF16ToString(cwd), nil + } + } else { + userProcParams, err := getUserProcessParams64(h) + if err != nil { + return "", err + } + if userProcParams.CurrentDirectoryPathNameLength > 0 { + cwd := readProcessMemory(syscall.Handle(h), procIs32Bits, userProcParams.CurrentDirectoryPathAddress, uint(userProcParams.CurrentDirectoryPathNameLength)) + if len(cwd) != int(userProcParams.CurrentDirectoryPathNameLength) { + return "", errors.New("cannot read current working directory") + } + + return convertUTF16ToString(cwd), nil + } + } + + // if we reach here, we have no cwd + return "", nil +} + +func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { + return []string{""}, common.ErrNotImplementedError +} + +func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { + return false, common.ErrNotImplementedError +} + +func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { + pid := p.Pid + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return "", err + } + defer windows.CloseHandle(c) + + var token syscall.Token + err = syscall.OpenProcessToken(syscall.Handle(c), syscall.TOKEN_QUERY, &token) + if err != nil { + return "", err + } + defer token.Close() + tokenUser, err := token.GetTokenUser() + if err != nil { + return "", err + } + + user, domain, _, err := tokenUser.User.Sid.LookupAccount("") + return domain + "\\" + user, err +} + +func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { + return "", common.ErrNotImplementedError +} + +// priorityClasses maps a win32 priority class to its WMI equivalent Win32_Process.Priority +// https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getpriorityclass +// https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-process +var priorityClasses = map[int]int32{ + 0x00008000: 10, // ABOVE_NORMAL_PRIORITY_CLASS + 0x00004000: 6, // BELOW_NORMAL_PRIORITY_CLASS + 0x00000080: 13, // HIGH_PRIORITY_CLASS + 0x00000040: 4, // IDLE_PRIORITY_CLASS + 0x00000020: 8, // NORMAL_PRIORITY_CLASS + 0x00000100: 24, // REALTIME_PRIORITY_CLASS +} + +func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return 0, err + } + defer windows.CloseHandle(c) + ret, _, err := procGetPriorityClass.Call(uintptr(c)) + if ret == 0 { + return 0, err + } + priority, ok := priorityClasses[int(ret)] + if !ok { + return 0, fmt.Errorf("unknown priority class %v", ret) + } + return priority, nil +} + +func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { + c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) + if err != nil { + return nil, err + } + defer windows.CloseHandle(c) + var ioCounters ioCounters + ret, _, err := procGetProcessIoCounters.Call(uintptr(c), uintptr(unsafe.Pointer(&ioCounters))) + if ret == 0 { + return nil, err + } + stats := &IOCountersStat{ + ReadCount: ioCounters.ReadOperationCount, + ReadBytes: ioCounters.ReadTransferCount, + WriteCount: ioCounters.WriteOperationCount, + WriteBytes: ioCounters.WriteTransferCount, + } + + return stats, nil +} + +func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { + return 0, common.ErrNotImplementedError +} + +func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { + ppid, ret, _, err := getFromSnapProcess(p.Pid) + if err != nil { + return 0, err + } + + // if no errors and not cached already, cache ppid + p.parent = ppid + if 0 == p.getPpid() { + p.setPpid(ppid) + } + + return ret, nil +} + +func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { + sysTimes, err := getProcessCPUTimes(p.Pid) + if err != nil { + return nil, err + } + + // User and kernel times are represented as a FILETIME structure + // which contains a 64-bit value representing the number of + // 100-nanosecond intervals since January 1, 1601 (UTC): + // http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx + // To convert it into a float representing the seconds that the + // process has executed in user/kernel mode I borrowed the code + // below from psutil's _psutil_windows.c, and in turn from Python's + // Modules/posixmodule.c + + user := float64(sysTimes.UserTime.HighDateTime)*429.4967296 + float64(sysTimes.UserTime.LowDateTime)*1e-7 + kernel := float64(sysTimes.KernelTime.HighDateTime)*429.4967296 + float64(sysTimes.KernelTime.LowDateTime)*1e-7 + + return &cpu.TimesStat{ + User: user, + System: kernel, + }, nil +} + +func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { + mem, err := getMemoryInfo(p.Pid) + if err != nil { + return nil, err + } + + ret := &MemoryInfoStat{ + RSS: uint64(mem.WorkingSetSize), + VMS: uint64(mem.PagefileUsage), + } + + return ret, nil +} + +func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + snap, err := windows.CreateToolhelp32Snapshot(windows.TH32CS_SNAPPROCESS, uint32(0)) + if err != nil { + return out, err + } + defer windows.CloseHandle(snap) + var pe32 windows.ProcessEntry32 + pe32.Size = uint32(unsafe.Sizeof(pe32)) + if err := windows.Process32First(snap, &pe32); err != nil { + return out, err + } + for { + if pe32.ParentProcessID == uint32(p.Pid) { + p, err := NewProcessWithContext(ctx, int32(pe32.ProcessID)) + if err == nil { + out = append(out, p) + } + } + if err = windows.Process32Next(snap, &pe32); err != nil { + break + } + } + return out, nil +} + +func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { + files := make([]OpenFilesStat, 0) + fileExists := make(map[string]bool) + + process, err := windows.OpenProcess(common.ProcessQueryInformation, false, uint32(p.Pid)) + if err != nil { + return nil, err + } + + buffer := make([]byte, 1024) + var size uint32 + + st := common.CallWithExpandingBuffer( + func() common.NtStatus { + return common.NtQuerySystemInformation( + common.SystemExtendedHandleInformationClass, + &buffer[0], + uint32(len(buffer)), + &size, + ) + }, + &buffer, + &size, + ) + if st.IsError() { + return nil, st.Error() + } + + handlesList := (*common.SystemExtendedHandleInformation)(unsafe.Pointer(&buffer[0])) + handles := make([]common.SystemExtendedHandleTableEntryInformation, int(handlesList.NumberOfHandles)) + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&handles)) + hdr.Data = uintptr(unsafe.Pointer(&handlesList.Handles[0])) + + currentProcess, err := windows.GetCurrentProcess() + if err != nil { + return nil, err + } + + for _, handle := range handles { + var file uintptr + if int32(handle.UniqueProcessId) != p.Pid { + continue + } + if windows.DuplicateHandle(process, windows.Handle(handle.HandleValue), currentProcess, (*windows.Handle)(&file), + 0, true, windows.DUPLICATE_SAME_ACCESS) != nil { + continue + } + // release the new handle + defer windows.CloseHandle(windows.Handle(file)) + + fileType, err := windows.GetFileType(windows.Handle(file)) + if err != nil || fileType != windows.FILE_TYPE_DISK { + continue + } + + var fileName string + ch := make(chan struct{}) + + go func() { + var buf [syscall.MAX_LONG_PATH]uint16 + n, err := windows.GetFinalPathNameByHandle(windows.Handle(file), &buf[0], syscall.MAX_LONG_PATH, 0) + if err != nil { + return + } + + fileName = string(utf16.Decode(buf[:n])) + ch <- struct{}{} + }() + + select { + case <-time.NewTimer(100 * time.Millisecond).C: + continue + case <-ch: + fileInfo, err := os.Stat(fileName) + if err != nil || fileInfo.IsDir() { + continue + } + + if _, exists := fileExists[fileName]; !exists { + files = append(files, OpenFilesStat{ + Path: fileName, + Fd: uint64(file), + }) + fileExists[fileName] = true + } + case <-ctx.Done(): + return files, ctx.Err() + } + } + + return files, nil +} + +func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { + return net.ConnectionsPidWithContext(ctx, "all", p.Pid) +} + +func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { + return nil, common.ErrNotImplementedError +} + +func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { + return common.ErrNotImplementedError +} + +func (p *Process) SuspendWithContext(ctx context.Context) error { + c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) + if err != nil { + return err + } + defer windows.CloseHandle(c) + + r1, _, _ := procNtSuspendProcess.Call(uintptr(c)) + if r1 != 0 { + // See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + return fmt.Errorf("NtStatus='0x%.8X'", r1) + } + + return nil +} + +func (p *Process) ResumeWithContext(ctx context.Context) error { + c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) + if err != nil { + return err + } + defer windows.CloseHandle(c) + + r1, _, _ := procNtResumeProcess.Call(uintptr(c)) + if r1 != 0 { + // See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + return fmt.Errorf("NtStatus='0x%.8X'", r1) + } + + return nil +} + +func (p *Process) TerminateWithContext(ctx context.Context) error { + proc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, false, uint32(p.Pid)) + if err != nil { + return err + } + err = windows.TerminateProcess(proc, 0) + windows.CloseHandle(proc) + return err +} + +func (p *Process) KillWithContext(ctx context.Context) error { + process, err := os.FindProcess(int(p.Pid)) + if err != nil { + return err + } + return process.Kill() +} + +func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { + envVars, err := getProcessEnvironmentVariables(p.Pid, ctx) + if err != nil { + return nil, fmt.Errorf("could not get environment variables: %s", err) + } + return envVars, nil +} + +// retrieve Ppid in a thread-safe manner +func (p *Process) getPpid() int32 { + p.parentMutex.RLock() + defer p.parentMutex.RUnlock() + return p.parent +} + +// cache Ppid in a thread-safe manner (WINDOWS ONLY) +// see https://psutil.readthedocs.io/en/latest/#psutil.Process.ppid +func (p *Process) setPpid(ppid int32) { + p.parentMutex.Lock() + defer p.parentMutex.Unlock() + p.parent = ppid +} + +func getFromSnapProcess(pid int32) (int32, int32, string, error) { + snap, err := windows.CreateToolhelp32Snapshot(windows.TH32CS_SNAPPROCESS, uint32(pid)) + if err != nil { + return 0, 0, "", err + } + defer windows.CloseHandle(snap) + var pe32 windows.ProcessEntry32 + pe32.Size = uint32(unsafe.Sizeof(pe32)) + if err = windows.Process32First(snap, &pe32); err != nil { + return 0, 0, "", err + } + for { + if pe32.ProcessID == uint32(pid) { + szexe := windows.UTF16ToString(pe32.ExeFile[:]) + return int32(pe32.ParentProcessID), int32(pe32.Threads), szexe, nil + } + if err = windows.Process32Next(snap, &pe32); err != nil { + break + } + } + return 0, 0, "", fmt.Errorf("couldn't find pid: %d", pid) +} + +func ProcessesWithContext(ctx context.Context) ([]*Process, error) { + out := []*Process{} + + pids, err := PidsWithContext(ctx) + if err != nil { + return out, fmt.Errorf("could not get Processes %s", err) + } + + for _, pid := range pids { + p, err := NewProcessWithContext(ctx, pid) + if err != nil { + continue + } + out = append(out, p) + } + + return out, nil +} + +func getRusage(pid int32) (*windows.Rusage, error) { + var CPU windows.Rusage + + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return nil, err + } + defer windows.CloseHandle(c) + + if err := windows.GetProcessTimes(c, &CPU.CreationTime, &CPU.ExitTime, &CPU.KernelTime, &CPU.UserTime); err != nil { + return nil, err + } + + return &CPU, nil +} + +func getMemoryInfo(pid int32) (PROCESS_MEMORY_COUNTERS, error) { + var mem PROCESS_MEMORY_COUNTERS + c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return mem, err + } + defer windows.CloseHandle(c) + if err := getProcessMemoryInfo(c, &mem); err != nil { + return mem, err + } + + return mem, err +} + +func getProcessMemoryInfo(h windows.Handle, mem *PROCESS_MEMORY_COUNTERS) (err error) { + r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(h), uintptr(unsafe.Pointer(mem)), uintptr(unsafe.Sizeof(*mem))) + if r1 == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +type SYSTEM_TIMES struct { + CreateTime syscall.Filetime + ExitTime syscall.Filetime + KernelTime syscall.Filetime + UserTime syscall.Filetime +} + +func getProcessCPUTimes(pid int32) (SYSTEM_TIMES, error) { + var times SYSTEM_TIMES + + h, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) + if err != nil { + return times, err + } + defer windows.CloseHandle(h) + + err = syscall.GetProcessTimes( + syscall.Handle(h), + ×.CreateTime, + ×.ExitTime, + ×.KernelTime, + ×.UserTime, + ) + + return times, err +} + +func getUserProcessParams32(handle windows.Handle) (rtlUserProcessParameters32, error) { + pebAddress, err := queryPebAddress(syscall.Handle(handle), true) + if err != nil { + return rtlUserProcessParameters32{}, fmt.Errorf("cannot locate process PEB: %w", err) + } + + buf := readProcessMemory(syscall.Handle(handle), true, pebAddress, uint(unsafe.Sizeof(processEnvironmentBlock32{}))) + if len(buf) != int(unsafe.Sizeof(processEnvironmentBlock32{})) { + return rtlUserProcessParameters32{}, fmt.Errorf("cannot read process PEB") + } + peb := (*processEnvironmentBlock32)(unsafe.Pointer(&buf[0])) + userProcessAddress := uint64(peb.ProcessParameters) + buf = readProcessMemory(syscall.Handle(handle), true, userProcessAddress, uint(unsafe.Sizeof(rtlUserProcessParameters32{}))) + if len(buf) != int(unsafe.Sizeof(rtlUserProcessParameters32{})) { + return rtlUserProcessParameters32{}, fmt.Errorf("cannot read user process parameters") + } + return *(*rtlUserProcessParameters32)(unsafe.Pointer(&buf[0])), nil +} + +func getUserProcessParams64(handle windows.Handle) (rtlUserProcessParameters64, error) { + pebAddress, err := queryPebAddress(syscall.Handle(handle), false) + if err != nil { + return rtlUserProcessParameters64{}, fmt.Errorf("cannot locate process PEB: %w", err) + } + + buf := readProcessMemory(syscall.Handle(handle), false, pebAddress, uint(unsafe.Sizeof(processEnvironmentBlock64{}))) + if len(buf) != int(unsafe.Sizeof(processEnvironmentBlock64{})) { + return rtlUserProcessParameters64{}, fmt.Errorf("cannot read process PEB") + } + peb := (*processEnvironmentBlock64)(unsafe.Pointer(&buf[0])) + userProcessAddress := peb.ProcessParameters + buf = readProcessMemory(syscall.Handle(handle), false, userProcessAddress, uint(unsafe.Sizeof(rtlUserProcessParameters64{}))) + if len(buf) != int(unsafe.Sizeof(rtlUserProcessParameters64{})) { + return rtlUserProcessParameters64{}, fmt.Errorf("cannot read user process parameters") + } + return *(*rtlUserProcessParameters64)(unsafe.Pointer(&buf[0])), nil +} + +func is32BitProcess(h windows.Handle) bool { + const ( + PROCESSOR_ARCHITECTURE_INTEL = 0 + PROCESSOR_ARCHITECTURE_ARM = 5 + PROCESSOR_ARCHITECTURE_ARM64 = 12 + PROCESSOR_ARCHITECTURE_IA64 = 6 + PROCESSOR_ARCHITECTURE_AMD64 = 9 + ) + + var procIs32Bits bool + switch processorArchitecture { + case PROCESSOR_ARCHITECTURE_INTEL, PROCESSOR_ARCHITECTURE_ARM: + procIs32Bits = true + case PROCESSOR_ARCHITECTURE_ARM64, PROCESSOR_ARCHITECTURE_IA64, PROCESSOR_ARCHITECTURE_AMD64: + var wow64 uint + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(h), + uintptr(common.ProcessWow64Information), + uintptr(unsafe.Pointer(&wow64)), + uintptr(unsafe.Sizeof(wow64)), + uintptr(0), + ) + if int(ret) >= 0 { + if wow64 != 0 { + procIs32Bits = true + } + } else { + // if the OS does not support the call, we fallback into the bitness of the app + if unsafe.Sizeof(wow64) == 4 { + procIs32Bits = true + } + } + + default: + // for other unknown platforms, we rely on process platform + if unsafe.Sizeof(processorArchitecture) == 8 { + procIs32Bits = false + } else { + procIs32Bits = true + } + } + return procIs32Bits +} + +func getProcessEnvironmentVariables(pid int32, ctx context.Context) ([]string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(pid)) + if err == windows.ERROR_ACCESS_DENIED || err == windows.ERROR_INVALID_PARAMETER { + return nil, nil + } + if err != nil { + return nil, err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + var processParameterBlockAddress uint64 + + if procIs32Bits { + peb, err := getUserProcessParams32(h) + if err != nil { + return nil, err + } + processParameterBlockAddress = uint64(peb.EnvironmentAddress) + } else { + peb, err := getUserProcessParams64(h) + if err != nil { + return nil, err + } + processParameterBlockAddress = peb.EnvironmentAddress + } + envvarScanner := bufio.NewScanner(&processReader{ + processHandle: h, + is32BitProcess: procIs32Bits, + offset: processParameterBlockAddress, + }) + envvarScanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) { + if atEOF && len(data) == 0 { + return 0, nil, nil + } + // Check for UTF-16 zero character + for i := 0; i < len(data)-1; i += 2 { + if data[i] == 0 && data[i+1] == 0 { + return i + 2, data[0:i], nil + } + } + if atEOF { + return len(data), data, nil + } + // Request more data + return 0, nil, nil + }) + var envVars []string + for envvarScanner.Scan() { + entry := envvarScanner.Bytes() + if len(entry) == 0 { + break // Block is finished + } + envVars = append(envVars, convertUTF16ToString(entry)) + select { + case <-ctx.Done(): + break + default: + continue + } + } + if err := envvarScanner.Err(); err != nil { + return nil, err + } + return envVars, nil +} + +type processReader struct { + processHandle windows.Handle + is32BitProcess bool + offset uint64 +} + +func (p *processReader) Read(buf []byte) (int, error) { + processMemory := readProcessMemory(syscall.Handle(p.processHandle), p.is32BitProcess, p.offset, uint(len(buf))) + if len(processMemory) == 0 { + return 0, io.EOF + } + copy(buf, processMemory) + p.offset += uint64(len(processMemory)) + return len(processMemory), nil +} + +func getProcessCommandLine(pid int32) (string, error) { + h, err := windows.OpenProcess(processQueryInformation|windows.PROCESS_VM_READ, false, uint32(pid)) + if err == windows.ERROR_ACCESS_DENIED || err == windows.ERROR_INVALID_PARAMETER { + return "", nil + } + if err != nil { + return "", err + } + defer syscall.CloseHandle(syscall.Handle(h)) + + procIs32Bits := is32BitProcess(h) + + if procIs32Bits { + userProcParams, err := getUserProcessParams32(h) + if err != nil { + return "", err + } + if userProcParams.CommandLineLength > 0 { + cmdLine := readProcessMemory(syscall.Handle(h), procIs32Bits, uint64(userProcParams.CommandLineAddress), uint(userProcParams.CommandLineLength)) + if len(cmdLine) != int(userProcParams.CommandLineLength) { + return "", errors.New("cannot read cmdline") + } + + return convertUTF16ToString(cmdLine), nil + } + } else { + userProcParams, err := getUserProcessParams64(h) + if err != nil { + return "", err + } + if userProcParams.CommandLineLength > 0 { + cmdLine := readProcessMemory(syscall.Handle(h), procIs32Bits, userProcParams.CommandLineAddress, uint(userProcParams.CommandLineLength)) + if len(cmdLine) != int(userProcParams.CommandLineLength) { + return "", errors.New("cannot read cmdline") + } + + return convertUTF16ToString(cmdLine), nil + } + } + + // if we reach here, we have no command line + return "", nil +} + +func convertUTF16ToString(src []byte) string { + srcLen := len(src) / 2 + + codePoints := make([]uint16, srcLen) + + srcIdx := 0 + for i := 0; i < srcLen; i++ { + codePoints[i] = uint16(src[srcIdx]) | uint16(src[srcIdx+1])<<8 + srcIdx += 2 + } + return syscall.UTF16ToString(codePoints) +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_windows_32bit.go b/vendor/github.com/shirou/gopsutil/v3/process/process_windows_32bit.go new file mode 100644 index 00000000..db4d4533 --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_windows_32bit.go @@ -0,0 +1,108 @@ +//go:build (windows && 386) || (windows && arm) +// +build windows,386 windows,arm + +package process + +import ( + "errors" + "syscall" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/windows" +) + +type PROCESS_MEMORY_COUNTERS struct { + CB uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint32 + WorkingSetSize uint32 + QuotaPeakPagedPoolUsage uint32 + QuotaPagedPoolUsage uint32 + QuotaPeakNonPagedPoolUsage uint32 + QuotaNonPagedPoolUsage uint32 + PagefileUsage uint32 + PeakPagefileUsage uint32 +} + +func queryPebAddress(procHandle syscall.Handle, is32BitProcess bool) (uint64, error) { + if is32BitProcess { + // we are on a 32-bit process reading an external 32-bit process + var info processBasicInformation32 + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return uint64(info.PebBaseAddress), nil + } else { + return 0, windows.NTStatus(ret) + } + } else { + // we are on a 32-bit process reading an external 64-bit process + if common.ProcNtWow64QueryInformationProcess64.Find() == nil { // avoid panic + var info processBasicInformation64 + + ret, _, _ := common.ProcNtWow64QueryInformationProcess64.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return info.PebBaseAddress, nil + } else { + return 0, windows.NTStatus(ret) + } + } else { + return 0, errors.New("can't find API to query 64 bit process from 32 bit") + } + } +} + +func readProcessMemory(h syscall.Handle, is32BitProcess bool, address uint64, size uint) []byte { + if is32BitProcess { + var read uint + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtReadVirtualMemory.Call( + uintptr(h), + uintptr(address), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:read] + } + } else { + // reading a 64-bit process from a 32-bit one + if common.ProcNtWow64ReadVirtualMemory64.Find() == nil { // avoid panic + var read uint64 + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtWow64ReadVirtualMemory64.Call( + uintptr(h), + uintptr(address&0xFFFFFFFF), // the call expects a 64-bit value + uintptr(address>>32), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), // the call expects a 64-bit value + uintptr(0), // but size is 32-bit so pass zero as the high dword + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:uint(read)] + } + } + } + + // if we reach here, an error happened + return nil +} diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_windows_64bit.go b/vendor/github.com/shirou/gopsutil/v3/process/process_windows_64bit.go new file mode 100644 index 00000000..74c6212c --- /dev/null +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_windows_64bit.go @@ -0,0 +1,79 @@ +//go:build (windows && amd64) || (windows && arm64) +// +build windows,amd64 windows,arm64 + +package process + +import ( + "syscall" + "unsafe" + + "github.com/shirou/gopsutil/v3/internal/common" + "golang.org/x/sys/windows" +) + +type PROCESS_MEMORY_COUNTERS struct { + CB uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint64 + WorkingSetSize uint64 + QuotaPeakPagedPoolUsage uint64 + QuotaPagedPoolUsage uint64 + QuotaPeakNonPagedPoolUsage uint64 + QuotaNonPagedPoolUsage uint64 + PagefileUsage uint64 + PeakPagefileUsage uint64 +} + +func queryPebAddress(procHandle syscall.Handle, is32BitProcess bool) (uint64, error) { + if is32BitProcess { + // we are on a 64-bit process reading an external 32-bit process + var wow64 uint + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessWow64Information), + uintptr(unsafe.Pointer(&wow64)), + uintptr(unsafe.Sizeof(wow64)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return uint64(wow64), nil + } else { + return 0, windows.NTStatus(ret) + } + } else { + // we are on a 64-bit process reading an external 64-bit process + var info processBasicInformation64 + + ret, _, _ := common.ProcNtQueryInformationProcess.Call( + uintptr(procHandle), + uintptr(common.ProcessBasicInformation), + uintptr(unsafe.Pointer(&info)), + uintptr(unsafe.Sizeof(info)), + uintptr(0), + ) + if status := windows.NTStatus(ret); status == windows.STATUS_SUCCESS { + return info.PebBaseAddress, nil + } else { + return 0, windows.NTStatus(ret) + } + } +} + +func readProcessMemory(procHandle syscall.Handle, _ bool, address uint64, size uint) []byte { + var read uint + + buffer := make([]byte, size) + + ret, _, _ := common.ProcNtReadVirtualMemory.Call( + uintptr(procHandle), + uintptr(address), + uintptr(unsafe.Pointer(&buffer[0])), + uintptr(size), + uintptr(unsafe.Pointer(&read)), + ) + if int(ret) >= 0 && read > 0 { + return buffer[:read] + } + return nil +} diff --git a/vendor/github.com/shoenig/go-m1cpu/.golangci.yaml b/vendor/github.com/shoenig/go-m1cpu/.golangci.yaml new file mode 100644 index 00000000..dc6fefb9 --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/.golangci.yaml @@ -0,0 +1,12 @@ +run: + timeout: 5m +linters: + enable: + - gofmt + - errcheck + - errname + - errorlint + - bodyclose + - durationcheck + - whitespace + diff --git a/vendor/github.com/shoenig/go-m1cpu/LICENSE b/vendor/github.com/shoenig/go-m1cpu/LICENSE new file mode 100644 index 00000000..e87a115e --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/LICENSE @@ -0,0 +1,363 @@ +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + diff --git a/vendor/github.com/shoenig/go-m1cpu/Makefile b/vendor/github.com/shoenig/go-m1cpu/Makefile new file mode 100644 index 00000000..28d78639 --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/Makefile @@ -0,0 +1,12 @@ +SHELL = bash + +default: test + +.PHONY: test +test: + @echo "--> Running Tests ..." + @go test -v -race ./... + +vet: + @echo "--> Vet Go sources ..." + @go vet ./... diff --git a/vendor/github.com/shoenig/go-m1cpu/README.md b/vendor/github.com/shoenig/go-m1cpu/README.md new file mode 100644 index 00000000..399657ac --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/README.md @@ -0,0 +1,66 @@ +# m1cpu + +[![Go Reference](https://pkg.go.dev/badge/github.com/shoenig/go-m1cpu.svg)](https://pkg.go.dev/github.com/shoenig/go-m1cpu) +[![MPL License](https://img.shields.io/github/license/shoenig/go-m1cpu?color=g&style=flat-square)](https://github.com/shoenig/go-m1cpu/blob/main/LICENSE) +[![Run CI Tests](https://github.com/shoenig/go-m1cpu/actions/workflows/ci.yaml/badge.svg)](https://github.com/shoenig/go-m1cpu/actions/workflows/ci.yaml) + +The `go-m1cpu` module is a library for inspecting Apple Silicon CPUs in Go. + +Use the `m1cpu` Go package for looking up the CPU frequency for Apple M1 and M2 CPUs. + +# Install + +```shell +go get github.com/shoenig/go-m1cpu@latest +``` + +# CGO + +This package requires the use of [CGO](https://go.dev/blog/cgo). + +Extracting the CPU properties is done via Apple's [IOKit](https://developer.apple.com/documentation/iokit?language=objc) +framework, which is accessible only through system C libraries. + +# Example + +Simple Go program to print Apple Silicon M1/M2 CPU speeds. + +```go +package main + +import ( + "fmt" + + "github.com/shoenig/go-m1cpu" +) + +func main() { + fmt.Println("Apple Silicon", m1cpu.IsAppleSilicon()) + + fmt.Println("pCore GHz", m1cpu.PCoreGHz()) + fmt.Println("eCore GHz", m1cpu.ECoreGHz()) + + fmt.Println("pCore Hz", m1cpu.PCoreHz()) + fmt.Println("eCore Hz", m1cpu.ECoreHz()) +} +``` + +Using `go test` to print out available information. + +``` +➜ go test -v -run Show +=== RUN Test_Show + cpu_test.go:42: pCore Hz 3504000000 + cpu_test.go:43: eCore Hz 2424000000 + cpu_test.go:44: pCore GHz 3.504 + cpu_test.go:45: eCore GHz 2.424 + cpu_test.go:46: pCore count 8 + cpu_test.go:47: eCoreCount 4 + cpu_test.go:50: pCore Caches 196608 131072 16777216 + cpu_test.go:53: eCore Caches 131072 65536 4194304 +--- PASS: Test_Show (0.00s) +``` + +# License + +Open source under the [MPL](LICENSE) diff --git a/vendor/github.com/shoenig/go-m1cpu/cpu.go b/vendor/github.com/shoenig/go-m1cpu/cpu.go new file mode 100644 index 00000000..502a8cce --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/cpu.go @@ -0,0 +1,213 @@ +//go:build darwin && arm64 && cgo + +package m1cpu + +// #cgo LDFLAGS: -framework CoreFoundation -framework IOKit +// #include +// #include +// #include +// #include +// +// #if !defined(MAC_OS_VERSION_12_0) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0 +// #define kIOMainPortDefault kIOMasterPortDefault +// #endif +// +// #define HzToGHz(hz) ((hz) / 1000000000.0) +// +// UInt64 global_pCoreHz; +// UInt64 global_eCoreHz; +// int global_pCoreCount; +// int global_eCoreCount; +// int global_pCoreL1InstCacheSize; +// int global_eCoreL1InstCacheSize; +// int global_pCoreL1DataCacheSize; +// int global_eCoreL1DataCacheSize; +// int global_pCoreL2CacheSize; +// int global_eCoreL2CacheSize; +// char global_brand[32]; +// +// UInt64 getFrequency(CFTypeRef typeRef) { +// CFDataRef cfData = typeRef; +// +// CFIndex size = CFDataGetLength(cfData); +// UInt8 buf[size]; +// CFDataGetBytes(cfData, CFRangeMake(0, size), buf); +// +// UInt8 b1 = buf[size-5]; +// UInt8 b2 = buf[size-6]; +// UInt8 b3 = buf[size-7]; +// UInt8 b4 = buf[size-8]; +// +// UInt64 pCoreHz = 0x00000000FFFFFFFF & ((b1<<24) | (b2 << 16) | (b3 << 8) | (b4)); +// return pCoreHz; +// } +// +// int sysctl_int(const char * name) { +// int value = -1; +// size_t size = 8; +// sysctlbyname(name, &value, &size, NULL, 0); +// return value; +// } +// +// void sysctl_string(const char * name, char * dest) { +// size_t size = 32; +// sysctlbyname(name, dest, &size, NULL, 0); +// } +// +// void initialize() { +// global_pCoreCount = sysctl_int("hw.perflevel0.physicalcpu"); +// global_eCoreCount = sysctl_int("hw.perflevel1.physicalcpu"); +// global_pCoreL1InstCacheSize = sysctl_int("hw.perflevel0.l1icachesize"); +// global_eCoreL1InstCacheSize = sysctl_int("hw.perflevel1.l1icachesize"); +// global_pCoreL1DataCacheSize = sysctl_int("hw.perflevel0.l1dcachesize"); +// global_eCoreL1DataCacheSize = sysctl_int("hw.perflevel1.l1dcachesize"); +// global_pCoreL2CacheSize = sysctl_int("hw.perflevel0.l2cachesize"); +// global_eCoreL2CacheSize = sysctl_int("hw.perflevel1.l2cachesize"); +// sysctl_string("machdep.cpu.brand_string", global_brand); +// +// CFMutableDictionaryRef matching = IOServiceMatching("AppleARMIODevice"); +// io_iterator_t iter; +// IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iter); +// +// const size_t bufsize = 512; +// io_object_t obj; +// while ((obj = IOIteratorNext(iter))) { +// char class[bufsize]; +// IOObjectGetClass(obj, class); +// char name[bufsize]; +// IORegistryEntryGetName(obj, name); +// +// if (strncmp(name, "pmgr", bufsize) == 0) { +// CFTypeRef pCoreRef = IORegistryEntryCreateCFProperty(obj, CFSTR("voltage-states5-sram"), kCFAllocatorDefault, 0); +// CFTypeRef eCoreRef = IORegistryEntryCreateCFProperty(obj, CFSTR("voltage-states1-sram"), kCFAllocatorDefault, 0); +// +// long long pCoreHz = getFrequency(pCoreRef); +// long long eCoreHz = getFrequency(eCoreRef); +// +// global_pCoreHz = pCoreHz; +// global_eCoreHz = eCoreHz; +// return; +// } +// } +// } +// +// UInt64 eCoreHz() { +// return global_eCoreHz; +// } +// +// UInt64 pCoreHz() { +// return global_pCoreHz; +// } +// +// Float64 eCoreGHz() { +// return HzToGHz(global_eCoreHz); +// } +// +// Float64 pCoreGHz() { +// return HzToGHz(global_pCoreHz); +// } +// +// int pCoreCount() { +// return global_pCoreCount; +// } +// +// int eCoreCount() { +// return global_eCoreCount; +// } +// +// int pCoreL1InstCacheSize() { +// return global_pCoreL1InstCacheSize; +// } +// +// int pCoreL1DataCacheSize() { +// return global_pCoreL1DataCacheSize; +// } +// +// int pCoreL2CacheSize() { +// return global_pCoreL2CacheSize; +// } +// +// int eCoreL1InstCacheSize() { +// return global_eCoreL1InstCacheSize; +// } +// +// int eCoreL1DataCacheSize() { +// return global_eCoreL1DataCacheSize; +// } +// +// int eCoreL2CacheSize() { +// return global_eCoreL2CacheSize; +// } +// +// char * modelName() { +// return global_brand; +// } +import "C" + +func init() { + C.initialize() +} + +// IsAppleSilicon returns true on this platform. +func IsAppleSilicon() bool { + return true +} + +// PCoreHZ returns the max frequency in Hertz of the P-Core of an Apple Silicon CPU. +func PCoreHz() uint64 { + return uint64(C.pCoreHz()) +} + +// ECoreHZ returns the max frequency in Hertz of the E-Core of an Apple Silicon CPU. +func ECoreHz() uint64 { + return uint64(C.eCoreHz()) +} + +// PCoreGHz returns the max frequency in Gigahertz of the P-Core of an Apple Silicon CPU. +func PCoreGHz() float64 { + return float64(C.pCoreGHz()) +} + +// ECoreGHz returns the max frequency in Gigahertz of the E-Core of an Apple Silicon CPU. +func ECoreGHz() float64 { + return float64(C.eCoreGHz()) +} + +// PCoreCount returns the number of physical P (performance) cores. +func PCoreCount() int { + return int(C.pCoreCount()) +} + +// ECoreCount returns the number of physical E (efficiency) cores. +func ECoreCount() int { + return int(C.eCoreCount()) +} + +// PCoreCacheSize returns the sizes of the P (performance) core cache sizes +// in the order of +// +// - L1 instruction cache +// - L1 data cache +// - L2 cache +func PCoreCache() (int, int, int) { + return int(C.pCoreL1InstCacheSize()), + int(C.pCoreL1DataCacheSize()), + int(C.pCoreL2CacheSize()) +} + +// ECoreCacheSize returns the sizes of the E (efficiency) core cache sizes +// in the order of +// +// - L1 instruction cache +// - L1 data cache +// - L2 cache +func ECoreCache() (int, int, int) { + return int(C.eCoreL1InstCacheSize()), + int(C.eCoreL1DataCacheSize()), + int(C.eCoreL2CacheSize()) +} + +// ModelName returns the model name of the CPU. +func ModelName() string { + return C.GoString(C.modelName()) +} diff --git a/vendor/github.com/shoenig/go-m1cpu/incompatible.go b/vendor/github.com/shoenig/go-m1cpu/incompatible.go new file mode 100644 index 00000000..d425025a --- /dev/null +++ b/vendor/github.com/shoenig/go-m1cpu/incompatible.go @@ -0,0 +1,53 @@ +//go:build !darwin || !arm64 || !cgo + +package m1cpu + +// IsAppleSilicon return false on this platform. +func IsAppleSilicon() bool { + return false +} + +// PCoreHZ requires darwin/arm64 +func PCoreHz() uint64 { + panic("m1cpu: not a darwin/arm64 system") +} + +// ECoreHZ requires darwin/arm64 +func ECoreHz() uint64 { + panic("m1cpu: not a darwin/arm64 system") +} + +// PCoreGHz requires darwin/arm64 +func PCoreGHz() float64 { + panic("m1cpu: not a darwin/arm64 system") +} + +// ECoreGHz requires darwin/arm64 +func ECoreGHz() float64 { + panic("m1cpu: not a darwin/arm64 system") +} + +// PCoreCount requires darwin/arm64 +func PCoreCount() int { + panic("m1cpu: not a darwin/arm64 system") +} + +// ECoreCount requires darwin/arm64 +func ECoreCount() int { + panic("m1cpu: not a darwin/arm64 system") +} + +// PCoreCacheSize requires darwin/arm64 +func PCoreCache() (int, int, int) { + panic("m1cpu: not a darwin/arm64 system") +} + +// ECoreCacheSize requires darwin/arm64 +func ECoreCache() (int, int, int) { + panic("m1cpu: not a darwin/arm64 system") +} + +// ModelName requires darwin/arm64 +func ModelName() string { + panic("m1cpu: not a darwin/arm64 system") +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/.gitignore b/vendor/github.com/testcontainers/testcontainers-go/.gitignore index 4d27765d..b6ba580a 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/.gitignore +++ b/vendor/github.com/testcontainers/testcontainers-go/.gitignore @@ -11,3 +11,5 @@ src/pip-delete-this-directory.txt .DS_Store TEST-*.xml + +**/go.work \ No newline at end of file diff --git a/vendor/github.com/testcontainers/testcontainers-go/.golangci.yml b/vendor/github.com/testcontainers/testcontainers-go/.golangci.yml index 89bf14cc..37f3bdc2 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/.golangci.yml +++ b/vendor/github.com/testcontainers/testcontainers-go/.golangci.yml @@ -1,16 +1,43 @@ linters: enable: + - errorlint - gci - - gofmt + - gocritic + - gofumpt - misspell - + - nonamedreturns + - testifylint linters-settings: + errorlint: + # Check whether fmt.Errorf uses the %w verb for formatting errors. + # See the https://github.com/polyfloyd/go-errorlint for caveats. + errorf: true + # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) + errorf-multi: true + # Check for plain type assertions and type switches. + asserts: true + # Check for plain error comparisons. + comparison: true gci: sections: - - standard - - default - - prefix(github.com/testcontainters) - + - standard + - default + - prefix(github.com/testcontainers) + testifylint: + disable: + - float-compare + - go-require + enable: + - bool-compare + - compares + - empty + - error-is-as + - error-nil + - expected-actual + - len + - require-error + - suite-dont-use-pkg + - suite-extra-assert-call run: - timeout: 3m + timeout: 5m diff --git a/vendor/github.com/testcontainers/testcontainers-go/Makefile b/vendor/github.com/testcontainers/testcontainers-go/Makefile index cb9d2f49..2674087e 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/Makefile +++ b/vendor/github.com/testcontainers/testcontainers-go/Makefile @@ -1,9 +1,14 @@ include ./commons-test.mk .PHONY: test-all -test-all: tools test-unit +test-all: tools test-tools test-unit .PHONY: test-examples test-examples: @echo "Running example tests..." make -C examples test + +.PHONY: tidy-all +tidy-all: + make -C examples tidy-examples + make -C modules tidy-modules diff --git a/vendor/github.com/testcontainers/testcontainers-go/Pipfile b/vendor/github.com/testcontainers/testcontainers-go/Pipfile index 2236de86..ffa08b97 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/Pipfile +++ b/vendor/github.com/testcontainers/testcontainers-go/Pipfile @@ -6,10 +6,11 @@ verify_ssl = true [dev-packages] [packages] -mkdocs = "*" -mkdocs-codeinclude-plugin = "*" -mkdocs-material = "*" -mkdocs-markdownextradata-plugin = "*" +mkdocs = "==1.5.3" +mkdocs-codeinclude-plugin = "==0.2.1" +mkdocs-include-markdown-plugin = "==6.0.4" +mkdocs-material = "==9.5.13" +mkdocs-markdownextradata-plugin = "==0.2.5" [requires] -python_version = "3.7" +python_version = "3.8" diff --git a/vendor/github.com/testcontainers/testcontainers-go/Pipfile.lock b/vendor/github.com/testcontainers/testcontainers-go/Pipfile.lock index 950b87f3..4b44bc7a 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/Pipfile.lock +++ b/vendor/github.com/testcontainers/testcontainers-go/Pipfile.lock @@ -1,11 +1,11 @@ { "_meta": { "hash": { - "sha256": "d3830267ea93391a077a2ba5b93aa8218c0a38002694b404b56df11498da3e56" + "sha256": "7e2177af09f35451787a76b01cf4552aa401ce8f0cc9739c329d98526c54a3ec" }, "pipfile-spec": 6, "requires": { - "python_version": "3.7" + "python_version": "3.8" }, "sources": [ { @@ -16,13 +16,141 @@ ] }, "default": { + "babel": { + "hashes": [ + "sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363", + "sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287" + ], + "markers": "python_version >= '3.7'", + "version": "==2.14.0" + }, + "bracex": { + "hashes": [ + "sha256:a27eaf1df42cf561fed58b7a8f3fdf129d1ea16a81e1fadd1d17989bc6384beb", + "sha256:efdc71eff95eaff5e0f8cfebe7d01adf2c8637c8c92edaf63ef348c241a82418" + ], + "markers": "python_version >= '3.8'", + "version": "==2.4" + }, + "certifi": { + "hashes": [ + "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f", + "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" + ], + "markers": "python_version >= '3.6'", + "version": "==2024.2.2" + }, + "charset-normalizer": { + "hashes": [ + "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027", + "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087", + "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786", + "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8", + "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09", + "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185", + "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574", + "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e", + "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519", + "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898", + "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269", + "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3", + "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f", + "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6", + "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8", + "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a", + "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73", + "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc", + "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714", + "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2", + "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc", + "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce", + "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d", + "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e", + "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6", + "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269", + "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96", + "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d", + "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a", + "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4", + "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77", + "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d", + "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0", + "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed", + "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068", + "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac", + "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25", + "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8", + "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab", + "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26", + "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2", + "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db", + "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f", + "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5", + "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99", + "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c", + "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d", + "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811", + "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa", + "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a", + "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03", + "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b", + "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04", + "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c", + "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001", + "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458", + "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389", + "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99", + "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985", + "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537", + "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238", + "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f", + "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d", + "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796", + "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a", + "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143", + "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8", + "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c", + "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5", + "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5", + "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711", + "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4", + "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6", + "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c", + "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7", + "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4", + "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b", + "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae", + "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12", + "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c", + "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae", + "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8", + "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887", + "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b", + "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4", + "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f", + "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5", + "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33", + "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519", + "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561" + ], + "markers": "python_full_version >= '3.7.0'", + "version": "==3.3.2" + }, "click": { "hashes": [ - "sha256:48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd", - "sha256:fa244bb30b3b5ee2cae3da8f55c9e5e0c0e86093306301fb418eb9dc40fbded5" + "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", + "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" ], "markers": "python_version >= '3.7'", - "version": "==8.1.6" + "version": "==8.1.7" + }, + "colorama": { + "hashes": [ + "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", + "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", + "version": "==0.4.6" }, "ghp-import": { "hashes": [ @@ -31,85 +159,103 @@ ], "version": "==2.1.0" }, + "idna": { + "hashes": [ + "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", + "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f" + ], + "markers": "python_version >= '3.5'", + "version": "==3.6" + }, "importlib-metadata": { "hashes": [ - "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4", - "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5" + "sha256:198f568f3230878cb1b44fbd7975f87906c22336dba2e4a7f05278c281fbd792", + "sha256:f4bc4c0c070c490abf4ce96d715f68e95923320370efb66143df00199bb6c100" ], - "markers": "python_version >= '3.7'", - "version": "==6.7.0" + "markers": "python_version < '3.10'", + "version": "==7.0.2" }, "jinja2": { "hashes": [ - "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", - "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61" + "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa", + "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90" ], "markers": "python_version >= '3.7'", - "version": "==3.1.2" + "version": "==3.1.3" }, "markdown": { "hashes": [ - "sha256:225c6123522495d4119a90b3a3ba31a1e87a70369e03f14799ea9c0d7183a3d6", - "sha256:a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941" + "sha256:d43323865d89fc0cb9b20c75fc8ad313af307cc087e84b657d9eec768eddeadd", + "sha256:e1ac7b3dc550ee80e602e71c1d168002f062e49f1b11e26a36264dafd4df2ef8" ], - "markers": "python_version >= '3.7'", - "version": "==3.4.4" + "markers": "python_version >= '3.8'", + "version": "==3.5.2" }, "markupsafe": { "hashes": [ - "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e", - "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e", - "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431", - "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686", - "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559", - "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc", - "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c", - "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0", - "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4", - "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9", - "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575", - "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba", - "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d", - "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3", - "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00", - "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155", - "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac", - "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52", - "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f", - "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8", - "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b", - "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24", - "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea", - "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198", - "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0", - "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee", - "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be", - "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2", - "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707", - "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6", - "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58", - "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779", - "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636", - "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c", - "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad", - "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee", - "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc", - "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2", - "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48", - "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7", - "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e", - "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b", - "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa", - "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5", - "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e", - "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb", - "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9", - "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57", - "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc", - "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2" + "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf", + "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff", + "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f", + "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3", + "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532", + "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f", + "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617", + "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df", + "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4", + "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906", + "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f", + "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4", + "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8", + "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371", + "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2", + "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465", + "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52", + "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6", + "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169", + "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad", + "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2", + "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0", + "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029", + "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f", + "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a", + "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced", + "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5", + "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c", + "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf", + "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9", + "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb", + "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad", + "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3", + "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1", + "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46", + "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc", + "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a", + "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee", + "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900", + "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5", + "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea", + "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f", + "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5", + "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e", + "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a", + "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f", + "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50", + "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a", + "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b", + "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4", + "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff", + "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2", + "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46", + "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b", + "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf", + "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5", + "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5", + "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab", + "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd", + "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68" ], "markers": "python_version >= '3.7'", - "version": "==2.1.3" + "version": "==2.1.5" }, "mergedeep": { "hashes": [ @@ -121,11 +267,12 @@ }, "mkdocs": { "hashes": [ - "sha256:89f5a094764381cda656af4298727c9f53dc3e602983087e1fe96ea1df24f4c1", - "sha256:a1fa8c2d0c1305d7fc2b9d9f607c71778572a8b110fb26642aa00296c9e6d072" + "sha256:3b3a78e736b31158d64dbb2f8ba29bd46a379d0c6e324c2246c3bc3d2189cfc1", + "sha256:eb7c99214dcb945313ba30426c2451b735992c73c2e10838f76d09e39ff4d0e2" ], "index": "pypi", - "version": "==1.2.3" + "markers": "python_version >= '3.7'", + "version": "==1.5.3" }, "mkdocs-codeinclude-plugin": { "hashes": [ @@ -133,58 +280,110 @@ "sha256:305387f67a885f0e36ec1cf977324fe1fe50d31301147194b63631d0864601b1" ], "index": "pypi", + "markers": "python_version >= '3.7'", "version": "==0.2.1" }, + "mkdocs-include-markdown-plugin": { + "hashes": [ + "sha256:523c9c3a1d6a517386dc11bf60b0c0c564af1071bb6de8d213106d54f752dcc1", + "sha256:e7b8b5ecc41d6a3e16969cff3725ec3a391b68e9dfe1a4b4e36a8508becda835" + ], + "index": "pypi", + "markers": "python_version >= '3.8'", + "version": "==6.0.4" + }, "mkdocs-markdownextradata-plugin": { "hashes": [ "sha256:9c562e8fe375647d5692d11dfe369a7bdd50302174d35995fce2aeca58036ec6" ], "index": "pypi", + "markers": "python_version not in '3.0, 3.1, 3.2, 3.3' and python_full_version >= '2.7.9'", "version": "==0.2.5" }, "mkdocs-material": { "hashes": [ - "sha256:524debb6ee8ee89cee08886f2a67c3c3875c0ee9579c598d7448cbd2607cd3b7", - "sha256:62ae84082fa9f077c86b7db63e7bedf392005041b451defc850f8d0887a11e91" + "sha256:5cbe17fee4e3b4980c8420a04cc762d8dc052ef1e10532abd4fce88e5ea9ce6a", + "sha256:d8e4caae576312a88fd2609b81cf43d233cdbe36860d67a68702b018b425bd87" ], "index": "pypi", - "version": "==3.2.0" + "markers": "python_version >= '3.8'", + "version": "==9.5.13" + }, + "mkdocs-material-extensions": { + "hashes": [ + "sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443", + "sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31" + ], + "markers": "python_version >= '3.8'", + "version": "==1.3.1" }, "packaging": { "hashes": [ - "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61", - "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f" + "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5", + "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" ], "markers": "python_version >= '3.7'", - "version": "==23.1" + "version": "==23.2" + }, + "paginate": { + "hashes": [ + "sha256:5e6007b6a9398177a7e1648d04fdd9f8c9766a1a945bceac82f1929e8c78af2d" + ], + "version": "==0.5.6" + }, + "pathspec": { + "hashes": [ + "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", + "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712" + ], + "markers": "python_version >= '3.8'", + "version": "==0.12.1" + }, + "platformdirs": { + "hashes": [ + "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068", + "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768" + ], + "markers": "python_version >= '3.8'", + "version": "==4.2.0" }, "pygments": { "hashes": [ - "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c", - "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1" + "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c", + "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367" ], "markers": "python_version >= '3.7'", - "version": "==2.15.1" + "version": "==2.17.2" }, "pymdown-extensions": { "hashes": [ - "sha256:508009b211373058debb8247e168de4cbcb91b1bff7b5e961b2c3e864e00b195", - "sha256:ef25dbbae530e8f67575d222b75ff0649b1e841e22c2ae9a20bad9472c2207dc" + "sha256:c70e146bdd83c744ffc766b4671999796aba18842b268510a329f7f64700d584", + "sha256:f5cc7000d7ff0d1ce9395d216017fa4df3dde800afb1fb72d1c7d3fd35e710f4" ], - "markers": "python_version >= '3.7'", - "version": "==10.1" + "markers": "python_version >= '3.8'", + "version": "==10.7.1" }, "python-dateutil": { "hashes": [ - "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", - "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", + "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.2" + "version": "==2.9.0.post0" + }, + "pytz": { + "hashes": [ + "sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812", + "sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319" + ], + "markers": "python_version < '3.9'", + "version": "==2024.1" }, "pyyaml": { "hashes": [ + "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5", "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc", + "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df", "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741", "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206", "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27", @@ -192,7 +391,10 @@ "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62", "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98", "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696", + "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290", + "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9", "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d", + "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6", "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867", "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47", "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486", @@ -200,11 +402,15 @@ "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3", "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007", "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938", + "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0", "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c", "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735", "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d", + "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28", + "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4", "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba", "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8", + "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef", "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5", "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd", "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3", @@ -217,7 +423,9 @@ "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43", "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859", "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673", + "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54", "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a", + "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b", "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab", "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa", "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c", @@ -236,6 +444,113 @@ "markers": "python_version >= '3.6'", "version": "==0.1" }, + "regex": { + "hashes": [ + "sha256:0694219a1d54336fd0445ea382d49d36882415c0134ee1e8332afd1529f0baa5", + "sha256:086dd15e9435b393ae06f96ab69ab2d333f5d65cbe65ca5a3ef0ec9564dfe770", + "sha256:094ba386bb5c01e54e14434d4caabf6583334090865b23ef58e0424a6286d3dc", + "sha256:09da66917262d9481c719599116c7dc0c321ffcec4b1f510c4f8a066f8768105", + "sha256:0ecf44ddf9171cd7566ef1768047f6e66975788258b1c6c6ca78098b95cf9a3d", + "sha256:0fda75704357805eb953a3ee15a2b240694a9a514548cd49b3c5124b4e2ad01b", + "sha256:11a963f8e25ab5c61348d090bf1b07f1953929c13bd2309a0662e9ff680763c9", + "sha256:150c39f5b964e4d7dba46a7962a088fbc91f06e606f023ce57bb347a3b2d4630", + "sha256:1b9d811f72210fa9306aeb88385b8f8bcef0dfbf3873410413c00aa94c56c2b6", + "sha256:1e0eabac536b4cc7f57a5f3d095bfa557860ab912f25965e08fe1545e2ed8b4c", + "sha256:22a86d9fff2009302c440b9d799ef2fe322416d2d58fc124b926aa89365ec482", + "sha256:22f3470f7524b6da61e2020672df2f3063676aff444db1daa283c2ea4ed259d6", + "sha256:263ef5cc10979837f243950637fffb06e8daed7f1ac1e39d5910fd29929e489a", + "sha256:283fc8eed679758de38fe493b7d7d84a198b558942b03f017b1f94dda8efae80", + "sha256:29171aa128da69afdf4bde412d5bedc335f2ca8fcfe4489038577d05f16181e5", + "sha256:298dc6354d414bc921581be85695d18912bea163a8b23cac9a2562bbcd5088b1", + "sha256:2aae8101919e8aa05ecfe6322b278f41ce2994c4a430303c4cd163fef746e04f", + "sha256:2f4e475a80ecbd15896a976aa0b386c5525d0ed34d5c600b6d3ebac0a67c7ddf", + "sha256:34e4af5b27232f68042aa40a91c3b9bb4da0eeb31b7632e0091afc4310afe6cb", + "sha256:37f8e93a81fc5e5bd8db7e10e62dc64261bcd88f8d7e6640aaebe9bc180d9ce2", + "sha256:3a17d3ede18f9cedcbe23d2daa8a2cd6f59fe2bf082c567e43083bba3fb00347", + "sha256:3b1de218d5375cd6ac4b5493e0b9f3df2be331e86520f23382f216c137913d20", + "sha256:43f7cd5754d02a56ae4ebb91b33461dc67be8e3e0153f593c509e21d219c5060", + "sha256:4558410b7a5607a645e9804a3e9dd509af12fb72b9825b13791a37cd417d73a5", + "sha256:4719bb05094d7d8563a450cf8738d2e1061420f79cfcc1fa7f0a44744c4d8f73", + "sha256:4bfc2b16e3ba8850e0e262467275dd4d62f0d045e0e9eda2bc65078c0110a11f", + "sha256:518440c991f514331f4850a63560321f833979d145d7d81186dbe2f19e27ae3d", + "sha256:51f4b32f793812714fd5307222a7f77e739b9bc566dc94a18126aba3b92b98a3", + "sha256:531ac6cf22b53e0696f8e1d56ce2396311254eb806111ddd3922c9d937151dae", + "sha256:5cd05d0f57846d8ba4b71d9c00f6f37d6b97d5e5ef8b3c3840426a475c8f70f4", + "sha256:5dd58946bce44b53b06d94aa95560d0b243eb2fe64227cba50017a8d8b3cd3e2", + "sha256:60080bb3d8617d96f0fb7e19796384cc2467447ef1c491694850ebd3670bc457", + "sha256:636ba0a77de609d6510235b7f0e77ec494d2657108f777e8765efc060094c98c", + "sha256:67d3ccfc590e5e7197750fcb3a2915b416a53e2de847a728cfa60141054123d4", + "sha256:68191f80a9bad283432385961d9efe09d783bcd36ed35a60fb1ff3f1ec2efe87", + "sha256:7502534e55c7c36c0978c91ba6f61703faf7ce733715ca48f499d3dbbd7657e0", + "sha256:7aa47c2e9ea33a4a2a05f40fcd3ea36d73853a2aae7b4feab6fc85f8bf2c9704", + "sha256:7d2af3f6b8419661a0c421584cfe8aaec1c0e435ce7e47ee2a97e344b98f794f", + "sha256:7e316026cc1095f2a3e8cc012822c99f413b702eaa2ca5408a513609488cb62f", + "sha256:88ad44e220e22b63b0f8f81f007e8abbb92874d8ced66f32571ef8beb0643b2b", + "sha256:88d1f7bef20c721359d8675f7d9f8e414ec5003d8f642fdfd8087777ff7f94b5", + "sha256:89723d2112697feaa320c9d351e5f5e7b841e83f8b143dba8e2d2b5f04e10923", + "sha256:8a0ccf52bb37d1a700375a6b395bff5dd15c50acb745f7db30415bae3c2b0715", + "sha256:8c2c19dae8a3eb0ea45a8448356ed561be843b13cbc34b840922ddf565498c1c", + "sha256:905466ad1702ed4acfd67a902af50b8db1feeb9781436372261808df7a2a7bca", + "sha256:9852b76ab558e45b20bf1893b59af64a28bd3820b0c2efc80e0a70a4a3ea51c1", + "sha256:98a2636994f943b871786c9e82bfe7883ecdaba2ef5df54e1450fa9869d1f756", + "sha256:9aa1a67bbf0f957bbe096375887b2505f5d8ae16bf04488e8b0f334c36e31360", + "sha256:9eda5f7a50141291beda3edd00abc2d4a5b16c29c92daf8d5bd76934150f3edc", + "sha256:a6d1047952c0b8104a1d371f88f4ab62e6275567d4458c1e26e9627ad489b445", + "sha256:a9b6d73353f777630626f403b0652055ebfe8ff142a44ec2cf18ae470395766e", + "sha256:a9cc99d6946d750eb75827cb53c4371b8b0fe89c733a94b1573c9dd16ea6c9e4", + "sha256:ad83e7545b4ab69216cef4cc47e344d19622e28aabec61574b20257c65466d6a", + "sha256:b014333bd0217ad3d54c143de9d4b9a3ca1c5a29a6d0d554952ea071cff0f1f8", + "sha256:b43523d7bc2abd757119dbfb38af91b5735eea45537ec6ec3a5ec3f9562a1c53", + "sha256:b521dcecebc5b978b447f0f69b5b7f3840eac454862270406a39837ffae4e697", + "sha256:b77e27b79448e34c2c51c09836033056a0547aa360c45eeeb67803da7b0eedaf", + "sha256:b7a635871143661feccce3979e1727c4e094f2bdfd3ec4b90dfd4f16f571a87a", + "sha256:b7fca9205b59c1a3d5031f7e64ed627a1074730a51c2a80e97653e3e9fa0d415", + "sha256:ba1b30765a55acf15dce3f364e4928b80858fa8f979ad41f862358939bdd1f2f", + "sha256:ba99d8077424501b9616b43a2d208095746fb1284fc5ba490139651f971d39d9", + "sha256:c25a8ad70e716f96e13a637802813f65d8a6760ef48672aa3502f4c24ea8b400", + "sha256:c3c4a78615b7762740531c27cf46e2f388d8d727d0c0c739e72048beb26c8a9d", + "sha256:c40281f7d70baf6e0db0c2f7472b31609f5bc2748fe7275ea65a0b4601d9b392", + "sha256:c7ad32824b7f02bb3c9f80306d405a1d9b7bb89362d68b3c5a9be53836caebdb", + "sha256:cb3fe77aec8f1995611f966d0c656fdce398317f850d0e6e7aebdfe61f40e1cd", + "sha256:cc038b2d8b1470364b1888a98fd22d616fba2b6309c5b5f181ad4483e0017861", + "sha256:cc37b9aeebab425f11f27e5e9e6cf580be7206c6582a64467a14dda211abc232", + "sha256:cc6bb9aa69aacf0f6032c307da718f61a40cf970849e471254e0e91c56ffca95", + "sha256:d126361607b33c4eb7b36debc173bf25d7805847346dd4d99b5499e1fef52bc7", + "sha256:d15b274f9e15b1a0b7a45d2ac86d1f634d983ca40d6b886721626c47a400bf39", + "sha256:d166eafc19f4718df38887b2bbe1467a4f74a9830e8605089ea7a30dd4da8887", + "sha256:d498eea3f581fbe1b34b59c697512a8baef88212f92e4c7830fcc1499f5b45a5", + "sha256:d6f7e255e5fa94642a0724e35406e6cb7001c09d476ab5fce002f652b36d0c39", + "sha256:d78bd484930c1da2b9679290a41cdb25cc127d783768a0369d6b449e72f88beb", + "sha256:d865984b3f71f6d0af64d0d88f5733521698f6c16f445bb09ce746c92c97c586", + "sha256:d902a43085a308cef32c0d3aea962524b725403fd9373dea18110904003bac97", + "sha256:d94a1db462d5690ebf6ae86d11c5e420042b9898af5dcf278bd97d6bda065423", + "sha256:da695d75ac97cb1cd725adac136d25ca687da4536154cdc2815f576e4da11c69", + "sha256:db2a0b1857f18b11e3b0e54ddfefc96af46b0896fb678c85f63fb8c37518b3e7", + "sha256:df26481f0c7a3f8739fecb3e81bc9da3fcfae34d6c094563b9d4670b047312e1", + "sha256:e14b73607d6231f3cc4622809c196b540a6a44e903bcfad940779c80dffa7be7", + "sha256:e2610e9406d3b0073636a3a2e80db05a02f0c3169b5632022b4e81c0364bcda5", + "sha256:e692296c4cc2873967771345a876bcfc1c547e8dd695c6b89342488b0ea55cd8", + "sha256:e693e233ac92ba83a87024e1d32b5f9ab15ca55ddd916d878146f4e3406b5c91", + "sha256:e81469f7d01efed9b53740aedd26085f20d49da65f9c1f41e822a33992cb1590", + "sha256:e8c7e08bb566de4faaf11984af13f6bcf6a08f327b13631d41d62592681d24fe", + "sha256:ed19b3a05ae0c97dd8f75a5d8f21f7723a8c33bbc555da6bbe1f96c470139d3c", + "sha256:efb2d82f33b2212898f1659fb1c2e9ac30493ac41e4d53123da374c3b5541e64", + "sha256:f44dd4d68697559d007462b0a3a1d9acd61d97072b71f6d1968daef26bc744bd", + "sha256:f72cbae7f6b01591f90814250e636065850c5926751af02bb48da94dfced7baa", + "sha256:f7bc09bc9c29ebead055bcba136a67378f03d66bf359e87d0f7c759d6d4ffa31", + "sha256:ff100b203092af77d1a5a7abe085b3506b7eaaf9abf65b73b7d6905b6cb76988" + ], + "markers": "python_version >= '3.7'", + "version": "==2023.12.25" + }, + "requests": { + "hashes": [ + "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f", + "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" + ], + "markers": "python_version >= '3.7'", + "version": "==2.31.0" + }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", @@ -244,54 +559,64 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.16.0" }, - "typing-extensions": { + "urllib3": { "hashes": [ - "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36", - "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2" + "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d", + "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19" ], - "markers": "python_version < '3.8'", - "version": "==4.7.1" + "markers": "python_version >= '3.8'", + "version": "==2.2.1" }, "watchdog": { "hashes": [ - "sha256:0e06ab8858a76e1219e68c7573dfeba9dd1c0219476c5a44d5333b01d7e1743a", - "sha256:13bbbb462ee42ec3c5723e1205be8ced776f05b100e4737518c67c8325cf6100", - "sha256:233b5817932685d39a7896b1090353fc8efc1ef99c9c054e46c8002561252fb8", - "sha256:25f70b4aa53bd743729c7475d7ec41093a580528b100e9a8c5b5efe8899592fc", - "sha256:2b57a1e730af3156d13b7fdddfc23dea6487fceca29fc75c5a868beed29177ae", - "sha256:336adfc6f5cc4e037d52db31194f7581ff744b67382eb6021c868322e32eef41", - "sha256:3aa7f6a12e831ddfe78cdd4f8996af9cf334fd6346531b16cec61c3b3c0d8da0", - "sha256:3ed7c71a9dccfe838c2f0b6314ed0d9b22e77d268c67e015450a29036a81f60f", - "sha256:4c9956d27be0bb08fc5f30d9d0179a855436e655f046d288e2bcc11adfae893c", - "sha256:4d98a320595da7a7c5a18fc48cb633c2e73cda78f93cac2ef42d42bf609a33f9", - "sha256:4f94069eb16657d2c6faada4624c39464f65c05606af50bb7902e036e3219be3", - "sha256:5113334cf8cf0ac8cd45e1f8309a603291b614191c9add34d33075727a967709", - "sha256:51f90f73b4697bac9c9a78394c3acbbd331ccd3655c11be1a15ae6fe289a8c83", - "sha256:5d9f3a10e02d7371cd929b5d8f11e87d4bad890212ed3901f9b4d68767bee759", - "sha256:7ade88d0d778b1b222adebcc0927428f883db07017618a5e684fd03b83342bd9", - "sha256:7c5f84b5194c24dd573fa6472685b2a27cc5a17fe5f7b6fd40345378ca6812e3", - "sha256:7e447d172af52ad204d19982739aa2346245cc5ba6f579d16dac4bfec226d2e7", - "sha256:8ae9cda41fa114e28faf86cb137d751a17ffd0316d1c34ccf2235e8a84365c7f", - "sha256:8f3ceecd20d71067c7fd4c9e832d4e22584318983cabc013dbf3f70ea95de346", - "sha256:9fac43a7466eb73e64a9940ac9ed6369baa39b3bf221ae23493a9ec4d0022674", - "sha256:a70a8dcde91be523c35b2bf96196edc5730edb347e374c7de7cd20c43ed95397", - "sha256:adfdeab2da79ea2f76f87eb42a3ab1966a5313e5a69a0213a3cc06ef692b0e96", - "sha256:ba07e92756c97e3aca0912b5cbc4e5ad802f4557212788e72a72a47ff376950d", - "sha256:c07253088265c363d1ddf4b3cdb808d59a0468ecd017770ed716991620b8f77a", - "sha256:c9d8c8ec7efb887333cf71e328e39cffbf771d8f8f95d308ea4125bf5f90ba64", - "sha256:d00e6be486affb5781468457b21a6cbe848c33ef43f9ea4a73b4882e5f188a44", - "sha256:d429c2430c93b7903914e4db9a966c7f2b068dd2ebdd2fa9b9ce094c7d459f33" + "sha256:11e12fafb13372e18ca1bbf12d50f593e7280646687463dd47730fd4f4d5d257", + "sha256:2895bf0518361a9728773083908801a376743bcc37dfa252b801af8fd281b1ca", + "sha256:39cb34b1f1afbf23e9562501673e7146777efe95da24fab5707b88f7fb11649b", + "sha256:45cc09cc4c3b43fb10b59ef4d07318d9a3ecdbff03abd2e36e77b6dd9f9a5c85", + "sha256:4986db5e8880b0e6b7cd52ba36255d4793bf5cdc95bd6264806c233173b1ec0b", + "sha256:5369136a6474678e02426bd984466343924d1df8e2fd94a9b443cb7e3aa20d19", + "sha256:557ba04c816d23ce98a06e70af6abaa0485f6d94994ec78a42b05d1c03dcbd50", + "sha256:6a4db54edea37d1058b08947c789a2354ee02972ed5d1e0dca9b0b820f4c7f92", + "sha256:6a80d5cae8c265842c7419c560b9961561556c4361b297b4c431903f8c33b269", + "sha256:6a9c71a0b02985b4b0b6d14b875a6c86ddea2fdbebd0c9a720a806a8bbffc69f", + "sha256:6c47bdd680009b11c9ac382163e05ca43baf4127954c5f6d0250e7d772d2b80c", + "sha256:6e949a8a94186bced05b6508faa61b7adacc911115664ccb1923b9ad1f1ccf7b", + "sha256:73c7a935e62033bd5e8f0da33a4dcb763da2361921a69a5a95aaf6c93aa03a87", + "sha256:76ad8484379695f3fe46228962017a7e1337e9acadafed67eb20aabb175df98b", + "sha256:8350d4055505412a426b6ad8c521bc7d367d1637a762c70fdd93a3a0d595990b", + "sha256:87e9df830022488e235dd601478c15ad73a0389628588ba0b028cb74eb72fed8", + "sha256:8f9a542c979df62098ae9c58b19e03ad3df1c9d8c6895d96c0d51da17b243b1c", + "sha256:8fec441f5adcf81dd240a5fe78e3d83767999771630b5ddfc5867827a34fa3d3", + "sha256:9a03e16e55465177d416699331b0f3564138f1807ecc5f2de9d55d8f188d08c7", + "sha256:ba30a896166f0fee83183cec913298151b73164160d965af2e93a20bbd2ab605", + "sha256:c17d98799f32e3f55f181f19dd2021d762eb38fdd381b4a748b9f5a36738e935", + "sha256:c522392acc5e962bcac3b22b9592493ffd06d1fc5d755954e6be9f4990de932b", + "sha256:d0f9bd1fd919134d459d8abf954f63886745f4660ef66480b9d753a7c9d40927", + "sha256:d18d7f18a47de6863cd480734613502904611730f8def45fc52a5d97503e5101", + "sha256:d31481ccf4694a8416b681544c23bd271f5a123162ab603c7d7d2dd7dd901a07", + "sha256:e3e7065cbdabe6183ab82199d7a4f6b3ba0a438c5a512a68559846ccb76a78ec", + "sha256:eed82cdf79cd7f0232e2fdc1ad05b06a5e102a43e331f7d041e5f0e0a34a51c4", + "sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245", + "sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d" ], - "markers": "python_version >= '3.7'", - "version": "==3.0.0" + "markers": "python_version >= '3.8'", + "version": "==4.0.0" + }, + "wcmatch": { + "hashes": [ + "sha256:14554e409b142edeefab901dc68ad570b30a72a8ab9a79106c5d5e9a6d241bd5", + "sha256:86c17572d0f75cbf3bcb1a18f3bf2f9e72b39a9c08c9b4a74e991e1882a8efb3" + ], + "markers": "python_version >= '3.8'", + "version": "==8.5" }, "zipp": { "hashes": [ - "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b", - "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556" + "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31", + "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0" ], - "markers": "python_version >= '3.7'", - "version": "==3.15.0" + "markers": "python_version >= '3.8'", + "version": "==3.17.0" } }, "develop": {} diff --git a/vendor/github.com/testcontainers/testcontainers-go/README.md b/vendor/github.com/testcontainers/testcontainers-go/README.md index 01ecc733..cf7e0fc2 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/README.md +++ b/vendor/github.com/testcontainers/testcontainers-go/README.md @@ -2,9 +2,26 @@ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=141451032&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs) +**Builds** + [![Main pipeline](https://github.com/testcontainers/testcontainers-go/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/testcontainers/testcontainers-go/actions/workflows/ci.yml) + +**Documentation** + +[![GoDoc Reference](https://pkg.go.dev/badge/github.com/testcontainers/testcontainers-go.svg)](https://pkg.go.dev/github.com/testcontainers/testcontainers-go) + +**Social** + +[![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack)](https://testcontainers.slack.com/) + +**Code quality** + [![Go Report Card](https://goreportcard.com/badge/github.com/testcontainers/testcontainers-go)](https://goreportcard.com/report/github.com/testcontainers/testcontainers-go) -[![GoDoc Reference](https://camo.githubusercontent.com/8609cfcb531fa0f5598a3d4353596fae9336cce3/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f79616e6777656e6d61692f686f772d746f2d6164642d62616467652d696e2d6769746875622d726561646d653f7374617475732e737667)](https://pkg.go.dev/github.com/testcontainers/testcontainers-go) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=testcontainers_testcontainers-go&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=testcontainers_testcontainers-go) + +**License** + +[![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/testcontainers/testcontainers-go/blob/main/LICENSE) _Testcontainers for Go_ is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers diff --git a/vendor/github.com/testcontainers/testcontainers-go/RELEASING.md b/vendor/github.com/testcontainers/testcontainers-go/RELEASING.md index 3990216f..31a99549 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/RELEASING.md +++ b/vendor/github.com/testcontainers/testcontainers-go/RELEASING.md @@ -150,8 +150,6 @@ git add modules/**/go.* git commit -m chore: use new version (v0.20.1) in modules and examples git tag v0.20.1 git tag examples/bigtable/v0.20.1 -git tag examples/cockroachdb/v0.20.1 -git tag examples/consul/v0.20.1 git tag examples/datastore/v0.20.1 git tag examples/firestore/v0.20.1 git tag examples/mongodb/v0.20.1 @@ -159,6 +157,7 @@ git tag examples/nginx/v0.20.1 git tag examples/pubsub/v0.20.1 git tag examples/spanner/v0.20.1 git tag examples/toxiproxy/v0.20.1 +git tag modules/cockroachdb/v0.20.1 git tag modules/compose/v0.20.1 git tag modules/couchbase/v0.20.1 git tag modules/localstack/v0.20.1 @@ -178,8 +177,6 @@ git commit -m chore: prepare for next minor development cycle (0.21.0) git push origin main --tags curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/bigtable/@v/v0.20.1.info -curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/cockroachdb/@v/v0.20.1.info -curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/consul/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/datastore/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/firestore/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/mongodb/@v/v0.20.1.info @@ -187,6 +184,7 @@ curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/exampl curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/pubsub/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/spanner/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/toxiproxy/@v/v0.20.1.info +curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/cockroachdb/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/compose/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/couchbase/@v/v0.20.1.info curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/localstack/@v/v0.20.1.info diff --git a/vendor/github.com/testcontainers/testcontainers-go/commons-test.mk b/vendor/github.com/testcontainers/testcontainers-go/commons-test.mk index 9a356ccd..e99d62a2 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/commons-test.mk +++ b/vendor/github.com/testcontainers/testcontainers-go/commons-test.mk @@ -1,21 +1,52 @@ +ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +GOBIN= $(GOPATH)/bin + +define go_install + go install $(1) +endef + +$(GOBIN)/golangci-lint: + $(call go_install,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2) + +$(GOBIN)/gotestsum: + $(call go_install,gotest.tools/gotestsum@latest) + +.PHONY: install +install: $(GOBIN)/golangci-lint $(GOBIN)/gotestsum + +.PHONY: clean +clean: + rm $(GOBIN)/golangci-lint + rm $(GOBIN)/gotestsum + .PHONY: dependencies-scan dependencies-scan: @echo ">> Scanning dependencies in $(CURDIR)..." go list -json -m all | docker run --rm -i sonatypecommunity/nancy:latest sleuth --skip-update-check +.PHONY: lint +lint: $(GOBIN)/golangci-lint + golangci-lint run --out-format=github-actions --path-prefix=. --verbose -c $(ROOT_DIR)/.golangci.yml --fix + .PHONY: test-% -test-%: +test-%: $(GOBIN)/gotestsum @echo "Running $* tests..." gotestsum \ --format short-verbose \ --rerun-fails=5 \ --packages="./..." \ - --junitfile TEST-$*.xml + --junitfile TEST-unit.xml \ + -- \ + -coverprofile=coverage.out \ + -timeout=30m .PHONY: tools tools: go mod download +.PHONY: test-tools +test-tools: $(GOBIN)/gotestsum + .PHONY: tools-tidy tools-tidy: go mod tidy diff --git a/vendor/github.com/testcontainers/testcontainers-go/container.go b/vendor/github.com/testcontainers/testcontainers-go/container.go index ec2351ea..249aff32 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/container.go +++ b/vendor/github.com/testcontainers/testcontainers-go/container.go @@ -5,7 +5,9 @@ import ( "errors" "fmt" "io" + "os" "path/filepath" + "strings" "time" "github.com/docker/docker/api/types" @@ -14,8 +16,11 @@ import ( "github.com/docker/docker/api/types/registry" "github.com/docker/docker/pkg/archive" "github.com/docker/go-connections/nat" + "github.com/google/uuid" + "github.com/moby/patternmatcher/ignorefile" + tcexec "github.com/testcontainers/testcontainers-go/exec" - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" + "github.com/testcontainers/testcontainers-go/internal/core" "github.com/testcontainers/testcontainers-go/wait" ) @@ -38,17 +43,17 @@ type Container interface { Ports(context.Context) (nat.PortMap, error) // get all exposed ports SessionID() string // get session id IsRunning() bool - Start(context.Context) error // start the container - Stop(context.Context, *time.Duration) error // stop the container - Terminate(context.Context) error // terminate the container - Logs(context.Context) (io.ReadCloser, error) // Get logs of the container - FollowOutput(LogConsumer) - StartLogProducer(context.Context) error - StopLogProducer() error - Name(context.Context) (string, error) // get container name - State(context.Context) (*types.ContainerState, error) // returns container's running state - Networks(context.Context) ([]string, error) // get container networks - NetworkAliases(context.Context) (map[string][]string, error) // get container network aliases for a network + Start(context.Context) error // start the container + Stop(context.Context, *time.Duration) error // stop the container + Terminate(context.Context) error // terminate the container + Logs(context.Context) (io.ReadCloser, error) // Get logs of the container + FollowOutput(LogConsumer) // Deprecated: it will be removed in the next major release + StartLogProducer(context.Context, ...LogProductionOption) error // Deprecated: Use the ContainerRequest instead + StopLogProducer() error // Deprecated: it will be removed in the next major release + Name(context.Context) (string, error) // get container name + State(context.Context) (*types.ContainerState, error) // returns container's running state + Networks(context.Context) ([]string, error) // get container networks + NetworkAliases(context.Context) (map[string][]string, error) // get container network aliases for a network Exec(ctx context.Context, cmd []string, options ...tcexec.ProcessOption) (int, io.Reader, error) ContainerIP(context.Context) (string, error) // get container ip ContainerIPs(context.Context) ([]string, error) // get all container IPs @@ -56,39 +61,68 @@ type Container interface { CopyDirToContainer(ctx context.Context, hostDirPath string, containerParentPath string, fileMode int64) error CopyFileToContainer(ctx context.Context, hostFilePath string, containerFilePath string, fileMode int64) error CopyFileFromContainer(ctx context.Context, filePath string) (io.ReadCloser, error) + GetLogProductionErrorChannel() <-chan error } // ImageBuildInfo defines what is needed to build an image type ImageBuildInfo interface { + BuildOptions() (types.ImageBuildOptions, error) // converts the ImageBuildInfo to a types.ImageBuildOptions GetContext() (io.Reader, error) // the path to the build context GetDockerfile() string // the relative path to the Dockerfile, including the fileitself + GetRepo() string // get repo label for image + GetTag() string // get tag label for image ShouldPrintBuildLog() bool // allow build log to be printed to stdout ShouldBuildImage() bool // return true if the image needs to be built GetBuildArgs() map[string]*string // return the environment args used to build the from Dockerfile - GetAuthConfigs() map[string]registry.AuthConfig // return the auth configs to be able to pull from an authenticated docker registry + GetAuthConfigs() map[string]registry.AuthConfig // Deprecated. Testcontainers will detect registry credentials automatically. Return the auth configs to be able to pull from an authenticated docker registry } // FromDockerfile represents the parameters needed to build an image from a Dockerfile // rather than using a pre-built one type FromDockerfile struct { - Context string // the path to the context of of the docker build + Context string // the path to the context of the docker build ContextArchive io.Reader // the tar archive file to send to docker that contains the build context Dockerfile string // the path from the context to the Dockerfile for the image, defaults to "Dockerfile" + Repo string // the repo label for image, defaults to UUID + Tag string // the tag label for image, defaults to UUID BuildArgs map[string]*string // enable user to pass build args to docker daemon PrintBuildLog bool // enable user to print build log AuthConfigs map[string]registry.AuthConfig // Deprecated. Testcontainers will detect registry credentials automatically. Enable auth configs to be able to pull from an authenticated docker registry + // KeepImage describes whether DockerContainer.Terminate should not delete the + // container image. Useful for images that are built from a Dockerfile and take a + // long time to build. Keeping the image also Docker to reuse it. + KeepImage bool + // BuildOptionsModifier Modifier for the build options before image build. Use it for + // advanced configurations while building the image. Please consider that the modifier + // is called after the default build options are set. + BuildOptionsModifier func(*types.ImageBuildOptions) } type ContainerFile struct { - HostFilePath string + HostFilePath string // If Reader is present, HostFilePath is ignored + Reader io.Reader // If Reader is present, HostFilePath is ignored ContainerFilePath string FileMode int64 } +// validate validates the ContainerFile +func (c *ContainerFile) validate() error { + if c.HostFilePath == "" && c.Reader == nil { + return errors.New("either HostFilePath or Reader must be specified") + } + + if c.ContainerFilePath == "" { + return errors.New("ContainerFilePath must be specified") + } + + return nil +} + // ContainerRequest represents the parameters used to get a running container type ContainerRequest struct { FromDockerfile Image string + ImageSubstitutors []ImageSubstitutor Entrypoint []string Env map[string]string ExposedPorts []string // allow specifying protocol info @@ -100,6 +134,7 @@ type ContainerRequest struct { WaitingFor wait.Strategy Name string // for specifying container name Hostname string + WorkingDir string // specify the working directory of the container ExtraHosts []string // Deprecated: Use HostConfigModifier instead Privileged bool // For starting privileged container Networks []string // for specifying network names @@ -110,7 +145,7 @@ type ContainerRequest struct { User string // for specifying uid:gid SkipReaper bool // Deprecated: The reaper is globally controlled by the .testcontainers.properties file or the TESTCONTAINERS_RYUK_DISABLED environment variable ReaperImage string // Deprecated: use WithImageName ContainerOption instead. Alternative reaper image - ReaperOptions []ContainerOption // options for the reaper + ReaperOptions []ContainerOption // Deprecated: the reaper is configured at the properties level, for an entire test session AutoRemove bool // Deprecated: Use HostConfigModifier instead. If set to true, the container will be removed from the host when stopped AlwaysPullImage bool // Always pull image ImagePlatform string // ImagePlatform describes the platform which the image runs on. @@ -122,6 +157,7 @@ type ContainerRequest struct { HostConfigModifier func(*container.HostConfig) // Modifier for the host config before container creation EnpointSettingsModifier func(map[string]*network.EndpointSettings) // Modifier for the network settings before container creation LifecycleHooks []ContainerLifecycleHooks // define hooks to be executed during container lifecycle + LogConsumerCfg *LogConsumerConfig // define the configuration for the log producer and its log consumers to follow the logs } // containerOptions functional options for a container @@ -130,9 +166,11 @@ type containerOptions struct { RegistryCredentials string // Deprecated: Testcontainers will detect registry credentials automatically } +// Deprecated: it will be removed in the next major release // functional option for setting the reaper image type ContainerOption func(*containerOptions) +// Deprecated: it will be removed in the next major release // WithImageName sets the reaper image name func WithImageName(imageName string) ContainerOption { return func(o *containerOptions) { @@ -140,7 +178,7 @@ func WithImageName(imageName string) ContainerOption { } } -// Deprecated: Testcontainers will detect registry credentials automatically +// Deprecated: Testcontainers will detect registry credentials automatically, and it will be removed in the next major release // WithRegistryCredentials sets the reaper registry credentials func WithRegistryCredentials(registryCredentials string) ContainerOption { return func(o *containerOptions) { @@ -170,6 +208,8 @@ func (c *ContainerRequest) Validate() error { // GetContext retrieve the build context for the request func (c *ContainerRequest) GetContext() (io.Reader, error) { + var includes []string = []string{"."} + if c.ContextArchive != nil { return c.ContextArchive, nil } @@ -181,7 +221,18 @@ func (c *ContainerRequest) GetContext() (io.Reader, error) { } c.Context = abs - buildContext, err := archive.TarWithOptions(c.Context, &archive.TarOptions{}) + excluded, err := parseDockerIgnore(abs) + if err != nil { + return nil, err + } + + dockerIgnoreLocation := filepath.Join(abs, ".dockerignore") + includes = append(includes, dockerIgnoreLocation, c.GetDockerfile()) + + buildContext, err := archive.TarWithOptions( + c.Context, + &archive.TarOptions{ExcludePatterns: excluded, IncludeFiles: includes}, + ) if err != nil { return nil, err } @@ -189,6 +240,20 @@ func (c *ContainerRequest) GetContext() (io.Reader, error) { return buildContext, nil } +func parseDockerIgnore(targetDir string) ([]string, error) { + // based on https://github.com/docker/cli/blob/master/cli/command/image/build/dockerignore.go#L14 + fileLocation := filepath.Join(targetDir, ".dockerignore") + var excluded []string + if f, openErr := os.Open(fileLocation); openErr == nil { + var err error + excluded, err = ignorefile.ReadAll(f) + if err != nil { + return excluded, fmt.Errorf("error reading .dockerignore: %w", err) + } + } + return excluded, nil +} + // GetBuildArgs returns the env args to be used when creating from Dockerfile func (c *ContainerRequest) GetBuildArgs() map[string]*string { return c.FromDockerfile.BuildArgs @@ -204,9 +269,35 @@ func (c *ContainerRequest) GetDockerfile() string { return f } +// GetRepo returns the Repo label for image from the ContainerRequest, defaults to UUID +func (c *ContainerRequest) GetRepo() string { + r := c.FromDockerfile.Repo + if r == "" { + return uuid.NewString() + } + + return strings.ToLower(r) +} + +// GetTag returns the Tag label for image from the ContainerRequest, defaults to UUID +func (c *ContainerRequest) GetTag() string { + t := c.FromDockerfile.Tag + if t == "" { + return uuid.NewString() + } + + return strings.ToLower(t) +} + +// Deprecated: Testcontainers will detect registry credentials automatically, and it will be removed in the next major release // GetAuthConfigs returns the auth configs to be able to pull from an authenticated docker registry func (c *ContainerRequest) GetAuthConfigs() map[string]registry.AuthConfig { - images, err := testcontainersdocker.ExtractImagesFromDockerfile(filepath.Join(c.Context, c.GetDockerfile()), c.GetBuildArgs()) + return getAuthConfigsFromDockerfile(c) +} + +// getAuthConfigsFromDockerfile returns the auth configs to be able to pull from an authenticated docker registry +func getAuthConfigsFromDockerfile(c *ContainerRequest) map[string]registry.AuthConfig { + images, err := core.ExtractImagesFromDockerfile(filepath.Join(c.Context, c.GetDockerfile()), c.GetBuildArgs()) if err != nil { return map[string]registry.AuthConfig{} } @@ -228,10 +319,60 @@ func (c *ContainerRequest) ShouldBuildImage() bool { return c.FromDockerfile.Context != "" || c.FromDockerfile.ContextArchive != nil } +func (c *ContainerRequest) ShouldKeepBuiltImage() bool { + return c.FromDockerfile.KeepImage +} + func (c *ContainerRequest) ShouldPrintBuildLog() bool { return c.FromDockerfile.PrintBuildLog } +// BuildOptions returns the image build options when building a Docker image from a Dockerfile. +// It will apply some defaults and finally call the BuildOptionsModifier from the FromDockerfile struct, +// if set. +func (c *ContainerRequest) BuildOptions() (types.ImageBuildOptions, error) { + buildOptions := types.ImageBuildOptions{ + Remove: true, + ForceRemove: true, + } + + if c.FromDockerfile.BuildOptionsModifier != nil { + c.FromDockerfile.BuildOptionsModifier(&buildOptions) + } + + // apply mandatory values after the modifier + buildOptions.BuildArgs = c.GetBuildArgs() + buildOptions.Dockerfile = c.GetDockerfile() + + buildContext, err := c.GetContext() + if err != nil { + return buildOptions, err + } + buildOptions.Context = buildContext + + // Make sure the auth configs from the Dockerfile are set right after the user-defined build options. + authsFromDockerfile := getAuthConfigsFromDockerfile(c) + + if buildOptions.AuthConfigs == nil { + buildOptions.AuthConfigs = map[string]registry.AuthConfig{} + } + + for registry, authConfig := range authsFromDockerfile { + buildOptions.AuthConfigs[registry] = authConfig + } + + // make sure the first tag is the one defined in the ContainerRequest + tag := fmt.Sprintf("%s:%s", c.GetRepo(), c.GetTag()) + if len(buildOptions.Tags) > 0 { + // prepend the tag + buildOptions.Tags = append([]string{tag}, buildOptions.Tags...) + } else { + buildOptions.Tags = []string{tag} + } + + return buildOptions, nil +} + func (c *ContainerRequest) validateContextAndImage() error { if c.FromDockerfile.Context != "" && c.Image != "" { return errors.New("you cannot specify both an Image and Context in a ContainerRequest") @@ -248,6 +389,8 @@ func (c *ContainerRequest) validateContextOrImageIsSpecified() error { return nil } +// validateMounts ensures that the mounts do not have duplicate targets. +// It will check the Mounts and HostConfigModifier.Binds fields. func (c *ContainerRequest) validateMounts() error { targets := make(map[string]bool, len(c.Mounts)) @@ -260,5 +403,29 @@ func (c *ContainerRequest) validateMounts() error { targets[targetPath] = true } } + + if c.HostConfigModifier == nil { + return nil + } + + hostConfig := container.HostConfig{} + + c.HostConfigModifier(&hostConfig) + + if hostConfig.Binds != nil && len(hostConfig.Binds) > 0 { + for _, bind := range hostConfig.Binds { + parts := strings.Split(bind, ":") + if len(parts) != 2 { + return fmt.Errorf("%w: %s", ErrInvalidBindMount, bind) + } + targetPath := parts[1] + if targets[targetPath] { + return fmt.Errorf("%w: %s", ErrDuplicateMountTarget, targetPath) + } else { + targets[targetPath] = true + } + } + } + return nil } diff --git a/vendor/github.com/testcontainers/testcontainers-go/docker.go b/vendor/github.com/testcontainers/testcontainers-go/docker.go index 5e935c67..6d10cf92 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/docker.go +++ b/vendor/github.com/testcontainers/testcontainers-go/docker.go @@ -11,9 +11,11 @@ import ( "errors" "fmt" "io" + "io/fs" "net/url" "os" "path/filepath" + "regexp" "strings" "sync" "time" @@ -28,23 +30,17 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/go-connections/nat" - "github.com/google/uuid" "github.com/moby/term" specs "github.com/opencontainers/image-spec/specs-go/v1" + tcexec "github.com/testcontainers/testcontainers-go/exec" - "github.com/testcontainers/testcontainers-go/internal" - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" - "github.com/testcontainers/testcontainers-go/internal/testcontainerssession" + "github.com/testcontainers/testcontainers-go/internal/config" + "github.com/testcontainers/testcontainers-go/internal/core" "github.com/testcontainers/testcontainers-go/wait" ) -var ( - // Implement interfaces - _ Container = (*DockerContainer)(nil) - - logOnce sync.Once - ErrDuplicateMountTarget = errors.New("duplicate mount target detected") -) +// Implement interfaces +var _ Container = (*DockerContainer)(nil) const ( Bridge = "bridge" // Bridge network name (as well as driver) @@ -55,6 +51,8 @@ const ( logStoppedForOutOfSyncMessage = "Stopping log consumer: Headers out of sync" ) +var createContainerFailDueToNameConflictRegex = regexp.MustCompile("Conflict. The container name .* is already in use by container .*") + // DockerContainer represents a container started using Docker type DockerContainer struct { // Container ID from Docker @@ -62,16 +60,32 @@ type DockerContainer struct { WaitingFor wait.Strategy Image string - isRunning bool - imageWasBuilt bool - provider *DockerProvider - sessionID uuid.UUID - terminationSignal chan bool - consumers []LogConsumer - raw *types.ContainerJSON - stopProducer chan bool - logger Logging - lifecycleHooks []ContainerLifecycleHooks + isRunning bool + imageWasBuilt bool + // keepBuiltImage makes Terminate not remove the image if imageWasBuilt. + keepBuiltImage bool + provider *DockerProvider + sessionID string + terminationSignal chan bool + consumers []LogConsumer + raw *types.ContainerJSON + logProductionError chan error + + // TODO: Remove locking and wait group once the deprecated StartLogProducer and + // StopLogProducer have been removed and hence logging can only be started and + // stopped once. + + // logProductionWaitGroup is used to signal when the log production has stopped. + // This allows stopLogProduction to safely set logProductionStop to nil. + logProductionWaitGroup sync.WaitGroup + + // logProductionMutex protects logProductionStop channel so it can be started again. + logProductionMutex sync.Mutex + logProductionStop chan struct{} + + logProductionTimeout *time.Duration + logger Logging + lifecycleHooks []ContainerLifecycleHooks } // SetLogger sets the logger for the container @@ -183,7 +197,7 @@ func (c *DockerContainer) Ports(ctx context.Context) (nat.PortMap, error) { // SessionID gets the current session id func (c *DockerContainer) SessionID() string { - return c.sessionID.String() + return c.sessionID } // Start will start an already created container @@ -193,7 +207,7 @@ func (c *DockerContainer) Start(ctx context.Context) error { return err } - if err := c.provider.client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}); err != nil { + if err := c.provider.client.ContainerStart(ctx, c.ID, container.StartOptions{}); err != nil { return err } defer c.provider.Close() @@ -203,6 +217,13 @@ func (c *DockerContainer) Start(ctx context.Context) error { return err } + c.isRunning = true + + err = c.readiedHook(ctx) + if err != nil { + return err + } + return nil } @@ -245,71 +266,54 @@ func (c *DockerContainer) Stop(ctx context.Context, timeout *time.Duration) erro // Terminate is used to kill the container. It is usually triggered by as defer function. func (c *DockerContainer) Terminate(ctx context.Context) error { - err := c.terminatingHook(ctx) - if err != nil { - return err - } - - err = c.StopLogProducer() - if err != nil { - return err - } - select { // close reaper if it was created case c.terminationSignal <- true: default: } - err = c.provider.client.ContainerRemove(ctx, c.GetContainerID(), types.ContainerRemoveOptions{ - RemoveVolumes: true, - Force: true, - }) - if err != nil { - return err - } - err = c.terminatedHook(ctx) - if err != nil { - return err + defer c.provider.client.Close() + + errs := []error{ + c.terminatingHook(ctx), + c.provider.client.ContainerRemove(ctx, c.GetContainerID(), container.RemoveOptions{ + RemoveVolumes: true, + Force: true, + }), + c.terminatedHook(ctx), } - if c.imageWasBuilt { + if c.imageWasBuilt && !c.keepBuiltImage { _, err := c.provider.client.ImageRemove(ctx, c.Image, types.ImageRemoveOptions{ Force: true, PruneChildren: true, }) - if err != nil { - return err - } - } - - if err := c.provider.client.Close(); err != nil { - return err + errs = append(errs, err) } - c.sessionID = uuid.UUID{} + c.sessionID = "" c.isRunning = false - return nil + return errors.Join(errs...) } // update container raw info func (c *DockerContainer) inspectRawContainer(ctx context.Context) (*types.ContainerJSON, error) { + defer c.provider.Close() inspect, err := c.provider.client.ContainerInspect(ctx, c.ID) if err != nil { return nil, err } - defer c.provider.Close() c.raw = &inspect return c.raw, nil } func (c *DockerContainer) inspectContainer(ctx context.Context) (*types.ContainerJSON, error) { + defer c.provider.Close() inspect, err := c.provider.client.ContainerInspect(ctx, c.ID) if err != nil { return nil, err } - defer c.provider.Close() return &inspect, nil } @@ -317,10 +321,9 @@ func (c *DockerContainer) inspectContainer(ctx context.Context) (*types.Containe // Logs will fetch both STDOUT and STDERR from the current container. Returns a // ReadCloser and leaves it up to the caller to extract what it wants. func (c *DockerContainer) Logs(ctx context.Context) (io.ReadCloser, error) { - const streamHeaderSize = 8 - options := types.ContainerLogsOptions{ + options := container.LogsOptions{ ShowStdout: true, ShowStderr: true, } @@ -335,7 +338,7 @@ func (c *DockerContainer) Logs(ctx context.Context) (io.ReadCloser, error) { r := bufio.NewReader(rc) go func() { - var lineStarted = true + lineStarted := true for err == nil { line, isPrefix, err := r.ReadLine() @@ -369,9 +372,14 @@ func (c *DockerContainer) Logs(ctx context.Context) (io.ReadCloser, error) { return pr, nil } -// FollowOutput adds a LogConsumer to be sent logs from the container's -// STDOUT and STDERR +// Deprecated: use the ContainerRequest.LogConsumerConfig field instead. func (c *DockerContainer) FollowOutput(consumer LogConsumer) { + c.followOutput(consumer) +} + +// followOutput adds a LogConsumer to be sent logs from the container's +// STDOUT and STDERR +func (c *DockerContainer) followOutput(consumer LogConsumer) { c.consumers = append(c.consumers, consumer) } @@ -472,12 +480,16 @@ func (c *DockerContainer) NetworkAliases(ctx context.Context) (map[string][]stri func (c *DockerContainer) Exec(ctx context.Context, cmd []string, options ...tcexec.ProcessOption) (int, io.Reader, error) { cli := c.provider.client - response, err := cli.ContainerExecCreate(ctx, c.ID, types.ExecConfig{ - Cmd: cmd, - Detach: false, - AttachStdout: true, - AttachStderr: true, - }) + + processOptions := tcexec.NewProcessOptions(cmd) + + // processing all the options in a first loop because for the multiplexed option + // we first need to have a containerExecCreateResponse + for _, o := range options { + o.Apply(processOptions) + } + + response, err := cli.ContainerExecCreate(ctx, c.ID, processOptions.ExecConfig) if err != nil { return 0, nil, err } @@ -487,12 +499,12 @@ func (c *DockerContainer) Exec(ctx context.Context, cmd []string, options ...tce return 0, nil, err } - opt := &tcexec.ProcessOptions{ - Reader: hijack.Reader, - } + processOptions.Reader = hijack.Reader + // second loop to process the multiplexed option, as now we have a reader + // from the created exec response. for _, o := range options { - o.Apply(opt) + o.Apply(processOptions) } var exitCode int @@ -510,7 +522,7 @@ func (c *DockerContainer) Exec(ctx context.Context, cmd []string, options ...tce time.Sleep(100 * time.Millisecond) } - return exitCode, opt.Reader, nil + return exitCode, processOptions.Reader, nil } type FileFromContainer struct { @@ -590,21 +602,43 @@ func (c *DockerContainer) CopyFileToContainer(ctx context.Context, hostFilePath return c.CopyDirToContainer(ctx, hostFilePath, containerFilePath, fileMode) } - fileContent, err := os.ReadFile(hostFilePath) + f, err := os.Open(hostFilePath) if err != nil { return err } - return c.CopyToContainer(ctx, fileContent, containerFilePath, fileMode) + defer f.Close() + + info, err := f.Stat() + if err != nil { + return err + } + + // In Go 1.22 os.File is always an io.WriterTo. However, testcontainers + // currently allows Go 1.21, so we need to trick the compiler a little. + var file fs.File = f + return c.copyToContainer(ctx, func(tw io.Writer) error { + // Attempt optimized writeTo, implemented in linux + if wt, ok := file.(io.WriterTo); ok { + _, err := wt.WriteTo(tw) + return err + } + _, err := io.Copy(tw, f) + return err + }, info.Size(), containerFilePath, fileMode) } // CopyToContainer copies fileContent data to a file in container func (c *DockerContainer) CopyToContainer(ctx context.Context, fileContent []byte, containerFilePath string, fileMode int64) error { - buffer, err := tarFile(fileContent, containerFilePath, fileMode) - if err != nil { + return c.copyToContainer(ctx, func(tw io.Writer) error { + _, err := tw.Write(fileContent) return err - } + }, int64(len(fileContent)), containerFilePath, fileMode) +} - err = c.provider.client.CopyToContainer(ctx, c.ID, filepath.Dir(containerFilePath), buffer, types.CopyToContainerOptions{}) +func (c *DockerContainer) copyToContainer(ctx context.Context, fileContent func(tw io.Writer) error, fileContentSize int64, containerFilePath string, fileMode int64) error { + buffer, err := tarFile(containerFilePath, fileContent, fileContentSize, fileMode) + + err = c.provider.client.CopyToContainer(ctx, c.ID, "/", buffer, types.CopyToContainerOptions{}) if err != nil { return err } @@ -613,45 +647,92 @@ func (c *DockerContainer) CopyToContainer(ctx context.Context, fileContent []byt return nil } -// StartLogProducer will start a concurrent process that will continuously read logs -// from the container and will send them to each added LogConsumer -func (c *DockerContainer) StartLogProducer(ctx context.Context) error { - if c.stopProducer != nil { - return errors.New("log producer already started") +type LogProductionOption func(*DockerContainer) + +// WithLogProductionTimeout is a functional option that sets the timeout for the log production. +// If the timeout is lower than 5s or greater than 60s it will be set to 5s or 60s respectively. +func WithLogProductionTimeout(timeout time.Duration) LogProductionOption { + return func(c *DockerContainer) { + c.logProductionTimeout = &timeout + } +} + +// Deprecated: use the ContainerRequest.LogConsumerConfig field instead. +func (c *DockerContainer) StartLogProducer(ctx context.Context, opts ...LogProductionOption) error { + return c.startLogProduction(ctx, opts...) +} + +// startLogProduction will start a concurrent process that will continuously read logs +// from the container and will send them to each added LogConsumer. +// Default log production timeout is 5s. It is used to set the context timeout +// which means that each log-reading loop will last at least the specified timeout +// and that it cannot be cancelled earlier. +// Use functional option WithLogProductionTimeout() to override default timeout. If it's +// lower than 5s and greater than 60s it will be set to 5s or 60s respectively. +func (c *DockerContainer) startLogProduction(ctx context.Context, opts ...LogProductionOption) error { + { + c.logProductionMutex.Lock() + defer c.logProductionMutex.Unlock() + + if c.logProductionStop != nil { + return errors.New("log production already started") + } + + c.logProductionStop = make(chan struct{}) + c.logProductionWaitGroup.Add(1) + } + + for _, opt := range opts { + opt(c) + } + + minLogProductionTimeout := time.Duration(5 * time.Second) + maxLogProductionTimeout := time.Duration(60 * time.Second) + + if c.logProductionTimeout == nil { + c.logProductionTimeout = &minLogProductionTimeout + } + + if *c.logProductionTimeout < minLogProductionTimeout { + c.logProductionTimeout = &minLogProductionTimeout + } + + if *c.logProductionTimeout > maxLogProductionTimeout { + c.logProductionTimeout = &maxLogProductionTimeout } - c.stopProducer = make(chan bool) + c.logProductionError = make(chan error, 1) + + go func() { + defer func() { + close(c.logProductionError) + c.logProductionWaitGroup.Done() + }() - go func(stop <-chan bool) { since := "" // if the socket is closed we will make additional logs request with updated Since timestamp BEGIN: - options := types.ContainerLogsOptions{ + options := container.LogsOptions{ ShowStdout: true, ShowStderr: true, Follow: true, Since: since, } - ctx, cancel := context.WithTimeout(ctx, time.Second*5) + ctx, cancel := context.WithTimeout(ctx, *c.logProductionTimeout) defer cancel() r, err := c.provider.client.ContainerLogs(ctx, c.GetContainerID(), options) if err != nil { - // if we can't get the logs, panic, we can't return an error to anything - // from within this goroutine - panic(err) + c.logProductionError <- err + return } defer c.provider.Close() for { select { - case <-stop: - err := r.Close() - if err != nil { - // we can't close the read closer, this should never happen - panic(err) - } + case <-c.logProductionStop: + c.logProductionError <- r.Close() return default: h := make([]byte, 8) @@ -663,7 +744,7 @@ func (c *DockerContainer) StartLogProducer(ctx context.Context) error { since = fmt.Sprintf("%d.%09d", now.Unix(), int64(now.Nanosecond())) goto BEGIN } - if errors.Is(err, context.DeadlineExceeded) { + if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) { // Probably safe to continue here continue } @@ -691,7 +772,7 @@ func (c *DockerContainer) StartLogProducer(ctx context.Context) error { if err != nil { // TODO: add-logger: use logger to log out this error _, _ = fmt.Fprintf(os.Stderr, "error occurred reading log with known length %s", err.Error()) - if errors.Is(err, context.DeadlineExceeded) { + if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) { // Probably safe to continue here continue } @@ -707,21 +788,39 @@ func (c *DockerContainer) StartLogProducer(ctx context.Context) error { } } } - }(c.stopProducer) + }() return nil } -// StopLogProducer will stop the concurrent process that is reading logs -// and sending them to each added LogConsumer +// Deprecated: it will be removed in the next major release. func (c *DockerContainer) StopLogProducer() error { - if c.stopProducer != nil { - c.stopProducer <- true - c.stopProducer = nil + return c.stopLogProduction() +} + +// stopLogProduction will stop the concurrent process that is reading logs +// and sending them to each added LogConsumer +func (c *DockerContainer) stopLogProduction() error { + // TODO: Remove locking and wait group once StartLogProducer and StopLogProducer + // have been removed and hence logging can only be started / stopped once. + c.logProductionMutex.Lock() + defer c.logProductionMutex.Unlock() + if c.logProductionStop != nil { + close(c.logProductionStop) + c.logProductionWaitGroup.Wait() + // Set c.logProductionStop to nil so that it can be started again. + c.logProductionStop = nil + return <-c.logProductionError } return nil } +// GetLogProductionErrorChannel exposes the only way for the consumer +// to be able to listen to errors and react to them. +func (c *DockerContainer) GetLogProductionErrorChannel() <-chan error { + return c.logProductionError +} + // DockerNetwork represents a network started using Docker type DockerNetwork struct { ID string // Network ID from Docker @@ -739,13 +838,9 @@ func (n *DockerNetwork) Remove(ctx context.Context) error { default: } - err := n.provider.client.NetworkRemove(ctx, n.ID) - if err != nil { - return err - } defer n.provider.Close() - return nil + return n.provider.client.NetworkRemove(ctx, n.ID) } // DockerProvider implements the ContainerProvider interface @@ -778,37 +873,18 @@ func (p *DockerProvider) SetClient(c client.APIClient) { var _ ContainerProvider = (*DockerProvider)(nil) -func NewDockerClient() (cli *client.Client, err error) { - return testcontainersdocker.NewClient(context.Background()) -} - // BuildImage will build and image from context and Dockerfile, then return the tag func (p *DockerProvider) BuildImage(ctx context.Context, img ImageBuildInfo) (string, error) { - repo := uuid.New() - tag := uuid.New() - - repoTag := fmt.Sprintf("%s:%s", repo, tag) - - buildContext, err := img.GetContext() - if err != nil { - return "", err - } - - buildOptions := types.ImageBuildOptions{ - BuildArgs: img.GetBuildArgs(), - Dockerfile: img.GetDockerfile(), - AuthConfigs: img.GetAuthConfigs(), - Context: buildContext, - Tags: []string{repoTag}, - Remove: true, - ForceRemove: true, - } + buildOptions, err := img.BuildOptions() + var buildError error var resp types.ImageBuildResponse err = backoff.Retry(func() error { - resp, err = p.client.ImageBuild(ctx, buildContext, buildOptions) + resp, err = p.client.ImageBuild(ctx, buildOptions.Context, buildOptions) if err != nil { - if _, ok := err.(errdefs.ErrNotFound); ok { + buildError = errors.Join(buildError, err) + var enf errdefs.ErrNotFound + if errors.As(err, &enf) { return backoff.Permanent(err) } Logger.Printf("Failed to build image: %s, will retry", err) @@ -819,7 +895,7 @@ func (p *DockerProvider) BuildImage(ctx context.Context, img ImageBuildInfo) (st return nil }, backoff.WithContext(backoff.NewExponentialBackOff(), ctx)) if err != nil { - return "", err + return "", errors.Join(buildError, err) } if img.ShouldPrintBuildLog() { @@ -840,7 +916,8 @@ func (p *DockerProvider) BuildImage(ctx context.Context, img ImageBuildInfo) (st _ = resp.Body.Close() - return repoTag, nil + // the first tag is the one we want + return buildOptions.Tags[0], nil } // CreateContainer fulfills a request for a container without starting it @@ -876,6 +953,8 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque } } + imageName := req.Image + env := []string{} for envKey, envVar := range req.Env { env = append(env, envKey+"="+envVar) @@ -885,20 +964,13 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque req.Labels = make(map[string]string) } - reaperOpts := containerOptions{ - ImageName: req.ReaperImage, - } - for _, opt := range req.ReaperOptions { - opt(&reaperOpts) - } - tcConfig := p.Config().Config var termSignal chan bool // the reaper does not need to start a reaper for itself - isReaperContainer := strings.EqualFold(req.Image, reaperImage(reaperOpts.ImageName)) + isReaperContainer := strings.HasSuffix(imageName, config.ReaperDefaultImage) if !tcConfig.RyukDisabled && !isReaperContainer { - r, err := reuseOrCreateReaper(context.WithValue(ctx, testcontainersdocker.DockerHostContextKey, p.host), testcontainerssession.String(), p, req.ReaperOptions...) + r, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, p.host), core.SessionID(), p) if err != nil { return nil, fmt.Errorf("%w: creating reaper failed", err) } @@ -906,28 +978,42 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque if err != nil { return nil, fmt.Errorf("%w: connecting to reaper failed", err) } - for k, v := range r.Labels() { - if _, ok := req.Labels[k]; !ok { - req.Labels[k] = v - } - } } + // Cleanup on error, otherwise set termSignal to nil before successful return. + defer func() { + if termSignal != nil { + termSignal <- true + } + }() + if err = req.Validate(); err != nil { return nil, err } - var tag string + // always append the hub substitutor after the user-defined ones + req.ImageSubstitutors = append(req.ImageSubstitutors, newPrependHubRegistry(tcConfig.HubImageNamePrefix)) + + for _, is := range req.ImageSubstitutors { + modifiedTag, err := is.Substitute(imageName) + if err != nil { + return nil, fmt.Errorf("failed to substitute image %s with %s: %w", imageName, is.Description(), err) + } + + if modifiedTag != imageName { + p.Logger.Printf("✍🏼 Replacing image with %s. From: %s to %s\n", is.Description(), imageName, modifiedTag) + imageName = modifiedTag + } + } + var platform *specs.Platform if req.ShouldBuildImage() { - tag, err = p.BuildImage(ctx, &req) + imageName, err = p.BuildImage(ctx, &req) if err != nil { return nil, err } } else { - tag = req.Image - if req.ImagePlatform != "" { p, err := platforms.Parse(req.ImagePlatform) if err != nil { @@ -941,7 +1027,7 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque if req.AlwaysPullImage { shouldPullImage = true // If requested always attempt to pull image } else { - image, _, err := p.client.ImageInspectWithRaw(ctx, tag) + image, _, err := p.client.ImageInspectWithRaw(ctx, imageName) if err != nil { if client.IsErrNotFound(err) { shouldPullImage = true @@ -958,34 +1044,28 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque pullOpt := types.ImagePullOptions{ Platform: req.ImagePlatform, // may be empty } - - registry, imageAuth, err := DockerImageAuth(ctx, req.Image) - if err != nil { - p.Logger.Printf("Failed to get image auth for %s. Setting empty credentials for the image: %s. Error is:%s", registry, req.Image, err) - } else { - // see https://github.com/docker/docs/blob/e8e1204f914767128814dca0ea008644709c117f/engine/api/sdk/examples.md?plain=1#L649-L657 - encodedJSON, err := json.Marshal(imageAuth) - if err != nil { - p.Logger.Printf("Failed to marshal image auth. Setting empty credentials for the image: %s. Error is:%s", req.Image, err) - } else { - pullOpt.RegistryAuth = base64.URLEncoding.EncodeToString(encodedJSON) - } - } - - if err := p.attemptToPullImage(ctx, tag, pullOpt); err != nil { + if err := p.attemptToPullImage(ctx, imageName, pullOpt); err != nil { return nil, err } } } + if !isReaperContainer { + // add the labels that the reaper will use to terminate the container to the request + for k, v := range core.DefaultLabels(core.SessionID()) { + req.Labels[k] = v + } + } + dockerInput := &container.Config{ Entrypoint: req.Entrypoint, - Image: tag, + Image: imageName, Env: env, Labels: req.Labels, Cmd: req.Cmd, Hostname: req.Hostname, User: req.User, + WorkingDir: req.WorkingDir, } hostConfig := &container.HostConfig{ @@ -999,51 +1079,13 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque // default hooks include logger hook and pre-create hook defaultHooks := []ContainerLifecycleHooks{ DefaultLoggingHook(p.Logger), - { - PreCreates: []ContainerRequestHook{ - func(ctx context.Context, req ContainerRequest) error { - return p.preCreateContainerHook(ctx, req, dockerInput, hostConfig, networkingConfig) - }, - }, - PostCreates: []ContainerHook{ - // copy files to container after it's created - func(ctx context.Context, c Container) error { - for _, f := range req.Files { - err := c.CopyFileToContainer(ctx, f.HostFilePath, f.ContainerFilePath, f.FileMode) - if err != nil { - return fmt.Errorf("can't copy %s to container: %w", f.HostFilePath, err) - } - } - - return nil - }, - }, - PostStarts: []ContainerHook{ - // first post-start hook is to wait for the container to be ready - func(ctx context.Context, c Container) error { - dockerContainer := c.(*DockerContainer) - - // if a Wait Strategy has been specified, wait before returning - if dockerContainer.WaitingFor != nil { - dockerContainer.logger.Printf( - "🚧 Waiting for container id %s image: %s. Waiting for: %+v", - dockerContainer.ID[:12], dockerContainer.Image, dockerContainer.WaitingFor, - ) - if err := dockerContainer.WaitingFor.WaitUntilReady(ctx, c); err != nil { - return err - } - } - - dockerContainer.isRunning = true - - return nil - }, - }, - }, + defaultPreCreateHook(ctx, p, req, dockerInput, hostConfig, networkingConfig), + defaultCopyFileToContainerHook(req.Files), + defaultLogConsumersHook(req.LogConsumerCfg), + defaultReadinessHook(), } - // always prepend default lifecycle hooks to user-defined hooks - req.LifecycleHooks = append(defaultHooks, req.LifecycleHooks...) + req.LifecycleHooks = []ContainerLifecycleHooks{combineContainerHooks(defaultHooks, req.LifecycleHooks)} err = req.creatingHook(ctx) if err != nil { @@ -1076,12 +1118,12 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque c := &DockerContainer{ ID: resp.ID, WaitingFor: req.WaitingFor, - Image: tag, + Image: imageName, imageWasBuilt: req.ShouldBuildImage(), - sessionID: testcontainerssession.ID(), + keepBuiltImage: req.ShouldKeepBuiltImage(), + sessionID: core.SessionID(), provider: p, terminationSignal: termSignal, - stopProducer: nil, logger: p.Logger, lifecycleHooks: req.LifecycleHooks, } @@ -1091,6 +1133,9 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque return nil, err } + // Disable cleanup on success + termSignal = nil + return c, nil } @@ -1101,7 +1146,7 @@ func (p *DockerProvider) findContainerByName(ctx context.Context, name string) ( // Note that, 'name' filter will use regex to find the containers filter := filters.NewArgs(filters.Arg("name", fmt.Sprintf("^%s$", name))) - containers, err := p.client.ContainerList(ctx, types.ContainerListOptions{Filters: filter}) + containers, err := p.client.ContainerList(ctx, container.ListOptions{Filters: filter}) if err != nil { return nil, err } @@ -1113,20 +1158,49 @@ func (p *DockerProvider) findContainerByName(ctx context.Context, name string) ( return nil, nil } +func (p *DockerProvider) waitContainerCreation(ctx context.Context, name string) (*types.Container, error) { + var container *types.Container + return container, backoff.Retry(func() error { + c, err := p.findContainerByName(ctx, name) + if err != nil { + return err + } + + if c == nil { + return fmt.Errorf("container %s not found", name) + } + + container = c + return nil + }, backoff.WithContext(backoff.NewExponentialBackOff(), ctx)) +} + func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req ContainerRequest) (Container, error) { c, err := p.findContainerByName(ctx, req.Name) if err != nil { return nil, err } if c == nil { - return p.CreateContainer(ctx, req) + createdContainer, err := p.CreateContainer(ctx, req) + if err == nil { + return createdContainer, nil + } + if !createContainerFailDueToNameConflictRegex.MatchString(err.Error()) { + return nil, err + } + c, err = p.waitContainerCreation(ctx, req.Name) + if err != nil { + return nil, err + } } + sessionID := core.SessionID() + tcConfig := p.Config().Config var termSignal chan bool if !tcConfig.RyukDisabled { - r, err := reuseOrCreateReaper(context.WithValue(ctx, testcontainersdocker.DockerHostContextKey, p.host), testcontainerssession.String(), p, req.ReaperOptions...) + r, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, p.host), sessionID, p) if err != nil { return nil, fmt.Errorf("%w: creating reaper failed", err) } @@ -1136,16 +1210,34 @@ func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req Contain } } + // default hooks include logger hook and pre-create hook + defaultHooks := []ContainerLifecycleHooks{ + DefaultLoggingHook(p.Logger), + defaultReadinessHook(), + defaultLogConsumersHook(req.LogConsumerCfg), + } + dc := &DockerContainer{ ID: c.ID, WaitingFor: req.WaitingFor, Image: c.Image, - sessionID: testcontainerssession.ID(), + sessionID: sessionID, provider: p, terminationSignal: termSignal, - stopProducer: nil, logger: p.Logger, - isRunning: c.State == "running", + lifecycleHooks: []ContainerLifecycleHooks{combineContainerHooks(defaultHooks, req.LifecycleHooks)}, + } + + err = dc.startedHook(ctx) + if err != nil { + return nil, err + } + + dc.isRunning = true + + err = dc.readiedHook(ctx) + if err != nil { + return nil, err } return dc, nil @@ -1154,14 +1246,25 @@ func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req Contain // attemptToPullImage tries to pull the image while respecting the ctx cancellations. // Besides, if the image cannot be pulled due to ErrorNotFound then no need to retry but terminate immediately. func (p *DockerProvider) attemptToPullImage(ctx context.Context, tag string, pullOpt types.ImagePullOptions) error { - var ( - err error - pull io.ReadCloser - ) + registry, imageAuth, err := DockerImageAuth(ctx, tag) + if err != nil { + p.Logger.Printf("Failed to get image auth for %s. Setting empty credentials for the image: %s. Error is:%s", registry, tag, err) + } else { + // see https://github.com/docker/docs/blob/e8e1204f914767128814dca0ea008644709c117f/engine/api/sdk/examples.md?plain=1#L649-L657 + encodedJSON, err := json.Marshal(imageAuth) + if err != nil { + p.Logger.Printf("Failed to marshal image auth. Setting empty credentials for the image: %s. Error is:%s", tag, err) + } else { + pullOpt.RegistryAuth = base64.URLEncoding.EncodeToString(encodedJSON) + } + } + + var pull io.ReadCloser err = backoff.Retry(func() error { pull, err = p.client.ImagePull(ctx, tag, pullOpt) if err != nil { - if _, ok := err.(errdefs.ErrNotFound); ok { + var enf errdefs.ErrNotFound + if errors.As(err, &enf) { return backoff.Permanent(err) } Logger.Printf("Failed to pull image: %s, will retry", err) @@ -1182,9 +1285,9 @@ func (p *DockerProvider) attemptToPullImage(ctx context.Context, tag string, pul } // Health measure the healthiness of the provider. Right now we leverage the -// docker-client ping endpoint to see if the daemon is reachable. -func (p *DockerProvider) Health(ctx context.Context) (err error) { - _, err = p.client.Ping(ctx) +// docker-client Info endpoint to see if the daemon is reachable. +func (p *DockerProvider) Health(ctx context.Context) error { + _, err := p.client.Info(ctx) defer p.Close() return err @@ -1239,10 +1342,10 @@ func daemonHost(ctx context.Context, p *DockerProvider) (string, error) { case "http", "https", "tcp": p.hostCache = url.Hostname() case "unix", "npipe": - if testcontainersdocker.InAContainer() { + if core.InAContainer() { ip, err := p.GetGatewayIP(ctx) if err != nil { - ip, err = testcontainersdocker.DefaultGatewayIP() + ip, err = core.DefaultGatewayIP() if err != nil { ip = "localhost" } @@ -1258,6 +1361,7 @@ func daemonHost(ctx context.Context, p *DockerProvider) (string, error) { return p.hostCache, nil } +// Deprecated: use network.New instead // CreateNetwork returns the object representing a new network identified by its name func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) (Network, error) { var err error @@ -1289,9 +1393,11 @@ func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) IPAM: req.IPAM, } + sessionID := core.SessionID() + var termSignal chan bool if !tcConfig.RyukDisabled { - r, err := reuseOrCreateReaper(context.WithValue(ctx, testcontainersdocker.DockerHostContextKey, p.host), testcontainerssession.String(), p, req.ReaperOptions...) + r, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, p.host), sessionID, p) if err != nil { return nil, fmt.Errorf("%w: creating network reaper failed", err) } @@ -1299,13 +1405,20 @@ func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) if err != nil { return nil, fmt.Errorf("%w: connecting to network reaper failed", err) } - for k, v := range r.Labels() { - if _, ok := req.Labels[k]; !ok { - req.Labels[k] = v - } - } } + // add the labels that the reaper will use to terminate the network to the request + for k, v := range core.DefaultLabels(sessionID) { + req.Labels[k] = v + } + + // Cleanup on error, otherwise set termSignal to nil before successful return. + defer func() { + if termSignal != nil { + termSignal <- true + } + }() + response, err := p.client.NetworkCreate(ctx, req.Name, nc) if err != nil { return &DockerNetwork{}, err @@ -1319,6 +1432,9 @@ func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) provider: p, } + // Disable cleanup on success + termSignal = nil + return n, nil } @@ -1388,11 +1504,7 @@ func (p *DockerProvider) getDefaultNetwork(ctx context.Context, cli client.APICl _, err = cli.NetworkCreate(ctx, reaperNetwork, types.NetworkCreate{ Driver: Bridge, Attachable: true, - Labels: map[string]string{ - TestcontainerLabel: "true", - testcontainersdocker.LabelLang: "go", - testcontainersdocker.LabelVersion: internal.Version, - }, + Labels: core.DefaultLabels(core.SessionID()), }) if err != nil { @@ -1402,3 +1514,90 @@ func (p *DockerProvider) getDefaultNetwork(ctx context.Context, cli client.APICl return reaperNetwork, nil } + +// containerFromDockerResponse builds a Docker container struct from the response of the Docker API +func containerFromDockerResponse(ctx context.Context, response types.Container) (*DockerContainer, error) { + provider, err := NewDockerProvider() + if err != nil { + return nil, err + } + + container := DockerContainer{} + + container.ID = response.ID + container.WaitingFor = nil + container.Image = response.Image + container.imageWasBuilt = false + + container.logger = provider.Logger + container.lifecycleHooks = []ContainerLifecycleHooks{ + DefaultLoggingHook(container.logger), + } + container.provider = provider + + container.sessionID = core.SessionID() + container.consumers = []LogConsumer{} + container.isRunning = response.State == "running" + + // the termination signal should be obtained from the reaper + container.terminationSignal = nil + + // populate the raw representation of the container + _, err = container.inspectRawContainer(ctx) + if err != nil { + return nil, err + } + + return &container, nil +} + +// ListImages list images from the provider. If an image has multiple Tags, each tag is reported +// individually with the same ID and same labels +func (p *DockerProvider) ListImages(ctx context.Context) ([]ImageInfo, error) { + images := []ImageInfo{} + + imageList, err := p.client.ImageList(ctx, types.ImageListOptions{}) + if err != nil { + return images, fmt.Errorf("listing images %w", err) + } + + for _, img := range imageList { + for _, tag := range img.RepoTags { + images = append(images, ImageInfo{ID: img.ID, Name: tag}) + } + } + + return images, nil +} + +// SaveImages exports a list of images as an uncompressed tar +func (p *DockerProvider) SaveImages(ctx context.Context, output string, images ...string) error { + outputFile, err := os.Create(output) + if err != nil { + return fmt.Errorf("opening output file %w", err) + } + defer func() { + _ = outputFile.Close() + }() + + imageReader, err := p.client.ImageSave(ctx, images) + if err != nil { + return fmt.Errorf("saving images %w", err) + } + defer func() { + _ = imageReader.Close() + }() + + // Attempt optimized readFrom, implemented in linux + _, err = outputFile.ReadFrom(imageReader) + if err != nil { + return fmt.Errorf("writing images to output %w", err) + } + + return nil +} + +// PullImage pulls image from registry +func (p *DockerProvider) PullImage(ctx context.Context, image string) error { + return p.attemptToPullImage(ctx, image, types.ImagePullOptions{}) +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/docker_auth.go b/vendor/github.com/testcontainers/testcontainers-go/docker_auth.go index ab80c814..e6fcfedf 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/docker_auth.go +++ b/vendor/github.com/testcontainers/testcontainers-go/docker_auth.go @@ -4,11 +4,13 @@ import ( "context" "encoding/base64" "encoding/json" + "net/url" "os" "github.com/cpuguy83/dockercfg" "github.com/docker/docker/api/types/registry" - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" + + "github.com/testcontainers/testcontainers-go/internal/core" ) // DockerImageAuth returns the auth config for the given Docker image, extracting first its Docker registry. @@ -16,33 +18,53 @@ import ( // for that registry, if it exists. func DockerImageAuth(ctx context.Context, image string) (string, registry.AuthConfig, error) { defaultRegistry := defaultRegistry(ctx) - reg := testcontainersdocker.ExtractRegistry(image, defaultRegistry) + reg := core.ExtractRegistry(image, defaultRegistry) cfgs, err := getDockerAuthConfigs() if err != nil { return reg, registry.AuthConfig{}, err } - if cfg, ok := cfgs[reg]; ok { + if cfg, ok := getRegistryAuth(reg, cfgs); ok { return reg, cfg, nil } return reg, registry.AuthConfig{}, dockercfg.ErrCredentialsNotFound } +func getRegistryAuth(reg string, cfgs map[string]registry.AuthConfig) (registry.AuthConfig, bool) { + if cfg, ok := cfgs[reg]; ok { + return cfg, true + } + + // fallback match using authentication key host + for k, cfg := range cfgs { + keyURL, err := url.Parse(k) + if err != nil { + continue + } + + if keyURL.Host == reg { + return cfg, true + } + } + + return registry.AuthConfig{}, false +} + // defaultRegistry returns the default registry to use when pulling images // It will use the docker daemon to get the default registry, returning "https://index.docker.io/v1/" if // it fails to get the information from the daemon func defaultRegistry(ctx context.Context) string { - client, err := testcontainersdocker.NewClient(ctx) + client, err := NewDockerClientWithOpts(ctx) if err != nil { - return testcontainersdocker.IndexDockerIO + return core.IndexDockerIO } defer client.Close() info, err := client.Info(ctx) if err != nil { - return testcontainersdocker.IndexDockerIO + return core.IndexDockerIO } return info.IndexServerAddress @@ -81,6 +103,17 @@ func getDockerAuthConfigs() (map[string]registry.AuthConfig, error) { cfgs[k] = ac } + // in the case where the auth field in the .docker/conf.json is empty, and the user has credential helpers registered + // the auth comes from there + for k := range cfg.CredentialHelpers { + ac := registry.AuthConfig{} + u, p, _ := dockercfg.GetRegistryCredentials(k) + ac.Username = u + ac.Password = p + + cfgs[k] = ac + } + return cfgs, nil } @@ -96,7 +129,6 @@ func getDockerConfig() (dockercfg.Config, error) { if err == nil { return cfg, nil } - } cfg, err := dockercfg.LoadDefaultConfig() diff --git a/vendor/github.com/testcontainers/testcontainers-go/docker_client.go b/vendor/github.com/testcontainers/testcontainers-go/docker_client.go new file mode 100644 index 00000000..eb719cf2 --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/docker_client.go @@ -0,0 +1,129 @@ +package testcontainers + +import ( + "context" + "fmt" + "sync" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/events" + "github.com/docker/docker/api/types/registry" + "github.com/docker/docker/api/types/system" + "github.com/docker/docker/client" + + "github.com/testcontainers/testcontainers-go/internal/core" +) + +// DockerClient is a wrapper around the docker client that is used by testcontainers-go. +// It implements the SystemAPIClient interface in order to cache the docker info and reuse it. +type DockerClient struct { + *client.Client // client is embedded into our own client +} + +var ( + // dockerInfo stores the docker info to be reused in the Info method + dockerInfo system.Info + dockerInfoSet bool + dockerInfoLock sync.Mutex +) + +// implements SystemAPIClient interface +var _ client.SystemAPIClient = &DockerClient{} + +// Events returns a channel to listen to events that happen to the docker daemon. +func (c *DockerClient) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) { + return c.Client.Events(ctx, options) +} + +// Info returns information about the docker server. The result of Info is cached +// and reused every time Info is called. +// It will also print out the docker server info, and the resolved Docker paths, to the default logger. +func (c *DockerClient) Info(ctx context.Context) (system.Info, error) { + dockerInfoLock.Lock() + defer dockerInfoLock.Unlock() + if dockerInfoSet { + return dockerInfo, nil + } + + info, err := c.Client.Info(ctx) + if err != nil { + return info, fmt.Errorf("failed to retrieve docker info: %w", err) + } + dockerInfo = info + dockerInfoSet = true + + infoMessage := `%v - Connected to docker: + Server Version: %v + API Version: %v + Operating System: %v + Total Memory: %v MB + Resolved Docker Host: %s + Resolved Docker Socket Path: %s + Test SessionID: %s + Test ProcessID: %s +` + + Logger.Printf(infoMessage, packagePath, + dockerInfo.ServerVersion, c.Client.ClientVersion(), + dockerInfo.OperatingSystem, dockerInfo.MemTotal/1024/1024, + core.ExtractDockerHost(ctx), + core.ExtractDockerSocket(ctx), + core.SessionID(), + core.ProcessID(), + ) + + return dockerInfo, nil +} + +// RegistryLogin logs into a Docker registry. +func (c *DockerClient) RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error) { + return c.Client.RegistryLogin(ctx, auth) +} + +// DiskUsage returns the disk usage of all images. +func (c *DockerClient) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) { + return c.Client.DiskUsage(ctx, options) +} + +// Ping pings the docker server. +func (c *DockerClient) Ping(ctx context.Context) (types.Ping, error) { + return c.Client.Ping(ctx) +} + +// Deprecated: Use NewDockerClientWithOpts instead. +func NewDockerClient() (*client.Client, error) { + cli, err := NewDockerClientWithOpts(context.Background()) + if err != nil { + return nil, err + } + + return cli.Client, nil +} + +func NewDockerClientWithOpts(ctx context.Context, opt ...client.Opt) (*DockerClient, error) { + dockerClient, err := core.NewClient(ctx, opt...) + if err != nil { + return nil, err + } + + tcClient := DockerClient{ + Client: dockerClient, + } + + if _, err = tcClient.Info(ctx); err != nil { + // Fallback to environment, including the original options + if len(opt) == 0 { + opt = []client.Opt{client.FromEnv, client.WithAPIVersionNegotiation()} + } + + dockerClient, err := client.NewClientWithOpts(opt...) + if err != nil { + return nil, err + } + + tcClient.Client = dockerClient + } + defer tcClient.Close() + + return &tcClient, nil +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/docker_mounts.go b/vendor/github.com/testcontainers/testcontainers-go/docker_mounts.go index bb63dc04..aed30103 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/docker_mounts.go +++ b/vendor/github.com/testcontainers/testcontainers-go/docker_mounts.go @@ -2,15 +2,14 @@ package testcontainers import "github.com/docker/docker/api/types/mount" -var ( - mountTypeMapping = map[MountType]mount.Type{ - MountTypeBind: mount.TypeBind, - MountTypeVolume: mount.TypeVolume, - MountTypeTmpfs: mount.TypeTmpfs, - MountTypePipe: mount.TypeNamedPipe, - } -) +var mountTypeMapping = map[MountType]mount.Type{ + MountTypeBind: mount.TypeBind, // Deprecated, it will be removed in a future release + MountTypeVolume: mount.TypeVolume, + MountTypeTmpfs: mount.TypeTmpfs, + MountTypePipe: mount.TypeNamedPipe, +} +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments // BindMounter can optionally be implemented by mount sources // to support advanced scenarios based on mount.BindOptions type BindMounter interface { @@ -29,6 +28,7 @@ type TmpfsMounter interface { GetTmpfsOptions() *mount.TmpfsOptions } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments type DockerBindMountSource struct { *mount.BindOptions @@ -37,14 +37,17 @@ type DockerBindMountSource struct { HostPath string } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments func (s DockerBindMountSource) Source() string { return s.HostPath } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments func (DockerBindMountSource) Type() MountType { return MountTypeBind } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments func (s DockerBindMountSource) GetBindOptions() *mount.BindOptions { return s.BindOptions } @@ -78,6 +81,12 @@ func (s DockerTmpfsMountSource) GetTmpfsOptions() *mount.TmpfsOptions { return s.TmpfsOptions } +// PrepareMounts maps the given []ContainerMount to the corresponding +// []mount.Mount for further processing +func (m ContainerMounts) PrepareMounts() []mount.Mount { + return mapToDockerMounts(m) +} + // mapToDockerMounts maps the given []ContainerMount to the corresponding // []mount.Mount for further processing func mapToDockerMounts(containerMounts ContainerMounts) []mount.Mount { @@ -101,12 +110,25 @@ func mapToDockerMounts(containerMounts ContainerMounts) []mount.Mount { } switch typedMounter := m.Source.(type) { - case BindMounter: - containerMount.BindOptions = typedMounter.GetBindOptions() case VolumeMounter: containerMount.VolumeOptions = typedMounter.GetVolumeOptions() case TmpfsMounter: containerMount.TmpfsOptions = typedMounter.GetTmpfsOptions() + case BindMounter: + Logger.Printf("Mount type %s is not supported by Testcontainers for Go", m.Source.Type()) + default: + // The provided source type has no custom options + } + + if mountType == mount.TypeVolume { + if containerMount.VolumeOptions == nil { + containerMount.VolumeOptions = &mount.VolumeOptions{ + Labels: make(map[string]string), + } + } + for k, v := range GenericLabels() { + containerMount.VolumeOptions.Labels[k] = v + } } mounts = append(mounts, containerMount) diff --git a/vendor/github.com/testcontainers/testcontainers-go/exec/processor.go b/vendor/github.com/testcontainers/testcontainers-go/exec/processor.go index 63987e46..c4f9e1b1 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/exec/processor.go +++ b/vendor/github.com/testcontainers/testcontainers-go/exec/processor.go @@ -4,12 +4,30 @@ import ( "bytes" "io" + "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/stdcopy" ) // ProcessOptions defines options applicable to the reader processor type ProcessOptions struct { - Reader io.Reader + ExecConfig types.ExecConfig + Reader io.Reader +} + +// NewProcessOptions returns a new ProcessOptions instance +// with the given command and default options: +// - detach: false +// - attach stdout: true +// - attach stderr: true +func NewProcessOptions(cmd []string) *ProcessOptions { + return &ProcessOptions{ + ExecConfig: types.ExecConfig{ + Cmd: cmd, + Detach: false, + AttachStdout: true, + AttachStderr: true, + }, + } } // ProcessOption defines a common interface to modify the reader processor @@ -24,8 +42,33 @@ func (fn ProcessOptionFunc) Apply(opts *ProcessOptions) { fn(opts) } +func WithUser(user string) ProcessOption { + return ProcessOptionFunc(func(opts *ProcessOptions) { + opts.ExecConfig.User = user + }) +} + +func WithWorkingDir(workingDir string) ProcessOption { + return ProcessOptionFunc(func(opts *ProcessOptions) { + opts.ExecConfig.WorkingDir = workingDir + }) +} + +func WithEnv(env []string) ProcessOption { + return ProcessOptionFunc(func(opts *ProcessOptions) { + opts.ExecConfig.Env = env + }) +} + func Multiplexed() ProcessOption { return ProcessOptionFunc(func(opts *ProcessOptions) { + // returning fast to bypass those options with a nil reader, + // which could be the case when other options are used + // to configure the exec creation. + if opts.Reader == nil { + return + } + done := make(chan struct{}) var outBuff bytes.Buffer @@ -39,6 +82,6 @@ func Multiplexed() ProcessOption { <-done - opts.Reader = &outBuff + opts.Reader = io.MultiReader(&outBuff, &errBuff) }) } diff --git a/vendor/github.com/testcontainers/testcontainers-go/file.go b/vendor/github.com/testcontainers/testcontainers-go/file.go index 509da643..a6743cc9 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/file.go +++ b/vendor/github.com/testcontainers/testcontainers-go/file.go @@ -41,7 +41,7 @@ func tarDir(src string, fileMode int64) (*bytes.Buffer, error) { buffer := &bytes.Buffer{} - fmt.Printf(">> creating TAR file from directory: %s\n", src) + Logger.Printf(">> creating TAR file from directory: %s\n", src) // tar > gzip > buffer zr := gzip.NewWriter(buffer) @@ -59,7 +59,7 @@ func tarDir(src string, fileMode int64) (*bytes.Buffer, error) { // if a symlink, skip file if fi.Mode().Type() == os.ModeSymlink { - fmt.Printf(">> skipping symlink: %s\n", file) + Logger.Printf(">> skipping symlink: %s\n", file) return nil } @@ -110,21 +110,21 @@ func tarDir(src string, fileMode int64) (*bytes.Buffer, error) { } // tarFile compress a single file using tar + gzip algorithms -func tarFile(fileContent []byte, basePath string, fileMode int64) (*bytes.Buffer, error) { +func tarFile(basePath string, fileContent func(tw io.Writer) error, fileContentSize int64, fileMode int64) (*bytes.Buffer, error) { buffer := &bytes.Buffer{} zr := gzip.NewWriter(buffer) tw := tar.NewWriter(zr) hdr := &tar.Header{ - Name: filepath.Base(basePath), + Name: basePath, Mode: fileMode, - Size: int64(len(fileContent)), + Size: fileContentSize, } if err := tw.WriteHeader(hdr); err != nil { return buffer, err } - if _, err := tw.Write(fileContent); err != nil { + if err := fileContent(tw); err != nil { return buffer, err } diff --git a/vendor/github.com/testcontainers/testcontainers-go/generic.go b/vendor/github.com/testcontainers/testcontainers-go/generic.go index 3f7024ab..65fec35c 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/generic.go +++ b/vendor/github.com/testcontainers/testcontainers-go/generic.go @@ -5,12 +5,8 @@ import ( "errors" "fmt" "sync" - "time" - "dario.cat/mergo" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" - "github.com/testcontainers/testcontainers-go/wait" + "github.com/testcontainers/testcontainers-go/internal/core" ) var ( @@ -27,77 +23,14 @@ type GenericContainerRequest struct { Reuse bool // reuse an existing container if it exists or create a new one. a container name mustn't be empty } -// ContainerCustomizer is an interface that can be used to configure the Testcontainers container -// request. The passed request will be merged with the default one. -type ContainerCustomizer interface { - Customize(req *GenericContainerRequest) -} - -// CustomizeRequestOption is a type that can be used to configure the Testcontainers container request. -// The passed request will be merged with the default one. -type CustomizeRequestOption func(req *GenericContainerRequest) - -func (opt CustomizeRequestOption) Customize(req *GenericContainerRequest) { - opt(req) -} - -// CustomizeRequest returns a function that can be used to merge the passed container request with the one that is used by the container. -// Slices and Maps will be appended. -func CustomizeRequest(src GenericContainerRequest) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - if err := mergo.Merge(req, &src, mergo.WithOverride, mergo.WithAppendSlice); err != nil { - fmt.Printf("error merging container request, keeping the original one. Error: %v", err) - return - } - } -} - -// WithImage sets the image for a container -func WithImage(image string) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - req.Image = image - } -} - -// WithConfigModifier allows to override the default container config -func WithConfigModifier(modifier func(config *container.Config)) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - req.ConfigModifier = modifier - } -} - -// WithEndpointSettingsModifier allows to override the default endpoint settings -func WithEndpointSettingsModifier(modifier func(settings map[string]*network.EndpointSettings)) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - req.EnpointSettingsModifier = modifier - } -} - -// WithHostConfigModifier allows to override the default host config -func WithHostConfigModifier(modifier func(hostConfig *container.HostConfig)) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - req.HostConfigModifier = modifier - } -} - -// WithWaitStrategy sets the wait strategy for a container, using 60 seconds as deadline -func WithWaitStrategy(strategies ...wait.Strategy) CustomizeRequestOption { - return WithWaitStrategyAndDeadline(60*time.Second, strategies...) -} - -// WithWaitStrategyAndDeadline sets the wait strategy for a container, including deadline -func WithWaitStrategyAndDeadline(deadline time.Duration, strategies ...wait.Strategy) CustomizeRequestOption { - return func(req *GenericContainerRequest) { - req.WaitingFor = wait.ForAll(strategies...).WithDeadline(deadline) - } -} - +// Deprecated: will be removed in the future. // GenericNetworkRequest represents parameters to a generic network type GenericNetworkRequest struct { NetworkRequest // embedded request for provider ProviderType ProviderType // which provider to use, Docker if empty } +// Deprecated: use network.New instead // GenericNetwork creates a generic network with parameters func GenericNetwork(ctx context.Context, req GenericNetworkRequest) (Network, error) { provider, err := req.ProviderType.GetProvider() @@ -126,6 +59,7 @@ func GenericContainer(ctx context.Context, req GenericContainerRequest) (Contain if err != nil { return nil, err } + defer provider.Close() var c Container if req.Reuse { @@ -139,12 +73,13 @@ func GenericContainer(ctx context.Context, req GenericContainerRequest) (Contain c, err = provider.CreateContainer(ctx, req.ContainerRequest) } if err != nil { - return nil, fmt.Errorf("%w: failed to create container", err) + // At this point `c` might not be nil. Give the caller an opportunity to call Destroy on the container. + return c, fmt.Errorf("%w: failed to create container", err) } if req.Started && !c.IsRunning() { if err := c.Start(ctx); err != nil { - return c, fmt.Errorf("%w: failed to start container", err) + return c, fmt.Errorf("failed to start container: %w", err) } } return c, nil @@ -154,4 +89,10 @@ func GenericContainer(ctx context.Context, req GenericContainerRequest) (Contain type GenericProvider interface { ContainerProvider NetworkProvider + ImageProvider +} + +// GenericLabels returns a map of labels that can be used to identify containers created by this library +func GenericLabels() map[string]string { + return core.DefaultLabels(core.SessionID()) } diff --git a/vendor/github.com/testcontainers/testcontainers-go/image.go b/vendor/github.com/testcontainers/testcontainers-go/image.go new file mode 100644 index 00000000..f7f2bf02 --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/image.go @@ -0,0 +1,18 @@ +package testcontainers + +import ( + "context" +) + +// ImageInfo represents a summary information of an image +type ImageInfo struct { + ID string + Name string +} + +// ImageProvider allows manipulating images +type ImageProvider interface { + ListImages(context.Context) ([]ImageInfo, error) + SaveImages(context.Context, string, ...string) error + PullImage(context.Context, string) error +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/config/config.go b/vendor/github.com/testcontainers/testcontainers-go/internal/config/config.go index 5460d6d6..1a7d0315 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/config/config.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/config/config.go @@ -6,22 +6,32 @@ import ( "path/filepath" "strconv" "sync" + "time" "github.com/magiconair/properties" ) -var tcConfig Config -var tcConfigOnce *sync.Once = new(sync.Once) +const ReaperDefaultImage = "testcontainers/ryuk:0.7.0" + +var ( + tcConfig Config + tcConfigOnce *sync.Once = new(sync.Once) +) -// Config represents the configuration for Testcontainers // testcontainersConfig { + +// Config represents the configuration for Testcontainers type Config struct { - Host string `properties:"docker.host,default="` - TLSVerify int `properties:"docker.tls.verify,default=0"` - CertPath string `properties:"docker.cert.path,default="` - RyukDisabled bool `properties:"ryuk.disabled,default=false"` - RyukPrivileged bool `properties:"ryuk.container.privileged,default=false"` - TestcontainersHost string `properties:"tc.host,default="` + Host string `properties:"docker.host,default="` + TLSVerify int `properties:"docker.tls.verify,default=0"` + CertPath string `properties:"docker.cert.path,default="` + HubImageNamePrefix string `properties:"hub.image.name.prefix,default="` + RyukDisabled bool `properties:"ryuk.disabled,default=false"` + RyukPrivileged bool `properties:"ryuk.container.privileged,default=false"` + RyukReconnectionTimeout time.Duration `properties:"ryuk.reconnection.timeout,default=10s"` + RyukConnectionTimeout time.Duration `properties:"ryuk.connection.timeout,default=1m"` + RyukVerbose bool `properties:"ryuk.verbose,default=false"` + TestcontainersHost string `properties:"tc.host,default="` } // } @@ -62,11 +72,21 @@ func read() Config { config.RyukDisabled = ryukDisabledEnv == "true" } + hubImageNamePrefix := os.Getenv("TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX") + if hubImageNamePrefix != "" { + config.HubImageNamePrefix = hubImageNamePrefix + } + ryukPrivilegedEnv := os.Getenv("TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED") if parseBool(ryukPrivilegedEnv) { config.RyukPrivileged = ryukPrivilegedEnv == "true" } + ryukVerboseEnv := os.Getenv("TESTCONTAINERS_RYUK_VERBOSE") + if parseBool(ryukVerboseEnv) { + config.RyukVerbose = ryukVerboseEnv == "true" + } + return config } @@ -87,14 +107,10 @@ func read() Config { return applyEnvironmentConfiguration(config) } - fmt.Printf("Testcontainers properties file has been found: %s\n", tcProp) - return applyEnvironmentConfiguration(config) } func parseBool(input string) bool { - if _, err := strconv.ParseBool(input); err == nil { - return true - } - return false + _, err := strconv.ParseBool(input) + return err == nil } diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/core/bootstrap.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/bootstrap.go new file mode 100644 index 00000000..cf06dde7 --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/bootstrap.go @@ -0,0 +1,105 @@ +package core + +import ( + "crypto/sha256" + "fmt" + "os" + + "github.com/google/uuid" + "github.com/shirou/gopsutil/v3/process" +) + +// sessionID returns a unique session ID for the current test session. Because each Go package +// will be run in a separate process, we need a way to identify the current test session. +// By test session, we mean: +// - a single "go test" invocation (including flags) +// - a single "go test ./..." invocation (including flags) +// - the execution of a single test or a set of tests using the IDE +// +// As a consequence, with the sole goal of aggregating test execution across multiple +// packages, this function will use the parent process ID (pid) of the current process +// and its creation date, to use it to generate a unique session ID. We are using the parent pid because +// the current process will be a child process of: +// - the process that is running the tests, e.g.: "go test"; +// - the process that is running the application in development mode, e.g. "go run main.go -tags dev"; +// - the process that is running the tests in the IDE, e.g.: "go test ./...". +// +// Finally, we will hash the combination of the "testcontainers-go:" string with the parent pid +// and the creation date of that parent process to generate a unique session ID. +// +// This sessionID will be used to: +// - identify the test session, aggregating the test execution of multiple packages in the same test session. +// - tag the containers created by testcontainers-go, adding a label to the container with the session ID. +var sessionID string + +// projectPath returns the current working directory of the parent test process running Testcontainers for Go. +// If it's not possible to get that directory, the library will use the current working directory. If again +// it's not possible to get the current working directory, the library will use a temporary directory. +var projectPath string + +// processID returns a unique ID for the current test process. Because each Go package will be run in a separate process, +// we need a way to identify the current test process, in the form of an UUID +var processID string + +const sessionIDPlaceholder = "testcontainers-go:%d:%d" + +func init() { + processID = uuid.New().String() + + parentPid := os.Getppid() + var createTime int64 + fallbackCwd, err := os.Getwd() + if err != nil { + // very unlinke to fail, but if it does, we will use a temp dir + fallbackCwd = os.TempDir() + } + + processes, err := process.Processes() + if err != nil { + sessionID = uuid.New().String() + projectPath = fallbackCwd + return + } + + for _, p := range processes { + if int(p.Pid) != parentPid { + continue + } + + cwd, err := p.Cwd() + if err != nil { + cwd = fallbackCwd + } + projectPath = cwd + + t, err := p.CreateTime() + if err != nil { + sessionID = uuid.New().String() + return + } + + createTime = t + break + } + + hasher := sha256.New() + _, err = hasher.Write([]byte(fmt.Sprintf(sessionIDPlaceholder, parentPid, createTime))) + if err != nil { + sessionID = uuid.New().String() + return + } + + sessionID = fmt.Sprintf("%x", hasher.Sum(nil)) +} + +func ProcessID() string { + return processID +} + +func ProjectPath() string { + return projectPath +} + +func SessionID() string { + return sessionID +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/client.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/client.go similarity index 63% rename from vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/client.go rename to vendor/github.com/testcontainers/testcontainers-go/internal/core/client.go index ec10d34d..64af509b 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/client.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/client.go @@ -1,12 +1,13 @@ -package testcontainersdocker +package core import ( "context" "path/filepath" "github.com/docker/docker/client" + + "github.com/testcontainers/testcontainers-go/internal" "github.com/testcontainers/testcontainers-go/internal/config" - "github.com/testcontainers/testcontainers-go/internal/testcontainerssession" ) // NewClient returns a new docker client extracting the docker host from the different alternatives @@ -31,7 +32,9 @@ func NewClient(ctx context.Context, ops ...client.Opt) (*client.Client, error) { opts = append(opts, client.WithHTTPHeaders( map[string]string{ - "x-tc-sid": testcontainerssession.String(), + "x-tc-pp": ProjectPath(), + "x-tc-sid": SessionID(), + "User-Agent": "tc-go/" + internal.Version, }), ) @@ -43,23 +46,5 @@ func NewClient(ctx context.Context, ops ...client.Opt) (*client.Client, error) { return nil, err } - if _, err = cli.Ping(context.Background()); err != nil { - // Fallback to environment, including the original options - cli, err = defaultClient(context.Background(), ops...) - if err != nil { - return nil, err - } - } - defer cli.Close() - return cli, nil } - -// defaultClient returns a plain, new docker client with the default options -func defaultClient(ctx context.Context, ops ...client.Opt) (*client.Client, error) { - if len(ops) == 0 { - ops = []client.Opt{client.FromEnv, client.WithAPIVersionNegotiation()} - } - - return client.NewClientWithOpts(ops...) -} diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_host.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go similarity index 96% rename from vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_host.go rename to vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go index c625c6cd..0b55ec01 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_host.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go @@ -1,4 +1,4 @@ -package testcontainersdocker +package core import ( "context" @@ -10,6 +10,7 @@ import ( "sync" "github.com/docker/docker/client" + "github.com/testcontainers/testcontainers-go/internal/config" ) @@ -29,11 +30,15 @@ var ( ErrTestcontainersHostNotSetInProperties = errors.New("tc.host not set in ~/.testcontainers.properties") ) -var dockerHostCache string -var dockerHostOnce sync.Once +var ( + dockerHostCache string + dockerHostOnce sync.Once +) -var dockerSocketPathCache string -var dockerSocketPathOnce sync.Once +var ( + dockerSocketPathCache string + dockerSocketPathOnce sync.Once +) // deprecated // see https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/dockerclient/DockerClientConfigUtils.java#L46 @@ -107,7 +112,7 @@ func extractDockerHost(ctx context.Context) string { for _, dockerHostFn := range dockerHostFns { dockerHost, err := dockerHostFn(ctx) if err != nil { - outerErr = fmt.Errorf("%w: %v", outerErr, err) + outerErr = fmt.Errorf("%w: %w", outerErr, err) continue } @@ -127,6 +132,7 @@ func extractDockerSocket(ctx context.Context) string { if err != nil { panic(err) // a Docker client is required to get the Docker info } + defer cli.Close() return extractDockerSocketFromClient(ctx, cli) } @@ -166,6 +172,10 @@ func extractDockerSocketFromClient(ctx context.Context, cli client.APIClient) st // Because Docker Desktop runs in a VM, we need to use the default docker path for rootless docker if info.OperatingSystem == "Docker Desktop" { + if IsWindows() { + return WindowsDockerSocketPath + } + return DockerSocketPath } @@ -202,12 +212,7 @@ func dockerHostFromProperties(ctx context.Context) (string, error) { cfg := config.Read() socketPath := cfg.Host if socketPath != "" { - parsed, err := parseURL(socketPath) - if err != nil { - return "", err - } - - return parsed, nil + return socketPath, nil } return "", ErrDockerSocketNotSetInProperties diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_rootless.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_rootless.go similarity index 93% rename from vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_rootless.go rename to vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_rootless.go index 43ff4637..44782d31 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_rootless.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_rootless.go @@ -1,4 +1,4 @@ -package testcontainersdocker +package core import ( "context" @@ -24,6 +24,11 @@ var ( // It is a variable so it can be modified for testing. var baseRunDir = "/run" +// IsWindows returns if the current OS is Windows. For that it checks the GOOS environment variable or the runtime.GOOS constant. +func IsWindows() bool { + return os.Getenv("GOOS") == "windows" || runtime.GOOS == "windows" +} + // rootlessDockerSocketPath returns if the path to the rootless Docker socket exists. // The rootless socket path is determined by the following order: // @@ -37,7 +42,7 @@ var baseRunDir = "/run" func rootlessDockerSocketPath(_ context.Context) (string, error) { // adding a manner to test it on non-windows machines, setting the GOOS env var to windows // This is needed because runtime.GOOS is a constant that returns the OS of the machine running the test - if os.Getenv("GOOS") == "windows" || runtime.GOOS == "windows" { + if IsWindows() { return "", ErrRootlessDockerNotSupportedWindows } @@ -52,7 +57,7 @@ func rootlessDockerSocketPath(_ context.Context) (string, error) { for _, socketPathFn := range socketPathFns { s, err := socketPathFn() if err != nil { - outerErr = fmt.Errorf("%w: %v", outerErr, err) + outerErr = fmt.Errorf("%w: %w", outerErr, err) continue } diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_socket.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_socket.go similarity index 90% rename from vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_socket.go rename to vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_socket.go index 42414e94..b0c0c848 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/docker_socket.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_socket.go @@ -1,4 +1,4 @@ -package testcontainersdocker +package core import ( "net/url" @@ -19,6 +19,9 @@ var DockerSocketPathWithSchema = DockerSocketSchema + DockerSocketPath // TCPSchema is the tcp schema. var TCPSchema = "tcp://" +// WindowsDockerSocketPath is the path to the docker socket under windows systems. +var WindowsDockerSocketPath = "//var/run/docker.sock" + func init() { const DefaultDockerHost = client.DefaultDockerHost diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/images.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/images.go similarity index 97% rename from vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/images.go rename to vendor/github.com/testcontainers/testcontainers-go/internal/core/images.go index 3dc10c2a..6c7213f1 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/images.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/images.go @@ -1,4 +1,4 @@ -package testcontainersdocker +package core import ( "bufio" @@ -60,7 +60,7 @@ func ExtractImagesFromDockerfile(dockerfile string, buildArgs map[string]*string // interpolate build args for k, v := range buildArgs { if v != nil { - parts[0] = strings.Replace(parts[0], "${"+k+"}", *v, -1) + parts[0] = strings.ReplaceAll(parts[0], "${"+k+"}", *v) } } images = append(images, parts[0]) diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/core/labels.go b/vendor/github.com/testcontainers/testcontainers-go/internal/core/labels.go new file mode 100644 index 00000000..58b054ab --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/core/labels.go @@ -0,0 +1,23 @@ +package core + +import ( + "github.com/testcontainers/testcontainers-go/internal" +) + +const ( + LabelBase = "org.testcontainers" + LabelLang = LabelBase + ".lang" + LabelReaper = LabelBase + ".reaper" + LabelRyuk = LabelBase + ".ryuk" + LabelSessionID = LabelBase + ".sessionId" + LabelVersion = LabelBase + ".version" +) + +func DefaultLabels(sessionID string) map[string]string { + return map[string]string{ + LabelBase: "true", + LabelLang: "go", + LabelSessionID: sessionID, + LabelVersion: internal.Version, + } +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/labels.go b/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/labels.go deleted file mode 100644 index 12742769..00000000 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainersdocker/labels.go +++ /dev/null @@ -1,9 +0,0 @@ -package testcontainersdocker - -const ( - LabelBase = "org.testcontainers" - LabelLang = LabelBase + ".lang" - LabelReaper = LabelBase + ".reaper" - LabelSessionID = LabelBase + ".sessionId" - LabelVersion = LabelBase + ".version" -) diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainerssession/session.go b/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainerssession/session.go deleted file mode 100644 index 21bd1f98..00000000 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/testcontainerssession/session.go +++ /dev/null @@ -1,22 +0,0 @@ -package testcontainerssession - -import ( - "sync" - - "github.com/google/uuid" -) - -var id uuid.UUID -var idOnce sync.Once - -func ID() uuid.UUID { - idOnce.Do(func() { - id = uuid.New() - }) - - return id -} - -func String() string { - return ID().String() -} diff --git a/vendor/github.com/testcontainers/testcontainers-go/internal/version.go b/vendor/github.com/testcontainers/testcontainers-go/internal/version.go index d3668352..684ecf1e 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/internal/version.go +++ b/vendor/github.com/testcontainers/testcontainers-go/internal/version.go @@ -1,4 +1,4 @@ package internal // Version is the next development version of the application -const Version = "0.22.0" +const Version = "0.30.0" diff --git a/vendor/github.com/testcontainers/testcontainers-go/lifecycle.go b/vendor/github.com/testcontainers/testcontainers-go/lifecycle.go index 55dd48cf..1cd0a8be 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/lifecycle.go +++ b/vendor/github.com/testcontainers/testcontainers-go/lifecycle.go @@ -2,6 +2,8 @@ package testcontainers import ( "context" + "errors" + "fmt" "io" "strings" @@ -24,6 +26,7 @@ type ContainerRequestHook func(ctx context.Context, req ContainerRequest) error // - Created // - Starting // - Started +// - Readied // - Stopping // - Stopped // - Terminating @@ -39,12 +42,14 @@ type ContainerLifecycleHooks struct { PostCreates []ContainerHook PreStarts []ContainerHook PostStarts []ContainerHook + PostReadies []ContainerHook PreStops []ContainerHook PostStops []ContainerHook PreTerminates []ContainerHook PostTerminates []ContainerHook } +// DefaultLoggingHook is a hook that will log the container lifecycle events var DefaultLoggingHook = func(logger Logging) ContainerLifecycleHooks { shortContainerID := func(c Container) string { return c.GetContainerID()[:12] @@ -75,6 +80,12 @@ var DefaultLoggingHook = func(logger Logging) ContainerLifecycleHooks { return nil }, }, + PostReadies: []ContainerHook{ + func(ctx context.Context, c Container) error { + logger.Printf("🔔 Container is ready: %s", shortContainerID(c)) + return nil + }, + }, PreStops: []ContainerHook{ func(ctx context.Context, c Container) error { logger.Printf("🐳 Stopping container: %s", shortContainerID(c)) @@ -83,7 +94,7 @@ var DefaultLoggingHook = func(logger Logging) ContainerLifecycleHooks { }, PostStops: []ContainerHook{ func(ctx context.Context, c Container) error { - logger.Printf("✋ Container stopped: %s", shortContainerID(c)) + logger.Printf("✅ Container stopped: %s", shortContainerID(c)) return nil }, }, @@ -102,117 +113,214 @@ var DefaultLoggingHook = func(logger Logging) ContainerLifecycleHooks { } } -// creatingHook is a hook that will be called before a container is created. -func (req ContainerRequest) creatingHook(ctx context.Context) error { - for _, lifecycleHooks := range req.LifecycleHooks { - err := lifecycleHooks.Creating(ctx)(req) - if err != nil { - return err - } +// defaultPreCreateHook is a hook that will apply the default configuration to the container +var defaultPreCreateHook = func(ctx context.Context, p *DockerProvider, req ContainerRequest, dockerInput *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig) ContainerLifecycleHooks { + return ContainerLifecycleHooks{ + PreCreates: []ContainerRequestHook{ + func(ctx context.Context, req ContainerRequest) error { + return p.preCreateContainerHook(ctx, req, dockerInput, hostConfig, networkingConfig) + }, + }, } +} - return nil +// defaultCopyFileToContainerHook is a hook that will copy files to the container after it's created +// but before it's started +var defaultCopyFileToContainerHook = func(files []ContainerFile) ContainerLifecycleHooks { + return ContainerLifecycleHooks{ + PostCreates: []ContainerHook{ + // copy files to container after it's created + func(ctx context.Context, c Container) error { + for _, f := range files { + if err := f.validate(); err != nil { + return fmt.Errorf("invalid file: %w", err) + } + + var err error + // Bytes takes precedence over HostFilePath + if f.Reader != nil { + bs, ioerr := io.ReadAll(f.Reader) + if ioerr != nil { + return fmt.Errorf("can't read from reader: %w", ioerr) + } + + err = c.CopyToContainer(ctx, bs, f.ContainerFilePath, f.FileMode) + } else { + err = c.CopyFileToContainer(ctx, f.HostFilePath, f.ContainerFilePath, f.FileMode) + } + + if err != nil { + return fmt.Errorf("can't copy %s to container: %w", f.HostFilePath, err) + } + } + + return nil + }, + }, + } } -// createdHook is a hook that will be called after a container is created -func (c *DockerContainer) createdHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PostCreates)(c) - if err != nil { - return err - } +// defaultLogConsumersHook is a hook that will start log consumers after the container is started +var defaultLogConsumersHook = func(cfg *LogConsumerConfig) ContainerLifecycleHooks { + return ContainerLifecycleHooks{ + PostStarts: []ContainerHook{ + // first post-start hook is to produce logs and start log consumers + func(ctx context.Context, c Container) error { + dockerContainer := c.(*DockerContainer) + + if cfg == nil { + return nil + } + + for _, consumer := range cfg.Consumers { + dockerContainer.followOutput(consumer) + } + + if len(cfg.Consumers) > 0 { + return dockerContainer.startLogProduction(ctx, cfg.Opts...) + } + return nil + }, + }, + PreTerminates: []ContainerHook{ + // first pre-terminate hook is to stop the log production + func(ctx context.Context, c Container) error { + if cfg == nil || len(cfg.Consumers) == 0 { + return nil + } + + dockerContainer := c.(*DockerContainer) + + return dockerContainer.stopLogProduction() + }, + }, } +} - return nil +// defaultReadinessHook is a hook that will wait for the container to be ready +var defaultReadinessHook = func() ContainerLifecycleHooks { + return ContainerLifecycleHooks{ + PostStarts: []ContainerHook{ + // wait for the container to be ready + func(ctx context.Context, c Container) error { + dockerContainer := c.(*DockerContainer) + + // if a Wait Strategy has been specified, wait before returning + if dockerContainer.WaitingFor != nil { + dockerContainer.logger.Printf( + "🚧 Waiting for container id %s image: %s. Waiting for: %+v", + dockerContainer.ID[:12], dockerContainer.Image, dockerContainer.WaitingFor, + ) + if err := dockerContainer.WaitingFor.WaitUntilReady(ctx, c); err != nil { + return err + } + } + + dockerContainer.isRunning = true + + return nil + }, + }, + } } -// startingHook is a hook that will be called before a container is started -func (c *DockerContainer) startingHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PreStarts)(c) - if err != nil { - c.printLogs(ctx) - return err - } +// creatingHook is a hook that will be called before a container is created. +func (req ContainerRequest) creatingHook(ctx context.Context) error { + errs := make([]error, len(req.LifecycleHooks)) + for i, lifecycleHooks := range req.LifecycleHooks { + errs[i] = lifecycleHooks.Creating(ctx)(req) } - return nil + return errors.Join(errs...) } -// startedHook is a hook that will be called after a container is started +// createdHook is a hook that will be called after a container is created. +func (c *DockerContainer) createdHook(ctx context.Context) error { + return c.applyLifecycleHooks(ctx, false, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PostCreates + }) +} + +// startingHook is a hook that will be called before a container is started. +func (c *DockerContainer) startingHook(ctx context.Context) error { + return c.applyLifecycleHooks(ctx, true, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PreStarts + }) +} + +// startedHook is a hook that will be called after a container is started. func (c *DockerContainer) startedHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PostStarts)(c) - if err != nil { - c.printLogs(ctx) - return err - } - } + return c.applyLifecycleHooks(ctx, true, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PostStarts + }) +} - return nil +// readiedHook is a hook that will be called after a container is ready. +func (c *DockerContainer) readiedHook(ctx context.Context) error { + return c.applyLifecycleHooks(ctx, true, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PostReadies + }) } // printLogs is a helper function that will print the logs of a Docker container // We are going to use this helper function to inform the user of the logs when an error occurs -func (c *DockerContainer) printLogs(ctx context.Context) { +func (c *DockerContainer) printLogs(ctx context.Context, cause error) { reader, err := c.Logs(ctx) if err != nil { - c.logger.Printf("failed accessing container logs: %w\n", err) + c.logger.Printf("failed accessing container logs: %v\n", err) return } b, err := io.ReadAll(reader) if err != nil { - c.logger.Printf("failed reading container logs: %w\n", err) + c.logger.Printf("failed reading container logs: %v\n", err) return } - c.logger.Printf("container logs:\n%s", b) + c.logger.Printf("container logs (%s):\n%s", cause, b) } -// stoppingHook is a hook that will be called before a container is stopped +// stoppingHook is a hook that will be called before a container is stopped. func (c *DockerContainer) stoppingHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PreStops)(c) - if err != nil { - return err - } - } - - return nil + return c.applyLifecycleHooks(ctx, false, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PreStops + }) } -// stoppedHook is a hook that will be called after a container is stopped +// stoppedHook is a hook that will be called after a container is stopped. func (c *DockerContainer) stoppedHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PostStops)(c) - if err != nil { - return err - } - } - - return nil + return c.applyLifecycleHooks(ctx, false, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PostStops + }) } -// terminatingHook is a hook that will be called before a container is terminated +// terminatingHook is a hook that will be called before a container is terminated. func (c *DockerContainer) terminatingHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PreTerminates)(c) - if err != nil { - return err - } - } - - return nil + return c.applyLifecycleHooks(ctx, false, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PreTerminates + }) } -// terminatedHook is a hook that will be called after a container is terminated +// terminatedHook is a hook that will be called after a container is terminated. func (c *DockerContainer) terminatedHook(ctx context.Context) error { - for _, lifecycleHooks := range c.lifecycleHooks { - err := containerHookFn(ctx, lifecycleHooks.PostTerminates)(c) - if err != nil { - return err + return c.applyLifecycleHooks(ctx, false, func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook { + return lifecycleHooks.PostTerminates + }) +} + +// applyLifecycleHooks applies all lifecycle hooks reporting the container logs on error if logError is true. +func (c *DockerContainer) applyLifecycleHooks(ctx context.Context, logError bool, hooks func(lifecycleHooks ContainerLifecycleHooks) []ContainerHook) error { + errs := make([]error, len(c.lifecycleHooks)) + for i, lifecycleHooks := range c.lifecycleHooks { + errs[i] = containerHookFn(ctx, hooks(lifecycleHooks))(c) + } + + if err := errors.Join(errs...); err != nil { + if logError { + c.printLogs(ctx, err) } + + return err } return nil @@ -235,13 +343,12 @@ func (c ContainerLifecycleHooks) Creating(ctx context.Context) func(req Containe // container lifecycle hooks. The created function will iterate over all the hooks and call them one by one. func containerHookFn(ctx context.Context, containerHook []ContainerHook) func(container Container) error { return func(container Container) error { - for _, hook := range containerHook { - if err := hook(ctx, container); err != nil { - return err - } + errs := make([]error, len(containerHook)) + for i, hook := range containerHook { + errs[i] = hook(ctx, container) } - return nil + return errors.Join(errs...) } } @@ -260,6 +367,11 @@ func (c ContainerLifecycleHooks) Started(ctx context.Context) func(container Con return containerHookFn(ctx, c.PostStarts) } +// Readied is a hook that will be called after a container is ready +func (c ContainerLifecycleHooks) Readied(ctx context.Context) func(container Container) error { + return containerHookFn(ctx, c.PostReadies) +} + // Stopping is a hook that will be called before a container is stopped func (c ContainerLifecycleHooks) Stopping(ctx context.Context) func(container Container) error { return containerHookFn(ctx, c.PreStops) @@ -330,7 +442,7 @@ func (p *DockerProvider) preCreateContainerHook(ctx context.Context, req Contain if err != nil { return err } - for p := range image.ContainerConfig.ExposedPorts { + for p := range image.Config.ExposedPorts { exposedPorts = append(exposedPorts, string(p)) } } @@ -352,6 +464,67 @@ func (p *DockerProvider) preCreateContainerHook(ctx context.Context, req Contain return nil } +// combineContainerHooks it returns just one ContainerLifecycle hook, as the result of combining +// the default hooks with the user-defined hooks. The function will loop over all the default hooks, +// storing each of the hooks in a slice, and then it will loop over all the user-defined hooks, +// appending or prepending them to the slice of hooks. The order of hooks is the following: +// - for Pre-hooks, always run the default hooks first, then append the user-defined hooks +// - for Post-hooks, always run the user-defined hooks first, then the default hooks +func combineContainerHooks(defaultHooks, userDefinedHooks []ContainerLifecycleHooks) ContainerLifecycleHooks { + preCreates := []ContainerRequestHook{} + postCreates := []ContainerHook{} + preStarts := []ContainerHook{} + postStarts := []ContainerHook{} + postReadies := []ContainerHook{} + preStops := []ContainerHook{} + postStops := []ContainerHook{} + preTerminates := []ContainerHook{} + postTerminates := []ContainerHook{} + + for _, defaultHook := range defaultHooks { + preCreates = append(preCreates, defaultHook.PreCreates...) + preStarts = append(preStarts, defaultHook.PreStarts...) + preStops = append(preStops, defaultHook.PreStops...) + preTerminates = append(preTerminates, defaultHook.PreTerminates...) + } + + // append the user-defined hooks after the default pre-hooks + // and because the post hooks are still empty, the user-defined post-hooks + // will be the first ones to be executed + for _, userDefinedHook := range userDefinedHooks { + preCreates = append(preCreates, userDefinedHook.PreCreates...) + postCreates = append(postCreates, userDefinedHook.PostCreates...) + preStarts = append(preStarts, userDefinedHook.PreStarts...) + postStarts = append(postStarts, userDefinedHook.PostStarts...) + postReadies = append(postReadies, userDefinedHook.PostReadies...) + preStops = append(preStops, userDefinedHook.PreStops...) + postStops = append(postStops, userDefinedHook.PostStops...) + preTerminates = append(preTerminates, userDefinedHook.PreTerminates...) + postTerminates = append(postTerminates, userDefinedHook.PostTerminates...) + } + + // finally, append the default post-hooks + for _, defaultHook := range defaultHooks { + postCreates = append(postCreates, defaultHook.PostCreates...) + postStarts = append(postStarts, defaultHook.PostStarts...) + postReadies = append(postReadies, defaultHook.PostReadies...) + postStops = append(postStops, defaultHook.PostStops...) + postTerminates = append(postTerminates, defaultHook.PostTerminates...) + } + + return ContainerLifecycleHooks{ + PreCreates: preCreates, + PostCreates: postCreates, + PreStarts: preStarts, + PostStarts: postStarts, + PostReadies: postReadies, + PreStops: preStops, + PostStops: postStops, + PreTerminates: preTerminates, + PostTerminates: postTerminates, + } +} + func mergePortBindings(configPortMap, exposedPortMap nat.PortMap, exposedPorts []string) nat.PortMap { if exposedPortMap == nil { exposedPortMap = make(map[nat.Port][]nat.PortBinding) diff --git a/vendor/github.com/testcontainers/testcontainers-go/logconsumer.go b/vendor/github.com/testcontainers/testcontainers-go/logconsumer.go index c5a2e29c..95bf1119 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/logconsumer.go +++ b/vendor/github.com/testcontainers/testcontainers-go/logconsumer.go @@ -6,6 +6,8 @@ const StdoutLog = "STDOUT" // StderrLog is the log type for STDERR const StderrLog = "STDERR" +// logStruct { + // Log represents a message that was created by a process, // LogType is either "STDOUT" or "STDERR", // Content is the byte contents of the message itself @@ -14,9 +16,21 @@ type Log struct { Content []byte } +// } + +// logConsumerInterface { + // LogConsumer represents any object that can // handle a Log, it is up to the LogConsumer instance // what to do with the log type LogConsumer interface { Accept(Log) } + +// } + +// LogConsumerConfig is a configuration object for the producer/consumer pattern +type LogConsumerConfig struct { + Opts []LogProductionOption // options for the production of logs + Consumers []LogConsumer // consumers for the logs +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/logger.go b/vendor/github.com/testcontainers/testcontainers-go/logger.go index 002ab19b..b137fdca 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/logger.go +++ b/vendor/github.com/testcontainers/testcontainers-go/logger.go @@ -12,63 +12,71 @@ import ( // Logger is the default log instance var Logger Logging = log.New(os.Stderr, "", log.LstdFlags) +// Validate our types implement the required interfaces. +var ( + _ Logging = (*log.Logger)(nil) + _ ContainerCustomizer = LoggerOption{} + _ GenericProviderOption = LoggerOption{} + _ DockerProviderOption = LoggerOption{} +) + // Logging defines the Logger interface type Logging interface { Printf(format string, v ...interface{}) } +// Deprecated: this function will be removed in a future release // LogDockerServerInfo logs the docker server info using the provided logger and Docker client func LogDockerServerInfo(ctx context.Context, client client.APIClient, logger Logging) { - infoMessage := `%v - Connected to docker: - Server Version: %v - API Version: %v - Operating System: %v - Total Memory: %v MB -` - - info, err := client.Info(ctx) - if err != nil { - logger.Printf("failed getting information about docker server: %s", err) - return - } - - logger.Printf(infoMessage, packagePath, - info.ServerVersion, client.ClientVersion(), - info.OperatingSystem, info.MemTotal/1024/1024) + // NOOP } // TestLogger returns a Logging implementation for testing.TB -// This way logs from testcontainers are part of the test output of a test suite or test case +// This way logs from testcontainers are part of the test output of a test suite or test case. func TestLogger(tb testing.TB) Logging { tb.Helper() return testLogger{TB: tb} } -// WithLogger is a generic option that implements GenericProviderOption, DockerProviderOption -// It replaces the global Logging implementation with a user defined one e.g. to aggregate logs from testcontainers -// with the logs of specific test case +// WithLogger returns a generic option that sets the logger to be used. +// +// Consider calling this before other "With functions" as these may generate logs. +// +// This can be given a TestLogger to collect the logs from testcontainers into a +// test case. func WithLogger(logger Logging) LoggerOption { return LoggerOption{ logger: logger, } } +// LoggerOption is a generic option that sets the logger to be used. +// +// It can be used to set the logger for providers and containers. type LoggerOption struct { logger Logging } +// ApplyGenericTo implements GenericProviderOption. func (o LoggerOption) ApplyGenericTo(opts *GenericProviderOptions) { opts.Logger = o.logger } +// ApplyDockerTo implements DockerProviderOption. func (o LoggerOption) ApplyDockerTo(opts *DockerProviderOptions) { opts.Logger = o.logger } +// Customize implements ContainerCustomizer. +func (o LoggerOption) Customize(req *GenericContainerRequest) { + req.Logger = o.logger +} + type testLogger struct { testing.TB } +// Printf implements Logging. func (t testLogger) Printf(format string, v ...interface{}) { t.Helper() t.Logf(format, v...) diff --git a/vendor/github.com/testcontainers/testcontainers-go/mkdocs.yml b/vendor/github.com/testcontainers/testcontainers-go/mkdocs.yml index d52b1e0e..82390165 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/mkdocs.yml +++ b/vendor/github.com/testcontainers/testcontainers-go/mkdocs.yml @@ -1,8 +1,10 @@ +# This file is autogenerated by the 'modulegen' tool. site_name: Testcontainers for Go site_url: https://golang.testcontainers.org plugins: - search - codeinclude + - include-markdown - markdownextradata theme: name: material @@ -16,6 +18,7 @@ theme: favicon: favicon.ico extra_css: - css/extra.css + - css/tc-header.css repo_name: testcontainers-go repo_url: https://github.com/testcontainers/testcontainers-go markdown_extensions: @@ -30,15 +33,17 @@ markdown_extensions: permalink: true - attr_list - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:materialx.emoji.twemoji nav: - Home: index.md - Quickstart: quickstart.md - Features: - features/creating_container.md - - features/files_and_mounts.md - features/configuration.md + - features/image_name_substitution.md + - features/files_and_mounts.md + - features/creating_networks.md - features/networking.md - features/garbage_collector.md - features/build_from_dockerfile.md @@ -46,7 +51,6 @@ nav: - features/docker_compose.md - features/follow_logs.md - features/override_container_command.md - - features/copy_file.md - Wait Strategies: - Introduction: features/wait/introduction.md - Exec: features/wait/exec.md @@ -59,28 +63,47 @@ nav: - SQL: features/wait/sql.md - Modules: - modules/index.md + - modules/artemis.md + - modules/cassandra.md + - modules/chroma.md + - modules/clickhouse.md + - modules/cockroachdb.md + - modules/consul.md - modules/couchbase.md + - modules/elasticsearch.md + - modules/gcloud.md + - modules/inbucket.md + - modules/influxdb.md - modules/k3s.md + - modules/k6.md + - modules/kafka.md - modules/localstack.md + - modules/mariadb.md + - modules/milvus.md + - modules/minio.md + - modules/mockserver.md + - modules/mongodb.md + - modules/mssql.md - modules/mysql.md + - modules/nats.md - modules/neo4j.md + - modules/ollama.md + - modules/openfga.md + - modules/openldap.md + - modules/opensearch.md - modules/postgres.md - modules/pulsar.md + - modules/qdrant.md + - modules/rabbitmq.md - modules/redis.md - modules/redpanda.md + - modules/registry.md + - modules/surrealdb.md - modules/vault.md + - modules/weaviate.md - Examples: - examples/index.md - - examples/bigtable.md - - examples/cockroachdb.md - - examples/consul.md - - examples/datastore.md - - examples/firestore.md - - examples/mongodb.md - - examples/nats.md - examples/nginx.md - - examples/pubsub.md - - examples/spanner.md - examples/toxiproxy.md - System Requirements: - system_requirements/index.md @@ -97,10 +120,11 @@ nav: - system_requirements/ci/travis.md - system_requirements/using_colima.md - system_requirements/using_podman.md + - system_requirements/rancher.md - Contributing: - contributing.md - contributing_docs.md - Getting help: getting_help.md edit_uri: edit/main/docs/ extra: - latest_version: v0.22.0 + latest_version: v0.30.0 diff --git a/vendor/github.com/testcontainers/testcontainers-go/mounts.go b/vendor/github.com/testcontainers/testcontainers-go/mounts.go index c4b6fc91..a68e468b 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/mounts.go +++ b/vendor/github.com/testcontainers/testcontainers-go/mounts.go @@ -1,14 +1,21 @@ package testcontainers +import "errors" + const ( - MountTypeBind MountType = iota + MountTypeBind MountType = iota // Deprecated: Use MountTypeVolume instead MountTypeVolume MountTypeTmpfs MountTypePipe ) var ( - _ ContainerMountSource = (*GenericBindMountSource)(nil) + ErrDuplicateMountTarget = errors.New("duplicate mount target detected") + ErrInvalidBindMount = errors.New("invalid bind mount") +) + +var ( + _ ContainerMountSource = (*GenericBindMountSource)(nil) // Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments _ ContainerMountSource = (*GenericVolumeMountSource)(nil) _ ContainerMountSource = (*GenericTmpfsMountSource)(nil) ) @@ -30,6 +37,7 @@ type ContainerMountSource interface { Type() MountType } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments // GenericBindMountSource implements ContainerMountSource and represents a bind mount // Optionally mount.BindOptions might be added for advanced scenarios type GenericBindMountSource struct { @@ -38,10 +46,12 @@ type GenericBindMountSource struct { HostPath string } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments func (s GenericBindMountSource) Source() string { return s.HostPath } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments func (GenericBindMountSource) Type() MountType { return MountTypeBind } @@ -63,8 +73,7 @@ func (GenericVolumeMountSource) Type() MountType { // GenericTmpfsMountSource implements ContainerMountSource and represents a TmpFS mount // Optionally mount.TmpfsOptions might be added for advanced scenarios -type GenericTmpfsMountSource struct { -} +type GenericTmpfsMountSource struct{} func (s GenericTmpfsMountSource) Source() string { return "" @@ -82,6 +91,7 @@ func (t ContainerMountTarget) Target() string { return string(t) } +// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments // BindMount returns a new ContainerMount with a GenericBindMountSource as source // This is a convenience method to cover typical use cases. func BindMount(hostPath string, mountTarget ContainerMountTarget) ContainerMount { @@ -107,7 +117,7 @@ func Mounts(mounts ...ContainerMount) ContainerMounts { // ContainerMount models a mount into a container type ContainerMount struct { - // Source is typically either a GenericBindMountSource or a GenericVolumeMountSource + // Source is typically either a GenericVolumeMountSource, as BindMount is not supported by all Docker environments Source ContainerMountSource // Target is the path where the mount should be mounted within the container Target ContainerMountTarget diff --git a/vendor/github.com/testcontainers/testcontainers-go/network.go b/vendor/github.com/testcontainers/testcontainers-go/network.go index c96fc11c..7ff0bf5a 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/network.go +++ b/vendor/github.com/testcontainers/testcontainers-go/network.go @@ -13,21 +13,26 @@ type NetworkProvider interface { GetNetwork(context.Context, NetworkRequest) (types.NetworkResource, error) // get a network } +// Deprecated: will be removed in the future // Network allows getting info about a single network instance type Network interface { Remove(context.Context) error // removes the network } +// Deprecated: will be removed in the future. type DefaultNetwork string +// Deprecated: will be removed in the future. func (n DefaultNetwork) ApplyGenericTo(opts *GenericProviderOptions) { opts.DefaultNetwork = string(n) } +// Deprecated: will be removed in the future. func (n DefaultNetwork) ApplyDockerTo(opts *DockerProviderOptions) { opts.DefaultNetwork = string(n) } +// Deprecated: will be removed in the future // NetworkRequest represents the parameters used to get a network type NetworkRequest struct { Driver string @@ -41,5 +46,5 @@ type NetworkRequest struct { SkipReaper bool // Deprecated: The reaper is globally controlled by the .testcontainers.properties file or the TESTCONTAINERS_RYUK_DISABLED environment variable ReaperImage string // Deprecated: use WithImageName ContainerOption instead. Alternative reaper registry - ReaperOptions []ContainerOption // Reaper options to use for this network + ReaperOptions []ContainerOption // Deprecated: the reaper is configured at the properties level, for an entire test session } diff --git a/vendor/github.com/testcontainers/testcontainers-go/options.go b/vendor/github.com/testcontainers/testcontainers-go/options.go new file mode 100644 index 00000000..391d3e1a --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/options.go @@ -0,0 +1,251 @@ +package testcontainers + +import ( + "context" + "fmt" + "time" + + "dario.cat/mergo" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/network" + + tcexec "github.com/testcontainers/testcontainers-go/exec" + "github.com/testcontainers/testcontainers-go/internal/core" + "github.com/testcontainers/testcontainers-go/wait" +) + +// ContainerCustomizer is an interface that can be used to configure the Testcontainers container +// request. The passed request will be merged with the default one. +type ContainerCustomizer interface { + Customize(req *GenericContainerRequest) +} + +// CustomizeRequestOption is a type that can be used to configure the Testcontainers container request. +// The passed request will be merged with the default one. +type CustomizeRequestOption func(req *GenericContainerRequest) + +func (opt CustomizeRequestOption) Customize(req *GenericContainerRequest) { + opt(req) +} + +// CustomizeRequest returns a function that can be used to merge the passed container request with the one that is used by the container. +// Slices and Maps will be appended. +func CustomizeRequest(src GenericContainerRequest) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + if err := mergo.Merge(req, &src, mergo.WithOverride, mergo.WithAppendSlice); err != nil { + Logger.Printf("error merging container request, keeping the original one. Error: %v", err) + return + } + } +} + +// WithConfigModifier allows to override the default container config +func WithConfigModifier(modifier func(config *container.Config)) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.ConfigModifier = modifier + } +} + +// WithEndpointSettingsModifier allows to override the default endpoint settings +func WithEndpointSettingsModifier(modifier func(settings map[string]*network.EndpointSettings)) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.EnpointSettingsModifier = modifier + } +} + +// WithEnv sets the environment variables for a container. +// If the environment variable already exists, it will be overridden. +func WithEnv(envs map[string]string) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + if req.Env == nil { + req.Env = map[string]string{} + } + + for key, val := range envs { + req.Env[key] = val + } + } +} + +// WithHostConfigModifier allows to override the default host config +func WithHostConfigModifier(modifier func(hostConfig *container.HostConfig)) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.HostConfigModifier = modifier + } +} + +// WithImage sets the image for a container +func WithImage(image string) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.Image = image + } +} + +// imageSubstitutor { + +// ImageSubstitutor represents a way to substitute container image names +type ImageSubstitutor interface { + // Description returns the name of the type and a short description of how it modifies the image. + // Useful to be printed in logs + Description() string + Substitute(image string) (string, error) +} + +// } + +// prependHubRegistry represents a way to prepend a custom Hub registry to the image name, +// using the HubImageNamePrefix configuration value +type prependHubRegistry struct { + prefix string +} + +// newPrependHubRegistry creates a new prependHubRegistry +func newPrependHubRegistry(hubPrefix string) prependHubRegistry { + return prependHubRegistry{ + prefix: hubPrefix, + } +} + +// Description returns the name of the type and a short description of how it modifies the image. +func (p prependHubRegistry) Description() string { + return fmt.Sprintf("HubImageSubstitutor (prepends %s)", p.prefix) +} + +// Substitute prepends the Hub prefix to the image name, with certain conditions: +// - if the prefix is empty, the image is returned as is. +// - if the image is a non-hub image (e.g. where another registry is set), the image is returned as is. +// - if the image is a Docker Hub image where the hub registry is explicitly part of the name +// (i.e. anything with a docker.io or registry.hub.docker.com host part), the image is returned as is. +func (p prependHubRegistry) Substitute(image string) (string, error) { + registry := core.ExtractRegistry(image, "") + + // add the exclusions in the right order + exclusions := []func() bool{ + func() bool { return p.prefix == "" }, // no prefix set at the configuration level + func() bool { return registry != "" }, // non-hub image + func() bool { return registry == "docker.io" }, // explicitly including docker.io + func() bool { return registry == "registry.hub.docker.com" }, // explicitly including registry.hub.docker.com + } + + for _, exclusion := range exclusions { + if exclusion() { + return image, nil + } + } + + return fmt.Sprintf("%s/%s", p.prefix, image), nil +} + +// WithImageSubstitutors sets the image substitutors for a container +func WithImageSubstitutors(fn ...ImageSubstitutor) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.ImageSubstitutors = fn + } +} + +// WithLogConsumers sets the log consumers for a container +func WithLogConsumers(consumer ...LogConsumer) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + if req.LogConsumerCfg == nil { + req.LogConsumerCfg = &LogConsumerConfig{} + } + + req.LogConsumerCfg.Consumers = consumer + } +} + +// Executable represents an executable command to be sent to a container, including options, +// as part of the different lifecycle hooks. +type Executable interface { + AsCommand() []string + // Options can container two different types of options: + // - Docker's ExecConfigs (WithUser, WithWorkingDir, WithEnv, etc.) + // - testcontainers' ProcessOptions (i.e. Multiplexed response) + Options() []tcexec.ProcessOption +} + +// ExecOptions is a struct that provides a default implementation for the Options method +// of the Executable interface. +type ExecOptions struct { + opts []tcexec.ProcessOption +} + +func (ce ExecOptions) Options() []tcexec.ProcessOption { + return ce.opts +} + +// RawCommand is a type that implements Executable and represents a command to be sent to a container +type RawCommand struct { + ExecOptions + cmds []string +} + +func NewRawCommand(cmds []string) RawCommand { + return RawCommand{ + cmds: cmds, + ExecOptions: ExecOptions{ + opts: []tcexec.ProcessOption{}, + }, + } +} + +// AsCommand returns the command as a slice of strings +func (r RawCommand) AsCommand() []string { + return r.cmds +} + +// WithStartupCommand will execute the command representation of each Executable into the container. +// It will leverage the container lifecycle hooks to call the command right after the container +// is started. +func WithStartupCommand(execs ...Executable) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + startupCommandsHook := ContainerLifecycleHooks{ + PostStarts: []ContainerHook{}, + } + + for _, exec := range execs { + execFn := func(ctx context.Context, c Container) error { + _, _, err := c.Exec(ctx, exec.AsCommand(), exec.Options()...) + return err + } + + startupCommandsHook.PostStarts = append(startupCommandsHook.PostStarts, execFn) + } + + req.LifecycleHooks = append(req.LifecycleHooks, startupCommandsHook) + } +} + +// WithAfterReadyCommand will execute the command representation of each Executable into the container. +// It will leverage the container lifecycle hooks to call the command right after the container +// is ready. +func WithAfterReadyCommand(execs ...Executable) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + postReadiesHook := []ContainerHook{} + + for _, exec := range execs { + execFn := func(ctx context.Context, c Container) error { + _, _, err := c.Exec(ctx, exec.AsCommand(), exec.Options()...) + return err + } + + postReadiesHook = append(postReadiesHook, execFn) + } + + req.LifecycleHooks = append(req.LifecycleHooks, ContainerLifecycleHooks{ + PostReadies: postReadiesHook, + }) + } +} + +// WithWaitStrategy sets the wait strategy for a container, using 60 seconds as deadline +func WithWaitStrategy(strategies ...wait.Strategy) CustomizeRequestOption { + return WithWaitStrategyAndDeadline(60*time.Second, strategies...) +} + +// WithWaitStrategyAndDeadline sets the wait strategy for a container, including deadline +func WithWaitStrategyAndDeadline(deadline time.Duration, strategies ...wait.Strategy) CustomizeRequestOption { + return func(req *GenericContainerRequest) { + req.WaitingFor = wait.ForAll(strategies...).WithDeadline(deadline) + } +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/parallel.go b/vendor/github.com/testcontainers/testcontainers-go/parallel.go index 297ab9d6..34740eea 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/parallel.go +++ b/vendor/github.com/testcontainers/testcontainers-go/parallel.go @@ -36,8 +36,8 @@ func parallelContainersRunner( requests <-chan GenericContainerRequest, errors chan<- ParallelContainersRequestError, containers chan<- Container, - wg *sync.WaitGroup) { - + wg *sync.WaitGroup, +) { for req := range requests { c, err := GenericContainer(ctx, req) if err != nil { @@ -101,7 +101,6 @@ func ParallelContainers(ctx context.Context, reqs ParallelContainerRequest, opt break } } - }() for _, req := range reqs { diff --git a/vendor/github.com/testcontainers/testcontainers-go/provider.go b/vendor/github.com/testcontainers/testcontainers-go/provider.go index d6868f8d..1be1ebe2 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/provider.go +++ b/vendor/github.com/testcontainers/testcontainers-go/provider.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" + "github.com/testcontainers/testcontainers-go/internal/core" ) // possible provider types @@ -138,14 +138,15 @@ func NewDockerProvider(provOpts ...DockerProviderOption) (*DockerProvider, error provOpts[idx].ApplyDockerTo(o) } - c, err := NewDockerClient() + ctx := context.Background() + c, err := NewDockerClientWithOpts(ctx) if err != nil { return nil, err } tcConfig := ReadConfig() - dockerHost := testcontainersdocker.ExtractDockerHost(context.Background()) + dockerHost := core.ExtractDockerHost(ctx) p := &DockerProvider{ DockerProviderOptions: o, @@ -154,10 +155,5 @@ func NewDockerProvider(provOpts ...DockerProviderOption) (*DockerProvider, error config: tcConfig, } - // log docker server info only once - logOnce.Do(func() { - LogDockerServerInfo(context.Background(), p.client, p.Logger) - }) - return p, nil } diff --git a/vendor/github.com/testcontainers/testcontainers-go/reaper.go b/vendor/github.com/testcontainers/testcontainers-go/reaper.go index b72a9bec..3dff6a7c 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/reaper.go +++ b/vendor/github.com/testcontainers/testcontainers-go/reaper.go @@ -4,32 +4,38 @@ import ( "bufio" "context" "fmt" + "math/rand" "net" "strings" "sync" "time" + "github.com/cenkalti/backoff/v4" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/errdefs" "github.com/docker/go-connections/nat" - "github.com/testcontainers/testcontainers-go/internal" - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" + + "github.com/testcontainers/testcontainers-go/internal/config" + "github.com/testcontainers/testcontainers-go/internal/core" "github.com/testcontainers/testcontainers-go/wait" ) const ( - // Deprecated: it has been replaced by the internal testcontainersdocker.LabelLang + // Deprecated: it has been replaced by the internal core.LabelLang TestcontainerLabel = "org.testcontainers.golang" - // Deprecated: it has been replaced by the internal testcontainersdocker.LabelSessionID + // Deprecated: it has been replaced by the internal core.LabelSessionID TestcontainerLabelSessionID = TestcontainerLabel + ".sessionId" - // Deprecated: it has been replaced by the internal testcontainersdocker.LabelReaper + // Deprecated: it has been replaced by the internal core.LabelReaper TestcontainerLabelIsReaper = TestcontainerLabel + ".reaper" - - ReaperDefaultImage = "docker.io/testcontainers/ryuk:0.5.1" ) var ( - reaperInstance *Reaper // We would like to create reaper only once - mutex sync.Mutex + // Deprecated: it has been replaced by an internal value + ReaperDefaultImage = config.ReaperDefaultImage + reaperInstance *Reaper // We would like to create reaper only once + reaperMutex sync.Mutex + reaperOnce sync.Once ) // ReaperProvider represents a provider for the reaper to run itself with @@ -42,37 +48,162 @@ type ReaperProvider interface { // NewReaper creates a Reaper with a sessionID to identify containers and a provider to use // Deprecated: it's not possible to create a reaper anymore. func NewReaper(ctx context.Context, sessionID string, provider ReaperProvider, reaperImageName string) (*Reaper, error) { - return reuseOrCreateReaper(ctx, sessionID, provider, WithImageName(reaperImageName)) + return reuseOrCreateReaper(ctx, sessionID, provider) +} + +// reaperContainerNameFromSessionID returns the container name that uniquely +// identifies the container based on the session id. +func reaperContainerNameFromSessionID(sessionID string) string { + // The session id is 64 characters, so we will not hit the limit of 128 + // characters for container names. + return fmt.Sprintf("reaper_%s", sessionID) +} + +// lookUpReaperContainer returns a DockerContainer type with the reaper container in the case +// it's found in the running state, and including the labels for sessionID, reaper, and ryuk. +// It will perform a retry with exponential backoff to allow for the container to be started and +// avoid potential false negatives. +func lookUpReaperContainer(ctx context.Context, sessionID string) (*DockerContainer, error) { + dockerClient, err := NewDockerClientWithOpts(ctx) + if err != nil { + return nil, err + } + defer dockerClient.Close() + + // the backoff will take at most 5 seconds to find the reaper container + // doing each attempt every 100ms + exp := backoff.NewExponentialBackOff() + + // we want random intervals between 100ms and 500ms for concurrent executions + // to not be synchronized: it could be the case that multiple executions of this + // function happen at the same time (specifically when called from a different test + // process execution), and we want to avoid that they all try to find the reaper + // container at the same time. + exp.InitialInterval = time.Duration(rand.Intn(5)*100) * time.Millisecond + exp.RandomizationFactor = rand.Float64() * 0.5 + exp.Multiplier = rand.Float64() * 2.0 + exp.MaxInterval = 5.0 * time.Second // max interval between attempts + exp.MaxElapsedTime = 1 * time.Minute // max time to keep trying + + var reaperContainer *DockerContainer + err = backoff.Retry(func() error { + args := []filters.KeyValuePair{ + filters.Arg("label", fmt.Sprintf("%s=%s", core.LabelSessionID, sessionID)), + filters.Arg("label", fmt.Sprintf("%s=%t", core.LabelReaper, true)), + filters.Arg("label", fmt.Sprintf("%s=%t", core.LabelRyuk, true)), + filters.Arg("name", reaperContainerNameFromSessionID(sessionID)), + } + + resp, err := dockerClient.ContainerList(ctx, container.ListOptions{ + All: true, + Filters: filters.NewArgs(args...), + }) + if err != nil { + return err + } + + if len(resp) == 0 { + // reaper container not found in the running state: do not look for it again + return nil + } + + if len(resp) > 1 { + return fmt.Errorf("not possible to have multiple reaper containers found for session ID %s", sessionID) + } + + r, err := containerFromDockerResponse(ctx, resp[0]) + if err != nil { + return err + } + + reaperContainer = r + + return nil + }, backoff.WithContext(exp, ctx)) + + if err != nil { + return nil, err + } + + return reaperContainer, nil } // reuseOrCreateReaper returns an existing Reaper instance if it exists and is running. Otherwise, a new Reaper instance -// will be created with a sessionID to identify containers and a provider to use -func reuseOrCreateReaper(ctx context.Context, sessionID string, provider ReaperProvider, opts ...ContainerOption) (*Reaper, error) { - mutex.Lock() - defer mutex.Unlock() - // If reaper already exists and healthy, re-use it +// will be created with a sessionID to identify containers in the same test session/program. +func reuseOrCreateReaper(ctx context.Context, sessionID string, provider ReaperProvider) (*Reaper, error) { + reaperMutex.Lock() + defer reaperMutex.Unlock() + + // 1. if the reaper instance has been already created, return it if reaperInstance != nil { // Verify this instance is still running by checking state. // Can't use Container.IsRunning because the bool is not updated when Reaper is terminated state, err := reaperInstance.container.State(ctx) - if err == nil && state.Running { + if err != nil { + if !errdefs.IsNotFound(err) { + return nil, err + } + } else if state.Running { return reaperInstance, nil } + // else: the reaper instance has been terminated, so we need to create a new one + reaperOnce = sync.Once{} } - r, err := newReaper(ctx, sessionID, provider, opts...) - if err != nil { - return nil, err + // 2. because the reaper instance has not been created yet, look for it in the Docker daemon, which + // will happen if the reaper container has been created in the same test session but in a different + // test process execution (e.g. when running tests in parallel), not having initialized the reaper + // instance yet. + reaperContainer, err := lookUpReaperContainer(context.Background(), sessionID) + if err == nil && reaperContainer != nil { + // The reaper container exists as a Docker container: re-use it + Logger.Printf("🔥 Reaper obtained from Docker for this test session %s", reaperContainer.ID) + reaperInstance, err = reuseReaperContainer(ctx, sessionID, provider, reaperContainer) + if err != nil { + return nil, err + } + return reaperInstance, nil + } + + // 3. the reaper container does not exist in the Docker daemon: create it, and do it using the + // synchronization primitive to avoid multiple executions of this function to create the reaper + var reaperErr error + reaperOnce.Do(func() { + r, err := newReaper(ctx, sessionID, provider) + if err != nil { + reaperErr = err + return + } + + reaperInstance, reaperErr = r, nil + }) + if reaperErr != nil { + reaperOnce = sync.Once{} + return nil, reaperErr } - reaperInstance = r return reaperInstance, nil } -// newReaper creates a Reaper with a sessionID to identify containers and a provider to use -// Should only be used internally and instead use reuseOrCreateReaper to prefer reusing an existing Reaper instance -func newReaper(ctx context.Context, sessionID string, provider ReaperProvider, opts ...ContainerOption) (*Reaper, error) { - dockerHostMount := testcontainersdocker.ExtractDockerSocket(ctx) +// reuseReaperContainer constructs a Reaper from an already running reaper +// DockerContainer. +func reuseReaperContainer(ctx context.Context, sessionID string, provider ReaperProvider, reaperContainer *DockerContainer) (*Reaper, error) { + endpoint, err := reaperContainer.PortEndpoint(ctx, "8080", "") + if err != nil { + return nil, err + } + return &Reaper{ + Provider: provider, + SessionID: sessionID, + Endpoint: endpoint, + container: reaperContainer, + }, nil +} + +// newReaper creates a Reaper with a sessionID to identify containers and a +// provider to use. Do not call this directly, use reuseOrCreateReaper instead. +func newReaper(ctx context.Context, sessionID string, provider ReaperProvider) (*Reaper, error) { + dockerHostMount := core.ExtractDockerSocket(ctx) reaper := &Reaper{ Provider: provider, @@ -83,39 +214,33 @@ func newReaper(ctx context.Context, sessionID string, provider ReaperProvider, o tcConfig := provider.Config().Config - reaperOpts := containerOptions{} - - for _, opt := range opts { - opt(&reaperOpts) - } - req := ContainerRequest{ - Image: reaperImage(reaperOpts.ImageName), + Image: config.ReaperDefaultImage, ExposedPorts: []string{string(listeningPort)}, - Labels: map[string]string{ - TestcontainerLabelIsReaper: "true", - testcontainersdocker.LabelReaper: "true", - }, - Mounts: Mounts(BindMount(dockerHostMount, "/var/run/docker.sock")), - Privileged: tcConfig.RyukPrivileged, - WaitingFor: wait.ForListeningPort(listeningPort), - ReaperOptions: opts, + Labels: core.DefaultLabels(sessionID), + Privileged: tcConfig.RyukPrivileged, + WaitingFor: wait.ForListeningPort(listeningPort), + Name: reaperContainerNameFromSessionID(sessionID), HostConfigModifier: func(hc *container.HostConfig) { hc.AutoRemove = true + hc.Binds = []string{dockerHostMount + ":/var/run/docker.sock"} hc.NetworkMode = Bridge }, + Env: map[string]string{}, + } + if to := tcConfig.RyukConnectionTimeout; to > time.Duration(0) { + req.Env["RYUK_CONNECTION_TIMEOUT"] = to.String() + } + if to := tcConfig.RyukReconnectionTimeout; to > time.Duration(0) { + req.Env["RYUK_RECONNECTION_TIMEOUT"] = to.String() + } + if tcConfig.RyukVerbose { + req.Env["RYUK_VERBOSE"] = "true" } - - // keep backwards compatibility - req.ReaperImage = req.Image // include reaper-specific labels to the reaper container - for k, v := range reaper.Labels() { - if k == TestcontainerLabelSessionID || k == testcontainersdocker.LabelSessionID { - continue - } - req.Labels[k] = v - } + req.Labels[core.LabelReaper] = "true" + req.Labels[core.LabelRyuk] = "true" // Attach reaper container to a requested network if it is specified if p, ok := provider.(*DockerProvider); ok { @@ -124,6 +249,48 @@ func newReaper(ctx context.Context, sessionID string, provider ReaperProvider, o c, err := provider.RunContainer(ctx, req) if err != nil { + // We need to check whether the error is caused by a container with the same name + // already existing due to race conditions. We manually match the error message + // as we do not have any error types to check against. + if createContainerFailDueToNameConflictRegex.MatchString(err.Error()) { + // Manually retrieve the already running reaper container. However, we need to + // use retries here as there are two possible race conditions that might lead to + // errors: In most cases, there is a small delay between container creation and + // actually being visible in list-requests. This means that creation might fail + // due to name conflicts, but when we list containers with this name, we do not + // get any results. In another case, the container might have simply died in the + // meantime and therefore cannot be found. + const timeout = 5 * time.Second + const cooldown = 100 * time.Millisecond + start := time.Now() + var reaperContainer *DockerContainer + for time.Since(start) < timeout { + reaperContainer, err = lookUpReaperContainer(ctx, sessionID) + if err == nil && reaperContainer != nil { + break + } + select { + case <-ctx.Done(): + case <-time.After(cooldown): + } + } + if err != nil { + return nil, fmt.Errorf("look up reaper container due to name conflict failed: %w", err) + } + // If the reaper container was not found, it is most likely to have died in + // between as we can exclude any client errors because of the previous error + // check. Because the reaper should only die if it performed clean-ups, we can + // fail here as the reaper timeout needs to be increased, anyway. + if reaperContainer == nil { + return nil, fmt.Errorf("look up reaper container returned nil although creation failed due to name conflict") + } + Logger.Printf("🔥 Reaper obtained from Docker for this test session %s", reaperContainer.ID) + reaper, err := reuseReaperContainer(ctx, sessionID, provider, reaperContainer) + if err != nil { + return nil, err + } + return reaper, nil + } return nil, err } reaper.container = c @@ -158,7 +325,7 @@ func (r *Reaper) Connect() (chan bool, error) { defer conn.Close() labelFilters := []string{} - for l, v := range r.Labels() { + for l, v := range core.DefaultLabels(r.SessionID) { labelFilters = append(labelFilters, fmt.Sprintf("label=%s=%s", l, v)) } @@ -194,19 +361,10 @@ func (r *Reaper) Connect() (chan bool, error) { } // Labels returns the container labels to use so that this Reaper cleans them up +// Deprecated: internally replaced by core.DefaultLabels(sessionID) func (r *Reaper) Labels() map[string]string { return map[string]string{ - TestcontainerLabel: "true", - TestcontainerLabelSessionID: r.SessionID, - testcontainersdocker.LabelLang: "go", - testcontainersdocker.LabelVersion: internal.Version, - testcontainersdocker.LabelSessionID: r.SessionID, - } -} - -func reaperImage(reaperImageName string) string { - if reaperImageName == "" { - return ReaperDefaultImage + core.LabelLang: "go", + core.LabelSessionID: r.SessionID, } - return reaperImageName } diff --git a/vendor/github.com/testcontainers/testcontainers-go/requirements.txt b/vendor/github.com/testcontainers/testcontainers-go/requirements.txt index 804cc5fd..8959e8fb 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/requirements.txt +++ b/vendor/github.com/testcontainers/testcontainers-go/requirements.txt @@ -1,4 +1,5 @@ mkdocs==1.5.2 mkdocs-codeinclude-plugin==0.2.1 -mkdocs-material==8.1.3 +mkdocs-include-markdown-plugin==6.0.4 +mkdocs-material==8.2.7 mkdocs-markdownextradata-plugin==0.2.5 diff --git a/vendor/github.com/testcontainers/testcontainers-go/sonar-project.properties b/vendor/github.com/testcontainers/testcontainers-go/sonar-project.properties new file mode 100644 index 00000000..131ecb33 --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/sonar-project.properties @@ -0,0 +1,21 @@ +# This file is autogenerated by the 'modulegen' tool. +# Github organization linked to sonarcloud +sonar.organization=testcontainers + +# Project key from sonarcloud dashboard for Github Action, otherwise pick a project key you like +sonar.projectKey=testcontainers_testcontainers-go + +sonar.projectName=testcontainers-go + +sonar.projectVersion=v0.30.0 + +sonar.sources=. + +sonar.exclusions=**/*_test.go,**/vendor/**,**/testdata/** + +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.test.exclusions=**/vendor/** + +sonar.go.coverage.reportPaths=**/coverage.out +sonar.go.tests.reportPaths=TEST-unit.xml,examples/nginx/TEST-unit.xml,examples/toxiproxy/TEST-unit.xml,modulegen/TEST-unit.xml,modules/artemis/TEST-unit.xml,modules/cassandra/TEST-unit.xml,modules/chroma/TEST-unit.xml,modules/clickhouse/TEST-unit.xml,modules/cockroachdb/TEST-unit.xml,modules/compose/TEST-unit.xml,modules/consul/TEST-unit.xml,modules/couchbase/TEST-unit.xml,modules/elasticsearch/TEST-unit.xml,modules/gcloud/TEST-unit.xml,modules/inbucket/TEST-unit.xml,modules/influxdb/TEST-unit.xml,modules/k3s/TEST-unit.xml,modules/k6/TEST-unit.xml,modules/kafka/TEST-unit.xml,modules/localstack/TEST-unit.xml,modules/mariadb/TEST-unit.xml,modules/milvus/TEST-unit.xml,modules/minio/TEST-unit.xml,modules/mockserver/TEST-unit.xml,modules/mongodb/TEST-unit.xml,modules/mssql/TEST-unit.xml,modules/mysql/TEST-unit.xml,modules/nats/TEST-unit.xml,modules/neo4j/TEST-unit.xml,modules/ollama/TEST-unit.xml,modules/openfga/TEST-unit.xml,modules/openldap/TEST-unit.xml,modules/opensearch/TEST-unit.xml,modules/postgres/TEST-unit.xml,modules/pulsar/TEST-unit.xml,modules/qdrant/TEST-unit.xml,modules/rabbitmq/TEST-unit.xml,modules/redis/TEST-unit.xml,modules/redpanda/TEST-unit.xml,modules/registry/TEST-unit.xml,modules/surrealdb/TEST-unit.xml,modules/vault/TEST-unit.xml,modules/weaviate/TEST-unit.xml diff --git a/vendor/github.com/testcontainers/testcontainers-go/testcontainer.go b/vendor/github.com/testcontainers/testcontainers-go/testcontainer.go deleted file mode 100644 index 6c42b00d..00000000 --- a/vendor/github.com/testcontainers/testcontainers-go/testcontainer.go +++ /dev/null @@ -1 +0,0 @@ -package testcontainers diff --git a/vendor/github.com/testcontainers/testcontainers-go/testcontainers.go b/vendor/github.com/testcontainers/testcontainers-go/testcontainers.go new file mode 100644 index 00000000..5b52e09a --- /dev/null +++ b/vendor/github.com/testcontainers/testcontainers-go/testcontainers.go @@ -0,0 +1,49 @@ +package testcontainers + +import ( + "context" + + "github.com/testcontainers/testcontainers-go/internal/core" +) + +// ExtractDockerSocket Extracts the docker socket from the different alternatives, removing the socket schema. +// Use this function to get the docker socket path, not the host (e.g. mounting the socket in a container). +// This function does not consider Windows containers at the moment. +// The possible alternatives are: +// +// 1. Docker host from the "tc.host" property in the ~/.testcontainers.properties file. +// 2. The TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE environment variable. +// 3. Using a Docker client, check if the Info().OperativeSystem is "Docker Desktop" and return the default docker socket path for rootless docker. +// 4. Else, Get the current Docker Host from the existing strategies: see ExtractDockerHost. +// 5. If the socket contains the unix schema, the schema is removed (e.g. unix:///var/run/docker.sock -> /var/run/docker.sock) +// 6. Else, the default location of the docker socket is used (/var/run/docker.sock) +// +// In any case, if the docker socket schema is "tcp://", the default docker socket path will be returned. +func ExtractDockerSocket() string { + return core.ExtractDockerSocket(context.Background()) +} + +// SessionID returns a unique session ID for the current test session. Because each Go package +// will be run in a separate process, we need a way to identify the current test session. +// By test session, we mean: +// - a single "go test" invocation (including flags) +// - a single "go test ./..." invocation (including flags) +// - the execution of a single test or a set of tests using the IDE +// +// As a consequence, with the sole goal of aggregating test execution across multiple +// packages, this variable will contain the value of the parent process ID (pid) of the current process +// and its creation date, to use it to generate a unique session ID. We are using the parent pid because +// the current process will be a child process of: +// - the process that is running the tests, e.g.: "go test"; +// - the process that is running the application in development mode, e.g. "go run main.go -tags dev"; +// - the process that is running the tests in the IDE, e.g.: "go test ./...". +// +// Finally, we will hash the combination of the "testcontainers-go:" string with the parent pid +// and the creation date of that parent process to generate a unique session ID. +// +// This sessionID will be used to: +// - identify the test session, aggregating the test execution of multiple packages in the same test session. +// - tag the containers created by testcontainers-go, adding a label to the container with the session ID. +func SessionID() string { + return core.SessionID() +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/testing.go b/vendor/github.com/testcontainers/testcontainers-go/testing.go index cdbd68d7..eab23cb8 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/testing.go +++ b/vendor/github.com/testcontainers/testcontainers-go/testing.go @@ -2,9 +2,8 @@ package testcontainers import ( "context" + "fmt" "testing" - - "github.com/testcontainers/testcontainers-go/internal/testcontainersdocker" ) // SkipIfProviderIsNotHealthy is a utility function capable of skipping tests @@ -26,7 +25,7 @@ func SkipIfProviderIsNotHealthy(t *testing.T) { // SkipIfDockerDesktop is a utility function capable of skipping tests // if tests are run using Docker Desktop. func SkipIfDockerDesktop(t *testing.T, ctx context.Context) { - cli, err := testcontainersdocker.NewClient(ctx) + cli, err := NewDockerClientWithOpts(ctx) if err != nil { t.Fatalf("failed to create docker client: %s", err) } @@ -40,3 +39,15 @@ func SkipIfDockerDesktop(t *testing.T, ctx context.Context) { t.Skip("Skipping test that requires host network access when running in Docker Desktop") } } + +// exampleLogConsumer { + +// StdoutLogConsumer is a LogConsumer that prints the log to stdout +type StdoutLogConsumer struct{} + +// Accept prints the log to stdout +func (lc *StdoutLogConsumer) Accept(l Log) { + fmt.Print(string(l.Content)) +} + +// } diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/all.go b/vendor/github.com/testcontainers/testcontainers-go/wait/all.go index 18531cbf..fb097fb5 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/all.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/all.go @@ -7,8 +7,10 @@ import ( ) // Implement interface -var _ Strategy = (*MultiStrategy)(nil) -var _ StrategyTimeout = (*MultiStrategy)(nil) +var ( + _ Strategy = (*MultiStrategy)(nil) + _ StrategyTimeout = (*MultiStrategy)(nil) +) type MultiStrategy struct { // all Strategies should have a startupTimeout to avoid waiting infinitely diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/errors.go b/vendor/github.com/testcontainers/testcontainers-go/wait/errors.go index f8a02a59..3e3919a6 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/errors.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/errors.go @@ -3,8 +3,11 @@ package wait -import "syscall" +import ( + "errors" + "syscall" +) func isConnRefusedErr(err error) bool { - return err == syscall.ECONNREFUSED + return errors.Is(err, syscall.ECONNREFUSED) } diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/exec.go b/vendor/github.com/testcontainers/testcontainers-go/wait/exec.go index 82f15c60..2e341dd3 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/exec.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/exec.go @@ -9,8 +9,10 @@ import ( ) // Implement interface -var _ Strategy = (*ExecStrategy)(nil) -var _ StrategyTimeout = (*ExecStrategy)(nil) +var ( + _ Strategy = (*ExecStrategy)(nil) + _ StrategyTimeout = (*ExecStrategy)(nil) +) type ExecStrategy struct { // all Strategies should have a startupTimeout to avoid waiting infinitely @@ -43,6 +45,12 @@ func (ws *ExecStrategy) WithStartupTimeout(startupTimeout time.Duration) *ExecSt return ws } +func (ws *ExecStrategy) WithExitCode(exitCode int) *ExecStrategy { + return ws.WithExitCodeMatcher(func(actualCode int) bool { + return actualCode == exitCode + }) +} + func (ws *ExecStrategy) WithExitCodeMatcher(exitCodeMatcher func(exitCode int) bool) *ExecStrategy { ws.ExitCodeMatcher = exitCodeMatcher return ws diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/exit.go b/vendor/github.com/testcontainers/testcontainers-go/wait/exit.go index 8ff59fe0..be12b8ad 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/exit.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/exit.go @@ -7,8 +7,10 @@ import ( ) // Implement interface -var _ Strategy = (*ExitStrategy)(nil) -var _ StrategyTimeout = (*ExitStrategy)(nil) +var ( + _ Strategy = (*ExitStrategy)(nil) + _ StrategyTimeout = (*ExitStrategy)(nil) +) // ExitStrategy will wait until container exit type ExitStrategy struct { @@ -24,7 +26,6 @@ func NewExitStrategy() *ExitStrategy { return &ExitStrategy{ PollInterval: defaultPollInterval(), } - } // fluent builders for each property @@ -59,7 +60,7 @@ func (ws *ExitStrategy) Timeout() *time.Duration { } // WaitUntilReady implements Strategy.WaitUntilReady -func (ws *ExitStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (ws *ExitStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error { if ws.timeout != nil { var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, *ws.timeout) diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/health.go b/vendor/github.com/testcontainers/testcontainers-go/wait/health.go index b0821c8a..06a9ad1e 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/health.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/health.go @@ -8,8 +8,10 @@ import ( ) // Implement interface -var _ Strategy = (*HealthStrategy)(nil) -var _ StrategyTimeout = (*HealthStrategy)(nil) +var ( + _ Strategy = (*HealthStrategy)(nil) + _ StrategyTimeout = (*HealthStrategy)(nil) +) // HealthStrategy will wait until the container becomes healthy type HealthStrategy struct { @@ -25,7 +27,6 @@ func NewHealthStrategy() *HealthStrategy { return &HealthStrategy{ PollInterval: defaultPollInterval(), } - } // fluent builders for each property @@ -60,7 +61,7 @@ func (ws *HealthStrategy) Timeout() *time.Duration { } // WaitUntilReady implements Strategy.WaitUntilReady -func (ws *HealthStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (ws *HealthStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error { timeout := defaultStartupTimeout() if ws.timeout != nil { timeout = *ws.timeout diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/host_port.go b/vendor/github.com/testcontainers/testcontainers-go/wait/host_port.go index 59fe7c11..c5448258 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/host_port.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/host_port.go @@ -14,8 +14,10 @@ import ( ) // Implement interface -var _ Strategy = (*HostPortStrategy)(nil) -var _ StrategyTimeout = (*HostPortStrategy)(nil) +var ( + _ Strategy = (*HostPortStrategy)(nil) + _ StrategyTimeout = (*HostPortStrategy)(nil) +) var errShellNotExecutable = errors.New("/bin/sh command not executable") @@ -69,7 +71,7 @@ func (hp *HostPortStrategy) Timeout() *time.Duration { } // WaitUntilReady implements Strategy.WaitUntilReady -func (hp *HostPortStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (hp *HostPortStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error { timeout := defaultStartupTimeout() if hp.timeout != nil { timeout = *hp.timeout @@ -80,17 +82,17 @@ func (hp *HostPortStrategy) WaitUntilReady(ctx context.Context, target StrategyT ipAddress, err := target.Host(ctx) if err != nil { - return + return err } - var waitInterval = hp.PollInterval + waitInterval := hp.PollInterval internalPort := hp.Port if internalPort == "" { var ports nat.PortMap ports, err = target.Ports(ctx) if err != nil { - return + return err } if len(ports) > 0 { for p := range ports { @@ -101,27 +103,26 @@ func (hp *HostPortStrategy) WaitUntilReady(ctx context.Context, target StrategyT } if internalPort == "" { - err = fmt.Errorf("no port to wait for") - return + return fmt.Errorf("no port to wait for") } var port nat.Port port, err = target.MappedPort(ctx, internalPort) - var i = 0 + i := 0 for port == "" { i++ select { case <-ctx.Done(): - return fmt.Errorf("%s:%w", ctx.Err(), err) + return fmt.Errorf("%w: %w", ctx.Err(), err) case <-time.After(waitInterval): if err := checkTarget(ctx, target); err != nil { return err } port, err = target.MappedPort(ctx, internalPort) if err != nil { - fmt.Printf("(%d) [%s] %s\n", i, port, err) + log.Printf("(%d) [%s] %s\n", i, port, err) } } } @@ -153,8 +154,10 @@ func externalCheck(ctx context.Context, ipAddress string, port nat.Port, target } conn, err := dialer.DialContext(ctx, proto, address) if err != nil { - if v, ok := err.(*net.OpError); ok { - if v2, ok := (v.Err).(*os.SyscallError); ok { + var v *net.OpError + if errors.As(err, &v) { + var v2 *os.SyscallError + if errors.As(v.Err, &v2) { if isConnRefusedErr(v2.Err) { time.Sleep(waitInterval) continue diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/http.go b/vendor/github.com/testcontainers/testcontainers-go/wait/http.go index 3ebd4469..89e4f092 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/http.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/http.go @@ -11,46 +11,54 @@ import ( "net/http" "net/url" "strconv" + "strings" "time" "github.com/docker/go-connections/nat" ) // Implement interface -var _ Strategy = (*HTTPStrategy)(nil) -var _ StrategyTimeout = (*HTTPStrategy)(nil) +var ( + _ Strategy = (*HTTPStrategy)(nil) + _ StrategyTimeout = (*HTTPStrategy)(nil) +) type HTTPStrategy struct { // all Strategies should have a startupTimeout to avoid waiting infinitely timeout *time.Duration // additional properties - Port nat.Port - Path string - StatusCodeMatcher func(status int) bool - ResponseMatcher func(body io.Reader) bool - UseTLS bool - AllowInsecure bool - TLSConfig *tls.Config // TLS config for HTTPS - Method string // http method - Body io.Reader // http request body - PollInterval time.Duration - UserInfo *url.Userinfo + Port nat.Port + Path string + StatusCodeMatcher func(status int) bool + ResponseMatcher func(body io.Reader) bool + UseTLS bool + AllowInsecure bool + TLSConfig *tls.Config // TLS config for HTTPS + Method string // http method + Body io.Reader // http request body + Headers map[string]string + ResponseHeadersMatcher func(headers http.Header) bool + PollInterval time.Duration + UserInfo *url.Userinfo + ForceIPv4LocalHost bool } // NewHTTPStrategy constructs a HTTP strategy waiting on port 80 and status code 200 func NewHTTPStrategy(path string) *HTTPStrategy { return &HTTPStrategy{ - Port: "", - Path: path, - StatusCodeMatcher: defaultStatusCodeMatcher, - ResponseMatcher: func(body io.Reader) bool { return true }, - UseTLS: false, - TLSConfig: nil, - Method: http.MethodGet, - Body: nil, - PollInterval: defaultPollInterval(), - UserInfo: nil, + Port: "", + Path: path, + StatusCodeMatcher: defaultStatusCodeMatcher, + ResponseMatcher: func(body io.Reader) bool { return true }, + UseTLS: false, + TLSConfig: nil, + Method: http.MethodGet, + Body: nil, + Headers: map[string]string{}, + ResponseHeadersMatcher: func(headers http.Header) bool { return true }, + PollInterval: defaultPollInterval(), + UserInfo: nil, } } @@ -106,6 +114,16 @@ func (ws *HTTPStrategy) WithBody(reqdata io.Reader) *HTTPStrategy { return ws } +func (ws *HTTPStrategy) WithHeaders(headers map[string]string) *HTTPStrategy { + ws.Headers = headers + return ws +} + +func (ws *HTTPStrategy) WithResponseHeadersMatcher(matcher func(http.Header) bool) *HTTPStrategy { + ws.ResponseHeadersMatcher = matcher + return ws +} + func (ws *HTTPStrategy) WithBasicAuth(username, password string) *HTTPStrategy { ws.UserInfo = url.UserPassword(username, password) return ws @@ -117,6 +135,13 @@ func (ws *HTTPStrategy) WithPollInterval(pollInterval time.Duration) *HTTPStrate return ws } +// WithForcedIPv4LocalHost forces usage of localhost to be ipv4 127.0.0.1 +// to avoid ipv6 docker bugs https://github.com/moby/moby/issues/42442 https://github.com/moby/moby/issues/42375 +func (ws *HTTPStrategy) WithForcedIPv4LocalHost() *HTTPStrategy { + ws.ForceIPv4LocalHost = true + return ws +} + // ForHTTP is a convenience method similar to Wait.java // https://github.com/testcontainers/testcontainers-java/blob/1d85a3834bd937f80aad3a4cec249c027f31aeb4/core/src/main/java/org/testcontainers/containers/wait/strategy/Wait.java func ForHTTP(path string) *HTTPStrategy { @@ -128,7 +153,7 @@ func (ws *HTTPStrategy) Timeout() *time.Duration { } // WaitUntilReady implements Strategy.WaitUntilReady -func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error { timeout := defaultStartupTimeout() if ws.timeout != nil { timeout = *ws.timeout @@ -139,16 +164,22 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge ipAddress, err := target.Host(ctx) if err != nil { - return + return err + } + // to avoid ipv6 docker bugs https://github.com/moby/moby/issues/42442 https://github.com/moby/moby/issues/42375 + if ws.ForceIPv4LocalHost { + ipAddress = strings.Replace(ipAddress, "localhost", "127.0.0.1", 1) } var mappedPort nat.Port if ws.Port == "" { - ports, err := target.Ports(ctx) - for err != nil { + var err error + var ports nat.PortMap + // we wait one polling interval before we grab the ports otherwise they might not be bound yet on startup + for err != nil || ports == nil { select { case <-ctx.Done(): - return fmt.Errorf("%s:%w", ctx.Err(), err) + return fmt.Errorf("%w: %w", ctx.Err(), err) case <-time.After(ws.PollInterval): if err := checkTarget(ctx, target); err != nil { return err @@ -175,7 +206,7 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge for mappedPort == "" { select { case <-ctx.Done(): - return fmt.Errorf("%s:%w", ctx.Err(), err) + return fmt.Errorf("%w: %w", ctx.Err(), err) case <-time.After(ws.PollInterval): if err := checkTarget(ctx, target); err != nil { return err @@ -233,11 +264,12 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge client := http.Client{Transport: tripper, Timeout: time.Second} address := net.JoinHostPort(ipAddress, strconv.Itoa(mappedPort.Int())) - endpoint := url.URL{ - Scheme: proto, - Host: address, - Path: ws.Path, + endpoint, err := url.Parse(ws.Path) + if err != nil { + return err } + endpoint.Scheme = proto + endpoint.Host = address if ws.UserInfo != nil { endpoint.User = ws.UserInfo @@ -248,7 +280,7 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge if ws.Body != nil { body, err = io.ReadAll(ws.Body) if err != nil { - return + return err } } @@ -264,6 +296,11 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge if err != nil { return err } + + for k, v := range ws.Headers { + req.Header.Set(k, v) + } + resp, err := client.Do(req) if err != nil { continue @@ -276,6 +313,10 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge _ = resp.Body.Close() continue } + if ws.ResponseHeadersMatcher != nil && !ws.ResponseHeadersMatcher(resp.Header) { + _ = resp.Body.Close() + continue + } if err := resp.Body.Close(); err != nil { continue } diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/log.go b/vendor/github.com/testcontainers/testcontainers-go/wait/log.go index fca23e28..530077f9 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/log.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/log.go @@ -3,13 +3,16 @@ package wait import ( "context" "io" + "regexp" "strings" "time" ) // Implement interface -var _ Strategy = (*LogStrategy)(nil) -var _ StrategyTimeout = (*LogStrategy)(nil) +var ( + _ Strategy = (*LogStrategy)(nil) + _ StrategyTimeout = (*LogStrategy)(nil) +) // LogStrategy will wait until a given log entry shows up in the docker logs type LogStrategy struct { @@ -18,6 +21,7 @@ type LogStrategy struct { // additional properties Log string + IsRegexp bool Occurrence int PollInterval time.Duration } @@ -26,6 +30,7 @@ type LogStrategy struct { func NewLogStrategy(log string) *LogStrategy { return &LogStrategy{ Log: log, + IsRegexp: false, Occurrence: 1, PollInterval: defaultPollInterval(), } @@ -35,6 +40,12 @@ func NewLogStrategy(log string) *LogStrategy { // since go has neither covariance nor generics, the return type must be the type of the concrete implementation // this is true for all properties, even the "shared" ones like startupTimeout +// AsRegexp can be used to change the default behavior of the log strategy to use regexp instead of plain text +func (ws *LogStrategy) AsRegexp() *LogStrategy { + ws.IsRegexp = true + return ws +} + // WithStartupTimeout can be used to change the default startup timeout func (ws *LogStrategy) WithStartupTimeout(timeout time.Duration) *LogStrategy { ws.timeout = &timeout @@ -72,7 +83,7 @@ func (ws *LogStrategy) Timeout() *time.Duration { } // WaitUntilReady implements Strategy.WaitUntilReady -func (ws *LogStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (ws *LogStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error { timeout := defaultStartupTimeout() if ws.timeout != nil { timeout = *ws.timeout @@ -104,11 +115,13 @@ LOOP: } logs := string(b) - if length == len(logs) && checkErr != nil { + + switch { + case length == len(logs) && checkErr != nil: return checkErr - } else if strings.Count(logs, ws.Log) >= ws.Occurrence { + case checkLogsFn(ws, b): break LOOP - } else { + default: length = len(logs) time.Sleep(ws.PollInterval) continue @@ -118,3 +131,15 @@ LOOP: return nil } + +func checkLogsFn(ws *LogStrategy, b []byte) bool { + if ws.IsRegexp { + re := regexp.MustCompile(ws.Log) + occurrences := re.FindAll(b, -1) + + return len(occurrences) >= ws.Occurrence + } + + logs := string(b) + return strings.Count(logs, ws.Log) >= ws.Occurrence +} diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/nop.go b/vendor/github.com/testcontainers/testcontainers-go/wait/nop.go index a16feb87..e7c86bea 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/nop.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/nop.go @@ -7,11 +7,14 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/go-connections/nat" + "github.com/testcontainers/testcontainers-go/exec" ) -var _ Strategy = (*NopStrategy)(nil) -var _ StrategyTimeout = (*NopStrategy)(nil) +var ( + _ Strategy = (*NopStrategy)(nil) + _ StrategyTimeout = (*NopStrategy)(nil) +) type NopStrategy struct { timeout *time.Duration diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/sql.go b/vendor/github.com/testcontainers/testcontainers-go/wait/sql.go index 9e0c0560..b766f60f 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/sql.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/sql.go @@ -9,8 +9,10 @@ import ( "github.com/docker/go-connections/nat" ) -var _ Strategy = (*waitForSql)(nil) -var _ StrategyTimeout = (*waitForSql)(nil) +var ( + _ Strategy = (*waitForSql)(nil) + _ StrategyTimeout = (*waitForSql)(nil) +) const defaultForSqlQuery = "SELECT 1" @@ -62,7 +64,7 @@ func (w *waitForSql) Timeout() *time.Duration { // WaitUntilReady repeatedly tries to run "SELECT 1" or user defined query on the given port using sql and driver. // // If it doesn't succeed until the timeout value which defaults to 60 seconds, it will return an error. -func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) { +func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) error { timeout := defaultStartupTimeout() if w.timeout != nil { timeout = *w.timeout @@ -73,7 +75,7 @@ func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) host, err := target.Host(ctx) if err != nil { - return + return err } ticker := time.NewTicker(w.PollInterval) @@ -85,7 +87,7 @@ func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) for port == "" { select { case <-ctx.Done(): - return fmt.Errorf("%s:%w", ctx.Err(), err) + return fmt.Errorf("%w: %w", ctx.Err(), err) case <-ticker.C: if err := checkTarget(ctx, target); err != nil { return err @@ -96,7 +98,7 @@ func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) db, err := sql.Open(w.Driver, w.URL(host, port)) if err != nil { - return fmt.Errorf("sql.Open: %v", err) + return fmt.Errorf("sql.Open: %w", err) } defer db.Close() for { diff --git a/vendor/github.com/testcontainers/testcontainers-go/wait/wait.go b/vendor/github.com/testcontainers/testcontainers-go/wait/wait.go index 559ce397..46a66f7d 100644 --- a/vendor/github.com/testcontainers/testcontainers-go/wait/wait.go +++ b/vendor/github.com/testcontainers/testcontainers-go/wait/wait.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/go-connections/nat" + "github.com/testcontainers/testcontainers-go/exec" ) diff --git a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml new file mode 100644 index 00000000..1b27f196 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml @@ -0,0 +1,23 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + GO_VERSION: go1.20 + +freebsd_12_task: + freebsd_instance: + image_family: freebsd-12-3 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... + +freebsd_13_task: + freebsd_instance: + image_family: freebsd-13-0 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -v ./... + test_script: bin/${GO_VERSION} test -race ./... diff --git a/vendor/github.com/tklauser/go-sysconf/.gitignore b/vendor/github.com/tklauser/go-sysconf/.gitignore new file mode 100644 index 00000000..e4827159 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/.gitignore @@ -0,0 +1 @@ +_obj/ diff --git a/vendor/github.com/tklauser/go-sysconf/LICENSE b/vendor/github.com/tklauser/go-sysconf/LICENSE new file mode 100644 index 00000000..73c6b899 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2018-2022, Tobias Klauser +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/tklauser/go-sysconf/README.md b/vendor/github.com/tklauser/go-sysconf/README.md new file mode 100644 index 00000000..b83d5abf --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/README.md @@ -0,0 +1,46 @@ +# go-sysconf + +[![Go Reference](https://pkg.go.dev/badge/github.com/tklauser/go-sysconf.svg)](https://pkg.go.dev/github.com/tklauser/go-sysconf) +[![GitHub Action Status](https://github.com/tklauser/go-sysconf/workflows/Tests/badge.svg)](https://github.com/tklauser/go-sysconf/actions?query=workflow%3ATests) + +`sysconf` for Go, without using cgo or external binaries (e.g. getconf). + +Supported operating systems: Linux, macOS, DragonflyBSD, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos. + +All POSIX.1 and POSIX.2 variables are supported, see [References](#references) for a complete list. + +Additionally, the following non-standard variables are supported on some operating systems: + +| Variable | Supported on | +|---|---| +| `SC_PHYS_PAGES` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_AVPHYS_PAGES` | Linux, OpenBSD, Solaris/Illumos | +| `SC_NPROCESSORS_CONF` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_NPROCESSORS_ONLN` | Linux, macOS, FreeBSD, NetBSD, OpenBSD, Solaris/Illumos | +| `SC_UIO_MAXIOV` | Linux | + +## Usage + +```Go +package main + +import ( + "fmt" + + "github.com/tklauser/go-sysconf" +) + +func main() { + // get clock ticks, this will return the same as C.sysconf(C._SC_CLK_TCK) + clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK) + if err == nil { + fmt.Printf("SC_CLK_TCK: %v\n", clktck) + } +} +``` + +## References + +* [POSIX documenation for `sysconf`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html) +* [Linux manpage for `sysconf(3)`](http://man7.org/linux/man-pages/man3/sysconf.3.html) +* [glibc constants for `sysconf` parameters](https://www.gnu.org/software/libc/manual/html_node/Constants-for-Sysconf.html) diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf.go b/vendor/github.com/tklauser/go-sysconf/sysconf.go new file mode 100644 index 00000000..9d674930 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf.go @@ -0,0 +1,21 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sysconf implements the sysconf(3) function and provides the +// associated SC_* constants to query system configuration values. +package sysconf + +import "errors" + +//go:generate go run mksysconf.go + +var errInvalid = errors.New("invalid parameter value") + +// Sysconf returns the value of a sysconf(3) runtime system parameter. +// The name parameter should be a SC_* constant define in this package. The +// implementation is GOOS-specific and certain SC_* constants might not be +// defined for all GOOSes. +func Sysconf(name int) (int64, error) { + return sysconf(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go new file mode 100644 index 00000000..7c96157b --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go @@ -0,0 +1,38 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || netbsd || openbsd +// +build darwin dragonfly freebsd netbsd openbsd + +package sysconf + +import "golang.org/x/sys/unix" + +func pathconf(path string, name int) int64 { + if val, err := unix.Pathconf(path, name); err == nil { + return int64(val) + } + return -1 +} + +func sysctl32(name string) int64 { + if val, err := unix.SysctlUint32(name); err == nil { + return int64(val) + } + return -1 +} + +func sysctl64(name string) int64 { + if val, err := unix.SysctlUint64(name); err == nil { + return int64(val) + } + return -1 +} + +func yesno(val int64) int64 { + if val == 0 { + return -1 + } + return val +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go new file mode 100644 index 00000000..3f5d83f6 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go @@ -0,0 +1,296 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "strconv" + "strings" + "sync" + + "golang.org/x/sys/unix" +) + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS +) + +var uname struct { + sync.Once + macOSMajor int +} + +// sysconf implements sysconf(4) as in the Darwin libc (derived from the FreeBSD +// libc), version 1534.81.1. +// See https://github.com/apple-oss-distributions/Libc/tree/Libc-1534.81.1. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + fallthrough + case SC_AIO_MAX: + return sysctl32("kern.aiomax"), nil + case SC_AIO_PRIO_DELTA_MAX: + return -1, nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _INT_MAX, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return -1, nil + case SC_GETGR_R_SIZE_MAX: + return 4096, nil + case SC_GETPW_R_SIZE_MAX: + return 4096, nil + case SC_IOV_MAX: + return _IOV_MAX, nil + case SC_MQ_OPEN_MAX: + return -1, nil + case SC_MQ_PRIO_MAX: + return -1, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX, SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil { + return -1, nil + } + if rlim.Cur > unix.RLIM_INFINITY { + return -1, nil + } + if rlim.Cur > _LONG_MAX { + return -1, unix.EOVERFLOW + } + return int64(rlim.Cur), nil + case SC_RTSIG_MAX: + return -1, nil + case SC_SEM_NSEMS_MAX: + return sysctl32("kern.sysv.semmns"), nil + case SC_SEM_VALUE_MAX: + return _POSIX_SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + // should be _PATH_DEV instead of "/" + return pathconf("/", _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + uname.Once.Do(func() { + var u unix.Utsname + err := unix.Uname(&u) + if err != nil { + return + } + rel := unix.ByteSliceToString(u.Release[:]) + ver := strings.Split(rel, ".") + maj, _ := strconv.Atoi(ver[0]) + uname.macOSMajor = maj + }) + if uname.macOSMajor < 22 { + return -1, nil + } + // macOS 13 (Ventura) and later + return 200112, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SS_REPL_MAX: + return _POSIX_SS_REPL_MAX, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TRACE_EVENT_FILTER: + return _POSIX_TRACE_EVENT_FILTER, nil + case SC_TRACE_EVENT_NAME_MAX: + return _POSIX_TRACE_EVENT_NAME_MAX, nil + case SC_TRACE_INHERIT: + return _POSIX_TRACE_INHERIT, nil + case SC_TRACE_LOG: + return _POSIX_TRACE_LOG, nil + case SC_TRACE_NAME_MAX: + return _POSIX_TRACE_NAME_MAX, nil + case SC_TRACE_SYS_MAX: + return _POSIX_TRACE_SYS_MAX, nil + case SC_TRACE_USER_EVENT_MAX: + return _POSIX_TRACE_USER_EVENT_MAX, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): darwin libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + case SC_V6_ILP32_OFF32: + if _V6_ILP32_OFF32 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofInt == unix.SizeofLong && + unix.SizeofLong == unix.SizeofPtr && + unix.SizeofPtr == sizeofOffT { + return 1, nil + } + return -1, nil + } + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + if _V6_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofInt == unix.SizeofLong && + unix.SizeofLong == unix.SizeofPtr && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + if _V6_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofLong == unix.SizeofPtr && + unix.SizeofPtr == sizeofOffT { + return 1, nil + } + return -1, nil + } + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + if _V6_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _V6_LPBIG_OFFBIG, nil + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_VERSION: + return _XOPEN_VERSION, nil + case SC_XOPEN_XCU_VERSION: + return _XOPEN_XCU_VERSION, nil + + case SC_PHYS_PAGES: + return sysctl64("hw.memsize") / int64(unix.Getpagesize()), nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go b/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go new file mode 100644 index 00000000..c2ed8d12 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_dragonfly.go @@ -0,0 +1,220 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS +) + +// sysconf implements sysconf(3) as in the FreeBSD 12 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return sysctl32("p1003_1b.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("p1003_1b.aio_max"), nil + case SC_AIO_PRIO_DELTA_MAX: + return sysctl32("p1003_1b.aio_prio_delta_max"), nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _ATEXIT_SIZE, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return yesno(sysctl32("p1003_1b.delaytimer_max")), nil + case SC_GETGR_R_SIZE_MAX, SC_GETPW_R_SIZE_MAX: + return -1, nil + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_MQ_OPEN_MAX: + return sysctl32("kern.mqueue.mq_open_max"), nil + case SC_MQ_PRIO_MAX: + return sysctl32("kern.mqueue.mq_prio_max"), nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_RTSIG_MAX: + return yesno(sysctl32("p1003_1b.rtsig_max")), nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return -1, nil + case SC_SIGQUEUE_MAX: + return yesno(sysctl32("p1003_1b.sigqueue_max")), nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return yesno(sysctl32("p1003_1b.timer_max")), nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_ASYNCHRONOUS_IO: + if _POSIX_ASYNCHRONOUS_IO == 0 { + return sysctl64("p1003_1b.asynchronous_io"), nil + } + return _POSIX_ASYNCHRONOUS_IO, nil + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): FreeBSD libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + /* TODO(tk): these need GOARCH-dependent integer size checks + case SC_V6_ILP32_OFF32: + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _V6_LPBIG_OFFBIG, nil + */ + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + + case SC_PHYS_PAGES: + return sysctl64("hw.availpages"), nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go new file mode 100644 index 00000000..b7939888 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_freebsd.go @@ -0,0 +1,226 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN - 1 + _LOGIN_NAME_MAX = _MAXLOGNAME + _SYMLOOP_MAX = _MAXSYMLINKS +) + +// sysconf implements sysconf(3) as in the FreeBSD 12 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return sysctl32("p1003_1b.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("p1003_1b.aio_max"), nil + case SC_AIO_PRIO_DELTA_MAX: + return sysctl32("p1003_1b.aio_prio_delta_max"), nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return _ATEXIT_SIZE, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return sysctl32("p1003_1b.delaytimer_max"), nil + case SC_GETGR_R_SIZE_MAX, SC_GETPW_R_SIZE_MAX: + return -1, nil + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_MQ_OPEN_MAX: + return yesno(sysctl32("p1003_1b.mq_open_max")), nil + case SC_MQ_PRIO_MAX: + return _MQ_PRIO_MAX, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return rlim.Cur, nil + } + } + return -1, nil + case SC_RTSIG_MAX: + return sysctl32("p1003_1b.rtsig_max"), nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return sysctl32("p1003_1b.sigqueue_max"), nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err != nil { + return -1, nil + } + if rlim.Cur == unix.RLIM_INFINITY { + return -1, nil + } + if rlim.Cur > _LONG_MAX { + return -1, unix.EOVERFLOW + } + if rlim.Cur > _SHRT_MAX { + return _SHRT_MAX, nil + } + return rlim.Cur, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return yesno(sysctl32("p1003_1b.timer_max")), nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TZNAME_MAX: + return pathconf(_PATH_ZONEINFO, _PC_NAME_MAX), nil + + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_MESSAGE_PASSING: + if _POSIX_MESSAGE_PASSING == 0 { + return yesno(sysctl32("p1003_1b.message_passing")), nil + } + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + if _POSIX_PRIORITIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.prioritized_io")), nil + } + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + if _POSIX_PRIORITY_SCHEDULING == 0 { + return yesno(sysctl32("p1003_1b.priority_scheduling")), nil + } + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_REALTIME_SIGNALS: + if _POSIX_REALTIME_SIGNALS == 0 { + return yesno(sysctl32("p1003_1b.realtime_signals")), nil + } + return _POSIX_REALTIME_SIGNALS, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_SEMAPHORES: + if _POSIX_SEMAPHORES == 0 { + return yesno(sysctl32("p1003_1b.semaphores")), nil + } + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + if _POSIX_SYNCHRONIZED_IO == 0 { + return yesno(sysctl32("p1003_1b.synchronized_io")), nil + } + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_TIMERS: + if _POSIX_TIMERS == 0 { + return yesno(sysctl32("p1003_1b.timers")), nil + } + return _POSIX_TIMERS, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + case SC_VERSION: + // TODO(tk): FreeBSD libc uses sysctl(CTL_KERN, KERN_POSIX1) + return _POSIX_VERSION, nil + + /* TODO(tk): these need GOARCH-dependent integer size checks + case SC_V6_ILP32_OFF32: + return _V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _V6_LPBIG_OFFBIG, nil + */ + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + + case SC_PHYS_PAGES: + if val, err := unix.SysctlUint64("hw.availpages"); err == nil { + return int64(val), nil + } + return -1, nil + case SC_NPROCESSORS_CONF: + fallthrough + case SC_NPROCESSORS_ONLN: + if val, err := unix.SysctlUint32("hw.ncpu"); err == nil { + return int64(val), nil + } + return -1, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go new file mode 100644 index 00000000..248bdc99 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go @@ -0,0 +1,46 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd + +package sysconf + +import "os" + +func sysconfGeneric(name int) (int64, error) { + // POSIX default values + if sc, err := sysconfPOSIX(name); err == nil { + return sc, nil + } + + switch name { + case SC_BC_BASE_MAX: + return _BC_BASE_MAX, nil + case SC_BC_DIM_MAX: + return _BC_DIM_MAX, nil + case SC_BC_SCALE_MAX: + return _BC_SCALE_MAX, nil + case SC_BC_STRING_MAX: + return _BC_STRING_MAX, nil + case SC_COLL_WEIGHTS_MAX: + return _COLL_WEIGHTS_MAX, nil + case SC_EXPR_NEST_MAX: + return _EXPR_NEST_MAX, nil + case SC_HOST_NAME_MAX: + return _HOST_NAME_MAX, nil + case SC_LINE_MAX: + return _LINE_MAX, nil + case SC_LOGIN_NAME_MAX: + return _LOGIN_NAME_MAX, nil + case SC_PAGESIZE: // same as SC_PAGE_SIZE + return int64(os.Getpagesize()), nil + case SC_RE_DUP_MAX: + return _RE_DUP_MAX, nil + case SC_SYMLOOP_MAX: + return _SYMLOOP_MAX, nil + } + + return -1, errInvalid +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go new file mode 100644 index 00000000..5fb49ac7 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go @@ -0,0 +1,345 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "bufio" + "io/ioutil" + "os" + "runtime" + "strconv" + "strings" + + "github.com/tklauser/numcpus" + "golang.org/x/sys/unix" +) + +const ( + // CLK_TCK is a constant on Linux for all architectures except alpha and ia64. + // See e.g. + // https://git.musl-libc.org/cgit/musl/tree/src/conf/sysconf.c#n30 + // https://github.com/containerd/cgroups/pull/12 + // https://lore.kernel.org/lkml/agtlq6$iht$1@penguin.transmeta.com/ + _SYSTEM_CLK_TCK = 100 +) + +func readProcFsInt64(path string, fallback int64) int64 { + data, err := ioutil.ReadFile(path) + if err != nil { + return fallback + } + i, err := strconv.ParseInt(string(data[:len(data)-1]), 0, 64) + if err != nil { + return fallback + } + return i +} + +// getMemPages computes mem*unit/os.Getpagesize(), but avoids overflowing int64. +func getMemPages(mem uint64, unit uint32) int64 { + pageSize := os.Getpagesize() + for unit > 1 && pageSize > 1 { + unit >>= 1 + pageSize >>= 1 + } + mem *= uint64(unit) + for pageSize > 1 { + pageSize >>= 1 + mem >>= 1 + } + return int64(mem) +} + +func getPhysPages() int64 { + var si unix.Sysinfo_t + err := unix.Sysinfo(&si) + if err != nil { + return int64(0) + } + return getMemPages(uint64(si.Totalram), si.Unit) +} + +func getAvPhysPages() int64 { + var si unix.Sysinfo_t + err := unix.Sysinfo(&si) + if err != nil { + return int64(0) + } + return getMemPages(uint64(si.Freeram), si.Unit) +} + +func getNprocsSysfs() (int64, error) { + n, err := numcpus.GetOnline() + return int64(n), err +} + +func getNprocsProcStat() (int64, error) { + f, err := os.Open("/proc/stat") + if err != nil { + return -1, err + } + defer f.Close() + + count := int64(0) + s := bufio.NewScanner(f) + for s.Scan() { + if line := strings.TrimSpace(s.Text()); strings.HasPrefix(line, "cpu") { + l := strings.SplitN(line, " ", 2) + _, err := strconv.ParseInt(l[0][3:], 10, 64) + if err == nil { + count++ + } + } else { + // The current format of /proc/stat has all the + // cpu* lines at the beginning. Assume this + // stays this way. + break + } + } + return count, nil +} + +func getNprocs() int64 { + count, err := getNprocsSysfs() + if err == nil { + return count + } + + count, err = getNprocsProcStat() + if err == nil { + return count + } + + // default to the value determined at runtime startup if all else fails + return int64(runtime.NumCPU()) +} + +func getNprocsConf() int64 { + count, err := numcpus.GetConfigured() + if err == nil { + return int64(count) + } + + // TODO(tk): fall back to reading /proc/cpuinfo on legacy systems + // without sysfs? + + return getNprocs() +} + +func hasClock(clockid int32) bool { + var res unix.Timespec + if err := unix.ClockGetres(clockid, &res); err != nil { + return false + } + return true +} + +func max(a, b int64) int64 { + if a > b { + return a + } + return b +} + +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX: + return -1, nil + case SC_AIO_MAX: + return -1, nil + case SC_AIO_PRIO_DELTA_MAX: + return _AIO_PRIO_DELTA_MAX, nil + case SC_ARG_MAX: + argMax := int64(_POSIX_ARG_MAX) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_STACK, &rlim); err == nil { + argMax = max(argMax, int64(rlim.Cur/4)) + } + return argMax, nil + case SC_ATEXIT_MAX: + return _INT_MAX, nil + case SC_CHILD_MAX: + childMax := int64(-1) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil && rlim.Cur != unix.RLIM_INFINITY { + childMax = int64(rlim.Cur) + } + return childMax, nil + case SC_CLK_TCK: + return _SYSTEM_CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return _DELAYTIMER_MAX, nil + case SC_GETGR_R_SIZE_MAX: + return _NSS_BUFLEN_GROUP, nil + case SC_GETPW_R_SIZE_MAX: + return _NSS_BUFLEN_PASSWD, nil + case SC_MQ_OPEN_MAX: + return -1, nil + case SC_MQ_PRIO_MAX: + return _MQ_PRIO_MAX, nil + case SC_NGROUPS_MAX: + return readProcFsInt64("/proc/sys/kernel/ngroups_max", _NGROUPS_MAX), nil + case SC_OPEN_MAX: + openMax := int64(_OPEN_MAX) + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + openMax = int64(rlim.Cur) + } + return openMax, nil + case SC_RTSIG_MAX: + return _RTSIG_MAX, nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_SIGPENDING, &rlim); err == nil { + return int64(rlim.Cur), nil + } + return readProcFsInt64("/proc/sys/kernel/rtsig-max", _POSIX_SIGQUEUE_MAX), nil + case SC_STREAM_MAX: + return _STREAM_MAX, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + return _TTY_NAME_MAX, nil + case SC_TZNAME_MAX: + return -1, nil + + case SC_CPUTIME: + if hasClock(unix.CLOCK_PROCESS_CPUTIME_ID) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_MONOTONIC_CLOCK: + if hasClock(unix.CLOCK_MONOTONIC) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_SAVED_IDS: + return _POSIX_SAVED_IDS, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + if hasClock(unix.CLOCK_THREAD_CPUTIME_ID) { + return _POSIX_VERSION, nil + } + return -1, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_TRACE: + return _POSIX_TRACE, nil + case SC_TRACE_EVENT_FILTER: + return _POSIX_TRACE_EVENT_FILTER, nil + case SC_TRACE_EVENT_NAME_MAX: + return -1, nil + case SC_TRACE_INHERIT: + return _POSIX_TRACE_INHERIT, nil + case SC_TRACE_LOG: + return _POSIX_TRACE_LOG, nil + case SC_TRACE_NAME_MAX: + return -1, nil + case SC_TRACE_SYS_MAX: + return -1, nil + case SC_TRACE_USER_EVENT_MAX: + return -1, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + + case SC_V7_ILP32_OFF32: + return _POSIX_V7_ILP32_OFF32, nil + case SC_V7_ILP32_OFFBIG: + return _POSIX_V7_ILP32_OFFBIG, nil + case SC_V7_LP64_OFF64: + return _POSIX_V7_LP64_OFF64, nil + case SC_V7_LPBIG_OFFBIG: + return _POSIX_V7_LPBIG_OFFBIG, nil + + case SC_V6_ILP32_OFF32: + return _POSIX_V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + return _POSIX_V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + return _POSIX_V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + return _POSIX_V6_LPBIG_OFFBIG, nil + + case SC_2_C_VERSION: + return _POSIX2_C_VERSION, nil + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return -1, nil + case SC_2_UPE: + return -1, nil + + case SC_XOPEN_CRYPT: + // removed in glibc 2.28 + return -1, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return -1, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_VERSION: + return _XOPEN_VERSION, nil + case SC_XOPEN_XCU_VERSION: + return _XOPEN_XCU_VERSION, nil + + case SC_PHYS_PAGES: + return getPhysPages(), nil + case SC_AVPHYS_PAGES: + return getAvPhysPages(), nil + case SC_NPROCESSORS_CONF: + return getNprocsConf(), nil + case SC_NPROCESSORS_ONLN: + return getNprocs(), nil + case SC_UIO_MAXIOV: // same as _SC_IOV_MAX + return _UIO_MAXIOV, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go new file mode 100644 index 00000000..325d4a6a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go @@ -0,0 +1,250 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import ( + "sync" + + "golang.org/x/sys/unix" +) + +const ( + _HOST_NAME_MAX = _MAXHOSTNAMELEN + _LOGIN_NAME_MAX = _MAXLOGNAME + 1 + _SYMLOOP_MAX = _MAXSYMLINKS + + _POSIX2_C_BIND = 1 + _POSIX2_C_DEV = -1 + _POSIX2_CHAR_TERM = -1 + _POSIX2_FORT_DEV = -1 + _POSIX2_FORT_RUN = -1 + _POSIX2_LOCALEDEF = -1 + _POSIX2_SW_DEV = -1 + _POSIX2_UPE = -1 +) + +var ( + clktck int64 + clktckOnce sync.Once +) + +func sysconfPOSIX(name int) (int64, error) { + // NetBSD does not define all _POSIX_* values used in sysconf_posix.go + // The supported ones are handled in sysconf below. + return -1, errInvalid +} + +func sysconf(name int) (int64, error) { + // NetBSD uses sysctl to get some of these values. For the user.* namespace, + // calls get handled by user_sysctl in /usr/src/lib/libc/gen/sysctl.c + // Duplicate the relevant values here. + + switch name { + + // 1003.1 + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + clktckOnce.Do(func() { + clktck = -1 + if ci, err := unix.SysctlClockinfo("kern.clockrate"); err == nil { + clktck = int64(ci.Hz) + } + }) + return clktck, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_JOB_CONTROL: + return sysctl32("kern.job_control"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + return int64(rlim.Cur), nil + } + return -1, nil + case SC_STREAM_MAX: + // sysctl("user.stream_max") + return _FOPEN_MAX, nil + case SC_TZNAME_MAX: + // sysctl("user.tzname_max") + return _NAME_MAX, nil + case SC_SAVED_IDS: + return yesno(sysctl32("kern.saved_ids")), nil + case SC_VERSION: + return sysctl32("kern.posix1version"), nil + + // 1003.1b + case SC_FSYNC: + return sysctl32("kern.fsync"), nil + case SC_SYNCHRONIZED_IO: + return sysctl32("kern.synchronized_io"), nil + case SC_MAPPED_FILES: + return sysctl32("kern.mapped_files"), nil + case SC_MEMLOCK: + return sysctl32("kern.memlock"), nil + case SC_MEMLOCK_RANGE: + return sysctl32("kern.memlock_range"), nil + case SC_MEMORY_PROTECTION: + return sysctl32("kern.memory_protection"), nil + case SC_MONOTONIC_CLOCK: + return sysctl32("kern.monotonic_clock"), nil + case SC_SEMAPHORES: + return sysctl32("kern.posix_semaphores"), nil + case SC_TIMERS: + return sysctl32("kern.posix_timers"), nil + + // 1003.1c + case SC_LOGIN_NAME_MAX: + return sysctl32("kern.login_name_max"), nil + case SC_THREADS: + return sysctl32("kern.posix_threads"), nil + + // 1003.1j + case SC_BARRIERS: + return yesno(sysctl32("kern.posix_barriers")), nil + case SC_SPIN_LOCKS: + return yesno(sysctl32("kern.posix_spin_locks")), nil + case SC_READER_WRITER_LOCKS: + return yesno(sysctl32("kern.posix_reader_writer_locks")), nil + + // 1003.2 + case SC_2_VERSION: + // sysctl user.posix2_version + return _POSIX2_VERSION, nil + case SC_2_C_BIND: + // sysctl user.posix2_c_bind + return _POSIX2_C_BIND, nil + case SC_2_C_DEV: + // sysctl user.posix2_c_dev + return _POSIX2_C_DEV, nil + case SC_2_CHAR_TERM: + // sysctl user.posix2_char_term + return _POSIX2_CHAR_TERM, nil + case SC_2_FORT_DEV: + // sysctl user.posix2_fort_dev + return _POSIX2_FORT_DEV, nil + case SC_2_FORT_RUN: + // sysctl user.posix2_fort_run + return _POSIX2_FORT_RUN, nil + case SC_2_LOCALEDEF: + // sysctl user.posix2_localedef + return _POSIX2_LOCALEDEF, nil + case SC_2_SW_DEV: + // sysctl user.posix2_sw_dev + return _POSIX2_SW_DEV, nil + case SC_2_UPE: + // sysctl user.posix2_upe + return _POSIX2_UPE, nil + + // XPG 4.2 + case SC_IOV_MAX: + return sysctl32("kern.iov_max"), nil + case SC_XOPEN_SHM: + return yesno(sysctl32("kern.ipc.sysvshm")), nil + + // 1003.1-2001, XSI Option Group + case SC_AIO_LISTIO_MAX: + return sysctl32("kern.aio_listio_max"), nil + case SC_AIO_MAX: + return sysctl32("kern.aio_max"), nil + case SC_ASYNCHRONOUS_IO: + return yesno(sysctl32("kern.posix_aio")), nil + case SC_MESSAGE_PASSING: + return yesno(sysctl32("kern.posix_msg")), nil + case SC_MQ_OPEN_MAX: + return sysctl32("kern.mqueue.mq_open_max"), nil + case SC_MQ_PRIO_MAX: + return sysctl32("kern.mqueue.mq_prio_max"), nil + case SC_PRIORITY_SCHEDULING: + return yesno(sysctl32("kern.posix_sched")), nil + case SC_ATEXIT_MAX: + // sysctl("user.atexit_max") + return -1, nil // TODO + + // 1003.1-2001, TSF + case SC_GETGR_R_SIZE_MAX: + return _GETGR_R_SIZE_MAX, nil + case SC_GETPW_R_SIZE_MAX: + return _GETPW_R_SIZE_MAX, nil + + // Unsorted + case SC_HOST_NAME_MAX: + return _MAXHOSTNAMELEN, nil + case SC_PASS_MAX: + return _PASSWORD_LEN, nil + case SC_REGEXP: + return _POSIX_REGEXP, nil + case SC_SHARED_MEMORY_OBJECTS: + return _POSIX_SHARED_MEMORY_OBJECTS, nil + case SC_SHELL: + return _POSIX_SHELL, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + + // Extensions + case SC_NPROCESSORS_CONF: + return sysctl32("hw.ncpu"), nil + case SC_NPROCESSORS_ONLN: + return sysctl32("hw.ncpuonline"), nil + + // Linux/Solaris + case SC_PHYS_PAGES: + return sysctl64("hw.physmem64") / int64(unix.Getpagesize()), nil + + // Native + case SC_SCHED_RT_TS: + return sysctl32("kern.sched.rtts"), nil + case SC_SCHED_PRI_MIN: + return sysctl32("kern.sched.pri_min"), nil + case SC_SCHED_PRI_MAX: + return sysctl32("kern.sched.pri_max"), nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _POSIX_THREAD_KEYS_MAX, nil + case SC_THREAD_STACK_MIN: + return int64(unix.Getpagesize()), nil + case SC_THREAD_THREADS_MAX: + return sysctl32("kern.maxproc"), nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_PRIORITY_SCHEDULING, + SC_THREAD_PRIO_INHERIT, + SC_THREAD_PROCESS_SHARED: + return -1, nil + case SC_TTY_NAME_MAX: + return pathconf(_PATH_DEV, _PC_NAME_MAX), nil + case SC_TIMER_MAX: + return _POSIX_TIMER_MAX, nil + case SC_SEM_NSEMS_MAX: + return _LONG_MAX, nil + case SC_CPUTIME: + return _POSIX_CPUTIME, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_DELAYTIMER_MAX: + return _POSIX_DELAYTIMER_MAX, nil + case SC_SIGQUEUE_MAX: + return _POSIX_SIGQUEUE_MAX, nil + case SC_REALTIME_SIGNALS: + return 200112, nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go new file mode 100644 index 00000000..c0c394ab --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_openbsd.go @@ -0,0 +1,271 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +// sysconf implements sysconf(3) as in the OpenBSD 6.3 libc. +func sysconf(name int) (int64, error) { + switch name { + case SC_AIO_LISTIO_MAX, + SC_AIO_MAX, + SC_AIO_PRIO_DELTA_MAX: + return -1, nil + case SC_ARG_MAX: + return sysctl32("kern.argmax"), nil + case SC_ATEXIT_MAX: + return -1, nil + case SC_CHILD_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_CLK_TCK: + return _CLK_TCK, nil + case SC_DELAYTIMER_MAX: + return -1, nil + case SC_GETGR_R_SIZE_MAX: + return _GR_BUF_LEN, nil + case SC_GETPW_R_SIZE_MAX: + return _PW_BUF_LEN, nil + case SC_IOV_MAX: + return _IOV_MAX, nil + case SC_LOGIN_NAME_MAX: + return _LOGIN_NAME_MAX, nil + case SC_NGROUPS_MAX: + return sysctl32("kern.ngroups"), nil + case SC_OPEN_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_SEM_NSEMS_MAX: + return -1, nil + case SC_SEM_VALUE_MAX: + return _SEM_VALUE_MAX, nil + case SC_SIGQUEUE_MAX: + return -1, nil + case SC_STREAM_MAX: + var rlim unix.Rlimit + if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + if rlim.Cur != unix.RLIM_INFINITY { + if rlim.Cur > _SHRT_MAX { + return _SHRT_MAX, nil + } + return int64(rlim.Cur), nil + } + } + return -1, nil + case SC_THREAD_DESTRUCTOR_ITERATIONS: + return _PTHREAD_DESTRUCTOR_ITERATIONS, nil + case SC_THREAD_KEYS_MAX: + return _PTHREAD_KEYS_MAX, nil + case SC_THREAD_STACK_MIN: + return _PTHREAD_STACK_MIN, nil + case SC_THREAD_THREADS_MAX: + return -1, nil + case SC_TIMER_MAX: + return -1, nil + case SC_TTY_NAME_MAX: + return _TTY_NAME_MAX, nil + case SC_TZNAME_MAX: + return _NAME_MAX, nil + + case SC_BARRIERS: + return _POSIX_BARRIERS, nil + case SC_FSYNC: + return _POSIX_FSYNC, nil + case SC_IPV6: + if _POSIX_IPV6 == 0 { + fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, 0) + if err == nil && fd >= 0 { + unix.Close(fd) + return int64(200112), nil + } + return 0, nil + } + return _POSIX_IPV6, nil + case SC_JOB_CONTROL: + return _POSIX_JOB_CONTROL, nil + case SC_MAPPED_FILES: + return _POSIX_MAPPED_FILES, nil + case SC_MONOTONIC_CLOCK: + return _POSIX_MONOTONIC_CLOCK, nil + case SC_SAVED_IDS: + return _POSIX_SAVED_IDS, nil + case SC_SEMAPHORES: + return _POSIX_SEMAPHORES, nil + case SC_SPAWN: + return _POSIX_SPAWN, nil + case SC_SPIN_LOCKS: + return _POSIX_SPIN_LOCKS, nil + case SC_SPORADIC_SERVER: + return _POSIX_SPORADIC_SERVER, nil + case SC_SYNCHRONIZED_IO: + return _POSIX_SYNCHRONIZED_IO, nil + case SC_THREAD_ATTR_STACKADDR: + return _POSIX_THREAD_ATTR_STACKADDR, nil + case SC_THREAD_ATTR_STACKSIZE: + return _POSIX_THREAD_ATTR_STACKSIZE, nil + case SC_THREAD_CPUTIME: + return _POSIX_THREAD_CPUTIME, nil + case SC_THREAD_PRIO_INHERIT: + return _POSIX_THREAD_PRIO_INHERIT, nil + case SC_THREAD_PRIO_PROTECT: + return _POSIX_THREAD_PRIO_PROTECT, nil + case SC_THREAD_PRIORITY_SCHEDULING: + return _POSIX_THREAD_PRIORITY_SCHEDULING, nil + case SC_THREAD_PROCESS_SHARED: + return _POSIX_THREAD_PROCESS_SHARED, nil + case SC_THREAD_ROBUST_PRIO_INHERIT: + return _POSIX_THREAD_ROBUST_PRIO_INHERIT, nil + case SC_THREAD_ROBUST_PRIO_PROTECT: + return _POSIX_THREAD_ROBUST_PRIO_PROTECT, nil + case SC_THREAD_SAFE_FUNCTIONS: + return _POSIX_THREAD_SAFE_FUNCTIONS, nil + case SC_THREAD_SPORADIC_SERVER: + return _POSIX_THREAD_SPORADIC_SERVER, nil + case SC_THREADS: + return _POSIX_THREADS, nil + case SC_TIMEOUTS: + return _POSIX_TIMEOUTS, nil + case SC_TIMERS: + return _POSIX_TIMERS, nil + case SC_TRACE, + SC_TRACE_EVENT_FILTER, + SC_TRACE_EVENT_NAME_MAX, + SC_TRACE_INHERIT, + SC_TRACE_LOG: + return _POSIX_TRACE, nil + case SC_TYPED_MEMORY_OBJECTS: + return _POSIX_TYPED_MEMORY_OBJECTS, nil + + case SC_V7_ILP32_OFF32: + return _POSIX_V7_ILP32_OFF32, nil + case SC_V7_ILP32_OFFBIG: + if _POSIX_V7_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 32 && + unix.SizeofPtr*_CHAR_BIT == 32 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_ILP32_OFFBIG, nil + case SC_V7_LP64_OFF64: + if _POSIX_V7_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofPtr*_CHAR_BIT == 64 && + sizeofOffT*_CHAR_BIT == 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_LP64_OFF64, nil + case SC_V7_LPBIG_OFFBIG: + if _POSIX_V7_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V7_LPBIG_OFFBIG, nil + + case SC_V6_ILP32_OFF32: + return _POSIX_V6_ILP32_OFF32, nil + case SC_V6_ILP32_OFFBIG: + if _POSIX_V6_ILP32_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 32 && + unix.SizeofPtr*_CHAR_BIT == 32 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_ILP32_OFFBIG, nil + case SC_V6_LP64_OFF64: + if _POSIX_V6_LP64_OFF64 == 0 { + if unix.SizeofInt*_CHAR_BIT == 32 && + unix.SizeofLong*_CHAR_BIT == 64 && + unix.SizeofPtr*_CHAR_BIT == 64 && + sizeofOffT*_CHAR_BIT == 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_LP64_OFF64, nil + case SC_V6_LPBIG_OFFBIG: + if _POSIX_V6_LPBIG_OFFBIG == 0 { + if unix.SizeofInt*_CHAR_BIT >= 32 && + unix.SizeofLong*_CHAR_BIT >= 64 && + unix.SizeofPtr*_CHAR_BIT >= 64 && + sizeofOffT*_CHAR_BIT >= 64 { + return 1, nil + } + return -1, nil + } + return _POSIX_V6_LPBIG_OFFBIG, nil + + case SC_2_CHAR_TERM: + return _POSIX2_CHAR_TERM, nil + case SC_2_PBS, + SC_2_PBS_ACCOUNTING, + SC_2_PBS_CHECKPOINT, + SC_2_PBS_LOCATE, + SC_2_PBS_MESSAGE, + SC_2_PBS_TRACK: + return _POSIX2_PBS, nil + case SC_2_UPE: + return _POSIX2_UPE, nil + case SC_2_VERSION: + return _POSIX2_VERSION, nil + + case SC_XOPEN_CRYPT: + return _XOPEN_CRYPT, nil + case SC_XOPEN_ENH_I18N: + return _XOPEN_ENH_I18N, nil + case SC_XOPEN_REALTIME: + return _XOPEN_REALTIME, nil + case SC_XOPEN_REALTIME_THREADS: + return _XOPEN_REALTIME_THREADS, nil + case SC_XOPEN_SHM: + return _XOPEN_SHM, nil + case SC_XOPEN_STREAMS: + return _XOPEN_STREAMS, nil + case SC_XOPEN_UNIX: + return _XOPEN_UNIX, nil + case SC_XOPEN_UUCP: + return _XOPEN_UUCP, nil + + case SC_AVPHYS_PAGES: + if uvm, err := unix.SysctlUvmexp("vm.uvmexp"); err == nil { + return int64(uvm.Free), nil + } + return -1, nil + case SC_PHYS_PAGES: + return sysctl64("hw.physmem") / int64(unix.Getpagesize()), nil + case SC_NPROCESSORS_CONF: + return sysctl32("hw.ncpu"), nil + case SC_NPROCESSORS_ONLN: + if val, err := unix.SysctlUint32("hw.ncpuonline"); err == nil { + return int64(val), nil + } + return sysctl32("hw.ncpu"), nil + } + + return sysconfGeneric(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go new file mode 100644 index 00000000..e61c0bc7 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go @@ -0,0 +1,83 @@ +// Copyright 2018 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || linux || openbsd +// +build darwin dragonfly freebsd linux openbsd + +package sysconf + +func sysconfPOSIX(name int) (int64, error) { + switch name { + case SC_ADVISORY_INFO: + return _POSIX_ADVISORY_INFO, nil + case SC_ASYNCHRONOUS_IO: + return _POSIX_ASYNCHRONOUS_IO, nil + case SC_BARRIERS: + return _POSIX_BARRIERS, nil + case SC_CLOCK_SELECTION: + return _POSIX_CLOCK_SELECTION, nil + case SC_CPUTIME: + return _POSIX_CPUTIME, nil + case SC_FSYNC: + return _POSIX_FSYNC, nil + case SC_IPV6: + return _POSIX_IPV6, nil + case SC_JOB_CONTROL: + return _POSIX_JOB_CONTROL, nil + case SC_MAPPED_FILES: + return _POSIX_MAPPED_FILES, nil + case SC_MEMLOCK: + return _POSIX_MEMLOCK, nil + case SC_MEMLOCK_RANGE: + return _POSIX_MEMLOCK_RANGE, nil + case SC_MONOTONIC_CLOCK: + return _POSIX_MONOTONIC_CLOCK, nil + case SC_MEMORY_PROTECTION: + return _POSIX_MEMORY_PROTECTION, nil + case SC_MESSAGE_PASSING: + return _POSIX_MESSAGE_PASSING, nil + case SC_PRIORITIZED_IO: + return _POSIX_PRIORITIZED_IO, nil + case SC_PRIORITY_SCHEDULING: + return _POSIX_PRIORITY_SCHEDULING, nil + case SC_RAW_SOCKETS: + return _POSIX_RAW_SOCKETS, nil + case SC_READER_WRITER_LOCKS: + return _POSIX_READER_WRITER_LOCKS, nil + case SC_REALTIME_SIGNALS: + return _POSIX_REALTIME_SIGNALS, nil + case SC_REGEXP: + return _POSIX_REGEXP, nil + case SC_SEMAPHORES: + return _POSIX_SEMAPHORES, nil + case SC_SHARED_MEMORY_OBJECTS: + return _POSIX_SHARED_MEMORY_OBJECTS, nil + case SC_SHELL: + return _POSIX_SHELL, nil + case SC_THREADS: + return _POSIX_THREADS, nil + case SC_TIMEOUTS: + return _POSIX_TIMEOUTS, nil + case SC_TIMERS: + return _POSIX_TIMERS, nil + case SC_VERSION: + return _POSIX_VERSION, nil + + case SC_2_C_BIND: + return _POSIX2_C_BIND, nil + case SC_2_C_DEV: + return _POSIX2_C_DEV, nil + case SC_2_FORT_DEV: + return -1, nil + case SC_2_FORT_RUN: + return -1, nil + case SC_2_LOCALEDEF: + return _POSIX2_LOCALEDEF, nil + case SC_2_SW_DEV: + return _POSIX2_SW_DEV, nil + case SC_2_VERSION: + return _POSIX2_VERSION, nil + } + return -1, errInvalid +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go b/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go new file mode 100644 index 00000000..443b2143 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_solaris.go @@ -0,0 +1,14 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sysconf + +import "golang.org/x/sys/unix" + +func sysconf(name int) (int64, error) { + if name < 0 { + return -1, errInvalid + } + return unix.Sysconf(name) +} diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go new file mode 100644 index 00000000..478d6920 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go @@ -0,0 +1,17 @@ +// Copyright 2021 Tobias Klauser. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris +// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris + +package sysconf + +import ( + "fmt" + "runtime" +) + +func sysconf(name int) (int64, error) { + return -1, fmt.Errorf("unsupported on %s", runtime.GOOS) +} diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go new file mode 100644 index 00000000..6fadf3db --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go @@ -0,0 +1,254 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_darwin.go + +//go:build darwin +// +build darwin + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x1d + SC_PAGESIZE = 0x1d + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x2f + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SS_REPL_MAX = 0x7e + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_EVENT_NAME_MAX = 0x7f + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TRACE_NAME_MAX = 0x80 + SC_TRACE_SYS_MAX = 0x81 + SC_TRACE_USER_EVENT_MAX = 0x82 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x79 + + SC_PHYS_PAGES = 0xc8 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _IOV_MAX = 0x400 + _LINE_MAX = 0x800 + _NAME_MAX = 0xff + _RE_DUP_MAX = 0xff + + _CLK_TCK = 0x64 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0xff + _MAXSYMLINKS = 0x20 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = -0x1 + _POSIX_BARRIERS = -0x1 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = -0x1 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x30db0 + _POSIX_JOB_CONTROL = 0x30db0 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = -0x1 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = -0x1 + _POSIX_MONOTONIC_CLOCK = -0x1 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = -0x1 + _POSIX_RAW_SOCKETS = -0x1 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = -0x1 + _POSIX_REGEXP = 0x30db0 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = -0x1 + _POSIX_SHARED_MEMORY_OBJECTS = -0x1 + _POSIX_SHELL = 0x30db0 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPIN_LOCKS = -0x1 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SS_REPL_MAX = 0x4 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = -0x1 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_INHERIT = -0x1 + _POSIX_THREAD_PRIO_PROTECT = -0x1 + _POSIX_THREAD_PRIORITY_SCHEDULING = -0x1 + _POSIX_THREAD_PROCESS_SHARED = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = -0x1 + _POSIX_TIMERS = -0x1 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_EVENT_NAME_MAX = 0x1e + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TRACE_NAME_MAX = 0x8 + _POSIX_TRACE_SYS_MAX = 0x8 + _POSIX_TRACE_USER_EVENT_MAX = 0x20 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = -0x1 + _V6_LP64_OFF64 = 0x1 + _V6_LPBIG_OFFBIG = 0x1 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = 0x30db0 + _POSIX2_CHAR_TERM = 0x30db0 + _POSIX2_LOCALEDEF = 0x30db0 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x30db0 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x30db0 + + _XOPEN_CRYPT = 0x1 + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x258 + _XOPEN_XCU_VERSION = 0x4 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x200 + _PTHREAD_STACK_MIN = 0x2000 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) + +const ( + _CHAR_BIT = 0x8 + + _INT_MAX = 0x7fffffff + _LONG_MAX = 0x7fffffffffffffff + + sizeofOffT = 0x8 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go new file mode 100644 index 00000000..0864cd44 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go @@ -0,0 +1,228 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_dragonfly.go + +//go:build dragonfly +// +build dragonfly + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x2f + SC_PAGESIZE = 0x2f + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x1d + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x75 + + SC_PHYS_PAGES = 0x79 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xa + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + _RE_DUP_MAX = 0xff + + _CLK_TCK = 0x80 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x11 + _MAXSYMLINKS = 0x20 + _ATEXIT_SIZE = 0x20 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x0 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x30db0 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = 0x30db0 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x30db0 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_PRIO_INHERIT = 0x30db0 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_THREAD_PROCESS_SHARED = -0x1 + _POSIX_THREAD_SAFE_FUNCTIONS = -0x1 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TIMERS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = 0x0 + _V6_LP64_OFF64 = 0x0 + _V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_UPE = 0x31069 + _POSIX2_VERSION = 0x30a2c + + _XOPEN_CRYPT = -0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = -0x1 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x4000 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go new file mode 100644 index 00000000..9885411a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go @@ -0,0 +1,229 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_freebsd.go + +//go:build freebsd +// +build freebsd + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x6b + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x2d + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x46 + SC_GETPW_R_SIZE_MAX = 0x47 + SC_HOST_NAME_MAX = 0x48 + SC_IOV_MAX = 0x38 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x49 + SC_MQ_OPEN_MAX = 0x2e + SC_MQ_PRIO_MAX = 0x4b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x2f + SC_PAGESIZE = 0x2f + SC_RE_DUP_MAX = 0x10 + SC_RTSIG_MAX = 0x30 + SC_SEM_NSEMS_MAX = 0x31 + SC_SEM_VALUE_MAX = 0x32 + SC_SIGQUEUE_MAX = 0x33 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x78 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x55 + SC_THREAD_KEYS_MAX = 0x56 + SC_THREAD_STACK_MIN = 0x5d + SC_THREAD_THREADS_MAX = 0x5e + SC_TIMER_MAX = 0x34 + SC_TTY_NAME_MAX = 0x65 + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x41 + SC_ASYNCHRONOUS_IO = 0x1c + SC_BARRIERS = 0x42 + SC_CLOCK_SELECTION = 0x43 + SC_CPUTIME = 0x44 + SC_FSYNC = 0x26 + SC_IPV6 = 0x76 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x1d + SC_MEMLOCK = 0x1e + SC_MEMLOCK_RANGE = 0x1f + SC_MEMORY_PROTECTION = 0x20 + SC_MESSAGE_PASSING = 0x21 + SC_MONOTONIC_CLOCK = 0x4a + SC_PRIORITIZED_IO = 0x22 + SC_PRIORITY_SCHEDULING = 0x23 + SC_RAW_SOCKETS = 0x77 + SC_READER_WRITER_LOCKS = 0x4c + SC_REALTIME_SIGNALS = 0x24 + SC_REGEXP = 0x4d + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x25 + SC_SHARED_MEMORY_OBJECTS = 0x27 + SC_SHELL = 0x4e + SC_SPAWN = 0x4f + SC_SPIN_LOCKS = 0x50 + SC_SPORADIC_SERVER = 0x51 + SC_SYNCHRONIZED_IO = 0x28 + SC_THREAD_ATTR_STACKADDR = 0x52 + SC_THREAD_ATTR_STACKSIZE = 0x53 + SC_THREAD_CPUTIME = 0x54 + SC_THREAD_PRIO_INHERIT = 0x57 + SC_THREAD_PRIO_PROTECT = 0x58 + SC_THREAD_PRIORITY_SCHEDULING = 0x59 + SC_THREAD_PROCESS_SHARED = 0x5a + SC_THREAD_SAFE_FUNCTIONS = 0x5b + SC_THREAD_SPORADIC_SERVER = 0x5c + SC_THREADS = 0x60 + SC_TIMEOUTS = 0x5f + SC_TIMERS = 0x29 + SC_TRACE = 0x61 + SC_TRACE_EVENT_FILTER = 0x62 + SC_TRACE_INHERIT = 0x63 + SC_TRACE_LOG = 0x64 + SC_TYPED_MEMORY_OBJECTS = 0x66 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x67 + SC_V6_ILP32_OFFBIG = 0x68 + SC_V6_LP64_OFF64 = 0x69 + SC_V6_LPBIG_OFFBIG = 0x6a + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x3b + SC_2_PBS_ACCOUNTING = 0x3c + SC_2_PBS_CHECKPOINT = 0x3d + SC_2_PBS_LOCATE = 0x3e + SC_2_PBS_MESSAGE = 0x3f + SC_2_PBS_TRACK = 0x40 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x6c + SC_XOPEN_ENH_I18N = 0x6d + SC_XOPEN_REALTIME = 0x6f + SC_XOPEN_REALTIME_THREADS = 0x70 + SC_XOPEN_SHM = 0x71 + SC_XOPEN_STREAMS = 0x72 + SC_XOPEN_UNIX = 0x73 + SC_XOPEN_VERSION = 0x74 + SC_XOPEN_XCU_VERSION = 0x75 + + SC_PHYS_PAGES = 0x79 + SC_NPROCESSORS_CONF = 0x39 + SC_NPROCESSORS_ONLN = 0x3a +) + +const ( + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xa + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + _MQ_PRIO_MAX = 0x40 + _RE_DUP_MAX = 0xff + _SEM_VALUE_MAX = 0x7fffffff + + _CLK_TCK = 0x80 + + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x21 + _MAXSYMLINKS = 0x20 + _ATEXIT_SIZE = 0x20 + + _POSIX_ADVISORY_INFO = 0x30db0 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x30db0 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x30db0 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = -0x1 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = 0x30db0 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = 0x0 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SEM_VALUE_MAX = 0x7fff + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x30db0 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_PRIO_INHERIT = 0x30db0 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_THREAD_PROCESS_SHARED = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TIMERS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x30db0 + + _V6_ILP32_OFF32 = -0x1 + _V6_ILP32_OFFBIG = 0x0 + _V6_LP64_OFF64 = 0x0 + _V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = -0x1 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = -0x1 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = -0x1 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x30a2c + + _XOPEN_CRYPT = -0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = -0x1 + + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x800 +) + +const ( + _PC_NAME_MAX = 0x4 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go new file mode 100644 index 00000000..8545a342 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go @@ -0,0 +1,147 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_linux.go + +//go:build linux +// +build linux + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x17 + SC_AIO_MAX = 0x18 + SC_AIO_PRIO_DELTA_MAX = 0x19 + SC_ARG_MAX = 0x0 + SC_ATEXIT_MAX = 0x57 + SC_BC_BASE_MAX = 0x24 + SC_BC_DIM_MAX = 0x25 + SC_BC_SCALE_MAX = 0x26 + SC_BC_STRING_MAX = 0x27 + SC_CHILD_MAX = 0x1 + SC_CLK_TCK = 0x2 + SC_COLL_WEIGHTS_MAX = 0x28 + SC_DELAYTIMER_MAX = 0x1a + SC_EXPR_NEST_MAX = 0x2a + SC_GETGR_R_SIZE_MAX = 0x45 + SC_GETPW_R_SIZE_MAX = 0x46 + SC_HOST_NAME_MAX = 0xb4 + SC_IOV_MAX = 0x3c + SC_LINE_MAX = 0x2b + SC_LOGIN_NAME_MAX = 0x47 + SC_MQ_OPEN_MAX = 0x1b + SC_MQ_PRIO_MAX = 0x1c + SC_NGROUPS_MAX = 0x3 + SC_OPEN_MAX = 0x4 + SC_PAGE_SIZE = 0x1e + SC_PAGESIZE = 0x1e + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x49 + SC_THREAD_KEYS_MAX = 0x4a + SC_THREAD_STACK_MIN = 0x4b + SC_THREAD_THREADS_MAX = 0x4c + SC_RE_DUP_MAX = 0x2c + SC_RTSIG_MAX = 0x1f + SC_SEM_NSEMS_MAX = 0x20 + SC_SEM_VALUE_MAX = 0x21 + SC_SIGQUEUE_MAX = 0x22 + SC_STREAM_MAX = 0x5 + SC_SYMLOOP_MAX = 0xad + SC_TIMER_MAX = 0x23 + SC_TTY_NAME_MAX = 0x48 + SC_TZNAME_MAX = 0x6 + + SC_ADVISORY_INFO = 0x84 + SC_ASYNCHRONOUS_IO = 0xc + SC_BARRIERS = 0x85 + SC_CLOCK_SELECTION = 0x89 + SC_CPUTIME = 0x8a + SC_FSYNC = 0xf + SC_IPV6 = 0xeb + SC_JOB_CONTROL = 0x7 + SC_MAPPED_FILES = 0x10 + SC_MEMLOCK = 0x11 + SC_MEMLOCK_RANGE = 0x12 + SC_MEMORY_PROTECTION = 0x13 + SC_MESSAGE_PASSING = 0x14 + SC_MONOTONIC_CLOCK = 0x95 + SC_PRIORITIZED_IO = 0xd + SC_PRIORITY_SCHEDULING = 0xa + SC_RAW_SOCKETS = 0xec + SC_READER_WRITER_LOCKS = 0x99 + SC_REALTIME_SIGNALS = 0x9 + SC_REGEXP = 0x9b + SC_SAVED_IDS = 0x8 + SC_SEMAPHORES = 0x15 + SC_SHARED_MEMORY_OBJECTS = 0x16 + SC_SHELL = 0x9d + SC_SPAWN = 0x9f + SC_SPIN_LOCKS = 0x9a + SC_SPORADIC_SERVER = 0xa0 + SC_SS_REPL_MAX = 0xf1 + SC_SYNCHRONIZED_IO = 0xe + SC_THREAD_ATTR_STACKADDR = 0x4d + SC_THREAD_ATTR_STACKSIZE = 0x4e + SC_THREAD_CPUTIME = 0x8b + SC_THREAD_PRIO_INHERIT = 0x50 + SC_THREAD_PRIO_PROTECT = 0x51 + SC_THREAD_PRIORITY_SCHEDULING = 0x4f + SC_THREAD_PROCESS_SHARED = 0x52 + SC_THREAD_ROBUST_PRIO_INHERIT = 0xf7 + SC_THREAD_ROBUST_PRIO_PROTECT = 0xf8 + SC_THREAD_SAFE_FUNCTIONS = 0x44 + SC_THREAD_SPORADIC_SERVER = 0xa1 + SC_THREADS = 0x43 + SC_TIMEOUTS = 0xa4 + SC_TIMERS = 0xb + SC_TRACE = 0xb5 + SC_TRACE_EVENT_FILTER = 0xb6 + SC_TRACE_EVENT_NAME_MAX = 0xf2 + SC_TRACE_INHERIT = 0xb7 + SC_TRACE_LOG = 0xb8 + SC_TRACE_NAME_MAX = 0xf3 + SC_TRACE_SYS_MAX = 0xf4 + SC_TRACE_USER_EVENT_MAX = 0xf5 + SC_TYPED_MEMORY_OBJECTS = 0xa5 + SC_VERSION = 0x1d + + SC_V7_ILP32_OFF32 = 0xed + SC_V7_ILP32_OFFBIG = 0xee + SC_V7_LP64_OFF64 = 0xef + SC_V7_LPBIG_OFFBIG = 0xf0 + + SC_V6_ILP32_OFF32 = 0xb0 + SC_V6_ILP32_OFFBIG = 0xb1 + SC_V6_LP64_OFF64 = 0xb2 + SC_V6_LPBIG_OFFBIG = 0xb3 + + SC_2_C_BIND = 0x2f + SC_2_C_DEV = 0x30 + SC_2_C_VERSION = 0x60 + SC_2_CHAR_TERM = 0x5f + SC_2_FORT_DEV = 0x31 + SC_2_FORT_RUN = 0x32 + SC_2_LOCALEDEF = 0x34 + SC_2_PBS = 0xa8 + SC_2_PBS_ACCOUNTING = 0xa9 + SC_2_PBS_CHECKPOINT = 0xaf + SC_2_PBS_LOCATE = 0xaa + SC_2_PBS_MESSAGE = 0xab + SC_2_PBS_TRACK = 0xac + SC_2_SW_DEV = 0x33 + SC_2_UPE = 0x61 + SC_2_VERSION = 0x2e + + SC_XOPEN_CRYPT = 0x5c + SC_XOPEN_ENH_I18N = 0x5d + SC_XOPEN_REALTIME = 0x82 + SC_XOPEN_REALTIME_THREADS = 0x83 + SC_XOPEN_SHM = 0x5e + SC_XOPEN_STREAMS = 0xf6 + SC_XOPEN_UNIX = 0x5b + SC_XOPEN_VERSION = 0x59 + SC_XOPEN_XCU_VERSION = 0x5a + + SC_PHYS_PAGES = 0x55 + SC_AVPHYS_PAGES = 0x56 + SC_NPROCESSORS_CONF = 0x53 + SC_NPROCESSORS_ONLN = 0x54 + SC_UIO_MAXIOV = 0x3c +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go new file mode 100644 index 00000000..d2aaf077 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go @@ -0,0 +1,164 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_netbsd.go + +//go:build netbsd +// +build netbsd + +package sysconf + +const ( + SC_ARG_MAX = 0x1 + SC_CHILD_MAX = 0x2 + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_JOB_CONTROL = 0x6 + SC_SAVED_IDS = 0x7 + SC_VERSION = 0x8 + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_COLL_WEIGHTS_MAX = 0xd + SC_EXPR_NEST_MAX = 0xe + SC_LINE_MAX = 0xf + SC_RE_DUP_MAX = 0x10 + SC_2_VERSION = 0x11 + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_STREAM_MAX = 0x1a + SC_TZNAME_MAX = 0x1b + SC_PAGESIZE = 0x1c + SC_PAGE_SIZE = 0x1c + SC_FSYNC = 0x1d + SC_XOPEN_SHM = 0x1e + SC_SYNCHRONIZED_IO = 0x1f + SC_IOV_MAX = 0x20 + SC_MAPPED_FILES = 0x21 + SC_MEMLOCK = 0x22 + SC_MEMLOCK_RANGE = 0x23 + SC_MEMORY_PROTECTION = 0x24 + SC_LOGIN_NAME_MAX = 0x25 + SC_MONOTONIC_CLOCK = 0x26 + SC_CLK_TCK = 0x27 + SC_ATEXIT_MAX = 0x28 + SC_THREADS = 0x29 + SC_SEMAPHORES = 0x2a + SC_BARRIERS = 0x2b + SC_TIMERS = 0x2c + SC_SPIN_LOCKS = 0x2d + SC_READER_WRITER_LOCKS = 0x2e + SC_GETGR_R_SIZE_MAX = 0x2f + SC_GETPW_R_SIZE_MAX = 0x30 + SC_CLOCK_SELECTION = 0x31 + SC_ASYNCHRONOUS_IO = 0x32 + SC_AIO_LISTIO_MAX = 0x33 + SC_AIO_MAX = 0x34 + SC_MESSAGE_PASSING = 0x35 + SC_MQ_OPEN_MAX = 0x36 + SC_MQ_PRIO_MAX = 0x37 + SC_PRIORITY_SCHEDULING = 0x38 + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x39 + SC_THREAD_KEYS_MAX = 0x3a + SC_THREAD_STACK_MIN = 0x3b + SC_THREAD_THREADS_MAX = 0x3c + SC_THREAD_ATTR_STACKADDR = 0x3d + SC_THREAD_ATTR_STACKSIZE = 0x3e + SC_THREAD_PRIORITY_SCHEDULING = 0x3f + SC_THREAD_PRIO_INHERIT = 0x40 + SC_THREAD_PRIO_PROTECT = 0x41 + SC_THREAD_PROCESS_SHARED = 0x42 + SC_THREAD_SAFE_FUNCTIONS = 0x43 + SC_TTY_NAME_MAX = 0x44 + SC_HOST_NAME_MAX = 0x45 + SC_PASS_MAX = 0x46 + SC_REGEXP = 0x47 + SC_SHELL = 0x48 + SC_SYMLOOP_MAX = 0x49 + + SC_V6_ILP32_OFF32 = 0x4a + SC_V6_ILP32_OFFBIG = 0x4b + SC_V6_LP64_OFF64 = 0x4c + SC_V6_LPBIG_OFFBIG = 0x4d + SC_2_PBS = 0x50 + SC_2_PBS_ACCOUNTING = 0x51 + SC_2_PBS_CHECKPOINT = 0x52 + SC_2_PBS_LOCATE = 0x53 + SC_2_PBS_MESSAGE = 0x54 + SC_2_PBS_TRACK = 0x55 + + SC_SPAWN = 0x56 + SC_SHARED_MEMORY_OBJECTS = 0x57 + + SC_TIMER_MAX = 0x58 + SC_SEM_NSEMS_MAX = 0x59 + SC_CPUTIME = 0x5a + SC_THREAD_CPUTIME = 0x5b + SC_DELAYTIMER_MAX = 0x5c + SC_SIGQUEUE_MAX = 0x5d + SC_REALTIME_SIGNALS = 0x5e + + SC_PHYS_PAGES = 0x79 + + SC_NPROCESSORS_CONF = 0x3e9 + SC_NPROCESSORS_ONLN = 0x3ea + + SC_SCHED_RT_TS = 0x7d1 + SC_SCHED_PRI_MIN = 0x7d2 + SC_SCHED_PRI_MAX = 0x7d3 +) + +const ( + _MAXHOSTNAMELEN = 0x100 + _MAXLOGNAME = 0x10 + _MAXSYMLINKS = 0x20 + + _POSIX_ARG_MAX = 0x1000 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CPUTIME = 0x30db0 + _POSIX_DELAYTIMER_MAX = 0x20 + _POSIX_PRIORITY_SCHEDULING = 0x30db0 + _POSIX_REGEXP = 0x1 + _POSIX_SHARED_MEMORY_OBJECTS = 0x0 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x30db0 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_PROTECT = 0x30db0 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_TIMER_MAX = 0x20 + _POSIX_VERSION = 0x30db0 + + _POSIX2_VERSION = 0x30db0 + + _FOPEN_MAX = 0x14 + _NAME_MAX = 0x1ff + _RE_DUP_MAX = 0xff + + _BC_BASE_MAX = 0x7fffffff + _BC_DIM_MAX = 0xffff + _BC_SCALE_MAX = 0x7fffffff + _BC_STRING_MAX = 0x7fffffff + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + + _GETGR_R_SIZE_MAX = 0x400 + _GETPW_R_SIZE_MAX = 0x400 + + _PATH_DEV = "/dev/" + _PATH_ZONEINFO = "/usr/share/zoneinfo" + + _PASSWORD_LEN = 0x80 +) + +const _PC_NAME_MAX = 0x4 diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go new file mode 100644 index 00000000..badc66cb --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go @@ -0,0 +1,263 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_openbsd.go + +//go:build openbsd +// +build openbsd + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x2a + SC_AIO_MAX = 0x2b + SC_AIO_PRIO_DELTA_MAX = 0x2c + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x2e + SC_BC_BASE_MAX = 0x9 + SC_BC_DIM_MAX = 0xa + SC_BC_SCALE_MAX = 0xb + SC_BC_STRING_MAX = 0xc + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0xd + SC_DELAYTIMER_MAX = 0x32 + SC_EXPR_NEST_MAX = 0xe + SC_GETGR_R_SIZE_MAX = 0x64 + SC_GETPW_R_SIZE_MAX = 0x65 + SC_HOST_NAME_MAX = 0x21 + SC_IOV_MAX = 0x33 + SC_LINE_MAX = 0xf + SC_LOGIN_NAME_MAX = 0x66 + SC_MQ_OPEN_MAX = 0x3a + SC_MQ_PRIO_MAX = 0x3b + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0x1c + SC_PAGESIZE = 0x1c + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x50 + SC_THREAD_KEYS_MAX = 0x51 + SC_THREAD_STACK_MIN = 0x59 + SC_THREAD_THREADS_MAX = 0x5a + SC_RE_DUP_MAX = 0x10 + SC_SEM_NSEMS_MAX = 0x1f + SC_SEM_VALUE_MAX = 0x20 + SC_SIGQUEUE_MAX = 0x46 + SC_STREAM_MAX = 0x1a + SC_SYMLOOP_MAX = 0x4c + SC_TIMER_MAX = 0x5d + SC_TTY_NAME_MAX = 0x6b + SC_TZNAME_MAX = 0x1b + + SC_ADVISORY_INFO = 0x29 + SC_ASYNCHRONOUS_IO = 0x2d + SC_BARRIERS = 0x2f + SC_CLOCK_SELECTION = 0x30 + SC_CPUTIME = 0x31 + SC_FSYNC = 0x1d + SC_IPV6 = 0x34 + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x35 + SC_MEMLOCK = 0x36 + SC_MEMLOCK_RANGE = 0x37 + SC_MEMORY_PROTECTION = 0x38 + SC_MESSAGE_PASSING = 0x39 + SC_MONOTONIC_CLOCK = 0x22 + SC_PRIORITIZED_IO = 0x3c + SC_PRIORITY_SCHEDULING = 0x3d + SC_RAW_SOCKETS = 0x3e + SC_READER_WRITER_LOCKS = 0x3f + SC_REALTIME_SIGNALS = 0x40 + SC_REGEXP = 0x41 + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x43 + SC_SHARED_MEMORY_OBJECTS = 0x44 + SC_SHELL = 0x45 + SC_SPAWN = 0x47 + SC_SPIN_LOCKS = 0x48 + SC_SPORADIC_SERVER = 0x49 + SC_SS_REPL_MAX = 0x4a + SC_SYNCHRONIZED_IO = 0x4b + SC_THREAD_ATTR_STACKADDR = 0x4d + SC_THREAD_ATTR_STACKSIZE = 0x4e + SC_THREAD_CPUTIME = 0x4f + SC_THREAD_PRIO_INHERIT = 0x52 + SC_THREAD_PRIO_PROTECT = 0x53 + SC_THREAD_PRIORITY_SCHEDULING = 0x54 + SC_THREAD_PROCESS_SHARED = 0x55 + SC_THREAD_ROBUST_PRIO_INHERIT = 0x56 + SC_THREAD_ROBUST_PRIO_PROTECT = 0x57 + SC_THREAD_SAFE_FUNCTIONS = 0x67 + SC_THREAD_SPORADIC_SERVER = 0x58 + SC_THREADS = 0x5b + SC_TIMEOUTS = 0x5c + SC_TIMERS = 0x5e + SC_TRACE = 0x5f + SC_TRACE_EVENT_FILTER = 0x60 + SC_TRACE_EVENT_NAME_MAX = 0x61 + SC_TRACE_INHERIT = 0x62 + SC_TRACE_LOG = 0x63 + SC_TRACE_NAME_MAX = 0x68 + SC_TRACE_SYS_MAX = 0x69 + SC_TRACE_USER_EVENT_MAX = 0x6a + SC_TYPED_MEMORY_OBJECTS = 0x6c + SC_VERSION = 0x8 + + SC_V7_ILP32_OFF32 = 0x71 + SC_V7_ILP32_OFFBIG = 0x72 + SC_V7_LP64_OFF64 = 0x73 + SC_V7_LPBIG_OFFBIG = 0x74 + + SC_V6_ILP32_OFF32 = 0x6d + SC_V6_ILP32_OFFBIG = 0x6e + SC_V6_LP64_OFF64 = 0x6f + SC_V6_LPBIG_OFFBIG = 0x70 + + SC_2_C_BIND = 0x12 + SC_2_C_DEV = 0x13 + SC_2_CHAR_TERM = 0x14 + SC_2_FORT_DEV = 0x15 + SC_2_FORT_RUN = 0x16 + SC_2_LOCALEDEF = 0x17 + SC_2_PBS = 0x23 + SC_2_PBS_ACCOUNTING = 0x24 + SC_2_PBS_CHECKPOINT = 0x25 + SC_2_PBS_LOCATE = 0x26 + SC_2_PBS_MESSAGE = 0x27 + SC_2_PBS_TRACK = 0x28 + SC_2_SW_DEV = 0x18 + SC_2_UPE = 0x19 + SC_2_VERSION = 0x11 + + SC_XOPEN_CRYPT = 0x75 + SC_XOPEN_ENH_I18N = 0x76 + SC_XOPEN_REALTIME = 0x78 + SC_XOPEN_REALTIME_THREADS = 0x79 + SC_XOPEN_SHM = 0x1e + SC_XOPEN_STREAMS = 0x7a + SC_XOPEN_UNIX = 0x7b + SC_XOPEN_UUCP = 0x7c + SC_XOPEN_VERSION = 0x7d + + SC_AVPHYS_PAGES = 0x1f5 + SC_PHYS_PAGES = 0x1f4 + SC_NPROCESSORS_CONF = 0x1f6 + SC_NPROCESSORS_ONLN = 0x1f7 +) + +const ( + _HOST_NAME_MAX = 0xff + _IOV_MAX = 0x400 + _LOGIN_NAME_MAX = 0x20 + _PTHREAD_DESTRUCTOR_ITERATIONS = 0x4 + _PTHREAD_KEYS_MAX = 0x100 + _PTHREAD_STACK_MIN = 0x1000 + _PTHREAD_THREADS_MAX = 0xffffffffffffffff + _SEM_VALUE_MAX = 0xffffffff + _SYMLOOP_MAX = 0x20 + _TTY_NAME_MAX = 0x104 + + _GR_BUF_LEN = 0xa40 + _PW_BUF_LEN = 0x400 + + _CLK_TCK = 0x64 + + _POSIX_ADVISORY_INFO = -0x1 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = -0x1 + _POSIX_BARRIERS = 0x30db0 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = -0x1 + _POSIX_CPUTIME = 0x31069 + _POSIX_FSYNC = 0x30db0 + _POSIX_IPV6 = 0x0 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x30db0 + _POSIX_MEMLOCK = 0x30db0 + _POSIX_MEMLOCK_RANGE = 0x30db0 + _POSIX_MEMORY_PROTECTION = 0x30db0 + _POSIX_MESSAGE_PASSING = -0x1 + _POSIX_MONOTONIC_CLOCK = 0x30db0 + _POSIX_PRIORITIZED_IO = -0x1 + _POSIX_PRIORITY_SCHEDULING = -0x1 + _POSIX_RAW_SOCKETS = 0x30db0 + _POSIX_READER_WRITER_LOCKS = 0x30db0 + _POSIX_REALTIME_SIGNALS = -0x1 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x30db0 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SPAWN = 0x30db0 + _POSIX_SPIN_LOCKS = 0x30db0 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = -0x1 + _POSIX_THREAD_ATTR_STACKADDR = 0x30db0 + _POSIX_THREAD_ATTR_STACKSIZE = 0x30db0 + _POSIX_THREAD_CPUTIME = 0x31069 + _POSIX_THREAD_KEYS_MAX = 0x80 + _POSIX_THREAD_PRIO_INHERIT = -0x1 + _POSIX_THREAD_PRIO_PROTECT = -0x1 + _POSIX_THREAD_PRIORITY_SCHEDULING = -0x1 + _POSIX_THREAD_PROCESS_SHARED = -0x1 + _POSIX_THREAD_ROBUST_PRIO_INHERIT = -0x1 + _POSIX_THREAD_ROBUST_PRIO_PROTECT = -0x1 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x30db0 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x30db0 + _POSIX_TIMERS = -0x1 + _POSIX_TIMEOUTS = 0x30db0 + _POSIX_TRACE = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = 0x0 + _POSIX_V7_LP64_OFF64 = 0x0 + _POSIX_V7_LPBIG_OFFBIG = 0x0 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = 0x0 + _POSIX_V6_LP64_OFF64 = 0x0 + _POSIX_V6_LPBIG_OFFBIG = 0x0 + + _POSIX2_C_BIND = 0x30db0 + _POSIX2_C_DEV = -0x1 + _POSIX2_CHAR_TERM = 0x1 + _POSIX2_LOCALEDEF = -0x1 + _POSIX2_PBS = -0x1 + _POSIX2_SW_DEV = 0x30db0 + _POSIX2_UPE = 0x30db0 + _POSIX2_VERSION = 0x31069 + + _XOPEN_CRYPT = 0x1 + _XOPEN_ENH_I18N = -0x1 + _XOPEN_REALTIME = -0x1 + _XOPEN_REALTIME_THREADS = -0x1 + _XOPEN_SHM = 0x1 + _XOPEN_STREAMS = -0x1 + _XOPEN_UNIX = -0x1 + _XOPEN_UUCP = -0x1 + + _FOPEN_MAX = 0x14 + _NAME_MAX = 0xff + _RE_DUP_MAX = 0xff + + _BC_BASE_MAX = 0x7fffffff + _BC_DIM_MAX = 0xffff + _BC_SCALE_MAX = 0x7fffffff + _BC_STRING_MAX = 0x7fffffff + _COLL_WEIGHTS_MAX = 0x2 + _EXPR_NEST_MAX = 0x20 + _LINE_MAX = 0x800 + + _SHRT_MAX = 0x7fff + + _PATH_ZONEINFO = "/usr/share/zoneinfo" +) + +const ( + _CHAR_BIT = 0x8 + + _INT_MAX = 0x7fffffff + + sizeofOffT = 0x8 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go new file mode 100644 index 00000000..29b6f874 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go @@ -0,0 +1,139 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_defs_solaris.go + +//go:build solaris +// +build solaris + +package sysconf + +const ( + SC_AIO_LISTIO_MAX = 0x12 + SC_AIO_MAX = 0x13 + SC_AIO_PRIO_DELTA_MAX = 0x14 + SC_ARG_MAX = 0x1 + SC_ATEXIT_MAX = 0x4c + SC_BC_BASE_MAX = 0x36 + SC_BC_DIM_MAX = 0x37 + SC_BC_SCALE_MAX = 0x38 + SC_BC_STRING_MAX = 0x39 + SC_CHILD_MAX = 0x2 + SC_CLK_TCK = 0x3 + SC_COLL_WEIGHTS_MAX = 0x3a + SC_DELAYTIMER_MAX = 0x16 + SC_EXPR_NEST_MAX = 0x3b + SC_GETGR_R_SIZE_MAX = 0x239 + SC_GETPW_R_SIZE_MAX = 0x23a + SC_HOST_NAME_MAX = 0x2df + SC_IOV_MAX = 0x4d + SC_LINE_MAX = 0x3c + SC_LOGIN_NAME_MAX = 0x23b + SC_MQ_OPEN_MAX = 0x1d + SC_MQ_PRIO_MAX = 0x1e + SC_NGROUPS_MAX = 0x4 + SC_OPEN_MAX = 0x5 + SC_PAGE_SIZE = 0xb + SC_PAGESIZE = 0xb + SC_THREAD_DESTRUCTOR_ITERATIONS = 0x238 + SC_THREAD_KEYS_MAX = 0x23c + SC_THREAD_STACK_MIN = 0x23d + SC_THREAD_THREADS_MAX = 0x23e + SC_RE_DUP_MAX = 0x3d + SC_RTSIG_MAX = 0x22 + SC_SEM_NSEMS_MAX = 0x24 + SC_SEM_VALUE_MAX = 0x25 + SC_SIGQUEUE_MAX = 0x27 + SC_STREAM_MAX = 0x10 + SC_SYMLOOP_MAX = 0x2e8 + SC_TIMER_MAX = 0x2c + SC_TTY_NAME_MAX = 0x23f + SC_TZNAME_MAX = 0x11 + + SC_ADVISORY_INFO = 0x2db + SC_ASYNCHRONOUS_IO = 0x15 + SC_BARRIERS = 0x2dc + SC_CLOCK_SELECTION = 0x2dd + SC_CPUTIME = 0x2de + SC_FSYNC = 0x17 + SC_IPV6 = 0x2fa + SC_JOB_CONTROL = 0x6 + SC_MAPPED_FILES = 0x18 + SC_MEMLOCK = 0x19 + SC_MEMLOCK_RANGE = 0x1a + SC_MEMORY_PROTECTION = 0x1b + SC_MESSAGE_PASSING = 0x1c + SC_MONOTONIC_CLOCK = 0x2e0 + SC_PRIORITIZED_IO = 0x1f + SC_PRIORITY_SCHEDULING = 0x20 + SC_RAW_SOCKETS = 0x2fb + SC_READER_WRITER_LOCKS = 0x2e1 + SC_REALTIME_SIGNALS = 0x21 + SC_REGEXP = 0x2e2 + SC_SAVED_IDS = 0x7 + SC_SEMAPHORES = 0x23 + SC_SHARED_MEMORY_OBJECTS = 0x26 + SC_SHELL = 0x2e3 + SC_SPAWN = 0x2e4 + SC_SPIN_LOCKS = 0x2e5 + SC_SPORADIC_SERVER = 0x2e6 + SC_SS_REPL_MAX = 0x2e7 + SC_SYNCHRONIZED_IO = 0x2a + SC_THREAD_ATTR_STACKADDR = 0x241 + SC_THREAD_ATTR_STACKSIZE = 0x242 + SC_THREAD_CPUTIME = 0x2e9 + SC_THREAD_PRIO_INHERIT = 0x244 + SC_THREAD_PRIO_PROTECT = 0x245 + SC_THREAD_PRIORITY_SCHEDULING = 0x243 + SC_THREAD_PROCESS_SHARED = 0x246 + SC_THREAD_SAFE_FUNCTIONS = 0x247 + SC_THREAD_SPORADIC_SERVER = 0x2ea + SC_THREADS = 0x240 + SC_TIMEOUTS = 0x2eb + SC_TIMERS = 0x2b + SC_TRACE = 0x2ec + SC_TRACE_EVENT_FILTER = 0x2ed + SC_TRACE_EVENT_NAME_MAX = 0x2ee + SC_TRACE_INHERIT = 0x2ef + SC_TRACE_LOG = 0x2f0 + SC_TRACE_NAME_MAX = 0x2f1 + SC_TRACE_SYS_MAX = 0x2f2 + SC_TRACE_USER_EVENT_MAX = 0x2f3 + SC_TYPED_MEMORY_OBJECTS = 0x2f4 + SC_VERSION = 0x8 + + SC_V6_ILP32_OFF32 = 0x2f5 + SC_V6_ILP32_OFFBIG = 0x2f6 + SC_V6_LP64_OFF64 = 0x2f7 + SC_V6_LPBIG_OFFBIG = 0x2f8 + + SC_2_C_BIND = 0x2d + SC_2_C_DEV = 0x2e + SC_2_C_VERSION = 0x2f + SC_2_CHAR_TERM = 0x42 + SC_2_FORT_DEV = 0x30 + SC_2_FORT_RUN = 0x31 + SC_2_LOCALEDEF = 0x32 + SC_2_PBS = 0x2d4 + SC_2_PBS_ACCOUNTING = 0x2d5 + SC_2_PBS_CHECKPOINT = 0x2d6 + SC_2_PBS_LOCATE = 0x2d8 + SC_2_PBS_MESSAGE = 0x2d9 + SC_2_PBS_TRACK = 0x2da + SC_2_SW_DEV = 0x33 + SC_2_UPE = 0x34 + SC_2_VERSION = 0x35 + + SC_XOPEN_CRYPT = 0x3e + SC_XOPEN_ENH_I18N = 0x3f + SC_XOPEN_REALTIME = 0x2ce + SC_XOPEN_REALTIME_THREADS = 0x2cf + SC_XOPEN_SHM = 0x40 + SC_XOPEN_STREAMS = 0x2f9 + SC_XOPEN_UNIX = 0x4e + SC_XOPEN_VERSION = 0xc + SC_XOPEN_XCU_VERSION = 0x43 + + SC_PHYS_PAGES = 0x1f4 + SC_AVPHYS_PAGES = 0x1f5 + SC_NPROCESSORS_CONF = 0xe + SC_NPROCESSORS_ONLN = 0xf +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go new file mode 100644 index 00000000..478fe63a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go @@ -0,0 +1,12 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && 386 +// +build freebsd,386 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go new file mode 100644 index 00000000..7f58a4d8 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go @@ -0,0 +1,12 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && amd64 +// +build freebsd,amd64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go new file mode 100644 index 00000000..deb47595 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go @@ -0,0 +1,12 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && arm +// +build freebsd,arm + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go new file mode 100644 index 00000000..556ba3da --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go @@ -0,0 +1,12 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && arm64 +// +build freebsd,arm64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go new file mode 100644 index 00000000..b7cff760 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go @@ -0,0 +1,12 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_freebsd.go + +//go:build freebsd && riscv64 +// +build freebsd,riscv64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff + _SHRT_MAX = 0x7fff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go new file mode 100644 index 00000000..16ee7ea6 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && 386 +// +build linux,386 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go new file mode 100644 index 00000000..39aee349 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && amd64 +// +build linux,amd64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go new file mode 100644 index 00000000..2e401164 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && arm +// +build linux,arm + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go new file mode 100644 index 00000000..362403ab --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && arm64 +// +build linux,arm64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go new file mode 100644 index 00000000..95a71f4a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && loong64 +// +build linux,loong64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go new file mode 100644 index 00000000..868b0ffb --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips +// +build linux,mips + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go new file mode 100644 index 00000000..5949f3d7 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips64 +// +build linux,mips64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go new file mode 100644 index 00000000..1853419a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mips64le +// +build linux,mips64le + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go new file mode 100644 index 00000000..ff41b346 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && mipsle +// +build linux,mipsle + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = 0x1 + _POSIX_V7_ILP32_OFFBIG = 0x1 + _POSIX_V7_LP64_OFF64 = -0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = 0x1 + _POSIX_V6_ILP32_OFFBIG = 0x1 + _POSIX_V6_LP64_OFF64 = -0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go new file mode 100644 index 00000000..38874372 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && ppc64 +// +build linux,ppc64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go new file mode 100644 index 00000000..6d76929a --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && ppc64le +// +build linux,ppc64le + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x20000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go new file mode 100644 index 00000000..3d7d71b3 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && riscv64 +// +build linux,riscv64 + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go new file mode 100644 index 00000000..9cf8529f --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go @@ -0,0 +1,114 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_linux.go + +//go:build linux && s390x +// +build linux,s390x + +package sysconf + +const ( + _AIO_PRIO_DELTA_MAX = 0x14 + _BC_BASE_MAX = 0x63 + _BC_DIM_MAX = 0x800 + _BC_SCALE_MAX = 0x63 + _BC_STRING_MAX = 0x3e8 + _COLL_WEIGHTS_MAX = 0xff + _DELAYTIMER_MAX = 0x7fffffff + _EXPR_NEST_MAX = 0x20 + _HOST_NAME_MAX = 0x40 + _LINE_MAX = 0x800 + _LOGIN_NAME_MAX = 0x100 + _MQ_PRIO_MAX = 0x8000 + _NGROUPS_MAX = 0x10000 + _NSS_BUFLEN_GROUP = 0x400 + _NSS_BUFLEN_PASSWD = 0x400 + _OPEN_MAX = 0x100 + _PTHREAD_KEYS_MAX = 0x400 + _PTHREAD_STACK_MIN = 0x4000 + _RE_DUP_MAX = 0x7fff + _RTSIG_MAX = 0x20 + _SEM_VALUE_MAX = 0x7fffffff + _STREAM_MAX = 0x10 + _SYMLOOP_MAX = -0x1 + _TTY_NAME_MAX = 0x20 + + _UIO_MAXIOV = 0x400 + + _INT_MAX = 0x7fffffff + + _POSIX_ADVISORY_INFO = 0x31069 + _POSIX_ARG_MAX = 0x1000 + _POSIX_ASYNCHRONOUS_IO = 0x31069 + _POSIX_BARRIERS = 0x31069 + _POSIX_CHILD_MAX = 0x19 + _POSIX_CLOCK_SELECTION = 0x31069 + _POSIX_CPUTIME = 0x0 + _POSIX_FSYNC = 0x31069 + _POSIX_IPV6 = 0x31069 + _POSIX_JOB_CONTROL = 0x1 + _POSIX_MAPPED_FILES = 0x31069 + _POSIX_MEMLOCK = 0x31069 + _POSIX_MEMLOCK_RANGE = 0x31069 + _POSIX_MEMORY_PROTECTION = 0x31069 + _POSIX_MESSAGE_PASSING = 0x31069 + _POSIX_MONOTONIC_CLOCK = 0x0 + _POSIX_PRIORITIZED_IO = 0x31069 + _POSIX_PRIORITY_SCHEDULING = 0x31069 + _POSIX_RAW_SOCKETS = 0x31069 + _POSIX_READER_WRITER_LOCKS = 0x31069 + _POSIX_REALTIME_SIGNALS = 0x31069 + _POSIX_REGEXP = 0x1 + _POSIX_SAVED_IDS = 0x1 + _POSIX_SEMAPHORES = 0x31069 + _POSIX_SHARED_MEMORY_OBJECTS = 0x31069 + _POSIX_SHELL = 0x1 + _POSIX_SIGQUEUE_MAX = 0x20 + _POSIX_SPAWN = 0x31069 + _POSIX_SPIN_LOCKS = 0x31069 + _POSIX_SPORADIC_SERVER = -0x1 + _POSIX_SYNCHRONIZED_IO = 0x31069 + _POSIX_THREAD_ATTR_STACKADDR = 0x31069 + _POSIX_THREAD_ATTR_STACKSIZE = 0x31069 + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 0x4 + _POSIX_THREAD_PRIO_INHERIT = 0x31069 + _POSIX_THREAD_PRIO_PROTECT = 0x31069 + _POSIX_THREAD_PRIORITY_SCHEDULING = 0x31069 + _POSIX_THREAD_PROCESS_SHARED = 0x31069 + _POSIX_THREAD_SAFE_FUNCTIONS = 0x31069 + _POSIX_THREAD_SPORADIC_SERVER = -0x1 + _POSIX_THREADS = 0x31069 + _POSIX_TIMEOUTS = 0x31069 + _POSIX_TIMERS = 0x31069 + _POSIX_TRACE = -0x1 + _POSIX_TRACE_EVENT_FILTER = -0x1 + _POSIX_TRACE_INHERIT = -0x1 + _POSIX_TRACE_LOG = -0x1 + _POSIX_TYPED_MEMORY_OBJECTS = -0x1 + _POSIX_VERSION = 0x31069 + + _POSIX_V7_ILP32_OFF32 = -0x1 + _POSIX_V7_ILP32_OFFBIG = -0x1 + _POSIX_V7_LP64_OFF64 = 0x1 + _POSIX_V7_LPBIG_OFFBIG = -0x1 + + _POSIX_V6_ILP32_OFF32 = -0x1 + _POSIX_V6_ILP32_OFFBIG = -0x1 + _POSIX_V6_LP64_OFF64 = 0x1 + _POSIX_V6_LPBIG_OFFBIG = -0x1 + + _POSIX2_C_BIND = 0x31069 + _POSIX2_C_DEV = 0x31069 + _POSIX2_C_VERSION = 0x31069 + _POSIX2_CHAR_TERM = 0x31069 + _POSIX2_LOCALEDEF = 0x31069 + _POSIX2_SW_DEV = 0x31069 + _POSIX2_VERSION = 0x31069 + + _XOPEN_ENH_I18N = 0x1 + _XOPEN_REALTIME = 0x1 + _XOPEN_REALTIME_THREADS = 0x1 + _XOPEN_SHM = 0x1 + _XOPEN_UNIX = 0x1 + _XOPEN_VERSION = 0x2bc + _XOPEN_XCU_VERSION = 0x4 +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go new file mode 100644 index 00000000..3cd64dd6 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && 386 +// +build netbsd,386 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go new file mode 100644 index 00000000..02fc1d0e --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && amd64 +// +build netbsd,amd64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go new file mode 100644 index 00000000..16f9b6e7 --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && arm +// +build netbsd,arm + +package sysconf + +const ( + _LONG_MAX = 0x7fffffff +) diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go new file mode 100644 index 00000000..e530339c --- /dev/null +++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go @@ -0,0 +1,11 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs sysconf_values_netbsd.go + +//go:build netbsd && arm64 +// +build netbsd,arm64 + +package sysconf + +const ( + _LONG_MAX = 0x7fffffffffffffff +) diff --git a/vendor/github.com/tklauser/numcpus/.cirrus.yml b/vendor/github.com/tklauser/numcpus/.cirrus.yml new file mode 100644 index 00000000..69c6ced5 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/.cirrus.yml @@ -0,0 +1,13 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + GO_VERSION: go1.20 + +freebsd_12_task: + freebsd_instance: + image_family: freebsd-12-3 + install_script: | + pkg install -y go + GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest + bin/${GO_VERSION} download + build_script: bin/${GO_VERSION} build -buildvcs=false -v ./... + test_script: bin/${GO_VERSION} test -buildvcs=false -race ./... diff --git a/vendor/github.com/tklauser/numcpus/LICENSE b/vendor/github.com/tklauser/numcpus/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/tklauser/numcpus/README.md b/vendor/github.com/tklauser/numcpus/README.md new file mode 100644 index 00000000..23612c54 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/README.md @@ -0,0 +1,52 @@ +# numcpus + +[![Go Reference](https://pkg.go.dev/badge/github.com/tklauser/numcpus.svg)](https://pkg.go.dev/github.com/tklauser/numcpus) +[![GitHub Action Status](https://github.com/tklauser/numcpus/workflows/Tests/badge.svg)](https://github.com/tklauser/numcpus/actions?query=workflow%3ATests) + +Package numcpus provides information about the number of CPUs in the system. + +It gets the number of CPUs (online, offline, present, possible, configured or +kernel maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD or +Solaris/Illumos systems. + +On Linux, the information is retrieved by reading the corresponding CPU +topology files in `/sys/devices/system/cpu`. + +On BSD systems, the information is retrieved using the `hw.ncpu` and +`hw.ncpuonline` sysctls, if supported. + +Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, +DragonflyBSD and Solaris/Illumos. ErrNotSupported is returned in case a +function is not supported on a particular platform. + +## Usage + +```Go +package main + +import ( + "fmt" + "os" + + "github.com/tklauser/numcpus" +) + +func main() { + online, err := numcpus.GetOnline() + if err != nil { + fmt.Fprintf(os.Stderr, "GetOnline: %v\n", err) + } + fmt.Printf("online CPUs: %v\n", online) + + possible, err := numcpus.GetPossible() + if err != nil { + fmt.Fprintf(os.Stderr, "GetPossible: %v\n", err) + } + fmt.Printf("possible CPUs: %v\n", possible) +} +``` + +## References + +* [Linux kernel sysfs documentation for CPU attributes](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu) +* [Linux kernel CPU topology documentation](https://www.kernel.org/doc/Documentation/cputopology.txt) diff --git a/vendor/github.com/tklauser/numcpus/numcpus.go b/vendor/github.com/tklauser/numcpus/numcpus.go new file mode 100644 index 00000000..af59983e --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus.go @@ -0,0 +1,75 @@ +// Copyright 2018-2022 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package numcpus provides information about the number of CPUs in the system. +// +// It gets the number of CPUs (online, offline, present, possible or kernel +// maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, +// Solaris/Illumos or Windows systems. +// +// On Linux, the information is retrieved by reading the corresponding CPU +// topology files in /sys/devices/system/cpu. +// +// On BSD systems, the information is retrieved using the hw.ncpu and +// hw.ncpuonline sysctls, if supported. +// +// On Windows systems, the information is retrieved using the +// GetActiveProcessorCount and GetMaximumProcessorCount functions, respectively. +// +// Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, +// DragonflyBSD, Solaris/Illumos and Windows. ErrNotSupported is returned in +// case a function is not supported on a particular platform. +package numcpus + +import "errors" + +// ErrNotSupported is the error returned when the function is not supported. +var ErrNotSupported = errors.New("function not supported") + +// GetConfigured returns the number of CPUs configured on the system. This +// function should return the same value as `getconf _SC_NPROCESSORS_CONF` on a +// unix system. +func GetConfigured() (int, error) { + return getConfigured() +} + +// GetKernelMax returns the maximum number of CPUs allowed by the kernel +// configuration. This function is only supported on Linux and Windows systems. +func GetKernelMax() (int, error) { + return getKernelMax() +} + +// GetOffline returns the number of offline CPUs, i.e. CPUs that are not online +// because they have been hotplugged off or exceed the limit of CPUs allowed by +// the kernel configuration (see GetKernelMax). This function is only supported +// on Linux systems. +func GetOffline() (int, error) { + return getOffline() +} + +// GetOnline returns the number of CPUs that are online and being scheduled. +func GetOnline() (int, error) { + return getOnline() +} + +// GetPossible returns the number of possible CPUs, i.e. CPUs that +// have been allocated resources and can be brought online if they are present. +func GetPossible() (int, error) { + return getPossible() +} + +// GetPresent returns the number of CPUs present in the system. +func GetPresent() (int, error) { + return getPresent() +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_bsd.go b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go new file mode 100644 index 00000000..9e77e38e --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go @@ -0,0 +1,66 @@ +// Copyright 2018 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build darwin || dragonfly || freebsd || netbsd || openbsd +// +build darwin dragonfly freebsd netbsd openbsd + +package numcpus + +import ( + "runtime" + + "golang.org/x/sys/unix" +) + +func getConfigured() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} + +func getKernelMax() (int, error) { + if runtime.GOOS == "freebsd" { + n, err := unix.SysctlUint32("kern.smp.maxcpus") + return int(n), err + } + return 0, ErrNotSupported +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + var n uint32 + var err error + switch runtime.GOOS { + case "netbsd", "openbsd": + n, err = unix.SysctlUint32("hw.ncpuonline") + if err != nil { + n, err = unix.SysctlUint32("hw.ncpu") + } + default: + n, err = unix.SysctlUint32("hw.ncpu") + } + return int(n), err +} + +func getPossible() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} + +func getPresent() (int, error) { + n, err := unix.SysctlUint32("hw.ncpu") + return int(n), err +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_linux.go b/vendor/github.com/tklauser/numcpus/numcpus_linux.go new file mode 100644 index 00000000..1a30525b --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_linux.go @@ -0,0 +1,120 @@ +// Copyright 2018 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package numcpus + +import ( + "io/ioutil" + "os" + "path/filepath" + "strconv" + "strings" + + "golang.org/x/sys/unix" +) + +const sysfsCPUBasePath = "/sys/devices/system/cpu" + +func getFromCPUAffinity() (int, error) { + var cpuSet unix.CPUSet + if err := unix.SchedGetaffinity(0, &cpuSet); err != nil { + return 0, err + } + return cpuSet.Count(), nil +} + +func readCPURange(file string) (int, error) { + buf, err := ioutil.ReadFile(filepath.Join(sysfsCPUBasePath, file)) + if err != nil { + return 0, err + } + return parseCPURange(strings.Trim(string(buf), "\n ")) +} + +func parseCPURange(cpus string) (int, error) { + n := int(0) + for _, cpuRange := range strings.Split(cpus, ",") { + if len(cpuRange) == 0 { + continue + } + rangeOp := strings.SplitN(cpuRange, "-", 2) + first, err := strconv.ParseUint(rangeOp[0], 10, 32) + if err != nil { + return 0, err + } + if len(rangeOp) == 1 { + n++ + continue + } + last, err := strconv.ParseUint(rangeOp[1], 10, 32) + if err != nil { + return 0, err + } + n += int(last - first + 1) + } + return n, nil +} + +func getConfigured() (int, error) { + d, err := os.Open(sysfsCPUBasePath) + if err != nil { + return 0, err + } + defer d.Close() + fis, err := d.Readdir(-1) + if err != nil { + return 0, err + } + count := 0 + for _, fi := range fis { + if name := fi.Name(); fi.IsDir() && strings.HasPrefix(name, "cpu") { + _, err := strconv.ParseInt(name[3:], 10, 64) + if err == nil { + count++ + } + } + } + return count, nil +} + +func getKernelMax() (int, error) { + buf, err := ioutil.ReadFile(filepath.Join(sysfsCPUBasePath, "kernel_max")) + if err != nil { + return 0, err + } + n, err := strconv.ParseInt(strings.Trim(string(buf), "\n "), 10, 32) + if err != nil { + return 0, err + } + return int(n), nil +} + +func getOffline() (int, error) { + return readCPURange("offline") +} + +func getOnline() (int, error) { + if n, err := getFromCPUAffinity(); err == nil { + return n, nil + } + return readCPURange("online") +} + +func getPossible() (int, error) { + return readCPURange("possible") +} + +func getPresent() (int, error) { + return readCPURange("present") +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_solaris.go b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go new file mode 100644 index 00000000..a2643237 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go @@ -0,0 +1,56 @@ +// Copyright 2021 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build solaris +// +build solaris + +package numcpus + +import "golang.org/x/sys/unix" + +// taken from /usr/include/sys/unistd.h +const ( + _SC_NPROCESSORS_CONF = 14 + _SC_NPROCESSORS_ONLN = 15 + _SC_NPROCESSORS_MAX = 516 +) + +func getConfigured() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} + +func getKernelMax() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_MAX) + return int(n), err +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_ONLN) + return int(n), err +} + +func getPossible() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} + +func getPresent() (int, error) { + n, err := unix.Sysconf(_SC_NPROCESSORS_CONF) + return int(n), err +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go new file mode 100644 index 00000000..4a0b7c43 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go @@ -0,0 +1,42 @@ +// Copyright 2021 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows +// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows + +package numcpus + +func getConfigured() (int, error) { + return 0, ErrNotSupported +} + +func getKernelMax() (int, error) { + return 0, ErrNotSupported +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + return 0, ErrNotSupported +} + +func getPossible() (int, error) { + return 0, ErrNotSupported +} + +func getPresent() (int, error) { + return 0, ErrNotSupported +} diff --git a/vendor/github.com/tklauser/numcpus/numcpus_windows.go b/vendor/github.com/tklauser/numcpus/numcpus_windows.go new file mode 100644 index 00000000..f7d5b402 --- /dev/null +++ b/vendor/github.com/tklauser/numcpus/numcpus_windows.go @@ -0,0 +1,41 @@ +// Copyright 2022 Tobias Klauser +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package numcpus + +import "golang.org/x/sys/windows" + +func getConfigured() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getKernelMax() (int, error) { + return int(windows.GetMaximumProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getOffline() (int, error) { + return 0, ErrNotSupported +} + +func getOnline() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getPossible() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} + +func getPresent() (int, error) { + return int(windows.GetActiveProcessorCount(windows.ALL_PROCESSOR_GROUPS)), nil +} diff --git a/vendor/github.com/yusufpapurcu/wmi/LICENSE b/vendor/github.com/yusufpapurcu/wmi/LICENSE new file mode 100644 index 00000000..ae80b672 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Stack Exchange + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/yusufpapurcu/wmi/README.md b/vendor/github.com/yusufpapurcu/wmi/README.md new file mode 100644 index 00000000..426d1a46 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/README.md @@ -0,0 +1,6 @@ +wmi +=== + +Package wmi provides a WQL interface to Windows WMI. + +Note: It interfaces with WMI on the local machine, therefore it only runs on Windows. diff --git a/vendor/github.com/yusufpapurcu/wmi/swbemservices.go b/vendor/github.com/yusufpapurcu/wmi/swbemservices.go new file mode 100644 index 00000000..a250c846 --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/swbemservices.go @@ -0,0 +1,261 @@ +//go:build windows +// +build windows + +package wmi + +import ( + "fmt" + "reflect" + "runtime" + "sync" + + "github.com/go-ole/go-ole" + "github.com/go-ole/go-ole/oleutil" +) + +// SWbemServices is used to access wmi. See https://msdn.microsoft.com/en-us/library/aa393719(v=vs.85).aspx +type SWbemServices struct { + //TODO: track namespace. Not sure if we can re connect to a different namespace using the same instance + cWMIClient *Client //This could also be an embedded struct, but then we would need to branch on Client vs SWbemServices in the Query method + sWbemLocatorIUnknown *ole.IUnknown + sWbemLocatorIDispatch *ole.IDispatch + queries chan *queryRequest + closeError chan error + lQueryorClose sync.Mutex +} + +type queryRequest struct { + query string + dst interface{} + args []interface{} + finished chan error +} + +// InitializeSWbemServices will return a new SWbemServices object that can be used to query WMI +func InitializeSWbemServices(c *Client, connectServerArgs ...interface{}) (*SWbemServices, error) { + //fmt.Println("InitializeSWbemServices: Starting") + //TODO: implement connectServerArgs as optional argument for init with connectServer call + s := new(SWbemServices) + s.cWMIClient = c + s.queries = make(chan *queryRequest) + initError := make(chan error) + go s.process(initError) + + err, ok := <-initError + if ok { + return nil, err //Send error to caller + } + //fmt.Println("InitializeSWbemServices: Finished") + return s, nil +} + +// Close will clear and release all of the SWbemServices resources +func (s *SWbemServices) Close() error { + s.lQueryorClose.Lock() + if s == nil || s.sWbemLocatorIDispatch == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices is not Initialized") + } + if s.queries == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices has been closed") + } + //fmt.Println("Close: sending close request") + var result error + ce := make(chan error) + s.closeError = ce //Race condition if multiple callers to close. May need to lock here + close(s.queries) //Tell background to shut things down + s.lQueryorClose.Unlock() + err, ok := <-ce + if ok { + result = err + } + //fmt.Println("Close: finished") + return result +} + +func (s *SWbemServices) process(initError chan error) { + //fmt.Println("process: starting background thread initialization") + //All OLE/WMI calls must happen on the same initialized thead, so lock this goroutine + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + err := ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED) + if err != nil { + oleCode := err.(*ole.OleError).Code() + if oleCode != ole.S_OK && oleCode != S_FALSE { + initError <- fmt.Errorf("ole.CoInitializeEx error: %v", err) + return + } + } + defer ole.CoUninitialize() + + unknown, err := oleutil.CreateObject("WbemScripting.SWbemLocator") + if err != nil { + initError <- fmt.Errorf("CreateObject SWbemLocator error: %v", err) + return + } else if unknown == nil { + initError <- ErrNilCreateObject + return + } + defer unknown.Release() + s.sWbemLocatorIUnknown = unknown + + dispatch, err := s.sWbemLocatorIUnknown.QueryInterface(ole.IID_IDispatch) + if err != nil { + initError <- fmt.Errorf("SWbemLocator QueryInterface error: %v", err) + return + } + defer dispatch.Release() + s.sWbemLocatorIDispatch = dispatch + + // we can't do the ConnectServer call outside the loop unless we find a way to track and re-init the connectServerArgs + //fmt.Println("process: initialized. closing initError") + close(initError) + //fmt.Println("process: waiting for queries") + for q := range s.queries { + //fmt.Printf("process: new query: len(query)=%d\n", len(q.query)) + errQuery := s.queryBackground(q) + //fmt.Println("process: s.queryBackground finished") + if errQuery != nil { + q.finished <- errQuery + } + close(q.finished) + } + //fmt.Println("process: queries channel closed") + s.queries = nil //set channel to nil so we know it is closed + //TODO: I think the Release/Clear calls can panic if things are in a bad state. + //TODO: May need to recover from panics and send error to method caller instead. + close(s.closeError) +} + +// Query runs the WQL query using a SWbemServices instance and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// http://msdn.microsoft.com/en-us/library/aa393720.aspx for details. +func (s *SWbemServices) Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + s.lQueryorClose.Lock() + if s == nil || s.sWbemLocatorIDispatch == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices is not Initialized") + } + if s.queries == nil { + s.lQueryorClose.Unlock() + return fmt.Errorf("SWbemServices has been closed") + } + + //fmt.Println("Query: Sending query request") + qr := queryRequest{ + query: query, + dst: dst, + args: connectServerArgs, + finished: make(chan error), + } + s.queries <- &qr + s.lQueryorClose.Unlock() + err, ok := <-qr.finished + if ok { + //fmt.Println("Query: Finished with error") + return err //Send error to caller + } + //fmt.Println("Query: Finished") + return nil +} + +func (s *SWbemServices) queryBackground(q *queryRequest) error { + if s == nil || s.sWbemLocatorIDispatch == nil { + return fmt.Errorf("SWbemServices is not Initialized") + } + wmi := s.sWbemLocatorIDispatch //Should just rename in the code, but this will help as we break things apart + //fmt.Println("queryBackground: Starting") + + dv := reflect.ValueOf(q.dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType := checkMultiArg(dv) + if mat == multiArgTypeInvalid { + return ErrInvalidEntityType + } + + // service is a SWbemServices + serviceRaw, err := oleutil.CallMethod(wmi, "ConnectServer", q.args...) + if err != nil { + return err + } + service := serviceRaw.ToIDispatch() + defer serviceRaw.Clear() + + // result is a SWBemObjectSet + resultRaw, err := oleutil.CallMethod(service, "ExecQuery", q.query) + if err != nil { + return err + } + result := resultRaw.ToIDispatch() + defer resultRaw.Clear() + + count, err := oleInt64(result, "Count") + if err != nil { + return err + } + + enumProperty, err := result.GetProperty("_NewEnum") + if err != nil { + return err + } + defer enumProperty.Clear() + + enum, err := enumProperty.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + if enum == nil { + return fmt.Errorf("can't get IEnumVARIANT, enum is nil") + } + defer enum.Release() + + // Initialize a slice with Count capacity + dv.Set(reflect.MakeSlice(dv.Type(), 0, int(count))) + + var errFieldMismatch error + for itemRaw, length, err := enum.Next(1); length > 0; itemRaw, length, err = enum.Next(1) { + if err != nil { + return err + } + + err := func() error { + // item is a SWbemObject, but really a Win32_Process + item := itemRaw.ToIDispatch() + defer item.Release() + + ev := reflect.New(elemType) + if err = s.cWMIClient.loadEntity(ev.Interface(), item); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + return nil + }() + if err != nil { + return err + } + } + //fmt.Println("queryBackground: Finished") + return errFieldMismatch +} diff --git a/vendor/github.com/yusufpapurcu/wmi/wmi.go b/vendor/github.com/yusufpapurcu/wmi/wmi.go new file mode 100644 index 00000000..26c3581c --- /dev/null +++ b/vendor/github.com/yusufpapurcu/wmi/wmi.go @@ -0,0 +1,591 @@ +//go:build windows +// +build windows + +/* +Package wmi provides a WQL interface for WMI on Windows. + +Example code to print names of running processes: + + type Win32_Process struct { + Name string + } + + func main() { + var dst []Win32_Process + q := wmi.CreateQuery(&dst, "") + err := wmi.Query(q, &dst) + if err != nil { + log.Fatal(err) + } + for i, v := range dst { + println(i, v.Name) + } + } +*/ +package wmi + +import ( + "bytes" + "errors" + "fmt" + "log" + "os" + "reflect" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "github.com/go-ole/go-ole" + "github.com/go-ole/go-ole/oleutil" +) + +var l = log.New(os.Stdout, "", log.LstdFlags) + +var ( + ErrInvalidEntityType = errors.New("wmi: invalid entity type") + // ErrNilCreateObject is the error returned if CreateObject returns nil even + // if the error was nil. + ErrNilCreateObject = errors.New("wmi: create object returned nil") + lock sync.Mutex +) + +// S_FALSE is returned by CoInitializeEx if it was already called on this thread. +const S_FALSE = 0x00000001 + +// QueryNamespace invokes Query with the given namespace on the local machine. +func QueryNamespace(query string, dst interface{}, namespace string) error { + return Query(query, dst, nil, namespace) +} + +// Query runs the WQL query and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +// +// Query is a wrapper around DefaultClient.Query. +func Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + if DefaultClient.SWbemServicesClient == nil { + return DefaultClient.Query(query, dst, connectServerArgs...) + } + return DefaultClient.SWbemServicesClient.Query(query, dst, connectServerArgs...) +} + +// CallMethod calls a method named methodName on an instance of the class named +// className, with the given params. +// +// CallMethod is a wrapper around DefaultClient.CallMethod. +func CallMethod(connectServerArgs []interface{}, className, methodName string, params []interface{}) (int32, error) { + return DefaultClient.CallMethod(connectServerArgs, className, methodName, params) +} + +// A Client is an WMI query client. +// +// Its zero value (DefaultClient) is a usable client. +type Client struct { + // NonePtrZero specifies if nil values for fields which aren't pointers + // should be returned as the field types zero value. + // + // Setting this to true allows stucts without pointer fields to be used + // without the risk failure should a nil value returned from WMI. + NonePtrZero bool + + // PtrNil specifies if nil values for pointer fields should be returned + // as nil. + // + // Setting this to true will set pointer fields to nil where WMI + // returned nil, otherwise the types zero value will be returned. + PtrNil bool + + // AllowMissingFields specifies that struct fields not present in the + // query result should not result in an error. + // + // Setting this to true allows custom queries to be used with full + // struct definitions instead of having to define multiple structs. + AllowMissingFields bool + + // SWbemServiceClient is an optional SWbemServices object that can be + // initialized and then reused across multiple queries. If it is null + // then the method will initialize a new temporary client each time. + SWbemServicesClient *SWbemServices +} + +// DefaultClient is the default Client and is used by Query, QueryNamespace, and CallMethod. +var DefaultClient = &Client{} + +// coinitService coinitializes WMI service. If no error is returned, a cleanup function +// is returned which must be executed (usually deferred) to clean up allocated resources. +func (c *Client) coinitService(connectServerArgs ...interface{}) (*ole.IDispatch, func(), error) { + var unknown *ole.IUnknown + var wmi *ole.IDispatch + var serviceRaw *ole.VARIANT + + // be sure teardown happens in the reverse + // order from that which they were created + deferFn := func() { + if serviceRaw != nil { + serviceRaw.Clear() + } + if wmi != nil { + wmi.Release() + } + if unknown != nil { + unknown.Release() + } + ole.CoUninitialize() + } + + // if we error'ed here, clean up immediately + var err error + defer func() { + if err != nil { + deferFn() + } + }() + + err = ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED) + if err != nil { + oleCode := err.(*ole.OleError).Code() + if oleCode != ole.S_OK && oleCode != S_FALSE { + return nil, nil, err + } + } + + unknown, err = oleutil.CreateObject("WbemScripting.SWbemLocator") + if err != nil { + return nil, nil, err + } else if unknown == nil { + return nil, nil, ErrNilCreateObject + } + + wmi, err = unknown.QueryInterface(ole.IID_IDispatch) + if err != nil { + return nil, nil, err + } + + // service is a SWbemServices + serviceRaw, err = oleutil.CallMethod(wmi, "ConnectServer", connectServerArgs...) + if err != nil { + return nil, nil, err + } + + return serviceRaw.ToIDispatch(), deferFn, nil +} + +// CallMethod calls a WMI method named methodName on an instance +// of the class named className. It passes in the arguments given +// in params. Use connectServerArgs to customize the machine and +// namespace; by default, the local machine and default namespace +// are used. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +func (c *Client) CallMethod(connectServerArgs []interface{}, className, methodName string, params []interface{}) (int32, error) { + service, cleanup, err := c.coinitService(connectServerArgs...) + if err != nil { + return 0, fmt.Errorf("coinit: %v", err) + } + defer cleanup() + + // Get class + classRaw, err := oleutil.CallMethod(service, "Get", className) + if err != nil { + return 0, fmt.Errorf("CallMethod Get class %s: %v", className, err) + } + class := classRaw.ToIDispatch() + defer classRaw.Clear() + + // Run method + resultRaw, err := oleutil.CallMethod(class, methodName, params...) + if err != nil { + return 0, fmt.Errorf("CallMethod %s.%s: %v", className, methodName, err) + } + resultInt, ok := resultRaw.Value().(int32) + if !ok { + return 0, fmt.Errorf("return value was not an int32: %v (%T)", resultRaw, resultRaw) + } + + return resultInt, nil +} + +// Query runs the WQL query and appends the values to dst. +// +// dst must have type *[]S or *[]*S, for some struct type S. Fields selected in +// the query must have the same name in dst. Supported types are all signed and +// unsigned integers, time.Time, string, bool, or a pointer to one of those. +// Array types are not supported. +// +// By default, the local machine and default namespace are used. These can be +// changed using connectServerArgs. See +// https://docs.microsoft.com/en-us/windows/desktop/WmiSdk/swbemlocator-connectserver +// for details. +func (c *Client) Query(query string, dst interface{}, connectServerArgs ...interface{}) error { + dv := reflect.ValueOf(dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType := checkMultiArg(dv) + if mat == multiArgTypeInvalid { + return ErrInvalidEntityType + } + + lock.Lock() + defer lock.Unlock() + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + service, cleanup, err := c.coinitService(connectServerArgs...) + if err != nil { + return err + } + defer cleanup() + + // result is a SWBemObjectSet + resultRaw, err := oleutil.CallMethod(service, "ExecQuery", query) + if err != nil { + return err + } + result := resultRaw.ToIDispatch() + defer resultRaw.Clear() + + count, err := oleInt64(result, "Count") + if err != nil { + return err + } + + enumProperty, err := result.GetProperty("_NewEnum") + if err != nil { + return err + } + defer enumProperty.Clear() + + enum, err := enumProperty.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + if enum == nil { + return fmt.Errorf("can't get IEnumVARIANT, enum is nil") + } + defer enum.Release() + + // Initialize a slice with Count capacity + dv.Set(reflect.MakeSlice(dv.Type(), 0, int(count))) + + var errFieldMismatch error + for itemRaw, length, err := enum.Next(1); length > 0; itemRaw, length, err = enum.Next(1) { + if err != nil { + return err + } + + err := func() error { + // item is a SWbemObject, but really a Win32_Process + item := itemRaw.ToIDispatch() + defer item.Release() + + ev := reflect.New(elemType) + if err = c.loadEntity(ev.Interface(), item); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + return nil + }() + if err != nil { + return err + } + } + return errFieldMismatch +} + +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. +// StructType is the type of the struct pointed to by the destination argument. +type ErrFieldMismatch struct { + StructType reflect.Type + FieldName string + Reason string +} + +func (e *ErrFieldMismatch) Error() string { + return fmt.Sprintf("wmi: cannot load field %q into a %q: %s", + e.FieldName, e.StructType, e.Reason) +} + +var timeType = reflect.TypeOf(time.Time{}) + +// loadEntity loads a SWbemObject into a struct pointer. +func (c *Client) loadEntity(dst interface{}, src *ole.IDispatch) (errFieldMismatch error) { + v := reflect.ValueOf(dst).Elem() + for i := 0; i < v.NumField(); i++ { + f := v.Field(i) + of := f + isPtr := f.Kind() == reflect.Ptr + n := v.Type().Field(i).Name + if n[0] < 'A' || n[0] > 'Z' { + continue + } + if !f.CanSet() { + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "CanSet() is false", + } + } + prop, err := oleutil.GetProperty(src, n) + if err != nil { + if !c.AllowMissingFields { + errFieldMismatch = &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "no such struct field", + } + } + continue + } + defer prop.Clear() + + if isPtr && !(c.PtrNil && prop.VT == 0x1) { + ptr := reflect.New(f.Type().Elem()) + f.Set(ptr) + f = f.Elem() + } + + if prop.VT == 0x1 { //VT_NULL + continue + } + + switch val := prop.Value().(type) { + case int8, int16, int32, int64, int: + v := reflect.ValueOf(val).Int() + switch f.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + f.SetInt(v) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + f.SetUint(uint64(v)) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not an integer class", + } + } + case uint8, uint16, uint32, uint64: + v := reflect.ValueOf(val).Uint() + switch f.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + f.SetInt(int64(v)) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + f.SetUint(v) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not an integer class", + } + } + case string: + switch f.Kind() { + case reflect.String: + f.SetString(val) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + iv, err := strconv.ParseInt(val, 10, 64) + if err != nil { + return err + } + f.SetInt(iv) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + uv, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return err + } + f.SetUint(uv) + case reflect.Struct: + switch f.Type() { + case timeType: + if len(val) == 25 { + mins, err := strconv.Atoi(val[22:]) + if err != nil { + return err + } + val = val[:22] + fmt.Sprintf("%02d%02d", mins/60, mins%60) + } + t, err := time.Parse("20060102150405.000000-0700", val) + if err != nil { + return err + } + f.Set(reflect.ValueOf(t)) + } + } + case bool: + switch f.Kind() { + case reflect.Bool: + f.SetBool(val) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not a bool", + } + } + case float32: + switch f.Kind() { + case reflect.Float32: + f.SetFloat(float64(val)) + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: "not a Float32", + } + } + default: + if f.Kind() == reflect.Slice { + switch f.Type().Elem().Kind() { + case reflect.String: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetString(v.(string)) + } + f.Set(fArr) + } + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetUint(reflect.ValueOf(v).Uint()) + } + f.Set(fArr) + } + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetInt(reflect.ValueOf(v).Int()) + } + f.Set(fArr) + } + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported slice type (%T)", val), + } + } + } else { + typeof := reflect.TypeOf(val) + if typeof == nil && (isPtr || c.NonePtrZero) { + if (isPtr && c.PtrNil) || (!isPtr && c.NonePtrZero) { + of.Set(reflect.Zero(of.Type())) + } + break + } + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported type (%T)", val), + } + } + } + } + return errFieldMismatch +} + +type multiArgType int + +const ( + multiArgTypeInvalid multiArgType = iota + multiArgTypeStruct + multiArgTypeStructPtr +) + +// checkMultiArg checks that v has type []S, []*S for some struct type S. +// +// It returns what category the slice's elements are, and the reflect.Type +// that represents S. +func checkMultiArg(v reflect.Value) (m multiArgType, elemType reflect.Type) { + if v.Kind() != reflect.Slice { + return multiArgTypeInvalid, nil + } + elemType = v.Type().Elem() + switch elemType.Kind() { + case reflect.Struct: + return multiArgTypeStruct, elemType + case reflect.Ptr: + elemType = elemType.Elem() + if elemType.Kind() == reflect.Struct { + return multiArgTypeStructPtr, elemType + } + } + return multiArgTypeInvalid, nil +} + +func oleInt64(item *ole.IDispatch, prop string) (int64, error) { + v, err := oleutil.GetProperty(item, prop) + if err != nil { + return 0, err + } + defer v.Clear() + + i := int64(v.Val) + return i, nil +} + +// CreateQuery returns a WQL query string that queries all columns of src. where +// is an optional string that is appended to the query, to be used with WHERE +// clauses. In such a case, the "WHERE" string should appear at the beginning. +// The wmi class is obtained by the name of the type. You can pass a optional +// class throught the variadic class parameter which is useful for anonymous +// structs. +func CreateQuery(src interface{}, where string, class ...string) string { + var b bytes.Buffer + b.WriteString("SELECT ") + s := reflect.Indirect(reflect.ValueOf(src)) + t := s.Type() + if s.Kind() == reflect.Slice { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return "" + } + var fields []string + for i := 0; i < t.NumField(); i++ { + fields = append(fields, t.Field(i).Name) + } + b.WriteString(strings.Join(fields, ", ")) + b.WriteString(" FROM ") + if len(class) > 0 { + b.WriteString(class[0]) + } else { + b.WriteString(t.Name()) + } + b.WriteString(" " + where) + return b.String() +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go new file mode 100644 index 00000000..92b8cf73 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// DefaultClient is the default Client and is used by Get, Head, Post and PostForm. +// Please be careful of intitialization order - for example, if you change +// the global propagator, the DefaultClient might still be using the old one. +var DefaultClient = &http.Client{Transport: NewTransport(http.DefaultTransport)} + +// Get is a convenient replacement for http.Get that adds a span around the request. +func Get(ctx context.Context, targetURL string) (resp *http.Response, err error) { + req, err := http.NewRequestWithContext(ctx, "GET", targetURL, nil) + if err != nil { + return nil, err + } + return DefaultClient.Do(req) +} + +// Head is a convenient replacement for http.Head that adds a span around the request. +func Head(ctx context.Context, targetURL string) (resp *http.Response, err error) { + req, err := http.NewRequestWithContext(ctx, "HEAD", targetURL, nil) + if err != nil { + return nil, err + } + return DefaultClient.Do(req) +} + +// Post is a convenient replacement for http.Post that adds a span around the request. +func Post(ctx context.Context, targetURL, contentType string, body io.Reader) (resp *http.Response, err error) { + req, err := http.NewRequestWithContext(ctx, "POST", targetURL, body) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", contentType) + return DefaultClient.Do(req) +} + +// PostForm is a convenient replacement for http.PostForm that adds a span around the request. +func PostForm(ctx context.Context, targetURL string, data url.Values) (resp *http.Response, err error) { + return Post(ctx, targetURL, "application/x-www-form-urlencoded", strings.NewReader(data.Encode())) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go new file mode 100644 index 00000000..cabf645a --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" +) + +// Attribute keys that can be added to a span. +const ( + ReadBytesKey = attribute.Key("http.read_bytes") // if anything was read from the request body, the total number of bytes read + ReadErrorKey = attribute.Key("http.read_error") // If an error occurred while reading a request, the string of the error (io.EOF is not recorded) + WroteBytesKey = attribute.Key("http.wrote_bytes") // if anything was written to the response writer, the total number of bytes written + WriteErrorKey = attribute.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded) +) + +// Server HTTP metrics. +const ( + serverRequestSize = "http.server.request.size" // Incoming request bytes total + serverResponseSize = "http.server.response.size" // Incoming response bytes total + serverDuration = "http.server.duration" // Incoming end to end duration, milliseconds +) + +// Client HTTP metrics. +const ( + clientRequestSize = "http.client.request.size" // Outgoing request bytes total + clientResponseSize = "http.client.response.size" // Outgoing response bytes total + clientDuration = "http.client.duration" // Outgoing end to end duration, milliseconds +) + +// Filter is a predicate used to determine whether a given http.request should +// be traced. A Filter must return true if the request should be traced. +type Filter func(*http.Request) bool + +func newTracer(tp trace.TracerProvider) trace.Tracer { + return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version())) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go new file mode 100644 index 00000000..a1b5b5e5 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go @@ -0,0 +1,207 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "net/http" + "net/http/httptrace" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +// ScopeName is the instrumentation scope name. +const ScopeName = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +// config represents the configuration options available for the http.Handler +// and http.Transport types. +type config struct { + ServerName string + Tracer trace.Tracer + Meter metric.Meter + Propagators propagation.TextMapPropagator + SpanStartOptions []trace.SpanStartOption + PublicEndpoint bool + PublicEndpointFn func(*http.Request) bool + ReadEvent bool + WriteEvent bool + Filters []Filter + SpanNameFormatter func(string, *http.Request) string + ClientTrace func(context.Context) *httptrace.ClientTrace + + TracerProvider trace.TracerProvider + MeterProvider metric.MeterProvider +} + +// Option interface used for setting optional config properties. +type Option interface { + apply(*config) +} + +type optionFunc func(*config) + +func (o optionFunc) apply(c *config) { + o(c) +} + +// newConfig creates a new config struct and applies opts to it. +func newConfig(opts ...Option) *config { + c := &config{ + Propagators: otel.GetTextMapPropagator(), + MeterProvider: otel.GetMeterProvider(), + } + for _, opt := range opts { + opt.apply(c) + } + + // Tracer is only initialized if manually specified. Otherwise, can be passed with the tracing context. + if c.TracerProvider != nil { + c.Tracer = newTracer(c.TracerProvider) + } + + c.Meter = c.MeterProvider.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version()), + ) + + return c +} + +// WithTracerProvider specifies a tracer provider to use for creating a tracer. +// If none is specified, the global provider is used. +func WithTracerProvider(provider trace.TracerProvider) Option { + return optionFunc(func(cfg *config) { + if provider != nil { + cfg.TracerProvider = provider + } + }) +} + +// WithMeterProvider specifies a meter provider to use for creating a meter. +// If none is specified, the global provider is used. +func WithMeterProvider(provider metric.MeterProvider) Option { + return optionFunc(func(cfg *config) { + if provider != nil { + cfg.MeterProvider = provider + } + }) +} + +// WithPublicEndpoint configures the Handler to link the span with an incoming +// span context. If this option is not provided, then the association is a child +// association instead of a link. +func WithPublicEndpoint() Option { + return optionFunc(func(c *config) { + c.PublicEndpoint = true + }) +} + +// WithPublicEndpointFn runs with every request, and allows conditionnally +// configuring the Handler to link the span with an incoming span context. If +// this option is not provided or returns false, then the association is a +// child association instead of a link. +// Note: WithPublicEndpoint takes precedence over WithPublicEndpointFn. +func WithPublicEndpointFn(fn func(*http.Request) bool) Option { + return optionFunc(func(c *config) { + c.PublicEndpointFn = fn + }) +} + +// WithPropagators configures specific propagators. If this +// option isn't specified, then the global TextMapPropagator is used. +func WithPropagators(ps propagation.TextMapPropagator) Option { + return optionFunc(func(c *config) { + if ps != nil { + c.Propagators = ps + } + }) +} + +// WithSpanOptions configures an additional set of +// trace.SpanOptions, which are applied to each new span. +func WithSpanOptions(opts ...trace.SpanStartOption) Option { + return optionFunc(func(c *config) { + c.SpanStartOptions = append(c.SpanStartOptions, opts...) + }) +} + +// WithFilter adds a filter to the list of filters used by the handler. +// If any filter indicates to exclude a request then the request will not be +// traced. All filters must allow a request to be traced for a Span to be created. +// If no filters are provided then all requests are traced. +// Filters will be invoked for each processed request, it is advised to make them +// simple and fast. +func WithFilter(f Filter) Option { + return optionFunc(func(c *config) { + c.Filters = append(c.Filters, f) + }) +} + +type event int + +// Different types of events that can be recorded, see WithMessageEvents. +const ( + ReadEvents event = iota + WriteEvents +) + +// WithMessageEvents configures the Handler to record the specified events +// (span.AddEvent) on spans. By default only summary attributes are added at the +// end of the request. +// +// Valid events are: +// - ReadEvents: Record the number of bytes read after every http.Request.Body.Read +// using the ReadBytesKey +// - WriteEvents: Record the number of bytes written after every http.ResponeWriter.Write +// using the WriteBytesKey +func WithMessageEvents(events ...event) Option { + return optionFunc(func(c *config) { + for _, e := range events { + switch e { + case ReadEvents: + c.ReadEvent = true + case WriteEvents: + c.WriteEvent = true + } + } + }) +} + +// WithSpanNameFormatter takes a function that will be called on every +// request and the returned string will become the Span Name. +func WithSpanNameFormatter(f func(operation string, r *http.Request) string) Option { + return optionFunc(func(c *config) { + c.SpanNameFormatter = f + }) +} + +// WithClientTrace takes a function that returns client trace instance that will be +// applied to the requests sent through the otelhttp Transport. +func WithClientTrace(f func(context.Context) *httptrace.ClientTrace) Option { + return optionFunc(func(c *config) { + c.ClientTrace = f + }) +} + +// WithServerName returns an Option that sets the name of the (virtual) server +// handling requests. +func WithServerName(server string) Option { + return optionFunc(func(c *config) { + c.ServerName = server + }) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go new file mode 100644 index 00000000..38c7f01c --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go @@ -0,0 +1,18 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package otelhttp provides an http.Handler and functions that are intended +// to be used to add tracing by wrapping existing handlers (with Handler) and +// routes WithRouteTag. +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go new file mode 100644 index 00000000..1fc15019 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go @@ -0,0 +1,283 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "io" + "net/http" + "time" + + "github.com/felixge/httpsnoop" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" + "go.opentelemetry.io/otel/trace" +) + +// middleware is an http middleware which wraps the next handler in a span. +type middleware struct { + operation string + server string + + tracer trace.Tracer + meter metric.Meter + propagators propagation.TextMapPropagator + spanStartOptions []trace.SpanStartOption + readEvent bool + writeEvent bool + filters []Filter + spanNameFormatter func(string, *http.Request) string + publicEndpoint bool + publicEndpointFn func(*http.Request) bool + + requestBytesCounter metric.Int64Counter + responseBytesCounter metric.Int64Counter + serverLatencyMeasure metric.Float64Histogram +} + +func defaultHandlerFormatter(operation string, _ *http.Request) string { + return operation +} + +// NewHandler wraps the passed handler in a span named after the operation and +// enriches it with metrics. +func NewHandler(handler http.Handler, operation string, opts ...Option) http.Handler { + return NewMiddleware(operation, opts...)(handler) +} + +// NewMiddleware returns a tracing and metrics instrumentation middleware. +// The handler returned by the middleware wraps a handler +// in a span named after the operation and enriches it with metrics. +func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler { + h := middleware{ + operation: operation, + } + + defaultOpts := []Option{ + WithSpanOptions(trace.WithSpanKind(trace.SpanKindServer)), + WithSpanNameFormatter(defaultHandlerFormatter), + } + + c := newConfig(append(defaultOpts, opts...)...) + h.configure(c) + h.createMeasures() + + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h.serveHTTP(w, r, next) + }) + } +} + +func (h *middleware) configure(c *config) { + h.tracer = c.Tracer + h.meter = c.Meter + h.propagators = c.Propagators + h.spanStartOptions = c.SpanStartOptions + h.readEvent = c.ReadEvent + h.writeEvent = c.WriteEvent + h.filters = c.Filters + h.spanNameFormatter = c.SpanNameFormatter + h.publicEndpoint = c.PublicEndpoint + h.publicEndpointFn = c.PublicEndpointFn + h.server = c.ServerName +} + +func handleErr(err error) { + if err != nil { + otel.Handle(err) + } +} + +func (h *middleware) createMeasures() { + var err error + h.requestBytesCounter, err = h.meter.Int64Counter( + serverRequestSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP request messages."), + ) + handleErr(err) + + h.responseBytesCounter, err = h.meter.Int64Counter( + serverResponseSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP response messages."), + ) + handleErr(err) + + h.serverLatencyMeasure, err = h.meter.Float64Histogram( + serverDuration, + metric.WithUnit("ms"), + metric.WithDescription("Measures the duration of inbound HTTP requests."), + ) + handleErr(err) +} + +// serveHTTP sets up tracing and calls the given next http.Handler with the span +// context injected into the request context. +func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http.Handler) { + requestStartTime := time.Now() + for _, f := range h.filters { + if !f(r) { + // Simply pass through to the handler if a filter rejects the request + next.ServeHTTP(w, r) + return + } + } + + ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) + opts := []trace.SpanStartOption{ + trace.WithAttributes(semconvutil.HTTPServerRequest(h.server, r)...), + } + if h.server != "" { + hostAttr := semconv.NetHostName(h.server) + opts = append(opts, trace.WithAttributes(hostAttr)) + } + opts = append(opts, h.spanStartOptions...) + if h.publicEndpoint || (h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx))) { + opts = append(opts, trace.WithNewRoot()) + // Linking incoming span context if any for public endpoint. + if s := trace.SpanContextFromContext(ctx); s.IsValid() && s.IsRemote() { + opts = append(opts, trace.WithLinks(trace.Link{SpanContext: s})) + } + } + + tracer := h.tracer + + if tracer == nil { + if span := trace.SpanFromContext(r.Context()); span.SpanContext().IsValid() { + tracer = newTracer(span.TracerProvider()) + } else { + tracer = newTracer(otel.GetTracerProvider()) + } + } + + ctx, span := tracer.Start(ctx, h.spanNameFormatter(h.operation, r), opts...) + defer span.End() + + readRecordFunc := func(int64) {} + if h.readEvent { + readRecordFunc = func(n int64) { + span.AddEvent("read", trace.WithAttributes(ReadBytesKey.Int64(n))) + } + } + + var bw bodyWrapper + // if request body is nil or NoBody, we don't want to mutate the body as it + // will affect the identity of it in an unforeseeable way because we assert + // ReadCloser fulfills a certain interface and it is indeed nil or NoBody. + if r.Body != nil && r.Body != http.NoBody { + bw.ReadCloser = r.Body + bw.record = readRecordFunc + r.Body = &bw + } + + writeRecordFunc := func(int64) {} + if h.writeEvent { + writeRecordFunc = func(n int64) { + span.AddEvent("write", trace.WithAttributes(WroteBytesKey.Int64(n))) + } + } + + rww := &respWriterWrapper{ + ResponseWriter: w, + record: writeRecordFunc, + ctx: ctx, + props: h.propagators, + statusCode: http.StatusOK, // default status code in case the Handler doesn't write anything + } + + // Wrap w to use our ResponseWriter methods while also exposing + // other interfaces that w may implement (http.CloseNotifier, + // http.Flusher, http.Hijacker, http.Pusher, io.ReaderFrom). + + w = httpsnoop.Wrap(w, httpsnoop.Hooks{ + Header: func(httpsnoop.HeaderFunc) httpsnoop.HeaderFunc { + return rww.Header + }, + Write: func(httpsnoop.WriteFunc) httpsnoop.WriteFunc { + return rww.Write + }, + WriteHeader: func(httpsnoop.WriteHeaderFunc) httpsnoop.WriteHeaderFunc { + return rww.WriteHeader + }, + }) + + labeler := &Labeler{} + ctx = injectLabeler(ctx, labeler) + + next.ServeHTTP(w, r.WithContext(ctx)) + + setAfterServeAttributes(span, bw.read.Load(), rww.written, rww.statusCode, bw.err, rww.err) + + // Add metrics + attributes := append(labeler.Get(), semconvutil.HTTPServerRequestMetrics(h.server, r)...) + if rww.statusCode > 0 { + attributes = append(attributes, semconv.HTTPStatusCode(rww.statusCode)) + } + o := metric.WithAttributes(attributes...) + h.requestBytesCounter.Add(ctx, bw.read.Load(), o) + h.responseBytesCounter.Add(ctx, rww.written, o) + + // Use floating point division here for higher precision (instead of Millisecond method). + elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) + + h.serverLatencyMeasure.Record(ctx, elapsedTime, o) +} + +func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, rerr, werr error) { + attributes := []attribute.KeyValue{} + + // TODO: Consider adding an event after each read and write, possibly as an + // option (defaulting to off), so as to not create needlessly verbose spans. + if read > 0 { + attributes = append(attributes, ReadBytesKey.Int64(read)) + } + if rerr != nil && rerr != io.EOF { + attributes = append(attributes, ReadErrorKey.String(rerr.Error())) + } + if wrote > 0 { + attributes = append(attributes, WroteBytesKey.Int64(wrote)) + } + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) + } + span.SetStatus(semconvutil.HTTPServerStatus(statusCode)) + + if werr != nil && werr != io.EOF { + attributes = append(attributes, WriteErrorKey.String(werr.Error())) + } + span.SetAttributes(attributes...) +} + +// WithRouteTag annotates spans and metrics with the provided route name +// with HTTP route attribute. +func WithRouteTag(route string, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + attr := semconv.HTTPRouteKey.String(route) + + span := trace.SpanFromContext(r.Context()) + span.SetAttributes(attr) + + labeler, _ := LabelerFromContext(r.Context()) + labeler.Add(attr) + + h.ServeHTTP(w, r) + }) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go new file mode 100644 index 00000000..edf4ce3d --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +// Generate semconvutil package: +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv_test.go.tmpl "--data={}" --out=httpconv_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv.go.tmpl "--data={}" --out=httpconv.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv_test.go.tmpl "--data={}" --out=netconv_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv.go.tmpl "--data={}" --out=netconv.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go new file mode 100644 index 00000000..0efd5261 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go @@ -0,0 +1,586 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconvutil/httpconv.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +import ( + "fmt" + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +// HTTPClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(HTTPClientResponse(resp), ClientRequest(resp.Request)...) +func HTTPClientResponse(resp *http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// HTTPClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.method", +// "net.peer.name". The following attributes are returned if the related values +// are defined in req: "net.peer.port", "user_agent.original", +// "http.request_content_length". +func HTTPClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// HTTPClientRequestMetrics returns metric attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.method", "net.peer.name". +// The following attributes are returned if the +// related values are defined in req: "net.peer.port". +func HTTPClientRequestMetrics(req *http.Request) []attribute.KeyValue { + return hc.ClientRequestMetrics(req) +} + +// HTTPClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func HTTPClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// HTTPServerRequest returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.target", "net.host.name". The following attributes are returned if +// they related values are defined in req: "net.host.port", "net.sock.peer.addr", +// "net.sock.peer.port", "user_agent.original", "http.client_ip". +func HTTPServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) +} + +// HTTPServerRequestMetrics returns metric attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "net.host.name". The following attributes are returned if they related +// values are defined in req: "net.host.port". +func HTTPServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequestMetrics(server, req) +} + +// HTTPServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func HTTPServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// httpConv are the HTTP semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type httpConv struct { + NetConv *netConv + + HTTPClientIPKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPResponseContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + UserAgentOriginalKey attribute.Key +} + +var hc = &httpConv{ + NetConv: nc, + + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + UserAgentOriginalKey: semconv.UserAgentOriginalKey, +} + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. The following attributes are returned if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func (c *httpConv) ClientResponse(resp *http.Response) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.status_code int + http.response_content_length int + */ + var n int + if resp.StatusCode > 0 { + n++ + } + if resp.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + if resp.StatusCode > 0 { + attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) + } + if resp.ContentLength > 0 { + attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) + } + return attrs +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.method", +// "net.peer.name". The following attributes are returned if the related values +// are defined in req: "net.peer.port", "user_agent.original", +// "http.request_content_length", "user_agent.original". +func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + user_agent.original string + http.url string + net.peer.name string + net.peer.port int + http.request_content_length int + */ + + /* The following semantic conventions are not returned: + http.status_code This requires the response. See ClientResponse. + http.response_content_length This requires the response. See ClientResponse. + net.sock.family This requires the socket used. + net.sock.peer.addr This requires the socket used. + net.sock.peer.name This requires the socket used. + net.sock.peer.port This requires the socket used. + http.resend_count This is something outside of a single request. + net.protocol.name The value is the Request is ignored, and the go client will always use "http". + net.protocol.version The value in the Request is ignored, and the go client will always use 1.1 or 2.0. + */ + n := 3 // URL, peer name, proto, and method. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + if req.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, c.HTTPURLKey.String(u)) + + attrs = append(attrs, c.NetConv.PeerName(peer)) + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if l := req.ContentLength; l > 0 { + attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) + } + + return attrs +} + +// ClientRequestMetrics returns metric attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.method", "net.peer.name". +// The following attributes are returned if the related values +// are defined in req: "net.peer.port". +func (c *httpConv) ClientRequestMetrics(req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + net.peer.name string + net.peer.port int + */ + + n := 2 // method, peer name. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.method(req.Method), c.NetConv.PeerName(peer)) + + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + return attrs +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.target", "net.host.name". The following attributes are returned if they +// related values are defined in req: "net.host.port", "net.sock.peer.addr", +// "net.sock.peer.port", "user_agent.original", "http.client_ip", +// "net.protocol.name", "net.protocol.version". +func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + http.scheme string + net.host.name string + net.host.port int + net.sock.peer.addr string + net.sock.peer.port int + user_agent.original string + http.client_ip string + net.protocol.name string Note: not set if the value is "http". + net.protocol.version string + http.target string Note: doesn't include the query parameter. + */ + + /* The following semantic conventions are not returned: + http.status_code This requires the response. + http.request_content_length This requires the len() of body, which can mutate it. + http.response_content_length This requires the response. + http.route This is not available. + net.sock.peer.name This would require a DNS lookup. + net.sock.host.addr The request doesn't have access to the underlying socket. + net.sock.host.port The request doesn't have access to the underlying socket. + + */ + n := 4 // Method, scheme, proto, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + peer, peerPort := splitHostPort(req.RemoteAddr) + if peer != "" { + n++ + if peerPort > 0 { + n++ + } + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + n++ + } + + var target string + if req.URL != nil { + target = req.URL.Path + if target != "" { + n++ + } + } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + n++ + } + if protoVersion != "" { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) + if peerPort > 0 { + attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if clientIP != "" { + attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) + } + + if target != "" { + attrs = append(attrs, c.HTTPTargetKey.String(target)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) + } + + return attrs +} + +// ServerRequestMetrics returns metric attributes for an HTTP request received +// by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "net.host.name". The following attributes are returned if they related +// values are defined in req: "net.host.port". +func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.scheme string + http.route string + http.method string + http.status_code int + net.host.name string + net.host.port int + net.protocol.name string Note: not set if the value is "http". + net.protocol.version string + */ + + n := 3 // Method, scheme, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + n++ + } + if protoVersion != "" { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.methodMetric(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + if protoName != "" { + attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) + } + + return attrs +} + +func (c *httpConv) method(method string) attribute.KeyValue { + if method == "" { + return c.HTTPMethodKey.String(http.MethodGet) + } + return c.HTTPMethodKey.String(method) +} + +func (c *httpConv) methodMetric(method string) attribute.KeyValue { + method = strings.ToUpper(method) + switch method { + case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: + default: + method = "_OTHER" + } + return c.HTTPMethodKey.String(method) +} + +func (c *httpConv) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return c.HTTPSchemeHTTPS + } + return c.HTTPSchemeHTTP +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +// Return the request host and port from the first non-empty source. +func firstHostPort(source ...string) (host string, port int) { + for _, hostport := range source { + host, port = splitHostPort(hostport) + if host != "" || port > 0 { + break + } + } + return +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func (c *httpConv) ClientStatus(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 400 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (c *httpConv) ServerStatus(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 500 { + return codes.Error, "" + } + return codes.Unset, "" +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go new file mode 100644 index 00000000..d3a06e0c --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go @@ -0,0 +1,215 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconvutil/netconv.go.tmpl + +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + +import ( + "net" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +// NetTransport returns a trace attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func NetTransport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// netConv are the network semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type netConv struct { + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetProtocolName attribute.Key + NetProtocolVersion attribute.Key + NetSockFamilyKey attribute.Key + NetSockPeerAddrKey attribute.Key + NetSockPeerPortKey attribute.Key + NetSockHostAddrKey attribute.Key + NetSockHostPortKey attribute.Key + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportInProc attribute.KeyValue +} + +var nc = &netConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetProtocolName: semconv.NetProtocolNameKey, + NetProtocolVersion: semconv.NetProtocolVersionKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +func (c *netConv) Transport(network string) attribute.KeyValue { + switch network { + case "tcp", "tcp4", "tcp6": + return c.NetTransportTCP + case "udp", "udp4", "udp6": + return c.NetTransportUDP + case "unix", "unixgram", "unixpacket": + return c.NetTransportInProc + default: + // "ip:*", "ip4:*", and "ip6:*" all are considered other. + return c.NetTransportOther + } +} + +// Host returns attributes for a network host address. +func (c *netConv) Host(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.HostName(h)) + if p > 0 { + attrs = append(attrs, c.HostPort(int(p))) + } + return attrs +} + +func (c *netConv) HostName(name string) attribute.KeyValue { + return c.NetHostNameKey.String(name) +} + +func (c *netConv) HostPort(port int) attribute.KeyValue { + return c.NetHostPortKey.Int(port) +} + +func family(network, address string) string { + switch network { + case "unix", "unixgram", "unixpacket": + return "unix" + default: + if ip := net.ParseIP(address); ip != nil { + if ip.To4() == nil { + return "inet6" + } + return "inet" + } + } + return "" +} + +// Peer returns attributes for a network peer address. +func (c *netConv) Peer(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.PeerName(h)) + if p > 0 { + attrs = append(attrs, c.PeerPort(int(p))) + } + return attrs +} + +func (c *netConv) PeerName(name string) attribute.KeyValue { + return c.NetPeerNameKey.String(name) +} + +func (c *netConv) PeerPort(port int) attribute.KeyValue { + return c.NetPeerPortKey.Int(port) +} + +func (c *netConv) SockPeerAddr(addr string) attribute.KeyValue { + return c.NetSockPeerAddrKey.String(addr) +} + +func (c *netConv) SockPeerPort(port int) attribute.KeyValue { + return c.NetSockPeerPortKey.Int(port) +} + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} + +func netProtocol(proto string) (name string, version string) { + name, version, _ = strings.Cut(proto, "/") + name = strings.ToLower(name) + return name, version +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go new file mode 100644 index 00000000..26a51a18 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" +) + +// Labeler is used to allow instrumented HTTP handlers to add custom attributes to +// the metrics recorded by the net/http instrumentation. +type Labeler struct { + mu sync.Mutex + attributes []attribute.KeyValue +} + +// Add attributes to a Labeler. +func (l *Labeler) Add(ls ...attribute.KeyValue) { + l.mu.Lock() + defer l.mu.Unlock() + l.attributes = append(l.attributes, ls...) +} + +// Get returns a copy of the attributes added to the Labeler. +func (l *Labeler) Get() []attribute.KeyValue { + l.mu.Lock() + defer l.mu.Unlock() + ret := make([]attribute.KeyValue, len(l.attributes)) + copy(ret, l.attributes) + return ret +} + +type labelerContextKeyType int + +const lablelerContextKey labelerContextKeyType = 0 + +func injectLabeler(ctx context.Context, l *Labeler) context.Context { + return context.WithValue(ctx, lablelerContextKey, l) +} + +// LabelerFromContext retrieves a Labeler instance from the provided context if +// one is available. If no Labeler was found in the provided context a new, empty +// Labeler is returned and the second return value is false. In this case it is +// safe to use the Labeler but any attributes added to it will not be used. +func LabelerFromContext(ctx context.Context) (*Labeler, bool) { + l, ok := ctx.Value(lablelerContextKey).(*Labeler) + if !ok { + l = &Labeler{} + } + return l, ok +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go new file mode 100644 index 00000000..43e937a6 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go @@ -0,0 +1,286 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "io" + "net/http" + "net/http/httptrace" + "sync/atomic" + "time" + + "go.opentelemetry.io/otel/metric" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +// Transport implements the http.RoundTripper interface and wraps +// outbound HTTP(S) requests with a span and enriches it with metrics. +type Transport struct { + rt http.RoundTripper + + tracer trace.Tracer + meter metric.Meter + propagators propagation.TextMapPropagator + spanStartOptions []trace.SpanStartOption + filters []Filter + spanNameFormatter func(string, *http.Request) string + clientTrace func(context.Context) *httptrace.ClientTrace + + requestBytesCounter metric.Int64Counter + responseBytesCounter metric.Int64Counter + latencyMeasure metric.Float64Histogram +} + +var _ http.RoundTripper = &Transport{} + +// NewTransport wraps the provided http.RoundTripper with one that +// starts a span, injects the span context into the outbound request headers, +// and enriches it with metrics. +// +// If the provided http.RoundTripper is nil, http.DefaultTransport will be used +// as the base http.RoundTripper. +func NewTransport(base http.RoundTripper, opts ...Option) *Transport { + if base == nil { + base = http.DefaultTransport + } + + t := Transport{ + rt: base, + } + + defaultOpts := []Option{ + WithSpanOptions(trace.WithSpanKind(trace.SpanKindClient)), + WithSpanNameFormatter(defaultTransportFormatter), + } + + c := newConfig(append(defaultOpts, opts...)...) + t.applyConfig(c) + t.createMeasures() + + return &t +} + +func (t *Transport) applyConfig(c *config) { + t.tracer = c.Tracer + t.meter = c.Meter + t.propagators = c.Propagators + t.spanStartOptions = c.SpanStartOptions + t.filters = c.Filters + t.spanNameFormatter = c.SpanNameFormatter + t.clientTrace = c.ClientTrace +} + +func (t *Transport) createMeasures() { + var err error + t.requestBytesCounter, err = t.meter.Int64Counter( + clientRequestSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP request messages."), + ) + handleErr(err) + + t.responseBytesCounter, err = t.meter.Int64Counter( + clientResponseSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP response messages."), + ) + handleErr(err) + + t.latencyMeasure, err = t.meter.Float64Histogram( + clientDuration, + metric.WithUnit("ms"), + metric.WithDescription("Measures the duration of outbound HTTP requests."), + ) + handleErr(err) +} + +func defaultTransportFormatter(_ string, r *http.Request) string { + return "HTTP " + r.Method +} + +// RoundTrip creates a Span and propagates its context via the provided request's headers +// before handing the request to the configured base RoundTripper. The created span will +// end when the response body is closed or when a read from the body returns io.EOF. +func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { + requestStartTime := time.Now() + for _, f := range t.filters { + if !f(r) { + // Simply pass through to the base RoundTripper if a filter rejects the request + return t.rt.RoundTrip(r) + } + } + + tracer := t.tracer + + if tracer == nil { + if span := trace.SpanFromContext(r.Context()); span.SpanContext().IsValid() { + tracer = newTracer(span.TracerProvider()) + } else { + tracer = newTracer(otel.GetTracerProvider()) + } + } + + opts := append([]trace.SpanStartOption{}, t.spanStartOptions...) // start with the configured options + + ctx, span := tracer.Start(r.Context(), t.spanNameFormatter("", r), opts...) + + if t.clientTrace != nil { + ctx = httptrace.WithClientTrace(ctx, t.clientTrace(ctx)) + } + + labeler := &Labeler{} + ctx = injectLabeler(ctx, labeler) + + r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request. + + // use a body wrapper to determine the request size + var bw bodyWrapper + // if request body is nil or NoBody, we don't want to mutate the body as it + // will affect the identity of it in an unforeseeable way because we assert + // ReadCloser fulfills a certain interface and it is indeed nil or NoBody. + if r.Body != nil && r.Body != http.NoBody { + bw.ReadCloser = r.Body + // noop to prevent nil panic. not using this record fun yet. + bw.record = func(int64) {} + r.Body = &bw + } + + span.SetAttributes(semconvutil.HTTPClientRequest(r)...) + t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) + + res, err := t.rt.RoundTrip(r) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + span.End() + return res, err + } + + // metrics + metricAttrs := append(labeler.Get(), semconvutil.HTTPClientRequestMetrics(r)...) + if res.StatusCode > 0 { + metricAttrs = append(metricAttrs, semconv.HTTPStatusCode(res.StatusCode)) + } + o := metric.WithAttributes(metricAttrs...) + t.requestBytesCounter.Add(ctx, bw.read.Load(), o) + // For handling response bytes we leverage a callback when the client reads the http response + readRecordFunc := func(n int64) { + t.responseBytesCounter.Add(ctx, n, o) + } + + // traces + span.SetAttributes(semconvutil.HTTPClientResponse(res)...) + span.SetStatus(semconvutil.HTTPClientStatus(res.StatusCode)) + + res.Body = newWrappedBody(span, readRecordFunc, res.Body) + + // Use floating point division here for higher precision (instead of Millisecond method). + elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) + + t.latencyMeasure.Record(ctx, elapsedTime, o) + + return res, err +} + +// newWrappedBody returns a new and appropriately scoped *wrappedBody as an +// io.ReadCloser. If the passed body implements io.Writer, the returned value +// will implement io.ReadWriteCloser. +func newWrappedBody(span trace.Span, record func(n int64), body io.ReadCloser) io.ReadCloser { + // The successful protocol switch responses will have a body that + // implement an io.ReadWriteCloser. Ensure this interface type continues + // to be satisfied if that is the case. + if _, ok := body.(io.ReadWriteCloser); ok { + return &wrappedBody{span: span, record: record, body: body} + } + + // Remove the implementation of the io.ReadWriteCloser and only implement + // the io.ReadCloser. + return struct{ io.ReadCloser }{&wrappedBody{span: span, record: record, body: body}} +} + +// wrappedBody is the response body type returned by the transport +// instrumentation to complete a span. Errors encountered when using the +// response body are recorded in span tracking the response. +// +// The span tracking the response is ended when this body is closed. +// +// If the response body implements the io.Writer interface (i.e. for +// successful protocol switches), the wrapped body also will. +type wrappedBody struct { + span trace.Span + recorded atomic.Bool + record func(n int64) + body io.ReadCloser + read atomic.Int64 +} + +var _ io.ReadWriteCloser = &wrappedBody{} + +func (wb *wrappedBody) Write(p []byte) (int, error) { + // This will not panic given the guard in newWrappedBody. + n, err := wb.body.(io.Writer).Write(p) + if err != nil { + wb.span.RecordError(err) + wb.span.SetStatus(codes.Error, err.Error()) + } + return n, err +} + +func (wb *wrappedBody) Read(b []byte) (int, error) { + n, err := wb.body.Read(b) + // Record the number of bytes read + wb.read.Add(int64(n)) + + switch err { + case nil: + // nothing to do here but fall through to the return + case io.EOF: + wb.recordBytesRead() + wb.span.End() + default: + wb.span.RecordError(err) + wb.span.SetStatus(codes.Error, err.Error()) + } + return n, err +} + +// recordBytesRead is a function that ensures the number of bytes read is recorded once and only once. +func (wb *wrappedBody) recordBytesRead() { + // note: it is more performant (and equally correct) to use atomic.Bool over sync.Once here. In the event that + // two goroutines are racing to call this method, the number of bytes read will no longer increase. Using + // CompareAndSwap allows later goroutines to return quickly and not block waiting for the race winner to finish + // calling wb.record(wb.read.Load()). + if wb.recorded.CompareAndSwap(false, true) { + // Record the total number of bytes read + wb.record(wb.read.Load()) + } +} + +func (wb *wrappedBody) Close() error { + wb.recordBytesRead() + wb.span.End() + if wb.body != nil { + return wb.body.Close() + } + return nil +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go new file mode 100644 index 00000000..35254e88 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +// Version is the current release version of the otelhttp instrumentation. +func Version() string { + return "0.49.0" + // This string is updated by the pre_release.sh script during release +} + +// SemVersion is the semantic version to be supplied to tracer/meter creation. +// +// Deprecated: Use [Version] instead. +func SemVersion() string { + return Version() +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go new file mode 100644 index 00000000..2852ec97 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go @@ -0,0 +1,100 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + +import ( + "context" + "io" + "net/http" + "sync/atomic" + + "go.opentelemetry.io/otel/propagation" +) + +var _ io.ReadCloser = &bodyWrapper{} + +// bodyWrapper wraps a http.Request.Body (an io.ReadCloser) to track the number +// of bytes read and the last error. +type bodyWrapper struct { + io.ReadCloser + record func(n int64) // must not be nil + + read atomic.Int64 + err error +} + +func (w *bodyWrapper) Read(b []byte) (int, error) { + n, err := w.ReadCloser.Read(b) + n1 := int64(n) + w.read.Add(n1) + w.err = err + w.record(n1) + return n, err +} + +func (w *bodyWrapper) Close() error { + return w.ReadCloser.Close() +} + +var _ http.ResponseWriter = &respWriterWrapper{} + +// respWriterWrapper wraps a http.ResponseWriter in order to track the number of +// bytes written, the last error, and to catch the first written statusCode. +// TODO: The wrapped http.ResponseWriter doesn't implement any of the optional +// types (http.Hijacker, http.Pusher, http.CloseNotifier, http.Flusher, etc) +// that may be useful when using it in real life situations. +type respWriterWrapper struct { + http.ResponseWriter + record func(n int64) // must not be nil + + // used to inject the header + ctx context.Context + + props propagation.TextMapPropagator + + written int64 + statusCode int + err error + wroteHeader bool +} + +func (w *respWriterWrapper) Header() http.Header { + return w.ResponseWriter.Header() +} + +func (w *respWriterWrapper) Write(p []byte) (int, error) { + if !w.wroteHeader { + w.WriteHeader(http.StatusOK) + } + n, err := w.ResponseWriter.Write(p) + n1 := int64(n) + w.record(n1) + w.written += n1 + w.err = err + return n, err +} + +// WriteHeader persists initial statusCode for span attribution. +// All calls to WriteHeader will be propagated to the underlying ResponseWriter +// and will persist the statusCode from the first call. +// Blocking consecutive calls to WriteHeader alters expected behavior and will +// remove warning logs from net/http where developers will notice incorrect handler implementations. +func (w *respWriterWrapper) WriteHeader(statusCode int) { + if !w.wroteHeader { + w.wroteHeader = true + w.statusCode = statusCode + } + w.ResponseWriter.WriteHeader(statusCode) +} diff --git a/vendor/go.opentelemetry.io/otel/.codespellignore b/vendor/go.opentelemetry.io/otel/.codespellignore new file mode 100644 index 00000000..120b63a9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellignore @@ -0,0 +1,7 @@ +ot +fo +te +collison +consequentially +ans +nam diff --git a/vendor/go.opentelemetry.io/otel/.codespellrc b/vendor/go.opentelemetry.io/otel/.codespellrc new file mode 100644 index 00000000..4afbb1fb --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,go.mod,go.sum,semconv,venv,.tools +uri-ignore-words-list = * +write = diff --git a/vendor/go.opentelemetry.io/otel/.gitattributes b/vendor/go.opentelemetry.io/otel/.gitattributes new file mode 100644 index 00000000..314766e9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore new file mode 100644 index 00000000..895c7664 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.gitignore @@ -0,0 +1,22 @@ +.DS_Store +Thumbs.db + +.tools/ +venv/ +.idea/ +.vscode/ +*.iml +*.so +coverage.* +go.work +go.work.sum + +gen/ + +/example/dice/dice +/example/namedtracer/namedtracer +/example/otel-collector/otel-collector +/example/opencensus/opencensus +/example/passthrough/passthrough +/example/prometheus/prometheus +/example/zipkin/zipkin diff --git a/vendor/go.opentelemetry.io/otel/.gitmodules b/vendor/go.opentelemetry.io/otel/.gitmodules new file mode 100644 index 00000000..38a1f569 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.gitmodules @@ -0,0 +1,3 @@ +[submodule "opentelemetry-proto"] + path = exporters/otlp/internal/opentelemetry-proto + url = https://github.com/open-telemetry/opentelemetry-proto diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml new file mode 100644 index 00000000..a62511f3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -0,0 +1,296 @@ +# See https://github.com/golangci/golangci-lint#config-file +run: + issues-exit-code: 1 #Default + tests: true #Default + +linters: + # Disable everything by default so upgrades to not include new "default + # enabled" linters. + disable-all: true + # Specifically enable linters we want to use. + enable: + - depguard + - errcheck + - godot + - gofumpt + - goimports + - gosec + - gosimple + - govet + - ineffassign + - misspell + - revive + - staticcheck + - typecheck + - unused + +issues: + # Maximum issues count per one linter. + # Set to 0 to disable. + # Default: 50 + # Setting to unlimited so the linter only is run once to debug all issues. + max-issues-per-linter: 0 + # Maximum count of issues with the same text. + # Set to 0 to disable. + # Default: 3 + # Setting to unlimited so the linter only is run once to debug all issues. + max-same-issues: 0 + # Excluding configuration per-path, per-linter, per-text and per-source. + exclude-rules: + # TODO: Having appropriate comments for exported objects helps development, + # even for objects in internal packages. Appropriate comments for all + # exported objects should be added and this exclusion removed. + - path: '.*internal/.*' + text: "exported (method|function|type|const) (.+) should have comment or be unexported" + linters: + - revive + # Yes, they are, but it's okay in a test. + - path: _test\.go + text: "exported func.*returns unexported type.*which can be annoying to use" + linters: + - revive + # Example test functions should be treated like main. + - path: example.*_test\.go + text: "calls to (.+) only in main[(][)] or init[(][)] functions" + linters: + - revive + # It's okay to not run gosec in a test. + - path: _test\.go + linters: + - gosec + # Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand) + # as we commonly use it in tests and examples. + - text: "G404:" + linters: + - gosec + # Igonoring gosec G402: TLS MinVersion too low + # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well. + - text: "G402: TLS MinVersion too low." + linters: + - gosec + include: + # revive exported should have comment or be unexported. + - EXC0012 + # revive package comment should be of the form ... + - EXC0013 + +linters-settings: + depguard: + rules: + non-tests: + files: + - "!$test" + - "!**/*test/*.go" + - "!**/internal/matchers/*.go" + deny: + - pkg: "testing" + - pkg: "github.com/stretchr/testify" + - pkg: "crypto/md5" + - pkg: "crypto/sha1" + - pkg: "crypto/**/pkix" + otlp-internal: + files: + - "!**/exporters/otlp/internal/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/internal" + desc: Do not use cross-module internal packages. + otlptrace-internal: + files: + - "!**/exporters/otlp/otlptrace/*.go" + - "!**/exporters/otlp/otlptrace/internal/**.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + desc: Do not use cross-module internal packages. + otlpmetric-internal: + files: + - "!**/exporters/otlp/otlpmetric/internal/*.go" + - "!**/exporters/otlp/otlpmetric/internal/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + desc: Do not use cross-module internal packages. + otel-internal: + files: + - "**/sdk/*.go" + - "**/sdk/**/*.go" + - "**/exporters/*.go" + - "**/exporters/**/*.go" + - "**/schema/*.go" + - "**/schema/**/*.go" + - "**/metric/*.go" + - "**/metric/**/*.go" + - "**/bridge/*.go" + - "**/bridge/**/*.go" + - "**/example/*.go" + - "**/example/**/*.go" + - "**/trace/*.go" + - "**/trace/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/internal$" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/attribute" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/internaltest" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/matchers" + desc: Do not use cross-module internal packages. + godot: + exclude: + # Exclude links. + - '^ *\[[^]]+\]:' + # Exclude sentence fragments for lists. + - '^[ ]*[-•]' + # Exclude sentences prefixing a list. + - ':$' + goimports: + local-prefixes: go.opentelemetry.io + misspell: + locale: US + ignore-words: + - cancelled + revive: + # Sets the default failure confidence. + # This means that linting errors with less than 0.8 confidence will be ignored. + # Default: 0.8 + confidence: 0.01 + rules: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports + - name: blank-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr + - name: bool-literal-in-expr + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr + - name: constant-logical-expr + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + # TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 + - name: context-as-argument + disabled: true + arguments: + allowTypesBefore: "*testing.T" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type + - name: context-keys-type + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit + - name: deep-exit + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer + - name: defer + disabled: false + arguments: + - ["call-chain", "loop"] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports + - name: dot-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports + - name: duplicated-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return + - name: early-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block + - name: empty-block + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines + - name: empty-lines + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming + - name: error-naming + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return + - name: error-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings + - name: error-strings + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf + - name: errorf + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported + - name: exported + disabled: false + arguments: + - "sayRepetitiveInsteadOfStutters" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter + - name: flag-parameter + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches + - name: identical-branches + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return + - name: if-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement + - name: increment-decrement + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow + - name: indent-error-flow + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing + - name: import-shadowing + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments + - name: package-comments + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range + - name: range + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure + - name: range-val-in-closure + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address + - name: range-val-address + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id + - name: redefines-builtin-id + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format + - name: string-format + disabled: false + arguments: + - - panic + - '/^[^\n]*$/' + - must not contain line breaks + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag + - name: struct-tag + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else + - name: superfluous-else + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal + - name: time-equal + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming + - name: var-naming + disabled: false + arguments: + - ["ID"] # AllowList + - ["Otel", "Aws", "Gcp"] # DenyList + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration + - name: var-declaration + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion + - name: unconditional-recursion + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return + - name: unexported-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error + - name: unhandled-error + disabled: false + arguments: + - "fmt.Fprint" + - "fmt.Fprintf" + - "fmt.Fprintln" + - "fmt.Print" + - "fmt.Printf" + - "fmt.Println" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt + - name: unnecessary-stmt + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break + - name: useless-break + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value + - name: waitgroup-by-value + disabled: false diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore new file mode 100644 index 00000000..40d62fa2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.lycheeignore @@ -0,0 +1,6 @@ +http://localhost +http://jaeger-collector +https://github.com/open-telemetry/opentelemetry-go/milestone/ +https://github.com/open-telemetry/opentelemetry-go/projects +file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries +file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual diff --git a/vendor/go.opentelemetry.io/otel/.markdownlint.yaml b/vendor/go.opentelemetry.io/otel/.markdownlint.yaml new file mode 100644 index 00000000..3202496c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/.markdownlint.yaml @@ -0,0 +1,29 @@ +# Default state for all rules +default: true + +# ul-style +MD004: false + +# hard-tabs +MD010: false + +# line-length +MD013: false + +# no-duplicate-header +MD024: + siblings_only: true + +#single-title +MD025: false + +# ol-prefix +MD029: + style: ordered + +# no-inline-html +MD033: false + +# fenced-code-language +MD040: false + diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md new file mode 100644 index 00000000..98f2d204 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -0,0 +1,2939 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 + +This release is the last to support [Go 1.20]. +The next release will require at least [Go 1.21]. + +### Added + +- Support [Go 1.22]. (#4890) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) +- The `go.opentelemetry.io/otel/log` module is added. + This module includes OpenTelemetry Go's implementation of the Logs Bridge API. + This module is in an alpha state, it is subject to breaking changes. + See our [versioning policy](./VERSIONING.md) for more info. (#4961) + +### Fixed + +- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) +- Fix negative buckets in output of exponential histograms. (#4956) + +## [1.23.1] 2024-02-07 + +### Fixed + +- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) + +## [1.23.0] 2024-02-06 + +This release contains the first stable, `v1`, release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +- Experimental exemplar exporting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871) +- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) + +### Changed + +- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. + Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. + It is up to the user to decide if they want to use the returned `Resource` or not. + It may have desired attributes overwritten or include stale semantic conventions. (#4876) + +### Fixed + +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) +- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) +- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) + +## [1.23.0-rc.1] 2024-01-18 + +This is a release candidate for the v1.23.0 release. +That release is expected to include the `v1` release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +## [1.22.0/0.45.0] 2024-01-17 + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.22.0` package. + The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) +- The `go.opentelemetry.io/otel/semconv/v1.23.0` package. + The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) +- The `go.opentelemetry.io/otel/semconv/v1.23.1` package. + The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) +- The `go.opentelemetry.io/otel/semconv/v1.24.0` package. + The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) +- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) +- Experimental cardinality limiting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) +- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) + +### Changed + +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) +- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. + If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) +- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) +- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) +- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) +- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) +- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818) +- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) + +### Fixed + +- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) +- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) +- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) +- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) +- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) +- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) + +## [1.21.0/0.44.0] 2023-11-16 + +### Removed + +- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) +- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) +- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723) + +### Fixed + +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) + +## [1.20.0/0.43.0] 2023-11-10 + +This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. + +### Added + +- Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) +- Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) +- Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) +- Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) +- Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) +- Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Add `go.opentelemetry.io/otel/metric.WithExplicitBucketBoundaries`, which allows defining default explicit bucket boundaries when creating histogram instruments. (#4603) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) +- Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) +- Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) +- Add support for Summary metrics in `go.opentelemetry.io/otel/bridge/opencensus`. (#4668) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) +- Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) +- Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. + Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) +- Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Deprecate `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4693) + +### Changed + +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) +- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. + This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. + This extends the `Tracer` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. + This extends the `Span` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4679) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4679) + +### Fixed + +- Fix improper parsing of characters such us `+`, `/` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_RESOURCE_ATTRIBUTES` in `go.opentelemetry.io/otel/sdk/resource` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracegrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp` as they were rendered as a whitespace. (#4699) +- In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) + +## [1.19.0/0.42.0/0.0.7] 2023-09-28 + +This release contains the first stable release of the OpenTelemetry Go [metric SDK]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/sdk/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) +- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON. (#4507) + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) +- The exporter in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettify its output by default anymore. (#4507) +- Upgrade `gopkg.io/yaml` from `v2` to `v3` in `go.opentelemetry.io/otel/schema`. (#4535) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the Prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +### Removed + +- Remove `"go.opentelemetry.io/otel/bridge/opencensus".NewMetricExporter`, which is replaced by `NewMetricProducer`. (#4566) + +## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 + +This is a release candidate for the v1.19.0/v0.42.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric SDK and will provide stability guarantees of that SDK. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + +## [1.18.0/0.41.0/0.0.6] 2023-09-12 + +This release drops the compatibility guarantee of [Go 1.19]. + +### Added + +- Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) +- Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) + +### Changed + +- Use a `TestingT` interface instead of `*testing.T` struct in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#4483) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). + The deprecation notice format for the function has been corrected to trigger Go documentation and build tooling. (#4470) + +### Removed + +- Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) +- Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) +- Dropped guaranteed support for versions of Go less than 1.20. (#4481) + +## [1.17.0/0.40.0/0.0.5] 2023-08-28 + +### Added + +- Export the `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Export the `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add support for exponential histogram aggregations. + A histogram can be configured as an exponential histogram using a view with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the aggregation. (#4245) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) +- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) +- Add info and debug logging to the metric SDK in `go.opentelemetry.io/otel/sdk/metric`. (#4315) +- The `go.opentelemetry.io/otel/semconv/v1.21.0` package. + The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) +- Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) +- Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) +- Expand the set of units supported by the Prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) +- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) +- Support Go 1.21. (#4463) + +### Changed + +- Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) +- Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) +- Return an error on the creation of new instruments in `go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp validation. (#4210) +- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) +- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) +- Count the Collect time in the `PeriodicReader` timeout in `go.opentelemetry.io/otel/sdk/metric`. (#4221) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- If an attribute set is omitted from an async callback, the previous value will no longer be exported in `go.opentelemetry.io/otel/sdk/metric`. (#4290) +- If an attribute set is observed multiple times in an async callback in `go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead of the last observation winning. (#4289) +- Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) +- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) +- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) +- Increase instrument name maximum length from 63 to 255 characters in `go.opentelemetry.io/otel/sdk/metric`. (#4434) +- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option` for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and `"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`. (#4346) + +### Removed + +- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`. + Use the added `WithProducer` option instead. (#4346) +- Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. + Notice that `PeriodicReader.ForceFlush` is still available. (#4375) + +### Fixed + +- Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) +- Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) +- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set an empty `host.id`. (#4317) +- Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) +- Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) +- The `ManualReader` will not panic if `AggregationSelector` returns `nil` in `go.opentelemetry.io/otel/sdk/metric`. (#4350) +- If a `Reader`'s `AggregationSelector` returns `nil` or `DefaultAggregation` the pipeline will use the default aggregation. (#4350) +- Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) +- Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) +- Improve context cancellation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) +- Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) +- Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) +- Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) +- Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) + +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated. + OpenTelemetry dropped support for Jaeger exporter in July 2023. + Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` + or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` instead. (#4423) +- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated. (#4423) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is deprecated. + Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric` instead. (#4435) + +## [1.16.0/0.39.0] 2023-05-18 + +This release contains the first stable release of the OpenTelemetry Go [metric API]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. + The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) +- The `go.opentelemetry.io/otel/semconv/v1.20.0` package. + The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) +- The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) +- OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) +- Fix serialization of `time.Time` zero values in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` packages. (#4271) + +### Changed + +- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) +- `MeterProvider` returns noop meters once it has been shutdown. (#4154) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. + Use `go.opentelemetry.io/otel/metric` instead. (#4055) + +### Fixed + +- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077) + +## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 + +This is a release candidate for the v1.16.0/v0.39.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. + This stages the metric API to be released as a stable module. (#4038) + +### Removed + +- The `go.opentelemetry.io/otel/metric/global` package is removed. + Use `go.opentelemetry.io/otel` instead. (#4039) + +## [1.15.1/0.38.1] 2023-05-02 + +### Fixed + +- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) + +## [1.15.0/0.38.0] 2023-04-27 + +### Added + +- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) +- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) +- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) +- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971) + - The `AddConfig` used to hold configuration for addition measurements + - `NewAddConfig` used to create a new `AddConfig` + - `AddOption` used to configure an `AddConfig` + - The `RecordConfig` used to hold configuration for recorded measurements + - `NewRecordConfig` used to create a new `RecordConfig` + - `RecordOption` used to configure a `RecordConfig` + - The `ObserveConfig` used to hold configuration for observed measurements + - `NewObserveConfig` used to create a new `ObserveConfig` + - `ObserveOption` used to configure an `ObserveConfig` +- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`. + They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) + +### Changed + +- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) +- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`. + This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) +- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) + - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` +- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966) +- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) +- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Int64Counter.Add` method now accepts `...AddOption` + - The `Float64Counter.Add` method now accepts `...AddOption` + - The `Int64UpDownCounter.Add` method now accepts `...AddOption` + - The `Float64UpDownCounter.Add` method now accepts `...AddOption` + - The `Int64Histogram.Record` method now accepts `...RecordOption` + - The `Float64Histogram.Record` method now accepts `...RecordOption` + - The `Int64Observer.Observe` method now accepts `...ObserveOption` + - The `Float64Observer.Observe` method now accepts `...ObserveOption` +- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Observer.ObserveInt64` method now accepts `...ObserveOption` + - The `Observer.ObserveFloat64` method now accepts `...ObserveOption` +- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) + +### Fixed + +- `TracerProvider` allows calling `Tracer()` while it's shutting down. + It used to deadlock. (#3924) +- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) +- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) +- Automatically figure out the default aggregation with `aggregation.Default`. (#3967) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated. + Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018) + +## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) +- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) +- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) +- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) +- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) +- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) + +### Changed + +- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832) +- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) +- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) +- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) +- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) +- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) +- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) +- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) + +### Fixed + +- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) +- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) +- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `float64` instrument configuration instead. (#3895) +- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `int64` instrument configuration instead. (#3895) +- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893) + +## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +This release drops the compatibility guarantee of [Go 1.18]. + +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + +### Changed + +- Dropped compatibility testing for [Go 1.18]. + The project no longer guarantees support for this version of Go. (#3813) + +### Fixed + +- Handle empty environment variable as it they were not set. (#3764) +- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) +- Fix race conditions in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic. (#3899) +- Fix sending nil `scopeInfo` to metrics channel in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic in `github.com/prometheus/client_golang/prometheus`. (#3899) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/global` package is deprecated. + Use `go.opentelemetry.io/otel` instead. (#3818) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) + +## [1.14.0/0.37.0/0.0.4] 2023-02-27 + +This release is the last to support [Go 1.18]. +The next release will require at least [Go 1.19]. + +### Added + +- The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) +- Support [Go 1.20]. (#3693) +- The `go.opentelemetry.io/otel/semconv/v1.18.0` package. + The package contains semantic conventions from the `v1.18.0` version of the OpenTelemetry specification. (#3719) + - The following `const` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeNameKey` -> `OTelScopeNameKey` + - `OtelScopeVersionKey` -> `OTelScopeVersionKey` + - `OtelLibraryNameKey` -> `OTelLibraryNameKey` + - `OtelLibraryVersionKey` -> `OTelLibraryVersionKey` + - `OtelStatusCodeKey` -> `OTelStatusCodeKey` + - `OtelStatusDescriptionKey` -> `OTelStatusDescriptionKey` + - `OtelStatusCodeOk` -> `OTelStatusCodeOk` + - `OtelStatusCodeError` -> `OTelStatusCodeError` + - The following `func` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeName` -> `OTelScopeName` + - `OtelScopeVersion` -> `OTelScopeVersion` + - `OtelLibraryName` -> `OTelLibraryName` + - `OtelLibraryVersion` -> `OTelLibraryVersion` + - `OtelStatusDescription` -> `OTelStatusDescription` +- A `IsSampled` method is added to the `SpanContext` implementation in `go.opentelemetry.io/otel/bridge/opentracing` to expose the span sampled state. + See the [README](./bridge/opentracing/README.md) for more information. (#3570) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) +- The following environment variables are supported by the periodic `Reader` in `go.opentelemetry.io/otel/sdk/metric`. (#3763) + - `OTEL_METRIC_EXPORT_INTERVAL` sets the time between collections and exports. + - `OTEL_METRIC_EXPORT_TIMEOUT` sets the timeout an export is attempted. + +### Changed + +- Fall-back to `TextMapCarrier` when it's not `HttpHeader`s in `go.opentelemetry.io/otel/bridge/opentracing`. (#3679) +- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. + This change is made to enable memory reuse by SDK users. (#3732) +- The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) + +### Fixed + +- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) +- Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) +- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) +- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) +- Data race issue in OTLP exporter retry mechanism. (#3755, #3756) +- Wrapping empty errors when exporting in `go.opentelemetry.io/otel/sdk/metric`. (#3698, #3772) +- Incorrect "all" and "resource" definition for schema files in `go.opentelemetry.io/otel/schema/v1.1`. (#3777) + +### Deprecated + +- The `go.opentelemetry.io/otel/metric/unit` package is deprecated. + Use the equivalent unit string instead. (#3776) + - Use `"1"` instead of `unit.Dimensionless` + - Use `"By"` instead of `unit.Bytes` + - Use `"ms"` instead of `unit.Milliseconds` + +## [1.13.0/0.36.0] 2023-02-07 + +### Added + +- Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. + These functions ensure semantic convention type correctness. (#3675) + +### Fixed + +- Removed the `http.target` attribute from being added by `ServerRequest` in the following packages. (#3687) + - `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.14.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.15.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.16.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.17.0/httpconv` + +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncint64` package is removed. (#3631) + +## [1.12.0/0.35.0] 2023-01-28 + +### Added + +- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `int64` Observer callbacks during their creation. (#3507) +- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `float64` Observer callbacks during their creation. (#3507) +- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`. + These additions are used to enable external metric Producers. (#3524) +- The `Callback` function type to `go.opentelemetry.io/otel/metric`. + This new named function type is registered with a `Meter`. (#3564) +- The `go.opentelemetry.io/otel/semconv/v1.13.0` package. + The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) + - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. + - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. +- The `go.opentelemetry.io/otel/semconv/v1.14.0` package. + The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) +- The `go.opentelemetry.io/otel/semconv/v1.15.0` package. + The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) +- The `go.opentelemetry.io/otel/semconv/v1.16.0` package. + The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) +- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. + These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) + - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` + - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` + - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` + - `Int64ObservableCounter` replaces the `asyncint64.Counter` + - `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter` + - `Int64ObservableGauge` replaces the `asyncint64.Gauge` + - `Float64Counter` replaces the `syncfloat64.Counter` + - `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter` + - `Float64Histogram` replaces the `syncfloat64.Histogram` + - `Int64Counter` replaces the `syncint64.Counter` + - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` + - `Int64Histogram` replaces the `syncint64.Histogram` +- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`. + This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116) +- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487) +- The `go.opentelemetry.io/otel/semconv/v1.17.0` package. + The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) + +### Changed + +- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) +- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507) + - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. + - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. + - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. + - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. +- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. + This `Registration` can be used to unregister callbacks. (#3522) +- Global error handler uses an atomic value instead of a mutex. (#3543) +- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) +- Global logger uses an atomic value instead of a mutex. (#3545) +- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) +- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. + This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name. + Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) +- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) +- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) + - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` + - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` + - `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram` + - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` + - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` + - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` +- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed. + - The named `Callback` replaces the inline function parameter. (#3564) + - `Callback` is required to return an error. (#3576) + - `Callback` accepts the added `Observer` parameter added. + This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) + - The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587) +- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. + This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. + Instead it uses the `net.sock.peer` attributes. (#3581) +- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) + +### Fixed + +- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549) +- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. + Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) + +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. + Use `NewMetricProducer` instead. (#3541) +- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. + Use `NewTracerProvider` instead. (#3116) + +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64Counter` + - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Int64Histogram` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64Counter` + - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Float64Histogram` + +## [1.11.2/0.34.0] 2022-12-05 + +### Added + +- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. + This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) +- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. + This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) +- OTLP exporters now recognize: (#3363) + - `OTEL_EXPORTER_OTLP_INSECURE` + - `OTEL_EXPORTER_OTLP_TRACES_INSECURE` + - `OTEL_EXPORTER_OTLP_METRICS_INSECURE` + - `OTEL_EXPORTER_OTLP_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` +- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) +- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) + +### Changed + +- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. + Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. + The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) +- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) +- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) + +### Fixed + +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Remove comparable requirement for `Reader`s. (#3387) +- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) +- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) +- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) +- Re-enabled Attribute Filters in the Metric SDK. (#3396) +- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) +- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) +- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +- Prevent duplicate Prometheus description, unit, and type. (#3469) +- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) + +### Removed + +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) + +### Deprecated + +- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. + Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) + +## [1.11.1/0.33.0] 2022-10-19 + +### Added + +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` registers with a Prometheus registerer on creation. + By default, it will register with the default Prometheus registerer. + A non-default registerer can be used by passing the `WithRegisterer` option. (#3239) +- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the default `AggregationSelector` used. (#3341) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` converts the `Resource` associated with metric exports into a `target_info` metric. (#3285) + +### Changed + +- The `"go.opentelemetry.io/otel/exporters/prometheus".New` function is updated to return an error. + It will return an error if the exporter fails to register with Prometheus. (#3239) + +### Fixed + +- The URL-encoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable are decoded. (#2963) +- The `baggage.NewMember` function decodes the `value` parameter instead of directly using it. + This fixes the implementation to be compliant with the W3C specification. (#3226) +- Slice attributes of the `attribute` package are now comparable based on their value, not instance. (#3108 #3252) +- The `Shutdown` and `ForceFlush` methods of the `"go.opentelemetry.io/otel/sdk/trace".TraceProvider` no longer return an error when no processor is registered. (#3268) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` cumulatively sums histogram buckets. (#3281) +- The sum of each histogram data point is now uniquely exported by the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) +- `UpDownCounters` are now correctly output as Prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` no longer describes the metrics it will send to Prometheus on startup. + Instead the exporter is defined as an "unchecked" collector for Prometheus. + This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds `_total` suffixes to counter metrics. (#3360) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. + This can be disabled using the `WithoutUnits()` option added to that package. (#3352) + +## [1.11.0/0.32.3] 2022-10-12 + +### Added + +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) + +### Changed + +- `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) +- Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. + This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) + +## [0.32.2] Metric SDK (Alpha) - 2022-10-11 + +### Added + +- Added an example of using metric views to customize instruments. (#3177) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`). (#3261) + +### Changed + +- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) +- Update histogram default bounds to match the requirements of the latest specification. (#3222) +- Encode the HTTP status code in the OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`) as an integer. (#3265) + +### Fixed + +- Use default view if instrument does not match any registered view of a reader. (#3224, #3237) +- Return the same instrument every time a user makes the exact same instrument creation call. (#3229, #3251) +- Return the existing instrument when a view transforms a creation call to match an existing instrument. (#3240, #3251) +- Log a warning when a conflicting instrument (e.g. description, unit, data-type) is created instead of returning an error. (#3251) +- The OpenCensus bridge no longer sends empty batches of metrics. (#3263) + +## [0.32.1] Metric SDK (Alpha) - 2022-09-22 + +### Changed + +- The Prometheus exporter sanitizes OpenTelemetry instrument names when exporting. + Invalid characters are replaced with `_`. (#3212) + +### Added + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) +- The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) + +### Fixed + +- Updated go.mods to point to valid versions of the sdk. (#3216) +- Set the `MeterProvider` resource on all exported metric data. (#3218) + +## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 + +### Changed + +- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. + Please see the package documentation for how the new SDK is initialized and configured. (#3175) +- Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) + +### Removed + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been removed. + A new bridge compliant with the revised metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/histogram` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/sum` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/controllertest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/time` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export/aggregation` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/metrictest` package is removed. + A replacement package that supports the new metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/number` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/processortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/reducer` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/registry` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/sdkapi` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/selector/simple` package is removed, see the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrUninitializedInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrBadInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".Accumulator` type was removed, see the `MeterProvider`in the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) +- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) + +## [1.10.0] - 2022-09-09 + +### Added + +- Support Go 1.19. (#3077) + Include compatibility testing and document support. (#3077) +- Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) +- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) + +### Changed + +- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) +- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) +- All exporters will be shutdown even if one reports an error (#3091) +- Ensure valid UTF-8 when truncating over-length attribute values. (#3156) + +## [1.9.0/0.0.3] - 2022-08-01 + +### Added + +- Add support for Schema Files format 1.1.x (metric "split" transform) with the new `go.opentelemetry.io/otel/schema/v1.1` package. (#2999) +- Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. + The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) +- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. + The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) +- Add the `http.method` attribute to HTTP server metric from all `go.opentelemetry.io/otel/semconv/*` packages. (#3018) + +### Fixed + +- Invalid warning for context setup being deferred in `go.opentelemetry.io/otel/bridge/opentracing` package. (#3029) + +## [1.8.0/0.31.0] - 2022-07-08 + +### Added + +- Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods +of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) + +### Changed + +- The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) +- In the `go.opentelemetry.io/otel/sdk/instrumentation` package rename `Library` to `Scope` and alias `Library` as `Scope` (#2976) +- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) + +### Removed + +- Support for go1.16. Support is now only for go1.17 and go1.18 (#2917) + +### Deprecated + +- The `Library` struct in the `go.opentelemetry.io/otel/sdk/instrumentation` package is deprecated. + Use the equivalent `Scope` struct instead. (#2977) +- The `ReadOnlySpan.InstrumentationLibrary` method from the `go.opentelemetry.io/otel/sdk/trace` package is deprecated. + Use the equivalent `ReadOnlySpan.InstrumentationScope` method instead. (#2977) + +## [1.7.0/0.30.0] - 2022-04-28 + +### Added + +- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. + The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) +- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. + The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) +- Add the `go.opentelemetry.io/otel/semconv/v1.10.0` package. + The package contains semantic conventions from the `v1.10.0` version of the OpenTelemetry specification. (#2842) +- Added an in-memory exporter to metrictest to aid testing with a full SDK. (#2776) + +### Fixed + +- Globally delegated instruments are unwrapped before delegating asynchronous callbacks. (#2784) +- Remove import of `testing` package in non-tests builds of the `go.opentelemetry.io/otel` package. (#2786) + +### Changed + +- The `WithLabelEncoder` option from the `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` package is renamed to `WithAttributeEncoder`. (#2790) +- The `LabelFilterSelector` interface from `go.opentelemetry.io/otel/sdk/metric/processor/reducer` is renamed to `AttributeFilterSelector`. + The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) +- The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. + Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) + +### Deprecated + +- The `Iterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.Attribute` method instead. (#2790) +- The `Iterator.IndexedLabel` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.IndexedAttribute` method instead. (#2790) +- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `MergeIterator.Attribute` method instead. (#2790) + +### Removed + +- Removed the `Batch` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) +- Removed the `Measurement` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) + +## [0.29.0] - 2022-04-11 + +### Added + +- The metrics global package was added back into several test files. (#2764) +- The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. + This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) + +### Removed + +- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) + +### Changed + +- Don't panic anymore when setting a global MeterProvider to itself. (#2749) +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) + +## [1.6.3] - 2022-04-07 + +### Fixed + +- Allow non-comparable global `MeterProvider`, `TracerProvider`, and `TextMapPropagator` types to be set. (#2772, #2773) + +## [1.6.2] - 2022-04-06 + +### Changed + +- Don't panic anymore when setting a global TracerProvider or TextMapPropagator to itself. (#2749) +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) + +## [1.6.1] - 2022-03-28 + +### Fixed + +- The `go.opentelemetry.io/otel/schema/*` packages now use the correct schema URL for their `SchemaURL` constant. + Instead of using `"https://opentelemetry.io/schemas/v"` they now use the correct URL without a `v` prefix, `"https://opentelemetry.io/schemas/"`. (#2743, #2744) + +### Security + +- Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. + This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #2728) + +## [1.6.0/0.28.0] - 2022-03-23 + +### ⚠️ Notice ⚠️ + +This update is a breaking change of the unstable Metrics API. +Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be modified. + +### Added + +- Add metrics exponential histogram support. + New mapping functions have been made available in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take dependencies on. (#2502) +- Add Go 1.18 to our compatibility tests. (#2679) +- Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) +- Add the `metric/global` for obtaining and setting the global `MeterProvider`. (#2660) + +### Changed + +- The metrics API has been significantly changed to match the revised OpenTelemetry specification. + High-level changes include: + + - Synchronous and asynchronous instruments are now handled by independent `InstrumentProvider`s. + These `InstrumentProvider`s are managed with a `Meter`. + - Synchronous and asynchronous instruments are grouped into their own packages based on value types. + - Asynchronous callbacks can now be registered with a `Meter`. + + Be sure to check out the metric module documentation for more information on how to use the revised API. (#2587, #2660) + +### Fixed + +- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) + +## [1.5.0] - 2022-03-16 + +### Added + +- Log the Exporters configuration in the TracerProviders message. (#2578) +- Added support to configure the span limits with environment variables. + The following environment variables are supported. (#2606, #2637) + - `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` + - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` + - `OTEL_SPAN_EVENT_COUNT_LIMIT` + - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` + - `OTEL_SPAN_LINK_COUNT_LIMIT` + - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` + + If the provided environment variables are invalid (negative), the default values would be used. +- Rename the `gc` runtime name to `go` (#2560) +- Add resource container ID detection. (#2418) +- Add span attribute value length limit. + The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. + The default limit for this resource is "unlimited". (#2637) +- Add the `WithRawSpanLimits` option to `go.opentelemetry.io/otel/sdk/trace`. + This option replaces the `WithSpanLimits` option. + Zero or negative values will not be changed to the default value like `WithSpanLimits` does. + Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. + Consequentially, limits should be constructed using `NewSpanLimits` and updated accordingly. (#2637) + +### Changed + +- Drop oldest tracestate `Member` when capacity is reached. (#2592) +- Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` configuration. (#2639) +- Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) +- Introduce new internal `envconfig` package for OTLP exporters. (#2608) +- If `http.Request.Host` is empty, fall back to use `URL.Host` when populating `http.host` in the `semconv` packages. (#2661) + +### Fixed + +- Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) +- Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) +- Unlimited span limits are now supported (negative values). (#2636, #2637) + +### Deprecated + +- Deprecated `"go.opentelemetry.io/otel/sdk/trace".WithSpanLimits`. + Use `WithRawSpanLimits` instead. + That option allows setting unlimited and zero limits, this option does not. + This option will be kept until the next major version incremented release. (#2637) + +## [1.4.1] - 2022-02-16 + +### Fixed + +- Fix race condition in reading the dropped spans number for the `BatchSpanProcessor`. (#2615) + +## [1.4.0] - 2022-02-11 + +### Added + +- Use `OTEL_EXPORTER_ZIPKIN_ENDPOINT` environment variable to specify zipkin collector endpoint. (#2490) +- Log the configuration of `TracerProvider`s, and `Tracer`s for debugging. + To enable use a logger with Verbosity (V level) `>=1`. (#2500) +- Added support to configure the batch span-processor with environment variables. + The following environment variables are used. (#2515) + - `OTEL_BSP_SCHEDULE_DELAY` + - `OTEL_BSP_EXPORT_TIMEOUT` + - `OTEL_BSP_MAX_QUEUE_SIZE`. + - `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` + +### Changed + +- Zipkin exporter exports `Resource` attributes in the `Tags` field. (#2589) + +### Deprecated + +- Deprecate module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2382) +- Deprecate `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets`. (#2445) + +### Fixed + +- Fixed the instrument kind for noop async instruments to correctly report an implementation. (#2461) +- Fix UDP packets overflowing with Jaeger payloads. (#2489, #2512) +- Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) +- Specify explicit buckets in Prometheus example, fixing issue where example only has `+inf` bucket. (#2419, #2493) +- W3C baggage will now decode urlescaped values. (#2529) +- Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) +- The order attributes are dropped from spans in the `go.opentelemetry.io/otel/sdk/trace` package when capacity is reached is fixed to be in compliance with the OpenTelemetry specification. + Instead of dropping the least-recently-used attribute, the last added attribute is dropped. + This drop order still only applies to attributes with unique keys not already contained in the span. + If an attribute is added with a key already contained in the span, that attribute is updated to the new value being added. (#2576) + +### Removed + +- Updated `go.opentelemetry.io/proto/otlp` from `v0.11.0` to `v0.12.0`. This version removes a number of deprecated methods. (#2546) + - [`Metric.GetIntGauge()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntGauge) + - [`Metric.GetIntHistogram()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntHistogram) + - [`Metric.GetIntSum()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntSum) + +## [1.3.0] - 2021-12-10 + +### ⚠️ Notice ⚠️ + +We have updated the project minimum supported Go version to 1.16 + +### Added + +- Added an internal Logger. + This can be used by the SDK and API to provide users with feedback of the internal state. + To enable verbose logs configure the logger which will print V(1) logs. For debugging information configure to print V(5) logs. (#2343) +- Add the `WithRetry` `Option` and the `RetryConfig` type to the `go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp` package to specify retry behavior consistently. (#2425) +- Add `SpanStatusFromHTTPStatusCodeAndSpanKind` to all `semconv` packages to return a span status code similar to `SpanStatusFromHTTPStatusCode`, but exclude `4XX` HTTP errors as span errors if the span is of server kind. (#2296) + +### Changed + +- The `"go.opentelemetry.io/otel/exporter/otel/otlptrace/otlptracegrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2329) +- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".Client` now uses the underlying gRPC `ClientConn` to handle name resolution, TCP connection establishment (with retries and backoff) and TLS handshakes, and handling errors on established connections by re-resolving the name and reconnecting. (#2425) +- The `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetricgrpc".RetrySettings` type is renamed to `RetryConfig`. (#2425) +- The `go.opentelemetry.io/otel/exporter/otel/*` gRPC exporters now default to using the host's root CA set if none are provided by the user and `WithInsecure` is not specified. (#2432) +- Change `resource.Default` to be evaluated the first time it is called, rather than on import. This allows the caller the option to update `OTEL_RESOURCE_ATTRIBUTES` first, such as with `os.Setenv`. (#2371) + +### Fixed + +- The `go.opentelemetry.io/otel/exporter/otel/*` exporters are updated to handle per-signal and universal endpoints according to the OpenTelemetry specification. + Any per-signal endpoint set via an `OTEL_EXPORTER_OTLP__ENDPOINT` environment variable is now used without modification of the path. + When `OTEL_EXPORTER_OTLP_ENDPOINT` is set, if it contains a path, that path is used as a base path which per-signal paths are appended to. (#2433) +- Basic metric controller updated to use sync.Map to avoid blocking calls (#2381) +- The `go.opentelemetry.io/otel/exporter/jaeger` correctly sets the `otel.status_code` value to be a string of `ERROR` or `OK` instead of an integer code. (#2439, #2440) + +### Deprecated + +- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithMaxAttempts` `Option`, use the new `WithRetry` `Option` instead. (#2425) +- Deprecated the `"go.opentelemetry.io/otel/exporter/otel/otlpmetric/otlpmetrichttp".WithBackoff` `Option`, use the new `WithRetry` `Option` instead. (#2425) + +### Removed + +- Remove the metric Processor's ability to convert cumulative to delta aggregation temporality. (#2350) +- Remove the metric Bound Instruments interface and implementations. (#2399) +- Remove the metric MinMaxSumCount kind aggregation and the corresponding OTLP export path. (#2423) +- Metric SDK removes the "exact" aggregator for histogram instruments, as it performed a non-standard aggregation for OTLP export (creating repeated Gauge points) and worked its way into a number of confusing examples. (#2348) + +## [1.2.0] - 2021-11-12 + +### Changed + +- Metric SDK `export.ExportKind`, `export.ExportKindSelector` types have been renamed to `aggregation.Temporality` and `aggregation.TemporalitySelector` respectively to keep in line with current specification and protocol along with built-in selectors (e.g., `aggregation.CumulativeTemporalitySelector`, ...). (#2274) +- The Metric `Exporter` interface now requires a `TemporalitySelector` method instead of an `ExportKindSelector`. (#2274) +- Metrics API cleanup. The `metric/sdkapi` package has been created to relocate the API-to-SDK interface: + - The following interface types simply moved from `metric` to `metric/sdkapi`: `Descriptor`, `MeterImpl`, `InstrumentImpl`, `SyncImpl`, `BoundSyncImpl`, `AsyncImpl`, `AsyncRunner`, `AsyncSingleRunner`, and `AsyncBatchRunner` + - The following struct types moved and are replaced with type aliases, since they are exposed to the user: `Observation`, `Measurement`. + - The No-op implementations of sync and async instruments are no longer exported, new functions `sdkapi.NewNoopAsyncInstrument()` and `sdkapi.NewNoopSyncInstrument()` are provided instead. (#2271) +- Update the SDK `BatchSpanProcessor` to export all queued spans when `ForceFlush` is called. (#2080, #2335) + +### Added + +- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) +- Added a new `schema` module to help parse Schema Files in OTEP 0152 format. (#2267) +- Added a new `MapCarrier` to the `go.opentelemetry.io/otel/propagation` package to hold propagated cross-cutting concerns as a `map[string]string` held in memory. (#2334) + +## [1.1.0] - 2021-10-27 + +### Added + +- Add the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".WithGRPCConn` option so the exporter can reuse an existing gRPC connection. (#2002) +- Add the `go.opentelemetry.io/otel/semconv/v1.7.0` package. + The package contains semantic conventions from the `v1.7.0` version of the OpenTelemetry specification. (#2320) +- Add the `go.opentelemetry.io/otel/semconv/v1.6.1` package. + The package contains semantic conventions from the `v1.6.1` version of the OpenTelemetry specification. (#2321) +- Add the `go.opentelemetry.io/otel/semconv/v1.5.0` package. + The package contains semantic conventions from the `v1.5.0` version of the OpenTelemetry specification. (#2322) + - When upgrading from the `semconv/v1.4.0` package note the following name changes: + - `K8SReplicasetUIDKey` -> `K8SReplicaSetUIDKey` + - `K8SReplicasetNameKey` -> `K8SReplicaSetNameKey` + - `K8SStatefulsetUIDKey` -> `K8SStatefulSetUIDKey` + - `k8SStatefulsetNameKey` -> `K8SStatefulSetNameKey` + - `K8SDaemonsetUIDKey` -> `K8SDaemonSetUIDKey` + - `K8SDaemonsetNameKey` -> `K8SDaemonSetNameKey` + +### Changed + +- Links added to a span will be dropped by the SDK if they contain an invalid span context (#2275). + +### Fixed + +- The `"go.opentelemetry.io/otel/semconv/v1.4.0".HTTPServerAttributesFromHTTPRequest` now correctly only sets the HTTP client IP attribute even if the connection was routed with proxies and there are multiple addresses in the `X-Forwarded-For` header. (#2282, #2284) +- The `"go.opentelemetry.io/otel/semconv/v1.4.0".NetAttributesFromHTTPRequest` function correctly handles IPv6 addresses as IP addresses and sets the correct net peer IP instead of the net peer hostname attribute. (#2283, #2285) +- The simple span processor shutdown method deterministically returns the exporter error status if it simultaneously finishes when the deadline is reached. (#2290, #2289) + +## [1.0.1] - 2021-10-01 + +### Fixed + +- json stdout exporter no longer crashes due to concurrency bug. (#2265) + +## [Metrics 0.24.0] - 2021-10-01 + +### Changed + +- NoopMeterProvider is now private and NewNoopMeterProvider must be used to obtain a noopMeterProvider. (#2237) +- The Metric SDK `Export()` function takes a new two-level reader interface for iterating over results one instrumentation library at a time. (#2197) + - The former `"go.opentelemetry.io/otel/sdk/export/metric".CheckpointSet` is renamed `Reader`. + - The new interface is named `"go.opentelemetry.io/otel/sdk/export/metric".InstrumentationLibraryReader`. + +## [1.0.0] - 2021-09-20 + +This is the first stable release for the project. +This release includes an API and SDK for the tracing signal that will comply with the stability guarantees defined by the projects [versioning policy](./VERSIONING.md). + +### Added + +- OTLP trace exporter now sets the `SchemaURL` field in the exported telemetry if the Tracer has `WithSchemaURL` option. (#2242) + +### Fixed + +- Slice-valued attributes can correctly be used as map keys. (#2223) + +### Removed + +- Removed the `"go.opentelemetry.io/otel/exporters/zipkin".WithSDKOptions` function. (#2248) +- Removed the deprecated package `go.opentelemetry.io/otel/oteltest`. (#2234) +- Removed the deprecated package `go.opentelemetry.io/otel/bridge/opencensus/utils`. (#2233) +- Removed deprecated functions, types, and methods from `go.opentelemetry.io/otel/attribute` package. + Use the typed functions and methods added to the package instead. (#2235) + - The `Key.Array` method is removed. + - The `Array` function is removed. + - The `Any` function is removed. + - The `ArrayValue` function is removed. + - The `AsArray` function is removed. + +## [1.0.0-RC3] - 2021-09-02 + +### Added + +- Added `ErrorHandlerFunc` to use a function as an `"go.opentelemetry.io/otel".ErrorHandler`. (#2149) +- Added `"go.opentelemetry.io/otel/trace".WithStackTrace` option to add a stack trace when using `span.RecordError` or when panic is handled in `span.End`. (#2163) +- Added typed slice attribute types and functionality to the `go.opentelemetry.io/otel/attribute` package to replace the existing array type and functions. (#2162) + - `BoolSlice`, `IntSlice`, `Int64Slice`, `Float64Slice`, and `StringSlice` replace the use of the `Array` function in the package. +- Added the `go.opentelemetry.io/otel/example/fib` example package. + Included is an example application that computes Fibonacci numbers. (#2203) + +### Changed + +- Metric instruments have been renamed to match the (feature-frozen) metric API specification: + - ValueRecorder becomes Histogram + - ValueObserver becomes Gauge + - SumObserver becomes CounterObserver + - UpDownSumObserver becomes UpDownCounterObserver + The API exported from this project is still considered experimental. (#2202) +- Metric SDK/API implementation type `InstrumentKind` moves into `sdkapi` sub-package. (#2091) +- The Metrics SDK export record no longer contains a Resource pointer, the SDK `"go.opentelemetry.io/otel/sdk/trace/export/metric".Exporter.Export()` function for push-based exporters now takes a single Resource argument, pull-based exporters use `"go.opentelemetry.io/otel/sdk/metric/controller/basic".Controller.Resource()`. (#2120) +- The JSON output of the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` is harmonized now such that the output is "plain" JSON objects after each other of the form `{ ... } { ... } { ... }`. Earlier the JSON objects describing a span were wrapped in a slice for each `Exporter.ExportSpans` call, like `[ { ... } ][ { ... } { ... } ]`. Outputting JSON object directly after each other is consistent with JSON loggers, and a bit easier to parse and read. (#2196) +- Update the `NewTracerConfig`, `NewSpanStartConfig`, `NewSpanEndConfig`, and `NewEventConfig` function in the `go.opentelemetry.io/otel/trace` package to return their respective configurations as structs instead of pointers to the struct. (#2212) + +### Deprecated + +- The `go.opentelemetry.io/otel/bridge/opencensus/utils` package is deprecated. + All functionality from this package now exists in the `go.opentelemetry.io/otel/bridge/opencensus` package. + The functions from that package should be used instead. (#2166) +- The `"go.opentelemetry.io/otel/attribute".Array` function and the related `ARRAY` value type is deprecated. + Use the typed `*Slice` functions and types added to the package instead. (#2162) +- The `"go.opentelemetry.io/otel/attribute".Any` function is deprecated. + Use the typed functions instead. (#2181) +- The `go.opentelemetry.io/otel/oteltest` package is deprecated. + The `"go.opentelemetry.io/otel/sdk/trace/tracetest".SpanRecorder` can be registered with the default SDK (`go.opentelemetry.io/otel/sdk/trace`) as a `SpanProcessor` and used as a replacement for this deprecated package. (#2188) + +### Removed + +- Removed metrics test package `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#2105) + +### Fixed + +- The `fromEnv` detector no longer throws an error when `OTEL_RESOURCE_ATTRIBUTES` environment variable is not set or empty. (#2138) +- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) +- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) +- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) +- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195) +- Fixed typos in resources.go. (#2201) + +## [1.0.0-RC2] - 2021-07-26 + +### Added + +- Added `WithOSDescription` resource configuration option to set OS (Operating System) description resource attribute (`os.description`). (#1840) +- Added `WithOS` resource configuration option to set all OS (Operating System) resource attributes at once. (#1840) +- Added the `WithRetry` option to the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. + This option is a replacement for the removed `WithMaxAttempts` and `WithBackoff` options. (#2095) +- Added API `LinkFromContext` to return Link which encapsulates SpanContext from provided context and also encapsulates attributes. (#2115) +- Added a new `Link` type under the SDK `otel/sdk/trace` package that counts the number of attributes that were dropped for surpassing the `AttributePerLinkCountLimit` configured in the Span's `SpanLimits`. + This new type replaces the equal-named API `Link` type found in the `otel/trace` package for most usages within the SDK. + For example, instances of this type are now returned by the `Links()` function of `ReadOnlySpan`s provided in places like the `OnEnd` function of `SpanProcessor` implementations. (#2118) +- Added the `SpanRecorder` type to the `go.opentelemetry.io/otel/skd/trace/tracetest` package. + This type can be used with the default SDK as a `SpanProcessor` during testing. (#2132) + +### Changed + +- The `SpanModels` function is now exported from the `go.opentelemetry.io/otel/exporters/zipkin` package to convert OpenTelemetry spans into Zipkin model spans. (#2027) +- Rename the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".RetrySettings` to `RetryConfig`. (#2095) + +### Deprecated + +- The `TextMapCarrier` and `TextMapPropagator` from the `go.opentelemetry.io/otel/oteltest` package and their associated creation functions (`TextMapCarrier`, `NewTextMapPropagator`) are deprecated. (#2114) +- The `Harness` type from the `go.opentelemetry.io/otel/oteltest` package and its associated creation function, `NewHarness` are deprecated and will be removed in the next release. (#2123) +- The `TraceStateFromKeyValues` function from the `go.opentelemetry.io/otel/oteltest` package is deprecated. + Use the `trace.ParseTraceState` function instead. (#2122) + +### Removed + +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/jaeger`. (#2020) +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/trace/zipkin`. (#2020) +- Removed the `"go.opentelemetry.io/otel/sdk/resource".WithBuiltinDetectors` function. + The explicit `With*` options for every built-in detector should be used instead. (#2026 #2097) +- Removed the `WithMaxAttempts` and `WithBackoff` options from the `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` package. + The retry logic of the package has been updated to match the `otlptracegrpc` package and accordingly a `WithRetry` option is added that should be used instead. (#2095) +- Removed `DroppedAttributeCount` field from `otel/trace.Link` struct. (#2118) + +### Fixed + +- When using WithNewRoot, don't use the parent context for making sampling decisions. (#2032) +- `oteltest.Tracer` now creates a valid `SpanContext` when using `WithNewRoot`. (#2073) +- OS type detector now sets the correct `dragonflybsd` value for DragonFly BSD. (#2092) +- The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package. + This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102) +- The `Inject` method for the `"go.opentelemetry.io/otel/propagation".TraceContext` type no longer injects empty `tracestate` values. (#2108) +- Use `6831` as default Jaeger agent port instead of `6832`. (#2131) + +## [Experimental Metrics v0.22.0] - 2021-07-19 + +### Added + +- Adds HTTP support for OTLP metrics exporter. (#2022) + +### Removed + +- Removed the deprecated package `go.opentelemetry.io/otel/exporters/metric/prometheus`. (#2020) + +## [1.0.0-RC1] / 0.21.0 - 2021-06-18 + +With this release we are introducing a split in module versions. The tracing API and SDK are entering the `v1.0.0` Release Candidate phase with `v1.0.0-RC1` +while the experimental metrics API and SDK continue with `v0.x` releases at `v0.21.0`. Modules at major version 1 or greater will not depend on modules +with major version 0. + +### Added + +- Adds `otlpgrpc.WithRetry`option for configuring the retry policy for transient errors on the otlp/gRPC exporter. (#1832) + - The following status codes are defined as transient errors: + | gRPC Status Code | Description | + | ---------------- | ----------- | + | 1 | Cancelled | + | 4 | Deadline Exceeded | + | 8 | Resource Exhausted | + | 10 | Aborted | + | 10 | Out of Range | + | 14 | Unavailable | + | 15 | Data Loss | +- Added `Status` type to the `go.opentelemetry.io/otel/sdk/trace` package to represent the status of a span. (#1874) +- Added `SpanStub` type and its associated functions to the `go.opentelemetry.io/otel/sdk/trace/tracetest` package. + This type can be used as a testing replacement for the `SpanSnapshot` that was removed from the `go.opentelemetry.io/otel/sdk/trace` package. (#1873) +- Adds support for scheme in `OTEL_EXPORTER_OTLP_ENDPOINT` according to the spec. (#1886) +- Adds `trace.WithSchemaURL` option for configuring the tracer with a Schema URL. (#1889) +- Added an example of using OpenTelemetry Go as a trace context forwarder. (#1912) +- `ParseTraceState` is added to the `go.opentelemetry.io/otel/trace` package. + It can be used to decode a `TraceState` from a `tracestate` header string value. (#1937) +- Added `Len` method to the `TraceState` type in the `go.opentelemetry.io/otel/trace` package. + This method returns the number of list-members the `TraceState` holds. (#1937) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace` that defines a trace exporter that uses a `otlptrace.Client` to send data. + Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` implementing a gRPC `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing .(#1922) +- Added `Baggage`, `Member`, and `Property` types to the `go.opentelemetry.io/otel/baggage` package along with their related functions. (#1967) +- Added `ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext` functions to the `go.opentelemetry.io/otel/baggage` package. + These functions replace the `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions from that package and directly work with the new `Baggage` type. (#1967) +- The `OTEL_SERVICE_NAME` environment variable is the preferred source for `service.name`, used by the environment resource detector if a service name is present both there and in `OTEL_RESOURCE_ATTRIBUTES`. (#1969) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` implementing an HTTP `otlptrace.Client` and offers convenience functions, `NewExportPipeline` and `InstallNewPipeline`, to setup and install a `otlptrace.Exporter` in tracing. (#1963) +- Changes `go.opentelemetry.io/otel/sdk/resource.NewWithAttributes` to require a schema URL. The old function is still available as `resource.NewSchemaless`. This is a breaking change. (#1938) +- Several builtin resource detectors now correctly populate the schema URL. (#1938) +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` that defines a metrics exporter that uses a `otlpmetric.Client` to send data. +- Creates package `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` implementing a gRPC `otlpmetric.Client` and offers convenience functions, `New` and `NewUnstarted`, to create an `otlpmetric.Exporter`.(#1991) +- Added `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter. (#2005) +- Added `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` exporter. (#2005) +- Added a `TracerProvider()` method to the `"go.opentelemetry.io/otel/trace".Span` interface. This can be used to obtain a `TracerProvider` from a given span that utilizes the same trace processing pipeline. (#2009) + +### Changed + +- Make `NewSplitDriver` from `go.opentelemetry.io/otel/exporters/otlp` take variadic arguments instead of a `SplitConfig` item. + `NewSplitDriver` now automatically implements an internal `noopDriver` for `SplitConfig` fields that are not initialized. (#1798) +- `resource.New()` now creates a Resource without builtin detectors. Previous behavior is now achieved by using `WithBuiltinDetectors` Option. (#1810) +- Move the `Event` type from the `go.opentelemetry.io/otel` package to the `go.opentelemetry.io/otel/sdk/trace` package. (#1846) +- CI builds validate against last two versions of Go, dropping 1.14 and adding 1.16. (#1865) +- BatchSpanProcessor now report export failures when calling `ForceFlush()` method. (#1860) +- `Set.Encoded(Encoder)` no longer caches the result of an encoding. (#1855) +- Renamed `CloudZoneKey` to `CloudAvailabilityZoneKey` in Resource semantic conventions according to spec. (#1871) +- The `StatusCode` and `StatusMessage` methods of the `ReadOnlySpan` interface and the `Span` produced by the `go.opentelemetry.io/otel/sdk/trace` package have been replaced with a single `Status` method. + This method returns the status of a span using the new `Status` type. (#1874) +- Updated `ExportSpans` method of the`SpanExporter` interface type to accept `ReadOnlySpan`s instead of the removed `SpanSnapshot`. + This brings the export interface into compliance with the specification in that it now accepts an explicitly immutable type instead of just an implied one. (#1873) +- Unembed `SpanContext` in `Link`. (#1877) +- Generate Semantic conventions from the specification YAML. (#1891) +- Spans created by the global `Tracer` obtained from `go.opentelemetry.io/otel`, prior to a functioning `TracerProvider` being set, now propagate the span context from their parent if one exists. (#1901) +- The `"go.opentelemetry.io/otel".Tracer` function now accepts tracer options. (#1902) +- Move the `go.opentelemetry.io/otel/unit` package to `go.opentelemetry.io/otel/metric/unit`. (#1903) +- Changed `go.opentelemetry.io/otel/trace.TracerConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config.) (#1921) +- Changed `go.opentelemetry.io/otel/trace.SpanConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Changed `span.End()` now only accepts Options that are allowed at `End()`. (#1921) +- Changed `go.opentelemetry.io/otel/metric.InstrumentConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Changed `go.opentelemetry.io/otel/metric.MeterConfig` to conform to the [Contributing guidelines](CONTRIBUTING.md#config). (#1921) +- Refactored option types according to the contribution style guide. (#1882) +- Move the `go.opentelemetry.io/otel/trace.TraceStateFromKeyValues` function to the `go.opentelemetry.io/otel/oteltest` package. + This function is preserved for testing purposes where it may be useful to create a `TraceState` from `attribute.KeyValue`s, but it is not intended for production use. + The new `ParseTraceState` function should be used to create a `TraceState`. (#1931) +- Updated `MarshalJSON` method of the `go.opentelemetry.io/otel/trace.TraceState` type to marshal the type into the string representation of the `TraceState`. (#1931) +- The `TraceState.Delete` method from the `go.opentelemetry.io/otel/trace` package no longer returns an error in addition to a `TraceState`. (#1931) +- Updated `Get` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) +- Updated `Insert` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a pair of `string`s instead of an `attribute.KeyValue` type. (#1931) +- Updated `Delete` method of the `TraceState` type from the `go.opentelemetry.io/otel/trace` package to accept a `string` instead of an `attribute.Key` type. (#1931) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/stdout` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/metric/prometheus` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1985) +- Renamed `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) +- Renamed `NewUnstartedExporter` to `NewUnstarted` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) +- The `go.opentelemetry.io/otel/semconv` package has been moved to `go.opentelemetry.io/otel/semconv/v1.4.0` to allow for multiple [telemetry schema](https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md) versions to be used concurrently. (#1987) +- Metrics test helpers in `go.opentelemetry.io/otel/oteltest` have been moved to `go.opentelemetry.io/otel/metric/metrictest`. (#1988) + +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/metric/prometheus` is deprecated, use `go.opentelemetry.io/otel/exporters/prometheus` instead. (#1993) +- The `go.opentelemetry.io/otel/exporters/trace/jaeger` is deprecated, use `go.opentelemetry.io/otel/exporters/jaeger` instead. (#1993) +- The `go.opentelemetry.io/otel/exporters/trace/zipkin` is deprecated, use `go.opentelemetry.io/otel/exporters/zipkin` instead. (#1993) + +### Removed + +- Removed `resource.WithoutBuiltin()`. Use `resource.New()`. (#1810) +- Unexported types `resource.FromEnv`, `resource.Host`, and `resource.TelemetrySDK`, Use the corresponding `With*()` to use individually. (#1810) +- Removed the `Tracer` and `IsRecording` method from the `ReadOnlySpan` in the `go.opentelemetry.io/otel/sdk/trace`. + The `Tracer` method is not a required to be included in this interface and given the mutable nature of the tracer that is associated with a span, this method is not appropriate. + The `IsRecording` method returns if the span is recording or not. + A read-only span value does not need to know if updates to it will be recorded or not. + By definition, it cannot be updated so there is no point in communicating if an update is recorded. (#1873) +- Removed the `SpanSnapshot` type from the `go.opentelemetry.io/otel/sdk/trace` package. + The use of this type has been replaced with the use of the explicitly immutable `ReadOnlySpan` type. + When a concrete representation of a read-only span is needed for testing, the newly added `SpanStub` in the `go.opentelemetry.io/otel/sdk/trace/tracetest` package should be used. (#1873) +- Removed the `Tracer` method from the `Span` interface in the `go.opentelemetry.io/otel/trace` package. + Using the same tracer that created a span introduces the error where an instrumentation library's `Tracer` is used by other code instead of their own. + The `"go.opentelemetry.io/otel".Tracer` function or a `TracerProvider` should be used to acquire a library specific `Tracer` instead. (#1900) + - The `TracerProvider()` method on the `Span` interface may also be used to obtain a `TracerProvider` using the same trace processing pipeline. (#2009) +- The `http.url` attribute generated by `HTTPClientAttributesFromHTTPRequest` will no longer include username or password information. (#1919) +- Removed `IsEmpty` method of the `TraceState` type in the `go.opentelemetry.io/otel/trace` package in favor of using the added `TraceState.Len` method. (#1931) +- Removed `Set`, `Value`, `ContextWithValue`, `ContextWithoutValue`, and `ContextWithEmpty` functions in the `go.opentelemetry.io/otel/baggage` package. + Handling of baggage is now done using the added `Baggage` type and related context functions (`ContextWithBaggage`, `ContextWithoutBaggage`, and `FromContext`) in that package. (#1967) +- The `InstallNewPipeline` and `NewExportPipeline` creation functions in all the exporters (prometheus, otlp, stdout, jaeger, and zipkin) have been removed. + These functions were deemed premature attempts to provide convenience that did not achieve this aim. (#1985) +- The `go.opentelemetry.io/otel/exporters/otlp` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace` instead. (#1990) +- The `go.opentelemetry.io/otel/exporters/stdout` exporter has been removed. Use `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` or `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` instead. (#2005) + +### Fixed + +- Only report errors from the `"go.opentelemetry.io/otel/sdk/resource".Environment` function when they are not `nil`. (#1850, #1851) +- The `Shutdown` method of the simple `SpanProcessor` in the `go.opentelemetry.io/otel/sdk/trace` package now honors the context deadline or cancellation. (#1616, #1856) +- BatchSpanProcessor now drops span batches that failed to be exported. (#1860) +- Use `http://localhost:14268/api/traces` as default Jaeger collector endpoint instead of `http://localhost:14250`. (#1898) +- Allow trailing and leading whitespace in the parsing of a `tracestate` header. (#1931) +- Add logic to determine if the channel is closed to fix Jaeger exporter test panic with close closed channel. (#1870, #1973) +- Avoid transport security when OTLP endpoint is a Unix socket. (#2001) + +### Security + +## [0.20.0] - 2021-04-23 + +### Added + +- The OTLP exporter now has two new convenience functions, `NewExportPipeline` and `InstallNewPipeline`, setup and install the exporter in tracing and metrics pipelines. (#1373) +- Adds semantic conventions for exceptions. (#1492) +- Added Jaeger Environment variables: `OTEL_EXPORTER_JAEGER_AGENT_HOST`, `OTEL_EXPORTER_JAEGER_AGENT_PORT` + These environment variables can be used to override Jaeger agent hostname and port (#1752) +- Option `ExportTimeout` was added to batch span processor. (#1755) +- `trace.TraceFlags` is now a defined type over `byte` and `WithSampled(bool) TraceFlags` and `IsSampled() bool` methods have been added to it. (#1770) +- The `Event` and `Link` struct types from the `go.opentelemetry.io/otel` package now include a `DroppedAttributeCount` field to record the number of attributes that were not recorded due to configured limits being reached. (#1771) +- The Jaeger exporter now reports dropped attributes for a Span event in the exported log. (#1771) +- Adds test to check BatchSpanProcessor ignores `OnEnd` and `ForceFlush` post `Shutdown`. (#1772) +- Extract resource attributes from the `OTEL_RESOURCE_ATTRIBUTES` environment variable and merge them with the `resource.Default` resource as well as resources provided to the `TracerProvider` and metric `Controller`. (#1785) +- Added `WithOSType` resource configuration option to set OS (Operating System) type resource attribute (`os.type`). (#1788) +- Added `WithProcess*` resource configuration options to set Process resource attributes. (#1788) + - `process.pid` + - `process.executable.name` + - `process.executable.path` + - `process.command_args` + - `process.owner` + - `process.runtime.name` + - `process.runtime.version` + - `process.runtime.description` +- Adds `k8s.node.name` and `k8s.node.uid` attribute keys to the `semconv` package. (#1789) +- Added support for configuring OTLP/HTTP and OTLP/gRPC Endpoints, TLS Certificates, Headers, Compression and Timeout via Environment Variables. (#1758, #1769 and #1811) + - `OTEL_EXPORTER_OTLP_ENDPOINT` + - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` + - `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` + - `OTEL_EXPORTER_OTLP_HEADERS` + - `OTEL_EXPORTER_OTLP_TRACES_HEADERS` + - `OTEL_EXPORTER_OTLP_METRICS_HEADERS` + - `OTEL_EXPORTER_OTLP_COMPRESSION` + - `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` + - `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` + - `OTEL_EXPORTER_OTLP_TIMEOUT` + - `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` + - `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` + - `OTEL_EXPORTER_OTLP_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE` +- Adds `otlpgrpc.WithTimeout` option for configuring timeout to the otlp/gRPC exporter. (#1821) +- Adds `jaeger.WithMaxPacketSize` option for configuring maximum UDP packet size used when connecting to the Jaeger agent. (#1853) + +### Fixed + +- The `Span.IsRecording` implementation from `go.opentelemetry.io/otel/sdk/trace` always returns false when not being sampled. (#1750) +- The Jaeger exporter now correctly sets tags for the Span status code and message. + This means it uses the correct tag keys (`"otel.status_code"`, `"otel.status_description"`) and does not set the status message as a tag unless it is set on the span. (#1761) +- The Jaeger exporter now correctly records Span event's names using the `"event"` key for a tag. + Additionally, this tag is overridden, as specified in the OTel specification, if the event contains an attribute with that key. (#1768) +- Zipkin Exporter: Ensure mapping between OTel and Zipkin span data complies with the specification. (#1688) +- Fixed typo for default service name in Jaeger Exporter. (#1797) +- Fix flaky OTLP for the reconnnection of the client connection. (#1527, #1814) +- Fix Jaeger exporter dropping of span batches that exceed the UDP packet size limit. + Instead, the exporter now splits the batch into smaller sendable batches. (#1828) + +### Changed + +- Span `RecordError` now records an `exception` event to comply with the semantic convention specification. (#1492) +- Jaeger exporter was updated to use thrift v0.14.1. (#1712) +- Migrate from using internally built and maintained version of the OTLP to the one hosted at `go.opentelemetry.io/proto/otlp`. (#1713) +- Migrate from using `github.com/gogo/protobuf` to `google.golang.org/protobuf` to match `go.opentelemetry.io/proto/otlp`. (#1713) +- The storage of a local or remote Span in a `context.Context` using its SpanContext is unified to store just the current Span. + The Span's SpanContext can now self-identify as being remote or not. + This means that `"go.opentelemetry.io/otel/trace".ContextWithRemoteSpanContext` will now overwrite any existing current Span, not just existing remote Spans, and make it the current Span in a `context.Context`. (#1731) +- Improve OTLP/gRPC exporter connection errors. (#1737) +- Information about a parent span context in a `"go.opentelemetry.io/otel/export/trace".SpanSnapshot` is unified in a new `Parent` field. + The existing `ParentSpanID` and `HasRemoteParent` fields are removed in favor of this. (#1748) +- The `ParentContext` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is updated to hold a `context.Context` containing the parent span. + This changes it to make `SamplingParameters` conform with the OpenTelemetry specification. (#1749) +- Updated Jaeger Environment Variables: `JAEGER_ENDPOINT`, `JAEGER_USER`, `JAEGER_PASSWORD` + to `OTEL_EXPORTER_JAEGER_ENDPOINT`, `OTEL_EXPORTER_JAEGER_USER`, `OTEL_EXPORTER_JAEGER_PASSWORD` in compliance with OTel specification. (#1752) +- Modify `BatchSpanProcessor.ForceFlush` to abort after timeout/cancellation. (#1757) +- The `DroppedAttributeCount` field of the `Span` in the `go.opentelemetry.io/otel` package now only represents the number of attributes dropped for the span itself. + It no longer is a conglomerate of itself, events, and link attributes that have been dropped. (#1771) +- Make `ExportSpans` in Jaeger Exporter honor context deadline. (#1773) +- Modify Zipkin Exporter default service name, use default resource's serviceName instead of empty. (#1777) +- The `go.opentelemetry.io/otel/sdk/export/trace` package is merged into the `go.opentelemetry.io/otel/sdk/trace` package. (#1778) +- The prometheus.InstallNewPipeline example is moved from comment to example test (#1796) +- The convenience functions for the stdout exporter have been updated to return the `TracerProvider` implementation and enable the shutdown of the exporter. (#1800) +- Replace the flush function returned from the Jaeger exporter's convenience creation functions (`InstallNewPipeline` and `NewExportPipeline`) with the `TracerProvider` implementation they create. + This enables the caller to shutdown and flush using the related `TracerProvider` methods. (#1822) +- Updated the Jaeger exporter to have a default endpoint, `http://localhost:14250`, for the collector. (#1824) +- Changed the function `WithCollectorEndpoint` in the Jaeger exporter to no longer accept an endpoint as an argument. + The endpoint can be passed with the `CollectorEndpointOption` using the `WithEndpoint` function or by setting the `OTEL_EXPORTER_JAEGER_ENDPOINT` environment variable value appropriately. (#1824) +- The Jaeger exporter no longer batches exported spans itself, instead it relies on the SDK's `BatchSpanProcessor` for this functionality. (#1830) +- The Jaeger exporter creation functions (`NewRawExporter`, `NewExportPipeline`, and `InstallNewPipeline`) no longer accept the removed `Option` type as a variadic argument. (#1830) + +### Removed + +- Removed Jaeger Environment variables: `JAEGER_SERVICE_NAME`, `JAEGER_DISABLED`, `JAEGER_TAGS` + These environment variables will no longer be used to override values of the Jaeger exporter (#1752) +- No longer set the links for a `Span` in `go.opentelemetry.io/otel/sdk/trace` that is configured to be a new root. + This is unspecified behavior that the OpenTelemetry community plans to standardize in the future. + To prevent backwards incompatible changes when it is specified, these links are removed. (#1726) +- Setting error status while recording error with Span from oteltest package. (#1729) +- The concept of a remote and local Span stored in a context is unified to just the current Span. + Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed. + Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContex` can be used to return the current Span. + If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731) +- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed. + This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749) +- The `trace.FlagsDebug` and `trace.FlagsDeferred` constants have been removed and will be localized to the B3 propagator. (#1770) +- Remove `Process` configuration, `WithProcessFromEnv` and `ProcessFromEnv`, and type from the Jaeger exporter package. + The information that could be configured in the `Process` struct should be configured in a `Resource` instead. (#1776, #1804) +- Remove the `WithDisabled` option from the Jaeger exporter. + To disable the exporter unregister it from the `TracerProvider` or use a no-operation `TracerProvider`. (#1806) +- Removed the functions `CollectorEndpointFromEnv` and `WithCollectorEndpointOptionFromEnv` from the Jaeger exporter. + These functions for retrieving specific environment variable values are redundant of other internal functions and + are not intended for end user use. (#1824) +- Removed the Jaeger exporter `WithSDKOptions` `Option`. + This option was used to set SDK options for the exporter creation convenience functions. + These functions are provided as a way to easily setup or install the exporter with what are deemed reasonable SDK settings for common use cases. + If the SDK needs to be configured differently, the `NewRawExporter` function and direct setup of the SDK with the desired settings should be used. (#1825) +- The `WithBufferMaxCount` and `WithBatchMaxCount` `Option`s from the Jaeger exporter are removed. + The exporter no longer batches exports, instead relying on the SDK's `BatchSpanProcessor` for this functionality. (#1830) +- The Jaeger exporter `Option` type is removed. + The type is no longer used by the exporter to configure anything. + All the previous configurations these options provided were duplicates of SDK configuration. + They have been removed in favor of using the SDK configuration and focuses the exporter configuration to be only about the endpoints it will send telemetry to. (#1830) + +## [0.19.0] - 2021-03-18 + +### Added + +- Added `Marshaler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586) +- A `ForceFlush` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` to flush all registered `SpanProcessor`s. (#1608) +- Added `WithSampler` and `WithSpanLimits` to tracer provider. (#1633, #1702) +- `"go.opentelemetry.io/otel/trace".SpanContext` now has a `remote` property, and `IsRemote()` predicate, that is true when the `SpanContext` has been extracted from remote context data. (#1701) +- A `Valid` method to the `"go.opentelemetry.io/otel/attribute".KeyValue` type. (#1703) + +### Changed + +- `trace.SpanContext` is now immutable and has no exported fields. (#1573) + - `trace.NewSpanContext()` can be used in conjunction with the `trace.SpanContextConfig` struct to initialize a new `SpanContext` where all values are known. +- Update the `ForceFlush` method signature to the `"go.opentelemetry.io/otel/sdk/trace".SpanProcessor` to accept a `context.Context` and return an error. (#1608) +- Update the `Shutdown` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` return an error on shutdown failure. (#1608) +- The SimpleSpanProcessor will now shut down the enclosed `SpanExporter` and gracefully ignore subsequent calls to `OnEnd` after `Shutdown` is called. (#1612) +- `"go.opentelemetry.io/sdk/metric/controller.basic".WithPusher` is replaced with `WithExporter` to provide consistent naming across project. (#1656) +- Added non-empty string check for trace `Attribute` keys. (#1659) +- Add `description` to SpanStatus only when `StatusCode` is set to error. (#1662) +- Jaeger exporter falls back to `resource.Default`'s `service.name` if the exported Span does not have one. (#1673) +- Jaeger exporter populates Jaeger's Span Process from Resource. (#1673) +- Renamed the `LabelSet` method of `"go.opentelemetry.io/otel/sdk/resource".Resource` to `Set`. (#1692) +- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/jaeger` package. (#1693) +- Changed `WithSDK` to `WithSDKOptions` to accept variadic arguments of `TracerProviderOption` type in `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1693) + +### Removed + +- Removed `serviceName` parameter from Zipkin exporter and uses resource instead. (#1549) +- Removed `WithConfig` from tracer provider to avoid overriding configuration. (#1633) +- Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. + These are now returned as a SpanProcessor interface from their respective constructors. (#1638) +- Removed `WithRecord()` from `trace.SpanOption` when creating a span. (#1660) +- Removed setting status to `Error` while recording an error as a span event in `RecordError`. (#1663) +- Removed `jaeger.WithProcess` configuration option. (#1673) +- Removed `ApplyConfig` method from `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` and the now unneeded `Config` struct. (#1693) + +### Fixed + +- Jaeger Exporter: Ensure mapping between OTEL and Jaeger span data complies with the specification. (#1626) +- `SamplingResult.TraceState` is correctly propagated to a newly created span's `SpanContext`. (#1655) +- The `otel-collector` example now correctly flushes metric events prior to shutting down the exporter. (#1678) +- Do not set span status message in `SpanStatusFromHTTPStatusCode` if it can be inferred from `http.status_code`. (#1681) +- Synchronization issues in global trace delegate implementation. (#1686) +- Reduced excess memory usage by global `TracerProvider`. (#1687) + +## [0.18.0] - 2021-03-03 + +### Added + +- Added `resource.Default()` for use with meter and tracer providers. (#1507) +- `AttributePerEventCountLimit` and `AttributePerLinkCountLimit` for `SpanLimits`. (#1535) +- Added `Keys()` method to `propagation.TextMapCarrier` and `propagation.HeaderCarrier` to adapt `http.Header` to this interface. (#1544) +- Added `code` attributes to `go.opentelemetry.io/otel/semconv` package. (#1558) +- Compatibility testing suite in the CI system for the following systems. (#1567) + | OS | Go Version | Architecture | + | ------- | ---------- | ------------ | + | Ubuntu | 1.15 | amd64 | + | Ubuntu | 1.14 | amd64 | + | Ubuntu | 1.15 | 386 | + | Ubuntu | 1.14 | 386 | + | MacOS | 1.15 | amd64 | + | MacOS | 1.14 | amd64 | + | Windows | 1.15 | amd64 | + | Windows | 1.14 | amd64 | + | Windows | 1.15 | 386 | + | Windows | 1.14 | 386 | + +### Changed + +- Replaced interface `oteltest.SpanRecorder` with its existing implementation + `StandardSpanRecorder`. (#1542) +- Default span limit values to 128. (#1535) +- Rename `MaxEventsPerSpan`, `MaxAttributesPerSpan` and `MaxLinksPerSpan` to `EventCountLimit`, `AttributeCountLimit` and `LinkCountLimit`, and move these fields into `SpanLimits`. (#1535) +- Renamed the `otel/label` package to `otel/attribute`. (#1541) +- Vendor the Jaeger exporter's dependency on Apache Thrift. (#1551) +- Parallelize the CI linting and testing. (#1567) +- Stagger timestamps in exact aggregator tests. (#1569) +- Changed all examples to use `WithBatchTimeout(5 * time.Second)` rather than `WithBatchTimeout(5)`. (#1621) +- Prevent end-users from implementing some interfaces (#1575) + + ``` + "otel/exporters/otlp/otlphttp".Option + "otel/exporters/stdout".Option + "otel/oteltest".Option + "otel/trace".TracerOption + "otel/trace".SpanOption + "otel/trace".EventOption + "otel/trace".LifeCycleOption + "otel/trace".InstrumentationOption + "otel/sdk/resource".Option + "otel/sdk/trace".ParentBasedSamplerOption + "otel/sdk/trace".ReadOnlySpan + "otel/sdk/trace".ReadWriteSpan + ``` + +### Removed + +- Removed attempt to resample spans upon changing the span name with `span.SetName()`. (#1545) +- The `test-benchmark` is no longer a dependency of the `precommit` make target. (#1567) +- Removed the `test-386` make target. + This was replaced with a full compatibility testing suite (i.e. multi OS/arch) in the CI system. (#1567) + +### Fixed + +- The sequential timing check of timestamps in the stdout exporter are now setup explicitly to be sequential (#1571). (#1572) +- Windows build of Jaeger tests now compiles with OS specific functions (#1576). (#1577) +- The sequential timing check of timestamps of go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue are now setup explicitly to be sequential (#1578). (#1579) +- Validate tracestate header keys with vendors according to the W3C TraceContext specification (#1475). (#1581) +- The OTLP exporter includes related labels for translations of a GaugeArray (#1563). (#1570) + +## [0.17.0] - 2021-02-12 + +### Changed + +- Rename project default branch from `master` to `main`. (#1505) +- Reverse order in which `Resource` attributes are merged, per change in spec. (#1501) +- Add tooling to maintain "replace" directives in go.mod files automatically. (#1528) +- Create new modules: otel/metric, otel/trace, otel/oteltest, otel/sdk/export/metric, otel/sdk/metric (#1528) +- Move metric-related public global APIs from otel to otel/metric/global. (#1528) + +## Fixed + +- Fixed otlpgrpc reconnection issue. +- The example code in the README.md of `go.opentelemetry.io/otel/exporters/otlp` is moved to a compiled example test and used the new `WithAddress` instead of `WithEndpoint`. (#1513) +- The otel-collector example now uses the default OTLP receiver port of the collector. + +## [0.16.0] - 2021-01-13 + +### Added + +- Add the `ReadOnlySpan` and `ReadWriteSpan` interfaces to provide better control for accessing span data. (#1360) +- `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369) +- Added documentation about the project's versioning policy. (#1388) +- Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418) +- Added codeql workflow to GitHub Actions (#1428) +- Added Gosec workflow to GitHub Actions (#1429) +- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420) +- Add an OpenCensus exporter bridge. (#1444) + +### Changed + +- Rename `internal/testing` to `internal/internaltest`. (#1449) +- Rename `export.SpanData` to `export.SpanSnapshot` and use it only for exporting spans. (#1360) +- Store the parent's full `SpanContext` rather than just its span ID in the `span` struct. (#1360) +- Improve span duration accuracy. (#1360) +- Migrated CI/CD from CircleCI to GitHub Actions (#1382) +- Remove duplicate checkout from GitHub Actions workflow (#1407) +- Metric `array` aggregator renamed `exact` to match its `aggregation.Kind` (#1412) +- Metric `exact` aggregator includes per-point timestamps (#1412) +- Metric stdout exporter uses MinMaxSumCount aggregator for ValueRecorder instruments (#1412) +- `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369) +- Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369) +- Unify endpoint API that related to OTel exporter. (#1401) +- Optimize metric histogram aggregator to re-use its slice of buckets. (#1435) +- Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430) +- Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434) +- `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432) +- Moved gRPC driver for OTLP exporter to `exporters/otlp/otlpgrpc`. (#1420) +- The `TraceContext` propagator now correctly propagates `TraceState` through the `SpanContext`. (#1447) +- Metric Push and Pull Controller components are combined into a single "basic" Controller: + - `WithExporter()` and `Start()` to configure Push behavior + - `Start()` is optional; use `Collect()` and `ForEach()` for Pull behavior + - `Start()` and `Stop()` accept Context. (#1378) +- The `Event` type is moved from the `otel/sdk/export/trace` package to the `otel/trace` API package. (#1452) + +### Removed + +- Remove `errUninitializedSpan` as its only usage is now obsolete. (#1360) +- Remove Metric export functionality related to quantiles and summary data points: this is not specified (#1412) +- Remove DDSketch metric aggregator; our intention is to re-introduce this as an option of the histogram aggregator after [new OTLP histogram data types](https://github.com/open-telemetry/opentelemetry-proto/pull/226) are released (#1412) + +### Fixed + +- `BatchSpanProcessor.Shutdown()` will now shutdown underlying `export.SpanExporter`. (#1443) + +## [0.15.0] - 2020-12-10 + +### Added + +- The `WithIDGenerator` `TracerProviderOption` is added to the `go.opentelemetry.io/otel/trace` package to configure an `IDGenerator` for the `TracerProvider`. (#1363) + +### Changed + +- The Zipkin exporter now uses the Span status code to determine. (#1328) +- `NewExporter` and `Start` functions in `go.opentelemetry.io/otel/exporters/otlp` now receive `context.Context` as a first parameter. (#1357) +- Move the OpenCensus example into `example` directory. (#1359) +- Moved the SDK's `internal.IDGenerator` interface in to the `sdk/trace` package to enable support for externally-defined ID generators. (#1363) +- Bump `github.com/google/go-cmp` from 0.5.3 to 0.5.4 (#1374) +- Bump `github.com/golangci/golangci-lint` in `/internal/tools` (#1375) + +### Fixed + +- Metric SDK `SumObserver` and `UpDownSumObserver` instruments correctness fixes. (#1381) + +## [0.14.0] - 2020-11-19 + +### Added + +- An `EventOption` and the related `NewEventConfig` function are added to the `go.opentelemetry.io/otel` package to configure Span events. (#1254) +- A `TextMapPropagator` and associated `TextMapCarrier` are added to the `go.opentelemetry.io/otel/oteltest` package to test `TextMap` type propagators and their use. (#1259) +- `SpanContextFromContext` returns `SpanContext` from context. (#1255) +- `TraceState` has been added to `SpanContext`. (#1340) +- `DeploymentEnvironmentKey` added to `go.opentelemetry.io/otel/semconv` package. (#1323) +- Add an OpenCensus to OpenTelemetry tracing bridge. (#1305) +- Add a parent context argument to `SpanProcessor.OnStart` to follow the specification. (#1333) +- Add missing tests for `sdk/trace/attributes_map.go`. (#1337) + +### Changed + +- Move the `go.opentelemetry.io/otel/api/trace` package into `go.opentelemetry.io/otel/trace` with the following changes. (#1229) (#1307) + - `ID` has been renamed to `TraceID`. + - `IDFromHex` has been renamed to `TraceIDFromHex`. + - `EmptySpanContext` is removed. +- Move the `go.opentelemetry.io/otel/api/trace/tracetest` package into `go.opentelemetry.io/otel/oteltest`. (#1229) +- OTLP Exporter updates: + - supports OTLP v0.6.0 (#1230, #1354) + - supports configurable aggregation temporality (default: Cumulative, optional: Stateless). (#1296) +- The Sampler is now called on local child spans. (#1233) +- The `Kind` type from the `go.opentelemetry.io/otel/api/metric` package was renamed to `InstrumentKind` to more specifically describe what it is and avoid semantic ambiguity. (#1240) +- The `MetricKind` method of the `Descriptor` type in the `go.opentelemetry.io/otel/api/metric` package was renamed to `Descriptor.InstrumentKind`. + This matches the returned type and fixes misuse of the term metric. (#1240) +- Move test harness from the `go.opentelemetry.io/otel/api/apitest` package into `go.opentelemetry.io/otel/oteltest`. (#1241) +- Move the `go.opentelemetry.io/otel/api/metric/metrictest` package into `go.opentelemetry.io/oteltest` as part of #964. (#1252) +- Move the `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric` as part of #1303. (#1321) +- Move the `go.opentelemetry.io/otel/api/metric/registry` package into `go.opentelemetry.io/otel/metric/registry` as a part of #1303. (#1316) +- Move the `Number` type (together with related functions) from `go.opentelemetry.io/otel/api/metric` package into `go.opentelemetry.io/otel/metric/number` as a part of #1303. (#1316) +- The function signature of the Span `AddEvent` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required name and a variable number of `EventOption`s. (#1254) +- The function signature of the Span `RecordError` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required error value and a variable number of `EventOption`s. (#1254) +- Move the `go.opentelemetry.io/otel/api/global` package to `go.opentelemetry.io/otel`. (#1262) (#1330) +- Move the `Version` function from `go.opentelemetry.io/otel/sdk` to `go.opentelemetry.io/otel`. (#1330) +- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#1267) +- Fix `Code.UnmarshalJSON` to work with valid JSON only. (#1276) +- The `resource.New()` method changes signature to support builtin attributes and functional options, including `telemetry.sdk.*` and + `host.name` semantic conventions; the former method is renamed `resource.NewWithAttributes`. (#1235) +- The Prometheus exporter now exports non-monotonic counters (i.e. `UpDownCounter`s) as gauges. (#1210) +- Correct the `Span.End` method documentation in the `otel` API to state updates are not allowed on a span after it has ended. (#1310) +- Updated span collection limits for attribute, event and link counts to 1000 (#1318) +- Renamed `semconv.HTTPUrlKey` to `semconv.HTTPURLKey`. (#1338) + +### Removed + +- The `ErrInvalidHexID`, `ErrInvalidTraceIDLength`, `ErrInvalidSpanIDLength`, `ErrInvalidSpanIDLength`, or `ErrNilSpanID` from the `go.opentelemetry.io/otel` package are unexported now. (#1243) +- The `AddEventWithTimestamp` method on the `Span` interface in `go.opentelemetry.io/otel` is removed due to its redundancy. + It is replaced by using the `AddEvent` method with a `WithTimestamp` option. (#1254) +- The `MockSpan` and `MockTracer` types are removed from `go.opentelemetry.io/otel/oteltest`. + `Tracer` and `Span` from the same module should be used in their place instead. (#1306) +- `WorkerCount` option is removed from `go.opentelemetry.io/otel/exporters/otlp`. (#1350) +- Remove the following labels types: INT32, UINT32, UINT64 and FLOAT32. (#1314) + +### Fixed + +- Rename `MergeItererator` to `MergeIterator` in the `go.opentelemetry.io/otel/label` package. (#1244) +- The `go.opentelemetry.io/otel/api/global` packages global TextMapPropagator now delegates functionality to a globally set delegate for all previously returned propagators. (#1258) +- Fix condition in `label.Any`. (#1299) +- Fix global `TracerProvider` to pass options to its configured provider. (#1329) +- Fix missing handler for `ExactKind` aggregator in OTLP metrics transformer (#1309) + +## [0.13.0] - 2020-10-08 + +### Added + +- OTLP Metric exporter supports Histogram aggregation. (#1209) +- The `Code` struct from the `go.opentelemetry.io/otel/codes` package now supports JSON marshaling and unmarshaling as well as implements the `Stringer` interface. (#1214) +- A Baggage API to implement the OpenTelemetry specification. (#1217) +- Add Shutdown method to sdk/trace/provider, shutdown processors in the order they were registered. (#1227) + +### Changed + +- Set default propagator to no-op propagator. (#1184) +- The `HTTPSupplier`, `HTTPExtractor`, `HTTPInjector`, and `HTTPPropagator` from the `go.opentelemetry.io/otel/api/propagation` package were replaced with unified `TextMapCarrier` and `TextMapPropagator` in the `go.opentelemetry.io/otel/propagation` package. (#1212) (#1325) +- The `New` function from the `go.opentelemetry.io/otel/api/propagation` package was replaced with `NewCompositeTextMapPropagator` in the `go.opentelemetry.io/otel` package. (#1212) +- The status codes of the `go.opentelemetry.io/otel/codes` package have been updated to match the latest OpenTelemetry specification. + They now are `Unset`, `Error`, and `Ok`. + They no longer track the gRPC codes. (#1214) +- The `StatusCode` field of the `SpanData` struct in the `go.opentelemetry.io/otel/sdk/export/trace` package now uses the codes package from this package instead of the gRPC project. (#1214) +- Move the `go.opentelemetry.io/otel/api/baggage` package into `go.opentelemetry.io/otel/baggage`. (#1217) (#1325) +- A `Shutdown` method of `SpanProcessor` and all its implementations receives a context and returns an error. (#1264) + +### Fixed + +- Copies of data from arrays and slices passed to `go.opentelemetry.io/otel/label.ArrayValue()` are now used in the returned `Value` instead of using the mutable data itself. (#1226) + +### Removed + +- The `ExtractHTTP` and `InjectHTTP` functions from the `go.opentelemetry.io/otel/api/propagation` package were removed. (#1212) +- The `Propagators` interface from the `go.opentelemetry.io/otel/api/propagation` package was removed to conform to the OpenTelemetry specification. + The explicit `TextMapPropagator` type can be used in its place as this is the `Propagator` type the specification defines. (#1212) +- The `SetAttribute` method of the `Span` from the `go.opentelemetry.io/otel/api/trace` package was removed given its redundancy with the `SetAttributes` method. (#1216) +- The internal implementation of Baggage storage is removed in favor of using the new Baggage API functionality. (#1217) +- Remove duplicate hostname key `HostHostNameKey` in Resource semantic conventions. (#1219) +- Nested array/slice support has been removed. (#1226) + +## [0.12.0] - 2020-09-24 + +### Added + +- A `SpanConfigure` function in `go.opentelemetry.io/otel/api/trace` to create a new `SpanConfig` from `SpanOption`s. (#1108) +- In the `go.opentelemetry.io/otel/api/trace` package, `NewTracerConfig` was added to construct new `TracerConfig`s. + This addition was made to conform with our project option conventions. (#1155) +- Instrumentation library information was added to the Zipkin exporter. (#1119) +- The `SpanProcessor` interface now has a `ForceFlush()` method. (#1166) +- More semantic conventions for k8s as resource attributes. (#1167) + +### Changed + +- Add reconnecting udp connection type to Jaeger exporter. + This change adds a new optional implementation of the udp conn interface used to detect changes to an agent's host dns record. + It then adopts the new destination address to ensure the exporter doesn't get stuck. This change was ported from jaegertracing/jaeger-client-go#520. (#1063) +- Replace `StartOption` and `EndOption` in `go.opentelemetry.io/otel/api/trace` with `SpanOption`. + This change is matched by replacing the `StartConfig` and `EndConfig` with a unified `SpanConfig`. (#1108) +- Replace the `LinkedTo` span option in `go.opentelemetry.io/otel/api/trace` with `WithLinks`. + This is be more consistent with our other option patterns, i.e. passing the item to be configured directly instead of its component parts, and provides a cleaner function signature. (#1108) +- The `go.opentelemetry.io/otel/api/trace` `TracerOption` was changed to an interface to conform to project option conventions. (#1109) +- Move the `B3` and `TraceContext` from within the `go.opentelemetry.io/otel/api/trace` package to their own `go.opentelemetry.io/otel/propagators` package. + This removal of the propagators is reflective of the OpenTelemetry specification for these propagators as well as cleans up the `go.opentelemetry.io/otel/api/trace` API. (#1118) +- Rename Jaeger tags used for instrumentation library information to reflect changes in OpenTelemetry specification. (#1119) +- Rename `ProbabilitySampler` to `TraceIDRatioBased` and change semantics to ignore parent span sampling status. (#1115) +- Move `tools` package under `internal`. (#1141) +- Move `go.opentelemetry.io/otel/api/correlation` package to `go.opentelemetry.io/otel/api/baggage`. (#1142) + The `correlation.CorrelationContext` propagator has been renamed `baggage.Baggage`. Other exported functions and types are unchanged. +- Rename `ParentOrElse` sampler to `ParentBased` and allow setting samplers depending on parent span. (#1153) +- In the `go.opentelemetry.io/otel/api/trace` package, `SpanConfigure` was renamed to `NewSpanConfig`. (#1155) +- Change `dependabot.yml` to add a `Skip Changelog` label to dependabot-sourced PRs. (#1161) +- The [configuration style guide](https://github.com/open-telemetry/opentelemetry-go/blob/master/CONTRIBUTING.md#config) has been updated to + recommend the use of `newConfig()` instead of `configure()`. (#1163) +- The `otlp.Config` type has been unexported and changed to `otlp.config`, along with its initializer. (#1163) +- Ensure exported interface types include parameter names and update the + Style Guide to reflect this styling rule. (#1172) +- Don't consider unset environment variable for resource detection to be an error. (#1170) +- Rename `go.opentelemetry.io/otel/api/metric.ConfigureInstrument` to `NewInstrumentConfig` and + `go.opentelemetry.io/otel/api/metric.ConfigureMeter` to `NewMeterConfig`. +- ValueObserver instruments use LastValue aggregator by default. (#1165) +- OTLP Metric exporter supports LastValue aggregation. (#1165) +- Move the `go.opentelemetry.io/otel/api/unit` package to `go.opentelemetry.io/otel/unit`. (#1185) +- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) +- Rename `NoopProvider` to `NoopMeterProvider` in the `go.opentelemetry.io/otel/api/metric` package. (#1190) +- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metric/metrictest` package. (#1190) +- Rename `Provider` to `MeterProvider` in the `go.opentelemetry.io/otel/api/metric/registry` package. (#1190) +- Rename `NewProvider` to `NewMeterProvider` in the `go.opentelemetry.io/otel/api/metri/registryc` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) +- Rename `NoopProvider` to `NoopTracerProvider` in the `go.opentelemetry.io/otel/api/trace` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) +- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/api/trace/tracetest` package. (#1190) +- Rename `WrapperProvider` to `WrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) +- Rename `NewWrapperProvider` to `NewWrapperTracerProvider` in the `go.opentelemetry.io/otel/bridge/opentracing` package. (#1190) +- Rename `Provider` method of the pull controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/pull` package. (#1190) +- Rename `Provider` method of the push controller to `MeterProvider` in the `go.opentelemetry.io/otel/sdk/metric/controller/push` package. (#1190) +- Rename `ProviderOptions` to `TracerProviderConfig` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `ProviderOption` to `TracerProviderOption` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190) +- Renamed `SamplingDecision` values to comply with OpenTelemetry specification change. (#1192) +- Renamed Zipkin attribute names from `ot.status_code & ot.status_description` to `otel.status_code & otel.status_description`. (#1201) +- The default SDK now invokes registered `SpanProcessor`s in the order they were registered with the `TracerProvider`. (#1195) +- Add test of spans being processed by the `SpanProcessor`s in the order they were registered. (#1203) + +### Removed + +- Remove the B3 propagator from `go.opentelemetry.io/otel/propagators`. It is now located in the + `go.opentelemetry.io/contrib/propagators/` module. (#1191) +- Remove the semantic convention for HTTP status text, `HTTPStatusTextKey` from package `go.opentelemetry.io/otel/semconv`. (#1194) + +### Fixed + +- Zipkin example no longer mentions `ParentSampler`, corrected to `ParentBased`. (#1171) +- Fix missing shutdown processor in otel-collector example. (#1186) +- Fix missing shutdown processor in basic and namedtracer examples. (#1197) + +## [0.11.0] - 2020-08-24 + +### Added + +- Support for exporting array-valued attributes via OTLP. (#992) +- `Noop` and `InMemory` `SpanBatcher` implementations to help with testing integrations. (#994) +- Support for filtering metric label sets. (#1047) +- A dimensionality-reducing metric Processor. (#1057) +- Integration tests for more OTel Collector Attribute types. (#1062) +- A new `WithSpanProcessor` `ProviderOption` is added to the `go.opentelemetry.io/otel/sdk/trace` package to create a `Provider` and automatically register the `SpanProcessor`. (#1078) + +### Changed + +- Rename `sdk/metric/processor/test` to `sdk/metric/processor/processortest`. (#1049) +- Rename `sdk/metric/controller/test` to `sdk/metric/controller/controllertest`. (#1049) +- Rename `api/testharness` to `api/apitest`. (#1049) +- Rename `api/trace/testtrace` to `api/trace/tracetest`. (#1049) +- Change Metric Processor to merge multiple observations. (#1024) +- The `go.opentelemetry.io/otel/bridge/opentracing` bridge package has been made into its own module. + This removes the package dependencies of this bridge from the rest of the OpenTelemetry based project. (#1038) +- Renamed `go.opentelemetry.io/otel/api/standard` package to `go.opentelemetry.io/otel/semconv` to avoid the ambiguous and generic name `standard` and better describe the package as containing OpenTelemetry semantic conventions. (#1016) +- The environment variable used for resource detection has been changed from `OTEL_RESOURCE_LABELS` to `OTEL_RESOURCE_ATTRIBUTES` (#1042) +- Replace `WithSyncer` with `WithBatcher` in examples. (#1044) +- Replace the `google.golang.org/grpc/codes` dependency in the API with an equivalent `go.opentelemetry.io/otel/codes` package. (#1046) +- Merge the `go.opentelemetry.io/otel/api/label` and `go.opentelemetry.io/otel/api/kv` into the new `go.opentelemetry.io/otel/label` package. (#1060) +- Unify Callback Function Naming. + Rename `*Callback` with `*Func`. (#1061) +- CI builds validate against last two versions of Go, dropping 1.13 and adding 1.15. (#1064) +- The `go.opentelemetry.io/otel/sdk/export/trace` interfaces `SpanSyncer` and `SpanBatcher` have been replaced with a specification compliant `Exporter` interface. + This interface still supports the export of `SpanData`, but only as a slice. + Implementation are also required now to return any error from `ExportSpans` if one occurs as well as implement a `Shutdown` method for exporter clean-up. (#1078) +- The `go.opentelemetry.io/otel/sdk/trace` `NewBatchSpanProcessor` function no longer returns an error. + If a `nil` exporter is passed as an argument to this function, instead of it returning an error, it now returns a `BatchSpanProcessor` that handles the export of `SpanData` by not taking any action. (#1078) +- The `go.opentelemetry.io/otel/sdk/trace` `NewProvider` function to create a `Provider` no longer returns an error, instead only a `*Provider`. + This change is related to `NewBatchSpanProcessor` not returning an error which was the only error this function would return. (#1078) + +### Removed + +- Duplicate, unused API sampler interface. (#999) + Use the [`Sampler` interface](https://github.com/open-telemetry/opentelemetry-go/blob/v0.11.0/sdk/trace/sampling.go) provided by the SDK instead. +- The `grpctrace` instrumentation was moved to the `go.opentelemetry.io/contrib` repository and out of this repository. + This move includes moving the `grpc` example to the `go.opentelemetry.io/contrib` as well. (#1027) +- The `WithSpan` method of the `Tracer` interface. + The functionality this method provided was limited compared to what a user can provide themselves. + It was removed with the understanding that if there is sufficient user need it can be added back based on actual user usage. (#1043) +- The `RegisterSpanProcessor` and `UnregisterSpanProcessor` functions. + These were holdovers from an approach prior to the TracerProvider design. They were not used anymore. (#1077) +- The `oterror` package. (#1026) +- The `othttp` and `httptrace` instrumentations were moved to `go.opentelemetry.io/contrib`. (#1032) + +### Fixed + +- The `semconv.HTTPServerMetricAttributesFromHTTPRequest()` function no longer generates the high-cardinality `http.request.content.length` label. (#1031) +- Correct instrumentation version tag in Jaeger exporter. (#1037) +- The SDK span will now set an error event if the `End` method is called during a panic (i.e. it was deferred). (#1043) +- Move internally generated protobuf code from the `go.opentelemetry.io/otel` to the OTLP exporter to reduce dependency overhead. (#1050) +- The `otel-collector` example referenced outdated collector processors. (#1006) + +## [0.10.0] - 2020-07-29 + +This release migrates the default OpenTelemetry SDK into its own Go module, decoupling the SDK from the API and reducing dependencies for instrumentation packages. + +### Added + +- The Zipkin exporter now has `NewExportPipeline` and `InstallNewPipeline` constructor functions to match the common pattern. + These function build a new exporter with default SDK options and register the exporter with the `global` package respectively. (#944) +- Add propagator option for gRPC instrumentation. (#986) +- The `testtrace` package now tracks the `trace.SpanKind` for each span. (#987) + +### Changed + +- Replace the `RegisterGlobal` `Option` in the Jaeger exporter with an `InstallNewPipeline` constructor function. + This matches the other exporter constructor patterns and will register a new exporter after building it with default configuration. (#944) +- The trace (`go.opentelemetry.io/otel/exporters/trace/stdout`) and metric (`go.opentelemetry.io/otel/exporters/metric/stdout`) `stdout` exporters are now merged into a single exporter at `go.opentelemetry.io/otel/exporters/stdout`. + This new exporter was made into its own Go module to follow the pattern of all exporters and decouple it from the `go.opentelemetry.io/otel` module. (#956, #963) +- Move the `go.opentelemetry.io/otel/exporters/test` test package to `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#962) +- The `go.opentelemetry.io/otel/api/kv/value` package was merged into the parent `go.opentelemetry.io/otel/api/kv` package. (#968) + - `value.Bool` was replaced with `kv.BoolValue`. + - `value.Int64` was replaced with `kv.Int64Value`. + - `value.Uint64` was replaced with `kv.Uint64Value`. + - `value.Float64` was replaced with `kv.Float64Value`. + - `value.Int32` was replaced with `kv.Int32Value`. + - `value.Uint32` was replaced with `kv.Uint32Value`. + - `value.Float32` was replaced with `kv.Float32Value`. + - `value.String` was replaced with `kv.StringValue`. + - `value.Int` was replaced with `kv.IntValue`. + - `value.Uint` was replaced with `kv.UintValue`. + - `value.Array` was replaced with `kv.ArrayValue`. +- Rename `Infer` to `Any` in the `go.opentelemetry.io/otel/api/kv` package. (#972) +- Change `othttp` to use the `httpsnoop` package to wrap the `ResponseWriter` so that optional interfaces (`http.Hijacker`, `http.Flusher`, etc.) that are implemented by the original `ResponseWriter`are also implemented by the wrapped `ResponseWriter`. (#979) +- Rename `go.opentelemetry.io/otel/sdk/metric/aggregator/test` package to `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest`. (#980) +- Make the SDK into its own Go module called `go.opentelemetry.io/otel/sdk`. (#985) +- Changed the default trace `Sampler` from `AlwaysOn` to `ParentOrElse(AlwaysOn)`. (#989) + +### Removed + +- The `IndexedAttribute` function from the `go.opentelemetry.io/otel/api/label` package was removed in favor of `IndexedLabel` which it was synonymous with. (#970) + +### Fixed + +- Bump github.com/golangci/golangci-lint from 1.28.3 to 1.29.0 in /tools. (#953) +- Bump github.com/google/go-cmp from 0.5.0 to 0.5.1. (#957) +- Use `global.Handle` for span export errors in the OTLP exporter. (#946) +- Correct Go language formatting in the README documentation. (#961) +- Remove default SDK dependencies from the `go.opentelemetry.io/otel/api` package. (#977) +- Remove default SDK dependencies from the `go.opentelemetry.io/otel/instrumentation` package. (#983) +- Move documented examples for `go.opentelemetry.io/otel/instrumentation/grpctrace` interceptors into Go example tests. (#984) + +## [0.9.0] - 2020-07-20 + +### Added + +- A new Resource Detector interface is included to allow resources to be automatically detected and included. (#939) +- A Detector to automatically detect resources from an environment variable. (#939) +- Github action to generate protobuf Go bindings locally in `internal/opentelemetry-proto-gen`. (#938) +- OTLP .proto files from `open-telemetry/opentelemetry-proto` imported as a git submodule under `internal/opentelemetry-proto`. + References to `github.com/open-telemetry/opentelemetry-proto` changed to `go.opentelemetry.io/otel/internal/opentelemetry-proto-gen`. (#942) + +### Changed + +- Non-nil value `struct`s for key-value pairs will be marshalled using JSON rather than `Sprintf`. (#948) + +### Removed + +- Removed dependency on `github.com/open-telemetry/opentelemetry-collector`. (#943) + +## [0.8.0] - 2020-07-09 + +### Added + +- The `B3Encoding` type to represent the B3 encoding(s) the B3 propagator can inject. + A value for HTTP supported encodings (Multiple Header: `MultipleHeader`, Single Header: `SingleHeader`) are included. (#882) +- The `FlagsDeferred` trace flag to indicate if the trace sampling decision has been deferred. (#882) +- The `FlagsDebug` trace flag to indicate if the trace is a debug trace. (#882) +- Add `peer.service` semantic attribute. (#898) +- Add database-specific semantic attributes. (#899) +- Add semantic convention for `faas.coldstart` and `container.id`. (#909) +- Add http content size semantic conventions. (#905) +- Include `http.request_content_length` in HTTP request basic attributes. (#905) +- Add semantic conventions for operating system process resource attribute keys. (#919) +- The Jaeger exporter now has a `WithBatchMaxCount` option to specify the maximum number of spans sent in a batch. (#931) + +### Changed + +- Update `CONTRIBUTING.md` to ask for updates to `CHANGELOG.md` with each pull request. (#879) +- Use lowercase header names for B3 Multiple Headers. (#881) +- The B3 propagator `SingleHeader` field has been replaced with `InjectEncoding`. + This new field can be set to combinations of the `B3Encoding` bitmasks and will inject trace information in these encodings. + If no encoding is set, the propagator will default to `MultipleHeader` encoding. (#882) +- The B3 propagator now extracts from either HTTP encoding of B3 (Single Header or Multiple Header) based on what is contained in the header. + Preference is given to Single Header encoding with Multiple Header being the fallback if Single Header is not found or is invalid. + This behavior change is made to dynamically support all correctly encoded traces received instead of having to guess the expected encoding prior to receiving. (#882) +- Extend semantic conventions for RPC. (#900) +- To match constant naming conventions in the `api/standard` package, the `FaaS*` key names are appended with a suffix of `Key`. (#920) + - `"api/standard".FaaSName` -> `FaaSNameKey` + - `"api/standard".FaaSID` -> `FaaSIDKey` + - `"api/standard".FaaSVersion` -> `FaaSVersionKey` + - `"api/standard".FaaSInstance` -> `FaaSInstanceKey` + +### Removed + +- The `FlagsUnused` trace flag is removed. + The purpose of this flag was to act as the inverse of `FlagsSampled`, the inverse of `FlagsSampled` is used instead. (#882) +- The B3 header constants (`B3SingleHeader`, `B3DebugFlagHeader`, `B3TraceIDHeader`, `B3SpanIDHeader`, `B3SampledHeader`, `B3ParentSpanIDHeader`) are removed. + If B3 header keys are needed [the authoritative OpenZipkin package constants](https://pkg.go.dev/github.com/openzipkin/zipkin-go@v0.2.2/propagation/b3?tab=doc#pkg-constants) should be used instead. (#882) + +### Fixed + +- The B3 Single Header name is now correctly `b3` instead of the previous `X-B3`. (#881) +- The B3 propagator now correctly supports sampling only values (`b3: 0`, `b3: 1`, or `b3: d`) for a Single B3 Header. (#882) +- The B3 propagator now propagates the debug flag. + This removes the behavior of changing the debug flag into a set sampling bit. + Instead, this now follow the B3 specification and omits the `X-B3-Sampling` header. (#882) +- The B3 propagator now tracks "unset" sampling state (meaning "defer the decision") and does not set the `X-B3-Sampling` header when injecting. (#882) +- Bump github.com/itchyny/gojq from 0.10.3 to 0.10.4 in /tools. (#883) +- Bump github.com/opentracing/opentracing-go from v1.1.1-0.20190913142402-a7454ce5950e to v1.2.0. (#885) +- The tracing time conversion for OTLP spans is now correctly set to `UnixNano`. (#896) +- Ensure span status is not set to `Unknown` when no HTTP status code is provided as it is assumed to be `200 OK`. (#908) +- Ensure `httptrace.clientTracer` closes `http.headers` span. (#912) +- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903) +- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905) +- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913) +- Update otel-colector example to use the v0.5.0 collector. (#915) +- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922) +- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922) +- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists. + This is in accordance with OpenTelemetry semantic conventions. (#922) +- Correlation Context extractor will no longer insert an empty map into the returned context when no valid values are extracted. (#923) +- Bump google.golang.org/api from 0.28.0 to 0.29.0 in /exporters/trace/jaeger. (#925) +- Bump github.com/itchyny/gojq from 0.10.4 to 0.11.0 in /tools. (#926) +- Bump github.com/golangci/golangci-lint from 1.28.1 to 1.28.2 in /tools. (#930) + +## [0.7.0] - 2020-06-26 + +This release implements the v0.5.0 version of the OpenTelemetry specification. + +### Added + +- The othttp instrumentation now includes default metrics. (#861) +- This CHANGELOG file to track all changes in the project going forward. +- Support for array type attributes. (#798) +- Apply transitive dependabot go.mod dependency updates as part of a new automatic Github workflow. (#844) +- Timestamps are now passed to exporters for each export. (#835) +- Add new `Accumulation` type to metric SDK to transport telemetry from `Accumulator`s to `Processor`s. + This replaces the prior `Record` `struct` use for this purpose. (#835) +- New dependabot integration to automate package upgrades. (#814) +- `Meter` and `Tracer` implementations accept instrumentation version version as an optional argument. + This instrumentation version is passed on to exporters. (#811) (#805) (#802) +- The OTLP exporter includes the instrumentation version in telemetry it exports. (#811) +- Environment variables for Jaeger exporter are supported. (#796) +- New `aggregation.Kind` in the export metric API. (#808) +- New example that uses OTLP and the collector. (#790) +- Handle errors in the span `SetName` during span initialization. (#791) +- Default service config to enable retries for retry-able failed requests in the OTLP exporter and an option to override this default. (#777) +- New `go.opentelemetry.io/otel/api/oterror` package to uniformly support error handling and definitions for the project. (#778) +- New `global` default implementation of the `go.opentelemetry.io/otel/api/oterror.Handler` interface to be used to handle errors prior to an user defined `Handler`. + There is also functionality for the user to register their `Handler` as well as a convenience function `Handle` to handle an error with this global `Handler`(#778) +- Options to specify propagators for httptrace and grpctrace instrumentation. (#784) +- The required `application/json` header for the Zipkin exporter is included in all exports. (#774) +- Integrate HTTP semantics helpers from the contrib repository into the `api/standard` package. #769 + +### Changed + +- Rename `Integrator` to `Processor` in the metric SDK. (#863) +- Rename `AggregationSelector` to `AggregatorSelector`. (#859) +- Rename `SynchronizedCopy` to `SynchronizedMove`. (#858) +- Rename `simple` integrator to `basic` integrator. (#857) +- Merge otlp collector examples. (#841) +- Change the metric SDK to support cumulative, delta, and pass-through exporters directly. + With these changes, cumulative and delta specific exporters are able to request the correct kind of aggregation from the SDK. (#840) +- The `Aggregator.Checkpoint` API is renamed to `SynchronizedCopy` and adds an argument, a different `Aggregator` into which the copy is stored. (#812) +- The `export.Aggregator` contract is that `Update()` and `SynchronizedCopy()` are synchronized with each other. + All the aggregation interfaces (`Sum`, `LastValue`, ...) are not meant to be synchronized, as the caller is expected to synchronize aggregators at a higher level after the `Accumulator`. + Some of the `Aggregators` used unnecessary locking and that has been cleaned up. (#812) +- Use of `metric.Number` was replaced by `int64` now that we use `sync.Mutex` in the `MinMaxSumCount` and `Histogram` `Aggregators`. (#812) +- Replace `AlwaysParentSample` with `ParentSample(fallback)` to match the OpenTelemetry v0.5.0 specification. (#810) +- Rename `sdk/export/metric/aggregator` to `sdk/export/metric/aggregation`. #808 +- Send configured headers with every request in the OTLP exporter, instead of just on connection creation. (#806) +- Update error handling for any one off error handlers, replacing, instead, with the `global.Handle` function. (#791) +- Rename `plugin` directory to `instrumentation` to match the OpenTelemetry specification. (#779) +- Makes the argument order to Histogram and DDSketch `New()` consistent. (#781) + +### Removed + +- `Uint64NumberKind` and related functions from the API. (#864) +- Context arguments from `Aggregator.Checkpoint` and `Integrator.Process` as they were unused. (#803) +- `SpanID` is no longer included in parameters for sampling decision to match the OpenTelemetry specification. (#775) + +### Fixed + +- Upgrade OTLP exporter to opentelemetry-proto matching the opentelemetry-collector v0.4.0 release. (#866) +- Allow changes to `go.sum` and `go.mod` when running dependabot tidy-up. (#871) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1. (#824) +- Bump github.com/prometheus/client_golang from 1.7.0 to 1.7.1 in /exporters/metric/prometheus. (#867) +- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/jaeger. (#853) +- Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/zipkin. (#854) +- Bumps github.com/golang/protobuf from 1.3.2 to 1.4.2 (#848) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/otlp (#817) +- Bump github.com/golangci/golangci-lint from 1.25.1 to 1.27.0 in /tools (#828) +- Bump github.com/prometheus/client_golang from 1.5.0 to 1.7.0 in /exporters/metric/prometheus (#838) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/jaeger (#829) +- Bump github.com/benbjohnson/clock from 1.0.0 to 1.0.3 (#815) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/zipkin (#823) +- Bump github.com/itchyny/gojq from 0.10.1 to 0.10.3 in /tools (#830) +- Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/metric/prometheus (#822) +- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/zipkin (#820) +- Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/jaeger (#831) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 (#836) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/trace/jaeger (#837) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/otlp (#839) +- Bump google.golang.org/api from 0.20.0 to 0.28.0 in /exporters/trace/jaeger (#843) +- Set span status from HTTP status code in the othttp instrumentation. (#832) +- Fixed typo in push controller comment. (#834) +- The `Aggregator` testing has been updated and cleaned. (#812) +- `metric.Number(0)` expressions are replaced by `0` where possible. (#812) +- Fixed `global` `handler_test.go` test failure. #804 +- Fixed `BatchSpanProcessor.Shutdown` to wait until all spans are processed. (#766) +- Fixed OTLP example's accidental early close of exporter. (#807) +- Ensure zipkin exporter reads and closes response body. (#788) +- Update instrumentation to use `api/standard` keys instead of custom keys. (#782) +- Clean up tools and RELEASING documentation. (#762) + +## [0.6.0] - 2020-05-21 + +### Added + +- Support for `Resource`s in the prometheus exporter. (#757) +- New pull controller. (#751) +- New `UpDownSumObserver` instrument. (#750) +- OpenTelemetry collector demo. (#711) +- New `SumObserver` instrument. (#747) +- New `UpDownCounter` instrument. (#745) +- New timeout `Option` and configuration function `WithTimeout` to the push controller. (#742) +- New `api/standards` package to implement semantic conventions and standard key-value generation. (#731) + +### Changed + +- Rename `Register*` functions in the metric API to `New*` for all `Observer` instruments. (#761) +- Use `[]float64` for histogram boundaries, not `[]metric.Number`. (#758) +- Change OTLP example to use exporter as a trace `Syncer` instead of as an unneeded `Batcher`. (#756) +- Replace `WithResourceAttributes()` with `WithResource()` in the trace SDK. (#754) +- The prometheus exporter now uses the new pull controller. (#751) +- Rename `ScheduleDelayMillis` to `BatchTimeout` in the trace `BatchSpanProcessor`.(#752) +- Support use of synchronous instruments in asynchronous callbacks (#725) +- Move `Resource` from the `Export` method parameter into the metric export `Record`. (#739) +- Rename `Observer` instrument to `ValueObserver`. (#734) +- The push controller now has a method (`Provider()`) to return a `metric.Provider` instead of the old `Meter` method that acted as a `metric.Provider`. (#738) +- Replace `Measure` instrument by `ValueRecorder` instrument. (#732) +- Rename correlation context header from `"Correlation-Context"` to `"otcorrelations"` to match the OpenTelemetry specification. (#727) + +### Fixed + +- Ensure gRPC `ClientStream` override methods do not panic in grpctrace package. (#755) +- Disable parts of `BatchSpanProcessor` test until a fix is found. (#743) +- Fix `string` case in `kv` `Infer` function. (#746) +- Fix panic in grpctrace client interceptors. (#740) +- Refactor the `api/metrics` push controller and add `CheckpointSet` synchronization. (#737) +- Rewrite span batch process queue batching logic. (#719) +- Remove the push controller named Meter map. (#738) +- Fix Histogram aggregator initial state (fix #735). (#736) +- Ensure golang alpine image is running `golang-1.14` for examples. (#733) +- Added test for grpctrace `UnaryInterceptorClient`. (#695) +- Rearrange `api/metric` code layout. (#724) + +## [0.5.0] - 2020-05-13 + +### Added + +- Batch `Observer` callback support. (#717) +- Alias `api` types to root package of project. (#696) +- Create basic `othttp.Transport` for simple client instrumentation. (#678) +- `SetAttribute(string, interface{})` to the trace API. (#674) +- Jaeger exporter option that allows user to specify custom http client. (#671) +- `Stringer` and `Infer` methods to `key`s. (#662) + +### Changed + +- Rename `NewKey` in the `kv` package to just `Key`. (#721) +- Move `core` and `key` to `kv` package. (#720) +- Make the metric API `Meter` a `struct` so the abstract `MeterImpl` can be passed and simplify implementation. (#709) +- Rename SDK `Batcher` to `Integrator` to match draft OpenTelemetry SDK specification. (#710) +- Rename SDK `Ungrouped` integrator to `simple.Integrator` to match draft OpenTelemetry SDK specification. (#710) +- Rename SDK `SDK` `struct` to `Accumulator` to match draft OpenTelemetry SDK specification. (#710) +- Move `Number` from `core` to `api/metric` package. (#706) +- Move `SpanContext` from `core` to `trace` package. (#692) +- Change traceparent header from `Traceparent` to `traceparent` to implement the W3C specification. (#681) + +### Fixed + +- Update tooling to run generators in all submodules. (#705) +- gRPC interceptor regexp to match methods without a service name. (#683) +- Use a `const` for padding 64-bit B3 trace IDs. (#701) +- Update `mockZipkin` listen address from `:0` to `127.0.0.1:0`. (#700) +- Left-pad 64-bit B3 trace IDs with zero. (#698) +- Propagate at least the first W3C tracestate header. (#694) +- Remove internal `StateLocker` implementation. (#688) +- Increase instance size CI system uses. (#690) +- Add a `key` benchmark and use reflection in `key.Infer()`. (#679) +- Fix internal `global` test by using `global.Meter` with `RecordBatch()`. (#680) +- Reimplement histogram using mutex instead of `StateLocker`. (#669) +- Switch `MinMaxSumCount` to a mutex lock implementation instead of `StateLocker`. (#667) +- Update documentation to not include any references to `WithKeys`. (#672) +- Correct misspelling. (#668) +- Fix clobbering of the span context if extraction fails. (#656) +- Bump `golangci-lint` and work around the corrupting bug. (#666) (#670) + +## [0.4.3] - 2020-04-24 + +### Added + +- `Dockerfile` and `docker-compose.yml` to run example code. (#635) +- New `grpctrace` package that provides gRPC client and server interceptors for both unary and stream connections. (#621) +- New `api/label` package, providing common label set implementation. (#651) +- Support for JSON marshaling of `Resources`. (#654) +- `TraceID` and `SpanID` implementations for `Stringer` interface. (#642) +- `RemoteAddrKey` in the othttp plugin to include the HTTP client address in top-level spans. (#627) +- `WithSpanFormatter` option to the othttp plugin. (#617) +- Updated README to include section for compatible libraries and include reference to the contrib repository. (#612) +- The prometheus exporter now supports exporting histograms. (#601) +- A `String` method to the `Resource` to return a hashable identifier for a now unique resource. (#613) +- An `Iter` method to the `Resource` to return an array `AttributeIterator`. (#613) +- An `Equal` method to the `Resource` test the equivalence of resources. (#613) +- An iterable structure (`AttributeIterator`) for `Resource` attributes. + +### Changed + +- zipkin export's `NewExporter` now requires a `serviceName` argument to ensure this needed values is provided. (#644) +- Pass `Resources` through the metrics export pipeline. (#659) + +### Removed + +- `WithKeys` option from the metric API. (#639) + +### Fixed + +- Use the `label.Set.Equivalent` value instead of an encoding in the batcher. (#658) +- Correct typo `trace.Exporter` to `trace.SpanSyncer` in comments. (#653) +- Use type names for return values in jaeger exporter. (#648) +- Increase the visibility of the `api/key` package by updating comments and fixing usages locally. (#650) +- `Checkpoint` only after `Update`; Keep records in the `sync.Map` longer. (#647) +- Do not cache `reflect.ValueOf()` in metric Labels. (#649) +- Batch metrics exported from the OTLP exporter based on `Resource` and labels. (#626) +- Add error wrapping to the prometheus exporter. (#631) +- Update the OTLP exporter batching of traces to use a unique `string` representation of an associated `Resource` as the batching key. (#623) +- Update OTLP `SpanData` transform to only include the `ParentSpanID` if one exists. (#614) +- Update `Resource` internal representation to uniquely and reliably identify resources. (#613) +- Check return value from `CheckpointSet.ForEach` in prometheus exporter. (#622) +- Ensure spans created by httptrace client tracer reflect operation structure. (#618) +- Create a new recorder rather than reuse when multiple observations in same epoch for asynchronous instruments. #610 +- The default port the OTLP exporter uses to connect to the OpenTelemetry collector is updated to match the one the collector listens on by default. (#611) + +## [0.4.2] - 2020-03-31 + +### Fixed + +- Fix `pre_release.sh` to update version in `sdk/opentelemetry.go`. (#607) +- Fix time conversion from internal to OTLP in OTLP exporter. (#606) + +## [0.4.1] - 2020-03-31 + +### Fixed + +- Update `tag.sh` to create signed tags. (#604) + +## [0.4.0] - 2020-03-30 + +### Added + +- New API package `api/metric/registry` that exposes a `MeterImpl` wrapper for use by SDKs to generate unique instruments. (#580) +- Script to verify examples after a new release. (#579) + +### Removed + +- The dogstatsd exporter due to lack of support. + This additionally removes support for statsd. (#591) +- `LabelSet` from the metric API. + This is replaced by a `[]core.KeyValue` slice. (#595) +- `Labels` from the metric API's `Meter` interface. (#595) + +### Changed + +- The metric `export.Labels` became an interface which the SDK implements and the `export` package provides a simple, immutable implementation of this interface intended for testing purposes. (#574) +- Renamed `internal/metric.Meter` to `MeterImpl`. (#580) +- Renamed `api/global/internal.obsImpl` to `asyncImpl`. (#580) + +### Fixed + +- Corrected missing return in mock span. (#582) +- Update License header for all source files to match CNCF guidelines and include a test to ensure it is present. (#586) (#596) +- Update to v0.3.0 of the OTLP in the OTLP exporter. (#588) +- Update pre-release script to be compatible between GNU and BSD based systems. (#592) +- Add a `RecordBatch` benchmark. (#594) +- Moved span transforms of the OTLP exporter to the internal package. (#593) +- Build both go-1.13 and go-1.14 in circleci to test for all supported versions of Go. (#569) +- Removed unneeded allocation on empty labels in OLTP exporter. (#597) +- Update `BatchedSpanProcessor` to process the queue until no data but respect max batch size. (#599) +- Update project documentation godoc.org links to pkg.go.dev. (#602) + +## [0.3.0] - 2020-03-21 + +This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality. +There is still a possibility of breaking changes. + +### Added + +- Add `Observer` metric instrument. (#474) +- Add global `Propagators` functionality to enable deferred initialization for propagators registered before the first Meter SDK is installed. (#494) +- Simplified export setup pipeline for the jaeger exporter to match other exporters. (#459) +- The zipkin trace exporter. (#495) +- The OTLP exporter to export metric and trace telemetry to the OpenTelemetry collector. (#497) (#544) (#545) +- Add `StatusMessage` field to the trace `Span`. (#524) +- Context propagation in OpenTracing bridge in terms of OpenTelemetry context propagation. (#525) +- The `Resource` type was added to the SDK. (#528) +- The global API now supports a `Tracer` and `Meter` function as shortcuts to getting a global `*Provider` and calling these methods directly. (#538) +- The metric API now defines a generic `MeterImpl` interface to support general purpose `Meter` construction. + Additionally, `SyncImpl` and `AsyncImpl` are added to support general purpose instrument construction. (#560) +- A metric `Kind` is added to represent the `MeasureKind`, `ObserverKind`, and `CounterKind`. (#560) +- Scripts to better automate the release process. (#576) + +### Changed + +- Default to to use `AlwaysSampler` instead of `ProbabilitySampler` to match OpenTelemetry specification. (#506) +- Renamed `AlwaysSampleSampler` to `AlwaysOnSampler` in the trace API. (#511) +- Renamed `NeverSampleSampler` to `AlwaysOffSampler` in the trace API. (#511) +- The `Status` field of the `Span` was changed to `StatusCode` to disambiguate with the added `StatusMessage`. (#524) +- Updated the trace `Sampler` interface conform to the OpenTelemetry specification. (#531) +- Rename metric API `Options` to `Config`. (#541) +- Rename metric `Counter` aggregator to be `Sum`. (#541) +- Unify metric options into `Option` from instrument specific options. (#541) +- The trace API's `TraceProvider` now support `Resource`s. (#545) +- Correct error in zipkin module name. (#548) +- The jaeger trace exporter now supports `Resource`s. (#551) +- Metric SDK now supports `Resource`s. + The `WithResource` option was added to configure a `Resource` on creation and the `Resource` method was added to the metric `Descriptor` to return the associated `Resource`. (#552) +- Replace `ErrNoLastValue` and `ErrEmptyDataSet` by `ErrNoData` in the metric SDK. (#557) +- The stdout trace exporter now supports `Resource`s. (#558) +- The metric `Descriptor` is now included at the API instead of the SDK. (#560) +- Replace `Ordered` with an iterator in `export.Labels`. (#567) + +### Removed + +- The vendor specific Stackdriver. It is now hosted on 3rd party vendor infrastructure. (#452) +- The `Unregister` method for metric observers as it is not in the OpenTelemetry specification. (#560) +- `GetDescriptor` from the metric SDK. (#575) +- The `Gauge` instrument from the metric API. (#537) + +### Fixed + +- Make histogram aggregator checkpoint consistent. (#438) +- Update README with import instructions and how to build and test. (#505) +- The default label encoding was updated to be unique. (#508) +- Use `NewRoot` in the othttp plugin for public endpoints. (#513) +- Fix data race in `BatchedSpanProcessor`. (#518) +- Skip test-386 for Mac OS 10.15.x (Catalina and upwards). #521 +- Use a variable-size array to represent ordered labels in maps. (#523) +- Update the OTLP protobuf and update changed import path. (#532) +- Use `StateLocker` implementation in `MinMaxSumCount`. (#546) +- Eliminate goroutine leak in histogram stress test. (#547) +- Update OTLP exporter with latest protobuf. (#550) +- Add filters to the othttp plugin. (#556) +- Provide an implementation of the `Header*` filters that do not depend on Go 1.14. (#565) +- Encode labels once during checkpoint. + The checkpoint function is executed in a single thread so we can do the encoding lazily before passing the encoded version of labels to the exporter. + This is a cheap and quick way to avoid encoding the labels on every collection interval. (#572) +- Run coverage over all packages in `COVERAGE_MOD_DIR`. (#573) + +## [0.2.3] - 2020-03-04 + +### Added + +- `RecordError` method on `Span`s in the trace API to Simplify adding error events to spans. (#473) +- Configurable push frequency for exporters setup pipeline. (#504) + +### Changed + +- Rename the `exporter` directory to `exporters`. + The `go.opentelemetry.io/otel/exporter/trace/jaeger` package was mistakenly released with a `v1.0.0` tag instead of `v0.1.0`. + This resulted in all subsequent releases not becoming the default latest. + A consequence of this was that all `go get`s pulled in the incompatible `v0.1.0` release of that package when pulling in more recent packages from other otel packages. + Renaming the `exporter` directory to `exporters` fixes this issue by renaming the package and therefore clearing any existing dependency tags. + Consequentially, this action also renames *all* exporter packages. (#502) + +### Removed + +- The `CorrelationContextHeader` constant in the `correlation` package is no longer exported. (#503) + +## [0.2.2] - 2020-02-27 + +### Added + +- `HTTPSupplier` interface in the propagation API to specify methods to retrieve and store a single value for a key to be associated with a carrier. (#467) +- `HTTPExtractor` interface in the propagation API to extract information from an `HTTPSupplier` into a context. (#467) +- `HTTPInjector` interface in the propagation API to inject information into an `HTTPSupplier.` (#467) +- `Config` and configuring `Option` to the propagator API. (#467) +- `Propagators` interface in the propagation API to contain the set of injectors and extractors for all supported carrier formats. (#467) +- `HTTPPropagator` interface in the propagation API to inject and extract from an `HTTPSupplier.` (#467) +- `WithInjectors` and `WithExtractors` functions to the propagator API to configure injectors and extractors to use. (#467) +- `ExtractHTTP` and `InjectHTTP` functions to apply configured HTTP extractors and injectors to a passed context. (#467) +- Histogram aggregator. (#433) +- `DefaultPropagator` function and have it return `trace.TraceContext` as the default context propagator. (#456) +- `AlwaysParentSample` sampler to the trace API. (#455) +- `WithNewRoot` option function to the trace API to specify the created span should be considered a root span. (#451) + +### Changed + +- Renamed `WithMap` to `ContextWithMap` in the correlation package. (#481) +- Renamed `FromContext` to `MapFromContext` in the correlation package. (#481) +- Move correlation context propagation to correlation package. (#479) +- Do not default to putting remote span context into links. (#480) +- `Tracer.WithSpan` updated to accept `StartOptions`. (#472) +- Renamed `MetricKind` to `Kind` to not stutter in the type usage. (#432) +- Renamed the `export` package to `metric` to match directory structure. (#432) +- Rename the `api/distributedcontext` package to `api/correlation`. (#444) +- Rename the `api/propagators` package to `api/propagation`. (#444) +- Move the propagators from the `propagators` package into the `trace` API package. (#444) +- Update `Float64Gauge`, `Int64Gauge`, `Float64Counter`, `Int64Counter`, `Float64Measure`, and `Int64Measure` metric methods to use value receivers instead of pointers. (#462) +- Moved all dependencies of tools package to a tools directory. (#466) + +### Removed + +- Binary propagators. (#467) +- NOOP propagator. (#467) + +### Fixed + +- Upgraded `github.com/golangci/golangci-lint` from `v1.21.0` to `v1.23.6` in `tools/`. (#492) +- Fix a possible nil-dereference crash (#478) +- Correct comments for `InstallNewPipeline` in the stdout exporter. (#483) +- Correct comments for `InstallNewPipeline` in the dogstatsd exporter. (#484) +- Correct comments for `InstallNewPipeline` in the prometheus exporter. (#482) +- Initialize `onError` based on `Config` in prometheus exporter. (#486) +- Correct module name in prometheus exporter README. (#475) +- Removed tracer name prefix from span names. (#430) +- Fix `aggregator_test.go` import package comment. (#431) +- Improved detail in stdout exporter. (#436) +- Fix a dependency issue (generate target should depend on stringer, not lint target) in Makefile. (#442) +- Reorders the Makefile targets within `precommit` target so we generate files and build the code before doing linting, so we can get much nicer errors about syntax errors from the compiler. (#442) +- Reword function documentation in gRPC plugin. (#446) +- Send the `span.kind` tag to Jaeger from the jaeger exporter. (#441) +- Fix `metadataSupplier` in the jaeger exporter to overwrite the header if existing instead of appending to it. (#441) +- Upgraded to Go 1.13 in CI. (#465) +- Correct opentelemetry.io URL in trace SDK documentation. (#464) +- Refactored reference counting logic in SDK determination of stale records. (#468) +- Add call to `runtime.Gosched` in instrument `acquireHandle` logic to not block the collector. (#469) + +## [0.2.1.1] - 2020-01-13 + +### Fixed + +- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428) + +## [0.2.1] - 2020-01-08 + +### Added + +- Global meter forwarding implementation. + This enables deferred initialization for metric instruments registered before the first Meter SDK is installed. (#392) +- Global trace forwarding implementation. + This enables deferred initialization for tracers registered before the first Trace SDK is installed. (#406) +- Standardize export pipeline creation in all exporters. (#395) +- A testing, organization, and comments for 64-bit field alignment. (#418) +- Script to tag all modules in the project. (#414) + +### Changed + +- Renamed `propagation` package to `propagators`. (#362) +- Renamed `B3Propagator` propagator to `B3`. (#362) +- Renamed `TextFormatPropagator` propagator to `TextFormat`. (#362) +- Renamed `BinaryPropagator` propagator to `Binary`. (#362) +- Renamed `BinaryFormatPropagator` propagator to `BinaryFormat`. (#362) +- Renamed `NoopTextFormatPropagator` propagator to `NoopTextFormat`. (#362) +- Renamed `TraceContextPropagator` propagator to `TraceContext`. (#362) +- Renamed `SpanOption` to `StartOption` in the trace API. (#369) +- Renamed `StartOptions` to `StartConfig` in the trace API. (#369) +- Renamed `EndOptions` to `EndConfig` in the trace API. (#369) +- `Number` now has a pointer receiver for its methods. (#375) +- Renamed `CurrentSpan` to `SpanFromContext` in the trace API. (#379) +- Renamed `SetCurrentSpan` to `ContextWithSpan` in the trace API. (#379) +- Renamed `Message` in Event to `Name` in the trace API. (#389) +- Prometheus exporter no longer aggregates metrics, instead it only exports them. (#385) +- Renamed `HandleImpl` to `BoundInstrumentImpl` in the metric API. (#400) +- Renamed `Float64CounterHandle` to `Float64CounterBoundInstrument` in the metric API. (#400) +- Renamed `Int64CounterHandle` to `Int64CounterBoundInstrument` in the metric API. (#400) +- Renamed `Float64GaugeHandle` to `Float64GaugeBoundInstrument` in the metric API. (#400) +- Renamed `Int64GaugeHandle` to `Int64GaugeBoundInstrument` in the metric API. (#400) +- Renamed `Float64MeasureHandle` to `Float64MeasureBoundInstrument` in the metric API. (#400) +- Renamed `Int64MeasureHandle` to `Int64MeasureBoundInstrument` in the metric API. (#400) +- Renamed `Release` method for bound instruments in the metric API to `Unbind`. (#400) +- Renamed `AcquireHandle` method for bound instruments in the metric API to `Bind`. (#400) +- Renamed the `File` option in the stdout exporter to `Writer`. (#404) +- Renamed all `Options` to `Config` for all metric exports where this wasn't already the case. + +### Fixed + +- Aggregator import path corrected. (#421) +- Correct links in README. (#368) +- The README was updated to match latest code changes in its examples. (#374) +- Don't capitalize error statements. (#375) +- Fix ignored errors. (#375) +- Fix ambiguous variable naming. (#375) +- Removed unnecessary type casting. (#375) +- Use named parameters. (#375) +- Updated release schedule. (#378) +- Correct http-stackdriver example module name. (#394) +- Removed the `http.request` span in `httptrace` package. (#397) +- Add comments in the metrics SDK (#399) +- Initialize checkpoint when creating ddsketch aggregator to prevent panic when merging into a empty one. (#402) (#403) +- Add documentation of compatible exporters in the README. (#405) +- Typo fix. (#408) +- Simplify span check logic in SDK tracer implementation. (#419) + +## [0.2.0] - 2019-12-03 + +### Added + +- Unary gRPC tracing example. (#351) +- Prometheus exporter. (#334) +- Dogstatsd metrics exporter. (#326) + +### Changed + +- Rename `MaxSumCount` aggregation to `MinMaxSumCount` and add the `Min` interface for this aggregation. (#352) +- Rename `GetMeter` to `Meter`. (#357) +- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) +- Rename `HTTPB3Propagator` to `B3Propagator`. (#355) +- Rename `HTTPTraceContextPropagator` to `TraceContextPropagator`. (#355) +- Move `/global` package to `/api/global`. (#356) +- Rename `GetTracer` to `Tracer`. (#347) + +### Removed + +- `SetAttribute` from the `Span` interface in the trace API. (#361) +- `AddLink` from the `Span` interface in the trace API. (#349) +- `Link` from the `Span` interface in the trace API. (#349) + +### Fixed + +- Exclude example directories from coverage report. (#365) +- Lint make target now implements automatic fixes with `golangci-lint` before a second run to report the remaining issues. (#360) +- Drop `GO111MODULE` environment variable in Makefile as Go 1.13 is the project specified minimum version and this is environment variable is not needed for that version of Go. (#359) +- Run the race checker for all test. (#354) +- Redundant commands in the Makefile are removed. (#354) +- Split the `generate` and `lint` targets of the Makefile. (#354) +- Renames `circle-ci` target to more generic `ci` in Makefile. (#354) +- Add example Prometheus binary to gitignore. (#358) +- Support negative numbers with the `MaxSumCount`. (#335) +- Resolve race conditions in `push_test.go` identified in #339. (#340) +- Use `/usr/bin/env bash` as a shebang in scripts rather than `/bin/bash`. (#336) +- Trace benchmark now tests both `AlwaysSample` and `NeverSample`. + Previously it was testing `AlwaysSample` twice. (#325) +- Trace benchmark now uses a `[]byte` for `TraceID` to fix failing test. (#325) +- Added a trace benchmark to test variadic functions in `setAttribute` vs `setAttributes` (#325) +- The `defaultkeys` batcher was only using the encoded label set as its map key while building a checkpoint. + This allowed distinct label sets through, but any metrics sharing a label set could be overwritten or merged incorrectly. + This was corrected. (#333) + +## [0.1.2] - 2019-11-18 + +### Fixed + +- Optimized the `simplelru` map for attributes to reduce the number of allocations. (#328) +- Removed unnecessary unslicing of parameters that are already a slice. (#324) + +## [0.1.1] - 2019-11-18 + +This release contains a Metrics SDK with stdout exporter and supports basic aggregations such as counter, gauges, array, maxsumcount, and ddsketch. + +### Added + +- Metrics stdout export pipeline. (#265) +- Array aggregation for raw measure metrics. (#282) +- The core.Value now have a `MarshalJSON` method. (#281) + +### Removed + +- `WithService`, `WithResources`, and `WithComponent` methods of tracers. (#314) +- Prefix slash in `Tracer.Start()` for the Jaeger example. (#292) + +### Changed + +- Allocation in LabelSet construction to reduce GC overhead. (#318) +- `trace.WithAttributes` to append values instead of replacing (#315) +- Use a formula for tolerance in sampling tests. (#298) +- Move export types into trace and metric-specific sub-directories. (#289) +- `SpanKind` back to being based on an `int` type. (#288) + +### Fixed + +- URL to OpenTelemetry website in README. (#323) +- Name of othttp default tracer. (#321) +- `ExportSpans` for the stackdriver exporter now handles `nil` context. (#294) +- CI modules cache to correctly restore/save from/to the cache. (#316) +- Fix metric SDK race condition between `LoadOrStore` and the assignment `rec.recorder = i.meter.exporter.AggregatorFor(rec)`. (#293) +- README now reflects the new code structure introduced with these changes. (#291) +- Make the basic example work. (#279) + +## [0.1.0] - 2019-11-04 + +This is the first release of open-telemetry go library. +It contains api and sdk for trace and meter. + +### Added + +- Initial OpenTelemetry trace and metric API prototypes. +- Initial OpenTelemetry trace, metric, and export SDK packages. +- A wireframe bridge to support compatibility with OpenTracing. +- Example code for a basic, http-stackdriver, http, jaeger, and named tracer setup. +- Exporters for Jaeger, Stackdriver, and stdout. +- Propagators for binary, B3, and trace-context protocols. +- Project information and guidelines in the form of a README and CONTRIBUTING. +- Tools to build the project and a Makefile to automate the process. +- Apache-2.0 license. +- CircleCI build CI manifest files. +- CODEOWNERS file to track owners of this project. + +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.24.0...HEAD +[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0 +[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 +[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 +[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 +[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 +[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 +[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 +[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 +[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 +[1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 +[1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 +[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 +[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 +[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 +[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 +[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 +[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 +[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 +[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 +[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 +[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 +[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 +[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 +[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 +[0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 +[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 +[1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 +[1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 +[1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 +[1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 +[0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 +[1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 +[1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 +[1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 +[1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 +[1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 +[1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 +[1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 +[1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 +[1.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.2.0 +[1.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.1.0 +[1.0.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.1 +[Metrics 0.24.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.24.0 +[1.0.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0 +[1.0.0-RC3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC3 +[1.0.0-RC2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC2 +[Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.22.0 +[1.0.0-RC1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC1 +[0.20.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.20.0 +[0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.19.0 +[0.18.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.18.0 +[0.17.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.17.0 +[0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.16.0 +[0.15.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.15.0 +[0.14.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.14.0 +[0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.13.0 +[0.12.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.12.0 +[0.11.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.11.0 +[0.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.10.0 +[0.9.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.9.0 +[0.8.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.8.0 +[0.7.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.7.0 +[0.6.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.6.0 +[0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.5.0 +[0.4.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.3 +[0.4.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.2 +[0.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.1 +[0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.0 +[0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.3.0 +[0.2.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.3 +[0.2.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.2 +[0.2.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1.1 +[0.2.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.1 +[0.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.2.0 +[0.1.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.2 +[0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 +[0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 + +[Go 1.22]: https://go.dev/doc/go1.22 +[Go 1.21]: https://go.dev/doc/go1.21 +[Go 1.20]: https://go.dev/doc/go1.20 +[Go 1.19]: https://go.dev/doc/go1.19 +[Go 1.18]: https://go.dev/doc/go1.18 + +[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric +[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric +[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS new file mode 100644 index 00000000..31d336d9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -0,0 +1,17 @@ +##################################################### +# +# List of approvers for this repository +# +##################################################### +# +# Learn about membership in OpenTelemetry community: +# https://github.com/open-telemetry/community/blob/main/community-membership.md +# +# +# Learn about CODEOWNERS file format: +# https://help.github.com/en/articles/about-code-owners +# + +* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu + +CODEOWNERS @MrAlias @MadVikingGod @pellared @dashpole \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md new file mode 100644 index 00000000..c9f2bac5 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -0,0 +1,645 @@ +# Contributing to opentelemetry-go + +The Go special interest group (SIG) meets regularly. See the +OpenTelemetry +[community](https://github.com/open-telemetry/community#golang-sdk) +repo for information on this and other language SIGs. + +See the [public meeting +notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) +for a summary description of past meetings. To request edit access, +join the meeting or get in touch on +[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). + +## Development + +You can view and edit the source code by cloning this repository: + +```sh +git clone https://github.com/open-telemetry/opentelemetry-go.git +``` + +Run `make test` to run the tests instead of `go test`. + +There are some generated files checked into the repo. To make sure +that the generated files are up-to-date, run `make` (or `make +precommit` - the `precommit` target is the default). + +The `precommit` target also fixes the formatting of the code and +checks the status of the go module files. + +Additionally, there is a `codespell` target that checks for common +typos in the code. It is not run by default, but you can run it +manually with `make codespell`. It will set up a virtual environment +in `venv` and install `codespell` there. + +If after running `make precommit` the output of `git status` contains +`nothing to commit, working tree clean` then it means that everything +is up-to-date and properly formatted. + +## Pull Requests + +### How to Send Pull Requests + +Everyone is welcome to contribute code to `opentelemetry-go` via +GitHub pull requests (PRs). + +To create a new PR, fork the project in GitHub and clone the upstream +repo: + +```sh +go get -d go.opentelemetry.io/otel +``` + +(This may print some warning about "build constraints exclude all Go +files", just ignore it.) + +This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`. You +can alternatively use `git` directly with: + +```sh +git clone https://github.com/open-telemetry/opentelemetry-go +``` + +(Note that `git clone` is *not* using the `go.opentelemetry.io/otel` name - +that name is a kind of a redirector to GitHub that `go get` can +understand, but `git` does not.) + +This would put the project in the `opentelemetry-go` directory in +current working directory. + +Enter the newly created directory and add your fork as a new remote: + +```sh +git remote add git@github.com:/opentelemetry-go +``` + +Check out a new branch, make modifications, run linters and tests, update +`CHANGELOG.md`, and push the branch to your fork: + +```sh +git checkout -b +# edit files +# update changelog +make precommit +git add -p +git commit +git push +``` + +Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull +request ID to the entry you added to `CHANGELOG.md`. + +Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request. +Rewriting Git history makes it difficult to keep track of iterations during code review. +All pull requests are squashed to a single commit upon merge to `main`. + +### How to Receive Comments + +* If the PR is not ready for review, please put `[WIP]` in the title, + tag it as `work-in-progress`, or mark it as + [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/). +* Make sure CLA is signed and CI is clear. + +### How to Get PRs Merged + +A PR is considered **ready to merge** when: + +* It has received two qualified approvals[^1]. + + This is not enforced through automation, but needs to be validated by the + maintainer merging. + * The qualified approvals need to be from [Approver]s/[Maintainer]s + affiliated with different companies. Two qualified approvals from + [Approver]s or [Maintainer]s affiliated with the same company counts as a + single qualified approval. + * PRs introducing changes that have already been discussed and consensus + reached only need one qualified approval. The discussion and resolution + needs to be linked to the PR. + * Trivial changes[^2] only need one qualified approval. + +* All feedback has been addressed. + * All PR comments and suggestions are resolved. + * All GitHub Pull Request reviews with a status of "Request changes" have + been addressed. Another review by the objecting reviewer with a different + status can be submitted to clear the original review, or the review can be + dismissed by a [Maintainer] when the issues from the original review have + been addressed. + * Any comments or reviews that cannot be resolved between the PR author and + reviewers can be submitted to the community [Approver]s and [Maintainer]s + during the weekly SIG meeting. If consensus is reached among the + [Approver]s and [Maintainer]s during the SIG meeting the objections to the + PR may be dismissed or resolved or the PR closed by a [Maintainer]. + * Any substantive changes to the PR require existing Approval reviews be + cleared unless the approver explicitly states that their approval persists + across changes. This includes changes resulting from other feedback. + [Approver]s and [Maintainer]s can help in clearing reviews and they should + be consulted if there are any questions. + +* The PR branch is up to date with the base branch it is merging into. + * To ensure this does not block the PR, it should be configured to allow + maintainers to update it. + +* It has been open for review for at least one working day. This gives people + reasonable time to review. + * Trivial changes[^2] do not have to wait for one day and may be merged with + a single [Maintainer]'s approval. + +* All required GitHub workflows have succeeded. +* Urgent fix can take exception as long as it has been actively communicated + among [Maintainer]s. + +Any [Maintainer] can merge the PR once the above criteria have been met. + +[^1]: A qualified approval is a GitHub Pull Request review with "Approve" + status from an OpenTelemetry Go [Approver] or [Maintainer]. +[^2]: Trivial changes include: typo corrections, cosmetic non-substantive + changes, documentation corrections or updates, dependency updates, etc. + +## Design Choices + +As with other OpenTelemetry clients, opentelemetry-go follows the +[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel). + +It's especially valuable to read through the [library +guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines). + +### Focus on Capabilities, Not Structure Compliance + +OpenTelemetry is an evolving specification, one where the desires and +use cases are clear, but the method to satisfy those uses cases are +not. + +As such, Contributions should provide functionality and behavior that +conforms to the specification, but the interface and structure is +flexible. + +It is preferable to have contributions follow the idioms of the +language rather than conform to specific API names or argument +patterns in the spec. + +For a deeper discussion, see +[this](https://github.com/open-telemetry/opentelemetry-specification/issues/165). + +## Documentation + +Each (non-internal, non-test) package must be documented using +[Go Doc Comments](https://go.dev/doc/comment), +preferably in a `doc.go` file. + +Prefer using [Examples](https://pkg.go.dev/testing#hdr-Examples) +instead of putting code snippets in Go doc comments. +In some cases, you can even create [Testable Examples](https://go.dev/blog/examples). + +You can install and run a "local Go Doc site" in the following way: + + ```sh + go install golang.org/x/pkgsite/cmd/pkgsite@latest + pkgsite + ``` + +[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) +is an example of a very well-documented package. + +## Style Guide + +One of the primary goals of this project is that it is actually used by +developers. With this goal in mind the project strives to build +user-friendly and idiomatic Go code adhering to the Go community's best +practices. + +For a non-comprehensive but foundational overview of these best practices +the [Effective Go](https://golang.org/doc/effective_go.html) documentation +is an excellent starting place. + +As a convenience for developers building this project the `make precommit` +will format, lint, validate, and in some cases fix the changes you plan to +submit. This check will need to pass for your changes to be able to be +merged. + +In addition to idiomatic Go, the project has adopted certain standards for +implementations of common patterns. These standards should be followed as a +default, and if they are not followed documentation needs to be included as +to the reasons why. + +### Configuration + +When creating an instantiation function for a complex `type T struct`, it is +useful to allow variable number of options to be applied. However, the strong +type system of Go restricts the function design options. There are a few ways +to solve this problem, but we have landed on the following design. + +#### `config` + +Configuration should be held in a `struct` named `config`, or prefixed with +specific type name this Configuration applies to if there are multiple +`config` in the package. This type must contain configuration options. + +```go +// config contains configuration options for a thing. +type config struct { + // options ... +} +``` + +In general the `config` type will not need to be used externally to the +package and should be unexported. If, however, it is expected that the user +will likely want to build custom options for the configuration, the `config` +should be exported. Please, include in the documentation for the `config` +how the user can extend the configuration. + +It is important that internal `config` are not shared across package boundaries. +Meaning a `config` from one package should not be directly used by another. The +one exception is the API packages. The configs from the base API, eg. +`go.opentelemetry.io/otel/trace.TracerConfig` and +`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed +by the SDK therefore it is expected that these are exported. + +When a config is exported we want to maintain forward and backward +compatibility, to achieve this no fields should be exported but should +instead be accessed by methods. + +Optionally, it is common to include a `newConfig` function (with the same +naming scheme). This function wraps any defaults setting and looping over +all options to create a configured `config`. + +```go +// newConfig returns an appropriately configured config. +func newConfig(options ...Option) config { + // Set default values for config. + config := config{/* […] */} + for _, option := range options { + config = option.apply(config) + } + // Perform any validation here. + return config +} +``` + +If validation of the `config` options is also performed this can return an +error as well that is expected to be handled by the instantiation function +or propagated to the user. + +Given the design goal of not having the user need to work with the `config`, +the `newConfig` function should also be unexported. + +#### `Option` + +To set the value of the options a `config` contains, a corresponding +`Option` interface type should be used. + +```go +type Option interface { + apply(config) config +} +``` + +Having `apply` unexported makes sure that it will not be used externally. +Moreover, the interface becomes sealed so the user cannot easily implement +the interface on its own. + +The `apply` method should return a modified version of the passed config. +This approach, instead of passing a pointer, is used to prevent the config from being allocated to the heap. + +The name of the interface should be prefixed in the same way the +corresponding `config` is (if at all). + +#### Options + +All user configurable options for a `config` must have a related unexported +implementation of the `Option` interface and an exported configuration +function that wraps this implementation. + +The wrapping function name should be prefixed with `With*` (or in the +special case of a boolean options `Without*`) and should have the following +function signature. + +```go +func With*(…) Option { … } +``` + +##### `bool` Options + +```go +type defaultFalseOption bool + +func (o defaultFalseOption) apply(c config) config { + c.Bool = bool(o) + return c +} + +// WithOption sets a T to have an option included. +func WithOption() Option { + return defaultFalseOption(true) +} +``` + +```go +type defaultTrueOption bool + +func (o defaultTrueOption) apply(c config) config { + c.Bool = bool(o) + return c +} + +// WithoutOption sets a T to have Bool option excluded. +func WithoutOption() Option { + return defaultTrueOption(false) +} +``` + +##### Declared Type Options + +```go +type myTypeOption struct { + MyType MyType +} + +func (o myTypeOption) apply(c config) config { + c.MyType = o.MyType + return c +} + +// WithMyType sets T to have include MyType. +func WithMyType(t MyType) Option { + return myTypeOption{t} +} +``` + +##### Functional Options + +```go +type optionFunc func(config) config + +func (fn optionFunc) apply(c config) config { + return fn(c) +} + +// WithMyType sets t as MyType. +func WithMyType(t MyType) Option { + return optionFunc(func(c config) config { + c.MyType = t + return c + }) +} +``` + +#### Instantiation + +Using this configuration pattern to configure instantiation with a `NewT` +function. + +```go +func NewT(options ...Option) T {…} +``` + +Any required parameters can be declared before the variadic `options`. + +#### Dealing with Overlap + +Sometimes there are multiple complex `struct` that share common +configuration and also have distinct configuration. To avoid repeated +portions of `config`s, a common `config` can be used with the union of +options being handled with the `Option` interface. + +For example. + +```go +// config holds options for all animals. +type config struct { + Weight float64 + Color string + MaxAltitude float64 +} + +// DogOption apply Dog specific options. +type DogOption interface { + applyDog(config) config +} + +// BirdOption apply Bird specific options. +type BirdOption interface { + applyBird(config) config +} + +// Option apply options for all animals. +type Option interface { + BirdOption + DogOption +} + +type weightOption float64 + +func (o weightOption) applyDog(c config) config { + c.Weight = float64(o) + return c +} + +func (o weightOption) applyBird(c config) config { + c.Weight = float64(o) + return c +} + +func WithWeight(w float64) Option { return weightOption(w) } + +type furColorOption string + +func (o furColorOption) applyDog(c config) config { + c.Color = string(o) + return c +} + +func WithFurColor(c string) DogOption { return furColorOption(c) } + +type maxAltitudeOption float64 + +func (o maxAltitudeOption) applyBird(c config) config { + c.MaxAltitude = float64(o) + return c +} + +func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) } + +func NewDog(name string, o ...DogOption) Dog {…} +func NewBird(name string, o ...BirdOption) Bird {…} +``` + +### Interfaces + +To allow other developers to better comprehend the code, it is important +to ensure it is sufficiently documented. One simple measure that contributes +to this aim is self-documenting by naming method parameters. Therefore, +where appropriate, methods of every exported interface type should have +their parameters appropriately named. + +#### Interface Stability + +All exported stable interfaces that include the following warning in their +documentation are allowed to be extended with additional methods. + +> Warning: methods may be added to this interface in minor releases. + +These interfaces are defined by the OpenTelemetry specification and will be +updated as the specification evolves. + +Otherwise, stable interfaces MUST NOT be modified. + +#### How to Change Specification Interfaces + +When an API change must be made, we will update the SDK with the new method one +release before the API change. This will allow the SDK one version before the +API change to work seamlessly with the new API. + +If an incompatible version of the SDK is used with the new API the application +will fail to compile. + +#### How Not to Change Specification Interfaces + +We have explored using a v2 of the API to change interfaces and found that there +was no way to introduce a v2 and have it work seamlessly with the v1 of the API. +Problems happened with libraries that upgraded to v2 when an application did not, +and would not produce any telemetry. + +More detail of the approaches considered and their limitations can be found in +the [Use a V2 API to evolve interfaces](https://github.com/open-telemetry/opentelemetry-go/issues/3920) +issue. + +#### How to Change Other Interfaces + +If new functionality is needed for an interface that cannot be changed it MUST +be added by including an additional interface. That added interface can be a +simple interface for the specific functionality that you want to add or it can +be a super-set of the original interface. For example, if you wanted to a +`Close` method to the `Exporter` interface: + +```go +type Exporter interface { + Export() +} +``` + +A new interface, `Closer`, can be added: + +```go +type Closer interface { + Close() +} +``` + +Code that is passed the `Exporter` interface can now check to see if the passed +value also satisfies the new interface. E.g. + +```go +func caller(e Exporter) { + /* ... */ + if c, ok := e.(Closer); ok { + c.Close() + } + /* ... */ +} +``` + +Alternatively, a new type that is the super-set of an `Exporter` can be created. + +```go +type ClosingExporter struct { + Exporter + Close() +} +``` + +This new type can be used similar to the simple interface above in that a +passed `Exporter` type can be asserted to satisfy the `ClosingExporter` type +and the `Close` method called. + +This super-set approach can be useful if there is explicit behavior that needs +to be coupled with the original type and passed as a unified type to a new +function, but, because of this coupling, it also limits the applicability of +the added functionality. If there exist other interfaces where this +functionality should be added, each one will need their own super-set +interfaces and will duplicate the pattern. For this reason, the simple targeted +interface that defines the specific functionality should be preferred. + +### Testing + +The tests should never leak goroutines. + +Use the term `ConcurrentSafe` in the test name when it aims to verify the +absence of race conditions. + +### Internal packages + +The use of internal packages should be scoped to a single module. A sub-module +should never import from a parent internal package. This creates a coupling +between the two modules where a user can upgrade the parent without the child +and if the internal package API has changed it will fail to upgrade[^3]. + +There are two known exceptions to this rule: + +- `go.opentelemetry.io/otel/internal/global` + - This package manages global state for all of opentelemetry-go. It needs to + be a single package in order to ensure the uniqueness of the global state. +- `go.opentelemetry.io/otel/internal/baggage` + - This package provides values in a `context.Context` that need to be + recognized by `go.opentelemetry.io/otel/baggage` and + `go.opentelemetry.io/otel/bridge/opentracing` but remain private. + +If you have duplicate code in multiple modules, make that code into a Go +template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl] +to render the templates in the desired locations. See [#4404] for an example of +this. + +[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 + +### Ignoring context cancellation + +OpenTelemetry API implementations need to ignore the cancellation of the context that are +passed when recording a value (e.g. starting a span, recording a measurement, emitting a log). +Recording methods should not return an error describing the cancellation state of the context +when they complete, nor should they abort any work. + +This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for +the method. In that case the context cancellation can be used for the timeout with the +restriction that this behavior is documented for the method. Otherwise, timeouts +are expected to be handled by the user calling the API, not the implementation. + +Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method +of a provider. It is assumed the context passed from a user is not used for this purpose. + +Outside of the direct recording of telemetry from the API (e.g. exporting telemetry, +force flushing telemetry, shutting down a signal provider) the context cancellation +should be honored. This means all work done on behalf of the user provided context +should be canceled. + +## Approvers and Maintainers + +### Approvers + +- [Evan Torrie](https://github.com/evantorrie), Verizon Media +- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics +- [Chester Cheung](https://github.com/hanyuancheung), Tencent +- [Damien Mathieu](https://github.com/dmathieu), Elastic +- [Anthony Mirabella](https://github.com/Aneurysm9), AWS + +### Maintainers + +- [David Ashpole](https://github.com/dashpole), Google +- [Aaron Clawson](https://github.com/MadVikingGod), LightStep +- [Robert Pająk](https://github.com/pellared), Splunk +- [Tyler Yahn](https://github.com/MrAlias), Splunk + +### Emeritus + +- [Liz Fong-Jones](https://github.com/lizthegrey), Honeycomb +- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep +- [Josh MacDonald](https://github.com/jmacd), LightStep + +### Become an Approver or a Maintainer + +See the [community membership document in OpenTelemetry community +repo](https://github.com/open-telemetry/community/blob/main/community-membership.md). + +[Approver]: #approvers +[Maintainer]: #maintainers +[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl +[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404 diff --git a/vendor/go.opentelemetry.io/otel/LICENSE b/vendor/go.opentelemetry.io/otel/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile new file mode 100644 index 00000000..6de95219 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -0,0 +1,318 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +TOOLS_MOD_DIR := ./internal/tools + +ALL_DOCS := $(shell find . -name '*.md' -type f | sort) +ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) +OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) +ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort) + +GO = go +TIMEOUT = 60 + +.DEFAULT_GOAL := precommit + +.PHONY: precommit ci +precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default +ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage + +# Tools + +TOOLS = $(CURDIR)/.tools + +$(TOOLS): + @mkdir -p $@ +$(TOOLS)/%: | $(TOOLS) + cd $(TOOLS_MOD_DIR) && \ + $(GO) build -o $@ $(PACKAGE) + +MULTIMOD = $(TOOLS)/multimod +$(TOOLS)/multimod: PACKAGE=go.opentelemetry.io/build-tools/multimod + +SEMCONVGEN = $(TOOLS)/semconvgen +$(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen + +CROSSLINK = $(TOOLS)/crosslink +$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink + +SEMCONVKIT = $(TOOLS)/semconvkit +$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit + +DBOTCONF = $(TOOLS)/dbotconf +$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf + +GOLANGCI_LINT = $(TOOLS)/golangci-lint +$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint + +MISSPELL = $(TOOLS)/misspell +$(TOOLS)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell + +GOCOVMERGE = $(TOOLS)/gocovmerge +$(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge + +STRINGER = $(TOOLS)/stringer +$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer + +PORTO = $(TOOLS)/porto +$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto + +GOJQ = $(TOOLS)/gojq +$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq + +GOTMPL = $(TOOLS)/gotmpl +$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl + +GORELEASE = $(TOOLS)/gorelease +$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease + +GOVULNCHECK = $(TOOLS)/govulncheck +$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck + +.PHONY: tools +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) + +# Virtualized python tools via docker + +# The directory where the virtual environment is created. +VENVDIR := venv + +# The directory where the python tools are installed. +PYTOOLS := $(VENVDIR)/bin + +# The pip executable in the virtual environment. +PIP := $(PYTOOLS)/pip + +# The directory in the docker image where the current directory is mounted. +WORKDIR := /workdir + +# The python image to use for the virtual environment. +PYTHONIMAGE := python:3.11.3-slim-bullseye + +# Run the python image with the current directory mounted. +DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) + +# Create a virtual environment for Python tools. +$(PYTOOLS): +# The `--upgrade` flag is needed to ensure that the virtual environment is +# created with the latest pip version. + @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" + +# Install python packages into the virtual environment. +$(PYTOOLS)/%: | $(PYTOOLS) + @$(DOCKERPY) $(PIP) install -r requirements.txt + +CODESPELL = $(PYTOOLS)/codespell +$(CODESPELL): PACKAGE=codespell + +# Generate + +.PHONY: generate +generate: go-generate vanity-import-fix + +.PHONY: go-generate +go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) +go-generate/%: DIR=$* +go-generate/%: | $(STRINGER) $(GOTMPL) + @echo "$(GO) generate $(DIR)/..." \ + && cd $(DIR) \ + && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... + +.PHONY: vanity-import-fix +vanity-import-fix: | $(PORTO) + @$(PORTO) --include-internal -w . + +# Generate go.work file for local development. +.PHONY: go-work +go-work: | $(CROSSLINK) + $(CROSSLINK) work --root=$(shell pwd) + +# Build + +.PHONY: build + +build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) +build/%: DIR=$* +build/%: + @echo "$(GO) build $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) build ./... + +build-tests/%: DIR=$* +build-tests/%: + @echo "$(GO) build tests $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null + +# Tests + +TEST_TARGETS := test-default test-bench test-short test-verbose test-race +.PHONY: $(TEST_TARGETS) test +test-default test-race: ARGS=-race +test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=. +test-short: ARGS=-short +test-verbose: ARGS=-v -race +$(TEST_TARGETS): test +test: $(OTEL_GO_MOD_DIRS:%=test/%) +test/%: DIR=$* +test/%: + @echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS) + +COVERAGE_MODE = atomic +COVERAGE_PROFILE = coverage.out +.PHONY: test-coverage +test-coverage: | $(GOCOVMERGE) + @set -e; \ + printf "" > coverage.txt; \ + for dir in $(ALL_COVERAGE_MOD_DIRS); do \ + echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \ + (cd "$${dir}" && \ + $(GO) list ./... \ + | grep -v third_party \ + | grep -v 'semconv/v.*' \ + | xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \ + $(GO) tool cover -html=coverage.out -o coverage.html); \ + done; \ + $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt + +# Adding a directory will include all benchmarks in that directory if a filter is not specified. +BENCHMARK_TARGETS := sdk/trace +.PHONY: benchmark +benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) +BENCHMARK_FILTER = . +# You can override the filter for a particular directory by adding a rule here. +benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample +benchmark/%: + @echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \ + && cd $* \ + $(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter)) + +.PHONY: golangci-lint golangci-lint-fix +golangci-lint-fix: ARGS=--fix +golangci-lint-fix: golangci-lint +golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%) +golangci-lint/%: DIR=$* +golangci-lint/%: | $(GOLANGCI_LINT) + @echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \ + && cd $(DIR) \ + && $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS) + +.PHONY: crosslink +crosslink: | $(CROSSLINK) + @echo "Updating intra-repository dependencies in all go modules" \ + && $(CROSSLINK) --root=$(shell pwd) --prune + +.PHONY: go-mod-tidy +go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) +go-mod-tidy/%: DIR=$* +go-mod-tidy/%: | crosslink + @echo "$(GO) mod tidy in $(DIR)" \ + && cd $(DIR) \ + && $(GO) mod tidy -compat=1.20 + +.PHONY: lint-modules +lint-modules: go-mod-tidy + +.PHONY: lint +lint: misspell lint-modules golangci-lint govulncheck + +.PHONY: vanity-import-check +vanity-import-check: | $(PORTO) + @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) + +.PHONY: misspell +misspell: | $(MISSPELL) + @$(MISSPELL) -w $(ALL_DOCS) + +.PHONY: govulncheck +govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) +govulncheck/%: DIR=$* +govulncheck/%: | $(GOVULNCHECK) + @echo "govulncheck ./... in $(DIR)" \ + && cd $(DIR) \ + && $(GOVULNCHECK) ./... + +.PHONY: codespell +codespell: | $(CODESPELL) + @$(DOCKERPY) $(CODESPELL) + +.PHONY: license-check +license-check: + @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ + awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ + done); \ + if [ -n "$${licRes}" ]; then \ + echo "license header checking failed:"; echo "$${licRes}"; \ + exit 1; \ + fi + +DEPENDABOT_CONFIG = .github/dependabot.yml +.PHONY: dependabot-check +dependabot-check: | $(DBOTCONF) + @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 ) + +.PHONY: dependabot-generate +dependabot-generate: | $(DBOTCONF) + @$(DBOTCONF) generate > $(DEPENDABOT_CONFIG) + +.PHONY: check-clean-work-tree +check-clean-work-tree: + @if ! git diff --quiet; then \ + echo; \ + echo 'Working tree is not clean, did you forget to run "make precommit"?'; \ + echo; \ + git status; \ + exit 1; \ + fi + +SEMCONVPKG ?= "semconv/" +.PHONY: semconv-generate +semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) + [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) + [ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 ) + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" + +.PHONY: gorelease +gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%) +gorelease/%: DIR=$* +gorelease/%:| $(GORELEASE) + @echo "gorelease in $(DIR):" \ + && cd $(DIR) \ + && $(GORELEASE) \ + || echo "" + +.PHONY: prerelease +prerelease: | $(MULTIMOD) + @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) + $(MULTIMOD) verify && $(MULTIMOD) prerelease -m ${MODSET} + +COMMIT ?= "HEAD" +.PHONY: add-tags +add-tags: | $(MULTIMOD) + @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) + $(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} + +.PHONY: lint-markdown +lint-markdown: + docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md new file mode 100644 index 00000000..7766259a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -0,0 +1,112 @@ +# OpenTelemetry-Go + +[![CI](https://github.com/open-telemetry/opentelemetry-go/workflows/ci/badge.svg)](https://github.com/open-telemetry/opentelemetry-go/actions?query=workflow%3Aci+branch%3Amain) +[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-go/coverage.svg?branch=main)](https://app.codecov.io/gh/open-telemetry/opentelemetry-go?branch=main) +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel)](https://pkg.go.dev/go.opentelemetry.io/otel) +[![Go Report Card](https://goreportcard.com/badge/go.opentelemetry.io/otel)](https://goreportcard.com/report/go.opentelemetry.io/otel) +[![Slack](https://img.shields.io/badge/slack-@cncf/otel--go-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C01NPAXACKT) + +OpenTelemetry-Go is the [Go](https://golang.org/) implementation of [OpenTelemetry](https://opentelemetry.io/). +It provides a set of APIs to directly measure performance and behavior of your software and send this data to observability platforms. + +## Project Status + +| Signal | Status | +|---------|--------------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | In development[^1] | + +Progress and status specific to this repository is tracked in our +[project boards](https://github.com/open-telemetry/opentelemetry-go/projects) +and +[milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). + +Project versioning information and stability guarantees can be found in the +[versioning documentation](VERSIONING.md). + +[^1]: https://github.com/orgs/open-telemetry/projects/43 + +### Compatibility + +OpenTelemetry-Go ensures compatibility with the current supported versions of +the [Go language](https://golang.org/doc/devel/release#policy): + +> Each major Go release is supported until there are two newer major releases. +> For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release. + +For versions of Go that are no longer supported upstream, opentelemetry-go will +stop ensuring compatibility with these versions in the following manner: + +- A minor release of opentelemetry-go will be made to add support for the new + supported release of Go. +- The following minor release of opentelemetry-go will remove compatibility + testing for the oldest (now archived upstream) version of Go. This, and + future, releases of opentelemetry-go may include features only supported by + the currently supported versions of Go. + +Currently, this project supports the following environments. + +| OS | Go Version | Architecture | +|---------|------------|--------------| +| Ubuntu | 1.22 | amd64 | +| Ubuntu | 1.21 | amd64 | +| Ubuntu | 1.20 | amd64 | +| Ubuntu | 1.22 | 386 | +| Ubuntu | 1.21 | 386 | +| Ubuntu | 1.20 | 386 | +| MacOS | 1.22 | amd64 | +| MacOS | 1.21 | amd64 | +| MacOS | 1.20 | amd64 | +| Windows | 1.22 | amd64 | +| Windows | 1.21 | amd64 | +| Windows | 1.20 | amd64 | +| Windows | 1.22 | 386 | +| Windows | 1.21 | 386 | +| Windows | 1.20 | 386 | + +While this project should work for other systems, no compatibility guarantees +are made for those systems currently. + +## Getting Started + +You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/). + +OpenTelemetry's goal is to provide a single set of APIs to capture distributed +traces and metrics from your application and send them to an observability +platform. This project allows you to do just that for applications written in +Go. There are two steps to this process: instrument your application, and +configure an exporter. + +### Instrumentation + +To start capturing distributed traces and metric events from your application +it first needs to be instrumented. The easiest way to do this is by using an +instrumentation library for your code. Be sure to check out [the officially +supported instrumentation +libraries](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation). + +If you need to extend the telemetry an instrumentation library provides or want +to build your own instrumentation for your application directly you will need +to use the +[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel) +package. The included [examples](./example/) are a good way to see some +practical uses of this process. + +### Export + +Now that your application is instrumented to collect telemetry, it needs an +export pipeline to send that telemetry to an observability platform. + +All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). + +| Exporter | Metrics | Traces | +|---------------------------------------|:-------:|:------:| +| [OTLP](./exporters/otlp/) | ✓ | ✓ | +| [Prometheus](./exporters/prometheus/) | ✓ | | +| [stdout](./exporters/stdout/) | ✓ | ✓ | +| [Zipkin](./exporters/zipkin/) | | ✓ | + +## Contributing + +See the [contributing documentation](CONTRIBUTING.md). diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md new file mode 100644 index 00000000..d2691d0b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -0,0 +1,139 @@ +# Release Process + +## Semantic Convention Generation + +New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. +The `semconv-generate` make target is used for this. + +1. Checkout a local copy of the [OpenTelemetry Semantic Conventions] to the desired release tag. +2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` +3. Run the `make semconv-generate ...` target from this repository. + +For example, + +```sh +export TAG="v1.21.0" # Change to the release version you are generating. +export OTEL_SEMCONV_REPO="/absolute/path/to/opentelemetry/semantic-conventions" +docker pull otel/semconvgen:latest +make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO. +``` + +This should create a new sub-package of [`semconv`](./semconv). +Ensure things look correct before submitting a pull request to include the addition. + +## Breaking changes validation + +You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes done in the public API. + +You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). + +## Pre-Release + +First, decide which module sets will be released and update their versions +in `versions.yaml`. Commit this change to a new branch. + +Update go.mod for submodules to depend on the new release which will happen in the next step. + +1. Run the `prerelease` make target. It creates a branch + `prerelease__` that will contain all release changes. + + ``` + make prerelease MODSET= + ``` + +2. Verify the changes. + + ``` + git diff ...prerelease__ + ``` + + This should have changed the version for all modules to be ``. + If these changes look correct, merge them into your pre-release branch: + + ```go + git merge prerelease__ + ``` + +3. Update the [Changelog](./CHANGELOG.md). + - Make sure all relevant changes for this release are included and are in language that non-contributors to the project can understand. + To verify this, you can look directly at the commits since the ``. + + ``` + git --no-pager log --pretty=oneline "..HEAD" + ``` + + - Move all the `Unreleased` changes into a new section following the title scheme (`[] - `). + - Update all the appropriate links at the bottom. + +4. Push the changes to upstream and create a Pull Request on GitHub. + Be sure to include the curated changes from the [Changelog](./CHANGELOG.md) in the description. + +## Tag + +Once the Pull Request with all the version changes has been approved and merged it is time to tag the merged commit. + +***IMPORTANT***: It is critical you use the same tag that you used in the Pre-Release step! +Failure to do so will leave things in a broken state. As long as you do not +change `versions.yaml` between pre-release and this step, things should be fine. + +***IMPORTANT***: [There is currently no way to remove an incorrectly tagged version of a Go module](https://github.com/golang/go/issues/34189). +It is critical you make sure the version you push upstream is correct. +[Failure to do so will lead to minor emergencies and tough to work around](https://github.com/open-telemetry/opentelemetry-go/issues/331). + +1. For each module set that will be released, run the `add-tags` make target + using the `` of the commit on the main branch for the merged Pull Request. + + ``` + make add-tags MODSET= COMMIT= + ``` + + It should only be necessary to provide an explicit `COMMIT` value if the + current `HEAD` of your working directory is not the correct commit. + +2. Push tags to the upstream remote (not your fork: `github.com/open-telemetry/opentelemetry-go.git`). + Make sure you push all sub-modules as well. + + ``` + git push upstream + git push upstream + ... + ``` + +## Release + +Finally create a Release for the new `` on GitHub. +The release body should include all the release notes from the Changelog for this release. + +## Verify Examples + +After releasing verify that examples build outside of the repository. + +``` +./verify_examples.sh +``` + +The script copies examples into a different directory removes any `replace` declarations in `go.mod` and builds them. +This ensures they build with the published release, not the local copy. + +## Post-Release + +### Contrib Repository + +Once verified be sure to [make a release for the `contrib` repository](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md) that uses this release. + +### Website Documentation + +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go]. +Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. + +[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions +[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/ +[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go + +### Demo Repository + +Bump the dependencies in the following Go services: + +- [`accountingservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accountingservice) +- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkoutservice) +- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/productcatalogservice) diff --git a/vendor/go.opentelemetry.io/otel/VERSIONING.md b/vendor/go.opentelemetry.io/otel/VERSIONING.md new file mode 100644 index 00000000..412f1e36 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/VERSIONING.md @@ -0,0 +1,224 @@ +# Versioning + +This document describes the versioning policy for this repository. This policy +is designed so the following goals can be achieved. + +**Users are provided a codebase of value that is stable and secure.** + +## Policy + +* Versioning of this project will be idiomatic of a Go project using [Go + modules](https://github.com/golang/go/wiki/Modules). + * [Semantic import + versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) + will be used. + * Versions will comply with [semver + 2.0](https://semver.org/spec/v2.0.0.html) with the following exceptions. + * New methods may be added to exported API interfaces. All exported + interfaces that fall within this exception will include the following + paragraph in their public documentation. + + > Warning: methods may be added to this interface in minor releases. + + * If a module is version `v2` or higher, the major version of the module + must be included as a `/vN` at the end of the module paths used in + `go.mod` files (e.g., `module go.opentelemetry.io/otel/v2`, `require + go.opentelemetry.io/otel/v2 v2.0.1`) and in the package import path + (e.g., `import "go.opentelemetry.io/otel/v2/trace"`). This includes the + paths used in `go get` commands (e.g., `go get + go.opentelemetry.io/otel/v2@v2.0.1`. Note there is both a `/v2` and a + `@v2.0.1` in that example. One way to think about it is that the module + name now includes the `/v2`, so include `/v2` whenever you are using the + module name). + * If a module is version `v0` or `v1`, do not include the major version in + either the module path or the import path. + * Modules will be used to encapsulate signals and components. + * Experimental modules still under active development will be versioned at + `v0` to imply the stability guarantee defined by + [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). + + > Major version zero (0.y.z) is for initial development. Anything MAY + > change at any time. The public API SHOULD NOT be considered stable. + + * Mature modules for which we guarantee a stable public API will be versioned + with a major version greater than `v0`. + * The decision to make a module stable will be made on a case-by-case + basis by the maintainers of this project. + * Experimental modules will start their versioning at `v0.0.0` and will + increment their minor version when backwards incompatible changes are + released and increment their patch version when backwards compatible + changes are released. + * All stable modules that use the same major version number will use the + same entire version number. + * Stable modules may be released with an incremented minor or patch + version even though that module has not been changed, but rather so + that it will remain at the same version as other stable modules that + did undergo change. + * When an experimental module becomes stable a new stable module version + will be released and will include this now stable module. The new + stable module version will be an increment of the minor version number + and will be applied to all existing stable modules as well as the newly + stable module being released. +* Versioning of the associated [contrib + repository](https://github.com/open-telemetry/opentelemetry-go-contrib) of + this project will be idiomatic of a Go project using [Go + modules](https://github.com/golang/go/wiki/Modules). + * [Semantic import + versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) + will be used. + * Versions will comply with [semver 2.0](https://semver.org/spec/v2.0.0.html). + * If a module is version `v2` or higher, the + major version of the module must be included as a `/vN` at the end of the + module paths used in `go.mod` files (e.g., `module + go.opentelemetry.io/contrib/instrumentation/host/v2`, `require + go.opentelemetry.io/contrib/instrumentation/host/v2 v2.0.1`) and in the + package import path (e.g., `import + "go.opentelemetry.io/contrib/instrumentation/host/v2"`). This includes + the paths used in `go get` commands (e.g., `go get + go.opentelemetry.io/contrib/instrumentation/host/v2@v2.0.1`. Note there + is both a `/v2` and a `@v2.0.1` in that example. One way to think about + it is that the module name now includes the `/v2`, so include `/v2` + whenever you are using the module name). + * If a module is version `v0` or `v1`, do not include the major version + in either the module path or the import path. + * In addition to public APIs, telemetry produced by stable instrumentation + will remain stable and backwards compatible. This is to avoid breaking + alerts and dashboard. + * Modules will be used to encapsulate instrumentation, detectors, exporters, + propagators, and any other independent sets of related components. + * Experimental modules still under active development will be versioned at + `v0` to imply the stability guarantee defined by + [semver](https://semver.org/spec/v2.0.0.html#spec-item-4). + + > Major version zero (0.y.z) is for initial development. Anything MAY + > change at any time. The public API SHOULD NOT be considered stable. + + * Mature modules for which we guarantee a stable public API and telemetry will + be versioned with a major version greater than `v0`. + * Experimental modules will start their versioning at `v0.0.0` and will + increment their minor version when backwards incompatible changes are + released and increment their patch version when backwards compatible + changes are released. + * Stable contrib modules cannot depend on experimental modules from this + project. + * All stable contrib modules of the same major version with this project + will use the same entire version as this project. + * Stable modules may be released with an incremented minor or patch + version even though that module's code has not been changed. Instead + the only change that will have been included is to have updated that + modules dependency on this project's stable APIs. + * When an experimental module in contrib becomes stable a new stable + module version will be released and will include this now stable + module. The new stable module version will be an increment of the minor + version number and will be applied to all existing stable contrib + modules, this project's modules, and the newly stable module being + released. + * Contrib modules will be kept up to date with this project's releases. + * Due to the dependency contrib modules will implicitly have on this + project's modules the release of stable contrib modules to match the + released version number will be staggered after this project's release. + There is no explicit time guarantee for how long after this projects + release the contrib release will be. Effort should be made to keep them + as close in time as possible. + * No additional stable release in this project can be made until the + contrib repository has a matching stable release. + * No release can be made in the contrib repository after this project's + stable release except for a stable release of the contrib repository. +* GitHub releases will be made for all releases. +* Go modules will be made available at Go package mirrors. + +## Example Versioning Lifecycle + +To better understand the implementation of the above policy the following +example is provided. This project is simplified to include only the following +modules and their versions: + +* `otel`: `v0.14.0` +* `otel/trace`: `v0.14.0` +* `otel/metric`: `v0.14.0` +* `otel/baggage`: `v0.14.0` +* `otel/sdk/trace`: `v0.14.0` +* `otel/sdk/metric`: `v0.14.0` + +These modules have been developed to a point where the `otel/trace`, +`otel/baggage`, and `otel/sdk/trace` modules have reached a point that they +should be considered for a stable release. The `otel/metric` and +`otel/sdk/metric` are still under active development and the `otel` module +depends on both `otel/trace` and `otel/metric`. + +The `otel` package is refactored to remove its dependencies on `otel/metric` so +it can be released as stable as well. With that done the following release +candidates are made: + +* `otel`: `v1.0.0-RC1` +* `otel/trace`: `v1.0.0-RC1` +* `otel/baggage`: `v1.0.0-RC1` +* `otel/sdk/trace`: `v1.0.0-RC1` + +The `otel/metric` and `otel/sdk/metric` modules remain at `v0.14.0`. + +A few minor issues are discovered in the `otel/trace` package. These issues are +resolved with some minor, but backwards incompatible, changes and are released +as a second release candidate: + +* `otel`: `v1.0.0-RC2` +* `otel/trace`: `v1.0.0-RC2` +* `otel/baggage`: `v1.0.0-RC2` +* `otel/sdk/trace`: `v1.0.0-RC2` + +Notice that all module version numbers are incremented to adhere to our +versioning policy. + +After these release candidates have been evaluated to satisfaction, they are +released as version `v1.0.0`. + +* `otel`: `v1.0.0` +* `otel/trace`: `v1.0.0` +* `otel/baggage`: `v1.0.0` +* `otel/sdk/trace`: `v1.0.0` + +Since both the `go` utility and the Go module system support [the semantic +versioning definition of +precedence](https://semver.org/spec/v2.0.0.html#spec-item-11), this release +will correctly be interpreted as the successor to the previous release +candidates. + +Active development of this project continues. The `otel/metric` module now has +backwards incompatible changes to its API that need to be released and the +`otel/baggage` module has a minor bug fix that needs to be released. The +following release is made: + +* `otel`: `v1.0.1` +* `otel/trace`: `v1.0.1` +* `otel/metric`: `v0.15.0` +* `otel/baggage`: `v1.0.1` +* `otel/sdk/trace`: `v1.0.1` +* `otel/sdk/metric`: `v0.15.0` + +Notice that, again, all stable module versions are incremented in unison and +the `otel/sdk/metric` package, which depends on the `otel/metric` package, also +bumped its version. This bump of the `otel/sdk/metric` package makes sense +given their coupling, though it is not explicitly required by our versioning +policy. + +As we progress, the `otel/metric` and `otel/sdk/metric` packages have reached a +point where they should be evaluated for stability. The `otel` module is +reintegrated with the `otel/metric` package and the following release is made: + +* `otel`: `v1.1.0-RC1` +* `otel/trace`: `v1.1.0-RC1` +* `otel/metric`: `v1.1.0-RC1` +* `otel/baggage`: `v1.1.0-RC1` +* `otel/sdk/trace`: `v1.1.0-RC1` +* `otel/sdk/metric`: `v1.1.0-RC1` + +All the modules are evaluated and determined to a viable stable release. They +are then released as version `v1.1.0` (the minor version is incremented to +indicate the addition of new signal). + +* `otel`: `v1.1.0` +* `otel/trace`: `v1.1.0` +* `otel/metric`: `v1.1.0` +* `otel/baggage`: `v1.1.0` +* `otel/sdk/trace`: `v1.1.0` +* `otel/sdk/metric`: `v1.1.0` diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go new file mode 100644 index 00000000..dafe7424 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package attribute provides key and value attributes. +package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go new file mode 100644 index 00000000..fe2bc576 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -0,0 +1,146 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "bytes" + "sync" + "sync/atomic" +) + +type ( + // Encoder is a mechanism for serializing an attribute set into a specific + // string representation that supports caching, to avoid repeated + // serialization. An example could be an exporter encoding the attribute + // set into a wire representation. + Encoder interface { + // Encode returns the serialized encoding of the attribute set using + // its Iterator. This result may be cached by a attribute.Set. + Encode(iterator Iterator) string + + // ID returns a value that is unique for each class of attribute + // encoder. Attribute encoders allocate these using `NewEncoderID`. + ID() EncoderID + } + + // EncoderID is used to identify distinct Encoder + // implementations, for caching encoded results. + EncoderID struct { + value uint64 + } + + // defaultAttrEncoder uses a sync.Pool of buffers to reduce the number of + // allocations used in encoding attributes. This implementation encodes a + // comma-separated list of key=value, with '/'-escaping of '=', ',', and + // '\'. + defaultAttrEncoder struct { + // pool is a pool of attribute set builders. The buffers in this pool + // grow to a size that most attribute encodings will not allocate new + // memory. + pool sync.Pool // *bytes.Buffer + } +) + +// escapeChar is used to ensure uniqueness of the attribute encoding where +// keys or values contain either '=' or ','. Since there is no parser needed +// for this encoding and its only requirement is to be unique, this choice is +// arbitrary. Users will see these in some exporters (e.g., stdout), so the +// backslash ('\') is used as a conventional choice. +const escapeChar = '\\' + +var ( + _ Encoder = &defaultAttrEncoder{} + + // encoderIDCounter is for generating IDs for other attribute encoders. + encoderIDCounter uint64 + + defaultEncoderOnce sync.Once + defaultEncoderID = NewEncoderID() + defaultEncoderInstance *defaultAttrEncoder +) + +// NewEncoderID returns a unique attribute encoder ID. It should be called +// once per each type of attribute encoder. Preferably in init() or in var +// definition. +func NewEncoderID() EncoderID { + return EncoderID{value: atomic.AddUint64(&encoderIDCounter, 1)} +} + +// DefaultEncoder returns an attribute encoder that encodes attributes in such +// a way that each escaped attribute's key is followed by an equal sign and +// then by an escaped attribute's value. All key-value pairs are separated by +// a comma. +// +// Escaping is done by prepending a backslash before either a backslash, equal +// sign or a comma. +func DefaultEncoder() Encoder { + defaultEncoderOnce.Do(func() { + defaultEncoderInstance = &defaultAttrEncoder{ + pool: sync.Pool{ + New: func() interface{} { + return &bytes.Buffer{} + }, + }, + } + }) + return defaultEncoderInstance +} + +// Encode is a part of an implementation of the AttributeEncoder interface. +func (d *defaultAttrEncoder) Encode(iter Iterator) string { + buf := d.pool.Get().(*bytes.Buffer) + defer d.pool.Put(buf) + buf.Reset() + + for iter.Next() { + i, keyValue := iter.IndexedAttribute() + if i > 0 { + _, _ = buf.WriteRune(',') + } + copyAndEscape(buf, string(keyValue.Key)) + + _, _ = buf.WriteRune('=') + + if keyValue.Value.Type() == STRING { + copyAndEscape(buf, keyValue.Value.AsString()) + } else { + _, _ = buf.WriteString(keyValue.Value.Emit()) + } + } + return buf.String() +} + +// ID is a part of an implementation of the AttributeEncoder interface. +func (*defaultAttrEncoder) ID() EncoderID { + return defaultEncoderID +} + +// copyAndEscape escapes `=`, `,` and its own escape character (`\`), +// making the default encoding unique. +func copyAndEscape(buf *bytes.Buffer, val string) { + for _, ch := range val { + switch ch { + case '=', ',', escapeChar: + _, _ = buf.WriteRune(escapeChar) + } + _, _ = buf.WriteRune(ch) + } +} + +// Valid returns true if this encoder ID was allocated by +// `NewEncoderID`. Invalid encoder IDs will not be cached. +func (id EncoderID) Valid() bool { + return id.value != 0 +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go new file mode 100644 index 00000000..638c213d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Filter supports removing certain attributes from attribute sets. When +// the filter returns true, the attribute will be kept in the filtered +// attribute set. When the filter returns false, the attribute is excluded +// from the filtered attribute set, and the attribute instead appears in +// the removed list of excluded attributes. +type Filter func(KeyValue) bool + +// NewAllowKeysFilter returns a Filter that only allows attributes with one of +// the provided keys. +// +// If keys is empty a deny-all filter is returned. +func NewAllowKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return false } + } + + allowed := make(map[Key]struct{}) + for _, k := range keys { + allowed[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := allowed[kv.Key] + return ok + } +} + +// NewDenyKeysFilter returns a Filter that only allows attributes +// that do not have one of the provided keys. +// +// If keys is empty an allow-all filter is returned. +func NewDenyKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return true } + } + + forbid := make(map[Key]struct{}) + for _, k := range keys { + forbid[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := forbid[kv.Key] + return !ok + } +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go new file mode 100644 index 00000000..841b271f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/iterator.go @@ -0,0 +1,161 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Iterator allows iterating over the set of attributes in order, sorted by +// key. +type Iterator struct { + storage *Set + idx int +} + +// MergeIterator supports iterating over two sets of attributes while +// eliminating duplicate values from the combined set. The first iterator +// value takes precedence. +type MergeIterator struct { + one oneIterator + two oneIterator + current KeyValue +} + +type oneIterator struct { + iter Iterator + done bool + attr KeyValue +} + +// Next moves the iterator to the next position. Returns false if there are no +// more attributes. +func (i *Iterator) Next() bool { + i.idx++ + return i.idx < i.Len() +} + +// Label returns current KeyValue. Must be called only after Next returns +// true. +// +// Deprecated: Use Attribute instead. +func (i *Iterator) Label() KeyValue { + return i.Attribute() +} + +// Attribute returns the current KeyValue of the Iterator. It must be called +// only after Next returns true. +func (i *Iterator) Attribute() KeyValue { + kv, _ := i.storage.Get(i.idx) + return kv +} + +// IndexedLabel returns current index and attribute. Must be called only +// after Next returns true. +// +// Deprecated: Use IndexedAttribute instead. +func (i *Iterator) IndexedLabel() (int, KeyValue) { + return i.idx, i.Attribute() +} + +// IndexedAttribute returns current index and attribute. Must be called only +// after Next returns true. +func (i *Iterator) IndexedAttribute() (int, KeyValue) { + return i.idx, i.Attribute() +} + +// Len returns a number of attributes in the iterated set. +func (i *Iterator) Len() int { + return i.storage.Len() +} + +// ToSlice is a convenience function that creates a slice of attributes from +// the passed iterator. The iterator is set up to start from the beginning +// before creating the slice. +func (i *Iterator) ToSlice() []KeyValue { + l := i.Len() + if l == 0 { + return nil + } + i.idx = -1 + slice := make([]KeyValue, 0, l) + for i.Next() { + slice = append(slice, i.Attribute()) + } + return slice +} + +// NewMergeIterator returns a MergeIterator for merging two attribute sets. +// Duplicates are resolved by taking the value from the first set. +func NewMergeIterator(s1, s2 *Set) MergeIterator { + mi := MergeIterator{ + one: makeOne(s1.Iter()), + two: makeOne(s2.Iter()), + } + return mi +} + +func makeOne(iter Iterator) oneIterator { + oi := oneIterator{ + iter: iter, + } + oi.advance() + return oi +} + +func (oi *oneIterator) advance() { + if oi.done = !oi.iter.Next(); !oi.done { + oi.attr = oi.iter.Attribute() + } +} + +// Next returns true if there is another attribute available. +func (m *MergeIterator) Next() bool { + if m.one.done && m.two.done { + return false + } + if m.one.done { + m.current = m.two.attr + m.two.advance() + return true + } + if m.two.done { + m.current = m.one.attr + m.one.advance() + return true + } + if m.one.attr.Key == m.two.attr.Key { + m.current = m.one.attr // first iterator attribute value wins + m.one.advance() + m.two.advance() + return true + } + if m.one.attr.Key < m.two.attr.Key { + m.current = m.one.attr + m.one.advance() + return true + } + m.current = m.two.attr + m.two.advance() + return true +} + +// Label returns the current value after Next() returns true. +// +// Deprecated: Use Attribute instead. +func (m *MergeIterator) Label() KeyValue { + return m.current +} + +// Attribute returns the current value after Next() returns true. +func (m *MergeIterator) Attribute() KeyValue { + return m.current +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go new file mode 100644 index 00000000..0656a04e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -0,0 +1,134 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Key represents the key part in key-value pairs. It's a string. The +// allowed character set in the key depends on the use of the key. +type Key string + +// Bool creates a KeyValue instance with a BOOL Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Bool(name, value). +func (k Key) Bool(v bool) KeyValue { + return KeyValue{ + Key: k, + Value: BoolValue(v), + } +} + +// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- BoolSlice(name, value). +func (k Key) BoolSlice(v []bool) KeyValue { + return KeyValue{ + Key: k, + Value: BoolSliceValue(v), + } +} + +// Int creates a KeyValue instance with an INT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int(name, value). +func (k Key) Int(v int) KeyValue { + return KeyValue{ + Key: k, + Value: IntValue(v), + } +} + +// IntSlice creates a KeyValue instance with an INT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- IntSlice(name, value). +func (k Key) IntSlice(v []int) KeyValue { + return KeyValue{ + Key: k, + Value: IntSliceValue(v), + } +} + +// Int64 creates a KeyValue instance with an INT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64(name, value). +func (k Key) Int64(v int64) KeyValue { + return KeyValue{ + Key: k, + Value: Int64Value(v), + } +} + +// Int64Slice creates a KeyValue instance with an INT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64Slice(name, value). +func (k Key) Int64Slice(v []int64) KeyValue { + return KeyValue{ + Key: k, + Value: Int64SliceValue(v), + } +} + +// Float64 creates a KeyValue instance with a FLOAT64 Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). +func (k Key) Float64(v float64) KeyValue { + return KeyValue{ + Key: k, + Value: Float64Value(v), + } +} + +// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). +func (k Key) Float64Slice(v []float64) KeyValue { + return KeyValue{ + Key: k, + Value: Float64SliceValue(v), + } +} + +// String creates a KeyValue instance with a STRING Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- String(name, value). +func (k Key) String(v string) KeyValue { + return KeyValue{ + Key: k, + Value: StringValue(v), + } +} + +// StringSlice creates a KeyValue instance with a STRINGSLICE Value. +// +// If creating both a key and value at the same time, use the provided +// convenience function instead -- StringSlice(name, value). +func (k Key) StringSlice(v []string) KeyValue { + return KeyValue{ + Key: k, + Value: StringSliceValue(v), + } +} + +// Defined returns true for non-empty keys. +func (k Key) Defined() bool { + return len(k) != 0 +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go new file mode 100644 index 00000000..1ddf3ce0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -0,0 +1,86 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "fmt" +) + +// KeyValue holds a key and value pair. +type KeyValue struct { + Key Key + Value Value +} + +// Valid returns if kv is a valid OpenTelemetry attribute. +func (kv KeyValue) Valid() bool { + return kv.Key.Defined() && kv.Value.Type() != INVALID +} + +// Bool creates a KeyValue with a BOOL Value type. +func Bool(k string, v bool) KeyValue { + return Key(k).Bool(v) +} + +// BoolSlice creates a KeyValue with a BOOLSLICE Value type. +func BoolSlice(k string, v []bool) KeyValue { + return Key(k).BoolSlice(v) +} + +// Int creates a KeyValue with an INT64 Value type. +func Int(k string, v int) KeyValue { + return Key(k).Int(v) +} + +// IntSlice creates a KeyValue with an INT64SLICE Value type. +func IntSlice(k string, v []int) KeyValue { + return Key(k).IntSlice(v) +} + +// Int64 creates a KeyValue with an INT64 Value type. +func Int64(k string, v int64) KeyValue { + return Key(k).Int64(v) +} + +// Int64Slice creates a KeyValue with an INT64SLICE Value type. +func Int64Slice(k string, v []int64) KeyValue { + return Key(k).Int64Slice(v) +} + +// Float64 creates a KeyValue with a FLOAT64 Value type. +func Float64(k string, v float64) KeyValue { + return Key(k).Float64(v) +} + +// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. +func Float64Slice(k string, v []float64) KeyValue { + return Key(k).Float64Slice(v) +} + +// String creates a KeyValue with a STRING Value type. +func String(k, v string) KeyValue { + return Key(k).String(v) +} + +// StringSlice creates a KeyValue with a STRINGSLICE Value type. +func StringSlice(k string, v []string) KeyValue { + return Key(k).StringSlice(v) +} + +// Stringer creates a new key-value pair with a passed name and a string +// value generated by the passed Stringer interface. +func Stringer(k string, v fmt.Stringer) KeyValue { + return Key(k).String(v.String()) +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go new file mode 100644 index 00000000..fb6da514 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -0,0 +1,452 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "encoding/json" + "reflect" + "sort" + "sync" +) + +type ( + // Set is the representation for a distinct attribute set. It manages an + // immutable set of attributes, with an internal cache for storing + // attribute encodings. + // + // This type supports the Equivalent method of comparison using values of + // type Distinct. + Set struct { + equivalent Distinct + } + + // Distinct wraps a variable-size array of KeyValue, constructed with keys + // in sorted order. This can be used as a map key or for equality checking + // between Sets. + Distinct struct { + iface interface{} + } + + // Sortable implements sort.Interface, used for sorting KeyValue. This is + // an exported type to support a memory optimization. A pointer to one of + // these is needed for the call to sort.Stable(), which the caller may + // provide in order to avoid an allocation. See NewSetWithSortable(). + Sortable []KeyValue +) + +var ( + // keyValueType is used in computeDistinctReflect. + keyValueType = reflect.TypeOf(KeyValue{}) + + // emptySet is returned for empty attribute sets. + emptySet = &Set{ + equivalent: Distinct{ + iface: [0]KeyValue{}, + }, + } + + // sortables is a pool of Sortables used to create Sets with a user does + // not provide one. + sortables = sync.Pool{ + New: func() interface{} { return new(Sortable) }, + } +) + +// EmptySet returns a reference to a Set with no elements. +// +// This is a convenience provided for optimized calling utility. +func EmptySet() *Set { + return emptySet +} + +// reflectValue abbreviates reflect.ValueOf(d). +func (d Distinct) reflectValue() reflect.Value { + return reflect.ValueOf(d.iface) +} + +// Valid returns true if this value refers to a valid Set. +func (d Distinct) Valid() bool { + return d.iface != nil +} + +// Len returns the number of attributes in this set. +func (l *Set) Len() int { + if l == nil || !l.equivalent.Valid() { + return 0 + } + return l.equivalent.reflectValue().Len() +} + +// Get returns the KeyValue at ordered position idx in this set. +func (l *Set) Get(idx int) (KeyValue, bool) { + if l == nil || !l.equivalent.Valid() { + return KeyValue{}, false + } + value := l.equivalent.reflectValue() + + if idx >= 0 && idx < value.Len() { + // Note: The Go compiler successfully avoids an allocation for + // the interface{} conversion here: + return value.Index(idx).Interface().(KeyValue), true + } + + return KeyValue{}, false +} + +// Value returns the value of a specified key in this set. +func (l *Set) Value(k Key) (Value, bool) { + if l == nil || !l.equivalent.Valid() { + return Value{}, false + } + rValue := l.equivalent.reflectValue() + vlen := rValue.Len() + + idx := sort.Search(vlen, func(idx int) bool { + return rValue.Index(idx).Interface().(KeyValue).Key >= k + }) + if idx >= vlen { + return Value{}, false + } + keyValue := rValue.Index(idx).Interface().(KeyValue) + if k == keyValue.Key { + return keyValue.Value, true + } + return Value{}, false +} + +// HasValue tests whether a key is defined in this set. +func (l *Set) HasValue(k Key) bool { + if l == nil { + return false + } + _, ok := l.Value(k) + return ok +} + +// Iter returns an iterator for visiting the attributes in this set. +func (l *Set) Iter() Iterator { + return Iterator{ + storage: l, + idx: -1, + } +} + +// ToSlice returns the set of attributes belonging to this set, sorted, where +// keys appear no more than once. +func (l *Set) ToSlice() []KeyValue { + iter := l.Iter() + return iter.ToSlice() +} + +// Equivalent returns a value that may be used as a map key. The Distinct type +// guarantees that the result will equal the equivalent. Distinct value of any +// attribute set with the same elements as this, where sets are made unique by +// choosing the last value in the input for any given key. +func (l *Set) Equivalent() Distinct { + if l == nil || !l.equivalent.Valid() { + return emptySet.equivalent + } + return l.equivalent +} + +// Equals returns true if the argument set is equivalent to this set. +func (l *Set) Equals(o *Set) bool { + return l.Equivalent() == o.Equivalent() +} + +// Encoded returns the encoded form of this set, according to encoder. +func (l *Set) Encoded(encoder Encoder) string { + if l == nil || encoder == nil { + return "" + } + + return encoder.Encode(l.Iter()) +} + +func empty() Set { + return Set{ + equivalent: emptySet.equivalent, + } +} + +// NewSet returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// Except for empty sets, this method adds an additional allocation compared +// with calls that include a Sortable. +func NewSet(kvs ...KeyValue) Set { + // Check for empty set. + if len(kvs) == 0 { + return empty() + } + srt := sortables.Get().(*Sortable) + s, _ := NewSetWithSortableFiltered(kvs, srt, nil) + sortables.Put(srt) + return s +} + +// NewSetWithSortable returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// This call includes a Sortable option as a memory optimization. +func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { + // Check for empty set. + if len(kvs) == 0 { + return empty() + } + s, _ := NewSetWithSortableFiltered(kvs, tmp, nil) + return s +} + +// NewSetWithFiltered returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. +// +// This call includes a Filter to include/exclude attribute keys from the +// return value. Excluded keys are returned as a slice of attribute values. +func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { + // Check for empty set. + if len(kvs) == 0 { + return empty(), nil + } + srt := sortables.Get().(*Sortable) + s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) + sortables.Put(srt) + return s, filtered +} + +// NewSetWithSortableFiltered returns a new Set. +// +// Duplicate keys are eliminated by taking the last value. This +// re-orders the input slice so that unique last-values are contiguous +// at the end of the slice. +// +// This ensures the following: +// +// - Last-value-wins semantics +// - Caller sees the reordering, but doesn't lose values +// - Repeated call preserve last-value wins. +// +// Note that methods are defined on Set, although this returns Set. Callers +// can avoid memory allocations by: +// +// - allocating a Sortable for use as a temporary in this method +// - allocating a Set for storing the return value of this constructor. +// +// The result maintains a cache of encoded attributes, by attribute.EncoderID. +// This value should not be copied after its first use. +// +// The second []KeyValue return value is a list of attributes that were +// excluded by the Filter (if non-nil). +func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) { + // Check for empty set. + if len(kvs) == 0 { + return empty(), nil + } + + *tmp = kvs + + // Stable sort so the following de-duplication can implement + // last-value-wins semantics. + sort.Stable(tmp) + + *tmp = nil + + position := len(kvs) - 1 + offset := position - 1 + + // The requirements stated above require that the stable + // result be placed in the end of the input slice, while + // overwritten values are swapped to the beginning. + // + // De-duplicate with last-value-wins semantics. Preserve + // duplicate values at the beginning of the input slice. + for ; offset >= 0; offset-- { + if kvs[offset].Key == kvs[position].Key { + continue + } + position-- + kvs[offset], kvs[position] = kvs[position], kvs[offset] + } + kvs = kvs[position:] + + if filter != nil { + if div := filteredToFront(kvs, filter); div != 0 { + return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div] + } + } + return Set{equivalent: computeDistinct(kvs)}, nil +} + +// filteredToFront filters slice in-place using keep function. All KeyValues that need to +// be removed are moved to the front. All KeyValues that need to be kept are +// moved (in-order) to the back. The index for the first KeyValue to be kept is +// returned. +func filteredToFront(slice []KeyValue, keep Filter) int { + n := len(slice) + j := n + for i := n - 1; i >= 0; i-- { + if keep(slice[i]) { + j-- + slice[i], slice[j] = slice[j], slice[i] + } + } + return j +} + +// Filter returns a filtered copy of this Set. See the documentation for +// NewSetWithSortableFiltered for more details. +func (l *Set) Filter(re Filter) (Set, []KeyValue) { + if re == nil { + return *l, nil + } + + // Iterate in reverse to the first attribute that will be filtered out. + n := l.Len() + first := n - 1 + for ; first >= 0; first-- { + kv, _ := l.Get(first) + if !re(kv) { + break + } + } + + // No attributes will be dropped, return the immutable Set l and nil. + if first < 0 { + return *l, nil + } + + // Copy now that we know we need to return a modified set. + // + // Do not do this in-place on the underlying storage of *Set l. Sets are + // immutable and filtering should not change this. + slice := l.ToSlice() + + // Don't re-iterate the slice if only slice[0] is filtered. + if first == 0 { + // It is safe to assume len(slice) >= 1 given we found at least one + // attribute above that needs to be filtered out. + return Set{equivalent: computeDistinct(slice[1:])}, slice[:1] + } + + // Move the filtered slice[first] to the front (preserving order). + kv := slice[first] + copy(slice[1:first+1], slice[:first]) + slice[0] = kv + + // Do not re-evaluate re(slice[first+1:]). + div := filteredToFront(slice[1:first+1], re) + 1 + return Set{equivalent: computeDistinct(slice[div:])}, slice[:div] +} + +// computeDistinct returns a Distinct using either the fixed- or +// reflect-oriented code path, depending on the size of the input. The input +// slice is assumed to already be sorted and de-duplicated. +func computeDistinct(kvs []KeyValue) Distinct { + iface := computeDistinctFixed(kvs) + if iface == nil { + iface = computeDistinctReflect(kvs) + } + return Distinct{ + iface: iface, + } +} + +// computeDistinctFixed computes a Distinct for small slices. It returns nil +// if the input is too large for this code path. +func computeDistinctFixed(kvs []KeyValue) interface{} { + switch len(kvs) { + case 1: + ptr := new([1]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 2: + ptr := new([2]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 3: + ptr := new([3]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 4: + ptr := new([4]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 5: + ptr := new([5]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 6: + ptr := new([6]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 7: + ptr := new([7]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 8: + ptr := new([8]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 9: + ptr := new([9]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + case 10: + ptr := new([10]KeyValue) + copy((*ptr)[:], kvs) + return *ptr + default: + return nil + } +} + +// computeDistinctReflect computes a Distinct using reflection, works for any +// size input. +func computeDistinctReflect(kvs []KeyValue) interface{} { + at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem() + for i, keyValue := range kvs { + *(at.Index(i).Addr().Interface().(*KeyValue)) = keyValue + } + return at.Interface() +} + +// MarshalJSON returns the JSON encoding of the Set. +func (l *Set) MarshalJSON() ([]byte, error) { + return json.Marshal(l.equivalent.iface) +} + +// MarshalLog is the marshaling function used by the logging system to represent this Set. +func (l Set) MarshalLog() interface{} { + kvs := make(map[string]string) + for _, kv := range l.ToSlice() { + kvs[string(kv.Key)] = kv.Value.Emit() + } + return kvs +} + +// Len implements sort.Interface. +func (l *Sortable) Len() int { + return len(*l) +} + +// Swap implements sort.Interface. +func (l *Sortable) Swap(i, j int) { + (*l)[i], (*l)[j] = (*l)[j], (*l)[i] +} + +// Less implements sort.Interface. +func (l *Sortable) Less(i, j int) bool { + return (*l)[i].Key < (*l)[j].Key +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go new file mode 100644 index 00000000..e584b247 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -0,0 +1,31 @@ +// Code generated by "stringer -type=Type"; DO NOT EDIT. + +package attribute + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[INVALID-0] + _ = x[BOOL-1] + _ = x[INT64-2] + _ = x[FLOAT64-3] + _ = x[STRING-4] + _ = x[BOOLSLICE-5] + _ = x[INT64SLICE-6] + _ = x[FLOAT64SLICE-7] + _ = x[STRINGSLICE-8] +} + +const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" + +var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 38, 48, 60, 71} + +func (i Type) String() string { + if i < 0 || i >= Type(len(_Type_index)-1) { + return "Type(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Type_name[_Type_index[i]:_Type_index[i+1]] +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go new file mode 100644 index 00000000..cb21dd5c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -0,0 +1,270 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +import ( + "encoding/json" + "fmt" + "reflect" + "strconv" + + "go.opentelemetry.io/otel/internal" + "go.opentelemetry.io/otel/internal/attribute" +) + +//go:generate stringer -type=Type + +// Type describes the type of the data Value holds. +type Type int // nolint: revive // redefines builtin Type. + +// Value represents the value part in key-value pairs. +type Value struct { + vtype Type + numeric uint64 + stringly string + slice interface{} +} + +const ( + // INVALID is used for a Value with no value set. + INVALID Type = iota + // BOOL is a boolean Type Value. + BOOL + // INT64 is a 64-bit signed integral Type Value. + INT64 + // FLOAT64 is a 64-bit floating point Type Value. + FLOAT64 + // STRING is a string Type Value. + STRING + // BOOLSLICE is a slice of booleans Type Value. + BOOLSLICE + // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. + INT64SLICE + // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. + FLOAT64SLICE + // STRINGSLICE is a slice of strings Type Value. + STRINGSLICE +) + +// BoolValue creates a BOOL Value. +func BoolValue(v bool) Value { + return Value{ + vtype: BOOL, + numeric: internal.BoolToRaw(v), + } +} + +// BoolSliceValue creates a BOOLSLICE Value. +func BoolSliceValue(v []bool) Value { + return Value{vtype: BOOLSLICE, slice: attribute.BoolSliceValue(v)} +} + +// IntValue creates an INT64 Value. +func IntValue(v int) Value { + return Int64Value(int64(v)) +} + +// IntSliceValue creates an INTSLICE Value. +func IntSliceValue(v []int) Value { + var int64Val int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(int64Val))) + for i, val := range v { + cp.Elem().Index(i).SetInt(int64(val)) + } + return Value{ + vtype: INT64SLICE, + slice: cp.Elem().Interface(), + } +} + +// Int64Value creates an INT64 Value. +func Int64Value(v int64) Value { + return Value{ + vtype: INT64, + numeric: internal.Int64ToRaw(v), + } +} + +// Int64SliceValue creates an INT64SLICE Value. +func Int64SliceValue(v []int64) Value { + return Value{vtype: INT64SLICE, slice: attribute.Int64SliceValue(v)} +} + +// Float64Value creates a FLOAT64 Value. +func Float64Value(v float64) Value { + return Value{ + vtype: FLOAT64, + numeric: internal.Float64ToRaw(v), + } +} + +// Float64SliceValue creates a FLOAT64SLICE Value. +func Float64SliceValue(v []float64) Value { + return Value{vtype: FLOAT64SLICE, slice: attribute.Float64SliceValue(v)} +} + +// StringValue creates a STRING Value. +func StringValue(v string) Value { + return Value{ + vtype: STRING, + stringly: v, + } +} + +// StringSliceValue creates a STRINGSLICE Value. +func StringSliceValue(v []string) Value { + return Value{vtype: STRINGSLICE, slice: attribute.StringSliceValue(v)} +} + +// Type returns a type of the Value. +func (v Value) Type() Type { + return v.vtype +} + +// AsBool returns the bool value. Make sure that the Value's type is +// BOOL. +func (v Value) AsBool() bool { + return internal.RawToBool(v.numeric) +} + +// AsBoolSlice returns the []bool value. Make sure that the Value's type is +// BOOLSLICE. +func (v Value) AsBoolSlice() []bool { + if v.vtype != BOOLSLICE { + return nil + } + return v.asBoolSlice() +} + +func (v Value) asBoolSlice() []bool { + return attribute.AsBoolSlice(v.slice) +} + +// AsInt64 returns the int64 value. Make sure that the Value's type is +// INT64. +func (v Value) AsInt64() int64 { + return internal.RawToInt64(v.numeric) +} + +// AsInt64Slice returns the []int64 value. Make sure that the Value's type is +// INT64SLICE. +func (v Value) AsInt64Slice() []int64 { + if v.vtype != INT64SLICE { + return nil + } + return v.asInt64Slice() +} + +func (v Value) asInt64Slice() []int64 { + return attribute.AsInt64Slice(v.slice) +} + +// AsFloat64 returns the float64 value. Make sure that the Value's +// type is FLOAT64. +func (v Value) AsFloat64() float64 { + return internal.RawToFloat64(v.numeric) +} + +// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is +// FLOAT64SLICE. +func (v Value) AsFloat64Slice() []float64 { + if v.vtype != FLOAT64SLICE { + return nil + } + return v.asFloat64Slice() +} + +func (v Value) asFloat64Slice() []float64 { + return attribute.AsFloat64Slice(v.slice) +} + +// AsString returns the string value. Make sure that the Value's type +// is STRING. +func (v Value) AsString() string { + return v.stringly +} + +// AsStringSlice returns the []string value. Make sure that the Value's type is +// STRINGSLICE. +func (v Value) AsStringSlice() []string { + if v.vtype != STRINGSLICE { + return nil + } + return v.asStringSlice() +} + +func (v Value) asStringSlice() []string { + return attribute.AsStringSlice(v.slice) +} + +type unknownValueType struct{} + +// AsInterface returns Value's data as interface{}. +func (v Value) AsInterface() interface{} { + switch v.Type() { + case BOOL: + return v.AsBool() + case BOOLSLICE: + return v.asBoolSlice() + case INT64: + return v.AsInt64() + case INT64SLICE: + return v.asInt64Slice() + case FLOAT64: + return v.AsFloat64() + case FLOAT64SLICE: + return v.asFloat64Slice() + case STRING: + return v.stringly + case STRINGSLICE: + return v.asStringSlice() + } + return unknownValueType{} +} + +// Emit returns a string representation of Value's data. +func (v Value) Emit() string { + switch v.Type() { + case BOOLSLICE: + return fmt.Sprint(v.asBoolSlice()) + case BOOL: + return strconv.FormatBool(v.AsBool()) + case INT64SLICE: + return fmt.Sprint(v.asInt64Slice()) + case INT64: + return strconv.FormatInt(v.AsInt64(), 10) + case FLOAT64SLICE: + return fmt.Sprint(v.asFloat64Slice()) + case FLOAT64: + return fmt.Sprint(v.AsFloat64()) + case STRINGSLICE: + return fmt.Sprint(v.asStringSlice()) + case STRING: + return v.stringly + default: + return "unknown" + } +} + +// MarshalJSON returns the JSON encoding of the Value. +func (v Value) MarshalJSON() ([]byte, error) { + var jsonVal struct { + Type string + Value interface{} + } + jsonVal.Type = v.Type().String() + jsonVal.Value = v.AsInterface() + return json.Marshal(jsonVal) +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go new file mode 100644 index 00000000..7d27cf77 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -0,0 +1,744 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package baggage // import "go.opentelemetry.io/otel/baggage" + +import ( + "errors" + "fmt" + "net/url" + "strings" + + "go.opentelemetry.io/otel/internal/baggage" +) + +const ( + maxMembers = 180 + maxBytesPerMembers = 4096 + maxBytesPerBaggageString = 8192 + + listDelimiter = "," + keyValueDelimiter = "=" + propertyDelimiter = ";" +) + +var ( + errInvalidKey = errors.New("invalid key") + errInvalidValue = errors.New("invalid value") + errInvalidProperty = errors.New("invalid baggage list-member property") + errInvalidMember = errors.New("invalid baggage list-member") + errMemberNumber = errors.New("too many list-members in baggage-string") + errMemberBytes = errors.New("list-member too large") + errBaggageBytes = errors.New("baggage-string too large") +) + +// Property is an additional metadata entry for a baggage list-member. +type Property struct { + key, value string + + // hasValue indicates if a zero-value value means the property does not + // have a value or if it was the zero-value. + hasValue bool +} + +// NewKeyProperty returns a new Property for key. +// +// If key is invalid, an error will be returned. +func NewKeyProperty(key string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + p := Property{key: key} + return p, nil +} + +// NewKeyValueProperty returns a new Property for key with value. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be precent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewKeyValuePropertyRaw] instead +// that does not require precent-encoding of the value. +func NewKeyValueProperty(key, value string) (Property, error) { + if !validateValue(value) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewKeyValuePropertyRaw(key, decodedValue) +} + +// NewKeyValuePropertyRaw returns a new Property for key with value. +// +// The passed key must be compliant with W3C Baggage specification. +func NewKeyValuePropertyRaw(key, value string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + p := Property{ + key: key, + value: value, + hasValue: true, + } + return p, nil +} + +func newInvalidProperty() Property { + return Property{} +} + +// parseProperty attempts to decode a Property from the passed string. It +// returns an error if the input is invalid according to the W3C Baggage +// specification. +func parseProperty(property string) (Property, error) { + if property == "" { + return newInvalidProperty(), nil + } + + p, ok := parsePropertyInternal(property) + if !ok { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) + } + + return p, nil +} + +// validate ensures p conforms to the W3C Baggage specification, returning an +// error otherwise. +func (p Property) validate() error { + errFunc := func(err error) error { + return fmt.Errorf("invalid property: %w", err) + } + + if !validateKey(p.key) { + return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) + } + if !p.hasValue && p.value != "" { + return errFunc(errors.New("inconsistent value")) + } + return nil +} + +// Key returns the Property key. +func (p Property) Key() string { + return p.key +} + +// Value returns the Property value. Additionally, a boolean value is returned +// indicating if the returned value is the empty if the Property has a value +// that is empty or if the value is not set. +func (p Property) Value() (string, bool) { + return p.value, p.hasValue +} + +// String encodes Property into a header string compliant with the W3C Baggage +// specification. +func (p Property) String() string { + if p.hasValue { + return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) + } + return p.key +} + +type properties []Property + +func fromInternalProperties(iProps []baggage.Property) properties { + if len(iProps) == 0 { + return nil + } + + props := make(properties, len(iProps)) + for i, p := range iProps { + props[i] = Property{ + key: p.Key, + value: p.Value, + hasValue: p.HasValue, + } + } + return props +} + +func (p properties) asInternal() []baggage.Property { + if len(p) == 0 { + return nil + } + + iProps := make([]baggage.Property, len(p)) + for i, prop := range p { + iProps[i] = baggage.Property{ + Key: prop.key, + Value: prop.value, + HasValue: prop.hasValue, + } + } + return iProps +} + +func (p properties) Copy() properties { + if len(p) == 0 { + return nil + } + + props := make(properties, len(p)) + copy(props, p) + return props +} + +// validate ensures each Property in p conforms to the W3C Baggage +// specification, returning an error otherwise. +func (p properties) validate() error { + for _, prop := range p { + if err := prop.validate(); err != nil { + return err + } + } + return nil +} + +// String encodes properties into a header string compliant with the W3C Baggage +// specification. +func (p properties) String() string { + props := make([]string, len(p)) + for i, prop := range p { + props[i] = prop.String() + } + return strings.Join(props, propertyDelimiter) +} + +// Member is a list-member of a baggage-string as defined by the W3C Baggage +// specification. +type Member struct { + key, value string + properties properties + + // hasData indicates whether the created property contains data or not. + // Properties that do not contain data are invalid with no other check + // required. + hasData bool +} + +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be precent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewMemberRaw] instead +// that does not require precent-encoding of the value. +func NewMember(key, value string, props ...Property) (Member, error) { + if !validateValue(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewMemberRaw(key, decodedValue, props...) +} + +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +func NewMemberRaw(key, value string, props ...Property) (Member, error) { + m := Member{ + key: key, + value: value, + properties: properties(props).Copy(), + hasData: true, + } + if err := m.validate(); err != nil { + return newInvalidMember(), err + } + return m, nil +} + +func newInvalidMember() Member { + return Member{} +} + +// parseMember attempts to decode a Member from the passed string. It returns +// an error if the input is invalid according to the W3C Baggage +// specification. +func parseMember(member string) (Member, error) { + if n := len(member); n > maxBytesPerMembers { + return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n) + } + + var props properties + keyValue, properties, found := strings.Cut(member, propertyDelimiter) + if found { + // Parse the member properties. + for _, pStr := range strings.Split(properties, propertyDelimiter) { + p, err := parseProperty(pStr) + if err != nil { + return newInvalidMember(), err + } + props = append(props, p) + } + } + // Parse the member key/value pair. + + // Take into account a value can contain equal signs (=). + k, v, found := strings.Cut(keyValue, keyValueDelimiter) + if !found { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) + } + // "Leading and trailing whitespaces are allowed but MUST be trimmed + // when converting the header into a data structure." + key := strings.TrimSpace(k) + if !validateKey(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + + val := strings.TrimSpace(v) + if !validateValue(val) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) + } + + // Decode a precent-encoded value. + value, err := url.PathUnescape(val) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %v", errInvalidValue, err) + } + return Member{key: key, value: value, properties: props, hasData: true}, nil +} + +// validate ensures m conforms to the W3C Baggage specification. +// A key must be an ASCII string, returning an error otherwise. +func (m Member) validate() error { + if !m.hasData { + return fmt.Errorf("%w: %q", errInvalidMember, m) + } + + if !validateKey(m.key) { + return fmt.Errorf("%w: %q", errInvalidKey, m.key) + } + return m.properties.validate() +} + +// Key returns the Member key. +func (m Member) Key() string { return m.key } + +// Value returns the Member value. +func (m Member) Value() string { return m.value } + +// Properties returns a copy of the Member properties. +func (m Member) Properties() []Property { return m.properties.Copy() } + +// String encodes Member into a header string compliant with the W3C Baggage +// specification. +func (m Member) String() string { + // A key is just an ASCII string. A value is restricted to be + // US-ASCII characters excluding CTLs, whitespace, + // DQUOTE, comma, semicolon, and backslash. + s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, valueEscape(m.value)) + if len(m.properties) > 0 { + s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String()) + } + return s +} + +// Baggage is a list of baggage members representing the baggage-string as +// defined by the W3C Baggage specification. +type Baggage struct { //nolint:golint + list baggage.List +} + +// New returns a new valid Baggage. It returns an error if it results in a +// Baggage exceeding limits set in that specification. +// +// It expects all the provided members to have already been validated. +func New(members ...Member) (Baggage, error) { + if len(members) == 0 { + return Baggage{}, nil + } + + b := make(baggage.List) + for _, m := range members { + if !m.hasData { + return Baggage{}, errInvalidMember + } + + // OpenTelemetry resolves duplicates by last-one-wins. + b[m.key] = baggage.Item{ + Value: m.value, + Properties: m.properties.asInternal(), + } + } + + // Check member numbers after deduplication. + if len(b) > maxMembers { + return Baggage{}, errMemberNumber + } + + bag := Baggage{b} + if n := len(bag.String()); n > maxBytesPerBaggageString { + return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n) + } + + return bag, nil +} + +// Parse attempts to decode a baggage-string from the passed string. It +// returns an error if the input is invalid according to the W3C Baggage +// specification. +// +// If there are duplicate list-members contained in baggage, the last one +// defined (reading left-to-right) will be the only one kept. This diverges +// from the W3C Baggage specification which allows duplicate list-members, but +// conforms to the OpenTelemetry Baggage specification. +func Parse(bStr string) (Baggage, error) { + if bStr == "" { + return Baggage{}, nil + } + + if n := len(bStr); n > maxBytesPerBaggageString { + return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n) + } + + b := make(baggage.List) + for _, memberStr := range strings.Split(bStr, listDelimiter) { + m, err := parseMember(memberStr) + if err != nil { + return Baggage{}, err + } + // OpenTelemetry resolves duplicates by last-one-wins. + b[m.key] = baggage.Item{ + Value: m.value, + Properties: m.properties.asInternal(), + } + } + + // OpenTelemetry does not allow for duplicate list-members, but the W3C + // specification does. Now that we have deduplicated, ensure the baggage + // does not exceed list-member limits. + if len(b) > maxMembers { + return Baggage{}, errMemberNumber + } + + return Baggage{b}, nil +} + +// Member returns the baggage list-member identified by key. +// +// If there is no list-member matching the passed key the returned Member will +// be a zero-value Member. +// The returned member is not validated, as we assume the validation happened +// when it was added to the Baggage. +func (b Baggage) Member(key string) Member { + v, ok := b.list[key] + if !ok { + // We do not need to worry about distinguishing between the situation + // where a zero-valued Member is included in the Baggage because a + // zero-valued Member is invalid according to the W3C Baggage + // specification (it has an empty key). + return newInvalidMember() + } + + return Member{ + key: key, + value: v.Value, + properties: fromInternalProperties(v.Properties), + hasData: true, + } +} + +// Members returns all the baggage list-members. +// The order of the returned list-members does not have significance. +// +// The returned members are not validated, as we assume the validation happened +// when they were added to the Baggage. +func (b Baggage) Members() []Member { + if len(b.list) == 0 { + return nil + } + + members := make([]Member, 0, len(b.list)) + for k, v := range b.list { + members = append(members, Member{ + key: k, + value: v.Value, + properties: fromInternalProperties(v.Properties), + hasData: true, + }) + } + return members +} + +// SetMember returns a copy the Baggage with the member included. If the +// baggage contains a Member with the same key the existing Member is +// replaced. +// +// If member is invalid according to the W3C Baggage specification, an error +// is returned with the original Baggage. +func (b Baggage) SetMember(member Member) (Baggage, error) { + if !member.hasData { + return b, errInvalidMember + } + + n := len(b.list) + if _, ok := b.list[member.key]; !ok { + n++ + } + list := make(baggage.List, n) + + for k, v := range b.list { + // Do not copy if we are just going to overwrite. + if k == member.key { + continue + } + list[k] = v + } + + list[member.key] = baggage.Item{ + Value: member.value, + Properties: member.properties.asInternal(), + } + + return Baggage{list: list}, nil +} + +// DeleteMember returns a copy of the Baggage with the list-member identified +// by key removed. +func (b Baggage) DeleteMember(key string) Baggage { + n := len(b.list) + if _, ok := b.list[key]; ok { + n-- + } + list := make(baggage.List, n) + + for k, v := range b.list { + if k == key { + continue + } + list[k] = v + } + + return Baggage{list: list} +} + +// Len returns the number of list-members in the Baggage. +func (b Baggage) Len() int { + return len(b.list) +} + +// String encodes Baggage into a header string compliant with the W3C Baggage +// specification. +func (b Baggage) String() string { + members := make([]string, 0, len(b.list)) + for k, v := range b.list { + members = append(members, Member{ + key: k, + value: v.Value, + properties: fromInternalProperties(v.Properties), + }.String()) + } + return strings.Join(members, listDelimiter) +} + +// parsePropertyInternal attempts to decode a Property from the passed string. +// It follows the spec at https://www.w3.org/TR/baggage/#definition. +func parsePropertyInternal(s string) (p Property, ok bool) { + // For the entire function we will use " key = value " as an example. + // Attempting to parse the key. + // First skip spaces at the beginning "< >key = value " (they could be empty). + index := skipSpace(s, 0) + + // Parse the key: " = value ". + keyStart := index + keyEnd := index + for _, c := range s[keyStart:] { + if !validateKeyChar(c) { + break + } + keyEnd++ + } + + // If we couldn't find any valid key character, + // it means the key is either empty or invalid. + if keyStart == keyEnd { + return + } + + // Skip spaces after the key: " key< >= value ". + index = skipSpace(s, keyEnd) + + if index == len(s) { + // A key can have no value, like: " key ". + ok = true + p.key = s[keyStart:keyEnd] + return + } + + // If we have not reached the end and we can't find the '=' delimiter, + // it means the property is invalid. + if s[index] != keyValueDelimiter[0] { + return + } + + // Attempting to parse the value. + // Match: " key =< >value ". + index = skipSpace(s, index+1) + + // Match the value string: " key = ". + // A valid property can be: " key =". + // Therefore, we don't have to check if the value is empty. + valueStart := index + valueEnd := index + for _, c := range s[valueStart:] { + if !validateValueChar(c) { + break + } + valueEnd++ + } + + // Skip all trailing whitespaces: " key = value< >". + index = skipSpace(s, valueEnd) + + // If after looking for the value and skipping whitespaces + // we have not reached the end, it means the property is + // invalid, something like: " key = value value1". + if index != len(s) { + return + } + + // Decode a precent-encoded value. + value, err := url.PathUnescape(s[valueStart:valueEnd]) + if err != nil { + return + } + + ok = true + p.key = s[keyStart:keyEnd] + p.hasValue = true + + p.value = value + return +} + +func skipSpace(s string, offset int) int { + i := offset + for ; i < len(s); i++ { + c := s[i] + if c != ' ' && c != '\t' { + break + } + } + return i +} + +func validateKey(s string) bool { + if len(s) == 0 { + return false + } + + for _, c := range s { + if !validateKeyChar(c) { + return false + } + } + + return true +} + +func validateKeyChar(c int32) bool { + return (c >= 0x23 && c <= 0x27) || + (c >= 0x30 && c <= 0x39) || + (c >= 0x41 && c <= 0x5a) || + (c >= 0x5e && c <= 0x7a) || + c == 0x21 || + c == 0x2a || + c == 0x2b || + c == 0x2d || + c == 0x2e || + c == 0x7c || + c == 0x7e +} + +func validateValue(s string) bool { + for _, c := range s { + if !validateValueChar(c) { + return false + } + } + + return true +} + +func validateValueChar(c int32) bool { + return c == 0x21 || + (c >= 0x23 && c <= 0x2b) || + (c >= 0x2d && c <= 0x3a) || + (c >= 0x3c && c <= 0x5b) || + (c >= 0x5d && c <= 0x7e) +} + +// valueEscape escapes the string so it can be safely placed inside a baggage value, +// replacing special characters with %XX sequences as needed. +// +// The implementation is based on: +// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285. +func valueEscape(s string) string { + hexCount := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(c) { + hexCount++ + } + } + + if hexCount == 0 { + return s + } + + var buf [64]byte + var t []byte + + required := len(s) + 2*hexCount + if required <= len(buf) { + t = buf[:required] + } else { + t = make([]byte, required) + } + + j := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(s[i]) { + const upperhex = "0123456789ABCDEF" + t[j] = '%' + t[j+1] = upperhex[c>>4] + t[j+2] = upperhex[c&15] + j += 3 + } else { + t[j] = c + j++ + } + } + + return string(t) +} + +// shouldEscape returns true if the specified byte should be escaped when +// appearing in a baggage value string. +func shouldEscape(c byte) bool { + if c == '%' { + // The percent character must be encoded so that percent-encoding can work. + return true + } + return !validateValueChar(int32(c)) +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go new file mode 100644 index 00000000..24b34b75 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/context.go @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package baggage // import "go.opentelemetry.io/otel/baggage" + +import ( + "context" + + "go.opentelemetry.io/otel/internal/baggage" +) + +// ContextWithBaggage returns a copy of parent with baggage. +func ContextWithBaggage(parent context.Context, b Baggage) context.Context { + // Delegate so any hooks for the OpenTracing bridge are handled. + return baggage.ContextWithList(parent, b.list) +} + +// ContextWithoutBaggage returns a copy of parent with no baggage. +func ContextWithoutBaggage(parent context.Context) context.Context { + // Delegate so any hooks for the OpenTracing bridge are handled. + return baggage.ContextWithList(parent, nil) +} + +// FromContext returns the baggage contained in ctx. +func FromContext(ctx context.Context) Baggage { + // Delegate so any hooks for the OpenTracing bridge are handled. + return Baggage{list: baggage.ListFromContext(ctx)} +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go new file mode 100644 index 00000000..4545100d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package baggage provides functionality for storing and retrieving +baggage items in Go context. For propagating the baggage, see the +go.opentelemetry.io/otel/propagation package. +*/ +package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go new file mode 100644 index 00000000..587ebae4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -0,0 +1,116 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package codes // import "go.opentelemetry.io/otel/codes" + +import ( + "encoding/json" + "fmt" + "strconv" +) + +const ( + // Unset is the default status code. + Unset Code = 0 + + // Error indicates the operation contains an error. + // + // NOTE: The error code in OTLP is 2. + // The value of this enum is only relevant to the internals + // of the Go SDK. + Error Code = 1 + + // Ok indicates operation has been validated by an Application developers + // or Operator to have completed successfully, or contain no error. + // + // NOTE: The Ok code in OTLP is 1. + // The value of this enum is only relevant to the internals + // of the Go SDK. + Ok Code = 2 + + maxCode = 3 +) + +// Code is an 32-bit representation of a status state. +type Code uint32 + +var codeToStr = map[Code]string{ + Unset: "Unset", + Error: "Error", + Ok: "Ok", +} + +var strToCode = map[string]Code{ + `"Unset"`: Unset, + `"Error"`: Error, + `"Ok"`: Ok, +} + +// String returns the Code as a string. +func (c Code) String() string { + return codeToStr[c] +} + +// UnmarshalJSON unmarshals b into the Code. +// +// This is based on the functionality in the gRPC codes package: +// https://github.com/grpc/grpc-go/blob/bb64fee312b46ebee26be43364a7a966033521b1/codes/codes.go#L218-L244 +func (c *Code) UnmarshalJSON(b []byte) error { + // From json.Unmarshaler: By convention, to approximate the behavior of + // Unmarshal itself, Unmarshalers implement UnmarshalJSON([]byte("null")) as + // a no-op. + if string(b) == "null" { + return nil + } + if c == nil { + return fmt.Errorf("nil receiver passed to UnmarshalJSON") + } + + var x interface{} + if err := json.Unmarshal(b, &x); err != nil { + return err + } + switch x.(type) { + case string: + if jc, ok := strToCode[string(b)]; ok { + *c = jc + return nil + } + return fmt.Errorf("invalid code: %q", string(b)) + case float64: + if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { + if ci >= maxCode { + return fmt.Errorf("invalid code: %q", ci) + } + + *c = Code(ci) + return nil + } + return fmt.Errorf("invalid code: %q", string(b)) + default: + return fmt.Errorf("invalid code: %q", string(b)) + } +} + +// MarshalJSON returns c as the JSON encoding of c. +func (c *Code) MarshalJSON() ([]byte, error) { + if c == nil { + return []byte("null"), nil + } + str, ok := codeToStr[*c] + if !ok { + return nil, fmt.Errorf("invalid code: %d", *c) + } + return []byte(fmt.Sprintf("%q", str)), nil +} diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go new file mode 100644 index 00000000..4e328fbb --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package codes defines the canonical error codes used by OpenTelemetry. + +It conforms to [the OpenTelemetry +specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). +*/ +package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go new file mode 100644 index 00000000..36d7c24e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otel provides global access to the OpenTelemetry API. The subpackages of +the otel package provide an implementation of the OpenTelemetry API. + +The provided API is used to instrument code and measure data about that code's +performance and operation. The measured data, by default, is not processed or +transmitted anywhere. An implementation of the OpenTelemetry SDK, like the +default SDK implementation (go.opentelemetry.io/otel/sdk), and associated +exporters are used to process and transport this data. + +To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/. + +To read more about tracing, see go.opentelemetry.io/otel/trace. + +To read more about metrics, see go.opentelemetry.io/otel/metric. + +To read more about propagation, see go.opentelemetry.io/otel/propagation and +go.opentelemetry.io/otel/baggage. +*/ +package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go new file mode 100644 index 00000000..72fad854 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -0,0 +1,38 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +// ErrorHandlerFunc is a convenience adapter to allow the use of a function +// as an ErrorHandler. +type ErrorHandlerFunc func(error) + +var _ ErrorHandler = ErrorHandlerFunc(nil) + +// Handle handles the irremediable error by calling the ErrorHandlerFunc itself. +func (f ErrorHandlerFunc) Handle(err error) { + f(err) +} diff --git a/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh b/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh new file mode 100644 index 00000000..9a58fb1d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +top_dir='.' +if [[ $# -gt 0 ]]; then + top_dir="${1}" +fi + +p=$(pwd) +mod_dirs=() + +# Note `mapfile` does not exist in older bash versions: +# https://stackoverflow.com/questions/41475261/need-alternative-to-readarray-mapfile-for-script-on-older-version-of-bash + +while IFS= read -r line; do + mod_dirs+=("$line") +done < <(find "${top_dir}" -type f -name 'go.mod' -exec dirname {} \; | sort) + +for mod_dir in "${mod_dirs[@]}"; do + cd "${mod_dir}" + + while IFS= read -r line; do + echo ".${line#${p}}" + done < <(go list --find -f '{{.Name}}|{{.Dir}}' ./... | grep '^main|' | cut -f 2- -d '|') + cd "${p}" +done diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go new file mode 100644 index 00000000..4115fe3b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" +) + +var ( + // Compile-time check global.ErrDelegator implements ErrorHandler. + _ ErrorHandler = (*global.ErrDelegator)(nil) + // Compile-time check global.ErrLogger implements ErrorHandler. + _ ErrorHandler = (*global.ErrLogger)(nil) +) + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } + +// Handle is a convenience function for ErrorHandler().Handle(err). +func Handle(err error) { global.Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go new file mode 100644 index 00000000..622c3ee3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go @@ -0,0 +1,111 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package attribute provide several helper functions for some commonly used +logic of processing attributes. +*/ +package attribute // import "go.opentelemetry.io/otel/internal/attribute" + +import ( + "reflect" +) + +// BoolSliceValue converts a bool slice into an array with same elements as slice. +func BoolSliceValue(v []bool) interface{} { + var zero bool + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) + return cp.Elem().Interface() +} + +// Int64SliceValue converts an int64 slice into an array with same elements as slice. +func Int64SliceValue(v []int64) interface{} { + var zero int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) + return cp.Elem().Interface() +} + +// Float64SliceValue converts a float64 slice into an array with same elements as slice. +func Float64SliceValue(v []float64) interface{} { + var zero float64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) + return cp.Elem().Interface() +} + +// StringSliceValue converts a string slice into an array with same elements as slice. +func StringSliceValue(v []string) interface{} { + var zero string + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) + return cp.Elem().Interface() +} + +// AsBoolSlice converts a bool array into a slice into with same elements as array. +func AsBoolSlice(v interface{}) []bool { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero bool + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]bool) +} + +// AsInt64Slice converts an int64 array into a slice into with same elements as array. +func AsInt64Slice(v interface{}) []int64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero int64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]int64) +} + +// AsFloat64Slice converts a float64 array into a slice into with same elements as array. +func AsFloat64Slice(v interface{}) []float64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero float64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]float64) +} + +// AsStringSlice converts a string array into a slice into with same elements as array. +func AsStringSlice(v interface{}) []string { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero string + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]string) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go new file mode 100644 index 00000000..b96e5408 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package baggage provides base types and functionality to store and retrieve +baggage in Go context. This package exists because the OpenTracing bridge to +OpenTelemetry needs to synchronize state whenever baggage for a context is +modified and that context contains an OpenTracing span. If it were not for +this need this package would not need to exist and the +`go.opentelemetry.io/otel/baggage` package would be the singular place where +W3C baggage is handled. +*/ +package baggage // import "go.opentelemetry.io/otel/internal/baggage" + +// List is the collection of baggage members. The W3C allows for duplicates, +// but OpenTelemetry does not, therefore, this is represented as a map. +type List map[string]Item + +// Item is the value and metadata properties part of a list-member. +type Item struct { + Value string + Properties []Property +} + +// Property is a metadata entry for a list-member. +type Property struct { + Key, Value string + + // HasValue indicates if a zero-value value means the property does not + // have a value or if it was the zero-value. + HasValue bool +} diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go new file mode 100644 index 00000000..4469700d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go @@ -0,0 +1,92 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package baggage // import "go.opentelemetry.io/otel/internal/baggage" + +import "context" + +type baggageContextKeyType int + +const baggageKey baggageContextKeyType = iota + +// SetHookFunc is a callback called when storing baggage in the context. +type SetHookFunc func(context.Context, List) context.Context + +// GetHookFunc is a callback called when getting baggage from the context. +type GetHookFunc func(context.Context, List) List + +type baggageState struct { + list List + + setHook SetHookFunc + getHook GetHookFunc +} + +// ContextWithSetHook returns a copy of parent with hook configured to be +// invoked every time ContextWithBaggage is called. +// +// Passing nil SetHookFunc creates a context with no set hook to call. +func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.setHook = hook + return context.WithValue(parent, baggageKey, s) +} + +// ContextWithGetHook returns a copy of parent with hook configured to be +// invoked every time FromContext is called. +// +// Passing nil GetHookFunc creates a context with no get hook to call. +func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.getHook = hook + return context.WithValue(parent, baggageKey, s) +} + +// ContextWithList returns a copy of parent with baggage. Passing nil list +// returns a context without any baggage. +func ContextWithList(parent context.Context, list List) context.Context { + var s baggageState + if v, ok := parent.Value(baggageKey).(baggageState); ok { + s = v + } + + s.list = list + ctx := context.WithValue(parent, baggageKey, s) + if s.setHook != nil { + ctx = s.setHook(ctx, list) + } + + return ctx +} + +// ListFromContext returns the baggage contained in ctx. +func ListFromContext(ctx context.Context) List { + switch v := ctx.Value(baggageKey).(type) { + case baggageState: + if v.getHook != nil { + return v.getHook(ctx, v.list) + } + return v.list + default: + return nil + } +} diff --git a/vendor/go.opentelemetry.io/otel/internal/gen.go b/vendor/go.opentelemetry.io/otel/internal/gen.go new file mode 100644 index 00000000..f532f07e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/internal" + +//go:generate gotmpl --body=./shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=./shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=./shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=./shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=./shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=./shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=./shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=./shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go new file mode 100644 index 00000000..5e9b8304 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -0,0 +1,102 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "log" + "os" + "sync/atomic" +) + +var ( + // GlobalErrorHandler provides an ErrorHandler that can be used + // throughout an OpenTelemetry instrumented project. When a user + // specified ErrorHandler is registered (`SetErrorHandler`) all calls to + // `Handle` and will be delegated to the registered ErrorHandler. + GlobalErrorHandler = defaultErrorHandler() + + // Compile-time check that delegator implements ErrorHandler. + _ ErrorHandler = (*ErrDelegator)(nil) + // Compile-time check that errLogger implements ErrorHandler. + _ ErrorHandler = (*ErrLogger)(nil) +) + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) +} + +type ErrDelegator struct { + delegate atomic.Pointer[ErrorHandler] +} + +func (d *ErrDelegator) Handle(err error) { + d.getDelegate().Handle(err) +} + +func (d *ErrDelegator) getDelegate() ErrorHandler { + return *d.delegate.Load() +} + +// setDelegate sets the ErrorHandler delegate. +func (d *ErrDelegator) setDelegate(eh ErrorHandler) { + d.delegate.Store(&eh) +} + +func defaultErrorHandler() *ErrDelegator { + d := &ErrDelegator{} + d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) + return d +} + +// ErrLogger logs errors if no delegate is set, otherwise they are delegated. +type ErrLogger struct { + l *log.Logger +} + +// Handle logs err if no delegate is set, otherwise it is delegated. +func (h *ErrLogger) Handle(err error) { + h.l.Print(err) +} + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return GlobalErrorHandler +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + GlobalErrorHandler.setDelegate(h) +} + +// Handle is a convenience function for ErrorHandler().Handle(err). +func Handle(err error) { + GetErrorHandler().Handle(err) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go new file mode 100644 index 00000000..ebb13c20 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -0,0 +1,371 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "context" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// unwrapper unwraps to return the underlying instrument implementation. +type unwrapper interface { + Unwrap() metric.Observable +} + +type afCounter struct { + embedded.Float64ObservableCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableCounterOption + + delegate atomic.Value // metric.Float64ObservableCounter +} + +var ( + _ unwrapper = (*afCounter)(nil) + _ metric.Float64ObservableCounter = (*afCounter)(nil) +) + +func (i *afCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableCounter) + } + return nil +} + +type afUpDownCounter struct { + embedded.Float64ObservableUpDownCounter + metric.Float64Observable + + name string + opts []metric.Float64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Float64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*afUpDownCounter)(nil) + _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +) + +func (i *afUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afUpDownCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableUpDownCounter) + } + return nil +} + +type afGauge struct { + embedded.Float64ObservableGauge + metric.Float64Observable + + name string + opts []metric.Float64ObservableGaugeOption + + delegate atomic.Value // metric.Float64ObservableGauge +} + +var ( + _ unwrapper = (*afGauge)(nil) + _ metric.Float64ObservableGauge = (*afGauge)(nil) +) + +func (i *afGauge) setDelegate(m metric.Meter) { + ctr, err := m.Float64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *afGauge) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Float64ObservableGauge) + } + return nil +} + +type aiCounter struct { + embedded.Int64ObservableCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableCounterOption + + delegate atomic.Value // metric.Int64ObservableCounter +} + +var ( + _ unwrapper = (*aiCounter)(nil) + _ metric.Int64ObservableCounter = (*aiCounter)(nil) +) + +func (i *aiCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableCounter) + } + return nil +} + +type aiUpDownCounter struct { + embedded.Int64ObservableUpDownCounter + metric.Int64Observable + + name string + opts []metric.Int64ObservableUpDownCounterOption + + delegate atomic.Value // metric.Int64ObservableUpDownCounter +} + +var ( + _ unwrapper = (*aiUpDownCounter)(nil) + _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +) + +func (i *aiUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiUpDownCounter) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableUpDownCounter) + } + return nil +} + +type aiGauge struct { + embedded.Int64ObservableGauge + metric.Int64Observable + + name string + opts []metric.Int64ObservableGaugeOption + + delegate atomic.Value // metric.Int64ObservableGauge +} + +var ( + _ unwrapper = (*aiGauge)(nil) + _ metric.Int64ObservableGauge = (*aiGauge)(nil) +) + +func (i *aiGauge) setDelegate(m metric.Meter) { + ctr, err := m.Int64ObservableGauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *aiGauge) Unwrap() metric.Observable { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(metric.Int64ObservableGauge) + } + return nil +} + +// Sync Instruments. +type sfCounter struct { + embedded.Float64Counter + + name string + opts []metric.Float64CounterOption + + delegate atomic.Value // metric.Float64Counter +} + +var _ metric.Float64Counter = (*sfCounter)(nil) + +func (i *sfCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Counter).Add(ctx, incr, opts...) + } +} + +type sfUpDownCounter struct { + embedded.Float64UpDownCounter + + name string + opts []metric.Float64UpDownCounterOption + + delegate atomic.Value // metric.Float64UpDownCounter +} + +var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) + +func (i *sfUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Float64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) + } +} + +type sfHistogram struct { + embedded.Float64Histogram + + name string + opts []metric.Float64HistogramOption + + delegate atomic.Value // metric.Float64Histogram +} + +var _ metric.Float64Histogram = (*sfHistogram)(nil) + +func (i *sfHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Float64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Histogram).Record(ctx, x, opts...) + } +} + +type siCounter struct { + embedded.Int64Counter + + name string + opts []metric.Int64CounterOption + + delegate atomic.Value // metric.Int64Counter +} + +var _ metric.Int64Counter = (*siCounter)(nil) + +func (i *siCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64Counter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Counter).Add(ctx, x, opts...) + } +} + +type siUpDownCounter struct { + embedded.Int64UpDownCounter + + name string + opts []metric.Int64UpDownCounterOption + + delegate atomic.Value // metric.Int64UpDownCounter +} + +var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) + +func (i *siUpDownCounter) setDelegate(m metric.Meter) { + ctr, err := m.Int64UpDownCounter(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) + } +} + +type siHistogram struct { + embedded.Int64Histogram + + name string + opts []metric.Int64HistogramOption + + delegate atomic.Value // metric.Int64Histogram +} + +var _ metric.Int64Histogram = (*siHistogram)(nil) + +func (i *siHistogram) setDelegate(m metric.Meter) { + ctr, err := m.Int64Histogram(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Histogram).Record(ctx, x, opts...) + } +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go new file mode 100644 index 00000000..c6f305a2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "log" + "os" + "sync/atomic" + + "github.com/go-logr/logr" + "github.com/go-logr/stdr" +) + +// globalLogger is the logging interface used within the otel api and sdk provide details of the internals. +// +// The default logger uses stdr which is backed by the standard `log.Logger` +// interface. This logger will only show messages at the Error Level. +var globalLogger atomic.Pointer[logr.Logger] + +func init() { + SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +} + +// SetLogger overrides the globalLogger with l. +// +// To see Warn messages use a logger with `l.V(1).Enabled() == true` +// To see Info messages use a logger with `l.V(4).Enabled() == true` +// To see Debug messages use a logger with `l.V(8).Enabled() == true`. +func SetLogger(l logr.Logger) { + globalLogger.Store(&l) +} + +func getLogger() logr.Logger { + return *globalLogger.Load() +} + +// Info prints messages about the general state of the API or SDK. +// This should usually be less than 5 messages a minute. +func Info(msg string, keysAndValues ...interface{}) { + getLogger().V(4).Info(msg, keysAndValues...) +} + +// Error prints messages about exceptional states of the API or SDK. +func Error(err error, msg string, keysAndValues ...interface{}) { + getLogger().Error(err, msg, keysAndValues...) +} + +// Debug prints messages about all internal changes in the API or SDK. +func Debug(msg string, keysAndValues ...interface{}) { + getLogger().V(8).Info(msg, keysAndValues...) +} + +// Warn prints messages about warnings in the API or SDK. +// Not an error but is likely more important than an informational event. +func Warn(msg string, keysAndValues ...interface{}) { + getLogger().V(1).Info(msg, keysAndValues...) +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go new file mode 100644 index 00000000..7ed61c0e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -0,0 +1,356 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "container/list" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" +) + +// meterProvider is a placeholder for a configured SDK MeterProvider. +// +// All MeterProvider functionality is forwarded to a delegate once +// configured. +type meterProvider struct { + embedded.MeterProvider + + mtx sync.Mutex + meters map[il]*meter + + delegate metric.MeterProvider +} + +// setDelegate configures p to delegate all MeterProvider functionality to +// provider. +// +// All Meters provided prior to this function call are switched out to be +// Meters provided by provider. All instruments and callbacks are recreated and +// delegated. +// +// It is guaranteed by the caller that this happens only once. +func (p *meterProvider) setDelegate(provider metric.MeterProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.meters) == 0 { + return + } + + for _, meter := range p.meters { + meter.setDelegate(provider) + } + + p.meters = nil +} + +// Meter implements MeterProvider. +func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Meter(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. + + c := metric.NewMeterConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + } + + if p.meters == nil { + p.meters = make(map[il]*meter) + } + + if val, ok := p.meters[key]; ok { + return val + } + + t := &meter{name: name, opts: opts} + p.meters[key] = t + return t +} + +// meter is a placeholder for a metric.Meter. +// +// All Meter functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopMeter. +type meter struct { + embedded.Meter + + name string + opts []metric.MeterOption + + mtx sync.Mutex + instruments []delegatedInstrument + + registry list.List + + delegate atomic.Value // metric.Meter +} + +type delegatedInstrument interface { + setDelegate(metric.Meter) +} + +// setDelegate configures m to delegate all Meter functionality to Meters +// created by provider. +// +// All subsequent calls to the Meter methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (m *meter) setDelegate(provider metric.MeterProvider) { + meter := provider.Meter(m.name, m.opts...) + m.delegate.Store(meter) + + m.mtx.Lock() + defer m.mtx.Unlock() + + for _, inst := range m.instruments { + inst.setDelegate(meter) + } + + var n *list.Element + for e := m.registry.Front(); e != nil; e = n { + r := e.Value.(*registration) + r.setDelegate(meter) + n = e.Next() + m.registry.Remove(e) + } + + m.instruments = nil + m.registry.Init() +} + +func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Counter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableGauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Counter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableGauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +// RegisterCallback captures the function that will be called during Collect. +func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + insts = unwrapInstruments(insts) + return del.RegisterCallback(f, insts...) + } + + m.mtx.Lock() + defer m.mtx.Unlock() + + reg := ®istration{instruments: insts, function: f} + e := m.registry.PushBack(reg) + reg.unreg = func() error { + m.mtx.Lock() + _ = m.registry.Remove(e) + m.mtx.Unlock() + return nil + } + return reg, nil +} + +type wrapped interface { + unwrap() metric.Observable +} + +func unwrapInstruments(instruments []metric.Observable) []metric.Observable { + out := make([]metric.Observable, 0, len(instruments)) + + for _, inst := range instruments { + if in, ok := inst.(wrapped); ok { + out = append(out, in.unwrap()) + } else { + out = append(out, inst) + } + } + + return out +} + +type registration struct { + embedded.Registration + + instruments []metric.Observable + function metric.Callback + + unreg func() error + unregMu sync.Mutex +} + +func (c *registration) setDelegate(m metric.Meter) { + insts := unwrapInstruments(c.instruments) + + c.unregMu.Lock() + defer c.unregMu.Unlock() + + if c.unreg == nil { + // Unregister already called. + return + } + + reg, err := m.RegisterCallback(c.function, insts...) + if err != nil { + GetErrorHandler().Handle(err) + } + + c.unreg = reg.Unregister +} + +func (c *registration) Unregister() error { + c.unregMu.Lock() + defer c.unregMu.Unlock() + if c.unreg == nil { + // Unregister already called. + return nil + } + + var err error + err, c.unreg = c.unreg(), nil + return err +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go new file mode 100644 index 00000000..06bac35c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go @@ -0,0 +1,82 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/propagation" +) + +// textMapPropagator is a default TextMapPropagator that delegates calls to a +// registered delegate if one is set, otherwise it defaults to delegating the +// calls to a the default no-op propagation.TextMapPropagator. +type textMapPropagator struct { + mtx sync.Mutex + once sync.Once + delegate propagation.TextMapPropagator + noop propagation.TextMapPropagator +} + +// Compile-time guarantee that textMapPropagator implements the +// propagation.TextMapPropagator interface. +var _ propagation.TextMapPropagator = (*textMapPropagator)(nil) + +func newTextMapPropagator() *textMapPropagator { + return &textMapPropagator{ + noop: propagation.NewCompositeTextMapPropagator(), + } +} + +// SetDelegate sets a delegate propagation.TextMapPropagator that all calls are +// forwarded to. Delegation can only be performed once, all subsequent calls +// perform no delegation. +func (p *textMapPropagator) SetDelegate(delegate propagation.TextMapPropagator) { + if delegate == nil { + return + } + + p.mtx.Lock() + p.once.Do(func() { p.delegate = delegate }) + p.mtx.Unlock() +} + +// effectiveDelegate returns the current delegate of p if one is set, +// otherwise the default noop TextMapPropagator is returned. This method +// can be called concurrently. +func (p *textMapPropagator) effectiveDelegate() propagation.TextMapPropagator { + p.mtx.Lock() + defer p.mtx.Unlock() + if p.delegate != nil { + return p.delegate + } + return p.noop +} + +// Inject set cross-cutting concerns from the Context into the carrier. +func (p *textMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + p.effectiveDelegate().Inject(ctx, carrier) +} + +// Extract reads cross-cutting concerns from the carrier into a Context. +func (p *textMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + return p.effectiveDelegate().Extract(ctx, carrier) +} + +// Fields returns the keys whose values are set with Inject. +func (p *textMapPropagator) Fields() []string { + return p.effectiveDelegate().Fields() +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go new file mode 100644 index 00000000..386c8bfd --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -0,0 +1,156 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "errors" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +type ( + tracerProviderHolder struct { + tp trace.TracerProvider + } + + propagatorsHolder struct { + tm propagation.TextMapPropagator + } + + meterProviderHolder struct { + mp metric.MeterProvider + } +) + +var ( + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() + + delegateTraceOnce sync.Once + delegateTextMapPropagatorOnce sync.Once + delegateMeterOnce sync.Once +) + +// TracerProvider is the internal implementation for global.TracerProvider. +func TracerProvider() trace.TracerProvider { + return globalTracer.Load().(tracerProviderHolder).tp +} + +// SetTracerProvider is the internal implementation for global.SetTracerProvider. +func SetTracerProvider(tp trace.TracerProvider) { + current := TracerProvider() + + if _, cOk := current.(*tracerProvider); cOk { + if _, tpOk := tp.(*tracerProvider); tpOk && current == tp { + // Do not assign the default delegating TracerProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in tracer provider"), + "Setting tracer provider to its current value. No delegate will be configured", + ) + return + } + } + + delegateTraceOnce.Do(func() { + if def, ok := current.(*tracerProvider); ok { + def.setDelegate(tp) + } + }) + globalTracer.Store(tracerProviderHolder{tp: tp}) +} + +// TextMapPropagator is the internal implementation for global.TextMapPropagator. +func TextMapPropagator() propagation.TextMapPropagator { + return globalPropagators.Load().(propagatorsHolder).tm +} + +// SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator. +func SetTextMapPropagator(p propagation.TextMapPropagator) { + current := TextMapPropagator() + + if _, cOk := current.(*textMapPropagator); cOk { + if _, pOk := p.(*textMapPropagator); pOk && current == p { + // Do not assign the default delegating TextMapPropagator to + // delegate to itself. + Error( + errors.New("no delegate configured in text map propagator"), + "Setting text map propagator to its current value. No delegate will be configured", + ) + return + } + } + + // For the textMapPropagator already returned by TextMapPropagator + // delegate to p. + delegateTextMapPropagatorOnce.Do(func() { + if def, ok := current.(*textMapPropagator); ok { + def.SetDelegate(p) + } + }) + // Return p when subsequent calls to TextMapPropagator are made. + globalPropagators.Store(propagatorsHolder{tm: p}) +} + +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to its current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + +func defaultTracerValue() *atomic.Value { + v := &atomic.Value{} + v.Store(tracerProviderHolder{tp: &tracerProvider{}}) + return v +} + +func defaultPropagatorsValue() *atomic.Value { + v := &atomic.Value{} + v.Store(propagatorsHolder{tm: newTextMapPropagator()}) + return v +} + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go new file mode 100644 index 00000000..3f61ec12 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +/* +This file contains the forwarding implementation of the TracerProvider used as +the default global instance. Prior to initialization of an SDK, Tracers +returned by the global TracerProvider will provide no-op functionality. This +means that all Span created prior to initialization are no-op Spans. + +Once an SDK has been initialized, all provided no-op Tracers are swapped for +Tracers provided by the SDK defined TracerProvider. However, any Span started +prior to this initialization does not change its behavior. Meaning, the Span +remains a no-op Span. + +The implementation to track and swap Tracers locks all new Tracer creation +until the swap is complete. This assumes that this operation is not +performance-critical. If that assumption is incorrect, be sure to configure an +SDK prior to any Tracer creation. +*/ + +import ( + "context" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" +) + +// tracerProvider is a placeholder for a configured SDK TracerProvider. +// +// All TracerProvider functionality is forwarded to a delegate once +// configured. +type tracerProvider struct { + embedded.TracerProvider + + mtx sync.Mutex + tracers map[il]*tracer + delegate trace.TracerProvider +} + +// Compile-time guarantee that tracerProvider implements the TracerProvider +// interface. +var _ trace.TracerProvider = &tracerProvider{} + +// setDelegate configures p to delegate all TracerProvider functionality to +// provider. +// +// All Tracers provided prior to this function call are switched out to be +// Tracers provided by provider. +// +// It is guaranteed by the caller that this happens only once. +func (p *tracerProvider) setDelegate(provider trace.TracerProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.tracers) == 0 { + return + } + + for _, t := range p.tracers { + t.setDelegate(provider) + } + + p.tracers = nil +} + +// Tracer implements TracerProvider. +func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Tracer(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the tracer in the tracers map. + + c := trace.NewTracerConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + } + + if p.tracers == nil { + p.tracers = make(map[il]*tracer) + } + + if val, ok := p.tracers[key]; ok { + return val + } + + t := &tracer{name: name, opts: opts, provider: p} + p.tracers[key] = t + return t +} + +type il struct { + name string + version string +} + +// tracer is a placeholder for a trace.Tracer. +// +// All Tracer functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopTracer. +type tracer struct { + embedded.Tracer + + name string + opts []trace.TracerOption + provider *tracerProvider + + delegate atomic.Value +} + +// Compile-time guarantee that tracer implements the trace.Tracer interface. +var _ trace.Tracer = &tracer{} + +// setDelegate configures t to delegate all Tracer functionality to Tracers +// created by provider. +// +// All subsequent calls to the Tracer methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (t *tracer) setDelegate(provider trace.TracerProvider) { + t.delegate.Store(provider.Tracer(t.name, t.opts...)) +} + +// Start implements trace.Tracer by forwarding the call to t.delegate if +// set, otherwise it forwards the call to a NoopTracer. +func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { + delegate := t.delegate.Load() + if delegate != nil { + return delegate.(trace.Tracer).Start(ctx, name, opts...) + } + + s := nonRecordingSpan{sc: trace.SpanContextFromContext(ctx), tracer: t} + ctx = trace.ContextWithSpan(ctx, s) + return ctx, s +} + +// nonRecordingSpan is a minimal implementation of a Span that wraps a +// SpanContext. It performs no operations other than to return the wrapped +// SpanContext. +type nonRecordingSpan struct { + embedded.Span + + sc trace.SpanContext + tracer *tracer +} + +var _ trace.Span = nonRecordingSpan{} + +// SpanContext returns the wrapped SpanContext. +func (s nonRecordingSpan) SpanContext() trace.SpanContext { return s.sc } + +// IsRecording always returns false. +func (nonRecordingSpan) IsRecording() bool { return false } + +// SetStatus does nothing. +func (nonRecordingSpan) SetStatus(codes.Code, string) {} + +// SetError does nothing. +func (nonRecordingSpan) SetError(bool) {} + +// SetAttributes does nothing. +func (nonRecordingSpan) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (nonRecordingSpan) End(...trace.SpanEndOption) {} + +// RecordError does nothing. +func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} + +// AddEvent does nothing. +func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} + +// SetName does nothing. +func (nonRecordingSpan) SetName(string) {} + +func (s nonRecordingSpan) TracerProvider() trace.TracerProvider { return s.tracer.provider } diff --git a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go new file mode 100644 index 00000000..e07e7940 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go @@ -0,0 +1,55 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/internal" + +import ( + "math" + "unsafe" +) + +func BoolToRaw(b bool) uint64 { // nolint:revive // b is not a control flag. + if b { + return 1 + } + return 0 +} + +func RawToBool(r uint64) bool { + return r != 0 +} + +func Int64ToRaw(i int64) uint64 { + return uint64(i) +} + +func RawToInt64(r uint64) int64 { + return int64(r) +} + +func Float64ToRaw(f float64) uint64 { + return math.Float64bits(f) +} + +func RawToFloat64(r uint64) float64 { + return math.Float64frombits(r) +} + +func RawPtrToFloat64Ptr(r *uint64) *float64 { + return (*float64)(unsafe.Pointer(r)) +} + +func RawPtrToInt64Ptr(r *uint64) *int64 { + return (*int64)(unsafe.Pointer(r)) +} diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go new file mode 100644 index 00000000..c4f8acd5 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/internal_logging.go @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "github.com/go-logr/logr" + + "go.opentelemetry.io/otel/internal/global" +) + +// SetLogger configures the logger used internally to opentelemetry. +func SetLogger(logger logr.Logger) { + global.SetLogger(logger) +} diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go new file mode 100644 index 00000000..f9551719 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -0,0 +1,53 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" +) + +// Meter returns a Meter from the global MeterProvider. The name must be the +// name of the library providing instrumentation. This name may be the same as +// the instrumented code only if that code provides built-in instrumentation. +// If the name is empty, then a implementation defined default name will be +// used instead. +// +// If this is called before a global MeterProvider is registered the returned +// Meter will be a No-op implementation of a Meter. When a global MeterProvider +// is registered for the first time, the returned Meter, and all the +// instruments it has created or will create, are recreated automatically from +// the new MeterProvider. +// +// This is short for GetMeterProvider().Meter(name). +func Meter(name string, opts ...metric.MeterOption) metric.Meter { + return GetMeterProvider().Meter(name, opts...) +} + +// GetMeterProvider returns the registered global meter provider. +// +// If no global GetMeterProvider has been registered, a No-op GetMeterProvider +// implementation is returned. When a global GetMeterProvider is registered for +// the first time, the returned GetMeterProvider, and all the Meters it has +// created or will create, are recreated automatically from the new +// GetMeterProvider. +func GetMeterProvider() metric.MeterProvider { + return global.MeterProvider() +} + +// SetMeterProvider registers mp as the global MeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + global.SetMeterProvider(mp) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/LICENSE b/vendor/go.opentelemetry.io/otel/metric/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go new file mode 100644 index 00000000..072baa8e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -0,0 +1,271 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Observable describes a set of instruments used asynchronously to +// record float64 measurements once per collection cycle. Observations of +// these instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Float64Observable interface { + Observable + + float64Observable() +} + +// Float64ObservableCounter is an instrument used to asynchronously record +// increasing float64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for +// unimplemented methods. +type Float64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableCounter + + Float64Observable +} + +// Float64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableCounterConfig returns a new +// [Float64ObservableCounterConfig] with all opts applied. +func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { + var config Float64ObservableCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableCounterOption applies options to a +// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableCounterOption. +type Float64ObservableCounterOption interface { + applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig +} + +// Float64ObservableUpDownCounter is an instrument used to asynchronously +// record float64 measurements once per collection cycle. Observations are only +// made within a callback for this instrument. The value observed is assumed +// the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableUpDownCounter + + Float64Observable +} + +// Float64ObservableUpDownCounterConfig contains options for asynchronous +// counter instruments that record int64 values. +type Float64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableUpDownCounterConfig returns a new +// [Float64ObservableUpDownCounterConfig] with all opts applied. +func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { + var config Float64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableUpDownCounterOption applies options to a +// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableUpDownCounterOption. +type Float64ObservableUpDownCounterOption interface { + applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig +} + +// Float64ObservableGauge is an instrument used to asynchronously record +// instantaneous float64 measurements once per collection cycle. Observations +// are only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64ObservableGauge + + Float64Observable +} + +// Float64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableGaugeConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig] +// with all opts applied. +func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { + var config Float64ObservableGaugeConfig + for _, o := range opts { + config = o.applyFloat64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableGaugeOption applies options to a +// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableGaugeOption. +type Float64ObservableGaugeOption interface { + applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig +} + +// Float64Observer is a recorder of float64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Observer + + // Observe records the float64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value float64, options ...ObserveOption) +} + +// Float64Callback is a function registered with a Meter that makes +// observations for a Float64Observerable instrument it is registered with. +// Calls to the Float64Observer record measurement values for the +// Float64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Float64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Float64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Float64Callback func(context.Context, Float64Observer) error + +// Float64ObservableOption applies options to float64 Observer instruments. +type Float64ObservableOption interface { + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +type float64CallbackOpt struct { + cback Float64Callback +} + +func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithFloat64Callback adds callback to be called for an instrument. +func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { + return float64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go new file mode 100644 index 00000000..9bd6ebf0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -0,0 +1,269 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Observable describes a set of instruments used asynchronously to record +// int64 measurements once per collection cycle. Observations of these +// instruments are only made within a callback. +// +// Warning: Methods may be added to this interface in minor releases. +type Int64Observable interface { + Observable + + int64Observable() +} + +// Int64ObservableCounter is an instrument used to asynchronously record +// increasing int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableCounter + + Int64Observable +} + +// Int64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig] +// with all opts applied. +func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { + var config Int64ObservableCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableCounterOption applies options to a +// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableCounterOption. +type Int64ObservableCounterOption interface { + applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig +} + +// Int64ObservableUpDownCounter is an instrument used to asynchronously record +// int64 measurements once per collection cycle. Observations are only made +// within a callback for this instrument. The value observed is assumed the to +// be the cumulative sum of the count. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableUpDownCounter + + Int64Observable +} + +// Int64ObservableUpDownCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableUpDownCounterConfig returns a new +// [Int64ObservableUpDownCounterConfig] with all opts applied. +func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { + var config Int64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableUpDownCounterOption applies options to a +// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableUpDownCounterOption. +type Int64ObservableUpDownCounterOption interface { + applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig +} + +// Int64ObservableGauge is an instrument used to asynchronously record +// instantaneous int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64ObservableGauge + + Int64Observable +} + +// Int64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableGaugeConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig] +// with all opts applied. +func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { + var config Int64ObservableGaugeConfig + for _, o := range opts { + config = o.applyInt64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableGaugeOption applies options to a +// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableGaugeOption. +type Int64ObservableGaugeOption interface { + applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig +} + +// Int64Observer is a recorder of int64 measurements. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Observer + + // Observe records the int64 value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value int64, options ...ObserveOption) +} + +// Int64Callback is a function registered with a Meter that makes observations +// for an Int64Observerable instrument it is registered with. Calls to the +// Int64Observer record measurement values for the Int64Observable. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Int64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Int64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Int64Callback func(context.Context, Int64Observer) error + +// Int64ObservableOption applies options to int64 Observer instruments. +type Int64ObservableOption interface { + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption +} + +type int64CallbackOpt struct { + cback Int64Callback +} + +func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg +} + +// WithInt64Callback adds callback to be called for an instrument. +func WithInt64Callback(callback Int64Callback) Int64ObservableOption { + return int64CallbackOpt{callback} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go new file mode 100644 index 00000000..778ad2d7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -0,0 +1,92 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import "go.opentelemetry.io/otel/attribute" + +// MeterConfig contains options for Meters. +type MeterConfig struct { + instrumentationVersion string + schemaURL string + attrs attribute.Set + + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. +} + +// InstrumentationVersion returns the version of the library providing +// instrumentation. +func (cfg MeterConfig) InstrumentationVersion() string { + return cfg.instrumentationVersion +} + +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (cfg MeterConfig) InstrumentationAttributes() attribute.Set { + return cfg.attrs +} + +// SchemaURL is the schema_url of the library providing instrumentation. +func (cfg MeterConfig) SchemaURL() string { + return cfg.schemaURL +} + +// MeterOption is an interface for applying Meter options. +type MeterOption interface { + // applyMeter is used to set a MeterOption value of a MeterConfig. + applyMeter(MeterConfig) MeterConfig +} + +// NewMeterConfig creates a new MeterConfig and applies +// all the given options. +func NewMeterConfig(opts ...MeterOption) MeterConfig { + var config MeterConfig + for _, o := range opts { + config = o.applyMeter(config) + } + return config +} + +type meterOptionFunc func(MeterConfig) MeterConfig + +func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig { + return fn(cfg) +} + +// WithInstrumentationVersion sets the instrumentation version. +func WithInstrumentationVersion(version string) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.instrumentationVersion = version + return config + }) +} + +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + +// WithSchemaURL sets the schema URL. +func WithSchemaURL(schemaURL string) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.schemaURL = schemaURL + return config + }) +} diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go new file mode 100644 index 00000000..54716e13 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -0,0 +1,170 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package metric provides the OpenTelemetry API used to measure metrics about +source code operation. + +This API is separate from its implementation so the instrumentation built from +it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official +OpenTelemetry implementation of this API. + +All measurements made with this package are made via instruments. These +instruments are created by a [Meter] which itself is created by a +[MeterProvider]. Applications need to accept a [MeterProvider] implementation +as a starting point when instrumenting. This can be done directly, or by using +the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an +appropriately named [Meter] from the accepted [MeterProvider], instrumentation +can then be built from the [Meter]'s instruments. + +# Instruments + +Each instrument is designed to make measurements of a particular type. Broadly, +all instruments fall into two overlapping logical categories: asynchronous or +synchronous, and int64 or float64. + +All synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are used to measure the operation and performance of source +code during the source code execution. These instruments only make measurements +when the source code they instrument is run. + +All asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) are used to measure metrics outside of the execution +of source code. They are said to make "observations" via a callback function +called once every measurement collection cycle. + +Each instrument is also grouped by the value type it measures. Either int64 or +float64. The value being measured will dictate which instrument in these +categories to use. + +Outside of these two broad categories, instruments are described by the +function they are designed to serve. All Counters ([Int64Counter], +[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are +designed to measure values that never decrease in value, but instead only +incrementally increase in value. UpDownCounters ([Int64UpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], and +[Float64ObservableUpDownCounter]) on the other hand, are designed to measure +values that can increase and decrease. When more information needs to be +conveyed about all the synchronous measurements made during a collection cycle, +a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, +when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge] and +[Float64ObservableGauge]) should be used. + +See the [OpenTelemetry documentation] for more information about instruments +and their intended use. + +# Measurements + +Measurements are made by recording values and information about the values with +an instrument. How these measurements are recorded depends on the instrument. + +Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are recorded using the instrument methods directly. All +counter instruments have an Add method that is used to measure an increment +value, and all histogram instruments have a Record method to measure a data +point. + +Asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) record measurements within a callback function. The +callback is registered with the Meter which ensures the callback is called once +per collection cycle. A callback can be registered two ways: during the +instrument's creation using an option, or later using the RegisterCallback +method of the [Meter] that created the instrument. + +If the following criteria are met, an option ([WithInt64Callback] or +[WithFloat64Callback]) can be used during the asynchronous instrument's +creation to register a callback ([Int64Callback] or [Float64Callback], +respectively): + + - The measurement process is known when the instrument is created + - Only that instrument will make a measurement within the callback + - The callback never needs to be unregistered + +If the criteria are not met, use the RegisterCallback method of the [Meter] that +created the instrument to register a [Callback]. + +# API Implementations + +This package does not conform to the standard Go versioning policy, all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/metric/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/metric/embedded" + + type MeterProvider struct { + embedded.MeterProvider + // ... + } + +If an author wants the default behavior of their implementations to a panic, +they need to embed the API interface directly. + + import "go.opentelemetry.io/otel/metric" + + type MeterProvider struct { + metric.MeterProvider + // ... + } + +This is not a recommended behavior as it could lead to publishing packages that +contain runtime panics when users update other package that use newer versions +of [go.opentelemetry.io/otel/metric]. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/metric/noop]: + + import "go.opentelemetry.io/otel/metric/noop" + + type MeterProvider struct { + noop.MeterProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. + +[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ +[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider +*/ +package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go new file mode 100644 index 00000000..ae0bdbd2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -0,0 +1,234 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// metric API]. +// +// Implementers of the [OpenTelemetry metric API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry metric API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric +package embedded // import "go.opentelemetry.io/otel/metric/embedded" + +// MeterProvider is embedded in +// [go.opentelemetry.io/otel/metric.MeterProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type MeterProvider interface{ meterProvider() } + +// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Meter interface{ meter() } + +// Float64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Float64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Observer] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Observer interface{ float64Observer() } + +// Int64Observer is embedded in +// [go.opentelemetry.io/otel/metric.Int64Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Observer interface{ int64Observer() } + +// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Observer] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Observer interface{ observer() } + +// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Registration] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Registration] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Registration interface{ registration() } + +// Float64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Float64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Counter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Counter interface{ float64Counter() } + +// Float64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Float64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Float64Histogram interface{ float64Histogram() } + +// Float64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableCounter interface{ float64ObservableCounter() } + +// Float64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableGauge interface{ float64ObservableGauge() } + +// Float64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } + +// Float64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Float64UpDownCounter interface{ float64UpDownCounter() } + +// Int64Counter is embedded in +// [go.opentelemetry.io/otel/metric.Int64Counter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Counter interface{ int64Counter() } + +// Int64Histogram is embedded in +// [go.opentelemetry.io/otel/metric.Int64Histogram]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64Histogram interface{ int64Histogram() } + +// Int64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableCounter interface{ int64ObservableCounter() } + +// Int64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Int64ObservableGauge interface{ int64ObservableGauge() } + +// Int64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } + +// Int64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go new file mode 100644 index 00000000..be89cd53 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -0,0 +1,357 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import "go.opentelemetry.io/otel/attribute" + +// Observable is used as a grouping mechanism for all instruments that are +// updated within a Callback. +type Observable interface { + observable() +} + +// InstrumentOption applies options to all instruments. +type InstrumentOption interface { + Int64CounterOption + Int64UpDownCounterOption + Int64HistogramOption + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption + + Float64CounterOption + Float64UpDownCounterOption + Float64HistogramOption + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption +} + +// HistogramOption applies options to histogram instruments. +type HistogramOption interface { + Int64HistogramOption + Float64HistogramOption +} + +type descOpt string + +func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.description = string(o) + return c +} + +// WithDescription sets the instrument description. +func WithDescription(desc string) InstrumentOption { return descOpt(desc) } + +type unitOpt string + +func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +// WithUnit sets the instrument unit. +// +// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. +func WithUnit(u string) InstrumentOption { return unitOpt(u) } + +// WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries. +// +// This option is considered "advisory", and may be ignored by API implementations. +func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption { return bucketOpt(bounds) } + +type bucketOpt []float64 + +func (o bucketOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +func (o bucketOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +// AddOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as an AddOption. +type AddOption interface { + applyAdd(AddConfig) AddConfig +} + +// AddConfig contains options for an addition measurement. +type AddConfig struct { + attrs attribute.Set +} + +// NewAddConfig returns a new [AddConfig] with all opts applied. +func NewAddConfig(opts []AddOption) AddConfig { + config := AddConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyAdd(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c AddConfig) Attributes() attribute.Set { + return c.attrs +} + +// RecordOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a RecordOption. +type RecordOption interface { + applyRecord(RecordConfig) RecordConfig +} + +// RecordConfig contains options for a recorded measurement. +type RecordConfig struct { + attrs attribute.Set +} + +// NewRecordConfig returns a new [RecordConfig] with all opts applied. +func NewRecordConfig(opts []RecordOption) RecordConfig { + config := RecordConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyRecord(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c RecordConfig) Attributes() attribute.Set { + return c.attrs +} + +// ObserveOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a ObserveOption. +type ObserveOption interface { + applyObserve(ObserveConfig) ObserveConfig +} + +// ObserveConfig contains options for an observed measurement. +type ObserveConfig struct { + attrs attribute.Set +} + +// NewObserveConfig returns a new [ObserveConfig] with all opts applied. +func NewObserveConfig(opts []ObserveOption) ObserveConfig { + config := ObserveConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyObserve(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c ObserveConfig) Attributes() attribute.Set { + return c.attrs +} + +// MeasurementOption applies options to all instrument measurement. +type MeasurementOption interface { + AddOption + RecordOption + ObserveOption +} + +type attrOpt struct { + set attribute.Set +} + +// mergeSets returns the union of keys between a and b. Any duplicate keys will +// use the value associated with b. +func mergeSets(a, b attribute.Set) attribute.Set { + // NewMergeIterator uses the first value for any duplicates. + iter := attribute.NewMergeIterator(&b, &a) + merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) + for iter.Next() { + merged = append(merged, iter.Attribute()) + } + return attribute.NewSet(merged...) +} + +func (o attrOpt) applyAdd(c AddConfig) AddConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +// WithAttributeSet sets the attribute Set associated with a measurement is +// made with. +// +// If multiple WithAttributeSet or WithAttributes options are passed the +// attributes will be merged together in the order they are passed. Attributes +// with duplicate keys will use the last value passed. +func WithAttributeSet(attributes attribute.Set) MeasurementOption { + return attrOpt{set: attributes} +} + +// WithAttributes converts attributes into an attribute Set and sets the Set to +// be associated with a measurement. This is shorthand for: +// +// cp := make([]attribute.KeyValue, len(attributes)) +// copy(cp, attributes) +// WithAttributes(attribute.NewSet(cp...)) +// +// [attribute.NewSet] may modify the passed attributes so this will make a copy +// of attributes before creating a set in order to ensure this function is +// concurrent safe. This makes this option function less optimized in +// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be +// preferred for performance sensitive code. +// +// See [WithAttributeSet] for information about how multiple WithAttributes are +// merged. +func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { + cp := make([]attribute.KeyValue, len(attributes)) + copy(cp, attributes) + return attrOpt{set: attribute.NewSet(cp...)} +} diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go new file mode 100644 index 00000000..2520bc74 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -0,0 +1,212 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// MeterProvider provides access to named Meter instances, for instrumenting +// an application or package. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type MeterProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.MeterProvider + + // Meter returns a new Meter with the provided name and configuration. + // + // A Meter should be scoped at most to a single package. The name needs to + // be unique so it does not collide with other names used by + // an application, nor other applications. To achieve this, the import path + // of the instrumentation package is recommended to be used as name. + // + // If the name is empty, then an implementation defined default name will + // be used instead. + Meter(name string, opts ...MeterOption) Meter +} + +// Meter provides access to instrument instances for recording metrics. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Meter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Meter + + // Int64Counter returns a new Int64Counter instrument identified by name + // and configured with options. The instrument is used to synchronously + // record increasing int64 measurements during a computational operation. + Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) + // Int64UpDownCounter returns a new Int64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record int64 measurements during a computational + // operation. + Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) + // Int64Histogram returns a new Int64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of int64 measurements during a + // computational operation. + Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) + // Int64ObservableCounter returns a new Int64ObservableCounter identified + // by name and configured with options. The instrument is used to + // asynchronously record increasing int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) + // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record int64 measurements once per + // a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) + // Int64ObservableGauge returns a new Int64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) + + // Float64Counter returns a new Float64Counter instrument identified by + // name and configured with options. The instrument is used to + // synchronously record increasing float64 measurements during a + // computational operation. + Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) + // Float64UpDownCounter returns a new Float64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record float64 measurements during a computational + // operation. + Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) + // Float64Histogram returns a new Float64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of float64 measurements during a + // computational operation. + Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) + // Float64ObservableCounter returns a new Float64ObservableCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record increasing float64 + // measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) + // Float64ObservableUpDownCounter returns a new + // Float64ObservableUpDownCounter instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // float64 measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) + // Float64ObservableGauge returns a new Float64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous float64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) + + // RegisterCallback registers f to be called during the collection of a + // measurement cycle. + // + // If Unregister of the returned Registration is called, f needs to be + // unregistered and not called during collection. + // + // The instruments f is registered with are the only instruments that f may + // observe values for. + // + // If no instruments are passed, f should not be registered nor called + // during collection. + // + // The function f needs to be concurrent safe. + RegisterCallback(f Callback, instruments ...Observable) (Registration, error) +} + +// Callback is a function registered with a Meter that makes observations for +// the set of instruments it is registered with. The Observer parameter is used +// to record measurement observations for these instruments. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Callbacks. Meaning, it should not report measurements for an instrument with +// the same attributes as another Callback will report. +// +// The function needs to be concurrent safe. +type Callback func(context.Context, Observer) error + +// Observer records measurements for multiple instruments in a Callback. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Observer + + // ObserveFloat64 records the float64 value for obsrv. + ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) + // ObserveInt64 records the int64 value for obsrv. + ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) +} + +// Registration is an token representing the unique registration of a callback +// for a set of instruments with a Meter. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Registration interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Registration + + // Unregister removes the callback registration from a Meter. + // + // This method needs to be idempotent and concurrent safe. + Unregister() error +} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go new file mode 100644 index 00000000..0a4825ae --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -0,0 +1,185 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Float64Counter is an instrument that records increasing float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) +} + +// Float64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Float64CounterConfig struct { + description string + unit string +} + +// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts +// applied. +func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { + var config Float64CounterConfig + for _, o := range opts { + config = o.applyFloat64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64CounterConfig) Unit() string { + return c.unit +} + +// Float64CounterOption applies options to a [Float64CounterConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64CounterOption. +type Float64CounterOption interface { + applyFloat64Counter(Float64CounterConfig) Float64CounterConfig +} + +// Float64UpDownCounter is an instrument that records increasing or decreasing +// float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) +} + +// Float64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Float64UpDownCounterConfig struct { + description string + unit string +} + +// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig] +// with all opts applied. +func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { + var config Float64UpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Float64UpDownCounterOption applies options to a +// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that +// can be used as a Float64UpDownCounterOption. +type Float64UpDownCounterOption interface { + applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig +} + +// Float64Histogram is an instrument that records a distribution of float64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr float64, options ...RecordOption) +} + +// Float64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Float64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all +// opts applied. +func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { + var config Float64HistogramConfig + for _, o := range opts { + config = o.applyFloat64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Float64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Float64HistogramOption applies options to a [Float64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64HistogramOption. +type Float64HistogramOption interface { + applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig +} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go new file mode 100644 index 00000000..56667d32 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -0,0 +1,185 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/embedded" +) + +// Int64Counter is an instrument that records increasing int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Counter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) +} + +// Int64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Int64CounterConfig struct { + description string + unit string +} + +// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts +// applied. +func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { + var config Int64CounterConfig + for _, o := range opts { + config = o.applyInt64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64CounterConfig) Unit() string { + return c.unit +} + +// Int64CounterOption applies options to a [Int64CounterConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64CounterOption. +type Int64CounterOption interface { + applyInt64Counter(Int64CounterConfig) Int64CounterConfig +} + +// Int64UpDownCounter is an instrument that records increasing or decreasing +// int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64UpDownCounter + + // Add records a change to the counter. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) +} + +// Int64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Int64UpDownCounterConfig struct { + description string + unit string +} + +// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with +// all opts applied. +func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { + var config Int64UpDownCounterConfig + for _, o := range opts { + config = o.applyInt64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. +// See [InstrumentOption] for other options that can be used as an +// Int64UpDownCounterOption. +type Int64UpDownCounterOption interface { + applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig +} + +// Int64Histogram is an instrument that records a distribution of int64 +// values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Histogram + + // Record adds an additional value to the distribution. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr int64, options ...RecordOption) +} + +// Int64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Int64HistogramConfig struct { + description string + unit string + explicitBucketBoundaries []float64 +} + +// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts +// applied. +func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { + var config Int64HistogramConfig + for _, o := range opts { + config = o.applyInt64Histogram(config) + } + return config +} + +// Description returns the configured description. +func (c Int64HistogramConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64HistogramConfig) Unit() string { + return c.unit +} + +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + +// Int64HistogramOption applies options to a [Int64HistogramConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64HistogramOption. +type Int64HistogramOption interface { + applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig +} diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go new file mode 100644 index 00000000..d29aaa32 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/propagation" +) + +// GetTextMapPropagator returns the global TextMapPropagator. If none has been +// set, a No-Op TextMapPropagator is returned. +func GetTextMapPropagator() propagation.TextMapPropagator { + return global.TextMapPropagator() +} + +// SetTextMapPropagator sets propagator as the global TextMapPropagator. +func SetTextMapPropagator(propagator propagation.TextMapPropagator) { + global.SetTextMapPropagator(propagator) +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go new file mode 100644 index 00000000..303cdf1c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go @@ -0,0 +1,58 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + + "go.opentelemetry.io/otel/baggage" +) + +const baggageHeader = "baggage" + +// Baggage is a propagator that supports the W3C Baggage format. +// +// This propagates user-defined baggage associated with a trace. The complete +// specification is defined at https://www.w3.org/TR/baggage/. +type Baggage struct{} + +var _ TextMapPropagator = Baggage{} + +// Inject sets baggage key-values from ctx into the carrier. +func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) { + bStr := baggage.FromContext(ctx).String() + if bStr != "" { + carrier.Set(baggageHeader, bStr) + } +} + +// Extract returns a copy of parent with the baggage from the carrier added. +func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context { + bStr := carrier.Get(baggageHeader) + if bStr == "" { + return parent + } + + bag, err := baggage.Parse(bStr) + if err != nil { + return parent + } + return baggage.ContextWithBaggage(parent, bag) +} + +// Fields returns the keys who's values are set with Inject. +func (b Baggage) Fields() []string { + return []string{baggageHeader} +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go new file mode 100644 index 00000000..c119eb28 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package propagation contains OpenTelemetry context propagators. + +OpenTelemetry propagators are used to extract and inject context data from and +into messages exchanged by applications. The propagator supported by this +package is the W3C Trace Context encoding +(https://www.w3.org/TR/trace-context/), and W3C Baggage +(https://www.w3.org/TR/baggage/). +*/ +package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go new file mode 100644 index 00000000..c94438f7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -0,0 +1,153 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + "net/http" +) + +// TextMapCarrier is the storage medium used by a TextMapPropagator. +type TextMapCarrier interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Get returns the value associated with the passed key. + Get(key string) string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Set stores the key-value pair. + Set(key string, value string) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Keys lists the keys stored in this carrier. + Keys() []string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +// MapCarrier is a TextMapCarrier that uses a map held in memory as a storage +// medium for propagated key-value pairs. +type MapCarrier map[string]string + +// Compile time check that MapCarrier implements the TextMapCarrier. +var _ TextMapCarrier = MapCarrier{} + +// Get returns the value associated with the passed key. +func (c MapCarrier) Get(key string) string { + return c[key] +} + +// Set stores the key-value pair. +func (c MapCarrier) Set(key, value string) { + c[key] = value +} + +// Keys lists the keys stored in this carrier. +func (c MapCarrier) Keys() []string { + keys := make([]string, 0, len(c)) + for k := range c { + keys = append(keys, k) + } + return keys +} + +// HeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface. +type HeaderCarrier http.Header + +// Get returns the value associated with the passed key. +func (hc HeaderCarrier) Get(key string) string { + return http.Header(hc).Get(key) +} + +// Set stores the key-value pair. +func (hc HeaderCarrier) Set(key string, value string) { + http.Header(hc).Set(key, value) +} + +// Keys lists the keys stored in this carrier. +func (hc HeaderCarrier) Keys() []string { + keys := make([]string, 0, len(hc)) + for k := range hc { + keys = append(keys, k) + } + return keys +} + +// TextMapPropagator propagates cross-cutting concerns as key-value text +// pairs within a carrier that travels in-band across process boundaries. +type TextMapPropagator interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Inject set cross-cutting concerns from the Context into the carrier. + Inject(ctx context.Context, carrier TextMapCarrier) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Extract reads cross-cutting concerns from the carrier into a Context. + Extract(ctx context.Context, carrier TextMapCarrier) context.Context + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + // Fields returns the keys whose values are set with Inject. + Fields() []string + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + +type compositeTextMapPropagator []TextMapPropagator + +func (p compositeTextMapPropagator) Inject(ctx context.Context, carrier TextMapCarrier) { + for _, i := range p { + i.Inject(ctx, carrier) + } +} + +func (p compositeTextMapPropagator) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { + for _, i := range p { + ctx = i.Extract(ctx, carrier) + } + return ctx +} + +func (p compositeTextMapPropagator) Fields() []string { + unique := make(map[string]struct{}) + for _, i := range p { + for _, k := range i.Fields() { + unique[k] = struct{}{} + } + } + + fields := make([]string, 0, len(unique)) + for k := range unique { + fields = append(fields, k) + } + return fields +} + +// NewCompositeTextMapPropagator returns a unified TextMapPropagator from the +// group of passed TextMapPropagator. This allows different cross-cutting +// concerns to be propagates in a unified manner. +// +// The returned TextMapPropagator will inject and extract cross-cutting +// concerns in the order the TextMapPropagators were provided. Additionally, +// the Fields method will return a de-duplicated slice of the keys that are +// set with the Inject method. +func NewCompositeTextMapPropagator(p ...TextMapPropagator) TextMapPropagator { + return compositeTextMapPropagator(p) +} diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go new file mode 100644 index 00000000..63e5d622 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -0,0 +1,167 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package propagation // import "go.opentelemetry.io/otel/propagation" + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + + "go.opentelemetry.io/otel/trace" +) + +const ( + supportedVersion = 0 + maxVersion = 254 + traceparentHeader = "traceparent" + tracestateHeader = "tracestate" + delimiter = "-" +) + +// TraceContext is a propagator that supports the W3C Trace Context format +// (https://www.w3.org/TR/trace-context/) +// +// This propagator will propagate the traceparent and tracestate headers to +// guarantee traces are not broken. It is up to the users of this propagator +// to choose if they want to participate in a trace by modifying the +// traceparent header and relevant parts of the tracestate header containing +// their proprietary information. +type TraceContext struct{} + +var ( + _ TextMapPropagator = TraceContext{} + versionPart = fmt.Sprintf("%.2X", supportedVersion) +) + +// Inject set tracecontext from the Context into the carrier. +func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { + sc := trace.SpanContextFromContext(ctx) + if !sc.IsValid() { + return + } + + if ts := sc.TraceState().String(); ts != "" { + carrier.Set(tracestateHeader, ts) + } + + // Clear all flags other than the trace-context supported sampling bit. + flags := sc.TraceFlags() & trace.FlagsSampled + + var sb strings.Builder + sb.Grow(2 + 32 + 16 + 2 + 3) + _, _ = sb.WriteString(versionPart) + traceID := sc.TraceID() + spanID := sc.SpanID() + flagByte := [1]byte{byte(flags)} + var buf [32]byte + for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} { + _ = sb.WriteByte(delimiter[0]) + n := hex.Encode(buf[:], src) + _, _ = sb.Write(buf[:n]) + } + carrier.Set(traceparentHeader, sb.String()) +} + +// Extract reads tracecontext from the carrier into a returned Context. +// +// The returned Context will be a copy of ctx and contain the extracted +// tracecontext as the remote SpanContext. If the extracted tracecontext is +// invalid, the passed ctx will be returned directly instead. +func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { + sc := tc.extract(carrier) + if !sc.IsValid() { + return ctx + } + return trace.ContextWithRemoteSpanContext(ctx, sc) +} + +func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { + h := carrier.Get(traceparentHeader) + if h == "" { + return trace.SpanContext{} + } + + var ver [1]byte + if !extractPart(ver[:], &h, 2) { + return trace.SpanContext{} + } + version := int(ver[0]) + if version > maxVersion { + return trace.SpanContext{} + } + + var scc trace.SpanContextConfig + if !extractPart(scc.TraceID[:], &h, 32) { + return trace.SpanContext{} + } + if !extractPart(scc.SpanID[:], &h, 16) { + return trace.SpanContext{} + } + + var opts [1]byte + if !extractPart(opts[:], &h, 2) { + return trace.SpanContext{} + } + if version == 0 && (h != "" || opts[0] > 2) { + // version 0 not allow extra + // version 0 not allow other flag + return trace.SpanContext{} + } + + // Clear all flags other than the trace-context supported sampling bit. + scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled + + // Ignore the error returned here. Failure to parse tracestate MUST NOT + // affect the parsing of traceparent according to the W3C tracecontext + // specification. + scc.TraceState, _ = trace.ParseTraceState(carrier.Get(tracestateHeader)) + scc.Remote = true + + sc := trace.NewSpanContext(scc) + if !sc.IsValid() { + return trace.SpanContext{} + } + + return sc +} + +// upperHex detect hex is upper case Unicode characters. +func upperHex(v string) bool { + for _, c := range v { + if c >= 'A' && c <= 'F' { + return true + } + } + return false +} + +func extractPart(dst []byte, h *string, n int) bool { + part, left, _ := strings.Cut(*h, delimiter) + *h = left + // hex.Decode decodes unsupported upper-case characters, so exclude explicitly. + if len(part) != n || upperHex(part) { + return false + } + if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 { + return false + } + return true +} + +// Fields returns the keys who's values are set with Inject. +func (tc TraceContext) Fields() []string { + return []string{traceparentHeader, tracestateHeader} +} diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt new file mode 100644 index 00000000..e0a43e13 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -0,0 +1 @@ +codespell==2.2.6 diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go new file mode 100644 index 00000000..67d1d4c4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go @@ -0,0 +1,1209 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTP Server spans attributes +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/specification/trace/semantic_conventions/http.md#http-server-definitions) + // if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. It represents the application + // layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. It represents the version + // of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.protocol.version` refers to the version of the protocol used + // and might be different from the protocol client's version. If the HTTP + // client used has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If defined for the address + // family and if different than `net.host.port` and if `net.sock.host.addr` + // is set. In other cases, it is still recommended to set this.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. It represents the version of +// the application layer protocol used. See note below. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go new file mode 100644 index 00000000..359c5a69 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.20.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go new file mode 100644 index 00000000..8ac9350d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go new file mode 100644 index 00000000..09ff4dfd --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go new file mode 100644 index 00000000..342aede9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go new file mode 100644 index 00000000..a2b90674 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go @@ -0,0 +1,2071 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// Heroku dyno metadata +const ( + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") +) + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a general computing instance. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// A service instance. +const ( + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go new file mode 100644 index 00000000..e449e5c3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go new file mode 100644 index 00000000..85177414 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go @@ -0,0 +1,2610 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: stable + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: stable + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: stable + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: stable + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: stable + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: stable + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// Semantic Convention for HTTP Server +const ( + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/users/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: stable + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go new file mode 100644 index 00000000..caf7249d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/trace" +) + +// Tracer creates a named tracer that implements Tracer interface. +// If the name is an empty string then provider uses default name. +// +// This is short for GetTracerProvider().Tracer(name, opts...) +func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + return GetTracerProvider().Tracer(name, opts...) +} + +// GetTracerProvider returns the registered global trace provider. +// If none is registered then an instance of NoopTracerProvider is returned. +// +// Use the trace provider to create a named tracer. E.g. +// +// tracer := otel.GetTracerProvider().Tracer("example.com/foo") +// +// or +// +// tracer := otel.Tracer("example.com/foo") +func GetTracerProvider() trace.TracerProvider { + return global.TracerProvider() +} + +// SetTracerProvider registers `tp` as the global trace provider. +func SetTracerProvider(tp trace.TracerProvider) { + global.SetTracerProvider(tp) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/LICENSE b/vendor/go.opentelemetry.io/otel/trace/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go new file mode 100644 index 00000000..3aadc66c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -0,0 +1,334 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" +) + +// TracerConfig is a group of options for a Tracer. +type TracerConfig struct { + instrumentationVersion string + // Schema URL of the telemetry emitted by the Tracer. + schemaURL string + attrs attribute.Set +} + +// InstrumentationVersion returns the version of the library providing instrumentation. +func (t *TracerConfig) InstrumentationVersion() string { + return t.instrumentationVersion +} + +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (t *TracerConfig) InstrumentationAttributes() attribute.Set { + return t.attrs +} + +// SchemaURL returns the Schema URL of the telemetry emitted by the Tracer. +func (t *TracerConfig) SchemaURL() string { + return t.schemaURL +} + +// NewTracerConfig applies all the options to a returned TracerConfig. +func NewTracerConfig(options ...TracerOption) TracerConfig { + var config TracerConfig + for _, option := range options { + config = option.apply(config) + } + return config +} + +// TracerOption applies an option to a TracerConfig. +type TracerOption interface { + apply(TracerConfig) TracerConfig +} + +type tracerOptionFunc func(TracerConfig) TracerConfig + +func (fn tracerOptionFunc) apply(cfg TracerConfig) TracerConfig { + return fn(cfg) +} + +// SpanConfig is a group of options for a Span. +type SpanConfig struct { + attributes []attribute.KeyValue + timestamp time.Time + links []Link + newRoot bool + spanKind SpanKind + stackTrace bool +} + +// Attributes describe the associated qualities of a Span. +func (cfg *SpanConfig) Attributes() []attribute.KeyValue { + return cfg.attributes +} + +// Timestamp is a time in a Span life-cycle. +func (cfg *SpanConfig) Timestamp() time.Time { + return cfg.timestamp +} + +// StackTrace checks whether stack trace capturing is enabled. +func (cfg *SpanConfig) StackTrace() bool { + return cfg.stackTrace +} + +// Links are the associations a Span has with other Spans. +func (cfg *SpanConfig) Links() []Link { + return cfg.links +} + +// NewRoot identifies a Span as the root Span for a new trace. This is +// commonly used when an existing trace crosses trust boundaries and the +// remote parent span context should be ignored for security. +func (cfg *SpanConfig) NewRoot() bool { + return cfg.newRoot +} + +// SpanKind is the role a Span has in a trace. +func (cfg *SpanConfig) SpanKind() SpanKind { + return cfg.spanKind +} + +// NewSpanStartConfig applies all the options to a returned SpanConfig. +// No validation is performed on the returned SpanConfig (e.g. no uniqueness +// checking or bounding of data), it is left to the SDK to perform this +// action. +func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { + var c SpanConfig + for _, option := range options { + c = option.applySpanStart(c) + } + return c +} + +// NewSpanEndConfig applies all the options to a returned SpanConfig. +// No validation is performed on the returned SpanConfig (e.g. no uniqueness +// checking or bounding of data), it is left to the SDK to perform this +// action. +func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { + var c SpanConfig + for _, option := range options { + c = option.applySpanEnd(c) + } + return c +} + +// SpanStartOption applies an option to a SpanConfig. These options are applicable +// only when the span is created. +type SpanStartOption interface { + applySpanStart(SpanConfig) SpanConfig +} + +type spanOptionFunc func(SpanConfig) SpanConfig + +func (fn spanOptionFunc) applySpanStart(cfg SpanConfig) SpanConfig { + return fn(cfg) +} + +// SpanEndOption applies an option to a SpanConfig. These options are +// applicable only when the span is ended. +type SpanEndOption interface { + applySpanEnd(SpanConfig) SpanConfig +} + +// EventConfig is a group of options for an Event. +type EventConfig struct { + attributes []attribute.KeyValue + timestamp time.Time + stackTrace bool +} + +// Attributes describe the associated qualities of an Event. +func (cfg *EventConfig) Attributes() []attribute.KeyValue { + return cfg.attributes +} + +// Timestamp is a time in an Event life-cycle. +func (cfg *EventConfig) Timestamp() time.Time { + return cfg.timestamp +} + +// StackTrace checks whether stack trace capturing is enabled. +func (cfg *EventConfig) StackTrace() bool { + return cfg.stackTrace +} + +// NewEventConfig applies all the EventOptions to a returned EventConfig. If no +// timestamp option is passed, the returned EventConfig will have a Timestamp +// set to the call time, otherwise no validation is performed on the returned +// EventConfig. +func NewEventConfig(options ...EventOption) EventConfig { + var c EventConfig + for _, option := range options { + c = option.applyEvent(c) + } + if c.timestamp.IsZero() { + c.timestamp = time.Now() + } + return c +} + +// EventOption applies span event options to an EventConfig. +type EventOption interface { + applyEvent(EventConfig) EventConfig +} + +// SpanOption are options that can be used at both the beginning and end of a span. +type SpanOption interface { + SpanStartOption + SpanEndOption +} + +// SpanStartEventOption are options that can be used at the start of a span, or with an event. +type SpanStartEventOption interface { + SpanStartOption + EventOption +} + +// SpanEndEventOption are options that can be used at the end of a span, or with an event. +type SpanEndEventOption interface { + SpanEndOption + EventOption +} + +type attributeOption []attribute.KeyValue + +func (o attributeOption) applySpan(c SpanConfig) SpanConfig { + c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c +} +func (o attributeOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o attributeOption) applyEvent(c EventConfig) EventConfig { + c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c +} + +var _ SpanStartEventOption = attributeOption{} + +// WithAttributes adds the attributes related to a span life-cycle event. +// These attributes are used to describe the work a Span represents when this +// option is provided to a Span's start or end events. Otherwise, these +// attributes provide additional information about the event being recorded +// (e.g. error, state change, processing progress, system event). +// +// If multiple of these options are passed the attributes of each successive +// option will extend the attributes instead of overwriting. There is no +// guarantee of uniqueness in the resulting attributes. +func WithAttributes(attributes ...attribute.KeyValue) SpanStartEventOption { + return attributeOption(attributes) +} + +// SpanEventOption are options that can be used with an event or a span. +type SpanEventOption interface { + SpanOption + EventOption +} + +type timestampOption time.Time + +func (o timestampOption) applySpan(c SpanConfig) SpanConfig { + c.timestamp = time.Time(o) + return c +} +func (o timestampOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applyEvent(c EventConfig) EventConfig { + c.timestamp = time.Time(o) + return c +} + +var _ SpanEventOption = timestampOption{} + +// WithTimestamp sets the time of a Span or Event life-cycle moment (e.g. +// started, stopped, errored). +func WithTimestamp(t time.Time) SpanEventOption { + return timestampOption(t) +} + +type stackTraceOption bool + +func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { + c.stackTrace = bool(o) + return c +} + +func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { + c.stackTrace = bool(o) + return c +} +func (o stackTraceOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } + +// WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false). +func WithStackTrace(b bool) SpanEndEventOption { + return stackTraceOption(b) +} + +// WithLinks adds links to a Span. The links are added to the existing Span +// links, i.e. this does not overwrite. Links with invalid span context are ignored. +func WithLinks(links ...Link) SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.links = append(cfg.links, links...) + return cfg + }) +} + +// WithNewRoot specifies that the Span should be treated as a root Span. Any +// existing parent span context will be ignored when defining the Span's trace +// identifiers. +func WithNewRoot() SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.newRoot = true + return cfg + }) +} + +// WithSpanKind sets the SpanKind of a Span. +func WithSpanKind(kind SpanKind) SpanStartOption { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { + cfg.spanKind = kind + return cfg + }) +} + +// WithInstrumentationVersion sets the instrumentation version. +func WithInstrumentationVersion(version string) TracerOption { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { + cfg.instrumentationVersion = version + return cfg + }) +} + +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption { + return tracerOptionFunc(func(config TracerConfig) TracerConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + +// WithSchemaURL sets the schema URL for the Tracer. +func WithSchemaURL(schemaURL string) TracerOption { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { + cfg.schemaURL = schemaURL + return cfg + }) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go new file mode 100644 index 00000000..76f9a083 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +import "context" + +type traceContextKeyType int + +const currentSpanKey traceContextKeyType = iota + +// ContextWithSpan returns a copy of parent with span set as the current Span. +func ContextWithSpan(parent context.Context, span Span) context.Context { + return context.WithValue(parent, currentSpanKey, span) +} + +// ContextWithSpanContext returns a copy of parent with sc as the current +// Span. The Span implementation that wraps sc is non-recording and performs +// no operations other than to return sc as the SpanContext from the +// SpanContext method. +func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context { + return ContextWithSpan(parent, nonRecordingSpan{sc: sc}) +} + +// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly +// as a remote SpanContext and as the current Span. The Span implementation +// that wraps rsc is non-recording and performs no operations other than to +// return rsc as the SpanContext from the SpanContext method. +func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context { + return ContextWithSpanContext(parent, rsc.WithRemote(true)) +} + +// SpanFromContext returns the current Span from ctx. +// +// If no Span is currently set in ctx an implementation of a Span that +// performs no operations is returned. +func SpanFromContext(ctx context.Context) Span { + if ctx == nil { + return noopSpan{} + } + if span, ok := ctx.Value(currentSpanKey).(Span); ok { + return span + } + return noopSpan{} +} + +// SpanContextFromContext returns the current Span's SpanContext. +func SpanContextFromContext(ctx context.Context) SpanContext { + return SpanFromContext(ctx).SpanContext() +} diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go new file mode 100644 index 00000000..440f3d75 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -0,0 +1,130 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package trace provides an implementation of the tracing part of the +OpenTelemetry API. + +To participate in distributed traces a Span needs to be created for the +operation being performed as part of a traced workflow. In its simplest form: + + var tracer trace.Tracer + + func init() { + tracer = otel.Tracer("instrumentation/package/name") + } + + func operation(ctx context.Context) { + var span trace.Span + ctx, span = tracer.Start(ctx, "operation") + defer span.End() + // ... + } + +A Tracer is unique to the instrumentation and is used to create Spans. +Instrumentation should be designed to accept a TracerProvider from which it +can create its own unique Tracer. Alternatively, the registered global +TracerProvider from the go.opentelemetry.io/otel package can be used as +a default. + + const ( + name = "instrumentation/package/name" + version = "0.1.0" + ) + + type Instrumentation struct { + tracer trace.Tracer + } + + func NewInstrumentation(tp trace.TracerProvider) *Instrumentation { + if tp == nil { + tp = otel.TracerProvider() + } + return &Instrumentation{ + tracer: tp.Tracer(name, trace.WithInstrumentationVersion(version)), + } + } + + func operation(ctx context.Context, inst *Instrumentation) { + var span trace.Span + ctx, span = inst.tracer.Start(ctx, "operation") + defer span.End() + // ... + } + +# API Implementations + +This package does not conform to the standard Go versioning policy; all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/trace/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/trace/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/trace/embedded" + + type TracerProvider struct { + embedded.TracerProvider + // ... + } + +If an author wants the default behavior of their implementations to panic, they +can embed the API interface directly. + + import "go.opentelemetry.io/otel/trace" + + type TracerProvider struct { + trace.TracerProvider + // ... + } + +This option is not recommended. It will lead to publishing packages that +contain runtime panics when users update to newer versions of +[go.opentelemetry.io/otel/trace], which may be done with a trasitive +dependency. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/trace/noop]: + + import "go.opentelemetry.io/otel/trace/noop" + + type TracerProvider struct { + noop.TracerProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/trace/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. +*/ +package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go new file mode 100644 index 00000000..898db5a7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// trace API]. +// +// Implementers of the [OpenTelemetry trace API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry trace API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace +package embedded // import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider is embedded in +// [go.opentelemetry.io/otel/trace.TracerProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type TracerProvider interface{ tracerProvider() } + +// Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Tracer interface{ tracer() } + +// Span is embedded in [go.opentelemetry.io/otel/trace.Span]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Span] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Span interface{ span() } diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go new file mode 100644 index 00000000..88fcb816 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +// nonRecordingSpan is a minimal implementation of a Span that wraps a +// SpanContext. It performs no operations other than to return the wrapped +// SpanContext. +type nonRecordingSpan struct { + noopSpan + + sc SpanContext +} + +// SpanContext returns the wrapped SpanContext. +func (s nonRecordingSpan) SpanContext() SpanContext { return s.sc } diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go new file mode 100644 index 00000000..c125491c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -0,0 +1,93 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +// NewNoopTracerProvider returns an implementation of TracerProvider that +// performs no operations. The Tracer and Spans created from the returned +// TracerProvider also perform no operations. +// +// Deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] +// instead. +func NewNoopTracerProvider() TracerProvider { + return noopTracerProvider{} +} + +type noopTracerProvider struct{ embedded.TracerProvider } + +var _ TracerProvider = noopTracerProvider{} + +// Tracer returns noop implementation of Tracer. +func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer { + return noopTracer{} +} + +// noopTracer is an implementation of Tracer that performs no operations. +type noopTracer struct{ embedded.Tracer } + +var _ Tracer = noopTracer{} + +// Start carries forward a non-recording Span, if one is present in the context, otherwise it +// creates a no-op Span. +func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption) (context.Context, Span) { + span := SpanFromContext(ctx) + if _, ok := span.(nonRecordingSpan); !ok { + // span is likely already a noopSpan, but let's be sure + span = noopSpan{} + } + return ContextWithSpan(ctx, span), span +} + +// noopSpan is an implementation of Span that performs no operations. +type noopSpan struct{ embedded.Span } + +var _ Span = noopSpan{} + +// SpanContext returns an empty span context. +func (noopSpan) SpanContext() SpanContext { return SpanContext{} } + +// IsRecording always returns false. +func (noopSpan) IsRecording() bool { return false } + +// SetStatus does nothing. +func (noopSpan) SetStatus(codes.Code, string) {} + +// SetError does nothing. +func (noopSpan) SetError(bool) {} + +// SetAttributes does nothing. +func (noopSpan) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (noopSpan) End(...SpanEndOption) {} + +// RecordError does nothing. +func (noopSpan) RecordError(error, ...EventOption) {} + +// AddEvent does nothing. +func (noopSpan) AddEvent(string, ...EventOption) {} + +// SetName does nothing. +func (noopSpan) SetName(string) {} + +// TracerProvider returns a no-op TracerProvider. +func (noopSpan) TracerProvider() TracerProvider { return noopTracerProvider{} } diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go new file mode 100644 index 00000000..26a4b226 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -0,0 +1,577 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "bytes" + "context" + "encoding/hex" + "encoding/json" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +const ( + // FlagsSampled is a bitmask with the sampled bit set. A SpanContext + // with the sampling bit set means the span is sampled. + FlagsSampled = TraceFlags(0x01) + + errInvalidHexID errorConst = "trace-id and span-id can only contain [0-9a-f] characters, all lowercase" + + errInvalidTraceIDLength errorConst = "hex encoded trace-id must have length equals to 32" + errNilTraceID errorConst = "trace-id can't be all zero" + + errInvalidSpanIDLength errorConst = "hex encoded span-id must have length equals to 16" + errNilSpanID errorConst = "span-id can't be all zero" +) + +type errorConst string + +func (e errorConst) Error() string { + return string(e) +} + +// TraceID is a unique identity of a trace. +// nolint:revive // revive complains about stutter of `trace.TraceID`. +type TraceID [16]byte + +var ( + nilTraceID TraceID + _ json.Marshaler = nilTraceID +) + +// IsValid checks whether the trace TraceID is valid. A valid trace ID does +// not consist of zeros only. +func (t TraceID) IsValid() bool { + return !bytes.Equal(t[:], nilTraceID[:]) +} + +// MarshalJSON implements a custom marshal function to encode TraceID +// as a hex string. +func (t TraceID) MarshalJSON() ([]byte, error) { + return json.Marshal(t.String()) +} + +// String returns the hex string representation form of a TraceID. +func (t TraceID) String() string { + return hex.EncodeToString(t[:]) +} + +// SpanID is a unique identity of a span in a trace. +type SpanID [8]byte + +var ( + nilSpanID SpanID + _ json.Marshaler = nilSpanID +) + +// IsValid checks whether the SpanID is valid. A valid SpanID does not consist +// of zeros only. +func (s SpanID) IsValid() bool { + return !bytes.Equal(s[:], nilSpanID[:]) +} + +// MarshalJSON implements a custom marshal function to encode SpanID +// as a hex string. +func (s SpanID) MarshalJSON() ([]byte, error) { + return json.Marshal(s.String()) +} + +// String returns the hex string representation form of a SpanID. +func (s SpanID) String() string { + return hex.EncodeToString(s[:]) +} + +// TraceIDFromHex returns a TraceID from a hex string if it is compliant with +// the W3C trace-context specification. See more at +// https://www.w3.org/TR/trace-context/#trace-id +// nolint:revive // revive complains about stutter of `trace.TraceIDFromHex`. +func TraceIDFromHex(h string) (TraceID, error) { + t := TraceID{} + if len(h) != 32 { + return t, errInvalidTraceIDLength + } + + if err := decodeHex(h, t[:]); err != nil { + return t, err + } + + if !t.IsValid() { + return t, errNilTraceID + } + return t, nil +} + +// SpanIDFromHex returns a SpanID from a hex string if it is compliant +// with the w3c trace-context specification. +// See more at https://www.w3.org/TR/trace-context/#parent-id +func SpanIDFromHex(h string) (SpanID, error) { + s := SpanID{} + if len(h) != 16 { + return s, errInvalidSpanIDLength + } + + if err := decodeHex(h, s[:]); err != nil { + return s, err + } + + if !s.IsValid() { + return s, errNilSpanID + } + return s, nil +} + +func decodeHex(h string, b []byte) error { + for _, r := range h { + switch { + case 'a' <= r && r <= 'f': + continue + case '0' <= r && r <= '9': + continue + default: + return errInvalidHexID + } + } + + decoded, err := hex.DecodeString(h) + if err != nil { + return err + } + + copy(b, decoded) + return nil +} + +// TraceFlags contains flags that can be set on a SpanContext. +type TraceFlags byte //nolint:revive // revive complains about stutter of `trace.TraceFlags`. + +// IsSampled returns if the sampling bit is set in the TraceFlags. +func (tf TraceFlags) IsSampled() bool { + return tf&FlagsSampled == FlagsSampled +} + +// WithSampled sets the sampling bit in a new copy of the TraceFlags. +func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // sampled is not a control flag. + if sampled { + return tf | FlagsSampled + } + + return tf &^ FlagsSampled +} + +// MarshalJSON implements a custom marshal function to encode TraceFlags +// as a hex string. +func (tf TraceFlags) MarshalJSON() ([]byte, error) { + return json.Marshal(tf.String()) +} + +// String returns the hex string representation form of TraceFlags. +func (tf TraceFlags) String() string { + return hex.EncodeToString([]byte{byte(tf)}[:]) +} + +// SpanContextConfig contains mutable fields usable for constructing +// an immutable SpanContext. +type SpanContextConfig struct { + TraceID TraceID + SpanID SpanID + TraceFlags TraceFlags + TraceState TraceState + Remote bool +} + +// NewSpanContext constructs a SpanContext using values from the provided +// SpanContextConfig. +func NewSpanContext(config SpanContextConfig) SpanContext { + return SpanContext{ + traceID: config.TraceID, + spanID: config.SpanID, + traceFlags: config.TraceFlags, + traceState: config.TraceState, + remote: config.Remote, + } +} + +// SpanContext contains identifying trace information about a Span. +type SpanContext struct { + traceID TraceID + spanID SpanID + traceFlags TraceFlags + traceState TraceState + remote bool +} + +var _ json.Marshaler = SpanContext{} + +// IsValid returns if the SpanContext is valid. A valid span context has a +// valid TraceID and SpanID. +func (sc SpanContext) IsValid() bool { + return sc.HasTraceID() && sc.HasSpanID() +} + +// IsRemote indicates whether the SpanContext represents a remotely-created Span. +func (sc SpanContext) IsRemote() bool { + return sc.remote +} + +// WithRemote returns a copy of sc with the Remote property set to remote. +func (sc SpanContext) WithRemote(remote bool) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: remote, + } +} + +// TraceID returns the TraceID from the SpanContext. +func (sc SpanContext) TraceID() TraceID { + return sc.traceID +} + +// HasTraceID checks if the SpanContext has a valid TraceID. +func (sc SpanContext) HasTraceID() bool { + return sc.traceID.IsValid() +} + +// WithTraceID returns a new SpanContext with the TraceID replaced. +func (sc SpanContext) WithTraceID(traceID TraceID) SpanContext { + return SpanContext{ + traceID: traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// SpanID returns the SpanID from the SpanContext. +func (sc SpanContext) SpanID() SpanID { + return sc.spanID +} + +// HasSpanID checks if the SpanContext has a valid SpanID. +func (sc SpanContext) HasSpanID() bool { + return sc.spanID.IsValid() +} + +// WithSpanID returns a new SpanContext with the SpanID replaced. +func (sc SpanContext) WithSpanID(spanID SpanID) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: spanID, + traceFlags: sc.traceFlags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// TraceFlags returns the flags from the SpanContext. +func (sc SpanContext) TraceFlags() TraceFlags { + return sc.traceFlags +} + +// IsSampled returns if the sampling bit is set in the SpanContext's TraceFlags. +func (sc SpanContext) IsSampled() bool { + return sc.traceFlags.IsSampled() +} + +// WithTraceFlags returns a new SpanContext with the TraceFlags replaced. +func (sc SpanContext) WithTraceFlags(flags TraceFlags) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: flags, + traceState: sc.traceState, + remote: sc.remote, + } +} + +// TraceState returns the TraceState from the SpanContext. +func (sc SpanContext) TraceState() TraceState { + return sc.traceState +} + +// WithTraceState returns a new SpanContext with the TraceState replaced. +func (sc SpanContext) WithTraceState(state TraceState) SpanContext { + return SpanContext{ + traceID: sc.traceID, + spanID: sc.spanID, + traceFlags: sc.traceFlags, + traceState: state, + remote: sc.remote, + } +} + +// Equal is a predicate that determines whether two SpanContext values are equal. +func (sc SpanContext) Equal(other SpanContext) bool { + return sc.traceID == other.traceID && + sc.spanID == other.spanID && + sc.traceFlags == other.traceFlags && + sc.traceState.String() == other.traceState.String() && + sc.remote == other.remote +} + +// MarshalJSON implements a custom marshal function to encode a SpanContext. +func (sc SpanContext) MarshalJSON() ([]byte, error) { + return json.Marshal(SpanContextConfig{ + TraceID: sc.traceID, + SpanID: sc.spanID, + TraceFlags: sc.traceFlags, + TraceState: sc.traceState, + Remote: sc.remote, + }) +} + +// Span is the individual component of a trace. It represents a single named +// and timed operation of a workflow that is traced. A Tracer is used to +// create a Span and it is then up to the operation the Span represents to +// properly end the Span when the operation itself ends. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + + // End completes the Span. The Span is considered complete and ready to be + // delivered through the rest of the telemetry pipeline after this method + // is called. Therefore, updates to the Span are not allowed after this + // method has been called. + End(options ...SpanEndOption) + + // AddEvent adds an event with the provided name and options. + AddEvent(name string, options ...EventOption) + + // IsRecording returns the recording state of the Span. It will return + // true if the Span is active and events can be recorded. + IsRecording() bool + + // RecordError will record err as an exception span event for this span. An + // additional call to SetStatus is required if the Status of the Span should + // be set to Error, as this method does not change the Span status. If this + // span is not being recorded or err is nil then this method does nothing. + RecordError(err error, options ...EventOption) + + // SpanContext returns the SpanContext of the Span. The returned SpanContext + // is usable even after the End method has been called for the Span. + SpanContext() SpanContext + + // SetStatus sets the status of the Span in the form of a code and a + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. + SetStatus(code codes.Code, description string) + + // SetName sets the Span name. + SetName(name string) + + // SetAttributes sets kv as attributes of the Span. If a key from kv + // already exists for an attribute of the Span it will be overwritten with + // the value contained in kv. + SetAttributes(kv ...attribute.KeyValue) + + // TracerProvider returns a TracerProvider that can be used to generate + // additional Spans on the same telemetry pipeline as the current Span. + TracerProvider() TracerProvider +} + +// Link is the relationship between two Spans. The relationship can be within +// the same Trace or across different Traces. +// +// For example, a Link is used in the following situations: +// +// 1. Batch Processing: A batch of operations may contain operations +// associated with one or more traces/spans. Since there can only be one +// parent SpanContext, a Link is used to keep reference to the +// SpanContext of all operations in the batch. +// 2. Public Endpoint: A SpanContext for an in incoming client request on a +// public endpoint should be considered untrusted. In such a case, a new +// trace with its own identity and sampling decision needs to be created, +// but this new trace needs to be related to the original trace in some +// form. A Link is used to keep reference to the original SpanContext and +// track the relationship. +type Link struct { + // SpanContext of the linked Span. + SpanContext SpanContext + + // Attributes describe the aspects of the link. + Attributes []attribute.KeyValue +} + +// LinkFromContext returns a link encapsulating the SpanContext in the provided ctx. +func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { + return Link{ + SpanContext: SpanContextFromContext(ctx), + Attributes: attrs, + } +} + +// SpanKind is the role a Span plays in a Trace. +type SpanKind int + +// As a convenience, these match the proto definition, see +// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 +// +// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` +// to coerce a span kind to a valid value. +const ( + // SpanKindUnspecified is an unspecified SpanKind and is not a valid + // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal + // if it is received. + SpanKindUnspecified SpanKind = 0 + // SpanKindInternal is a SpanKind for a Span that represents an internal + // operation within an application. + SpanKindInternal SpanKind = 1 + // SpanKindServer is a SpanKind for a Span that represents the operation + // of handling a request from a client. + SpanKindServer SpanKind = 2 + // SpanKindClient is a SpanKind for a Span that represents the operation + // of client making a request to a server. + SpanKindClient SpanKind = 3 + // SpanKindProducer is a SpanKind for a Span that represents the operation + // of a producer sending a message to a message broker. Unlike + // SpanKindClient and SpanKindServer, there is often no direct + // relationship between this kind of Span and a SpanKindConsumer kind. A + // SpanKindProducer Span will end once the message is accepted by the + // message broker which might not overlap with the processing of that + // message. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer is a SpanKind for a Span that represents the operation + // of a consumer receiving a message from a message broker. Like + // SpanKindProducer Spans, there is often no direct relationship between + // this Span and the Span that produced the message. + SpanKindConsumer SpanKind = 5 +) + +// ValidateSpanKind returns a valid span kind value. This will coerce +// invalid values into the default value, SpanKindInternal. +func ValidateSpanKind(spanKind SpanKind) SpanKind { + switch spanKind { + case SpanKindInternal, + SpanKindServer, + SpanKindClient, + SpanKindProducer, + SpanKindConsumer: + // valid + return spanKind + default: + return SpanKindInternal + } +} + +// String returns the specified name of the SpanKind in lower-case. +func (sk SpanKind) String() string { + switch sk { + case SpanKindInternal: + return "internal" + case SpanKindServer: + return "server" + case SpanKindClient: + return "client" + case SpanKindProducer: + return "producer" + case SpanKindConsumer: + return "consumer" + default: + return "unspecified" + } +} + +// Tracer is the creator of Spans. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + + // Start creates a span and a context.Context containing the newly-created span. + // + // If the context.Context provided in `ctx` contains a Span then the newly-created + // Span will be a child of that span, otherwise it will be a root span. This behavior + // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the + // newly-created Span to be a root span even if `ctx` contains a Span. + // + // When creating a Span it is recommended to provide all known span attributes using + // the `WithAttributes()` SpanOption as samplers will only have access to the + // attributes provided when a Span is created. + // + // Any Span that is created MUST also be ended. This is the responsibility of the user. + // Implementations of this API may leak memory or other resources if Spans are not ended. + Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) +} + +// TracerProvider provides Tracers that are used by instrumentation code to +// trace computational workflows. +// +// A TracerProvider is the collection destination of all Spans from Tracers it +// provides, it represents a unique telemetry collection pipeline. How that +// pipeline is defined, meaning how those Spans are collected, processed, and +// where they are exported, depends on its implementation. Instrumentation +// authors do not need to define this implementation, rather just use the +// provided Tracers to instrument code. +// +// Commonly, instrumentation code will accept a TracerProvider implementation +// at runtime from its users or it can simply use the globally registered one +// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + + // Tracer returns a unique Tracer scoped to be used by instrumentation code + // to trace computational workflows. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use traces to communicate different domains of + // workflow data (i.e. using spans to communicate workflow events only). If + // this is the case, the WithScopeAttributes option should be used to + // uniquely identify Tracers that handle the different domains of workflow + // data. + // + // If the same name and options are passed multiple times, the same Tracer + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Tracer or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Tracer. All implementations will ensure any TracerProvider + // configuration changes are propagated to all provided Tracers. + // + // If name is empty, then an implementation defined default name will be + // used instead. + // + // This method is safe to call concurrently. + Tracer(name string, options ...TracerOption) Tracer +} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go new file mode 100644 index 00000000..db936ba5 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -0,0 +1,331 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "encoding/json" + "fmt" + "strings" +) + +const ( + maxListMembers = 32 + + listDelimiters = "," + memberDelimiter = "=" + + errInvalidKey errorConst = "invalid tracestate key" + errInvalidValue errorConst = "invalid tracestate value" + errInvalidMember errorConst = "invalid tracestate list-member" + errMemberNumber errorConst = "too many list-members in tracestate" + errDuplicate errorConst = "duplicate list-member in tracestate" +) + +type member struct { + Key string + Value string +} + +// according to (chr = %x20 / (nblk-char = %x21-2B / %x2D-3C / %x3E-7E) ) +// means (chr = %x20-2B / %x2D-3C / %x3E-7E) . +func checkValueChar(v byte) bool { + return v >= '\x20' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// according to (nblk-chr = %x21-2B / %x2D-3C / %x3E-7E) . +func checkValueLast(v byte) bool { + return v >= '\x21' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// based on the W3C Trace Context specification +// +// value = (0*255(chr)) nblk-chr +// nblk-chr = %x21-2B / %x2D-3C / %x3E-7E +// chr = %x20 / nblk-chr +// +// see https://www.w3.org/TR/trace-context-1/#value +func checkValue(val string) bool { + n := len(val) + if n == 0 || n > 256 { + return false + } + for i := 0; i < n-1; i++ { + if !checkValueChar(val[i]) { + return false + } + } + return checkValueLast(val[n-1]) +} + +func checkKeyRemain(key string) bool { + // ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) + for _, v := range key { + if isAlphaNum(byte(v)) { + continue + } + switch v { + case '_', '-', '*', '/': + continue + } + return false + } + return true +} + +// according to +// +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// +// param n is remain part length, should be 255 in simple-key or 13 in system-id. +func checkKeyPart(key string, n int) bool { + if len(key) == 0 { + return false + } + first := key[0] // key's first char + ret := len(key[1:]) <= n + ret = ret && first >= 'a' && first <= 'z' + return ret && checkKeyRemain(key[1:]) +} + +func isAlphaNum(c byte) bool { + if c >= 'a' && c <= 'z' { + return true + } + return c >= '0' && c <= '9' +} + +// according to +// +// tenant-id = ( lcalpha / DIGIT ) 0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) +// +// param n is remain part length, should be 240 exactly. +func checkKeyTenant(key string, n int) bool { + if len(key) == 0 { + return false + } + return isAlphaNum(key[0]) && len(key[1:]) <= n && checkKeyRemain(key[1:]) +} + +// based on the W3C Trace Context specification +// +// key = simple-key / multi-tenant-key +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// multi-tenant-key = tenant-id "@" system-id +// tenant-id = ( lcalpha / DIGIT ) (0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// lcalpha = %x61-7A ; a-z +// +// see https://www.w3.org/TR/trace-context-1/#tracestate-header. +func checkKey(key string) bool { + tenant, system, ok := strings.Cut(key, "@") + if !ok { + return checkKeyPart(key, 255) + } + return checkKeyTenant(tenant, 240) && checkKeyPart(system, 13) +} + +func newMember(key, value string) (member, error) { + if !checkKey(key) { + return member{}, errInvalidKey + } + if !checkValue(value) { + return member{}, errInvalidValue + } + return member{Key: key, Value: value}, nil +} + +func parseMember(m string) (member, error) { + key, val, ok := strings.Cut(m, memberDelimiter) + if !ok { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + key = strings.TrimLeft(key, " \t") + val = strings.TrimRight(val, " \t") + result, e := newMember(key, val) + if e != nil { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + return result, nil +} + +// String encodes member into a string compliant with the W3C Trace Context +// specification. +func (m member) String() string { + return m.Key + "=" + m.Value +} + +// TraceState provides additional vendor-specific trace identification +// information across different distributed tracing systems. It represents an +// immutable list consisting of key/value pairs, each pair is referred to as a +// list-member. +// +// TraceState conforms to the W3C Trace Context specification +// (https://www.w3.org/TR/trace-context-1). All operations that create or copy +// a TraceState do so by validating all input and will only produce TraceState +// that conform to the specification. Specifically, this means that all +// list-member's key/value pairs are valid, no duplicate list-members exist, +// and the maximum number of list-members (32) is not exceeded. +type TraceState struct { //nolint:revive // revive complains about stutter of `trace.TraceState` + // list is the members in order. + list []member +} + +var _ json.Marshaler = TraceState{} + +// ParseTraceState attempts to decode a TraceState from the passed +// string. It returns an error if the input is invalid according to the W3C +// Trace Context specification. +func ParseTraceState(ts string) (TraceState, error) { + if ts == "" { + return TraceState{}, nil + } + + wrapErr := func(err error) error { + return fmt.Errorf("failed to parse tracestate: %w", err) + } + + var members []member + found := make(map[string]struct{}) + for ts != "" { + var memberStr string + memberStr, ts, _ = strings.Cut(ts, listDelimiters) + if len(memberStr) == 0 { + continue + } + + m, err := parseMember(memberStr) + if err != nil { + return TraceState{}, wrapErr(err) + } + + if _, ok := found[m.Key]; ok { + return TraceState{}, wrapErr(errDuplicate) + } + found[m.Key] = struct{}{} + + members = append(members, m) + if n := len(members); n > maxListMembers { + return TraceState{}, wrapErr(errMemberNumber) + } + } + + return TraceState{list: members}, nil +} + +// MarshalJSON marshals the TraceState into JSON. +func (ts TraceState) MarshalJSON() ([]byte, error) { + return json.Marshal(ts.String()) +} + +// String encodes the TraceState into a string compliant with the W3C +// Trace Context specification. The returned string will be invalid if the +// TraceState contains any invalid members. +func (ts TraceState) String() string { + if len(ts.list) == 0 { + return "" + } + var n int + n += len(ts.list) // member delimiters: '=' + n += len(ts.list) - 1 // list delimiters: ',' + for _, mem := range ts.list { + n += len(mem.Key) + n += len(mem.Value) + } + + var sb strings.Builder + sb.Grow(n) + _, _ = sb.WriteString(ts.list[0].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[0].Value) + for i := 1; i < len(ts.list); i++ { + _ = sb.WriteByte(listDelimiters[0]) + _, _ = sb.WriteString(ts.list[i].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[i].Value) + } + return sb.String() +} + +// Get returns the value paired with key from the corresponding TraceState +// list-member if it exists, otherwise an empty string is returned. +func (ts TraceState) Get(key string) string { + for _, member := range ts.list { + if member.Key == key { + return member.Value + } + } + + return "" +} + +// Insert adds a new list-member defined by the key/value pair to the +// TraceState. If a list-member already exists for the given key, that +// list-member's value is updated. The new or updated list-member is always +// moved to the beginning of the TraceState as specified by the W3C Trace +// Context specification. +// +// If key or value are invalid according to the W3C Trace Context +// specification an error is returned with the original TraceState. +// +// If adding a new list-member means the TraceState would have more members +// then is allowed, the new list-member will be inserted and the right-most +// list-member will be dropped in the returned TraceState. +func (ts TraceState) Insert(key, value string) (TraceState, error) { + m, err := newMember(key, value) + if err != nil { + return ts, err + } + n := len(ts.list) + found := n + for i := range ts.list { + if ts.list[i].Key == key { + found = i + } + } + cTS := TraceState{} + if found == n && n < maxListMembers { + cTS.list = make([]member, n+1) + } else { + cTS.list = make([]member, n) + } + cTS.list[0] = m + // When the number of members exceeds capacity, drop the "right-most". + copy(cTS.list[1:], ts.list[0:found]) + if found < n { + copy(cTS.list[1+found:], ts.list[found+1:]) + } + return cTS, nil +} + +// Delete returns a copy of the TraceState with the list-member identified by +// key removed. +func (ts TraceState) Delete(key string) TraceState { + members := make([]member, ts.Len()) + copy(members, ts.list) + for i, member := range ts.list { + if member.Key == key { + members = append(members[:i], members[i+1:]...) + // TraceState should contain no duplicate members. + break + } + } + return TraceState{list: members} +} + +// Len returns the number of list-members in the TraceState. +func (ts TraceState) Len() int { + return len(ts.list) +} diff --git a/vendor/go.opentelemetry.io/otel/verify_examples.sh b/vendor/go.opentelemetry.io/otel/verify_examples.sh new file mode 100644 index 00000000..dbb61a42 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/verify_examples.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +cd $(dirname $0) +TOOLS_DIR=$(pwd)/.tools + +if [ -z "${GOPATH}" ] ; then + printf "GOPATH is not defined.\n" + exit -1 +fi + +if [ ! -d "${GOPATH}" ] ; then + printf "GOPATH ${GOPATH} is invalid \n" + exit -1 +fi + +# Pre-requisites +if ! git diff --quiet; then \ + git status + printf "\n\nError: working tree is not clean\n" + exit -1 +fi + +if [ "$(git tag --contains $(git log -1 --pretty=format:"%H"))" = "" ] ; then + printf "$(git log -1)" + printf "\n\nError: HEAD is not pointing to a tagged version" +fi + +make ${TOOLS_DIR}/gojq + +DIR_TMP="${GOPATH}/src/oteltmp/" +rm -rf $DIR_TMP +mkdir -p $DIR_TMP + +printf "Copy examples to ${DIR_TMP}\n" +cp -a ./example ${DIR_TMP} + +# Update go.mod files +printf "Update go.mod: rename module and remove replace\n" + +PACKAGE_DIRS=$(find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | egrep 'example' | sed 's/^\.\///' | sort) + +for dir in $PACKAGE_DIRS; do + printf " Update go.mod for $dir\n" + (cd "${DIR_TMP}/${dir}" && \ + # replaces is ("mod1" "mod2" …) + replaces=($(go mod edit -json | ${TOOLS_DIR}/gojq '.Replace[].Old.Path')) && \ + # strip double quotes + replaces=("${replaces[@]%\"}") && \ + replaces=("${replaces[@]#\"}") && \ + # make an array (-dropreplace=mod1 -dropreplace=mod2 …) + dropreplaces=("${replaces[@]/#/-dropreplace=}") && \ + go mod edit -module "oteltmp/${dir}" "${dropreplaces[@]}" && \ + go mod tidy) +done +printf "Update done:\n\n" + +# Build directories that contain main package. These directories are different than +# directories that contain go.mod files. +printf "Build examples:\n" +EXAMPLES=$(./get_main_pkgs.sh ./example) +for ex in $EXAMPLES; do + printf " Build $ex in ${DIR_TMP}/${ex}\n" + (cd "${DIR_TMP}/${ex}" && \ + go build .) +done + +# Cleanup +printf "Remove copied files.\n" +rm -rf $DIR_TMP diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go new file mode 100644 index 00000000..7b2993a1 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +// Version is the current release version of OpenTelemetry in use. +func Version() string { + return "1.24.0" +} diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml new file mode 100644 index 00000000..1b556e67 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -0,0 +1,56 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +module-sets: + stable-v1: + version: v1.24.0 + modules: + - go.opentelemetry.io/otel + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test + - go.opentelemetry.io/otel/bridge/opentracing + - go.opentelemetry.io/otel/bridge/opentracing/test + - go.opentelemetry.io/otel/example/dice + - go.opentelemetry.io/otel/example/namedtracer + - go.opentelemetry.io/otel/example/opencensus + - go.opentelemetry.io/otel/example/otel-collector + - go.opentelemetry.io/otel/example/passthrough + - go.opentelemetry.io/otel/example/zipkin + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp + - go.opentelemetry.io/otel/exporters/otlp/otlptrace + - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc + - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric + - go.opentelemetry.io/otel/exporters/stdout/stdouttrace + - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/metric + - go.opentelemetry.io/otel/sdk + - go.opentelemetry.io/otel/sdk/metric + - go.opentelemetry.io/otel/trace + experimental-metrics: + version: v0.46.0 + modules: + - go.opentelemetry.io/otel/example/prometheus + - go.opentelemetry.io/otel/exporters/prometheus + experimental-logs: + version: v0.0.1-alpha + modules: + - go.opentelemetry.io/otel/log + experimental-schema: + version: v0.0.7 + modules: + - go.opentelemetry.io/otel/schema +excluded-modules: + - go.opentelemetry.io/otel/internal/tools diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s index 66aebae2..c672ccf6 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s +++ b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s @@ -33,6 +33,9 @@ #define CONSTBASE R16 #define BLOCKS R17 +// for VPERMXOR +#define MASK R18 + DATA consts<>+0x00(SB)/8, $0x3320646e61707865 DATA consts<>+0x08(SB)/8, $0x6b20657479622d32 DATA consts<>+0x10(SB)/8, $0x0000000000000001 @@ -53,7 +56,11 @@ DATA consts<>+0x80(SB)/8, $0x6b2065746b206574 DATA consts<>+0x88(SB)/8, $0x6b2065746b206574 DATA consts<>+0x90(SB)/8, $0x0000000100000000 DATA consts<>+0x98(SB)/8, $0x0000000300000002 -GLOBL consts<>(SB), RODATA, $0xa0 +DATA consts<>+0xa0(SB)/8, $0x5566774411223300 +DATA consts<>+0xa8(SB)/8, $0xddeeffcc99aabb88 +DATA consts<>+0xb0(SB)/8, $0x6677445522330011 +DATA consts<>+0xb8(SB)/8, $0xeeffccddaabb8899 +GLOBL consts<>(SB), RODATA, $0xc0 //func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32) TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40 @@ -70,6 +77,9 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40 MOVD $48, R10 MOVD $64, R11 SRD $6, LEN, BLOCKS + // for VPERMXOR + MOVD $consts<>+0xa0(SB), MASK + MOVD $16, R20 // V16 LXVW4X (CONSTBASE)(R0), VS48 ADD $80,CONSTBASE @@ -87,6 +97,10 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40 // V28 LXVW4X (CONSTBASE)(R11), VS60 + // Load mask constants for VPERMXOR + LXVW4X (MASK)(R0), V20 + LXVW4X (MASK)(R20), V21 + // splat slot from V19 -> V26 VSPLTW $0, V19, V26 @@ -97,7 +111,7 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40 MOVD $10, R14 MOVD R14, CTR - + PCALIGN $16 loop_outer_vsx: // V0, V1, V2, V3 LXVW4X (R0)(CONSTBASE), VS32 @@ -128,22 +142,17 @@ loop_outer_vsx: VSPLTISW $12, V28 VSPLTISW $8, V29 VSPLTISW $7, V30 - + PCALIGN $16 loop_vsx: VADDUWM V0, V4, V0 VADDUWM V1, V5, V1 VADDUWM V2, V6, V2 VADDUWM V3, V7, V3 - VXOR V12, V0, V12 - VXOR V13, V1, V13 - VXOR V14, V2, V14 - VXOR V15, V3, V15 - - VRLW V12, V27, V12 - VRLW V13, V27, V13 - VRLW V14, V27, V14 - VRLW V15, V27, V15 + VPERMXOR V12, V0, V21, V12 + VPERMXOR V13, V1, V21, V13 + VPERMXOR V14, V2, V21, V14 + VPERMXOR V15, V3, V21, V15 VADDUWM V8, V12, V8 VADDUWM V9, V13, V9 @@ -165,15 +174,10 @@ loop_vsx: VADDUWM V2, V6, V2 VADDUWM V3, V7, V3 - VXOR V12, V0, V12 - VXOR V13, V1, V13 - VXOR V14, V2, V14 - VXOR V15, V3, V15 - - VRLW V12, V29, V12 - VRLW V13, V29, V13 - VRLW V14, V29, V14 - VRLW V15, V29, V15 + VPERMXOR V12, V0, V20, V12 + VPERMXOR V13, V1, V20, V13 + VPERMXOR V14, V2, V20, V14 + VPERMXOR V15, V3, V20, V15 VADDUWM V8, V12, V8 VADDUWM V9, V13, V9 @@ -195,15 +199,10 @@ loop_vsx: VADDUWM V2, V7, V2 VADDUWM V3, V4, V3 - VXOR V15, V0, V15 - VXOR V12, V1, V12 - VXOR V13, V2, V13 - VXOR V14, V3, V14 - - VRLW V15, V27, V15 - VRLW V12, V27, V12 - VRLW V13, V27, V13 - VRLW V14, V27, V14 + VPERMXOR V15, V0, V21, V15 + VPERMXOR V12, V1, V21, V12 + VPERMXOR V13, V2, V21, V13 + VPERMXOR V14, V3, V21, V14 VADDUWM V10, V15, V10 VADDUWM V11, V12, V11 @@ -225,15 +224,10 @@ loop_vsx: VADDUWM V2, V7, V2 VADDUWM V3, V4, V3 - VXOR V15, V0, V15 - VXOR V12, V1, V12 - VXOR V13, V2, V13 - VXOR V14, V3, V14 - - VRLW V15, V29, V15 - VRLW V12, V29, V12 - VRLW V13, V29, V13 - VRLW V14, V29, V14 + VPERMXOR V15, V0, V20, V15 + VPERMXOR V12, V1, V20, V12 + VPERMXOR V13, V2, V20, V13 + VPERMXOR V14, V3, V20, V14 VADDUWM V10, V15, V10 VADDUWM V11, V12, V11 @@ -249,48 +243,48 @@ loop_vsx: VRLW V6, V30, V6 VRLW V7, V30, V7 VRLW V4, V30, V4 - BC 16, LT, loop_vsx + BDNZ loop_vsx VADDUWM V12, V26, V12 - WORD $0x13600F8C // VMRGEW V0, V1, V27 - WORD $0x13821F8C // VMRGEW V2, V3, V28 + VMRGEW V0, V1, V27 + VMRGEW V2, V3, V28 - WORD $0x10000E8C // VMRGOW V0, V1, V0 - WORD $0x10421E8C // VMRGOW V2, V3, V2 + VMRGOW V0, V1, V0 + VMRGOW V2, V3, V2 - WORD $0x13A42F8C // VMRGEW V4, V5, V29 - WORD $0x13C63F8C // VMRGEW V6, V7, V30 + VMRGEW V4, V5, V29 + VMRGEW V6, V7, V30 XXPERMDI VS32, VS34, $0, VS33 XXPERMDI VS32, VS34, $3, VS35 XXPERMDI VS59, VS60, $0, VS32 XXPERMDI VS59, VS60, $3, VS34 - WORD $0x10842E8C // VMRGOW V4, V5, V4 - WORD $0x10C63E8C // VMRGOW V6, V7, V6 + VMRGOW V4, V5, V4 + VMRGOW V6, V7, V6 - WORD $0x13684F8C // VMRGEW V8, V9, V27 - WORD $0x138A5F8C // VMRGEW V10, V11, V28 + VMRGEW V8, V9, V27 + VMRGEW V10, V11, V28 XXPERMDI VS36, VS38, $0, VS37 XXPERMDI VS36, VS38, $3, VS39 XXPERMDI VS61, VS62, $0, VS36 XXPERMDI VS61, VS62, $3, VS38 - WORD $0x11084E8C // VMRGOW V8, V9, V8 - WORD $0x114A5E8C // VMRGOW V10, V11, V10 + VMRGOW V8, V9, V8 + VMRGOW V10, V11, V10 - WORD $0x13AC6F8C // VMRGEW V12, V13, V29 - WORD $0x13CE7F8C // VMRGEW V14, V15, V30 + VMRGEW V12, V13, V29 + VMRGEW V14, V15, V30 XXPERMDI VS40, VS42, $0, VS41 XXPERMDI VS40, VS42, $3, VS43 XXPERMDI VS59, VS60, $0, VS40 XXPERMDI VS59, VS60, $3, VS42 - WORD $0x118C6E8C // VMRGOW V12, V13, V12 - WORD $0x11CE7E8C // VMRGOW V14, V15, V14 + VMRGOW V12, V13, V12 + VMRGOW V14, V15, V14 VSPLTISW $4, V27 VADDUWM V26, V27, V26 @@ -431,7 +425,7 @@ tail_vsx: ADD $-1, R11, R12 ADD $-1, INP ADD $-1, OUT - + PCALIGN $16 looptail_vsx: // Copying the result to OUT // in bytes. @@ -439,7 +433,7 @@ looptail_vsx: MOVBZU 1(INP), TMP XOR KEY, TMP, KEY MOVBU KEY, 1(OUT) - BC 16, LT, looptail_vsx + BDNZ looptail_vsx // Clear the stack values STXVW4X VS48, (R11)(R0) diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index 34bf089d..9486c598 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -404,10 +404,10 @@ func validateKey(key PublicKey, algo string, user string, c packetConn) (bool, e return false, err } - return confirmKeyAck(key, algo, c) + return confirmKeyAck(key, c) } -func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) { +func confirmKeyAck(key PublicKey, c packetConn) (bool, error) { pubKey := key.Marshal() for { @@ -425,7 +425,15 @@ func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) { if err := Unmarshal(packet, &msg); err != nil { return false, err } - if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) { + // According to RFC 4252 Section 7 the algorithm in + // SSH_MSG_USERAUTH_PK_OK should match that of the request but some + // servers send the key type instead. OpenSSH allows any algorithm + // that matches the public key, so we do the same. + // https://github.com/openssh/openssh-portable/blob/86bdd385/sshconnect2.c#L709 + if !contains(algorithmsForKeyFormat(key.Type()), msg.Algo) { + return false, nil + } + if !bytes.Equal(msg.PubKey, pubKey) { return false, nil } return true, nil diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index c2dfe326..e2ae4f89 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -426,6 +426,35 @@ func (l ServerAuthError) Error() string { return "[" + strings.Join(errs, ", ") + "]" } +// ServerAuthCallbacks defines server-side authentication callbacks. +type ServerAuthCallbacks struct { + // PasswordCallback behaves like [ServerConfig.PasswordCallback]. + PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error) + + // PublicKeyCallback behaves like [ServerConfig.PublicKeyCallback]. + PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error) + + // KeyboardInteractiveCallback behaves like [ServerConfig.KeyboardInteractiveCallback]. + KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error) + + // GSSAPIWithMICConfig behaves like [ServerConfig.GSSAPIWithMICConfig]. + GSSAPIWithMICConfig *GSSAPIWithMICConfig +} + +// PartialSuccessError can be returned by any of the [ServerConfig] +// authentication callbacks to indicate to the client that authentication has +// partially succeeded, but further steps are required. +type PartialSuccessError struct { + // Next defines the authentication callbacks to apply to further steps. The + // available methods communicated to the client are based on the non-nil + // ServerAuthCallbacks fields. + Next ServerAuthCallbacks +} + +func (p *PartialSuccessError) Error() string { + return "ssh: authenticated with partial success" +} + // ErrNoAuth is the error value returned if no // authentication method has been passed yet. This happens as a normal // part of the authentication loop, since the client first tries @@ -439,8 +468,18 @@ func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, err var perms *Permissions authFailures := 0 + noneAuthCount := 0 var authErrs []error var displayedBanner bool + partialSuccessReturned := false + // Set the initial authentication callbacks from the config. They can be + // changed if a PartialSuccessError is returned. + authConfig := ServerAuthCallbacks{ + PasswordCallback: config.PasswordCallback, + PublicKeyCallback: config.PublicKeyCallback, + KeyboardInteractiveCallback: config.KeyboardInteractiveCallback, + GSSAPIWithMICConfig: config.GSSAPIWithMICConfig, + } userAuthLoop: for { @@ -471,6 +510,11 @@ userAuthLoop: return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service) } + if s.user != userAuthReq.User && partialSuccessReturned { + return nil, fmt.Errorf("ssh: client changed the user after a partial success authentication, previous user %q, current user %q", + s.user, userAuthReq.User) + } + s.user = userAuthReq.User if !displayedBanner && config.BannerCallback != nil { @@ -491,20 +535,18 @@ userAuthLoop: switch userAuthReq.Method { case "none": - if config.NoClientAuth { + noneAuthCount++ + // We don't allow none authentication after a partial success + // response. + if config.NoClientAuth && !partialSuccessReturned { if config.NoClientAuthCallback != nil { perms, authErr = config.NoClientAuthCallback(s) } else { authErr = nil } } - - // allow initial attempt of 'none' without penalty - if authFailures == 0 { - authFailures-- - } case "password": - if config.PasswordCallback == nil { + if authConfig.PasswordCallback == nil { authErr = errors.New("ssh: password auth not configured") break } @@ -518,17 +560,17 @@ userAuthLoop: return nil, parseError(msgUserAuthRequest) } - perms, authErr = config.PasswordCallback(s, password) + perms, authErr = authConfig.PasswordCallback(s, password) case "keyboard-interactive": - if config.KeyboardInteractiveCallback == nil { + if authConfig.KeyboardInteractiveCallback == nil { authErr = errors.New("ssh: keyboard-interactive auth not configured") break } prompter := &sshClientKeyboardInteractive{s} - perms, authErr = config.KeyboardInteractiveCallback(s, prompter.Challenge) + perms, authErr = authConfig.KeyboardInteractiveCallback(s, prompter.Challenge) case "publickey": - if config.PublicKeyCallback == nil { + if authConfig.PublicKeyCallback == nil { authErr = errors.New("ssh: publickey auth not configured") break } @@ -562,11 +604,18 @@ userAuthLoop: if !ok { candidate.user = s.user candidate.pubKeyData = pubKeyData - candidate.perms, candidate.result = config.PublicKeyCallback(s, pubKey) - if candidate.result == nil && candidate.perms != nil && candidate.perms.CriticalOptions != nil && candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" { - candidate.result = checkSourceAddress( + candidate.perms, candidate.result = authConfig.PublicKeyCallback(s, pubKey) + _, isPartialSuccessError := candidate.result.(*PartialSuccessError) + + if (candidate.result == nil || isPartialSuccessError) && + candidate.perms != nil && + candidate.perms.CriticalOptions != nil && + candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" { + if err := checkSourceAddress( s.RemoteAddr(), - candidate.perms.CriticalOptions[sourceAddressCriticalOption]) + candidate.perms.CriticalOptions[sourceAddressCriticalOption]); err != nil { + candidate.result = err + } } cache.add(candidate) } @@ -578,8 +627,8 @@ userAuthLoop: if len(payload) > 0 { return nil, parseError(msgUserAuthRequest) } - - if candidate.result == nil { + _, isPartialSuccessError := candidate.result.(*PartialSuccessError) + if candidate.result == nil || isPartialSuccessError { okMsg := userAuthPubKeyOkMsg{ Algo: algo, PubKey: pubKeyData, @@ -629,11 +678,11 @@ userAuthLoop: perms = candidate.perms } case "gssapi-with-mic": - if config.GSSAPIWithMICConfig == nil { + if authConfig.GSSAPIWithMICConfig == nil { authErr = errors.New("ssh: gssapi-with-mic auth not configured") break } - gssapiConfig := config.GSSAPIWithMICConfig + gssapiConfig := authConfig.GSSAPIWithMICConfig userAuthRequestGSSAPI, err := parseGSSAPIPayload(userAuthReq.Payload) if err != nil { return nil, parseError(msgUserAuthRequest) @@ -689,49 +738,70 @@ userAuthLoop: break userAuthLoop } - authFailures++ - if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries { - // If we have hit the max attempts, don't bother sending the - // final SSH_MSG_USERAUTH_FAILURE message, since there are - // no more authentication methods which can be attempted, - // and this message may cause the client to re-attempt - // authentication while we send the disconnect message. - // Continue, and trigger the disconnect at the start of - // the loop. - // - // The SSH specification is somewhat confusing about this, - // RFC 4252 Section 5.1 requires each authentication failure - // be responded to with a respective SSH_MSG_USERAUTH_FAILURE - // message, but Section 4 says the server should disconnect - // after some number of attempts, but it isn't explicit which - // message should take precedence (i.e. should there be a failure - // message than a disconnect message, or if we are going to - // disconnect, should we only send that message.) - // - // Either way, OpenSSH disconnects immediately after the last - // failed authnetication attempt, and given they are typically - // considered the golden implementation it seems reasonable - // to match that behavior. - continue + var failureMsg userAuthFailureMsg + + if partialSuccess, ok := authErr.(*PartialSuccessError); ok { + // After a partial success error we don't allow changing the user + // name and execute the NoClientAuthCallback. + partialSuccessReturned = true + + // In case a partial success is returned, the server may send + // a new set of authentication methods. + authConfig = partialSuccess.Next + + // Reset pubkey cache, as the new PublicKeyCallback might + // accept a different set of public keys. + cache = pubKeyCache{} + + // Send back a partial success message to the user. + failureMsg.PartialSuccess = true + } else { + // Allow initial attempt of 'none' without penalty. + if authFailures > 0 || userAuthReq.Method != "none" || noneAuthCount != 1 { + authFailures++ + } + if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries { + // If we have hit the max attempts, don't bother sending the + // final SSH_MSG_USERAUTH_FAILURE message, since there are + // no more authentication methods which can be attempted, + // and this message may cause the client to re-attempt + // authentication while we send the disconnect message. + // Continue, and trigger the disconnect at the start of + // the loop. + // + // The SSH specification is somewhat confusing about this, + // RFC 4252 Section 5.1 requires each authentication failure + // be responded to with a respective SSH_MSG_USERAUTH_FAILURE + // message, but Section 4 says the server should disconnect + // after some number of attempts, but it isn't explicit which + // message should take precedence (i.e. should there be a failure + // message than a disconnect message, or if we are going to + // disconnect, should we only send that message.) + // + // Either way, OpenSSH disconnects immediately after the last + // failed authentication attempt, and given they are typically + // considered the golden implementation it seems reasonable + // to match that behavior. + continue + } } - var failureMsg userAuthFailureMsg - if config.PasswordCallback != nil { + if authConfig.PasswordCallback != nil { failureMsg.Methods = append(failureMsg.Methods, "password") } - if config.PublicKeyCallback != nil { + if authConfig.PublicKeyCallback != nil { failureMsg.Methods = append(failureMsg.Methods, "publickey") } - if config.KeyboardInteractiveCallback != nil { + if authConfig.KeyboardInteractiveCallback != nil { failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive") } - if config.GSSAPIWithMICConfig != nil && config.GSSAPIWithMICConfig.Server != nil && - config.GSSAPIWithMICConfig.AllowLogin != nil { + if authConfig.GSSAPIWithMICConfig != nil && authConfig.GSSAPIWithMICConfig.Server != nil && + authConfig.GSSAPIWithMICConfig.AllowLogin != nil { failureMsg.Methods = append(failureMsg.Methods, "gssapi-with-mic") } if len(failureMsg.Methods) == 0 { - return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false") + return nil, errors.New("ssh: no authentication methods available") } if err := s.transport.writePacket(Marshal(&failureMsg)); err != nil { diff --git a/vendor/golang.org/x/net/internal/socks/client.go b/vendor/golang.org/x/net/internal/socks/client.go deleted file mode 100644 index 3d6f516a..00000000 --- a/vendor/golang.org/x/net/internal/socks/client.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socks - -import ( - "context" - "errors" - "io" - "net" - "strconv" - "time" -) - -var ( - noDeadline = time.Time{} - aLongTimeAgo = time.Unix(1, 0) -) - -func (d *Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error) { - host, port, err := splitHostPort(address) - if err != nil { - return nil, err - } - if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() { - c.SetDeadline(deadline) - defer c.SetDeadline(noDeadline) - } - if ctx != context.Background() { - errCh := make(chan error, 1) - done := make(chan struct{}) - defer func() { - close(done) - if ctxErr == nil { - ctxErr = <-errCh - } - }() - go func() { - select { - case <-ctx.Done(): - c.SetDeadline(aLongTimeAgo) - errCh <- ctx.Err() - case <-done: - errCh <- nil - } - }() - } - - b := make([]byte, 0, 6+len(host)) // the size here is just an estimate - b = append(b, Version5) - if len(d.AuthMethods) == 0 || d.Authenticate == nil { - b = append(b, 1, byte(AuthMethodNotRequired)) - } else { - ams := d.AuthMethods - if len(ams) > 255 { - return nil, errors.New("too many authentication methods") - } - b = append(b, byte(len(ams))) - for _, am := range ams { - b = append(b, byte(am)) - } - } - if _, ctxErr = c.Write(b); ctxErr != nil { - return - } - - if _, ctxErr = io.ReadFull(c, b[:2]); ctxErr != nil { - return - } - if b[0] != Version5 { - return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) - } - am := AuthMethod(b[1]) - if am == AuthMethodNoAcceptableMethods { - return nil, errors.New("no acceptable authentication methods") - } - if d.Authenticate != nil { - if ctxErr = d.Authenticate(ctx, c, am); ctxErr != nil { - return - } - } - - b = b[:0] - b = append(b, Version5, byte(d.cmd), 0) - if ip := net.ParseIP(host); ip != nil { - if ip4 := ip.To4(); ip4 != nil { - b = append(b, AddrTypeIPv4) - b = append(b, ip4...) - } else if ip6 := ip.To16(); ip6 != nil { - b = append(b, AddrTypeIPv6) - b = append(b, ip6...) - } else { - return nil, errors.New("unknown address type") - } - } else { - if len(host) > 255 { - return nil, errors.New("FQDN too long") - } - b = append(b, AddrTypeFQDN) - b = append(b, byte(len(host))) - b = append(b, host...) - } - b = append(b, byte(port>>8), byte(port)) - if _, ctxErr = c.Write(b); ctxErr != nil { - return - } - - if _, ctxErr = io.ReadFull(c, b[:4]); ctxErr != nil { - return - } - if b[0] != Version5 { - return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) - } - if cmdErr := Reply(b[1]); cmdErr != StatusSucceeded { - return nil, errors.New("unknown error " + cmdErr.String()) - } - if b[2] != 0 { - return nil, errors.New("non-zero reserved field") - } - l := 2 - var a Addr - switch b[3] { - case AddrTypeIPv4: - l += net.IPv4len - a.IP = make(net.IP, net.IPv4len) - case AddrTypeIPv6: - l += net.IPv6len - a.IP = make(net.IP, net.IPv6len) - case AddrTypeFQDN: - if _, err := io.ReadFull(c, b[:1]); err != nil { - return nil, err - } - l += int(b[0]) - default: - return nil, errors.New("unknown address type " + strconv.Itoa(int(b[3]))) - } - if cap(b) < l { - b = make([]byte, l) - } else { - b = b[:l] - } - if _, ctxErr = io.ReadFull(c, b); ctxErr != nil { - return - } - if a.IP != nil { - copy(a.IP, b) - } else { - a.Name = string(b[:len(b)-2]) - } - a.Port = int(b[len(b)-2])<<8 | int(b[len(b)-1]) - return &a, nil -} - -func splitHostPort(address string) (string, int, error) { - host, port, err := net.SplitHostPort(address) - if err != nil { - return "", 0, err - } - portnum, err := strconv.Atoi(port) - if err != nil { - return "", 0, err - } - if 1 > portnum || portnum > 0xffff { - return "", 0, errors.New("port number out of range " + port) - } - return host, portnum, nil -} diff --git a/vendor/golang.org/x/net/internal/socks/socks.go b/vendor/golang.org/x/net/internal/socks/socks.go deleted file mode 100644 index 84fcc32b..00000000 --- a/vendor/golang.org/x/net/internal/socks/socks.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package socks provides a SOCKS version 5 client implementation. -// -// SOCKS protocol version 5 is defined in RFC 1928. -// Username/Password authentication for SOCKS version 5 is defined in -// RFC 1929. -package socks - -import ( - "context" - "errors" - "io" - "net" - "strconv" -) - -// A Command represents a SOCKS command. -type Command int - -func (cmd Command) String() string { - switch cmd { - case CmdConnect: - return "socks connect" - case cmdBind: - return "socks bind" - default: - return "socks " + strconv.Itoa(int(cmd)) - } -} - -// An AuthMethod represents a SOCKS authentication method. -type AuthMethod int - -// A Reply represents a SOCKS command reply code. -type Reply int - -func (code Reply) String() string { - switch code { - case StatusSucceeded: - return "succeeded" - case 0x01: - return "general SOCKS server failure" - case 0x02: - return "connection not allowed by ruleset" - case 0x03: - return "network unreachable" - case 0x04: - return "host unreachable" - case 0x05: - return "connection refused" - case 0x06: - return "TTL expired" - case 0x07: - return "command not supported" - case 0x08: - return "address type not supported" - default: - return "unknown code: " + strconv.Itoa(int(code)) - } -} - -// Wire protocol constants. -const ( - Version5 = 0x05 - - AddrTypeIPv4 = 0x01 - AddrTypeFQDN = 0x03 - AddrTypeIPv6 = 0x04 - - CmdConnect Command = 0x01 // establishes an active-open forward proxy connection - cmdBind Command = 0x02 // establishes a passive-open forward proxy connection - - AuthMethodNotRequired AuthMethod = 0x00 // no authentication required - AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password - AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authentication methods - - StatusSucceeded Reply = 0x00 -) - -// An Addr represents a SOCKS-specific address. -// Either Name or IP is used exclusively. -type Addr struct { - Name string // fully-qualified domain name - IP net.IP - Port int -} - -func (a *Addr) Network() string { return "socks" } - -func (a *Addr) String() string { - if a == nil { - return "" - } - port := strconv.Itoa(a.Port) - if a.IP == nil { - return net.JoinHostPort(a.Name, port) - } - return net.JoinHostPort(a.IP.String(), port) -} - -// A Conn represents a forward proxy connection. -type Conn struct { - net.Conn - - boundAddr net.Addr -} - -// BoundAddr returns the address assigned by the proxy server for -// connecting to the command target address from the proxy server. -func (c *Conn) BoundAddr() net.Addr { - if c == nil { - return nil - } - return c.boundAddr -} - -// A Dialer holds SOCKS-specific options. -type Dialer struct { - cmd Command // either CmdConnect or cmdBind - proxyNetwork string // network between a proxy server and a client - proxyAddress string // proxy server address - - // ProxyDial specifies the optional dial function for - // establishing the transport connection. - ProxyDial func(context.Context, string, string) (net.Conn, error) - - // AuthMethods specifies the list of request authentication - // methods. - // If empty, SOCKS client requests only AuthMethodNotRequired. - AuthMethods []AuthMethod - - // Authenticate specifies the optional authentication - // function. It must be non-nil when AuthMethods is not empty. - // It must return an error when the authentication is failed. - Authenticate func(context.Context, io.ReadWriter, AuthMethod) error -} - -// DialContext connects to the provided address on the provided -// network. -// -// The returned error value may be a net.OpError. When the Op field of -// net.OpError contains "socks", the Source field contains a proxy -// server address and the Addr field contains a command target -// address. -// -// See func Dial of the net package of standard library for a -// description of the network and address parameters. -func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { - if err := d.validateTarget(network, address); err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - if ctx == nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} - } - var err error - var c net.Conn - if d.ProxyDial != nil { - c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress) - } else { - var dd net.Dialer - c, err = dd.DialContext(ctx, d.proxyNetwork, d.proxyAddress) - } - if err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - a, err := d.connect(ctx, c, address) - if err != nil { - c.Close() - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - return &Conn{Conn: c, boundAddr: a}, nil -} - -// DialWithConn initiates a connection from SOCKS server to the target -// network and address using the connection c that is already -// connected to the SOCKS server. -// -// It returns the connection's local address assigned by the SOCKS -// server. -func (d *Dialer) DialWithConn(ctx context.Context, c net.Conn, network, address string) (net.Addr, error) { - if err := d.validateTarget(network, address); err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - if ctx == nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} - } - a, err := d.connect(ctx, c, address) - if err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - return a, nil -} - -// Dial connects to the provided address on the provided network. -// -// Unlike DialContext, it returns a raw transport connection instead -// of a forward proxy connection. -// -// Deprecated: Use DialContext or DialWithConn instead. -func (d *Dialer) Dial(network, address string) (net.Conn, error) { - if err := d.validateTarget(network, address); err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - var err error - var c net.Conn - if d.ProxyDial != nil { - c, err = d.ProxyDial(context.Background(), d.proxyNetwork, d.proxyAddress) - } else { - c, err = net.Dial(d.proxyNetwork, d.proxyAddress) - } - if err != nil { - proxy, dst, _ := d.pathAddrs(address) - return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} - } - if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil { - c.Close() - return nil, err - } - return c, nil -} - -func (d *Dialer) validateTarget(network, address string) error { - switch network { - case "tcp", "tcp6", "tcp4": - default: - return errors.New("network not implemented") - } - switch d.cmd { - case CmdConnect, cmdBind: - default: - return errors.New("command not implemented") - } - return nil -} - -func (d *Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error) { - for i, s := range []string{d.proxyAddress, address} { - host, port, err := splitHostPort(s) - if err != nil { - return nil, nil, err - } - a := &Addr{Port: port} - a.IP = net.ParseIP(host) - if a.IP == nil { - a.Name = host - } - if i == 0 { - proxy = a - } else { - dst = a - } - } - return -} - -// NewDialer returns a new Dialer that dials through the provided -// proxy server's network and address. -func NewDialer(network, address string) *Dialer { - return &Dialer{proxyNetwork: network, proxyAddress: address, cmd: CmdConnect} -} - -const ( - authUsernamePasswordVersion = 0x01 - authStatusSucceeded = 0x00 -) - -// UsernamePassword are the credentials for the username/password -// authentication method. -type UsernamePassword struct { - Username string - Password string -} - -// Authenticate authenticates a pair of username and password with the -// proxy server. -func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth AuthMethod) error { - switch auth { - case AuthMethodNotRequired: - return nil - case AuthMethodUsernamePassword: - if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 { - return errors.New("invalid username/password") - } - b := []byte{authUsernamePasswordVersion} - b = append(b, byte(len(up.Username))) - b = append(b, up.Username...) - b = append(b, byte(len(up.Password))) - b = append(b, up.Password...) - // TODO(mikio): handle IO deadlines and cancelation if - // necessary - if _, err := rw.Write(b); err != nil { - return err - } - if _, err := io.ReadFull(rw, b[:2]); err != nil { - return err - } - if b[0] != authUsernamePasswordVersion { - return errors.New("invalid username/password version") - } - if b[1] != authStatusSucceeded { - return errors.New("username/password authentication failed") - } - return nil - } - return errors.New("unsupported authentication method " + strconv.Itoa(int(auth))) -} diff --git a/vendor/golang.org/x/net/proxy/dial.go b/vendor/golang.org/x/net/proxy/dial.go deleted file mode 100644 index 811c2e4e..00000000 --- a/vendor/golang.org/x/net/proxy/dial.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proxy - -import ( - "context" - "net" -) - -// A ContextDialer dials using a context. -type ContextDialer interface { - DialContext(ctx context.Context, network, address string) (net.Conn, error) -} - -// Dial works like DialContext on net.Dialer but using a dialer returned by FromEnvironment. -// -// The passed ctx is only used for returning the Conn, not the lifetime of the Conn. -// -// Custom dialers (registered via RegisterDialerType) that do not implement ContextDialer -// can leak a goroutine for as long as it takes the underlying Dialer implementation to timeout. -// -// A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. -func Dial(ctx context.Context, network, address string) (net.Conn, error) { - d := FromEnvironment() - if xd, ok := d.(ContextDialer); ok { - return xd.DialContext(ctx, network, address) - } - return dialContext(ctx, d, network, address) -} - -// WARNING: this can leak a goroutine for as long as the underlying Dialer implementation takes to timeout -// A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. -func dialContext(ctx context.Context, d Dialer, network, address string) (net.Conn, error) { - var ( - conn net.Conn - done = make(chan struct{}, 1) - err error - ) - go func() { - conn, err = d.Dial(network, address) - close(done) - if conn != nil && ctx.Err() != nil { - conn.Close() - } - }() - select { - case <-ctx.Done(): - err = ctx.Err() - case <-done: - } - return conn, err -} diff --git a/vendor/golang.org/x/net/proxy/direct.go b/vendor/golang.org/x/net/proxy/direct.go deleted file mode 100644 index 3d66bdef..00000000 --- a/vendor/golang.org/x/net/proxy/direct.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proxy - -import ( - "context" - "net" -) - -type direct struct{} - -// Direct implements Dialer by making network connections directly using net.Dial or net.DialContext. -var Direct = direct{} - -var ( - _ Dialer = Direct - _ ContextDialer = Direct -) - -// Dial directly invokes net.Dial with the supplied parameters. -func (direct) Dial(network, addr string) (net.Conn, error) { - return net.Dial(network, addr) -} - -// DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters. -func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { - var d net.Dialer - return d.DialContext(ctx, network, addr) -} diff --git a/vendor/golang.org/x/net/proxy/per_host.go b/vendor/golang.org/x/net/proxy/per_host.go deleted file mode 100644 index 573fe79e..00000000 --- a/vendor/golang.org/x/net/proxy/per_host.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proxy - -import ( - "context" - "net" - "strings" -) - -// A PerHost directs connections to a default Dialer unless the host name -// requested matches one of a number of exceptions. -type PerHost struct { - def, bypass Dialer - - bypassNetworks []*net.IPNet - bypassIPs []net.IP - bypassZones []string - bypassHosts []string -} - -// NewPerHost returns a PerHost Dialer that directs connections to either -// defaultDialer or bypass, depending on whether the connection matches one of -// the configured rules. -func NewPerHost(defaultDialer, bypass Dialer) *PerHost { - return &PerHost{ - def: defaultDialer, - bypass: bypass, - } -} - -// Dial connects to the address addr on the given network through either -// defaultDialer or bypass. -func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - - return p.dialerForRequest(host).Dial(network, addr) -} - -// DialContext connects to the address addr on the given network through either -// defaultDialer or bypass. -func (p *PerHost) DialContext(ctx context.Context, network, addr string) (c net.Conn, err error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - d := p.dialerForRequest(host) - if x, ok := d.(ContextDialer); ok { - return x.DialContext(ctx, network, addr) - } - return dialContext(ctx, d, network, addr) -} - -func (p *PerHost) dialerForRequest(host string) Dialer { - if ip := net.ParseIP(host); ip != nil { - for _, net := range p.bypassNetworks { - if net.Contains(ip) { - return p.bypass - } - } - for _, bypassIP := range p.bypassIPs { - if bypassIP.Equal(ip) { - return p.bypass - } - } - return p.def - } - - for _, zone := range p.bypassZones { - if strings.HasSuffix(host, zone) { - return p.bypass - } - if host == zone[1:] { - // For a zone ".example.com", we match "example.com" - // too. - return p.bypass - } - } - for _, bypassHost := range p.bypassHosts { - if bypassHost == host { - return p.bypass - } - } - return p.def -} - -// AddFromString parses a string that contains comma-separated values -// specifying hosts that should use the bypass proxy. Each value is either an -// IP address, a CIDR range, a zone (*.example.com) or a host name -// (localhost). A best effort is made to parse the string and errors are -// ignored. -func (p *PerHost) AddFromString(s string) { - hosts := strings.Split(s, ",") - for _, host := range hosts { - host = strings.TrimSpace(host) - if len(host) == 0 { - continue - } - if strings.Contains(host, "/") { - // We assume that it's a CIDR address like 127.0.0.0/8 - if _, net, err := net.ParseCIDR(host); err == nil { - p.AddNetwork(net) - } - continue - } - if ip := net.ParseIP(host); ip != nil { - p.AddIP(ip) - continue - } - if strings.HasPrefix(host, "*.") { - p.AddZone(host[1:]) - continue - } - p.AddHost(host) - } -} - -// AddIP specifies an IP address that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match an IP. -func (p *PerHost) AddIP(ip net.IP) { - p.bypassIPs = append(p.bypassIPs, ip) -} - -// AddNetwork specifies an IP range that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match. -func (p *PerHost) AddNetwork(net *net.IPNet) { - p.bypassNetworks = append(p.bypassNetworks, net) -} - -// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of -// "example.com" matches "example.com" and all of its subdomains. -func (p *PerHost) AddZone(zone string) { - if strings.HasSuffix(zone, ".") { - zone = zone[:len(zone)-1] - } - if !strings.HasPrefix(zone, ".") { - zone = "." + zone - } - p.bypassZones = append(p.bypassZones, zone) -} - -// AddHost specifies a host name that will use the bypass proxy. -func (p *PerHost) AddHost(host string) { - if strings.HasSuffix(host, ".") { - host = host[:len(host)-1] - } - p.bypassHosts = append(p.bypassHosts, host) -} diff --git a/vendor/golang.org/x/net/proxy/proxy.go b/vendor/golang.org/x/net/proxy/proxy.go deleted file mode 100644 index 9ff4b9a7..00000000 --- a/vendor/golang.org/x/net/proxy/proxy.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package proxy provides support for a variety of protocols to proxy network -// data. -package proxy // import "golang.org/x/net/proxy" - -import ( - "errors" - "net" - "net/url" - "os" - "sync" -) - -// A Dialer is a means to establish a connection. -// Custom dialers should also implement ContextDialer. -type Dialer interface { - // Dial connects to the given address via the proxy. - Dial(network, addr string) (c net.Conn, err error) -} - -// Auth contains authentication parameters that specific Dialers may require. -type Auth struct { - User, Password string -} - -// FromEnvironment returns the dialer specified by the proxy-related -// variables in the environment and makes underlying connections -// directly. -func FromEnvironment() Dialer { - return FromEnvironmentUsing(Direct) -} - -// FromEnvironmentUsing returns the dialer specify by the proxy-related -// variables in the environment and makes underlying connections -// using the provided forwarding Dialer (for instance, a *net.Dialer -// with desired configuration). -func FromEnvironmentUsing(forward Dialer) Dialer { - allProxy := allProxyEnv.Get() - if len(allProxy) == 0 { - return forward - } - - proxyURL, err := url.Parse(allProxy) - if err != nil { - return forward - } - proxy, err := FromURL(proxyURL, forward) - if err != nil { - return forward - } - - noProxy := noProxyEnv.Get() - if len(noProxy) == 0 { - return proxy - } - - perHost := NewPerHost(proxy, forward) - perHost.AddFromString(noProxy) - return perHost -} - -// proxySchemes is a map from URL schemes to a function that creates a Dialer -// from a URL with such a scheme. -var proxySchemes map[string]func(*url.URL, Dialer) (Dialer, error) - -// RegisterDialerType takes a URL scheme and a function to generate Dialers from -// a URL with that scheme and a forwarding Dialer. Registered schemes are used -// by FromURL. -func RegisterDialerType(scheme string, f func(*url.URL, Dialer) (Dialer, error)) { - if proxySchemes == nil { - proxySchemes = make(map[string]func(*url.URL, Dialer) (Dialer, error)) - } - proxySchemes[scheme] = f -} - -// FromURL returns a Dialer given a URL specification and an underlying -// Dialer for it to make network requests. -func FromURL(u *url.URL, forward Dialer) (Dialer, error) { - var auth *Auth - if u.User != nil { - auth = new(Auth) - auth.User = u.User.Username() - if p, ok := u.User.Password(); ok { - auth.Password = p - } - } - - switch u.Scheme { - case "socks5", "socks5h": - addr := u.Hostname() - port := u.Port() - if port == "" { - port = "1080" - } - return SOCKS5("tcp", net.JoinHostPort(addr, port), auth, forward) - } - - // If the scheme doesn't match any of the built-in schemes, see if it - // was registered by another package. - if proxySchemes != nil { - if f, ok := proxySchemes[u.Scheme]; ok { - return f(u, forward) - } - } - - return nil, errors.New("proxy: unknown scheme: " + u.Scheme) -} - -var ( - allProxyEnv = &envOnce{ - names: []string{"ALL_PROXY", "all_proxy"}, - } - noProxyEnv = &envOnce{ - names: []string{"NO_PROXY", "no_proxy"}, - } -) - -// envOnce looks up an environment variable (optionally by multiple -// names) once. It mitigates expensive lookups on some platforms -// (e.g. Windows). -// (Borrowed from net/http/transport.go) -type envOnce struct { - names []string - once sync.Once - val string -} - -func (e *envOnce) Get() string { - e.once.Do(e.init) - return e.val -} - -func (e *envOnce) init() { - for _, n := range e.names { - e.val = os.Getenv(n) - if e.val != "" { - return - } - } -} - -// reset is used by tests -func (e *envOnce) reset() { - e.once = sync.Once{} - e.val = "" -} diff --git a/vendor/golang.org/x/net/proxy/socks5.go b/vendor/golang.org/x/net/proxy/socks5.go deleted file mode 100644 index c91651f9..00000000 --- a/vendor/golang.org/x/net/proxy/socks5.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proxy - -import ( - "context" - "net" - - "golang.org/x/net/internal/socks" -) - -// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given -// address with an optional username and password. -// See RFC 1928 and RFC 1929. -func SOCKS5(network, address string, auth *Auth, forward Dialer) (Dialer, error) { - d := socks.NewDialer(network, address) - if forward != nil { - if f, ok := forward.(ContextDialer); ok { - d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { - return f.DialContext(ctx, network, address) - } - } else { - d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { - return dialContext(ctx, forward, network, address) - } - } - } - if auth != nil { - up := socks.UsernamePassword{ - Username: auth.User, - Password: auth.Password, - } - d.AuthMethods = []socks.AuthMethod{ - socks.AuthMethodNotRequired, - socks.AuthMethodUsernamePassword, - } - d.Authenticate = up.Authenticate - } - return d, nil -} diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 4756ad5f..8fa707aa 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -103,6 +103,7 @@ var ARM64 struct { HasASIMDDP bool // Advanced SIMD double precision instruction set HasSHA512 bool // SHA512 hardware implementation HasSVE bool // Scalable Vector Extensions + HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 _ CacheLinePad } diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index f3eb993b..0e27a21e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -28,6 +28,7 @@ func initOptions() { {Name: "sm3", Feature: &ARM64.HasSM3}, {Name: "sm4", Feature: &ARM64.HasSM4}, {Name: "sve", Feature: &ARM64.HasSVE}, + {Name: "sve2", Feature: &ARM64.HasSVE2}, {Name: "crc32", Feature: &ARM64.HasCRC32}, {Name: "atomics", Feature: &ARM64.HasATOMICS}, {Name: "asimdhp", Feature: &ARM64.HasASIMDHP}, @@ -164,6 +165,15 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { switch extractBits(pfr0, 32, 35) { case 1: ARM64.HasSVE = true + + parseARM64SVERegister(getzfr0()) + } +} + +func parseARM64SVERegister(zfr0 uint64) { + switch extractBits(zfr0, 0, 3) { + case 1: + ARM64.HasSVE2 = true } } diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s index fcb9a388..22cc9984 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -29,3 +29,11 @@ TEXT ·getpfr0(SB),NOSPLIT,$0-8 WORD $0xd5380400 MOVD R0, ret+0(FP) RET + +// func getzfr0() uint64 +TEXT ·getzfr0(SB),NOSPLIT,$0-8 + // get SVE Feature Register 0 into x0 + // mrs x0, ID_AA64ZFR0_EL1 = d5380480 + WORD $0xd5380480 + MOVD R0, ret+0(FP) + RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index a8acd3e3..6ac6e1ef 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -9,3 +9,4 @@ package cpu func getisar0() uint64 func getisar1() uint64 func getpfr0() uint64 +func getzfr0() uint64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go index a968b80f..3d386d0f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -35,6 +35,8 @@ const ( hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 + + hwcap2_SVE2 = 1 << 1 ) // linuxKernelCanEmulateCPUID reports whether we're running @@ -104,6 +106,9 @@ func doinit() { ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) + + // HWCAP2 feature bits + ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) } func isSet(hwc uint, value uint) bool { diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s index 2f67ba86..813dfad7 100644 --- a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -9,9 +9,11 @@ #define PSALAA 1208(R0) #define GTAB64(x) 80(x) #define LCA64(x) 88(x) +#define SAVSTACK_ASYNC(x) 336(x) // in the LCA #define CAA(x) 8(x) -#define EDCHPXV(x) 1016(x) // in the CAA -#define SAVSTACK_ASYNC(x) 336(x) // in the LCA +#define CEECAATHDID(x) 976(x) // in the CAA +#define EDCHPXV(x) 1016(x) // in the CAA +#define GOCB(x) 1104(x) // in the CAA // SS_*, where x=SAVSTACK_ASYNC #define SS_LE(x) 0(x) @@ -19,405 +21,362 @@ #define SS_ERRNO(x) 16(x) #define SS_ERRNOJR(x) 20(x) -#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6 +// Function Descriptor Offsets +#define __errno 0x156*16 +#define __err2ad 0x16C*16 -TEXT ·clearErrno(SB),NOSPLIT,$0-0 - BL addrerrno<>(SB) - MOVD $0, 0(R3) +// Call Instructions +#define LE_CALL BYTE $0x0D; BYTE $0x76 // BL R7, R6 +#define SVC_LOAD BYTE $0x0A; BYTE $0x08 // SVC 08 LOAD +#define SVC_DELETE BYTE $0x0A; BYTE $0x09 // SVC 09 DELETE + +DATA zosLibVec<>(SB)/8, $0 +GLOBL zosLibVec<>(SB), NOPTR, $8 + +TEXT ·initZosLibVec(SB), NOSPLIT|NOFRAME, $0-0 + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD CAA(R8), R8 + MOVD EDCHPXV(R8), R8 + MOVD R8, zosLibVec<>(SB) + RET + +TEXT ·GetZosLibVec(SB), NOSPLIT|NOFRAME, $0-0 + MOVD zosLibVec<>(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·clearErrno(SB), NOSPLIT, $0-0 + BL addrerrno<>(SB) + MOVD $0, 0(R3) RET // Returns the address of errno in R3. -TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0 +TEXT addrerrno<>(SB), NOSPLIT|NOFRAME, $0-0 // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 // Get __errno FuncDesc. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - ADD $(0x156*16), R9 - LMG 0(R9), R5, R6 + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + ADD $(__errno), R9 + LMG 0(R9), R5, R6 // Switch to saved LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) // Call __errno function. LE_CALL NOPH // Switch back to Go stack. - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. RET -TEXT ·syscall_syscall(SB),NOSPLIT,$0-56 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 +// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) +TEXT ·svcCall(SB), NOSPLIT, $0 + BL runtime·save_g(SB) // Save g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD R15, 0(R9) - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 + MOVD argv+8(FP), R1 // Move function arguments into registers + MOVD dsa+16(FP), g + MOVD fnptr+0(FP), R15 - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 + BYTE $0x0D // Branch to function + BYTE $0xEF - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) + BL runtime·load_g(SB) // Restore g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R15 - // Call function. - LE_CALL - NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+32(FP) - MOVD R0, r2+40(FP) - MOVD R0, err+48(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL addrerrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+48(FP) -done: - BL runtime·exitsyscall(SB) RET -TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56 - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 - - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 +// func svcLoad(name *byte) unsafe.Pointer +TEXT ·svcLoad(SB), NOSPLIT, $0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD $0x80000000, R1 + MOVD $0, R15 + SVC_LOAD + MOVW R15, R3 // Save return code from SVC + MOVD R2, R15 // Restore go stack pointer + CMP R3, $0 // Check SVC return code + BNE error + + MOVD $-2, R3 // Reset last bit of entry point to zero + AND R0, R3 + MOVD R3, ret+8(FP) // Return entry point returned by SVC + CMP R0, R3 // Check if last bit of entry point was set + BNE done + + MOVD R15, R2 // Save go stack pointer + MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08) + SVC_DELETE + MOVD R2, R15 // Restore go stack pointer - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) +error: + MOVD $0, ret+8(FP) // Return 0 on failure - // Call function. - LE_CALL - NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+32(FP) - MOVD R0, r2+40(FP) - MOVD R0, err+48(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL addrerrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+48(FP) done: + XOR R0, R0 // Reset r0 to 0 RET -TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 +// func svcUnload(name *byte, fnptr unsafe.Pointer) int64 +TEXT ·svcUnload(SB), NOSPLIT, $0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD fnptr+8(FP), R15 + SVC_DELETE + XOR R0, R0 // Reset r0 to 0 + MOVD R15, R1 // Save SVC return code + MOVD R2, R15 // Restore go stack pointer + MOVD R1, ret+16(FP) // Return SVC return code + RET +// func gettid() uint64 +TEXT ·gettid(SB), NOSPLIT, $0 // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 + // Get CEECAATHDID + MOVD CAA(R8), R9 + MOVD CEECAATHDID(R9), R9 + MOVD R9, ret+0(FP) - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) - - // Fill in parameter list. - MOVD a4+32(FP), R12 - MOVD R12, (2176+24)(R4) - MOVD a5+40(FP), R12 - MOVD R12, (2176+32)(R4) - MOVD a6+48(FP), R12 - MOVD R12, (2176+40)(R4) - - // Call function. - LE_CALL - NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+56(FP) - MOVD R0, r2+64(FP) - MOVD R0, err+72(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL addrerrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+72(FP) -done: - BL runtime·exitsyscall(SB) RET -TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80 - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 - - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 +// +// Call LE function, if the return is -1 +// errno and errno2 is retrieved +// +TEXT ·CallLeFuncWithErr(SB), NOSPLIT, $0 + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD CAA(R8), R9 + MOVD g, GOCB(R9) // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) - - // Fill in parameter list. - MOVD a4+32(FP), R12 - MOVD R12, (2176+24)(R4) - MOVD a5+40(FP), R12 - MOVD R12, (2176+32)(R4) - MOVD a6+48(FP), R12 - MOVD R12, (2176+40)(R4) - - // Call function. - LE_CALL + MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address + MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer + + MOVD parms_base+8(FP), R7 // R7 -> argument array + MOVD parms_len+16(FP), R8 // R8 number of arguments + + // arg 1 ---> R1 + CMP R8, $0 + BEQ docall + SUB $1, R8 + MOVD 0(R7), R1 + + // arg 2 ---> R2 + CMP R8, $0 + BEQ docall + SUB $1, R8 + ADD $8, R7 + MOVD 0(R7), R2 + + // arg 3 --> R3 + CMP R8, $0 + BEQ docall + SUB $1, R8 + ADD $8, R7 + MOVD 0(R7), R3 + + CMP R8, $0 + BEQ docall + MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument + +repeat: + ADD $8, R7 + MOVD 0(R7), R0 // advance arg pointer by 8 byte + ADD $8, R6 // advance LE argument address by 8 byte + MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame + SUB $1, R8 + CMP R8, $0 + BNE repeat + +docall: + MOVD funcdesc+0(FP), R8 // R8-> function descriptor + LMG 0(R8), R5, R6 + MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC + LE_CALL // balr R7, R6 (return #1) + NOPH + MOVD R3, ret+32(FP) + CMP R3, $-1 // compare result to -1 + BNE done + + // retrieve errno and errno2 + MOVD zosLibVec<>(SB), R8 + ADD $(__errno), R8 + LMG 0(R8), R5, R6 + LE_CALL // balr R7, R6 __errno (return #3) NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+56(FP) - MOVD R0, r2+64(FP) - MOVD R0, err+72(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL ·rrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+72(FP) + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) + MOVD zosLibVec<>(SB), R8 + ADD $(__err2ad), R8 + LMG 0(R8), R5, R6 + LE_CALL // balr R7, R6 __err2ad (return #2) + NOPH + MOVW (R3), R2 // retrieve errno2 + MOVD R2, errno2+40(FP) // store in return area + done: + MOVD R4, 0(R9) // Save stack pointer. RET -TEXT ·syscall_syscall9(SB),NOSPLIT,$0 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 - - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 +// +// Call LE function, if the return is 0 +// errno and errno2 is retrieved +// +TEXT ·CallLeFuncWithPtrReturn(SB), NOSPLIT, $0 + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD CAA(R8), R9 + MOVD g, GOCB(R9) // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) - - // Fill in parameter list. - MOVD a4+32(FP), R12 - MOVD R12, (2176+24)(R4) - MOVD a5+40(FP), R12 - MOVD R12, (2176+32)(R4) - MOVD a6+48(FP), R12 - MOVD R12, (2176+40)(R4) - MOVD a7+56(FP), R12 - MOVD R12, (2176+48)(R4) - MOVD a8+64(FP), R12 - MOVD R12, (2176+56)(R4) - MOVD a9+72(FP), R12 - MOVD R12, (2176+64)(R4) - - // Call function. - LE_CALL + MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address + MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer + + MOVD parms_base+8(FP), R7 // R7 -> argument array + MOVD parms_len+16(FP), R8 // R8 number of arguments + + // arg 1 ---> R1 + CMP R8, $0 + BEQ docall + SUB $1, R8 + MOVD 0(R7), R1 + + // arg 2 ---> R2 + CMP R8, $0 + BEQ docall + SUB $1, R8 + ADD $8, R7 + MOVD 0(R7), R2 + + // arg 3 --> R3 + CMP R8, $0 + BEQ docall + SUB $1, R8 + ADD $8, R7 + MOVD 0(R7), R3 + + CMP R8, $0 + BEQ docall + MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument + +repeat: + ADD $8, R7 + MOVD 0(R7), R0 // advance arg pointer by 8 byte + ADD $8, R6 // advance LE argument address by 8 byte + MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame + SUB $1, R8 + CMP R8, $0 + BNE repeat + +docall: + MOVD funcdesc+0(FP), R8 // R8-> function descriptor + LMG 0(R8), R5, R6 + MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC + LE_CALL // balr R7, R6 (return #1) NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+80(FP) - MOVD R0, r2+88(FP) - MOVD R0, err+96(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL addrerrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+96(FP) -done: - BL runtime·exitsyscall(SB) - RET - -TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0 - MOVD a1+8(FP), R1 - MOVD a2+16(FP), R2 - MOVD a3+24(FP), R3 - - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - - // Get function. - MOVD CAA(R8), R9 - MOVD EDCHPXV(R9), R9 - MOVD trap+0(FP), R5 - SLD $4, R5 - ADD R5, R9 - LMG 0(R9), R5, R6 - - // Restore LE stack. - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R4 - MOVD $0, 0(R9) - - // Fill in parameter list. - MOVD a4+32(FP), R12 - MOVD R12, (2176+24)(R4) - MOVD a5+40(FP), R12 - MOVD R12, (2176+32)(R4) - MOVD a6+48(FP), R12 - MOVD R12, (2176+40)(R4) - MOVD a7+56(FP), R12 - MOVD R12, (2176+48)(R4) - MOVD a8+64(FP), R12 - MOVD R12, (2176+56)(R4) - MOVD a9+72(FP), R12 - MOVD R12, (2176+64)(R4) - - // Call function. - LE_CALL + MOVD R3, ret+32(FP) + CMP R3, $0 // compare result to 0 + BNE done + + // retrieve errno and errno2 + MOVD zosLibVec<>(SB), R8 + ADD $(__errno), R8 + LMG 0(R8), R5, R6 + LE_CALL // balr R7, R6 __errno (return #3) NOPH - XOR R0, R0 // Restore R0 to $0. - MOVD R4, 0(R9) // Save stack pointer. - - MOVD R3, r1+80(FP) - MOVD R0, r2+88(FP) - MOVD R0, err+96(FP) - MOVW R3, R4 - CMP R4, $-1 - BNE done - BL addrerrno<>(SB) - MOVWZ 0(R3), R3 - MOVD R3, err+96(FP) -done: - RET - -// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) -TEXT ·svcCall(SB),NOSPLIT,$0 - BL runtime·save_g(SB) // Save g and stack pointer - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD R15, 0(R9) - - MOVD argv+8(FP), R1 // Move function arguments into registers - MOVD dsa+16(FP), g - MOVD fnptr+0(FP), R15 - - BYTE $0x0D // Branch to function - BYTE $0xEF - - BL runtime·load_g(SB) // Restore g and stack pointer - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - MOVD SAVSTACK_ASYNC(R8), R9 - MOVD 0(R9), R15 - - RET - -// func svcLoad(name *byte) unsafe.Pointer -TEXT ·svcLoad(SB),NOSPLIT,$0 - MOVD R15, R2 // Save go stack pointer - MOVD name+0(FP), R0 // Move SVC args into registers - MOVD $0x80000000, R1 - MOVD $0, R15 - BYTE $0x0A // SVC 08 LOAD - BYTE $0x08 - MOVW R15, R3 // Save return code from SVC - MOVD R2, R15 // Restore go stack pointer - CMP R3, $0 // Check SVC return code - BNE error - - MOVD $-2, R3 // Reset last bit of entry point to zero - AND R0, R3 - MOVD R3, addr+8(FP) // Return entry point returned by SVC - CMP R0, R3 // Check if last bit of entry point was set - BNE done - - MOVD R15, R2 // Save go stack pointer - MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08) - BYTE $0x0A // SVC 09 DELETE - BYTE $0x09 - MOVD R2, R15 // Restore go stack pointer + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) + MOVD zosLibVec<>(SB), R8 + ADD $(__err2ad), R8 + LMG 0(R8), R5, R6 + LE_CALL // balr R7, R6 __err2ad (return #2) + NOPH + MOVW (R3), R2 // retrieve errno2 + MOVD R2, errno2+40(FP) // store in return area + XOR R2, R2 + MOVWZ R2, (R3) // clear errno2 -error: - MOVD $0, addr+8(FP) // Return 0 on failure done: - XOR R0, R0 // Reset r0 to 0 + MOVD R4, 0(R9) // Save stack pointer. RET -// func svcUnload(name *byte, fnptr unsafe.Pointer) int64 -TEXT ·svcUnload(SB),NOSPLIT,$0 - MOVD R15, R2 // Save go stack pointer - MOVD name+0(FP), R0 // Move SVC args into registers - MOVD addr+8(FP), R15 - BYTE $0x0A // SVC 09 - BYTE $0x09 - XOR R0, R0 // Reset r0 to 0 - MOVD R15, R1 // Save SVC return code - MOVD R2, R15 // Restore go stack pointer - MOVD R1, rc+0(FP) // Return SVC return code +// +// function to test if a pointer can be safely dereferenced (content read) +// return 0 for succces +// +TEXT ·ptrtest(SB), NOSPLIT, $0-16 + MOVD arg+0(FP), R10 // test pointer in R10 + + // set up R2 to point to CEECAADMC + BYTE $0xE3; BYTE $0x20; BYTE $0x04; BYTE $0xB8; BYTE $0x00; BYTE $0x17 // llgt 2,1208 + BYTE $0xB9; BYTE $0x17; BYTE $0x00; BYTE $0x22 // llgtr 2,2 + BYTE $0xA5; BYTE $0x26; BYTE $0x7F; BYTE $0xFF // nilh 2,32767 + BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x58; BYTE $0x00; BYTE $0x04 // lg 2,88(2) + BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x08; BYTE $0x00; BYTE $0x04 // lg 2,8(2) + BYTE $0x41; BYTE $0x22; BYTE $0x03; BYTE $0x68 // la 2,872(2) + + // set up R5 to point to the "shunt" path which set 1 to R3 (failure) + BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x33 // xgr 3,3 + BYTE $0xA7; BYTE $0x55; BYTE $0x00; BYTE $0x04 // bras 5,lbl1 + BYTE $0xA7; BYTE $0x39; BYTE $0x00; BYTE $0x01 // lghi 3,1 + + // if r3 is not zero (failed) then branch to finish + BYTE $0xB9; BYTE $0x02; BYTE $0x00; BYTE $0x33 // lbl1 ltgr 3,3 + BYTE $0xA7; BYTE $0x74; BYTE $0x00; BYTE $0x08 // brc b'0111',lbl2 + + // stomic store shunt address in R5 into CEECAADMC + BYTE $0xE3; BYTE $0x52; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 5,0(2) + + // now try reading from the test pointer in R10, if it fails it branches to the "lghi" instruction above + BYTE $0xE3; BYTE $0x9A; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x04 // lg 9,0(10) + + // finish here, restore 0 into CEECAADMC + BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x99 // lbl2 xgr 9,9 + BYTE $0xE3; BYTE $0x92; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 9,0(2) + MOVD R3, ret+8(FP) // result in R3 RET -// func gettid() uint64 -TEXT ·gettid(SB), NOSPLIT, $0 - // Get library control area (LCA). - MOVW PSALAA, R8 - MOVD LCA64(R8), R8 - - // Get CEECAATHDID - MOVD CAA(R8), R9 - MOVD 0x3D0(R9), R9 - MOVD R9, ret+0(FP) - +// +// function to test if a untptr can be loaded from a pointer +// return 1: the 8-byte content +// 2: 0 for success, 1 for failure +// +// func safeload(ptr uintptr) ( value uintptr, error uintptr) +TEXT ·safeload(SB), NOSPLIT, $0-24 + MOVD ptr+0(FP), R10 // test pointer in R10 + MOVD $0x0, R6 + BYTE $0xE3; BYTE $0x20; BYTE $0x04; BYTE $0xB8; BYTE $0x00; BYTE $0x17 // llgt 2,1208 + BYTE $0xB9; BYTE $0x17; BYTE $0x00; BYTE $0x22 // llgtr 2,2 + BYTE $0xA5; BYTE $0x26; BYTE $0x7F; BYTE $0xFF // nilh 2,32767 + BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x58; BYTE $0x00; BYTE $0x04 // lg 2,88(2) + BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x08; BYTE $0x00; BYTE $0x04 // lg 2,8(2) + BYTE $0x41; BYTE $0x22; BYTE $0x03; BYTE $0x68 // la 2,872(2) + BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x33 // xgr 3,3 + BYTE $0xA7; BYTE $0x55; BYTE $0x00; BYTE $0x04 // bras 5,lbl1 + BYTE $0xA7; BYTE $0x39; BYTE $0x00; BYTE $0x01 // lghi 3,1 + BYTE $0xB9; BYTE $0x02; BYTE $0x00; BYTE $0x33 // lbl1 ltgr 3,3 + BYTE $0xA7; BYTE $0x74; BYTE $0x00; BYTE $0x08 // brc b'0111',lbl2 + BYTE $0xE3; BYTE $0x52; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 5,0(2) + BYTE $0xE3; BYTE $0x6A; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x04 // lg 6,0(10) + BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x99 // lbl2 xgr 9,9 + BYTE $0xE3; BYTE $0x92; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 9,0(2) + MOVD R6, value+8(FP) // result in R6 + MOVD R3, error+16(FP) // error in R3 RET diff --git a/vendor/golang.org/x/sys/unix/bpxsvc_zos.go b/vendor/golang.org/x/sys/unix/bpxsvc_zos.go new file mode 100644 index 00000000..39d647d8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/bpxsvc_zos.go @@ -0,0 +1,657 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos + +package unix + +import ( + "bytes" + "fmt" + "unsafe" +) + +//go:noescape +func bpxcall(plist []unsafe.Pointer, bpx_offset int64) + +//go:noescape +func A2e([]byte) + +//go:noescape +func E2a([]byte) + +const ( + BPX4STA = 192 // stat + BPX4FST = 104 // fstat + BPX4LST = 132 // lstat + BPX4OPN = 156 // open + BPX4CLO = 72 // close + BPX4CHR = 500 // chattr + BPX4FCR = 504 // fchattr + BPX4LCR = 1180 // lchattr + BPX4CTW = 492 // cond_timed_wait + BPX4GTH = 1056 // __getthent + BPX4PTQ = 412 // pthread_quiesc + BPX4PTR = 320 // ptrace +) + +const ( + //options + //byte1 + BPX_OPNFHIGH = 0x80 + //byte2 + BPX_OPNFEXEC = 0x80 + //byte3 + BPX_O_NOLARGEFILE = 0x08 + BPX_O_LARGEFILE = 0x04 + BPX_O_ASYNCSIG = 0x02 + BPX_O_SYNC = 0x01 + //byte4 + BPX_O_CREXCL = 0xc0 + BPX_O_CREAT = 0x80 + BPX_O_EXCL = 0x40 + BPX_O_NOCTTY = 0x20 + BPX_O_TRUNC = 0x10 + BPX_O_APPEND = 0x08 + BPX_O_NONBLOCK = 0x04 + BPX_FNDELAY = 0x04 + BPX_O_RDWR = 0x03 + BPX_O_RDONLY = 0x02 + BPX_O_WRONLY = 0x01 + BPX_O_ACCMODE = 0x03 + BPX_O_GETFL = 0x0f + + //mode + // byte1 (file type) + BPX_FT_DIR = 1 + BPX_FT_CHARSPEC = 2 + BPX_FT_REGFILE = 3 + BPX_FT_FIFO = 4 + BPX_FT_SYMLINK = 5 + BPX_FT_SOCKET = 6 + //byte3 + BPX_S_ISUID = 0x08 + BPX_S_ISGID = 0x04 + BPX_S_ISVTX = 0x02 + BPX_S_IRWXU1 = 0x01 + BPX_S_IRUSR = 0x01 + //byte4 + BPX_S_IRWXU2 = 0xc0 + BPX_S_IWUSR = 0x80 + BPX_S_IXUSR = 0x40 + BPX_S_IRWXG = 0x38 + BPX_S_IRGRP = 0x20 + BPX_S_IWGRP = 0x10 + BPX_S_IXGRP = 0x08 + BPX_S_IRWXOX = 0x07 + BPX_S_IROTH = 0x04 + BPX_S_IWOTH = 0x02 + BPX_S_IXOTH = 0x01 + + CW_INTRPT = 1 + CW_CONDVAR = 32 + CW_TIMEOUT = 64 + + PGTHA_NEXT = 2 + PGTHA_CURRENT = 1 + PGTHA_FIRST = 0 + PGTHA_LAST = 3 + PGTHA_PROCESS = 0x80 + PGTHA_CONTTY = 0x40 + PGTHA_PATH = 0x20 + PGTHA_COMMAND = 0x10 + PGTHA_FILEDATA = 0x08 + PGTHA_THREAD = 0x04 + PGTHA_PTAG = 0x02 + PGTHA_COMMANDLONG = 0x01 + PGTHA_THREADFAST = 0x80 + PGTHA_FILEPATH = 0x40 + PGTHA_THDSIGMASK = 0x20 + // thread quiece mode + QUIESCE_TERM int32 = 1 + QUIESCE_FORCE int32 = 2 + QUIESCE_QUERY int32 = 3 + QUIESCE_FREEZE int32 = 4 + QUIESCE_UNFREEZE int32 = 5 + FREEZE_THIS_THREAD int32 = 6 + FREEZE_EXIT int32 = 8 + QUIESCE_SRB int32 = 9 +) + +type Pgtha struct { + Pid uint32 // 0 + Tid0 uint32 // 4 + Tid1 uint32 + Accesspid byte // C + Accesstid byte // D + Accessasid uint16 // E + Loginname [8]byte // 10 + Flag1 byte // 18 + Flag1b2 byte // 19 +} + +type Bpxystat_t struct { // DSECT BPXYSTAT + St_id [4]uint8 // 0 + St_length uint16 // 0x4 + St_version uint16 // 0x6 + St_mode uint32 // 0x8 + St_ino uint32 // 0xc + St_dev uint32 // 0x10 + St_nlink uint32 // 0x14 + St_uid uint32 // 0x18 + St_gid uint32 // 0x1c + St_size uint64 // 0x20 + St_atime uint32 // 0x28 + St_mtime uint32 // 0x2c + St_ctime uint32 // 0x30 + St_rdev uint32 // 0x34 + St_auditoraudit uint32 // 0x38 + St_useraudit uint32 // 0x3c + St_blksize uint32 // 0x40 + St_createtime uint32 // 0x44 + St_auditid [4]uint32 // 0x48 + St_res01 uint32 // 0x58 + Ft_ccsid uint16 // 0x5c + Ft_flags uint16 // 0x5e + St_res01a [2]uint32 // 0x60 + St_res02 uint32 // 0x68 + St_blocks uint32 // 0x6c + St_opaque [3]uint8 // 0x70 + St_visible uint8 // 0x73 + St_reftime uint32 // 0x74 + St_fid uint64 // 0x78 + St_filefmt uint8 // 0x80 + St_fspflag2 uint8 // 0x81 + St_res03 [2]uint8 // 0x82 + St_ctimemsec uint32 // 0x84 + St_seclabel [8]uint8 // 0x88 + St_res04 [4]uint8 // 0x90 + // end of version 1 + _ uint32 // 0x94 + St_atime64 uint64 // 0x98 + St_mtime64 uint64 // 0xa0 + St_ctime64 uint64 // 0xa8 + St_createtime64 uint64 // 0xb0 + St_reftime64 uint64 // 0xb8 + _ uint64 // 0xc0 + St_res05 [16]uint8 // 0xc8 + // end of version 2 +} + +type BpxFilestatus struct { + Oflag1 byte + Oflag2 byte + Oflag3 byte + Oflag4 byte +} + +type BpxMode struct { + Ftype byte + Mode1 byte + Mode2 byte + Mode3 byte +} + +// Thr attribute structure for extended attributes +type Bpxyatt_t struct { // DSECT BPXYATT + Att_id [4]uint8 + Att_version uint16 + Att_res01 [2]uint8 + Att_setflags1 uint8 + Att_setflags2 uint8 + Att_setflags3 uint8 + Att_setflags4 uint8 + Att_mode uint32 + Att_uid uint32 + Att_gid uint32 + Att_opaquemask [3]uint8 + Att_visblmaskres uint8 + Att_opaque [3]uint8 + Att_visibleres uint8 + Att_size_h uint32 + Att_size_l uint32 + Att_atime uint32 + Att_mtime uint32 + Att_auditoraudit uint32 + Att_useraudit uint32 + Att_ctime uint32 + Att_reftime uint32 + // end of version 1 + Att_filefmt uint8 + Att_res02 [3]uint8 + Att_filetag uint32 + Att_res03 [8]uint8 + // end of version 2 + Att_atime64 uint64 + Att_mtime64 uint64 + Att_ctime64 uint64 + Att_reftime64 uint64 + Att_seclabel [8]uint8 + Att_ver3res02 [8]uint8 + // end of version 3 +} + +func BpxOpen(name string, options *BpxFilestatus, mode *BpxMode) (rv int32, rc int32, rn int32) { + if len(name) < 1024 { + var namebuf [1024]byte + sz := int32(copy(namebuf[:], name)) + A2e(namebuf[:sz]) + var parms [7]unsafe.Pointer + parms[0] = unsafe.Pointer(&sz) + parms[1] = unsafe.Pointer(&namebuf[0]) + parms[2] = unsafe.Pointer(options) + parms[3] = unsafe.Pointer(mode) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4OPN) + return rv, rc, rn + } + return -1, -1, -1 +} + +func BpxClose(fd int32) (rv int32, rc int32, rn int32) { + var parms [4]unsafe.Pointer + parms[0] = unsafe.Pointer(&fd) + parms[1] = unsafe.Pointer(&rv) + parms[2] = unsafe.Pointer(&rc) + parms[3] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4CLO) + return rv, rc, rn +} + +func BpxFileFStat(fd int32, st *Bpxystat_t) (rv int32, rc int32, rn int32) { + st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3} + st.St_version = 2 + stat_sz := uint32(unsafe.Sizeof(*st)) + var parms [6]unsafe.Pointer + parms[0] = unsafe.Pointer(&fd) + parms[1] = unsafe.Pointer(&stat_sz) + parms[2] = unsafe.Pointer(st) + parms[3] = unsafe.Pointer(&rv) + parms[4] = unsafe.Pointer(&rc) + parms[5] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4FST) + return rv, rc, rn +} + +func BpxFileStat(name string, st *Bpxystat_t) (rv int32, rc int32, rn int32) { + if len(name) < 1024 { + var namebuf [1024]byte + sz := int32(copy(namebuf[:], name)) + A2e(namebuf[:sz]) + st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3} + st.St_version = 2 + stat_sz := uint32(unsafe.Sizeof(*st)) + var parms [7]unsafe.Pointer + parms[0] = unsafe.Pointer(&sz) + parms[1] = unsafe.Pointer(&namebuf[0]) + parms[2] = unsafe.Pointer(&stat_sz) + parms[3] = unsafe.Pointer(st) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4STA) + return rv, rc, rn + } + return -1, -1, -1 +} + +func BpxFileLStat(name string, st *Bpxystat_t) (rv int32, rc int32, rn int32) { + if len(name) < 1024 { + var namebuf [1024]byte + sz := int32(copy(namebuf[:], name)) + A2e(namebuf[:sz]) + st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3} + st.St_version = 2 + stat_sz := uint32(unsafe.Sizeof(*st)) + var parms [7]unsafe.Pointer + parms[0] = unsafe.Pointer(&sz) + parms[1] = unsafe.Pointer(&namebuf[0]) + parms[2] = unsafe.Pointer(&stat_sz) + parms[3] = unsafe.Pointer(st) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4LST) + return rv, rc, rn + } + return -1, -1, -1 +} + +func BpxChattr(path string, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) { + if len(path) >= 1024 { + return -1, -1, -1 + } + var namebuf [1024]byte + sz := int32(copy(namebuf[:], path)) + A2e(namebuf[:sz]) + attr_sz := uint32(unsafe.Sizeof(*attr)) + var parms [7]unsafe.Pointer + parms[0] = unsafe.Pointer(&sz) + parms[1] = unsafe.Pointer(&namebuf[0]) + parms[2] = unsafe.Pointer(&attr_sz) + parms[3] = unsafe.Pointer(attr) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4CHR) + return rv, rc, rn +} + +func BpxLchattr(path string, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) { + if len(path) >= 1024 { + return -1, -1, -1 + } + var namebuf [1024]byte + sz := int32(copy(namebuf[:], path)) + A2e(namebuf[:sz]) + attr_sz := uint32(unsafe.Sizeof(*attr)) + var parms [7]unsafe.Pointer + parms[0] = unsafe.Pointer(&sz) + parms[1] = unsafe.Pointer(&namebuf[0]) + parms[2] = unsafe.Pointer(&attr_sz) + parms[3] = unsafe.Pointer(attr) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4LCR) + return rv, rc, rn +} + +func BpxFchattr(fd int32, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) { + attr_sz := uint32(unsafe.Sizeof(*attr)) + var parms [6]unsafe.Pointer + parms[0] = unsafe.Pointer(&fd) + parms[1] = unsafe.Pointer(&attr_sz) + parms[2] = unsafe.Pointer(attr) + parms[3] = unsafe.Pointer(&rv) + parms[4] = unsafe.Pointer(&rc) + parms[5] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4FCR) + return rv, rc, rn +} + +func BpxCondTimedWait(sec uint32, nsec uint32, events uint32, secrem *uint32, nsecrem *uint32) (rv int32, rc int32, rn int32) { + var parms [8]unsafe.Pointer + parms[0] = unsafe.Pointer(&sec) + parms[1] = unsafe.Pointer(&nsec) + parms[2] = unsafe.Pointer(&events) + parms[3] = unsafe.Pointer(secrem) + parms[4] = unsafe.Pointer(nsecrem) + parms[5] = unsafe.Pointer(&rv) + parms[6] = unsafe.Pointer(&rc) + parms[7] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4CTW) + return rv, rc, rn +} +func BpxGetthent(in *Pgtha, outlen *uint32, out unsafe.Pointer) (rv int32, rc int32, rn int32) { + var parms [7]unsafe.Pointer + inlen := uint32(26) // nothing else will work. Go says Pgtha is 28-byte because of alignment, but Pgtha is "packed" and must be 26-byte + parms[0] = unsafe.Pointer(&inlen) + parms[1] = unsafe.Pointer(&in) + parms[2] = unsafe.Pointer(outlen) + parms[3] = unsafe.Pointer(&out) + parms[4] = unsafe.Pointer(&rv) + parms[5] = unsafe.Pointer(&rc) + parms[6] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4GTH) + return rv, rc, rn +} +func ZosJobname() (jobname string, err error) { + var pgtha Pgtha + pgtha.Pid = uint32(Getpid()) + pgtha.Accesspid = PGTHA_CURRENT + pgtha.Flag1 = PGTHA_PROCESS + var out [256]byte + var outlen uint32 + outlen = 256 + rv, rc, rn := BpxGetthent(&pgtha, &outlen, unsafe.Pointer(&out[0])) + if rv == 0 { + gthc := []byte{0x87, 0xa3, 0x88, 0x83} // 'gthc' in ebcdic + ix := bytes.Index(out[:], gthc) + if ix == -1 { + err = fmt.Errorf("BPX4GTH: gthc return data not found") + return + } + jn := out[ix+80 : ix+88] // we didn't declare Pgthc, but jobname is 8-byte at offset 80 + E2a(jn) + jobname = string(bytes.TrimRight(jn, " ")) + + } else { + err = fmt.Errorf("BPX4GTH: rc=%d errno=%d reason=code=0x%x", rv, rc, rn) + } + return +} +func Bpx4ptq(code int32, data string) (rv int32, rc int32, rn int32) { + var userdata [8]byte + var parms [5]unsafe.Pointer + copy(userdata[:], data+" ") + A2e(userdata[:]) + parms[0] = unsafe.Pointer(&code) + parms[1] = unsafe.Pointer(&userdata[0]) + parms[2] = unsafe.Pointer(&rv) + parms[3] = unsafe.Pointer(&rc) + parms[4] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4PTQ) + return rv, rc, rn +} + +const ( + PT_TRACE_ME = 0 // Debug this process + PT_READ_I = 1 // Read a full word + PT_READ_D = 2 // Read a full word + PT_READ_U = 3 // Read control info + PT_WRITE_I = 4 //Write a full word + PT_WRITE_D = 5 //Write a full word + PT_CONTINUE = 7 //Continue the process + PT_KILL = 8 //Terminate the process + PT_READ_GPR = 11 // Read GPR, CR, PSW + PT_READ_FPR = 12 // Read FPR + PT_READ_VR = 13 // Read VR + PT_WRITE_GPR = 14 // Write GPR, CR, PSW + PT_WRITE_FPR = 15 // Write FPR + PT_WRITE_VR = 16 // Write VR + PT_READ_BLOCK = 17 // Read storage + PT_WRITE_BLOCK = 19 // Write storage + PT_READ_GPRH = 20 // Read GPRH + PT_WRITE_GPRH = 21 // Write GPRH + PT_REGHSET = 22 // Read all GPRHs + PT_ATTACH = 30 // Attach to a process + PT_DETACH = 31 // Detach from a process + PT_REGSET = 32 // Read all GPRs + PT_REATTACH = 33 // Reattach to a process + PT_LDINFO = 34 // Read loader info + PT_MULTI = 35 // Multi process mode + PT_LD64INFO = 36 // RMODE64 Info Area + PT_BLOCKREQ = 40 // Block request + PT_THREAD_INFO = 60 // Read thread info + PT_THREAD_MODIFY = 61 + PT_THREAD_READ_FOCUS = 62 + PT_THREAD_WRITE_FOCUS = 63 + PT_THREAD_HOLD = 64 + PT_THREAD_SIGNAL = 65 + PT_EXPLAIN = 66 + PT_EVENTS = 67 + PT_THREAD_INFO_EXTENDED = 68 + PT_REATTACH2 = 71 + PT_CAPTURE = 72 + PT_UNCAPTURE = 73 + PT_GET_THREAD_TCB = 74 + PT_GET_ALET = 75 + PT_SWAPIN = 76 + PT_EXTENDED_EVENT = 98 + PT_RECOVER = 99 // Debug a program check + PT_GPR0 = 0 // General purpose register 0 + PT_GPR1 = 1 // General purpose register 1 + PT_GPR2 = 2 // General purpose register 2 + PT_GPR3 = 3 // General purpose register 3 + PT_GPR4 = 4 // General purpose register 4 + PT_GPR5 = 5 // General purpose register 5 + PT_GPR6 = 6 // General purpose register 6 + PT_GPR7 = 7 // General purpose register 7 + PT_GPR8 = 8 // General purpose register 8 + PT_GPR9 = 9 // General purpose register 9 + PT_GPR10 = 10 // General purpose register 10 + PT_GPR11 = 11 // General purpose register 11 + PT_GPR12 = 12 // General purpose register 12 + PT_GPR13 = 13 // General purpose register 13 + PT_GPR14 = 14 // General purpose register 14 + PT_GPR15 = 15 // General purpose register 15 + PT_FPR0 = 16 // Floating point register 0 + PT_FPR1 = 17 // Floating point register 1 + PT_FPR2 = 18 // Floating point register 2 + PT_FPR3 = 19 // Floating point register 3 + PT_FPR4 = 20 // Floating point register 4 + PT_FPR5 = 21 // Floating point register 5 + PT_FPR6 = 22 // Floating point register 6 + PT_FPR7 = 23 // Floating point register 7 + PT_FPR8 = 24 // Floating point register 8 + PT_FPR9 = 25 // Floating point register 9 + PT_FPR10 = 26 // Floating point register 10 + PT_FPR11 = 27 // Floating point register 11 + PT_FPR12 = 28 // Floating point register 12 + PT_FPR13 = 29 // Floating point register 13 + PT_FPR14 = 30 // Floating point register 14 + PT_FPR15 = 31 // Floating point register 15 + PT_FPC = 32 // Floating point control register + PT_PSW = 40 // PSW + PT_PSW0 = 40 // Left half of the PSW + PT_PSW1 = 41 // Right half of the PSW + PT_CR0 = 42 // Control register 0 + PT_CR1 = 43 // Control register 1 + PT_CR2 = 44 // Control register 2 + PT_CR3 = 45 // Control register 3 + PT_CR4 = 46 // Control register 4 + PT_CR5 = 47 // Control register 5 + PT_CR6 = 48 // Control register 6 + PT_CR7 = 49 // Control register 7 + PT_CR8 = 50 // Control register 8 + PT_CR9 = 51 // Control register 9 + PT_CR10 = 52 // Control register 10 + PT_CR11 = 53 // Control register 11 + PT_CR12 = 54 // Control register 12 + PT_CR13 = 55 // Control register 13 + PT_CR14 = 56 // Control register 14 + PT_CR15 = 57 // Control register 15 + PT_GPRH0 = 58 // GP High register 0 + PT_GPRH1 = 59 // GP High register 1 + PT_GPRH2 = 60 // GP High register 2 + PT_GPRH3 = 61 // GP High register 3 + PT_GPRH4 = 62 // GP High register 4 + PT_GPRH5 = 63 // GP High register 5 + PT_GPRH6 = 64 // GP High register 6 + PT_GPRH7 = 65 // GP High register 7 + PT_GPRH8 = 66 // GP High register 8 + PT_GPRH9 = 67 // GP High register 9 + PT_GPRH10 = 68 // GP High register 10 + PT_GPRH11 = 69 // GP High register 11 + PT_GPRH12 = 70 // GP High register 12 + PT_GPRH13 = 71 // GP High register 13 + PT_GPRH14 = 72 // GP High register 14 + PT_GPRH15 = 73 // GP High register 15 + PT_VR0 = 74 // Vector register 0 + PT_VR1 = 75 // Vector register 1 + PT_VR2 = 76 // Vector register 2 + PT_VR3 = 77 // Vector register 3 + PT_VR4 = 78 // Vector register 4 + PT_VR5 = 79 // Vector register 5 + PT_VR6 = 80 // Vector register 6 + PT_VR7 = 81 // Vector register 7 + PT_VR8 = 82 // Vector register 8 + PT_VR9 = 83 // Vector register 9 + PT_VR10 = 84 // Vector register 10 + PT_VR11 = 85 // Vector register 11 + PT_VR12 = 86 // Vector register 12 + PT_VR13 = 87 // Vector register 13 + PT_VR14 = 88 // Vector register 14 + PT_VR15 = 89 // Vector register 15 + PT_VR16 = 90 // Vector register 16 + PT_VR17 = 91 // Vector register 17 + PT_VR18 = 92 // Vector register 18 + PT_VR19 = 93 // Vector register 19 + PT_VR20 = 94 // Vector register 20 + PT_VR21 = 95 // Vector register 21 + PT_VR22 = 96 // Vector register 22 + PT_VR23 = 97 // Vector register 23 + PT_VR24 = 98 // Vector register 24 + PT_VR25 = 99 // Vector register 25 + PT_VR26 = 100 // Vector register 26 + PT_VR27 = 101 // Vector register 27 + PT_VR28 = 102 // Vector register 28 + PT_VR29 = 103 // Vector register 29 + PT_VR30 = 104 // Vector register 30 + PT_VR31 = 105 // Vector register 31 + PT_PSWG = 106 // PSWG + PT_PSWG0 = 106 // Bytes 0-3 + PT_PSWG1 = 107 // Bytes 4-7 + PT_PSWG2 = 108 // Bytes 8-11 (IA high word) + PT_PSWG3 = 109 // Bytes 12-15 (IA low word) +) + +func Bpx4ptr(request int32, pid int32, addr unsafe.Pointer, data unsafe.Pointer, buffer unsafe.Pointer) (rv int32, rc int32, rn int32) { + var parms [8]unsafe.Pointer + parms[0] = unsafe.Pointer(&request) + parms[1] = unsafe.Pointer(&pid) + parms[2] = unsafe.Pointer(&addr) + parms[3] = unsafe.Pointer(&data) + parms[4] = unsafe.Pointer(&buffer) + parms[5] = unsafe.Pointer(&rv) + parms[6] = unsafe.Pointer(&rc) + parms[7] = unsafe.Pointer(&rn) + bpxcall(parms[:], BPX4PTR) + return rv, rc, rn +} + +func copyU8(val uint8, dest []uint8) int { + if len(dest) < 1 { + return 0 + } + dest[0] = val + return 1 +} + +func copyU8Arr(src, dest []uint8) int { + if len(dest) < len(src) { + return 0 + } + for i, v := range src { + dest[i] = v + } + return len(src) +} + +func copyU16(val uint16, dest []uint16) int { + if len(dest) < 1 { + return 0 + } + dest[0] = val + return 1 +} + +func copyU32(val uint32, dest []uint32) int { + if len(dest) < 1 { + return 0 + } + dest[0] = val + return 1 +} + +func copyU32Arr(src, dest []uint32) int { + if len(dest) < len(src) { + return 0 + } + for i, v := range src { + dest[i] = v + } + return len(src) +} + +func copyU64(val uint64, dest []uint64) int { + if len(dest) < 1 { + return 0 + } + dest[0] = val + return 1 +} diff --git a/vendor/golang.org/x/sys/unix/bpxsvc_zos.s b/vendor/golang.org/x/sys/unix/bpxsvc_zos.s new file mode 100644 index 00000000..4bd4a179 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/bpxsvc_zos.s @@ -0,0 +1,192 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "go_asm.h" +#include "textflag.h" + +// function to call USS assembly language services +// +// doc: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_3.1.0/com.ibm.zos.v3r1.bpxb100/bit64env.htm +// +// arg1 unsafe.Pointer array that ressembles an OS PLIST +// +// arg2 function offset as in +// doc: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_3.1.0/com.ibm.zos.v3r1.bpxb100/bpx2cr_List_of_offsets.htm +// +// func bpxcall(plist []unsafe.Pointer, bpx_offset int64) + +TEXT ·bpxcall(SB), NOSPLIT|NOFRAME, $0 + MOVD plist_base+0(FP), R1 // r1 points to plist + MOVD bpx_offset+24(FP), R2 // r2 offset to BPX vector table + MOVD R14, R7 // save r14 + MOVD R15, R8 // save r15 + MOVWZ 16(R0), R9 + MOVWZ 544(R9), R9 + MOVWZ 24(R9), R9 // call vector in r9 + ADD R2, R9 // add offset to vector table + MOVWZ (R9), R9 // r9 points to entry point + BYTE $0x0D // BL R14,R9 --> basr r14,r9 + BYTE $0xE9 // clobbers 0,1,14,15 + MOVD R8, R15 // restore 15 + JMP R7 // return via saved return address + +// func A2e(arr [] byte) +// code page conversion from 819 to 1047 +TEXT ·A2e(SB), NOSPLIT|NOFRAME, $0 + MOVD arg_base+0(FP), R2 // pointer to arry of characters + MOVD arg_len+8(FP), R3 // count + XOR R0, R0 + XOR R1, R1 + BYTE $0xA7; BYTE $0x15; BYTE $0x00; BYTE $0x82 // BRAS 1,(2+(256/2)) + + // ASCII -> EBCDIC conversion table: + BYTE $0x00; BYTE $0x01; BYTE $0x02; BYTE $0x03 + BYTE $0x37; BYTE $0x2d; BYTE $0x2e; BYTE $0x2f + BYTE $0x16; BYTE $0x05; BYTE $0x15; BYTE $0x0b + BYTE $0x0c; BYTE $0x0d; BYTE $0x0e; BYTE $0x0f + BYTE $0x10; BYTE $0x11; BYTE $0x12; BYTE $0x13 + BYTE $0x3c; BYTE $0x3d; BYTE $0x32; BYTE $0x26 + BYTE $0x18; BYTE $0x19; BYTE $0x3f; BYTE $0x27 + BYTE $0x1c; BYTE $0x1d; BYTE $0x1e; BYTE $0x1f + BYTE $0x40; BYTE $0x5a; BYTE $0x7f; BYTE $0x7b + BYTE $0x5b; BYTE $0x6c; BYTE $0x50; BYTE $0x7d + BYTE $0x4d; BYTE $0x5d; BYTE $0x5c; BYTE $0x4e + BYTE $0x6b; BYTE $0x60; BYTE $0x4b; BYTE $0x61 + BYTE $0xf0; BYTE $0xf1; BYTE $0xf2; BYTE $0xf3 + BYTE $0xf4; BYTE $0xf5; BYTE $0xf6; BYTE $0xf7 + BYTE $0xf8; BYTE $0xf9; BYTE $0x7a; BYTE $0x5e + BYTE $0x4c; BYTE $0x7e; BYTE $0x6e; BYTE $0x6f + BYTE $0x7c; BYTE $0xc1; BYTE $0xc2; BYTE $0xc3 + BYTE $0xc4; BYTE $0xc5; BYTE $0xc6; BYTE $0xc7 + BYTE $0xc8; BYTE $0xc9; BYTE $0xd1; BYTE $0xd2 + BYTE $0xd3; BYTE $0xd4; BYTE $0xd5; BYTE $0xd6 + BYTE $0xd7; BYTE $0xd8; BYTE $0xd9; BYTE $0xe2 + BYTE $0xe3; BYTE $0xe4; BYTE $0xe5; BYTE $0xe6 + BYTE $0xe7; BYTE $0xe8; BYTE $0xe9; BYTE $0xad + BYTE $0xe0; BYTE $0xbd; BYTE $0x5f; BYTE $0x6d + BYTE $0x79; BYTE $0x81; BYTE $0x82; BYTE $0x83 + BYTE $0x84; BYTE $0x85; BYTE $0x86; BYTE $0x87 + BYTE $0x88; BYTE $0x89; BYTE $0x91; BYTE $0x92 + BYTE $0x93; BYTE $0x94; BYTE $0x95; BYTE $0x96 + BYTE $0x97; BYTE $0x98; BYTE $0x99; BYTE $0xa2 + BYTE $0xa3; BYTE $0xa4; BYTE $0xa5; BYTE $0xa6 + BYTE $0xa7; BYTE $0xa8; BYTE $0xa9; BYTE $0xc0 + BYTE $0x4f; BYTE $0xd0; BYTE $0xa1; BYTE $0x07 + BYTE $0x20; BYTE $0x21; BYTE $0x22; BYTE $0x23 + BYTE $0x24; BYTE $0x25; BYTE $0x06; BYTE $0x17 + BYTE $0x28; BYTE $0x29; BYTE $0x2a; BYTE $0x2b + BYTE $0x2c; BYTE $0x09; BYTE $0x0a; BYTE $0x1b + BYTE $0x30; BYTE $0x31; BYTE $0x1a; BYTE $0x33 + BYTE $0x34; BYTE $0x35; BYTE $0x36; BYTE $0x08 + BYTE $0x38; BYTE $0x39; BYTE $0x3a; BYTE $0x3b + BYTE $0x04; BYTE $0x14; BYTE $0x3e; BYTE $0xff + BYTE $0x41; BYTE $0xaa; BYTE $0x4a; BYTE $0xb1 + BYTE $0x9f; BYTE $0xb2; BYTE $0x6a; BYTE $0xb5 + BYTE $0xbb; BYTE $0xb4; BYTE $0x9a; BYTE $0x8a + BYTE $0xb0; BYTE $0xca; BYTE $0xaf; BYTE $0xbc + BYTE $0x90; BYTE $0x8f; BYTE $0xea; BYTE $0xfa + BYTE $0xbe; BYTE $0xa0; BYTE $0xb6; BYTE $0xb3 + BYTE $0x9d; BYTE $0xda; BYTE $0x9b; BYTE $0x8b + BYTE $0xb7; BYTE $0xb8; BYTE $0xb9; BYTE $0xab + BYTE $0x64; BYTE $0x65; BYTE $0x62; BYTE $0x66 + BYTE $0x63; BYTE $0x67; BYTE $0x9e; BYTE $0x68 + BYTE $0x74; BYTE $0x71; BYTE $0x72; BYTE $0x73 + BYTE $0x78; BYTE $0x75; BYTE $0x76; BYTE $0x77 + BYTE $0xac; BYTE $0x69; BYTE $0xed; BYTE $0xee + BYTE $0xeb; BYTE $0xef; BYTE $0xec; BYTE $0xbf + BYTE $0x80; BYTE $0xfd; BYTE $0xfe; BYTE $0xfb + BYTE $0xfc; BYTE $0xba; BYTE $0xae; BYTE $0x59 + BYTE $0x44; BYTE $0x45; BYTE $0x42; BYTE $0x46 + BYTE $0x43; BYTE $0x47; BYTE $0x9c; BYTE $0x48 + BYTE $0x54; BYTE $0x51; BYTE $0x52; BYTE $0x53 + BYTE $0x58; BYTE $0x55; BYTE $0x56; BYTE $0x57 + BYTE $0x8c; BYTE $0x49; BYTE $0xcd; BYTE $0xce + BYTE $0xcb; BYTE $0xcf; BYTE $0xcc; BYTE $0xe1 + BYTE $0x70; BYTE $0xdd; BYTE $0xde; BYTE $0xdb + BYTE $0xdc; BYTE $0x8d; BYTE $0x8e; BYTE $0xdf + +retry: + WORD $0xB9931022 // TROO 2,2,b'0001' + BVS retry + RET + +// func e2a(arr [] byte) +// code page conversion from 1047 to 819 +TEXT ·E2a(SB), NOSPLIT|NOFRAME, $0 + MOVD arg_base+0(FP), R2 // pointer to arry of characters + MOVD arg_len+8(FP), R3 // count + XOR R0, R0 + XOR R1, R1 + BYTE $0xA7; BYTE $0x15; BYTE $0x00; BYTE $0x82 // BRAS 1,(2+(256/2)) + + // EBCDIC -> ASCII conversion table: + BYTE $0x00; BYTE $0x01; BYTE $0x02; BYTE $0x03 + BYTE $0x9c; BYTE $0x09; BYTE $0x86; BYTE $0x7f + BYTE $0x97; BYTE $0x8d; BYTE $0x8e; BYTE $0x0b + BYTE $0x0c; BYTE $0x0d; BYTE $0x0e; BYTE $0x0f + BYTE $0x10; BYTE $0x11; BYTE $0x12; BYTE $0x13 + BYTE $0x9d; BYTE $0x0a; BYTE $0x08; BYTE $0x87 + BYTE $0x18; BYTE $0x19; BYTE $0x92; BYTE $0x8f + BYTE $0x1c; BYTE $0x1d; BYTE $0x1e; BYTE $0x1f + BYTE $0x80; BYTE $0x81; BYTE $0x82; BYTE $0x83 + BYTE $0x84; BYTE $0x85; BYTE $0x17; BYTE $0x1b + BYTE $0x88; BYTE $0x89; BYTE $0x8a; BYTE $0x8b + BYTE $0x8c; BYTE $0x05; BYTE $0x06; BYTE $0x07 + BYTE $0x90; BYTE $0x91; BYTE $0x16; BYTE $0x93 + BYTE $0x94; BYTE $0x95; BYTE $0x96; BYTE $0x04 + BYTE $0x98; BYTE $0x99; BYTE $0x9a; BYTE $0x9b + BYTE $0x14; BYTE $0x15; BYTE $0x9e; BYTE $0x1a + BYTE $0x20; BYTE $0xa0; BYTE $0xe2; BYTE $0xe4 + BYTE $0xe0; BYTE $0xe1; BYTE $0xe3; BYTE $0xe5 + BYTE $0xe7; BYTE $0xf1; BYTE $0xa2; BYTE $0x2e + BYTE $0x3c; BYTE $0x28; BYTE $0x2b; BYTE $0x7c + BYTE $0x26; BYTE $0xe9; BYTE $0xea; BYTE $0xeb + BYTE $0xe8; BYTE $0xed; BYTE $0xee; BYTE $0xef + BYTE $0xec; BYTE $0xdf; BYTE $0x21; BYTE $0x24 + BYTE $0x2a; BYTE $0x29; BYTE $0x3b; BYTE $0x5e + BYTE $0x2d; BYTE $0x2f; BYTE $0xc2; BYTE $0xc4 + BYTE $0xc0; BYTE $0xc1; BYTE $0xc3; BYTE $0xc5 + BYTE $0xc7; BYTE $0xd1; BYTE $0xa6; BYTE $0x2c + BYTE $0x25; BYTE $0x5f; BYTE $0x3e; BYTE $0x3f + BYTE $0xf8; BYTE $0xc9; BYTE $0xca; BYTE $0xcb + BYTE $0xc8; BYTE $0xcd; BYTE $0xce; BYTE $0xcf + BYTE $0xcc; BYTE $0x60; BYTE $0x3a; BYTE $0x23 + BYTE $0x40; BYTE $0x27; BYTE $0x3d; BYTE $0x22 + BYTE $0xd8; BYTE $0x61; BYTE $0x62; BYTE $0x63 + BYTE $0x64; BYTE $0x65; BYTE $0x66; BYTE $0x67 + BYTE $0x68; BYTE $0x69; BYTE $0xab; BYTE $0xbb + BYTE $0xf0; BYTE $0xfd; BYTE $0xfe; BYTE $0xb1 + BYTE $0xb0; BYTE $0x6a; BYTE $0x6b; BYTE $0x6c + BYTE $0x6d; BYTE $0x6e; BYTE $0x6f; BYTE $0x70 + BYTE $0x71; BYTE $0x72; BYTE $0xaa; BYTE $0xba + BYTE $0xe6; BYTE $0xb8; BYTE $0xc6; BYTE $0xa4 + BYTE $0xb5; BYTE $0x7e; BYTE $0x73; BYTE $0x74 + BYTE $0x75; BYTE $0x76; BYTE $0x77; BYTE $0x78 + BYTE $0x79; BYTE $0x7a; BYTE $0xa1; BYTE $0xbf + BYTE $0xd0; BYTE $0x5b; BYTE $0xde; BYTE $0xae + BYTE $0xac; BYTE $0xa3; BYTE $0xa5; BYTE $0xb7 + BYTE $0xa9; BYTE $0xa7; BYTE $0xb6; BYTE $0xbc + BYTE $0xbd; BYTE $0xbe; BYTE $0xdd; BYTE $0xa8 + BYTE $0xaf; BYTE $0x5d; BYTE $0xb4; BYTE $0xd7 + BYTE $0x7b; BYTE $0x41; BYTE $0x42; BYTE $0x43 + BYTE $0x44; BYTE $0x45; BYTE $0x46; BYTE $0x47 + BYTE $0x48; BYTE $0x49; BYTE $0xad; BYTE $0xf4 + BYTE $0xf6; BYTE $0xf2; BYTE $0xf3; BYTE $0xf5 + BYTE $0x7d; BYTE $0x4a; BYTE $0x4b; BYTE $0x4c + BYTE $0x4d; BYTE $0x4e; BYTE $0x4f; BYTE $0x50 + BYTE $0x51; BYTE $0x52; BYTE $0xb9; BYTE $0xfb + BYTE $0xfc; BYTE $0xf9; BYTE $0xfa; BYTE $0xff + BYTE $0x5c; BYTE $0xf7; BYTE $0x53; BYTE $0x54 + BYTE $0x55; BYTE $0x56; BYTE $0x57; BYTE $0x58 + BYTE $0x59; BYTE $0x5a; BYTE $0xb2; BYTE $0xd4 + BYTE $0xd6; BYTE $0xd2; BYTE $0xd3; BYTE $0xd5 + BYTE $0x30; BYTE $0x31; BYTE $0x32; BYTE $0x33 + BYTE $0x34; BYTE $0x35; BYTE $0x36; BYTE $0x37 + BYTE $0x38; BYTE $0x39; BYTE $0xb3; BYTE $0xdb + BYTE $0xdc; BYTE $0xd9; BYTE $0xda; BYTE $0x9f + +retry: + WORD $0xB9931022 // TROO 2,2,b'0001' + BVS retry + RET diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go deleted file mode 100644 index 7753fdde..00000000 --- a/vendor/golang.org/x/sys/unix/epoll_zos.go +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build zos && s390x - -package unix - -import ( - "sync" -) - -// This file simulates epoll on z/OS using poll. - -// Analogous to epoll_event on Linux. -// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove? -type EpollEvent struct { - Events uint32 - Fd int32 - Pad int32 -} - -const ( - EPOLLERR = 0x8 - EPOLLHUP = 0x10 - EPOLLIN = 0x1 - EPOLLMSG = 0x400 - EPOLLOUT = 0x4 - EPOLLPRI = 0x2 - EPOLLRDBAND = 0x80 - EPOLLRDNORM = 0x40 - EPOLLWRBAND = 0x200 - EPOLLWRNORM = 0x100 - EPOLL_CTL_ADD = 0x1 - EPOLL_CTL_DEL = 0x2 - EPOLL_CTL_MOD = 0x3 - // The following constants are part of the epoll API, but represent - // currently unsupported functionality on z/OS. - // EPOLL_CLOEXEC = 0x80000 - // EPOLLET = 0x80000000 - // EPOLLONESHOT = 0x40000000 - // EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis - // EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode - // EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability -) - -// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL -// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16). - -// epToPollEvt converts epoll event field to poll equivalent. -// In epoll, Events is a 32-bit field, while poll uses 16 bits. -func epToPollEvt(events uint32) int16 { - var ep2p = map[uint32]int16{ - EPOLLIN: POLLIN, - EPOLLOUT: POLLOUT, - EPOLLHUP: POLLHUP, - EPOLLPRI: POLLPRI, - EPOLLERR: POLLERR, - } - - var pollEvts int16 = 0 - for epEvt, pEvt := range ep2p { - if (events & epEvt) != 0 { - pollEvts |= pEvt - } - } - - return pollEvts -} - -// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields. -func pToEpollEvt(revents int16) uint32 { - var p2ep = map[int16]uint32{ - POLLIN: EPOLLIN, - POLLOUT: EPOLLOUT, - POLLHUP: EPOLLHUP, - POLLPRI: EPOLLPRI, - POLLERR: EPOLLERR, - } - - var epollEvts uint32 = 0 - for pEvt, epEvt := range p2ep { - if (revents & pEvt) != 0 { - epollEvts |= epEvt - } - } - - return epollEvts -} - -// Per-process epoll implementation. -type epollImpl struct { - mu sync.Mutex - epfd2ep map[int]*eventPoll - nextEpfd int -} - -// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances. -// On Linux, this is an in-kernel data structure accessed through a fd. -type eventPoll struct { - mu sync.Mutex - fds map[int]*EpollEvent -} - -// epoll impl for this process. -var impl epollImpl = epollImpl{ - epfd2ep: make(map[int]*eventPoll), - nextEpfd: 0, -} - -func (e *epollImpl) epollcreate(size int) (epfd int, err error) { - e.mu.Lock() - defer e.mu.Unlock() - epfd = e.nextEpfd - e.nextEpfd++ - - e.epfd2ep[epfd] = &eventPoll{ - fds: make(map[int]*EpollEvent), - } - return epfd, nil -} - -func (e *epollImpl) epollcreate1(flag int) (fd int, err error) { - return e.epollcreate(4) -} - -func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) { - e.mu.Lock() - defer e.mu.Unlock() - - ep, ok := e.epfd2ep[epfd] - if !ok { - - return EBADF - } - - switch op { - case EPOLL_CTL_ADD: - // TODO(neeilan): When we make epfds and fds disjoint, detect epoll - // loops here (instances watching each other) and return ELOOP. - if _, ok := ep.fds[fd]; ok { - return EEXIST - } - ep.fds[fd] = event - case EPOLL_CTL_MOD: - if _, ok := ep.fds[fd]; !ok { - return ENOENT - } - ep.fds[fd] = event - case EPOLL_CTL_DEL: - if _, ok := ep.fds[fd]; !ok { - return ENOENT - } - delete(ep.fds, fd) - - } - return nil -} - -// Must be called while holding ep.mu -func (ep *eventPoll) getFds() []int { - fds := make([]int, len(ep.fds)) - for fd := range ep.fds { - fds = append(fds, fd) - } - return fds -} - -func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) { - e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait - ep, ok := e.epfd2ep[epfd] - - if !ok { - e.mu.Unlock() - return 0, EBADF - } - - pollfds := make([]PollFd, 4) - for fd, epollevt := range ep.fds { - pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)}) - } - e.mu.Unlock() - - n, err = Poll(pollfds, msec) - if err != nil { - return n, err - } - - i := 0 - for _, pFd := range pollfds { - if pFd.Revents != 0 { - events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)} - i++ - } - - if i == n { - break - } - } - - return n, nil -} - -func EpollCreate(size int) (fd int, err error) { - return impl.epollcreate(size) -} - -func EpollCreate1(flag int) (fd int, err error) { - return impl.epollcreate1(flag) -} - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - return impl.epollctl(epfd, op, fd, event) -} - -// Because EpollWait mutates events, the caller is expected to coordinate -// concurrent access if calling with the same epfd from multiple goroutines. -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - return impl.epollwait(epfd, events, msec) -} diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go deleted file mode 100644 index c8bde601..00000000 --- a/vendor/golang.org/x/sys/unix/fstatfs_zos.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build zos && s390x - -package unix - -import ( - "unsafe" -) - -// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent. - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - var stat_v Statvfs_t - err = Fstatvfs(fd, &stat_v) - if err == nil { - // populate stat - stat.Type = 0 - stat.Bsize = stat_v.Bsize - stat.Blocks = stat_v.Blocks - stat.Bfree = stat_v.Bfree - stat.Bavail = stat_v.Bavail - stat.Files = stat_v.Files - stat.Ffree = stat_v.Ffree - stat.Fsid = stat_v.Fsid - stat.Namelen = stat_v.Namemax - stat.Frsize = stat_v.Frsize - stat.Flags = stat_v.Flag - for passn := 0; passn < 5; passn++ { - switch passn { - case 0: - err = tryGetmntent64(stat) - break - case 1: - err = tryGetmntent128(stat) - break - case 2: - err = tryGetmntent256(stat) - break - case 3: - err = tryGetmntent512(stat) - break - case 4: - err = tryGetmntent1024(stat) - break - default: - break - } - //proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred) - if err == nil || err != nil && err != ERANGE { - break - } - } - } - return err -} - -func tryGetmntent64(stat *Statfs_t) (err error) { - var mnt_ent_buffer struct { - header W_Mnth - filesys_info [64]W_Mntent - } - var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) - fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) - if err != nil { - return err - } - err = ERANGE //return ERANGE if no match is found in this batch - for i := 0; i < fs_count; i++ { - if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { - stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) - err = nil - break - } - } - return err -} - -func tryGetmntent128(stat *Statfs_t) (err error) { - var mnt_ent_buffer struct { - header W_Mnth - filesys_info [128]W_Mntent - } - var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) - fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) - if err != nil { - return err - } - err = ERANGE //return ERANGE if no match is found in this batch - for i := 0; i < fs_count; i++ { - if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { - stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) - err = nil - break - } - } - return err -} - -func tryGetmntent256(stat *Statfs_t) (err error) { - var mnt_ent_buffer struct { - header W_Mnth - filesys_info [256]W_Mntent - } - var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) - fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) - if err != nil { - return err - } - err = ERANGE //return ERANGE if no match is found in this batch - for i := 0; i < fs_count; i++ { - if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { - stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) - err = nil - break - } - } - return err -} - -func tryGetmntent512(stat *Statfs_t) (err error) { - var mnt_ent_buffer struct { - header W_Mnth - filesys_info [512]W_Mntent - } - var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) - fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) - if err != nil { - return err - } - err = ERANGE //return ERANGE if no match is found in this batch - for i := 0; i < fs_count; i++ { - if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { - stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) - err = nil - break - } - } - return err -} - -func tryGetmntent1024(stat *Statfs_t) (err error) { - var mnt_ent_buffer struct { - header W_Mnth - filesys_info [1024]W_Mntent - } - var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) - fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) - if err != nil { - return err - } - err = ERANGE //return ERANGE if no match is found in this batch - for i := 0; i < fs_count; i++ { - if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { - stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) - err = nil - break - } - } - return err -} diff --git a/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/vendor/golang.org/x/sys/unix/mmap_nomremap.go index 4b68e597..7f602ffd 100644 --- a/vendor/golang.org/x/sys/unix/mmap_nomremap.go +++ b/vendor/golang.org/x/sys/unix/mmap_nomremap.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris +//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris || zos package unix diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go index 4d0a3430..0482408d 100644 --- a/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // For Unix, get the pagesize from the runtime. diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 130398b6..b903c006 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build darwin +//go:build darwin || zos package unix diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_zos.go b/vendor/golang.org/x/sys/unix/sockcmsg_zos.go new file mode 100644 index 00000000..3e53dbc0 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sockcmsg_zos.go @@ -0,0 +1,58 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Socket control messages + +package unix + +import "unsafe" + +// UnixCredentials encodes credentials into a socket control message +// for sending to another process. This can be used for +// authentication. +func UnixCredentials(ucred *Ucred) []byte { + b := make([]byte, CmsgSpace(SizeofUcred)) + h := (*Cmsghdr)(unsafe.Pointer(&b[0])) + h.Level = SOL_SOCKET + h.Type = SCM_CREDENTIALS + h.SetLen(CmsgLen(SizeofUcred)) + *(*Ucred)(h.data(0)) = *ucred + return b +} + +// ParseUnixCredentials decodes a socket control message that contains +// credentials in a Ucred structure. To receive such a message, the +// SO_PASSCRED option must be enabled on the socket. +func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { + if m.Header.Level != SOL_SOCKET { + return nil, EINVAL + } + if m.Header.Type != SCM_CREDENTIALS { + return nil, EINVAL + } + ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) + return &ucred, nil +} + +// PktInfo4 encodes Inet4Pktinfo into a socket control message of type IP_PKTINFO. +func PktInfo4(info *Inet4Pktinfo) []byte { + b := make([]byte, CmsgSpace(SizeofInet4Pktinfo)) + h := (*Cmsghdr)(unsafe.Pointer(&b[0])) + h.Level = SOL_IP + h.Type = IP_PKTINFO + h.SetLen(CmsgLen(SizeofInet4Pktinfo)) + *(*Inet4Pktinfo)(h.data(0)) = *info + return b +} + +// PktInfo6 encodes Inet6Pktinfo into a socket control message of type IPV6_PKTINFO. +func PktInfo6(info *Inet6Pktinfo) []byte { + b := make([]byte, CmsgSpace(SizeofInet6Pktinfo)) + h := (*Cmsghdr)(unsafe.Pointer(&b[0])) + h.Level = SOL_IPV6 + h.Type = IPV6_PKTINFO + h.SetLen(CmsgLen(SizeofInet6Pktinfo)) + *(*Inet6Pktinfo)(h.data(0)) = *info + return b +} diff --git a/vendor/golang.org/x/sys/unix/symaddr_zos_s390x.s b/vendor/golang.org/x/sys/unix/symaddr_zos_s390x.s new file mode 100644 index 00000000..3c4f33cb --- /dev/null +++ b/vendor/golang.org/x/sys/unix/symaddr_zos_s390x.s @@ -0,0 +1,75 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x && gc + +#include "textflag.h" + +// provide the address of function variable to be fixed up. + +TEXT ·getPipe2Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Pipe2(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_FlockAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Flock(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_GetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Getxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_NanosleepAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Nanosleep(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_SetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Setxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_Wait4Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Wait4(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_MountAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Mount(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_UnmountAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Unmount(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_UtimesNanoAtAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·UtimesNanoAt(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_UtimesNanoAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·UtimesNano(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_MkfifoatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Mkfifoat(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_ChtagAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Chtag(SB), R8 + MOVD R8, ret+0(FP) + RET + +TEXT ·get_ReadlinkatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Readlinkat(SB), R8 + MOVD R8, ret+0(FP) + RET + diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index b473038c..312ae6ac 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -4,11 +4,21 @@ //go:build zos && s390x +// Many of the following syscalls are not available on all versions of z/OS. +// Some missing calls have legacy implementations/simulations but others +// will be missing completely. To achieve consistent failing behaviour on +// legacy systems, we first test the function pointer via a safeloading +// mechanism to see if the function exists on a given system. Then execution +// is branched to either continue the function call, or return an error. + package unix import ( "bytes" "fmt" + "os" + "reflect" + "regexp" "runtime" "sort" "strings" @@ -17,17 +27,205 @@ import ( "unsafe" ) +//go:noescape +func initZosLibVec() + +//go:noescape +func GetZosLibVec() uintptr + +func init() { + initZosLibVec() + r0, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS_____GETENV_A<<4, uintptr(unsafe.Pointer(&([]byte("__ZOS_XSYSTRACE\x00"))[0]))) + if r0 != 0 { + n, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___ATOI_A<<4, r0) + ZosTraceLevel = int(n) + r0, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS_____GETENV_A<<4, uintptr(unsafe.Pointer(&([]byte("__ZOS_XSYSTRACEFD\x00"))[0]))) + if r0 != 0 { + fd, _, _ := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___ATOI_A<<4, r0) + f := os.NewFile(fd, "zostracefile") + if f != nil { + ZosTracefile = f + } + } + + } +} + +//go:noescape +func CallLeFuncWithErr(funcdesc uintptr, parms ...uintptr) (ret, errno2 uintptr, err Errno) + +//go:noescape +func CallLeFuncWithPtrReturn(funcdesc uintptr, parms ...uintptr) (ret, errno2 uintptr, err Errno) + +// ------------------------------- +// pointer validity test +// good pointer returns 0 +// bad pointer returns 1 +// +//go:nosplit +func ptrtest(uintptr) uint64 + +// Load memory at ptr location with error handling if the location is invalid +// +//go:noescape +func safeload(ptr uintptr) (value uintptr, error uintptr) + const ( - O_CLOEXEC = 0 // Dummy value (not supported). - AF_LOCAL = AF_UNIX // AF_LOCAL is an alias for AF_UNIX + entrypointLocationOffset = 8 // From function descriptor + + xplinkEyecatcher = 0x00c300c500c500f1 // ".C.E.E.1" + eyecatcherOffset = 16 // From function entrypoint (negative) + ppa1LocationOffset = 8 // From function entrypoint (negative) + + nameLenOffset = 0x14 // From PPA1 start + nameOffset = 0x16 // From PPA1 start ) -func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func syscall_syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall_rawsyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall_syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) -func syscall_rawsyscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) +func getPpaOffset(funcptr uintptr) int64 { + entrypoint, err := safeload(funcptr + entrypointLocationOffset) + if err != 0 { + return -1 + } + + // XPLink functions have ".C.E.E.1" as the first 8 bytes (EBCDIC) + val, err := safeload(entrypoint - eyecatcherOffset) + if err != 0 { + return -1 + } + if val != xplinkEyecatcher { + return -1 + } + + ppaoff, err := safeload(entrypoint - ppa1LocationOffset) + if err != 0 { + return -1 + } + + ppaoff >>= 32 + return int64(ppaoff) +} + +//------------------------------- +// function descriptor pointer validity test +// good pointer returns 0 +// bad pointer returns 1 + +// TODO: currently mksyscall_zos_s390x.go generate empty string for funcName +// have correct funcName pass to the funcptrtest function +func funcptrtest(funcptr uintptr, funcName string) uint64 { + entrypoint, err := safeload(funcptr + entrypointLocationOffset) + if err != 0 { + return 1 + } + + ppaoff := getPpaOffset(funcptr) + if ppaoff == -1 { + return 1 + } + + // PPA1 offset value is from the start of the entire function block, not the entrypoint + ppa1 := (entrypoint - eyecatcherOffset) + uintptr(ppaoff) + + nameLen, err := safeload(ppa1 + nameLenOffset) + if err != 0 { + return 1 + } + + nameLen >>= 48 + if nameLen > 128 { + return 1 + } + + // no function name input to argument end here + if funcName == "" { + return 0 + } + + var funcname [128]byte + for i := 0; i < int(nameLen); i += 8 { + v, err := safeload(ppa1 + nameOffset + uintptr(i)) + if err != 0 { + return 1 + } + funcname[i] = byte(v >> 56) + funcname[i+1] = byte(v >> 48) + funcname[i+2] = byte(v >> 40) + funcname[i+3] = byte(v >> 32) + funcname[i+4] = byte(v >> 24) + funcname[i+5] = byte(v >> 16) + funcname[i+6] = byte(v >> 8) + funcname[i+7] = byte(v) + } + + runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___E2A_L<<4, // __e2a_l + []uintptr{uintptr(unsafe.Pointer(&funcname[0])), nameLen}) + + name := string(funcname[:nameLen]) + if name != funcName { + return 1 + } + + return 0 +} + +// For detection of capabilities on a system. +// Is function descriptor f a valid function? +func isValidLeFunc(f uintptr) error { + ret := funcptrtest(f, "") + if ret != 0 { + return fmt.Errorf("Bad pointer, not an LE function ") + } + return nil +} + +// Retrieve function name from descriptor +func getLeFuncName(f uintptr) (string, error) { + // assume it has been checked, only check ppa1 validity here + entry := ((*[2]uintptr)(unsafe.Pointer(f)))[1] + preamp := ((*[4]uint32)(unsafe.Pointer(entry - eyecatcherOffset))) + + offsetPpa1 := preamp[2] + if offsetPpa1 > 0x0ffff { + return "", fmt.Errorf("PPA1 offset seems too big 0x%x\n", offsetPpa1) + } + + ppa1 := uintptr(unsafe.Pointer(preamp)) + uintptr(offsetPpa1) + res := ptrtest(ppa1) + if res != 0 { + return "", fmt.Errorf("PPA1 address not valid") + } + + size := *(*uint16)(unsafe.Pointer(ppa1 + nameLenOffset)) + if size > 128 { + return "", fmt.Errorf("Function name seems too long, length=%d\n", size) + } + + var name [128]byte + funcname := (*[128]byte)(unsafe.Pointer(ppa1 + nameOffset)) + copy(name[0:size], funcname[0:size]) + + runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___E2A_L<<4, // __e2a_l + []uintptr{uintptr(unsafe.Pointer(&name[0])), uintptr(size)}) + + return string(name[:size]), nil +} + +// Check z/OS version +func zosLeVersion() (version, release uint32) { + p1 := (*(*uintptr)(unsafe.Pointer(uintptr(1208)))) >> 32 + p1 = *(*uintptr)(unsafe.Pointer(uintptr(p1 + 88))) + p1 = *(*uintptr)(unsafe.Pointer(uintptr(p1 + 8))) + p1 = *(*uintptr)(unsafe.Pointer(uintptr(p1 + 984))) + vrm := *(*uint32)(unsafe.Pointer(p1 + 80)) + version = (vrm & 0x00ff0000) >> 16 + release = (vrm & 0x0000ff00) >> 8 + return +} + +// returns a zos C FILE * for stdio fd 0, 1, 2 +func ZosStdioFilep(fd int32) uintptr { + return uintptr(*(*uint64)(unsafe.Pointer(uintptr(*(*uint64)(unsafe.Pointer(uintptr(*(*uint64)(unsafe.Pointer(uintptr(uint64(*(*uint32)(unsafe.Pointer(uintptr(1208)))) + 80))) + uint64((fd+2)<<3)))))))) +} func copyStat(stat *Stat_t, statLE *Stat_LE_t) { stat.Dev = uint64(statLE.Dev) @@ -65,6 +263,21 @@ func (d *Dirent) NameString() string { } } +func DecodeData(dest []byte, sz int, val uint64) { + for i := 0; i < sz; i++ { + dest[sz-1-i] = byte((val >> (uint64(i * 8))) & 0xff) + } +} + +func EncodeData(data []byte) uint64 { + var value uint64 + sz := len(data) + for i := 0; i < sz; i++ { + value |= uint64(data[i]) << uint64(((sz - i - 1) * 8)) + } + return value +} + func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { if sa.Port < 0 || sa.Port > 0xFFFF { return nil, 0, EINVAL @@ -74,7 +287,9 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - sa.raw.Addr = sa.Addr + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -88,7 +303,9 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - sa.raw.Addr = sa.Addr + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -146,7 +363,9 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - sa.Addr = pp.Addr + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } return sa, nil case AF_INET6: @@ -155,7 +374,9 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - sa.Addr = pp.Addr + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } return sa, nil } return nil, EAFNOSUPPORT @@ -177,6 +398,43 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { return } +func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept4(fd, &rsa, &len, flags) + if err != nil { + return + } + if len > SizeofSockaddrAny { + panic("RawSockaddrAny too small") + } + // TODO(neeilan): Remove 0 in call + sa, err = anyToSockaddr(0, &rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} + +func Ctermid() (tty string, err error) { + var termdev [1025]byte + runtime.EnterSyscall() + r0, err2, err1 := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___CTERMID_A<<4, uintptr(unsafe.Pointer(&termdev[0]))) + runtime.ExitSyscall() + if r0 == 0 { + return "", fmt.Errorf("%s (errno2=0x%x)\n", err1.Error(), err2) + } + s := string(termdev[:]) + idx := strings.Index(s, string(rune(0))) + if idx == -1 { + tty = s + } else { + tty = s[:idx] + } + return +} + func (iov *Iovec) SetLen(length int) { iov.Len = uint64(length) } @@ -190,10 +448,16 @@ func (cmsg *Cmsghdr) SetLen(length int) { } //sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys Flistxattr(fd int, dest []byte) (sz int, err error) = SYS___FLISTXATTR_A +//sys Fremovexattr(fd int, attr string) (err error) = SYS___FREMOVEXATTR_A //sys read(fd int, p []byte) (n int, err error) //sys write(fd int, p []byte) (n int, err error) +//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) = SYS___FGETXATTR_A +//sys Fsetxattr(fd int, attr string, data []byte, flag int) (err error) = SYS___FSETXATTR_A + //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = SYS___ACCEPT4_A //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___BIND_A //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___CONNECT_A //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) @@ -204,6 +468,7 @@ func (cmsg *Cmsghdr) SetLen(length int) { //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETPEERNAME_A //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETSOCKNAME_A +//sys Removexattr(path string, attr string) (err error) = SYS___REMOVEXATTR_A //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = SYS___RECVFROM_A //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = SYS___SENDTO_A //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___RECVMSG_A @@ -212,6 +477,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { //sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP //sys ioctl(fd int, req int, arg uintptr) (err error) = SYS_IOCTL //sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = SYS_IOCTL +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) = SYS_SHMAT +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) = SYS_SHMCTL64 +//sys shmdt(addr uintptr) (err error) = SYS_SHMDT +//sys shmget(key int, size int, flag int) (id int, err error) = SYS_SHMGET //sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A //sys Chdir(path string) (err error) = SYS___CHDIR_A @@ -220,14 +489,31 @@ func (cmsg *Cmsghdr) SetLen(length int) { //sys Creat(path string, mode uint32) (fd int, err error) = SYS___CREAT_A //sys Dup(oldfd int) (fd int, err error) //sys Dup2(oldfd int, newfd int) (err error) +//sys Dup3(oldfd int, newfd int, flags int) (err error) = SYS_DUP3 +//sys Dirfd(dirp uintptr) (fd int, err error) = SYS_DIRFD +//sys EpollCreate(size int) (fd int, err error) = SYS_EPOLL_CREATE +//sys EpollCreate1(flags int) (fd int, err error) = SYS_EPOLL_CREATE1 +//sys EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) = SYS_EPOLL_CTL +//sys EpollPwait(epfd int, events []EpollEvent, msec int, sigmask *int) (n int, err error) = SYS_EPOLL_PWAIT +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_WAIT //sys Errno2() (er2 int) = SYS___ERRNO2 -//sys Err2ad() (eadd *int) = SYS___ERR2AD +//sys Eventfd(initval uint, flags int) (fd int, err error) = SYS_EVENTFD //sys Exit(code int) +//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) = SYS___FACCESSAT_A + +func Faccessat2(dirfd int, path string, mode uint32, flags int) (err error) { + return Faccessat(dirfd, path, mode, flags) +} + //sys Fchdir(fd int) (err error) //sys Fchmod(fd int, mode uint32) (err error) +//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) = SYS___FCHMODAT_A //sys Fchown(fd int, uid int, gid int) (err error) +//sys Fchownat(fd int, path string, uid int, gid int, flags int) (err error) = SYS___FCHOWNAT_A //sys FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) = SYS_FCNTL +//sys Fdatasync(fd int) (err error) = SYS_FDATASYNC //sys fstat(fd int, stat *Stat_LE_t) (err error) +//sys fstatat(dirfd int, path string, stat *Stat_LE_t, flags int) (err error) = SYS___FSTATAT_A func Fstat(fd int, stat *Stat_t) (err error) { var statLE Stat_LE_t @@ -236,28 +522,208 @@ func Fstat(fd int, stat *Stat_t) (err error) { return } +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + var statLE Stat_LE_t + err = fstatat(dirfd, path, &statLE, flags) + copyStat(stat, &statLE) + return +} + +func impl_Getxattr(path string, attr string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___GETXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest))) + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_GetxattrAddr() *(func(path string, attr string, dest []byte) (sz int, err error)) + +var Getxattr = enter_Getxattr + +func enter_Getxattr(path string, attr string, dest []byte) (sz int, err error) { + funcref := get_GetxattrAddr() + if validGetxattr() { + *funcref = impl_Getxattr + } else { + *funcref = error_Getxattr + } + return (*funcref)(path, attr, dest) +} + +func error_Getxattr(path string, attr string, dest []byte) (sz int, err error) { + return -1, ENOSYS +} + +func validGetxattr() bool { + if funcptrtest(GetZosLibVec()+SYS___GETXATTR_A<<4, "") == 0 { + if name, err := getLeFuncName(GetZosLibVec() + SYS___GETXATTR_A<<4); err == nil { + return name == "__getxattr_a" + } + } + return false +} + +//sys Lgetxattr(link string, attr string, dest []byte) (sz int, err error) = SYS___LGETXATTR_A +//sys Lsetxattr(path string, attr string, data []byte, flags int) (err error) = SYS___LSETXATTR_A + +func impl_Setxattr(path string, attr string, data []byte, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SETXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_SetxattrAddr() *(func(path string, attr string, data []byte, flags int) (err error)) + +var Setxattr = enter_Setxattr + +func enter_Setxattr(path string, attr string, data []byte, flags int) (err error) { + funcref := get_SetxattrAddr() + if validSetxattr() { + *funcref = impl_Setxattr + } else { + *funcref = error_Setxattr + } + return (*funcref)(path, attr, data, flags) +} + +func error_Setxattr(path string, attr string, data []byte, flags int) (err error) { + return ENOSYS +} + +func validSetxattr() bool { + if funcptrtest(GetZosLibVec()+SYS___SETXATTR_A<<4, "") == 0 { + if name, err := getLeFuncName(GetZosLibVec() + SYS___SETXATTR_A<<4); err == nil { + return name == "__setxattr_a" + } + } + return false +} + +//sys Fstatfs(fd int, buf *Statfs_t) (err error) = SYS_FSTATFS //sys Fstatvfs(fd int, stat *Statvfs_t) (err error) = SYS_FSTATVFS //sys Fsync(fd int) (err error) +//sys Futimes(fd int, tv []Timeval) (err error) = SYS_FUTIMES +//sys Futimesat(dirfd int, path string, tv []Timeval) (err error) = SYS___FUTIMESAT_A //sys Ftruncate(fd int, length int64) (err error) -//sys Getpagesize() (pgsize int) = SYS_GETPAGESIZE +//sys Getrandom(buf []byte, flags int) (n int, err error) = SYS_GETRANDOM +//sys InotifyInit() (fd int, err error) = SYS_INOTIFY_INIT +//sys InotifyInit1(flags int) (fd int, err error) = SYS_INOTIFY_INIT1 +//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) = SYS___INOTIFY_ADD_WATCH_A +//sys InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) = SYS_INOTIFY_RM_WATCH +//sys Listxattr(path string, dest []byte) (sz int, err error) = SYS___LISTXATTR_A +//sys Llistxattr(path string, dest []byte) (sz int, err error) = SYS___LLISTXATTR_A +//sys Lremovexattr(path string, attr string) (err error) = SYS___LREMOVEXATTR_A +//sys Lutimes(path string, tv []Timeval) (err error) = SYS___LUTIMES_A //sys Mprotect(b []byte, prot int) (err error) = SYS_MPROTECT //sys Msync(b []byte, flags int) (err error) = SYS_MSYNC +//sys Console2(cmsg *ConsMsg2, modstr *byte, concmd *uint32) (err error) = SYS___CONSOLE2 + +// Pipe2 begin + +//go:nosplit +func getPipe2Addr() *(func([]int, int) error) + +var Pipe2 = pipe2Enter + +func pipe2Enter(p []int, flags int) (err error) { + if funcptrtest(GetZosLibVec()+SYS_PIPE2<<4, "") == 0 { + *getPipe2Addr() = pipe2Impl + } else { + *getPipe2Addr() = pipe2Error + } + return (*getPipe2Addr())(p, flags) +} + +func pipe2Impl(p []int, flags int) (err error) { + var pp [2]_C_int + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_PIPE2<<4, uintptr(unsafe.Pointer(&pp[0])), uintptr(flags)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } else { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } + return +} +func pipe2Error(p []int, flags int) (err error) { + return fmt.Errorf("Pipe2 is not available on this system") +} + +// Pipe2 end + //sys Poll(fds []PollFd, timeout int) (n int, err error) = SYS_POLL + +func Readdir(dir uintptr) (dirent *Dirent, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___READDIR_A<<4, uintptr(dir)) + runtime.ExitSyscall() + dirent = (*Dirent)(unsafe.Pointer(r0)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//sys Readdir_r(dirp uintptr, entry *direntLE, result **direntLE) (err error) = SYS___READDIR_R_A +//sys Statfs(path string, buf *Statfs_t) (err error) = SYS___STATFS_A +//sys Syncfs(fd int) (err error) = SYS_SYNCFS //sys Times(tms *Tms) (ticks uintptr, err error) = SYS_TIMES //sys W_Getmntent(buff *byte, size int) (lastsys int, err error) = SYS_W_GETMNTENT //sys W_Getmntent_A(buff *byte, size int) (lastsys int, err error) = SYS___W_GETMNTENT_A //sys mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) = SYS___MOUNT_A -//sys unmount(filesystem string, mtm int) (err error) = SYS___UMOUNT_A +//sys unmount_LE(filesystem string, mtm int) (err error) = SYS___UMOUNT_A //sys Chroot(path string) (err error) = SYS___CHROOT_A //sys Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) = SYS_SELECT -//sysnb Uname(buf *Utsname) (err error) = SYS___UNAME_A +//sysnb Uname(buf *Utsname) (err error) = SYS_____OSNAME_A +//sys Unshare(flags int) (err error) = SYS_UNSHARE func Ptsname(fd int) (name string, err error) { - r0, _, e1 := syscall_syscall(SYS___PTSNAME_A, uintptr(fd), 0, 0) - name = u2s(unsafe.Pointer(r0)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___PTSNAME_A<<4, uintptr(fd)) + runtime.ExitSyscall() + if r0 == 0 { + err = errnoErr2(e1, e2) + } else { + name = u2s(unsafe.Pointer(r0)) } return } @@ -272,13 +738,19 @@ func u2s(cstr unsafe.Pointer) string { } func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_CLOSE<<4, uintptr(fd)) + runtime.ExitSyscall() for i := 0; e1 == EAGAIN && i < 10; i++ { - _, _, _ = syscall_syscall(SYS_USLEEP, uintptr(10), 0, 0) - _, _, e1 = syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + runtime.EnterSyscall() + CallLeFuncWithErr(GetZosLibVec()+SYS_USLEEP<<4, uintptr(10)) + runtime.ExitSyscall() + runtime.EnterSyscall() + r0, e2, e1 = CallLeFuncWithErr(GetZosLibVec()+SYS_CLOSE<<4, uintptr(fd)) + runtime.ExitSyscall() } - if e1 != 0 { - err = errnoErr(e1) + if r0 != 0 { + err = errnoErr2(e1, e2) } return } @@ -288,9 +760,15 @@ func Madvise(b []byte, advice int) (err error) { return } +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return mapper.Mmap(fd, offset, length, prot, flags) +} + +func Munmap(b []byte) (err error) { + return mapper.Munmap(b) +} + //sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A -//sysnb Getegid() (egid int) -//sysnb Geteuid() (uid int) //sysnb Getgid() (gid int) //sysnb Getpid() (pid int) //sysnb Getpgid(pid int) (pgid int, err error) = SYS_GETPGID @@ -317,11 +795,14 @@ func Getrusage(who int, rusage *Rusage) (err error) { return } +//sys Getegid() (egid int) = SYS_GETEGID +//sys Geteuid() (euid int) = SYS_GETEUID //sysnb Getsid(pid int) (sid int, err error) = SYS_GETSID //sysnb Getuid() (uid int) //sysnb Kill(pid int, sig Signal) (err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS___LCHOWN_A //sys Link(path string, link string) (err error) = SYS___LINK_A +//sys Linkat(oldDirFd int, oldPath string, newDirFd int, newPath string, flags int) (err error) = SYS___LINKAT_A //sys Listen(s int, n int) (err error) //sys lstat(path string, stat *Stat_LE_t) (err error) = SYS___LSTAT_A @@ -332,15 +813,150 @@ func Lstat(path string, stat *Stat_t) (err error) { return } +// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/ +func isSpecialPath(path []byte) (v bool) { + var special = [4][8]byte{ + [8]byte{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'}, + [8]byte{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'}, + [8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'}, + [8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}} + + var i, j int + for i = 0; i < len(special); i++ { + for j = 0; j < len(special[i]); j++ { + if path[j] != special[i][j] { + break + } + } + if j == len(special[i]) { + return true + } + } + return false +} + +func realpath(srcpath string, abspath []byte) (pathlen int, errno int) { + var source [1024]byte + copy(source[:], srcpath) + source[len(srcpath)] = 0 + ret := runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___REALPATH_A<<4, //__realpath_a() + []uintptr{uintptr(unsafe.Pointer(&source[0])), + uintptr(unsafe.Pointer(&abspath[0]))}) + if ret != 0 { + index := bytes.IndexByte(abspath[:], byte(0)) + if index != -1 { + return index, 0 + } + } else { + errptr := (*int)(unsafe.Pointer(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO<<4, []uintptr{}))) //__errno() + return 0, *errptr + } + return 0, 245 // EBADDATA 245 +} + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + n = int(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___READLINK_A<<4, + []uintptr{uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))})) + runtime.KeepAlive(unsafe.Pointer(_p0)) + if n == -1 { + value := *(*int32)(unsafe.Pointer(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO<<4, []uintptr{}))) + err = errnoErr(Errno(value)) + } else { + if buf[0] == '$' { + if isSpecialPath(buf[1:9]) { + cnt, err1 := realpath(path, buf) + if err1 == 0 { + n = cnt + } + } + } + } + return +} + +func impl_Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___READLINKAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + return n, err + } else { + if buf[0] == '$' { + if isSpecialPath(buf[1:9]) { + cnt, err1 := realpath(path, buf) + if err1 == 0 { + n = cnt + } + } + } + } + return +} + +//go:nosplit +func get_ReadlinkatAddr() *(func(dirfd int, path string, buf []byte) (n int, err error)) + +var Readlinkat = enter_Readlinkat + +func enter_Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + funcref := get_ReadlinkatAddr() + if funcptrtest(GetZosLibVec()+SYS___READLINKAT_A<<4, "") == 0 { + *funcref = impl_Readlinkat + } else { + *funcref = error_Readlinkat + } + return (*funcref)(dirfd, path, buf) +} + +func error_Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + n = -1 + err = ENOSYS + return +} + //sys Mkdir(path string, mode uint32) (err error) = SYS___MKDIR_A +//sys Mkdirat(dirfd int, path string, mode uint32) (err error) = SYS___MKDIRAT_A //sys Mkfifo(path string, mode uint32) (err error) = SYS___MKFIFO_A //sys Mknod(path string, mode uint32, dev int) (err error) = SYS___MKNOD_A +//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) = SYS___MKNODAT_A +//sys PivotRoot(newroot string, oldroot string) (err error) = SYS___PIVOT_ROOT_A //sys Pread(fd int, p []byte, offset int64) (n int, err error) //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) -//sys Readlink(path string, buf []byte) (n int, err error) = SYS___READLINK_A +//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) = SYS___PRCTL_A +//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT //sys Rename(from string, to string) (err error) = SYS___RENAME_A +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) = SYS___RENAMEAT_A +//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) = SYS___RENAMEAT2_A //sys Rmdir(path string) (err error) = SYS___RMDIR_A //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK +//sys Setegid(egid int) (err error) = SYS_SETEGID +//sys Seteuid(euid int) (err error) = SYS_SETEUID +//sys Sethostname(p []byte) (err error) = SYS___SETHOSTNAME_A +//sys Setns(fd int, nstype int) (err error) = SYS_SETNS //sys Setpriority(which int, who int, prio int) (err error) //sysnb Setpgid(pid int, pgid int) (err error) = SYS_SETPGID //sysnb Setrlimit(resource int, lim *Rlimit) (err error) @@ -360,32 +976,57 @@ func Stat(path string, sta *Stat_t) (err error) { } //sys Symlink(path string, link string) (err error) = SYS___SYMLINK_A +//sys Symlinkat(oldPath string, dirfd int, newPath string) (err error) = SYS___SYMLINKAT_A //sys Sync() = SYS_SYNC //sys Truncate(path string, length int64) (err error) = SYS___TRUNCATE_A //sys Tcgetattr(fildes int, termptr *Termios) (err error) = SYS_TCGETATTR //sys Tcsetattr(fildes int, when int, termptr *Termios) (err error) = SYS_TCSETATTR //sys Umask(mask int) (oldmask int) //sys Unlink(path string) (err error) = SYS___UNLINK_A +//sys Unlinkat(dirfd int, path string, flags int) (err error) = SYS___UNLINKAT_A //sys Utime(path string, utim *Utimbuf) (err error) = SYS___UTIME_A //sys open(path string, mode int, perm uint32) (fd int, err error) = SYS___OPEN_A func Open(path string, mode int, perm uint32) (fd int, err error) { + if mode&O_ACCMODE == 0 { + mode |= O_RDONLY + } return open(path, mode, perm) } -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - wd, err := Getwd() - if err != nil { - return err +//sys openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) = SYS___OPENAT_A + +func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { + if flags&O_ACCMODE == 0 { + flags |= O_RDONLY } + return openat(dirfd, path, flags, mode) +} - if err := Fchdir(dirfd); err != nil { - return err +//sys openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) = SYS___OPENAT2_A + +func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) { + if how.Flags&O_ACCMODE == 0 { + how.Flags |= O_RDONLY } - defer Chdir(wd) + return openat2(dirfd, path, how, SizeofOpenHow) +} - return Mkfifo(path, mode) +func ZosFdToPath(dirfd int) (path string, err error) { + var buffer [1024]byte + runtime.EnterSyscall() + ret, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_W_IOCTL<<4, uintptr(dirfd), 17, 1024, uintptr(unsafe.Pointer(&buffer[0]))) + runtime.ExitSyscall() + if ret == 0 { + zb := bytes.IndexByte(buffer[:], 0) + if zb == -1 { + zb = len(buffer) + } + CallLeFuncWithErr(GetZosLibVec()+SYS___E2A_L<<4, uintptr(unsafe.Pointer(&buffer[0])), uintptr(zb)) + return string(buffer[:zb]), nil + } + return "", errnoErr2(e1, e2) } //sys remove(path string) (err error) @@ -403,10 +1044,12 @@ func Getcwd(buf []byte) (n int, err error) { } else { p = unsafe.Pointer(&_zero) } - _, _, e := syscall_syscall(SYS___GETCWD_A, uintptr(p), uintptr(len(buf)), 0) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___GETCWD_A<<4, uintptr(p), uintptr(len(buf))) + runtime.ExitSyscall() n = clen(buf) + 1 - if e != 0 { - err = errnoErr(e) + if r0 == 0 { + err = errnoErr2(e1, e2) } return } @@ -520,9 +1163,41 @@ func (w WaitStatus) StopSignal() Signal { func (w WaitStatus) TrapCause() int { return -1 } +//sys waitid(idType int, id int, info *Siginfo, options int) (err error) + +func Waitid(idType int, id int, info *Siginfo, options int, rusage *Rusage) (err error) { + return waitid(idType, id, info, options) +} + //sys waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) -func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { +func impl_Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_WAIT4<<4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage))) + runtime.ExitSyscall() + wpid = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_Wait4Addr() *(func(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error)) + +var Wait4 = enter_Wait4 + +func enter_Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + funcref := get_Wait4Addr() + if funcptrtest(GetZosLibVec()+SYS_WAIT4<<4, "") == 0 { + *funcref = impl_Wait4 + } else { + *funcref = legacyWait4 + } + return (*funcref)(pid, wstatus, options, rusage) +} + +func legacyWait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { // TODO(mundaym): z/OS doesn't have wait4. I don't think getrusage does what we want. // At the moment rusage will not be touched. var status _C_int @@ -571,23 +1246,62 @@ func Pipe(p []int) (err error) { } var pp [2]_C_int err = pipe(&pp) - if err == nil { - p[0] = int(pp[0]) - p[1] = int(pp[1]) - } + p[0] = int(pp[0]) + p[1] = int(pp[1]) return } //sys utimes(path string, timeval *[2]Timeval) (err error) = SYS___UTIMES_A func Utimes(path string, tv []Timeval) (err error) { + if tv == nil { + return utimes(path, nil) + } if len(tv) != 2 { return EINVAL } return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -func UtimesNano(path string, ts []Timespec) error { +//sys utimensat(dirfd int, path string, ts *[2]Timespec, flags int) (err error) = SYS___UTIMENSAT_A + +func validUtimensat() bool { + if funcptrtest(GetZosLibVec()+SYS___UTIMENSAT_A<<4, "") == 0 { + if name, err := getLeFuncName(GetZosLibVec() + SYS___UTIMENSAT_A<<4); err == nil { + return name == "__utimensat_a" + } + } + return false +} + +// Begin UtimesNano + +//go:nosplit +func get_UtimesNanoAddr() *(func(path string, ts []Timespec) (err error)) + +var UtimesNano = enter_UtimesNano + +func enter_UtimesNano(path string, ts []Timespec) (err error) { + funcref := get_UtimesNanoAddr() + if validUtimensat() { + *funcref = utimesNanoImpl + } else { + *funcref = legacyUtimesNano + } + return (*funcref)(path, ts) +} + +func utimesNanoImpl(path string, ts []Timespec) (err error) { + if ts == nil { + return utimensat(AT_FDCWD, path, nil, 0) + } + if len(ts) != 2 { + return EINVAL + } + return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) +} + +func legacyUtimesNano(path string, ts []Timespec) (err error) { if len(ts) != 2 { return EINVAL } @@ -600,6 +1314,70 @@ func UtimesNano(path string, ts []Timespec) error { return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } +// End UtimesNano + +// Begin UtimesNanoAt + +//go:nosplit +func get_UtimesNanoAtAddr() *(func(dirfd int, path string, ts []Timespec, flags int) (err error)) + +var UtimesNanoAt = enter_UtimesNanoAt + +func enter_UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) (err error) { + funcref := get_UtimesNanoAtAddr() + if validUtimensat() { + *funcref = utimesNanoAtImpl + } else { + *funcref = legacyUtimesNanoAt + } + return (*funcref)(dirfd, path, ts, flags) +} + +func utimesNanoAtImpl(dirfd int, path string, ts []Timespec, flags int) (err error) { + if ts == nil { + return utimensat(dirfd, path, nil, flags) + } + if len(ts) != 2 { + return EINVAL + } + return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags) +} + +func legacyUtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) (err error) { + if path[0] != '/' { + dirPath, err := ZosFdToPath(dirfd) + if err != nil { + return err + } + path = dirPath + "/" + path + } + if flags == AT_SYMLINK_NOFOLLOW { + if len(ts) != 2 { + return EINVAL + } + + if ts[0].Nsec >= 5e8 { + ts[0].Sec++ + } + ts[0].Nsec = 0 + if ts[1].Nsec >= 5e8 { + ts[1].Sec++ + } + ts[1].Nsec = 0 + + // Not as efficient as it could be because Timespec and + // Timeval have different types in the different OSes + tv := []Timeval{ + NsecToTimeval(TimespecToNsec(ts[0])), + NsecToTimeval(TimespecToNsec(ts[1])), + } + return Lutimes(path, tv) + } + return UtimesNano(path, ts) +} + +// End UtimesNanoAt + func Getsockname(fd int) (sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -1186,67 +1964,46 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) return n, nil } -func Opendir(name string) (uintptr, error) { - p, err := BytePtrFromString(name) - if err != nil { - return 0, err - } - dir, _, e := syscall_syscall(SYS___OPENDIR_A, uintptr(unsafe.Pointer(p)), 0, 0) - runtime.KeepAlive(unsafe.Pointer(p)) - if e != 0 { - err = errnoErr(e) - } - return dir, err -} - -// clearsyscall.Errno resets the errno value to 0. -func clearErrno() - -func Readdir(dir uintptr) (*Dirent, error) { - var ent Dirent - var res uintptr - // __readdir_r_a returns errno at the end of the directory stream, rather than 0. - // Therefore to avoid false positives we clear errno before calling it. - - // TODO(neeilan): Commented this out to get sys/unix compiling on z/OS. Uncomment and fix. Error: "undefined: clearsyscall" - //clearsyscall.Errno() // TODO(mundaym): check pre-emption rules. - - e, _, _ := syscall_syscall(SYS___READDIR_R_A, dir, uintptr(unsafe.Pointer(&ent)), uintptr(unsafe.Pointer(&res))) - var err error - if e != 0 { - err = errnoErr(Errno(e)) - } - if res == 0 { - return nil, err - } - return &ent, err -} - -func readdir_r(dirp uintptr, entry *direntLE, result **direntLE) (err error) { - r0, _, e1 := syscall_syscall(SYS___READDIR_R_A, dirp, uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - if int64(r0) == -1 { - err = errnoErr(Errno(e1)) +func Opendir(name string) (uintptr, error) { + p, err := BytePtrFromString(name) + if err != nil { + return 0, err } - return + err = nil + runtime.EnterSyscall() + dir, e2, e1 := CallLeFuncWithPtrReturn(GetZosLibVec()+SYS___OPENDIR_A<<4, uintptr(unsafe.Pointer(p))) + runtime.ExitSyscall() + runtime.KeepAlive(unsafe.Pointer(p)) + if dir == 0 { + err = errnoErr2(e1, e2) + } + return dir, err } +// clearsyscall.Errno resets the errno value to 0. +func clearErrno() + func Closedir(dir uintptr) error { - _, _, e := syscall_syscall(SYS_CLOSEDIR, dir, 0, 0) - if e != 0 { - return errnoErr(e) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_CLOSEDIR<<4, dir) + runtime.ExitSyscall() + if r0 != 0 { + return errnoErr2(e1, e2) } return nil } func Seekdir(dir uintptr, pos int) { - _, _, _ = syscall_syscall(SYS_SEEKDIR, dir, uintptr(pos), 0) + runtime.EnterSyscall() + CallLeFuncWithErr(GetZosLibVec()+SYS_SEEKDIR<<4, dir, uintptr(pos)) + runtime.ExitSyscall() } func Telldir(dir uintptr) (int, error) { - p, _, e := syscall_syscall(SYS_TELLDIR, dir, 0, 0) + p, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_TELLDIR<<4, dir) pos := int(p) - if pos == -1 { - return pos, errnoErr(e) + if int64(p) == -1 { + return pos, errnoErr2(e1, e2) } return pos, nil } @@ -1261,19 +2018,55 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { *(*int64)(unsafe.Pointer(&flock[4])) = lk.Start *(*int64)(unsafe.Pointer(&flock[12])) = lk.Len *(*int32)(unsafe.Pointer(&flock[20])) = lk.Pid - _, _, errno := syscall_syscall(SYS_FCNTL, fd, uintptr(cmd), uintptr(unsafe.Pointer(&flock))) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, fd, uintptr(cmd), uintptr(unsafe.Pointer(&flock))) + runtime.ExitSyscall() lk.Type = *(*int16)(unsafe.Pointer(&flock[0])) lk.Whence = *(*int16)(unsafe.Pointer(&flock[2])) lk.Start = *(*int64)(unsafe.Pointer(&flock[4])) lk.Len = *(*int64)(unsafe.Pointer(&flock[12])) lk.Pid = *(*int32)(unsafe.Pointer(&flock[20])) - if errno == 0 { + if r0 == 0 { return nil } - return errno + return errnoErr2(e1, e2) +} + +func impl_Flock(fd int, how int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FLOCK<<4, uintptr(fd), uintptr(how)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FlockAddr() *(func(fd int, how int) (err error)) + +var Flock = enter_Flock + +func validFlock(fp uintptr) bool { + if funcptrtest(GetZosLibVec()+SYS_FLOCK<<4, "") == 0 { + if name, err := getLeFuncName(GetZosLibVec() + SYS_FLOCK<<4); err == nil { + return name == "flock" + } + } + return false +} + +func enter_Flock(fd int, how int) (err error) { + funcref := get_FlockAddr() + if validFlock(GetZosLibVec() + SYS_FLOCK<<4) { + *funcref = impl_Flock + } else { + *funcref = legacyFlock + } + return (*funcref)(fd, how) } -func Flock(fd int, how int) error { +func legacyFlock(fd int, how int) error { var flock_type int16 var fcntl_cmd int @@ -1307,41 +2100,51 @@ func Flock(fd int, how int) error { } func Mlock(b []byte) (err error) { - _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MLOCKALL<<4, _BPX_NONSWAP) + runtime.ExitSyscall() + if r0 != 0 { + err = errnoErr2(e1, e2) } return } func Mlock2(b []byte, flags int) (err error) { - _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MLOCKALL<<4, _BPX_NONSWAP) + runtime.ExitSyscall() + if r0 != 0 { + err = errnoErr2(e1, e2) } return } func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MLOCKALL<<4, _BPX_NONSWAP) + runtime.ExitSyscall() + if r0 != 0 { + err = errnoErr2(e1, e2) } return } func Munlock(b []byte) (err error) { - _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MLOCKALL<<4, _BPX_SWAP) + runtime.ExitSyscall() + if r0 != 0 { + err = errnoErr2(e1, e2) } return } func Munlockall() (err error) { - _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MLOCKALL<<4, _BPX_SWAP) + runtime.ExitSyscall() + if r0 != 0 { + err = errnoErr2(e1, e2) } return } @@ -1372,15 +2175,104 @@ func ClockGettime(clockid int32, ts *Timespec) error { return nil } -func Statfs(path string, stat *Statfs_t) (err error) { - fd, err := open(path, O_RDONLY, 0) - defer Close(fd) - if err != nil { - return err +// Chtag + +//go:nosplit +func get_ChtagAddr() *(func(path string, ccsid uint64, textbit uint64) error) + +var Chtag = enter_Chtag + +func enter_Chtag(path string, ccsid uint64, textbit uint64) error { + funcref := get_ChtagAddr() + if validSetxattr() { + *funcref = impl_Chtag + } else { + *funcref = legacy_Chtag + } + return (*funcref)(path, ccsid, textbit) +} + +func legacy_Chtag(path string, ccsid uint64, textbit uint64) error { + tag := ccsid<<16 | textbit<<15 + var tag_buff [8]byte + DecodeData(tag_buff[:], 8, tag) + return Setxattr(path, "filetag", tag_buff[:], XATTR_REPLACE) +} + +func impl_Chtag(path string, ccsid uint64, textbit uint64) error { + tag := ccsid<<16 | textbit<<15 + var tag_buff [4]byte + DecodeData(tag_buff[:], 4, tag) + return Setxattr(path, "system.filetag", tag_buff[:], XATTR_REPLACE) +} + +// End of Chtag + +// Nanosleep + +//go:nosplit +func get_NanosleepAddr() *(func(time *Timespec, leftover *Timespec) error) + +var Nanosleep = enter_Nanosleep + +func enter_Nanosleep(time *Timespec, leftover *Timespec) error { + funcref := get_NanosleepAddr() + if funcptrtest(GetZosLibVec()+SYS_NANOSLEEP<<4, "") == 0 { + *funcref = impl_Nanosleep + } else { + *funcref = legacyNanosleep + } + return (*funcref)(time, leftover) +} + +func impl_Nanosleep(time *Timespec, leftover *Timespec) error { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_NANOSLEEP<<4, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover))) + runtime.ExitSyscall() + if int64(r0) == -1 { + return errnoErr2(e1, e2) + } + return nil +} + +func legacyNanosleep(time *Timespec, leftover *Timespec) error { + t0 := runtime.Nanotime1() + var secrem uint32 + var nsecrem uint32 + total := time.Sec*1000000000 + time.Nsec + elapsed := runtime.Nanotime1() - t0 + var rv int32 + var rc int32 + var err error + // repeatedly sleep for 1 second until less than 1 second left + for total-elapsed > 1000000000 { + rv, rc, _ = BpxCondTimedWait(uint32(1), uint32(0), uint32(CW_CONDVAR), &secrem, &nsecrem) + if rv != 0 && rc != 112 { // 112 is EAGAIN + if leftover != nil && rc == 120 { // 120 is EINTR + leftover.Sec = int64(secrem) + leftover.Nsec = int64(nsecrem) + } + err = Errno(rc) + return err + } + elapsed = runtime.Nanotime1() - t0 } - return Fstatfs(fd, stat) + // sleep the remainder + if total > elapsed { + rv, rc, _ = BpxCondTimedWait(uint32(0), uint32(total-elapsed), uint32(CW_CONDVAR), &secrem, &nsecrem) + } + if leftover != nil && rc == 120 { + leftover.Sec = int64(secrem) + leftover.Nsec = int64(nsecrem) + } + if rv != 0 && rc != 112 { + err = Errno(rc) + } + return err } +// End of Nanosleep + var ( Stdin = 0 Stdout = 1 @@ -1395,6 +2287,9 @@ var ( errENOENT error = syscall.ENOENT ) +var ZosTraceLevel int +var ZosTracefile *os.File + var ( signalNameMapOnce sync.Once signalNameMap map[string]syscall.Signal @@ -1416,6 +2311,56 @@ func errnoErr(e Errno) error { return e } +var reg *regexp.Regexp + +// enhanced with zos specific errno2 +func errnoErr2(e Errno, e2 uintptr) error { + switch e { + case 0: + return nil + case EAGAIN: + return errEAGAIN + /* + Allow the retrieval of errno2 for EINVAL and ENOENT on zos + case EINVAL: + return errEINVAL + case ENOENT: + return errENOENT + */ + } + if ZosTraceLevel > 0 { + var name string + if reg == nil { + reg = regexp.MustCompile("(^unix\\.[^/]+$|.*\\/unix\\.[^/]+$)") + } + i := 1 + pc, file, line, ok := runtime.Caller(i) + if ok { + name = runtime.FuncForPC(pc).Name() + } + for ok && reg.MatchString(runtime.FuncForPC(pc).Name()) { + i += 1 + pc, file, line, ok = runtime.Caller(i) + } + if ok { + if ZosTracefile == nil { + ZosConsolePrintf("From %s:%d\n", file, line) + ZosConsolePrintf("%s: %s (errno2=0x%x)\n", name, e.Error(), e2) + } else { + fmt.Fprintf(ZosTracefile, "From %s:%d\n", file, line) + fmt.Fprintf(ZosTracefile, "%s: %s (errno2=0x%x)\n", name, e.Error(), e2) + } + } else { + if ZosTracefile == nil { + ZosConsolePrintf("%s (errno2=0x%x)\n", e.Error(), e2) + } else { + fmt.Fprintf(ZosTracefile, "%s (errno2=0x%x)\n", e.Error(), e2) + } + } + } + return e +} + // ErrnoName returns the error name for error number e. func ErrnoName(e Errno) string { i := sort.Search(len(errorList), func(i int) bool { @@ -1474,6 +2419,9 @@ func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (d return nil, EINVAL } + // Set __MAP_64 by default + flags |= __MAP_64 + // Map the requested memory. addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset) if errno != nil { @@ -1778,83 +2726,170 @@ func Exec(argv0 string, argv []string, envv []string) error { return syscall.Exec(argv0, argv, envv) } -func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { +func Getag(path string) (ccsid uint16, flag uint16, err error) { + var val [8]byte + sz, err := Getxattr(path, "ccsid", val[:]) + if err != nil { + return + } + ccsid = uint16(EncodeData(val[0:sz])) + sz, err = Getxattr(path, "flags", val[:]) + if err != nil { + return + } + flag = uint16(EncodeData(val[0:sz]) >> 15) + return +} + +// Mount begin +func impl_Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(source) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(target) + if err != nil { + return + } + var _p2 *byte + _p2, err = BytePtrFromString(fstype) + if err != nil { + return + } + var _p3 *byte + _p3, err = BytePtrFromString(data) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MOUNT1_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(_p3))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_MountAddr() *(func(source string, target string, fstype string, flags uintptr, data string) (err error)) + +var Mount = enter_Mount + +func enter_Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { + funcref := get_MountAddr() + if validMount() { + *funcref = impl_Mount + } else { + *funcref = legacyMount + } + return (*funcref)(source, target, fstype, flags, data) +} + +func legacyMount(source string, target string, fstype string, flags uintptr, data string) (err error) { if needspace := 8 - len(fstype); needspace <= 0 { - fstype = fstype[:8] + fstype = fstype[0:8] } else { - fstype += " "[:needspace] + fstype += " "[0:needspace] } return mount_LE(target, source, fstype, uint32(flags), int32(len(data)), data) } -func Unmount(name string, mtm int) (err error) { +func validMount() bool { + if funcptrtest(GetZosLibVec()+SYS___MOUNT1_A<<4, "") == 0 { + if name, err := getLeFuncName(GetZosLibVec() + SYS___MOUNT1_A<<4); err == nil { + return name == "__mount1_a" + } + } + return false +} + +// Mount end + +// Unmount begin +func impl_Unmount(target string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(target) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UMOUNT2_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_UnmountAddr() *(func(target string, flags int) (err error)) + +var Unmount = enter_Unmount + +func enter_Unmount(target string, flags int) (err error) { + funcref := get_UnmountAddr() + if funcptrtest(GetZosLibVec()+SYS___UMOUNT2_A<<4, "") == 0 { + *funcref = impl_Unmount + } else { + *funcref = legacyUnmount + } + return (*funcref)(target, flags) +} + +func legacyUnmount(name string, mtm int) (err error) { // mountpoint is always a full path and starts with a '/' // check if input string is not a mountpoint but a filesystem name if name[0] != '/' { - return unmount(name, mtm) + return unmount_LE(name, mtm) } // treat name as mountpoint b2s := func(arr []byte) string { - nulli := bytes.IndexByte(arr, 0) - if nulli == -1 { - return string(arr) - } else { - return string(arr[:nulli]) + var str string + for i := 0; i < len(arr); i++ { + if arr[i] == 0 { + str = string(arr[:i]) + break + } } + return str } var buffer struct { header W_Mnth fsinfo [64]W_Mntent } - fsCount, err := W_Getmntent_A((*byte)(unsafe.Pointer(&buffer)), int(unsafe.Sizeof(buffer))) - if err != nil { - return err - } - if fsCount == 0 { - return EINVAL - } - for i := 0; i < fsCount; i++ { - if b2s(buffer.fsinfo[i].Mountpoint[:]) == name { - err = unmount(b2s(buffer.fsinfo[i].Fsname[:]), mtm) - break + fs_count, err := W_Getmntent_A((*byte)(unsafe.Pointer(&buffer)), int(unsafe.Sizeof(buffer))) + if err == nil { + err = EINVAL + for i := 0; i < fs_count; i++ { + if b2s(buffer.fsinfo[i].Mountpoint[:]) == name { + err = unmount_LE(b2s(buffer.fsinfo[i].Fsname[:]), mtm) + break + } } + } else if fs_count == 0 { + err = EINVAL } return err } -func fdToPath(dirfd int) (path string, err error) { - var buffer [1024]byte - // w_ctrl() - ret := runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_W_IOCTL<<4, - []uintptr{uintptr(dirfd), 17, 1024, uintptr(unsafe.Pointer(&buffer[0]))}) - if ret == 0 { - zb := bytes.IndexByte(buffer[:], 0) - if zb == -1 { - zb = len(buffer) - } - // __e2a_l() - runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___E2A_L<<4, - []uintptr{uintptr(unsafe.Pointer(&buffer[0])), uintptr(zb)}) - return string(buffer[:zb]), nil - } - // __errno() - errno := int(*(*int32)(unsafe.Pointer(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO<<4, - []uintptr{})))) - // __errno2() - errno2 := int(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO2<<4, - []uintptr{})) - // strerror_r() - ret = runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_STRERROR_R<<4, - []uintptr{uintptr(errno), uintptr(unsafe.Pointer(&buffer[0])), 1024}) - if ret == 0 { - zb := bytes.IndexByte(buffer[:], 0) - if zb == -1 { - zb = len(buffer) - } - return "", fmt.Errorf("%s (errno2=0x%x)", buffer[:zb], errno2) - } else { - return "", fmt.Errorf("fdToPath errno %d (errno2=0x%x)", errno, errno2) +// Unmount end + +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + reclen, ok := direntReclen(buf) + if !ok { + return 0, false } + return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true } func direntLeToDirentUnix(dirent *direntLE, dir uintptr, path string) (Dirent, error) { @@ -1896,7 +2931,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { } // Get path from fd to avoid unavailable call (fdopendir) - path, err := fdToPath(fd) + path, err := ZosFdToPath(fd) if err != nil { return 0, err } @@ -1910,7 +2945,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { for { var entryLE direntLE var entrypLE *direntLE - e := readdir_r(d, &entryLE, &entrypLE) + e := Readdir_r(d, &entryLE, &entrypLE) if e != nil { return n, e } @@ -1956,23 +2991,127 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return n, nil } -func ReadDirent(fd int, buf []byte) (n int, err error) { - var base = (*uintptr)(unsafe.Pointer(new(uint64))) - return Getdirentries(fd, buf, base) +func Err2ad() (eadd *int) { + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS___ERR2AD<<4) + eadd = (*int)(unsafe.Pointer(r0)) + return } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +func ZosConsolePrintf(format string, v ...interface{}) (int, error) { + type __cmsg struct { + _ uint16 + _ [2]uint8 + __msg_length uint32 + __msg uintptr + _ [4]uint8 + } + msg := fmt.Sprintf(format, v...) + strptr := unsafe.Pointer((*reflect.StringHeader)(unsafe.Pointer(&msg)).Data) + len := (*reflect.StringHeader)(unsafe.Pointer(&msg)).Len + cmsg := __cmsg{__msg_length: uint32(len), __msg: uintptr(strptr)} + cmd := uint32(0) + runtime.EnterSyscall() + rc, err2, err1 := CallLeFuncWithErr(GetZosLibVec()+SYS_____CONSOLE_A<<4, uintptr(unsafe.Pointer(&cmsg)), 0, uintptr(unsafe.Pointer(&cmd))) + runtime.ExitSyscall() + if rc != 0 { + return 0, fmt.Errorf("%s (errno2=0x%x)\n", err1.Error(), err2) + } + return 0, nil +} +func ZosStringToEbcdicBytes(str string, nullterm bool) (ebcdicBytes []byte) { + if nullterm { + ebcdicBytes = []byte(str + "\x00") + } else { + ebcdicBytes = []byte(str) + } + A2e(ebcdicBytes) + return +} +func ZosEbcdicBytesToString(b []byte, trimRight bool) (str string) { + res := make([]byte, len(b)) + copy(res, b) + E2a(res) + if trimRight { + str = string(bytes.TrimRight(res, " \x00")) + } else { + str = string(res) + } + return } -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +func fdToPath(dirfd int) (path string, err error) { + var buffer [1024]byte + // w_ctrl() + ret := runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_W_IOCTL<<4, + []uintptr{uintptr(dirfd), 17, 1024, uintptr(unsafe.Pointer(&buffer[0]))}) + if ret == 0 { + zb := bytes.IndexByte(buffer[:], 0) + if zb == -1 { + zb = len(buffer) + } + // __e2a_l() + runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___E2A_L<<4, + []uintptr{uintptr(unsafe.Pointer(&buffer[0])), uintptr(zb)}) + return string(buffer[:zb]), nil + } + // __errno() + errno := int(*(*int32)(unsafe.Pointer(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO<<4, + []uintptr{})))) + // __errno2() + errno2 := int(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO2<<4, + []uintptr{})) + // strerror_r() + ret = runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_STRERROR_R<<4, + []uintptr{uintptr(errno), uintptr(unsafe.Pointer(&buffer[0])), 1024}) + if ret == 0 { + zb := bytes.IndexByte(buffer[:], 0) + if zb == -1 { + zb = len(buffer) + } + return "", fmt.Errorf("%s (errno2=0x%x)", buffer[:zb], errno2) + } else { + return "", fmt.Errorf("fdToPath errno %d (errno2=0x%x)", errno, errno2) + } } -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false +func impl_Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKFIFOAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_MkfifoatAddr() *(func(dirfd int, path string, mode uint32) (err error)) + +var Mkfifoat = enter_Mkfifoat + +func enter_Mkfifoat(dirfd int, path string, mode uint32) (err error) { + funcref := get_MkfifoatAddr() + if funcptrtest(GetZosLibVec()+SYS___MKFIFOAT_A<<4, "") == 0 { + *funcref = impl_Mkfifoat + } else { + *funcref = legacy_Mkfifoat + } + return (*funcref)(dirfd, path, mode) +} + +func legacy_Mkfifoat(dirfd int, path string, mode uint32) (err error) { + dirname, err := ZosFdToPath(dirfd) + if err != nil { + return err + } + return Mkfifo(dirname+"/"+path, mode) } + +//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT +//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT +//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 79a84f18..672d6b0a 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (darwin && !ios) || linux +//go:build (darwin && !ios) || linux || zos package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go index 9eb0db66..8b7977a2 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build darwin && !ios +//go:build (darwin && !ios) || zos package unix diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 36bf8399..93a38a97 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -491,6 +491,7 @@ const ( BPF_F_REPLACE = 0x4 BPF_F_SLEEPABLE = 0x10 BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_TEST_REG_INVARIANTS = 0x80 BPF_F_TEST_RND_HI32 = 0x4 BPF_F_TEST_RUN_ON_CPU = 0x1 BPF_F_TEST_STATE_FREQ = 0x8 @@ -1697,6 +1698,7 @@ const ( KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 + KEXEC_FILE_DEBUG = 0x8 KEXEC_FILE_NO_INITRAMFS = 0x4 KEXEC_FILE_ON_CRASH = 0x2 KEXEC_FILE_UNLOAD = 0x1 @@ -1898,6 +1900,7 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 + MNT_ID_REQ_SIZE_VER0 = 0x18 MODULE_INIT_COMPRESSED_FILE = 0x4 MODULE_INIT_IGNORE_MODVERSIONS = 0x1 MODULE_INIT_IGNORE_VERMAGIC = 0x2 @@ -2302,6 +2305,7 @@ const ( PERF_AUX_FLAG_PARTIAL = 0x4 PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00 PERF_AUX_FLAG_TRUNCATED = 0x1 + PERF_BRANCH_ENTRY_INFO_BITS_MAX = 0x21 PERF_BR_ARM64_DEBUG_DATA = 0x7 PERF_BR_ARM64_DEBUG_EXIT = 0x5 PERF_BR_ARM64_DEBUG_HALT = 0x4 @@ -3168,6 +3172,7 @@ const ( STATX_GID = 0x10 STATX_INO = 0x100 STATX_MNT_ID = 0x1000 + STATX_MNT_ID_UNIQUE = 0x4000 STATX_MODE = 0x2 STATX_MTIME = 0x40 STATX_NLINK = 0x4 @@ -3562,12 +3567,16 @@ const ( XDP_RX_RING = 0x2 XDP_SHARED_UMEM = 0x1 XDP_STATISTICS = 0x7 + XDP_TXMD_FLAGS_CHECKSUM = 0x2 + XDP_TXMD_FLAGS_TIMESTAMP = 0x1 + XDP_TX_METADATA = 0x2 XDP_TX_RING = 0x3 XDP_UMEM_COMPLETION_RING = 0x6 XDP_UMEM_FILL_RING = 0x5 XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000 XDP_UMEM_PGOFF_FILL_RING = 0x100000000 XDP_UMEM_REG = 0x4 + XDP_UMEM_TX_SW_CSUM = 0x2 XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1 XDP_USE_NEED_WAKEUP = 0x8 XDP_USE_SG = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index 4dfd2e05..da08b2ab 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -10,41 +10,99 @@ package unix const ( - BRKINT = 0x0001 - CLOCK_MONOTONIC = 0x1 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x3 - CS8 = 0x0030 - CSIZE = 0x0030 - ECHO = 0x00000008 - ECHONL = 0x00000001 - FD_CLOEXEC = 0x01 - FD_CLOFORK = 0x02 - FNDELAY = 0x04 - F_CLOSFD = 9 - F_CONTROL_CVT = 13 - F_DUPFD = 0 - F_DUPFD2 = 8 - F_GETFD = 1 - F_GETFL = 259 - F_GETLK = 5 - F_GETOWN = 10 - F_OK = 0x0 - F_RDLCK = 1 - F_SETFD = 2 - F_SETFL = 4 - F_SETLK = 6 - F_SETLKW = 7 - F_SETOWN = 11 - F_SETTAG = 12 - F_UNLCK = 3 - F_WRLCK = 2 - FSTYPE_ZFS = 0xe9 //"Z" - FSTYPE_HFS = 0xc8 //"H" - FSTYPE_NFS = 0xd5 //"N" - FSTYPE_TFS = 0xe3 //"T" - FSTYPE_AUTOMOUNT = 0xc1 //"A" + BRKINT = 0x0001 + CLOCAL = 0x1 + CLOCK_MONOTONIC = 0x1 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x3 + CLONE_NEWIPC = 0x08000000 + CLONE_NEWNET = 0x40000000 + CLONE_NEWNS = 0x00020000 + CLONE_NEWPID = 0x20000000 + CLONE_NEWUTS = 0x04000000 + CLONE_PARENT = 0x00008000 + CS8 = 0x0030 + CSIZE = 0x0030 + ECHO = 0x00000008 + ECHONL = 0x00000001 + EFD_SEMAPHORE = 0x00002000 + EFD_CLOEXEC = 0x00001000 + EFD_NONBLOCK = 0x00000004 + EPOLL_CLOEXEC = 0x00001000 + EPOLL_CTL_ADD = 0 + EPOLL_CTL_MOD = 1 + EPOLL_CTL_DEL = 2 + EPOLLRDNORM = 0x0001 + EPOLLRDBAND = 0x0002 + EPOLLIN = 0x0003 + EPOLLOUT = 0x0004 + EPOLLWRBAND = 0x0008 + EPOLLPRI = 0x0010 + EPOLLERR = 0x0020 + EPOLLHUP = 0x0040 + EPOLLEXCLUSIVE = 0x20000000 + EPOLLONESHOT = 0x40000000 + FD_CLOEXEC = 0x01 + FD_CLOFORK = 0x02 + FD_SETSIZE = 0x800 + FNDELAY = 0x04 + F_CLOSFD = 9 + F_CONTROL_CVT = 13 + F_DUPFD = 0 + F_DUPFD2 = 8 + F_GETFD = 1 + F_GETFL = 259 + F_GETLK = 5 + F_GETOWN = 10 + F_OK = 0x0 + F_RDLCK = 1 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 6 + F_SETLKW = 7 + F_SETOWN = 11 + F_SETTAG = 12 + F_UNLCK = 3 + F_WRLCK = 2 + FSTYPE_ZFS = 0xe9 //"Z" + FSTYPE_HFS = 0xc8 //"H" + FSTYPE_NFS = 0xd5 //"N" + FSTYPE_TFS = 0xe3 //"T" + FSTYPE_AUTOMOUNT = 0xc1 //"A" + GRND_NONBLOCK = 1 + GRND_RANDOM = 2 + HUPCL = 0x0100 // Hang up on last close + IN_CLOEXEC = 0x00001000 + IN_NONBLOCK = 0x00000004 + IN_ACCESS = 0x00000001 + IN_MODIFY = 0x00000002 + IN_ATTRIB = 0x00000004 + IN_CLOSE_WRITE = 0x00000008 + IN_CLOSE_NOWRITE = 0x00000010 + IN_OPEN = 0x00000020 + IN_MOVED_FROM = 0x00000040 + IN_MOVED_TO = 0x00000080 + IN_CREATE = 0x00000100 + IN_DELETE = 0x00000200 + IN_DELETE_SELF = 0x00000400 + IN_MOVE_SELF = 0x00000800 + IN_UNMOUNT = 0x00002000 + IN_Q_OVERFLOW = 0x00004000 + IN_IGNORED = 0x00008000 + IN_CLOSE = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) + IN_MOVE = (IN_MOVED_FROM | IN_MOVED_TO) + IN_ALL_EVENTS = (IN_ACCESS | IN_MODIFY | IN_ATTRIB | + IN_CLOSE | IN_OPEN | IN_MOVE | + IN_CREATE | IN_DELETE | IN_DELETE_SELF | + IN_MOVE_SELF) + IN_ONLYDIR = 0x01000000 + IN_DONT_FOLLOW = 0x02000000 + IN_EXCL_UNLINK = 0x04000000 + IN_MASK_CREATE = 0x10000000 + IN_MASK_ADD = 0x20000000 + IN_ISDIR = 0x40000000 + IN_ONESHOT = 0x80000000 IP6F_MORE_FRAG = 0x0001 IP6F_OFF_MASK = 0xfff8 IP6F_RESERVED_MASK = 0x0006 @@ -152,10 +210,18 @@ const ( IP_PKTINFO = 101 IP_RECVPKTINFO = 102 IP_TOS = 2 - IP_TTL = 3 + IP_TTL = 14 IP_UNBLOCK_SOURCE = 11 + ICMP6_FILTER = 1 + MCAST_INCLUDE = 0 + MCAST_EXCLUDE = 1 + MCAST_JOIN_GROUP = 40 + MCAST_LEAVE_GROUP = 41 + MCAST_JOIN_SOURCE_GROUP = 42 + MCAST_LEAVE_SOURCE_GROUP = 43 + MCAST_BLOCK_SOURCE = 44 + MCAST_UNBLOCK_SOURCE = 46 ICANON = 0x0010 - ICMP6_FILTER = 0x26 ICRNL = 0x0002 IEXTEN = 0x0020 IGNBRK = 0x0004 @@ -165,10 +231,10 @@ const ( ISTRIP = 0x0080 IXON = 0x0200 IXOFF = 0x0100 - LOCK_SH = 0x1 // Not exist on zOS - LOCK_EX = 0x2 // Not exist on zOS - LOCK_NB = 0x4 // Not exist on zOS - LOCK_UN = 0x8 // Not exist on zOS + LOCK_SH = 0x1 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_UN = 0x8 POLLIN = 0x0003 POLLOUT = 0x0004 POLLPRI = 0x0010 @@ -182,15 +248,29 @@ const ( MAP_PRIVATE = 0x1 // changes are private MAP_SHARED = 0x2 // changes are shared MAP_FIXED = 0x4 // place exactly - MCAST_JOIN_GROUP = 40 - MCAST_LEAVE_GROUP = 41 - MCAST_JOIN_SOURCE_GROUP = 42 - MCAST_LEAVE_SOURCE_GROUP = 43 - MCAST_BLOCK_SOURCE = 44 - MCAST_UNBLOCK_SOURCE = 45 + __MAP_MEGA = 0x8 + __MAP_64 = 0x10 + MAP_ANON = 0x20 + MAP_ANONYMOUS = 0x20 MS_SYNC = 0x1 // msync - synchronous writes MS_ASYNC = 0x2 // asynchronous writes MS_INVALIDATE = 0x4 // invalidate mappings + MS_BIND = 0x00001000 + MS_MOVE = 0x00002000 + MS_NOSUID = 0x00000002 + MS_PRIVATE = 0x00040000 + MS_REC = 0x00004000 + MS_REMOUNT = 0x00008000 + MS_RDONLY = 0x00000001 + MS_UNBINDABLE = 0x00020000 + MNT_DETACH = 0x00000004 + ZOSDSFS_SUPER_MAGIC = 0x44534653 // zOS DSFS + NFS_SUPER_MAGIC = 0x6969 // NFS + NSFS_MAGIC = 0x6e736673 // PROCNS + PROC_SUPER_MAGIC = 0x9fa0 // proc FS + ZOSTFS_SUPER_MAGIC = 0x544653 // zOS TFS + ZOSUFS_SUPER_MAGIC = 0x554653 // zOS UFS + ZOSZFS_SUPER_MAGIC = 0x5A4653 // zOS ZFS MTM_RDONLY = 0x80000000 MTM_RDWR = 0x40000000 MTM_UMOUNT = 0x10000000 @@ -205,13 +285,20 @@ const ( MTM_REMOUNT = 0x00000100 MTM_NOSECURITY = 0x00000080 NFDBITS = 0x20 + ONLRET = 0x0020 // NL performs CR function O_ACCMODE = 0x03 O_APPEND = 0x08 O_ASYNCSIG = 0x0200 O_CREAT = 0x80 + O_DIRECT = 0x00002000 + O_NOFOLLOW = 0x00004000 + O_DIRECTORY = 0x00008000 + O_PATH = 0x00080000 + O_CLOEXEC = 0x00001000 O_EXCL = 0x40 O_GETFL = 0x0F O_LARGEFILE = 0x0400 + O_NDELAY = 0x4 O_NONBLOCK = 0x04 O_RDONLY = 0x02 O_RDWR = 0x03 @@ -248,6 +335,7 @@ const ( AF_IUCV = 17 AF_LAT = 14 AF_LINK = 18 + AF_LOCAL = AF_UNIX // AF_LOCAL is an alias for AF_UNIX AF_MAX = 30 AF_NBS = 7 AF_NDD = 23 @@ -285,15 +373,33 @@ const ( RLIMIT_AS = 5 RLIMIT_NOFILE = 6 RLIMIT_MEMLIMIT = 7 + RLIMIT_MEMLOCK = 0x8 RLIM_INFINITY = 2147483647 + SCHED_FIFO = 0x2 + SCM_CREDENTIALS = 0x2 SCM_RIGHTS = 0x01 SF_CLOSE = 0x00000002 SF_REUSE = 0x00000001 + SHM_RND = 0x2 + SHM_RDONLY = 0x1 + SHMLBA = 0x1000 + IPC_STAT = 0x3 + IPC_SET = 0x2 + IPC_RMID = 0x1 + IPC_PRIVATE = 0x0 + IPC_CREAT = 0x1000000 + __IPC_MEGA = 0x4000000 + __IPC_SHAREAS = 0x20000000 + __IPC_BELOWBAR = 0x10000000 + IPC_EXCL = 0x2000000 + __IPC_GIGA = 0x8000000 SHUT_RD = 0 SHUT_RDWR = 2 SHUT_WR = 1 + SOCK_CLOEXEC = 0x00001000 SOCK_CONN_DGRAM = 6 SOCK_DGRAM = 2 + SOCK_NONBLOCK = 0x800 SOCK_RAW = 3 SOCK_RDM = 4 SOCK_SEQPACKET = 5 @@ -378,8 +484,6 @@ const ( S_IFMST = 0x00FF0000 TCP_KEEPALIVE = 0x8 TCP_NODELAY = 0x1 - TCP_INFO = 0xb - TCP_USER_TIMEOUT = 0x1 TIOCGWINSZ = 0x4008a368 TIOCSWINSZ = 0x8008a367 TIOCSBRK = 0x2000a77b @@ -427,7 +531,10 @@ const ( VSUSP = 9 VTIME = 10 WCONTINUED = 0x4 + WEXITED = 0x8 WNOHANG = 0x1 + WNOWAIT = 0x20 + WSTOPPED = 0x10 WUNTRACED = 0x2 _BPX_SWAP = 1 _BPX_NONSWAP = 2 @@ -452,8 +559,28 @@ const ( MADV_FREE = 15 // for Linux compatibility -- no zos semantics MADV_WIPEONFORK = 16 // for Linux compatibility -- no zos semantics MADV_KEEPONFORK = 17 // for Linux compatibility -- no zos semantics - AT_SYMLINK_NOFOLLOW = 1 // for Unix compatibility -- no zos semantics - AT_FDCWD = 2 // for Unix compatibility -- no zos semantics + AT_SYMLINK_FOLLOW = 0x400 + AT_SYMLINK_NOFOLLOW = 0x100 + XATTR_CREATE = 0x1 + XATTR_REPLACE = 0x2 + P_PID = 0 + P_PGID = 1 + P_ALL = 2 + PR_SET_NAME = 15 + PR_GET_NAME = 16 + PR_SET_NO_NEW_PRIVS = 38 + PR_GET_NO_NEW_PRIVS = 39 + PR_SET_DUMPABLE = 4 + PR_GET_DUMPABLE = 3 + PR_SET_PDEATHSIG = 1 + PR_GET_PDEATHSIG = 2 + PR_SET_CHILD_SUBREAPER = 36 + PR_GET_CHILD_SUBREAPER = 37 + AT_FDCWD = -100 + AT_EACCESS = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_REMOVEDIR = 0x200 + RENAME_NOREPLACE = 1 << 0 ) const ( @@ -476,6 +603,7 @@ const ( EMLINK = Errno(125) ENAMETOOLONG = Errno(126) ENFILE = Errno(127) + ENOATTR = Errno(265) ENODEV = Errno(128) ENOENT = Errno(129) ENOEXEC = Errno(130) @@ -700,7 +828,7 @@ var errorList = [...]struct { {145, "EDC5145I", "The parameter list is too long, or the message to receive was too large for the buffer."}, {146, "EDC5146I", "Too many levels of symbolic links."}, {147, "EDC5147I", "Illegal byte sequence."}, - {148, "", ""}, + {148, "EDC5148I", "The named attribute or data not available."}, {149, "EDC5149I", "Value Overflow Error."}, {150, "EDC5150I", "UNIX System Services is not active."}, {151, "EDC5151I", "Dynamic allocation error."}, @@ -743,6 +871,7 @@ var errorList = [...]struct { {259, "EDC5259I", "A CUN_RS_NO_CONVERSION error was issued by Unicode Services."}, {260, "EDC5260I", "A CUN_RS_TABLE_NOT_ALIGNED error was issued by Unicode Services."}, {262, "EDC5262I", "An iconv() function encountered an unexpected error while using Unicode Services."}, + {265, "EDC5265I", "The named attribute not available."}, {1000, "EDC8000I", "A bad socket-call constant was found in the IUCV header."}, {1001, "EDC8001I", "An error was found in the IUCV header."}, {1002, "EDC8002I", "A socket descriptor is out of range."}, diff --git a/vendor/golang.org/x/sys/unix/zsymaddr_zos_s390x.s b/vendor/golang.org/x/sys/unix/zsymaddr_zos_s390x.s new file mode 100644 index 00000000..b77ff5db --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsymaddr_zos_s390x.s @@ -0,0 +1,364 @@ +// go run mksyscall_zos_s390x.go -o_sysnum zsysnum_zos_s390x.go -o_syscall zsyscall_zos_s390x.go -i_syscall syscall_zos_s390x.go -o_asm zsymaddr_zos_s390x.s +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build zos && s390x +#include "textflag.h" + +// provide the address of function variable to be fixed up. + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FlistxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Flistxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FremovexattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fremovexattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FgetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fgetxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FsetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fsetxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_accept4Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·accept4(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_RemovexattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Removexattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_Dup3Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Dup3(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_DirfdAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Dirfd(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EpollCreateAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·EpollCreate(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EpollCreate1Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·EpollCreate1(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EpollCtlAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·EpollCtl(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EpollPwaitAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·EpollPwait(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EpollWaitAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·EpollWait(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_EventfdAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Eventfd(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FaccessatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Faccessat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FchmodatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fchmodat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FchownatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fchownat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FdatasyncAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fdatasync(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_fstatatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·fstatat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LgetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Lgetxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LsetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Lsetxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FstatfsAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Fstatfs(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FutimesAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Futimes(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_FutimesatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Futimesat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_GetrandomAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Getrandom(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_InotifyInitAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·InotifyInit(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_InotifyInit1Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·InotifyInit1(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_InotifyAddWatchAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·InotifyAddWatch(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_InotifyRmWatchAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·InotifyRmWatch(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_ListxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Listxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LlistxattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Llistxattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LremovexattrAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Lremovexattr(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LutimesAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Lutimes(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_StatfsAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Statfs(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_SyncfsAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Syncfs(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_UnshareAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Unshare(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_LinkatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Linkat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_MkdiratAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Mkdirat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_MknodatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Mknodat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_PivotRootAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·PivotRoot(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_PrctlAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Prctl(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_PrlimitAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Prlimit(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_RenameatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Renameat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_Renameat2Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Renameat2(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_SethostnameAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Sethostname(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_SetnsAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Setns(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_SymlinkatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Symlinkat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_UnlinkatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·Unlinkat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_openatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·openat(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_openat2Addr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·openat2(SB), R8 + MOVD R8, ret+0(FP) + RET + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +TEXT ·get_utimensatAddr(SB), NOSPLIT|NOFRAME, $0-8 + MOVD $·utimensat(SB), R8 + MOVD R8, ret+0(FP) + RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index 94f01123..7ccf66b7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags zos,s390x syscall_zos_s390x.go +// go run mksyscall_zos_s390x.go -o_sysnum zsysnum_zos_s390x.go -o_syscall zsyscall_zos_s390x.go -i_syscall syscall_zos_s390x.go -o_asm zsymaddr_zos_s390x.s // Code generated by the command above; see README.md. DO NOT EDIT. //go:build zos && s390x @@ -6,17 +6,100 @@ package unix import ( + "runtime" + "syscall" "unsafe" ) +var _ syscall.Errno + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), uintptr(arg)) + runtime.ExitSyscall() val = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Flistxattr(fd int, dest []byte) (sz int, err error) { + var _p0 unsafe.Pointer + if len(dest) > 0 { + _p0 = unsafe.Pointer(&dest[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FLISTXATTR_A<<4, uintptr(fd), uintptr(_p0), uintptr(len(dest))) + runtime.ExitSyscall() + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FlistxattrAddr() *(func(fd int, dest []byte) (sz int, err error)) + +var Flistxattr = enter_Flistxattr + +func enter_Flistxattr(fd int, dest []byte) (sz int, err error) { + funcref := get_FlistxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___FLISTXATTR_A<<4, "") == 0 { + *funcref = impl_Flistxattr + } else { + *funcref = error_Flistxattr + } + return (*funcref)(fd, dest) +} + +func error_Flistxattr(fd int, dest []byte) (sz int, err error) { + sz = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Fremovexattr(fd int, attr string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attr) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FREMOVEXATTR_A<<4, uintptr(fd), uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FremovexattrAddr() *(func(fd int, attr string) (err error)) + +var Fremovexattr = enter_Fremovexattr + +func enter_Fremovexattr(fd int, attr string) (err error) { + funcref := get_FremovexattrAddr() + if funcptrtest(GetZosLibVec()+SYS___FREMOVEXATTR_A<<4, "") == 0 { + *funcref = impl_Fremovexattr + } else { + *funcref = error_Fremovexattr } + return (*funcref)(fd, attr) +} + +func error_Fremovexattr(fd int, attr string) (err error) { + err = ENOSYS return } @@ -29,10 +112,12 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_READ<<4, uintptr(fd), uintptr(_p0), uintptr(len(p))) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -46,31 +131,159 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_WRITE<<4, uintptr(fd), uintptr(_p0), uintptr(len(p))) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FGETXATTR_A<<4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + runtime.ExitSyscall() + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FgetxattrAddr() *(func(fd int, attr string, dest []byte) (sz int, err error)) + +var Fgetxattr = enter_Fgetxattr + +func enter_Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { + funcref := get_FgetxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___FGETXATTR_A<<4, "") == 0 { + *funcref = impl_Fgetxattr + } else { + *funcref = error_Fgetxattr + } + return (*funcref)(fd, attr, dest) +} + +func error_Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { + sz = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Fsetxattr(fd int, attr string, data []byte, flag int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(data) > 0 { + _p1 = unsafe.Pointer(&data[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FSETXATTR_A<<4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(data)), uintptr(flag)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FsetxattrAddr() *(func(fd int, attr string, data []byte, flag int) (err error)) + +var Fsetxattr = enter_Fsetxattr + +func enter_Fsetxattr(fd int, attr string, data []byte, flag int) (err error) { + funcref := get_FsetxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___FSETXATTR_A<<4, "") == 0 { + *funcref = impl_Fsetxattr + } else { + *funcref = error_Fsetxattr } + return (*funcref)(fd, attr, data, flag) +} + +func error_Fsetxattr(fd int, attr string, data []byte, flag int) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(SYS___ACCEPT_A, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___ACCEPT_A<<4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___ACCEPT4_A<<4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags)) + runtime.ExitSyscall() fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_accept4Addr() *(func(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)) + +var accept4 = enter_accept4 + +func enter_accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + funcref := get_accept4Addr() + if funcptrtest(GetZosLibVec()+SYS___ACCEPT4_A<<4, "") == 0 { + *funcref = impl_accept4 + } else { + *funcref = error_accept4 } + return (*funcref)(s, rsa, addrlen, flags) +} + +func error_accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + fd = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(SYS___BIND_A, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___BIND_A<<4, uintptr(s), uintptr(addr), uintptr(addrlen)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -78,9 +291,11 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(SYS___CONNECT_A, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CONNECT_A<<4, uintptr(s), uintptr(addr), uintptr(addrlen)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -88,10 +303,10 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(n int, list *_Gid_t) (nn int, err error) { - r0, _, e1 := syscall_rawsyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETGROUPS<<4, uintptr(n), uintptr(unsafe.Pointer(list))) nn = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -99,9 +314,9 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(n int, list *_Gid_t) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETGROUPS<<4, uintptr(n), uintptr(unsafe.Pointer(list))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -109,9 +324,11 @@ func setgroups(n int, list *_Gid_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETSOCKOPT<<4, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -119,9 +336,11 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETSOCKOPT<<4, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -129,10 +348,10 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawsyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SOCKET<<4, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -140,9 +359,9 @@ func socket(domain int, typ int, proto int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawsyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SOCKETPAIR<<4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -150,9 +369,9 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawsyscall(SYS___GETPEERNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___GETPEERNAME_A<<4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -160,10 +379,52 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawsyscall(SYS___GETSOCKNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___GETSOCKNAME_A<<4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Removexattr(path string, attr string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___REMOVEXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_RemovexattrAddr() *(func(path string, attr string) (err error)) + +var Removexattr = enter_Removexattr + +func enter_Removexattr(path string, attr string) (err error) { + funcref := get_RemovexattrAddr() + if funcptrtest(GetZosLibVec()+SYS___REMOVEXATTR_A<<4, "") == 0 { + *funcref = impl_Removexattr + } else { + *funcref = error_Removexattr } + return (*funcref)(path, attr) +} + +func error_Removexattr(path string, attr string) (err error) { + err = ENOSYS return } @@ -176,10 +437,12 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(SYS___RECVFROM_A, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RECVFROM_A<<4, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -193,9 +456,11 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(SYS___SENDTO_A, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SENDTO_A<<4, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -203,10 +468,12 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(SYS___RECVMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RECVMSG_A<<4, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -214,10 +481,12 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(SYS___SENDMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SENDMSG_A<<4, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -225,10 +494,12 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_MMAP<<4, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + runtime.ExitSyscall() ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -236,9 +507,11 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_MUNMAP<<4, uintptr(addr), uintptr(length)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -246,9 +519,11 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req int, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_IOCTL<<4, uintptr(fd), uintptr(req), uintptr(arg)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -256,9 +531,62 @@ func ioctl(fd int, req int, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { - _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_IOCTL<<4, uintptr(fd), uintptr(req), uintptr(arg)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SHMAT<<4, uintptr(id), uintptr(addr), uintptr(flag)) + runtime.ExitSyscall() + ret = uintptr(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SHMCTL64<<4, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + runtime.ExitSyscall() + result = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SHMDT<<4, uintptr(addr)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SHMGET<<4, uintptr(key), uintptr(size), uintptr(flag)) + runtime.ExitSyscall() + id = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -271,9 +599,11 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___ACCESS_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___ACCESS_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -286,9 +616,11 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___CHDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CHDIR_A<<4, uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -301,9 +633,11 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___CHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CHOWN_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -316,9 +650,11 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___CHMOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CHMOD_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -331,10 +667,12 @@ func Creat(path string, mode uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(SYS___CREAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CREAT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -342,10 +680,12 @@ func Creat(path string, mode uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { - r0, _, e1 := syscall_syscall(SYS_DUP, uintptr(oldfd), 0, 0) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_DUP<<4, uintptr(oldfd)) + runtime.ExitSyscall() fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -353,617 +693,2216 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(oldfd int, newfd int) (err error) { - _, _, e1 := syscall_syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_DUP2<<4, uintptr(oldfd), uintptr(newfd)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Errno2() (er2 int) { - uer2, _, _ := syscall_syscall(SYS___ERRNO2, 0, 0, 0) - er2 = int(uer2) +func impl_Dup3(oldfd int, newfd int, flags int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_DUP3<<4, uintptr(oldfd), uintptr(newfd), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_Dup3Addr() *(func(oldfd int, newfd int, flags int) (err error)) -func Err2ad() (eadd *int) { - ueadd, _, _ := syscall_syscall(SYS___ERR2AD, 0, 0, 0) - eadd = (*int)(unsafe.Pointer(ueadd)) - return -} +var Dup3 = enter_Dup3 -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func enter_Dup3(oldfd int, newfd int, flags int) (err error) { + funcref := get_Dup3Addr() + if funcptrtest(GetZosLibVec()+SYS_DUP3<<4, "") == 0 { + *funcref = impl_Dup3 + } else { + *funcref = error_Dup3 + } + return (*funcref)(oldfd, newfd, flags) +} -func Exit(code int) { - syscall_syscall(SYS_EXIT, uintptr(code), 0, 0) +func error_Dup3(oldfd int, newfd int, flags int) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) +func impl_Dirfd(dirp uintptr) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_DIRFD<<4, uintptr(dirp)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_DirfdAddr() *(func(dirp uintptr) (fd int, err error)) -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) +var Dirfd = enter_Dirfd + +func enter_Dirfd(dirp uintptr) (fd int, err error) { + funcref := get_DirfdAddr() + if funcptrtest(GetZosLibVec()+SYS_DIRFD<<4, "") == 0 { + *funcref = impl_Dirfd + } else { + *funcref = error_Dirfd } + return (*funcref)(dirp) +} + +func error_Dirfd(dirp uintptr) (fd int, err error) { + fd = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) +func impl_EpollCreate(size int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EPOLL_CREATE<<4, uintptr(size)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_EpollCreateAddr() *(func(size int) (fd int, err error)) -func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) { - r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - retval = int(r0) - if e1 != 0 { - err = errnoErr(e1) +var EpollCreate = enter_EpollCreate + +func enter_EpollCreate(size int) (fd int, err error) { + funcref := get_EpollCreateAddr() + if funcptrtest(GetZosLibVec()+SYS_EPOLL_CREATE<<4, "") == 0 { + *funcref = impl_EpollCreate + } else { + *funcref = error_EpollCreate } + return (*funcref)(size) +} + +func error_EpollCreate(size int) (fd int, err error) { + fd = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *Stat_LE_t) (err error) { - _, _, e1 := syscall_syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) +func impl_EpollCreate1(flags int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EPOLL_CREATE1<<4, uintptr(flags)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_EpollCreate1Addr() *(func(flags int) (fd int, err error)) -func Fstatvfs(fd int, stat *Statvfs_t) (err error) { - _, _, e1 := syscall_syscall(SYS_FSTATVFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) +var EpollCreate1 = enter_EpollCreate1 + +func enter_EpollCreate1(flags int) (fd int, err error) { + funcref := get_EpollCreate1Addr() + if funcptrtest(GetZosLibVec()+SYS_EPOLL_CREATE1<<4, "") == 0 { + *funcref = impl_EpollCreate1 + } else { + *funcref = error_EpollCreate1 } + return (*funcref)(flags) +} + +func error_EpollCreate1(flags int) (fd int, err error) { + fd = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) +func impl_EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EPOLL_CTL<<4, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_EpollCtlAddr() *(func(epfd int, op int, fd int, event *EpollEvent) (err error)) -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) +var EpollCtl = enter_EpollCtl + +func enter_EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + funcref := get_EpollCtlAddr() + if funcptrtest(GetZosLibVec()+SYS_EPOLL_CTL<<4, "") == 0 { + *funcref = impl_EpollCtl + } else { + *funcref = error_EpollCtl } - return + return (*funcref)(epfd, op, fd, event) } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpagesize() (pgsize int) { - r0, _, _ := syscall_syscall(SYS_GETPAGESIZE, 0, 0, 0) - pgsize = int(r0) +func error_EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mprotect(b []byte, prot int) (err error) { +func impl_EpollPwait(epfd int, events []EpollEvent, msec int, sigmask *int) (n int, err error) { var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EPOLL_PWAIT<<4, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), uintptr(unsafe.Pointer(sigmask))) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_EpollPwaitAddr() *(func(epfd int, events []EpollEvent, msec int, sigmask *int) (n int, err error)) -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) +var EpollPwait = enter_EpollPwait + +func enter_EpollPwait(epfd int, events []EpollEvent, msec int, sigmask *int) (n int, err error) { + funcref := get_EpollPwaitAddr() + if funcptrtest(GetZosLibVec()+SYS_EPOLL_PWAIT<<4, "") == 0 { + *funcref = impl_EpollPwait } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) + *funcref = error_EpollPwait } + return (*funcref)(epfd, events, msec, sigmask) +} + +func error_EpollPwait(epfd int, events []EpollEvent, msec int, sigmask *int) (n int, err error) { + n = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Poll(fds []PollFd, timeout int) (n int, err error) { +func impl_EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer - if len(fds) > 0 { - _p0 = unsafe.Pointer(&fds[0]) + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(SYS_POLL, uintptr(_p0), uintptr(len(fds)), uintptr(timeout)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EPOLL_WAIT<<4, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec)) + runtime.ExitSyscall() n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_EpollWaitAddr() *(func(epfd int, events []EpollEvent, msec int) (n int, err error)) -func Times(tms *Tms) (ticks uintptr, err error) { - r0, _, e1 := syscall_syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) - ticks = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) +var EpollWait = enter_EpollWait + +func enter_EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + funcref := get_EpollWaitAddr() + if funcptrtest(GetZosLibVec()+SYS_EPOLL_WAIT<<4, "") == 0 { + *funcref = impl_EpollWait + } else { + *funcref = error_EpollWait } + return (*funcref)(epfd, events, msec) +} + +func error_EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + n = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func W_Getmntent(buff *byte, size int) (lastsys int, err error) { - r0, _, e1 := syscall_syscall(SYS_W_GETMNTENT, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) - lastsys = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } +func Errno2() (er2 int) { + runtime.EnterSyscall() + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS___ERRNO2<<4) + runtime.ExitSyscall() + er2 = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) { - r0, _, e1 := syscall_syscall(SYS___W_GETMNTENT_A, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) - lastsys = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func impl_Eventfd(initval uint, flags int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_EVENTFD<<4, uintptr(initval), uintptr(flags)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } +//go:nosplit +func get_EventfdAddr() *(func(initval uint, flags int) (fd int, err error)) + +var Eventfd = enter_Eventfd + +func enter_Eventfd(initval uint, flags int) (fd int, err error) { + funcref := get_EventfdAddr() + if funcptrtest(GetZosLibVec()+SYS_EVENTFD<<4, "") == 0 { + *funcref = impl_Eventfd + } else { + *funcref = error_Eventfd + } + return (*funcref)(initval, flags) +} + +func error_Eventfd(initval uint, flags int) (fd int, err error) { + fd = -1 + err = ENOSYS + return +} + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) { +func Exit(code int) { + runtime.EnterSyscall() + CallLeFuncWithErr(GetZosLibVec()+SYS_EXIT<<4, uintptr(code)) + runtime.ExitSyscall() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - var _p1 *byte - _p1, err = BytePtrFromString(filesystem) - if err != nil { - return - } - var _p2 *byte - _p2, err = BytePtrFromString(fstype) - if err != nil { - return - } - var _p3 *byte - _p3, err = BytePtrFromString(parm) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(SYS___MOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3))) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FACCESSAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_FaccessatAddr() *(func(dirfd int, path string, mode uint32, flags int) (err error)) -func unmount(filesystem string, mtm int) (err error) { +var Faccessat = enter_Faccessat + +func enter_Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + funcref := get_FaccessatAddr() + if funcptrtest(GetZosLibVec()+SYS___FACCESSAT_A<<4, "") == 0 { + *funcref = impl_Faccessat + } else { + *funcref = error_Faccessat + } + return (*funcref)(dirfd, path, mode, flags) +} + +func error_Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCHDIR<<4, uintptr(fd)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCHMOD<<4, uintptr(fd), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte - _p0, err = BytePtrFromString(filesystem) + _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___UMOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mtm), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FCHMODAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FchmodatAddr() *(func(dirfd int, path string, mode uint32, flags int) (err error)) + +var Fchmodat = enter_Fchmodat + +func enter_Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + funcref := get_FchmodatAddr() + if funcptrtest(GetZosLibVec()+SYS___FCHMODAT_A<<4, "") == 0 { + *funcref = impl_Fchmodat + } else { + *funcref = error_Fchmodat + } + return (*funcref)(dirfd, path, mode, flags) +} + +func error_Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCHOWN<<4, uintptr(fd), uintptr(uid), uintptr(gid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Chroot(path string) (err error) { +func impl_Fchownat(fd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___CHROOT_A, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FCHOWNAT_A<<4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FchownatAddr() *(func(fd int, path string, uid int, gid int, flags int) (err error)) + +var Fchownat = enter_Fchownat + +func enter_Fchownat(fd int, path string, uid int, gid int, flags int) (err error) { + funcref := get_FchownatAddr() + if funcptrtest(GetZosLibVec()+SYS___FCHOWNAT_A<<4, "") == 0 { + *funcref = impl_Fchownat + } else { + *funcref = error_Fchownat } + return (*funcref)(fd, path, uid, gid, flags) +} + +func error_Fchownat(fd int, path string, uid int, gid int, flags int) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Uname(buf *Utsname) (err error) { - _, _, e1 := syscall_rawsyscall(SYS___UNAME_A, uintptr(unsafe.Pointer(buf)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) +func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), uintptr(arg)) + runtime.ExitSyscall() + retval = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Gethostname(buf []byte) (err error) { +func impl_Fdatasync(fd int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FDATASYNC<<4, uintptr(fd)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FdatasyncAddr() *(func(fd int) (err error)) + +var Fdatasync = enter_Fdatasync + +func enter_Fdatasync(fd int) (err error) { + funcref := get_FdatasyncAddr() + if funcptrtest(GetZosLibVec()+SYS_FDATASYNC<<4, "") == 0 { + *funcref = impl_Fdatasync + } else { + *funcref = error_Fdatasync + } + return (*funcref)(fd) +} + +func error_Fdatasync(fd int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstat(fd int, stat *Stat_LE_t) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FSTAT<<4, uintptr(fd), uintptr(unsafe.Pointer(stat))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_fstatat(dirfd int, path string, stat *Stat_LE_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FSTATAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_fstatatAddr() *(func(dirfd int, path string, stat *Stat_LE_t, flags int) (err error)) + +var fstatat = enter_fstatat + +func enter_fstatat(dirfd int, path string, stat *Stat_LE_t, flags int) (err error) { + funcref := get_fstatatAddr() + if funcptrtest(GetZosLibVec()+SYS___FSTATAT_A<<4, "") == 0 { + *funcref = impl_fstatat + } else { + *funcref = error_fstatat + } + return (*funcref)(dirfd, path, stat, flags) +} + +func error_fstatat(dirfd int, path string, stat *Stat_LE_t, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LGETXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest))) + runtime.ExitSyscall() + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LgetxattrAddr() *(func(link string, attr string, dest []byte) (sz int, err error)) + +var Lgetxattr = enter_Lgetxattr + +func enter_Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { + funcref := get_LgetxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___LGETXATTR_A<<4, "") == 0 { + *funcref = impl_Lgetxattr + } else { + *funcref = error_Lgetxattr + } + return (*funcref)(link, attr, dest) +} + +func error_Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { + sz = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Lsetxattr(path string, attr string, data []byte, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LSETXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LsetxattrAddr() *(func(path string, attr string, data []byte, flags int) (err error)) + +var Lsetxattr = enter_Lsetxattr + +func enter_Lsetxattr(path string, attr string, data []byte, flags int) (err error) { + funcref := get_LsetxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___LSETXATTR_A<<4, "") == 0 { + *funcref = impl_Lsetxattr + } else { + *funcref = error_Lsetxattr + } + return (*funcref)(path, attr, data, flags) +} + +func error_Lsetxattr(path string, attr string, data []byte, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Fstatfs(fd int, buf *Statfs_t) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FSTATFS<<4, uintptr(fd), uintptr(unsafe.Pointer(buf))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FstatfsAddr() *(func(fd int, buf *Statfs_t) (err error)) + +var Fstatfs = enter_Fstatfs + +func enter_Fstatfs(fd int, buf *Statfs_t) (err error) { + funcref := get_FstatfsAddr() + if funcptrtest(GetZosLibVec()+SYS_FSTATFS<<4, "") == 0 { + *funcref = impl_Fstatfs + } else { + *funcref = error_Fstatfs + } + return (*funcref)(fd, buf) +} + +func error_Fstatfs(fd int, buf *Statfs_t) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatvfs(fd int, stat *Statvfs_t) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FSTATVFS<<4, uintptr(fd), uintptr(unsafe.Pointer(stat))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FSYNC<<4, uintptr(fd)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Futimes(fd int, tv []Timeval) (err error) { var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) + if len(tv) > 0 { + _p0 = unsafe.Pointer(&tv[0]) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(SYS___GETHOSTNAME_A, uintptr(_p0), uintptr(len(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FUTIMES<<4, uintptr(fd), uintptr(_p0), uintptr(len(tv))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_FutimesAddr() *(func(fd int, tv []Timeval) (err error)) -func Getegid() (egid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) +var Futimes = enter_Futimes + +func enter_Futimes(fd int, tv []Timeval) (err error) { + funcref := get_FutimesAddr() + if funcptrtest(GetZosLibVec()+SYS_FUTIMES<<4, "") == 0 { + *funcref = impl_Futimes + } else { + *funcref = error_Futimes + } + return (*funcref)(fd, tv) +} + +func error_Futimes(fd int, tv []Timeval) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Geteuid() (uid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) +func impl_Futimesat(dirfd int, path string, tv []Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(tv) > 0 { + _p1 = unsafe.Pointer(&tv[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___FUTIMESAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(tv))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_FutimesatAddr() *(func(dirfd int, path string, tv []Timeval) (err error)) + +var Futimesat = enter_Futimesat + +func enter_Futimesat(dirfd int, path string, tv []Timeval) (err error) { + funcref := get_FutimesatAddr() + if funcptrtest(GetZosLibVec()+SYS___FUTIMESAT_A<<4, "") == 0 { + *funcref = impl_Futimesat + } else { + *funcref = error_Futimesat + } + return (*funcref)(dirfd, path, tv) +} + +func error_Futimesat(dirfd int, path string, tv []Timeval) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getgid() (gid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) +func Ftruncate(fd int, length int64) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FTRUNCATE<<4, uintptr(fd), uintptr(length)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpid() (pid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) +func impl_Getrandom(buf []byte, flags int) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETRANDOM<<4, uintptr(_p0), uintptr(len(buf)), uintptr(flags)) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_GetrandomAddr() *(func(buf []byte, flags int) (n int, err error)) + +var Getrandom = enter_Getrandom + +func enter_Getrandom(buf []byte, flags int) (n int, err error) { + funcref := get_GetrandomAddr() + if funcptrtest(GetZosLibVec()+SYS_GETRANDOM<<4, "") == 0 { + *funcref = impl_Getrandom + } else { + *funcref = error_Getrandom + } + return (*funcref)(buf, flags) +} + +func error_Getrandom(buf []byte, flags int) (n int, err error) { + n = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawsyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func impl_InotifyInit() (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec() + SYS_INOTIFY_INIT<<4) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_InotifyInitAddr() *(func() (fd int, err error)) + +var InotifyInit = enter_InotifyInit + +func enter_InotifyInit() (fd int, err error) { + funcref := get_InotifyInitAddr() + if funcptrtest(GetZosLibVec()+SYS_INOTIFY_INIT<<4, "") == 0 { + *funcref = impl_InotifyInit + } else { + *funcref = error_InotifyInit } + return (*funcref)() +} + +func error_InotifyInit() (fd int, err error) { + fd = -1 + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getppid() (pid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETPPID, 0, 0, 0) - pid = int(r0) +func impl_InotifyInit1(flags int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_INOTIFY_INIT1<<4, uintptr(flags)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_InotifyInit1Addr() *(func(flags int) (fd int, err error)) + +var InotifyInit1 = enter_InotifyInit1 + +func enter_InotifyInit1(flags int) (fd int, err error) { + funcref := get_InotifyInit1Addr() + if funcptrtest(GetZosLibVec()+SYS_INOTIFY_INIT1<<4, "") == 0 { + *funcref = impl_InotifyInit1 + } else { + *funcref = error_InotifyInit1 + } + return (*funcref)(flags) +} + +func error_InotifyInit1(flags int) (fd int, err error) { + fd = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___INOTIFY_ADD_WATCH_A<<4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) + runtime.ExitSyscall() + watchdesc = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_InotifyAddWatchAddr() *(func(fd int, pathname string, mask uint32) (watchdesc int, err error)) + +var InotifyAddWatch = enter_InotifyAddWatch + +func enter_InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { + funcref := get_InotifyAddWatchAddr() + if funcptrtest(GetZosLibVec()+SYS___INOTIFY_ADD_WATCH_A<<4, "") == 0 { + *funcref = impl_InotifyAddWatch + } else { + *funcref = error_InotifyAddWatch + } + return (*funcref)(fd, pathname, mask) +} + +func error_InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { + watchdesc = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_INOTIFY_RM_WATCH<<4, uintptr(fd), uintptr(watchdesc)) + runtime.ExitSyscall() + success = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_InotifyRmWatchAddr() *(func(fd int, watchdesc uint32) (success int, err error)) + +var InotifyRmWatch = enter_InotifyRmWatch + +func enter_InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { + funcref := get_InotifyRmWatchAddr() + if funcptrtest(GetZosLibVec()+SYS_INOTIFY_RM_WATCH<<4, "") == 0 { + *funcref = impl_InotifyRmWatch + } else { + *funcref = error_InotifyRmWatch + } + return (*funcref)(fd, watchdesc) +} + +func error_InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { + success = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Listxattr(path string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LISTXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + runtime.ExitSyscall() + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_ListxattrAddr() *(func(path string, dest []byte) (sz int, err error)) + +var Listxattr = enter_Listxattr + +func enter_Listxattr(path string, dest []byte) (sz int, err error) { + funcref := get_ListxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___LISTXATTR_A<<4, "") == 0 { + *funcref = impl_Listxattr + } else { + *funcref = error_Listxattr + } + return (*funcref)(path, dest) +} + +func error_Listxattr(path string, dest []byte) (sz int, err error) { + sz = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Llistxattr(path string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LLISTXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + runtime.ExitSyscall() + sz = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LlistxattrAddr() *(func(path string, dest []byte) (sz int, err error)) + +var Llistxattr = enter_Llistxattr + +func enter_Llistxattr(path string, dest []byte) (sz int, err error) { + funcref := get_LlistxattrAddr() + if funcptrtest(GetZosLibVec()+SYS___LLISTXATTR_A<<4, "") == 0 { + *funcref = impl_Llistxattr + } else { + *funcref = error_Llistxattr + } + return (*funcref)(path, dest) +} + +func error_Llistxattr(path string, dest []byte) (sz int, err error) { + sz = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Lremovexattr(path string, attr string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LREMOVEXATTR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LremovexattrAddr() *(func(path string, attr string) (err error)) + +var Lremovexattr = enter_Lremovexattr + +func enter_Lremovexattr(path string, attr string) (err error) { + funcref := get_LremovexattrAddr() + if funcptrtest(GetZosLibVec()+SYS___LREMOVEXATTR_A<<4, "") == 0 { + *funcref = impl_Lremovexattr + } else { + *funcref = error_Lremovexattr + } + return (*funcref)(path, attr) +} + +func error_Lremovexattr(path string, attr string) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Lutimes(path string, tv []Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(tv) > 0 { + _p1 = unsafe.Pointer(&tv[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LUTIMES_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(tv))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LutimesAddr() *(func(path string, tv []Timeval) (err error)) + +var Lutimes = enter_Lutimes + +func enter_Lutimes(path string, tv []Timeval) (err error) { + funcref := get_LutimesAddr() + if funcptrtest(GetZosLibVec()+SYS___LUTIMES_A<<4, "") == 0 { + *funcref = impl_Lutimes + } else { + *funcref = error_Lutimes + } + return (*funcref)(path, tv) +} + +func error_Lutimes(path string, tv []Timeval) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_MPROTECT<<4, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_MSYNC<<4, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Console2(cmsg *ConsMsg2, modstr *byte, concmd *uint32) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CONSOLE2<<4, uintptr(unsafe.Pointer(cmsg)), uintptr(unsafe.Pointer(modstr)), uintptr(unsafe.Pointer(concmd))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Poll(fds []PollFd, timeout int) (n int, err error) { + var _p0 unsafe.Pointer + if len(fds) > 0 { + _p0 = unsafe.Pointer(&fds[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_POLL<<4, uintptr(_p0), uintptr(len(fds)), uintptr(timeout)) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readdir_r(dirp uintptr, entry *direntLE, result **direntLE) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___READDIR_R_A<<4, uintptr(dirp), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Statfs(path string, buf *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___STATFS_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_StatfsAddr() *(func(path string, buf *Statfs_t) (err error)) + +var Statfs = enter_Statfs + +func enter_Statfs(path string, buf *Statfs_t) (err error) { + funcref := get_StatfsAddr() + if funcptrtest(GetZosLibVec()+SYS___STATFS_A<<4, "") == 0 { + *funcref = impl_Statfs + } else { + *funcref = error_Statfs + } + return (*funcref)(path, buf) +} + +func error_Statfs(path string, buf *Statfs_t) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Syncfs(fd int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SYNCFS<<4, uintptr(fd)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_SyncfsAddr() *(func(fd int) (err error)) + +var Syncfs = enter_Syncfs + +func enter_Syncfs(fd int) (err error) { + funcref := get_SyncfsAddr() + if funcptrtest(GetZosLibVec()+SYS_SYNCFS<<4, "") == 0 { + *funcref = impl_Syncfs + } else { + *funcref = error_Syncfs + } + return (*funcref)(fd) +} + +func error_Syncfs(fd int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Times(tms *Tms) (ticks uintptr, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_TIMES<<4, uintptr(unsafe.Pointer(tms))) + runtime.ExitSyscall() + ticks = uintptr(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent(buff *byte, size int) (lastsys int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_W_GETMNTENT<<4, uintptr(unsafe.Pointer(buff)), uintptr(size)) + runtime.ExitSyscall() + lastsys = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___W_GETMNTENT_A<<4, uintptr(unsafe.Pointer(buff)), uintptr(size)) + runtime.ExitSyscall() + lastsys = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(filesystem) + if err != nil { + return + } + var _p2 *byte + _p2, err = BytePtrFromString(fstype) + if err != nil { + return + } + var _p3 *byte + _p3, err = BytePtrFromString(parm) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MOUNT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unmount_LE(filesystem string, mtm int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(filesystem) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UMOUNT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mtm)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___CHROOT_A<<4, uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SELECT<<4, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout))) + runtime.ExitSyscall() + ret = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Uname(buf *Utsname) (err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_____OSNAME_A<<4, uintptr(unsafe.Pointer(buf))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Unshare(flags int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_UNSHARE<<4, uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_UnshareAddr() *(func(flags int) (err error)) + +var Unshare = enter_Unshare + +func enter_Unshare(flags int) (err error) { + funcref := get_UnshareAddr() + if funcptrtest(GetZosLibVec()+SYS_UNSHARE<<4, "") == 0 { + *funcref = impl_Unshare + } else { + *funcref = error_Unshare + } + return (*funcref)(flags) +} + +func error_Unshare(flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gethostname(buf []byte) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___GETHOSTNAME_A<<4, uintptr(_p0), uintptr(len(buf))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETGID<<4) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETPID<<4) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETPGID<<4, uintptr(pid)) + pgid = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (pid int) { + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETPPID<<4) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETPRIORITY<<4, uintptr(which), uintptr(who)) + runtime.ExitSyscall() + prio = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETRLIMIT<<4, uintptr(resource), uintptr(unsafe.Pointer(rlim))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getrusage(who int, rusage *rusage_zos) (err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETRUSAGE<<4, uintptr(who), uintptr(unsafe.Pointer(rusage))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + runtime.EnterSyscall() + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETEGID<<4) + runtime.ExitSyscall() + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (euid int) { + runtime.EnterSyscall() + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETEUID<<4) + runtime.ExitSyscall() + euid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETSID<<4, uintptr(pid)) + sid = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := CallLeFuncWithErr(GetZosLibVec() + SYS_GETUID<<4) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, sig Signal) (err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_KILL<<4, uintptr(pid), uintptr(sig)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LCHOWN_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LINK_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Linkat(oldDirFd int, oldPath string, newDirFd int, newPath string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldPath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newPath) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LINKAT_A<<4, uintptr(oldDirFd), uintptr(unsafe.Pointer(_p0)), uintptr(newDirFd), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_LinkatAddr() *(func(oldDirFd int, oldPath string, newDirFd int, newPath string, flags int) (err error)) + +var Linkat = enter_Linkat + +func enter_Linkat(oldDirFd int, oldPath string, newDirFd int, newPath string, flags int) (err error) { + funcref := get_LinkatAddr() + if funcptrtest(GetZosLibVec()+SYS___LINKAT_A<<4, "") == 0 { + *funcref = impl_Linkat + } else { + *funcref = error_Linkat + } + return (*funcref)(oldDirFd, oldPath, newDirFd, newPath, flags) +} + +func error_Linkat(oldDirFd int, oldPath string, newDirFd int, newPath string, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_LISTEN<<4, uintptr(s), uintptr(n)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func lstat(path string, stat *Stat_LE_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___LSTAT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKDIR_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKDIRAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_MkdiratAddr() *(func(dirfd int, path string, mode uint32) (err error)) + +var Mkdirat = enter_Mkdirat + +func enter_Mkdirat(dirfd int, path string, mode uint32) (err error) { + funcref := get_MkdiratAddr() + if funcptrtest(GetZosLibVec()+SYS___MKDIRAT_A<<4, "") == 0 { + *funcref = impl_Mkdirat + } else { + *funcref = error_Mkdirat + } + return (*funcref)(dirfd, path, mode) +} + +func error_Mkdirat(dirfd int, path string, mode uint32) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKFIFO_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKNOD_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___MKNODAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_MknodatAddr() *(func(dirfd int, path string, mode uint32, dev int) (err error)) + +var Mknodat = enter_Mknodat + +func enter_Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + funcref := get_MknodatAddr() + if funcptrtest(GetZosLibVec()+SYS___MKNODAT_A<<4, "") == 0 { + *funcref = impl_Mknodat + } else { + *funcref = error_Mknodat + } + return (*funcref)(dirfd, path, mode, dev) +} + +func error_Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_PivotRoot(newroot string, oldroot string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(newroot) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(oldroot) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___PIVOT_ROOT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_PivotRootAddr() *(func(newroot string, oldroot string) (err error)) + +var PivotRoot = enter_PivotRoot + +func enter_PivotRoot(newroot string, oldroot string) (err error) { + funcref := get_PivotRootAddr() + if funcptrtest(GetZosLibVec()+SYS___PIVOT_ROOT_A<<4, "") == 0 { + *funcref = impl_PivotRoot + } else { + *funcref = error_PivotRoot + } + return (*funcref)(newroot, oldroot) +} + +func error_PivotRoot(newroot string, oldroot string) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_PREAD<<4, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset)) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_PWRITE<<4, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset)) + runtime.ExitSyscall() + n = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) +func impl_Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___PRCTL_A<<4, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_PrctlAddr() *(func(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)) -func getrusage(who int, rusage *rusage_zos) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) +var Prctl = enter_Prctl + +func enter_Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { + funcref := get_PrctlAddr() + if funcptrtest(GetZosLibVec()+SYS___PRCTL_A<<4, "") == 0 { + *funcref = impl_Prctl + } else { + *funcref = error_Prctl } - return + return (*funcref)(option, arg2, arg3, arg4, arg5) } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawsyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } +func error_Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getuid() (uid int) { - r0, _, _ := syscall_rawsyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) +func impl_Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_PRLIMIT<<4, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_PrlimitAddr() *(func(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error)) -func Kill(pid int, sig Signal) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) - if e1 != 0 { - err = errnoErr(e1) +var Prlimit = enter_Prlimit + +func enter_Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { + funcref := get_PrlimitAddr() + if funcptrtest(GetZosLibVec()+SYS_PRLIMIT<<4, "") == 0 { + *funcref = impl_Prlimit + } else { + *funcref = error_Prlimit } + return (*funcref)(pid, resource, newlimit, old) +} + +func error_Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Lchown(path string, uid int, gid int) (err error) { +func Rename(from string, to string) (err error) { var _p0 *byte - _p0, err = BytePtrFromString(path) + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___LCHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RENAME_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Link(path string, link string) (err error) { +func impl_Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte - _p0, err = BytePtrFromString(path) + _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte - _p1, err = BytePtrFromString(link) + _p1, err = BytePtrFromString(newpath) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___LINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RENAMEAT_A<<4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_RenameatAddr() *(func(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)) -func Listen(s int, n int) (err error) { - _, _, e1 := syscall_syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { - err = errnoErr(e1) +var Renameat = enter_Renameat + +func enter_Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + funcref := get_RenameatAddr() + if funcptrtest(GetZosLibVec()+SYS___RENAMEAT_A<<4, "") == 0 { + *funcref = impl_Renameat + } else { + *funcref = error_Renameat } + return (*funcref)(olddirfd, oldpath, newdirfd, newpath) +} + +func error_Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *Stat_LE_t) (err error) { +func impl_Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte - _p0, err = BytePtrFromString(path) + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___LSTAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RENAMEAT2_A<<4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_Renameat2Addr() *(func(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)) -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(SYS___MKDIR_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) +var Renameat2 = enter_Renameat2 + +func enter_Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { + funcref := get_Renameat2Addr() + if funcptrtest(GetZosLibVec()+SYS___RENAMEAT2_A<<4, "") == 0 { + *funcref = impl_Renameat2 + } else { + *funcref = error_Renameat2 } + return (*funcref)(olddirfd, oldpath, newdirfd, newpath, flags) +} + +func error_Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifo(path string, mode uint32) (err error) { +func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(SYS___MKFIFO_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___RMDIR_A<<4, uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(SYS___MKNOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) +func Seek(fd int, offset int64, whence int) (off int64, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_LSEEK<<4, uintptr(fd), uintptr(offset), uintptr(whence)) + runtime.ExitSyscall() + off = int64(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) +func Setegid(egid int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETEGID<<4, uintptr(egid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } - r0, _, e1 := syscall_syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETEUID<<4, uintptr(euid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { +func impl_Sethostname(p []byte) (err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SETHOSTNAME_A<<4, uintptr(_p0), uintptr(len(p))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_SethostnameAddr() *(func(p []byte) (err error)) -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) +var Sethostname = enter_Sethostname + +func enter_Sethostname(p []byte) (err error) { + funcref := get_SethostnameAddr() + if funcptrtest(GetZosLibVec()+SYS___SETHOSTNAME_A<<4, "") == 0 { + *funcref = impl_Sethostname } else { - _p1 = unsafe.Pointer(&_zero) + *funcref = error_Sethostname } - r0, _, e1 := syscall_syscall(SYS___READLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return + return (*funcref)(p) } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall(SYS___RENAME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } +func error_Sethostname(p []byte) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(SYS___RMDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) +func impl_Setns(fd int, nstype int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETNS<<4, uintptr(fd), uintptr(nstype)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +//go:nosplit +func get_SetnsAddr() *(func(fd int, nstype int) (err error)) -func Seek(fd int, offset int64, whence int) (off int64, err error) { - r0, _, e1 := syscall_syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - off = int64(r0) - if e1 != 0 { - err = errnoErr(e1) +var Setns = enter_Setns + +func enter_Setns(fd int, nstype int) (err error) { + funcref := get_SetnsAddr() + if funcptrtest(GetZosLibVec()+SYS_SETNS<<4, "") == 0 { + *funcref = impl_Setns + } else { + *funcref = error_Setns } + return (*funcref)(fd, nstype) +} + +func error_Setns(fd int, nstype int) (err error) { + err = ENOSYS return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETPRIORITY<<4, uintptr(which), uintptr(who), uintptr(prio)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -971,9 +2910,9 @@ func Setpriority(which int, who int, prio int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETPGID<<4, uintptr(pid), uintptr(pgid)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -981,9 +2920,9 @@ func Setpgid(pid int, pgid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(resource int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETRLIMIT<<4, uintptr(resource), uintptr(unsafe.Pointer(lim))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -991,9 +2930,9 @@ func Setrlimit(resource int, lim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETREGID<<4, uintptr(rgid), uintptr(egid)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1001,9 +2940,9 @@ func Setregid(rgid int, egid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETREUID<<4, uintptr(ruid), uintptr(euid)) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1011,10 +2950,10 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawsyscall(SYS_SETSID, 0, 0, 0) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec() + SYS_SETSID<<4) pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1022,9 +2961,11 @@ func Setsid() (pid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_syscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETUID<<4, uintptr(uid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1032,9 +2973,11 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(uid int) (err error) { - _, _, e1 := syscall_syscall(SYS_SETGID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SETGID<<4, uintptr(uid)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1042,9 +2985,11 @@ func Setgid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_SHUTDOWN<<4, uintptr(fd), uintptr(how)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1057,9 +3002,11 @@ func stat(path string, statLE *Stat_LE_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___STAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___STAT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1077,17 +3024,63 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___SYMLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SYMLINK_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Symlinkat(oldPath string, dirfd int, newPath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldPath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newPath) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___SYMLINKAT_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(dirfd), uintptr(unsafe.Pointer(_p1))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } +//go:nosplit +func get_SymlinkatAddr() *(func(oldPath string, dirfd int, newPath string) (err error)) + +var Symlinkat = enter_Symlinkat + +func enter_Symlinkat(oldPath string, dirfd int, newPath string) (err error) { + funcref := get_SymlinkatAddr() + if funcptrtest(GetZosLibVec()+SYS___SYMLINKAT_A<<4, "") == 0 { + *funcref = impl_Symlinkat + } else { + *funcref = error_Symlinkat + } + return (*funcref)(oldPath, dirfd, newPath) +} + +func error_Symlinkat(oldPath string, dirfd int, newPath string) (err error) { + err = ENOSYS + return +} + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() { - syscall_syscall(SYS_SYNC, 0, 0, 0) + runtime.EnterSyscall() + CallLeFuncWithErr(GetZosLibVec() + SYS_SYNC<<4) + runtime.ExitSyscall() return } @@ -1099,9 +3092,11 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___TRUNCATE_A, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___TRUNCATE_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(length)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1109,9 +3104,11 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tcgetattr(fildes int, termptr *Termios) (err error) { - _, _, e1 := syscall_syscall(SYS_TCGETATTR, uintptr(fildes), uintptr(unsafe.Pointer(termptr)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_TCGETATTR<<4, uintptr(fildes), uintptr(unsafe.Pointer(termptr))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1119,9 +3116,11 @@ func Tcgetattr(fildes int, termptr *Termios) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tcsetattr(fildes int, when int, termptr *Termios) (err error) { - _, _, e1 := syscall_syscall(SYS_TCSETATTR, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr))) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_TCSETATTR<<4, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1129,7 +3128,9 @@ func Tcsetattr(fildes int, when int, termptr *Termios) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(mask int) (oldmask int) { - r0, _, _ := syscall_syscall(SYS_UMASK, uintptr(mask), 0, 0) + runtime.EnterSyscall() + r0, _, _ := CallLeFuncWithErr(GetZosLibVec()+SYS_UMASK<<4, uintptr(mask)) + runtime.ExitSyscall() oldmask = int(r0) return } @@ -1142,10 +3143,49 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___UNLINK_A, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UNLINK_A<<4, uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UNLINKAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_UnlinkatAddr() *(func(dirfd int, path string, flags int) (err error)) + +var Unlinkat = enter_Unlinkat + +func enter_Unlinkat(dirfd int, path string, flags int) (err error) { + funcref := get_UnlinkatAddr() + if funcptrtest(GetZosLibVec()+SYS___UNLINKAT_A<<4, "") == 0 { + *funcref = impl_Unlinkat + } else { + *funcref = error_Unlinkat } + return (*funcref)(dirfd, path, flags) +} + +func error_Unlinkat(dirfd int, path string, flags int) (err error) { + err = ENOSYS return } @@ -1157,9 +3197,11 @@ func Utime(path string, utim *Utimbuf) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___UTIME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UTIME_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1172,11 +3214,91 @@ func open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(SYS___OPEN_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___OPEN_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___OPENAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_openatAddr() *(func(dirfd int, path string, flags int, mode uint32) (fd int, err error)) + +var openat = enter_openat + +func enter_openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { + funcref := get_openatAddr() + if funcptrtest(GetZosLibVec()+SYS___OPENAT_A<<4, "") == 0 { + *funcref = impl_openat + } else { + *funcref = error_openat + } + return (*funcref)(dirfd, path, flags, mode) +} + +func error_openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { + fd = -1 + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func impl_openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___OPENAT2_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(open_how)), uintptr(size)) + runtime.ExitSyscall() fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_openat2Addr() *(func(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error)) + +var openat2 = enter_openat2 + +func enter_openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) { + funcref := get_openat2Addr() + if funcptrtest(GetZosLibVec()+SYS___OPENAT2_A<<4, "") == 0 { + *funcref = impl_openat2 + } else { + *funcref = error_openat2 } + return (*funcref)(dirfd, path, open_how, size) +} + +func error_openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) { + fd = -1 + err = ENOSYS return } @@ -1188,9 +3310,23 @@ func remove(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_REMOVE<<4, uintptr(unsafe.Pointer(_p0))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func waitid(idType int, id int, info *Siginfo, options int) (err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_WAITID<<4, uintptr(idType), uintptr(id), uintptr(unsafe.Pointer(info)), uintptr(options)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1198,10 +3334,12 @@ func remove(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) { - r0, _, e1 := syscall_syscall(SYS_WAITPID, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options)) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_WAITPID<<4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options)) + runtime.ExitSyscall() wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1209,9 +3347,9 @@ func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tv *timeval_zos) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GETTIMEOFDAY<<4, uintptr(unsafe.Pointer(tv))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1219,9 +3357,9 @@ func gettimeofday(tv *timeval_zos) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]_C_int) (err error) { - _, _, e1 := syscall_rawsyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_PIPE<<4, uintptr(unsafe.Pointer(p))) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } @@ -1234,20 +3372,87 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(SYS___UTIMES_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UTIMES_A<<4, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval))) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) { - r0, _, e1 := syscall_syscall6(SYS_SELECT, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func impl_utimensat(dirfd int, path string, ts *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS___UTIMENSAT_A<<4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(ts)), uintptr(flags)) + runtime.ExitSyscall() + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +//go:nosplit +func get_utimensatAddr() *(func(dirfd int, path string, ts *[2]Timespec, flags int) (err error)) + +var utimensat = enter_utimensat + +func enter_utimensat(dirfd int, path string, ts *[2]Timespec, flags int) (err error) { + funcref := get_utimensatAddr() + if funcptrtest(GetZosLibVec()+SYS___UTIMENSAT_A<<4, "") == 0 { + *funcref = impl_utimensat + } else { + *funcref = error_utimensat + } + return (*funcref)(dirfd, path, ts, flags) +} + +func error_utimensat(dirfd int, path string, ts *[2]Timespec, flags int) (err error) { + err = ENOSYS + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Posix_openpt(oflag int) (fd int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_POSIX_OPENPT<<4, uintptr(oflag)) + runtime.ExitSyscall() + fd = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Grantpt(fildes int) (rc int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_GRANTPT<<4, uintptr(fildes)) + runtime.ExitSyscall() + rc = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlockpt(fildes int) (rc int, err error) { + runtime.EnterSyscall() + r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_UNLOCKPT<<4, uintptr(fildes)) + runtime.ExitSyscall() + rc = int(r0) + if int64(r0) == -1 { + err = errnoErr2(e1, e2) } return } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 0cc3ce49..53aef5dc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -452,4 +452,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 856d92d6..71d52476 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -374,4 +374,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 8d467094..c7477061 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -416,4 +416,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index edc17324..f96e214f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -319,4 +319,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 445eba20..28425346 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -313,4 +313,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index adba01bc..d0953018 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -436,4 +436,9 @@ const ( SYS_FUTEX_WAKE = 4454 SYS_FUTEX_WAIT = 4455 SYS_FUTEX_REQUEUE = 4456 + SYS_STATMOUNT = 4457 + SYS_LISTMOUNT = 4458 + SYS_LSM_GET_SELF_ATTR = 4459 + SYS_LSM_SET_SELF_ATTR = 4460 + SYS_LSM_LIST_MODULES = 4461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 014c4e9c..295c7f4b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -366,4 +366,9 @@ const ( SYS_FUTEX_WAKE = 5454 SYS_FUTEX_WAIT = 5455 SYS_FUTEX_REQUEUE = 5456 + SYS_STATMOUNT = 5457 + SYS_LISTMOUNT = 5458 + SYS_LSM_GET_SELF_ATTR = 5459 + SYS_LSM_SET_SELF_ATTR = 5460 + SYS_LSM_LIST_MODULES = 5461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index ccc97d74..d1a9eaca 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -366,4 +366,9 @@ const ( SYS_FUTEX_WAKE = 5454 SYS_FUTEX_WAIT = 5455 SYS_FUTEX_REQUEUE = 5456 + SYS_STATMOUNT = 5457 + SYS_LISTMOUNT = 5458 + SYS_LSM_GET_SELF_ATTR = 5459 + SYS_LSM_SET_SELF_ATTR = 5460 + SYS_LSM_LIST_MODULES = 5461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index ec2b64a9..bec157c3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -436,4 +436,9 @@ const ( SYS_FUTEX_WAKE = 4454 SYS_FUTEX_WAIT = 4455 SYS_FUTEX_REQUEUE = 4456 + SYS_STATMOUNT = 4457 + SYS_LISTMOUNT = 4458 + SYS_LSM_GET_SELF_ATTR = 4459 + SYS_LSM_SET_SELF_ATTR = 4460 + SYS_LSM_LIST_MODULES = 4461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 21a839e3..7ee7bdc4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -443,4 +443,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index c11121ec..fad1f25b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -415,4 +415,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 909b631f..7d3e1635 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -415,4 +415,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index e49bed16..0ed53ad9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -320,4 +320,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 66017d2d..2fba04ad 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -381,4 +381,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 47bab18d..621d00d7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -394,4 +394,9 @@ const ( SYS_FUTEX_WAKE = 454 SYS_FUTEX_WAIT = 455 SYS_FUTEX_REQUEUE = 456 + SYS_STATMOUNT = 457 + SYS_LISTMOUNT = 458 + SYS_LSM_GET_SELF_ATTR = 459 + SYS_LSM_SET_SELF_ATTR = 460 + SYS_LSM_LIST_MODULES = 461 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go index b2e30858..5e8c263c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -1,2669 +1,2852 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// go run mksyscall_zos_s390x.go -o_sysnum zsysnum_zos_s390x.go -o_syscall zsyscall_zos_s390x.go -i_syscall syscall_zos_s390x.go -o_asm zsymaddr_zos_s390x.s +// Code generated by the command above; see README.md. DO NOT EDIT. //go:build zos && s390x package unix -// TODO: auto-generate. - const ( - SYS_ACOSD128 = 0xB80 - SYS_ACOSD32 = 0xB7E - SYS_ACOSD64 = 0xB7F - SYS_ACOSHD128 = 0xB83 - SYS_ACOSHD32 = 0xB81 - SYS_ACOSHD64 = 0xB82 - SYS_AIO_FSYNC = 0xC69 - SYS_ASCTIME = 0x0AE - SYS_ASCTIME64 = 0xCD7 - SYS_ASCTIME64_R = 0xCD8 - SYS_ASIND128 = 0xB86 - SYS_ASIND32 = 0xB84 - SYS_ASIND64 = 0xB85 - SYS_ASINHD128 = 0xB89 - SYS_ASINHD32 = 0xB87 - SYS_ASINHD64 = 0xB88 - SYS_ATAN2D128 = 0xB8F - SYS_ATAN2D32 = 0xB8D - SYS_ATAN2D64 = 0xB8E - SYS_ATAND128 = 0xB8C - SYS_ATAND32 = 0xB8A - SYS_ATAND64 = 0xB8B - SYS_ATANHD128 = 0xB92 - SYS_ATANHD32 = 0xB90 - SYS_ATANHD64 = 0xB91 - SYS_BIND2ADDRSEL = 0xD59 - SYS_C16RTOMB = 0xD40 - SYS_C32RTOMB = 0xD41 - SYS_CBRTD128 = 0xB95 - SYS_CBRTD32 = 0xB93 - SYS_CBRTD64 = 0xB94 - SYS_CEILD128 = 0xB98 - SYS_CEILD32 = 0xB96 - SYS_CEILD64 = 0xB97 - SYS_CLEARENV = 0x0C9 - SYS_CLEARERR_UNLOCKED = 0xCA1 - SYS_CLOCK = 0x0AA - SYS_CLOGL = 0xA00 - SYS_CLRMEMF = 0x0BD - SYS_CONJ = 0xA03 - SYS_CONJF = 0xA06 - SYS_CONJL = 0xA09 - SYS_COPYSIGND128 = 0xB9E - SYS_COPYSIGND32 = 0xB9C - SYS_COPYSIGND64 = 0xB9D - SYS_COSD128 = 0xBA1 - SYS_COSD32 = 0xB9F - SYS_COSD64 = 0xBA0 - SYS_COSHD128 = 0xBA4 - SYS_COSHD32 = 0xBA2 - SYS_COSHD64 = 0xBA3 - SYS_CPOW = 0xA0C - SYS_CPOWF = 0xA0F - SYS_CPOWL = 0xA12 - SYS_CPROJ = 0xA15 - SYS_CPROJF = 0xA18 - SYS_CPROJL = 0xA1B - SYS_CREAL = 0xA1E - SYS_CREALF = 0xA21 - SYS_CREALL = 0xA24 - SYS_CSIN = 0xA27 - SYS_CSINF = 0xA2A - SYS_CSINH = 0xA30 - SYS_CSINHF = 0xA33 - SYS_CSINHL = 0xA36 - SYS_CSINL = 0xA2D - SYS_CSNAP = 0x0C5 - SYS_CSQRT = 0xA39 - SYS_CSQRTF = 0xA3C - SYS_CSQRTL = 0xA3F - SYS_CTAN = 0xA42 - SYS_CTANF = 0xA45 - SYS_CTANH = 0xA4B - SYS_CTANHF = 0xA4E - SYS_CTANHL = 0xA51 - SYS_CTANL = 0xA48 - SYS_CTIME = 0x0AB - SYS_CTIME64 = 0xCD9 - SYS_CTIME64_R = 0xCDA - SYS_CTRACE = 0x0C6 - SYS_DIFFTIME = 0x0A7 - SYS_DIFFTIME64 = 0xCDB - SYS_DLADDR = 0xC82 - SYS_DYNALLOC = 0x0C3 - SYS_DYNFREE = 0x0C2 - SYS_ERFCD128 = 0xBAA - SYS_ERFCD32 = 0xBA8 - SYS_ERFCD64 = 0xBA9 - SYS_ERFD128 = 0xBA7 - SYS_ERFD32 = 0xBA5 - SYS_ERFD64 = 0xBA6 - SYS_EXP2D128 = 0xBB0 - SYS_EXP2D32 = 0xBAE - SYS_EXP2D64 = 0xBAF - SYS_EXPD128 = 0xBAD - SYS_EXPD32 = 0xBAB - SYS_EXPD64 = 0xBAC - SYS_EXPM1D128 = 0xBB3 - SYS_EXPM1D32 = 0xBB1 - SYS_EXPM1D64 = 0xBB2 - SYS_FABSD128 = 0xBB6 - SYS_FABSD32 = 0xBB4 - SYS_FABSD64 = 0xBB5 - SYS_FDELREC_UNLOCKED = 0xCA2 - SYS_FDIMD128 = 0xBB9 - SYS_FDIMD32 = 0xBB7 - SYS_FDIMD64 = 0xBB8 - SYS_FDOPEN_UNLOCKED = 0xCFC - SYS_FECLEAREXCEPT = 0xAEA - SYS_FEGETENV = 0xAEB - SYS_FEGETEXCEPTFLAG = 0xAEC - SYS_FEGETROUND = 0xAED - SYS_FEHOLDEXCEPT = 0xAEE - SYS_FEOF_UNLOCKED = 0xCA3 - SYS_FERAISEEXCEPT = 0xAEF - SYS_FERROR_UNLOCKED = 0xCA4 - SYS_FESETENV = 0xAF0 - SYS_FESETEXCEPTFLAG = 0xAF1 - SYS_FESETROUND = 0xAF2 - SYS_FETCHEP = 0x0BF - SYS_FETESTEXCEPT = 0xAF3 - SYS_FEUPDATEENV = 0xAF4 - SYS_FE_DEC_GETROUND = 0xBBA - SYS_FE_DEC_SETROUND = 0xBBB - SYS_FFLUSH_UNLOCKED = 0xCA5 - SYS_FGETC_UNLOCKED = 0xC80 - SYS_FGETPOS64 = 0xCEE - SYS_FGETPOS64_UNLOCKED = 0xCF4 - SYS_FGETPOS_UNLOCKED = 0xCA6 - SYS_FGETS_UNLOCKED = 0xC7C - SYS_FGETWC_UNLOCKED = 0xCA7 - SYS_FGETWS_UNLOCKED = 0xCA8 - SYS_FILENO_UNLOCKED = 0xCA9 - SYS_FLDATA = 0x0C1 - SYS_FLDATA_UNLOCKED = 0xCAA - SYS_FLOCATE_UNLOCKED = 0xCAB - SYS_FLOORD128 = 0xBBE - SYS_FLOORD32 = 0xBBC - SYS_FLOORD64 = 0xBBD - SYS_FMA = 0xA63 - SYS_FMAD128 = 0xBC1 - SYS_FMAD32 = 0xBBF - SYS_FMAD64 = 0xBC0 - SYS_FMAF = 0xA66 - SYS_FMAL = 0xA69 - SYS_FMAX = 0xA6C - SYS_FMAXD128 = 0xBC4 - SYS_FMAXD32 = 0xBC2 - SYS_FMAXD64 = 0xBC3 - SYS_FMAXF = 0xA6F - SYS_FMAXL = 0xA72 - SYS_FMIN = 0xA75 - SYS_FMIND128 = 0xBC7 - SYS_FMIND32 = 0xBC5 - SYS_FMIND64 = 0xBC6 - SYS_FMINF = 0xA78 - SYS_FMINL = 0xA7B - SYS_FMODD128 = 0xBCA - SYS_FMODD32 = 0xBC8 - SYS_FMODD64 = 0xBC9 - SYS_FOPEN64 = 0xD49 - SYS_FOPEN64_UNLOCKED = 0xD4A - SYS_FOPEN_UNLOCKED = 0xCFA - SYS_FPRINTF_UNLOCKED = 0xCAC - SYS_FPUTC_UNLOCKED = 0xC81 - SYS_FPUTS_UNLOCKED = 0xC7E - SYS_FPUTWC_UNLOCKED = 0xCAD - SYS_FPUTWS_UNLOCKED = 0xCAE - SYS_FREAD_NOUPDATE = 0xCEC - SYS_FREAD_NOUPDATE_UNLOCKED = 0xCED - SYS_FREAD_UNLOCKED = 0xC7B - SYS_FREEIFADDRS = 0xCE6 - SYS_FREOPEN64 = 0xD4B - SYS_FREOPEN64_UNLOCKED = 0xD4C - SYS_FREOPEN_UNLOCKED = 0xCFB - SYS_FREXPD128 = 0xBCE - SYS_FREXPD32 = 0xBCC - SYS_FREXPD64 = 0xBCD - SYS_FSCANF_UNLOCKED = 0xCAF - SYS_FSEEK64 = 0xCEF - SYS_FSEEK64_UNLOCKED = 0xCF5 - SYS_FSEEKO64 = 0xCF0 - SYS_FSEEKO64_UNLOCKED = 0xCF6 - SYS_FSEEKO_UNLOCKED = 0xCB1 - SYS_FSEEK_UNLOCKED = 0xCB0 - SYS_FSETPOS64 = 0xCF1 - SYS_FSETPOS64_UNLOCKED = 0xCF7 - SYS_FSETPOS_UNLOCKED = 0xCB3 - SYS_FTELL64 = 0xCF2 - SYS_FTELL64_UNLOCKED = 0xCF8 - SYS_FTELLO64 = 0xCF3 - SYS_FTELLO64_UNLOCKED = 0xCF9 - SYS_FTELLO_UNLOCKED = 0xCB5 - SYS_FTELL_UNLOCKED = 0xCB4 - SYS_FUPDATE = 0x0B5 - SYS_FUPDATE_UNLOCKED = 0xCB7 - SYS_FWIDE_UNLOCKED = 0xCB8 - SYS_FWPRINTF_UNLOCKED = 0xCB9 - SYS_FWRITE_UNLOCKED = 0xC7A - SYS_FWSCANF_UNLOCKED = 0xCBA - SYS_GETDATE64 = 0xD4F - SYS_GETIFADDRS = 0xCE7 - SYS_GETIPV4SOURCEFILTER = 0xC77 - SYS_GETSOURCEFILTER = 0xC79 - SYS_GETSYNTX = 0x0FD - SYS_GETS_UNLOCKED = 0xC7D - SYS_GETTIMEOFDAY64 = 0xD50 - SYS_GETWCHAR_UNLOCKED = 0xCBC - SYS_GETWC_UNLOCKED = 0xCBB - SYS_GMTIME = 0x0B0 - SYS_GMTIME64 = 0xCDC - SYS_GMTIME64_R = 0xCDD - SYS_HYPOTD128 = 0xBD1 - SYS_HYPOTD32 = 0xBCF - SYS_HYPOTD64 = 0xBD0 - SYS_ILOGBD128 = 0xBD4 - SYS_ILOGBD32 = 0xBD2 - SYS_ILOGBD64 = 0xBD3 - SYS_ILOGBF = 0xA7E - SYS_ILOGBL = 0xA81 - SYS_INET6_IS_SRCADDR = 0xD5A - SYS_ISBLANK = 0x0FE - SYS_ISWALNUM = 0x0FF - SYS_LDEXPD128 = 0xBD7 - SYS_LDEXPD32 = 0xBD5 - SYS_LDEXPD64 = 0xBD6 - SYS_LGAMMAD128 = 0xBDA - SYS_LGAMMAD32 = 0xBD8 - SYS_LGAMMAD64 = 0xBD9 - SYS_LIO_LISTIO = 0xC6A - SYS_LLRINT = 0xA84 - SYS_LLRINTD128 = 0xBDD - SYS_LLRINTD32 = 0xBDB - SYS_LLRINTD64 = 0xBDC - SYS_LLRINTF = 0xA87 - SYS_LLRINTL = 0xA8A - SYS_LLROUND = 0xA8D - SYS_LLROUNDD128 = 0xBE0 - SYS_LLROUNDD32 = 0xBDE - SYS_LLROUNDD64 = 0xBDF - SYS_LLROUNDF = 0xA90 - SYS_LLROUNDL = 0xA93 - SYS_LOCALTIM = 0x0B1 - SYS_LOCALTIME = 0x0B1 - SYS_LOCALTIME64 = 0xCDE - SYS_LOCALTIME64_R = 0xCDF - SYS_LOG10D128 = 0xBE6 - SYS_LOG10D32 = 0xBE4 - SYS_LOG10D64 = 0xBE5 - SYS_LOG1PD128 = 0xBE9 - SYS_LOG1PD32 = 0xBE7 - SYS_LOG1PD64 = 0xBE8 - SYS_LOG2D128 = 0xBEC - SYS_LOG2D32 = 0xBEA - SYS_LOG2D64 = 0xBEB - SYS_LOGBD128 = 0xBEF - SYS_LOGBD32 = 0xBED - SYS_LOGBD64 = 0xBEE - SYS_LOGBF = 0xA96 - SYS_LOGBL = 0xA99 - SYS_LOGD128 = 0xBE3 - SYS_LOGD32 = 0xBE1 - SYS_LOGD64 = 0xBE2 - SYS_LRINT = 0xA9C - SYS_LRINTD128 = 0xBF2 - SYS_LRINTD32 = 0xBF0 - SYS_LRINTD64 = 0xBF1 - SYS_LRINTF = 0xA9F - SYS_LRINTL = 0xAA2 - SYS_LROUNDD128 = 0xBF5 - SYS_LROUNDD32 = 0xBF3 - SYS_LROUNDD64 = 0xBF4 - SYS_LROUNDL = 0xAA5 - SYS_MBLEN = 0x0AF - SYS_MBRTOC16 = 0xD42 - SYS_MBRTOC32 = 0xD43 - SYS_MEMSET = 0x0A3 - SYS_MKTIME = 0x0AC - SYS_MKTIME64 = 0xCE0 - SYS_MODFD128 = 0xBF8 - SYS_MODFD32 = 0xBF6 - SYS_MODFD64 = 0xBF7 - SYS_NAN = 0xAA8 - SYS_NAND128 = 0xBFB - SYS_NAND32 = 0xBF9 - SYS_NAND64 = 0xBFA - SYS_NANF = 0xAAA - SYS_NANL = 0xAAC - SYS_NEARBYINT = 0xAAE - SYS_NEARBYINTD128 = 0xBFE - SYS_NEARBYINTD32 = 0xBFC - SYS_NEARBYINTD64 = 0xBFD - SYS_NEARBYINTF = 0xAB1 - SYS_NEARBYINTL = 0xAB4 - SYS_NEXTAFTERD128 = 0xC01 - SYS_NEXTAFTERD32 = 0xBFF - SYS_NEXTAFTERD64 = 0xC00 - SYS_NEXTAFTERF = 0xAB7 - SYS_NEXTAFTERL = 0xABA - SYS_NEXTTOWARD = 0xABD - SYS_NEXTTOWARDD128 = 0xC04 - SYS_NEXTTOWARDD32 = 0xC02 - SYS_NEXTTOWARDD64 = 0xC03 - SYS_NEXTTOWARDF = 0xAC0 - SYS_NEXTTOWARDL = 0xAC3 - SYS_NL_LANGINFO = 0x0FC - SYS_PERROR_UNLOCKED = 0xCBD - SYS_POSIX_FALLOCATE = 0xCE8 - SYS_POSIX_MEMALIGN = 0xCE9 - SYS_POSIX_OPENPT = 0xC66 - SYS_POWD128 = 0xC07 - SYS_POWD32 = 0xC05 - SYS_POWD64 = 0xC06 - SYS_PRINTF_UNLOCKED = 0xCBE - SYS_PSELECT = 0xC67 - SYS_PTHREAD_ATTR_GETSTACK = 0xB3E - SYS_PTHREAD_ATTR_SETSTACK = 0xB3F - SYS_PTHREAD_SECURITY_APPLID_NP = 0xCE4 - SYS_PUTS_UNLOCKED = 0xC7F - SYS_PUTWCHAR_UNLOCKED = 0xCC0 - SYS_PUTWC_UNLOCKED = 0xCBF - SYS_QUANTEXPD128 = 0xD46 - SYS_QUANTEXPD32 = 0xD44 - SYS_QUANTEXPD64 = 0xD45 - SYS_QUANTIZED128 = 0xC0A - SYS_QUANTIZED32 = 0xC08 - SYS_QUANTIZED64 = 0xC09 - SYS_REMAINDERD128 = 0xC0D - SYS_REMAINDERD32 = 0xC0B - SYS_REMAINDERD64 = 0xC0C - SYS_RESIZE_ALLOC = 0xCEB - SYS_REWIND_UNLOCKED = 0xCC1 - SYS_RINTD128 = 0xC13 - SYS_RINTD32 = 0xC11 - SYS_RINTD64 = 0xC12 - SYS_RINTF = 0xACB - SYS_RINTL = 0xACD - SYS_ROUND = 0xACF - SYS_ROUNDD128 = 0xC16 - SYS_ROUNDD32 = 0xC14 - SYS_ROUNDD64 = 0xC15 - SYS_ROUNDF = 0xAD2 - SYS_ROUNDL = 0xAD5 - SYS_SAMEQUANTUMD128 = 0xC19 - SYS_SAMEQUANTUMD32 = 0xC17 - SYS_SAMEQUANTUMD64 = 0xC18 - SYS_SCALBLN = 0xAD8 - SYS_SCALBLND128 = 0xC1C - SYS_SCALBLND32 = 0xC1A - SYS_SCALBLND64 = 0xC1B - SYS_SCALBLNF = 0xADB - SYS_SCALBLNL = 0xADE - SYS_SCALBND128 = 0xC1F - SYS_SCALBND32 = 0xC1D - SYS_SCALBND64 = 0xC1E - SYS_SCALBNF = 0xAE3 - SYS_SCALBNL = 0xAE6 - SYS_SCANF_UNLOCKED = 0xCC2 - SYS_SCHED_YIELD = 0xB32 - SYS_SETENV = 0x0C8 - SYS_SETIPV4SOURCEFILTER = 0xC76 - SYS_SETSOURCEFILTER = 0xC78 - SYS_SHM_OPEN = 0xC8C - SYS_SHM_UNLINK = 0xC8D - SYS_SIND128 = 0xC22 - SYS_SIND32 = 0xC20 - SYS_SIND64 = 0xC21 - SYS_SINHD128 = 0xC25 - SYS_SINHD32 = 0xC23 - SYS_SINHD64 = 0xC24 - SYS_SIZEOF_ALLOC = 0xCEA - SYS_SOCKATMARK = 0xC68 - SYS_SQRTD128 = 0xC28 - SYS_SQRTD32 = 0xC26 - SYS_SQRTD64 = 0xC27 - SYS_STRCHR = 0x0A0 - SYS_STRCSPN = 0x0A1 - SYS_STRERROR = 0x0A8 - SYS_STRERROR_R = 0xB33 - SYS_STRFTIME = 0x0B2 - SYS_STRLEN = 0x0A9 - SYS_STRPBRK = 0x0A2 - SYS_STRSPN = 0x0A4 - SYS_STRSTR = 0x0A5 - SYS_STRTOD128 = 0xC2B - SYS_STRTOD32 = 0xC29 - SYS_STRTOD64 = 0xC2A - SYS_STRTOK = 0x0A6 - SYS_TAND128 = 0xC2E - SYS_TAND32 = 0xC2C - SYS_TAND64 = 0xC2D - SYS_TANHD128 = 0xC31 - SYS_TANHD32 = 0xC2F - SYS_TANHD64 = 0xC30 - SYS_TGAMMAD128 = 0xC34 - SYS_TGAMMAD32 = 0xC32 - SYS_TGAMMAD64 = 0xC33 - SYS_TIME = 0x0AD - SYS_TIME64 = 0xCE1 - SYS_TMPFILE64 = 0xD4D - SYS_TMPFILE64_UNLOCKED = 0xD4E - SYS_TMPFILE_UNLOCKED = 0xCFD - SYS_TRUNCD128 = 0xC40 - SYS_TRUNCD32 = 0xC3E - SYS_TRUNCD64 = 0xC3F - SYS_UNGETC_UNLOCKED = 0xCC3 - SYS_UNGETWC_UNLOCKED = 0xCC4 - SYS_UNSETENV = 0xB34 - SYS_VFPRINTF_UNLOCKED = 0xCC5 - SYS_VFSCANF_UNLOCKED = 0xCC7 - SYS_VFWPRINTF_UNLOCKED = 0xCC9 - SYS_VFWSCANF_UNLOCKED = 0xCCB - SYS_VPRINTF_UNLOCKED = 0xCCD - SYS_VSCANF_UNLOCKED = 0xCCF - SYS_VWPRINTF_UNLOCKED = 0xCD1 - SYS_VWSCANF_UNLOCKED = 0xCD3 - SYS_WCSTOD128 = 0xC43 - SYS_WCSTOD32 = 0xC41 - SYS_WCSTOD64 = 0xC42 - SYS_WPRINTF_UNLOCKED = 0xCD5 - SYS_WSCANF_UNLOCKED = 0xCD6 - SYS__FLUSHLBF = 0xD68 - SYS__FLUSHLBF_UNLOCKED = 0xD6F - SYS___ACOSHF_H = 0xA54 - SYS___ACOSHL_H = 0xA55 - SYS___ASINHF_H = 0xA56 - SYS___ASINHL_H = 0xA57 - SYS___ATANPID128 = 0xC6D - SYS___ATANPID32 = 0xC6B - SYS___ATANPID64 = 0xC6C - SYS___CBRTF_H = 0xA58 - SYS___CBRTL_H = 0xA59 - SYS___CDUMP = 0x0C4 - SYS___CLASS = 0xAFA - SYS___CLASS2 = 0xB99 - SYS___CLASS2D128 = 0xC99 - SYS___CLASS2D32 = 0xC97 - SYS___CLASS2D64 = 0xC98 - SYS___CLASS2F = 0xC91 - SYS___CLASS2F_B = 0xC93 - SYS___CLASS2F_H = 0xC94 - SYS___CLASS2L = 0xC92 - SYS___CLASS2L_B = 0xC95 - SYS___CLASS2L_H = 0xC96 - SYS___CLASS2_B = 0xB9A - SYS___CLASS2_H = 0xB9B - SYS___CLASS_B = 0xAFB - SYS___CLASS_H = 0xAFC - SYS___CLOGL_B = 0xA01 - SYS___CLOGL_H = 0xA02 - SYS___CLRENV = 0x0C9 - SYS___CLRMF = 0x0BD - SYS___CODEPAGE_INFO = 0xC64 - SYS___CONJF_B = 0xA07 - SYS___CONJF_H = 0xA08 - SYS___CONJL_B = 0xA0A - SYS___CONJL_H = 0xA0B - SYS___CONJ_B = 0xA04 - SYS___CONJ_H = 0xA05 - SYS___COPYSIGN_B = 0xA5A - SYS___COPYSIGN_H = 0xAF5 - SYS___COSPID128 = 0xC70 - SYS___COSPID32 = 0xC6E - SYS___COSPID64 = 0xC6F - SYS___CPOWF_B = 0xA10 - SYS___CPOWF_H = 0xA11 - SYS___CPOWL_B = 0xA13 - SYS___CPOWL_H = 0xA14 - SYS___CPOW_B = 0xA0D - SYS___CPOW_H = 0xA0E - SYS___CPROJF_B = 0xA19 - SYS___CPROJF_H = 0xA1A - SYS___CPROJL_B = 0xA1C - SYS___CPROJL_H = 0xA1D - SYS___CPROJ_B = 0xA16 - SYS___CPROJ_H = 0xA17 - SYS___CREALF_B = 0xA22 - SYS___CREALF_H = 0xA23 - SYS___CREALL_B = 0xA25 - SYS___CREALL_H = 0xA26 - SYS___CREAL_B = 0xA1F - SYS___CREAL_H = 0xA20 - SYS___CSINF_B = 0xA2B - SYS___CSINF_H = 0xA2C - SYS___CSINHF_B = 0xA34 - SYS___CSINHF_H = 0xA35 - SYS___CSINHL_B = 0xA37 - SYS___CSINHL_H = 0xA38 - SYS___CSINH_B = 0xA31 - SYS___CSINH_H = 0xA32 - SYS___CSINL_B = 0xA2E - SYS___CSINL_H = 0xA2F - SYS___CSIN_B = 0xA28 - SYS___CSIN_H = 0xA29 - SYS___CSNAP = 0x0C5 - SYS___CSQRTF_B = 0xA3D - SYS___CSQRTF_H = 0xA3E - SYS___CSQRTL_B = 0xA40 - SYS___CSQRTL_H = 0xA41 - SYS___CSQRT_B = 0xA3A - SYS___CSQRT_H = 0xA3B - SYS___CTANF_B = 0xA46 - SYS___CTANF_H = 0xA47 - SYS___CTANHF_B = 0xA4F - SYS___CTANHF_H = 0xA50 - SYS___CTANHL_B = 0xA52 - SYS___CTANHL_H = 0xA53 - SYS___CTANH_B = 0xA4C - SYS___CTANH_H = 0xA4D - SYS___CTANL_B = 0xA49 - SYS___CTANL_H = 0xA4A - SYS___CTAN_B = 0xA43 - SYS___CTAN_H = 0xA44 - SYS___CTEST = 0x0C7 - SYS___CTRACE = 0x0C6 - SYS___D1TOP = 0xC9B - SYS___D2TOP = 0xC9C - SYS___D4TOP = 0xC9D - SYS___DYNALL = 0x0C3 - SYS___DYNFRE = 0x0C2 - SYS___EXP2F_H = 0xA5E - SYS___EXP2L_H = 0xA5F - SYS___EXP2_H = 0xA5D - SYS___EXPM1F_H = 0xA5B - SYS___EXPM1L_H = 0xA5C - SYS___FBUFSIZE = 0xD60 - SYS___FLBF = 0xD62 - SYS___FLDATA = 0x0C1 - SYS___FMAF_B = 0xA67 - SYS___FMAF_H = 0xA68 - SYS___FMAL_B = 0xA6A - SYS___FMAL_H = 0xA6B - SYS___FMAXF_B = 0xA70 - SYS___FMAXF_H = 0xA71 - SYS___FMAXL_B = 0xA73 - SYS___FMAXL_H = 0xA74 - SYS___FMAX_B = 0xA6D - SYS___FMAX_H = 0xA6E - SYS___FMA_B = 0xA64 - SYS___FMA_H = 0xA65 - SYS___FMINF_B = 0xA79 - SYS___FMINF_H = 0xA7A - SYS___FMINL_B = 0xA7C - SYS___FMINL_H = 0xA7D - SYS___FMIN_B = 0xA76 - SYS___FMIN_H = 0xA77 - SYS___FPENDING = 0xD61 - SYS___FPENDING_UNLOCKED = 0xD6C - SYS___FPURGE = 0xD69 - SYS___FPURGE_UNLOCKED = 0xD70 - SYS___FP_CAST_D = 0xBCB - SYS___FREADABLE = 0xD63 - SYS___FREADAHEAD = 0xD6A - SYS___FREADAHEAD_UNLOCKED = 0xD71 - SYS___FREADING = 0xD65 - SYS___FREADING_UNLOCKED = 0xD6D - SYS___FSEEK2 = 0xB3C - SYS___FSETERR = 0xD6B - SYS___FSETLOCKING = 0xD67 - SYS___FTCHEP = 0x0BF - SYS___FTELL2 = 0xB3B - SYS___FUPDT = 0x0B5 - SYS___FWRITABLE = 0xD64 - SYS___FWRITING = 0xD66 - SYS___FWRITING_UNLOCKED = 0xD6E - SYS___GETCB = 0x0B4 - SYS___GETGRGID1 = 0xD5B - SYS___GETGRNAM1 = 0xD5C - SYS___GETTHENT = 0xCE5 - SYS___GETTOD = 0xD3E - SYS___HYPOTF_H = 0xAF6 - SYS___HYPOTL_H = 0xAF7 - SYS___ILOGBF_B = 0xA7F - SYS___ILOGBF_H = 0xA80 - SYS___ILOGBL_B = 0xA82 - SYS___ILOGBL_H = 0xA83 - SYS___ISBLANK_A = 0xB2E - SYS___ISBLNK = 0x0FE - SYS___ISWBLANK_A = 0xB2F - SYS___LE_CEEGTJS = 0xD72 - SYS___LE_TRACEBACK = 0xB7A - SYS___LGAMMAL_H = 0xA62 - SYS___LGAMMA_B_C99 = 0xB39 - SYS___LGAMMA_H_C99 = 0xB38 - SYS___LGAMMA_R_C99 = 0xB3A - SYS___LLRINTF_B = 0xA88 - SYS___LLRINTF_H = 0xA89 - SYS___LLRINTL_B = 0xA8B - SYS___LLRINTL_H = 0xA8C - SYS___LLRINT_B = 0xA85 - SYS___LLRINT_H = 0xA86 - SYS___LLROUNDF_B = 0xA91 - SYS___LLROUNDF_H = 0xA92 - SYS___LLROUNDL_B = 0xA94 - SYS___LLROUNDL_H = 0xA95 - SYS___LLROUND_B = 0xA8E - SYS___LLROUND_H = 0xA8F - SYS___LOCALE_CTL = 0xD47 - SYS___LOG1PF_H = 0xA60 - SYS___LOG1PL_H = 0xA61 - SYS___LOGBF_B = 0xA97 - SYS___LOGBF_H = 0xA98 - SYS___LOGBL_B = 0xA9A - SYS___LOGBL_H = 0xA9B - SYS___LOGIN_APPLID = 0xCE2 - SYS___LRINTF_B = 0xAA0 - SYS___LRINTF_H = 0xAA1 - SYS___LRINTL_B = 0xAA3 - SYS___LRINTL_H = 0xAA4 - SYS___LRINT_B = 0xA9D - SYS___LRINT_H = 0xA9E - SYS___LROUNDF_FIXUP = 0xB31 - SYS___LROUNDL_B = 0xAA6 - SYS___LROUNDL_H = 0xAA7 - SYS___LROUND_FIXUP = 0xB30 - SYS___MOSERVICES = 0xD3D - SYS___MUST_STAY_CLEAN = 0xB7C - SYS___NANF_B = 0xAAB - SYS___NANL_B = 0xAAD - SYS___NAN_B = 0xAA9 - SYS___NEARBYINTF_B = 0xAB2 - SYS___NEARBYINTF_H = 0xAB3 - SYS___NEARBYINTL_B = 0xAB5 - SYS___NEARBYINTL_H = 0xAB6 - SYS___NEARBYINT_B = 0xAAF - SYS___NEARBYINT_H = 0xAB0 - SYS___NEXTAFTERF_B = 0xAB8 - SYS___NEXTAFTERF_H = 0xAB9 - SYS___NEXTAFTERL_B = 0xABB - SYS___NEXTAFTERL_H = 0xABC - SYS___NEXTTOWARDF_B = 0xAC1 - SYS___NEXTTOWARDF_H = 0xAC2 - SYS___NEXTTOWARDL_B = 0xAC4 - SYS___NEXTTOWARDL_H = 0xAC5 - SYS___NEXTTOWARD_B = 0xABE - SYS___NEXTTOWARD_H = 0xABF - SYS___O_ENV = 0xB7D - SYS___PASSWD_APPLID = 0xCE3 - SYS___PTOD1 = 0xC9E - SYS___PTOD2 = 0xC9F - SYS___PTOD4 = 0xCA0 - SYS___REGCOMP_STD = 0x0EA - SYS___REMAINDERF_H = 0xAC6 - SYS___REMAINDERL_H = 0xAC7 - SYS___REMQUOD128 = 0xC10 - SYS___REMQUOD32 = 0xC0E - SYS___REMQUOD64 = 0xC0F - SYS___REMQUOF_H = 0xAC9 - SYS___REMQUOL_H = 0xACA - SYS___REMQUO_H = 0xAC8 - SYS___RINTF_B = 0xACC - SYS___RINTL_B = 0xACE - SYS___ROUNDF_B = 0xAD3 - SYS___ROUNDF_H = 0xAD4 - SYS___ROUNDL_B = 0xAD6 - SYS___ROUNDL_H = 0xAD7 - SYS___ROUND_B = 0xAD0 - SYS___ROUND_H = 0xAD1 - SYS___SCALBLNF_B = 0xADC - SYS___SCALBLNF_H = 0xADD - SYS___SCALBLNL_B = 0xADF - SYS___SCALBLNL_H = 0xAE0 - SYS___SCALBLN_B = 0xAD9 - SYS___SCALBLN_H = 0xADA - SYS___SCALBNF_B = 0xAE4 - SYS___SCALBNF_H = 0xAE5 - SYS___SCALBNL_B = 0xAE7 - SYS___SCALBNL_H = 0xAE8 - SYS___SCALBN_B = 0xAE1 - SYS___SCALBN_H = 0xAE2 - SYS___SETENV = 0x0C8 - SYS___SINPID128 = 0xC73 - SYS___SINPID32 = 0xC71 - SYS___SINPID64 = 0xC72 - SYS___SMF_RECORD2 = 0xD48 - SYS___STATIC_REINIT = 0xB3D - SYS___TGAMMAF_H_C99 = 0xB79 - SYS___TGAMMAL_H = 0xAE9 - SYS___TGAMMA_H_C99 = 0xB78 - SYS___TOCSNAME2 = 0xC9A - SYS_CEIL = 0x01F - SYS_CHAUDIT = 0x1E0 - SYS_EXP = 0x01A - SYS_FCHAUDIT = 0x1E1 - SYS_FREXP = 0x01D - SYS_GETGROUPSBYNAME = 0x1E2 - SYS_GETPWUID = 0x1A0 - SYS_GETUID = 0x1A1 - SYS_ISATTY = 0x1A3 - SYS_KILL = 0x1A4 - SYS_LDEXP = 0x01E - SYS_LINK = 0x1A5 - SYS_LOG10 = 0x01C - SYS_LSEEK = 0x1A6 - SYS_LSTAT = 0x1A7 - SYS_MKDIR = 0x1A8 - SYS_MKFIFO = 0x1A9 - SYS_MKNOD = 0x1AA - SYS_MODF = 0x01B - SYS_MOUNT = 0x1AB - SYS_OPEN = 0x1AC - SYS_OPENDIR = 0x1AD - SYS_PATHCONF = 0x1AE - SYS_PAUSE = 0x1AF - SYS_PIPE = 0x1B0 - SYS_PTHREAD_ATTR_DESTROY = 0x1E7 - SYS_PTHREAD_ATTR_GETDETACHSTATE = 0x1EB - SYS_PTHREAD_ATTR_GETSTACKSIZE = 0x1E9 - SYS_PTHREAD_ATTR_GETWEIGHT_NP = 0x1ED - SYS_PTHREAD_ATTR_INIT = 0x1E6 - SYS_PTHREAD_ATTR_SETDETACHSTATE = 0x1EA - SYS_PTHREAD_ATTR_SETSTACKSIZE = 0x1E8 - SYS_PTHREAD_ATTR_SETWEIGHT_NP = 0x1EC - SYS_PTHREAD_CANCEL = 0x1EE - SYS_PTHREAD_CLEANUP_POP = 0x1F0 - SYS_PTHREAD_CLEANUP_PUSH = 0x1EF - SYS_PTHREAD_CONDATTR_DESTROY = 0x1F2 - SYS_PTHREAD_CONDATTR_INIT = 0x1F1 - SYS_PTHREAD_COND_BROADCAST = 0x1F6 - SYS_PTHREAD_COND_DESTROY = 0x1F4 - SYS_PTHREAD_COND_INIT = 0x1F3 - SYS_PTHREAD_COND_SIGNAL = 0x1F5 - SYS_PTHREAD_COND_TIMEDWAIT = 0x1F8 - SYS_PTHREAD_COND_WAIT = 0x1F7 - SYS_PTHREAD_CREATE = 0x1F9 - SYS_PTHREAD_DETACH = 0x1FA - SYS_PTHREAD_EQUAL = 0x1FB - SYS_PTHREAD_EXIT = 0x1E4 - SYS_PTHREAD_GETSPECIFIC = 0x1FC - SYS_PTHREAD_JOIN = 0x1FD - SYS_PTHREAD_KEY_CREATE = 0x1FE - SYS_PTHREAD_KILL = 0x1E5 - SYS_PTHREAD_MUTEXATTR_INIT = 0x1FF - SYS_READ = 0x1B2 - SYS_READDIR = 0x1B3 - SYS_READLINK = 0x1B4 - SYS_REWINDDIR = 0x1B5 - SYS_RMDIR = 0x1B6 - SYS_SETEGID = 0x1B7 - SYS_SETEUID = 0x1B8 - SYS_SETGID = 0x1B9 - SYS_SETPGID = 0x1BA - SYS_SETSID = 0x1BB - SYS_SETUID = 0x1BC - SYS_SIGACTION = 0x1BD - SYS_SIGADDSET = 0x1BE - SYS_SIGDELSET = 0x1BF - SYS_SIGEMPTYSET = 0x1C0 - SYS_SIGFILLSET = 0x1C1 - SYS_SIGISMEMBER = 0x1C2 - SYS_SIGLONGJMP = 0x1C3 - SYS_SIGPENDING = 0x1C4 - SYS_SIGPROCMASK = 0x1C5 - SYS_SIGSETJMP = 0x1C6 - SYS_SIGSUSPEND = 0x1C7 - SYS_SIGWAIT = 0x1E3 - SYS_SLEEP = 0x1C8 - SYS_STAT = 0x1C9 - SYS_SYMLINK = 0x1CB - SYS_SYSCONF = 0x1CC - SYS_TCDRAIN = 0x1CD - SYS_TCFLOW = 0x1CE - SYS_TCFLUSH = 0x1CF - SYS_TCGETATTR = 0x1D0 - SYS_TCGETPGRP = 0x1D1 - SYS_TCSENDBREAK = 0x1D2 - SYS_TCSETATTR = 0x1D3 - SYS_TCSETPGRP = 0x1D4 - SYS_TIMES = 0x1D5 - SYS_TTYNAME = 0x1D6 - SYS_TZSET = 0x1D7 - SYS_UMASK = 0x1D8 - SYS_UMOUNT = 0x1D9 - SYS_UNAME = 0x1DA - SYS_UNLINK = 0x1DB - SYS_UTIME = 0x1DC - SYS_WAIT = 0x1DD - SYS_WAITPID = 0x1DE - SYS_WRITE = 0x1DF - SYS_W_GETPSENT = 0x1B1 - SYS_W_IOCTL = 0x1A2 - SYS_W_STATFS = 0x1CA - SYS_A64L = 0x2EF - SYS_BCMP = 0x2B9 - SYS_BCOPY = 0x2BA - SYS_BZERO = 0x2BB - SYS_CATCLOSE = 0x2B6 - SYS_CATGETS = 0x2B7 - SYS_CATOPEN = 0x2B8 - SYS_CRYPT = 0x2AC - SYS_DBM_CLEARERR = 0x2F7 - SYS_DBM_CLOSE = 0x2F8 - SYS_DBM_DELETE = 0x2F9 - SYS_DBM_ERROR = 0x2FA - SYS_DBM_FETCH = 0x2FB - SYS_DBM_FIRSTKEY = 0x2FC - SYS_DBM_NEXTKEY = 0x2FD - SYS_DBM_OPEN = 0x2FE - SYS_DBM_STORE = 0x2FF - SYS_DRAND48 = 0x2B2 - SYS_ENCRYPT = 0x2AD - SYS_ENDUTXENT = 0x2E1 - SYS_ERAND48 = 0x2B3 - SYS_ERF = 0x02C - SYS_ERFC = 0x02D - SYS_FCHDIR = 0x2D9 - SYS_FFS = 0x2BC - SYS_FMTMSG = 0x2E5 - SYS_FSTATVFS = 0x2B4 - SYS_FTIME = 0x2F5 - SYS_GAMMA = 0x02E - SYS_GETDATE = 0x2A6 - SYS_GETPAGESIZE = 0x2D8 - SYS_GETTIMEOFDAY = 0x2F6 - SYS_GETUTXENT = 0x2E0 - SYS_GETUTXID = 0x2E2 - SYS_GETUTXLINE = 0x2E3 - SYS_HCREATE = 0x2C6 - SYS_HDESTROY = 0x2C7 - SYS_HSEARCH = 0x2C8 - SYS_HYPOT = 0x02B - SYS_INDEX = 0x2BD - SYS_INITSTATE = 0x2C2 - SYS_INSQUE = 0x2CF - SYS_ISASCII = 0x2ED - SYS_JRAND48 = 0x2E6 - SYS_L64A = 0x2F0 - SYS_LCONG48 = 0x2EA - SYS_LFIND = 0x2C9 - SYS_LRAND48 = 0x2E7 - SYS_LSEARCH = 0x2CA - SYS_MEMCCPY = 0x2D4 - SYS_MRAND48 = 0x2E8 - SYS_NRAND48 = 0x2E9 - SYS_PCLOSE = 0x2D2 - SYS_POPEN = 0x2D1 - SYS_PUTUTXLINE = 0x2E4 - SYS_RANDOM = 0x2C4 - SYS_REMQUE = 0x2D0 - SYS_RINDEX = 0x2BE - SYS_SEED48 = 0x2EC - SYS_SETKEY = 0x2AE - SYS_SETSTATE = 0x2C3 - SYS_SETUTXENT = 0x2DF - SYS_SRAND48 = 0x2EB - SYS_SRANDOM = 0x2C5 - SYS_STATVFS = 0x2B5 - SYS_STRCASECMP = 0x2BF - SYS_STRDUP = 0x2C0 - SYS_STRNCASECMP = 0x2C1 - SYS_SWAB = 0x2D3 - SYS_TDELETE = 0x2CB - SYS_TFIND = 0x2CC - SYS_TOASCII = 0x2EE - SYS_TSEARCH = 0x2CD - SYS_TWALK = 0x2CE - SYS_UALARM = 0x2F1 - SYS_USLEEP = 0x2F2 - SYS_WAIT3 = 0x2A7 - SYS_WAITID = 0x2A8 - SYS_Y1 = 0x02A - SYS___ATOE = 0x2DB - SYS___ATOE_L = 0x2DC - SYS___CATTRM = 0x2A9 - SYS___CNVBLK = 0x2AF - SYS___CRYTRM = 0x2B0 - SYS___DLGHT = 0x2A1 - SYS___ECRTRM = 0x2B1 - SYS___ETOA = 0x2DD - SYS___ETOA_L = 0x2DE - SYS___GDTRM = 0x2AA - SYS___OCLCK = 0x2DA - SYS___OPARGF = 0x2A2 - SYS___OPERRF = 0x2A5 - SYS___OPINDF = 0x2A4 - SYS___OPOPTF = 0x2A3 - SYS___RNDTRM = 0x2AB - SYS___SRCTRM = 0x2F4 - SYS___TZONE = 0x2A0 - SYS___UTXTRM = 0x2F3 - SYS_ASIN = 0x03E - SYS_ISXDIGIT = 0x03B - SYS_SETLOCAL = 0x03A - SYS_SETLOCALE = 0x03A - SYS_SIN = 0x03F - SYS_TOLOWER = 0x03C - SYS_TOUPPER = 0x03D - SYS_ACCEPT_AND_RECV = 0x4F7 - SYS_ATOL = 0x04E - SYS_CHECKSCH = 0x4BC - SYS_CHECKSCHENV = 0x4BC - SYS_CLEARERR = 0x04C - SYS_CONNECTS = 0x4B5 - SYS_CONNECTSERVER = 0x4B5 - SYS_CONNECTW = 0x4B4 - SYS_CONNECTWORKMGR = 0x4B4 - SYS_CONTINUE = 0x4B3 - SYS_CONTINUEWORKUNIT = 0x4B3 - SYS_COPYSIGN = 0x4C2 - SYS_CREATEWO = 0x4B2 - SYS_CREATEWORKUNIT = 0x4B2 - SYS_DELETEWO = 0x4B9 - SYS_DELETEWORKUNIT = 0x4B9 - SYS_DISCONNE = 0x4B6 - SYS_DISCONNECTSERVER = 0x4B6 - SYS_FEOF = 0x04D - SYS_FERROR = 0x04A - SYS_FINITE = 0x4C8 - SYS_GAMMA_R = 0x4E2 - SYS_JOINWORK = 0x4B7 - SYS_JOINWORKUNIT = 0x4B7 - SYS_LEAVEWOR = 0x4B8 - SYS_LEAVEWORKUNIT = 0x4B8 - SYS_LGAMMA_R = 0x4EB - SYS_MATHERR = 0x4D0 - SYS_PERROR = 0x04F - SYS_QUERYMET = 0x4BA - SYS_QUERYMETRICS = 0x4BA - SYS_QUERYSCH = 0x4BB - SYS_QUERYSCHENV = 0x4BB - SYS_REWIND = 0x04B - SYS_SCALBN = 0x4D4 - SYS_SIGNIFIC = 0x4D5 - SYS_SIGNIFICAND = 0x4D5 - SYS___ACOSH_B = 0x4DA - SYS___ACOS_B = 0x4D9 - SYS___ASINH_B = 0x4BE - SYS___ASIN_B = 0x4DB - SYS___ATAN2_B = 0x4DC - SYS___ATANH_B = 0x4DD - SYS___ATAN_B = 0x4BF - SYS___CBRT_B = 0x4C0 - SYS___CEIL_B = 0x4C1 - SYS___COSH_B = 0x4DE - SYS___COS_B = 0x4C3 - SYS___DGHT = 0x4A8 - SYS___ENVN = 0x4B0 - SYS___ERFC_B = 0x4C5 - SYS___ERF_B = 0x4C4 - SYS___EXPM1_B = 0x4C6 - SYS___EXP_B = 0x4DF - SYS___FABS_B = 0x4C7 - SYS___FLOOR_B = 0x4C9 - SYS___FMOD_B = 0x4E0 - SYS___FP_SETMODE = 0x4F8 - SYS___FREXP_B = 0x4CA - SYS___GAMMA_B = 0x4E1 - SYS___GDRR = 0x4A1 - SYS___HRRNO = 0x4A2 - SYS___HYPOT_B = 0x4E3 - SYS___ILOGB_B = 0x4CB - SYS___ISNAN_B = 0x4CC - SYS___J0_B = 0x4E4 - SYS___J1_B = 0x4E6 - SYS___JN_B = 0x4E8 - SYS___LDEXP_B = 0x4CD - SYS___LGAMMA_B = 0x4EA - SYS___LOG10_B = 0x4ED - SYS___LOG1P_B = 0x4CE - SYS___LOGB_B = 0x4CF - SYS___LOGIN = 0x4F5 - SYS___LOG_B = 0x4EC - SYS___MLOCKALL = 0x4B1 - SYS___MODF_B = 0x4D1 - SYS___NEXTAFTER_B = 0x4D2 - SYS___OPENDIR2 = 0x4F3 - SYS___OPEN_STAT = 0x4F6 - SYS___OPND = 0x4A5 - SYS___OPPT = 0x4A6 - SYS___OPRG = 0x4A3 - SYS___OPRR = 0x4A4 - SYS___PID_AFFINITY = 0x4BD - SYS___POW_B = 0x4EE - SYS___READDIR2 = 0x4F4 - SYS___REMAINDER_B = 0x4EF - SYS___RINT_B = 0x4D3 - SYS___SCALB_B = 0x4F0 - SYS___SIGACTIONSET = 0x4FB - SYS___SIGGM = 0x4A7 - SYS___SINH_B = 0x4F1 - SYS___SIN_B = 0x4D6 - SYS___SQRT_B = 0x4F2 - SYS___TANH_B = 0x4D8 - SYS___TAN_B = 0x4D7 - SYS___TRRNO = 0x4AF - SYS___TZNE = 0x4A9 - SYS___TZZN = 0x4AA - SYS___UCREATE = 0x4FC - SYS___UFREE = 0x4FE - SYS___UHEAPREPORT = 0x4FF - SYS___UMALLOC = 0x4FD - SYS___Y0_B = 0x4E5 - SYS___Y1_B = 0x4E7 - SYS___YN_B = 0x4E9 - SYS_ABORT = 0x05C - SYS_ASCTIME_R = 0x5E0 - SYS_ATEXIT = 0x05D - SYS_CONNECTE = 0x5AE - SYS_CONNECTEXPORTIMPORT = 0x5AE - SYS_CTIME_R = 0x5E1 - SYS_DN_COMP = 0x5DF - SYS_DN_EXPAND = 0x5DD - SYS_DN_SKIPNAME = 0x5DE - SYS_EXIT = 0x05A - SYS_EXPORTWO = 0x5A1 - SYS_EXPORTWORKUNIT = 0x5A1 - SYS_EXTRACTW = 0x5A5 - SYS_EXTRACTWORKUNIT = 0x5A5 - SYS_FSEEKO = 0x5C9 - SYS_FTELLO = 0x5C8 - SYS_GETGRGID_R = 0x5E7 - SYS_GETGRNAM_R = 0x5E8 - SYS_GETLOGIN_R = 0x5E9 - SYS_GETPWNAM_R = 0x5EA - SYS_GETPWUID_R = 0x5EB - SYS_GMTIME_R = 0x5E2 - SYS_IMPORTWO = 0x5A3 - SYS_IMPORTWORKUNIT = 0x5A3 - SYS_INET_NTOP = 0x5D3 - SYS_INET_PTON = 0x5D4 - SYS_LLABS = 0x5CE - SYS_LLDIV = 0x5CB - SYS_LOCALTIME_R = 0x5E3 - SYS_PTHREAD_ATFORK = 0x5ED - SYS_PTHREAD_ATTR_GETDETACHSTATE_U98 = 0x5FB - SYS_PTHREAD_ATTR_GETGUARDSIZE = 0x5EE - SYS_PTHREAD_ATTR_GETSCHEDPARAM = 0x5F9 - SYS_PTHREAD_ATTR_GETSTACKADDR = 0x5EF - SYS_PTHREAD_ATTR_SETDETACHSTATE_U98 = 0x5FC - SYS_PTHREAD_ATTR_SETGUARDSIZE = 0x5F0 - SYS_PTHREAD_ATTR_SETSCHEDPARAM = 0x5FA - SYS_PTHREAD_ATTR_SETSTACKADDR = 0x5F1 - SYS_PTHREAD_CONDATTR_GETPSHARED = 0x5F2 - SYS_PTHREAD_CONDATTR_SETPSHARED = 0x5F3 - SYS_PTHREAD_DETACH_U98 = 0x5FD - SYS_PTHREAD_GETCONCURRENCY = 0x5F4 - SYS_PTHREAD_GETSPECIFIC_U98 = 0x5FE - SYS_PTHREAD_KEY_DELETE = 0x5F5 - SYS_PTHREAD_SETCANCELSTATE = 0x5FF - SYS_PTHREAD_SETCONCURRENCY = 0x5F6 - SYS_PTHREAD_SIGMASK = 0x5F7 - SYS_QUERYENC = 0x5AD - SYS_QUERYWORKUNITCLASSIFICATION = 0x5AD - SYS_RAISE = 0x05E - SYS_RAND_R = 0x5E4 - SYS_READDIR_R = 0x5E6 - SYS_REALLOC = 0x05B - SYS_RES_INIT = 0x5D8 - SYS_RES_MKQUERY = 0x5D7 - SYS_RES_QUERY = 0x5D9 - SYS_RES_QUERYDOMAIN = 0x5DC - SYS_RES_SEARCH = 0x5DA - SYS_RES_SEND = 0x5DB - SYS_SETJMP = 0x05F - SYS_SIGQUEUE = 0x5A9 - SYS_STRTOK_R = 0x5E5 - SYS_STRTOLL = 0x5B0 - SYS_STRTOULL = 0x5B1 - SYS_TTYNAME_R = 0x5EC - SYS_UNDOEXPO = 0x5A2 - SYS_UNDOEXPORTWORKUNIT = 0x5A2 - SYS_UNDOIMPO = 0x5A4 - SYS_UNDOIMPORTWORKUNIT = 0x5A4 - SYS_WCSTOLL = 0x5CC - SYS_WCSTOULL = 0x5CD - SYS___ABORT = 0x05C - SYS___CONSOLE2 = 0x5D2 - SYS___CPL = 0x5A6 - SYS___DISCARDDATA = 0x5F8 - SYS___DSA_PREV = 0x5B2 - SYS___EP_FIND = 0x5B3 - SYS___FP_SWAPMODE = 0x5AF - SYS___GETUSERID = 0x5AB - SYS___GET_CPUID = 0x5B9 - SYS___GET_SYSTEM_SETTINGS = 0x5BA - SYS___IPDOMAINNAME = 0x5AC - SYS___MAP_INIT = 0x5A7 - SYS___MAP_SERVICE = 0x5A8 - SYS___MOUNT = 0x5AA - SYS___MSGRCV_TIMED = 0x5B7 - SYS___RES = 0x5D6 - SYS___SEMOP_TIMED = 0x5B8 - SYS___SERVER_THREADS_QUERY = 0x5B4 - SYS_FPRINTF = 0x06D - SYS_FSCANF = 0x06A - SYS_PRINTF = 0x06F - SYS_SETBUF = 0x06B - SYS_SETVBUF = 0x06C - SYS_SSCANF = 0x06E - SYS___CATGETS_A = 0x6C0 - SYS___CHAUDIT_A = 0x6F4 - SYS___CHMOD_A = 0x6E8 - SYS___COLLATE_INIT_A = 0x6AC - SYS___CREAT_A = 0x6F6 - SYS___CTYPE_INIT_A = 0x6AF - SYS___DLLLOAD_A = 0x6DF - SYS___DLLQUERYFN_A = 0x6E0 - SYS___DLLQUERYVAR_A = 0x6E1 - SYS___E2A_L = 0x6E3 - SYS___EXECLE_A = 0x6A0 - SYS___EXECLP_A = 0x6A4 - SYS___EXECVE_A = 0x6C1 - SYS___EXECVP_A = 0x6C2 - SYS___EXECV_A = 0x6B1 - SYS___FPRINTF_A = 0x6FA - SYS___GETADDRINFO_A = 0x6BF - SYS___GETNAMEINFO_A = 0x6C4 - SYS___GET_WCTYPE_STD_A = 0x6AE - SYS___ICONV_OPEN_A = 0x6DE - SYS___IF_INDEXTONAME_A = 0x6DC - SYS___IF_NAMETOINDEX_A = 0x6DB - SYS___ISWCTYPE_A = 0x6B0 - SYS___IS_WCTYPE_STD_A = 0x6B2 - SYS___LOCALECONV_A = 0x6B8 - SYS___LOCALECONV_STD_A = 0x6B9 - SYS___LOCALE_INIT_A = 0x6B7 - SYS___LSTAT_A = 0x6EE - SYS___LSTAT_O_A = 0x6EF - SYS___MKDIR_A = 0x6E9 - SYS___MKFIFO_A = 0x6EC - SYS___MKNOD_A = 0x6F0 - SYS___MONETARY_INIT_A = 0x6BC - SYS___MOUNT_A = 0x6F1 - SYS___NL_CSINFO_A = 0x6D6 - SYS___NL_LANGINFO_A = 0x6BA - SYS___NL_LNAGINFO_STD_A = 0x6BB - SYS___NL_MONINFO_A = 0x6D7 - SYS___NL_NUMINFO_A = 0x6D8 - SYS___NL_RESPINFO_A = 0x6D9 - SYS___NL_TIMINFO_A = 0x6DA - SYS___NUMERIC_INIT_A = 0x6C6 - SYS___OPEN_A = 0x6F7 - SYS___PRINTF_A = 0x6DD - SYS___RESP_INIT_A = 0x6C7 - SYS___RPMATCH_A = 0x6C8 - SYS___RPMATCH_C_A = 0x6C9 - SYS___RPMATCH_STD_A = 0x6CA - SYS___SETLOCALE_A = 0x6F9 - SYS___SPAWNP_A = 0x6C5 - SYS___SPAWN_A = 0x6C3 - SYS___SPRINTF_A = 0x6FB - SYS___STAT_A = 0x6EA - SYS___STAT_O_A = 0x6EB - SYS___STRCOLL_STD_A = 0x6A1 - SYS___STRFMON_A = 0x6BD - SYS___STRFMON_STD_A = 0x6BE - SYS___STRFTIME_A = 0x6CC - SYS___STRFTIME_STD_A = 0x6CD - SYS___STRPTIME_A = 0x6CE - SYS___STRPTIME_STD_A = 0x6CF - SYS___STRXFRM_A = 0x6A2 - SYS___STRXFRM_C_A = 0x6A3 - SYS___STRXFRM_STD_A = 0x6A5 - SYS___SYNTAX_INIT_A = 0x6D4 - SYS___TIME_INIT_A = 0x6CB - SYS___TOD_INIT_A = 0x6D5 - SYS___TOWLOWER_A = 0x6B3 - SYS___TOWLOWER_STD_A = 0x6B4 - SYS___TOWUPPER_A = 0x6B5 - SYS___TOWUPPER_STD_A = 0x6B6 - SYS___UMOUNT_A = 0x6F2 - SYS___VFPRINTF_A = 0x6FC - SYS___VPRINTF_A = 0x6FD - SYS___VSPRINTF_A = 0x6FE - SYS___VSWPRINTF_A = 0x6FF - SYS___WCSCOLL_A = 0x6A6 - SYS___WCSCOLL_C_A = 0x6A7 - SYS___WCSCOLL_STD_A = 0x6A8 - SYS___WCSFTIME_A = 0x6D0 - SYS___WCSFTIME_STD_A = 0x6D1 - SYS___WCSXFRM_A = 0x6A9 - SYS___WCSXFRM_C_A = 0x6AA - SYS___WCSXFRM_STD_A = 0x6AB - SYS___WCTYPE_A = 0x6AD - SYS___W_GETMNTENT_A = 0x6F5 - SYS_____CCSIDTYPE_A = 0x6E6 - SYS_____CHATTR_A = 0x6E2 - SYS_____CSNAMETYPE_A = 0x6E7 - SYS_____OPEN_STAT_A = 0x6ED - SYS_____SPAWN2_A = 0x6D2 - SYS_____SPAWNP2_A = 0x6D3 - SYS_____TOCCSID_A = 0x6E4 - SYS_____TOCSNAME_A = 0x6E5 - SYS_ACL_FREE = 0x7FF - SYS_ACL_INIT = 0x7FE - SYS_FWIDE = 0x7DF - SYS_FWPRINTF = 0x7D1 - SYS_FWRITE = 0x07E - SYS_FWSCANF = 0x7D5 - SYS_GETCHAR = 0x07B - SYS_GETS = 0x07C - SYS_M_CREATE_LAYOUT = 0x7C9 - SYS_M_DESTROY_LAYOUT = 0x7CA - SYS_M_GETVALUES_LAYOUT = 0x7CB - SYS_M_SETVALUES_LAYOUT = 0x7CC - SYS_M_TRANSFORM_LAYOUT = 0x7CD - SYS_M_WTRANSFORM_LAYOUT = 0x7CE - SYS_PREAD = 0x7C7 - SYS_PUTC = 0x07D - SYS_PUTCHAR = 0x07A - SYS_PUTS = 0x07F - SYS_PWRITE = 0x7C8 - SYS_TOWCTRAN = 0x7D8 - SYS_TOWCTRANS = 0x7D8 - SYS_UNATEXIT = 0x7B5 - SYS_VFWPRINT = 0x7D3 - SYS_VFWPRINTF = 0x7D3 - SYS_VWPRINTF = 0x7D4 - SYS_WCTRANS = 0x7D7 - SYS_WPRINTF = 0x7D2 - SYS_WSCANF = 0x7D6 - SYS___ASCTIME_R_A = 0x7A1 - SYS___BASENAME_A = 0x7DC - SYS___BTOWC_A = 0x7E4 - SYS___CDUMP_A = 0x7B7 - SYS___CEE3DMP_A = 0x7B6 - SYS___CEILF_H = 0x7F4 - SYS___CEILL_H = 0x7F5 - SYS___CEIL_H = 0x7EA - SYS___CRYPT_A = 0x7BE - SYS___CSNAP_A = 0x7B8 - SYS___CTEST_A = 0x7B9 - SYS___CTIME_R_A = 0x7A2 - SYS___CTRACE_A = 0x7BA - SYS___DBM_OPEN_A = 0x7E6 - SYS___DIRNAME_A = 0x7DD - SYS___FABSF_H = 0x7FA - SYS___FABSL_H = 0x7FB - SYS___FABS_H = 0x7ED - SYS___FGETWC_A = 0x7AA - SYS___FGETWS_A = 0x7AD - SYS___FLOORF_H = 0x7F6 - SYS___FLOORL_H = 0x7F7 - SYS___FLOOR_H = 0x7EB - SYS___FPUTWC_A = 0x7A5 - SYS___FPUTWS_A = 0x7A8 - SYS___GETTIMEOFDAY_A = 0x7AE - SYS___GETWCHAR_A = 0x7AC - SYS___GETWC_A = 0x7AB - SYS___GLOB_A = 0x7DE - SYS___GMTIME_A = 0x7AF - SYS___GMTIME_R_A = 0x7B0 - SYS___INET_PTON_A = 0x7BC - SYS___J0_H = 0x7EE - SYS___J1_H = 0x7EF - SYS___JN_H = 0x7F0 - SYS___LOCALTIME_A = 0x7B1 - SYS___LOCALTIME_R_A = 0x7B2 - SYS___MALLOC24 = 0x7FC - SYS___MALLOC31 = 0x7FD - SYS___MKTIME_A = 0x7B3 - SYS___MODFF_H = 0x7F8 - SYS___MODFL_H = 0x7F9 - SYS___MODF_H = 0x7EC - SYS___OPENDIR_A = 0x7C2 - SYS___OSNAME = 0x7E0 - SYS___PUTWCHAR_A = 0x7A7 - SYS___PUTWC_A = 0x7A6 - SYS___READDIR_A = 0x7C3 - SYS___STRTOLL_A = 0x7A3 - SYS___STRTOULL_A = 0x7A4 - SYS___SYSLOG_A = 0x7BD - SYS___TZZNA = 0x7B4 - SYS___UNGETWC_A = 0x7A9 - SYS___UTIME_A = 0x7A0 - SYS___VFPRINTF2_A = 0x7E7 - SYS___VPRINTF2_A = 0x7E8 - SYS___VSPRINTF2_A = 0x7E9 - SYS___VSWPRNTF2_A = 0x7BB - SYS___WCSTOD_A = 0x7D9 - SYS___WCSTOL_A = 0x7DA - SYS___WCSTOUL_A = 0x7DB - SYS___WCTOB_A = 0x7E5 - SYS___Y0_H = 0x7F1 - SYS___Y1_H = 0x7F2 - SYS___YN_H = 0x7F3 - SYS_____OPENDIR2_A = 0x7BF - SYS_____OSNAME_A = 0x7E1 - SYS_____READDIR2_A = 0x7C0 - SYS_DLCLOSE = 0x8DF - SYS_DLERROR = 0x8E0 - SYS_DLOPEN = 0x8DD - SYS_DLSYM = 0x8DE - SYS_FLOCKFILE = 0x8D3 - SYS_FTRYLOCKFILE = 0x8D4 - SYS_FUNLOCKFILE = 0x8D5 - SYS_GETCHAR_UNLOCKED = 0x8D7 - SYS_GETC_UNLOCKED = 0x8D6 - SYS_PUTCHAR_UNLOCKED = 0x8D9 - SYS_PUTC_UNLOCKED = 0x8D8 - SYS_SNPRINTF = 0x8DA - SYS_VSNPRINTF = 0x8DB - SYS_WCSCSPN = 0x08B - SYS_WCSLEN = 0x08C - SYS_WCSNCAT = 0x08D - SYS_WCSNCMP = 0x08A - SYS_WCSNCPY = 0x08F - SYS_WCSSPN = 0x08E - SYS___ABSF_H = 0x8E7 - SYS___ABSL_H = 0x8E8 - SYS___ABS_H = 0x8E6 - SYS___ACOSF_H = 0x8EA - SYS___ACOSH_H = 0x8EC - SYS___ACOSL_H = 0x8EB - SYS___ACOS_H = 0x8E9 - SYS___ASINF_H = 0x8EE - SYS___ASINH_H = 0x8F0 - SYS___ASINL_H = 0x8EF - SYS___ASIN_H = 0x8ED - SYS___ATAN2F_H = 0x8F8 - SYS___ATAN2L_H = 0x8F9 - SYS___ATAN2_H = 0x8F7 - SYS___ATANF_H = 0x8F2 - SYS___ATANHF_H = 0x8F5 - SYS___ATANHL_H = 0x8F6 - SYS___ATANH_H = 0x8F4 - SYS___ATANL_H = 0x8F3 - SYS___ATAN_H = 0x8F1 - SYS___CBRT_H = 0x8FA - SYS___COPYSIGNF_H = 0x8FB - SYS___COPYSIGNL_H = 0x8FC - SYS___COSF_H = 0x8FE - SYS___COSL_H = 0x8FF - SYS___COS_H = 0x8FD - SYS___DLERROR_A = 0x8D2 - SYS___DLOPEN_A = 0x8D0 - SYS___DLSYM_A = 0x8D1 - SYS___GETUTXENT_A = 0x8C6 - SYS___GETUTXID_A = 0x8C7 - SYS___GETUTXLINE_A = 0x8C8 - SYS___ITOA = 0x8AA - SYS___ITOA_A = 0x8B0 - SYS___LE_CONDITION_TOKEN_BUILD = 0x8A5 - SYS___LE_MSG_ADD_INSERT = 0x8A6 - SYS___LE_MSG_GET = 0x8A7 - SYS___LE_MSG_GET_AND_WRITE = 0x8A8 - SYS___LE_MSG_WRITE = 0x8A9 - SYS___LLTOA = 0x8AE - SYS___LLTOA_A = 0x8B4 - SYS___LTOA = 0x8AC - SYS___LTOA_A = 0x8B2 - SYS___PUTCHAR_UNLOCKED_A = 0x8CC - SYS___PUTC_UNLOCKED_A = 0x8CB - SYS___PUTUTXLINE_A = 0x8C9 - SYS___RESET_EXCEPTION_HANDLER = 0x8E3 - SYS___REXEC_A = 0x8C4 - SYS___REXEC_AF_A = 0x8C5 - SYS___SET_EXCEPTION_HANDLER = 0x8E2 - SYS___SNPRINTF_A = 0x8CD - SYS___SUPERKILL = 0x8A4 - SYS___TCGETATTR_A = 0x8A1 - SYS___TCSETATTR_A = 0x8A2 - SYS___ULLTOA = 0x8AF - SYS___ULLTOA_A = 0x8B5 - SYS___ULTOA = 0x8AD - SYS___ULTOA_A = 0x8B3 - SYS___UTOA = 0x8AB - SYS___UTOA_A = 0x8B1 - SYS___VHM_EVENT = 0x8E4 - SYS___VSNPRINTF_A = 0x8CE - SYS_____GETENV_A = 0x8C3 - SYS_____UTMPXNAME_A = 0x8CA - SYS_CACOSH = 0x9A0 - SYS_CACOSHF = 0x9A3 - SYS_CACOSHL = 0x9A6 - SYS_CARG = 0x9A9 - SYS_CARGF = 0x9AC - SYS_CARGL = 0x9AF - SYS_CASIN = 0x9B2 - SYS_CASINF = 0x9B5 - SYS_CASINH = 0x9BB - SYS_CASINHF = 0x9BE - SYS_CASINHL = 0x9C1 - SYS_CASINL = 0x9B8 - SYS_CATAN = 0x9C4 - SYS_CATANF = 0x9C7 - SYS_CATANH = 0x9CD - SYS_CATANHF = 0x9D0 - SYS_CATANHL = 0x9D3 - SYS_CATANL = 0x9CA - SYS_CCOS = 0x9D6 - SYS_CCOSF = 0x9D9 - SYS_CCOSH = 0x9DF - SYS_CCOSHF = 0x9E2 - SYS_CCOSHL = 0x9E5 - SYS_CCOSL = 0x9DC - SYS_CEXP = 0x9E8 - SYS_CEXPF = 0x9EB - SYS_CEXPL = 0x9EE - SYS_CIMAG = 0x9F1 - SYS_CIMAGF = 0x9F4 - SYS_CIMAGL = 0x9F7 - SYS_CLOGF = 0x9FD - SYS_MEMCHR = 0x09B - SYS_MEMCMP = 0x09A - SYS_STRCOLL = 0x09C - SYS_STRNCMP = 0x09D - SYS_STRRCHR = 0x09F - SYS_STRXFRM = 0x09E - SYS___CACOSHF_B = 0x9A4 - SYS___CACOSHF_H = 0x9A5 - SYS___CACOSHL_B = 0x9A7 - SYS___CACOSHL_H = 0x9A8 - SYS___CACOSH_B = 0x9A1 - SYS___CACOSH_H = 0x9A2 - SYS___CARGF_B = 0x9AD - SYS___CARGF_H = 0x9AE - SYS___CARGL_B = 0x9B0 - SYS___CARGL_H = 0x9B1 - SYS___CARG_B = 0x9AA - SYS___CARG_H = 0x9AB - SYS___CASINF_B = 0x9B6 - SYS___CASINF_H = 0x9B7 - SYS___CASINHF_B = 0x9BF - SYS___CASINHF_H = 0x9C0 - SYS___CASINHL_B = 0x9C2 - SYS___CASINHL_H = 0x9C3 - SYS___CASINH_B = 0x9BC - SYS___CASINH_H = 0x9BD - SYS___CASINL_B = 0x9B9 - SYS___CASINL_H = 0x9BA - SYS___CASIN_B = 0x9B3 - SYS___CASIN_H = 0x9B4 - SYS___CATANF_B = 0x9C8 - SYS___CATANF_H = 0x9C9 - SYS___CATANHF_B = 0x9D1 - SYS___CATANHF_H = 0x9D2 - SYS___CATANHL_B = 0x9D4 - SYS___CATANHL_H = 0x9D5 - SYS___CATANH_B = 0x9CE - SYS___CATANH_H = 0x9CF - SYS___CATANL_B = 0x9CB - SYS___CATANL_H = 0x9CC - SYS___CATAN_B = 0x9C5 - SYS___CATAN_H = 0x9C6 - SYS___CCOSF_B = 0x9DA - SYS___CCOSF_H = 0x9DB - SYS___CCOSHF_B = 0x9E3 - SYS___CCOSHF_H = 0x9E4 - SYS___CCOSHL_B = 0x9E6 - SYS___CCOSHL_H = 0x9E7 - SYS___CCOSH_B = 0x9E0 - SYS___CCOSH_H = 0x9E1 - SYS___CCOSL_B = 0x9DD - SYS___CCOSL_H = 0x9DE - SYS___CCOS_B = 0x9D7 - SYS___CCOS_H = 0x9D8 - SYS___CEXPF_B = 0x9EC - SYS___CEXPF_H = 0x9ED - SYS___CEXPL_B = 0x9EF - SYS___CEXPL_H = 0x9F0 - SYS___CEXP_B = 0x9E9 - SYS___CEXP_H = 0x9EA - SYS___CIMAGF_B = 0x9F5 - SYS___CIMAGF_H = 0x9F6 - SYS___CIMAGL_B = 0x9F8 - SYS___CIMAGL_H = 0x9F9 - SYS___CIMAG_B = 0x9F2 - SYS___CIMAG_H = 0x9F3 - SYS___CLOG = 0x9FA - SYS___CLOGF_B = 0x9FE - SYS___CLOGF_H = 0x9FF - SYS___CLOG_B = 0x9FB - SYS___CLOG_H = 0x9FC - SYS_ISWCTYPE = 0x10C - SYS_ISWXDIGI = 0x10A - SYS_ISWXDIGIT = 0x10A - SYS_MBSINIT = 0x10F - SYS_TOWLOWER = 0x10D - SYS_TOWUPPER = 0x10E - SYS_WCTYPE = 0x10B - SYS_WCSSTR = 0x11B - SYS___RPMTCH = 0x11A - SYS_WCSTOD = 0x12E - SYS_WCSTOK = 0x12C - SYS_WCSTOL = 0x12D - SYS_WCSTOUL = 0x12F - SYS_FGETWC = 0x13C - SYS_FGETWS = 0x13D - SYS_FPUTWC = 0x13E - SYS_FPUTWS = 0x13F - SYS_REGERROR = 0x13B - SYS_REGFREE = 0x13A - SYS_COLLEQUIV = 0x14F - SYS_COLLTOSTR = 0x14E - SYS_ISMCCOLLEL = 0x14C - SYS_STRTOCOLL = 0x14D - SYS_DLLFREE = 0x16F - SYS_DLLQUERYFN = 0x16D - SYS_DLLQUERYVAR = 0x16E - SYS_GETMCCOLL = 0x16A - SYS_GETWMCCOLL = 0x16B - SYS___ERR2AD = 0x16C - SYS_CFSETOSPEED = 0x17A - SYS_CHDIR = 0x17B - SYS_CHMOD = 0x17C - SYS_CHOWN = 0x17D - SYS_CLOSE = 0x17E - SYS_CLOSEDIR = 0x17F - SYS_LOG = 0x017 - SYS_COSH = 0x018 - SYS_FCHMOD = 0x18A - SYS_FCHOWN = 0x18B - SYS_FCNTL = 0x18C - SYS_FILENO = 0x18D - SYS_FORK = 0x18E - SYS_FPATHCONF = 0x18F - SYS_GETLOGIN = 0x19A - SYS_GETPGRP = 0x19C - SYS_GETPID = 0x19D - SYS_GETPPID = 0x19E - SYS_GETPWNAM = 0x19F - SYS_TANH = 0x019 - SYS_W_GETMNTENT = 0x19B - SYS_POW = 0x020 - SYS_PTHREAD_SELF = 0x20A - SYS_PTHREAD_SETINTR = 0x20B - SYS_PTHREAD_SETINTRTYPE = 0x20C - SYS_PTHREAD_SETSPECIFIC = 0x20D - SYS_PTHREAD_TESTINTR = 0x20E - SYS_PTHREAD_YIELD = 0x20F - SYS_SQRT = 0x021 - SYS_FLOOR = 0x022 - SYS_J1 = 0x023 - SYS_WCSPBRK = 0x23F - SYS_BSEARCH = 0x24C - SYS_FABS = 0x024 - SYS_GETENV = 0x24A - SYS_LDIV = 0x24D - SYS_SYSTEM = 0x24B - SYS_FMOD = 0x025 - SYS___RETHROW = 0x25F - SYS___THROW = 0x25E - SYS_J0 = 0x026 - SYS_PUTENV = 0x26A - SYS___GETENV = 0x26F - SYS_SEMCTL = 0x27A - SYS_SEMGET = 0x27B - SYS_SEMOP = 0x27C - SYS_SHMAT = 0x27D - SYS_SHMCTL = 0x27E - SYS_SHMDT = 0x27F - SYS_YN = 0x027 - SYS_JN = 0x028 - SYS_SIGALTSTACK = 0x28A - SYS_SIGHOLD = 0x28B - SYS_SIGIGNORE = 0x28C - SYS_SIGINTERRUPT = 0x28D - SYS_SIGPAUSE = 0x28E - SYS_SIGRELSE = 0x28F - SYS_GETOPT = 0x29A - SYS_GETSUBOPT = 0x29D - SYS_LCHOWN = 0x29B - SYS_SETPGRP = 0x29E - SYS_TRUNCATE = 0x29C - SYS_Y0 = 0x029 - SYS___GDERR = 0x29F - SYS_ISALPHA = 0x030 - SYS_VFORK = 0x30F - SYS__LONGJMP = 0x30D - SYS__SETJMP = 0x30E - SYS_GLOB = 0x31A - SYS_GLOBFREE = 0x31B - SYS_ISALNUM = 0x031 - SYS_PUTW = 0x31C - SYS_SEEKDIR = 0x31D - SYS_TELLDIR = 0x31E - SYS_TEMPNAM = 0x31F - SYS_GETTIMEOFDAY_R = 0x32E - SYS_ISLOWER = 0x032 - SYS_LGAMMA = 0x32C - SYS_REMAINDER = 0x32A - SYS_SCALB = 0x32B - SYS_SYNC = 0x32F - SYS_TTYSLOT = 0x32D - SYS_ENDPROTOENT = 0x33A - SYS_ENDSERVENT = 0x33B - SYS_GETHOSTBYADDR = 0x33D - SYS_GETHOSTBYADDR_R = 0x33C - SYS_GETHOSTBYNAME = 0x33F - SYS_GETHOSTBYNAME_R = 0x33E - SYS_ISCNTRL = 0x033 - SYS_GETSERVBYNAME = 0x34A - SYS_GETSERVBYPORT = 0x34B - SYS_GETSERVENT = 0x34C - SYS_GETSOCKNAME = 0x34D - SYS_GETSOCKOPT = 0x34E - SYS_INET_ADDR = 0x34F - SYS_ISDIGIT = 0x034 - SYS_ISGRAPH = 0x035 - SYS_SELECT = 0x35B - SYS_SELECTEX = 0x35C - SYS_SEND = 0x35D - SYS_SENDTO = 0x35F - SYS_CHROOT = 0x36A - SYS_ISNAN = 0x36D - SYS_ISUPPER = 0x036 - SYS_ULIMIT = 0x36C - SYS_UTIMES = 0x36E - SYS_W_STATVFS = 0x36B - SYS___H_ERRNO = 0x36F - SYS_GRANTPT = 0x37A - SYS_ISPRINT = 0x037 - SYS_TCGETSID = 0x37C - SYS_UNLOCKPT = 0x37B - SYS___TCGETCP = 0x37D - SYS___TCSETCP = 0x37E - SYS___TCSETTABLES = 0x37F - SYS_ISPUNCT = 0x038 - SYS_NLIST = 0x38C - SYS___IPDBCS = 0x38D - SYS___IPDSPX = 0x38E - SYS___IPMSGC = 0x38F - SYS___STHOSTENT = 0x38B - SYS___STSERVENT = 0x38A - SYS_ISSPACE = 0x039 - SYS_COS = 0x040 - SYS_T_ALLOC = 0x40A - SYS_T_BIND = 0x40B - SYS_T_CLOSE = 0x40C - SYS_T_CONNECT = 0x40D - SYS_T_ERROR = 0x40E - SYS_T_FREE = 0x40F - SYS_TAN = 0x041 - SYS_T_RCVREL = 0x41A - SYS_T_RCVUDATA = 0x41B - SYS_T_RCVUDERR = 0x41C - SYS_T_SND = 0x41D - SYS_T_SNDDIS = 0x41E - SYS_T_SNDREL = 0x41F - SYS_GETPMSG = 0x42A - SYS_ISASTREAM = 0x42B - SYS_PUTMSG = 0x42C - SYS_PUTPMSG = 0x42D - SYS_SINH = 0x042 - SYS___ISPOSIXON = 0x42E - SYS___OPENMVSREL = 0x42F - SYS_ACOS = 0x043 - SYS_ATAN = 0x044 - SYS_ATAN2 = 0x045 - SYS_FTELL = 0x046 - SYS_FGETPOS = 0x047 - SYS_SOCK_DEBUG = 0x47A - SYS_SOCK_DO_TESTSTOR = 0x47D - SYS_TAKESOCKET = 0x47E - SYS___SERVER_INIT = 0x47F - SYS_FSEEK = 0x048 - SYS___IPHOST = 0x48B - SYS___IPNODE = 0x48C - SYS___SERVER_CLASSIFY_CREATE = 0x48D - SYS___SERVER_CLASSIFY_DESTROY = 0x48E - SYS___SERVER_CLASSIFY_RESET = 0x48F - SYS___SMF_RECORD = 0x48A - SYS_FSETPOS = 0x049 - SYS___FNWSA = 0x49B - SYS___SPAWN2 = 0x49D - SYS___SPAWNP2 = 0x49E - SYS_ATOF = 0x050 - SYS_PTHREAD_MUTEXATTR_GETPSHARED = 0x50A - SYS_PTHREAD_MUTEXATTR_SETPSHARED = 0x50B - SYS_PTHREAD_RWLOCK_DESTROY = 0x50C - SYS_PTHREAD_RWLOCK_INIT = 0x50D - SYS_PTHREAD_RWLOCK_RDLOCK = 0x50E - SYS_PTHREAD_RWLOCK_TRYRDLOCK = 0x50F - SYS_ATOI = 0x051 - SYS___FP_CLASS = 0x51D - SYS___FP_CLR_FLAG = 0x51A - SYS___FP_FINITE = 0x51E - SYS___FP_ISNAN = 0x51F - SYS___FP_RAISE_XCP = 0x51C - SYS___FP_READ_FLAG = 0x51B - SYS_RAND = 0x052 - SYS_SIGTIMEDWAIT = 0x52D - SYS_SIGWAITINFO = 0x52E - SYS___CHKBFP = 0x52F - SYS___FPC_RS = 0x52C - SYS___FPC_RW = 0x52A - SYS___FPC_SM = 0x52B - SYS_STRTOD = 0x053 - SYS_STRTOL = 0x054 - SYS_STRTOUL = 0x055 - SYS_MALLOC = 0x056 - SYS_SRAND = 0x057 - SYS_CALLOC = 0x058 - SYS_FREE = 0x059 - SYS___OSENV = 0x59F - SYS___W_PIOCTL = 0x59E - SYS_LONGJMP = 0x060 - SYS___FLOORF_B = 0x60A - SYS___FLOORL_B = 0x60B - SYS___FREXPF_B = 0x60C - SYS___FREXPL_B = 0x60D - SYS___LDEXPF_B = 0x60E - SYS___LDEXPL_B = 0x60F - SYS_SIGNAL = 0x061 - SYS___ATAN2F_B = 0x61A - SYS___ATAN2L_B = 0x61B - SYS___COSHF_B = 0x61C - SYS___COSHL_B = 0x61D - SYS___EXPF_B = 0x61E - SYS___EXPL_B = 0x61F - SYS_TMPNAM = 0x062 - SYS___ABSF_B = 0x62A - SYS___ABSL_B = 0x62C - SYS___ABS_B = 0x62B - SYS___FMODF_B = 0x62D - SYS___FMODL_B = 0x62E - SYS___MODFF_B = 0x62F - SYS_ATANL = 0x63A - SYS_CEILF = 0x63B - SYS_CEILL = 0x63C - SYS_COSF = 0x63D - SYS_COSHF = 0x63F - SYS_COSL = 0x63E - SYS_REMOVE = 0x063 - SYS_POWL = 0x64A - SYS_RENAME = 0x064 - SYS_SINF = 0x64B - SYS_SINHF = 0x64F - SYS_SINL = 0x64C - SYS_SQRTF = 0x64D - SYS_SQRTL = 0x64E - SYS_BTOWC = 0x65F - SYS_FREXPL = 0x65A - SYS_LDEXPF = 0x65B - SYS_LDEXPL = 0x65C - SYS_MODFF = 0x65D - SYS_MODFL = 0x65E - SYS_TMPFILE = 0x065 - SYS_FREOPEN = 0x066 - SYS___CHARMAP_INIT_A = 0x66E - SYS___GETHOSTBYADDR_R_A = 0x66C - SYS___GETHOSTBYNAME_A = 0x66A - SYS___GETHOSTBYNAME_R_A = 0x66D - SYS___MBLEN_A = 0x66F - SYS___RES_INIT_A = 0x66B - SYS_FCLOSE = 0x067 - SYS___GETGRGID_R_A = 0x67D - SYS___WCSTOMBS_A = 0x67A - SYS___WCSTOMBS_STD_A = 0x67B - SYS___WCSWIDTH_A = 0x67C - SYS___WCSWIDTH_ASIA = 0x67F - SYS___WCSWIDTH_STD_A = 0x67E - SYS_FFLUSH = 0x068 - SYS___GETLOGIN_R_A = 0x68E - SYS___GETPWNAM_R_A = 0x68C - SYS___GETPWUID_R_A = 0x68D - SYS___TTYNAME_R_A = 0x68F - SYS___WCWIDTH_ASIA = 0x68B - SYS___WCWIDTH_STD_A = 0x68A - SYS_FOPEN = 0x069 - SYS___REGEXEC_A = 0x69A - SYS___REGEXEC_STD_A = 0x69B - SYS___REGFREE_A = 0x69C - SYS___REGFREE_STD_A = 0x69D - SYS___STRCOLL_A = 0x69E - SYS___STRCOLL_C_A = 0x69F - SYS_SCANF = 0x070 - SYS___A64L_A = 0x70C - SYS___ECVT_A = 0x70D - SYS___FCVT_A = 0x70E - SYS___GCVT_A = 0x70F - SYS___STRTOUL_A = 0x70A - SYS_____AE_CORRESTBL_QUERY_A = 0x70B - SYS_SPRINTF = 0x071 - SYS___ACCESS_A = 0x71F - SYS___CATOPEN_A = 0x71E - SYS___GETOPT_A = 0x71D - SYS___REALPATH_A = 0x71A - SYS___SETENV_A = 0x71B - SYS___SYSTEM_A = 0x71C - SYS_FGETC = 0x072 - SYS___GAI_STRERROR_A = 0x72F - SYS___RMDIR_A = 0x72A - SYS___STATVFS_A = 0x72B - SYS___SYMLINK_A = 0x72C - SYS___TRUNCATE_A = 0x72D - SYS___UNLINK_A = 0x72E - SYS_VFPRINTF = 0x073 - SYS___ISSPACE_A = 0x73A - SYS___ISUPPER_A = 0x73B - SYS___ISWALNUM_A = 0x73F - SYS___ISXDIGIT_A = 0x73C - SYS___TOLOWER_A = 0x73D - SYS___TOUPPER_A = 0x73E - SYS_VPRINTF = 0x074 - SYS___CONFSTR_A = 0x74B - SYS___FDOPEN_A = 0x74E - SYS___FLDATA_A = 0x74F - SYS___FTOK_A = 0x74C - SYS___ISWXDIGIT_A = 0x74A - SYS___MKTEMP_A = 0x74D - SYS_VSPRINTF = 0x075 - SYS___GETGRGID_A = 0x75A - SYS___GETGRNAM_A = 0x75B - SYS___GETGROUPSBYNAME_A = 0x75C - SYS___GETHOSTENT_A = 0x75D - SYS___GETHOSTNAME_A = 0x75E - SYS___GETLOGIN_A = 0x75F - SYS_GETC = 0x076 - SYS___CREATEWORKUNIT_A = 0x76A - SYS___CTERMID_A = 0x76B - SYS___FMTMSG_A = 0x76C - SYS___INITGROUPS_A = 0x76D - SYS___MSGRCV_A = 0x76F - SYS_____LOGIN_A = 0x76E - SYS_FGETS = 0x077 - SYS___STRCASECMP_A = 0x77B - SYS___STRNCASECMP_A = 0x77C - SYS___TTYNAME_A = 0x77D - SYS___UNAME_A = 0x77E - SYS___UTIMES_A = 0x77F - SYS_____SERVER_PWU_A = 0x77A - SYS_FPUTC = 0x078 - SYS___CREAT_O_A = 0x78E - SYS___ENVNA = 0x78F - SYS___FREAD_A = 0x78A - SYS___FWRITE_A = 0x78B - SYS___ISASCII = 0x78D - SYS___OPEN_O_A = 0x78C - SYS_FPUTS = 0x079 - SYS___ASCTIME_A = 0x79C - SYS___CTIME_A = 0x79D - SYS___GETDATE_A = 0x79E - SYS___GETSERVBYPORT_A = 0x79A - SYS___GETSERVENT_A = 0x79B - SYS___TZSET_A = 0x79F - SYS_ACL_FROM_TEXT = 0x80C - SYS_ACL_SET_FD = 0x80A - SYS_ACL_SET_FILE = 0x80B - SYS_ACL_SORT = 0x80E - SYS_ACL_TO_TEXT = 0x80D - SYS_UNGETC = 0x080 - SYS___SHUTDOWN_REGISTRATION = 0x80F - SYS_FREAD = 0x081 - SYS_FREEADDRINFO = 0x81A - SYS_GAI_STRERROR = 0x81B - SYS_REXEC_AF = 0x81C - SYS___DYNALLOC_A = 0x81F - SYS___POE = 0x81D - SYS_WCSTOMBS = 0x082 - SYS___INET_ADDR_A = 0x82F - SYS___NLIST_A = 0x82A - SYS_____TCGETCP_A = 0x82B - SYS_____TCSETCP_A = 0x82C - SYS_____W_PIOCTL_A = 0x82E - SYS_MBTOWC = 0x083 - SYS___CABEND = 0x83D - SYS___LE_CIB_GET = 0x83E - SYS___RECVMSG_A = 0x83B - SYS___SENDMSG_A = 0x83A - SYS___SET_LAA_FOR_JIT = 0x83F - SYS_____LCHATTR_A = 0x83C - SYS_WCTOMB = 0x084 - SYS___CBRTL_B = 0x84A - SYS___COPYSIGNF_B = 0x84B - SYS___COPYSIGNL_B = 0x84C - SYS___COTANF_B = 0x84D - SYS___COTANL_B = 0x84F - SYS___COTAN_B = 0x84E - SYS_MBSTOWCS = 0x085 - SYS___LOG1PL_B = 0x85A - SYS___LOG2F_B = 0x85B - SYS___LOG2L_B = 0x85D - SYS___LOG2_B = 0x85C - SYS___REMAINDERF_B = 0x85E - SYS___REMAINDERL_B = 0x85F - SYS_ACOSHF = 0x86E - SYS_ACOSHL = 0x86F - SYS_WCSCPY = 0x086 - SYS___ERFCF_B = 0x86D - SYS___ERFF_B = 0x86C - SYS___LROUNDF_B = 0x86A - SYS___LROUND_B = 0x86B - SYS_COTANL = 0x87A - SYS_EXP2F = 0x87B - SYS_EXP2L = 0x87C - SYS_EXPM1F = 0x87D - SYS_EXPM1L = 0x87E - SYS_FDIMF = 0x87F - SYS_WCSCAT = 0x087 - SYS___COTANL = 0x87A - SYS_REMAINDERF = 0x88A - SYS_REMAINDERL = 0x88B - SYS_REMAINDF = 0x88A - SYS_REMAINDL = 0x88B - SYS_REMQUO = 0x88D - SYS_REMQUOF = 0x88C - SYS_REMQUOL = 0x88E - SYS_TGAMMAF = 0x88F - SYS_WCSCHR = 0x088 - SYS_ERFCF = 0x89B - SYS_ERFCL = 0x89C - SYS_ERFL = 0x89A - SYS_EXP2 = 0x89E - SYS_WCSCMP = 0x089 - SYS___EXP2_B = 0x89D - SYS___FAR_JUMP = 0x89F - SYS_ABS = 0x090 - SYS___ERFCL_H = 0x90A - SYS___EXPF_H = 0x90C - SYS___EXPL_H = 0x90D - SYS___EXPM1_H = 0x90E - SYS___EXP_H = 0x90B - SYS___FDIM_H = 0x90F - SYS_DIV = 0x091 - SYS___LOG2F_H = 0x91F - SYS___LOG2_H = 0x91E - SYS___LOGB_H = 0x91D - SYS___LOGF_H = 0x91B - SYS___LOGL_H = 0x91C - SYS___LOG_H = 0x91A - SYS_LABS = 0x092 - SYS___POWL_H = 0x92A - SYS___REMAINDER_H = 0x92B - SYS___RINT_H = 0x92C - SYS___SCALB_H = 0x92D - SYS___SINF_H = 0x92F - SYS___SIN_H = 0x92E - SYS_STRNCPY = 0x093 - SYS___TANHF_H = 0x93B - SYS___TANHL_H = 0x93C - SYS___TANH_H = 0x93A - SYS___TGAMMAF_H = 0x93E - SYS___TGAMMA_H = 0x93D - SYS___TRUNC_H = 0x93F - SYS_MEMCPY = 0x094 - SYS_VFWSCANF = 0x94A - SYS_VSWSCANF = 0x94E - SYS_VWSCANF = 0x94C - SYS_INET6_RTH_ADD = 0x95D - SYS_INET6_RTH_INIT = 0x95C - SYS_INET6_RTH_REVERSE = 0x95E - SYS_INET6_RTH_SEGMENTS = 0x95F - SYS_INET6_RTH_SPACE = 0x95B - SYS_MEMMOVE = 0x095 - SYS_WCSTOLD = 0x95A - SYS_STRCPY = 0x096 - SYS_STRCMP = 0x097 - SYS_CABS = 0x98E - SYS_STRCAT = 0x098 - SYS___CABS_B = 0x98F - SYS___POW_II = 0x98A - SYS___POW_II_B = 0x98B - SYS___POW_II_H = 0x98C - SYS_CACOSF = 0x99A - SYS_CACOSL = 0x99D - SYS_STRNCAT = 0x099 - SYS___CACOSF_B = 0x99B - SYS___CACOSF_H = 0x99C - SYS___CACOSL_B = 0x99E - SYS___CACOSL_H = 0x99F - SYS_ISWALPHA = 0x100 - SYS_ISWBLANK = 0x101 - SYS___ISWBLK = 0x101 - SYS_ISWCNTRL = 0x102 - SYS_ISWDIGIT = 0x103 - SYS_ISWGRAPH = 0x104 - SYS_ISWLOWER = 0x105 - SYS_ISWPRINT = 0x106 - SYS_ISWPUNCT = 0x107 - SYS_ISWSPACE = 0x108 - SYS_ISWUPPER = 0x109 - SYS_WCTOB = 0x110 - SYS_MBRLEN = 0x111 - SYS_MBRTOWC = 0x112 - SYS_MBSRTOWC = 0x113 - SYS_MBSRTOWCS = 0x113 - SYS_WCRTOMB = 0x114 - SYS_WCSRTOMB = 0x115 - SYS_WCSRTOMBS = 0x115 - SYS___CSID = 0x116 - SYS___WCSID = 0x117 - SYS_STRPTIME = 0x118 - SYS___STRPTM = 0x118 - SYS_STRFMON = 0x119 - SYS_WCSCOLL = 0x130 - SYS_WCSXFRM = 0x131 - SYS_WCSWIDTH = 0x132 - SYS_WCWIDTH = 0x133 - SYS_WCSFTIME = 0x134 - SYS_SWPRINTF = 0x135 - SYS_VSWPRINT = 0x136 - SYS_VSWPRINTF = 0x136 - SYS_SWSCANF = 0x137 - SYS_REGCOMP = 0x138 - SYS_REGEXEC = 0x139 - SYS_GETWC = 0x140 - SYS_GETWCHAR = 0x141 - SYS_PUTWC = 0x142 - SYS_PUTWCHAR = 0x143 - SYS_UNGETWC = 0x144 - SYS_ICONV_OPEN = 0x145 - SYS_ICONV = 0x146 - SYS_ICONV_CLOSE = 0x147 - SYS_COLLRANGE = 0x150 - SYS_CCLASS = 0x151 - SYS_COLLORDER = 0x152 - SYS___DEMANGLE = 0x154 - SYS_FDOPEN = 0x155 - SYS___ERRNO = 0x156 - SYS___ERRNO2 = 0x157 - SYS___TERROR = 0x158 - SYS_MAXCOLL = 0x169 - SYS_DLLLOAD = 0x170 - SYS__EXIT = 0x174 - SYS_ACCESS = 0x175 - SYS_ALARM = 0x176 - SYS_CFGETISPEED = 0x177 - SYS_CFGETOSPEED = 0x178 - SYS_CFSETISPEED = 0x179 - SYS_CREAT = 0x180 - SYS_CTERMID = 0x181 - SYS_DUP = 0x182 - SYS_DUP2 = 0x183 - SYS_EXECL = 0x184 - SYS_EXECLE = 0x185 - SYS_EXECLP = 0x186 - SYS_EXECV = 0x187 - SYS_EXECVE = 0x188 - SYS_EXECVP = 0x189 - SYS_FSTAT = 0x190 - SYS_FSYNC = 0x191 - SYS_FTRUNCATE = 0x192 - SYS_GETCWD = 0x193 - SYS_GETEGID = 0x194 - SYS_GETEUID = 0x195 - SYS_GETGID = 0x196 - SYS_GETGRGID = 0x197 - SYS_GETGRNAM = 0x198 - SYS_GETGROUPS = 0x199 - SYS_PTHREAD_MUTEXATTR_DESTROY = 0x200 - SYS_PTHREAD_MUTEXATTR_SETKIND_NP = 0x201 - SYS_PTHREAD_MUTEXATTR_GETKIND_NP = 0x202 - SYS_PTHREAD_MUTEX_INIT = 0x203 - SYS_PTHREAD_MUTEX_DESTROY = 0x204 - SYS_PTHREAD_MUTEX_LOCK = 0x205 - SYS_PTHREAD_MUTEX_TRYLOCK = 0x206 - SYS_PTHREAD_MUTEX_UNLOCK = 0x207 - SYS_PTHREAD_ONCE = 0x209 - SYS_TW_OPEN = 0x210 - SYS_TW_FCNTL = 0x211 - SYS_PTHREAD_JOIN_D4_NP = 0x212 - SYS_PTHREAD_CONDATTR_SETKIND_NP = 0x213 - SYS_PTHREAD_CONDATTR_GETKIND_NP = 0x214 - SYS_EXTLINK_NP = 0x215 - SYS___PASSWD = 0x216 - SYS_SETGROUPS = 0x217 - SYS_INITGROUPS = 0x218 - SYS_WCSRCHR = 0x240 - SYS_SVC99 = 0x241 - SYS___SVC99 = 0x241 - SYS_WCSWCS = 0x242 - SYS_LOCALECO = 0x243 - SYS_LOCALECONV = 0x243 - SYS___LIBREL = 0x244 - SYS_RELEASE = 0x245 - SYS___RLSE = 0x245 - SYS_FLOCATE = 0x246 - SYS___FLOCT = 0x246 - SYS_FDELREC = 0x247 - SYS___FDLREC = 0x247 - SYS_FETCH = 0x248 - SYS___FETCH = 0x248 - SYS_QSORT = 0x249 - SYS___CLEANUPCATCH = 0x260 - SYS___CATCHMATCH = 0x261 - SYS___CLEAN2UPCATCH = 0x262 - SYS_GETPRIORITY = 0x270 - SYS_NICE = 0x271 - SYS_SETPRIORITY = 0x272 - SYS_GETITIMER = 0x273 - SYS_SETITIMER = 0x274 - SYS_MSGCTL = 0x275 - SYS_MSGGET = 0x276 - SYS_MSGRCV = 0x277 - SYS_MSGSND = 0x278 - SYS_MSGXRCV = 0x279 - SYS___MSGXR = 0x279 - SYS_SHMGET = 0x280 - SYS___GETIPC = 0x281 - SYS_SETGRENT = 0x282 - SYS_GETGRENT = 0x283 - SYS_ENDGRENT = 0x284 - SYS_SETPWENT = 0x285 - SYS_GETPWENT = 0x286 - SYS_ENDPWENT = 0x287 - SYS_BSD_SIGNAL = 0x288 - SYS_KILLPG = 0x289 - SYS_SIGSET = 0x290 - SYS_SIGSTACK = 0x291 - SYS_GETRLIMIT = 0x292 - SYS_SETRLIMIT = 0x293 - SYS_GETRUSAGE = 0x294 - SYS_MMAP = 0x295 - SYS_MPROTECT = 0x296 - SYS_MSYNC = 0x297 - SYS_MUNMAP = 0x298 - SYS_CONFSTR = 0x299 - SYS___NDMTRM = 0x300 - SYS_FTOK = 0x301 - SYS_BASENAME = 0x302 - SYS_DIRNAME = 0x303 - SYS_GETDTABLESIZE = 0x304 - SYS_MKSTEMP = 0x305 - SYS_MKTEMP = 0x306 - SYS_NFTW = 0x307 - SYS_GETWD = 0x308 - SYS_LOCKF = 0x309 - SYS_WORDEXP = 0x310 - SYS_WORDFREE = 0x311 - SYS_GETPGID = 0x312 - SYS_GETSID = 0x313 - SYS___UTMPXNAME = 0x314 - SYS_CUSERID = 0x315 - SYS_GETPASS = 0x316 - SYS_FNMATCH = 0x317 - SYS_FTW = 0x318 - SYS_GETW = 0x319 - SYS_ACOSH = 0x320 - SYS_ASINH = 0x321 - SYS_ATANH = 0x322 - SYS_CBRT = 0x323 - SYS_EXPM1 = 0x324 - SYS_ILOGB = 0x325 - SYS_LOGB = 0x326 - SYS_LOG1P = 0x327 - SYS_NEXTAFTER = 0x328 - SYS_RINT = 0x329 - SYS_SPAWN = 0x330 - SYS_SPAWNP = 0x331 - SYS_GETLOGIN_UU = 0x332 - SYS_ECVT = 0x333 - SYS_FCVT = 0x334 - SYS_GCVT = 0x335 - SYS_ACCEPT = 0x336 - SYS_BIND = 0x337 - SYS_CONNECT = 0x338 - SYS_ENDHOSTENT = 0x339 - SYS_GETHOSTENT = 0x340 - SYS_GETHOSTID = 0x341 - SYS_GETHOSTNAME = 0x342 - SYS_GETNETBYADDR = 0x343 - SYS_GETNETBYNAME = 0x344 - SYS_GETNETENT = 0x345 - SYS_GETPEERNAME = 0x346 - SYS_GETPROTOBYNAME = 0x347 - SYS_GETPROTOBYNUMBER = 0x348 - SYS_GETPROTOENT = 0x349 - SYS_INET_LNAOF = 0x350 - SYS_INET_MAKEADDR = 0x351 - SYS_INET_NETOF = 0x352 - SYS_INET_NETWORK = 0x353 - SYS_INET_NTOA = 0x354 - SYS_IOCTL = 0x355 - SYS_LISTEN = 0x356 - SYS_READV = 0x357 - SYS_RECV = 0x358 - SYS_RECVFROM = 0x359 - SYS_SETHOSTENT = 0x360 - SYS_SETNETENT = 0x361 - SYS_SETPEER = 0x362 - SYS_SETPROTOENT = 0x363 - SYS_SETSERVENT = 0x364 - SYS_SETSOCKOPT = 0x365 - SYS_SHUTDOWN = 0x366 - SYS_SOCKET = 0x367 - SYS_SOCKETPAIR = 0x368 - SYS_WRITEV = 0x369 - SYS_ENDNETENT = 0x370 - SYS_CLOSELOG = 0x371 - SYS_OPENLOG = 0x372 - SYS_SETLOGMASK = 0x373 - SYS_SYSLOG = 0x374 - SYS_PTSNAME = 0x375 - SYS_SETREUID = 0x376 - SYS_SETREGID = 0x377 - SYS_REALPATH = 0x378 - SYS___SIGNGAM = 0x379 - SYS_POLL = 0x380 - SYS_REXEC = 0x381 - SYS___ISASCII2 = 0x382 - SYS___TOASCII2 = 0x383 - SYS_CHPRIORITY = 0x384 - SYS_PTHREAD_ATTR_SETSYNCTYPE_NP = 0x385 - SYS_PTHREAD_ATTR_GETSYNCTYPE_NP = 0x386 - SYS_PTHREAD_SET_LIMIT_NP = 0x387 - SYS___STNETENT = 0x388 - SYS___STPROTOENT = 0x389 - SYS___SELECT1 = 0x390 - SYS_PTHREAD_SECURITY_NP = 0x391 - SYS___CHECK_RESOURCE_AUTH_NP = 0x392 - SYS___CONVERT_ID_NP = 0x393 - SYS___OPENVMREL = 0x394 - SYS_WMEMCHR = 0x395 - SYS_WMEMCMP = 0x396 - SYS_WMEMCPY = 0x397 - SYS_WMEMMOVE = 0x398 - SYS_WMEMSET = 0x399 - SYS___FPUTWC = 0x400 - SYS___PUTWC = 0x401 - SYS___PWCHAR = 0x402 - SYS___WCSFTM = 0x403 - SYS___WCSTOK = 0x404 - SYS___WCWDTH = 0x405 - SYS_T_ACCEPT = 0x409 - SYS_T_GETINFO = 0x410 - SYS_T_GETPROTADDR = 0x411 - SYS_T_GETSTATE = 0x412 - SYS_T_LISTEN = 0x413 - SYS_T_LOOK = 0x414 - SYS_T_OPEN = 0x415 - SYS_T_OPTMGMT = 0x416 - SYS_T_RCV = 0x417 - SYS_T_RCVCONNECT = 0x418 - SYS_T_RCVDIS = 0x419 - SYS_T_SNDUDATA = 0x420 - SYS_T_STRERROR = 0x421 - SYS_T_SYNC = 0x422 - SYS_T_UNBIND = 0x423 - SYS___T_ERRNO = 0x424 - SYS___RECVMSG2 = 0x425 - SYS___SENDMSG2 = 0x426 - SYS_FATTACH = 0x427 - SYS_FDETACH = 0x428 - SYS_GETMSG = 0x429 - SYS_GETCONTEXT = 0x430 - SYS_SETCONTEXT = 0x431 - SYS_MAKECONTEXT = 0x432 - SYS_SWAPCONTEXT = 0x433 - SYS_PTHREAD_GETSPECIFIC_D8_NP = 0x434 - SYS_GETCLIENTID = 0x470 - SYS___GETCLIENTID = 0x471 - SYS_GETSTABLESIZE = 0x472 - SYS_GETIBMOPT = 0x473 - SYS_GETIBMSOCKOPT = 0x474 - SYS_GIVESOCKET = 0x475 - SYS_IBMSFLUSH = 0x476 - SYS_MAXDESC = 0x477 - SYS_SETIBMOPT = 0x478 - SYS_SETIBMSOCKOPT = 0x479 - SYS___SERVER_PWU = 0x480 - SYS_PTHREAD_TAG_NP = 0x481 - SYS___CONSOLE = 0x482 - SYS___WSINIT = 0x483 - SYS___IPTCPN = 0x489 - SYS___SERVER_CLASSIFY = 0x490 - SYS___HEAPRPT = 0x496 - SYS___ISBFP = 0x500 - SYS___FP_CAST = 0x501 - SYS___CERTIFICATE = 0x502 - SYS_SEND_FILE = 0x503 - SYS_AIO_CANCEL = 0x504 - SYS_AIO_ERROR = 0x505 - SYS_AIO_READ = 0x506 - SYS_AIO_RETURN = 0x507 - SYS_AIO_SUSPEND = 0x508 - SYS_AIO_WRITE = 0x509 - SYS_PTHREAD_RWLOCK_TRYWRLOCK = 0x510 - SYS_PTHREAD_RWLOCK_UNLOCK = 0x511 - SYS_PTHREAD_RWLOCK_WRLOCK = 0x512 - SYS_PTHREAD_RWLOCKATTR_GETPSHARED = 0x513 - SYS_PTHREAD_RWLOCKATTR_SETPSHARED = 0x514 - SYS_PTHREAD_RWLOCKATTR_INIT = 0x515 - SYS_PTHREAD_RWLOCKATTR_DESTROY = 0x516 - SYS___CTTBL = 0x517 - SYS_PTHREAD_MUTEXATTR_SETTYPE = 0x518 - SYS_PTHREAD_MUTEXATTR_GETTYPE = 0x519 - SYS___FP_UNORDERED = 0x520 - SYS___FP_READ_RND = 0x521 - SYS___FP_READ_RND_B = 0x522 - SYS___FP_SWAP_RND = 0x523 - SYS___FP_SWAP_RND_B = 0x524 - SYS___FP_LEVEL = 0x525 - SYS___FP_BTOH = 0x526 - SYS___FP_HTOB = 0x527 - SYS___FPC_RD = 0x528 - SYS___FPC_WR = 0x529 - SYS_PTHREAD_SETCANCELTYPE = 0x600 - SYS_PTHREAD_TESTCANCEL = 0x601 - SYS___ATANF_B = 0x602 - SYS___ATANL_B = 0x603 - SYS___CEILF_B = 0x604 - SYS___CEILL_B = 0x605 - SYS___COSF_B = 0x606 - SYS___COSL_B = 0x607 - SYS___FABSF_B = 0x608 - SYS___FABSL_B = 0x609 - SYS___SINF_B = 0x610 - SYS___SINL_B = 0x611 - SYS___TANF_B = 0x612 - SYS___TANL_B = 0x613 - SYS___TANHF_B = 0x614 - SYS___TANHL_B = 0x615 - SYS___ACOSF_B = 0x616 - SYS___ACOSL_B = 0x617 - SYS___ASINF_B = 0x618 - SYS___ASINL_B = 0x619 - SYS___LOGF_B = 0x620 - SYS___LOGL_B = 0x621 - SYS___LOG10F_B = 0x622 - SYS___LOG10L_B = 0x623 - SYS___POWF_B = 0x624 - SYS___POWL_B = 0x625 - SYS___SINHF_B = 0x626 - SYS___SINHL_B = 0x627 - SYS___SQRTF_B = 0x628 - SYS___SQRTL_B = 0x629 - SYS___MODFL_B = 0x630 - SYS_ABSF = 0x631 - SYS_ABSL = 0x632 - SYS_ACOSF = 0x633 - SYS_ACOSL = 0x634 - SYS_ASINF = 0x635 - SYS_ASINL = 0x636 - SYS_ATAN2F = 0x637 - SYS_ATAN2L = 0x638 - SYS_ATANF = 0x639 - SYS_COSHL = 0x640 - SYS_EXPF = 0x641 - SYS_EXPL = 0x642 - SYS_TANHF = 0x643 - SYS_TANHL = 0x644 - SYS_LOG10F = 0x645 - SYS_LOG10L = 0x646 - SYS_LOGF = 0x647 - SYS_LOGL = 0x648 - SYS_POWF = 0x649 - SYS_SINHL = 0x650 - SYS_TANF = 0x651 - SYS_TANL = 0x652 - SYS_FABSF = 0x653 - SYS_FABSL = 0x654 - SYS_FLOORF = 0x655 - SYS_FLOORL = 0x656 - SYS_FMODF = 0x657 - SYS_FMODL = 0x658 - SYS_FREXPF = 0x659 - SYS___CHATTR = 0x660 - SYS___FCHATTR = 0x661 - SYS___TOCCSID = 0x662 - SYS___CSNAMETYPE = 0x663 - SYS___TOCSNAME = 0x664 - SYS___CCSIDTYPE = 0x665 - SYS___AE_CORRESTBL_QUERY = 0x666 - SYS___AE_AUTOCONVERT_STATE = 0x667 - SYS_DN_FIND = 0x668 - SYS___GETHOSTBYADDR_A = 0x669 - SYS___MBLEN_SB_A = 0x670 - SYS___MBLEN_STD_A = 0x671 - SYS___MBLEN_UTF = 0x672 - SYS___MBSTOWCS_A = 0x673 - SYS___MBSTOWCS_STD_A = 0x674 - SYS___MBTOWC_A = 0x675 - SYS___MBTOWC_ISO1 = 0x676 - SYS___MBTOWC_SBCS = 0x677 - SYS___MBTOWC_MBCS = 0x678 - SYS___MBTOWC_UTF = 0x679 - SYS___CSID_A = 0x680 - SYS___CSID_STD_A = 0x681 - SYS___WCSID_A = 0x682 - SYS___WCSID_STD_A = 0x683 - SYS___WCTOMB_A = 0x684 - SYS___WCTOMB_ISO1 = 0x685 - SYS___WCTOMB_STD_A = 0x686 - SYS___WCTOMB_UTF = 0x687 - SYS___WCWIDTH_A = 0x688 - SYS___GETGRNAM_R_A = 0x689 - SYS___READDIR_R_A = 0x690 - SYS___E2A_S = 0x691 - SYS___FNMATCH_A = 0x692 - SYS___FNMATCH_C_A = 0x693 - SYS___EXECL_A = 0x694 - SYS___FNMATCH_STD_A = 0x695 - SYS___REGCOMP_A = 0x696 - SYS___REGCOMP_STD_A = 0x697 - SYS___REGERROR_A = 0x698 - SYS___REGERROR_STD_A = 0x699 - SYS___SWPRINTF_A = 0x700 - SYS___FSCANF_A = 0x701 - SYS___SCANF_A = 0x702 - SYS___SSCANF_A = 0x703 - SYS___SWSCANF_A = 0x704 - SYS___ATOF_A = 0x705 - SYS___ATOI_A = 0x706 - SYS___ATOL_A = 0x707 - SYS___STRTOD_A = 0x708 - SYS___STRTOL_A = 0x709 - SYS___L64A_A = 0x710 - SYS___STRERROR_A = 0x711 - SYS___PERROR_A = 0x712 - SYS___FETCH_A = 0x713 - SYS___GETENV_A = 0x714 - SYS___MKSTEMP_A = 0x717 - SYS___PTSNAME_A = 0x718 - SYS___PUTENV_A = 0x719 - SYS___CHDIR_A = 0x720 - SYS___CHOWN_A = 0x721 - SYS___CHROOT_A = 0x722 - SYS___GETCWD_A = 0x723 - SYS___GETWD_A = 0x724 - SYS___LCHOWN_A = 0x725 - SYS___LINK_A = 0x726 - SYS___PATHCONF_A = 0x727 - SYS___IF_NAMEINDEX_A = 0x728 - SYS___READLINK_A = 0x729 - SYS___EXTLINK_NP_A = 0x730 - SYS___ISALNUM_A = 0x731 - SYS___ISALPHA_A = 0x732 - SYS___A2E_S = 0x733 - SYS___ISCNTRL_A = 0x734 - SYS___ISDIGIT_A = 0x735 - SYS___ISGRAPH_A = 0x736 - SYS___ISLOWER_A = 0x737 - SYS___ISPRINT_A = 0x738 - SYS___ISPUNCT_A = 0x739 - SYS___ISWALPHA_A = 0x740 - SYS___A2E_L = 0x741 - SYS___ISWCNTRL_A = 0x742 - SYS___ISWDIGIT_A = 0x743 - SYS___ISWGRAPH_A = 0x744 - SYS___ISWLOWER_A = 0x745 - SYS___ISWPRINT_A = 0x746 - SYS___ISWPUNCT_A = 0x747 - SYS___ISWSPACE_A = 0x748 - SYS___ISWUPPER_A = 0x749 - SYS___REMOVE_A = 0x750 - SYS___RENAME_A = 0x751 - SYS___TMPNAM_A = 0x752 - SYS___FOPEN_A = 0x753 - SYS___FREOPEN_A = 0x754 - SYS___CUSERID_A = 0x755 - SYS___POPEN_A = 0x756 - SYS___TEMPNAM_A = 0x757 - SYS___FTW_A = 0x758 - SYS___GETGRENT_A = 0x759 - SYS___INET_NTOP_A = 0x760 - SYS___GETPASS_A = 0x761 - SYS___GETPWENT_A = 0x762 - SYS___GETPWNAM_A = 0x763 - SYS___GETPWUID_A = 0x764 - SYS_____CHECK_RESOURCE_AUTH_NP_A = 0x765 - SYS___CHECKSCHENV_A = 0x766 - SYS___CONNECTSERVER_A = 0x767 - SYS___CONNECTWORKMGR_A = 0x768 - SYS_____CONSOLE_A = 0x769 - SYS___MSGSND_A = 0x770 - SYS___MSGXRCV_A = 0x771 - SYS___NFTW_A = 0x772 - SYS_____PASSWD_A = 0x773 - SYS___PTHREAD_SECURITY_NP_A = 0x774 - SYS___QUERYMETRICS_A = 0x775 - SYS___QUERYSCHENV = 0x776 - SYS___READV_A = 0x777 - SYS_____SERVER_CLASSIFY_A = 0x778 - SYS_____SERVER_INIT_A = 0x779 - SYS___W_GETPSENT_A = 0x780 - SYS___WRITEV_A = 0x781 - SYS___W_STATFS_A = 0x782 - SYS___W_STATVFS_A = 0x783 - SYS___FPUTC_A = 0x784 - SYS___PUTCHAR_A = 0x785 - SYS___PUTS_A = 0x786 - SYS___FGETS_A = 0x787 - SYS___GETS_A = 0x788 - SYS___FPUTS_A = 0x789 - SYS___PUTC_A = 0x790 - SYS___AE_THREAD_SETMODE = 0x791 - SYS___AE_THREAD_SWAPMODE = 0x792 - SYS___GETNETBYADDR_A = 0x793 - SYS___GETNETBYNAME_A = 0x794 - SYS___GETNETENT_A = 0x795 - SYS___GETPROTOBYNAME_A = 0x796 - SYS___GETPROTOBYNUMBER_A = 0x797 - SYS___GETPROTOENT_A = 0x798 - SYS___GETSERVBYNAME_A = 0x799 - SYS_ACL_FIRST_ENTRY = 0x800 - SYS_ACL_GET_ENTRY = 0x801 - SYS_ACL_VALID = 0x802 - SYS_ACL_CREATE_ENTRY = 0x803 - SYS_ACL_DELETE_ENTRY = 0x804 - SYS_ACL_UPDATE_ENTRY = 0x805 - SYS_ACL_DELETE_FD = 0x806 - SYS_ACL_DELETE_FILE = 0x807 - SYS_ACL_GET_FD = 0x808 - SYS_ACL_GET_FILE = 0x809 - SYS___ERFL_B = 0x810 - SYS___ERFCL_B = 0x811 - SYS___LGAMMAL_B = 0x812 - SYS___SETHOOKEVENTS = 0x813 - SYS_IF_NAMETOINDEX = 0x814 - SYS_IF_INDEXTONAME = 0x815 - SYS_IF_NAMEINDEX = 0x816 - SYS_IF_FREENAMEINDEX = 0x817 - SYS_GETADDRINFO = 0x818 - SYS_GETNAMEINFO = 0x819 - SYS___DYNFREE_A = 0x820 - SYS___RES_QUERY_A = 0x821 - SYS___RES_SEARCH_A = 0x822 - SYS___RES_QUERYDOMAIN_A = 0x823 - SYS___RES_MKQUERY_A = 0x824 - SYS___RES_SEND_A = 0x825 - SYS___DN_EXPAND_A = 0x826 - SYS___DN_SKIPNAME_A = 0x827 - SYS___DN_COMP_A = 0x828 - SYS___DN_FIND_A = 0x829 - SYS___INET_NTOA_A = 0x830 - SYS___INET_NETWORK_A = 0x831 - SYS___ACCEPT_A = 0x832 - SYS___ACCEPT_AND_RECV_A = 0x833 - SYS___BIND_A = 0x834 - SYS___CONNECT_A = 0x835 - SYS___GETPEERNAME_A = 0x836 - SYS___GETSOCKNAME_A = 0x837 - SYS___RECVFROM_A = 0x838 - SYS___SENDTO_A = 0x839 - SYS___LCHATTR = 0x840 - SYS___WRITEDOWN = 0x841 - SYS_PTHREAD_MUTEX_INIT2 = 0x842 - SYS___ACOSHF_B = 0x843 - SYS___ACOSHL_B = 0x844 - SYS___ASINHF_B = 0x845 - SYS___ASINHL_B = 0x846 - SYS___ATANHF_B = 0x847 - SYS___ATANHL_B = 0x848 - SYS___CBRTF_B = 0x849 - SYS___EXP2F_B = 0x850 - SYS___EXP2L_B = 0x851 - SYS___EXPM1F_B = 0x852 - SYS___EXPM1L_B = 0x853 - SYS___FDIMF_B = 0x854 - SYS___FDIM_B = 0x855 - SYS___FDIML_B = 0x856 - SYS___HYPOTF_B = 0x857 - SYS___HYPOTL_B = 0x858 - SYS___LOG1PF_B = 0x859 - SYS___REMQUOF_B = 0x860 - SYS___REMQUO_B = 0x861 - SYS___REMQUOL_B = 0x862 - SYS___TGAMMAF_B = 0x863 - SYS___TGAMMA_B = 0x864 - SYS___TGAMMAL_B = 0x865 - SYS___TRUNCF_B = 0x866 - SYS___TRUNC_B = 0x867 - SYS___TRUNCL_B = 0x868 - SYS___LGAMMAF_B = 0x869 - SYS_ASINHF = 0x870 - SYS_ASINHL = 0x871 - SYS_ATANHF = 0x872 - SYS_ATANHL = 0x873 - SYS_CBRTF = 0x874 - SYS_CBRTL = 0x875 - SYS_COPYSIGNF = 0x876 - SYS_CPYSIGNF = 0x876 - SYS_COPYSIGNL = 0x877 - SYS_CPYSIGNL = 0x877 - SYS_COTANF = 0x878 - SYS___COTANF = 0x878 - SYS_COTAN = 0x879 - SYS___COTAN = 0x879 - SYS_FDIM = 0x881 - SYS_FDIML = 0x882 - SYS_HYPOTF = 0x883 - SYS_HYPOTL = 0x884 - SYS_LOG1PF = 0x885 - SYS_LOG1PL = 0x886 - SYS_LOG2F = 0x887 - SYS_LOG2 = 0x888 - SYS_LOG2L = 0x889 - SYS_TGAMMA = 0x890 - SYS_TGAMMAL = 0x891 - SYS_TRUNCF = 0x892 - SYS_TRUNC = 0x893 - SYS_TRUNCL = 0x894 - SYS_LGAMMAF = 0x895 - SYS_LGAMMAL = 0x896 - SYS_LROUNDF = 0x897 - SYS_LROUND = 0x898 - SYS_ERFF = 0x899 - SYS___COSHF_H = 0x900 - SYS___COSHL_H = 0x901 - SYS___COTAN_H = 0x902 - SYS___COTANF_H = 0x903 - SYS___COTANL_H = 0x904 - SYS___ERF_H = 0x905 - SYS___ERFF_H = 0x906 - SYS___ERFL_H = 0x907 - SYS___ERFC_H = 0x908 - SYS___ERFCF_H = 0x909 - SYS___FDIMF_H = 0x910 - SYS___FDIML_H = 0x911 - SYS___FMOD_H = 0x912 - SYS___FMODF_H = 0x913 - SYS___FMODL_H = 0x914 - SYS___GAMMA_H = 0x915 - SYS___HYPOT_H = 0x916 - SYS___ILOGB_H = 0x917 - SYS___LGAMMA_H = 0x918 - SYS___LGAMMAF_H = 0x919 - SYS___LOG2L_H = 0x920 - SYS___LOG1P_H = 0x921 - SYS___LOG10_H = 0x922 - SYS___LOG10F_H = 0x923 - SYS___LOG10L_H = 0x924 - SYS___LROUND_H = 0x925 - SYS___LROUNDF_H = 0x926 - SYS___NEXTAFTER_H = 0x927 - SYS___POW_H = 0x928 - SYS___POWF_H = 0x929 - SYS___SINL_H = 0x930 - SYS___SINH_H = 0x931 - SYS___SINHF_H = 0x932 - SYS___SINHL_H = 0x933 - SYS___SQRT_H = 0x934 - SYS___SQRTF_H = 0x935 - SYS___SQRTL_H = 0x936 - SYS___TAN_H = 0x937 - SYS___TANF_H = 0x938 - SYS___TANL_H = 0x939 - SYS___TRUNCF_H = 0x940 - SYS___TRUNCL_H = 0x941 - SYS___COSH_H = 0x942 - SYS___LE_DEBUG_SET_RESUME_MCH = 0x943 - SYS_VFSCANF = 0x944 - SYS_VSCANF = 0x946 - SYS_VSSCANF = 0x948 - SYS_IMAXABS = 0x950 - SYS_IMAXDIV = 0x951 - SYS_STRTOIMAX = 0x952 - SYS_STRTOUMAX = 0x953 - SYS_WCSTOIMAX = 0x954 - SYS_WCSTOUMAX = 0x955 - SYS_ATOLL = 0x956 - SYS_STRTOF = 0x957 - SYS_STRTOLD = 0x958 - SYS_WCSTOF = 0x959 - SYS_INET6_RTH_GETADDR = 0x960 - SYS_INET6_OPT_INIT = 0x961 - SYS_INET6_OPT_APPEND = 0x962 - SYS_INET6_OPT_FINISH = 0x963 - SYS_INET6_OPT_SET_VAL = 0x964 - SYS_INET6_OPT_NEXT = 0x965 - SYS_INET6_OPT_FIND = 0x966 - SYS_INET6_OPT_GET_VAL = 0x967 - SYS___POW_I = 0x987 - SYS___POW_I_B = 0x988 - SYS___POW_I_H = 0x989 - SYS___CABS_H = 0x990 - SYS_CABSF = 0x991 - SYS___CABSF_B = 0x992 - SYS___CABSF_H = 0x993 - SYS_CABSL = 0x994 - SYS___CABSL_B = 0x995 - SYS___CABSL_H = 0x996 - SYS_CACOS = 0x997 - SYS___CACOS_B = 0x998 - SYS___CACOS_H = 0x999 + SYS_LOG = 0x17 // 23 + SYS_COSH = 0x18 // 24 + SYS_TANH = 0x19 // 25 + SYS_EXP = 0x1A // 26 + SYS_MODF = 0x1B // 27 + SYS_LOG10 = 0x1C // 28 + SYS_FREXP = 0x1D // 29 + SYS_LDEXP = 0x1E // 30 + SYS_CEIL = 0x1F // 31 + SYS_POW = 0x20 // 32 + SYS_SQRT = 0x21 // 33 + SYS_FLOOR = 0x22 // 34 + SYS_J1 = 0x23 // 35 + SYS_FABS = 0x24 // 36 + SYS_FMOD = 0x25 // 37 + SYS_J0 = 0x26 // 38 + SYS_YN = 0x27 // 39 + SYS_JN = 0x28 // 40 + SYS_Y0 = 0x29 // 41 + SYS_Y1 = 0x2A // 42 + SYS_HYPOT = 0x2B // 43 + SYS_ERF = 0x2C // 44 + SYS_ERFC = 0x2D // 45 + SYS_GAMMA = 0x2E // 46 + SYS_ISALPHA = 0x30 // 48 + SYS_ISALNUM = 0x31 // 49 + SYS_ISLOWER = 0x32 // 50 + SYS_ISCNTRL = 0x33 // 51 + SYS_ISDIGIT = 0x34 // 52 + SYS_ISGRAPH = 0x35 // 53 + SYS_ISUPPER = 0x36 // 54 + SYS_ISPRINT = 0x37 // 55 + SYS_ISPUNCT = 0x38 // 56 + SYS_ISSPACE = 0x39 // 57 + SYS_SETLOCAL = 0x3A // 58 + SYS_SETLOCALE = 0x3A // 58 + SYS_ISXDIGIT = 0x3B // 59 + SYS_TOLOWER = 0x3C // 60 + SYS_TOUPPER = 0x3D // 61 + SYS_ASIN = 0x3E // 62 + SYS_SIN = 0x3F // 63 + SYS_COS = 0x40 // 64 + SYS_TAN = 0x41 // 65 + SYS_SINH = 0x42 // 66 + SYS_ACOS = 0x43 // 67 + SYS_ATAN = 0x44 // 68 + SYS_ATAN2 = 0x45 // 69 + SYS_FTELL = 0x46 // 70 + SYS_FGETPOS = 0x47 // 71 + SYS_FSEEK = 0x48 // 72 + SYS_FSETPOS = 0x49 // 73 + SYS_FERROR = 0x4A // 74 + SYS_REWIND = 0x4B // 75 + SYS_CLEARERR = 0x4C // 76 + SYS_FEOF = 0x4D // 77 + SYS_ATOL = 0x4E // 78 + SYS_PERROR = 0x4F // 79 + SYS_ATOF = 0x50 // 80 + SYS_ATOI = 0x51 // 81 + SYS_RAND = 0x52 // 82 + SYS_STRTOD = 0x53 // 83 + SYS_STRTOL = 0x54 // 84 + SYS_STRTOUL = 0x55 // 85 + SYS_MALLOC = 0x56 // 86 + SYS_SRAND = 0x57 // 87 + SYS_CALLOC = 0x58 // 88 + SYS_FREE = 0x59 // 89 + SYS_EXIT = 0x5A // 90 + SYS_REALLOC = 0x5B // 91 + SYS_ABORT = 0x5C // 92 + SYS___ABORT = 0x5C // 92 + SYS_ATEXIT = 0x5D // 93 + SYS_RAISE = 0x5E // 94 + SYS_SETJMP = 0x5F // 95 + SYS_LONGJMP = 0x60 // 96 + SYS_SIGNAL = 0x61 // 97 + SYS_TMPNAM = 0x62 // 98 + SYS_REMOVE = 0x63 // 99 + SYS_RENAME = 0x64 // 100 + SYS_TMPFILE = 0x65 // 101 + SYS_FREOPEN = 0x66 // 102 + SYS_FCLOSE = 0x67 // 103 + SYS_FFLUSH = 0x68 // 104 + SYS_FOPEN = 0x69 // 105 + SYS_FSCANF = 0x6A // 106 + SYS_SETBUF = 0x6B // 107 + SYS_SETVBUF = 0x6C // 108 + SYS_FPRINTF = 0x6D // 109 + SYS_SSCANF = 0x6E // 110 + SYS_PRINTF = 0x6F // 111 + SYS_SCANF = 0x70 // 112 + SYS_SPRINTF = 0x71 // 113 + SYS_FGETC = 0x72 // 114 + SYS_VFPRINTF = 0x73 // 115 + SYS_VPRINTF = 0x74 // 116 + SYS_VSPRINTF = 0x75 // 117 + SYS_GETC = 0x76 // 118 + SYS_FGETS = 0x77 // 119 + SYS_FPUTC = 0x78 // 120 + SYS_FPUTS = 0x79 // 121 + SYS_PUTCHAR = 0x7A // 122 + SYS_GETCHAR = 0x7B // 123 + SYS_GETS = 0x7C // 124 + SYS_PUTC = 0x7D // 125 + SYS_FWRITE = 0x7E // 126 + SYS_PUTS = 0x7F // 127 + SYS_UNGETC = 0x80 // 128 + SYS_FREAD = 0x81 // 129 + SYS_WCSTOMBS = 0x82 // 130 + SYS_MBTOWC = 0x83 // 131 + SYS_WCTOMB = 0x84 // 132 + SYS_MBSTOWCS = 0x85 // 133 + SYS_WCSCPY = 0x86 // 134 + SYS_WCSCAT = 0x87 // 135 + SYS_WCSCHR = 0x88 // 136 + SYS_WCSCMP = 0x89 // 137 + SYS_WCSNCMP = 0x8A // 138 + SYS_WCSCSPN = 0x8B // 139 + SYS_WCSLEN = 0x8C // 140 + SYS_WCSNCAT = 0x8D // 141 + SYS_WCSSPN = 0x8E // 142 + SYS_WCSNCPY = 0x8F // 143 + SYS_ABS = 0x90 // 144 + SYS_DIV = 0x91 // 145 + SYS_LABS = 0x92 // 146 + SYS_STRNCPY = 0x93 // 147 + SYS_MEMCPY = 0x94 // 148 + SYS_MEMMOVE = 0x95 // 149 + SYS_STRCPY = 0x96 // 150 + SYS_STRCMP = 0x97 // 151 + SYS_STRCAT = 0x98 // 152 + SYS_STRNCAT = 0x99 // 153 + SYS_MEMCMP = 0x9A // 154 + SYS_MEMCHR = 0x9B // 155 + SYS_STRCOLL = 0x9C // 156 + SYS_STRNCMP = 0x9D // 157 + SYS_STRXFRM = 0x9E // 158 + SYS_STRRCHR = 0x9F // 159 + SYS_STRCHR = 0xA0 // 160 + SYS_STRCSPN = 0xA1 // 161 + SYS_STRPBRK = 0xA2 // 162 + SYS_MEMSET = 0xA3 // 163 + SYS_STRSPN = 0xA4 // 164 + SYS_STRSTR = 0xA5 // 165 + SYS_STRTOK = 0xA6 // 166 + SYS_DIFFTIME = 0xA7 // 167 + SYS_STRERROR = 0xA8 // 168 + SYS_STRLEN = 0xA9 // 169 + SYS_CLOCK = 0xAA // 170 + SYS_CTIME = 0xAB // 171 + SYS_MKTIME = 0xAC // 172 + SYS_TIME = 0xAD // 173 + SYS_ASCTIME = 0xAE // 174 + SYS_MBLEN = 0xAF // 175 + SYS_GMTIME = 0xB0 // 176 + SYS_LOCALTIM = 0xB1 // 177 + SYS_LOCALTIME = 0xB1 // 177 + SYS_STRFTIME = 0xB2 // 178 + SYS___GETCB = 0xB4 // 180 + SYS_FUPDATE = 0xB5 // 181 + SYS___FUPDT = 0xB5 // 181 + SYS_CLRMEMF = 0xBD // 189 + SYS___CLRMF = 0xBD // 189 + SYS_FETCHEP = 0xBF // 191 + SYS___FTCHEP = 0xBF // 191 + SYS_FLDATA = 0xC1 // 193 + SYS___FLDATA = 0xC1 // 193 + SYS_DYNFREE = 0xC2 // 194 + SYS___DYNFRE = 0xC2 // 194 + SYS_DYNALLOC = 0xC3 // 195 + SYS___DYNALL = 0xC3 // 195 + SYS___CDUMP = 0xC4 // 196 + SYS_CSNAP = 0xC5 // 197 + SYS___CSNAP = 0xC5 // 197 + SYS_CTRACE = 0xC6 // 198 + SYS___CTRACE = 0xC6 // 198 + SYS___CTEST = 0xC7 // 199 + SYS_SETENV = 0xC8 // 200 + SYS___SETENV = 0xC8 // 200 + SYS_CLEARENV = 0xC9 // 201 + SYS___CLRENV = 0xC9 // 201 + SYS___REGCOMP_STD = 0xEA // 234 + SYS_NL_LANGINFO = 0xFC // 252 + SYS_GETSYNTX = 0xFD // 253 + SYS_ISBLANK = 0xFE // 254 + SYS___ISBLNK = 0xFE // 254 + SYS_ISWALNUM = 0xFF // 255 + SYS_ISWALPHA = 0x100 // 256 + SYS_ISWBLANK = 0x101 // 257 + SYS___ISWBLK = 0x101 // 257 + SYS_ISWCNTRL = 0x102 // 258 + SYS_ISWDIGIT = 0x103 // 259 + SYS_ISWGRAPH = 0x104 // 260 + SYS_ISWLOWER = 0x105 // 261 + SYS_ISWPRINT = 0x106 // 262 + SYS_ISWPUNCT = 0x107 // 263 + SYS_ISWSPACE = 0x108 // 264 + SYS_ISWUPPER = 0x109 // 265 + SYS_ISWXDIGI = 0x10A // 266 + SYS_ISWXDIGIT = 0x10A // 266 + SYS_WCTYPE = 0x10B // 267 + SYS_ISWCTYPE = 0x10C // 268 + SYS_TOWLOWER = 0x10D // 269 + SYS_TOWUPPER = 0x10E // 270 + SYS_MBSINIT = 0x10F // 271 + SYS_WCTOB = 0x110 // 272 + SYS_MBRLEN = 0x111 // 273 + SYS_MBRTOWC = 0x112 // 274 + SYS_MBSRTOWC = 0x113 // 275 + SYS_MBSRTOWCS = 0x113 // 275 + SYS_WCRTOMB = 0x114 // 276 + SYS_WCSRTOMB = 0x115 // 277 + SYS_WCSRTOMBS = 0x115 // 277 + SYS___CSID = 0x116 // 278 + SYS___WCSID = 0x117 // 279 + SYS_STRPTIME = 0x118 // 280 + SYS___STRPTM = 0x118 // 280 + SYS_STRFMON = 0x119 // 281 + SYS___RPMTCH = 0x11A // 282 + SYS_WCSSTR = 0x11B // 283 + SYS_WCSTOK = 0x12C // 300 + SYS_WCSTOL = 0x12D // 301 + SYS_WCSTOD = 0x12E // 302 + SYS_WCSTOUL = 0x12F // 303 + SYS_WCSCOLL = 0x130 // 304 + SYS_WCSXFRM = 0x131 // 305 + SYS_WCSWIDTH = 0x132 // 306 + SYS_WCWIDTH = 0x133 // 307 + SYS_WCSFTIME = 0x134 // 308 + SYS_SWPRINTF = 0x135 // 309 + SYS_VSWPRINT = 0x136 // 310 + SYS_VSWPRINTF = 0x136 // 310 + SYS_SWSCANF = 0x137 // 311 + SYS_REGCOMP = 0x138 // 312 + SYS_REGEXEC = 0x139 // 313 + SYS_REGFREE = 0x13A // 314 + SYS_REGERROR = 0x13B // 315 + SYS_FGETWC = 0x13C // 316 + SYS_FGETWS = 0x13D // 317 + SYS_FPUTWC = 0x13E // 318 + SYS_FPUTWS = 0x13F // 319 + SYS_GETWC = 0x140 // 320 + SYS_GETWCHAR = 0x141 // 321 + SYS_PUTWC = 0x142 // 322 + SYS_PUTWCHAR = 0x143 // 323 + SYS_UNGETWC = 0x144 // 324 + SYS_ICONV_OPEN = 0x145 // 325 + SYS_ICONV = 0x146 // 326 + SYS_ICONV_CLOSE = 0x147 // 327 + SYS_ISMCCOLLEL = 0x14C // 332 + SYS_STRTOCOLL = 0x14D // 333 + SYS_COLLTOSTR = 0x14E // 334 + SYS_COLLEQUIV = 0x14F // 335 + SYS_COLLRANGE = 0x150 // 336 + SYS_CCLASS = 0x151 // 337 + SYS_COLLORDER = 0x152 // 338 + SYS___DEMANGLE = 0x154 // 340 + SYS_FDOPEN = 0x155 // 341 + SYS___ERRNO = 0x156 // 342 + SYS___ERRNO2 = 0x157 // 343 + SYS___TERROR = 0x158 // 344 + SYS_MAXCOLL = 0x169 // 361 + SYS_GETMCCOLL = 0x16A // 362 + SYS_GETWMCCOLL = 0x16B // 363 + SYS___ERR2AD = 0x16C // 364 + SYS_DLLQUERYFN = 0x16D // 365 + SYS_DLLQUERYVAR = 0x16E // 366 + SYS_DLLFREE = 0x16F // 367 + SYS_DLLLOAD = 0x170 // 368 + SYS__EXIT = 0x174 // 372 + SYS_ACCESS = 0x175 // 373 + SYS_ALARM = 0x176 // 374 + SYS_CFGETISPEED = 0x177 // 375 + SYS_CFGETOSPEED = 0x178 // 376 + SYS_CFSETISPEED = 0x179 // 377 + SYS_CFSETOSPEED = 0x17A // 378 + SYS_CHDIR = 0x17B // 379 + SYS_CHMOD = 0x17C // 380 + SYS_CHOWN = 0x17D // 381 + SYS_CLOSE = 0x17E // 382 + SYS_CLOSEDIR = 0x17F // 383 + SYS_CREAT = 0x180 // 384 + SYS_CTERMID = 0x181 // 385 + SYS_DUP = 0x182 // 386 + SYS_DUP2 = 0x183 // 387 + SYS_EXECL = 0x184 // 388 + SYS_EXECLE = 0x185 // 389 + SYS_EXECLP = 0x186 // 390 + SYS_EXECV = 0x187 // 391 + SYS_EXECVE = 0x188 // 392 + SYS_EXECVP = 0x189 // 393 + SYS_FCHMOD = 0x18A // 394 + SYS_FCHOWN = 0x18B // 395 + SYS_FCNTL = 0x18C // 396 + SYS_FILENO = 0x18D // 397 + SYS_FORK = 0x18E // 398 + SYS_FPATHCONF = 0x18F // 399 + SYS_FSTAT = 0x190 // 400 + SYS_FSYNC = 0x191 // 401 + SYS_FTRUNCATE = 0x192 // 402 + SYS_GETCWD = 0x193 // 403 + SYS_GETEGID = 0x194 // 404 + SYS_GETEUID = 0x195 // 405 + SYS_GETGID = 0x196 // 406 + SYS_GETGRGID = 0x197 // 407 + SYS_GETGRNAM = 0x198 // 408 + SYS_GETGROUPS = 0x199 // 409 + SYS_GETLOGIN = 0x19A // 410 + SYS_W_GETMNTENT = 0x19B // 411 + SYS_GETPGRP = 0x19C // 412 + SYS_GETPID = 0x19D // 413 + SYS_GETPPID = 0x19E // 414 + SYS_GETPWNAM = 0x19F // 415 + SYS_GETPWUID = 0x1A0 // 416 + SYS_GETUID = 0x1A1 // 417 + SYS_W_IOCTL = 0x1A2 // 418 + SYS_ISATTY = 0x1A3 // 419 + SYS_KILL = 0x1A4 // 420 + SYS_LINK = 0x1A5 // 421 + SYS_LSEEK = 0x1A6 // 422 + SYS_LSTAT = 0x1A7 // 423 + SYS_MKDIR = 0x1A8 // 424 + SYS_MKFIFO = 0x1A9 // 425 + SYS_MKNOD = 0x1AA // 426 + SYS_MOUNT = 0x1AB // 427 + SYS_OPEN = 0x1AC // 428 + SYS_OPENDIR = 0x1AD // 429 + SYS_PATHCONF = 0x1AE // 430 + SYS_PAUSE = 0x1AF // 431 + SYS_PIPE = 0x1B0 // 432 + SYS_W_GETPSENT = 0x1B1 // 433 + SYS_READ = 0x1B2 // 434 + SYS_READDIR = 0x1B3 // 435 + SYS_READLINK = 0x1B4 // 436 + SYS_REWINDDIR = 0x1B5 // 437 + SYS_RMDIR = 0x1B6 // 438 + SYS_SETEGID = 0x1B7 // 439 + SYS_SETEUID = 0x1B8 // 440 + SYS_SETGID = 0x1B9 // 441 + SYS_SETPGID = 0x1BA // 442 + SYS_SETSID = 0x1BB // 443 + SYS_SETUID = 0x1BC // 444 + SYS_SIGACTION = 0x1BD // 445 + SYS_SIGADDSET = 0x1BE // 446 + SYS_SIGDELSET = 0x1BF // 447 + SYS_SIGEMPTYSET = 0x1C0 // 448 + SYS_SIGFILLSET = 0x1C1 // 449 + SYS_SIGISMEMBER = 0x1C2 // 450 + SYS_SIGLONGJMP = 0x1C3 // 451 + SYS_SIGPENDING = 0x1C4 // 452 + SYS_SIGPROCMASK = 0x1C5 // 453 + SYS_SIGSETJMP = 0x1C6 // 454 + SYS_SIGSUSPEND = 0x1C7 // 455 + SYS_SLEEP = 0x1C8 // 456 + SYS_STAT = 0x1C9 // 457 + SYS_W_STATFS = 0x1CA // 458 + SYS_SYMLINK = 0x1CB // 459 + SYS_SYSCONF = 0x1CC // 460 + SYS_TCDRAIN = 0x1CD // 461 + SYS_TCFLOW = 0x1CE // 462 + SYS_TCFLUSH = 0x1CF // 463 + SYS_TCGETATTR = 0x1D0 // 464 + SYS_TCGETPGRP = 0x1D1 // 465 + SYS_TCSENDBREAK = 0x1D2 // 466 + SYS_TCSETATTR = 0x1D3 // 467 + SYS_TCSETPGRP = 0x1D4 // 468 + SYS_TIMES = 0x1D5 // 469 + SYS_TTYNAME = 0x1D6 // 470 + SYS_TZSET = 0x1D7 // 471 + SYS_UMASK = 0x1D8 // 472 + SYS_UMOUNT = 0x1D9 // 473 + SYS_UNAME = 0x1DA // 474 + SYS_UNLINK = 0x1DB // 475 + SYS_UTIME = 0x1DC // 476 + SYS_WAIT = 0x1DD // 477 + SYS_WAITPID = 0x1DE // 478 + SYS_WRITE = 0x1DF // 479 + SYS_CHAUDIT = 0x1E0 // 480 + SYS_FCHAUDIT = 0x1E1 // 481 + SYS_GETGROUPSBYNAME = 0x1E2 // 482 + SYS_SIGWAIT = 0x1E3 // 483 + SYS_PTHREAD_EXIT = 0x1E4 // 484 + SYS_PTHREAD_KILL = 0x1E5 // 485 + SYS_PTHREAD_ATTR_INIT = 0x1E6 // 486 + SYS_PTHREAD_ATTR_DESTROY = 0x1E7 // 487 + SYS_PTHREAD_ATTR_SETSTACKSIZE = 0x1E8 // 488 + SYS_PTHREAD_ATTR_GETSTACKSIZE = 0x1E9 // 489 + SYS_PTHREAD_ATTR_SETDETACHSTATE = 0x1EA // 490 + SYS_PTHREAD_ATTR_GETDETACHSTATE = 0x1EB // 491 + SYS_PTHREAD_ATTR_SETWEIGHT_NP = 0x1EC // 492 + SYS_PTHREAD_ATTR_GETWEIGHT_NP = 0x1ED // 493 + SYS_PTHREAD_CANCEL = 0x1EE // 494 + SYS_PTHREAD_CLEANUP_PUSH = 0x1EF // 495 + SYS_PTHREAD_CLEANUP_POP = 0x1F0 // 496 + SYS_PTHREAD_CONDATTR_INIT = 0x1F1 // 497 + SYS_PTHREAD_CONDATTR_DESTROY = 0x1F2 // 498 + SYS_PTHREAD_COND_INIT = 0x1F3 // 499 + SYS_PTHREAD_COND_DESTROY = 0x1F4 // 500 + SYS_PTHREAD_COND_SIGNAL = 0x1F5 // 501 + SYS_PTHREAD_COND_BROADCAST = 0x1F6 // 502 + SYS_PTHREAD_COND_WAIT = 0x1F7 // 503 + SYS_PTHREAD_COND_TIMEDWAIT = 0x1F8 // 504 + SYS_PTHREAD_CREATE = 0x1F9 // 505 + SYS_PTHREAD_DETACH = 0x1FA // 506 + SYS_PTHREAD_EQUAL = 0x1FB // 507 + SYS_PTHREAD_GETSPECIFIC = 0x1FC // 508 + SYS_PTHREAD_JOIN = 0x1FD // 509 + SYS_PTHREAD_KEY_CREATE = 0x1FE // 510 + SYS_PTHREAD_MUTEXATTR_INIT = 0x1FF // 511 + SYS_PTHREAD_MUTEXATTR_DESTROY = 0x200 // 512 + SYS_PTHREAD_MUTEXATTR_SETKIND_NP = 0x201 // 513 + SYS_PTHREAD_MUTEXATTR_GETKIND_NP = 0x202 // 514 + SYS_PTHREAD_MUTEX_INIT = 0x203 // 515 + SYS_PTHREAD_MUTEX_DESTROY = 0x204 // 516 + SYS_PTHREAD_MUTEX_LOCK = 0x205 // 517 + SYS_PTHREAD_MUTEX_TRYLOCK = 0x206 // 518 + SYS_PTHREAD_MUTEX_UNLOCK = 0x207 // 519 + SYS_PTHREAD_ONCE = 0x209 // 521 + SYS_PTHREAD_SELF = 0x20A // 522 + SYS_PTHREAD_SETINTR = 0x20B // 523 + SYS_PTHREAD_SETINTRTYPE = 0x20C // 524 + SYS_PTHREAD_SETSPECIFIC = 0x20D // 525 + SYS_PTHREAD_TESTINTR = 0x20E // 526 + SYS_PTHREAD_YIELD = 0x20F // 527 + SYS_TW_OPEN = 0x210 // 528 + SYS_TW_FCNTL = 0x211 // 529 + SYS_PTHREAD_JOIN_D4_NP = 0x212 // 530 + SYS_PTHREAD_CONDATTR_SETKIND_NP = 0x213 // 531 + SYS_PTHREAD_CONDATTR_GETKIND_NP = 0x214 // 532 + SYS_EXTLINK_NP = 0x215 // 533 + SYS___PASSWD = 0x216 // 534 + SYS_SETGROUPS = 0x217 // 535 + SYS_INITGROUPS = 0x218 // 536 + SYS_WCSPBRK = 0x23F // 575 + SYS_WCSRCHR = 0x240 // 576 + SYS_SVC99 = 0x241 // 577 + SYS___SVC99 = 0x241 // 577 + SYS_WCSWCS = 0x242 // 578 + SYS_LOCALECO = 0x243 // 579 + SYS_LOCALECONV = 0x243 // 579 + SYS___LIBREL = 0x244 // 580 + SYS_RELEASE = 0x245 // 581 + SYS___RLSE = 0x245 // 581 + SYS_FLOCATE = 0x246 // 582 + SYS___FLOCT = 0x246 // 582 + SYS_FDELREC = 0x247 // 583 + SYS___FDLREC = 0x247 // 583 + SYS_FETCH = 0x248 // 584 + SYS___FETCH = 0x248 // 584 + SYS_QSORT = 0x249 // 585 + SYS_GETENV = 0x24A // 586 + SYS_SYSTEM = 0x24B // 587 + SYS_BSEARCH = 0x24C // 588 + SYS_LDIV = 0x24D // 589 + SYS___THROW = 0x25E // 606 + SYS___RETHROW = 0x25F // 607 + SYS___CLEANUPCATCH = 0x260 // 608 + SYS___CATCHMATCH = 0x261 // 609 + SYS___CLEAN2UPCATCH = 0x262 // 610 + SYS_PUTENV = 0x26A // 618 + SYS___GETENV = 0x26F // 623 + SYS_GETPRIORITY = 0x270 // 624 + SYS_NICE = 0x271 // 625 + SYS_SETPRIORITY = 0x272 // 626 + SYS_GETITIMER = 0x273 // 627 + SYS_SETITIMER = 0x274 // 628 + SYS_MSGCTL = 0x275 // 629 + SYS_MSGGET = 0x276 // 630 + SYS_MSGRCV = 0x277 // 631 + SYS_MSGSND = 0x278 // 632 + SYS_MSGXRCV = 0x279 // 633 + SYS___MSGXR = 0x279 // 633 + SYS_SEMCTL = 0x27A // 634 + SYS_SEMGET = 0x27B // 635 + SYS_SEMOP = 0x27C // 636 + SYS_SHMAT = 0x27D // 637 + SYS_SHMCTL = 0x27E // 638 + SYS_SHMDT = 0x27F // 639 + SYS_SHMGET = 0x280 // 640 + SYS___GETIPC = 0x281 // 641 + SYS_SETGRENT = 0x282 // 642 + SYS_GETGRENT = 0x283 // 643 + SYS_ENDGRENT = 0x284 // 644 + SYS_SETPWENT = 0x285 // 645 + SYS_GETPWENT = 0x286 // 646 + SYS_ENDPWENT = 0x287 // 647 + SYS_BSD_SIGNAL = 0x288 // 648 + SYS_KILLPG = 0x289 // 649 + SYS_SIGALTSTACK = 0x28A // 650 + SYS_SIGHOLD = 0x28B // 651 + SYS_SIGIGNORE = 0x28C // 652 + SYS_SIGINTERRUPT = 0x28D // 653 + SYS_SIGPAUSE = 0x28E // 654 + SYS_SIGRELSE = 0x28F // 655 + SYS_SIGSET = 0x290 // 656 + SYS_SIGSTACK = 0x291 // 657 + SYS_GETRLIMIT = 0x292 // 658 + SYS_SETRLIMIT = 0x293 // 659 + SYS_GETRUSAGE = 0x294 // 660 + SYS_MMAP = 0x295 // 661 + SYS_MPROTECT = 0x296 // 662 + SYS_MSYNC = 0x297 // 663 + SYS_MUNMAP = 0x298 // 664 + SYS_CONFSTR = 0x299 // 665 + SYS_GETOPT = 0x29A // 666 + SYS_LCHOWN = 0x29B // 667 + SYS_TRUNCATE = 0x29C // 668 + SYS_GETSUBOPT = 0x29D // 669 + SYS_SETPGRP = 0x29E // 670 + SYS___GDERR = 0x29F // 671 + SYS___TZONE = 0x2A0 // 672 + SYS___DLGHT = 0x2A1 // 673 + SYS___OPARGF = 0x2A2 // 674 + SYS___OPOPTF = 0x2A3 // 675 + SYS___OPINDF = 0x2A4 // 676 + SYS___OPERRF = 0x2A5 // 677 + SYS_GETDATE = 0x2A6 // 678 + SYS_WAIT3 = 0x2A7 // 679 + SYS_WAITID = 0x2A8 // 680 + SYS___CATTRM = 0x2A9 // 681 + SYS___GDTRM = 0x2AA // 682 + SYS___RNDTRM = 0x2AB // 683 + SYS_CRYPT = 0x2AC // 684 + SYS_ENCRYPT = 0x2AD // 685 + SYS_SETKEY = 0x2AE // 686 + SYS___CNVBLK = 0x2AF // 687 + SYS___CRYTRM = 0x2B0 // 688 + SYS___ECRTRM = 0x2B1 // 689 + SYS_DRAND48 = 0x2B2 // 690 + SYS_ERAND48 = 0x2B3 // 691 + SYS_FSTATVFS = 0x2B4 // 692 + SYS_STATVFS = 0x2B5 // 693 + SYS_CATCLOSE = 0x2B6 // 694 + SYS_CATGETS = 0x2B7 // 695 + SYS_CATOPEN = 0x2B8 // 696 + SYS_BCMP = 0x2B9 // 697 + SYS_BCOPY = 0x2BA // 698 + SYS_BZERO = 0x2BB // 699 + SYS_FFS = 0x2BC // 700 + SYS_INDEX = 0x2BD // 701 + SYS_RINDEX = 0x2BE // 702 + SYS_STRCASECMP = 0x2BF // 703 + SYS_STRDUP = 0x2C0 // 704 + SYS_STRNCASECMP = 0x2C1 // 705 + SYS_INITSTATE = 0x2C2 // 706 + SYS_SETSTATE = 0x2C3 // 707 + SYS_RANDOM = 0x2C4 // 708 + SYS_SRANDOM = 0x2C5 // 709 + SYS_HCREATE = 0x2C6 // 710 + SYS_HDESTROY = 0x2C7 // 711 + SYS_HSEARCH = 0x2C8 // 712 + SYS_LFIND = 0x2C9 // 713 + SYS_LSEARCH = 0x2CA // 714 + SYS_TDELETE = 0x2CB // 715 + SYS_TFIND = 0x2CC // 716 + SYS_TSEARCH = 0x2CD // 717 + SYS_TWALK = 0x2CE // 718 + SYS_INSQUE = 0x2CF // 719 + SYS_REMQUE = 0x2D0 // 720 + SYS_POPEN = 0x2D1 // 721 + SYS_PCLOSE = 0x2D2 // 722 + SYS_SWAB = 0x2D3 // 723 + SYS_MEMCCPY = 0x2D4 // 724 + SYS_GETPAGESIZE = 0x2D8 // 728 + SYS_FCHDIR = 0x2D9 // 729 + SYS___OCLCK = 0x2DA // 730 + SYS___ATOE = 0x2DB // 731 + SYS___ATOE_L = 0x2DC // 732 + SYS___ETOA = 0x2DD // 733 + SYS___ETOA_L = 0x2DE // 734 + SYS_SETUTXENT = 0x2DF // 735 + SYS_GETUTXENT = 0x2E0 // 736 + SYS_ENDUTXENT = 0x2E1 // 737 + SYS_GETUTXID = 0x2E2 // 738 + SYS_GETUTXLINE = 0x2E3 // 739 + SYS_PUTUTXLINE = 0x2E4 // 740 + SYS_FMTMSG = 0x2E5 // 741 + SYS_JRAND48 = 0x2E6 // 742 + SYS_LRAND48 = 0x2E7 // 743 + SYS_MRAND48 = 0x2E8 // 744 + SYS_NRAND48 = 0x2E9 // 745 + SYS_LCONG48 = 0x2EA // 746 + SYS_SRAND48 = 0x2EB // 747 + SYS_SEED48 = 0x2EC // 748 + SYS_ISASCII = 0x2ED // 749 + SYS_TOASCII = 0x2EE // 750 + SYS_A64L = 0x2EF // 751 + SYS_L64A = 0x2F0 // 752 + SYS_UALARM = 0x2F1 // 753 + SYS_USLEEP = 0x2F2 // 754 + SYS___UTXTRM = 0x2F3 // 755 + SYS___SRCTRM = 0x2F4 // 756 + SYS_FTIME = 0x2F5 // 757 + SYS_GETTIMEOFDAY = 0x2F6 // 758 + SYS_DBM_CLEARERR = 0x2F7 // 759 + SYS_DBM_CLOSE = 0x2F8 // 760 + SYS_DBM_DELETE = 0x2F9 // 761 + SYS_DBM_ERROR = 0x2FA // 762 + SYS_DBM_FETCH = 0x2FB // 763 + SYS_DBM_FIRSTKEY = 0x2FC // 764 + SYS_DBM_NEXTKEY = 0x2FD // 765 + SYS_DBM_OPEN = 0x2FE // 766 + SYS_DBM_STORE = 0x2FF // 767 + SYS___NDMTRM = 0x300 // 768 + SYS_FTOK = 0x301 // 769 + SYS_BASENAME = 0x302 // 770 + SYS_DIRNAME = 0x303 // 771 + SYS_GETDTABLESIZE = 0x304 // 772 + SYS_MKSTEMP = 0x305 // 773 + SYS_MKTEMP = 0x306 // 774 + SYS_NFTW = 0x307 // 775 + SYS_GETWD = 0x308 // 776 + SYS_LOCKF = 0x309 // 777 + SYS__LONGJMP = 0x30D // 781 + SYS__SETJMP = 0x30E // 782 + SYS_VFORK = 0x30F // 783 + SYS_WORDEXP = 0x310 // 784 + SYS_WORDFREE = 0x311 // 785 + SYS_GETPGID = 0x312 // 786 + SYS_GETSID = 0x313 // 787 + SYS___UTMPXNAME = 0x314 // 788 + SYS_CUSERID = 0x315 // 789 + SYS_GETPASS = 0x316 // 790 + SYS_FNMATCH = 0x317 // 791 + SYS_FTW = 0x318 // 792 + SYS_GETW = 0x319 // 793 + SYS_GLOB = 0x31A // 794 + SYS_GLOBFREE = 0x31B // 795 + SYS_PUTW = 0x31C // 796 + SYS_SEEKDIR = 0x31D // 797 + SYS_TELLDIR = 0x31E // 798 + SYS_TEMPNAM = 0x31F // 799 + SYS_ACOSH = 0x320 // 800 + SYS_ASINH = 0x321 // 801 + SYS_ATANH = 0x322 // 802 + SYS_CBRT = 0x323 // 803 + SYS_EXPM1 = 0x324 // 804 + SYS_ILOGB = 0x325 // 805 + SYS_LOGB = 0x326 // 806 + SYS_LOG1P = 0x327 // 807 + SYS_NEXTAFTER = 0x328 // 808 + SYS_RINT = 0x329 // 809 + SYS_REMAINDER = 0x32A // 810 + SYS_SCALB = 0x32B // 811 + SYS_LGAMMA = 0x32C // 812 + SYS_TTYSLOT = 0x32D // 813 + SYS_GETTIMEOFDAY_R = 0x32E // 814 + SYS_SYNC = 0x32F // 815 + SYS_SPAWN = 0x330 // 816 + SYS_SPAWNP = 0x331 // 817 + SYS_GETLOGIN_UU = 0x332 // 818 + SYS_ECVT = 0x333 // 819 + SYS_FCVT = 0x334 // 820 + SYS_GCVT = 0x335 // 821 + SYS_ACCEPT = 0x336 // 822 + SYS_BIND = 0x337 // 823 + SYS_CONNECT = 0x338 // 824 + SYS_ENDHOSTENT = 0x339 // 825 + SYS_ENDPROTOENT = 0x33A // 826 + SYS_ENDSERVENT = 0x33B // 827 + SYS_GETHOSTBYADDR_R = 0x33C // 828 + SYS_GETHOSTBYADDR = 0x33D // 829 + SYS_GETHOSTBYNAME_R = 0x33E // 830 + SYS_GETHOSTBYNAME = 0x33F // 831 + SYS_GETHOSTENT = 0x340 // 832 + SYS_GETHOSTID = 0x341 // 833 + SYS_GETHOSTNAME = 0x342 // 834 + SYS_GETNETBYADDR = 0x343 // 835 + SYS_GETNETBYNAME = 0x344 // 836 + SYS_GETNETENT = 0x345 // 837 + SYS_GETPEERNAME = 0x346 // 838 + SYS_GETPROTOBYNAME = 0x347 // 839 + SYS_GETPROTOBYNUMBER = 0x348 // 840 + SYS_GETPROTOENT = 0x349 // 841 + SYS_GETSERVBYNAME = 0x34A // 842 + SYS_GETSERVBYPORT = 0x34B // 843 + SYS_GETSERVENT = 0x34C // 844 + SYS_GETSOCKNAME = 0x34D // 845 + SYS_GETSOCKOPT = 0x34E // 846 + SYS_INET_ADDR = 0x34F // 847 + SYS_INET_LNAOF = 0x350 // 848 + SYS_INET_MAKEADDR = 0x351 // 849 + SYS_INET_NETOF = 0x352 // 850 + SYS_INET_NETWORK = 0x353 // 851 + SYS_INET_NTOA = 0x354 // 852 + SYS_IOCTL = 0x355 // 853 + SYS_LISTEN = 0x356 // 854 + SYS_READV = 0x357 // 855 + SYS_RECV = 0x358 // 856 + SYS_RECVFROM = 0x359 // 857 + SYS_SELECT = 0x35B // 859 + SYS_SELECTEX = 0x35C // 860 + SYS_SEND = 0x35D // 861 + SYS_SENDTO = 0x35F // 863 + SYS_SETHOSTENT = 0x360 // 864 + SYS_SETNETENT = 0x361 // 865 + SYS_SETPEER = 0x362 // 866 + SYS_SETPROTOENT = 0x363 // 867 + SYS_SETSERVENT = 0x364 // 868 + SYS_SETSOCKOPT = 0x365 // 869 + SYS_SHUTDOWN = 0x366 // 870 + SYS_SOCKET = 0x367 // 871 + SYS_SOCKETPAIR = 0x368 // 872 + SYS_WRITEV = 0x369 // 873 + SYS_CHROOT = 0x36A // 874 + SYS_W_STATVFS = 0x36B // 875 + SYS_ULIMIT = 0x36C // 876 + SYS_ISNAN = 0x36D // 877 + SYS_UTIMES = 0x36E // 878 + SYS___H_ERRNO = 0x36F // 879 + SYS_ENDNETENT = 0x370 // 880 + SYS_CLOSELOG = 0x371 // 881 + SYS_OPENLOG = 0x372 // 882 + SYS_SETLOGMASK = 0x373 // 883 + SYS_SYSLOG = 0x374 // 884 + SYS_PTSNAME = 0x375 // 885 + SYS_SETREUID = 0x376 // 886 + SYS_SETREGID = 0x377 // 887 + SYS_REALPATH = 0x378 // 888 + SYS___SIGNGAM = 0x379 // 889 + SYS_GRANTPT = 0x37A // 890 + SYS_UNLOCKPT = 0x37B // 891 + SYS_TCGETSID = 0x37C // 892 + SYS___TCGETCP = 0x37D // 893 + SYS___TCSETCP = 0x37E // 894 + SYS___TCSETTABLES = 0x37F // 895 + SYS_POLL = 0x380 // 896 + SYS_REXEC = 0x381 // 897 + SYS___ISASCII2 = 0x382 // 898 + SYS___TOASCII2 = 0x383 // 899 + SYS_CHPRIORITY = 0x384 // 900 + SYS_PTHREAD_ATTR_SETSYNCTYPE_NP = 0x385 // 901 + SYS_PTHREAD_ATTR_GETSYNCTYPE_NP = 0x386 // 902 + SYS_PTHREAD_SET_LIMIT_NP = 0x387 // 903 + SYS___STNETENT = 0x388 // 904 + SYS___STPROTOENT = 0x389 // 905 + SYS___STSERVENT = 0x38A // 906 + SYS___STHOSTENT = 0x38B // 907 + SYS_NLIST = 0x38C // 908 + SYS___IPDBCS = 0x38D // 909 + SYS___IPDSPX = 0x38E // 910 + SYS___IPMSGC = 0x38F // 911 + SYS___SELECT1 = 0x390 // 912 + SYS_PTHREAD_SECURITY_NP = 0x391 // 913 + SYS___CHECK_RESOURCE_AUTH_NP = 0x392 // 914 + SYS___CONVERT_ID_NP = 0x393 // 915 + SYS___OPENVMREL = 0x394 // 916 + SYS_WMEMCHR = 0x395 // 917 + SYS_WMEMCMP = 0x396 // 918 + SYS_WMEMCPY = 0x397 // 919 + SYS_WMEMMOVE = 0x398 // 920 + SYS_WMEMSET = 0x399 // 921 + SYS___FPUTWC = 0x400 // 1024 + SYS___PUTWC = 0x401 // 1025 + SYS___PWCHAR = 0x402 // 1026 + SYS___WCSFTM = 0x403 // 1027 + SYS___WCSTOK = 0x404 // 1028 + SYS___WCWDTH = 0x405 // 1029 + SYS_T_ACCEPT = 0x409 // 1033 + SYS_T_ALLOC = 0x40A // 1034 + SYS_T_BIND = 0x40B // 1035 + SYS_T_CLOSE = 0x40C // 1036 + SYS_T_CONNECT = 0x40D // 1037 + SYS_T_ERROR = 0x40E // 1038 + SYS_T_FREE = 0x40F // 1039 + SYS_T_GETINFO = 0x410 // 1040 + SYS_T_GETPROTADDR = 0x411 // 1041 + SYS_T_GETSTATE = 0x412 // 1042 + SYS_T_LISTEN = 0x413 // 1043 + SYS_T_LOOK = 0x414 // 1044 + SYS_T_OPEN = 0x415 // 1045 + SYS_T_OPTMGMT = 0x416 // 1046 + SYS_T_RCV = 0x417 // 1047 + SYS_T_RCVCONNECT = 0x418 // 1048 + SYS_T_RCVDIS = 0x419 // 1049 + SYS_T_RCVREL = 0x41A // 1050 + SYS_T_RCVUDATA = 0x41B // 1051 + SYS_T_RCVUDERR = 0x41C // 1052 + SYS_T_SND = 0x41D // 1053 + SYS_T_SNDDIS = 0x41E // 1054 + SYS_T_SNDREL = 0x41F // 1055 + SYS_T_SNDUDATA = 0x420 // 1056 + SYS_T_STRERROR = 0x421 // 1057 + SYS_T_SYNC = 0x422 // 1058 + SYS_T_UNBIND = 0x423 // 1059 + SYS___T_ERRNO = 0x424 // 1060 + SYS___RECVMSG2 = 0x425 // 1061 + SYS___SENDMSG2 = 0x426 // 1062 + SYS_FATTACH = 0x427 // 1063 + SYS_FDETACH = 0x428 // 1064 + SYS_GETMSG = 0x429 // 1065 + SYS_GETPMSG = 0x42A // 1066 + SYS_ISASTREAM = 0x42B // 1067 + SYS_PUTMSG = 0x42C // 1068 + SYS_PUTPMSG = 0x42D // 1069 + SYS___ISPOSIXON = 0x42E // 1070 + SYS___OPENMVSREL = 0x42F // 1071 + SYS_GETCONTEXT = 0x430 // 1072 + SYS_SETCONTEXT = 0x431 // 1073 + SYS_MAKECONTEXT = 0x432 // 1074 + SYS_SWAPCONTEXT = 0x433 // 1075 + SYS_PTHREAD_GETSPECIFIC_D8_NP = 0x434 // 1076 + SYS_GETCLIENTID = 0x470 // 1136 + SYS___GETCLIENTID = 0x471 // 1137 + SYS_GETSTABLESIZE = 0x472 // 1138 + SYS_GETIBMOPT = 0x473 // 1139 + SYS_GETIBMSOCKOPT = 0x474 // 1140 + SYS_GIVESOCKET = 0x475 // 1141 + SYS_IBMSFLUSH = 0x476 // 1142 + SYS_MAXDESC = 0x477 // 1143 + SYS_SETIBMOPT = 0x478 // 1144 + SYS_SETIBMSOCKOPT = 0x479 // 1145 + SYS_SOCK_DEBUG = 0x47A // 1146 + SYS_SOCK_DO_TESTSTOR = 0x47D // 1149 + SYS_TAKESOCKET = 0x47E // 1150 + SYS___SERVER_INIT = 0x47F // 1151 + SYS___SERVER_PWU = 0x480 // 1152 + SYS_PTHREAD_TAG_NP = 0x481 // 1153 + SYS___CONSOLE = 0x482 // 1154 + SYS___WSINIT = 0x483 // 1155 + SYS___IPTCPN = 0x489 // 1161 + SYS___SMF_RECORD = 0x48A // 1162 + SYS___IPHOST = 0x48B // 1163 + SYS___IPNODE = 0x48C // 1164 + SYS___SERVER_CLASSIFY_CREATE = 0x48D // 1165 + SYS___SERVER_CLASSIFY_DESTROY = 0x48E // 1166 + SYS___SERVER_CLASSIFY_RESET = 0x48F // 1167 + SYS___SERVER_CLASSIFY = 0x490 // 1168 + SYS___HEAPRPT = 0x496 // 1174 + SYS___FNWSA = 0x49B // 1179 + SYS___SPAWN2 = 0x49D // 1181 + SYS___SPAWNP2 = 0x49E // 1182 + SYS___GDRR = 0x4A1 // 1185 + SYS___HRRNO = 0x4A2 // 1186 + SYS___OPRG = 0x4A3 // 1187 + SYS___OPRR = 0x4A4 // 1188 + SYS___OPND = 0x4A5 // 1189 + SYS___OPPT = 0x4A6 // 1190 + SYS___SIGGM = 0x4A7 // 1191 + SYS___DGHT = 0x4A8 // 1192 + SYS___TZNE = 0x4A9 // 1193 + SYS___TZZN = 0x4AA // 1194 + SYS___TRRNO = 0x4AF // 1199 + SYS___ENVN = 0x4B0 // 1200 + SYS___MLOCKALL = 0x4B1 // 1201 + SYS_CREATEWO = 0x4B2 // 1202 + SYS_CREATEWORKUNIT = 0x4B2 // 1202 + SYS_CONTINUE = 0x4B3 // 1203 + SYS_CONTINUEWORKUNIT = 0x4B3 // 1203 + SYS_CONNECTW = 0x4B4 // 1204 + SYS_CONNECTWORKMGR = 0x4B4 // 1204 + SYS_CONNECTS = 0x4B5 // 1205 + SYS_CONNECTSERVER = 0x4B5 // 1205 + SYS_DISCONNE = 0x4B6 // 1206 + SYS_DISCONNECTSERVER = 0x4B6 // 1206 + SYS_JOINWORK = 0x4B7 // 1207 + SYS_JOINWORKUNIT = 0x4B7 // 1207 + SYS_LEAVEWOR = 0x4B8 // 1208 + SYS_LEAVEWORKUNIT = 0x4B8 // 1208 + SYS_DELETEWO = 0x4B9 // 1209 + SYS_DELETEWORKUNIT = 0x4B9 // 1209 + SYS_QUERYMET = 0x4BA // 1210 + SYS_QUERYMETRICS = 0x4BA // 1210 + SYS_QUERYSCH = 0x4BB // 1211 + SYS_QUERYSCHENV = 0x4BB // 1211 + SYS_CHECKSCH = 0x4BC // 1212 + SYS_CHECKSCHENV = 0x4BC // 1212 + SYS___PID_AFFINITY = 0x4BD // 1213 + SYS___ASINH_B = 0x4BE // 1214 + SYS___ATAN_B = 0x4BF // 1215 + SYS___CBRT_B = 0x4C0 // 1216 + SYS___CEIL_B = 0x4C1 // 1217 + SYS_COPYSIGN = 0x4C2 // 1218 + SYS___COS_B = 0x4C3 // 1219 + SYS___ERF_B = 0x4C4 // 1220 + SYS___ERFC_B = 0x4C5 // 1221 + SYS___EXPM1_B = 0x4C6 // 1222 + SYS___FABS_B = 0x4C7 // 1223 + SYS_FINITE = 0x4C8 // 1224 + SYS___FLOOR_B = 0x4C9 // 1225 + SYS___FREXP_B = 0x4CA // 1226 + SYS___ILOGB_B = 0x4CB // 1227 + SYS___ISNAN_B = 0x4CC // 1228 + SYS___LDEXP_B = 0x4CD // 1229 + SYS___LOG1P_B = 0x4CE // 1230 + SYS___LOGB_B = 0x4CF // 1231 + SYS_MATHERR = 0x4D0 // 1232 + SYS___MODF_B = 0x4D1 // 1233 + SYS___NEXTAFTER_B = 0x4D2 // 1234 + SYS___RINT_B = 0x4D3 // 1235 + SYS_SCALBN = 0x4D4 // 1236 + SYS_SIGNIFIC = 0x4D5 // 1237 + SYS_SIGNIFICAND = 0x4D5 // 1237 + SYS___SIN_B = 0x4D6 // 1238 + SYS___TAN_B = 0x4D7 // 1239 + SYS___TANH_B = 0x4D8 // 1240 + SYS___ACOS_B = 0x4D9 // 1241 + SYS___ACOSH_B = 0x4DA // 1242 + SYS___ASIN_B = 0x4DB // 1243 + SYS___ATAN2_B = 0x4DC // 1244 + SYS___ATANH_B = 0x4DD // 1245 + SYS___COSH_B = 0x4DE // 1246 + SYS___EXP_B = 0x4DF // 1247 + SYS___FMOD_B = 0x4E0 // 1248 + SYS___GAMMA_B = 0x4E1 // 1249 + SYS_GAMMA_R = 0x4E2 // 1250 + SYS___HYPOT_B = 0x4E3 // 1251 + SYS___J0_B = 0x4E4 // 1252 + SYS___Y0_B = 0x4E5 // 1253 + SYS___J1_B = 0x4E6 // 1254 + SYS___Y1_B = 0x4E7 // 1255 + SYS___JN_B = 0x4E8 // 1256 + SYS___YN_B = 0x4E9 // 1257 + SYS___LGAMMA_B = 0x4EA // 1258 + SYS_LGAMMA_R = 0x4EB // 1259 + SYS___LOG_B = 0x4EC // 1260 + SYS___LOG10_B = 0x4ED // 1261 + SYS___POW_B = 0x4EE // 1262 + SYS___REMAINDER_B = 0x4EF // 1263 + SYS___SCALB_B = 0x4F0 // 1264 + SYS___SINH_B = 0x4F1 // 1265 + SYS___SQRT_B = 0x4F2 // 1266 + SYS___OPENDIR2 = 0x4F3 // 1267 + SYS___READDIR2 = 0x4F4 // 1268 + SYS___LOGIN = 0x4F5 // 1269 + SYS___OPEN_STAT = 0x4F6 // 1270 + SYS_ACCEPT_AND_RECV = 0x4F7 // 1271 + SYS___FP_SETMODE = 0x4F8 // 1272 + SYS___SIGACTIONSET = 0x4FB // 1275 + SYS___UCREATE = 0x4FC // 1276 + SYS___UMALLOC = 0x4FD // 1277 + SYS___UFREE = 0x4FE // 1278 + SYS___UHEAPREPORT = 0x4FF // 1279 + SYS___ISBFP = 0x500 // 1280 + SYS___FP_CAST = 0x501 // 1281 + SYS___CERTIFICATE = 0x502 // 1282 + SYS_SEND_FILE = 0x503 // 1283 + SYS_AIO_CANCEL = 0x504 // 1284 + SYS_AIO_ERROR = 0x505 // 1285 + SYS_AIO_READ = 0x506 // 1286 + SYS_AIO_RETURN = 0x507 // 1287 + SYS_AIO_SUSPEND = 0x508 // 1288 + SYS_AIO_WRITE = 0x509 // 1289 + SYS_PTHREAD_MUTEXATTR_GETPSHARED = 0x50A // 1290 + SYS_PTHREAD_MUTEXATTR_SETPSHARED = 0x50B // 1291 + SYS_PTHREAD_RWLOCK_DESTROY = 0x50C // 1292 + SYS_PTHREAD_RWLOCK_INIT = 0x50D // 1293 + SYS_PTHREAD_RWLOCK_RDLOCK = 0x50E // 1294 + SYS_PTHREAD_RWLOCK_TRYRDLOCK = 0x50F // 1295 + SYS_PTHREAD_RWLOCK_TRYWRLOCK = 0x510 // 1296 + SYS_PTHREAD_RWLOCK_UNLOCK = 0x511 // 1297 + SYS_PTHREAD_RWLOCK_WRLOCK = 0x512 // 1298 + SYS_PTHREAD_RWLOCKATTR_GETPSHARED = 0x513 // 1299 + SYS_PTHREAD_RWLOCKATTR_SETPSHARED = 0x514 // 1300 + SYS_PTHREAD_RWLOCKATTR_INIT = 0x515 // 1301 + SYS_PTHREAD_RWLOCKATTR_DESTROY = 0x516 // 1302 + SYS___CTTBL = 0x517 // 1303 + SYS_PTHREAD_MUTEXATTR_SETTYPE = 0x518 // 1304 + SYS_PTHREAD_MUTEXATTR_GETTYPE = 0x519 // 1305 + SYS___FP_CLR_FLAG = 0x51A // 1306 + SYS___FP_READ_FLAG = 0x51B // 1307 + SYS___FP_RAISE_XCP = 0x51C // 1308 + SYS___FP_CLASS = 0x51D // 1309 + SYS___FP_FINITE = 0x51E // 1310 + SYS___FP_ISNAN = 0x51F // 1311 + SYS___FP_UNORDERED = 0x520 // 1312 + SYS___FP_READ_RND = 0x521 // 1313 + SYS___FP_READ_RND_B = 0x522 // 1314 + SYS___FP_SWAP_RND = 0x523 // 1315 + SYS___FP_SWAP_RND_B = 0x524 // 1316 + SYS___FP_LEVEL = 0x525 // 1317 + SYS___FP_BTOH = 0x526 // 1318 + SYS___FP_HTOB = 0x527 // 1319 + SYS___FPC_RD = 0x528 // 1320 + SYS___FPC_WR = 0x529 // 1321 + SYS___FPC_RW = 0x52A // 1322 + SYS___FPC_SM = 0x52B // 1323 + SYS___FPC_RS = 0x52C // 1324 + SYS_SIGTIMEDWAIT = 0x52D // 1325 + SYS_SIGWAITINFO = 0x52E // 1326 + SYS___CHKBFP = 0x52F // 1327 + SYS___W_PIOCTL = 0x59E // 1438 + SYS___OSENV = 0x59F // 1439 + SYS_EXPORTWO = 0x5A1 // 1441 + SYS_EXPORTWORKUNIT = 0x5A1 // 1441 + SYS_UNDOEXPO = 0x5A2 // 1442 + SYS_UNDOEXPORTWORKUNIT = 0x5A2 // 1442 + SYS_IMPORTWO = 0x5A3 // 1443 + SYS_IMPORTWORKUNIT = 0x5A3 // 1443 + SYS_UNDOIMPO = 0x5A4 // 1444 + SYS_UNDOIMPORTWORKUNIT = 0x5A4 // 1444 + SYS_EXTRACTW = 0x5A5 // 1445 + SYS_EXTRACTWORKUNIT = 0x5A5 // 1445 + SYS___CPL = 0x5A6 // 1446 + SYS___MAP_INIT = 0x5A7 // 1447 + SYS___MAP_SERVICE = 0x5A8 // 1448 + SYS_SIGQUEUE = 0x5A9 // 1449 + SYS___MOUNT = 0x5AA // 1450 + SYS___GETUSERID = 0x5AB // 1451 + SYS___IPDOMAINNAME = 0x5AC // 1452 + SYS_QUERYENC = 0x5AD // 1453 + SYS_QUERYWORKUNITCLASSIFICATION = 0x5AD // 1453 + SYS_CONNECTE = 0x5AE // 1454 + SYS_CONNECTEXPORTIMPORT = 0x5AE // 1454 + SYS___FP_SWAPMODE = 0x5AF // 1455 + SYS_STRTOLL = 0x5B0 // 1456 + SYS_STRTOULL = 0x5B1 // 1457 + SYS___DSA_PREV = 0x5B2 // 1458 + SYS___EP_FIND = 0x5B3 // 1459 + SYS___SERVER_THREADS_QUERY = 0x5B4 // 1460 + SYS___MSGRCV_TIMED = 0x5B7 // 1463 + SYS___SEMOP_TIMED = 0x5B8 // 1464 + SYS___GET_CPUID = 0x5B9 // 1465 + SYS___GET_SYSTEM_SETTINGS = 0x5BA // 1466 + SYS_FTELLO = 0x5C8 // 1480 + SYS_FSEEKO = 0x5C9 // 1481 + SYS_LLDIV = 0x5CB // 1483 + SYS_WCSTOLL = 0x5CC // 1484 + SYS_WCSTOULL = 0x5CD // 1485 + SYS_LLABS = 0x5CE // 1486 + SYS___CONSOLE2 = 0x5D2 // 1490 + SYS_INET_NTOP = 0x5D3 // 1491 + SYS_INET_PTON = 0x5D4 // 1492 + SYS___RES = 0x5D6 // 1494 + SYS_RES_MKQUERY = 0x5D7 // 1495 + SYS_RES_INIT = 0x5D8 // 1496 + SYS_RES_QUERY = 0x5D9 // 1497 + SYS_RES_SEARCH = 0x5DA // 1498 + SYS_RES_SEND = 0x5DB // 1499 + SYS_RES_QUERYDOMAIN = 0x5DC // 1500 + SYS_DN_EXPAND = 0x5DD // 1501 + SYS_DN_SKIPNAME = 0x5DE // 1502 + SYS_DN_COMP = 0x5DF // 1503 + SYS_ASCTIME_R = 0x5E0 // 1504 + SYS_CTIME_R = 0x5E1 // 1505 + SYS_GMTIME_R = 0x5E2 // 1506 + SYS_LOCALTIME_R = 0x5E3 // 1507 + SYS_RAND_R = 0x5E4 // 1508 + SYS_STRTOK_R = 0x5E5 // 1509 + SYS_READDIR_R = 0x5E6 // 1510 + SYS_GETGRGID_R = 0x5E7 // 1511 + SYS_GETGRNAM_R = 0x5E8 // 1512 + SYS_GETLOGIN_R = 0x5E9 // 1513 + SYS_GETPWNAM_R = 0x5EA // 1514 + SYS_GETPWUID_R = 0x5EB // 1515 + SYS_TTYNAME_R = 0x5EC // 1516 + SYS_PTHREAD_ATFORK = 0x5ED // 1517 + SYS_PTHREAD_ATTR_GETGUARDSIZE = 0x5EE // 1518 + SYS_PTHREAD_ATTR_GETSTACKADDR = 0x5EF // 1519 + SYS_PTHREAD_ATTR_SETGUARDSIZE = 0x5F0 // 1520 + SYS_PTHREAD_ATTR_SETSTACKADDR = 0x5F1 // 1521 + SYS_PTHREAD_CONDATTR_GETPSHARED = 0x5F2 // 1522 + SYS_PTHREAD_CONDATTR_SETPSHARED = 0x5F3 // 1523 + SYS_PTHREAD_GETCONCURRENCY = 0x5F4 // 1524 + SYS_PTHREAD_KEY_DELETE = 0x5F5 // 1525 + SYS_PTHREAD_SETCONCURRENCY = 0x5F6 // 1526 + SYS_PTHREAD_SIGMASK = 0x5F7 // 1527 + SYS___DISCARDDATA = 0x5F8 // 1528 + SYS_PTHREAD_ATTR_GETSCHEDPARAM = 0x5F9 // 1529 + SYS_PTHREAD_ATTR_SETSCHEDPARAM = 0x5FA // 1530 + SYS_PTHREAD_ATTR_GETDETACHSTATE_U98 = 0x5FB // 1531 + SYS_PTHREAD_ATTR_SETDETACHSTATE_U98 = 0x5FC // 1532 + SYS_PTHREAD_DETACH_U98 = 0x5FD // 1533 + SYS_PTHREAD_GETSPECIFIC_U98 = 0x5FE // 1534 + SYS_PTHREAD_SETCANCELSTATE = 0x5FF // 1535 + SYS_PTHREAD_SETCANCELTYPE = 0x600 // 1536 + SYS_PTHREAD_TESTCANCEL = 0x601 // 1537 + SYS___ATANF_B = 0x602 // 1538 + SYS___ATANL_B = 0x603 // 1539 + SYS___CEILF_B = 0x604 // 1540 + SYS___CEILL_B = 0x605 // 1541 + SYS___COSF_B = 0x606 // 1542 + SYS___COSL_B = 0x607 // 1543 + SYS___FABSF_B = 0x608 // 1544 + SYS___FABSL_B = 0x609 // 1545 + SYS___FLOORF_B = 0x60A // 1546 + SYS___FLOORL_B = 0x60B // 1547 + SYS___FREXPF_B = 0x60C // 1548 + SYS___FREXPL_B = 0x60D // 1549 + SYS___LDEXPF_B = 0x60E // 1550 + SYS___LDEXPL_B = 0x60F // 1551 + SYS___SINF_B = 0x610 // 1552 + SYS___SINL_B = 0x611 // 1553 + SYS___TANF_B = 0x612 // 1554 + SYS___TANL_B = 0x613 // 1555 + SYS___TANHF_B = 0x614 // 1556 + SYS___TANHL_B = 0x615 // 1557 + SYS___ACOSF_B = 0x616 // 1558 + SYS___ACOSL_B = 0x617 // 1559 + SYS___ASINF_B = 0x618 // 1560 + SYS___ASINL_B = 0x619 // 1561 + SYS___ATAN2F_B = 0x61A // 1562 + SYS___ATAN2L_B = 0x61B // 1563 + SYS___COSHF_B = 0x61C // 1564 + SYS___COSHL_B = 0x61D // 1565 + SYS___EXPF_B = 0x61E // 1566 + SYS___EXPL_B = 0x61F // 1567 + SYS___LOGF_B = 0x620 // 1568 + SYS___LOGL_B = 0x621 // 1569 + SYS___LOG10F_B = 0x622 // 1570 + SYS___LOG10L_B = 0x623 // 1571 + SYS___POWF_B = 0x624 // 1572 + SYS___POWL_B = 0x625 // 1573 + SYS___SINHF_B = 0x626 // 1574 + SYS___SINHL_B = 0x627 // 1575 + SYS___SQRTF_B = 0x628 // 1576 + SYS___SQRTL_B = 0x629 // 1577 + SYS___ABSF_B = 0x62A // 1578 + SYS___ABS_B = 0x62B // 1579 + SYS___ABSL_B = 0x62C // 1580 + SYS___FMODF_B = 0x62D // 1581 + SYS___FMODL_B = 0x62E // 1582 + SYS___MODFF_B = 0x62F // 1583 + SYS___MODFL_B = 0x630 // 1584 + SYS_ABSF = 0x631 // 1585 + SYS_ABSL = 0x632 // 1586 + SYS_ACOSF = 0x633 // 1587 + SYS_ACOSL = 0x634 // 1588 + SYS_ASINF = 0x635 // 1589 + SYS_ASINL = 0x636 // 1590 + SYS_ATAN2F = 0x637 // 1591 + SYS_ATAN2L = 0x638 // 1592 + SYS_ATANF = 0x639 // 1593 + SYS_ATANL = 0x63A // 1594 + SYS_CEILF = 0x63B // 1595 + SYS_CEILL = 0x63C // 1596 + SYS_COSF = 0x63D // 1597 + SYS_COSL = 0x63E // 1598 + SYS_COSHF = 0x63F // 1599 + SYS_COSHL = 0x640 // 1600 + SYS_EXPF = 0x641 // 1601 + SYS_EXPL = 0x642 // 1602 + SYS_TANHF = 0x643 // 1603 + SYS_TANHL = 0x644 // 1604 + SYS_LOG10F = 0x645 // 1605 + SYS_LOG10L = 0x646 // 1606 + SYS_LOGF = 0x647 // 1607 + SYS_LOGL = 0x648 // 1608 + SYS_POWF = 0x649 // 1609 + SYS_POWL = 0x64A // 1610 + SYS_SINF = 0x64B // 1611 + SYS_SINL = 0x64C // 1612 + SYS_SQRTF = 0x64D // 1613 + SYS_SQRTL = 0x64E // 1614 + SYS_SINHF = 0x64F // 1615 + SYS_SINHL = 0x650 // 1616 + SYS_TANF = 0x651 // 1617 + SYS_TANL = 0x652 // 1618 + SYS_FABSF = 0x653 // 1619 + SYS_FABSL = 0x654 // 1620 + SYS_FLOORF = 0x655 // 1621 + SYS_FLOORL = 0x656 // 1622 + SYS_FMODF = 0x657 // 1623 + SYS_FMODL = 0x658 // 1624 + SYS_FREXPF = 0x659 // 1625 + SYS_FREXPL = 0x65A // 1626 + SYS_LDEXPF = 0x65B // 1627 + SYS_LDEXPL = 0x65C // 1628 + SYS_MODFF = 0x65D // 1629 + SYS_MODFL = 0x65E // 1630 + SYS_BTOWC = 0x65F // 1631 + SYS___CHATTR = 0x660 // 1632 + SYS___FCHATTR = 0x661 // 1633 + SYS___TOCCSID = 0x662 // 1634 + SYS___CSNAMETYPE = 0x663 // 1635 + SYS___TOCSNAME = 0x664 // 1636 + SYS___CCSIDTYPE = 0x665 // 1637 + SYS___AE_CORRESTBL_QUERY = 0x666 // 1638 + SYS___AE_AUTOCONVERT_STATE = 0x667 // 1639 + SYS_DN_FIND = 0x668 // 1640 + SYS___GETHOSTBYADDR_A = 0x669 // 1641 + SYS___GETHOSTBYNAME_A = 0x66A // 1642 + SYS___RES_INIT_A = 0x66B // 1643 + SYS___GETHOSTBYADDR_R_A = 0x66C // 1644 + SYS___GETHOSTBYNAME_R_A = 0x66D // 1645 + SYS___CHARMAP_INIT_A = 0x66E // 1646 + SYS___MBLEN_A = 0x66F // 1647 + SYS___MBLEN_SB_A = 0x670 // 1648 + SYS___MBLEN_STD_A = 0x671 // 1649 + SYS___MBLEN_UTF = 0x672 // 1650 + SYS___MBSTOWCS_A = 0x673 // 1651 + SYS___MBSTOWCS_STD_A = 0x674 // 1652 + SYS___MBTOWC_A = 0x675 // 1653 + SYS___MBTOWC_ISO1 = 0x676 // 1654 + SYS___MBTOWC_SBCS = 0x677 // 1655 + SYS___MBTOWC_MBCS = 0x678 // 1656 + SYS___MBTOWC_UTF = 0x679 // 1657 + SYS___WCSTOMBS_A = 0x67A // 1658 + SYS___WCSTOMBS_STD_A = 0x67B // 1659 + SYS___WCSWIDTH_A = 0x67C // 1660 + SYS___GETGRGID_R_A = 0x67D // 1661 + SYS___WCSWIDTH_STD_A = 0x67E // 1662 + SYS___WCSWIDTH_ASIA = 0x67F // 1663 + SYS___CSID_A = 0x680 // 1664 + SYS___CSID_STD_A = 0x681 // 1665 + SYS___WCSID_A = 0x682 // 1666 + SYS___WCSID_STD_A = 0x683 // 1667 + SYS___WCTOMB_A = 0x684 // 1668 + SYS___WCTOMB_ISO1 = 0x685 // 1669 + SYS___WCTOMB_STD_A = 0x686 // 1670 + SYS___WCTOMB_UTF = 0x687 // 1671 + SYS___WCWIDTH_A = 0x688 // 1672 + SYS___GETGRNAM_R_A = 0x689 // 1673 + SYS___WCWIDTH_STD_A = 0x68A // 1674 + SYS___WCWIDTH_ASIA = 0x68B // 1675 + SYS___GETPWNAM_R_A = 0x68C // 1676 + SYS___GETPWUID_R_A = 0x68D // 1677 + SYS___GETLOGIN_R_A = 0x68E // 1678 + SYS___TTYNAME_R_A = 0x68F // 1679 + SYS___READDIR_R_A = 0x690 // 1680 + SYS___E2A_S = 0x691 // 1681 + SYS___FNMATCH_A = 0x692 // 1682 + SYS___FNMATCH_C_A = 0x693 // 1683 + SYS___EXECL_A = 0x694 // 1684 + SYS___FNMATCH_STD_A = 0x695 // 1685 + SYS___REGCOMP_A = 0x696 // 1686 + SYS___REGCOMP_STD_A = 0x697 // 1687 + SYS___REGERROR_A = 0x698 // 1688 + SYS___REGERROR_STD_A = 0x699 // 1689 + SYS___REGEXEC_A = 0x69A // 1690 + SYS___REGEXEC_STD_A = 0x69B // 1691 + SYS___REGFREE_A = 0x69C // 1692 + SYS___REGFREE_STD_A = 0x69D // 1693 + SYS___STRCOLL_A = 0x69E // 1694 + SYS___STRCOLL_C_A = 0x69F // 1695 + SYS___EXECLE_A = 0x6A0 // 1696 + SYS___STRCOLL_STD_A = 0x6A1 // 1697 + SYS___STRXFRM_A = 0x6A2 // 1698 + SYS___STRXFRM_C_A = 0x6A3 // 1699 + SYS___EXECLP_A = 0x6A4 // 1700 + SYS___STRXFRM_STD_A = 0x6A5 // 1701 + SYS___WCSCOLL_A = 0x6A6 // 1702 + SYS___WCSCOLL_C_A = 0x6A7 // 1703 + SYS___WCSCOLL_STD_A = 0x6A8 // 1704 + SYS___WCSXFRM_A = 0x6A9 // 1705 + SYS___WCSXFRM_C_A = 0x6AA // 1706 + SYS___WCSXFRM_STD_A = 0x6AB // 1707 + SYS___COLLATE_INIT_A = 0x6AC // 1708 + SYS___WCTYPE_A = 0x6AD // 1709 + SYS___GET_WCTYPE_STD_A = 0x6AE // 1710 + SYS___CTYPE_INIT_A = 0x6AF // 1711 + SYS___ISWCTYPE_A = 0x6B0 // 1712 + SYS___EXECV_A = 0x6B1 // 1713 + SYS___IS_WCTYPE_STD_A = 0x6B2 // 1714 + SYS___TOWLOWER_A = 0x6B3 // 1715 + SYS___TOWLOWER_STD_A = 0x6B4 // 1716 + SYS___TOWUPPER_A = 0x6B5 // 1717 + SYS___TOWUPPER_STD_A = 0x6B6 // 1718 + SYS___LOCALE_INIT_A = 0x6B7 // 1719 + SYS___LOCALECONV_A = 0x6B8 // 1720 + SYS___LOCALECONV_STD_A = 0x6B9 // 1721 + SYS___NL_LANGINFO_A = 0x6BA // 1722 + SYS___NL_LNAGINFO_STD_A = 0x6BB // 1723 + SYS___MONETARY_INIT_A = 0x6BC // 1724 + SYS___STRFMON_A = 0x6BD // 1725 + SYS___STRFMON_STD_A = 0x6BE // 1726 + SYS___GETADDRINFO_A = 0x6BF // 1727 + SYS___CATGETS_A = 0x6C0 // 1728 + SYS___EXECVE_A = 0x6C1 // 1729 + SYS___EXECVP_A = 0x6C2 // 1730 + SYS___SPAWN_A = 0x6C3 // 1731 + SYS___GETNAMEINFO_A = 0x6C4 // 1732 + SYS___SPAWNP_A = 0x6C5 // 1733 + SYS___NUMERIC_INIT_A = 0x6C6 // 1734 + SYS___RESP_INIT_A = 0x6C7 // 1735 + SYS___RPMATCH_A = 0x6C8 // 1736 + SYS___RPMATCH_C_A = 0x6C9 // 1737 + SYS___RPMATCH_STD_A = 0x6CA // 1738 + SYS___TIME_INIT_A = 0x6CB // 1739 + SYS___STRFTIME_A = 0x6CC // 1740 + SYS___STRFTIME_STD_A = 0x6CD // 1741 + SYS___STRPTIME_A = 0x6CE // 1742 + SYS___STRPTIME_STD_A = 0x6CF // 1743 + SYS___WCSFTIME_A = 0x6D0 // 1744 + SYS___WCSFTIME_STD_A = 0x6D1 // 1745 + SYS_____SPAWN2_A = 0x6D2 // 1746 + SYS_____SPAWNP2_A = 0x6D3 // 1747 + SYS___SYNTAX_INIT_A = 0x6D4 // 1748 + SYS___TOD_INIT_A = 0x6D5 // 1749 + SYS___NL_CSINFO_A = 0x6D6 // 1750 + SYS___NL_MONINFO_A = 0x6D7 // 1751 + SYS___NL_NUMINFO_A = 0x6D8 // 1752 + SYS___NL_RESPINFO_A = 0x6D9 // 1753 + SYS___NL_TIMINFO_A = 0x6DA // 1754 + SYS___IF_NAMETOINDEX_A = 0x6DB // 1755 + SYS___IF_INDEXTONAME_A = 0x6DC // 1756 + SYS___PRINTF_A = 0x6DD // 1757 + SYS___ICONV_OPEN_A = 0x6DE // 1758 + SYS___DLLLOAD_A = 0x6DF // 1759 + SYS___DLLQUERYFN_A = 0x6E0 // 1760 + SYS___DLLQUERYVAR_A = 0x6E1 // 1761 + SYS_____CHATTR_A = 0x6E2 // 1762 + SYS___E2A_L = 0x6E3 // 1763 + SYS_____TOCCSID_A = 0x6E4 // 1764 + SYS_____TOCSNAME_A = 0x6E5 // 1765 + SYS_____CCSIDTYPE_A = 0x6E6 // 1766 + SYS_____CSNAMETYPE_A = 0x6E7 // 1767 + SYS___CHMOD_A = 0x6E8 // 1768 + SYS___MKDIR_A = 0x6E9 // 1769 + SYS___STAT_A = 0x6EA // 1770 + SYS___STAT_O_A = 0x6EB // 1771 + SYS___MKFIFO_A = 0x6EC // 1772 + SYS_____OPEN_STAT_A = 0x6ED // 1773 + SYS___LSTAT_A = 0x6EE // 1774 + SYS___LSTAT_O_A = 0x6EF // 1775 + SYS___MKNOD_A = 0x6F0 // 1776 + SYS___MOUNT_A = 0x6F1 // 1777 + SYS___UMOUNT_A = 0x6F2 // 1778 + SYS___CHAUDIT_A = 0x6F4 // 1780 + SYS___W_GETMNTENT_A = 0x6F5 // 1781 + SYS___CREAT_A = 0x6F6 // 1782 + SYS___OPEN_A = 0x6F7 // 1783 + SYS___SETLOCALE_A = 0x6F9 // 1785 + SYS___FPRINTF_A = 0x6FA // 1786 + SYS___SPRINTF_A = 0x6FB // 1787 + SYS___VFPRINTF_A = 0x6FC // 1788 + SYS___VPRINTF_A = 0x6FD // 1789 + SYS___VSPRINTF_A = 0x6FE // 1790 + SYS___VSWPRINTF_A = 0x6FF // 1791 + SYS___SWPRINTF_A = 0x700 // 1792 + SYS___FSCANF_A = 0x701 // 1793 + SYS___SCANF_A = 0x702 // 1794 + SYS___SSCANF_A = 0x703 // 1795 + SYS___SWSCANF_A = 0x704 // 1796 + SYS___ATOF_A = 0x705 // 1797 + SYS___ATOI_A = 0x706 // 1798 + SYS___ATOL_A = 0x707 // 1799 + SYS___STRTOD_A = 0x708 // 1800 + SYS___STRTOL_A = 0x709 // 1801 + SYS___STRTOUL_A = 0x70A // 1802 + SYS_____AE_CORRESTBL_QUERY_A = 0x70B // 1803 + SYS___A64L_A = 0x70C // 1804 + SYS___ECVT_A = 0x70D // 1805 + SYS___FCVT_A = 0x70E // 1806 + SYS___GCVT_A = 0x70F // 1807 + SYS___L64A_A = 0x710 // 1808 + SYS___STRERROR_A = 0x711 // 1809 + SYS___PERROR_A = 0x712 // 1810 + SYS___FETCH_A = 0x713 // 1811 + SYS___GETENV_A = 0x714 // 1812 + SYS___MKSTEMP_A = 0x717 // 1815 + SYS___PTSNAME_A = 0x718 // 1816 + SYS___PUTENV_A = 0x719 // 1817 + SYS___REALPATH_A = 0x71A // 1818 + SYS___SETENV_A = 0x71B // 1819 + SYS___SYSTEM_A = 0x71C // 1820 + SYS___GETOPT_A = 0x71D // 1821 + SYS___CATOPEN_A = 0x71E // 1822 + SYS___ACCESS_A = 0x71F // 1823 + SYS___CHDIR_A = 0x720 // 1824 + SYS___CHOWN_A = 0x721 // 1825 + SYS___CHROOT_A = 0x722 // 1826 + SYS___GETCWD_A = 0x723 // 1827 + SYS___GETWD_A = 0x724 // 1828 + SYS___LCHOWN_A = 0x725 // 1829 + SYS___LINK_A = 0x726 // 1830 + SYS___PATHCONF_A = 0x727 // 1831 + SYS___IF_NAMEINDEX_A = 0x728 // 1832 + SYS___READLINK_A = 0x729 // 1833 + SYS___RMDIR_A = 0x72A // 1834 + SYS___STATVFS_A = 0x72B // 1835 + SYS___SYMLINK_A = 0x72C // 1836 + SYS___TRUNCATE_A = 0x72D // 1837 + SYS___UNLINK_A = 0x72E // 1838 + SYS___GAI_STRERROR_A = 0x72F // 1839 + SYS___EXTLINK_NP_A = 0x730 // 1840 + SYS___ISALNUM_A = 0x731 // 1841 + SYS___ISALPHA_A = 0x732 // 1842 + SYS___A2E_S = 0x733 // 1843 + SYS___ISCNTRL_A = 0x734 // 1844 + SYS___ISDIGIT_A = 0x735 // 1845 + SYS___ISGRAPH_A = 0x736 // 1846 + SYS___ISLOWER_A = 0x737 // 1847 + SYS___ISPRINT_A = 0x738 // 1848 + SYS___ISPUNCT_A = 0x739 // 1849 + SYS___ISSPACE_A = 0x73A // 1850 + SYS___ISUPPER_A = 0x73B // 1851 + SYS___ISXDIGIT_A = 0x73C // 1852 + SYS___TOLOWER_A = 0x73D // 1853 + SYS___TOUPPER_A = 0x73E // 1854 + SYS___ISWALNUM_A = 0x73F // 1855 + SYS___ISWALPHA_A = 0x740 // 1856 + SYS___A2E_L = 0x741 // 1857 + SYS___ISWCNTRL_A = 0x742 // 1858 + SYS___ISWDIGIT_A = 0x743 // 1859 + SYS___ISWGRAPH_A = 0x744 // 1860 + SYS___ISWLOWER_A = 0x745 // 1861 + SYS___ISWPRINT_A = 0x746 // 1862 + SYS___ISWPUNCT_A = 0x747 // 1863 + SYS___ISWSPACE_A = 0x748 // 1864 + SYS___ISWUPPER_A = 0x749 // 1865 + SYS___ISWXDIGIT_A = 0x74A // 1866 + SYS___CONFSTR_A = 0x74B // 1867 + SYS___FTOK_A = 0x74C // 1868 + SYS___MKTEMP_A = 0x74D // 1869 + SYS___FDOPEN_A = 0x74E // 1870 + SYS___FLDATA_A = 0x74F // 1871 + SYS___REMOVE_A = 0x750 // 1872 + SYS___RENAME_A = 0x751 // 1873 + SYS___TMPNAM_A = 0x752 // 1874 + SYS___FOPEN_A = 0x753 // 1875 + SYS___FREOPEN_A = 0x754 // 1876 + SYS___CUSERID_A = 0x755 // 1877 + SYS___POPEN_A = 0x756 // 1878 + SYS___TEMPNAM_A = 0x757 // 1879 + SYS___FTW_A = 0x758 // 1880 + SYS___GETGRENT_A = 0x759 // 1881 + SYS___GETGRGID_A = 0x75A // 1882 + SYS___GETGRNAM_A = 0x75B // 1883 + SYS___GETGROUPSBYNAME_A = 0x75C // 1884 + SYS___GETHOSTENT_A = 0x75D // 1885 + SYS___GETHOSTNAME_A = 0x75E // 1886 + SYS___GETLOGIN_A = 0x75F // 1887 + SYS___INET_NTOP_A = 0x760 // 1888 + SYS___GETPASS_A = 0x761 // 1889 + SYS___GETPWENT_A = 0x762 // 1890 + SYS___GETPWNAM_A = 0x763 // 1891 + SYS___GETPWUID_A = 0x764 // 1892 + SYS_____CHECK_RESOURCE_AUTH_NP_A = 0x765 // 1893 + SYS___CHECKSCHENV_A = 0x766 // 1894 + SYS___CONNECTSERVER_A = 0x767 // 1895 + SYS___CONNECTWORKMGR_A = 0x768 // 1896 + SYS_____CONSOLE_A = 0x769 // 1897 + SYS___CREATEWORKUNIT_A = 0x76A // 1898 + SYS___CTERMID_A = 0x76B // 1899 + SYS___FMTMSG_A = 0x76C // 1900 + SYS___INITGROUPS_A = 0x76D // 1901 + SYS_____LOGIN_A = 0x76E // 1902 + SYS___MSGRCV_A = 0x76F // 1903 + SYS___MSGSND_A = 0x770 // 1904 + SYS___MSGXRCV_A = 0x771 // 1905 + SYS___NFTW_A = 0x772 // 1906 + SYS_____PASSWD_A = 0x773 // 1907 + SYS___PTHREAD_SECURITY_NP_A = 0x774 // 1908 + SYS___QUERYMETRICS_A = 0x775 // 1909 + SYS___QUERYSCHENV = 0x776 // 1910 + SYS___READV_A = 0x777 // 1911 + SYS_____SERVER_CLASSIFY_A = 0x778 // 1912 + SYS_____SERVER_INIT_A = 0x779 // 1913 + SYS_____SERVER_PWU_A = 0x77A // 1914 + SYS___STRCASECMP_A = 0x77B // 1915 + SYS___STRNCASECMP_A = 0x77C // 1916 + SYS___TTYNAME_A = 0x77D // 1917 + SYS___UNAME_A = 0x77E // 1918 + SYS___UTIMES_A = 0x77F // 1919 + SYS___W_GETPSENT_A = 0x780 // 1920 + SYS___WRITEV_A = 0x781 // 1921 + SYS___W_STATFS_A = 0x782 // 1922 + SYS___W_STATVFS_A = 0x783 // 1923 + SYS___FPUTC_A = 0x784 // 1924 + SYS___PUTCHAR_A = 0x785 // 1925 + SYS___PUTS_A = 0x786 // 1926 + SYS___FGETS_A = 0x787 // 1927 + SYS___GETS_A = 0x788 // 1928 + SYS___FPUTS_A = 0x789 // 1929 + SYS___FREAD_A = 0x78A // 1930 + SYS___FWRITE_A = 0x78B // 1931 + SYS___OPEN_O_A = 0x78C // 1932 + SYS___ISASCII = 0x78D // 1933 + SYS___CREAT_O_A = 0x78E // 1934 + SYS___ENVNA = 0x78F // 1935 + SYS___PUTC_A = 0x790 // 1936 + SYS___AE_THREAD_SETMODE = 0x791 // 1937 + SYS___AE_THREAD_SWAPMODE = 0x792 // 1938 + SYS___GETNETBYADDR_A = 0x793 // 1939 + SYS___GETNETBYNAME_A = 0x794 // 1940 + SYS___GETNETENT_A = 0x795 // 1941 + SYS___GETPROTOBYNAME_A = 0x796 // 1942 + SYS___GETPROTOBYNUMBER_A = 0x797 // 1943 + SYS___GETPROTOENT_A = 0x798 // 1944 + SYS___GETSERVBYNAME_A = 0x799 // 1945 + SYS___GETSERVBYPORT_A = 0x79A // 1946 + SYS___GETSERVENT_A = 0x79B // 1947 + SYS___ASCTIME_A = 0x79C // 1948 + SYS___CTIME_A = 0x79D // 1949 + SYS___GETDATE_A = 0x79E // 1950 + SYS___TZSET_A = 0x79F // 1951 + SYS___UTIME_A = 0x7A0 // 1952 + SYS___ASCTIME_R_A = 0x7A1 // 1953 + SYS___CTIME_R_A = 0x7A2 // 1954 + SYS___STRTOLL_A = 0x7A3 // 1955 + SYS___STRTOULL_A = 0x7A4 // 1956 + SYS___FPUTWC_A = 0x7A5 // 1957 + SYS___PUTWC_A = 0x7A6 // 1958 + SYS___PUTWCHAR_A = 0x7A7 // 1959 + SYS___FPUTWS_A = 0x7A8 // 1960 + SYS___UNGETWC_A = 0x7A9 // 1961 + SYS___FGETWC_A = 0x7AA // 1962 + SYS___GETWC_A = 0x7AB // 1963 + SYS___GETWCHAR_A = 0x7AC // 1964 + SYS___FGETWS_A = 0x7AD // 1965 + SYS___GETTIMEOFDAY_A = 0x7AE // 1966 + SYS___GMTIME_A = 0x7AF // 1967 + SYS___GMTIME_R_A = 0x7B0 // 1968 + SYS___LOCALTIME_A = 0x7B1 // 1969 + SYS___LOCALTIME_R_A = 0x7B2 // 1970 + SYS___MKTIME_A = 0x7B3 // 1971 + SYS___TZZNA = 0x7B4 // 1972 + SYS_UNATEXIT = 0x7B5 // 1973 + SYS___CEE3DMP_A = 0x7B6 // 1974 + SYS___CDUMP_A = 0x7B7 // 1975 + SYS___CSNAP_A = 0x7B8 // 1976 + SYS___CTEST_A = 0x7B9 // 1977 + SYS___CTRACE_A = 0x7BA // 1978 + SYS___VSWPRNTF2_A = 0x7BB // 1979 + SYS___INET_PTON_A = 0x7BC // 1980 + SYS___SYSLOG_A = 0x7BD // 1981 + SYS___CRYPT_A = 0x7BE // 1982 + SYS_____OPENDIR2_A = 0x7BF // 1983 + SYS_____READDIR2_A = 0x7C0 // 1984 + SYS___OPENDIR_A = 0x7C2 // 1986 + SYS___READDIR_A = 0x7C3 // 1987 + SYS_PREAD = 0x7C7 // 1991 + SYS_PWRITE = 0x7C8 // 1992 + SYS_M_CREATE_LAYOUT = 0x7C9 // 1993 + SYS_M_DESTROY_LAYOUT = 0x7CA // 1994 + SYS_M_GETVALUES_LAYOUT = 0x7CB // 1995 + SYS_M_SETVALUES_LAYOUT = 0x7CC // 1996 + SYS_M_TRANSFORM_LAYOUT = 0x7CD // 1997 + SYS_M_WTRANSFORM_LAYOUT = 0x7CE // 1998 + SYS_FWPRINTF = 0x7D1 // 2001 + SYS_WPRINTF = 0x7D2 // 2002 + SYS_VFWPRINT = 0x7D3 // 2003 + SYS_VFWPRINTF = 0x7D3 // 2003 + SYS_VWPRINTF = 0x7D4 // 2004 + SYS_FWSCANF = 0x7D5 // 2005 + SYS_WSCANF = 0x7D6 // 2006 + SYS_WCTRANS = 0x7D7 // 2007 + SYS_TOWCTRAN = 0x7D8 // 2008 + SYS_TOWCTRANS = 0x7D8 // 2008 + SYS___WCSTOD_A = 0x7D9 // 2009 + SYS___WCSTOL_A = 0x7DA // 2010 + SYS___WCSTOUL_A = 0x7DB // 2011 + SYS___BASENAME_A = 0x7DC // 2012 + SYS___DIRNAME_A = 0x7DD // 2013 + SYS___GLOB_A = 0x7DE // 2014 + SYS_FWIDE = 0x7DF // 2015 + SYS___OSNAME = 0x7E0 // 2016 + SYS_____OSNAME_A = 0x7E1 // 2017 + SYS___BTOWC_A = 0x7E4 // 2020 + SYS___WCTOB_A = 0x7E5 // 2021 + SYS___DBM_OPEN_A = 0x7E6 // 2022 + SYS___VFPRINTF2_A = 0x7E7 // 2023 + SYS___VPRINTF2_A = 0x7E8 // 2024 + SYS___VSPRINTF2_A = 0x7E9 // 2025 + SYS___CEIL_H = 0x7EA // 2026 + SYS___FLOOR_H = 0x7EB // 2027 + SYS___MODF_H = 0x7EC // 2028 + SYS___FABS_H = 0x7ED // 2029 + SYS___J0_H = 0x7EE // 2030 + SYS___J1_H = 0x7EF // 2031 + SYS___JN_H = 0x7F0 // 2032 + SYS___Y0_H = 0x7F1 // 2033 + SYS___Y1_H = 0x7F2 // 2034 + SYS___YN_H = 0x7F3 // 2035 + SYS___CEILF_H = 0x7F4 // 2036 + SYS___CEILL_H = 0x7F5 // 2037 + SYS___FLOORF_H = 0x7F6 // 2038 + SYS___FLOORL_H = 0x7F7 // 2039 + SYS___MODFF_H = 0x7F8 // 2040 + SYS___MODFL_H = 0x7F9 // 2041 + SYS___FABSF_H = 0x7FA // 2042 + SYS___FABSL_H = 0x7FB // 2043 + SYS___MALLOC24 = 0x7FC // 2044 + SYS___MALLOC31 = 0x7FD // 2045 + SYS_ACL_INIT = 0x7FE // 2046 + SYS_ACL_FREE = 0x7FF // 2047 + SYS_ACL_FIRST_ENTRY = 0x800 // 2048 + SYS_ACL_GET_ENTRY = 0x801 // 2049 + SYS_ACL_VALID = 0x802 // 2050 + SYS_ACL_CREATE_ENTRY = 0x803 // 2051 + SYS_ACL_DELETE_ENTRY = 0x804 // 2052 + SYS_ACL_UPDATE_ENTRY = 0x805 // 2053 + SYS_ACL_DELETE_FD = 0x806 // 2054 + SYS_ACL_DELETE_FILE = 0x807 // 2055 + SYS_ACL_GET_FD = 0x808 // 2056 + SYS_ACL_GET_FILE = 0x809 // 2057 + SYS_ACL_SET_FD = 0x80A // 2058 + SYS_ACL_SET_FILE = 0x80B // 2059 + SYS_ACL_FROM_TEXT = 0x80C // 2060 + SYS_ACL_TO_TEXT = 0x80D // 2061 + SYS_ACL_SORT = 0x80E // 2062 + SYS___SHUTDOWN_REGISTRATION = 0x80F // 2063 + SYS___ERFL_B = 0x810 // 2064 + SYS___ERFCL_B = 0x811 // 2065 + SYS___LGAMMAL_B = 0x812 // 2066 + SYS___SETHOOKEVENTS = 0x813 // 2067 + SYS_IF_NAMETOINDEX = 0x814 // 2068 + SYS_IF_INDEXTONAME = 0x815 // 2069 + SYS_IF_NAMEINDEX = 0x816 // 2070 + SYS_IF_FREENAMEINDEX = 0x817 // 2071 + SYS_GETADDRINFO = 0x818 // 2072 + SYS_GETNAMEINFO = 0x819 // 2073 + SYS_FREEADDRINFO = 0x81A // 2074 + SYS_GAI_STRERROR = 0x81B // 2075 + SYS_REXEC_AF = 0x81C // 2076 + SYS___POE = 0x81D // 2077 + SYS___DYNALLOC_A = 0x81F // 2079 + SYS___DYNFREE_A = 0x820 // 2080 + SYS___RES_QUERY_A = 0x821 // 2081 + SYS___RES_SEARCH_A = 0x822 // 2082 + SYS___RES_QUERYDOMAIN_A = 0x823 // 2083 + SYS___RES_MKQUERY_A = 0x824 // 2084 + SYS___RES_SEND_A = 0x825 // 2085 + SYS___DN_EXPAND_A = 0x826 // 2086 + SYS___DN_SKIPNAME_A = 0x827 // 2087 + SYS___DN_COMP_A = 0x828 // 2088 + SYS___DN_FIND_A = 0x829 // 2089 + SYS___NLIST_A = 0x82A // 2090 + SYS_____TCGETCP_A = 0x82B // 2091 + SYS_____TCSETCP_A = 0x82C // 2092 + SYS_____W_PIOCTL_A = 0x82E // 2094 + SYS___INET_ADDR_A = 0x82F // 2095 + SYS___INET_NTOA_A = 0x830 // 2096 + SYS___INET_NETWORK_A = 0x831 // 2097 + SYS___ACCEPT_A = 0x832 // 2098 + SYS___ACCEPT_AND_RECV_A = 0x833 // 2099 + SYS___BIND_A = 0x834 // 2100 + SYS___CONNECT_A = 0x835 // 2101 + SYS___GETPEERNAME_A = 0x836 // 2102 + SYS___GETSOCKNAME_A = 0x837 // 2103 + SYS___RECVFROM_A = 0x838 // 2104 + SYS___SENDTO_A = 0x839 // 2105 + SYS___SENDMSG_A = 0x83A // 2106 + SYS___RECVMSG_A = 0x83B // 2107 + SYS_____LCHATTR_A = 0x83C // 2108 + SYS___CABEND = 0x83D // 2109 + SYS___LE_CIB_GET = 0x83E // 2110 + SYS___SET_LAA_FOR_JIT = 0x83F // 2111 + SYS___LCHATTR = 0x840 // 2112 + SYS___WRITEDOWN = 0x841 // 2113 + SYS_PTHREAD_MUTEX_INIT2 = 0x842 // 2114 + SYS___ACOSHF_B = 0x843 // 2115 + SYS___ACOSHL_B = 0x844 // 2116 + SYS___ASINHF_B = 0x845 // 2117 + SYS___ASINHL_B = 0x846 // 2118 + SYS___ATANHF_B = 0x847 // 2119 + SYS___ATANHL_B = 0x848 // 2120 + SYS___CBRTF_B = 0x849 // 2121 + SYS___CBRTL_B = 0x84A // 2122 + SYS___COPYSIGNF_B = 0x84B // 2123 + SYS___COPYSIGNL_B = 0x84C // 2124 + SYS___COTANF_B = 0x84D // 2125 + SYS___COTAN_B = 0x84E // 2126 + SYS___COTANL_B = 0x84F // 2127 + SYS___EXP2F_B = 0x850 // 2128 + SYS___EXP2L_B = 0x851 // 2129 + SYS___EXPM1F_B = 0x852 // 2130 + SYS___EXPM1L_B = 0x853 // 2131 + SYS___FDIMF_B = 0x854 // 2132 + SYS___FDIM_B = 0x855 // 2133 + SYS___FDIML_B = 0x856 // 2134 + SYS___HYPOTF_B = 0x857 // 2135 + SYS___HYPOTL_B = 0x858 // 2136 + SYS___LOG1PF_B = 0x859 // 2137 + SYS___LOG1PL_B = 0x85A // 2138 + SYS___LOG2F_B = 0x85B // 2139 + SYS___LOG2_B = 0x85C // 2140 + SYS___LOG2L_B = 0x85D // 2141 + SYS___REMAINDERF_B = 0x85E // 2142 + SYS___REMAINDERL_B = 0x85F // 2143 + SYS___REMQUOF_B = 0x860 // 2144 + SYS___REMQUO_B = 0x861 // 2145 + SYS___REMQUOL_B = 0x862 // 2146 + SYS___TGAMMAF_B = 0x863 // 2147 + SYS___TGAMMA_B = 0x864 // 2148 + SYS___TGAMMAL_B = 0x865 // 2149 + SYS___TRUNCF_B = 0x866 // 2150 + SYS___TRUNC_B = 0x867 // 2151 + SYS___TRUNCL_B = 0x868 // 2152 + SYS___LGAMMAF_B = 0x869 // 2153 + SYS___LROUNDF_B = 0x86A // 2154 + SYS___LROUND_B = 0x86B // 2155 + SYS___ERFF_B = 0x86C // 2156 + SYS___ERFCF_B = 0x86D // 2157 + SYS_ACOSHF = 0x86E // 2158 + SYS_ACOSHL = 0x86F // 2159 + SYS_ASINHF = 0x870 // 2160 + SYS_ASINHL = 0x871 // 2161 + SYS_ATANHF = 0x872 // 2162 + SYS_ATANHL = 0x873 // 2163 + SYS_CBRTF = 0x874 // 2164 + SYS_CBRTL = 0x875 // 2165 + SYS_COPYSIGNF = 0x876 // 2166 + SYS_CPYSIGNF = 0x876 // 2166 + SYS_COPYSIGNL = 0x877 // 2167 + SYS_CPYSIGNL = 0x877 // 2167 + SYS_COTANF = 0x878 // 2168 + SYS___COTANF = 0x878 // 2168 + SYS_COTAN = 0x879 // 2169 + SYS___COTAN = 0x879 // 2169 + SYS_COTANL = 0x87A // 2170 + SYS___COTANL = 0x87A // 2170 + SYS_EXP2F = 0x87B // 2171 + SYS_EXP2L = 0x87C // 2172 + SYS_EXPM1F = 0x87D // 2173 + SYS_EXPM1L = 0x87E // 2174 + SYS_FDIMF = 0x87F // 2175 + SYS_FDIM = 0x881 // 2177 + SYS_FDIML = 0x882 // 2178 + SYS_HYPOTF = 0x883 // 2179 + SYS_HYPOTL = 0x884 // 2180 + SYS_LOG1PF = 0x885 // 2181 + SYS_LOG1PL = 0x886 // 2182 + SYS_LOG2F = 0x887 // 2183 + SYS_LOG2 = 0x888 // 2184 + SYS_LOG2L = 0x889 // 2185 + SYS_REMAINDERF = 0x88A // 2186 + SYS_REMAINDF = 0x88A // 2186 + SYS_REMAINDERL = 0x88B // 2187 + SYS_REMAINDL = 0x88B // 2187 + SYS_REMQUOF = 0x88C // 2188 + SYS_REMQUO = 0x88D // 2189 + SYS_REMQUOL = 0x88E // 2190 + SYS_TGAMMAF = 0x88F // 2191 + SYS_TGAMMA = 0x890 // 2192 + SYS_TGAMMAL = 0x891 // 2193 + SYS_TRUNCF = 0x892 // 2194 + SYS_TRUNC = 0x893 // 2195 + SYS_TRUNCL = 0x894 // 2196 + SYS_LGAMMAF = 0x895 // 2197 + SYS_LGAMMAL = 0x896 // 2198 + SYS_LROUNDF = 0x897 // 2199 + SYS_LROUND = 0x898 // 2200 + SYS_ERFF = 0x899 // 2201 + SYS_ERFL = 0x89A // 2202 + SYS_ERFCF = 0x89B // 2203 + SYS_ERFCL = 0x89C // 2204 + SYS___EXP2_B = 0x89D // 2205 + SYS_EXP2 = 0x89E // 2206 + SYS___FAR_JUMP = 0x89F // 2207 + SYS___TCGETATTR_A = 0x8A1 // 2209 + SYS___TCSETATTR_A = 0x8A2 // 2210 + SYS___SUPERKILL = 0x8A4 // 2212 + SYS___LE_CONDITION_TOKEN_BUILD = 0x8A5 // 2213 + SYS___LE_MSG_ADD_INSERT = 0x8A6 // 2214 + SYS___LE_MSG_GET = 0x8A7 // 2215 + SYS___LE_MSG_GET_AND_WRITE = 0x8A8 // 2216 + SYS___LE_MSG_WRITE = 0x8A9 // 2217 + SYS___ITOA = 0x8AA // 2218 + SYS___UTOA = 0x8AB // 2219 + SYS___LTOA = 0x8AC // 2220 + SYS___ULTOA = 0x8AD // 2221 + SYS___LLTOA = 0x8AE // 2222 + SYS___ULLTOA = 0x8AF // 2223 + SYS___ITOA_A = 0x8B0 // 2224 + SYS___UTOA_A = 0x8B1 // 2225 + SYS___LTOA_A = 0x8B2 // 2226 + SYS___ULTOA_A = 0x8B3 // 2227 + SYS___LLTOA_A = 0x8B4 // 2228 + SYS___ULLTOA_A = 0x8B5 // 2229 + SYS_____GETENV_A = 0x8C3 // 2243 + SYS___REXEC_A = 0x8C4 // 2244 + SYS___REXEC_AF_A = 0x8C5 // 2245 + SYS___GETUTXENT_A = 0x8C6 // 2246 + SYS___GETUTXID_A = 0x8C7 // 2247 + SYS___GETUTXLINE_A = 0x8C8 // 2248 + SYS___PUTUTXLINE_A = 0x8C9 // 2249 + SYS_____UTMPXNAME_A = 0x8CA // 2250 + SYS___PUTC_UNLOCKED_A = 0x8CB // 2251 + SYS___PUTCHAR_UNLOCKED_A = 0x8CC // 2252 + SYS___SNPRINTF_A = 0x8CD // 2253 + SYS___VSNPRINTF_A = 0x8CE // 2254 + SYS___DLOPEN_A = 0x8D0 // 2256 + SYS___DLSYM_A = 0x8D1 // 2257 + SYS___DLERROR_A = 0x8D2 // 2258 + SYS_FLOCKFILE = 0x8D3 // 2259 + SYS_FTRYLOCKFILE = 0x8D4 // 2260 + SYS_FUNLOCKFILE = 0x8D5 // 2261 + SYS_GETC_UNLOCKED = 0x8D6 // 2262 + SYS_GETCHAR_UNLOCKED = 0x8D7 // 2263 + SYS_PUTC_UNLOCKED = 0x8D8 // 2264 + SYS_PUTCHAR_UNLOCKED = 0x8D9 // 2265 + SYS_SNPRINTF = 0x8DA // 2266 + SYS_VSNPRINTF = 0x8DB // 2267 + SYS_DLOPEN = 0x8DD // 2269 + SYS_DLSYM = 0x8DE // 2270 + SYS_DLCLOSE = 0x8DF // 2271 + SYS_DLERROR = 0x8E0 // 2272 + SYS___SET_EXCEPTION_HANDLER = 0x8E2 // 2274 + SYS___RESET_EXCEPTION_HANDLER = 0x8E3 // 2275 + SYS___VHM_EVENT = 0x8E4 // 2276 + SYS___ABS_H = 0x8E6 // 2278 + SYS___ABSF_H = 0x8E7 // 2279 + SYS___ABSL_H = 0x8E8 // 2280 + SYS___ACOS_H = 0x8E9 // 2281 + SYS___ACOSF_H = 0x8EA // 2282 + SYS___ACOSL_H = 0x8EB // 2283 + SYS___ACOSH_H = 0x8EC // 2284 + SYS___ASIN_H = 0x8ED // 2285 + SYS___ASINF_H = 0x8EE // 2286 + SYS___ASINL_H = 0x8EF // 2287 + SYS___ASINH_H = 0x8F0 // 2288 + SYS___ATAN_H = 0x8F1 // 2289 + SYS___ATANF_H = 0x8F2 // 2290 + SYS___ATANL_H = 0x8F3 // 2291 + SYS___ATANH_H = 0x8F4 // 2292 + SYS___ATANHF_H = 0x8F5 // 2293 + SYS___ATANHL_H = 0x8F6 // 2294 + SYS___ATAN2_H = 0x8F7 // 2295 + SYS___ATAN2F_H = 0x8F8 // 2296 + SYS___ATAN2L_H = 0x8F9 // 2297 + SYS___CBRT_H = 0x8FA // 2298 + SYS___COPYSIGNF_H = 0x8FB // 2299 + SYS___COPYSIGNL_H = 0x8FC // 2300 + SYS___COS_H = 0x8FD // 2301 + SYS___COSF_H = 0x8FE // 2302 + SYS___COSL_H = 0x8FF // 2303 + SYS___COSHF_H = 0x900 // 2304 + SYS___COSHL_H = 0x901 // 2305 + SYS___COTAN_H = 0x902 // 2306 + SYS___COTANF_H = 0x903 // 2307 + SYS___COTANL_H = 0x904 // 2308 + SYS___ERF_H = 0x905 // 2309 + SYS___ERFF_H = 0x906 // 2310 + SYS___ERFL_H = 0x907 // 2311 + SYS___ERFC_H = 0x908 // 2312 + SYS___ERFCF_H = 0x909 // 2313 + SYS___ERFCL_H = 0x90A // 2314 + SYS___EXP_H = 0x90B // 2315 + SYS___EXPF_H = 0x90C // 2316 + SYS___EXPL_H = 0x90D // 2317 + SYS___EXPM1_H = 0x90E // 2318 + SYS___FDIM_H = 0x90F // 2319 + SYS___FDIMF_H = 0x910 // 2320 + SYS___FDIML_H = 0x911 // 2321 + SYS___FMOD_H = 0x912 // 2322 + SYS___FMODF_H = 0x913 // 2323 + SYS___FMODL_H = 0x914 // 2324 + SYS___GAMMA_H = 0x915 // 2325 + SYS___HYPOT_H = 0x916 // 2326 + SYS___ILOGB_H = 0x917 // 2327 + SYS___LGAMMA_H = 0x918 // 2328 + SYS___LGAMMAF_H = 0x919 // 2329 + SYS___LOG_H = 0x91A // 2330 + SYS___LOGF_H = 0x91B // 2331 + SYS___LOGL_H = 0x91C // 2332 + SYS___LOGB_H = 0x91D // 2333 + SYS___LOG2_H = 0x91E // 2334 + SYS___LOG2F_H = 0x91F // 2335 + SYS___LOG2L_H = 0x920 // 2336 + SYS___LOG1P_H = 0x921 // 2337 + SYS___LOG10_H = 0x922 // 2338 + SYS___LOG10F_H = 0x923 // 2339 + SYS___LOG10L_H = 0x924 // 2340 + SYS___LROUND_H = 0x925 // 2341 + SYS___LROUNDF_H = 0x926 // 2342 + SYS___NEXTAFTER_H = 0x927 // 2343 + SYS___POW_H = 0x928 // 2344 + SYS___POWF_H = 0x929 // 2345 + SYS___POWL_H = 0x92A // 2346 + SYS___REMAINDER_H = 0x92B // 2347 + SYS___RINT_H = 0x92C // 2348 + SYS___SCALB_H = 0x92D // 2349 + SYS___SIN_H = 0x92E // 2350 + SYS___SINF_H = 0x92F // 2351 + SYS___SINL_H = 0x930 // 2352 + SYS___SINH_H = 0x931 // 2353 + SYS___SINHF_H = 0x932 // 2354 + SYS___SINHL_H = 0x933 // 2355 + SYS___SQRT_H = 0x934 // 2356 + SYS___SQRTF_H = 0x935 // 2357 + SYS___SQRTL_H = 0x936 // 2358 + SYS___TAN_H = 0x937 // 2359 + SYS___TANF_H = 0x938 // 2360 + SYS___TANL_H = 0x939 // 2361 + SYS___TANH_H = 0x93A // 2362 + SYS___TANHF_H = 0x93B // 2363 + SYS___TANHL_H = 0x93C // 2364 + SYS___TGAMMA_H = 0x93D // 2365 + SYS___TGAMMAF_H = 0x93E // 2366 + SYS___TRUNC_H = 0x93F // 2367 + SYS___TRUNCF_H = 0x940 // 2368 + SYS___TRUNCL_H = 0x941 // 2369 + SYS___COSH_H = 0x942 // 2370 + SYS___LE_DEBUG_SET_RESUME_MCH = 0x943 // 2371 + SYS_VFSCANF = 0x944 // 2372 + SYS_VSCANF = 0x946 // 2374 + SYS_VSSCANF = 0x948 // 2376 + SYS_VFWSCANF = 0x94A // 2378 + SYS_VWSCANF = 0x94C // 2380 + SYS_VSWSCANF = 0x94E // 2382 + SYS_IMAXABS = 0x950 // 2384 + SYS_IMAXDIV = 0x951 // 2385 + SYS_STRTOIMAX = 0x952 // 2386 + SYS_STRTOUMAX = 0x953 // 2387 + SYS_WCSTOIMAX = 0x954 // 2388 + SYS_WCSTOUMAX = 0x955 // 2389 + SYS_ATOLL = 0x956 // 2390 + SYS_STRTOF = 0x957 // 2391 + SYS_STRTOLD = 0x958 // 2392 + SYS_WCSTOF = 0x959 // 2393 + SYS_WCSTOLD = 0x95A // 2394 + SYS_INET6_RTH_SPACE = 0x95B // 2395 + SYS_INET6_RTH_INIT = 0x95C // 2396 + SYS_INET6_RTH_ADD = 0x95D // 2397 + SYS_INET6_RTH_REVERSE = 0x95E // 2398 + SYS_INET6_RTH_SEGMENTS = 0x95F // 2399 + SYS_INET6_RTH_GETADDR = 0x960 // 2400 + SYS_INET6_OPT_INIT = 0x961 // 2401 + SYS_INET6_OPT_APPEND = 0x962 // 2402 + SYS_INET6_OPT_FINISH = 0x963 // 2403 + SYS_INET6_OPT_SET_VAL = 0x964 // 2404 + SYS_INET6_OPT_NEXT = 0x965 // 2405 + SYS_INET6_OPT_FIND = 0x966 // 2406 + SYS_INET6_OPT_GET_VAL = 0x967 // 2407 + SYS___POW_I = 0x987 // 2439 + SYS___POW_I_B = 0x988 // 2440 + SYS___POW_I_H = 0x989 // 2441 + SYS___POW_II = 0x98A // 2442 + SYS___POW_II_B = 0x98B // 2443 + SYS___POW_II_H = 0x98C // 2444 + SYS_CABS = 0x98E // 2446 + SYS___CABS_B = 0x98F // 2447 + SYS___CABS_H = 0x990 // 2448 + SYS_CABSF = 0x991 // 2449 + SYS___CABSF_B = 0x992 // 2450 + SYS___CABSF_H = 0x993 // 2451 + SYS_CABSL = 0x994 // 2452 + SYS___CABSL_B = 0x995 // 2453 + SYS___CABSL_H = 0x996 // 2454 + SYS_CACOS = 0x997 // 2455 + SYS___CACOS_B = 0x998 // 2456 + SYS___CACOS_H = 0x999 // 2457 + SYS_CACOSF = 0x99A // 2458 + SYS___CACOSF_B = 0x99B // 2459 + SYS___CACOSF_H = 0x99C // 2460 + SYS_CACOSL = 0x99D // 2461 + SYS___CACOSL_B = 0x99E // 2462 + SYS___CACOSL_H = 0x99F // 2463 + SYS_CACOSH = 0x9A0 // 2464 + SYS___CACOSH_B = 0x9A1 // 2465 + SYS___CACOSH_H = 0x9A2 // 2466 + SYS_CACOSHF = 0x9A3 // 2467 + SYS___CACOSHF_B = 0x9A4 // 2468 + SYS___CACOSHF_H = 0x9A5 // 2469 + SYS_CACOSHL = 0x9A6 // 2470 + SYS___CACOSHL_B = 0x9A7 // 2471 + SYS___CACOSHL_H = 0x9A8 // 2472 + SYS_CARG = 0x9A9 // 2473 + SYS___CARG_B = 0x9AA // 2474 + SYS___CARG_H = 0x9AB // 2475 + SYS_CARGF = 0x9AC // 2476 + SYS___CARGF_B = 0x9AD // 2477 + SYS___CARGF_H = 0x9AE // 2478 + SYS_CARGL = 0x9AF // 2479 + SYS___CARGL_B = 0x9B0 // 2480 + SYS___CARGL_H = 0x9B1 // 2481 + SYS_CASIN = 0x9B2 // 2482 + SYS___CASIN_B = 0x9B3 // 2483 + SYS___CASIN_H = 0x9B4 // 2484 + SYS_CASINF = 0x9B5 // 2485 + SYS___CASINF_B = 0x9B6 // 2486 + SYS___CASINF_H = 0x9B7 // 2487 + SYS_CASINL = 0x9B8 // 2488 + SYS___CASINL_B = 0x9B9 // 2489 + SYS___CASINL_H = 0x9BA // 2490 + SYS_CASINH = 0x9BB // 2491 + SYS___CASINH_B = 0x9BC // 2492 + SYS___CASINH_H = 0x9BD // 2493 + SYS_CASINHF = 0x9BE // 2494 + SYS___CASINHF_B = 0x9BF // 2495 + SYS___CASINHF_H = 0x9C0 // 2496 + SYS_CASINHL = 0x9C1 // 2497 + SYS___CASINHL_B = 0x9C2 // 2498 + SYS___CASINHL_H = 0x9C3 // 2499 + SYS_CATAN = 0x9C4 // 2500 + SYS___CATAN_B = 0x9C5 // 2501 + SYS___CATAN_H = 0x9C6 // 2502 + SYS_CATANF = 0x9C7 // 2503 + SYS___CATANF_B = 0x9C8 // 2504 + SYS___CATANF_H = 0x9C9 // 2505 + SYS_CATANL = 0x9CA // 2506 + SYS___CATANL_B = 0x9CB // 2507 + SYS___CATANL_H = 0x9CC // 2508 + SYS_CATANH = 0x9CD // 2509 + SYS___CATANH_B = 0x9CE // 2510 + SYS___CATANH_H = 0x9CF // 2511 + SYS_CATANHF = 0x9D0 // 2512 + SYS___CATANHF_B = 0x9D1 // 2513 + SYS___CATANHF_H = 0x9D2 // 2514 + SYS_CATANHL = 0x9D3 // 2515 + SYS___CATANHL_B = 0x9D4 // 2516 + SYS___CATANHL_H = 0x9D5 // 2517 + SYS_CCOS = 0x9D6 // 2518 + SYS___CCOS_B = 0x9D7 // 2519 + SYS___CCOS_H = 0x9D8 // 2520 + SYS_CCOSF = 0x9D9 // 2521 + SYS___CCOSF_B = 0x9DA // 2522 + SYS___CCOSF_H = 0x9DB // 2523 + SYS_CCOSL = 0x9DC // 2524 + SYS___CCOSL_B = 0x9DD // 2525 + SYS___CCOSL_H = 0x9DE // 2526 + SYS_CCOSH = 0x9DF // 2527 + SYS___CCOSH_B = 0x9E0 // 2528 + SYS___CCOSH_H = 0x9E1 // 2529 + SYS_CCOSHF = 0x9E2 // 2530 + SYS___CCOSHF_B = 0x9E3 // 2531 + SYS___CCOSHF_H = 0x9E4 // 2532 + SYS_CCOSHL = 0x9E5 // 2533 + SYS___CCOSHL_B = 0x9E6 // 2534 + SYS___CCOSHL_H = 0x9E7 // 2535 + SYS_CEXP = 0x9E8 // 2536 + SYS___CEXP_B = 0x9E9 // 2537 + SYS___CEXP_H = 0x9EA // 2538 + SYS_CEXPF = 0x9EB // 2539 + SYS___CEXPF_B = 0x9EC // 2540 + SYS___CEXPF_H = 0x9ED // 2541 + SYS_CEXPL = 0x9EE // 2542 + SYS___CEXPL_B = 0x9EF // 2543 + SYS___CEXPL_H = 0x9F0 // 2544 + SYS_CIMAG = 0x9F1 // 2545 + SYS___CIMAG_B = 0x9F2 // 2546 + SYS___CIMAG_H = 0x9F3 // 2547 + SYS_CIMAGF = 0x9F4 // 2548 + SYS___CIMAGF_B = 0x9F5 // 2549 + SYS___CIMAGF_H = 0x9F6 // 2550 + SYS_CIMAGL = 0x9F7 // 2551 + SYS___CIMAGL_B = 0x9F8 // 2552 + SYS___CIMAGL_H = 0x9F9 // 2553 + SYS___CLOG = 0x9FA // 2554 + SYS___CLOG_B = 0x9FB // 2555 + SYS___CLOG_H = 0x9FC // 2556 + SYS_CLOGF = 0x9FD // 2557 + SYS___CLOGF_B = 0x9FE // 2558 + SYS___CLOGF_H = 0x9FF // 2559 + SYS_CLOGL = 0xA00 // 2560 + SYS___CLOGL_B = 0xA01 // 2561 + SYS___CLOGL_H = 0xA02 // 2562 + SYS_CONJ = 0xA03 // 2563 + SYS___CONJ_B = 0xA04 // 2564 + SYS___CONJ_H = 0xA05 // 2565 + SYS_CONJF = 0xA06 // 2566 + SYS___CONJF_B = 0xA07 // 2567 + SYS___CONJF_H = 0xA08 // 2568 + SYS_CONJL = 0xA09 // 2569 + SYS___CONJL_B = 0xA0A // 2570 + SYS___CONJL_H = 0xA0B // 2571 + SYS_CPOW = 0xA0C // 2572 + SYS___CPOW_B = 0xA0D // 2573 + SYS___CPOW_H = 0xA0E // 2574 + SYS_CPOWF = 0xA0F // 2575 + SYS___CPOWF_B = 0xA10 // 2576 + SYS___CPOWF_H = 0xA11 // 2577 + SYS_CPOWL = 0xA12 // 2578 + SYS___CPOWL_B = 0xA13 // 2579 + SYS___CPOWL_H = 0xA14 // 2580 + SYS_CPROJ = 0xA15 // 2581 + SYS___CPROJ_B = 0xA16 // 2582 + SYS___CPROJ_H = 0xA17 // 2583 + SYS_CPROJF = 0xA18 // 2584 + SYS___CPROJF_B = 0xA19 // 2585 + SYS___CPROJF_H = 0xA1A // 2586 + SYS_CPROJL = 0xA1B // 2587 + SYS___CPROJL_B = 0xA1C // 2588 + SYS___CPROJL_H = 0xA1D // 2589 + SYS_CREAL = 0xA1E // 2590 + SYS___CREAL_B = 0xA1F // 2591 + SYS___CREAL_H = 0xA20 // 2592 + SYS_CREALF = 0xA21 // 2593 + SYS___CREALF_B = 0xA22 // 2594 + SYS___CREALF_H = 0xA23 // 2595 + SYS_CREALL = 0xA24 // 2596 + SYS___CREALL_B = 0xA25 // 2597 + SYS___CREALL_H = 0xA26 // 2598 + SYS_CSIN = 0xA27 // 2599 + SYS___CSIN_B = 0xA28 // 2600 + SYS___CSIN_H = 0xA29 // 2601 + SYS_CSINF = 0xA2A // 2602 + SYS___CSINF_B = 0xA2B // 2603 + SYS___CSINF_H = 0xA2C // 2604 + SYS_CSINL = 0xA2D // 2605 + SYS___CSINL_B = 0xA2E // 2606 + SYS___CSINL_H = 0xA2F // 2607 + SYS_CSINH = 0xA30 // 2608 + SYS___CSINH_B = 0xA31 // 2609 + SYS___CSINH_H = 0xA32 // 2610 + SYS_CSINHF = 0xA33 // 2611 + SYS___CSINHF_B = 0xA34 // 2612 + SYS___CSINHF_H = 0xA35 // 2613 + SYS_CSINHL = 0xA36 // 2614 + SYS___CSINHL_B = 0xA37 // 2615 + SYS___CSINHL_H = 0xA38 // 2616 + SYS_CSQRT = 0xA39 // 2617 + SYS___CSQRT_B = 0xA3A // 2618 + SYS___CSQRT_H = 0xA3B // 2619 + SYS_CSQRTF = 0xA3C // 2620 + SYS___CSQRTF_B = 0xA3D // 2621 + SYS___CSQRTF_H = 0xA3E // 2622 + SYS_CSQRTL = 0xA3F // 2623 + SYS___CSQRTL_B = 0xA40 // 2624 + SYS___CSQRTL_H = 0xA41 // 2625 + SYS_CTAN = 0xA42 // 2626 + SYS___CTAN_B = 0xA43 // 2627 + SYS___CTAN_H = 0xA44 // 2628 + SYS_CTANF = 0xA45 // 2629 + SYS___CTANF_B = 0xA46 // 2630 + SYS___CTANF_H = 0xA47 // 2631 + SYS_CTANL = 0xA48 // 2632 + SYS___CTANL_B = 0xA49 // 2633 + SYS___CTANL_H = 0xA4A // 2634 + SYS_CTANH = 0xA4B // 2635 + SYS___CTANH_B = 0xA4C // 2636 + SYS___CTANH_H = 0xA4D // 2637 + SYS_CTANHF = 0xA4E // 2638 + SYS___CTANHF_B = 0xA4F // 2639 + SYS___CTANHF_H = 0xA50 // 2640 + SYS_CTANHL = 0xA51 // 2641 + SYS___CTANHL_B = 0xA52 // 2642 + SYS___CTANHL_H = 0xA53 // 2643 + SYS___ACOSHF_H = 0xA54 // 2644 + SYS___ACOSHL_H = 0xA55 // 2645 + SYS___ASINHF_H = 0xA56 // 2646 + SYS___ASINHL_H = 0xA57 // 2647 + SYS___CBRTF_H = 0xA58 // 2648 + SYS___CBRTL_H = 0xA59 // 2649 + SYS___COPYSIGN_B = 0xA5A // 2650 + SYS___EXPM1F_H = 0xA5B // 2651 + SYS___EXPM1L_H = 0xA5C // 2652 + SYS___EXP2_H = 0xA5D // 2653 + SYS___EXP2F_H = 0xA5E // 2654 + SYS___EXP2L_H = 0xA5F // 2655 + SYS___LOG1PF_H = 0xA60 // 2656 + SYS___LOG1PL_H = 0xA61 // 2657 + SYS___LGAMMAL_H = 0xA62 // 2658 + SYS_FMA = 0xA63 // 2659 + SYS___FMA_B = 0xA64 // 2660 + SYS___FMA_H = 0xA65 // 2661 + SYS_FMAF = 0xA66 // 2662 + SYS___FMAF_B = 0xA67 // 2663 + SYS___FMAF_H = 0xA68 // 2664 + SYS_FMAL = 0xA69 // 2665 + SYS___FMAL_B = 0xA6A // 2666 + SYS___FMAL_H = 0xA6B // 2667 + SYS_FMAX = 0xA6C // 2668 + SYS___FMAX_B = 0xA6D // 2669 + SYS___FMAX_H = 0xA6E // 2670 + SYS_FMAXF = 0xA6F // 2671 + SYS___FMAXF_B = 0xA70 // 2672 + SYS___FMAXF_H = 0xA71 // 2673 + SYS_FMAXL = 0xA72 // 2674 + SYS___FMAXL_B = 0xA73 // 2675 + SYS___FMAXL_H = 0xA74 // 2676 + SYS_FMIN = 0xA75 // 2677 + SYS___FMIN_B = 0xA76 // 2678 + SYS___FMIN_H = 0xA77 // 2679 + SYS_FMINF = 0xA78 // 2680 + SYS___FMINF_B = 0xA79 // 2681 + SYS___FMINF_H = 0xA7A // 2682 + SYS_FMINL = 0xA7B // 2683 + SYS___FMINL_B = 0xA7C // 2684 + SYS___FMINL_H = 0xA7D // 2685 + SYS_ILOGBF = 0xA7E // 2686 + SYS___ILOGBF_B = 0xA7F // 2687 + SYS___ILOGBF_H = 0xA80 // 2688 + SYS_ILOGBL = 0xA81 // 2689 + SYS___ILOGBL_B = 0xA82 // 2690 + SYS___ILOGBL_H = 0xA83 // 2691 + SYS_LLRINT = 0xA84 // 2692 + SYS___LLRINT_B = 0xA85 // 2693 + SYS___LLRINT_H = 0xA86 // 2694 + SYS_LLRINTF = 0xA87 // 2695 + SYS___LLRINTF_B = 0xA88 // 2696 + SYS___LLRINTF_H = 0xA89 // 2697 + SYS_LLRINTL = 0xA8A // 2698 + SYS___LLRINTL_B = 0xA8B // 2699 + SYS___LLRINTL_H = 0xA8C // 2700 + SYS_LLROUND = 0xA8D // 2701 + SYS___LLROUND_B = 0xA8E // 2702 + SYS___LLROUND_H = 0xA8F // 2703 + SYS_LLROUNDF = 0xA90 // 2704 + SYS___LLROUNDF_B = 0xA91 // 2705 + SYS___LLROUNDF_H = 0xA92 // 2706 + SYS_LLROUNDL = 0xA93 // 2707 + SYS___LLROUNDL_B = 0xA94 // 2708 + SYS___LLROUNDL_H = 0xA95 // 2709 + SYS_LOGBF = 0xA96 // 2710 + SYS___LOGBF_B = 0xA97 // 2711 + SYS___LOGBF_H = 0xA98 // 2712 + SYS_LOGBL = 0xA99 // 2713 + SYS___LOGBL_B = 0xA9A // 2714 + SYS___LOGBL_H = 0xA9B // 2715 + SYS_LRINT = 0xA9C // 2716 + SYS___LRINT_B = 0xA9D // 2717 + SYS___LRINT_H = 0xA9E // 2718 + SYS_LRINTF = 0xA9F // 2719 + SYS___LRINTF_B = 0xAA0 // 2720 + SYS___LRINTF_H = 0xAA1 // 2721 + SYS_LRINTL = 0xAA2 // 2722 + SYS___LRINTL_B = 0xAA3 // 2723 + SYS___LRINTL_H = 0xAA4 // 2724 + SYS_LROUNDL = 0xAA5 // 2725 + SYS___LROUNDL_B = 0xAA6 // 2726 + SYS___LROUNDL_H = 0xAA7 // 2727 + SYS_NAN = 0xAA8 // 2728 + SYS___NAN_B = 0xAA9 // 2729 + SYS_NANF = 0xAAA // 2730 + SYS___NANF_B = 0xAAB // 2731 + SYS_NANL = 0xAAC // 2732 + SYS___NANL_B = 0xAAD // 2733 + SYS_NEARBYINT = 0xAAE // 2734 + SYS___NEARBYINT_B = 0xAAF // 2735 + SYS___NEARBYINT_H = 0xAB0 // 2736 + SYS_NEARBYINTF = 0xAB1 // 2737 + SYS___NEARBYINTF_B = 0xAB2 // 2738 + SYS___NEARBYINTF_H = 0xAB3 // 2739 + SYS_NEARBYINTL = 0xAB4 // 2740 + SYS___NEARBYINTL_B = 0xAB5 // 2741 + SYS___NEARBYINTL_H = 0xAB6 // 2742 + SYS_NEXTAFTERF = 0xAB7 // 2743 + SYS___NEXTAFTERF_B = 0xAB8 // 2744 + SYS___NEXTAFTERF_H = 0xAB9 // 2745 + SYS_NEXTAFTERL = 0xABA // 2746 + SYS___NEXTAFTERL_B = 0xABB // 2747 + SYS___NEXTAFTERL_H = 0xABC // 2748 + SYS_NEXTTOWARD = 0xABD // 2749 + SYS___NEXTTOWARD_B = 0xABE // 2750 + SYS___NEXTTOWARD_H = 0xABF // 2751 + SYS_NEXTTOWARDF = 0xAC0 // 2752 + SYS___NEXTTOWARDF_B = 0xAC1 // 2753 + SYS___NEXTTOWARDF_H = 0xAC2 // 2754 + SYS_NEXTTOWARDL = 0xAC3 // 2755 + SYS___NEXTTOWARDL_B = 0xAC4 // 2756 + SYS___NEXTTOWARDL_H = 0xAC5 // 2757 + SYS___REMAINDERF_H = 0xAC6 // 2758 + SYS___REMAINDERL_H = 0xAC7 // 2759 + SYS___REMQUO_H = 0xAC8 // 2760 + SYS___REMQUOF_H = 0xAC9 // 2761 + SYS___REMQUOL_H = 0xACA // 2762 + SYS_RINTF = 0xACB // 2763 + SYS___RINTF_B = 0xACC // 2764 + SYS_RINTL = 0xACD // 2765 + SYS___RINTL_B = 0xACE // 2766 + SYS_ROUND = 0xACF // 2767 + SYS___ROUND_B = 0xAD0 // 2768 + SYS___ROUND_H = 0xAD1 // 2769 + SYS_ROUNDF = 0xAD2 // 2770 + SYS___ROUNDF_B = 0xAD3 // 2771 + SYS___ROUNDF_H = 0xAD4 // 2772 + SYS_ROUNDL = 0xAD5 // 2773 + SYS___ROUNDL_B = 0xAD6 // 2774 + SYS___ROUNDL_H = 0xAD7 // 2775 + SYS_SCALBLN = 0xAD8 // 2776 + SYS___SCALBLN_B = 0xAD9 // 2777 + SYS___SCALBLN_H = 0xADA // 2778 + SYS_SCALBLNF = 0xADB // 2779 + SYS___SCALBLNF_B = 0xADC // 2780 + SYS___SCALBLNF_H = 0xADD // 2781 + SYS_SCALBLNL = 0xADE // 2782 + SYS___SCALBLNL_B = 0xADF // 2783 + SYS___SCALBLNL_H = 0xAE0 // 2784 + SYS___SCALBN_B = 0xAE1 // 2785 + SYS___SCALBN_H = 0xAE2 // 2786 + SYS_SCALBNF = 0xAE3 // 2787 + SYS___SCALBNF_B = 0xAE4 // 2788 + SYS___SCALBNF_H = 0xAE5 // 2789 + SYS_SCALBNL = 0xAE6 // 2790 + SYS___SCALBNL_B = 0xAE7 // 2791 + SYS___SCALBNL_H = 0xAE8 // 2792 + SYS___TGAMMAL_H = 0xAE9 // 2793 + SYS_FECLEAREXCEPT = 0xAEA // 2794 + SYS_FEGETENV = 0xAEB // 2795 + SYS_FEGETEXCEPTFLAG = 0xAEC // 2796 + SYS_FEGETROUND = 0xAED // 2797 + SYS_FEHOLDEXCEPT = 0xAEE // 2798 + SYS_FERAISEEXCEPT = 0xAEF // 2799 + SYS_FESETENV = 0xAF0 // 2800 + SYS_FESETEXCEPTFLAG = 0xAF1 // 2801 + SYS_FESETROUND = 0xAF2 // 2802 + SYS_FETESTEXCEPT = 0xAF3 // 2803 + SYS_FEUPDATEENV = 0xAF4 // 2804 + SYS___COPYSIGN_H = 0xAF5 // 2805 + SYS___HYPOTF_H = 0xAF6 // 2806 + SYS___HYPOTL_H = 0xAF7 // 2807 + SYS___CLASS = 0xAFA // 2810 + SYS___CLASS_B = 0xAFB // 2811 + SYS___CLASS_H = 0xAFC // 2812 + SYS___ISBLANK_A = 0xB2E // 2862 + SYS___ISWBLANK_A = 0xB2F // 2863 + SYS___LROUND_FIXUP = 0xB30 // 2864 + SYS___LROUNDF_FIXUP = 0xB31 // 2865 + SYS_SCHED_YIELD = 0xB32 // 2866 + SYS_STRERROR_R = 0xB33 // 2867 + SYS_UNSETENV = 0xB34 // 2868 + SYS___LGAMMA_H_C99 = 0xB38 // 2872 + SYS___LGAMMA_B_C99 = 0xB39 // 2873 + SYS___LGAMMA_R_C99 = 0xB3A // 2874 + SYS___FTELL2 = 0xB3B // 2875 + SYS___FSEEK2 = 0xB3C // 2876 + SYS___STATIC_REINIT = 0xB3D // 2877 + SYS_PTHREAD_ATTR_GETSTACK = 0xB3E // 2878 + SYS_PTHREAD_ATTR_SETSTACK = 0xB3F // 2879 + SYS___TGAMMA_H_C99 = 0xB78 // 2936 + SYS___TGAMMAF_H_C99 = 0xB79 // 2937 + SYS___LE_TRACEBACK = 0xB7A // 2938 + SYS___MUST_STAY_CLEAN = 0xB7C // 2940 + SYS___O_ENV = 0xB7D // 2941 + SYS_ACOSD32 = 0xB7E // 2942 + SYS_ACOSD64 = 0xB7F // 2943 + SYS_ACOSD128 = 0xB80 // 2944 + SYS_ACOSHD32 = 0xB81 // 2945 + SYS_ACOSHD64 = 0xB82 // 2946 + SYS_ACOSHD128 = 0xB83 // 2947 + SYS_ASIND32 = 0xB84 // 2948 + SYS_ASIND64 = 0xB85 // 2949 + SYS_ASIND128 = 0xB86 // 2950 + SYS_ASINHD32 = 0xB87 // 2951 + SYS_ASINHD64 = 0xB88 // 2952 + SYS_ASINHD128 = 0xB89 // 2953 + SYS_ATAND32 = 0xB8A // 2954 + SYS_ATAND64 = 0xB8B // 2955 + SYS_ATAND128 = 0xB8C // 2956 + SYS_ATAN2D32 = 0xB8D // 2957 + SYS_ATAN2D64 = 0xB8E // 2958 + SYS_ATAN2D128 = 0xB8F // 2959 + SYS_ATANHD32 = 0xB90 // 2960 + SYS_ATANHD64 = 0xB91 // 2961 + SYS_ATANHD128 = 0xB92 // 2962 + SYS_CBRTD32 = 0xB93 // 2963 + SYS_CBRTD64 = 0xB94 // 2964 + SYS_CBRTD128 = 0xB95 // 2965 + SYS_CEILD32 = 0xB96 // 2966 + SYS_CEILD64 = 0xB97 // 2967 + SYS_CEILD128 = 0xB98 // 2968 + SYS___CLASS2 = 0xB99 // 2969 + SYS___CLASS2_B = 0xB9A // 2970 + SYS___CLASS2_H = 0xB9B // 2971 + SYS_COPYSIGND32 = 0xB9C // 2972 + SYS_COPYSIGND64 = 0xB9D // 2973 + SYS_COPYSIGND128 = 0xB9E // 2974 + SYS_COSD32 = 0xB9F // 2975 + SYS_COSD64 = 0xBA0 // 2976 + SYS_COSD128 = 0xBA1 // 2977 + SYS_COSHD32 = 0xBA2 // 2978 + SYS_COSHD64 = 0xBA3 // 2979 + SYS_COSHD128 = 0xBA4 // 2980 + SYS_ERFD32 = 0xBA5 // 2981 + SYS_ERFD64 = 0xBA6 // 2982 + SYS_ERFD128 = 0xBA7 // 2983 + SYS_ERFCD32 = 0xBA8 // 2984 + SYS_ERFCD64 = 0xBA9 // 2985 + SYS_ERFCD128 = 0xBAA // 2986 + SYS_EXPD32 = 0xBAB // 2987 + SYS_EXPD64 = 0xBAC // 2988 + SYS_EXPD128 = 0xBAD // 2989 + SYS_EXP2D32 = 0xBAE // 2990 + SYS_EXP2D64 = 0xBAF // 2991 + SYS_EXP2D128 = 0xBB0 // 2992 + SYS_EXPM1D32 = 0xBB1 // 2993 + SYS_EXPM1D64 = 0xBB2 // 2994 + SYS_EXPM1D128 = 0xBB3 // 2995 + SYS_FABSD32 = 0xBB4 // 2996 + SYS_FABSD64 = 0xBB5 // 2997 + SYS_FABSD128 = 0xBB6 // 2998 + SYS_FDIMD32 = 0xBB7 // 2999 + SYS_FDIMD64 = 0xBB8 // 3000 + SYS_FDIMD128 = 0xBB9 // 3001 + SYS_FE_DEC_GETROUND = 0xBBA // 3002 + SYS_FE_DEC_SETROUND = 0xBBB // 3003 + SYS_FLOORD32 = 0xBBC // 3004 + SYS_FLOORD64 = 0xBBD // 3005 + SYS_FLOORD128 = 0xBBE // 3006 + SYS_FMAD32 = 0xBBF // 3007 + SYS_FMAD64 = 0xBC0 // 3008 + SYS_FMAD128 = 0xBC1 // 3009 + SYS_FMAXD32 = 0xBC2 // 3010 + SYS_FMAXD64 = 0xBC3 // 3011 + SYS_FMAXD128 = 0xBC4 // 3012 + SYS_FMIND32 = 0xBC5 // 3013 + SYS_FMIND64 = 0xBC6 // 3014 + SYS_FMIND128 = 0xBC7 // 3015 + SYS_FMODD32 = 0xBC8 // 3016 + SYS_FMODD64 = 0xBC9 // 3017 + SYS_FMODD128 = 0xBCA // 3018 + SYS___FP_CAST_D = 0xBCB // 3019 + SYS_FREXPD32 = 0xBCC // 3020 + SYS_FREXPD64 = 0xBCD // 3021 + SYS_FREXPD128 = 0xBCE // 3022 + SYS_HYPOTD32 = 0xBCF // 3023 + SYS_HYPOTD64 = 0xBD0 // 3024 + SYS_HYPOTD128 = 0xBD1 // 3025 + SYS_ILOGBD32 = 0xBD2 // 3026 + SYS_ILOGBD64 = 0xBD3 // 3027 + SYS_ILOGBD128 = 0xBD4 // 3028 + SYS_LDEXPD32 = 0xBD5 // 3029 + SYS_LDEXPD64 = 0xBD6 // 3030 + SYS_LDEXPD128 = 0xBD7 // 3031 + SYS_LGAMMAD32 = 0xBD8 // 3032 + SYS_LGAMMAD64 = 0xBD9 // 3033 + SYS_LGAMMAD128 = 0xBDA // 3034 + SYS_LLRINTD32 = 0xBDB // 3035 + SYS_LLRINTD64 = 0xBDC // 3036 + SYS_LLRINTD128 = 0xBDD // 3037 + SYS_LLROUNDD32 = 0xBDE // 3038 + SYS_LLROUNDD64 = 0xBDF // 3039 + SYS_LLROUNDD128 = 0xBE0 // 3040 + SYS_LOGD32 = 0xBE1 // 3041 + SYS_LOGD64 = 0xBE2 // 3042 + SYS_LOGD128 = 0xBE3 // 3043 + SYS_LOG10D32 = 0xBE4 // 3044 + SYS_LOG10D64 = 0xBE5 // 3045 + SYS_LOG10D128 = 0xBE6 // 3046 + SYS_LOG1PD32 = 0xBE7 // 3047 + SYS_LOG1PD64 = 0xBE8 // 3048 + SYS_LOG1PD128 = 0xBE9 // 3049 + SYS_LOG2D32 = 0xBEA // 3050 + SYS_LOG2D64 = 0xBEB // 3051 + SYS_LOG2D128 = 0xBEC // 3052 + SYS_LOGBD32 = 0xBED // 3053 + SYS_LOGBD64 = 0xBEE // 3054 + SYS_LOGBD128 = 0xBEF // 3055 + SYS_LRINTD32 = 0xBF0 // 3056 + SYS_LRINTD64 = 0xBF1 // 3057 + SYS_LRINTD128 = 0xBF2 // 3058 + SYS_LROUNDD32 = 0xBF3 // 3059 + SYS_LROUNDD64 = 0xBF4 // 3060 + SYS_LROUNDD128 = 0xBF5 // 3061 + SYS_MODFD32 = 0xBF6 // 3062 + SYS_MODFD64 = 0xBF7 // 3063 + SYS_MODFD128 = 0xBF8 // 3064 + SYS_NAND32 = 0xBF9 // 3065 + SYS_NAND64 = 0xBFA // 3066 + SYS_NAND128 = 0xBFB // 3067 + SYS_NEARBYINTD32 = 0xBFC // 3068 + SYS_NEARBYINTD64 = 0xBFD // 3069 + SYS_NEARBYINTD128 = 0xBFE // 3070 + SYS_NEXTAFTERD32 = 0xBFF // 3071 + SYS_NEXTAFTERD64 = 0xC00 // 3072 + SYS_NEXTAFTERD128 = 0xC01 // 3073 + SYS_NEXTTOWARDD32 = 0xC02 // 3074 + SYS_NEXTTOWARDD64 = 0xC03 // 3075 + SYS_NEXTTOWARDD128 = 0xC04 // 3076 + SYS_POWD32 = 0xC05 // 3077 + SYS_POWD64 = 0xC06 // 3078 + SYS_POWD128 = 0xC07 // 3079 + SYS_QUANTIZED32 = 0xC08 // 3080 + SYS_QUANTIZED64 = 0xC09 // 3081 + SYS_QUANTIZED128 = 0xC0A // 3082 + SYS_REMAINDERD32 = 0xC0B // 3083 + SYS_REMAINDERD64 = 0xC0C // 3084 + SYS_REMAINDERD128 = 0xC0D // 3085 + SYS___REMQUOD32 = 0xC0E // 3086 + SYS___REMQUOD64 = 0xC0F // 3087 + SYS___REMQUOD128 = 0xC10 // 3088 + SYS_RINTD32 = 0xC11 // 3089 + SYS_RINTD64 = 0xC12 // 3090 + SYS_RINTD128 = 0xC13 // 3091 + SYS_ROUNDD32 = 0xC14 // 3092 + SYS_ROUNDD64 = 0xC15 // 3093 + SYS_ROUNDD128 = 0xC16 // 3094 + SYS_SAMEQUANTUMD32 = 0xC17 // 3095 + SYS_SAMEQUANTUMD64 = 0xC18 // 3096 + SYS_SAMEQUANTUMD128 = 0xC19 // 3097 + SYS_SCALBLND32 = 0xC1A // 3098 + SYS_SCALBLND64 = 0xC1B // 3099 + SYS_SCALBLND128 = 0xC1C // 3100 + SYS_SCALBND32 = 0xC1D // 3101 + SYS_SCALBND64 = 0xC1E // 3102 + SYS_SCALBND128 = 0xC1F // 3103 + SYS_SIND32 = 0xC20 // 3104 + SYS_SIND64 = 0xC21 // 3105 + SYS_SIND128 = 0xC22 // 3106 + SYS_SINHD32 = 0xC23 // 3107 + SYS_SINHD64 = 0xC24 // 3108 + SYS_SINHD128 = 0xC25 // 3109 + SYS_SQRTD32 = 0xC26 // 3110 + SYS_SQRTD64 = 0xC27 // 3111 + SYS_SQRTD128 = 0xC28 // 3112 + SYS_STRTOD32 = 0xC29 // 3113 + SYS_STRTOD64 = 0xC2A // 3114 + SYS_STRTOD128 = 0xC2B // 3115 + SYS_TAND32 = 0xC2C // 3116 + SYS_TAND64 = 0xC2D // 3117 + SYS_TAND128 = 0xC2E // 3118 + SYS_TANHD32 = 0xC2F // 3119 + SYS_TANHD64 = 0xC30 // 3120 + SYS_TANHD128 = 0xC31 // 3121 + SYS_TGAMMAD32 = 0xC32 // 3122 + SYS_TGAMMAD64 = 0xC33 // 3123 + SYS_TGAMMAD128 = 0xC34 // 3124 + SYS_TRUNCD32 = 0xC3E // 3134 + SYS_TRUNCD64 = 0xC3F // 3135 + SYS_TRUNCD128 = 0xC40 // 3136 + SYS_WCSTOD32 = 0xC41 // 3137 + SYS_WCSTOD64 = 0xC42 // 3138 + SYS_WCSTOD128 = 0xC43 // 3139 + SYS___CODEPAGE_INFO = 0xC64 // 3172 + SYS_POSIX_OPENPT = 0xC66 // 3174 + SYS_PSELECT = 0xC67 // 3175 + SYS_SOCKATMARK = 0xC68 // 3176 + SYS_AIO_FSYNC = 0xC69 // 3177 + SYS_LIO_LISTIO = 0xC6A // 3178 + SYS___ATANPID32 = 0xC6B // 3179 + SYS___ATANPID64 = 0xC6C // 3180 + SYS___ATANPID128 = 0xC6D // 3181 + SYS___COSPID32 = 0xC6E // 3182 + SYS___COSPID64 = 0xC6F // 3183 + SYS___COSPID128 = 0xC70 // 3184 + SYS___SINPID32 = 0xC71 // 3185 + SYS___SINPID64 = 0xC72 // 3186 + SYS___SINPID128 = 0xC73 // 3187 + SYS_SETIPV4SOURCEFILTER = 0xC76 // 3190 + SYS_GETIPV4SOURCEFILTER = 0xC77 // 3191 + SYS_SETSOURCEFILTER = 0xC78 // 3192 + SYS_GETSOURCEFILTER = 0xC79 // 3193 + SYS_FWRITE_UNLOCKED = 0xC7A // 3194 + SYS_FREAD_UNLOCKED = 0xC7B // 3195 + SYS_FGETS_UNLOCKED = 0xC7C // 3196 + SYS_GETS_UNLOCKED = 0xC7D // 3197 + SYS_FPUTS_UNLOCKED = 0xC7E // 3198 + SYS_PUTS_UNLOCKED = 0xC7F // 3199 + SYS_FGETC_UNLOCKED = 0xC80 // 3200 + SYS_FPUTC_UNLOCKED = 0xC81 // 3201 + SYS_DLADDR = 0xC82 // 3202 + SYS_SHM_OPEN = 0xC8C // 3212 + SYS_SHM_UNLINK = 0xC8D // 3213 + SYS___CLASS2F = 0xC91 // 3217 + SYS___CLASS2L = 0xC92 // 3218 + SYS___CLASS2F_B = 0xC93 // 3219 + SYS___CLASS2F_H = 0xC94 // 3220 + SYS___CLASS2L_B = 0xC95 // 3221 + SYS___CLASS2L_H = 0xC96 // 3222 + SYS___CLASS2D32 = 0xC97 // 3223 + SYS___CLASS2D64 = 0xC98 // 3224 + SYS___CLASS2D128 = 0xC99 // 3225 + SYS___TOCSNAME2 = 0xC9A // 3226 + SYS___D1TOP = 0xC9B // 3227 + SYS___D2TOP = 0xC9C // 3228 + SYS___D4TOP = 0xC9D // 3229 + SYS___PTOD1 = 0xC9E // 3230 + SYS___PTOD2 = 0xC9F // 3231 + SYS___PTOD4 = 0xCA0 // 3232 + SYS_CLEARERR_UNLOCKED = 0xCA1 // 3233 + SYS_FDELREC_UNLOCKED = 0xCA2 // 3234 + SYS_FEOF_UNLOCKED = 0xCA3 // 3235 + SYS_FERROR_UNLOCKED = 0xCA4 // 3236 + SYS_FFLUSH_UNLOCKED = 0xCA5 // 3237 + SYS_FGETPOS_UNLOCKED = 0xCA6 // 3238 + SYS_FGETWC_UNLOCKED = 0xCA7 // 3239 + SYS_FGETWS_UNLOCKED = 0xCA8 // 3240 + SYS_FILENO_UNLOCKED = 0xCA9 // 3241 + SYS_FLDATA_UNLOCKED = 0xCAA // 3242 + SYS_FLOCATE_UNLOCKED = 0xCAB // 3243 + SYS_FPRINTF_UNLOCKED = 0xCAC // 3244 + SYS_FPUTWC_UNLOCKED = 0xCAD // 3245 + SYS_FPUTWS_UNLOCKED = 0xCAE // 3246 + SYS_FSCANF_UNLOCKED = 0xCAF // 3247 + SYS_FSEEK_UNLOCKED = 0xCB0 // 3248 + SYS_FSEEKO_UNLOCKED = 0xCB1 // 3249 + SYS_FSETPOS_UNLOCKED = 0xCB3 // 3251 + SYS_FTELL_UNLOCKED = 0xCB4 // 3252 + SYS_FTELLO_UNLOCKED = 0xCB5 // 3253 + SYS_FUPDATE_UNLOCKED = 0xCB7 // 3255 + SYS_FWIDE_UNLOCKED = 0xCB8 // 3256 + SYS_FWPRINTF_UNLOCKED = 0xCB9 // 3257 + SYS_FWSCANF_UNLOCKED = 0xCBA // 3258 + SYS_GETWC_UNLOCKED = 0xCBB // 3259 + SYS_GETWCHAR_UNLOCKED = 0xCBC // 3260 + SYS_PERROR_UNLOCKED = 0xCBD // 3261 + SYS_PRINTF_UNLOCKED = 0xCBE // 3262 + SYS_PUTWC_UNLOCKED = 0xCBF // 3263 + SYS_PUTWCHAR_UNLOCKED = 0xCC0 // 3264 + SYS_REWIND_UNLOCKED = 0xCC1 // 3265 + SYS_SCANF_UNLOCKED = 0xCC2 // 3266 + SYS_UNGETC_UNLOCKED = 0xCC3 // 3267 + SYS_UNGETWC_UNLOCKED = 0xCC4 // 3268 + SYS_VFPRINTF_UNLOCKED = 0xCC5 // 3269 + SYS_VFSCANF_UNLOCKED = 0xCC7 // 3271 + SYS_VFWPRINTF_UNLOCKED = 0xCC9 // 3273 + SYS_VFWSCANF_UNLOCKED = 0xCCB // 3275 + SYS_VPRINTF_UNLOCKED = 0xCCD // 3277 + SYS_VSCANF_UNLOCKED = 0xCCF // 3279 + SYS_VWPRINTF_UNLOCKED = 0xCD1 // 3281 + SYS_VWSCANF_UNLOCKED = 0xCD3 // 3283 + SYS_WPRINTF_UNLOCKED = 0xCD5 // 3285 + SYS_WSCANF_UNLOCKED = 0xCD6 // 3286 + SYS_ASCTIME64 = 0xCD7 // 3287 + SYS_ASCTIME64_R = 0xCD8 // 3288 + SYS_CTIME64 = 0xCD9 // 3289 + SYS_CTIME64_R = 0xCDA // 3290 + SYS_DIFFTIME64 = 0xCDB // 3291 + SYS_GMTIME64 = 0xCDC // 3292 + SYS_GMTIME64_R = 0xCDD // 3293 + SYS_LOCALTIME64 = 0xCDE // 3294 + SYS_LOCALTIME64_R = 0xCDF // 3295 + SYS_MKTIME64 = 0xCE0 // 3296 + SYS_TIME64 = 0xCE1 // 3297 + SYS___LOGIN_APPLID = 0xCE2 // 3298 + SYS___PASSWD_APPLID = 0xCE3 // 3299 + SYS_PTHREAD_SECURITY_APPLID_NP = 0xCE4 // 3300 + SYS___GETTHENT = 0xCE5 // 3301 + SYS_FREEIFADDRS = 0xCE6 // 3302 + SYS_GETIFADDRS = 0xCE7 // 3303 + SYS_POSIX_FALLOCATE = 0xCE8 // 3304 + SYS_POSIX_MEMALIGN = 0xCE9 // 3305 + SYS_SIZEOF_ALLOC = 0xCEA // 3306 + SYS_RESIZE_ALLOC = 0xCEB // 3307 + SYS_FREAD_NOUPDATE = 0xCEC // 3308 + SYS_FREAD_NOUPDATE_UNLOCKED = 0xCED // 3309 + SYS_FGETPOS64 = 0xCEE // 3310 + SYS_FSEEK64 = 0xCEF // 3311 + SYS_FSEEKO64 = 0xCF0 // 3312 + SYS_FSETPOS64 = 0xCF1 // 3313 + SYS_FTELL64 = 0xCF2 // 3314 + SYS_FTELLO64 = 0xCF3 // 3315 + SYS_FGETPOS64_UNLOCKED = 0xCF4 // 3316 + SYS_FSEEK64_UNLOCKED = 0xCF5 // 3317 + SYS_FSEEKO64_UNLOCKED = 0xCF6 // 3318 + SYS_FSETPOS64_UNLOCKED = 0xCF7 // 3319 + SYS_FTELL64_UNLOCKED = 0xCF8 // 3320 + SYS_FTELLO64_UNLOCKED = 0xCF9 // 3321 + SYS_FOPEN_UNLOCKED = 0xCFA // 3322 + SYS_FREOPEN_UNLOCKED = 0xCFB // 3323 + SYS_FDOPEN_UNLOCKED = 0xCFC // 3324 + SYS_TMPFILE_UNLOCKED = 0xCFD // 3325 + SYS___MOSERVICES = 0xD3D // 3389 + SYS___GETTOD = 0xD3E // 3390 + SYS_C16RTOMB = 0xD40 // 3392 + SYS_C32RTOMB = 0xD41 // 3393 + SYS_MBRTOC16 = 0xD42 // 3394 + SYS_MBRTOC32 = 0xD43 // 3395 + SYS_QUANTEXPD32 = 0xD44 // 3396 + SYS_QUANTEXPD64 = 0xD45 // 3397 + SYS_QUANTEXPD128 = 0xD46 // 3398 + SYS___LOCALE_CTL = 0xD47 // 3399 + SYS___SMF_RECORD2 = 0xD48 // 3400 + SYS_FOPEN64 = 0xD49 // 3401 + SYS_FOPEN64_UNLOCKED = 0xD4A // 3402 + SYS_FREOPEN64 = 0xD4B // 3403 + SYS_FREOPEN64_UNLOCKED = 0xD4C // 3404 + SYS_TMPFILE64 = 0xD4D // 3405 + SYS_TMPFILE64_UNLOCKED = 0xD4E // 3406 + SYS_GETDATE64 = 0xD4F // 3407 + SYS_GETTIMEOFDAY64 = 0xD50 // 3408 + SYS_BIND2ADDRSEL = 0xD59 // 3417 + SYS_INET6_IS_SRCADDR = 0xD5A // 3418 + SYS___GETGRGID1 = 0xD5B // 3419 + SYS___GETGRNAM1 = 0xD5C // 3420 + SYS___FBUFSIZE = 0xD60 // 3424 + SYS___FPENDING = 0xD61 // 3425 + SYS___FLBF = 0xD62 // 3426 + SYS___FREADABLE = 0xD63 // 3427 + SYS___FWRITABLE = 0xD64 // 3428 + SYS___FREADING = 0xD65 // 3429 + SYS___FWRITING = 0xD66 // 3430 + SYS___FSETLOCKING = 0xD67 // 3431 + SYS__FLUSHLBF = 0xD68 // 3432 + SYS___FPURGE = 0xD69 // 3433 + SYS___FREADAHEAD = 0xD6A // 3434 + SYS___FSETERR = 0xD6B // 3435 + SYS___FPENDING_UNLOCKED = 0xD6C // 3436 + SYS___FREADING_UNLOCKED = 0xD6D // 3437 + SYS___FWRITING_UNLOCKED = 0xD6E // 3438 + SYS__FLUSHLBF_UNLOCKED = 0xD6F // 3439 + SYS___FPURGE_UNLOCKED = 0xD70 // 3440 + SYS___FREADAHEAD_UNLOCKED = 0xD71 // 3441 + SYS___LE_CEEGTJS = 0xD72 // 3442 + SYS___LE_RECORD_DUMP = 0xD73 // 3443 + SYS_FSTAT64 = 0xD74 // 3444 + SYS_LSTAT64 = 0xD75 // 3445 + SYS_STAT64 = 0xD76 // 3446 + SYS___READDIR2_64 = 0xD77 // 3447 + SYS___OPEN_STAT64 = 0xD78 // 3448 + SYS_FTW64 = 0xD79 // 3449 + SYS_NFTW64 = 0xD7A // 3450 + SYS_UTIME64 = 0xD7B // 3451 + SYS_UTIMES64 = 0xD7C // 3452 + SYS___GETIPC64 = 0xD7D // 3453 + SYS_MSGCTL64 = 0xD7E // 3454 + SYS_SEMCTL64 = 0xD7F // 3455 + SYS_SHMCTL64 = 0xD80 // 3456 + SYS_MSGXRCV64 = 0xD81 // 3457 + SYS___MGXR64 = 0xD81 // 3457 + SYS_W_GETPSENT64 = 0xD82 // 3458 + SYS_PTHREAD_COND_TIMEDWAIT64 = 0xD83 // 3459 + SYS_FTIME64 = 0xD85 // 3461 + SYS_GETUTXENT64 = 0xD86 // 3462 + SYS_GETUTXID64 = 0xD87 // 3463 + SYS_GETUTXLINE64 = 0xD88 // 3464 + SYS_PUTUTXLINE64 = 0xD89 // 3465 + SYS_NEWLOCALE = 0xD8A // 3466 + SYS_FREELOCALE = 0xD8B // 3467 + SYS_USELOCALE = 0xD8C // 3468 + SYS_DUPLOCALE = 0xD8D // 3469 + SYS___CHATTR64 = 0xD9C // 3484 + SYS___LCHATTR64 = 0xD9D // 3485 + SYS___FCHATTR64 = 0xD9E // 3486 + SYS_____CHATTR64_A = 0xD9F // 3487 + SYS_____LCHATTR64_A = 0xDA0 // 3488 + SYS___LE_CEEUSGD = 0xDA1 // 3489 + SYS___LE_IFAM_CON = 0xDA2 // 3490 + SYS___LE_IFAM_DSC = 0xDA3 // 3491 + SYS___LE_IFAM_GET = 0xDA4 // 3492 + SYS___LE_IFAM_QRY = 0xDA5 // 3493 + SYS_ALIGNED_ALLOC = 0xDA6 // 3494 + SYS_ACCEPT4 = 0xDA7 // 3495 + SYS___ACCEPT4_A = 0xDA8 // 3496 + SYS_COPYFILERANGE = 0xDA9 // 3497 + SYS_GETLINE = 0xDAA // 3498 + SYS___GETLINE_A = 0xDAB // 3499 + SYS_DIRFD = 0xDAC // 3500 + SYS_CLOCK_GETTIME = 0xDAD // 3501 + SYS_DUP3 = 0xDAE // 3502 + SYS_EPOLL_CREATE = 0xDAF // 3503 + SYS_EPOLL_CREATE1 = 0xDB0 // 3504 + SYS_EPOLL_CTL = 0xDB1 // 3505 + SYS_EPOLL_WAIT = 0xDB2 // 3506 + SYS_EPOLL_PWAIT = 0xDB3 // 3507 + SYS_EVENTFD = 0xDB4 // 3508 + SYS_STATFS = 0xDB5 // 3509 + SYS___STATFS_A = 0xDB6 // 3510 + SYS_FSTATFS = 0xDB7 // 3511 + SYS_INOTIFY_INIT = 0xDB8 // 3512 + SYS_INOTIFY_INIT1 = 0xDB9 // 3513 + SYS_INOTIFY_ADD_WATCH = 0xDBA // 3514 + SYS___INOTIFY_ADD_WATCH_A = 0xDBB // 3515 + SYS_INOTIFY_RM_WATCH = 0xDBC // 3516 + SYS_PIPE2 = 0xDBD // 3517 + SYS_PIVOT_ROOT = 0xDBE // 3518 + SYS___PIVOT_ROOT_A = 0xDBF // 3519 + SYS_PRCTL = 0xDC0 // 3520 + SYS_PRLIMIT = 0xDC1 // 3521 + SYS_SETHOSTNAME = 0xDC2 // 3522 + SYS___SETHOSTNAME_A = 0xDC3 // 3523 + SYS_SETRESUID = 0xDC4 // 3524 + SYS_SETRESGID = 0xDC5 // 3525 + SYS_PTHREAD_CONDATTR_GETCLOCK = 0xDC6 // 3526 + SYS_FLOCK = 0xDC7 // 3527 + SYS_FGETXATTR = 0xDC8 // 3528 + SYS___FGETXATTR_A = 0xDC9 // 3529 + SYS_FLISTXATTR = 0xDCA // 3530 + SYS___FLISTXATTR_A = 0xDCB // 3531 + SYS_FREMOVEXATTR = 0xDCC // 3532 + SYS___FREMOVEXATTR_A = 0xDCD // 3533 + SYS_FSETXATTR = 0xDCE // 3534 + SYS___FSETXATTR_A = 0xDCF // 3535 + SYS_GETXATTR = 0xDD0 // 3536 + SYS___GETXATTR_A = 0xDD1 // 3537 + SYS_LGETXATTR = 0xDD2 // 3538 + SYS___LGETXATTR_A = 0xDD3 // 3539 + SYS_LISTXATTR = 0xDD4 // 3540 + SYS___LISTXATTR_A = 0xDD5 // 3541 + SYS_LLISTXATTR = 0xDD6 // 3542 + SYS___LLISTXATTR_A = 0xDD7 // 3543 + SYS_LREMOVEXATTR = 0xDD8 // 3544 + SYS___LREMOVEXATTR_A = 0xDD9 // 3545 + SYS_LSETXATTR = 0xDDA // 3546 + SYS___LSETXATTR_A = 0xDDB // 3547 + SYS_REMOVEXATTR = 0xDDC // 3548 + SYS___REMOVEXATTR_A = 0xDDD // 3549 + SYS_SETXATTR = 0xDDE // 3550 + SYS___SETXATTR_A = 0xDDF // 3551 + SYS_FDATASYNC = 0xDE0 // 3552 + SYS_SYNCFS = 0xDE1 // 3553 + SYS_FUTIMES = 0xDE2 // 3554 + SYS_FUTIMESAT = 0xDE3 // 3555 + SYS___FUTIMESAT_A = 0xDE4 // 3556 + SYS_LUTIMES = 0xDE5 // 3557 + SYS___LUTIMES_A = 0xDE6 // 3558 + SYS_INET_ATON = 0xDE7 // 3559 + SYS_GETRANDOM = 0xDE8 // 3560 + SYS_GETTID = 0xDE9 // 3561 + SYS_MEMFD_CREATE = 0xDEA // 3562 + SYS___MEMFD_CREATE_A = 0xDEB // 3563 + SYS_FACCESSAT = 0xDEC // 3564 + SYS___FACCESSAT_A = 0xDED // 3565 + SYS_FCHMODAT = 0xDEE // 3566 + SYS___FCHMODAT_A = 0xDEF // 3567 + SYS_FCHOWNAT = 0xDF0 // 3568 + SYS___FCHOWNAT_A = 0xDF1 // 3569 + SYS_FSTATAT = 0xDF2 // 3570 + SYS___FSTATAT_A = 0xDF3 // 3571 + SYS_LINKAT = 0xDF4 // 3572 + SYS___LINKAT_A = 0xDF5 // 3573 + SYS_MKDIRAT = 0xDF6 // 3574 + SYS___MKDIRAT_A = 0xDF7 // 3575 + SYS_MKFIFOAT = 0xDF8 // 3576 + SYS___MKFIFOAT_A = 0xDF9 // 3577 + SYS_MKNODAT = 0xDFA // 3578 + SYS___MKNODAT_A = 0xDFB // 3579 + SYS_OPENAT = 0xDFC // 3580 + SYS___OPENAT_A = 0xDFD // 3581 + SYS_READLINKAT = 0xDFE // 3582 + SYS___READLINKAT_A = 0xDFF // 3583 + SYS_RENAMEAT = 0xE00 // 3584 + SYS___RENAMEAT_A = 0xE01 // 3585 + SYS_RENAMEAT2 = 0xE02 // 3586 + SYS___RENAMEAT2_A = 0xE03 // 3587 + SYS_SYMLINKAT = 0xE04 // 3588 + SYS___SYMLINKAT_A = 0xE05 // 3589 + SYS_UNLINKAT = 0xE06 // 3590 + SYS___UNLINKAT_A = 0xE07 // 3591 + SYS_SYSINFO = 0xE08 // 3592 + SYS_WAIT4 = 0xE0A // 3594 + SYS_CLONE = 0xE0B // 3595 + SYS_UNSHARE = 0xE0C // 3596 + SYS_SETNS = 0xE0D // 3597 + SYS_CAPGET = 0xE0E // 3598 + SYS_CAPSET = 0xE0F // 3599 + SYS_STRCHRNUL = 0xE10 // 3600 + SYS_PTHREAD_CONDATTR_SETCLOCK = 0xE12 // 3602 + SYS_OPEN_BY_HANDLE_AT = 0xE13 // 3603 + SYS___OPEN_BY_HANDLE_AT_A = 0xE14 // 3604 + SYS___INET_ATON_A = 0xE15 // 3605 + SYS_MOUNT1 = 0xE16 // 3606 + SYS___MOUNT1_A = 0xE17 // 3607 + SYS_UMOUNT1 = 0xE18 // 3608 + SYS___UMOUNT1_A = 0xE19 // 3609 + SYS_UMOUNT2 = 0xE1A // 3610 + SYS___UMOUNT2_A = 0xE1B // 3611 + SYS___PRCTL_A = 0xE1C // 3612 + SYS_LOCALTIME_R2 = 0xE1D // 3613 + SYS___LOCALTIME_R2_A = 0xE1E // 3614 + SYS_OPENAT2 = 0xE1F // 3615 + SYS___OPENAT2_A = 0xE20 // 3616 + SYS___LE_CEEMICT = 0xE21 // 3617 + SYS_GETENTROPY = 0xE22 // 3618 + SYS_NANOSLEEP = 0xE23 // 3619 + SYS_UTIMENSAT = 0xE24 // 3620 + SYS___UTIMENSAT_A = 0xE25 // 3621 + SYS_ASPRINTF = 0xE26 // 3622 + SYS___ASPRINTF_A = 0xE27 // 3623 + SYS_VASPRINTF = 0xE28 // 3624 + SYS___VASPRINTF_A = 0xE29 // 3625 + SYS_DPRINTF = 0xE2A // 3626 + SYS___DPRINTF_A = 0xE2B // 3627 + SYS_GETOPT_LONG = 0xE2C // 3628 + SYS___GETOPT_LONG_A = 0xE2D // 3629 + SYS_PSIGNAL = 0xE2E // 3630 + SYS___PSIGNAL_A = 0xE2F // 3631 + SYS_PSIGNAL_UNLOCKED = 0xE30 // 3632 + SYS___PSIGNAL_UNLOCKED_A = 0xE31 // 3633 + SYS_FSTATAT_O = 0xE32 // 3634 + SYS___FSTATAT_O_A = 0xE33 // 3635 + SYS_FSTATAT64 = 0xE34 // 3636 + SYS___FSTATAT64_A = 0xE35 // 3637 + SYS___CHATTRAT = 0xE36 // 3638 + SYS_____CHATTRAT_A = 0xE37 // 3639 + SYS___CHATTRAT64 = 0xE38 // 3640 + SYS_____CHATTRAT64_A = 0xE39 // 3641 + SYS_MADVISE = 0xE3A // 3642 + SYS___AUTHENTICATE = 0xE3B // 3643 + ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index eff6bcde..0036746e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1178,7 +1178,8 @@ const ( PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 0x10 PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 0x11 PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT = 0x12 - PERF_SAMPLE_BRANCH_MAX_SHIFT = 0x13 + PERF_SAMPLE_BRANCH_COUNTERS = 0x80000 + PERF_SAMPLE_BRANCH_MAX_SHIFT = 0x14 PERF_SAMPLE_BRANCH_USER = 0x1 PERF_SAMPLE_BRANCH_KERNEL = 0x2 PERF_SAMPLE_BRANCH_HV = 0x4 @@ -1198,7 +1199,7 @@ const ( PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_SAMPLE_BRANCH_HW_INDEX = 0x20000 PERF_SAMPLE_BRANCH_PRIV_SAVE = 0x40000 - PERF_SAMPLE_BRANCH_MAX = 0x80000 + PERF_SAMPLE_BRANCH_MAX = 0x100000 PERF_BR_UNKNOWN = 0x0 PERF_BR_COND = 0x1 PERF_BR_UNCOND = 0x2 @@ -2481,6 +2482,15 @@ type XDPMmapOffsets struct { Cr XDPRingOffset } +type XDPUmemReg struct { + Addr uint64 + Len uint64 + Chunk_size uint32 + Headroom uint32 + Flags uint32 + Tx_metadata_len uint32 +} + type XDPStatistics struct { Rx_dropped uint64 Rx_invalid_descs uint64 @@ -2935,7 +2945,7 @@ const ( BPF_TCP_LISTEN = 0xa BPF_TCP_CLOSING = 0xb BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd + BPF_TCP_MAX_STATES = 0xe TCP_BPF_IW = 0x3e9 TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_BPF_DELACK_MAX = 0x3eb @@ -3211,7 +3221,7 @@ const ( DEVLINK_CMD_LINECARD_NEW = 0x50 DEVLINK_CMD_LINECARD_DEL = 0x51 DEVLINK_CMD_SELFTESTS_GET = 0x52 - DEVLINK_CMD_MAX = 0x53 + DEVLINK_CMD_MAX = 0x54 DEVLINK_PORT_TYPE_NOTSET = 0x0 DEVLINK_PORT_TYPE_AUTO = 0x1 DEVLINK_PORT_TYPE_ETH = 0x2 @@ -4595,7 +4605,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x146 + NL80211_ATTR_MAX = 0x149 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_MATCH_SETS = 0x85 @@ -4861,7 +4871,7 @@ const ( NL80211_BSS_FREQUENCY_OFFSET = 0x14 NL80211_BSS_INFORMATION_ELEMENTS = 0x6 NL80211_BSS_LAST_SEEN_BOOTTIME = 0xf - NL80211_BSS_MAX = 0x16 + NL80211_BSS_MAX = 0x18 NL80211_BSS_MLD_ADDR = 0x16 NL80211_BSS_MLO_LINK_ID = 0x15 NL80211_BSS_PAD = 0x10 @@ -4965,7 +4975,7 @@ const ( NL80211_CMD_LEAVE_IBSS = 0x2c NL80211_CMD_LEAVE_MESH = 0x45 NL80211_CMD_LEAVE_OCB = 0x6d - NL80211_CMD_MAX = 0x9a + NL80211_CMD_MAX = 0x9b NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29 NL80211_CMD_MODIFY_LINK_STA = 0x97 NL80211_CMD_NAN_MATCH = 0x78 @@ -5199,7 +5209,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x1c + NL80211_FREQUENCY_ATTR_MAX = 0x1f NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 438a30af..fd402da4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -477,14 +477,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index adceca35..eb7a5e18 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -492,15 +492,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index eeaa00a3..d78ac108 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -470,15 +470,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]uint8 Driver_name [64]uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 6739aa91..cd06d47f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -471,15 +471,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 9920ef63..2f28fe26 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -472,15 +472,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 2923b799..71d6cac2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -476,15 +476,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index ce2750ee..8596d453 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -474,15 +474,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 3038811d..cd60ea18 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -474,15 +474,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index efc6fed1..b0ae420c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -476,15 +476,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 9a654b75..83597287 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -482,15 +482,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]uint8 Driver_name [64]uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 40d358e3..69eb6a5c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -481,15 +481,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]uint8 Driver_name [64]uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 148c6ceb..5f583cb6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -481,15 +481,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]uint8 Driver_name [64]uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 72ba8154..15adc041 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -499,15 +499,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]uint8 Driver_name [64]uint8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 71e76550..cf3ce900 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -495,15 +495,6 @@ const ( BLKPG = 0x1269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 4abbdb9d..590b5673 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -476,15 +476,6 @@ const ( BLKPG = 0x20001269 ) -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 - Flags uint32 - _ [4]byte -} - type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index 54f31be6..d9a13af4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -25,10 +25,13 @@ const ( SizeofIPv6Mreq = 20 SizeofICMPv6Filter = 32 SizeofIPv6MTUInfo = 32 + SizeofInet4Pktinfo = 8 + SizeofInet6Pktinfo = 20 SizeofLinger = 8 SizeofSockaddrInet4 = 16 SizeofSockaddrInet6 = 28 SizeofTCPInfo = 0x68 + SizeofUcred = 12 ) type ( @@ -69,12 +72,17 @@ type Utimbuf struct { } type Utsname struct { - Sysname [65]byte - Nodename [65]byte - Release [65]byte - Version [65]byte - Machine [65]byte - Domainname [65]byte + Sysname [16]byte + Nodename [32]byte + Release [8]byte + Version [8]byte + Machine [16]byte +} + +type Ucred struct { + Pid int32 + Uid uint32 + Gid uint32 } type RawSockaddrInet4 struct { @@ -325,7 +333,7 @@ type Statvfs_t struct { } type Statfs_t struct { - Type uint32 + Type uint64 Bsize uint64 Blocks uint64 Bfree uint64 @@ -336,6 +344,7 @@ type Statfs_t struct { Namelen uint64 Frsize uint64 Flags uint64 + _ [4]uint64 } type direntLE struct { @@ -412,3 +421,126 @@ type W_Mntent struct { Quiesceowner [8]byte _ [38]byte } + +type EpollEvent struct { + Events uint32 + _ int32 + Fd int32 + Pad int32 +} + +type InotifyEvent struct { + Wd int32 + Mask uint32 + Cookie uint32 + Len uint32 + Name string +} + +const ( + SizeofInotifyEvent = 0x10 +) + +type ConsMsg2 struct { + Cm2Format uint16 + Cm2R1 uint16 + Cm2Msglength uint32 + Cm2Msg *byte + Cm2R2 [4]byte + Cm2R3 [4]byte + Cm2Routcde *uint32 + Cm2Descr *uint32 + Cm2Msgflag uint32 + Cm2Token uint32 + Cm2Msgid *uint32 + Cm2R4 [4]byte + Cm2DomToken uint32 + Cm2DomMsgid *uint32 + Cm2ModCartptr *byte + Cm2ModConsidptr *byte + Cm2MsgCart [8]byte + Cm2MsgConsid [4]byte + Cm2R5 [12]byte +} + +const ( + CC_modify = 1 + CC_stop = 2 + CONSOLE_FORMAT_2 = 2 + CONSOLE_FORMAT_3 = 3 + CONSOLE_HRDCPY = 0x80000000 +) + +type OpenHow struct { + Flags uint64 + Mode uint64 + Resolve uint64 +} + +const SizeofOpenHow = 0x18 + +const ( + RESOLVE_CACHED = 0x20 + RESOLVE_BENEATH = 0x8 + RESOLVE_IN_ROOT = 0x10 + RESOLVE_NO_MAGICLINKS = 0x2 + RESOLVE_NO_SYMLINKS = 0x4 + RESOLVE_NO_XDEV = 0x1 +) + +type Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + _ [44]byte +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode int32 +} + +type SysvShmDesc struct { + Perm SysvIpcPerm + _ [4]byte + Lpid int32 + Cpid int32 + Nattch uint32 + _ [4]byte + _ [4]byte + _ [4]byte + _ int32 + _ uint8 + _ uint8 + _ uint16 + _ *byte + Segsz uint64 + Atime Time_t + Dtime Time_t + Ctime Time_t +} + +type SysvShmDesc64 struct { + Perm SysvIpcPerm + _ [4]byte + Lpid int32 + Cpid int32 + Nattch uint32 + _ [4]byte + _ [4]byte + _ [4]byte + _ int32 + _ byte + _ uint8 + _ uint16 + _ *byte + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 +} diff --git a/vendor/golang.org/x/sys/windows/aliases.go b/vendor/golang.org/x/sys/windows/aliases.go index ce2d713d..16f90560 100644 --- a/vendor/golang.org/x/sys/windows/aliases.go +++ b/vendor/golang.org/x/sys/windows/aliases.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build windows && go1.9 +//go:build windows package windows diff --git a/vendor/golang.org/x/sys/windows/empty.s b/vendor/golang.org/x/sys/windows/empty.s deleted file mode 100644 index ba64caca..00000000 --- a/vendor/golang.org/x/sys/windows/empty.s +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.12 - -// This file is here to allow bodyless functions with go:linkname for Go 1.11 -// and earlier (see https://golang.org/issue/23311). diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 6395a031..6525c62f 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -165,6 +165,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW //sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) +//sys DisconnectNamedPipe(pipe Handle) (err error) //sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) //sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW //sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState @@ -348,8 +349,19 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost //sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) //sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) +//sys ClearCommBreak(handle Handle) (err error) +//sys ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) +//sys EscapeCommFunction(handle Handle, dwFunc uint32) (err error) +//sys GetCommState(handle Handle, lpDCB *DCB) (err error) +//sys GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) //sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys PurgeComm(handle Handle, dwFlags uint32) (err error) +//sys SetCommBreak(handle Handle) (err error) +//sys SetCommMask(handle Handle, dwEvtMask uint32) (err error) +//sys SetCommState(handle Handle, lpDCB *DCB) (err error) //sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) +//sys WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) //sys GetActiveProcessorCount(groupNumber uint16) (ret uint32) //sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32) //sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows @@ -1834,3 +1846,73 @@ func ResizePseudoConsole(pconsole Handle, size Coord) error { // accept arguments that can be casted to uintptr, and Coord can't. return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size)))) } + +// DCB constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb. +const ( + CBR_110 = 110 + CBR_300 = 300 + CBR_600 = 600 + CBR_1200 = 1200 + CBR_2400 = 2400 + CBR_4800 = 4800 + CBR_9600 = 9600 + CBR_14400 = 14400 + CBR_19200 = 19200 + CBR_38400 = 38400 + CBR_57600 = 57600 + CBR_115200 = 115200 + CBR_128000 = 128000 + CBR_256000 = 256000 + + DTR_CONTROL_DISABLE = 0x00000000 + DTR_CONTROL_ENABLE = 0x00000010 + DTR_CONTROL_HANDSHAKE = 0x00000020 + + RTS_CONTROL_DISABLE = 0x00000000 + RTS_CONTROL_ENABLE = 0x00001000 + RTS_CONTROL_HANDSHAKE = 0x00002000 + RTS_CONTROL_TOGGLE = 0x00003000 + + NOPARITY = 0 + ODDPARITY = 1 + EVENPARITY = 2 + MARKPARITY = 3 + SPACEPARITY = 4 + + ONESTOPBIT = 0 + ONE5STOPBITS = 1 + TWOSTOPBITS = 2 +) + +// EscapeCommFunction constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction. +const ( + SETXOFF = 1 + SETXON = 2 + SETRTS = 3 + CLRRTS = 4 + SETDTR = 5 + CLRDTR = 6 + SETBREAK = 8 + CLRBREAK = 9 +) + +// PurgeComm constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-purgecomm. +const ( + PURGE_TXABORT = 0x0001 + PURGE_RXABORT = 0x0002 + PURGE_TXCLEAR = 0x0004 + PURGE_RXCLEAR = 0x0008 +) + +// SetCommMask constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcommmask. +const ( + EV_RXCHAR = 0x0001 + EV_RXFLAG = 0x0002 + EV_TXEMPTY = 0x0004 + EV_CTS = 0x0008 + EV_DSR = 0x0010 + EV_RLSD = 0x0020 + EV_BREAK = 0x0040 + EV_ERR = 0x0080 + EV_RING = 0x0100 +) diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 359780f6..d8cb71db 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -3380,3 +3380,27 @@ type BLOB struct { Size uint32 BlobData *byte } + +type ComStat struct { + Flags uint32 + CBInQue uint32 + CBOutQue uint32 +} + +type DCB struct { + DCBlength uint32 + BaudRate uint32 + Flags uint32 + wReserved uint16 + XonLim uint16 + XoffLim uint16 + ByteSize uint8 + Parity uint8 + StopBits uint8 + XonChar byte + XoffChar byte + ErrorChar byte + EofChar byte + EvtChar byte + wReserved1 uint16 +} diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index e8791c82..5c6035dd 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -188,6 +188,8 @@ var ( procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") procCancelIo = modkernel32.NewProc("CancelIo") procCancelIoEx = modkernel32.NewProc("CancelIoEx") + procClearCommBreak = modkernel32.NewProc("ClearCommBreak") + procClearCommError = modkernel32.NewProc("ClearCommError") procCloseHandle = modkernel32.NewProc("CloseHandle") procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole") procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") @@ -212,7 +214,9 @@ var ( procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList") procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") + procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") + procEscapeCommFunction = modkernel32.NewProc("EscapeCommFunction") procExitProcess = modkernel32.NewProc("ExitProcess") procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") procFindClose = modkernel32.NewProc("FindClose") @@ -236,6 +240,8 @@ var ( procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") procGetACP = modkernel32.NewProc("GetACP") procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount") + procGetCommModemStatus = modkernel32.NewProc("GetCommModemStatus") + procGetCommState = modkernel32.NewProc("GetCommState") procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts") procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") @@ -322,6 +328,7 @@ var ( procProcess32NextW = modkernel32.NewProc("Process32NextW") procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId") procPulseEvent = modkernel32.NewProc("PulseEvent") + procPurgeComm = modkernel32.NewProc("PurgeComm") procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW") procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject") @@ -335,6 +342,9 @@ var ( procResetEvent = modkernel32.NewProc("ResetEvent") procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole") procResumeThread = modkernel32.NewProc("ResumeThread") + procSetCommBreak = modkernel32.NewProc("SetCommBreak") + procSetCommMask = modkernel32.NewProc("SetCommMask") + procSetCommState = modkernel32.NewProc("SetCommState") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") @@ -342,7 +352,6 @@ var ( procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") - procSetFileValidData = modkernel32.NewProc("SetFileValidData") procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") procSetErrorMode = modkernel32.NewProc("SetErrorMode") procSetEvent = modkernel32.NewProc("SetEvent") @@ -351,6 +360,7 @@ var ( procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle") procSetFilePointer = modkernel32.NewProc("SetFilePointer") procSetFileTime = modkernel32.NewProc("SetFileTime") + procSetFileValidData = modkernel32.NewProc("SetFileValidData") procSetHandleInformation = modkernel32.NewProc("SetHandleInformation") procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState") @@ -361,6 +371,7 @@ var ( procSetStdHandle = modkernel32.NewProc("SetStdHandle") procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") + procSetupComm = modkernel32.NewProc("SetupComm") procSizeofResource = modkernel32.NewProc("SizeofResource") procSleepEx = modkernel32.NewProc("SleepEx") procTerminateJobObject = modkernel32.NewProc("TerminateJobObject") @@ -379,6 +390,7 @@ var ( procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx") procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId") + procWaitCommEvent = modkernel32.NewProc("WaitCommEvent") procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") @@ -1641,6 +1653,22 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { return } +func ClearCommBreak(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) { + r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CloseHandle(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { @@ -1845,6 +1873,14 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff return } +func DisconnectNamedPipe(pipe Handle) (err error) { + r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { var _p0 uint32 if bInheritHandle { @@ -1857,6 +1893,14 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP return } +func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { + r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func ExitProcess(exitcode uint32) { syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) return @@ -2058,6 +2102,22 @@ func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { return } +func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetCommState(handle Handle, lpDCB *DCB) (err error) { + r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { @@ -2810,6 +2870,14 @@ func PulseEvent(event Handle) (err error) { return } +func PurgeComm(handle Handle, dwFlags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) n = uint32(r0) @@ -2924,6 +2992,30 @@ func ResumeThread(thread Handle) (ret uint32, err error) { return } +func SetCommBreak(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetCommState(handle Handle, lpDCB *DCB) (err error) { + r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { @@ -2989,14 +3081,6 @@ func SetEndOfFile(handle Handle) (err error) { return } -func SetFileValidData(handle Handle, validDataLength int64) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) if r1 == 0 { @@ -3060,6 +3144,14 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim return } +func SetFileValidData(handle Handle, validDataLength int64) (err error) { + r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { @@ -3145,6 +3237,14 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro return } +func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) size = uint32(r0) @@ -3291,6 +3391,14 @@ func WTSGetActiveConsoleSessionId() (sessionID uint32) { return } +func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { var _p0 uint32 if waitAll { diff --git a/vendor/modernc.org/libc/AUTHORS b/vendor/modernc.org/libc/AUTHORS index bba82908..cd921661 100644 --- a/vendor/modernc.org/libc/AUTHORS +++ b/vendor/modernc.org/libc/AUTHORS @@ -14,4 +14,5 @@ Jan Mercl <0xjnml@gmail.com> Jason DeBettencourt Koichi Shiraishi Marius Orcsik +Scot C Bontrager Steffen Butzer diff --git a/vendor/modernc.org/libc/CONTRIBUTORS b/vendor/modernc.org/libc/CONTRIBUTORS index 2bed7daf..9e66e215 100644 --- a/vendor/modernc.org/libc/CONTRIBUTORS +++ b/vendor/modernc.org/libc/CONTRIBUTORS @@ -13,5 +13,6 @@ Jan Mercl <0xjnml@gmail.com> Jason DeBettencourt Koichi Shiraishi Marius Orcsik +Scot C Bontrager Steffen Butzer ZHU Zijia diff --git a/vendor/modernc.org/libc/builder.json b/vendor/modernc.org/libc/builder.json index 25d60127..6b9f4177 100644 --- a/vendor/modernc.org/libc/builder.json +++ b/vendor/modernc.org/libc/builder.json @@ -1,9 +1,9 @@ { "autogen": "linux/(amd64|loong64)", "autoupdate": "", - "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)", + "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64)", "download": [ {"re": "linux/(amd64|loong64)", "files": ["https://git.musl-libc.org/cgit/musl/snapshot/musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz"]} ], - "test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)" + "test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64)" } diff --git a/vendor/modernc.org/libc/ccgo_linux_amd64.go b/vendor/modernc.org/libc/ccgo_linux_amd64.go index bd7c6b9c..d01d173f 100644 --- a/vendor/modernc.org/libc/ccgo_linux_amd64.go +++ b/vendor/modernc.org/libc/ccgo_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated for linux/amd64 by 'gcc --package-name=libc --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -emit-func-aliases -eval-all-macros -extended-errors -ignore-asm-errors -isystem -mlong-double-64 -std=c99 -nostdinc -ffreestanding -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -DNDEBUG -nostdlib -shared -o lib/libc.so.go obj/src/complex/__cexp.lo.go obj/src/complex/__cexpf.lo.go obj/src/complex/cabs.lo.go obj/src/complex/cabsf.lo.go obj/src/complex/cabsl.lo.go obj/src/complex/cacos.lo.go obj/src/complex/cacosf.lo.go obj/src/complex/cacosh.lo.go obj/src/complex/cacoshf.lo.go obj/src/complex/cacoshl.lo.go obj/src/complex/cacosl.lo.go obj/src/complex/carg.lo.go obj/src/complex/cargf.lo.go obj/src/complex/cargl.lo.go obj/src/complex/casin.lo.go obj/src/complex/casinf.lo.go obj/src/complex/casinh.lo.go obj/src/complex/casinhf.lo.go obj/src/complex/casinhl.lo.go obj/src/complex/casinl.lo.go obj/src/complex/catan.lo.go obj/src/complex/catanf.lo.go obj/src/complex/catanh.lo.go obj/src/complex/catanhf.lo.go obj/src/complex/catanhl.lo.go obj/src/complex/catanl.lo.go obj/src/complex/ccos.lo.go obj/src/complex/ccosf.lo.go obj/src/complex/ccosh.lo.go obj/src/complex/ccoshf.lo.go obj/src/complex/ccoshl.lo.go obj/src/complex/ccosl.lo.go obj/src/complex/cexp.lo.go obj/src/complex/cexpf.lo.go obj/src/complex/cexpl.lo.go obj/src/complex/cimag.lo.go obj/src/complex/cimagf.lo.go obj/src/complex/cimagl.lo.go obj/src/complex/clog.lo.go obj/src/complex/clogf.lo.go obj/src/complex/clogl.lo.go obj/src/complex/conj.lo.go obj/src/complex/conjf.lo.go obj/src/complex/conjl.lo.go obj/src/complex/cpow.lo.go obj/src/complex/cpowf.lo.go obj/src/complex/cpowl.lo.go obj/src/complex/cproj.lo.go obj/src/complex/cprojf.lo.go obj/src/complex/cprojl.lo.go obj/src/complex/creal.lo.go obj/src/complex/crealf.lo.go obj/src/complex/creall.lo.go obj/src/complex/csin.lo.go obj/src/complex/csinf.lo.go obj/src/complex/csinh.lo.go obj/src/complex/csinhf.lo.go obj/src/complex/csinhl.lo.go obj/src/complex/csinl.lo.go obj/src/complex/csqrt.lo.go obj/src/complex/csqrtf.lo.go obj/src/complex/csqrtl.lo.go obj/src/complex/ctan.lo.go obj/src/complex/ctanf.lo.go obj/src/complex/ctanh.lo.go obj/src/complex/ctanhf.lo.go obj/src/complex/ctanhl.lo.go obj/src/complex/ctanl.lo.go obj/src/conf/confstr.lo.go obj/src/conf/fpathconf.lo.go obj/src/conf/legacy.lo.go obj/src/conf/pathconf.lo.go obj/src/conf/sysconf.lo.go obj/src/crypt/crypt.lo.go obj/src/crypt/crypt_blowfish.lo.go obj/src/crypt/crypt_des.lo.go obj/src/crypt/crypt_md5.lo.go obj/src/crypt/crypt_r.lo.go obj/src/crypt/crypt_sha256.lo.go obj/src/crypt/crypt_sha512.lo.go obj/src/crypt/encrypt.lo.go obj/src/ctype/__ctype_b_loc.lo.go obj/src/ctype/__ctype_get_mb_cur_max.lo.go obj/src/ctype/__ctype_tolower_loc.lo.go obj/src/ctype/__ctype_toupper_loc.lo.go obj/src/ctype/isalnum.lo.go obj/src/ctype/isalpha.lo.go obj/src/ctype/isascii.lo.go obj/src/ctype/isblank.lo.go obj/src/ctype/iscntrl.lo.go obj/src/ctype/isdigit.lo.go obj/src/ctype/isgraph.lo.go obj/src/ctype/islower.lo.go obj/src/ctype/isprint.lo.go obj/src/ctype/ispunct.lo.go obj/src/ctype/isspace.lo.go obj/src/ctype/isupper.lo.go obj/src/ctype/iswalnum.lo.go obj/src/ctype/iswalpha.lo.go obj/src/ctype/iswblank.lo.go obj/src/ctype/iswcntrl.lo.go obj/src/ctype/iswctype.lo.go obj/src/ctype/iswdigit.lo.go obj/src/ctype/iswgraph.lo.go obj/src/ctype/iswlower.lo.go obj/src/ctype/iswprint.lo.go obj/src/ctype/iswpunct.lo.go obj/src/ctype/iswspace.lo.go obj/src/ctype/iswupper.lo.go obj/src/ctype/iswxdigit.lo.go obj/src/ctype/isxdigit.lo.go obj/src/ctype/toascii.lo.go obj/src/ctype/tolower.lo.go obj/src/ctype/toupper.lo.go obj/src/ctype/towctrans.lo.go obj/src/ctype/wcswidth.lo.go obj/src/ctype/wctrans.lo.go obj/src/ctype/wcwidth.lo.go obj/src/dirent/alphasort.lo.go obj/src/dirent/closedir.lo.go obj/src/dirent/dirfd.lo.go obj/src/dirent/fdopendir.lo.go obj/src/dirent/opendir.lo.go obj/src/dirent/readdir.lo.go obj/src/dirent/readdir_r.lo.go obj/src/dirent/rewinddir.lo.go obj/src/dirent/scandir.lo.go obj/src/dirent/seekdir.lo.go obj/src/dirent/telldir.lo.go obj/src/dirent/versionsort.lo.go obj/src/env/__environ.lo.go obj/src/env/__reset_tls.lo.go obj/src/env/__stack_chk_fail.lo.go obj/src/env/clearenv.lo.go obj/src/env/getenv.lo.go obj/src/env/putenv.lo.go obj/src/env/secure_getenv.lo.go obj/src/env/setenv.lo.go obj/src/env/unsetenv.lo.go obj/src/errno/strerror.lo.go obj/src/exit/_Exit.lo.go obj/src/exit/abort_lock.lo.go obj/src/exit/assert.lo.go obj/src/exit/at_quick_exit.lo.go obj/src/exit/quick_exit.lo.go obj/src/fcntl/creat.lo.go obj/src/fcntl/fcntl.lo.go obj/src/fcntl/open.lo.go obj/src/fcntl/openat.lo.go obj/src/fcntl/posix_fadvise.lo.go obj/src/fcntl/posix_fallocate.lo.go obj/src/fenv/fenv.lo.go obj/src/internal/defsysinfo.lo.go obj/src/internal/emulate_wait4.lo.go obj/src/internal/floatscan.lo.go obj/src/internal/intscan.lo.go obj/src/internal/libc.lo.go obj/src/internal/procfdname.lo.go obj/src/internal/shgetc.lo.go obj/src/internal/syscall_ret.lo.go obj/src/internal/vdso.lo.go obj/src/internal/version.lo.go obj/src/ipc/ftok.lo.go obj/src/ipc/msgctl.lo.go obj/src/ipc/msgget.lo.go obj/src/ipc/msgrcv.lo.go obj/src/ipc/msgsnd.lo.go obj/src/ipc/semctl.lo.go obj/src/ipc/semget.lo.go obj/src/ipc/semop.lo.go obj/src/ipc/semtimedop.lo.go obj/src/ipc/shmat.lo.go obj/src/ipc/shmctl.lo.go obj/src/ipc/shmdt.lo.go obj/src/ipc/shmget.lo.go obj/src/linux/adjtime.lo.go obj/src/linux/adjtimex.lo.go obj/src/linux/arch_prctl.lo.go obj/src/linux/brk.lo.go obj/src/linux/cache.lo.go obj/src/linux/cap.lo.go obj/src/linux/chroot.lo.go obj/src/linux/clock_adjtime.lo.go obj/src/linux/copy_file_range.lo.go obj/src/linux/epoll.lo.go obj/src/linux/eventfd.lo.go obj/src/linux/fallocate.lo.go obj/src/linux/fanotify.lo.go obj/src/linux/flock.lo.go obj/src/linux/getdents.lo.go obj/src/linux/getrandom.lo.go obj/src/linux/inotify.lo.go obj/src/linux/ioperm.lo.go obj/src/linux/iopl.lo.go obj/src/linux/klogctl.lo.go obj/src/linux/memfd_create.lo.go obj/src/linux/mlock2.lo.go obj/src/linux/module.lo.go obj/src/linux/mount.lo.go obj/src/linux/name_to_handle_at.lo.go obj/src/linux/open_by_handle_at.lo.go obj/src/linux/personality.lo.go obj/src/linux/pivot_root.lo.go obj/src/linux/prctl.lo.go obj/src/linux/preadv2.lo.go obj/src/linux/prlimit.lo.go obj/src/linux/process_vm.lo.go obj/src/linux/ptrace.lo.go obj/src/linux/pwritev2.lo.go obj/src/linux/quotactl.lo.go obj/src/linux/readahead.lo.go obj/src/linux/reboot.lo.go obj/src/linux/remap_file_pages.lo.go obj/src/linux/sbrk.lo.go obj/src/linux/sendfile.lo.go obj/src/linux/setfsgid.lo.go obj/src/linux/setfsuid.lo.go obj/src/linux/sethostname.lo.go obj/src/linux/setns.lo.go obj/src/linux/settimeofday.lo.go obj/src/linux/signalfd.lo.go obj/src/linux/splice.lo.go obj/src/linux/statx.lo.go obj/src/linux/stime.lo.go obj/src/linux/swap.lo.go obj/src/linux/sync_file_range.lo.go obj/src/linux/syncfs.lo.go obj/src/linux/sysinfo.lo.go obj/src/linux/tee.lo.go obj/src/linux/timerfd.lo.go obj/src/linux/unshare.lo.go obj/src/linux/utimes.lo.go obj/src/linux/vhangup.lo.go obj/src/linux/vmsplice.lo.go obj/src/linux/wait3.lo.go obj/src/linux/wait4.lo.go obj/src/linux/xattr.lo.go obj/src/locale/__lctrans.lo.go obj/src/locale/__mo_lookup.lo.go obj/src/locale/bind_textdomain_codeset.lo.go obj/src/locale/c_locale.lo.go obj/src/locale/catclose.lo.go obj/src/locale/catgets.lo.go obj/src/locale/catopen.lo.go obj/src/locale/dcngettext.lo.go obj/src/locale/duplocale.lo.go obj/src/locale/freelocale.lo.go obj/src/locale/iconv.lo.go obj/src/locale/iconv_close.lo.go obj/src/locale/langinfo.lo.go obj/src/locale/locale_map.lo.go obj/src/locale/localeconv.lo.go obj/src/locale/newlocale.lo.go obj/src/locale/pleval.lo.go obj/src/locale/setlocale.lo.go obj/src/locale/strcoll.lo.go obj/src/locale/strfmon.lo.go obj/src/locale/strtod_l.lo.go obj/src/locale/strxfrm.lo.go obj/src/locale/textdomain.lo.go obj/src/locale/uselocale.lo.go obj/src/locale/wcscoll.lo.go obj/src/locale/wcsxfrm.lo.go obj/src/malloc/reallocarray.lo.go obj/src/math/__cos.lo.go obj/src/math/__cosdf.lo.go obj/src/math/__cosl.lo.go obj/src/math/__expo2.lo.go obj/src/math/__expo2f.lo.go obj/src/math/__fpclassify.lo.go obj/src/math/__fpclassifyf.lo.go obj/src/math/__fpclassifyl.lo.go obj/src/math/__invtrigl.lo.go obj/src/math/__math_divzero.lo.go obj/src/math/__math_divzerof.lo.go obj/src/math/__math_invalid.lo.go obj/src/math/__math_invalidf.lo.go obj/src/math/__math_invalidl.lo.go obj/src/math/__math_oflow.lo.go obj/src/math/__math_oflowf.lo.go obj/src/math/__math_uflow.lo.go obj/src/math/__math_uflowf.lo.go obj/src/math/__math_xflow.lo.go obj/src/math/__math_xflowf.lo.go obj/src/math/__polevll.lo.go obj/src/math/__rem_pio2.lo.go obj/src/math/__rem_pio2_large.lo.go obj/src/math/__rem_pio2f.lo.go obj/src/math/__rem_pio2l.lo.go obj/src/math/__signbit.lo.go obj/src/math/__signbitf.lo.go obj/src/math/__signbitl.lo.go obj/src/math/__sin.lo.go obj/src/math/__sindf.lo.go obj/src/math/__sinl.lo.go obj/src/math/__tan.lo.go obj/src/math/__tandf.lo.go obj/src/math/__tanl.lo.go obj/src/math/acos.lo.go obj/src/math/acosf.lo.go obj/src/math/acosh.lo.go obj/src/math/acoshf.lo.go obj/src/math/acoshl.lo.go obj/src/math/acosl.lo.go obj/src/math/asin.lo.go obj/src/math/asinf.lo.go obj/src/math/asinh.lo.go obj/src/math/asinhf.lo.go obj/src/math/asinhl.lo.go obj/src/math/asinl.lo.go obj/src/math/atan.lo.go obj/src/math/atan2.lo.go obj/src/math/atan2f.lo.go obj/src/math/atan2l.lo.go obj/src/math/atanf.lo.go obj/src/math/atanh.lo.go obj/src/math/atanhf.lo.go obj/src/math/atanhl.lo.go obj/src/math/atanl.lo.go obj/src/math/cbrt.lo.go obj/src/math/cbrtf.lo.go obj/src/math/cbrtl.lo.go obj/src/math/ceil.lo.go obj/src/math/ceilf.lo.go obj/src/math/ceill.lo.go obj/src/math/copysign.lo.go obj/src/math/copysignf.lo.go obj/src/math/copysignl.lo.go obj/src/math/cos.lo.go obj/src/math/cosf.lo.go obj/src/math/cosh.lo.go obj/src/math/coshf.lo.go obj/src/math/coshl.lo.go obj/src/math/cosl.lo.go obj/src/math/erf.lo.go obj/src/math/erff.lo.go obj/src/math/erfl.lo.go obj/src/math/exp.lo.go obj/src/math/exp10.lo.go obj/src/math/exp10f.lo.go obj/src/math/exp10l.lo.go obj/src/math/exp2.lo.go obj/src/math/exp2f.lo.go obj/src/math/exp2f_data.lo.go obj/src/math/exp2l.lo.go obj/src/math/exp_data.lo.go obj/src/math/expf.lo.go obj/src/math/expl.lo.go obj/src/math/expm1.lo.go obj/src/math/expm1f.lo.go obj/src/math/expm1l.lo.go obj/src/math/fabs.lo.go obj/src/math/fabsf.lo.go obj/src/math/fabsl.lo.go obj/src/math/fdim.lo.go obj/src/math/fdimf.lo.go obj/src/math/fdiml.lo.go obj/src/math/finite.lo.go obj/src/math/finitef.lo.go obj/src/math/floor.lo.go obj/src/math/floorf.lo.go obj/src/math/floorl.lo.go obj/src/math/fma.lo.go obj/src/math/fmal.lo.go obj/src/math/fmax.lo.go obj/src/math/fmaxf.lo.go obj/src/math/fmaxl.lo.go obj/src/math/fmin.lo.go obj/src/math/fminf.lo.go obj/src/math/fminl.lo.go obj/src/math/fmod.lo.go obj/src/math/fmodf.lo.go obj/src/math/fmodl.lo.go obj/src/math/frexp.lo.go obj/src/math/frexpf.lo.go obj/src/math/frexpl.lo.go obj/src/math/hypot.lo.go obj/src/math/hypotf.lo.go obj/src/math/hypotl.lo.go obj/src/math/ilogb.lo.go obj/src/math/ilogbf.lo.go obj/src/math/ilogbl.lo.go obj/src/math/j0.lo.go obj/src/math/j0f.lo.go obj/src/math/j1.lo.go obj/src/math/j1f.lo.go obj/src/math/jn.lo.go obj/src/math/jnf.lo.go obj/src/math/ldexp.lo.go obj/src/math/ldexpf.lo.go obj/src/math/ldexpl.lo.go obj/src/math/lgamma.lo.go obj/src/math/lgamma_r.lo.go obj/src/math/lgammaf.lo.go obj/src/math/lgammaf_r.lo.go obj/src/math/lgammal.lo.go obj/src/math/llrint.lo.go obj/src/math/llrintf.lo.go obj/src/math/llrintl.lo.go obj/src/math/llround.lo.go obj/src/math/llroundf.lo.go obj/src/math/llroundl.lo.go obj/src/math/log.lo.go obj/src/math/log10.lo.go obj/src/math/log10f.lo.go obj/src/math/log10l.lo.go obj/src/math/log1p.lo.go obj/src/math/log1pf.lo.go obj/src/math/log1pl.lo.go obj/src/math/log2.lo.go obj/src/math/log2_data.lo.go obj/src/math/log2f.lo.go obj/src/math/log2f_data.lo.go obj/src/math/log2l.lo.go obj/src/math/log_data.lo.go obj/src/math/logb.lo.go obj/src/math/logbf.lo.go obj/src/math/logbl.lo.go obj/src/math/logf.lo.go obj/src/math/logf_data.lo.go obj/src/math/logl.lo.go obj/src/math/lrint.lo.go obj/src/math/lrintf.lo.go obj/src/math/lrintl.lo.go obj/src/math/lround.lo.go obj/src/math/lroundf.lo.go obj/src/math/lroundl.lo.go obj/src/math/modf.lo.go obj/src/math/modff.lo.go obj/src/math/modfl.lo.go obj/src/math/nan.lo.go obj/src/math/nanf.lo.go obj/src/math/nanl.lo.go obj/src/math/nextafter.lo.go obj/src/math/nextafterf.lo.go obj/src/math/nextafterl.lo.go obj/src/math/nexttoward.lo.go obj/src/math/nexttowardf.lo.go obj/src/math/nexttowardl.lo.go obj/src/math/pow.lo.go obj/src/math/pow_data.lo.go obj/src/math/powf.lo.go obj/src/math/powf_data.lo.go obj/src/math/powl.lo.go obj/src/math/remainder.lo.go obj/src/math/remainderf.lo.go obj/src/math/remainderl.lo.go obj/src/math/remquo.lo.go obj/src/math/remquof.lo.go obj/src/math/remquol.lo.go obj/src/math/rint.lo.go obj/src/math/rintf.lo.go obj/src/math/rintl.lo.go obj/src/math/round.lo.go obj/src/math/roundf.lo.go obj/src/math/roundl.lo.go obj/src/math/scalb.lo.go obj/src/math/scalbf.lo.go obj/src/math/scalbln.lo.go obj/src/math/scalblnf.lo.go obj/src/math/scalblnl.lo.go obj/src/math/scalbn.lo.go obj/src/math/scalbnf.lo.go obj/src/math/scalbnl.lo.go obj/src/math/signgam.lo.go obj/src/math/significand.lo.go obj/src/math/significandf.lo.go obj/src/math/sin.lo.go obj/src/math/sincos.lo.go obj/src/math/sincosf.lo.go obj/src/math/sincosl.lo.go obj/src/math/sinf.lo.go obj/src/math/sinh.lo.go obj/src/math/sinhf.lo.go obj/src/math/sinhl.lo.go obj/src/math/sinl.lo.go obj/src/math/sqrt.lo.go obj/src/math/sqrt_data.lo.go obj/src/math/sqrtf.lo.go obj/src/math/sqrtl.lo.go obj/src/math/tan.lo.go obj/src/math/tanf.lo.go obj/src/math/tanh.lo.go obj/src/math/tanhf.lo.go obj/src/math/tanhl.lo.go obj/src/math/tanl.lo.go obj/src/math/tgamma.lo.go obj/src/math/tgammaf.lo.go obj/src/math/tgammal.lo.go obj/src/math/trunc.lo.go obj/src/math/truncf.lo.go obj/src/math/truncl.lo.go obj/src/misc/a64l.lo.go obj/src/misc/basename.lo.go obj/src/misc/dirname.lo.go obj/src/misc/ffs.lo.go obj/src/misc/ffsl.lo.go obj/src/misc/ffsll.lo.go obj/src/misc/fmtmsg.lo.go obj/src/misc/get_current_dir_name.lo.go obj/src/misc/getauxval.lo.go obj/src/misc/getdomainname.lo.go obj/src/misc/getentropy.lo.go obj/src/misc/gethostid.lo.go obj/src/misc/getopt.lo.go obj/src/misc/getopt_long.lo.go obj/src/misc/getpriority.lo.go obj/src/misc/getresgid.lo.go obj/src/misc/getresuid.lo.go obj/src/misc/getrlimit.lo.go obj/src/misc/getrusage.lo.go obj/src/misc/getsubopt.lo.go obj/src/misc/ioctl.lo.go obj/src/misc/issetugid.lo.go obj/src/misc/lockf.lo.go obj/src/misc/login_tty.lo.go obj/src/misc/mntent.lo.go obj/src/misc/nftw.lo.go obj/src/misc/openpty.lo.go obj/src/misc/ptsname.lo.go obj/src/misc/pty.lo.go obj/src/misc/realpath.lo.go obj/src/misc/setdomainname.lo.go obj/src/misc/setpriority.lo.go obj/src/misc/setrlimit.lo.go obj/src/misc/syscall.lo.go obj/src/misc/syslog.lo.go obj/src/misc/uname.lo.go obj/src/mman/madvise.lo.go obj/src/mman/mincore.lo.go obj/src/mman/mlock.lo.go obj/src/mman/mlockall.lo.go obj/src/mman/mmap.lo.go obj/src/mman/mprotect.lo.go obj/src/mman/mremap.lo.go obj/src/mman/msync.lo.go obj/src/mman/munlock.lo.go obj/src/mman/munlockall.lo.go obj/src/mman/munmap.lo.go obj/src/mman/posix_madvise.lo.go obj/src/mman/shm_open.lo.go obj/src/multibyte/btowc.lo.go obj/src/multibyte/c16rtomb.lo.go obj/src/multibyte/c32rtomb.lo.go obj/src/multibyte/internal.lo.go obj/src/multibyte/mblen.lo.go obj/src/multibyte/mbrlen.lo.go obj/src/multibyte/mbrtoc16.lo.go obj/src/multibyte/mbrtoc32.lo.go obj/src/multibyte/mbrtowc.lo.go obj/src/multibyte/mbsinit.lo.go obj/src/multibyte/mbsnrtowcs.lo.go obj/src/multibyte/mbsrtowcs.lo.go obj/src/multibyte/mbstowcs.lo.go obj/src/multibyte/mbtowc.lo.go obj/src/multibyte/wcrtomb.lo.go obj/src/multibyte/wcsnrtombs.lo.go obj/src/multibyte/wcsrtombs.lo.go obj/src/multibyte/wcstombs.lo.go obj/src/multibyte/wctob.lo.go obj/src/multibyte/wctomb.lo.go obj/src/network/accept.lo.go obj/src/network/accept4.lo.go obj/src/network/bind.lo.go obj/src/network/connect.lo.go obj/src/network/dn_comp.lo.go obj/src/network/dn_expand.lo.go obj/src/network/dn_skipname.lo.go obj/src/network/dns_parse.lo.go obj/src/network/ent.lo.go obj/src/network/ether.lo.go obj/src/network/freeaddrinfo.lo.go obj/src/network/gai_strerror.lo.go obj/src/network/getaddrinfo.lo.go obj/src/network/gethostbyaddr.lo.go obj/src/network/gethostbyaddr_r.lo.go obj/src/network/gethostbyname.lo.go obj/src/network/gethostbyname2.lo.go obj/src/network/gethostbyname2_r.lo.go obj/src/network/gethostbyname_r.lo.go obj/src/network/getifaddrs.lo.go obj/src/network/getnameinfo.lo.go obj/src/network/getpeername.lo.go obj/src/network/getservbyname.lo.go obj/src/network/getservbyname_r.lo.go obj/src/network/getsockname.lo.go obj/src/network/getsockopt.lo.go obj/src/network/h_errno.lo.go obj/src/network/herror.lo.go obj/src/network/hstrerror.lo.go obj/src/network/htonl.lo.go obj/src/network/htons.lo.go obj/src/network/if_freenameindex.lo.go obj/src/network/if_indextoname.lo.go obj/src/network/if_nameindex.lo.go obj/src/network/if_nametoindex.lo.go obj/src/network/in6addr_any.lo.go obj/src/network/in6addr_loopback.lo.go obj/src/network/inet_addr.lo.go obj/src/network/inet_aton.lo.go obj/src/network/inet_legacy.lo.go obj/src/network/inet_ntoa.lo.go obj/src/network/inet_ntop.lo.go obj/src/network/inet_pton.lo.go obj/src/network/listen.lo.go obj/src/network/lookup_ipliteral.lo.go obj/src/network/lookup_name.lo.go obj/src/network/lookup_serv.lo.go obj/src/network/netlink.lo.go obj/src/network/netname.lo.go obj/src/network/ns_parse.lo.go obj/src/network/ntohl.lo.go obj/src/network/ntohs.lo.go obj/src/network/proto.lo.go obj/src/network/recv.lo.go obj/src/network/recvfrom.lo.go obj/src/network/recvmmsg.lo.go obj/src/network/recvmsg.lo.go obj/src/network/res_init.lo.go obj/src/network/res_mkquery.lo.go obj/src/network/res_msend.lo.go obj/src/network/res_send.lo.go obj/src/network/res_state.lo.go obj/src/network/resolvconf.lo.go obj/src/network/send.lo.go obj/src/network/sendmmsg.lo.go obj/src/network/sendmsg.lo.go obj/src/network/sendto.lo.go obj/src/network/serv.lo.go obj/src/network/setsockopt.lo.go obj/src/network/shutdown.lo.go obj/src/network/sockatmark.lo.go obj/src/network/socket.lo.go obj/src/network/socketpair.lo.go obj/src/passwd/fgetgrent.lo.go obj/src/passwd/fgetpwent.lo.go obj/src/passwd/getgr_a.lo.go obj/src/passwd/getgr_r.lo.go obj/src/passwd/getgrent.lo.go obj/src/passwd/getgrent_a.lo.go obj/src/passwd/getgrouplist.lo.go obj/src/passwd/getpw_a.lo.go obj/src/passwd/getpw_r.lo.go obj/src/passwd/getpwent.lo.go obj/src/passwd/getpwent_a.lo.go obj/src/passwd/getspent.lo.go obj/src/passwd/lckpwdf.lo.go obj/src/passwd/nscd_query.lo.go obj/src/passwd/putgrent.lo.go obj/src/passwd/putpwent.lo.go obj/src/passwd/putspent.lo.go obj/src/prng/__rand48_step.lo.go obj/src/prng/__seed48.lo.go obj/src/prng/drand48.lo.go obj/src/prng/lcong48.lo.go obj/src/prng/lrand48.lo.go obj/src/prng/mrand48.lo.go obj/src/prng/rand.lo.go obj/src/prng/rand_r.lo.go obj/src/prng/random.lo.go obj/src/prng/seed48.lo.go obj/src/prng/srand48.lo.go obj/src/process/execl.lo.go obj/src/process/execle.lo.go obj/src/process/execlp.lo.go obj/src/process/execv.lo.go obj/src/process/execve.lo.go obj/src/process/execvp.lo.go obj/src/process/fexecve.lo.go obj/src/process/fork.lo.go obj/src/process/posix_spawn_file_actions_addchdir.lo.go obj/src/process/posix_spawn_file_actions_addclose.lo.go obj/src/process/posix_spawn_file_actions_adddup2.lo.go obj/src/process/posix_spawn_file_actions_addfchdir.lo.go obj/src/process/posix_spawn_file_actions_addopen.lo.go obj/src/process/posix_spawn_file_actions_destroy.lo.go obj/src/process/posix_spawn_file_actions_init.lo.go obj/src/process/posix_spawnattr_destroy.lo.go obj/src/process/posix_spawnattr_getflags.lo.go obj/src/process/posix_spawnattr_getpgroup.lo.go obj/src/process/posix_spawnattr_getsigdefault.lo.go obj/src/process/posix_spawnattr_getsigmask.lo.go obj/src/process/posix_spawnattr_init.lo.go obj/src/process/posix_spawnattr_sched.lo.go obj/src/process/posix_spawnattr_setflags.lo.go obj/src/process/posix_spawnattr_setpgroup.lo.go obj/src/process/posix_spawnattr_setsigdefault.lo.go obj/src/process/posix_spawnattr_setsigmask.lo.go obj/src/process/vfork.lo.go obj/src/process/wait.lo.go obj/src/process/waitid.lo.go obj/src/process/waitpid.lo.go obj/src/regex/fnmatch.lo.go obj/src/regex/glob.lo.go obj/src/regex/regcomp.lo.go obj/src/regex/regerror.lo.go obj/src/regex/regexec.lo.go obj/src/regex/tre-mem.lo.go obj/src/search/hsearch.lo.go obj/src/search/insque.lo.go obj/src/search/lsearch.lo.go obj/src/search/tdelete.lo.go obj/src/search/tdestroy.lo.go obj/src/search/tfind.lo.go obj/src/search/tsearch.lo.go obj/src/search/twalk.lo.go obj/src/select/poll.lo.go obj/src/select/ppoll.lo.go obj/src/select/pselect.lo.go obj/src/select/select.lo.go obj/src/setjmp/longjmp.lo.go obj/src/setjmp/setjmp.lo.go obj/src/signal/block.lo.go obj/src/signal/getitimer.lo.go obj/src/signal/kill.lo.go obj/src/signal/killpg.lo.go obj/src/signal/psiginfo.lo.go obj/src/signal/psignal.lo.go obj/src/signal/raise.lo.go obj/src/signal/restore.lo.go obj/src/signal/setitimer.lo.go obj/src/signal/sigaction.lo.go obj/src/signal/sigaddset.lo.go obj/src/signal/sigaltstack.lo.go obj/src/signal/sigandset.lo.go obj/src/signal/sigdelset.lo.go obj/src/signal/sigemptyset.lo.go obj/src/signal/sigfillset.lo.go obj/src/signal/sigisemptyset.lo.go obj/src/signal/sigismember.lo.go obj/src/signal/sigorset.lo.go obj/src/signal/sigpending.lo.go obj/src/signal/sigprocmask.lo.go obj/src/signal/sigqueue.lo.go obj/src/signal/sigrtmax.lo.go obj/src/signal/sigrtmin.lo.go obj/src/signal/sigsetjmp.lo.go obj/src/signal/sigsetjmp_tail.lo.go obj/src/signal/sigsuspend.lo.go obj/src/signal/sigtimedwait.lo.go obj/src/signal/sigwait.lo.go obj/src/signal/sigwaitinfo.lo.go obj/src/stat/__xstat.lo.go obj/src/stat/chmod.lo.go obj/src/stat/fchmod.lo.go obj/src/stat/fchmodat.lo.go obj/src/stat/fstat.lo.go obj/src/stat/fstatat.lo.go obj/src/stat/futimens.lo.go obj/src/stat/futimesat.lo.go obj/src/stat/lchmod.lo.go obj/src/stat/lstat.lo.go obj/src/stat/mkdir.lo.go obj/src/stat/mkdirat.lo.go obj/src/stat/mkfifo.lo.go obj/src/stat/mkfifoat.lo.go obj/src/stat/mknod.lo.go obj/src/stat/mknodat.lo.go obj/src/stat/stat.lo.go obj/src/stat/statvfs.lo.go obj/src/stat/umask.lo.go obj/src/stat/utimensat.lo.go obj/src/stdio/__fclose_ca.lo.go obj/src/stdio/__fdopen.lo.go obj/src/stdio/__fmodeflags.lo.go obj/src/stdio/__fopen_rb_ca.lo.go obj/src/stdio/__overflow.lo.go obj/src/stdio/__stdio_close.lo.go obj/src/stdio/__stdio_exit.lo.go obj/src/stdio/__stdio_read.lo.go obj/src/stdio/__stdio_seek.lo.go obj/src/stdio/__stdio_write.lo.go obj/src/stdio/__stdout_write.lo.go obj/src/stdio/__toread.lo.go obj/src/stdio/__towrite.lo.go obj/src/stdio/__uflow.lo.go obj/src/stdio/asprintf.lo.go obj/src/stdio/clearerr.lo.go obj/src/stdio/dprintf.lo.go obj/src/stdio/ext.lo.go obj/src/stdio/ext2.lo.go obj/src/stdio/fclose.lo.go obj/src/stdio/feof.lo.go obj/src/stdio/ferror.lo.go obj/src/stdio/fflush.lo.go obj/src/stdio/fgetc.lo.go obj/src/stdio/fgetln.lo.go obj/src/stdio/fgetpos.lo.go obj/src/stdio/fgets.lo.go obj/src/stdio/fgetwc.lo.go obj/src/stdio/fgetws.lo.go obj/src/stdio/fileno.lo.go obj/src/stdio/flockfile.lo.go obj/src/stdio/fmemopen.lo.go obj/src/stdio/fopen.lo.go obj/src/stdio/fopencookie.lo.go obj/src/stdio/fprintf.lo.go obj/src/stdio/fputc.lo.go obj/src/stdio/fputs.lo.go obj/src/stdio/fputwc.lo.go obj/src/stdio/fputws.lo.go obj/src/stdio/fread.lo.go obj/src/stdio/freopen.lo.go obj/src/stdio/fscanf.lo.go obj/src/stdio/fseek.lo.go obj/src/stdio/fsetpos.lo.go obj/src/stdio/ftell.lo.go obj/src/stdio/ftrylockfile.lo.go obj/src/stdio/funlockfile.lo.go obj/src/stdio/fwide.lo.go obj/src/stdio/fwprintf.lo.go obj/src/stdio/fwrite.lo.go obj/src/stdio/fwscanf.lo.go obj/src/stdio/getc.lo.go obj/src/stdio/getc_unlocked.lo.go obj/src/stdio/getchar.lo.go obj/src/stdio/getchar_unlocked.lo.go obj/src/stdio/getdelim.lo.go obj/src/stdio/getline.lo.go obj/src/stdio/gets.lo.go obj/src/stdio/getw.lo.go obj/src/stdio/getwc.lo.go obj/src/stdio/getwchar.lo.go obj/src/stdio/ofl.lo.go obj/src/stdio/ofl_add.lo.go obj/src/stdio/open_memstream.lo.go obj/src/stdio/open_wmemstream.lo.go obj/src/stdio/pclose.lo.go obj/src/stdio/perror.lo.go obj/src/stdio/printf.lo.go obj/src/stdio/putc.lo.go obj/src/stdio/putc_unlocked.lo.go obj/src/stdio/putchar.lo.go obj/src/stdio/putchar_unlocked.lo.go obj/src/stdio/puts.lo.go obj/src/stdio/putw.lo.go obj/src/stdio/putwc.lo.go obj/src/stdio/putwchar.lo.go obj/src/stdio/remove.lo.go obj/src/stdio/rename.lo.go obj/src/stdio/rewind.lo.go obj/src/stdio/scanf.lo.go obj/src/stdio/setbuf.lo.go obj/src/stdio/setbuffer.lo.go obj/src/stdio/setlinebuf.lo.go obj/src/stdio/setvbuf.lo.go obj/src/stdio/snprintf.lo.go obj/src/stdio/sprintf.lo.go obj/src/stdio/sscanf.lo.go obj/src/stdio/stderr.lo.go obj/src/stdio/stdin.lo.go obj/src/stdio/stdout.lo.go obj/src/stdio/swprintf.lo.go obj/src/stdio/swscanf.lo.go obj/src/stdio/tempnam.lo.go obj/src/stdio/tmpfile.lo.go obj/src/stdio/tmpnam.lo.go obj/src/stdio/ungetc.lo.go obj/src/stdio/ungetwc.lo.go obj/src/stdio/vasprintf.lo.go obj/src/stdio/vdprintf.lo.go obj/src/stdio/vfprintf.lo.go obj/src/stdio/vfscanf.lo.go obj/src/stdio/vfwprintf.lo.go obj/src/stdio/vfwscanf.lo.go obj/src/stdio/vprintf.lo.go obj/src/stdio/vscanf.lo.go obj/src/stdio/vsnprintf.lo.go obj/src/stdio/vsprintf.lo.go obj/src/stdio/vsscanf.lo.go obj/src/stdio/vswprintf.lo.go obj/src/stdio/vswscanf.lo.go obj/src/stdio/vwprintf.lo.go obj/src/stdio/vwscanf.lo.go obj/src/stdio/wprintf.lo.go obj/src/stdio/wscanf.lo.go obj/src/stdlib/abs.lo.go obj/src/stdlib/atof.lo.go obj/src/stdlib/atoi.lo.go obj/src/stdlib/atol.lo.go obj/src/stdlib/atoll.lo.go obj/src/stdlib/bsearch.lo.go obj/src/stdlib/div.lo.go obj/src/stdlib/ecvt.lo.go obj/src/stdlib/fcvt.lo.go obj/src/stdlib/gcvt.lo.go obj/src/stdlib/imaxabs.lo.go obj/src/stdlib/imaxdiv.lo.go obj/src/stdlib/labs.lo.go obj/src/stdlib/ldiv.lo.go obj/src/stdlib/llabs.lo.go obj/src/stdlib/lldiv.lo.go obj/src/stdlib/qsort.lo.go obj/src/stdlib/qsort_nr.lo.go obj/src/stdlib/strtod.lo.go obj/src/stdlib/strtol.lo.go obj/src/stdlib/wcstod.lo.go obj/src/stdlib/wcstol.lo.go obj/src/string/bcmp.lo.go obj/src/string/bcopy.lo.go obj/src/string/bzero.lo.go obj/src/string/explicit_bzero.lo.go obj/src/string/index.lo.go obj/src/string/memccpy.lo.go obj/src/string/memchr.lo.go obj/src/string/memcmp.lo.go obj/src/string/memcpy.lo.go obj/src/string/memmem.lo.go obj/src/string/memmove.lo.go obj/src/string/mempcpy.lo.go obj/src/string/memrchr.lo.go obj/src/string/memset.lo.go obj/src/string/rindex.lo.go obj/src/string/stpcpy.lo.go obj/src/string/stpncpy.lo.go obj/src/string/strcasecmp.lo.go obj/src/string/strcasestr.lo.go obj/src/string/strcat.lo.go obj/src/string/strchr.lo.go obj/src/string/strchrnul.lo.go obj/src/string/strcmp.lo.go obj/src/string/strcpy.lo.go obj/src/string/strcspn.lo.go obj/src/string/strdup.lo.go obj/src/string/strerror_r.lo.go obj/src/string/strlcat.lo.go obj/src/string/strlcpy.lo.go obj/src/string/strlen.lo.go obj/src/string/strncasecmp.lo.go obj/src/string/strncat.lo.go obj/src/string/strncmp.lo.go obj/src/string/strncpy.lo.go obj/src/string/strndup.lo.go obj/src/string/strnlen.lo.go obj/src/string/strpbrk.lo.go obj/src/string/strrchr.lo.go obj/src/string/strsep.lo.go obj/src/string/strsignal.lo.go obj/src/string/strspn.lo.go obj/src/string/strstr.lo.go obj/src/string/strtok.lo.go obj/src/string/strtok_r.lo.go obj/src/string/strverscmp.lo.go obj/src/string/swab.lo.go obj/src/string/wcpcpy.lo.go obj/src/string/wcpncpy.lo.go obj/src/string/wcscasecmp.lo.go obj/src/string/wcscasecmp_l.lo.go obj/src/string/wcscat.lo.go obj/src/string/wcschr.lo.go obj/src/string/wcscmp.lo.go obj/src/string/wcscpy.lo.go obj/src/string/wcscspn.lo.go obj/src/string/wcsdup.lo.go obj/src/string/wcslen.lo.go obj/src/string/wcsncasecmp.lo.go obj/src/string/wcsncasecmp_l.lo.go obj/src/string/wcsncat.lo.go obj/src/string/wcsncmp.lo.go obj/src/string/wcsncpy.lo.go obj/src/string/wcsnlen.lo.go obj/src/string/wcspbrk.lo.go obj/src/string/wcsrchr.lo.go obj/src/string/wcsspn.lo.go obj/src/string/wcsstr.lo.go obj/src/string/wcstok.lo.go obj/src/string/wcswcs.lo.go obj/src/string/wmemchr.lo.go obj/src/string/wmemcmp.lo.go obj/src/string/wmemcpy.lo.go obj/src/string/wmemmove.lo.go obj/src/string/wmemset.lo.go obj/src/temp/mkdtemp.lo.go obj/src/temp/mkostemp.lo.go obj/src/temp/mkostemps.lo.go obj/src/temp/mkstemp.lo.go obj/src/temp/mkstemps.lo.go obj/src/temp/mktemp.lo.go obj/src/termios/cfgetospeed.lo.go obj/src/termios/cfmakeraw.lo.go obj/src/termios/cfsetospeed.lo.go obj/src/termios/tcdrain.lo.go obj/src/termios/tcflow.lo.go obj/src/termios/tcflush.lo.go obj/src/termios/tcgetattr.lo.go obj/src/termios/tcgetsid.lo.go obj/src/termios/tcgetwinsize.lo.go obj/src/termios/tcsendbreak.lo.go obj/src/termios/tcsetattr.lo.go obj/src/termios/tcsetwinsize.lo.go obj/src/time/__map_file.lo.go obj/src/time/__month_to_secs.lo.go obj/src/time/__secs_to_tm.lo.go obj/src/time/__tm_to_secs.lo.go obj/src/time/__tz.lo.go obj/src/time/__year_to_secs.lo.go obj/src/time/asctime.lo.go obj/src/time/asctime_r.lo.go obj/src/time/clock.lo.go obj/src/time/clock_getcpuclockid.lo.go obj/src/time/clock_getres.lo.go obj/src/time/clock_gettime.lo.go obj/src/time/clock_nanosleep.lo.go obj/src/time/clock_settime.lo.go obj/src/time/ctime.lo.go obj/src/time/ctime_r.lo.go obj/src/time/difftime.lo.go obj/src/time/ftime.lo.go obj/src/time/getdate.lo.go obj/src/time/gettimeofday.lo.go obj/src/time/gmtime.lo.go obj/src/time/gmtime_r.lo.go obj/src/time/localtime.lo.go obj/src/time/localtime_r.lo.go obj/src/time/mktime.lo.go obj/src/time/nanosleep.lo.go obj/src/time/strftime.lo.go obj/src/time/strptime.lo.go obj/src/time/time.lo.go obj/src/time/timegm.lo.go obj/src/time/timer_delete.lo.go obj/src/time/timer_getoverrun.lo.go obj/src/time/timer_gettime.lo.go obj/src/time/timer_settime.lo.go obj/src/time/times.lo.go obj/src/time/timespec_get.lo.go obj/src/time/utime.lo.go obj/src/time/wcsftime.lo.go obj/src/unistd/_exit.lo.go obj/src/unistd/access.lo.go obj/src/unistd/acct.lo.go obj/src/unistd/alarm.lo.go obj/src/unistd/chdir.lo.go obj/src/unistd/chown.lo.go obj/src/unistd/close.lo.go obj/src/unistd/ctermid.lo.go obj/src/unistd/dup.lo.go obj/src/unistd/dup2.lo.go obj/src/unistd/dup3.lo.go obj/src/unistd/faccessat.lo.go obj/src/unistd/fchdir.lo.go obj/src/unistd/fchown.lo.go obj/src/unistd/fchownat.lo.go obj/src/unistd/fdatasync.lo.go obj/src/unistd/fsync.lo.go obj/src/unistd/ftruncate.lo.go obj/src/unistd/getcwd.lo.go obj/src/unistd/getegid.lo.go obj/src/unistd/geteuid.lo.go obj/src/unistd/getgid.lo.go obj/src/unistd/getgroups.lo.go obj/src/unistd/gethostname.lo.go obj/src/unistd/getlogin.lo.go obj/src/unistd/getlogin_r.lo.go obj/src/unistd/getpgid.lo.go obj/src/unistd/getpgrp.lo.go obj/src/unistd/getpid.lo.go obj/src/unistd/getppid.lo.go obj/src/unistd/getsid.lo.go obj/src/unistd/getuid.lo.go obj/src/unistd/isatty.lo.go obj/src/unistd/lchown.lo.go obj/src/unistd/link.lo.go obj/src/unistd/linkat.lo.go obj/src/unistd/lseek.lo.go obj/src/unistd/nice.lo.go obj/src/unistd/pause.lo.go obj/src/unistd/pipe.lo.go obj/src/unistd/pipe2.lo.go obj/src/unistd/posix_close.lo.go obj/src/unistd/pread.lo.go obj/src/unistd/preadv.lo.go obj/src/unistd/pwrite.lo.go obj/src/unistd/pwritev.lo.go obj/src/unistd/read.lo.go obj/src/unistd/readlink.lo.go obj/src/unistd/readlinkat.lo.go obj/src/unistd/readv.lo.go obj/src/unistd/renameat.lo.go obj/src/unistd/rmdir.lo.go obj/src/unistd/setgid.lo.go obj/src/unistd/setpgid.lo.go obj/src/unistd/setpgrp.lo.go obj/src/unistd/setsid.lo.go obj/src/unistd/setuid.lo.go obj/src/unistd/setxid.lo.go obj/src/unistd/sleep.lo.go obj/src/unistd/symlink.lo.go obj/src/unistd/symlinkat.lo.go obj/src/unistd/sync.lo.go obj/src/unistd/tcgetpgrp.lo.go obj/src/unistd/tcsetpgrp.lo.go obj/src/unistd/truncate.lo.go obj/src/unistd/ttyname.lo.go obj/src/unistd/ttyname_r.lo.go obj/src/unistd/ualarm.lo.go obj/src/unistd/unlink.lo.go obj/src/unistd/unlinkat.lo.go obj/src/unistd/usleep.lo.go obj/src/unistd/write.lo.go obj/src/unistd/writev.lo.go -lgcc -lgcc_eh', DO NOT EDIT. +// Code generated for linux/amd64 by 'gcc --package-name=libc --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -emit-func-aliases -eval-all-macros -extended-errors -ignore-asm-errors -isystem -mlong-double-64 -std=c99 -nostdinc -ffreestanding -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -DNDEBUG -nostdlib -shared -o lib/libc.so.go obj/src/complex/__cexp.lo.go obj/src/complex/__cexpf.lo.go obj/src/complex/cabs.lo.go obj/src/complex/cabsf.lo.go obj/src/complex/cabsl.lo.go obj/src/complex/cacos.lo.go obj/src/complex/cacosf.lo.go obj/src/complex/cacosh.lo.go obj/src/complex/cacoshf.lo.go obj/src/complex/cacoshl.lo.go obj/src/complex/cacosl.lo.go obj/src/complex/carg.lo.go obj/src/complex/cargf.lo.go obj/src/complex/cargl.lo.go obj/src/complex/casin.lo.go obj/src/complex/casinf.lo.go obj/src/complex/casinh.lo.go obj/src/complex/casinhf.lo.go obj/src/complex/casinhl.lo.go obj/src/complex/casinl.lo.go obj/src/complex/catan.lo.go obj/src/complex/catanf.lo.go obj/src/complex/catanh.lo.go obj/src/complex/catanhf.lo.go obj/src/complex/catanhl.lo.go obj/src/complex/catanl.lo.go obj/src/complex/ccos.lo.go obj/src/complex/ccosf.lo.go obj/src/complex/ccosh.lo.go obj/src/complex/ccoshf.lo.go obj/src/complex/ccoshl.lo.go obj/src/complex/ccosl.lo.go obj/src/complex/cexp.lo.go obj/src/complex/cexpf.lo.go obj/src/complex/cexpl.lo.go obj/src/complex/cimag.lo.go obj/src/complex/cimagf.lo.go obj/src/complex/cimagl.lo.go obj/src/complex/clog.lo.go obj/src/complex/clogf.lo.go obj/src/complex/clogl.lo.go obj/src/complex/conj.lo.go obj/src/complex/conjf.lo.go obj/src/complex/conjl.lo.go obj/src/complex/cpow.lo.go obj/src/complex/cpowf.lo.go obj/src/complex/cpowl.lo.go obj/src/complex/cproj.lo.go obj/src/complex/cprojf.lo.go obj/src/complex/cprojl.lo.go obj/src/complex/creal.lo.go obj/src/complex/crealf.lo.go obj/src/complex/creall.lo.go obj/src/complex/csin.lo.go obj/src/complex/csinf.lo.go obj/src/complex/csinh.lo.go obj/src/complex/csinhf.lo.go obj/src/complex/csinhl.lo.go obj/src/complex/csinl.lo.go obj/src/complex/csqrt.lo.go obj/src/complex/csqrtf.lo.go obj/src/complex/csqrtl.lo.go obj/src/complex/ctan.lo.go obj/src/complex/ctanf.lo.go obj/src/complex/ctanh.lo.go obj/src/complex/ctanhf.lo.go obj/src/complex/ctanhl.lo.go obj/src/complex/ctanl.lo.go obj/src/conf/confstr.lo.go obj/src/conf/fpathconf.lo.go obj/src/conf/legacy.lo.go obj/src/conf/pathconf.lo.go obj/src/conf/sysconf.lo.go obj/src/crypt/crypt.lo.go obj/src/crypt/crypt_blowfish.lo.go obj/src/crypt/crypt_des.lo.go obj/src/crypt/crypt_md5.lo.go obj/src/crypt/crypt_r.lo.go obj/src/crypt/crypt_sha256.lo.go obj/src/crypt/crypt_sha512.lo.go obj/src/crypt/encrypt.lo.go obj/src/ctype/__ctype_b_loc.lo.go obj/src/ctype/__ctype_get_mb_cur_max.lo.go obj/src/ctype/__ctype_tolower_loc.lo.go obj/src/ctype/__ctype_toupper_loc.lo.go obj/src/ctype/isalnum.lo.go obj/src/ctype/isalpha.lo.go obj/src/ctype/isascii.lo.go obj/src/ctype/isblank.lo.go obj/src/ctype/iscntrl.lo.go obj/src/ctype/isdigit.lo.go obj/src/ctype/isgraph.lo.go obj/src/ctype/islower.lo.go obj/src/ctype/isprint.lo.go obj/src/ctype/ispunct.lo.go obj/src/ctype/isspace.lo.go obj/src/ctype/isupper.lo.go obj/src/ctype/iswalnum.lo.go obj/src/ctype/iswalpha.lo.go obj/src/ctype/iswblank.lo.go obj/src/ctype/iswcntrl.lo.go obj/src/ctype/iswctype.lo.go obj/src/ctype/iswdigit.lo.go obj/src/ctype/iswgraph.lo.go obj/src/ctype/iswlower.lo.go obj/src/ctype/iswprint.lo.go obj/src/ctype/iswpunct.lo.go obj/src/ctype/iswspace.lo.go obj/src/ctype/iswupper.lo.go obj/src/ctype/iswxdigit.lo.go obj/src/ctype/isxdigit.lo.go obj/src/ctype/toascii.lo.go obj/src/ctype/tolower.lo.go obj/src/ctype/toupper.lo.go obj/src/ctype/towctrans.lo.go obj/src/ctype/wcswidth.lo.go obj/src/ctype/wctrans.lo.go obj/src/ctype/wcwidth.lo.go obj/src/dirent/alphasort.lo.go obj/src/dirent/closedir.lo.go obj/src/dirent/dirfd.lo.go obj/src/dirent/fdopendir.lo.go obj/src/dirent/opendir.lo.go obj/src/dirent/readdir.lo.go obj/src/dirent/readdir_r.lo.go obj/src/dirent/rewinddir.lo.go obj/src/dirent/scandir.lo.go obj/src/dirent/seekdir.lo.go obj/src/dirent/telldir.lo.go obj/src/dirent/versionsort.lo.go obj/src/env/__environ.lo.go obj/src/env/__reset_tls.lo.go obj/src/env/__stack_chk_fail.lo.go obj/src/env/clearenv.lo.go obj/src/env/getenv.lo.go obj/src/env/putenv.lo.go obj/src/env/secure_getenv.lo.go obj/src/env/setenv.lo.go obj/src/env/unsetenv.lo.go obj/src/errno/strerror.lo.go obj/src/exit/_Exit.lo.go obj/src/exit/abort_lock.lo.go obj/src/exit/assert.lo.go obj/src/exit/at_quick_exit.lo.go obj/src/exit/quick_exit.lo.go obj/src/fcntl/creat.lo.go obj/src/fcntl/fcntl.lo.go obj/src/fcntl/open.lo.go obj/src/fcntl/openat.lo.go obj/src/fcntl/posix_fadvise.lo.go obj/src/fcntl/posix_fallocate.lo.go obj/src/fenv/fenv.lo.go obj/src/internal/defsysinfo.lo.go obj/src/internal/emulate_wait4.lo.go obj/src/internal/floatscan.lo.go obj/src/internal/intscan.lo.go obj/src/internal/libc.lo.go obj/src/internal/procfdname.lo.go obj/src/internal/shgetc.lo.go obj/src/internal/syscall_ret.lo.go obj/src/internal/vdso.lo.go obj/src/internal/version.lo.go obj/src/ipc/ftok.lo.go obj/src/ipc/msgctl.lo.go obj/src/ipc/msgget.lo.go obj/src/ipc/msgrcv.lo.go obj/src/ipc/msgsnd.lo.go obj/src/ipc/semctl.lo.go obj/src/ipc/semget.lo.go obj/src/ipc/semop.lo.go obj/src/ipc/semtimedop.lo.go obj/src/ipc/shmat.lo.go obj/src/ipc/shmctl.lo.go obj/src/ipc/shmdt.lo.go obj/src/ipc/shmget.lo.go obj/src/legacy/cuserid.lo.go obj/src/legacy/err.lo.go obj/src/legacy/euidaccess.lo.go obj/src/legacy/ftw.lo.go obj/src/legacy/futimes.lo.go obj/src/legacy/getdtablesize.lo.go obj/src/legacy/getloadavg.lo.go obj/src/legacy/getpagesize.lo.go obj/src/legacy/getpass.lo.go obj/src/legacy/getusershell.lo.go obj/src/legacy/isastream.lo.go obj/src/legacy/lutimes.lo.go obj/src/legacy/ulimit.lo.go obj/src/legacy/utmpx.lo.go obj/src/linux/adjtime.lo.go obj/src/linux/adjtimex.lo.go obj/src/linux/arch_prctl.lo.go obj/src/linux/brk.lo.go obj/src/linux/cache.lo.go obj/src/linux/cap.lo.go obj/src/linux/chroot.lo.go obj/src/linux/clock_adjtime.lo.go obj/src/linux/copy_file_range.lo.go obj/src/linux/epoll.lo.go obj/src/linux/eventfd.lo.go obj/src/linux/fallocate.lo.go obj/src/linux/fanotify.lo.go obj/src/linux/flock.lo.go obj/src/linux/getdents.lo.go obj/src/linux/getrandom.lo.go obj/src/linux/inotify.lo.go obj/src/linux/ioperm.lo.go obj/src/linux/iopl.lo.go obj/src/linux/klogctl.lo.go obj/src/linux/memfd_create.lo.go obj/src/linux/mlock2.lo.go obj/src/linux/module.lo.go obj/src/linux/mount.lo.go obj/src/linux/name_to_handle_at.lo.go obj/src/linux/open_by_handle_at.lo.go obj/src/linux/personality.lo.go obj/src/linux/pivot_root.lo.go obj/src/linux/prctl.lo.go obj/src/linux/preadv2.lo.go obj/src/linux/prlimit.lo.go obj/src/linux/process_vm.lo.go obj/src/linux/ptrace.lo.go obj/src/linux/pwritev2.lo.go obj/src/linux/quotactl.lo.go obj/src/linux/readahead.lo.go obj/src/linux/reboot.lo.go obj/src/linux/remap_file_pages.lo.go obj/src/linux/sbrk.lo.go obj/src/linux/sendfile.lo.go obj/src/linux/setfsgid.lo.go obj/src/linux/setfsuid.lo.go obj/src/linux/sethostname.lo.go obj/src/linux/setns.lo.go obj/src/linux/settimeofday.lo.go obj/src/linux/signalfd.lo.go obj/src/linux/splice.lo.go obj/src/linux/statx.lo.go obj/src/linux/stime.lo.go obj/src/linux/swap.lo.go obj/src/linux/sync_file_range.lo.go obj/src/linux/syncfs.lo.go obj/src/linux/sysinfo.lo.go obj/src/linux/tee.lo.go obj/src/linux/timerfd.lo.go obj/src/linux/unshare.lo.go obj/src/linux/utimes.lo.go obj/src/linux/vhangup.lo.go obj/src/linux/vmsplice.lo.go obj/src/linux/wait3.lo.go obj/src/linux/wait4.lo.go obj/src/linux/xattr.lo.go obj/src/locale/__lctrans.lo.go obj/src/locale/__mo_lookup.lo.go obj/src/locale/bind_textdomain_codeset.lo.go obj/src/locale/c_locale.lo.go obj/src/locale/catclose.lo.go obj/src/locale/catgets.lo.go obj/src/locale/catopen.lo.go obj/src/locale/dcngettext.lo.go obj/src/locale/duplocale.lo.go obj/src/locale/freelocale.lo.go obj/src/locale/iconv.lo.go obj/src/locale/iconv_close.lo.go obj/src/locale/langinfo.lo.go obj/src/locale/locale_map.lo.go obj/src/locale/localeconv.lo.go obj/src/locale/newlocale.lo.go obj/src/locale/pleval.lo.go obj/src/locale/setlocale.lo.go obj/src/locale/strcoll.lo.go obj/src/locale/strfmon.lo.go obj/src/locale/strtod_l.lo.go obj/src/locale/strxfrm.lo.go obj/src/locale/textdomain.lo.go obj/src/locale/uselocale.lo.go obj/src/locale/wcscoll.lo.go obj/src/locale/wcsxfrm.lo.go obj/src/malloc/reallocarray.lo.go obj/src/math/__cos.lo.go obj/src/math/__cosdf.lo.go obj/src/math/__cosl.lo.go obj/src/math/__expo2.lo.go obj/src/math/__expo2f.lo.go obj/src/math/__fpclassify.lo.go obj/src/math/__fpclassifyf.lo.go obj/src/math/__fpclassifyl.lo.go obj/src/math/__invtrigl.lo.go obj/src/math/__math_divzero.lo.go obj/src/math/__math_divzerof.lo.go obj/src/math/__math_invalid.lo.go obj/src/math/__math_invalidf.lo.go obj/src/math/__math_invalidl.lo.go obj/src/math/__math_oflow.lo.go obj/src/math/__math_oflowf.lo.go obj/src/math/__math_uflow.lo.go obj/src/math/__math_uflowf.lo.go obj/src/math/__math_xflow.lo.go obj/src/math/__math_xflowf.lo.go obj/src/math/__polevll.lo.go obj/src/math/__rem_pio2.lo.go obj/src/math/__rem_pio2_large.lo.go obj/src/math/__rem_pio2f.lo.go obj/src/math/__rem_pio2l.lo.go obj/src/math/__signbit.lo.go obj/src/math/__signbitf.lo.go obj/src/math/__signbitl.lo.go obj/src/math/__sin.lo.go obj/src/math/__sindf.lo.go obj/src/math/__sinl.lo.go obj/src/math/__tan.lo.go obj/src/math/__tandf.lo.go obj/src/math/__tanl.lo.go obj/src/math/acos.lo.go obj/src/math/acosf.lo.go obj/src/math/acosh.lo.go obj/src/math/acoshf.lo.go obj/src/math/acoshl.lo.go obj/src/math/acosl.lo.go obj/src/math/asin.lo.go obj/src/math/asinf.lo.go obj/src/math/asinh.lo.go obj/src/math/asinhf.lo.go obj/src/math/asinhl.lo.go obj/src/math/asinl.lo.go obj/src/math/atan.lo.go obj/src/math/atan2.lo.go obj/src/math/atan2f.lo.go obj/src/math/atan2l.lo.go obj/src/math/atanf.lo.go obj/src/math/atanh.lo.go obj/src/math/atanhf.lo.go obj/src/math/atanhl.lo.go obj/src/math/atanl.lo.go obj/src/math/cbrt.lo.go obj/src/math/cbrtf.lo.go obj/src/math/cbrtl.lo.go obj/src/math/ceil.lo.go obj/src/math/ceilf.lo.go obj/src/math/ceill.lo.go obj/src/math/copysign.lo.go obj/src/math/copysignf.lo.go obj/src/math/copysignl.lo.go obj/src/math/cos.lo.go obj/src/math/cosf.lo.go obj/src/math/cosh.lo.go obj/src/math/coshf.lo.go obj/src/math/coshl.lo.go obj/src/math/cosl.lo.go obj/src/math/erf.lo.go obj/src/math/erff.lo.go obj/src/math/erfl.lo.go obj/src/math/exp.lo.go obj/src/math/exp10.lo.go obj/src/math/exp10f.lo.go obj/src/math/exp10l.lo.go obj/src/math/exp2.lo.go obj/src/math/exp2f.lo.go obj/src/math/exp2f_data.lo.go obj/src/math/exp2l.lo.go obj/src/math/exp_data.lo.go obj/src/math/expf.lo.go obj/src/math/expl.lo.go obj/src/math/expm1.lo.go obj/src/math/expm1f.lo.go obj/src/math/expm1l.lo.go obj/src/math/fabs.lo.go obj/src/math/fabsf.lo.go obj/src/math/fabsl.lo.go obj/src/math/fdim.lo.go obj/src/math/fdimf.lo.go obj/src/math/fdiml.lo.go obj/src/math/finite.lo.go obj/src/math/finitef.lo.go obj/src/math/floor.lo.go obj/src/math/floorf.lo.go obj/src/math/floorl.lo.go obj/src/math/fma.lo.go obj/src/math/fmal.lo.go obj/src/math/fmax.lo.go obj/src/math/fmaxf.lo.go obj/src/math/fmaxl.lo.go obj/src/math/fmin.lo.go obj/src/math/fminf.lo.go obj/src/math/fminl.lo.go obj/src/math/fmod.lo.go obj/src/math/fmodf.lo.go obj/src/math/fmodl.lo.go obj/src/math/frexp.lo.go obj/src/math/frexpf.lo.go obj/src/math/frexpl.lo.go obj/src/math/hypot.lo.go obj/src/math/hypotf.lo.go obj/src/math/hypotl.lo.go obj/src/math/ilogb.lo.go obj/src/math/ilogbf.lo.go obj/src/math/ilogbl.lo.go obj/src/math/j0.lo.go obj/src/math/j0f.lo.go obj/src/math/j1.lo.go obj/src/math/j1f.lo.go obj/src/math/jn.lo.go obj/src/math/jnf.lo.go obj/src/math/ldexp.lo.go obj/src/math/ldexpf.lo.go obj/src/math/ldexpl.lo.go obj/src/math/lgamma.lo.go obj/src/math/lgamma_r.lo.go obj/src/math/lgammaf.lo.go obj/src/math/lgammaf_r.lo.go obj/src/math/lgammal.lo.go obj/src/math/llrint.lo.go obj/src/math/llrintf.lo.go obj/src/math/llrintl.lo.go obj/src/math/llround.lo.go obj/src/math/llroundf.lo.go obj/src/math/llroundl.lo.go obj/src/math/log.lo.go obj/src/math/log10.lo.go obj/src/math/log10f.lo.go obj/src/math/log10l.lo.go obj/src/math/log1p.lo.go obj/src/math/log1pf.lo.go obj/src/math/log1pl.lo.go obj/src/math/log2.lo.go obj/src/math/log2_data.lo.go obj/src/math/log2f.lo.go obj/src/math/log2f_data.lo.go obj/src/math/log2l.lo.go obj/src/math/log_data.lo.go obj/src/math/logb.lo.go obj/src/math/logbf.lo.go obj/src/math/logbl.lo.go obj/src/math/logf.lo.go obj/src/math/logf_data.lo.go obj/src/math/logl.lo.go obj/src/math/lrint.lo.go obj/src/math/lrintf.lo.go obj/src/math/lrintl.lo.go obj/src/math/lround.lo.go obj/src/math/lroundf.lo.go obj/src/math/lroundl.lo.go obj/src/math/modf.lo.go obj/src/math/modff.lo.go obj/src/math/modfl.lo.go obj/src/math/nan.lo.go obj/src/math/nanf.lo.go obj/src/math/nanl.lo.go obj/src/math/nextafter.lo.go obj/src/math/nextafterf.lo.go obj/src/math/nextafterl.lo.go obj/src/math/nexttoward.lo.go obj/src/math/nexttowardf.lo.go obj/src/math/nexttowardl.lo.go obj/src/math/pow.lo.go obj/src/math/pow_data.lo.go obj/src/math/powf.lo.go obj/src/math/powf_data.lo.go obj/src/math/powl.lo.go obj/src/math/remainder.lo.go obj/src/math/remainderf.lo.go obj/src/math/remainderl.lo.go obj/src/math/remquo.lo.go obj/src/math/remquof.lo.go obj/src/math/remquol.lo.go obj/src/math/rint.lo.go obj/src/math/rintf.lo.go obj/src/math/rintl.lo.go obj/src/math/round.lo.go obj/src/math/roundf.lo.go obj/src/math/roundl.lo.go obj/src/math/scalb.lo.go obj/src/math/scalbf.lo.go obj/src/math/scalbln.lo.go obj/src/math/scalblnf.lo.go obj/src/math/scalblnl.lo.go obj/src/math/scalbn.lo.go obj/src/math/scalbnf.lo.go obj/src/math/scalbnl.lo.go obj/src/math/signgam.lo.go obj/src/math/significand.lo.go obj/src/math/significandf.lo.go obj/src/math/sin.lo.go obj/src/math/sincos.lo.go obj/src/math/sincosf.lo.go obj/src/math/sincosl.lo.go obj/src/math/sinf.lo.go obj/src/math/sinh.lo.go obj/src/math/sinhf.lo.go obj/src/math/sinhl.lo.go obj/src/math/sinl.lo.go obj/src/math/sqrt.lo.go obj/src/math/sqrt_data.lo.go obj/src/math/sqrtf.lo.go obj/src/math/sqrtl.lo.go obj/src/math/tan.lo.go obj/src/math/tanf.lo.go obj/src/math/tanh.lo.go obj/src/math/tanhf.lo.go obj/src/math/tanhl.lo.go obj/src/math/tanl.lo.go obj/src/math/tgamma.lo.go obj/src/math/tgammaf.lo.go obj/src/math/tgammal.lo.go obj/src/math/trunc.lo.go obj/src/math/truncf.lo.go obj/src/math/truncl.lo.go obj/src/misc/a64l.lo.go obj/src/misc/basename.lo.go obj/src/misc/dirname.lo.go obj/src/misc/ffs.lo.go obj/src/misc/ffsl.lo.go obj/src/misc/ffsll.lo.go obj/src/misc/fmtmsg.lo.go obj/src/misc/get_current_dir_name.lo.go obj/src/misc/getauxval.lo.go obj/src/misc/getdomainname.lo.go obj/src/misc/getentropy.lo.go obj/src/misc/gethostid.lo.go obj/src/misc/getopt.lo.go obj/src/misc/getopt_long.lo.go obj/src/misc/getpriority.lo.go obj/src/misc/getresgid.lo.go obj/src/misc/getresuid.lo.go obj/src/misc/getrlimit.lo.go obj/src/misc/getrusage.lo.go obj/src/misc/getsubopt.lo.go obj/src/misc/ioctl.lo.go obj/src/misc/issetugid.lo.go obj/src/misc/lockf.lo.go obj/src/misc/login_tty.lo.go obj/src/misc/mntent.lo.go obj/src/misc/nftw.lo.go obj/src/misc/openpty.lo.go obj/src/misc/ptsname.lo.go obj/src/misc/pty.lo.go obj/src/misc/realpath.lo.go obj/src/misc/setdomainname.lo.go obj/src/misc/setpriority.lo.go obj/src/misc/setrlimit.lo.go obj/src/misc/syscall.lo.go obj/src/misc/syslog.lo.go obj/src/misc/uname.lo.go obj/src/mman/madvise.lo.go obj/src/mman/mincore.lo.go obj/src/mman/mlock.lo.go obj/src/mman/mlockall.lo.go obj/src/mman/mmap.lo.go obj/src/mman/mprotect.lo.go obj/src/mman/mremap.lo.go obj/src/mman/msync.lo.go obj/src/mman/munlock.lo.go obj/src/mman/munlockall.lo.go obj/src/mman/munmap.lo.go obj/src/mman/posix_madvise.lo.go obj/src/mman/shm_open.lo.go obj/src/multibyte/btowc.lo.go obj/src/multibyte/c16rtomb.lo.go obj/src/multibyte/c32rtomb.lo.go obj/src/multibyte/internal.lo.go obj/src/multibyte/mblen.lo.go obj/src/multibyte/mbrlen.lo.go obj/src/multibyte/mbrtoc16.lo.go obj/src/multibyte/mbrtoc32.lo.go obj/src/multibyte/mbrtowc.lo.go obj/src/multibyte/mbsinit.lo.go obj/src/multibyte/mbsnrtowcs.lo.go obj/src/multibyte/mbsrtowcs.lo.go obj/src/multibyte/mbstowcs.lo.go obj/src/multibyte/mbtowc.lo.go obj/src/multibyte/wcrtomb.lo.go obj/src/multibyte/wcsnrtombs.lo.go obj/src/multibyte/wcsrtombs.lo.go obj/src/multibyte/wcstombs.lo.go obj/src/multibyte/wctob.lo.go obj/src/multibyte/wctomb.lo.go obj/src/network/accept.lo.go obj/src/network/accept4.lo.go obj/src/network/bind.lo.go obj/src/network/connect.lo.go obj/src/network/dn_comp.lo.go obj/src/network/dn_expand.lo.go obj/src/network/dn_skipname.lo.go obj/src/network/dns_parse.lo.go obj/src/network/ent.lo.go obj/src/network/ether.lo.go obj/src/network/freeaddrinfo.lo.go obj/src/network/gai_strerror.lo.go obj/src/network/getaddrinfo.lo.go obj/src/network/gethostbyaddr.lo.go obj/src/network/gethostbyaddr_r.lo.go obj/src/network/gethostbyname.lo.go obj/src/network/gethostbyname2.lo.go obj/src/network/gethostbyname2_r.lo.go obj/src/network/gethostbyname_r.lo.go obj/src/network/getifaddrs.lo.go obj/src/network/getnameinfo.lo.go obj/src/network/getpeername.lo.go obj/src/network/getservbyname.lo.go obj/src/network/getservbyname_r.lo.go obj/src/network/getsockname.lo.go obj/src/network/getsockopt.lo.go obj/src/network/h_errno.lo.go obj/src/network/herror.lo.go obj/src/network/hstrerror.lo.go obj/src/network/htonl.lo.go obj/src/network/htons.lo.go obj/src/network/if_freenameindex.lo.go obj/src/network/if_indextoname.lo.go obj/src/network/if_nameindex.lo.go obj/src/network/if_nametoindex.lo.go obj/src/network/in6addr_any.lo.go obj/src/network/in6addr_loopback.lo.go obj/src/network/inet_addr.lo.go obj/src/network/inet_aton.lo.go obj/src/network/inet_legacy.lo.go obj/src/network/inet_ntoa.lo.go obj/src/network/inet_ntop.lo.go obj/src/network/inet_pton.lo.go obj/src/network/listen.lo.go obj/src/network/lookup_ipliteral.lo.go obj/src/network/lookup_name.lo.go obj/src/network/lookup_serv.lo.go obj/src/network/netlink.lo.go obj/src/network/netname.lo.go obj/src/network/ns_parse.lo.go obj/src/network/ntohl.lo.go obj/src/network/ntohs.lo.go obj/src/network/proto.lo.go obj/src/network/recv.lo.go obj/src/network/recvfrom.lo.go obj/src/network/recvmmsg.lo.go obj/src/network/recvmsg.lo.go obj/src/network/res_init.lo.go obj/src/network/res_mkquery.lo.go obj/src/network/res_msend.lo.go obj/src/network/res_send.lo.go obj/src/network/res_state.lo.go obj/src/network/resolvconf.lo.go obj/src/network/send.lo.go obj/src/network/sendmmsg.lo.go obj/src/network/sendmsg.lo.go obj/src/network/sendto.lo.go obj/src/network/serv.lo.go obj/src/network/setsockopt.lo.go obj/src/network/shutdown.lo.go obj/src/network/sockatmark.lo.go obj/src/network/socket.lo.go obj/src/network/socketpair.lo.go obj/src/passwd/fgetgrent.lo.go obj/src/passwd/fgetpwent.lo.go obj/src/passwd/getgr_a.lo.go obj/src/passwd/getgr_r.lo.go obj/src/passwd/getgrent.lo.go obj/src/passwd/getgrent_a.lo.go obj/src/passwd/getgrouplist.lo.go obj/src/passwd/getpw_a.lo.go obj/src/passwd/getpw_r.lo.go obj/src/passwd/getpwent.lo.go obj/src/passwd/getpwent_a.lo.go obj/src/passwd/getspent.lo.go obj/src/passwd/lckpwdf.lo.go obj/src/passwd/nscd_query.lo.go obj/src/passwd/putgrent.lo.go obj/src/passwd/putpwent.lo.go obj/src/passwd/putspent.lo.go obj/src/prng/__rand48_step.lo.go obj/src/prng/__seed48.lo.go obj/src/prng/drand48.lo.go obj/src/prng/lcong48.lo.go obj/src/prng/lrand48.lo.go obj/src/prng/mrand48.lo.go obj/src/prng/rand.lo.go obj/src/prng/rand_r.lo.go obj/src/prng/random.lo.go obj/src/prng/seed48.lo.go obj/src/prng/srand48.lo.go obj/src/process/execl.lo.go obj/src/process/execle.lo.go obj/src/process/execlp.lo.go obj/src/process/execv.lo.go obj/src/process/execve.lo.go obj/src/process/execvp.lo.go obj/src/process/fexecve.lo.go obj/src/process/fork.lo.go obj/src/process/posix_spawn_file_actions_addchdir.lo.go obj/src/process/posix_spawn_file_actions_addclose.lo.go obj/src/process/posix_spawn_file_actions_adddup2.lo.go obj/src/process/posix_spawn_file_actions_addfchdir.lo.go obj/src/process/posix_spawn_file_actions_addopen.lo.go obj/src/process/posix_spawn_file_actions_destroy.lo.go obj/src/process/posix_spawn_file_actions_init.lo.go obj/src/process/posix_spawnattr_destroy.lo.go obj/src/process/posix_spawnattr_getflags.lo.go obj/src/process/posix_spawnattr_getpgroup.lo.go obj/src/process/posix_spawnattr_getsigdefault.lo.go obj/src/process/posix_spawnattr_getsigmask.lo.go obj/src/process/posix_spawnattr_init.lo.go obj/src/process/posix_spawnattr_sched.lo.go obj/src/process/posix_spawnattr_setflags.lo.go obj/src/process/posix_spawnattr_setpgroup.lo.go obj/src/process/posix_spawnattr_setsigdefault.lo.go obj/src/process/posix_spawnattr_setsigmask.lo.go obj/src/process/vfork.lo.go obj/src/process/wait.lo.go obj/src/process/waitid.lo.go obj/src/process/waitpid.lo.go obj/src/regex/fnmatch.lo.go obj/src/regex/glob.lo.go obj/src/regex/regcomp.lo.go obj/src/regex/regerror.lo.go obj/src/regex/regexec.lo.go obj/src/regex/tre-mem.lo.go obj/src/search/hsearch.lo.go obj/src/search/insque.lo.go obj/src/search/lsearch.lo.go obj/src/search/tdelete.lo.go obj/src/search/tdestroy.lo.go obj/src/search/tfind.lo.go obj/src/search/tsearch.lo.go obj/src/search/twalk.lo.go obj/src/select/poll.lo.go obj/src/select/ppoll.lo.go obj/src/select/pselect.lo.go obj/src/select/select.lo.go obj/src/setjmp/longjmp.lo.go obj/src/setjmp/setjmp.lo.go obj/src/signal/block.lo.go obj/src/signal/getitimer.lo.go obj/src/signal/kill.lo.go obj/src/signal/killpg.lo.go obj/src/signal/psiginfo.lo.go obj/src/signal/psignal.lo.go obj/src/signal/raise.lo.go obj/src/signal/restore.lo.go obj/src/signal/setitimer.lo.go obj/src/signal/sigaction.lo.go obj/src/signal/sigaddset.lo.go obj/src/signal/sigaltstack.lo.go obj/src/signal/sigandset.lo.go obj/src/signal/sigdelset.lo.go obj/src/signal/sigemptyset.lo.go obj/src/signal/sigfillset.lo.go obj/src/signal/sigisemptyset.lo.go obj/src/signal/sigismember.lo.go obj/src/signal/sigorset.lo.go obj/src/signal/sigpending.lo.go obj/src/signal/sigprocmask.lo.go obj/src/signal/sigqueue.lo.go obj/src/signal/sigrtmax.lo.go obj/src/signal/sigrtmin.lo.go obj/src/signal/sigsetjmp.lo.go obj/src/signal/sigsetjmp_tail.lo.go obj/src/signal/sigsuspend.lo.go obj/src/signal/sigtimedwait.lo.go obj/src/signal/sigwait.lo.go obj/src/signal/sigwaitinfo.lo.go obj/src/stat/__xstat.lo.go obj/src/stat/chmod.lo.go obj/src/stat/fchmod.lo.go obj/src/stat/fchmodat.lo.go obj/src/stat/fstat.lo.go obj/src/stat/fstatat.lo.go obj/src/stat/futimens.lo.go obj/src/stat/futimesat.lo.go obj/src/stat/lchmod.lo.go obj/src/stat/lstat.lo.go obj/src/stat/mkdir.lo.go obj/src/stat/mkdirat.lo.go obj/src/stat/mkfifo.lo.go obj/src/stat/mkfifoat.lo.go obj/src/stat/mknod.lo.go obj/src/stat/mknodat.lo.go obj/src/stat/stat.lo.go obj/src/stat/statvfs.lo.go obj/src/stat/umask.lo.go obj/src/stat/utimensat.lo.go obj/src/stdio/__fclose_ca.lo.go obj/src/stdio/__fdopen.lo.go obj/src/stdio/__fmodeflags.lo.go obj/src/stdio/__fopen_rb_ca.lo.go obj/src/stdio/__overflow.lo.go obj/src/stdio/__stdio_close.lo.go obj/src/stdio/__stdio_exit.lo.go obj/src/stdio/__stdio_read.lo.go obj/src/stdio/__stdio_seek.lo.go obj/src/stdio/__stdio_write.lo.go obj/src/stdio/__stdout_write.lo.go obj/src/stdio/__toread.lo.go obj/src/stdio/__towrite.lo.go obj/src/stdio/__uflow.lo.go obj/src/stdio/asprintf.lo.go obj/src/stdio/clearerr.lo.go obj/src/stdio/dprintf.lo.go obj/src/stdio/ext.lo.go obj/src/stdio/ext2.lo.go obj/src/stdio/fclose.lo.go obj/src/stdio/feof.lo.go obj/src/stdio/ferror.lo.go obj/src/stdio/fflush.lo.go obj/src/stdio/fgetc.lo.go obj/src/stdio/fgetln.lo.go obj/src/stdio/fgetpos.lo.go obj/src/stdio/fgets.lo.go obj/src/stdio/fgetwc.lo.go obj/src/stdio/fgetws.lo.go obj/src/stdio/fileno.lo.go obj/src/stdio/flockfile.lo.go obj/src/stdio/fmemopen.lo.go obj/src/stdio/fopen.lo.go obj/src/stdio/fopencookie.lo.go obj/src/stdio/fprintf.lo.go obj/src/stdio/fputc.lo.go obj/src/stdio/fputs.lo.go obj/src/stdio/fputwc.lo.go obj/src/stdio/fputws.lo.go obj/src/stdio/fread.lo.go obj/src/stdio/freopen.lo.go obj/src/stdio/fscanf.lo.go obj/src/stdio/fseek.lo.go obj/src/stdio/fsetpos.lo.go obj/src/stdio/ftell.lo.go obj/src/stdio/ftrylockfile.lo.go obj/src/stdio/funlockfile.lo.go obj/src/stdio/fwide.lo.go obj/src/stdio/fwprintf.lo.go obj/src/stdio/fwrite.lo.go obj/src/stdio/fwscanf.lo.go obj/src/stdio/getc.lo.go obj/src/stdio/getc_unlocked.lo.go obj/src/stdio/getchar.lo.go obj/src/stdio/getchar_unlocked.lo.go obj/src/stdio/getdelim.lo.go obj/src/stdio/getline.lo.go obj/src/stdio/gets.lo.go obj/src/stdio/getw.lo.go obj/src/stdio/getwc.lo.go obj/src/stdio/getwchar.lo.go obj/src/stdio/ofl.lo.go obj/src/stdio/ofl_add.lo.go obj/src/stdio/open_memstream.lo.go obj/src/stdio/open_wmemstream.lo.go obj/src/stdio/pclose.lo.go obj/src/stdio/perror.lo.go obj/src/stdio/printf.lo.go obj/src/stdio/putc.lo.go obj/src/stdio/putc_unlocked.lo.go obj/src/stdio/putchar.lo.go obj/src/stdio/putchar_unlocked.lo.go obj/src/stdio/puts.lo.go obj/src/stdio/putw.lo.go obj/src/stdio/putwc.lo.go obj/src/stdio/putwchar.lo.go obj/src/stdio/remove.lo.go obj/src/stdio/rename.lo.go obj/src/stdio/rewind.lo.go obj/src/stdio/scanf.lo.go obj/src/stdio/setbuf.lo.go obj/src/stdio/setbuffer.lo.go obj/src/stdio/setlinebuf.lo.go obj/src/stdio/setvbuf.lo.go obj/src/stdio/snprintf.lo.go obj/src/stdio/sprintf.lo.go obj/src/stdio/sscanf.lo.go obj/src/stdio/stderr.lo.go obj/src/stdio/stdin.lo.go obj/src/stdio/stdout.lo.go obj/src/stdio/swprintf.lo.go obj/src/stdio/swscanf.lo.go obj/src/stdio/tempnam.lo.go obj/src/stdio/tmpfile.lo.go obj/src/stdio/tmpnam.lo.go obj/src/stdio/ungetc.lo.go obj/src/stdio/ungetwc.lo.go obj/src/stdio/vasprintf.lo.go obj/src/stdio/vdprintf.lo.go obj/src/stdio/vfprintf.lo.go obj/src/stdio/vfscanf.lo.go obj/src/stdio/vfwprintf.lo.go obj/src/stdio/vfwscanf.lo.go obj/src/stdio/vprintf.lo.go obj/src/stdio/vscanf.lo.go obj/src/stdio/vsnprintf.lo.go obj/src/stdio/vsprintf.lo.go obj/src/stdio/vsscanf.lo.go obj/src/stdio/vswprintf.lo.go obj/src/stdio/vswscanf.lo.go obj/src/stdio/vwprintf.lo.go obj/src/stdio/vwscanf.lo.go obj/src/stdio/wprintf.lo.go obj/src/stdio/wscanf.lo.go obj/src/stdlib/abs.lo.go obj/src/stdlib/atof.lo.go obj/src/stdlib/atoi.lo.go obj/src/stdlib/atol.lo.go obj/src/stdlib/atoll.lo.go obj/src/stdlib/bsearch.lo.go obj/src/stdlib/div.lo.go obj/src/stdlib/ecvt.lo.go obj/src/stdlib/fcvt.lo.go obj/src/stdlib/gcvt.lo.go obj/src/stdlib/imaxabs.lo.go obj/src/stdlib/imaxdiv.lo.go obj/src/stdlib/labs.lo.go obj/src/stdlib/ldiv.lo.go obj/src/stdlib/llabs.lo.go obj/src/stdlib/lldiv.lo.go obj/src/stdlib/qsort.lo.go obj/src/stdlib/qsort_nr.lo.go obj/src/stdlib/strtod.lo.go obj/src/stdlib/strtol.lo.go obj/src/stdlib/wcstod.lo.go obj/src/stdlib/wcstol.lo.go obj/src/string/bcmp.lo.go obj/src/string/bcopy.lo.go obj/src/string/bzero.lo.go obj/src/string/explicit_bzero.lo.go obj/src/string/index.lo.go obj/src/string/memccpy.lo.go obj/src/string/memchr.lo.go obj/src/string/memcmp.lo.go obj/src/string/memcpy.lo.go obj/src/string/memmem.lo.go obj/src/string/memmove.lo.go obj/src/string/mempcpy.lo.go obj/src/string/memrchr.lo.go obj/src/string/memset.lo.go obj/src/string/rindex.lo.go obj/src/string/stpcpy.lo.go obj/src/string/stpncpy.lo.go obj/src/string/strcasecmp.lo.go obj/src/string/strcasestr.lo.go obj/src/string/strcat.lo.go obj/src/string/strchr.lo.go obj/src/string/strchrnul.lo.go obj/src/string/strcmp.lo.go obj/src/string/strcpy.lo.go obj/src/string/strcspn.lo.go obj/src/string/strdup.lo.go obj/src/string/strerror_r.lo.go obj/src/string/strlcat.lo.go obj/src/string/strlcpy.lo.go obj/src/string/strlen.lo.go obj/src/string/strncasecmp.lo.go obj/src/string/strncat.lo.go obj/src/string/strncmp.lo.go obj/src/string/strncpy.lo.go obj/src/string/strndup.lo.go obj/src/string/strnlen.lo.go obj/src/string/strpbrk.lo.go obj/src/string/strrchr.lo.go obj/src/string/strsep.lo.go obj/src/string/strsignal.lo.go obj/src/string/strspn.lo.go obj/src/string/strstr.lo.go obj/src/string/strtok.lo.go obj/src/string/strtok_r.lo.go obj/src/string/strverscmp.lo.go obj/src/string/swab.lo.go obj/src/string/wcpcpy.lo.go obj/src/string/wcpncpy.lo.go obj/src/string/wcscasecmp.lo.go obj/src/string/wcscasecmp_l.lo.go obj/src/string/wcscat.lo.go obj/src/string/wcschr.lo.go obj/src/string/wcscmp.lo.go obj/src/string/wcscpy.lo.go obj/src/string/wcscspn.lo.go obj/src/string/wcsdup.lo.go obj/src/string/wcslen.lo.go obj/src/string/wcsncasecmp.lo.go obj/src/string/wcsncasecmp_l.lo.go obj/src/string/wcsncat.lo.go obj/src/string/wcsncmp.lo.go obj/src/string/wcsncpy.lo.go obj/src/string/wcsnlen.lo.go obj/src/string/wcspbrk.lo.go obj/src/string/wcsrchr.lo.go obj/src/string/wcsspn.lo.go obj/src/string/wcsstr.lo.go obj/src/string/wcstok.lo.go obj/src/string/wcswcs.lo.go obj/src/string/wmemchr.lo.go obj/src/string/wmemcmp.lo.go obj/src/string/wmemcpy.lo.go obj/src/string/wmemmove.lo.go obj/src/string/wmemset.lo.go obj/src/temp/mkdtemp.lo.go obj/src/temp/mkostemp.lo.go obj/src/temp/mkostemps.lo.go obj/src/temp/mkstemp.lo.go obj/src/temp/mkstemps.lo.go obj/src/temp/mktemp.lo.go obj/src/termios/cfgetospeed.lo.go obj/src/termios/cfmakeraw.lo.go obj/src/termios/cfsetospeed.lo.go obj/src/termios/tcdrain.lo.go obj/src/termios/tcflow.lo.go obj/src/termios/tcflush.lo.go obj/src/termios/tcgetattr.lo.go obj/src/termios/tcgetsid.lo.go obj/src/termios/tcgetwinsize.lo.go obj/src/termios/tcsendbreak.lo.go obj/src/termios/tcsetattr.lo.go obj/src/termios/tcsetwinsize.lo.go obj/src/time/__map_file.lo.go obj/src/time/__month_to_secs.lo.go obj/src/time/__secs_to_tm.lo.go obj/src/time/__tm_to_secs.lo.go obj/src/time/__tz.lo.go obj/src/time/__year_to_secs.lo.go obj/src/time/asctime.lo.go obj/src/time/asctime_r.lo.go obj/src/time/clock.lo.go obj/src/time/clock_getcpuclockid.lo.go obj/src/time/clock_getres.lo.go obj/src/time/clock_gettime.lo.go obj/src/time/clock_nanosleep.lo.go obj/src/time/clock_settime.lo.go obj/src/time/ctime.lo.go obj/src/time/ctime_r.lo.go obj/src/time/difftime.lo.go obj/src/time/ftime.lo.go obj/src/time/getdate.lo.go obj/src/time/gettimeofday.lo.go obj/src/time/gmtime.lo.go obj/src/time/gmtime_r.lo.go obj/src/time/localtime.lo.go obj/src/time/localtime_r.lo.go obj/src/time/mktime.lo.go obj/src/time/nanosleep.lo.go obj/src/time/strftime.lo.go obj/src/time/strptime.lo.go obj/src/time/time.lo.go obj/src/time/timegm.lo.go obj/src/time/timer_delete.lo.go obj/src/time/timer_getoverrun.lo.go obj/src/time/timer_gettime.lo.go obj/src/time/timer_settime.lo.go obj/src/time/times.lo.go obj/src/time/timespec_get.lo.go obj/src/time/utime.lo.go obj/src/time/wcsftime.lo.go obj/src/unistd/_exit.lo.go obj/src/unistd/access.lo.go obj/src/unistd/acct.lo.go obj/src/unistd/alarm.lo.go obj/src/unistd/chdir.lo.go obj/src/unistd/chown.lo.go obj/src/unistd/close.lo.go obj/src/unistd/ctermid.lo.go obj/src/unistd/dup.lo.go obj/src/unistd/dup2.lo.go obj/src/unistd/dup3.lo.go obj/src/unistd/faccessat.lo.go obj/src/unistd/fchdir.lo.go obj/src/unistd/fchown.lo.go obj/src/unistd/fchownat.lo.go obj/src/unistd/fdatasync.lo.go obj/src/unistd/fsync.lo.go obj/src/unistd/ftruncate.lo.go obj/src/unistd/getcwd.lo.go obj/src/unistd/getegid.lo.go obj/src/unistd/geteuid.lo.go obj/src/unistd/getgid.lo.go obj/src/unistd/getgroups.lo.go obj/src/unistd/gethostname.lo.go obj/src/unistd/getlogin.lo.go obj/src/unistd/getlogin_r.lo.go obj/src/unistd/getpgid.lo.go obj/src/unistd/getpgrp.lo.go obj/src/unistd/getpid.lo.go obj/src/unistd/getppid.lo.go obj/src/unistd/getsid.lo.go obj/src/unistd/getuid.lo.go obj/src/unistd/isatty.lo.go obj/src/unistd/lchown.lo.go obj/src/unistd/link.lo.go obj/src/unistd/linkat.lo.go obj/src/unistd/lseek.lo.go obj/src/unistd/nice.lo.go obj/src/unistd/pause.lo.go obj/src/unistd/pipe.lo.go obj/src/unistd/pipe2.lo.go obj/src/unistd/posix_close.lo.go obj/src/unistd/pread.lo.go obj/src/unistd/preadv.lo.go obj/src/unistd/pwrite.lo.go obj/src/unistd/pwritev.lo.go obj/src/unistd/read.lo.go obj/src/unistd/readlink.lo.go obj/src/unistd/readlinkat.lo.go obj/src/unistd/readv.lo.go obj/src/unistd/renameat.lo.go obj/src/unistd/rmdir.lo.go obj/src/unistd/setgid.lo.go obj/src/unistd/setpgid.lo.go obj/src/unistd/setpgrp.lo.go obj/src/unistd/setsid.lo.go obj/src/unistd/setuid.lo.go obj/src/unistd/setxid.lo.go obj/src/unistd/sleep.lo.go obj/src/unistd/symlink.lo.go obj/src/unistd/symlinkat.lo.go obj/src/unistd/sync.lo.go obj/src/unistd/tcgetpgrp.lo.go obj/src/unistd/tcsetpgrp.lo.go obj/src/unistd/truncate.lo.go obj/src/unistd/ttyname.lo.go obj/src/unistd/ttyname_r.lo.go obj/src/unistd/ualarm.lo.go obj/src/unistd/unlink.lo.go obj/src/unistd/unlinkat.lo.go obj/src/unistd/usleep.lo.go obj/src/unistd/write.lo.go obj/src/unistd/writev.lo.go -lgcc -lgcc_eh', DO NOT EDIT. //go:build linux && amd64 // +build linux,amd64 @@ -98,7 +98,6 @@ const LDBL_TRUE_MIN = 0 const LITTLE_ENDIAN = 1234 const MATH_ERREXCEPT = 2 const MATH_ERRNO = 1 -const MAXFLOAT = 0 const M_1_PI = 0 const M_2_PI = 0 const M_2_SQRTPI = 0 @@ -703,7 +702,7 @@ func Xcabsl(tls *TLS, z complex128) (r float64) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Xcabs(tls, Complex128FromComplex128(z)) + return float64(Xcabs(tls, Complex128FromComplex128(complex128(z)))) } const M_PI_21 = 1.5707963267948966 @@ -829,7 +828,7 @@ func Xcacoshl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcacosh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcacosh(tls, Complex128FromComplex128(complex128(z)))) } func Xcacosl(tls *TLS, z complex128) (r complex128) { @@ -837,7 +836,7 @@ func Xcacosl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcacos(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcacos(tls, Complex128FromComplex128(complex128(z)))) } func Xcarg(tls *TLS, z complex128) (r float64) { @@ -861,7 +860,7 @@ func Xcargl(tls *TLS, z complex128) (r float64) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Xcarg(tls, Complex128FromComplex128(z)) + return float64(Xcarg(tls, Complex128FromComplex128(complex128(z)))) } // FIXME @@ -911,7 +910,7 @@ func Xcasinf(tls *TLS, z complex64) (r1 complex64) { y = +(*(*[2]float32)(unsafe.Pointer(&z)))[int32(1)] v1 = [2]float32{ 0: float32(Float64FromFloat64(1) - float64((x-y)*(x+y))), - 1: float32(-Float64FromFloat64(2) * float64(x) * float64(y)), + 1: float32(-Float64FromFloat64(2) * float64(float64(x)) * float64(float64(y))), } w = *(*complex64)(unsafe.Pointer(&v1)) v2 = [2]float32{ @@ -971,7 +970,7 @@ func Xcasinhl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcasinh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcasinh(tls, Complex128FromComplex128(complex128(z)))) } func Xcasinl(tls *TLS, z complex128) (r complex128) { @@ -979,7 +978,7 @@ func Xcasinl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcasin(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcasin(tls, Complex128FromComplex128(complex128(z)))) } const MAXNUM = 0 @@ -999,8 +998,8 @@ func __redupi(tls *TLS, x float64) (r float64) { } else { t -= float64(0.5) } - i = int64(t) /* the multiple */ - t = float64(i) + i = int64(int64(t)) /* the multiple */ + t = float64(float64(i)) t = x - t*_DP1 - t*_DP2 - t*_DP3 return t } @@ -1051,9 +1050,9 @@ func __redupif(tls *TLS, xx float32) (r float32) { } else { t -= Float32FromFloat32(0.5) } - i = int64(t) /* the multiple */ - t = float32(i) - t = float32(float64(x) - float64(t)*_DP11 - float64(t)*_DP21 - float64(t)*_DP31) + i = int64(int64(t)) /* the multiple */ + t = float32(float32(i)) + t = float32(float64(float64(x)) - float64(float64(t))*_DP11 - float64(float64(t))*_DP21 - float64(float64(t))*_DP31) return t } @@ -1131,7 +1130,7 @@ func Xcatanhl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcatanh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcatanh(tls, Complex128FromComplex128(complex128(z)))) } func Xcatanl(tls *TLS, z complex128) (r complex128) { @@ -1139,7 +1138,7 @@ func Xcatanl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcatan(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcatan(tls, Complex128FromComplex128(complex128(z)))) } /* cos(z) = cosh(i z) */ @@ -1188,10 +1187,10 @@ func Xccosh(tls *TLS, z complex128) (r complex128) { y = +(*(*[2]float64)(unsafe.Pointer(&z)))[int32(1)] __u = *(*Tuint64_t)(unsafe.Pointer(&x)) hx = int32(__u >> int32(32)) - lx = int32(uint32(__u)) + lx = int32(uint32(uint32(__u))) __u1 = *(*Tuint64_t)(unsafe.Pointer(&y)) hy = int32(__u1 >> int32(32)) - ly = int32(uint32(__u1)) + ly = int32(uint32(uint32(__u1))) ix = int32(0x7fffffff) & hx iy = int32(0x7fffffff) & hy /* Handle the nearly-non-exceptional cases where x and y are finite. */ @@ -1457,7 +1456,7 @@ func Xccoshl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xccosh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xccosh(tls, Complex128FromComplex128(complex128(z)))) } func Xccosl(tls *TLS, z complex128) (r complex128) { @@ -1465,7 +1464,7 @@ func Xccosl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xccos(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xccos(tls, Complex128FromComplex128(complex128(z)))) } var _exp_ovfl = uint32(0x40862e42) /* high bits of MAX_EXP * ln2 ~= 710 */ @@ -1485,7 +1484,7 @@ func Xcexp(tls *TLS, z complex128) (r complex128) { y = +(*(*[2]float64)(unsafe.Pointer(&z)))[int32(1)] __u = *(*Tuint64_t)(unsafe.Pointer(&y)) hy = uint32(__u >> int32(32)) - ly = uint32(__u) + ly = uint32(uint32(__u)) hy &= uint32(0x7fffffff) /* cexp(x + I 0) = exp(x) + I 0 */ if hy|ly == uint32(0) { @@ -1497,7 +1496,7 @@ func Xcexp(tls *TLS, z complex128) (r complex128) { } __u1 = *(*Tuint64_t)(unsafe.Pointer(&x)) hx = uint32(__u1 >> int32(32)) - lx = uint32(__u1) + lx = uint32(uint32(__u1)) /* cexp(0 + I y) = cos(y) + I sin(y) */ if hx&uint32(0x7fffffff)|lx == uint32(0) { v2 = [2]float64{ @@ -1641,7 +1640,7 @@ func Xcexpl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcexp(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcexp(tls, Complex128FromComplex128(complex128(z)))) } func Xcimag(tls *TLS, z complex128) (r float64) { @@ -1713,7 +1712,7 @@ func Xclogl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xclog(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xclog(tls, Complex128FromComplex128(complex128(z)))) } func Xconj(tls *TLS, z complex128) (r complex128) { @@ -1781,7 +1780,7 @@ func Xcpowl(tls *TLS, z complex128, c complex128) (r complex128) { trc("tls=%v z=%v c=%v, (%v:)", tls, z, c, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcpow(tls, Complex128FromComplex128(z), Complex128FromComplex128(c))) + return Complex128FromComplex128(Xcpow(tls, Complex128FromComplex128(complex128(z)), Complex128FromComplex128(complex128(c)))) } func Xcproj(tls *TLS, z complex128) (r complex128) { @@ -1803,6 +1802,7 @@ func Xcproj(tls *TLS, z complex128) (r complex128) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) == Uint64FromUint64(0x7ff)< %v", r) }() } - return Complex128FromComplex128(Xcproj(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcproj(tls, Complex128FromComplex128(complex128(z)))) } func Xcreal(tls *TLS, z complex128) (r float64) { @@ -1942,10 +1943,10 @@ func Xcsinh(tls *TLS, z complex128) (r complex128) { y = +(*(*[2]float64)(unsafe.Pointer(&z)))[int32(1)] __u = *(*Tuint64_t)(unsafe.Pointer(&x)) hx = int32(__u >> int32(32)) - lx = int32(uint32(__u)) + lx = int32(uint32(uint32(__u))) __u1 = *(*Tuint64_t)(unsafe.Pointer(&y)) hy = int32(__u1 >> int32(32)) - ly = int32(uint32(__u1)) + ly = int32(uint32(uint32(__u1))) ix = int32(0x7fffffff) & hx iy = int32(0x7fffffff) & hy /* Handle the nearly-non-exceptional cases where x and y are finite. */ @@ -2212,7 +2213,7 @@ func Xcsinhl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcsinh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcsinh(tls, Complex128FromComplex128(complex128(z)))) } func Xcsinl(tls *TLS, z complex128) (r complex128) { @@ -2220,7 +2221,7 @@ func Xcsinl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcsin(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcsin(tls, Complex128FromComplex128(complex128(z)))) } const THRESH = 7.446288774449766e+307 @@ -2443,17 +2444,17 @@ _9: * This is Algorithm 312, CACM vol 10, Oct 1967. */ if a >= Float32FromInt32(0) { - t = Xsqrt(tls, (float64(a)+Xhypot(tls, float64(a), float64(b)))*float64(0.5)) + t = Xsqrt(tls, (float64(float64(a))+Xhypot(tls, float64(float64(a)), float64(float64(b))))*float64(0.5)) v14 = [2]float32{ 0: float32(t), - 1: float32(float64(b) / (Float64FromFloat64(2) * t)), + 1: float32(float64(float64(b)) / (Float64FromFloat64(2) * t)), } return *(*complex64)(unsafe.Pointer(&v14)) } else { - t = Xsqrt(tls, (float64(-a)+Xhypot(tls, float64(a), float64(b)))*float64(0.5)) + t = Xsqrt(tls, (float64(-a)+Xhypot(tls, float64(float64(a)), float64(float64(b))))*float64(0.5)) v15 = [2]float32{ 0: float32(float64(Xfabsf(tls, b)) / (Float64FromFloat64(2) * t)), - 1: Xcopysignf(tls, float32(t), b), + 1: Xcopysignf(tls, float32(float32(t)), b), } return *(*complex64)(unsafe.Pointer(&v15)) } @@ -2468,7 +2469,7 @@ func Xcsqrtl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xcsqrt(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xcsqrt(tls, Complex128FromComplex128(complex128(z)))) } /* tan(z) = -i tanh(i z) */ @@ -2532,7 +2533,7 @@ func Xctanh(tls *TLS, z complex128) (r complex128) { y = +(*(*[2]float64)(unsafe.Pointer(&z)))[int32(1)] __u1 = *(*Tuint64_t)(unsafe.Pointer(&x)) hx = uint32(__u1 >> int32(32)) - lx = uint32(__u1) + lx = uint32(uint32(__u1)) ix = hx & uint32(0x7fffffff) /* * ctanh(NaN + i 0) = NaN + i 0 @@ -2722,7 +2723,7 @@ func Xctanhl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xctanh(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xctanh(tls, Complex128FromComplex128(complex128(z)))) } func Xctanl(tls *TLS, z complex128) (r complex128) { @@ -2730,7 +2731,7 @@ func Xctanl(tls *TLS, z complex128) (r complex128) { trc("tls=%v z=%v, (%v:)", tls, z, origin(2)) defer func() { trc("-> %v", r) }() } - return Complex128FromComplex128(Xctan(tls, Complex128FromComplex128(z))) + return Complex128FromComplex128(Xctan(tls, Complex128FromComplex128(complex128(z)))) } const BUFSIZ = 1024 @@ -2835,7 +2836,6 @@ const ENOTSUP = 95 const ENOTTY = 25 const ENOTUNIQ = 76 const ENXIO = 6 -const EOF = -1 const EOPNOTSUPP = 95 const EOVERFLOW = 75 const EOWNERDEAD = 130 @@ -2881,11 +2881,8 @@ const L_tmpnam = 20 const POSIX_CLOSE_RESTART = 0 const P_tmpdir = "/tmp" const R_OK = 4 -const SEEK_CUR = 1 const SEEK_DATA = 3 -const SEEK_END = 2 const SEEK_HOLE = 4 -const SEEK_SET = 0 const STDERR_FILENO = 2 const STDIN_FILENO = 0 const STDOUT_FILENO = 1 @@ -3145,10 +3142,6 @@ const _SC_XOPEN_XPG4 = 100 const _XOPEN_ENH_I18N = 1 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 -const errno = 0 -const stderr = 0 -const stdin = 0 -const stdout = 0 type Tsize_t = uint64 @@ -3189,7 +3182,7 @@ func Xconfstr(tls *TLS, name int32, buf uintptr, len1 Tsize_t) (r Tsize_t) { if !(name != 0) { s = __ccgo_ts + 1 } else { - if uint32(name) & ^Uint32FromUint32(4) != uint32(1) && uint32(name-int32(_CS_POSIX_V6_ILP32_OFF32_CFLAGS)) > uint32(35) { + if uint32(uint32(name)) & ^Uint32FromUint32(4) != uint32(1) && uint32(name-int32(_CS_POSIX_V6_ILP32_OFF32_CFLAGS)) > uint32(35) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uint64(0) } @@ -3243,6 +3236,9 @@ const PTHREAD_STACK_MIN = 2048 const RE_DUP_MAX = 255 const SCHAR_MAX = 127 const SCHAR_MIN = -128 +const SEEK_CUR = 1 +const SEEK_END = 2 +const SEEK_SET = 0 const SEM_NSEMS_MAX = 256 const SEM_VALUE_MAX = 2147483647 const SHRT_MAX = 32767 @@ -3313,7 +3309,7 @@ func Xfpathconf(tls *TLS, fd int32, name int32) (r int64) { trc("tls=%v fd=%v name=%v, (%v:)", tls, fd, name, origin(2)) defer func() { trc("-> %v", r) }() } - if uint64(name) >= Uint64FromInt64(42)/Uint64FromInt64(2) { + if uint64(uint64(name)) >= Uint64FromInt64(42)/Uint64FromInt64(2) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) } @@ -6132,7 +6128,6 @@ const SYS_exit = 60 const SYS_exit_group = 231 const SYS_faccessat = 269 const SYS_faccessat2 = 439 -const SYS_fadvise = 221 const SYS_fadvise64 = 221 const SYS_fallocate = 285 const SYS_fanotify_init = 300 @@ -6157,7 +6152,6 @@ const SYS_fsmount = 432 const SYS_fsopen = 430 const SYS_fspick = 433 const SYS_fstat = 5 -const SYS_fstatat = 262 const SYS_fstatfs = 138 const SYS_fsync = 74 const SYS_ftruncate = 77 @@ -6170,7 +6164,6 @@ const SYS_get_robust_list = 274 const SYS_get_thread_area = 211 const SYS_getcpu = 309 const SYS_getcwd = 79 -const SYS_getdents = 217 const SYS_getdents64 = 217 const SYS_getegid = 108 const SYS_geteuid = 107 @@ -6295,7 +6288,6 @@ const SYS_pkey_mprotect = 329 const SYS_poll = 7 const SYS_ppoll = 271 const SYS_prctl = 157 -const SYS_pread = 17 const SYS_pread64 = 17 const SYS_preadv = 295 const SYS_preadv2 = 327 @@ -6307,7 +6299,6 @@ const SYS_process_vm_writev = 311 const SYS_pselect6 = 270 const SYS_ptrace = 101 const SYS_putpmsg = 182 -const SYS_pwrite = 18 const SYS_pwrite64 = 18 const SYS_pwritev = 296 const SYS_pwritev2 = 328 @@ -7467,7 +7458,7 @@ func Xsysconf(tls *TLS, name int32) (r int64) { var _ /* set at bp+16 */ [128]uint8 var _ /* si at bp+144 */ Tsysinfo _, _, _, _, _, _, _, _ = cnt, i, mem, val, v1, v3, v6, p5 - if uint64(name) >= Uint64FromInt64(502)/Uint64FromInt64(2) || !(_values1[name] != 0) { + if uint64(uint64(name)) >= Uint64FromInt64(502)/Uint64FromInt64(2) || !(_values1[name] != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) } else { @@ -7512,7 +7503,7 @@ func Xsysconf(tls *TLS, name int32) (r int64) { cnt = v3 i = v3 for { - if !(uint64(i) < uint64(128)) { + if !(uint64(uint64(i)) < uint64(128)) { break } for { @@ -7521,15 +7512,17 @@ func Xsysconf(tls *TLS, name int32) (r int64) { } goto _4 _4: + ; p5 = bp + 16 + uintptr(i) *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) & (int32((*(*[128]uint8)(unsafe.Pointer(bp + 16)))[i]) - Int32FromInt32(1))) cnt++ } goto _2 _2: + ; i++ } - return int64(cnt) + return int64(int64(cnt)) case (-Int32FromInt32(256) | Int32FromInt32(8)) & Int32FromInt32(255): fallthrough case (-Int32FromInt32(256) | Int32FromInt32(9)) & Int32FromInt32(255): @@ -7538,9 +7531,9 @@ func Xsysconf(tls *TLS, name int32) (r int64) { (*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Fmem_unit = uint32(1) } if name == int32(_SC_PHYS_PAGES) { - mem = (*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Ftotalram + mem = uint64((*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Ftotalram) } else { - mem = (*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Ffreeram + (*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Fbufferram + mem = uint64((*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Ffreeram + (*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Fbufferram) } mem *= uint64((*(*Tsysinfo)(unsafe.Pointer(bp + 144))).Fmem_unit) mem /= uint64(PAGESIZE) @@ -9070,6 +9063,7 @@ func _BF_swap(tls *TLS, x uintptr, count int32) { *(*TBF_word)(unsafe.Pointer(v4)) = tmp&uint32(0x00FF00FF)<>Int32FromInt32(8)&uint32(0x00FF00FF) goto _3 _3: + ; count-- v2 = count if !(v2 != 0) { @@ -9122,6 +9116,7 @@ func _BF_encrypt(tls *TLS, ctx uintptr, L TBF_word, R TBF_word, start uintptr, e L ^= tmp3 goto _1 _1: + ; i += int32(2) } tmp4 = R @@ -9181,8 +9176,8 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags * Prefix "$2x$": bug = 1, safety = 0 * Prefix "$2y$": bug = 0, safety = 0 */ - bug = uint32(int32(flags) & int32(1)) - safety = uint32(flags) & uint32(2) << int32(15) + bug = uint32(int32(int32(flags)) & int32(1)) + safety = uint32(uint32(flags)) & uint32(2) << int32(15) v1 = Uint32FromInt32(0) diff = v1 sign = v1 @@ -9202,7 +9197,7 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags *(*TBF_word)(unsafe.Pointer(bp)) <<= uint32(8) *(*TBF_word)(unsafe.Pointer(bp)) |= uint32(uint8(*(*int8)(unsafe.Pointer(ptr)))) /* correct */ *(*TBF_word)(unsafe.Pointer(bp + 1*4)) <<= uint32(8) - *(*TBF_word)(unsafe.Pointer(bp + 1*4)) |= uint32(*(*int8)(unsafe.Pointer(ptr))) /* bug */ + *(*TBF_word)(unsafe.Pointer(bp + 1*4)) |= uint32(int8(*(*int8)(unsafe.Pointer(ptr)))) /* bug */ /* * Sign extension in the first char has no effect - nothing to overwrite yet, * and those extra 24 bits will be fully shifted out of the 32-bit word. For @@ -9219,6 +9214,7 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags } goto _4 _4: + ; j++ } diff |= (*(*[2]TBF_word)(unsafe.Pointer(bp)))[0] ^ (*(*[2]TBF_word)(unsafe.Pointer(bp)))[int32(1)] /* Non-zero on any differences */ @@ -9226,6 +9222,7 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags *(*TBF_word)(unsafe.Pointer(initial + uintptr(i)*4)) = *(*TBF_word)(unsafe.Pointer(uintptr(unsafe.Pointer(&_BF_init_state)) + uintptr(i)*4)) ^ (*(*[2]TBF_word)(unsafe.Pointer(bp)))[bug] goto _2 _2: + ; i++ } /* @@ -9314,6 +9311,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + uintptr(i+int32(1))*4)) ^= *(*TBF_word)(unsafe.Pointer(bp + 4168 + uintptr(i+int32(1))*4)) goto _3 _3: + ; i += int32(2) } done = 0 @@ -9338,6 +9336,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + uintptr(i+int32(3))*4)) ^= tmp4 goto _4 _4: + ; i += int32(4) } *(*TBF_word)(unsafe.Pointer(bp + 16*4)) ^= tmp1 @@ -9345,6 +9344,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w } goto _2 _2: + ; count-- v1 = count if !(v1 != 0) { @@ -9363,6 +9363,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w L1 = _BF_encrypt(tls, bp, L1, (*(*[2]TBF_word)(unsafe.Pointer(bp + 4264)))[int32(1)], bp+4264, bp+4264) goto _7 _7: + ; count-- v6 = count if !(v6 != 0) { @@ -9373,6 +9374,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + 4240 + uintptr(i+int32(1))*4)) = (*(*[2]TBF_word)(unsafe.Pointer(bp + 4264)))[int32(1)] goto _5 _5: + ; i += int32(2) } Xmemcpy(tls, output, setting, uint64(Int32FromInt32(7)+Int32FromInt32(22)-Int32FromInt32(1))) @@ -11257,7 +11259,7 @@ func _ascii_to_bin(tls *TLS, ch int32) (r Tuint32_t) { } } retval &= int32(0x3f) - return uint32(retval) + return uint32(uint32(retval)) } // C documentation @@ -11267,7 +11269,7 @@ func _ascii_to_bin(tls *TLS, ch int32) (r Tuint32_t) { // * containing characters that would violate the passwd file format. // */ func _ascii_is_unsafe(tls *TLS, ch uint8) (r int32) { - return BoolInt32(!(ch != 0) || int32(ch) == int32('\n') || int32(ch) == int32(':')) + return BoolInt32(!(ch != 0) || int32(int32(ch)) == int32('\n') || int32(int32(ch)) == int32(':')) } func _setup_salt(tls *TLS, salt Tuint32_t) (r Tuint32_t) { @@ -11289,6 +11291,7 @@ func _setup_salt(tls *TLS, salt Tuint32_t) (r Tuint32_t) { obit >>= uint32(1) goto _1 _1: + ; i++ } return saltbits @@ -11322,6 +11325,7 @@ func X__des_setkey(tls *TLS, key uintptr, ekey uintptr) { k1 |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_key_perm_maskr)) + uintptr(j+uint32(1))*64 + uintptr(rawkey0>>ibit&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_key_perm_maskr)) + uintptr(i+uint32(8))*64 + uintptr(rawkey1>>ibit&uint32(0xf))*4)) goto _2 _2: + ; i++ ibit -= uint32(4) } @@ -11354,12 +11358,14 @@ func X__des_setkey(tls *TLS, key uintptr, ekey uintptr) { ibit -= uint32(3) goto _5 _5: + ; i++ } *(*Tuint32_t)(unsafe.Pointer(ekey + uintptr(round)*4)) = kl *(*Tuint32_t)(unsafe.Pointer(ekey + 64 + uintptr(round)*4)) = kr goto _3 _3: + ; round++ } } @@ -11394,6 +11400,7 @@ func X__do_des(tls *TLS, l_in Tuint32_t, r_in Tuint32_t, l_out uintptr, r_out ui r |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_ip_maskr)) + uintptr(i)*64 + uintptr(l_in>>ibit&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_ip_maskr)) + uintptr(i+uint32(8))*64 + uintptr(r_in>>ibit&uint32(0xf))*4)) goto _2 _2: + ; i++ ibit -= uint32(4) } @@ -11464,6 +11471,7 @@ func X__do_des(tls *TLS, l_in Tuint32_t, r_in Tuint32_t, l_out uintptr, r_out ui lo |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_fp_maskl)) + uintptr(i1)*64 + uintptr(l>>ibit1&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_fp_maskl)) + uintptr(i1+uint32(4))*64 + uintptr(r>>ibit1&uint32(0xf))*4)) goto _8 _8: + ; i1++ ibit1 -= uint32(4) } @@ -11537,6 +11545,7 @@ func __crypt_extended_r_uut(tls *TLS, _key uintptr, _setting uintptr, output uin count |= value << ((i - uint32(1)) * uint32(6)) goto _2 _2: + ; i++ } if !(count != 0) { @@ -11555,6 +11564,7 @@ func __crypt_extended_r_uut(tls *TLS, _key uintptr, _setting uintptr, output uin salt |= value1 << ((i - uint32(5)) * uint32(6)) goto _3 _3: + ; i++ } for *(*uint8)(unsafe.Pointer(key)) != 0 { @@ -11780,6 +11790,7 @@ func _processblock(tls *TLS, s uintptr, buf uintptr) { *(*Tuint32_t)(unsafe.Pointer(bp + uintptr(i)*4)) |= uint32(*(*Tuint8_t)(unsafe.Pointer(buf + uintptr(uint32(4)*i+uint32(3))))) << int32(24) goto _1 _1: + ; i++ } a = *(*Tuint32_t)(unsafe.Pointer(s + 8)) @@ -11897,6 +11908,7 @@ func _md5_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(4)*i+int32(3)))) = uint8(*(*Tuint32_t)(unsafe.Pointer(s + 8 + uintptr(i)*4)) >> int32(24)) goto _1 _1: + ; i++ } } @@ -11925,6 +11937,7 @@ func _md5_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock(tls, s, p) goto _1 _1: + ; len1 -= uint64(64) p += uintptr(64) } @@ -12004,30 +12017,32 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt } goto _1 _1: + ; i++ } slen = i /* md5(key salt key) */ _md5_init(tls, bp) - _md5_update(tls, bp, key, uint64(klen)) - _md5_update(tls, bp, salt, uint64(slen)) - _md5_update(tls, bp, key, uint64(klen)) + _md5_update(tls, bp, key, uint64(uint64(klen))) + _md5_update(tls, bp, salt, uint64(uint64(slen))) + _md5_update(tls, bp, key, uint64(uint64(klen))) _md5_sum(tls, bp, bp+88) /* md5(key $1$ salt repeated-md weird-key[0]-0) */ _md5_init(tls, bp) - _md5_update(tls, bp, key, uint64(klen)) + _md5_update(tls, bp, key, uint64(uint64(klen))) _md5_update(tls, bp, setting, uint64(uint32(3)+slen)) i = klen for { - if !(uint64(i) > uint64(16)) { + if !(uint64(uint64(i)) > uint64(16)) { break } _md5_update(tls, bp, bp+88, uint64(16)) goto _2 _2: + ; i = uint32(uint64(i) - Uint64FromInt64(16)) } - _md5_update(tls, bp, bp+88, uint64(i)) + _md5_update(tls, bp, bp+88, uint64(uint64(i))) (*(*[16]uint8)(unsafe.Pointer(bp + 88)))[0] = uint8(0) i = klen for { @@ -12041,6 +12056,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt } goto _3 _3: + ; i >>= uint32(1) } _md5_sum(tls, bp, bp+88) @@ -12052,24 +12068,25 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt } _md5_init(tls, bp) if i%uint32(2) != 0 { - _md5_update(tls, bp, key, uint64(klen)) + _md5_update(tls, bp, key, uint64(uint64(klen))) } else { _md5_update(tls, bp, bp+88, uint64(16)) } if i%uint32(3) != 0 { - _md5_update(tls, bp, salt, uint64(slen)) + _md5_update(tls, bp, salt, uint64(uint64(slen))) } if i%uint32(7) != 0 { - _md5_update(tls, bp, key, uint64(klen)) + _md5_update(tls, bp, key, uint64(uint64(klen))) } if i%uint32(2) != 0 { _md5_update(tls, bp, bp+88, uint64(16)) } else { - _md5_update(tls, bp, key, uint64(klen)) + _md5_update(tls, bp, key, uint64(uint64(klen))) } _md5_sum(tls, bp, bp+88) goto _4 _4: + ; i++ } /* output is $1$salt$hash */ @@ -12086,6 +12103,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt p = _to64(tls, p, uint32(int32((*(*[16]uint8)(unsafe.Pointer(bp + 88)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm)) + uintptr(i)*3))])<>Int32FromInt32(10) + (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(7)] + (_ror(tls, (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(7)) ^ _ror(tls, (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(18)) ^ (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)]>>Int32FromInt32(3)) + (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(16)] goto _2 _2: + ; i++ } a = *(*Tuint32_t)(unsafe.Pointer(s + 8)) @@ -12321,6 +12341,7 @@ func _processblock1(tls *TLS, s uintptr, buf uintptr) { a = t1 + t2 goto _3 _3: + ; i++ } *(*Tuint32_t)(unsafe.Pointer(s + 8)) += a @@ -12385,6 +12406,7 @@ func _sha256_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(4)*i+int32(3)))) = uint8(*(*Tuint32_t)(unsafe.Pointer(s + 8 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -12413,6 +12435,7 @@ func _sha256_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock1(tls, s, p) goto _1 _1: + ; len1 -= uint64(64) p += uintptr(64) } @@ -12457,9 +12480,10 @@ func _hashmd(tls *TLS, s uintptr, n uint32, md uintptr) { _sha256_update(tls, s, md, uint64(32)) goto _1 _1: + ; i -= uint32(32) } - _sha256_update(tls, s, md, uint64(i)) + _sha256_update(tls, s, md, uint64(uint64(i))) } func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 uintptr) { @@ -12515,7 +12539,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if u > uint64(ROUNDS_MAX) { return uintptr(0) } else { - r = uint32(u) + r = uint32(uint32(u)) } } /* needed when rounds is zero prefixed or out of bounds */ @@ -12532,19 +12556,20 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _1 _1: + ; i++ } slen = i /* B = sha(key salt key) */ _sha256_init(tls, bp) - _sha256_update(tls, bp, key, uint64(klen)) - _sha256_update(tls, bp, salt, uint64(slen)) - _sha256_update(tls, bp, key, uint64(klen)) + _sha256_update(tls, bp, key, uint64(uint64(klen))) + _sha256_update(tls, bp, salt, uint64(uint64(slen))) + _sha256_update(tls, bp, key, uint64(uint64(klen))) _sha256_sum(tls, bp, bp+104) /* A = sha(key salt repeat-B alternate-B-key) */ _sha256_init(tls, bp) - _sha256_update(tls, bp, key, uint64(klen)) - _sha256_update(tls, bp, salt, uint64(slen)) + _sha256_update(tls, bp, key, uint64(uint64(klen))) + _sha256_update(tls, bp, salt, uint64(uint64(slen))) _hashmd(tls, bp, klen, bp+104) i = klen for { @@ -12554,10 +12579,11 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if i&uint32(1) != 0 { _sha256_update(tls, bp, bp+104, uint64(32)) } else { - _sha256_update(tls, bp, key, uint64(klen)) + _sha256_update(tls, bp, key, uint64(uint64(klen))) } goto _2 _2: + ; i >>= uint32(1) } _sha256_sum(tls, bp, bp+104) @@ -12568,9 +12594,10 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if !(i < klen) { break } - _sha256_update(tls, bp, key, uint64(klen)) + _sha256_update(tls, bp, key, uint64(uint64(klen))) goto _3 _3: + ; i++ } _sha256_sum(tls, bp, bp+136) @@ -12581,9 +12608,10 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if !(i < uint32(int32(16)+int32((*(*[32]uint8)(unsafe.Pointer(bp + 104)))[0]))) { break } - _sha256_update(tls, bp, salt, uint64(slen)) + _sha256_update(tls, bp, salt, uint64(uint64(slen))) goto _4 _4: + ; i++ } _sha256_sum(tls, bp, bp+168) @@ -12600,7 +12628,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha256_update(tls, bp, bp+104, uint64(32)) } if i%uint32(3) != 0 { - _sha256_update(tls, bp, bp+168, uint64(slen)) + _sha256_update(tls, bp, bp+168, uint64(uint64(slen))) } if i%uint32(7) != 0 { _hashmd(tls, bp, klen, bp+136) @@ -12613,6 +12641,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha256_sum(tls, bp, bp+104) goto _5 _5: + ; i++ } /* output is $5$rounds=n$salt$hash */ @@ -12626,6 +12655,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui p = _to641(tls, p, uint32(int32((*(*[32]uint8)(unsafe.Pointer(bp + 104)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm1)) + uintptr(i)*3))])<>Int32FromInt32(6) + (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(7)] + (_ror1(tls, (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(1)) ^ _ror1(tls, (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(8)) ^ (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)]>>Int32FromInt32(7)) + (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(16)] goto _2 _2: + ; i++ } a = *(*Tuint64_t)(unsafe.Pointer(s + 8)) @@ -12864,6 +12896,7 @@ func _processblock2(tls *TLS, s uintptr, buf uintptr) { a = t1 + t2 goto _3 _3: + ; i++ } *(*Tuint64_t)(unsafe.Pointer(s + 8)) += a @@ -12932,6 +12965,7 @@ func _sha512_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(8)*i+int32(7)))) = uint8(*(*Tuint64_t)(unsafe.Pointer(s + 8 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -12960,6 +12994,7 @@ func _sha512_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock2(tls, s, p) goto _1 _1: + ; len1 -= uint64(128) p += uintptr(128) } @@ -13004,9 +13039,10 @@ func _hashmd1(tls *TLS, s uintptr, n uint32, md uintptr) { _sha512_update(tls, s, md, uint64(64)) goto _1 _1: + ; i -= uint32(64) } - _sha512_update(tls, s, md, uint64(i)) + _sha512_update(tls, s, md, uint64(uint64(i))) } func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 uintptr) { @@ -13031,6 +13067,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _1 _1: + ; i++ } if i > uint32(KEY_MAX1) { @@ -13071,7 +13108,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if u > uint64(ROUNDS_MAX) { return uintptr(0) } else { - r = uint32(u) + r = uint32(uint32(u)) } } /* needed when rounds is zero prefixed or out of bounds */ @@ -13088,19 +13125,20 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _2 _2: + ; i++ } slen = i /* B = sha(key salt key) */ _sha512_init(tls, bp) - _sha512_update(tls, bp, key, uint64(klen)) - _sha512_update(tls, bp, salt, uint64(slen)) - _sha512_update(tls, bp, key, uint64(klen)) + _sha512_update(tls, bp, key, uint64(uint64(klen))) + _sha512_update(tls, bp, salt, uint64(uint64(slen))) + _sha512_update(tls, bp, key, uint64(uint64(klen))) _sha512_sum(tls, bp, bp+200) /* A = sha(key salt repeat-B alternate-B-key) */ _sha512_init(tls, bp) - _sha512_update(tls, bp, key, uint64(klen)) - _sha512_update(tls, bp, salt, uint64(slen)) + _sha512_update(tls, bp, key, uint64(uint64(klen))) + _sha512_update(tls, bp, salt, uint64(uint64(slen))) _hashmd1(tls, bp, klen, bp+200) i = klen for { @@ -13110,10 +13148,11 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if i&uint32(1) != 0 { _sha512_update(tls, bp, bp+200, uint64(64)) } else { - _sha512_update(tls, bp, key, uint64(klen)) + _sha512_update(tls, bp, key, uint64(uint64(klen))) } goto _3 _3: + ; i >>= uint32(1) } _sha512_sum(tls, bp, bp+200) @@ -13124,9 +13163,10 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if !(i < klen) { break } - _sha512_update(tls, bp, key, uint64(klen)) + _sha512_update(tls, bp, key, uint64(uint64(klen))) goto _4 _4: + ; i++ } _sha512_sum(tls, bp, bp+264) @@ -13137,9 +13177,10 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui if !(i < uint32(int32(16)+int32((*(*[64]uint8)(unsafe.Pointer(bp + 200)))[0]))) { break } - _sha512_update(tls, bp, salt, uint64(slen)) + _sha512_update(tls, bp, salt, uint64(uint64(slen))) goto _5 _5: + ; i++ } _sha512_sum(tls, bp, bp+328) @@ -13156,7 +13197,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha512_update(tls, bp, bp+200, uint64(64)) } if i%uint32(3) != 0 { - _sha512_update(tls, bp, bp+328, uint64(slen)) + _sha512_update(tls, bp, bp+328, uint64(uint64(slen))) } if i%uint32(7) != 0 { _hashmd1(tls, bp, klen, bp+264) @@ -13169,6 +13210,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha512_sum(tls, bp, bp+200) goto _6 _6: + ; i++ } /* output is $6$rounds=n$salt$hash */ @@ -13182,6 +13224,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui p = _to642(tls, p, uint32(int32((*(*[64]uint8)(unsafe.Pointer(bp + 200)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm2)) + uintptr(i)*3))])<> j & uint32(1)) goto _5 _5: + ; j-- } goto _4 _4: + ; i++ } } @@ -13893,7 +13943,7 @@ func X__ctype_get_mb_cur_max(tls *TLS) (r Tsize_t) { } var v1 int32 _ = v1 - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -14210,7 +14260,7 @@ func Xisalpha(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) + return BoolInt32(uint32(uint32(c))|uint32(32)-uint32('a') < uint32(26)) } func X__isalpha_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14266,7 +14316,7 @@ func Xiscntrl(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c) < uint32(0x20) || c == int32(0x7f)) + return BoolInt32(uint32(uint32(c)) < uint32(0x20) || c == int32(0x7f)) } func X__iscntrl_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14290,7 +14340,7 @@ func Xisdigit(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)-uint32('0') < uint32(10)) + return BoolInt32(uint32(uint32(c))-uint32('0') < uint32(10)) } func X__isdigit_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14314,7 +14364,7 @@ func Xisgraph(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)-uint32(0x21) < uint32(0x5e)) + return BoolInt32(uint32(uint32(c))-uint32(0x21) < uint32(0x5e)) } func X__isgraph_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14338,7 +14388,7 @@ func Xislower(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)-uint32('a') < uint32(26)) + return BoolInt32(uint32(uint32(c))-uint32('a') < uint32(26)) } func X__islower_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14362,7 +14412,7 @@ func Xisprint(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)-uint32(0x20) < uint32(0x5f)) + return BoolInt32(uint32(uint32(c))-uint32(0x20) < uint32(0x5f)) } func X__isprint_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14410,7 +14460,7 @@ func Xisspace(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(c == int32(' ') || uint32(c)-uint32('\t') < uint32(5)) + return BoolInt32(c == int32(' ') || uint32(uint32(c))-uint32('\t') < uint32(5)) } func X__isspace_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14434,7 +14484,7 @@ func Xisupper(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(uint32(c)-uint32('A') < uint32(26)) + return BoolInt32(uint32(uint32(c))-uint32('A') < uint32(26)) } func X__isupper_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -14453,8 +14503,6 @@ func Xisupper_l(tls *TLS, c int32, l Tlocale_t) (r int32) { return X__isupper_l(tls, c, l) } -const WEOF = 4294967295 - type Twint_t = uint32 type Twctype_t = uint64 @@ -17358,7 +17406,7 @@ func Xiswblank(tls *TLS, wc Twint_t) (r int32) { trc("tls=%v wc=%v, (%v:)", tls, wc, origin(2)) defer func() { trc("-> %v", r) }() } - return Xisblank(tls, int32(wc)) + return Xisblank(tls, int32(int32(wc))) } func X__iswblank_l(tls *TLS, c Twint_t, l Tlocale_t) (r int32) { @@ -17463,10 +17511,11 @@ func Xwctype(tls *TLS, s uintptr) (r Twctype_t) { break } if int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(p))) && !(Xstrcmp(tls, s, p) != 0) { - return uint64(i) + return uint64(uint64(i)) } goto _1 _1: + ; i++ p += uintptr(6) } @@ -19216,7 +19265,7 @@ func Xiswspace(tls *TLS, wc Twint_t) (r int32) { trc("tls=%v wc=%v, (%v:)", tls, wc, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(wc != 0 && Xwcschr(tls, uintptr(unsafe.Pointer(&_spaces)), int32(wc)) != 0) + return BoolInt32(wc != 0 && Xwcschr(tls, uintptr(unsafe.Pointer(&_spaces)), int32(int32(wc))) != 0) } var _spaces = [22]Twchar_t{ @@ -19312,7 +19361,7 @@ func Xisxdigit(tls *TLS, c int32) (r int32) { trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) defer func() { trc("-> %v", r) }() } - return BoolInt32(BoolInt32(uint32(c)-uint32('0') < uint32(10)) != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6)) + return BoolInt32(BoolInt32(uint32(c)-uint32('0') < uint32(10)) != 0 || uint32(uint32(c))|uint32(32)-uint32('a') < uint32(6)) } func X__isxdigit_l(tls *TLS, c int32, l Tlocale_t) (r int32) { @@ -22180,9 +22229,9 @@ func _casemap(tls *TLS, c uint32, dir int32) (r1 int32) { var b, rt, try, v, x, xb, xn, y uint32 var c0, r, rd, v1 int32 _, _, _, _, _, _, _, _, _, _, _, _ = b, c0, r, rd, rt, try, v, x, xb, xn, y, v1 - c0 = int32(c) + c0 = int32(int32(c)) if c >= uint32(0x20000) { - return int32(c) + return int32(int32(c)) } b = c >> int32(8) c &= uint32(255) @@ -22200,12 +22249,12 @@ func _casemap(tls *TLS, c uint32, dir int32) (r1 int32) { /* rules 0/1 are simple lower/upper case with a delta. * apply according to desired mapping direction. */ if rt < uint32(2) { - return int32(uint32(c0) + uint32(rd)&-(rt^uint32(dir))) + return int32(uint32(uint32(c0)) + uint32(uint32(rd))&-(rt^uint32(uint32(dir)))) } /* binary search. endpoints of the binary search for * this block are stored in the rule delta field. */ xn = uint32(rd & int32(0xff)) - xb = uint32(rd) >> int32(8) + xb = uint32(uint32(rd)) >> int32(8) for xn != 0 { try = uint32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_exceptions)) + uintptr(xb+xn/uint32(2))*2))) if try == c { @@ -22213,7 +22262,7 @@ func _casemap(tls *TLS, c uint32, dir int32) (r1 int32) { rt = uint32(r & int32(255)) rd = r >> int32(8) if rt < uint32(2) { - return int32(uint32(c0) + uint32(rd)&-(rt^uint32(dir))) + return int32(uint32(uint32(c0)) + uint32(uint32(rd))&-(rt^uint32(uint32(dir)))) } /* Hard-coded for the four exceptional titlecase */ if dir != 0 { @@ -22311,6 +22360,7 @@ func Xwcswidth(tls *TLS, wcs uintptr, n Tsize_t) (r int32) { } goto _1 _1: + ; l += k wcs += 4 } @@ -24451,7 +24501,7 @@ func Xwcwidth(tls *TLS, wc Twchar_t) (r int32) { } var v1, v2 int32 _, _ = v1, v2 - if uint32(wc) < uint32(0xff) { + if uint32(uint32(wc)) < uint32(0xff) { if (wc+int32(1))&int32(0x7f) >= int32(0x21) { v1 = int32(1) } else { @@ -24464,7 +24514,7 @@ func Xwcwidth(tls *TLS, wc Twchar_t) (r int32) { } return v1 } - if uint32(wc)&uint32(0xfffeffff) < uint32(0xfffe) { + if uint32(uint32(wc))&uint32(0xfffeffff) < uint32(0xfffe) { if int32(_table5[int32(_table5[wc>>int32(8)])*int32(32)+wc&int32(255)>>int32(3)])>>(wc&int32(7))&int32(1) != 0 { return 0 } @@ -24476,10 +24526,10 @@ func Xwcwidth(tls *TLS, wc Twchar_t) (r int32) { if wc&int32(0xfffe) == int32(0xfffe) { return -int32(1) } - if uint32(wc)-uint32(0x20000) < uint32(0x20000) { + if uint32(uint32(wc))-uint32(0x20000) < uint32(0x20000) { return int32(2) } - if wc == int32(0xe0001) || uint32(wc)-uint32(0xe0020) < uint32(0x5f) || uint32(wc)-uint32(0xe0100) < uint32(0xef) { + if wc == int32(0xe0001) || uint32(uint32(wc))-uint32(0xe0020) < uint32(0x5f) || uint32(uint32(wc))-uint32(0xe0100) < uint32(0xef) { return 0 } return int32(1) @@ -24932,7 +24982,7 @@ func Xscandir(tls *TLS, path uintptr, res uintptr, sel uintptr, cmp uintptr) (r Xqsort(tls, names, cnt, uint64(8), cmp) } *(*uintptr)(unsafe.Pointer(res)) = names - return int32(cnt) + return int32(int32(cnt)) } func Xseekdir(tls *TLS, dir uintptr, off int64) { @@ -24973,7 +25023,7 @@ func X__reset_tls(tls *TLS) { var mem, p uintptr var self Tpthread_t _, _, _, _, _ = i, mem, n, p, self - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) n = *(*Tuintptr_t)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(self)).Fdtv)) if n != 0 { p = X__libc.Ftls_head @@ -24987,6 +25037,7 @@ func X__reset_tls(tls *TLS) { Xmemset(tls, mem+uintptr((*Ttls_module)(unsafe.Pointer(p)).Flen1), 0, (*Ttls_module)(unsafe.Pointer(p)).Fsize-(*Ttls_module)(unsafe.Pointer(p)).Flen1) goto _1 _1: + ; i++ p = (*Ttls_module)(unsafe.Pointer(p)).Fnext } @@ -25008,7 +25059,7 @@ func X__init_ssp(tls *TLS, entropy uintptr) { * still be detected. Endianness is taken care of * automatically. */ *(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__stack_chk_guard)) + 1)) = 0 - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fcanary = X__stack_chk_guard + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fcanary = X__stack_chk_guard } func X__stack_chk_fail(tls *TLS) { @@ -25060,7 +25111,7 @@ func Xgetenv(tls *TLS, name uintptr) (r uintptr) { var e uintptr var l Tsize_t _, _ = e, l - l = uint64(int64(X__strchrnul(tls, name, int32('='))) - int64(name)) + l = uint64(int64(X__strchrnul(tls, name, int32('='))) - int64(int64(name))) if l != 0 && !(*(*int8)(unsafe.Pointer(name + uintptr(l))) != 0) && Xenviron != 0 { e = Xenviron for { @@ -25072,6 +25123,7 @@ func Xgetenv(tls *TLS, name uintptr) (r uintptr) { } goto _1 _1: + ; e += 8 } } @@ -25104,6 +25156,7 @@ func X__putenv(tls *TLS, s uintptr, l Tsize_t, r uintptr) (r1 int32) { } goto _1 _1: + ; e += 8 i++ } @@ -25133,6 +25186,7 @@ func X__putenv(tls *TLS, s uintptr, l Tsize_t, r uintptr) (r1 int32) { } return 0 oom: + ; Xfree(tls, r) return -int32(1) } @@ -25146,7 +25200,7 @@ func Xputenv(tls *TLS, s uintptr) (r int32) { } var l Tsize_t _ = l - l = uint64(int64(X__strchrnul(tls, s, int32('='))) - int64(s)) + l = uint64(int64(X__strchrnul(tls, s, int32('='))) - int64(int64(s))) if !(l != 0) || !(*(*int8)(unsafe.Pointer(s + uintptr(l))) != 0) { return Xunsetenv(tls, s) } @@ -25204,6 +25258,7 @@ func X__env_rm_add(tls *TLS, old uintptr, new1 uintptr) { } goto _1 _1: + ; i++ } if !(new1 != 0) { @@ -25234,7 +25289,7 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) (r int32) { var v2 bool _, _, _, _, _ = l1, l2, s, v1, v2 if v2 = !(var1 != 0); !v2 { - v1 = uint64(int64(X__strchrnul(tls, var1, int32('='))) - int64(var1)) + v1 = uint64(int64(X__strchrnul(tls, var1, int32('='))) - int64(int64(var1))) l1 = v1 } if v2 || !(v1 != 0) || *(*int8)(unsafe.Pointer(var1 + uintptr(l1))) != 0 { @@ -25266,7 +25321,7 @@ func Xunsetenv(tls *TLS, name uintptr) (r int32) { var e, eo, v2 uintptr var l Tsize_t _, _, _, _ = e, eo, l, v2 - l = uint64(int64(X__strchrnul(tls, name, int32('='))) - int64(name)) + l = uint64(int64(X__strchrnul(tls, name, int32('='))) - int64(int64(name))) if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) @@ -25291,6 +25346,7 @@ func Xunsetenv(tls *TLS, name uintptr) (r int32) { } goto _1 _1: + ; e += 8 } if eo != e { @@ -25600,7 +25656,7 @@ func X__strerror_l(tls *TLS, e int32, loc Tlocale_t) (r uintptr) { } var s uintptr _ = s - if uint64(e) >= Uint64FromInt64(264)/Uint64FromInt64(2) { + if uint64(uint64(e)) >= Uint64FromInt64(264)/Uint64FromInt64(2) { e = 0 } s = uintptr(unsafe.Pointer(&_errmsgstr)) + uintptr(_errmsgidx[e]) @@ -25612,7 +25668,7 @@ func Xstrerror(tls *TLS, e int32) (r uintptr) { trc("tls=%v e=%v, (%v:)", tls, e, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrerror_l(tls *TLS, e int32, loc Tlocale_t) (r uintptr) { @@ -25737,7 +25793,7 @@ func Xfcntl(tls *TLS, fd int32, cmd int32, va uintptr) (r int32) { return int32(X__syscall3(tls, int64(SYS_fcntl), int64(fd), int64(cmd), int64(uintptr(arg)))) } if ret != 0 { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } if (*(*Tf_owner_ex)(unsafe.Pointer(bp))).Ftype1 == int32(F_OWNER_PGRP) { v1 = -(*(*Tf_owner_ex)(unsafe.Pointer(bp))).Fpid @@ -25752,7 +25808,7 @@ func Xfcntl(tls *TLS, fd int32, cmd int32, va uintptr) (r int32) { if ret1 >= 0 { X__syscall3(tls, int64(SYS_fcntl), int64(ret1), int64(Int32FromInt32(F_SETFD)), int64(Int32FromInt32(FD_CLOEXEC))) } - return int32(X__syscall_ret(tls, uint64(ret1))) + return int32(X__syscall_ret(tls, uint64(uint64(ret1)))) } ret1 = int32(X__syscall3(tls, int64(SYS_fcntl), int64(fd), int64(Int32FromInt32(F_DUPFD_CLOEXEC)), int64(Int32FromInt32(0)))) if ret1 != -int32(EINVAL) { @@ -25765,7 +25821,7 @@ func Xfcntl(tls *TLS, fd int32, cmd int32, va uintptr) (r int32) { if ret1 >= 0 { X__syscall3(tls, int64(SYS_fcntl), int64(ret1), int64(Int32FromInt32(F_SETFD)), int64(Int32FromInt32(FD_CLOEXEC))) } - return int32(X__syscall_ret(tls, uint64(ret1))) + return int32(X__syscall_ret(tls, uint64(uint64(ret1)))) } switch cmd { case int32(F_SETLK): @@ -25801,7 +25857,7 @@ func Xopen(tls *TLS, filename uintptr, flags int32, va uintptr) (r int32) { if fd >= 0 && flags&int32(O_CLOEXEC) != 0 { X__syscall3(tls, int64(SYS_fcntl), int64(fd), int64(Int32FromInt32(F_SETFD)), int64(Int32FromInt32(FD_CLOEXEC))) } - return int32(X__syscall_ret(tls, uint64(fd))) + return int32(X__syscall_ret(tls, uint64(uint64(fd)))) } func Xopenat(tls *TLS, fd int32, filename uintptr, flags int32, va uintptr) (r int32) { @@ -26039,6 +26095,7 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { x = int32(10)*x + c - int32('0') goto _9 _9: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v12 = f + 8 v11 = *(*uintptr)(unsafe.Pointer(v12)) @@ -26049,14 +26106,15 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { } c = v10 } - y = int64(x) + y = int64(int64(x)) for { if !(uint32(c-int32('0')) < uint32(10) && y < Int64FromInt64(0x7fffffffffffffff)/Int64FromInt32(100)) { break } - y = int64(10)*y + int64(c) - int64('0') + y = int64(10)*y + int64(int64(c)) - int64('0') goto _13 _13: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v16 = f + 8 v15 = *(*uintptr)(unsafe.Pointer(v16)) @@ -26073,6 +26131,7 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { } goto _17 _17: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v20 = f + 8 v19 = *(*uintptr)(unsafe.Pointer(v20)) @@ -26125,6 +26184,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, gotdig = int32(1) goto _1 _1: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v4 = f + 8 v3 = *(*uintptr)(unsafe.Pointer(v4)) @@ -26154,6 +26214,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, lrp-- goto _5 _5: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v11 = f + 8 v10 = *(*uintptr)(unsafe.Pointer(v11)) @@ -26180,10 +26241,10 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, if k < Int32FromInt32(KMAX)-Int32FromInt32(3) { dc++ if c != int32('0') { - lnz = int32(dc) + lnz = int32(int32(dc)) } if j != 0 { - (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k]*uint32(10) + uint32(c) - uint32('0') + (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k]*uint32(10) + uint32(uint32(c)) - uint32('0') } else { (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = uint32(c - int32('0')) } @@ -26204,6 +26265,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _12 _12: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v16 = f + 8 v15 = *(*uintptr)(unsafe.Pointer(v16)) @@ -26245,19 +26307,19 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } /* Handle zero specially to avoid nasty special cases later */ if !((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0] != 0) { - return float64(sign) * float64(0) + return float64(float64(float64(sign)) * float64(0)) } /* Optimize small integers (w/no exponent) and over/under-flow */ if lrp == dc && dc < int64(10) && (bits > int32(30) || (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]>>bits == uint32(0)) { - return float64(sign) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) + return float64(float64(sign)) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) } if lrp > int64(-emin/int32(2)) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) - return float64(sign) * Float64FromFloat64(1.79769313486231570815e+308) * Float64FromFloat64(1.79769313486231570815e+308) + return float64(float64(sign)) * Float64FromFloat64(1.79769313486231570815e+308) * Float64FromFloat64(1.79769313486231570815e+308) } if lrp < int64(emin-Int32FromInt32(2)*Int32FromInt32(LDBL_MANT_DIG)) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) - return float64(sign) * Float64FromFloat64(2.22507385850720138309e-308) * Float64FromFloat64(2.22507385850720138309e-308) + return float64(float64(sign)) * Float64FromFloat64(2.22507385850720138309e-308) * Float64FromFloat64(2.22507385850720138309e-308) } /* Align incomplete final B1B digit */ if j != 0 { @@ -26268,6 +26330,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, *(*Tuint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32(10) goto _19 _19: + ; j++ } k++ @@ -26276,18 +26339,18 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, a = 0 z = k e2 = 0 - rp = int32(lrp) + rp = int32(int32(lrp)) /* Optimize small to mid-size integers (even in exp. notation) */ if lnz < int32(9) && lnz <= rp && rp < int32(18) { if rp == int32(9) { - return float64(sign) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) + return float64(float64(sign)) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) } if rp < int32(9) { - return float64(sign) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) / float64(_p10s[int32(8)-rp]) + return float64(float64(sign)) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) / float64(_p10s[int32(8)-rp]) } bitlim = bits - int32(3)*(rp-Int32FromInt32(9)) if bitlim > int32(30) || (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]>>bitlim == uint32(0) { - return float64(sign) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) * float64(_p10s[rp-int32(10)]) + return float64(float64(sign)) * float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[0]) * float64(_p10s[rp-int32(10)]) } } /* Drop trailing zeros */ @@ -26297,6 +26360,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _20 _20: + ; z-- } /* Align radix point to B1B digit boundary */ @@ -26314,8 +26378,8 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, if !(k != z) { break } - tmp = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] % uint32(p10) - (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k]/uint32(p10) + carry + tmp = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] % uint32(uint32(p10)) + (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k]/uint32(uint32(p10)) + carry carry = uint32(int32(1000000000)/p10) * tmp if k == a && !((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] != 0) { a = (a + int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) @@ -26323,6 +26387,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _22 _22: + ; k++ } if carry != 0 { @@ -26338,13 +26403,13 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, e2 -= int32(29) k = (z - int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) for { - tmp1 = uint64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k])< uint64(1000000000) { carry1 = uint32(tmp1 / uint64(1000000000)) (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = uint32(tmp1 % uint64(1000000000)) } else { carry1 = uint32(0) - (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = uint32(tmp1) + (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] = uint32(uint32(tmp1)) } if k == (z-int32(1))&(Int32FromInt32(KMAX)-Int32FromInt32(1)) && k != a && !((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[k] != 0) { z = k @@ -26354,6 +26419,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _24 _24: + ; k = (k - int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) } if carry1 != 0 { @@ -26385,6 +26451,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _26 _26: + ; i++ } if i == int32(LD_B1B_DIG) && rp == Int32FromInt32(9)*Int32FromInt32(LD_B1B_DIG) { @@ -26410,6 +26477,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _27 _27: + ; k = (k + int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) } if carry2 != 0 { @@ -26439,9 +26507,10 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, y = Float64FromFloat64(1e+09)*y + float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[(a+i)&(Int32FromInt32(KMAX)-Int32FromInt32(1))]) goto _28 _28: + ; i++ } - y *= float64(sign) + y *= float64(float64(sign)) /* Limit precision for denormal results */ if bits > int32(LDBL_MANT_DIG)+e2-emin { bits = int32(LDBL_MANT_DIG) + e2 - emin @@ -26452,8 +26521,8 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } /* Calculate bias term to force rounding, move out lower bits */ if bits < int32(LDBL_MANT_DIG) { - bias = Xcopysignl(tls, Xscalbn(tls, Float64FromInt32(1), Int32FromInt32(2)*Int32FromInt32(LDBL_MANT_DIG)-bits-int32(1)), y) - frac = Xfmodl(tls, y, Xscalbn(tls, Float64FromInt32(1), int32(LDBL_MANT_DIG)-bits)) + bias = Xcopysignl(tls, float64(Xscalbn(tls, Float64FromInt32(1), Int32FromInt32(2)*Int32FromInt32(LDBL_MANT_DIG)-bits-int32(1))), y) + frac = Xfmodl(tls, y, float64(Xscalbn(tls, Float64FromInt32(1), int32(LDBL_MANT_DIG)-bits))) y -= frac y += bias } @@ -26461,16 +26530,16 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, if (a+i)&(Int32FromInt32(KMAX)-Int32FromInt32(1)) != z { t = (*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[(a+i)&(Int32FromInt32(KMAX)-Int32FromInt32(1))] if t < uint32(500000000) && (t != 0 || (a+i+int32(1))&(Int32FromInt32(KMAX)-Int32FromInt32(1)) != z) { - frac += float64(0.25) * float64(sign) + frac += float64(float64(0.25) * float64(float64(sign))) } else { if t > uint32(500000000) { - frac += float64(0.75) * float64(sign) + frac += float64(float64(0.75) * float64(float64(sign))) } else { if t == uint32(500000000) { if (a+i+int32(1))&(Int32FromInt32(KMAX)-Int32FromInt32(1)) == z { - frac += float64(0.5) * float64(sign) + frac += float64(float64(0.5) * float64(float64(sign))) } else { - frac += float64(0.75) * float64(sign) + frac += float64(float64(0.75) * float64(float64(sign))) } } } @@ -26546,6 +26615,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 gotdig = int32(1) goto _4 _4: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v7 = f + 8 v6 = *(*uintptr)(unsafe.Pointer(v7)) @@ -26576,6 +26646,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 gotdig = int32(1) goto _11 _11: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v14 = f + 8 v13 = *(*uintptr)(unsafe.Pointer(v14)) @@ -26606,11 +26677,11 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 d = c - int32('0') } if dc < int64(8) { - x = x*uint32(16) + uint32(d) + x = x*uint32(16) + uint32(uint32(d)) } else { if dc < int64(Int32FromInt32(LDBL_MANT_DIG)/Int32FromInt32(4)+Int32FromInt32(1)) { scale /= Float64FromInt32(16) - y += float64(d) * scale + y += float64(float64(d)) * scale } else { if d != 0 && !(gottail != 0) { y += Float64FromFloat64(0.5) * scale @@ -26622,6 +26693,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 } goto _15 _15: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v18 = f + 8 v17 = *(*uintptr)(unsafe.Pointer(v18)) @@ -26648,7 +26720,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 } else { X__shlim(tls, f, int64(Int32FromInt32(0))) } - return float64(sign) * float64(0) + return float64(float64(float64(sign)) * float64(0)) } if !(gotrad != 0) { rp = dc @@ -26677,15 +26749,15 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 } e2 += int64(4)*rp - int64(32) if !(x != 0) { - return float64(sign) * float64(0) + return float64(float64(float64(sign)) * float64(0)) } if e2 > int64(-emin) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) - return float64(sign) * Float64FromFloat64(1.79769313486231570815e+308) * Float64FromFloat64(1.79769313486231570815e+308) + return float64(float64(sign)) * Float64FromFloat64(1.79769313486231570815e+308) * Float64FromFloat64(1.79769313486231570815e+308) } if e2 < int64(emin-Int32FromInt32(2)*Int32FromInt32(LDBL_MANT_DIG)) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) - return float64(sign) * Float64FromFloat64(2.22507385850720138309e-308) * Float64FromFloat64(2.22507385850720138309e-308) + return float64(float64(sign)) * Float64FromFloat64(2.22507385850720138309e-308) * Float64FromFloat64(2.22507385850720138309e-308) } for x < uint32(0x80000000) { if y >= Float64FromFloat64(0.5) { @@ -26697,25 +26769,25 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 } e2-- } - if int64(bits) > int64(32)+e2-int64(emin) { - bits = int32(int64(32) + e2 - int64(emin)) + if int64(int64(bits)) > int64(32)+e2-int64(int64(emin)) { + bits = int32(int64(32) + e2 - int64(int64(emin))) if bits < 0 { bits = 0 } } if bits < int32(LDBL_MANT_DIG) { - bias = Xcopysignl(tls, Xscalbn(tls, Float64FromInt32(1), Int32FromInt32(32)+Int32FromInt32(LDBL_MANT_DIG)-bits-int32(1)), float64(sign)) + bias = Xcopysignl(tls, float64(Xscalbn(tls, Float64FromInt32(1), Int32FromInt32(32)+Int32FromInt32(LDBL_MANT_DIG)-bits-int32(1))), float64(float64(sign))) } if bits < int32(32) && y != 0 && !(x&Uint32FromInt32(1) != 0) { x++ y = Float64FromInt32(0) } - y = bias + float64(sign)*float64(x) + float64(sign)*y + y = bias + float64(float64(sign))*float64(float64(x)) + float64(float64(sign))*y y -= bias if !(y != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) } - return Xscalbnl(tls, y, int32(e2)) + return Xscalbnl(tls, y, int32(int32(e2))) } func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { @@ -26790,6 +26862,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _11 _11: + ; i++ } if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 { @@ -26807,11 +26880,12 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _16 _16: + ; i-- } } } - return float64(float32(sign) * X__builtin_inff(tls)) + return float64(float32(float32(sign)) * X__builtin_inff(tls)) } if !(i != 0) { i = uint64(0) @@ -26832,6 +26906,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _18 _18: + ; i++ } } @@ -26888,6 +26963,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { return float64(X__builtin_nanf(tls, __ccgo_ts)) goto _26 _26: + ; i++ } return float64(X__builtin_nanf(tls, __ccgo_ts)) @@ -27291,6 +27367,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint x = x*uint32(10) + uint32(c-Int32FromUint8('0')) goto _20 _20: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v23 = f + 8 v22 = *(*uintptr)(unsafe.Pointer(v23)) @@ -27301,7 +27378,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint } c = v21 } - y = uint64(x) + y = uint64(uint64(x)) for { if !(uint32(c-int32('0')) < uint32(10) && y <= (Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1))/Uint64FromInt32(10) && uint64(10)*y <= Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)-uint64(c-Int32FromUint8('0'))) { break @@ -27309,6 +27386,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint y = y*uint64(10) + uint64(c-Int32FromUint8('0')) goto _24 _24: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v27 = f + 8 v26 = *(*uintptr)(unsafe.Pointer(v27)) @@ -27333,6 +27411,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint x = x<>bs) { break @@ -27351,6 +27430,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint y = y<= 0 { (*TFILE)(unsafe.Pointer(f)).Frpos-- } @@ -27438,7 +27522,7 @@ done: } } } - return y ^ uint64(neg) - uint64(neg) + return y ^ uint64(uint64(neg)) - uint64(uint64(neg)) } func X__procfdname(tls *TLS, buf uintptr, fd uint32) { @@ -27457,6 +27541,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { } goto _1 _1: + ; i++ } if !(fd != 0) { @@ -27471,6 +27556,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { } goto _3 _3: + ; j /= uint32(10) i++ } @@ -27484,6 +27570,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { *(*int8)(unsafe.Pointer(buf + uintptr(v5))) = int8(uint32('0') + fd%uint32(10)) goto _4 _4: + ; fd /= uint32(10) } } @@ -27535,7 +27622,7 @@ func X__shgetc(tls *TLS, f uintptr) (r int32) { } (*TFILE)(unsafe.Pointer(f)).Fshcnt = int64((*TFILE)(unsafe.Pointer(f)).Fbuf) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) + cnt if (*TFILE)(unsafe.Pointer(f)).Frpos <= (*TFILE)(unsafe.Pointer(f)).Fbuf { - *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Frpos + uintptr(-Int32FromInt32(1)))) = uint8(c) + *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Frpos + uintptr(-Int32FromInt32(1)))) = uint8(uint8(c)) } return c } @@ -27549,7 +27636,7 @@ func X__syscall_ret(tls *TLS, r uint64) (r1 int64) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(-r) return int64(-int32(1)) } - return int64(r) + return int64(int64(r)) } type TElf_Symndx = uint32 @@ -27621,7 +27708,7 @@ func Xftok(tls *TLS, path uintptr, id int32) (r Tkey_t) { if Xstat(tls, path, bp) < 0 { return -int32(1) } - return int32((*(*Tstat)(unsafe.Pointer(bp))).Fst_ino&Uint64FromInt32(0xffff) | (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev&Uint64FromInt32(0xff)< %v", r) }() + } + bp := tls.Alloc(2112) + defer tls.Free(2112) + var len1 Tsize_t + var _ /* ppw at bp+48 */ uintptr + var _ /* pw at bp+0 */ Tpasswd + var _ /* pwb at bp+56 */ [256]int64 + _ = len1 + if buf != 0 { + *(*int8)(unsafe.Pointer(buf)) = 0 + } + Xgetpwuid_r(tls, Xgeteuid(tls), bp, bp+56, uint64(2048), bp+48) + if !(*(*uintptr)(unsafe.Pointer(bp + 48)) != 0) { + return buf + } + len1 = Xstrnlen(tls, (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_name, uint64(L_cuserid)) + if len1 == uint64(L_cuserid) { + return buf + } + if !(buf != 0) { + buf = uintptr(unsafe.Pointer(&_usridbuf)) + } + Xmemcpy(tls, buf, (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_name, len1+uint64(1)) + return buf +} + +var _usridbuf [20]int8 + +func Xvwarn(tls *TLS, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v fmt=%v ap=%v, (%v:)", tls, fmt, ap, origin(2)) + } + bp := tls.Alloc(16) + defer tls.Free(16) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+350, VaList(bp+8, Xprogram_invocation_short_name)) + if fmt != 0 { + Xvfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), fmt, ap) + Xfputs(tls, __ccgo_ts+355, uintptr(unsafe.Pointer(&X__stderr_FILE))) + } + Xperror(tls, uintptr(0)) +} + +func Xvwarnx(tls *TLS, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v fmt=%v ap=%v, (%v:)", tls, fmt, ap, origin(2)) + } + bp := tls.Alloc(16) + defer tls.Free(16) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+350, VaList(bp+8, Xprogram_invocation_short_name)) + if fmt != 0 { + Xvfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), fmt, ap) + } + Xputc(tls, int32('\n'), uintptr(unsafe.Pointer(&X__stderr_FILE))) +} + +func Xverr(tls *TLS, status int32, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v ap=%v, (%v:)", tls, status, fmt, ap, origin(2)) + } + Xvwarn(tls, fmt, ap) + _exit(tls, status) +} + +func Xverrx(tls *TLS, status int32, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v ap=%v, (%v:)", tls, status, fmt, ap, origin(2)) + } + Xvwarnx(tls, fmt, ap) + _exit(tls, status) +} + +func Xwarn(tls *TLS, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v fmt=%v va=%v, (%v:)", tls, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xvwarn(tls, fmt, ap) + _ = ap +} + +func Xwarnx(tls *TLS, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v fmt=%v va=%v, (%v:)", tls, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xvwarnx(tls, fmt, ap) + _ = ap +} + +func Xerr(tls *TLS, status int32, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v va=%v, (%v:)", tls, status, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xverr(tls, status, fmt, ap) + _ = ap +} + +func Xerrx(tls *TLS, status int32, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v va=%v, (%v:)", tls, status, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xverrx(tls, status, fmt, ap) + _ = ap +} + +func Xeuidaccess(tls *TLS, filename uintptr, amode int32) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v amode=%v, (%v:)", tls, filename, amode, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xfaccessat(tls, -int32(100), filename, amode, int32(AT_EACCESS)) +} + +func Xeaccess(tls *TLS, filename uintptr, amode int32) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v amode=%v, (%v:)", tls, filename, amode, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xeuidaccess(tls, filename, amode) +} + +const FTW_CHDIR = 4 +const FTW_D = 2 +const FTW_DEPTH = 8 +const FTW_DNR = 3 +const FTW_DP = 6 +const FTW_F = 1 +const FTW_MOUNT = 2 +const FTW_NS = 4 +const FTW_PHYS = 1 +const FTW_SL = 5 +const FTW_SLN = 7 + +type TFTW = struct { + Fbase int32 + Flevel int32 +} + +func Xftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32) (r int32) { + if __ccgo_strace { + trc("tls=%v path=%v fn=%v fd_limit=%v, (%v:)", tls, path, fn, fd_limit, origin(2)) + defer func() { trc("-> %v", r) }() + } + /* The following cast assumes that calling a function with one + * argument more than it needs behaves as expected. This is + * actually undefined, but works on all real-world machines. */ + return Xnftw(tls, path, fn, fd_limit, int32(FTW_PHYS)) +} + +const STATX_ALL = 4095 +const STATX_ATIME = 32 +const STATX_BASIC_STATS = 2047 +const STATX_BLOCKS = 1024 +const STATX_BTIME = 2048 +const STATX_CTIME = 128 +const STATX_GID = 16 +const STATX_INO = 256 +const STATX_MODE = 2 +const STATX_MTIME = 64 +const STATX_NLINK = 4 +const STATX_SIZE = 512 +const STATX_TYPE = 1 +const STATX_UID = 8 +const S_IEXEC = 64 +const S_IREAD = 256 +const S_IWRITE = 128 + +type Tstatx_timestamp = struct { + Ftv_sec Tint64_t + Ftv_nsec Tuint32_t + F__pad Tuint32_t +} + +type Tstatx = struct { + Fstx_mask Tuint32_t + Fstx_blksize Tuint32_t + Fstx_attributes Tuint64_t + Fstx_nlink Tuint32_t + Fstx_uid Tuint32_t + Fstx_gid Tuint32_t + Fstx_mode Tuint16_t + F__pad0 [1]Tuint16_t + Fstx_ino Tuint64_t + Fstx_size Tuint64_t + Fstx_blocks Tuint64_t + Fstx_attributes_mask Tuint64_t + Fstx_atime Tstatx_timestamp + Fstx_btime Tstatx_timestamp + Fstx_ctime Tstatx_timestamp + Fstx_mtime Tstatx_timestamp + Fstx_rdev_major Tuint32_t + Fstx_rdev_minor Tuint32_t + Fstx_dev_major Tuint32_t + Fstx_dev_minor Tuint32_t + F__pad1 [14]Tuint64_t +} + +type Ttimezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} + +func Xfutimes(tls *TLS, fd int32, tv uintptr) (r int32) { + if __ccgo_strace { + trc("tls=%v fd=%v tv=%v, (%v:)", tls, fd, tv, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(32) + defer tls.Free(32) + var _ /* times at bp+0 */ [2]Ttimespec + if !(tv != 0) { + return Xfutimens(tls, fd, uintptr(0)) + } + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_usec * int64(1000) + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_usec * int64(1000) + return Xfutimens(tls, fd, bp) +} + +const prlimit64 = 0 + +func Xgetdtablesize(tls *TLS) (r int32) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(16) + defer tls.Free(16) + var v1 uint64 + var _ /* rl at bp+0 */ Trlimit + _ = v1 + Xgetrlimit(tls, int32(RLIMIT_NOFILE), bp) + if (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur < uint64(INT_MAX) { + v1 = (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur + } else { + v1 = uint64(INT_MAX) + } + return int32(v1) +} + +func Xgetloadavg(tls *TLS, a uintptr, n int32) (r int32) { + if __ccgo_strace { + trc("tls=%v a=%v n=%v, (%v:)", tls, a, n, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(368) + defer tls.Free(368) + var i, v1 int32 + var _ /* si at bp+0 */ Tsysinfo + _, _ = i, v1 + if n <= 0 { + if n != 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 + } + Xsysinfo(tls, bp) + if n > int32(3) { + n = int32(3) + } + i = 0 + for { + if !(i < n) { + break + } + *(*float64)(unsafe.Pointer(a + uintptr(i)*8)) = Float64FromFloat64(1) / float64(Int32FromInt32(1)< %v", r) }() + } + return int32(PAGESIZE) +} + +const B0 = 0 +const B1000000 = 4104 +const B110 = 3 +const B115200 = 4098 +const B1152000 = 4105 +const B1200 = 9 +const B134 = 4 +const B150 = 5 +const B1500000 = 4106 +const B1800 = 10 +const B19200 = 14 +const B200 = 6 +const B2000000 = 4107 +const B230400 = 4099 +const B2400 = 11 +const B2500000 = 4108 +const B300 = 7 +const B3000000 = 4109 +const B3500000 = 4110 +const B38400 = 15 +const B4000000 = 4111 +const B460800 = 4100 +const B4800 = 12 +const B50 = 1 +const B500000 = 4101 +const B57600 = 4097 +const B576000 = 4102 +const B600 = 8 +const B75 = 2 +const B921600 = 4103 +const B9600 = 13 +const BRKINT = 2 +const BS0 = 0 +const BS1 = 8192 +const BSDLY = 8192 +const CBAUD = 4111 +const CBAUDEX = 4096 +const CIBAUD = 269418496 +const CLOCAL = 2048 +const CMSPAR = 1073741824 +const CR0 = 0 +const CR1 = 512 +const CR2 = 1024 +const CR3 = 1536 +const CRDLY = 1536 +const CREAD = 128 +const CRTSCTS = 2147483648 +const CS5 = 0 +const CS6 = 16 +const CS7 = 32 +const CS8 = 48 +const CSIZE = 48 +const CSTOPB = 64 +const ECHO = 8 +const ECHOCTL = 512 +const ECHOE = 16 +const ECHOK = 32 +const ECHOKE = 2048 +const ECHONL = 64 +const ECHOPRT = 1024 +const EXTA = 14 +const EXTB = 15 +const EXTPROC = 65536 +const FF0 = 0 +const FF1 = 32768 +const FFDLY = 32768 +const FLUSHO = 4096 +const HUPCL = 1024 +const ICANON = 2 +const ICRNL = 256 +const IEXTEN = 32768 +const IGNBRK = 1 +const IGNCR = 128 +const IGNPAR = 4 +const IMAXBEL = 8192 +const INLCR = 64 +const INPCK = 16 +const ISIG = 1 +const ISTRIP = 32 +const IUCLC = 512 +const IUTF8 = 16384 +const IXANY = 2048 +const IXOFF = 4096 +const IXON = 1024 +const NCCS = 32 +const NL0 = 0 +const NL1 = 256 +const NLDLY = 256 +const NOFLSH = 128 +const OCRNL = 8 +const OFDEL = 128 +const OFILL = 64 +const OLCUC = 2 +const ONLCR = 4 +const ONLRET = 32 +const ONOCR = 16 +const OPOST = 1 +const PARENB = 256 +const PARMRK = 8 +const PARODD = 512 +const PENDIN = 16384 +const TAB0 = 0 +const TAB1 = 2048 +const TAB2 = 4096 +const TAB3 = 6144 +const TABDLY = 6144 +const TCIFLUSH = 0 +const TCIOFF = 2 +const TCIOFLUSH = 2 +const TCION = 3 +const TCOFLUSH = 1 +const TCOOFF = 0 +const TCOON = 1 +const TCSADRAIN = 1 +const TCSAFLUSH = 2 +const TCSANOW = 0 +const TOSTOP = 256 +const VDISCARD = 13 +const VEOF = 4 +const VEOL = 11 +const VEOL2 = 16 +const VERASE = 2 +const VINTR = 0 +const VKILL = 3 +const VLNEXT = 15 +const VMIN = 6 +const VQUIT = 1 +const VREPRINT = 12 +const VSTART = 8 +const VSTOP = 9 +const VSUSP = 10 +const VSWTC = 7 +const VT0 = 0 +const VT1 = 16384 +const VTDLY = 16384 +const VTIME = 5 +const VWERASE = 14 +const XCASE = 4 +const XTABS = 6144 + +type Twinsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} + +type Tcc_t = uint8 + +type Tspeed_t = uint32 + +type Ttcflag_t = uint32 + +type Ttermios = struct { + Fc_iflag Ttcflag_t + Fc_oflag Ttcflag_t + Fc_cflag Ttcflag_t + Fc_lflag Ttcflag_t + Fc_line Tcc_t + Fc_cc [32]Tcc_t + F__c_ispeed Tspeed_t + F__c_ospeed Tspeed_t +} + +func Xgetpass(tls *TLS, prompt uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v prompt=%v, (%v:)", tls, prompt, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(144) + defer tls.Free(144) + var fd, v1 int32 + var l Tssize_t + var v2 uintptr + var _ /* s at bp+0 */ Ttermios + var _ /* t at bp+60 */ Ttermios + _, _, _, _ = fd, l, v1, v2 + v1 = Xopen(tls, __ccgo_ts+358, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) + fd = v1 + if v1 < 0 { + return uintptr(0) + } + Xtcgetattr(tls, fd, bp+60) + *(*Ttermios)(unsafe.Pointer(bp)) = *(*Ttermios)(unsafe.Pointer(bp + 60)) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_lflag &= uint32(^(Int32FromInt32(ECHO) | Int32FromInt32(ISIG))) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_lflag |= uint32(ICANON) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_iflag &= uint32(^(Int32FromInt32(INLCR) | Int32FromInt32(IGNCR))) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_iflag |= uint32(ICRNL) + Xtcsetattr(tls, fd, int32(TCSAFLUSH), bp+60) + Xtcdrain(tls, fd) + Xdprintf(tls, fd, __ccgo_ts+15, VaList(bp+128, prompt)) + l = Xread(tls, fd, uintptr(unsafe.Pointer(&_password)), uint64(128)) + if l >= 0 { + if l > 0 && int32(_password[l-int64(1)]) == int32('\n') || uint64(uint64(l)) == uint64(128) { + l-- + } + _password[l] = 0 + } + Xtcsetattr(tls, fd, int32(TCSAFLUSH), bp) + Xdprintf(tls, fd, __ccgo_ts+367, 0) + Xclose(tls, fd) + if l < 0 { + v2 = uintptr(0) + } else { + v2 = uintptr(unsafe.Pointer(&_password)) + } + return v2 +} + +var _password [128]int8 + +var _defshells = [18]int8{'/', 'b', 'i', 'n', '/', 's', 'h', 10, '/', 'b', 'i', 'n', '/', 'c', 's', 'h', 10} + +var _line uintptr +var _linesize Tsize_t +var _f uintptr + +func Xendusershell(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + if _f != 0 { + Xfclose(tls, _f) + } + _f = uintptr(0) +} + +func Xsetusershell(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + if !(_f != 0) { + _f = Xfopen(tls, __ccgo_ts+369, __ccgo_ts+381) + } + if !(_f != 0) { + _f = Xfmemopen(tls, uintptr(unsafe.Pointer(&_defshells)), Uint64FromInt64(18)-Uint64FromInt32(1), __ccgo_ts+385) + } +} + +func Xgetusershell(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + var l Tssize_t + _ = l + if !(_f != 0) { + Xsetusershell(tls) + } + if !(_f != 0) { + return uintptr(0) + } + l = Xgetline(tls, uintptr(unsafe.Pointer(&_line)), uintptr(unsafe.Pointer(&_linesize)), _f) + if l <= 0 { + return uintptr(0) + } + if int32(*(*int8)(unsafe.Pointer(_line + uintptr(l-int64(1))))) == int32('\n') { + *(*int8)(unsafe.Pointer(_line + uintptr(l-int64(1)))) = 0 + } + return _line +} + +const ANYMARK = 1 +const FLUSHBAND = 4 +const FLUSHR = 1 +const FLUSHRW = 3 +const FLUSHW = 2 +const FMNAMESZ = 8 +const I_ATMARK = 21279 +const I_CANPUT = 21282 +const I_CKBAND = 21277 +const I_FDINSERT = 21264 +const I_FIND = 21259 +const I_FLUSH = 21253 +const I_FLUSHBAND = 21276 +const I_GETBAND = 21278 +const I_GETCLTIME = 21281 +const I_GETSIG = 21258 +const I_GRDOPT = 21255 +const I_GWROPT = 21268 +const I_LINK = 21260 +const I_LIST = 21269 +const I_LOOK = 21252 +const I_NREAD = 21249 +const I_PEEK = 21263 +const I_PLINK = 21270 +const I_POP = 21251 +const I_PUNLINK = 21271 +const I_PUSH = 21250 +const I_RECVFD = 21262 +const I_SENDFD = 21265 +const I_SETCLTIME = 21280 +const I_SETSIG = 21257 +const I_SRDOPT = 21254 +const I_STR = 21256 +const I_SWROPT = 21267 +const I_UNLINK = 21261 +const LASTMARK = 2 +const MORECTL = 1 +const MOREDATA = 2 +const MSG_ANY = 2 +const MSG_BAND = 4 +const MSG_HIPRI = 1 +const MUXID_ALL = -1 +const RMSGD = 1 +const RMSGN = 2 +const RNORM = 0 +const RPROTDAT = 4 +const RPROTDIS = 8 +const RPROTMASK = 28 +const RPROTNORM = 16 +const RS_HIPRI = 1 +const SNDPIPE = 2 +const SNDZERO = 1 +const S_BANDURG = 512 +const S_ERROR = 16 +const S_HANGUP = 32 +const S_HIPRI = 2 +const S_INPUT = 1 +const S_MSG = 8 +const S_OUTPUT = 4 +const S_RDBAND = 128 +const S_RDNORM = 64 +const S_WRBAND = 256 +const S_WRNORM = 4 +const __SID = 21248 + +type Tbandinfo = struct { + Fbi_pri uint8 + Fbi_flag int32 +} + +type Tstrbuf = struct { + Fmaxlen int32 + Flen1 int32 + Fbuf uintptr +} + +type Tstrpeek = struct { + Fctlbuf Tstrbuf + Fdatabuf Tstrbuf + Fflags uint32 +} + +type Tstrfdinsert = struct { + Fctlbuf Tstrbuf + Fdatabuf Tstrbuf + Fflags uint32 + Ffildes int32 + Foffset int32 +} + +type Tstrioctl = struct { + Fic_cmd int32 + Fic_timout int32 + Fic_len int32 + Fic_dp uintptr +} + +type Tstrrecvfd = struct { + Ffd int32 + Fuid int32 + Fgid int32 + F__fill [8]int8 +} + +type Tstr_mlist = struct { + Fl_name [9]int8 +} + +type Tstr_list = struct { + Fsl_nmods int32 + Fsl_modlist uintptr +} + +func Xisastream(tls *TLS, fd int32) (r int32) { + if __ccgo_strace { + trc("tls=%v fd=%v, (%v:)", tls, fd, origin(2)) + defer func() { trc("-> %v", r) }() + } + var v1 int32 + _ = v1 + if Xfcntl(tls, fd, int32(F_GETFD), 0) < 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 +} + +func Xlutimes(tls *TLS, filename uintptr, tv uintptr) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v tv=%v, (%v:)", tls, filename, tv, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(32) + defer tls.Free(32) + var v1 uintptr + var _ /* times at bp+0 */ [2]Ttimespec + _ = v1 + if tv != 0 { + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_usec * int64(1000) + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_usec * int64(1000) + } + if tv != 0 { + v1 = bp + } else { + v1 = uintptr(0) + } + return Xutimensat(tls, -int32(100), filename, v1, int32(AT_SYMLINK_NOFOLLOW)) +} + +const UL_GETFSIZE = 1 +const UL_SETFSIZE = 2 + +func Xulimit(tls *TLS, cmd int32, va uintptr) (r int64) { + if __ccgo_strace { + trc("tls=%v cmd=%v va=%v, (%v:)", tls, cmd, va, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(16) + defer tls.Free(16) + var ap Tva_list + var val int64 + var _ /* rl at bp+0 */ Trlimit + _, _ = ap, val + Xgetrlimit(tls, int32(RLIMIT_FSIZE), bp) + if cmd == int32(UL_SETFSIZE) { + ap = va + val = VaInt64(&ap) + _ = ap + (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur = uint64(512) * uint64(uint64(val)) + if Xsetrlimit(tls, int32(RLIMIT_FSIZE), bp) != 0 { + return int64(-int32(1)) + } + } + return int64((*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur / uint64(512)) +} + +const BOOT_TIME = 2 +const DEAD_PROCESS = 8 +const EMPTY = 0 +const INIT_PROCESS = 5 +const LOGIN_PROCESS = 6 +const NEW_TIME = 3 +const OLD_TIME = 4 +const RUN_LVL = 1 +const USER_PROCESS = 7 +const e_exit = 0 +const e_termination = 0 + +type Tutmpx = struct { + Fut_type int16 + F__ut_pad1 int16 + Fut_pid Tpid_t + Fut_line [32]int8 + Fut_id [4]int8 + Fut_user [32]int8 + Fut_host [256]int8 + Fut_exit struct { + F__e_termination int16 + F__e_exit int16 + } + Fut_session int32 + F__ut_pad2 int32 + Fut_tv Ttimeval + Fut_addr_v6 [4]uint32 + F__unused [20]int8 +} + +func Xendutxent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } +} + +func Xsetutxent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } +} + +func Xgetutxent(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xgetutxid(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xgetutxline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xpututxline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xupdwtmpx(tls *TLS, f uintptr, u uintptr) { + if __ccgo_strace { + trc("tls=%v f=%v u=%v, (%v:)", tls, f, u, origin(2)) + } +} + +func ___utmpxname(tls *TLS, f uintptr) (r int32) { + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOPNOTSUPP) + return -int32(1) +} + +func Xendutent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + Xendutxent(tls) +} + +func Xgetutent(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxent(tls) +} + +func Xgetutid(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxid(tls, ut) +} + +func Xgetutline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxline(tls, ut) +} + +func Xpututline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xpututxline(tls, ut) +} + +func Xsetutent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + Xsetutxent(tls) +} + +func Xupdwtmp(tls *TLS, f uintptr, u uintptr) { + if __ccgo_strace { + trc("tls=%v f=%v u=%v, (%v:)", tls, f, u, origin(2)) + } + Xupdwtmpx(tls, f, u) +} + const ADJ_ESTERROR = 8 const ADJ_FREQUENCY = 2 const ADJ_MAXERROR = 4 @@ -28008,11 +28984,6 @@ const TIME_OK = 0 const TIME_OOP = 3 const TIME_WAIT = 4 -type Ttimezone = struct { - Ftz_minuteswest int32 - Ftz_dsttime int32 -} - type Tntptimeval = struct { Ftime Ttimeval Fmaxerror int64 @@ -28241,7 +29212,7 @@ func Xclock_adjtime(tls *TLS, clock_id Tclockid_t, utx uintptr) (r1 int32) { (*Ttimex)(unsafe.Pointer(utx)).Fstbcnt = (*(*Tktimex)(unsafe.Pointer(bp))).Fstbcnt (*Ttimex)(unsafe.Pointer(utx)).Ftai = (*(*Tktimex)(unsafe.Pointer(bp))).Ftai } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } if clock_id == CLOCK_REALTIME { return int32(X__syscall_ret(tls, uint64(X__syscall1(tls, int64(SYS_adjtimex), int64(utx))))) @@ -28323,7 +29294,7 @@ func Xepoll_create1(tls *TLS, flags int32) (r1 int32) { if r == -int32(ENOSYS) && !(flags != 0) { r = int32(X__syscall1(tls, int64(SYS_epoll_create), int64(Int32FromInt32(1)))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xepoll_ctl(tls *TLS, fd int32, op int32, fd2 int32, ev uintptr) (r int32) { @@ -28345,7 +29316,7 @@ func Xepoll_pwait(tls *TLS, fd int32, ev uintptr, cnt int32, to int32, sigs uint if r == -int32(ENOSYS) && !(sigs != 0) { r = int32(___syscall_cp(tls, int64(SYS_epoll_wait), int64(fd), int64(ev), int64(cnt), int64(to), 0, 0)) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xepoll_wait(tls *TLS, fd int32, ev uintptr, cnt int32, to int32) (r int32) { @@ -28373,7 +29344,7 @@ func Xeventfd(tls *TLS, count uint32, flags int32) (r1 int32) { if r == -int32(ENOSYS) && !(flags != 0) { r = int32(X__syscall1(tls, int64(SYS_eventfd), int64(count))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xeventfd_read(tls *TLS, fd int32, value uintptr) (r int32) { @@ -28660,7 +29631,7 @@ func Xinotify_init1(tls *TLS, flags int32) (r1 int32) { if r == -int32(ENOSYS) && !(flags != 0) { r = int32(X__syscall0(tls, int64(SYS_inotify_init))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xinotify_add_watch(tls *TLS, fd int32, pathname uintptr, mask Tuint32_t) (r int32) { @@ -29009,13 +29980,6 @@ const _IOC_NONE = 0 const _IOC_READ = 2 const _IOC_WRITE = 1 -type Twinsize = struct { - Fws_row uint16 - Fws_col uint16 - Fws_xpixel uint16 - Fws_ypixel uint16 -} - func Xmount(tls *TLS, special uintptr, dir uintptr, fstype uintptr, flags uint64, data uintptr) (r int32) { if __ccgo_strace { trc("tls=%v special=%v dir=%v fstype=%v flags=%v data=%v, (%v:)", tls, special, dir, fstype, flags, data, origin(2)) @@ -29277,6 +30241,7 @@ func Xprctl(tls *TLS, op int32, va uintptr) (r int32) { x[i] = VaUint64(&ap) goto _1 _1: + ; i++ } _ = ap @@ -29304,8 +30269,6 @@ func Xpreadv2(tls *TLS, fd int32, iov uintptr, count int32, ofs Toff_t, flags in return X__syscall_ret(tls, uint64(___syscall_cp(tls, int64(SYS_preadv2), int64(fd), int64(iov), int64(count), ofs, ofs>>Int32FromInt32(32), int64(flags)))) } -const prlimit64 = 0 - func Xprlimit(tls *TLS, pid Tpid_t, resource int32, new_limit uintptr, old_limit uintptr) (r1 int32) { if __ccgo_strace { trc("tls=%v pid=%v resource=%v new_limit=%v old_limit=%v, (%v:)", tls, pid, resource, new_limit, old_limit, origin(2)) @@ -29512,11 +30475,11 @@ func Xptrace(tls *TLS, req int32, va uintptr) (r int64) { data = VaUintptr(&ap) /* PTRACE_{READ,WRITE}{DATA,TEXT} (16...19) are specific to SPARC. */ _ = ap - if uint32(req)-uint32(1) < uint32(3) { + if uint32(uint32(req))-uint32(1) < uint32(3) { data = bp } ret = X__syscall_ret(tls, uint64(X__syscall5(tls, int64(SYS_ptrace), int64(req), int64(pid), int64(addr), int64(data), int64(addr2)))) - if ret < 0 || uint32(req)-uint32(1) >= uint32(3) { + if ret < 0 || uint32(uint32(req))-uint32(1) >= uint32(3) { return ret } return *(*int64)(unsafe.Pointer(bp)) @@ -29791,7 +30754,7 @@ func Xsignalfd(tls *TLS, fd int32, sigs uintptr, flags int32) (r int32) { _ = ret ret = int32(X__syscall4(tls, int64(SYS_signalfd4), int64(fd), int64(sigs), int64(Int32FromInt32(_NSIG)/Int32FromInt32(8)), int64(flags))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } ret = int32(X__syscall3(tls, int64(SYS_signalfd), int64(fd), int64(sigs), int64(Int32FromInt32(_NSIG)/Int32FromInt32(8)))) if ret >= 0 { @@ -29802,7 +30765,7 @@ func Xsignalfd(tls *TLS, fd int32, sigs uintptr, flags int32) (r int32) { X__syscall3(tls, int64(SYS_fcntl), int64(ret), int64(Int32FromInt32(F_SETFL)), int64(Int32FromInt32(O_NONBLOCK))) } } - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } func Xsplice(tls *TLS, fd_in int32, off_in uintptr, fd_out int32, off_out uintptr, len1 Tsize_t, flags uint32) (r Tssize_t) { @@ -29813,54 +30776,6 @@ func Xsplice(tls *TLS, fd_in int32, off_in uintptr, fd_out int32, off_out uintpt return X__syscall_ret(tls, uint64(X__syscall6(tls, int64(SYS_splice), int64(fd_in), int64(off_in), int64(fd_out), int64(off_out), int64(len1), int64(flags)))) } -const STATX_ALL = 4095 -const STATX_ATIME = 32 -const STATX_BASIC_STATS = 2047 -const STATX_BLOCKS = 1024 -const STATX_BTIME = 2048 -const STATX_CTIME = 128 -const STATX_GID = 16 -const STATX_INO = 256 -const STATX_MODE = 2 -const STATX_MTIME = 64 -const STATX_NLINK = 4 -const STATX_SIZE = 512 -const STATX_TYPE = 1 -const STATX_UID = 8 -const S_IEXEC = 64 -const S_IREAD = 256 -const S_IWRITE = 128 - -type Tstatx_timestamp = struct { - Ftv_sec Tint64_t - Ftv_nsec Tuint32_t - F__pad Tuint32_t -} - -type Tstatx = struct { - Fstx_mask Tuint32_t - Fstx_blksize Tuint32_t - Fstx_attributes Tuint64_t - Fstx_nlink Tuint32_t - Fstx_uid Tuint32_t - Fstx_gid Tuint32_t - Fstx_mode Tuint16_t - F__pad0 [1]Tuint16_t - Fstx_ino Tuint64_t - Fstx_size Tuint64_t - Fstx_blocks Tuint64_t - Fstx_attributes_mask Tuint64_t - Fstx_atime Tstatx_timestamp - Fstx_btime Tstatx_timestamp - Fstx_ctime Tstatx_timestamp - Fstx_mtime Tstatx_timestamp - Fstx_rdev_major Tuint32_t - Fstx_rdev_minor Tuint32_t - Fstx_dev_major Tuint32_t - Fstx_dev_minor Tuint32_t - F__pad1 [14]Tuint64_t -} - func Xstatx(tls *TLS, dirfd int32, path uintptr, flags int32, mask uint32, stx uintptr) (r int32) { if __ccgo_strace { trc("tls=%v dirfd=%v path=%v flags=%v mask=%v stx=%v, (%v:)", tls, dirfd, path, flags, mask, stx, origin(2)) @@ -29873,7 +30788,7 @@ func Xstatx(tls *TLS, dirfd int32, path uintptr, flags int32, mask uint32, stx u _ = ret ret = int32(X__syscall5(tls, int64(SYS_statx), int64(dirfd), int64(path), int64(flags), int64(mask), int64(stx))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } ret = Xfstatat(tls, dirfd, path, bp, flags) if ret != 0 { @@ -30182,7 +31097,7 @@ func Xwait4(tls *TLS, pid Tpid_t, status uintptr, options int32, ru uintptr) (r1 Ftv_usec: (*(*[4]int64)(unsafe.Pointer(bp)))[int32(3)], } } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } const XATTR_CREATE = 1 @@ -30311,7 +31226,7 @@ func X__lctrans_cur(tls *TLS, msg uintptr) (r uintptr) { trc("tls=%v msg=%v, (%v:)", tls, msg, origin(2)) defer func() { trc("-> %v", r) }() } - return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale + 5*8))) + return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale + 5*8))) } func _swapc(tls *TLS, x Tuint32_t, c int32) (r Tuint32_t) { @@ -30340,7 +31255,7 @@ func X__mo_lookup(tls *TLS, p uintptr, size Tsize_t, s uintptr) (r uintptr) { n = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + 2*4)), sw) o = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + 3*4)), sw) t = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + 4*4)), sw) - if uint64(n) >= size/uint64(4) || uint64(o) >= size-uint64(uint32(4)*n) || uint64(t) >= size-uint64(uint32(4)*n) || (o|t)%uint32(4) != 0 { + if uint64(uint64(n)) >= size/uint64(4) || uint64(uint64(o)) >= size-uint64(uint32(4)*n) || uint64(uint64(t)) >= size-uint64(uint32(4)*n) || (o|t)%uint32(4) != 0 { return uintptr(0) } o /= uint32(4) @@ -30348,14 +31263,14 @@ func X__mo_lookup(tls *TLS, p uintptr, size Tsize_t, s uintptr) (r uintptr) { for { ol = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + uintptr(o+uint32(2)*(b+n/uint32(2)))*4)), sw) os = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + uintptr(o+uint32(2)*(b+n/uint32(2))+uint32(1))*4)), sw) - if uint64(os) >= size || uint64(ol) >= size-uint64(os) || *(*int8)(unsafe.Pointer(p + uintptr(os+ol))) != 0 { + if uint64(uint64(os)) >= size || uint64(uint64(ol)) >= size-uint64(uint64(os)) || *(*int8)(unsafe.Pointer(p + uintptr(os+ol))) != 0 { return uintptr(0) } sign = Xstrcmp(tls, s, p+uintptr(os)) if !(sign != 0) { tl = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + uintptr(t+uint32(2)*(b+n/uint32(2)))*4)), sw) ts = _swapc(tls, *(*Tuint32_t)(unsafe.Pointer(mo + uintptr(t+uint32(2)*(b+n/uint32(2))+uint32(1))*4)), sw) - if uint64(ts) >= size || uint64(tl) >= size-uint64(ts) || *(*int8)(unsafe.Pointer(p + uintptr(ts+tl))) != 0 { + if uint64(uint64(ts)) >= size || uint64(uint64(tl)) >= size-uint64(uint64(ts)) || *(*int8)(unsafe.Pointer(p + uintptr(ts+tl))) != 0 { return uintptr(0) } return p + uintptr(ts) @@ -30384,7 +31299,7 @@ func Xbind_textdomain_codeset(tls *TLS, domainname uintptr, codeset uintptr) (r trc("tls=%v domainname=%v codeset=%v, (%v:)", tls, domainname, codeset, origin(2)) defer func() { trc("-> %v", r) }() } - if codeset != 0 && Xstrcasecmp(tls, codeset, __ccgo_ts+350) != 0 { + if codeset != 0 && Xstrcasecmp(tls, codeset, __ccgo_ts+388) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) } return UintptrFromInt32(0) @@ -30477,17 +31392,17 @@ _6: goto _9 _9: strings = map1 + uintptr(20) + uintptr(v8) - v10 = uint32(set_id) + v10 = uint32(uint32(set_id)) v11 = v10>>int32(24) | v10>>int32(8)&uint32(0xff00) | v10<>int32(24) | v13>>int32(8)&uint32(0xff00) | v13<= uint32(LC_ALL) { + if uint32(uint32(category)) >= uint32(LC_ALL) { goto notrans } if !(domainname != 0) { @@ -30912,6 +31832,7 @@ func Xdcngettext(tls *TLS, domainname uintptr, msgid1 uintptr, msgid2 uintptr, n } goto _1 _1: + ; q = (*Tbinding)(unsafe.Pointer(q)).Fnext } if !(q != 0) { @@ -30922,6 +31843,7 @@ func Xdcngettext(tls *TLS, domainname uintptr, msgid1 uintptr, msgid2 uintptr, n goto _2 } notrans: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = old_errno if n == uint64(1) { v3 = msgid1 @@ -30930,6 +31852,7 @@ notrans: } return v3 _2: + ; p = AtomicLoadPUintptr(uintptr(unsafe.Pointer(&_cats))) for { if !(p != 0) { @@ -30940,6 +31863,7 @@ _2: } goto _4 _4: + ; p = (*Tmsgcat)(unsafe.Pointer(p)).Fnext } if !(p != 0) { @@ -30954,19 +31878,19 @@ _2: if !(modname != 0) { modname = locname + uintptr(loclen) } - v5 = loclen - uint64(int64(modname)-int64(locname)) + v5 = loclen - uint64(int64(int64(modname))-int64(int64(locname))) modlen = v5 alt_modlen = v5 - loclen = uint64(int64(modname) - int64(locname)) + loclen = uint64(int64(int64(modname)) - int64(int64(locname))) /* Drop .charset identifier; it is not used. */ csp = Xmemchr(tls, locname, int32('.'), loclen) if csp != 0 { - loclen = uint64(int64(csp) - int64(locname)) + loclen = uint64(int64(int64(csp)) - int64(int64(locname))) } v6 = dirlen + uint64(1) + loclen + modlen + uint64(1) + catlen + uint64(1) + domlen + uint64(3) + uint64(1) name = Xrealloc(tls, name, v6) for { - Xsnprintf(tls, name, v6, __ccgo_ts+402, VaList(bp+24, dirname, int32(loclen), locname, int32(alt_modlen), modname, catname, domainname)) + Xsnprintf(tls, name, v6, __ccgo_ts+440, VaList(bp+24, dirname, int32(int32(loclen)), locname, int32(int32(alt_modlen)), modname, catname, domainname)) v8 = X__map_file(tls, name, bp) map1 = v8 if v8 != 0 { @@ -30979,7 +31903,7 @@ _2: v9 = Xmemchr(tls, locname, int32('_'), loclen) locp = v9 if v9 != 0 { - loclen = uint64(int64(locp) - int64(locname)) + loclen = uint64(int64(int64(locp)) - int64(int64(locname))) alt_modlen = modlen } else { break @@ -31001,10 +31925,10 @@ _2: (*Tmsgcat)(unsafe.Pointer(p)).Flm = lm (*Tmsgcat)(unsafe.Pointer(p)).Fmap1 = map1 (*Tmsgcat)(unsafe.Pointer(p)).Fmap_size = *(*Tsize_t)(unsafe.Pointer(bp)) - rule = __ccgo_ts + 424 + rule = __ccgo_ts + 462 np = uint64(2) r = X__mo_lookup(tls, (*Tmsgcat)(unsafe.Pointer(p)).Fmap1, (*Tmsgcat)(unsafe.Pointer(p)).Fmap_size, __ccgo_ts) - for r != 0 && Xstrncmp(tls, r, __ccgo_ts+430, uint64(13)) != 0 { + for r != 0 && Xstrncmp(tls, r, __ccgo_ts+468, uint64(13)) != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = Xstrchr(tls, r, int32('\n')) if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { v10 = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(1) @@ -31025,7 +31949,7 @@ _2: } r++ } - if !(Xstrncmp(tls, r, __ccgo_ts+444, uint64(9)) != 0) { + if !(Xstrncmp(tls, r, __ccgo_ts+482, uint64(9)) != 0) { np = Xstrtoul(tls, r+uintptr(9), bp+8, int32(10)) r = *(*uintptr)(unsafe.Pointer(bp + 8)) } @@ -31044,27 +31968,29 @@ _2: } r++ } - if !(Xstrncmp(tls, r, __ccgo_ts+454, uint64(7)) != 0) { + if !(Xstrncmp(tls, r, __ccgo_ts+492, uint64(7)) != 0) { rule = r + uintptr(7) } } } - (*Tmsgcat)(unsafe.Pointer(p)).Fnplurals = int32(np) + (*Tmsgcat)(unsafe.Pointer(p)).Fnplurals = int32(int32(np)) (*Tmsgcat)(unsafe.Pointer(p)).Fplural_rule = rule for { old_cats = AtomicLoadPUintptr(uintptr(unsafe.Pointer(&_cats))) (*Tmsgcat)(unsafe.Pointer(p)).Fnext = old_cats goto _20 _20: + ; v17 = old_cats // __asm__( "lock ; cmpxchg %3, %1" // // : "=a"(t), "=m"(*(void *volatile *)p) // : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 13, __ccgo_ts+462) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 13, __ccgo_ts+500) v18 = v17 goto _19 _19: + ; if !(v18 != old_cats) { break } @@ -31087,7 +32013,7 @@ _2: if !(v21 != 0) { break } - rem = (*Tmsgcat)(unsafe.Pointer(p)).Fmap_size - uint64(int64(trans)-int64((*Tmsgcat)(unsafe.Pointer(p)).Fmap1)) + rem = (*Tmsgcat)(unsafe.Pointer(p)).Fmap_size - uint64(int64(int64(trans))-int64((*Tmsgcat)(unsafe.Pointer(p)).Fmap1)) l = Xstrnlen(tls, trans, rem) if l+uint64(1) >= rem { goto notrans @@ -97324,6 +98250,7 @@ func _fuzzycmp(tls *TLS, a uintptr, b uintptr) (r int32) { } goto _1 _1: + ; a++ b++ } @@ -97348,6 +98275,7 @@ func _find_charmap(tls *TLS, name uintptr) (r Tsize_t) { } goto _2 _2: + ; s += uintptr(Xstrlen(tls, s) + uint64(1)) } return uint64(int64(s+uintptr(1)) - t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_charmaps)))) @@ -97376,11 +98304,11 @@ func _combine_to_from(tls *TLS, t Tsize_t, f Tsize_t) (r Ticonv_t) { } func _extract_from(tls *TLS, cd Ticonv_t) (r Tsize_t) { - return uint64(cd) >> int32(16) + return uint64(uint64(cd)) >> int32(16) } func _extract_to(tls *TLS, cd Ticonv_t) (r Tsize_t) { - return uint64(cd) >> int32(1) & uint64(0x7fff) + return uint64(uint64(cd)) >> int32(1) & uint64(0x7fff) } func Xiconv_open(tls *TLS, to uintptr, from uintptr) (r Ticonv_t) { @@ -97431,7 +98359,7 @@ func _get_16(tls *TLS, s uintptr, e int32) (r uint32) { func _put_16(tls *TLS, s uintptr, c uint32, e int32) { e &= int32(1) *(*uint8)(unsafe.Pointer(s + uintptr(e))) = uint8(c >> int32(8)) - *(*uint8)(unsafe.Pointer(s + uintptr(int32(1)-e))) = uint8(c) + *(*uint8)(unsafe.Pointer(s + uintptr(int32(1)-e))) = uint8(uint8(c)) } func _get_32(tls *TLS, s uintptr, e int32) (r uint32) { @@ -97444,7 +98372,7 @@ func _put_32(tls *TLS, s uintptr, c uint32, e int32) { *(*uint8)(unsafe.Pointer(s + uintptr(e^0))) = uint8(c >> int32(24)) *(*uint8)(unsafe.Pointer(s + uintptr(e^int32(1)))) = uint8(c >> int32(16)) *(*uint8)(unsafe.Pointer(s + uintptr(e^int32(2)))) = uint8(c >> int32(8)) - *(*uint8)(unsafe.Pointer(s + uintptr(e^int32(3)))) = uint8(c) + *(*uint8)(unsafe.Pointer(s + uintptr(e^int32(3)))) = uint8(uint8(c)) } /* Adapt as needed */ @@ -97518,7 +98446,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, d, err, from, i, i1, j, j1, k, l, loc, map1, ploc, scd, tmplen, tmpx, to, tomap, totype, type1, x, v100, v101, v102, v103, v104, v25, v26, v27, v28, v54, v55, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v80, v81, v82, v83, v84, v85, v86, v87, v88, v89, v90, v91, v92, v93, v94, v95, v96, v97, v98, v99 x = uint64(0) scd = uintptr(0) - if !(uint64(cd)&Uint64FromInt32(1) != 0) { + if !(uint64(uint64(cd))&Uint64FromInt32(1) != 0) { scd = cd cd = (*Tstateful_cd)(unsafe.Pointer(scd)).Fbase_cd } @@ -97529,7 +98457,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tmbstate_t)(unsafe.Pointer(bp + 24)) = Tmbstate_t{} type1 = *(*uint8)(unsafe.Pointer(map1 + uintptr(-Int32FromInt32(1)))) totype = *(*uint8)(unsafe.Pointer(tomap + uintptr(-Int32FromInt32(1)))) - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if !(in != 0) || !(*(*uintptr)(unsafe.Pointer(in)) != 0) || !(*(*Tsize_t)(unsafe.Pointer(inb)) != 0) { return uint64(0) @@ -97541,7 +98469,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } c = uint32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(in))))) l = uint64(1) - switch int32(type1) { + switch int32(int32(type1)) { case int32(UTF_8): goto _2 case int32(US_ASCII): @@ -97587,6 +98515,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _2: + ; if c < uint32(128) { goto _23 } @@ -97600,11 +98529,13 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui c = uint32(*(*Twchar_t)(unsafe.Pointer(bp + 32))) goto _23 _3: + ; if c >= uint32(128) { goto ilseq } goto _23 _4: + ; l = uint64(4) if *(*Tsize_t)(unsafe.Pointer(inb)) < l { goto starved @@ -97614,38 +98545,45 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto _24 } _6: + ; _5: + ; l = uint64(4) if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(4) { goto starved } - c = _get_32(tls, *(*uintptr)(unsafe.Pointer(in)), int32(type1)) + c = _get_32(tls, *(*uintptr)(unsafe.Pointer(in)), int32(int32(type1))) _24: + ; if c-uint32(0xd800) < uint32(0x800) || c >= uint32(0x110000) { goto ilseq } goto _23 _10: + ; _9: + ; _8: + ; _7: + ; l = uint64(2) if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(2) { goto starved } - c = _get_16(tls, *(*uintptr)(unsafe.Pointer(in)), int32(type1)) + c = _get_16(tls, *(*uintptr)(unsafe.Pointer(in)), int32(int32(type1))) if c-Uint32FromInt32(0xdc00) < uint32(0x400) { goto ilseq } if c-Uint32FromInt32(0xd800) < uint32(0x400) { - if uint32(int32(type1)-int32(UCS2BE)) < uint32(2) { + if uint32(int32(int32(type1))-int32(UCS2BE)) < uint32(2) { goto ilseq } l = uint64(4) if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(4) { goto starved } - d = _get_16(tls, *(*uintptr)(unsafe.Pointer(in))+UintptrFromInt32(2), int32(type1)) + d = _get_16(tls, *(*uintptr)(unsafe.Pointer(in))+UintptrFromInt32(2), int32(int32(type1))) if d-Uint32FromInt32(0xdc00) >= uint32(0x400) { goto ilseq } @@ -97653,14 +98591,16 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _12: + ; _11: + ; l = uint64(0) if !((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate != 0) { if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(2) { goto starved } c = _get_16(tls, *(*uintptr)(unsafe.Pointer(in)), 0) - if int32(type1) == int32(UCS2) { + if int32(int32(type1)) == int32(UCS2) { if c == uint32(0xfffe) { v26 = int32(UCS2LE) } else { @@ -97683,6 +98623,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui type1 = uint8((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate) goto _1 _13: + ; l = uint64(0) if !((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate != 0) { if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(4) { @@ -97702,6 +98643,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui type1 = uint8((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate) goto _1 _14: + ; if c < uint32(128) { goto _23 } @@ -97747,6 +98689,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _15: + ; if c < uint32(128) { goto _23 } @@ -97774,6 +98717,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _16: + ; if c >= uint32(128) { goto ilseq } @@ -97842,6 +98786,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _17: + ; if c < uint32(128) { goto _23 } @@ -97849,11 +98794,13 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto ilseq } _18: + ; if c == uint32(128) { c = uint32(0x20ac) goto _23 } _19: + ; if c < uint32(128) { goto _23 } @@ -97866,11 +98813,11 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto starved } d = uint32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(in)) + UintptrFromInt32(1)))) - if d < uint32(0xa1) && int32(type1) == int32(GB2312) { + if d < uint32(0xa1) && int32(int32(type1)) == int32(GB2312) { goto ilseq } if d-uint32(0x40) >= uint32(191) || d == uint32(127) { - if d-uint32('0') > uint32(9) || int32(type1) != int32(GB18030) { + if d-uint32('0') > uint32(9) || int32(int32(type1)) != int32(GB18030) { goto ilseq } l = uint64(4) @@ -97910,10 +98857,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _31 _31: + ; j++ } goto _30 _30: + ; i++ } d = c + uint32(1) @@ -97930,6 +98879,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui c = uint32(*(*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(&_gb18030)) + uintptr(c)*380 + uintptr(d)*2))) goto _23 _20: + ; if c < uint32(128) { goto _23 } @@ -97961,10 +98911,10 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui * here. Ugly, yes. */ if c/uint32(256) == uint32(0xdc) { *(*uintptr)(unsafe.Pointer(bp + 48)) = bp + 40 - *(*uintptr)(unsafe.Pointer(bp)) = __ccgo_ts + 473 + uintptr(c%uint32(256)) + *(*uintptr)(unsafe.Pointer(bp)) = __ccgo_ts + 511 + uintptr(c%uint32(256)) *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(4) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(8) - tmpx = Xiconv(tls, _combine_to_from(tls, uint64(to), _find_charmap(tls, __ccgo_ts+490)), bp, bp+8, bp+48, bp+16) + tmpx = Xiconv(tls, _combine_to_from(tls, uint64(uint64(to)), _find_charmap(tls, __ccgo_ts+528)), bp, bp+8, bp+48, bp+16) tmplen = uint64(int64(*(*uintptr)(unsafe.Pointer(bp + 48))) - t__predefined_ptrdiff_t(bp+40)) if tmplen > *(*Tsize_t)(unsafe.Pointer(outb)) { goto toobig @@ -97989,6 +98939,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _21: + ; if c < uint32(128) { goto _23 } @@ -98045,10 +98996,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _34 _34: + ; j1++ } goto _33 _33: + ; i1++ } d = c + uint32(1) @@ -98064,6 +99017,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _22: + ; if !(c != 0) { goto _23 } @@ -98072,7 +99026,8 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto ilseq } _23: - switch int32(totype) { + ; + switch int32(int32(totype)) { case int32(WCHAR_T): goto _35 case int32(UTF_8): @@ -98108,35 +99063,41 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _51 _35: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { goto toobig } - *(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(out)))) = int32(c) + *(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(out)))) = int32(int32(c)) *(*uintptr)(unsafe.Pointer(out)) += uintptr(4) *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _36: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { - k = uint64(Xwctomb(tls, bp+56, int32(c))) + k = uint64(Xwctomb(tls, bp+56, int32(int32(c)))) if *(*Tsize_t)(unsafe.Pointer(outb)) < k { goto toobig } Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(out)), bp+56, k) } else { - k = uint64(Xwctomb(tls, *(*uintptr)(unsafe.Pointer(out)), int32(c))) + k = uint64(Xwctomb(tls, *(*uintptr)(unsafe.Pointer(out)), int32(int32(c)))) } *(*uintptr)(unsafe.Pointer(out)) += uintptr(k) *(*Tsize_t)(unsafe.Pointer(outb)) -= k goto _51 _37: + ; if !(c > uint32(0x7f)) { goto _52 } subst: + ; x++ c = Uint32FromUint8('*') _52: + ; _38: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(1) { goto toobig } @@ -98144,18 +99105,20 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto _53 } revout: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(1) { goto toobig } v55 = out v54 = *(*uintptr)(unsafe.Pointer(v55)) *(*uintptr)(unsafe.Pointer(v55))++ - *(*int8)(unsafe.Pointer(v54)) = int8(c) + *(*int8)(unsafe.Pointer(v54)) = int8(int8(c)) *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(1) goto _51 _53: + ; d = c - c = uint32(int32(4) * int32(totype)) + c = uint32(int32(4) * int32(int32(totype))) for { if !(c < uint32(256)) { break @@ -98165,10 +99128,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _56 _56: + ; c++ } goto subst _39: + ; if c < uint32(128) { goto revout } @@ -98216,6 +99181,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(2) goto _51 _40: + ; if c < uint32(128) { goto revout } @@ -98241,6 +99207,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(2) goto _51 _41: + ; if c < uint32(128) { goto revout } @@ -98343,20 +99310,26 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(8) goto _51 _42: + ; totype = uint8(UCS2BE) _47: + ; _46: + ; _45: + ; _44: + ; _43: - if c < uint32(0x10000) || uint32(int32(totype)-int32(UCS2BE)) < uint32(2) { + ; + if c < uint32(0x10000) || uint32(int32(int32(totype))-int32(UCS2BE)) < uint32(2) { if c >= uint32(0x10000) { c = uint32(0xFFFD) } if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(2) { goto toobig } - _put_16(tls, *(*uintptr)(unsafe.Pointer(out)), c, int32(totype)) + _put_16(tls, *(*uintptr)(unsafe.Pointer(out)), c, int32(int32(totype))) *(*uintptr)(unsafe.Pointer(out)) += uintptr(2) *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(2) goto _51 @@ -98365,42 +99338,51 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto toobig } c -= uint32(0x10000) - _put_16(tls, *(*uintptr)(unsafe.Pointer(out)), c>>int32(10)|uint32(0xd800), int32(totype)) - _put_16(tls, *(*uintptr)(unsafe.Pointer(out))+UintptrFromInt32(2), c&uint32(0x3ff)|uint32(0xdc00), int32(totype)) + _put_16(tls, *(*uintptr)(unsafe.Pointer(out)), c>>int32(10)|uint32(0xd800), int32(int32(totype))) + _put_16(tls, *(*uintptr)(unsafe.Pointer(out))+UintptrFromInt32(2), c&uint32(0x3ff)|uint32(0xdc00), int32(int32(totype))) *(*uintptr)(unsafe.Pointer(out)) += uintptr(4) *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _48: + ; totype = uint8(UTF_32BE) _50: + ; _49: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { goto toobig } - _put_32(tls, *(*uintptr)(unsafe.Pointer(out)), c, int32(totype)) + _put_32(tls, *(*uintptr)(unsafe.Pointer(out)), c, int32(int32(totype))) *(*uintptr)(unsafe.Pointer(out)) += uintptr(4) *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _51: + ; goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(in)) += uintptr(l) *(*Tsize_t)(unsafe.Pointer(inb)) -= l } *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc return x ilseq: + ; err = int32(EILSEQ) x = uint64(-Int32FromInt32(1)) goto end toobig: + ; err = int32(E2BIG) x = uint64(-Int32FromInt32(1)) goto end starved: + ; err = int32(EINVAL) x = uint64(-Int32FromInt32(1)) end: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = err *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc return x @@ -98411,7 +99393,7 @@ func Xiconv_close(tls *TLS, cd Ticonv_t) (r int32) { trc("tls=%v cd=%v, (%v:)", tls, cd, origin(2)) defer func() { trc("-> %v", r) }() } - if !(uint64(cd)&Uint64FromInt32(1) != 0) { + if !(uint64(uint64(cd))&Uint64FromInt32(1) != 0) { Xfree(tls, cd) } return 0 @@ -98434,9 +99416,9 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { idx = item & int32(65535) if item == int32(CODESET) { if *(*uintptr)(unsafe.Pointer(loc)) != 0 { - v1 = __ccgo_ts + 350 + v1 = __ccgo_ts + 388 } else { - v1 = __ccgo_ts + 495 + v1 = __ccgo_ts + 533 } return v1 } @@ -98445,7 +99427,7 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { if *(*uintptr)(unsafe.Pointer(loc + uintptr(cat)*8)) != 0 { v2 = *(*uintptr)(unsafe.Pointer(loc + uintptr(cat)*8)) + 16 } else { - v2 = __ccgo_ts + 501 + v2 = __ccgo_ts + 539 } return v2 } @@ -98483,10 +99465,12 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { } goto _4 _4: + ; str++ } goto _3 _3: + ; idx-- str++ } @@ -98501,7 +99485,7 @@ func X__nl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { trc("tls=%v item=%v, (%v:)", tls, item, origin(2)) defer func() { trc("-> %v", r) }() } - return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xnl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { @@ -98565,18 +99549,18 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { new1 = uintptr(0) path = uintptr(0) if !(*(*int8)(unsafe.Pointer(val)) != 0) { - v1 = Xgetenv(tls, __ccgo_ts+503) + v1 = Xgetenv(tls, __ccgo_ts+541) val = v1 if v3 = v1 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v3 { v2 = Xgetenv(tls, uintptr(unsafe.Pointer(&_envvars))+uintptr(cat)*12) val = v2 } if v5 = v3 || v2 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v5 { - v4 = Xgetenv(tls, __ccgo_ts+364) + v4 = Xgetenv(tls, __ccgo_ts+402) val = v4 } if v7 = v5 || v4 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v7 { - v6 = __ccgo_ts + 510 + v6 = __ccgo_ts + 548 val = v6 } _ = v7 || v6 != 0 @@ -98589,12 +99573,13 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _8 _8: + ; n++ } if int32(*(*int8)(unsafe.Pointer(val))) == int32('.') || *(*int8)(unsafe.Pointer(val + uintptr(n))) != 0 { - val = __ccgo_ts + 510 + val = __ccgo_ts + 548 } - builtin = BoolInt32(int32(*(*int8)(unsafe.Pointer(val))) == int32('C') && !(*(*int8)(unsafe.Pointer(val + 1)) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+510) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+518) != 0)) + builtin = BoolInt32(int32(*(*int8)(unsafe.Pointer(val))) == int32('C') && !(*(*int8)(unsafe.Pointer(val + 1)) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+548) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+556) != 0)) if builtin != 0 { if cat == LC_CTYPE && int32(*(*int8)(unsafe.Pointer(val + 1))) == int32('.') { return uintptr(unsafe.Pointer(&X__c_dot_utf8)) @@ -98611,10 +99596,11 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _9 _9: + ; p = (*t__locale_map)(unsafe.Pointer(p)).Fnext } if !(X__libc.Fsecure != 0) { - path = Xgetenv(tls, __ccgo_ts+524) + path = Xgetenv(tls, __ccgo_ts+562) } /* FIXME: add a default path? */ if path != 0 { @@ -98623,7 +99609,7 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { break } z = X__strchrnul(tls, path, int32(':')) - l = uint64(int64(z) - int64(path)) + l = uint64(int64(int64(z)) - int64(int64(path))) if l >= uint64(256)-n-uint64(2) { goto _10 } @@ -98648,6 +99634,7 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _10 _10: + ; path = z + BoolUintptr(!!(*(*int8)(unsafe.Pointer(z)) != 0)) } } @@ -98687,7 +99674,7 @@ var _loc_head uintptr * from SUS and have nothing to do with the host system. */ var _posix_lconv = Tlconv{ - Fdecimal_point: __ccgo_ts + 537, + Fdecimal_point: __ccgo_ts + 575, Fthousands_sep: __ccgo_ts, Fgrouping: __ccgo_ts, Fint_curr_symbol: __ccgo_ts, @@ -98762,6 +99749,7 @@ func _do_newlocale(tls *TLS, mask int32, name uintptr, loc Tlocale_t) (r Tlocale } goto _1 _1: + ; i++ } /* For locales with allocated storage, modify in-place. */ @@ -98789,6 +99777,7 @@ func _do_newlocale(tls *TLS, mask int32, name uintptr, loc Tlocale_t) (r Tlocale *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_locale)) + uintptr(i1)*8)) = X__get_locale(tls, i1, __ccgo_ts) goto _4 _4: + ; i1++ } *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_ctype_locale)))) = *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_locale)))) @@ -98986,6 +99975,7 @@ func _parseop(tls *TLS, st uintptr, s uintptr) (r uintptr) { } goto _1 _1: + ; i++ } (*Tst)(unsafe.Pointer(st)).Fop = int32(13) @@ -99104,7 +100094,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { var _ /* part at bp+48 */ [24]int8 var _ /* tmp_locale at bp+0 */ t__locale_struct _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, l, lm, lm1, p, part1, ret, s, same, z, v3, v4, v5, v6 - if uint32(cat) > uint32(LC_ALL) { + if uint32(uint32(cat)) > uint32(LC_ALL) { return uintptr(0) } ___lock(tls, uintptr(unsafe.Pointer(&X__locale_lock))) @@ -99123,9 +100113,9 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { break } z = X__strchrnul(tls, p, int32(';')) - if int64(z)-int64(p) <= int64(LOCALE_NAME_MAX) { - Xmemcpy(tls, bp+48, p, uint64(int64(z)-int64(p))) - (*(*[24]int8)(unsafe.Pointer(bp + 48)))[int64(z)-int64(p)] = 0 + if int64(int64(z))-int64(int64(p)) <= int64(LOCALE_NAME_MAX) { + Xmemcpy(tls, bp+48, p, uint64(int64(int64(z))-int64(int64(p)))) + (*(*[24]int8)(unsafe.Pointer(bp + 48)))[int64(int64(z))-int64(int64(p))] = 0 if *(*int8)(unsafe.Pointer(z)) != 0 { p = z + uintptr(1) } @@ -99138,6 +100128,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { *(*uintptr)(unsafe.Pointer(bp + uintptr(i)*8)) = lm goto _1 _1: + ; i++ } X__libc.Fglobal_locale = *(*t__locale_struct)(unsafe.Pointer(bp)) @@ -99156,7 +100147,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { if lm1 != 0 { v3 = lm1 + 16 } else { - v3 = __ccgo_ts + 501 + v3 = __ccgo_ts + 539 } part1 = v3 l = Xstrlen(tls, part1) @@ -99165,6 +100156,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { s += uintptr(l + uint64(1)) goto _2 _2: + ; i++ } s-- @@ -99191,7 +100183,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { if lm != 0 { v6 = lm + 16 } else { - v6 = __ccgo_ts + 501 + v6 = __ccgo_ts + 539 } ret = v6 ___unlock(tls, uintptr(unsafe.Pointer(&X__locale_lock))) @@ -99211,7 +100203,7 @@ func Xstrcoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrcoll_l(tls *TLS, l uintptr, r uintptr, loc Tlocale_t) (r1 int32) { @@ -99232,6 +100224,7 @@ func _vstrfmon_l(tls *TLS, s uintptr, n Tsize_t, loc Tlocale_t, fmt uintptr, ap _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = fill, fw, intl, l, left, lp, negpar, nogrp, nosym, rp, s0, w, x, v12, v5, v6, v8 s0 = s _3: + ; if !(n != 0 && *(*int8)(unsafe.Pointer(fmt)) != 0) { goto _1 } @@ -99239,6 +100232,7 @@ _3: goto _4 } literal: + ; v5 = s s++ v6 = fmt @@ -99247,6 +100241,7 @@ literal: n-- goto _2 _4: + ; fmt++ if int32(*(*int8)(unsafe.Pointer(fmt))) == int32('%') { goto literal @@ -99281,6 +100276,7 @@ _4: break goto _7 _7: + ; fmt++ } fw = 0 @@ -99291,6 +100287,7 @@ _4: fw = int32(10)*fw + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _9 _9: + ; fmt++ } lp = 0 @@ -99305,6 +100302,7 @@ _4: lp = int32(10)*lp + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _10 _10: + ; fmt++ } } @@ -99318,6 +100316,7 @@ _4: rp = int32(10)*rp + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _11 _11: + ; fmt++ } } @@ -99329,7 +100328,7 @@ _4: w = fw } x = VaFloat64(&ap) - l = uint64(Xsnprintf(tls, s, n, __ccgo_ts+539, VaList(bp+8, w, rp, x))) + l = uint64(Xsnprintf(tls, s, n, __ccgo_ts+577, VaList(bp+8, w, rp, x))) if l >= n { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(E2BIG) return int64(-int32(1)) @@ -99338,10 +100337,12 @@ _4: n -= l goto _2 _2: + ; goto _3 goto _1 _1: - return int64(s) - int64(s0) + ; + return int64(int64(s)) - int64(int64(s0)) } func Xstrfmon_l(tls *TLS, s uintptr, n Tsize_t, loc Tlocale_t, fmt uintptr, va uintptr) (r Tssize_t) { @@ -99367,7 +100368,7 @@ func Xstrfmon(tls *TLS, s uintptr, n Tsize_t, fmt uintptr, va uintptr) (r Tssize var ret Tssize_t _, _ = ap, ret ap = va - ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale, fmt, ap) + ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale, fmt, ap) _ = ap return ret } @@ -99442,7 +100443,7 @@ func Xstrxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -99477,7 +100478,7 @@ func X__gettextdomain(tls *TLS) (r uintptr) { if _current_domain != 0 { v1 = _current_domain } else { - v1 = __ccgo_ts + 393 + v1 = __ccgo_ts + 431 } return v1 } @@ -99531,7 +100532,7 @@ func X__uselocale(tls *TLS, new1 Tlocale_t) (r Tlocale_t) { var global, old, v1, v2 Tlocale_t var self Tpthread_t _, _, _, _, _ = global, old, self, v1, v2 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) old = (*t__pthread)(unsafe.Pointer(self)).Flocale global = uintptr(unsafe.Pointer(&X__libc)) + 56 if new1 != 0 { @@ -99574,7 +100575,7 @@ func Xwcscoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -99615,7 +100616,7 @@ func Xwcsxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -99827,7 +100828,7 @@ func X__fpclassifyl(tls *TLS, x float64) (r int32) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return X__fpclassify(tls, x) + return X__fpclassify(tls, float64(float64(x))) } const pio2_hi = 0 @@ -100088,9 +101089,10 @@ func X__rem_pio2(tls *TLS, x float64, y uintptr) (r1 int32) { goto _1 } /* |x| ~< 2^20*(pi/2), medium size */ medium: + ; /* rint(x/(pi/2)) */ fn = x*_invpio2 + _toint - _toint - n = int32(fn) + n = int32(int32(fn)) r = x - fn*_pio2_1 w = fn * _pio2_1t /* 1st round, good to 85 bits */ /* Matters with directed rounding. */ @@ -100130,6 +101132,7 @@ medium: *(*float64)(unsafe.Pointer(y + 1*8)) = r - *(*float64)(unsafe.Pointer(y)) - w return n _1: + ; /* * all other (large) arguments */ @@ -100149,10 +101152,11 @@ _1: if !(i < int32(2)) { break } - (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i] = float64(int32(z)) + (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i] = float64(int32(int32(z))) z = (z - (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i]) * float64(1.6777216e+07) goto _3 _3: + ; i++ } (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i] = z @@ -100313,6 +101317,7 @@ func X__rem_pio2_large(tls *TLS, x uintptr, y uintptr, e0 int32, nx int32, prec f[i] = v2 goto _1 _1: + ; i++ j++ } @@ -100331,15 +101336,18 @@ func X__rem_pio2_large(tls *TLS, x uintptr, y uintptr, e0 int32, nx int32, prec fw += *(*float64)(unsafe.Pointer(x + uintptr(j)*8)) * f[jx+i-j] goto _4 _4: + ; j++ } q[i] = fw goto _3 _3: + ; i++ } jz = jk recompute: + ; /* distill q[] into iq[] reversingly */ i = 0 j = jz @@ -100353,14 +101361,15 @@ recompute: z = q[j-int32(1)] + fw goto _5 _5: + ; i++ j-- } /* compute n */ z = Xscalbn(tls, z, q0) /* actual value of z */ z -= float64(8) * Xfloor(tls, z*float64(0.125)) /* trim off integer >= 8 */ - n = int32(z) - z -= float64(n) + n = int32(int32(z)) + z -= float64(float64(n)) ih = 0 if q0 > 0 { /* need iq[jz-1] to determine n */ i = (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz-int32(1)] >> (int32(24) - q0) @@ -100395,6 +101404,7 @@ recompute: } goto _6 _6: + ; i++ } if q0 > 0 { /* rare case: chance is 1 in 12 */ @@ -100424,6 +101434,7 @@ recompute: j |= (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[i] goto _7 _7: + ; i-- } if j == 0 { /* need recomputation */ @@ -100434,6 +101445,7 @@ recompute: } goto _8 _8: + ; k++ } /* k = no. of terms needed */ i = jz + int32(1) @@ -100451,11 +101463,13 @@ recompute: fw += *(*float64)(unsafe.Pointer(x + uintptr(j)*8)) * f[jx+i-j] goto _10 _10: + ; j++ } q[i] = fw goto _9 _9: + ; i++ } jz += k @@ -100477,9 +101491,9 @@ recompute: (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz] = int32(z - Float64FromFloat64(1.6777216e+07)*fw) jz += int32(1) q0 += int32(24) - (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz] = int32(fw) + (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz] = int32(int32(fw)) } else { - (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz] = int32(z) + (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[jz] = int32(int32(z)) } } /* convert integer "bit" chunk to floating-point value */ @@ -100493,6 +101507,7 @@ recompute: fw *= float64(5.960464477539063e-08) goto _11 _11: + ; i-- } /* compute PIo2[0,...,jp]*q[jz,...,0] */ @@ -100510,11 +101525,13 @@ recompute: fw += _PIo2[k] * q[i+k] goto _13 _13: + ; k++ } (*(*[20]float64)(unsafe.Pointer(bp + 80)))[jz-i] = fw goto _12 _12: + ; i-- } /* compress fq[] into y[] */ @@ -100530,6 +101547,7 @@ recompute: } goto _18 _14: + ; fw = float64(0) i = jz for { @@ -100539,6 +101557,7 @@ _14: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _19 _19: + ; i-- } if ih == 0 { @@ -100549,7 +101568,9 @@ _14: *(*float64)(unsafe.Pointer(y)) = v20 goto _18 _16: + ; _15: + ; fw = float64(0) i = jz for { @@ -100559,6 +101580,7 @@ _15: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _21 _21: + ; i-- } // TODO: drop excess precision here once double_t is used @@ -100578,6 +101600,7 @@ _15: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _23 _23: + ; i++ } if ih == 0 { @@ -100587,9 +101610,11 @@ _15: } *(*float64)(unsafe.Pointer(y + 1*8)) = v24 goto _18 -_17: /* painful */ +_17: + ; /* painful */ i = jz _27: + ; if !(i > 0) { goto _25 } @@ -100598,10 +101623,12 @@ _27: (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i-int32(1)] = fw goto _26 _26: + ; i-- goto _27 goto _25 _25: + ; i = jz for { if !(i > int32(1)) { @@ -100612,6 +101639,7 @@ _25: (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i-int32(1)] = fw goto _28 _28: + ; i-- } fw = float64(0) @@ -100623,6 +101651,7 @@ _25: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _29 _29: + ; i-- } if ih == 0 { @@ -100635,6 +101664,7 @@ _25: *(*float64)(unsafe.Pointer(y + 2*8)) = -fw } _18: + ; return n & int32(7) } @@ -100683,19 +101713,19 @@ func X__rem_pio2f(tls *TLS, x float32, y uintptr) (r int32) { /* 25+53 bit pi is good enough for medium size */ if ix < uint32(0x4dc90fdb) { /* |x| ~< 2^28*(pi/2), medium size */ /* Use a specialized rint() to get fn. */ - fn = float64(x)*_invpio21 + _toint1 - _toint1 - n = int32(fn) - *(*float64)(unsafe.Pointer(y)) = float64(x) - fn*_pio2_11 - fn*_pio2_1t1 + fn = float64(float64(x))*_invpio21 + _toint1 - _toint1 + n = int32(int32(fn)) + *(*float64)(unsafe.Pointer(y)) = float64(float64(x)) - fn*_pio2_11 - fn*_pio2_1t1 /* Matters with directed rounding. */ if *(*float64)(unsafe.Pointer(y)) < -_pio41 { n-- fn-- - *(*float64)(unsafe.Pointer(y)) = float64(x) - fn*_pio2_11 - fn*_pio2_1t1 + *(*float64)(unsafe.Pointer(y)) = float64(float64(x)) - fn*_pio2_11 - fn*_pio2_1t1 } else { if *(*float64)(unsafe.Pointer(y)) > _pio41 { n++ fn++ - *(*float64)(unsafe.Pointer(y)) = float64(x) - fn*_pio2_11 - fn*_pio2_1t1 + *(*float64)(unsafe.Pointer(y)) = float64(float64(x)) - fn*_pio2_11 - fn*_pio2_1t1 } } return n @@ -100775,7 +101805,7 @@ func X__signbitl(tls *TLS, x float64) (r int32) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return X__signbit(tls, x) + return X__signbit(tls, float64(float64(x))) } var _S1 = -Float64FromFloat64(0.16666666666666632) /* 0xBFC55555, 0x55555549 */ @@ -101165,7 +102195,7 @@ func Xacoshl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xacosh(tls, x) + return float64(Xacosh(tls, float64(float64(x)))) } func Xacosl(tls *TLS, x float64) (r float64) { @@ -101173,7 +102203,7 @@ func Xacosl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xacos(tls, x) + return float64(Xacos(tls, float64(float64(x)))) } var _pio2_hi2 = float64(1.5707963267948966) /* 0x3FF921FB, 0x54442D18 */ @@ -101275,7 +102305,7 @@ func Xasinf(tls *TLS, x float32) (r float32) { ix = hx & uint32(0x7fffffff) if ix >= uint32(0x3f800000) { /* |x| >= 1 */ if ix == uint32(0x3f800000) { /* |x| == 1 */ - return float32(float64(x)*_pio2 + Float64FromFloat32(7.52316384526264e-37)) + return float32(float64(float64(x))*_pio2 + Float64FromFloat32(7.52316384526264e-37)) } /* asin(+-1) = +-pi/2 with inexact */ return Float32FromInt32(0) / (x - x) /* asin(|x|>1) is NaN */ } @@ -101288,7 +102318,7 @@ func Xasinf(tls *TLS, x float32) (r float32) { } /* 1 > |x| >= 0.5 */ z = (Float32FromInt32(1) - Xfabsf(tls, x)) * Float32FromFloat32(0.5) - s = Xsqrt(tls, float64(z)) + s = Xsqrt(tls, float64(float64(z))) x = float32(_pio2 - Float64FromInt32(2)*(s+s*float64(_R3(tls, z)))) if hx>>int32(31) != 0 { return -x @@ -101346,7 +102376,7 @@ func Xasinh(tls *TLS, x float64) (r float64) { if uint64(8) == uint64(8) { y1 = x + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x + Float64FromFloat32(1.329227995784916e+36)) } } } @@ -101430,7 +102460,7 @@ func Xasinhl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xasinh(tls, x) + return float64(Xasinh(tls, float64(float64(x)))) } func Xasinl(tls *TLS, x float64) (r float64) { @@ -101438,7 +102468,7 @@ func Xasinl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xasin(tls, x) + return float64(Xasin(tls, float64(float64(x)))) } var _atanhi = [4]float64{ @@ -101511,12 +102541,12 @@ func Xatan(tls *TLS, x float64) (r float64) { if ix < uint32(0x00100000) { /* raise underflow for subnormal x */ if uint64(4) == uint64(4) { - y = float32(x) + y = float32(float32(x)) } else { if uint64(4) == uint64(8) { - y1 = float64(float32(x)) + y1 = float64(float32(float32(x))) } else { - y2 = float64(float32(x)) + y2 = float64(float32(float32(x))) } } } @@ -101585,6 +102615,7 @@ func Xatan2(tls *TLS, y float64, x float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)<> int32(32)) - lx = uint32(__u1) + lx = uint32(uint32(__u1)) __u2 = *(*Tuint64_t)(unsafe.Pointer(&y)) iy = uint32(__u2 >> int32(32)) - ly = uint32(__u2) + ly = uint32(uint32(__u2)) if ix-uint32(0x3ff00000)|lx == uint32(0) { /* x = 1.0 */ return Xatan(tls, y) } @@ -101705,6 +102736,7 @@ func Xatan2f(tls *TLS, y float32, x float32) (r float32) { v1 = *(*uint32)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = y v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -101803,7 +102835,7 @@ func Xatan2l(tls *TLS, y float64, x float64) (r float64) { trc("tls=%v y=%v x=%v, (%v:)", tls, y, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xatan2(tls, y, x) + return float64(Xatan2(tls, float64(float64(y)), float64(float64(x)))) } var _atanhi1 = [4]float32{ @@ -101957,12 +102989,12 @@ func Xatanh(tls *TLS, x float64) (r float64) { /* handle underflow */ if e == uint32(0) { if uint64(4) == uint64(4) { - y = float32(y3) + y = float32(float32(y3)) } else { if uint64(4) == uint64(8) { - y1 = float64(float32(y3)) + y1 = float64(float32(float32(y3))) } else { - y2 = float64(float32(y3)) + y2 = float64(float32(float32(y3))) } } } @@ -102048,7 +103080,7 @@ func Xatanhl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xatanh(tls, x) + return float64(Xatanh(tls, float64(float64(x)))) } func Xatanl(tls *TLS, x float64) (r float64) { @@ -102056,7 +103088,7 @@ func Xatanl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xatan(tls, x) + return float64(Xatan(tls, float64(float64(x)))) } var _B1 = uint32(715094163) /* B1 = (1023-1023/3-0.03306235651)*2**20 */ @@ -102125,8 +103157,8 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { hx = hx/uint32(3) + _B1 } p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63)) - *(*Tuint64_t)(unsafe.Pointer(bp)) |= uint64(hx) << int32(32) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & (Uint64FromUint64(1) << Int32FromInt32(63))) + *(*Tuint64_t)(unsafe.Pointer(bp)) |= uint64(uint64(hx)) << int32(32) t = *(*float64)(unsafe.Pointer(bp)) /* * New cbrt to 23 bits: @@ -102151,7 +103183,7 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { * before the final error is larger than 0.667 ulps. */ *(*float64)(unsafe.Pointer(bp)) = t - *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*Tuint64_t)(unsafe.Pointer(bp)) + Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000) + *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(uint64(*(*Tuint64_t)(unsafe.Pointer(bp))+Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000)) t = *(*float64)(unsafe.Pointer(bp)) /* one step Newton iteration to 53 bits with error < 0.667 ulps */ s = t * t /* t*t is exact */ @@ -102211,15 +103243,15 @@ func Xcbrtf(tls *TLS, x float32) (r1 float32) { */ T = float64(*(*float32)(unsafe.Pointer(bp))) r = T * T * T - T = T * (float64(x) + float64(x) + r) / (float64(x) + r + r) + T = T * (float64(float64(x)) + float64(float64(x)) + r) / (float64(float64(x)) + r + r) /* * Second step Newton iteration to 47 bits. In double precision for * efficiency and accuracy. */ r = T * T * T - T = T * (float64(x) + float64(x) + r) / (float64(x) + r + r) + T = T * (float64(float64(x)) + float64(float64(x)) + r) / (float64(float64(x)) + r + r) /* rounding to 24 bits is perfect in round-to-nearest mode */ - return float32(T) + return float32(float32(T)) } func Xcbrtl(tls *TLS, x float64) (r float64) { @@ -102227,7 +103259,7 @@ func Xcbrtl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xcbrt(tls, x) + return float64(Xcbrt(tls, float64(float64(x)))) } const DBL_EPSILON5 = 2.220446049250313e-16 @@ -102271,12 +103303,12 @@ func Xceil(tls *TLS, x float64) (r float64) { /* special case because of non-nearest rounding modes */ if e <= Int32FromInt32(0x3ff)-Int32FromInt32(1) { if uint64(8) == uint64(4) { - y = float32(y3) + y = float32(float32(y3)) } else { if uint64(8) == uint64(8) { y1 = y3 } else { - y2 = y3 + y2 = float64(float64(y3)) } } if *(*Tuint64_t)(unsafe.Pointer(bp))>>int32(63) != 0 { @@ -102366,7 +103398,7 @@ func Xceill(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xceil(tls, x) + return float64(Xceil(tls, float64(float64(x)))) } func Xcopysign(tls *TLS, x float64, y float64) (r float64) { @@ -102403,9 +103435,9 @@ func Xcopysign(tls *TLS, x float64, y float64) (r float64) { }{} *(*float64)(unsafe.Pointer(bp + 8)) = y p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | *(*Tuint64_t)(unsafe.Pointer(bp + 8))&(Uint64FromUint64(1)< %v", r) }() } - return Xcopysign(tls, x, y) + return float64(Xcopysign(tls, float64(float64(x)), float64(float64(y)))) } func Xcos(tls *TLS, x float64) (r float64) { @@ -102478,7 +103510,7 @@ func Xcos(tls *TLS, x float64) (r float64) { if uint64(8) == uint64(8) { y1 = x + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x + Float64FromFloat32(1.329227995784916e+36)) } } return float64(1) @@ -102545,37 +103577,37 @@ func Xcosf(tls *TLS, x float32) (r float32) { } return Float32FromFloat32(1) } - return X__cosdf(tls, float64(x)) + return X__cosdf(tls, float64(float64(x))) } if ix <= uint32(0x407b53d1) { /* |x| ~<= 5*pi/4 */ if ix > uint32(0x4016cbe3) { /* |x| ~> 3*pi/4 */ if sign != 0 { - v1 = float64(x) + _c2pio2 + v1 = float64(float64(x)) + _c2pio2 } else { - v1 = float64(x) - _c2pio2 + v1 = float64(float64(x)) - _c2pio2 } return -X__cosdf(tls, v1) } else { if sign != 0 { - return X__sindf(tls, float64(x)+_c1pio2) + return X__sindf(tls, float64(float64(x))+_c1pio2) } else { - return X__sindf(tls, _c1pio2-float64(x)) + return X__sindf(tls, _c1pio2-float64(float64(x))) } } } if ix <= uint32(0x40e231d5) { /* |x| ~<= 9*pi/4 */ if ix > uint32(0x40afeddf) { /* |x| ~> 7*pi/4 */ if sign != 0 { - v2 = float64(x) + _c4pio2 + v2 = float64(float64(x)) + _c4pio2 } else { - v2 = float64(x) - _c4pio2 + v2 = float64(float64(x)) - _c4pio2 } return X__cosdf(tls, v2) } else { if sign != 0 { return X__sindf(tls, float64(-x)-_c3pio2) } else { - return X__sindf(tls, float64(x)-_c3pio2) + return X__sindf(tls, float64(float64(x))-_c3pio2) } } } @@ -102643,7 +103675,7 @@ func Xcosh(tls *TLS, x float64) (r float64) { if uint64(8) == uint64(8) { y1 = x + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x + Float64FromFloat32(1.329227995784916e+36)) } } return Float64FromInt32(1) @@ -102722,7 +103754,7 @@ func Xcoshl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xcosh(tls, x) + return float64(Xcosh(tls, float64(float64(x)))) } func Xcosl(tls *TLS, x float64) (r float64) { @@ -102730,7 +103762,7 @@ func Xcosl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xcos(tls, x) + return float64(Xcos(tls, float64(float64(x)))) } var _erx = float64(0.8450629115104675) /* 0x3FEB0AC1, 0x60000000 */ @@ -103108,7 +104140,7 @@ func Xerfl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xerf(tls, x) + return float64(Xerf(tls, float64(float64(x)))) } func Xerfcl(tls *TLS, x float64) (r float64) { @@ -103116,7 +104148,7 @@ func Xerfcl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xerfc(tls, x) + return float64(Xerfc(tls, float64(float64(x)))) } const EXP2_POLY_ORDER = 5 @@ -103140,7 +104172,7 @@ func _specialcase(tls *TLS, tmp Tdouble_t, sbits Tuint64_t, ki Tuint64_t) (r flo _, _, _, _, _, _, _, _, _, _, _ = hi, lo, scale, y, y1, y2, y3, v1, v3, v5, v7 if ki&uint64(0x80000000) == uint64(0) { /* k > 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)< %v", r) }() } - return Xexp10(tls, x) + return float64(Xexp10(tls, float64(float64(x)))) } func Xpow10l(tls *TLS, x float64) (r float64) { @@ -103430,7 +104462,7 @@ func _specialcase1(tls *TLS, tmp Tdouble_t, sbits Tuint64_t, ki Tuint64_t) (r fl _, _, _, _, _, _, _, _, _, _, _ = hi, lo, scale, y, y1, y2, y3, v1, v3, v5, v7 if ki&uint64(0x80000000) == uint64(0) { /* k > 0, the exponent of scale might have overflowed by 1. */ - sbits = sbits - Uint64FromUint64(1)<= _top122(tls, Float32FromFloat32(128)) { /* |x| >= 128 or x is nan. */ @@ -103621,7 +104653,7 @@ _3: y2 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__exp2f_data)) + 264 + 2*8))*r + Float64FromInt32(1) y2 = z*r2 + y2 y2 = y2 * s - y = float32(y2) + y = float32(float32(y2)) v5 = y goto _6 _6: @@ -103642,7 +104674,7 @@ func Xexp2l(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xexp2(tls, x) + return float64(Xexp2(tls, float64(float64(x)))) } const N2 = 128 @@ -103685,7 +104717,7 @@ func Xexpf(tls *TLS, x float32) (r1 float32) { var y, v1, v5 float32 var y1, v2, v4 float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = abstop, kd, ki, r, r2, s, t, xd, y, y1, y2, z, v1, v2, v4, v5 - xd = float64(x) + xd = float64(float64(x)) abstop = _top123(tls, x) & uint32(0x7ff) if abstop >= _top123(tls, Float32FromFloat32(88)) { /* |x| >= 88 or x is nan. */ @@ -103726,7 +104758,7 @@ _3: y2 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__exp2f_data)) + 304 + 2*8))*r + Float64FromInt32(1) y2 = z*r2 + y2 y2 = y2 * s - y = float32(y2) + y = float32(float32(y2)) v5 = y goto _6 _6: @@ -103738,7 +104770,7 @@ func Xexpl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xexp(tls, x) + return float64(Xexp(tls, float64(float64(x)))) } var _o_threshold = float64(709.782712893384) /* 0x40862E42, 0xFEFA39EF */ @@ -103820,7 +104852,7 @@ func Xexpm1(tls *TLS, x float64) (r float64) { v3 = float64(0.5) } k = int32(_invln2*x + v3) - t = float64(k) + t = float64(float64(k)) hi = x - t*_ln2_hi /* t*ln2_hi is exact here */ lo = t * _ln2_lo } @@ -103830,12 +104862,12 @@ func Xexpm1(tls *TLS, x float64) (r float64) { if hx < uint32(0x3c900000) { /* |x| < 2**-54, return x */ if hx < uint32(0x00100000) { if uint64(4) == uint64(4) { - y = float32(x) + y = float32(float32(x)) } else { if uint64(4) == uint64(8) { - y1 = float64(float32(x)) + y1 = float64(float32(float32(x))) } else { - y2 = float64(float32(x)) + y2 = float64(float32(float32(x))) } } } @@ -103955,7 +104987,7 @@ func Xexpm1f(tls *TLS, x float32) (r float32) { v1 = Float32FromFloat32(0.5) } k = int32(_invln21*x + v1) - t = float32(k) + t = float32(float32(k)) hi = x - t*_ln2_hi1 /* t*ln2_hi is exact here */ lo = t * _ln2_lo1 } @@ -104025,7 +105057,7 @@ func Xexpm1l(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xexpm1(tls, x) + return float64(Xexpm1(tls, float64(float64(x)))) } func Xfabs(tls *TLS, x float64) (r float64) { @@ -104050,7 +105082,7 @@ func Xfabs(tls *TLS, x float64) (r float64) { }{} *(*float64)(unsafe.Pointer(bp)) = x p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) return *(*float64)(unsafe.Pointer(bp)) } @@ -104082,7 +105114,7 @@ func Xfabsl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfabs(tls, x) + return float64(Xfabs(tls, float64(float64(x)))) } func Xfdim(tls *TLS, x float64, y float64) (r float64) { @@ -104162,7 +105194,7 @@ func Xfdiml(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfdim(tls, x, y) + return float64(Xfdim(tls, float64(float64(x)), float64(float64(y)))) } func Xfinite(tls *TLS, x float64) (r int32) { @@ -104246,12 +105278,12 @@ func Xfloor(tls *TLS, x float64) (r float64) { /* special case because of non-nearest rounding modes */ if e <= Int32FromInt32(0x3ff)-Int32FromInt32(1) { if uint64(8) == uint64(4) { - y = float32(y3) + y = float32(float32(y3)) } else { if uint64(8) == uint64(8) { y1 = y3 } else { - y2 = y3 + y2 = float64(float64(y3)) } } if *(*Tuint64_t)(unsafe.Pointer(bp))>>int32(63) != 0 { @@ -104341,7 +105373,7 @@ func Xfloorl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfloor(tls, x) + return float64(Xfloor(tls, float64(float64(x)))) } const DBL_MIN1 = 2.2250738585072014e-308 @@ -104374,8 +105406,8 @@ func _normalize(tls *TLS, x float64) (r Tnum) { } e = v2 } - ix = ix & (Uint64FromUint64(1)<> int32(32) - ylo = uint64(uint32(y)) + ylo = uint64(uint32(uint32(y))) yhi = y >> int32(32) t1 = xlo * ylo t2 = xlo*yhi + xhi*ylo @@ -104492,7 +105524,7 @@ func Xfma(tls *TLS, x float64, y float64, z float64) (r1 float64) { e += int32(64) v1 = *(*Tuint64_t)(unsafe.Pointer(bp)) // __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 121, __ccgo_ts+545) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 121, __ccgo_ts+583) v2 = int32(v1) goto _3 _3: @@ -104503,7 +105535,7 @@ func Xfma(tls *TLS, x float64, y float64, z float64) (r1 float64) { if *(*Tuint64_t)(unsafe.Pointer(bp + 8)) != 0 { v4 = *(*Tuint64_t)(unsafe.Pointer(bp + 8)) // __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 121, __ccgo_ts+545) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 121, __ccgo_ts+583) v5 = int32(v4) goto _6 _6: @@ -104524,7 +105556,7 @@ func Xfma(tls *TLS, x float64, y float64, z float64) (r1 float64) { if sign != 0 { i = -i } - r = float64(i) /* |r| is in [0x1p62,0x1p63] */ + r = float64(float64(i)) /* |r| is in [0x1p62,0x1p63] */ if e < -Int32FromInt32(1022)-Int32FromInt32(62) { /* result is subnormal before rounding */ if e == -Int32FromInt32(1022)-Int32FromInt32(63) { @@ -104537,16 +105569,16 @@ func Xfma(tls *TLS, x float64, y float64, z float64) (r1 float64) { on arch behaviour which can be imitated by a double to float conversion */ fltmin = float32(Float64FromFloat64(1.0842021401737618e-19) * Float64FromFloat32(1.1754943508222875e-38) * r) - return Float64FromFloat64(2.2250738585072014e-308) / Float64FromFloat32(1.1754943508222875e-38) * float64(fltmin) + return Float64FromFloat64(2.2250738585072014e-308) / Float64FromFloat32(1.1754943508222875e-38) * float64(float64(fltmin)) } /* one bit is lost when scaled, add another top bit to only round once at conversion if it is inexact */ if *(*Tuint64_t)(unsafe.Pointer(bp))<>int32(1) | *(*Tuint64_t)(unsafe.Pointer(bp))&uint64(1) | Uint64FromUint64(1)<>int32(1)|*(*Tuint64_t)(unsafe.Pointer(bp))&uint64(1)) | Uint64FromUint64(1)< %v", r) }() } - return Xfma(tls, x, y, z) + return float64(Xfma(tls, float64(float64(x)), float64(float64(y)), float64(float64(z)))) } func Xfmax(tls *TLS, x float64, y float64) (r float64) { @@ -104696,7 +105728,7 @@ func Xfmaxl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfmax(tls, x, y) + return float64(Xfmax(tls, float64(float64(x)), float64(float64(y)))) } func Xfmin(tls *TLS, x float64, y float64) (r float64) { @@ -104818,7 +105850,7 @@ func Xfminl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfmin(tls, x, y) + return float64(Xfmin(tls, float64(float64(x)), float64(float64(y)))) } func Xfmod(tls *TLS, x float64, y float64) (r float64) { @@ -104892,13 +105924,14 @@ func Xfmod(tls *TLS, x float64, y float64) (r float64) { } goto _4 _4: + ; ex-- i <<= uint64(1) } uxi <<= uint64(-ex + int32(1)) } else { - uxi = uxi & (-Uint64FromUint64(1) >> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uint64(uxi) | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p6))) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= uint64(-ex + int32(1)) } - uxi |= uint64(sx) << int32(63) + uxi |= uint64(uint64(sx)) << int32(63) *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = uxi return *(*float64)(unsafe.Pointer(bp + 8)) } @@ -105031,6 +106067,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _4 _4: + ; ex-- i <<= uint32(1) } @@ -105047,6 +106084,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _5 _5: + ; ey-- i <<= uint32(1) } @@ -105070,6 +106108,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { uxi <<= uint32(1) goto _6 _6: + ; ex-- } i = uxi - *(*Tuint32_t)(unsafe.Pointer(bp + 8)) @@ -105085,13 +106124,14 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _7 _7: + ; uxi <<= uint32(1) ex-- } /* scale result up */ if ex > 0 { uxi -= Uint32FromUint32(1) << Int32FromInt32(23) - uxi |= uint32(ex) << int32(23) + uxi |= uint32(uint32(ex)) << int32(23) } else { uxi >>= uint32(-ex + int32(1)) } @@ -105105,7 +106145,7 @@ func Xfmodl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfmod(tls, x, y) + return float64(Xfmod(tls, float64(float64(x)), float64(float64(y)))) } func Xfrexp(tls *TLS, x float64, e uintptr) (r float64) { @@ -105146,9 +106186,9 @@ func Xfrexp(tls *TLS, x float64, e uintptr) (r float64) { } *(*int32)(unsafe.Pointer(e)) = ee - int32(0x3fe) p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & Uint64FromUint64(0x800fffffffffffff) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & Uint64FromUint64(0x800fffffffffffff)) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | Uint64FromUint64(0x3fe0000000000000) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p2))) | Uint64FromUint64(0x3fe0000000000000)) return *(*float64)(unsafe.Pointer(bp)) } @@ -105177,7 +106217,7 @@ func Xfrexpf(tls *TLS, x float32, e uintptr) (r float32) { ee = int32(*(*Tuint32_t)(unsafe.Pointer(bp)) >> int32(23) & uint32(0xff)) if !(ee != 0) { if x != 0 { - x = Xfrexpf(tls, float32(float64(x)*float64(1.8446744073709552e+19)), e) + x = Xfrexpf(tls, float32(float64(float64(x))*float64(1.8446744073709552e+19)), e) *(*int32)(unsafe.Pointer(e)) -= int32(64) } else { *(*int32)(unsafe.Pointer(e)) = 0 @@ -105201,7 +106241,7 @@ func Xfrexpl(tls *TLS, x float64, e uintptr) (r float64) { trc("tls=%v x=%v e=%v, (%v:)", tls, x, e, origin(2)) defer func() { trc("-> %v", r) }() } - return Xfrexp(tls, x, e) + return float64(Xfrexp(tls, float64(float64(x)), e)) } const SPLIT = 1 @@ -105261,9 +106301,9 @@ func Xhypot(tls *TLS, x float64, y float64) (r float64) { *(*float64)(unsafe.Pointer(bp + 8)) = y /* arrange |x| >= |y| */ p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) p2 = bp + 8 - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p2))) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) if *(*Tuint64_t)(unsafe.Pointer(bp)) < *(*Tuint64_t)(unsafe.Pointer(bp + 8)) { ut = *(*struct { Fi [0]Tuint64_t @@ -105393,7 +106433,7 @@ func Xhypotf(tls *TLS, x float32, y float32) (r float32) { y *= Float32FromFloat32(1.2379400392853803e+27) } } - return z * Xsqrtf(tls, float32(float64(x)*float64(x)+float64(y)*float64(y))) + return z * Xsqrtf(tls, float32(float64(float64(x))*float64(float64(x))+float64(float64(y))*float64(float64(y)))) } func Xhypotl(tls *TLS, x float64, y float64) (r float64) { @@ -105401,7 +106441,7 @@ func Xhypotl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xhypot(tls, x, y) + return float64(Xhypot(tls, float64(float64(x)), float64(float64(y)))) } func Xilogb(tls *TLS, x float64) (r int32) { @@ -105452,6 +106492,7 @@ func Xilogb(tls *TLS, x float64) (r int32) { } goto _1 _1: + ; e-- i <<= uint64(1) } @@ -105525,6 +106566,7 @@ func Xilogbf(tls *TLS, x float32) (r int32) { } goto _1 _1: + ; e-- i <<= uint32(1) } @@ -105555,7 +106597,7 @@ func Xilogbl(tls *TLS, x float64) (r int32) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xilogb(tls, x) + return Xilogb(tls, float64(float64(x))) } var _invsqrtpi = float64(0.5641895835477563) /* 0x3FE20DD7, 0x50429B6D */ @@ -105672,7 +106714,7 @@ func Xy0(tls *TLS, x float64) (r float64) { _, _, _, _, _, _ = __u, ix, lx, u, v, z __u = *(*Tuint64_t)(unsafe.Pointer(&x)) ix = uint32(__u >> int32(32)) - lx = uint32(__u) + lx = uint32(uint32(__u)) /* y0(nan)=nan, y0(<0)=nan, y0(0)=-inf, y0(inf)=0 */ if ix<> int32(32)) - lx = uint32(__u) + lx = uint32(uint32(__u)) /* y1(nan)=nan, y1(<0)=nan, y1(0)=-inf, y1(inf)=0 */ if ix<> int32(32)) - lx = uint32(__u) + lx = uint32(uint32(__u)) sign = int32(ix >> int32(31)) ix &= uint32(0x7fffffff) if ix|(lx|-lx)>>int32(31) > uint32(0x7ff00000) { /* nan */ @@ -106961,7 +108003,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { if ix|lx == uint32(0) || ix == uint32(0x7ff00000) { /* if x is 0 or inf */ b = float64(0) } else { - if float64(nm1) < x { + if float64(float64(nm1)) < x { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if ix >= uint32(0x52d00000) { /* x > 2**302 */ /* (x >> n**2) @@ -107001,7 +108043,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { } i++ temp = b - b = b*(float64(2)*float64(i)/x) - a /* avoid underflow */ + b = b*(float64(2)*float64(float64(i))/x) - a /* avoid underflow */ a = temp goto _1 _1: @@ -107023,16 +108065,17 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { if !(i <= nm1+int32(1)) { break } - a *= float64(i) /* a = n! */ - b *= temp /* b = (x/2)^n */ + a *= float64(float64(i)) /* a = n! */ + b *= temp /* b = (x/2)^n */ goto _2 _2: + ; i++ } b = b / a } } else { - nf = float64(nm1) + float64(1) + nf = float64(float64(nm1)) + float64(1) w = Float64FromInt32(2) * nf / x h = Float64FromInt32(2) / x z = w + h @@ -107052,9 +108095,10 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { if !(i >= 0) { break } - t = Float64FromInt32(1) / (Float64FromInt32(2)*(float64(i)+nf)/x - t) + t = Float64FromInt32(1) / (Float64FromInt32(2)*(float64(float64(i))+nf)/x - t) goto _3 _3: + ; i-- } a = t @@ -107075,10 +108119,11 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { break } temp = b - b = b*(float64(2)*float64(i))/x - a + b = b*(float64(2)*float64(float64(i)))/x - a a = temp goto _4 _4: + ; i-- } } else { @@ -107088,7 +108133,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { break } temp = b - b = b*(float64(2)*float64(i))/x - a + b = b*(float64(2)*float64(float64(i)))/x - a a = temp /* scale b to avoid spurious overflow */ if b > float64(3.273390607896142e+150) { @@ -107098,6 +108143,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { } goto _5 _5: + ; i-- } } @@ -107131,7 +108177,7 @@ func Xyn(tls *TLS, n int32, x float64) (r float64) { _, _, _, _, _, _, _, _, _, _, _, _ = __u, a, b, i, ib, ix, lx, nm1, sign, temp, v1, v3 __u = *(*Tuint64_t)(unsafe.Pointer(&x)) ix = uint32(__u >> int32(32)) - lx = uint32(__u) + lx = uint32(uint32(__u)) sign = int32(ix >> int32(31)) ix &= uint32(0x7fffffff) if ix|(lx|-lx)>>int32(31) > uint32(0x7ff00000) { /* nan */ @@ -107201,7 +108247,7 @@ func Xyn(tls *TLS, n int32, x float64) (r float64) { } i++ temp = b - b = float64(2)*float64(i)/x*b - a + b = float64(2)*float64(float64(i))/x*b - a ib = uint32(*(*Tuint64_t)(unsafe.Pointer(&b)) >> int32(32)) a = temp goto _2 @@ -107250,7 +108296,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { if ix == uint32(0) || ix == uint32(0x7f800000) { /* if x is 0 or inf */ b = Float32FromFloat32(0) } else { - if float32(nm1) < x { + if float32(float32(nm1)) < x { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ a = Xj0f(tls, x) b = Xj1f(tls, x) @@ -107261,7 +108307,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { } i++ temp = b - b = b*(Float32FromFloat32(2)*float32(i)/x) - a + b = b*(Float32FromFloat32(2)*float32(float32(i))/x) - a a = temp goto _1 _1: @@ -107282,15 +108328,16 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { if !(i <= nm1+int32(1)) { break } - a *= float32(i) /* a = n! */ - b *= temp /* b = (x/2)^n */ + a *= float32(float32(i)) /* a = n! */ + b *= temp /* b = (x/2)^n */ goto _2 _2: + ; i++ } b = b / a } else { - nf = float32(nm1) + Float32FromFloat32(1) + nf = float32(float32(nm1)) + Float32FromFloat32(1) w = Float32FromInt32(2) * nf / x h = Float32FromInt32(2) / x z = w + h @@ -107310,9 +108357,10 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { if !(i >= 0) { break } - t = Float32FromFloat32(1) / (Float32FromInt32(2)*(float32(i)+nf)/x - t) + t = Float32FromFloat32(1) / (Float32FromInt32(2)*(float32(float32(i))+nf)/x - t) goto _3 _3: + ; i-- } a = t @@ -107333,10 +108381,11 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { break } temp = b - b = Float32FromFloat32(2)*float32(i)*b/x - a + b = Float32FromFloat32(2)*float32(float32(i))*b/x - a a = temp goto _4 _4: + ; i-- } } else { @@ -107346,7 +108395,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { break } temp = b - b = Float32FromFloat32(2)*float32(i)*b/x - a + b = Float32FromFloat32(2)*float32(float32(i))*b/x - a a = temp /* scale b to avoid spurious overflow */ if b > Float32FromFloat32(1.152921504606847e+18) { @@ -107356,6 +108405,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { } goto _5 _5: + ; i-- } } @@ -107427,7 +108477,7 @@ func Xynf(tls *TLS, n int32, x float32) (r float32) { } i++ temp = b - b = Float32FromFloat32(2)*float32(i)/x*b - a + b = Float32FromFloat32(2)*float32(float32(i))/x*b - a ib = *(*Tuint32_t)(unsafe.Pointer(&b)) a = temp goto _2 @@ -107547,7 +108597,7 @@ func _sin_pi(tls *TLS, x float64) (r float64) { x = float64(2) * (x*float64(0.5) - Xfloor(tls, x*float64(0.5))) /* x mod 2.0 */ n = int32(x * Float64FromFloat64(4)) n = (n + int32(1)) / int32(2) - x -= float64(float32(n) * Float32FromFloat32(0.5)) + x -= float64(float32(float32(n)) * Float32FromFloat32(0.5)) x *= _pi2 switch n { default: /* case 4: */ @@ -107670,8 +108720,8 @@ func X__lgamma_r(tls *TLS, x float64, signgamp uintptr) (r1 float64) { } } else { if ix < uint32(0x40200000) { /* x < 8.0 */ - i = int32(x) - y = x - float64(i) + i = int32(int32(x)) + y = x - float64(float64(i)) p = y * (_s0 + y*(_s1+y*(_s2+y*(_s3+y*(_s4+y*(_s5+y*_s6)))))) q = float64(1) + y*(_r1+y*(_r2+y*(_r3+y*(_r4+y*(_r5+y*_r6))))) r = float64(0.5)*y + p/q @@ -107804,7 +108854,7 @@ func _sin_pi1(tls *TLS, x float32) (r float32) { x = Float32FromInt32(2) * (x*Float32FromFloat32(0.5) - Xfloorf(tls, x*Float32FromFloat32(0.5))) /* x mod 2.0 */ n = int32(x * Float32FromInt32(4)) n = (n + int32(1)) / int32(2) - y = float64(x - float32(n)*Float32FromFloat32(0.5)) + y = float64(x - float32(float32(n))*Float32FromFloat32(0.5)) y *= float64(3.141592653589793) switch n { default: /* case 4: */ @@ -107927,8 +108977,8 @@ func X__lgammaf_r(tls *TLS, x float32, signgamp uintptr) (r1 float32) { } } else { if ix < uint32(0x41000000) { /* x < 8.0 */ - i = int32(x) - y = x - float32(i) + i = int32(int32(x)) + y = x - float32(float32(i)) p = y * (_s06 + y*(_s11+y*(_s21+y*(_s31+y*(_s41+y*(_s51+y*_s61)))))) q = Float32FromFloat32(1) + y*(_r11+y*(_r21+y*(_r31+y*(_r41+y*(_r51+y*_r61))))) r = Float32FromFloat32(0.5)*y + p/q @@ -107983,7 +109033,7 @@ func X__lgammal_r(tls *TLS, x float64, sg uintptr) (r float64) { trc("tls=%v x=%v sg=%v, (%v:)", tls, x, sg, origin(2)) defer func() { trc("-> %v", r) }() } - return X__lgamma_r(tls, x, sg) + return float64(X__lgamma_r(tls, float64(float64(x)), sg)) } func Xlgammal(tls *TLS, x float64) (r float64) { @@ -108027,7 +109077,7 @@ func Xllrintl(tls *TLS, x float64) (r int64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xllrint(tls, x) + return Xllrint(tls, float64(float64(x))) } func Xllround(tls *TLS, x float64) (r int64) { @@ -108128,15 +109178,15 @@ func Xlog(tls *TLS, x float64) (r1 float64) { /* x is subnormal, normalize it. */ v9 = x * float64(4.503599627370496e+15) ix = *(*Tuint64_t)(unsafe.Pointer(&v9)) - ix = ix - Uint64FromUint64(52)<> (Int32FromInt32(52) - Int32FromInt32(LOG_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> int32(52)) /* arithmetic shift */ + iz = uint64(uint64(uint64(ix)) - uint64(uint64(tmp))&(Uint64FromUint64(0xfff)<>Int32FromInt32(20)) - int32(0x3ff) hx = hx&uint32(0x000fffff) + uint32(0x3fe6a09e) - *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(hx)< %v", r) }() } - return Xlog10(tls, x) + return float64(Xlog10(tls, float64(float64(x)))) } var _ln2_hi2 = float64(0.6931471803691238) /* 3fe62e42 fee00000 */ @@ -108406,12 +109456,12 @@ func Xlog1p(tls *TLS, x float64) (r float64) { /* underflow if subnormal */ if hx&uint32(0x7ff00000) == uint32(0) { if uint64(4) == uint64(4) { - y = float32(x) + y = float32(float32(x)) } else { if uint64(4) == uint64(8) { - y1 = float64(float32(x)) + y1 = float64(float32(float32(x))) } else { - y2 = float64(float32(x)) + y2 = float64(float32(float32(x))) } } } @@ -108446,7 +109496,7 @@ func Xlog1p(tls *TLS, x float64) (r float64) { } /* reduce u into [sqrt(2)/2, sqrt(2)] */ hu = hu&uint32(0x000fffff) + uint32(0x3fe6a09e) - *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(hu)< %v", r) }() } - return Xlog1p(tls, x) + return float64(Xlog1p(tls, float64(float64(x)))) } const LOG2_POLY1_ORDER = 11 @@ -108608,7 +109658,7 @@ func Xlog2(tls *TLS, x float64) (r1 float64) { } r = x - float64(1) v7 = r - v6 = *(*Tuint64_t)(unsafe.Pointer(&v7)) & (-Uint64FromUint64(1) << Int32FromInt32(32)) + v6 = uint64(uint64(*(*Tuint64_t)(unsafe.Pointer(&v7))) & (-Uint64FromUint64(1) << Int32FromInt32(32))) rhi = *(*float64)(unsafe.Pointer(&v6)) rlo = r - rhi hi = rhi * X__log2_data.Finvln2hi @@ -108642,15 +109692,15 @@ func Xlog2(tls *TLS, x float64) (r1 float64) { /* x is subnormal, normalize it. */ v11 = x * float64(4.503599627370496e+15) ix = *(*Tuint64_t)(unsafe.Pointer(&v11)) - ix = ix - Uint64FromUint64(52)<> (Int32FromInt32(52) - Int32FromInt32(LOG2_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> int32(52)) /* arithmetic shift */ + iz = uint64(uint64(uint64(ix)) - uint64(uint64(tmp))&(Uint64FromUint64(0xfff)<> (Int32FromInt32(23) - Int32FromInt32(LOG2F_TABLE_BITS)) % uint32(Int32FromInt32(1)<> int32(23) /* arithmetic shift */ + k = int32(int32(tmp)) >> int32(23) /* arithmetic shift */ invc = (*(*struct { Finvc float64 Flogc float64 @@ -108772,14 +109822,14 @@ func Xlog2f(tls *TLS, x float32) (r1 float32) { z = float64(*(*float32)(unsafe.Pointer(&iz))) /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ r = z*invc - Float64FromInt32(1) - y0 = logc + float64(k) + y0 = logc + float64(float64(k)) /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ r2 = r * r y1 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__log2f_data)) + 256 + 1*8))*r + *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__log2f_data)) + 256 + 2*8)) y1 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__log2f_data)) + 256))*r2 + y1 p = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__log2f_data)) + 256 + 3*8))*r + y0 y1 = y1*r2 + p - y = float32(y1) + y = float32(float32(y1)) v2 = y goto _3 _3: @@ -108799,7 +109849,7 @@ func Xlog2l(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xlog2(tls, x) + return float64(Xlog2(tls, float64(float64(x)))) } const N7 = 128 @@ -108891,7 +109941,7 @@ func Xlogbl(tls *TLS, x float64) (r float64) { F__f float64 } _ = v1 - *(*float64)(unsafe.Pointer(bp)) = x + *(*float64)(unsafe.Pointer(bp)) = float64(float64(x)) v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: @@ -108952,7 +110002,7 @@ func Xlogf(tls *TLS, x float32) (r1 float32) { The ith subinterval contains z and c is near its center. */ tmp = ix - uint32(OFF1) i = int32(tmp >> (Int32FromInt32(23) - Int32FromInt32(LOGF_TABLE_BITS)) % uint32(Int32FromInt32(1)<> int32(23) /* arithmetic shift */ + k = int32(int32(tmp)) >> int32(23) /* arithmetic shift */ iz = ix - tmp&uint32(0xff800000) invc = (*(*struct { Finvc float64 @@ -108965,13 +110015,13 @@ func Xlogf(tls *TLS, x float32) (r1 float32) { z = float64(*(*float32)(unsafe.Pointer(&iz))) /* log(x) = log1p(z/c-1) + log(c) + k*Ln2 */ r = z*invc - Float64FromInt32(1) - y0 = logc + float64(k)*X__logf_data.Fln2 + y0 = logc + float64(float64(k))*X__logf_data.Fln2 /* Pipelined polynomial evaluation to approximate log1p(r). */ r2 = r * r y1 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__logf_data)) + 264 + 1*8))*r + *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__logf_data)) + 264 + 2*8)) y1 = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__logf_data)) + 264))*r2 + y1 y1 = y1*r2 + (y0 + r) - y = float32(y1) + y = float32(float32(y1)) v2 = y goto _3 _3: @@ -108992,7 +110042,7 @@ func Xlogl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xlog(tls, x) + return float64(Xlog(tls, float64(float64(x)))) } /* @@ -109041,7 +110091,7 @@ func Xlrintl(tls *TLS, x float64) (r int64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xlrint(tls, x) + return Xlrint(tls, float64(float64(x))) } func Xlround(tls *TLS, x float64) (r int64) { @@ -109099,21 +110149,21 @@ func Xmodf(tls *TLS, x float64, iptr uintptr) (r float64) { return x } p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p1))) & (Uint64FromUint64(1) << Int32FromInt32(63))) return *(*float64)(unsafe.Pointer(bp)) } /* no integral part*/ if e < 0 { p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p2))) & (Uint64FromUint64(1) << Int32FromInt32(63))) *(*float64)(unsafe.Pointer(iptr)) = *(*float64)(unsafe.Pointer(bp)) return x } - mask = -Uint64FromUint64(1) >> Int32FromInt32(12) >> e + mask = uint64(-Uint64FromUint64(1) >> Int32FromInt32(12) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&mask == uint64(0) { *(*float64)(unsafe.Pointer(iptr)) = x p3 = bp - *(*Tuint64_t)(unsafe.Pointer(p3)) = *(*Tuint64_t)(unsafe.Pointer(p3)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p3)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p3))) & (Uint64FromUint64(1) << Int32FromInt32(63))) return *(*float64)(unsafe.Pointer(bp)) } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^mask @@ -109180,8 +110230,8 @@ func Xmodfl(tls *TLS, x float64, iptr uintptr) (r1 float64) { var r float64 var _ /* d at bp+0 */ float64 _ = r - r = Xmodf(tls, x, bp) - *(*float64)(unsafe.Pointer(iptr)) = *(*float64)(unsafe.Pointer(bp)) + r = float64(Xmodf(tls, float64(float64(x)), bp)) + *(*float64)(unsafe.Pointer(iptr)) = float64(*(*float64)(unsafe.Pointer(bp))) return r } @@ -109255,6 +110305,7 @@ func Xnextafter(tls *TLS, x float64, y3 float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)< ay || (*(*Tuint64_t)(unsafe.Pointer(bp + 8))^*(*Tuint64_t)(unsafe.Pointer(bp + 16)))&(Uint64FromUint64(1)< ay || uint64(*(*Tuint64_t)(unsafe.Pointer(bp + 8))^*(*Tuint64_t)(unsafe.Pointer(bp + 16)))&(Uint64FromUint64(1)< uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = y3 v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -109413,7 +110465,7 @@ func Xnextafterl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xnextafter(tls, x, y) + return float64(Xnextafter(tls, float64(float64(x)), float64(float64(y)))) } func Xnexttoward(tls *TLS, x float64, y float64) (r float64) { @@ -109421,7 +110473,7 @@ func Xnexttoward(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xnextafter(tls, x, y) + return Xnextafter(tls, x, float64(float64(y))) } func Xnexttowardf(tls *TLS, x float32, y3 float64) (r float32) { @@ -109462,21 +110514,22 @@ func Xnexttowardf(tls *TLS, x float32, y3 float64) (r float32) { v1 = *(*uint32)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0; !v5 { - *(*float64)(unsafe.Pointer(bp + 8)) = y3 + *(*float64)(unsafe.Pointer(bp + 8)) = float64(float64(y3)) v3 = *(*uint64)(unsafe.Pointer(bp + 8)) goto _4 _4: } if v5 || BoolInt32(v3&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)<> (Int32FromInt32(52) - Int32FromInt32(POW_LOG_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> int32(52)) /* arithmetic shift */ + iz = uint64(uint64(uint64(ix)) - uint64(uint64(tmp))&(Uint64FromUint64(0xfff)< 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)< Int32FromInt32(0x3ff)+Int32FromInt32(52) { return int32(2) } - if iy&(uint64(1)<<(Int32FromInt32(0x3ff)+Int32FromInt32(52)-e)-uint64(1)) != 0 { + if uint64(uint64(iy))&(uint64(1)<<(Int32FromInt32(0x3ff)+Int32FromInt32(52)-e)-uint64(1)) != 0 { return 0 } - if iy&(uint64(1)<<(Int32FromInt32(0x3ff)+Int32FromInt32(52)-e)) != 0 { + if uint64(uint64(iy))&(uint64(1)<<(Int32FromInt32(0x3ff)+Int32FromInt32(52)-e)) != 0 { return int32(1) } return int32(2) @@ -109916,15 +110968,15 @@ func Xpow(tls *TLS, x float64, y1 float64) (r float64) { v15 = x * float64(4.503599627370496e+15) ix = *(*Tuint64_t)(unsafe.Pointer(&v15)) ix &= uint64(0x7fffffffffffffff) - ix = ix - Uint64FromUint64(52)<> (Int32FromInt32(23) - Int32FromInt32(POWF_LOG2_TABLE_BITS)) % uint32(Int32FromInt32(1)<> (Int32FromInt32(23) - Int32FromInt32(POWF_SCALE_BITS)) /* arithmetic shift */ + k = int32(int32(top)) >> (Int32FromInt32(23) - Int32FromInt32(POWF_SCALE_BITS)) /* arithmetic shift */ invc = (*(*struct { Finvc float64 Flogc float64 @@ -109989,7 +111042,7 @@ func _log2_inline(tls *TLS, ix Tuint32_t) (r1 Tdouble_t) { z = float64(*(*float32)(unsafe.Pointer(&iz))) /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ r = z*invc - Float64FromInt32(1) - y0 = logc + float64(k) + y0 = logc + float64(float64(k)) /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ r2 = r * r y = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__powf_log2_data)) + 256))*r + *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__powf_log2_data)) + 256 + 1*8)) @@ -110024,7 +111077,7 @@ _2: r = xd - kd /* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ t = *(*Tuint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__exp2f_data)) + uintptr(ki%uint64(Int32FromInt32(1)<>int32(47)&uint64(0xffff) >= *(*Tuint64_t)(unsafe.Pointer(&v6))>>int32(47) { @@ -110168,7 +111221,7 @@ func Xpowl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xpow(tls, x, y) + return float64(Xpow(tls, float64(float64(x)), float64(float64(y)))) } func Xremainder(tls *TLS, x float64, y float64) (r float64) { @@ -110214,7 +111267,7 @@ func Xremainderl(tls *TLS, x float64, y float64) (r float64) { trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) defer func() { trc("-> %v", r) }() } - return Xremainder(tls, x, y) + return float64(Xremainder(tls, float64(float64(x)), float64(float64(y)))) } func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { @@ -110287,13 +111340,14 @@ func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { } goto _4 _4: + ; ex-- i <<= uint64(1) } uxi <<= uint64(-ex + int32(1)) } else { - uxi = uxi & (-Uint64FromUint64(1) >> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uint64(uxi) | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(uint64(*(*Tuint64_t)(unsafe.Pointer(p6))) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= uint64(-ex + int32(1)) } @@ -110373,9 +111431,9 @@ end: } q &= uint32(0x7fffffff) if sx^sy != 0 { - v10 = -int32(q) + v10 = -int32(int32(q)) } else { - v10 = int32(q) + v10 = int32(int32(q)) } *(*int32)(unsafe.Pointer(quo)) = v10 if sx != 0 { @@ -110454,6 +111512,7 @@ func Xremquof(tls *TLS, x float32, y float32, quo uintptr) (r float32) { } goto _4 _4: + ; ex-- i <<= uint32(1) } @@ -110470,6 +111529,7 @@ func Xremquof(tls *TLS, x float32, y float32, quo uintptr) (r float32) { } goto _5 _5: + ; ey-- i <<= uint32(1) } @@ -110499,6 +111559,7 @@ func Xremquof(tls *TLS, x float32, y float32, quo uintptr) (r float32) { q <<= uint32(1) goto _6 _6: + ; ex-- } i = uxi - *(*Tuint32_t)(unsafe.Pointer(bp + 8)) @@ -110515,15 +111576,17 @@ func Xremquof(tls *TLS, x float32, y float32, quo uintptr) (r float32) { } goto _7 _7: + ; uxi <<= uint32(1) ex-- } } end: + ; /* scale result and decide between |x| and |x|-|y| */ if ex > 0 { uxi -= Uint32FromUint32(1) << Int32FromInt32(23) - uxi |= uint32(ex) << int32(23) + uxi |= uint32(uint32(ex)) << int32(23) } else { uxi >>= uint32(-ex + int32(1)) } @@ -110538,9 +111601,9 @@ end: } q &= uint32(0x7fffffff) if sx^sy != 0 { - v8 = -int32(q) + v8 = -int32(int32(q)) } else { - v8 = int32(q) + v8 = int32(int32(q)) } *(*int32)(unsafe.Pointer(quo)) = v8 if sx != 0 { @@ -110556,7 +111619,7 @@ func Xremquol(tls *TLS, x float64, y float64, quo uintptr) (r float64) { trc("tls=%v x=%v y=%v quo=%v, (%v:)", tls, x, y, quo, origin(2)) defer func() { trc("-> %v", r) }() } - return Xremquo(tls, x, y, quo) + return float64(Xremquo(tls, float64(float64(x)), float64(float64(y)), quo)) } const DBL_EPSILON9 = 2.220446049250313e-16 @@ -110663,7 +111726,7 @@ func Xrintl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xrint(tls, x) + return float64(Xrint(tls, float64(float64(x)))) } const DBL_EPSILON11 = 2.220446049250313e-16 @@ -110709,7 +111772,7 @@ func Xround(tls *TLS, x float64) (r float64) { if uint64(8) == uint64(8) { y1 = x + _toint6 } else { - y2 = x + _toint6 + y2 = float64(x + _toint6) } } return Float64FromInt32(0) * *(*float64)(unsafe.Pointer(bp)) @@ -110801,7 +111864,7 @@ func Xroundl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xround(tls, x) + return float64(Xround(tls, float64(float64(x)))) } func Xscalb(tls *TLS, x float64, fn float64) (r float64) { @@ -110822,6 +111885,7 @@ func Xscalb(tls *TLS, x float64, fn float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)< float64(65000) { return Xscalbn(tls, x, -int32(65000)) } - return Xscalbn(tls, x, int32(fn)) + return Xscalbn(tls, x, int32(int32(fn))) } func Xscalbf(tls *TLS, x float32, fn float32) (r float32) { @@ -110872,6 +111936,7 @@ func Xscalbf(tls *TLS, x float32, fn float32) (r float32) { v1 = *(*uint32)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = fn v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -110901,7 +111966,7 @@ _7: if -fn > Float32FromFloat32(65000) { return Xscalbnf(tls, x, -int32(65000)) } - return Xscalbnf(tls, x, int32(fn)) + return Xscalbnf(tls, x, int32(int32(fn))) } func Xscalbln(tls *TLS, x float64, n int64) (r float64) { @@ -110916,7 +111981,7 @@ func Xscalbln(tls *TLS, x float64, n int64) (r float64) { n = int64(-Int32FromInt32(1) - Int32FromInt32(0x7fffffff)) } } - return Xscalbn(tls, x, int32(n)) + return Xscalbn(tls, x, int32(int32(n))) } func Xscalblnf(tls *TLS, x float32, n int64) (r float32) { @@ -110931,7 +111996,7 @@ func Xscalblnf(tls *TLS, x float32, n int64) (r float32) { n = int64(-Int32FromInt32(1) - Int32FromInt32(0x7fffffff)) } } - return Xscalbnf(tls, x, int32(n)) + return Xscalbnf(tls, x, int32(int32(n))) } func Xscalblnl(tls *TLS, x float64, n int64) (r float64) { @@ -110939,7 +112004,7 @@ func Xscalblnl(tls *TLS, x float64, n int64) (r float64) { trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2)) defer func() { trc("-> %v", r) }() } - return Xscalbln(tls, x, n) + return float64(Xscalbln(tls, float64(float64(x)), n)) } func Xscalbn(tls *TLS, x float64, n int32) (r float64) { @@ -111033,7 +112098,7 @@ func Xscalbnl(tls *TLS, x float64, n int32) (r float64) { trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2)) defer func() { trc("-> %v", r) }() } - return Xscalbn(tls, x, n) + return float64(Xscalbn(tls, float64(float64(x)), n)) } func Xsignificand(tls *TLS, x float64) (r float64) { @@ -111093,7 +112158,7 @@ func Xsin(tls *TLS, x float64) (r float64) { } else { v3 = x + Float64FromFloat32(1.329227995784916e+36) } - y2 = v3 + y2 = float64(v3) } } return x @@ -111159,7 +112224,7 @@ func Xsincos(tls *TLS, x float64, sin uintptr, cos uintptr) { } else { v3 = x + Float64FromFloat32(1.329227995784916e+36) } - y2 = v3 + y2 = float64(v3) } } *(*float64)(unsafe.Pointer(sin)) = x @@ -111260,33 +112325,33 @@ func Xsincosf(tls *TLS, x float32, sin uintptr, cos uintptr) { *(*float32)(unsafe.Pointer(cos)) = Float32FromFloat32(1) return } - *(*float32)(unsafe.Pointer(sin)) = X__sindf(tls, float64(x)) - *(*float32)(unsafe.Pointer(cos)) = X__cosdf(tls, float64(x)) + *(*float32)(unsafe.Pointer(sin)) = X__sindf(tls, float64(float64(x))) + *(*float32)(unsafe.Pointer(cos)) = X__cosdf(tls, float64(float64(x))) return } /* |x| ~<= 5*pi/4 */ if ix <= uint32(0x407b53d1) { if ix <= uint32(0x4016cbe3) { /* |x| ~<= 3pi/4 */ if sign != 0 { - *(*float32)(unsafe.Pointer(sin)) = -X__cosdf(tls, float64(x)+_s1pio2) - *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, float64(x)+_s1pio2) + *(*float32)(unsafe.Pointer(sin)) = -X__cosdf(tls, float64(float64(x))+_s1pio2) + *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, float64(float64(x))+_s1pio2) } else { - *(*float32)(unsafe.Pointer(sin)) = X__cosdf(tls, _s1pio2-float64(x)) - *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, _s1pio2-float64(x)) + *(*float32)(unsafe.Pointer(sin)) = X__cosdf(tls, _s1pio2-float64(float64(x))) + *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, _s1pio2-float64(float64(x))) } return } /* -sin(x+c) is not correct if x+c could be 0: -0 vs +0 */ if sign != 0 { - v4 = float64(x) + _s2pio2 + v4 = float64(float64(x)) + _s2pio2 } else { - v4 = float64(x) - _s2pio2 + v4 = float64(float64(x)) - _s2pio2 } *(*float32)(unsafe.Pointer(sin)) = -X__sindf(tls, v4) if sign != 0 { - v5 = float64(x) + _s2pio2 + v5 = float64(float64(x)) + _s2pio2 } else { - v5 = float64(x) - _s2pio2 + v5 = float64(float64(x)) - _s2pio2 } *(*float32)(unsafe.Pointer(cos)) = -X__cosdf(tls, v5) return @@ -111295,24 +112360,24 @@ func Xsincosf(tls *TLS, x float32, sin uintptr, cos uintptr) { if ix <= uint32(0x40e231d5) { if ix <= uint32(0x40afeddf) { /* |x| ~<= 7*pi/4 */ if sign != 0 { - *(*float32)(unsafe.Pointer(sin)) = X__cosdf(tls, float64(x)+_s3pio2) - *(*float32)(unsafe.Pointer(cos)) = -X__sindf(tls, float64(x)+_s3pio2) + *(*float32)(unsafe.Pointer(sin)) = X__cosdf(tls, float64(float64(x))+_s3pio2) + *(*float32)(unsafe.Pointer(cos)) = -X__sindf(tls, float64(float64(x))+_s3pio2) } else { - *(*float32)(unsafe.Pointer(sin)) = -X__cosdf(tls, float64(x)-_s3pio2) - *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, float64(x)-_s3pio2) + *(*float32)(unsafe.Pointer(sin)) = -X__cosdf(tls, float64(float64(x))-_s3pio2) + *(*float32)(unsafe.Pointer(cos)) = X__sindf(tls, float64(float64(x))-_s3pio2) } return } if sign != 0 { - v6 = float64(x) + _s4pio2 + v6 = float64(float64(x)) + _s4pio2 } else { - v6 = float64(x) - _s4pio2 + v6 = float64(float64(x)) - _s4pio2 } *(*float32)(unsafe.Pointer(sin)) = X__sindf(tls, v6) if sign != 0 { - v7 = float64(x) + _s4pio2 + v7 = float64(float64(x)) + _s4pio2 } else { - v7 = float64(x) - _s4pio2 + v7 = float64(float64(x)) - _s4pio2 } *(*float32)(unsafe.Pointer(cos)) = X__cosdf(tls, v7) return @@ -111357,9 +112422,9 @@ func Xsincosl(tls *TLS, x float64, sin uintptr, cos uintptr) { defer tls.Free(16) var _ /* cosd at bp+8 */ float64 var _ /* sind at bp+0 */ float64 - Xsincos(tls, x, bp, bp+8) - *(*float64)(unsafe.Pointer(sin)) = *(*float64)(unsafe.Pointer(bp)) - *(*float64)(unsafe.Pointer(cos)) = *(*float64)(unsafe.Pointer(bp + 8)) + Xsincos(tls, float64(float64(x)), bp, bp+8) + *(*float64)(unsafe.Pointer(sin)) = float64(*(*float64)(unsafe.Pointer(bp))) + *(*float64)(unsafe.Pointer(cos)) = float64(*(*float64)(unsafe.Pointer(bp + 8))) } const M_PI_27 = 1.5707963267948966 @@ -111418,35 +112483,35 @@ func Xsinf(tls *TLS, x float32) (r float32) { } return x } - return X__sindf(tls, float64(x)) + return X__sindf(tls, float64(float64(x))) } if ix <= uint32(0x407b53d1) { /* |x| ~<= 5*pi/4 */ if ix <= uint32(0x4016cbe3) { /* |x| ~<= 3pi/4 */ if sign != 0 { - return -X__cosdf(tls, float64(x)+_s1pio21) + return -X__cosdf(tls, float64(float64(x))+_s1pio21) } else { - return X__cosdf(tls, float64(x)-_s1pio21) + return X__cosdf(tls, float64(float64(x))-_s1pio21) } } if sign != 0 { - v4 = -(float64(x) + _s2pio21) + v4 = -(float64(float64(x)) + _s2pio21) } else { - v4 = -(float64(x) - _s2pio21) + v4 = -(float64(float64(x)) - _s2pio21) } return X__sindf(tls, v4) } if ix <= uint32(0x40e231d5) { /* |x| ~<= 9*pi/4 */ if ix <= uint32(0x40afeddf) { /* |x| ~<= 7*pi/4 */ if sign != 0 { - return X__cosdf(tls, float64(x)+_s3pio21) + return X__cosdf(tls, float64(float64(x))+_s3pio21) } else { - return -X__cosdf(tls, float64(x)-_s3pio21) + return -X__cosdf(tls, float64(float64(x))-_s3pio21) } } if sign != 0 { - v5 = float64(x) + _s4pio21 + v5 = float64(float64(x)) + _s4pio21 } else { - v5 = float64(x) - _s4pio21 + v5 = float64(float64(x)) - _s4pio21 } return X__sindf(tls, v5) } @@ -111578,7 +112643,7 @@ func Xsinhl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xsinh(tls, x) + return float64(Xsinh(tls, float64(float64(x)))) } func Xsinl(tls *TLS, x float64) (r float64) { @@ -111586,7 +112651,7 @@ func Xsinl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xsin(tls, x) + return float64(Xsin(tls, float64(float64(x)))) } const FENV_SUPPORT = 1 @@ -111595,7 +112660,7 @@ const FENV_SUPPORT = 1 // // /* returns a*b*2^-32 - e, with error 0 <= e < 1. */ func _mul32(tls *TLS, a Tuint32_t, b Tuint32_t) (r Tuint32_t) { - return uint32(uint64(a) * uint64(b) >> int32(32)) + return uint32(uint64(uint64(a)) * uint64(uint64(b)) >> int32(32)) } // C documentation @@ -111654,17 +112719,17 @@ func Xsqrt(tls *TLS, x float64) (r1 float64) { i = ix >> Int32FromInt32(46) % uint64(128) r = uint64(uint32(X__rsqrt_tab[i]) << int32(16)) /* |r sqrt(m) - 1| < 0x1.fdp-9 */ - s = uint64(_mul32(tls, uint32(m>>int32(32)), uint32(r))) + s = uint64(_mul32(tls, uint32(m>>int32(32)), uint32(uint32(r)))) /* |s/sqrt(m) - 1| < 0x1.fdp-9 */ - d = uint64(_mul32(tls, uint32(s), uint32(r))) + d = uint64(_mul32(tls, uint32(uint32(s)), uint32(uint32(r)))) u = _three - d - r = uint64(_mul32(tls, uint32(r), uint32(u)) << int32(1)) + r = uint64(_mul32(tls, uint32(uint32(r)), uint32(uint32(u))) << int32(1)) /* |r sqrt(m) - 1| < 0x1.7bp-16 */ - s = uint64(_mul32(tls, uint32(s), uint32(u)) << int32(1)) + s = uint64(_mul32(tls, uint32(uint32(s)), uint32(uint32(u))) << int32(1)) /* |s/sqrt(m) - 1| < 0x1.7bp-16 */ - d = uint64(_mul32(tls, uint32(s), uint32(r))) + d = uint64(_mul32(tls, uint32(uint32(s)), uint32(uint32(r)))) u = _three - d - r = uint64(_mul32(tls, uint32(r), uint32(u)) << int32(1)) + r = uint64(_mul32(tls, uint32(uint32(r)), uint32(uint32(u))) << int32(1)) /* |r sqrt(m) - 1| < 0x1.3704p-29 (measured worst-case) */ r = r << int32(32) s = _mul64(tls, m, r) @@ -111758,7 +112823,7 @@ func Xsqrt(tls *TLS, x float64) (r1 float64) { var _three = uint64(0xc0000000) func _mul321(tls *TLS, a Tuint32_t, b Tuint32_t) (r Tuint32_t) { - return uint32(uint64(a) * uint64(b) >> int32(32)) + return uint32(uint64(uint64(a)) * uint64(uint64(b)) >> int32(32)) } /* see sqrt.c for more detailed comments. */ @@ -111854,7 +112919,7 @@ func Xsqrtl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xsqrt(tls, x) + return float64(Xsqrt(tls, float64(float64(x)))) } func Xtan(tls *TLS, x float64) (r float64) { @@ -111897,7 +112962,7 @@ func Xtan(tls *TLS, x float64) (r float64) { } else { v3 = x + Float64FromFloat32(1.329227995784916e+36) } - y2 = v3 + y2 = float64(v3) } } return x @@ -111969,21 +113034,21 @@ func Xtanf(tls *TLS, x float32) (r float32) { } return x } - return X__tandf(tls, float64(x), 0) + return X__tandf(tls, float64(float64(x)), 0) } if ix <= uint32(0x407b53d1) { /* |x| ~<= 5*pi/4 */ if ix <= uint32(0x4016cbe3) { /* |x| ~<= 3pi/4 */ if sign != 0 { - v4 = float64(x) + _t1pio2 + v4 = float64(float64(x)) + _t1pio2 } else { - v4 = float64(x) - _t1pio2 + v4 = float64(float64(x)) - _t1pio2 } return X__tandf(tls, v4, int32(1)) } else { if sign != 0 { - v5 = float64(x) + _t2pio2 + v5 = float64(float64(x)) + _t2pio2 } else { - v5 = float64(x) - _t2pio2 + v5 = float64(float64(x)) - _t2pio2 } return X__tandf(tls, v5, 0) } @@ -111991,16 +113056,16 @@ func Xtanf(tls *TLS, x float32) (r float32) { if ix <= uint32(0x40e231d5) { /* |x| ~<= 9*pi/4 */ if ix <= uint32(0x40afeddf) { /* |x| ~<= 7*pi/4 */ if sign != 0 { - v6 = float64(x) + _t3pio2 + v6 = float64(float64(x)) + _t3pio2 } else { - v6 = float64(x) - _t3pio2 + v6 = float64(float64(x)) - _t3pio2 } return X__tandf(tls, v6, int32(1)) } else { if sign != 0 { - v7 = float64(x) + _t4pio2 + v7 = float64(float64(x)) + _t4pio2 } else { - v7 = float64(x) - _t4pio2 + v7 = float64(float64(x)) - _t4pio2 } return X__tandf(tls, v7, 0) } @@ -112076,12 +113141,12 @@ func Xtanh(tls *TLS, x float64) (r float64) { /* |x| is subnormal */ /* note: the branch above would not raise underflow in [0x1p-1023,0x1p-1022) */ if uint64(4) == uint64(4) { - y = float32(x) + y = float32(float32(x)) } else { if uint64(4) == uint64(8) { - y1 = float64(float32(x)) + y1 = float64(float32(float32(x))) } else { - y2 = float64(float32(x)) + y2 = float64(float32(float32(x))) } } t = x @@ -112172,7 +113237,7 @@ func Xtanhl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xtanh(tls, x) + return float64(Xtanh(tls, float64(float64(x)))) } func Xtanl(tls *TLS, x float64) (r float64) { @@ -112180,10 +113245,10 @@ func Xtanl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xtan(tls, x) + return float64(Xtan(tls, float64(float64(x)))) } -const N11 = 12 +const N10 = 12 var _pi4 = float64(3.141592653589793) @@ -112200,7 +113265,7 @@ func _sinpi(tls *TLS, x float64) (r float64) { /* reduce x into [-.25,.25] */ n = int32(Float64FromInt32(4) * x) n = (n + int32(1)) / int32(2) - x -= float64(n) * float64(0.5) + x -= float64(float64(n)) * float64(0.5) x *= _pi4 switch n { default: /* case 4 */ @@ -112291,7 +113356,7 @@ func _S(tls *TLS, x float64) (r float64) { den = Float64FromInt32(0) /* to avoid overflow handle large x differently */ if x < Float64FromInt32(8) { - i = int32(N11) + i = int32(N10) for { if !(i >= 0) { break @@ -112300,18 +113365,20 @@ func _S(tls *TLS, x float64) (r float64) { den = den*x + _Sden[i] goto _1 _1: + ; i-- } } else { i = 0 for { - if !(i <= int32(N11)) { + if !(i <= int32(N10)) { break } num = num/x + _Snum[i] den = den/x + _Sden[i] goto _2 _2: + ; i++ } } @@ -112361,7 +113428,7 @@ func Xtgamma(tls *TLS, x float64) (r1 float64) { return Float64FromInt32(0) / Float64FromFloat64(0) } if x <= float64(Uint64FromInt64(184)/Uint64FromInt64(8)) { - return _fact[int32(x)-int32(1)] + return _fact[int32(int32(x))-int32(1)] } } /* x >= 172: tgamma(x)=inf with overflow */ @@ -112420,7 +113487,7 @@ func Xtgammaf(tls *TLS, x float32) (r float32) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return float32(Xtgamma(tls, float64(x))) + return float32(Xtgamma(tls, float64(float64(x)))) } func Xtgammal(tls *TLS, x float64) (r float64) { @@ -112428,7 +113495,7 @@ func Xtgammal(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xtgamma(tls, x) + return float64(Xtgamma(tls, float64(float64(x)))) } func Xtrunc(tls *TLS, x float64) (r float64) { @@ -112462,7 +113529,7 @@ func Xtrunc(tls *TLS, x float64) (r float64) { if e < int32(12) { e = int32(1) } - m = -Uint64FromUint64(1) >> e + m = uint64(-Uint64FromUint64(1) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&m == uint64(0) { return x } @@ -112472,7 +113539,7 @@ func Xtrunc(tls *TLS, x float64) (r float64) { if uint64(8) == uint64(8) { y1 = x + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x + Float64FromFloat32(1.329227995784916e+36)) } } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^m @@ -112532,7 +113599,7 @@ func Xtruncl(tls *TLS, x float64) (r float64) { trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) defer func() { trc("-> %v", r) }() } - return Xtrunc(tls, x) + return float64(Xtrunc(tls, float64(float64(x)))) } var _digits = [65]int8{'.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'} @@ -112556,13 +113623,14 @@ func Xa64l(tls *TLS, s uintptr) (r int64) { if !(d != 0) { break } - x |= uint32(int64(d)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits)))) << e + x |= uint32(int64(int64(d))-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits)))) << e goto _1 _1: + ; e += int32(6) s++ } - return int64(int32(x)) + return int64(int32(int32(x))) } func Xl64a(tls *TLS, x0 int64) (r uintptr) { @@ -112573,7 +113641,7 @@ func Xl64a(tls *TLS, x0 int64) (r uintptr) { var p uintptr var x Tuint32_t _, _ = p, x - x = uint32(x0) + x = uint32(uint32(x0)) p = uintptr(unsafe.Pointer(&_s)) for { if !(x != 0) { @@ -112582,6 +113650,7 @@ func Xl64a(tls *TLS, x0 int64) (r uintptr) { *(*int8)(unsafe.Pointer(p)) = _digits[x&uint32(63)] goto _1 _1: + ; p++ x >>= uint32(6) } @@ -112599,7 +113668,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { var i Tsize_t _ = i if !(s != 0) || !(*(*int8)(unsafe.Pointer(s)) != 0) { - return __ccgo_ts + 537 + return __ccgo_ts + 575 } i = Xstrlen(tls, s) - uint64(1) for { @@ -112609,6 +113678,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(s + uintptr(i))) = 0 goto _1 _1: + ; i-- } for { @@ -112617,6 +113687,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { } goto _2 _2: + ; i-- } return s + uintptr(i) @@ -112638,7 +113709,7 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { var i Tsize_t _ = i if !(s != 0) || !(*(*int8)(unsafe.Pointer(s)) != 0) { - return __ccgo_ts + 537 + return __ccgo_ts + 575 } i = Xstrlen(tls, s) - uint64(1) for { @@ -112646,10 +113717,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 549 + return __ccgo_ts + 587 } goto _1 _1: + ; i-- } for { @@ -112657,10 +113729,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 537 + return __ccgo_ts + 575 } goto _2 _2: + ; i-- } for { @@ -112668,10 +113741,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 549 + return __ccgo_ts + 587 } goto _3 _3: + ; i-- } *(*int8)(unsafe.Pointer(s + uintptr(i+uint64(1)))) = 0 @@ -112686,7 +113760,7 @@ func Xffs(tls *TLS, i int32) (r int32) { var v1 int32 _ = v1 if i != 0 { - v1 = _a_ctz_l(tls, uint64(i)) + int32(1) + v1 = _a_ctz_l(tls, uint64(uint64(i))) + int32(1) } else { v1 = 0 } @@ -112701,7 +113775,7 @@ func Xffsl(tls *TLS, i int64) (r int32) { var v1 int32 _ = v1 if i != 0 { - v1 = _a_ctz_l(tls, uint64(i)) + int32(1) + v1 = _a_ctz_l(tls, uint64(uint64(i))) + int32(1) } else { v1 = 0 } @@ -112717,9 +113791,9 @@ func Xffsll(tls *TLS, i int64) (r int32) { var v2 Tuint64_t _, _, _ = v1, v2, v3 if i != 0 { - v2 = uint64(i) + v2 = uint64(uint64(i)) // __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 114, __ccgo_ts+551) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 114, __ccgo_ts+589) v3 = int32(v2) goto _4 _4: @@ -112786,33 +113860,33 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text ret = 0 verb = 0 errstring = uintptr(MM_NULLSEV) - cmsg = Xgetenv(tls, __ccgo_ts+557) + cmsg = Xgetenv(tls, __ccgo_ts+595) msgs = [6]uintptr{ - 0: __ccgo_ts + 565, - 1: __ccgo_ts + 571, - 2: __ccgo_ts + 580, - 3: __ccgo_ts + 585, - 4: __ccgo_ts + 592, + 0: __ccgo_ts + 603, + 1: __ccgo_ts + 609, + 2: __ccgo_ts + 618, + 3: __ccgo_ts + 623, + 4: __ccgo_ts + 630, 5: UintptrFromInt32(0), } _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp) if severity == int32(MM_HALT) { - errstring = __ccgo_ts + 596 + errstring = __ccgo_ts + 634 } else { if severity == int32(MM_ERROR) { - errstring = __ccgo_ts + 603 + errstring = __ccgo_ts + 641 } else { if severity == int32(MM_WARNING) { - errstring = __ccgo_ts + 611 + errstring = __ccgo_ts + 649 } else { if severity == int32(MM_INFO) { - errstring = __ccgo_ts + 621 + errstring = __ccgo_ts + 659 } } } } if classification&int64(MM_CONSOLE) != 0 { - consolefd = Xopen(tls, __ccgo_ts+628, int32(O_WRONLY), 0) + consolefd = Xopen(tls, __ccgo_ts+666, int32(O_WRONLY), 0) if consolefd < 0 { ret = int32(MM_NOCON) } else { @@ -112822,7 +113896,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v1 = __ccgo_ts } if label != 0 { - v2 = __ccgo_ts + 641 + v2 = __ccgo_ts + 355 } else { v2 = __ccgo_ts } @@ -112837,7 +113911,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v4 = __ccgo_ts } if action != 0 { - v5 = __ccgo_ts + 644 + v5 = __ccgo_ts + 679 } else { v5 = __ccgo_ts } @@ -112847,7 +113921,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v6 = __ccgo_ts } if action != 0 { - v7 = __ccgo_ts + 654 + v7 = __ccgo_ts + 689 } else { v7 = __ccgo_ts } @@ -112856,7 +113930,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } else { v8 = __ccgo_ts } - if Xdprintf(tls, consolefd, __ccgo_ts+656, VaList(bp+16, v1, v2, v3, v4, v5, v6, v7, v8)) < int32(1) { + if Xdprintf(tls, consolefd, __ccgo_ts+691, VaList(bp+16, v1, v2, v3, v4, v5, v6, v7, v8)) < int32(1) { ret = int32(MM_NOCON) } Xclose(tls, consolefd) @@ -112874,6 +113948,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } goto _9 _9: + ; i++ } if msgs[i] == UintptrFromInt32(0) { @@ -112897,7 +113972,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v10 = __ccgo_ts } if verb&int32(1) != 0 && label != 0 { - v11 = __ccgo_ts + 641 + v11 = __ccgo_ts + 355 } else { v11 = __ccgo_ts } @@ -112912,7 +113987,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v13 = __ccgo_ts } if verb&int32(8) != 0 && action != 0 { - v14 = __ccgo_ts + 644 + v14 = __ccgo_ts + 679 } else { v14 = __ccgo_ts } @@ -112922,7 +113997,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v15 = __ccgo_ts } if verb&int32(8) != 0 && action != 0 { - v16 = __ccgo_ts + 654 + v16 = __ccgo_ts + 689 } else { v16 = __ccgo_ts } @@ -112931,7 +114006,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } else { v17 = __ccgo_ts } - if Xdprintf(tls, int32(2), __ccgo_ts+656, VaList(bp+16, v10, v11, v12, v13, v14, v15, v16, v17)) < int32(1) { + if Xdprintf(tls, int32(2), __ccgo_ts+691, VaList(bp+16, v10, v11, v12, v13, v14, v15, v16, v17)) < int32(1) { ret |= int32(MM_NOMSG) } } @@ -112953,8 +114028,8 @@ func Xget_current_dir_name(tls *TLS) (r uintptr) { var _ /* a at bp+0 */ Tstat var _ /* b at bp+144 */ Tstat _ = res - res = Xgetenv(tls, __ccgo_ts+674) - if res != 0 && *(*int8)(unsafe.Pointer(res)) != 0 && !(Xstat(tls, res, bp) != 0) && !(Xstat(tls, __ccgo_ts+537, bp+144) != 0) && (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev == (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_dev && (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino == (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_ino { + res = Xgetenv(tls, __ccgo_ts+709) + if res != 0 && *(*int8)(unsafe.Pointer(res)) != 0 && !(Xstat(tls, res, bp) != 0) && !(Xstat(tls, __ccgo_ts+575, bp+144) != 0) && (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev == (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_dev && (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino == (*(*Tstat)(unsafe.Pointer(bp + 144))).Fst_ino { return Xstrdup(tls, res) } return Xgetcwd(tls, uintptr(0), uint64(0)) @@ -112980,6 +114055,7 @@ func X__getauxval(tls *TLS, item uint64) (r uint64) { } goto _1 _1: + ; auxv += uintptr(2) * 8 } *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOENT) @@ -113048,7 +114124,7 @@ func Xgetentropy(tls *TLS, buffer uintptr, len1 Tsize_t) (r int32) { } } pos += uintptr(ret) - len1 -= uint64(ret) + len1 -= uint64(uint64(ret)) ret = 0 } _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp)), uintptr(0)) @@ -113164,7 +114240,7 @@ func Xgetopt(tls *TLS, argc int32, argv uintptr, optstring uintptr) (r int32) { if *(*Twchar_t)(unsafe.Pointer(bp + 4)) != *(*Twchar_t)(unsafe.Pointer(bp)) || *(*Twchar_t)(unsafe.Pointer(bp)) == int32(':') { Xoptopt = *(*Twchar_t)(unsafe.Pointer(bp)) if int32(*(*int8)(unsafe.Pointer(optstring))) != int32(':') && Xopterr != 0 { - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+678, optchar, uint64(k)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+713, optchar, uint64(uint64(k))) } return int32('?') } @@ -113185,7 +114261,7 @@ func Xgetopt(tls *TLS, argc int32, argv uintptr, optstring uintptr) (r int32) { return int32(':') } if Xopterr != 0 { - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+702, optchar, uint64(k)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+737, optchar, uint64(uint64(k))) } return int32('?') } @@ -113226,6 +114302,7 @@ func _permute(tls *TLS, argv uintptr, dest int32, src int32) { *(*uintptr)(unsafe.Pointer(av + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(av + uintptr(i-int32(1))*8)) goto _1 _1: + ; i-- } *(*uintptr)(unsafe.Pointer(av + uintptr(dest)*8)) = tmp @@ -113254,6 +114331,7 @@ func ___getopt_long(tls *TLS, argc int32, argv uintptr, optstring uintptr, longo } goto _1 _1: + ; i++ } Xoptind = i @@ -113270,6 +114348,7 @@ func ___getopt_long(tls *TLS, argc int32, argv uintptr, optstring uintptr, longo _permute(tls, argv, skipped, Xoptind-int32(1)) goto _2 _2: + ; i1++ } Xoptind = skipped + cnt @@ -113313,10 +114392,11 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, cnt++ goto _1 _1: + ; i++ } - if cnt == int32(1) && longonly != 0 && int64(arg)-int64(start) == int64(Xmblen(tls, start, uint64(MB_LEN_MAX))) { - l = int32(int64(arg) - int64(start)) + if cnt == int32(1) && longonly != 0 && int64(int64(arg))-int64(int64(start)) == int64(Xmblen(tls, start, uint64(MB_LEN_MAX))) { + l = int32(int64(int64(arg)) - int64(int64(start))) i = 0 for { if !(*(*int8)(unsafe.Pointer(optstring + uintptr(i))) != 0) { @@ -113329,6 +114409,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, } goto _4 _4: + ; j++ } if j == l { @@ -113337,6 +114418,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, } goto _3 _3: + ; i++ } } @@ -113350,7 +114432,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, if colon != 0 || !(Xopterr != 0) { return int32('?') } - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+734, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+769, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) return int32('?') } Xoptarg = opt + uintptr(1) @@ -113366,7 +114448,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, if !(Xopterr != 0) { return int32('?') } - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+702, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+737, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) return int32('?') } Xoptind++ @@ -113385,9 +114467,9 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, Xoptopt = 0 if !(colon != 0) && Xopterr != 0 { if cnt != 0 { - v6 = __ccgo_ts + 771 + v6 = __ccgo_ts + 806 } else { - v6 = __ccgo_ts + 678 + v6 = __ccgo_ts + 713 } X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), v6, *(*uintptr)(unsafe.Pointer(argv + uintptr(Xoptind)*8))+uintptr(2), Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(Xoptind)*8))+uintptr(2))) } @@ -113473,13 +114555,13 @@ func Xgetrlimit(tls *TLS, resource int32, rlim uintptr) (r int32) { if (*(*[2]uint64)(unsafe.Pointer(bp)))[0] == -Uint64FromUint64(1) { v1 = ^Uint64FromUint64(0) } else { - v1 = (*(*[2]uint64)(unsafe.Pointer(bp)))[0] + v1 = uint64((*(*[2]uint64)(unsafe.Pointer(bp)))[0]) } (*Trlimit)(unsafe.Pointer(rlim)).Frlim_cur = v1 if (*(*[2]uint64)(unsafe.Pointer(bp)))[int32(1)] == -Uint64FromUint64(1) { v2 = ^Uint64FromUint64(0) } else { - v2 = (*(*[2]uint64)(unsafe.Pointer(bp)))[int32(1)] + v2 = uint64((*(*[2]uint64)(unsafe.Pointer(bp)))[int32(1)]) } (*Trlimit)(unsafe.Pointer(rlim)).Frlim_max = v2 if (*Trlimit)(unsafe.Pointer(rlim)).Frlim_cur >= ^Uint64FromUint64(0) { @@ -113515,7 +114597,7 @@ func Xgetrusage(tls *TLS, who int32, ru uintptr) (r1 int32) { Ftv_usec: (*(*[4]int64)(unsafe.Pointer(bp)))[int32(3)], } } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xgetsubopt(tls *TLS, opt uintptr, keys uintptr, val uintptr) (r int32) { @@ -113557,6 +114639,7 @@ func Xgetsubopt(tls *TLS, opt uintptr, keys uintptr, val uintptr) (r int32) { return i goto _3 _3: + ; i++ } return -int32(1) @@ -113841,9 +114924,9 @@ func _convert_ioctl_struct(tls *TLS, map1 uintptr, old uintptr, new1 uintptr, di ts_offset = int32(*(*uint8)(unsafe.Pointer(map1 + 12 + uintptr(i)))) len1 = ts_offset - old_offset if dir == int32(W) { - Xmemcpy(tls, old+uintptr(old_offset), new1+uintptr(new_offset), uint64(len1)) + Xmemcpy(tls, old+uintptr(old_offset), new1+uintptr(new_offset), uint64(uint64(len1))) } else { - Xmemcpy(tls, new1+uintptr(new_offset), old+uintptr(old_offset), uint64(len1)) + Xmemcpy(tls, new1+uintptr(new_offset), old+uintptr(old_offset), uint64(uint64(len1))) } new_offset += len1 old_offset += len1 @@ -113856,17 +114939,18 @@ func _convert_ioctl_struct(tls *TLS, map1 uintptr, old uintptr, new1 uintptr, di new_offset += (align - int32(1)) & -new_offset if dir == int32(W) { Xmemcpy(tls, bp, new1+uintptr(new_offset), uint64(8)) - *(*int64)(unsafe.Pointer(bp + 8)) = *(*int64)(unsafe.Pointer(bp)) + *(*int64)(unsafe.Pointer(bp + 8)) = int64(*(*int64)(unsafe.Pointer(bp))) Xmemcpy(tls, old+uintptr(old_offset), bp+8, uint64(8)) } else { Xmemcpy(tls, bp+8, old+uintptr(old_offset), uint64(8)) - *(*int64)(unsafe.Pointer(bp)) = *(*int64)(unsafe.Pointer(bp + 8)) + *(*int64)(unsafe.Pointer(bp)) = int64(*(*int64)(unsafe.Pointer(bp + 8))) Xmemcpy(tls, new1+uintptr(new_offset), bp, uint64(8)) } new_offset = int32(uint64(new_offset) + Uint64FromInt64(8)) old_offset = int32(uint64(old_offset) + Uint64FromInt64(8)) goto _1 _1: + ; i++ } if dir == int32(W) { @@ -113899,7 +114983,7 @@ func Xioctl(tls *TLS, fd int32, req int32, va uintptr) (r1 int32) { if Bool(Bool(int32(SIOCGSTAMP) != int32(SIOCGSTAMP_OLD)) && req != 0) && r == -int32(ENOTTY) { i = 0 for { - if !(uint64(i) < Uint64FromInt64(400)/Uint64FromInt64(20)) { + if !(uint64(uint64(i)) < Uint64FromInt64(400)/Uint64FromInt64(20)) { break } if _compat_map[i].Fnew_req != req { @@ -113914,10 +114998,11 @@ func Xioctl(tls *TLS, fd int32, req int32, va uintptr) (r1 int32) { break goto _1 _1: + ; i++ } } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xissetugid(tls *TLS) (r int32) { @@ -113938,7 +115023,7 @@ func Xlockf(tls *TLS, fd int32, op int32, size Toff_t) (r int32) { var _ /* l at bp+0 */ Tflock *(*Tflock)(unsafe.Pointer(bp)) = Tflock{ Fl_type: int16(F_WRLCK), - Fl_whence: int16(SEEK_CUR), + Fl_whence: int16(1), Fl_len: size, } switch op { @@ -113965,15 +115050,6 @@ func Xlockf(tls *TLS, fd int32, op int32, size Toff_t) (r int32) { } const ACCOUNTING = 9 -const BOOT_TIME = 2 -const DEAD_PROCESS = 8 -const EMPTY = 0 -const INIT_PROCESS = 5 -const LOGIN_PROCESS = 6 -const NEW_TIME = 3 -const OLD_TIME = 4 -const RUN_LVL = 1 -const USER_PROCESS = 7 const UTMP_FILE = "_PATH_UTMP" const UTMP_FILENAME = "_PATH_UTMP" const UT_HOSTSIZE = 256 @@ -113983,30 +115059,9 @@ const WTMP_FILE = "_PATH_WTMP" const WTMP_FILENAME = "_PATH_WTMP" const _PATH_UTMP = "/dev/null/utmp" const _PATH_WTMP = "/dev/null/wtmp" -const e_exit = 0 -const e_termination = 0 const ut_name = 0 const utmp = 0 -type Tutmpx = struct { - Fut_type int16 - F__ut_pad1 int16 - Fut_pid Tpid_t - Fut_line [32]int8 - Fut_id [4]int8 - Fut_user [32]int8 - Fut_host [256]int8 - Fut_exit struct { - F__e_termination int16 - F__e_exit int16 - } - Fut_session int32 - F__ut_pad2 int32 - Fut_tv Ttimeval - Fut_addr_v6 [4]uint32 - F__unused [20]int8 -} - type Tlastlog = struct { Fll_time Ttime_t Fll_line [32]int8 @@ -114127,12 +115182,13 @@ func _unescape_ent(tls *TLS, beg uintptr) (r uintptr) { } goto _5 _5: + ; i++ } if cval != 0 { v7 = dest dest++ - *(*int8)(unsafe.Pointer(v7)) = int8(cval) + *(*int8)(unsafe.Pointer(v7)) = int8(int8(cval)) src = val } else { v8 = dest @@ -114171,7 +115227,7 @@ func Xgetmntent_r(tls *TLS, f uintptr, mnt uintptr, linebuf uintptr, buflen int3 return uintptr(0) } if !(Xstrchr(tls, linebuf, int32('\n')) != 0) { - Xfscanf(tls, f, __ccgo_ts+795, 0) + Xfscanf(tls, f, __ccgo_ts+830, 0) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) return uintptr(0) } @@ -114184,12 +115240,13 @@ func Xgetmntent_r(tls *TLS, f uintptr, mnt uintptr, linebuf uintptr, buflen int3 if !(i < Uint64FromInt64(32)/Uint64FromInt64(4)) { break } - (*(*[8]int32)(unsafe.Pointer(bp)))[i] = int32(len1) + (*(*[8]int32)(unsafe.Pointer(bp)))[i] = int32(int32(len1)) goto _1 _1: + ; i++ } - Xsscanf(tls, linebuf, __ccgo_ts+807, VaList(bp+40, bp, bp+uintptr(1)*4, bp+uintptr(2)*4, bp+uintptr(3)*4, bp+uintptr(4)*4, bp+uintptr(5)*4, bp+uintptr(6)*4, bp+uintptr(7)*4, mnt+32, mnt+36)) + Xsscanf(tls, linebuf, __ccgo_ts+842, VaList(bp+40, bp, bp+uintptr(1)*4, bp+uintptr(2)*4, bp+uintptr(3)*4, bp+uintptr(4)*4, bp+uintptr(5)*4, bp+uintptr(6)*4, bp+uintptr(7)*4, mnt+32, mnt+36)) } *(*int8)(unsafe.Pointer(linebuf + uintptr((*(*[8]int32)(unsafe.Pointer(bp)))[int32(1)]))) = 0 *(*int8)(unsafe.Pointer(linebuf + uintptr((*(*[8]int32)(unsafe.Pointer(bp)))[int32(3)]))) = 0 @@ -114219,10 +115276,10 @@ func Xaddmntent(tls *TLS, f uintptr, mnt uintptr) (r int32) { } bp := tls.Alloc(64) defer tls.Free(64) - if Xfseek(tls, f, 0, int32(SEEK_END)) != 0 { + if Xfseek(tls, f, 0, int32(2)) != 0 { return int32(1) } - return BoolInt32(Xfprintf(tls, f, __ccgo_ts+862, VaList(bp+8, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_fsname, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_dir, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_type, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_freq, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_passno)) < 0) + return BoolInt32(Xfprintf(tls, f, __ccgo_ts+897, VaList(bp+8, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_fsname, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_dir, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_type, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_freq, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_passno)) < 0) } func Xhasmntopt(tls *TLS, mnt uintptr, opt uintptr) (r uintptr) { @@ -114233,23 +115290,6 @@ func Xhasmntopt(tls *TLS, mnt uintptr, opt uintptr) (r uintptr) { return Xstrstr(tls, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, opt) } -const FTW_CHDIR = 4 -const FTW_D = 2 -const FTW_DEPTH = 8 -const FTW_DNR = 3 -const FTW_DP = 6 -const FTW_F = 1 -const FTW_MOUNT = 2 -const FTW_NS = 4 -const FTW_PHYS = 1 -const FTW_SL = 5 -const FTW_SLN = 7 - -type TFTW = struct { - Fbase int32 - Flevel int32 -} - type Thistory = struct { Fchain uintptr Fdev Tdev_t @@ -114339,6 +115379,7 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _5 _5: + ; k-- } for { @@ -114347,9 +115388,10 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _6 _6: + ; k-- } - (*(*TFTW)(unsafe.Pointer(bp + 176))).Fbase = int32(k) + (*(*TFTW)(unsafe.Pointer(bp + 176))).Fbase = int32(int32(k)) } if type1 == int32(FTW_D) || type1 == int32(FTW_DP) { dfd = Xopen(tls, path, O_RDONLY, 0) @@ -114377,6 +115419,7 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _9 _9: + ; h = (*Thistory)(unsafe.Pointer(h)).Fchain } if (type1 == int32(FTW_D) || type1 == int32(FTW_DP)) && fd_limit != 0 { @@ -114453,148 +115496,6 @@ func Xnftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32) (r1 return r } -const B0 = 0 -const B1000000 = 4104 -const B110 = 3 -const B115200 = 4098 -const B1152000 = 4105 -const B1200 = 9 -const B134 = 4 -const B150 = 5 -const B1500000 = 4106 -const B1800 = 10 -const B19200 = 14 -const B200 = 6 -const B2000000 = 4107 -const B230400 = 4099 -const B2400 = 11 -const B2500000 = 4108 -const B300 = 7 -const B3000000 = 4109 -const B3500000 = 4110 -const B38400 = 15 -const B4000000 = 4111 -const B460800 = 4100 -const B4800 = 12 -const B50 = 1 -const B500000 = 4101 -const B57600 = 4097 -const B576000 = 4102 -const B600 = 8 -const B75 = 2 -const B921600 = 4103 -const B9600 = 13 -const BRKINT = 2 -const BS0 = 0 -const BS1 = 8192 -const BSDLY = 8192 -const CLOCAL = 2048 -const CR0 = 0 -const CR1 = 512 -const CR2 = 1024 -const CR3 = 1536 -const CRDLY = 1536 -const CREAD = 128 -const CS5 = 0 -const CS6 = 16 -const CS7 = 32 -const CS8 = 48 -const CSIZE = 48 -const CSTOPB = 64 -const ECHO = 8 -const ECHOE = 16 -const ECHOK = 32 -const ECHONL = 64 -const FF0 = 0 -const FF1 = 32768 -const FFDLY = 32768 -const HUPCL = 1024 -const ICANON = 2 -const ICRNL = 256 -const IEXTEN = 32768 -const IGNBRK = 1 -const IGNCR = 128 -const IGNPAR = 4 -const IMAXBEL = 8192 -const INLCR = 64 -const INPCK = 16 -const ISIG = 1 -const ISTRIP = 32 -const IUCLC = 512 -const IUTF8 = 16384 -const IXANY = 2048 -const IXOFF = 4096 -const IXON = 1024 -const NCCS = 32 -const NL0 = 0 -const NL1 = 256 -const NLDLY = 256 -const NOFLSH = 128 -const OCRNL = 8 -const OFDEL = 128 -const OFILL = 64 -const OLCUC = 2 -const ONLCR = 4 -const ONLRET = 32 -const ONOCR = 16 -const OPOST = 1 -const PARENB = 256 -const PARMRK = 8 -const PARODD = 512 -const TAB0 = 0 -const TAB1 = 2048 -const TAB2 = 4096 -const TAB3 = 6144 -const TABDLY = 6144 -const TCIFLUSH = 0 -const TCIOFF = 2 -const TCIOFLUSH = 2 -const TCION = 3 -const TCOFLUSH = 1 -const TCOOFF = 0 -const TCOON = 1 -const TCSADRAIN = 1 -const TCSAFLUSH = 2 -const TCSANOW = 0 -const TOSTOP = 256 -const VDISCARD = 13 -const VEOF = 4 -const VEOL = 11 -const VEOL2 = 16 -const VERASE = 2 -const VINTR = 0 -const VKILL = 3 -const VLNEXT = 15 -const VMIN = 6 -const VQUIT = 1 -const VREPRINT = 12 -const VSTART = 8 -const VSTOP = 9 -const VSUSP = 10 -const VSWTC = 7 -const VT0 = 0 -const VT1 = 16384 -const VTDLY = 16384 -const VTIME = 5 -const VWERASE = 14 - -type Tcc_t = uint8 - -type Tspeed_t = uint32 - -type Ttcflag_t = uint32 - -type Ttermios = struct { - Fc_iflag Ttcflag_t - Fc_oflag Ttcflag_t - Fc_cflag Ttcflag_t - Fc_lflag Ttcflag_t - Fc_line Tcc_t - Fc_cc [32]Tcc_t - F__c_ispeed Tspeed_t - F__c_ospeed Tspeed_t -} - /* Nonstandard, but vastly superior to the standard functions */ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws uintptr) (r int32) { @@ -114610,7 +115511,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui var _ /* n at bp+0 */ int32 _, _, _ = m, s, v1 *(*int32)(unsafe.Pointer(bp)) = 0 - m = Xopen(tls, __ccgo_ts+881, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) + m = Xopen(tls, __ccgo_ts+916, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) if m < 0 { return -int32(1) } @@ -114621,7 +115522,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui if !(name != 0) { name = bp + 8 } - Xsnprintf(tls, name, uint64(20), __ccgo_ts+891, VaList(bp+40, *(*int32)(unsafe.Pointer(bp)))) + Xsnprintf(tls, name, uint64(20), __ccgo_ts+926, VaList(bp+40, *(*int32)(unsafe.Pointer(bp)))) v1 = Xopen(tls, name, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) s = v1 if v1 < 0 { @@ -114638,6 +115539,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) return 0 fail: + ; Xclose(tls, m) _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) return -int32(1) @@ -114667,7 +115569,7 @@ func Xposix_openpt(tls *TLS, flags int32) (r1 int32) { } var r int32 _ = r - r = Xopen(tls, __ccgo_ts+881, flags, 0) + r = Xopen(tls, __ccgo_ts+916, flags, 0) if r < 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(ENOSPC) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EAGAIN) } @@ -114712,7 +115614,7 @@ func X__ptsname_r(tls *TLS, fd int32, buf uintptr, len1 Tsize_t) (r int32) { if v1 != 0 { return -err } - if uint64(Xsnprintf(tls, buf, len1, __ccgo_ts+891, VaList(bp+16, *(*int32)(unsafe.Pointer(bp))))) >= len1 { + if uint64(Xsnprintf(tls, buf, len1, __ccgo_ts+926, VaList(bp+16, *(*int32)(unsafe.Pointer(bp))))) >= len1 { return int32(ERANGE) } return 0 @@ -114733,7 +115635,7 @@ func _slash_len(tls *TLS, s uintptr) (r Tsize_t) { for int32(*(*int8)(unsafe.Pointer(s))) == int32('/') { s++ } - return uint64(int64(s) - int64(s0)) + return uint64(int64(int64(s)) - int64(int64(s0))) } func Xrealpath(tls *TLS, filename uintptr, resolved uintptr) (r uintptr) { @@ -114773,7 +115675,9 @@ func Xrealpath(tls *TLS, filename uintptr, resolved uintptr) (r uintptr) { * If not a link, it's moved to output; if a link, contents are * pushed to the stack. */ restart: + ; _3: + ; /* If stack starts with /, the whole component is / or // * and the output state must be reset. */ if int32((*(*[4097]int8)(unsafe.Pointer(bp)))[p]) == int32('/') { @@ -114793,7 +115697,7 @@ _3: goto _2 } z = X__strchrnul(tls, bp+uintptr(p), int32('/')) - v6 = uint64(int64(z) - int64(bp+uintptr(p))) + v6 = uint64(int64(int64(z)) - int64(bp+uintptr(p))) l = v6 l0 = v6 if !(l != 0) && !(check_dir != 0) { @@ -114841,7 +115745,7 @@ _3: } } k = Xreadlink(tls, bp+4097, bp, p) - if uint64(k) == p { + if uint64(uint64(k)) == p { goto toolong } if !(k != 0) { @@ -114855,6 +115759,7 @@ _3: return uintptr(0) } skip_readlink: + ; check_dir = 0 if up != 0 { for q != 0 && int32((*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[q-uint64(1)]) != int32('/') { @@ -114871,6 +115776,7 @@ skip_readlink: check_dir = int32((*(*[4097]int8)(unsafe.Pointer(bp)))[p]) goto _2 _8: + ; cnt++ v9 = cnt if v9 == uint64(SYMLOOP_MAX) { @@ -114884,17 +115790,19 @@ _8: p++ } } - p -= uint64(k) - Xmemmove(tls, bp+uintptr(p), bp, uint64(k)) + p -= uint64(uint64(k)) + Xmemmove(tls, bp+uintptr(p), bp, uint64(uint64(k))) /* Skip the stack advancement in case we have a new * absolute base path. */ goto restart goto _2 _2: + ; p += _slash_len(tls, bp+uintptr(p)) goto _3 goto _1 _1: + ; (*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[q] = 0 if int32((*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[0]) != int32('/') { if !(Xgetcwd(tls, bp, uint64(4097)) != 0) { @@ -114938,6 +115846,7 @@ _1: return Xstrdup(tls, bp+4097) } toolong: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENAMETOOLONG) return uintptr(0) } @@ -114998,7 +115907,7 @@ func Xsetrlimit(tls *TLS, resource int32, rlim uintptr) (r int32) { } ret = int32(X__syscall4(tls, int64(SYS_prlimit64), int64(Int32FromInt32(0)), int64(resource), int64(rlim), int64(Int32FromInt32(0)))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } if (*Trlimit)(unsafe.Pointer(rlim)).Frlim_cur < ^Uint64FromUint64(0) { v1 = (*Trlimit)(unsafe.Pointer(rlim)).Frlim_cur @@ -115012,8 +115921,8 @@ func Xsetrlimit(tls *TLS, resource int32, rlim uintptr) (r int32) { } *(*Tctx)(unsafe.Pointer(bp + 16)) = Tctx{ Flim: [2]uint64{ - 0: v1, - 1: v2, + 0: uint64(v1), + 1: uint64(v2), }, Fres: resource, Ferr: -int32(1), @@ -115463,18 +116372,18 @@ func __vsyslog(tls *TLS, priority int32, message uintptr, ap Tva_list) { } *(*Ttime_t)(unsafe.Pointer(bp + 16)) = Xtime(tls, UintptrFromInt32(0)) Xgmtime_r(tls, bp+16, bp+24) - Xstrftime_l(tls, bp, uint64(16), __ccgo_ts+903, bp+24, uintptr(unsafe.Pointer(&X__c_locale))) + Xstrftime_l(tls, bp, uint64(16), __ccgo_ts+938, bp+24, uintptr(unsafe.Pointer(&X__c_locale))) if _log_opt&int32(LOG_PID) != 0 { v1 = Xgetpid(tls) } else { v1 = 0 } pid = v1 - l = Xsnprintf(tls, bp+80, uint64(1024), __ccgo_ts+912, VaList(bp+1120, priority, bp, bp+1104, uintptr(unsafe.Pointer(&_log_ident)), __ccgo_ts+934+BoolUintptr(!(pid != 0)), pid, __ccgo_ts+936+BoolUintptr(!(pid != 0)))) + l = Xsnprintf(tls, bp+80, uint64(1024), __ccgo_ts+947, VaList(bp+1120, priority, bp, bp+1104, uintptr(unsafe.Pointer(&_log_ident)), __ccgo_ts+969+BoolUintptr(!(pid != 0)), pid, __ccgo_ts+971+BoolUintptr(!(pid != 0)))) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = errno_save - l2 = Xvsnprintf(tls, bp+80+uintptr(l), uint64(1024)-uint64(l), message, ap) + l2 = Xvsnprintf(tls, bp+80+uintptr(l), uint64(1024)-uint64(uint64(l)), message, ap) if l2 >= 0 { - if uint64(l2) >= uint64(1024)-uint64(l) { + if uint64(uint64(l2)) >= uint64(1024)-uint64(uint64(l)) { l = int32(Uint64FromInt64(1024) - Uint64FromInt32(1)) } else { l += l2 @@ -115484,15 +116393,15 @@ func __vsyslog(tls *TLS, priority int32, message uintptr, ap Tva_list) { l++ (*(*[1024]int8)(unsafe.Pointer(bp + 80)))[v2] = int8('\n') } - if Xsend(tls, _log_fd, bp+80, uint64(l), 0) < 0 && (!(_is_lost_conn(tls, *(*int32)(unsafe.Pointer(X__errno_location(tls)))) != 0) || Xconnect(tls, _log_fd, uintptr(unsafe.Pointer(&_log_addr)), uint32(12)) < 0 || Xsend(tls, _log_fd, bp+80, uint64(l), 0) < 0) && _log_opt&int32(LOG_CONS) != 0 { - fd = Xopen(tls, __ccgo_ts+628, Int32FromInt32(O_WRONLY)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) + if Xsend(tls, _log_fd, bp+80, uint64(uint64(l)), 0) < 0 && (!(_is_lost_conn(tls, *(*int32)(unsafe.Pointer(X__errno_location(tls)))) != 0) || Xconnect(tls, _log_fd, uintptr(unsafe.Pointer(&_log_addr)), uint32(12)) < 0 || Xsend(tls, _log_fd, bp+80, uint64(uint64(l)), 0) < 0) && _log_opt&int32(LOG_CONS) != 0 { + fd = Xopen(tls, __ccgo_ts+666, Int32FromInt32(O_WRONLY)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) if fd >= 0 { - Xdprintf(tls, fd, __ccgo_ts+938, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) + Xdprintf(tls, fd, __ccgo_ts+973, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) Xclose(tls, fd) } } if _log_opt&int32(LOG_PERROR) != 0 { - Xdprintf(tls, int32(2), __ccgo_ts+938, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) + Xdprintf(tls, int32(2), __ccgo_ts+973, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) } } } @@ -115592,7 +116501,7 @@ func X__mmap(tls *TLS, start uintptr, len1 Tsize_t, prot int32, flags int32, fd } var ret int64 _ = ret - if uint64(off)&(-Uint64FromUint64(0x2000)<<(Uint64FromInt32(8)*Uint64FromInt64(8)-Uint64FromInt32(1))|(Uint64FromUint64(4096)-Uint64FromInt32(1))) != 0 { + if uint64(uint64(off))&(-Uint64FromUint64(0x2000)<<(Uint64FromInt32(8)*Uint64FromInt64(8)-Uint64FromInt32(1))|(Uint64FromUint64(4096)-Uint64FromInt32(1))) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(-Int32FromInt32(1)) } @@ -115608,7 +116517,7 @@ func X__mmap(tls *TLS, start uintptr, len1 Tsize_t, prot int32, flags int32, fd if ret == int64(-int32(EPERM)) && !(start != 0) && flags&int32(MAP_ANON) != 0 && !(flags&Int32FromInt32(MAP_FIXED) != 0) { ret = int64(-int32(ENOMEM)) } - return uintptr(X__syscall_ret(tls, uint64(ret))) + return uintptr(X__syscall_ret(tls, uint64(uint64(ret)))) } func Xmmap(tls *TLS, start uintptr, len1 Tsize_t, prot int32, flags int32, fd int32, off Toff_t) (r uintptr) { @@ -115626,7 +116535,7 @@ func X__mprotect(tls *TLS, addr uintptr, len1 Tsize_t, prot int32) (r int32) { } var end, start Tsize_t _, _ = end, start - start = uint64(addr) & uint64(-Int32FromInt32(PAGESIZE)) + start = uint64(uint64(addr)) & uint64(-Int32FromInt32(PAGESIZE)) end = uint64(addr+uintptr(len1)+UintptrFromInt32(PAGESIZE)-UintptrFromInt32(1)) & uint64(-Int32FromInt32(PAGESIZE)) return int32(X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_mprotect), int64(start), int64(end-start), int64(prot))))) } @@ -115739,16 +116648,16 @@ func X__shm_mapname(tls *TLS, name uintptr, buf uintptr) (r uintptr) { } v1 = X__strchrnul(tls, name, int32('/')) p = v1 - if *(*int8)(unsafe.Pointer(v1)) != 0 || p == name || int64(p)-int64(name) <= int64(2) && int32(*(*int8)(unsafe.Pointer(name))) == int32('.') && int32(*(*int8)(unsafe.Pointer(p + uintptr(-Int32FromInt32(1))))) == int32('.') { + if *(*int8)(unsafe.Pointer(v1)) != 0 || p == name || int64(int64(p))-int64(int64(name)) <= int64(2) && int32(*(*int8)(unsafe.Pointer(name))) == int32('.') && int32(*(*int8)(unsafe.Pointer(p + uintptr(-Int32FromInt32(1))))) == int32('.') { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } - if int64(p)-int64(name) > int64(NAME_MAX) { + if int64(int64(p))-int64(int64(name)) > int64(NAME_MAX) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENAMETOOLONG) return uintptr(0) } - Xmemcpy(tls, buf, __ccgo_ts+943, uint64(9)) - Xmemcpy(tls, buf+uintptr(9), name, uint64(int64(p)-int64(name)+int64(1))) + Xmemcpy(tls, buf, __ccgo_ts+978, uint64(9)) + Xmemcpy(tls, buf+uintptr(9), name, uint64(int64(int64(p))-int64(int64(name))+int64(1))) return buf } @@ -115814,11 +116723,11 @@ func Xbtowc(tls *TLS, c int32) (r Twint_t) { var b, v3 int32 var v1, v2 uint32 _, _, _, _ = b, v1, v2, v3 - b = int32(uint8(c)) - if uint32(b) < uint32(128) { - v1 = uint32(b) + b = int32(uint8(uint8(c))) + if uint32(uint32(b)) < uint32(128) { + v1 = uint32(uint32(b)) } else { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -115855,22 +116764,23 @@ func Xc16rtomb(tls *TLS, s uintptr, c16 Tchar16_t, ps uintptr) (r Tsize_t) { } return uint64(1) } - if !(*(*uint32)(unsafe.Pointer(x)) != 0) && uint32(c16)-uint32(0xd800) < uint32(0x400) { - *(*uint32)(unsafe.Pointer(x)) = uint32((int32(c16) - int32(0xd7c0)) << int32(10)) + if !(*(*uint32)(unsafe.Pointer(x)) != 0) && uint32(uint32(c16))-uint32(0xd800) < uint32(0x400) { + *(*uint32)(unsafe.Pointer(x)) = uint32((int32(int32(c16)) - int32(0xd7c0)) << int32(10)) return uint64(0) } if *(*uint32)(unsafe.Pointer(x)) != 0 { - if uint32(c16)-uint32(0xdc00) >= uint32(0x400) { + if uint32(uint32(c16))-uint32(0xdc00) >= uint32(0x400) { goto ilseq } else { - wc = int32(*(*uint32)(unsafe.Pointer(x)) + uint32(c16) - uint32(0xdc00)) + wc = int32(*(*uint32)(unsafe.Pointer(x)) + uint32(uint32(c16)) - uint32(0xdc00)) } *(*uint32)(unsafe.Pointer(x)) = uint32(0) } else { - wc = int32(c16) + wc = int32(int32(c16)) } return Xwcrtomb(tls, s, wc, uintptr(0)) ilseq: + ; *(*uint32)(unsafe.Pointer(x)) = uint32(0) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EILSEQ) return uint64(-Int32FromInt32(1)) @@ -115883,7 +116793,7 @@ func Xc32rtomb(tls *TLS, s uintptr, c32 Tchar32_t, ps uintptr) (r Tsize_t) { trc("tls=%v s=%v c32=%v ps=%v, (%v:)", tls, s, c32, ps, origin(2)) defer func() { trc("-> %v", r) }() } - return Xwcrtomb(tls, s, int32(c32), ps) + return Xwcrtomb(tls, s, int32(int32(c32)), ps) } func Xmblen(tls *TLS, s uintptr, n Tsize_t) (r int32) { @@ -116017,7 +116927,7 @@ func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t, st uintptr) (r Tsize *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolUint64(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -116039,13 +116949,14 @@ func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t, st uintptr) (r Tsize goto ilseq } loop: + ; v4 = s s++ c = c<>int32(3)-int32(0x10)|(int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)+int32(c)>>Int32FromInt32(26))) & ^Int32FromInt32(7) != 0 { s-- goto _9 @@ -116260,17 +117174,21 @@ resume0: c = uint32(0) goto _10 _10: + ; goto _11 goto _9 _9: + ; goto _8 _7: + ; _15: + ; if !(wn != 0) { *(*uintptr)(unsafe.Pointer(src)) = s return wn0 } - if uint32(*(*uint8)(unsafe.Pointer(s)))-uint32(1) < uint32(0x7f) && uint64(s)%uint64(4) == uint64(0) { + if uint32(*(*uint8)(unsafe.Pointer(s)))-uint32(1) < uint32(0x7f) && uint64(uint64(s))%uint64(4) == uint64(0) { for wn >= uint64(5) && !((*(*uint32)(unsafe.Pointer(s))|(*(*uint32)(unsafe.Pointer(s))-Uint32FromInt32(0x01010101)))&Uint32FromUint32(0x80808080) != 0) { v16 = ws ws += 4 @@ -116311,6 +117229,7 @@ _15: s++ c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(v26)))-uint32(0xc2)] resume: + ; if (int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)-int32(0x10)|(int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)+int32(c)>>Int32FromInt32(26))) & ^Int32FromInt32(7) != 0 { s-- goto _13 @@ -116338,15 +117257,18 @@ resume: } v30 = ws ws += 4 - *(*Twchar_t)(unsafe.Pointer(v30)) = int32(c) + *(*Twchar_t)(unsafe.Pointer(v30)) = int32(int32(c)) wn-- c = uint32(0) goto _14 _14: + ; goto _15 goto _13 _13: + ; _8: + ; if !(c != 0) && !(*(*uint8)(unsafe.Pointer(s)) != 0) { if ws != 0 { *(*Twchar_t)(unsafe.Pointer(ws)) = 0 @@ -116400,7 +117322,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolInt32(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -116428,7 +117350,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { s++ c = c<= uint32(0x40) { @@ -116438,7 +117360,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { s++ c = c<= uint32(0x40) { @@ -116449,6 +117371,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { *(*Twchar_t)(unsafe.Pointer(wc)) = int32(c<>Int32FromInt32(6)) *(*int8)(unsafe.Pointer(s)) = int8(int32(0x80) | wc&int32(0x3f)) return uint64(2) } else { - if uint32(wc) < uint32(0xd800) || uint32(wc)-uint32(0xe000) < uint32(0x2000) { + if uint32(uint32(wc)) < uint32(0xd800) || uint32(uint32(wc))-uint32(0xe000) < uint32(0x2000) { v3 = s s++ *(*int8)(unsafe.Pointer(v3)) = int8(int32(0xe0) | wc>>Int32FromInt32(12)) @@ -116498,7 +117421,7 @@ func Xwcrtomb(tls *TLS, s uintptr, wc Twchar_t, st uintptr) (r Tsize_t) { *(*int8)(unsafe.Pointer(s)) = int8(int32(0x80) | wc&int32(0x3f)) return uint64(3) } else { - if uint32(wc)-uint32(0x10000) < uint32(0x100000) { + if uint32(uint32(wc))-uint32(0x10000) < uint32(0x100000) { v5 = s s++ *(*int8)(unsafe.Pointer(v5)) = int8(int32(0xf0) | wc>>Int32FromInt32(18)) @@ -116600,6 +117523,7 @@ func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n Tsize_t, st uintptr) (r Tsize } goto _1 _1: + ; ws2 += 4 } return n @@ -116672,15 +117596,15 @@ func Xwctob(tls *TLS, c Twint_t) (r int32) { var v1 int32 _ = v1 if c < uint32(128) { - return int32(c) + return int32(int32(c)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) } if v1 == int32(1) && c-uint32(0xdf80) < uint32(0x80) { - return int32(uint8(c)) + return int32(uint8(uint8(c))) } return -int32(1) } @@ -117772,12 +118696,12 @@ func _getoffs(tls *TLS, offs uintptr, base uintptr, s uintptr) (r int32) { if !(*(*uint8)(unsafe.Pointer(s)) != 0) { return i } - if int64(s)-int64(base) >= int64(0x4000) { + if int64(int64(s))-int64(int64(base)) >= int64(0x4000) { return 0 } v2 = i i++ - *(*int16)(unsafe.Pointer(offs + uintptr(v2)*2)) = int16(int64(s) - int64(base)) + *(*int16)(unsafe.Pointer(offs + uintptr(v2)*2)) = int16(int64(int64(s)) - int64(int64(base))) s += uintptr(int32(*(*uint8)(unsafe.Pointer(s))) + int32(1)) goto _1 _1: @@ -117801,6 +118725,7 @@ func _getlens(tls *TLS, lens uintptr, s uintptr, l int32) (r int32) { } goto _2 _2: + ; j++ } if uint32(j-k)-uint32(1) > uint32(62) { @@ -117843,7 +118768,7 @@ func _match(tls *TLS, offset uintptr, base uintptr, dn uintptr, end uintptr, len v3 = noff o = int32((*(*[128]int16)(unsafe.Pointer(bp)))[v3]) end -= uintptr(l) - if l != int32(*(*uint8)(unsafe.Pointer(base + uintptr(o)))) || Xmemcmp(tls, base+uintptr(o)+uintptr(1), end, uint64(l)) != 0 { + if l != int32(*(*uint8)(unsafe.Pointer(base + uintptr(o)))) || Xmemcmp(tls, base+uintptr(o)+uintptr(1), end, uint64(uint64(l))) != 0 { return m } *(*int32)(unsafe.Pointer(offset)) = o @@ -117888,7 +118813,7 @@ func Xdn_comp(tls *TLS, src uintptr, dst uintptr, space int32, dnptrs uintptr, l return int32(1) } end = src + uintptr(l) - n = _getlens(tls, bp+4, src, int32(l)) + n = _getlens(tls, bp+4, src, int32(int32(l))) if !(n != 0) { return -int32(1) } @@ -117903,30 +118828,32 @@ func Xdn_comp(tls *TLS, src uintptr, dst uintptr, space int32, dnptrs uintptr, l if m > bestlen { bestlen = m bestoff = *(*int32)(unsafe.Pointer(bp)) - if uint64(m) == l { + if uint64(uint64(m)) == l { break } } goto _1 _1: + ; p += 8 } } /* encode unmatched part */ - if uint64(space) < l-uint64(bestlen)+uint64(2)+BoolUint64(uint64(bestlen-Int32FromInt32(1)) < l-Uint64FromInt32(1)) { + if uint64(uint64(space)) < l-uint64(uint64(bestlen))+uint64(2)+BoolUint64(uint64(bestlen-Int32FromInt32(1)) < l-Uint64FromInt32(1)) { return -int32(1) } - Xmemcpy(tls, dst+uintptr(1), src, l-uint64(bestlen)) + Xmemcpy(tls, dst+uintptr(1), src, l-uint64(uint64(bestlen))) v3 = Int32FromInt32(0) j = v3 i = v3 for { - if !(uint64(i) < l-uint64(bestlen)) { + if !(uint64(uint64(i)) < l-uint64(uint64(bestlen))) { break } *(*uint8)(unsafe.Pointer(dst + uintptr(i))) = (*(*[127]uint8)(unsafe.Pointer(bp + 4)))[j] goto _2 _2: + ; v4 = j j++ i += int32((*(*[127]uint8)(unsafe.Pointer(bp + 4)))[v4]) + int32(1) @@ -117938,7 +118865,7 @@ func Xdn_comp(tls *TLS, src uintptr, dst uintptr, space int32, dnptrs uintptr, l *(*uint8)(unsafe.Pointer(dst + uintptr(v5))) = uint8(int32(0xc0) | bestoff>>int32(8)) v6 = i i++ - *(*uint8)(unsafe.Pointer(dst + uintptr(v6))) = uint8(bestoff) + *(*uint8)(unsafe.Pointer(dst + uintptr(v6))) = uint8(uint8(bestoff)) } else { v7 = i i++ @@ -117982,7 +118909,7 @@ func X__dn_expand(tls *TLS, base uintptr, end uintptr, src uintptr, dest uintptr /* detect reference loop using an iteration counter */ i = 0 for { - if !(int64(i) < int64(end)-int64(base)) { + if !(int64(int64(i)) < int64(int64(end))-int64(int64(base))) { break } /* loop invariants: p= int64(end)-int64(base) { + if int64(int64(j)) >= int64(int64(end))-int64(int64(base)) { return -int32(1) } p = base + uintptr(j) @@ -118008,7 +118935,7 @@ func X__dn_expand(tls *TLS, base uintptr, end uintptr, src uintptr, dest uintptr v4 = p p++ j = int32(*(*uint8)(unsafe.Pointer(v4))) - if int64(j) >= int64(end)-int64(p) || int64(j) >= int64(dend)-int64(dest) { + if int64(int64(j)) >= int64(int64(end))-int64(int64(p)) || int64(int64(j)) >= int64(int64(dend))-int64(int64(dest)) { return -int32(1) } for { @@ -118026,13 +118953,14 @@ func X__dn_expand(tls *TLS, base uintptr, end uintptr, src uintptr, dest uintptr } else { *(*int8)(unsafe.Pointer(dest)) = 0 if len1 < 0 { - len1 = int32(int64(p+uintptr(1)) - int64(src)) + len1 = int32(int64(p+uintptr(1)) - int64(int64(src))) } return len1 } } goto _2 _2: + ; i += int32(2) } return -int32(1) @@ -118056,16 +118984,16 @@ func Xdn_skipname(tls *TLS, s uintptr, end uintptr) (r int32) { p = s for p < end { if !(*(*uint8)(unsafe.Pointer(p)) != 0) { - return int32(int64(p) - int64(s) + int64(1)) + return int32(int64(int64(p)) - int64(int64(s)) + int64(1)) } else { if int32(*(*uint8)(unsafe.Pointer(p))) >= int32(192) { if p+uintptr(1) < end { - return int32(int64(p) - int64(s) + int64(2)) + return int32(int64(int64(p)) - int64(int64(s)) + int64(2)) } else { break } } else { - if int64(end)-int64(p) < int64(int32(*(*uint8)(unsafe.Pointer(p)))+int32(1)) { + if int64(int64(end))-int64(int64(p)) < int64(int32(*(*uint8)(unsafe.Pointer(p)))+int32(1)) { break } else { p += uintptr(int32(*(*uint8)(unsafe.Pointer(p))) + int32(1)) @@ -118194,7 +119122,7 @@ func X__dns_parse(tls *TLS, r uintptr, rlen int32, callback uintptr, ctx uintptr if !(v1 != 0) { break } - for int64(p)-int64(r) < int64(rlen) && uint32(*(*uint8)(unsafe.Pointer(p)))-uint32(1) < uint32(127) { + for int64(int64(p))-int64(int64(r)) < int64(int64(rlen)) && uint32(*(*uint8)(unsafe.Pointer(p)))-uint32(1) < uint32(127) { p++ } if p > r+uintptr(rlen)-uintptr(6) { @@ -118208,7 +119136,7 @@ func X__dns_parse(tls *TLS, r uintptr, rlen int32, callback uintptr, ctx uintptr if !(v2 != 0) { break } - for int64(p)-int64(r) < int64(rlen) && uint32(*(*uint8)(unsafe.Pointer(p)))-uint32(1) < uint32(127) { + for int64(int64(p))-int64(int64(r)) < int64(int64(rlen)) && uint32(*(*uint8)(unsafe.Pointer(p)))-uint32(1) < uint32(127) { p++ } if p > r+uintptr(rlen)-uintptr(12) { @@ -118216,7 +119144,7 @@ func X__dns_parse(tls *TLS, r uintptr, rlen int32, callback uintptr, ctx uintptr } p += uintptr(int32(1) + BoolInt32(!!(*(*uint8)(unsafe.Pointer(p)) != 0))) len1 = int32(*(*uint8)(unsafe.Pointer(p + 8)))*int32(256) + int32(*(*uint8)(unsafe.Pointer(p + 9))) - if int64(len1+int32(10)) > int64(r+uintptr(rlen))-int64(p) { + if int64(len1+int32(10)) > int64(r+uintptr(rlen))-int64(int64(p)) { return -int32(1) } if (*(*func(*TLS, uintptr, int32, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{callback})))(tls, ctx, int32(*(*uint8)(unsafe.Pointer(p + 1))), p+uintptr(10), len1, r, rlen) < 0 { @@ -118572,9 +119500,10 @@ func Xether_aton_r(tls *TLS, x uintptr, p_a uintptr) (r uintptr) { if n > uint64(0xFF) { return uintptr(0) } /* bad byte */ - *(*Tuint8_t)(unsafe.Pointer(bp + uintptr(ii))) = uint8(n) + *(*Tuint8_t)(unsafe.Pointer(bp + uintptr(ii))) = uint8(uint8(n)) goto _1 _1: + ; ii++ } if int32(*(*int8)(unsafe.Pointer(x))) != 0 { @@ -118611,13 +119540,14 @@ func Xether_ntoa_r(tls *TLS, p_a uintptr, x uintptr) (r uintptr) { break } if ii == 0 { - v2 = __ccgo_ts + 953 + v2 = __ccgo_ts + 988 } else { - v2 = __ccgo_ts + 958 + v2 = __ccgo_ts + 993 } x += uintptr(Xsprintf(tls, x, v2, VaList(bp+8, int32(*(*Tuint8_t)(unsafe.Pointer(p_a + uintptr(ii))))))) goto _1 _1: + ; ii++ } return y @@ -118671,6 +119601,7 @@ func Xfreeaddrinfo(tls *TLS, p uintptr) { } goto _1 _1: + ; cnt++ p = (*Taddrinfo)(unsafe.Pointer(p)).Fai_next } @@ -118707,10 +119638,12 @@ func Xgai_strerror(tls *TLS, ecode int32) (r uintptr) { } goto _2 _2: + ; s++ } goto _1 _1: + ; ecode++ s++ } @@ -118817,6 +119750,7 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt family = tf[int32(1)-i] goto _1 _1: + ; i++ } } @@ -118833,7 +119767,7 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt } nais = nservs * naddrs canon_len = int32(Xstrlen(tls, bp+1352)) - out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(88)+uint64(canon_len)+uint64(1)) + out = Xcalloc(tls, uint64(1), uint64(uint64(nais))*uint64(88)+uint64(uint64(canon_len))+uint64(1)) if !(out != 0) { return -int32(10) } @@ -118855,7 +119789,7 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt if !(j < nservs) { break } - (*(*Taibuf)(unsafe.Pointer(out + uintptr(k)*88))).Fslot = int16(k) + (*(*Taibuf)(unsafe.Pointer(out + uintptr(k)*88))).Fslot = int16(int16(k)) if (*(*[48]Taddress)(unsafe.Pointer(bp + 8)))[i].Ffamily == int32(PF_INET) { v5 = uint64(16) } else { @@ -118886,14 +119820,16 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt } goto _4 _4: + ; j++ k++ } goto _2 _2: + ; i++ } - (*(*Taibuf)(unsafe.Pointer(out))).Fref = int16(nais) + (*(*Taibuf)(unsafe.Pointer(out))).Fref = int16(int16(nais)) *(*uintptr)(unsafe.Pointer(res)) = out return 0 } @@ -119060,7 +119996,7 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l Tsocklen_t, af int32, h uintptr, bu Fsin Tsockaddr_in F__ccgo_pad2 [12]byte }{} - *(*uint16)(unsafe.Pointer(bp)) = uint16(af) + *(*uint16)(unsafe.Pointer(bp)) = uint16(uint16(af)) if af == int32(PF_INET6) { v1 = uint64(28) } else { @@ -119080,26 +120016,26 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l Tsocklen_t, af int32, h uintptr, bu } } /* Align buffer and check for space for pointers and ip address */ - i = int32(uint64(buf) & (Uint64FromInt64(8) - Uint64FromInt32(1))) + i = int32(uint64(uint64(buf)) & (Uint64FromInt64(8) - Uint64FromInt32(1))) if !(i != 0) { i = int32(8) } - if buflen <= Uint64FromInt32(5)*Uint64FromInt64(8)-uint64(i)+uint64(l) { + if buflen <= Uint64FromInt32(5)*Uint64FromInt64(8)-uint64(uint64(i))+uint64(uint64(l)) { return int32(ERANGE) } - buf += uintptr(uint64(8) - uint64(i)) - buflen -= Uint64FromInt32(5)*Uint64FromInt64(8) - uint64(i) + uint64(l) + buf += uintptr(uint64(8) - uint64(uint64(i))) + buflen -= Uint64FromInt32(5)*Uint64FromInt64(8) - uint64(uint64(i)) + uint64(uint64(l)) (*Thostent)(unsafe.Pointer(h)).Fh_addr_list = buf buf += uintptr(Uint64FromInt32(2) * Uint64FromInt64(8)) (*Thostent)(unsafe.Pointer(h)).Fh_aliases = buf buf += uintptr(Uint64FromInt32(2) * Uint64FromInt64(8)) *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list)) = buf - Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list)), a, uint64(l)) + Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list)), a, uint64(uint64(l))) buf += uintptr(l) *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list + 1*8)) = uintptr(0) *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_aliases)) = buf *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = uintptr(0) - switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { + switch Xgetnameinfo(tls, bp, sl, buf, uint32(uint32(buflen)), uintptr(0), uint32(0), 0) { case -int32(3): *(*int32)(unsafe.Pointer(err)) = int32(TRY_AGAIN) return int32(EAGAIN) @@ -119117,7 +120053,7 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l Tsocklen_t, af int32, h uintptr, bu break } (*Thostent)(unsafe.Pointer(h)).Fh_addrtype = af - (*Thostent)(unsafe.Pointer(h)).Fh_length = int32(l) + (*Thostent)(unsafe.Pointer(h)).Fh_length = int32(int32(l)) (*Thostent)(unsafe.Pointer(h)).Fh_name = *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_aliases)) *(*uintptr)(unsafe.Pointer(res)) = h return 0 @@ -119202,7 +120138,7 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, } (*Thostent)(unsafe.Pointer(h)).Fh_length = v1 /* Align buffer */ - align = -uint64(buf) & (Uint64FromInt64(8) - Uint64FromInt32(1)) + align = -uint64(uint64(buf)) & (Uint64FromInt64(8) - Uint64FromInt32(1)) need = Uint64FromInt32(4) * Uint64FromInt64(8) need += uint64(cnt+Int32FromInt32(1)) * (uint64(8) + uint64((*Thostent)(unsafe.Pointer(h)).Fh_length)) need += Xstrlen(tls, name) + uint64(1) @@ -119226,6 +120162,7 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*Thostent)(unsafe.Pointer(h)).Fh_length)) goto _2 _2: + ; i++ } *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = uintptr(0) @@ -119472,16 +120409,16 @@ func _copy_addr(tls *TLS, r uintptr, af int32, sa uintptr, addr uintptr, addrlen dst = sa + 8 len1 = int32(16) if int32(*(*Tuint8_t)(unsafe.Pointer(addr))) == int32(0xfe) && int32(*(*Tuint8_t)(unsafe.Pointer(addr + 1)))&int32(0xc0) == int32(0x80) || int32(*(*Tuint8_t)(unsafe.Pointer(addr))) == int32(0xff) && int32(*(*Tuint8_t)(unsafe.Pointer(addr + 1)))&int32(0xf) == int32(0x2) { - (*(*Tsockaddr_in6)(unsafe.Pointer(sa))).Fsin6_scope_id = uint32(ifindex) + (*(*Tsockaddr_in6)(unsafe.Pointer(sa))).Fsin6_scope_id = uint32(uint32(ifindex)) } default: return } - if addrlen < uint64(len1) { + if addrlen < uint64(uint64(len1)) { return } - (*Tsockany)(unsafe.Pointer(sa)).Fsa.Fsa_family = uint16(af) - Xmemcpy(tls, dst, addr, uint64(len1)) + (*Tsockany)(unsafe.Pointer(sa)).Fsa.Fsa_family = uint16(uint16(af)) + Xmemcpy(tls, dst, addr, uint64(uint64(len1))) *(*uintptr)(unsafe.Pointer(r)) = sa } @@ -119492,12 +120429,12 @@ func _gen_netmask(tls *TLS, r uintptr, af int32, sa uintptr, prefixlen int32) { var _ /* addr at bp+0 */ [16]Tuint8_t _, _ = i, v1 *(*[16]Tuint8_t)(unsafe.Pointer(bp)) = [16]Tuint8_t{} - if uint64(prefixlen) > Uint64FromInt32(8)*Uint64FromInt64(16) { + if uint64(uint64(prefixlen)) > Uint64FromInt32(8)*Uint64FromInt64(16) { prefixlen = int32(Uint64FromInt32(8) * Uint64FromInt64(16)) } i = prefixlen / int32(8) - Xmemset(tls, bp, int32(0xff), uint64(i)) - if uint64(i) < uint64(16) { + Xmemset(tls, bp, int32(0xff), uint64(uint64(i))) + if uint64(uint64(i)) < uint64(16) { v1 = i i++ (*(*[16]Tuint8_t)(unsafe.Pointer(bp)))[v1] = uint8(int32(0xff) << (int32(8) - prefixlen%int32(8))) @@ -119512,7 +120449,7 @@ func _copy_lladdr(tls *TLS, r uintptr, sa uintptr, addr uintptr, addrlen Tsize_t (*(*Tsockaddr_ll_hack)(unsafe.Pointer(sa))).Fsll_family = uint16(PF_PACKET) (*(*Tsockaddr_ll_hack)(unsafe.Pointer(sa))).Fsll_ifindex = ifindex (*(*Tsockaddr_ll_hack)(unsafe.Pointer(sa))).Fsll_hatype = hatype - (*(*Tsockaddr_ll_hack)(unsafe.Pointer(sa))).Fsll_halen = uint8(addrlen) + (*(*Tsockaddr_ll_hack)(unsafe.Pointer(sa))).Fsll_halen = uint8(uint8(addrlen)) Xmemcpy(tls, sa+12, addr, addrlen) *(*uintptr)(unsafe.Pointer(r)) = sa } @@ -119539,6 +120476,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { break goto _1 _1: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } } else { @@ -119552,13 +120490,14 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _2 _2: + ; ifs0 = (*Tifaddrs_storage)(unsafe.Pointer(ifs0)).Fhash_next } if !(ifs0 != 0) { return 0 } } - ifs = Xcalloc(tls, uint64(1), uint64(200)+uint64(stats_len)) + ifs = Xcalloc(tls, uint64(1), uint64(200)+uint64(uint64(stats_len))) if ifs == uintptr(0) { return -int32(1) } @@ -119587,6 +120526,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _3 _3: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } if (*Tifaddrs_storage)(unsafe.Pointer(ifs)).Fifa.Fifa_name != 0 { @@ -119631,6 +120571,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _4 _4: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } if (*Tifaddrs_storage)(unsafe.Pointer(ifs)).Fifa.Fifa_addr != 0 { @@ -119694,7 +120635,7 @@ func _itoa(tls *TLS, p uintptr, x uint32) (r uintptr) { func _mkptr4(tls *TLS, s uintptr, ip uintptr) { bp := tls.Alloc(48) defer tls.Free(48) - Xsprintf(tls, s, __ccgo_ts+964, VaList(bp+8, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) + Xsprintf(tls, s, __ccgo_ts+999, VaList(bp+8, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) } func _mkptr6(tls *TLS, s uintptr, ip uintptr) { @@ -119720,9 +120661,10 @@ func _mkptr6(tls *TLS, s uintptr, ip uintptr) { *(*int8)(unsafe.Pointer(v5)) = int8('.') goto _1 _1: + ; i-- } - Xstrcpy(tls, s, __ccgo_ts+989) + Xstrcpy(tls, s, __ccgo_ts+1024) } var _xdigits = [17]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} @@ -119739,13 +120681,13 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int var _ /* iplit at bp+1560 */ Taddress var _ /* line at bp+0 */ [512]int8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f, p, z, v1, v10, v11, v13, v15, v16, v18, v2, v4, v5, v7, v8 - f = X__fopen_rb_ca(tls, __ccgo_ts+998, bp+1592, bp+512, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1033, bp+1592, bp+512, uint64(1032)) if !(f != 0) { return } if family == int32(PF_INET) { Xmemcpy(tls, bp+1544+uintptr(12), a, uint64(4)) - Xmemcpy(tls, bp+1544, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, bp+1544, __ccgo_ts+1044, uint64(12)) a = bp + 1544 } for Xfgets(tls, bp, int32(512), f) != 0 { @@ -119770,6 +120712,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _3 _3: + ; p++ } if !(*(*int8)(unsafe.Pointer(p)) != 0) { @@ -119783,7 +120726,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } if (*(*Taddress)(unsafe.Pointer(bp + 1560))).Ffamily == int32(PF_INET) { Xmemcpy(tls, bp+1560+8+uintptr(12), bp+1560+8, uint64(4)) - Xmemcpy(tls, bp+1560+8, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, bp+1560+8, __ccgo_ts+1044, uint64(12)) (*(*Taddress)(unsafe.Pointer(bp + 1560))).Fscopeid = uint32(0) } if Xmemcmp(tls, a, bp+1560+8, uint64(16)) != 0 || (*(*Taddress)(unsafe.Pointer(bp + 1560))).Fscopeid != scopeid { @@ -119801,6 +120744,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _9 _9: + ; p++ } z = p @@ -119816,11 +120760,12 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _14 _14: + ; z++ } *(*int8)(unsafe.Pointer(z)) = 0 - if int64(z)-int64(p) < int64(256) { - Xmemcpy(tls, buf, p, uint64(int64(z)-int64(p)+int64(1))) + if int64(int64(z))-int64(int64(p)) < int64(256) { + Xmemcpy(tls, buf, p, uint64(int64(int64(z))-int64(int64(p))+int64(1))) break } } @@ -119839,7 +120784,7 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { var _ /* line at bp+0 */ [128]int8 var _ /* z at bp+128 */ uintptr _, _, _, _, _, _, _, _, _ = f, p, svport, v1, v2, v4, v5, v7, v8 - f = X__fopen_rb_ca(tls, __ccgo_ts+1022, bp+1168, bp+136, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1057, bp+1168, bp+136, uint64(1032)) if !(f != 0) { return } @@ -119865,6 +120810,7 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { } goto _3 _3: + ; p++ } if !(*(*int8)(unsafe.Pointer(p)) != 0) { @@ -119874,19 +120820,19 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { p++ *(*int8)(unsafe.Pointer(v8)) = 0 svport = Xstrtoul(tls, p, bp+128, int32(10)) - if svport != uint64(port) || *(*uintptr)(unsafe.Pointer(bp + 128)) == p { + if svport != uint64(uint64(port)) || *(*uintptr)(unsafe.Pointer(bp + 128)) == p { continue } - if dgram != 0 && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1036, uint64(4)) != 0 { + if dgram != 0 && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1071, uint64(4)) != 0 { continue } - if !(dgram != 0) && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1041, uint64(4)) != 0 { + if !(dgram != 0) && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1076, uint64(4)) != 0 { continue } - if int64(p)-t__predefined_ptrdiff_t(bp) > int64(32) { + if int64(int64(p))-t__predefined_ptrdiff_t(bp) > int64(32) { continue } - Xmemcpy(tls, buf, bp, uint64(int64(p)-t__predefined_ptrdiff_t(bp))) + Xmemcpy(tls, buf, bp, uint64(int64(int64(p))-t__predefined_ptrdiff_t(bp))) break } X__fclose_ca(tls, f) @@ -119923,17 +120869,17 @@ func Xgetnameinfo(tls *TLS, sa uintptr, sl Tsocklen_t, node uintptr, nodelen Tso switch af { case int32(PF_INET): a = sa + 4 - if uint64(sl) < uint64(16) { + if uint64(uint64(sl)) < uint64(16) { return -int32(6) } _mkptr4(tls, bp, a) scopeid = uint32(0) case int32(PF_INET6): a = sa + 8 - if uint64(sl) < uint64(28) { + if uint64(uint64(sl)) < uint64(28) { return -int32(6) } - if Xmemcmp(tls, a, __ccgo_ts+1009, uint64(12)) != 0 { + if Xmemcmp(tls, a, __ccgo_ts+1044, uint64(12)) != 0 { _mkptr6(tls, bp, a) } else { _mkptr4(tls, bp, a+uintptr(12)) @@ -119953,7 +120899,7 @@ func Xgetnameinfo(tls *TLS, sa uintptr, sl Tsocklen_t, node uintptr, nodelen Tso rlen = X__res_send(tls, bp+347, qlen, bp+443, int32(512)) (*(*[256]int8)(unsafe.Pointer(bp + 78)))[0] = 0 if rlen > 0 { - if uint64(rlen) > uint64(512) { + if uint64(uint64(rlen)) > uint64(512) { rlen = int32(512) } X__dns_parse(tls, bp+443, rlen, __ccgo_fp(_dns_parse_callback), bp+78) @@ -119978,7 +120924,7 @@ func Xgetnameinfo(tls *TLS, sa uintptr, sl Tsocklen_t, node uintptr, nodelen Tso Xstrcat(tls, bp+78, p) } } - if Xstrlen(tls, bp+78) >= uint64(nodelen) { + if Xstrlen(tls, bp+78) >= uint64(uint64(nodelen)) { return -int32(12) } Xstrcpy(tls, node, bp+78) @@ -119991,9 +120937,9 @@ func Xgetnameinfo(tls *TLS, sa uintptr, sl Tsocklen_t, node uintptr, nodelen Tso _reverse_services(tls, bp+78, port, flags&int32(NI_DGRAM)) } if !(*(*int8)(unsafe.Pointer(p1)) != 0) { - p1 = _itoa(tls, bp+334, uint32(port)) + p1 = _itoa(tls, bp+334, uint32(uint32(port))) } - if Xstrlen(tls, p1) >= uint64(servlen) { + if Xstrlen(tls, p1) >= uint64(uint64(servlen)) { return -int32(12) } Xstrcpy(tls, serv, p1) @@ -120073,18 +121019,18 @@ func Xgetservbyname_r(tls *TLS, name uintptr, prots uintptr, se uintptr, buf uin return int32(ENOENT) } /* Align buffer */ - align = int32(-uint64(buf) & (Uint64FromInt64(16) - Uint64FromInt64(8) - Uint64FromInt32(1))) - if buflen < Uint64FromInt32(2)*Uint64FromInt64(8)+uint64(align) { + align = int32(-uint64(uint64(buf)) & (Uint64FromInt64(16) - Uint64FromInt64(8) - Uint64FromInt32(1))) + if buflen < Uint64FromInt32(2)*Uint64FromInt64(8)+uint64(uint64(align)) { return int32(ERANGE) } buf += uintptr(align) if !(prots != 0) { proto = 0 } else { - if !(Xstrcmp(tls, prots, __ccgo_ts+1046) != 0) { + if !(Xstrcmp(tls, prots, __ccgo_ts+1081) != 0) { proto = int32(IPPROTO_TCP) } else { - if !(Xstrcmp(tls, prots, __ccgo_ts+1050) != 0) { + if !(Xstrcmp(tls, prots, __ccgo_ts+1085) != 0) { proto = int32(IPPROTO_UDP) } else { return int32(EINVAL) @@ -120108,9 +121054,9 @@ func Xgetservbyname_r(tls *TLS, name uintptr, prots uintptr, se uintptr, buf uin *(*uintptr)(unsafe.Pointer((*Tservent)(unsafe.Pointer(se)).Fs_aliases + 1*8)) = uintptr(0) (*Tservent)(unsafe.Pointer(se)).Fs_port = int32(Xhtons(tls, (*(*[2]Tservice)(unsafe.Pointer(bp)))[0].Fport)) if int32((*(*[2]Tservice)(unsafe.Pointer(bp)))[0].Fproto) == int32(IPPROTO_TCP) { - v1 = __ccgo_ts + 1046 + v1 = __ccgo_ts + 1081 } else { - v1 = __ccgo_ts + 1050 + v1 = __ccgo_ts + 1085 } (*Tservent)(unsafe.Pointer(se)).Fs_proto = v1 *(*uintptr)(unsafe.Pointer(res)) = se @@ -120270,7 +121216,7 @@ _9: } } } - return int32(X__syscall_ret(tls, uint64(r1))) + return int32(X__syscall_ret(tls, uint64(uint64(r1)))) } func X__h_errno_location(tls *TLS) (r uintptr) { @@ -120278,10 +121224,10 @@ func X__h_errno_location(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - if !((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstack != 0) { + if !((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstack != 0) { return uintptr(unsafe.Pointer(&Xh_errno)) } - return ___get_tp(tls) + 160 + return uintptr(___get_tp(tls)) + 160 } func Xherror(tls *TLS, msg uintptr) { @@ -120298,11 +121244,11 @@ func Xherror(tls *TLS, msg uintptr) { v1 = __ccgo_ts } if msg != 0 { - v2 = __ccgo_ts + 641 + v2 = __ccgo_ts + 355 } else { v2 = __ccgo_ts } - Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+1054, VaList(bp+8, v1, v2, Xhstrerror(tls, *(*int32)(unsafe.Pointer(X__h_errno_location(tls)))))) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+1089, VaList(bp+8, v1, v2, Xhstrerror(tls, *(*int32)(unsafe.Pointer(X__h_errno_location(tls)))))) } type Tcpu_set_t1 = struct { @@ -120339,10 +121285,12 @@ func Xhstrerror(tls *TLS, ecode int32) (r uintptr) { } goto _2 _2: + ; s++ } goto _1 _1: + ; ecode-- s++ } @@ -120403,7 +121351,7 @@ func Xhtons(tls *TLS, n Tuint16_t) (r Tuint16_t) { _4: v1 = int32(v3) } else { - v1 = int32(n) + v1 = int32(int32(n)) } return uint16(v1) } @@ -120430,7 +121378,7 @@ func Xif_indextoname(tls *TLS, index uint32, name uintptr) (r1 uintptr) { if v1 < 0 { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 16)) = int32(index) + *(*int32)(unsafe.Pointer(bp + 16)) = int32(int32(index)) r = Xioctl(tls, fd, int32(SIOCGIFNAME), VaList(bp+48, bp)) X__syscall1(tls, int64(SYS_close), int64(fd)) if r < 0 { @@ -120491,7 +121439,7 @@ func _netlink_msg_to_nameindex(tls *TLS, pctx uintptr, h uintptr) (r int32) { i = *(*uint32)(unsafe.Pointer(ctx + 24 + uintptr(bucket)*4)) for i != 0 { map1 = (*Tifnameindexctx)(unsafe.Pointer(ctx)).Flist + uintptr(i-uint32(1))*28 - if (*Tifnamemap)(unsafe.Pointer(map1)).Findex == uint32(index) && int32((*Tifnamemap)(unsafe.Pointer(map1)).Fnamelen) == namelen && Xmemcmp(tls, map1+9, rta+UintptrFromInt64(4), uint64(namelen)) == 0 { + if (*Tifnamemap)(unsafe.Pointer(map1)).Findex == uint32(uint32(index)) && int32((*Tifnamemap)(unsafe.Pointer(map1)).Fnamelen) == namelen && Xmemcmp(tls, map1+9, rta+UintptrFromInt64(4), uint64(uint64(namelen))) == 0 { return 0 } i = (*Tifnamemap)(unsafe.Pointer(map1)).Fhash_next @@ -120511,12 +121459,12 @@ func _netlink_msg_to_nameindex(tls *TLS, pctx uintptr, h uintptr) (r int32) { return -int32(1) } (*Tifnameindexctx)(unsafe.Pointer(ctx)).Flist = map1 - (*Tifnameindexctx)(unsafe.Pointer(ctx)).Fallocated = uint32(a) + (*Tifnameindexctx)(unsafe.Pointer(ctx)).Fallocated = uint32(uint32(a)) } map1 = (*Tifnameindexctx)(unsafe.Pointer(ctx)).Flist + uintptr((*Tifnameindexctx)(unsafe.Pointer(ctx)).Fnum)*28 - (*Tifnamemap)(unsafe.Pointer(map1)).Findex = uint32(index) - (*Tifnamemap)(unsafe.Pointer(map1)).Fnamelen = uint8(namelen) - Xmemcpy(tls, map1+9, rta+UintptrFromInt64(4), uint64(namelen)) + (*Tifnamemap)(unsafe.Pointer(map1)).Findex = uint32(uint32(index)) + (*Tifnamemap)(unsafe.Pointer(map1)).Fnamelen = uint8(uint8(namelen)) + Xmemcpy(tls, map1+9, rta+UintptrFromInt64(4), uint64(uint64(namelen))) *(*uint32)(unsafe.Pointer(ctx + 8)) += uint32(namelen + int32(1)) (*Tifnameindexctx)(unsafe.Pointer(ctx)).Fnum++ (*Tifnamemap)(unsafe.Pointer(map1)).Fhash_next = *(*uint32)(unsafe.Pointer(ctx + 24 + uintptr(bucket)*4)) @@ -120524,6 +121472,7 @@ func _netlink_msg_to_nameindex(tls *TLS, pctx uintptr, h uintptr) (r int32) { return 0 goto _1 _1: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } return 0 @@ -120569,6 +121518,7 @@ func Xif_nameindex(tls *TLS) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = 0 goto _1 _1: + ; i-- s += 28 d += 16 @@ -120576,6 +121526,7 @@ func Xif_nameindex(tls *TLS) (r uintptr) { (*Tif_nameindex)(unsafe.Pointer(d)).Fif_index = uint32(0) (*Tif_nameindex)(unsafe.Pointer(d)).Fif_name = uintptr(0) err: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 280)), uintptr(0)) Xfree(tls, (*Tifnameindexctx)(unsafe.Pointer(ctx)).Flist) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOBUFS) @@ -120652,6 +121603,7 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) (r int32) { s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) goto _1 _1: + ; i++ } if i == int32(4) { @@ -120681,6 +121633,7 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) (r int32) { *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8((*(*[4]uint64)(unsafe.Pointer(bp)))[i]) goto _2 _2: + ; i++ } return int32(1) @@ -120766,7 +121719,7 @@ func Xinet_ntoa(tls *TLS, _in Tin_addr) (r uintptr) { var a uintptr _ = a a = bp - Xsnprintf(tls, uintptr(unsafe.Pointer(&_buf4)), uint64(16), __ccgo_ts+1062, VaList(bp+16, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3))))) + Xsnprintf(tls, uintptr(unsafe.Pointer(&_buf4)), uint64(16), __ccgo_ts+1097, VaList(bp+16, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3))))) return uintptr(unsafe.Pointer(&_buf4)) } @@ -120787,14 +121740,14 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l Tsocklen_t) (r uint a = a0 switch af { case int32(PF_INET): - if uint32(Xsnprintf(tls, s, uint64(l), __ccgo_ts+1062, VaList(bp+112, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { + if uint32(Xsnprintf(tls, s, uint64(uint64(l)), __ccgo_ts+1097, VaList(bp+112, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { return s } case int32(PF_INET6): - if Xmemcmp(tls, a, __ccgo_ts+1009, uint64(12)) != 0 { - Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1074, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) + if Xmemcmp(tls, a, __ccgo_ts+1044, uint64(12)) != 0 { + Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1109, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) } else { - Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1098, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) + Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1133, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) } /* Replace longest /(^0|:)[:0]{2,}/ with "::" */ v2 = Int32FromInt32(0) @@ -120808,13 +121761,14 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l Tsocklen_t) (r uint if i != 0 && int32((*(*[100]int8)(unsafe.Pointer(bp)))[i]) != int32(':') { goto _1 } - j = int32(Xstrspn(tls, bp+uintptr(i), __ccgo_ts+1128)) + j = int32(Xstrspn(tls, bp+uintptr(i), __ccgo_ts+1163)) if j > max { best = i max = j } goto _1 _1: + ; i++ } if max > int32(3) { @@ -120823,7 +121777,7 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l Tsocklen_t) (r uint (*(*[100]int8)(unsafe.Pointer(bp)))[best] = v3 Xmemmove(tls, bp+uintptr(best)+uintptr(2), bp+uintptr(best)+uintptr(max), uint64(i-best-max+int32(1))) } - if Xstrlen(tls, bp) < uint64(l) { + if Xstrlen(tls, bp) < uint64(uint64(l)) { Xstrcpy(tls, s, bp) return s } @@ -120877,12 +121831,13 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { v = int32(10)*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - int32('0') goto _2 _2: + ; j++ } if j == 0 || j > int32(1) && int32(*(*int8)(unsafe.Pointer(s))) == int32('0') || v > int32(255) { return 0 } - *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) + *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(uint8(v)) if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == int32(3) { return int32(1) } @@ -120892,6 +121847,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { s += uintptr(j + int32(1)) goto _1 _1: + ; i++ } return 0 @@ -120937,12 +121893,13 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { v = int32(16)*v + d goto _8 _8: + ; j++ } if j == 0 { return 0 } - (*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[i&int32(7)] = uint16(v) + (*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[i&int32(7)] = uint16(uint16(v)) if !(*(*int8)(unsafe.Pointer(s + uintptr(j))) != 0) && (brk >= 0 || i == int32(7)) { break } @@ -120961,6 +121918,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { s += uintptr(j + int32(1)) goto _6 _6: + ; i++ } if brk >= 0 { @@ -120973,6 +121931,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { (*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[brk+j] = uint16(0) goto _12 _12: + ; j++ } } @@ -120989,6 +121948,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { *(*uint8)(unsafe.Pointer(v15)) = uint8((*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[j]) goto _13 _13: + ; j++ } if need_v4 != 0 && Xinet_pton(tls, int32(PF_INET), s, a-uintptr(4)) <= 0 { @@ -121054,9 +122014,9 @@ func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) (r i } p = Xstrchr(tls, name, int32('%')) scopeid = uint64(0) - if p != 0 && int64(p)-int64(name) < int64(64) { - Xmemcpy(tls, bp+20, name, uint64(int64(p)-int64(name))) - (*(*[64]int8)(unsafe.Pointer(bp + 20)))[int64(p)-int64(name)] = 0 + if p != 0 && int64(int64(p))-int64(int64(name)) < int64(64) { + Xmemcpy(tls, bp+20, name, uint64(int64(int64(p))-int64(int64(name)))) + (*(*[64]int8)(unsafe.Pointer(bp + 20)))[int64(int64(p))-int64(int64(name))] = 0 name = bp + 20 } if Xinet_pton(tls, int32(PF_INET6), name, bp+4) <= 0 { @@ -121088,7 +122048,7 @@ func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) (r i return -int32(2) } } - (*(*Taddress)(unsafe.Pointer(buf))).Fscopeid = uint32(scopeid) + (*(*Taddress)(unsafe.Pointer(buf))).Fscopeid = uint32(uint32(scopeid)) return int32(1) } @@ -121117,6 +122077,7 @@ func _is_valid_hostname(tls *TLS, host uintptr) (r int32) { } goto _1 _1: + ; s++ } return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) @@ -121189,7 +122150,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family cnt = 0 badfam = 0 have_canon = 0 - f = X__fopen_rb_ca(tls, __ccgo_ts+998, bp+1544, bp+512, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1033, bp+1544, bp+512, uint64(1032)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -121220,6 +122181,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family v6 = BoolInt32(v5 == int32(' ') || uint32(v5)-uint32('\t') < uint32(5)) goto _7 _7: + ; if v11 = !(v6 != 0); !v11 { v8 = int32(*(*int8)(unsafe.Pointer(p + uintptr(l)))) v9 = BoolInt32(v8 == int32(' ') || uint32(v8)-uint32('\t') < uint32(5)) @@ -121232,6 +122194,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _3 _3: + ; p++ } if !(p != 0) { @@ -121251,6 +122214,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _13 _13: + ; p++ } v18 = p @@ -121281,6 +122245,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _19 _19: + ; p++ } z = p @@ -121296,12 +122261,13 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _24 _24: + ; z++ } *(*int8)(unsafe.Pointer(z)) = 0 if _is_valid_hostname(tls, p) != 0 { have_canon = int32(1) - Xmemcpy(tls, canon, p, uint64(int64(z)-int64(p)+int64(1))) + Xmemcpy(tls, canon, p, uint64(int64(int64(z))-int64(int64(p))+int64(1))) } } X__fclose_ca(tls, f) @@ -121358,7 +122324,7 @@ func _dns_parse_callback1(tls *TLS, c uintptr, rr int32, data uintptr, len1 int3 v2 = ctx + 16 v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2))++ - Xmemcpy(tls, (*Tdpc_ctx)(unsafe.Pointer(ctx)).Faddrs+uintptr(v1)*28+8, data, uint64(len1)) + Xmemcpy(tls, (*Tdpc_ctx)(unsafe.Pointer(ctx)).Faddrs+uintptr(v1)*28+8, data, uint64(uint64(len1))) return 0 } @@ -121408,6 +122374,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _1 _1: + ; i++ } if X__res_msend_rc(tls, nq, bp+10160, bp+10192, bp+10176, bp+10200, int32(4800), conf) < 0 { @@ -121429,6 +122396,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _2 _2: + ; i++ } i = nq - int32(1) @@ -121443,6 +122411,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i X__dns_parse(tls, bp+560+uintptr(i)*4800, (*(*[2]int32)(unsafe.Pointer(bp + 10200)))[i], __ccgo_fp(_dns_parse_callback1), bp+10208) goto _3 _3: + ; i-- } if (*(*Tdpc_ctx)(unsafe.Pointer(bp + 10208))).Fcnt != 0 { @@ -121492,6 +122461,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _1 _1: + ; l++ } if dots >= uint64((*(*Tresolvconf)(unsafe.Pointer(bp + 256))).Fndots) || int32(*(*int8)(unsafe.Pointer(name + uintptr(l-uint64(1))))) == int32('.') { @@ -121529,6 +122499,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _4 _4: + ; p++ } z = p @@ -121544,14 +122515,15 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _8 _8: + ; z++ } if z == p { break } - if uint64(int64(z)-int64(p)) < uint64(256)-l-uint64(1) { - Xmemcpy(tls, canon+uintptr(l)+uintptr(1), p, uint64(int64(z)-int64(p))) - *(*int8)(unsafe.Pointer(canon + uintptr(uint64(int64(z)-int64(p)+int64(1))+l))) = 0 + if uint64(int64(int64(z))-int64(int64(p))) < uint64(256)-l-uint64(1) { + Xmemcpy(tls, canon+uintptr(l)+uintptr(1), p, uint64(int64(int64(z))-int64(int64(p)))) + *(*int8)(unsafe.Pointer(canon + uintptr(uint64(int64(int64(z))-int64(int64(p))+int64(1))+l))) = 0 cnt = _name_from_dns(tls, buf, canon, canon, family, bp+256) if cnt != 0 { return cnt @@ -121559,6 +122531,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _3 _3: + ; p = z } *(*int8)(unsafe.Pointer(canon + uintptr(l))) = 0 @@ -121628,6 +122601,7 @@ func _policyof(tls *TLS, a uintptr) (r uintptr) { return uintptr(unsafe.Pointer(&_defpolicy)) + uintptr(i)*20 goto _1 _1: + ; i++ } return r @@ -121663,9 +122637,10 @@ func _prefixmatch(tls *TLS, s uintptr, d uintptr) (r int32) { } goto _1 _1: + ; i++ } - return int32(i) + return int32(int32(i)) } func _addrcmp(tls *TLS, _a uintptr, _b uintptr) (r int32) { @@ -121744,6 +122719,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _2 _2: + ; i++ } if i < cnt { @@ -121759,6 +122735,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _3 _3: + ; i++ } v5 = j @@ -121776,10 +122753,11 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i goto _6 } Xmemcpy(tls, buf+uintptr(i)*28+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) - Xmemcpy(tls, buf+uintptr(i)*28+8, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, buf+uintptr(i)*28+8, __ccgo_ts+1044, uint64(12)) (*(*Taddress)(unsafe.Pointer(buf + uintptr(i)*28))).Ffamily = int32(PF_INET6) goto _6 _6: + ; i++ } } @@ -121798,6 +122776,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _7 _7: + ; i++ } if i == cnt { @@ -121834,9 +122813,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i sa = bp + 4 *(*Tsocklen_t)(unsafe.Pointer(bp + 92)) = uint32(28) } else { - Xmemcpy(tls, bp+4+8, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, bp+4+8, __ccgo_ts+1044, uint64(12)) Xmemcpy(tls, bp+32+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) - Xmemcpy(tls, bp+32+8, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, bp+32+8, __ccgo_ts+1044, uint64(12)) Xmemcpy(tls, bp+32+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) Xmemcpy(tls, bp+76+4, buf+uintptr(i)*28+8, uint64(4)) da = bp + 76 @@ -121875,9 +122854,10 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i (*(*Taddress)(unsafe.Pointer(buf + uintptr(i)*28))).Fsortkey = key goto _8 _8: + ; i++ } - Xqsort(tls, buf, uint64(cnt), uint64(28), __ccgo_fp(_addrcmp)) + Xqsort(tls, buf, uint64(uint64(cnt)), uint64(28), __ccgo_fp(_addrcmp)) _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp)), uintptr(0)) return cnt } @@ -121928,8 +122908,8 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i return -int32(8) } (*(*Tservice)(unsafe.Pointer(buf))).Fport = uint16(0) - (*(*Tservice)(unsafe.Pointer(buf))).Fproto = uint8(proto) - (*(*Tservice)(unsafe.Pointer(buf))).Fsocktype = uint8(socktype) + (*(*Tservice)(unsafe.Pointer(buf))).Fproto = uint8(uint8(proto)) + (*(*Tservice)(unsafe.Pointer(buf))).Fsocktype = uint8(uint8(socktype)) return int32(1) } if name != 0 { @@ -121943,14 +122923,14 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i return -int32(8) } if proto != int32(IPPROTO_UDP) { - (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(port) + (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(uint16(port)) (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fsocktype = uint8(SOCK_STREAM) v1 = cnt cnt++ (*(*Tservice)(unsafe.Pointer(buf + uintptr(v1)*4))).Fproto = uint8(IPPROTO_TCP) } if proto != int32(IPPROTO_TCP) { - (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(port) + (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(uint16(port)) (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fsocktype = uint8(SOCK_DGRAM) v2 = cnt cnt++ @@ -121962,7 +122942,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i return -int32(2) } l = Xstrlen(tls, name) - f = X__fopen_rb_ca(tls, __ccgo_ts+1022, bp+1168, bp+136, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1057, bp+1168, bp+136, uint64(1032)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -122013,6 +122993,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i break goto _5 _5: + ; p++ } if !(p != 0) { @@ -122032,27 +123013,28 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i } goto _15 _15: + ; p++ } port = Xstrtoul(tls, p, bp+128, int32(10)) if port > uint64(65535) || *(*uintptr)(unsafe.Pointer(bp + 128)) == p { continue } - if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1036, uint64(4)) != 0) { + if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1071, uint64(4)) != 0) { if proto == int32(IPPROTO_TCP) { continue } - (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(port) + (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(uint16(port)) (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fsocktype = uint8(SOCK_DGRAM) v20 = cnt cnt++ (*(*Tservice)(unsafe.Pointer(buf + uintptr(v20)*4))).Fproto = uint8(IPPROTO_UDP) } - if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1041, uint64(4)) != 0) { + if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1076, uint64(4)) != 0) { if proto == int32(IPPROTO_UDP) { continue } - (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(port) + (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fport = uint16(uint16(port)) (*(*Tservice)(unsafe.Pointer(buf + uintptr(cnt)*4))).Fsocktype = uint8(SOCK_STREAM) v21 = cnt cnt++ @@ -122104,7 +123086,7 @@ func ___netlink_enumerate(tls *TLS, fd int32, seq uint32, type1 int32, af int32, } Freply [0]Tnlmsghdr Fbuf [8192]Tuint8_t - })(unsafe.Pointer(bp))))).Fnlh.Fnlmsg_type = uint16(type1) + })(unsafe.Pointer(bp))))).Fnlh.Fnlmsg_type = uint16(uint16(type1)) (*(*struct { Fnlh Tnlmsghdr Fg Trtgenmsg @@ -122137,7 +123119,7 @@ func ___netlink_enumerate(tls *TLS, fd int32, seq uint32, type1 int32, af int32, } Freply [0]Tnlmsghdr Fbuf [8192]Tuint8_t - })(unsafe.Pointer(bp))))).Fg.Frtgen_family = uint8(af) + })(unsafe.Pointer(bp))))).Fg.Frtgen_family = uint8(uint8(af)) r = int32(Xsend(tls, fd, bp, uint64(20), 0)) if r < 0 { return r @@ -122164,6 +123146,7 @@ func ___netlink_enumerate(tls *TLS, fd int32, seq uint32, type1 int32, af int32, } goto _1 _1: + ; h = h + uintptr(((*Tnlmsghdr)(unsafe.Pointer(h)).Fnlmsg_len+Uint32FromInt32(3))&uint32(^Int32FromInt32(3))) } } @@ -122232,7 +123215,7 @@ func Xns_put16(tls *TLS, s uint32, cp uintptr) { *(*uint8)(unsafe.Pointer(v1)) = uint8(s >> int32(8)) v2 = cp cp++ - *(*uint8)(unsafe.Pointer(v2)) = uint8(s) + *(*uint8)(unsafe.Pointer(v2)) = uint8(uint8(s)) } func Xns_put32(tls *TLS, l uint64, cp uintptr) { @@ -122252,7 +123235,7 @@ func Xns_put32(tls *TLS, l uint64, cp uintptr) { *(*uint8)(unsafe.Pointer(v3)) = uint8(l >> int32(8)) v4 = cp cp++ - *(*uint8)(unsafe.Pointer(v4)) = uint8(l) + *(*uint8)(unsafe.Pointer(v4)) = uint8(uint8(l)) } func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int32) { @@ -122280,6 +123263,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 *(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(i)*2)) = uint16(Xns_get16(tls, msg-uintptr(2))) goto _1 _1: + ; i++ } i = 0 @@ -122289,7 +123273,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 } if *(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(i)*2)) != 0 { *(*uintptr)(unsafe.Pointer(handle + 32 + uintptr(i)*8)) = msg - r = Xns_skiprr(tls, msg, (*Tns_msg)(unsafe.Pointer(handle)).F_eom, i, int32(*(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(i)*2)))) + r = Xns_skiprr(tls, msg, (*Tns_msg)(unsafe.Pointer(handle)).F_eom, int32(i), int32(*(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(i)*2)))) if r < 0 { return -int32(1) } @@ -122299,6 +123283,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 } goto _2 _2: + ; i++ } if msg != (*Tns_msg)(unsafe.Pointer(handle)).F_eom { @@ -122309,6 +123294,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 (*Tns_msg)(unsafe.Pointer(handle)).F_msg_ptr = UintptrFromInt32(0) return 0 bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122332,25 +123318,26 @@ func Xns_skiprr(tls *TLS, ptr uintptr, eom uintptr, section Tns_sect, count int3 if r < 0 { goto bad } - if int64(r+Int32FromInt32(2)*Int32FromInt32(NS_INT16SZ)) > int64(eom)-int64(p) { + if int64(r+Int32FromInt32(2)*Int32FromInt32(NS_INT16SZ)) > int64(int64(eom))-int64(int64(p)) { goto bad } p += uintptr(r + Int32FromInt32(2)*Int32FromInt32(NS_INT16SZ)) - if section != int32(_ns_s_qd) { - if int64(Int32FromInt32(NS_INT32SZ)+Int32FromInt32(NS_INT16SZ)) > int64(eom)-int64(p) { + if int32(section) != int32(_ns_s_qd) { + if int64(Int32FromInt32(NS_INT32SZ)+Int32FromInt32(NS_INT16SZ)) > int64(int64(eom))-int64(int64(p)) { goto bad } p += uintptr(NS_INT32SZ) p += uintptr(2) r = int32(Xns_get16(tls, p-uintptr(2))) - if int64(r) > int64(eom)-int64(p) { + if int64(int64(r)) > int64(int64(eom))-int64(int64(p)) { goto bad } p += uintptr(r) } } - return int32(int64(p) - int64(ptr)) + return int32(int64(int64(p)) - int64(int64(ptr))) bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122363,10 +123350,10 @@ func Xns_parserr(tls *TLS, handle uintptr, section Tns_sect, rrnum int32, rr uin var r int32 var p1, p2, p3, p4 uintptr _, _, _, _, _ = r, p1, p2, p3, p4 - if section < 0 || section >= int32(_ns_s_max) { + if int32(section) < 0 || int32(section) >= int32(_ns_s_max) { goto bad } - if section != (*Tns_msg)(unsafe.Pointer(handle)).F_sect { + if int32(section) != (*Tns_msg)(unsafe.Pointer(handle)).F_sect { (*Tns_msg)(unsafe.Pointer(handle)).F_sect = section (*Tns_msg)(unsafe.Pointer(handle)).F_rrnum = 0 (*Tns_msg)(unsafe.Pointer(handle)).F_msg_ptr = *(*uintptr)(unsafe.Pointer(handle + 32 + uintptr(section)*8)) @@ -122403,7 +123390,7 @@ func Xns_parserr(tls *TLS, handle uintptr, section Tns_sect, rrnum int32, rr uin p2 = handle + 72 *(*uintptr)(unsafe.Pointer(p2)) += uintptr(2) (*Tns_rr)(unsafe.Pointer(rr)).Frr_class = uint16(Xns_get16(tls, *(*uintptr)(unsafe.Pointer(p2))-uintptr(2))) - if section != int32(_ns_s_qd) { + if int32(section) != int32(_ns_s_qd) { if int64(Int32FromInt32(NS_INT32SZ)+Int32FromInt32(NS_INT16SZ)) > int64((*Tns_msg)(unsafe.Pointer(handle)).F_eom)-int64((*Tns_msg)(unsafe.Pointer(handle)).F_msg_ptr) { goto size } @@ -122425,7 +123412,7 @@ func Xns_parserr(tls *TLS, handle uintptr, section Tns_sect, rrnum int32, rr uin } (*Tns_msg)(unsafe.Pointer(handle)).F_rrnum++ if (*Tns_msg)(unsafe.Pointer(handle)).F_rrnum > int32(*(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(section)*2))) { - (*Tns_msg)(unsafe.Pointer(handle)).F_sect = section + int32(1) + (*Tns_msg)(unsafe.Pointer(handle)).F_sect = int32(section) + int32(1) if (*Tns_msg)(unsafe.Pointer(handle)).F_sect == int32(_ns_s_max) { (*Tns_msg)(unsafe.Pointer(handle)).F_rrnum = -int32(1) (*Tns_msg)(unsafe.Pointer(handle)).F_msg_ptr = UintptrFromInt32(0) @@ -122435,9 +123422,11 @@ func Xns_parserr(tls *TLS, handle uintptr, section Tns_sect, rrnum int32, rr uin } return 0 bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENODEV) return -int32(1) size: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122449,7 +123438,7 @@ func Xns_name_uncompress(tls *TLS, msg uintptr, eom uintptr, src uintptr, dst ui } var r int32 _ = r - r = Xdn_expand(tls, msg, eom, src, dst, int32(dstsiz)) + r = Xdn_expand(tls, msg, eom, src, dst, int32(int32(dstsiz))) if r < 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) } @@ -122507,7 +123496,7 @@ func Xntohs(tls *TLS, n Tuint16_t) (r Tuint16_t) { _4: v1 = int32(v3) } else { - v1 = int32(n) + v1 = int32(int32(n)) } return uint16(v1) } @@ -122536,7 +123525,7 @@ func Xgetprotoent(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - if uint64(_idx) >= uint64(239) { + if uint64(uint64(_idx)) >= uint64(239) { return UintptrFromInt32(0) } _p.Fp_proto = int32(_protos[_idx]) @@ -122638,6 +123627,7 @@ func Xrecvmmsg(tls *TLS, fd int32, msgvec uintptr, vlen uint32, flags uint32, ti (*Tmmsghdr)(unsafe.Pointer(mh)).Fmsg_hdr.F__pad1 = v2 goto _1 _1: + ; i-- mh += 64 } @@ -122682,24 +123672,28 @@ func X__convert_scm_timestamps(tls *TLS, msg uintptr, csize Tsocklen_t) { } goto _5 _3: + ; if type1 != 0 { goto _5 } type1 = int32(SO_TIMESTAMP) goto common _4: + ; type1 = int32(SO_TIMESTAMPNS) common: + ; Xmemcpy(tls, bp, cmsg+UintptrFromInt32(1)*16, uint64(8)) - (*(*[2]int64)(unsafe.Pointer(bp + 8)))[0] = *(*int64)(unsafe.Pointer(bp)) + (*(*[2]int64)(unsafe.Pointer(bp + 8)))[0] = int64(*(*int64)(unsafe.Pointer(bp))) Xmemcpy(tls, bp, cmsg+UintptrFromInt32(1)*16+uintptr(8), uint64(8)) - (*(*[2]int64)(unsafe.Pointer(bp + 8)))[int32(1)] = *(*int64)(unsafe.Pointer(bp)) + (*(*[2]int64)(unsafe.Pointer(bp + 8)))[int32(1)] = int64(*(*int64)(unsafe.Pointer(bp))) goto _5 _5: } last = cmsg goto _1 _1: + ; if uint64((*Tcmsghdr)(unsafe.Pointer(cmsg)).Fcmsg_len) < uint64(16) || (uint64((*Tcmsghdr)(unsafe.Pointer(cmsg)).Fcmsg_len)+uint64(8)-uint64(1))&uint64(^int64(Uint64FromInt64(8)-Uint64FromInt32(1)))+uint64(16) >= uint64(int64((*Tmsghdr)(unsafe.Pointer(msg)).Fmsg_control+uintptr((*Tmsghdr)(unsafe.Pointer(msg)).Fmsg_controllen))-int64(cmsg)) { v6 = uintptr(0) } else { @@ -122810,11 +123804,11 @@ func X__res_mkquery(tls *TLS, op int32, dname uintptr, class int32, type1 int32, return -int32(1) } n = int32(uint64(17) + l + BoolUint64(!!(l != 0))) - if l > uint64(253) || buflen < n || uint32(op) > uint32(15) || uint32(class) > uint32(255) || uint32(type1) > uint32(255) { + if l > uint64(253) || buflen < n || uint32(uint32(op)) > uint32(15) || uint32(uint32(class)) > uint32(255) || uint32(uint32(type1)) > uint32(255) { return -int32(1) } /* Construct query template - ID will be filled later */ - Xmemset(tls, bp, 0, uint64(n)) + Xmemset(tls, bp, 0, uint64(uint64(n))) (*(*[280]uint8)(unsafe.Pointer(bp)))[int32(2)] = uint8(op*int32(8) + int32(1)) (*(*[280]uint8)(unsafe.Pointer(bp)))[int32(3)] = uint8(32) /* AD */ (*(*[280]uint8)(unsafe.Pointer(bp)))[int32(5)] = uint8(1) @@ -122831,6 +123825,7 @@ func X__res_mkquery(tls *TLS, op int32, dname uintptr, class int32, type1 int32, } goto _2 _2: + ; j++ } if uint32(j-i)-uint32(1) > uint32(62) { @@ -122839,16 +123834,17 @@ func X__res_mkquery(tls *TLS, op int32, dname uintptr, class int32, type1 int32, (*(*[280]uint8)(unsafe.Pointer(bp)))[i-int32(1)] = uint8(j - i) goto _1 _1: + ; i = j + int32(1) } - (*(*[280]uint8)(unsafe.Pointer(bp)))[i+int32(1)] = uint8(type1) - (*(*[280]uint8)(unsafe.Pointer(bp)))[i+int32(3)] = uint8(class) + (*(*[280]uint8)(unsafe.Pointer(bp)))[i+int32(1)] = uint8(uint8(type1)) + (*(*[280]uint8)(unsafe.Pointer(bp)))[i+int32(3)] = uint8(uint8(class)) /* Make a reasonably unpredictable id */ Xclock_gettime(tls, CLOCK_REALTIME, bp+280) id = int32((uint64((*(*Ttimespec)(unsafe.Pointer(bp + 280))).Ftv_nsec) + uint64((*(*Ttimespec)(unsafe.Pointer(bp + 280))).Ftv_nsec)/uint64(65536)) & uint64(0xffff)) (*(*[280]uint8)(unsafe.Pointer(bp)))[0] = uint8(id / int32(256)) - (*(*[280]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(id) - Xmemcpy(tls, buf, bp, uint64(n)) + (*(*[280]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(uint8(id)) + Xmemcpy(tls, buf, bp, uint64(uint64(n))) return n } @@ -122972,6 +123968,7 @@ func _cleanup(tls *TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -122994,7 +123991,7 @@ func _start_tcp(tls *TLS, pfd uintptr, family int32, sa uintptr, sl Tsocklen_t, _, _ = fd, r *(*[2]Tuint8_t)(unsafe.Pointer(bp + 32)) = [2]Tuint8_t{ 0: uint8(ql >> int32(8)), - 1: uint8(ql), + 1: uint8(uint8(ql)), } *(*[2]Tiovec)(unsafe.Pointer(bp)) = [2]Tiovec{ 0: { @@ -123003,7 +124000,7 @@ func _start_tcp(tls *TLS, pfd uintptr, family int32, sa uintptr, sl Tsocklen_t, }, 1: { Fiov_base: q, - Fiov_len: uint64(ql), + Fiov_len: uint64(uint64(ql)), }, } *(*Tmsghdr)(unsafe.Pointer(bp + 40)) = Tmsghdr{ @@ -123114,18 +124111,18 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a family = int32(PF_INET) v1 = uint64(nqueries+int32(2)) * 8 pfd = Xrealloc(tls, pfd, v1) - v2 = uint64(nqueries) * 4 + v2 = uint64(uint64(nqueries)) * 4 qpos = Xrealloc(tls, qpos, v2) - v3 = uint64(nqueries) * 4 + v3 = uint64(uint64(nqueries)) * 4 apos = Xrealloc(tls, apos, v3) - v4 = uint64(nqueries) * 2 + v4 = uint64(uint64(nqueries)) * 2 alen_buf = Xrealloc(tls, alen_buf, v4) _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp+200) timeout = int32(uint32(1000) * (*Tresolvconf)(unsafe.Pointer(conf)).Ftimeout) attempts = int32((*Tresolvconf)(unsafe.Pointer(conf)).Fattempts) nns = 0 for { - if !(uint32(nns) < (*Tresolvconf)(unsafe.Pointer(conf)).Fnns) { + if !(uint32(uint32(nns)) < (*Tresolvconf)(unsafe.Pointer(conf)).Fnns) { break } iplit = conf + uintptr(nns)*28 @@ -123152,6 +124149,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _5 _5: + ; nns++ } /* Get local address and open/bind a socket */ @@ -123165,6 +124163,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _7 _7: + ; i++ } if i == nns { @@ -123192,12 +124191,13 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a goto _8 } Xmemcpy(tls, bp+116+uintptr(i)*28+8+uintptr(12), bp+116+uintptr(i)*28+4, uint64(4)) - Xmemcpy(tls, bp+116+uintptr(i)*28+8, __ccgo_ts+1009, uint64(12)) + Xmemcpy(tls, bp+116+uintptr(i)*28+8, __ccgo_ts+1044, uint64(12)) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_family = uint16(PF_INET6) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_flowinfo = uint32(0) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_scope_id = uint32(0) goto _8 _8: + ; i++ } } @@ -123205,7 +124205,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a Fsin6 [0]Tsockaddr_in6 Fsin Tsockaddr_in F__ccgo_pad2 [12]byte - })(unsafe.Pointer(bp + 88))).Fsin.Fsin_family = uint16(family) + })(unsafe.Pointer(bp + 88))).Fsin.Fsin_family = uint16(uint16(family)) if fd < 0 || Xbind(tls, fd, bp+88, sl) < 0 { if fd >= 0 { Xclose(tls, fd) @@ -123224,6 +124224,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a (*(*Tpollfd)(unsafe.Add(unsafe.Pointer(pfd), i*8))).Ffd = -int32(1) goto _9 _9: + ; i++ } (*(*Tpollfd)(unsafe.Add(unsafe.Pointer(pfd), nqueries*8))).Ffd = fd @@ -123231,15 +124232,15 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a (*(*Tpollfd)(unsafe.Add(unsafe.Pointer(pfd), (nqueries+int32(1))*8))).Ffd = -int32(2) __pthread_cleanup_push(tls, bp+208, __ccgo_fp(_cleanup), pfd) _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 200)), uintptr(0)) - Xmemset(tls, alens, 0, uint64(4)*uint64(nqueries)) + Xmemset(tls, alens, 0, uint64(4)*uint64(uint64(nqueries))) retry_interval = timeout / attempts next = 0 v10 = _mtime(tls) t2 = v10 t0 = v10 - t1 = t2 - uint64(retry_interval) + t1 = t2 - uint64(uint64(retry_interval)) for { - if !(t2-t0 < uint64(timeout)) { + if !(t2-t0 < uint64(uint64(timeout))) { break } /* This is the loop exit condition: that all queries @@ -123251,12 +124252,13 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _12 _12: + ; i++ } if i == nqueries { break } - if t2-t1 >= uint64(retry_interval) { + if t2-t1 >= uint64(uint64(retry_interval)) { /* Query all configured namservers in parallel */ i = 0 for { @@ -123272,25 +124274,27 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a Xsendto(tls, fd, *(*uintptr)(unsafe.Pointer(queries + uintptr(i)*8)), uint64(*(*int32)(unsafe.Pointer(qlens + uintptr(i)*4))), int32(MSG_NOSIGNAL), bp+116+uintptr(j)*28, sl) goto _14 _14: + ; j++ } } goto _13 _13: + ; i++ } t1 = t2 servfail_retry = int32(2) * nqueries } /* Wait for a response, or until time to retry */ - if Xpoll(tls, pfd, uint64(nqueries+int32(1)), int32(t1+uint64(retry_interval)-t2)) <= 0 { + if Xpoll(tls, pfd, uint64(nqueries+int32(1)), int32(t1+uint64(uint64(retry_interval))-t2)) <= 0 { goto _11 } for next < nqueries { *(*[1]Tiovec)(unsafe.Pointer(bp + 8)) = [1]Tiovec{ 0: { Fiov_base: *(*uintptr)(unsafe.Pointer(answers + uintptr(next)*8)), - Fiov_len: uint64(asize), + Fiov_len: uint64(uint64(asize)), }, } *(*Tmsghdr)(unsafe.Pointer(bp + 232)) = Tmsghdr{ @@ -123310,11 +124314,12 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a /* Ignore replies from addresses we didn't send to */ j = 0 for { - if !(j < nns && Xmemcmp(tls, bp+116+uintptr(j)*28, bp+88, uint64(sl)) != 0) { + if !(j < nns && Xmemcmp(tls, bp+116+uintptr(j)*28, bp+88, uint64(uint64(sl))) != 0) { break } goto _15 _15: + ; j++ } if j == nns { @@ -123328,6 +124333,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _16 _16: + ; i++ } if i == nqueries { @@ -123365,10 +124371,11 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _19 _19: + ; next++ } } else { - Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(answers + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer(answers + uintptr(next)*8)), uint64(rlen)) + Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(answers + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer(answers + uintptr(next)*8)), uint64(uint64(rlen))) } /* Ignore further UDP if all slots full or TCP-mode */ if next == nqueries { @@ -123423,6 +124430,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _20 _20: + ; i++ } i = 0 @@ -123438,7 +124446,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a }, 1: { Fiov_base: *(*uintptr)(unsafe.Pointer(answers + uintptr(i)*8)), - Fiov_len: uint64(asize), + Fiov_len: uint64(uint64(asize)), }, } *(*Tmsghdr)(unsafe.Pointer(bp + 344)) = Tmsghdr{ @@ -123474,13 +124482,16 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _21 _21: + ; i++ } goto _11 _11: + ; t2 = _mtime(tls) } out: + ; __pthread_cleanup_pop(tls, bp+208, int32(1)) /* Disregard any incomplete TCP results */ i = 0 @@ -123493,6 +124504,7 @@ out: } goto _22 _22: + ; i++ } return 0 @@ -123591,7 +124603,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ if search != 0 { *(*int8)(unsafe.Pointer(search)) = 0 } - f = X__fopen_rb_ca(tls, __ccgo_ts+1131, bp+512, bp+256, uint64(256)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1166, bp+512, bp+256, uint64(256)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -123611,14 +124623,14 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } continue } - if v4 = !(Xstrncmp(tls, bp, __ccgo_ts+1148, uint64(7)) != 0); v4 { + if v4 = !(Xstrncmp(tls, bp, __ccgo_ts+1183, uint64(7)) != 0); v4 { v1 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(7)]) v2 = BoolInt32(v1 == int32(' ') || uint32(v1)-uint32('\t') < uint32(5)) goto _3 _3: } if v4 && v2 != 0 { - p = Xstrstr(tls, bp, __ccgo_ts+1156) + p = Xstrstr(tls, bp, __ccgo_ts+1191) if p != 0 && BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 6)))-uint32('0') < uint32(10)) != 0 { p += uintptr(6) x = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123631,7 +124643,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ (*Tresolvconf)(unsafe.Pointer(conf)).Fndots = uint32(v5) } } - p = Xstrstr(tls, bp, __ccgo_ts+1163) + p = Xstrstr(tls, bp, __ccgo_ts+1198) if p != 0 && BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 9)))-uint32('0') < uint32(10)) != 0 { p += uintptr(9) x1 = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123644,7 +124656,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ (*Tresolvconf)(unsafe.Pointer(conf)).Fattempts = uint32(v6) } } - p = Xstrstr(tls, bp, __ccgo_ts+1173) + p = Xstrstr(tls, bp, __ccgo_ts+1208) if p != 0 && (BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 8)))-uint32('0') < uint32(10)) != 0 || int32(*(*int8)(unsafe.Pointer(p + 8))) == int32('.')) { p += uintptr(8) x2 = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123659,7 +124671,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } continue } - if v11 = !(Xstrncmp(tls, bp, __ccgo_ts+1182, uint64(10)) != 0); v11 { + if v11 = !(Xstrncmp(tls, bp, __ccgo_ts+1217, uint64(10)) != 0); v11 { v8 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(10)]) v9 = BoolInt32(v8 == int32(' ') || uint32(v8)-uint32('\t') < uint32(5)) goto _10 @@ -123680,6 +124692,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _12 _12: + ; p++ } *(*uintptr)(unsafe.Pointer(bp + 744)) = p @@ -123695,6 +124708,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _16 _16: + ; *(*uintptr)(unsafe.Pointer(bp + 744))++ } *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 744)))) = 0 @@ -123706,7 +124720,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ if !(search != 0) { continue } - if v24 = Xstrncmp(tls, bp, __ccgo_ts+1193, uint64(6)) != 0 && Xstrncmp(tls, bp, __ccgo_ts+1200, uint64(6)) != 0; !v24 { + if v24 = Xstrncmp(tls, bp, __ccgo_ts+1228, uint64(6)) != 0 && Xstrncmp(tls, bp, __ccgo_ts+1235, uint64(6)) != 0; !v24 { v21 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(6)]) v22 = BoolInt32(v21 == int32(' ') || uint32(v21)-uint32('\t') < uint32(5)) goto _23 @@ -123726,6 +124740,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _25 _25: + ; p++ } l = Xstrlen(tls, p) @@ -123737,11 +124752,12 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } X__fclose_ca(tls, f) no_resolv_conf: + ; if !(nns != 0) { - X__lookup_ipliteral(tls, conf, __ccgo_ts+1207, PF_UNSPEC) + X__lookup_ipliteral(tls, conf, __ccgo_ts+1242, PF_UNSPEC) nns = int32(1) } - (*Tresolvconf)(unsafe.Pointer(conf)).Fnns = uint32(nns) + (*Tresolvconf)(unsafe.Pointer(conf)).Fnns = uint32(uint32(nns)) return 0 } @@ -123769,23 +124785,25 @@ func Xsendmmsg(tls *TLS, fd int32, msgvec uintptr, vlen uint32, flags uint32) (r } i = 0 for { - if !(uint32(i) < vlen) { + if !(uint32(uint32(i)) < vlen) { break } /* As an unfortunate inconsistency, the sendmmsg API uses * unsigned int for the resulting msg_len, despite sendmsg * returning ssize_t. However Linux limits the total bytes * sent by sendmsg to INT_MAX, so the assignment is safe. */ - r = Xsendmsg(tls, fd, msgvec+uintptr(i)*64, int32(flags)) + r = Xsendmsg(tls, fd, msgvec+uintptr(i)*64, int32(int32(flags))) if r < 0 { goto error } - (*(*Tmmsghdr)(unsafe.Pointer(msgvec + uintptr(i)*64))).Fmsg_len = uint32(r) + (*(*Tmmsghdr)(unsafe.Pointer(msgvec + uintptr(i)*64))).Fmsg_len = uint32(uint32(r)) goto _1 _1: + ; i++ } error: + ; if i != 0 { v2 = i } else { @@ -123835,6 +124853,7 @@ func Xsendmsg(tls *TLS, fd int32, msg uintptr, flags int32) (r1 Tssize_t) { (*Tcmsghdr)(unsafe.Pointer(c)).F__pad1 = 0 goto _2 _2: + ; if uint64((*Tcmsghdr)(unsafe.Pointer(c)).Fcmsg_len) < uint64(16) || (uint64((*Tcmsghdr)(unsafe.Pointer(c)).Fcmsg_len)+uint64(8)-uint64(1))&uint64(^int64(Uint64FromInt64(8)-Uint64FromInt32(1)))+uint64(16) >= uint64(int64((*Tmsghdr)(unsafe.Pointer(bp)).Fmsg_control+uintptr((*Tmsghdr)(unsafe.Pointer(bp)).Fmsg_controllen))-int64(c)) { v4 = uintptr(0) } else { @@ -123965,7 +124984,7 @@ _9: if true { break } - if uint64(optlen) < uint64(16) { + if uint64(uint64(optlen)) < uint64(16) { return int32(X__syscall_ret(tls, uint64(-Int32FromInt32(EINVAL)))) } tv = optval @@ -124047,7 +125066,7 @@ _9: } } } - return int32(X__syscall_ret(tls, uint64(r1))) + return int32(X__syscall_ret(tls, uint64(uint64(r1)))) } func Xshutdown(tls *TLS, fd int32, how int32) (r1 int32) { @@ -124149,7 +125168,7 @@ _9: _18: s = int32(v17) if s < 0 { - return int32(X__syscall_ret(tls, uint64(s))) + return int32(X__syscall_ret(tls, uint64(uint64(s)))) } if type1&int32(SOCK_CLOEXEC) != 0 { X__syscall3(tls, int64(SYS_fcntl), int64(s), int64(Int32FromInt32(F_SETFD)), int64(Int32FromInt32(FD_CLOEXEC))) @@ -124158,7 +125177,7 @@ _9: X__syscall3(tls, int64(SYS_fcntl), int64(s), int64(Int32FromInt32(F_SETFL)), int64(Int32FromInt32(O_NONBLOCK))) } } - return int32(X__syscall_ret(tls, uint64(s))) + return int32(X__syscall_ret(tls, uint64(uint64(s)))) } func Xsocketpair(tls *TLS, domain int32, type1 int32, protocol int32, fd uintptr) (r2 int32) { @@ -124230,16 +125249,6 @@ _9: const SHADOW = "/etc/shadow" -type Tpasswd = struct { - Fpw_name uintptr - Fpw_passwd uintptr - Fpw_uid Tuid_t - Fpw_gid Tgid_t - Fpw_gecos uintptr - Fpw_dir uintptr - Fpw_shell uintptr -} - type Tgroup = struct { Fgr_name uintptr Fgr_passwd uintptr @@ -124271,11 +125280,11 @@ func Xfgetgrent(tls *TLS, f uintptr) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgrent_a(tls, f, uintptr(unsafe.Pointer(&_gr)), uintptr(unsafe.Pointer(&_line)), bp+8, uintptr(unsafe.Pointer(&_mem)), bp+16, bp) + X__getgrent_a(tls, f, uintptr(unsafe.Pointer(&_gr)), uintptr(unsafe.Pointer(&_line1)), bp+8, uintptr(unsafe.Pointer(&_mem)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } -var _line uintptr +var _line1 uintptr var _mem uintptr @@ -124291,11 +125300,11 @@ func Xfgetpwent(tls *TLS, f uintptr) (r uintptr) { var _ /* res at bp+8 */ uintptr var _ /* size at bp+0 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0) - X__getpwent_a(tls, f, uintptr(unsafe.Pointer(&_pw)), uintptr(unsafe.Pointer(&_line1)), bp, bp+8) + X__getpwent_a(tls, f, uintptr(unsafe.Pointer(&_pw)), uintptr(unsafe.Pointer(&_line2)), bp, bp+8) return *(*uintptr)(unsafe.Pointer(bp + 8)) } -var _line1 uintptr +var _line2 uintptr var _pw Tpasswd @@ -124369,7 +125378,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz rv = 0 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp) - f = Xfopen(tls, __ccgo_ts+1217, __ccgo_ts+1228) + f = Xfopen(tls, __ccgo_ts+1252, __ccgo_ts+381) if !(f != 0) { rv = *(*int32)(unsafe.Pointer(X__errno_location(tls))) goto done @@ -124453,6 +125462,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz grlist_len += uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 44))) goto _3 _3: + ; i++ } if len1 > *(*Tsize_t)(unsafe.Pointer(size)) || !(*(*uintptr)(unsafe.Pointer(buf)) != 0) { @@ -124501,6 +125511,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz } goto _9 _9: + ; ptr++ } *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(mem)) + uintptr(i)*8)) = uintptr(0) @@ -124525,10 +125536,12 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz } *(*uintptr)(unsafe.Pointer(res)) = gr cleanup_f: + ; Xfclose(tls, f) goto done } done: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp)), uintptr(0)) if rv != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = rv @@ -124559,7 +125572,7 @@ func _getgr_r(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, size rv = int32(ERANGE) } if *(*uintptr)(unsafe.Pointer(res)) != 0 { - buf += uintptr((uint64(16) - uint64(buf)) % uint64(16)) + buf += uintptr((uint64(16) - uint64(uint64(buf))) % uint64(16)) (*Tgroup)(unsafe.Pointer(gr)).Fgr_mem = buf buf += uintptr((*(*Tsize_t)(unsafe.Pointer(bp + 24)) + uint64(1)) * uint64(8)) Xmemcpy(tls, buf, *(*uintptr)(unsafe.Pointer(bp)), *(*Tsize_t)(unsafe.Pointer(bp + 8))) @@ -124573,6 +125586,7 @@ func _getgr_r(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, size *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)) = uintptr(int64(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(i)*8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))) + buf goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)) = uintptr(0) @@ -124602,8 +125616,8 @@ func Xgetgrgid_r(tls *TLS, gid Tgid_t, gr uintptr, buf uintptr, size Tsize_t, re return _getgr_r(tls, uintptr(0), gid, gr, buf, size, res) } -var _f uintptr -var _line2 uintptr +var _f1 uintptr +var _line3 uintptr var _mem1 uintptr var _gr1 Tgroup @@ -124611,10 +125625,10 @@ func Xsetgrent(tls *TLS) { if __ccgo_strace { trc("tls=%v, (%v:)", tls, origin(2)) } - if _f != 0 { - Xfclose(tls, _f) + if _f1 != 0 { + Xfclose(tls, _f1) } - _f = uintptr(0) + _f1 = uintptr(0) } func Xgetgrent(tls *TLS) (r uintptr) { @@ -124629,13 +125643,13 @@ func Xgetgrent(tls *TLS) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - if !(_f != 0) { - _f = Xfopen(tls, __ccgo_ts+1217, __ccgo_ts+1228) + if !(_f1 != 0) { + _f1 = Xfopen(tls, __ccgo_ts+1252, __ccgo_ts+381) } - if !(_f != 0) { + if !(_f1 != 0) { return uintptr(0) } - X__getgrent_a(tls, _f, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgrent_a(tls, _f1, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124651,7 +125665,7 @@ func Xgetgrgid(tls *TLS, gid Tgid_t) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgr_a(tls, uintptr(0), gid, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgr_a(tls, uintptr(0), gid, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124667,7 +125681,7 @@ func Xgetgrnam(tls *TLS, name uintptr) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgr_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgr_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124689,6 +125703,7 @@ func _atou(tls *TLS, s uintptr) (r uint32) { x = uint32(10)*x + uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-Int32FromUint8('0')) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return x @@ -124769,6 +125784,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } goto _10 _10: + ; *(*uintptr)(unsafe.Pointer(bp))++ } Xfree(tls, *(*uintptr)(unsafe.Pointer(mem))) @@ -124798,6 +125814,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } goto _11 _11: + ; *(*uintptr)(unsafe.Pointer(bp))++ } i++ @@ -124808,6 +125825,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } (*Tgroup)(unsafe.Pointer(gr)).Fgr_mem = *(*uintptr)(unsafe.Pointer(mem)) end: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(res)) = gr if rv != 0 { @@ -124880,12 +125898,13 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u *(*Tuint32_t)(unsafe.Pointer(nscdbuf + uintptr(i)*4)) = v4 goto _2 _2: + ; i++ } } } Xfclose(tls, f) - f = Xfopen(tls, __ccgo_ts+1217, __ccgo_ts+1228) + f = Xfopen(tls, __ccgo_ts+1252, __ccgo_ts+381) if !(f != 0) && *(*int32)(unsafe.Pointer(X__errno_location(tls))) != int32(ENOENT) && *(*int32)(unsafe.Pointer(X__errno_location(tls))) != int32(ENOTDIR) { goto cleanup } @@ -124907,6 +125926,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _7 _7: + ; i++ } } @@ -124917,6 +125937,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _8 _8: + ; i++ } if !(*(*uintptr)(unsafe.Pointer((*(*Tgroup)(unsafe.Pointer(bp))).Fgr_mem + uintptr(i)*8)) != 0) { @@ -124924,7 +125945,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } n++ v9 = n - if v9 <= int64(nlim) { + if v9 <= int64(int64(nlim)) { v10 = groups groups += 4 *(*Tgid_t)(unsafe.Pointer(v10)) = (*(*Tgroup)(unsafe.Pointer(bp))).Fgr_gid @@ -124944,7 +125965,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u if *(*Tuint32_t)(unsafe.Pointer(nscdbuf + uintptr(i)*4)) != gid { n++ v12 = n - if v12 <= int64(nlim) { + if v12 <= int64(int64(nlim)) { v13 = groups groups += 4 *(*Tgid_t)(unsafe.Pointer(v13)) = *(*Tuint32_t)(unsafe.Pointer(nscdbuf + uintptr(i)*4)) @@ -124952,17 +125973,19 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _11 _11: + ; i++ } } - if n > int64(nlim) { + if n > int64(int64(nlim)) { v14 = int64(-int32(1)) } else { v14 = n } ret = int32(v14) - *(*int32)(unsafe.Pointer(ngroups)) = int32(n) + *(*int32)(unsafe.Pointer(ngroups)) = int32(int32(n)) cleanup: + ; if f != 0 { Xfclose(tls, f) } @@ -125007,7 +126030,7 @@ func X__getpw_a(tls *TLS, name uintptr, uid Tuid_t, pw uintptr, buf uintptr, siz rv = 0 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp+4) - f = Xfopen(tls, __ccgo_ts+1232, __ccgo_ts+1228) + f = Xfopen(tls, __ccgo_ts+1263, __ccgo_ts+381) if !(f != 0) { rv = *(*int32)(unsafe.Pointer(X__errno_location(tls))) goto done @@ -125109,10 +126132,12 @@ func X__getpw_a(tls *TLS, name uintptr, uid Tuid_t, pw uintptr, buf uintptr, siz } *(*uintptr)(unsafe.Pointer(res)) = pw cleanup_f: + ; Xfclose(tls, f) goto done } done: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) if rv != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = rv @@ -125169,8 +126194,8 @@ func Xgetpwuid_r(tls *TLS, uid Tuid_t, pw uintptr, buf uintptr, size Tsize_t, re return _getpw_r(tls, uintptr(0), uid, pw, buf, size, res) } -var _f1 uintptr -var _line3 uintptr +var _f2 uintptr +var _line4 uintptr var _pw1 Tpasswd var _size Tsize_t @@ -125178,10 +126203,10 @@ func Xsetpwent(tls *TLS) { if __ccgo_strace { trc("tls=%v, (%v:)", tls, origin(2)) } - if _f1 != 0 { - Xfclose(tls, _f1) + if _f2 != 0 { + Xfclose(tls, _f2) } - _f1 = uintptr(0) + _f2 = uintptr(0) } func Xgetpwent(tls *TLS) (r uintptr) { @@ -125192,13 +126217,13 @@ func Xgetpwent(tls *TLS) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - if !(_f1 != 0) { - _f1 = Xfopen(tls, __ccgo_ts+1232, __ccgo_ts+1228) + if !(_f2 != 0) { + _f2 = Xfopen(tls, __ccgo_ts+1263, __ccgo_ts+381) } - if !(_f1 != 0) { + if !(_f2 != 0) { return uintptr(0) } - X__getpwent_a(tls, _f1, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpwent_a(tls, _f2, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -125210,7 +126235,7 @@ func Xgetpwuid(tls *TLS, uid Tuid_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - X__getpw_a(tls, uintptr(0), uid, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpw_a(tls, uintptr(0), uid, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -125222,7 +126247,7 @@ func Xgetpwnam(tls *TLS, name uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - X__getpw_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpw_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -125244,6 +126269,7 @@ func _atou1(tls *TLS, s uintptr) (r uint32) { x = uint32(10)*x + uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-Int32FromUint8('0')) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return x @@ -125427,12 +126453,13 @@ func X__nscd_query(tls *TLS, req Tint32_t, key uintptr, buf uintptr, len1 Tsize_ errno_save = *(*int32)(unsafe.Pointer(X__errno_location(tls))) *(*int32)(unsafe.Pointer(swap)) = 0 retry: + ; Xmemset(tls, buf, 0, len1) *(*Tint32_t)(unsafe.Pointer(buf)) = int32(NSCDVERSION) fd = Xsocket(tls, int32(PF_LOCAL), Int32FromInt32(SOCK_STREAM)|Int32FromInt32(SOCK_CLOEXEC), 0) if fd < 0 { if *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EAFNOSUPPORT) { - f = Xfopen(tls, __ccgo_ts+1244, __ccgo_ts+1254) + f = Xfopen(tls, __ccgo_ts+1275, __ccgo_ts+1285) if f != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = errno_save } @@ -125440,7 +126467,7 @@ retry: } return uintptr(0) } - v1 = Xfdopen(tls, fd, __ccgo_ts+1257) + v1 = Xfdopen(tls, fd, __ccgo_ts+1288) f = v1 if !(v1 != 0) { Xclose(tls, fd) @@ -125486,6 +126513,7 @@ retry: (*(*[3]Tint32_t)(unsafe.Pointer(bp + 32)))[i] = int32(v4) goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(swap)) = int32(1) @@ -125508,6 +126536,7 @@ retry: *(*Tint32_t)(unsafe.Pointer(buf + uintptr(i)*4)) = int32(v8) goto _6 _6: + ; i++ } } @@ -125521,6 +126550,7 @@ retry: } return f error: + ; Xfclose(tls, f) return uintptr(0) } @@ -125537,7 +126567,7 @@ func Xputgrent(tls *TLS, gr uintptr, f uintptr) (r1 int32) { var v4 uintptr _, _, _, _, _, _ = i, r, v1, v3, v4, v5 Xflockfile(tls, f) - v1 = Xfprintf(tls, f, __ccgo_ts+1259, VaList(bp+8, (*Tgroup)(unsafe.Pointer(gr)).Fgr_name, (*Tgroup)(unsafe.Pointer(gr)).Fgr_passwd, (*Tgroup)(unsafe.Pointer(gr)).Fgr_gid)) + v1 = Xfprintf(tls, f, __ccgo_ts+1290, VaList(bp+8, (*Tgroup)(unsafe.Pointer(gr)).Fgr_name, (*Tgroup)(unsafe.Pointer(gr)).Fgr_passwd, (*Tgroup)(unsafe.Pointer(gr)).Fgr_gid)) r = v1 if v1 < 0 { goto done @@ -125549,22 +126579,24 @@ func Xputgrent(tls *TLS, gr uintptr, f uintptr) (r1 int32) { break } if i != 0 { - v4 = __ccgo_ts + 1269 + v4 = __ccgo_ts + 1300 } else { v4 = __ccgo_ts } - v3 = Xfprintf(tls, f, __ccgo_ts+1271, VaList(bp+8, v4, *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)))) + v3 = Xfprintf(tls, f, __ccgo_ts+1302, VaList(bp+8, v4, *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)))) r = v3 if v3 < 0 { goto done } goto _2 _2: + ; i++ } } r = Xfputc(tls, int32('\n'), f) done: + ; Xfunlockfile(tls, f) if r < 0 { v5 = -int32(1) @@ -125583,7 +126615,7 @@ func Xputpwent(tls *TLS, pw uintptr, f uintptr) (r int32) { defer tls.Free(64) var v1 int32 _ = v1 - if Xfprintf(tls, f, __ccgo_ts+1276, VaList(bp+8, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_name, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_passwd, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_uid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gecos, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_dir, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_shell)) < 0 { + if Xfprintf(tls, f, __ccgo_ts+1307, VaList(bp+8, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_name, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_passwd, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_uid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gecos, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_dir, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_shell)) < 0 { v1 = -int32(1) } else { v1 = 0 @@ -125683,7 +126715,7 @@ func Xputspent(tls *TLS, sp uintptr, f uintptr) (r int32) { } else { v17 = (*Tspwd)(unsafe.Pointer(sp)).Fsp_flag } - if Xfprintf(tls, f, __ccgo_ts+1298, VaList(bp+8, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)) < 0 { + if Xfprintf(tls, f, __ccgo_ts+1329, VaList(bp+8, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)) < 0 { v1 = -int32(1) } else { v1 = 0 @@ -125698,13 +126730,13 @@ func X__rand48_step(tls *TLS, xi uintptr, lc uintptr) (r Tuint64_t) { } var a, x Tuint64_t _, _ = a, x - x = uint64(uint32(*(*uint16)(unsafe.Pointer(xi)))|(uint32(*(*uint16)(unsafe.Pointer(xi + 1*2)))+0)<> int32(16)) *(*uint16)(unsafe.Pointer(xi + 2*2)) = uint16(x >> int32(32)) - return x & uint64(0xffffffffffff) + return uint64(uint64(uint64(x)) & uint64(0xffffffffffff)) } func Xerand48(tls *TLS, s uintptr) (r float64) { @@ -125725,7 +126757,7 @@ func Xerand48(tls *TLS, s uintptr) (r float64) { Ff [0]float64 Fu Tuint64_t }{} - *(*uint64)(unsafe.Pointer(bp)) = uint64(0x3ff0000000000000) | X__rand48_step(tls, s, uintptr(unsafe.Pointer(&X__seed48))+uintptr(3)*2)< %v", r) }() } - _seed = uint64(6364136223846793005)*_seed + uint64(1) + _seed = uint64(uint64(6364136223846793005)*uint64(uint64(_seed)) + uint64(1)) return int32(_seed >> int32(33)) } @@ -125865,7 +126897,7 @@ func _lcg31(tls *TLS, x Tuint32_t) (r Tuint32_t) { } func _lcg64(tls *TLS, x Tuint64_t) (r Tuint64_t) { - return uint64(6364136223846793005)*x + uint64(1) + return uint64(uint64(6364136223846793005)*uint64(uint64(x)) + uint64(1)) } func _savestate(tls *TLS) (r uintptr) { @@ -125884,9 +126916,9 @@ func ___srandom(tls *TLS, seed uint32) { var k, v1 int32 var s Tuint64_t _, _, _ = k, s, v1 - s = uint64(seed) + s = uint64(uint64(seed)) if _n == 0 { - *(*Tuint32_t)(unsafe.Pointer(_x1)) = uint32(s) + *(*Tuint32_t)(unsafe.Pointer(_x1)) = uint32(uint32(s)) return } if _n == int32(31) || _n == int32(7) { @@ -125905,6 +126937,7 @@ func ___srandom(tls *TLS, seed uint32) { *(*Tuint32_t)(unsafe.Pointer(_x1 + uintptr(k)*4)) = uint32(s >> int32(32)) goto _2 _2: + ; k++ } /* make sure x contains at least one odd number */ @@ -125999,6 +127032,7 @@ func Xrandom(tls *TLS) (r int64) { _j = 0 } end: + ; ___unlock(tls, uintptr(unsafe.Pointer(&_lock3))) return k } @@ -126023,7 +127057,7 @@ func Xsrand48(tls *TLS, seed int64) { defer tls.Free(16) *(*[3]uint16)(unsafe.Pointer(bp)) = [3]uint16{ 0: uint16(0x330e), - 1: uint16(seed), + 1: uint16(uint16(seed)), 2: uint16(seed >> int32(16)), } Xseed48(tls, bp) @@ -126048,6 +127082,7 @@ func Xexecl(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -126063,6 +127098,7 @@ func Xexecl(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = UintptrFromInt32(0) @@ -126090,6 +127126,7 @@ func Xexecle(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -126105,6 +127142,7 @@ func Xexecle(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } envp = VaUintptr(&ap) @@ -126132,6 +127170,7 @@ func Xexeclp(tls *TLS, file uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -126147,6 +127186,7 @@ func Xexeclp(tls *TLS, file uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = UintptrFromInt32(0) @@ -126183,7 +127223,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { var v2 t__predefined_size_t _, _, _, _, _, _, _, _, _, _ = b, k, l, p, path, seen_eacces, z, v2, v3, v4 defer func() { Xrealloc(tls, b, 0) }() - path = Xgetenv(tls, __ccgo_ts+1347) + path = Xgetenv(tls, __ccgo_ts+1378) seen_eacces = 0 *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOENT) if !(*(*int8)(unsafe.Pointer(file)) != 0) { @@ -126193,7 +127233,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { return Xexecve(tls, file, argv, envp) } if !(path != 0) { - path = __ccgo_ts + 1352 + path = __ccgo_ts + 1383 } k = Xstrnlen(tls, file, uint64(Int32FromInt32(NAME_MAX)+Int32FromInt32(1))) if k > uint64(NAME_MAX) { @@ -126206,7 +127246,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { v2 = l + k + uint64(1) b = Xrealloc(tls, b, v2) z = X__strchrnul(tls, p, int32(':')) - if uint64(int64(z)-int64(p)) >= l { + if uint64(int64(int64(z))-int64(int64(p))) >= l { v3 = z z++ if !(*(*int8)(unsafe.Pointer(v3)) != 0) { @@ -126214,9 +127254,9 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { } goto _1 } - Xmemcpy(tls, b, p, uint64(int64(z)-int64(p))) - *(*int8)(unsafe.Add(unsafe.Pointer(b), int64(z)-int64(p))) = int8('/') - Xmemcpy(tls, b+uintptr(int64(z)-int64(p))+BoolUintptr(z > p), file, k+uint64(1)) + Xmemcpy(tls, b, p, uint64(int64(int64(z))-int64(int64(p)))) + *(*int8)(unsafe.Add(unsafe.Pointer(b), int64(int64(z))-int64(int64(p)))) = int8('/') + Xmemcpy(tls, b+uintptr(int64(int64(z))-int64(int64(p)))+BoolUintptr(z > p), file, k+uint64(1)) Xexecve(tls, b, argv, envp) switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(EACCES): @@ -126235,6 +127275,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { } goto _1 _1: + ; p = z } if seen_eacces != 0 { @@ -126271,9 +127312,9 @@ func Xfexecve(tls *TLS, fd int32, argv uintptr, envp uintptr) (r1 int32) { _ = r r = int32(X__syscall5(tls, int64(SYS_execveat), int64(fd), int64(__ccgo_ts), int64(argv), int64(envp), int64(Int32FromInt32(AT_EMPTY_PATH)))) if r != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } - X__procfdname(tls, bp, uint32(fd)) + X__procfdname(tls, bp, uint32(uint32(fd))) Xexecve(tls, bp, argv, envp) if *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(ENOENT) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EBADF) @@ -126593,10 +127634,10 @@ func Xposix_spawnattr_setflags(tls *TLS, attr uintptr, flags int16) (r int32) { var all_flags uint32 _ = all_flags all_flags = uint32(Int32FromInt32(POSIX_SPAWN_RESETIDS) | Int32FromInt32(POSIX_SPAWN_SETPGROUP) | Int32FromInt32(POSIX_SPAWN_SETSIGDEF) | Int32FromInt32(POSIX_SPAWN_SETSIGMASK) | Int32FromInt32(POSIX_SPAWN_SETSCHEDPARAM) | Int32FromInt32(POSIX_SPAWN_SETSCHEDULER) | Int32FromInt32(POSIX_SPAWN_USEVFORK) | Int32FromInt32(POSIX_SPAWN_SETSID)) - if uint32(flags) & ^all_flags != 0 { + if uint32(uint32(flags)) & ^all_flags != 0 { return int32(EINVAL) } - (*Tposix_spawnattr_t)(unsafe.Pointer(attr)).F__flags = int32(flags) + (*Tposix_spawnattr_t)(unsafe.Pointer(attr)).F__flags = int32(int32(flags)) return 0 } @@ -126690,7 +127731,7 @@ func _str_next(tls *TLS, str uintptr, n Tsize_t, step uintptr) (r int32) { *(*Tsize_t)(unsafe.Pointer(step)) = uint64(1) return -int32(1) } - *(*Tsize_t)(unsafe.Pointer(step)) = uint64(k) + *(*Tsize_t)(unsafe.Pointer(step)) = uint64(uint64(k)) return *(*Twchar_t)(unsafe.Pointer(bp)) } *(*Tsize_t)(unsafe.Pointer(step)) = uint64(1) @@ -126747,6 +127788,7 @@ func _pat_next(tls *TLS, pat uintptr, m Tsize_t, step uintptr, flags int32) (r i } goto _1 _1: + ; k++ } if k == m || !(*(*int8)(unsafe.Pointer(pat + uintptr(k))) != 0) { @@ -126763,6 +127805,7 @@ func _pat_next(tls *TLS, pat uintptr, m Tsize_t, step uintptr, flags int32) (r i return -int32(4) } escaped: + ; if uint32(*(*int8)(unsafe.Pointer(pat))) >= uint32(128) { k1 = Xmbtowc(tls, bp, pat, m) if k1 < 0 { @@ -126779,11 +127822,11 @@ func _casefold(tls *TLS, k int32) (r int32) { var c int32 var v1 uint32 _, _ = c, v1 - c = int32(Xtowupper(tls, uint32(k))) + c = int32(Xtowupper(tls, uint32(uint32(k)))) if c == k { - v1 = Xtowlower(tls, uint32(k)) + v1 = Xtowlower(tls, uint32(uint32(k))) } else { - v1 = uint32(c) + v1 = uint32(uint32(c)) } return int32(v1) } @@ -126827,7 +127870,7 @@ func _match_bracket(tls *TLS, p uintptr, k int32, kfold int32) (r int32) { return 0 } if *(*Twchar_t)(unsafe.Pointer(bp)) <= *(*Twchar_t)(unsafe.Pointer(bp + 4)) { - if uint32(k)-uint32(*(*Twchar_t)(unsafe.Pointer(bp))) <= uint32(*(*Twchar_t)(unsafe.Pointer(bp + 4))-*(*Twchar_t)(unsafe.Pointer(bp))) || uint32(kfold)-uint32(*(*Twchar_t)(unsafe.Pointer(bp))) <= uint32(*(*Twchar_t)(unsafe.Pointer(bp + 4))-*(*Twchar_t)(unsafe.Pointer(bp))) { + if uint32(uint32(k))-uint32(*(*Twchar_t)(unsafe.Pointer(bp))) <= uint32(*(*Twchar_t)(unsafe.Pointer(bp + 4))-*(*Twchar_t)(unsafe.Pointer(bp))) || uint32(uint32(kfold))-uint32(*(*Twchar_t)(unsafe.Pointer(bp))) <= uint32(*(*Twchar_t)(unsafe.Pointer(bp + 4))-*(*Twchar_t)(unsafe.Pointer(bp))) { return BoolInt32(!(inv != 0)) } } @@ -126841,10 +127884,10 @@ func _match_bracket(tls *TLS, p uintptr, k int32, kfold int32) (r int32) { for int32(*(*int8)(unsafe.Pointer(p + uintptr(-Int32FromInt32(1))))) != z || int32(*(*int8)(unsafe.Pointer(p))) != int32(']') { p++ } - if z == int32(':') && int64(p-uintptr(1))-int64(p0) < int64(16) { - Xmemcpy(tls, bp+8, p0, uint64(int64(p-uintptr(1))-int64(p0))) - (*(*[16]int8)(unsafe.Pointer(bp + 8)))[int64(p-uintptr(1))-int64(p0)] = 0 - if Xiswctype(tls, uint32(k), Xwctype(tls, bp+8)) != 0 || Xiswctype(tls, uint32(kfold), Xwctype(tls, bp+8)) != 0 { + if z == int32(':') && int64(p-uintptr(1))-int64(int64(p0)) < int64(16) { + Xmemcpy(tls, bp+8, p0, uint64(int64(p-uintptr(1))-int64(int64(p0)))) + (*(*[16]int8)(unsafe.Pointer(bp + 8)))[int64(p-uintptr(1))-int64(int64(p0))] = 0 + if Xiswctype(tls, uint32(uint32(k)), Xwctype(tls, bp+8)) != 0 || Xiswctype(tls, uint32(uint32(kfold)), Xwctype(tls, bp+8)) != 0 { return BoolInt32(!(inv != 0)) } } @@ -126864,6 +127907,7 @@ func _match_bracket(tls *TLS, p uintptr, k int32, kfold int32) (r int32) { } goto _1 _1: + ; p++ } return inv @@ -126940,7 +127984,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, if !(p < endpat) { break } - switch _pat_next(tls, p, uint64(int64(endpat)-int64(p)), bp, flags) { + switch _pat_next(tls, p, uint64(int64(int64(endpat))-int64(int64(p))), bp, flags) { case -int32(2): return int32(FNM_NOMATCH) case -int32(5): @@ -126952,6 +127996,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } goto _5 _5: + ; p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) } /* Past this point we need not check for UNMATCHABLE in pat, @@ -126971,7 +128016,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, break } if v9 = uint32(*(*int8)(unsafe.Pointer(s + uintptr(-Int32FromInt32(1))))) < uint32(128); !v9 { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v8 = int32(4) } else { v8 = int32(1) @@ -126990,6 +128035,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } goto _7 _7: + ; tailcnt-- } if tailcnt != 0 { @@ -126999,9 +128045,9 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, /* Check that the pat and str tails match */ p = ptail for { - c = _pat_next(tls, p, uint64(int64(endpat)-int64(p)), bp, flags) + c = _pat_next(tls, p, uint64(int64(int64(endpat))-int64(int64(p))), bp, flags) p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) - v12 = _str_next(tls, s, uint64(int64(endstr)-int64(s)), bp+8) + v12 = _str_next(tls, s, uint64(int64(int64(endstr))-int64(int64(s))), bp+8) k = v12 if v12 <= 0 { if c != END { @@ -127036,7 +128082,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, p = pat s = str for { - c = _pat_next(tls, p, uint64(int64(endpat)-int64(p)), bp, flags) + c = _pat_next(tls, p, uint64(int64(int64(endpat))-int64(int64(p))), bp, flags) p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) /* Encountering * completes/commits a component */ if c == -int32(5) { @@ -127044,7 +128090,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, str = s break } - k = _str_next(tls, s, uint64(int64(endstr)-int64(s)), bp+8) + k = _str_next(tls, s, uint64(int64(int64(endstr))-int64(int64(s))), bp+8) if !(k != 0) { return int32(FNM_NOMATCH) } @@ -127072,17 +128118,18 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } /* If we failed, advance str, by 1 char if it's a valid * char, or past all invalid bytes otherwise. */ - k = _str_next(tls, str, uint64(int64(endstr)-int64(str)), bp+8) + k = _str_next(tls, str, uint64(int64(int64(endstr))-int64(int64(str))), bp+8) if k > 0 { str += uintptr(*(*Tsize_t)(unsafe.Pointer(bp + 8))) } else { str++ for { - if !(_str_next(tls, str, uint64(int64(endstr)-int64(str)), bp+8) < 0) { + if !(_str_next(tls, str, uint64(int64(int64(endstr))-int64(int64(str))), bp+8) < 0) { break } goto _16 _16: + ; str++ } } @@ -127110,6 +128157,7 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { } goto _2 _2: + ; s++ } p = pat @@ -127121,12 +128169,13 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { } goto _3 _3: + ; p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) } if c != int32(*(*int8)(unsafe.Pointer(s))) && (!(*(*int8)(unsafe.Pointer(s)) != 0) || !(flags&Int32FromInt32(FNM_LEADING_DIR) != 0)) { return int32(FNM_NOMATCH) } - if _fnmatch_internal(tls, pat, uint64(int64(p)-int64(pat)), str, uint64(int64(s)-int64(str)), flags) != 0 { + if _fnmatch_internal(tls, pat, uint64(int64(int64(p))-int64(int64(pat))), str, uint64(int64(int64(s))-int64(int64(str))), flags) != 0 { return int32(FNM_NOMATCH) } if !(c != 0) { @@ -127147,11 +128196,12 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { if int32(*(*int8)(unsafe.Pointer(s))) != int32('/') { goto _5 } - if !(_fnmatch_internal(tls, pat, uint64(-Int32FromInt32(1)), str, uint64(int64(s)-int64(str)), flags) != 0) { + if !(_fnmatch_internal(tls, pat, uint64(-Int32FromInt32(1)), str, uint64(int64(int64(s))-int64(int64(str))), flags) != 0) { return 0 } goto _5 _5: + ; s++ } } @@ -127245,7 +128295,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag return 0 } pat += uintptr(i) - pos += uint64(j) + pos += uint64(uint64(j)) v4 = Int64FromInt32(0) j = v4 i = v4 @@ -127300,6 +128350,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag type1 = 0 goto _3 _3: + ; i++ } *(*int8)(unsafe.Pointer(buf + uintptr(pos))) = 0 @@ -127334,9 +128385,10 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag } goto _6 _6: + ; p-- } - if (int64(p2)-int64(p))%int64(2) != 0 { + if (int64(int64(p2))-int64(int64(p)))%int64(2) != 0 { p2-- saved_sep = int8('\\') } @@ -127344,7 +128396,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag if pos != 0 { v7 = buf } else { - v7 = __ccgo_ts + 537 + v7 = __ccgo_ts + 575 } dir = Xopendir(tls, v7) if !(dir != 0) { @@ -127434,6 +128486,7 @@ func _freelist(tls *TLS, head uintptr) { Xfree(tls, match) goto _1 _1: + ; match = next } } @@ -127466,7 +128519,7 @@ func _expand_tilde(tls *TLS, pat uintptr, buf uintptr, pos uintptr) (r int32) { if *(*int8)(unsafe.Pointer(p)) != 0 { v3 = UintptrFromInt32(0) } else { - v3 = Xgetenv(tls, __ccgo_ts+1381) + v3 = Xgetenv(tls, __ccgo_ts+1412) } home = v3 if !(home != 0) { @@ -127485,15 +128538,20 @@ func _expand_tilde(tls *TLS, pat uintptr, buf uintptr, pos uintptr) (r int32) { } goto _8 _5: + ; return int32(GLOB_NOSPACE) _7: + ; if !!(*(*uintptr)(unsafe.Pointer(bp + 48)) != 0) { goto _9 } _6: + ; return int32(GLOB_NOMATCH) _9: + ; _8: + ; home = (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_dir } for i < uint64(Int32FromInt32(PATH_MAX)-Int32FromInt32(2)) && *(*int8)(unsafe.Pointer(home)) != 0 { @@ -127581,6 +128639,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) = (*Tmatch)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fnext cnt++ } @@ -127619,6 +128678,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr(i)*8)) = UintptrFromInt32(0) goto _3 _3: + ; i++ } } @@ -127631,6 +128691,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr(offs+i)*8)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + 8 goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) = (*Tmatch)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fnext i++ } @@ -127656,6 +128717,7 @@ func Xglobfree(tls *TLS, g uintptr) { Xfree(tls, *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr((*Tglob_t)(unsafe.Pointer(g)).Fgl_offs+i)*8))-uintptr(uint64(UintptrFromInt32(0)+8))) goto _1 _1: + ; i++ } Xfree(tls, (*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv) @@ -127924,7 +128986,7 @@ func _tre_ast_new_node(tls *TLS, mem Ttre_mem_t, type1 int32, obj uintptr) (r ui return uintptr(0) } (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fobj = obj - (*Ttre_ast_node_t)(unsafe.Pointer(node)).Ftype1 = type1 + (*Ttre_ast_node_t)(unsafe.Pointer(node)).Ftype1 = int32(type1) (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fnullable = -int32(1) (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id = -int32(1) return node @@ -127938,8 +129000,8 @@ func _tre_ast_new_literal(tls *TLS, mem Ttre_mem_t, code_min int32, code_max int if !(node != 0) { return uintptr(0) } - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(code_min) - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(code_max) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(int64(code_min)) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(int64(code_max)) (*Ttre_literal_t)(unsafe.Pointer(lit)).Fposition = position return node } @@ -127955,7 +129017,7 @@ func _tre_ast_new_iter(tls *TLS, mem Ttre_mem_t, arg uintptr, min int32, max int (*Ttre_iteration_t)(unsafe.Pointer(iter)).Farg = arg (*Ttre_iteration_t)(unsafe.Pointer(iter)).Fmin = min (*Ttre_iteration_t)(unsafe.Pointer(iter)).Fmax = max - SetBitFieldPtr8Uint32(iter+16, uint32(minimal), 0, 0x1) + SetBitFieldPtr8Uint32(iter+16, uint32(uint32(minimal)), 0, 0x1) (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fnum_submatches = (*Ttre_ast_node_t)(unsafe.Pointer(arg)).Fnum_submatches return node } @@ -128024,7 +129086,7 @@ func _tre_stack_new(tls *TLS, size int32, max_size int32, increment int32) (r ui _ = s s = Xmalloc(tls, uint64(24)) if s != UintptrFromInt32(0) { - (*Ttre_stack_t)(unsafe.Pointer(s)).Fstack = Xmalloc(tls, uint64(8)*uint64(size)) + (*Ttre_stack_t)(unsafe.Pointer(s)).Fstack = Xmalloc(tls, uint64(8)*uint64(uint64(size))) if (*Ttre_stack_t)(unsafe.Pointer(s)).Fstack == UintptrFromInt32(0) { Xfree(tls, s) return UintptrFromInt32(0) @@ -128061,7 +129123,7 @@ func _tre_stack_push(tls *TLS, s uintptr, value Ttre_stack_item) (r Treg_errcode if new_size > (*Ttre_stack_t)(unsafe.Pointer(s)).Fmax_size { new_size = (*Ttre_stack_t)(unsafe.Pointer(s)).Fmax_size } - new_buffer = Xrealloc(tls, (*Ttre_stack_t)(unsafe.Pointer(s)).Fstack, uint64(8)*uint64(new_size)) + new_buffer = Xrealloc(tls, (*Ttre_stack_t)(unsafe.Pointer(s)).Fstack, uint64(8)*uint64(uint64(new_size))) if new_buffer == UintptrFromInt32(0) { return int32(REG_ESPACE) } @@ -128136,51 +129198,51 @@ var _tre_macros = [13]struct { }{ 0: { Fc: int8('t'), - Fexpansion: __ccgo_ts + 1386, + Fexpansion: __ccgo_ts + 1417, }, 1: { Fc: int8('n'), - Fexpansion: __ccgo_ts + 1388, + Fexpansion: __ccgo_ts + 367, }, 2: { Fc: int8('r'), - Fexpansion: __ccgo_ts + 1390, + Fexpansion: __ccgo_ts + 1419, }, 3: { Fc: int8('f'), - Fexpansion: __ccgo_ts + 1392, + Fexpansion: __ccgo_ts + 1421, }, 4: { Fc: int8('a'), - Fexpansion: __ccgo_ts + 1394, + Fexpansion: __ccgo_ts + 1423, }, 5: { Fc: int8('e'), - Fexpansion: __ccgo_ts + 1396, + Fexpansion: __ccgo_ts + 1425, }, 6: { Fc: int8('w'), - Fexpansion: __ccgo_ts + 1398, + Fexpansion: __ccgo_ts + 1427, }, 7: { Fc: int8('W'), - Fexpansion: __ccgo_ts + 1411, + Fexpansion: __ccgo_ts + 1440, }, 8: { Fc: int8('s'), - Fexpansion: __ccgo_ts + 1425, + Fexpansion: __ccgo_ts + 1454, }, 9: { Fc: int8('S'), - Fexpansion: __ccgo_ts + 1437, + Fexpansion: __ccgo_ts + 1466, }, 10: { Fc: int8('d'), - Fexpansion: __ccgo_ts + 1450, + Fexpansion: __ccgo_ts + 1479, }, 11: { Fc: int8('D'), - Fexpansion: __ccgo_ts + 1462, + Fexpansion: __ccgo_ts + 1491, }, 12: {}, } @@ -128200,6 +129262,7 @@ func _tre_expand_macro(tls *TLS, s uintptr) (r uintptr) { } goto _1 _1: + ; i++ } return _tre_macros[i].Fexpansion @@ -128256,8 +129319,8 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { /* assumes islower(c) and isupper(c) are exclusive and toupper(c)!=c if islower(c). multiple opposite case characters are not supported */ - if Xiswlower(tls, uint32(c)) != 0 { - v2 = int32(Xtowupper(tls, uint32(c))) + if Xiswlower(tls, uint32(uint32(c))) != 0 { + v2 = int32(Xtowupper(tls, uint32(uint32(c)))) e = v2 b = v2 c++ @@ -128266,17 +129329,18 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { if !(c <= max) { break } - if Xtowupper(tls, uint32(c)) != uint32(e) { + if Xtowupper(tls, uint32(uint32(c))) != uint32(uint32(e)) { break } goto _3 _3: + ; c++ e++ } } else { - if Xiswupper(tls, uint32(c)) != 0 { - v4 = int32(Xtowlower(tls, uint32(c))) + if Xiswupper(tls, uint32(uint32(c))) != 0 { + v4 = int32(Xtowlower(tls, uint32(uint32(c)))) e = v4 b = v4 c++ @@ -128285,11 +129349,12 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { if !(c <= max) { break } - if Xtowlower(tls, uint32(c)) != uint32(e) { + if Xtowlower(tls, uint32(uint32(c))) != uint32(uint32(e)) { break } goto _5 _5: + ; c++ e++ } @@ -128302,7 +129367,7 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { if !(lit != 0) { return -int32(1) } - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(b) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(int64(b)) (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(e - int32(1)) (*Ttre_literal_t)(unsafe.Pointer(lit)).Fposition = -int32(1) goto _1 @@ -128379,13 +129444,14 @@ func _parse_bracket_terms(tls *TLS, ctx uintptr, s uintptr, ls uintptr, neg uint break } if int32(*(*int8)(unsafe.Pointer(s + uintptr(len1)))) == int32(':') { - Xmemcpy(tls, bp+4, s, uint64(len1)) + Xmemcpy(tls, bp+4, s, uint64(uint64(len1))) (*(*[15]int8)(unsafe.Pointer(bp + 4)))[len1] = 0 class = Xwctype(tls, bp+4) break } goto _3 _3: + ; len1++ } if !(class != 0) || int32(*(*int8)(unsafe.Pointer(s + uintptr(len1+int32(1))))) != int32(']') { @@ -128424,8 +129490,8 @@ func _parse_bracket_terms(tls *TLS, ctx uintptr, s uintptr, ls uintptr, neg uint if !(lit != 0) { return int32(REG_ESPACE) } - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(min) - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(max) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(int64(min)) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(int64(max)) (*Ttre_literal_t)(unsafe.Pointer(lit)).Fclass = class (*Ttre_literal_t)(unsafe.Pointer(lit)).Fposition = -int32(1) /* Add opposite-case codepoints if REG_ICASE is present. @@ -128535,8 +129601,8 @@ func _parse_bracket(tls *TLS, ctx uintptr, s uintptr) (r Treg_errcode_t) { goto _2 } negmax = min - int32(1) - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(negmin) - (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(negmax) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_min = int64(int64(negmin)) + (*Ttre_literal_t)(unsafe.Pointer(lit)).Fcode_max = int64(int64(negmax)) negmin = max + int32(1) } (*Ttre_literal_t)(unsafe.Pointer(lit)).Fposition = (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fposition @@ -128549,9 +129615,11 @@ func _parse_bracket(tls *TLS, ctx uintptr, s uintptr) (r Treg_errcode_t) { } goto _2 _2: + ; i++ } parse_bracket_done: + ; Xfree(tls, (*(*Tliterals)(unsafe.Pointer(bp))).Fa) (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fposition++ (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fn = node @@ -128695,8 +129763,10 @@ func _parse_atom(tls *TLS, ctx uintptr, s uintptr) (r Treg_errcode_t) { } goto _13 _1: + ; return _parse_bracket(tls, ctx, s+uintptr(1)) _2: + ; p = _tre_expand_macro(tls, s+uintptr(1)) if p != 0 { /* assume \X expansion is a single atom */ @@ -128738,6 +129808,7 @@ _2: v = int32(16)*v + c goto _15 _15: + ; i++ } s += uintptr(i) @@ -128795,6 +129866,7 @@ _2: s++ goto _13 _3: + ; if (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fcflags&int32(REG_NEWLINE) != 0 { v22 = ctx + 44 v21 = *(*int32)(unsafe.Pointer(v22)) @@ -128818,6 +129890,7 @@ _3: s++ goto _13 _4: + ; /* '^' has a special meaning everywhere in EREs, and at beginning of BRE. */ if !(ere != 0) && s != (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fstart { goto parse_literal @@ -128826,6 +129899,7 @@ _4: s++ goto _13 _5: + ; /* '$' is special everywhere in EREs, and at the end of a BRE subexpression. */ if !(ere != 0) && *(*int8)(unsafe.Pointer(s + 1)) != 0 && (int32(*(*int8)(unsafe.Pointer(s + 1))) != int32('\\') || int32(*(*int8)(unsafe.Pointer(s + 2))) != int32(')') && int32(*(*int8)(unsafe.Pointer(s + 2))) != int32('|')) { goto parse_literal @@ -128834,22 +129908,30 @@ _5: s++ goto _13 _9: + ; _8: + ; _7: + ; _6: + ; /* reject repetitions after empty expression in ERE */ if ere != 0 { return int32(REG_BADRPT) } _10: + ; if !(ere != 0) { goto parse_literal } _11: + ; node = _tre_ast_new_literal(tls, (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fmem, -int32(1), -int32(1), -int32(1)) goto _13 _12: + ; parse_literal: + ; len1 = Xmbtowc(tls, bp, s, uint64(-Int32FromInt32(1))) if len1 < 0 { return int32(REG_BADPAT) @@ -128870,7 +129952,9 @@ parse_literal: s += uintptr(len1) goto _13 _13: + ; end: + ; if !(node != 0) { return int32(REG_ESPACE) } @@ -128945,6 +130029,7 @@ func _tre_parse(tls *TLS, ctx uintptr) (r Treg_errcode_t) { s = (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fs } parse_iter: + ; for { if int32(*(*int8)(unsafe.Pointer(s))) != int32('\\') && int32(*(*int8)(unsafe.Pointer(s))) != int32('*') { if !(ere != 0) { @@ -129164,6 +130249,7 @@ func _tre_purge_regset(tls *TLS, regset uintptr, tnfa uintptr, tag int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(regset)) = -int32(1) @@ -129223,6 +130309,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u (*(*Ttre_tag_states_t)(unsafe.Pointer(saved_states + uintptr(i)*8))).Ftag = -int32(1) goto _1 _1: + ; i++ } } @@ -129253,6 +130340,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _2: + ; id = _tre_stack_pop_int(tls, stack) /* Add end of this submatch to regset. */ i1 = 0 @@ -129262,6 +130350,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _11 _11: + ; i1++ } *(*int32)(unsafe.Pointer(regset + uintptr(i1)*4)) = id*int32(2) + int32(1) @@ -129274,11 +130363,13 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _12 _12: + ; i1++ } *(*int32)(unsafe.Pointer(parents + uintptr(i1-int32(1))*4)) = -int32(1) goto _10 _3: + ; node = _tre_stack_pop_voidptr(tls, stack) if (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id >= 0 { id1 = (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id @@ -129290,6 +130381,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _13 _13: + ; i2++ } *(*int32)(unsafe.Pointer(regset + uintptr(i2)*4)) = id1 * int32(2) @@ -129302,6 +130394,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _14 _14: + ; i2++ } (*(*Ttre_submatch_data_t)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fsubmatch_data + uintptr(id1)*16))).Fparents = UintptrFromInt32(0) @@ -129320,6 +130413,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u *(*int32)(unsafe.Pointer(p + uintptr(i2)*4)) = *(*int32)(unsafe.Pointer(parents + uintptr(i2)*4)) goto _15 _15: + ; i2++ } *(*int32)(unsafe.Pointer(p + uintptr(i2)*4)) = -int32(1) @@ -129354,6 +130448,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _16 _16: + ; i3++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i3)*4)) = tag @@ -129473,6 +130568,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _17 _17: + ; i4++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i4)*4)) = tag @@ -129569,6 +130665,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _18 _18: + ; i5++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i5)*4)) = tag @@ -129601,6 +130698,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _19 _19: + ; i6++ } *(*int32)(unsafe.Pointer(parents + uintptr(i6)*4)) = (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id @@ -129608,6 +130706,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 /* end case: ADDTAGS_RECURSE */ _4: + ; minimal = 0 node = _tre_stack_pop_voidptr(tls, stack) if first_pass != 0 { @@ -129629,6 +130728,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _5: + ; new_tag = _tre_stack_pop_int(tls, stack) next_tag = _tre_stack_pop_int(tls, stack) if new_tag >= 0 { @@ -129636,25 +130736,30 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _6: + ; node = _tre_stack_pop_voidptr(tls, stack) if first_pass != 0 { (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fnum_tags = (*Ttre_ast_node_t)(unsafe.Pointer((*Ttre_catenation_t)(unsafe.Pointer((*Ttre_ast_node_t)(unsafe.Pointer(node)).Fobj)).Fleft)).Fnum_tags + (*Ttre_ast_node_t)(unsafe.Pointer((*Ttre_catenation_t)(unsafe.Pointer((*Ttre_ast_node_t)(unsafe.Pointer(node)).Fobj)).Fright)).Fnum_tags } goto _10 _7: + ; /* Lift the bottom of the `regset' array so that when processing the right operand the items currently in the array are invisible. The original bottom was saved at ADDTAGS_UNION and will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */ _21: + ; if !(*(*int32)(unsafe.Pointer(regset)) >= 0) { goto _20 } regset += 4 goto _21 _20: + ; goto _10 _8: + ; left2 = _tre_stack_pop_voidptr(tls, stack) right2 = _tre_stack_pop_voidptr(tls, stack) node = _tre_stack_pop_voidptr(tls, stack) @@ -129693,8 +130798,10 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u direction = int32(_TRE_TAG_MAXIMIZE) goto _10 _9: + ; goto _10 - _10: /* end switch(symbol) */ + _10: + /* end switch(symbol) */ } /* end while(tre_stack_num_objects(stack) > bottom) */ if !(first_pass != 0) { _tre_purge_regset(tls, regset, tnfa, tag) @@ -129707,6 +130814,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _23 _23: + ; i7++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i7)*4)) = tag @@ -130048,6 +131156,7 @@ func _tre_expand_ast(tls *TLS, mem Ttre_mem_t, stack uintptr, ast uintptr, posit } goto _1 _1: + ; j++ } if (*Ttre_iteration_t)(unsafe.Pointer(iter1)).Fmax == -int32(1) { @@ -130090,6 +131199,7 @@ func _tre_expand_ast(tls *TLS, mem Ttre_mem_t, stack uintptr, ast uintptr, posit } goto _3 _3: + ; j++ } } @@ -130170,6 +131280,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _1 _1: + ; num_tags++ } s1 = 0 @@ -130179,6 +131290,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _2 _2: + ; s1++ } s2 = 0 @@ -130188,6 +131300,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _3 _3: + ; s2++ } new_set = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), int32(1), uint64(56)*uint64(s1+s2+Int32FromInt32(1))) @@ -130216,6 +131329,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _5 _5: + ; i++ } new_tags = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), 0, Uint64FromInt64(4)*uint64(i+num_tags+Int32FromInt32(1))) @@ -130230,6 +131344,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = *(*int32)(unsafe.Pointer((*(*Ttre_pos_and_tags_t)(unsafe.Pointer(set1 + uintptr(s1)*56))).Ftags + uintptr(j)*4)) goto _6 _6: + ; j++ } i = 0 @@ -130240,6 +131355,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j+i)*4)) = *(*int32)(unsafe.Pointer(tags + uintptr(i)*4)) goto _7 _7: + ; i++ } *(*int32)(unsafe.Pointer(new_tags + uintptr(j+i)*4)) = -int32(1) @@ -130247,6 +131363,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _4 _4: + ; s1++ } s2 = 0 @@ -130272,6 +131389,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _9 _9: + ; i++ } new_tags = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), 0, uint64(4)*uint64(i+Int32FromInt32(1))) @@ -130286,6 +131404,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = *(*int32)(unsafe.Pointer((*(*Ttre_pos_and_tags_t)(unsafe.Pointer(set2 + uintptr(s2)*56))).Ftags + uintptr(j)*4)) goto _10 _10: + ; j++ } *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = -int32(1) @@ -130293,6 +131412,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _8 _8: + ; s2++ } (*(*Ttre_pos_and_tags_t)(unsafe.Pointer(new_set + uintptr(s1+s2)*56))).Fposition = -int32(1) @@ -130337,6 +131457,7 @@ func _tre_match_empty(tls *TLS, stack uintptr, node uintptr, tags uintptr, asser } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(tags + uintptr(i)*4)) < 0 { @@ -130707,6 +131828,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun } goto _3 _3: + ; i++ } (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes = Xmalloc(tls, uint64(8)*uint64(i+Int32FromInt32(1))) @@ -130721,6 +131843,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes + uintptr(i)*8)) = *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_pos_and_tags_t)(unsafe.Pointer(p1)).Fneg_classes + uintptr(i)*8)) goto _4 _4: + ; i++ } *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes + uintptr(i)*8)) = Uint64FromInt32(0) @@ -130775,6 +131898,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun } goto _5 _5: + ; k++ } if !(dup != 0) { @@ -131024,6 +132148,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { *(*int32)(unsafe.Pointer(counts + uintptr(i)*4)) = 0 goto _3 _3: + ; i++ } _tre_ast_to_tnfa(tls, tree, UintptrFromInt32(0), counts, UintptrFromInt32(0)) @@ -131038,9 +132163,10 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { *(*int32)(unsafe.Pointer(counts + uintptr(i)*4)) = 0 goto _4 _4: + ; i++ } - transitions = Xcalloc(tls, uint64(uint32(add)+uint32(1)), uint64(56)) + transitions = Xcalloc(tls, uint64(uint32(uint32(add))+uint32(1)), uint64(56)) if transitions == UintptrFromInt32(0) { errcode = int32(REG_ESPACE) if int32(1) != 0 { @@ -131048,7 +132174,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { } } (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Ftransitions = transitions - (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_transitions = uint32(add) + (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_transitions = uint32(uint32(add)) errcode = _tre_ast_to_tnfa(tls, tree, transitions, counts, offs) if errcode != REG_OK { errcode = errcode @@ -131063,7 +132189,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { i++ p += 56 } - initial = Xcalloc(tls, uint64(uint32(i)+uint32(1)), uint64(56)) + initial = Xcalloc(tls, uint64(uint32(uint32(i))+uint32(1)), uint64(56)) if initial == UintptrFromInt32(0) { errcode = int32(REG_ESPACE) if int32(1) != 0 { @@ -131090,6 +132216,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { } goto _6 _6: + ; j++ } (*(*Ttre_tnfa_transition_t)(unsafe.Pointer(initial + uintptr(i)*56))).Ftags = Xmalloc(tls, uint64(4)*uint64(j+Int32FromInt32(1))) @@ -131105,10 +132232,11 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { i++ goto _5 _5: + ; p += 56 } (*(*Ttre_tnfa_transition_t)(unsafe.Pointer(initial + uintptr(i)*56))).Fstate = UintptrFromInt32(0) - (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_transitions = uint32(add) + (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_transitions = uint32(uint32(add)) (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Ffinal = transitions + uintptr(*(*int32)(unsafe.Pointer(offs + uintptr((*(*Ttre_pos_and_tags_t)(unsafe.Pointer((*Ttre_ast_node_t)(unsafe.Pointer(tree)).Flastpos))).Fposition)*4)))*56 (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states = (*(*Ttre_parse_ctx_t)(unsafe.Pointer(bp))).Fposition (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags = cflags @@ -131119,6 +132247,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { (*Tregex_t)(unsafe.Pointer(preg)).F__opaque = tnfa return REG_OK error_exit: + ; /* Free everything that was allocated and return the error code. */ X__tre_mem_destroy(tls, mem) if stack != UintptrFromInt32(0) { @@ -131161,6 +132290,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _1 _1: + ; i++ } if (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Ftransitions != 0 { @@ -131177,6 +132307,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _2 _2: + ; trans += 56 } Xfree(tls, (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Finitial) @@ -131192,6 +132323,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _3 _3: + ; i++ } Xfree(tls, (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fsubmatch_data) @@ -131232,6 +132364,7 @@ func Xregerror(tls *TLS, e int32, preg uintptr, buf uintptr, size Tsize_t) (r Ts } goto _1 _1: + ; e-- s += uintptr(Xstrlen(tls, s) + uint64(1)) } @@ -131278,6 +132411,7 @@ func _tre_tag_order(tls *TLS, num_tags int32, tag_directions uintptr, t1 uintptr } goto _1 _1: + ; i++ } /* assert(0);*/ @@ -131359,7 +132493,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags everything in a single large block with calloc(). */ /* Ensure that tbytes and xbytes*num_states cannot overflow, and that * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ - if uint64(num_tags) > uint64(0xffffffffffffffff)/(Uint64FromInt32(8)*Uint64FromInt64(8)*uint64((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states)) { + if uint64(uint64(num_tags)) > uint64(0xffffffffffffffff)/(Uint64FromInt32(8)*Uint64FromInt64(8)*uint64((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states)) { return int32(REG_ESPACE) } /* Likewise check rbytes. */ @@ -131371,10 +132505,10 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags return int32(REG_ESPACE) } /* Compute the length of the block we need. */ - tbytes = uint64(8) * uint64(num_tags) + tbytes = uint64(8) * uint64(uint64(num_tags)) rbytes = uint64(16) * uint64((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states+Int32FromInt32(1)) pbytes = uint64(16) * uint64((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states) - xbytes = uint64(8) * uint64(num_tags) + xbytes = uint64(8) * uint64(uint64(num_tags)) total_bytes = (Uint64FromInt64(8)-Uint64FromInt32(1))*Uint64FromInt32(4) + (rbytes+xbytes*uint64((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_states))*uint64(2) + tbytes + pbytes /* Allocate the memory. */ buf = Xcalloc(tls, total_bytes, uint64(1)) @@ -131384,32 +132518,32 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags /* Get the various pointers within tmp_buf (properly aligned). */ tmp_tags = buf tmp_buf = buf + uintptr(tbytes) - if uint64(int64(tmp_buf))%uint64(8) != 0 { - v1 = uint64(8) - uint64(int64(tmp_buf))%uint64(8) + if uint64(int64(int64(tmp_buf)))%uint64(8) != 0 { + v1 = uint64(8) - uint64(int64(int64(tmp_buf)))%uint64(8) } else { v1 = uint64(0) } tmp_buf += uintptr(v1) reach_next = tmp_buf tmp_buf += uintptr(rbytes) - if uint64(int64(tmp_buf))%uint64(8) != 0 { - v2 = uint64(8) - uint64(int64(tmp_buf))%uint64(8) + if uint64(int64(int64(tmp_buf)))%uint64(8) != 0 { + v2 = uint64(8) - uint64(int64(int64(tmp_buf)))%uint64(8) } else { v2 = uint64(0) } tmp_buf += uintptr(v2) reach = tmp_buf tmp_buf += uintptr(rbytes) - if uint64(int64(tmp_buf))%uint64(8) != 0 { - v3 = uint64(8) - uint64(int64(tmp_buf))%uint64(8) + if uint64(int64(int64(tmp_buf)))%uint64(8) != 0 { + v3 = uint64(8) - uint64(int64(int64(tmp_buf)))%uint64(8) } else { v3 = uint64(0) } tmp_buf += uintptr(v3) reach_pos = tmp_buf tmp_buf += uintptr(pbytes) - if uint64(int64(tmp_buf))%uint64(8) != 0 { - v4 = uint64(8) - uint64(int64(tmp_buf))%uint64(8) + if uint64(int64(int64(tmp_buf)))%uint64(8) != 0 { + v4 = uint64(8) - uint64(int64(int64(tmp_buf)))%uint64(8) } else { v4 = uint64(0) } @@ -131425,6 +132559,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags tmp_buf += uintptr(xbytes) goto _5 _5: + ; i++ } i = 0 @@ -131435,6 +132570,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags (*(*Ttre_reach_pos_t)(unsafe.Pointer(reach_pos + uintptr(i)*16))).Fpos = int64(-int32(1)) goto _6 _6: + ; i++ } prev_c = *(*Ttre_char_t)(unsafe.Pointer(bp)) @@ -131458,7 +132594,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags trans_i = (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Finitial for (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fstate != UintptrFromInt32(0) { if (*(*Ttre_reach_pos_t)(unsafe.Pointer(reach_pos + uintptr((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fstate_id)*16))).Fpos < pos { - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0))) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0))) { trans_i += 56 continue } @@ -131471,6 +132607,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) = int64(-int32(1)) goto _8 _8: + ; i++ } tag_i = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131493,6 +132630,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) goto _9 _9: + ; i++ } } @@ -131559,6 +132697,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _12 _12: + ; i += int32(2) } if !(skip != 0) { @@ -131570,6 +132709,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _11 _11: + ; reach_i += 16 } (*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Fstate = UintptrFromInt32(0) @@ -131593,8 +132733,8 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags break } /* Does this transition match the input symbol? */ - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_min <= uint32(prev_c) && (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_max >= uint32(prev_c) { - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && !((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&Int32FromInt32(REG_ICASE) != 0) && !(Xiswctype(tls, uint32(prev_c), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE) != 0 && !(Xiswctype(tls, Xtowlower(tls, uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) && !(Xiswctype(tls, Xtowupper(tls, uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS_NEG) != 0 && _tre_neg_char_classes_match(tls, (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fneg_classes, uint32(prev_c), (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE)) != 0)) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_min <= uint32(uint32(prev_c)) && (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_max >= uint32(uint32(prev_c)) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && !((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&Int32FromInt32(REG_ICASE) != 0) && !(Xiswctype(tls, uint32(uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE) != 0 && !(Xiswctype(tls, Xtowlower(tls, uint32(uint32(prev_c))), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) && !(Xiswctype(tls, Xtowupper(tls, uint32(uint32(prev_c))), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS_NEG) != 0 && _tre_neg_char_classes_match(tls, (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fneg_classes, uint32(uint32(prev_c)), (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE)) != 0)) { goto _14 } /* Compute the tags after this transition. */ @@ -131606,6 +132746,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(tmp_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_i)).Ftags + uintptr(i)*8)) goto _15 _15: + ; i++ } tag_i = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131636,6 +132777,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) goto _16 _16: + ; i++ } } @@ -131659,6 +132801,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer(tmp_tags + uintptr(i)*8)) goto _17 _17: + ; i++ } } @@ -131668,10 +132811,12 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _14 _14: + ; trans_i += 56 } goto _13 _13: + ; reach_i += 16 } (*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Fstate = UintptrFromInt32(0) @@ -131684,6 +132829,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } ret = v18 error_exit: + ; Xfree(tls, buf) return ret } @@ -131792,6 +132938,7 @@ func _tre_tnfa_run_backtrack(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } } retry: + ; i = 0 for { if !(i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_tags) { @@ -131803,6 +132950,7 @@ retry: } goto _1 _1: + ; i++ } i = 0 @@ -131813,6 +132961,7 @@ retry: *(*int32)(unsafe.Pointer(states_seen + uintptr(i)*4)) = 0 goto _2 _2: + ; i++ } state = UintptrFromInt32(0) @@ -131840,7 +132989,7 @@ retry: if !((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fstate != 0) { break } - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0))) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0))) { goto _4 } if state == UintptrFromInt32(0) { @@ -131898,6 +133047,7 @@ retry: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i1)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i1)*8)) goto _5 _5: + ; i1++ } tmp = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131911,6 +133061,7 @@ retry: } goto _4 _4: + ; trans_i += 56 } if next_tags != 0 { @@ -131921,6 +133072,7 @@ retry: *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(*(*int32)(unsafe.Pointer(next_tags)))*8)) = pos goto _7 _7: + ; next_tags += 4 } } @@ -131928,6 +133080,7 @@ retry: goto backtrack } _9: + ; if !(int32(1) != 0) { goto _8 } @@ -131944,6 +133097,7 @@ _9: *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i2)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i2)*8)) goto _10 _10: + ; i2++ } } @@ -131963,7 +133117,7 @@ _9: so = (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(bt)*16))).Frm_so eo = (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(bt)*16))).Frm_eo bt_len = eo - so - result = Xstrncmp(tls, string1+uintptr(so), str_byte-uintptr(1), uint64(bt_len)) + result = Xstrncmp(tls, string1+uintptr(so), str_byte-uintptr(1), uint64(uint64(bt_len))) if result == 0 { /* Back reference matched. Check for infinite loop. */ if bt_len == 0 { @@ -132019,8 +133173,8 @@ _9: if !((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fstate != 0) { break } - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_min <= uint32(prev_c) && (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_max >= uint32(prev_c) { - if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(prev_c)) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && !((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&Int32FromInt32(REG_ICASE) != 0) && !(Xiswctype(tls, uint32(prev_c), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE) != 0 && !(Xiswctype(tls, Xtowlower(tls, uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) && !(Xiswctype(tls, Xtowupper(tls, uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS_NEG) != 0 && _tre_neg_char_classes_match(tls, (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fneg_classes, uint32(prev_c), (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE)) != 0)) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_min <= uint32(uint32(prev_c)) && (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fcode_max >= uint32(uint32(prev_c)) { + if (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions != 0 && ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOL) != 0 && (pos > 0 || reg_notbol != 0) && (prev_c != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOL) != 0 && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') || reg_noteol != 0) && (*(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\n') || !(reg_newline != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_BOW) != 0 && (prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0 || !(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_EOW) != 0 && (!(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) || (*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB) != 0 && (pos != 0 && *(*Ttre_char_t)(unsafe.Pointer(bp)) != int32('\000') && BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) == BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_AT_WB_NEG) != 0 && (pos == 0 || *(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('\000') || BoolInt32(prev_c == int32('_') || Xiswalnum(tls, uint32(uint32(prev_c))) != 0) != BoolInt32(*(*Ttre_char_t)(unsafe.Pointer(bp)) == int32('_') || Xiswalnum(tls, uint32(*(*Ttre_char_t)(unsafe.Pointer(bp)))) != 0)) || ((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && !((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&Int32FromInt32(REG_ICASE) != 0) && !(Xiswctype(tls, uint32(uint32(prev_c)), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS) != 0 && (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE) != 0 && !(Xiswctype(tls, Xtowlower(tls, uint32(uint32(prev_c))), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) && !(Xiswctype(tls, Xtowupper(tls, uint32(uint32(prev_c))), *(*Ttre_ctype_t)(unsafe.Pointer(trans_i + 40))) != 0) || (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fassertions&int32(ASSERT_CHAR_CLASS_NEG) != 0 && _tre_neg_char_classes_match(tls, (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Fneg_classes, uint32(uint32(prev_c)), (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fcflags&int32(REG_ICASE)) != 0)) { goto _13 } if next_state == UintptrFromInt32(0) { @@ -132081,6 +133235,7 @@ _9: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i3)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i3)*8)) goto _14 _14: + ; i3++ } tmp1 = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -132091,12 +133246,14 @@ _9: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(*(*int32)(unsafe.Pointer(tmp1)))*8)) = pos goto _15 _15: + ; tmp1 += 4 } } } goto _13 _13: + ; trans_i += 56 } if !(next_state != UintptrFromInt32(0)) { @@ -132114,7 +133271,9 @@ _9: } goto _17 _16: + ; backtrack: + ; /* A matching transition was not found. Try to backtrack. */ if (*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fprev != 0 { if (*Ttre_tnfa_transition_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Fstate)).Fassertions&int32(ASSERT_BACKREF) != 0 { @@ -132132,6 +133291,7 @@ backtrack: *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i4)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i4)*8)) goto _19 _19: + ; i4++ } stack = (*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fprev @@ -132150,8 +133310,10 @@ backtrack: } } _17: + ; goto _9 _8: + ; if match_eo >= 0 { v20 = REG_OK } else { @@ -132160,6 +133322,7 @@ _8: ret = v20 *(*Tregoff_t)(unsafe.Pointer(match_end_ofs)) = match_eo error_exit: + ; X__tre_mem_destroy(tls, mem) if tags != 0 { Xfree(tls, tags) @@ -132190,7 +133353,7 @@ func _tre_fill_pmatch(tls *TLS, nmatch Tsize_t, pmatch uintptr, cflags int32, tn if match_eo >= 0 && !(cflags&Int32FromInt32(REG_NOSUB) != 0) { /* Construct submatch offsets from the tags. */ submatch_data = (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fsubmatch_data - for i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_submatches && uint64(i) < nmatch { + for i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_submatches && uint64(uint64(i)) < nmatch { if (*(*Ttre_submatch_data_t)(unsafe.Pointer(submatch_data + uintptr(i)*16))).Fso_tag == (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fend_tag { (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(i)*16))).Frm_so = match_eo } else { @@ -132213,7 +133376,7 @@ func _tre_fill_pmatch(tls *TLS, nmatch Tsize_t, pmatch uintptr, cflags int32, tn /* Reset all submatches that are not within all of their parent submatches. */ i = uint32(0) - for i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_submatches && uint64(i) < nmatch { + for i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_submatches && uint64(uint64(i)) < nmatch { if (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(i)*16))).Frm_eo == int64(-int32(1)) { } parents = (*(*Ttre_submatch_data_t)(unsafe.Pointer(submatch_data + uintptr(i)*16))).Fparents @@ -132230,13 +133393,14 @@ func _tre_fill_pmatch(tls *TLS, nmatch Tsize_t, pmatch uintptr, cflags int32, tn } goto _2 _2: + ; j++ } } i++ } } - for uint64(i) < nmatch { + for uint64(uint64(i)) < nmatch { (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(i)*16))).Frm_so = int64(-int32(1)) (*(*Tregmatch_t)(unsafe.Pointer(pmatch + uintptr(i)*16))).Frm_eo = int64(-int32(1)) i++ @@ -132370,7 +133534,7 @@ func X__tre_mem_alloc_impl(tls *TLS, mem Ttre_mem_t, provided int32, provided_bl (*Ttre_mem_struct)(unsafe.Pointer(mem)).Ffailed = int32(1) return UintptrFromInt32(0) } - (*Ttre_list_t)(unsafe.Pointer(l)).Fdata = Xmalloc(tls, uint64(block_size)) + (*Ttre_list_t)(unsafe.Pointer(l)).Fdata = Xmalloc(tls, uint64(uint64(block_size))) if (*Ttre_list_t)(unsafe.Pointer(l)).Fdata == UintptrFromInt32(0) { Xfree(tls, l) (*Ttre_mem_struct)(unsafe.Pointer(mem)).Ffailed = int32(1) @@ -132385,7 +133549,7 @@ func X__tre_mem_alloc_impl(tls *TLS, mem Ttre_mem_t, provided int32, provided_bl } (*Ttre_mem_struct)(unsafe.Pointer(mem)).Fcurrent = l (*Ttre_mem_struct)(unsafe.Pointer(mem)).Fptr = (*Ttre_list_t)(unsafe.Pointer(l)).Fdata - (*Ttre_mem_struct)(unsafe.Pointer(mem)).Fn = uint64(block_size) + (*Ttre_mem_struct)(unsafe.Pointer(mem)).Fn = uint64(uint64(block_size)) } } /* Make sure the next pointer will be aligned. */ @@ -132487,6 +133651,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _1 _1: + ; newsize *= uint64(2) } (*t__tab)(unsafe.Pointer((*Thsearch_data)(unsafe.Pointer(htab)).F__tab)).Fentries = Xcalloc(tls, newsize, uint64(16)) @@ -132513,6 +133678,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _3 _3: + ; v4 = j j++ i += v4 @@ -132521,6 +133687,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _2 _2: + ; e += 16 } Xfree(tls, oldtab) @@ -132555,6 +133722,7 @@ func _lookup(tls *TLS, key uintptr, hash Tsize_t, htab uintptr) (r uintptr) { } goto _1 _1: + ; v2 = j j++ i += v2 @@ -132607,7 +133775,7 @@ func ___hsearch_r(tls *TLS, item TENTRY, action TACTION, retval uintptr, htab ui *(*uintptr)(unsafe.Pointer(retval)) = e return int32(1) } - if action == int32(_FIND) { + if int32(action) == int32(_FIND) { *(*uintptr)(unsafe.Pointer(retval)) = uintptr(0) return 0 } @@ -132693,6 +133861,7 @@ func Xlsearch(tls *TLS, key uintptr, base uintptr, nelp uintptr, width Tsize_t, } goto _2 _2: + ; i++ } *(*Tsize_t)(unsafe.Pointer(nelp)) = n + uint64(1) @@ -132722,6 +133891,7 @@ func Xlfind(tls *TLS, key uintptr, base uintptr, nelp uintptr, width Tsize_t, co } goto _2 _2: + ; i++ } return uintptr(0) @@ -132991,13 +134161,13 @@ func _walk(tls *TLS, r uintptr, action uintptr, d int32) { return } if (*Tnode1)(unsafe.Pointer(r)).Fh == int32(1) { - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_leaf), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _leaf, d) } else { - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_preorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _preorder, d) _walk(tls, *(*uintptr)(unsafe.Pointer(r + 8)), action, d+int32(1)) - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_postorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _postorder, d) _walk(tls, *(*uintptr)(unsafe.Pointer(r + 8 + 1*8)), action, d+int32(1)) - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_endorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _endorder, d) } } @@ -133068,7 +134238,7 @@ func Xpselect(tls *TLS, n int32, rfds uintptr, wfds uintptr, efds uintptr, ts ui var _ /* data at bp+16 */ [2]Tsyscall_arg_t _, _, _, _, _ = ns, s, v1, v2, v3 *(*[2]Tsyscall_arg_t)(unsafe.Pointer(bp + 16)) = [2]Tsyscall_arg_t{ - 0: int64(uint64(mask)), + 0: int64(uint64(uint64(mask))), 1: int64(Int32FromInt32(_NSIG) / Int32FromInt32(8)), } if ts != 0 { @@ -133200,7 +134370,7 @@ func Xgetitimer(tls *TLS, which int32, old uintptr) (r1 int32) { (*Titimerval)(unsafe.Pointer(old)).Fit_value.Ftv_sec = (*(*[4]int64)(unsafe.Pointer(bp)))[int32(2)] (*Titimerval)(unsafe.Pointer(old)).Fit_value.Ftv_usec = (*(*[4]int64)(unsafe.Pointer(bp)))[int32(3)] } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } return int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_getitimer), int64(which), int64(old))))) } @@ -133262,11 +134432,11 @@ func Xpsignal(tls *TLS, sig int32, msg uintptr) { v2 = __ccgo_ts } if msg != 0 { - v3 = __ccgo_ts + 641 + v3 = __ccgo_ts + 355 } else { v3 = __ccgo_ts } - if Xfprintf(tls, f, __ccgo_ts+1054, VaList(bp+8, v2, v3, s)) >= 0 { + if Xfprintf(tls, f, __ccgo_ts+1089, VaList(bp+8, v2, v3, s)) >= 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = old_errno } (*TFILE)(unsafe.Pointer(f)).Fmode = old_mode @@ -133287,7 +134457,7 @@ func Xraise(tls *TLS, sig int32) (r int32) { var _ /* set at bp+0 */ Tsigset_t _ = ret X__block_app_sigs(tls, bp) - ret = int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid), int64(sig))))) + ret = int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid), int64(sig))))) X__restore_sigs(tls, bp) return ret } @@ -133339,7 +134509,7 @@ func Xsetitimer(tls *TLS, which int32, new1 uintptr, old uintptr) (r1 int32) { (*Titimerval)(unsafe.Pointer(old)).Fit_value.Ftv_sec = (*(*[4]int64)(unsafe.Pointer(bp + 32)))[int32(2)] (*Titimerval)(unsafe.Pointer(old)).Fit_value.Ftv_usec = (*(*[4]int64)(unsafe.Pointer(bp + 32)))[int32(3)] } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } return int32(X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_setitimer), int64(which), int64(new1), int64(old))))) } @@ -133385,13 +134555,13 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old uintptr) (r1 int32) // // "lock ; or %1, %0" // : "=m"(*p) : "r"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 48, __ccgo_ts+1475) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 48, __ccgo_ts+1504) } else { // __asm__ __volatile__( // // "lock ; or %1, %0" // : "=m"(*p) : "r"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 64, __ccgo_ts+1475) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 64, __ccgo_ts+1504) } /* If pthread_create has not yet been called, * implementation-internal signals might not @@ -133413,7 +134583,7 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old uintptr) (r1 int32) // // "mov %1, %0 ; lock ; orl $0,(%%rsp)" // : "=m"(*p) : "r"(x) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1475) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1504) } } (*(*Tk_sigaction)(unsafe.Pointer(bp + 8))).Fhandler = *(*uintptr)(unsafe.Pointer(sa)) @@ -133443,7 +134613,7 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old uintptr) (r1 int32) (*Tsigaction)(unsafe.Pointer(old)).Fsa_flags = int32((*(*Tk_sigaction)(unsafe.Pointer(bp + 40))).Fflags) Xmemcpy(tls, old+8, bp+40+24, uint64(Int32FromInt32(_NSIG)/Int32FromInt32(8))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func X__sigaction(tls *TLS, sig int32, sa uintptr, old uintptr) (r1 int32) { @@ -133456,7 +134626,7 @@ func X__sigaction(tls *TLS, sig int32, sa uintptr, old uintptr) (r1 int32) { var r int32 var _ /* set at bp+0 */ [1]uint64 _ = r - if uint32(sig)-uint32(32) < uint32(3) || uint32(sig)-uint32(1) >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) { + if uint32(uint32(sig))-uint32(32) < uint32(3) || uint32(uint32(sig))-uint32(1) >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } @@ -133491,11 +134661,11 @@ func Xsigaddset(tls *TLS, set uintptr, sig int32) (r int32) { var s uint32 _ = s s = uint32(sig - int32(1)) - if s >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) || uint32(sig)-uint32(32) < uint32(3) { + if s >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) || uint32(uint32(sig))-uint32(32) < uint32(3) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } - *(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8)) |= uint64(1) << (uint64(s) & (Uint64FromInt32(8)*Uint64FromInt64(8) - Uint64FromInt32(1))) + *(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8)) |= uint64(1) << (uint64(uint64(s)) & (Uint64FromInt32(8)*Uint64FromInt64(8) - Uint64FromInt32(1))) return 0 } @@ -133547,6 +134717,7 @@ func Xsigandset(tls *TLS, dest uintptr, left uintptr, right uintptr) (r1 int32) *(*uint64)(unsafe.Pointer(d + uintptr(i)*8)) = *(*uint64)(unsafe.Pointer(l + uintptr(i)*8)) & *(*uint64)(unsafe.Pointer(r + uintptr(i)*8)) goto _1 _1: + ; i++ } return 0 @@ -133560,11 +134731,11 @@ func Xsigdelset(tls *TLS, set uintptr, sig int32) (r int32) { var s uint32 _ = s s = uint32(sig - int32(1)) - if s >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) || uint32(sig)-uint32(32) < uint32(3) { + if s >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) || uint32(uint32(sig))-uint32(32) < uint32(3) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } - *(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8)) &= ^(Uint64FromUint64(1) << (uint64(s) & (Uint64FromInt32(8)*Uint64FromInt64(8) - Uint64FromInt32(1)))) + *(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8)) &= ^(Uint64FromUint64(1) << (uint64(uint64(s)) & (Uint64FromInt32(8)*Uint64FromInt64(8) - Uint64FromInt32(1)))) return 0 } @@ -133622,6 +134793,7 @@ func Xsigisemptyset(tls *TLS, set uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -133638,7 +134810,7 @@ func Xsigismember(tls *TLS, set uintptr, sig int32) (r int32) { if s >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) { return 0 } - return BoolInt32(!!(*(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8))&(Uint64FromUint64(1)<<(uint64(s)&(Uint64FromInt32(8)*Uint64FromInt64(8)-Uint64FromInt32(1)))) != 0)) + return BoolInt32(!!(*(*uint64)(unsafe.Pointer(set + uintptr(uint64(s/uint32(8))/uint64(8))*8))&(Uint64FromUint64(1)<<(uint64(uint64(s))&(Uint64FromInt32(8)*Uint64FromInt64(8)-Uint64FromInt32(1)))) != 0)) } func Xsigorset(tls *TLS, dest uintptr, left uintptr, right uintptr) (r1 int32) { @@ -133660,6 +134832,7 @@ func Xsigorset(tls *TLS, dest uintptr, left uintptr, right uintptr) (r1 int32) { *(*uint64)(unsafe.Pointer(d + uintptr(i)*8)) = *(*uint64)(unsafe.Pointer(l + uintptr(i)*8)) | *(*uint64)(unsafe.Pointer(r + uintptr(i)*8)) goto _1 _1: + ; i++ } return 0 @@ -133783,7 +134956,7 @@ func Xsigtimedwait(tls *TLS, mask uintptr, si uintptr, timeout uintptr) (r int32 for cond := true; cond; cond = ret == -int32(EINTR) { ret = _do_sigtimedwait(tls, mask, si, timeout) } - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } func Xsigwait(tls *TLS, mask uintptr, sig uintptr) (r int32) { @@ -133877,9 +135050,9 @@ func Xfchmod(tls *TLS, fd int32, mode Tmode_t) (r int32) { _ = ret ret = int32(X__syscall2(tls, int64(SYS_fchmod), int64(fd), int64(mode))) if ret != -int32(EBADF) || X__syscall2(tls, int64(SYS_fcntl), int64(fd), int64(Int32FromInt32(F_GETFD))) < 0 { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } - X__procfdname(tls, bp, uint32(fd)) + X__procfdname(tls, bp, uint32(uint32(fd))) return int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_chmod), int64(bp), int64(mode))))) } @@ -133899,7 +135072,7 @@ func Xfchmodat(tls *TLS, fd int32, path uintptr, mode Tmode_t, flag int32) (r in } ret = int32(X__syscall4(tls, int64(SYS_fchmodat2), int64(fd), int64(path), int64(mode), int64(flag))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } if flag != int32(AT_SYMLINK_NOFOLLOW) { return int32(X__syscall_ret(tls, uint64(-Int32FromInt32(EINVAL)))) @@ -133916,9 +135089,9 @@ func Xfchmodat(tls *TLS, fd int32, path uintptr, mode Tmode_t, flag int32) (r in if fd2 == -int32(ELOOP) { return int32(X__syscall_ret(tls, uint64(-Int32FromInt32(EOPNOTSUPP)))) } - return int32(X__syscall_ret(tls, uint64(fd2))) + return int32(X__syscall_ret(tls, uint64(uint64(fd2)))) } - X__procfdname(tls, bp+144, uint32(fd2)) + X__procfdname(tls, bp+144, uint32(uint32(fd2))) ret = Xstat(tls, bp+144, bp) if !(ret != 0) { if (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(S_IFMT) == uint32(S_IFLNK) { @@ -134002,13 +135175,13 @@ func _fstatat_statx(tls *TLS, fd int32, path uintptr, st uintptr, flag int32) (r return ret } *(*Tstat)(unsafe.Pointer(st)) = Tstat{ - Fst_dev: uint64((*(*Tstatx1)(unsafe.Pointer(bp))).Fstx_dev_major)&Uint64FromUint64(0xfffff000)<= 0 { ret = int32(X__syscall4(tls, int64(SYS_newfstatat), int64(fd), int64(path), int64(bp), int64(flag))) if ret == -int32(EINVAL) { - X__procfdname(tls, bp+144, uint32(fd)) + X__procfdname(tls, bp+144, uint32(uint32(fd))) ret = int32(X__syscall2(tls, int64(SYS_stat), int64(bp+144), int64(bp))) } } @@ -134116,11 +135289,11 @@ func X__fstatat(tls *TLS, fd int32, path uintptr, st uintptr, flag int32) (r int if uint64(8) < uint64(8) { ret = _fstatat_statx(tls, fd, path, st, flag) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } } ret = _fstatat_kstat(tls, fd, path, st, flag) - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } func Xfstatat(tls *TLS, fd int32, path uintptr, st uintptr, flag int32) (r int32) { @@ -134163,6 +135336,7 @@ func X__futimesat(tls *TLS, dirfd int32, pathname uintptr, times uintptr) (r int (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[i].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(times + uintptr(i)*16))).Ftv_usec * int64(1000) goto _1 _1: + ; i++ } } @@ -134345,7 +135519,7 @@ func Xutimensat(tls *TLS, fd int32, path uintptr, times uintptr, flags int32) (r } r = int32(X__syscall4(tls, int64(SYS_utimensat), int64(fd), int64(path), int64(times), int64(flags))) if r != -int32(ENOSYS) || flags != 0 { - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } tv = uintptr(0) if times != 0 { @@ -134365,15 +135539,16 @@ func Xutimensat(tls *TLS, fd int32, path uintptr, times uintptr, flags int32) (r (*(*[4]int64)(unsafe.Pointer(bp)))[int32(2)*i+int32(1)] = (*(*Ttimespec)(unsafe.Pointer(times + uintptr(i)*16))).Ftv_nsec / int64(1000) goto _1 _1: + ; i++ } } r = int32(X__syscall3(tls, int64(SYS_futimesat), int64(fd), int64(path), int64(tv))) if r != -int32(ENOSYS) || fd != -int32(100) { - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } r = int32(X__syscall2(tls, int64(SYS_utimes), int64(path), int64(tv))) - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func X__fclose_ca(tls *TLS, f uintptr) (r int32) { @@ -134396,7 +135571,7 @@ func X__fdopen(tls *TLS, fd int32, mode uintptr) (r uintptr) { var _ /* wsz at bp+0 */ Twinsize _, _, _, _ = f, flags, v1, v2 /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1492, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1521, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -134523,7 +135698,7 @@ func X__overflow(tls *TLS, f uintptr, _c int32) (r int32) { var v2, v3 uintptr var _ /* c at bp+0 */ uint8 _, _, _ = v1, v2, v3 - *(*uint8)(unsafe.Pointer(bp)) = uint8(_c) + *(*uint8)(unsafe.Pointer(bp)) = uint8(uint8(_c)) if !((*TFILE)(unsafe.Pointer(f)).Fwend != 0) && X__towrite(tls, f) != 0 { return -int32(1) } @@ -134566,7 +135741,7 @@ func _close_file(tls *TLS, f uintptr) { (*(*func(*TLS, uintptr, uintptr, Tsize_t) Tsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fwrite})))(tls, f, uintptr(0), uint64(0)) } if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { - (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(SEEK_CUR)) + (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(1)) } } @@ -134584,6 +135759,7 @@ func X__stdio_exit(tls *TLS) { _close_file(tls, f) goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext } _close_file(tls, AtomicLoadPUintptr(uintptr(unsafe.Pointer(&X__stdin_used)))) @@ -134636,8 +135812,8 @@ func X__stdio_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint32)(unsafe.Pointer(f)) |= uint32(v2) return uint64(0) } - if uint64(cnt) <= (*(*[2]Tiovec)(unsafe.Pointer(bp)))[0].Fiov_len { - return uint64(cnt) + if uint64(uint64(cnt)) <= (*(*[2]Tiovec)(unsafe.Pointer(bp)))[0].Fiov_len { + return uint64(uint64(cnt)) } cnt = Tssize_t(uint64(cnt) - (*(*[2]Tiovec)(unsafe.Pointer(bp)))[0].Fiov_len) (*TFILE)(unsafe.Pointer(f)).Frpos = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -134688,7 +135864,7 @@ func X__stdio_write(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) iovcnt = int32(2) for { cnt = X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_writev), int64((*TFILE)(unsafe.Pointer(f)).Ffd), int64(iov), int64(iovcnt)))) - if uint64(cnt) == rem { + if uint64(uint64(cnt)) == rem { (*TFILE)(unsafe.Pointer(f)).Fwend = (*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr((*TFILE)(unsafe.Pointer(f)).Fbuf_size) v2 = (*TFILE)(unsafe.Pointer(f)).Fbuf (*TFILE)(unsafe.Pointer(f)).Fwbase = v2 @@ -134709,14 +135885,14 @@ func X__stdio_write(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) } return v5 } - rem -= uint64(cnt) - if uint64(cnt) > (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_len { + rem -= uint64(uint64(cnt)) + if uint64(uint64(cnt)) > (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_len { cnt = Tssize_t(uint64(cnt) - (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_len) iov += 16 iovcnt-- } (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_base = (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_base + uintptr(cnt) - (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_len -= uint64(cnt) + (*(*Tiovec)(unsafe.Pointer(iov))).Fiov_len -= uint64(uint64(cnt)) goto _1 _1: } @@ -135191,6 +136367,7 @@ func Xfflush(tls *TLS, f uintptr) (r1 int32) { } goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext } X__ofl_unlock(tls) @@ -135214,7 +136391,7 @@ func Xfflush(tls *TLS, f uintptr) (r1 int32) { } /* If reading, sync position, per POSIX */ if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { - (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(SEEK_CUR)) + (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(1)) } /* Clear read and write modes */ v5 = UintptrFromInt32(0) @@ -135248,7 +136425,7 @@ func _locking_getc(tls *TLS, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1525) v2 = v1 goto _3 _3: @@ -135269,7 +136446,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1525) v8 = v7 goto _9 _9: @@ -135298,7 +136475,7 @@ func Xfgetc(tls *TLS, f uintptr) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = f l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -135352,14 +136529,14 @@ func Xfgetln(tls *TLS, f uintptr, plen uintptr) (r uintptr) { ret = (*TFILE)(unsafe.Pointer(f)).Frpos z++ v7 = z - *(*Tsize_t)(unsafe.Pointer(plen)) = uint64(int64(v7) - int64(ret)) + *(*Tsize_t)(unsafe.Pointer(plen)) = uint64(int64(v7) - int64(int64(ret))) (*TFILE)(unsafe.Pointer(f)).Frpos = z } else { *(*[1]Tsize_t)(unsafe.Pointer(bp)) = [1]Tsize_t{} v8 = Xgetline(tls, f+168, bp, f) l = v8 if v8 > 0 { - *(*Tsize_t)(unsafe.Pointer(plen)) = uint64(l) + *(*Tsize_t)(unsafe.Pointer(plen)) = uint64(uint64(l)) ret = (*TFILE)(unsafe.Pointer(f)).Fgetln_buf } } @@ -135380,7 +136557,7 @@ func Xfgetpos(tls *TLS, f uintptr, pos uintptr) (r int32) { if off < 0 { return -int32(1) } - *(*int64)(unsafe.Pointer(pos)) = off + *(*int64)(unsafe.Pointer(pos)) = int64(int64(off)) return 0 } @@ -135419,7 +136596,7 @@ func Xfgets(tls *TLS, s uintptr, n int32, f uintptr) (r uintptr) { if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { z = Xmemchr(tls, (*TFILE)(unsafe.Pointer(f)).Frpos, int32('\n'), uint64(int64((*TFILE)(unsafe.Pointer(f)).Frend)-int64((*TFILE)(unsafe.Pointer(f)).Frpos))) if z != 0 { - v2 = int64(z) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) + int64(1) + v2 = int64(int64(z)) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) + int64(1) } else { v2 = int64((*TFILE)(unsafe.Pointer(f)).Frend) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) } @@ -135455,7 +136632,7 @@ func Xfgets(tls *TLS, s uintptr, n int32, f uintptr) (r uintptr) { break } n-- - v8 = int8(c) + v8 = int8(int8(c)) v9 = p p++ *(*int8)(unsafe.Pointer(v9)) = v8 @@ -135542,7 +136719,7 @@ func X__fgetwc_unlocked(tls *TLS, f uintptr) (r Twint_t) { var ploc uintptr var wc Twchar_t _, _, _ = loc, ploc, wc - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if (*TFILE)(unsafe.Pointer(f)).Fmode <= 0 { Xfwide(tls, f, int32(1)) @@ -135550,7 +136727,7 @@ func X__fgetwc_unlocked(tls *TLS, f uintptr) (r Twint_t) { *(*Tlocale_t)(unsafe.Pointer(ploc)) = (*TFILE)(unsafe.Pointer(f)).Flocale wc = int32(___fgetwc_unlocked_internal(tls, f)) *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc - return uint32(wc) + return uint32(uint32(wc)) } func Xfgetwc(tls *TLS, f uintptr) (r Twint_t) { @@ -135621,12 +136798,13 @@ func Xfgetws(tls *TLS, s uintptr, n int32, f uintptr) (r uintptr) { } v4 = p p += 4 - *(*Twchar_t)(unsafe.Pointer(v4)) = int32(c) + *(*Twchar_t)(unsafe.Pointer(v4)) = int32(int32(c)) if c == uint32('\n') { break } goto _3 _3: + ; n-- } *(*Twchar_t)(unsafe.Pointer(p)) = 0 @@ -135692,7 +136870,7 @@ func Xflockfile(tls *TLS, f uintptr) { return } ___lockfile(tls, f) - X__register_locked_file(tls, f, ___get_tp(tls)) + X__register_locked_file(tls, f, uintptr(___get_tp(tls))) } type Tcookie = struct { @@ -135717,13 +136895,15 @@ func _mseek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { var v2 Tsize_t _, _, _ = base, c, v2 c = (*TFILE)(unsafe.Pointer(f)).Fcookie - if !(uint32(whence) > uint32(2)) { + if !(uint32(uint32(whence)) > uint32(2)) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie)(unsafe.Pointer(c)).Flen1, @@ -135812,7 +136992,7 @@ func Xfmemopen(tls *TLS, buf uintptr, size Tsize_t, mode uintptr) (r uintptr) { var v3 Tsize_t _, _, _, _, _ = f, plus, v1, v2, v3 plus = BoolInt32(!!(Xstrchr(tls, mode, int32('+')) != 0)) - if !(Xstrchr(tls, __ccgo_ts+1492, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1521, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -135882,7 +137062,7 @@ func Xfopen(tls *TLS, filename uintptr, mode uintptr) (r uintptr) { var fd, flags int32 _, _, _ = f, fd, flags /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1492, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1521, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -135933,8 +137113,8 @@ func _cookieread(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { if ret <= 0 { goto bail } - readlen += uint64(ret) - remain -= uint64(ret) + readlen += uint64(uint64(ret)) + remain -= uint64(uint64(ret)) } if !((*TFILE)(unsafe.Pointer(f)).Fbuf_size != 0) || remain > BoolUint64(!!((*TFILE)(unsafe.Pointer(f)).Fbuf_size != 0)) { return readlen @@ -135953,6 +137133,7 @@ func _cookieread(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer(buf + uintptr(v1))) = *(*uint8)(unsafe.Pointer(v2)) return readlen bail: + ; if ret == 0 { v4 = int32(F_EOF) } else { @@ -135991,7 +137172,7 @@ func _cookiewrite(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint32)(unsafe.Pointer(f)) |= uint32(F_ERR) return uint64(0) } - return uint64(ret) + return uint64(uint64(ret)) } func _cookieseek(tls *TLS, f uintptr, _off Toff_t, whence int32) (r Toff_t) { @@ -136002,7 +137183,7 @@ func _cookieseek(tls *TLS, f uintptr, _off Toff_t, whence int32) (r Toff_t) { var res int32 _, _ = fc, res fc = (*TFILE)(unsafe.Pointer(f)).Fcookie - if uint32(whence) > uint32(2) { + if uint32(uint32(whence)) > uint32(2) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) } @@ -136012,7 +137193,7 @@ func _cookieseek(tls *TLS, f uintptr, _off Toff_t, whence int32) (r Toff_t) { } res = (*(*func(*TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfcookie)(unsafe.Pointer(fc)).Fiofuncs.Fseek})))(tls, (*Tfcookie)(unsafe.Pointer(fc)).Fcookie, bp, whence) if res < 0 { - return int64(res) + return int64(int64(res)) } return *(*Toff_t)(unsafe.Pointer(bp)) } @@ -136036,7 +137217,7 @@ func Xfopencookie(tls *TLS, cookie uintptr, mode uintptr, iofuncs Tcookie_io_fun var v2 int32 _, _, _ = f, v1, v2 /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1492, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1521, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -136098,7 +137279,7 @@ func _locking_putc(tls *TLS, c int32, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1538) v2 = v1 goto _3 _3: @@ -136121,7 +137302,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1538) v9 = v8 goto _10 _10: @@ -136152,7 +137333,7 @@ func Xfputc(tls *TLS, c int32, f uintptr) (r int32) { v1 = c v2 = f l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if int32(uint8(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = uint8(v1) v8 = v2 + 40 @@ -136204,7 +137385,7 @@ func X__fputwc_unlocked(tls *TLS, c Twchar_t, f uintptr) (r Twint_t) { var v2 uint8 var _ /* mbc at bp+0 */ [4]int8 _, _, _, _, _, _, _ = l, loc, ploc, v1, v2, v3, v4 - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if (*TFILE)(unsafe.Pointer(f)).Fmode <= 0 { Xfwide(tls, f, int32(1)) @@ -136232,16 +137413,16 @@ func X__fputwc_unlocked(tls *TLS, c Twchar_t, f uintptr) (r Twint_t) { } } else { l = Xwctomb(tls, bp, c) - if l < 0 || X__fwritex(tls, bp, uint64(l), f) < uint64(l) { + if l < 0 || X__fwritex(tls, bp, uint64(uint64(l)), f) < uint64(uint64(l)) { c = Int32FromUint32(0xffffffff) } } } - if uint32(c) == uint32(0xffffffff) { + if uint32(uint32(c)) == uint32(0xffffffff) { *(*uint32)(unsafe.Pointer(f)) |= uint32(F_ERR) } *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc - return uint32(c) + return uint32(uint32(c)) } func Xfputwc(tls *TLS, c Twchar_t, f uintptr) (r Twint_t) { @@ -136261,7 +137442,7 @@ func Xfputwc(tls *TLS, c Twchar_t, f uintptr) (r Twint_t) { if __need_unlock != 0 { ___unlockfile(tls, f) } - return uint32(c) + return uint32(uint32(c)) } func Xfputwc_unlocked(tls *TLS, c Twchar_t, f uintptr) (r Twint_t) { @@ -136296,7 +137477,7 @@ func Xfputws(tls *TLS, _ws uintptr, f uintptr) (r int32) { var _ /* buf at bp+8 */ [1024]uint8 _, _, _, _, _, _, _ = __need_unlock, l, loc, ploc, v1, v2, v3 l = uint64(0) - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if AtomicLoadPInt32(f+140) >= 0 { v1 = ___lockfile(tls, f) @@ -136326,7 +137507,7 @@ func Xfputws(tls *TLS, _ws uintptr, f uintptr) (r int32) { ___unlockfile(tls, f) } *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc - return int32(l) /* 0 or -1 */ + return int32(int32(l)) /* 0 or -1 */ } func Xfputws_unlocked(tls *TLS, _ws uintptr, f uintptr) (r int32) { @@ -136392,6 +137573,7 @@ func Xfread(tls *TLS, destv uintptr, size Tsize_t, nmemb Tsize_t, f uintptr) (r } goto _3 _3: + ; l -= k dest += uintptr(k) } @@ -136467,8 +137649,10 @@ func Xfreopen(tls *TLS, filename uintptr, mode uintptr, f uintptr) (r uintptr) { } return f fail2: + ; Xfclose(tls, f2) fail: + ; Xfclose(tls, f) return UintptrFromInt32(0) } @@ -136503,12 +137687,12 @@ func X__fseeko_unlocked(tls *TLS, f uintptr, off Toff_t, whence int32) (r int32) var v1, v2, v3 uintptr _, _, _ = v1, v2, v3 /* Fail immediately for invalid whence argument. */ - if whence != int32(SEEK_CUR) && whence != SEEK_SET && whence != int32(SEEK_END) { + if whence != int32(1) && whence != 0 && whence != int32(2) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } /* Adjust relative offset for unread data in buffer, if any. */ - if whence == int32(SEEK_CUR) && (*TFILE)(unsafe.Pointer(f)).Frend != 0 { + if whence == int32(1) && (*TFILE)(unsafe.Pointer(f)).Frend != 0 { off -= int64((*TFILE)(unsafe.Pointer(f)).Frend) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) } /* Flush write buffer, and report error on failure. */ @@ -136577,7 +137761,7 @@ func Xfsetpos(tls *TLS, f uintptr, pos uintptr) (r int32) { trc("tls=%v f=%v pos=%v, (%v:)", tls, f, pos, origin(2)) defer func() { trc("-> %v", r) }() } - return X__fseeko(tls, f, *(*int64)(unsafe.Pointer(pos)), SEEK_SET) + return X__fseeko(tls, f, int64(*(*int64)(unsafe.Pointer(pos))), 0) } /* Support signed or unsigned plain-char */ @@ -136598,9 +137782,9 @@ func X__ftello_unlocked(tls *TLS, f uintptr) (r Toff_t) { var v1 int32 _, _ = pos, v1 if (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_APP) != 0 && (*TFILE)(unsafe.Pointer(f)).Fwpos != (*TFILE)(unsafe.Pointer(f)).Fwbase { - v1 = int32(SEEK_END) + v1 = int32(2) } else { - v1 = int32(SEEK_CUR) + v1 = int32(1) } pos = (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, 0, v1) if pos < 0 { @@ -136667,7 +137851,7 @@ func X__do_orphaned_stdio_locks(tls *TLS) { } var f uintptr _ = f - f = (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks + f = (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks for { if !(f != 0) { break @@ -136676,9 +137860,10 @@ func X__do_orphaned_stdio_locks(tls *TLS) { // // "mov %1, %0 ; lock ; orl $0,(%%rsp)" // : "=m"(*p) : "r"(x) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1522) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1551) goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } } @@ -136694,7 +137879,7 @@ func X__unlist_locked_file(tls *TLS, f uintptr) { if (*TFILE)(unsafe.Pointer(f)).Fprev_locked != 0 { (*TFILE)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fprev_locked)).Fnext_locked = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } else { - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } } } @@ -136721,7 +137906,7 @@ func Xftrylockfile(tls *TLS, f uintptr) (r int32) { var self Tpthread_t var v5 bool _, _, _, _, _, _, _ = owner, self, tid, v1, v2, v3, v5 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) tid = (*t__pthread)(unsafe.Pointer(self)).Ftid owner = AtomicLoadPInt32(f + 140) if owner & ^Int32FromInt32(MAYBE_WAITERS) == tid { @@ -136742,7 +137927,7 @@ func Xftrylockfile(tls *TLS, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1548) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1577) v3 = v2 goto _4 _4: @@ -136783,7 +137968,7 @@ func Xfwide(tls *TLS, f uintptr, mode int32) (r int32) { __need_unlock = v1 if mode != 0 { if !((*TFILE)(unsafe.Pointer(f)).Flocale != 0) { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -136848,6 +138033,7 @@ func X__fwritex(tls *TLS, s uintptr, l Tsize_t, f uintptr) (r Tsize_t) { } goto _1 _1: + ; i-- } if i != 0 { @@ -136934,7 +138120,7 @@ func _locking_getc1(tls *TLS, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1525) v2 = v1 goto _3 _3: @@ -136955,7 +138141,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1525) v8 = v7 goto _9 _9: @@ -136984,7 +138170,7 @@ func Xgetc(tls *TLS, f uintptr) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = f l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -137054,7 +138240,7 @@ func _locking_getc2(tls *TLS, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1525) v2 = v1 goto _3 _3: @@ -137075,7 +138261,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1496) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1525) v8 = v7 goto _9 _9: @@ -137104,7 +138290,7 @@ func Xgetchar(tls *TLS) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = uintptr(unsafe.Pointer(&X__stdin_FILE)) l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -137175,7 +138361,7 @@ func Xgetdelim(tls *TLS, s uintptr, n uintptr, delim int32, f uintptr) (r Tssize if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { z = Xmemchr(tls, (*TFILE)(unsafe.Pointer(f)).Frpos, delim, uint64(int64((*TFILE)(unsafe.Pointer(f)).Frend)-int64((*TFILE)(unsafe.Pointer(f)).Frpos))) if z != 0 { - v3 = int64(z) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) + int64(1) + v3 = int64(int64(z)) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) + int64(1) } else { v3 = int64((*TFILE)(unsafe.Pointer(f)).Frend) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) } @@ -137244,9 +138430,9 @@ func Xgetdelim(tls *TLS, s uintptr, n uintptr, delim int32, f uintptr) (r Tssize v9 = f + 8 *(*uintptr)(unsafe.Pointer(v9))-- v8 = *(*uintptr)(unsafe.Pointer(v9)) - *(*uint8)(unsafe.Pointer(v8)) = uint8(c) + *(*uint8)(unsafe.Pointer(v8)) = uint8(uint8(c)) } else { - v10 = int8(c) + v10 = int8(int8(c)) v11 = i i++ *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)) + uintptr(v11))) = v10 @@ -137261,7 +138447,7 @@ func Xgetdelim(tls *TLS, s uintptr, n uintptr, delim int32, f uintptr) (r Tssize if __need_unlock != 0 { ___unlockfile(tls, f) } - return int64(i) + return int64(int64(i)) } func X__getdelim(tls *TLS, s uintptr, n uintptr, delim int32, f uintptr) (r Tssize_t) { @@ -137312,7 +138498,7 @@ func Xgets(tls *TLS, s uintptr) (r uintptr) { } v6 = i i++ - *(*int8)(unsafe.Pointer(s + uintptr(v6))) = int8(c) + *(*int8)(unsafe.Pointer(s + uintptr(v6))) = int8(int8(c)) } *(*int8)(unsafe.Pointer(s + uintptr(i))) = 0 if c != int32('\n') && (!((*TFILE)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__stdin_FILE)))).Fflags&Uint32FromInt32(F_EOF) != 0) || !(i != 0)) { @@ -137425,13 +138611,15 @@ func _ms_seek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { var v2 Tsize_t _, _, _ = base, c, v2 c = (*TFILE)(unsafe.Pointer(f)).Fcookie - if !(uint32(whence) > uint32(2)) { + if !(uint32(uint32(whence)) > uint32(2)) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie1)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie1)(unsafe.Pointer(c)).Flen1, @@ -137556,13 +138744,15 @@ func _wms_seek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { var v2 Tsize_t _, _, _ = base, c, v2 c = (*TFILE)(unsafe.Pointer(f)).Fcookie - if !(uint32(whence) > uint32(2)) { + if !(uint32(uint32(whence)) > uint32(2)) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie2)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie2)(unsafe.Pointer(c)).Flen1, @@ -137694,7 +138884,7 @@ func Xpclose(tls *TLS, f uintptr) (r1 int32) { } } if r < 0 { - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } return *(*int32)(unsafe.Pointer(bp)) } @@ -137756,7 +138946,7 @@ func _locking_putc1(tls *TLS, c int32, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1538) v2 = v1 goto _3 _3: @@ -137779,7 +138969,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1538) v9 = v8 goto _10 _10: @@ -137810,7 +139000,7 @@ func Xputc(tls *TLS, c int32, f uintptr) (r int32) { v1 = c v2 = f l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if int32(uint8(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = uint8(v1) v8 = v2 + 40 @@ -137886,7 +139076,7 @@ func _locking_putc2(tls *TLS, c int32, f uintptr) (r int32) { // // "lock ; cmpxchg %3, %1" // : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 4, __ccgo_ts+1538) v2 = v1 goto _3 _3: @@ -137909,7 +139099,7 @@ _3: // // "xchg %0, %1" // : "=r"(v), "=m"(*p) : "0"(v) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1509) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 22, __ccgo_ts+1538) v9 = v8 goto _10 _10: @@ -137940,7 +139130,7 @@ func Xputchar(tls *TLS, c int32) (r int32) { v1 = c v2 = uintptr(unsafe.Pointer(&X__stdout_FILE)) l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if int32(uint8(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = uint8(v1) v8 = v2 + 40 @@ -138063,7 +139253,7 @@ func Xremove(tls *TLS, path uintptr) (r1 int32) { if r == -int32(EISDIR) { r = int32(X__syscall1(tls, int64(SYS_rmdir), int64(path))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xrename(tls *TLS, old uintptr, new1 uintptr) (r int32) { @@ -138086,7 +139276,7 @@ func Xrewind(tls *TLS, f uintptr) { v1 = 0 } __need_unlock = v1 - X__fseeko_unlocked(tls, f, 0, SEEK_SET) + X__fseeko_unlocked(tls, f, 0, 0) *(*uint32)(unsafe.Pointer(f)) &= uint32(^Int32FromInt32(F_ERR)) if __need_unlock != 0 { ___unlockfile(tls, f) @@ -138308,10 +139498,10 @@ func Xtempnam(tls *TLS, dir uintptr, pfx uintptr) (r1 uintptr) { var _ /* s at bp+1 */ [4096]int8 _, _, _, _, _ = dl, l, pl, r, try if !(dir != 0) { - dir = __ccgo_ts + 1561 + dir = __ccgo_ts + 1590 } if !(pfx != 0) { - pfx = __ccgo_ts + 1566 + pfx = __ccgo_ts + 1595 } dl = Xstrlen(tls, dir) pl = Xstrlen(tls, pfx) @@ -138338,6 +139528,7 @@ func Xtempnam(tls *TLS, dir uintptr, pfx uintptr) (r1 uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138364,7 +139555,7 @@ func Xtmpfile(tls *TLS) (r uintptr) { fd = int32(X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_open), int64(bp), int64(Int32FromInt32(O_RDWR)|Int32FromInt32(O_CREAT)|Int32FromInt32(O_EXCL)|Int32FromInt32(O_LARGEFILE)), int64(Int32FromInt32(0600)))))) if fd >= 0 { X__syscall1(tls, int64(SYS_unlink), int64(bp)) - f = X__fdopen(tls, fd, __ccgo_ts+1571) + f = X__fdopen(tls, fd, __ccgo_ts+1600) if !(f != 0) { X__syscall1(tls, int64(SYS_close), int64(fd)) } @@ -138372,6 +139563,7 @@ func Xtmpfile(tls *TLS) (r uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138407,6 +139599,7 @@ func Xtmpnam(tls *TLS, buf uintptr) (r1 uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138443,12 +139636,12 @@ func Xungetc(tls *TLS, c int32, f uintptr) (r int32) { v3 = f + 8 *(*uintptr)(unsafe.Pointer(v3))-- v2 = *(*uintptr)(unsafe.Pointer(v3)) - *(*uint8)(unsafe.Pointer(v2)) = uint8(c) + *(*uint8)(unsafe.Pointer(v2)) = uint8(uint8(c)) *(*uint32)(unsafe.Pointer(f)) &= uint32(^Int32FromInt32(F_EOF)) if __need_unlock != 0 { ___unlockfile(tls, f) } - return int32(uint8(c)) + return int32(uint8(uint8(c))) } func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { @@ -138464,7 +139657,7 @@ func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { var v3 bool var _ /* mbc at bp+0 */ [4]uint8 _, _, _, _, _, _, _, _, _, _ = __need_unlock, l, loc, ploc, v1, v2, v3, v4, v5, p6 - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if AtomicLoadPInt32(f+140) >= 0 { v1 = ___lockfile(tls, f) @@ -138480,7 +139673,7 @@ func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { X__toread(tls, f) } if v3 = !((*TFILE)(unsafe.Pointer(f)).Frpos != 0) || c == uint32(0xffffffff); !v3 { - v2 = int32(Xwcrtomb(tls, bp, int32(c), uintptr(0))) + v2 = int32(Xwcrtomb(tls, bp, int32(int32(c)), uintptr(0))) l = v2 } if v3 || v2 < 0 || (*TFILE)(unsafe.Pointer(f)).Frpos < (*TFILE)(unsafe.Pointer(f)).Fbuf-uintptr(UNGET)+uintptr(l) { @@ -138494,11 +139687,11 @@ func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { v5 = f + 8 *(*uintptr)(unsafe.Pointer(v5))-- v4 = *(*uintptr)(unsafe.Pointer(v5)) - *(*uint8)(unsafe.Pointer(v4)) = uint8(c) + *(*uint8)(unsafe.Pointer(v4)) = uint8(uint8(c)) } else { p6 = f + 8 *(*uintptr)(unsafe.Pointer(p6)) -= uintptr(l) - Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p6)), bp, uint64(l)) + Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p6)), bp, uint64(uint64(l))) } *(*uint32)(unsafe.Pointer(f)) &= uint32(^Int32FromInt32(F_EOF)) if __need_unlock != 0 { @@ -138522,13 +139715,13 @@ func Xvasprintf(tls *TLS, s uintptr, fmt uintptr, ap Tva_list) (r int32) { l = Xvsnprintf(tls, uintptr(0), uint64(0), fmt, ap2) _ = ap2 if v2 = l < 0; !v2 { - v1 = Xmalloc(tls, uint64(uint32(l)+uint32(1))) + v1 = Xmalloc(tls, uint64(uint32(uint32(l))+uint32(1))) *(*uintptr)(unsafe.Pointer(s)) = v1 } if v2 || !(v1 != 0) { return -int32(1) } - return Xvsnprintf(tls, *(*uintptr)(unsafe.Pointer(s)), uint64(uint32(l)+uint32(1)), fmt, ap) + return Xvsnprintf(tls, *(*uintptr)(unsafe.Pointer(s)), uint64(uint32(uint32(l))+uint32(1)), fmt, ap) } func Xvdprintf(tls *TLS, fd int32, fmt uintptr, ap Tva_list) (r int32) { @@ -138716,7 +139909,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -138738,7 +139931,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -138756,26 +139949,27 @@ func _pad3(tls *TLS, f uintptr, c int8, w int32, l int32, fl int32) { var v1 uint64 var _ /* pad at bp+0 */ [256]int8 _ = v1 - if uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))|Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0 || l >= w { + if uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))|Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0 || l >= w { return } l = w - l - if uint64(l) > uint64(256) { + if uint64(uint64(l)) > uint64(256) { v1 = uint64(256) } else { - v1 = uint64(l) + v1 = uint64(uint64(l)) } - Xmemset(tls, bp, int32(c), v1) + Xmemset(tls, bp, int32(int32(c)), v1) for { - if !(uint64(l) >= uint64(256)) { + if !(uint64(uint64(l)) >= uint64(256)) { break } _out(tls, f, bp, uint64(256)) goto _2 _2: + ; l = int32(uint64(l) - Uint64FromInt64(256)) } - _out(tls, f, bp, uint64(l)) + _out(tls, f, bp, uint64(uint64(l))) } var _xdigits1 = [16]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'} @@ -138792,6 +139986,7 @@ func _fmt_x(tls *TLS, x Tuintmax_t, s uintptr, lower int32) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(int32(_xdigits1[x&uint64(15)]) | lower) goto _1 _1: + ; x >>= uint64(4) } return s @@ -138809,6 +140004,7 @@ func _fmt_o(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(uint64('0') + x&uint64(7)) goto _1 _1: + ; x >>= uint64(3) } return s @@ -138827,6 +140023,7 @@ func _fmt_u(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(uint64('0') + x%uint64(10)) goto _1 _1: + ; x /= uint64(10) } y = x @@ -138839,6 +140036,7 @@ func _fmt_u(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v4)) = int8(uint64('0') + y%uint64(10)) goto _3 _3: + ; y /= uint64(10) } return s @@ -138871,20 +140069,20 @@ func _fmt_fp(tls *TLS, f uintptr, y float64, w int32, p int32, fl int32, t int32 var _ /* ebuf0 at bp+538 */ [12]int8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, carry, carry1, d, e, ebuf, estr, i, j, l, need, pl, prefix, r, re, rm, round, round1, s, s1, s2, s3, s4, sh, sh1, small, x, x1, x2, z, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v24, v25, v27, v28, v3, v31, v32, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v48, v49, v5, v51, v52, v54, v55, v56, v57, v58, v6, v7, v8, v9 *(*int32)(unsafe.Pointer(bp + 512)) = 0 - prefix = __ccgo_ts + 1574 + prefix = __ccgo_ts + 1603 ebuf = bp + 538 + uintptr(Uint64FromInt32(3)*Uint64FromInt64(4)) pl = int32(1) - *(*float64)(unsafe.Pointer(bp)) = y + *(*float64)(unsafe.Pointer(bp)) = float64(float64(y)) v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: if int32(v1>>Int32FromInt32(63)) != 0 { y = -y } else { - if uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0 { + if uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0 { prefix += uintptr(3) } else { - if uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0 { + if uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0 { prefix += uintptr(6) } else { prefix++ @@ -138892,29 +140090,29 @@ _2: } } } - *(*float64)(unsafe.Pointer(bp)) = y + *(*float64)(unsafe.Pointer(bp)) = float64(float64(y)) v3 = *(*uint64)(unsafe.Pointer(bp)) goto _4 _4: if !(BoolInt32(v3&(-Uint64FromUint64(1)>>Int32FromInt32(1)) < Uint64FromUint64(0x7ff)< int32(3)+pl { v7 = w } else { @@ -138981,32 +140179,32 @@ _4: *(*int8)(unsafe.Pointer(v13)) = int8(t + (Int32FromUint8('p') - Int32FromUint8('a'))) s = bp + 516 for cond := true; cond; cond = y != 0 { - x = int32(y) + x = int32(int32(y)) v14 = s s++ *(*int8)(unsafe.Pointer(v14)) = int8(int32(_xdigits1[x]) | t&int32(32)) - y = Float64FromInt32(16) * (y - float64(x)) - if int64(s)-t__predefined_ptrdiff_t(bp+516) == int64(1) && (y != 0 || p > 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { + y = Float64FromInt32(16) * (y - float64(float64(x))) + if int64(int64(s))-t__predefined_ptrdiff_t(bp+516) == int64(1) && (y != 0 || p > 0 || uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { v15 = s s++ *(*int8)(unsafe.Pointer(v15)) = int8('.') } } - if int64(p) > int64(Int32FromInt32(INT_MAX)-Int32FromInt32(2))-(int64(ebuf)-int64(estr))-int64(pl) { + if int64(int64(p)) > int64(Int32FromInt32(INT_MAX)-Int32FromInt32(2))-(int64(int64(ebuf))-int64(int64(estr)))-int64(int64(pl)) { return -int32(1) } - if p != 0 && int64(s)-t__predefined_ptrdiff_t(bp+516)-int64(2) < int64(p) { - l = int32(int64(p+Int32FromInt32(2)) + (int64(ebuf) - int64(estr))) + if p != 0 && int64(int64(s))-t__predefined_ptrdiff_t(bp+516)-int64(2) < int64(int64(p)) { + l = int32(int64(p+Int32FromInt32(2)) + (int64(int64(ebuf)) - int64(int64(estr)))) } else { - l = int32(int64(s) - t__predefined_ptrdiff_t(bp+516) + (int64(ebuf) - int64(estr))) + l = int32(int64(int64(s)) - t__predefined_ptrdiff_t(bp+516) + (int64(int64(ebuf)) - int64(int64(estr)))) } _pad3(tls, f, int8(' '), w, pl+l, fl) - _out(tls, f, prefix, uint64(pl)) - _pad3(tls, f, int8('0'), w, pl+l, int32(uint32(fl)^Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' ')))) - _out(tls, f, bp+516, uint64(int64(s)-t__predefined_ptrdiff_t(bp+516))) - _pad3(tls, f, int8('0'), int32(int64(l)-(int64(ebuf)-int64(estr))-(int64(s)-t__predefined_ptrdiff_t(bp+516))), 0, 0) - _out(tls, f, estr, uint64(int64(ebuf)-int64(estr))) - _pad3(tls, f, int8(' '), w, pl+l, int32(uint32(fl)^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) + _out(tls, f, prefix, uint64(uint64(pl))) + _pad3(tls, f, int8('0'), w, pl+l, int32(uint32(uint32(fl))^Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' ')))) + _out(tls, f, bp+516, uint64(int64(int64(s))-t__predefined_ptrdiff_t(bp+516))) + _pad3(tls, f, int8('0'), int32(int64(int64(l))-(int64(int64(ebuf))-int64(int64(estr)))-(int64(int64(s))-t__predefined_ptrdiff_t(bp+516))), 0, 0) + _out(tls, f, estr, uint64(int64(int64(ebuf))-int64(int64(estr)))) + _pad3(tls, f, int8(' '), w, pl+l, int32(uint32(uint32(fl))^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) if w > pl+l { v16 = w } else { @@ -139035,7 +140233,7 @@ _4: a = v19 } for cond := true; cond; cond = y != 0 { - *(*Tuint32_t)(unsafe.Pointer(z)) = uint32(y) + *(*Tuint32_t)(unsafe.Pointer(z)) = uint32(uint32(y)) v21 = z z += 4 y = Float64FromInt32(1000000000) * (y - float64(*(*Tuint32_t)(unsafe.Pointer(v21)))) @@ -139053,11 +140251,12 @@ _4: if !(d >= a) { break } - x1 = uint64(*(*Tuint32_t)(unsafe.Pointer(d)))<>sh1) * rm goto _26 _26: + ; d += 4 } if !(*(*Tuint32_t)(unsafe.Pointer(a)) != 0) { @@ -139106,20 +140306,21 @@ _4: v28 = a } b = v28 - if (int64(z)-int64(b))/4 > int64(need) { + if (int64(int64(z))-int64(int64(b)))/4 > int64(int64(need)) { z = b + uintptr(need)*4 } *(*int32)(unsafe.Pointer(bp + 512)) += sh1 } if a < z { i = int32(10) - e = int32(Int64FromInt32(9) * ((int64(r) - int64(a)) / 4)) + e = int32(Int64FromInt32(9) * ((int64(int64(r)) - int64(int64(a))) / 4)) for { - if !(*(*Tuint32_t)(unsafe.Pointer(a)) >= uint32(i)) { + if !(*(*Tuint32_t)(unsafe.Pointer(a)) >= uint32(uint32(i))) { break } goto _29 _29: + ; i *= int32(10) e++ } @@ -139128,7 +140329,7 @@ _4: } /* Perform rounding: j is precision after the radix (possibly neg) */ j = p - BoolInt32(t|int32(32) != int32('f'))*e - BoolInt32(t|int32(32) == int32('g') && p != 0) - if int64(j) < int64(9)*((int64(z)-int64(r))/4-int64(1)) { + if int64(int64(j)) < int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1)) { /* We avoid C's broken division of negative numbers */ d = r + uintptr(1)*4 + uintptr((j+Int32FromInt32(9)*Int32FromInt32(LDBL_MAX_EXP))/Int32FromInt32(9)-Int32FromInt32(LDBL_MAX_EXP))*4 j += Int32FromInt32(9) * Int32FromInt32(LDBL_MAX_EXP) @@ -139141,14 +140342,15 @@ _4: } goto _30 _30: + ; i *= int32(10) j++ } - x2 = *(*Tuint32_t)(unsafe.Pointer(d)) % uint32(i) + x2 = *(*Tuint32_t)(unsafe.Pointer(d)) % uint32(uint32(i)) /* Are there any significant digits past j? */ if x2 != 0 || d+uintptr(1)*4 != z { round1 = Float64FromInt32(2) / Float64FromFloat64(2.22044604925031308085e-16) - if *(*Tuint32_t)(unsafe.Pointer(d))/uint32(i)&uint32(1) != 0 || i == int32(1000000000) && d > a && *(*Tuint32_t)(unsafe.Pointer(d + uintptr(-Int32FromInt32(1))*4))&uint32(1) != 0 { + if *(*Tuint32_t)(unsafe.Pointer(d))/uint32(uint32(i))&uint32(1) != 0 || i == int32(1000000000) && d > a && *(*Tuint32_t)(unsafe.Pointer(d + uintptr(-Int32FromInt32(1))*4))&uint32(1) != 0 { round1 += Float64FromInt32(2) } if x2 < uint32(i/int32(2)) { @@ -139167,7 +140369,7 @@ _4: *(*Tuint32_t)(unsafe.Pointer(d)) -= x2 /* Decide whether to round by probing round+small */ if round1+small != round1 { - *(*Tuint32_t)(unsafe.Pointer(d)) = *(*Tuint32_t)(unsafe.Pointer(d)) + uint32(i) + *(*Tuint32_t)(unsafe.Pointer(d)) = *(*Tuint32_t)(unsafe.Pointer(d)) + uint32(uint32(i)) for *(*Tuint32_t)(unsafe.Pointer(d)) > uint32(999999999) { v31 = d d -= 4 @@ -139180,13 +140382,14 @@ _4: *(*Tuint32_t)(unsafe.Pointer(d))++ } i = int32(10) - e = int32(Int64FromInt32(9) * ((int64(r) - int64(a)) / 4)) + e = int32(Int64FromInt32(9) * ((int64(int64(r)) - int64(int64(a))) / 4)) for { - if !(*(*Tuint32_t)(unsafe.Pointer(a)) >= uint32(i)) { + if !(*(*Tuint32_t)(unsafe.Pointer(a)) >= uint32(uint32(i))) { break } goto _33 _33: + ; i *= int32(10) e++ } @@ -139202,6 +140405,7 @@ _4: } goto _34 _34: + ; z -= 4 } if t|int32(32) == int32('g') { @@ -139215,17 +140419,18 @@ _4: t -= int32(2) p-- } - if !(uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { + if !(uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { /* Count trailing zeros in last place */ if z > a && *(*Tuint32_t)(unsafe.Pointer(z + uintptr(-Int32FromInt32(1))*4)) != 0 { i = int32(10) j = Int32FromInt32(0) for { - if !(*(*Tuint32_t)(unsafe.Pointer(z + uintptr(-Int32FromInt32(1))*4))%uint32(i) == uint32(0)) { + if !(*(*Tuint32_t)(unsafe.Pointer(z + uintptr(-Int32FromInt32(1))*4))%uint32(uint32(i)) == uint32(0)) { break } goto _35 _35: + ; i *= int32(10) j++ } @@ -139233,35 +140438,35 @@ _4: j = int32(9) } if t|int32(32) == int32('f') { - if int64(Int32FromInt32(0)) > int64(9)*((int64(z)-int64(r))/4-int64(1))-int64(j) { + if int64(Int32FromInt32(0)) > int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1))-int64(int64(j)) { v37 = int64(Int32FromInt32(0)) } else { - v37 = int64(9)*((int64(z)-int64(r))/4-int64(1)) - int64(j) + v37 = int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1)) - int64(int64(j)) } if int64(p) < v37 { v36 = int64(p) } else { - if int64(Int32FromInt32(0)) > int64(9)*((int64(z)-int64(r))/4-int64(1))-int64(j) { + if int64(Int32FromInt32(0)) > int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1))-int64(int64(j)) { v38 = int64(Int32FromInt32(0)) } else { - v38 = int64(9)*((int64(z)-int64(r))/4-int64(1)) - int64(j) + v38 = int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1)) - int64(int64(j)) } v36 = v38 } p = int32(v36) } else { - if int64(Int32FromInt32(0)) > int64(9)*((int64(z)-int64(r))/4-int64(1))+int64(e)-int64(j) { + if int64(Int32FromInt32(0)) > int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1))+int64(int64(e))-int64(int64(j)) { v40 = int64(Int32FromInt32(0)) } else { - v40 = int64(9)*((int64(z)-int64(r))/4-int64(1)) + int64(e) - int64(j) + v40 = int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1)) + int64(int64(e)) - int64(int64(j)) } if int64(p) < v40 { v39 = int64(p) } else { - if int64(Int32FromInt32(0)) > int64(9)*((int64(z)-int64(r))/4-int64(1))+int64(e)-int64(j) { + if int64(Int32FromInt32(0)) > int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1))+int64(int64(e))-int64(int64(j)) { v41 = int64(Int32FromInt32(0)) } else { - v41 = int64(9)*((int64(z)-int64(r))/4-int64(1)) + int64(e) - int64(j) + v41 = int64(9)*((int64(int64(z))-int64(int64(r)))/4-int64(1)) + int64(int64(e)) - int64(int64(j)) } v39 = v41 } @@ -139269,10 +140474,10 @@ _4: } } } - if p > Int32FromInt32(INT_MAX)-Int32FromInt32(1)-BoolInt32(p != 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { + if p > Int32FromInt32(INT_MAX)-Int32FromInt32(1)-BoolInt32(p != 0 || uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) { return -int32(1) } - l = int32(1) + p + BoolInt32(p != 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) + l = int32(1) + p + BoolInt32(p != 0 || uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0) if t|int32(32) == int32('f') { if e > int32(INT_MAX)-l { return -int32(1) @@ -139287,7 +140492,7 @@ _4: v42 = e } estr = _fmt_u(tls, uint64(v42), ebuf) - for int64(ebuf)-int64(estr) < int64(2) { + for int64(int64(ebuf))-int64(int64(estr)) < int64(2) { estr-- v43 = estr *(*int8)(unsafe.Pointer(v43)) = int8('0') @@ -139302,18 +140507,18 @@ _4: *(*int8)(unsafe.Pointer(v44)) = int8(v45) estr-- v46 = estr - *(*int8)(unsafe.Pointer(v46)) = int8(t) - if int64(ebuf)-int64(estr) > int64(int32(INT_MAX)-l) { + *(*int8)(unsafe.Pointer(v46)) = int8(int8(t)) + if int64(int64(ebuf))-int64(int64(estr)) > int64(int32(INT_MAX)-l) { return -int32(1) } - l = int32(int64(l) + (int64(ebuf) - int64(estr))) + l = int32(int64(l) + (int64(int64(ebuf)) - int64(int64(estr)))) } if l > int32(INT_MAX)-pl { return -int32(1) } _pad3(tls, f, int8(' '), w, pl+l, fl) - _out(tls, f, prefix, uint64(pl)) - _pad3(tls, f, int8('0'), w, pl+l, int32(uint32(fl)^Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' ')))) + _out(tls, f, prefix, uint64(uint64(pl))) + _pad3(tls, f, int8('0'), w, pl+l, int32(uint32(uint32(fl))^Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' ')))) if t|int32(32) == int32('f') { if a > r { a = r @@ -139337,13 +140542,14 @@ _4: *(*int8)(unsafe.Pointer(v49)) = int8('0') } } - _out(tls, f, s2, uint64(int64(bp+516+uintptr(9))-int64(s2))) + _out(tls, f, s2, uint64(int64(bp+516+uintptr(9))-int64(int64(s2)))) goto _47 _47: + ; d += 4 } - if p != 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { - _out(tls, f, __ccgo_ts+537, uint64(1)) + if p != 0 || uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { + _out(tls, f, __ccgo_ts+575, uint64(1)) } for { if !(d < z && p > 0) { @@ -139363,6 +140569,7 @@ _4: _out(tls, f, s3, uint64(v52)) goto _50 _50: + ; d += 4 p -= int32(9) } @@ -139392,25 +140599,26 @@ _4: v56 = s4 s4++ _out(tls, f, v56, uint64(1)) - if p > 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { - _out(tls, f, __ccgo_ts+537, uint64(1)) + if p > 0 || uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { + _out(tls, f, __ccgo_ts+575, uint64(1)) } } - if int64(bp+516+UintptrFromInt32(9))-int64(s4) < int64(p) { - v57 = int64(bp+516+UintptrFromInt32(9)) - int64(s4) + if int64(bp+516+UintptrFromInt32(9))-int64(int64(s4)) < int64(p) { + v57 = int64(bp+516+UintptrFromInt32(9)) - int64(int64(s4)) } else { v57 = int64(p) } _out(tls, f, s4, uint64(v57)) - p = int32(int64(p) - (int64(bp+516+UintptrFromInt32(9)) - int64(s4))) + p = int32(int64(p) - (int64(bp+516+UintptrFromInt32(9)) - int64(int64(s4)))) goto _53 _53: + ; d += 4 } _pad3(tls, f, int8('0'), p+int32(18), int32(18), 0) - _out(tls, f, estr, uint64(int64(ebuf)-int64(estr))) + _out(tls, f, estr, uint64(int64(int64(ebuf))-int64(int64(estr)))) } - _pad3(tls, f, int8(' '), w, pl+l, int32(uint32(fl)^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) + _pad3(tls, f, int8(' '), w, pl+l, int32(uint32(uint32(fl))^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) if w > pl+l { v58 = w } else { @@ -139427,13 +140635,14 @@ func _getint(tls *TLS, s uintptr) (r int32) { if !(BoolInt32(uint32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-uint32('0') < uint32(10)) != 0) { break } - if uint32(i) > Uint32FromInt32(INT_MAX)/Uint32FromUint32(10) || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-int32('0') > int32(INT_MAX)-int32(10)*i { + if uint32(uint32(i)) > Uint32FromInt32(INT_MAX)/Uint32FromUint32(10) || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-int32('0') > int32(INT_MAX)-int32(10)*i { i = -int32(1) } else { i = int32(10)*i + (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s))))) - int32('0')) } goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return i @@ -139479,6 +140688,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp))++ } z = *(*uintptr)(unsafe.Pointer(bp)) @@ -139488,15 +140698,16 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _3 _3: + ; z++ *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2) } - if int64(z)-int64(a) > int64(int32(INT_MAX)-cnt) { + if int64(int64(z))-int64(int64(a)) > int64(int32(INT_MAX)-cnt) { goto overflow } - l = int32(int64(z) - int64(a)) + l = int32(int64(int64(z)) - int64(int64(a))) if f != 0 { - _out(tls, f, a, uint64(l)) + _out(tls, f, a, uint64(uint64(l))) } if l != 0 { goto _1 @@ -139518,6 +140729,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl |= uint32(1) << (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) - int32(' ')) goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp))++ } /* Read field width */ @@ -139611,13 +140823,13 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } else { if argpos >= 0 { if !(f != 0) { - *(*int32)(unsafe.Pointer(nl_type + uintptr(argpos)*4)) = int32(st) + *(*int32)(unsafe.Pointer(nl_type + uintptr(argpos)*4)) = int32(int32(st)) } else { *(*Targ)(unsafe.Pointer(bp + 8)) = *(*Targ)(unsafe.Pointer(nl_arg + uintptr(argpos)*8)) } } else { if f != 0 { - _pop_arg(tls, bp+8, int32(st), ap) + _pop_arg(tls, bp+8, int32(int32(st)), ap) } else { return 0 } @@ -139631,7 +140843,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, return -int32(1) } z = bp + 16 + uintptr(24) - prefix = __ccgo_ts + 1605 + prefix = __ccgo_ts + 1634 pl = 0 t = int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + uintptr(-Int32FromInt32(1))))) /* Transform ls,lc -> S,C */ @@ -139688,25 +140900,27 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _30 _9: + ; switch ps { case uint32(_BARE): *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = cnt case uint32(_LPRE): - *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = int64(cnt) + *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = int64(int64(cnt)) case uint32(_LLPRE): - *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = int64(cnt) + *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = int64(int64(cnt)) case uint32(_HPRE): - *(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint16(cnt) + *(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint16(uint16(cnt)) case uint32(_HHPRE): - *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8(cnt) + *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint8(uint8(cnt)) case uint32(_ZTPRE): - *(*Tsize_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint64(cnt) + *(*Tsize_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint64(uint64(cnt)) case uint32(_JPRE): - *(*Tuintmax_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint64(cnt) + *(*Tuintmax_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = uint64(uint64(cnt)) break } goto _1 _10: + ; if uint64(p) > Uint64FromInt32(2)*Uint64FromInt64(8) { v31 = uint64(p) } else { @@ -139716,7 +140930,9 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, t = int32('x') fl |= Uint32FromUint32(1) << (Int32FromUint8('#') - Int32FromUint8(' ')) _12: + ; _11: + ; a = _fmt_x(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z, t&int32(32)) if *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0 && fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { prefix += uintptr(t >> Int32FromInt32(4)) @@ -139726,16 +140942,20 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, goto _32 } _13: + ; a = _fmt_o(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z) - if fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 && int64(p) < int64(z)-int64(a)+int64(1) { - p = int32(int64(z) - int64(a) + int64(1)) + if fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 && int64(int64(p)) < int64(int64(z))-int64(int64(a))+int64(1) { + p = int32(int64(int64(z)) - int64(int64(a)) + int64(1)) } _32: + ; if !(0 != 0) { goto _33 } _15: + ; _14: + ; pl = int32(1) if *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) > uint64(Int64FromInt64(INT64_MAX)) { *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) = -*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) @@ -139751,8 +140971,10 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } } _16: + ; a = _fmt_u(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z) _33: + ; if xp != 0 && p < 0 { goto overflow } @@ -139763,15 +140985,17 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, a = z goto _30 } - if int64(p) > int64(z)-int64(a)+BoolInt64(!(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0)) { + if int64(p) > int64(int64(z))-int64(int64(a))+BoolInt64(!(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0)) { v34 = int64(p) } else { - v34 = int64(z) - int64(a) + BoolInt64(!(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0)) + v34 = int64(int64(z)) - int64(int64(a)) + BoolInt64(!(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0)) } p = int32(v34) goto _30 narrow_c: + ; _17: + ; v36 = Int32FromInt32(1) p = v36 v35 = z - uintptr(v36) @@ -139780,20 +141004,24 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl &= ^(Uint32FromUint32(1) << (Int32FromUint8('0') - Int32FromUint8(' '))) goto _30 _19: + ; if !(int32(1) != 0) { goto _37 } a = Xstrerror(tls, *(*int32)(unsafe.Pointer(X__errno_location(tls)))) goto _38 _37: + ; _18: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { v39 = *(*uintptr)(unsafe.Pointer(bp + 8)) } else { - v39 = __ccgo_ts + 1615 + v39 = __ccgo_ts + 1644 } a = v39 _38: + ; if p < 0 { v40 = int32(INT_MAX) } else { @@ -139803,10 +141031,11 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if p < 0 && *(*int8)(unsafe.Pointer(z)) != 0 { goto overflow } - p = int32(int64(z) - int64(a)) + p = int32(int64(int64(z)) - int64(int64(a))) fl &= ^(Uint32FromUint32(1) << (Int32FromUint8('0') - Int32FromUint8(' '))) goto _30 _20: + ; if !(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0) { goto narrow_c } @@ -139815,23 +141044,25 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, *(*uintptr)(unsafe.Pointer(bp + 8)) = bp + 40 p = -int32(1) _21: + ; ws = *(*uintptr)(unsafe.Pointer(bp + 8)) v42 = Int32FromInt32(0) l = v42 i = uint64(v42) for { - if v45 = i < uint64(p) && *(*Twchar_t)(unsafe.Pointer(ws)) != 0; v45 { + if v45 = i < uint64(uint64(p)) && *(*Twchar_t)(unsafe.Pointer(ws)) != 0; v45 { v44 = ws ws += 4 v43 = Xwctomb(tls, bp+48, *(*Twchar_t)(unsafe.Pointer(v44))) l = v43 } - if !(v45 && v43 >= 0 && uint64(l) <= uint64(p)-i) { + if !(v45 && v43 >= 0 && uint64(uint64(l)) <= uint64(uint64(p))-i) { break } goto _41 _41: - i += uint64(l) + ; + i += uint64(uint64(l)) } if l < 0 { return -int32(1) @@ -139839,24 +141070,25 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if i > uint64(INT_MAX) { goto overflow } - p = int32(i) - _pad3(tls, f, int8(' '), w, p, int32(fl)) + p = int32(int32(i)) + _pad3(tls, f, int8(' '), w, p, int32(int32(fl))) ws = *(*uintptr)(unsafe.Pointer(bp + 8)) i = uint64(0) for { - if v49 = i < uint64(0+uint32(p)) && *(*Twchar_t)(unsafe.Pointer(ws)) != 0; v49 { + if v49 = i < uint64(0+uint32(uint32(p))) && *(*Twchar_t)(unsafe.Pointer(ws)) != 0; v49 { v48 = ws ws += 4 v47 = Xwctomb(tls, bp+48, *(*Twchar_t)(unsafe.Pointer(v48))) l = v47 } - if !(v49 && i+uint64(v47) <= uint64(p)) { + if !(v49 && i+uint64(v47) <= uint64(uint64(p))) { break } - _out(tls, f, bp+48, uint64(l)) + _out(tls, f, bp+48, uint64(uint64(l))) goto _46 _46: - i += uint64(l) + ; + i += uint64(uint64(l)) } _pad3(tls, f, int8(' '), w, p, int32(fl^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) if w > p { @@ -139867,24 +141099,33 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, l = v50 goto _1 _29: + ; _28: + ; _27: + ; _26: + ; _25: + ; _24: + ; _23: + ; _22: + ; if xp != 0 && p < 0 { goto overflow } - l = _fmt_fp(tls, f, *(*float64)(unsafe.Pointer(bp + 8)), w, p, int32(fl), t) + l = _fmt_fp(tls, f, *(*float64)(unsafe.Pointer(bp + 8)), w, p, int32(int32(fl)), t) if l < 0 { goto overflow } goto _1 _30: - if int64(p) < int64(z)-int64(a) { - p = int32(int64(z) - int64(a)) + ; + if int64(int64(p)) < int64(int64(z))-int64(int64(a)) { + p = int32(int64(int64(z)) - int64(int64(a))) } if p > int32(INT_MAX)-pl { goto overflow @@ -139895,11 +141136,11 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if w > int32(INT_MAX)-cnt { goto overflow } - _pad3(tls, f, int8(' '), w, pl+p, int32(fl)) - _out(tls, f, prefix, uint64(pl)) + _pad3(tls, f, int8(' '), w, pl+p, int32(int32(fl))) + _out(tls, f, prefix, uint64(uint64(pl))) _pad3(tls, f, int8('0'), w, pl+p, int32(fl^Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' ')))) - _pad3(tls, f, int8('0'), p, int32(int64(z)-int64(a)), 0) - _out(tls, f, a, uint64(int64(z)-int64(a))) + _pad3(tls, f, int8('0'), p, int32(int64(int64(z))-int64(int64(a))), 0) + _out(tls, f, a, uint64(int64(int64(z))-int64(int64(a)))) _pad3(tls, f, int8(' '), w, pl+p, int32(fl^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) l = w goto _1 @@ -139919,6 +141160,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, _pop_arg(tls, nl_arg+uintptr(i)*8, *(*int32)(unsafe.Pointer(nl_type + uintptr(i)*4)), ap) goto _51 _51: + ; i++ } for { @@ -139927,6 +141169,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _52 _52: + ; i++ } if i <= uint64(NL_ARGMAX) { @@ -139934,9 +141177,11 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } return int32(1) inval: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) overflow: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return -int32(1) } @@ -140002,7 +141247,7 @@ func Xvfprintf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_ERR) != 0 { ret = -int32(1) } - *(*uint32)(unsafe.Pointer(f)) |= uint32(olderr) + *(*uint32)(unsafe.Pointer(f)) |= uint32(uint32(olderr)) if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -140023,15 +141268,15 @@ func _store_int(tls *TLS, dest uintptr, size int32, i uint64) { } switch size { case -int32(2): - *(*int8)(unsafe.Pointer(dest)) = int8(i) + *(*int8)(unsafe.Pointer(dest)) = int8(int8(i)) case -int32(1): - *(*int16)(unsafe.Pointer(dest)) = int16(i) + *(*int16)(unsafe.Pointer(dest)) = int16(int16(i)) case SIZE_def: - *(*int32)(unsafe.Pointer(dest)) = int32(i) + *(*int32)(unsafe.Pointer(dest)) = int32(int32(i)) case int32(SIZE_l): - *(*int64)(unsafe.Pointer(dest)) = int64(i) + *(*int64)(unsafe.Pointer(dest)) = int64(int64(i)) case int32(SIZE_ll): - *(*int64)(unsafe.Pointer(dest)) = int64(i) + *(*int64)(unsafe.Pointer(dest)) = int64(int64(i)) break } } @@ -140050,6 +141295,7 @@ func _arg_n(tls *TLS, ap Tva_list, n uint32) (r uintptr) { _ = VaUintptr(&ap2) goto _1 _1: + ; i-- } p = VaUintptr(&ap2) @@ -140202,6 +141448,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(10)*width + int32(*(*uint8)(unsafe.Pointer(p))) - int32('0') goto _27 _27: + ; p++ } if int32(*(*uint8)(unsafe.Pointer(p))) == int32('m') { @@ -140297,7 +141544,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { fallthrough case int32('['): case int32('n'): - _store_int(tls, dest, size, uint64(pos)) + _store_int(tls, dest, size, uint64(uint64(pos))) /* do not increment match count, etc! */ goto _2 default: @@ -140379,8 +141626,11 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _42: + ; _41: + ; _40: + ; if t == int32('c') || t == int32('s') { Xmemset(tls, bp+16, -int32(1), uint64(257)) (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[0] = uint8(0) @@ -140430,12 +141680,14 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[int32(1)+c] = uint8(int32(1) - invert) goto _61 _61: + ; c++ } } (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[int32(1)+int32(*(*uint8)(unsafe.Pointer(p)))] = uint8(int32(1) - invert) goto _60 _60: + ; p++ } } @@ -140443,7 +141695,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { s = uintptr(0) i = uint64(0) if t == int32('c') { - v63 = uint32(width) + uint32(1) + v63 = uint32(uint32(width)) + uint32(1) } else { v63 = uint32(31) } @@ -140472,7 +141724,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if !((*(*[257]uint8)(unsafe.Pointer(bp + 16)))[v64+int32(1)] != 0) { break } - *(*int8)(unsafe.Pointer(bp)) = int8(c) + *(*int8)(unsafe.Pointer(bp)) = int8(int8(c)) switch Xmbrtowc(tls, bp+276, bp, uint64(1), bp+8) { case uint64(-Int32FromInt32(1)): goto input_fail @@ -140518,7 +141770,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } v73 = i i++ - *(*int8)(unsafe.Pointer(s + uintptr(v73))) = int8(c) + *(*int8)(unsafe.Pointer(s + uintptr(v73))) = int8(int8(c)) if i == k { k += k + uint64(1) tmp1 = Xrealloc(tls, s, k) @@ -140548,7 +141800,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } v79 = i i++ - *(*int8)(unsafe.Pointer(s + uintptr(v79))) = int8(c) + *(*int8)(unsafe.Pointer(s + uintptr(v79))) = int8(int8(c)) } } else { for { @@ -140575,7 +141827,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if !((*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != 0) { goto match_fail } - if t == int32('c') && (*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != int64(width) { + if t == int32('c') && (*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != int64(int64(width)) { goto match_fail } if alloc != 0 { @@ -140595,38 +141847,54 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _45: + ; _44: + ; _43: + ; base = int32(16) goto int_common _46: + ; base = int32(8) goto int_common _48: + ; _47: + ; base = int32(10) goto int_common _49: + ; base = 0 int_common: - x = X__intscan(tls, f, uint32(base), 0, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + ; + x = X__intscan(tls, f, uint32(uint32(base)), 0, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) if !((*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != 0) { goto match_fail } if t == int32('p') && dest != 0 { - *(*uintptr)(unsafe.Pointer(dest)) = uintptr(x) + *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uint64(uint64(x))) } else { _store_int(tls, dest, size, x) } goto _58 _57: + ; _56: + ; _55: + ; _54: + ; _53: + ; _52: + ; _51: + ; _50: + ; y = X__floatscan(tls, f, size, 0) if !((*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != 0) { goto match_fail @@ -140634,9 +141902,9 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if dest != 0 { switch size { case SIZE_def: - *(*float32)(unsafe.Pointer(dest)) = float32(y) + *(*float32)(unsafe.Pointer(dest)) = float32(float32(y)) case int32(SIZE_l): - *(*float64)(unsafe.Pointer(dest)) = y + *(*float64)(unsafe.Pointer(dest)) = float64(float64(y)) case int32(SIZE_L): *(*float64)(unsafe.Pointer(dest)) = y break @@ -140644,29 +141912,36 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _58: + ; pos += (*TFILE)(unsafe.Pointer(f)).Fshcnt + (int64((*TFILE)(unsafe.Pointer(f)).Frpos) - int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) if dest != 0 { matches++ } goto _2 _2: + ; p++ } if !(0 != 0) { goto _85 } fmt_fail: + ; alloc_fail: + ; input_fail: + ; if !(matches != 0) { matches-- } match_fail: + ; if alloc != 0 { Xfree(tls, s) Xfree(tls, wcs) } _85: + ; if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -140803,7 +142078,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -140825,7 +142100,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -140850,10 +142125,10 @@ func _out1(tls *TLS, f uintptr, s uintptr, l Tsize_t) { func _pad4(tls *TLS, f uintptr, n int32, fl int32) { bp := tls.Alloc(32) defer tls.Free(32) - if uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0 || !(n != 0) || (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_ERR) != 0 { + if uint32(uint32(fl))&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0 || !(n != 0) || (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_ERR) != 0 { return } - Xfprintf(tls, f, __ccgo_ts+1622, VaList(bp+8, n, __ccgo_ts)) + Xfprintf(tls, f, __ccgo_ts+1651, VaList(bp+8, n, __ccgo_ts)) } func _getint1(tls *TLS, s uintptr) (r int32) { @@ -140864,13 +142139,14 @@ func _getint1(tls *TLS, s uintptr) (r int32) { if !(BoolInt32(uint32(*(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-uint32('0') < uint32(10)) != 0) { break } - if uint32(i) > Uint32FromInt32(INT_MAX)/Uint32FromUint32(10) || *(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s))))-int32('0') > int32(INT_MAX)-int32(10)*i { + if uint32(uint32(i)) > Uint32FromInt32(INT_MAX)/Uint32FromUint32(10) || *(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s))))-int32('0') > int32(INT_MAX)-int32(10)*i { i = -int32(1) } else { i = int32(10)*i + (*(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))) - int32('0')) } goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s)) += 4 } return i @@ -140926,6 +142202,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) += 4 } z = *(*uintptr)(unsafe.Pointer(bp + 8)) @@ -140935,15 +142212,16 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _3 _3: + ; z += 4 *(*uintptr)(unsafe.Pointer(bp + 8)) += uintptr(2) * 4 } - if (int64(z)-int64(a))/4 > int64(int32(INT_MAX)-cnt) { + if (int64(int64(z))-int64(int64(a)))/4 > int64(int32(INT_MAX)-cnt) { goto overflow } - l = int32((int64(z) - int64(a)) / 4) + l = int32((int64(int64(z)) - int64(int64(a))) / 4) if f != 0 { - _out1(tls, f, a, uint64(l)) + _out1(tls, f, a, uint64(uint64(l))) } if l != 0 { goto _1 @@ -140965,6 +142243,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl |= uint32(1) << (*(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) - int32(' ')) goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) += 4 } /* Read field width */ @@ -141049,11 +142328,11 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } } else { if argpos >= 0 { - *(*int32)(unsafe.Pointer(nl_type + uintptr(argpos)*4)) = int32(st) + *(*int32)(unsafe.Pointer(nl_type + uintptr(argpos)*4)) = int32(int32(st)) *(*Targ)(unsafe.Pointer(bp + 16)) = *(*Targ)(unsafe.Pointer(nl_arg + uintptr(argpos)*8)) } else { if f != 0 { - _pop_arg1(tls, bp+16, int32(st), ap) + _pop_arg1(tls, bp+16, int32(int32(st)), ap) } else { return 0 } @@ -141076,17 +142355,17 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, case uint32(_BARE): *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = cnt case uint32(_LPRE): - *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = int64(cnt) + *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = int64(int64(cnt)) case uint32(_LLPRE): - *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = int64(cnt) + *(*int64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = int64(int64(cnt)) case uint32(_HPRE): - *(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint16(cnt) + *(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint16(uint16(cnt)) case uint32(_HHPRE): - *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint8(cnt) + *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint8(uint8(cnt)) case uint32(_ZTPRE): - *(*Tsize_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint64(cnt) + *(*Tsize_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint64(uint64(cnt)) case uint32(_JPRE): - *(*Tuintmax_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint64(cnt) + *(*Tuintmax_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) = uint64(uint64(cnt)) break } goto _1 @@ -141096,7 +142375,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if w < int32(1) { w = int32(1) } - _pad4(tls, f, w-int32(1), int32(fl)) + _pad4(tls, f, w-int32(1), int32(int32(fl))) if t == int32('C') { v9 = *(*Tuintmax_t)(unsafe.Pointer(bp + 16)) } else { @@ -141118,12 +142397,12 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if p < 0 && *(*Twchar_t)(unsafe.Pointer(z)) != 0 { goto overflow } - p = int32((int64(z) - int64(a)) / 4) + p = int32((int64(int64(z)) - int64(int64(a))) / 4) if w < p { w = p } - _pad4(tls, f, w-p, int32(fl)) - _out1(tls, f, a, uint64(p)) + _pad4(tls, f, w-p, int32(int32(fl))) + _out1(tls, f, a, uint64(uint64(p))) _pad4(tls, f, w-p, int32(fl^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) l = w goto _1 @@ -141132,7 +142411,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fallthrough case int32('s'): if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) { - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 1615 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 1644 } bs = *(*uintptr)(unsafe.Pointer(bp + 16)) v12 = Int32FromInt32(0) @@ -141153,6 +142432,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _11 _11: + ; bs += uintptr(i) l++ } @@ -141166,7 +142446,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if w < p { w = p } - _pad4(tls, f, w-p, int32(fl)) + _pad4(tls, f, w-p, int32(int32(fl))) bs = *(*uintptr)(unsafe.Pointer(bp + 16)) for { v16 = l @@ -141185,7 +142465,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if xp != 0 && p < 0 { goto overflow } - Xsnprintf(tls, bp+24, uint64(16), __ccgo_ts+1626, VaList(bp+56, __ccgo_ts+1646+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1648+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1650+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0)), __ccgo_ts+654+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1652+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0)), int32(_sizeprefix[t|int32(32)-int32('a')]), t)) + Xsnprintf(tls, bp+24, uint64(16), __ccgo_ts+1655, VaList(bp+56, __ccgo_ts+1675+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1677+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1679+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0)), __ccgo_ts+689+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1681+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0)), int32(_sizeprefix[t|int32(32)-int32('a')]), t)) switch t | Int32FromInt32(32) { case int32('a'): fallthrough @@ -141226,6 +142506,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, _pop_arg1(tls, nl_arg+uintptr(i)*8, *(*int32)(unsafe.Pointer(nl_type + uintptr(i)*4)), ap) goto _17 _17: + ; i++ } for { @@ -141234,6 +142515,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _18 _18: + ; i++ } if i <= int32(NL_ARGMAX) { @@ -141241,9 +142523,11 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } return int32(1) inval: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) overflow: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return -int32(1) } @@ -141280,7 +142564,7 @@ func Xvfwprintf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_ERR) != 0 { ret = -int32(1) } - *(*uint32)(unsafe.Pointer(f)) |= uint32(olderr) + *(*uint32)(unsafe.Pointer(f)) |= uint32(uint32(olderr)) if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -141294,15 +142578,15 @@ func _store_int1(tls *TLS, dest uintptr, size int32, i uint64) { } switch size { case -int32(2): - *(*int8)(unsafe.Pointer(dest)) = int8(i) + *(*int8)(unsafe.Pointer(dest)) = int8(int8(i)) case -int32(1): - *(*int16)(unsafe.Pointer(dest)) = int16(i) + *(*int16)(unsafe.Pointer(dest)) = int16(int16(i)) case SIZE_def: - *(*int32)(unsafe.Pointer(dest)) = int32(i) + *(*int32)(unsafe.Pointer(dest)) = int32(int32(i)) case int32(SIZE_l): - *(*int64)(unsafe.Pointer(dest)) = int64(i) + *(*int64)(unsafe.Pointer(dest)) = int64(int64(i)) case int32(SIZE_ll): - *(*int64)(unsafe.Pointer(dest)) = int64(i) + *(*int64)(unsafe.Pointer(dest)) = int64(int64(i)) break } } @@ -141321,6 +142605,7 @@ func _arg_n1(tls *TLS, ap Tva_list, n uint32) (r uintptr) { _ = VaUintptr(&ap2) goto _1 _1: + ; i-- } p = VaUintptr(&ap2) @@ -141363,6 +142648,7 @@ func _in_set(tls *TLS, set uintptr, c int32) (r int32) { } goto _2 _2: + ; j++ } } @@ -141371,6 +142657,7 @@ func _in_set(tls *TLS, set uintptr, c int32) (r int32) { } goto _1 _1: + ; p += 4 } return 0 @@ -141504,6 +142791,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(10)*width + *(*Twchar_t)(unsafe.Pointer(p)) - int32('0') goto _20 _20: + ; p += 4 } if *(*Twchar_t)(unsafe.Pointer(p)) == int32('m') { @@ -141634,7 +142922,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } switch t { case int32('n'): - _store_int1(tls, dest, size, uint64(pos)) + _store_int1(tls, dest, size, uint64(uint64(pos))) /* do not increment match count, etc! */ goto _2 case int32('s'): @@ -141647,7 +142935,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(1) } invert = int32(1) - set = __ccgo_ts + 1654 + set = __ccgo_ts + 1683 } else { if t == int32('s') { invert = int32(1) @@ -141692,7 +142980,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { i = uint64(0) if alloc != 0 { if t == int32('c') { - v35 = uint32(width) + uint32(1) + v35 = uint32(uint32(width)) + uint32(1) } else { v35 = uint32(31) } @@ -141749,7 +143037,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if l < 0 { goto input_fail } - i += uint64(l) + i += uint64(uint64(l)) if alloc != 0 && i > k-uint64(4) { k += k + uint64(1) tmp2 = Xrealloc(tls, s, k) @@ -141824,7 +143112,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if width < int32(1) { width = 0 } - Xsnprintf(tls, bp+8, uint64(22), __ccgo_ts+1658, VaList(bp+40, int32(1)+BoolInt32(!(dest != 0)), __ccgo_ts+1676, width, uintptr(unsafe.Pointer(&_size_pfx))+uintptr(size+int32(2))*3, t)) + Xsnprintf(tls, bp+8, uint64(22), __ccgo_ts+1687, VaList(bp+40, int32(1)+BoolInt32(!(dest != 0)), __ccgo_ts+1705, width, uintptr(unsafe.Pointer(&_size_pfx))+uintptr(size+int32(2))*3, t)) *(*Toff_t)(unsafe.Pointer(bp)) = 0 if dest != 0 { v45 = dest @@ -141847,23 +143135,29 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _2 _2: + ; p += 4 } if !(0 != 0) { goto _46 } fmt_fail: + ; alloc_fail: + ; input_fail: + ; if !(matches != 0) { matches-- } match_fail: + ; if alloc != 0 { Xfree(tls, s) Xfree(tls, wcs) } _46: + ; if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -142040,7 +143334,7 @@ func _string_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { k = len1 + uint64(256) end = Xmemchr(tls, src, 0, k) if end != 0 { - k = uint64(int64(end) - int64(src)) + k = uint64(int64(int64(end)) - int64(int64(src))) } if k < len1 { len1 = k @@ -142106,7 +143400,7 @@ func _sw_write(tls *TLS, f uintptr, s uintptr, l Tsize_t) (r Tsize_t) { i = int32(1) } s += uintptr(i) - l -= uint64(i) + l -= uint64(uint64(i)) (*Tcookie4)(unsafe.Pointer(c)).Fl-- (*Tcookie4)(unsafe.Pointer(c)).Fws += 4 } @@ -142118,7 +143412,7 @@ func _sw_write(tls *TLS, f uintptr, s uintptr, l Tsize_t) (r Tsize_t) { (*TFILE)(unsafe.Pointer(f)).Fwbase = v3 (*TFILE)(unsafe.Pointer(f)).Fwpos = v3 *(*uint32)(unsafe.Pointer(f)) |= uint32(F_ERR) - return uint64(i) + return uint64(uint64(i)) } (*TFILE)(unsafe.Pointer(f)).Fwend = (*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr((*TFILE)(unsafe.Pointer(f)).Fbuf_size) v5 = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -142156,7 +143450,7 @@ func Xvswprintf(tls *TLS, s uintptr, n Tsize_t, fmt uintptr, ap Tva_list) (r1 in } r = Xvfwprintf(tls, bp+272, fmt, ap) _sw_write(tls, bp+272, uintptr(0), uint64(0)) - if uint64(r) >= n { + if uint64(uint64(r)) >= n { v1 = -int32(1) } else { v1 = r @@ -142476,10 +143770,10 @@ func Xecvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { var i, j, v1, v3 int32 var _ /* tmp at bp+0 */ [32]int8 _, _, _, _ = i, j, v1, v3 - if uint32(n)-uint32(1) > uint32(15) { + if uint32(uint32(n))-uint32(1) > uint32(15) { n = int32(15) } - Xsprintf(tls, bp, __ccgo_ts+1679, VaList(bp+40, n-int32(1), x)) + Xsprintf(tls, bp, __ccgo_ts+1708, VaList(bp+40, n-int32(1), x)) v1 = BoolInt32(int32((*(*[32]int8)(unsafe.Pointer(bp)))[0]) == Int32FromUint8('-')) *(*int32)(unsafe.Pointer(sign)) = v1 i = v1 @@ -142491,6 +143785,7 @@ func Xecvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { _buf8[j] = (*(*[32]int8)(unsafe.Pointer(bp)))[i] goto _2 _2: + ; v3 = i i++ j += BoolInt32(int32((*(*[32]int8)(unsafe.Pointer(bp)))[v3]) != int32('.')) @@ -142512,23 +143807,23 @@ func Xfcvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { var i, lz int32 var _ /* tmp at bp+0 */ [1500]int8 _, _ = i, lz - if uint32(n) > uint32(1400) { + if uint32(uint32(n)) > uint32(1400) { n = int32(1400) } - Xsprintf(tls, bp, __ccgo_ts+1684, VaList(bp+1512, n, x)) + Xsprintf(tls, bp, __ccgo_ts+1713, VaList(bp+1512, n, x)) i = BoolInt32(int32((*(*[1500]int8)(unsafe.Pointer(bp)))[0]) == int32('-')) if int32((*(*[1500]int8)(unsafe.Pointer(bp)))[i]) == int32('0') { - lz = int32(Xstrspn(tls, bp+uintptr(i)+uintptr(2), __ccgo_ts+1652)) + lz = int32(Xstrspn(tls, bp+uintptr(i)+uintptr(2), __ccgo_ts+1681)) } else { - lz = -int32(Xstrcspn(tls, bp+uintptr(i), __ccgo_ts+537)) + lz = -int32(Xstrcspn(tls, bp+uintptr(i), __ccgo_ts+575)) } if n <= lz { *(*int32)(unsafe.Pointer(sign)) = i *(*int32)(unsafe.Pointer(dp)) = int32(1) - if uint32(n) > uint32(14) { + if uint32(uint32(n)) > uint32(14) { n = int32(14) } - return __ccgo_ts + 1689 + UintptrFromInt32(14) - uintptr(n) + return __ccgo_ts + 1718 + UintptrFromInt32(14) - uintptr(n) } return Xecvt(tls, x, n-lz, dp, sign) } @@ -142540,7 +143835,7 @@ func Xgcvt(tls *TLS, x float64, n int32, b uintptr) (r uintptr) { } bp := tls.Alloc(32) defer tls.Free(32) - Xsprintf(tls, b, __ccgo_ts+1705, VaList(bp+8, n, x)) + Xsprintf(tls, b, __ccgo_ts+1734, VaList(bp+8, n, x)) return b } @@ -142668,6 +143963,7 @@ func _cycle(tls *TLS, width Tsize_t, ar uintptr, n int32) { *(*uintptr)(unsafe.Pointer(ar + uintptr(i)*8)) += uintptr(l) goto _2 _2: + ; i++ } width -= l @@ -142678,25 +143974,25 @@ func _cycle(tls *TLS, width Tsize_t, ar uintptr, n int32) { // // /* shl() and shr() need n > 0 */ func _shl(tls *TLS, p uintptr, n int32) { - if uint64(n) >= Uint64FromInt32(8)*Uint64FromInt64(8) { + if uint64(uint64(n)) >= Uint64FromInt32(8)*Uint64FromInt64(8) { n = int32(uint64(n) - Uint64FromInt32(8)*Uint64FromInt64(8)) *(*Tsize_t)(unsafe.Pointer(p + 1*8)) = *(*Tsize_t)(unsafe.Pointer(p)) *(*Tsize_t)(unsafe.Pointer(p)) = uint64(0) } - *(*Tsize_t)(unsafe.Pointer(p + 1*8)) <<= uint64(n) - *(*Tsize_t)(unsafe.Pointer(p + 1*8)) |= *(*Tsize_t)(unsafe.Pointer(p)) >> (Uint64FromInt64(8)*Uint64FromInt32(8) - uint64(n)) - *(*Tsize_t)(unsafe.Pointer(p)) <<= uint64(n) + *(*Tsize_t)(unsafe.Pointer(p + 1*8)) <<= uint64(uint64(n)) + *(*Tsize_t)(unsafe.Pointer(p + 1*8)) |= *(*Tsize_t)(unsafe.Pointer(p)) >> (Uint64FromInt64(8)*Uint64FromInt32(8) - uint64(uint64(n))) + *(*Tsize_t)(unsafe.Pointer(p)) <<= uint64(uint64(n)) } func _shr(tls *TLS, p uintptr, n int32) { - if uint64(n) >= Uint64FromInt32(8)*Uint64FromInt64(8) { + if uint64(uint64(n)) >= Uint64FromInt32(8)*Uint64FromInt64(8) { n = int32(uint64(n) - Uint64FromInt32(8)*Uint64FromInt64(8)) *(*Tsize_t)(unsafe.Pointer(p)) = *(*Tsize_t)(unsafe.Pointer(p + 1*8)) *(*Tsize_t)(unsafe.Pointer(p + 1*8)) = uint64(0) } - *(*Tsize_t)(unsafe.Pointer(p)) >>= uint64(n) - *(*Tsize_t)(unsafe.Pointer(p)) |= *(*Tsize_t)(unsafe.Pointer(p + 1*8)) << (Uint64FromInt64(8)*Uint64FromInt32(8) - uint64(n)) - *(*Tsize_t)(unsafe.Pointer(p + 1*8)) >>= uint64(n) + *(*Tsize_t)(unsafe.Pointer(p)) >>= uint64(uint64(n)) + *(*Tsize_t)(unsafe.Pointer(p)) |= *(*Tsize_t)(unsafe.Pointer(p + 1*8)) << (Uint64FromInt64(8)*Uint64FromInt32(8) - uint64(uint64(n))) + *(*Tsize_t)(unsafe.Pointer(p + 1*8)) >>= uint64(uint64(n)) } func _sift(tls *TLS, head uintptr, width Tsize_t, cmp Tcmpfun, arg uintptr, pshift int32, lp uintptr) { @@ -142805,6 +144101,7 @@ func X__qsort_r(tls *TLS, base uintptr, nel Tsize_t, width Tsize_t, cmp Tcmpfun, } goto _1 _1: + ; i++ } for head < high { @@ -142813,7 +144110,7 @@ func X__qsort_r(tls *TLS, base uintptr, nel Tsize_t, width Tsize_t, cmp Tcmpfun, _shr(tls, bp+768, int32(2)) pshift += int32(2) } else { - if (*(*[96]Tsize_t)(unsafe.Pointer(bp)))[pshift-int32(1)] >= uint64(int64(high)-int64(head)) { + if (*(*[96]Tsize_t)(unsafe.Pointer(bp)))[pshift-int32(1)] >= uint64(int64(int64(high))-int64(int64(head))) { _trinkle(tls, head, width, cmp, arg, bp+768, pshift, 0, bp) } else { _sift(tls, head, width, cmp, arg, pshift, bp) @@ -142906,7 +144203,7 @@ func Xstrtod(tls *TLS, s uintptr, p uintptr) (r float64) { trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2)) defer func() { trc("-> %v", r) }() } - return _strtox(tls, s, p, int32(1)) + return float64(_strtox(tls, s, p, int32(1))) } func Xstrtold(tls *TLS, s uintptr, p uintptr) (r float64) { @@ -142930,7 +144227,7 @@ func _strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) (r uint64) (*TFILE)(unsafe.Pointer(bp)).Fbuf = v1 (*TFILE)(unsafe.Pointer(bp)).Frend = uintptr(-Int32FromInt32(1)) X__shlim(tls, bp, int64(Int32FromInt32(0))) - y = X__intscan(tls, bp, uint32(base), int32(1), lim) + y = X__intscan(tls, bp, uint32(uint32(base)), int32(1), lim) if p != 0 { cnt = uint64((*TFILE)(unsafe.Pointer(bp)).Fshcnt + (int64((*TFILE)(unsafe.Pointer(bp)).Frpos) - int64((*TFILE)(unsafe.Pointer(bp)).Fbuf))) *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) @@ -142959,7 +144256,7 @@ func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _strtox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return uint64(_strtox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)))) } func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -142967,7 +144264,7 @@ func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return int64(_strtox1(tls, s, p, base, Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return int64(_strtox1(tls, s, p, base, uint64(Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -142975,7 +144272,7 @@ func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Xstrtoll(tls, s, p, base) + return int64(Xstrtoll(tls, s, p, base)) } func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) (r Tuintmax_t) { @@ -142983,7 +144280,7 @@ func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) (r Tuintmax_t) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Xstrtoull(tls, s, p, base) + return uint64(Xstrtoull(tls, s, p, base)) } func X__strtoimax_internal(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -143045,7 +144342,7 @@ func _do_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { _, _, _, _, _ = i, wcs, v2, v3, v4 wcs = (*TFILE)(unsafe.Pointer(f)).Fcookie if !(*(*Twchar_t)(unsafe.Pointer(wcs)) != 0) { - wcs = __ccgo_ts + 1710 + wcs = __ccgo_ts + 1739 } i = uint64(0) for { @@ -143060,6 +144357,7 @@ func _do_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr(i))) = uint8(v2) goto _1 _1: + ; i++ } (*TFILE)(unsafe.Pointer(f)).Frpos = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -143126,7 +144424,7 @@ func Xwcstod(tls *TLS, s uintptr, p uintptr) (r float64) { trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2)) defer func() { trc("-> %v", r) }() } - return _wcstox(tls, s, p, int32(1)) + return float64(_wcstox(tls, s, p, int32(1))) } func Xwcstold(tls *TLS, s uintptr, p uintptr) (r float64) { @@ -143148,7 +144446,7 @@ func _do_read1(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { _, _, _, _, _ = i, wcs, v2, v3, v4 wcs = (*TFILE)(unsafe.Pointer(f)).Fcookie if !(*(*Twchar_t)(unsafe.Pointer(wcs)) != 0) { - wcs = __ccgo_ts + 1710 + wcs = __ccgo_ts + 1739 } i = uint64(0) for { @@ -143163,6 +144461,7 @@ func _do_read1(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr(i))) = uint8(v2) goto _1 _1: + ; i++ } (*TFILE)(unsafe.Pointer(f)).Frpos = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -143203,7 +144502,7 @@ func _wcstox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) (r uint64) } (*(*TFILE)(unsafe.Pointer(bp + 64))).Fcookie = t X__shlim(tls, bp+64, int64(Int32FromInt32(0))) - y = X__intscan(tls, bp+64, uint32(base), int32(1), lim) + y = X__intscan(tls, bp+64, uint32(uint32(base)), int32(1), lim) if p != 0 { cnt = uint64((*TFILE)(unsafe.Pointer(bp+64)).Fshcnt + (int64((*TFILE)(unsafe.Pointer(bp+64)).Frpos) - int64((*TFILE)(unsafe.Pointer(bp+64)).Fbuf))) if cnt != 0 { @@ -143237,7 +144536,7 @@ func Xwcstoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _wcstox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return uint64(_wcstox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)))) } func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -143245,7 +144544,7 @@ func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return int64(_wcstox1(tls, s, p, base, Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return int64(_wcstox1(tls, s, p, base, uint64(Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xwcstoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -143253,7 +144552,7 @@ func Xwcstoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Xwcstoll(tls, s, p, base) + return int64(Xwcstoll(tls, s, p, base)) } func Xwcstoumax(tls *TLS, s uintptr, p uintptr, base int32) (r Tuintmax_t) { @@ -143261,7 +144560,7 @@ func Xwcstoumax(tls *TLS, s uintptr, p uintptr, base int32) (r Tuintmax_t) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Xwcstoull(tls, s, p, base) + return uint64(Xwcstoull(tls, s, p, base)) } func Xbcmp(tls *TLS, s1 uintptr, s2 uintptr, n Tsize_t) (r int32) { @@ -143326,10 +144625,10 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt _, _, _, _, _, _, _, _, _ = d, k, s, wd, ws, v2, v3, v6, v7 d = dest s = src - c = int32(uint8(c)) - if uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(d)&(Uint64FromInt64(8)-Uint64FromInt32(1)) { + c = int32(uint8(uint8(c))) + if uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(uint64(d))&(Uint64FromInt64(8)-Uint64FromInt32(1)) { for { - if v3 = uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v3 { + if v3 = uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v3 { v2 = *(*uint8)(unsafe.Pointer(s)) *(*uint8)(unsafe.Pointer(d)) = v2 } @@ -143338,14 +144637,15 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt } goto _1 _1: + ; n-- s++ d++ } - if uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 { + if uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 { goto tail } - k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(c) + k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(uint64(c)) wd = d ws = s for { @@ -143355,6 +144655,7 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt *(*uint64)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) goto _4 _4: + ; n -= uint64(8) ws += 8 wd += 8 @@ -143372,11 +144673,13 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt } goto _5 _5: + ; n-- s++ d++ } tail: + ; if n != 0 { return d + uintptr(1) } @@ -143403,18 +144706,19 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { var s, w, v4 uintptr _, _, _, _ = k, s, w, v4 s = src - c = int32(uint8(c)) + c = int32(uint8(uint8(c))) for { - if !(uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) { + if !(uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) { break } goto _1 _1: + ; s++ n-- } if n != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c { - k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(c) + k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(uint64(c)) w = s for { if !(n >= Uint64FromInt64(8) && !((*(*uint64)(unsafe.Pointer(w))^k-uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)) & ^(*(*uint64)(unsafe.Pointer(w))^k) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)*uint64(Int32FromInt32(UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) { @@ -143422,6 +144726,7 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { } goto _2 _2: + ; w += 8 n -= Uint64FromInt64(8) } @@ -143433,6 +144738,7 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { } goto _3 _3: + ; s++ n-- } @@ -143460,6 +144766,7 @@ func Xmemcmp(tls *TLS, vl uintptr, vr uintptr, n Tsize_t) (r1 int32) { } goto _1 _1: + ; n-- l++ r++ @@ -143486,7 +144793,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { d = dest s = src for { - if !(uint64(s)%uint64(4) != 0 && n != 0) { + if !(uint64(uint64(s))%uint64(4) != 0 && n != 0) { break } v2 = d @@ -143496,9 +144803,10 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint8)(unsafe.Pointer(v2)) = *(*uint8)(unsafe.Pointer(v3)) goto _1 _1: + ; n-- } - if uint64(d)%uint64(4) == uint64(0) { + if uint64(uint64(d))%uint64(4) == uint64(0) { for { if !(n >= uint64(16)) { break @@ -143509,6 +144817,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint32)(unsafe.Pointer(d + UintptrFromInt32(12))) = *(*uint32)(unsafe.Pointer(s + UintptrFromInt32(12))) goto _4 _4: + ; s += uintptr(16) d += uintptr(16) n -= uint64(16) @@ -143542,7 +144851,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { return dest } if n >= uint64(32) { - switch uint64(d) % Uint64FromInt32(4) { + switch uint64(uint64(d)) % Uint64FromInt32(4) { case uint64(1): w = *(*uint32)(unsafe.Pointer(s)) v9 = d @@ -143575,6 +144884,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint32)(unsafe.Pointer(d + UintptrFromInt32(12))) = x>>Int32FromInt32(24) | w<>Int32FromInt32(16) | w<>Int32FromInt32(8) | w<= uint64(32)) { break @@ -144316,6 +145637,7 @@ func Xmemset(tls *TLS, dest uintptr, c int32, n Tsize_t) (r uintptr) { *(*uint64)(unsafe.Pointer(s + UintptrFromInt32(24))) = c64 goto _1 _1: + ; n -= uint64(32) s += uintptr(32) } @@ -144349,9 +145671,9 @@ func X__stpcpy(tls *TLS, d uintptr, s uintptr) (r uintptr) { var wd, ws, v4, v5 uintptr var v2, v7 int8 _, _, _, _, _, _ = wd, ws, v2, v4, v5, v7 - if uint64(s)%Uint64FromInt64(8) == uint64(d)%Uint64FromInt64(8) { + if uint64(uint64(s))%Uint64FromInt64(8) == uint64(uint64(d))%Uint64FromInt64(8) { for { - if !(uint64(s)%Uint64FromInt64(8) != 0) { + if !(uint64(uint64(s))%Uint64FromInt64(8) != 0) { break } v2 = *(*int8)(unsafe.Pointer(s)) @@ -144361,6 +145683,7 @@ func X__stpcpy(tls *TLS, d uintptr, s uintptr) (r uintptr) { } goto _1 _1: + ; s++ d++ } @@ -144372,6 +145695,7 @@ func X__stpcpy(tls *TLS, d uintptr, s uintptr) (r uintptr) { } goto _3 _3: + ; v4 = wd wd += 8 v5 = ws @@ -144389,6 +145713,7 @@ func X__stpcpy(tls *TLS, d uintptr, s uintptr) (r uintptr) { } goto _6 _6: + ; s++ d++ } @@ -144432,9 +145757,9 @@ func X__stpncpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r uintptr) { var v2, v6 int8 var v3, v7 bool _, _, _, _, _, _ = wd, ws, v2, v3, v6, v7 - if uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(d)&(Uint64FromInt64(8)-Uint64FromInt32(1)) { + if uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(uint64(d))&(Uint64FromInt64(8)-Uint64FromInt32(1)) { for { - if v3 = uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v3 { + if v3 = uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v3 { v2 = *(*int8)(unsafe.Pointer(s)) *(*int8)(unsafe.Pointer(d)) = v2 } @@ -144443,6 +145768,7 @@ func X__stpncpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r uintptr) { } goto _1 _1: + ; n-- s++ d++ @@ -144459,6 +145785,7 @@ func X__stpncpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r uintptr) { *(*uint64)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) goto _4 _4: + ; n -= uint64(8) ws += 8 wd += 8 @@ -144476,11 +145803,13 @@ func X__stpncpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r uintptr) { } goto _5 _5: + ; n-- s++ d++ } tail: + ; Xmemset(tls, d, 0, n) return d } @@ -144517,6 +145846,7 @@ func Xstrcasecmp(tls *TLS, _l uintptr, _r uintptr) (r1 int32) { } goto _1 _1: + ; l++ r++ } @@ -144556,6 +145886,7 @@ func Xstrcasestr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _1 _1: + ; h++ } return uintptr(0) @@ -144578,7 +145909,7 @@ func Xstrchr(tls *TLS, s uintptr, c int32) (r1 uintptr) { var r, v1 uintptr _, _ = r, v1 r = X__strchrnul(tls, s, c) - if int32(*(*uint8)(unsafe.Pointer(r))) == int32(uint8(c)) { + if int32(*(*uint8)(unsafe.Pointer(r))) == int32(uint8(uint8(c))) { v1 = r } else { v1 = uintptr(0) @@ -144605,12 +145936,12 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { var k Tsize_t var w uintptr _, _ = k, w - c = int32(uint8(c)) + c = int32(uint8(uint8(c))) if !(c != 0) { return s + uintptr(Xstrlen(tls, s)) } for { - if !(uint64(s)%Uint64FromInt64(8) != 0) { + if !(uint64(uint64(s))%Uint64FromInt64(8) != 0) { break } if !(*(*int8)(unsafe.Pointer(s)) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c { @@ -144618,9 +145949,10 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { } goto _1 _1: + ; s++ } - k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(c) + k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(UCHAR_MAX) * uint64(uint64(c)) w = s for { if !(!((*(*uint64)(unsafe.Pointer(w))-uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)) & ^*(*uint64)(unsafe.Pointer(w)) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)*uint64(Int32FromInt32(UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0) && !((*(*uint64)(unsafe.Pointer(w))^k-uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)) & ^(*(*uint64)(unsafe.Pointer(w))^k) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(UCHAR_MAX)*uint64(Int32FromInt32(UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) { @@ -144628,6 +145960,7 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { } goto _2 _2: + ; w += 8 } s = w @@ -144637,6 +145970,7 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) { } goto _3 _3: + ; s++ } return s @@ -144670,6 +146004,7 @@ func Xstrcmp(tls *TLS, l uintptr, r uintptr) (r1 int32) { } goto _1 _1: + ; l++ r++ } @@ -144698,7 +146033,7 @@ func Xstrcspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { _, _, _ = a, v3, p2 a = s if !(*(*int8)(unsafe.Pointer(c)) != 0) || !(*(*int8)(unsafe.Pointer(c + 1)) != 0) { - return uint64(int64(X__strchrnul(tls, s, int32(*(*int8)(unsafe.Pointer(c))))) - int64(a)) + return uint64(int64(X__strchrnul(tls, s, int32(*(*int8)(unsafe.Pointer(c))))) - int64(int64(a))) } Xmemset(tls, bp, 0, uint64(32)) for { @@ -144711,6 +146046,7 @@ func Xstrcspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _1 _1: + ; c++ } for { @@ -144719,9 +146055,10 @@ func Xstrcspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _4 _4: + ; s++ } - return uint64(int64(s) - int64(a)) + return uint64(int64(int64(s)) - int64(int64(a))) } func Xstrdup(tls *TLS, s uintptr) (r uintptr) { @@ -144810,9 +146147,9 @@ func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r Tsize_t) { if !(v1 != 0) { goto finish } - if uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(d)&(Uint64FromInt64(8)-Uint64FromInt32(1)) { + if uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) == uint64(uint64(d))&(Uint64FromInt64(8)-Uint64FromInt32(1)) { for { - if v4 = uint64(s)&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v4 { + if v4 = uint64(uint64(s))&(Uint64FromInt64(8)-Uint64FromInt32(1)) != 0 && n != 0; v4 { v3 = *(*int8)(unsafe.Pointer(s)) *(*int8)(unsafe.Pointer(d)) = v3 } @@ -144821,6 +146158,7 @@ func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r Tsize_t) { } goto _2 _2: + ; n-- s++ d++ @@ -144835,6 +146173,7 @@ func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r Tsize_t) { *(*Tsize_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) goto _5 _5: + ; n -= uint64(8) ws += 8 wd += 8 @@ -144853,13 +146192,15 @@ func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r Tsize_t) { } goto _6 _6: + ; n-- s++ d++ } *(*int8)(unsafe.Pointer(d)) = 0 finish: - return uint64(int64(d)-int64(d0)) + Xstrlen(tls, s) + ; + return uint64(int64(int64(d))-int64(int64(d0))) + Xstrlen(tls, s) return r } @@ -144883,14 +146224,15 @@ func Xstrlen(tls *TLS, s uintptr) (r Tsize_t) { _, _ = a, w a = s for { - if !(uint64(s)%Uint64FromInt64(8) != 0) { + if !(uint64(uint64(s))%Uint64FromInt64(8) != 0) { break } if !(*(*int8)(unsafe.Pointer(s)) != 0) { - return uint64(int64(s) - int64(a)) + return uint64(int64(int64(s)) - int64(int64(a))) } goto _1 _1: + ; s++ } w = s @@ -144900,6 +146242,7 @@ func Xstrlen(tls *TLS, s uintptr) (r Tsize_t) { } goto _2 _2: + ; w += 8 } s = w @@ -144909,9 +146252,10 @@ func Xstrlen(tls *TLS, s uintptr) (r Tsize_t) { } goto _3 _3: + ; s++ } - return uint64(int64(s) - int64(a)) + return uint64(int64(int64(s)) - int64(int64(a))) } func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n Tsize_t) (r1 int32) { @@ -144935,6 +146279,7 @@ func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n Tsize_t) (r1 int32) { } goto _2 _2: + ; l++ r++ n-- @@ -145002,6 +146347,7 @@ func Xstrncmp(tls *TLS, _l uintptr, _r uintptr, n Tsize_t) (r1 int32) { } goto _2 _2: + ; l++ r++ n-- @@ -145046,7 +146392,7 @@ func Xstrnlen(tls *TLS, s uintptr, n Tsize_t) (r Tsize_t) { _, _ = p, v1 p = Xmemchr(tls, s, 0, n) if p != 0 { - v1 = uint64(int64(p) - int64(s)) + v1 = uint64(int64(int64(p)) - int64(int64(s))) } else { v1 = n } @@ -145112,7 +146458,7 @@ func Xstrsignal(tls *TLS, signum int32) (r uintptr) { _, _ = s, v2 s = uintptr(unsafe.Pointer(&_strings)) signum = signum - if uint32(signum)-uint32(1) >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) { + if uint32(uint32(signum))-uint32(1) >= uint32(Int32FromInt32(_NSIG)-Int32FromInt32(1)) { signum = 0 } for { @@ -145127,10 +146473,12 @@ func Xstrsignal(tls *TLS, signum int32) (r uintptr) { } goto _3 _3: + ; s++ } goto _1 _1: + ; s++ } return X__lctrans_cur(tls, s) @@ -145159,9 +146507,10 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _1 _1: + ; s++ } - return uint64(int64(s) - int64(a)) + return uint64(int64(int64(s)) - int64(int64(a))) } for { if v4 = *(*int8)(unsafe.Pointer(c)) != 0; v4 { @@ -145173,6 +146522,7 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _2 _2: + ; c++ } for { @@ -145181,9 +146531,10 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _5 _5: + ; s++ } - return uint64(int64(s) - int64(a)) + return uint64(int64(int64(s)) - int64(int64(a))) } func _twobyte_strstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { @@ -145194,14 +146545,15 @@ func _twobyte_strstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { hw = uint16(int32(*(*uint8)(unsafe.Pointer(h)))<= s { @@ -145986,9 +147353,10 @@ func Xwcsspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _1 _1: + ; s += 4 } - return uint64((int64(s) - int64(a)) / 4) + return uint64((int64(int64(s)) - int64(int64(a))) / 4) } func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { @@ -146004,6 +147372,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _1 _1: + ; l++ } if *(*Twchar_t)(unsafe.Pointer(n + uintptr(l)*4)) != 0 { @@ -146092,13 +147461,13 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { /* Search loop */ for { /* Update incremental end-of-haystack pointer */ - if uint64((int64(z)-int64(h))/4) < l { + if uint64((int64(int64(z))-int64(int64(h)))/4) < l { /* Fast estimate for MIN(l,63) */ grow = l | uint64(63) z2 = Xwmemchr(tls, z, 0, grow) if z2 != 0 { z = z2 - if uint64((int64(z)-int64(h))/4) < l { + if uint64((int64(int64(z))-int64(int64(h)))/4) < l { return uintptr(0) } } else { @@ -146118,6 +147487,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _10 _10: + ; k++ } if *(*Twchar_t)(unsafe.Pointer(n + uintptr(k)*4)) != 0 { @@ -146133,6 +147503,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _12 _12: + ; k-- } if k <= mem { @@ -146223,6 +147594,7 @@ func Xwmemchr(tls *TLS, s uintptr, c Twchar_t, n Tsize_t) (r uintptr) { } goto _1 _1: + ; n-- s += 4 } @@ -146247,6 +147619,7 @@ func Xwmemcmp(tls *TLS, l uintptr, r uintptr, n Tsize_t) (r1 int32) { } goto _1 _1: + ; n-- l += 4 r += 4 @@ -146300,7 +147673,7 @@ func Xwmemmove(tls *TLS, d uintptr, s uintptr, n Tsize_t) (r uintptr) { if d == s { return d } - if uint64(d)-uint64(s) < n*uint64(4) { + if uint64(uint64(d))-uint64(uint64(s)) < n*uint64(4) { for { v1 = n n-- @@ -146358,7 +147731,7 @@ func Xmkdtemp(tls *TLS, template uintptr) (r uintptr) { _, _, _ = l, retries, v1 l = Xstrlen(tls, template) retries = int32(100) - if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1718, uint64(6)) != 0 { + if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1747, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -146369,13 +147742,14 @@ func Xmkdtemp(tls *TLS, template uintptr) (r uintptr) { } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EEXIST)) { break } } - Xmemcpy(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1718, uint64(6)) + Xmemcpy(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1747, uint64(6)) return uintptr(0) } @@ -146398,7 +147772,7 @@ func X__mkostemps(tls *TLS, template uintptr, len1 int32, flags int32) (r int32) var l Tsize_t _, _, _, _, _ = fd, l, retries, v1, v3 l = Xstrlen(tls, template) - if l < uint64(6) || uint64(len1) > l-uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1718, uint64(6)) != 0 { + if l < uint64(6) || uint64(uint64(len1)) > l-uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1747, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } @@ -146413,13 +147787,14 @@ func X__mkostemps(tls *TLS, template uintptr, len1 int32, flags int32) (r int32) } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EEXIST)) { break } } - Xmemcpy(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1718, uint64(6)) + Xmemcpy(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1747, uint64(6)) return -int32(1) } @@ -146460,7 +147835,7 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { _, _, _ = l, retries, v1 l = Xstrlen(tls, template) retries = int32(100) - if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1718, uint64(6)) != 0 { + if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1747, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) *(*int8)(unsafe.Pointer(template)) = 0 return template @@ -146475,6 +147850,7 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0) { @@ -146486,22 +147862,6 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { return template } -const CBAUD = 4111 -const CBAUDEX = 4096 -const CIBAUD = 269418496 -const CMSPAR = 1073741824 -const CRTSCTS = 2147483648 -const ECHOCTL = 512 -const ECHOKE = 2048 -const ECHOPRT = 1024 -const EXTA = 14 -const EXTB = 15 -const EXTPROC = 65536 -const FLUSHO = 4096 -const PENDIN = 16384 -const XCASE = 4 -const XTABS = 6144 - func Xcfgetospeed(tls *TLS, tio uintptr) (r Tspeed_t) { if __ccgo_strace { trc("tls=%v tio=%v, (%v:)", tls, tio, origin(2)) @@ -146786,7 +148146,7 @@ func X__secs_to_tm(tls *TLS, t int64, tm uintptr) (r int32) { if yday >= int32(365)+leap { yday -= int32(365) + leap } - years = int64(remyears+int32(4)*q_cycles+int32(100)*c_cycles) + int64(400)*int64(qc_cycles) + years = int64(remyears+int32(4)*q_cycles+int32(100)*c_cycles) + int64(400)*int64(int64(qc_cycles)) months = 0 for { if !(int32(_days_in_month[months]) <= remdays) { @@ -146795,6 +148155,7 @@ func X__secs_to_tm(tls *TLS, t int64, tm uintptr) (r int32) { remdays -= int32(_days_in_month[months]) goto _1 _1: + ; months++ } if months >= int32(10) { @@ -146850,7 +148211,7 @@ func X__tm_to_secs(tls *TLS, tm uintptr) (r int64) { adj-- month += int32(12) } - year += int64(adj) + year += int64(int64(adj)) } t = X__year_to_secs(tls, year, bp) t += int64(X__month_to_secs(tls, month, *(*int32)(unsafe.Pointer(bp)))) @@ -146893,9 +148254,10 @@ func _getint2(tls *TLS, p uintptr) (r int32) { x = uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p)))))-int32('0')) + uint32(10)*x goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(p))++ } - return int32(x) + return int32(int32(x)) } func _getoff(tls *TLS, p uintptr) (r int32) { @@ -146971,6 +148333,7 @@ func _getname(tls *TLS, d uintptr, p uintptr) { } goto _1 _1: + ; i++ } if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p)) + uintptr(i))) != 0 { @@ -146987,6 +148350,7 @@ func _getname(tls *TLS, d uintptr, p uintptr) { } goto _2 _2: + ; i++ } } @@ -147016,6 +148380,7 @@ func _zi_dotprod(tls *TLS, z uintptr, v uintptr, n Tsize_t) (r Tsize_t) { y += uint64(x * uint32(*(*uint8)(unsafe.Pointer(v)))) goto _1 _1: + ; n-- z += uintptr(4) v++ @@ -147037,9 +148402,9 @@ func _do_tzset(tls *TLS) { _, _, _, _, _, _, _, _, _, _, _, _, _ = i, l, map1, p1, pathname, posix_form, scale, skip, try, v2, v5, v6, v7 pathname = bp + 6 + uintptr(24) map1 = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 288)) = Xgetenv(tls, __ccgo_ts+1725) + *(*uintptr)(unsafe.Pointer(bp + 288)) = Xgetenv(tls, __ccgo_ts+1754) if !(*(*uintptr)(unsafe.Pointer(bp + 288)) != 0) { - *(*uintptr)(unsafe.Pointer(bp + 288)) = __ccgo_ts + 1728 + *(*uintptr)(unsafe.Pointer(bp + 288)) = __ccgo_ts + 1757 } if !(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288)))) != 0) { *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) @@ -147057,6 +148422,7 @@ func _do_tzset(tls *TLS) { _r0[i] = v2 goto _1 _1: + ; i++ } if _zi != 0 { @@ -147087,7 +148453,7 @@ func _do_tzset(tls *TLS) { if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) != int32(':') { *(*uintptr)(unsafe.Pointer(bp + 296)) = *(*uintptr)(unsafe.Pointer(bp + 288)) _getname(tls, bp+308, bp+296) - if *(*uintptr)(unsafe.Pointer(bp + 296)) != *(*uintptr)(unsafe.Pointer(bp + 288)) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('+') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('-') || BoolInt32(uint32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296)))))-uint32('0') < uint32(10)) != 0 || !(Xstrcmp(tls, bp+308, __ccgo_ts+1743) != 0) || !(Xstrcmp(tls, bp+308, __ccgo_ts+1747) != 0)) { + if *(*uintptr)(unsafe.Pointer(bp + 296)) != *(*uintptr)(unsafe.Pointer(bp + 288)) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('+') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('-') || BoolInt32(uint32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296)))))-uint32('0') < uint32(10)) != 0 || !(Xstrcmp(tls, bp+308, __ccgo_ts+1772) != 0) || !(Xstrcmp(tls, bp+308, __ccgo_ts+1776) != 0)) { posix_form = int32(1) } } @@ -147099,7 +148465,7 @@ func _do_tzset(tls *TLS) { *(*uintptr)(unsafe.Pointer(bp + 288))++ } if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) == int32('/') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) == int32('.') { - if !(X__libc.Fsecure != 0) || !(Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), __ccgo_ts+1728) != 0) { + if !(X__libc.Fsecure != 0) || !(Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), __ccgo_ts+1757) != 0) { map1 = X__map_file(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), uintptr(unsafe.Pointer(&_map_size))) } } else { @@ -147117,6 +148483,7 @@ func _do_tzset(tls *TLS) { map1 = X__map_file(tls, pathname-uintptr(l), uintptr(unsafe.Pointer(&_map_size))) goto _3 _3: + ; try += uintptr(l + uint64(1)) } } @@ -147125,7 +148492,7 @@ func _do_tzset(tls *TLS) { *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) } } - if map1 != 0 && (_map_size < uint64(44) || Xmemcmp(tls, map1, __ccgo_ts+1751, uint64(4)) != 0) { + if map1 != 0 && (_map_size < uint64(44) || Xmemcmp(tls, map1, __ccgo_ts+1780, uint64(4)) != 0) { X__munmap(tls, map1, _map_size) map1 = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) @@ -147160,6 +148527,7 @@ func _do_tzset(tls *TLS) { } goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 288))-- } *(*uintptr)(unsafe.Pointer(bp + 288))++ @@ -147188,6 +148556,7 @@ func _do_tzset(tls *TLS) { } goto _8 _8: + ; p1 += uintptr(6) } if !(Xtzname[0] != 0) { @@ -147198,7 +148567,7 @@ func _do_tzset(tls *TLS) { } if !(Xdaylight != 0) { Xtzname[int32(1)] = Xtzname[0] - _dst_off = int32(Xtimezone) + _dst_off = int32(int32(Xtimezone)) } return } @@ -147220,7 +148589,7 @@ func _do_tzset(tls *TLS) { } } else { Xdaylight = 0 - _dst_off = int32(Xtimezone) + _dst_off = int32(int32(Xtimezone)) } if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) == int32(',') { *(*uintptr)(unsafe.Pointer(bp + 288))++ @@ -147245,7 +148614,7 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { scale = int32(3) - BoolInt32(_trans == _zi+uintptr(44)) off = 0 a = uint64(0) - n = uint64((int64(_index) - int64(_trans)) >> scale) + n = uint64((int64(int64(_index)) - int64(int64(_trans))) >> scale) if !(n != 0) { if alt != 0 { *(*Tsize_t)(unsafe.Pointer(alt)) = uint64(0) @@ -147259,12 +148628,12 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { if scale == int32(3) { x = x<> scale) + n = uint64((int64(int64(_index)) - int64(int64(_trans))) >> scale) if a == n-uint64(1) { return uint64(-Int32FromInt32(1)) } @@ -147282,11 +148651,11 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { if scale == int32(3) { x = x<= t0 && t < t1 { @@ -147431,6 +148801,7 @@ func X__secs_to_zone(tls *TLS, t int64, local int32, isdst uintptr, offset uintp goto dst } std: + ; *(*int32)(unsafe.Pointer(isdst)) = 0 *(*int64)(unsafe.Pointer(offset)) = -Xtimezone if oppoff != 0 { @@ -147440,6 +148811,7 @@ std: ___unlock(tls, uintptr(unsafe.Pointer(&_lock4))) return dst: + ; *(*int32)(unsafe.Pointer(isdst)) = int32(1) *(*int64)(unsafe.Pointer(offset)) = int64(-_dst_off) if oppoff != 0 { @@ -147465,7 +148837,7 @@ func X__tm_to_tzname(tls *TLS, tm uintptr) (r uintptr) { p = (*Ttm)(unsafe.Pointer(tm)).F__tm_zone ___lock(tls, uintptr(unsafe.Pointer(&_lock4))) _do_tzset(tls) - if p != uintptr(unsafe.Pointer(&X__utc)) && p != Xtzname[0] && p != Xtzname[int32(1)] && (!(_zi != 0) || uint64(p)-uint64(_abbrevs) >= uint64(int64(_abbrevs_end)-int64(_abbrevs))) { + if p != uintptr(unsafe.Pointer(&X__utc)) && p != Xtzname[0] && p != Xtzname[int32(1)] && (!(_zi != 0) || uint64(uint64(p))-uint64(uint64(_abbrevs)) >= uint64(int64(int64(_abbrevs_end))-int64(int64(_abbrevs)))) { p = __ccgo_ts } ___unlock(tls, uintptr(unsafe.Pointer(&_lock4))) @@ -147482,8 +148854,8 @@ func X__year_to_secs(tls *TLS, year int64, is_leap uintptr) (r int64) { var centuries, cycles, leaps, leaps1, rem, y int32 var _ /* dummy at bp+0 */ int32 _, _, _, _, _, _ = centuries, cycles, leaps, leaps1, rem, y - if uint64(year)-uint64(2) <= uint64(136) { - y = int32(year) + if uint64(uint64(year))-uint64(2) <= uint64(136) { + y = int32(int32(year)) leaps = (y - int32(68)) >> int32(2) if !((y-Int32FromInt32(68))&Int32FromInt32(3) != 0) { leaps-- @@ -147531,13 +148903,13 @@ func X__year_to_secs(tls *TLS, year int64, is_leap uintptr) (r int64) { *(*int32)(unsafe.Pointer(is_leap)) = 0 leaps1 = 0 } else { - leaps1 = int32(uint32(rem) / uint32(4)) + leaps1 = int32(uint32(uint32(rem)) / uint32(4)) rem = int32(uint32(rem) % Uint32FromUint32(4)) *(*int32)(unsafe.Pointer(is_leap)) = BoolInt32(!(rem != 0)) } } leaps1 += int32(97)*cycles + int32(24)*centuries - *(*int32)(unsafe.Pointer(is_leap)) - return (year-int64(100))*int64(31536000) + int64(leaps1)*int64(86400) + int64(946684800) + int64(86400) + return (year-int64(100))*int64(31536000) + int64(int64(leaps1))*int64(86400) + int64(946684800) + int64(86400) } func Xasctime(tls *TLS, tm uintptr) (r uintptr) { @@ -147557,7 +148929,7 @@ func X__asctime_r(tls *TLS, tm uintptr, buf uintptr) (r uintptr) { } bp := tls.Alloc(64) defer tls.Free(64) - if Xsnprintf(tls, buf, uint64(26), __ccgo_ts+1756, VaList(bp+8, X__nl_langinfo_l(tls, int32(ABDAY_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_wday, uintptr(unsafe.Pointer(&X__c_locale))), X__nl_langinfo_l(tls, int32(ABMON_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_mon, uintptr(unsafe.Pointer(&X__c_locale))), (*Ttm)(unsafe.Pointer(tm)).Ftm_mday, (*Ttm)(unsafe.Pointer(tm)).Ftm_hour, (*Ttm)(unsafe.Pointer(tm)).Ftm_min, (*Ttm)(unsafe.Pointer(tm)).Ftm_sec, int32(1900)+(*Ttm)(unsafe.Pointer(tm)).Ftm_year)) >= int32(26) { + if Xsnprintf(tls, buf, uint64(26), __ccgo_ts+1785, VaList(bp+8, X__nl_langinfo_l(tls, int32(ABDAY_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_wday, uintptr(unsafe.Pointer(&X__c_locale))), X__nl_langinfo_l(tls, int32(ABMON_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_mon, uintptr(unsafe.Pointer(&X__c_locale))), (*Ttm)(unsafe.Pointer(tm)).Ftm_mday, (*Ttm)(unsafe.Pointer(tm)).Ftm_hour, (*Ttm)(unsafe.Pointer(tm)).Ftm_min, (*Ttm)(unsafe.Pointer(tm)).Ftm_sec, int32(1900)+(*Ttm)(unsafe.Pointer(tm)).Ftm_year)) >= int32(26) { /* ISO C requires us to use the above format string, * even if it will not fit in the buffer. Thus asctime_r * is _supposed_ to crash if the fields in tm are too large. @@ -147566,7 +148938,7 @@ func X__asctime_r(tls *TLS, tm uintptr, buf uintptr) (r uintptr) { * on other implementations (e.g. stack smashing..). */ // __asm__ __volatile__( "hlt" : : : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 108, __ccgo_ts+1788) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 108, __ccgo_ts+1817) } return buf } @@ -147654,7 +149026,7 @@ func X__clock_gettime(tls *TLS, clk Tclockid_t, ts uintptr) (r1 int32) { } r = -int32(EINVAL) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xclock_gettime(tls *TLS, clk Tclockid_t, ts uintptr) (r int32) { @@ -147774,14 +149146,14 @@ func Xgetdate(tls *TLS, s uintptr) (r uintptr) { var _ /* fmt at bp+0 */ [100]int8 _, _, _, _ = datemsk, f, p, ret ret = uintptr(0) - datemsk = Xgetenv(tls, __ccgo_ts+1800) + datemsk = Xgetenv(tls, __ccgo_ts+1829) f = uintptr(0) _pthread_setcancelstate(tls, PTHREAD_CANCEL_DEFERRED, bp+100) if !(datemsk != 0) { Xgetdate_err = int32(1) goto out } - f = Xfopen(tls, datemsk, __ccgo_ts+1228) + f = Xfopen(tls, datemsk, __ccgo_ts+381) if !(f != 0) { if *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(ENOMEM) { Xgetdate_err = int32(6) @@ -147803,6 +149175,7 @@ func Xgetdate(tls *TLS, s uintptr) (r uintptr) { Xgetdate_err = int32(7) } out: + ; if f != 0 { Xfclose(tls, f) } @@ -147844,7 +149217,7 @@ func X__gmtime_r(tls *TLS, t uintptr, tm uintptr) (r uintptr) { trc("tls=%v t=%v tm=%v, (%v:)", tls, t, tm, origin(2)) defer func() { trc("-> %v", r) }() } - if X__secs_to_tm(tls, *(*Ttime_t)(unsafe.Pointer(t)), tm) < 0 { + if X__secs_to_tm(tls, int64(*(*Ttime_t)(unsafe.Pointer(t))), tm) < 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return uintptr(0) } @@ -147888,12 +149261,12 @@ func X__localtime_r(tls *TLS, t uintptr, tm uintptr) (r uintptr) { } /* Reject time_t values whose year would overflow int because * __secs_to_zone cannot safely handle them. */ - if *(*Ttime_t)(unsafe.Pointer(t)) < int64(-Int32FromInt32(1)-Int32FromInt32(0x7fffffff))*Int64FromInt64(31622400) || *(*Ttime_t)(unsafe.Pointer(t)) > Int64FromInt32(INT_MAX)*Int64FromInt64(31622400) { + if int64(*(*Ttime_t)(unsafe.Pointer(t))) < int64(-Int32FromInt32(1)-Int32FromInt32(0x7fffffff))*Int64FromInt64(31622400) || int64(*(*Ttime_t)(unsafe.Pointer(t))) > Int64FromInt32(INT_MAX)*Int64FromInt64(31622400) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return uintptr(0) } - X__secs_to_zone(tls, *(*Ttime_t)(unsafe.Pointer(t)), 0, tm+32, tm+40, uintptr(0), tm+48) - if X__secs_to_tm(tls, *(*Ttime_t)(unsafe.Pointer(t))+(*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff, tm) < 0 { + X__secs_to_zone(tls, int64(*(*Ttime_t)(unsafe.Pointer(t))), 0, tm+32, tm+40, uintptr(0), tm+48) + if X__secs_to_tm(tls, int64(*(*Ttime_t)(unsafe.Pointer(t)))+int64((*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff), tm) < 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return uintptr(0) } @@ -147931,19 +149304,20 @@ func Xmktime(tls *TLS, tm uintptr) (r Ttime_t) { t = X__tm_to_secs(tls, tm) X__secs_to_zone(tls, t, int32(1), bp+32, bp+40, bp+56, bp+48) if (*Ttm)(unsafe.Pointer(tm)).Ftm_isdst >= 0 && (*(*Ttm)(unsafe.Pointer(bp))).Ftm_isdst != (*Ttm)(unsafe.Pointer(tm)).Ftm_isdst { - t -= *(*int64)(unsafe.Pointer(bp + 56)) - (*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff + t -= int64(*(*int64)(unsafe.Pointer(bp + 56)) - (*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff) } - t -= (*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff - if t != t { + t -= int64((*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff) + if int64(int64(int64(t))) != t { goto error } X__secs_to_zone(tls, t, 0, bp+32, bp+40, bp+56, bp+48) - if X__secs_to_tm(tls, t+(*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff, bp) < 0 { + if X__secs_to_tm(tls, t+int64((*(*Ttm)(unsafe.Pointer(bp))).F__tm_gmtoff), bp) < 0 { goto error } *(*Ttm)(unsafe.Pointer(tm)) = *(*Ttm)(unsafe.Pointer(bp)) - return t + return int64(int64(t)) error: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return int64(-int32(1)) } @@ -148009,7 +149383,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc var item Tnl_item var val int64 _, _, _, _, _, _, _, _, _, _, _, _ = d, def_pad, fmt, item, val, width, v1, v2, v4, v5, v6, v7 - fmt = __ccgo_ts + 1650 + fmt = __ccgo_ts + 1679 width = int32(2) def_pad = int32('0') switch f { @@ -148052,10 +149426,10 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc val = int64((*Ttm)(unsafe.Pointer(tm)).Ftm_mday) goto number case int32('D'): - fmt = __ccgo_ts + 1808 + fmt = __ccgo_ts + 1837 goto recu_strftime case int32('F'): - fmt = __ccgo_ts + 1817 + fmt = __ccgo_ts + 1846 goto recu_strftime case int32('g'): fallthrough @@ -148106,7 +149480,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto number case int32('n'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 1388 + return __ccgo_ts + 367 case int32('p'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_hour >= int32(12) { v1 = int32(PM_STR) @@ -148136,6 +149510,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc *(*int8)(unsafe.Pointer(v4)) = int8(Xtolower(tls, int32(*(*int8)(unsafe.Pointer(v5))))) goto _3 _3: + ; *(*Tsize_t)(unsafe.Pointer(l))++ } return s @@ -148143,10 +149518,10 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc item = int32(T_FMT_AMPM) goto nl_strftime case int32('R'): - fmt = __ccgo_ts + 1826 + fmt = __ccgo_ts + 1855 goto recu_strftime case int32('s'): - val = X__tm_to_secs(tls, tm) - (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff + val = X__tm_to_secs(tls, tm) - int64((*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff) width = int32(1) goto number case int32('S'): @@ -148154,9 +149529,9 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto number case int32('t'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 1386 + return __ccgo_ts + 1417 case int32('T'): - fmt = __ccgo_ts + 1832 + fmt = __ccgo_ts + 1861 goto recu_strftime case int32('u'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_wday != 0 { @@ -148195,7 +149570,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc case int32('Y'): val = int64((*Ttm)(unsafe.Pointer(tm)).Ftm_year) + int64(1900) if val >= int64(10000) { - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1841, VaList(bp+8, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1870, VaList(bp+8, val))) return s } width = int32(4) @@ -148205,7 +149580,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc *(*Tsize_t)(unsafe.Pointer(l)) = uint64(0) return __ccgo_ts } - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1847, VaList(bp+8, (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff/int64(3600)*int64(100)+(*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff%int64(3600)/int64(60)))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1876, VaList(bp+8, (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff/int64(3600)*int64(100)+(*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff%int64(3600)/int64(60)))) return s case int32('Z'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_isdst < 0 { @@ -148216,11 +149591,12 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto string case int32('%'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 376 + return __ccgo_ts + 414 default: return uintptr(0) } number: + ; if pad != 0 { v7 = pad } else { @@ -148228,24 +149604,28 @@ number: } switch v7 { case int32('-'): - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1854, VaList(bp+8, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1883, VaList(bp+8, val))) case int32('_'): - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1859, VaList(bp+8, width, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1888, VaList(bp+8, width, val))) case int32('0'): fallthrough default: - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1865, VaList(bp+8, width, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1894, VaList(bp+8, width, val))) break } return s nl_strcat: + ; fmt = X__nl_langinfo_l(tls, item, loc) string: + ; *(*Tsize_t)(unsafe.Pointer(l)) = Xstrlen(tls, fmt) return fmt nl_strftime: + ; fmt = X__nl_langinfo_l(tls, item, loc) recu_strftime: + ; *(*Tsize_t)(unsafe.Pointer(l)) = X__strftime_l(tls, s, uint64(100), fmt, tm, loc) if !(*(*Tsize_t)(unsafe.Pointer(l)) != 0) { return uintptr(0) @@ -148331,6 +149711,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _5 _5: + ; t++ *(*Tsize_t)(unsafe.Pointer(bp))-- } @@ -148344,6 +149725,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _6 _6: + ; d++ } if (*Ttm)(unsafe.Pointer(tm)).Ftm_year < -int32(1900) { @@ -148375,6 +149757,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl *(*int8)(unsafe.Pointer(s + uintptr(v12))) = int8('0') goto _11 _11: + ; width-- } } @@ -148385,6 +149768,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl l += *(*Tsize_t)(unsafe.Pointer(bp)) goto _1 _1: + ; f++ } if n != 0 { @@ -148401,7 +149785,7 @@ func Xstrftime(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize_t trc("tls=%v s=%v n=%v f=%v tm=%v, (%v:)", tls, s, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { @@ -148450,6 +149834,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _4 _4: + ; s++ } } else { @@ -148541,25 +149926,32 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _41 _11: + ; _10: + ; dest = tm + 24 min = int32(ABDAY_1) range1 = int32(7) goto symbolic_range _14: + ; _13: + ; _12: + ; dest = tm + 16 min = int32(ABMON_1) range1 = int32(12) goto symbolic_range _15: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(D_T_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _16: + ; dest = bp + 4 if w < 0 { w = int32(2) @@ -148567,47 +149959,58 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { want_century |= int32(2) goto numeric_digits _18: + ; _17: + ; dest = tm + 12 min = int32(1) range1 = int32(31) goto numeric_range _19: - s = Xstrptime(tls, s, __ccgo_ts+1808, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1837, tm) if !(s != 0) { return uintptr(0) } goto _41 _20: + ; dest = tm + 8 min = 0 range1 = int32(24) goto numeric_range _21: + ; dest = tm + 8 min = int32(1) range1 = int32(12) goto numeric_range _22: + ; dest = tm + 28 min = int32(1) range1 = int32(366) adj = int32(1) goto numeric_range _23: + ; dest = tm + 16 min = int32(1) range1 = int32(12) adj = int32(1) goto numeric_range _24: + ; dest = tm + 4 min = 0 range1 = int32(60) goto numeric_range _26: + ; _25: + ; _44: + ; if v48 = *(*int8)(unsafe.Pointer(s)) != 0; v48 { v45 = int32(*(*int8)(unsafe.Pointer(s))) v46 = BoolInt32(v45 == int32(' ') || uint32(v45)-uint32('\t') < uint32(5)) @@ -148619,12 +150022,15 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _43 _43: + ; s++ goto _44 goto _42 _42: + ; goto _41 _27: + ; ex = Xnl_langinfo(tls, int32(AM_STR)) len1 = Xstrlen(tls, ex) if !(Xstrncasecmp(tls, s, ex, len1) != 0) { @@ -148642,58 +150048,69 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } return uintptr(0) _28: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(T_FMT_AMPM)), tm) if !(s != 0) { return uintptr(0) } goto _41 _29: - s = Xstrptime(tls, s, __ccgo_ts+1826, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1855, tm) if !(s != 0) { return uintptr(0) } goto _41 _30: + ; dest = tm min = 0 range1 = int32(61) goto numeric_range _31: - s = Xstrptime(tls, s, __ccgo_ts+1832, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1861, tm) if !(s != 0) { return uintptr(0) } goto _41 _33: + ; _32: + ; /* Throw away result, for now. (FIXME?) */ dest = bp min = 0 range1 = int32(54) goto numeric_range _34: + ; dest = tm + 24 min = 0 range1 = int32(7) goto numeric_range _35: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(D_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _36: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(T_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _37: + ; dest = bp + 8 w = int32(2) want_century |= int32(1) goto numeric_digits _38: + ; dest = tm + 20 if w < 0 { w = int32(4) @@ -148702,6 +150119,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { want_century = 0 goto numeric_digits _39: + ; v49 = s s++ if int32(*(*int8)(unsafe.Pointer(v49))) != int32('%') { @@ -148709,8 +150127,10 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _41 _40: + ; return uintptr(0) numeric_range: + ; if !(BoolInt32(uint32(*(*int8)(unsafe.Pointer(s)))-Uint32FromUint8('0') < Uint32FromInt32(10)) != 0) { return uintptr(0) } @@ -148725,9 +150145,10 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) = *(*int32)(unsafe.Pointer(dest))*int32(10) + int32(*(*int8)(unsafe.Pointer(v51))) - int32('0') goto _50 _50: + ; i *= int32(10) } - if uint32(*(*int32)(unsafe.Pointer(dest))-min) >= uint32(range1) { + if uint32(*(*int32)(unsafe.Pointer(dest))-min) >= uint32(uint32(range1)) { return uintptr(0) } *(*int32)(unsafe.Pointer(dest)) -= adj @@ -148736,6 +150157,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto update numeric_digits: + ; neg = 0 if int32(*(*int8)(unsafe.Pointer(s))) == int32('+') { s++ @@ -148760,6 +150182,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) = *(*int32)(unsafe.Pointer(dest))*int32(10) + int32(*(*int8)(unsafe.Pointer(v54))) - int32('0') goto _52 _52: + ; i++ } if neg != 0 { @@ -148768,6 +150191,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) -= adj goto update symbolic_range: + ; i = int32(2)*range1 - int32(1) for { if !(i >= 0) { @@ -148783,6 +150207,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { break goto _55 _55: + ; i-- } if i < 0 { @@ -148790,6 +150215,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto update update: + ; //FIXME _41: } @@ -148840,7 +150266,7 @@ func Xtimegm(tls *TLS, tm uintptr) (r Ttime_t) { (*Ttm1)(unsafe.Pointer(tm)).Ftm_isdst = 0 (*Ttm1)(unsafe.Pointer(tm)).Ftm_gmtoff = 0 (*Ttm1)(unsafe.Pointer(tm)).Ftm_zone = uintptr(unsafe.Pointer(&X__utc)) - return t + return int64(int64(t)) } func Xtimer_delete(tls *TLS, t Ttimer_t) (r int32) { @@ -148850,13 +150276,13 @@ func Xtimer_delete(tls *TLS, t Ttimer_t) (r int32) { } var td Tpthread_t _ = td - if int64(t) < 0 { - td = uintptr(uint64(t) << Int32FromInt32(1)) + if int64(int64(t)) < 0 { + td = uintptr(uint64(uint64(t)) << Int32FromInt32(1)) // __asm__ __volatile__( // // "mov %1, %0 ; lock ; orl $0,(%%rsp)" // : "=m"(*p) : "r"(x) : "memory" ); - X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1872) + X__assert_fail(tls, __ccgo_ts+212, __ccgo_ts+247, 88, __ccgo_ts+1901) X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(td)).Ftid), int64(Int32FromInt32(SIGTIMER))) return 0 } @@ -148870,8 +150296,8 @@ func Xtimer_getoverrun(tls *TLS, t Ttimer_t) (r int32) { } var td Tpthread_t _ = td - if int64(t) < 0 { - td = uintptr(uint64(t) << Int32FromInt32(1)) + if int64(int64(t)) < 0 { + td = uintptr(uint64(uint64(t)) << Int32FromInt32(1)) t = uintptr(uint64(AtomicLoadPInt32(td+164) & Int32FromInt32(INT_MAX))) } return int32(X__syscall_ret(tls, uint64(X__syscall1(tls, int64(SYS_timer_getoverrun), int64(t))))) @@ -148884,8 +150310,8 @@ func Xtimer_gettime(tls *TLS, t Ttimer_t, val uintptr) (r int32) { } var td Tpthread_t _ = td - if int64(t) < 0 { - td = uintptr(uint64(t) << Int32FromInt32(1)) + if int64(int64(t)) < 0 { + td = uintptr(uint64(uint64(t)) << Int32FromInt32(1)) t = uintptr(uint64(AtomicLoadPInt32(td+164) & Int32FromInt32(INT_MAX))) } return int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_timer_gettime), int64(t), int64(val))))) @@ -148898,8 +150324,8 @@ func Xtimer_settime(tls *TLS, t Ttimer_t, flags int32, val uintptr, old uintptr) } var td Tpthread_t _ = td - if int64(t) < 0 { - td = uintptr(uint64(t) << Int32FromInt32(1)) + if int64(int64(t)) < 0 { + td = uintptr(uint64(uint64(t)) << Int32FromInt32(1)) t = uintptr(uint64(AtomicLoadPInt32(td+164) & Int32FromInt32(INT_MAX))) } return int32(X__syscall_ret(tls, uint64(X__syscall4(tls, int64(SYS_timer_settime), int64(t), int64(flags), int64(val), int64(old))))) @@ -149044,6 +150470,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _5 _5: + ; t += 4 *(*Tsize_t)(unsafe.Pointer(bp))-- } @@ -149070,6 +150497,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl *(*Twchar_t)(unsafe.Pointer(s + uintptr(v9)*4)) = int32('0') goto _8 _8: + ; width-- } } @@ -149080,6 +150508,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl l += *(*Tsize_t)(unsafe.Pointer(bp)) goto _1 _1: + ; f += 4 } if n != 0 { @@ -149096,7 +150525,7 @@ func Xwcsftime(tls *TLS, wcs uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize trc("tls=%v wcs=%v n=%v f=%v tm=%v, (%v:)", tls, wcs, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xwcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { @@ -149141,7 +150570,7 @@ func Xalarm(tls *TLS, seconds uint32) (r uint32) { var _ /* old at bp+32 */ Titimerval *(*Titimerval)(unsafe.Pointer(bp)) = Titimerval{ Fit_value: Ttimeval{ - Ftv_sec: int64(seconds), + Ftv_sec: int64(int64(seconds)), }, } *(*Titimerval)(unsafe.Pointer(bp + 32)) = Titimerval{} @@ -149181,7 +150610,7 @@ func Xclose(tls *TLS, fd int32) (r1 int32) { if r == -int32(EINTR) { r = 0 } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xctermid(tls *TLS, s uintptr) (r uintptr) { @@ -149192,9 +150621,9 @@ func Xctermid(tls *TLS, s uintptr) (r uintptr) { var v1 uintptr _ = v1 if s != 0 { - v1 = Xstrcpy(tls, s, __ccgo_ts+1885) + v1 = Xstrcpy(tls, s, __ccgo_ts+358) } else { - v1 = __ccgo_ts + 1885 + v1 = __ccgo_ts + 358 } return v1 } @@ -149221,7 +150650,7 @@ func Xdup2(tls *TLS, old int32, new1 int32) (r1 int32) { break } } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func X__dup3(tls *TLS, old int32, new1 int32, flags int32) (r1 int32) { @@ -149243,7 +150672,7 @@ func X__dup3(tls *TLS, old int32, new1 int32, flags int32) (r1 int32) { } } if r != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } if flags & ^Int32FromInt32(O_CLOEXEC) != 0 { return int32(X__syscall_ret(tls, uint64(-Int32FromInt32(EINVAL)))) @@ -149259,7 +150688,7 @@ func X__dup3(tls *TLS, old int32, new1 int32, flags int32) (r1 int32) { if r >= 0 && flags&int32(O_CLOEXEC) != 0 { X__syscall3(tls, int64(SYS_fcntl), int64(new1), int64(Int32FromInt32(F_SETFD)), int64(Int32FromInt32(FD_CLOEXEC))) } - return int32(X__syscall_ret(tls, uint64(r))) + return int32(X__syscall_ret(tls, uint64(uint64(r)))) } func Xdup3(tls *TLS, old int32, new1 int32, flags int32) (r int32) { @@ -149302,7 +150731,7 @@ func Xfaccessat(tls *TLS, fd int32, filename uintptr, amode int32, flag int32) ( if flag != 0 { ret = int32(X__syscall4(tls, int64(SYS_faccessat2), int64(fd), int64(filename), int64(amode), int64(flag))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } } if flag & ^Int32FromInt32(AT_EACCESS) != 0 { @@ -149323,9 +150752,9 @@ func Xfchdir(tls *TLS, fd int32) (r int32) { _ = ret ret = int32(X__syscall1(tls, int64(SYS_fchdir), int64(fd))) if ret != -int32(EBADF) || X__syscall2(tls, int64(SYS_fcntl), int64(fd), int64(Int32FromInt32(F_GETFD))) < 0 { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } - X__procfdname(tls, bp, uint32(fd)) + X__procfdname(tls, bp, uint32(uint32(fd))) return int32(X__syscall_ret(tls, uint64(X__syscall1(tls, int64(SYS_chdir), int64(bp))))) } @@ -149341,9 +150770,9 @@ func Xfchown(tls *TLS, fd int32, uid Tuid_t, gid Tgid_t) (r int32) { _ = ret ret = int32(X__syscall3(tls, int64(SYS_fchown), int64(fd), int64(uid), int64(gid))) if ret != -int32(EBADF) || X__syscall2(tls, int64(SYS_fcntl), int64(fd), int64(Int32FromInt32(F_GETFD))) < 0 { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } - X__procfdname(tls, bp, uint32(fd)) + X__procfdname(tls, bp, uint32(uint32(fd))) return int32(X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_chown), int64(bp), int64(uid), int64(gid))))) } @@ -149483,6 +150912,7 @@ func Xgethostname(tls *TLS, name uintptr, len1 Tsize_t) (r int32) { } goto _1 _1: + ; i++ } if i != 0 && i == len1 { @@ -149496,7 +150926,7 @@ func Xgetlogin(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - return Xgetenv(tls, __ccgo_ts+1894) + return Xgetenv(tls, __ccgo_ts+1914) } func Xgetlogin_r(tls *TLS, name uintptr, size Tsize_t) (r int32) { @@ -149683,7 +151113,7 @@ func Xpipe2(tls *TLS, fd uintptr, flag int32) (r int32) { } ret = int32(X__syscall2(tls, int64(SYS_pipe2), int64(fd), int64(flag))) if ret != -int32(ENOSYS) { - return int32(X__syscall_ret(tls, uint64(ret))) + return int32(X__syscall_ret(tls, uint64(uint64(ret)))) } if flag & ^(Int32FromInt32(O_CLOEXEC)|Int32FromInt32(O_NONBLOCK)) != 0 { return int32(X__syscall_ret(tls, uint64(-Int32FromInt32(EINVAL)))) @@ -149769,7 +151199,7 @@ func Xreadlink(tls *TLS, path uintptr, buf uintptr, bufsize Tsize_t) (r1 Tssize_ if buf == bp && r > 0 { r = 0 } - return X__syscall_ret(tls, uint64(r)) + return X__syscall_ret(tls, uint64(uint64(r))) } func Xreadlinkat(tls *TLS, fd int32, path uintptr, buf uintptr, bufsize Tsize_t) (r1 Tssize_t) { @@ -149790,7 +151220,7 @@ func Xreadlinkat(tls *TLS, fd int32, path uintptr, buf uintptr, bufsize Tsize_t) if buf == bp && r > 0 { r = 0 } - return X__syscall_ret(tls, uint64(r)) + return X__syscall_ret(tls, uint64(uint64(r))) } func Xreadv(tls *TLS, fd int32, iov uintptr, count int32) (r Tssize_t) { @@ -149822,7 +151252,7 @@ func Xsetgid(tls *TLS, gid Tgid_t) (r int32) { trc("tls=%v gid=%v, (%v:)", tls, gid, origin(2)) defer func() { trc("-> %v", r) }() } - return X__setxid(tls, int32(SYS_setgid), int32(gid), 0, 0) + return X__setxid(tls, int32(SYS_setgid), int32(int32(gid)), 0, 0) } func Xsetpgid(tls *TLS, pid Tpid_t, pgid Tpid_t) (r int32) { @@ -149854,7 +151284,7 @@ func Xsetuid(tls *TLS, uid Tuid_t) (r int32) { trc("tls=%v uid=%v, (%v:)", tls, uid, origin(2)) defer func() { trc("-> %v", r) }() } - return X__setxid(tls, int32(SYS_setuid), int32(uid), 0, 0) + return X__setxid(tls, int32(SYS_setuid), int32(int32(uid)), 0, 0) } type Tctx2 = struct { @@ -149922,7 +151352,7 @@ func Xsleep(tls *TLS, seconds uint32) (r uint32) { defer tls.Free(16) var _ /* tv at bp+0 */ Ttimespec *(*Ttimespec)(unsafe.Pointer(bp)) = Ttimespec{ - Ftv_sec: int64(seconds), + Ftv_sec: int64(int64(seconds)), } if Xnanosleep(tls, bp, bp) != 0 { return uint32((*(*Ttimespec)(unsafe.Pointer(bp))).Ftv_sec) @@ -150029,12 +151459,12 @@ func Xttyname_r(tls *TLS, fd int32, name uintptr, size Tsize_t) (r int32) { if !(Xisatty(tls, fd) != 0) { return *(*int32)(unsafe.Pointer(X__errno_location(tls))) } - X__procfdname(tls, bp+288, uint32(fd)) + X__procfdname(tls, bp+288, uint32(uint32(fd))) l = Xreadlink(tls, bp+288, name, size) if l < 0 { return *(*int32)(unsafe.Pointer(X__errno_location(tls))) } else { - if uint64(l) == size { + if uint64(uint64(l)) == size { return int32(ERANGE) } } @@ -150059,10 +151489,10 @@ func Xualarm(tls *TLS, value uint32, interval uint32) (r uint32) { var _ /* it_old at bp+32 */ Titimerval *(*Titimerval)(unsafe.Pointer(bp)) = Titimerval{ Fit_interval: Ttimeval{ - Ftv_usec: int64(interval), + Ftv_usec: int64(int64(interval)), }, Fit_value: Ttimeval{ - Ftv_usec: int64(value), + Ftv_usec: int64(int64(value)), }, } Xsetitimer(tls, ITIMER_REAL, bp, bp+32) @@ -153311,4 +154741,4 @@ var Xstdout = uintptr(unsafe.Pointer(&X__stdout_FILE)) var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "\x00/bin:/usr/bin\x00%s\x008b \xd0\xc1\xd2\xcf\xcc\xd8\x00$2a$00$abcdefghijklmnopqrstuu\x00\xff\xa334\xff\xff\xff\xa3345\x00*\x00\x80\xff\x80\x01 \x7f\x81\x80\x80\r\n\xff\x7f \x81 test\x00_0.../9Zz\x00_0.../9ZzX7iSJNd21sU\x00\x80x\x00\x80x22/wK52ZKGA\x00x\x00$1$\x00$5$\x00rounds=\x00rounds=%u$\x00$5$%s%.*s$\x00$6$\x00$6$%s%.*s$\x00toupper\x00tolower\x00assembler statements not supported\x00atomic_arch.h\x00__stack_chk_fail\x00Assertion failed: %s (%s: %s: %d)\n\x00infinity\x00nan\x00\x00\x01\x02\x04\a\x03\x06\x05\x00/proc/self/fd/\x00UTF-8\x00NLSPATH\x00LANG\x00_.@\x00.@\x00%\x00bindtextdomain\x00messages\x00%s/%.*s%.*s/%s/%s.mo\x00\x00n!=1;\x00Plural-Forms:\x00nplurals=\x00plural=\x00dcngettext\x00Ê̄Ê̌ê̄ê̌\x00utf8\x00ASCII\x00C\x00LC_ALL\x00C.UTF-8\x00POSIX\x00MUSL_LOCPATH\x00.\x00%*.*f\x00fma\x00/\x00ffsll\x00MSGVERB\x00label\x00severity\x00text\x00action\x00tag\x00HALT: \x00ERROR: \x00WARNING: \x00INFO: \x00/dev/console\x00: \x00\nTO FIX: \x00 \x00%s%s%s%s%s%s%s%s\n\x00PWD\x00: unrecognized option: \x00: option requires an argument: \x00: option does not take an argument: \x00: option is ambiguous: \x00%*[^\n]%*[\n]\x00 %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d\x00%s\t%s\t%s\t%s\t%d\t%d\n\x00/dev/ptmx\x00/dev/pts/%d\x00%b %e %T\x00<%d>%s %n%s%s%.0d%s: \x00[\x00]\x00%.*s\x00/dev/shm/\x00%.2X\x00:%.2X\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x00/etc/hosts\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00/etc/services\x00/udp\x00/tcp\x00tcp\x00udp\x00%s%s%s\n\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00/etc/resolv.conf\x00options\x00ndots:\x00attempts:\x00timeout:\x00nameserver\x00domain\x00search\x00127.0.0.1\x00/etc/group\x00rbe\x00/etc/passwd\x00/dev/null\x00re\x00r\x00%s:%s:%u:\x00,\x00%s%s\x00%s:%s:%u:%u:%s:%s:%s\n\x00%s:%s:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*lu\n\x00PATH\x00/usr/local/bin:/bin:/usr/bin\x00HOME\x00\t\x00\n\x00\r\x00\f\x00\a\x00\x1b\x00[[:alnum:]_]\x00[^[:alnum:]_]\x00[[:space:]]\x00[^[:space:]]\x00[[:digit:]]\x00[^[:digit:]]\x00__libc_sigaction\x00rwa\x00locking_getc\x00locking_putc\x00__do_orphaned_stdio_locks\x00ftrylockfile\x00/tmp\x00temp\x00w+\x00-0X+0X 0X-0x+0x 0x\x00inf\x00INF\x00NAN\x00-+ 0X0x\x00(null)\x00%*s\x00%%%s%s%s%s%s*.*%c%c\x00#\x00+\x00-\x000\x00\x00\x00\x00\x00%.*s%.0d%s%c%%lln\x00%*\x00%.*e\x00%.*f\x00000000000000000\x00%.*g\x00@\x00\x00\x00\x00\x00\x00\x00XXXXXX\x00TZ\x00/etc/localtime\x00UTC\x00GMT\x00TZif\x00%.3s %.3s%3d %.2d:%.2d:%.2d %d\n\x00__asctime_r\x00DATEMSK\x00%m/%d/%y\x00%Y-%m-%d\x00%H:%M\x00%H:%M:%S\x00+%lld\x00%+.4ld\x00%lld\x00%*lld\x00%0*lld\x00timer_delete\x00/dev/tty\x00LOGNAME\x00" +var __ccgo_ts1 = "\x00/bin:/usr/bin\x00%s\x008b \xd0\xc1\xd2\xcf\xcc\xd8\x00$2a$00$abcdefghijklmnopqrstuu\x00\xff\xa334\xff\xff\xff\xa3345\x00*\x00\x80\xff\x80\x01 \x7f\x81\x80\x80\r\n\xff\x7f \x81 test\x00_0.../9Zz\x00_0.../9ZzX7iSJNd21sU\x00\x80x\x00\x80x22/wK52ZKGA\x00x\x00$1$\x00$5$\x00rounds=\x00rounds=%u$\x00$5$%s%.*s$\x00$6$\x00$6$%s%.*s$\x00toupper\x00tolower\x00assembler statements not supported\x00atomic_arch.h\x00__stack_chk_fail\x00Assertion failed: %s (%s: %s: %d)\n\x00infinity\x00nan\x00\x00\x01\x02\x04\a\x03\x06\x05\x00/proc/self/fd/\x00%s: \x00: \x00/dev/tty\x00\n\x00/etc/shells\x00rbe\x00rb\x00UTF-8\x00NLSPATH\x00LANG\x00_.@\x00.@\x00%\x00bindtextdomain\x00messages\x00%s/%.*s%.*s/%s/%s.mo\x00\x00n!=1;\x00Plural-Forms:\x00nplurals=\x00plural=\x00dcngettext\x00Ê̄Ê̌ê̄ê̌\x00utf8\x00ASCII\x00C\x00LC_ALL\x00C.UTF-8\x00POSIX\x00MUSL_LOCPATH\x00.\x00%*.*f\x00fma\x00/\x00ffsll\x00MSGVERB\x00label\x00severity\x00text\x00action\x00tag\x00HALT: \x00ERROR: \x00WARNING: \x00INFO: \x00/dev/console\x00\nTO FIX: \x00 \x00%s%s%s%s%s%s%s%s\n\x00PWD\x00: unrecognized option: \x00: option requires an argument: \x00: option does not take an argument: \x00: option is ambiguous: \x00%*[^\n]%*[\n]\x00 %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d\x00%s\t%s\t%s\t%s\t%d\t%d\n\x00/dev/ptmx\x00/dev/pts/%d\x00%b %e %T\x00<%d>%s %n%s%s%.0d%s: \x00[\x00]\x00%.*s\x00/dev/shm/\x00%.2X\x00:%.2X\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x00/etc/hosts\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00/etc/services\x00/udp\x00/tcp\x00tcp\x00udp\x00%s%s%s\n\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00/etc/resolv.conf\x00options\x00ndots:\x00attempts:\x00timeout:\x00nameserver\x00domain\x00search\x00127.0.0.1\x00/etc/group\x00/etc/passwd\x00/dev/null\x00re\x00r\x00%s:%s:%u:\x00,\x00%s%s\x00%s:%s:%u:%u:%s:%s:%s\n\x00%s:%s:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*lu\n\x00PATH\x00/usr/local/bin:/bin:/usr/bin\x00HOME\x00\t\x00\r\x00\f\x00\a\x00\x1b\x00[[:alnum:]_]\x00[^[:alnum:]_]\x00[[:space:]]\x00[^[:space:]]\x00[[:digit:]]\x00[^[:digit:]]\x00__libc_sigaction\x00rwa\x00locking_getc\x00locking_putc\x00__do_orphaned_stdio_locks\x00ftrylockfile\x00/tmp\x00temp\x00w+\x00-0X+0X 0X-0x+0x 0x\x00inf\x00INF\x00NAN\x00-+ 0X0x\x00(null)\x00%*s\x00%%%s%s%s%s%s*.*%c%c\x00#\x00+\x00-\x000\x00\x00\x00\x00\x00%.*s%.0d%s%c%%lln\x00%*\x00%.*e\x00%.*f\x00000000000000000\x00%.*g\x00@\x00\x00\x00\x00\x00\x00\x00XXXXXX\x00TZ\x00/etc/localtime\x00UTC\x00GMT\x00TZif\x00%.3s %.3s%3d %.2d:%.2d:%.2d %d\n\x00__asctime_r\x00DATEMSK\x00%m/%d/%y\x00%Y-%m-%d\x00%H:%M\x00%H:%M:%S\x00+%lld\x00%+.4ld\x00%lld\x00%*lld\x00%0*lld\x00timer_delete\x00LOGNAME\x00" diff --git a/vendor/modernc.org/libc/ccgo_linux_loong64.go b/vendor/modernc.org/libc/ccgo_linux_loong64.go index 3e268e39..88933032 100644 --- a/vendor/modernc.org/libc/ccgo_linux_loong64.go +++ b/vendor/modernc.org/libc/ccgo_linux_loong64.go @@ -1,4 +1,4 @@ -// Code generated for linux/loong64 by 'gcc --package-name=libc --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -emit-func-aliases -eval-all-macros -extended-errors -ignore-asm-errors -isystem -std=c99 -nostdinc -ffreestanding -D_XOPEN_SOURCE=700 -I./arch/loongarch64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -DNDEBUG -nostdlib -shared -o lib/libc.so.go obj/src/complex/__cexp.lo.go obj/src/complex/__cexpf.lo.go obj/src/complex/cabs.lo.go obj/src/complex/cabsf.lo.go obj/src/complex/cabsl.lo.go obj/src/complex/cacos.lo.go obj/src/complex/cacosf.lo.go obj/src/complex/cacosh.lo.go obj/src/complex/cacoshf.lo.go obj/src/complex/cacoshl.lo.go obj/src/complex/cacosl.lo.go obj/src/complex/carg.lo.go obj/src/complex/cargf.lo.go obj/src/complex/cargl.lo.go obj/src/complex/casin.lo.go obj/src/complex/casinf.lo.go obj/src/complex/casinh.lo.go obj/src/complex/casinhf.lo.go obj/src/complex/casinhl.lo.go obj/src/complex/casinl.lo.go obj/src/complex/catan.lo.go obj/src/complex/catanf.lo.go obj/src/complex/catanh.lo.go obj/src/complex/catanhf.lo.go obj/src/complex/catanhl.lo.go obj/src/complex/catanl.lo.go obj/src/complex/ccos.lo.go obj/src/complex/ccosf.lo.go obj/src/complex/ccosh.lo.go obj/src/complex/ccoshf.lo.go obj/src/complex/ccoshl.lo.go obj/src/complex/ccosl.lo.go obj/src/complex/cexp.lo.go obj/src/complex/cexpf.lo.go obj/src/complex/cexpl.lo.go obj/src/complex/cimag.lo.go obj/src/complex/cimagf.lo.go obj/src/complex/cimagl.lo.go obj/src/complex/clog.lo.go obj/src/complex/clogf.lo.go obj/src/complex/clogl.lo.go obj/src/complex/conj.lo.go obj/src/complex/conjf.lo.go obj/src/complex/conjl.lo.go obj/src/complex/cpow.lo.go obj/src/complex/cpowf.lo.go obj/src/complex/cpowl.lo.go obj/src/complex/cproj.lo.go obj/src/complex/cprojf.lo.go obj/src/complex/cprojl.lo.go obj/src/complex/creal.lo.go obj/src/complex/crealf.lo.go obj/src/complex/creall.lo.go obj/src/complex/csin.lo.go obj/src/complex/csinf.lo.go obj/src/complex/csinh.lo.go obj/src/complex/csinhf.lo.go obj/src/complex/csinhl.lo.go obj/src/complex/csinl.lo.go obj/src/complex/csqrt.lo.go obj/src/complex/csqrtf.lo.go obj/src/complex/csqrtl.lo.go obj/src/complex/ctan.lo.go obj/src/complex/ctanf.lo.go obj/src/complex/ctanh.lo.go obj/src/complex/ctanhf.lo.go obj/src/complex/ctanhl.lo.go obj/src/complex/ctanl.lo.go obj/src/conf/confstr.lo.go obj/src/conf/fpathconf.lo.go obj/src/conf/legacy.lo.go obj/src/conf/pathconf.lo.go obj/src/conf/sysconf.lo.go obj/src/crypt/crypt.lo.go obj/src/crypt/crypt_blowfish.lo.go obj/src/crypt/crypt_des.lo.go obj/src/crypt/crypt_md5.lo.go obj/src/crypt/crypt_r.lo.go obj/src/crypt/crypt_sha256.lo.go obj/src/crypt/crypt_sha512.lo.go obj/src/crypt/encrypt.lo.go obj/src/ctype/__ctype_b_loc.lo.go obj/src/ctype/__ctype_get_mb_cur_max.lo.go obj/src/ctype/__ctype_tolower_loc.lo.go obj/src/ctype/__ctype_toupper_loc.lo.go obj/src/ctype/isalnum.lo.go obj/src/ctype/isalpha.lo.go obj/src/ctype/isascii.lo.go obj/src/ctype/isblank.lo.go obj/src/ctype/iscntrl.lo.go obj/src/ctype/isdigit.lo.go obj/src/ctype/isgraph.lo.go obj/src/ctype/islower.lo.go obj/src/ctype/isprint.lo.go obj/src/ctype/ispunct.lo.go obj/src/ctype/isspace.lo.go obj/src/ctype/isupper.lo.go obj/src/ctype/iswalnum.lo.go obj/src/ctype/iswalpha.lo.go obj/src/ctype/iswblank.lo.go obj/src/ctype/iswcntrl.lo.go obj/src/ctype/iswctype.lo.go obj/src/ctype/iswdigit.lo.go obj/src/ctype/iswgraph.lo.go obj/src/ctype/iswlower.lo.go obj/src/ctype/iswprint.lo.go obj/src/ctype/iswpunct.lo.go obj/src/ctype/iswspace.lo.go obj/src/ctype/iswupper.lo.go obj/src/ctype/iswxdigit.lo.go obj/src/ctype/isxdigit.lo.go obj/src/ctype/toascii.lo.go obj/src/ctype/tolower.lo.go obj/src/ctype/toupper.lo.go obj/src/ctype/towctrans.lo.go obj/src/ctype/wcswidth.lo.go obj/src/ctype/wctrans.lo.go obj/src/ctype/wcwidth.lo.go obj/src/dirent/alphasort.lo.go obj/src/dirent/closedir.lo.go obj/src/dirent/dirfd.lo.go obj/src/dirent/fdopendir.lo.go obj/src/dirent/opendir.lo.go obj/src/dirent/readdir.lo.go obj/src/dirent/readdir_r.lo.go obj/src/dirent/rewinddir.lo.go obj/src/dirent/scandir.lo.go obj/src/dirent/seekdir.lo.go obj/src/dirent/telldir.lo.go obj/src/dirent/versionsort.lo.go obj/src/env/__environ.lo.go obj/src/env/__reset_tls.lo.go obj/src/env/__stack_chk_fail.lo.go obj/src/env/clearenv.lo.go obj/src/env/getenv.lo.go obj/src/env/putenv.lo.go obj/src/env/secure_getenv.lo.go obj/src/env/setenv.lo.go obj/src/env/unsetenv.lo.go obj/src/errno/strerror.lo.go obj/src/exit/_Exit.lo.go obj/src/exit/abort_lock.lo.go obj/src/exit/assert.lo.go obj/src/exit/at_quick_exit.lo.go obj/src/exit/quick_exit.lo.go obj/src/fcntl/creat.lo.go obj/src/fcntl/fcntl.lo.go obj/src/fcntl/open.lo.go obj/src/fcntl/openat.lo.go obj/src/fcntl/posix_fadvise.lo.go obj/src/fcntl/posix_fallocate.lo.go obj/src/internal/defsysinfo.lo.go obj/src/internal/emulate_wait4.lo.go obj/src/internal/floatscan.lo.go obj/src/internal/intscan.lo.go obj/src/internal/libc.lo.go obj/src/internal/procfdname.lo.go obj/src/internal/shgetc.lo.go obj/src/internal/syscall_ret.lo.go obj/src/internal/vdso.lo.go obj/src/internal/version.lo.go obj/src/ipc/ftok.lo.go obj/src/ipc/msgctl.lo.go obj/src/ipc/msgget.lo.go obj/src/ipc/msgrcv.lo.go obj/src/ipc/msgsnd.lo.go obj/src/ipc/semctl.lo.go obj/src/ipc/semget.lo.go obj/src/ipc/semop.lo.go obj/src/ipc/semtimedop.lo.go obj/src/ipc/shmat.lo.go obj/src/ipc/shmctl.lo.go obj/src/ipc/shmdt.lo.go obj/src/ipc/shmget.lo.go obj/src/linux/adjtime.lo.go obj/src/linux/adjtimex.lo.go obj/src/linux/arch_prctl.lo.go obj/src/linux/brk.lo.go obj/src/linux/cache.lo.go obj/src/linux/cap.lo.go obj/src/linux/chroot.lo.go obj/src/linux/clock_adjtime.lo.go obj/src/linux/copy_file_range.lo.go obj/src/linux/epoll.lo.go obj/src/linux/eventfd.lo.go obj/src/linux/fallocate.lo.go obj/src/linux/fanotify.lo.go obj/src/linux/flock.lo.go obj/src/linux/getdents.lo.go obj/src/linux/getrandom.lo.go obj/src/linux/inotify.lo.go obj/src/linux/ioperm.lo.go obj/src/linux/iopl.lo.go obj/src/linux/klogctl.lo.go obj/src/linux/memfd_create.lo.go obj/src/linux/mlock2.lo.go obj/src/linux/module.lo.go obj/src/linux/mount.lo.go obj/src/linux/name_to_handle_at.lo.go obj/src/linux/open_by_handle_at.lo.go obj/src/linux/personality.lo.go obj/src/linux/pivot_root.lo.go obj/src/linux/prctl.lo.go obj/src/linux/preadv2.lo.go obj/src/linux/prlimit.lo.go obj/src/linux/process_vm.lo.go obj/src/linux/ptrace.lo.go obj/src/linux/pwritev2.lo.go obj/src/linux/quotactl.lo.go obj/src/linux/readahead.lo.go obj/src/linux/reboot.lo.go obj/src/linux/remap_file_pages.lo.go obj/src/linux/sbrk.lo.go obj/src/linux/sendfile.lo.go obj/src/linux/setfsgid.lo.go obj/src/linux/setfsuid.lo.go obj/src/linux/sethostname.lo.go obj/src/linux/setns.lo.go obj/src/linux/settimeofday.lo.go obj/src/linux/signalfd.lo.go obj/src/linux/splice.lo.go obj/src/linux/statx.lo.go obj/src/linux/stime.lo.go obj/src/linux/swap.lo.go obj/src/linux/sync_file_range.lo.go obj/src/linux/syncfs.lo.go obj/src/linux/sysinfo.lo.go obj/src/linux/tee.lo.go obj/src/linux/timerfd.lo.go obj/src/linux/unshare.lo.go obj/src/linux/utimes.lo.go obj/src/linux/vhangup.lo.go obj/src/linux/vmsplice.lo.go obj/src/linux/wait3.lo.go obj/src/linux/wait4.lo.go obj/src/linux/xattr.lo.go obj/src/locale/__lctrans.lo.go obj/src/locale/__mo_lookup.lo.go obj/src/locale/bind_textdomain_codeset.lo.go obj/src/locale/c_locale.lo.go obj/src/locale/catclose.lo.go obj/src/locale/catgets.lo.go obj/src/locale/catopen.lo.go obj/src/locale/dcngettext.lo.go obj/src/locale/duplocale.lo.go obj/src/locale/freelocale.lo.go obj/src/locale/iconv.lo.go obj/src/locale/iconv_close.lo.go obj/src/locale/langinfo.lo.go obj/src/locale/locale_map.lo.go obj/src/locale/localeconv.lo.go obj/src/locale/newlocale.lo.go obj/src/locale/pleval.lo.go obj/src/locale/setlocale.lo.go obj/src/locale/strcoll.lo.go obj/src/locale/strfmon.lo.go obj/src/locale/strtod_l.lo.go obj/src/locale/strxfrm.lo.go obj/src/locale/textdomain.lo.go obj/src/locale/uselocale.lo.go obj/src/locale/wcscoll.lo.go obj/src/locale/wcsxfrm.lo.go obj/src/malloc/reallocarray.lo.go obj/src/math/__cos.lo.go obj/src/math/__cosdf.lo.go obj/src/math/__cosl.lo.go obj/src/math/__expo2.lo.go obj/src/math/__expo2f.lo.go obj/src/math/__fpclassify.lo.go obj/src/math/__fpclassifyf.lo.go obj/src/math/__fpclassifyl.lo.go obj/src/math/__invtrigl.lo.go obj/src/math/__math_divzero.lo.go obj/src/math/__math_divzerof.lo.go obj/src/math/__math_invalid.lo.go obj/src/math/__math_invalidf.lo.go obj/src/math/__math_invalidl.lo.go obj/src/math/__math_oflow.lo.go obj/src/math/__math_oflowf.lo.go obj/src/math/__math_uflow.lo.go obj/src/math/__math_uflowf.lo.go obj/src/math/__math_xflow.lo.go obj/src/math/__math_xflowf.lo.go obj/src/math/__polevll.lo.go obj/src/math/__rem_pio2.lo.go obj/src/math/__rem_pio2_large.lo.go obj/src/math/__rem_pio2f.lo.go obj/src/math/__rem_pio2l.lo.go obj/src/math/__signbit.lo.go obj/src/math/__signbitf.lo.go obj/src/math/__signbitl.lo.go obj/src/math/__sin.lo.go obj/src/math/__sindf.lo.go obj/src/math/__sinl.lo.go obj/src/math/__tan.lo.go obj/src/math/__tandf.lo.go obj/src/math/__tanl.lo.go obj/src/math/acos.lo.go obj/src/math/acosf.lo.go obj/src/math/acosh.lo.go obj/src/math/acoshf.lo.go obj/src/math/acoshl.lo.go obj/src/math/acosl.lo.go obj/src/math/asin.lo.go obj/src/math/asinf.lo.go obj/src/math/asinh.lo.go obj/src/math/asinhf.lo.go obj/src/math/asinhl.lo.go obj/src/math/asinl.lo.go obj/src/math/atan.lo.go obj/src/math/atan2.lo.go obj/src/math/atan2f.lo.go obj/src/math/atan2l.lo.go obj/src/math/atanf.lo.go obj/src/math/atanh.lo.go obj/src/math/atanhf.lo.go obj/src/math/atanhl.lo.go obj/src/math/atanl.lo.go obj/src/math/cbrt.lo.go obj/src/math/cbrtf.lo.go obj/src/math/cbrtl.lo.go obj/src/math/ceil.lo.go obj/src/math/ceilf.lo.go obj/src/math/ceill.lo.go obj/src/math/copysign.lo.go obj/src/math/copysignf.lo.go obj/src/math/copysignl.lo.go obj/src/math/cos.lo.go obj/src/math/cosf.lo.go obj/src/math/cosh.lo.go obj/src/math/coshf.lo.go obj/src/math/coshl.lo.go obj/src/math/cosl.lo.go obj/src/math/erf.lo.go obj/src/math/erff.lo.go obj/src/math/erfl.lo.go obj/src/math/exp.lo.go obj/src/math/exp10.lo.go obj/src/math/exp10f.lo.go obj/src/math/exp10l.lo.go obj/src/math/exp2.lo.go obj/src/math/exp2f.lo.go obj/src/math/exp2f_data.lo.go obj/src/math/exp2l.lo.go obj/src/math/exp_data.lo.go obj/src/math/expf.lo.go obj/src/math/expl.lo.go obj/src/math/expm1.lo.go obj/src/math/expm1f.lo.go obj/src/math/expm1l.lo.go obj/src/math/fabs.lo.go obj/src/math/fabsf.lo.go obj/src/math/fabsl.lo.go obj/src/math/fdim.lo.go obj/src/math/fdimf.lo.go obj/src/math/fdiml.lo.go obj/src/math/finite.lo.go obj/src/math/finitef.lo.go obj/src/math/floor.lo.go obj/src/math/floorf.lo.go obj/src/math/floorl.lo.go obj/src/math/fma.lo.go obj/src/math/fmal.lo.go obj/src/math/fmax.lo.go obj/src/math/fmaxf.lo.go obj/src/math/fmaxl.lo.go obj/src/math/fmin.lo.go obj/src/math/fminf.lo.go obj/src/math/fminl.lo.go obj/src/math/fmod.lo.go obj/src/math/fmodf.lo.go obj/src/math/fmodl.lo.go obj/src/math/frexp.lo.go obj/src/math/frexpf.lo.go obj/src/math/frexpl.lo.go obj/src/math/hypot.lo.go obj/src/math/hypotf.lo.go obj/src/math/hypotl.lo.go obj/src/math/ilogb.lo.go obj/src/math/ilogbf.lo.go obj/src/math/ilogbl.lo.go obj/src/math/j0.lo.go obj/src/math/j0f.lo.go obj/src/math/j1.lo.go obj/src/math/j1f.lo.go obj/src/math/jn.lo.go obj/src/math/jnf.lo.go obj/src/math/ldexp.lo.go obj/src/math/ldexpf.lo.go obj/src/math/ldexpl.lo.go obj/src/math/lgamma.lo.go obj/src/math/lgamma_r.lo.go obj/src/math/lgammaf.lo.go obj/src/math/lgammaf_r.lo.go obj/src/math/lgammal.lo.go obj/src/math/llrint.lo.go obj/src/math/llrintf.lo.go obj/src/math/llrintl.lo.go obj/src/math/llround.lo.go obj/src/math/llroundf.lo.go obj/src/math/llroundl.lo.go obj/src/math/log.lo.go obj/src/math/log10.lo.go obj/src/math/log10f.lo.go obj/src/math/log10l.lo.go obj/src/math/log1p.lo.go obj/src/math/log1pf.lo.go obj/src/math/log1pl.lo.go obj/src/math/log2.lo.go obj/src/math/log2_data.lo.go obj/src/math/log2f.lo.go obj/src/math/log2f_data.lo.go obj/src/math/log2l.lo.go obj/src/math/log_data.lo.go obj/src/math/logb.lo.go obj/src/math/logbf.lo.go obj/src/math/logbl.lo.go obj/src/math/logf.lo.go obj/src/math/logf_data.lo.go obj/src/math/logl.lo.go obj/src/math/lrint.lo.go obj/src/math/lrintf.lo.go obj/src/math/lrintl.lo.go obj/src/math/lround.lo.go obj/src/math/lroundf.lo.go obj/src/math/lroundl.lo.go obj/src/math/modf.lo.go obj/src/math/modff.lo.go obj/src/math/modfl.lo.go obj/src/math/nan.lo.go obj/src/math/nanf.lo.go obj/src/math/nanl.lo.go obj/src/math/nextafter.lo.go obj/src/math/nextafterf.lo.go obj/src/math/nextafterl.lo.go obj/src/math/nexttoward.lo.go obj/src/math/nexttowardf.lo.go obj/src/math/nexttowardl.lo.go obj/src/math/pow.lo.go obj/src/math/pow_data.lo.go obj/src/math/powf.lo.go obj/src/math/powf_data.lo.go obj/src/math/powl.lo.go obj/src/math/remainder.lo.go obj/src/math/remainderf.lo.go obj/src/math/remainderl.lo.go obj/src/math/remquo.lo.go obj/src/math/remquof.lo.go obj/src/math/remquol.lo.go obj/src/math/rint.lo.go obj/src/math/rintf.lo.go obj/src/math/rintl.lo.go obj/src/math/round.lo.go obj/src/math/roundf.lo.go obj/src/math/roundl.lo.go obj/src/math/scalb.lo.go obj/src/math/scalbf.lo.go obj/src/math/scalbln.lo.go obj/src/math/scalblnf.lo.go obj/src/math/scalblnl.lo.go obj/src/math/scalbn.lo.go obj/src/math/scalbnf.lo.go obj/src/math/scalbnl.lo.go obj/src/math/signgam.lo.go obj/src/math/significand.lo.go obj/src/math/significandf.lo.go obj/src/math/sin.lo.go obj/src/math/sincos.lo.go obj/src/math/sincosf.lo.go obj/src/math/sincosl.lo.go obj/src/math/sinf.lo.go obj/src/math/sinh.lo.go obj/src/math/sinhf.lo.go obj/src/math/sinhl.lo.go obj/src/math/sinl.lo.go obj/src/math/sqrt.lo.go obj/src/math/sqrt_data.lo.go obj/src/math/sqrtf.lo.go obj/src/math/sqrtl.lo.go obj/src/math/tan.lo.go obj/src/math/tanf.lo.go obj/src/math/tanh.lo.go obj/src/math/tanhf.lo.go obj/src/math/tanhl.lo.go obj/src/math/tanl.lo.go obj/src/math/tgamma.lo.go obj/src/math/tgammaf.lo.go obj/src/math/tgammal.lo.go obj/src/math/trunc.lo.go obj/src/math/truncf.lo.go obj/src/math/truncl.lo.go obj/src/misc/a64l.lo.go obj/src/misc/basename.lo.go obj/src/misc/dirname.lo.go obj/src/misc/ffs.lo.go obj/src/misc/ffsl.lo.go obj/src/misc/ffsll.lo.go obj/src/misc/fmtmsg.lo.go obj/src/misc/get_current_dir_name.lo.go obj/src/misc/getauxval.lo.go obj/src/misc/getdomainname.lo.go obj/src/misc/getentropy.lo.go obj/src/misc/gethostid.lo.go obj/src/misc/getopt.lo.go obj/src/misc/getopt_long.lo.go obj/src/misc/getpriority.lo.go obj/src/misc/getresgid.lo.go obj/src/misc/getresuid.lo.go obj/src/misc/getrlimit.lo.go obj/src/misc/getrusage.lo.go obj/src/misc/getsubopt.lo.go obj/src/misc/ioctl.lo.go obj/src/misc/issetugid.lo.go obj/src/misc/lockf.lo.go obj/src/misc/login_tty.lo.go obj/src/misc/mntent.lo.go obj/src/misc/nftw.lo.go obj/src/misc/openpty.lo.go obj/src/misc/ptsname.lo.go obj/src/misc/pty.lo.go obj/src/misc/realpath.lo.go obj/src/misc/setdomainname.lo.go obj/src/misc/setpriority.lo.go obj/src/misc/setrlimit.lo.go obj/src/misc/syscall.lo.go obj/src/misc/syslog.lo.go obj/src/misc/uname.lo.go obj/src/mman/madvise.lo.go obj/src/mman/mincore.lo.go obj/src/mman/mlock.lo.go obj/src/mman/mlockall.lo.go obj/src/mman/mmap.lo.go obj/src/mman/mprotect.lo.go obj/src/mman/mremap.lo.go obj/src/mman/msync.lo.go obj/src/mman/munlock.lo.go obj/src/mman/munlockall.lo.go obj/src/mman/munmap.lo.go obj/src/mman/posix_madvise.lo.go obj/src/mman/shm_open.lo.go obj/src/multibyte/btowc.lo.go obj/src/multibyte/c16rtomb.lo.go obj/src/multibyte/c32rtomb.lo.go obj/src/multibyte/internal.lo.go obj/src/multibyte/mblen.lo.go obj/src/multibyte/mbrlen.lo.go obj/src/multibyte/mbrtoc16.lo.go obj/src/multibyte/mbrtoc32.lo.go obj/src/multibyte/mbrtowc.lo.go obj/src/multibyte/mbsinit.lo.go obj/src/multibyte/mbsnrtowcs.lo.go obj/src/multibyte/mbsrtowcs.lo.go obj/src/multibyte/mbstowcs.lo.go obj/src/multibyte/mbtowc.lo.go obj/src/multibyte/wcrtomb.lo.go obj/src/multibyte/wcsnrtombs.lo.go obj/src/multibyte/wcsrtombs.lo.go obj/src/multibyte/wcstombs.lo.go obj/src/multibyte/wctob.lo.go obj/src/multibyte/wctomb.lo.go obj/src/network/accept.lo.go obj/src/network/accept4.lo.go obj/src/network/bind.lo.go obj/src/network/connect.lo.go obj/src/network/dn_comp.lo.go obj/src/network/dn_expand.lo.go obj/src/network/dn_skipname.lo.go obj/src/network/dns_parse.lo.go obj/src/network/ent.lo.go obj/src/network/ether.lo.go obj/src/network/freeaddrinfo.lo.go obj/src/network/gai_strerror.lo.go obj/src/network/getaddrinfo.lo.go obj/src/network/gethostbyaddr.lo.go obj/src/network/gethostbyaddr_r.lo.go obj/src/network/gethostbyname.lo.go obj/src/network/gethostbyname2.lo.go obj/src/network/gethostbyname2_r.lo.go obj/src/network/gethostbyname_r.lo.go obj/src/network/getifaddrs.lo.go obj/src/network/getnameinfo.lo.go obj/src/network/getpeername.lo.go obj/src/network/getservbyname.lo.go obj/src/network/getservbyname_r.lo.go obj/src/network/getsockname.lo.go obj/src/network/getsockopt.lo.go obj/src/network/h_errno.lo.go obj/src/network/herror.lo.go obj/src/network/hstrerror.lo.go obj/src/network/htonl.lo.go obj/src/network/htons.lo.go obj/src/network/if_freenameindex.lo.go obj/src/network/if_indextoname.lo.go obj/src/network/if_nameindex.lo.go obj/src/network/if_nametoindex.lo.go obj/src/network/in6addr_any.lo.go obj/src/network/in6addr_loopback.lo.go obj/src/network/inet_addr.lo.go obj/src/network/inet_aton.lo.go obj/src/network/inet_legacy.lo.go obj/src/network/inet_ntoa.lo.go obj/src/network/inet_ntop.lo.go obj/src/network/inet_pton.lo.go obj/src/network/listen.lo.go obj/src/network/lookup_ipliteral.lo.go obj/src/network/lookup_name.lo.go obj/src/network/lookup_serv.lo.go obj/src/network/netlink.lo.go obj/src/network/netname.lo.go obj/src/network/ns_parse.lo.go obj/src/network/ntohl.lo.go obj/src/network/ntohs.lo.go obj/src/network/proto.lo.go obj/src/network/recv.lo.go obj/src/network/recvfrom.lo.go obj/src/network/recvmmsg.lo.go obj/src/network/recvmsg.lo.go obj/src/network/res_init.lo.go obj/src/network/res_mkquery.lo.go obj/src/network/res_msend.lo.go obj/src/network/res_send.lo.go obj/src/network/res_state.lo.go obj/src/network/resolvconf.lo.go obj/src/network/send.lo.go obj/src/network/sendmmsg.lo.go obj/src/network/sendmsg.lo.go obj/src/network/sendto.lo.go obj/src/network/serv.lo.go obj/src/network/setsockopt.lo.go obj/src/network/shutdown.lo.go obj/src/network/sockatmark.lo.go obj/src/network/socket.lo.go obj/src/network/socketpair.lo.go obj/src/passwd/fgetgrent.lo.go obj/src/passwd/fgetpwent.lo.go obj/src/passwd/getgr_a.lo.go obj/src/passwd/getgr_r.lo.go obj/src/passwd/getgrent.lo.go obj/src/passwd/getgrent_a.lo.go obj/src/passwd/getgrouplist.lo.go obj/src/passwd/getpw_a.lo.go obj/src/passwd/getpw_r.lo.go obj/src/passwd/getpwent.lo.go obj/src/passwd/getpwent_a.lo.go obj/src/passwd/getspent.lo.go obj/src/passwd/lckpwdf.lo.go obj/src/passwd/nscd_query.lo.go obj/src/passwd/putgrent.lo.go obj/src/passwd/putpwent.lo.go obj/src/passwd/putspent.lo.go obj/src/prng/__rand48_step.lo.go obj/src/prng/__seed48.lo.go obj/src/prng/drand48.lo.go obj/src/prng/lcong48.lo.go obj/src/prng/lrand48.lo.go obj/src/prng/mrand48.lo.go obj/src/prng/rand.lo.go obj/src/prng/rand_r.lo.go obj/src/prng/random.lo.go obj/src/prng/seed48.lo.go obj/src/prng/srand48.lo.go obj/src/process/execl.lo.go obj/src/process/execle.lo.go obj/src/process/execlp.lo.go obj/src/process/execv.lo.go obj/src/process/execve.lo.go obj/src/process/execvp.lo.go obj/src/process/fexecve.lo.go obj/src/process/fork.lo.go obj/src/process/posix_spawn_file_actions_addchdir.lo.go obj/src/process/posix_spawn_file_actions_addclose.lo.go obj/src/process/posix_spawn_file_actions_adddup2.lo.go obj/src/process/posix_spawn_file_actions_addfchdir.lo.go obj/src/process/posix_spawn_file_actions_addopen.lo.go obj/src/process/posix_spawn_file_actions_destroy.lo.go obj/src/process/posix_spawn_file_actions_init.lo.go obj/src/process/posix_spawnattr_destroy.lo.go obj/src/process/posix_spawnattr_getflags.lo.go obj/src/process/posix_spawnattr_getpgroup.lo.go obj/src/process/posix_spawnattr_getsigdefault.lo.go obj/src/process/posix_spawnattr_getsigmask.lo.go obj/src/process/posix_spawnattr_init.lo.go obj/src/process/posix_spawnattr_sched.lo.go obj/src/process/posix_spawnattr_setflags.lo.go obj/src/process/posix_spawnattr_setpgroup.lo.go obj/src/process/posix_spawnattr_setsigdefault.lo.go obj/src/process/posix_spawnattr_setsigmask.lo.go obj/src/process/vfork.lo.go obj/src/process/wait.lo.go obj/src/process/waitid.lo.go obj/src/process/waitpid.lo.go obj/src/regex/fnmatch.lo.go obj/src/regex/glob.lo.go obj/src/regex/regcomp.lo.go obj/src/regex/regerror.lo.go obj/src/regex/regexec.lo.go obj/src/regex/tre-mem.lo.go obj/src/search/hsearch.lo.go obj/src/search/insque.lo.go obj/src/search/lsearch.lo.go obj/src/search/tdelete.lo.go obj/src/search/tdestroy.lo.go obj/src/search/tfind.lo.go obj/src/search/tsearch.lo.go obj/src/search/twalk.lo.go obj/src/select/poll.lo.go obj/src/select/ppoll.lo.go obj/src/select/pselect.lo.go obj/src/select/select.lo.go obj/src/signal/block.lo.go obj/src/signal/getitimer.lo.go obj/src/signal/kill.lo.go obj/src/signal/killpg.lo.go obj/src/signal/psiginfo.lo.go obj/src/signal/psignal.lo.go obj/src/signal/raise.lo.go obj/src/signal/restore.lo.go obj/src/signal/setitimer.lo.go obj/src/signal/sigaction.lo.go obj/src/signal/sigaddset.lo.go obj/src/signal/sigaltstack.lo.go obj/src/signal/sigandset.lo.go obj/src/signal/sigdelset.lo.go obj/src/signal/sigemptyset.lo.go obj/src/signal/sigfillset.lo.go obj/src/signal/sigisemptyset.lo.go obj/src/signal/sigismember.lo.go obj/src/signal/sigorset.lo.go obj/src/signal/sigpending.lo.go obj/src/signal/sigprocmask.lo.go obj/src/signal/sigqueue.lo.go obj/src/signal/sigrtmax.lo.go obj/src/signal/sigrtmin.lo.go obj/src/signal/sigsetjmp.lo.go obj/src/signal/sigsetjmp_tail.lo.go obj/src/signal/sigsuspend.lo.go obj/src/signal/sigtimedwait.lo.go obj/src/signal/sigwait.lo.go obj/src/signal/sigwaitinfo.lo.go obj/src/stat/__xstat.lo.go obj/src/stat/chmod.lo.go obj/src/stat/fchmod.lo.go obj/src/stat/fchmodat.lo.go obj/src/stat/fstat.lo.go obj/src/stat/fstatat.lo.go obj/src/stat/futimens.lo.go obj/src/stat/futimesat.lo.go obj/src/stat/lchmod.lo.go obj/src/stat/lstat.lo.go obj/src/stat/mkdir.lo.go obj/src/stat/mkdirat.lo.go obj/src/stat/mkfifo.lo.go obj/src/stat/mkfifoat.lo.go obj/src/stat/mknod.lo.go obj/src/stat/mknodat.lo.go obj/src/stat/stat.lo.go obj/src/stat/statvfs.lo.go obj/src/stat/umask.lo.go obj/src/stat/utimensat.lo.go obj/src/stdio/__fclose_ca.lo.go obj/src/stdio/__fdopen.lo.go obj/src/stdio/__fmodeflags.lo.go obj/src/stdio/__fopen_rb_ca.lo.go obj/src/stdio/__overflow.lo.go obj/src/stdio/__stdio_close.lo.go obj/src/stdio/__stdio_exit.lo.go obj/src/stdio/__stdio_read.lo.go obj/src/stdio/__stdio_seek.lo.go obj/src/stdio/__stdio_write.lo.go obj/src/stdio/__stdout_write.lo.go obj/src/stdio/__toread.lo.go obj/src/stdio/__towrite.lo.go obj/src/stdio/__uflow.lo.go obj/src/stdio/asprintf.lo.go obj/src/stdio/clearerr.lo.go obj/src/stdio/dprintf.lo.go obj/src/stdio/ext.lo.go obj/src/stdio/ext2.lo.go obj/src/stdio/fclose.lo.go obj/src/stdio/feof.lo.go obj/src/stdio/ferror.lo.go obj/src/stdio/fflush.lo.go obj/src/stdio/fgetc.lo.go obj/src/stdio/fgetln.lo.go obj/src/stdio/fgetpos.lo.go obj/src/stdio/fgets.lo.go obj/src/stdio/fgetwc.lo.go obj/src/stdio/fgetws.lo.go obj/src/stdio/fileno.lo.go obj/src/stdio/flockfile.lo.go obj/src/stdio/fmemopen.lo.go obj/src/stdio/fopen.lo.go obj/src/stdio/fopencookie.lo.go obj/src/stdio/fprintf.lo.go obj/src/stdio/fputc.lo.go obj/src/stdio/fputs.lo.go obj/src/stdio/fputwc.lo.go obj/src/stdio/fputws.lo.go obj/src/stdio/fread.lo.go obj/src/stdio/freopen.lo.go obj/src/stdio/fscanf.lo.go obj/src/stdio/fseek.lo.go obj/src/stdio/fsetpos.lo.go obj/src/stdio/ftell.lo.go obj/src/stdio/ftrylockfile.lo.go obj/src/stdio/funlockfile.lo.go obj/src/stdio/fwide.lo.go obj/src/stdio/fwprintf.lo.go obj/src/stdio/fwrite.lo.go obj/src/stdio/fwscanf.lo.go obj/src/stdio/getc.lo.go obj/src/stdio/getc_unlocked.lo.go obj/src/stdio/getchar.lo.go obj/src/stdio/getchar_unlocked.lo.go obj/src/stdio/getdelim.lo.go obj/src/stdio/getline.lo.go obj/src/stdio/gets.lo.go obj/src/stdio/getw.lo.go obj/src/stdio/getwc.lo.go obj/src/stdio/getwchar.lo.go obj/src/stdio/ofl.lo.go obj/src/stdio/ofl_add.lo.go obj/src/stdio/open_memstream.lo.go obj/src/stdio/open_wmemstream.lo.go obj/src/stdio/pclose.lo.go obj/src/stdio/perror.lo.go obj/src/stdio/printf.lo.go obj/src/stdio/putc.lo.go obj/src/stdio/putc_unlocked.lo.go obj/src/stdio/putchar.lo.go obj/src/stdio/putchar_unlocked.lo.go obj/src/stdio/puts.lo.go obj/src/stdio/putw.lo.go obj/src/stdio/putwc.lo.go obj/src/stdio/putwchar.lo.go obj/src/stdio/remove.lo.go obj/src/stdio/rename.lo.go obj/src/stdio/rewind.lo.go obj/src/stdio/scanf.lo.go obj/src/stdio/setbuf.lo.go obj/src/stdio/setbuffer.lo.go obj/src/stdio/setlinebuf.lo.go obj/src/stdio/setvbuf.lo.go obj/src/stdio/snprintf.lo.go obj/src/stdio/sprintf.lo.go obj/src/stdio/sscanf.lo.go obj/src/stdio/stderr.lo.go obj/src/stdio/stdin.lo.go obj/src/stdio/stdout.lo.go obj/src/stdio/swprintf.lo.go obj/src/stdio/swscanf.lo.go obj/src/stdio/tempnam.lo.go obj/src/stdio/tmpfile.lo.go obj/src/stdio/tmpnam.lo.go obj/src/stdio/ungetc.lo.go obj/src/stdio/ungetwc.lo.go obj/src/stdio/vasprintf.lo.go obj/src/stdio/vdprintf.lo.go obj/src/stdio/vfprintf.lo.go obj/src/stdio/vfscanf.lo.go obj/src/stdio/vfwprintf.lo.go obj/src/stdio/vfwscanf.lo.go obj/src/stdio/vprintf.lo.go obj/src/stdio/vscanf.lo.go obj/src/stdio/vsnprintf.lo.go obj/src/stdio/vsprintf.lo.go obj/src/stdio/vsscanf.lo.go obj/src/stdio/vswprintf.lo.go obj/src/stdio/vswscanf.lo.go obj/src/stdio/vwprintf.lo.go obj/src/stdio/vwscanf.lo.go obj/src/stdio/wprintf.lo.go obj/src/stdio/wscanf.lo.go obj/src/stdlib/abs.lo.go obj/src/stdlib/atof.lo.go obj/src/stdlib/atoi.lo.go obj/src/stdlib/atol.lo.go obj/src/stdlib/atoll.lo.go obj/src/stdlib/bsearch.lo.go obj/src/stdlib/div.lo.go obj/src/stdlib/ecvt.lo.go obj/src/stdlib/fcvt.lo.go obj/src/stdlib/gcvt.lo.go obj/src/stdlib/imaxabs.lo.go obj/src/stdlib/imaxdiv.lo.go obj/src/stdlib/labs.lo.go obj/src/stdlib/ldiv.lo.go obj/src/stdlib/llabs.lo.go obj/src/stdlib/lldiv.lo.go obj/src/stdlib/qsort.lo.go obj/src/stdlib/qsort_nr.lo.go obj/src/stdlib/strtod.lo.go obj/src/stdlib/strtol.lo.go obj/src/stdlib/wcstod.lo.go obj/src/stdlib/wcstol.lo.go obj/src/string/bcmp.lo.go obj/src/string/bcopy.lo.go obj/src/string/bzero.lo.go obj/src/string/explicit_bzero.lo.go obj/src/string/index.lo.go obj/src/string/memccpy.lo.go obj/src/string/memchr.lo.go obj/src/string/memcmp.lo.go obj/src/string/memcpy.lo.go obj/src/string/memmem.lo.go obj/src/string/memmove.lo.go obj/src/string/mempcpy.lo.go obj/src/string/memrchr.lo.go obj/src/string/memset.lo.go obj/src/string/rindex.lo.go obj/src/string/stpcpy.lo.go obj/src/string/stpncpy.lo.go obj/src/string/strcasecmp.lo.go obj/src/string/strcasestr.lo.go obj/src/string/strcat.lo.go obj/src/string/strchr.lo.go obj/src/string/strchrnul.lo.go obj/src/string/strcmp.lo.go obj/src/string/strcpy.lo.go obj/src/string/strcspn.lo.go obj/src/string/strdup.lo.go obj/src/string/strerror_r.lo.go obj/src/string/strlcat.lo.go obj/src/string/strlcpy.lo.go obj/src/string/strlen.lo.go obj/src/string/strncasecmp.lo.go obj/src/string/strncat.lo.go obj/src/string/strncmp.lo.go obj/src/string/strncpy.lo.go obj/src/string/strndup.lo.go obj/src/string/strnlen.lo.go obj/src/string/strpbrk.lo.go obj/src/string/strrchr.lo.go obj/src/string/strsep.lo.go obj/src/string/strsignal.lo.go obj/src/string/strspn.lo.go obj/src/string/strstr.lo.go obj/src/string/strtok.lo.go obj/src/string/strtok_r.lo.go obj/src/string/strverscmp.lo.go obj/src/string/swab.lo.go obj/src/string/wcpcpy.lo.go obj/src/string/wcpncpy.lo.go obj/src/string/wcscasecmp.lo.go obj/src/string/wcscasecmp_l.lo.go obj/src/string/wcscat.lo.go obj/src/string/wcschr.lo.go obj/src/string/wcscmp.lo.go obj/src/string/wcscpy.lo.go obj/src/string/wcscspn.lo.go obj/src/string/wcsdup.lo.go obj/src/string/wcslen.lo.go obj/src/string/wcsncasecmp.lo.go obj/src/string/wcsncasecmp_l.lo.go obj/src/string/wcsncat.lo.go obj/src/string/wcsncmp.lo.go obj/src/string/wcsncpy.lo.go obj/src/string/wcsnlen.lo.go obj/src/string/wcspbrk.lo.go obj/src/string/wcsrchr.lo.go obj/src/string/wcsspn.lo.go obj/src/string/wcsstr.lo.go obj/src/string/wcstok.lo.go obj/src/string/wcswcs.lo.go obj/src/string/wmemchr.lo.go obj/src/string/wmemcmp.lo.go obj/src/string/wmemcpy.lo.go obj/src/string/wmemmove.lo.go obj/src/string/wmemset.lo.go obj/src/temp/mkdtemp.lo.go obj/src/temp/mkostemp.lo.go obj/src/temp/mkostemps.lo.go obj/src/temp/mkstemp.lo.go obj/src/temp/mkstemps.lo.go obj/src/temp/mktemp.lo.go obj/src/termios/cfgetospeed.lo.go obj/src/termios/cfmakeraw.lo.go obj/src/termios/cfsetospeed.lo.go obj/src/termios/tcdrain.lo.go obj/src/termios/tcflow.lo.go obj/src/termios/tcflush.lo.go obj/src/termios/tcgetattr.lo.go obj/src/termios/tcgetsid.lo.go obj/src/termios/tcgetwinsize.lo.go obj/src/termios/tcsendbreak.lo.go obj/src/termios/tcsetattr.lo.go obj/src/termios/tcsetwinsize.lo.go obj/src/time/__map_file.lo.go obj/src/time/__month_to_secs.lo.go obj/src/time/__secs_to_tm.lo.go obj/src/time/__tm_to_secs.lo.go obj/src/time/__tz.lo.go obj/src/time/__year_to_secs.lo.go obj/src/time/asctime.lo.go obj/src/time/asctime_r.lo.go obj/src/time/clock.lo.go obj/src/time/clock_getcpuclockid.lo.go obj/src/time/clock_getres.lo.go obj/src/time/clock_gettime.lo.go obj/src/time/clock_nanosleep.lo.go obj/src/time/clock_settime.lo.go obj/src/time/ctime.lo.go obj/src/time/ctime_r.lo.go obj/src/time/difftime.lo.go obj/src/time/ftime.lo.go obj/src/time/getdate.lo.go obj/src/time/gettimeofday.lo.go obj/src/time/gmtime.lo.go obj/src/time/gmtime_r.lo.go obj/src/time/localtime.lo.go obj/src/time/localtime_r.lo.go obj/src/time/mktime.lo.go obj/src/time/nanosleep.lo.go obj/src/time/strftime.lo.go obj/src/time/strptime.lo.go obj/src/time/time.lo.go obj/src/time/timegm.lo.go obj/src/time/timer_delete.lo.go obj/src/time/timer_getoverrun.lo.go obj/src/time/timer_gettime.lo.go obj/src/time/timer_settime.lo.go obj/src/time/times.lo.go obj/src/time/timespec_get.lo.go obj/src/time/utime.lo.go obj/src/time/wcsftime.lo.go obj/src/unistd/_exit.lo.go obj/src/unistd/access.lo.go obj/src/unistd/acct.lo.go obj/src/unistd/alarm.lo.go obj/src/unistd/chdir.lo.go obj/src/unistd/chown.lo.go obj/src/unistd/close.lo.go obj/src/unistd/ctermid.lo.go obj/src/unistd/dup.lo.go obj/src/unistd/dup2.lo.go obj/src/unistd/dup3.lo.go obj/src/unistd/faccessat.lo.go obj/src/unistd/fchdir.lo.go obj/src/unistd/fchown.lo.go obj/src/unistd/fchownat.lo.go obj/src/unistd/fdatasync.lo.go obj/src/unistd/fsync.lo.go obj/src/unistd/ftruncate.lo.go obj/src/unistd/getcwd.lo.go obj/src/unistd/getegid.lo.go obj/src/unistd/geteuid.lo.go obj/src/unistd/getgid.lo.go obj/src/unistd/getgroups.lo.go obj/src/unistd/gethostname.lo.go obj/src/unistd/getlogin.lo.go obj/src/unistd/getlogin_r.lo.go obj/src/unistd/getpgid.lo.go obj/src/unistd/getpgrp.lo.go obj/src/unistd/getpid.lo.go obj/src/unistd/getppid.lo.go obj/src/unistd/getsid.lo.go obj/src/unistd/getuid.lo.go obj/src/unistd/isatty.lo.go obj/src/unistd/lchown.lo.go obj/src/unistd/link.lo.go obj/src/unistd/linkat.lo.go obj/src/unistd/lseek.lo.go obj/src/unistd/nice.lo.go obj/src/unistd/pause.lo.go obj/src/unistd/pipe.lo.go obj/src/unistd/pipe2.lo.go obj/src/unistd/posix_close.lo.go obj/src/unistd/pread.lo.go obj/src/unistd/preadv.lo.go obj/src/unistd/pwrite.lo.go obj/src/unistd/pwritev.lo.go obj/src/unistd/read.lo.go obj/src/unistd/readlink.lo.go obj/src/unistd/readlinkat.lo.go obj/src/unistd/readv.lo.go obj/src/unistd/renameat.lo.go obj/src/unistd/rmdir.lo.go obj/src/unistd/setgid.lo.go obj/src/unistd/setpgid.lo.go obj/src/unistd/setpgrp.lo.go obj/src/unistd/setsid.lo.go obj/src/unistd/setuid.lo.go obj/src/unistd/setxid.lo.go obj/src/unistd/sleep.lo.go obj/src/unistd/symlink.lo.go obj/src/unistd/symlinkat.lo.go obj/src/unistd/sync.lo.go obj/src/unistd/tcgetpgrp.lo.go obj/src/unistd/tcsetpgrp.lo.go obj/src/unistd/truncate.lo.go obj/src/unistd/ttyname.lo.go obj/src/unistd/ttyname_r.lo.go obj/src/unistd/ualarm.lo.go obj/src/unistd/unlink.lo.go obj/src/unistd/unlinkat.lo.go obj/src/unistd/usleep.lo.go obj/src/unistd/write.lo.go obj/src/unistd/writev.lo.go -lgcc -lgcc_eh', DO NOT EDIT. +// Code generated for linux/loong64 by 'gcc --package-name=libc --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -emit-func-aliases -eval-all-macros -extended-errors -ignore-asm-errors -isystem -std=c99 -nostdinc -ffreestanding -D_XOPEN_SOURCE=700 -I./arch/loongarch64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -DNDEBUG -nostdlib -shared -o lib/libc.so.go obj/src/complex/__cexp.lo.go obj/src/complex/__cexpf.lo.go obj/src/complex/cabs.lo.go obj/src/complex/cabsf.lo.go obj/src/complex/cabsl.lo.go obj/src/complex/cacos.lo.go obj/src/complex/cacosf.lo.go obj/src/complex/cacosh.lo.go obj/src/complex/cacoshf.lo.go obj/src/complex/cacoshl.lo.go obj/src/complex/cacosl.lo.go obj/src/complex/carg.lo.go obj/src/complex/cargf.lo.go obj/src/complex/cargl.lo.go obj/src/complex/casin.lo.go obj/src/complex/casinf.lo.go obj/src/complex/casinh.lo.go obj/src/complex/casinhf.lo.go obj/src/complex/casinhl.lo.go obj/src/complex/casinl.lo.go obj/src/complex/catan.lo.go obj/src/complex/catanf.lo.go obj/src/complex/catanh.lo.go obj/src/complex/catanhf.lo.go obj/src/complex/catanhl.lo.go obj/src/complex/catanl.lo.go obj/src/complex/ccos.lo.go obj/src/complex/ccosf.lo.go obj/src/complex/ccosh.lo.go obj/src/complex/ccoshf.lo.go obj/src/complex/ccoshl.lo.go obj/src/complex/ccosl.lo.go obj/src/complex/cexp.lo.go obj/src/complex/cexpf.lo.go obj/src/complex/cexpl.lo.go obj/src/complex/cimag.lo.go obj/src/complex/cimagf.lo.go obj/src/complex/cimagl.lo.go obj/src/complex/clog.lo.go obj/src/complex/clogf.lo.go obj/src/complex/clogl.lo.go obj/src/complex/conj.lo.go obj/src/complex/conjf.lo.go obj/src/complex/conjl.lo.go obj/src/complex/cpow.lo.go obj/src/complex/cpowf.lo.go obj/src/complex/cpowl.lo.go obj/src/complex/cproj.lo.go obj/src/complex/cprojf.lo.go obj/src/complex/cprojl.lo.go obj/src/complex/creal.lo.go obj/src/complex/crealf.lo.go obj/src/complex/creall.lo.go obj/src/complex/csin.lo.go obj/src/complex/csinf.lo.go obj/src/complex/csinh.lo.go obj/src/complex/csinhf.lo.go obj/src/complex/csinhl.lo.go obj/src/complex/csinl.lo.go obj/src/complex/csqrt.lo.go obj/src/complex/csqrtf.lo.go obj/src/complex/csqrtl.lo.go obj/src/complex/ctan.lo.go obj/src/complex/ctanf.lo.go obj/src/complex/ctanh.lo.go obj/src/complex/ctanhf.lo.go obj/src/complex/ctanhl.lo.go obj/src/complex/ctanl.lo.go obj/src/conf/confstr.lo.go obj/src/conf/fpathconf.lo.go obj/src/conf/legacy.lo.go obj/src/conf/pathconf.lo.go obj/src/conf/sysconf.lo.go obj/src/crypt/crypt.lo.go obj/src/crypt/crypt_blowfish.lo.go obj/src/crypt/crypt_des.lo.go obj/src/crypt/crypt_md5.lo.go obj/src/crypt/crypt_r.lo.go obj/src/crypt/crypt_sha256.lo.go obj/src/crypt/crypt_sha512.lo.go obj/src/crypt/encrypt.lo.go obj/src/ctype/__ctype_b_loc.lo.go obj/src/ctype/__ctype_get_mb_cur_max.lo.go obj/src/ctype/__ctype_tolower_loc.lo.go obj/src/ctype/__ctype_toupper_loc.lo.go obj/src/ctype/isalnum.lo.go obj/src/ctype/isalpha.lo.go obj/src/ctype/isascii.lo.go obj/src/ctype/isblank.lo.go obj/src/ctype/iscntrl.lo.go obj/src/ctype/isdigit.lo.go obj/src/ctype/isgraph.lo.go obj/src/ctype/islower.lo.go obj/src/ctype/isprint.lo.go obj/src/ctype/ispunct.lo.go obj/src/ctype/isspace.lo.go obj/src/ctype/isupper.lo.go obj/src/ctype/iswalnum.lo.go obj/src/ctype/iswalpha.lo.go obj/src/ctype/iswblank.lo.go obj/src/ctype/iswcntrl.lo.go obj/src/ctype/iswctype.lo.go obj/src/ctype/iswdigit.lo.go obj/src/ctype/iswgraph.lo.go obj/src/ctype/iswlower.lo.go obj/src/ctype/iswprint.lo.go obj/src/ctype/iswpunct.lo.go obj/src/ctype/iswspace.lo.go obj/src/ctype/iswupper.lo.go obj/src/ctype/iswxdigit.lo.go obj/src/ctype/isxdigit.lo.go obj/src/ctype/toascii.lo.go obj/src/ctype/tolower.lo.go obj/src/ctype/toupper.lo.go obj/src/ctype/towctrans.lo.go obj/src/ctype/wcswidth.lo.go obj/src/ctype/wctrans.lo.go obj/src/ctype/wcwidth.lo.go obj/src/dirent/alphasort.lo.go obj/src/dirent/closedir.lo.go obj/src/dirent/dirfd.lo.go obj/src/dirent/fdopendir.lo.go obj/src/dirent/opendir.lo.go obj/src/dirent/readdir.lo.go obj/src/dirent/readdir_r.lo.go obj/src/dirent/rewinddir.lo.go obj/src/dirent/scandir.lo.go obj/src/dirent/seekdir.lo.go obj/src/dirent/telldir.lo.go obj/src/dirent/versionsort.lo.go obj/src/env/__environ.lo.go obj/src/env/__reset_tls.lo.go obj/src/env/__stack_chk_fail.lo.go obj/src/env/clearenv.lo.go obj/src/env/getenv.lo.go obj/src/env/putenv.lo.go obj/src/env/secure_getenv.lo.go obj/src/env/setenv.lo.go obj/src/env/unsetenv.lo.go obj/src/errno/strerror.lo.go obj/src/exit/_Exit.lo.go obj/src/exit/abort_lock.lo.go obj/src/exit/assert.lo.go obj/src/exit/at_quick_exit.lo.go obj/src/exit/quick_exit.lo.go obj/src/fcntl/creat.lo.go obj/src/fcntl/fcntl.lo.go obj/src/fcntl/open.lo.go obj/src/fcntl/openat.lo.go obj/src/fcntl/posix_fadvise.lo.go obj/src/fcntl/posix_fallocate.lo.go obj/src/internal/defsysinfo.lo.go obj/src/internal/emulate_wait4.lo.go obj/src/internal/floatscan.lo.go obj/src/internal/intscan.lo.go obj/src/internal/libc.lo.go obj/src/internal/procfdname.lo.go obj/src/internal/shgetc.lo.go obj/src/internal/syscall_ret.lo.go obj/src/internal/vdso.lo.go obj/src/internal/version.lo.go obj/src/ipc/ftok.lo.go obj/src/ipc/msgctl.lo.go obj/src/ipc/msgget.lo.go obj/src/ipc/msgrcv.lo.go obj/src/ipc/msgsnd.lo.go obj/src/ipc/semctl.lo.go obj/src/ipc/semget.lo.go obj/src/ipc/semop.lo.go obj/src/ipc/semtimedop.lo.go obj/src/ipc/shmat.lo.go obj/src/ipc/shmctl.lo.go obj/src/ipc/shmdt.lo.go obj/src/ipc/shmget.lo.go obj/src/legacy/cuserid.lo.go obj/src/legacy/err.lo.go obj/src/legacy/euidaccess.lo.go obj/src/legacy/ftw.lo.go obj/src/legacy/futimes.lo.go obj/src/legacy/getdtablesize.lo.go obj/src/legacy/getloadavg.lo.go obj/src/legacy/getpagesize.lo.go obj/src/legacy/getpass.lo.go obj/src/legacy/getusershell.lo.go obj/src/legacy/isastream.lo.go obj/src/legacy/lutimes.lo.go obj/src/legacy/ulimit.lo.go obj/src/legacy/utmpx.lo.go obj/src/linux/adjtime.lo.go obj/src/linux/adjtimex.lo.go obj/src/linux/arch_prctl.lo.go obj/src/linux/brk.lo.go obj/src/linux/cache.lo.go obj/src/linux/cap.lo.go obj/src/linux/chroot.lo.go obj/src/linux/clock_adjtime.lo.go obj/src/linux/copy_file_range.lo.go obj/src/linux/epoll.lo.go obj/src/linux/eventfd.lo.go obj/src/linux/fallocate.lo.go obj/src/linux/fanotify.lo.go obj/src/linux/flock.lo.go obj/src/linux/getdents.lo.go obj/src/linux/getrandom.lo.go obj/src/linux/inotify.lo.go obj/src/linux/ioperm.lo.go obj/src/linux/iopl.lo.go obj/src/linux/klogctl.lo.go obj/src/linux/memfd_create.lo.go obj/src/linux/mlock2.lo.go obj/src/linux/module.lo.go obj/src/linux/mount.lo.go obj/src/linux/name_to_handle_at.lo.go obj/src/linux/open_by_handle_at.lo.go obj/src/linux/personality.lo.go obj/src/linux/pivot_root.lo.go obj/src/linux/prctl.lo.go obj/src/linux/preadv2.lo.go obj/src/linux/prlimit.lo.go obj/src/linux/process_vm.lo.go obj/src/linux/ptrace.lo.go obj/src/linux/pwritev2.lo.go obj/src/linux/quotactl.lo.go obj/src/linux/readahead.lo.go obj/src/linux/reboot.lo.go obj/src/linux/remap_file_pages.lo.go obj/src/linux/sbrk.lo.go obj/src/linux/sendfile.lo.go obj/src/linux/setfsgid.lo.go obj/src/linux/setfsuid.lo.go obj/src/linux/sethostname.lo.go obj/src/linux/setns.lo.go obj/src/linux/settimeofday.lo.go obj/src/linux/signalfd.lo.go obj/src/linux/splice.lo.go obj/src/linux/statx.lo.go obj/src/linux/stime.lo.go obj/src/linux/swap.lo.go obj/src/linux/sync_file_range.lo.go obj/src/linux/syncfs.lo.go obj/src/linux/sysinfo.lo.go obj/src/linux/tee.lo.go obj/src/linux/timerfd.lo.go obj/src/linux/unshare.lo.go obj/src/linux/utimes.lo.go obj/src/linux/vhangup.lo.go obj/src/linux/vmsplice.lo.go obj/src/linux/wait3.lo.go obj/src/linux/wait4.lo.go obj/src/linux/xattr.lo.go obj/src/locale/__lctrans.lo.go obj/src/locale/__mo_lookup.lo.go obj/src/locale/bind_textdomain_codeset.lo.go obj/src/locale/c_locale.lo.go obj/src/locale/catclose.lo.go obj/src/locale/catgets.lo.go obj/src/locale/catopen.lo.go obj/src/locale/dcngettext.lo.go obj/src/locale/duplocale.lo.go obj/src/locale/freelocale.lo.go obj/src/locale/iconv.lo.go obj/src/locale/iconv_close.lo.go obj/src/locale/langinfo.lo.go obj/src/locale/locale_map.lo.go obj/src/locale/localeconv.lo.go obj/src/locale/newlocale.lo.go obj/src/locale/pleval.lo.go obj/src/locale/setlocale.lo.go obj/src/locale/strcoll.lo.go obj/src/locale/strfmon.lo.go obj/src/locale/strtod_l.lo.go obj/src/locale/strxfrm.lo.go obj/src/locale/textdomain.lo.go obj/src/locale/uselocale.lo.go obj/src/locale/wcscoll.lo.go obj/src/locale/wcsxfrm.lo.go obj/src/malloc/reallocarray.lo.go obj/src/math/__cos.lo.go obj/src/math/__cosdf.lo.go obj/src/math/__cosl.lo.go obj/src/math/__expo2.lo.go obj/src/math/__expo2f.lo.go obj/src/math/__fpclassify.lo.go obj/src/math/__fpclassifyf.lo.go obj/src/math/__fpclassifyl.lo.go obj/src/math/__invtrigl.lo.go obj/src/math/__math_divzero.lo.go obj/src/math/__math_divzerof.lo.go obj/src/math/__math_invalid.lo.go obj/src/math/__math_invalidf.lo.go obj/src/math/__math_invalidl.lo.go obj/src/math/__math_oflow.lo.go obj/src/math/__math_oflowf.lo.go obj/src/math/__math_uflow.lo.go obj/src/math/__math_uflowf.lo.go obj/src/math/__math_xflow.lo.go obj/src/math/__math_xflowf.lo.go obj/src/math/__polevll.lo.go obj/src/math/__rem_pio2.lo.go obj/src/math/__rem_pio2_large.lo.go obj/src/math/__rem_pio2f.lo.go obj/src/math/__rem_pio2l.lo.go obj/src/math/__signbit.lo.go obj/src/math/__signbitf.lo.go obj/src/math/__signbitl.lo.go obj/src/math/__sin.lo.go obj/src/math/__sindf.lo.go obj/src/math/__sinl.lo.go obj/src/math/__tan.lo.go obj/src/math/__tandf.lo.go obj/src/math/__tanl.lo.go obj/src/math/acos.lo.go obj/src/math/acosf.lo.go obj/src/math/acosh.lo.go obj/src/math/acoshf.lo.go obj/src/math/acoshl.lo.go obj/src/math/acosl.lo.go obj/src/math/asin.lo.go obj/src/math/asinf.lo.go obj/src/math/asinh.lo.go obj/src/math/asinhf.lo.go obj/src/math/asinhl.lo.go obj/src/math/asinl.lo.go obj/src/math/atan.lo.go obj/src/math/atan2.lo.go obj/src/math/atan2f.lo.go obj/src/math/atan2l.lo.go obj/src/math/atanf.lo.go obj/src/math/atanh.lo.go obj/src/math/atanhf.lo.go obj/src/math/atanhl.lo.go obj/src/math/atanl.lo.go obj/src/math/cbrt.lo.go obj/src/math/cbrtf.lo.go obj/src/math/cbrtl.lo.go obj/src/math/ceil.lo.go obj/src/math/ceilf.lo.go obj/src/math/ceill.lo.go obj/src/math/copysign.lo.go obj/src/math/copysignf.lo.go obj/src/math/copysignl.lo.go obj/src/math/cos.lo.go obj/src/math/cosf.lo.go obj/src/math/cosh.lo.go obj/src/math/coshf.lo.go obj/src/math/coshl.lo.go obj/src/math/cosl.lo.go obj/src/math/erf.lo.go obj/src/math/erff.lo.go obj/src/math/erfl.lo.go obj/src/math/exp.lo.go obj/src/math/exp10.lo.go obj/src/math/exp10f.lo.go obj/src/math/exp10l.lo.go obj/src/math/exp2.lo.go obj/src/math/exp2f.lo.go obj/src/math/exp2f_data.lo.go obj/src/math/exp2l.lo.go obj/src/math/exp_data.lo.go obj/src/math/expf.lo.go obj/src/math/expl.lo.go obj/src/math/expm1.lo.go obj/src/math/expm1f.lo.go obj/src/math/expm1l.lo.go obj/src/math/fabs.lo.go obj/src/math/fabsf.lo.go obj/src/math/fabsl.lo.go obj/src/math/fdim.lo.go obj/src/math/fdimf.lo.go obj/src/math/fdiml.lo.go obj/src/math/finite.lo.go obj/src/math/finitef.lo.go obj/src/math/floor.lo.go obj/src/math/floorf.lo.go obj/src/math/floorl.lo.go obj/src/math/fma.lo.go obj/src/math/fmal.lo.go obj/src/math/fmax.lo.go obj/src/math/fmaxf.lo.go obj/src/math/fmaxl.lo.go obj/src/math/fmin.lo.go obj/src/math/fminf.lo.go obj/src/math/fminl.lo.go obj/src/math/fmod.lo.go obj/src/math/fmodf.lo.go obj/src/math/fmodl.lo.go obj/src/math/frexp.lo.go obj/src/math/frexpf.lo.go obj/src/math/frexpl.lo.go obj/src/math/hypot.lo.go obj/src/math/hypotf.lo.go obj/src/math/hypotl.lo.go obj/src/math/ilogb.lo.go obj/src/math/ilogbf.lo.go obj/src/math/ilogbl.lo.go obj/src/math/j0.lo.go obj/src/math/j0f.lo.go obj/src/math/j1.lo.go obj/src/math/j1f.lo.go obj/src/math/jn.lo.go obj/src/math/jnf.lo.go obj/src/math/ldexp.lo.go obj/src/math/ldexpf.lo.go obj/src/math/ldexpl.lo.go obj/src/math/lgamma.lo.go obj/src/math/lgamma_r.lo.go obj/src/math/lgammaf.lo.go obj/src/math/lgammaf_r.lo.go obj/src/math/lgammal.lo.go obj/src/math/llrint.lo.go obj/src/math/llrintf.lo.go obj/src/math/llrintl.lo.go obj/src/math/llround.lo.go obj/src/math/llroundf.lo.go obj/src/math/llroundl.lo.go obj/src/math/log.lo.go obj/src/math/log10.lo.go obj/src/math/log10f.lo.go obj/src/math/log10l.lo.go obj/src/math/log1p.lo.go obj/src/math/log1pf.lo.go obj/src/math/log1pl.lo.go obj/src/math/log2.lo.go obj/src/math/log2_data.lo.go obj/src/math/log2f.lo.go obj/src/math/log2f_data.lo.go obj/src/math/log2l.lo.go obj/src/math/log_data.lo.go obj/src/math/logb.lo.go obj/src/math/logbf.lo.go obj/src/math/logbl.lo.go obj/src/math/logf.lo.go obj/src/math/logf_data.lo.go obj/src/math/logl.lo.go obj/src/math/lrint.lo.go obj/src/math/lrintf.lo.go obj/src/math/lrintl.lo.go obj/src/math/lround.lo.go obj/src/math/lroundf.lo.go obj/src/math/lroundl.lo.go obj/src/math/modf.lo.go obj/src/math/modff.lo.go obj/src/math/modfl.lo.go obj/src/math/nan.lo.go obj/src/math/nanf.lo.go obj/src/math/nanl.lo.go obj/src/math/nextafter.lo.go obj/src/math/nextafterf.lo.go obj/src/math/nextafterl.lo.go obj/src/math/nexttoward.lo.go obj/src/math/nexttowardf.lo.go obj/src/math/nexttowardl.lo.go obj/src/math/pow.lo.go obj/src/math/pow_data.lo.go obj/src/math/powf.lo.go obj/src/math/powf_data.lo.go obj/src/math/powl.lo.go obj/src/math/remainder.lo.go obj/src/math/remainderf.lo.go obj/src/math/remainderl.lo.go obj/src/math/remquo.lo.go obj/src/math/remquof.lo.go obj/src/math/remquol.lo.go obj/src/math/rint.lo.go obj/src/math/rintf.lo.go obj/src/math/rintl.lo.go obj/src/math/round.lo.go obj/src/math/roundf.lo.go obj/src/math/roundl.lo.go obj/src/math/scalb.lo.go obj/src/math/scalbf.lo.go obj/src/math/scalbln.lo.go obj/src/math/scalblnf.lo.go obj/src/math/scalblnl.lo.go obj/src/math/scalbn.lo.go obj/src/math/scalbnf.lo.go obj/src/math/scalbnl.lo.go obj/src/math/signgam.lo.go obj/src/math/significand.lo.go obj/src/math/significandf.lo.go obj/src/math/sin.lo.go obj/src/math/sincos.lo.go obj/src/math/sincosf.lo.go obj/src/math/sincosl.lo.go obj/src/math/sinf.lo.go obj/src/math/sinh.lo.go obj/src/math/sinhf.lo.go obj/src/math/sinhl.lo.go obj/src/math/sinl.lo.go obj/src/math/sqrt.lo.go obj/src/math/sqrt_data.lo.go obj/src/math/sqrtf.lo.go obj/src/math/sqrtl.lo.go obj/src/math/tan.lo.go obj/src/math/tanf.lo.go obj/src/math/tanh.lo.go obj/src/math/tanhf.lo.go obj/src/math/tanhl.lo.go obj/src/math/tanl.lo.go obj/src/math/tgamma.lo.go obj/src/math/tgammaf.lo.go obj/src/math/tgammal.lo.go obj/src/math/trunc.lo.go obj/src/math/truncf.lo.go obj/src/math/truncl.lo.go obj/src/misc/a64l.lo.go obj/src/misc/basename.lo.go obj/src/misc/dirname.lo.go obj/src/misc/ffs.lo.go obj/src/misc/ffsl.lo.go obj/src/misc/ffsll.lo.go obj/src/misc/fmtmsg.lo.go obj/src/misc/get_current_dir_name.lo.go obj/src/misc/getauxval.lo.go obj/src/misc/getdomainname.lo.go obj/src/misc/getentropy.lo.go obj/src/misc/gethostid.lo.go obj/src/misc/getopt.lo.go obj/src/misc/getopt_long.lo.go obj/src/misc/getpriority.lo.go obj/src/misc/getresgid.lo.go obj/src/misc/getresuid.lo.go obj/src/misc/getrlimit.lo.go obj/src/misc/getrusage.lo.go obj/src/misc/getsubopt.lo.go obj/src/misc/ioctl.lo.go obj/src/misc/issetugid.lo.go obj/src/misc/lockf.lo.go obj/src/misc/login_tty.lo.go obj/src/misc/mntent.lo.go obj/src/misc/nftw.lo.go obj/src/misc/openpty.lo.go obj/src/misc/ptsname.lo.go obj/src/misc/pty.lo.go obj/src/misc/realpath.lo.go obj/src/misc/setdomainname.lo.go obj/src/misc/setpriority.lo.go obj/src/misc/setrlimit.lo.go obj/src/misc/syscall.lo.go obj/src/misc/syslog.lo.go obj/src/misc/uname.lo.go obj/src/mman/madvise.lo.go obj/src/mman/mincore.lo.go obj/src/mman/mlock.lo.go obj/src/mman/mlockall.lo.go obj/src/mman/mmap.lo.go obj/src/mman/mprotect.lo.go obj/src/mman/mremap.lo.go obj/src/mman/msync.lo.go obj/src/mman/munlock.lo.go obj/src/mman/munlockall.lo.go obj/src/mman/munmap.lo.go obj/src/mman/posix_madvise.lo.go obj/src/mman/shm_open.lo.go obj/src/multibyte/btowc.lo.go obj/src/multibyte/c16rtomb.lo.go obj/src/multibyte/c32rtomb.lo.go obj/src/multibyte/internal.lo.go obj/src/multibyte/mblen.lo.go obj/src/multibyte/mbrlen.lo.go obj/src/multibyte/mbrtoc16.lo.go obj/src/multibyte/mbrtoc32.lo.go obj/src/multibyte/mbrtowc.lo.go obj/src/multibyte/mbsinit.lo.go obj/src/multibyte/mbsnrtowcs.lo.go obj/src/multibyte/mbsrtowcs.lo.go obj/src/multibyte/mbstowcs.lo.go obj/src/multibyte/mbtowc.lo.go obj/src/multibyte/wcrtomb.lo.go obj/src/multibyte/wcsnrtombs.lo.go obj/src/multibyte/wcsrtombs.lo.go obj/src/multibyte/wcstombs.lo.go obj/src/multibyte/wctob.lo.go obj/src/multibyte/wctomb.lo.go obj/src/network/accept.lo.go obj/src/network/accept4.lo.go obj/src/network/bind.lo.go obj/src/network/connect.lo.go obj/src/network/dn_comp.lo.go obj/src/network/dn_expand.lo.go obj/src/network/dn_skipname.lo.go obj/src/network/dns_parse.lo.go obj/src/network/ent.lo.go obj/src/network/ether.lo.go obj/src/network/freeaddrinfo.lo.go obj/src/network/gai_strerror.lo.go obj/src/network/getaddrinfo.lo.go obj/src/network/gethostbyaddr.lo.go obj/src/network/gethostbyaddr_r.lo.go obj/src/network/gethostbyname.lo.go obj/src/network/gethostbyname2.lo.go obj/src/network/gethostbyname2_r.lo.go obj/src/network/gethostbyname_r.lo.go obj/src/network/getifaddrs.lo.go obj/src/network/getnameinfo.lo.go obj/src/network/getpeername.lo.go obj/src/network/getservbyname.lo.go obj/src/network/getservbyname_r.lo.go obj/src/network/getsockname.lo.go obj/src/network/getsockopt.lo.go obj/src/network/h_errno.lo.go obj/src/network/herror.lo.go obj/src/network/hstrerror.lo.go obj/src/network/htonl.lo.go obj/src/network/htons.lo.go obj/src/network/if_freenameindex.lo.go obj/src/network/if_indextoname.lo.go obj/src/network/if_nameindex.lo.go obj/src/network/if_nametoindex.lo.go obj/src/network/in6addr_any.lo.go obj/src/network/in6addr_loopback.lo.go obj/src/network/inet_addr.lo.go obj/src/network/inet_aton.lo.go obj/src/network/inet_legacy.lo.go obj/src/network/inet_ntoa.lo.go obj/src/network/inet_ntop.lo.go obj/src/network/inet_pton.lo.go obj/src/network/listen.lo.go obj/src/network/lookup_ipliteral.lo.go obj/src/network/lookup_name.lo.go obj/src/network/lookup_serv.lo.go obj/src/network/netlink.lo.go obj/src/network/netname.lo.go obj/src/network/ns_parse.lo.go obj/src/network/ntohl.lo.go obj/src/network/ntohs.lo.go obj/src/network/proto.lo.go obj/src/network/recv.lo.go obj/src/network/recvfrom.lo.go obj/src/network/recvmmsg.lo.go obj/src/network/recvmsg.lo.go obj/src/network/res_init.lo.go obj/src/network/res_mkquery.lo.go obj/src/network/res_msend.lo.go obj/src/network/res_send.lo.go obj/src/network/res_state.lo.go obj/src/network/resolvconf.lo.go obj/src/network/send.lo.go obj/src/network/sendmmsg.lo.go obj/src/network/sendmsg.lo.go obj/src/network/sendto.lo.go obj/src/network/serv.lo.go obj/src/network/setsockopt.lo.go obj/src/network/shutdown.lo.go obj/src/network/sockatmark.lo.go obj/src/network/socket.lo.go obj/src/network/socketpair.lo.go obj/src/passwd/fgetgrent.lo.go obj/src/passwd/fgetpwent.lo.go obj/src/passwd/getgr_a.lo.go obj/src/passwd/getgr_r.lo.go obj/src/passwd/getgrent.lo.go obj/src/passwd/getgrent_a.lo.go obj/src/passwd/getgrouplist.lo.go obj/src/passwd/getpw_a.lo.go obj/src/passwd/getpw_r.lo.go obj/src/passwd/getpwent.lo.go obj/src/passwd/getpwent_a.lo.go obj/src/passwd/getspent.lo.go obj/src/passwd/lckpwdf.lo.go obj/src/passwd/nscd_query.lo.go obj/src/passwd/putgrent.lo.go obj/src/passwd/putpwent.lo.go obj/src/passwd/putspent.lo.go obj/src/prng/__rand48_step.lo.go obj/src/prng/__seed48.lo.go obj/src/prng/drand48.lo.go obj/src/prng/lcong48.lo.go obj/src/prng/lrand48.lo.go obj/src/prng/mrand48.lo.go obj/src/prng/rand.lo.go obj/src/prng/rand_r.lo.go obj/src/prng/random.lo.go obj/src/prng/seed48.lo.go obj/src/prng/srand48.lo.go obj/src/process/execl.lo.go obj/src/process/execle.lo.go obj/src/process/execlp.lo.go obj/src/process/execv.lo.go obj/src/process/execve.lo.go obj/src/process/execvp.lo.go obj/src/process/fexecve.lo.go obj/src/process/fork.lo.go obj/src/process/posix_spawn_file_actions_addchdir.lo.go obj/src/process/posix_spawn_file_actions_addclose.lo.go obj/src/process/posix_spawn_file_actions_adddup2.lo.go obj/src/process/posix_spawn_file_actions_addfchdir.lo.go obj/src/process/posix_spawn_file_actions_addopen.lo.go obj/src/process/posix_spawn_file_actions_destroy.lo.go obj/src/process/posix_spawn_file_actions_init.lo.go obj/src/process/posix_spawnattr_destroy.lo.go obj/src/process/posix_spawnattr_getflags.lo.go obj/src/process/posix_spawnattr_getpgroup.lo.go obj/src/process/posix_spawnattr_getsigdefault.lo.go obj/src/process/posix_spawnattr_getsigmask.lo.go obj/src/process/posix_spawnattr_init.lo.go obj/src/process/posix_spawnattr_sched.lo.go obj/src/process/posix_spawnattr_setflags.lo.go obj/src/process/posix_spawnattr_setpgroup.lo.go obj/src/process/posix_spawnattr_setsigdefault.lo.go obj/src/process/posix_spawnattr_setsigmask.lo.go obj/src/process/vfork.lo.go obj/src/process/wait.lo.go obj/src/process/waitid.lo.go obj/src/process/waitpid.lo.go obj/src/regex/fnmatch.lo.go obj/src/regex/glob.lo.go obj/src/regex/regcomp.lo.go obj/src/regex/regerror.lo.go obj/src/regex/regexec.lo.go obj/src/regex/tre-mem.lo.go obj/src/search/hsearch.lo.go obj/src/search/insque.lo.go obj/src/search/lsearch.lo.go obj/src/search/tdelete.lo.go obj/src/search/tdestroy.lo.go obj/src/search/tfind.lo.go obj/src/search/tsearch.lo.go obj/src/search/twalk.lo.go obj/src/select/poll.lo.go obj/src/select/ppoll.lo.go obj/src/select/pselect.lo.go obj/src/select/select.lo.go obj/src/signal/block.lo.go obj/src/signal/getitimer.lo.go obj/src/signal/kill.lo.go obj/src/signal/killpg.lo.go obj/src/signal/psiginfo.lo.go obj/src/signal/psignal.lo.go obj/src/signal/raise.lo.go obj/src/signal/restore.lo.go obj/src/signal/setitimer.lo.go obj/src/signal/sigaction.lo.go obj/src/signal/sigaddset.lo.go obj/src/signal/sigaltstack.lo.go obj/src/signal/sigandset.lo.go obj/src/signal/sigdelset.lo.go obj/src/signal/sigemptyset.lo.go obj/src/signal/sigfillset.lo.go obj/src/signal/sigisemptyset.lo.go obj/src/signal/sigismember.lo.go obj/src/signal/sigorset.lo.go obj/src/signal/sigpending.lo.go obj/src/signal/sigprocmask.lo.go obj/src/signal/sigqueue.lo.go obj/src/signal/sigrtmax.lo.go obj/src/signal/sigrtmin.lo.go obj/src/signal/sigsetjmp.lo.go obj/src/signal/sigsetjmp_tail.lo.go obj/src/signal/sigsuspend.lo.go obj/src/signal/sigtimedwait.lo.go obj/src/signal/sigwait.lo.go obj/src/signal/sigwaitinfo.lo.go obj/src/stat/__xstat.lo.go obj/src/stat/chmod.lo.go obj/src/stat/fchmod.lo.go obj/src/stat/fchmodat.lo.go obj/src/stat/fstat.lo.go obj/src/stat/fstatat.lo.go obj/src/stat/futimens.lo.go obj/src/stat/futimesat.lo.go obj/src/stat/lchmod.lo.go obj/src/stat/lstat.lo.go obj/src/stat/mkdir.lo.go obj/src/stat/mkdirat.lo.go obj/src/stat/mkfifo.lo.go obj/src/stat/mkfifoat.lo.go obj/src/stat/mknod.lo.go obj/src/stat/mknodat.lo.go obj/src/stat/stat.lo.go obj/src/stat/statvfs.lo.go obj/src/stat/umask.lo.go obj/src/stat/utimensat.lo.go obj/src/stdio/__fclose_ca.lo.go obj/src/stdio/__fdopen.lo.go obj/src/stdio/__fmodeflags.lo.go obj/src/stdio/__fopen_rb_ca.lo.go obj/src/stdio/__overflow.lo.go obj/src/stdio/__stdio_close.lo.go obj/src/stdio/__stdio_exit.lo.go obj/src/stdio/__stdio_read.lo.go obj/src/stdio/__stdio_seek.lo.go obj/src/stdio/__stdio_write.lo.go obj/src/stdio/__stdout_write.lo.go obj/src/stdio/__toread.lo.go obj/src/stdio/__towrite.lo.go obj/src/stdio/__uflow.lo.go obj/src/stdio/asprintf.lo.go obj/src/stdio/clearerr.lo.go obj/src/stdio/dprintf.lo.go obj/src/stdio/ext.lo.go obj/src/stdio/ext2.lo.go obj/src/stdio/fclose.lo.go obj/src/stdio/feof.lo.go obj/src/stdio/ferror.lo.go obj/src/stdio/fflush.lo.go obj/src/stdio/fgetc.lo.go obj/src/stdio/fgetln.lo.go obj/src/stdio/fgetpos.lo.go obj/src/stdio/fgets.lo.go obj/src/stdio/fgetwc.lo.go obj/src/stdio/fgetws.lo.go obj/src/stdio/fileno.lo.go obj/src/stdio/flockfile.lo.go obj/src/stdio/fmemopen.lo.go obj/src/stdio/fopen.lo.go obj/src/stdio/fopencookie.lo.go obj/src/stdio/fprintf.lo.go obj/src/stdio/fputc.lo.go obj/src/stdio/fputs.lo.go obj/src/stdio/fputwc.lo.go obj/src/stdio/fputws.lo.go obj/src/stdio/fread.lo.go obj/src/stdio/freopen.lo.go obj/src/stdio/fscanf.lo.go obj/src/stdio/fseek.lo.go obj/src/stdio/fsetpos.lo.go obj/src/stdio/ftell.lo.go obj/src/stdio/ftrylockfile.lo.go obj/src/stdio/funlockfile.lo.go obj/src/stdio/fwide.lo.go obj/src/stdio/fwprintf.lo.go obj/src/stdio/fwrite.lo.go obj/src/stdio/fwscanf.lo.go obj/src/stdio/getc.lo.go obj/src/stdio/getc_unlocked.lo.go obj/src/stdio/getchar.lo.go obj/src/stdio/getchar_unlocked.lo.go obj/src/stdio/getdelim.lo.go obj/src/stdio/getline.lo.go obj/src/stdio/gets.lo.go obj/src/stdio/getw.lo.go obj/src/stdio/getwc.lo.go obj/src/stdio/getwchar.lo.go obj/src/stdio/ofl.lo.go obj/src/stdio/ofl_add.lo.go obj/src/stdio/open_memstream.lo.go obj/src/stdio/open_wmemstream.lo.go obj/src/stdio/pclose.lo.go obj/src/stdio/perror.lo.go obj/src/stdio/printf.lo.go obj/src/stdio/putc.lo.go obj/src/stdio/putc_unlocked.lo.go obj/src/stdio/putchar.lo.go obj/src/stdio/putchar_unlocked.lo.go obj/src/stdio/puts.lo.go obj/src/stdio/putw.lo.go obj/src/stdio/putwc.lo.go obj/src/stdio/putwchar.lo.go obj/src/stdio/remove.lo.go obj/src/stdio/rename.lo.go obj/src/stdio/rewind.lo.go obj/src/stdio/scanf.lo.go obj/src/stdio/setbuf.lo.go obj/src/stdio/setbuffer.lo.go obj/src/stdio/setlinebuf.lo.go obj/src/stdio/setvbuf.lo.go obj/src/stdio/snprintf.lo.go obj/src/stdio/sprintf.lo.go obj/src/stdio/sscanf.lo.go obj/src/stdio/stderr.lo.go obj/src/stdio/stdin.lo.go obj/src/stdio/stdout.lo.go obj/src/stdio/swprintf.lo.go obj/src/stdio/swscanf.lo.go obj/src/stdio/tempnam.lo.go obj/src/stdio/tmpfile.lo.go obj/src/stdio/tmpnam.lo.go obj/src/stdio/ungetc.lo.go obj/src/stdio/ungetwc.lo.go obj/src/stdio/vasprintf.lo.go obj/src/stdio/vdprintf.lo.go obj/src/stdio/vfprintf.lo.go obj/src/stdio/vfscanf.lo.go obj/src/stdio/vfwprintf.lo.go obj/src/stdio/vfwscanf.lo.go obj/src/stdio/vprintf.lo.go obj/src/stdio/vscanf.lo.go obj/src/stdio/vsnprintf.lo.go obj/src/stdio/vsprintf.lo.go obj/src/stdio/vsscanf.lo.go obj/src/stdio/vswprintf.lo.go obj/src/stdio/vswscanf.lo.go obj/src/stdio/vwprintf.lo.go obj/src/stdio/vwscanf.lo.go obj/src/stdio/wprintf.lo.go obj/src/stdio/wscanf.lo.go obj/src/stdlib/abs.lo.go obj/src/stdlib/atof.lo.go obj/src/stdlib/atoi.lo.go obj/src/stdlib/atol.lo.go obj/src/stdlib/atoll.lo.go obj/src/stdlib/bsearch.lo.go obj/src/stdlib/div.lo.go obj/src/stdlib/ecvt.lo.go obj/src/stdlib/fcvt.lo.go obj/src/stdlib/gcvt.lo.go obj/src/stdlib/imaxabs.lo.go obj/src/stdlib/imaxdiv.lo.go obj/src/stdlib/labs.lo.go obj/src/stdlib/ldiv.lo.go obj/src/stdlib/llabs.lo.go obj/src/stdlib/lldiv.lo.go obj/src/stdlib/qsort.lo.go obj/src/stdlib/qsort_nr.lo.go obj/src/stdlib/strtod.lo.go obj/src/stdlib/strtol.lo.go obj/src/stdlib/wcstod.lo.go obj/src/stdlib/wcstol.lo.go obj/src/string/bcmp.lo.go obj/src/string/bcopy.lo.go obj/src/string/bzero.lo.go obj/src/string/explicit_bzero.lo.go obj/src/string/index.lo.go obj/src/string/memccpy.lo.go obj/src/string/memchr.lo.go obj/src/string/memcmp.lo.go obj/src/string/memcpy.lo.go obj/src/string/memmem.lo.go obj/src/string/memmove.lo.go obj/src/string/mempcpy.lo.go obj/src/string/memrchr.lo.go obj/src/string/memset.lo.go obj/src/string/rindex.lo.go obj/src/string/stpcpy.lo.go obj/src/string/stpncpy.lo.go obj/src/string/strcasecmp.lo.go obj/src/string/strcasestr.lo.go obj/src/string/strcat.lo.go obj/src/string/strchr.lo.go obj/src/string/strchrnul.lo.go obj/src/string/strcmp.lo.go obj/src/string/strcpy.lo.go obj/src/string/strcspn.lo.go obj/src/string/strdup.lo.go obj/src/string/strerror_r.lo.go obj/src/string/strlcat.lo.go obj/src/string/strlcpy.lo.go obj/src/string/strlen.lo.go obj/src/string/strncasecmp.lo.go obj/src/string/strncat.lo.go obj/src/string/strncmp.lo.go obj/src/string/strncpy.lo.go obj/src/string/strndup.lo.go obj/src/string/strnlen.lo.go obj/src/string/strpbrk.lo.go obj/src/string/strrchr.lo.go obj/src/string/strsep.lo.go obj/src/string/strsignal.lo.go obj/src/string/strspn.lo.go obj/src/string/strstr.lo.go obj/src/string/strtok.lo.go obj/src/string/strtok_r.lo.go obj/src/string/strverscmp.lo.go obj/src/string/swab.lo.go obj/src/string/wcpcpy.lo.go obj/src/string/wcpncpy.lo.go obj/src/string/wcscasecmp.lo.go obj/src/string/wcscasecmp_l.lo.go obj/src/string/wcscat.lo.go obj/src/string/wcschr.lo.go obj/src/string/wcscmp.lo.go obj/src/string/wcscpy.lo.go obj/src/string/wcscspn.lo.go obj/src/string/wcsdup.lo.go obj/src/string/wcslen.lo.go obj/src/string/wcsncasecmp.lo.go obj/src/string/wcsncasecmp_l.lo.go obj/src/string/wcsncat.lo.go obj/src/string/wcsncmp.lo.go obj/src/string/wcsncpy.lo.go obj/src/string/wcsnlen.lo.go obj/src/string/wcspbrk.lo.go obj/src/string/wcsrchr.lo.go obj/src/string/wcsspn.lo.go obj/src/string/wcsstr.lo.go obj/src/string/wcstok.lo.go obj/src/string/wcswcs.lo.go obj/src/string/wmemchr.lo.go obj/src/string/wmemcmp.lo.go obj/src/string/wmemcpy.lo.go obj/src/string/wmemmove.lo.go obj/src/string/wmemset.lo.go obj/src/temp/mkdtemp.lo.go obj/src/temp/mkostemp.lo.go obj/src/temp/mkostemps.lo.go obj/src/temp/mkstemp.lo.go obj/src/temp/mkstemps.lo.go obj/src/temp/mktemp.lo.go obj/src/termios/cfgetospeed.lo.go obj/src/termios/cfmakeraw.lo.go obj/src/termios/cfsetospeed.lo.go obj/src/termios/tcdrain.lo.go obj/src/termios/tcflow.lo.go obj/src/termios/tcflush.lo.go obj/src/termios/tcgetattr.lo.go obj/src/termios/tcgetsid.lo.go obj/src/termios/tcgetwinsize.lo.go obj/src/termios/tcsendbreak.lo.go obj/src/termios/tcsetattr.lo.go obj/src/termios/tcsetwinsize.lo.go obj/src/time/__map_file.lo.go obj/src/time/__month_to_secs.lo.go obj/src/time/__secs_to_tm.lo.go obj/src/time/__tm_to_secs.lo.go obj/src/time/__tz.lo.go obj/src/time/__year_to_secs.lo.go obj/src/time/asctime.lo.go obj/src/time/asctime_r.lo.go obj/src/time/clock.lo.go obj/src/time/clock_getcpuclockid.lo.go obj/src/time/clock_getres.lo.go obj/src/time/clock_gettime.lo.go obj/src/time/clock_nanosleep.lo.go obj/src/time/clock_settime.lo.go obj/src/time/ctime.lo.go obj/src/time/ctime_r.lo.go obj/src/time/difftime.lo.go obj/src/time/ftime.lo.go obj/src/time/getdate.lo.go obj/src/time/gettimeofday.lo.go obj/src/time/gmtime.lo.go obj/src/time/gmtime_r.lo.go obj/src/time/localtime.lo.go obj/src/time/localtime_r.lo.go obj/src/time/mktime.lo.go obj/src/time/nanosleep.lo.go obj/src/time/strftime.lo.go obj/src/time/strptime.lo.go obj/src/time/time.lo.go obj/src/time/timegm.lo.go obj/src/time/timer_delete.lo.go obj/src/time/timer_getoverrun.lo.go obj/src/time/timer_gettime.lo.go obj/src/time/timer_settime.lo.go obj/src/time/times.lo.go obj/src/time/timespec_get.lo.go obj/src/time/utime.lo.go obj/src/time/wcsftime.lo.go obj/src/unistd/_exit.lo.go obj/src/unistd/access.lo.go obj/src/unistd/acct.lo.go obj/src/unistd/alarm.lo.go obj/src/unistd/chdir.lo.go obj/src/unistd/chown.lo.go obj/src/unistd/close.lo.go obj/src/unistd/ctermid.lo.go obj/src/unistd/dup.lo.go obj/src/unistd/dup2.lo.go obj/src/unistd/dup3.lo.go obj/src/unistd/faccessat.lo.go obj/src/unistd/fchdir.lo.go obj/src/unistd/fchown.lo.go obj/src/unistd/fchownat.lo.go obj/src/unistd/fdatasync.lo.go obj/src/unistd/fsync.lo.go obj/src/unistd/ftruncate.lo.go obj/src/unistd/getcwd.lo.go obj/src/unistd/getegid.lo.go obj/src/unistd/geteuid.lo.go obj/src/unistd/getgid.lo.go obj/src/unistd/getgroups.lo.go obj/src/unistd/gethostname.lo.go obj/src/unistd/getlogin.lo.go obj/src/unistd/getlogin_r.lo.go obj/src/unistd/getpgid.lo.go obj/src/unistd/getpgrp.lo.go obj/src/unistd/getpid.lo.go obj/src/unistd/getppid.lo.go obj/src/unistd/getsid.lo.go obj/src/unistd/getuid.lo.go obj/src/unistd/isatty.lo.go obj/src/unistd/lchown.lo.go obj/src/unistd/link.lo.go obj/src/unistd/linkat.lo.go obj/src/unistd/lseek.lo.go obj/src/unistd/nice.lo.go obj/src/unistd/pause.lo.go obj/src/unistd/pipe.lo.go obj/src/unistd/pipe2.lo.go obj/src/unistd/posix_close.lo.go obj/src/unistd/pread.lo.go obj/src/unistd/preadv.lo.go obj/src/unistd/pwrite.lo.go obj/src/unistd/pwritev.lo.go obj/src/unistd/read.lo.go obj/src/unistd/readlink.lo.go obj/src/unistd/readlinkat.lo.go obj/src/unistd/readv.lo.go obj/src/unistd/renameat.lo.go obj/src/unistd/rmdir.lo.go obj/src/unistd/setgid.lo.go obj/src/unistd/setpgid.lo.go obj/src/unistd/setpgrp.lo.go obj/src/unistd/setsid.lo.go obj/src/unistd/setuid.lo.go obj/src/unistd/setxid.lo.go obj/src/unistd/sleep.lo.go obj/src/unistd/symlink.lo.go obj/src/unistd/symlinkat.lo.go obj/src/unistd/sync.lo.go obj/src/unistd/tcgetpgrp.lo.go obj/src/unistd/tcsetpgrp.lo.go obj/src/unistd/truncate.lo.go obj/src/unistd/ttyname.lo.go obj/src/unistd/ttyname_r.lo.go obj/src/unistd/ualarm.lo.go obj/src/unistd/unlink.lo.go obj/src/unistd/unlinkat.lo.go obj/src/unistd/usleep.lo.go obj/src/unistd/write.lo.go obj/src/unistd/writev.lo.go -lgcc -lgcc_eh', DO NOT EDIT. //go:build linux && loong64 // +build linux,loong64 @@ -100,7 +100,6 @@ const LDBL_TRUE_MIN = 0 const LITTLE_ENDIAN = 1234 const MATH_ERREXCEPT = 2 const MATH_ERRNO = 1 -const MAXFLOAT = 0 const M_1_PI = 0 const M_2_PI = 0 const M_2_SQRTPI = 0 @@ -1891,6 +1890,7 @@ func Xcproj(tls *TLS, z complex128) (r complex128) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) == Uint64FromUint64(0x7ff)<>Int32FromInt32(8)&uint32(0x00FF00FF) goto _3 _3: + ; count-- v2 = count if !(v2 != 0) { @@ -9107,6 +9102,7 @@ func _BF_encrypt(tls *TLS, ctx uintptr, L TBF_word, R TBF_word, start uintptr, e L ^= tmp3 goto _1 _1: + ; i += int32(2) } tmp4 = R @@ -9204,6 +9200,7 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags } goto _4 _4: + ; j++ } diff |= (*(*[2]TBF_word)(unsafe.Pointer(bp)))[0] ^ (*(*[2]TBF_word)(unsafe.Pointer(bp)))[int32(1)] /* Non-zero on any differences */ @@ -9211,6 +9208,7 @@ func _BF_set_key(tls *TLS, key uintptr, expanded uintptr, initial uintptr, flags *(*TBF_word)(unsafe.Pointer(initial + uintptr(i)*4)) = *(*TBF_word)(unsafe.Pointer(uintptr(unsafe.Pointer(&_BF_init_state)) + uintptr(i)*4)) ^ (*(*[2]TBF_word)(unsafe.Pointer(bp)))[bug] goto _2 _2: + ; i++ } /* @@ -9299,6 +9297,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + uintptr(i+int32(1))*4)) ^= *(*TBF_word)(unsafe.Pointer(bp + 4168 + uintptr(i+int32(1))*4)) goto _3 _3: + ; i += int32(2) } done = 0 @@ -9323,6 +9322,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + uintptr(i+int32(3))*4)) ^= tmp4 goto _4 _4: + ; i += int32(4) } *(*TBF_word)(unsafe.Pointer(bp + 16*4)) ^= tmp1 @@ -9330,6 +9330,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w } goto _2 _2: + ; count-- v1 = count if !(v1 != 0) { @@ -9348,6 +9349,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w L1 = _BF_encrypt(tls, bp, L1, (*(*[2]TBF_word)(unsafe.Pointer(bp + 4264)))[int32(1)], bp+4264, bp+4264) goto _7 _7: + ; count-- v6 = count if !(v6 != 0) { @@ -9358,6 +9360,7 @@ func _BF_crypt(tls *TLS, key uintptr, setting uintptr, output uintptr, min TBF_w *(*TBF_word)(unsafe.Pointer(bp + 4240 + uintptr(i+int32(1))*4)) = (*(*[2]TBF_word)(unsafe.Pointer(bp + 4264)))[int32(1)] goto _5 _5: + ; i += int32(2) } Xmemcpy(tls, output, setting, uint64(Int32FromInt32(7)+Int32FromInt32(22)-Int32FromInt32(1))) @@ -11274,6 +11277,7 @@ func _setup_salt(tls *TLS, salt Tuint32_t) (r Tuint32_t) { obit >>= uint32(1) goto _1 _1: + ; i++ } return saltbits @@ -11307,6 +11311,7 @@ func X__des_setkey(tls *TLS, key uintptr, ekey uintptr) { k1 |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_key_perm_maskr)) + uintptr(j+uint32(1))*64 + uintptr(rawkey0>>ibit&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_key_perm_maskr)) + uintptr(i+uint32(8))*64 + uintptr(rawkey1>>ibit&uint32(0xf))*4)) goto _2 _2: + ; i++ ibit -= uint32(4) } @@ -11339,12 +11344,14 @@ func X__des_setkey(tls *TLS, key uintptr, ekey uintptr) { ibit -= uint32(3) goto _5 _5: + ; i++ } *(*Tuint32_t)(unsafe.Pointer(ekey + uintptr(round)*4)) = kl *(*Tuint32_t)(unsafe.Pointer(ekey + 64 + uintptr(round)*4)) = kr goto _3 _3: + ; round++ } } @@ -11379,6 +11386,7 @@ func X__do_des(tls *TLS, l_in Tuint32_t, r_in Tuint32_t, l_out uintptr, r_out ui r |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_ip_maskr)) + uintptr(i)*64 + uintptr(l_in>>ibit&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_ip_maskr)) + uintptr(i+uint32(8))*64 + uintptr(r_in>>ibit&uint32(0xf))*4)) goto _2 _2: + ; i++ ibit -= uint32(4) } @@ -11449,6 +11457,7 @@ func X__do_des(tls *TLS, l_in Tuint32_t, r_in Tuint32_t, l_out uintptr, r_out ui lo |= *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_fp_maskl)) + uintptr(i1)*64 + uintptr(l>>ibit1&uint32(0xf))*4)) | *(*Tuint32_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_fp_maskl)) + uintptr(i1+uint32(4))*64 + uintptr(r>>ibit1&uint32(0xf))*4)) goto _8 _8: + ; i1++ ibit1 -= uint32(4) } @@ -11522,6 +11531,7 @@ func __crypt_extended_r_uut(tls *TLS, _key uintptr, _setting uintptr, output uin count |= value << ((i - uint32(1)) * uint32(6)) goto _2 _2: + ; i++ } if !(count != 0) { @@ -11540,6 +11550,7 @@ func __crypt_extended_r_uut(tls *TLS, _key uintptr, _setting uintptr, output uin salt |= value1 << ((i - uint32(5)) * uint32(6)) goto _3 _3: + ; i++ } for *(*uint8)(unsafe.Pointer(key)) != 0 { @@ -11765,6 +11776,7 @@ func _processblock(tls *TLS, s uintptr, buf uintptr) { *(*Tuint32_t)(unsafe.Pointer(bp + uintptr(i)*4)) |= uint32(*(*Tuint8_t)(unsafe.Pointer(buf + uintptr(uint32(4)*i+uint32(3))))) << int32(24) goto _1 _1: + ; i++ } a = *(*Tuint32_t)(unsafe.Pointer(s + 8)) @@ -11882,6 +11894,7 @@ func _md5_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(4)*i+int32(3)))) = uint8(*(*Tuint32_t)(unsafe.Pointer(s + 8 + uintptr(i)*4)) >> int32(24)) goto _1 _1: + ; i++ } } @@ -11910,6 +11923,7 @@ func _md5_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock(tls, s, p) goto _1 _1: + ; len1 -= uint64(64) p += uintptr(64) } @@ -11989,6 +12003,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt } goto _1 _1: + ; i++ } slen = i @@ -12010,6 +12025,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt _md5_update(tls, bp, bp+88, uint64(16)) goto _2 _2: + ; i = uint32(uint64(i) - Uint64FromInt64(16)) } _md5_update(tls, bp, bp+88, uint64(i)) @@ -12026,6 +12042,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt } goto _3 _3: + ; i >>= uint32(1) } _md5_sum(tls, bp, bp+88) @@ -12055,6 +12072,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt _md5_sum(tls, bp, bp+88) goto _4 _4: + ; i++ } /* output is $1$salt$hash */ @@ -12071,6 +12089,7 @@ func _md5crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r uintpt p = _to64(tls, p, uint32(int32((*(*[16]uint8)(unsafe.Pointer(bp + 88)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm)) + uintptr(i)*3))])<>Int32FromInt32(10) + (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(7)] + (_ror(tls, (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(7)) ^ _ror(tls, (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(18)) ^ (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(15)]>>Int32FromInt32(3)) + (*(*[64]Tuint32_t)(unsafe.Pointer(bp)))[i-int32(16)] goto _2 _2: + ; i++ } a = *(*Tuint32_t)(unsafe.Pointer(s + 8)) @@ -12306,6 +12327,7 @@ func _processblock1(tls *TLS, s uintptr, buf uintptr) { a = t1 + t2 goto _3 _3: + ; i++ } *(*Tuint32_t)(unsafe.Pointer(s + 8)) += a @@ -12370,6 +12392,7 @@ func _sha256_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(4)*i+int32(3)))) = uint8(*(*Tuint32_t)(unsafe.Pointer(s + 8 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -12398,6 +12421,7 @@ func _sha256_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock1(tls, s, p) goto _1 _1: + ; len1 -= uint64(64) p += uintptr(64) } @@ -12442,6 +12466,7 @@ func _hashmd(tls *TLS, s uintptr, n uint32, md uintptr) { _sha256_update(tls, s, md, uint64(32)) goto _1 _1: + ; i -= uint32(32) } _sha256_update(tls, s, md, uint64(i)) @@ -12517,6 +12542,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _1 _1: + ; i++ } slen = i @@ -12543,6 +12569,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _2 _2: + ; i >>= uint32(1) } _sha256_sum(tls, bp, bp+104) @@ -12556,6 +12583,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha256_update(tls, bp, key, uint64(klen)) goto _3 _3: + ; i++ } _sha256_sum(tls, bp, bp+136) @@ -12569,6 +12597,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha256_update(tls, bp, salt, uint64(slen)) goto _4 _4: + ; i++ } _sha256_sum(tls, bp, bp+168) @@ -12598,6 +12627,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha256_sum(tls, bp, bp+104) goto _5 _5: + ; i++ } /* output is $5$rounds=n$salt$hash */ @@ -12611,6 +12641,7 @@ func _sha256crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui p = _to641(tls, p, uint32(int32((*(*[32]uint8)(unsafe.Pointer(bp + 104)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm1)) + uintptr(i)*3))])<>Int32FromInt32(6) + (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(7)] + (_ror1(tls, (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(1)) ^ _ror1(tls, (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)], int32(8)) ^ (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(15)]>>Int32FromInt32(7)) + (*(*[80]Tuint64_t)(unsafe.Pointer(bp)))[i-int32(16)] goto _2 _2: + ; i++ } a = *(*Tuint64_t)(unsafe.Pointer(s + 8)) @@ -12849,6 +12882,7 @@ func _processblock2(tls *TLS, s uintptr, buf uintptr) { a = t1 + t2 goto _3 _3: + ; i++ } *(*Tuint64_t)(unsafe.Pointer(s + 8)) += a @@ -12917,6 +12951,7 @@ func _sha512_sum(tls *TLS, s uintptr, md uintptr) { *(*Tuint8_t)(unsafe.Pointer(md + uintptr(int32(8)*i+int32(7)))) = uint8(*(*Tuint64_t)(unsafe.Pointer(s + 8 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -12945,6 +12980,7 @@ func _sha512_update(tls *TLS, s uintptr, m uintptr, len1 uint64) { _processblock2(tls, s, p) goto _1 _1: + ; len1 -= uint64(128) p += uintptr(128) } @@ -12989,6 +13025,7 @@ func _hashmd1(tls *TLS, s uintptr, n uint32, md uintptr) { _sha512_update(tls, s, md, uint64(64)) goto _1 _1: + ; i -= uint32(64) } _sha512_update(tls, s, md, uint64(i)) @@ -13016,6 +13053,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _1 _1: + ; i++ } if i > uint32(KEY_MAX1) { @@ -13073,6 +13111,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _2 _2: + ; i++ } slen = i @@ -13099,6 +13138,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui } goto _3 _3: + ; i >>= uint32(1) } _sha512_sum(tls, bp, bp+200) @@ -13112,6 +13152,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha512_update(tls, bp, key, uint64(klen)) goto _4 _4: + ; i++ } _sha512_sum(tls, bp, bp+264) @@ -13125,6 +13166,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha512_update(tls, bp, salt, uint64(slen)) goto _5 _5: + ; i++ } _sha512_sum(tls, bp, bp+328) @@ -13154,6 +13196,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui _sha512_sum(tls, bp, bp+200) goto _6 _6: + ; i++ } /* output is $6$rounds=n$salt$hash */ @@ -13167,6 +13210,7 @@ func _sha512crypt(tls *TLS, key uintptr, setting uintptr, output uintptr) (r1 ui p = _to642(tls, p, uint32(int32((*(*[64]uint8)(unsafe.Pointer(bp + 200)))[*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_perm2)) + uintptr(i)*3))])<> j & uint32(1)) goto _5 _5: + ; j-- } goto _4 _4: + ; i++ } } @@ -14442,8 +14493,6 @@ func Xisupper_l(tls *TLS, c int32, l Tlocale_t) (r int32) { return X__isupper_l(tls, c, l) } -const WEOF = 4294967295 - type Twint_t = uint32 type Twctype_t = uint64 @@ -17456,6 +17505,7 @@ func Xwctype(tls *TLS, s uintptr) (r Twctype_t) { } goto _1 _1: + ; i++ p += uintptr(6) } @@ -22300,6 +22350,7 @@ func Xwcswidth(tls *TLS, wcs uintptr, n Tsize_t) (r int32) { } goto _1 _1: + ; l += k wcs += 4 } @@ -24977,6 +25028,7 @@ func X__reset_tls(tls *TLS) { Xmemset(tls, mem+uintptr((*Ttls_module)(unsafe.Pointer(p)).Flen1), 0, (*Ttls_module)(unsafe.Pointer(p)).Fsize-(*Ttls_module)(unsafe.Pointer(p)).Flen1) goto _1 _1: + ; i++ p = (*Ttls_module)(unsafe.Pointer(p)).Fnext } @@ -25061,6 +25113,7 @@ func Xgetenv(tls *TLS, name uintptr) (r uintptr) { } goto _1 _1: + ; e += 8 } } @@ -25093,6 +25146,7 @@ func X__putenv(tls *TLS, s uintptr, l Tsize_t, r uintptr) (r1 int32) { } goto _1 _1: + ; e += 8 i++ } @@ -25122,6 +25176,7 @@ func X__putenv(tls *TLS, s uintptr, l Tsize_t, r uintptr) (r1 int32) { } return 0 oom: + ; Xfree(tls, r) return -int32(1) } @@ -25193,6 +25248,7 @@ func X__env_rm_add(tls *TLS, old uintptr, new1 uintptr) { } goto _1 _1: + ; i++ } if !(new1 != 0) { @@ -25280,6 +25336,7 @@ func Xunsetenv(tls *TLS, name uintptr) (r int32) { } goto _1 _1: + ; e += 8 } if eo != e { @@ -25939,6 +25996,7 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { x = int32(10)*x + c - int32('0') goto _9 _9: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v12 = f + 8 v11 = *(*uintptr)(unsafe.Pointer(v12)) @@ -25957,6 +26015,7 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { y = int64(10)*y + int64(c) - int64('0') goto _13 _13: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v16 = f + 8 v15 = *(*uintptr)(unsafe.Pointer(v16)) @@ -25973,6 +26032,7 @@ func _scanexp(tls *TLS, f uintptr, pok int32) (r int64) { } goto _17 _17: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v20 = f + 8 v19 = *(*uintptr)(unsafe.Pointer(v20)) @@ -26025,6 +26085,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, gotdig = int32(1) goto _1 _1: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v4 = f + 8 v3 = *(*uintptr)(unsafe.Pointer(v4)) @@ -26054,6 +26115,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, lrp-- goto _5 _5: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v11 = f + 8 v10 = *(*uintptr)(unsafe.Pointer(v11)) @@ -26104,6 +26166,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _12 _12: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v16 = f + 8 v15 = *(*uintptr)(unsafe.Pointer(v16)) @@ -26168,6 +26231,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, *(*Tuint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32(10) goto _19 _19: + ; j++ } k++ @@ -26197,6 +26261,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _20 _20: + ; z-- } /* Align radix point to B1B digit boundary */ @@ -26223,6 +26288,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _22 _22: + ; k++ } if carry != 0 { @@ -26254,6 +26320,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _24 _24: + ; k = (k - int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) } if carry1 != 0 { @@ -26285,6 +26352,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _26 _26: + ; i++ } if i == int32(LD_B1B_DIG) && rp == Int32FromInt32(9)*Int32FromInt32(LD_B1B_DIG) { @@ -26310,6 +26378,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, } goto _27 _27: + ; k = (k + int32(1)) & (Int32FromInt32(KMAX) - Int32FromInt32(1)) } if carry2 != 0 { @@ -26339,6 +26408,7 @@ func _decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, y = Float64FromFloat64(1e+09)*y + float64((*(*[128]Tuint32_t)(unsafe.Pointer(bp)))[(a+i)&(Int32FromInt32(KMAX)-Int32FromInt32(1))]) goto _28 _28: + ; i++ } y *= float64(sign) @@ -26446,6 +26516,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 gotdig = int32(1) goto _4 _4: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v7 = f + 8 v6 = *(*uintptr)(unsafe.Pointer(v7)) @@ -26476,6 +26547,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 gotdig = int32(1) goto _11 _11: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v14 = f + 8 v13 = *(*uintptr)(unsafe.Pointer(v14)) @@ -26522,6 +26594,7 @@ func _hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int3 } goto _15 _15: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v18 = f + 8 v17 = *(*uintptr)(unsafe.Pointer(v18)) @@ -26690,6 +26763,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _11 _11: + ; i++ } if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 { @@ -26707,6 +26781,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _16 _16: + ; i-- } } @@ -26732,6 +26807,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { } goto _18 _18: + ; i++ } } @@ -26788,6 +26864,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) (r float64) { return float64(X__builtin_nanf(tls, __ccgo_ts)) goto _26 _26: + ; i++ } return float64(X__builtin_nanf(tls, __ccgo_ts)) @@ -27191,6 +27268,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint x = x*uint32(10) + uint32(c-Int32FromUint8('0')) goto _20 _20: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v23 = f + 8 v22 = *(*uintptr)(unsafe.Pointer(v23)) @@ -27209,6 +27287,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint y = y*uint64(10) + uint64(c-Int32FromUint8('0')) goto _24 _24: + ; if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Fshend { v27 = f + 8 v26 = *(*uintptr)(unsafe.Pointer(v27)) @@ -27233,6 +27312,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) (r uint x = x<= 0 { (*TFILE)(unsafe.Pointer(f)).Frpos-- } @@ -27357,6 +27442,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { } goto _1 _1: + ; i++ } if !(fd != 0) { @@ -27371,6 +27457,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { } goto _3 _3: + ; j /= uint32(10) i++ } @@ -27384,6 +27471,7 @@ func X__procfdname(tls *TLS, buf uintptr, fd uint32) { *(*int8)(unsafe.Pointer(buf + uintptr(v5))) = int8(uint32('0') + fd%uint32(10)) goto _4 _4: + ; fd /= uint32(10) } } @@ -27854,6 +27942,895 @@ func Xshmget(tls *TLS, key Tkey_t, size Tsize_t, flag int32) (r int32) { return int32(X__syscall_ret(tls, uint64(X__syscall3(tls, int64(SYS_shmget), int64(key), int64(size), int64(flag))))) } +type Tpasswd = struct { + Fpw_name uintptr + Fpw_passwd uintptr + Fpw_uid Tuid_t + Fpw_gid Tgid_t + Fpw_gecos uintptr + Fpw_dir uintptr + Fpw_shell uintptr +} + +func Xcuserid(tls *TLS, buf uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v buf=%v, (%v:)", tls, buf, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(2112) + defer tls.Free(2112) + var len1 Tsize_t + var _ /* ppw at bp+48 */ uintptr + var _ /* pw at bp+0 */ Tpasswd + var _ /* pwb at bp+56 */ [256]int64 + _ = len1 + if buf != 0 { + *(*int8)(unsafe.Pointer(buf)) = 0 + } + Xgetpwuid_r(tls, Xgeteuid(tls), bp, bp+56, uint64(2048), bp+48) + if !(*(*uintptr)(unsafe.Pointer(bp + 48)) != 0) { + return buf + } + len1 = Xstrnlen(tls, (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_name, uint64(L_cuserid)) + if len1 == uint64(L_cuserid) { + return buf + } + if !(buf != 0) { + buf = uintptr(unsafe.Pointer(&_usridbuf)) + } + Xmemcpy(tls, buf, (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_name, len1+uint64(1)) + return buf +} + +var _usridbuf [20]int8 + +func Xvwarn(tls *TLS, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v fmt=%v ap=%v, (%v:)", tls, fmt, ap, origin(2)) + } + bp := tls.Alloc(16) + defer tls.Free(16) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+284, VaList(bp+8, Xprogram_invocation_short_name)) + if fmt != 0 { + Xvfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), fmt, ap) + Xfputs(tls, __ccgo_ts+289, uintptr(unsafe.Pointer(&X__stderr_FILE))) + } + Xperror(tls, uintptr(0)) +} + +func Xvwarnx(tls *TLS, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v fmt=%v ap=%v, (%v:)", tls, fmt, ap, origin(2)) + } + bp := tls.Alloc(16) + defer tls.Free(16) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+284, VaList(bp+8, Xprogram_invocation_short_name)) + if fmt != 0 { + Xvfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), fmt, ap) + } + Xputc(tls, int32('\n'), uintptr(unsafe.Pointer(&X__stderr_FILE))) +} + +func Xverr(tls *TLS, status int32, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v ap=%v, (%v:)", tls, status, fmt, ap, origin(2)) + } + Xvwarn(tls, fmt, ap) + _exit(tls, status) +} + +func Xverrx(tls *TLS, status int32, fmt uintptr, ap Tva_list) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v ap=%v, (%v:)", tls, status, fmt, ap, origin(2)) + } + Xvwarnx(tls, fmt, ap) + _exit(tls, status) +} + +func Xwarn(tls *TLS, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v fmt=%v va=%v, (%v:)", tls, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xvwarn(tls, fmt, ap) + _ = ap +} + +func Xwarnx(tls *TLS, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v fmt=%v va=%v, (%v:)", tls, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xvwarnx(tls, fmt, ap) + _ = ap +} + +func Xerr(tls *TLS, status int32, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v va=%v, (%v:)", tls, status, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xverr(tls, status, fmt, ap) + _ = ap +} + +func Xerrx(tls *TLS, status int32, fmt uintptr, va uintptr) { + if __ccgo_strace { + trc("tls=%v status=%v fmt=%v va=%v, (%v:)", tls, status, fmt, va, origin(2)) + } + var ap Tva_list + _ = ap + ap = va + Xverrx(tls, status, fmt, ap) + _ = ap +} + +func Xeuidaccess(tls *TLS, filename uintptr, amode int32) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v amode=%v, (%v:)", tls, filename, amode, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xfaccessat(tls, -int32(100), filename, amode, int32(AT_EACCESS)) +} + +func Xeaccess(tls *TLS, filename uintptr, amode int32) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v amode=%v, (%v:)", tls, filename, amode, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xeuidaccess(tls, filename, amode) +} + +const FTW_CHDIR = 4 +const FTW_D = 2 +const FTW_DEPTH = 8 +const FTW_DNR = 3 +const FTW_DP = 6 +const FTW_F = 1 +const FTW_MOUNT = 2 +const FTW_NS = 4 +const FTW_PHYS = 1 +const FTW_SL = 5 +const FTW_SLN = 7 + +type TFTW = struct { + Fbase int32 + Flevel int32 +} + +func Xftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32) (r int32) { + if __ccgo_strace { + trc("tls=%v path=%v fn=%v fd_limit=%v, (%v:)", tls, path, fn, fd_limit, origin(2)) + defer func() { trc("-> %v", r) }() + } + /* The following cast assumes that calling a function with one + * argument more than it needs behaves as expected. This is + * actually undefined, but works on all real-world machines. */ + return Xnftw(tls, path, fn, fd_limit, int32(FTW_PHYS)) +} + +const STATX_ALL = 4095 +const STATX_ATIME = 32 +const STATX_BASIC_STATS = 2047 +const STATX_BLOCKS = 1024 +const STATX_BTIME = 2048 +const STATX_CTIME = 128 +const STATX_GID = 16 +const STATX_INO = 256 +const STATX_MODE = 2 +const STATX_MTIME = 64 +const STATX_NLINK = 4 +const STATX_SIZE = 512 +const STATX_TYPE = 1 +const STATX_UID = 8 +const S_IEXEC = 64 +const S_IREAD = 256 +const S_IWRITE = 128 + +type Tstatx_timestamp = struct { + Ftv_sec Tint64_t + Ftv_nsec Tuint32_t + F__pad Tuint32_t +} + +type Tstatx = struct { + Fstx_mask Tuint32_t + Fstx_blksize Tuint32_t + Fstx_attributes Tuint64_t + Fstx_nlink Tuint32_t + Fstx_uid Tuint32_t + Fstx_gid Tuint32_t + Fstx_mode Tuint16_t + F__pad0 [1]Tuint16_t + Fstx_ino Tuint64_t + Fstx_size Tuint64_t + Fstx_blocks Tuint64_t + Fstx_attributes_mask Tuint64_t + Fstx_atime Tstatx_timestamp + Fstx_btime Tstatx_timestamp + Fstx_ctime Tstatx_timestamp + Fstx_mtime Tstatx_timestamp + Fstx_rdev_major Tuint32_t + Fstx_rdev_minor Tuint32_t + Fstx_dev_major Tuint32_t + Fstx_dev_minor Tuint32_t + F__pad1 [14]Tuint64_t +} + +type Ttimezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} + +func Xfutimes(tls *TLS, fd int32, tv uintptr) (r int32) { + if __ccgo_strace { + trc("tls=%v fd=%v tv=%v, (%v:)", tls, fd, tv, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(32) + defer tls.Free(32) + var _ /* times at bp+0 */ [2]Ttimespec + if !(tv != 0) { + return Xfutimens(tls, fd, uintptr(0)) + } + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_usec * int64(1000) + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_usec * int64(1000) + return Xfutimens(tls, fd, bp) +} + +const prlimit64 = 0 + +func Xgetdtablesize(tls *TLS) (r int32) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(16) + defer tls.Free(16) + var v1 uint64 + var _ /* rl at bp+0 */ Trlimit + _ = v1 + Xgetrlimit(tls, int32(RLIMIT_NOFILE), bp) + if (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur < uint64(INT_MAX) { + v1 = (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur + } else { + v1 = uint64(INT_MAX) + } + return int32(v1) +} + +func Xgetloadavg(tls *TLS, a uintptr, n int32) (r int32) { + if __ccgo_strace { + trc("tls=%v a=%v n=%v, (%v:)", tls, a, n, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(368) + defer tls.Free(368) + var i, v1 int32 + var _ /* si at bp+0 */ Tsysinfo + _, _ = i, v1 + if n <= 0 { + if n != 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 + } + Xsysinfo(tls, bp) + if n > int32(3) { + n = int32(3) + } + i = 0 + for { + if !(i < n) { + break + } + *(*float64)(unsafe.Pointer(a + uintptr(i)*8)) = Float64FromFloat64(1) / float64(Int32FromInt32(1)< %v", r) }() + } + return int32(X__libc.Fpage_size) +} + +const B0 = 0 +const B1000000 = 4104 +const B110 = 3 +const B115200 = 4098 +const B1152000 = 4105 +const B1200 = 9 +const B134 = 4 +const B150 = 5 +const B1500000 = 4106 +const B1800 = 10 +const B19200 = 14 +const B200 = 6 +const B2000000 = 4107 +const B230400 = 4099 +const B2400 = 11 +const B2500000 = 4108 +const B300 = 7 +const B3000000 = 4109 +const B3500000 = 4110 +const B38400 = 15 +const B4000000 = 4111 +const B460800 = 4100 +const B4800 = 12 +const B50 = 1 +const B500000 = 4101 +const B57600 = 4097 +const B576000 = 4102 +const B600 = 8 +const B75 = 2 +const B921600 = 4103 +const B9600 = 13 +const BRKINT = 2 +const BS0 = 0 +const BS1 = 8192 +const BSDLY = 8192 +const CBAUD = 4111 +const CBAUDEX = 4096 +const CIBAUD = 269418496 +const CLOCAL = 2048 +const CMSPAR = 1073741824 +const CR0 = 0 +const CR1 = 512 +const CR2 = 1024 +const CR3 = 1536 +const CRDLY = 1536 +const CREAD = 128 +const CRTSCTS = 2147483648 +const CS5 = 0 +const CS6 = 16 +const CS7 = 32 +const CS8 = 48 +const CSIZE = 48 +const CSTOPB = 64 +const ECHO = 8 +const ECHOCTL = 512 +const ECHOE = 16 +const ECHOK = 32 +const ECHOKE = 2048 +const ECHONL = 64 +const ECHOPRT = 1024 +const EXTA = 14 +const EXTB = 15 +const EXTPROC = 65536 +const FF0 = 0 +const FF1 = 32768 +const FFDLY = 32768 +const FLUSHO = 4096 +const HUPCL = 1024 +const ICANON = 2 +const ICRNL = 256 +const IEXTEN = 32768 +const IGNBRK = 1 +const IGNCR = 128 +const IGNPAR = 4 +const IMAXBEL = 8192 +const INLCR = 64 +const INPCK = 16 +const ISIG = 1 +const ISTRIP = 32 +const IUCLC = 512 +const IUTF8 = 16384 +const IXANY = 2048 +const IXOFF = 4096 +const IXON = 1024 +const NCCS = 32 +const NL0 = 0 +const NL1 = 256 +const NLDLY = 256 +const NOFLSH = 128 +const OCRNL = 8 +const OFDEL = 128 +const OFILL = 64 +const OLCUC = 2 +const ONLCR = 4 +const ONLRET = 32 +const ONOCR = 16 +const OPOST = 1 +const PARENB = 256 +const PARMRK = 8 +const PARODD = 512 +const PENDIN = 16384 +const TAB0 = 0 +const TAB1 = 2048 +const TAB2 = 4096 +const TAB3 = 6144 +const TABDLY = 6144 +const TCIFLUSH = 0 +const TCIOFF = 2 +const TCIOFLUSH = 2 +const TCION = 3 +const TCOFLUSH = 1 +const TCOOFF = 0 +const TCOON = 1 +const TCSADRAIN = 1 +const TCSAFLUSH = 2 +const TCSANOW = 0 +const TOSTOP = 256 +const VDISCARD = 13 +const VEOF = 4 +const VEOL = 11 +const VEOL2 = 16 +const VERASE = 2 +const VINTR = 0 +const VKILL = 3 +const VLNEXT = 15 +const VMIN = 6 +const VQUIT = 1 +const VREPRINT = 12 +const VSTART = 8 +const VSTOP = 9 +const VSUSP = 10 +const VSWTC = 7 +const VT0 = 0 +const VT1 = 16384 +const VTDLY = 16384 +const VTIME = 5 +const VWERASE = 14 +const XCASE = 4 +const XTABS = 6144 + +type Twinsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} + +type Tcc_t = uint8 + +type Tspeed_t = uint32 + +type Ttcflag_t = uint32 + +type Ttermios = struct { + Fc_iflag Ttcflag_t + Fc_oflag Ttcflag_t + Fc_cflag Ttcflag_t + Fc_lflag Ttcflag_t + Fc_line Tcc_t + Fc_cc [32]Tcc_t + F__c_ispeed Tspeed_t + F__c_ospeed Tspeed_t +} + +func Xgetpass(tls *TLS, prompt uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v prompt=%v, (%v:)", tls, prompt, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(144) + defer tls.Free(144) + var fd, v1 int32 + var l Tssize_t + var v2 uintptr + var _ /* s at bp+0 */ Ttermios + var _ /* t at bp+60 */ Ttermios + _, _, _, _ = fd, l, v1, v2 + v1 = Xopen(tls, __ccgo_ts+292, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) + fd = v1 + if v1 < 0 { + return uintptr(0) + } + Xtcgetattr(tls, fd, bp+60) + *(*Ttermios)(unsafe.Pointer(bp)) = *(*Ttermios)(unsafe.Pointer(bp + 60)) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_lflag &= uint32(^(Int32FromInt32(ECHO) | Int32FromInt32(ISIG))) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_lflag |= uint32(ICANON) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_iflag &= uint32(^(Int32FromInt32(INLCR) | Int32FromInt32(IGNCR))) + (*(*Ttermios)(unsafe.Pointer(bp + 60))).Fc_iflag |= uint32(ICRNL) + Xtcsetattr(tls, fd, int32(TCSAFLUSH), bp+60) + Xtcdrain(tls, fd) + Xdprintf(tls, fd, __ccgo_ts+15, VaList(bp+128, prompt)) + l = Xread(tls, fd, uintptr(unsafe.Pointer(&_password)), uint64(128)) + if l >= 0 { + if l > 0 && int32(_password[l-int64(1)]) == int32('\n') || uint64(l) == uint64(128) { + l-- + } + _password[l] = 0 + } + Xtcsetattr(tls, fd, int32(TCSAFLUSH), bp) + Xdprintf(tls, fd, __ccgo_ts+301, 0) + Xclose(tls, fd) + if l < 0 { + v2 = uintptr(0) + } else { + v2 = uintptr(unsafe.Pointer(&_password)) + } + return v2 +} + +var _password [128]int8 + +var _defshells = [18]int8{'/', 'b', 'i', 'n', '/', 's', 'h', 10, '/', 'b', 'i', 'n', '/', 'c', 's', 'h', 10} + +var _line uintptr +var _linesize Tsize_t +var _f uintptr + +func Xendusershell(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + if _f != 0 { + Xfclose(tls, _f) + } + _f = uintptr(0) +} + +func Xsetusershell(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + if !(_f != 0) { + _f = Xfopen(tls, __ccgo_ts+303, __ccgo_ts+315) + } + if !(_f != 0) { + _f = Xfmemopen(tls, uintptr(unsafe.Pointer(&_defshells)), Uint64FromInt64(18)-Uint64FromInt32(1), __ccgo_ts+319) + } +} + +func Xgetusershell(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + var l Tssize_t + _ = l + if !(_f != 0) { + Xsetusershell(tls) + } + if !(_f != 0) { + return uintptr(0) + } + l = Xgetline(tls, uintptr(unsafe.Pointer(&_line)), uintptr(unsafe.Pointer(&_linesize)), _f) + if l <= 0 { + return uintptr(0) + } + if int32(*(*int8)(unsafe.Pointer(_line + uintptr(l-int64(1))))) == int32('\n') { + *(*int8)(unsafe.Pointer(_line + uintptr(l-int64(1)))) = 0 + } + return _line +} + +const ANYMARK = 1 +const FLUSHBAND = 4 +const FLUSHR = 1 +const FLUSHRW = 3 +const FLUSHW = 2 +const FMNAMESZ = 8 +const I_ATMARK = 21279 +const I_CANPUT = 21282 +const I_CKBAND = 21277 +const I_FDINSERT = 21264 +const I_FIND = 21259 +const I_FLUSH = 21253 +const I_FLUSHBAND = 21276 +const I_GETBAND = 21278 +const I_GETCLTIME = 21281 +const I_GETSIG = 21258 +const I_GRDOPT = 21255 +const I_GWROPT = 21268 +const I_LINK = 21260 +const I_LIST = 21269 +const I_LOOK = 21252 +const I_NREAD = 21249 +const I_PEEK = 21263 +const I_PLINK = 21270 +const I_POP = 21251 +const I_PUNLINK = 21271 +const I_PUSH = 21250 +const I_RECVFD = 21262 +const I_SENDFD = 21265 +const I_SETCLTIME = 21280 +const I_SETSIG = 21257 +const I_SRDOPT = 21254 +const I_STR = 21256 +const I_SWROPT = 21267 +const I_UNLINK = 21261 +const LASTMARK = 2 +const MORECTL = 1 +const MOREDATA = 2 +const MSG_ANY = 2 +const MSG_BAND = 4 +const MSG_HIPRI = 1 +const MUXID_ALL = -1 +const RMSGD = 1 +const RMSGN = 2 +const RNORM = 0 +const RPROTDAT = 4 +const RPROTDIS = 8 +const RPROTMASK = 28 +const RPROTNORM = 16 +const RS_HIPRI = 1 +const SNDPIPE = 2 +const SNDZERO = 1 +const S_BANDURG = 512 +const S_ERROR = 16 +const S_HANGUP = 32 +const S_HIPRI = 2 +const S_INPUT = 1 +const S_MSG = 8 +const S_OUTPUT = 4 +const S_RDBAND = 128 +const S_RDNORM = 64 +const S_WRBAND = 256 +const S_WRNORM = 4 +const __SID = 21248 + +type Tbandinfo = struct { + Fbi_pri uint8 + Fbi_flag int32 +} + +type Tstrbuf = struct { + Fmaxlen int32 + Flen1 int32 + Fbuf uintptr +} + +type Tstrpeek = struct { + Fctlbuf Tstrbuf + Fdatabuf Tstrbuf + Fflags uint32 +} + +type Tstrfdinsert = struct { + Fctlbuf Tstrbuf + Fdatabuf Tstrbuf + Fflags uint32 + Ffildes int32 + Foffset int32 +} + +type Tstrioctl = struct { + Fic_cmd int32 + Fic_timout int32 + Fic_len int32 + Fic_dp uintptr +} + +type Tstrrecvfd = struct { + Ffd int32 + Fuid int32 + Fgid int32 + F__fill [8]int8 +} + +type Tstr_mlist = struct { + Fl_name [9]int8 +} + +type Tstr_list = struct { + Fsl_nmods int32 + Fsl_modlist uintptr +} + +func Xisastream(tls *TLS, fd int32) (r int32) { + if __ccgo_strace { + trc("tls=%v fd=%v, (%v:)", tls, fd, origin(2)) + defer func() { trc("-> %v", r) }() + } + var v1 int32 + _ = v1 + if Xfcntl(tls, fd, int32(F_GETFD), 0) < 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 +} + +func Xlutimes(tls *TLS, filename uintptr, tv uintptr) (r int32) { + if __ccgo_strace { + trc("tls=%v filename=%v tv=%v, (%v:)", tls, filename, tv, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(32) + defer tls.Free(32) + var v1 uintptr + var _ /* times at bp+0 */ [2]Ttimespec + _ = v1 + if tv != 0 { + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[0].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv))).Ftv_usec * int64(1000) + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_sec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_sec + (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[int32(1)].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(tv + 1*16))).Ftv_usec * int64(1000) + } + if tv != 0 { + v1 = bp + } else { + v1 = uintptr(0) + } + return Xutimensat(tls, -int32(100), filename, v1, int32(AT_SYMLINK_NOFOLLOW)) +} + +const UL_GETFSIZE = 1 +const UL_SETFSIZE = 2 + +func Xulimit(tls *TLS, cmd int32, va uintptr) (r int64) { + if __ccgo_strace { + trc("tls=%v cmd=%v va=%v, (%v:)", tls, cmd, va, origin(2)) + defer func() { trc("-> %v", r) }() + } + bp := tls.Alloc(16) + defer tls.Free(16) + var ap Tva_list + var val int64 + var _ /* rl at bp+0 */ Trlimit + _, _ = ap, val + Xgetrlimit(tls, int32(RLIMIT_FSIZE), bp) + if cmd == int32(UL_SETFSIZE) { + ap = va + val = VaInt64(&ap) + _ = ap + (*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur = uint64(512) * uint64(val) + if Xsetrlimit(tls, int32(RLIMIT_FSIZE), bp) != 0 { + return int64(-int32(1)) + } + } + return int64((*(*Trlimit)(unsafe.Pointer(bp))).Frlim_cur / uint64(512)) +} + +const BOOT_TIME = 2 +const DEAD_PROCESS = 8 +const EMPTY = 0 +const INIT_PROCESS = 5 +const LOGIN_PROCESS = 6 +const NEW_TIME = 3 +const OLD_TIME = 4 +const RUN_LVL = 1 +const USER_PROCESS = 7 +const e_exit = 0 +const e_termination = 0 + +type Tutmpx = struct { + Fut_type int16 + F__ut_pad1 int16 + Fut_pid Tpid_t + Fut_line [32]int8 + Fut_id [4]int8 + Fut_user [32]int8 + Fut_host [256]int8 + Fut_exit struct { + F__e_termination int16 + F__e_exit int16 + } + Fut_session int32 + F__ut_pad2 int32 + Fut_tv Ttimeval + Fut_addr_v6 [4]uint32 + F__unused [20]int8 +} + +func Xendutxent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } +} + +func Xsetutxent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } +} + +func Xgetutxent(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xgetutxid(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xgetutxline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xpututxline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return UintptrFromInt32(0) +} + +func Xupdwtmpx(tls *TLS, f uintptr, u uintptr) { + if __ccgo_strace { + trc("tls=%v f=%v u=%v, (%v:)", tls, f, u, origin(2)) + } +} + +func ___utmpxname(tls *TLS, f uintptr) (r int32) { + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOPNOTSUPP) + return -int32(1) +} + +func Xendutent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + Xendutxent(tls) +} + +func Xgetutent(tls *TLS) (r uintptr) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxent(tls) +} + +func Xgetutid(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxid(tls, ut) +} + +func Xgetutline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xgetutxline(tls, ut) +} + +func Xpututline(tls *TLS, ut uintptr) (r uintptr) { + if __ccgo_strace { + trc("tls=%v ut=%v, (%v:)", tls, ut, origin(2)) + defer func() { trc("-> %v", r) }() + } + return Xpututxline(tls, ut) +} + +func Xsetutent(tls *TLS) { + if __ccgo_strace { + trc("tls=%v, (%v:)", tls, origin(2)) + } + Xsetutxent(tls) +} + +func Xupdwtmp(tls *TLS, f uintptr, u uintptr) { + if __ccgo_strace { + trc("tls=%v f=%v u=%v, (%v:)", tls, f, u, origin(2)) + } + Xupdwtmpx(tls, f, u) +} + const ADJ_ESTERROR = 8 const ADJ_FREQUENCY = 2 const ADJ_MAXERROR = 4 @@ -27904,11 +28881,6 @@ const TIME_OK = 0 const TIME_OOP = 3 const TIME_WAIT = 4 -type Ttimezone = struct { - Ftz_minuteswest int32 - Ftz_dsttime int32 -} - type Tntptimeval = struct { Ftime Ttimeval Fmaxerror int64 @@ -28869,13 +29841,6 @@ const _IOC_NONE = 0 const _IOC_READ = 2 const _IOC_WRITE = 1 -type Twinsize = struct { - Fws_row uint16 - Fws_col uint16 - Fws_xpixel uint16 - Fws_ypixel uint16 -} - func Xmount(tls *TLS, special uintptr, dir uintptr, fstype uintptr, flags uint64, data uintptr) (r int32) { if __ccgo_strace { trc("tls=%v special=%v dir=%v fstype=%v flags=%v data=%v, (%v:)", tls, special, dir, fstype, flags, data, origin(2)) @@ -29137,6 +30102,7 @@ func Xprctl(tls *TLS, op int32, va uintptr) (r int32) { x[i] = VaUint64(&ap) goto _1 _1: + ; i++ } _ = ap @@ -29164,8 +30130,6 @@ func Xpreadv2(tls *TLS, fd int32, iov uintptr, count int32, ofs Toff_t, flags in return X__syscall_ret(tls, uint64(___syscall_cp(tls, int64(SYS_preadv2), int64(fd), int64(iov), int64(count), ofs, ofs>>Int32FromInt32(32), int64(flags)))) } -const prlimit64 = 0 - func Xprlimit(tls *TLS, pid Tpid_t, resource int32, new_limit uintptr, old_limit uintptr) (r1 int32) { if __ccgo_strace { trc("tls=%v pid=%v resource=%v new_limit=%v old_limit=%v, (%v:)", tls, pid, resource, new_limit, old_limit, origin(2)) @@ -29649,54 +30613,6 @@ func Xsplice(tls *TLS, fd_in int32, off_in uintptr, fd_out int32, off_out uintpt return X__syscall_ret(tls, uint64(X__syscall6(tls, int64(SYS_splice), int64(fd_in), int64(off_in), int64(fd_out), int64(off_out), int64(len1), int64(flags)))) } -const STATX_ALL = 4095 -const STATX_ATIME = 32 -const STATX_BASIC_STATS = 2047 -const STATX_BLOCKS = 1024 -const STATX_BTIME = 2048 -const STATX_CTIME = 128 -const STATX_GID = 16 -const STATX_INO = 256 -const STATX_MODE = 2 -const STATX_MTIME = 64 -const STATX_NLINK = 4 -const STATX_SIZE = 512 -const STATX_TYPE = 1 -const STATX_UID = 8 -const S_IEXEC = 64 -const S_IREAD = 256 -const S_IWRITE = 128 - -type Tstatx_timestamp = struct { - Ftv_sec Tint64_t - Ftv_nsec Tuint32_t - F__pad Tuint32_t -} - -type Tstatx = struct { - Fstx_mask Tuint32_t - Fstx_blksize Tuint32_t - Fstx_attributes Tuint64_t - Fstx_nlink Tuint32_t - Fstx_uid Tuint32_t - Fstx_gid Tuint32_t - Fstx_mode Tuint16_t - F__pad0 [1]Tuint16_t - Fstx_ino Tuint64_t - Fstx_size Tuint64_t - Fstx_blocks Tuint64_t - Fstx_attributes_mask Tuint64_t - Fstx_atime Tstatx_timestamp - Fstx_btime Tstatx_timestamp - Fstx_ctime Tstatx_timestamp - Fstx_mtime Tstatx_timestamp - Fstx_rdev_major Tuint32_t - Fstx_rdev_minor Tuint32_t - Fstx_dev_major Tuint32_t - Fstx_dev_minor Tuint32_t - F__pad1 [14]Tuint64_t -} - func Xstatx(tls *TLS, dirfd int32, path uintptr, flags int32, mask uint32, stx uintptr) (r int32) { if __ccgo_strace { trc("tls=%v dirfd=%v path=%v flags=%v mask=%v stx=%v, (%v:)", tls, dirfd, path, flags, mask, stx, origin(2)) @@ -30134,7 +31050,7 @@ func Xbind_textdomain_codeset(tls *TLS, domainname uintptr, codeset uintptr) (r trc("tls=%v domainname=%v codeset=%v, (%v:)", tls, domainname, codeset, origin(2)) defer func() { trc("-> %v", r) }() } - if codeset != 0 && Xstrcasecmp(tls, codeset, __ccgo_ts+284) != 0 { + if codeset != 0 && Xstrcasecmp(tls, codeset, __ccgo_ts+322) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) } return UintptrFromInt32(0) @@ -30372,7 +31288,7 @@ func Xcatopen(tls *TLS, name uintptr, oflag int32) (r Tnl_catd) { return _do_catopen(tls, name) } if v2 = X__libc.Fsecure != 0; !v2 { - v1 = Xgetenv(tls, __ccgo_ts+290) + v1 = Xgetenv(tls, __ccgo_ts+328) path = v1 } if v2 || !(v1 != 0) { @@ -30382,7 +31298,7 @@ func Xcatopen(tls *TLS, name uintptr, oflag int32) (r Tnl_catd) { if oflag != 0 { v3 = Xnl_langinfo(tls, Int32FromInt32(LC_MESSAGES)<= uint32(128) { goto ilseq } goto _23 _4: + ; l = uint64(4) if *(*Tsize_t)(unsafe.Pointer(inb)) < l { goto starved @@ -97425,21 +98359,28 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto _24 } _6: + ; _5: + ; l = uint64(4) if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(4) { goto starved } c = _get_32(tls, *(*uintptr)(unsafe.Pointer(in)), int32(type1)) _24: + ; if c-uint32(0xd800) < uint32(0x800) || c >= uint32(0x110000) { goto ilseq } goto _23 _10: + ; _9: + ; _8: + ; _7: + ; l = uint64(2) if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(2) { goto starved @@ -97464,7 +98405,9 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _12: + ; _11: + ; l = uint64(0) if !((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate != 0) { if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(2) { @@ -97494,6 +98437,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui type1 = uint8((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate) goto _1 _13: + ; l = uint64(0) if !((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate != 0) { if *(*Tsize_t)(unsafe.Pointer(inb)) < uint64(4) { @@ -97513,6 +98457,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui type1 = uint8((*Tstateful_cd)(unsafe.Pointer(scd)).Fstate) goto _1 _14: + ; if c < uint32(128) { goto _23 } @@ -97558,6 +98503,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _15: + ; if c < uint32(128) { goto _23 } @@ -97585,6 +98531,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _16: + ; if c >= uint32(128) { goto ilseq } @@ -97653,6 +98600,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _17: + ; if c < uint32(128) { goto _23 } @@ -97660,11 +98608,13 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto ilseq } _18: + ; if c == uint32(128) { c = uint32(0x20ac) goto _23 } _19: + ; if c < uint32(128) { goto _23 } @@ -97721,10 +98671,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _31 _31: + ; j++ } goto _30 _30: + ; i++ } d = c + uint32(1) @@ -97741,6 +98693,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui c = uint32(*(*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(&_gb18030)) + uintptr(c)*380 + uintptr(d)*2))) goto _23 _20: + ; if c < uint32(128) { goto _23 } @@ -97772,10 +98725,10 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui * here. Ugly, yes. */ if c/uint32(256) == uint32(0xdc) { *(*uintptr)(unsafe.Pointer(bp + 48)) = bp + 40 - *(*uintptr)(unsafe.Pointer(bp)) = __ccgo_ts + 456 + uintptr(c%uint32(256)) + *(*uintptr)(unsafe.Pointer(bp)) = __ccgo_ts + 494 + uintptr(c%uint32(256)) *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(4) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(8) - tmpx = Xiconv(tls, _combine_to_from(tls, uint64(to), _find_charmap(tls, __ccgo_ts+473)), bp, bp+8, bp+48, bp+16) + tmpx = Xiconv(tls, _combine_to_from(tls, uint64(to), _find_charmap(tls, __ccgo_ts+511)), bp, bp+8, bp+48, bp+16) tmplen = uint64(int64(*(*uintptr)(unsafe.Pointer(bp + 48))) - t__predefined_ptrdiff_t(bp+40)) if tmplen > *(*Tsize_t)(unsafe.Pointer(outb)) { goto toobig @@ -97800,6 +98753,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _21: + ; if c < uint32(128) { goto _23 } @@ -97856,10 +98810,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _34 _34: + ; j1++ } goto _33 _33: + ; i1++ } d = c + uint32(1) @@ -97875,6 +98831,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _23 _22: + ; if !(c != 0) { goto _23 } @@ -97883,6 +98840,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto ilseq } _23: + ; switch int32(totype) { case int32(WCHAR_T): goto _35 @@ -97919,6 +98877,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _51 _35: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { goto toobig } @@ -97927,6 +98886,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _36: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { k = uint64(Xwctomb(tls, bp+56, int32(c))) if *(*Tsize_t)(unsafe.Pointer(outb)) < k { @@ -97940,14 +98900,18 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= k goto _51 _37: + ; if !(c > uint32(0x7f)) { goto _52 } subst: + ; x++ c = Uint32FromUint8('*') _52: + ; _38: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(1) { goto toobig } @@ -97955,6 +98919,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui goto _53 } revout: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(1) { goto toobig } @@ -97965,6 +98930,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(1) goto _51 _53: + ; d = c c = uint32(int32(4) * int32(totype)) for { @@ -97976,10 +98942,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui } goto _56 _56: + ; c++ } goto subst _39: + ; if c < uint32(128) { goto revout } @@ -98027,6 +98995,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(2) goto _51 _40: + ; if c < uint32(128) { goto revout } @@ -98052,6 +99021,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(2) goto _51 _41: + ; if c < uint32(128) { goto revout } @@ -98154,12 +99124,18 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(8) goto _51 _42: + ; totype = uint8(UCS2BE) _47: + ; _46: + ; _45: + ; _44: + ; _43: + ; if c < uint32(0x10000) || uint32(int32(totype)-int32(UCS2BE)) < uint32(2) { if c >= uint32(0x10000) { c = uint32(0xFFFD) @@ -98182,9 +99158,12 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _48: + ; totype = uint8(UTF_32BE) _50: + ; _49: + ; if *(*Tsize_t)(unsafe.Pointer(outb)) < uint64(4) { goto toobig } @@ -98193,25 +99172,31 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tsize_t)(unsafe.Pointer(outb)) -= uint64(4) goto _51 _51: + ; goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(in)) += uintptr(l) *(*Tsize_t)(unsafe.Pointer(inb)) -= l } *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc return x ilseq: + ; err = int32(EILSEQ) x = uint64(-Int32FromInt32(1)) goto end toobig: + ; err = int32(E2BIG) x = uint64(-Int32FromInt32(1)) goto end starved: + ; err = int32(EINVAL) x = uint64(-Int32FromInt32(1)) end: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = err *(*Tlocale_t)(unsafe.Pointer(ploc)) = loc return x @@ -98245,9 +99230,9 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { idx = item & int32(65535) if item == int32(CODESET) { if *(*uintptr)(unsafe.Pointer(loc)) != 0 { - v1 = __ccgo_ts + 284 + v1 = __ccgo_ts + 322 } else { - v1 = __ccgo_ts + 478 + v1 = __ccgo_ts + 516 } return v1 } @@ -98256,7 +99241,7 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { if *(*uintptr)(unsafe.Pointer(loc + uintptr(cat)*8)) != 0 { v2 = *(*uintptr)(unsafe.Pointer(loc + uintptr(cat)*8)) + 16 } else { - v2 = __ccgo_ts + 484 + v2 = __ccgo_ts + 522 } return v2 } @@ -98294,10 +99279,12 @@ func X__nl_langinfo_l(tls *TLS, item Tnl_item, loc Tlocale_t) (r uintptr) { } goto _4 _4: + ; str++ } goto _3 _3: + ; idx-- str++ } @@ -98376,18 +99363,18 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { new1 = uintptr(0) path = uintptr(0) if !(*(*int8)(unsafe.Pointer(val)) != 0) { - v1 = Xgetenv(tls, __ccgo_ts+486) + v1 = Xgetenv(tls, __ccgo_ts+524) val = v1 if v3 = v1 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v3 { v2 = Xgetenv(tls, uintptr(unsafe.Pointer(&_envvars))+uintptr(cat)*12) val = v2 } if v5 = v3 || v2 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v5 { - v4 = Xgetenv(tls, __ccgo_ts+298) + v4 = Xgetenv(tls, __ccgo_ts+336) val = v4 } if v7 = v5 || v4 != 0 && *(*int8)(unsafe.Pointer(val)) != 0; !v7 { - v6 = __ccgo_ts + 493 + v6 = __ccgo_ts + 531 val = v6 } _ = v7 || v6 != 0 @@ -98400,12 +99387,13 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _8 _8: + ; n++ } if int32(*(*int8)(unsafe.Pointer(val))) == int32('.') || *(*int8)(unsafe.Pointer(val + uintptr(n))) != 0 { - val = __ccgo_ts + 493 + val = __ccgo_ts + 531 } - builtin = BoolInt32(int32(*(*int8)(unsafe.Pointer(val))) == int32('C') && !(*(*int8)(unsafe.Pointer(val + 1)) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+493) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+501) != 0)) + builtin = BoolInt32(int32(*(*int8)(unsafe.Pointer(val))) == int32('C') && !(*(*int8)(unsafe.Pointer(val + 1)) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+531) != 0) || !(Xstrcmp(tls, val, __ccgo_ts+539) != 0)) if builtin != 0 { if cat == LC_CTYPE && int32(*(*int8)(unsafe.Pointer(val + 1))) == int32('.') { return uintptr(unsafe.Pointer(&X__c_dot_utf8)) @@ -98422,10 +99410,11 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _9 _9: + ; p = (*t__locale_map)(unsafe.Pointer(p)).Fnext } if !(X__libc.Fsecure != 0) { - path = Xgetenv(tls, __ccgo_ts+507) + path = Xgetenv(tls, __ccgo_ts+545) } /* FIXME: add a default path? */ if path != 0 { @@ -98459,6 +99448,7 @@ func X__get_locale(tls *TLS, cat int32, val uintptr) (r uintptr) { } goto _10 _10: + ; path = z + BoolUintptr(!!(*(*int8)(unsafe.Pointer(z)) != 0)) } } @@ -98498,7 +99488,7 @@ var _loc_head uintptr * from SUS and have nothing to do with the host system. */ var _posix_lconv = Tlconv{ - Fdecimal_point: __ccgo_ts + 520, + Fdecimal_point: __ccgo_ts + 558, Fthousands_sep: __ccgo_ts, Fgrouping: __ccgo_ts, Fint_curr_symbol: __ccgo_ts, @@ -98573,6 +99563,7 @@ func _do_newlocale(tls *TLS, mask int32, name uintptr, loc Tlocale_t) (r Tlocale } goto _1 _1: + ; i++ } /* For locales with allocated storage, modify in-place. */ @@ -98600,6 +99591,7 @@ func _do_newlocale(tls *TLS, mask int32, name uintptr, loc Tlocale_t) (r Tlocale *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_locale)) + uintptr(i1)*8)) = X__get_locale(tls, i1, __ccgo_ts) goto _4 _4: + ; i1++ } *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_ctype_locale)))) = *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_default_locale)))) @@ -98797,6 +99789,7 @@ func _parseop(tls *TLS, st uintptr, s uintptr) (r uintptr) { } goto _1 _1: + ; i++ } (*Tst)(unsafe.Pointer(st)).Fop = int32(13) @@ -98949,6 +99942,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { *(*uintptr)(unsafe.Pointer(bp + uintptr(i)*8)) = lm goto _1 _1: + ; i++ } X__libc.Fglobal_locale = *(*t__locale_struct)(unsafe.Pointer(bp)) @@ -98967,7 +99961,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { if lm1 != 0 { v3 = lm1 + 16 } else { - v3 = __ccgo_ts + 484 + v3 = __ccgo_ts + 522 } part1 = v3 l = Xstrlen(tls, part1) @@ -98976,6 +99970,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { s += uintptr(l + uint64(1)) goto _2 _2: + ; i++ } s-- @@ -99002,7 +99997,7 @@ func Xsetlocale(tls *TLS, cat int32, name uintptr) (r uintptr) { if lm != 0 { v6 = lm + 16 } else { - v6 = __ccgo_ts + 484 + v6 = __ccgo_ts + 522 } ret = v6 ___unlock(tls, uintptr(unsafe.Pointer(&X__locale_lock))) @@ -99043,6 +100038,7 @@ func _vstrfmon_l(tls *TLS, s uintptr, n Tsize_t, loc Tlocale_t, fmt uintptr, ap _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = fill, fw, intl, l, left, lp, negpar, nogrp, nosym, rp, s0, w, x, v12, v5, v6, v8 s0 = s _3: + ; if !(n != 0 && *(*int8)(unsafe.Pointer(fmt)) != 0) { goto _1 } @@ -99050,6 +100046,7 @@ _3: goto _4 } literal: + ; v5 = s s++ v6 = fmt @@ -99058,6 +100055,7 @@ literal: n-- goto _2 _4: + ; fmt++ if int32(*(*int8)(unsafe.Pointer(fmt))) == int32('%') { goto literal @@ -99092,6 +100090,7 @@ _4: break goto _7 _7: + ; fmt++ } fw = 0 @@ -99102,6 +100101,7 @@ _4: fw = int32(10)*fw + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _9 _9: + ; fmt++ } lp = 0 @@ -99116,6 +100116,7 @@ _4: lp = int32(10)*lp + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _10 _10: + ; fmt++ } } @@ -99129,6 +100130,7 @@ _4: rp = int32(10)*rp + (int32(*(*int8)(unsafe.Pointer(fmt))) - int32('0')) goto _11 _11: + ; fmt++ } } @@ -99140,7 +100142,7 @@ _4: w = fw } x = VaFloat64(&ap) - l = uint64(Xsnprintf(tls, s, n, __ccgo_ts+522, VaList(bp+8, w, rp, x))) + l = uint64(Xsnprintf(tls, s, n, __ccgo_ts+560, VaList(bp+8, w, rp, x))) if l >= n { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(E2BIG) return int64(-int32(1)) @@ -99149,9 +100151,11 @@ _4: n -= l goto _2 _2: + ; goto _3 goto _1 _1: + ; return int64(s) - int64(s0) } @@ -99288,7 +100292,7 @@ func X__gettextdomain(tls *TLS) (r uintptr) { if _current_domain != 0 { v1 = _current_domain } else { - v1 = __ccgo_ts + 376 + v1 = __ccgo_ts + 414 } return v1 } @@ -99899,6 +100903,7 @@ func X__rem_pio2(tls *TLS, x float64, y uintptr) (r1 int32) { goto _1 } /* |x| ~< 2^20*(pi/2), medium size */ medium: + ; /* rint(x/(pi/2)) */ fn = x*_invpio2 + _toint - _toint n = int32(fn) @@ -99941,6 +100946,7 @@ medium: *(*float64)(unsafe.Pointer(y + 1*8)) = r - *(*float64)(unsafe.Pointer(y)) - w return n _1: + ; /* * all other (large) arguments */ @@ -99964,6 +100970,7 @@ _1: z = (z - (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i]) * float64(1.6777216e+07) goto _3 _3: + ; i++ } (*(*[3]float64)(unsafe.Pointer(bp + 8)))[i] = z @@ -100124,6 +101131,7 @@ func X__rem_pio2_large(tls *TLS, x uintptr, y uintptr, e0 int32, nx int32, prec f[i] = v2 goto _1 _1: + ; i++ j++ } @@ -100142,15 +101150,18 @@ func X__rem_pio2_large(tls *TLS, x uintptr, y uintptr, e0 int32, nx int32, prec fw += *(*float64)(unsafe.Pointer(x + uintptr(j)*8)) * f[jx+i-j] goto _4 _4: + ; j++ } q[i] = fw goto _3 _3: + ; i++ } jz = jk recompute: + ; /* distill q[] into iq[] reversingly */ i = 0 j = jz @@ -100164,6 +101175,7 @@ recompute: z = q[j-int32(1)] + fw goto _5 _5: + ; i++ j-- } @@ -100206,6 +101218,7 @@ recompute: } goto _6 _6: + ; i++ } if q0 > 0 { /* rare case: chance is 1 in 12 */ @@ -100235,6 +101248,7 @@ recompute: j |= (*(*[20]Tint32_t)(unsafe.Pointer(bp)))[i] goto _7 _7: + ; i-- } if j == 0 { /* need recomputation */ @@ -100245,6 +101259,7 @@ recompute: } goto _8 _8: + ; k++ } /* k = no. of terms needed */ i = jz + int32(1) @@ -100262,11 +101277,13 @@ recompute: fw += *(*float64)(unsafe.Pointer(x + uintptr(j)*8)) * f[jx+i-j] goto _10 _10: + ; j++ } q[i] = fw goto _9 _9: + ; i++ } jz += k @@ -100304,6 +101321,7 @@ recompute: fw *= float64(5.960464477539063e-08) goto _11 _11: + ; i-- } /* compute PIo2[0,...,jp]*q[jz,...,0] */ @@ -100321,11 +101339,13 @@ recompute: fw += _PIo2[k] * q[i+k] goto _13 _13: + ; k++ } (*(*[20]float64)(unsafe.Pointer(bp + 80)))[jz-i] = fw goto _12 _12: + ; i-- } /* compress fq[] into y[] */ @@ -100341,6 +101361,7 @@ recompute: } goto _18 _14: + ; fw = float64(0) i = jz for { @@ -100350,6 +101371,7 @@ _14: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _19 _19: + ; i-- } if ih == 0 { @@ -100360,7 +101382,9 @@ _14: *(*float64)(unsafe.Pointer(y)) = v20 goto _18 _16: + ; _15: + ; fw = float64(0) i = jz for { @@ -100370,6 +101394,7 @@ _15: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _21 _21: + ; i-- } // TODO: drop excess precision here once double_t is used @@ -100389,6 +101414,7 @@ _15: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _23 _23: + ; i++ } if ih == 0 { @@ -100398,9 +101424,11 @@ _15: } *(*float64)(unsafe.Pointer(y + 1*8)) = v24 goto _18 -_17: /* painful */ +_17: + ; /* painful */ i = jz _27: + ; if !(i > 0) { goto _25 } @@ -100409,10 +101437,12 @@ _27: (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i-int32(1)] = fw goto _26 _26: + ; i-- goto _27 goto _25 _25: + ; i = jz for { if !(i > int32(1)) { @@ -100423,6 +101453,7 @@ _25: (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i-int32(1)] = fw goto _28 _28: + ; i-- } fw = float64(0) @@ -100434,6 +101465,7 @@ _25: fw += (*(*[20]float64)(unsafe.Pointer(bp + 80)))[i] goto _29 _29: + ; i-- } if ih == 0 { @@ -100446,6 +101478,7 @@ _25: *(*float64)(unsafe.Pointer(y + 2*8)) = -fw } _18: + ; return n & int32(7) } @@ -101396,6 +102429,7 @@ func Xatan2(tls *TLS, y float64, x float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)< uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = y v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -104754,6 +105789,7 @@ func Xfmod(tls *TLS, x float64, y float64) (r float64) { } goto _4 _4: + ; ex-- i <<= uint64(1) } @@ -104770,6 +105806,7 @@ func Xfmod(tls *TLS, x float64, y float64) (r float64) { } goto _5 _5: + ; ey-- i <<= uint64(1) } @@ -104795,6 +105832,7 @@ func Xfmod(tls *TLS, x float64, y float64) (r float64) { uxi <<= uint64(1) goto _8 _8: + ; ex-- } i = uxi - *(*Tuint64_t)(unsafe.Pointer(bp + 16)) @@ -104810,6 +105848,7 @@ func Xfmod(tls *TLS, x float64, y float64) (r float64) { } goto _9 _9: + ; uxi <<= uint64(1) ex-- } @@ -104893,6 +105932,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _4 _4: + ; ex-- i <<= uint32(1) } @@ -104909,6 +105949,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _5 _5: + ; ey-- i <<= uint32(1) } @@ -104932,6 +105973,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { uxi <<= uint32(1) goto _6 _6: + ; ex-- } i = uxi - *(*Tuint32_t)(unsafe.Pointer(bp + 8)) @@ -104947,6 +105989,7 @@ func Xfmodf(tls *TLS, x float32, y float32) (r float32) { } goto _7 _7: + ; uxi <<= uint32(1) ex-- } @@ -105314,6 +106357,7 @@ func Xilogb(tls *TLS, x float64) (r int32) { } goto _1 _1: + ; e-- i <<= uint64(1) } @@ -105387,6 +106431,7 @@ func Xilogbf(tls *TLS, x float32) (r int32) { } goto _1 _1: + ; e-- i <<= uint32(1) } @@ -106889,6 +107934,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { b *= temp /* b = (x/2)^n */ goto _2 _2: + ; i++ } b = b / a @@ -106917,6 +107963,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { t = Float64FromInt32(1) / (Float64FromInt32(2)*(float64(i)+nf)/x - t) goto _3 _3: + ; i-- } a = t @@ -106941,6 +107988,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { a = temp goto _4 _4: + ; i-- } } else { @@ -106960,6 +108008,7 @@ func Xjn(tls *TLS, n int32, x float64) (r float64) { } goto _5 _5: + ; i-- } } @@ -107148,6 +108197,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { b *= temp /* b = (x/2)^n */ goto _2 _2: + ; i++ } b = b / a @@ -107175,6 +108225,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { t = Float32FromFloat32(1) / (Float32FromInt32(2)*(float32(i)+nf)/x - t) goto _3 _3: + ; i-- } a = t @@ -107199,6 +108250,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { a = temp goto _4 _4: + ; i-- } } else { @@ -107218,6 +108270,7 @@ func Xjnf(tls *TLS, n int32, x float32) (r float32) { } goto _5 _5: + ; i-- } } @@ -109108,6 +110161,7 @@ func Xnextafter(tls *TLS, x float64, y3 float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)< uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = y3 v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -109315,6 +110370,7 @@ func Xnexttowardf(tls *TLS, x float32, y3 float64) (r float32) { v1 = *(*uint32)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0; !v5 { *(*float64)(unsafe.Pointer(bp + 8)) = y3 v3 = *(*uint64)(unsafe.Pointer(bp + 8)) @@ -109395,7 +110451,6 @@ func Xnexttowardl(tls *TLS, x float64, y float64) (r float64) { return Xnextafterl(tls, x, y) } -const N9 = 128 const OFF2 = 4604531861337669632 const POW_LOG_POLY_ORDER = 8 const POW_LOG_TABLE_BITS = 7 @@ -109770,6 +110825,8 @@ func Xpow(tls *TLS, x float64, y1 float64) (r float64) { return _exp_inline(tls, ehi, elo, sign_bias) } +const N9 = 128 + type Tpow_log_data = struct { Fln2hi float64 Fln2lo float64 @@ -109782,7 +110839,6 @@ type Tpow_log_data = struct { } } -const N10 = 32 const OFF3 = 1060306944 const POWF_LOG2_POLY_ORDER = 5 const POWF_LOG2_TABLE_BITS = 4 @@ -110125,6 +111181,7 @@ func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { } goto _4 _4: + ; ex-- i <<= uint64(1) } @@ -110141,6 +111198,7 @@ func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { } goto _5 _5: + ; ey-- i <<= uint64(1) } @@ -110172,6 +111230,7 @@ func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { q <<= uint32(1) goto _8 _8: + ; ex-- } i = uxi - *(*Tuint64_t)(unsafe.Pointer(bp + 16)) @@ -110188,11 +111247,13 @@ func Xremquo(tls *TLS, x float64, y float64, quo uintptr) (r float64) { } goto _9 _9: + ; uxi <<= uint64(1) ex-- } } end: + ; /* scale result and decide between |x| and |x|-|y| */ if ex > 0 { uxi = uxi - Uint64FromUint64(1)< 0 { uxi -= Uint32FromUint32(1) << Int32FromInt32(23) @@ -110660,6 +111726,7 @@ func Xscalb(tls *TLS, x float64, fn float64) (r float64) { v1 = *(*uint64)(unsafe.Pointer(bp)) goto _2 _2: + ; if v5 = BoolInt32(v1&(-Uint64FromUint64(1)>>Int32FromInt32(1)) > Uint64FromUint64(0x7ff)< uint32(0x7f800000)) != 0; !v5 { *(*float32)(unsafe.Pointer(bp)) = fn v3 = *(*uint32)(unsafe.Pointer(bp)) @@ -112021,7 +113089,7 @@ func Xtanl(tls *TLS, x float64) (r float64) { return Xtan(tls, x) } -const N11 = 12 +const N10 = 12 var _pi4 = float64(3.141592653589793) @@ -112129,7 +113197,7 @@ func _S(tls *TLS, x float64) (r float64) { den = Float64FromInt32(0) /* to avoid overflow handle large x differently */ if x < Float64FromInt32(8) { - i = int32(N11) + i = int32(N10) for { if !(i >= 0) { break @@ -112138,18 +113206,20 @@ func _S(tls *TLS, x float64) (r float64) { den = den*x + _Sden[i] goto _1 _1: + ; i-- } } else { i = 0 for { - if !(i <= int32(N11)) { + if !(i <= int32(N10)) { break } num = num/x + _Snum[i] den = den/x + _Sden[i] goto _2 _2: + ; i++ } } @@ -112397,6 +113467,7 @@ func Xa64l(tls *TLS, s uintptr) (r int64) { x |= uint32(int64(d)-t__predefined_ptrdiff_t(uintptr(unsafe.Pointer(&_digits)))) << e goto _1 _1: + ; e += int32(6) s++ } @@ -112420,6 +113491,7 @@ func Xl64a(tls *TLS, x0 int64) (r uintptr) { *(*int8)(unsafe.Pointer(p)) = _digits[x&uint32(63)] goto _1 _1: + ; p++ x >>= uint32(6) } @@ -112437,7 +113509,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { var i Tsize_t _ = i if !(s != 0) || !(*(*int8)(unsafe.Pointer(s)) != 0) { - return __ccgo_ts + 520 + return __ccgo_ts + 558 } i = Xstrlen(tls, s) - uint64(1) for { @@ -112447,6 +113519,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(s + uintptr(i))) = 0 goto _1 _1: + ; i-- } for { @@ -112455,6 +113528,7 @@ func Xbasename(tls *TLS, s uintptr) (r uintptr) { } goto _2 _2: + ; i-- } return s + uintptr(i) @@ -112476,7 +113550,7 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { var i Tsize_t _ = i if !(s != 0) || !(*(*int8)(unsafe.Pointer(s)) != 0) { - return __ccgo_ts + 520 + return __ccgo_ts + 558 } i = Xstrlen(tls, s) - uint64(1) for { @@ -112484,10 +113558,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 528 + return __ccgo_ts + 566 } goto _1 _1: + ; i-- } for { @@ -112495,10 +113570,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 520 + return __ccgo_ts + 558 } goto _2 _2: + ; i-- } for { @@ -112506,10 +113582,11 @@ func Xdirname(tls *TLS, s uintptr) (r uintptr) { break } if !(i != 0) { - return __ccgo_ts + 528 + return __ccgo_ts + 566 } goto _3 _3: + ; i-- } *(*int8)(unsafe.Pointer(s + uintptr(i+uint64(1)))) = 0 @@ -112627,33 +113704,33 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text ret = 0 verb = 0 errstring = uintptr(MM_NULLSEV) - cmsg = Xgetenv(tls, __ccgo_ts+530) + cmsg = Xgetenv(tls, __ccgo_ts+568) msgs = [6]uintptr{ - 0: __ccgo_ts + 538, - 1: __ccgo_ts + 544, - 2: __ccgo_ts + 553, - 3: __ccgo_ts + 558, - 4: __ccgo_ts + 565, + 0: __ccgo_ts + 576, + 1: __ccgo_ts + 582, + 2: __ccgo_ts + 591, + 3: __ccgo_ts + 596, + 4: __ccgo_ts + 603, 5: UintptrFromInt32(0), } _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp) if severity == int32(MM_HALT) { - errstring = __ccgo_ts + 569 + errstring = __ccgo_ts + 607 } else { if severity == int32(MM_ERROR) { - errstring = __ccgo_ts + 576 + errstring = __ccgo_ts + 614 } else { if severity == int32(MM_WARNING) { - errstring = __ccgo_ts + 584 + errstring = __ccgo_ts + 622 } else { if severity == int32(MM_INFO) { - errstring = __ccgo_ts + 594 + errstring = __ccgo_ts + 632 } } } } if classification&int64(MM_CONSOLE) != 0 { - consolefd = Xopen(tls, __ccgo_ts+601, int32(O_WRONLY), 0) + consolefd = Xopen(tls, __ccgo_ts+639, int32(O_WRONLY), 0) if consolefd < 0 { ret = int32(MM_NOCON) } else { @@ -112663,7 +113740,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v1 = __ccgo_ts } if label != 0 { - v2 = __ccgo_ts + 614 + v2 = __ccgo_ts + 289 } else { v2 = __ccgo_ts } @@ -112678,7 +113755,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v4 = __ccgo_ts } if action != 0 { - v5 = __ccgo_ts + 617 + v5 = __ccgo_ts + 652 } else { v5 = __ccgo_ts } @@ -112688,7 +113765,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v6 = __ccgo_ts } if action != 0 { - v7 = __ccgo_ts + 627 + v7 = __ccgo_ts + 662 } else { v7 = __ccgo_ts } @@ -112697,7 +113774,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } else { v8 = __ccgo_ts } - if Xdprintf(tls, consolefd, __ccgo_ts+629, VaList(bp+16, v1, v2, v3, v4, v5, v6, v7, v8)) < int32(1) { + if Xdprintf(tls, consolefd, __ccgo_ts+664, VaList(bp+16, v1, v2, v3, v4, v5, v6, v7, v8)) < int32(1) { ret = int32(MM_NOCON) } Xclose(tls, consolefd) @@ -112715,6 +113792,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } goto _9 _9: + ; i++ } if msgs[i] == UintptrFromInt32(0) { @@ -112738,7 +113816,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v10 = __ccgo_ts } if verb&int32(1) != 0 && label != 0 { - v11 = __ccgo_ts + 614 + v11 = __ccgo_ts + 289 } else { v11 = __ccgo_ts } @@ -112753,7 +113831,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v13 = __ccgo_ts } if verb&int32(8) != 0 && action != 0 { - v14 = __ccgo_ts + 617 + v14 = __ccgo_ts + 652 } else { v14 = __ccgo_ts } @@ -112763,7 +113841,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text v15 = __ccgo_ts } if verb&int32(8) != 0 && action != 0 { - v16 = __ccgo_ts + 627 + v16 = __ccgo_ts + 662 } else { v16 = __ccgo_ts } @@ -112772,7 +113850,7 @@ func Xfmtmsg(tls *TLS, classification int64, label uintptr, severity int32, text } else { v17 = __ccgo_ts } - if Xdprintf(tls, int32(2), __ccgo_ts+629, VaList(bp+16, v10, v11, v12, v13, v14, v15, v16, v17)) < int32(1) { + if Xdprintf(tls, int32(2), __ccgo_ts+664, VaList(bp+16, v10, v11, v12, v13, v14, v15, v16, v17)) < int32(1) { ret |= int32(MM_NOMSG) } } @@ -112794,8 +113872,8 @@ func Xget_current_dir_name(tls *TLS) (r uintptr) { var _ /* a at bp+0 */ Tstat var _ /* b at bp+128 */ Tstat _ = res - res = Xgetenv(tls, __ccgo_ts+647) - if res != 0 && *(*int8)(unsafe.Pointer(res)) != 0 && !(Xstat(tls, res, bp) != 0) && !(Xstat(tls, __ccgo_ts+520, bp+128) != 0) && (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev == (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_dev && (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino == (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_ino { + res = Xgetenv(tls, __ccgo_ts+682) + if res != 0 && *(*int8)(unsafe.Pointer(res)) != 0 && !(Xstat(tls, res, bp) != 0) && !(Xstat(tls, __ccgo_ts+558, bp+128) != 0) && (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev == (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_dev && (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino == (*(*Tstat)(unsafe.Pointer(bp + 128))).Fst_ino { return Xstrdup(tls, res) } return Xgetcwd(tls, uintptr(0), uint64(0)) @@ -112821,6 +113899,7 @@ func X__getauxval(tls *TLS, item uint64) (r uint64) { } goto _1 _1: + ; auxv += uintptr(2) * 8 } *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOENT) @@ -112994,7 +114073,7 @@ func Xgetopt(tls *TLS, argc int32, argv uintptr, optstring uintptr) (r int32) { if *(*Twchar_t)(unsafe.Pointer(bp + 4)) != *(*Twchar_t)(unsafe.Pointer(bp)) || *(*Twchar_t)(unsafe.Pointer(bp)) == int32(':') { Xoptopt = *(*Twchar_t)(unsafe.Pointer(bp)) if int32(*(*int8)(unsafe.Pointer(optstring))) != int32(':') && Xopterr != 0 { - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+651, optchar, uint64(k)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+686, optchar, uint64(k)) } return int32('?') } @@ -113015,7 +114094,7 @@ func Xgetopt(tls *TLS, argc int32, argv uintptr, optstring uintptr) (r int32) { return int32(':') } if Xopterr != 0 { - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+675, optchar, uint64(k)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+710, optchar, uint64(k)) } return int32('?') } @@ -113056,6 +114135,7 @@ func _permute(tls *TLS, argv uintptr, dest int32, src int32) { *(*uintptr)(unsafe.Pointer(av + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(av + uintptr(i-int32(1))*8)) goto _1 _1: + ; i-- } *(*uintptr)(unsafe.Pointer(av + uintptr(dest)*8)) = tmp @@ -113084,6 +114164,7 @@ func ___getopt_long(tls *TLS, argc int32, argv uintptr, optstring uintptr, longo } goto _1 _1: + ; i++ } Xoptind = i @@ -113100,6 +114181,7 @@ func ___getopt_long(tls *TLS, argc int32, argv uintptr, optstring uintptr, longo _permute(tls, argv, skipped, Xoptind-int32(1)) goto _2 _2: + ; i1++ } Xoptind = skipped + cnt @@ -113143,6 +114225,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, cnt++ goto _1 _1: + ; i++ } if cnt == int32(1) && longonly != 0 && int64(arg)-int64(start) == int64(Xmblen(tls, start, uint64(MB_LEN_MAX))) { @@ -113159,6 +114242,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, } goto _4 _4: + ; j++ } if j == l { @@ -113167,6 +114251,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, } goto _3 _3: + ; i++ } } @@ -113180,7 +114265,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, if colon != 0 || !(Xopterr != 0) { return int32('?') } - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+707, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+742, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) return int32('?') } Xoptarg = opt + uintptr(1) @@ -113196,7 +114281,7 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, if !(Xopterr != 0) { return int32('?') } - X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+675, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) + X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), __ccgo_ts+710, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname, Xstrlen(tls, (*(*Toption)(unsafe.Pointer(longopts + uintptr(i)*32))).Fname)) return int32('?') } Xoptind++ @@ -113215,9 +114300,9 @@ func ___getopt_long_core(tls *TLS, argc int32, argv uintptr, optstring uintptr, Xoptopt = 0 if !(colon != 0) && Xopterr != 0 { if cnt != 0 { - v6 = __ccgo_ts + 744 + v6 = __ccgo_ts + 779 } else { - v6 = __ccgo_ts + 651 + v6 = __ccgo_ts + 686 } X__getopt_msg(tls, *(*uintptr)(unsafe.Pointer(argv)), v6, *(*uintptr)(unsafe.Pointer(argv + uintptr(Xoptind)*8))+uintptr(2), Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(Xoptind)*8))+uintptr(2))) } @@ -113359,6 +114444,7 @@ func Xgetsubopt(tls *TLS, opt uintptr, keys uintptr, val uintptr) (r int32) { return i goto _3 _3: + ; i++ } return -int32(1) @@ -113669,6 +114755,7 @@ func _convert_ioctl_struct(tls *TLS, map1 uintptr, old uintptr, new1 uintptr, di old_offset = int32(uint64(old_offset) + Uint64FromInt64(8)) goto _1 _1: + ; i++ } if dir == int32(W) { @@ -113716,6 +114803,7 @@ func Xioctl(tls *TLS, fd int32, req int32, va uintptr) (r1 int32) { break goto _1 _1: + ; i++ } } @@ -113740,7 +114828,7 @@ func Xlockf(tls *TLS, fd int32, op int32, size Toff_t) (r int32) { var _ /* l at bp+0 */ Tflock *(*Tflock)(unsafe.Pointer(bp)) = Tflock{ Fl_type: int16(F_WRLCK), - Fl_whence: int16(SEEK_CUR), + Fl_whence: int16(1), Fl_len: size, } switch op { @@ -113767,15 +114855,6 @@ func Xlockf(tls *TLS, fd int32, op int32, size Toff_t) (r int32) { } const ACCOUNTING = 9 -const BOOT_TIME = 2 -const DEAD_PROCESS = 8 -const EMPTY = 0 -const INIT_PROCESS = 5 -const LOGIN_PROCESS = 6 -const NEW_TIME = 3 -const OLD_TIME = 4 -const RUN_LVL = 1 -const USER_PROCESS = 7 const UTMP_FILE = "_PATH_UTMP" const UTMP_FILENAME = "_PATH_UTMP" const UT_HOSTSIZE = 256 @@ -113785,30 +114864,9 @@ const WTMP_FILE = "_PATH_WTMP" const WTMP_FILENAME = "_PATH_WTMP" const _PATH_UTMP = "/dev/null/utmp" const _PATH_WTMP = "/dev/null/wtmp" -const e_exit = 0 -const e_termination = 0 const ut_name = 0 const utmp = 0 -type Tutmpx = struct { - Fut_type int16 - F__ut_pad1 int16 - Fut_pid Tpid_t - Fut_line [32]int8 - Fut_id [4]int8 - Fut_user [32]int8 - Fut_host [256]int8 - Fut_exit struct { - F__e_termination int16 - F__e_exit int16 - } - Fut_session int32 - F__ut_pad2 int32 - Fut_tv Ttimeval - Fut_addr_v6 [4]uint32 - F__unused [20]int8 -} - type Tlastlog = struct { Fll_time Ttime_t Fll_line [32]int8 @@ -113929,6 +114987,7 @@ func _unescape_ent(tls *TLS, beg uintptr) (r uintptr) { } goto _5 _5: + ; i++ } if cval != 0 { @@ -113973,7 +115032,7 @@ func Xgetmntent_r(tls *TLS, f uintptr, mnt uintptr, linebuf uintptr, buflen int3 return uintptr(0) } if !(Xstrchr(tls, linebuf, int32('\n')) != 0) { - Xfscanf(tls, f, __ccgo_ts+768, 0) + Xfscanf(tls, f, __ccgo_ts+803, 0) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ERANGE) return uintptr(0) } @@ -113989,9 +115048,10 @@ func Xgetmntent_r(tls *TLS, f uintptr, mnt uintptr, linebuf uintptr, buflen int3 (*(*[8]int32)(unsafe.Pointer(bp)))[i] = int32(len1) goto _1 _1: + ; i++ } - Xsscanf(tls, linebuf, __ccgo_ts+780, VaList(bp+40, bp, bp+uintptr(1)*4, bp+uintptr(2)*4, bp+uintptr(3)*4, bp+uintptr(4)*4, bp+uintptr(5)*4, bp+uintptr(6)*4, bp+uintptr(7)*4, mnt+32, mnt+36)) + Xsscanf(tls, linebuf, __ccgo_ts+815, VaList(bp+40, bp, bp+uintptr(1)*4, bp+uintptr(2)*4, bp+uintptr(3)*4, bp+uintptr(4)*4, bp+uintptr(5)*4, bp+uintptr(6)*4, bp+uintptr(7)*4, mnt+32, mnt+36)) } *(*int8)(unsafe.Pointer(linebuf + uintptr((*(*[8]int32)(unsafe.Pointer(bp)))[int32(1)]))) = 0 *(*int8)(unsafe.Pointer(linebuf + uintptr((*(*[8]int32)(unsafe.Pointer(bp)))[int32(3)]))) = 0 @@ -114021,10 +115081,10 @@ func Xaddmntent(tls *TLS, f uintptr, mnt uintptr) (r int32) { } bp := tls.Alloc(64) defer tls.Free(64) - if Xfseek(tls, f, 0, int32(SEEK_END)) != 0 { + if Xfseek(tls, f, 0, int32(2)) != 0 { return int32(1) } - return BoolInt32(Xfprintf(tls, f, __ccgo_ts+835, VaList(bp+8, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_fsname, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_dir, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_type, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_freq, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_passno)) < 0) + return BoolInt32(Xfprintf(tls, f, __ccgo_ts+870, VaList(bp+8, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_fsname, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_dir, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_type, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_freq, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_passno)) < 0) } func Xhasmntopt(tls *TLS, mnt uintptr, opt uintptr) (r uintptr) { @@ -114035,23 +115095,6 @@ func Xhasmntopt(tls *TLS, mnt uintptr, opt uintptr) (r uintptr) { return Xstrstr(tls, (*Tmntent)(unsafe.Pointer(mnt)).Fmnt_opts, opt) } -const FTW_CHDIR = 4 -const FTW_D = 2 -const FTW_DEPTH = 8 -const FTW_DNR = 3 -const FTW_DP = 6 -const FTW_F = 1 -const FTW_MOUNT = 2 -const FTW_NS = 4 -const FTW_PHYS = 1 -const FTW_SL = 5 -const FTW_SLN = 7 - -type TFTW = struct { - Fbase int32 - Flevel int32 -} - type Thistory = struct { Fchain uintptr Fdev Tdev_t @@ -114141,6 +115184,7 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _5 _5: + ; k-- } for { @@ -114149,6 +115193,7 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _6 _6: + ; k-- } (*(*TFTW)(unsafe.Pointer(bp + 160))).Fbase = int32(k) @@ -114179,6 +115224,7 @@ func _do_nftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32, h } goto _9 _9: + ; h = (*Thistory)(unsafe.Pointer(h)).Fchain } if (type1 == int32(FTW_D) || type1 == int32(FTW_DP)) && fd_limit != 0 { @@ -114255,148 +115301,6 @@ func Xnftw(tls *TLS, path uintptr, fn uintptr, fd_limit int32, flags int32) (r1 return r } -const B0 = 0 -const B1000000 = 4104 -const B110 = 3 -const B115200 = 4098 -const B1152000 = 4105 -const B1200 = 9 -const B134 = 4 -const B150 = 5 -const B1500000 = 4106 -const B1800 = 10 -const B19200 = 14 -const B200 = 6 -const B2000000 = 4107 -const B230400 = 4099 -const B2400 = 11 -const B2500000 = 4108 -const B300 = 7 -const B3000000 = 4109 -const B3500000 = 4110 -const B38400 = 15 -const B4000000 = 4111 -const B460800 = 4100 -const B4800 = 12 -const B50 = 1 -const B500000 = 4101 -const B57600 = 4097 -const B576000 = 4102 -const B600 = 8 -const B75 = 2 -const B921600 = 4103 -const B9600 = 13 -const BRKINT = 2 -const BS0 = 0 -const BS1 = 8192 -const BSDLY = 8192 -const CLOCAL = 2048 -const CR0 = 0 -const CR1 = 512 -const CR2 = 1024 -const CR3 = 1536 -const CRDLY = 1536 -const CREAD = 128 -const CS5 = 0 -const CS6 = 16 -const CS7 = 32 -const CS8 = 48 -const CSIZE = 48 -const CSTOPB = 64 -const ECHO = 8 -const ECHOE = 16 -const ECHOK = 32 -const ECHONL = 64 -const FF0 = 0 -const FF1 = 32768 -const FFDLY = 32768 -const HUPCL = 1024 -const ICANON = 2 -const ICRNL = 256 -const IEXTEN = 32768 -const IGNBRK = 1 -const IGNCR = 128 -const IGNPAR = 4 -const IMAXBEL = 8192 -const INLCR = 64 -const INPCK = 16 -const ISIG = 1 -const ISTRIP = 32 -const IUCLC = 512 -const IUTF8 = 16384 -const IXANY = 2048 -const IXOFF = 4096 -const IXON = 1024 -const NCCS = 32 -const NL0 = 0 -const NL1 = 256 -const NLDLY = 256 -const NOFLSH = 128 -const OCRNL = 8 -const OFDEL = 128 -const OFILL = 64 -const OLCUC = 2 -const ONLCR = 4 -const ONLRET = 32 -const ONOCR = 16 -const OPOST = 1 -const PARENB = 256 -const PARMRK = 8 -const PARODD = 512 -const TAB0 = 0 -const TAB1 = 2048 -const TAB2 = 4096 -const TAB3 = 6144 -const TABDLY = 6144 -const TCIFLUSH = 0 -const TCIOFF = 2 -const TCIOFLUSH = 2 -const TCION = 3 -const TCOFLUSH = 1 -const TCOOFF = 0 -const TCOON = 1 -const TCSADRAIN = 1 -const TCSAFLUSH = 2 -const TCSANOW = 0 -const TOSTOP = 256 -const VDISCARD = 13 -const VEOF = 4 -const VEOL = 11 -const VEOL2 = 16 -const VERASE = 2 -const VINTR = 0 -const VKILL = 3 -const VLNEXT = 15 -const VMIN = 6 -const VQUIT = 1 -const VREPRINT = 12 -const VSTART = 8 -const VSTOP = 9 -const VSUSP = 10 -const VSWTC = 7 -const VT0 = 0 -const VT1 = 16384 -const VTDLY = 16384 -const VTIME = 5 -const VWERASE = 14 - -type Tcc_t = uint8 - -type Tspeed_t = uint32 - -type Ttcflag_t = uint32 - -type Ttermios = struct { - Fc_iflag Ttcflag_t - Fc_oflag Ttcflag_t - Fc_cflag Ttcflag_t - Fc_lflag Ttcflag_t - Fc_line Tcc_t - Fc_cc [32]Tcc_t - F__c_ispeed Tspeed_t - F__c_ospeed Tspeed_t -} - /* Nonstandard, but vastly superior to the standard functions */ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws uintptr) (r int32) { @@ -114412,7 +115316,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui var _ /* n at bp+0 */ int32 _, _, _ = m, s, v1 *(*int32)(unsafe.Pointer(bp)) = 0 - m = Xopen(tls, __ccgo_ts+854, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) + m = Xopen(tls, __ccgo_ts+889, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) if m < 0 { return -int32(1) } @@ -114423,7 +115327,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui if !(name != 0) { name = bp + 8 } - Xsnprintf(tls, name, uint64(20), __ccgo_ts+864, VaList(bp+40, *(*int32)(unsafe.Pointer(bp)))) + Xsnprintf(tls, name, uint64(20), __ccgo_ts+899, VaList(bp+40, *(*int32)(unsafe.Pointer(bp)))) v1 = Xopen(tls, name, Int32FromInt32(O_RDWR)|Int32FromInt32(O_NOCTTY), 0) s = v1 if v1 < 0 { @@ -114440,6 +115344,7 @@ func Xopenpty(tls *TLS, pm uintptr, ps uintptr, name uintptr, tio uintptr, ws ui _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) return 0 fail: + ; Xclose(tls, m) _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) return -int32(1) @@ -114469,7 +115374,7 @@ func Xposix_openpt(tls *TLS, flags int32) (r1 int32) { } var r int32 _ = r - r = Xopen(tls, __ccgo_ts+854, flags, 0) + r = Xopen(tls, __ccgo_ts+889, flags, 0) if r < 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(ENOSPC) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EAGAIN) } @@ -114514,7 +115419,7 @@ func X__ptsname_r(tls *TLS, fd int32, buf uintptr, len1 Tsize_t) (r int32) { if v1 != 0 { return -err } - if uint64(Xsnprintf(tls, buf, len1, __ccgo_ts+864, VaList(bp+16, *(*int32)(unsafe.Pointer(bp))))) >= len1 { + if uint64(Xsnprintf(tls, buf, len1, __ccgo_ts+899, VaList(bp+16, *(*int32)(unsafe.Pointer(bp))))) >= len1 { return int32(ERANGE) } return 0 @@ -114575,7 +115480,9 @@ func Xrealpath(tls *TLS, filename uintptr, resolved uintptr) (r uintptr) { * If not a link, it's moved to output; if a link, contents are * pushed to the stack. */ restart: + ; _3: + ; /* If stack starts with /, the whole component is / or // * and the output state must be reset. */ if int32((*(*[4097]int8)(unsafe.Pointer(bp)))[p]) == int32('/') { @@ -114657,6 +115564,7 @@ _3: return uintptr(0) } skip_readlink: + ; check_dir = 0 if up != 0 { for q != 0 && int32((*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[q-uint64(1)]) != int32('/') { @@ -114673,6 +115581,7 @@ skip_readlink: check_dir = int32((*(*[4097]int8)(unsafe.Pointer(bp)))[p]) goto _2 _8: + ; cnt++ v9 = cnt if v9 == uint64(SYMLOOP_MAX) { @@ -114693,10 +115602,12 @@ _8: goto restart goto _2 _2: + ; p += _slash_len(tls, bp+uintptr(p)) goto _3 goto _1 _1: + ; (*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[q] = 0 if int32((*(*[4096]int8)(unsafe.Pointer(bp + 4097)))[0]) != int32('/') { if !(Xgetcwd(tls, bp, uint64(4097)) != 0) { @@ -114740,6 +115651,7 @@ _1: return Xstrdup(tls, bp+4097) } toolong: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENAMETOOLONG) return uintptr(0) } @@ -115223,14 +116135,14 @@ func __vsyslog(tls *TLS, priority int32, message uintptr, ap Tva_list) { } *(*Ttime_t)(unsafe.Pointer(bp + 16)) = Xtime(tls, UintptrFromInt32(0)) Xgmtime_r(tls, bp+16, bp+24) - Xstrftime_l(tls, bp, uint64(16), __ccgo_ts+876, bp+24, uintptr(unsafe.Pointer(&X__c_locale))) + Xstrftime_l(tls, bp, uint64(16), __ccgo_ts+911, bp+24, uintptr(unsafe.Pointer(&X__c_locale))) if _log_opt&int32(LOG_PID) != 0 { v1 = Xgetpid(tls) } else { v1 = 0 } pid = v1 - l = Xsnprintf(tls, bp+80, uint64(1024), __ccgo_ts+885, VaList(bp+1120, priority, bp, bp+1104, uintptr(unsafe.Pointer(&_log_ident)), __ccgo_ts+907+BoolUintptr(!(pid != 0)), pid, __ccgo_ts+909+BoolUintptr(!(pid != 0)))) + l = Xsnprintf(tls, bp+80, uint64(1024), __ccgo_ts+920, VaList(bp+1120, priority, bp, bp+1104, uintptr(unsafe.Pointer(&_log_ident)), __ccgo_ts+942+BoolUintptr(!(pid != 0)), pid, __ccgo_ts+944+BoolUintptr(!(pid != 0)))) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = errno_save l2 = Xvsnprintf(tls, bp+80+uintptr(l), uint64(1024)-uint64(l), message, ap) if l2 >= 0 { @@ -115245,14 +116157,14 @@ func __vsyslog(tls *TLS, priority int32, message uintptr, ap Tva_list) { (*(*[1024]int8)(unsafe.Pointer(bp + 80)))[v2] = int8('\n') } if Xsend(tls, _log_fd, bp+80, uint64(l), 0) < 0 && (!(_is_lost_conn(tls, *(*int32)(unsafe.Pointer(X__errno_location(tls)))) != 0) || Xconnect(tls, _log_fd, uintptr(unsafe.Pointer(&_log_addr)), uint32(12)) < 0 || Xsend(tls, _log_fd, bp+80, uint64(l), 0) < 0) && _log_opt&int32(LOG_CONS) != 0 { - fd = Xopen(tls, __ccgo_ts+601, Int32FromInt32(O_WRONLY)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) + fd = Xopen(tls, __ccgo_ts+639, Int32FromInt32(O_WRONLY)|Int32FromInt32(O_NOCTTY)|Int32FromInt32(O_CLOEXEC), 0) if fd >= 0 { - Xdprintf(tls, fd, __ccgo_ts+911, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) + Xdprintf(tls, fd, __ccgo_ts+946, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) Xclose(tls, fd) } } if _log_opt&int32(LOG_PERROR) != 0 { - Xdprintf(tls, int32(2), __ccgo_ts+911, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) + Xdprintf(tls, int32(2), __ccgo_ts+946, VaList(bp+1120, l-*(*int32)(unsafe.Pointer(bp + 1104)), bp+80+uintptr(*(*int32)(unsafe.Pointer(bp + 1104))))) } } } @@ -115507,7 +116419,7 @@ func X__shm_mapname(tls *TLS, name uintptr, buf uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENAMETOOLONG) return uintptr(0) } - Xmemcpy(tls, buf, __ccgo_ts+916, uint64(9)) + Xmemcpy(tls, buf, __ccgo_ts+951, uint64(9)) Xmemcpy(tls, buf+uintptr(9), name, uint64(int64(p)-int64(name)+int64(1))) return buf } @@ -115622,6 +116534,7 @@ func Xc16rtomb(tls *TLS, s uintptr, c16 Tchar16_t, ps uintptr) (r Tsize_t) { } return Xwcrtomb(tls, s, wc, uintptr(0)) ilseq: + ; *(*uint32)(unsafe.Pointer(x)) = uint32(0) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EILSEQ) return uint64(-Int32FromInt32(1)) @@ -115790,6 +116703,7 @@ func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t, st uintptr) (r Tsize goto ilseq } loop: + ; v4 = s s++ c = c<>int32(3)-int32(0x10)|(int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)+int32(c)>>Int32FromInt32(26))) & ^Int32FromInt32(7) != 0 { s-- goto _9 @@ -116011,12 +116928,16 @@ resume0: c = uint32(0) goto _10 _10: + ; goto _11 goto _9 _9: + ; goto _8 _7: + ; _15: + ; if !(wn != 0) { *(*uintptr)(unsafe.Pointer(src)) = s return wn0 @@ -116062,6 +116983,7 @@ _15: s++ c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(v26)))-uint32(0xc2)] resume: + ; if (int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)-int32(0x10)|(int32(*(*uint8)(unsafe.Pointer(s)))>>int32(3)+int32(c)>>Int32FromInt32(26))) & ^Int32FromInt32(7) != 0 { s-- goto _13 @@ -116094,10 +117016,13 @@ resume: c = uint32(0) goto _14 _14: + ; goto _15 goto _13 _13: + ; _8: + ; if !(c != 0) && !(*(*uint8)(unsafe.Pointer(s)) != 0) { if ws != 0 { *(*Twchar_t)(unsafe.Pointer(ws)) = 0 @@ -116200,6 +117125,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { *(*Twchar_t)(unsafe.Pointer(wc)) = int32(c< uint32(62) { @@ -117660,6 +118588,7 @@ func Xdn_comp(tls *TLS, src uintptr, dst uintptr, space int32, dnptrs uintptr, l } goto _1 _1: + ; p += 8 } } @@ -117678,6 +118607,7 @@ func Xdn_comp(tls *TLS, src uintptr, dst uintptr, space int32, dnptrs uintptr, l *(*uint8)(unsafe.Pointer(dst + uintptr(i))) = (*(*[127]uint8)(unsafe.Pointer(bp + 4)))[j] goto _2 _2: + ; v4 = j j++ i += int32((*(*[127]uint8)(unsafe.Pointer(bp + 4)))[v4]) + int32(1) @@ -117784,6 +118714,7 @@ func X__dn_expand(tls *TLS, base uintptr, end uintptr, src uintptr, dest uintptr } goto _2 _2: + ; i += int32(2) } return -int32(1) @@ -118326,6 +119257,7 @@ func Xether_aton_r(tls *TLS, x uintptr, p_a uintptr) (r uintptr) { *(*Tuint8_t)(unsafe.Pointer(bp + uintptr(ii))) = uint8(n) goto _1 _1: + ; ii++ } if int32(*(*int8)(unsafe.Pointer(x))) != 0 { @@ -118362,13 +119294,14 @@ func Xether_ntoa_r(tls *TLS, p_a uintptr, x uintptr) (r uintptr) { break } if ii == 0 { - v2 = __ccgo_ts + 926 + v2 = __ccgo_ts + 961 } else { - v2 = __ccgo_ts + 931 + v2 = __ccgo_ts + 966 } x += uintptr(Xsprintf(tls, x, v2, VaList(bp+8, int32(*(*Tuint8_t)(unsafe.Pointer(p_a + uintptr(ii))))))) goto _1 _1: + ; ii++ } return y @@ -118422,6 +119355,7 @@ func Xfreeaddrinfo(tls *TLS, p uintptr) { } goto _1 _1: + ; cnt++ p = (*Taddrinfo)(unsafe.Pointer(p)).Fai_next } @@ -118458,10 +119392,12 @@ func Xgai_strerror(tls *TLS, ecode int32) (r uintptr) { } goto _2 _2: + ; s++ } goto _1 _1: + ; ecode++ s++ } @@ -118568,6 +119504,7 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt family = tf[int32(1)-i] goto _1 _1: + ; i++ } } @@ -118637,11 +119574,13 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt } goto _4 _4: + ; j++ k++ } goto _2 _2: + ; i++ } (*(*Taibuf)(unsafe.Pointer(out))).Fref = int16(nais) @@ -118977,6 +119916,7 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*Thostent)(unsafe.Pointer(h)).Fh_length)) goto _2 _2: + ; i++ } *(*uintptr)(unsafe.Pointer((*Thostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = uintptr(0) @@ -119290,6 +120230,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { break goto _1 _1: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } } else { @@ -119303,6 +120244,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _2 _2: + ; ifs0 = (*Tifaddrs_storage)(unsafe.Pointer(ifs0)).Fhash_next } if !(ifs0 != 0) { @@ -119338,6 +120280,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _3 _3: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } if (*Tifaddrs_storage)(unsafe.Pointer(ifs)).Fifa.Fifa_name != 0 { @@ -119382,6 +120325,7 @@ func _netlink_msg_to_ifaddr(tls *TLS, pctx uintptr, h uintptr) (r int32) { } goto _4 _4: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } if (*Tifaddrs_storage)(unsafe.Pointer(ifs)).Fifa.Fifa_addr != 0 { @@ -119445,7 +120389,7 @@ func _itoa(tls *TLS, p uintptr, x uint32) (r uintptr) { func _mkptr4(tls *TLS, s uintptr, ip uintptr) { bp := tls.Alloc(48) defer tls.Free(48) - Xsprintf(tls, s, __ccgo_ts+937, VaList(bp+8, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) + Xsprintf(tls, s, __ccgo_ts+972, VaList(bp+8, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) } func _mkptr6(tls *TLS, s uintptr, ip uintptr) { @@ -119471,9 +120415,10 @@ func _mkptr6(tls *TLS, s uintptr, ip uintptr) { *(*int8)(unsafe.Pointer(v5)) = int8('.') goto _1 _1: + ; i-- } - Xstrcpy(tls, s, __ccgo_ts+962) + Xstrcpy(tls, s, __ccgo_ts+997) } var _xdigits = [17]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} @@ -119490,13 +120435,13 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int var _ /* iplit at bp+1560 */ Taddress var _ /* line at bp+0 */ [512]int8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = f, p, z, v1, v10, v11, v13, v15, v16, v18, v2, v4, v5, v7, v8 - f = X__fopen_rb_ca(tls, __ccgo_ts+971, bp+1592, bp+512, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1006, bp+1592, bp+512, uint64(1032)) if !(f != 0) { return } if family == int32(PF_INET) { Xmemcpy(tls, bp+1544+uintptr(12), a, uint64(4)) - Xmemcpy(tls, bp+1544, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, bp+1544, __ccgo_ts+1017, uint64(12)) a = bp + 1544 } for Xfgets(tls, bp, int32(512), f) != 0 { @@ -119521,6 +120466,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _3 _3: + ; p++ } if !(*(*int8)(unsafe.Pointer(p)) != 0) { @@ -119534,7 +120480,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } if (*(*Taddress)(unsafe.Pointer(bp + 1560))).Ffamily == int32(PF_INET) { Xmemcpy(tls, bp+1560+8+uintptr(12), bp+1560+8, uint64(4)) - Xmemcpy(tls, bp+1560+8, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, bp+1560+8, __ccgo_ts+1017, uint64(12)) (*(*Taddress)(unsafe.Pointer(bp + 1560))).Fscopeid = uint32(0) } if Xmemcmp(tls, a, bp+1560+8, uint64(16)) != 0 || (*(*Taddress)(unsafe.Pointer(bp + 1560))).Fscopeid != scopeid { @@ -119552,6 +120498,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _9 _9: + ; p++ } z = p @@ -119567,6 +120514,7 @@ func _reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int } goto _14 _14: + ; z++ } *(*int8)(unsafe.Pointer(z)) = 0 @@ -119590,7 +120538,7 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { var _ /* line at bp+0 */ [128]int8 var _ /* z at bp+128 */ uintptr _, _, _, _, _, _, _, _, _ = f, p, svport, v1, v2, v4, v5, v7, v8 - f = X__fopen_rb_ca(tls, __ccgo_ts+995, bp+1168, bp+136, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1030, bp+1168, bp+136, uint64(1032)) if !(f != 0) { return } @@ -119616,6 +120564,7 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { } goto _3 _3: + ; p++ } if !(*(*int8)(unsafe.Pointer(p)) != 0) { @@ -119628,10 +120577,10 @@ func _reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { if svport != uint64(port) || *(*uintptr)(unsafe.Pointer(bp + 128)) == p { continue } - if dgram != 0 && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1009, uint64(4)) != 0 { + if dgram != 0 && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1044, uint64(4)) != 0 { continue } - if !(dgram != 0) && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1014, uint64(4)) != 0 { + if !(dgram != 0) && Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1049, uint64(4)) != 0 { continue } if int64(p)-t__predefined_ptrdiff_t(bp) > int64(32) { @@ -119684,7 +120633,7 @@ func Xgetnameinfo(tls *TLS, sa uintptr, sl Tsocklen_t, node uintptr, nodelen Tso if uint64(sl) < uint64(28) { return -int32(6) } - if Xmemcmp(tls, a, __ccgo_ts+982, uint64(12)) != 0 { + if Xmemcmp(tls, a, __ccgo_ts+1017, uint64(12)) != 0 { _mkptr6(tls, bp, a) } else { _mkptr4(tls, bp, a+uintptr(12)) @@ -119832,10 +120781,10 @@ func Xgetservbyname_r(tls *TLS, name uintptr, prots uintptr, se uintptr, buf uin if !(prots != 0) { proto = 0 } else { - if !(Xstrcmp(tls, prots, __ccgo_ts+1019) != 0) { + if !(Xstrcmp(tls, prots, __ccgo_ts+1054) != 0) { proto = int32(IPPROTO_TCP) } else { - if !(Xstrcmp(tls, prots, __ccgo_ts+1023) != 0) { + if !(Xstrcmp(tls, prots, __ccgo_ts+1058) != 0) { proto = int32(IPPROTO_UDP) } else { return int32(EINVAL) @@ -119859,9 +120808,9 @@ func Xgetservbyname_r(tls *TLS, name uintptr, prots uintptr, se uintptr, buf uin *(*uintptr)(unsafe.Pointer((*Tservent)(unsafe.Pointer(se)).Fs_aliases + 1*8)) = uintptr(0) (*Tservent)(unsafe.Pointer(se)).Fs_port = int32(Xhtons(tls, (*(*[2]Tservice)(unsafe.Pointer(bp)))[0].Fport)) if int32((*(*[2]Tservice)(unsafe.Pointer(bp)))[0].Fproto) == int32(IPPROTO_TCP) { - v1 = __ccgo_ts + 1019 + v1 = __ccgo_ts + 1054 } else { - v1 = __ccgo_ts + 1023 + v1 = __ccgo_ts + 1058 } (*Tservent)(unsafe.Pointer(se)).Fs_proto = v1 *(*uintptr)(unsafe.Pointer(res)) = se @@ -120049,11 +120998,11 @@ func Xherror(tls *TLS, msg uintptr) { v1 = __ccgo_ts } if msg != 0 { - v2 = __ccgo_ts + 614 + v2 = __ccgo_ts + 289 } else { v2 = __ccgo_ts } - Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+1027, VaList(bp+8, v1, v2, Xhstrerror(tls, *(*int32)(unsafe.Pointer(X__h_errno_location(tls)))))) + Xfprintf(tls, uintptr(unsafe.Pointer(&X__stderr_FILE)), __ccgo_ts+1062, VaList(bp+8, v1, v2, Xhstrerror(tls, *(*int32)(unsafe.Pointer(X__h_errno_location(tls)))))) } type Tcpu_set_t1 = struct { @@ -120081,10 +121030,12 @@ func Xhstrerror(tls *TLS, ecode int32) (r uintptr) { } goto _2 _2: + ; s++ } goto _1 _1: + ; ecode-- s++ } @@ -120266,6 +121217,7 @@ func _netlink_msg_to_nameindex(tls *TLS, pctx uintptr, h uintptr) (r int32) { return 0 goto _1 _1: + ; rta = rta + uintptr((int32((*Trtattr)(unsafe.Pointer(rta)).Frta_len)+Int32FromInt32(3)) & ^Int32FromInt32(3)) } return 0 @@ -120311,6 +121263,7 @@ func Xif_nameindex(tls *TLS) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = 0 goto _1 _1: + ; i-- s += 28 d += 16 @@ -120318,6 +121271,7 @@ func Xif_nameindex(tls *TLS) (r uintptr) { (*Tif_nameindex)(unsafe.Pointer(d)).Fif_index = uint32(0) (*Tif_nameindex)(unsafe.Pointer(d)).Fif_name = uintptr(0) err: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 280)), uintptr(0)) Xfree(tls, (*Tifnameindexctx)(unsafe.Pointer(ctx)).Flist) *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOBUFS) @@ -120394,6 +121348,7 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) (r int32) { s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) goto _1 _1: + ; i++ } if i == int32(4) { @@ -120423,6 +121378,7 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) (r int32) { *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8((*(*[4]uint64)(unsafe.Pointer(bp)))[i]) goto _2 _2: + ; i++ } return int32(1) @@ -120508,7 +121464,7 @@ func Xinet_ntoa(tls *TLS, _in Tin_addr) (r uintptr) { var a uintptr _ = a a = bp - Xsnprintf(tls, uintptr(unsafe.Pointer(&_buf4)), uint64(16), __ccgo_ts+1035, VaList(bp+16, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3))))) + Xsnprintf(tls, uintptr(unsafe.Pointer(&_buf4)), uint64(16), __ccgo_ts+1070, VaList(bp+16, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3))))) return uintptr(unsafe.Pointer(&_buf4)) } @@ -120529,14 +121485,14 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l Tsocklen_t) (r uint a = a0 switch af { case int32(PF_INET): - if uint32(Xsnprintf(tls, s, uint64(l), __ccgo_ts+1035, VaList(bp+112, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { + if uint32(Xsnprintf(tls, s, uint64(l), __ccgo_ts+1070, VaList(bp+112, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { return s } case int32(PF_INET6): - if Xmemcmp(tls, a, __ccgo_ts+982, uint64(12)) != 0 { - Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1047, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) + if Xmemcmp(tls, a, __ccgo_ts+1017, uint64(12)) != 0 { + Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1082, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) } else { - Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1071, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) + Xsnprintf(tls, bp, uint64(100), __ccgo_ts+1106, VaList(bp+112, int32(256)*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), int32(256)*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) } /* Replace longest /(^0|:)[:0]{2,}/ with "::" */ v2 = Int32FromInt32(0) @@ -120550,13 +121506,14 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l Tsocklen_t) (r uint if i != 0 && int32((*(*[100]int8)(unsafe.Pointer(bp)))[i]) != int32(':') { goto _1 } - j = int32(Xstrspn(tls, bp+uintptr(i), __ccgo_ts+1101)) + j = int32(Xstrspn(tls, bp+uintptr(i), __ccgo_ts+1136)) if j > max { best = i max = j } goto _1 _1: + ; i++ } if max > int32(3) { @@ -120619,6 +121576,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { v = int32(10)*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - int32('0') goto _2 _2: + ; j++ } if j == 0 || j > int32(1) && int32(*(*int8)(unsafe.Pointer(s))) == int32('0') || v > int32(255) { @@ -120634,6 +121592,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { s += uintptr(j + int32(1)) goto _1 _1: + ; i++ } return 0 @@ -120679,6 +121638,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { v = int32(16)*v + d goto _8 _8: + ; j++ } if j == 0 { @@ -120703,6 +121663,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { s += uintptr(j + int32(1)) goto _6 _6: + ; i++ } if brk >= 0 { @@ -120715,6 +121676,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { (*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[brk+j] = uint16(0) goto _12 _12: + ; j++ } } @@ -120731,6 +121693,7 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) (r int32) { *(*uint8)(unsafe.Pointer(v15)) = uint8((*(*[8]Tuint16_t)(unsafe.Pointer(bp)))[j]) goto _13 _13: + ; j++ } if need_v4 != 0 && Xinet_pton(tls, int32(PF_INET), s, a-uintptr(4)) <= 0 { @@ -120859,6 +121822,7 @@ func _is_valid_hostname(tls *TLS, host uintptr) (r int32) { } goto _1 _1: + ; s++ } return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) @@ -120931,7 +121895,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family cnt = 0 badfam = 0 have_canon = 0 - f = X__fopen_rb_ca(tls, __ccgo_ts+971, bp+1544, bp+512, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1006, bp+1544, bp+512, uint64(1032)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -120962,6 +121926,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family v6 = BoolInt32(v5 == int32(' ') || uint32(v5)-uint32('\t') < uint32(5)) goto _7 _7: + ; if v11 = !(v6 != 0); !v11 { v8 = int32(*(*int8)(unsafe.Pointer(p + uintptr(l)))) v9 = BoolInt32(v8 == int32(' ') || uint32(v8)-uint32('\t') < uint32(5)) @@ -120974,6 +121939,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _3 _3: + ; p++ } if !(p != 0) { @@ -120993,6 +121959,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _13 _13: + ; p++ } v18 = p @@ -121023,6 +121990,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _19 _19: + ; p++ } z = p @@ -121038,6 +122006,7 @@ func _name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } goto _24 _24: + ; z++ } *(*int8)(unsafe.Pointer(z)) = 0 @@ -121150,6 +122119,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _1 _1: + ; i++ } if X__res_msend_rc(tls, nq, bp+10160, bp+10192, bp+10176, bp+10200, int32(4800), conf) < 0 { @@ -121171,6 +122141,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _2 _2: + ; i++ } i = nq - int32(1) @@ -121185,6 +122156,7 @@ func _name_from_dns(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i X__dns_parse(tls, bp+560+uintptr(i)*4800, (*(*[2]int32)(unsafe.Pointer(bp + 10200)))[i], __ccgo_fp(_dns_parse_callback1), bp+10208) goto _3 _3: + ; i-- } if (*(*Tdpc_ctx)(unsafe.Pointer(bp + 10208))).Fcnt != 0 { @@ -121234,6 +122206,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _1 _1: + ; l++ } if dots >= uint64((*(*Tresolvconf)(unsafe.Pointer(bp + 256))).Fndots) || int32(*(*int8)(unsafe.Pointer(name + uintptr(l-uint64(1))))) == int32('.') { @@ -121271,6 +122244,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _4 _4: + ; p++ } z = p @@ -121286,6 +122260,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _8 _8: + ; z++ } if z == p { @@ -121301,6 +122276,7 @@ func _name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, f } goto _3 _3: + ; p = z } *(*int8)(unsafe.Pointer(canon + uintptr(l))) = 0 @@ -121370,6 +122346,7 @@ func _policyof(tls *TLS, a uintptr) (r uintptr) { return uintptr(unsafe.Pointer(&_defpolicy)) + uintptr(i)*20 goto _1 _1: + ; i++ } return r @@ -121405,6 +122382,7 @@ func _prefixmatch(tls *TLS, s uintptr, d uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(i) @@ -121486,6 +122464,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _2 _2: + ; i++ } if i < cnt { @@ -121501,6 +122480,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _3 _3: + ; i++ } v5 = j @@ -121518,10 +122498,11 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i goto _6 } Xmemcpy(tls, buf+uintptr(i)*28+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) - Xmemcpy(tls, buf+uintptr(i)*28+8, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, buf+uintptr(i)*28+8, __ccgo_ts+1017, uint64(12)) (*(*Taddress)(unsafe.Pointer(buf + uintptr(i)*28))).Ffamily = int32(PF_INET6) goto _6 _6: + ; i++ } } @@ -121540,6 +122521,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i } goto _7 _7: + ; i++ } if i == cnt { @@ -121576,9 +122558,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i sa = bp + 4 *(*Tsocklen_t)(unsafe.Pointer(bp + 92)) = uint32(28) } else { - Xmemcpy(tls, bp+4+8, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, bp+4+8, __ccgo_ts+1017, uint64(12)) Xmemcpy(tls, bp+32+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) - Xmemcpy(tls, bp+32+8, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, bp+32+8, __ccgo_ts+1017, uint64(12)) Xmemcpy(tls, bp+32+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) Xmemcpy(tls, bp+76+4, buf+uintptr(i)*28+8, uint64(4)) da = bp + 76 @@ -121617,6 +122599,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i (*(*Taddress)(unsafe.Pointer(buf + uintptr(i)*28))).Fsortkey = key goto _8 _8: + ; i++ } Xqsort(tls, buf, uint64(cnt), uint64(28), __ccgo_fp(_addrcmp)) @@ -121704,7 +122687,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i return -int32(2) } l = Xstrlen(tls, name) - f = X__fopen_rb_ca(tls, __ccgo_ts+995, bp+1168, bp+136, uint64(1032)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1030, bp+1168, bp+136, uint64(1032)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -121755,6 +122738,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i break goto _5 _5: + ; p++ } if !(p != 0) { @@ -121774,13 +122758,14 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i } goto _15 _15: + ; p++ } port = Xstrtoul(tls, p, bp+128, int32(10)) if port > uint64(65535) || *(*uintptr)(unsafe.Pointer(bp + 128)) == p { continue } - if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1009, uint64(4)) != 0) { + if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1044, uint64(4)) != 0) { if proto == int32(IPPROTO_TCP) { continue } @@ -121790,7 +122775,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i cnt++ (*(*Tservice)(unsafe.Pointer(buf + uintptr(v20)*4))).Fproto = uint8(IPPROTO_UDP) } - if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1014, uint64(4)) != 0) { + if !(Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(bp + 128)), __ccgo_ts+1049, uint64(4)) != 0) { if proto == int32(IPPROTO_UDP) { continue } @@ -121906,6 +122891,7 @@ func ___netlink_enumerate(tls *TLS, fd int32, seq uint32, type1 int32, af int32, } goto _1 _1: + ; h = h + uintptr(((*Tnlmsghdr)(unsafe.Pointer(h)).Fnlmsg_len+Uint32FromInt32(3))&uint32(^Int32FromInt32(3))) } } @@ -122022,6 +123008,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 *(*Tuint16_t)(unsafe.Pointer(handle + 20 + uintptr(i)*2)) = uint16(Xns_get16(tls, msg-uintptr(2))) goto _1 _1: + ; i++ } i = 0 @@ -122041,6 +123028,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 } goto _2 _2: + ; i++ } if msg != (*Tns_msg)(unsafe.Pointer(handle)).F_eom { @@ -122051,6 +123039,7 @@ func Xns_initparse(tls *TLS, msg uintptr, msglen int32, handle uintptr) (r1 int3 (*Tns_msg)(unsafe.Pointer(handle)).F_msg_ptr = UintptrFromInt32(0) return 0 bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122093,6 +123082,7 @@ func Xns_skiprr(tls *TLS, ptr uintptr, eom uintptr, section Tns_sect, count int3 } return int32(int64(p) - int64(ptr)) bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122177,9 +123167,11 @@ func Xns_parserr(tls *TLS, handle uintptr, section Tns_sect, rrnum int32, rr uin } return 0 bad: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENODEV) return -int32(1) size: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EMSGSIZE) return -int32(1) } @@ -122380,6 +123372,7 @@ func Xrecvmmsg(tls *TLS, fd int32, msgvec uintptr, vlen uint32, flags uint32, ti (*Tmmsghdr)(unsafe.Pointer(mh)).Fmsg_hdr.F__pad1 = v2 goto _1 _1: + ; i-- mh += 64 } @@ -122424,14 +123417,17 @@ func X__convert_scm_timestamps(tls *TLS, msg uintptr, csize Tsocklen_t) { } goto _5 _3: + ; if type1 != 0 { goto _5 } type1 = int32(SO_TIMESTAMP) goto common _4: + ; type1 = int32(SO_TIMESTAMPNS) common: + ; Xmemcpy(tls, bp, cmsg+UintptrFromInt32(1)*16, uint64(8)) (*(*[2]int64)(unsafe.Pointer(bp + 8)))[0] = *(*int64)(unsafe.Pointer(bp)) Xmemcpy(tls, bp, cmsg+UintptrFromInt32(1)*16+uintptr(8), uint64(8)) @@ -122442,6 +123438,7 @@ func X__convert_scm_timestamps(tls *TLS, msg uintptr, csize Tsocklen_t) { last = cmsg goto _1 _1: + ; if uint64((*Tcmsghdr)(unsafe.Pointer(cmsg)).Fcmsg_len) < uint64(16) || (uint64((*Tcmsghdr)(unsafe.Pointer(cmsg)).Fcmsg_len)+uint64(8)-uint64(1))&uint64(^int64(Uint64FromInt64(8)-Uint64FromInt32(1)))+uint64(16) >= uint64(int64((*Tmsghdr)(unsafe.Pointer(msg)).Fmsg_control+uintptr((*Tmsghdr)(unsafe.Pointer(msg)).Fmsg_controllen))-int64(cmsg)) { v6 = uintptr(0) } else { @@ -122573,6 +123570,7 @@ func X__res_mkquery(tls *TLS, op int32, dname uintptr, class int32, type1 int32, } goto _2 _2: + ; j++ } if uint32(j-i)-uint32(1) > uint32(62) { @@ -122581,6 +123579,7 @@ func X__res_mkquery(tls *TLS, op int32, dname uintptr, class int32, type1 int32, (*(*[280]uint8)(unsafe.Pointer(bp)))[i-int32(1)] = uint8(j - i) goto _1 _1: + ; i = j + int32(1) } (*(*[280]uint8)(unsafe.Pointer(bp)))[i+int32(1)] = uint8(type1) @@ -122714,6 +123713,7 @@ func _cleanup(tls *TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -122894,6 +123894,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _5 _5: + ; nns++ } /* Get local address and open/bind a socket */ @@ -122907,6 +123908,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _7 _7: + ; i++ } if i == nns { @@ -122934,12 +123936,13 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a goto _8 } Xmemcpy(tls, bp+116+uintptr(i)*28+8+uintptr(12), bp+116+uintptr(i)*28+4, uint64(4)) - Xmemcpy(tls, bp+116+uintptr(i)*28+8, __ccgo_ts+982, uint64(12)) + Xmemcpy(tls, bp+116+uintptr(i)*28+8, __ccgo_ts+1017, uint64(12)) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_family = uint16(PF_INET6) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_flowinfo = uint32(0) (*(*Tsockaddr_in6)(unsafe.Pointer(bp + 116 + uintptr(i)*28))).Fsin6_scope_id = uint32(0) goto _8 _8: + ; i++ } } @@ -122966,6 +123969,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a (*(*Tpollfd)(unsafe.Add(unsafe.Pointer(pfd), i*8))).Ffd = -int32(1) goto _9 _9: + ; i++ } (*(*Tpollfd)(unsafe.Add(unsafe.Pointer(pfd), nqueries*8))).Ffd = fd @@ -122993,6 +123997,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _12 _12: + ; i++ } if i == nqueries { @@ -123014,11 +124019,13 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a Xsendto(tls, fd, *(*uintptr)(unsafe.Pointer(queries + uintptr(i)*8)), uint64(*(*int32)(unsafe.Pointer(qlens + uintptr(i)*4))), int32(MSG_NOSIGNAL), bp+116+uintptr(j)*28, sl) goto _14 _14: + ; j++ } } goto _13 _13: + ; i++ } t1 = t2 @@ -123057,6 +124064,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _15 _15: + ; j++ } if j == nns { @@ -123070,6 +124078,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _16 _16: + ; i++ } if i == nqueries { @@ -123107,6 +124116,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _19 _19: + ; next++ } } else { @@ -123165,6 +124175,7 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _20 _20: + ; i++ } i = 0 @@ -123216,13 +124227,16 @@ func X__res_msend_rc(tls *TLS, nqueries int32, queries uintptr, qlens uintptr, a } goto _21 _21: + ; i++ } goto _11 _11: + ; t2 = _mtime(tls) } out: + ; __pthread_cleanup_pop(tls, bp+208, int32(1)) /* Disregard any incomplete TCP results */ i = 0 @@ -123235,6 +124249,7 @@ out: } goto _22 _22: + ; i++ } return 0 @@ -123333,7 +124348,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ if search != 0 { *(*int8)(unsafe.Pointer(search)) = 0 } - f = X__fopen_rb_ca(tls, __ccgo_ts+1104, bp+512, bp+256, uint64(256)) + f = X__fopen_rb_ca(tls, __ccgo_ts+1139, bp+512, bp+256, uint64(256)) if !(f != 0) { switch *(*int32)(unsafe.Pointer(X__errno_location(tls))) { case int32(ENOENT): @@ -123353,14 +124368,14 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } continue } - if v4 = !(Xstrncmp(tls, bp, __ccgo_ts+1121, uint64(7)) != 0); v4 { + if v4 = !(Xstrncmp(tls, bp, __ccgo_ts+1156, uint64(7)) != 0); v4 { v1 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(7)]) v2 = BoolInt32(v1 == int32(' ') || uint32(v1)-uint32('\t') < uint32(5)) goto _3 _3: } if v4 && v2 != 0 { - p = Xstrstr(tls, bp, __ccgo_ts+1129) + p = Xstrstr(tls, bp, __ccgo_ts+1164) if p != 0 && BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 6)))-uint32('0') < uint32(10)) != 0 { p += uintptr(6) x = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123373,7 +124388,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ (*Tresolvconf)(unsafe.Pointer(conf)).Fndots = uint32(v5) } } - p = Xstrstr(tls, bp, __ccgo_ts+1136) + p = Xstrstr(tls, bp, __ccgo_ts+1171) if p != 0 && BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 9)))-uint32('0') < uint32(10)) != 0 { p += uintptr(9) x1 = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123386,7 +124401,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ (*Tresolvconf)(unsafe.Pointer(conf)).Fattempts = uint32(v6) } } - p = Xstrstr(tls, bp, __ccgo_ts+1146) + p = Xstrstr(tls, bp, __ccgo_ts+1181) if p != 0 && (BoolInt32(uint32(*(*int8)(unsafe.Pointer(p + 8)))-uint32('0') < uint32(10)) != 0 || int32(*(*int8)(unsafe.Pointer(p + 8))) == int32('.')) { p += uintptr(8) x2 = Xstrtoul(tls, p, bp+744, int32(10)) @@ -123401,7 +124416,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } continue } - if v11 = !(Xstrncmp(tls, bp, __ccgo_ts+1155, uint64(10)) != 0); v11 { + if v11 = !(Xstrncmp(tls, bp, __ccgo_ts+1190, uint64(10)) != 0); v11 { v8 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(10)]) v9 = BoolInt32(v8 == int32(' ') || uint32(v8)-uint32('\t') < uint32(5)) goto _10 @@ -123422,6 +124437,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _12 _12: + ; p++ } *(*uintptr)(unsafe.Pointer(bp + 744)) = p @@ -123437,6 +124453,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _16 _16: + ; *(*uintptr)(unsafe.Pointer(bp + 744))++ } *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 744)))) = 0 @@ -123448,7 +124465,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ if !(search != 0) { continue } - if v24 = Xstrncmp(tls, bp, __ccgo_ts+1166, uint64(6)) != 0 && Xstrncmp(tls, bp, __ccgo_ts+1173, uint64(6)) != 0; !v24 { + if v24 = Xstrncmp(tls, bp, __ccgo_ts+1201, uint64(6)) != 0 && Xstrncmp(tls, bp, __ccgo_ts+1208, uint64(6)) != 0; !v24 { v21 = int32((*(*[256]int8)(unsafe.Pointer(bp)))[int32(6)]) v22 = BoolInt32(v21 == int32(' ') || uint32(v21)-uint32('\t') < uint32(5)) goto _23 @@ -123468,6 +124485,7 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } goto _25 _25: + ; p++ } l = Xstrlen(tls, p) @@ -123479,8 +124497,9 @@ func X__get_resolv_conf(tls *TLS, conf uintptr, search uintptr, search_sz Tsize_ } X__fclose_ca(tls, f) no_resolv_conf: + ; if !(nns != 0) { - X__lookup_ipliteral(tls, conf, __ccgo_ts+1180, PF_UNSPEC) + X__lookup_ipliteral(tls, conf, __ccgo_ts+1215, PF_UNSPEC) nns = int32(1) } (*Tresolvconf)(unsafe.Pointer(conf)).Fnns = uint32(nns) @@ -123525,9 +124544,11 @@ func Xsendmmsg(tls *TLS, fd int32, msgvec uintptr, vlen uint32, flags uint32) (r (*(*Tmmsghdr)(unsafe.Pointer(msgvec + uintptr(i)*64))).Fmsg_len = uint32(r) goto _1 _1: + ; i++ } error: + ; if i != 0 { v2 = i } else { @@ -123577,6 +124598,7 @@ func Xsendmsg(tls *TLS, fd int32, msg uintptr, flags int32) (r1 Tssize_t) { (*Tcmsghdr)(unsafe.Pointer(c)).F__pad1 = 0 goto _2 _2: + ; if uint64((*Tcmsghdr)(unsafe.Pointer(c)).Fcmsg_len) < uint64(16) || (uint64((*Tcmsghdr)(unsafe.Pointer(c)).Fcmsg_len)+uint64(8)-uint64(1))&uint64(^int64(Uint64FromInt64(8)-Uint64FromInt32(1)))+uint64(16) >= uint64(int64((*Tmsghdr)(unsafe.Pointer(bp)).Fmsg_control+uintptr((*Tmsghdr)(unsafe.Pointer(bp)).Fmsg_controllen))-int64(c)) { v4 = uintptr(0) } else { @@ -123972,16 +124994,6 @@ _9: const SHADOW = "/etc/shadow" -type Tpasswd = struct { - Fpw_name uintptr - Fpw_passwd uintptr - Fpw_uid Tuid_t - Fpw_gid Tgid_t - Fpw_gecos uintptr - Fpw_dir uintptr - Fpw_shell uintptr -} - type Tgroup = struct { Fgr_name uintptr Fgr_passwd uintptr @@ -124013,11 +125025,11 @@ func Xfgetgrent(tls *TLS, f uintptr) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgrent_a(tls, f, uintptr(unsafe.Pointer(&_gr)), uintptr(unsafe.Pointer(&_line)), bp+8, uintptr(unsafe.Pointer(&_mem)), bp+16, bp) + X__getgrent_a(tls, f, uintptr(unsafe.Pointer(&_gr)), uintptr(unsafe.Pointer(&_line1)), bp+8, uintptr(unsafe.Pointer(&_mem)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } -var _line uintptr +var _line1 uintptr var _mem uintptr @@ -124033,11 +125045,11 @@ func Xfgetpwent(tls *TLS, f uintptr) (r uintptr) { var _ /* res at bp+8 */ uintptr var _ /* size at bp+0 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp)) = uint64(0) - X__getpwent_a(tls, f, uintptr(unsafe.Pointer(&_pw)), uintptr(unsafe.Pointer(&_line1)), bp, bp+8) + X__getpwent_a(tls, f, uintptr(unsafe.Pointer(&_pw)), uintptr(unsafe.Pointer(&_line2)), bp, bp+8) return *(*uintptr)(unsafe.Pointer(bp + 8)) } -var _line1 uintptr +var _line2 uintptr var _pw Tpasswd @@ -124111,7 +125123,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz rv = 0 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp) - f = Xfopen(tls, __ccgo_ts+1190, __ccgo_ts+1201) + f = Xfopen(tls, __ccgo_ts+1225, __ccgo_ts+315) if !(f != 0) { rv = *(*int32)(unsafe.Pointer(X__errno_location(tls))) goto done @@ -124195,6 +125207,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz grlist_len += uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 44))) goto _3 _3: + ; i++ } if len1 > *(*Tsize_t)(unsafe.Pointer(size)) || !(*(*uintptr)(unsafe.Pointer(buf)) != 0) { @@ -124243,6 +125256,7 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz } goto _9 _9: + ; ptr++ } *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(mem)) + uintptr(i)*8)) = uintptr(0) @@ -124267,10 +125281,12 @@ func X__getgr_a(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, siz } *(*uintptr)(unsafe.Pointer(res)) = gr cleanup_f: + ; Xfclose(tls, f) goto done } done: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp)), uintptr(0)) if rv != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = rv @@ -124315,6 +125331,7 @@ func _getgr_r(tls *TLS, name uintptr, gid Tgid_t, gr uintptr, buf uintptr, size *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)) = uintptr(int64(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(i)*8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))) + buf goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)) = uintptr(0) @@ -124344,8 +125361,8 @@ func Xgetgrgid_r(tls *TLS, gid Tgid_t, gr uintptr, buf uintptr, size Tsize_t, re return _getgr_r(tls, uintptr(0), gid, gr, buf, size, res) } -var _f uintptr -var _line2 uintptr +var _f1 uintptr +var _line3 uintptr var _mem1 uintptr var _gr1 Tgroup @@ -124353,10 +125370,10 @@ func Xsetgrent(tls *TLS) { if __ccgo_strace { trc("tls=%v, (%v:)", tls, origin(2)) } - if _f != 0 { - Xfclose(tls, _f) + if _f1 != 0 { + Xfclose(tls, _f1) } - _f = uintptr(0) + _f1 = uintptr(0) } func Xgetgrent(tls *TLS) (r uintptr) { @@ -124371,13 +125388,13 @@ func Xgetgrent(tls *TLS) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - if !(_f != 0) { - _f = Xfopen(tls, __ccgo_ts+1190, __ccgo_ts+1201) + if !(_f1 != 0) { + _f1 = Xfopen(tls, __ccgo_ts+1225, __ccgo_ts+315) } - if !(_f != 0) { + if !(_f1 != 0) { return uintptr(0) } - X__getgrent_a(tls, _f, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgrent_a(tls, _f1, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124393,7 +125410,7 @@ func Xgetgrgid(tls *TLS, gid Tgid_t) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgr_a(tls, uintptr(0), gid, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgr_a(tls, uintptr(0), gid, uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124409,7 +125426,7 @@ func Xgetgrnam(tls *TLS, name uintptr) (r uintptr) { var _ /* size at bp+8 */ Tsize_t *(*Tsize_t)(unsafe.Pointer(bp + 8)) = uint64(0) *(*Tsize_t)(unsafe.Pointer(bp + 16)) = uint64(0) - X__getgr_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line2)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) + X__getgr_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_gr1)), uintptr(unsafe.Pointer(&_line3)), bp+8, uintptr(unsafe.Pointer(&_mem1)), bp+16, bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124431,6 +125448,7 @@ func _atou(tls *TLS, s uintptr) (r uint32) { x = uint32(10)*x + uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-Int32FromUint8('0')) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return x @@ -124511,6 +125529,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } goto _10 _10: + ; *(*uintptr)(unsafe.Pointer(bp))++ } Xfree(tls, *(*uintptr)(unsafe.Pointer(mem))) @@ -124540,6 +125559,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } goto _11 _11: + ; *(*uintptr)(unsafe.Pointer(bp))++ } i++ @@ -124550,6 +125570,7 @@ func X__getgrent_a(tls *TLS, f uintptr, gr uintptr, line uintptr, size uintptr, } (*Tgroup)(unsafe.Pointer(gr)).Fgr_mem = *(*uintptr)(unsafe.Pointer(mem)) end: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(res)) = gr if rv != 0 { @@ -124622,12 +125643,13 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u *(*Tuint32_t)(unsafe.Pointer(nscdbuf + uintptr(i)*4)) = v4 goto _2 _2: + ; i++ } } } Xfclose(tls, f) - f = Xfopen(tls, __ccgo_ts+1190, __ccgo_ts+1201) + f = Xfopen(tls, __ccgo_ts+1225, __ccgo_ts+315) if !(f != 0) && *(*int32)(unsafe.Pointer(X__errno_location(tls))) != int32(ENOENT) && *(*int32)(unsafe.Pointer(X__errno_location(tls))) != int32(ENOTDIR) { goto cleanup } @@ -124649,6 +125671,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _7 _7: + ; i++ } } @@ -124659,6 +125682,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _8 _8: + ; i++ } if !(*(*uintptr)(unsafe.Pointer((*(*Tgroup)(unsafe.Pointer(bp))).Fgr_mem + uintptr(i)*8)) != 0) { @@ -124694,6 +125718,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u } goto _11 _11: + ; i++ } } @@ -124705,6 +125730,7 @@ func Xgetgrouplist(tls *TLS, user uintptr, gid Tgid_t, groups uintptr, ngroups u ret = int32(v14) *(*int32)(unsafe.Pointer(ngroups)) = int32(n) cleanup: + ; if f != 0 { Xfclose(tls, f) } @@ -124749,7 +125775,7 @@ func X__getpw_a(tls *TLS, name uintptr, uid Tuid_t, pw uintptr, buf uintptr, siz rv = 0 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) _pthread_setcancelstate(tls, int32(PTHREAD_CANCEL_DISABLE), bp+4) - f = Xfopen(tls, __ccgo_ts+1205, __ccgo_ts+1201) + f = Xfopen(tls, __ccgo_ts+1236, __ccgo_ts+315) if !(f != 0) { rv = *(*int32)(unsafe.Pointer(X__errno_location(tls))) goto done @@ -124851,10 +125877,12 @@ func X__getpw_a(tls *TLS, name uintptr, uid Tuid_t, pw uintptr, buf uintptr, siz } *(*uintptr)(unsafe.Pointer(res)) = pw cleanup_f: + ; Xfclose(tls, f) goto done } done: + ; _pthread_setcancelstate(tls, *(*int32)(unsafe.Pointer(bp + 4)), uintptr(0)) if rv != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = rv @@ -124911,8 +125939,8 @@ func Xgetpwuid_r(tls *TLS, uid Tuid_t, pw uintptr, buf uintptr, size Tsize_t, re return _getpw_r(tls, uintptr(0), uid, pw, buf, size, res) } -var _f1 uintptr -var _line3 uintptr +var _f2 uintptr +var _line4 uintptr var _pw1 Tpasswd var _size Tsize_t @@ -124920,10 +125948,10 @@ func Xsetpwent(tls *TLS) { if __ccgo_strace { trc("tls=%v, (%v:)", tls, origin(2)) } - if _f1 != 0 { - Xfclose(tls, _f1) + if _f2 != 0 { + Xfclose(tls, _f2) } - _f1 = uintptr(0) + _f2 = uintptr(0) } func Xgetpwent(tls *TLS) (r uintptr) { @@ -124934,13 +125962,13 @@ func Xgetpwent(tls *TLS) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - if !(_f1 != 0) { - _f1 = Xfopen(tls, __ccgo_ts+1205, __ccgo_ts+1201) + if !(_f2 != 0) { + _f2 = Xfopen(tls, __ccgo_ts+1236, __ccgo_ts+315) } - if !(_f1 != 0) { + if !(_f2 != 0) { return uintptr(0) } - X__getpwent_a(tls, _f1, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpwent_a(tls, _f2, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124952,7 +125980,7 @@ func Xgetpwuid(tls *TLS, uid Tuid_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - X__getpw_a(tls, uintptr(0), uid, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpw_a(tls, uintptr(0), uid, uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124964,7 +125992,7 @@ func Xgetpwnam(tls *TLS, name uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ uintptr - X__getpw_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line3)), uintptr(unsafe.Pointer(&_size)), bp) + X__getpw_a(tls, name, uint32(0), uintptr(unsafe.Pointer(&_pw1)), uintptr(unsafe.Pointer(&_line4)), uintptr(unsafe.Pointer(&_size)), bp) return *(*uintptr)(unsafe.Pointer(bp)) } @@ -124986,6 +126014,7 @@ func _atou1(tls *TLS, s uintptr) (r uint32) { x = uint32(10)*x + uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(s)))))-Int32FromUint8('0')) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return x @@ -125169,12 +126198,13 @@ func X__nscd_query(tls *TLS, req Tint32_t, key uintptr, buf uintptr, len1 Tsize_ errno_save = *(*int32)(unsafe.Pointer(X__errno_location(tls))) *(*int32)(unsafe.Pointer(swap)) = 0 retry: + ; Xmemset(tls, buf, 0, len1) *(*Tint32_t)(unsafe.Pointer(buf)) = int32(NSCDVERSION) fd = Xsocket(tls, int32(PF_LOCAL), Int32FromInt32(SOCK_STREAM)|Int32FromInt32(SOCK_CLOEXEC), 0) if fd < 0 { if *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EAFNOSUPPORT) { - f = Xfopen(tls, __ccgo_ts+1217, __ccgo_ts+1227) + f = Xfopen(tls, __ccgo_ts+1248, __ccgo_ts+1258) if f != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = errno_save } @@ -125182,7 +126212,7 @@ retry: } return uintptr(0) } - v1 = Xfdopen(tls, fd, __ccgo_ts+1230) + v1 = Xfdopen(tls, fd, __ccgo_ts+1261) f = v1 if !(v1 != 0) { Xclose(tls, fd) @@ -125228,6 +126258,7 @@ retry: (*(*[3]Tint32_t)(unsafe.Pointer(bp + 32)))[i] = int32(v4) goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(swap)) = int32(1) @@ -125250,6 +126281,7 @@ retry: *(*Tint32_t)(unsafe.Pointer(buf + uintptr(i)*4)) = int32(v8) goto _6 _6: + ; i++ } } @@ -125263,6 +126295,7 @@ retry: } return f error: + ; Xfclose(tls, f) return uintptr(0) } @@ -125279,7 +126312,7 @@ func Xputgrent(tls *TLS, gr uintptr, f uintptr) (r1 int32) { var v4 uintptr _, _, _, _, _, _ = i, r, v1, v3, v4, v5 Xflockfile(tls, f) - v1 = Xfprintf(tls, f, __ccgo_ts+1232, VaList(bp+8, (*Tgroup)(unsafe.Pointer(gr)).Fgr_name, (*Tgroup)(unsafe.Pointer(gr)).Fgr_passwd, (*Tgroup)(unsafe.Pointer(gr)).Fgr_gid)) + v1 = Xfprintf(tls, f, __ccgo_ts+1263, VaList(bp+8, (*Tgroup)(unsafe.Pointer(gr)).Fgr_name, (*Tgroup)(unsafe.Pointer(gr)).Fgr_passwd, (*Tgroup)(unsafe.Pointer(gr)).Fgr_gid)) r = v1 if v1 < 0 { goto done @@ -125291,22 +126324,24 @@ func Xputgrent(tls *TLS, gr uintptr, f uintptr) (r1 int32) { break } if i != 0 { - v4 = __ccgo_ts + 1242 + v4 = __ccgo_ts + 1273 } else { v4 = __ccgo_ts } - v3 = Xfprintf(tls, f, __ccgo_ts+1244, VaList(bp+8, v4, *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)))) + v3 = Xfprintf(tls, f, __ccgo_ts+1275, VaList(bp+8, v4, *(*uintptr)(unsafe.Pointer((*Tgroup)(unsafe.Pointer(gr)).Fgr_mem + uintptr(i)*8)))) r = v3 if v3 < 0 { goto done } goto _2 _2: + ; i++ } } r = Xfputc(tls, int32('\n'), f) done: + ; Xfunlockfile(tls, f) if r < 0 { v5 = -int32(1) @@ -125325,7 +126360,7 @@ func Xputpwent(tls *TLS, pw uintptr, f uintptr) (r int32) { defer tls.Free(64) var v1 int32 _ = v1 - if Xfprintf(tls, f, __ccgo_ts+1249, VaList(bp+8, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_name, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_passwd, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_uid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gecos, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_dir, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_shell)) < 0 { + if Xfprintf(tls, f, __ccgo_ts+1280, VaList(bp+8, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_name, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_passwd, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_uid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gid, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_gecos, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_dir, (*Tpasswd)(unsafe.Pointer(pw)).Fpw_shell)) < 0 { v1 = -int32(1) } else { v1 = 0 @@ -125425,7 +126460,7 @@ func Xputspent(tls *TLS, sp uintptr, f uintptr) (r int32) { } else { v17 = (*Tspwd)(unsafe.Pointer(sp)).Fsp_flag } - if Xfprintf(tls, f, __ccgo_ts+1271, VaList(bp+8, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)) < 0 { + if Xfprintf(tls, f, __ccgo_ts+1302, VaList(bp+8, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)) < 0 { v1 = -int32(1) } else { v1 = 0 @@ -125647,6 +126682,7 @@ func ___srandom(tls *TLS, seed uint32) { *(*Tuint32_t)(unsafe.Pointer(_x1 + uintptr(k)*4)) = uint32(s >> int32(32)) goto _2 _2: + ; k++ } /* make sure x contains at least one odd number */ @@ -125741,6 +126777,7 @@ func Xrandom(tls *TLS) (r int64) { _j = 0 } end: + ; ___unlock(tls, uintptr(unsafe.Pointer(&_lock3))) return k } @@ -125790,6 +126827,7 @@ func Xexecl(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -125805,6 +126843,7 @@ func Xexecl(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = UintptrFromInt32(0) @@ -125832,6 +126871,7 @@ func Xexecle(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -125847,6 +126887,7 @@ func Xexecle(tls *TLS, path uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } envp = VaUintptr(&ap) @@ -125874,6 +126915,7 @@ func Xexeclp(tls *TLS, file uintptr, argv0 uintptr, va uintptr) (r int32) { } goto _1 _1: + ; argc++ } _ = ap @@ -125889,6 +126931,7 @@ func Xexeclp(tls *TLS, file uintptr, argv0 uintptr, va uintptr) (r int32) { *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = VaUintptr(&ap) goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Add(unsafe.Pointer(argv), i*8)) = UintptrFromInt32(0) @@ -125925,7 +126968,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { var v2 t__predefined_size_t _, _, _, _, _, _, _, _, _, _ = b, k, l, p, path, seen_eacces, z, v2, v3, v4 defer func() { Xrealloc(tls, b, 0) }() - path = Xgetenv(tls, __ccgo_ts+1320) + path = Xgetenv(tls, __ccgo_ts+1351) seen_eacces = 0 *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(ENOENT) if !(*(*int8)(unsafe.Pointer(file)) != 0) { @@ -125935,7 +126978,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { return Xexecve(tls, file, argv, envp) } if !(path != 0) { - path = __ccgo_ts + 1325 + path = __ccgo_ts + 1356 } k = Xstrnlen(tls, file, uint64(Int32FromInt32(NAME_MAX)+Int32FromInt32(1))) if k > uint64(NAME_MAX) { @@ -125977,6 +127020,7 @@ func X__execvpe(tls *TLS, file uintptr, argv uintptr, envp uintptr) (r int32) { } goto _1 _1: + ; p = z } if seen_eacces != 0 { @@ -126489,6 +127533,7 @@ func _pat_next(tls *TLS, pat uintptr, m Tsize_t, step uintptr, flags int32) (r i } goto _1 _1: + ; k++ } if k == m || !(*(*int8)(unsafe.Pointer(pat + uintptr(k))) != 0) { @@ -126505,6 +127550,7 @@ func _pat_next(tls *TLS, pat uintptr, m Tsize_t, step uintptr, flags int32) (r i return -int32(4) } escaped: + ; if uint32(*(*int8)(unsafe.Pointer(pat))) >= uint32(128) { k1 = Xmbtowc(tls, bp, pat, m) if k1 < 0 { @@ -126606,6 +127652,7 @@ func _match_bracket(tls *TLS, p uintptr, k int32, kfold int32) (r int32) { } goto _1 _1: + ; p++ } return inv @@ -126694,6 +127741,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } goto _5 _5: + ; p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) } /* Past this point we need not check for UNMATCHABLE in pat, @@ -126732,6 +127780,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } goto _7 _7: + ; tailcnt-- } if tailcnt != 0 { @@ -126825,6 +127874,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, } goto _16 _16: + ; str++ } } @@ -126852,6 +127902,7 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { } goto _2 _2: + ; s++ } p = pat @@ -126863,6 +127914,7 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { } goto _3 _3: + ; p += uintptr(*(*Tsize_t)(unsafe.Pointer(bp))) } if c != int32(*(*int8)(unsafe.Pointer(s))) && (!(*(*int8)(unsafe.Pointer(s)) != 0) || !(flags&Int32FromInt32(FNM_LEADING_DIR) != 0)) { @@ -126894,6 +127946,7 @@ func Xfnmatch(tls *TLS, pat uintptr, str uintptr, flags int32) (r int32) { } goto _5 _5: + ; s++ } } @@ -127042,6 +128095,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag type1 = 0 goto _3 _3: + ; i++ } *(*int8)(unsafe.Pointer(buf + uintptr(pos))) = 0 @@ -127076,6 +128130,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag } goto _6 _6: + ; p-- } if (int64(p2)-int64(p))%int64(2) != 0 { @@ -127086,7 +128141,7 @@ func _do_glob(tls *TLS, buf uintptr, pos Tsize_t, type1 int32, pat uintptr, flag if pos != 0 { v7 = buf } else { - v7 = __ccgo_ts + 520 + v7 = __ccgo_ts + 558 } dir = Xopendir(tls, v7) if !(dir != 0) { @@ -127176,6 +128231,7 @@ func _freelist(tls *TLS, head uintptr) { Xfree(tls, match) goto _1 _1: + ; match = next } } @@ -127208,7 +128264,7 @@ func _expand_tilde(tls *TLS, pat uintptr, buf uintptr, pos uintptr) (r int32) { if *(*int8)(unsafe.Pointer(p)) != 0 { v3 = UintptrFromInt32(0) } else { - v3 = Xgetenv(tls, __ccgo_ts+1354) + v3 = Xgetenv(tls, __ccgo_ts+1385) } home = v3 if !(home != 0) { @@ -127227,15 +128283,20 @@ func _expand_tilde(tls *TLS, pat uintptr, buf uintptr, pos uintptr) (r int32) { } goto _8 _5: + ; return int32(GLOB_NOSPACE) _7: + ; if !!(*(*uintptr)(unsafe.Pointer(bp + 48)) != 0) { goto _9 } _6: + ; return int32(GLOB_NOMATCH) _9: + ; _8: + ; home = (*(*Tpasswd)(unsafe.Pointer(bp))).Fpw_dir } for i < uint64(Int32FromInt32(PATH_MAX)-Int32FromInt32(2)) && *(*int8)(unsafe.Pointer(home)) != 0 { @@ -127323,6 +128384,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) = (*Tmatch)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fnext cnt++ } @@ -127361,6 +128423,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr(i)*8)) = UintptrFromInt32(0) goto _3 _3: + ; i++ } } @@ -127373,6 +128436,7 @@ func Xglob(tls *TLS, pat uintptr, flags int32, errfunc uintptr, g uintptr) (r in *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr(offs+i)*8)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + 8 goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) = (*Tmatch)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fnext i++ } @@ -127398,6 +128462,7 @@ func Xglobfree(tls *TLS, g uintptr) { Xfree(tls, *(*uintptr)(unsafe.Pointer((*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv + uintptr((*Tglob_t)(unsafe.Pointer(g)).Fgl_offs+i)*8))-uintptr(uint64(UintptrFromInt32(0)+8))) goto _1 _1: + ; i++ } Xfree(tls, (*Tglob_t)(unsafe.Pointer(g)).Fgl_pathv) @@ -127878,51 +128943,51 @@ var _tre_macros = [13]struct { }{ 0: { Fc: int8('t'), - Fexpansion: __ccgo_ts + 1359, + Fexpansion: __ccgo_ts + 1390, }, 1: { Fc: int8('n'), - Fexpansion: __ccgo_ts + 1361, + Fexpansion: __ccgo_ts + 301, }, 2: { Fc: int8('r'), - Fexpansion: __ccgo_ts + 1363, + Fexpansion: __ccgo_ts + 1392, }, 3: { Fc: int8('f'), - Fexpansion: __ccgo_ts + 1365, + Fexpansion: __ccgo_ts + 1394, }, 4: { Fc: int8('a'), - Fexpansion: __ccgo_ts + 1367, + Fexpansion: __ccgo_ts + 1396, }, 5: { Fc: int8('e'), - Fexpansion: __ccgo_ts + 1369, + Fexpansion: __ccgo_ts + 1398, }, 6: { Fc: int8('w'), - Fexpansion: __ccgo_ts + 1371, + Fexpansion: __ccgo_ts + 1400, }, 7: { Fc: int8('W'), - Fexpansion: __ccgo_ts + 1384, + Fexpansion: __ccgo_ts + 1413, }, 8: { Fc: int8('s'), - Fexpansion: __ccgo_ts + 1398, + Fexpansion: __ccgo_ts + 1427, }, 9: { Fc: int8('S'), - Fexpansion: __ccgo_ts + 1410, + Fexpansion: __ccgo_ts + 1439, }, 10: { Fc: int8('d'), - Fexpansion: __ccgo_ts + 1423, + Fexpansion: __ccgo_ts + 1452, }, 11: { Fc: int8('D'), - Fexpansion: __ccgo_ts + 1435, + Fexpansion: __ccgo_ts + 1464, }, 12: {}, } @@ -127942,6 +129007,7 @@ func _tre_expand_macro(tls *TLS, s uintptr) (r uintptr) { } goto _1 _1: + ; i++ } return _tre_macros[i].Fexpansion @@ -128013,6 +129079,7 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { } goto _3 _3: + ; c++ e++ } @@ -128032,6 +129099,7 @@ func _add_icase_literals(tls *TLS, ls uintptr, min int32, max int32) (r int32) { } goto _5 _5: + ; c++ e++ } @@ -128128,6 +129196,7 @@ func _parse_bracket_terms(tls *TLS, ctx uintptr, s uintptr, ls uintptr, neg uint } goto _3 _3: + ; len1++ } if !(class != 0) || int32(*(*int8)(unsafe.Pointer(s + uintptr(len1+int32(1))))) != int32(']') { @@ -128291,9 +129360,11 @@ func _parse_bracket(tls *TLS, ctx uintptr, s uintptr) (r Treg_errcode_t) { } goto _2 _2: + ; i++ } parse_bracket_done: + ; Xfree(tls, (*(*Tliterals)(unsafe.Pointer(bp))).Fa) (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fposition++ (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fn = node @@ -128437,8 +129508,10 @@ func _parse_atom(tls *TLS, ctx uintptr, s uintptr) (r Treg_errcode_t) { } goto _13 _1: + ; return _parse_bracket(tls, ctx, s+uintptr(1)) _2: + ; p = _tre_expand_macro(tls, s+uintptr(1)) if p != 0 { /* assume \X expansion is a single atom */ @@ -128480,6 +129553,7 @@ _2: v = int32(16)*v + c goto _15 _15: + ; i++ } s += uintptr(i) @@ -128537,6 +129611,7 @@ _2: s++ goto _13 _3: + ; if (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fcflags&int32(REG_NEWLINE) != 0 { v22 = ctx + 44 v21 = *(*int32)(unsafe.Pointer(v22)) @@ -128560,6 +129635,7 @@ _3: s++ goto _13 _4: + ; /* '^' has a special meaning everywhere in EREs, and at beginning of BRE. */ if !(ere != 0) && s != (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fstart { goto parse_literal @@ -128568,6 +129644,7 @@ _4: s++ goto _13 _5: + ; /* '$' is special everywhere in EREs, and at the end of a BRE subexpression. */ if !(ere != 0) && *(*int8)(unsafe.Pointer(s + 1)) != 0 && (int32(*(*int8)(unsafe.Pointer(s + 1))) != int32('\\') || int32(*(*int8)(unsafe.Pointer(s + 2))) != int32(')') && int32(*(*int8)(unsafe.Pointer(s + 2))) != int32('|')) { goto parse_literal @@ -128576,22 +129653,30 @@ _5: s++ goto _13 _9: + ; _8: + ; _7: + ; _6: + ; /* reject repetitions after empty expression in ERE */ if ere != 0 { return int32(REG_BADRPT) } _10: + ; if !(ere != 0) { goto parse_literal } _11: + ; node = _tre_ast_new_literal(tls, (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fmem, -int32(1), -int32(1), -int32(1)) goto _13 _12: + ; parse_literal: + ; len1 = Xmbtowc(tls, bp, s, uint64(-Int32FromInt32(1))) if len1 < 0 { return int32(REG_BADPAT) @@ -128612,7 +129697,9 @@ parse_literal: s += uintptr(len1) goto _13 _13: + ; end: + ; if !(node != 0) { return int32(REG_ESPACE) } @@ -128687,6 +129774,7 @@ func _tre_parse(tls *TLS, ctx uintptr) (r Treg_errcode_t) { s = (*Ttre_parse_ctx_t)(unsafe.Pointer(ctx)).Fs } parse_iter: + ; for { if int32(*(*int8)(unsafe.Pointer(s))) != int32('\\') && int32(*(*int8)(unsafe.Pointer(s))) != int32('*') { if !(ere != 0) { @@ -128906,6 +129994,7 @@ func _tre_purge_regset(tls *TLS, regset uintptr, tnfa uintptr, tag int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(regset)) = -int32(1) @@ -128965,6 +130054,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u (*(*Ttre_tag_states_t)(unsafe.Pointer(saved_states + uintptr(i)*8))).Ftag = -int32(1) goto _1 _1: + ; i++ } } @@ -128995,6 +130085,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _2: + ; id = _tre_stack_pop_int(tls, stack) /* Add end of this submatch to regset. */ i1 = 0 @@ -129004,6 +130095,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _11 _11: + ; i1++ } *(*int32)(unsafe.Pointer(regset + uintptr(i1)*4)) = id*int32(2) + int32(1) @@ -129016,11 +130108,13 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _12 _12: + ; i1++ } *(*int32)(unsafe.Pointer(parents + uintptr(i1-int32(1))*4)) = -int32(1) goto _10 _3: + ; node = _tre_stack_pop_voidptr(tls, stack) if (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id >= 0 { id1 = (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id @@ -129032,6 +130126,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _13 _13: + ; i2++ } *(*int32)(unsafe.Pointer(regset + uintptr(i2)*4)) = id1 * int32(2) @@ -129044,6 +130139,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _14 _14: + ; i2++ } (*(*Ttre_submatch_data_t)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fsubmatch_data + uintptr(id1)*16))).Fparents = UintptrFromInt32(0) @@ -129062,6 +130158,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u *(*int32)(unsafe.Pointer(p + uintptr(i2)*4)) = *(*int32)(unsafe.Pointer(parents + uintptr(i2)*4)) goto _15 _15: + ; i2++ } *(*int32)(unsafe.Pointer(p + uintptr(i2)*4)) = -int32(1) @@ -129096,6 +130193,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _16 _16: + ; i3++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i3)*4)) = tag @@ -129215,6 +130313,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _17 _17: + ; i4++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i4)*4)) = tag @@ -129311,6 +130410,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _18 _18: + ; i5++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i5)*4)) = tag @@ -129343,6 +130443,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _19 _19: + ; i6++ } *(*int32)(unsafe.Pointer(parents + uintptr(i6)*4)) = (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fsubmatch_id @@ -129350,6 +130451,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 /* end case: ADDTAGS_RECURSE */ _4: + ; minimal = 0 node = _tre_stack_pop_voidptr(tls, stack) if first_pass != 0 { @@ -129371,6 +130473,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _5: + ; new_tag = _tre_stack_pop_int(tls, stack) next_tag = _tre_stack_pop_int(tls, stack) if new_tag >= 0 { @@ -129378,25 +130481,30 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _10 _6: + ; node = _tre_stack_pop_voidptr(tls, stack) if first_pass != 0 { (*Ttre_ast_node_t)(unsafe.Pointer(node)).Fnum_tags = (*Ttre_ast_node_t)(unsafe.Pointer((*Ttre_catenation_t)(unsafe.Pointer((*Ttre_ast_node_t)(unsafe.Pointer(node)).Fobj)).Fleft)).Fnum_tags + (*Ttre_ast_node_t)(unsafe.Pointer((*Ttre_catenation_t)(unsafe.Pointer((*Ttre_ast_node_t)(unsafe.Pointer(node)).Fobj)).Fright)).Fnum_tags } goto _10 _7: + ; /* Lift the bottom of the `regset' array so that when processing the right operand the items currently in the array are invisible. The original bottom was saved at ADDTAGS_UNION and will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */ _21: + ; if !(*(*int32)(unsafe.Pointer(regset)) >= 0) { goto _20 } regset += 4 goto _21 _20: + ; goto _10 _8: + ; left2 = _tre_stack_pop_voidptr(tls, stack) right2 = _tre_stack_pop_voidptr(tls, stack) node = _tre_stack_pop_voidptr(tls, stack) @@ -129435,8 +130543,10 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u direction = int32(_TRE_TAG_MAXIMIZE) goto _10 _9: + ; goto _10 - _10: /* end switch(symbol) */ + _10: + /* end switch(symbol) */ } /* end while(tre_stack_num_objects(stack) > bottom) */ if !(first_pass != 0) { _tre_purge_regset(tls, regset, tnfa, tag) @@ -129449,6 +130559,7 @@ func _tre_add_tags(tls *TLS, mem Ttre_mem_t, stack uintptr, tree uintptr, tnfa u } goto _23 _23: + ; i7++ } *(*int32)(unsafe.Pointer((*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fminimal_tags + uintptr(i7)*4)) = tag @@ -129790,6 +130901,7 @@ func _tre_expand_ast(tls *TLS, mem Ttre_mem_t, stack uintptr, ast uintptr, posit } goto _1 _1: + ; j++ } if (*Ttre_iteration_t)(unsafe.Pointer(iter1)).Fmax == -int32(1) { @@ -129832,6 +130944,7 @@ func _tre_expand_ast(tls *TLS, mem Ttre_mem_t, stack uintptr, ast uintptr, posit } goto _3 _3: + ; j++ } } @@ -129912,6 +131025,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _1 _1: + ; num_tags++ } s1 = 0 @@ -129921,6 +131035,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _2 _2: + ; s1++ } s2 = 0 @@ -129930,6 +131045,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _3 _3: + ; s2++ } new_set = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), int32(1), uint64(56)*uint64(s1+s2+Int32FromInt32(1))) @@ -129958,6 +131074,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _5 _5: + ; i++ } new_tags = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), 0, Uint64FromInt64(4)*uint64(i+num_tags+Int32FromInt32(1))) @@ -129972,6 +131089,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = *(*int32)(unsafe.Pointer((*(*Ttre_pos_and_tags_t)(unsafe.Pointer(set1 + uintptr(s1)*56))).Ftags + uintptr(j)*4)) goto _6 _6: + ; j++ } i = 0 @@ -129982,6 +131100,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j+i)*4)) = *(*int32)(unsafe.Pointer(tags + uintptr(i)*4)) goto _7 _7: + ; i++ } *(*int32)(unsafe.Pointer(new_tags + uintptr(j+i)*4)) = -int32(1) @@ -129989,6 +131108,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _4 _4: + ; s1++ } s2 = 0 @@ -130014,6 +131134,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _9 _9: + ; i++ } new_tags = X__tre_mem_alloc_impl(tls, mem, 0, UintptrFromInt32(0), 0, uint64(4)*uint64(i+Int32FromInt32(1))) @@ -130028,6 +131149,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = *(*int32)(unsafe.Pointer((*(*Ttre_pos_and_tags_t)(unsafe.Pointer(set2 + uintptr(s2)*56))).Ftags + uintptr(j)*4)) goto _10 _10: + ; j++ } *(*int32)(unsafe.Pointer(new_tags + uintptr(j)*4)) = -int32(1) @@ -130035,6 +131157,7 @@ func _tre_set_union(tls *TLS, mem Ttre_mem_t, set1 uintptr, set2 uintptr, tags u } goto _8 _8: + ; s2++ } (*(*Ttre_pos_and_tags_t)(unsafe.Pointer(new_set + uintptr(s1+s2)*56))).Fposition = -int32(1) @@ -130079,6 +131202,7 @@ func _tre_match_empty(tls *TLS, stack uintptr, node uintptr, tags uintptr, asser } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(tags + uintptr(i)*4)) < 0 { @@ -130449,6 +131573,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun } goto _3 _3: + ; i++ } (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes = Xmalloc(tls, uint64(8)*uint64(i+Int32FromInt32(1))) @@ -130463,6 +131588,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes + uintptr(i)*8)) = *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_pos_and_tags_t)(unsafe.Pointer(p1)).Fneg_classes + uintptr(i)*8)) goto _4 _4: + ; i++ } *(*Ttre_ctype_t)(unsafe.Pointer((*Ttre_tnfa_transition_t)(unsafe.Pointer(trans)).Fneg_classes + uintptr(i)*8)) = Uint64FromInt32(0) @@ -130517,6 +131643,7 @@ func _tre_make_trans(tls *TLS, p1 uintptr, p2 uintptr, transitions uintptr, coun } goto _5 _5: + ; k++ } if !(dup != 0) { @@ -130766,6 +131893,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { *(*int32)(unsafe.Pointer(counts + uintptr(i)*4)) = 0 goto _3 _3: + ; i++ } _tre_ast_to_tnfa(tls, tree, UintptrFromInt32(0), counts, UintptrFromInt32(0)) @@ -130780,6 +131908,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { *(*int32)(unsafe.Pointer(counts + uintptr(i)*4)) = 0 goto _4 _4: + ; i++ } transitions = Xcalloc(tls, uint64(uint32(add)+uint32(1)), uint64(56)) @@ -130832,6 +131961,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { } goto _6 _6: + ; j++ } (*(*Ttre_tnfa_transition_t)(unsafe.Pointer(initial + uintptr(i)*56))).Ftags = Xmalloc(tls, uint64(4)*uint64(j+Int32FromInt32(1))) @@ -130847,6 +131977,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { i++ goto _5 _5: + ; p += 56 } (*(*Ttre_tnfa_transition_t)(unsafe.Pointer(initial + uintptr(i)*56))).Fstate = UintptrFromInt32(0) @@ -130861,6 +131992,7 @@ func Xregcomp(tls *TLS, preg uintptr, regex uintptr, cflags int32) (r int32) { (*Tregex_t)(unsafe.Pointer(preg)).F__opaque = tnfa return REG_OK error_exit: + ; /* Free everything that was allocated and return the error code. */ X__tre_mem_destroy(tls, mem) if stack != UintptrFromInt32(0) { @@ -130903,6 +132035,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _1 _1: + ; i++ } if (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Ftransitions != 0 { @@ -130919,6 +132052,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _2 _2: + ; trans += 56 } Xfree(tls, (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Finitial) @@ -130934,6 +132068,7 @@ func Xregfree(tls *TLS, preg uintptr) { } goto _3 _3: + ; i++ } Xfree(tls, (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fsubmatch_data) @@ -130974,6 +132109,7 @@ func Xregerror(tls *TLS, e int32, preg uintptr, buf uintptr, size Tsize_t) (r Ts } goto _1 _1: + ; e-- s += uintptr(Xstrlen(tls, s) + uint64(1)) } @@ -131020,6 +132156,7 @@ func _tre_tag_order(tls *TLS, num_tags int32, tag_directions uintptr, t1 uintptr } goto _1 _1: + ; i++ } /* assert(0);*/ @@ -131167,6 +132304,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags tmp_buf += uintptr(xbytes) goto _5 _5: + ; i++ } i = 0 @@ -131177,6 +132315,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags (*(*Ttre_reach_pos_t)(unsafe.Pointer(reach_pos + uintptr(i)*16))).Fpos = int64(-int32(1)) goto _6 _6: + ; i++ } prev_c = *(*Ttre_char_t)(unsafe.Pointer(bp)) @@ -131213,6 +132352,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) = int64(-int32(1)) goto _8 _8: + ; i++ } tag_i = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131235,6 +132375,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) goto _9 _9: + ; i++ } } @@ -131301,6 +132442,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _12 _12: + ; i += int32(2) } if !(skip != 0) { @@ -131312,6 +132454,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _11 _11: + ; reach_i += 16 } (*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Fstate = UintptrFromInt32(0) @@ -131348,6 +132491,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(tmp_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_i)).Ftags + uintptr(i)*8)) goto _15 _15: + ; i++ } tag_i = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131378,6 +132522,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Ftags + uintptr(i)*8)) goto _16 _16: + ; i++ } } @@ -131401,6 +132546,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i)*8)) = *(*Tregoff_t)(unsafe.Pointer(tmp_tags + uintptr(i)*8)) goto _17 _17: + ; i++ } } @@ -131410,10 +132556,12 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } goto _14 _14: + ; trans_i += 56 } goto _13 _13: + ; reach_i += 16 } (*Ttre_tnfa_reach_t)(unsafe.Pointer(reach_next_i)).Fstate = UintptrFromInt32(0) @@ -131426,6 +132574,7 @@ func _tre_tnfa_run_parallel(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } ret = v18 error_exit: + ; Xfree(tls, buf) return ret } @@ -131534,6 +132683,7 @@ func _tre_tnfa_run_backtrack(tls *TLS, tnfa uintptr, string1 uintptr, match_tags } } retry: + ; i = 0 for { if !(i < (*Ttre_tnfa_t)(unsafe.Pointer(tnfa)).Fnum_tags) { @@ -131545,6 +132695,7 @@ retry: } goto _1 _1: + ; i++ } i = 0 @@ -131555,6 +132706,7 @@ retry: *(*int32)(unsafe.Pointer(states_seen + uintptr(i)*4)) = 0 goto _2 _2: + ; i++ } state = UintptrFromInt32(0) @@ -131640,6 +132792,7 @@ retry: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i1)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i1)*8)) goto _5 _5: + ; i1++ } tmp = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131653,6 +132806,7 @@ retry: } goto _4 _4: + ; trans_i += 56 } if next_tags != 0 { @@ -131663,6 +132817,7 @@ retry: *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(*(*int32)(unsafe.Pointer(next_tags)))*8)) = pos goto _7 _7: + ; next_tags += 4 } } @@ -131670,6 +132825,7 @@ retry: goto backtrack } _9: + ; if !(int32(1) != 0) { goto _8 } @@ -131686,6 +132842,7 @@ _9: *(*Tregoff_t)(unsafe.Pointer(match_tags + uintptr(i2)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i2)*8)) goto _10 _10: + ; i2++ } } @@ -131823,6 +132980,7 @@ _9: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i3)*8)) = *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i3)*8)) goto _14 _14: + ; i3++ } tmp1 = (*Ttre_tnfa_transition_t)(unsafe.Pointer(trans_i)).Ftags @@ -131833,12 +132991,14 @@ _9: *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(*(*int32)(unsafe.Pointer(tmp1)))*8)) = pos goto _15 _15: + ; tmp1 += 4 } } } goto _13 _13: + ; trans_i += 56 } if !(next_state != UintptrFromInt32(0)) { @@ -131856,7 +133016,9 @@ _9: } goto _17 _16: + ; backtrack: + ; /* A matching transition was not found. Try to backtrack. */ if (*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fprev != 0 { if (*Ttre_tnfa_transition_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Fstate)).Fassertions&int32(ASSERT_BACKREF) != 0 { @@ -131874,6 +133036,7 @@ backtrack: *(*Tregoff_t)(unsafe.Pointer(tags + uintptr(i4)*8)) = *(*Tregoff_t)(unsafe.Pointer((*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fitem.Ftags + uintptr(i4)*8)) goto _19 _19: + ; i4++ } stack = (*Ttre_backtrack_struct)(unsafe.Pointer(stack)).Fprev @@ -131892,8 +133055,10 @@ backtrack: } } _17: + ; goto _9 _8: + ; if match_eo >= 0 { v20 = REG_OK } else { @@ -131902,6 +133067,7 @@ _8: ret = v20 *(*Tregoff_t)(unsafe.Pointer(match_end_ofs)) = match_eo error_exit: + ; X__tre_mem_destroy(tls, mem) if tags != 0 { Xfree(tls, tags) @@ -131972,6 +133138,7 @@ func _tre_fill_pmatch(tls *TLS, nmatch Tsize_t, pmatch uintptr, cflags int32, tn } goto _2 _2: + ; j++ } } @@ -132229,6 +133396,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _1 _1: + ; newsize *= uint64(2) } (*t__tab)(unsafe.Pointer((*Thsearch_data)(unsafe.Pointer(htab)).F__tab)).Fentries = Xcalloc(tls, newsize, uint64(16)) @@ -132255,6 +133423,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _3 _3: + ; v4 = j j++ i += v4 @@ -132263,6 +133432,7 @@ func _resize(tls *TLS, nel Tsize_t, htab uintptr) (r int32) { } goto _2 _2: + ; e += 16 } Xfree(tls, oldtab) @@ -132297,6 +133467,7 @@ func _lookup(tls *TLS, key uintptr, hash Tsize_t, htab uintptr) (r uintptr) { } goto _1 _1: + ; v2 = j j++ i += v2 @@ -132435,6 +133606,7 @@ func Xlsearch(tls *TLS, key uintptr, base uintptr, nelp uintptr, width Tsize_t, } goto _2 _2: + ; i++ } *(*Tsize_t)(unsafe.Pointer(nelp)) = n + uint64(1) @@ -132464,6 +133636,7 @@ func Xlfind(tls *TLS, key uintptr, base uintptr, nelp uintptr, width Tsize_t, co } goto _2 _2: + ; i++ } return uintptr(0) @@ -132733,13 +133906,13 @@ func _walk(tls *TLS, r uintptr, action uintptr, d int32) { return } if (*Tnode1)(unsafe.Pointer(r)).Fh == int32(1) { - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_leaf), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _leaf, d) } else { - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_preorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _preorder, d) _walk(tls, *(*uintptr)(unsafe.Pointer(r + 8)), action, d+int32(1)) - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_postorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _postorder, d) _walk(tls, *(*uintptr)(unsafe.Pointer(r + 8 + 1*8)), action, d+int32(1)) - (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, int32(_endorder), d) + (*(*func(*TLS, uintptr, TVISIT, int32))(unsafe.Pointer(&struct{ uintptr }{action})))(tls, r, _endorder, d) } } @@ -133007,11 +134180,11 @@ func Xpsignal(tls *TLS, sig int32, msg uintptr) { v2 = __ccgo_ts } if msg != 0 { - v3 = __ccgo_ts + 614 + v3 = __ccgo_ts + 289 } else { v3 = __ccgo_ts } - if Xfprintf(tls, f, __ccgo_ts+1027, VaList(bp+8, v2, v3, s)) >= 0 { + if Xfprintf(tls, f, __ccgo_ts+1062, VaList(bp+8, v2, v3, s)) >= 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = old_errno } (*TFILE)(unsafe.Pointer(f)).Fmode = old_mode @@ -133130,35 +134303,37 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old1 uintptr) (r2 int32) if Uint64FromInt64(8) == Uint64FromInt64(4) { v3 = v1 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1477) v7 = v goto _8 _8: old = v7 goto _6 _6: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1477) v4 = r goto _5 _5: + ; if !!(v4 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) _ = old goto _9 _9: @@ -133175,35 +134350,37 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old1 uintptr) (r2 int32) if *(*Tuint32_t)(unsafe.Pointer(bp + 8)) != 0 { v11 = v10 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1477) v15 = v goto _16 _16: old = v15 goto _14 _14: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1477) v12 = r goto _13 _13: + ; if !!(v12 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) _ = old goto _17 _17: @@ -133211,35 +134388,37 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old1 uintptr) (r2 int32) if *(*Tuint32_t)(unsafe.Pointer(bp + 8 + 1*4)) != 0 { v18 = v10 + uintptr(1)*4 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1477) v22 = v goto _23 _23: old = v22 goto _21 _21: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1477) v19 = r goto _20 _20: + ; if !!(v19 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) _ = old goto _24 _24: @@ -133262,10 +134441,10 @@ func X__libc_sigaction(tls *TLS, sig int32, sa uintptr, old1 uintptr) (r2 int32) } if !((*Tsigaction)(unsafe.Pointer(sa)).Fsa_flags&Int32FromInt32(SA_RESTART) != 0) { // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) AtomicStorePInt32(uintptr(unsafe.Pointer(&X__eintr_valid_flag)), int32(1)) // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1448) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1477) } } (*(*Tk_sigaction)(unsafe.Pointer(bp + 16))).Fhandler = *(*uintptr)(unsafe.Pointer(sa)) @@ -133383,6 +134562,7 @@ func Xsigandset(tls *TLS, dest uintptr, left uintptr, right uintptr) (r1 int32) *(*uint64)(unsafe.Pointer(d + uintptr(i)*8)) = *(*uint64)(unsafe.Pointer(l + uintptr(i)*8)) & *(*uint64)(unsafe.Pointer(r + uintptr(i)*8)) goto _1 _1: + ; i++ } return 0 @@ -133458,6 +134638,7 @@ func Xsigisemptyset(tls *TLS, set uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -133496,6 +134677,7 @@ func Xsigorset(tls *TLS, dest uintptr, left uintptr, right uintptr) (r1 int32) { *(*uint64)(unsafe.Pointer(d + uintptr(i)*8)) = *(*uint64)(unsafe.Pointer(l + uintptr(i)*8)) | *(*uint64)(unsafe.Pointer(r + uintptr(i)*8)) goto _1 _1: + ; i++ } return 0 @@ -133915,6 +135097,7 @@ func X__futimesat(tls *TLS, dirfd int32, pathname uintptr, times uintptr) (r int (*(*[2]Ttimespec)(unsafe.Pointer(bp)))[i].Ftv_nsec = (*(*Ttimeval)(unsafe.Pointer(times + uintptr(i)*16))).Ftv_usec * int64(1000) goto _1 _1: + ; i++ } } @@ -134115,7 +135298,7 @@ func X__fdopen(tls *TLS, fd int32, mode uintptr) (r uintptr) { var _ /* wsz at bp+0 */ Twinsize _, _, _, _ = f, flags, v1, v2 /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1465, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1494, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -134285,7 +135468,7 @@ func _close_file(tls *TLS, f uintptr) { (*(*func(*TLS, uintptr, uintptr, Tsize_t) Tsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fwrite})))(tls, f, uintptr(0), uint64(0)) } if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { - (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(SEEK_CUR)) + (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(1)) } } @@ -134303,6 +135486,7 @@ func X__stdio_exit(tls *TLS) { _close_file(tls, f) goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext } _close_file(tls, AtomicLoadPUintptr(uintptr(unsafe.Pointer(&X__stdin_used)))) @@ -134910,6 +136094,7 @@ func Xfflush(tls *TLS, f uintptr) (r1 int32) { } goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext } X__ofl_unlock(tls) @@ -134933,7 +136118,7 @@ func Xfflush(tls *TLS, f uintptr) (r1 int32) { } /* If reading, sync position, per POSIX */ if (*TFILE)(unsafe.Pointer(f)).Frpos != (*TFILE)(unsafe.Pointer(f)).Frend { - (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(SEEK_CUR)) + (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Frend), int32(1)) } /* Clear read and write modes */ v5 = UintptrFromInt32(0) @@ -134965,27 +136150,28 @@ func _locking_getc(tls *TLS, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, old, old1, r, v, v1, v10, v11, v12, v13, v14, v17, v19, v2, v21, v22, v23, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v2 = r goto _3 _3: @@ -134995,7 +136181,7 @@ func _locking_getc(tls *TLS, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v8 = old goto _9 _9: @@ -135013,35 +136199,37 @@ _9: c = v10 v13 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v17 = v goto _18 _18: old1 = v17 goto _16 _16: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v14 = r goto _15 _15: + ; if !!(v14 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v19 = old1 goto _20 _20: @@ -135399,6 +136587,7 @@ func Xfgetws(tls *TLS, s uintptr, n int32, f uintptr) (r uintptr) { } goto _3 _3: + ; n-- } *(*Twchar_t)(unsafe.Pointer(p)) = 0 @@ -135493,9 +136682,11 @@ func _mseek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie)(unsafe.Pointer(c)).Flen1, @@ -135584,7 +136775,7 @@ func Xfmemopen(tls *TLS, buf uintptr, size Tsize_t, mode uintptr) (r uintptr) { var v3 Tsize_t _, _, _, _, _ = f, plus, v1, v2, v3 plus = BoolInt32(!!(Xstrchr(tls, mode, int32('+')) != 0)) - if !(Xstrchr(tls, __ccgo_ts+1465, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1494, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -135654,7 +136845,7 @@ func Xfopen(tls *TLS, filename uintptr, mode uintptr) (r uintptr) { var fd, flags int32 _, _, _ = f, fd, flags /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1465, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1494, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -135725,6 +136916,7 @@ func _cookieread(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer(buf + uintptr(v1))) = *(*uint8)(unsafe.Pointer(v2)) return readlen bail: + ; if ret == 0 { v4 = int32(F_EOF) } else { @@ -135808,7 +137000,7 @@ func Xfopencookie(tls *TLS, cookie uintptr, mode uintptr, iofuncs Tcookie_io_fun var v2 int32 _, _, _ = f, v1, v2 /* Check for valid initial mode character */ - if !(Xstrchr(tls, __ccgo_ts+1465, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { + if !(Xstrchr(tls, __ccgo_ts+1494, int32(*(*int8)(unsafe.Pointer(mode)))) != 0) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -135868,27 +137060,28 @@ func _locking_putc(tls *TLS, c int32, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = old, old1, r, v, v1, v10, v11, v12, v13, v14, v15, v18, v2, v20, v22, v23, v24, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v2 = r goto _3 _3: @@ -135898,7 +137091,7 @@ func _locking_putc(tls *TLS, c int32, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v8 = old goto _9 _9: @@ -135918,35 +137111,37 @@ _9: c = v10 v14 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v18 = v goto _19 _19: old1 = v18 goto _17 _17: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v15 = r goto _16 _16: + ; if !!(v15 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v20 = old1 goto _21 _21: @@ -136217,6 +137412,7 @@ func Xfread(tls *TLS, destv uintptr, size Tsize_t, nmemb Tsize_t, f uintptr) (r } goto _3 _3: + ; l -= k dest += uintptr(k) } @@ -136292,8 +137488,10 @@ func Xfreopen(tls *TLS, filename uintptr, mode uintptr, f uintptr) (r uintptr) { } return f fail2: + ; Xfclose(tls, f2) fail: + ; Xfclose(tls, f) return UintptrFromInt32(0) } @@ -136328,12 +137526,12 @@ func X__fseeko_unlocked(tls *TLS, f uintptr, off Toff_t, whence int32) (r int32) var v1, v2, v3 uintptr _, _, _ = v1, v2, v3 /* Fail immediately for invalid whence argument. */ - if whence != int32(SEEK_CUR) && whence != SEEK_SET && whence != int32(SEEK_END) { + if whence != int32(1) && whence != 0 && whence != int32(2) { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } /* Adjust relative offset for unread data in buffer, if any. */ - if whence == int32(SEEK_CUR) && (*TFILE)(unsafe.Pointer(f)).Frend != 0 { + if whence == int32(1) && (*TFILE)(unsafe.Pointer(f)).Frend != 0 { off -= int64((*TFILE)(unsafe.Pointer(f)).Frend) - int64((*TFILE)(unsafe.Pointer(f)).Frpos) } /* Flush write buffer, and report error on failure. */ @@ -136402,7 +137600,7 @@ func Xfsetpos(tls *TLS, f uintptr, pos uintptr) (r int32) { trc("tls=%v f=%v pos=%v, (%v:)", tls, f, pos, origin(2)) defer func() { trc("-> %v", r) }() } - return X__fseeko(tls, f, *(*int64)(unsafe.Pointer(pos)), SEEK_SET) + return X__fseeko(tls, f, *(*int64)(unsafe.Pointer(pos)), 0) } /* Support signed or unsigned plain-char */ @@ -136423,9 +137621,9 @@ func X__ftello_unlocked(tls *TLS, f uintptr) (r Toff_t) { var v1 int32 _, _ = pos, v1 if (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_APP) != 0 && (*TFILE)(unsafe.Pointer(f)).Fwpos != (*TFILE)(unsafe.Pointer(f)).Fwbase { - v1 = int32(SEEK_END) + v1 = int32(2) } else { - v1 = int32(SEEK_CUR) + v1 = int32(1) } pos = (*(*func(*TLS, uintptr, Toff_t, int32) Toff_t)(unsafe.Pointer(&struct{ uintptr }{(*TFILE)(unsafe.Pointer(f)).Fseek})))(tls, f, 0, v1) if pos < 0 { @@ -136498,12 +137696,13 @@ func X__do_orphaned_stdio_locks(tls *TLS) { break } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1495) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1524) AtomicStorePInt32(f+140, int32(0x40000000)) // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1495) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1524) goto _1 _1: + ; f = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } } @@ -136565,27 +137764,28 @@ func Xftrylockfile(tls *TLS, f uintptr) (r1 int32) { if v11 = owner != 0; !v11 { v2 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1521) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1550) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1521) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1550) v7 = v goto _8 _8: old = v7 goto _6 _6: + ; if v5 = old == 0; v5 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1521) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1550) v3 = r goto _4 _4: @@ -136595,7 +137795,7 @@ func Xftrylockfile(tls *TLS, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1521) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1550) v9 = old goto _10 _10: @@ -136701,6 +137901,7 @@ func X__fwritex(tls *TLS, s uintptr, l Tsize_t, f uintptr) (r Tsize_t) { } goto _1 _1: + ; i-- } if i != 0 { @@ -136785,27 +137986,28 @@ func _locking_getc1(tls *TLS, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, old, old1, r, v, v1, v10, v11, v12, v13, v14, v17, v19, v2, v21, v22, v23, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v2 = r goto _3 _3: @@ -136815,7 +138017,7 @@ func _locking_getc1(tls *TLS, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v8 = old goto _9 _9: @@ -136833,35 +138035,37 @@ _9: c = v10 v13 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v17 = v goto _18 _18: old1 = v17 goto _16 _16: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v14 = r goto _15 _15: + ; if !!(v14 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v19 = old1 goto _20 _20: @@ -136958,27 +138162,28 @@ func _locking_getc2(tls *TLS, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, old, old1, r, v, v1, v10, v11, v12, v13, v14, v17, v19, v2, v21, v22, v23, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v2 = r goto _3 _3: @@ -136988,7 +138193,7 @@ func _locking_getc2(tls *TLS, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v8 = old goto _9 _9: @@ -137006,35 +138211,37 @@ _9: c = v10 v13 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1498) v17 = v goto _18 _18: old1 = v17 goto _16 _16: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1498) v14 = r goto _15 _15: + ; if !!(v14 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1469) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1498) v19 = old1 goto _20 _20: @@ -137388,9 +138595,11 @@ func _ms_seek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie1)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie1)(unsafe.Pointer(c)).Flen1, @@ -137519,9 +138728,11 @@ func _wms_seek(tls *TLS, f uintptr, off Toff_t, whence int32) (r Toff_t) { goto _1 } fail: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return int64(-int32(1)) _1: + ; *(*[3]Tsize_t)(unsafe.Pointer(bp)) = [3]Tsize_t{ 1: (*Tcookie2)(unsafe.Pointer(c)).Fpos, 2: (*Tcookie2)(unsafe.Pointer(c)).Flen1, @@ -137713,27 +138924,28 @@ func _locking_putc1(tls *TLS, c int32, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = old, old1, r, v, v1, v10, v11, v12, v13, v14, v15, v18, v2, v20, v22, v23, v24, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v2 = r goto _3 _3: @@ -137743,7 +138955,7 @@ func _locking_putc1(tls *TLS, c int32, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v8 = old goto _9 _9: @@ -137763,35 +138975,37 @@ _9: c = v10 v14 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v18 = v goto _19 _19: old1 = v18 goto _17 _17: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v15 = r goto _16 _16: + ; if !!(v15 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v20 = old1 goto _21 _21: @@ -137896,27 +139110,28 @@ func _locking_putc2(tls *TLS, c int32, f uintptr) (r1 int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = old, old1, r, v, v1, v10, v11, v12, v13, v14, v15, v18, v2, v20, v22, v23, v24, v4, v6, v8 v1 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v6 = v goto _7 _7: old = v6 goto _5 _5: + ; if v4 = old == 0; v4 { // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v2 = r goto _3 _3: @@ -137926,7 +139141,7 @@ func _locking_putc2(tls *TLS, c int32, f uintptr) (r1 int32) { } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v8 = old goto _9 _9: @@ -137946,35 +139161,37 @@ _9: c = v10 v14 = f + 140 // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) for { // __asm__ __volatile__ ( // // "ll.w %0, %1" // : "=r"(v) // : "ZC"(*p)); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 5, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 5, __ccgo_ts+1511) v18 = v goto _19 _19: old1 = v18 goto _17 _17: + ; // __asm__ __volatile__ ( // // "sc.w %0, %1" // : "=r"(r), "=ZC"(*p) // : "0"(v) : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 16, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 16, __ccgo_ts+1511) v15 = r goto _16 _16: + ; if !!(v15 != 0) { break } } // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1482) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1511) v20 = old1 goto _21 _21: @@ -138151,7 +139368,7 @@ func Xrewind(tls *TLS, f uintptr) { v1 = 0 } __need_unlock = v1 - X__fseeko_unlocked(tls, f, 0, SEEK_SET) + X__fseeko_unlocked(tls, f, 0, 0) *(*uint32)(unsafe.Pointer(f)) &= uint32(^Int32FromInt32(F_ERR)) if __need_unlock != 0 { ___unlockfile(tls, f) @@ -138373,10 +139590,10 @@ func Xtempnam(tls *TLS, dir uintptr, pfx uintptr) (r1 uintptr) { var _ /* s at bp+1 */ [4096]int8 _, _, _, _, _ = dl, l, pl, r, try if !(dir != 0) { - dir = __ccgo_ts + 1534 + dir = __ccgo_ts + 1563 } if !(pfx != 0) { - pfx = __ccgo_ts + 1539 + pfx = __ccgo_ts + 1568 } dl = Xstrlen(tls, dir) pl = Xstrlen(tls, pfx) @@ -138403,6 +139620,7 @@ func Xtempnam(tls *TLS, dir uintptr, pfx uintptr) (r1 uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138429,7 +139647,7 @@ func Xtmpfile(tls *TLS) (r uintptr) { fd = int32(X__syscall_ret(tls, uint64(X__syscall4(tls, int64(SYS_openat), int64(-Int32FromInt32(100)), int64(bp), int64(Int32FromInt32(O_RDWR)|Int32FromInt32(O_CREAT)|Int32FromInt32(O_EXCL)|Int32FromInt32(O_LARGEFILE)), int64(Int32FromInt32(0600)))))) if fd >= 0 { X__syscall3(tls, int64(SYS_unlinkat), int64(-Int32FromInt32(100)), int64(bp), int64(Int32FromInt32(0))) - f = X__fdopen(tls, fd, __ccgo_ts+1544) + f = X__fdopen(tls, fd, __ccgo_ts+1573) if !(f != 0) { X__syscall1(tls, int64(SYS_close), int64(fd)) } @@ -138437,6 +139655,7 @@ func Xtmpfile(tls *TLS) (r uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138472,6 +139691,7 @@ func Xtmpnam(tls *TLS, buf uintptr) (r1 uintptr) { } goto _1 _1: + ; try++ } return uintptr(0) @@ -138838,6 +140058,7 @@ func _pad3(tls *TLS, f uintptr, c int8, w int32, l int32, fl int32) { _out(tls, f, bp, uint64(256)) goto _2 _2: + ; l = int32(uint64(l) - Uint64FromInt64(256)) } _out(tls, f, bp, uint64(l)) @@ -138857,6 +140078,7 @@ func _fmt_x(tls *TLS, x Tuintmax_t, s uintptr, lower int32) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(int32(_xdigits1[x&uint64(15)]) | lower) goto _1 _1: + ; x >>= uint64(4) } return s @@ -138874,6 +140096,7 @@ func _fmt_o(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(uint64('0') + x&uint64(7)) goto _1 _1: + ; x >>= uint64(3) } return s @@ -138892,6 +140115,7 @@ func _fmt_u(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v2)) = int8(uint64('0') + x%uint64(10)) goto _1 _1: + ; x /= uint64(10) } y = x @@ -138904,6 +140128,7 @@ func _fmt_u(tls *TLS, x Tuintmax_t, s uintptr) (r uintptr) { *(*int8)(unsafe.Pointer(v4)) = int8(uint64('0') + y%uint64(10)) goto _3 _3: + ; y /= uint64(10) } return s @@ -138936,7 +140161,7 @@ func _fmt_fp(tls *TLS, f uintptr, y float64, w int32, p int32, fl int32, t int32 var _ /* ebuf0 at bp+538 */ [12]int8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, carry, carry1, d, e, ebuf, estr, i, j, l, need, pl, prefix, r, re, rm, round, round1, s, s1, s2, s3, s4, sh, sh1, small, x, x1, x2, z, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v24, v25, v27, v28, v3, v31, v32, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v48, v49, v5, v51, v52, v54, v55, v56, v57, v58, v6, v7, v8, v9 *(*int32)(unsafe.Pointer(bp + 512)) = 0 - prefix = __ccgo_ts + 1547 + prefix = __ccgo_ts + 1576 ebuf = bp + 538 + uintptr(Uint64FromInt32(3)*Uint64FromInt64(4)) pl = int32(1) *(*float64)(unsafe.Pointer(bp)) = y @@ -138963,16 +140188,16 @@ _2: _4: if !(BoolInt32(v3&(-Uint64FromUint64(1)>>Int32FromInt32(1)) < Uint64FromUint64(0x7ff)<>sh1) * rm goto _26 _26: + ; d += 4 } if !(*(*Tuint32_t)(unsafe.Pointer(a)) != 0) { @@ -139185,6 +140412,7 @@ _4: } goto _29 _29: + ; i *= int32(10) e++ } @@ -139206,6 +140434,7 @@ _4: } goto _30 _30: + ; i *= int32(10) j++ } @@ -139252,6 +140481,7 @@ _4: } goto _33 _33: + ; i *= int32(10) e++ } @@ -139267,6 +140497,7 @@ _4: } goto _34 _34: + ; z -= 4 } if t|int32(32) == int32('g') { @@ -139291,6 +140522,7 @@ _4: } goto _35 _35: + ; i *= int32(10) j++ } @@ -139405,10 +140637,11 @@ _4: _out(tls, f, s2, uint64(int64(bp+516+uintptr(9))-int64(s2))) goto _47 _47: + ; d += 4 } if p != 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { - _out(tls, f, __ccgo_ts+520, uint64(1)) + _out(tls, f, __ccgo_ts+558, uint64(1)) } for { if !(d < z && p > 0) { @@ -139428,6 +140661,7 @@ _4: _out(tls, f, s3, uint64(v52)) goto _50 _50: + ; d += 4 p -= int32(9) } @@ -139458,7 +140692,7 @@ _4: s4++ _out(tls, f, v56, uint64(1)) if p > 0 || uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { - _out(tls, f, __ccgo_ts+520, uint64(1)) + _out(tls, f, __ccgo_ts+558, uint64(1)) } } if int64(bp+516+UintptrFromInt32(9))-int64(s4) < int64(p) { @@ -139470,6 +140704,7 @@ _4: p = int32(int64(p) - (int64(bp+516+UintptrFromInt32(9)) - int64(s4))) goto _53 _53: + ; d += 4 } _pad3(tls, f, int8('0'), p+int32(18), int32(18), 0) @@ -139499,6 +140734,7 @@ func _getint(tls *TLS, s uintptr) (r int32) { } goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s))++ } return i @@ -139544,6 +140780,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp))++ } z = *(*uintptr)(unsafe.Pointer(bp)) @@ -139553,6 +140790,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _3 _3: + ; z++ *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2) } @@ -139583,6 +140821,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl |= uint32(1) << (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) - int32(' ')) goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp))++ } /* Read field width */ @@ -139696,7 +140935,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, return -int32(1) } z = bp + 16 + uintptr(24) - prefix = __ccgo_ts + 1578 + prefix = __ccgo_ts + 1607 pl = 0 t = int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + uintptr(-Int32FromInt32(1))))) /* Transform ls,lc -> S,C */ @@ -139753,6 +140992,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _30 _9: + ; switch ps { case uint32(_BARE): *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = cnt @@ -139772,6 +141012,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _1 _10: + ; if uint64(p) > Uint64FromInt32(2)*Uint64FromInt64(8) { v31 = uint64(p) } else { @@ -139781,7 +141022,9 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, t = int32('x') fl |= Uint32FromUint32(1) << (Int32FromUint8('#') - Int32FromUint8(' ')) _12: + ; _11: + ; a = _fmt_x(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z, t&int32(32)) if *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0 && fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 { prefix += uintptr(t >> Int32FromInt32(4)) @@ -139791,16 +141034,20 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, goto _32 } _13: + ; a = _fmt_o(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z) if fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0 && int64(p) < int64(z)-int64(a)+int64(1) { p = int32(int64(z) - int64(a) + int64(1)) } _32: + ; if !(0 != 0) { goto _33 } _15: + ; _14: + ; pl = int32(1) if *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) > uint64(Int64FromInt64(INT64_MAX)) { *(*Tuintmax_t)(unsafe.Pointer(bp + 8)) = -*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) @@ -139816,8 +141063,10 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } } _16: + ; a = _fmt_u(tls, *(*Tuintmax_t)(unsafe.Pointer(bp + 8)), z) _33: + ; if xp != 0 && p < 0 { goto overflow } @@ -139836,7 +141085,9 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, p = int32(v34) goto _30 narrow_c: + ; _17: + ; v36 = Int32FromInt32(1) p = v36 v35 = z - uintptr(v36) @@ -139845,20 +141096,24 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl &= ^(Uint32FromUint32(1) << (Int32FromUint8('0') - Int32FromUint8(' '))) goto _30 _19: + ; if !(int32(1) != 0) { goto _37 } a = Xstrerror(tls, *(*int32)(unsafe.Pointer(X__errno_location(tls)))) goto _38 _37: + ; _18: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { v39 = *(*uintptr)(unsafe.Pointer(bp + 8)) } else { - v39 = __ccgo_ts + 1588 + v39 = __ccgo_ts + 1617 } a = v39 _38: + ; if p < 0 { v40 = int32(INT_MAX) } else { @@ -139872,6 +141127,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl &= ^(Uint32FromUint32(1) << (Int32FromUint8('0') - Int32FromUint8(' '))) goto _30 _20: + ; if !(*(*Tuintmax_t)(unsafe.Pointer(bp + 8)) != 0) { goto narrow_c } @@ -139880,6 +141136,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, *(*uintptr)(unsafe.Pointer(bp + 8)) = bp + 40 p = -int32(1) _21: + ; ws = *(*uintptr)(unsafe.Pointer(bp + 8)) v42 = Int32FromInt32(0) l = v42 @@ -139896,6 +141153,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _41 _41: + ; i += uint64(l) } if l < 0 { @@ -139921,6 +141179,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, _out(tls, f, bp+48, uint64(l)) goto _46 _46: + ; i += uint64(l) } _pad3(tls, f, int8(' '), w, p, int32(fl^Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' ')))) @@ -139932,13 +141191,21 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, l = v50 goto _1 _29: + ; _28: + ; _27: + ; _26: + ; _25: + ; _24: + ; _23: + ; _22: + ; if xp != 0 && p < 0 { goto overflow } @@ -139948,6 +141215,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _1 _30: + ; if int64(p) < int64(z)-int64(a) { p = int32(int64(z) - int64(a)) } @@ -139984,6 +141252,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, _pop_arg(tls, nl_arg+uintptr(i)*8, *(*int32)(unsafe.Pointer(nl_type + uintptr(i)*4)), ap) goto _51 _51: + ; i++ } for { @@ -139992,6 +141261,7 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _52 _52: + ; i++ } if i <= uint64(NL_ARGMAX) { @@ -139999,9 +141269,11 @@ func _printf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } return int32(1) inval: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) overflow: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return -int32(1) } @@ -140115,6 +141387,7 @@ func _arg_n(tls *TLS, ap Tva_list, n uint32) (r uintptr) { _ = VaUintptr(&ap2) goto _1 _1: + ; i-- } p = VaUintptr(&ap2) @@ -140267,6 +141540,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(10)*width + int32(*(*uint8)(unsafe.Pointer(p))) - int32('0') goto _27 _27: + ; p++ } if int32(*(*uint8)(unsafe.Pointer(p))) == int32('m') { @@ -140444,8 +141718,11 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _42: + ; _41: + ; _40: + ; if t == int32('c') || t == int32('s') { Xmemset(tls, bp+16, -int32(1), uint64(257)) (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[0] = uint8(0) @@ -140495,12 +141772,14 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[int32(1)+c] = uint8(int32(1) - invert) goto _61 _61: + ; c++ } } (*(*[257]uint8)(unsafe.Pointer(bp + 16)))[int32(1)+int32(*(*uint8)(unsafe.Pointer(p)))] = uint8(int32(1) - invert) goto _60 _60: + ; p++ } } @@ -140660,20 +141939,28 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _45: + ; _44: + ; _43: + ; base = int32(16) goto int_common _46: + ; base = int32(8) goto int_common _48: + ; _47: + ; base = int32(10) goto int_common _49: + ; base = 0 int_common: + ; x = X__intscan(tls, f, uint32(base), 0, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) if !((*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != 0) { goto match_fail @@ -140685,13 +141972,21 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _57: + ; _56: + ; _55: + ; _54: + ; _53: + ; _52: + ; _51: + ; _50: + ; y = X__floatscan(tls, f, size, 0) if !((*TFILE)(unsafe.Pointer(f)).Fshcnt+(int64((*TFILE)(unsafe.Pointer(f)).Frpos)-int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) != 0) { goto match_fail @@ -140709,29 +142004,36 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _58 _58: + ; pos += (*TFILE)(unsafe.Pointer(f)).Fshcnt + (int64((*TFILE)(unsafe.Pointer(f)).Frpos) - int64((*TFILE)(unsafe.Pointer(f)).Fbuf)) if dest != 0 { matches++ } goto _2 _2: + ; p++ } if !(0 != 0) { goto _85 } fmt_fail: + ; alloc_fail: + ; input_fail: + ; if !(matches != 0) { matches-- } match_fail: + ; if alloc != 0 { Xfree(tls, s) Xfree(tls, wcs) } _85: + ; if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -140918,7 +142220,7 @@ func _pad4(tls *TLS, f uintptr, n int32, fl int32) { if uint32(fl)&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0 || !(n != 0) || (*TFILE)(unsafe.Pointer(f)).Fflags&uint32(F_ERR) != 0 { return } - Xfprintf(tls, f, __ccgo_ts+1595, VaList(bp+8, n, __ccgo_ts)) + Xfprintf(tls, f, __ccgo_ts+1624, VaList(bp+8, n, __ccgo_ts)) } func _getint1(tls *TLS, s uintptr) (r int32) { @@ -140936,6 +142238,7 @@ func _getint1(tls *TLS, s uintptr) (r int32) { } goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(s)) += 4 } return i @@ -140991,6 +142294,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _2 _2: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) += 4 } z = *(*uintptr)(unsafe.Pointer(bp + 8)) @@ -141000,6 +142304,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _3 _3: + ; z += 4 *(*uintptr)(unsafe.Pointer(bp + 8)) += uintptr(2) * 4 } @@ -141030,6 +142335,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fl |= uint32(1) << (*(*Twchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) - int32(' ')) goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 8)) += 4 } /* Read field width */ @@ -141197,7 +142503,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, fallthrough case int32('s'): if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) { - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 1588 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 1617 } bs = *(*uintptr)(unsafe.Pointer(bp + 16)) v12 = Int32FromInt32(0) @@ -141218,6 +142524,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _11 _11: + ; bs += uintptr(i) l++ } @@ -141250,7 +142557,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, if xp != 0 && p < 0 { goto overflow } - Xsnprintf(tls, bp+24, uint64(16), __ccgo_ts+1599, VaList(bp+56, __ccgo_ts+1619+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1621+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1623+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0)), __ccgo_ts+627+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1625+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0)), int32(_sizeprefix[t|int32(32)-int32('a')]), t)) + Xsnprintf(tls, bp+24, uint64(16), __ccgo_ts+1628, VaList(bp+56, __ccgo_ts+1648+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('#')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1650+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('+')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1652+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('-')-Int32FromUint8(' '))) != 0)), __ccgo_ts+662+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8(' ')-Int32FromUint8(' '))) != 0)), __ccgo_ts+1654+BoolUintptr(!(fl&(Uint32FromUint32(1)<<(Int32FromUint8('0')-Int32FromUint8(' '))) != 0)), int32(_sizeprefix[t|int32(32)-int32('a')]), t)) switch t | Int32FromInt32(32) { case int32('a'): fallthrough @@ -141291,6 +142598,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, _pop_arg1(tls, nl_arg+uintptr(i)*8, *(*int32)(unsafe.Pointer(nl_type + uintptr(i)*4)), ap) goto _17 _17: + ; i++ } for { @@ -141299,6 +142607,7 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } goto _18 _18: + ; i++ } if i <= int32(NL_ARGMAX) { @@ -141306,9 +142615,11 @@ func _wprintf_core(tls *TLS, f uintptr, fmt uintptr, ap uintptr, nl_arg uintptr, } return int32(1) inval: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) overflow: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return -int32(1) } @@ -141386,6 +142697,7 @@ func _arg_n1(tls *TLS, ap Tva_list, n uint32) (r uintptr) { _ = VaUintptr(&ap2) goto _1 _1: + ; i-- } p = VaUintptr(&ap2) @@ -141428,6 +142740,7 @@ func _in_set(tls *TLS, set uintptr, c int32) (r int32) { } goto _2 _2: + ; j++ } } @@ -141436,6 +142749,7 @@ func _in_set(tls *TLS, set uintptr, c int32) (r int32) { } goto _1 _1: + ; p += 4 } return 0 @@ -141569,6 +142883,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(10)*width + *(*Twchar_t)(unsafe.Pointer(p)) - int32('0') goto _20 _20: + ; p += 4 } if *(*Twchar_t)(unsafe.Pointer(p)) == int32('m') { @@ -141712,7 +143027,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { width = int32(1) } invert = int32(1) - set = __ccgo_ts + 1627 + set = __ccgo_ts + 1656 } else { if t == int32('s') { invert = int32(1) @@ -141889,7 +143204,7 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { if width < int32(1) { width = 0 } - Xsnprintf(tls, bp+8, uint64(22), __ccgo_ts+1631, VaList(bp+40, int32(1)+BoolInt32(!(dest != 0)), __ccgo_ts+1649, width, uintptr(unsafe.Pointer(&_size_pfx))+uintptr(size+int32(2))*3, t)) + Xsnprintf(tls, bp+8, uint64(22), __ccgo_ts+1660, VaList(bp+40, int32(1)+BoolInt32(!(dest != 0)), __ccgo_ts+1678, width, uintptr(unsafe.Pointer(&_size_pfx))+uintptr(size+int32(2))*3, t)) *(*Toff_t)(unsafe.Pointer(bp)) = 0 if dest != 0 { v45 = dest @@ -141912,23 +143227,29 @@ func Xvfwscanf(tls *TLS, f uintptr, fmt uintptr, ap Tva_list) (r int32) { } goto _2 _2: + ; p += 4 } if !(0 != 0) { goto _46 } fmt_fail: + ; alloc_fail: + ; input_fail: + ; if !(matches != 0) { matches-- } match_fail: + ; if alloc != 0 { Xfree(tls, s) Xfree(tls, wcs) } _46: + ; if __need_unlock != 0 { ___unlockfile(tls, f) } @@ -142544,7 +143865,7 @@ func Xecvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { if uint32(n)-uint32(1) > uint32(15) { n = int32(15) } - Xsprintf(tls, bp, __ccgo_ts+1652, VaList(bp+40, n-int32(1), x)) + Xsprintf(tls, bp, __ccgo_ts+1681, VaList(bp+40, n-int32(1), x)) v1 = BoolInt32(int32((*(*[32]int8)(unsafe.Pointer(bp)))[0]) == Int32FromUint8('-')) *(*int32)(unsafe.Pointer(sign)) = v1 i = v1 @@ -142556,6 +143877,7 @@ func Xecvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { _buf8[j] = (*(*[32]int8)(unsafe.Pointer(bp)))[i] goto _2 _2: + ; v3 = i i++ j += BoolInt32(int32((*(*[32]int8)(unsafe.Pointer(bp)))[v3]) != int32('.')) @@ -142580,12 +143902,12 @@ func Xfcvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { if uint32(n) > uint32(1400) { n = int32(1400) } - Xsprintf(tls, bp, __ccgo_ts+1657, VaList(bp+1512, n, x)) + Xsprintf(tls, bp, __ccgo_ts+1686, VaList(bp+1512, n, x)) i = BoolInt32(int32((*(*[1500]int8)(unsafe.Pointer(bp)))[0]) == int32('-')) if int32((*(*[1500]int8)(unsafe.Pointer(bp)))[i]) == int32('0') { - lz = int32(Xstrspn(tls, bp+uintptr(i)+uintptr(2), __ccgo_ts+1625)) + lz = int32(Xstrspn(tls, bp+uintptr(i)+uintptr(2), __ccgo_ts+1654)) } else { - lz = -int32(Xstrcspn(tls, bp+uintptr(i), __ccgo_ts+520)) + lz = -int32(Xstrcspn(tls, bp+uintptr(i), __ccgo_ts+558)) } if n <= lz { *(*int32)(unsafe.Pointer(sign)) = i @@ -142593,7 +143915,7 @@ func Xfcvt(tls *TLS, x float64, n int32, dp uintptr, sign uintptr) (r uintptr) { if uint32(n) > uint32(14) { n = int32(14) } - return __ccgo_ts + 1662 + UintptrFromInt32(14) - uintptr(n) + return __ccgo_ts + 1691 + UintptrFromInt32(14) - uintptr(n) } return Xecvt(tls, x, n-lz, dp, sign) } @@ -142605,7 +143927,7 @@ func Xgcvt(tls *TLS, x float64, n int32, b uintptr) (r uintptr) { } bp := tls.Alloc(32) defer tls.Free(32) - Xsprintf(tls, b, __ccgo_ts+1678, VaList(bp+8, n, x)) + Xsprintf(tls, b, __ccgo_ts+1707, VaList(bp+8, n, x)) return b } @@ -142742,6 +144064,7 @@ func _cycle(tls *TLS, width Tsize_t, ar uintptr, n int32) { *(*uintptr)(unsafe.Pointer(ar + uintptr(i)*8)) += uintptr(l) goto _2 _2: + ; i++ } width -= l @@ -142879,6 +144202,7 @@ func X__qsort_r(tls *TLS, base uintptr, nel Tsize_t, width Tsize_t, cmp Tcmpfun, } goto _1 _1: + ; i++ } for head < high { @@ -143119,7 +144443,7 @@ func _do_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { _, _, _, _, _ = i, wcs, v2, v3, v4 wcs = (*TFILE)(unsafe.Pointer(f)).Fcookie if !(*(*Twchar_t)(unsafe.Pointer(wcs)) != 0) { - wcs = __ccgo_ts + 1683 + wcs = __ccgo_ts + 1712 } i = uint64(0) for { @@ -143134,6 +144458,7 @@ func _do_read(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr(i))) = uint8(v2) goto _1 _1: + ; i++ } (*TFILE)(unsafe.Pointer(f)).Frpos = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -143222,7 +144547,7 @@ func _do_read1(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { _, _, _, _, _ = i, wcs, v2, v3, v4 wcs = (*TFILE)(unsafe.Pointer(f)).Fcookie if !(*(*Twchar_t)(unsafe.Pointer(wcs)) != 0) { - wcs = __ccgo_ts + 1683 + wcs = __ccgo_ts + 1712 } i = uint64(0) for { @@ -143237,6 +144562,7 @@ func _do_read1(tls *TLS, f uintptr, buf uintptr, len1 Tsize_t) (r Tsize_t) { *(*uint8)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fbuf + uintptr(i))) = uint8(v2) goto _1 _1: + ; i++ } (*TFILE)(unsafe.Pointer(f)).Frpos = (*TFILE)(unsafe.Pointer(f)).Fbuf @@ -143412,6 +144738,7 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt } goto _1 _1: + ; n-- s++ d++ @@ -143429,6 +144756,7 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt *(*uint64)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) goto _4 _4: + ; n -= uint64(8) ws += 8 wd += 8 @@ -143446,11 +144774,13 @@ func Xmemccpy(tls *TLS, dest uintptr, src uintptr, c int32, n Tsize_t) (r uintpt } goto _5 _5: + ; n-- s++ d++ } tail: + ; if n != 0 { return d + uintptr(1) } @@ -143484,6 +144814,7 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { } goto _1 _1: + ; s++ n-- } @@ -143496,6 +144827,7 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { } goto _2 _2: + ; w += 8 n -= Uint64FromInt64(8) } @@ -143507,6 +144839,7 @@ func Xmemchr(tls *TLS, src uintptr, c int32, n Tsize_t) (r uintptr) { } goto _3 _3: + ; s++ n-- } @@ -143534,6 +144867,7 @@ func Xmemcmp(tls *TLS, vl uintptr, vr uintptr, n Tsize_t) (r1 int32) { } goto _1 _1: + ; n-- l++ r++ @@ -143570,6 +144904,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint8)(unsafe.Pointer(v2)) = *(*uint8)(unsafe.Pointer(v3)) goto _1 _1: + ; n-- } if uint64(d)%uint64(4) == uint64(0) { @@ -143583,6 +144918,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint32)(unsafe.Pointer(d + UintptrFromInt32(12))) = *(*uint32)(unsafe.Pointer(s + UintptrFromInt32(12))) goto _4 _4: + ; s += uintptr(16) d += uintptr(16) n -= uint64(16) @@ -143649,6 +144985,7 @@ func Xmemcpy(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r uintptr) { *(*uint32)(unsafe.Pointer(d + UintptrFromInt32(12))) = x>>Int32FromInt32(24) | w<>Int32FromInt32(16) | w<>Int32FromInt32(8) | w<= s { @@ -146060,6 +147454,7 @@ func Xwcsspn(tls *TLS, s uintptr, c uintptr) (r Tsize_t) { } goto _1 _1: + ; s += 4 } return uint64((int64(s) - int64(a)) / 4) @@ -146078,6 +147473,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _1 _1: + ; l++ } if *(*Twchar_t)(unsafe.Pointer(n + uintptr(l)*4)) != 0 { @@ -146192,6 +147588,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _10 _10: + ; k++ } if *(*Twchar_t)(unsafe.Pointer(n + uintptr(k)*4)) != 0 { @@ -146207,6 +147604,7 @@ func _twoway_wcsstr(tls *TLS, h uintptr, n uintptr) (r uintptr) { } goto _12 _12: + ; k-- } if k <= mem { @@ -146297,6 +147695,7 @@ func Xwmemchr(tls *TLS, s uintptr, c Twchar_t, n Tsize_t) (r uintptr) { } goto _1 _1: + ; n-- s += 4 } @@ -146321,6 +147720,7 @@ func Xwmemcmp(tls *TLS, l uintptr, r uintptr, n Tsize_t) (r1 int32) { } goto _1 _1: + ; n-- l += 4 r += 4 @@ -146432,7 +147832,7 @@ func Xmkdtemp(tls *TLS, template uintptr) (r uintptr) { _, _, _ = l, retries, v1 l = Xstrlen(tls, template) retries = int32(100) - if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1691, uint64(6)) != 0 { + if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1720, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return uintptr(0) } @@ -146443,13 +147843,14 @@ func Xmkdtemp(tls *TLS, template uintptr) (r uintptr) { } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EEXIST)) { break } } - Xmemcpy(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1691, uint64(6)) + Xmemcpy(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1720, uint64(6)) return uintptr(0) } @@ -146472,7 +147873,7 @@ func X__mkostemps(tls *TLS, template uintptr, len1 int32, flags int32) (r int32) var l Tsize_t _, _, _, _, _ = fd, l, retries, v1, v3 l = Xstrlen(tls, template) - if l < uint64(6) || uint64(len1) > l-uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1691, uint64(6)) != 0 { + if l < uint64(6) || uint64(len1) > l-uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1720, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) return -int32(1) } @@ -146487,13 +147888,14 @@ func X__mkostemps(tls *TLS, template uintptr, len1 int32, flags int32) (r int32) } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0 && *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(EEXIST)) { break } } - Xmemcpy(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1691, uint64(6)) + Xmemcpy(tls, template+uintptr(l)-uintptr(len1)-uintptr(6), __ccgo_ts+1720, uint64(6)) return -int32(1) } @@ -146534,7 +147936,7 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { _, _, _ = l, retries, v1 l = Xstrlen(tls, template) retries = int32(100) - if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1691, uint64(6)) != 0 { + if l < uint64(6) || Xmemcmp(tls, template+uintptr(l)-uintptr(6), __ccgo_ts+1720, uint64(6)) != 0 { *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EINVAL) *(*int8)(unsafe.Pointer(template)) = 0 return template @@ -146549,6 +147951,7 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { } goto _2 _2: + ; retries-- v1 = retries if !(v1 != 0) { @@ -146560,22 +147963,6 @@ func Xmktemp(tls *TLS, template uintptr) (r uintptr) { return template } -const CBAUD = 4111 -const CBAUDEX = 4096 -const CIBAUD = 269418496 -const CMSPAR = 1073741824 -const CRTSCTS = 2147483648 -const ECHOCTL = 512 -const ECHOKE = 2048 -const ECHOPRT = 1024 -const EXTA = 14 -const EXTB = 15 -const EXTPROC = 65536 -const FLUSHO = 4096 -const PENDIN = 16384 -const XCASE = 4 -const XTABS = 6144 - func Xcfgetospeed(tls *TLS, tio uintptr) (r Tspeed_t) { if __ccgo_strace { trc("tls=%v tio=%v, (%v:)", tls, tio, origin(2)) @@ -146869,6 +148256,7 @@ func X__secs_to_tm(tls *TLS, t int64, tm uintptr) (r int32) { remdays -= int32(_days_in_month[months]) goto _1 _1: + ; months++ } if months >= int32(10) { @@ -146967,6 +148355,7 @@ func _getint2(tls *TLS, p uintptr) (r int32) { x = uint32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p)))))-int32('0')) + uint32(10)*x goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(p))++ } return int32(x) @@ -147045,6 +148434,7 @@ func _getname(tls *TLS, d uintptr, p uintptr) { } goto _1 _1: + ; i++ } if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p)) + uintptr(i))) != 0 { @@ -147061,6 +148451,7 @@ func _getname(tls *TLS, d uintptr, p uintptr) { } goto _2 _2: + ; i++ } } @@ -147090,6 +148481,7 @@ func _zi_dotprod(tls *TLS, z uintptr, v uintptr, n Tsize_t) (r Tsize_t) { y += uint64(x * uint32(*(*uint8)(unsafe.Pointer(v)))) goto _1 _1: + ; n-- z += uintptr(4) v++ @@ -147111,9 +148503,9 @@ func _do_tzset(tls *TLS) { _, _, _, _, _, _, _, _, _, _, _, _, _ = i, l, map1, p1, pathname, posix_form, scale, skip, try, v2, v5, v6, v7 pathname = bp + 6 + uintptr(24) map1 = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 288)) = Xgetenv(tls, __ccgo_ts+1698) + *(*uintptr)(unsafe.Pointer(bp + 288)) = Xgetenv(tls, __ccgo_ts+1727) if !(*(*uintptr)(unsafe.Pointer(bp + 288)) != 0) { - *(*uintptr)(unsafe.Pointer(bp + 288)) = __ccgo_ts + 1701 + *(*uintptr)(unsafe.Pointer(bp + 288)) = __ccgo_ts + 1730 } if !(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288)))) != 0) { *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) @@ -147131,6 +148523,7 @@ func _do_tzset(tls *TLS) { _r0[i] = v2 goto _1 _1: + ; i++ } if _zi != 0 { @@ -147161,7 +148554,7 @@ func _do_tzset(tls *TLS) { if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) != int32(':') { *(*uintptr)(unsafe.Pointer(bp + 296)) = *(*uintptr)(unsafe.Pointer(bp + 288)) _getname(tls, bp+308, bp+296) - if *(*uintptr)(unsafe.Pointer(bp + 296)) != *(*uintptr)(unsafe.Pointer(bp + 288)) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('+') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('-') || BoolInt32(uint32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296)))))-uint32('0') < uint32(10)) != 0 || !(Xstrcmp(tls, bp+308, __ccgo_ts+1716) != 0) || !(Xstrcmp(tls, bp+308, __ccgo_ts+1720) != 0)) { + if *(*uintptr)(unsafe.Pointer(bp + 296)) != *(*uintptr)(unsafe.Pointer(bp + 288)) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('+') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296))))) == int32('-') || BoolInt32(uint32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296)))))-uint32('0') < uint32(10)) != 0 || !(Xstrcmp(tls, bp+308, __ccgo_ts+1745) != 0) || !(Xstrcmp(tls, bp+308, __ccgo_ts+1749) != 0)) { posix_form = int32(1) } } @@ -147173,7 +148566,7 @@ func _do_tzset(tls *TLS) { *(*uintptr)(unsafe.Pointer(bp + 288))++ } if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) == int32('/') || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 288))))) == int32('.') { - if !(X__libc.Fsecure != 0) || !(Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), __ccgo_ts+1701) != 0) { + if !(X__libc.Fsecure != 0) || !(Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), __ccgo_ts+1730) != 0) { map1 = X__map_file(tls, *(*uintptr)(unsafe.Pointer(bp + 288)), uintptr(unsafe.Pointer(&_map_size))) } } else { @@ -147191,6 +148584,7 @@ func _do_tzset(tls *TLS) { map1 = X__map_file(tls, pathname-uintptr(l), uintptr(unsafe.Pointer(&_map_size))) goto _3 _3: + ; try += uintptr(l + uint64(1)) } } @@ -147199,7 +148593,7 @@ func _do_tzset(tls *TLS) { *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) } } - if map1 != 0 && (_map_size < uint64(44) || Xmemcmp(tls, map1, __ccgo_ts+1724, uint64(4)) != 0) { + if map1 != 0 && (_map_size < uint64(44) || Xmemcmp(tls, map1, __ccgo_ts+1753, uint64(4)) != 0) { X__munmap(tls, map1, _map_size) map1 = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 288)) = uintptr(unsafe.Pointer(&X__utc)) @@ -147234,6 +148628,7 @@ func _do_tzset(tls *TLS) { } goto _4 _4: + ; *(*uintptr)(unsafe.Pointer(bp + 288))-- } *(*uintptr)(unsafe.Pointer(bp + 288))++ @@ -147262,6 +148657,7 @@ func _do_tzset(tls *TLS) { } goto _8 _8: + ; p1 += uintptr(6) } if !(Xtzname[0] != 0) { @@ -147370,6 +148766,7 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { } goto _1 _1: + ; i -= uint64(6) } if local != 0 { @@ -147505,6 +148902,7 @@ func X__secs_to_zone(tls *TLS, t int64, local int32, isdst uintptr, offset uintp goto dst } std: + ; *(*int32)(unsafe.Pointer(isdst)) = 0 *(*int64)(unsafe.Pointer(offset)) = -Xtimezone if oppoff != 0 { @@ -147514,6 +148912,7 @@ std: ___unlock(tls, uintptr(unsafe.Pointer(&_lock4))) return dst: + ; *(*int32)(unsafe.Pointer(isdst)) = int32(1) *(*int64)(unsafe.Pointer(offset)) = int64(-_dst_off) if oppoff != 0 { @@ -147631,7 +149030,7 @@ func X__asctime_r(tls *TLS, tm uintptr, buf uintptr) (r uintptr) { } bp := tls.Alloc(64) defer tls.Free(64) - if Xsnprintf(tls, buf, uint64(26), __ccgo_ts+1729, VaList(bp+8, X__nl_langinfo_l(tls, int32(ABDAY_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_wday, uintptr(unsafe.Pointer(&X__c_locale))), X__nl_langinfo_l(tls, int32(ABMON_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_mon, uintptr(unsafe.Pointer(&X__c_locale))), (*Ttm)(unsafe.Pointer(tm)).Ftm_mday, (*Ttm)(unsafe.Pointer(tm)).Ftm_hour, (*Ttm)(unsafe.Pointer(tm)).Ftm_min, (*Ttm)(unsafe.Pointer(tm)).Ftm_sec, int32(1900)+(*Ttm)(unsafe.Pointer(tm)).Ftm_year)) >= int32(26) { + if Xsnprintf(tls, buf, uint64(26), __ccgo_ts+1758, VaList(bp+8, X__nl_langinfo_l(tls, int32(ABDAY_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_wday, uintptr(unsafe.Pointer(&X__c_locale))), X__nl_langinfo_l(tls, int32(ABMON_1)+(*Ttm)(unsafe.Pointer(tm)).Ftm_mon, uintptr(unsafe.Pointer(&X__c_locale))), (*Ttm)(unsafe.Pointer(tm)).Ftm_mday, (*Ttm)(unsafe.Pointer(tm)).Ftm_hour, (*Ttm)(unsafe.Pointer(tm)).Ftm_min, (*Ttm)(unsafe.Pointer(tm)).Ftm_sec, int32(1900)+(*Ttm)(unsafe.Pointer(tm)).Ftm_year)) >= int32(26) { /* ISO C requires us to use the above format string, * even if it will not fit in the buffer. Thus asctime_r * is _supposed_ to crash if the fields in tm are too large. @@ -147847,14 +149246,14 @@ func Xgetdate(tls *TLS, s uintptr) (r uintptr) { var _ /* fmt at bp+0 */ [100]int8 _, _, _, _ = datemsk, f, p, ret ret = uintptr(0) - datemsk = Xgetenv(tls, __ccgo_ts+1761) + datemsk = Xgetenv(tls, __ccgo_ts+1790) f = uintptr(0) _pthread_setcancelstate(tls, PTHREAD_CANCEL_DEFERRED, bp+100) if !(datemsk != 0) { Xgetdate_err = int32(1) goto out } - f = Xfopen(tls, datemsk, __ccgo_ts+1201) + f = Xfopen(tls, datemsk, __ccgo_ts+315) if !(f != 0) { if *(*int32)(unsafe.Pointer(X__errno_location(tls))) == int32(ENOMEM) { Xgetdate_err = int32(6) @@ -147876,6 +149275,7 @@ func Xgetdate(tls *TLS, s uintptr) (r uintptr) { Xgetdate_err = int32(7) } out: + ; if f != 0 { Xfclose(tls, f) } @@ -148017,6 +149417,7 @@ func Xmktime(tls *TLS, tm uintptr) (r Ttime_t) { *(*Ttm)(unsafe.Pointer(tm)) = *(*Ttm)(unsafe.Pointer(bp)) return t error: + ; *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(EOVERFLOW) return int64(-int32(1)) } @@ -148082,7 +149483,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc var item Tnl_item var val int64 _, _, _, _, _, _, _, _, _, _, _, _ = d, def_pad, fmt, item, val, width, v1, v2, v4, v5, v6, v7 - fmt = __ccgo_ts + 1623 + fmt = __ccgo_ts + 1652 width = int32(2) def_pad = int32('0') switch f { @@ -148125,10 +149526,10 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc val = int64((*Ttm)(unsafe.Pointer(tm)).Ftm_mday) goto number case int32('D'): - fmt = __ccgo_ts + 1769 + fmt = __ccgo_ts + 1798 goto recu_strftime case int32('F'): - fmt = __ccgo_ts + 1778 + fmt = __ccgo_ts + 1807 goto recu_strftime case int32('g'): fallthrough @@ -148179,7 +149580,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto number case int32('n'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 1361 + return __ccgo_ts + 301 case int32('p'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_hour >= int32(12) { v1 = int32(PM_STR) @@ -148209,6 +149610,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc *(*int8)(unsafe.Pointer(v4)) = int8(Xtolower(tls, int32(*(*int8)(unsafe.Pointer(v5))))) goto _3 _3: + ; *(*Tsize_t)(unsafe.Pointer(l))++ } return s @@ -148216,7 +149618,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc item = int32(T_FMT_AMPM) goto nl_strftime case int32('R'): - fmt = __ccgo_ts + 1787 + fmt = __ccgo_ts + 1816 goto recu_strftime case int32('s'): val = X__tm_to_secs(tls, tm) - (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff @@ -148227,9 +149629,9 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto number case int32('t'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 1359 + return __ccgo_ts + 1390 case int32('T'): - fmt = __ccgo_ts + 1793 + fmt = __ccgo_ts + 1822 goto recu_strftime case int32('u'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_wday != 0 { @@ -148268,7 +149670,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc case int32('Y'): val = int64((*Ttm)(unsafe.Pointer(tm)).Ftm_year) + int64(1900) if val >= int64(10000) { - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1802, VaList(bp+8, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1831, VaList(bp+8, val))) return s } width = int32(4) @@ -148278,7 +149680,7 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc *(*Tsize_t)(unsafe.Pointer(l)) = uint64(0) return __ccgo_ts } - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1808, VaList(bp+8, (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff/int64(3600)*int64(100)+(*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff%int64(3600)/int64(60)))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1837, VaList(bp+8, (*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff/int64(3600)*int64(100)+(*Ttm)(unsafe.Pointer(tm)).F__tm_gmtoff%int64(3600)/int64(60)))) return s case int32('Z'): if (*Ttm)(unsafe.Pointer(tm)).Ftm_isdst < 0 { @@ -148289,11 +149691,12 @@ func X__strftime_fmt_1(tls *TLS, s uintptr, l uintptr, f int32, tm uintptr, loc goto string case int32('%'): *(*Tsize_t)(unsafe.Pointer(l)) = uint64(1) - return __ccgo_ts + 310 + return __ccgo_ts + 348 default: return uintptr(0) } number: + ; if pad != 0 { v7 = pad } else { @@ -148301,24 +149704,28 @@ number: } switch v7 { case int32('-'): - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1815, VaList(bp+8, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1844, VaList(bp+8, val))) case int32('_'): - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1820, VaList(bp+8, width, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1849, VaList(bp+8, width, val))) case int32('0'): fallthrough default: - *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1826, VaList(bp+8, width, val))) + *(*Tsize_t)(unsafe.Pointer(l)) = uint64(Xsnprintf(tls, s, uint64(100), __ccgo_ts+1855, VaList(bp+8, width, val))) break } return s nl_strcat: + ; fmt = X__nl_langinfo_l(tls, item, loc) string: + ; *(*Tsize_t)(unsafe.Pointer(l)) = Xstrlen(tls, fmt) return fmt nl_strftime: + ; fmt = X__nl_langinfo_l(tls, item, loc) recu_strftime: + ; *(*Tsize_t)(unsafe.Pointer(l)) = X__strftime_l(tls, s, uint64(100), fmt, tm, loc) if !(*(*Tsize_t)(unsafe.Pointer(l)) != 0) { return uintptr(0) @@ -148404,6 +149811,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _5 _5: + ; t++ *(*Tsize_t)(unsafe.Pointer(bp))-- } @@ -148417,6 +149825,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _6 _6: + ; d++ } if (*Ttm)(unsafe.Pointer(tm)).Ftm_year < -int32(1900) { @@ -148448,6 +149857,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl *(*int8)(unsafe.Pointer(s + uintptr(v12))) = int8('0') goto _11 _11: + ; width-- } } @@ -148458,6 +149868,7 @@ func X__strftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl l += *(*Tsize_t)(unsafe.Pointer(bp)) goto _1 _1: + ; f++ } if n != 0 { @@ -148523,6 +149934,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _4 _4: + ; s++ } } else { @@ -148614,25 +150026,32 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _41 _11: + ; _10: + ; dest = tm + 24 min = int32(ABDAY_1) range1 = int32(7) goto symbolic_range _14: + ; _13: + ; _12: + ; dest = tm + 16 min = int32(ABMON_1) range1 = int32(12) goto symbolic_range _15: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(D_T_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _16: + ; dest = bp + 4 if w < 0 { w = int32(2) @@ -148640,47 +150059,58 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { want_century |= int32(2) goto numeric_digits _18: + ; _17: + ; dest = tm + 12 min = int32(1) range1 = int32(31) goto numeric_range _19: - s = Xstrptime(tls, s, __ccgo_ts+1769, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1798, tm) if !(s != 0) { return uintptr(0) } goto _41 _20: + ; dest = tm + 8 min = 0 range1 = int32(24) goto numeric_range _21: + ; dest = tm + 8 min = int32(1) range1 = int32(12) goto numeric_range _22: + ; dest = tm + 28 min = int32(1) range1 = int32(366) adj = int32(1) goto numeric_range _23: + ; dest = tm + 16 min = int32(1) range1 = int32(12) adj = int32(1) goto numeric_range _24: + ; dest = tm + 4 min = 0 range1 = int32(60) goto numeric_range _26: + ; _25: + ; _44: + ; if v48 = *(*int8)(unsafe.Pointer(s)) != 0; v48 { v45 = int32(*(*int8)(unsafe.Pointer(s))) v46 = BoolInt32(v45 == int32(' ') || uint32(v45)-uint32('\t') < uint32(5)) @@ -148692,12 +150122,15 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _43 _43: + ; s++ goto _44 goto _42 _42: + ; goto _41 _27: + ; ex = Xnl_langinfo(tls, int32(AM_STR)) len1 = Xstrlen(tls, ex) if !(Xstrncasecmp(tls, s, ex, len1) != 0) { @@ -148715,58 +150148,69 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } return uintptr(0) _28: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(T_FMT_AMPM)), tm) if !(s != 0) { return uintptr(0) } goto _41 _29: - s = Xstrptime(tls, s, __ccgo_ts+1787, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1816, tm) if !(s != 0) { return uintptr(0) } goto _41 _30: + ; dest = tm min = 0 range1 = int32(61) goto numeric_range _31: - s = Xstrptime(tls, s, __ccgo_ts+1793, tm) + ; + s = Xstrptime(tls, s, __ccgo_ts+1822, tm) if !(s != 0) { return uintptr(0) } goto _41 _33: + ; _32: + ; /* Throw away result, for now. (FIXME?) */ dest = bp min = 0 range1 = int32(54) goto numeric_range _34: + ; dest = tm + 24 min = 0 range1 = int32(7) goto numeric_range _35: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(D_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _36: + ; s = Xstrptime(tls, s, Xnl_langinfo(tls, int32(T_FMT)), tm) if !(s != 0) { return uintptr(0) } goto _41 _37: + ; dest = bp + 8 w = int32(2) want_century |= int32(1) goto numeric_digits _38: + ; dest = tm + 20 if w < 0 { w = int32(4) @@ -148775,6 +150219,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { want_century = 0 goto numeric_digits _39: + ; v49 = s s++ if int32(*(*int8)(unsafe.Pointer(v49))) != int32('%') { @@ -148782,8 +150227,10 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto _41 _40: + ; return uintptr(0) numeric_range: + ; if !(BoolInt32(uint32(*(*int8)(unsafe.Pointer(s)))-Uint32FromUint8('0') < Uint32FromInt32(10)) != 0) { return uintptr(0) } @@ -148798,6 +150245,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) = *(*int32)(unsafe.Pointer(dest))*int32(10) + int32(*(*int8)(unsafe.Pointer(v51))) - int32('0') goto _50 _50: + ; i *= int32(10) } if uint32(*(*int32)(unsafe.Pointer(dest))-min) >= uint32(range1) { @@ -148809,6 +150257,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto update numeric_digits: + ; neg = 0 if int32(*(*int8)(unsafe.Pointer(s))) == int32('+') { s++ @@ -148833,6 +150282,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) = *(*int32)(unsafe.Pointer(dest))*int32(10) + int32(*(*int8)(unsafe.Pointer(v54))) - int32('0') goto _52 _52: + ; i++ } if neg != 0 { @@ -148841,6 +150291,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(dest)) -= adj goto update symbolic_range: + ; i = int32(2)*range1 - int32(1) for { if !(i >= 0) { @@ -148856,6 +150307,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { break goto _55 _55: + ; i-- } if i < 0 { @@ -148863,6 +150315,7 @@ func Xstrptime(tls *TLS, s uintptr, f uintptr, tm uintptr) (r uintptr) { } goto update update: + ; //FIXME _41: } @@ -148926,10 +150379,10 @@ func Xtimer_delete(tls *TLS, t Ttimer_t) (r int32) { if int64(t) < 0 { td = uintptr(uint64(t) << Int32FromInt32(1)) // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1833) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1862) AtomicStorePInt32(td+148, AtomicLoadPInt32(td+148)|(-Int32FromInt32(1)-Int32FromInt32(0x7fffffff))) // __asm__ __volatile__ ("dbar 0" : : : "memory"); - X__assert_fail(tls, __ccgo_ts+312, __ccgo_ts+347, 49, __ccgo_ts+1833) + X__assert_fail(tls, __ccgo_ts+350, __ccgo_ts+385, 49, __ccgo_ts+1862) X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(td)).Ftid), int64(Int32FromInt32(SIGTIMER))) return 0 } @@ -149117,6 +150570,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl } goto _5 _5: + ; t += 4 *(*Tsize_t)(unsafe.Pointer(bp))-- } @@ -149143,6 +150597,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl *(*Twchar_t)(unsafe.Pointer(s + uintptr(v9)*4)) = int32('0') goto _8 _8: + ; width-- } } @@ -149153,6 +150608,7 @@ func X__wcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tl l += *(*Tsize_t)(unsafe.Pointer(bp)) goto _1 _1: + ; f += 4 } if n != 0 { @@ -149265,9 +150721,9 @@ func Xctermid(tls *TLS, s uintptr) (r uintptr) { var v1 uintptr _ = v1 if s != 0 { - v1 = Xstrcpy(tls, s, __ccgo_ts+1846) + v1 = Xstrcpy(tls, s, __ccgo_ts+292) } else { - v1 = __ccgo_ts + 1846 + v1 = __ccgo_ts + 292 } return v1 } @@ -149542,6 +150998,7 @@ func Xgethostname(tls *TLS, name uintptr, len1 Tsize_t) (r int32) { } goto _1 _1: + ; i++ } if i != 0 && i == len1 { @@ -149555,7 +151012,7 @@ func Xgetlogin(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - return Xgetenv(tls, __ccgo_ts+1855) + return Xgetenv(tls, __ccgo_ts+1875) } func Xgetlogin_r(tls *TLS, name uintptr, size Tsize_t) (r int32) { @@ -152592,4 +154049,4 @@ var Xstdout = uintptr(unsafe.Pointer(&X__stdout_FILE)) var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "\x00/bin:/usr/bin\x00%s\x008b \xd0\xc1\xd2\xcf\xcc\xd8\x00$2a$00$abcdefghijklmnopqrstuu\x00\xff\xa334\xff\xff\xff\xa3345\x00*\x00\x80\xff\x80\x01 \x7f\x81\x80\x80\r\n\xff\x7f \x81 test\x00_0.../9Zz\x00_0.../9ZzX7iSJNd21sU\x00\x80x\x00\x80x22/wK52ZKGA\x00x\x00$1$\x00$5$\x00rounds=\x00rounds=%u$\x00$5$%s%.*s$\x00$6$\x00$6$%s%.*s$\x00toupper\x00tolower\x00Assertion failed: %s (%s: %s: %d)\n\x00infinity\x00nan\x00\x00\x01\x02\x04\a\x03\x06\x05\x00/proc/self/fd/\x00UTF-8\x00NLSPATH\x00LANG\x00_.@\x00.@\x00%\x00assembler statements not supported\x00atomic_arch.h\x00bindtextdomain\x00messages\x00%s/%.*s%.*s/%s/%s.mo\x00\x00n!=1;\x00Plural-Forms:\x00nplurals=\x00plural=\x00dcngettext\x00Ê̄Ê̌ê̄ê̌\x00utf8\x00ASCII\x00C\x00LC_ALL\x00C.UTF-8\x00POSIX\x00MUSL_LOCPATH\x00.\x00%*.*f\x00/\x00MSGVERB\x00label\x00severity\x00text\x00action\x00tag\x00HALT: \x00ERROR: \x00WARNING: \x00INFO: \x00/dev/console\x00: \x00\nTO FIX: \x00 \x00%s%s%s%s%s%s%s%s\n\x00PWD\x00: unrecognized option: \x00: option requires an argument: \x00: option does not take an argument: \x00: option is ambiguous: \x00%*[^\n]%*[\n]\x00 %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d\x00%s\t%s\t%s\t%s\t%d\t%d\n\x00/dev/ptmx\x00/dev/pts/%d\x00%b %e %T\x00<%d>%s %n%s%s%.0d%s: \x00[\x00]\x00%.*s\x00/dev/shm/\x00%.2X\x00:%.2X\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x00/etc/hosts\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00/etc/services\x00/udp\x00/tcp\x00tcp\x00udp\x00%s%s%s\n\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00/etc/resolv.conf\x00options\x00ndots:\x00attempts:\x00timeout:\x00nameserver\x00domain\x00search\x00127.0.0.1\x00/etc/group\x00rbe\x00/etc/passwd\x00/dev/null\x00re\x00r\x00%s:%s:%u:\x00,\x00%s%s\x00%s:%s:%u:%u:%s:%s:%s\n\x00%s:%s:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*lu\n\x00PATH\x00/usr/local/bin:/bin:/usr/bin\x00HOME\x00\t\x00\n\x00\r\x00\f\x00\a\x00\x1b\x00[[:alnum:]_]\x00[^[:alnum:]_]\x00[[:space:]]\x00[^[:space:]]\x00[[:digit:]]\x00[^[:digit:]]\x00__libc_sigaction\x00rwa\x00locking_getc\x00locking_putc\x00__do_orphaned_stdio_locks\x00ftrylockfile\x00/tmp\x00temp\x00w+\x00-0X+0X 0X-0x+0x 0x\x00inf\x00INF\x00NAN\x00-+ 0X0x\x00(null)\x00%*s\x00%%%s%s%s%s%s*.*%c%c\x00#\x00+\x00-\x000\x00\x00\x00\x00\x00%.*s%.0d%s%c%%lln\x00%*\x00%.*e\x00%.*f\x00000000000000000\x00%.*g\x00@\x00\x00\x00\x00\x00\x00\x00XXXXXX\x00TZ\x00/etc/localtime\x00UTC\x00GMT\x00TZif\x00%.3s %.3s%3d %.2d:%.2d:%.2d %d\n\x00DATEMSK\x00%m/%d/%y\x00%Y-%m-%d\x00%H:%M\x00%H:%M:%S\x00+%lld\x00%+.4ld\x00%lld\x00%*lld\x00%0*lld\x00timer_delete\x00/dev/tty\x00LOGNAME\x00" +var __ccgo_ts1 = "\x00/bin:/usr/bin\x00%s\x008b \xd0\xc1\xd2\xcf\xcc\xd8\x00$2a$00$abcdefghijklmnopqrstuu\x00\xff\xa334\xff\xff\xff\xa3345\x00*\x00\x80\xff\x80\x01 \x7f\x81\x80\x80\r\n\xff\x7f \x81 test\x00_0.../9Zz\x00_0.../9ZzX7iSJNd21sU\x00\x80x\x00\x80x22/wK52ZKGA\x00x\x00$1$\x00$5$\x00rounds=\x00rounds=%u$\x00$5$%s%.*s$\x00$6$\x00$6$%s%.*s$\x00toupper\x00tolower\x00Assertion failed: %s (%s: %s: %d)\n\x00infinity\x00nan\x00\x00\x01\x02\x04\a\x03\x06\x05\x00/proc/self/fd/\x00%s: \x00: \x00/dev/tty\x00\n\x00/etc/shells\x00rbe\x00rb\x00UTF-8\x00NLSPATH\x00LANG\x00_.@\x00.@\x00%\x00assembler statements not supported\x00atomic_arch.h\x00bindtextdomain\x00messages\x00%s/%.*s%.*s/%s/%s.mo\x00\x00n!=1;\x00Plural-Forms:\x00nplurals=\x00plural=\x00dcngettext\x00Ê̄Ê̌ê̄ê̌\x00utf8\x00ASCII\x00C\x00LC_ALL\x00C.UTF-8\x00POSIX\x00MUSL_LOCPATH\x00.\x00%*.*f\x00/\x00MSGVERB\x00label\x00severity\x00text\x00action\x00tag\x00HALT: \x00ERROR: \x00WARNING: \x00INFO: \x00/dev/console\x00\nTO FIX: \x00 \x00%s%s%s%s%s%s%s%s\n\x00PWD\x00: unrecognized option: \x00: option requires an argument: \x00: option does not take an argument: \x00: option is ambiguous: \x00%*[^\n]%*[\n]\x00 %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d\x00%s\t%s\t%s\t%s\t%d\t%d\n\x00/dev/ptmx\x00/dev/pts/%d\x00%b %e %T\x00<%d>%s %n%s%s%.0d%s: \x00[\x00]\x00%.*s\x00/dev/shm/\x00%.2X\x00:%.2X\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x00/etc/hosts\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00/etc/services\x00/udp\x00/tcp\x00tcp\x00udp\x00%s%s%s\n\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00/etc/resolv.conf\x00options\x00ndots:\x00attempts:\x00timeout:\x00nameserver\x00domain\x00search\x00127.0.0.1\x00/etc/group\x00/etc/passwd\x00/dev/null\x00re\x00r\x00%s:%s:%u:\x00,\x00%s%s\x00%s:%s:%u:%u:%s:%s:%s\n\x00%s:%s:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*lu\n\x00PATH\x00/usr/local/bin:/bin:/usr/bin\x00HOME\x00\t\x00\r\x00\f\x00\a\x00\x1b\x00[[:alnum:]_]\x00[^[:alnum:]_]\x00[[:space:]]\x00[^[:space:]]\x00[[:digit:]]\x00[^[:digit:]]\x00__libc_sigaction\x00rwa\x00locking_getc\x00locking_putc\x00__do_orphaned_stdio_locks\x00ftrylockfile\x00/tmp\x00temp\x00w+\x00-0X+0X 0X-0x+0x 0x\x00inf\x00INF\x00NAN\x00-+ 0X0x\x00(null)\x00%*s\x00%%%s%s%s%s%s*.*%c%c\x00#\x00+\x00-\x000\x00\x00\x00\x00\x00%.*s%.0d%s%c%%lln\x00%*\x00%.*e\x00%.*f\x00000000000000000\x00%.*g\x00@\x00\x00\x00\x00\x00\x00\x00XXXXXX\x00TZ\x00/etc/localtime\x00UTC\x00GMT\x00TZif\x00%.3s %.3s%3d %.2d:%.2d:%.2d %d\n\x00DATEMSK\x00%m/%d/%y\x00%Y-%m-%d\x00%H:%M\x00%H:%M:%S\x00+%lld\x00%+.4ld\x00%lld\x00%*lld\x00%0*lld\x00timer_delete\x00LOGNAME\x00" diff --git a/vendor/modernc.org/libc/etc.go b/vendor/modernc.org/libc/etc.go index 1350a777..adbe7590 100644 --- a/vendor/modernc.org/libc/etc.go +++ b/vendor/modernc.org/libc/etc.go @@ -172,6 +172,10 @@ func removeObject(t uintptr) { } func (t *TLS) setErrno(err interface{}) { + if t == nil { + panic("nil TLS") + } + if memgrind { if atomic.SwapInt32(&t.reentryGuard, 1) != 0 { panic(todo("concurrent use of TLS instance %p", t)) @@ -568,6 +572,19 @@ func VaUintptr(app *uintptr) uintptr { return v } +func getVaList(va uintptr) []string { + r := []string{} + + for p := va; ; p += 8 { + st := *(*uintptr)(unsafe.Pointer(p)) + if st == 0 { + return r + } + r = append(r, GoString(st)) + } + return r +} + func roundup(n, to uintptr) uintptr { if r := n % to; r != 0 { return n + to - r diff --git a/vendor/modernc.org/libc/libc_musl.go b/vendor/modernc.org/libc/libc_musl.go index 72b02c34..57cec4e1 100644 --- a/vendor/modernc.org/libc/libc_musl.go +++ b/vendor/modernc.org/libc/libc_musl.go @@ -6,6 +6,36 @@ //go:generate go run generator.go +// Package libc is the runtime for programs generated by ccgo/v4 or later. +// +// # Version compatibility +// +// The API of this package, in particular the bits that directly support the +// ccgo compiler, may change in a way that is not backward compatible. If you +// have generated some Go code from C you should stick to the version of this +// package that you used at that time and was tested with your payload. The +// correct way to upgrade to a newer version of this package is to first +// recompile (C to Go) your code with a newwer version if ccgo that depends on +// the new libc version. +// +// If you use C to Go translated code provided by others, stick to the version +// of libc that translated code shows in its go.mod file and do not upgrade the +// dependency just because a newer libc is tagged.Vgq +// +// This is if course unfortunate. However, it's somewhat similar to C code +// linked with a specific version of, say GNU libc. When such code asking for +// glibc5 is run on a system with glibc6, or vice versa, it will fail. +// +// As a particular example, if your project imports modernc.org/sqlite you +// should use the same libc version as seen in the go.mod file of the sqlite +// package. +// +// tl;dr: It is not always possible to fix ccgo bugs and/or improve performance +// of the ccgo transpiled code without occasionally making incompatible changes +// to this package. +// +// # Thread Local Storage +// // A TLS instance represents a main thread or a thread created by // Xpthread_create. A TLS instance is not safe for concurrent use by multiple // goroutines. @@ -243,7 +273,7 @@ type tlsStackSlot struct { // TLS emulates thread local storage. TLS is not safe for concurrent use by // multiple goroutines. type TLS struct { - allocaStack [][]uintptr + allocaStack []int allocas []uintptr jumpBuffers []uintptr pthread uintptr // *t__pthread @@ -380,17 +410,22 @@ func (tls *TLS) alloca(n Tsize_t) (r uintptr) { return r } -func (tls *TLS) FreeAlloca() func() { - tls.allocaStack = append(tls.allocaStack, tls.allocas) - tls.allocas = nil - return func() { - for _, v := range tls.allocas { - Xfree(tls, v) - } - n := len(tls.allocaStack) - tls.allocas = tls.allocaStack[n-1] - tls.allocaStack = tls.allocaStack[:n-1] +// AllocaEntry must be called early on function entry when the function calls +// or may call alloca(3). +func (tls *TLS) AllocaEntry() { + tls.allocaStack = append(tls.allocaStack, len(tls.allocas)) +} + +// AllocaExit must be defer-called on function exit when the function calls or +// may call alloca(3). +func (tls *TLS) AllocaExit() { + n := len(tls.allocaStack) + x := tls.allocaStack[n-1] + tls.allocaStack = tls.allocaStack[:n-1] + for _, v := range tls.allocas[x:] { + Xfree(tls, v) } + tls.allocas = tls.allocas[:x] } func (tls *TLS) Close() { @@ -399,7 +434,7 @@ func (tls *TLS) Close() { for _, v := range tls.allocas { Xfree(tls, v) } - for _, v := range tls.stack[:tls.sp] { + for _, v := range tls.stack /* shrink diabled[:tls.sp] */ { Xfree(tls, v.p) } if tls.ownsPthread { @@ -441,6 +476,10 @@ func Xexit(tls *TLS, code int32) { os.Exit(int(code)) } +func _exit(tls *TLS, code int32) { + Xexit(tls, code) +} + var abort Tsigaction func Xabort(tls *TLS) { @@ -992,8 +1031,3 @@ func Xuuid_unparse(t *TLS, uu, out uintptr) { } var Xzero_struct_address Taddress - -// int getpagesize(void); -func Xgetpagesize(t *TLS) int32 { - return int32(unix.Getpagesize()) -} diff --git a/vendor/modernc.org/libc/libc_openbsd.go b/vendor/modernc.org/libc/libc_openbsd.go index e93c65bd..3b3eb6ce 100644 --- a/vendor/modernc.org/libc/libc_openbsd.go +++ b/vendor/modernc.org/libc/libc_openbsd.go @@ -5,6 +5,7 @@ package libc // import "modernc.org/libc" import ( + "encoding/hex" "fmt" "io" "os" @@ -34,10 +35,12 @@ import ( "modernc.org/libc/termios" "modernc.org/libc/time" "modernc.org/libc/unistd" + "modernc.org/libc/utime" "modernc.org/libc/uuid" ) var ( + startTime = gotime.Now() // For clock(3) in6_addr_any in.In6_addr ) @@ -46,10 +49,22 @@ var X__stderrp = Xstdout var X__stdinp = Xstdin var X__stdoutp = Xstdout var X__sF [3]stdio.FILE -var X_tolower_tab_ = Xmalloc(nil, 2*65537) -var X_toupper_tab_ = Xmalloc(nil, 2*65537) +var X_tolower_tab_ uintptr +var X_toupper_tab_ uintptr func init() { + // fake a TLS since this comes before NewTLS() or Start() + t := &TLS{errnop: uintptr(unsafe.Pointer(&errno0))} + X_tolower_tab_ = Xmalloc(t, 2*65537) + if X_tolower_tab_ == 0 { + panic("unable to allocate tolower table") + } + + X_toupper_tab_ = Xmalloc(t, 2*65537) + if X_tolower_tab_ == 0 { + panic("unable to allocate toupper table") + } + for c := rune(0); c < 0xffff; c++ { y := c s := strings.ToLower(string(c)) @@ -174,11 +189,12 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 { if __ccgo_strace { trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 { + ru := unix.Rusage{} + if err := unix.Getrusage(int(who), &ru); err != nil { t.setErrno(err) return -1 } - + *(*unix.Rusage)(unsafe.Pointer(usage)) = ru return 0 } @@ -217,14 +233,14 @@ func Xchdir(t *TLS, path uintptr) int32 { if __ccgo_strace { trc("t=%v path=%v, (%v:)", t, path, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 { + if err := unix.Chdir(GoString(path)); err != nil { t.setErrno(err) return -1 } - // if dmesgs { - // dmesg("%v: %q: ok", origin(1), GoString(path)) - // } + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(path)) + } return 0 } @@ -267,7 +283,7 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr { // int open(const char *pathname, int flags, ...); func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { if __ccgo_strace { - trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2)) + trc("t=%v pathname=%s flags=%v args=%v, (%v:)", t, GoString(pathname), flags, args, origin(2)) } return Xopen64(t, pathname, flags, args) } @@ -275,26 +291,31 @@ func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { // int open(const char *pathname, int flags, ...); func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { if __ccgo_strace { - trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2)) + trc("t=%v pathname=%s flags=%v args=%v, (%v:)", t, GoString(pathname), flags, args, origin(2)) } var mode types.Mode_t if args != 0 { mode = (types.Mode_t)(VaUint32(&args)) } - fdcwd := fcntl.AT_FDCWD - n, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(fdcwd), pathname, uintptr(flags), uintptr(mode), 0, 0) - if err != 0 { - // if dmesgs { - // dmesg("%v: %q %#x: %v", origin(1), GoString(pathname), flags, err) - // } + fd, err := unix.Open(GoString(pathname), int(flags), mode) + if err != nil { + if __ccgo_strace { + trc("%s: %s", err.Error(), GoString(pathname)) + } + if dmesgs { + dmesg("%v: %q %#x: %v", origin(1), GoString(pathname), flags, err) + } t.setErrno(err) return -1 } - // if dmesgs { - // dmesg("%v: %q flags %#x mode %#o: fd %v", origin(1), GoString(pathname), flags, mode, n) - // } - return int32(n) + if dmesgs { + dmesg("%v: %q flags %#x mode %#o: fd %v", origin(1), GoString(pathname), flags, mode, fd) + } + if __ccgo_strace { + trc("%s fd=%d", GoString(pathname), fd) + } + return int32(fd) } // off_t lseek(int fd, off_t offset, int whence); @@ -305,10 +326,6 @@ func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { return types.Off_t(Xlseek64(t, fd, offset, whence)) } -func whenceStr(whence int32) string { - panic(todo("")) -} - var fsyncStatbuf stat.Stat // int fsync(int fd); @@ -321,7 +338,7 @@ func Xfsync(t *TLS, fd int32) int32 { return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf))) } - if _, _, err := unix.Syscall(unix.SYS_FSYNC, uintptr(fd), 0, 0); err != 0 { + if err := unix.Fsync(int(fd)); err != nil { t.setErrno(err) return -1 } @@ -356,7 +373,7 @@ func Xclose(t *TLS, fd int32) int32 { if __ccgo_strace { trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 { + if err := unix.Close(int(fd)); err != nil { t.setErrno(err) return -1 } @@ -426,15 +443,26 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { if __ccgo_strace { trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) } - n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count)) - if err != 0 { + var n int + var err error + switch { + case count == 0: + n, err = unix.Read(int(fd), nil) + default: + n, err = unix.Read(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count]) + if dmesgs && err == nil { + dmesg("%v: fd %v, count %#x, n %#x\n%s", origin(1), fd, count, n, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:n:n])) + } + } + if err != nil { + if dmesgs { + dmesg("%v: fd %v, %v FAIL", origin(1), fd, err) + } t.setErrno(err) return -1 } - if dmesgs { - // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) - dmesg("%v: fd %d, buf %#0x, count %#x: n %#x", origin(1), fd, count, n) + dmesg("%v: ok", origin(1)) } return types.Ssize_t(n) } @@ -444,27 +472,29 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { if __ccgo_strace { trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) } - const retry = 5 - var err syscall.Errno - for i := 0; i < retry; i++ { - var n uintptr - switch n, _, err = unix.Syscall(unix.SYS_WRITE, uintptr(fd), buf, uintptr(count)); err { - case 0: - if dmesgs { - // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) - dmesg("%v: %d %#x: %#x", origin(1), fd, count, n) - } - return types.Ssize_t(n) - case errno.EAGAIN: - // nop + var n int + var err error + switch { + case count == 0: + n, err = unix.Write(int(fd), nil) + default: + n, err = unix.Write(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count]) + if dmesgs { + dmesg("%v: fd %v, count %#x\n%s", origin(1), fd, count, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:count:count])) + } + } + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) } + t.setErrno(err) + return -1 } if dmesgs { - dmesg("%v: fd %v, buf %#0x, count %#x: %v", origin(1), fd, count, err) + dmesg("%v: ok", origin(1)) } - t.setErrno(err) - return -1 + return types.Ssize_t(n) } // int fchmod(int fd, mode_t mode); @@ -472,7 +502,7 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 { if __ccgo_strace { trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 { + if err := unix.Fchmod(int(fd), uint32(mode)); err != nil { t.setErrno(err) return -1 } @@ -488,7 +518,7 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 { if __ccgo_strace { trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 { + if err := unix.Fchown(int(fd), int(owner), int(group)); err != nil { t.setErrno(err) return -1 } @@ -501,7 +531,7 @@ func Xgeteuid(t *TLS) types.Uid_t { if __ccgo_strace { trc("t=%v, (%v:)", t, origin(2)) } - n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0) + n := unix.Geteuid() return types.Uid_t(n) } @@ -510,7 +540,8 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 { if __ccgo_strace { trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 { + b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), length) + if err := unix.Munmap(b); err != nil { t.setErrno(err) return -1 } @@ -544,6 +575,7 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2)) } if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 { + panic(todo("", "will fail on OpenBSD 7.5")) t.setErrno(err) return -1 } @@ -558,6 +590,7 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so } if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 { t.setErrno(err) + panic(todo("", "will fail on OpenBSD 7.5")) return -1 } @@ -569,6 +602,7 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { if __ccgo_strace { trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2)) } + var argp uintptr if va != 0 { argp = VaUintptr(&va) @@ -576,6 +610,7 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { n, _, err := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(request), argp) if err != 0 { t.setErrno(err) + panic(todo("", "will fail on OpenBSD 7.5")) return -1 } @@ -587,14 +622,15 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 { if __ccgo_strace { trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 { - // if dmesgs { - // dmesg("%v: fd %v: %v", origin(1), sockfd, err) - // } + sn, err := unix.Getsockname(int(sockfd)) + if err != nil { + if dmesgs { + dmesg("%v: fd %v: %v", origin(1), sockfd, err) + } t.setErrno(err) return -1 } - + *(*unix.Sockaddr)(unsafe.Pointer(addr)) = sn return 0 } @@ -636,8 +672,7 @@ func Xumask(t *TLS, mask types.Mode_t) types.Mode_t { if __ccgo_strace { trc("t=%v mask=%v, (%v:)", t, mask, origin(2)) } - n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0) - return types.Mode_t(n) + return types.Mode_t(unix.Umask(int(mask))) } // int execvp(const char *file, char *const argv[]); @@ -645,7 +680,7 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 { if __ccgo_strace { trc("t=%v argv=%v, (%v:)", t, argv, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 { + if err := unix.Exec(GoString(file), getVaList(argv), GetEnviron()); err != nil { t.setErrno(err) return -1 } @@ -658,12 +693,18 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid if __ccgo_strace { trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2)) } - n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0) - if err != 0 { + n, err := unix.Wait4(int(pid), (*unix.WaitStatus)(unsafe.Pointer(wstatus)), int(optname), nil) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } t.setErrno(err) return -1 } + if dmesgs { + dmesg("%v: ok", origin(1)) + } return types.Pid_t(n) } @@ -691,12 +732,13 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ if __ccgo_strace { trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2)) } - n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) - if err != 0 { + p := make([]byte, len) + n, _, err := unix.Recvfrom(int(sockfd), p, int(flags)) + if err != nil { t.setErrno(err) return -1 } - + copy((*RawMem)(unsafe.Pointer(buf))[:n:n], p[:]) return types.Ssize_t(n) } @@ -705,13 +747,14 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ if __ccgo_strace { trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2)) } - n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) - if err != 0 { + + p := unsafe.Slice((*byte)(unsafe.Pointer(buf)), len) + if err := unix.Send(int(sockfd), p, int(flags)); err != nil { t.setErrno(err) return -1 } - return types.Ssize_t(n) + return types.Ssize_t(len) } // int shutdown(int sockfd, int how); @@ -719,7 +762,7 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 { if __ccgo_strace { trc("t=%v how=%v, (%v:)", t, how, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 { + if err := unix.Shutdown(int(sockfd), int(how)); err != nil { t.setErrno(err) return -1 } @@ -732,10 +775,18 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { if __ccgo_strace { trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + sa, err := unix.Getpeername(int(sockfd)) + if err != nil { t.setErrno(err) return -1 } + if __ccgo_strace { + trc("sa=%v", sa) + } + + panic(todo("")) + // populate addr & addrlen from sa + // , addr, uintptr(addrlen)) return 0 } @@ -745,13 +796,13 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 { if __ccgo_strace { trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2)) } - n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol)) - if err != 0 { + fd, err := unix.Socket(int(domain), int(type1), int(protocol)) + if err != nil { t.setErrno(err) return -1 } - return int32(n) + return int32(fd) } // int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); @@ -759,13 +810,12 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { if __ccgo_strace { trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) } - n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen)) - if err != 0 { + if err := unix.Bind(int(sockfd), *(*unix.Sockaddr)(unsafe.Pointer(addr))); err != nil { t.setErrno(err) return -1 } - return int32(n) + return 0 } // int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); @@ -773,7 +823,7 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { if __ccgo_strace { trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + if err := unix.Connect(int(sockfd), *(*unix.Sockaddr)(unsafe.Pointer(addr))); err != nil { t.setErrno(err) return -1 } @@ -786,7 +836,7 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 { if __ccgo_strace { trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 { + if err := unix.Listen(int(sockfd), int(backlog)); err != nil { t.setErrno(err) return -1 } @@ -799,14 +849,19 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { if __ccgo_strace { trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) } - panic(todo("")) - // n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0) - // if err != 0 { - // t.setErrno(err) - // return -1 - // } - // return int32(n) + nfd, sa, err := unix.Accept(int(sockfd)) + if err != nil { + t.setErrno(err) + return -1 + } + if __ccgo_strace { + trc("sa=%v", sa) + } + + panic(todo("")) + // populate addr, addrlen from sa + return int32(nfd) } // int getrlimit(int resource, struct rlimit *rlim); @@ -830,7 +885,7 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { if __ccgo_strace { trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { + if err := unix.Setrlimit(int(resource), (*unix.Rlimit)(unsafe.Pointer(rlim))); err != nil { t.setErrno(err) return -1 } @@ -1337,18 +1392,19 @@ func Xfflush(t *TLS, stream uintptr) int32 { // size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { if __ccgo_strace { - trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2)) + trc("t=%v ptr=%+v nmemb=%d stream=%v, (%v:)", t, unsafe.Slice((*byte)(unsafe.Pointer(ptr)), nmemb), nmemb, *(*int32)(unsafe.Pointer(stream)), origin(2)) } - m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) - if err != 0 { + buf := unsafe.Slice((*byte)(unsafe.Pointer(ptr)), nmemb*size) + m, err := unix.Read(int(file(stream).fd()), buf) + if err != nil { file(stream).setErr() return 0 } - // if dmesgs { - // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) - // dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) - // } + if dmesgs { + // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) + dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) + } return types.Size_t(m) / size } @@ -1357,8 +1413,9 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type if __ccgo_strace { trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2)) } - m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) - if err != 0 { + buf := unsafe.Slice((*byte)(unsafe.Pointer(ptr)), nmemb*size) + m, err := unix.Write(int(file(stream).fd()), buf) + if err != nil { file(stream).setErr() return 0 } @@ -1455,7 +1512,8 @@ func Xfputs(t *TLS, s, stream uintptr) int32 { if __ccgo_strace { trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) } - if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 { + buf := unsafe.Slice((*byte)(unsafe.Pointer(s)), uintptr(Xstrlen(t, s))) + if _, err := unix.Write(int(file(stream).fd()), buf); err != nil { return -1 } @@ -1814,20 +1872,38 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off if __ccgo_strace { trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2)) } + + if addr == 0 { + data, err := unix.Mmap(int(fd), int64(offset), int(length), int(prot), int(flags)) + if err != nil { + t.setErrno(err) + return ^uintptr(0) + } + if __ccgo_strace { + trc("Xmmap returning %v", uintptr(unsafe.Pointer(&data))) + } + return uintptr(unsafe.Pointer(&data[0])) + } + // On 2021-12-23, a new syscall for mmap was introduced: // // 49 STD NOLOCK { void *sys_mmap(void *addr, size_t len, int prot, \ // int flags, int fd, off_t pos); } // src: https://github.com/golang/go/issues/59661 + if __ccgo_strace { + trc("Xmmap with addr %d (%v:)", addr, origin(2)) + } + + panic(todo("")) const unix_SYS_MMAP = 49 // Cannot avoid the syscall here, addr sometimes matter. - data, _, err := unix.Syscall6(unix_SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) + data, _, err := unix.RawSyscall6(unix_SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) if err != 0 { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } + //if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + //} t.setErrno(err) return ^uintptr(0) // (void*)-1 } @@ -2055,3 +2131,729 @@ func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off // } return types.Ssize_t(n) } + +// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); +func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { + if __ccgo_strace { + trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2)) + } + panic(todo("SYS_SIGACTION not supported")) +} + +// FILE *fopen64(const char *pathname, const char *mode); +func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { + if __ccgo_strace { + trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) + } + m := strings.ReplaceAll(GoString(mode), "b", "") + var flags int + switch m { + case "r": + flags = fcntl.O_RDONLY + case "r+": + flags = fcntl.O_RDWR + case "w": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC + case "w+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC + case "a": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND + case "a+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND + default: + panic(m) + } + fd, err := unix.Open(GoString(pathname), int(flags), 0666) + if err != nil { + if dmesgs { + dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) + } + t.setErrno(err) + return 0 + } + + if dmesgs { + dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) + } + if p := newFile(t, int32(fd)); p != 0 { + return p + } + + panic("OOM") +} + +// int lstat(const char *pathname, struct stat *statbuf); +func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%s statbuf=%v, (%v:)", t, GoString(pathname), statbuf, origin(2)) + } + if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int stat(const char *pathname, struct stat *statbuf); +func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%s statbuf=%v, (%v:)", t, GoString(pathname), statbuf, origin(2)) + } + if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int mkdir(const char *path, mode_t mode); +func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { + if __ccgo_strace { + trc("t=%v path=%v mode=%v, (%v:)", t, GoString(path), mode, origin(2)) + } + if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(path)) + } + return 0 +} + +// int access(const char *pathname, int mode); +func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, GoString(pathname), mode, origin(2)) + } + if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// int unlink(const char *pathname); +func Xunlink(t *TLS, pathname uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v, (%v:)", t, GoString(pathname), origin(2)) + } + if err := unix.Unlink(GoString(pathname)); err != nil { + if dmesgs { + dmesg("%v: %q: %v", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); +func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { + if __ccgo_strace { + trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2)) + } + var n int + var err error + switch { + case buf == 0 || bufsize == 0: + n, err = unix.Readlink(GoString(path), nil) + default: + n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) + } + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok") + } + return types.Ssize_t(n) +} + +// int symlink(const char *target, const char *linkpath); +func Xsymlink(t *TLS, target, linkpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v linkpath=%v, (%v:)", t, GoString(linkpath), origin(2)) + } + if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chmod(const char *pathname, mode_t mode) +func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, GoString(pathname), mode, origin(2)) + } + if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// time_t time(time_t *tloc); +func Xtime(t *TLS, tloc uintptr) time.Time_t { + if __ccgo_strace { + trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2)) + } + panic(todo("")) + // n := time.Now().UTC().Unix() + // if tloc != 0 { + // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) + // } + // return types.Time_t(n) +} + +// int utimes(const char *filename, const struct timeval times[2]); +func Xutimes(t *TLS, filename, times uintptr) int32 { + if __ccgo_strace { + trc("t=%v filename=%v, times=%v, (%v:)", t, GoString(filename), times, origin(2)) + } + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) + a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, *(*unix.Stat_t)(unsafe.Pointer(statbuf)), origin(2)) + } + if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: fd %d: ok", origin(1), fd) + } + return 0 +} + +// off64_t lseek64(int fd, off64_t offset, int whence); +func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + if __ccgo_strace { + trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) + } + n, err := unix.Seek(int(fd), int64(offset), int(whence)) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: fd %d, offset %#0x, whence %d, ok", origin(1), fd, offset, whence) + } + return types.Off_t(n) +} + +// int fcntl(int fd, int cmd, ... /* arg */ ); +func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) (r int32) { + if __ccgo_strace { + trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) + defer func() { trc("-> %v", r) }() + } + var err error + var p uintptr + var i int + switch cmd { + case fcntl.F_GETLK, fcntl.F_SETLK: + p = *(*uintptr)(unsafe.Pointer(args)) + err = unix.FcntlFlock(uintptr(fd), int(cmd), (*unix.Flock_t)(unsafe.Pointer(p))) + case fcntl.F_GETFL: + i, err = unix.FcntlInt(uintptr(fd), int(cmd), 0) + r = int32(i) + case fcntl.F_SETFD, fcntl.F_SETFL: + arg := *(*int32)(unsafe.Pointer(args)) + _, err = unix.FcntlInt(uintptr(fd), int(cmd), int(arg)) + default: + panic(todo("%v: %v %v", origin(1), fd, cmd)) + } + if err != nil { + if dmesgs { + dmesg("%v: fd %v cmd %v p %#x: %v FAIL", origin(1), fcntlCmdStr(fd), cmd, p, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %d %s %#x: ok", origin(1), fd, fcntlCmdStr(cmd), p) + } + return r +} + +// int rename(const char *oldpath, const char *newpath); +func Xrename(t *TLS, oldpath, newpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) + } + if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int mknod(const char *pathname, mode_t mode, dev_t dev); +func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2)) + } + if err := unix.Mknod(GoString(pathname), uint32(mode), int(dev)); err != nil { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int utime(const char *filename, const struct utimbuf *times); +func Xutime(t *TLS, filename, times uintptr) int32 { + if __ccgo_strace { + trc("t=%v times=%v, (%v:)", t, times, origin(2)) + } + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Factime + a[1].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chown(const char *pathname, uid_t owner, gid_t group); +func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2)) + } + if err := unix.Chown(GoString(pathname), int(owner), int(group)); err != nil { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int link(const char *oldpath, const char *newpath); +func Xlink(t *TLS, oldpath, newpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) + } + if err := unix.Link(GoString(oldpath), GoString(newpath)); err != nil { + t.setErrno(err) + return -1 + } + return 0 +} + +// int dup2(int oldfd, int newfd); +func Xdup2(t *TLS, oldfd, newfd int32) int32 { + if __ccgo_strace { + trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2)) + } + if err := unix.Dup2(int(oldfd), int(newfd)); err != nil { + t.setErrno(err) + return -1 + } + + return 0 +} + +// unsigned int alarm(unsigned int seconds); +func Xalarm(t *TLS, seconds uint32) uint32 { + if __ccgo_strace { + trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2)) + } + panic("SYS_ALARM not supported") + + /* n, err := unix.Alarm(uint(seconds)) + if err != nil { + t.setErrno(err) + return 0 + } + + return uint32(n) + */ +} + +// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags); +func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */ + if __ccgo_strace { + trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2)) + } + panic(todo("")) + //TODO bp := tls.Alloc(347) + //TODO defer tls.Free(347) + + //TODO // var ptr [78]int8 at bp, 78 + + //TODO // var buf [256]int8 at bp+78, 256 + + //TODO // var num [13]int8 at bp+334, 13 + + //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) + //TODO var a uintptr + //TODO var scopeid uint32 + + //TODO switch af { + //TODO case 2: + //TODO a = (sa1 + 4 /* &.sin_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { + //TODO return -6 + //TODO } + //TODO mkptr4(tls, bp /* &ptr[0] */, a) + //TODO scopeid = uint32(0) + //TODO break + //TODO case 10: + //TODO a = (sa1 + 8 /* &.sin6_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { + //TODO return -6 + //TODO } + //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { + //TODO mkptr6(tls, bp /* &ptr[0] */, a) + //TODO } else { + //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) + //TODO } + //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id + //TODO break + //TODO default: + //TODO return -6 + //TODO } + + //TODO if (node != 0) && (nodelen != 0) { + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x01) != 0) { + //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { + //TODO Xabort(tls) //TODO- + //TODO // unsigned char query[18+PTR_MAX], reply[512]; + //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, + //TODO // 0, 0, 0, query, sizeof query); + //TODO // query[3] = 0; /* don't need AD flag */ + //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); + //TODO // buf[0] = 0; + //TODO // if (rlen > 0) + //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { + //TODO if (flags & 0x08) != 0 { + //TODO return -2 + //TODO } + //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) + //TODO if scopeid != 0 { + //TODO Xabort(tls) //TODO- + //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; + //TODO // if (!(flags & NI_NUMERICSCOPE) && + //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || + //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) + //TODO // p = if_indextoname(scopeid, tmp+1); + //TODO // if (!p) + //TODO // p = itoa(num, scopeid); + //TODO // *--p = '%'; + //TODO // strcat(buf, p); + //TODO } + //TODO } + //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) + //TODO } + + //TODO if (serv != 0) && (servlen != 0) { + //TODO var p uintptr = bp + 78 /* buf */ + //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x02) != 0) { + //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { + //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) + //TODO } + //TODO if Xstrlen(tls, p) >= size_t(servlen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, serv, p) + //TODO } + + //TODO return 0 +} + +func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ + if __ccgo_strace { + trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2)) + } + panic(todo("")) + //TODO bp := tls.Alloc(28) + //TODO defer tls.Free(28) + + //TODO //TODO union { + //TODO //TODO struct sockaddr_in sin; + //TODO //TODO struct sockaddr_in6 sin6; + //TODO //TODO } sa = { .sin.sin_family = af }; + //TODO *(*struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO }{} //TODO- + //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- + //TODO var sl socklen_t + //TODO if af == 10 { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) + //TODO } else { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) + //TODO } + //TODO var i int32 + + //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) + + //TODO // Load address argument into sockaddr structure + //TODO if (af == 10) && (l == socklen_t(16)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) + //TODO } else if (af == 2) && (l == socklen_t(4)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) + //TODO } else { + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return 22 + //TODO } + + //TODO // Align buffer and check for space for pointers and ip address + //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) + //TODO if !(i != 0) { + //TODO i = int32(unsafe.Sizeof(uintptr(0))) + //TODO } + //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { + //TODO return 34 + //TODO } + //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) + //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) + + //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf + //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) + //TODO buf += uintptr(l) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) + + //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { + //TODO case -3: + //TODO *(*int32)(unsafe.Pointer(err)) = 2 + //TODO return 11 + //TODO case -12: + //TODO return 34 + //TODO default: + //TODO fallthrough + //TODO case -10: + //TODO fallthrough + //TODO case -11: + //TODO fallthrough + //TODO case -4: + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) + //TODO case 0: + //TODO break + //TODO } + + //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af + //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) + //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) + //TODO *(*uintptr)(unsafe.Pointer(res)) = h + //TODO return 0 +} + +// int getrlimit(int resource, struct rlimit *rlim); +func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if __ccgo_strace { + trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) + } + if err := unix.Getrlimit(int(resource), (*unix.Rlimit)(unsafe.Pointer(rlim))); err != nil { + t.setErrno(err) + return -1 + } + + return 0 +} + +func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { + var statp uintptr + if stat != nil { + statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) + if statp == 0 { + panic("OOM") + } + + *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat + } + csp, errx := CString(path) + if errx != nil { + panic("OOM") + } + + return &fts.FTSENT{ + Ffts_info: uint16(info), + Ffts_path: csp, + Ffts_pathlen: types.Size_t(len(path)), + Ffts_statp: statp, + Ffts_errno: int32(err), + } +} + +// DIR *opendir(const char *name); +func Xopendir(t *TLS, name uintptr) uintptr { + if __ccgo_strace { + trc("t=%v name=%v, (%v:)", t, name, origin(2)) + } + p := Xmalloc(t, types.Size_t(unsafe.Sizeof(darwinDir{}))) + if p == 0 { + panic("OOM") + } + + fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) + if fd < 0 { + if dmesgs { + dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) + } + Xfree(t, p) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + (*darwinDir)(unsafe.Pointer(p)).fd = fd + (*darwinDir)(unsafe.Pointer(p)).h = 0 + (*darwinDir)(unsafe.Pointer(p)).l = 0 + (*darwinDir)(unsafe.Pointer(p)).eof = false + return p +} + +func Xrewinddir(tls *TLS, f uintptr) { + if __ccgo_strace { + trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) + } + Xfseek(tls, f, 0, stdio.SEEK_SET) +} + +// clock_t clock(void); +func Xclock(t *TLS) time.Clock_t { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } + return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second) +} + +// ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); +func Xrecvmsg(t *TLS, sockfd int32, msg uintptr, flags int32) types.Ssize_t { + if __ccgo_strace { + trc("t=%v sockfd=%v msg=%v flags=%v, (%v:)", t, sockfd, msg, flags, origin(2)) + } + oob := []byte{} + buf := []byte{} + + n, _, _, _, err := unix.Recvmsg(int(sockfd), buf, oob, int(flags)) + if err != nil { + t.setErrno(err) + return -1 + } + copy((*RawMem)(unsafe.Pointer(msg))[:n:n], buf[:]) + + return types.Ssize_t(n) +} diff --git a/vendor/modernc.org/libc/libc_openbsd_386.go b/vendor/modernc.org/libc/libc_openbsd_386.go index 5b414c18..13cc9df5 100644 --- a/vendor/modernc.org/libc/libc_openbsd_386.go +++ b/vendor/modernc.org/libc/libc_openbsd_386.go @@ -4,706 +4,7 @@ package libc // import "modernc.org/libc" -import ( - "strings" - "syscall" - "unsafe" - - "golang.org/x/sys/unix" - "modernc.org/libc/fcntl" - "modernc.org/libc/fts" - "modernc.org/libc/sys/types" - "modernc.org/libc/time" - "modernc.org/libc/utime" -) - type ( long = int32 ulong = uint32 ) - -// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); -func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { - if __ccgo_strace { - trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -// FILE *fopen64(const char *pathname, const char *mode); -func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { - if __ccgo_strace { - trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) - } - m := strings.ReplaceAll(GoString(mode), "b", "") - var flags int - switch m { - case "r": - flags = fcntl.O_RDONLY - case "r+": - flags = fcntl.O_RDWR - case "w": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC - case "w+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC - case "a": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND - case "a+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND - default: - panic(m) - } - fd, err := unix.Open(GoString(pathname), int(flags), 0666) - if err != nil { - if dmesgs { - dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) - } - t.setErrno(err) - return 0 - } - - if dmesgs { - dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) - } - if p := newFile(t, int32(fd)); p != 0 { - return p - } - - panic("OOM") -} - -// int lstat(const char *pathname, struct stat *statbuf); -func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int stat(const char *pathname, struct stat *statbuf); -func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int mkdir(const char *path, mode_t mode); -func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2)) - } - if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(path)) - } - return 0 -} - -// int access(const char *pathname, int mode); -func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// int unlink(const char *pathname); -func Xunlink(t *TLS, pathname uintptr) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2)) - } - if err := unix.Unlink(GoString(pathname)); err != nil { - if dmesgs { - dmesg("%v: %q: %v", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); -func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { - if __ccgo_strace { - trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2)) - } - var n int - var err error - switch { - case buf == 0 || bufsize == 0: - n, err = unix.Readlink(GoString(path), nil) - default: - n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) - } - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok") - } - return types.Ssize_t(n) -} - -// int symlink(const char *target, const char *linkpath); -func Xsymlink(t *TLS, target, linkpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2)) - } - if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chmod(const char *pathname, mode_t mode) -func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// time_t time(time_t *tloc); -func Xtime(t *TLS, tloc uintptr) time.Time_t { - if __ccgo_strace { - trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2)) - } - panic(todo("")) - // n := time.Now().UTC().Unix() - // if tloc != 0 { - // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) - // } - // return types.Time_t(n) -} - -// int utimes(const char *filename, const struct timeval times[2]); -func Xutimes(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) - a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int fstat(int fd, struct stat *statbuf); -func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2)) - } - if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: fd %d: ok", origin(1), fd) - } - return 0 -} - -// off64_t lseek64(int fd, off64_t offset, int whence); -func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { - if __ccgo_strace { - trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) - } - n, err := unix.Seek(int(fd), int64(offset), int(whence)) - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return types.Off_t(n) -} - -func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { - if __ccgo_strace { - trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) - } - var arg uintptr - if args != 0 { - arg = *(*uintptr)(unsafe.Pointer(args)) - } - n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg) - if err != 0 { - if dmesgs { - dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n) - } - return int32(n) -} - -// int rename(const char *oldpath, const char *newpath); -func Xrename(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int mknod(const char *pathname, mode_t mode, dev_t dev); -func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int utime(const char *filename, const struct utimbuf *times); -func Xutime(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0].Sec = int64((*utime.Utimbuf)(unsafe.Pointer(times)).Factime) - a[1].Sec = int64((*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime) - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chown(const char *pathname, uid_t owner, gid_t group); -func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -// int link(const char *oldpath, const char *newpath); -func Xlink(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int dup2(int oldfd, int newfd); -func Xdup2(t *TLS, oldfd, newfd int32) int32 { - if __ccgo_strace { - trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - // if err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return int32(n) -} - -// unsigned int alarm(unsigned int seconds); -func Xalarm(t *TLS, seconds uint32) uint32 { - if __ccgo_strace { - trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) - // if err != 0 { - // panic(todo("")) - // } - - // return uint32(n) -} - -func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */ - if __ccgo_strace { - trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(347) - //TODO defer tls.Free(347) - - //TODO // var ptr [78]int8 at bp, 78 - - //TODO // var buf [256]int8 at bp+78, 256 - - //TODO // var num [13]int8 at bp+334, 13 - - //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) - //TODO var a uintptr - //TODO var scopeid uint32 - - //TODO switch af { - //TODO case 2: - //TODO a = (sa1 + 4 /* &.sin_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { - //TODO return -6 - //TODO } - //TODO mkptr4(tls, bp /* &ptr[0] */, a) - //TODO scopeid = uint32(0) - //TODO break - //TODO case 10: - //TODO a = (sa1 + 8 /* &.sin6_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { - //TODO return -6 - //TODO } - //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { - //TODO mkptr6(tls, bp /* &ptr[0] */, a) - //TODO } else { - //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) - //TODO } - //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id - //TODO break - //TODO default: - //TODO return -6 - //TODO } - - //TODO if (node != 0) && (nodelen != 0) { - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x01) != 0) { - //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { - //TODO Xabort(tls) //TODO- - //TODO // unsigned char query[18+PTR_MAX], reply[512]; - //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, - //TODO // 0, 0, 0, query, sizeof query); - //TODO // query[3] = 0; /* don't need AD flag */ - //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); - //TODO // buf[0] = 0; - //TODO // if (rlen > 0) - //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { - //TODO if (flags & 0x08) != 0 { - //TODO return -2 - //TODO } - //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) - //TODO if scopeid != 0 { - //TODO Xabort(tls) //TODO- - //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; - //TODO // if (!(flags & NI_NUMERICSCOPE) && - //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || - //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) - //TODO // p = if_indextoname(scopeid, tmp+1); - //TODO // if (!p) - //TODO // p = itoa(num, scopeid); - //TODO // *--p = '%'; - //TODO // strcat(buf, p); - //TODO } - //TODO } - //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) - //TODO } - - //TODO if (serv != 0) && (servlen != 0) { - //TODO var p uintptr = bp + 78 /* buf */ - //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x02) != 0) { - //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { - //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) - //TODO } - //TODO if Xstrlen(tls, p) >= size_t(servlen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, serv, p) - //TODO } - - //TODO return 0 -} - -func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ - if __ccgo_strace { - trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(28) - //TODO defer tls.Free(28) - - //TODO //TODO union { - //TODO //TODO struct sockaddr_in sin; - //TODO //TODO struct sockaddr_in6 sin6; - //TODO //TODO } sa = { .sin.sin_family = af }; - //TODO *(*struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO }{} //TODO- - //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- - //TODO var sl socklen_t - //TODO if af == 10 { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) - //TODO } else { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) - //TODO } - //TODO var i int32 - - //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) - - //TODO // Load address argument into sockaddr structure - //TODO if (af == 10) && (l == socklen_t(16)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) - //TODO } else if (af == 2) && (l == socklen_t(4)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) - //TODO } else { - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return 22 - //TODO } - - //TODO // Align buffer and check for space for pointers and ip address - //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) - //TODO if !(i != 0) { - //TODO i = int32(unsafe.Sizeof(uintptr(0))) - //TODO } - //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { - //TODO return 34 - //TODO } - //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) - //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) - - //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf - //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) - //TODO buf += uintptr(l) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) - - //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { - //TODO case -3: - //TODO *(*int32)(unsafe.Pointer(err)) = 2 - //TODO return 11 - //TODO case -12: - //TODO return 34 - //TODO default: - //TODO fallthrough - //TODO case -10: - //TODO fallthrough - //TODO case -11: - //TODO fallthrough - //TODO case -4: - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) - //TODO case 0: - //TODO break - //TODO } - - //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af - //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) - //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) - //TODO *(*uintptr)(unsafe.Pointer(res)) = h - //TODO return 0 -} - -// int getrlimit(int resource, struct rlimit *rlim); -func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { - if __ccgo_strace { - trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { - var statp uintptr - if stat != nil { - statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) - if statp == 0 { - panic("OOM") - } - - *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat - } - csp, errx := CString(path) - if errx != nil { - panic("OOM") - } - - return &fts.FTSENT{ - Ffts_info: uint16(info), - Ffts_path: csp, - Ffts_pathlen: uint32(len(path)), - Ffts_statp: statp, - Ffts_errno: int32(err), - } -} - -// DIR *opendir(const char *name); -func Xopendir(t *TLS, name uintptr) uintptr { - if __ccgo_strace { - trc("t=%v name=%v, (%v:)", t, name, origin(2)) - } - p := Xmalloc(t, uint32(unsafe.Sizeof(darwinDir{}))) - if p == 0 { - panic("OOM") - } - - fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) - if fd < 0 { - if dmesgs { - dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) - } - Xfree(t, p) - return 0 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - (*darwinDir)(unsafe.Pointer(p)).fd = fd - (*darwinDir)(unsafe.Pointer(p)).h = 0 - (*darwinDir)(unsafe.Pointer(p)).l = 0 - (*darwinDir)(unsafe.Pointer(p)).eof = false - return p -} diff --git a/vendor/modernc.org/libc/libc_openbsd_amd64.go b/vendor/modernc.org/libc/libc_openbsd_amd64.go index d600c5a9..5fdfcb10 100644 --- a/vendor/modernc.org/libc/libc_openbsd_amd64.go +++ b/vendor/modernc.org/libc/libc_openbsd_amd64.go @@ -4,729 +4,7 @@ package libc // import "modernc.org/libc" -import ( - "strings" - "syscall" - gotime "time" - "unsafe" - - "golang.org/x/sys/unix" - "modernc.org/libc/fcntl" - "modernc.org/libc/fts" - "modernc.org/libc/stdio" - "modernc.org/libc/sys/types" - "modernc.org/libc/time" - "modernc.org/libc/utime" -) - type ( long = int64 ulong = uint64 ) - -var ( - startTime = gotime.Now() // For clock(3) -) - -// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); -func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { - if __ccgo_strace { - trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// FILE *fopen64(const char *pathname, const char *mode); -func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { - if __ccgo_strace { - trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) - } - m := strings.ReplaceAll(GoString(mode), "b", "") - var flags int - switch m { - case "r": - flags = fcntl.O_RDONLY - case "r+": - flags = fcntl.O_RDWR - case "w": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC - case "w+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC - case "a": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND - case "a+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND - default: - panic(m) - } - fd, err := unix.Open(GoString(pathname), int(flags), 0666) - if err != nil { - if dmesgs { - dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) - } - t.setErrno(err) - return 0 - } - - if dmesgs { - dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) - } - if p := newFile(t, int32(fd)); p != 0 { - return p - } - - panic("OOM") -} - -// int lstat(const char *pathname, struct stat *statbuf); -func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int stat(const char *pathname, struct stat *statbuf); -func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int mkdir(const char *path, mode_t mode); -func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2)) - } - if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(path)) - } - return 0 -} - -// int access(const char *pathname, int mode); -func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// int unlink(const char *pathname); -func Xunlink(t *TLS, pathname uintptr) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2)) - } - if err := unix.Unlink(GoString(pathname)); err != nil { - if dmesgs { - dmesg("%v: %q: %v", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); -func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { - if __ccgo_strace { - trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2)) - } - var n int - var err error - switch { - case buf == 0 || bufsize == 0: - n, err = unix.Readlink(GoString(path), nil) - default: - n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) - } - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok") - } - return types.Ssize_t(n) -} - -// int symlink(const char *target, const char *linkpath); -func Xsymlink(t *TLS, target, linkpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2)) - } - if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chmod(const char *pathname, mode_t mode) -func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// time_t time(time_t *tloc); -func Xtime(t *TLS, tloc uintptr) time.Time_t { - if __ccgo_strace { - trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2)) - } - panic(todo("")) - // n := time.Now().UTC().Unix() - // if tloc != 0 { - // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) - // } - // return types.Time_t(n) -} - -// int utimes(const char *filename, const struct timeval times[2]); -func Xutimes(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) - a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int fstat(int fd, struct stat *statbuf); -func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2)) - } - if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: fd %d: ok", origin(1), fd) - } - return 0 -} - -// off64_t lseek64(int fd, off64_t offset, int whence); -func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { - if __ccgo_strace { - trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) - } - n, err := unix.Seek(int(fd), int64(offset), int(whence)) - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: fd %d, offset %#0x, whence %d, ok", origin(1), fd, offset, whence) - } - return types.Off_t(n) -} - -func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { - if __ccgo_strace { - trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) - } - var arg uintptr - if args != 0 { - arg = *(*uintptr)(unsafe.Pointer(args)) - } - n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg) - if err != 0 { - if dmesgs { - dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n) - } - return int32(n) -} - -// int rename(const char *oldpath, const char *newpath); -func Xrename(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int mknod(const char *pathname, mode_t mode, dev_t dev); -func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int utime(const char *filename, const struct utimbuf *times); -func Xutime(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Factime - a[1].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chown(const char *pathname, uid_t owner, gid_t group); -func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -// int link(const char *oldpath, const char *newpath); -func Xlink(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int dup2(int oldfd, int newfd); -func Xdup2(t *TLS, oldfd, newfd int32) int32 { - if __ccgo_strace { - trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - // if err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return int32(n) -} - -// unsigned int alarm(unsigned int seconds); -func Xalarm(t *TLS, seconds uint32) uint32 { - if __ccgo_strace { - trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) - // if err != 0 { - // panic(todo("")) - // } - - // return uint32(n) -} - -// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags); -func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */ - if __ccgo_strace { - trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(347) - //TODO defer tls.Free(347) - - //TODO // var ptr [78]int8 at bp, 78 - - //TODO // var buf [256]int8 at bp+78, 256 - - //TODO // var num [13]int8 at bp+334, 13 - - //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) - //TODO var a uintptr - //TODO var scopeid uint32 - - //TODO switch af { - //TODO case 2: - //TODO a = (sa1 + 4 /* &.sin_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { - //TODO return -6 - //TODO } - //TODO mkptr4(tls, bp /* &ptr[0] */, a) - //TODO scopeid = uint32(0) - //TODO break - //TODO case 10: - //TODO a = (sa1 + 8 /* &.sin6_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { - //TODO return -6 - //TODO } - //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { - //TODO mkptr6(tls, bp /* &ptr[0] */, a) - //TODO } else { - //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) - //TODO } - //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id - //TODO break - //TODO default: - //TODO return -6 - //TODO } - - //TODO if (node != 0) && (nodelen != 0) { - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x01) != 0) { - //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { - //TODO Xabort(tls) //TODO- - //TODO // unsigned char query[18+PTR_MAX], reply[512]; - //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, - //TODO // 0, 0, 0, query, sizeof query); - //TODO // query[3] = 0; /* don't need AD flag */ - //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); - //TODO // buf[0] = 0; - //TODO // if (rlen > 0) - //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { - //TODO if (flags & 0x08) != 0 { - //TODO return -2 - //TODO } - //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) - //TODO if scopeid != 0 { - //TODO Xabort(tls) //TODO- - //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; - //TODO // if (!(flags & NI_NUMERICSCOPE) && - //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || - //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) - //TODO // p = if_indextoname(scopeid, tmp+1); - //TODO // if (!p) - //TODO // p = itoa(num, scopeid); - //TODO // *--p = '%'; - //TODO // strcat(buf, p); - //TODO } - //TODO } - //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) - //TODO } - - //TODO if (serv != 0) && (servlen != 0) { - //TODO var p uintptr = bp + 78 /* buf */ - //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x02) != 0) { - //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { - //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) - //TODO } - //TODO if Xstrlen(tls, p) >= size_t(servlen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, serv, p) - //TODO } - - //TODO return 0 -} - -func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ - if __ccgo_strace { - trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(28) - //TODO defer tls.Free(28) - - //TODO //TODO union { - //TODO //TODO struct sockaddr_in sin; - //TODO //TODO struct sockaddr_in6 sin6; - //TODO //TODO } sa = { .sin.sin_family = af }; - //TODO *(*struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO }{} //TODO- - //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- - //TODO var sl socklen_t - //TODO if af == 10 { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) - //TODO } else { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) - //TODO } - //TODO var i int32 - - //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) - - //TODO // Load address argument into sockaddr structure - //TODO if (af == 10) && (l == socklen_t(16)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) - //TODO } else if (af == 2) && (l == socklen_t(4)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) - //TODO } else { - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return 22 - //TODO } - - //TODO // Align buffer and check for space for pointers and ip address - //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) - //TODO if !(i != 0) { - //TODO i = int32(unsafe.Sizeof(uintptr(0))) - //TODO } - //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { - //TODO return 34 - //TODO } - //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) - //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) - - //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf - //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) - //TODO buf += uintptr(l) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) - - //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { - //TODO case -3: - //TODO *(*int32)(unsafe.Pointer(err)) = 2 - //TODO return 11 - //TODO case -12: - //TODO return 34 - //TODO default: - //TODO fallthrough - //TODO case -10: - //TODO fallthrough - //TODO case -11: - //TODO fallthrough - //TODO case -4: - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) - //TODO case 0: - //TODO break - //TODO } - - //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af - //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) - //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) - //TODO *(*uintptr)(unsafe.Pointer(res)) = h - //TODO return 0 -} - -// int getrlimit(int resource, struct rlimit *rlim); -func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { - if __ccgo_strace { - trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { - var statp uintptr - if stat != nil { - statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) - if statp == 0 { - panic("OOM") - } - - *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat - } - csp, errx := CString(path) - if errx != nil { - panic("OOM") - } - - return &fts.FTSENT{ - Ffts_info: uint16(info), - Ffts_path: csp, - Ffts_pathlen: uint64(len(path)), - Ffts_statp: statp, - Ffts_errno: int32(err), - } -} - -// DIR *opendir(const char *name); -func Xopendir(t *TLS, name uintptr) uintptr { - if __ccgo_strace { - trc("t=%v name=%v, (%v:)", t, name, origin(2)) - } - p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{}))) - if p == 0 { - panic("OOM") - } - - fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) - if fd < 0 { - if dmesgs { - dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) - } - Xfree(t, p) - return 0 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - (*darwinDir)(unsafe.Pointer(p)).fd = fd - (*darwinDir)(unsafe.Pointer(p)).h = 0 - (*darwinDir)(unsafe.Pointer(p)).l = 0 - (*darwinDir)(unsafe.Pointer(p)).eof = false - return p -} - -func Xrewinddir(tls *TLS, f uintptr) { - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - Xfseek(tls, f, 0, stdio.SEEK_SET) -} - -// clock_t clock(void); -func Xclock(t *TLS) time.Clock_t { - if __ccgo_strace { - trc("t=%v, (%v:)", t, origin(2)) - } - return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second) -} diff --git a/vendor/modernc.org/libc/libc_openbsd_arm64.go b/vendor/modernc.org/libc/libc_openbsd_arm64.go index 89af8729..5fdfcb10 100644 --- a/vendor/modernc.org/libc/libc_openbsd_arm64.go +++ b/vendor/modernc.org/libc/libc_openbsd_arm64.go @@ -4,721 +4,7 @@ package libc // import "modernc.org/libc" -import ( - "strings" - "syscall" - gotime "time" - "unsafe" - - "golang.org/x/sys/unix" - "modernc.org/libc/fcntl" - "modernc.org/libc/fts" - "modernc.org/libc/sys/types" - "modernc.org/libc/time" - "modernc.org/libc/utime" -) - type ( long = int64 ulong = uint64 ) - -var ( - startTime = gotime.Now() // For clock(3) -) - -// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); -func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { - if __ccgo_strace { - trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// FILE *fopen64(const char *pathname, const char *mode); -func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { - if __ccgo_strace { - trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) - } - m := strings.ReplaceAll(GoString(mode), "b", "") - var flags int - switch m { - case "r": - flags = fcntl.O_RDONLY - case "r+": - flags = fcntl.O_RDWR - case "w": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC - case "w+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC - case "a": - flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND - case "a+": - flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND - default: - panic(m) - } - fd, err := unix.Open(GoString(pathname), int(flags), 0666) - if err != nil { - if dmesgs { - dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) - } - t.setErrno(err) - return 0 - } - - if dmesgs { - dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) - } - if p := newFile(t, int32(fd)); p != 0 { - return p - } - - panic("OOM") -} - -// int lstat(const char *pathname, struct stat *statbuf); -func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int stat(const char *pathname, struct stat *statbuf); -func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) - } - if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(pathname)) - } - return 0 -} - -// int mkdir(const char *path, mode_t mode); -func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2)) - } - if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q: ok", origin(1), GoString(path)) - } - return 0 -} - -// int access(const char *pathname, int mode); -func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// int unlink(const char *pathname); -func Xunlink(t *TLS, pathname uintptr) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2)) - } - if err := unix.Unlink(GoString(pathname)); err != nil { - if dmesgs { - dmesg("%v: %q: %v", origin(1), GoString(pathname), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); -func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { - if __ccgo_strace { - trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2)) - } - var n int - var err error - switch { - case buf == 0 || bufsize == 0: - n, err = unix.Readlink(GoString(path), nil) - default: - n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) - } - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok") - } - return types.Ssize_t(n) -} - -// int symlink(const char *target, const char *linkpath); -func Xsymlink(t *TLS, target, linkpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2)) - } - if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chmod(const char *pathname, mode_t mode) -func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) - } - if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { - if dmesgs { - dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - } - return 0 -} - -// time_t time(time_t *tloc); -func Xtime(t *TLS, tloc uintptr) time.Time_t { - if __ccgo_strace { - trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2)) - } - panic(todo("")) - // n := time.Now().UTC().Unix() - // if tloc != 0 { - // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) - // } - // return types.Time_t(n) -} - -// int utimes(const char *filename, const struct timeval times[2]); -func Xutimes(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) - a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int fstat(int fd, struct stat *statbuf); -func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { - if __ccgo_strace { - trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2)) - } - if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { - if dmesgs { - dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: fd %d: ok", origin(1), fd) - } - return 0 -} - -// off64_t lseek64(int fd, off64_t offset, int whence); -func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { - if __ccgo_strace { - trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) - } - n, err := unix.Seek(int(fd), int64(offset), int(whence)) - if err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return types.Off_t(n) -} - -func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { - if __ccgo_strace { - trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) - } - var arg uintptr - if args != 0 { - arg = *(*uintptr)(unsafe.Pointer(args)) - } - n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg) - if err != 0 { - if dmesgs { - dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n) - } - return int32(n) -} - -// int rename(const char *oldpath, const char *newpath); -func Xrename(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int mknod(const char *pathname, mode_t mode, dev_t dev); -func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int utime(const char *filename, const struct utimbuf *times); -func Xutime(t *TLS, filename, times uintptr) int32 { - if __ccgo_strace { - trc("t=%v times=%v, (%v:)", t, times, origin(2)) - } - var a []unix.Timeval - if times != 0 { - a = make([]unix.Timeval, 2) - a[0].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Factime - a[1].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime - } - if err := unix.Utimes(GoString(filename), a); err != nil { - if dmesgs { - dmesg("%v: %v FAIL", origin(1), err) - } - t.setErrno(err) - return -1 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - return 0 -} - -// int chown(const char *pathname, uid_t owner, gid_t group); -func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { - if __ccgo_strace { - trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -// int link(const char *oldpath, const char *newpath); -func Xlink(t *TLS, oldpath, newpath uintptr) int32 { - if __ccgo_strace { - trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) - } - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return 0 -} - -// int dup2(int oldfd, int newfd); -func Xdup2(t *TLS, oldfd, newfd int32) int32 { - if __ccgo_strace { - trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - // if err != 0 { - // t.setErrno(err) - // return -1 - // } - - // return int32(n) -} - -// unsigned int alarm(unsigned int seconds); -func Xalarm(t *TLS, seconds uint32) uint32 { - if __ccgo_strace { - trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2)) - } - panic(todo("")) - // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) - // if err != 0 { - // panic(todo("")) - // } - - // return uint32(n) -} - -// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags); -func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */ - if __ccgo_strace { - trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(347) - //TODO defer tls.Free(347) - - //TODO // var ptr [78]int8 at bp, 78 - - //TODO // var buf [256]int8 at bp+78, 256 - - //TODO // var num [13]int8 at bp+334, 13 - - //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) - //TODO var a uintptr - //TODO var scopeid uint32 - - //TODO switch af { - //TODO case 2: - //TODO a = (sa1 + 4 /* &.sin_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { - //TODO return -6 - //TODO } - //TODO mkptr4(tls, bp /* &ptr[0] */, a) - //TODO scopeid = uint32(0) - //TODO break - //TODO case 10: - //TODO a = (sa1 + 8 /* &.sin6_addr */) - //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { - //TODO return -6 - //TODO } - //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { - //TODO mkptr6(tls, bp /* &ptr[0] */, a) - //TODO } else { - //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) - //TODO } - //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id - //TODO break - //TODO default: - //TODO return -6 - //TODO } - - //TODO if (node != 0) && (nodelen != 0) { - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x01) != 0) { - //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { - //TODO Xabort(tls) //TODO- - //TODO // unsigned char query[18+PTR_MAX], reply[512]; - //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, - //TODO // 0, 0, 0, query, sizeof query); - //TODO // query[3] = 0; /* don't need AD flag */ - //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); - //TODO // buf[0] = 0; - //TODO // if (rlen > 0) - //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { - //TODO if (flags & 0x08) != 0 { - //TODO return -2 - //TODO } - //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) - //TODO if scopeid != 0 { - //TODO Xabort(tls) //TODO- - //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; - //TODO // if (!(flags & NI_NUMERICSCOPE) && - //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || - //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) - //TODO // p = if_indextoname(scopeid, tmp+1); - //TODO // if (!p) - //TODO // p = itoa(num, scopeid); - //TODO // *--p = '%'; - //TODO // strcat(buf, p); - //TODO } - //TODO } - //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) - //TODO } - - //TODO if (serv != 0) && (servlen != 0) { - //TODO var p uintptr = bp + 78 /* buf */ - //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) - //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) - //TODO if !((flags & 0x02) != 0) { - //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) - //TODO } - //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { - //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) - //TODO } - //TODO if Xstrlen(tls, p) >= size_t(servlen) { - //TODO return -12 - //TODO } - //TODO Xstrcpy(tls, serv, p) - //TODO } - - //TODO return 0 -} - -func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ - if __ccgo_strace { - trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2)) - } - panic(todo("")) - //TODO bp := tls.Alloc(28) - //TODO defer tls.Free(28) - - //TODO //TODO union { - //TODO //TODO struct sockaddr_in sin; - //TODO //TODO struct sockaddr_in6 sin6; - //TODO //TODO } sa = { .sin.sin_family = af }; - //TODO *(*struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { - //TODO sin sockaddr_in - //TODO _ [12]byte - //TODO }{} //TODO- - //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- - //TODO var sl socklen_t - //TODO if af == 10 { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) - //TODO } else { - //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) - //TODO } - //TODO var i int32 - - //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) - - //TODO // Load address argument into sockaddr structure - //TODO if (af == 10) && (l == socklen_t(16)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) - //TODO } else if (af == 2) && (l == socklen_t(4)) { - //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) - //TODO } else { - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return 22 - //TODO } - - //TODO // Align buffer and check for space for pointers and ip address - //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) - //TODO if !(i != 0) { - //TODO i = int32(unsafe.Sizeof(uintptr(0))) - //TODO } - //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { - //TODO return 34 - //TODO } - //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) - //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) - - //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf - //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) - - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf - //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) - //TODO buf += uintptr(l) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf - //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) - - //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { - //TODO case -3: - //TODO *(*int32)(unsafe.Pointer(err)) = 2 - //TODO return 11 - //TODO case -12: - //TODO return 34 - //TODO default: - //TODO fallthrough - //TODO case -10: - //TODO fallthrough - //TODO case -11: - //TODO fallthrough - //TODO case -4: - //TODO *(*int32)(unsafe.Pointer(err)) = 3 - //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) - //TODO case 0: - //TODO break - //TODO } - - //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af - //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) - //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) - //TODO *(*uintptr)(unsafe.Pointer(res)) = h - //TODO return 0 -} - -// int getrlimit(int resource, struct rlimit *rlim); -func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { - if __ccgo_strace { - trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) - } - if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { - t.setErrno(err) - return -1 - } - - return 0 -} - -func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { - var statp uintptr - if stat != nil { - statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) - if statp == 0 { - panic("OOM") - } - - *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat - } - csp, errx := CString(path) - if errx != nil { - panic("OOM") - } - - return &fts.FTSENT{ - Ffts_info: uint16(info), - Ffts_path: csp, - Ffts_pathlen: uint64(len(path)), - Ffts_statp: statp, - Ffts_errno: int32(err), - } -} - -// DIR *opendir(const char *name); -func Xopendir(t *TLS, name uintptr) uintptr { - if __ccgo_strace { - trc("t=%v name=%v, (%v:)", t, name, origin(2)) - } - p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{}))) - if p == 0 { - panic("OOM") - } - - fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) - if fd < 0 { - if dmesgs { - dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) - } - Xfree(t, p) - return 0 - } - - if dmesgs { - dmesg("%v: ok", origin(1)) - } - (*darwinDir)(unsafe.Pointer(p)).fd = fd - (*darwinDir)(unsafe.Pointer(p)).h = 0 - (*darwinDir)(unsafe.Pointer(p)).l = 0 - (*darwinDir)(unsafe.Pointer(p)).eof = false - return p -} - -// clock_t clock(void); -func Xclock(t *TLS) time.Clock_t { - if __ccgo_strace { - trc("t=%v, (%v:)", t, origin(2)) - } - return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second) -} diff --git a/vendor/modernc.org/libc/libc_unix.go b/vendor/modernc.org/libc/libc_unix.go index 6cb8dcbb..0e50da1f 100644 --- a/vendor/modernc.org/libc/libc_unix.go +++ b/vendor/modernc.org/libc/libc_unix.go @@ -11,7 +11,6 @@ package libc // import "modernc.org/libc" import ( "bufio" // "encoding/hex" - "io/ioutil" "math" "math/rand" "os" @@ -118,10 +117,6 @@ func Xgethostname(t *TLS, name uintptr, slen types.Size_t) int32 { if __ccgo_strace { trc("t=%v name=%v slen=%v, (%v:)", t, name, slen, origin(2)) } - if slen < 0 { - t.setErrno(errno.EINVAL) - return -1 - } if slen == 0 { return 0 @@ -299,7 +294,7 @@ func Xtmpfile(t *TLS) uintptr { if __ccgo_strace { trc("t=%v, (%v:)", t, origin(2)) } - f, err := ioutil.TempFile("", "tmpfile-") + f, err := os.CreateTemp("", "tmpfile-") if err != nil { t.setErrno(err) return 0 @@ -318,7 +313,7 @@ func Xtmpfile(t *TLS) uintptr { // FILE *fdopen(int fd, const char *mode); func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr { if __ccgo_strace { - trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2)) + trc("t=%v fd=%v mode=%v, (%v:)", t, fd, GoString(mode), origin(2)) } m := strings.ReplaceAll(GoString(mode), "b", "") switch m { @@ -334,12 +329,12 @@ func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr { return 0 } - if p := newFile(t, fd); p != 0 { - return p + p := newFile(t, fd) + if p == 0 { + t.setErrno(errno.EINVAL) + return 0 } - - t.setErrno(errno.EINVAL) - return 0 + return p } // struct passwd *getpwnam(const char *name); @@ -588,11 +583,7 @@ func initPasswd2(t *TLS, buf uintptr, buflen types.Size_t, p *pwd.Passwd, name, } p.Fpw_shell, buf, buflen = bufString(buf, buflen, shell) - if buf == 0 { - return false - } - - return true + return buf != 0 } func bufString(buf uintptr, buflen types.Size_t, s string) (uintptr, uintptr, types.Size_t) { @@ -972,14 +963,16 @@ func Xuuid_unparse(t *TLS, uu, out uintptr) { *(*byte)(unsafe.Pointer(out + uintptr(len(s)))) = 0 } -var staticRandomData = &rand.Rand{} +// no longer used? +// var staticRandomData = &rand.Rand{} // char *initstate(unsigned seed, char *state, size_t size); func Xinitstate(t *TLS, seed uint32, statebuf uintptr, statelen types.Size_t) uintptr { if __ccgo_strace { trc("t=%v seed=%v statebuf=%v statelen=%v, (%v:)", t, seed, statebuf, statelen, origin(2)) } - staticRandomData = rand.New(rand.NewSource(int64(seed))) + // staticRandomData = rand.New(rand.NewSource(int64(seed))) + _ = rand.New(rand.NewSource(int64(seed))) return 0 } diff --git a/vendor/modernc.org/libc/libc_unix1.go b/vendor/modernc.org/libc/libc_unix1.go index 52151736..45cd8458 100644 --- a/vendor/modernc.org/libc/libc_unix1.go +++ b/vendor/modernc.org/libc/libc_unix1.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build unix && !illumos && !(linux && (amd64 || loong64)) +//go:build unix && !illumos && !(linux && (amd64 || loong64)) && !openbsd package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/pthread.go b/vendor/modernc.org/libc/pthread.go index 1a190db1..9e49cc0e 100644 --- a/vendor/modernc.org/libc/pthread.go +++ b/vendor/modernc.org/libc/pthread.go @@ -446,6 +446,7 @@ func (m *mutex) lock(id int32) int32 { m.Unlock() m.wait.Lock() + // intentional empty section - wake up other waiters m.wait.Unlock() } default: diff --git a/vendor/modernc.org/memory/AUTHORS b/vendor/modernc.org/memory/AUTHORS index 06687a28..599ec406 100644 --- a/vendor/modernc.org/memory/AUTHORS +++ b/vendor/modernc.org/memory/AUTHORS @@ -8,6 +8,7 @@ # # Please keep the list sorted. +Gleb Sakhnov Jan Mercl <0xjnml@gmail.com> +Scot C Bontrager Steffen Butzer -Gleb Sakhnov diff --git a/vendor/modernc.org/memory/CONTRIBUTORS b/vendor/modernc.org/memory/CONTRIBUTORS index 56ea0f10..e26a49e0 100644 --- a/vendor/modernc.org/memory/CONTRIBUTORS +++ b/vendor/modernc.org/memory/CONTRIBUTORS @@ -7,7 +7,8 @@ # Please keep the list sorted. Anup Kodlekere +Gleb Sakhnov Jan Mercl <0xjnml@gmail.com> +Scot C Bontrager Steffen Butzer ZHU Zijia -Gleb Sakhnov diff --git a/vendor/modernc.org/memory/builder.json b/vendor/modernc.org/memory/builder.json new file mode 100644 index 00000000..c84be24e --- /dev/null +++ b/vendor/modernc.org/memory/builder.json @@ -0,0 +1,6 @@ +{ + "autogen": "none", + "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/amd64|windows/(amd64|arm64)", + "autoupdate": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/amd64|windows/(amd64|arm64)", + "test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/amd64|windows/(amd64|arm64)" +} diff --git a/vendor/modernc.org/memory/mmap_openbsd.go b/vendor/modernc.org/memory/mmap_openbsd.go index 0b5e4f1d..24cc0a42 100644 --- a/vendor/modernc.org/memory/mmap_openbsd.go +++ b/vendor/modernc.org/memory/mmap_openbsd.go @@ -1,19 +1,97 @@ -// Copyright 2017 The Memory Authors. All rights reserved. +// Copyright 2011 Evan Shaw. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE-MMAP-GO file. + +// Modifications (c) 2024 The Memory Authors. +// Copyright 2024 The Memory Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build 386 || amd64 || arm64 -// +build 386 amd64 arm64 +//go:build openbsd && (386 || amd64 || arm64) package memory import ( - _ "unsafe" + "fmt" + "os" + "sync" + "unsafe" + + "golang.org/x/sys/unix" +) + +// track what can be unmapped +var allocmap map[uintptr][]byte +var m sync.Mutex + +const pageSizeLog = 20 + +var ( + osPageMask = osPageSize - 1 + osPageSize = os.Getpagesize() ) -// Function syscall.mmap for darwin and openbsd calls internal/abi.FuncPCABI0, -// which is implemented as a compile intrinsic so the code cannot be reused. -// Using go:linkname directive to link mmapSyscall to syscall.mmap +func init() { + allocmap = make(map[uintptr][]byte) +} + +func unmap(addr uintptr, size int) error { + if trace { + fmt.Fprintf(os.Stderr, "unmap %#x\n", addr) + } + + a, ok := allocmap[addr] + if !ok { + if trace { + fmt.Fprintf(os.Stderr, "unmap %#x: not found\n", addr) + } + // panic("unmap called on unknown mapping") + return nil + } + + if err := unix.Munmap(a); err != nil { + if trace { + fmt.Fprintf(os.Stderr, "unmap: %s\n", err.Error()) + } + // panic(err.Error()) + return err + } + + m.Lock() + delete(allocmap, addr) + m.Unlock() + + return nil +} + +func mmap(size int) (uintptr, int, error) { + roundsize := roundup(size, osPageSize) + pageSize + + b, err := unix.Mmap(-1, 0, roundsize, unix.PROT_READ|unix.PROT_WRITE, unix.MAP_PRIVATE|unix.MAP_ANON) + if err != nil { + return 0, 0, err + } + + p := uintptr(unsafe.Pointer(&b[0])) + + if trace { + fmt.Fprintf(os.Stderr, "mmap actual @%#x size: %#x\n", p, roundsize) + } + + // waste all the space until the next page + r := (p + uintptr(pageSize)) &^ uintptr(pageMask) + nsize := (roundsize) - int((r - p)) + if nsize < size { + panic("didn't allocate enough to meet initial request!") + } + + if trace { + fmt.Fprintf(os.Stderr, "mmap page-rounded @%#x size: %#x\n", r, nsize) + } + + m.Lock() + allocmap[r] = b + m.Unlock() -//go:linkname mmapSyscall syscall.mmap -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) + return r, nsize, nil +} diff --git a/vendor/modernc.org/memory/mmap_unix.go b/vendor/modernc.org/memory/mmap_unix.go index 93f9b820..de57b882 100644 --- a/vendor/modernc.org/memory/mmap_unix.go +++ b/vendor/modernc.org/memory/mmap_unix.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE-MMAP-GO file. -//go:build darwin || dragonfly || freebsd || linux || openbsd || (solaris && !illumos) || netbsd -// +build darwin dragonfly freebsd linux openbsd solaris,!illumos netbsd +//go:build darwin || dragonfly || freebsd || linux || (solaris && !illumos) || netbsd +// +build darwin dragonfly freebsd linux solaris,!illumos netbsd // Modifications (c) 2017 The Memory Authors. @@ -33,6 +33,7 @@ func unmap(addr uintptr, size int) error { // pageSize aligned. func mmap(size int) (uintptr, int, error) { size = roundup(size, osPageSize) + // The actual mmap syscall varies by architecture. mmapSyscall provides same // functionality as the unexported funtion syscall.mmap and is declared in // mmap_*_*.go and mmap_fallback.go. To add support for a new architecture, diff --git a/vendor/modernc.org/sqlite/AUTHORS b/vendor/modernc.org/sqlite/AUTHORS index 580af028..8ded64c3 100644 --- a/vendor/modernc.org/sqlite/AUTHORS +++ b/vendor/modernc.org/sqlite/AUTHORS @@ -22,6 +22,7 @@ Josh Klein Logan Snow Michael Hoffmann Michael Rykov +Morgan Bazalgette Ross Light Saed SayedAhmed Steffen Butzer diff --git a/vendor/modernc.org/sqlite/CONTRIBUTORS b/vendor/modernc.org/sqlite/CONTRIBUTORS index 01c92d91..c8b9fea7 100644 --- a/vendor/modernc.org/sqlite/CONTRIBUTORS +++ b/vendor/modernc.org/sqlite/CONTRIBUTORS @@ -23,10 +23,12 @@ Josh Bleecher Snyder Josh Klein Kim Logan Snow +Mario Salgado Mark Summerfield Matthew Gabeler-Lee Michael Hoffmann Michael Rykov +Morgan Bazalgette Romain Le Disez Ross Light Saed SayedAhmed diff --git a/vendor/modernc.org/sqlite/Makefile b/vendor/modernc.org/sqlite/Makefile index 357baa01..85c40ebc 100644 --- a/vendor/modernc.org/sqlite/Makefile +++ b/vendor/modernc.org/sqlite/Makefile @@ -29,6 +29,8 @@ build_all_targets: GOOS=linux GOARCH=arm go build -v ./... GOOS=linux GOARCH=arm64 go test -c -o /dev/null GOOS=linux GOARCH=arm64 go build -v ./... + GOOS=linux GOARCH=loong64 go test -c -o /dev/null + GOOS=linux GOARCH=loong64 go build -v ./... GOOS=linux GOARCH=ppc64le go test -c -o /dev/null GOOS=linux GOARCH=ppc64le go build -v ./... GOOS=linux GOARCH=riscv64 go test -c -o /dev/null @@ -55,7 +57,7 @@ clean: edit: @touch log - @if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile all_test.go generator.go & fi + @if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile go.mod builder.json all_test.go vendor_libsqlite3.go & fi editor: gofmt -l -s -w . 2>&1 | tee log-editor @@ -64,7 +66,7 @@ editor: go build -o /dev/null vendor_libsqlite3.go test: - go test -v -timeout 24h 2>&1 | tee log-test + go test -v -timeout 24h . ./functest 2>&1 | tee log-test vendor: go run vendor_libsqlite3.go && make build_all_targets diff --git a/vendor/modernc.org/sqlite/README.md b/vendor/modernc.org/sqlite/README.md index aa45ff87..f47ad324 100644 --- a/vendor/modernc.org/sqlite/README.md +++ b/vendor/modernc.org/sqlite/README.md @@ -16,7 +16,7 @@ allowing one of the maintainers to work on it also in office hours. ## Documentation -[godoc.org/modernc.org/sqlite](http://godoc.org/modernc.org/sqlite) +[pkg.go.dev/modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite) ## Builders @@ -74,3 +74,8 @@ RAM. Shown are the best of 3 runs. TOTAL....................................................... 5.525s TOTAL....................................................... 4.637s This particular test executes 16.1% faster in the C version. + +## Troubleshooting + +* Q: **How can I write to a database concurrently without getting the `database is locked` error (or `SQLITE_BUSY`)?** + * A: You can't. The C sqlite implementation does not allow concurrent writes, and this libary does not modify that behaviour. You can, however, use [DB.SetMaxOpenConns(1)](https://pkg.go.dev/database/sql#DB.SetMaxOpenConns) so that only 1 connection is ever used by the `DB`, allowing concurrent access to DB without making the writes concurrent. More information on issues [#65](https://gitlab.com/cznic/sqlite/-/issues/65) and [#106](https://gitlab.com/cznic/sqlite/-/issues/106). diff --git a/vendor/modernc.org/sqlite/bind_blob.go b/vendor/modernc.org/sqlite/bind_blob.go new file mode 100644 index 00000000..42b0c680 --- /dev/null +++ b/vendor/modernc.org/sqlite/bind_blob.go @@ -0,0 +1,40 @@ +// Copyright 2024 The Sqlite Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !(linux && (amd64 || loong64)) + +package sqlite // import "modernc.org/sqlite" + +import ( + "unsafe" + + "modernc.org/libc" + sqlite3 "modernc.org/sqlite/lib" +) + +// C documentation +// +// int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +func (c *conn) bindBlob(pstmt uintptr, idx1 int, value []byte) (uintptr, error) { + if value != nil && len(value) == 0 { + if rc := sqlite3.Xsqlite3_bind_zeroblob(c.tls, pstmt, int32(idx1), 0); rc != sqlite3.SQLITE_OK { + return 0, c.errstr(rc) + } + return 0, nil + } + + p, err := c.malloc(len(value)) + if err != nil { + return 0, err + } + if len(value) != 0 { + copy((*libc.RawMem)(unsafe.Pointer(p))[:len(value):len(value)], value) + } + if rc := sqlite3.Xsqlite3_bind_blob(c.tls, pstmt, int32(idx1), p, int32(len(value)), 0); rc != sqlite3.SQLITE_OK { + c.free(p) + return 0, c.errstr(rc) + } + + return p, nil +} diff --git a/vendor/modernc.org/sqlite/bind_blob_musl.go b/vendor/modernc.org/sqlite/bind_blob_musl.go new file mode 100644 index 00000000..644805a7 --- /dev/null +++ b/vendor/modernc.org/sqlite/bind_blob_musl.go @@ -0,0 +1,40 @@ +// Copyright 2024 The Sqlite Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux && (amd64 || loong64) + +package sqlite // import "modernc.org/sqlite" + +import ( + "unsafe" + + "modernc.org/libc" + sqlite3 "modernc.org/sqlite/lib" +) + +// C documentation +// +// int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +func (c *conn) bindBlob(pstmt uintptr, idx1 int, value []byte) (uintptr, error) { + if value == nil { + if rc := sqlite3.Xsqlite3_bind_null(c.tls, pstmt, int32(idx1)); rc != sqlite3.SQLITE_OK { + return 0, c.errstr(rc) + } + return 0, nil + } + + p, err := c.malloc(len(value)) + if err != nil { + return 0, err + } + if len(value) != 0 { + copy((*libc.RawMem)(unsafe.Pointer(p))[:len(value):len(value)], value) + } + if rc := sqlite3.Xsqlite3_bind_blob(c.tls, pstmt, int32(idx1), p, int32(len(value)), 0); rc != sqlite3.SQLITE_OK { + c.free(p) + return 0, c.errstr(rc) + } + + return p, nil +} diff --git a/vendor/modernc.org/sqlite/builder.json b/vendor/modernc.org/sqlite/builder.json index 4b42126d..0072d8d2 100644 --- a/vendor/modernc.org/sqlite/builder.json +++ b/vendor/modernc.org/sqlite/builder.json @@ -1,6 +1,6 @@ { "autogen": "", - "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)", - "autoupdate": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)", - "test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)" + "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)", + "autoupdate": "", + "test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)" } diff --git a/vendor/modernc.org/sqlite/doc.go b/vendor/modernc.org/sqlite/doc.go index dfa994da..1d867201 100644 --- a/vendor/modernc.org/sqlite/doc.go +++ b/vendor/modernc.org/sqlite/doc.go @@ -19,19 +19,20 @@ // // OS Arch SQLite version // ------------------------------ -// darwin amd64 3.45.1 -// darwin arm64 3.45.1 -// freebsd amd64 3.45.1 -// freebsd arm64 3.45.1 -// linux 386 3.45.1 -// linux amd64 3.45.1 -// linux arm 3.45.1 -// linux arm64 3.45.1 -// linux ppc64le 3.45.1 -// linux riscv64 3.45.1 -// linux s390x 3.45.1 -// windows amd64 3.45.1 -// windows arm64 3.45.1 +// darwin amd64 3.45.3 +// darwin arm64 3.45.3 +// freebsd amd64 3.45.3 +// freebsd arm64 3.45.3 +// linux 386 3.45.3 +// linux amd64 3.45.3 +// linux arm 3.45.3 +// linux arm64 3.45.3 +// linux loong64 3.45.3 +// linux ppc64le 3.45.3 +// linux riscv64 3.45.3 +// linux s390x 3.45.3 +// windows amd64 3.45.3 +// windows arm64 3.45.3 // // # Builders // diff --git a/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go index 61fa9c0f..ba18b977 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated for darwin/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for darwin/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build darwin && amd64 // +build darwin,amd64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -334,9 +336,6 @@ const CC_VARALPHA = 5 const CC_VARNUM = 6 const CC_X = 0 const CHARCLASS_NAME_MAX = 14 -const CHAR_BIT = 8 -const CHAR_MAX = 127 -const CHAR_MIN = -128 const CHILD_MAX = 266 const CKCNSTRNT_COLUMN = 1 const CKCNSTRNT_ROWID = 2 @@ -866,7 +865,6 @@ const HASHTABLE_NPAGE_ONE = 4096 const HASHTABLE_NSLOT = 8192 const HAVE_FCHOWN = 1 const HAVE_FULLFSYNC = 1 -const HAVE_GETHOSTUUID = 1 const HAVE_LSTAT = 1 const HAVE_MREMAP = 0 const HAVE_PREAD = 1 @@ -931,8 +929,6 @@ const INT_LEAST64_MAX = 9223372036854775807 const INT_LEAST64_MIN = -9223372036854775808 const INT_LEAST8_MAX = 127 const INT_LEAST8_MIN = -128 -const INT_MAX = 2147483647 -const INT_MIN = -2147483648 const IN_INDEX_EPH = 2 const IN_INDEX_INDEX_ASC = 3 const IN_INDEX_INDEX_DESC = 4 @@ -1053,8 +1049,6 @@ const LEGACY_TEMP_SCHEMA_TABLE = "sqlite_temp_master" const LINE_MAX = 2048 const LINK_MAX = 32767 const LITTLE_ENDIAN = 1234 -const LLONG_MAX = 9223372036854775807 -const LLONG_MIN = -9223372036854775808 const LOCATE_NOERR = 2 const LOCATE_VIEW = 1 const LOCK_EX = 2 @@ -1062,10 +1056,6 @@ const LOCK_NB = 4 const LOCK_SH = 1 const LOCK_UN = 8 const LONGDOUBLE_TYPE = 0 -const LONG_LONG_MAX = 9223372036854775807 -const LONG_LONG_MIN = -9223372036854775808 -const LONG_MAX = 9223372036854775807 -const LONG_MIN = -9223372036854775808 const LOOKASIDE_SMALL = 128 const L_INCR = 1 const L_SET = 0 @@ -1136,6 +1126,8 @@ const MAC_OS_VERSION_13_6 = 130600 const MAC_OS_VERSION_14_0 = 140000 const MAC_OS_VERSION_14_1 = 140100 const MAC_OS_VERSION_14_2 = 140200 +const MAC_OS_VERSION_14_3 = 140300 +const MAC_OS_VERSION_14_4 = 140400 const MAC_OS_X_VERSION_10_0 = 1000 const MAC_OS_X_VERSION_10_1 = 1010 const MAC_OS_X_VERSION_10_10 = 101000 @@ -1180,6 +1172,7 @@ const MADV_PAGEOUT = 10 const MADV_RANDOM = 1 const MADV_SEQUENTIAL = 2 const MADV_WILLNEED = 3 +const MADV_ZERO = 11 const MADV_ZERO_WIRED_PAGES = 6 const MAP_32BIT = 32768 const MAP_ANON = 4096 @@ -1389,6 +1382,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NFDBITS = 0 const NFSV2_MAX_FH_SIZE = 32 @@ -2005,8 +1999,6 @@ const SBC_PRESERVE_GRAFT = 32 const SBC_PRESERVE_MOUNT = 1 const SBC_STRICT_AUTH = 16 const SBC_SYSTEM_CONTENT = 4 -const SCHAR_MAX = 127 -const SCHAR_MIN = -128 const SCHEMA_ROOT = 1 const SEARCHFS_MAX_SEARCHPARMS = 4096 const SEEK_CUR = 1 @@ -2063,8 +2055,6 @@ const SF_WinRewrite = 1048576 const SHARED_FIRST = 2 const SHARED_LOCK = 1 const SHARED_SIZE = 510 -const SHRT_MAX = 32767 -const SHRT_MIN = -32768 const SIGABRT = 6 const SIGALRM = 14 const SIGBUS = 10 @@ -2209,6 +2199,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2663,10 +2654,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2741,7 +2729,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2849,8 +2837,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -3229,7 +3217,6 @@ const TRIGGER_AFTER = 2 const TRIGGER_BEFORE = 1 const TRUE = 1 const TTYDISC = 0 -const UCHAR_MAX = 255 const UF_APPEND = 4 const UF_COMPRESSED = 32 const UF_DATAVAULT = 128 @@ -3254,10 +3241,6 @@ const UINT_LEAST16_MAX = 65535 const UINT_LEAST32_MAX = 4294967295 const UINT_LEAST64_MAX = 18446744073709551615 const UINT_LEAST8_MAX = 255 -const UINT_MAX = 4294967295 -const ULLONG_MAX = 18446744073709551615 -const ULONG_LONG_MAX = 18446744073709551615 -const ULONG_MAX = 18446744073709551615 const UNDERFLOW = 4 const UNIXFILE_DELETE = 32 const UNIXFILE_DIRSYNC = 8 @@ -3272,7 +3255,6 @@ const UNIX_SHM_DMS = 128 const UNKNOWN_LOCK = 5 const USER_FSIGNATURES_CDHASH_LEN = 20 const USE_PREAD = 1 -const USHRT_MAX = 65535 const UTIME_NOW = -1 const UTIME_OMIT = -2 const UpperToLower = 0 @@ -3306,6 +3288,7 @@ const VOL_CAP_FMT_2TB_FILESIZE = 2048 const VOL_CAP_FMT_64BIT_OBJECT_IDS = 131072 const VOL_CAP_FMT_CASE_PRESERVING = 512 const VOL_CAP_FMT_CASE_SENSITIVE = 256 +const VOL_CAP_FMT_CLONE_MAPPING = 67108864 const VOL_CAP_FMT_DECMPFS_COMPRESSION = 65536 const VOL_CAP_FMT_DIR_HARDLINKS = 262144 const VOL_CAP_FMT_DOCUMENT_ID = 524288 @@ -3330,6 +3313,7 @@ const VOL_CAP_FMT_WRITE_GENERATION_COUNT = 1048576 const VOL_CAP_FMT_ZERO_RUNS = 128 const VOL_CAP_INT_ADVLOCK = 256 const VOL_CAP_INT_ALLOCATE = 64 +const VOL_CAP_INT_ATTRIBUTION_TAG = 4194304 const VOL_CAP_INT_ATTRLIST = 2 const VOL_CAP_INT_CLONE = 65536 const VOL_CAP_INT_COPYFILE = 32 @@ -3366,6 +3350,7 @@ const VQ_SYNCEVENT = 1024 const VQ_UNMOUNT = 16 const VQ_UPDATE = 256 const VQ_VERYLOWDISK = 512 +const ViewCanHaveRowid = 0 const WAIT_ANY = -1 const WAIT_MYPGRP = 0 const WAKEMON_DISABLE = 2 @@ -3803,7 +3788,6 @@ const _SC_XOPEN_UNIX = 115 const _SC_XOPEN_VERSION = 116 const _SC_XOPEN_XCU_VERSION = 121 const _STRUCT_MCONTEXT = "_STRUCT_MCONTEXT64" -const _USE_FORTIFY_LEVEL = 2 const _V6_ILP32_OFF32 = -1 const _V6_ILP32_OFFBIG = -1 const _V6_LP64_OFF64 = 1 @@ -3875,6 +3859,8 @@ const __BRIDGEOS_7_6 = 70600 const __BRIDGEOS_8_0 = 80000 const __BRIDGEOS_8_1 = 80100 const __BRIDGEOS_8_2 = 80200 +const __BRIDGEOS_8_3 = 80300 +const __BRIDGEOS_8_4 = 80400 const __BYTE_ORDER__ = 1234 const __CCGO__ = 1 const __CHAR_BIT__ = 8 @@ -3941,6 +3927,8 @@ const __DRIVERKIT_22_6 = 220600 const __DRIVERKIT_23_0 = 230000 const __DRIVERKIT_23_1 = 230100 const __DRIVERKIT_23_2 = 230200 +const __DRIVERKIT_23_3 = 230300 +const __DRIVERKIT_23_4 = 230400 const __DYLDDL_DRIVERKIT_UNAVAILABLE = 0 const __DYNAMIC__ = 1 const __ENABLE_LEGACY_MAC_AVAILABILITY = 1 @@ -4048,16 +4036,12 @@ const __INT_FAST8_MAX__ = 127 const __INT_FAST8_WIDTH__ = 8 const __INT_LEAST16_FMTd__ = "hd" const __INT_LEAST16_FMTi__ = "hi" -const __INT_LEAST16_MAX = 32767 const __INT_LEAST16_MAX__ = 32767 -const __INT_LEAST16_MIN = -32768 const __INT_LEAST16_TYPE__ = 0 const __INT_LEAST16_WIDTH__ = 16 const __INT_LEAST32_FMTd__ = "d" const __INT_LEAST32_FMTi__ = "i" -const __INT_LEAST32_MAX = 2147483647 const __INT_LEAST32_MAX__ = 2147483647 -const __INT_LEAST32_MIN = -2147483648 const __INT_LEAST32_TYPE__ = 0 const __INT_LEAST32_WIDTH__ = 32 const __INT_LEAST64_FMTd__ = "lld" @@ -4068,9 +4052,7 @@ const __INT_LEAST64_MIN = -9223372036854775808 const __INT_LEAST64_WIDTH__ = 64 const __INT_LEAST8_FMTd__ = "hhd" const __INT_LEAST8_FMTi__ = "hhi" -const __INT_LEAST8_MAX = 127 const __INT_LEAST8_MAX__ = 127 -const __INT_LEAST8_MIN = -128 const __INT_LEAST8_WIDTH__ = 8 const __INT_MAX__ = 2147483647 const __INT_WIDTH__ = 32 @@ -4112,6 +4094,8 @@ const __IPHONE_15_3 = 150300 const __IPHONE_15_4 = 150400 const __IPHONE_15_5 = 150500 const __IPHONE_15_6 = 150600 +const __IPHONE_15_7 = 150700 +const __IPHONE_15_8 = 150800 const __IPHONE_16_0 = 160000 const __IPHONE_16_1 = 160100 const __IPHONE_16_2 = 160200 @@ -4123,6 +4107,8 @@ const __IPHONE_16_7 = 160700 const __IPHONE_17_0 = 170000 const __IPHONE_17_1 = 170100 const __IPHONE_17_2 = 170200 +const __IPHONE_17_3 = 170300 +const __IPHONE_17_4 = 170400 const __IPHONE_2_0 = 20000 const __IPHONE_2_1 = 20100 const __IPHONE_2_2 = 20200 @@ -4231,7 +4217,9 @@ const __MAC_13_6 = 130600 const __MAC_14_0 = 140000 const __MAC_14_1 = 140100 const __MAC_14_2 = 140200 -const __MAC_OS_X_VERSION_MAX_ALLOWED = 140200 +const __MAC_14_3 = 140300 +const __MAC_14_4 = 140400 +const __MAC_OS_X_VERSION_MAX_ALLOWED = 140400 const __MAC_OS_X_VERSION_MIN_REQUIRED = 140000 const __MMX__ = 1 const __NO_INLINE__ = 1 @@ -4365,6 +4353,8 @@ const __TVOS_16_6 = 160600 const __TVOS_17_0 = 170000 const __TVOS_17_1 = 170100 const __TVOS_17_2 = 170200 +const __TVOS_17_3 = 170300 +const __TVOS_17_4 = 170400 const __TVOS_9_0 = 90000 const __TVOS_9_1 = 90100 const __TVOS_9_2 = 90200 @@ -4427,13 +4417,11 @@ const __UINT_LEAST16_FMTX__ = "hX" const __UINT_LEAST16_FMTo__ = "ho" const __UINT_LEAST16_FMTu__ = "hu" const __UINT_LEAST16_FMTx__ = "hx" -const __UINT_LEAST16_MAX = 65535 const __UINT_LEAST16_MAX__ = 65535 const __UINT_LEAST32_FMTX__ = "X" const __UINT_LEAST32_FMTo__ = "o" const __UINT_LEAST32_FMTu__ = "u" const __UINT_LEAST32_FMTx__ = "x" -const __UINT_LEAST32_MAX = 4294967295 const __UINT_LEAST32_MAX__ = 4294967295 const __UINT_LEAST64_FMTX__ = "llX" const __UINT_LEAST64_FMTo__ = "llo" @@ -4445,14 +4433,16 @@ const __UINT_LEAST8_FMTX__ = "hhX" const __UINT_LEAST8_FMTo__ = "hho" const __UINT_LEAST8_FMTu__ = "hhu" const __UINT_LEAST8_FMTx__ = "hhx" -const __UINT_LEAST8_MAX = 255 const __UINT_LEAST8_MAX__ = 255 const __USER_LABEL_PREFIX__ = 0 -const __VERSION__ = "Apple LLVM 15.0.0 (clang-1500.1.0.2.5)" +const __VERSION__ = "Apple LLVM 15.0.0 (clang-1500.3.9.4)" const __VISIONOS_1_0 = 10000 +const __VISIONOS_1_1 = 10100 const __WATCHOS_10_0 = 100000 const __WATCHOS_10_1 = 100100 const __WATCHOS_10_2 = 100200 +const __WATCHOS_10_3 = 100300 +const __WATCHOS_10_4 = 100400 const __WATCHOS_1_0 = 10000 const __WATCHOS_2_0 = 20000 const __WATCHOS_2_1 = 20100 @@ -4486,6 +4476,7 @@ const __WATCHOS_8_4 = 80400 const __WATCHOS_8_5 = 80500 const __WATCHOS_8_6 = 80600 const __WATCHOS_8_7 = 80700 +const __WATCHOS_8_8 = 80800 const __WATCHOS_9_0 = 90000 const __WATCHOS_9_1 = 90100 const __WATCHOS_9_2 = 90200 @@ -4501,14 +4492,14 @@ const __WINT_TYPE__ = 0 const __WINT_WIDTH__ = 32 const __amd64 = 1 const __amd64__ = 1 -const __apple_build_version__ = 15000100 +const __apple_build_version__ = 15000309 const __bool_true_false_are_defined = 1 const __clang__ = 1 const __clang_literal_encoding__ = "UTF-8" const __clang_major__ = 15 const __clang_minor__ = 0 const __clang_patchlevel__ = 0 -const __clang_version__ = "15.0.0 (clang-1500.1.0.2.5)" +const __clang_version__ = "15.0.0 (clang-1500.3.9.4)" const __clang_wide_literal_encoding__ = "UTF-32" const __code_model_small__ = 1 const __const = 0 @@ -4517,15 +4508,8 @@ const __core2__ = 1 const __exported_pop = 0 const __exported_push = 0 const __has_ptrcheck = 0 +const __has_safe_buffers = 0 const __header_inline = 0 -const __int16_c_suffix = 0 -const __int32_c_suffix = 0 -const __int64_c_suffix = 0 -const __int8_c_suffix = 0 -const __int_least16_t = 0 -const __int_least32_t = 0 -const __int_least64_t = 0 -const __int_least8_t = 0 const __llvm__ = 1 const __nonnull = 0 const __null_unspecified = 0 @@ -4535,10 +4519,6 @@ const __restrict = 0 const __restrict_arr = 0 const __signed = 0 const __tune_core2__ = 1 -const __uint_least16_t = 0 -const __uint_least32_t = 0 -const __uint_least64_t = 0 -const __uint_least8_t = 0 const __unreachable_ok_pop = 0 const __unreachable_ok_push = 0 const __volatile = 0 @@ -9305,7 +9285,9 @@ type Trusage_info_v6 = struct { Fri_pcycles Tuint64_t Fri_energy_nj Tuint64_t Fri_penergy_nj Tuint64_t - Fri_reserved [14]Tuint64_t + Fri_secure_time_in_system Tuint64_t + Fri_secure_ptime_in_system Tuint64_t + Fri_reserved [12]Tuint64_t } type rusage_info_v6 = Trusage_info_v6 @@ -9354,7 +9336,9 @@ type Trusage_info_current = struct { Fri_pcycles Tuint64_t Fri_energy_nj Tuint64_t Fri_penergy_nj Tuint64_t - Fri_reserved [14]Tuint64_t + Fri_secure_time_in_system Tuint64_t + Fri_secure_ptime_in_system Tuint64_t + Fri_reserved [12]Tuint64_t } type rusage_info_current = Trusage_info_current @@ -10536,6 +10520,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -12099,6 +12084,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -12804,6 +12793,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -15338,7 +15328,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -15485,6 +15475,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -15497,7 +15488,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -15522,6 +15513,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -15532,11 +15524,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -15551,7 +15545,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart @@ -15563,6 +15557,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -15596,6 +15591,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -15780,6 +15776,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -15847,6 +15844,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { zDate++ } @@ -16530,6 +16528,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -16547,6 +16546,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1271, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -16657,6 +16663,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -16767,7 +16774,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { @@ -16780,7 +16787,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 8)) += y @@ -16795,6 +16802,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -16848,6 +16856,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -17114,7 +17123,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -17140,7 +17149,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -17156,9 +17165,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = 0 (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -17177,7 +17186,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -17208,7 +17217,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1411, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -17226,6 +17235,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -17836,6 +17846,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -19566,6 +19577,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -20122,6 +20134,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -20147,6 +20160,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -20206,11 +20220,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -20319,6 +20337,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -20340,14 +20359,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -20363,6 +20386,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -20495,6 +20521,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -20516,6 +20543,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v70)) = int8('0') goto _69 _69: + ; precision-- e2++ } @@ -20603,6 +20631,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -20620,6 +20649,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -20628,11 +20658,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -20709,7 +20741,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -20763,6 +20797,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -20770,6 +20805,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -20782,9 +20818,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -20832,6 +20871,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -20871,6 +20911,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -20882,6 +20923,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -20905,6 +20947,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -20936,8 +20979,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -20964,6 +21009,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -21823,6 +21869,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -21833,6 +21880,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -22496,6 +22544,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -22713,6 +22762,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.X__builtin___memcpy_chk(tls, bp+8, bp, uint64(8), libc.X__builtin_object_size(tls, bp+8, 0)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -23565,6 +23636,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -23615,6 +23687,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -23650,6 +23723,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -24097,6 +24175,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -24157,6 +24236,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -24179,6 +24259,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -24400,6 +24481,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { } goto _1 _1: + ; i++ } return i @@ -24456,6 +24538,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -29140,6 +29232,7 @@ func _afpLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { } } afp_end_lock: + ; Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) return rc } @@ -29588,6 +29681,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -29605,7 +29699,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3512, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3512, bp, int32(41778)) } // C documentation @@ -29642,7 +29736,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -30250,7 +30346,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -30679,6 +30779,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -30696,6 +30797,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -30752,6 +30854,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -30845,7 +30948,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -31319,6 +31422,7 @@ func _autolockIoFinderImpl(tls *libc.TLS, filePath uintptr, pNew uintptr) (r uin } goto _1 _1: + ; i++ } } @@ -31455,7 +31559,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -31477,7 +31581,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam rc = _findInodeInfo(tls, pNew, pNew+16) if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pNew)).FlockingContext) - _robust_close(tls, pNew, h, int32(43873)) + _robust_close(tls, pNew, h, int32(43935)) h = -int32(1) } _unixLeaveMutex(tls) @@ -31498,7 +31602,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -31652,6 +31756,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -31909,7 +32014,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3395, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3395, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -31945,7 +32050,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } if libc.Xfstatfs(tls, fd, bp) == -int32(1) { _storeLastErrno(tls, p, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - _robust_close(tls, p, fd, int32(44427)) + _robust_close(tls, p, fd, int32(44489)) return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(13)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+144, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(1026)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3584, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3584, zIn, int32(44691)) return } (*(*[1026]int8)(unsafe.Pointer(bp + 144)))[got] = 0 @@ -32188,6 +32294,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -32220,14 +32327,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3413, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3413, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= 0 { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, bp) - _robust_close(tls, pFile, fd, int32(45364)) + _robust_close(tls, pFile, fd, int32(45426)) } libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+4167, libc.VaList(bp+2144, cPath, bp+2065)) } @@ -33018,7 +33129,8 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { ** we'll try to use the path there, if we can't open that path, we'll ** retry with a new auto-generated path */ - _3: /* in case we need to try again for an :auto: named lock file */ + _3: + ; /* in case we need to try again for an :auto: named lock file */ if !(createConch != 0) && !(forceNewLockPath != 0) { hostIdMatch = libc.BoolInt32(!(libc.Xmemcmp(tls, bp+20+1, bp, uint64(PROXY_HOSTIDLEN)) != 0)) /* if the conch has data compare the contents */ @@ -33099,16 +33211,17 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { } (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(conchFile)).FpMethod)).FxUnlock})))(tls, conchFile, int32(SHARED_LOCK)) end_takeconch: + ; if rc == SQLITE_OK && (*TunixFile)(unsafe.Pointer(pFile)).FopenFlags != 0 { if (*TunixFile)(unsafe.Pointer(pFile)).Fh >= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(45617)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(45679)) } (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) fd = _robust_open(tls, (*TproxyLockingContext)(unsafe.Pointer(pCtx)).FdbPath, (*TunixFile)(unsafe.Pointer(pFile)).FopenFlags, uint16(0)) if fd >= 0 { (*TunixFile)(unsafe.Pointer(pFile)).Fh = fd } else { - rc = _sqlite3CantopenError(tls, int32(45625)) /* SQLITE_BUSY? proxyTakeConch called + rc = _sqlite3CantopenError(tls, int32(45687)) /* SQLITE_BUSY? proxyTakeConch called during locking */ } } @@ -33152,11 +33265,13 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { return rc goto _2 _2: + ; if int32(1) != 0 { goto _3 } goto _1 - _1: /* in case we need to retry the :auto: lock file - + _1: + /* in case we need to retry the :auto: lock file - ** we should never get here except via the 'continue' call. */ } return r @@ -33220,6 +33335,7 @@ func _proxyCreateConchPathname(tls *libc.TLS, dbPath uintptr, pConchPath uintptr } goto _2 _2: + ; i-- } *(*int8)(unsafe.Pointer(conchPath + uintptr(i))) = int8('.') @@ -33634,6 +33750,7 @@ func Xsqlite3_os_init(tls *libc.TLS) (r int32) { Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&_aVfs))+uintptr(i)*168, libc.BoolInt32(i == uint32(0))) goto _1 _1: + ; i++ } _unixBigLock = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1)) @@ -34189,6 +34306,7 @@ func _memdbClose(tls *libc.TLS, pFile uintptr) (r int32) { } goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, pVfsMutex) @@ -34538,6 +34656,7 @@ func _memdbOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFd uintptr, flags i } goto _1 _1: + ; i++ } if p == uintptr(0) { @@ -34784,6 +34903,14 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp pOut = uintptr(0) } else { sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + if sz == 0 { + Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + Xsqlite3_exec(tls, db, __ccgo_ts+4359, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == int32(SQLITE_ROW) { + sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + } + } if piSize != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = sz } @@ -34810,6 +34937,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _2 _2: + ; pgno++ } } @@ -34840,7 +34968,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = int32(SQLITE_ERROR) goto end_deserialize } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4359, libc.VaList(bp+16, zSchema)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4384, libc.VaList(bp+16, zSchema)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -34875,6 +35003,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = SQLITE_OK } end_deserialize: + ; Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) if pData != 0 && mFlags&uint32(SQLITE_DESERIALIZE_FREEONCLOSE) != uint32(0) { Xsqlite3_free(tls, pData) @@ -35142,6 +35271,7 @@ func _sqlite3BitvecSet(tls *libc.TLS, p uintptr, i Tu32) (r int32) { /* available free spot. check to see if this is going to */ /* make our hash too "full". */ bitvec_set_rehash: + ; if uint64((*TBitvec)(unsafe.Pointer(p)).FnSet) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -35161,6 +35291,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -35168,6 +35299,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -35224,6 +35356,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -35249,6 +35382,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -35392,10 +35526,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -35752,6 +35888,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -35763,6 +35900,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -35950,6 +36088,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -35972,6 +36111,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -36030,6 +36170,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -36137,6 +36278,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -36163,6 +36305,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -36184,6 +36327,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -36291,6 +36435,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -36707,6 +36852,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -36963,6 +37109,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -37012,6 +37159,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -37825,6 +37973,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -37979,6 +38128,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -38001,6 +38151,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -38106,6 +38257,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -38198,6 +38350,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -38239,6 +38392,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -39143,12 +39297,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -39355,6 +39511,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -39501,6 +39658,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -39575,6 +39733,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -39742,6 +39901,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -39833,6 +39993,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -39867,6 +40028,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -40626,6 +40788,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -40946,11 +41109,13 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -40991,7 +41156,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -45079,7 +45259,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4432, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4457, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -46466,6 +46646,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -46519,10 +46700,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -46606,7 +46788,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -46671,6 +46853,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -46695,11 +46878,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -46732,6 +46917,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -46740,10 +46926,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< 0 { @@ -49259,7 +49467,7 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, /* Copy data from the log to the database file. */ if rc == SQLITE_OK { if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { - rc = _sqlite3CorruptError(tls, int32(68842)) + rc = _sqlite3CorruptError(tls, int32(68912)) } else { rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) } @@ -50332,6 +50540,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } _lockBtreeMutex(tls, p) @@ -50345,6 +50554,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } } @@ -50396,6 +50606,7 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) @@ -50422,6 +50633,7 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } } @@ -50589,6 +50801,7 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } return SQLITE_OK @@ -50636,6 +50849,7 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } /* If the above search did not find a BtLock struct associating Btree p @@ -50729,6 +50943,7 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) goto _2 _2: + ; pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext } } @@ -50765,6 +50980,7 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -50801,6 +51017,7 @@ func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, i } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -50902,6 +51119,7 @@ func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) goto _1 _1: + ; i++ } _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -51017,6 +51235,7 @@ func _saveAllCursors(tls *libc.TLS, pBt uintptr, iRoot TPgno, pExcept uintptr) ( } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -51085,7 +51304,7 @@ func _btreeMoveto(tls *libc.TLS, pCur uintptr, pKey uintptr, nKey Ti64, bias int } _sqlite3VdbeRecordUnpack(tls, pKeyInfo, int32(nKey), pKey, pIdxKey) if int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) == 0 || int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) > int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -51263,7 +51482,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } /* The super-journal page number must never be used as a pointer map page */ if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -51276,12 +51495,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -51295,6 +51514,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -51323,7 +51543,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) if pPgno != 0 { @@ -51331,7 +51551,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -51751,7 +51971,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -51791,12 +52011,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -51804,21 +52024,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.X__builtin___memmove_chk(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz)), libc.X__builtin_object_size(tls, data+uintptr(iFree+sz+sz2), 0)) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -51840,6 +52060,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -51864,25 +52085,27 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) libc.X__builtin___memcpy_chk(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size), libc.X__builtin_object_size(tls, data+uintptr(cbrk), 0)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) @@ -51942,7 +52165,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -51959,14 +52182,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -52009,11 +52232,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -52027,7 +52250,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -52110,12 +52333,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none @@ -52126,11 +52349,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -52151,7 +52374,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -52168,10 +52391,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -52232,7 +52455,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -52258,7 +52481,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -52297,12 +52520,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -52329,7 +52552,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -52360,14 +52583,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))< iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -52392,7 +52616,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) @@ -52405,7 +52629,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -52558,7 +52782,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _, _ = pPage, rc if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -52620,7 +52844,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -52708,7 +52932,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4513) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4538) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ @@ -52784,6 +53008,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -52792,6 +53017,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -52925,11 +53151,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -53489,7 +53717,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4522, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4547, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -53527,7 +53755,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -53582,6 +53810,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -53746,6 +53975,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -53849,6 +54079,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -53927,6 +54158,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53962,7 +54194,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -53986,7 +54218,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -53995,7 +54227,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -54004,11 +54236,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -54038,7 +54271,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -54134,7 +54367,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -54172,7 +54405,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) @@ -54239,7 +54472,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -54282,7 +54515,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -54297,6 +54530,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -54311,7 +54545,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -54324,6 +54558,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -54560,6 +54795,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -54775,7 +55011,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo /* Assert that the caller has opened the required transaction. */ if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { iTable = uint32(0) @@ -54804,6 +55040,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -55166,7 +55403,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ pBufStart = pBuf /* Start of original out buffer */ if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _getCellInfo(tls, pCur) aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload @@ -55176,7 +55413,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -55228,7 +55465,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) if offset >= ovflSize { @@ -55302,7 +55539,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -55437,7 +55674,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { var v3, p1 uintptr _, _, _, _ = rc, v2, v3, p1 if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -55449,7 +55686,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -55565,9 +55802,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** in such a way that page pRoot is linked into a second b-tree table ** (or the freelist). */ if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -55577,7 +55815,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -55811,7 +56049,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -55855,6 +56093,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -55869,6 +56108,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -55943,6 +56183,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -56010,7 +56251,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -56025,6 +56266,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -56071,7 +56313,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -56102,7 +56344,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -56135,7 +56377,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -56144,7 +56386,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -56159,6 +56401,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -56209,6 +56452,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -56270,7 +56514,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -56380,7 +56624,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -56468,7 +56712,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -56523,7 +56767,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -56549,7 +56793,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -56576,7 +56820,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -56621,6 +56865,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -56637,6 +56882,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -56645,7 +56891,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -56746,6 +56992,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } } end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) return rc @@ -56781,7 +57028,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in iTrunk = uint32(0) /* Page number of free-list trunk page */ pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -56832,7 +57079,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -56841,7 +57088,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in } nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -56897,6 +57144,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -56929,7 +57177,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -56947,7 +57195,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -56970,7 +57218,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -57055,6 +57303,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n libc.X__builtin___memcpy_chk(tls, pPayload, pSrc, uint64(nSrc), libc.X__builtin_object_size(tls, pPayload, 0)) @@ -57190,7 +57439,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -57574,6 +57823,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -57583,12 +57833,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -57596,7 +57846,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.X__builtin___memmove_chk(tls, pData, pCell, uint64(sz), libc.X__builtin_object_size(tls, pData, 0)) i++ @@ -57670,6 +57920,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -57690,7 +57941,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr ** database. But they might for a corrupt database. Hence use memmove() ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.X__builtin___memmove_chk(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz), libc.X__builtin_object_size(tls, pSlot, 0)) @@ -57761,6 +58012,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -57773,6 +58025,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -57788,6 +58041,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -57798,6 +58052,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -57834,7 +58089,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.X__builtin___memmove_chk(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2)), libc.X__builtin_object_size(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, 0)) nCell -= nShift @@ -57885,6 +58140,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -57900,9 +58156,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -57947,7 +58204,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _, _, _, _, _, _, _ = pBt, pOut, pStop, v1, v2, v3, v4 pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt /* Page number of pNew */ if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ /* Allocate a new page. This page will become the right-sibling of ** pPage. Make the parent page writable, so that the new divider cell @@ -58308,7 +58565,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -58331,7 +58588,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.X__builtin___memset_chk(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow)), libc.X__builtin_object_size(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0)) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -58345,6 +58602,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -58357,6 +58615,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } @@ -58393,6 +58652,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -58439,11 +58699,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -58457,7 +58719,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -58500,12 +58762,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -58558,11 +58821,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -58589,7 +58853,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -58618,6 +58882,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -58640,6 +58905,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno goto _19 _19: + ; i++ } i = 0 @@ -58658,6 +58924,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -58679,6 +58946,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) @@ -58760,6 +59028,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -58809,11 +59078,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -58822,6 +59092,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -58889,6 +59160,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -58925,6 +59197,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -58939,12 +59212,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -58954,6 +59229,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -58964,6 +59240,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -59051,10 +59328,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -59123,7 +59401,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -59212,6 +59490,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -59281,7 +59560,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -59312,7 +59591,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -59397,7 +59676,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -59489,7 +59768,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -59503,6 +59782,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -59524,7 +59804,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -59554,10 +59834,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.X__builtin___memcpy_chk(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8))), libc.X__builtin_object_size(tls, oldCell, 0)) return SQLITE_OK @@ -59573,7 +59853,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { } } @@ -59600,7 +59880,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s */ if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -59623,6 +59903,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -59673,7 +59954,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -59695,7 +59976,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -59795,21 +60076,21 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&(int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx))))< _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -60054,7 +60335,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -60135,14 +60416,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int var _ /* rc at bp+8 */ int32 _, _, _, _ = hdr, i, pCell, v2 if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -60169,6 +60450,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -60193,6 +60475,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -60276,7 +60559,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -60541,7 +60824,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4526, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4551, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -60589,11 +60872,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4528, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4553, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4551, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4576, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -60619,11 +60902,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4681, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4706, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -60675,6 +60958,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -60694,11 +60978,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4720 + v2 = __ccgo_ts + 4745 } else { - v2 = __ccgo_ts + 4725 + v2 = __ccgo_ts + 4750 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4746, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4771, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -60834,12 +61118,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4772 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4797 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4790, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4815, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4944, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4969, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4974, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4999, 0) doCoverageCheck = 0 goto _4 } @@ -60921,7 +61205,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4998, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5023, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -60944,7 +61228,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5022, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5047, 0) depth = d2 } } else { @@ -60953,6 +61237,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -60976,6 +61261,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5047, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5072, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -61033,10 +61319,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5084, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5109, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -61122,7 +61409,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 5136 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 5161 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -61141,15 +61428,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+5147, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+5172, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+5192, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+5217, 0) } } } @@ -61169,6 +61457,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -64138,16 +64443,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -64185,6 +64491,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -64571,10 +64878,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -64730,6 +65039,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -64853,6 +65163,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -64948,6 +65259,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -65049,6 +65361,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -65448,7 +65761,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5404, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5429, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -65461,38 +65774,39 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1650 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5409) == 0 { - zColl = __ccgo_ts + 5416 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5434) == 0 { + zColl = __ccgo_ts + 5441 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5397 + v3 = __ccgo_ts + 5422 } else { v3 = __ccgo_ts + 1650 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5418 + v4 = __ccgo_ts + 5443 } else { v4 = __ccgo_ts + 1650 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5421, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5446, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5445, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5470, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5454, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5454, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1406, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5461, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5486, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1373, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -65509,14 +65823,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { zP4 = __ccgo_ts + 1651 } else { - zP4 = __ccgo_ts + 5464 + zP4 = __ccgo_ts + 5489 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5471, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5496, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -65531,14 +65845,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5504, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5484, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5509, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5486 + zP4 = __ccgo_ts + 5511 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -65554,10 +65869,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5431, - 1: __ccgo_ts + 5433, - 2: __ccgo_ts + 5435, - 3: __ccgo_ts + 5440, + 0: __ccgo_ts + 5456, + 1: __ccgo_ts + 5458, + 2: __ccgo_ts + 5460, + 3: __ccgo_ts + 5465, } // C documentation @@ -65620,6 +65935,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -65646,6 +65962,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -65685,6 +66002,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -65717,6 +66035,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -65750,6 +66069,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -65816,6 +66136,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -65843,6 +66164,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -65864,6 +66186,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -65919,6 +66242,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -66250,6 +66574,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -66302,6 +66627,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -66429,6 +66755,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -66462,6 +66789,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -66480,6 +66808,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -66494,7 +66823,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5494, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5519, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -66502,18 +66831,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5506, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5531, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5520, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5545, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5535, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5560, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) @@ -66554,6 +66883,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -66590,6 +66920,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -66626,6 +66957,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -66692,6 +67024,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -66740,7 +67073,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -68048,7 +68402,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -68081,16 +68435,21 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -68113,7 +68472,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -68148,7 +68507,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -68173,7 +68532,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } } } } @@ -68199,7 +68561,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -68240,18 +68602,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -68478,8 +68841,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -68510,7 +68874,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -68574,6 +68938,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -68660,15 +69025,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5578 + zContext = __ccgo_ts + 5603 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5597 + zContext = __ccgo_ts + 5622 } else { - zContext = __ccgo_ts + 5616 + zContext = __ccgo_ts + 5641 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5625, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5650, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -68721,6 +69086,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -68785,6 +69151,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -68840,7 +69207,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5661, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5686, 0) return int32(1) } else { return 0 @@ -68850,7 +69217,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5706, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5731, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -68908,7 +69275,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -68975,6 +69342,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { @@ -69410,7 +69778,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5746, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5771, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -69466,6 +69834,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -69489,6 +69858,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -69585,6 +69955,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask @@ -69606,7 +69977,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -69736,7 +70107,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -69899,6 +70270,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -69934,6 +70306,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -69957,6 +70330,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -70192,18 +70566,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5769, - 1: __ccgo_ts + 5774, - 2: __ccgo_ts + 5781, - 3: __ccgo_ts + 5784, - 4: __ccgo_ts + 5787, - 5: __ccgo_ts + 5790, - 6: __ccgo_ts + 5793, - 7: __ccgo_ts + 5796, - 8: __ccgo_ts + 5804, - 9: __ccgo_ts + 5807, - 10: __ccgo_ts + 5814, - 11: __ccgo_ts + 5822, + 0: __ccgo_ts + 5794, + 1: __ccgo_ts + 5799, + 2: __ccgo_ts + 5806, + 3: __ccgo_ts + 5809, + 4: __ccgo_ts + 5812, + 5: __ccgo_ts + 5815, + 6: __ccgo_ts + 5818, + 7: __ccgo_ts + 5821, + 8: __ccgo_ts + 5829, + 9: __ccgo_ts + 5832, + 10: __ccgo_ts + 5839, + 11: __ccgo_ts + 5847, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -70338,6 +70712,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -70445,14 +70820,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5829, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5854, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -70740,6 +71115,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -71015,7 +71391,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -71062,6 +71438,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -71143,7 +71520,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -71210,6 +71587,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -71315,7 +71693,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5869, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5894, int32(3)) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } } else { @@ -71353,7 +71731,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1406, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5390, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5415, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -71368,27 +71746,28 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5873, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5898, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5880, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5905, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5893, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5918, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5896, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5921, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5901, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5926, int32(1)) } } } @@ -71891,6 +72270,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -71999,19 +72379,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity int8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -72058,7 +72438,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -72528,8 +72908,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -72542,6 +72924,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadPInt32(db+432) != 0 { goto abort_due_to_interrupt } @@ -72565,7 +72948,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) *(*Ti64)(unsafe.Pointer(pIn1)) = int64(int32((int64(pOp) - int64(aOp)) / 24)) @@ -72592,7 +72976,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -72614,7 +72999,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp3 - int32(1)) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) @@ -72624,7 +73010,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: - ; /* There are never any jumps to instruction 0 */ + ; + /* There are never any jumps to instruction 0 */ /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 goto _187 @@ -72637,6 +73024,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pCaller = aOp + uintptr(*(*Ti64)(unsafe.Pointer(pIn1)))*24 pOp = aOp + uintptr((*TVdbeOp)(unsafe.Pointer(pCaller)).Fp2-int32(1))*24 @@ -72656,6 +73044,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) pcDest = int32(*(*Ti64)(unsafe.Pointer(pIn1))) @@ -72670,7 +73059,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -72707,6 +73097,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -72734,15 +73125,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8((*TOp)(unsafe.Pointer(pOp)).Fp2) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5937, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5962, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5958, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5983, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = int32((int64(pOp) - int64(aOp)) / 24) - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5965, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5990, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) if rc == int32(SQLITE_BUSY) { @@ -72761,7 +73152,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -72771,7 +73163,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) goto _187 @@ -72781,7 +73174,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) *(*float64)(unsafe.Pointer(pOut)) = *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -72794,7 +73188,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) if int32(encoding) != int32(SQLITE_UTF8) { @@ -72832,7 +73227,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) (*TMem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -72874,7 +73270,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { @@ -72903,6 +73301,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) goto _187 @@ -72913,7 +73312,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { _sqlite3VdbeMemSetZeroBlob(tls, pOut, (*TOp)(unsafe.Pointer(pOp)).Fp1) @@ -72933,7 +73333,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 if _sqlite3VdbeMemTooBig(tls, pVar) != 0 { goto too_big @@ -72957,7 +73358,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -72972,6 +73374,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 56 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -72993,6 +73396,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -73027,7 +73431,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) @@ -73040,7 +73445,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetInt64(tls, pOut, *(*Ti64)(unsafe.Pointer(pIn1))) @@ -73057,6 +73463,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -73073,6 +73480,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + uint32(2) | uint32(1) (*TVdbe)(unsafe.Pointer(p)).FpResultRow = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -73097,7 +73505,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -73195,11 +73604,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -73209,6 +73623,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -73246,18 +73661,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -73291,9 +73709,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -73312,6 +73733,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) } @@ -73346,10 +73768,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -73411,7 +73837,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -73423,7 +73850,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) @@ -73447,7 +73875,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -73468,7 +73897,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) @@ -73576,12 +74006,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -73652,16 +74088,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -73702,7 +74148,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ if iCompare == 0 { goto jump_to_p2 } @@ -73719,6 +74166,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; goto _187 /* Opcode: Compare P1 P2 P3 P4 P5 ** Synopsis: r[P1@P3] <-> r[P2@P3] @@ -73742,7 +74190,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -73758,11 +74207,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) @@ -73775,8 +74224,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } goto _187 @@ -73788,7 +74238,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ if iCompare < 0 { pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 } else { @@ -73819,8 +74270,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -73856,7 +74309,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) goto _187 /* Opcode: Not P1 P2 * * * @@ -73866,7 +74320,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -73882,7 +74337,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -73908,14 +74364,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -73930,6 +74387,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -73942,6 +74400,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -73952,7 +74411,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -73990,6 +74450,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { @@ -74020,7 +74481,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -74032,7 +74494,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -74049,6 +74512,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) @@ -74070,7 +74534,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { @@ -74111,10 +74576,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { @@ -74122,9 +74589,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* For the special case of as pseudo-cursor, the seekResult field ** identifies the register that holds the record */ pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -74134,11 +74601,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -74161,9 +74628,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -74219,13 +74686,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -74240,16 +74707,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -74258,8 +74726,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -74282,10 +74750,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -74299,10 +74769,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -74318,9 +74790,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -74341,9 +74813,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -74372,13 +74844,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -74408,6 +74882,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -74418,11 +74893,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) @@ -74449,16 +74924,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -74471,13 +74946,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5989, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+6014, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -74546,7 +75024,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -74563,8 +75042,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) pData0 = aMem + uintptr(nField)*56 @@ -74579,10 +75058,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 @@ -74669,10 +75148,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -74751,16 +75230,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -74772,9 +75251,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -74816,9 +75295,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { libc.X__builtin___memcpy_chk(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn), libc.X__builtin_object_size(tls, zPayload, 0)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) @@ -74848,6 +75327,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) @@ -74869,6 +75349,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -74879,7 +75360,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6030, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6055, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -74921,19 +75402,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+6081, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6106, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6103, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6128, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -74942,18 +75424,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -74975,8 +75457,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -74991,8 +75474,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -75053,6 +75537,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 /* At least this one VM is active */ @@ -75065,13 +75550,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6157, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6182, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -75081,9 +75566,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -75095,16 +75580,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 6212 + v250 = __ccgo_ts + 6237 } else { if iRollback != 0 { - v249 = __ccgo_ts + 6260 + v251 = __ccgo_ts + 6285 } else { - v249 = __ccgo_ts + 6303 + v251 = __ccgo_ts + 6328 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -75144,6 +75629,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 104)) = 0 if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(libc.Uint64FromInt32(SQLITE_QueryOnly)|uint64(libc.Int32FromInt32(0x00002))<>0)) == int32(1) { rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)< 0 { /* Make register reg[P3] into a value that can be used as the data ** form sqlite3BtreeInsert() where the length of the data is zero. */ @@ -75524,11 +76019,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) @@ -75562,6 +76057,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) if pCx2 == uintptr(0) { goto no_mem @@ -75580,11 +76076,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -75605,6 +76102,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) if pCx3 == uintptr(0) { goto no_mem @@ -75623,7 +76121,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) goto _187 @@ -75717,10 +76216,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) eqOnly = 0 @@ -75799,11 +76302,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) @@ -75849,6 +76352,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 } else { @@ -75926,6 +76430,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first ** opcode past the OP_SeekGE itself. */ @@ -75939,29 +76444,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -75974,8 +76482,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -75992,6 +76501,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -76008,6 +76518,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { goto jump_to_p2_and_check_for_interrupt @@ -76104,14 +76615,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } /* Fall through into OP_NotFound */ - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) @@ -76123,11 +76638,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { /* Composite key generated by OP_MakeRecord */ if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 if rc != 0 { goto no_mem } @@ -76167,8 +76682,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -76225,6 +76741,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -76247,10 +76764,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto notExistsWithKey } /* Fall through into OP_NotExists */ - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) *(*int32)(unsafe.Pointer(bp + 248)) = 0 @@ -76262,7 +76781,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -76279,12 +76798,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -76301,7 +76821,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -76347,8 +76868,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -76380,15 +76902,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -76442,7 +76965,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -76476,11 +77000,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -76497,11 +77021,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if pTab1 != 0 { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -76515,15 +77039,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -76570,6 +77095,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) /* If the update-hook or pre-update-hook will be invoked, set zDb to @@ -76590,11 +77116,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Invoke the pre-update-hook if required. */ if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -76623,6 +77149,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -76642,6 +77169,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -76667,6 +77195,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) @@ -76704,6 +77233,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) @@ -76740,6 +77270,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { @@ -76782,6 +77313,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { /* If the cursor is not already open, create a special kind of @@ -76823,8 +77355,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) *(*int32)(unsafe.Pointer(bp + 392)) = 0 @@ -76853,6 +77387,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) @@ -76890,8 +77425,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Fall through into OP_Rewind */ /* Opcode: Rewind P1 P2 * * * @@ -76910,6 +77447,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { @@ -76985,17 +77523,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -77037,17 +77579,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ } if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -77056,11 +77599,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { goto abort_due_to_error @@ -77074,14 +77617,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -77106,6 +77650,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo @@ -77123,7 +77668,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -77319,6 +77871,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { @@ -77359,6 +77912,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -77380,6 +77934,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) @@ -77400,6 +77955,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 @@ -77416,6 +77972,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -77447,6 +78004,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -77459,13 +78017,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6389 + zSchema = __ccgo_ts + 6414 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6403, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6428, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -77480,7 +78038,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -77501,6 +78059,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { goto abort_due_to_error @@ -77515,6 +78074,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -77526,6 +78086,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -77537,6 +78098,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -77558,7 +78120,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -77585,7 +78148,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { @@ -77604,6 +78168,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { /* The boolean index is empty */ @@ -77638,6 +78203,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -77674,7 +78240,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 /* If the p5 flag is clear, then recursive invocation of triggers is @@ -77695,8 +78262,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -77705,7 +78273,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6446, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6471, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -77751,8 +78319,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { @@ -77767,17 +78336,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.X__builtin___memset_chk(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8)), libc.X__builtin_object_size(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0)) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -77794,6 +78363,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -77808,6 +78378,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -77830,7 +78401,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -77853,14 +78425,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -77884,7 +78458,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) @@ -77910,18 +78485,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -77942,7 +78518,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -77957,7 +78534,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6483 + v286 = __ccgo_ts + 6508 } else { - v284 = __ccgo_ts + 6488 + v286 = __ccgo_ts + 6513 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6495, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6520, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -78214,11 +78801,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -78245,12 +78832,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -78262,6 +78850,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt rc = _sqlite3BtreeIncrVacuum(tls, pBt2) if rc != 0 { @@ -78289,6 +78878,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -78301,6 +78891,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) goto _187 @@ -78310,6 +78901,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) goto _187 @@ -78329,6 +78921,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6586, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6611, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -78994,8 +79612,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -79014,7 +79633,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ goto _187 /***************************************************************************** ** The cases of the switch statement above this line should all be indented @@ -79023,6 +79643,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -79030,17 +79651,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -79083,12 +79707,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5746, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5771, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1620, 0) rc = int32(SQLITE_NOMEM) @@ -79097,16 +79723,17 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error return r } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5903, - 1: __ccgo_ts + 5912, - 2: __ccgo_ts + 5919, - 3: __ccgo_ts + 5925, + 0: __ccgo_ts + 5928, + 1: __ccgo_ts + 5937, + 2: __ccgo_ts + 5944, + 3: __ccgo_ts + 5950, } var _and_logic = [9]uint8{ @@ -79260,13 +79887,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1636 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6624 + v3 = __ccgo_ts + 6649 } else { - v3 = __ccgo_ts + 6629 + v3 = __ccgo_ts + 6654 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6637, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6662, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -79284,7 +79911,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6666, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6691, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -79327,15 +79954,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6686, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6711, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6716, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6741, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6752, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6777, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -79360,11 +79987,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6773, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6798, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -79390,14 +80018,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6794 + zFault = __ccgo_ts + 6819 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -79413,19 +80043,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6806 + zFault = __ccgo_ts + 6831 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6814, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6839, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -79486,6 +80118,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -79585,7 +80218,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -79684,7 +80317,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -80684,6 +81317,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -80803,6 +81437,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -80862,6 +81497,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -80951,6 +81587,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -81006,6 +81643,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -81061,6 +81699,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -81266,6 +81905,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -81288,6 +81928,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -81440,6 +82081,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -81517,6 +82159,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -81583,6 +82226,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -81988,6 +82632,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -81998,6 +82643,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -82176,6 +82822,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -82240,6 +82887,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -82263,6 +82911,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -82344,6 +82993,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -82359,6 +83009,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -82400,6 +83051,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -82431,6 +83083,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -82451,6 +83104,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -82657,6 +83311,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -82822,6 +83477,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -82842,6 +83498,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -82877,6 +83534,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -82914,6 +83572,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -83024,6 +83683,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -83234,6 +83894,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -83332,6 +83993,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -83426,6 +84088,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -83609,6 +84272,9 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE var _ /* temp at bp+0 */ TExpr _, _, _ = db, pDup, pOrig /* The database connection */ pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -83666,6 +84332,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -83679,6 +84346,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -83779,25 +84447,25 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { var zLegacy uintptr _ = zLegacy - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6848, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6873, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6856+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6875+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6881+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6900+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6389+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6414+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6894+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6919+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6894+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6919+7) == 0 { return int32(1) } } @@ -83880,9 +84548,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6908, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6933, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -83963,6 +84632,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -83974,7 +84644,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6913) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6938) != 0 { goto _2 } } @@ -84044,15 +84714,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } @@ -84080,11 +84761,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6915, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6940, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6919, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6944, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -84093,7 +84774,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6923, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6948, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -84116,6 +84797,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -84172,8 +84854,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -84208,15 +84890,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6932, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6957, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6963, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6988, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -84229,6 +84911,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -84267,7 +84950,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+7018, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+7043, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.X__builtin___memset_chk(tls, pExpr+64, 0, uint64(8), libc.X__builtin_object_size(tls, pExpr+64, 0)) return int32(WRC_Prune) @@ -84296,7 +84979,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7053 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7078 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -84306,18 +84989,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 7062 + v10 = __ccgo_ts + 7087 } else { - v10 = __ccgo_ts + 7077 + v10 = __ccgo_ts + 7102 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7099, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7124, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7112, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7137, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7122, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7147, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -84352,6 +85035,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) @@ -84439,19 +85123,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 7129 + zIn = __ccgo_ts + 7154 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 7157 + zIn = __ccgo_ts + 7182 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 7175 + zIn = __ccgo_ts + 7200 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 7193 + zIn = __ccgo_ts + 7218 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7211, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7236, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -84497,10 +85181,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { @@ -84531,6 +85215,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -84545,29 +85242,51 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -84588,7 +85307,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } else { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7231, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7256, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -84612,22 +85331,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) if pDef == uintptr(0) { @@ -84644,7 +85363,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7248, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7273, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -84658,17 +85377,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7312, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7337, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -84689,7 +85408,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7348, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7373, uintptr(0), pExpr) } } else { /* Must fit in 8 bits */ @@ -84713,29 +85432,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7376, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7401, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7419 + zType = __ccgo_ts + 7444 } else { - zType = __ccgo_ts + 7426 + zType = __ccgo_ts + 7451 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7436, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7461, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7464, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7489, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7486, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7511, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7530, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7555, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -84752,11 +85471,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -84772,11 +85491,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -84795,15 +85514,15 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -84820,7 +85539,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7578, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7603, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } @@ -84831,7 +85550,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } case int32(TK_VARIABLE): if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7589, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7614, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -84877,17 +85596,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -84921,6 +85640,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -84986,6 +85706,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -85000,7 +85721,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7600, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7625, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -85035,7 +85756,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7656, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7681, 0) return int32(1) } i = 0 @@ -85046,6 +85767,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -85072,7 +85794,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7690, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7715, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -85130,6 +85852,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -85141,11 +85864,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7696, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7721, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -85174,7 +85898,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7757, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7782, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -85203,6 +85927,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -85336,10 +86061,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -85445,6 +86172,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -85482,16 +86210,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7788, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7813, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -85504,6 +86234,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -85517,6 +86248,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -85545,7 +86277,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7690) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7715) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -85556,7 +86288,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7827) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7852) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -85566,11 +86298,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7858, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -85728,6 +86461,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -85949,6 +86683,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -86018,7 +86753,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -86091,6 +86830,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -86539,7 +87279,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) return } if int32(op) == int32(TK_LE) { @@ -86593,6 +87333,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -86617,7 +87358,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7892, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7917, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -86654,6 +87395,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -86675,6 +87417,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -86959,11 +87702,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7940 + v2 = __ccgo_ts + 7965 } else { v2 = __ccgo_ts + 1650 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7942, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7967, libc.VaList(bp+8, nExprElem, v2, nElem)) break } pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) @@ -86977,6 +87720,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -87039,7 +87783,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u } *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7986, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8011, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -87059,7 +87803,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8020, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8045, libc.VaList(bp+8, p)) } // C documentation @@ -87130,7 +87874,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8070, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8095, libc.VaList(bp+8, pExpr)) } } } @@ -87182,7 +87926,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8090, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8115, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -87215,7 +87959,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8133, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8158, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -87600,6 +88344,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -87728,6 +88473,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -87805,6 +88551,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -87834,6 +88581,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -87893,6 +88641,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -88048,7 +88797,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8156, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8181, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -88067,6 +88816,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -88080,6 +88830,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -88174,7 +88925,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8186, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8211, libc.VaList(bp+8, zObject)) } } @@ -88197,6 +88948,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -88239,6 +88991,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -88270,10 +89023,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8209) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8234) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8214) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8239) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -88589,6 +89342,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -88621,6 +89375,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -88828,13 +89583,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+8220) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8245) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+8228) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8253) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+8234) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8259) == 0 { return int32(1) } return 0 @@ -88852,9 +89607,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 8220, - 1: __ccgo_ts + 8228, - 2: __ccgo_ts + 8234, + 0: __ccgo_ts + 8245, + 1: __ccgo_ts + 8253, + 2: __ccgo_ts + 8259, } ii = 0 for { @@ -88871,6 +89626,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -88878,6 +89634,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -88942,6 +89699,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -89101,6 +89859,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -89132,7 +89891,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8238, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8263, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -89161,6 +89920,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -89209,6 +89969,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -89224,12 +89985,13 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8546, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8571, libc.VaList(bp+160, pExpr)) } else { return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -90833,7 +91612,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8573, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8598, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -90856,6 +91635,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -90937,7 +91717,7 @@ expr_code_doover: } n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8156, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8181, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -90999,7 +91779,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -91057,7 +91837,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -91101,6 +91881,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -91113,7 +91894,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, endLabel) case int32(TK_RAISE): if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8597, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8622, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -91174,6 +91955,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -91390,6 +92172,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -91535,7 +92318,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -91552,9 +92337,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -91574,7 +92361,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -91583,11 +92372,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -91596,15 +92391,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -91617,7 +92416,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -91630,6 +92431,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -91722,7 +92524,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -91739,9 +92543,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -91763,7 +92569,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -91772,11 +92580,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -91785,15 +92599,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -91803,7 +92621,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -91816,6 +92636,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -92053,6 +92874,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -92268,6 +93090,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -92469,6 +93298,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -92520,6 +93350,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -92529,6 +93360,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -92703,6 +93535,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } @@ -92733,6 +93566,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -92744,6 +93578,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) @@ -92792,6 +93627,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -92810,6 +93646,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -92857,6 +93694,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -92881,6 +93719,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -92983,6 +93822,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -93116,6 +93956,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -93166,8 +94007,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8647, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8672, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -93186,9 +94027,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8675, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8700, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8850, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8875, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -93204,9 +94045,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9024, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9049, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9171, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9196, 0) } } @@ -93262,7 +94103,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9322, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9347, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -93271,11 +94112,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9381, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9406, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9387, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9412, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -93305,21 +94146,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9414, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9439, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9598, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9623, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9903, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9919, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9928, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9944, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9977, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10002, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -93335,8 +94176,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+10242, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+10267, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -93350,7 +94192,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10255, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10280, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -93390,11 +94232,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10293, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10318, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10325, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10350, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -93410,10 +94252,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10352) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10377) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10411) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10436) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -93425,13 +94267,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10464) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10489) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10510) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10535) } } /* Modify the CREATE TABLE statement. */ @@ -93445,7 +94287,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10537, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10562, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -93473,7 +94315,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10683, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10708, libc.VaList(bp+16, zTab, zDb)) } } } @@ -93511,12 +94353,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11036, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11061, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11070, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11095, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -93540,7 +94382,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+11100, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+11125, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { goto exit_begin_add_column } @@ -93555,6 +94397,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } (*(*struct { @@ -93577,6 +94420,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { FpDfltList uintptr })(unsafe.Pointer(pTab + 64))).FaddColOffset exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -93598,18 +94442,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 11119 + zType = __ccgo_ts + 11144 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 11124 + zType = __ccgo_ts + 11149 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 11138 + v1 = __ccgo_ts + 11163 } else { - v1 = __ccgo_ts + 11155 + v1 = __ccgo_ts + 11180 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11173, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11198, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -93666,10 +94510,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11191, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11216, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -93685,12 +94530,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld goto exit_rename_column } bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11212, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11394, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11237, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11419, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+10242, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+10267, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -93798,6 +94644,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -93862,6 +94709,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -93886,6 +94734,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -93918,6 +94767,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -93936,6 +94786,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -93991,6 +94842,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -94013,6 +94865,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -94051,6 +94904,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -94121,6 +94975,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -94130,6 +94985,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -94153,11 +95009,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11525 + v1 = __ccgo_ts + 11550 } else { v1 = __ccgo_ts + 1650 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11527, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11552, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -94186,6 +95042,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -94214,6 +95071,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -94232,8 +95090,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11550, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11575, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -94249,7 +95107,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -94288,7 +95146,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11558, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11583, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -94333,11 +95191,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 _sqlite3Dequote(tls, zBuf1) if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11525 + v1 = __ccgo_ts + 11550 } else { v1 = __ccgo_ts + 1650 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11564, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11589, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -94376,6 +95234,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -94467,6 +95326,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -94506,6 +95366,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -94548,11 +95409,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -94711,6 +95574,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -94721,6 +95585,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -94732,6 +95597,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } @@ -94757,10 +95623,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -94792,6 +95660,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -94804,6 +95673,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -94864,6 +95734,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -94962,6 +95833,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -95011,11 +95883,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -95135,6 +96009,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -95292,7 +96167,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -95309,10 +96184,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11569, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11594, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -95361,23 +96237,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11191, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11216, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11576 + v1 = __ccgo_ts + 11601 } else { - v1 = __ccgo_ts + 5912 + v1 = __ccgo_ts + 5937 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11588, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11613, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11616, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11641, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -95389,10 +96265,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1650, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11664, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11689, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11785, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11810, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -95422,6 +96298,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -95455,6 +96332,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -95474,6 +96352,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -95491,27 +96370,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11803, + FzName: __ccgo_ts + 11828, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11824, + FzName: __ccgo_ts + 11849, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11844, + FzName: __ccgo_ts + 11869, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11863, + FzName: __ccgo_ts + 11888, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11882, + FzName: __ccgo_ts + 11907, }, } @@ -95722,7 +96601,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11985, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12010, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -95733,10 +96612,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12008, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12033, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12038, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12063, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -95745,6 +96624,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -95757,6 +96637,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -95766,15 +96647,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11905, - FzCols: __ccgo_ts + 11918, + FzName: __ccgo_ts + 11930, + FzCols: __ccgo_ts + 11943, }, 1: { - FzName: __ccgo_ts + 11931, - FzCols: __ccgo_ts + 11944, + FzName: __ccgo_ts + 11956, + FzCols: __ccgo_ts + 11969, }, 2: { - FzName: __ccgo_ts + 11972, + FzName: __ccgo_ts + 11997, }, } @@ -95943,6 +96824,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -95953,6 +96835,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -96049,6 +96932,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } i = 0 @@ -96059,6 +96943,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -96072,7 +96957,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12056, + FzName: __ccgo_ts + 12081, } func init() { @@ -96110,6 +96995,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -96184,6 +97070,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -96217,6 +97104,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.X__builtin___memset_chk(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero), libc.X__builtin_object_size(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -96232,6 +97120,7 @@ find_new_min: } goto _2 _2: + ; i++ } (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin @@ -96264,6 +97153,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -96280,10 +97170,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -96303,10 +97195,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -96355,6 +97249,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -96372,6 +97267,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -96386,6 +97282,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -96419,6 +97316,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -96432,7 +97330,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12066, + FzName: __ccgo_ts + 12091, } func init() { @@ -96482,7 +97380,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12076, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12101, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -96493,9 +97391,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12081, libc.VaList(bp+72, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12106, libc.VaList(bp+72, iVal)) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -96531,9 +97430,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+12087, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+12112, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -96548,7 +97448,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12093, + FzName: __ccgo_ts + 12118, } func init() { @@ -96614,7 +97514,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+12102, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+12127, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -96628,7 +97528,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.X__builtin___memcpy_chk(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11905, uint64(13), libc.X__builtin_object_size(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, 0)) + libc.X__builtin___memcpy_chk(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11930, uint64(13), libc.X__builtin_object_size(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, 0)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -96782,6 +97682,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -96803,6 +97704,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -96830,6 +97732,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -96850,7 +97753,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12112, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12137, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -96887,6 +97790,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -96909,6 +97813,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -96922,6 +97827,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -96931,7 +97837,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12112, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12137, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -96982,6 +97888,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -97002,9 +97909,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+12116) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+12141) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+12120) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+12145) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -97051,6 +97958,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -97160,23 +98068,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+12124, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12149, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+12135, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12160, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+12145, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12170, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -97287,6 +98196,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -97354,6 +98264,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -97365,6 +98276,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -97468,6 +98380,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } } @@ -97548,11 +98461,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11931, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11956, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+12157, __ccgo_ts+12226, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+12182, __ccgo_ts+12251, zDb) } return rc } @@ -97598,6 +98511,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -97611,15 +98525,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11905, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11930, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+12278, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+12303, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -97639,6 +98554,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -97664,6 +98580,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -97730,7 +98647,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6908, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6933, zName) == 0) } // C documentation @@ -97786,7 +98703,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12319, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12344, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -97817,7 +98734,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12322, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12347, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -97826,11 +98743,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { break } if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12359, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12384, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -97873,7 +98791,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12389, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12414, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -97881,7 +98799,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12418, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12443, 0) rc = int32(SQLITE_ERROR) } } @@ -97928,7 +98846,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1620, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 24)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12486, libc.VaList(bp+56, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12511, libc.VaList(bp+56, zFile)) } } } @@ -97936,6 +98854,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 24)), -int32(1)) @@ -97984,18 +98903,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12514, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12539, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12535, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12560, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12561, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12586, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -98014,6 +98934,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -98067,6 +98988,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -98086,7 +99008,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12583, + FzName: __ccgo_ts + 12608, } func init() { @@ -98108,7 +99030,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12597, + FzName: __ccgo_ts + 12622, } func init() { @@ -98134,7 +99056,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12611, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12636, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -98168,7 +99090,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12635, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12660, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -98183,6 +99105,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -98197,6 +99120,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -98284,6 +99208,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -98381,7 +99306,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12681, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12706, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -98409,11 +99334,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12704, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12729, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12710, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12735, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12716, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12741, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -98459,6 +99384,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -98472,7 +99398,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 8228 + zCol = __ccgo_ts + 8253 } } if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -98507,7 +99433,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12743, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12768, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -98619,6 +99545,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -98669,6 +99596,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -98734,6 +99662,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -98762,6 +99691,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -98777,6 +99707,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -98805,6 +99736,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*32))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*32 + 24))) goto _5 _5: + ; i++ } } @@ -98916,26 +99848,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6908) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6933) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6875+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6389+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6856) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6900+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6414+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6881) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6389) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6414) } } } @@ -98962,14 +99895,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6389) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6414) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6875+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6856) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6900+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6881) } } } @@ -99007,7 +99941,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12758, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12783, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -99025,15 +99959,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12766 + v1 = __ccgo_ts + 12791 } else { - v1 = __ccgo_ts + 12779 + v1 = __ccgo_ts + 12804 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7112, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7137, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7122, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7147, libc.VaList(bp+8, zMsg, zName)) } } else { } @@ -99071,12 +100005,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6389+7) == 0 { - return __ccgo_ts + 6894 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6414+7) == 0 { + return __ccgo_ts + 6919 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6856+7) == 0 { - return __ccgo_ts + 6875 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6881+7) == 0 { + return __ccgo_ts + 6900 } } return zName @@ -99123,6 +100057,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -99210,6 +100145,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -99249,6 +100185,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -99281,6 +100218,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -99436,6 +100374,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -99495,6 +100434,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -99595,7 +100535,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6389) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6414) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -99627,11 +100567,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6908, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6933, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -99684,13 +100625,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12793, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12818, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12810, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12835, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -99738,8 +100679,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12830, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12855, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -99761,6 +100702,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -99787,6 +100729,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -99819,6 +100762,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -99881,6 +100825,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -99950,9 +100895,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -99965,7 +100910,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12872, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12897, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -99981,9 +100926,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 11119 + v2 = __ccgo_ts + 11144 } else { - v2 = __ccgo_ts + 9381 + v2 = __ccgo_ts + 9406 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -99993,9 +100938,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui } zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6856 + v3 = __ccgo_ts + 6881 } else { - v3 = __ccgo_ts + 6389 + v3 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -100019,11 +100964,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 11119 + v4 = __ccgo_ts + 11144 } else { - v4 = __ccgo_ts + 9381 + v4 = __ccgo_ts + 9406 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12913, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12938, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -100031,7 +100976,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12934, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12959, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -100120,6 +101065,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -100181,7 +101127,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12969, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12994, 0) } else { } (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) @@ -100197,7 +101143,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+13003, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+13028, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -100244,7 +101190,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13023, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13048, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -100254,12 +101200,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+13046, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+13071, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+13053, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+13078, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -100287,6 +101233,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -100307,12 +101254,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13063, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13088, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -100376,6 +101324,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -100513,10 +101462,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13089, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13114, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13134, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13159, 0) } else { libc.X__builtin___memset_chk(tls, bp, 0, uint64(72), libc.X__builtin_object_size(tls, bp, 0)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -100574,7 +101523,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13200, 0) } } @@ -100611,7 +101560,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13227, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13252, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) @@ -100643,11 +101592,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -100665,13 +101616,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13268, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13293, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -100701,6 +101653,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1)))))])&int32(0x01) != 0 { @@ -100752,6 +101705,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -100777,17 +101731,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13324, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13349, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13367, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13392, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13375, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13400, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -100817,8 +101771,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13382, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13407, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -100874,6 +101830,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -100911,6 +101868,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -100934,6 +101892,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -100969,18 +101928,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1650 - zSep2 = __ccgo_ts + 13413 - zEnd = __ccgo_ts + 5429 + zSep2 = __ccgo_ts + 13438 + zEnd = __ccgo_ts + 5454 } else { - zSep = __ccgo_ts + 13415 - zSep2 = __ccgo_ts + 13419 - zEnd = __ccgo_ts + 13424 + zSep = __ccgo_ts + 13440 + zSep2 = __ccgo_ts + 13444 + zEnd = __ccgo_ts + 13449 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -100988,7 +101948,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13427, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13452, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -101010,6 +101970,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(bp)) += len1 goto _3 _3: + ; i++ pCol += 16 } @@ -101019,11 +101980,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1650, - 1: __ccgo_ts + 13441, - 2: __ccgo_ts + 13447, - 3: __ccgo_ts + 13452, - 4: __ccgo_ts + 13457, - 5: __ccgo_ts + 13447, + 1: __ccgo_ts + 13466, + 2: __ccgo_ts + 13472, + 3: __ccgo_ts + 13477, + 4: __ccgo_ts + 13482, + 5: __ccgo_ts + 13472, } // C documentation @@ -101080,6 +102041,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -101116,6 +102078,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -101175,6 +102138,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -101221,6 +102185,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -101276,6 +102241,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -101332,6 +102298,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -101375,6 +102342,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -101402,10 +102370,12 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -101421,6 +102391,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -101439,6 +102410,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _recomputeColumnsNotIndexed(tls, pPk) @@ -101528,6 +102500,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -101640,9 +102613,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13463, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13488, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13496, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13521, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -101656,17 +102629,18 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13523, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13548, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13573, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13598, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -101709,10 +102683,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13605, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13630, 0) return } } @@ -101726,6 +102701,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -101745,12 +102721,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9381 - zType2 = __ccgo_ts + 13649 + zType = __ccgo_ts + 9406 + zType2 = __ccgo_ts + 13674 } else { /* A view */ - zType = __ccgo_ts + 11119 - zType2 = __ccgo_ts + 13655 + zType = __ccgo_ts + 11144 + zType2 = __ccgo_ts + 13680 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -101833,13 +102809,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13660, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13685, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13675, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13700, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -101848,17 +102824,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13773, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13798, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13815, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13840, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13849, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13874, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13870, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13895, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -101875,7 +102851,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9903) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9928) == 0 { (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } } @@ -101908,7 +102884,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13902, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13927, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -101920,11 +102896,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+11119, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+11144, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -101967,6 +102944,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -102018,7 +102996,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13938, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13963, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } /* If we get this far, it means we need to compute the table names. @@ -102123,6 +103101,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -102164,6 +103143,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -102178,6 +103158,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -102199,7 +103180,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13968, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13993, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -102212,7 +103193,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13983, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14008, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -102263,6 +103244,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -102294,12 +103276,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+14050, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+14075, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12008, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12033, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -102336,7 +103319,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14064, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14089, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -102345,7 +103328,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14109, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14134, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -102380,11 +103363,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3420, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7589, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7614, int32(10)) == 0 { return 0 } return int32(1) @@ -102439,9 +103422,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -102474,18 +103457,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14176, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14201, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14204, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14229, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14238, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14263, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -102495,12 +103478,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12120, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12145, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102541,13 +103525,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14270, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14295, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14358, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -102563,6 +103547,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -102605,10 +103590,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14427, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14452, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -102616,6 +103602,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -102635,6 +103622,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -102659,6 +103647,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -102864,15 +103853,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14473 + v2 = __ccgo_ts + 14498 } else { - v2 = __ccgo_ts + 14479 + v2 = __ccgo_ts + 14504 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14484, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14509, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -102945,7 +103935,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14512, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14537, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -102955,7 +103945,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14518, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14543, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -102969,16 +103959,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14568, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14593, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14596, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14621, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14646, 0) goto exit_create_index } /* @@ -102999,19 +103989,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if zName == uintptr(0) { goto exit_create_index } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14512, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14537, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14655, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14680, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14689, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14714, libc.VaList(bp+136, zName)) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -103028,10 +104018,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14713, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14738, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -103049,9 +104040,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6856 + v2 = __ccgo_ts + 6881 } else { - v2 = __ccgo_ts + 6389 + v2 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -103079,7 +104070,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14512) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14537) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -103098,6 +104089,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -103162,7 +104154,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14736, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14761, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -103212,6 +104204,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -103236,6 +104229,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } } else { @@ -103266,6 +104260,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -103293,6 +104288,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -103305,7 +104301,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14797, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14822, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -103323,6 +104319,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -103334,8 +104331,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14839, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14864, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -103377,9 +104374,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1650 } else { - v13 = __ccgo_ts + 14856 + v13 = __ccgo_ts + 14881 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14864, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14889, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -103387,7 +104384,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14884, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14909, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -103395,7 +104392,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14943, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14968, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -103414,6 +104411,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -103442,6 +104440,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -103515,6 +104514,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) goto _3 _3: + ; i++ } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { @@ -103554,7 +104554,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14970, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14995, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -103563,7 +104563,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14988, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15013, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -103571,9 +104571,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -103589,13 +104589,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+15061, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12116, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12141, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -103704,6 +104705,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -103728,6 +104730,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -103777,7 +104780,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15121, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -103800,6 +104803,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -103813,6 +104817,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -103921,6 +104926,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -103973,6 +104979,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -104005,11 +105012,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 15157 + v1 = __ccgo_ts + 15182 } else { - v1 = __ccgo_ts + 15160 + v1 = __ccgo_ts + 15185 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15166, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15191, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -104047,6 +105054,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) return uintptr(0) @@ -104157,6 +105165,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -104174,6 +105183,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -104182,6 +105192,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -104202,7 +105213,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { var eTxnType, i int32 _, _, _, _, _ = db, eTxnType, i, pBt, v db = (*TParse)(unsafe.Pointer(pParse)).Fdb - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+15202, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+15227, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -104229,6 +105240,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -104248,9 +105260,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _, _, _ = isRollback, v, v1 isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 15208 + v1 = __ccgo_ts + 15233 } else { - v1 = __ccgo_ts + 15217 + v1 = __ccgo_ts + 15242 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -104282,9 +105294,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 15202, - 1: __ccgo_ts + 15224, - 2: __ccgo_ts + 15208, + 0: __ccgo_ts + 15227, + 1: __ccgo_ts + 15249, + 2: __ccgo_ts + 15233, } // C documentation @@ -104304,7 +105316,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15232, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15257, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -104369,6 +105381,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -104487,7 +105500,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+15302, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+15327, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -104496,13 +105509,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx } zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*16))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+15313, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+15338, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1663, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -104527,10 +105541,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12704, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12729, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15432, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15457, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -105620,11 +106647,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15465, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15490, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15494, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15519, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -105743,6 +106770,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -105828,6 +106856,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -105896,6 +106925,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -106024,9 +107054,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15532) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15557) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -106128,6 +107159,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -106169,7 +107201,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11905) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11930) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -106260,6 +107292,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -106346,6 +107379,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -106447,6 +107481,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -106470,10 +107505,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6629, - 1: __ccgo_ts + 6624, - 2: __ccgo_ts + 8520, - 3: __ccgo_ts + 8515, + 0: __ccgo_ts + 6654, + 1: __ccgo_ts + 6649, + 2: __ccgo_ts + 8545, + 3: __ccgo_ts + 8540, 4: __ccgo_ts + 1636, } @@ -106588,7 +107623,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15570, -int32(1)) return } iVal = -iVal @@ -106684,10 +107719,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -106775,6 +107812,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -106838,6 +107876,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -106897,7 +107936,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15562, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15587, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -106958,6 +107997,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106984,6 +108024,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -107475,7 +108516,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15568, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15593, -int32(1)) return } if argc == int32(3) { @@ -107487,7 +108528,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15601, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15626, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -107656,13 +108697,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5390, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15671, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15646, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15679, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -107683,6 +108724,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') @@ -107693,7 +108735,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15653, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15687, libc.VaList(bp+16, zArg)) default: Xsqlite3_str_append(tls, pStr, __ccgo_ts+1651, int32(4)) break @@ -107817,6 +108859,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -107856,6 +108899,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -107983,9 +109027,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -108037,7 +109083,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -108090,6 +109136,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } libc.X__builtin___memcpy_chk(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i), libc.X__builtin_object_size(tls, zOut+uintptr(j), 0)) @@ -108145,6 +109192,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -108170,6 +109218,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -108191,6 +109240,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -108214,6 +109264,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -108234,7 +109285,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11525, + 0: __ccgo_ts + 11550, } // C documentation @@ -108259,6 +109310,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -108287,6 +109339,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 @@ -108355,6 +109408,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -108378,6 +109432,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -108390,7 +109445,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15656, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15690, int32(4), libc.UintptrFromInt32(0)) } } @@ -108451,7 +109506,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12743, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12768, -int32(1)) return } if argc == int32(2) { @@ -108640,9 +109695,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15570, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -108662,7 +109717,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108681,7 +109736,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108982,7 +110037,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15661, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15695, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } @@ -109011,12 +110066,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15667, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15667, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15701, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15701, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -109317,562 +110373,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15672, + FzName: __ccgo_ts + 15706, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15692, + FzName: __ccgo_ts + 15726, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15739, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15723, + FzName: __ccgo_ts + 15757, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15732, + FzName: __ccgo_ts + 15766, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15755, + FzName: __ccgo_ts + 15789, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15840, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15815, + FzName: __ccgo_ts + 15849, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15826, + FzName: __ccgo_ts + 15860, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15833, + FzName: __ccgo_ts + 15867, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15853, + FzName: __ccgo_ts + 15887, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15853, + FzName: __ccgo_ts + 15887, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15859, + FzName: __ccgo_ts + 15893, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15859, + FzName: __ccgo_ts + 15893, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15872, + FzName: __ccgo_ts + 15906, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15879, + FzName: __ccgo_ts + 15913, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15887, + FzName: __ccgo_ts + 15921, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15894, + FzName: __ccgo_ts + 15928, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15907, + FzName: __ccgo_ts + 15941, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15913, + FzName: __ccgo_ts + 15947, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15920, + FzName: __ccgo_ts + 15954, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15961, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15969, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15940, + FzName: __ccgo_ts + 15974, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15950, + FzName: __ccgo_ts + 15984, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15956, + FzName: __ccgo_ts + 15990, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15962, + FzName: __ccgo_ts + 15996, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15989, + FzName: __ccgo_ts + 16023, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16030, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16003, + FzName: __ccgo_ts + 16037, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16014, + FzName: __ccgo_ts + 16048, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16021, + FzName: __ccgo_ts + 16055, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16036, + FzName: __ccgo_ts + 16070, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16053, + FzName: __ccgo_ts + 16087, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16064, + FzName: __ccgo_ts + 16098, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16070, + FzName: __ccgo_ts + 16104, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16088, + FzName: __ccgo_ts + 16122, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16096, + FzName: __ccgo_ts + 16130, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16110, + FzName: __ccgo_ts + 16144, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16118, + FzName: __ccgo_ts + 16152, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16127, + FzName: __ccgo_ts + 16161, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16127, + FzName: __ccgo_ts + 16161, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16134, + FzName: __ccgo_ts + 16168, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16134, + FzName: __ccgo_ts + 16168, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16144, + FzName: __ccgo_ts + 16178, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16148, + FzName: __ccgo_ts + 16182, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16154, + FzName: __ccgo_ts + 16188, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 16158, + FzName: __ccgo_ts + 16192, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 16158, + FzName: __ccgo_ts + 16192, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16164, + FzName: __ccgo_ts + 16198, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16164, + FzName: __ccgo_ts + 16198, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16177, + FzName: __ccgo_ts + 16211, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 16188, + FzName: __ccgo_ts + 16222, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15667, + FzName: __ccgo_ts + 15701, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15667, + FzName: __ccgo_ts + 15701, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16193, + FzName: __ccgo_ts + 16227, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16198, + FzName: __ccgo_ts + 16232, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16206, + FzName: __ccgo_ts + 16240, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16212, + FzName: __ccgo_ts + 16246, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16218, + FzName: __ccgo_ts + 16252, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 16221, + FzName: __ccgo_ts + 16255, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 16225, + FzName: __ccgo_ts + 16259, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 16231, + FzName: __ccgo_ts + 16265, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16221, + FzName: __ccgo_ts + 16255, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16236, + FzName: __ccgo_ts + 16270, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16240, + FzName: __ccgo_ts + 16274, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16244, + FzName: __ccgo_ts + 16278, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16250, + FzName: __ccgo_ts + 16284, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16254, + FzName: __ccgo_ts + 16288, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16259, + FzName: __ccgo_ts + 16293, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16264, + FzName: __ccgo_ts + 16298, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16269, + FzName: __ccgo_ts + 16303, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16275, + FzName: __ccgo_ts + 16309, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16279, + FzName: __ccgo_ts + 16313, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16283, + FzName: __ccgo_ts + 16317, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16287, + FzName: __ccgo_ts + 16321, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16292, + FzName: __ccgo_ts + 16326, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16297, + FzName: __ccgo_ts + 16331, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16302, + FzName: __ccgo_ts + 16336, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16308, + FzName: __ccgo_ts + 16342, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16314, + FzName: __ccgo_ts + 16348, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16320, + FzName: __ccgo_ts + 16354, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16325, + FzName: __ccgo_ts + 16359, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16333, + FzName: __ccgo_ts + 16367, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16341, + FzName: __ccgo_ts + 16375, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16344, + FzName: __ccgo_ts + 16378, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16349, + FzName: __ccgo_ts + 16383, }, } @@ -110286,6 +111342,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -110325,6 +111382,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -110332,6 +111390,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -110341,11 +111400,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16353, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16387, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -110408,6 +111468,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -110447,6 +111508,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -110477,6 +111539,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -110630,6 +111693,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -110665,6 +111729,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -110771,10 +111836,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -110822,6 +111889,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -110883,6 +111951,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -110931,10 +112000,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -111060,6 +112131,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -111095,6 +112167,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -111122,6 +112195,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -111195,6 +112269,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -111238,10 +112313,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -111265,11 +112342,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -111337,6 +112416,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -111353,6 +112433,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -111435,11 +112516,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6919, + Fz: __ccgo_ts + 6944, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6915, + Fz: __ccgo_ts + 6940, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -111495,6 +112576,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -111502,7 +112584,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5548) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5573) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -111601,6 +112683,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -111652,6 +112735,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -111765,6 +112849,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 @@ -111805,6 +112890,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -111936,6 +113022,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -111944,6 +113031,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -112004,6 +113092,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -112030,6 +113119,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -112070,11 +113160,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8485, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8510, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -112196,6 +113287,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -112301,6 +113393,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -112571,6 +113664,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -112592,13 +113686,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16398, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16432, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -112606,13 +113701,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16439, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16473, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -112703,6 +113799,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -112720,16 +113817,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16471, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16505, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16523, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16557, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -112761,6 +113859,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -112771,11 +113870,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16548, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16582, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16594, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16628, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -112789,7 +113888,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -112890,6 +113989,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112930,6 +114030,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -113087,6 +114188,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -113100,9 +114202,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16615) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16649) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -113491,7 +114594,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -115698,10 +116823,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16667, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16701, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -115718,9 +116844,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.X__builtin___memcpy_chk(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16671, uint64(6), libc.X__builtin_object_size(tls, zAltEntry+uintptr(iEntry), 0)) + libc.X__builtin___memcpy_chk(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16705, uint64(6), libc.X__builtin_object_size(tls, zAltEntry+uintptr(iEntry), 0)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -115732,7 +116859,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16677, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16711, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115747,7 +116874,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16720, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16754, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -115769,6 +116896,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -115776,7 +116904,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16752, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16786, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115785,7 +116913,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16629, + 0: __ccgo_ts + 16663, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -115815,6 +116943,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115898,6 +117027,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115948,6 +117078,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -116015,12 +117146,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16789, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16823, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -116068,63 +117200,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5804, - 1: __ccgo_ts + 16828, - 2: __ccgo_ts + 9381, - 3: __ccgo_ts + 16832, - 4: __ccgo_ts + 16837, - 5: __ccgo_ts + 16840, - 6: __ccgo_ts + 16850, - 7: __ccgo_ts + 16860, - 8: __ccgo_ts + 16866, - 9: __ccgo_ts + 16870, - 10: __ccgo_ts + 16875, - 11: __ccgo_ts + 16880, - 12: __ccgo_ts + 16888, - 13: __ccgo_ts + 16899, - 14: __ccgo_ts + 16902, - 15: __ccgo_ts + 16909, - 16: __ccgo_ts + 16870, - 17: __ccgo_ts + 16875, - 18: __ccgo_ts + 16916, - 19: __ccgo_ts + 16921, - 20: __ccgo_ts + 16924, - 21: __ccgo_ts + 16931, - 22: __ccgo_ts + 16866, - 23: __ccgo_ts + 16870, - 24: __ccgo_ts + 16937, - 25: __ccgo_ts + 16942, - 26: __ccgo_ts + 16947, - 27: __ccgo_ts + 16870, - 28: __ccgo_ts + 16951, - 29: __ccgo_ts + 16875, - 30: __ccgo_ts + 16959, - 31: __ccgo_ts + 16963, - 32: __ccgo_ts + 16968, - 33: __ccgo_ts + 12120, - 34: __ccgo_ts + 12116, - 35: __ccgo_ts + 16974, - 36: __ccgo_ts + 16979, - 37: __ccgo_ts + 16984, - 38: __ccgo_ts + 16828, - 39: __ccgo_ts + 16870, - 40: __ccgo_ts + 16989, - 41: __ccgo_ts + 16996, - 42: __ccgo_ts + 17003, - 43: __ccgo_ts + 9381, - 44: __ccgo_ts + 17011, - 45: __ccgo_ts + 5807, - 46: __ccgo_ts + 17017, - 47: __ccgo_ts + 16828, - 48: __ccgo_ts + 16870, - 49: __ccgo_ts + 17022, - 50: __ccgo_ts + 17027, - 51: __ccgo_ts + 16221, - 52: __ccgo_ts + 17032, - 53: __ccgo_ts + 17045, - 54: __ccgo_ts + 17054, - 55: __ccgo_ts + 17061, - 56: __ccgo_ts + 17072, + 0: __ccgo_ts + 5829, + 1: __ccgo_ts + 16862, + 2: __ccgo_ts + 9406, + 3: __ccgo_ts + 16866, + 4: __ccgo_ts + 16871, + 5: __ccgo_ts + 16874, + 6: __ccgo_ts + 16884, + 7: __ccgo_ts + 16894, + 8: __ccgo_ts + 16900, + 9: __ccgo_ts + 16904, + 10: __ccgo_ts + 16909, + 11: __ccgo_ts + 16914, + 12: __ccgo_ts + 16922, + 13: __ccgo_ts + 16933, + 14: __ccgo_ts + 16936, + 15: __ccgo_ts + 16943, + 16: __ccgo_ts + 16904, + 17: __ccgo_ts + 16909, + 18: __ccgo_ts + 16950, + 19: __ccgo_ts + 16955, + 20: __ccgo_ts + 16958, + 21: __ccgo_ts + 16965, + 22: __ccgo_ts + 16900, + 23: __ccgo_ts + 16904, + 24: __ccgo_ts + 16971, + 25: __ccgo_ts + 16976, + 26: __ccgo_ts + 16981, + 27: __ccgo_ts + 16904, + 28: __ccgo_ts + 16985, + 29: __ccgo_ts + 16909, + 30: __ccgo_ts + 16993, + 31: __ccgo_ts + 16997, + 32: __ccgo_ts + 17002, + 33: __ccgo_ts + 12145, + 34: __ccgo_ts + 12141, + 35: __ccgo_ts + 17008, + 36: __ccgo_ts + 17013, + 37: __ccgo_ts + 17018, + 38: __ccgo_ts + 16862, + 39: __ccgo_ts + 16904, + 40: __ccgo_ts + 17023, + 41: __ccgo_ts + 17030, + 42: __ccgo_ts + 17037, + 43: __ccgo_ts + 9406, + 44: __ccgo_ts + 17045, + 45: __ccgo_ts + 5832, + 46: __ccgo_ts + 17051, + 47: __ccgo_ts + 16862, + 48: __ccgo_ts + 16904, + 49: __ccgo_ts + 17056, + 50: __ccgo_ts + 17061, + 51: __ccgo_ts + 16255, + 52: __ccgo_ts + 17066, + 53: __ccgo_ts + 17079, + 54: __ccgo_ts + 17088, + 55: __ccgo_ts + 17095, + 56: __ccgo_ts + 17106, } // C documentation @@ -116143,191 +117275,191 @@ type PragmaName = TPragmaName var _aPragmaName = [67]TPragmaName{ 0: { - FzName: __ccgo_ts + 17080, + FzName: __ccgo_ts + 17114, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 17095, + FzName: __ccgo_ts + 17129, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 17110, + FzName: __ccgo_ts + 17144, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 17122, + FzName: __ccgo_ts + 17156, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 17138, + FzName: __ccgo_ts + 17172, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 17061, + FzName: __ccgo_ts + 17095, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 17151, + FzName: __ccgo_ts + 17185, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 17163, + FzName: __ccgo_ts + 17197, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 17183, + FzName: __ccgo_ts + 17217, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 17199, + FzName: __ccgo_ts + 17233, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 17220, + FzName: __ccgo_ts + 17254, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 17235, + FzName: __ccgo_ts + 17269, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 17251, + FzName: __ccgo_ts + 17285, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 17265, + FzName: __ccgo_ts + 17299, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 17278, + FzName: __ccgo_ts + 17312, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 17292, + FzName: __ccgo_ts + 17326, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 17311, + FzName: __ccgo_ts + 17345, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 17330, + FzName: __ccgo_ts + 17364, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17353, + FzName: __ccgo_ts + 17387, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17362, + FzName: __ccgo_ts + 17396, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17414, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17397, + FzName: __ccgo_ts + 17431, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17410, + FzName: __ccgo_ts + 17444, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17425, + FzName: __ccgo_ts + 17459, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17443, + FzName: __ccgo_ts + 17477, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17453, + FzName: __ccgo_ts + 17487, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17467, + FzName: __ccgo_ts + 17501, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17517, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17508, + FzName: __ccgo_ts + 17542, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17527, + FzName: __ccgo_ts + 17561, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17538, + FzName: __ccgo_ts + 17572, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17549, + FzName: __ccgo_ts + 17583, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -116335,151 +117467,151 @@ var _aPragmaName = [67]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17561, + FzName: __ccgo_ts + 17595, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17577, + FzName: __ccgo_ts + 17611, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17590, + FzName: __ccgo_ts + 17624, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17609, + FzName: __ccgo_ts + 17643, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17628, + FzName: __ccgo_ts + 17662, FePragTyp: uint8(PragTyp_LOCK_PROXY_FILE), FmPragFlg: uint8(PragFlg_NoColumns1), }, 37: { - FzName: __ccgo_ts + 17644, + FzName: __ccgo_ts + 17678, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17657, + FzName: __ccgo_ts + 17691, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 39: { - FzName: __ccgo_ts + 17672, + FzName: __ccgo_ts + 17706, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 40: { - FzName: __ccgo_ts + 17682, + FzName: __ccgo_ts + 17716, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 41: { - FzName: __ccgo_ts + 17694, + FzName: __ccgo_ts + 17728, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 42: { - FzName: __ccgo_ts + 17703, + FzName: __ccgo_ts + 17737, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 43: { - FzName: __ccgo_ts + 17714, + FzName: __ccgo_ts + 17748, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 44: { - FzName: __ccgo_ts + 17724, + FzName: __ccgo_ts + 17758, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 45: { - FzName: __ccgo_ts + 17736, + FzName: __ccgo_ts + 17770, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 46: { - FzName: __ccgo_ts + 17747, + FzName: __ccgo_ts + 17781, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 47: { - FzName: __ccgo_ts + 17759, + FzName: __ccgo_ts + 17793, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 48: { - FzName: __ccgo_ts + 17776, + FzName: __ccgo_ts + 17810, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 49: { - FzName: __ccgo_ts + 17795, + FzName: __ccgo_ts + 17829, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 50: { - FzName: __ccgo_ts + 17821, + FzName: __ccgo_ts + 17855, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 51: { - FzName: __ccgo_ts + 17836, + FzName: __ccgo_ts + 17870, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 52: { - FzName: __ccgo_ts + 17850, + FzName: __ccgo_ts + 17884, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 53: { - FzName: __ccgo_ts + 17869, + FzName: __ccgo_ts + 17903, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 54: { - FzName: __ccgo_ts + 17883, + FzName: __ccgo_ts + 17917, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 55: { - FzName: __ccgo_ts + 17899, + FzName: __ccgo_ts + 17933, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 56: { - FzName: __ccgo_ts + 17911, + FzName: __ccgo_ts + 17945, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17922, + FzName: __ccgo_ts + 17956, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 58: { - FzName: __ccgo_ts + 17933, + FzName: __ccgo_ts + 17967, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -116487,45 +117619,45 @@ var _aPragmaName = [67]TPragmaName{ FiArg: uint64(1), }, 59: { - FzName: __ccgo_ts + 17945, + FzName: __ccgo_ts + 17979, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 60: { - FzName: __ccgo_ts + 17956, + FzName: __ccgo_ts + 17990, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 61: { - FzName: __ccgo_ts + 17977, + FzName: __ccgo_ts + 18011, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 62: { - FzName: __ccgo_ts + 17985, + FzName: __ccgo_ts + 18019, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 63: { - FzName: __ccgo_ts + 18000, + FzName: __ccgo_ts + 18034, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 64: { - FzName: __ccgo_ts + 18013, + FzName: __ccgo_ts + 18047, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 65: { - FzName: __ccgo_ts + 18032, + FzName: __ccgo_ts + 18066, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 66: { - FzName: __ccgo_ts + 18047, + FzName: __ccgo_ts + 18081, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -116567,6 +117699,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -116625,10 +117758,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18063) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18097) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18073) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18107) { return PAGER_LOCKINGMODE_NORMAL } } @@ -116646,13 +117779,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8541) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8566) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18080) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18114) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18085) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18119) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -116675,10 +117808,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17022) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17056) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+18097) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+18131) == 0 { return int32(2) } else { return 0 @@ -116700,7 +117833,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18104, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18138, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -116761,6 +117894,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -116829,15 +117963,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 18166 + zName = __ccgo_ts + 18200 case int32(OE_SetDflt): - zName = __ccgo_ts + 18175 + zName = __ccgo_ts + 18209 case int32(OE_Cascade): - zName = __ccgo_ts + 18187 + zName = __ccgo_ts + 18221 case int32(OE_Restrict): - zName = __ccgo_ts + 18195 + zName = __ccgo_ts + 18229 default: - zName = __ccgo_ts + 18204 + zName = __ccgo_ts + 18238 break } return zName @@ -116858,12 +117992,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 18214, - 1: __ccgo_ts + 18221, - 2: __ccgo_ts + 18229, - 3: __ccgo_ts + 18233, - 4: __ccgo_ts + 18097, - 5: __ccgo_ts + 18242, + 0: __ccgo_ts + 18248, + 1: __ccgo_ts + 18255, + 2: __ccgo_ts + 18263, + 3: __ccgo_ts + 18267, + 4: __ccgo_ts + 18131, + 5: __ccgo_ts + 18276, } // C documentation @@ -116925,25 +118059,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 18267 + zType = __ccgo_ts + 18301 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 18269 + zType = __ccgo_ts + 18303 } else { - zType = __ccgo_ts + 7940 + zType = __ccgo_ts + 7965 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18271, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18305, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 18246, - 2: __ccgo_ts + 18251, - 3: __ccgo_ts + 18259, + 1: __ccgo_ts + 18280, + 2: __ccgo_ts + 18285, + 3: __ccgo_ts + 18293, } // C documentation @@ -116984,8 +118119,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(256) defer tls.Free(256) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -117014,7 +118149,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -117043,7 +118178,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+18278, libc.VaList(bp+184, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+18312, libc.VaList(bp+184, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -117190,7 +118325,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt b = -int32(1) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18282) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18316) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -117205,6 +118340,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -117260,7 +118396,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 18073 + zRet = __ccgo_ts + 18107 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -117279,6 +118415,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -117287,7 +118424,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) } if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 18063 + zRet = __ccgo_ts + 18097 } _returnSingleText(tls, v, zRet) break @@ -117297,7 +118434,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -117316,6 +118453,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -117345,6 +118483,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -117522,6 +118661,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -117574,7 +118714,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*int8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18287, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18321, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -117616,7 +118756,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p res1 = _sqlite3OsFileControl(tls, pFile1, int32(SQLITE_FCNTL_SET_LOCKPROXYFILE), libc.UintptrFromInt32(0)) } if res1 != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18312, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18346, 0) goto pragma_out } } @@ -117636,7 +118776,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18342, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18376, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -117669,7 +118809,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18395) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18429) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -117742,15 +118882,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } } pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18401 + v14 = __ccgo_ts + 18435 } else { - v14 = __ccgo_ts + 18409 + v14 = __ccgo_ts + 18443 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -117765,6 +118906,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+184, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -117820,7 +118962,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18416, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18450, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 88)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+88, uintptr(0)) @@ -117836,6 +118978,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117849,25 +118992,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 11119 + zType = __ccgo_ts + 11144 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13367 + zType = __ccgo_ts + 13392 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18432 + zType = __ccgo_ts + 18466 } else { - zType = __ccgo_ts + 9381 + zType = __ccgo_ts + 9406 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18439, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18473, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117906,13 +119051,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18446, libc.VaList(bp+184, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18480, libc.VaList(bp+184, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18451, libc.VaList(bp+184, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18485, libc.VaList(bp+184, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117931,13 +119077,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18456, - 1: __ccgo_ts + 18458, - 2: __ccgo_ts + 16899, + 0: __ccgo_ts + 18490, + 1: __ccgo_ts + 18492, + 2: __ccgo_ts + 16933, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18460, libc.VaList(bp+184, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18494, libc.VaList(bp+184, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117953,9 +119100,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { goto _24 } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18466, libc.VaList(bp+184, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18500, libc.VaList(bp+184, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117969,9 +119117,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18470, libc.VaList(bp+184, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18504, libc.VaList(bp+184, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117990,10 +119139,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -118005,6 +119156,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -118015,9 +119167,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7940, libc.VaList(bp+184, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7965, libc.VaList(bp+184, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -118026,9 +119179,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1608)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7940, libc.VaList(bp+184, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7965, libc.VaList(bp+184, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -118051,9 +119205,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18473, libc.VaList(bp+184, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18482)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18507, libc.VaList(bp+184, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18516)) goto _32 _32: + ; j2++ } i7++ @@ -118062,7 +119217,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -118122,6 +119277,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -118169,6 +119325,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -118189,12 +119346,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18487, libc.VaList(bp+184, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18521, libc.VaList(bp+184, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 104))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -118314,6 +119472,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -118322,6 +119481,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -118364,10 +119524,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -118378,7 +119540,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18491, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18525, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -118396,50 +119558,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -118464,6 +119582,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118486,6 +119605,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -118503,13 +119623,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 116)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 116)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18515, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18549, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -118518,6 +119638,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 116)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -118585,9 +119706,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18551, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18585, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -118600,7 +119722,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if bStrict != 0 && doTypeCheck != 0 { _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18571, libc.VaList(bp+184, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18605, libc.VaList(bp+184, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -118608,7 +119730,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18593, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18627, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -118619,10 +119741,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 116)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18616, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18650, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18618, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18652, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -118632,6 +119754,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -118649,12 +119772,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18638, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18672, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -118678,9 +119802,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 120))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18668) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18702) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18673) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18707) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -118693,9 +119817,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 120))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18694) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18728) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18730) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18764) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -118717,14 +119841,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18668) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18702) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18741) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18775) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -118745,13 +119870,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 120))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 120))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18768) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18802) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -118759,6 +119885,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 136))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118766,7 +119893,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 116)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18795) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18829) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -118785,6 +119912,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118794,17 +119922,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 112)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18824 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18858 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118862,27 +120057,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18885, libc.VaList(bp+184, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18919, libc.VaList(bp+184, zRight)) } } } @@ -118960,11 +120156,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118980,20 +120176,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18080) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18114) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18910) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18944) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18233) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18267) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -119017,11 +120213,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -119089,7 +120285,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -119098,22 +120294,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -119122,16 +120318,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -119140,15 +120336,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18918, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18952, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -119156,12 +120353,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -119259,6 +120458,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -119388,34 +120588,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18827, + FzName: __ccgo_ts + 18861, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18832, + FzName: __ccgo_ts + 18866, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18838, + FzName: __ccgo_ts + 18872, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18847, + FzName: __ccgo_ts + 18881, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18856, + FzName: __ccgo_ts + 18890, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18864, + FzName: __ccgo_ts + 18898, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18872, + FzName: __ccgo_ts + 18906, }, 7: { - FzName: __ccgo_ts + 18879, + FzName: __ccgo_ts + 18913, }, 8: {}, } @@ -119511,34 +120711,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18936) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18970) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18951, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18985, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = int8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18958, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18992, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18964) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18998) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18976) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+19010) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) _sqlite3StrAccumFinish(tls, bp) rc = Xsqlite3_declare_vtab(tls, db, bp+32) if rc == SQLITE_OK { @@ -119612,6 +120813,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -119624,6 +120826,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -119667,6 +120871,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -119739,17 +120944,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18991) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+19025) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18999, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19033, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19003, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19037, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -119884,24 +121090,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+19037, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+19071, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5431 + v1 = __ccgo_ts + 5456 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+19065, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+19099, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+19096, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+19130, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119909,9 +121115,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 19007, - 1: __ccgo_ts + 19014, - 2: __ccgo_ts + 19026, + 0: __ccgo_ts + 19041, + 1: __ccgo_ts + 19048, + 2: __ccgo_ts + 19060, } // C documentation @@ -119934,6 +121140,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119986,7 +121193,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14839) + _corruptSchema(tls, pData, argv, __ccgo_ts+14864) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -120019,11 +121226,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+19104) + _corruptSchema(tls, pData, argv, __ccgo_ts+19138) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14839) + _corruptSchema(tls, pData, argv, __ccgo_ts+14864) } } } @@ -120062,18 +121269,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9381 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9406 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6856 + v2 = __ccgo_ts + 6881 } else { - v2 = __ccgo_ts + 6389 + v2 = __ccgo_ts + 6414 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8453 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 19117 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8478 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 19151 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -120134,6 +121341,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -120161,7 +121369,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12418) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12443) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -120187,7 +121395,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+19189) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+19223) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -120202,7 +121410,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl /* Read the schema information out of the schema tables */ (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+19213, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+19247, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -120240,11 +121448,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+19277, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+19311, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -120674,6 +121888,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -120685,7 +121900,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -120699,6 +121914,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120829,6 +122045,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -121210,6 +122427,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -121218,18 +122436,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11525 - zSp2 = __ccgo_ts + 11525 + zSp1 = __ccgo_ts + 11550 + zSp2 = __ccgo_ts + 11550 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19296, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19330, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -121302,6 +122521,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -121354,6 +122574,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -121403,6 +122624,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -121451,6 +122673,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -121516,7 +122739,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19326, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19360, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -121536,6 +122759,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -121565,7 +122789,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19376, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19410, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -121587,7 +122811,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19440, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19474, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -121609,6 +122833,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -121621,6 +122846,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -121629,7 +122855,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 7053, + Fz: __ccgo_ts + 7078, Fn: uint32(8), } @@ -121885,7 +123111,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121907,6 +123133,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) @@ -122043,6 +123270,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -122072,6 +123300,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -122088,6 +123317,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } } @@ -122219,9 +123449,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } else { /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -122267,6 +123497,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -122382,6 +123613,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -122399,13 +123631,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19477 + z = __ccgo_ts + 19511 case int32(TK_INTERSECT): - z = __ccgo_ts + 19487 + z = __ccgo_ts + 19521 case int32(TK_EXCEPT): - z = __ccgo_ts + 19497 + z = __ccgo_ts + 19531 default: - z = __ccgo_ts + 19504 + z = __ccgo_ts + 19538 break } return z @@ -122426,7 +123658,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19510, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19544, libc.VaList(bp+8, zUsage)) } /* @@ -122461,11 +123693,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19533 + v1 = __ccgo_ts + 19567 } else { v1 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19548, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19582, libc.VaList(bp+8, v1)) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) _sqlite3VdbeGoto(tls, v, addrBreak) @@ -122527,6 +123759,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -122544,6 +123777,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -122654,6 +123888,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -122688,7 +123923,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -122702,7 +123937,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } if iCol < 0 { zType = __ccgo_ts + 1138 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 17011 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 17045 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -122770,6 +124005,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122847,13 +124083,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } if iCol < 0 { - zCol = __ccgo_ts + 17011 + zCol = __ccgo_ts + 17045 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122861,7 +124097,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19579, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19613, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122871,6 +124107,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122952,7 +124189,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 17011 + v3 = __ccgo_ts + 17045 } zName = v3 } else { @@ -122967,7 +124204,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19579, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19613, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122994,6 +124231,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -123002,7 +124240,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19588, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19622, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -123019,6 +124257,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -123032,6 +124271,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -123097,6 +124337,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -123113,7 +124354,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19596 + zType = __ccgo_ts + 19630 } else { zType = uintptr(0) j = int32(1) @@ -123127,6 +124368,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -123149,6 +124391,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 16 } @@ -123367,6 +124610,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -123425,7 +124669,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19600, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19634, 0) return } /* Obtain authorization to do a recursive query */ @@ -123456,6 +124700,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -123517,7 +124762,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19649, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19683, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -123526,12 +124771,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19691, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19725, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -123559,13 +124805,14 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19697, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19731, 0) _sqlite3Select(tls, pParse, p, bp) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup /* Keep running the loop until the Queue is empty */ _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -123614,7 +124861,7 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) } else { v1 = __ccgo_ts + 3689 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19712, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19746, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123722,8 +124969,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19735, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19750, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19784, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123748,7 +124995,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19477, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19511, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123761,7 +125008,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -123800,7 +125047,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19803, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123858,7 +125105,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19803, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123925,6 +125172,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -123949,15 +125197,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123976,9 +125227,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19790, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19824, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19836, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -124228,6 +125479,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -124249,6 +125501,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -124274,6 +125527,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -124303,6 +125557,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -124319,6 +125574,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr nSelect++ goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -124334,6 +125590,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -124341,8 +125598,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7690) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7690) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7715) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7715) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -124386,14 +125643,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19918, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19952, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19929, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19963, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -124406,7 +125663,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19934, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19968, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -124621,7 +125878,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5409 + v1 = __ccgo_ts + 5434 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124662,6 +125919,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -124693,11 +125951,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124790,11 +126050,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -124909,10 +126171,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -125212,6 +126476,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -125226,6 +126491,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -125334,6 +126600,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -125431,6 +126698,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.X__builtin___memset_chk(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104), libc.X__builtin_object_size(tls, pSubSrc+8+uintptr(i)*104, 0)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -125469,6 +126737,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 @@ -125519,10 +126788,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -125600,6 +126871,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125703,6 +126975,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125951,6 +127224,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125989,6 +127266,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -126012,10 +127290,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -126103,6 +127383,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -126125,6 +127406,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -126158,10 +127440,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -126197,13 +127481,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r return uint8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15864) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15898) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15868) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15902) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -126287,10 +127571,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19940, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19974, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -126341,6 +127626,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -126365,6 +127651,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -126412,7 +127699,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19958, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19992, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -126451,6 +127738,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -126458,6 +127746,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -126585,7 +127874,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19981, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20015, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126609,7 +127898,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20001, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20035, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126623,6 +127912,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126630,7 +127920,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20044 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20078 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -126655,12 +127945,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20067, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20101, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126669,9 +127960,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20105 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20139 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20173 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126730,13 +128021,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+20177, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+20211, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) /* The usual case - do not allow ROWID on a subquery */ *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -126885,7 +128177,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20181, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20215, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126900,7 +128192,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20220, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20254, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126915,7 +128207,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15432, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15457, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol @@ -126933,6 +128225,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } @@ -126967,6 +128260,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -127035,7 +128329,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6913 + v10 = __ccgo_ts + 6938 } zSchemaName = v10 } @@ -127052,18 +128346,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20251, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20285, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -127124,10 +128422,10 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20256, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20290, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -127140,7 +128438,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -127149,23 +128447,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20265, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20283, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20317, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -127173,7 +128474,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20303, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20337, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -127256,6 +128557,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -127352,6 +128654,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -127383,6 +128686,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -127448,6 +128752,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -127510,12 +128815,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20334, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20368, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20385, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20419, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -127536,10 +128841,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20418, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20452, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -127583,6 +128889,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127597,6 +128904,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -127617,6 +128925,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -127727,6 +129036,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127767,6 +129077,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -127791,6 +129102,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -127809,6 +129121,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -127833,7 +129146,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20451 + v1 = __ccgo_ts + 20485 } else { v1 = __ccgo_ts + 1650 } @@ -127842,7 +129155,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20474, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20508, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127874,7 +129187,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8453) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8478) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -128030,7 +129343,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+16158) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+16192) != 0 { return 0 } /* Is count() */ if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { @@ -128133,6 +129446,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -128292,7 +129606,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20486, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20520, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -128366,6 +129680,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -128380,6 +129695,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -128391,7 +129707,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20540, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20574, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -128474,6 +129790,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128571,7 +129888,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20580, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20614, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128619,7 +129936,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20595, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20629, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128645,6 +129962,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128713,6 +130031,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128725,6 +130044,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128836,6 +130156,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -128851,6 +130172,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } @@ -128880,6 +130202,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -129023,11 +130346,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20611 + v44 = __ccgo_ts + 20645 } else { - v44 = __ccgo_ts + 20620 + v44 = __ccgo_ts + 20654 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19510, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19544, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -129043,6 +130366,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -129061,6 +130385,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -129122,6 +130447,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -129239,6 +130565,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -129282,6 +130609,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -129341,7 +130669,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20611) + _explainTempTable(tls, pParse, __ccgo_ts+20645) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -129359,6 +130687,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) _sqlite3VdbeExplainPop(tls, pParse) return rc @@ -129455,12 +130784,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20629, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20663, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129489,12 +130819,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129599,6 +130931,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129708,7 +131041,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20694, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20728, 0) goto trigger_cleanup } iDb = int32(1) @@ -129748,7 +131081,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto trigger_cleanup } - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20740, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20774, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -129758,11 +131091,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20748, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20782, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20789, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20823, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -129771,13 +131104,13 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if zName == uintptr(0) { goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20740, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20774, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20829, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20863, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) } @@ -129785,8 +131118,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20855, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20889, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129794,15 +131127,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20893 + v1 = __ccgo_ts + 20927 } else { - v1 = __ccgo_ts + 20900 + v1 = __ccgo_ts + 20934 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20906, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20940, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20943, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20977, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129822,9 +131155,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6856 + v3 = __ccgo_ts + 6881 } else { - v3 = __ccgo_ts + 6389 + v3 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129866,6 +131199,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 pColumns = uintptr(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129876,6 +131210,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129920,7 +131255,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20740, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20774, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -129942,11 +131277,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20989, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21023, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129957,10 +131293,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21037, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21071, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+21112, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+21146, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -129978,6 +131314,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _sqlite3DeleteTriggerStep(tls, db, pStepList) } @@ -130004,6 +131341,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -130220,11 +131558,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21141, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21175, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -130233,6 +131572,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -130264,9 +131604,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 if iDb == int32(1) { @@ -130281,7 +131621,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21161, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21195, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -130312,6 +131652,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -130348,6 +131689,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -130412,11 +131754,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 21223 + v1 = __ccgo_ts + 21257 } else { - v1 = __ccgo_ts + 21230 + v1 = __ccgo_ts + 21264 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21237, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21271, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -130434,6 +131776,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130515,7 +131858,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21285, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21319, 0) return int32(1) } @@ -130560,6 +131903,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130573,6 +131917,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130651,6 +131996,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130703,7 +132049,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6586, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6611, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130724,6 +132070,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130804,7 +132151,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+21327, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+21361, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130869,6 +132216,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130979,6 +132327,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -131042,6 +132391,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -131236,6 +132586,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -131254,6 +132605,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -131276,6 +132628,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -131408,6 +132761,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -131437,6 +132791,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131485,7 +132840,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21341, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21375, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -131495,6 +132850,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131504,13 +132860,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21377, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21411, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 8228 + v11 = __ccgo_ts + 8253 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -131524,6 +132880,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } chngKey = uint8(int32(chngRowid) + int32(chngPk)) @@ -131554,6 +132911,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131609,6 +132967,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131618,6 +132977,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131836,6 +133196,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131905,6 +133266,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131961,6 +133323,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -132025,6 +133388,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -132075,6 +133439,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -132183,9 +133548,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21396) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21430) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -132279,6 +133645,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -132312,6 +133679,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -132360,6 +133728,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132475,7 +133844,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132576,6 +133945,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132584,6 +133954,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132592,22 +133963,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]int8)(unsafe.Pointer(bp + 200)))[0] = 0 } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21409, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21443, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21413, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21447, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132628,14 +134009,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132695,10 +134082,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12793, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12818, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132717,6 +134105,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132779,7 +134168,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21486, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21490, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21520, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21524, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -132880,6 +134269,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132905,17 +134295,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21494) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21528) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21534) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21568) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21577) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21611) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -132954,7 +134344,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21595, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21629, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -132966,7 +134356,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21618) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21652) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -132983,7 +134373,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+15202) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+15227) if rc != SQLITE_OK { goto end_of_vacuum } @@ -133014,11 +134404,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21645, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21679, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21753, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21787, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -133027,7 +134417,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21807, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21841, libc.VaList(bp+24, zDbMain)) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { goto end_of_vacuum @@ -133037,7 +134427,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21958, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21992, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -133056,6 +134446,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -133076,6 +134467,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -133269,6 +134661,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -133278,6 +134671,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -133334,6 +134728,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -133435,6 +134830,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -133520,6 +134916,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133556,7 +134953,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13023, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13048, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133679,7 +135076,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+22088, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+22122, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133689,11 +135086,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+22112, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+22146, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+22211, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+22245, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -133780,11 +135177,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22230, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22264, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133821,7 +135219,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22272, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22306, libc.VaList(bp+48, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) @@ -133836,7 +135234,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 22302 + zFormat = __ccgo_ts + 22336 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133870,11 +135268,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16902, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16936, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133892,6 +135291,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -133906,6 +135306,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133948,7 +135349,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22348, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22382, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -134035,7 +135436,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22348, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22382, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -134070,9 +135471,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _sqlite3ParseObjectInit(tls, bp, db) @@ -134168,6 +135569,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -134226,6 +135628,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -134266,6 +135669,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -134333,6 +135737,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -134406,6 +135811,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134511,6 +135917,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -134643,7 +136050,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { ap = va switch op { @@ -134656,7 +136063,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -135378,10 +136785,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 22367 + return __ccgo_ts + 22401 } if i == -int32(1) { - return __ccgo_ts + 17011 + return __ccgo_ts + 17045 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -135400,10 +136807,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, var i int32 _ = i if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22408, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22380, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22414, int32(1)) } i = 0 for { @@ -135411,19 +136818,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13438, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22380, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22414, int32(1)) } i = 0 for { @@ -135431,15 +136839,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13438, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5431, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5456, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } } @@ -135472,7 +136881,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22382, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22416, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135480,27 +136889,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22408, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 22385 + v2 = __ccgo_ts + 22419 } else { - v2 = __ccgo_ts + 22390 + v2 = __ccgo_ts + 22424 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22398) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22432) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22400) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22434) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } // C documentation @@ -135543,47 +136953,47 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22402 + v2 = __ccgo_ts + 22436 } else { - v2 = __ccgo_ts + 22409 + v2 = __ccgo_ts + 22443 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22414, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22448, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11576 + zFmt = __ccgo_ts + 11601 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22420 + zFmt = __ccgo_ts + 22454 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22453 + zFmt = __ccgo_ts + 22487 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22478 + zFmt = __ccgo_ts + 22512 } else { - zFmt = __ccgo_ts + 22496 + zFmt = __ccgo_ts + 22530 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22505, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22539, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 17011 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22513, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 17045 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22547, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = int8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22544, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22578, libc.VaList(bp+144, zRowid)) cRangeOp = int8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -135593,10 +137003,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22554, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22588, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22559, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22593, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135615,7 +137025,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22586, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22620, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135649,14 +137059,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22597, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22631, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22385, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22419, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22618, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22652, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135666,15 +137076,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22408, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22385, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22419, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135813,6 +137224,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135889,6 +137301,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135923,11 +137336,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -135986,6 +137401,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -135998,6 +137414,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -136112,6 +137529,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -136230,6 +137648,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -136280,6 +137699,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -136347,6 +137767,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -136384,6 +137805,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -136425,6 +137847,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -136568,6 +137991,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -136629,6 +138053,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136729,6 +138154,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136759,6 +138185,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -137153,6 +138580,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -137242,6 +138670,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.X__builtin___memcpy_chk(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104), libc.X__builtin_object_size(tls, pOrTab+8+uintptr(k)*104, 0)) goto _48 _48: + ; k++ } } else { @@ -137332,6 +138761,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -137347,7 +138777,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22626, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22660, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -137370,7 +138800,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22641, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22675, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) if pSubWInfo != 0 { addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) @@ -137404,6 +138834,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137475,6 +138906,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -137598,6 +139030,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -137653,6 +139086,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -137685,6 +139119,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137725,6 +139160,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137745,10 +139181,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137834,7 +139272,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22650, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22684, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -137848,6 +139286,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -137870,6 +139309,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -137903,6 +139343,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -138145,6 +139586,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 @@ -138270,6 +139712,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -138333,19 +139776,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16860, + FzOp: __ccgo_ts + 16894, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 16188, + FzOp: __ccgo_ts + 16222, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15667, + FzOp: __ccgo_ts + 15701, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22664, + FzOp: __ccgo_ts + 22698, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138464,6 +139907,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp } goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138630,6 +140074,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -138656,6 +140101,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -138761,6 +140207,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } @@ -138802,11 +140249,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -138830,6 +140279,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } @@ -138926,6 +140376,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -138978,14 +140429,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -139025,10 +140479,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -139119,7 +140575,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22671, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22705, 0) return } } else { @@ -139131,7 +140587,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22671, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22705, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -139215,7 +140671,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } else { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 8214 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 8239 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -139237,6 +140693,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -139288,6 +140745,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) goto _11 _11: + ; i1++ } } @@ -139309,7 +140767,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22712 + v13 = __ccgo_ts + 22746 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -139362,6 +140820,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -139384,6 +140843,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139579,6 +141039,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139600,6 +141061,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -139763,6 +141225,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -139790,6 +141253,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -139829,7 +141293,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22719, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22753, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -139856,6 +141320,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -140034,6 +141499,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -140130,6 +141596,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -140151,6 +141618,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -140158,6 +141626,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -140188,6 +141657,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -140299,6 +141769,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -140336,6 +141807,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -140504,6 +141976,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140572,6 +142045,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140613,6 +142087,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140621,6 +142096,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140687,6 +142163,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -140823,7 +142300,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143627,6 +145136,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -143753,6 +145263,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -143786,6 +145297,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -143860,6 +145372,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -143899,7 +145412,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22792, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22826, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 @@ -143961,6 +145474,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -143973,11 +145487,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22792, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22826, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } (*(*struct { @@ -144124,7 +145639,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -144174,6 +145689,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -144185,6 +145701,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -144292,6 +145809,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -144424,16 +145942,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144465,11 +145986,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -144540,6 +146063,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144553,7 +146077,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22818, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22852, 0) rc = SQLITE_OK } else { break @@ -144561,6 +146085,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -144706,6 +146231,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -144723,6 +146249,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -144795,6 +146322,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -144872,6 +146400,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -144910,6 +146439,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -144937,11 +146467,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -144964,6 +146496,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -145121,6 +146654,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -145242,6 +146776,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -145307,16 +146842,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -145327,10 +146865,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22853, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -145346,6 +146885,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } /* Load the lowest cost path into pWInfo */ @@ -145362,6 +146902,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145494,6 +147035,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145511,6 +147053,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -145649,6 +147192,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -145666,6 +147210,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -145675,6 +147220,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- goto _1 _1: + ; i-- } return notReady @@ -145729,6 +147275,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -145747,9 +147294,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 for { @@ -145759,11 +147306,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -145793,7 +147338,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) } @@ -145804,6 +147349,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -145833,6 +147379,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -145952,7 +147499,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22871, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22905, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -146024,7 +147571,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22899, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22933, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -146046,6 +147593,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -146104,6 +147652,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -146276,6 +147825,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -146379,6 +147929,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -146429,6 +147980,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -146436,6 +147988,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146506,6 +148059,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -146582,6 +148136,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -146619,6 +148174,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } i = 0 @@ -146723,6 +148279,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -146732,6 +148289,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -147010,7 +148568,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22917, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22951, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -147192,7 +148751,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22973, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+23007, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147514,10 +149073,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23018, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23052, libc.VaList(bp+8, zName)) } return p } @@ -147568,12 +149128,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23037, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23071, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23108, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23142, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -147646,12 +149206,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8453) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8478) } break } goto _1 _1: + ; i++ } } @@ -147719,6 +149280,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -147741,6 +149303,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -147766,6 +149329,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -147896,6 +149460,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -147923,7 +149488,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt bp := tls.Alloc(16) defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+23171, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+23205, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -148054,6 +149619,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -148208,7 +149774,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23197, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23231, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -148227,6 +149793,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -148274,18 +149841,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 23229 + zErr = __ccgo_ts + 23263 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 23246 + zErr = __ccgo_ts + 23280 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 23262 + zErr = __ccgo_ts + 23296 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23282, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23316, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -148309,7 +149876,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23315, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23349, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148485,6 +150052,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148526,11 +150094,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 23362, - 1: __ccgo_ts + 23415, - 2: __ccgo_ts + 22917, - 3: __ccgo_ts + 23466, - 4: __ccgo_ts + 23518, + 0: __ccgo_ts + 23396, + 1: __ccgo_ts + 23449, + 2: __ccgo_ts + 22951, + 3: __ccgo_ts + 23500, + 4: __ccgo_ts + 23552, } var _aOp1 = [5]int32{ @@ -148693,6 +150261,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -148751,6 +150320,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -148795,6 +150365,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -148821,6 +150392,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148871,6 +150443,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148919,6 +150492,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -149054,6 +150628,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149099,6 +150674,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -149129,6 +150705,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149483,6 +151060,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -149971,6 +151549,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -150299,11 +151878,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23568 + v1 = __ccgo_ts + 23602 } else { - v1 = __ccgo_ts + 23577 + v1 = __ccgo_ts + 23611 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23583, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23617, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -150312,7 +151891,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23625, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23659, 0) } } } @@ -150401,7 +151980,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23659, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23693, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -156714,103 +158293,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -156935,7 +158514,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23697, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23731, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158449,289 +160028,387 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+17011, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+17045, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23719, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23753, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16924, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16958, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23719, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23753, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -158755,17 +160432,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -158773,10 +160455,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -158790,73 +160474,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -158890,142 +160598,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23746) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23780) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -159038,74 +160792,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159116,18 +160891,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1)))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159138,7 +160917,7 @@ _200: /* expr ::= VARIABLE */ ** in the virtual machine. #N is the N-th register. */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23755, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23789, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -159148,47 +160927,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159200,23 +160989,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -159229,7 +161028,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -159243,33 +161043,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -159278,17 +161087,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -159301,7 +161114,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -159313,9 +161127,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 8209 + v345 = __ccgo_ts + 8234 } else { - v345 = __ccgo_ts + 8214 + v345 = __ccgo_ts + 8239 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159358,18 +161172,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -159386,13 +161203,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -159407,73 +161226,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -159482,236 +161323,309 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23779, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23813, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23874, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23908, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23958, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23992, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = int8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -159720,11 +161634,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -159734,22 +161650,27 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: + ; goto _342 /********** End reduce actions ************************************************/ _342: + ; yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) @@ -159782,9 +161703,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23755, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23789, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24043, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24077, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -161833,6 +163754,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -162012,6 +163934,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -162027,6 +163950,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -162071,6 +163995,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -162166,6 +164091,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -162199,6 +164125,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -162210,6 +164137,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -162244,6 +164172,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -162262,6 +164191,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -162285,6 +164215,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -162307,6 +164238,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -162325,6 +164257,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -162346,6 +164279,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -162458,7 +164392,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24060, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24094, libc.VaList(bp+2456, bp+2432)) break } } @@ -162482,7 +164416,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+24085, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+24119, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -162597,7 +164531,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*int8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*int8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -162607,9 +164541,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -162623,7 +164557,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -162635,7 +164569,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -162644,9 +164578,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*int8)(unsafe.Pointer(zSql))) @@ -162667,13 +164601,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*int8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24096, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24130, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -162681,13 +164616,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20740, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20774, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24103, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24137, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24108, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24142, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -162697,10 +164632,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24118, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24152, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24122, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24156, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -162960,6 +164895,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -163131,8 +165068,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -163140,7 +165077,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -164259,31 +166215,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 24198, - 1: __ccgo_ts + 24211, - 3: __ccgo_ts + 24227, - 4: __ccgo_ts + 24252, - 5: __ccgo_ts + 24266, - 6: __ccgo_ts + 24285, + 0: __ccgo_ts + 24232, + 1: __ccgo_ts + 24245, + 3: __ccgo_ts + 24261, + 4: __ccgo_ts + 24286, + 5: __ccgo_ts + 24300, + 6: __ccgo_ts + 24319, 7: __ccgo_ts + 1620, - 8: __ccgo_ts + 24310, - 9: __ccgo_ts + 24347, - 10: __ccgo_ts + 24359, - 11: __ccgo_ts + 24374, - 12: __ccgo_ts + 24407, - 13: __ccgo_ts + 24425, - 14: __ccgo_ts + 24450, - 15: __ccgo_ts + 24479, - 17: __ccgo_ts + 6344, - 18: __ccgo_ts + 5746, - 19: __ccgo_ts + 24496, - 20: __ccgo_ts + 24514, - 21: __ccgo_ts + 24532, - 23: __ccgo_ts + 24566, - 25: __ccgo_ts + 24587, - 26: __ccgo_ts + 24613, - 27: __ccgo_ts + 24636, - 28: __ccgo_ts + 24657, + 8: __ccgo_ts + 24344, + 9: __ccgo_ts + 24381, + 10: __ccgo_ts + 24393, + 11: __ccgo_ts + 24408, + 12: __ccgo_ts + 24441, + 13: __ccgo_ts + 24459, + 14: __ccgo_ts + 24484, + 15: __ccgo_ts + 24513, + 17: __ccgo_ts + 6369, + 18: __ccgo_ts + 5771, + 19: __ccgo_ts + 24530, + 20: __ccgo_ts + 24548, + 21: __ccgo_ts + 24566, + 23: __ccgo_ts + 24600, + 25: __ccgo_ts + 24621, + 26: __ccgo_ts + 24647, + 27: __ccgo_ts + 24670, + 28: __ccgo_ts + 24691, } // C documentation @@ -164462,7 +166418,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i var p, v1 uintptr _, _, _, _ = extraFlags, p, rc, v1 if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) @@ -164505,7 +166461,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24754, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24788, 0) return int32(SQLITE_BUSY) } else { _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -164576,6 +166532,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -164629,7 +166586,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24817, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24851, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -164904,7 +166861,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { @@ -164914,7 +166871,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24868, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24902, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -164987,6 +166944,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -165035,7 +166993,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165167,7 +167125,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165177,7 +167135,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165226,7 +167184,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -165235,7 +167193,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24889, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24923, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -165261,6 +167219,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -165381,7 +167340,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u flags = *(*uint32)(unsafe.Pointer(pFlags)) zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24957, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24991, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -165395,6 +167354,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -165410,8 +167370,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24963, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24973, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24997, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25007, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -165500,20 +167460,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+25001, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+25035, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+25005, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+25039, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 25005 + zModeType = __ccgo_ts + 25039 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+25026, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+25060, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -165542,15 +167502,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25041, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25075, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25061, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25095, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -165574,10 +167535,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25085, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25119, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -165592,11 +167554,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 25011, + Fz: __ccgo_ts + 25045, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 25018, + Fz: __ccgo_ts + 25052, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -165607,19 +167569,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 25031, + Fz: __ccgo_ts + 25065, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 25034, + Fz: __ccgo_ts + 25068, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 25037, + Fz: __ccgo_ts + 25071, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 18097, + Fz: __ccgo_ts + 18131, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -165747,8 +167709,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22712, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+25101, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22746, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+25135, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -165769,7 +167731,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -165805,9 +167767,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6908 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6933 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 24103 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 24137 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165829,6 +167791,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -165852,6 +167815,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } @@ -165898,7 +167862,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 25107 + zFilename = __ccgo_ts + 25141 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -166013,6 +167977,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166038,6 +168003,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -166113,20 +168079,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+25110, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+25144, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+25135) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+25169) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+25155) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+25189) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+25162) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+25196) } // C documentation @@ -166191,6 +168157,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -166232,6 +168199,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -166254,7 +168222,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+25179, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+25213, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -166896,6 +168864,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -166915,6 +168884,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -167280,7 +169250,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+25207, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+25241, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -167296,6 +169266,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -167381,6 +169352,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -167401,6 +169373,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -167479,6 +169452,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -167494,7 +169468,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } _leaveMutex(tls) if rc != 0 { - v2 = __ccgo_ts + 25215 + v2 = __ccgo_ts + 25249 } else { v2 = uintptr(0) } @@ -168375,18 +170349,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1636, - 1: __ccgo_ts + 8209, - 2: __ccgo_ts + 8214, - 3: __ccgo_ts + 6629, - 4: __ccgo_ts + 6629, - 5: __ccgo_ts + 6624, - 6: __ccgo_ts + 6624, - 7: __ccgo_ts + 8520, - 8: __ccgo_ts + 8520, - 9: __ccgo_ts + 8520, - 10: __ccgo_ts + 8520, - 11: __ccgo_ts + 25238, - 12: __ccgo_ts + 25244, + 1: __ccgo_ts + 8234, + 2: __ccgo_ts + 8239, + 3: __ccgo_ts + 6654, + 4: __ccgo_ts + 6654, + 5: __ccgo_ts + 6649, + 6: __ccgo_ts + 6649, + 7: __ccgo_ts + 8545, + 8: __ccgo_ts + 8545, + 9: __ccgo_ts + 8545, + 10: __ccgo_ts + 8545, + 11: __ccgo_ts + 25272, + 12: __ccgo_ts + 25278, 13: __ccgo_ts + 1650, 14: __ccgo_ts + 1650, 15: __ccgo_ts + 1650, @@ -168814,6 +170788,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -168901,6 +170876,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -168917,6 +170893,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -169226,6 +171203,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -169239,6 +171217,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -169271,13 +171250,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25251 + uintptr(int32(c)>>int32(4)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25285 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25251 + uintptr(int32(c)&int32(0xf)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25285 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -169312,7 +171292,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1636, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+25268, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15671, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -169333,7 +171313,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25276, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25302, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -169387,7 +171367,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25331, -int32(1)) } } } @@ -169555,6 +171535,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -169577,6 +171558,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -169633,6 +171615,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -169666,8 +171649,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(3), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 25320, - FzRepl: __ccgo_ts + 25324, + FzMatch: __ccgo_ts + 25346, + FzRepl: __ccgo_ts + 25350, }, 1: { Fc1: int8('i'), @@ -169675,8 +171658,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(8), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 25332, - FzRepl: __ccgo_ts + 25324, + FzMatch: __ccgo_ts + 25358, + FzRepl: __ccgo_ts + 25350, }, 2: { Fc1: int8('n'), @@ -169691,7 +171674,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('Q'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 25341, + FzMatch: __ccgo_ts + 25367, FzRepl: __ccgo_ts + 1636, }, 4: { @@ -169699,7 +171682,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('S'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 25346, + FzMatch: __ccgo_ts + 25372, FzRepl: __ccgo_ts + 1636, }, } @@ -169715,7 +171698,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25351, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25377, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -170135,6 +172118,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -170166,7 +172150,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+25394, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25420, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -170283,6 +172267,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { case int32('{'): goto _1 @@ -170363,6 +172348,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170435,6 +172421,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -170474,12 +172461,14 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170542,19 +172531,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -170616,24 +172609,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8209, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8234, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8214, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8239, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -170643,19 +172640,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) c = *(*int8)(unsafe.Pointer(z + uintptr(i))) if int32(c) <= int32('0') { @@ -170670,6 +172679,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -170684,14 +172694,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+25320, int32(3)) == 0 { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+25346, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25403) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25429) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25416, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25442, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -170721,6 +172731,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -170730,6 +172741,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*int8)(unsafe.Pointer(z + uintptr(j))) @@ -170774,6 +172786,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -170786,39 +172799,57 @@ parse_number_2: } } parse_number_finish: + ; if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { i++ } _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -170828,12 +172859,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1636, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*int8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -170851,7 +172884,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -170859,11 +172892,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -170894,7 +172929,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -170907,7 +172942,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -170929,6 +172964,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.X__builtin___memset_chk(tls, bp, 0, uint64(72), libc.X__builtin_object_size(tls, bp, 0)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -171065,22 +173104,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1636, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8209, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8234, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8214, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8239, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -171113,16 +173158,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 25324 + v19 = __ccgo_ts + 25350 } else { - v19 = __ccgo_ts + 12076 + v19 = __ccgo_ts + 12101 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171145,16 +173192,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, int8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, int8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, int8('"')) @@ -171166,6 +173217,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -171177,7 +173229,7 @@ _11: sz2 -= k2 } if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25422, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25448, uint32(2)) zIn2++ sz2-- continue @@ -171191,7 +173243,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, int8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25425, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25451, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -171199,12 +173251,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25432, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25458, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25437, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25463, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -171233,9 +173285,11 @@ _11: _jsonAppendChar(tls, pOut, int8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, int8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -171253,6 +173307,7 @@ _13: _jsonAppendChar(tls, pOut, int8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, int8('{')) j = i + n @@ -171278,11 +173333,14 @@ _14: _jsonAppendChar(tls, pOut, int8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -171353,6 +173411,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -171769,6 +173828,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -171787,6 +173847,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -172000,7 +174061,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -172035,25 +174096,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -172098,11 +174164,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -172115,11 +174184,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -172187,13 +174260,16 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ *(*int8)(unsafe.Pointer(zOut + uintptr(iOut))) = 0 Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -172207,14 +174283,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) return } @@ -172255,7 +174335,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25276, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25302, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -172268,7 +174348,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.X__builtin___memset_chk(tls, pParse, 0, uint64(72), libc.X__builtin_object_size(tls, pParse, 0)) return int32(1) @@ -172287,10 +174367,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } else { if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25403) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25429) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -172329,7 +174409,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25444, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25470, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -172415,15 +174495,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -172508,6 +174590,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -172551,12 +174634,12 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -172596,15 +174679,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -172696,6 +174781,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, int8(']')) @@ -172733,7 +174819,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25462 + v1 = __ccgo_ts + 25488 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -172743,7 +174829,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } eErr = uint8(1) @@ -172774,6 +174860,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -172792,6 +174879,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -172865,9 +174953,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25464, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25490, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5484, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5509, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1663, uint32(1)) @@ -172876,9 +174964,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25466, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25492, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25469, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25495, uint32(1)) } } } @@ -172918,7 +175006,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -172928,6 +175016,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -172938,6 +175027,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -173183,7 +175273,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -173207,7 +175297,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25471, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25497, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -173218,7 +175308,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25522, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25548, -int32(1)) _jsonStringReset(tls, bp) return } @@ -173230,6 +175320,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, int8('}')) @@ -173289,21 +175380,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -173321,7 +175415,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+16110) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+16144) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -173352,9 +175446,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25556 + v1 = __ccgo_ts + 25582 } else { - v1 = __ccgo_ts + 25560 + v1 = __ccgo_ts + 25586 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -173402,7 +175496,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } goto json_type_done @@ -173412,6 +175506,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -173489,7 +175584,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25567, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25593, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -173596,6 +175691,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -173679,7 +175775,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25624, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25650, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -173745,6 +175841,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -173827,7 +175924,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25627, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25653, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -173930,7 +176027,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25630) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25656) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -174064,7 +176161,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { var _ /* sz at bp+0 */ Tu32 _, _, _, _, _ = i, k, n, needQuote, z if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25713, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25739, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -174085,13 +176182,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25720, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25746, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25728, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25754, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -174253,6 +176351,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -174282,9 +176383,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -174343,6 +176444,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -174473,7 +176575,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25734, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25760, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -174494,8 +176596,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25305, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25331, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -174556,176 +176659,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25736, + FzName: __ccgo_ts + 25762, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25741, + FzName: __ccgo_ts + 25767, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25747, + FzName: __ccgo_ts + 25773, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25758, + FzName: __ccgo_ts + 25784, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25770, + FzName: __ccgo_ts + 25796, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25770, + FzName: __ccgo_ts + 25796, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25788, + FzName: __ccgo_ts + 25814, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25808, + FzName: __ccgo_ts + 25834, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25821, + FzName: __ccgo_ts + 25847, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25835, + FzName: __ccgo_ts + 25861, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25838, + FzName: __ccgo_ts + 25864, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25842, + FzName: __ccgo_ts + 25868, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25854, + FzName: __ccgo_ts + 25880, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25867, + FzName: __ccgo_ts + 25893, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25879, + FzName: __ccgo_ts + 25905, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25892, + FzName: __ccgo_ts + 25918, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25903, + FzName: __ccgo_ts + 25929, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25915, + FzName: __ccgo_ts + 25941, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25926, + FzName: __ccgo_ts + 25952, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25938, + FzName: __ccgo_ts + 25964, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25951, + FzName: __ccgo_ts + 25977, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25964, + FzName: __ccgo_ts + 25990, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25978, + FzName: __ccgo_ts + 26004, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25987, + FzName: __ccgo_ts + 26013, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25997, + FzName: __ccgo_ts + 26023, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25997, + FzName: __ccgo_ts + 26023, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 26007, + FzName: __ccgo_ts + 26033, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 26007, + FzName: __ccgo_ts + 26033, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 26018, + FzName: __ccgo_ts + 26044, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 26035, + FzName: __ccgo_ts + 26061, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 26053, + FzName: __ccgo_ts + 26079, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 26071, + FzName: __ccgo_ts + 26097, }, } @@ -174795,6 +176898,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -174805,11 +176909,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 26090, + FzName: __ccgo_ts + 26116, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 26100, + FzName: __ccgo_ts + 26126, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -175339,6 +177443,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -175373,6 +177478,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -175412,11 +177518,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -175456,10 +177560,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+26110, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+26136, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -175513,6 +177616,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -175541,6 +177645,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -175760,7 +177865,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+26115, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+26141, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -175821,6 +177926,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -175834,6 +177940,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -175857,7 +177964,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -176163,6 +178272,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -176592,6 +178708,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -176667,7 +178786,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+26197) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+26223) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -176804,6 +178923,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -176891,6 +179011,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } ii = 0 @@ -176909,6 +179030,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -176960,6 +179082,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -177122,6 +179245,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -177137,6 +179261,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -177220,11 +179345,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -177280,6 +179407,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -177303,6 +179431,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -177311,6 +179440,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -177483,11 +179613,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -177518,6 +179650,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -177531,6 +179664,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -177540,6 +179674,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.X__builtin___memcpy_chk(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48), libc.X__builtin_object_size(tls, pBboxLeft, 0)) @@ -177566,6 +179701,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -177593,6 +179729,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -177641,6 +179778,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -177721,6 +179859,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -177736,6 +179875,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -177752,6 +179892,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -177796,6 +179937,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -177886,6 +180028,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -177995,6 +180138,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -178097,6 +180241,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -178175,7 +180320,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26211, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26237, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -178185,11 +180330,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26231, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26257, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26263, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26289, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178263,6 +180408,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -178279,6 +180425,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -178342,6 +180489,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -178349,6 +180497,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -178362,7 +180511,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -178381,6 +180530,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -178394,7 +180547,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26300, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26326, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -178448,9 +180601,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26445 + zFmt = __ccgo_ts + 26471 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11905, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11930, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -178501,15 +180654,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26501, - 1: __ccgo_ts + 5807, - 2: __ccgo_ts + 17011, + 0: __ccgo_ts + 26527, + 1: __ccgo_ts + 5832, + 2: __ccgo_ts + 17045, } var _rtreeModule = Tsqlite3_module{ @@ -178534,7 +180688,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) @@ -178553,20 +180707,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26915, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26941, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26977, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27003, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26982, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+27046, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+27116, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27008, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27072, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27142, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -178596,7 +180751,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 27165 + zFormat = __ccgo_ts + 27191 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -178607,33 +180762,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+27273, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+27299, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27318, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27344, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13438, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27345, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27371, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27367, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27393, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27375, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27401, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -178647,14 +180804,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26506, - 1: __ccgo_ts + 26559, - 2: __ccgo_ts + 26604, - 3: __ccgo_ts + 26656, - 4: __ccgo_ts + 26710, - 5: __ccgo_ts + 26755, - 6: __ccgo_ts + 26813, - 7: __ccgo_ts + 26868, + 0: __ccgo_ts + 26532, + 1: __ccgo_ts + 26585, + 2: __ccgo_ts + 26630, + 3: __ccgo_ts + 26682, + 4: __ccgo_ts + 26736, + 5: __ccgo_ts + 26781, + 6: __ccgo_ts + 26839, + 7: __ccgo_ts + 26894, } // C documentation @@ -178712,7 +180869,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27391, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27417, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -178723,14 +180880,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27411, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27437, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+32) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -178807,13 +180964,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, 0)) - libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27654, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) + libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27680, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27660, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27686, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -178822,7 +180979,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27684, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27710, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -178833,9 +180990,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27711, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27737, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -178887,6 +181045,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -178895,8 +181054,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27690, - 1: __ccgo_ts + 27701, + 0: __ccgo_ts + 27716, + 1: __ccgo_ts + 27727, } // C documentation @@ -178954,22 +181113,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11525, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11550, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27714, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27740, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27720, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27746, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27724, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27750, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -178993,7 +181154,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27726, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27752, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -179111,11 +181272,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4526 + v1 = __ccgo_ts + 4551 } else { v1 = __ccgo_ts + 1650 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27759, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27785, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -179149,7 +181310,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27766, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27792, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -179166,7 +181327,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27811, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27837, libc.VaList(bp+8, iNode)) } } return pRet @@ -179195,8 +181356,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27843, - 1: __ccgo_ts + 27897, + 0: __ccgo_ts + 27869, + 1: __ccgo_ts + 27923, } if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) @@ -179209,21 +181370,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27945 + v1 = __ccgo_ts + 27971 } else { - v1 = __ccgo_ts + 27953 + v1 = __ccgo_ts + 27979 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27962, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27988, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27945 + v2 = __ccgo_ts + 27971 } else { - v2 = __ccgo_ts + 27953 + v2 = __ccgo_ts + 27979 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28007, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28033, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -179268,7 +181429,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28065, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28091, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -179286,11 +181447,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28113, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28139, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -179318,19 +181480,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28180, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28206, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28214, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28240, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28244, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28270, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -179350,6 +181512,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -179374,12 +181537,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+28299, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+28325, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28330, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28356, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -179408,7 +181571,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28397, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28423, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -179418,11 +181581,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+26211, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+26237, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28425, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28451, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -179438,8 +181601,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28456, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28463, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28482, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28489, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -179466,7 +181629,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28471, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28497, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -179517,13 +181680,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28490, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28516, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6908 + zDb = __ccgo_ts + 6933 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -179532,7 +181695,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18824 + v1 = __ccgo_ts + 18858 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -179755,6 +181918,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -179865,6 +182029,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -179925,6 +182090,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -179995,18 +182161,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25464, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25490, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28541, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28567, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28552, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28578, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180035,19 +182202,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = int8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28563, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28589, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28581, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28607, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = int8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28589, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28615, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -180055,13 +182223,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28597, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28623, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28601, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28627, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180113,6 +182282,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -180142,6 +182312,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -180207,6 +182378,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -180284,6 +182456,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -180353,6 +182526,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -180362,6 +182536,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -180389,18 +182564,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.X__builtin___memset_chk(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4), libc.X__builtin_object_size(tls, aCoord, 0)) } _2: + ; return pOut } @@ -180583,6 +182762,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -180759,6 +182939,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -180825,6 +183006,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -180833,6 +183015,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -180844,6 +183027,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -180912,6 +183096,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -180928,6 +183113,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -180994,6 +183180,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -181018,6 +183205,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181054,6 +183242,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181078,6 +183267,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -181167,13 +183357,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, 0)) - libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27654, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) + libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27680, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28614, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28640, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -181182,12 +183372,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28636, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28662, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27711, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27737, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -181216,6 +183407,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -181363,6 +183555,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -181413,11 +183606,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17011 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17045 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -181427,7 +183621,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28640 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28666 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -181435,7 +183629,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28646 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28672 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -181555,7 +183749,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28655, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28681, 0) } goto geopoly_update_end } @@ -181634,6 +183828,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -181642,6 +183837,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -181655,12 +183851,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28695) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28721) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28711) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28737) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -181716,6 +183912,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -181726,10 +183923,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28888, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28914, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -181743,61 +183941,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28726, + FzName: __ccgo_ts + 28752, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28739, + FzName: __ccgo_ts + 28765, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28752, + FzName: __ccgo_ts + 28778, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28765, + FzName: __ccgo_ts + 28791, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28711, + FzName: __ccgo_ts + 28737, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28777, + FzName: __ccgo_ts + 28803, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28695, + FzName: __ccgo_ts + 28721, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28800, + FzName: __ccgo_ts + 28826, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28814, + FzName: __ccgo_ts + 28840, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28827, + FzName: __ccgo_ts + 28853, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28841, + FzName: __ccgo_ts + 28867, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28857, + FzName: __ccgo_ts + 28883, }, } @@ -181823,7 +184021,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28869, + FzName: __ccgo_ts + 28895, }, } @@ -181848,20 +184046,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28896, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28922, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28906, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28932, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28917, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28943, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28640, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28666, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28928, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28954, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -181906,6 +184104,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -181955,13 +184154,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+26197, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+26223, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -183178,7 +185378,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28938, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28964, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -183188,7 +185388,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28938, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28964, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -183290,6 +185490,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -183368,7 +185569,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28959, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28985, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -183456,7 +185657,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+26110, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+26136, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -183464,6 +185665,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -183492,13 +185694,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.X__builtin___memset_chk(tls, pIter, 0, uint64(192), libc.X__builtin_object_size(tls, pIter, 0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 29130 + v1 = __ccgo_ts + 29156 } else { v1 = __ccgo_ts + 1650 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29171, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29197, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+29321) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+29347) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -183726,7 +185928,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29446, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29472, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -183736,7 +185938,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29565, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29591, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -183744,7 +185946,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29586, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29612, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -183756,7 +185958,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29637, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29663, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -183767,6 +185969,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -183775,6 +185978,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -183797,7 +186001,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.X__builtin___memcpy_chk(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol), libc.X__builtin_object_size(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29658, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29684, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -183810,7 +186014,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.X__builtin___memset_chk(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol), libc.X__builtin_object_size(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -183863,7 +186067,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+20265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+20299, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -183874,7 +186078,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29715, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29741, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -183885,7 +186089,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29734, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29760, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -183893,12 +186097,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29739, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29765, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -183906,17 +186111,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29749 + v4 = __ccgo_ts + 29775 } else { - v4 = __ccgo_ts + 29762 + v4 = __ccgo_ts + 29788 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29771, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29797, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29800, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29826, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -183933,11 +186138,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29822, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29848, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -183983,10 +186189,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29849, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29875, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 15338 goto _1 _1: + ; i++ } return zList @@ -184017,12 +186224,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29858, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29884, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -184064,21 +186272,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29871, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29897, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29903, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+29926) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29932, __ccgo_ts+29939, __ccgo_ts+5429) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+29952) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29958, __ccgo_ts+29965, __ccgo_ts+5454) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+1650) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29947, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29973, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29989, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+30015, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -184130,7 +186338,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1650 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -184147,19 +186355,20 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 30009 + zCol = __ccgo_ts + 30035 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+30017, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30038, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 15313 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+30043, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30064, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+30100, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 15338 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -184168,7 +186377,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30101, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30127, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { zSep = __ccgo_ts + 1650 iCol = 0 @@ -184185,19 +186394,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+30149, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 15313 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+30175, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 15338 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+30156, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+30182, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -184248,7 +186459,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zAnd = __ccgo_ts + 1650 /* Set to " AND " later on */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184257,7 +186468,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30168, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30194, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) zType = __ccgo_ts + 1650 } else { if iCid < 0 { @@ -184271,14 +186482,15 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 30009 + zCol = __ccgo_ts + 30035 } else { - zCol = __ccgo_ts + 29739 + zCol = __ccgo_ts + 29765 } } zType = __ccgo_ts + 1138 @@ -184286,24 +186498,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30190, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30216, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29926 + v2 = __ccgo_ts + 29952 } else { v2 = __ccgo_ts + 1650 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+30210, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+30236, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+30231, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+30264, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+30257, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+30290, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 15313 - zAnd = __ccgo_ts + 22374 + zCom = __ccgo_ts + 15338 + zAnd = __ccgo_ts + 22408 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184357,22 +186569,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+30288, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+30314, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+30300, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+30326, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 15313 + zS = __ccgo_ts + 15338 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30309, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30335, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -184398,7 +186611,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30324, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1650 @@ -184408,14 +186621,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30338, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 22374 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30364, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22408 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30376, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1650 i1 = 0 @@ -184425,11 +186639,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30400, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 22374 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30426, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22408 } goto _2 _2: + ; i1++ } } @@ -184448,7 +186663,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30413, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30439, 0) } // C documentation @@ -184490,21 +186705,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30400, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30426, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30439, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30465, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30469, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30495, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } } } goto _1 _1: + ; i++ } } @@ -184552,6 +186768,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) goto _1 _1: + ; i++ } } @@ -184581,16 +186798,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 z = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30506 + zSep = __ccgo_ts + 30532 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29658, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29684, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16899) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16933) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) } break } @@ -184601,16 +186818,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29926 + v1 = __ccgo_ts + 29952 } else { v1 = __ccgo_ts + 1650 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30519, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 15313 + z = _rbuMPrintf(tls, p, __ccgo_ts+30545, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 15338 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30530, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30556, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -184656,7 +186873,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30534) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30560) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184664,7 +186881,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -184673,21 +186890,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30584, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30610, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29926 + v1 = __ccgo_ts + 29952 } else { v1 = __ccgo_ts + 1650 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30606, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 15313 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30632, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 15338 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30616, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30642, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30631, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30657, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) } } @@ -184724,7 +186941,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1650 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -184733,37 +186950,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1650 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30693 + zPk = __ccgo_ts + 30719 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30706 + v2 = __ccgo_ts + 30732 } else { v2 = __ccgo_ts + 1650 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30716, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 15313 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30742, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 15338 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30743, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30769, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30750 + v3 = __ccgo_ts + 30776 } else { v3 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30765, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30791, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) } } @@ -184789,7 +187007,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30797, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30823, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -184810,6 +187028,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -184834,7 +187053,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc zRet = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30854) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30880) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -184903,6 +187122,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -184917,6 +187137,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -184928,6 +187149,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -184942,6 +187164,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -184957,6 +187180,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -184998,7 +187222,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30920, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30946, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -185015,18 +187239,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30940, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30966, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31005, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31031, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31041, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31067, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185041,26 +187265,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 31075 + v2 = __ccgo_ts + 31101 } else { - v2 = __ccgo_ts + 31079 + v2 = __ccgo_ts + 31105 } v1 = v2 } else { v1 = __ccgo_ts + 1650 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31085, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31111, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31146, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31172, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 31075 + v3 = __ccgo_ts + 31101 } else { - v3 = __ccgo_ts + 31079 + v3 = __ccgo_ts + 31105 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31207, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31233, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185079,8 +187303,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6919) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6915) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6944) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6940) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -185089,39 +187313,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1650 } else { - v4 = __ccgo_ts + 31366 + v4 = __ccgo_ts + 31392 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 31375 + v5 = __ccgo_ts + 31401 } else { v5 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31385, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31411, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31421, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31447, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31449 + zRbuRowid = __ccgo_ts + 31475 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31461 + v6 = __ccgo_ts + 31487 } else { v6 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31478, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31554, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31504, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31580, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31853, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31879, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -185132,9 +187356,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31952 + v7 = __ccgo_ts + 31978 } else { - v7 = __ccgo_ts + 31962 + v7 = __ccgo_ts + 31988 } zRbuRowid1 = v7 } @@ -185147,14 +187371,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30009, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30035, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+1650) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31973 + v8 = __ccgo_ts + 31999 } else { v8 = __ccgo_ts + 1650 } @@ -185164,11 +187388,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1650 } if zOrder != 0 { - v10 = __ccgo_ts + 23568 + v10 = __ccgo_ts + 23602 } else { v10 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31979, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+32005, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -185225,6 +187449,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { @@ -185235,6 +187460,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -185254,9 +187480,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 31366 + zPrefix = __ccgo_ts + 31392 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+32027, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+32053, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -185330,7 +187556,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32057, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32083, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -185389,27 +187615,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+32087, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+32113, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32115, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32141, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+3420, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) } else { - libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+6908, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) + libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+6933, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32133, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32159, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -185442,10 +187668,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32199, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32225, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24957, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24991, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*int8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -185461,14 +187687,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 32231 + v2 = __ccgo_ts + 32257 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1650 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+32233, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+32259, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -185479,27 +187705,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32265, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32291, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32306, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32297, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32323, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32313, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32339, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32341, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32367, 0) } } @@ -185583,7 +187809,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32313, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32339, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -185616,7 +187842,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32359, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32385, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -185749,16 +187975,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -185780,7 +188006,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32394, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32420, 0) } // C documentation @@ -185797,13 +188023,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32419, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32426, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32445, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32452, libc.VaList(bp+8, zMove)) if zWal == uintptr(0) || zOal == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -185935,7 +188161,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24514, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24548, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -185948,6 +188174,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -186026,6 +188253,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -186069,7 +188297,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32433) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32459) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -186082,7 +188310,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32455, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32481, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -186109,7 +188337,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd } pFd = v1 - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32482, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32508, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -186145,9 +188373,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32640, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32666, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32655, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32681, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -186170,9 +188398,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { _, _ = i, zSql *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32675, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32701, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32700) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32726) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186183,10 +188411,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32808) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32834) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32873) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32899) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -186197,13 +188425,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32917, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32943, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -186230,8 +188459,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+18000) - _rbuCopyPragma(tls, p, __ccgo_ts+17095) + _rbuCopyPragma(tls, p, __ccgo_ts+18034) + _rbuCopyPragma(tls, p, __ccgo_ts+17129) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -186239,7 +188468,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32942, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32968, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -186261,10 +188490,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -186351,7 +188580,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32970, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32996, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -186374,10 +188603,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32419, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32445, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } @@ -186399,7 +188628,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { var _ /* zRnd at bp+4 */ [64]int8 _ = pVfs Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32995, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+33021, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -186445,7 +188674,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain } db = v1 - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+33006, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+33032, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -186490,11 +188719,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33078, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33104, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33092) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33118) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -186503,7 +188732,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33149) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33175) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186583,7 +188812,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33223, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33249, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -186605,17 +188834,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 33255 + v3 = __ccgo_ts + 33281 } else { - v3 = __ccgo_ts + 33262 + v3 = __ccgo_ts + 33288 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33269, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33295, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15202, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15227, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -186627,21 +188856,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17714) - _rbuCopyPragma(tls, p, __ccgo_ts+17110) + _rbuCopyPragma(tls, p, __ccgo_ts+17748) + _rbuCopyPragma(tls, p, __ccgo_ts+17144) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33301, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33327, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33317, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33343, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -186719,7 +188948,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+33341, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+33367, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -186766,7 +188995,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31366, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31392, uint64(8)) == 0 { nDel = int32(8) for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -186776,6 +189005,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -186793,7 +189023,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -186802,7 +189032,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -186812,7 +189042,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33349, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33375, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186913,7 +189143,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -186926,19 +189156,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 15202 + v1 = __ccgo_ts + 15227 } else { - v1 = __ccgo_ts + 33301 + v1 = __ccgo_ts + 33327 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33301, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33327, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -187048,6 +189278,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -187095,6 +189326,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187107,6 +189339,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -187133,6 +189366,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187146,6 +189380,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187178,6 +189413,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -187188,6 +189424,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -187214,6 +189451,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -187496,7 +189734,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33376, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33402, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -187522,7 +189760,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33399, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33425, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -187717,7 +189955,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6908) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6933) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -187731,7 +189969,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33410, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33436, 0) != 0 { oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) } @@ -188284,7 +190522,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12514, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12539, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -188354,16 +190592,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -188431,6 +190670,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -188466,6 +190706,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -188659,17 +190900,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -188759,6 +191003,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -188812,8 +191057,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33421 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33430, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33447 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33456, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -188842,7 +191087,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg @@ -188853,7 +191098,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33442, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33468, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -188873,16 +191118,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33450 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33476 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33459 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33485 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33464 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33490 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -188907,6 +191152,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -188979,12 +191225,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33474, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33500, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33629, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33655, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33643, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33669, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -189006,37 +191252,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -189061,7 +191307,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33658, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33684, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -189730,6 +191976,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -192893,6 +195182,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -192974,7 +195264,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -192998,7 +195288,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -193013,7 +195303,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -193028,6 +195318,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -193068,7 +195359,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -193128,6 +195419,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -193172,7 +195464,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -193230,6 +195522,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.X__builtin___memset_chk(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2), libc.X__builtin_object_size(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0)) @@ -193277,7 +195570,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -193287,7 +195580,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -193307,6 +195600,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -193365,7 +195659,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -193373,6 +195667,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -193405,6 +195700,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -193613,6 +195909,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -193733,6 +196030,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -193752,6 +196050,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -193762,6 +196061,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.X__builtin___memset_chk(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2), libc.X__builtin_object_size(tls, apVal, 0)) @@ -193769,7 +196069,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { @@ -193790,6 +196090,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -193936,6 +196237,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -193969,7 +196271,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11905) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11930) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -193978,9 +196280,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.X__builtin___memset_chk(tls, bp+8, 0, uint64(16), libc.X__builtin_object_size(tls, bp+8, 0)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.X__builtin___memcpy_chk(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4), libc.X__builtin_object_size(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, 0)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34302, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34328, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34315, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34341, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -193990,17 +196292,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34321, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34347, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 15313 + zSep = __ccgo_ts + 15338 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1650 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34326, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34352, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -194009,16 +196312,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34334, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34360, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34409, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34435, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 22374 + zSep = __ccgo_ts + 22408 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194062,6 +196366,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -194100,9 +196405,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34415, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34441, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34326, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34352, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -194112,18 +196417,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34321, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34347, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 22374 + zSep = __ccgo_ts + 22408 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34433, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34459, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33897, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33923, bp) zSep = __ccgo_ts + 1650 i = 0 for { @@ -194133,15 +196439,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34409, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34435, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34441 + zSep = __ccgo_ts + 34467 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5429, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5454, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -194167,7 +196474,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6908, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6933, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -194190,34 +196497,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34446, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34472, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+22380, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22414, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+15313, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+15338, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34464, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34490, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34475, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34501, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5429, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5454, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -194240,12 +196549,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11905, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11930, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34479) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34505) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34592) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34618) } return rc } @@ -194311,13 +196620,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -194377,6 +196687,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -194442,6 +196753,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -194642,6 +196954,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -194723,7 +197036,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34736, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34762, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -194736,7 +197049,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34757, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34783, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -194830,10 +197143,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34776, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34802, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34802, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34828, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -194874,7 +197187,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6908, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6933, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -194888,22 +197201,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34832, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34858, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34876, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34902, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34947, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34973, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11905) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11930) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -194960,13 +197274,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+35007, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35033, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+35037, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+35063, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+35061, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+35037, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35087, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35063, uintptr(0), uintptr(0), uintptr(0)) } } if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { @@ -195122,6 +197436,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195168,6 +197483,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195294,6 +197610,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -195356,6 +197673,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -195372,6 +197690,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -195383,6 +197702,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -195395,6 +197715,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -195456,6 +197777,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -195489,6 +197811,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -195533,6 +197856,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -195613,14 +197937,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -195851,6 +198178,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -195922,6 +198250,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -195945,6 +198274,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -196002,6 +198332,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -196032,6 +198363,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -197377,23 +199709,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -197525,7 +199857,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35089, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35115, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -197708,116 +200040,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) @@ -197848,7 +200210,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35117, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35143, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -198151,7 +200513,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+35148, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+35174, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -198248,7 +200610,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 35155 + zErr = __ccgo_ts + 35181 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -198376,6 +200738,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -198428,6 +200791,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -198492,7 +200856,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 35205 + zErr = __ccgo_ts + 35231 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -198573,6 +200937,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -198594,11 +200959,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -198760,6 +201127,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -198824,6 +201192,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -198842,6 +201211,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -198866,15 +201236,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 35253, + FzFunc: __ccgo_ts + 35279, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 35261, + FzFunc: __ccgo_ts + 35287, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 35271, + FzFunc: __ccgo_ts + 35297, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -198887,6 +201257,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -199396,6 +201767,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35283, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35309, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35314, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35340, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -199773,7 +202148,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35347, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35373, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -199783,7 +202158,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35384, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35410, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -199791,7 +202166,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35393, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35419, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -199814,10 +202189,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35426, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35452, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -199828,58 +202204,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35460, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35486, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35468, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35494, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35500, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35526, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35506, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35532, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35525, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35551, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35568, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35594, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35582, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35608, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35620, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35646, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35631, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35657, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5822, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5847, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8541, + FzName: __ccgo_ts + 8566, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 18080, + FzName: __ccgo_ts + 18114, }, 2: { - FzName: __ccgo_ts + 35666, + FzName: __ccgo_ts + 35692, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -199887,20 +202263,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35674, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35700, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35705, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35731, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35715, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35741, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35749, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35775, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -199972,15 +202348,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35777) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+17011) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35782, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35803) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+17045) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35808, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35812) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35838) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35822, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35848, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -200006,7 +202382,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35853, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35879, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -200014,12 +202390,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35858, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35884, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35865, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35891, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } @@ -200075,8 +202452,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35777) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35873, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35803) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35899, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } i = int32(3) @@ -200107,7 +202484,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35902, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35928, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -200132,11 +202509,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35922, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35948, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -200144,7 +202522,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35972, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35998, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -200157,18 +202535,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { zTail = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35460 + zTail = __ccgo_ts + 35486 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 36027 + zTail = __ccgo_ts + 36053 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36035, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36061, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+17011, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+17045, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200203,6 +202581,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -200231,7 +202610,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36046, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36072, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -200240,15 +202619,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 15313 + v2 = __ccgo_ts + 15338 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36062, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36088, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36069, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35777)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36095, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35803)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) @@ -200394,7 +202774,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36095) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36121) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -200405,7 +202785,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36100) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36126) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -200416,7 +202796,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36109) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36135) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -200430,7 +202810,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36119) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36145) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -200441,7 +202821,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36129) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36155) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -200458,7 +202838,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36141) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36167) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -200473,7 +202853,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35777) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35803) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -200488,7 +202868,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36153) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36179) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -200530,7 +202910,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 36167 + zSelect = __ccgo_ts + 36193 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -200550,7 +202930,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+36199) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+36225) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -200562,7 +202942,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36207, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36233, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -200783,17 +203163,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36278, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36304, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36298, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36324, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -200804,16 +203185,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36329, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36355, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36332, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36358, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+31075, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+31101, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -200917,6 +203299,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -200977,6 +203360,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -201034,6 +203418,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -201081,6 +203466,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -201124,6 +203510,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -201180,6 +203567,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -201208,6 +203596,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -201361,6 +203755,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -201484,6 +203879,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -201512,6 +203908,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -201528,6 +203925,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -201543,6 +203941,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -201550,6 +203949,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -201613,6 +204013,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -201650,6 +204051,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -201675,6 +204077,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -201747,6 +204150,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -201755,11 +204159,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -201806,6 +204212,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -201825,6 +204232,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -201836,6 +204244,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -201938,10 +204347,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -201998,6 +204409,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -202078,6 +204490,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -202108,6 +204521,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -202163,6 +204577,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -202288,6 +204703,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -202417,10 +204833,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -202638,6 +205056,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -202792,6 +205211,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -202800,6 +205220,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -202843,8 +205264,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+36336, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35117, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+36362, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35143, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -202864,12 +205285,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36341, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36367, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -202918,6 +205340,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -202928,6 +205351,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -202966,6 +205390,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -202994,10 +205419,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21377, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21411, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -203103,6 +205529,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -203120,7 +205547,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36370, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36396, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -203177,6 +205604,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -203232,6 +205660,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -203304,17 +205733,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36423 + v2 = __ccgo_ts + 36449 } else { - v2 = __ccgo_ts + 36336 + v2 = __ccgo_ts + 36362 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36430, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36456, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -203323,7 +205753,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36480, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36506, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -203484,6 +205914,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -203524,6 +205955,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -203546,6 +205978,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -203598,10 +206031,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -203631,6 +206066,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -203650,6 +206086,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -203677,6 +206114,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -203691,6 +206129,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -203811,10 +206250,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -203987,10 +206428,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.X__builtin___memset_chk(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8), libc.X__builtin_object_size(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0)) @@ -204010,6 +206453,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -205850,6 +208308,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -205958,7 +208417,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36684, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36710, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -206042,7 +208501,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { - libc.X__builtin___memcpy_chk(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36679, uint64(4), libc.X__builtin_object_size(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), 0)) + libc.X__builtin___memcpy_chk(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36705, uint64(4), libc.X__builtin_object_size(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), 0)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -206075,10 +208534,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -206130,10 +208591,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -206179,6 +208642,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -206195,6 +208659,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -206244,6 +208709,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -206312,6 +208778,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -206343,6 +208810,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -206430,6 +208898,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -206466,6 +208935,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -206982,6 +209452,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -207177,6 +209648,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -207305,6 +209777,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -207341,6 +209814,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -207371,6 +209845,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -209739,6 +212239,7 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int } goto _1 _1: + ; ii++ } } @@ -209787,6 +212288,7 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin } goto _1 _1: + ; iLvl++ } if nBest < nMin { @@ -209919,7 +212421,7 @@ func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int defer tls.Free(32) if iPgno != int32(1) { if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { - _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36930, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36956, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) @@ -210042,6 +212544,7 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } goto _1 _1: + ; pgno++ } _fts5DataRelease(tls, pLeaf) @@ -210231,6 +212734,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) goto _3 _3: + ; iKey++ } /* Set iDelKeyOff to the value of the footer entry to remove from @@ -210298,6 +212802,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } goto _6 _6: + ; iPgno-- } if iPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { @@ -210692,6 +213197,7 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint } goto _1 _1: + ; i++ } nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) @@ -210728,10 +213234,12 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint iSegOut++ goto _4 _4: + ; iSeg++ } goto _3 _3: + ; iLvl-- } v5 = nSeg @@ -210769,6 +213277,7 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iLvl++ } for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { @@ -211045,6 +213554,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -211145,6 +213655,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -211217,6 +213728,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -211259,6 +213771,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -211271,11 +213784,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -211284,6 +213799,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } i = 0 @@ -211302,10 +213818,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -211420,11 +213938,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36991, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37017, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+26110, __ccgo_ts+36999, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+26136, __ccgo_ts+37025, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+12116, __ccgo_ts+37034, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+12141, __ccgo_ts+37060, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -211501,6 +214019,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -211562,6 +214081,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -211683,6 +214203,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -211767,6 +214288,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -211806,6 +214328,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -211847,6 +214370,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -211880,9 +214404,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -211890,16 +214415,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -211948,7 +214476,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+37078) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+37104) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -212007,10 +214535,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -212036,6 +214566,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -212063,11 +214594,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -212143,6 +214676,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -212360,6 +214894,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -212412,6 +214947,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -212460,7 +214996,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Binary representation of iNew */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36533, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36559, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -212600,6 +215136,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -212653,6 +215190,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -212664,6 +215202,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -212762,6 +215301,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -212849,6 +215389,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -212892,10 +215433,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -212932,6 +215475,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -213281,6 +215830,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -213859,7 +216409,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) bSeenMatch = 0 bSeenRank = 0 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37171, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37197, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -213898,7 +216448,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5461, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5486, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) } } @@ -213918,7 +216468,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5461, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5486, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -213938,6 +216488,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -213977,6 +216528,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -214055,6 +216607,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -214152,6 +216705,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -214185,6 +216739,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -214226,6 +216781,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -214256,6 +216812,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -214411,7 +216968,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 15313 + v1 = __ccgo_ts + 15338 } else { v1 = __ccgo_ts + 1650 } @@ -214421,11 +216978,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1650 } if bDesc != 0 { - v3 = __ccgo_ts + 37210 + v3 = __ccgo_ts + 37236 } else { - v3 = __ccgo_ts + 37215 + v3 = __ccgo_ts + 37241 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+37219, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+37245, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr @@ -214479,17 +217036,18 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+37274, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+37300, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5804, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5829, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37280, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -214516,6 +217074,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -214538,7 +217097,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37308, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37334, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) @@ -214557,6 +217116,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } @@ -214570,7 +217130,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37318, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37344, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -214604,7 +217164,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37339, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37365, libc.VaList(bp+24, z)) } } } else { @@ -214612,7 +217172,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 35271 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 35297 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -214663,7 +217223,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37171, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37197, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -214739,6 +217299,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -214806,7 +217367,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37372, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -214831,6 +217392,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -214986,36 +217548,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37408, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37434, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37419, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37445, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37499, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37525, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37507, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37533, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17694, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17728, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37563, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37589, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37569, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37595, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37585, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37611, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -215113,9 +217675,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+18214, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+18248, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37591, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37617, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -215144,11 +217706,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 21230 + v1 = __ccgo_ts + 21264 } else { - v1 = __ccgo_ts + 37650 + v1 = __ccgo_ts + 37676 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37662, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37688, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -215199,7 +217761,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -215368,6 +217930,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -215438,6 +218001,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -215453,6 +218017,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -215580,6 +218145,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -215598,6 +218164,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -215614,6 +218181,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -215651,6 +218219,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -215690,6 +218259,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -215944,6 +218514,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -215970,6 +218541,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -215985,7 +218557,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37699, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37725, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -216052,9 +218624,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -216062,10 +218636,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -216076,10 +218652,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -216090,6 +218668,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -216102,12 +218681,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -216166,7 +218748,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37720, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37746, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -216364,6 +218946,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -216407,7 +218990,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr pMod = _fts5LocateTokenizer(tls, pGlobal, v1) if pMod == uintptr(0) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37791, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37817, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -216423,7 +219006,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37813, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37839, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -216452,6 +219035,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -216466,6 +219050,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -216476,7 +219061,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37844) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37870) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -216490,7 +219075,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37857, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37883, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -216512,17 +219097,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37948, - 1: __ccgo_ts + 35460, - 2: __ccgo_ts + 26110, - 3: __ccgo_ts + 36027, - 4: __ccgo_ts + 12116, + 0: __ccgo_ts + 37974, + 1: __ccgo_ts + 35486, + 2: __ccgo_ts + 26136, + 3: __ccgo_ts + 36053, + 4: __ccgo_ts + 12141, } // C documentation @@ -216542,10 +219128,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37955, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37981, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38001, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38027, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -216568,7 +219154,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+38064, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+38090, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -216585,10 +219171,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38064, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38090, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38069, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38095, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -216691,17 +219277,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, ** statements to operate on it. */ if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 38084, - 1: __ccgo_ts + 38152, - 2: __ccgo_ts + 38221, - 3: __ccgo_ts + 38254, - 4: __ccgo_ts + 38293, - 5: __ccgo_ts + 38333, - 6: __ccgo_ts + 38372, - 7: __ccgo_ts + 38415, - 8: __ccgo_ts + 38454, - 9: __ccgo_ts + 38498, - 10: __ccgo_ts + 38538, + 0: __ccgo_ts + 38110, + 1: __ccgo_ts + 38178, + 2: __ccgo_ts + 38247, + 3: __ccgo_ts + 38280, + 4: __ccgo_ts + 38319, + 5: __ccgo_ts + 38359, + 6: __ccgo_ts + 38398, + 7: __ccgo_ts + 38441, + 8: __ccgo_ts + 38480, + 9: __ccgo_ts + 38524, + 10: __ccgo_ts + 38564, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -216729,6 +219315,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = int8(',') goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = int8('\000') @@ -216737,14 +219324,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38561 + v2 = __ccgo_ts + 38587 } else { v2 = __ccgo_ts + 1650 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38564 + v3 = __ccgo_ts + 38590 } else { v3 = __ccgo_ts + 1650 } @@ -216802,12 +219389,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38572, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38598, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38676, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38702, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38714, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38740, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -216816,7 +219403,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38752, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38778, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -216828,14 +219415,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+26110, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+12116, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37948, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+26136, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+12141, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37974, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+36027, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+36053, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35460, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35486, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -216855,13 +219442,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30750 + v1 = __ccgo_ts + 30776 } else { v1 = __ccgo_ts + 1650 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38794, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38820, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38824, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38850, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -216902,35 +219489,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38868, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38894, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38891, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38917, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35460, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35486, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38897 + zCols = __ccgo_ts + 38923 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38929 + zCols = __ccgo_ts + 38955 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+36027, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+36053, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37948, __ccgo_ts+38977, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37974, __ccgo_ts+39003, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -216959,6 +219547,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -217059,6 +219648,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -217197,6 +219787,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -217269,9 +219860,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38994, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39020, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39044, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39070, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -217279,7 +219870,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -217326,6 +219917,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -217423,6 +220015,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -217471,6 +220064,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -217490,7 +220084,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+39073, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+39099, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -217588,6 +220182,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -217664,6 +220259,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -217690,6 +220286,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -217697,14 +220294,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35460, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35486, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -218597,15 +221210,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -218667,7 +221285,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 39165 + zBase = __ccgo_ts + 39191 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -218758,6 +221376,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -218773,6 +221392,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -218831,6 +221451,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39175, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39201, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39178, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39204, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39183, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39209, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39188, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39214, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39191, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39217, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39194, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39220, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39199, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39225, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39204, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39230, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39208, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39234, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39214, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39240, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39219, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39245, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -218944,49 +221566,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39223, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39249, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39227, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39253, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39230, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39256, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39234, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39260, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39238, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39264, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39242, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39268, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39246, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39272, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39250, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39276, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219003,20 +221625,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39254, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39280, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39257, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39283, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39264, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39290, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -219032,75 +221654,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39267, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39293, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39275, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39301, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39282, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39308, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39287, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39313, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39183, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39209, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39292, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39318, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39178, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39204, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39297, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39323, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39302, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39328, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+16221, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+16255, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39307, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39333, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39311, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39337, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39316, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39342, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39219, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39245, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39322, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39348, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39326, uint64(1), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39352, uint64(1), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39328, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39354, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39242, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39268, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -219109,48 +221731,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39334, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39360, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39342, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39368, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39348, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39374, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39353, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39379, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39359, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39385, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39246, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39272, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39367, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39393, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39375, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39401, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39379, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39405, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39242, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39268, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -219158,21 +221780,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39387, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39413, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39393, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39419, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39246, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39272, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39399, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39425, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -219190,48 +221812,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39406, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39432, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39411, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39437, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39416, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39442, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39422, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39448, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39375, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39401, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39428, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39454, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39434, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39460, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -219247,13 +221869,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39440, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39466, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39444, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39470, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39447, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39473, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -219261,7 +221883,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39450, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39476, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -219347,6 +221969,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -219420,14 +222043,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39454) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39480) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39147) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39173) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('2') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -219444,6 +222067,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -219548,6 +222172,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -219699,7 +222324,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 39165, + FzName: __ccgo_ts + 39191, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -219707,7 +222332,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39469, + FzName: __ccgo_ts + 39495, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -219715,7 +222340,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39475, + FzName: __ccgo_ts + 39501, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -219723,7 +222348,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39482, + FzName: __ccgo_ts + 39508, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -219743,6 +222368,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -224787,6 +227413,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -225073,6 +227700,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -225095,6 +227723,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -225253,16 +227882,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39490) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39516) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39494) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39520) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39498) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39524) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39507, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39533, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -225331,15 +227960,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39541, - 1: __ccgo_ts + 39581, - 2: __ccgo_ts + 39616, + 0: __ccgo_ts + 39567, + 1: __ccgo_ts + 39607, + 2: __ccgo_ts + 39642, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+24103, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+24137, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39659, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39685, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -225451,6 +228080,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -225508,10 +228138,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39692, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39718, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39723, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39749, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } @@ -225530,7 +228160,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39774, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39800, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -225676,6 +228306,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -225771,6 +228402,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -225954,7 +228586,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39800, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39826, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -226007,7 +228639,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39810 + return __ccgo_ts + 39836 } type TAggInfo_col = struct { @@ -226289,11 +228921,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-15.0.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00nfs\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00dylib\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-15.0.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00nfs\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00dylib\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods @@ -226303,4 +228935,3 @@ type Sqlite3_index_info = sqlite3_index_info type Sqlite3_module = sqlite3_module type Sqlite3_vtab = sqlite3_vtab type Sqlite3_vtab_cursor = sqlite3_vtab_cursor - diff --git a/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go index 9716eceb..870ef46f 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go @@ -1,4 +1,4 @@ -// Code generated for darwin/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/var/folders/4f/mc8mts295pqf7gmnfcwh6g8w0000gn/T/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for darwin/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build darwin && arm64 // +build darwin,arm64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -334,9 +336,6 @@ const CC_VARALPHA = 5 const CC_VARNUM = 6 const CC_X = 0 const CHARCLASS_NAME_MAX = 14 -const CHAR_BIT = 8 -const CHAR_MAX = 127 -const CHAR_MIN = -128 const CHILD_MAX = 266 const CKCNSTRNT_COLUMN = 1 const CKCNSTRNT_ROWID = 2 @@ -861,7 +860,6 @@ const HASHTABLE_NPAGE_ONE = 4096 const HASHTABLE_NSLOT = 8192 const HAVE_FCHOWN = 1 const HAVE_FULLFSYNC = 1 -const HAVE_GETHOSTUUID = 1 const HAVE_LSTAT = 1 const HAVE_MREMAP = 0 const HAVE_PREAD = 1 @@ -926,8 +924,6 @@ const INT_LEAST64_MAX = 9223372036854775807 const INT_LEAST64_MIN = -9223372036854775808 const INT_LEAST8_MAX = 127 const INT_LEAST8_MIN = -128 -const INT_MAX = 2147483647 -const INT_MIN = -2147483648 const IN_INDEX_EPH = 2 const IN_INDEX_INDEX_ASC = 3 const IN_INDEX_INDEX_DESC = 4 @@ -1048,8 +1044,6 @@ const LEGACY_TEMP_SCHEMA_TABLE = "sqlite_temp_master" const LINE_MAX = 2048 const LINK_MAX = 32767 const LITTLE_ENDIAN = 1234 -const LLONG_MAX = 9223372036854775807 -const LLONG_MIN = -9223372036854775808 const LOCATE_NOERR = 2 const LOCATE_VIEW = 1 const LOCK_EX = 2 @@ -1057,10 +1051,6 @@ const LOCK_NB = 4 const LOCK_SH = 1 const LOCK_UN = 8 const LONGDOUBLE_TYPE = 0 -const LONG_LONG_MAX = 9223372036854775807 -const LONG_LONG_MIN = -9223372036854775808 -const LONG_MAX = 9223372036854775807 -const LONG_MIN = -9223372036854775808 const LOOKASIDE_SMALL = 128 const L_INCR = 1 const L_SET = 0 @@ -1131,6 +1121,8 @@ const MAC_OS_VERSION_13_6 = 130600 const MAC_OS_VERSION_14_0 = 140000 const MAC_OS_VERSION_14_1 = 140100 const MAC_OS_VERSION_14_2 = 140200 +const MAC_OS_VERSION_14_3 = 140300 +const MAC_OS_VERSION_14_4 = 140400 const MAC_OS_X_VERSION_10_0 = 1000 const MAC_OS_X_VERSION_10_1 = 1010 const MAC_OS_X_VERSION_10_10 = 101000 @@ -1175,6 +1167,7 @@ const MADV_PAGEOUT = 10 const MADV_RANDOM = 1 const MADV_SEQUENTIAL = 2 const MADV_WILLNEED = 3 +const MADV_ZERO = 11 const MADV_ZERO_WIRED_PAGES = 6 const MAP_32BIT = 32768 const MAP_ANON = 4096 @@ -1384,6 +1377,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NFDBITS = 0 const NFSV2_MAX_FH_SIZE = 32 @@ -2000,8 +1994,6 @@ const SBC_PRESERVE_GRAFT = 32 const SBC_PRESERVE_MOUNT = 1 const SBC_STRICT_AUTH = 16 const SBC_SYSTEM_CONTENT = 4 -const SCHAR_MAX = 127 -const SCHAR_MIN = -128 const SCHEMA_ROOT = 1 const SEARCHFS_MAX_SEARCHPARMS = 4096 const SEEK_CUR = 1 @@ -2058,8 +2050,6 @@ const SF_WinRewrite = 1048576 const SHARED_FIRST = 2 const SHARED_LOCK = 1 const SHARED_SIZE = 510 -const SHRT_MAX = 32767 -const SHRT_MIN = -32768 const SIGABRT = 6 const SIGALRM = 14 const SIGBUS = 10 @@ -2204,6 +2194,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2658,10 +2649,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2736,7 +2724,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2844,8 +2832,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -3224,7 +3212,6 @@ const TRIGGER_AFTER = 2 const TRIGGER_BEFORE = 1 const TRUE = 1 const TTYDISC = 0 -const UCHAR_MAX = 255 const UF_APPEND = 4 const UF_COMPRESSED = 32 const UF_DATAVAULT = 128 @@ -3249,10 +3236,6 @@ const UINT_LEAST16_MAX = 65535 const UINT_LEAST32_MAX = 4294967295 const UINT_LEAST64_MAX = 18446744073709551615 const UINT_LEAST8_MAX = 255 -const UINT_MAX = 4294967295 -const ULLONG_MAX = 18446744073709551615 -const ULONG_LONG_MAX = 18446744073709551615 -const ULONG_MAX = 18446744073709551615 const UNDERFLOW = 4 const UNIXFILE_DELETE = 32 const UNIXFILE_DIRSYNC = 8 @@ -3267,7 +3250,6 @@ const UNIX_SHM_DMS = 128 const UNKNOWN_LOCK = 5 const USER_FSIGNATURES_CDHASH_LEN = 20 const USE_PREAD = 1 -const USHRT_MAX = 65535 const UTIME_NOW = -1 const UTIME_OMIT = -2 const UpperToLower = 0 @@ -3301,6 +3283,7 @@ const VOL_CAP_FMT_2TB_FILESIZE = 2048 const VOL_CAP_FMT_64BIT_OBJECT_IDS = 131072 const VOL_CAP_FMT_CASE_PRESERVING = 512 const VOL_CAP_FMT_CASE_SENSITIVE = 256 +const VOL_CAP_FMT_CLONE_MAPPING = 67108864 const VOL_CAP_FMT_DECMPFS_COMPRESSION = 65536 const VOL_CAP_FMT_DIR_HARDLINKS = 262144 const VOL_CAP_FMT_DOCUMENT_ID = 524288 @@ -3325,6 +3308,7 @@ const VOL_CAP_FMT_WRITE_GENERATION_COUNT = 1048576 const VOL_CAP_FMT_ZERO_RUNS = 128 const VOL_CAP_INT_ADVLOCK = 256 const VOL_CAP_INT_ALLOCATE = 64 +const VOL_CAP_INT_ATTRIBUTION_TAG = 4194304 const VOL_CAP_INT_ATTRLIST = 2 const VOL_CAP_INT_CLONE = 65536 const VOL_CAP_INT_COPYFILE = 32 @@ -3361,6 +3345,7 @@ const VQ_SYNCEVENT = 1024 const VQ_UNMOUNT = 16 const VQ_UPDATE = 256 const VQ_VERYLOWDISK = 512 +const ViewCanHaveRowid = 0 const WAIT_ANY = -1 const WAIT_MYPGRP = 0 const WAKEMON_DISABLE = 2 @@ -3800,7 +3785,6 @@ const _SC_XOPEN_UNIX = 115 const _SC_XOPEN_VERSION = 116 const _SC_XOPEN_XCU_VERSION = 121 const _STRUCT_MCONTEXT = "_STRUCT_MCONTEXT64" -const _USE_FORTIFY_LEVEL = 2 const _V6_ILP32_OFF32 = -1 const _V6_ILP32_OFFBIG = -1 const _V6_LP64_OFF64 = 1 @@ -3918,6 +3902,8 @@ const __BRIDGEOS_7_6 = 70600 const __BRIDGEOS_8_0 = 80000 const __BRIDGEOS_8_1 = 80100 const __BRIDGEOS_8_2 = 80200 +const __BRIDGEOS_8_3 = 80300 +const __BRIDGEOS_8_4 = 80400 const __BYTE_ORDER__ = 1234 const __CCGO__ = 1 const __CHAR_BIT__ = 8 @@ -3983,6 +3969,8 @@ const __DRIVERKIT_22_6 = 220600 const __DRIVERKIT_23_0 = 230000 const __DRIVERKIT_23_1 = 230100 const __DRIVERKIT_23_2 = 230200 +const __DRIVERKIT_23_3 = 230300 +const __DRIVERKIT_23_4 = 230400 const __DYLDDL_DRIVERKIT_UNAVAILABLE = 0 const __DYNAMIC__ = 1 const __ENABLE_LEGACY_MAC_AVAILABILITY = 1 @@ -4089,16 +4077,12 @@ const __INT_FAST8_MAX__ = 127 const __INT_FAST8_WIDTH__ = 8 const __INT_LEAST16_FMTd__ = "hd" const __INT_LEAST16_FMTi__ = "hi" -const __INT_LEAST16_MAX = 32767 const __INT_LEAST16_MAX__ = 32767 -const __INT_LEAST16_MIN = -32768 const __INT_LEAST16_TYPE__ = 0 const __INT_LEAST16_WIDTH__ = 16 const __INT_LEAST32_FMTd__ = "d" const __INT_LEAST32_FMTi__ = "i" -const __INT_LEAST32_MAX = 2147483647 const __INT_LEAST32_MAX__ = 2147483647 -const __INT_LEAST32_MIN = -2147483648 const __INT_LEAST32_TYPE__ = 0 const __INT_LEAST32_WIDTH__ = 32 const __INT_LEAST64_FMTd__ = "lld" @@ -4109,9 +4093,7 @@ const __INT_LEAST64_MIN = -9223372036854775808 const __INT_LEAST64_WIDTH__ = 64 const __INT_LEAST8_FMTd__ = "hhd" const __INT_LEAST8_FMTi__ = "hhi" -const __INT_LEAST8_MAX = 127 const __INT_LEAST8_MAX__ = 127 -const __INT_LEAST8_MIN = -128 const __INT_LEAST8_WIDTH__ = 8 const __INT_MAX__ = 2147483647 const __INT_WIDTH__ = 32 @@ -4153,6 +4135,8 @@ const __IPHONE_15_3 = 150300 const __IPHONE_15_4 = 150400 const __IPHONE_15_5 = 150500 const __IPHONE_15_6 = 150600 +const __IPHONE_15_7 = 150700 +const __IPHONE_15_8 = 150800 const __IPHONE_16_0 = 160000 const __IPHONE_16_1 = 160100 const __IPHONE_16_2 = 160200 @@ -4164,6 +4148,8 @@ const __IPHONE_16_7 = 160700 const __IPHONE_17_0 = 170000 const __IPHONE_17_1 = 170100 const __IPHONE_17_2 = 170200 +const __IPHONE_17_3 = 170300 +const __IPHONE_17_4 = 170400 const __IPHONE_2_0 = 20000 const __IPHONE_2_1 = 20100 const __IPHONE_2_2 = 20200 @@ -4270,7 +4256,9 @@ const __MAC_13_6 = 130600 const __MAC_14_0 = 140000 const __MAC_14_1 = 140100 const __MAC_14_2 = 140200 -const __MAC_OS_X_VERSION_MAX_ALLOWED = 140200 +const __MAC_14_3 = 140300 +const __MAC_14_4 = 140400 +const __MAC_OS_X_VERSION_MAX_ALLOWED = 140400 const __MAC_OS_X_VERSION_MIN_REQUIRED = 140000 const __NO_INLINE__ = 1 const __NO_MATH_ERRNO__ = 1 @@ -4393,6 +4381,8 @@ const __TVOS_16_6 = 160600 const __TVOS_17_0 = 170000 const __TVOS_17_1 = 170100 const __TVOS_17_2 = 170200 +const __TVOS_17_3 = 170300 +const __TVOS_17_4 = 170400 const __TVOS_9_0 = 90000 const __TVOS_9_1 = 90100 const __TVOS_9_2 = 90200 @@ -4455,13 +4445,11 @@ const __UINT_LEAST16_FMTX__ = "hX" const __UINT_LEAST16_FMTo__ = "ho" const __UINT_LEAST16_FMTu__ = "hu" const __UINT_LEAST16_FMTx__ = "hx" -const __UINT_LEAST16_MAX = 65535 const __UINT_LEAST16_MAX__ = 65535 const __UINT_LEAST32_FMTX__ = "X" const __UINT_LEAST32_FMTo__ = "o" const __UINT_LEAST32_FMTu__ = "u" const __UINT_LEAST32_FMTx__ = "x" -const __UINT_LEAST32_MAX = 4294967295 const __UINT_LEAST32_MAX__ = 4294967295 const __UINT_LEAST64_FMTX__ = "llX" const __UINT_LEAST64_FMTo__ = "llo" @@ -4473,14 +4461,16 @@ const __UINT_LEAST8_FMTX__ = "hhX" const __UINT_LEAST8_FMTo__ = "hho" const __UINT_LEAST8_FMTu__ = "hhu" const __UINT_LEAST8_FMTx__ = "hhx" -const __UINT_LEAST8_MAX = 255 const __UINT_LEAST8_MAX__ = 255 const __USER_LABEL_PREFIX__ = 0 -const __VERSION__ = "Apple LLVM 15.0.0 (clang-1500.1.0.2.5)" +const __VERSION__ = "Apple LLVM 15.0.0 (clang-1500.3.9.4)" const __VISIONOS_1_0 = 10000 +const __VISIONOS_1_1 = 10100 const __WATCHOS_10_0 = 100000 const __WATCHOS_10_1 = 100100 const __WATCHOS_10_2 = 100200 +const __WATCHOS_10_3 = 100300 +const __WATCHOS_10_4 = 100400 const __WATCHOS_1_0 = 10000 const __WATCHOS_2_0 = 20000 const __WATCHOS_2_1 = 20100 @@ -4514,6 +4504,7 @@ const __WATCHOS_8_4 = 80400 const __WATCHOS_8_5 = 80500 const __WATCHOS_8_6 = 80600 const __WATCHOS_8_7 = 80700 +const __WATCHOS_8_8 = 80800 const __WATCHOS_9_0 = 90000 const __WATCHOS_9_1 = 90100 const __WATCHOS_9_2 = 90200 @@ -4528,7 +4519,7 @@ const __WINT_MAX__ = 2147483647 const __WINT_TYPE__ = 0 const __WINT_WIDTH__ = 32 const __aarch64__ = 1 -const __apple_build_version__ = 15000100 +const __apple_build_version__ = 15000309 const __arm64 = 1 const __arm64__ = 1 const __bool_true_false_are_defined = 1 @@ -4537,21 +4528,14 @@ const __clang_literal_encoding__ = "UTF-8" const __clang_major__ = 15 const __clang_minor__ = 0 const __clang_patchlevel__ = 0 -const __clang_version__ = "15.0.0 (clang-1500.1.0.2.5)" +const __clang_version__ = "15.0.0 (clang-1500.3.9.4)" const __clang_wide_literal_encoding__ = "UTF-32" const __const = 0 const __exported_pop = 0 const __exported_push = 0 const __has_ptrcheck = 0 +const __has_safe_buffers = 0 const __header_inline = 0 -const __int16_c_suffix = 0 -const __int32_c_suffix = 0 -const __int64_c_suffix = 0 -const __int8_c_suffix = 0 -const __int_least16_t = 0 -const __int_least32_t = 0 -const __int_least64_t = 0 -const __int_least8_t = 0 const __llvm__ = 1 const __nonnull = 0 const __null_unspecified = 0 @@ -4560,10 +4544,6 @@ const __pic__ = 2 const __restrict = 0 const __restrict_arr = 0 const __signed = 0 -const __uint_least16_t = 0 -const __uint_least32_t = 0 -const __uint_least64_t = 0 -const __uint_least8_t = 0 const __unreachable_ok_pop = 0 const __unreachable_ok_push = 0 const __volatile = 0 @@ -8875,7 +8855,9 @@ type Trusage_info_v6 = struct { Fri_pcycles Tuint64_t Fri_energy_nj Tuint64_t Fri_penergy_nj Tuint64_t - Fri_reserved [14]Tuint64_t + Fri_secure_time_in_system Tuint64_t + Fri_secure_ptime_in_system Tuint64_t + Fri_reserved [12]Tuint64_t } type rusage_info_v6 = Trusage_info_v6 @@ -8924,7 +8906,9 @@ type Trusage_info_current = struct { Fri_pcycles Tuint64_t Fri_energy_nj Tuint64_t Fri_penergy_nj Tuint64_t - Fri_reserved [14]Tuint64_t + Fri_secure_time_in_system Tuint64_t + Fri_secure_ptime_in_system Tuint64_t + Fri_reserved [12]Tuint64_t } type rusage_info_current = Trusage_info_current @@ -10124,6 +10108,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -11687,6 +11672,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -12392,6 +12381,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -14926,7 +14916,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -15073,6 +15063,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -15085,7 +15076,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -15110,6 +15101,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -15120,11 +15112,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -15139,7 +15133,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart @@ -15151,6 +15145,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -15184,6 +15179,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -15368,6 +15364,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -15435,6 +15432,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { zDate++ } @@ -16118,6 +16116,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -16135,6 +16134,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1271, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -16245,6 +16251,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -16355,7 +16362,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { @@ -16368,7 +16375,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 8)) += y @@ -16383,6 +16390,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -16436,6 +16444,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -16702,7 +16711,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -16728,7 +16737,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -16744,9 +16753,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = 0 (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -16765,7 +16774,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -16796,7 +16805,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1411, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -16814,6 +16823,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -17424,6 +17434,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -19154,6 +19165,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -19710,6 +19722,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -19735,6 +19748,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -19794,11 +19808,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -19907,6 +19925,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -19928,14 +19947,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -19951,6 +19974,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -20083,6 +20109,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -20104,6 +20131,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v70)) = int8('0') goto _69 _69: + ; precision-- e2++ } @@ -20191,6 +20219,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -20208,6 +20237,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -20216,11 +20246,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -20297,7 +20329,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -20351,6 +20385,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -20358,6 +20393,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -20370,9 +20406,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -20420,6 +20459,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -20459,6 +20499,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -20470,6 +20511,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -20493,6 +20535,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -20524,8 +20567,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -20552,6 +20597,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -21411,6 +21457,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -21421,6 +21468,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -22084,6 +22132,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -22301,6 +22350,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.X__builtin___memcpy_chk(tls, bp+8, bp, uint64(8), libc.X__builtin_object_size(tls, bp+8, 0)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -23153,6 +23224,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -23203,6 +23275,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -23238,6 +23311,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -23685,6 +23763,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -23745,6 +23824,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -23767,6 +23847,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -23988,6 +24069,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { } goto _1 _1: + ; i++ } return i @@ -24044,6 +24126,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -28695,6 +28787,7 @@ func _afpLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { } } afp_end_lock: + ; Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) return rc } @@ -29143,6 +29236,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -29160,7 +29254,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3512, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3512, bp, int32(41778)) } // C documentation @@ -29197,7 +29291,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -29805,7 +29901,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -30234,6 +30334,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -30251,6 +30352,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -30307,6 +30409,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -30400,7 +30503,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -30874,6 +30977,7 @@ func _autolockIoFinderImpl(tls *libc.TLS, filePath uintptr, pNew uintptr) (r uin } goto _1 _1: + ; i++ } } @@ -31010,7 +31114,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -31032,7 +31136,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam rc = _findInodeInfo(tls, pNew, pNew+16) if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pNew)).FlockingContext) - _robust_close(tls, pNew, h, int32(43873)) + _robust_close(tls, pNew, h, int32(43935)) h = -int32(1) } _unixLeaveMutex(tls) @@ -31053,7 +31157,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -31207,6 +31311,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -31464,7 +31569,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3395, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3395, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -31500,7 +31605,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } if libc.Xfstatfs(tls, fd, bp) == -int32(1) { _storeLastErrno(tls, p, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - _robust_close(tls, p, fd, int32(44427)) + _robust_close(tls, p, fd, int32(44489)) return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(13)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+144, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(1026)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3584, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3584, zIn, int32(44691)) return } (*(*[1026]int8)(unsafe.Pointer(bp + 144)))[got] = 0 @@ -31743,6 +31849,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -31775,14 +31882,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3413, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3413, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= 0 { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, bp) - _robust_close(tls, pFile, fd, int32(45364)) + _robust_close(tls, pFile, fd, int32(45426)) } libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+4167, libc.VaList(bp+2144, cPath, bp+2065)) } @@ -32573,7 +32684,8 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { ** we'll try to use the path there, if we can't open that path, we'll ** retry with a new auto-generated path */ - _3: /* in case we need to try again for an :auto: named lock file */ + _3: + ; /* in case we need to try again for an :auto: named lock file */ if !(createConch != 0) && !(forceNewLockPath != 0) { hostIdMatch = libc.BoolInt32(!(libc.Xmemcmp(tls, bp+20+1, bp, uint64(PROXY_HOSTIDLEN)) != 0)) /* if the conch has data compare the contents */ @@ -32654,16 +32766,17 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { } (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(conchFile)).FpMethod)).FxUnlock})))(tls, conchFile, int32(SHARED_LOCK)) end_takeconch: + ; if rc == SQLITE_OK && (*TunixFile)(unsafe.Pointer(pFile)).FopenFlags != 0 { if (*TunixFile)(unsafe.Pointer(pFile)).Fh >= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(45617)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(45679)) } (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) fd = _robust_open(tls, (*TproxyLockingContext)(unsafe.Pointer(pCtx)).FdbPath, (*TunixFile)(unsafe.Pointer(pFile)).FopenFlags, uint16(0)) if fd >= 0 { (*TunixFile)(unsafe.Pointer(pFile)).Fh = fd } else { - rc = _sqlite3CantopenError(tls, int32(45625)) /* SQLITE_BUSY? proxyTakeConch called + rc = _sqlite3CantopenError(tls, int32(45687)) /* SQLITE_BUSY? proxyTakeConch called during locking */ } } @@ -32707,11 +32820,13 @@ func _proxyTakeConch(tls *libc.TLS, pFile uintptr) (r int32) { return rc goto _2 _2: + ; if int32(1) != 0 { goto _3 } goto _1 - _1: /* in case we need to retry the :auto: lock file - + _1: + /* in case we need to retry the :auto: lock file - ** we should never get here except via the 'continue' call. */ } return r @@ -32775,6 +32890,7 @@ func _proxyCreateConchPathname(tls *libc.TLS, dbPath uintptr, pConchPath uintptr } goto _2 _2: + ; i-- } *(*int8)(unsafe.Pointer(conchPath + uintptr(i))) = int8('.') @@ -33189,6 +33305,7 @@ func Xsqlite3_os_init(tls *libc.TLS) (r int32) { Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&_aVfs))+uintptr(i)*168, libc.BoolInt32(i == uint32(0))) goto _1 _1: + ; i++ } _unixBigLock = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1)) @@ -33744,6 +33861,7 @@ func _memdbClose(tls *libc.TLS, pFile uintptr) (r int32) { } goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, pVfsMutex) @@ -34093,6 +34211,7 @@ func _memdbOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFd uintptr, flags i } goto _1 _1: + ; i++ } if p == uintptr(0) { @@ -34339,6 +34458,14 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp pOut = uintptr(0) } else { sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + if sz == 0 { + Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + Xsqlite3_exec(tls, db, __ccgo_ts+4359, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == int32(SQLITE_ROW) { + sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + } + } if piSize != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = sz } @@ -34365,6 +34492,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _2 _2: + ; pgno++ } } @@ -34395,7 +34523,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = int32(SQLITE_ERROR) goto end_deserialize } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4359, libc.VaList(bp+16, zSchema)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4384, libc.VaList(bp+16, zSchema)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -34430,6 +34558,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = SQLITE_OK } end_deserialize: + ; Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) if pData != 0 && mFlags&uint32(SQLITE_DESERIALIZE_FREEONCLOSE) != uint32(0) { Xsqlite3_free(tls, pData) @@ -34697,6 +34826,7 @@ func _sqlite3BitvecSet(tls *libc.TLS, p uintptr, i Tu32) (r int32) { /* available free spot. check to see if this is going to */ /* make our hash too "full". */ bitvec_set_rehash: + ; if uint64((*TBitvec)(unsafe.Pointer(p)).FnSet) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -34716,6 +34846,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -34723,6 +34854,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -34779,6 +34911,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -34804,6 +34937,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -34947,10 +35081,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -35307,6 +35443,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -35318,6 +35455,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -35505,6 +35643,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -35527,6 +35666,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -35585,6 +35725,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -35692,6 +35833,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -35718,6 +35860,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -35739,6 +35882,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -35846,6 +35990,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -36262,6 +36407,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -36518,6 +36664,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -36567,6 +36714,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -37380,6 +37528,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -37534,6 +37683,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -37556,6 +37706,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -37661,6 +37812,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -37753,6 +37905,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -37794,6 +37947,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -38698,12 +38852,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -38910,6 +39066,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -39056,6 +39213,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -39130,6 +39288,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -39297,6 +39456,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -39388,6 +39548,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -39422,6 +39583,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -40181,6 +40343,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -40501,11 +40664,13 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -40546,7 +40711,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -44634,7 +44814,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4432, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4457, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -46021,6 +46201,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -46074,10 +46255,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -46161,7 +46343,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -46226,6 +46408,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -46250,11 +46433,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -46287,6 +46472,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -46295,10 +46481,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< 0 { @@ -48814,7 +49022,7 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, /* Copy data from the log to the database file. */ if rc == SQLITE_OK { if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { - rc = _sqlite3CorruptError(tls, int32(68842)) + rc = _sqlite3CorruptError(tls, int32(68912)) } else { rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) } @@ -49887,6 +50095,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } _lockBtreeMutex(tls, p) @@ -49900,6 +50109,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } } @@ -49951,6 +50161,7 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) @@ -49977,6 +50188,7 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } } @@ -50144,6 +50356,7 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } return SQLITE_OK @@ -50191,6 +50404,7 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } /* If the above search did not find a BtLock struct associating Btree p @@ -50284,6 +50498,7 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) goto _2 _2: + ; pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext } } @@ -50320,6 +50535,7 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -50356,6 +50572,7 @@ func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, i } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -50457,6 +50674,7 @@ func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) goto _1 _1: + ; i++ } _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -50572,6 +50790,7 @@ func _saveAllCursors(tls *libc.TLS, pBt uintptr, iRoot TPgno, pExcept uintptr) ( } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -50640,7 +50859,7 @@ func _btreeMoveto(tls *libc.TLS, pCur uintptr, pKey uintptr, nKey Ti64, bias int } _sqlite3VdbeRecordUnpack(tls, pKeyInfo, int32(nKey), pKey, pIdxKey) if int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) == 0 || int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) > int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -50818,7 +51037,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } /* The super-journal page number must never be used as a pointer map page */ if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -50831,12 +51050,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -50850,6 +51069,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -50878,7 +51098,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) if pPgno != 0 { @@ -50886,7 +51106,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -51306,7 +51526,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -51346,12 +51566,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -51359,21 +51579,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.X__builtin___memmove_chk(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz)), libc.X__builtin_object_size(tls, data+uintptr(iFree+sz+sz2), 0)) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -51395,6 +51615,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -51419,25 +51640,27 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) libc.X__builtin___memcpy_chk(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size), libc.X__builtin_object_size(tls, data+uintptr(cbrk), 0)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) @@ -51497,7 +51720,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -51514,14 +51737,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -51564,11 +51787,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -51582,7 +51805,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -51665,12 +51888,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none @@ -51681,11 +51904,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -51706,7 +51929,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -51723,10 +51946,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -51787,7 +52010,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -51813,7 +52036,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -51852,12 +52075,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -51884,7 +52107,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -51915,14 +52138,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))< iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -51947,7 +52171,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) @@ -51960,7 +52184,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -52113,7 +52337,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _, _ = pPage, rc if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -52175,7 +52399,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -52263,7 +52487,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4513) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4538) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ @@ -52339,6 +52563,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -52347,6 +52572,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -52480,11 +52706,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -53044,7 +53272,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4522, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4547, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -53082,7 +53310,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -53137,6 +53365,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -53301,6 +53530,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -53404,6 +53634,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -53482,6 +53713,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53517,7 +53749,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -53541,7 +53773,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -53550,7 +53782,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -53559,11 +53791,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -53593,7 +53826,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -53689,7 +53922,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -53727,7 +53960,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) @@ -53794,7 +54027,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -53837,7 +54070,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -53852,6 +54085,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -53866,7 +54100,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -53879,6 +54113,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -54115,6 +54350,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -54330,7 +54566,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo /* Assert that the caller has opened the required transaction. */ if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { iTable = uint32(0) @@ -54359,6 +54595,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -54721,7 +54958,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ pBufStart = pBuf /* Start of original out buffer */ if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _getCellInfo(tls, pCur) aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload @@ -54731,7 +54968,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -54783,7 +55020,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) if offset >= ovflSize { @@ -54857,7 +55094,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -54992,7 +55229,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { var v3, p1 uintptr _, _, _, _ = rc, v2, v3, p1 if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -55004,7 +55241,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -55120,9 +55357,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** in such a way that page pRoot is linked into a second b-tree table ** (or the freelist). */ if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -55132,7 +55370,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -55366,7 +55604,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -55410,6 +55648,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -55424,6 +55663,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -55498,6 +55738,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -55565,7 +55806,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -55580,6 +55821,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -55626,7 +55868,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -55657,7 +55899,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -55690,7 +55932,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -55699,7 +55941,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -55714,6 +55956,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -55764,6 +56007,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -55825,7 +56069,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -55935,7 +56179,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -56023,7 +56267,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -56078,7 +56322,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -56104,7 +56348,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -56131,7 +56375,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -56176,6 +56420,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -56192,6 +56437,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -56200,7 +56446,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -56301,6 +56547,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } } end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) return rc @@ -56336,7 +56583,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in iTrunk = uint32(0) /* Page number of free-list trunk page */ pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -56387,7 +56634,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -56396,7 +56643,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in } nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -56452,6 +56699,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -56484,7 +56732,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -56502,7 +56750,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -56525,7 +56773,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -56610,6 +56858,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n libc.X__builtin___memcpy_chk(tls, pPayload, pSrc, uint64(nSrc), libc.X__builtin_object_size(tls, pPayload, 0)) @@ -56745,7 +56994,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -57129,6 +57378,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -57138,12 +57388,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -57151,7 +57401,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.X__builtin___memmove_chk(tls, pData, pCell, uint64(sz), libc.X__builtin_object_size(tls, pData, 0)) i++ @@ -57225,6 +57475,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -57245,7 +57496,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr ** database. But they might for a corrupt database. Hence use memmove() ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.X__builtin___memmove_chk(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz), libc.X__builtin_object_size(tls, pSlot, 0)) @@ -57316,6 +57567,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -57328,6 +57580,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -57343,6 +57596,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -57353,6 +57607,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -57389,7 +57644,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.X__builtin___memmove_chk(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2)), libc.X__builtin_object_size(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, 0)) nCell -= nShift @@ -57440,6 +57695,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -57455,9 +57711,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -57502,7 +57759,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _, _, _, _, _, _, _ = pBt, pOut, pStop, v1, v2, v3, v4 pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt /* Page number of pNew */ if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ /* Allocate a new page. This page will become the right-sibling of ** pPage. Make the parent page writable, so that the new divider cell @@ -57863,7 +58120,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -57886,7 +58143,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.X__builtin___memset_chk(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow)), libc.X__builtin_object_size(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0)) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -57900,6 +58157,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -57912,6 +58170,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } @@ -57948,6 +58207,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -57994,11 +58254,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -58012,7 +58274,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -58055,12 +58317,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -58113,11 +58376,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -58144,7 +58408,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -58173,6 +58437,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -58195,6 +58460,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno goto _19 _19: + ; i++ } i = 0 @@ -58213,6 +58479,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -58234,6 +58501,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) @@ -58315,6 +58583,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -58364,11 +58633,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -58377,6 +58647,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -58444,6 +58715,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -58480,6 +58752,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -58494,12 +58767,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -58509,6 +58784,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -58519,6 +58795,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -58606,10 +58883,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -58678,7 +58956,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -58767,6 +59045,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -58836,7 +59115,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -58867,7 +59146,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -58952,7 +59231,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -59044,7 +59323,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -59058,6 +59337,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -59079,7 +59359,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -59109,10 +59389,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.X__builtin___memcpy_chk(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8))), libc.X__builtin_object_size(tls, oldCell, 0)) return SQLITE_OK @@ -59128,7 +59408,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { } } @@ -59155,7 +59435,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s */ if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -59178,6 +59458,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -59228,7 +59509,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -59250,7 +59531,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -59350,21 +59631,21 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&(int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx))))< _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -59609,7 +59890,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -59690,14 +59971,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int var _ /* rc at bp+8 */ int32 _, _, _, _ = hdr, i, pCell, v2 if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -59724,6 +60005,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -59748,6 +60030,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -59831,7 +60114,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -60096,7 +60379,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4526, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4551, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -60144,11 +60427,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4528, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4553, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4551, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4576, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -60174,11 +60457,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4681, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4706, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -60230,6 +60513,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -60249,11 +60533,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4720 + v2 = __ccgo_ts + 4745 } else { - v2 = __ccgo_ts + 4725 + v2 = __ccgo_ts + 4750 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4746, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4771, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -60389,12 +60673,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4772 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4797 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4790, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4815, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4944, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4969, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4974, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4999, 0) doCoverageCheck = 0 goto _4 } @@ -60476,7 +60760,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4998, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5023, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -60499,7 +60783,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5022, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5047, 0) depth = d2 } } else { @@ -60508,6 +60792,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -60531,6 +60816,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5047, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5072, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -60588,10 +60874,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+5084, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+5109, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -60677,7 +60964,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 5136 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 5161 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -60696,15 +60983,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+5147, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+5172, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+5192, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+5217, 0) } } } @@ -60724,6 +61012,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -63693,16 +63998,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -63740,6 +64046,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -64126,10 +64433,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -64285,6 +64594,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -64408,6 +64718,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -64503,6 +64814,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -64604,6 +64916,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -65003,7 +65316,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5404, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5429, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -65016,38 +65329,39 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1650 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5409) == 0 { - zColl = __ccgo_ts + 5416 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5434) == 0 { + zColl = __ccgo_ts + 5441 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5397 + v3 = __ccgo_ts + 5422 } else { v3 = __ccgo_ts + 1650 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5418 + v4 = __ccgo_ts + 5443 } else { v4 = __ccgo_ts + 1650 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5421, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5446, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5445, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5470, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5454, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5454, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1406, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5461, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5486, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1373, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -65064,14 +65378,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { zP4 = __ccgo_ts + 1651 } else { - zP4 = __ccgo_ts + 5464 + zP4 = __ccgo_ts + 5489 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5471, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5496, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -65086,14 +65400,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5479, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5504, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5484, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5509, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5486 + zP4 = __ccgo_ts + 5511 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -65109,10 +65424,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5431, - 1: __ccgo_ts + 5433, - 2: __ccgo_ts + 5435, - 3: __ccgo_ts + 5440, + 0: __ccgo_ts + 5456, + 1: __ccgo_ts + 5458, + 2: __ccgo_ts + 5460, + 3: __ccgo_ts + 5465, } // C documentation @@ -65175,6 +65490,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -65201,6 +65517,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -65240,6 +65557,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -65272,6 +65590,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -65305,6 +65624,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -65371,6 +65691,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -65398,6 +65719,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -65419,6 +65741,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -65474,6 +65797,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -65805,6 +66129,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -65857,6 +66182,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -65984,6 +66310,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -66017,6 +66344,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -66035,6 +66363,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -66049,7 +66378,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5494, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5519, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -66057,18 +66386,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5506, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5531, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5520, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5545, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5535, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5560, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) @@ -66109,6 +66438,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -66145,6 +66475,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -66181,6 +66512,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -66247,6 +66579,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -66295,7 +66628,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -67603,7 +67957,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -67636,16 +67990,21 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -67668,7 +68027,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -67703,7 +68062,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -67728,7 +68087,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } } } } @@ -67754,7 +68116,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -67795,18 +68157,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -68033,8 +68396,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -68065,7 +68429,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -68129,6 +68493,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -68215,15 +68580,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5578 + zContext = __ccgo_ts + 5603 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5597 + zContext = __ccgo_ts + 5622 } else { - zContext = __ccgo_ts + 5616 + zContext = __ccgo_ts + 5641 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5625, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5650, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -68276,6 +68641,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -68340,6 +68706,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -68395,7 +68762,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5661, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5686, 0) return int32(1) } else { return 0 @@ -68405,7 +68772,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5706, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5731, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -68463,7 +68830,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -68530,6 +68897,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { @@ -68965,7 +69333,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5746, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5771, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -69021,6 +69389,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -69044,6 +69413,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -69140,6 +69510,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask @@ -69161,7 +69532,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -69291,7 +69662,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -69454,6 +69825,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -69489,6 +69861,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -69512,6 +69885,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -69747,18 +70121,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5769, - 1: __ccgo_ts + 5774, - 2: __ccgo_ts + 5781, - 3: __ccgo_ts + 5784, - 4: __ccgo_ts + 5787, - 5: __ccgo_ts + 5790, - 6: __ccgo_ts + 5793, - 7: __ccgo_ts + 5796, - 8: __ccgo_ts + 5804, - 9: __ccgo_ts + 5807, - 10: __ccgo_ts + 5814, - 11: __ccgo_ts + 5822, + 0: __ccgo_ts + 5794, + 1: __ccgo_ts + 5799, + 2: __ccgo_ts + 5806, + 3: __ccgo_ts + 5809, + 4: __ccgo_ts + 5812, + 5: __ccgo_ts + 5815, + 6: __ccgo_ts + 5818, + 7: __ccgo_ts + 5821, + 8: __ccgo_ts + 5829, + 9: __ccgo_ts + 5832, + 10: __ccgo_ts + 5839, + 11: __ccgo_ts + 5847, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -69893,6 +70267,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -70000,14 +70375,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5829, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5854, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -70295,6 +70670,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -70570,7 +70946,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -70617,6 +70993,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -70698,7 +71075,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -70765,6 +71142,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -70870,7 +71248,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5869, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5894, int32(3)) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } } else { @@ -70908,7 +71286,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1406, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5390, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5415, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -70923,27 +71301,28 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5873, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5898, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5880, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5905, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5893, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5918, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5896, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5921, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5901, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5926, int32(1)) } } } @@ -71446,6 +71825,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -71554,19 +71934,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity int8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -71613,7 +71993,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -72083,8 +72463,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -72097,6 +72479,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadPInt32(db+432) != 0 { goto abort_due_to_interrupt } @@ -72120,7 +72503,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) *(*Ti64)(unsafe.Pointer(pIn1)) = int64(int32((int64(pOp) - int64(aOp)) / 24)) @@ -72147,7 +72531,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -72169,7 +72554,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp3 - int32(1)) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) @@ -72179,7 +72565,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: - ; /* There are never any jumps to instruction 0 */ + ; + /* There are never any jumps to instruction 0 */ /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 goto _187 @@ -72192,6 +72579,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pCaller = aOp + uintptr(*(*Ti64)(unsafe.Pointer(pIn1)))*24 pOp = aOp + uintptr((*TVdbeOp)(unsafe.Pointer(pCaller)).Fp2-int32(1))*24 @@ -72211,6 +72599,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) pcDest = int32(*(*Ti64)(unsafe.Pointer(pIn1))) @@ -72225,7 +72614,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -72262,6 +72652,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -72289,15 +72680,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8((*TOp)(unsafe.Pointer(pOp)).Fp2) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5937, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5962, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5958, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5983, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = int32((int64(pOp) - int64(aOp)) / 24) - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5965, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5990, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) if rc == int32(SQLITE_BUSY) { @@ -72316,7 +72707,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -72326,7 +72718,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) goto _187 @@ -72336,7 +72729,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) *(*float64)(unsafe.Pointer(pOut)) = *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -72349,7 +72743,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) if int32(encoding) != int32(SQLITE_UTF8) { @@ -72387,7 +72782,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) (*TMem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -72429,7 +72825,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { @@ -72458,6 +72856,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) goto _187 @@ -72468,7 +72867,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { _sqlite3VdbeMemSetZeroBlob(tls, pOut, (*TOp)(unsafe.Pointer(pOp)).Fp1) @@ -72488,7 +72888,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 if _sqlite3VdbeMemTooBig(tls, pVar) != 0 { goto too_big @@ -72512,7 +72913,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -72527,6 +72929,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 56 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -72548,6 +72951,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -72582,7 +72986,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) @@ -72595,7 +73000,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetInt64(tls, pOut, *(*Ti64)(unsafe.Pointer(pIn1))) @@ -72612,6 +73018,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -72628,6 +73035,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + uint32(2) | uint32(1) (*TVdbe)(unsafe.Pointer(p)).FpResultRow = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -72652,7 +73060,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -72750,11 +73159,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -72764,6 +73178,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -72801,18 +73216,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -72846,9 +73264,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -72867,6 +73288,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) } @@ -72901,10 +73323,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -72966,7 +73392,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -72978,7 +73405,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) @@ -73002,7 +73430,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -73023,7 +73452,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) @@ -73131,12 +73561,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -73207,16 +73643,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -73257,7 +73703,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ if iCompare == 0 { goto jump_to_p2 } @@ -73274,6 +73721,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; goto _187 /* Opcode: Compare P1 P2 P3 P4 P5 ** Synopsis: r[P1@P3] <-> r[P2@P3] @@ -73297,7 +73745,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -73313,11 +73762,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) @@ -73330,8 +73779,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } goto _187 @@ -73343,7 +73793,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ if iCompare < 0 { pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 } else { @@ -73374,8 +73825,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -73411,7 +73864,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) goto _187 /* Opcode: Not P1 P2 * * * @@ -73421,7 +73875,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -73437,7 +73892,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -73463,14 +73919,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -73485,6 +73942,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -73497,6 +73955,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -73507,7 +73966,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -73545,6 +74005,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { @@ -73575,7 +74036,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -73587,7 +74049,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -73604,6 +74067,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) @@ -73625,7 +74089,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { @@ -73666,10 +74131,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { @@ -73677,9 +74144,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* For the special case of as pseudo-cursor, the seekResult field ** identifies the register that holds the record */ pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -73689,11 +74156,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -73716,9 +74183,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -73774,13 +74241,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -73795,16 +74262,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -73813,8 +74281,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -73837,10 +74305,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -73854,10 +74324,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -73873,9 +74345,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -73896,9 +74368,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -73927,13 +74399,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -73963,6 +74437,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -73973,11 +74448,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) @@ -74004,16 +74479,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -74026,13 +74501,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5989, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+6014, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -74101,7 +74579,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -74118,8 +74597,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) pData0 = aMem + uintptr(nField)*56 @@ -74134,10 +74613,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 @@ -74224,10 +74703,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -74306,16 +74785,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -74327,9 +74806,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -74371,9 +74850,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { libc.X__builtin___memcpy_chk(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn), libc.X__builtin_object_size(tls, zPayload, 0)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) @@ -74403,6 +74882,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) @@ -74424,6 +74904,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -74434,7 +74915,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6030, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6055, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -74476,19 +74957,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+6081, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6106, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6103, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6128, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -74497,18 +74979,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -74530,8 +75012,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -74546,8 +75029,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -74608,6 +75092,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 /* At least this one VM is active */ @@ -74620,13 +75105,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+6157, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6182, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -74636,9 +75121,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -74650,16 +75135,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 6212 + v250 = __ccgo_ts + 6237 } else { if iRollback != 0 { - v249 = __ccgo_ts + 6260 + v251 = __ccgo_ts + 6285 } else { - v249 = __ccgo_ts + 6303 + v251 = __ccgo_ts + 6328 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -74699,6 +75184,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 104)) = 0 if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(libc.Uint64FromInt32(SQLITE_QueryOnly)|uint64(libc.Int32FromInt32(0x00002))<>0)) == int32(1) { rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)< 0 { /* Make register reg[P3] into a value that can be used as the data ** form sqlite3BtreeInsert() where the length of the data is zero. */ @@ -75079,11 +75574,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) @@ -75117,6 +75612,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) if pCx2 == uintptr(0) { goto no_mem @@ -75135,11 +75631,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -75160,6 +75657,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) if pCx3 == uintptr(0) { goto no_mem @@ -75178,7 +75676,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) goto _187 @@ -75272,10 +75771,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) eqOnly = 0 @@ -75354,11 +75857,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) @@ -75404,6 +75907,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 } else { @@ -75481,6 +75985,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first ** opcode past the OP_SeekGE itself. */ @@ -75494,29 +75999,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -75529,8 +76037,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -75547,6 +76056,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -75563,6 +76073,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { goto jump_to_p2_and_check_for_interrupt @@ -75659,14 +76170,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } /* Fall through into OP_NotFound */ - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) @@ -75678,11 +76193,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { /* Composite key generated by OP_MakeRecord */ if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 if rc != 0 { goto no_mem } @@ -75722,8 +76237,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -75780,6 +76296,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -75802,10 +76319,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto notExistsWithKey } /* Fall through into OP_NotExists */ - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) *(*int32)(unsafe.Pointer(bp + 248)) = 0 @@ -75817,7 +76336,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -75834,12 +76353,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -75856,7 +76376,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -75902,8 +76423,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -75935,15 +76457,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -75997,7 +76520,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -76031,11 +76555,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -76052,11 +76576,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if pTab1 != 0 { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -76070,15 +76594,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -76125,6 +76650,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) /* If the update-hook or pre-update-hook will be invoked, set zDb to @@ -76145,11 +76671,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Invoke the pre-update-hook if required. */ if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -76178,6 +76704,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -76197,6 +76724,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -76222,6 +76750,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) @@ -76259,6 +76788,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) @@ -76295,6 +76825,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { @@ -76337,6 +76868,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { /* If the cursor is not already open, create a special kind of @@ -76378,8 +76910,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) *(*int32)(unsafe.Pointer(bp + 392)) = 0 @@ -76408,6 +76942,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) @@ -76445,8 +76980,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Fall through into OP_Rewind */ /* Opcode: Rewind P1 P2 * * * @@ -76465,6 +77002,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { @@ -76540,17 +77078,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -76592,17 +77134,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ } if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -76611,11 +77154,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { goto abort_due_to_error @@ -76629,14 +77172,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -76661,6 +77205,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo @@ -76678,7 +77223,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -76874,6 +77426,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { @@ -76914,6 +77467,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -76935,6 +77489,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) @@ -76955,6 +77510,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 @@ -76971,6 +77527,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -77002,6 +77559,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -77014,13 +77572,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6389 + zSchema = __ccgo_ts + 6414 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6403, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6428, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -77035,7 +77593,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -77056,6 +77614,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { goto abort_due_to_error @@ -77070,6 +77629,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -77081,6 +77641,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -77092,6 +77653,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -77113,7 +77675,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -77140,7 +77703,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { @@ -77159,6 +77723,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { /* The boolean index is empty */ @@ -77193,6 +77758,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -77229,7 +77795,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 /* If the p5 flag is clear, then recursive invocation of triggers is @@ -77250,8 +77817,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -77260,7 +77828,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6446, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6471, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -77306,8 +77874,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { @@ -77322,17 +77891,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.X__builtin___memset_chk(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8)), libc.X__builtin_object_size(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0)) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -77349,6 +77918,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -77363,6 +77933,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -77385,7 +77956,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -77408,14 +77980,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -77439,7 +78013,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) @@ -77465,18 +78040,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -77497,7 +78073,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -77512,7 +78089,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6483 + v286 = __ccgo_ts + 6508 } else { - v284 = __ccgo_ts + 6488 + v286 = __ccgo_ts + 6513 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6495, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6520, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -77769,11 +78356,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -77800,12 +78387,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -77817,6 +78405,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt rc = _sqlite3BtreeIncrVacuum(tls, pBt2) if rc != 0 { @@ -77844,6 +78433,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -77856,6 +78446,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) goto _187 @@ -77865,6 +78456,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) goto _187 @@ -77884,6 +78476,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6586, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6611, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -78549,8 +79167,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -78569,7 +79188,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ goto _187 /***************************************************************************** ** The cases of the switch statement above this line should all be indented @@ -78578,6 +79198,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -78585,17 +79206,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -78638,12 +79262,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5746, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5771, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1620, 0) rc = int32(SQLITE_NOMEM) @@ -78652,16 +79278,17 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error return r } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5903, - 1: __ccgo_ts + 5912, - 2: __ccgo_ts + 5919, - 3: __ccgo_ts + 5925, + 0: __ccgo_ts + 5928, + 1: __ccgo_ts + 5937, + 2: __ccgo_ts + 5944, + 3: __ccgo_ts + 5950, } var _and_logic = [9]uint8{ @@ -78815,13 +79442,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1636 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6624 + v3 = __ccgo_ts + 6649 } else { - v3 = __ccgo_ts + 6629 + v3 = __ccgo_ts + 6654 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6637, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6662, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -78839,7 +79466,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6666, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6691, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -78882,15 +79509,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6686, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6711, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6716, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6741, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6752, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6777, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -78915,11 +79542,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6773, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6798, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -78945,14 +79573,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6794 + zFault = __ccgo_ts + 6819 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -78968,19 +79598,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6806 + zFault = __ccgo_ts + 6831 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6814, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6839, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -79041,6 +79673,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -79140,7 +79773,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -79239,7 +79872,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -80239,6 +80872,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -80358,6 +80992,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -80417,6 +81052,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -80506,6 +81142,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -80561,6 +81198,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -80616,6 +81254,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -80821,6 +81460,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -80843,6 +81483,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -80995,6 +81636,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -81072,6 +81714,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -81138,6 +81781,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -81543,6 +82187,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -81553,6 +82198,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -81731,6 +82377,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -81795,6 +82442,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -81818,6 +82466,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -81899,6 +82548,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -81914,6 +82564,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -81955,6 +82606,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -81986,6 +82638,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -82006,6 +82659,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -82212,6 +82866,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -82377,6 +83032,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -82397,6 +83053,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -82432,6 +83089,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -82469,6 +83127,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -82579,6 +83238,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -82789,6 +83449,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -82887,6 +83548,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -82981,6 +83643,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -83164,6 +83827,9 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE var _ /* temp at bp+0 */ TExpr _, _, _ = db, pDup, pOrig /* The database connection */ pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -83221,6 +83887,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -83234,6 +83901,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -83334,25 +84002,25 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { var zLegacy uintptr _ = zLegacy - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6848, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6873, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6856+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6875+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6881+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6900+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6389+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6414+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6894+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6919+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6894+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6919+7) == 0 { return int32(1) } } @@ -83435,9 +84103,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6908, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6933, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -83518,6 +84187,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -83529,7 +84199,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6913) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6938) != 0 { goto _2 } } @@ -83599,15 +84269,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } @@ -83635,11 +84316,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6915, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6940, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6919, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6944, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -83648,7 +84329,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6923, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6948, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -83671,6 +84352,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -83727,8 +84409,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -83763,15 +84445,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6932, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6957, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6963, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6988, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -83784,6 +84466,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -83822,7 +84505,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+7018, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+7043, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.X__builtin___memset_chk(tls, pExpr+64, 0, uint64(8), libc.X__builtin_object_size(tls, pExpr+64, 0)) return int32(WRC_Prune) @@ -83851,7 +84534,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7053 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7078 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -83861,18 +84544,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 7062 + v10 = __ccgo_ts + 7087 } else { - v10 = __ccgo_ts + 7077 + v10 = __ccgo_ts + 7102 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7099, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7124, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7112, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7137, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7122, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7147, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -83907,6 +84590,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) @@ -83994,19 +84678,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 7129 + zIn = __ccgo_ts + 7154 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 7157 + zIn = __ccgo_ts + 7182 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 7175 + zIn = __ccgo_ts + 7200 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 7193 + zIn = __ccgo_ts + 7218 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7211, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7236, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -84052,10 +84736,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { @@ -84086,6 +84770,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -84100,29 +84797,51 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -84143,7 +84862,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } else { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7231, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7256, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -84167,22 +84886,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) if pDef == uintptr(0) { @@ -84199,7 +84918,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7248, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7273, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -84213,17 +84932,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7312, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7337, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -84244,7 +84963,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7348, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7373, uintptr(0), pExpr) } } else { /* Must fit in 8 bits */ @@ -84268,29 +84987,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7376, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7401, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7419 + zType = __ccgo_ts + 7444 } else { - zType = __ccgo_ts + 7426 + zType = __ccgo_ts + 7451 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7436, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7461, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7464, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7489, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7486, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7511, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7530, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7555, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -84307,11 +85026,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -84327,11 +85046,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -84350,15 +85069,15 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -84375,7 +85094,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7578, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7603, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } @@ -84386,7 +85105,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } case int32(TK_VARIABLE): if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7589, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7614, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -84432,17 +85151,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -84476,6 +85195,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -84541,6 +85261,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -84555,7 +85276,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7600, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7625, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -84590,7 +85311,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7656, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7681, 0) return int32(1) } i = 0 @@ -84601,6 +85322,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -84627,7 +85349,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7690, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7715, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -84685,6 +85407,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -84696,11 +85419,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7696, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7721, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -84729,7 +85453,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7757, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7782, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -84758,6 +85482,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -84891,10 +85616,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -85000,6 +85727,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -85037,16 +85765,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7788, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7813, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -85059,6 +85789,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -85072,6 +85803,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -85100,7 +85832,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7690) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7715) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -85111,7 +85843,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7827) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7852) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -85121,11 +85853,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7858, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -85283,6 +86016,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -85504,6 +86238,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -85573,7 +86308,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -85646,6 +86385,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -86094,7 +86834,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) return } if int32(op) == int32(TK_LE) { @@ -86148,6 +86888,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -86172,7 +86913,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7892, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7917, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -86209,6 +86950,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -86230,6 +86972,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -86514,11 +87257,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7940 + v2 = __ccgo_ts + 7965 } else { v2 = __ccgo_ts + 1650 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7942, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7967, libc.VaList(bp+8, nExprElem, v2, nElem)) break } pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) @@ -86532,6 +87275,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -86594,7 +87338,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u } *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7986, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8011, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -86614,7 +87358,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8020, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8045, libc.VaList(bp+8, p)) } // C documentation @@ -86685,7 +87429,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8070, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8095, libc.VaList(bp+8, pExpr)) } } } @@ -86737,7 +87481,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8090, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8115, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -86770,7 +87514,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8133, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8158, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -87155,6 +87899,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -87283,6 +88028,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -87360,6 +88106,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -87389,6 +88136,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -87448,6 +88196,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -87603,7 +88352,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8156, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8181, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -87622,6 +88371,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -87635,6 +88385,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -87729,7 +88480,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8186, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8211, libc.VaList(bp+8, zObject)) } } @@ -87752,6 +88503,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -87794,6 +88546,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -87825,10 +88578,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8209) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8234) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8214) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8239) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -88144,6 +88897,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -88176,6 +88930,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -88383,13 +89138,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+8220) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8245) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+8228) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8253) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+8234) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+8259) == 0 { return int32(1) } return 0 @@ -88407,9 +89162,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 8220, - 1: __ccgo_ts + 8228, - 2: __ccgo_ts + 8234, + 0: __ccgo_ts + 8245, + 1: __ccgo_ts + 8253, + 2: __ccgo_ts + 8259, } ii = 0 for { @@ -88426,6 +89181,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -88433,6 +89189,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -88497,6 +89254,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -88656,6 +89414,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -88687,7 +89446,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8238, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8263, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -88716,6 +89475,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -88764,6 +89524,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -88779,12 +89540,13 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8546, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8571, libc.VaList(bp+160, pExpr)) } else { return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -90388,7 +91167,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8573, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8598, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -90411,6 +91190,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -90492,7 +91272,7 @@ expr_code_doover: } n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8156, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8181, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -90554,7 +91334,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7000, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7025, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -90612,7 +91392,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -90656,6 +91436,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -90668,7 +91449,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, endLabel) case int32(TK_RAISE): if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8597, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8622, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -90729,6 +91510,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -90945,6 +91727,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -91090,7 +91873,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -91107,9 +91892,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -91129,7 +91916,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -91138,11 +91927,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -91151,15 +91946,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -91172,7 +91971,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -91185,6 +91986,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -91277,7 +92079,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -91294,9 +92098,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -91318,7 +92124,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -91327,11 +92135,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -91340,15 +92154,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -91358,7 +92176,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -91371,6 +92191,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -91608,6 +92429,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -91823,6 +92645,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -92024,6 +92853,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -92075,6 +92905,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -92084,6 +92915,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -92258,6 +93090,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } @@ -92288,6 +93121,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -92299,6 +93133,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) @@ -92347,6 +93182,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -92365,6 +93201,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -92412,6 +93249,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -92436,6 +93274,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -92538,6 +93377,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -92671,6 +93511,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -92721,8 +93562,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8647, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8672, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92741,9 +93582,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8675, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8700, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8850, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8875, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -92759,9 +93600,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9024, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9049, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9171, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9196, 0) } } @@ -92817,7 +93658,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9322, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9347, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -92826,11 +93667,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9381, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9406, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9387, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9412, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -92860,21 +93701,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9414, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9439, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9598, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9623, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9903, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9919, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9928, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9944, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9977, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10002, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -92890,8 +93731,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+10242, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+10267, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -92905,7 +93747,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10255, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10280, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -92945,11 +93787,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10293, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10318, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10325, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10350, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -92965,10 +93807,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10352) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10377) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10411) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10436) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -92980,13 +93822,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10464) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10489) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10510) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10535) } } /* Modify the CREATE TABLE statement. */ @@ -93000,7 +93842,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10537, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10562, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -93028,7 +93870,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10683, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10708, libc.VaList(bp+16, zTab, zDb)) } } } @@ -93066,12 +93908,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11036, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11061, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11070, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11095, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -93095,7 +93937,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+11100, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+11125, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { goto exit_begin_add_column } @@ -93110,6 +93952,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } (*(*struct { @@ -93132,6 +93975,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { FpDfltList uintptr })(unsafe.Pointer(pTab + 64))).FaddColOffset exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -93153,18 +93997,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 11119 + zType = __ccgo_ts + 11144 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 11124 + zType = __ccgo_ts + 11149 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 11138 + v1 = __ccgo_ts + 11163 } else { - v1 = __ccgo_ts + 11155 + v1 = __ccgo_ts + 11180 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11173, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11198, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -93221,10 +94065,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11191, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11216, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -93240,12 +94085,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld goto exit_rename_column } bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11212, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11394, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11237, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11419, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+10242, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+10267, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -93353,6 +94199,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -93417,6 +94264,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -93441,6 +94289,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -93473,6 +94322,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -93491,6 +94341,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -93546,6 +94397,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -93568,6 +94420,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -93606,6 +94459,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -93676,6 +94530,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -93685,6 +94540,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -93708,11 +94564,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11525 + v1 = __ccgo_ts + 11550 } else { v1 = __ccgo_ts + 1650 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11527, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11552, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -93741,6 +94597,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -93769,6 +94626,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -93787,8 +94645,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11550, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11575, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -93804,7 +94662,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -93843,7 +94701,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11558, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11583, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -93888,11 +94746,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 _sqlite3Dequote(tls, zBuf1) if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11525 + v1 = __ccgo_ts + 11550 } else { v1 = __ccgo_ts + 1650 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11564, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11589, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -93931,6 +94789,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -94022,6 +94881,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -94061,6 +94921,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -94103,11 +94964,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -94266,6 +95129,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -94276,6 +95140,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -94287,6 +95152,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } @@ -94312,10 +95178,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -94347,6 +95215,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -94359,6 +95228,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -94419,6 +95289,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -94517,6 +95388,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -94566,11 +95438,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -94690,6 +95564,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -94847,7 +95722,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -94864,10 +95739,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11569, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11594, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -94916,23 +95792,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11191, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11216, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11576 + v1 = __ccgo_ts + 11601 } else { - v1 = __ccgo_ts + 5912 + v1 = __ccgo_ts + 5937 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11588, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11613, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11616, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11641, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -94944,10 +95820,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1650, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11664, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11689, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11785, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11810, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -94977,6 +95853,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -95010,6 +95887,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -95029,6 +95907,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -95046,27 +95925,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11803, + FzName: __ccgo_ts + 11828, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11824, + FzName: __ccgo_ts + 11849, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11844, + FzName: __ccgo_ts + 11869, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11863, + FzName: __ccgo_ts + 11888, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11882, + FzName: __ccgo_ts + 11907, }, } @@ -95277,7 +96156,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11985, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12010, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -95288,10 +96167,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12008, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12033, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12038, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12063, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -95300,6 +96179,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -95312,6 +96192,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -95321,15 +96202,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11905, - FzCols: __ccgo_ts + 11918, + FzName: __ccgo_ts + 11930, + FzCols: __ccgo_ts + 11943, }, 1: { - FzName: __ccgo_ts + 11931, - FzCols: __ccgo_ts + 11944, + FzName: __ccgo_ts + 11956, + FzCols: __ccgo_ts + 11969, }, 2: { - FzName: __ccgo_ts + 11972, + FzName: __ccgo_ts + 11997, }, } @@ -95498,6 +96379,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -95508,6 +96390,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -95604,6 +96487,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } i = 0 @@ -95614,6 +96498,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -95627,7 +96512,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12056, + FzName: __ccgo_ts + 12081, } func init() { @@ -95665,6 +96550,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -95739,6 +96625,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -95772,6 +96659,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.X__builtin___memset_chk(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero), libc.X__builtin_object_size(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -95787,6 +96675,7 @@ find_new_min: } goto _2 _2: + ; i++ } (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin @@ -95819,6 +96708,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -95835,10 +96725,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -95858,10 +96750,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -95910,6 +96804,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -95927,6 +96822,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -95941,6 +96837,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -95974,6 +96871,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -95987,7 +96885,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12066, + FzName: __ccgo_ts + 12091, } func init() { @@ -96037,7 +96935,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12076, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12101, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -96048,9 +96946,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12081, libc.VaList(bp+72, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+12106, libc.VaList(bp+72, iVal)) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -96086,9 +96985,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+12087, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+12112, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -96103,7 +97003,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12093, + FzName: __ccgo_ts + 12118, } func init() { @@ -96169,7 +97069,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+12102, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+12127, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -96183,7 +97083,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.X__builtin___memcpy_chk(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11905, uint64(13), libc.X__builtin_object_size(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, 0)) + libc.X__builtin___memcpy_chk(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11930, uint64(13), libc.X__builtin_object_size(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, 0)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -96337,6 +97237,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -96358,6 +97259,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -96385,6 +97287,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -96405,7 +97308,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12112, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12137, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -96442,6 +97345,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -96464,6 +97368,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -96477,6 +97382,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -96486,7 +97392,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12112, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+12137, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -96537,6 +97443,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -96557,9 +97464,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+12116) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+12141) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+12120) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+12145) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -96606,6 +97513,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -96715,23 +97623,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+12124, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12149, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+12135, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12160, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+12145, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+12170, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -96842,6 +97751,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -96909,6 +97819,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -96920,6 +97831,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -97023,6 +97935,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } } @@ -97103,11 +98016,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11931, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11956, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+12157, __ccgo_ts+12226, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+12182, __ccgo_ts+12251, zDb) } return rc } @@ -97153,6 +98066,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -97166,15 +98080,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11905, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11930, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+12278, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+12303, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -97194,6 +98109,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -97219,6 +98135,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -97285,7 +98202,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6908, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6933, zName) == 0) } // C documentation @@ -97341,7 +98258,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12319, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12344, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -97372,7 +98289,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12322, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12347, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -97381,11 +98298,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { break } if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12359, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12384, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -97428,7 +98346,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12389, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12414, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -97436,7 +98354,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12418, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12443, 0) rc = int32(SQLITE_ERROR) } } @@ -97483,7 +98401,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1620, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 24)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12486, libc.VaList(bp+56, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12511, libc.VaList(bp+56, zFile)) } } } @@ -97491,6 +98409,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 24)), -int32(1)) @@ -97539,18 +98458,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12514, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12539, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12535, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12560, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12561, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12586, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -97569,6 +98489,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -97622,6 +98543,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -97641,7 +98563,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12583, + FzName: __ccgo_ts + 12608, } func init() { @@ -97663,7 +98585,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12597, + FzName: __ccgo_ts + 12622, } func init() { @@ -97689,7 +98611,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12611, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12636, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -97723,7 +98645,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12635, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12660, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -97738,6 +98660,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -97752,6 +98675,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -97839,6 +98763,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -97936,7 +98861,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12681, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12706, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -97964,11 +98889,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12704, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12729, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12710, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12735, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12716, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12741, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -98014,6 +98939,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -98027,7 +98953,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 8228 + zCol = __ccgo_ts + 8253 } } if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -98062,7 +98988,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12743, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12768, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -98174,6 +99100,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -98224,6 +99151,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -98289,6 +99217,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -98317,6 +99246,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -98332,6 +99262,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -98360,6 +99291,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*32))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*32 + 24))) goto _5 _5: + ; i++ } } @@ -98471,26 +99403,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6908) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6933) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6875+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6389+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6856) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6900+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6414+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6881) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6389) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6414) } } } @@ -98517,14 +99450,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6894+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6389) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6919+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6414) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6875+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6856) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6900+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6881) } } } @@ -98562,7 +99496,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12758, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12783, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -98580,15 +99514,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12766 + v1 = __ccgo_ts + 12791 } else { - v1 = __ccgo_ts + 12779 + v1 = __ccgo_ts + 12804 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7112, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7137, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7122, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7147, libc.VaList(bp+8, zMsg, zName)) } } else { } @@ -98626,12 +99560,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6389+7) == 0 { - return __ccgo_ts + 6894 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6414+7) == 0 { + return __ccgo_ts + 6919 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6856+7) == 0 { - return __ccgo_ts + 6875 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6881+7) == 0 { + return __ccgo_ts + 6900 } } return zName @@ -98678,6 +99612,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -98765,6 +99700,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -98804,6 +99740,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -98836,6 +99773,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -98991,6 +99929,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -99050,6 +99989,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -99150,7 +100090,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6389) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6414) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -99182,11 +100122,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6908, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6933, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -99239,13 +100180,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12793, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12818, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12810, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12835, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -99293,8 +100234,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6848, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12830, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6873, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12855, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -99316,6 +100257,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -99342,6 +100284,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -99374,6 +100317,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -99436,6 +100380,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -99505,9 +100450,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -99520,7 +100465,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12872, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12897, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -99536,9 +100481,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 11119 + v2 = __ccgo_ts + 11144 } else { - v2 = __ccgo_ts + 9381 + v2 = __ccgo_ts + 9406 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -99548,9 +100493,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui } zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6856 + v3 = __ccgo_ts + 6881 } else { - v3 = __ccgo_ts + 6389 + v3 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -99574,11 +100519,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 11119 + v4 = __ccgo_ts + 11144 } else { - v4 = __ccgo_ts + 9381 + v4 = __ccgo_ts + 9406 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12913, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12938, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -99586,7 +100531,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12934, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12959, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -99675,6 +100620,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -99736,7 +100682,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12969, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12994, 0) } else { } (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) @@ -99752,7 +100698,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+13003, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+13028, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -99799,7 +100745,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13023, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13048, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -99809,12 +100755,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+13046, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+13071, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+13053, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+13078, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -99842,6 +100788,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -99862,12 +100809,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13063, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13088, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -99931,6 +100879,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -100068,10 +101017,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13089, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13114, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13134, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13159, 0) } else { libc.X__builtin___memset_chk(tls, bp, 0, uint64(72), libc.X__builtin_object_size(tls, bp, 0)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -100129,7 +101078,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13200, 0) } } @@ -100166,7 +101115,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13227, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13252, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) @@ -100198,11 +101147,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -100220,13 +101171,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13268, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13293, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -100256,6 +101208,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1)))))])&int32(0x01) != 0 { @@ -100307,6 +101260,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -100332,17 +101286,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13324, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13349, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13367, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13392, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13375, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13400, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -100372,8 +101326,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13382, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13407, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -100429,6 +101385,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -100466,6 +101423,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -100489,6 +101447,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -100524,18 +101483,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1650 - zSep2 = __ccgo_ts + 13413 - zEnd = __ccgo_ts + 5429 + zSep2 = __ccgo_ts + 13438 + zEnd = __ccgo_ts + 5454 } else { - zSep = __ccgo_ts + 13415 - zSep2 = __ccgo_ts + 13419 - zEnd = __ccgo_ts + 13424 + zSep = __ccgo_ts + 13440 + zSep2 = __ccgo_ts + 13444 + zEnd = __ccgo_ts + 13449 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -100543,7 +101503,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13427, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13452, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -100565,6 +101525,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(bp)) += len1 goto _3 _3: + ; i++ pCol += 16 } @@ -100574,11 +101535,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1650, - 1: __ccgo_ts + 13441, - 2: __ccgo_ts + 13447, - 3: __ccgo_ts + 13452, - 4: __ccgo_ts + 13457, - 5: __ccgo_ts + 13447, + 1: __ccgo_ts + 13466, + 2: __ccgo_ts + 13472, + 3: __ccgo_ts + 13477, + 4: __ccgo_ts + 13482, + 5: __ccgo_ts + 13472, } // C documentation @@ -100635,6 +101596,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -100671,6 +101633,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -100730,6 +101693,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -100776,6 +101740,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -100831,6 +101796,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -100887,6 +101853,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -100930,6 +101897,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -100957,10 +101925,12 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -100976,6 +101946,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -100994,6 +101965,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _recomputeColumnsNotIndexed(tls, pPk) @@ -101083,6 +102055,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -101195,9 +102168,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13463, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13488, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13496, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13521, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -101211,17 +102184,18 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13523, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13548, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13573, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13598, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -101264,10 +102238,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13605, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13630, 0) return } } @@ -101281,6 +102256,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -101300,12 +102276,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9381 - zType2 = __ccgo_ts + 13649 + zType = __ccgo_ts + 9406 + zType2 = __ccgo_ts + 13674 } else { /* A view */ - zType = __ccgo_ts + 11119 - zType2 = __ccgo_ts + 13655 + zType = __ccgo_ts + 11144 + zType2 = __ccgo_ts + 13680 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -101388,13 +102364,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13660, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13685, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13675, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13700, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -101403,17 +102379,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13773, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13798, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13815, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13840, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13849, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13874, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13870, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13895, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -101430,7 +102406,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9903) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9928) == 0 { (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } } @@ -101463,7 +102439,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13902, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13927, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -101475,11 +102451,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+11119, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+11144, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -101522,6 +102499,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -101573,7 +102551,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13938, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13963, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } /* If we get this far, it means we need to compute the table names. @@ -101678,6 +102656,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -101719,6 +102698,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -101733,6 +102713,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -101754,7 +102735,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13968, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13993, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -101767,7 +102748,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13983, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14008, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -101818,6 +102799,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -101849,12 +102831,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+14050, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+14075, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+12008, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+12033, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -101891,7 +102874,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14064, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14089, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -101900,7 +102883,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14109, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14134, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -101935,11 +102918,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3420, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7589, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7614, int32(10)) == 0 { return 0 } return int32(1) @@ -101994,9 +102977,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -102029,18 +103012,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14176, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14201, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14204, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14229, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14238, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14263, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -102050,12 +103033,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12120, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12145, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102096,13 +103080,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14270, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14295, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14358, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -102118,6 +103102,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -102160,10 +103145,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14427, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14452, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -102171,6 +103157,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -102190,6 +103177,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -102214,6 +103202,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -102419,15 +103408,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14473 + v2 = __ccgo_ts + 14498 } else { - v2 = __ccgo_ts + 14479 + v2 = __ccgo_ts + 14504 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14484, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14509, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -102500,7 +103490,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14512, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14537, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -102510,7 +103500,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14518, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14543, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -102524,16 +103514,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14568, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14593, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14596, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14621, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14646, 0) goto exit_create_index } /* @@ -102554,19 +103544,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if zName == uintptr(0) { goto exit_create_index } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14512, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14537, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14655, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14680, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14689, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14714, libc.VaList(bp+136, zName)) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -102583,10 +103573,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14713, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14738, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -102604,9 +103595,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6856 + v2 = __ccgo_ts + 6881 } else { - v2 = __ccgo_ts + 6389 + v2 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -102634,7 +103625,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14512) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14537) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -102653,6 +103644,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -102717,7 +103709,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14736, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14761, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -102767,6 +103759,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -102791,6 +103784,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } } else { @@ -102821,6 +103815,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -102848,6 +103843,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -102860,7 +103856,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14797, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14822, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -102878,6 +103874,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -102889,8 +103886,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14839, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14864, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -102932,9 +103929,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1650 } else { - v13 = __ccgo_ts + 14856 + v13 = __ccgo_ts + 14881 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14864, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14889, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -102942,7 +103939,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14884, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14909, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -102950,7 +103947,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14943, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14968, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -102969,6 +103966,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -102997,6 +103995,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -103070,6 +104069,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) goto _3 _3: + ; i++ } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { @@ -103109,7 +104109,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14970, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14995, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -103118,7 +104118,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14988, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15013, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -103126,9 +104126,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -103144,13 +104144,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+15061, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12116, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+12141, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -103259,6 +104260,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -103283,6 +104285,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -103332,7 +104335,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15121, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -103355,6 +104358,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -103368,6 +104372,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -103476,6 +104481,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -103528,6 +104534,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -103560,11 +104567,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 15157 + v1 = __ccgo_ts + 15182 } else { - v1 = __ccgo_ts + 15160 + v1 = __ccgo_ts + 15185 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15166, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15191, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -103602,6 +104609,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) return uintptr(0) @@ -103712,6 +104720,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -103729,6 +104738,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -103737,6 +104747,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -103757,7 +104768,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { var eTxnType, i int32 _, _, _, _, _ = db, eTxnType, i, pBt, v db = (*TParse)(unsafe.Pointer(pParse)).Fdb - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+15202, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+15227, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -103784,6 +104795,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -103803,9 +104815,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _, _, _ = isRollback, v, v1 isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 15208 + v1 = __ccgo_ts + 15233 } else { - v1 = __ccgo_ts + 15217 + v1 = __ccgo_ts + 15242 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -103837,9 +104849,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 15202, - 1: __ccgo_ts + 15224, - 2: __ccgo_ts + 15208, + 0: __ccgo_ts + 15227, + 1: __ccgo_ts + 15249, + 2: __ccgo_ts + 15233, } // C documentation @@ -103859,7 +104871,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15232, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15257, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -103924,6 +104936,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -104042,7 +105055,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+15302, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+15327, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -104051,13 +105064,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx } zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*16))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+15313, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+15338, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1663, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -104082,10 +105096,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12704, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12729, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15432, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15457, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -105175,11 +106202,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15465, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15490, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15494, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15519, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -105298,6 +106325,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -105383,6 +106411,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -105451,6 +106480,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -105579,9 +106609,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15532) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15557) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -105683,6 +106714,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -105724,7 +106756,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11905) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11930) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -105815,6 +106847,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -105901,6 +106934,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -106002,6 +107036,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -106025,10 +107060,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6629, - 1: __ccgo_ts + 6624, - 2: __ccgo_ts + 8520, - 3: __ccgo_ts + 8515, + 0: __ccgo_ts + 6654, + 1: __ccgo_ts + 6649, + 2: __ccgo_ts + 8545, + 3: __ccgo_ts + 8540, 4: __ccgo_ts + 1636, } @@ -106143,7 +107178,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15570, -int32(1)) return } iVal = -iVal @@ -106239,10 +107274,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -106330,6 +107367,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -106393,6 +107431,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -106452,7 +107491,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15562, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15587, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -106513,6 +107552,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106539,6 +107579,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -107030,7 +108071,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15568, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15593, -int32(1)) return } if argc == int32(3) { @@ -107042,7 +108083,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15601, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15626, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -107211,13 +108252,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5390, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15671, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15646, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15679, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -107238,6 +108279,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') @@ -107248,7 +108290,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15653, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15687, libc.VaList(bp+16, zArg)) default: Xsqlite3_str_append(tls, pStr, __ccgo_ts+1651, int32(4)) break @@ -107372,6 +108414,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -107411,6 +108454,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -107538,9 +108582,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -107592,7 +108638,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -107645,6 +108691,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } libc.X__builtin___memcpy_chk(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i), libc.X__builtin_object_size(tls, zOut+uintptr(j), 0)) @@ -107700,6 +108747,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -107725,6 +108773,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -107746,6 +108795,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -107769,6 +108819,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -107789,7 +108840,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11525, + 0: __ccgo_ts + 11550, } // C documentation @@ -107814,6 +108865,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -107842,6 +108894,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 @@ -107910,6 +108963,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -107933,6 +108987,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -107945,7 +109000,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15656, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15690, int32(4), libc.UintptrFromInt32(0)) } } @@ -108006,7 +109061,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12743, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12768, -int32(1)) return } if argc == int32(2) { @@ -108195,9 +109250,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15570, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -108217,7 +109272,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108236,7 +109291,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108537,7 +109592,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15661, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15695, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } @@ -108566,12 +109621,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15667, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15667, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15701, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15701, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -108872,562 +109928,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15672, + FzName: __ccgo_ts + 15706, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15692, + FzName: __ccgo_ts + 15726, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15739, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15723, + FzName: __ccgo_ts + 15757, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15732, + FzName: __ccgo_ts + 15766, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15755, + FzName: __ccgo_ts + 15789, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15840, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15815, + FzName: __ccgo_ts + 15849, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15826, + FzName: __ccgo_ts + 15860, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15833, + FzName: __ccgo_ts + 15867, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15853, + FzName: __ccgo_ts + 15887, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15853, + FzName: __ccgo_ts + 15887, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15859, + FzName: __ccgo_ts + 15893, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15859, + FzName: __ccgo_ts + 15893, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15868, + FzName: __ccgo_ts + 15902, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15872, + FzName: __ccgo_ts + 15906, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15879, + FzName: __ccgo_ts + 15913, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15887, + FzName: __ccgo_ts + 15921, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15894, + FzName: __ccgo_ts + 15928, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15907, + FzName: __ccgo_ts + 15941, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15913, + FzName: __ccgo_ts + 15947, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15920, + FzName: __ccgo_ts + 15954, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15961, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15969, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15940, + FzName: __ccgo_ts + 15974, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15950, + FzName: __ccgo_ts + 15984, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15956, + FzName: __ccgo_ts + 15990, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15962, + FzName: __ccgo_ts + 15996, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15989, + FzName: __ccgo_ts + 16023, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16030, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16003, + FzName: __ccgo_ts + 16037, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16014, + FzName: __ccgo_ts + 16048, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16021, + FzName: __ccgo_ts + 16055, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16036, + FzName: __ccgo_ts + 16070, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16053, + FzName: __ccgo_ts + 16087, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16064, + FzName: __ccgo_ts + 16098, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16070, + FzName: __ccgo_ts + 16104, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16088, + FzName: __ccgo_ts + 16122, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16096, + FzName: __ccgo_ts + 16130, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16110, + FzName: __ccgo_ts + 16144, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16118, + FzName: __ccgo_ts + 16152, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16127, + FzName: __ccgo_ts + 16161, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16127, + FzName: __ccgo_ts + 16161, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16134, + FzName: __ccgo_ts + 16168, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16134, + FzName: __ccgo_ts + 16168, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16144, + FzName: __ccgo_ts + 16178, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16148, + FzName: __ccgo_ts + 16182, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16154, + FzName: __ccgo_ts + 16188, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 16158, + FzName: __ccgo_ts + 16192, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 16158, + FzName: __ccgo_ts + 16192, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16164, + FzName: __ccgo_ts + 16198, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16164, + FzName: __ccgo_ts + 16198, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 16177, + FzName: __ccgo_ts + 16211, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 16188, + FzName: __ccgo_ts + 16222, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15667, + FzName: __ccgo_ts + 15701, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15667, + FzName: __ccgo_ts + 15701, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16193, + FzName: __ccgo_ts + 16227, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16198, + FzName: __ccgo_ts + 16232, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16206, + FzName: __ccgo_ts + 16240, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16212, + FzName: __ccgo_ts + 16246, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16218, + FzName: __ccgo_ts + 16252, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 16221, + FzName: __ccgo_ts + 16255, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 16225, + FzName: __ccgo_ts + 16259, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 16231, + FzName: __ccgo_ts + 16265, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16221, + FzName: __ccgo_ts + 16255, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16236, + FzName: __ccgo_ts + 16270, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16240, + FzName: __ccgo_ts + 16274, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16244, + FzName: __ccgo_ts + 16278, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16250, + FzName: __ccgo_ts + 16284, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16254, + FzName: __ccgo_ts + 16288, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16259, + FzName: __ccgo_ts + 16293, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16264, + FzName: __ccgo_ts + 16298, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16269, + FzName: __ccgo_ts + 16303, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16275, + FzName: __ccgo_ts + 16309, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16279, + FzName: __ccgo_ts + 16313, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16283, + FzName: __ccgo_ts + 16317, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16287, + FzName: __ccgo_ts + 16321, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16292, + FzName: __ccgo_ts + 16326, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16297, + FzName: __ccgo_ts + 16331, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16302, + FzName: __ccgo_ts + 16336, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16308, + FzName: __ccgo_ts + 16342, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16314, + FzName: __ccgo_ts + 16348, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16320, + FzName: __ccgo_ts + 16354, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16325, + FzName: __ccgo_ts + 16359, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 16333, + FzName: __ccgo_ts + 16367, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16341, + FzName: __ccgo_ts + 16375, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 16344, + FzName: __ccgo_ts + 16378, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 7053, + FzName: __ccgo_ts + 7078, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16349, + FzName: __ccgo_ts + 16383, }, } @@ -109841,6 +110897,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -109880,6 +110937,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -109887,6 +110945,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -109896,11 +110955,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16353, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16387, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -109963,6 +111023,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -110002,6 +111063,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -110032,6 +111094,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -110185,6 +111248,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -110220,6 +111284,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -110326,10 +111391,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -110377,6 +111444,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -110438,6 +111506,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -110486,10 +111555,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -110615,6 +111686,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -110650,6 +111722,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -110677,6 +111750,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -110750,6 +111824,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110793,10 +111868,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -110820,11 +111897,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110892,6 +111971,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -110908,6 +111988,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110990,11 +112071,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6919, + Fz: __ccgo_ts + 6944, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6915, + Fz: __ccgo_ts + 6940, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -111050,6 +112131,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -111057,7 +112139,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5548) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5573) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -111156,6 +112238,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -111207,6 +112290,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -111320,6 +112404,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 @@ -111360,6 +112445,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -111491,6 +112577,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -111499,6 +112586,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -111559,6 +112647,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -111585,6 +112674,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -111625,11 +112715,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8485, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8510, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -111751,6 +112842,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111856,6 +112948,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -112126,6 +113219,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -112147,13 +113241,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16398, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16432, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -112161,13 +113256,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16439, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16473, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -112258,6 +113354,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -112275,16 +113372,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16471, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16505, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16523, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16557, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -112316,6 +113414,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -112326,11 +113425,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16548, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16582, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16594, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16628, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -112344,7 +113443,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -112445,6 +113544,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112485,6 +113585,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -112642,6 +113743,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -112655,9 +113757,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16615) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16649) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -113046,7 +114149,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -115253,10 +116378,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16667, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16701, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -115273,9 +116399,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.X__builtin___memcpy_chk(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16671, uint64(6), libc.X__builtin_object_size(tls, zAltEntry+uintptr(iEntry), 0)) + libc.X__builtin___memcpy_chk(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16705, uint64(6), libc.X__builtin_object_size(tls, zAltEntry+uintptr(iEntry), 0)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -115287,7 +116414,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16677, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16711, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115302,7 +116429,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16720, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16754, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -115324,6 +116451,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -115331,7 +116459,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16752, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16786, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115340,7 +116468,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16629, + 0: __ccgo_ts + 16663, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -115370,6 +116498,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115453,6 +116582,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115503,6 +116633,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -115570,12 +116701,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16789, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16823, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -115623,63 +116755,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5804, - 1: __ccgo_ts + 16828, - 2: __ccgo_ts + 9381, - 3: __ccgo_ts + 16832, - 4: __ccgo_ts + 16837, - 5: __ccgo_ts + 16840, - 6: __ccgo_ts + 16850, - 7: __ccgo_ts + 16860, - 8: __ccgo_ts + 16866, - 9: __ccgo_ts + 16870, - 10: __ccgo_ts + 16875, - 11: __ccgo_ts + 16880, - 12: __ccgo_ts + 16888, - 13: __ccgo_ts + 16899, - 14: __ccgo_ts + 16902, - 15: __ccgo_ts + 16909, - 16: __ccgo_ts + 16870, - 17: __ccgo_ts + 16875, - 18: __ccgo_ts + 16916, - 19: __ccgo_ts + 16921, - 20: __ccgo_ts + 16924, - 21: __ccgo_ts + 16931, - 22: __ccgo_ts + 16866, - 23: __ccgo_ts + 16870, - 24: __ccgo_ts + 16937, - 25: __ccgo_ts + 16942, - 26: __ccgo_ts + 16947, - 27: __ccgo_ts + 16870, - 28: __ccgo_ts + 16951, - 29: __ccgo_ts + 16875, - 30: __ccgo_ts + 16959, - 31: __ccgo_ts + 16963, - 32: __ccgo_ts + 16968, - 33: __ccgo_ts + 12120, - 34: __ccgo_ts + 12116, - 35: __ccgo_ts + 16974, - 36: __ccgo_ts + 16979, - 37: __ccgo_ts + 16984, - 38: __ccgo_ts + 16828, - 39: __ccgo_ts + 16870, - 40: __ccgo_ts + 16989, - 41: __ccgo_ts + 16996, - 42: __ccgo_ts + 17003, - 43: __ccgo_ts + 9381, - 44: __ccgo_ts + 17011, - 45: __ccgo_ts + 5807, - 46: __ccgo_ts + 17017, - 47: __ccgo_ts + 16828, - 48: __ccgo_ts + 16870, - 49: __ccgo_ts + 17022, - 50: __ccgo_ts + 17027, - 51: __ccgo_ts + 16221, - 52: __ccgo_ts + 17032, - 53: __ccgo_ts + 17045, - 54: __ccgo_ts + 17054, - 55: __ccgo_ts + 17061, - 56: __ccgo_ts + 17072, + 0: __ccgo_ts + 5829, + 1: __ccgo_ts + 16862, + 2: __ccgo_ts + 9406, + 3: __ccgo_ts + 16866, + 4: __ccgo_ts + 16871, + 5: __ccgo_ts + 16874, + 6: __ccgo_ts + 16884, + 7: __ccgo_ts + 16894, + 8: __ccgo_ts + 16900, + 9: __ccgo_ts + 16904, + 10: __ccgo_ts + 16909, + 11: __ccgo_ts + 16914, + 12: __ccgo_ts + 16922, + 13: __ccgo_ts + 16933, + 14: __ccgo_ts + 16936, + 15: __ccgo_ts + 16943, + 16: __ccgo_ts + 16904, + 17: __ccgo_ts + 16909, + 18: __ccgo_ts + 16950, + 19: __ccgo_ts + 16955, + 20: __ccgo_ts + 16958, + 21: __ccgo_ts + 16965, + 22: __ccgo_ts + 16900, + 23: __ccgo_ts + 16904, + 24: __ccgo_ts + 16971, + 25: __ccgo_ts + 16976, + 26: __ccgo_ts + 16981, + 27: __ccgo_ts + 16904, + 28: __ccgo_ts + 16985, + 29: __ccgo_ts + 16909, + 30: __ccgo_ts + 16993, + 31: __ccgo_ts + 16997, + 32: __ccgo_ts + 17002, + 33: __ccgo_ts + 12145, + 34: __ccgo_ts + 12141, + 35: __ccgo_ts + 17008, + 36: __ccgo_ts + 17013, + 37: __ccgo_ts + 17018, + 38: __ccgo_ts + 16862, + 39: __ccgo_ts + 16904, + 40: __ccgo_ts + 17023, + 41: __ccgo_ts + 17030, + 42: __ccgo_ts + 17037, + 43: __ccgo_ts + 9406, + 44: __ccgo_ts + 17045, + 45: __ccgo_ts + 5832, + 46: __ccgo_ts + 17051, + 47: __ccgo_ts + 16862, + 48: __ccgo_ts + 16904, + 49: __ccgo_ts + 17056, + 50: __ccgo_ts + 17061, + 51: __ccgo_ts + 16255, + 52: __ccgo_ts + 17066, + 53: __ccgo_ts + 17079, + 54: __ccgo_ts + 17088, + 55: __ccgo_ts + 17095, + 56: __ccgo_ts + 17106, } // C documentation @@ -115698,191 +116830,191 @@ type PragmaName = TPragmaName var _aPragmaName = [67]TPragmaName{ 0: { - FzName: __ccgo_ts + 17080, + FzName: __ccgo_ts + 17114, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 17095, + FzName: __ccgo_ts + 17129, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 17110, + FzName: __ccgo_ts + 17144, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 17122, + FzName: __ccgo_ts + 17156, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 17138, + FzName: __ccgo_ts + 17172, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 17061, + FzName: __ccgo_ts + 17095, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 17151, + FzName: __ccgo_ts + 17185, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 17163, + FzName: __ccgo_ts + 17197, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 17183, + FzName: __ccgo_ts + 17217, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 17199, + FzName: __ccgo_ts + 17233, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 17220, + FzName: __ccgo_ts + 17254, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 17235, + FzName: __ccgo_ts + 17269, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 17251, + FzName: __ccgo_ts + 17285, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 17265, + FzName: __ccgo_ts + 17299, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 17278, + FzName: __ccgo_ts + 17312, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 17292, + FzName: __ccgo_ts + 17326, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 17311, + FzName: __ccgo_ts + 17345, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 17330, + FzName: __ccgo_ts + 17364, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17353, + FzName: __ccgo_ts + 17387, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17362, + FzName: __ccgo_ts + 17396, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17414, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17397, + FzName: __ccgo_ts + 17431, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17410, + FzName: __ccgo_ts + 17444, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17425, + FzName: __ccgo_ts + 17459, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17443, + FzName: __ccgo_ts + 17477, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17453, + FzName: __ccgo_ts + 17487, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17467, + FzName: __ccgo_ts + 17501, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17517, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17508, + FzName: __ccgo_ts + 17542, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17527, + FzName: __ccgo_ts + 17561, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17538, + FzName: __ccgo_ts + 17572, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17549, + FzName: __ccgo_ts + 17583, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -115890,151 +117022,151 @@ var _aPragmaName = [67]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17561, + FzName: __ccgo_ts + 17595, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17577, + FzName: __ccgo_ts + 17611, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17590, + FzName: __ccgo_ts + 17624, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17609, + FzName: __ccgo_ts + 17643, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17628, + FzName: __ccgo_ts + 17662, FePragTyp: uint8(PragTyp_LOCK_PROXY_FILE), FmPragFlg: uint8(PragFlg_NoColumns1), }, 37: { - FzName: __ccgo_ts + 17644, + FzName: __ccgo_ts + 17678, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17657, + FzName: __ccgo_ts + 17691, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 39: { - FzName: __ccgo_ts + 17672, + FzName: __ccgo_ts + 17706, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 40: { - FzName: __ccgo_ts + 17682, + FzName: __ccgo_ts + 17716, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 41: { - FzName: __ccgo_ts + 17694, + FzName: __ccgo_ts + 17728, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 42: { - FzName: __ccgo_ts + 17703, + FzName: __ccgo_ts + 17737, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 43: { - FzName: __ccgo_ts + 17714, + FzName: __ccgo_ts + 17748, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 44: { - FzName: __ccgo_ts + 17724, + FzName: __ccgo_ts + 17758, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 45: { - FzName: __ccgo_ts + 17736, + FzName: __ccgo_ts + 17770, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 46: { - FzName: __ccgo_ts + 17747, + FzName: __ccgo_ts + 17781, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 47: { - FzName: __ccgo_ts + 17759, + FzName: __ccgo_ts + 17793, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 48: { - FzName: __ccgo_ts + 17776, + FzName: __ccgo_ts + 17810, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 49: { - FzName: __ccgo_ts + 17795, + FzName: __ccgo_ts + 17829, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 50: { - FzName: __ccgo_ts + 17821, + FzName: __ccgo_ts + 17855, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 51: { - FzName: __ccgo_ts + 17836, + FzName: __ccgo_ts + 17870, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 52: { - FzName: __ccgo_ts + 17850, + FzName: __ccgo_ts + 17884, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 53: { - FzName: __ccgo_ts + 17869, + FzName: __ccgo_ts + 17903, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 54: { - FzName: __ccgo_ts + 17883, + FzName: __ccgo_ts + 17917, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 55: { - FzName: __ccgo_ts + 17899, + FzName: __ccgo_ts + 17933, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 56: { - FzName: __ccgo_ts + 17911, + FzName: __ccgo_ts + 17945, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17922, + FzName: __ccgo_ts + 17956, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 58: { - FzName: __ccgo_ts + 17933, + FzName: __ccgo_ts + 17967, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -116042,45 +117174,45 @@ var _aPragmaName = [67]TPragmaName{ FiArg: uint64(1), }, 59: { - FzName: __ccgo_ts + 17945, + FzName: __ccgo_ts + 17979, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 60: { - FzName: __ccgo_ts + 17956, + FzName: __ccgo_ts + 17990, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 61: { - FzName: __ccgo_ts + 17977, + FzName: __ccgo_ts + 18011, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 62: { - FzName: __ccgo_ts + 17985, + FzName: __ccgo_ts + 18019, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 63: { - FzName: __ccgo_ts + 18000, + FzName: __ccgo_ts + 18034, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 64: { - FzName: __ccgo_ts + 18013, + FzName: __ccgo_ts + 18047, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 65: { - FzName: __ccgo_ts + 18032, + FzName: __ccgo_ts + 18066, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 66: { - FzName: __ccgo_ts + 18047, + FzName: __ccgo_ts + 18081, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -116122,6 +117254,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -116180,10 +117313,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18063) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18097) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18073) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18107) { return PAGER_LOCKINGMODE_NORMAL } } @@ -116201,13 +117334,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8541) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8566) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18080) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18114) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18085) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+18119) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -116230,10 +117363,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17022) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17056) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+18097) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+18131) == 0 { return int32(2) } else { return 0 @@ -116255,7 +117388,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18104, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18138, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -116316,6 +117449,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -116384,15 +117518,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 18166 + zName = __ccgo_ts + 18200 case int32(OE_SetDflt): - zName = __ccgo_ts + 18175 + zName = __ccgo_ts + 18209 case int32(OE_Cascade): - zName = __ccgo_ts + 18187 + zName = __ccgo_ts + 18221 case int32(OE_Restrict): - zName = __ccgo_ts + 18195 + zName = __ccgo_ts + 18229 default: - zName = __ccgo_ts + 18204 + zName = __ccgo_ts + 18238 break } return zName @@ -116413,12 +117547,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 18214, - 1: __ccgo_ts + 18221, - 2: __ccgo_ts + 18229, - 3: __ccgo_ts + 18233, - 4: __ccgo_ts + 18097, - 5: __ccgo_ts + 18242, + 0: __ccgo_ts + 18248, + 1: __ccgo_ts + 18255, + 2: __ccgo_ts + 18263, + 3: __ccgo_ts + 18267, + 4: __ccgo_ts + 18131, + 5: __ccgo_ts + 18276, } // C documentation @@ -116480,25 +117614,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 18267 + zType = __ccgo_ts + 18301 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 18269 + zType = __ccgo_ts + 18303 } else { - zType = __ccgo_ts + 7940 + zType = __ccgo_ts + 7965 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18271, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18305, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 18246, - 2: __ccgo_ts + 18251, - 3: __ccgo_ts + 18259, + 1: __ccgo_ts + 18280, + 2: __ccgo_ts + 18285, + 3: __ccgo_ts + 18293, } // C documentation @@ -116539,8 +117674,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(256) defer tls.Free(256) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -116569,7 +117704,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pFile, pFile1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pPager2, pPager3, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, res1, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -116598,7 +117733,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+18278, libc.VaList(bp+184, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+18312, libc.VaList(bp+184, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -116745,7 +117880,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt b = -int32(1) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18282) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18316) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -116760,6 +117895,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -116815,7 +117951,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 18073 + zRet = __ccgo_ts + 18107 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -116834,6 +117970,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -116842,7 +117979,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) } if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 18063 + zRet = __ccgo_ts + 18097 } _returnSingleText(tls, v, zRet) break @@ -116852,7 +117989,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -116871,6 +118008,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -116900,6 +118038,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -117077,6 +118216,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -117129,7 +118269,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*int8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18287, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18321, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -117171,7 +118311,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p res1 = _sqlite3OsFileControl(tls, pFile1, int32(SQLITE_FCNTL_SET_LOCKPROXYFILE), libc.UintptrFromInt32(0)) } if res1 != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18312, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18346, 0) goto pragma_out } } @@ -117191,7 +118331,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18342, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18376, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -117224,7 +118364,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18395) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18429) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -117297,15 +118437,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } } pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18401 + v14 = __ccgo_ts + 18435 } else { - v14 = __ccgo_ts + 18409 + v14 = __ccgo_ts + 18443 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -117320,6 +118461,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+184, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -117375,7 +118517,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18416, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18450, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 88)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+88, uintptr(0)) @@ -117391,6 +118533,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117404,25 +118547,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 11119 + zType = __ccgo_ts + 11144 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13367 + zType = __ccgo_ts + 13392 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18432 + zType = __ccgo_ts + 18466 } else { - zType = __ccgo_ts + 9381 + zType = __ccgo_ts + 9406 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18439, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18473, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117461,13 +118606,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18446, libc.VaList(bp+184, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18480, libc.VaList(bp+184, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18451, libc.VaList(bp+184, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18485, libc.VaList(bp+184, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117486,13 +118632,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18456, - 1: __ccgo_ts + 18458, - 2: __ccgo_ts + 16899, + 0: __ccgo_ts + 18490, + 1: __ccgo_ts + 18492, + 2: __ccgo_ts + 16933, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18460, libc.VaList(bp+184, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18494, libc.VaList(bp+184, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117508,9 +118655,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { goto _24 } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18466, libc.VaList(bp+184, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18500, libc.VaList(bp+184, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117524,9 +118672,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18470, libc.VaList(bp+184, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18504, libc.VaList(bp+184, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117545,10 +118694,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -117560,6 +118711,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -117570,9 +118722,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7940, libc.VaList(bp+184, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7965, libc.VaList(bp+184, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -117581,9 +118734,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1608)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7940, libc.VaList(bp+184, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7965, libc.VaList(bp+184, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -117606,9 +118760,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18473, libc.VaList(bp+184, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18482)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18507, libc.VaList(bp+184, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18516)) goto _32 _32: + ; j2++ } i7++ @@ -117617,7 +118772,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -117677,6 +118832,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117724,6 +118880,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -117744,12 +118901,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18487, libc.VaList(bp+184, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18521, libc.VaList(bp+184, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 104))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117869,6 +119027,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -117877,6 +119036,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -117919,10 +119079,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -117933,7 +119095,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18491, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18525, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -117951,50 +119113,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -118019,6 +119137,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118041,6 +119160,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -118058,13 +119178,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 116)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 116)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18515, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18549, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -118073,6 +119193,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 116)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -118140,9 +119261,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18551, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18585, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -118155,7 +119277,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if bStrict != 0 && doTypeCheck != 0 { _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18571, libc.VaList(bp+184, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18605, libc.VaList(bp+184, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -118163,7 +119285,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18593, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18627, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -118174,10 +119296,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 116)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18616, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18650, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18618, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18652, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -118187,6 +119309,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -118204,12 +119327,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18638, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18672, libc.VaList(bp+184, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -118233,9 +119357,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 120))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18668) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18702) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18673) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18707) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -118248,9 +119372,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 120))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18694) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18728) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18730) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18764) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -118272,14 +119396,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18668) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18702) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18741) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18775) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -118300,13 +119425,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 120))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 120))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18768) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18802) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -118314,6 +119440,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 136))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118321,7 +119448,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 116)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18795) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18829) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -118340,6 +119467,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118349,17 +119477,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 112)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18824 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18858 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118417,27 +119612,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18885, libc.VaList(bp+184, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18919, libc.VaList(bp+184, zRight)) } } } @@ -118515,11 +119711,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118535,20 +119731,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18080) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18114) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18910) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18944) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18233) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18267) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -118572,11 +119768,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -118644,7 +119840,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -118653,22 +119849,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -118677,16 +119873,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -118695,15 +119891,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18918, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18952, libc.VaList(bp+184, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -118711,12 +119908,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -118814,6 +120013,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -118943,34 +120143,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18827, + FzName: __ccgo_ts + 18861, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18832, + FzName: __ccgo_ts + 18866, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18838, + FzName: __ccgo_ts + 18872, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18847, + FzName: __ccgo_ts + 18881, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18856, + FzName: __ccgo_ts + 18890, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18864, + FzName: __ccgo_ts + 18898, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18872, + FzName: __ccgo_ts + 18906, }, 7: { - FzName: __ccgo_ts + 18879, + FzName: __ccgo_ts + 18913, }, 8: {}, } @@ -119066,34 +120266,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18936) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18970) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18951, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18985, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = int8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18958, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18992, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18964) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18998) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18976) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+19010) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) _sqlite3StrAccumFinish(tls, bp) rc = Xsqlite3_declare_vtab(tls, db, bp+32) if rc == SQLITE_OK { @@ -119167,6 +120368,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -119179,6 +120381,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -119222,6 +120426,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -119294,17 +120499,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18991) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+19025) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18999, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19033, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19003, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+19037, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -119439,24 +120645,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+19037, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+19071, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5431 + v1 = __ccgo_ts + 5456 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+19065, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+19099, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+19096, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+19130, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119464,9 +120670,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 19007, - 1: __ccgo_ts + 19014, - 2: __ccgo_ts + 19026, + 0: __ccgo_ts + 19041, + 1: __ccgo_ts + 19048, + 2: __ccgo_ts + 19060, } // C documentation @@ -119489,6 +120695,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119541,7 +120748,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14839) + _corruptSchema(tls, pData, argv, __ccgo_ts+14864) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -119574,11 +120781,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+19104) + _corruptSchema(tls, pData, argv, __ccgo_ts+19138) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14839) + _corruptSchema(tls, pData, argv, __ccgo_ts+14864) } } } @@ -119617,18 +120824,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9381 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9406 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6856 + v2 = __ccgo_ts + 6881 } else { - v2 = __ccgo_ts + 6389 + v2 = __ccgo_ts + 6414 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8453 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 19117 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8478 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 19151 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -119689,6 +120896,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -119716,7 +120924,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12418) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12443) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119742,7 +120950,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+19189) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+19223) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119757,7 +120965,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl /* Read the schema information out of the schema tables */ (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+19213, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+19247, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -119795,11 +121003,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+19277, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+19311, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -120229,6 +121443,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -120240,7 +121455,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -120254,6 +121469,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120384,6 +121600,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -120765,6 +121982,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -120773,18 +121991,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11525 - zSp2 = __ccgo_ts + 11525 + zSp1 = __ccgo_ts + 11550 + zSp2 = __ccgo_ts + 11550 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19296, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19330, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -120857,6 +122076,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -120909,6 +122129,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -120958,6 +122179,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -121006,6 +122228,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -121071,7 +122294,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19326, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19360, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -121091,6 +122314,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -121120,7 +122344,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19376, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19410, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -121142,7 +122366,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19440, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19474, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -121164,6 +122388,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -121176,6 +122401,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -121184,7 +122410,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 7053, + Fz: __ccgo_ts + 7078, Fn: uint32(8), } @@ -121440,7 +122666,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121462,6 +122688,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) @@ -121598,6 +122825,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -121627,6 +122855,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -121643,6 +122872,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } } @@ -121774,9 +123004,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } else { /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -121822,6 +123052,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -121937,6 +123168,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -121954,13 +123186,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19477 + z = __ccgo_ts + 19511 case int32(TK_INTERSECT): - z = __ccgo_ts + 19487 + z = __ccgo_ts + 19521 case int32(TK_EXCEPT): - z = __ccgo_ts + 19497 + z = __ccgo_ts + 19531 default: - z = __ccgo_ts + 19504 + z = __ccgo_ts + 19538 break } return z @@ -121981,7 +123213,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19510, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19544, libc.VaList(bp+8, zUsage)) } /* @@ -122016,11 +123248,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19533 + v1 = __ccgo_ts + 19567 } else { v1 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19548, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19582, libc.VaList(bp+8, v1)) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) _sqlite3VdbeGoto(tls, v, addrBreak) @@ -122082,6 +123314,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -122099,6 +123332,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -122209,6 +123443,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -122243,7 +123478,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -122257,7 +123492,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } if iCol < 0 { zType = __ccgo_ts + 1138 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 17011 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 17045 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -122325,6 +123560,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122402,13 +123638,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } if iCol < 0 { - zCol = __ccgo_ts + 17011 + zCol = __ccgo_ts + 17045 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122416,7 +123652,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19579, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19613, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122426,6 +123662,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122507,7 +123744,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 17011 + v3 = __ccgo_ts + 17045 } zName = v3 } else { @@ -122522,7 +123759,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19579, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19613, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122549,6 +123786,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -122557,7 +123795,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19588, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19622, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -122574,6 +123812,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -122587,6 +123826,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -122652,6 +123892,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -122668,7 +123909,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19596 + zType = __ccgo_ts + 19630 } else { zType = uintptr(0) j = int32(1) @@ -122682,6 +123923,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -122704,6 +123946,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 16 } @@ -122922,6 +124165,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -122980,7 +124224,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19600, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19634, 0) return } /* Obtain authorization to do a recursive query */ @@ -123011,6 +124255,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -123072,7 +124317,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19649, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19683, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -123081,12 +124326,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19691, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19725, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -123114,13 +124360,14 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19697, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19731, 0) _sqlite3Select(tls, pParse, p, bp) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup /* Keep running the loop until the Queue is empty */ _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -123169,7 +124416,7 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) } else { v1 = __ccgo_ts + 3689 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19712, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19746, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123277,8 +124524,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19735, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19750, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19784, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123303,7 +124550,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19477, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19511, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123316,7 +124563,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -123355,7 +124602,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19803, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123413,7 +124660,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19769, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19803, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123480,6 +124727,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -123504,15 +124752,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123531,9 +124782,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19790, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19824, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19836, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -123783,6 +125034,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -123804,6 +125056,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -123829,6 +125082,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -123858,6 +125112,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -123874,6 +125129,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr nSelect++ goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -123889,6 +125145,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -123896,8 +125153,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7690) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7690) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7715) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7715) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -123941,14 +125198,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19918, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19952, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19929, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19963, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -123961,7 +125218,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19934, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19968, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -124176,7 +125433,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5409 + v1 = __ccgo_ts + 5434 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124217,6 +125474,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -124248,11 +125506,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124345,11 +125605,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -124464,10 +125726,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -124767,6 +126031,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -124781,6 +126046,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -124889,6 +126155,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -124986,6 +126253,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.X__builtin___memset_chk(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104), libc.X__builtin_object_size(tls, pSubSrc+8+uintptr(i)*104, 0)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -125024,6 +126292,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 @@ -125074,10 +126343,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -125155,6 +126426,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125258,6 +126530,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125506,6 +126779,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125544,6 +126821,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -125567,10 +126845,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -125658,6 +126938,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -125680,6 +126961,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -125713,10 +126995,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -125752,13 +127036,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r return uint8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15864) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15898) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15868) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15902) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -125842,10 +127126,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19940, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19974, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -125896,6 +127181,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -125920,6 +127206,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -125967,7 +127254,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19958, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19992, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -126006,6 +127293,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -126013,6 +127301,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -126140,7 +127429,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19981, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20015, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126164,7 +127453,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20001, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20035, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126178,6 +127467,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126185,7 +127475,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20044 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20078 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -126210,12 +127500,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20067, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20101, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126224,9 +127515,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20105 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20139 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 20173 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126285,13 +127576,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+20177, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+20211, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) /* The usual case - do not allow ROWID on a subquery */ *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -126440,7 +127732,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20181, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20215, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126455,7 +127747,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20220, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20254, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126470,7 +127762,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15432, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15457, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol @@ -126488,6 +127780,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } @@ -126522,6 +127815,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -126590,7 +127884,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6913 + v10 = __ccgo_ts + 6938 } zSchemaName = v10 } @@ -126607,18 +127901,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20251, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20285, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -126679,10 +127977,10 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20256, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+20290, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -126695,7 +127993,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12704, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12729, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -126704,23 +128002,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20265, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20283, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20317, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -126728,7 +128029,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20303, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20337, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -126811,6 +128112,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -126907,6 +128209,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -126938,6 +128241,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -127003,6 +128307,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -127065,12 +128370,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20334, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20368, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20385, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20419, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -127091,10 +128396,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20418, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20452, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -127138,6 +128444,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127152,6 +128459,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -127172,6 +128480,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -127282,6 +128591,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127322,6 +128632,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -127346,6 +128657,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -127364,6 +128676,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -127388,7 +128701,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20451 + v1 = __ccgo_ts + 20485 } else { v1 = __ccgo_ts + 1650 } @@ -127397,7 +128710,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20474, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20508, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127429,7 +128742,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8453) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8478) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -127585,7 +128898,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+16158) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+16192) != 0 { return 0 } /* Is count() */ if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { @@ -127688,6 +129001,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -127847,7 +129161,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20486, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20520, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -127921,6 +129235,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -127935,6 +129250,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -127946,7 +129262,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20540, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20574, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -128029,6 +129345,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128126,7 +129443,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20580, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20614, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128174,7 +129491,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20595, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20629, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128200,6 +129517,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128268,6 +129586,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128280,6 +129599,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128391,6 +129711,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -128406,6 +129727,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } @@ -128435,6 +129757,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -128578,11 +129901,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20611 + v44 = __ccgo_ts + 20645 } else { - v44 = __ccgo_ts + 20620 + v44 = __ccgo_ts + 20654 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19510, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19544, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -128598,6 +129921,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -128616,6 +129940,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -128677,6 +130002,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -128794,6 +130120,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -128837,6 +130164,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -128896,7 +130224,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20611) + _explainTempTable(tls, pParse, __ccgo_ts+20645) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -128914,6 +130242,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) _sqlite3VdbeExplainPop(tls, pParse) return rc @@ -129010,12 +130339,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20629, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20663, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129044,12 +130374,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129154,6 +130486,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129263,7 +130596,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20694, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20728, 0) goto trigger_cleanup } iDb = int32(1) @@ -129303,7 +130636,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto trigger_cleanup } - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20740, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20774, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -129313,11 +130646,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20748, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20782, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20789, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20823, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -129326,13 +130659,13 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if zName == uintptr(0) { goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20740, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20774, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20829, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20863, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) } @@ -129340,8 +130673,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6848, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20855, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6873, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20889, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129349,15 +130682,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20893 + v1 = __ccgo_ts + 20927 } else { - v1 = __ccgo_ts + 20900 + v1 = __ccgo_ts + 20934 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20906, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20940, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20943, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20977, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129377,9 +130710,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6856 + v3 = __ccgo_ts + 6881 } else { - v3 = __ccgo_ts + 6389 + v3 = __ccgo_ts + 6414 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129421,6 +130754,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 pColumns = uintptr(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129431,6 +130765,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129475,7 +130810,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20740, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20774, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -129497,11 +130832,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20989, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21023, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129512,10 +130848,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21037, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21071, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+21112, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+21146, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -129533,6 +130869,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _sqlite3DeleteTriggerStep(tls, db, pStepList) } @@ -129559,6 +130896,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -129775,11 +131113,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21141, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21175, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -129788,6 +131127,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -129819,9 +131159,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6856 + v1 = __ccgo_ts + 6881 } else { - v1 = __ccgo_ts + 6389 + v1 = __ccgo_ts + 6414 } zTab = v1 if iDb == int32(1) { @@ -129836,7 +131176,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21161, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21195, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -129867,6 +131207,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -129903,6 +131244,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -129967,11 +131309,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 21223 + v1 = __ccgo_ts + 21257 } else { - v1 = __ccgo_ts + 21230 + v1 = __ccgo_ts + 21264 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21237, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21271, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -129989,6 +131331,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130070,7 +131413,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21285, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21319, 0) return int32(1) } @@ -130115,6 +131458,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130128,6 +131472,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130206,6 +131551,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130258,7 +131604,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6586, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6611, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130279,6 +131625,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130359,7 +131706,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+21327, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+21361, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130424,6 +131771,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130534,6 +131882,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -130597,6 +131946,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -130791,6 +132141,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -130809,6 +132160,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -130831,6 +132183,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -130963,6 +132316,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -130992,6 +132346,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131040,7 +132395,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21341, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21375, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -131050,6 +132405,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131059,13 +132415,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21377, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21411, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 8228 + v11 = __ccgo_ts + 8253 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -131079,6 +132435,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } chngKey = uint8(int32(chngRowid) + int32(chngPk)) @@ -131109,6 +132466,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131164,6 +132522,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131173,6 +132532,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131391,6 +132751,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131460,6 +132821,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131516,6 +132878,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -131580,6 +132943,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -131630,6 +132994,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -131738,9 +133103,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21396) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21430) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -131834,6 +133200,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -131867,6 +133234,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -131915,6 +133283,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132030,7 +133399,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132131,6 +133500,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132139,6 +133509,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132147,22 +133518,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]int8)(unsafe.Pointer(bp + 200)))[0] = 0 } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21409, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21443, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21413, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21447, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132183,14 +133564,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132250,10 +133637,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12793, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12818, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132272,6 +133660,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132334,7 +133723,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21486, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21490, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21520, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21524, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -132435,6 +133824,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132460,17 +133850,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21494) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21528) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21534) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21568) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21577) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21611) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -132509,7 +133899,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21595, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21629, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -132521,7 +133911,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21618) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21652) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -132538,7 +133928,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+15202) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+15227) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132569,11 +133959,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21645, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21679, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21753, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21787, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132582,7 +133972,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21807, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21841, libc.VaList(bp+24, zDbMain)) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { goto end_of_vacuum @@ -132592,7 +133982,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21958, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21992, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -132611,6 +134001,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -132631,6 +134022,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -132824,6 +134216,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -132833,6 +134226,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -132889,6 +134283,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -132990,6 +134385,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -133075,6 +134471,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133111,7 +134508,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13023, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13048, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133234,7 +134631,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+22088, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+22122, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133244,11 +134641,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+22112, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+22146, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+22211, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+22245, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -133335,11 +134732,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22230, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22264, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133376,7 +134774,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22272, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22306, libc.VaList(bp+48, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) @@ -133391,7 +134789,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 22302 + zFormat = __ccgo_ts + 22336 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133425,11 +134823,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16902, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16936, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133447,6 +134846,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -133461,6 +134861,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133503,7 +134904,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22348, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22382, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -133590,7 +134991,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22348, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22382, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -133625,9 +135026,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _sqlite3ParseObjectInit(tls, bp, db) @@ -133723,6 +135124,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -133781,6 +135183,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -133821,6 +135224,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -133888,6 +135292,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -133961,6 +135366,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134066,6 +135472,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -134198,7 +135605,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { ap = va switch op { @@ -134211,7 +135618,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -134933,10 +136340,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 22367 + return __ccgo_ts + 22401 } if i == -int32(1) { - return __ccgo_ts + 17011 + return __ccgo_ts + 17045 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -134955,10 +136362,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, var i int32 _ = i if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22408, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22380, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22414, int32(1)) } i = 0 for { @@ -134966,19 +136373,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13438, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22380, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22414, int32(1)) } i = 0 for { @@ -134986,15 +136394,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13438, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5431, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5456, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } } @@ -135027,7 +136436,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22382, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22416, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135035,27 +136444,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22408, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 22385 + v2 = __ccgo_ts + 22419 } else { - v2 = __ccgo_ts + 22390 + v2 = __ccgo_ts + 22424 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22398) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22432) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22400) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22434) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5454, int32(1)) } // C documentation @@ -135098,47 +136508,47 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22402 + v2 = __ccgo_ts + 22436 } else { - v2 = __ccgo_ts + 22409 + v2 = __ccgo_ts + 22443 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22414, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22448, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11576 + zFmt = __ccgo_ts + 11601 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22420 + zFmt = __ccgo_ts + 22454 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22453 + zFmt = __ccgo_ts + 22487 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22478 + zFmt = __ccgo_ts + 22512 } else { - zFmt = __ccgo_ts + 22496 + zFmt = __ccgo_ts + 22530 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22505, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22539, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 17011 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22513, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 17045 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22547, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = int8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22544, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22578, libc.VaList(bp+144, zRowid)) cRangeOp = int8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -135148,10 +136558,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22554, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22588, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22559, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22593, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135170,7 +136580,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22586, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22620, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135204,14 +136614,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22597, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22631, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22385, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22419, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22618, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22652, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135221,15 +136631,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22374, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22408, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22385, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22419, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5429, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5454, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135368,6 +136779,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135444,6 +136856,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135478,11 +136891,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -135541,6 +136956,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -135553,6 +136969,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -135667,6 +137084,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -135785,6 +137203,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -135835,6 +137254,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -135902,6 +137322,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -135939,6 +137360,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -135980,6 +137402,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -136123,6 +137546,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -136184,6 +137608,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136284,6 +137709,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136314,6 +137740,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -136708,6 +138135,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -136797,6 +138225,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.X__builtin___memcpy_chk(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104), libc.X__builtin_object_size(tls, pOrTab+8+uintptr(k)*104, 0)) goto _48 _48: + ; k++ } } else { @@ -136887,6 +138316,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -136902,7 +138332,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22626, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22660, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -136925,7 +138355,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22641, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22675, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) if pSubWInfo != 0 { addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) @@ -136959,6 +138389,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137030,6 +138461,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -137153,6 +138585,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -137208,6 +138641,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -137240,6 +138674,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137280,6 +138715,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137300,10 +138736,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137389,7 +138827,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22650, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22684, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -137403,6 +138841,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -137425,6 +138864,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -137458,6 +138898,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -137700,6 +139141,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 @@ -137825,6 +139267,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -137888,19 +139331,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16860, + FzOp: __ccgo_ts + 16894, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 16188, + FzOp: __ccgo_ts + 16222, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15667, + FzOp: __ccgo_ts + 15701, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22664, + FzOp: __ccgo_ts + 22698, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138019,6 +139462,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp } goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138185,6 +139629,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -138211,6 +139656,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -138316,6 +139762,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } @@ -138357,11 +139804,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -138385,6 +139834,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } @@ -138481,6 +139931,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -138533,14 +139984,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -138580,10 +140034,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -138674,7 +140130,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22671, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22705, 0) return } } else { @@ -138686,7 +140142,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22671, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22705, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -138770,7 +140226,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } else { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 8214 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 8239 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -138792,6 +140248,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -138843,6 +140300,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) goto _11 _11: + ; i1++ } } @@ -138864,7 +140322,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22712 + v13 = __ccgo_ts + 22746 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -138917,6 +140375,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -138939,6 +140398,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139134,6 +140594,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139155,6 +140616,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -139318,6 +140780,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -139345,6 +140808,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -139384,7 +140848,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22719, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22753, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -139411,6 +140875,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -139589,6 +141054,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -139685,6 +141151,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -139706,6 +141173,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -139713,6 +141181,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -139743,6 +141212,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -139854,6 +141324,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -139891,6 +141362,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -140059,6 +141531,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140127,6 +141600,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140168,6 +141642,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140176,6 +141651,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140242,6 +141718,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -140378,7 +141855,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143182,6 +144691,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -143308,6 +144818,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -143341,6 +144852,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -143415,6 +144927,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -143454,7 +144967,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22792, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22826, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 @@ -143516,6 +145029,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -143528,11 +145042,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22792, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22826, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } (*(*struct { @@ -143679,7 +145194,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -143729,6 +145244,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -143740,6 +145256,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -143847,6 +145364,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -143979,16 +145497,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144020,11 +145541,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -144095,6 +145618,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144108,7 +145632,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22818, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22852, 0) rc = SQLITE_OK } else { break @@ -144116,6 +145640,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -144261,6 +145786,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -144278,6 +145804,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -144350,6 +145877,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -144427,6 +145955,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -144465,6 +145994,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -144492,11 +146022,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -144519,6 +146051,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -144676,6 +146209,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -144797,6 +146331,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -144862,16 +146397,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -144882,10 +146420,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22853, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -144901,6 +146440,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } /* Load the lowest cost path into pWInfo */ @@ -144917,6 +146457,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145049,6 +146590,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145066,6 +146608,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -145204,6 +146747,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -145221,6 +146765,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -145230,6 +146775,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- goto _1 _1: + ; i-- } return notReady @@ -145284,6 +146830,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -145302,9 +146849,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 for { @@ -145314,11 +146861,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -145348,7 +146893,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) } @@ -145359,6 +146904,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -145388,6 +146934,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -145507,7 +147054,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22871, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22905, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -145579,7 +147126,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22899, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22933, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -145601,6 +147148,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -145659,6 +147207,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -145831,6 +147380,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -145934,6 +147484,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -145984,6 +147535,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -145991,6 +147543,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146061,6 +147614,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -146137,6 +147691,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -146174,6 +147729,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } i = 0 @@ -146278,6 +147834,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -146287,6 +147844,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -146565,7 +148123,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22917, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22951, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -146747,7 +148306,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22973, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+23007, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147069,10 +148628,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23018, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23052, libc.VaList(bp+8, zName)) } return p } @@ -147123,12 +148683,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23037, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23071, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23108, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23142, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -147201,12 +148761,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8453) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8478) } break } goto _1 _1: + ; i++ } } @@ -147274,6 +148835,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -147296,6 +148858,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -147321,6 +148884,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -147451,6 +149015,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -147478,7 +149043,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt bp := tls.Alloc(16) defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+23171, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+23205, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -147609,6 +149174,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -147763,7 +149329,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23197, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23231, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -147782,6 +149348,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -147829,18 +149396,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 23229 + zErr = __ccgo_ts + 23263 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 23246 + zErr = __ccgo_ts + 23280 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 23262 + zErr = __ccgo_ts + 23296 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23282, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23316, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -147864,7 +149431,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23315, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23349, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148040,6 +149607,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148081,11 +149649,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 23362, - 1: __ccgo_ts + 23415, - 2: __ccgo_ts + 22917, - 3: __ccgo_ts + 23466, - 4: __ccgo_ts + 23518, + 0: __ccgo_ts + 23396, + 1: __ccgo_ts + 23449, + 2: __ccgo_ts + 22951, + 3: __ccgo_ts + 23500, + 4: __ccgo_ts + 23552, } var _aOp1 = [5]int32{ @@ -148248,6 +149816,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -148306,6 +149875,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -148350,6 +149920,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -148376,6 +149947,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148426,6 +149998,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148474,6 +150047,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -148609,6 +150183,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148654,6 +150229,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -148684,6 +150260,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149038,6 +150615,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -149526,6 +151104,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -149854,11 +151433,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23568 + v1 = __ccgo_ts + 23602 } else { - v1 = __ccgo_ts + 23577 + v1 = __ccgo_ts + 23611 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23583, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23617, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -149867,7 +151446,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23625, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23659, 0) } } } @@ -149956,7 +151535,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23659, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23693, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -156269,103 +157848,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -156490,7 +158069,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23697, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23731, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158004,289 +159583,387 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+17011, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+17045, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23719, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23753, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16924, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16958, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23719, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23753, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -158310,17 +159987,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -158328,10 +160010,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -158345,73 +160029,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -158445,142 +160153,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23746) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23780) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -158593,74 +160347,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -158671,18 +160446,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1)))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -158693,7 +160472,7 @@ _200: /* expr ::= VARIABLE */ ** in the virtual machine. #N is the N-th register. */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23755, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23789, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -158703,47 +160482,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -158755,23 +160544,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -158784,7 +160583,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -158798,33 +160598,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -158833,17 +160642,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -158856,7 +160669,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -158868,9 +160682,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 8209 + v345 = __ccgo_ts + 8234 } else { - v345 = __ccgo_ts + 8214 + v345 = __ccgo_ts + 8239 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -158913,18 +160727,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -158941,13 +160758,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -158962,73 +160781,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -159037,236 +160878,309 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23779, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23813, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23874, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23908, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23958, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23992, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = int8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -159275,11 +161189,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -159289,22 +161205,27 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: + ; goto _342 /********** End reduce actions ************************************************/ _342: + ; yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) @@ -159337,9 +161258,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23755, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23789, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24043, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24077, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -161388,6 +163309,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -161567,6 +163489,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -161582,6 +163505,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -161626,6 +163550,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -161721,6 +163646,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -161754,6 +163680,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -161765,6 +163692,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -161799,6 +163727,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -161817,6 +163746,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -161840,6 +163770,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -161862,6 +163793,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -161880,6 +163812,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -161901,6 +163834,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -162013,7 +163947,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24060, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24094, libc.VaList(bp+2456, bp+2432)) break } } @@ -162037,7 +163971,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+24085, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+24119, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -162152,7 +164086,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*int8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*int8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -162162,9 +164096,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -162178,7 +164112,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -162190,7 +164124,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -162199,9 +164133,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*int8)(unsafe.Pointer(zSql))) @@ -162222,13 +164156,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*int8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24096, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24130, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -162236,13 +164171,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20740, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20774, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24103, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24137, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24108, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24142, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -162252,10 +164187,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24118, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24152, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24122, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+24156, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -162515,6 +164450,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -162686,8 +164623,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -162695,7 +164632,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -163814,31 +165770,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 24198, - 1: __ccgo_ts + 24211, - 3: __ccgo_ts + 24227, - 4: __ccgo_ts + 24252, - 5: __ccgo_ts + 24266, - 6: __ccgo_ts + 24285, + 0: __ccgo_ts + 24232, + 1: __ccgo_ts + 24245, + 3: __ccgo_ts + 24261, + 4: __ccgo_ts + 24286, + 5: __ccgo_ts + 24300, + 6: __ccgo_ts + 24319, 7: __ccgo_ts + 1620, - 8: __ccgo_ts + 24310, - 9: __ccgo_ts + 24347, - 10: __ccgo_ts + 24359, - 11: __ccgo_ts + 24374, - 12: __ccgo_ts + 24407, - 13: __ccgo_ts + 24425, - 14: __ccgo_ts + 24450, - 15: __ccgo_ts + 24479, - 17: __ccgo_ts + 6344, - 18: __ccgo_ts + 5746, - 19: __ccgo_ts + 24496, - 20: __ccgo_ts + 24514, - 21: __ccgo_ts + 24532, - 23: __ccgo_ts + 24566, - 25: __ccgo_ts + 24587, - 26: __ccgo_ts + 24613, - 27: __ccgo_ts + 24636, - 28: __ccgo_ts + 24657, + 8: __ccgo_ts + 24344, + 9: __ccgo_ts + 24381, + 10: __ccgo_ts + 24393, + 11: __ccgo_ts + 24408, + 12: __ccgo_ts + 24441, + 13: __ccgo_ts + 24459, + 14: __ccgo_ts + 24484, + 15: __ccgo_ts + 24513, + 17: __ccgo_ts + 6369, + 18: __ccgo_ts + 5771, + 19: __ccgo_ts + 24530, + 20: __ccgo_ts + 24548, + 21: __ccgo_ts + 24566, + 23: __ccgo_ts + 24600, + 25: __ccgo_ts + 24621, + 26: __ccgo_ts + 24647, + 27: __ccgo_ts + 24670, + 28: __ccgo_ts + 24691, } // C documentation @@ -164017,7 +165973,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i var p, v1 uintptr _, _, _, _ = extraFlags, p, rc, v1 if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) @@ -164060,7 +166016,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24754, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24788, 0) return int32(SQLITE_BUSY) } else { _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -164131,6 +166087,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -164184,7 +166141,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24817, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24851, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -164459,7 +166416,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { @@ -164469,7 +166426,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24868, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24902, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -164542,6 +166499,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -164590,7 +166548,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -164722,7 +166680,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -164732,7 +166690,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -164781,7 +166739,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -164790,7 +166748,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24889, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24923, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -164816,6 +166774,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -164936,7 +166895,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u flags = *(*uint32)(unsafe.Pointer(pFlags)) zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24957, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24991, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -164950,6 +166909,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -164965,8 +166925,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24963, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24973, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24997, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25007, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -165055,20 +167015,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+25001, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+25035, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+25005, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+25039, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 25005 + zModeType = __ccgo_ts + 25039 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+25026, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+25060, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -165097,15 +167057,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25041, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25075, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25061, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25095, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -165129,10 +167090,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25085, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+25119, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -165147,11 +167109,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 25011, + Fz: __ccgo_ts + 25045, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 25018, + Fz: __ccgo_ts + 25052, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -165162,19 +167124,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 25031, + Fz: __ccgo_ts + 25065, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 25034, + Fz: __ccgo_ts + 25068, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 25037, + Fz: __ccgo_ts + 25071, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 18097, + Fz: __ccgo_ts + 18131, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -165302,8 +167264,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22712, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+25101, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22746, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+25135, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -165324,7 +167286,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -165360,9 +167322,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6908 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6933 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 24103 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 24137 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165384,6 +167346,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -165407,6 +167370,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } @@ -165453,7 +167417,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 25107 + zFilename = __ccgo_ts + 25141 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -165568,6 +167532,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -165593,6 +167558,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -165668,20 +167634,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+25110, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+25144, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+25135) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+25169) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+25155) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+25189) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+25162) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+25196) } // C documentation @@ -165746,6 +167712,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -165787,6 +167754,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -165809,7 +167777,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+25179, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+25213, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -166451,6 +168419,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -166470,6 +168439,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -166835,7 +168805,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+25207, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+25241, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -166851,6 +168821,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -166936,6 +168907,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -166956,6 +168928,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -167034,6 +169007,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -167049,7 +169023,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } _leaveMutex(tls) if rc != 0 { - v2 = __ccgo_ts + 25215 + v2 = __ccgo_ts + 25249 } else { v2 = uintptr(0) } @@ -167930,18 +169904,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1636, - 1: __ccgo_ts + 8209, - 2: __ccgo_ts + 8214, - 3: __ccgo_ts + 6629, - 4: __ccgo_ts + 6629, - 5: __ccgo_ts + 6624, - 6: __ccgo_ts + 6624, - 7: __ccgo_ts + 8520, - 8: __ccgo_ts + 8520, - 9: __ccgo_ts + 8520, - 10: __ccgo_ts + 8520, - 11: __ccgo_ts + 25238, - 12: __ccgo_ts + 25244, + 1: __ccgo_ts + 8234, + 2: __ccgo_ts + 8239, + 3: __ccgo_ts + 6654, + 4: __ccgo_ts + 6654, + 5: __ccgo_ts + 6649, + 6: __ccgo_ts + 6649, + 7: __ccgo_ts + 8545, + 8: __ccgo_ts + 8545, + 9: __ccgo_ts + 8545, + 10: __ccgo_ts + 8545, + 11: __ccgo_ts + 25272, + 12: __ccgo_ts + 25278, 13: __ccgo_ts + 1650, 14: __ccgo_ts + 1650, 15: __ccgo_ts + 1650, @@ -168369,6 +170343,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -168456,6 +170431,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -168472,6 +170448,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -168781,6 +170758,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -168794,6 +170772,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -168826,13 +170805,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25251 + uintptr(int32(c)>>int32(4)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25285 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25251 + uintptr(int32(c)&int32(0xf)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 25285 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -168867,7 +170847,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1636, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+25268, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15671, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -168888,7 +170868,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25276, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25302, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -168942,7 +170922,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+25331, -int32(1)) } } } @@ -169110,6 +171090,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -169132,6 +171113,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -169188,6 +171170,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -169221,8 +171204,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(3), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 25320, - FzRepl: __ccgo_ts + 25324, + FzMatch: __ccgo_ts + 25346, + FzRepl: __ccgo_ts + 25350, }, 1: { Fc1: int8('i'), @@ -169230,8 +171213,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(8), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 25332, - FzRepl: __ccgo_ts + 25324, + FzMatch: __ccgo_ts + 25358, + FzRepl: __ccgo_ts + 25350, }, 2: { Fc1: int8('n'), @@ -169246,7 +171229,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('Q'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 25341, + FzMatch: __ccgo_ts + 25367, FzRepl: __ccgo_ts + 1636, }, 4: { @@ -169254,7 +171237,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('S'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 25346, + FzMatch: __ccgo_ts + 25372, FzRepl: __ccgo_ts + 1636, }, } @@ -169270,7 +171253,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25351, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25377, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -169690,6 +171673,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -169721,7 +171705,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+25394, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25420, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -169838,6 +171822,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { case int32('{'): goto _1 @@ -169918,6 +171903,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -169990,6 +171976,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -170029,12 +172016,14 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170097,19 +172086,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -170171,24 +172164,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8209, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8234, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8214, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+8239, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -170198,19 +172195,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) c = *(*int8)(unsafe.Pointer(z + uintptr(i))) if int32(c) <= int32('0') { @@ -170225,6 +172234,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -170239,14 +172249,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+25320, int32(3)) == 0 { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+25346, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25403) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25429) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25416, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25442, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -170276,6 +172286,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -170285,6 +172296,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*int8)(unsafe.Pointer(z + uintptr(j))) @@ -170329,6 +172341,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -170341,39 +172354,57 @@ parse_number_2: } } parse_number_finish: + ; if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { i++ } _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -170383,12 +172414,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1636, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*int8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -170406,7 +172439,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -170414,11 +172447,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -170449,7 +172484,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -170462,7 +172497,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -170484,6 +172519,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.X__builtin___memset_chk(tls, bp, 0, uint64(72), libc.X__builtin_object_size(tls, bp, 0)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -170620,22 +172659,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1636, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8209, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8234, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8214, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+8239, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -170668,16 +172713,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 25324 + v19 = __ccgo_ts + 25350 } else { - v19 = __ccgo_ts + 12076 + v19 = __ccgo_ts + 12101 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -170700,16 +172747,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, int8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, int8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, int8('"')) @@ -170721,6 +172772,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -170732,7 +172784,7 @@ _11: sz2 -= k2 } if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25422, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25448, uint32(2)) zIn2++ sz2-- continue @@ -170746,7 +172798,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, int8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25425, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25451, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -170754,12 +172806,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25432, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25458, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25437, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25463, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -170788,9 +172840,11 @@ _11: _jsonAppendChar(tls, pOut, int8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, int8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -170808,6 +172862,7 @@ _13: _jsonAppendChar(tls, pOut, int8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, int8('{')) j = i + n @@ -170833,11 +172888,14 @@ _14: _jsonAppendChar(tls, pOut, int8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -170908,6 +172966,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -171324,6 +173383,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -171342,6 +173402,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -171555,7 +173616,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -171590,25 +173651,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171653,11 +173719,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -171670,11 +173739,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -171742,13 +173815,16 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ *(*int8)(unsafe.Pointer(zOut + uintptr(iOut))) = 0 Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -171762,14 +173838,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25305, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+25331, -int32(1)) return } @@ -171810,7 +173890,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25276, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25302, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -171823,7 +173903,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.X__builtin___memset_chk(tls, pParse, 0, uint64(72), libc.X__builtin_object_size(tls, pParse, 0)) return int32(1) @@ -171842,10 +173922,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25410) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25436) } else { if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25403) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25429) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -171884,7 +173964,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25444, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25470, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -171970,15 +174050,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -172063,6 +174145,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -172106,12 +174189,12 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -172151,15 +174234,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -172251,6 +174336,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, int8(']')) @@ -172288,7 +174374,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25462 + v1 = __ccgo_ts + 25488 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -172298,7 +174384,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } eErr = uint8(1) @@ -172329,6 +174415,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -172347,6 +174434,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -172420,9 +174508,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25464, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25490, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5484, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5509, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1663, uint32(1)) @@ -172431,9 +174519,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25466, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25492, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25469, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25495, uint32(1)) } } } @@ -172473,7 +174561,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -172483,6 +174571,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -172493,6 +174582,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -172738,7 +174828,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -172762,7 +174852,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25471, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25497, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -172773,7 +174863,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25522, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25548, -int32(1)) _jsonStringReset(tls, bp) return } @@ -172785,6 +174875,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, int8('}')) @@ -172844,21 +174935,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -172876,7 +174970,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+16110) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+16144) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -172907,9 +175001,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25556 + v1 = __ccgo_ts + 25582 } else { - v1 = __ccgo_ts + 25560 + v1 = __ccgo_ts + 25586 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -172957,7 +175051,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25305, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25331, -int32(1)) } } goto json_type_done @@ -172967,6 +175061,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -173044,7 +175139,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25567, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25593, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -173151,6 +175246,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -173234,7 +175330,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25624, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25650, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -173300,6 +175396,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -173382,7 +175479,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25627, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25653, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -173485,7 +175582,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25630) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25656) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -173619,7 +175716,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { var _ /* sz at bp+0 */ Tu32 _, _, _, _, _ = i, k, n, needQuote, z if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25713, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25739, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -173640,13 +175737,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25720, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25746, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25728, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25754, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -173808,6 +175906,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -173837,9 +175938,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -173898,6 +175999,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -174028,7 +176130,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25734, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25760, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -174049,8 +176151,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25305, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25331, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -174111,176 +176214,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25736, + FzName: __ccgo_ts + 25762, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25741, + FzName: __ccgo_ts + 25767, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25747, + FzName: __ccgo_ts + 25773, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25758, + FzName: __ccgo_ts + 25784, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25770, + FzName: __ccgo_ts + 25796, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25770, + FzName: __ccgo_ts + 25796, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25788, + FzName: __ccgo_ts + 25814, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25808, + FzName: __ccgo_ts + 25834, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25821, + FzName: __ccgo_ts + 25847, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25835, + FzName: __ccgo_ts + 25861, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25838, + FzName: __ccgo_ts + 25864, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25842, + FzName: __ccgo_ts + 25868, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25854, + FzName: __ccgo_ts + 25880, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25867, + FzName: __ccgo_ts + 25893, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25879, + FzName: __ccgo_ts + 25905, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25892, + FzName: __ccgo_ts + 25918, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25903, + FzName: __ccgo_ts + 25929, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25915, + FzName: __ccgo_ts + 25941, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25926, + FzName: __ccgo_ts + 25952, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25938, + FzName: __ccgo_ts + 25964, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25951, + FzName: __ccgo_ts + 25977, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25964, + FzName: __ccgo_ts + 25990, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25978, + FzName: __ccgo_ts + 26004, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25987, + FzName: __ccgo_ts + 26013, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25997, + FzName: __ccgo_ts + 26023, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25997, + FzName: __ccgo_ts + 26023, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 26007, + FzName: __ccgo_ts + 26033, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 26007, + FzName: __ccgo_ts + 26033, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 26018, + FzName: __ccgo_ts + 26044, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 26035, + FzName: __ccgo_ts + 26061, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 26053, + FzName: __ccgo_ts + 26079, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 26071, + FzName: __ccgo_ts + 26097, }, } @@ -174350,6 +176453,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -174360,11 +176464,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 26090, + FzName: __ccgo_ts + 26116, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 26100, + FzName: __ccgo_ts + 26126, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -174894,6 +176998,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -174928,6 +177033,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -174967,11 +177073,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -175011,10 +177115,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+26110, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+26136, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -175068,6 +177171,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -175096,6 +177200,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -175315,7 +177420,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+26115, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+26141, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -175376,6 +177481,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -175389,6 +177495,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -175412,7 +177519,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -175718,6 +177827,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -176147,6 +178263,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -176222,7 +178341,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+26197) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+26223) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -176359,6 +178478,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -176446,6 +178566,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } ii = 0 @@ -176464,6 +178585,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -176515,6 +178637,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -176677,6 +178800,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -176692,6 +178816,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -176775,11 +178900,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -176835,6 +178962,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -176858,6 +178986,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -176866,6 +178995,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -177038,11 +179168,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -177073,6 +179205,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -177086,6 +179219,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -177095,6 +179229,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.X__builtin___memcpy_chk(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48), libc.X__builtin_object_size(tls, pBboxLeft, 0)) @@ -177121,6 +179256,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -177148,6 +179284,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -177196,6 +179333,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -177276,6 +179414,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -177291,6 +179430,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -177307,6 +179447,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -177351,6 +179492,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -177441,6 +179583,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -177550,6 +179693,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -177652,6 +179796,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -177730,7 +179875,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26211, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26237, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -177740,11 +179885,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26231, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26257, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26263, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26289, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -177818,6 +179963,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -177834,6 +179980,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -177897,6 +180044,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -177904,6 +180052,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -177917,7 +180066,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -177936,6 +180085,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -177949,7 +180102,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26300, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26326, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -178003,9 +180156,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26445 + zFmt = __ccgo_ts + 26471 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11905, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11930, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -178056,15 +180209,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26501, - 1: __ccgo_ts + 5807, - 2: __ccgo_ts + 17011, + 0: __ccgo_ts + 26527, + 1: __ccgo_ts + 5832, + 2: __ccgo_ts + 17045, } var _rtreeModule = Tsqlite3_module{ @@ -178089,7 +180243,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) @@ -178108,20 +180262,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26915, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26941, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26977, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27003, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26982, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+27046, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+27116, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27008, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27072, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+27142, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -178151,7 +180306,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 27165 + zFormat = __ccgo_ts + 27191 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -178162,33 +180317,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+27273, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+27299, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27318, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27344, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13413, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13438, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27345, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27371, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27367, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27393, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27375, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27401, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -178202,14 +180359,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26506, - 1: __ccgo_ts + 26559, - 2: __ccgo_ts + 26604, - 3: __ccgo_ts + 26656, - 4: __ccgo_ts + 26710, - 5: __ccgo_ts + 26755, - 6: __ccgo_ts + 26813, - 7: __ccgo_ts + 26868, + 0: __ccgo_ts + 26532, + 1: __ccgo_ts + 26585, + 2: __ccgo_ts + 26630, + 3: __ccgo_ts + 26682, + 4: __ccgo_ts + 26736, + 5: __ccgo_ts + 26781, + 6: __ccgo_ts + 26839, + 7: __ccgo_ts + 26894, } // C documentation @@ -178267,7 +180424,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27391, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27417, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -178278,14 +180435,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27411, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27437, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+32) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -178362,13 +180519,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, 0)) - libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27654, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) + libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27680, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27660, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27686, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -178377,7 +180534,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27684, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27710, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -178388,9 +180545,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27711, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27737, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -178442,6 +180600,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -178450,8 +180609,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27690, - 1: __ccgo_ts + 27701, + 0: __ccgo_ts + 27716, + 1: __ccgo_ts + 27727, } // C documentation @@ -178509,22 +180668,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11525, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11550, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27714, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27740, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27720, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27746, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27724, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27750, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -178548,7 +180709,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27726, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27752, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -178666,11 +180827,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4526 + v1 = __ccgo_ts + 4551 } else { v1 = __ccgo_ts + 1650 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27759, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27785, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -178704,7 +180865,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27766, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27792, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -178721,7 +180882,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27811, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27837, libc.VaList(bp+8, iNode)) } } return pRet @@ -178750,8 +180911,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27843, - 1: __ccgo_ts + 27897, + 0: __ccgo_ts + 27869, + 1: __ccgo_ts + 27923, } if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) @@ -178764,21 +180925,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27945 + v1 = __ccgo_ts + 27971 } else { - v1 = __ccgo_ts + 27953 + v1 = __ccgo_ts + 27979 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27962, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27988, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27945 + v2 = __ccgo_ts + 27971 } else { - v2 = __ccgo_ts + 27953 + v2 = __ccgo_ts + 27979 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28007, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28033, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -178823,7 +180984,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28065, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28091, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -178841,11 +181002,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28113, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28139, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -178873,19 +181035,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28180, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28206, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28214, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28240, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28244, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28270, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -178905,6 +181067,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -178929,12 +181092,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+28299, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+28325, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28330, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+28356, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -178963,7 +181126,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28397, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28423, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -178973,11 +181136,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+26211, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+26237, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28425, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28451, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -178993,8 +181156,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28456, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28463, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28482, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28489, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -179021,7 +181184,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28471, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28497, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -179072,13 +181235,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28490, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28516, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6908 + zDb = __ccgo_ts + 6933 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -179087,7 +181250,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18824 + v1 = __ccgo_ts + 18858 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -179310,6 +181473,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -179420,6 +181584,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -179480,6 +181645,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -179550,18 +181716,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25464, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25490, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28541, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28567, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28552, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28578, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -179590,19 +181757,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = int8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28563, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28589, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28581, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28607, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = int8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28589, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28615, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -179610,13 +181778,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28597, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28623, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28601, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28627, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -179668,6 +181837,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -179697,6 +181867,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -179762,6 +181933,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -179839,6 +182011,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -179908,6 +182081,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -179917,6 +182091,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -179944,18 +182119,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.X__builtin___memset_chk(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4), libc.X__builtin_object_size(tls, aCoord, 0)) } _2: + ; return pOut } @@ -180138,6 +182317,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -180314,6 +182494,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -180380,6 +182561,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -180388,6 +182570,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -180399,6 +182582,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -180467,6 +182651,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -180483,6 +182668,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -180549,6 +182735,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -180573,6 +182760,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -180609,6 +182797,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -180633,6 +182822,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -180722,13 +182912,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, 0)) libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, 0)) - libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27654, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) + libc.X__builtin___memcpy_chk(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27680, uint64(6), libc.X__builtin_object_size(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), 0)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28614, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28640, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -180737,12 +182927,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28636, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28662, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27711, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27737, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -180771,6 +182962,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -180918,6 +183110,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -180968,11 +183161,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17011 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17045 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -180982,7 +183176,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28640 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28666 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -180990,7 +183184,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28646 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28672 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -181110,7 +183304,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28655, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28681, 0) } goto geopoly_update_end } @@ -181189,6 +183383,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -181197,6 +183392,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -181210,12 +183406,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28695) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28721) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28711) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28737) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -181271,6 +183467,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -181281,10 +183478,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28888, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28914, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -181298,61 +183496,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28726, + FzName: __ccgo_ts + 28752, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28739, + FzName: __ccgo_ts + 28765, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28752, + FzName: __ccgo_ts + 28778, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28765, + FzName: __ccgo_ts + 28791, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28711, + FzName: __ccgo_ts + 28737, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28777, + FzName: __ccgo_ts + 28803, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28695, + FzName: __ccgo_ts + 28721, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28800, + FzName: __ccgo_ts + 28826, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28814, + FzName: __ccgo_ts + 28840, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28827, + FzName: __ccgo_ts + 28853, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28841, + FzName: __ccgo_ts + 28867, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28857, + FzName: __ccgo_ts + 28883, }, } @@ -181378,7 +183576,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28869, + FzName: __ccgo_ts + 28895, }, } @@ -181403,20 +183601,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28896, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28922, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28906, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28932, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28917, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28943, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28640, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28666, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28928, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28954, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -181461,6 +183659,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -181510,13 +183709,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+26197, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+26223, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -182733,7 +184933,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28938, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28964, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -182743,7 +184943,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28938, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28964, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -182845,6 +185045,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -182923,7 +185124,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28959, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28985, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -183011,7 +185212,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+26110, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+26136, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -183019,6 +185220,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -183047,13 +185249,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.X__builtin___memset_chk(tls, pIter, 0, uint64(192), libc.X__builtin_object_size(tls, pIter, 0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 29130 + v1 = __ccgo_ts + 29156 } else { v1 = __ccgo_ts + 1650 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29171, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29197, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+29321) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+29347) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -183281,7 +185483,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29446, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29472, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -183291,7 +185493,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29565, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29591, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -183299,7 +185501,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29586, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29612, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -183311,7 +185513,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29637, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29663, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -183322,6 +185524,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -183330,6 +185533,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -183352,7 +185556,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.X__builtin___memcpy_chk(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol), libc.X__builtin_object_size(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29658, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29684, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -183365,7 +185569,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.X__builtin___memset_chk(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol), libc.X__builtin_object_size(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -183418,7 +185622,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+20265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+20299, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -183429,7 +185633,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29715, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29741, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -183440,7 +185644,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29734, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29760, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -183448,12 +185652,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29739, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29765, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -183461,17 +185666,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29749 + v4 = __ccgo_ts + 29775 } else { - v4 = __ccgo_ts + 29762 + v4 = __ccgo_ts + 29788 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29771, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29797, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29800, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29826, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -183488,11 +185693,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29822, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29848, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -183538,10 +185744,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29849, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29875, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 15338 goto _1 _1: + ; i++ } return zList @@ -183572,12 +185779,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29858, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29884, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -183619,21 +185827,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29871, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29897, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29903, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+29926) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29932, __ccgo_ts+29939, __ccgo_ts+5429) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+29952) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29958, __ccgo_ts+29965, __ccgo_ts+5454) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+1650) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29947, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29973, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29989, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+30015, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -183685,7 +185893,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1650 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -183702,19 +185910,20 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 30009 + zCol = __ccgo_ts + 30035 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+30017, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30038, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 15313 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+30043, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30064, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+30100, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 15338 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -183723,7 +185932,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30101, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30127, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { zSep = __ccgo_ts + 1650 iCol = 0 @@ -183740,19 +185949,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+30149, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 15313 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+30175, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 15338 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+30156, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+30182, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -183803,7 +186014,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zAnd = __ccgo_ts + 1650 /* Set to " AND " later on */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -183812,7 +186023,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30168, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30194, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) zType = __ccgo_ts + 1650 } else { if iCid < 0 { @@ -183826,14 +186037,15 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 30009 + zCol = __ccgo_ts + 30035 } else { - zCol = __ccgo_ts + 29739 + zCol = __ccgo_ts + 29765 } } zType = __ccgo_ts + 1138 @@ -183841,24 +186053,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30190, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+30216, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29926 + v2 = __ccgo_ts + 29952 } else { v2 = __ccgo_ts + 1650 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+30210, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+30236, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+30231, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+30264, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+30257, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+30290, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 15313 - zAnd = __ccgo_ts + 22374 + zCom = __ccgo_ts + 15338 + zAnd = __ccgo_ts + 22408 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -183912,22 +186124,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+30288, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+30314, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+30300, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+30326, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 15313 + zS = __ccgo_ts + 15338 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30309, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30335, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -183953,7 +186166,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30324, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1650 @@ -183963,14 +186176,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30338, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 22374 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30364, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22408 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30376, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1650 i1 = 0 @@ -183980,11 +186194,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30400, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 22374 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30426, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22408 } goto _2 _2: + ; i1++ } } @@ -184003,7 +186218,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30413, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30439, 0) } // C documentation @@ -184045,21 +186260,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30400, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30426, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30439, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30465, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30469, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 15313 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30495, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15338 } } } goto _1 _1: + ; i++ } } @@ -184107,6 +186323,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) goto _1 _1: + ; i++ } } @@ -184136,16 +186353,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 z = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30506 + zSep = __ccgo_ts + 30532 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29658, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29684, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16899) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16933) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) } break } @@ -184156,16 +186373,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29926 + v1 = __ccgo_ts + 29952 } else { v1 = __ccgo_ts + 1650 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30519, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 15313 + z = _rbuMPrintf(tls, p, __ccgo_ts+30545, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 15338 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30530, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30556, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -184211,7 +186428,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30534) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30560) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184219,7 +186436,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29686, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29712, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -184228,21 +186445,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30584, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30610, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29926 + v1 = __ccgo_ts + 29952 } else { v1 = __ccgo_ts + 1650 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30606, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 15313 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30632, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 15338 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30616, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30642, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30631, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30657, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) } } @@ -184279,7 +186496,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1650 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -184288,37 +186505,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1650 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30693 + zPk = __ccgo_ts + 30719 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30706 + v2 = __ccgo_ts + 30732 } else { v2 = __ccgo_ts + 1650 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30716, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 15313 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30742, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 15338 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30743, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30769, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30750 + v3 = __ccgo_ts + 30776 } else { v3 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30765, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30791, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) } } @@ -184344,7 +186562,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30797, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30823, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -184365,6 +186583,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -184389,7 +186608,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc zRet = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30854) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30880) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -184458,6 +186677,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -184472,6 +186692,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -184483,6 +186704,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -184497,6 +186719,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -184512,6 +186735,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -184553,7 +186777,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30920, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30946, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -184570,18 +186794,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30940, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30966, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31005, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31031, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31041, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31067, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -184596,26 +186820,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 31075 + v2 = __ccgo_ts + 31101 } else { - v2 = __ccgo_ts + 31079 + v2 = __ccgo_ts + 31105 } v1 = v2 } else { v1 = __ccgo_ts + 1650 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31085, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31111, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31146, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31172, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 31075 + v3 = __ccgo_ts + 31101 } else { - v3 = __ccgo_ts + 31079 + v3 = __ccgo_ts + 31105 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31207, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+31233, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -184634,8 +186858,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6919) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6915) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6944) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6940) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -184644,39 +186868,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1650 } else { - v4 = __ccgo_ts + 31366 + v4 = __ccgo_ts + 31392 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 31375 + v5 = __ccgo_ts + 31401 } else { v5 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31385, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31411, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31421, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31447, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31449 + zRbuRowid = __ccgo_ts + 31475 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31461 + v6 = __ccgo_ts + 31487 } else { v6 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31478, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31554, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31504, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31580, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31853, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31879, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -184687,9 +186911,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31952 + v7 = __ccgo_ts + 31978 } else { - v7 = __ccgo_ts + 31962 + v7 = __ccgo_ts + 31988 } zRbuRowid1 = v7 } @@ -184702,14 +186926,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30009, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+30035, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15313, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+15338, __ccgo_ts+1650) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31973 + v8 = __ccgo_ts + 31999 } else { v8 = __ccgo_ts + 1650 } @@ -184719,11 +186943,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1650 } if zOrder != 0 { - v10 = __ccgo_ts + 23568 + v10 = __ccgo_ts + 23602 } else { v10 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31979, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+32005, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -184780,6 +187004,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { @@ -184790,6 +187015,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -184809,9 +187035,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 31366 + zPrefix = __ccgo_ts + 31392 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+32027, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+32053, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -184885,7 +187111,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32057, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32083, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -184944,27 +187170,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+32087, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+32113, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32115, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32141, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+3420, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) } else { - libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+6908, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) + libc.X__builtin___memcpy_chk(tls, p+48, __ccgo_ts+6933, uint64(4), libc.X__builtin_object_size(tls, p+48, 0)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32133, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32159, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -184997,10 +187223,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32199, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32225, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24957, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24991, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*int8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -185016,14 +187242,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 32231 + v2 = __ccgo_ts + 32257 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1650 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+32233, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+32259, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -185034,27 +187260,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32265, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32291, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32306, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32297, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32323, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32313, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32339, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32341, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32367, 0) } } @@ -185138,7 +187364,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32313, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32339, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -185171,7 +187397,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32359, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32385, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -185304,16 +187530,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -185335,7 +187561,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32394, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32420, 0) } // C documentation @@ -185352,13 +187578,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6908) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6933) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32419, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32426, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32445, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32452, libc.VaList(bp+8, zMove)) if zWal == uintptr(0) || zOal == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -185490,7 +187716,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24514, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24548, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -185503,6 +187729,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -185581,6 +187808,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -185624,7 +187852,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32433) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32459) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -185637,7 +187865,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32455, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32481, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -185664,7 +187892,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd } pFd = v1 - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32482, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32508, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -185700,9 +187928,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32640, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32666, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32655, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32681, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -185725,9 +187953,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { _, _ = i, zSql *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32675, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32701, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32700) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32726) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -185738,10 +187966,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32808) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32834) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32873) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32899) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -185752,13 +187980,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32917, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32943, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -185785,8 +188014,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+18000) - _rbuCopyPragma(tls, p, __ccgo_ts+17095) + _rbuCopyPragma(tls, p, __ccgo_ts+18034) + _rbuCopyPragma(tls, p, __ccgo_ts+17129) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -185794,7 +188023,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32942, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32968, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -185816,10 +188045,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -185906,7 +188135,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32970, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32996, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -185929,10 +188158,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32419, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32445, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6908, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6933, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } @@ -185954,7 +188183,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { var _ /* zRnd at bp+4 */ [64]int8 _ = pVfs Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32995, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+33021, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -186000,7 +188229,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain } db = v1 - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+33006, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+33032, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -186045,11 +188274,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33078, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33104, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33092) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33118) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -186058,7 +188287,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33149) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+33175) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186138,7 +188367,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33223, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33249, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -186160,17 +188389,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 33255 + v3 = __ccgo_ts + 33281 } else { - v3 = __ccgo_ts + 33262 + v3 = __ccgo_ts + 33288 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33269, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33295, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15202, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15227, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -186182,21 +188411,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17714) - _rbuCopyPragma(tls, p, __ccgo_ts+17110) + _rbuCopyPragma(tls, p, __ccgo_ts+17748) + _rbuCopyPragma(tls, p, __ccgo_ts+17144) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33301, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33327, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6908, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6933, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33317, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+33343, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -186274,7 +188503,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+33341, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+33367, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -186321,7 +188550,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31366, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31392, uint64(8)) == 0 { nDel = int32(8) for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -186331,6 +188560,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -186348,7 +188578,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -186357,7 +188587,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -186367,7 +188597,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33349, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33375, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186468,7 +188698,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15217, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+15242, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -186481,19 +188711,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15217, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+15242, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 15202 + v1 = __ccgo_ts + 15227 } else { - v1 = __ccgo_ts + 33301 + v1 = __ccgo_ts + 33327 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33301, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33327, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -186603,6 +188833,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -186650,6 +188881,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -186662,6 +188894,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -186688,6 +188921,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -186701,6 +188935,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -186733,6 +188968,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -186743,6 +188979,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -186769,6 +189006,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -187051,7 +189289,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33376, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33402, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -187077,7 +189315,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33399, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33425, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -187272,7 +189510,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6908) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6933) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -187286,7 +189524,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33410, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33436, 0) != 0 { oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) } @@ -187839,7 +190077,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12514, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12539, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -187909,16 +190147,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -187986,6 +190225,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -188021,6 +190261,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -188214,17 +190455,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -188314,6 +190558,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -188367,8 +190612,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33421 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33430, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33447 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33456, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -188397,7 +190642,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg @@ -188408,7 +190653,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33442, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33468, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -188428,16 +190673,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33450 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33476 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33459 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33485 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33464 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33490 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -188462,6 +190707,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -188534,12 +190780,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33474, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33500, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33629, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33655, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33643, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33669, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -188561,37 +190807,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -188616,7 +190862,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33658, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33684, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -189285,6 +191531,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -192448,6 +194737,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -192529,7 +194819,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -192553,7 +194843,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -192568,7 +194858,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -192583,6 +194873,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -192623,7 +194914,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -192683,6 +194974,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -192727,7 +195019,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -192785,6 +195077,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.X__builtin___memset_chk(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2), libc.X__builtin_object_size(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0)) @@ -192832,7 +195125,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -192842,7 +195135,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -192862,6 +195155,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -192920,7 +195214,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -192928,6 +195222,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -192960,6 +195255,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -193168,6 +195464,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -193288,6 +195585,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -193307,6 +195605,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -193317,6 +195616,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.X__builtin___memset_chk(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2), libc.X__builtin_object_size(tls, apVal, 0)) @@ -193324,7 +195624,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { @@ -193345,6 +195645,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -193491,6 +195792,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -193524,7 +195826,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11905) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11930) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -193533,9 +195835,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.X__builtin___memset_chk(tls, bp+8, 0, uint64(16), libc.X__builtin_object_size(tls, bp+8, 0)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.X__builtin___memcpy_chk(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4), libc.X__builtin_object_size(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, 0)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34302, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34328, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34315, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34341, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -193545,17 +195847,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34321, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34347, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 15313 + zSep = __ccgo_ts + 15338 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1650 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34326, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34352, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -193564,16 +195867,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34334, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34360, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34409, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34435, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 22374 + zSep = __ccgo_ts + 22408 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -193617,6 +195921,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -193655,9 +195960,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34415, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34441, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34326, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34352, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -193667,18 +195972,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34321, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34347, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 22374 + zSep = __ccgo_ts + 22408 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34433, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34459, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33897, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33923, bp) zSep = __ccgo_ts + 1650 i = 0 for { @@ -193688,15 +195994,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34409, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34435, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34441 + zSep = __ccgo_ts + 34467 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5429, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5454, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -193722,7 +196029,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6908, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6933, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -193745,34 +196052,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34446, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34472, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+22380, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22414, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+15313, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+15338, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34464, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34490, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34475, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34501, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5429, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5454, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -193795,12 +196104,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11905, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11930, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34479) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34505) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34592) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34618) } return rc } @@ -193866,13 +196175,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -193932,6 +196242,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -193997,6 +196308,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -194197,6 +196509,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -194278,7 +196591,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34736, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34762, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -194291,7 +196604,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34757, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34783, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -194385,10 +196698,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34776, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34802, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34802, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34828, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -194429,7 +196742,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6908, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6933, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -194443,22 +196756,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34832, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34858, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34876, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34902, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34947, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34973, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11905) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11930) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -194515,13 +196829,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+35007, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35033, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+35037, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+35063, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+35061, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+35037, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35087, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+35063, uintptr(0), uintptr(0), uintptr(0)) } } if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { @@ -194677,6 +196991,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -194723,6 +197038,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -194849,6 +197165,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -194911,6 +197228,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -194927,6 +197245,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -194938,6 +197257,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -194950,6 +197270,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -195011,6 +197332,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -195044,6 +197366,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -195088,6 +197411,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -195168,14 +197492,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -195406,6 +197733,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -195477,6 +197805,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -195500,6 +197829,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -195557,6 +197887,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -195587,6 +197918,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -196932,23 +199264,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -197080,7 +199412,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35089, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35115, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -197263,116 +199595,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) @@ -197403,7 +199765,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35117, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35143, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -197706,7 +200068,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+35148, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+35174, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -197803,7 +200165,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 35155 + zErr = __ccgo_ts + 35181 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -197931,6 +200293,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -197983,6 +200346,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -198047,7 +200411,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 35205 + zErr = __ccgo_ts + 35231 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -198128,6 +200492,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -198149,11 +200514,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -198315,6 +200682,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -198379,6 +200747,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -198397,6 +200766,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -198421,15 +200791,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 35253, + FzFunc: __ccgo_ts + 35279, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 35261, + FzFunc: __ccgo_ts + 35287, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 35271, + FzFunc: __ccgo_ts + 35297, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -198442,6 +200812,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -198951,6 +201322,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35283, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35309, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35314, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35340, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -199328,7 +201703,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35347, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35373, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -199338,7 +201713,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35384, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35410, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -199346,7 +201721,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35393, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35419, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -199369,10 +201744,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35426, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35452, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -199383,58 +201759,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35460, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35486, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35468, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35494, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35500, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35526, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35506, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35532, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35525, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35551, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35568, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35594, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35582, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35608, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35620, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35646, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35631, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35657, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5822, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5847, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8541, + FzName: __ccgo_ts + 8566, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 18080, + FzName: __ccgo_ts + 18114, }, 2: { - FzName: __ccgo_ts + 35666, + FzName: __ccgo_ts + 35692, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -199442,20 +201818,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35674, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35700, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35705, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35731, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35715, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35741, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35749, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35775, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -199527,15 +201903,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35777) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+17011) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35782, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35803) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+17045) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35808, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35812) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35838) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35822, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35848, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -199561,7 +201937,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35853, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35879, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -199569,12 +201945,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35858, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35884, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35865, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35891, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } @@ -199630,8 +202007,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35777) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35873, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35803) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35899, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } i = int32(3) @@ -199662,7 +202039,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35902, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35928, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -199687,11 +202064,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35922, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35948, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -199699,7 +202077,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35972, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35998, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -199712,18 +202090,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { zTail = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35460 + zTail = __ccgo_ts + 35486 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 36027 + zTail = __ccgo_ts + 36053 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36035, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36061, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+17011, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+17045, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -199758,6 +202136,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -199786,7 +202165,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36046, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36072, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -199795,15 +202174,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 15313 + v2 = __ccgo_ts + 15338 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36062, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36088, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36069, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35777)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36095, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35803)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) @@ -199949,7 +202329,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36095) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36121) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -199960,7 +202340,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36100) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36126) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -199971,7 +202351,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36109) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36135) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -199985,7 +202365,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36119) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36145) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -199996,7 +202376,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36129) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36155) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -200013,7 +202393,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36141) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36167) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -200028,7 +202408,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35777) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35803) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -200043,7 +202423,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36153) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+36179) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -200085,7 +202465,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 36167 + zSelect = __ccgo_ts + 36193 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -200105,7 +202485,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+36199) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+36225) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -200117,7 +202497,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36207, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36233, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -200338,17 +202718,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36278, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36304, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36298, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36324, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -200359,16 +202740,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36329, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36355, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36332, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+36358, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+31075, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+31101, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -200472,6 +202854,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -200532,6 +202915,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -200589,6 +202973,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -200636,6 +203021,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -200679,6 +203065,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -200735,6 +203122,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -200763,6 +203151,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -200916,6 +203310,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -201039,6 +203434,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -201067,6 +203463,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -201083,6 +203480,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -201098,6 +203496,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -201105,6 +203504,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -201168,6 +203568,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -201205,6 +203606,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -201230,6 +203632,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -201302,6 +203705,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -201310,11 +203714,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -201361,6 +203767,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -201380,6 +203787,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -201391,6 +203799,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -201493,10 +203902,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -201553,6 +203964,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -201633,6 +204045,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -201663,6 +204076,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -201718,6 +204132,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -201843,6 +204258,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -201972,10 +204388,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -202193,6 +204611,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -202347,6 +204766,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -202355,6 +204775,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -202398,8 +204819,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+36336, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35117, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+36362, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35143, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -202419,12 +204840,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36341, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36367, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -202473,6 +204895,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -202483,6 +204906,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -202521,6 +204945,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -202549,10 +204974,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21377, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21411, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -202658,6 +205084,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -202675,7 +205102,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36370, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36396, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -202732,6 +205159,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -202787,6 +205215,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -202859,17 +205288,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36423 + v2 = __ccgo_ts + 36449 } else { - v2 = __ccgo_ts + 36336 + v2 = __ccgo_ts + 36362 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36430, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36456, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -202878,7 +205308,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36480, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36506, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -203039,6 +205469,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -203079,6 +205510,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -203101,6 +205533,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -203153,10 +205586,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -203186,6 +205621,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -203205,6 +205641,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -203232,6 +205669,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -203246,6 +205684,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -203366,10 +205805,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -203542,10 +205983,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.X__builtin___memset_chk(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8), libc.X__builtin_object_size(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0)) @@ -203565,6 +206008,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -205405,6 +207863,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -205513,7 +207972,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36684, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36710, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -205597,7 +208056,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { - libc.X__builtin___memcpy_chk(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36679, uint64(4), libc.X__builtin_object_size(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), 0)) + libc.X__builtin___memcpy_chk(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36705, uint64(4), libc.X__builtin_object_size(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), 0)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -205630,10 +208089,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -205685,10 +208146,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -205734,6 +208197,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -205750,6 +208214,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -205799,6 +208264,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -205867,6 +208333,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -205898,6 +208365,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -205985,6 +208453,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -206021,6 +208490,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -206537,6 +209007,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -206732,6 +209203,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -206860,6 +209332,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -206896,6 +209369,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -206926,6 +209400,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -209294,6 +211794,7 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int } goto _1 _1: + ; ii++ } } @@ -209342,6 +211843,7 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin } goto _1 _1: + ; iLvl++ } if nBest < nMin { @@ -209474,7 +211976,7 @@ func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int defer tls.Free(32) if iPgno != int32(1) { if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { - _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36930, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36956, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) @@ -209597,6 +212099,7 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } goto _1 _1: + ; pgno++ } _fts5DataRelease(tls, pLeaf) @@ -209786,6 +212289,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) goto _3 _3: + ; iKey++ } /* Set iDelKeyOff to the value of the footer entry to remove from @@ -209853,6 +212357,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } goto _6 _6: + ; iPgno-- } if iPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { @@ -210247,6 +212752,7 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint } goto _1 _1: + ; i++ } nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) @@ -210283,10 +212789,12 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint iSegOut++ goto _4 _4: + ; iSeg++ } goto _3 _3: + ; iLvl-- } v5 = nSeg @@ -210324,6 +212832,7 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iLvl++ } for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { @@ -210600,6 +213109,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -210700,6 +213210,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -210772,6 +213283,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -210814,6 +213326,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -210826,11 +213339,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -210839,6 +213354,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } i = 0 @@ -210857,10 +213373,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -210975,11 +213493,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36991, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37017, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+26110, __ccgo_ts+36999, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+26136, __ccgo_ts+37025, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+12116, __ccgo_ts+37034, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+12141, __ccgo_ts+37060, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -211056,6 +213574,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -211117,6 +213636,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -211238,6 +213758,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -211322,6 +213843,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -211361,6 +213883,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -211402,6 +213925,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -211435,9 +213959,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -211445,16 +213970,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -211503,7 +214031,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+37078) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+37104) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -211562,10 +214090,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -211591,6 +214121,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -211618,11 +214149,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -211698,6 +214231,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -211915,6 +214449,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -211967,6 +214502,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -212015,7 +214551,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Binary representation of iNew */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36533, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36559, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -212155,6 +214691,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -212208,6 +214745,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -212219,6 +214757,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -212317,6 +214856,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -212404,6 +214944,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -212447,10 +214988,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -212487,6 +215030,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -212836,6 +215385,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -213414,7 +215964,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) bSeenMatch = 0 bSeenRank = 0 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37171, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37197, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -213453,7 +216003,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5461, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5486, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) } } @@ -213473,7 +216023,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5461, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5486, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -213493,6 +216043,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -213532,6 +216083,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -213610,6 +216162,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -213707,6 +216260,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -213740,6 +216294,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -213781,6 +216336,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -213811,6 +216367,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -213966,7 +216523,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 15313 + v1 = __ccgo_ts + 15338 } else { v1 = __ccgo_ts + 1650 } @@ -213976,11 +216533,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1650 } if bDesc != 0 { - v3 = __ccgo_ts + 37210 + v3 = __ccgo_ts + 37236 } else { - v3 = __ccgo_ts + 37215 + v3 = __ccgo_ts + 37241 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+37219, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+37245, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr @@ -214034,17 +216591,18 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+37274, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+37300, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5804, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5829, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37280, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -214071,6 +216629,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -214093,7 +216652,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37308, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+37334, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) @@ -214112,6 +216671,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } @@ -214125,7 +216685,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37318, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37344, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -214159,7 +216719,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37339, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37365, libc.VaList(bp+24, z)) } } } else { @@ -214167,7 +216727,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 35271 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 35297 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -214218,7 +216778,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37171, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37197, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -214294,6 +216854,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -214361,7 +216922,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37372, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -214386,6 +216947,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -214541,36 +217103,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37408, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37434, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37419, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37445, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37499, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37525, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37507, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37533, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17694, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17728, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37563, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37589, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37569, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37595, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37585, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37611, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -214668,9 +217230,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+18214, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+18248, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37591, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37617, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -214699,11 +217261,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 21230 + v1 = __ccgo_ts + 21264 } else { - v1 = __ccgo_ts + 37650 + v1 = __ccgo_ts + 37676 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37662, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37688, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -214754,7 +217316,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -214923,6 +217485,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -214993,6 +217556,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -215008,6 +217572,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -215135,6 +217700,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -215153,6 +217719,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -215169,6 +217736,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -215206,6 +217774,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -215245,6 +217814,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -215499,6 +218069,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -215525,6 +218096,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -215540,7 +218112,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37699, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37725, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -215607,9 +218179,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -215617,10 +218191,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -215631,10 +218207,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -215645,6 +218223,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -215657,12 +218236,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -215721,7 +218303,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37720, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37746, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -215919,6 +218501,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -215962,7 +218545,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr pMod = _fts5LocateTokenizer(tls, pGlobal, v1) if pMod == uintptr(0) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37791, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37817, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -215978,7 +218561,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37813, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37839, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -216007,6 +218590,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -216021,6 +218605,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -216031,7 +218616,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37844) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37870) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -216045,7 +218630,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37857, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37883, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -216067,17 +218652,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37948, - 1: __ccgo_ts + 35460, - 2: __ccgo_ts + 26110, - 3: __ccgo_ts + 36027, - 4: __ccgo_ts + 12116, + 0: __ccgo_ts + 37974, + 1: __ccgo_ts + 35486, + 2: __ccgo_ts + 26136, + 3: __ccgo_ts + 36053, + 4: __ccgo_ts + 12141, } // C documentation @@ -216097,10 +218683,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37955, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37981, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38001, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38027, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -216123,7 +218709,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+38064, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+38090, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -216140,10 +218726,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38064, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38090, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38069, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+38095, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -216246,17 +218832,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, ** statements to operate on it. */ if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 38084, - 1: __ccgo_ts + 38152, - 2: __ccgo_ts + 38221, - 3: __ccgo_ts + 38254, - 4: __ccgo_ts + 38293, - 5: __ccgo_ts + 38333, - 6: __ccgo_ts + 38372, - 7: __ccgo_ts + 38415, - 8: __ccgo_ts + 38454, - 9: __ccgo_ts + 38498, - 10: __ccgo_ts + 38538, + 0: __ccgo_ts + 38110, + 1: __ccgo_ts + 38178, + 2: __ccgo_ts + 38247, + 3: __ccgo_ts + 38280, + 4: __ccgo_ts + 38319, + 5: __ccgo_ts + 38359, + 6: __ccgo_ts + 38398, + 7: __ccgo_ts + 38441, + 8: __ccgo_ts + 38480, + 9: __ccgo_ts + 38524, + 10: __ccgo_ts + 38564, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -216284,6 +218870,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = int8(',') goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = int8('\000') @@ -216292,14 +218879,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38561 + v2 = __ccgo_ts + 38587 } else { v2 = __ccgo_ts + 1650 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38564 + v3 = __ccgo_ts + 38590 } else { v3 = __ccgo_ts + 1650 } @@ -216357,12 +218944,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38572, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38598, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38676, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38702, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38714, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38740, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -216371,7 +218958,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38752, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38778, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -216383,14 +218970,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+26110, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+12116, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37948, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+26136, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+12141, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37974, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+36027, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+36053, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35460, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35486, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -216410,13 +218997,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30750 + v1 = __ccgo_ts + 30776 } else { v1 = __ccgo_ts + 1650 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38794, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38820, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38824, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38850, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -216457,35 +219044,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38868, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38894, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38891, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38917, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35460, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35486, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38897 + zCols = __ccgo_ts + 38923 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38929 + zCols = __ccgo_ts + 38955 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+36027, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+36053, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37948, __ccgo_ts+38977, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37974, __ccgo_ts+39003, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -216514,6 +219102,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -216614,6 +219203,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -216752,6 +219342,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -216824,9 +219415,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38994, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39020, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39044, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+39070, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -216834,7 +219425,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36199, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+36225, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -216881,6 +219472,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -216978,6 +219570,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -217026,6 +219619,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -217045,7 +219639,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+39073, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+39099, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -217143,6 +219737,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -217219,6 +219814,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -217245,6 +219841,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -217252,14 +219849,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35460, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35486, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -218152,15 +220765,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -218222,7 +220840,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 39165 + zBase = __ccgo_ts + 39191 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -218313,6 +220931,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -218328,6 +220947,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -218386,6 +221006,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39175, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39201, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39178, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39204, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39183, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39209, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39188, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39214, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39191, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39217, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39194, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39220, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39199, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39225, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39204, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39230, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39208, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39234, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39214, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39240, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39219, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39245, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -218499,49 +221121,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39223, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39249, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39227, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39253, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39230, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39256, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39234, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39260, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39238, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39264, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39242, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39268, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39246, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39272, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39250, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39276, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -218558,20 +221180,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39254, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39280, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39257, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39283, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39264, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39290, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(2)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -218587,75 +221209,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39267, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39293, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39275, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39301, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39282, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39308, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39287, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39313, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39183, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39209, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39292, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39318, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39178, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39204, uint64(4), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39297, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39323, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39302, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39328, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+16221, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+16255, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39307, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39333, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39311, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39337, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39316, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39342, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39219, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39245, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39322, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39348, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39326, uint64(1), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39352, uint64(1), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39328, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39354, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39242, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39268, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -218664,48 +221286,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39334, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39360, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39250, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39276, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39342, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39368, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39348, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39374, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39234, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39353, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39379, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39359, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39385, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39246, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39272, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39367, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39393, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39375, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39401, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39379, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39405, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39242, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39268, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(7)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -218713,21 +221335,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39387, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39413, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39393, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39419, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39246, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39272, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39399, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39425, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39260, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+39286, uint64(3), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(6)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -218745,48 +221367,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39406, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39432, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(4)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39411, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39437, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39416, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39442, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39422, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39448, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39191, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39217, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39375, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39401, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39428, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39454, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39434, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39460, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39175, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+39201, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(5)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -218802,13 +221424,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39440, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39466, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39444, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) + libc.X__builtin___memcpy_chk(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39470, uint64(2), libc.X__builtin_object_size(tls, aBuf+uintptr(nBuf-int32(3)), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39447, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39473, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -218816,7 +221438,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39450, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39476, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -218902,6 +221524,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -218975,14 +221598,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39454) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39480) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39147) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39173) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('2') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -218999,6 +221622,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -219103,6 +221727,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -219254,7 +221879,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 39165, + FzName: __ccgo_ts + 39191, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -219262,7 +221887,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39469, + FzName: __ccgo_ts + 39495, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -219270,7 +221895,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39475, + FzName: __ccgo_ts + 39501, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -219278,7 +221903,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39482, + FzName: __ccgo_ts + 39508, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -219298,6 +221923,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -224342,6 +226968,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -224628,6 +227255,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -224650,6 +227278,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -224808,16 +227437,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39490) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39516) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39494) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39520) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39498) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39524) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39507, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39533, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -224886,15 +227515,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39541, - 1: __ccgo_ts + 39581, - 2: __ccgo_ts + 39616, + 0: __ccgo_ts + 39567, + 1: __ccgo_ts + 39607, + 2: __ccgo_ts + 39642, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+24103, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+24137, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39659, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39685, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -225006,6 +227635,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -225063,10 +227693,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39692, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39718, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39723, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39749, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } @@ -225085,7 +227715,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39774, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39800, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -225231,6 +227861,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -225326,6 +227957,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -225509,7 +228141,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39800, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39826, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -225562,7 +228194,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39810 + return __ccgo_ts + 39836 } type TAggInfo_col = struct { @@ -225844,11 +228476,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-15.0.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00nfs\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00dylib\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-15.0.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00nfs\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00dylib\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods @@ -225858,4 +228490,3 @@ type Sqlite3_index_info = sqlite3_index_info type Sqlite3_module = sqlite3_module type Sqlite3_vtab = sqlite3_vtab type Sqlite3_vtab_cursor = sqlite3_vtab_cursor - diff --git a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go index 95e3d375..74721ada 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go @@ -1,4 +1,4 @@ -// Code generated for freebsd/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -ltcl8.6 -eval-all-macros', DO NOT EDIT. +// Code generated for freebsd/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -ltcl8.6 -eval-all-macros', DO NOT EDIT. //go:build freebsd && amd64 // +build freebsd,amd64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -795,6 +797,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NETGRAPHDISC = 6 const NFDBITS = 0 @@ -1485,6 +1488,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -1939,10 +1943,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2017,7 +2018,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2125,8 +2126,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2480,6 +2481,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2609,7 +2611,6 @@ const YY_REDUCE_MIN = -271 const YY_SHIFT_COUNT = 578 const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 -const _BIG_ENDIAN = 4321 const _BYTE_ORDER = 1234 const _CS_PATH = 1 const _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 @@ -2631,7 +2632,6 @@ const _IOLBF = 1 const _IONBF = 2 const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 -const _LITTLE_ENDIAN = 1234 const _LP64 = 1 const _MADV_DONTNEED = 4 const _MADV_NORMAL = 0 @@ -8091,6 +8091,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -9654,6 +9655,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -10359,6 +10364,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -12893,7 +12899,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13040,6 +13046,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13052,7 +13059,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -13077,6 +13084,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -13087,11 +13095,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -13106,7 +13116,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart @@ -13118,6 +13128,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -13151,6 +13162,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -13341,6 +13353,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -13408,6 +13421,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { zDate++ } @@ -14091,6 +14105,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -14108,6 +14123,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1271, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -14218,6 +14240,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -14328,7 +14351,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { @@ -14341,7 +14364,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 8)) += y @@ -14356,6 +14379,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -14409,6 +14433,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -14675,7 +14700,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -14701,7 +14726,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -14717,9 +14742,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = 0 (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -14738,7 +14763,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -14769,7 +14794,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1411, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -14787,6 +14812,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -15397,6 +15423,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -17127,6 +17154,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -17683,6 +17711,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -17708,6 +17737,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -17767,11 +17797,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -17880,6 +17914,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -17901,14 +17936,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -17924,6 +17963,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -18056,6 +18098,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -18077,6 +18120,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v70)) = int8('0') goto _69 _69: + ; precision-- e2++ } @@ -18164,6 +18208,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -18181,6 +18226,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -18189,11 +18235,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -18270,7 +18318,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -18324,6 +18374,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -18331,6 +18382,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -18343,9 +18395,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -18393,6 +18448,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -18432,6 +18488,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -18443,6 +18500,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -18466,6 +18524,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -18497,8 +18556,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -18525,6 +18586,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -19384,6 +19446,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -19394,6 +19457,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -20057,6 +20121,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -20254,6 +20319,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -21106,6 +21193,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -21156,6 +21244,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -21191,6 +21280,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -21638,6 +21732,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -21698,6 +21793,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -21720,6 +21816,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -21941,6 +22038,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { } goto _1 _1: + ; i++ } return i @@ -21997,6 +22095,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -25650,6 +25758,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -25667,7 +25776,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3512, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3512, bp, int32(41778)) } // C documentation @@ -25704,7 +25813,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -26308,7 +26419,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -26737,6 +26852,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -26754,6 +26870,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -26810,6 +26927,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -26903,7 +27021,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -27274,7 +27392,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -27293,7 +27411,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -27447,6 +27565,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -27702,7 +27821,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3395, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3395, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -27753,6 +27872,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -27777,7 +27897,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__error(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+224, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(1026)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3584, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3584, zIn, int32(44691)) return } (*(*[1026]int8)(unsafe.Pointer(bp + 224)))[got] = 0 @@ -27942,6 +28062,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -27974,14 +28095,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3413, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3413, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -29817,6 +29952,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -29824,6 +29960,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -29880,6 +30017,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -29905,6 +30043,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -30048,10 +30187,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -30408,6 +30549,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -30419,6 +30561,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -30606,6 +30749,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -30628,6 +30772,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -30686,6 +30831,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -30793,6 +30939,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -30819,6 +30966,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -30840,6 +30988,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -30947,6 +31096,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -31363,6 +31513,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -31619,6 +31770,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -31668,6 +31820,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -32481,6 +32634,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -32635,6 +32789,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -32657,6 +32812,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -32762,6 +32918,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -32854,6 +33011,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -32895,6 +33053,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -33799,12 +33958,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -34011,6 +34172,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -34157,6 +34319,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -34231,6 +34394,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -34398,6 +34562,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -34489,6 +34654,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -34523,6 +34689,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -35282,6 +35449,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -35602,11 +35770,13 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -35647,7 +35817,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -39735,7 +39920,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4086, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4111, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -41122,6 +41307,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -41175,10 +41361,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -41262,7 +41449,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -41327,6 +41514,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -41351,11 +41539,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -41388,6 +41578,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -41396,10 +41587,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< 0 { @@ -43915,7 +44128,7 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, /* Copy data from the log to the database file. */ if rc == SQLITE_OK { if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { - rc = _sqlite3CorruptError(tls, int32(68842)) + rc = _sqlite3CorruptError(tls, int32(68912)) } else { rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) } @@ -44988,6 +45201,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } _lockBtreeMutex(tls, p) @@ -45001,6 +45215,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } } @@ -45052,6 +45267,7 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) @@ -45078,6 +45294,7 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } } @@ -45245,6 +45462,7 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } return SQLITE_OK @@ -45292,6 +45510,7 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } /* If the above search did not find a BtLock struct associating Btree p @@ -45385,6 +45604,7 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) goto _2 _2: + ; pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext } } @@ -45421,6 +45641,7 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -45457,6 +45678,7 @@ func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, i } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -45558,6 +45780,7 @@ func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) goto _1 _1: + ; i++ } _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -45673,6 +45896,7 @@ func _saveAllCursors(tls *libc.TLS, pBt uintptr, iRoot TPgno, pExcept uintptr) ( } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -45741,7 +45965,7 @@ func _btreeMoveto(tls *libc.TLS, pCur uintptr, pKey uintptr, nKey Ti64, bias int } _sqlite3VdbeRecordUnpack(tls, pKeyInfo, int32(nKey), pKey, pIdxKey) if int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) == 0 || int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) > int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -45919,7 +46143,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } /* The super-journal page number must never be used as a pointer map page */ if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -45932,12 +46156,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -45951,6 +46175,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -45979,7 +46204,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) if pPgno != 0 { @@ -45987,7 +46212,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -46407,7 +46632,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -46447,12 +46672,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -46460,21 +46685,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -46496,6 +46721,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -46520,25 +46746,27 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) @@ -46598,7 +46826,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -46615,14 +46843,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -46665,11 +46893,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -46683,7 +46911,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -46766,12 +46994,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none @@ -46782,11 +47010,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -46807,7 +47035,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -46824,10 +47052,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -46888,7 +47116,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -46914,7 +47142,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -46953,12 +47181,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -46985,7 +47213,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -47016,14 +47244,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))< iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -47048,7 +47277,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) @@ -47061,7 +47290,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -47214,7 +47443,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _, _ = pPage, rc if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -47276,7 +47505,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -47364,7 +47593,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4167) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4192) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ @@ -47440,6 +47669,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -47448,6 +47678,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -47581,11 +47812,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -48145,7 +48378,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4176, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4201, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -48183,7 +48416,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -48238,6 +48471,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -48402,6 +48636,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -48505,6 +48740,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -48583,6 +48819,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -48618,7 +48855,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -48642,7 +48879,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -48651,7 +48888,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -48660,11 +48897,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -48694,7 +48932,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -48790,7 +49028,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -48828,7 +49066,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) @@ -48895,7 +49133,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -48938,7 +49176,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -48953,6 +49191,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -48967,7 +49206,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -48980,6 +49219,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -49216,6 +49456,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -49431,7 +49672,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo /* Assert that the caller has opened the required transaction. */ if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { iTable = uint32(0) @@ -49460,6 +49701,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -49822,7 +50064,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ pBufStart = pBuf /* Start of original out buffer */ if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _getCellInfo(tls, pCur) aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload @@ -49832,7 +50074,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -49884,7 +50126,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) if offset >= ovflSize { @@ -49958,7 +50200,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -50093,7 +50335,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { var v3, p1 uintptr _, _, _, _ = rc, v2, v3, p1 if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -50105,7 +50347,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -50221,9 +50463,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** in such a way that page pRoot is linked into a second b-tree table ** (or the freelist). */ if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -50233,7 +50476,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -50467,7 +50710,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -50511,6 +50754,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -50525,6 +50769,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -50599,6 +50844,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -50666,7 +50912,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -50681,6 +50927,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -50727,7 +50974,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -50758,7 +51005,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -50791,7 +51038,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -50800,7 +51047,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -50815,6 +51062,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -50865,6 +51113,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -50926,7 +51175,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -51036,7 +51285,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -51124,7 +51373,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -51179,7 +51428,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -51205,7 +51454,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -51232,7 +51481,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -51277,6 +51526,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -51293,6 +51543,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -51301,7 +51552,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -51402,6 +51653,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } } end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) return rc @@ -51437,7 +51689,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in iTrunk = uint32(0) /* Page number of free-list trunk page */ pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -51488,7 +51740,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -51497,7 +51749,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in } nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -51553,6 +51805,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -51585,7 +51838,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -51603,7 +51856,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -51626,7 +51879,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -51711,6 +51964,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n libc.Xmemcpy(tls, pPayload, pSrc, uint64(nSrc)) @@ -51846,7 +52100,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -52230,6 +52484,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -52239,12 +52494,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -52252,7 +52507,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint64(sz)) i++ @@ -52326,6 +52581,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -52346,7 +52602,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr ** database. But they might for a corrupt database. Hence use memmove() ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) @@ -52417,6 +52673,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -52429,6 +52686,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -52444,6 +52702,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -52454,6 +52713,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -52490,7 +52750,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2))) nCell -= nShift @@ -52541,6 +52801,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -52556,9 +52817,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -52603,7 +52865,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _, _, _, _, _, _, _ = pBt, pOut, pStop, v1, v2, v3, v4 pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt /* Page number of pNew */ if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ /* Allocate a new page. This page will become the right-sibling of ** pPage. Make the parent page writable, so that the new divider cell @@ -52964,7 +53226,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -52987,7 +53249,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -53001,6 +53263,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -53013,6 +53276,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } @@ -53049,6 +53313,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -53095,11 +53360,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -53113,7 +53380,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -53156,12 +53423,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -53214,11 +53482,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -53245,7 +53514,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -53274,6 +53543,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -53296,6 +53566,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno goto _19 _19: + ; i++ } i = 0 @@ -53314,6 +53585,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -53335,6 +53607,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) @@ -53416,6 +53689,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -53465,11 +53739,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -53478,6 +53753,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -53545,6 +53821,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -53581,6 +53858,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -53595,12 +53873,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -53610,6 +53890,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -53620,6 +53901,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -53707,10 +53989,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -53779,7 +54062,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -53868,6 +54151,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -53937,7 +54221,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -53968,7 +54252,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -54053,7 +54337,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -54145,7 +54429,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -54159,6 +54443,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -54180,7 +54465,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -54210,10 +54495,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -54229,7 +54514,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { } } @@ -54256,7 +54541,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s */ if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -54279,6 +54564,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -54329,7 +54615,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -54351,7 +54637,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -54451,21 +54737,21 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&(int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx))))< _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -54710,7 +54996,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -54791,14 +55077,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int var _ /* rc at bp+8 */ int32 _, _, _, _ = hdr, i, pCell, v2 if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -54825,6 +55111,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -54849,6 +55136,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -54932,7 +55220,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -55197,7 +55485,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4180, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4205, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -55245,11 +55533,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4182, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4207, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4205, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4230, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -55275,11 +55563,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4335, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4360, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -55331,6 +55619,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -55350,11 +55639,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4374 + v2 = __ccgo_ts + 4399 } else { - v2 = __ccgo_ts + 4379 + v2 = __ccgo_ts + 4404 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4400, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4425, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -55490,12 +55779,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4426 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4451 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4444, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4469, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4598, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4623, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4628, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4653, 0) doCoverageCheck = 0 goto _4 } @@ -55577,7 +55866,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4652, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4677, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -55600,7 +55889,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4676, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4701, 0) depth = d2 } } else { @@ -55609,6 +55898,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -55632,6 +55922,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4701, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4726, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -55689,10 +55980,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4738, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4763, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -55778,7 +56070,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4790 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4815 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -55797,15 +56089,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4801, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4826, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4846, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4871, 0) } } } @@ -55825,6 +56118,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -58794,16 +59104,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -58841,6 +59152,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -59227,10 +59539,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -59386,6 +59700,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -59509,6 +59824,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -59604,6 +59920,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -59705,6 +60022,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -60104,7 +60422,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5058, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5083, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -60117,38 +60435,39 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1650 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5063) == 0 { - zColl = __ccgo_ts + 5070 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5088) == 0 { + zColl = __ccgo_ts + 5095 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5051 + v3 = __ccgo_ts + 5076 } else { v3 = __ccgo_ts + 1650 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5072 + v4 = __ccgo_ts + 5097 } else { v4 = __ccgo_ts + 1650 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5075, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5100, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5099, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5124, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5108, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5108, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1406, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5115, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5140, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1373, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -60165,14 +60484,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { zP4 = __ccgo_ts + 1651 } else { - zP4 = __ccgo_ts + 5118 + zP4 = __ccgo_ts + 5143 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5125, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5150, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -60187,14 +60506,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5158, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5138, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5163, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5140 + zP4 = __ccgo_ts + 5165 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -60210,10 +60530,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5085, - 1: __ccgo_ts + 5087, - 2: __ccgo_ts + 5089, - 3: __ccgo_ts + 5094, + 0: __ccgo_ts + 5110, + 1: __ccgo_ts + 5112, + 2: __ccgo_ts + 5114, + 3: __ccgo_ts + 5119, } // C documentation @@ -60276,6 +60596,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60302,6 +60623,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60341,6 +60663,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -60373,6 +60696,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -60406,6 +60730,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -60472,6 +60797,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -60499,6 +60825,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -60520,6 +60847,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -60575,6 +60903,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -60906,6 +61235,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60958,6 +61288,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -61085,6 +61416,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -61118,6 +61450,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -61136,6 +61469,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -61150,7 +61484,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5148, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5173, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -61158,18 +61492,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5160, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5185, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5174, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5199, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5189, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5214, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) @@ -61210,6 +61544,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -61246,6 +61581,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -61282,6 +61618,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -61348,6 +61685,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -61396,7 +61734,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -62704,7 +63063,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -62737,16 +63096,21 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -62769,7 +63133,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -62804,7 +63168,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -62829,7 +63193,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } } } } @@ -62855,7 +63222,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -62896,18 +63263,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -63134,8 +63502,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -63166,7 +63535,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -63230,6 +63599,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -63316,15 +63686,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5232 + zContext = __ccgo_ts + 5257 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5251 + zContext = __ccgo_ts + 5276 } else { - zContext = __ccgo_ts + 5270 + zContext = __ccgo_ts + 5295 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5279, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5304, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -63377,6 +63747,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -63441,6 +63812,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -63496,7 +63868,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5315, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5340, 0) return int32(1) } else { return 0 @@ -63506,7 +63878,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5360, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5385, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -63564,7 +63936,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -63631,6 +64003,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { @@ -64066,7 +64439,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5400, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5425, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -64122,6 +64495,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -64145,6 +64519,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -64241,6 +64616,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask @@ -64262,7 +64638,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -64392,7 +64768,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -64555,6 +64931,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -64590,6 +64967,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -64613,6 +64991,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -64848,18 +65227,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5423, - 1: __ccgo_ts + 5428, - 2: __ccgo_ts + 5435, - 3: __ccgo_ts + 5438, - 4: __ccgo_ts + 5441, - 5: __ccgo_ts + 5444, - 6: __ccgo_ts + 5447, - 7: __ccgo_ts + 5450, - 8: __ccgo_ts + 5458, - 9: __ccgo_ts + 5461, - 10: __ccgo_ts + 5468, - 11: __ccgo_ts + 5476, + 0: __ccgo_ts + 5448, + 1: __ccgo_ts + 5453, + 2: __ccgo_ts + 5460, + 3: __ccgo_ts + 5463, + 4: __ccgo_ts + 5466, + 5: __ccgo_ts + 5469, + 6: __ccgo_ts + 5472, + 7: __ccgo_ts + 5475, + 8: __ccgo_ts + 5483, + 9: __ccgo_ts + 5486, + 10: __ccgo_ts + 5493, + 11: __ccgo_ts + 5501, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -64994,6 +65373,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -65101,14 +65481,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5483, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5508, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -65396,6 +65776,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -65671,7 +66052,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -65718,6 +66099,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -65799,7 +66181,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -65866,6 +66248,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -65971,7 +66354,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5523, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5548, int32(3)) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } } else { @@ -66009,7 +66392,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1406, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5044, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5069, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -66024,27 +66407,28 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5527, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5552, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5534, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5559, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5547, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5572, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5550, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5575, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5555, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5580, int32(1)) } } } @@ -66547,6 +66931,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -66655,19 +67040,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity int8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -66714,7 +67099,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -67184,8 +67569,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -67198,6 +67585,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadPInt32(db+432) != 0 { goto abort_due_to_interrupt } @@ -67221,7 +67609,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) *(*Ti64)(unsafe.Pointer(pIn1)) = int64(int32((int64(pOp) - int64(aOp)) / 24)) @@ -67248,7 +67637,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -67270,7 +67660,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp3 - int32(1)) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) @@ -67280,7 +67671,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: - ; /* There are never any jumps to instruction 0 */ + ; + /* There are never any jumps to instruction 0 */ /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 goto _187 @@ -67293,6 +67685,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pCaller = aOp + uintptr(*(*Ti64)(unsafe.Pointer(pIn1)))*24 pOp = aOp + uintptr((*TVdbeOp)(unsafe.Pointer(pCaller)).Fp2-int32(1))*24 @@ -67312,6 +67705,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) pcDest = int32(*(*Ti64)(unsafe.Pointer(pIn1))) @@ -67326,7 +67720,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -67363,6 +67758,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -67390,15 +67786,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8((*TOp)(unsafe.Pointer(pOp)).Fp2) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5591, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5616, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5612, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5637, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3797, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = int32((int64(pOp) - int64(aOp)) / 24) - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5619, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5644, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) if rc == int32(SQLITE_BUSY) { @@ -67417,7 +67813,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -67427,7 +67824,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) goto _187 @@ -67437,7 +67835,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) *(*float64)(unsafe.Pointer(pOut)) = *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -67450,7 +67849,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) if int32(encoding) != int32(SQLITE_UTF8) { @@ -67488,7 +67888,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) (*TMem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -67530,7 +67931,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { @@ -67559,6 +67962,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) goto _187 @@ -67569,7 +67973,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { _sqlite3VdbeMemSetZeroBlob(tls, pOut, (*TOp)(unsafe.Pointer(pOp)).Fp1) @@ -67589,7 +67994,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 if _sqlite3VdbeMemTooBig(tls, pVar) != 0 { goto too_big @@ -67613,7 +68019,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -67628,6 +68035,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 56 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -67649,6 +68057,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -67683,7 +68092,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) @@ -67696,7 +68106,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetInt64(tls, pOut, *(*Ti64)(unsafe.Pointer(pIn1))) @@ -67713,6 +68124,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -67729,6 +68141,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + uint32(2) | uint32(1) (*TVdbe)(unsafe.Pointer(p)).FpResultRow = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -67753,7 +68166,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -67851,11 +68265,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -67865,6 +68284,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -67902,18 +68322,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -67947,9 +68370,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -67968,6 +68394,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) } @@ -68002,10 +68429,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -68067,7 +68498,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -68079,7 +68511,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) @@ -68103,7 +68536,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -68124,7 +68558,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) @@ -68232,12 +68667,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -68308,16 +68749,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -68358,7 +68809,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ if iCompare == 0 { goto jump_to_p2 } @@ -68375,6 +68827,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; goto _187 /* Opcode: Compare P1 P2 P3 P4 P5 ** Synopsis: r[P1@P3] <-> r[P2@P3] @@ -68398,7 +68851,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -68414,11 +68868,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) @@ -68431,8 +68885,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } goto _187 @@ -68444,7 +68899,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ if iCompare < 0 { pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 } else { @@ -68475,8 +68931,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -68512,7 +68970,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) goto _187 /* Opcode: Not P1 P2 * * * @@ -68522,7 +68981,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -68538,7 +68998,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -68564,14 +69025,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -68586,6 +69048,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -68598,6 +69061,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -68608,7 +69072,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -68646,6 +69111,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { @@ -68676,7 +69142,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -68688,7 +69155,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -68705,6 +69173,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) @@ -68726,7 +69195,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { @@ -68767,10 +69237,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { @@ -68778,9 +69250,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* For the special case of as pseudo-cursor, the seekResult field ** identifies the register that holds the record */ pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -68790,11 +69262,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -68817,9 +69289,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -68875,13 +69347,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -68896,16 +69368,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -68914,8 +69387,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -68938,10 +69411,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -68955,10 +69430,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -68974,9 +69451,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -68997,9 +69474,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -69028,13 +69505,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -69064,6 +69543,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -69074,11 +69554,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) @@ -69105,16 +69585,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -69127,13 +69607,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5643, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5668, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -69202,7 +69685,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -69219,8 +69703,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) pData0 = aMem + uintptr(nField)*56 @@ -69235,10 +69719,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 @@ -69325,10 +69809,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -69407,16 +69891,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -69428,9 +69912,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -69472,9 +69956,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) @@ -69504,6 +69988,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) @@ -69525,6 +70010,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -69535,7 +70021,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5684, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5709, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -69577,19 +70063,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5735, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5760, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5757, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5782, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -69598,18 +70085,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -69631,8 +70118,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -69647,8 +70135,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -69709,6 +70198,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 /* At least this one VM is active */ @@ -69721,13 +70211,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5811, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5836, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -69737,9 +70227,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -69751,16 +70241,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 5866 + v250 = __ccgo_ts + 5891 } else { if iRollback != 0 { - v249 = __ccgo_ts + 5914 + v251 = __ccgo_ts + 5939 } else { - v249 = __ccgo_ts + 5957 + v251 = __ccgo_ts + 5982 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -69800,6 +70290,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 104)) = 0 if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(libc.Uint64FromInt32(SQLITE_QueryOnly)|uint64(libc.Int32FromInt32(0x00002))<>0)) == int32(1) { rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)< 0 { /* Make register reg[P3] into a value that can be used as the data ** form sqlite3BtreeInsert() where the length of the data is zero. */ @@ -70180,11 +70680,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) @@ -70218,6 +70718,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) if pCx2 == uintptr(0) { goto no_mem @@ -70236,11 +70737,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -70261,6 +70763,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) if pCx3 == uintptr(0) { goto no_mem @@ -70279,7 +70782,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) goto _187 @@ -70373,10 +70877,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) eqOnly = 0 @@ -70455,11 +70963,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) @@ -70505,6 +71013,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 } else { @@ -70582,6 +71091,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first ** opcode past the OP_SeekGE itself. */ @@ -70595,29 +71105,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -70630,8 +71143,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -70648,6 +71162,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -70664,6 +71179,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { goto jump_to_p2_and_check_for_interrupt @@ -70760,14 +71276,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } /* Fall through into OP_NotFound */ - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) @@ -70779,11 +71299,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { /* Composite key generated by OP_MakeRecord */ if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 if rc != 0 { goto no_mem } @@ -70823,8 +71343,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -70881,6 +71402,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -70903,10 +71425,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto notExistsWithKey } /* Fall through into OP_NotExists */ - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) *(*int32)(unsafe.Pointer(bp + 248)) = 0 @@ -70918,7 +71442,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -70935,12 +71459,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -70957,7 +71482,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -71003,8 +71529,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -71036,15 +71563,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -71098,7 +71626,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -71132,11 +71661,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -71153,11 +71682,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if pTab1 != 0 { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -71171,15 +71700,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -71226,6 +71756,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) /* If the update-hook or pre-update-hook will be invoked, set zDb to @@ -71246,11 +71777,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Invoke the pre-update-hook if required. */ if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -71279,6 +71810,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -71298,6 +71830,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -71323,6 +71856,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) @@ -71360,6 +71894,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) @@ -71396,6 +71931,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { @@ -71438,6 +71974,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { /* If the cursor is not already open, create a special kind of @@ -71479,8 +72016,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) *(*int32)(unsafe.Pointer(bp + 392)) = 0 @@ -71509,6 +72048,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) @@ -71546,8 +72086,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Fall through into OP_Rewind */ /* Opcode: Rewind P1 P2 * * * @@ -71566,6 +72108,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { @@ -71641,17 +72184,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -71693,17 +72240,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ } if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -71712,11 +72260,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { goto abort_due_to_error @@ -71730,14 +72278,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -71762,6 +72311,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo @@ -71779,7 +72329,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -71975,6 +72532,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { @@ -72015,6 +72573,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -72036,6 +72595,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) @@ -72056,6 +72616,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 @@ -72072,6 +72633,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -72103,6 +72665,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -72115,13 +72678,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6043 + zSchema = __ccgo_ts + 6068 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6057, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6082, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -72136,7 +72699,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -72157,6 +72720,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { goto abort_due_to_error @@ -72171,6 +72735,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -72182,6 +72747,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -72193,6 +72759,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -72214,7 +72781,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -72241,7 +72809,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { @@ -72260,6 +72829,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { /* The boolean index is empty */ @@ -72294,6 +72864,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -72330,7 +72901,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 /* If the p5 flag is clear, then recursive invocation of triggers is @@ -72351,8 +72923,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -72361,7 +72934,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6100, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6125, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -72407,8 +72980,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { @@ -72423,17 +72997,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -72450,6 +73024,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -72464,6 +73039,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -72486,7 +73062,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -72509,14 +73086,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -72540,7 +73119,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) @@ -72566,18 +73146,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -72598,7 +73179,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -72613,7 +73195,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6137 + v286 = __ccgo_ts + 6162 } else { - v284 = __ccgo_ts + 6142 + v286 = __ccgo_ts + 6167 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6149, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6174, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -72870,11 +73462,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -72901,12 +73493,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -72918,6 +73511,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt rc = _sqlite3BtreeIncrVacuum(tls, pBt2) if rc != 0 { @@ -72945,6 +73539,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -72957,6 +73552,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) goto _187 @@ -72966,6 +73562,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) goto _187 @@ -72985,6 +73582,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6240, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6265, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -73650,8 +74273,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -73670,7 +74294,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ goto _187 /***************************************************************************** ** The cases of the switch statement above this line should all be indented @@ -73679,6 +74304,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -73686,17 +74312,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -73739,12 +74368,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5400, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5425, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1620, 0) rc = int32(SQLITE_NOMEM) @@ -73753,16 +74384,17 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error return r } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5557, - 1: __ccgo_ts + 5566, - 2: __ccgo_ts + 5573, - 3: __ccgo_ts + 5579, + 0: __ccgo_ts + 5582, + 1: __ccgo_ts + 5591, + 2: __ccgo_ts + 5598, + 3: __ccgo_ts + 5604, } var _and_logic = [9]uint8{ @@ -73916,13 +74548,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1636 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6278 + v3 = __ccgo_ts + 6303 } else { - v3 = __ccgo_ts + 6283 + v3 = __ccgo_ts + 6308 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6291, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6316, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -73940,7 +74572,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6320, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6345, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3797, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -73983,15 +74615,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6340, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6365, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6370, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6395, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6406, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6431, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -74016,11 +74648,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6427, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6452, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74046,14 +74679,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6448 + zFault = __ccgo_ts + 6473 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -74069,19 +74704,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6460 + zFault = __ccgo_ts + 6485 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6468, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6493, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74142,6 +74779,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -74241,7 +74879,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -74340,7 +74978,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -75340,6 +75978,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -75459,6 +76098,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -75518,6 +76158,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -75607,6 +76248,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -75662,6 +76304,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -75717,6 +76360,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -75922,6 +76566,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -75944,6 +76589,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -76096,6 +76742,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -76173,6 +76820,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -76239,6 +76887,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -76644,6 +77293,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -76654,6 +77304,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -76832,6 +77483,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -76896,6 +77548,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -76919,6 +77572,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -77000,6 +77654,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -77015,6 +77670,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -77056,6 +77712,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -77087,6 +77744,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -77107,6 +77765,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -77313,6 +77972,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -77478,6 +78138,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -77498,6 +78159,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -77533,6 +78195,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -77570,6 +78233,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -77680,6 +78344,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -77890,6 +78555,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -77988,6 +78654,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -78082,6 +78749,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -78265,6 +78933,9 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE var _ /* temp at bp+0 */ TExpr _, _, _ = db, pDup, pOrig /* The database connection */ pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -78322,6 +78993,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -78335,6 +79007,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -78435,25 +79108,25 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { var zLegacy uintptr _ = zLegacy - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6502, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6527, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6510+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6529+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6535+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6554+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6043+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6068+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6548+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6573+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6548+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6573+7) == 0 { return int32(1) } } @@ -78536,9 +79209,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6562, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6587, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -78619,6 +79293,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -78630,7 +79305,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6567) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6592) != 0 { goto _2 } } @@ -78700,15 +79375,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } @@ -78736,11 +79422,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6569, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6594, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6573, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6598, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -78749,7 +79435,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6577, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6602, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -78772,6 +79458,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -78828,8 +79515,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -78864,15 +79551,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6586, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6611, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6617, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6642, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -78885,6 +79572,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -78923,7 +79611,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6672, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6697, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+64, 0, uint64(8)) return int32(WRC_Prune) @@ -78952,7 +79640,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6707 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6732 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -78962,18 +79650,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6716 + v10 = __ccgo_ts + 6741 } else { - v10 = __ccgo_ts + 6731 + v10 = __ccgo_ts + 6756 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6753, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6778, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6766, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6791, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6801, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -79008,6 +79696,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) @@ -79095,19 +79784,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6783 + zIn = __ccgo_ts + 6808 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6811 + zIn = __ccgo_ts + 6836 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6829 + zIn = __ccgo_ts + 6854 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6847 + zIn = __ccgo_ts + 6872 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6865, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6890, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -79153,10 +79842,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { @@ -79187,6 +79876,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -79201,29 +79903,51 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break + } + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -79244,7 +79968,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } else { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6885, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6910, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -79268,22 +79992,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) if pDef == uintptr(0) { @@ -79300,7 +80024,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6902, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6927, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -79314,17 +80038,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6966, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6991, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -79345,7 +80069,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7002, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7027, uintptr(0), pExpr) } } else { /* Must fit in 8 bits */ @@ -79369,29 +80093,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7030, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7055, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7073 + zType = __ccgo_ts + 7098 } else { - zType = __ccgo_ts + 7080 + zType = __ccgo_ts + 7105 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7090, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7115, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7118, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7143, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7140, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7165, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7184, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7209, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -79408,11 +80132,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -79428,11 +80152,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -79451,15 +80175,15 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -79476,7 +80200,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7232, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7257, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } @@ -79487,7 +80211,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } case int32(TK_VARIABLE): if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7243, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7268, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -79533,17 +80257,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -79577,6 +80301,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -79642,6 +80367,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -79656,7 +80382,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7254, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7279, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -79691,7 +80417,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7310, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7335, 0) return int32(1) } i = 0 @@ -79702,6 +80428,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -79728,7 +80455,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7344, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7369, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -79786,6 +80513,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -79797,11 +80525,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7350, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7375, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -79830,7 +80559,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7411, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7436, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -79859,6 +80588,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -79992,10 +80722,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -80101,6 +80833,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -80138,16 +80871,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7442, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7467, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -80160,6 +80895,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -80173,6 +80909,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -80201,7 +80938,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7344) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7369) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -80212,7 +80949,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7481) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7506) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -80222,11 +80959,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7487, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7512, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -80384,6 +81122,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -80605,6 +81344,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -80674,7 +81414,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -80747,6 +81491,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -81195,7 +81940,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) return } if int32(op) == int32(TK_LE) { @@ -81249,6 +81994,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -81273,7 +82019,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7546, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7571, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -81310,6 +82056,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -81331,6 +82078,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -81615,11 +82363,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7594 + v2 = __ccgo_ts + 7619 } else { v2 = __ccgo_ts + 1650 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7596, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7621, libc.VaList(bp+8, nExprElem, v2, nElem)) break } pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) @@ -81633,6 +82381,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -81695,7 +82444,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u } *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7640, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7665, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -81715,7 +82464,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7674, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7699, libc.VaList(bp+8, p)) } // C documentation @@ -81786,7 +82535,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7724, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7749, libc.VaList(bp+8, pExpr)) } } } @@ -81838,7 +82587,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7744, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7769, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -81871,7 +82620,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7787, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7812, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -82256,6 +83005,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -82384,6 +83134,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -82461,6 +83212,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -82490,6 +83242,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -82549,6 +83302,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -82704,7 +83458,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7835, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -82723,6 +83477,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -82736,6 +83491,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -82830,7 +83586,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7840, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7865, libc.VaList(bp+8, zObject)) } } @@ -82853,6 +83609,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -82895,6 +83652,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -82926,10 +83684,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7863) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7888) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7868) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7893) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -83245,6 +84003,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -83277,6 +84036,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -83484,13 +84244,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7874) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7899) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7882) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7907) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7888) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7913) == 0 { return int32(1) } return 0 @@ -83508,9 +84268,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7874, - 1: __ccgo_ts + 7882, - 2: __ccgo_ts + 7888, + 0: __ccgo_ts + 7899, + 1: __ccgo_ts + 7907, + 2: __ccgo_ts + 7913, } ii = 0 for { @@ -83527,6 +84287,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -83534,6 +84295,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -83598,6 +84360,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -83757,6 +84520,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -83788,7 +84552,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7892, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7917, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -83817,6 +84581,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -83865,6 +84630,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -83880,12 +84646,13 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8200, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+160, pExpr)) } else { return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -85489,7 +86273,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8227, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8252, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -85512,6 +86296,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -85593,7 +86378,7 @@ expr_code_doover: } n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7835, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -85655,7 +86440,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -85713,7 +86498,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -85757,6 +86542,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -85769,7 +86555,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, endLabel) case int32(TK_RAISE): if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8251, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8276, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -85830,6 +86616,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -86046,6 +86833,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -86191,7 +86979,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -86208,9 +86998,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -86230,7 +87022,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -86239,11 +87033,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -86252,15 +87052,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -86273,7 +87077,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -86286,6 +87092,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -86378,7 +87185,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -86395,9 +87204,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -86419,7 +87230,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -86428,11 +87241,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -86441,15 +87260,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -86459,7 +87282,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -86472,6 +87297,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -86709,6 +87535,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -86924,6 +87751,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -87125,6 +87959,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -87176,6 +88011,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -87185,6 +88021,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -87359,6 +88196,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } @@ -87389,6 +88227,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -87400,6 +88239,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) @@ -87448,6 +88288,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -87466,6 +88307,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -87513,6 +88355,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -87537,6 +88380,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -87639,6 +88483,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -87772,6 +88617,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -87822,8 +88668,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8301, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8326, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -87842,9 +88688,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8329, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8354, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8504, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8529, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -87860,9 +88706,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8678, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8703, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8825, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8850, 0) } } @@ -87918,7 +88764,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8976, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9001, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -87927,11 +88773,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9035, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9060, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9041, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -87961,21 +88807,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9068, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9093, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9252, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9277, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9557, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9573, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9582, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9598, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9631, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9656, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -87991,8 +88837,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9896, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9921, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -88006,7 +88853,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9909, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9934, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -88046,11 +88893,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9947, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9972, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9979, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10004, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -88066,10 +88913,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10006) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10031) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10065) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10090) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -88081,13 +88928,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10118) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10143) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10164) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10189) } } /* Modify the CREATE TABLE statement. */ @@ -88101,7 +88948,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10191, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10216, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -88129,7 +88976,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10337, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10362, libc.VaList(bp+16, zTab, zDb)) } } } @@ -88167,12 +89014,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10690, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10715, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10724, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10749, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -88196,7 +89043,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10754, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10779, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { goto exit_begin_add_column } @@ -88211,6 +89058,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } (*(*struct { @@ -88233,6 +89081,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { FpDfltList uintptr })(unsafe.Pointer(pTab + 64))).FaddColOffset exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -88254,18 +89103,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10773 + zType = __ccgo_ts + 10798 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10778 + zType = __ccgo_ts + 10803 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10792 + v1 = __ccgo_ts + 10817 } else { - v1 = __ccgo_ts + 10809 + v1 = __ccgo_ts + 10834 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10827, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10852, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -88322,10 +89171,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10845, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10870, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -88341,12 +89191,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld goto exit_rename_column } bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10866, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11048, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10891, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11073, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9896, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9921, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -88454,6 +89305,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -88518,6 +89370,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -88542,6 +89395,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -88574,6 +89428,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -88592,6 +89447,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -88647,6 +89503,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -88669,6 +89526,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -88707,6 +89565,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -88777,6 +89636,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -88786,6 +89646,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -88809,11 +89670,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11179 + v1 = __ccgo_ts + 11204 } else { v1 = __ccgo_ts + 1650 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11181, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11206, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -88842,6 +89703,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -88870,6 +89732,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -88888,8 +89751,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11204, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11229, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -88905,7 +89768,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -88944,7 +89807,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11212, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11237, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -88989,11 +89852,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 _sqlite3Dequote(tls, zBuf1) if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11179 + v1 = __ccgo_ts + 11204 } else { v1 = __ccgo_ts + 1650 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11218, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11243, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -89032,6 +89895,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -89123,6 +89987,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -89162,6 +90027,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -89204,11 +90070,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -89367,6 +90235,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -89377,6 +90246,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -89388,6 +90258,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } @@ -89413,10 +90284,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -89448,6 +90321,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -89460,6 +90334,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -89520,6 +90395,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -89618,6 +90494,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -89667,11 +90544,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -89791,6 +90670,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -89948,7 +90828,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -89965,10 +90845,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11223, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11248, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -90017,23 +90898,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10845, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10870, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11230 + v1 = __ccgo_ts + 11255 } else { - v1 = __ccgo_ts + 5566 + v1 = __ccgo_ts + 5591 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11242, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11267, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11270, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11295, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -90045,10 +90926,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1650, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11318, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11343, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11439, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11464, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -90078,6 +90959,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -90111,6 +90993,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -90130,6 +91013,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -90147,27 +91031,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11457, + FzName: __ccgo_ts + 11482, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11478, + FzName: __ccgo_ts + 11503, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11498, + FzName: __ccgo_ts + 11523, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11517, + FzName: __ccgo_ts + 11542, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11536, + FzName: __ccgo_ts + 11561, }, } @@ -90378,7 +91262,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11639, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11664, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -90389,10 +91273,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11687, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11692, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11717, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -90401,6 +91285,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -90413,6 +91298,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -90422,15 +91308,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11559, - FzCols: __ccgo_ts + 11572, + FzName: __ccgo_ts + 11584, + FzCols: __ccgo_ts + 11597, }, 1: { - FzName: __ccgo_ts + 11585, - FzCols: __ccgo_ts + 11598, + FzName: __ccgo_ts + 11610, + FzCols: __ccgo_ts + 11623, }, 2: { - FzName: __ccgo_ts + 11626, + FzName: __ccgo_ts + 11651, }, } @@ -90599,6 +91485,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -90609,6 +91496,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -90705,6 +91593,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } i = 0 @@ -90715,6 +91604,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -90728,7 +91618,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11710, + FzName: __ccgo_ts + 11735, } func init() { @@ -90766,6 +91656,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -90840,6 +91731,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -90873,6 +91765,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -90888,6 +91781,7 @@ find_new_min: } goto _2 _2: + ; i++ } (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin @@ -90920,6 +91814,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -90936,10 +91831,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -90959,10 +91856,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -91011,6 +91910,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -91028,6 +91928,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -91042,6 +91943,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -91075,6 +91977,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -91088,7 +91991,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11720, + FzName: __ccgo_ts + 11745, } func init() { @@ -91138,7 +92041,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11730, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11755, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -91149,9 +92052,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11735, libc.VaList(bp+72, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11760, libc.VaList(bp+72, iVal)) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -91187,9 +92091,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11741, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11766, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -91204,7 +92109,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11747, + FzName: __ccgo_ts + 11772, } func init() { @@ -91270,7 +92175,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11756, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11781, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -91284,7 +92189,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11559, uint64(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11584, uint64(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -91438,6 +92343,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -91459,6 +92365,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -91486,6 +92393,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -91506,7 +92414,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11766, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11791, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -91543,6 +92451,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -91565,6 +92474,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -91578,6 +92488,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -91587,7 +92498,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11766, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11791, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -91638,6 +92549,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -91658,9 +92570,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11770) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11795) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11774) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11799) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -91707,6 +92619,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -91816,23 +92729,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11778, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11803, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11789, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11814, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11799, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11824, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -91943,6 +92857,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -92010,6 +92925,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -92021,6 +92937,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -92124,6 +93041,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } } @@ -92204,11 +93122,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11585, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11610, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11811, __ccgo_ts+11880, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11836, __ccgo_ts+11905, zDb) } return rc } @@ -92254,6 +93172,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -92267,15 +93186,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11559, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11584, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11932, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11957, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -92295,6 +93215,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -92320,6 +93241,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -92386,7 +93308,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6562, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6587, zName) == 0) } // C documentation @@ -92442,7 +93364,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11973, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11998, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -92473,7 +93395,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11976, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12001, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -92482,11 +93404,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { break } if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12013, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12038, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -92529,7 +93452,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12043, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12068, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -92537,7 +93460,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12072, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12097, 0) rc = int32(SQLITE_ERROR) } } @@ -92584,7 +93507,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1620, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 24)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12140, libc.VaList(bp+56, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12165, libc.VaList(bp+56, zFile)) } } } @@ -92592,6 +93515,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 24)), -int32(1)) @@ -92640,18 +93564,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12168, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12193, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12189, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12214, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12215, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12240, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -92670,6 +93595,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -92723,6 +93649,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -92742,7 +93669,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12237, + FzName: __ccgo_ts + 12262, } func init() { @@ -92764,7 +93691,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12251, + FzName: __ccgo_ts + 12276, } func init() { @@ -92790,7 +93717,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12265, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12290, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -92824,7 +93751,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12289, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12314, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -92839,6 +93766,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -92853,6 +93781,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92940,6 +93869,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -93037,7 +93967,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12335, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12360, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -93065,11 +93995,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12358, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12383, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12364, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12389, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12370, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -93115,6 +94045,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -93128,7 +94059,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 7882 + zCol = __ccgo_ts + 7907 } } if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -93163,7 +94094,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12397, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12422, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -93275,6 +94206,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -93325,6 +94257,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -93390,6 +94323,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -93418,6 +94352,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -93433,6 +94368,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -93461,6 +94397,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*32))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*32 + 24))) goto _5 _5: + ; i++ } } @@ -93572,26 +94509,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6562) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6587) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6529+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6043+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6510) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6554+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6068+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6535) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6043) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6068) } } } @@ -93618,14 +94556,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6043) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6068) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6529+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6510) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6554+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6535) } } } @@ -93663,7 +94602,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12412, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12437, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -93681,15 +94620,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12420 + v1 = __ccgo_ts + 12445 } else { - v1 = __ccgo_ts + 12433 + v1 = __ccgo_ts + 12458 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6766, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6791, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6801, libc.VaList(bp+8, zMsg, zName)) } } else { } @@ -93727,12 +94666,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6043+7) == 0 { - return __ccgo_ts + 6548 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6068+7) == 0 { + return __ccgo_ts + 6573 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6510+7) == 0 { - return __ccgo_ts + 6529 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6535+7) == 0 { + return __ccgo_ts + 6554 } } return zName @@ -93779,6 +94718,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -93866,6 +94806,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -93905,6 +94846,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -93937,6 +94879,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -94092,6 +95035,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -94151,6 +95095,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -94251,7 +95196,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6043) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6068) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -94283,11 +95228,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6562, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6587, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -94340,13 +95286,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12447, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12472, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12464, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12489, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -94394,8 +95340,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12484, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12509, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -94417,6 +95363,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -94443,6 +95390,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -94475,6 +95423,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -94537,6 +95486,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -94606,9 +95556,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -94621,7 +95571,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12526, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12551, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -94637,9 +95587,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10773 + v2 = __ccgo_ts + 10798 } else { - v2 = __ccgo_ts + 9035 + v2 = __ccgo_ts + 9060 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -94649,9 +95599,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui } zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6510 + v3 = __ccgo_ts + 6535 } else { - v3 = __ccgo_ts + 6043 + v3 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -94675,11 +95625,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10773 + v4 = __ccgo_ts + 10798 } else { - v4 = __ccgo_ts + 9035 + v4 = __ccgo_ts + 9060 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12567, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12592, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -94687,7 +95637,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12588, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12613, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -94776,6 +95726,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -94837,7 +95788,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12623, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12648, 0) } else { } (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) @@ -94853,7 +95804,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12657, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12682, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -94900,7 +95851,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12677, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12702, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -94910,12 +95861,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12700, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12725, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12707, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12732, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -94943,6 +95894,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -94963,12 +95915,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12717, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12742, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -95032,6 +95985,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -95169,10 +96123,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12743, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12768, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12788, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12813, 0) } else { libc.Xmemset(tls, bp, 0, uint64(72)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -95230,7 +96184,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12829, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12854, 0) } } @@ -95267,7 +96221,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12881, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12906, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) @@ -95299,11 +96253,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -95321,13 +96277,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12947, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -95357,6 +96314,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1)))))])&int32(0x01) != 0 { @@ -95408,6 +96366,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -95433,17 +96392,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12978, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13003, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13021, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13046, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13029, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13054, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -95473,8 +96432,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13036, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13061, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -95530,6 +96491,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -95567,6 +96529,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -95590,6 +96553,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -95625,18 +96589,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1650 - zSep2 = __ccgo_ts + 13067 - zEnd = __ccgo_ts + 5083 + zSep2 = __ccgo_ts + 13092 + zEnd = __ccgo_ts + 5108 } else { - zSep = __ccgo_ts + 13069 - zSep2 = __ccgo_ts + 13073 - zEnd = __ccgo_ts + 13078 + zSep = __ccgo_ts + 13094 + zSep2 = __ccgo_ts + 13098 + zEnd = __ccgo_ts + 13103 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -95644,7 +96609,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13081, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13106, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -95666,6 +96631,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(bp)) += len1 goto _3 _3: + ; i++ pCol += 16 } @@ -95675,11 +96641,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1650, - 1: __ccgo_ts + 13095, - 2: __ccgo_ts + 13101, - 3: __ccgo_ts + 13106, - 4: __ccgo_ts + 13111, - 5: __ccgo_ts + 13101, + 1: __ccgo_ts + 13120, + 2: __ccgo_ts + 13126, + 3: __ccgo_ts + 13131, + 4: __ccgo_ts + 13136, + 5: __ccgo_ts + 13126, } // C documentation @@ -95736,6 +96702,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -95772,6 +96739,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -95831,6 +96799,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -95877,6 +96846,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -95932,6 +96902,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -95988,6 +96959,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -96031,6 +97003,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -96058,10 +97031,12 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -96077,6 +97052,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -96095,6 +97071,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _recomputeColumnsNotIndexed(tls, pPk) @@ -96184,6 +97161,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -96296,9 +97274,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13117, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13142, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13150, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -96312,17 +97290,18 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13177, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13202, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13227, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13252, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -96365,10 +97344,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13259, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13284, 0) return } } @@ -96382,6 +97362,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -96401,12 +97382,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9035 - zType2 = __ccgo_ts + 13303 + zType = __ccgo_ts + 9060 + zType2 = __ccgo_ts + 13328 } else { /* A view */ - zType = __ccgo_ts + 10773 - zType2 = __ccgo_ts + 13309 + zType = __ccgo_ts + 10798 + zType2 = __ccgo_ts + 13334 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -96489,13 +97470,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13314, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13339, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13329, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13354, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -96504,17 +97485,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13427, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13452, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13469, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13494, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13503, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13528, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13524, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13549, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -96531,7 +97512,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9557) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9582) == 0 { (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } } @@ -96564,7 +97545,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13556, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13581, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -96576,11 +97557,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10773, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10798, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -96623,6 +97605,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -96674,7 +97657,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13592, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13617, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } /* If we get this far, it means we need to compute the table names. @@ -96779,6 +97762,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -96820,6 +97804,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -96834,6 +97819,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -96855,7 +97841,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13622, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13647, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -96868,7 +97854,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13637, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13662, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -96919,6 +97905,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -96950,12 +97937,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13704, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13729, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11687, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -96992,7 +97980,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13718, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13743, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -97001,7 +97989,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13763, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13788, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -97036,11 +98024,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3420, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7243, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7268, int32(10)) == 0 { return 0 } return int32(1) @@ -97095,9 +98083,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -97130,18 +98118,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13830, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13855, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13858, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13883, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13892, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13917, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -97151,12 +98139,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11774, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11799, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -97197,13 +98186,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13924, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13949, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13987, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14012, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -97219,6 +98208,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -97261,10 +98251,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14081, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14106, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -97272,6 +98263,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -97291,6 +98283,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -97315,6 +98308,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -97520,15 +98514,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14127 + v2 = __ccgo_ts + 14152 } else { - v2 = __ccgo_ts + 14133 + v2 = __ccgo_ts + 14158 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14138, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14163, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -97601,7 +98596,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14166, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14191, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -97611,7 +98606,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14172, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14197, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -97625,16 +98620,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14222, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14247, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14250, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14275, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14275, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14300, 0) goto exit_create_index } /* @@ -97655,19 +98650,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if zName == uintptr(0) { goto exit_create_index } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14166, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14191, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14309, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14334, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14343, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14368, libc.VaList(bp+136, zName)) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -97684,10 +98679,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14367, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14392, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -97705,9 +98701,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6510 + v2 = __ccgo_ts + 6535 } else { - v2 = __ccgo_ts + 6043 + v2 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -97735,7 +98731,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14166) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14191) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -97754,6 +98750,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -97818,7 +98815,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14390, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14415, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -97868,6 +98865,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -97892,6 +98890,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } } else { @@ -97922,6 +98921,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -97949,6 +98949,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -97961,7 +98962,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14451, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14476, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -97979,6 +98980,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -97990,8 +98992,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14493, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14518, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -98033,9 +99035,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1650 } else { - v13 = __ccgo_ts + 14510 + v13 = __ccgo_ts + 14535 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14518, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14543, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -98043,7 +99045,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14538, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14563, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -98051,7 +99053,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14597, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14622, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -98070,6 +99072,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -98098,6 +99101,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -98171,6 +99175,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) goto _3 _3: + ; i++ } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { @@ -98210,7 +99215,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14624, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14649, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -98219,7 +99224,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14642, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14667, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -98227,9 +99232,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -98245,13 +99250,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14715, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11770, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14740, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11795, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -98360,6 +99366,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -98384,6 +99391,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -98433,7 +99441,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14775, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14800, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -98456,6 +99464,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -98469,6 +99478,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -98577,6 +99587,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -98629,6 +99640,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -98661,11 +99673,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14811 + v1 = __ccgo_ts + 14836 } else { - v1 = __ccgo_ts + 14814 + v1 = __ccgo_ts + 14839 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14820, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14845, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -98703,6 +99715,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) return uintptr(0) @@ -98813,6 +99826,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -98830,6 +99844,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -98838,6 +99853,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -98858,7 +99874,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { var eTxnType, i int32 _, _, _, _, _ = db, eTxnType, i, pBt, v db = (*TParse)(unsafe.Pointer(pParse)).Fdb - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14856, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14881, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -98885,6 +99901,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -98904,9 +99921,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _, _, _ = isRollback, v, v1 isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14862 + v1 = __ccgo_ts + 14887 } else { - v1 = __ccgo_ts + 14871 + v1 = __ccgo_ts + 14896 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -98938,9 +99955,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14856, - 1: __ccgo_ts + 14878, - 2: __ccgo_ts + 14862, + 0: __ccgo_ts + 14881, + 1: __ccgo_ts + 14903, + 2: __ccgo_ts + 14887, } // C documentation @@ -98960,7 +99977,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14886, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14911, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -99025,6 +100042,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -99143,7 +100161,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14956, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14981, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -99152,13 +100170,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx } zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*16))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+14967, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+14992, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1663, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -99183,10 +100202,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12383, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15111, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -100276,11 +101308,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15119, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15144, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15148, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15173, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -100399,6 +101431,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -100484,6 +101517,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -100552,6 +101586,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -100680,9 +101715,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15186) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15211) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -100784,6 +101820,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -100825,7 +101862,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11559) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11584) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -100916,6 +101953,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -101002,6 +102040,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -101103,6 +102142,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -101126,10 +102166,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6283, - 1: __ccgo_ts + 6278, - 2: __ccgo_ts + 8174, - 3: __ccgo_ts + 8169, + 0: __ccgo_ts + 6308, + 1: __ccgo_ts + 6303, + 2: __ccgo_ts + 8199, + 3: __ccgo_ts + 8194, 4: __ccgo_ts + 1636, } @@ -101244,7 +102284,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15199, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15224, -int32(1)) return } iVal = -iVal @@ -101340,10 +102380,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -101431,6 +102473,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -101494,6 +102537,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -101553,7 +102597,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15216, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15241, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -101614,6 +102658,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -101640,6 +102685,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -102131,7 +103177,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15247, -int32(1)) return } if argc == int32(3) { @@ -102143,7 +103189,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15255, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15280, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -102312,13 +103358,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5044, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15325, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15300, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15333, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -102339,6 +103385,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') @@ -102349,7 +103396,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15307, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15341, libc.VaList(bp+16, zArg)) default: Xsqlite3_str_append(tls, pStr, __ccgo_ts+1651, int32(4)) break @@ -102473,6 +103520,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -102512,6 +103560,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -102639,9 +103688,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -102693,7 +103744,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -102746,6 +103797,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } libc.Xmemcpy(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i)) @@ -102801,6 +103853,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -102826,6 +103879,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -102847,6 +103901,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -102870,6 +103925,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -102890,7 +103946,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11179, + 0: __ccgo_ts + 11204, } // C documentation @@ -102915,6 +103971,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -102943,6 +104000,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 @@ -103011,6 +104069,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -103034,6 +104093,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -103046,7 +104106,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15310, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15344, int32(4), libc.UintptrFromInt32(0)) } } @@ -103107,7 +104167,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12397, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12422, -int32(1)) return } if argc == int32(2) { @@ -103296,9 +104356,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15199, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15224, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -103318,7 +104378,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -103337,7 +104397,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -103638,7 +104698,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15315, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15349, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } @@ -103667,12 +104727,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15321, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15321, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15355, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15355, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -103973,562 +105034,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15326, + FzName: __ccgo_ts + 15360, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15346, + FzName: __ccgo_ts + 15380, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15359, + FzName: __ccgo_ts + 15393, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15377, + FzName: __ccgo_ts + 15411, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15386, + FzName: __ccgo_ts + 15420, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15394, + FzName: __ccgo_ts + 15428, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15394, + FzName: __ccgo_ts + 15428, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15409, + FzName: __ccgo_ts + 15443, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15435, + FzName: __ccgo_ts + 15469, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15460, + FzName: __ccgo_ts + 15494, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15469, + FzName: __ccgo_ts + 15503, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15480, + FzName: __ccgo_ts + 15514, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15487, + FzName: __ccgo_ts + 15521, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15501, + FzName: __ccgo_ts + 15535, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15501, + FzName: __ccgo_ts + 15535, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15507, + FzName: __ccgo_ts + 15541, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15507, + FzName: __ccgo_ts + 15541, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15513, + FzName: __ccgo_ts + 15547, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15513, + FzName: __ccgo_ts + 15547, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15526, + FzName: __ccgo_ts + 15560, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15533, + FzName: __ccgo_ts + 15567, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15541, + FzName: __ccgo_ts + 15575, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15548, + FzName: __ccgo_ts + 15582, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15561, + FzName: __ccgo_ts + 15595, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15567, + FzName: __ccgo_ts + 15601, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15574, + FzName: __ccgo_ts + 15608, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15581, + FzName: __ccgo_ts + 15615, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15589, + FzName: __ccgo_ts + 15623, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15594, + FzName: __ccgo_ts + 15628, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15598, + FzName: __ccgo_ts + 15632, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15598, + FzName: __ccgo_ts + 15632, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15604, + FzName: __ccgo_ts + 15638, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15610, + FzName: __ccgo_ts + 15644, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15616, + FzName: __ccgo_ts + 15650, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15620, + FzName: __ccgo_ts + 15654, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15620, + FzName: __ccgo_ts + 15654, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15626, + FzName: __ccgo_ts + 15660, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15626, + FzName: __ccgo_ts + 15660, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15643, + FzName: __ccgo_ts + 15677, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15650, + FzName: __ccgo_ts + 15684, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15657, + FzName: __ccgo_ts + 15691, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15668, + FzName: __ccgo_ts + 15702, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15675, + FzName: __ccgo_ts + 15709, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15690, + FzName: __ccgo_ts + 15724, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15707, + FzName: __ccgo_ts + 15741, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15718, + FzName: __ccgo_ts + 15752, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15724, + FzName: __ccgo_ts + 15758, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15742, + FzName: __ccgo_ts + 15776, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15750, + FzName: __ccgo_ts + 15784, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15764, + FzName: __ccgo_ts + 15798, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15772, + FzName: __ccgo_ts + 15806, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15788, + FzName: __ccgo_ts + 15822, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15788, + FzName: __ccgo_ts + 15822, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15798, + FzName: __ccgo_ts + 15832, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15802, + FzName: __ccgo_ts + 15836, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15808, + FzName: __ccgo_ts + 15842, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15812, + FzName: __ccgo_ts + 15846, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15812, + FzName: __ccgo_ts + 15846, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15818, + FzName: __ccgo_ts + 15852, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15818, + FzName: __ccgo_ts + 15852, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15831, + FzName: __ccgo_ts + 15865, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15842, + FzName: __ccgo_ts + 15876, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15321, + FzName: __ccgo_ts + 15355, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15321, + FzName: __ccgo_ts + 15355, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15852, + FzName: __ccgo_ts + 15886, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15860, + FzName: __ccgo_ts + 15894, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15866, + FzName: __ccgo_ts + 15900, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15872, + FzName: __ccgo_ts + 15906, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15875, + FzName: __ccgo_ts + 15909, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15879, + FzName: __ccgo_ts + 15913, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15885, + FzName: __ccgo_ts + 15919, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15875, + FzName: __ccgo_ts + 15909, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15890, + FzName: __ccgo_ts + 15924, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15894, + FzName: __ccgo_ts + 15928, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15898, + FzName: __ccgo_ts + 15932, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15904, + FzName: __ccgo_ts + 15938, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15908, + FzName: __ccgo_ts + 15942, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15913, + FzName: __ccgo_ts + 15947, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15918, + FzName: __ccgo_ts + 15952, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15923, + FzName: __ccgo_ts + 15957, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15929, + FzName: __ccgo_ts + 15963, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15933, + FzName: __ccgo_ts + 15967, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15937, + FzName: __ccgo_ts + 15971, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15941, + FzName: __ccgo_ts + 15975, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15946, + FzName: __ccgo_ts + 15980, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15951, + FzName: __ccgo_ts + 15985, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15956, + FzName: __ccgo_ts + 15990, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15962, + FzName: __ccgo_ts + 15996, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15968, + FzName: __ccgo_ts + 16002, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15974, + FzName: __ccgo_ts + 16008, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15987, + FzName: __ccgo_ts + 16021, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15995, + FzName: __ccgo_ts + 16029, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15998, + FzName: __ccgo_ts + 16032, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16003, + FzName: __ccgo_ts + 16037, }, } @@ -104942,6 +106003,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -104981,6 +106043,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -104988,6 +106051,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -104997,11 +106061,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16007, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16041, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -105064,6 +106129,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -105103,6 +106169,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -105133,6 +106200,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -105286,6 +106354,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -105321,6 +106390,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -105427,10 +106497,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -105478,6 +106550,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -105539,6 +106612,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -105587,10 +106661,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -105716,6 +106792,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -105751,6 +106828,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -105778,6 +106856,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -105851,6 +106930,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -105894,10 +106974,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -105921,11 +107003,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -105993,6 +107077,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -106009,6 +107094,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -106091,11 +107177,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6573, + Fz: __ccgo_ts + 6598, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6569, + Fz: __ccgo_ts + 6594, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -106151,6 +107237,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -106158,7 +107245,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5202) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5227) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -106257,6 +107344,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -106308,6 +107396,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -106421,6 +107510,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 @@ -106461,6 +107551,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -106592,6 +107683,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -106600,6 +107692,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -106660,6 +107753,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -106686,6 +107780,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -106726,11 +107821,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8139, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8164, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -106852,6 +107948,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -106957,6 +108054,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -107227,6 +108325,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -107248,13 +108347,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16052, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16086, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -107262,13 +108362,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16093, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16127, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -107359,6 +108460,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -107376,16 +108478,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16125, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16159, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16177, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16211, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -107417,6 +108520,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -107427,11 +108531,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16202, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16236, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16282, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -107445,7 +108549,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -107546,6 +108650,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -107586,6 +108691,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -107743,6 +108849,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -107756,9 +108863,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16269) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16303) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -108147,7 +109255,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -110354,10 +111484,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16318, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16352, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -110374,9 +111505,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16322, uint64(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16356, uint64(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -110388,7 +111520,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16328, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16362, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -110403,7 +111535,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16371, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16405, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -110425,6 +111557,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -110432,7 +111565,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16403, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16437, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -110441,7 +111574,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16283, + 0: __ccgo_ts + 16317, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -110471,6 +111604,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -110554,6 +111688,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -110604,6 +111739,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -110671,12 +111807,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16440, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16474, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -110724,63 +111861,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5458, - 1: __ccgo_ts + 16479, - 2: __ccgo_ts + 9035, - 3: __ccgo_ts + 16483, - 4: __ccgo_ts + 16488, - 5: __ccgo_ts + 16491, - 6: __ccgo_ts + 16501, - 7: __ccgo_ts + 16511, - 8: __ccgo_ts + 16517, - 9: __ccgo_ts + 16521, - 10: __ccgo_ts + 16526, - 11: __ccgo_ts + 16531, - 12: __ccgo_ts + 16539, - 13: __ccgo_ts + 16550, - 14: __ccgo_ts + 16553, - 15: __ccgo_ts + 16560, - 16: __ccgo_ts + 16521, - 17: __ccgo_ts + 16526, - 18: __ccgo_ts + 16567, - 19: __ccgo_ts + 16572, - 20: __ccgo_ts + 16575, - 21: __ccgo_ts + 16582, - 22: __ccgo_ts + 16517, - 23: __ccgo_ts + 16521, - 24: __ccgo_ts + 16588, - 25: __ccgo_ts + 16593, - 26: __ccgo_ts + 16598, - 27: __ccgo_ts + 16521, - 28: __ccgo_ts + 16602, - 29: __ccgo_ts + 16526, - 30: __ccgo_ts + 16610, - 31: __ccgo_ts + 16614, - 32: __ccgo_ts + 16619, - 33: __ccgo_ts + 11774, - 34: __ccgo_ts + 11770, - 35: __ccgo_ts + 16625, - 36: __ccgo_ts + 16630, - 37: __ccgo_ts + 16635, - 38: __ccgo_ts + 16479, - 39: __ccgo_ts + 16521, - 40: __ccgo_ts + 16640, - 41: __ccgo_ts + 16647, - 42: __ccgo_ts + 16654, - 43: __ccgo_ts + 9035, - 44: __ccgo_ts + 16662, - 45: __ccgo_ts + 5461, - 46: __ccgo_ts + 16668, - 47: __ccgo_ts + 16479, - 48: __ccgo_ts + 16521, - 49: __ccgo_ts + 16673, - 50: __ccgo_ts + 16678, - 51: __ccgo_ts + 15875, - 52: __ccgo_ts + 16683, - 53: __ccgo_ts + 16696, - 54: __ccgo_ts + 16705, - 55: __ccgo_ts + 16712, - 56: __ccgo_ts + 16723, + 0: __ccgo_ts + 5483, + 1: __ccgo_ts + 16513, + 2: __ccgo_ts + 9060, + 3: __ccgo_ts + 16517, + 4: __ccgo_ts + 16522, + 5: __ccgo_ts + 16525, + 6: __ccgo_ts + 16535, + 7: __ccgo_ts + 16545, + 8: __ccgo_ts + 16551, + 9: __ccgo_ts + 16555, + 10: __ccgo_ts + 16560, + 11: __ccgo_ts + 16565, + 12: __ccgo_ts + 16573, + 13: __ccgo_ts + 16584, + 14: __ccgo_ts + 16587, + 15: __ccgo_ts + 16594, + 16: __ccgo_ts + 16555, + 17: __ccgo_ts + 16560, + 18: __ccgo_ts + 16601, + 19: __ccgo_ts + 16606, + 20: __ccgo_ts + 16609, + 21: __ccgo_ts + 16616, + 22: __ccgo_ts + 16551, + 23: __ccgo_ts + 16555, + 24: __ccgo_ts + 16622, + 25: __ccgo_ts + 16627, + 26: __ccgo_ts + 16632, + 27: __ccgo_ts + 16555, + 28: __ccgo_ts + 16636, + 29: __ccgo_ts + 16560, + 30: __ccgo_ts + 16644, + 31: __ccgo_ts + 16648, + 32: __ccgo_ts + 16653, + 33: __ccgo_ts + 11799, + 34: __ccgo_ts + 11795, + 35: __ccgo_ts + 16659, + 36: __ccgo_ts + 16664, + 37: __ccgo_ts + 16669, + 38: __ccgo_ts + 16513, + 39: __ccgo_ts + 16555, + 40: __ccgo_ts + 16674, + 41: __ccgo_ts + 16681, + 42: __ccgo_ts + 16688, + 43: __ccgo_ts + 9060, + 44: __ccgo_ts + 16696, + 45: __ccgo_ts + 5486, + 46: __ccgo_ts + 16702, + 47: __ccgo_ts + 16513, + 48: __ccgo_ts + 16555, + 49: __ccgo_ts + 16707, + 50: __ccgo_ts + 16712, + 51: __ccgo_ts + 15909, + 52: __ccgo_ts + 16717, + 53: __ccgo_ts + 16730, + 54: __ccgo_ts + 16739, + 55: __ccgo_ts + 16746, + 56: __ccgo_ts + 16757, } // C documentation @@ -110799,191 +111936,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16731, + FzName: __ccgo_ts + 16765, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16746, + FzName: __ccgo_ts + 16780, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16761, + FzName: __ccgo_ts + 16795, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16773, + FzName: __ccgo_ts + 16807, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16789, + FzName: __ccgo_ts + 16823, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16712, + FzName: __ccgo_ts + 16746, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16802, + FzName: __ccgo_ts + 16836, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16814, + FzName: __ccgo_ts + 16848, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16834, + FzName: __ccgo_ts + 16868, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16850, + FzName: __ccgo_ts + 16884, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16871, + FzName: __ccgo_ts + 16905, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16886, + FzName: __ccgo_ts + 16920, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16902, + FzName: __ccgo_ts + 16936, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16916, + FzName: __ccgo_ts + 16950, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16929, + FzName: __ccgo_ts + 16963, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16943, + FzName: __ccgo_ts + 16977, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16962, + FzName: __ccgo_ts + 16996, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16981, + FzName: __ccgo_ts + 17015, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17004, + FzName: __ccgo_ts + 17038, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17013, + FzName: __ccgo_ts + 17047, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17031, + FzName: __ccgo_ts + 17065, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17048, + FzName: __ccgo_ts + 17082, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17061, + FzName: __ccgo_ts + 17095, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17076, + FzName: __ccgo_ts + 17110, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17094, + FzName: __ccgo_ts + 17128, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17104, + FzName: __ccgo_ts + 17138, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17118, + FzName: __ccgo_ts + 17152, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17134, + FzName: __ccgo_ts + 17168, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17159, + FzName: __ccgo_ts + 17193, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17178, + FzName: __ccgo_ts + 17212, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17189, + FzName: __ccgo_ts + 17223, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17200, + FzName: __ccgo_ts + 17234, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -110991,146 +112128,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17212, + FzName: __ccgo_ts + 17246, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17228, + FzName: __ccgo_ts + 17262, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17241, + FzName: __ccgo_ts + 17275, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17260, + FzName: __ccgo_ts + 17294, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17279, + FzName: __ccgo_ts + 17313, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17292, + FzName: __ccgo_ts + 17326, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17307, + FzName: __ccgo_ts + 17341, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17317, + FzName: __ccgo_ts + 17351, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17329, + FzName: __ccgo_ts + 17363, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17338, + FzName: __ccgo_ts + 17372, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17349, + FzName: __ccgo_ts + 17383, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17359, + FzName: __ccgo_ts + 17393, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17371, + FzName: __ccgo_ts + 17405, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17382, + FzName: __ccgo_ts + 17416, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17394, + FzName: __ccgo_ts + 17428, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17411, + FzName: __ccgo_ts + 17445, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17430, + FzName: __ccgo_ts + 17464, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17456, + FzName: __ccgo_ts + 17490, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17471, + FzName: __ccgo_ts + 17505, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17485, + FzName: __ccgo_ts + 17519, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17504, + FzName: __ccgo_ts + 17538, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17518, + FzName: __ccgo_ts + 17552, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17534, + FzName: __ccgo_ts + 17568, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17546, + FzName: __ccgo_ts + 17580, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17557, + FzName: __ccgo_ts + 17591, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17568, + FzName: __ccgo_ts + 17602, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -111138,45 +112275,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17580, + FzName: __ccgo_ts + 17614, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17591, + FzName: __ccgo_ts + 17625, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17612, + FzName: __ccgo_ts + 17646, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17620, + FzName: __ccgo_ts + 17654, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17635, + FzName: __ccgo_ts + 17669, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17648, + FzName: __ccgo_ts + 17682, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17667, + FzName: __ccgo_ts + 17701, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17682, + FzName: __ccgo_ts + 17716, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -111218,6 +112355,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -111276,10 +112414,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17698) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17732) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17708) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17742) { return PAGER_LOCKINGMODE_NORMAL } } @@ -111297,13 +112435,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8195) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8220) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17715) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17749) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17720) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17754) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -111326,10 +112464,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16673) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16707) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17732) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17766) == 0 { return int32(2) } else { return 0 @@ -111351,7 +112489,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17739, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17773, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -111412,6 +112550,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -111480,15 +112619,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17801 + zName = __ccgo_ts + 17835 case int32(OE_SetDflt): - zName = __ccgo_ts + 17810 + zName = __ccgo_ts + 17844 case int32(OE_Cascade): - zName = __ccgo_ts + 17822 + zName = __ccgo_ts + 17856 case int32(OE_Restrict): - zName = __ccgo_ts + 17830 + zName = __ccgo_ts + 17864 default: - zName = __ccgo_ts + 17839 + zName = __ccgo_ts + 17873 break } return zName @@ -111509,12 +112648,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17849, - 1: __ccgo_ts + 17856, - 2: __ccgo_ts + 17864, - 3: __ccgo_ts + 17868, - 4: __ccgo_ts + 17732, - 5: __ccgo_ts + 17877, + 0: __ccgo_ts + 17883, + 1: __ccgo_ts + 17890, + 2: __ccgo_ts + 17898, + 3: __ccgo_ts + 17902, + 4: __ccgo_ts + 17766, + 5: __ccgo_ts + 17911, } // C documentation @@ -111576,25 +112715,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17936 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17904 + zType = __ccgo_ts + 17938 } else { - zType = __ccgo_ts + 7594 + zType = __ccgo_ts + 7619 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17906, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17940, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17881, - 2: __ccgo_ts + 17886, - 3: __ccgo_ts + 17894, + 1: __ccgo_ts + 17915, + 2: __ccgo_ts + 17920, + 3: __ccgo_ts + 17928, } // C documentation @@ -111635,8 +112775,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(240) defer tls.Free(240) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -111664,7 +112804,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -111693,7 +112833,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17913, libc.VaList(bp+176, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17947, libc.VaList(bp+176, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -111840,7 +112980,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt b = -int32(1) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17917) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17951) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -111855,6 +112995,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -111910,7 +113051,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17708 + zRet = __ccgo_ts + 17742 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -111929,6 +113070,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -111937,7 +113079,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) } if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17698 + zRet = __ccgo_ts + 17732 } _returnSingleText(tls, v, zRet) break @@ -111947,7 +113089,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -111966,6 +113108,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -111995,6 +113138,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -112172,6 +113316,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -112224,7 +113369,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*int8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17956, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -112256,7 +113401,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17947, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17981, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -112289,7 +113434,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18000) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18034) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -112362,15 +113507,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } } pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18006 + v14 = __ccgo_ts + 18040 } else { - v14 = __ccgo_ts + 18014 + v14 = __ccgo_ts + 18048 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -112385,6 +113531,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -112440,7 +113587,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18021, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18055, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 80)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+80, uintptr(0)) @@ -112456,6 +113603,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -112469,25 +113617,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10773 + zType = __ccgo_ts + 10798 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13021 + zType = __ccgo_ts + 13046 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18037 + zType = __ccgo_ts + 18071 } else { - zType = __ccgo_ts + 9035 + zType = __ccgo_ts + 9060 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18044, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18078, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -112526,13 +113676,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18051, libc.VaList(bp+176, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18085, libc.VaList(bp+176, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18056, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18090, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -112551,13 +113702,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18061, - 1: __ccgo_ts + 18063, - 2: __ccgo_ts + 16550, + 0: __ccgo_ts + 18095, + 1: __ccgo_ts + 18097, + 2: __ccgo_ts + 16584, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18065, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18099, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -112573,9 +113725,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { goto _24 } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18071, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18105, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -112589,9 +113742,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18075, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18109, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -112610,10 +113764,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -112625,6 +113781,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -112635,9 +113792,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7594, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7619, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -112646,9 +113804,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7594, libc.VaList(bp+176, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7619, libc.VaList(bp+176, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -112671,9 +113830,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18078, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18087)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18112, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18121)) goto _32 _32: + ; j2++ } i7++ @@ -112682,7 +113842,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -112742,6 +113902,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -112789,6 +113950,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -112809,12 +113971,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18092, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18126, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -112934,6 +114097,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -112942,6 +114106,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -112984,10 +114149,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -112998,7 +114165,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18096, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18130, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -113016,50 +114183,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -113084,6 +114207,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113106,6 +114230,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -113123,13 +114248,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18120, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -113138,6 +114263,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 108)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -113205,9 +114331,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18156, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18190, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -113220,7 +114347,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if bStrict != 0 && doTypeCheck != 0 { _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18176, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18210, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -113228,7 +114355,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18198, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18232, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -113239,10 +114366,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18221, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18255, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18223, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18257, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -113252,6 +114379,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -113269,12 +114397,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18243, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18277, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -113298,9 +114427,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 112))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18273) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18307) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18278) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18312) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -113313,9 +114442,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18299) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18333) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18335) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18369) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -113337,14 +114466,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18273) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18307) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18346) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18380) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -113365,13 +114495,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 112))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 112))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18373) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18407) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -113379,6 +114510,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 128))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113386,7 +114518,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 108)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18400) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18434) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -113405,6 +114537,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113414,17 +114547,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 104)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18429 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18463 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -113482,27 +114682,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18490, libc.VaList(bp+176, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18524, libc.VaList(bp+176, zRight)) } } } @@ -113580,11 +114781,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -113600,20 +114801,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17715) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17749) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18515) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18549) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17868) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17902) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -113637,11 +114838,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -113709,7 +114910,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -113718,22 +114919,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -113742,16 +114943,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -113760,15 +114961,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18523, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18557, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -113776,12 +114978,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -113879,6 +115083,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -114008,34 +115213,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18432, + FzName: __ccgo_ts + 18466, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18437, + FzName: __ccgo_ts + 18471, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18443, + FzName: __ccgo_ts + 18477, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18452, + FzName: __ccgo_ts + 18486, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18461, + FzName: __ccgo_ts + 18495, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18469, + FzName: __ccgo_ts + 18503, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18477, + FzName: __ccgo_ts + 18511, }, 7: { - FzName: __ccgo_ts + 18484, + FzName: __ccgo_ts + 18518, }, 8: {}, } @@ -114131,34 +115336,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18541) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18575) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18556, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18590, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = int8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18563, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18597, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18569) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18603) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18581) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18615) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) _sqlite3StrAccumFinish(tls, bp) rc = Xsqlite3_declare_vtab(tls, db, bp+32) if rc == SQLITE_OK { @@ -114232,6 +115438,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -114244,6 +115451,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -114287,6 +115496,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -114359,17 +115569,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18596) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18630) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18604, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18638, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18608, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18642, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -114504,24 +115715,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18642, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18676, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5085 + v1 = __ccgo_ts + 5110 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18670, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18704, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18701, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18735, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -114529,9 +115740,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18612, - 1: __ccgo_ts + 18619, - 2: __ccgo_ts + 18631, + 0: __ccgo_ts + 18646, + 1: __ccgo_ts + 18653, + 2: __ccgo_ts + 18665, } // C documentation @@ -114554,6 +115765,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -114606,7 +115818,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14493) + _corruptSchema(tls, pData, argv, __ccgo_ts+14518) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -114639,11 +115851,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18709) + _corruptSchema(tls, pData, argv, __ccgo_ts+18743) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14493) + _corruptSchema(tls, pData, argv, __ccgo_ts+14518) } } } @@ -114682,18 +115894,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9035 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9060 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6510 + v2 = __ccgo_ts + 6535 } else { - v2 = __ccgo_ts + 6043 + v2 = __ccgo_ts + 6068 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8107 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18722 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8132 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18756 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -114754,6 +115966,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -114781,7 +115994,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12072) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12097) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -114807,7 +116020,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18794) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18828) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -114822,7 +116035,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl /* Read the schema information out of the schema tables */ (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18818, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18852, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -114860,11 +116073,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18882, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18916, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -115294,6 +116513,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -115305,7 +116525,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -115319,6 +116539,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -115449,6 +116670,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -115830,6 +117052,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -115838,18 +117061,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11179 - zSp2 = __ccgo_ts + 11179 + zSp1 = __ccgo_ts + 11204 + zSp2 = __ccgo_ts + 11204 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18901, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18935, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -115922,6 +117146,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -115974,6 +117199,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -116023,6 +117249,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -116071,6 +117298,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -116136,7 +117364,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18931, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18965, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -116156,6 +117384,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -116185,7 +117414,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18981, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19015, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -116207,7 +117436,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19045, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19079, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -116229,6 +117458,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -116241,6 +117471,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -116249,7 +117480,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6707, + Fz: __ccgo_ts + 6732, Fn: uint32(8), } @@ -116505,7 +117736,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -116527,6 +117758,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) @@ -116663,6 +117895,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -116692,6 +117925,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -116708,6 +117942,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } } @@ -116839,9 +118074,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } else { /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -116887,6 +118122,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -117002,6 +118238,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -117019,13 +118256,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19082 + z = __ccgo_ts + 19116 case int32(TK_INTERSECT): - z = __ccgo_ts + 19092 + z = __ccgo_ts + 19126 case int32(TK_EXCEPT): - z = __ccgo_ts + 19102 + z = __ccgo_ts + 19136 default: - z = __ccgo_ts + 19109 + z = __ccgo_ts + 19143 break } return z @@ -117046,7 +118283,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19115, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19149, libc.VaList(bp+8, zUsage)) } /* @@ -117081,11 +118318,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19138 + v1 = __ccgo_ts + 19172 } else { v1 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19153, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19187, libc.VaList(bp+8, v1)) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) _sqlite3VdbeGoto(tls, v, addrBreak) @@ -117147,6 +118384,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -117164,6 +118402,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -117274,6 +118513,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -117308,7 +118548,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -117322,7 +118562,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } if iCol < 0 { zType = __ccgo_ts + 1138 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16662 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16696 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -117390,6 +118630,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -117467,13 +118708,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } if iCol < 0 { - zCol = __ccgo_ts + 16662 + zCol = __ccgo_ts + 16696 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -117481,7 +118722,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19184, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19218, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -117491,6 +118732,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -117572,7 +118814,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 16662 + v3 = __ccgo_ts + 16696 } zName = v3 } else { @@ -117587,7 +118829,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19184, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19218, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -117614,6 +118856,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -117622,7 +118865,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19193, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19227, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -117639,6 +118882,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -117652,6 +118896,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -117717,6 +118962,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -117733,7 +118979,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19201 + zType = __ccgo_ts + 19235 } else { zType = uintptr(0) j = int32(1) @@ -117747,6 +118993,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -117769,6 +119016,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 16 } @@ -117987,6 +119235,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -118045,7 +119294,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19205, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19239, 0) return } /* Obtain authorization to do a recursive query */ @@ -118076,6 +119325,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -118137,7 +119387,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19254, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19288, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -118146,12 +119396,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19296, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19330, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -118179,13 +119430,14 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19302, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19336, 0) _sqlite3Select(tls, pParse, p, bp) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup /* Keep running the loop until the Queue is empty */ _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -118232,9 +119484,9 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if nRow == int32(1) { v1 = __ccgo_ts + 1650 } else { - v1 = __ccgo_ts + 19317 + v1 = __ccgo_ts + 19351 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19319, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19353, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -118342,8 +119594,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19342, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19357, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19391, 0) } /* Generate code for the left and right SELECT statements. */ @@ -118368,7 +119620,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19082, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19116, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118381,7 +119633,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -118420,7 +119672,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19410, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118478,7 +119730,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19410, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118545,6 +119797,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -118569,15 +119822,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -118596,9 +119852,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19397, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19431, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19443, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19477, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -118848,6 +120104,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -118869,6 +120126,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -118894,6 +120152,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -118923,6 +120182,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -118939,6 +120199,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr nSelect++ goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -118954,6 +120215,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -118961,8 +120223,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7344) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7344) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7369) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7369) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -119006,14 +120268,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19525, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19559, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19536, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19570, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -119026,7 +120288,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19541, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19575, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -119241,7 +120503,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5063 + v1 = __ccgo_ts + 5088 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -119282,6 +120544,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -119313,11 +120576,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -119410,11 +120675,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -119529,10 +120796,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -119832,6 +121101,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -119846,6 +121116,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -119954,6 +121225,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -120051,6 +121323,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -120089,6 +121362,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 @@ -120139,10 +121413,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -120220,6 +121496,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -120323,6 +121600,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -120571,6 +121849,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -120609,6 +121891,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -120632,10 +121915,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -120723,6 +122008,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -120745,6 +122031,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -120778,10 +122065,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -120817,13 +122106,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r return uint8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15518) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15552) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15522) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15556) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -120907,10 +122196,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19547, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19581, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -120961,6 +122251,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -120985,6 +122276,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -121032,7 +122324,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19565, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19599, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -121071,6 +122363,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -121078,6 +122371,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -121205,7 +122499,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19588, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19622, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -121229,7 +122523,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19608, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19642, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -121243,6 +122537,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -121250,7 +122545,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19651 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19685 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -121275,12 +122570,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19674, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19708, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -121289,9 +122585,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19712 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19746 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19780 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -121350,13 +122646,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19784, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19818, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) /* The usual case - do not allow ROWID on a subquery */ *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -121505,7 +122802,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19788, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19822, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -121520,7 +122817,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19827, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19861, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -121535,7 +122832,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15111, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol @@ -121553,6 +122850,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } @@ -121587,6 +122885,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -121655,7 +122954,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6567 + v10 = __ccgo_ts + 6592 } zSchemaName = v10 } @@ -121672,18 +122971,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19858, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19892, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -121744,10 +123047,10 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19863, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19897, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -121760,7 +123063,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -121769,23 +123072,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19872, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19906, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19924, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -121793,7 +123099,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19910, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19944, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -121876,6 +123182,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -121972,6 +123279,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -122003,6 +123311,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -122068,6 +123377,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -122130,12 +123440,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19941, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19975, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19992, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20026, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -122156,10 +123466,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20025, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20059, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -122203,6 +123514,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -122217,6 +123529,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -122237,6 +123550,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -122347,6 +123661,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -122387,6 +123702,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -122411,6 +123727,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -122429,6 +123746,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -122453,7 +123771,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20058 + v1 = __ccgo_ts + 20092 } else { v1 = __ccgo_ts + 1650 } @@ -122462,7 +123780,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20081, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20115, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -122494,7 +123812,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8107) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8132) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -122650,7 +123968,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15812) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15846) != 0 { return 0 } /* Is count() */ if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { @@ -122753,6 +124071,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -122912,7 +124231,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20093, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20127, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -122986,6 +124305,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -123000,6 +124320,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -123011,7 +124332,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20147, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20181, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -123094,6 +124415,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -123191,7 +124513,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20187, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20221, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -123239,7 +124561,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20202, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20236, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -123265,6 +124587,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -123333,6 +124656,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -123345,6 +124669,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -123456,6 +124781,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -123471,6 +124797,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } @@ -123500,6 +124827,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -123643,11 +124971,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20218 + v44 = __ccgo_ts + 20252 } else { - v44 = __ccgo_ts + 20227 + v44 = __ccgo_ts + 20261 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19115, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19149, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -123663,6 +124991,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -123681,6 +125010,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -123742,6 +125072,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -123859,6 +125190,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -123902,6 +125234,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -123961,7 +125294,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20218) + _explainTempTable(tls, pParse, __ccgo_ts+20252) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -123979,6 +125312,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) _sqlite3VdbeExplainPop(tls, pParse) return rc @@ -124075,12 +125409,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20236, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20270, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -124109,12 +125444,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -124219,6 +125556,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -124328,7 +125666,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20301, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20335, 0) goto trigger_cleanup } iDb = int32(1) @@ -124368,7 +125706,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto trigger_cleanup } - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20347, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20381, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -124378,11 +125716,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20355, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20389, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20396, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20430, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -124391,13 +125729,13 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if zName == uintptr(0) { goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20347, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20381, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20436, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20470, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) } @@ -124405,8 +125743,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20462, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20496, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -124414,15 +125752,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20500 + v1 = __ccgo_ts + 20534 } else { - v1 = __ccgo_ts + 20507 + v1 = __ccgo_ts + 20541 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20513, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20547, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20550, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20584, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -124442,9 +125780,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6510 + v3 = __ccgo_ts + 6535 } else { - v3 = __ccgo_ts + 6043 + v3 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -124486,6 +125824,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 pColumns = uintptr(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -124496,6 +125835,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -124540,7 +125880,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20347, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20381, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -124562,11 +125902,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20596, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20630, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -124577,10 +125918,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20644, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20678, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20719, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20753, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -124598,6 +125939,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _sqlite3DeleteTriggerStep(tls, db, pStepList) } @@ -124624,6 +125966,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -124840,11 +126183,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20748, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20782, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -124853,6 +126197,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -124884,9 +126229,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 if iDb == int32(1) { @@ -124901,7 +126246,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20768, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20802, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -124932,6 +126277,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -124968,6 +126314,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -125032,11 +126379,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20830 + v1 = __ccgo_ts + 20864 } else { - v1 = __ccgo_ts + 20837 + v1 = __ccgo_ts + 20871 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20844, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20878, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -125054,6 +126401,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -125135,7 +126483,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20892, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20926, 0) return int32(1) } @@ -125180,6 +126528,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -125193,6 +126542,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -125271,6 +126621,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -125323,7 +126674,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6240, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6265, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -125344,6 +126695,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -125424,7 +126776,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20934, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20968, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -125489,6 +126841,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -125599,6 +126952,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -125662,6 +127016,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -125856,6 +127211,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -125874,6 +127230,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -125896,6 +127253,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -126028,6 +127386,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -126057,6 +127416,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -126105,7 +127465,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20948, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -126115,6 +127475,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -126124,13 +127485,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20984, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7882 + v11 = __ccgo_ts + 7907 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -126144,6 +127505,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } chngKey = uint8(int32(chngRowid) + int32(chngPk)) @@ -126174,6 +127536,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -126229,6 +127592,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -126238,6 +127602,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -126456,6 +127821,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -126525,6 +127891,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -126581,6 +127948,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -126645,6 +128013,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -126695,6 +128064,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -126803,9 +128173,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21003) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21037) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -126899,6 +128270,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -126932,6 +128304,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -126980,6 +128353,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -127095,7 +128469,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -127196,6 +128570,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -127204,6 +128579,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -127212,22 +128588,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]int8)(unsafe.Pointer(bp + 200)))[0] = 0 } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21016, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21050, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21020, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21054, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -127248,14 +128634,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -127315,10 +128707,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12447, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12472, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -127337,6 +128730,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -127399,7 +128793,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21093, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21097, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21127, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21131, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -127500,6 +128894,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -127525,17 +128920,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21101) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21135) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21141) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21175) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21184) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21218) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -127574,7 +128969,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21202, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21236, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -127586,7 +128981,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21225) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21259) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -127603,7 +128998,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14856) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14881) if rc != SQLITE_OK { goto end_of_vacuum } @@ -127634,11 +129029,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21252, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21286, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21360, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21394, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -127647,7 +129042,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21414, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21448, libc.VaList(bp+24, zDbMain)) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { goto end_of_vacuum @@ -127657,7 +129052,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21565, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21599, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -127676,6 +129071,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -127696,6 +129092,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -127889,6 +129286,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -127898,6 +129296,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -127954,6 +129353,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -128055,6 +129455,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -128140,6 +129541,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -128176,7 +129578,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12677, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12702, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -128299,7 +129701,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21695, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21729, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -128309,11 +129711,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21719, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21753, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21818, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21852, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -128400,11 +129802,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21837, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21871, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -128441,7 +129844,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21879, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21913, libc.VaList(bp+48, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3797, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) @@ -128456,7 +129859,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21909 + zFormat = __ccgo_ts + 21943 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -128490,11 +129893,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16553, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16587, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -128512,6 +129916,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -128526,6 +129931,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -128568,7 +129974,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21955, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21989, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -128655,7 +130061,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21955, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21989, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -128690,9 +130096,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _sqlite3ParseObjectInit(tls, bp, db) @@ -128788,6 +130194,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -128846,6 +130253,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -128886,6 +130294,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -128953,6 +130362,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -129026,6 +130436,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -129131,6 +130542,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -129263,7 +130675,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { ap = va switch op { @@ -129276,7 +130688,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -129998,10 +131410,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21974 + return __ccgo_ts + 22008 } if i == -int32(1) { - return __ccgo_ts + 16662 + return __ccgo_ts + 16696 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -130020,10 +131432,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, var i int32 _ = i if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22015, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(1)) } i = 0 for { @@ -130031,19 +131443,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13092, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(1)) } i = 0 for { @@ -130051,15 +131464,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13092, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5085, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5110, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } } @@ -130092,7 +131506,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21989, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22023, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -130100,27 +131514,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22015, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21992 + v2 = __ccgo_ts + 22026 } else { - v2 = __ccgo_ts + 21997 + v2 = __ccgo_ts + 22031 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22039) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22007) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22041) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } // C documentation @@ -130163,47 +131578,47 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22009 + v2 = __ccgo_ts + 22043 } else { - v2 = __ccgo_ts + 22016 + v2 = __ccgo_ts + 22050 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22021, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22055, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11230 + zFmt = __ccgo_ts + 11255 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22027 + zFmt = __ccgo_ts + 22061 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22060 + zFmt = __ccgo_ts + 22094 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22085 + zFmt = __ccgo_ts + 22119 } else { - zFmt = __ccgo_ts + 22103 + zFmt = __ccgo_ts + 22137 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22112, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22146, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16662 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22120, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 16696 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22154, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = int8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22151, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22185, libc.VaList(bp+144, zRowid)) cRangeOp = int8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -130213,10 +131628,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22161, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22195, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22166, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22200, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -130235,7 +131650,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22193, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22227, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -130269,14 +131684,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22204, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22238, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21992, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22026, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22259, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -130286,15 +131701,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22015, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21992, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22026, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -130433,6 +131849,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -130509,6 +131926,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -130543,11 +131961,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -130606,6 +132026,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -130618,6 +132039,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -130732,6 +132154,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -130850,6 +132273,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -130900,6 +132324,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -130967,6 +132392,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -131004,6 +132430,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -131045,6 +132472,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -131188,6 +132616,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -131249,6 +132678,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -131349,6 +132779,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -131379,6 +132810,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -131773,6 +133205,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -131862,6 +133295,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104)) goto _48 _48: + ; k++ } } else { @@ -131952,6 +133386,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -131967,7 +133402,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22233, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22267, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -131990,7 +133425,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22248, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22282, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) if pSubWInfo != 0 { addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) @@ -132024,6 +133459,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -132095,6 +133531,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -132218,6 +133655,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -132273,6 +133711,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -132305,6 +133744,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -132345,6 +133785,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -132365,10 +133806,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -132454,7 +133897,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22257, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22291, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -132468,6 +133911,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -132490,6 +133934,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -132523,6 +133968,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -132765,6 +134211,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 @@ -132890,6 +134337,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -132953,19 +134401,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16511, + FzOp: __ccgo_ts + 16545, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15842, + FzOp: __ccgo_ts + 15876, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15321, + FzOp: __ccgo_ts + 15355, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22271, + FzOp: __ccgo_ts + 22305, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -133084,6 +134532,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp } goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -133250,6 +134699,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -133276,6 +134726,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -133381,6 +134832,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } @@ -133422,11 +134874,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -133450,6 +134904,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } @@ -133546,6 +135001,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -133598,14 +135054,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -133645,10 +135104,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -133739,7 +135200,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22278, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22312, 0) return } } else { @@ -133751,7 +135212,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22278, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22312, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -133835,7 +135296,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } else { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7868 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7893 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -133857,6 +135318,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -133908,6 +135370,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) goto _11 _11: + ; i1++ } } @@ -133929,7 +135392,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22319 + v13 = __ccgo_ts + 22353 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -133982,6 +135445,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -134004,6 +135468,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -134199,6 +135664,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -134220,6 +135686,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -134383,6 +135850,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -134410,6 +135878,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -134449,7 +135918,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22326, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22360, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -134476,6 +135945,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -134654,6 +136124,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -134750,6 +136221,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -134771,6 +136243,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -134778,6 +136251,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -134808,6 +136282,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -134919,6 +136394,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -134956,6 +136432,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -135124,6 +136601,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -135192,6 +136670,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -135233,6 +136712,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -135241,6 +136721,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -135307,6 +136788,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -135443,7 +136925,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -138247,6 +139761,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -138373,6 +139888,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -138406,6 +139922,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -138480,6 +139997,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -138519,7 +140037,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22399, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22433, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 @@ -138581,6 +140099,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -138593,11 +140112,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22399, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22433, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } (*(*struct { @@ -138744,7 +140264,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -138794,6 +140314,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -138805,6 +140326,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -138912,6 +140434,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -139044,16 +140567,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -139085,11 +140611,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -139160,6 +140688,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -139173,7 +140702,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22425, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22459, 0) rc = SQLITE_OK } else { break @@ -139181,6 +140710,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -139326,6 +140856,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -139343,6 +140874,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -139415,6 +140947,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -139492,6 +141025,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -139530,6 +141064,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -139557,11 +141092,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -139584,6 +141121,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -139741,6 +141279,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -139862,6 +141401,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -139927,16 +141467,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -139947,10 +141490,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22460, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22494, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -139966,6 +141510,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } /* Load the lowest cost path into pWInfo */ @@ -139982,6 +141527,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -140114,6 +141660,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140131,6 +141678,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -140269,6 +141817,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -140286,6 +141835,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -140295,6 +141845,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- goto _1 _1: + ; i-- } return notReady @@ -140349,6 +141900,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -140367,9 +141919,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 for { @@ -140379,11 +141931,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -140413,7 +141963,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) } @@ -140424,6 +141974,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -140453,6 +142004,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -140572,7 +142124,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22478, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22512, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -140644,7 +142196,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22506, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22540, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -140666,6 +142218,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -140724,6 +142277,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -140896,6 +142450,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -140999,6 +142554,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -141049,6 +142605,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -141056,6 +142613,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -141126,6 +142684,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -141202,6 +142761,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -141239,6 +142799,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } i = 0 @@ -141343,6 +142904,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -141352,6 +142914,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -141630,7 +143193,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22524, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22558, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -141812,7 +143376,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22580, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22614, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -142134,10 +143698,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22625, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22659, libc.VaList(bp+8, zName)) } return p } @@ -142188,12 +143753,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22644, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22678, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22715, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22749, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -142266,12 +143831,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8107) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8132) } break } goto _1 _1: + ; i++ } } @@ -142339,6 +143905,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -142361,6 +143928,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -142386,6 +143954,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -142516,6 +144085,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -142543,7 +144113,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt bp := tls.Alloc(16) defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22778, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22812, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -142674,6 +144244,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -142828,7 +144399,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22804, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22838, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -142847,6 +144418,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -142894,18 +144466,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22836 + zErr = __ccgo_ts + 22870 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22853 + zErr = __ccgo_ts + 22887 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22869 + zErr = __ccgo_ts + 22903 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22889, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22923, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -142929,7 +144501,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22956, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -143105,6 +144677,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143146,11 +144719,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22969, - 1: __ccgo_ts + 23022, - 2: __ccgo_ts + 22524, - 3: __ccgo_ts + 23073, - 4: __ccgo_ts + 23125, + 0: __ccgo_ts + 23003, + 1: __ccgo_ts + 23056, + 2: __ccgo_ts + 22558, + 3: __ccgo_ts + 23107, + 4: __ccgo_ts + 23159, } var _aOp1 = [5]int32{ @@ -143313,6 +144886,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -143371,6 +144945,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -143415,6 +144990,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -143441,6 +145017,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143491,6 +145068,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143539,6 +145117,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -143674,6 +145253,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143719,6 +145299,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -143749,6 +145330,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -144103,6 +145685,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -144591,6 +146174,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -144919,11 +146503,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23175 + v1 = __ccgo_ts + 23209 } else { - v1 = __ccgo_ts + 23184 + v1 = __ccgo_ts + 23218 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23190, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23224, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -144932,7 +146516,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23232, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23266, 0) } } } @@ -145021,7 +146605,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23266, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23300, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -151334,103 +152918,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -151555,7 +153139,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23304, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23338, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -153069,289 +154653,387 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16662, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16696, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23326, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16575, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16609, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23326, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -153375,17 +155057,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -153393,10 +155080,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -153410,73 +155099,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -153510,142 +155223,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23353) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23387) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -153658,74 +155417,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -153736,18 +155516,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1)))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -153758,7 +155542,7 @@ _200: /* expr ::= VARIABLE */ ** in the virtual machine. #N is the N-th register. */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23396, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -153768,47 +155552,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -153820,23 +155614,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -153849,7 +155653,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -153863,33 +155668,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -153898,17 +155712,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -153921,7 +155739,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -153933,9 +155752,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 7863 + v345 = __ccgo_ts + 7888 } else { - v345 = __ccgo_ts + 7868 + v345 = __ccgo_ts + 7893 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -153978,18 +155797,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -154006,13 +155828,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -154027,73 +155851,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -154102,236 +155948,309 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23386, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23420, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23481, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23515, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23565, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23599, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = int8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -154340,11 +156259,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -154354,22 +156275,27 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: + ; goto _342 /********** End reduce actions ************************************************/ _342: + ; yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) @@ -154402,9 +156328,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23396, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23650, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23684, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -156453,6 +158379,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -156632,6 +158559,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -156647,6 +158575,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -156691,6 +158620,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -156786,6 +158716,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -156819,6 +158750,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -156830,6 +158762,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -156864,6 +158797,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -156882,6 +158816,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -156905,6 +158840,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -156927,6 +158863,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -156945,6 +158882,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -156966,6 +158904,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -157078,7 +159017,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23667, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23701, libc.VaList(bp+2456, bp+2432)) break } } @@ -157102,7 +159041,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3797, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23692, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23726, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -157217,7 +159156,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*int8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*int8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -157227,9 +159166,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -157243,7 +159182,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -157255,7 +159194,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -157264,9 +159203,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*int8)(unsafe.Pointer(zSql))) @@ -157287,13 +159226,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*int8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23703, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23737, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -157301,13 +159241,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20347, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20381, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23710, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23744, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23715, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23749, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -157317,10 +159257,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23725, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23759, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23729, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23763, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -157580,6 +159520,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -157751,8 +159693,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -157760,7 +159702,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -158879,31 +160840,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23805, - 1: __ccgo_ts + 23818, - 3: __ccgo_ts + 23834, - 4: __ccgo_ts + 23859, - 5: __ccgo_ts + 23873, - 6: __ccgo_ts + 23892, + 0: __ccgo_ts + 23839, + 1: __ccgo_ts + 23852, + 3: __ccgo_ts + 23868, + 4: __ccgo_ts + 23893, + 5: __ccgo_ts + 23907, + 6: __ccgo_ts + 23926, 7: __ccgo_ts + 1620, - 8: __ccgo_ts + 23917, - 9: __ccgo_ts + 23954, - 10: __ccgo_ts + 23966, - 11: __ccgo_ts + 23981, - 12: __ccgo_ts + 24014, - 13: __ccgo_ts + 24032, - 14: __ccgo_ts + 24057, - 15: __ccgo_ts + 24086, - 17: __ccgo_ts + 5998, - 18: __ccgo_ts + 5400, - 19: __ccgo_ts + 24103, - 20: __ccgo_ts + 24121, - 21: __ccgo_ts + 24139, - 23: __ccgo_ts + 24173, - 25: __ccgo_ts + 24194, - 26: __ccgo_ts + 24220, - 27: __ccgo_ts + 24243, - 28: __ccgo_ts + 24264, + 8: __ccgo_ts + 23951, + 9: __ccgo_ts + 23988, + 10: __ccgo_ts + 24000, + 11: __ccgo_ts + 24015, + 12: __ccgo_ts + 24048, + 13: __ccgo_ts + 24066, + 14: __ccgo_ts + 24091, + 15: __ccgo_ts + 24120, + 17: __ccgo_ts + 6023, + 18: __ccgo_ts + 5425, + 19: __ccgo_ts + 24137, + 20: __ccgo_ts + 24155, + 21: __ccgo_ts + 24173, + 23: __ccgo_ts + 24207, + 25: __ccgo_ts + 24228, + 26: __ccgo_ts + 24254, + 27: __ccgo_ts + 24277, + 28: __ccgo_ts + 24298, } // C documentation @@ -159082,7 +161043,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i var p, v1 uintptr _, _, _, _ = extraFlags, p, rc, v1 if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) @@ -159125,7 +161086,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24361, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24395, 0) return int32(SQLITE_BUSY) } else { _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -159196,6 +161157,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -159249,7 +161211,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24424, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24458, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -159524,7 +161486,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { @@ -159534,7 +161496,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24475, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24509, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -159607,6 +161569,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -159655,7 +161618,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -159787,7 +161750,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -159797,7 +161760,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -159846,7 +161809,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -159855,7 +161818,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24496, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24530, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -159881,6 +161844,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -160001,7 +161965,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u flags = *(*uint32)(unsafe.Pointer(pFlags)) zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24564, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24598, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -160015,6 +161979,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -160030,8 +161995,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24570, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24580, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24604, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24614, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -160120,20 +162085,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24608, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24642, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24612, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24646, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24612 + zModeType = __ccgo_ts + 24646 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24633, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24667, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -160162,15 +162127,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24648, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24682, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24668, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24702, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -160194,10 +162160,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24692, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24726, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -160212,11 +162179,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24618, + Fz: __ccgo_ts + 24652, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24625, + Fz: __ccgo_ts + 24659, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -160227,19 +162194,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24638, + Fz: __ccgo_ts + 24672, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24641, + Fz: __ccgo_ts + 24675, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24644, + Fz: __ccgo_ts + 24678, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17732, + Fz: __ccgo_ts + 17766, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -160367,8 +162334,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22319, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24708, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22353, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24742, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -160389,7 +162356,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -160425,9 +162392,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6562 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6587 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23710 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23744 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -160449,6 +162416,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -160472,6 +162440,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } @@ -160518,7 +162487,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24714 + zFilename = __ccgo_ts + 24748 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -160633,6 +162602,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -160658,6 +162628,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -160733,20 +162704,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24717, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24751, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24742) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24776) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24762) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24796) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24769) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24803) } // C documentation @@ -160811,6 +162782,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -160852,6 +162824,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -160874,7 +162847,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24786, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24820, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -161516,6 +163489,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -161535,6 +163509,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -161900,7 +163875,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24814, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24848, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -161916,6 +163891,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -162001,6 +163977,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -162021,6 +163998,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -162099,6 +164077,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -162114,7 +164093,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } _leaveMutex(tls) if rc != 0 { - v2 = __ccgo_ts + 24822 + v2 = __ccgo_ts + 24856 } else { v2 = uintptr(0) } @@ -162995,18 +164974,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1636, - 1: __ccgo_ts + 7863, - 2: __ccgo_ts + 7868, - 3: __ccgo_ts + 6283, - 4: __ccgo_ts + 6283, - 5: __ccgo_ts + 6278, - 6: __ccgo_ts + 6278, - 7: __ccgo_ts + 8174, - 8: __ccgo_ts + 8174, - 9: __ccgo_ts + 8174, - 10: __ccgo_ts + 8174, - 11: __ccgo_ts + 24845, - 12: __ccgo_ts + 24851, + 1: __ccgo_ts + 7888, + 2: __ccgo_ts + 7893, + 3: __ccgo_ts + 6308, + 4: __ccgo_ts + 6308, + 5: __ccgo_ts + 6303, + 6: __ccgo_ts + 6303, + 7: __ccgo_ts + 8199, + 8: __ccgo_ts + 8199, + 9: __ccgo_ts + 8199, + 10: __ccgo_ts + 8199, + 11: __ccgo_ts + 24879, + 12: __ccgo_ts + 24885, 13: __ccgo_ts + 1650, 14: __ccgo_ts + 1650, 15: __ccgo_ts + 1650, @@ -163434,6 +165413,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -163521,6 +165501,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -163537,6 +165518,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -163846,6 +165828,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -163859,6 +165842,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -163891,13 +165875,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24858 + uintptr(int32(c)>>int32(4)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24892 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24858 + uintptr(int32(c)&int32(0xf)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24892 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -163932,7 +165917,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1636, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24875, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15325, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -163953,7 +165938,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24883, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24909, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -164007,7 +165992,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24938, -int32(1)) } } } @@ -164175,6 +166160,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -164197,6 +166183,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -164253,6 +166240,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -164286,8 +166274,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(3), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24927, - FzRepl: __ccgo_ts + 24931, + FzMatch: __ccgo_ts + 24953, + FzRepl: __ccgo_ts + 24957, }, 1: { Fc1: int8('i'), @@ -164295,8 +166283,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(8), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24939, - FzRepl: __ccgo_ts + 24931, + FzMatch: __ccgo_ts + 24965, + FzRepl: __ccgo_ts + 24957, }, 2: { Fc1: int8('n'), @@ -164311,7 +166299,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('Q'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24948, + FzMatch: __ccgo_ts + 24974, FzRepl: __ccgo_ts + 1636, }, 4: { @@ -164319,7 +166307,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('S'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24953, + FzMatch: __ccgo_ts + 24979, FzRepl: __ccgo_ts + 1636, }, } @@ -164335,7 +166323,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24958, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24984, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -164755,6 +166743,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -164786,7 +166775,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+25001, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25027, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -164903,6 +166892,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { case int32('{'): goto _1 @@ -164983,6 +166973,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -165055,6 +167046,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -165094,12 +167086,14 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -165162,19 +167156,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -165236,24 +167234,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7863, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7888, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7868, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7893, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -165263,19 +167265,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) c = *(*int8)(unsafe.Pointer(z + uintptr(i))) if int32(c) <= int32('0') { @@ -165290,6 +167304,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -165304,14 +167319,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24927, int32(3)) == 0 { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24953, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25010) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25036) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25023, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25049, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -165341,6 +167356,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -165350,6 +167366,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*int8)(unsafe.Pointer(z + uintptr(j))) @@ -165394,6 +167411,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -165406,39 +167424,57 @@ parse_number_2: } } parse_number_finish: + ; if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { i++ } _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -165448,12 +167484,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1636, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*int8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -165471,7 +167509,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -165479,11 +167517,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -165514,7 +167554,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -165527,7 +167567,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -165549,6 +167589,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint64(72)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -165685,22 +167729,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1636, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7863, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7888, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7868, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7893, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -165733,16 +167783,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24931 + v19 = __ccgo_ts + 24957 } else { - v19 = __ccgo_ts + 11730 + v19 = __ccgo_ts + 11755 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -165765,16 +167817,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, int8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, int8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, int8('"')) @@ -165786,6 +167842,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -165797,7 +167854,7 @@ _11: sz2 -= k2 } if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25029, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25055, uint32(2)) zIn2++ sz2-- continue @@ -165811,7 +167868,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, int8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25032, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25058, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -165819,12 +167876,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25039, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25065, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25044, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25070, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -165853,9 +167910,11 @@ _11: _jsonAppendChar(tls, pOut, int8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, int8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -165873,6 +167932,7 @@ _13: _jsonAppendChar(tls, pOut, int8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, int8('{')) j = i + n @@ -165898,11 +167958,14 @@ _14: _jsonAppendChar(tls, pOut, int8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -165973,6 +168036,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -166389,6 +168453,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -166407,6 +168472,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -166620,7 +168686,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -166655,25 +168721,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -166718,11 +168789,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -166735,11 +168809,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -166807,13 +168885,16 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ *(*int8)(unsafe.Pointer(zOut + uintptr(iOut))) = 0 Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -166827,14 +168908,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) return } @@ -166875,7 +168960,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24883, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24909, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -166888,7 +168973,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint64(72)) return int32(1) @@ -166907,10 +168992,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } else { if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25010) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25036) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -166949,7 +169034,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25051, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25077, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -167035,15 +169120,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -167128,6 +169215,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -167171,12 +169259,12 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -167216,15 +169304,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -167316,6 +169406,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, int8(']')) @@ -167353,7 +169444,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25069 + v1 = __ccgo_ts + 25095 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -167363,7 +169454,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } eErr = uint8(1) @@ -167394,6 +169485,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -167412,6 +169504,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -167485,9 +169578,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25097, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5138, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5163, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1663, uint32(1)) @@ -167496,9 +169589,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25073, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25099, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25076, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25102, uint32(1)) } } } @@ -167538,7 +169631,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -167548,6 +169641,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -167558,6 +169652,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -167803,7 +169898,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -167827,7 +169922,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25078, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25104, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -167838,7 +169933,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25129, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25155, -int32(1)) _jsonStringReset(tls, bp) return } @@ -167850,6 +169945,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, int8('}')) @@ -167909,21 +170005,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -167941,7 +170040,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15764) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15798) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -167972,9 +170071,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25163 + v1 = __ccgo_ts + 25189 } else { - v1 = __ccgo_ts + 25167 + v1 = __ccgo_ts + 25193 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -168022,7 +170121,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } goto json_type_done @@ -168032,6 +170131,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -168109,7 +170209,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25174, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25200, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -168216,6 +170316,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -168299,7 +170400,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25231, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25257, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -168365,6 +170466,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -168447,7 +170549,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25234, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25260, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -168550,7 +170652,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25237) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25263) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -168684,7 +170786,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { var _ /* sz at bp+0 */ Tu32 _, _, _, _, _ = i, k, n, needQuote, z if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25320, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25346, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -168705,13 +170807,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25327, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25353, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25335, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25361, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -168873,6 +170976,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -168902,9 +171008,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -168963,6 +171069,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -169093,7 +171200,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25341, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25367, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -169114,8 +171221,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24912, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24938, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -169176,176 +171284,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25343, + FzName: __ccgo_ts + 25369, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25348, + FzName: __ccgo_ts + 25374, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25354, + FzName: __ccgo_ts + 25380, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25365, + FzName: __ccgo_ts + 25391, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25377, + FzName: __ccgo_ts + 25403, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25377, + FzName: __ccgo_ts + 25403, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25395, + FzName: __ccgo_ts + 25421, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25415, + FzName: __ccgo_ts + 25441, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25428, + FzName: __ccgo_ts + 25454, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25442, + FzName: __ccgo_ts + 25468, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25445, + FzName: __ccgo_ts + 25471, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25449, + FzName: __ccgo_ts + 25475, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25461, + FzName: __ccgo_ts + 25487, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25474, + FzName: __ccgo_ts + 25500, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25486, + FzName: __ccgo_ts + 25512, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25499, + FzName: __ccgo_ts + 25525, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25510, + FzName: __ccgo_ts + 25536, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25522, + FzName: __ccgo_ts + 25548, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25533, + FzName: __ccgo_ts + 25559, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25545, + FzName: __ccgo_ts + 25571, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25558, + FzName: __ccgo_ts + 25584, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25571, + FzName: __ccgo_ts + 25597, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25585, + FzName: __ccgo_ts + 25611, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25594, + FzName: __ccgo_ts + 25620, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25604, + FzName: __ccgo_ts + 25630, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25604, + FzName: __ccgo_ts + 25630, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25614, + FzName: __ccgo_ts + 25640, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25614, + FzName: __ccgo_ts + 25640, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25625, + FzName: __ccgo_ts + 25651, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25642, + FzName: __ccgo_ts + 25668, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25660, + FzName: __ccgo_ts + 25686, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25678, + FzName: __ccgo_ts + 25704, }, } @@ -169415,6 +171523,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -169425,11 +171534,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25697, + FzName: __ccgo_ts + 25723, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25707, + FzName: __ccgo_ts + 25733, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -169959,6 +172068,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -169993,6 +172103,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -170032,11 +172143,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -170076,10 +172185,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25717, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25743, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -170133,6 +172241,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -170161,6 +172270,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -170380,7 +172490,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25722, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25748, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -170441,6 +172551,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -170454,6 +172565,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -170477,7 +172589,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -170784,6 +172898,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -171213,6 +173334,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -171288,7 +173412,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25804) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25830) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -171425,6 +173549,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -171512,6 +173637,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } ii = 0 @@ -171530,6 +173656,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -171581,6 +173708,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -171743,6 +173871,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -171758,6 +173887,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -171841,11 +173971,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -171901,6 +174033,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -171924,6 +174057,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -171932,6 +174066,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -172104,11 +174239,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -172139,6 +174276,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -172152,6 +174290,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -172161,6 +174300,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48)) @@ -172187,6 +174327,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -172214,6 +174355,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -172262,6 +174404,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -172342,6 +174485,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -172357,6 +174501,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -172373,6 +174518,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -172417,6 +174563,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -172507,6 +174654,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -172616,6 +174764,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -172718,6 +174867,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -172796,7 +174946,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25818, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25844, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -172806,11 +174956,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25838, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25864, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25870, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25896, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -172884,6 +175034,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -172900,6 +175051,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -172963,6 +175115,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -172970,6 +175123,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -172983,7 +175137,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -173002,6 +175156,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -173015,7 +175173,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25907, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25933, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -173069,9 +175227,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26052 + zFmt = __ccgo_ts + 26078 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11559, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11584, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -173122,15 +175280,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26108, - 1: __ccgo_ts + 5461, - 2: __ccgo_ts + 16662, + 0: __ccgo_ts + 26134, + 1: __ccgo_ts + 5486, + 2: __ccgo_ts + 16696, } var _rtreeModule = Tsqlite3_module{ @@ -173155,7 +175314,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) @@ -173174,20 +175333,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26522, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26548, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26584, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26610, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26589, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26653, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26723, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26615, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26679, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26749, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -173217,7 +175377,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 26772 + zFormat = __ccgo_ts + 26798 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -173228,33 +175388,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26880, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26906, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26925, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26951, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13092, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26952, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26978, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26974, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27000, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26982, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27008, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -173268,14 +175430,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26113, - 1: __ccgo_ts + 26166, - 2: __ccgo_ts + 26211, - 3: __ccgo_ts + 26263, - 4: __ccgo_ts + 26317, - 5: __ccgo_ts + 26362, - 6: __ccgo_ts + 26420, - 7: __ccgo_ts + 26475, + 0: __ccgo_ts + 26139, + 1: __ccgo_ts + 26192, + 2: __ccgo_ts + 26237, + 3: __ccgo_ts + 26289, + 4: __ccgo_ts + 26343, + 5: __ccgo_ts + 26388, + 6: __ccgo_ts + 26446, + 7: __ccgo_ts + 26501, } // C documentation @@ -173333,7 +175495,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26998, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27024, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -173344,14 +175506,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3797, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27018, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27044, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+32) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3797, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -173428,13 +175590,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27261, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27287, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27267, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27293, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -173443,7 +175605,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27291, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27317, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -173454,9 +175616,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27318, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27344, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -173508,6 +175671,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -173516,8 +175680,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27297, - 1: __ccgo_ts + 27308, + 0: __ccgo_ts + 27323, + 1: __ccgo_ts + 27334, } // C documentation @@ -173575,22 +175739,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11179, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11204, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27321, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27347, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27327, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27353, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27331, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27357, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -173614,7 +175780,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27333, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27359, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -173732,11 +175898,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4180 + v1 = __ccgo_ts + 4205 } else { v1 = __ccgo_ts + 1650 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27366, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27392, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -173770,7 +175936,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27373, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27399, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -173787,7 +175953,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27418, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27444, libc.VaList(bp+8, iNode)) } } return pRet @@ -173816,8 +175982,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27450, - 1: __ccgo_ts + 27504, + 0: __ccgo_ts + 27476, + 1: __ccgo_ts + 27530, } if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) @@ -173830,21 +175996,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27552 + v1 = __ccgo_ts + 27578 } else { - v1 = __ccgo_ts + 27560 + v1 = __ccgo_ts + 27586 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27569, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27595, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27552 + v2 = __ccgo_ts + 27578 } else { - v2 = __ccgo_ts + 27560 + v2 = __ccgo_ts + 27586 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27614, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27640, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -173889,7 +176055,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27672, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27698, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -173907,11 +176073,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27720, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27746, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -173939,19 +176106,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27787, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27813, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27821, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27847, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27851, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27877, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -173971,6 +176138,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -173995,12 +176163,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27906, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27932, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27937, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27963, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -174029,7 +176197,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28004, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28030, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -174039,11 +176207,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25818, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25844, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28032, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28058, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -174059,8 +176227,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28063, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28070, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28089, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28096, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -174087,7 +176255,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28078, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28104, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -174138,13 +176306,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28097, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28123, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6562 + zDb = __ccgo_ts + 6587 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -174153,7 +176321,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18429 + v1 = __ccgo_ts + 18463 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -174376,6 +176544,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -174486,6 +176655,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -174546,6 +176716,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -174616,18 +176787,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25071, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25097, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28148, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28174, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28159, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28185, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -174656,19 +176828,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = int8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28170, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28196, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28188, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28214, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = int8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28196, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28222, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -174676,13 +176849,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28204, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28230, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28208, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28234, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -174734,6 +176908,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -174763,6 +176938,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -174828,6 +177004,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -174905,6 +177082,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -174974,6 +177152,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -174983,6 +177162,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -175010,18 +177190,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) } _2: + ; return pOut } @@ -175204,6 +177388,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -175380,6 +177565,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -175446,6 +177632,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -175454,6 +177641,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -175465,6 +177653,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -175533,6 +177722,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -175549,6 +177739,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -175615,6 +177806,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -175639,6 +177831,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -175675,6 +177868,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -175699,6 +177893,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -175788,13 +177983,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27261, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27287, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28221, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28247, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -175803,12 +177998,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28243, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28269, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27318, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27344, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -175837,6 +178033,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -175984,6 +178181,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -176034,11 +178232,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16662 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16696 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -176048,7 +178247,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28247 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28273 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -176056,7 +178255,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28253 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28279 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -176176,7 +178375,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28262, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28288, 0) } goto geopoly_update_end } @@ -176255,6 +178454,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -176263,6 +178463,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -176276,12 +178477,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28302) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28328) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28318) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28344) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -176337,6 +178538,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -176347,10 +178549,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28495, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28521, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -176364,61 +178567,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28333, + FzName: __ccgo_ts + 28359, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28346, + FzName: __ccgo_ts + 28372, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28359, + FzName: __ccgo_ts + 28385, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28372, + FzName: __ccgo_ts + 28398, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28318, + FzName: __ccgo_ts + 28344, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28384, + FzName: __ccgo_ts + 28410, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28302, + FzName: __ccgo_ts + 28328, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28407, + FzName: __ccgo_ts + 28433, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28421, + FzName: __ccgo_ts + 28447, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28434, + FzName: __ccgo_ts + 28460, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28448, + FzName: __ccgo_ts + 28474, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28464, + FzName: __ccgo_ts + 28490, }, } @@ -176444,7 +178647,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28476, + FzName: __ccgo_ts + 28502, }, } @@ -176469,20 +178672,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28503, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28529, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28513, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28539, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28524, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28550, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28247, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28273, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28535, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28561, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -176527,6 +178730,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -176576,13 +178780,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25804, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25830, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -177799,7 +180004,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28571, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -177809,7 +180014,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28571, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -177911,6 +180116,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -177989,7 +180195,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28566, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28592, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -178077,7 +180283,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25717, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25743, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -178085,6 +180291,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -178113,13 +180320,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint64(192)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28737 + v1 = __ccgo_ts + 28763 } else { v1 = __ccgo_ts + 1650 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28778, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28804, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28928) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28954) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -178347,7 +180554,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29053, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29079, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -178357,7 +180564,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29172, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29198, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -178365,7 +180572,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29193, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29219, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -178377,7 +180584,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29244, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29270, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -178388,6 +180595,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -178396,6 +180604,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -178418,7 +180627,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -178431,7 +180640,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -178484,7 +180693,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19872, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19906, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -178495,7 +180704,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29322, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29348, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -178506,7 +180715,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29341, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29367, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -178514,12 +180723,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29346, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29372, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178527,17 +180737,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29356 + v4 = __ccgo_ts + 29382 } else { - v4 = __ccgo_ts + 29369 + v4 = __ccgo_ts + 29395 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29378, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29404, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29407, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29433, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -178554,11 +180764,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29429, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29455, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -178604,10 +180815,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29456, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29482, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14992 goto _1 _1: + ; i++ } return zList @@ -178638,12 +180850,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29465, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29491, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -178685,21 +180898,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29478, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29504, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29510, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29536, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+29533) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29539, __ccgo_ts+29546, __ccgo_ts+5083) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+29559) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29565, __ccgo_ts+29572, __ccgo_ts+5108) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+1650) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29554, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29580, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29596, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -178751,7 +180964,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1650 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -178768,19 +180981,20 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 29616 + zCol = __ccgo_ts + 29642 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29624, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29645, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29681, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14967 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29650, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29671, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29707, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14992 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -178789,7 +181003,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29708, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29734, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { zSep = __ccgo_ts + 1650 iCol = 0 @@ -178806,19 +181020,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29756, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14967 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29782, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14992 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29763, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29789, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -178869,7 +181085,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zAnd = __ccgo_ts + 1650 /* Set to " AND " later on */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -178878,7 +181094,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29775, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29801, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) zType = __ccgo_ts + 1650 } else { if iCid < 0 { @@ -178892,14 +181108,15 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29616 + zCol = __ccgo_ts + 29642 } else { - zCol = __ccgo_ts + 29346 + zCol = __ccgo_ts + 29372 } } zType = __ccgo_ts + 1138 @@ -178907,24 +181124,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29797, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29823, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29533 + v2 = __ccgo_ts + 29559 } else { v2 = __ccgo_ts + 1650 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29817, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29843, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29838, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29871, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29864, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29897, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14967 - zAnd = __ccgo_ts + 21981 + zCom = __ccgo_ts + 14992 + zAnd = __ccgo_ts + 22015 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178978,22 +181195,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29895, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29921, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29907, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29933, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14967 + zS = __ccgo_ts + 14992 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29916, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29942, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -179019,7 +181237,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29931, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29957, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1650 @@ -179029,14 +181247,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29945, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21981 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29971, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22015 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29957, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29983, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1650 i1 = 0 @@ -179046,11 +181265,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30007, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21981 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30033, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22015 } goto _2 _2: + ; i1++ } } @@ -179069,7 +181289,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30020, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30046, 0) } // C documentation @@ -179111,21 +181331,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30007, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30033, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30046, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30072, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30076, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30102, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } } } goto _1 _1: + ; i++ } } @@ -179173,6 +181394,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) goto _1 _1: + ; i++ } } @@ -179202,16 +181424,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 z = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30113 + zSep = __ccgo_ts + 30139 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16550) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16584) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) } break } @@ -179222,16 +181444,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29533 + v1 = __ccgo_ts + 29559 } else { v1 = __ccgo_ts + 1650 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30126, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14967 + z = _rbuMPrintf(tls, p, __ccgo_ts+30152, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14992 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30137, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30163, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -179277,7 +181499,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30141) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30167) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -179285,7 +181507,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -179294,21 +181516,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30191, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30217, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29533 + v1 = __ccgo_ts + 29559 } else { v1 = __ccgo_ts + 1650 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30213, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14967 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30239, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14992 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30223, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30249, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30238, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30264, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) } } @@ -179345,7 +181567,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1650 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -179354,37 +181576,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1650 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30300 + zPk = __ccgo_ts + 30326 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30313 + v2 = __ccgo_ts + 30339 } else { v2 = __ccgo_ts + 1650 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30323, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14967 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30349, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14992 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30376, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30357 + v3 = __ccgo_ts + 30383 } else { v3 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30372, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30398, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) } } @@ -179410,7 +181633,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30404, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30430, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -179431,6 +181654,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -179455,7 +181679,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc zRet = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30461) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30487) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -179524,6 +181748,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -179538,6 +181763,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -179549,6 +181775,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -179563,6 +181790,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -179578,6 +181806,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -179619,7 +181848,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30527, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30553, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -179636,18 +181865,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30547, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30573, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30612, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30638, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30648, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30674, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -179662,26 +181891,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30682 + v2 = __ccgo_ts + 30708 } else { - v2 = __ccgo_ts + 30686 + v2 = __ccgo_ts + 30712 } v1 = v2 } else { v1 = __ccgo_ts + 1650 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30692, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30718, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30753, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30779, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30682 + v3 = __ccgo_ts + 30708 } else { - v3 = __ccgo_ts + 30686 + v3 = __ccgo_ts + 30712 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30814, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30840, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -179700,8 +181929,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6573) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6569) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6598) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6594) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -179710,39 +181939,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1650 } else { - v4 = __ccgo_ts + 30973 + v4 = __ccgo_ts + 30999 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30982 + v5 = __ccgo_ts + 31008 } else { v5 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30992, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31018, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31028, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31054, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31056 + zRbuRowid = __ccgo_ts + 31082 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31068 + v6 = __ccgo_ts + 31094 } else { v6 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31085, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31161, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31111, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31187, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31460, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31486, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -179753,9 +181982,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31559 + v7 = __ccgo_ts + 31585 } else { - v7 = __ccgo_ts + 31569 + v7 = __ccgo_ts + 31595 } zRbuRowid1 = v7 } @@ -179768,14 +181997,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29616, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29642, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+1650) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31580 + v8 = __ccgo_ts + 31606 } else { v8 = __ccgo_ts + 1650 } @@ -179785,11 +182014,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1650 } if zOrder != 0 { - v10 = __ccgo_ts + 23175 + v10 = __ccgo_ts + 23209 } else { v10 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31586, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31612, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -179846,6 +182075,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { @@ -179856,6 +182086,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -179875,9 +182106,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30973 + zPrefix = __ccgo_ts + 30999 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31634, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31660, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -179951,7 +182182,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31664, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31690, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -180010,27 +182241,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31694, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31720, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31722, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31748, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.Xmemcpy(tls, p+48, __ccgo_ts+3420, uint64(4)) } else { - libc.Xmemcpy(tls, p+48, __ccgo_ts+6562, uint64(4)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+6587, uint64(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31740, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31766, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -180063,10 +182294,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31806, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31832, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24564, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24598, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*int8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -180082,14 +182313,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 31838 + v2 = __ccgo_ts + 31864 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1650 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31840, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31866, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -180100,27 +182331,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31872, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31898, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31887, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31913, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31904, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31930, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31920, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31946, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31948, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31974, 0) } } @@ -180204,7 +182435,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31920, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31946, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -180237,7 +182468,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31966, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31992, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -180370,16 +182601,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -180401,7 +182632,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32001, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32027, 0) } // C documentation @@ -180418,13 +182649,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32026, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32033, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32052, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32059, libc.VaList(bp+8, zMove)) if zWal == uintptr(0) || zOal == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -180556,7 +182787,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24121, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24155, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -180569,6 +182800,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -180647,6 +182879,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -180690,7 +182923,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32040) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32066) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -180703,7 +182936,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32062, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32088, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -180730,7 +182963,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd } pFd = v1 - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32089, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32115, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -180766,9 +182999,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32247, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32273, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32262, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32288, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -180791,9 +183024,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { _, _ = i, zSql *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32282, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32308, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32307) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32333) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -180804,10 +183037,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32415) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32441) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32480) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32506) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -180818,13 +183051,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32524, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32550, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -180851,8 +183085,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17635) - _rbuCopyPragma(tls, p, __ccgo_ts+16746) + _rbuCopyPragma(tls, p, __ccgo_ts+17669) + _rbuCopyPragma(tls, p, __ccgo_ts+16780) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -180860,7 +183094,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32549, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32575, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -180882,10 +183116,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -180972,7 +183206,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32577, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32603, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -180995,10 +183229,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32026, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32052, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } @@ -181020,7 +183254,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { var _ /* zRnd at bp+4 */ [64]int8 _ = pVfs Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32602, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32628, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -181066,7 +183300,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain } db = v1 - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32613, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32639, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -181111,11 +183345,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32685, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32711, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32699) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32725) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -181124,7 +183358,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32756) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32782) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -181204,7 +183438,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32830, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32856, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -181226,17 +183460,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32862 + v3 = __ccgo_ts + 32888 } else { - v3 = __ccgo_ts + 32869 + v3 = __ccgo_ts + 32895 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32876, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32902, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14856, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14881, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -181248,21 +183482,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17349) - _rbuCopyPragma(tls, p, __ccgo_ts+16761) + _rbuCopyPragma(tls, p, __ccgo_ts+17383) + _rbuCopyPragma(tls, p, __ccgo_ts+16795) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32908, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32934, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32924, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32950, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -181340,7 +183574,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32948, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32974, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -181387,7 +183621,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30973, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30999, uint64(8)) == 0 { nDel = int32(8) for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -181397,6 +183631,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -181414,7 +183649,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -181423,7 +183658,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -181433,7 +183668,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32956, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32982, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -181534,7 +183769,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -181547,19 +183782,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14856 + v1 = __ccgo_ts + 14881 } else { - v1 = __ccgo_ts + 32908 + v1 = __ccgo_ts + 32934 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32908, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32934, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -181669,6 +183904,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -181716,6 +183952,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -181728,6 +183965,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -181754,6 +183992,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -181767,6 +184006,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -181799,6 +184039,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -181809,6 +184050,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -181835,6 +184077,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -182117,7 +184360,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32983, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33009, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -182143,7 +184386,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33006, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33032, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -182338,7 +184581,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6562) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6587) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -182352,7 +184595,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33017, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33043, 0) != 0 { oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) } @@ -182905,7 +185148,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12168, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12193, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -182975,16 +185218,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -183052,6 +185296,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -183087,6 +185332,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -183280,17 +185526,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -183380,6 +185629,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -183395,7 +185645,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33028, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33054, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FzPath = v1 if z == uintptr(0) { @@ -183433,8 +185683,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33030 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33039, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33056 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33065, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -183463,7 +185713,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg @@ -183474,7 +185724,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33051, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33077, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -183494,16 +185744,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33059 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33085 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33068 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33094 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33073 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33099 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -183528,6 +185778,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -183600,12 +185851,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33083, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33109, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33238, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33264, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33252, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33278, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -183627,37 +185878,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -183682,7 +185933,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33267, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33293, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -184351,6 +186602,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -187514,6 +189808,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -187595,7 +189890,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -187619,7 +189914,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -187634,7 +189929,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -187649,6 +189944,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -187689,7 +189985,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -187749,6 +190045,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -187793,7 +190090,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -187851,6 +190148,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2)) @@ -187898,7 +190196,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -187908,7 +190206,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -187928,6 +190226,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -187986,7 +190285,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -187994,6 +190293,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -188026,6 +190326,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -188234,6 +190535,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -188354,6 +190656,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -188373,6 +190676,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -188383,6 +190687,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) @@ -188390,7 +190695,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { @@ -188411,6 +190716,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -188557,6 +190863,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -188590,7 +190897,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11559) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11584) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -188599,9 +190906,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.Xmemset(tls, bp+8, 0, uint64(16)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33911, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33937, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33924, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33950, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -188611,17 +190918,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33930, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33956, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14967 + zSep = __ccgo_ts + 14992 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1650 - _sessionAppendStr(tls, bp+8, __ccgo_ts+33935, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33961, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -188630,16 +190938,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { - _sessionAppendStr(tls, bp+8, __ccgo_ts+33943, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33969, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34018, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34044, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21981 + zSep = __ccgo_ts + 22015 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -188683,6 +190992,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -188721,9 +191031,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34024, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34050, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33935, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33961, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -188733,18 +191043,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33930, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33956, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 21981 + zSep = __ccgo_ts + 22015 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34042, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34068, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33506, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33532, bp) zSep = __ccgo_ts + 1650 i = 0 for { @@ -188754,15 +191065,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34018, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34044, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34050 + zSep = __ccgo_ts + 34076 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5083, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5108, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -188788,7 +191100,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6562, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6587, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -188811,34 +191123,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34055, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34081, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+21987, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22021, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+14967, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+14992, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34073, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34099, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34084, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34110, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5083, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5108, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -188861,12 +191175,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11559, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11584, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34088) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34114) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34201) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34227) } return rc } @@ -188932,13 +191246,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -188998,6 +191313,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -189063,6 +191379,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -189263,6 +191580,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -189344,7 +191662,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34345, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34371, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -189357,7 +191675,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34366, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34392, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -189451,10 +191769,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34385, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34411, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34411, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34437, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -189495,7 +191813,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6562, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6587, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -189509,22 +191827,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34441, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34467, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34485, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34511, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34556, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34582, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11559) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11584) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -189581,13 +191900,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34616, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34642, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34646, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34672, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34646, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34696, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34672, uintptr(0), uintptr(0), uintptr(0)) } } if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { @@ -189743,6 +192062,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -189789,6 +192109,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -189915,6 +192236,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -189977,6 +192299,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -189993,6 +192316,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -190004,6 +192328,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -190016,6 +192341,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -190077,6 +192403,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -190110,6 +192437,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -190154,6 +192482,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -190234,14 +192563,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -190472,6 +192804,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -190543,6 +192876,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -190566,6 +192900,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -190623,6 +192958,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -190653,6 +192989,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -191998,23 +194335,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -192146,7 +194483,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34698, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -192329,116 +194666,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) @@ -192469,7 +194836,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34726, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34752, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -192765,7 +195132,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34757, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34783, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -192862,7 +195229,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34764 + zErr = __ccgo_ts + 34790 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -192990,6 +195357,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -193042,6 +195410,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -193106,7 +195475,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34814 + zErr = __ccgo_ts + 34840 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -193187,6 +195556,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -193208,11 +195578,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -193374,6 +195746,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -193438,6 +195811,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -193456,6 +195830,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -193480,15 +195855,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34862, + FzFunc: __ccgo_ts + 34888, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34870, + FzFunc: __ccgo_ts + 34896, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34880, + FzFunc: __ccgo_ts + 34906, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -193501,6 +195876,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -194010,6 +196386,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34892, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34918, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34923, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34949, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -194387,7 +196767,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34956, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34982, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -194397,7 +196777,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34993, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35019, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -194405,7 +196785,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35002, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35028, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -194428,10 +196808,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35035, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35061, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -194442,58 +196823,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35069, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35095, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35077, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35103, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35109, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35135, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35115, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35141, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35134, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35160, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35177, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35203, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35191, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35217, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35229, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35255, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35240, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35266, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5476, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5501, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8195, + FzName: __ccgo_ts + 8220, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17715, + FzName: __ccgo_ts + 17749, }, 2: { - FzName: __ccgo_ts + 35275, + FzName: __ccgo_ts + 35301, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -194501,20 +196882,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35283, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35309, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35314, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35340, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35324, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35350, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35358, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35384, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -194586,15 +196967,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35386) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16662) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35391, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35412) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16696) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35417, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35421) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35447) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35431, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35457, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -194620,7 +197001,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35462, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35488, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -194628,12 +197009,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35467, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35493, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35474, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35500, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } @@ -194689,8 +197071,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35386) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35482, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35412) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35508, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } i = int32(3) @@ -194721,7 +197103,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35511, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35537, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -194746,11 +197128,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35531, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35557, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -194758,7 +197141,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35581, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35607, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -194771,18 +197154,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { zTail = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35069 + zTail = __ccgo_ts + 35095 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35636 + zTail = __ccgo_ts + 35662 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35644, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35670, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16662, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16696, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194817,6 +197200,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -194845,7 +197229,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35655, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35681, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -194854,15 +197238,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 14967 + v2 = __ccgo_ts + 14992 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35671, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35697, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35678, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35386)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35704, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35412)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) @@ -195008,7 +197393,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35704) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35730) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -195019,7 +197404,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35709) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35735) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -195030,7 +197415,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35718) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35744) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -195044,7 +197429,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35728) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35754) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -195055,7 +197440,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35738) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35764) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -195072,7 +197457,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35750) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35776) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -195087,7 +197472,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35386) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35412) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -195102,7 +197487,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35762) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35788) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -195144,7 +197529,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35776 + zSelect = __ccgo_ts + 35802 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -195164,7 +197549,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35808) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35834) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -195176,7 +197561,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35816, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35842, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -195397,17 +197782,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35887, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35913, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35907, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35933, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -195418,16 +197804,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35938, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35964, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35941, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35967, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30682, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30708, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -195531,6 +197918,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -195591,6 +197979,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -195648,6 +198037,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -195695,6 +198085,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -195738,6 +198129,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -195794,6 +198186,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -195822,6 +198215,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -195975,6 +198374,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -196098,6 +198498,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -196126,6 +198527,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -196142,6 +198544,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -196157,6 +198560,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -196164,6 +198568,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -196227,6 +198632,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -196264,6 +198670,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -196289,6 +198696,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -196361,6 +198769,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -196369,11 +198778,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -196420,6 +198831,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -196439,6 +198851,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -196450,6 +198863,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -196552,10 +198966,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -196612,6 +199028,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -196692,6 +199109,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -196722,6 +199140,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -196777,6 +199196,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -196902,6 +199322,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -197031,10 +199452,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -197252,6 +199675,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -197406,6 +199830,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -197414,6 +199839,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -197457,8 +199883,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35945, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34726, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35971, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34752, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -197478,12 +199904,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35950, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35976, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -197532,6 +199959,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -197542,6 +199970,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -197580,6 +200009,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -197608,10 +200038,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20984, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -197717,6 +200148,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -197734,7 +200166,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35979, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36005, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -197791,6 +200223,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -197846,6 +200279,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -197918,17 +200352,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36032 + v2 = __ccgo_ts + 36058 } else { - v2 = __ccgo_ts + 35945 + v2 = __ccgo_ts + 35971 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36039, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36065, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -197937,7 +200372,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36089, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36115, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -198098,6 +200533,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -198138,6 +200574,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -198160,6 +200597,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -198212,10 +200650,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -198245,6 +200685,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -198264,6 +200705,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -198291,6 +200733,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -198305,6 +200748,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -198425,10 +200869,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -198601,10 +201047,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8)) @@ -198624,6 +201072,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -200464,6 +202927,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200572,7 +203036,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36293, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36319, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -200656,7 +203120,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36288, uint64(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36314, uint64(4)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -200689,10 +203153,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -200744,10 +203210,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -200793,6 +203261,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -200809,6 +203278,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -200858,6 +203328,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -200926,6 +203397,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -200957,6 +203429,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -201044,6 +203517,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -201080,6 +203554,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -201596,6 +204071,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -201791,6 +204267,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -201919,6 +204396,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -201955,6 +204433,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -201985,6 +204464,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -204353,6 +206858,7 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int } goto _1 _1: + ; ii++ } } @@ -204401,6 +206907,7 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin } goto _1 _1: + ; iLvl++ } if nBest < nMin { @@ -204533,7 +207040,7 @@ func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int defer tls.Free(32) if iPgno != int32(1) { if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { - _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36539, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36565, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) @@ -204656,6 +207163,7 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } goto _1 _1: + ; pgno++ } _fts5DataRelease(tls, pLeaf) @@ -204845,6 +207353,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) goto _3 _3: + ; iKey++ } /* Set iDelKeyOff to the value of the footer entry to remove from @@ -204912,6 +207421,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } goto _6 _6: + ; iPgno-- } if iPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { @@ -205306,6 +207816,7 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint } goto _1 _1: + ; i++ } nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) @@ -205342,10 +207853,12 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint iSegOut++ goto _4 _4: + ; iSeg++ } goto _3 _3: + ; iLvl-- } v5 = nSeg @@ -205383,6 +207896,7 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iLvl++ } for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { @@ -205659,6 +208173,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -205759,6 +208274,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -205831,6 +208347,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -205873,6 +208390,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -205885,11 +208403,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -205898,6 +208418,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } i = 0 @@ -205916,10 +208437,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -206034,11 +208557,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36600, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36626, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25717, __ccgo_ts+36608, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25743, __ccgo_ts+36634, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11770, __ccgo_ts+36643, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11795, __ccgo_ts+36669, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -206115,6 +208638,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -206176,6 +208700,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -206297,6 +208822,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -206381,6 +208907,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -206420,6 +208947,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -206461,6 +208989,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -206494,9 +209023,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -206504,16 +209034,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -206562,7 +209095,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36687) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36713) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -206621,10 +209154,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -206650,6 +209185,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -206677,11 +209213,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -206757,6 +209295,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -206974,6 +209513,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -207026,6 +209566,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -207074,7 +209615,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Binary representation of iNew */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36142, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36168, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -207214,6 +209755,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -207267,6 +209809,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -207278,6 +209821,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -207376,6 +209920,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -207463,6 +210008,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -207506,10 +210052,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -207546,6 +210094,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -207895,6 +210449,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -208473,7 +211028,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) bSeenMatch = 0 bSeenRank = 0 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36780, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36806, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -208512,7 +211067,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5115, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5140, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) } } @@ -208532,7 +211087,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5115, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5140, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -208552,6 +211107,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -208591,6 +211147,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -208669,6 +211226,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -208766,6 +211324,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -208799,6 +211358,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -208840,6 +211400,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -208870,6 +211431,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -209025,7 +211587,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14967 + v1 = __ccgo_ts + 14992 } else { v1 = __ccgo_ts + 1650 } @@ -209035,11 +211597,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1650 } if bDesc != 0 { - v3 = __ccgo_ts + 36819 + v3 = __ccgo_ts + 36845 } else { - v3 = __ccgo_ts + 36824 + v3 = __ccgo_ts + 36850 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36828, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36854, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr @@ -209093,17 +211655,18 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36883, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36909, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5458, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5483, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36889, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36915, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -209130,6 +211693,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -209152,7 +211716,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36917, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36943, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) @@ -209171,6 +211735,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } @@ -209184,7 +211749,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36927, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36953, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -209218,7 +211783,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36948, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36974, libc.VaList(bp+24, z)) } } } else { @@ -209226,7 +211791,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34880 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34906 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -209277,7 +211842,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36780, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36806, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -209353,6 +211918,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -209420,7 +211986,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36981, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37007, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -209445,6 +212011,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -209600,36 +212167,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37017, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37043, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37028, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37054, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37108, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37134, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37116, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37142, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17329, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17363, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37172, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37198, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37178, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37204, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37194, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37220, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -209727,9 +212294,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17849, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17883, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37200, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37226, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -209758,11 +212325,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 20837 + v1 = __ccgo_ts + 20871 } else { - v1 = __ccgo_ts + 37259 + v1 = __ccgo_ts + 37285 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37271, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37297, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -209813,7 +212380,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -209982,6 +212549,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -210052,6 +212620,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -210067,6 +212636,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -210194,6 +212764,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -210212,6 +212783,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -210228,6 +212800,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -210265,6 +212838,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -210304,6 +212878,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -210558,6 +213133,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -210584,6 +213160,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -210599,7 +213176,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37308, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37334, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -210666,9 +213243,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -210676,10 +213255,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -210690,10 +213271,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -210704,6 +213287,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -210716,12 +213300,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -210780,7 +213367,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37329, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37355, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -210978,6 +213565,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -211021,7 +213609,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr pMod = _fts5LocateTokenizer(tls, pGlobal, v1) if pMod == uintptr(0) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37400, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37426, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -211037,7 +213625,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37422, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37448, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -211066,6 +213654,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -211080,6 +213669,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -211090,7 +213680,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37453) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37479) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -211104,7 +213694,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37466, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37492, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -211126,17 +213716,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37557, - 1: __ccgo_ts + 35069, - 2: __ccgo_ts + 25717, - 3: __ccgo_ts + 35636, - 4: __ccgo_ts + 11770, + 0: __ccgo_ts + 37583, + 1: __ccgo_ts + 35095, + 2: __ccgo_ts + 25743, + 3: __ccgo_ts + 35662, + 4: __ccgo_ts + 11795, } // C documentation @@ -211156,10 +213747,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37564, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37590, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37610, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37636, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -211182,7 +213773,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37673, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37699, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -211199,10 +213790,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37673, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37699, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37678, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37704, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -211305,17 +213896,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, ** statements to operate on it. */ if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37693, - 1: __ccgo_ts + 37761, - 2: __ccgo_ts + 37830, - 3: __ccgo_ts + 37863, - 4: __ccgo_ts + 37902, - 5: __ccgo_ts + 37942, - 6: __ccgo_ts + 37981, - 7: __ccgo_ts + 38024, - 8: __ccgo_ts + 38063, - 9: __ccgo_ts + 38107, - 10: __ccgo_ts + 38147, + 0: __ccgo_ts + 37719, + 1: __ccgo_ts + 37787, + 2: __ccgo_ts + 37856, + 3: __ccgo_ts + 37889, + 4: __ccgo_ts + 37928, + 5: __ccgo_ts + 37968, + 6: __ccgo_ts + 38007, + 7: __ccgo_ts + 38050, + 8: __ccgo_ts + 38089, + 9: __ccgo_ts + 38133, + 10: __ccgo_ts + 38173, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -211343,6 +213934,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = int8(',') goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = int8('\000') @@ -211351,14 +213943,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38170 + v2 = __ccgo_ts + 38196 } else { v2 = __ccgo_ts + 1650 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38173 + v3 = __ccgo_ts + 38199 } else { v3 = __ccgo_ts + 1650 } @@ -211416,12 +214008,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38181, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38207, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38285, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38311, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38323, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38349, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -211430,7 +214022,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38361, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38387, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -211442,14 +214034,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25717, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11770, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37557, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25743, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11795, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37583, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35636, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35662, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35069, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35095, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -211469,13 +214061,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30357 + v1 = __ccgo_ts + 30383 } else { v1 = __ccgo_ts + 1650 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38403, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38429, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38433, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38459, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -211516,35 +214108,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38477, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38503, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38500, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38526, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35069, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35095, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38506 + zCols = __ccgo_ts + 38532 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38538 + zCols = __ccgo_ts + 38564 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35636, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35662, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37557, __ccgo_ts+38586, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37583, __ccgo_ts+38612, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -211573,6 +214166,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -211673,6 +214267,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -211811,6 +214406,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -211883,9 +214479,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38603, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38629, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38653, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38679, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -211893,7 +214489,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -211940,6 +214536,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -212037,6 +214634,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -212085,6 +214683,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -212104,7 +214703,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38682, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38708, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -212202,6 +214801,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -212278,6 +214878,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -212304,6 +214905,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -212311,14 +214913,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35069, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35095, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -213211,15 +215829,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -213281,7 +215904,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38774 + zBase = __ccgo_ts + 38800 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -213372,6 +215995,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -213387,6 +216011,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -213445,6 +216070,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38784, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38810, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38787, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38813, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38792, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38818, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38797, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38823, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38800, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38803, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38829, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38808, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38813, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38839, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38817, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38843, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38823, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38828, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38854, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -213558,49 +216185,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38832, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38858, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38836, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38862, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38839, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38865, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38843, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38869, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38847, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38873, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38851, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38877, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38855, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38881, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38859, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38885, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -213617,20 +216244,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38863, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38843, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38889, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38866, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38869, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38892, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38873, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38859, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -213646,75 +216273,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38876, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38902, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38884, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38910, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38891, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38917, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38896, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38922, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38792, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38818, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38901, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38927, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38787, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38813, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38906, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38932, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38859, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38911, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38937, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15875, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15909, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38916, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38942, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38869, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38920, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38946, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38925, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38951, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38828, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38854, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38931, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38957, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38935, uint64(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38961, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38937, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38963, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38851, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38877, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -213723,48 +216350,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38943, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38969, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38859, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38951, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38977, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38957, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38983, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38962, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38988, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38968, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38855, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38881, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38976, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39002, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38984, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39010, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38988, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39014, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38851, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38877, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -213772,21 +216399,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38996, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39022, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39002, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39028, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38855, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38881, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39008, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39034, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38869, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -213804,48 +216431,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39015, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39020, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39046, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39025, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39051, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39031, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38984, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39010, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39037, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39063, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39043, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39069, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -213861,13 +216488,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39049, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39075, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39053, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39079, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39056, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39082, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -213875,7 +216502,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39059, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39085, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -213961,6 +216588,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -214034,14 +216662,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39063) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39089) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38756) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38782) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('2') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -214058,6 +216686,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -214162,6 +216791,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -214313,7 +216943,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38774, + FzName: __ccgo_ts + 38800, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -214321,7 +216951,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39078, + FzName: __ccgo_ts + 39104, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -214329,7 +216959,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39084, + FzName: __ccgo_ts + 39110, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -214337,7 +216967,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39091, + FzName: __ccgo_ts + 39117, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -214357,6 +216987,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -219401,6 +222032,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -219687,6 +222319,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -219709,6 +222342,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -219867,16 +222501,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39099) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39125) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39103) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39129) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39107) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39133) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39116, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39142, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -219945,15 +222579,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39150, - 1: __ccgo_ts + 39190, - 2: __ccgo_ts + 39225, + 0: __ccgo_ts + 39176, + 1: __ccgo_ts + 39216, + 2: __ccgo_ts + 39251, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23710, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23744, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39268, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39294, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -220065,6 +222699,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -220122,10 +222757,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39301, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39327, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39332, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39358, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } @@ -220144,7 +222779,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39383, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39409, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -220290,6 +222925,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -220385,6 +223021,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -220568,7 +223205,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39409, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39435, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -220621,7 +223258,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39419 + return __ccgo_ts + 39445 } type TAggInfo_col = struct { @@ -220903,11 +223540,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-16.0.6\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-16.0.6\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go index 2d22676c..a500656c 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go @@ -1,4 +1,4 @@ -// Code generated for freebsd/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -ltcl8.6 -eval-all-macros', DO NOT EDIT. +// Code generated for freebsd/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -ltcl8.6 -eval-all-macros', DO NOT EDIT. //go:build freebsd && arm64 // +build freebsd,arm64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -795,6 +797,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NETGRAPHDISC = 6 const NFDBITS = 0 @@ -1485,6 +1488,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -1939,10 +1943,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2017,7 +2018,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2125,8 +2126,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2480,6 +2481,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2609,7 +2611,6 @@ const YY_REDUCE_MIN = -271 const YY_SHIFT_COUNT = 578 const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 -const _BIG_ENDIAN = 4321 const _BYTE_ORDER = 1234 const _CS_PATH = 1 const _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 @@ -2631,7 +2632,6 @@ const _IOLBF = 1 const _IONBF = 2 const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 -const _LITTLE_ENDIAN = 1234 const _LP64 = 1 const _MADV_DONTNEED = 4 const _MADV_NORMAL = 0 @@ -8102,6 +8102,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -9665,6 +9666,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -10370,6 +10375,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -12904,7 +12910,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13051,6 +13057,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13063,7 +13070,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -13088,6 +13095,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -13098,11 +13106,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -13117,7 +13127,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart @@ -13129,6 +13139,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -13162,6 +13173,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -13352,6 +13364,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -13419,6 +13432,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zDate))])&int32(0x01) != 0 { zDate++ } @@ -14102,6 +14116,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -14119,6 +14134,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1271, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -14229,6 +14251,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -14339,7 +14362,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { @@ -14352,7 +14375,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = uint8(0) *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 8)) += y @@ -14367,6 +14390,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -14420,6 +14444,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -14686,7 +14711,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*uint8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -14712,7 +14737,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -14728,9 +14753,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1342 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = uint8(0) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -14749,7 +14774,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -14780,7 +14805,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1337, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1411, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = uint8(int32(uint8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -14798,6 +14823,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -15408,6 +15434,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -17138,6 +17165,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -17694,6 +17722,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -17719,6 +17748,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -17778,11 +17808,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -17891,6 +17925,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -17912,14 +17947,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -17935,6 +17974,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -18067,6 +18109,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -18088,6 +18131,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v70)) = uint8('0') goto _69 _69: + ; precision-- e2++ } @@ -18175,6 +18219,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*uint8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -18192,6 +18237,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -18200,11 +18246,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]uint8)(unsafe.Pointer(bp)))[0] = uint8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -18281,7 +18329,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -18335,6 +18385,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -18342,6 +18393,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -18354,9 +18406,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -18404,6 +18459,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -18443,6 +18499,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -18454,6 +18511,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -18477,6 +18535,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -18508,8 +18567,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -18536,6 +18597,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -19395,6 +19457,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -19405,6 +19468,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -20068,6 +20132,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -20265,6 +20330,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -21117,6 +21204,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*uint8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*uint8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -21167,6 +21255,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -21202,6 +21291,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -21649,6 +21743,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -21709,6 +21804,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -21731,6 +21827,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -21952,6 +22049,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { } goto _1 _1: + ; i++ } return i @@ -22008,6 +22106,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*uint8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = uint8(int32(_sqlite3HexToInt(tls, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -25661,6 +25769,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -25678,7 +25787,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3512, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3512, bp, int32(41778)) } // C documentation @@ -25715,7 +25824,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -26319,7 +26430,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -26748,6 +26863,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -26765,6 +26881,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -26821,6 +26938,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -26914,7 +27032,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -27285,7 +27403,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -27304,7 +27422,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -27458,6 +27576,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -27713,7 +27832,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3395, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3395, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -27764,6 +27883,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -27788,7 +27908,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__error(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+224, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(1026)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3584, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3584, zIn, int32(44691)) return } (*(*[1026]uint8)(unsafe.Pointer(bp + 224)))[got] = uint8(0) @@ -27953,6 +28073,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*uint8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -27985,14 +28106,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*uint8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(1026)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3413, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3413, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*uint8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = uint8(0) if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -29828,6 +29963,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -29835,6 +29971,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -29891,6 +30028,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -29916,6 +30054,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -30059,10 +30198,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -30419,6 +30560,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -30430,6 +30572,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -30617,6 +30760,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -30639,6 +30783,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -30697,6 +30842,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -30804,6 +30950,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -30830,6 +30977,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -30851,6 +30999,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -30958,6 +31107,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -31374,6 +31524,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -31630,6 +31781,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -31679,6 +31831,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -32492,6 +32645,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -32646,6 +32800,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -32668,6 +32823,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -32773,6 +32929,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -32865,6 +33022,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -32906,6 +33064,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -33810,12 +33969,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -34022,6 +34183,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -34168,6 +34330,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -34242,6 +34405,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -34409,6 +34573,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -34500,6 +34665,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -34534,6 +34700,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -35293,6 +35460,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -35613,11 +35781,13 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -35658,7 +35828,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -39746,7 +39931,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4086, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4111, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -41133,6 +41318,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -41186,10 +41372,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -41273,7 +41460,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -41338,6 +41525,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -41362,11 +41550,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -41399,6 +41589,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -41407,10 +41598,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< 0 { @@ -43926,7 +44139,7 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, /* Copy data from the log to the database file. */ if rc == SQLITE_OK { if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { - rc = _sqlite3CorruptError(tls, int32(68842)) + rc = _sqlite3CorruptError(tls, int32(68912)) } else { rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) } @@ -44999,6 +45212,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } _lockBtreeMutex(tls, p) @@ -45012,6 +45226,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } } @@ -45063,6 +45278,7 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) @@ -45089,6 +45305,7 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } } @@ -45256,6 +45473,7 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } return SQLITE_OK @@ -45303,6 +45521,7 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } /* If the above search did not find a BtLock struct associating Btree p @@ -45396,6 +45615,7 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) goto _2 _2: + ; pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext } } @@ -45432,6 +45652,7 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -45468,6 +45689,7 @@ func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, i } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -45569,6 +45791,7 @@ func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) goto _1 _1: + ; i++ } _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -45684,6 +45907,7 @@ func _saveAllCursors(tls *libc.TLS, pBt uintptr, iRoot TPgno, pExcept uintptr) ( } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -45752,7 +45976,7 @@ func _btreeMoveto(tls *libc.TLS, pCur uintptr, pKey uintptr, nKey Ti64, bias int } _sqlite3VdbeRecordUnpack(tls, pKeyInfo, int32(nKey), pKey, pIdxKey) if int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) == 0 || int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) > int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -45930,7 +46154,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } /* The super-journal page number must never be used as a pointer map page */ if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -45943,12 +46167,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -45962,6 +46186,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -45990,7 +46215,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) if pPgno != 0 { @@ -45998,7 +46223,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -46418,7 +46643,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -46458,12 +46683,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -46471,21 +46696,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -46507,6 +46732,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -46531,25 +46757,27 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) @@ -46609,7 +46837,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -46626,14 +46854,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -46676,11 +46904,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -46694,7 +46922,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -46777,12 +47005,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none @@ -46793,11 +47021,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -46818,7 +47046,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -46835,10 +47063,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -46899,7 +47127,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -46925,7 +47153,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -46964,12 +47192,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -46996,7 +47224,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -47027,14 +47255,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))< iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -47059,7 +47288,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) @@ -47072,7 +47301,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -47225,7 +47454,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _, _ = pPage, rc if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -47287,7 +47516,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -47375,7 +47604,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4167) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4192) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ @@ -47451,6 +47680,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -47459,6 +47689,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -47592,11 +47823,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -48156,7 +48389,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4176, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4201, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -48194,7 +48427,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -48249,6 +48482,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -48413,6 +48647,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -48516,6 +48751,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -48594,6 +48830,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -48629,7 +48866,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -48653,7 +48890,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -48662,7 +48899,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -48671,11 +48908,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -48705,7 +48943,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -48801,7 +49039,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -48839,7 +49077,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) @@ -48906,7 +49144,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -48949,7 +49187,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -48964,6 +49202,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -48978,7 +49217,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -48991,6 +49230,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -49227,6 +49467,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -49442,7 +49683,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo /* Assert that the caller has opened the required transaction. */ if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { iTable = uint32(0) @@ -49471,6 +49712,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -49833,7 +50075,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ pBufStart = pBuf /* Start of original out buffer */ if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _getCellInfo(tls, pCur) aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload @@ -49843,7 +50085,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -49895,7 +50137,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) if offset >= ovflSize { @@ -49969,7 +50211,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -50104,7 +50346,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { var v3, p1 uintptr _, _, _, _ = rc, v2, v3, p1 if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -50116,7 +50358,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -50232,9 +50474,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** in such a way that page pRoot is linked into a second b-tree table ** (or the freelist). */ if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -50244,7 +50487,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -50478,7 +50721,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -50522,6 +50765,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -50536,6 +50780,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -50610,6 +50855,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -50677,7 +50923,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -50692,6 +50938,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -50738,7 +50985,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -50769,7 +51016,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -50802,7 +51049,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -50811,7 +51058,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -50826,6 +51073,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) return rc } @@ -50876,6 +51124,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -50937,7 +51186,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -51047,7 +51296,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -51135,7 +51384,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -51190,7 +51439,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -51216,7 +51465,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -51243,7 +51492,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -51288,6 +51537,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -51304,6 +51554,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -51312,7 +51563,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -51413,6 +51664,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } } end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) return rc @@ -51448,7 +51700,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in iTrunk = uint32(0) /* Page number of free-list trunk page */ pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -51499,7 +51751,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -51508,7 +51760,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in } nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -51564,6 +51816,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -51596,7 +51849,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -51614,7 +51867,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -51637,7 +51890,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -51722,6 +51975,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n libc.Xmemcpy(tls, pPayload, pSrc, uint64(nSrc)) @@ -51857,7 +52111,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -52241,6 +52495,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -52250,12 +52505,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -52263,7 +52518,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint64(sz)) i++ @@ -52337,6 +52592,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -52357,7 +52613,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr ** database. But they might for a corrupt database. Hence use memmove() ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) @@ -52428,6 +52684,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -52440,6 +52697,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -52455,6 +52713,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -52465,6 +52724,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -52501,7 +52761,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2))) nCell -= nShift @@ -52552,6 +52812,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -52567,9 +52828,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -52614,7 +52876,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _, _, _, _, _, _, _ = pBt, pOut, pStop, v1, v2, v3, v4 pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt /* Page number of pNew */ if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ /* Allocate a new page. This page will become the right-sibling of ** pPage. Make the parent page writable, so that the new divider cell @@ -52975,7 +53237,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -52998,7 +53260,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -53012,6 +53274,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -53024,6 +53287,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } @@ -53060,6 +53324,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -53106,11 +53371,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -53124,7 +53391,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -53167,12 +53434,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -53225,11 +53493,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -53256,7 +53525,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -53285,6 +53554,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -53307,6 +53577,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno goto _19 _19: + ; i++ } i = 0 @@ -53325,6 +53596,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -53346,6 +53618,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) @@ -53427,6 +53700,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -53476,11 +53750,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -53489,6 +53764,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -53556,6 +53832,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -53592,6 +53869,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -53606,12 +53884,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -53621,6 +53901,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -53631,6 +53912,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -53718,10 +54000,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -53790,7 +54073,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -53879,6 +54162,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -53948,7 +54232,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -53979,7 +54263,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -54064,7 +54348,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -54156,7 +54440,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -54170,6 +54454,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -54191,7 +54476,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -54221,10 +54506,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -54240,7 +54525,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { } } @@ -54267,7 +54552,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s */ if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -54290,6 +54575,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -54340,7 +54626,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -54362,7 +54648,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -54462,21 +54748,21 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&(int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx))))< _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -54721,7 +55007,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -54802,14 +55088,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int var _ /* rc at bp+8 */ int32 _, _, _, _ = hdr, i, pCell, v2 if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -54836,6 +55122,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -54860,6 +55147,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -54943,7 +55231,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -55208,7 +55496,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4180, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4205, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -55256,11 +55544,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4182, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4207, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4205, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4230, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -55286,11 +55574,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4335, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4360, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -55342,6 +55630,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -55361,11 +55650,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4374 + v2 = __ccgo_ts + 4399 } else { - v2 = __ccgo_ts + 4379 + v2 = __ccgo_ts + 4404 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4400, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4425, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -55501,12 +55790,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4426 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4451 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4444, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4469, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4598, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4623, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4628, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4653, 0) doCoverageCheck = 0 goto _4 } @@ -55588,7 +55877,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4652, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4677, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -55611,7 +55900,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4676, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4701, 0) depth = d2 } } else { @@ -55620,6 +55909,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -55643,6 +55933,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4701, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4726, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -55700,10 +55991,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4738, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4763, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -55789,7 +56081,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4790 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4815 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -55808,15 +56100,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4801, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4826, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4846, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4871, 0) } } } @@ -55836,6 +56129,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -58805,16 +59115,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -58852,6 +59163,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -59238,10 +59550,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -59397,6 +59711,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -59520,6 +59835,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -59615,6 +59931,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -59716,6 +60033,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -60115,7 +60433,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5058, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5083, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -60128,38 +60446,39 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1650 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5063) == 0 { - zColl = __ccgo_ts + 5070 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5088) == 0 { + zColl = __ccgo_ts + 5095 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5051 + v3 = __ccgo_ts + 5076 } else { v3 = __ccgo_ts + 1650 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5072 + v4 = __ccgo_ts + 5097 } else { v4 = __ccgo_ts + 1650 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5075, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5100, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5099, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5124, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5108, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5108, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1406, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5115, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5140, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1373, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -60176,14 +60495,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { zP4 = __ccgo_ts + 1651 } else { - zP4 = __ccgo_ts + 5118 + zP4 = __ccgo_ts + 5143 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5125, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5150, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -60198,14 +60517,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5133, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5158, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5138, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5163, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5140 + zP4 = __ccgo_ts + 5165 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -60221,10 +60541,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5085, - 1: __ccgo_ts + 5087, - 2: __ccgo_ts + 5089, - 3: __ccgo_ts + 5094, + 0: __ccgo_ts + 5110, + 1: __ccgo_ts + 5112, + 2: __ccgo_ts + 5114, + 3: __ccgo_ts + 5119, } // C documentation @@ -60287,6 +60607,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60313,6 +60634,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60352,6 +60674,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -60384,6 +60707,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -60417,6 +60741,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -60483,6 +60808,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -60510,6 +60836,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -60531,6 +60858,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -60586,6 +60914,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -60917,6 +61246,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -60969,6 +61299,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -61096,6 +61427,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -61129,6 +61461,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -61147,6 +61480,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -61161,7 +61495,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5148, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5173, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -61169,18 +61503,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5160, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5185, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5174, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5199, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5189, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5214, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) @@ -61221,6 +61555,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -61257,6 +61592,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -61293,6 +61629,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -61359,6 +61696,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -61407,7 +61745,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -62715,7 +63074,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -62748,16 +63107,21 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -62780,7 +63144,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -62815,7 +63179,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -62840,7 +63204,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } } } } @@ -62866,7 +63233,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -62907,18 +63274,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -63145,8 +63513,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -63177,7 +63546,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -63241,6 +63610,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -63327,15 +63697,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5232 + zContext = __ccgo_ts + 5257 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5251 + zContext = __ccgo_ts + 5276 } else { - zContext = __ccgo_ts + 5270 + zContext = __ccgo_ts + 5295 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5279, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5304, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -63388,6 +63758,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -63452,6 +63823,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -63507,7 +63879,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5315, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5340, 0) return int32(1) } else { return 0 @@ -63517,7 +63889,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5360, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5385, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -63575,7 +63947,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -63642,6 +64014,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { @@ -64077,7 +64450,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5400, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5425, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -64133,6 +64506,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -64156,6 +64530,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -64252,6 +64627,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask @@ -64273,7 +64649,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -64403,7 +64779,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -64566,6 +64942,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -64601,6 +64978,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -64624,6 +65002,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -64859,18 +65238,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5423, - 1: __ccgo_ts + 5428, - 2: __ccgo_ts + 5435, - 3: __ccgo_ts + 5438, - 4: __ccgo_ts + 5441, - 5: __ccgo_ts + 5444, - 6: __ccgo_ts + 5447, - 7: __ccgo_ts + 5450, - 8: __ccgo_ts + 5458, - 9: __ccgo_ts + 5461, - 10: __ccgo_ts + 5468, - 11: __ccgo_ts + 5476, + 0: __ccgo_ts + 5448, + 1: __ccgo_ts + 5453, + 2: __ccgo_ts + 5460, + 3: __ccgo_ts + 5463, + 4: __ccgo_ts + 5466, + 5: __ccgo_ts + 5469, + 6: __ccgo_ts + 5472, + 7: __ccgo_ts + 5475, + 8: __ccgo_ts + 5483, + 9: __ccgo_ts + 5486, + 10: __ccgo_ts + 5493, + 11: __ccgo_ts + 5501, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -65005,6 +65384,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -65112,14 +65492,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5483, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5508, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -65407,6 +65787,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -65682,7 +66063,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -65729,6 +66110,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -65810,7 +66192,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -65877,6 +66259,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -65982,7 +66365,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5523, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5548, int32(3)) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } } else { @@ -66020,7 +66403,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1406, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5044, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5069, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -66035,27 +66418,28 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5527, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5552, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5534, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5559, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5547, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5572, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5550, libc.VaList(bp+104, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5575, libc.VaList(bp+104, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5555, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5580, int32(1)) } } } @@ -66558,6 +66942,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -66666,19 +67051,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity uint8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -66725,7 +67110,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -67195,8 +67580,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -67209,6 +67596,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadPInt32(db+432) != 0 { goto abort_due_to_interrupt } @@ -67232,7 +67620,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) *(*Ti64)(unsafe.Pointer(pIn1)) = int64(int32((int64(pOp) - int64(aOp)) / 24)) @@ -67259,7 +67648,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -67281,7 +67671,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp3 - int32(1)) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) @@ -67291,7 +67682,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: - ; /* There are never any jumps to instruction 0 */ + ; + /* There are never any jumps to instruction 0 */ /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 goto _187 @@ -67304,6 +67696,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pCaller = aOp + uintptr(*(*Ti64)(unsafe.Pointer(pIn1)))*24 pOp = aOp + uintptr((*TVdbeOp)(unsafe.Pointer(pCaller)).Fp2-int32(1))*24 @@ -67323,6 +67716,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) pcDest = int32(*(*Ti64)(unsafe.Pointer(pIn1))) @@ -67337,7 +67731,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -67374,6 +67769,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -67401,15 +67797,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8((*TOp)(unsafe.Pointer(pOp)).Fp2) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5591, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5616, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5612, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5637, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3797, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = int32((int64(pOp) - int64(aOp)) / 24) - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5619, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5644, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) if rc == int32(SQLITE_BUSY) { @@ -67428,7 +67824,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -67438,7 +67835,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) goto _187 @@ -67448,7 +67846,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) *(*float64)(unsafe.Pointer(pOut)) = *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -67461,7 +67860,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) if int32(encoding) != int32(SQLITE_UTF8) { @@ -67499,7 +67899,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) (*TMem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -67541,7 +67942,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { @@ -67570,6 +67973,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) goto _187 @@ -67580,7 +67984,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { _sqlite3VdbeMemSetZeroBlob(tls, pOut, (*TOp)(unsafe.Pointer(pOp)).Fp1) @@ -67600,7 +68005,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 if _sqlite3VdbeMemTooBig(tls, pVar) != 0 { goto too_big @@ -67624,7 +68030,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -67639,6 +68046,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 56 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -67660,6 +68068,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -67694,7 +68103,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) @@ -67707,7 +68117,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetInt64(tls, pOut, *(*Ti64)(unsafe.Pointer(pIn1))) @@ -67724,6 +68135,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -67740,6 +68152,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + uint32(2) | uint32(1) (*TVdbe)(unsafe.Pointer(p)).FpResultRow = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -67764,7 +68177,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -67862,11 +68276,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -67876,6 +68295,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -67913,18 +68333,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -67958,9 +68381,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -67979,6 +68405,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) } @@ -68013,10 +68440,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -68078,7 +68509,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -68090,7 +68522,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, uint8(SQLITE_AFF_NUMERIC), encoding) @@ -68114,7 +68547,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -68135,7 +68569,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) @@ -68243,12 +68678,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -68319,16 +68760,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -68369,7 +68820,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ if iCompare == 0 { goto jump_to_p2 } @@ -68386,6 +68838,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; goto _187 /* Opcode: Compare P1 P2 P3 P4 P5 ** Synopsis: r[P1@P3] <-> r[P2@P3] @@ -68409,7 +68862,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -68425,11 +68879,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) @@ -68442,8 +68896,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } goto _187 @@ -68455,7 +68910,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ if iCompare < 0 { pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 } else { @@ -68486,8 +68942,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -68523,7 +68981,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) goto _187 /* Opcode: Not P1 P2 * * * @@ -68533,7 +68992,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -68549,7 +69009,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -68575,14 +69036,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -68597,6 +69059,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -68609,6 +69072,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -68619,7 +69083,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -68657,6 +69122,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { @@ -68687,7 +69153,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -68699,7 +69166,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -68716,6 +69184,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) @@ -68737,7 +69206,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { @@ -68778,10 +69248,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { @@ -68789,9 +69261,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* For the special case of as pseudo-cursor, the seekResult field ** identifies the register that holds the record */ pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -68801,11 +69273,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -68828,9 +69300,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -68886,13 +69358,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -68907,16 +69379,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -68925,8 +69398,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -68949,10 +69422,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -68966,10 +69441,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -68985,9 +69462,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -69008,9 +69485,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -69039,13 +69516,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -69075,6 +69554,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -69085,11 +69565,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) @@ -69116,16 +69596,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -69138,13 +69618,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5643, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5668, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -69213,7 +69696,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -69230,8 +69714,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) pData0 = aMem + uintptr(nField)*56 @@ -69246,10 +69730,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*uint8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*uint8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*uint8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 @@ -69336,10 +69820,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -69418,16 +69902,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -69439,9 +69923,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -69483,9 +69967,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) @@ -69515,6 +69999,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) @@ -69536,6 +70021,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -69546,7 +70032,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5684, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5709, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -69588,19 +70074,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5735, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5760, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5757, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5782, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -69609,18 +70096,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -69642,8 +70129,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -69658,8 +70146,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -69720,6 +70209,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 /* At least this one VM is active */ @@ -69732,13 +70222,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5811, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5836, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -69748,9 +70238,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -69762,16 +70252,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 5866 + v250 = __ccgo_ts + 5891 } else { if iRollback != 0 { - v249 = __ccgo_ts + 5914 + v251 = __ccgo_ts + 5939 } else { - v249 = __ccgo_ts + 5957 + v251 = __ccgo_ts + 5982 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -69811,6 +70301,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 104)) = 0 if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(libc.Uint64FromInt32(SQLITE_QueryOnly)|uint64(libc.Int32FromInt32(0x00002))<>0)) == int32(1) { rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)< 0 { /* Make register reg[P3] into a value that can be used as the data ** form sqlite3BtreeInsert() where the length of the data is zero. */ @@ -70191,11 +70691,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) @@ -70229,6 +70729,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) if pCx2 == uintptr(0) { goto no_mem @@ -70247,11 +70748,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -70272,6 +70774,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) if pCx3 == uintptr(0) { goto no_mem @@ -70290,7 +70793,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) goto _187 @@ -70384,10 +70888,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) eqOnly = 0 @@ -70466,11 +70974,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) @@ -70516,6 +71024,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 } else { @@ -70593,6 +71102,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first ** opcode past the OP_SeekGE itself. */ @@ -70606,29 +71116,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -70641,8 +71154,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -70659,6 +71173,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -70675,6 +71190,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { goto jump_to_p2_and_check_for_interrupt @@ -70771,14 +71287,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } /* Fall through into OP_NotFound */ - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) @@ -70790,11 +71310,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { /* Composite key generated by OP_MakeRecord */ if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 if rc != 0 { goto no_mem } @@ -70834,8 +71354,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -70892,6 +71413,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -70914,10 +71436,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto notExistsWithKey } /* Fall through into OP_NotExists */ - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) *(*int32)(unsafe.Pointer(bp + 248)) = 0 @@ -70929,7 +71453,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -70946,12 +71470,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -70968,7 +71493,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -71014,8 +71540,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -71047,15 +71574,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -71109,7 +71637,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -71143,11 +71672,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -71164,11 +71693,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if pTab1 != 0 { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -71182,15 +71711,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -71237,6 +71767,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) /* If the update-hook or pre-update-hook will be invoked, set zDb to @@ -71257,11 +71788,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Invoke the pre-update-hook if required. */ if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -71290,6 +71821,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -71309,6 +71841,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -71334,6 +71867,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) @@ -71371,6 +71905,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) @@ -71407,6 +71942,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { @@ -71449,6 +71985,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { /* If the cursor is not already open, create a special kind of @@ -71490,8 +72027,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) *(*int32)(unsafe.Pointer(bp + 392)) = 0 @@ -71520,6 +72059,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) @@ -71557,8 +72097,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Fall through into OP_Rewind */ /* Opcode: Rewind P1 P2 * * * @@ -71577,6 +72119,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { @@ -71652,17 +72195,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -71704,17 +72251,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ } if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -71723,11 +72271,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { goto abort_due_to_error @@ -71741,14 +72289,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -71773,6 +72322,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo @@ -71790,7 +72340,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -71986,6 +72543,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { @@ -72026,6 +72584,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -72047,6 +72606,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) @@ -72067,6 +72627,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 @@ -72083,6 +72644,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -72114,6 +72676,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -72126,13 +72689,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6043 + zSchema = __ccgo_ts + 6068 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6057, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6082, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -72147,7 +72710,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -72168,6 +72731,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { goto abort_due_to_error @@ -72182,6 +72746,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -72193,6 +72758,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -72204,6 +72770,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -72225,7 +72792,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -72252,7 +72820,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { @@ -72271,6 +72840,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { /* The boolean index is empty */ @@ -72305,6 +72875,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -72341,7 +72912,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 /* If the p5 flag is clear, then recursive invocation of triggers is @@ -72362,8 +72934,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -72372,7 +72945,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6100, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6125, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -72418,8 +72991,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { @@ -72434,17 +73008,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -72461,6 +73035,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -72475,6 +73050,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -72497,7 +73073,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -72520,14 +73097,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -72551,7 +73130,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) @@ -72577,18 +73157,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -72609,7 +73190,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -72624,7 +73206,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6137 + v286 = __ccgo_ts + 6162 } else { - v284 = __ccgo_ts + 6142 + v286 = __ccgo_ts + 6167 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6149, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6174, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -72881,11 +73473,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -72912,12 +73504,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -72929,6 +73522,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt rc = _sqlite3BtreeIncrVacuum(tls, pBt2) if rc != 0 { @@ -72956,6 +73550,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -72968,6 +73563,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) goto _187 @@ -72977,6 +73573,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) goto _187 @@ -72996,6 +73593,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6240, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6265, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -73661,8 +74284,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -73681,7 +74305,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ goto _187 /***************************************************************************** ** The cases of the switch statement above this line should all be indented @@ -73690,6 +74315,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -73697,17 +74323,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -73750,12 +74379,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5400, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5425, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1620, 0) rc = int32(SQLITE_NOMEM) @@ -73764,16 +74395,17 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error return r } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5557, - 1: __ccgo_ts + 5566, - 2: __ccgo_ts + 5573, - 3: __ccgo_ts + 5579, + 0: __ccgo_ts + 5582, + 1: __ccgo_ts + 5591, + 2: __ccgo_ts + 5598, + 3: __ccgo_ts + 5604, } var _and_logic = [9]uint8{ @@ -73927,13 +74559,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1636 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6278 + v3 = __ccgo_ts + 6303 } else { - v3 = __ccgo_ts + 6283 + v3 = __ccgo_ts + 6308 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6291, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6316, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -73951,7 +74583,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6320, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6345, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3797, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -73994,15 +74626,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6340, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6365, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6370, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6395, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6406, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6431, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -74027,11 +74659,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6427, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6452, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74057,14 +74690,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6448 + zFault = __ccgo_ts + 6473 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -74080,19 +74715,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6460 + zFault = __ccgo_ts + 6485 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6468, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6493, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74153,6 +74790,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -74252,7 +74890,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -74351,7 +74989,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -75351,6 +75989,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -75470,6 +76109,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -75529,6 +76169,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -75618,6 +76259,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -75673,6 +76315,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -75728,6 +76371,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -75933,6 +76577,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -75955,6 +76600,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -76107,6 +76753,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -76184,6 +76831,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -76250,6 +76898,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -76655,6 +77304,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -76665,6 +77315,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -76843,6 +77494,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -76907,6 +77559,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -76930,6 +77583,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -77011,6 +77665,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -77026,6 +77681,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -77067,6 +77723,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -77098,6 +77755,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -77118,6 +77776,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -77324,6 +77983,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -77489,6 +78149,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -77509,6 +78170,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -77544,6 +78206,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -77581,6 +78244,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -77691,6 +78355,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -77901,6 +78566,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -77999,6 +78665,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -78093,6 +78760,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -78276,6 +78944,9 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE var _ /* temp at bp+0 */ TExpr _, _, _ = db, pDup, pOrig /* The database connection */ pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -78333,6 +79004,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -78346,6 +79018,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -78446,25 +79119,25 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { var zLegacy uintptr _ = zLegacy - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6502, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6527, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6510+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6529+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6535+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6554+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6043+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6068+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6548+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6573+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6548+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6573+7) == 0 { return int32(1) } } @@ -78547,9 +79220,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6562, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6587, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -78630,6 +79304,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -78641,7 +79316,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6567) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6592) != 0 { goto _2 } } @@ -78711,15 +79386,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } @@ -78747,11 +79433,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6569, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6594, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6573, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6598, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -78760,7 +79446,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6577, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6602, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -78783,6 +79469,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -78839,8 +79526,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -78875,15 +79562,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6586, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6611, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6617, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6642, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -78896,6 +79583,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -78934,7 +79622,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6672, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6697, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+64, 0, uint64(8)) return int32(WRC_Prune) @@ -78963,7 +79651,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6707 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6732 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -78973,18 +79661,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6716 + v10 = __ccgo_ts + 6741 } else { - v10 = __ccgo_ts + 6731 + v10 = __ccgo_ts + 6756 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6753, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6778, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6766, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6791, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6801, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -79019,6 +79707,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) @@ -79106,19 +79795,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6783 + zIn = __ccgo_ts + 6808 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6811 + zIn = __ccgo_ts + 6836 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6829 + zIn = __ccgo_ts + 6854 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6847 + zIn = __ccgo_ts + 6872 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6865, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6890, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -79164,10 +79853,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { @@ -79198,6 +79887,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -79212,29 +79914,51 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break + } + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -79255,7 +79979,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } else { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6885, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6910, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -79279,22 +80003,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) if pDef == uintptr(0) { @@ -79311,7 +80035,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6902, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6927, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -79325,17 +80049,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*uint8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6966, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6991, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -79356,7 +80080,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7002, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7027, uintptr(0), pExpr) } } else { /* Must fit in 8 bits */ @@ -79380,29 +80104,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7030, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7055, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7073 + zType = __ccgo_ts + 7098 } else { - zType = __ccgo_ts + 7080 + zType = __ccgo_ts + 7105 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7090, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7115, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7118, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7143, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7140, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7165, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7184, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7209, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -79419,11 +80143,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -79439,11 +80163,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -79462,15 +80186,15 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -79487,7 +80211,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7232, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7257, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } @@ -79498,7 +80222,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } case int32(TK_VARIABLE): if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7243, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7268, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -79544,17 +80268,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -79588,6 +80312,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -79653,6 +80378,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -79667,7 +80393,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7254, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7279, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -79702,7 +80428,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7310, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7335, 0) return int32(1) } i = 0 @@ -79713,6 +80439,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -79739,7 +80466,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7344, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7369, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -79797,6 +80524,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -79808,11 +80536,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7350, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7375, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -79841,7 +80570,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7411, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7436, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -79870,6 +80599,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -80003,10 +80733,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -80112,6 +80844,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -80149,16 +80882,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7442, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7467, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -80171,6 +80906,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -80184,6 +80920,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -80212,7 +80949,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7344) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7369) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -80223,7 +80960,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7481) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7506) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -80233,11 +80970,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7487, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7512, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -80395,6 +81133,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -80616,6 +81355,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -80685,7 +81425,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -80758,6 +81502,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -81206,7 +81951,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) return } if int32(op) == int32(TK_LE) { @@ -81260,6 +82005,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -81284,7 +82030,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7546, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7571, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -81321,6 +82067,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -81342,6 +82089,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -81626,11 +82374,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7594 + v2 = __ccgo_ts + 7619 } else { v2 = __ccgo_ts + 1650 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7596, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7621, libc.VaList(bp+8, nExprElem, v2, nElem)) break } pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) @@ -81644,6 +82392,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -81706,7 +82455,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u } *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7640, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7665, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -81726,7 +82475,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7674, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7699, libc.VaList(bp+8, p)) } // C documentation @@ -81797,7 +82546,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7724, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7749, libc.VaList(bp+8, pExpr)) } } } @@ -81849,7 +82598,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7744, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7769, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -81882,7 +82631,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7787, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7812, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -82267,6 +83016,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -82395,6 +83145,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -82472,6 +83223,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -82501,6 +83253,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -82560,6 +83313,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -82715,7 +83469,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7835, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -82734,6 +83488,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -82747,6 +83502,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -82841,7 +83597,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7840, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7865, libc.VaList(bp+8, zObject)) } } @@ -82864,6 +83620,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -82906,6 +83663,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -82937,10 +83695,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7863) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7888) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7868) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7893) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -83256,6 +84014,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -83288,6 +84047,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -83495,13 +84255,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff uint8) (r i // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7874) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7899) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7882) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7907) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7888) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7913) == 0 { return int32(1) } return 0 @@ -83519,9 +84279,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7874, - 1: __ccgo_ts + 7882, - 2: __ccgo_ts + 7888, + 0: __ccgo_ts + 7899, + 1: __ccgo_ts + 7907, + 2: __ccgo_ts + 7913, } ii = 0 for { @@ -83538,6 +84298,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -83545,6 +84306,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -83609,6 +84371,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -83768,6 +84531,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -83799,7 +84563,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7892, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7917, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -83828,6 +84592,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -83876,6 +84641,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -83891,12 +84657,13 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8200, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+160, pExpr)) } else { return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -85500,7 +86284,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8227, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8252, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -85523,6 +86307,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -85604,7 +86389,7 @@ expr_code_doover: } n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7835, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -85666,7 +86451,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6654, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6679, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -85724,7 +86509,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -85768,6 +86553,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -85780,7 +86566,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, endLabel) case int32(TK_RAISE): if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8251, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8276, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -85841,6 +86627,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -86057,6 +86844,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -86202,7 +86990,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -86219,9 +87009,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -86241,7 +87033,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -86250,11 +87044,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -86263,15 +87063,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -86284,7 +87088,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -86297,6 +87103,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -86389,7 +87196,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -86406,9 +87215,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -86430,7 +87241,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -86439,11 +87252,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -86452,15 +87271,19 @@ _7: _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -86470,7 +87293,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -86483,6 +87308,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -86720,6 +87546,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -86935,6 +87762,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -87136,6 +87970,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -87187,6 +88022,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -87196,6 +88032,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -87370,6 +88207,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } @@ -87400,6 +88238,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -87411,6 +88250,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) @@ -87459,6 +88299,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -87477,6 +88318,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -87524,6 +88366,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -87548,6 +88391,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -87650,6 +88494,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -87783,6 +88628,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -87833,8 +88679,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8301, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8326, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -87853,9 +88699,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8329, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8354, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8504, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8529, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -87871,9 +88717,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8678, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8703, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8825, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8850, 0) } } @@ -87929,7 +88775,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8976, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9001, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -87938,11 +88784,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9035, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9060, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9041, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -87972,21 +88818,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9068, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9093, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9252, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9277, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9557, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9573, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9582, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9598, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9631, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9656, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -88002,8 +88848,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9896, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9921, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -88017,7 +88864,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9909, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9934, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -88057,11 +88904,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9947, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9972, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9979, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10004, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -88077,10 +88924,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10006) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10031) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10065) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10090) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -88092,13 +88939,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10118) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10143) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10164) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10189) } } /* Modify the CREATE TABLE statement. */ @@ -88112,7 +88959,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10191, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10216, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -88140,7 +88987,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10337, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10362, libc.VaList(bp+16, zTab, zDb)) } } } @@ -88178,12 +89025,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10690, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10715, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10724, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10749, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -88207,7 +89054,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10754, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10779, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { goto exit_begin_add_column } @@ -88222,6 +89069,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } (*(*struct { @@ -88244,6 +89092,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { FpDfltList uintptr })(unsafe.Pointer(pTab + 64))).FaddColOffset exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -88265,18 +89114,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10773 + zType = __ccgo_ts + 10798 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10778 + zType = __ccgo_ts + 10803 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10792 + v1 = __ccgo_ts + 10817 } else { - v1 = __ccgo_ts + 10809 + v1 = __ccgo_ts + 10834 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10827, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10852, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -88333,10 +89182,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10845, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10870, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -88352,12 +89202,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld goto exit_rename_column } bQuote = int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10866, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11048, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10891, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11073, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9896, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9921, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -88465,6 +89316,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -88529,6 +89381,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -88553,6 +89406,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -88585,6 +89439,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -88603,6 +89458,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -88658,6 +89514,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -88680,6 +89537,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -88718,6 +89576,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -88788,6 +89647,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -88797,6 +89657,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -88820,11 +89681,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*uint8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11179 + v1 = __ccgo_ts + 11204 } else { v1 = __ccgo_ts + 1650 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11181, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11206, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -88853,6 +89714,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -88881,6 +89743,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -88899,8 +89762,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11204, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11229, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -88916,7 +89779,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -88955,7 +89818,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11212, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11237, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -89000,11 +89863,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*uint8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = uint8(0) _sqlite3Dequote(tls, zBuf1) if int32(*(*uint8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11179 + v1 = __ccgo_ts + 11204 } else { v1 = __ccgo_ts + 1650 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11218, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11243, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -89043,6 +89906,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -89134,6 +89998,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -89173,6 +90038,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -89215,11 +90081,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -89378,6 +90246,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -89388,6 +90257,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -89399,6 +90269,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } @@ -89424,10 +90295,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -89459,6 +90332,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -89471,6 +90345,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -89531,6 +90406,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -89629,6 +90505,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -89678,11 +90555,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -89802,6 +90681,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -89959,7 +90839,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -89976,10 +90856,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11223, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11248, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -90028,23 +90909,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10845, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10870, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11230 + v1 = __ccgo_ts + 11255 } else { - v1 = __ccgo_ts + 5566 + v1 = __ccgo_ts + 5591 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11242, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11267, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11270, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11295, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -90056,10 +90937,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1650, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11318, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11343, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11439, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11464, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -90089,6 +90970,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -90122,6 +91004,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -90141,6 +91024,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -90158,27 +91042,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11457, + FzName: __ccgo_ts + 11482, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11478, + FzName: __ccgo_ts + 11503, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11498, + FzName: __ccgo_ts + 11523, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11517, + FzName: __ccgo_ts + 11542, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11536, + FzName: __ccgo_ts + 11561, }, } @@ -90389,7 +91273,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11639, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11664, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -90400,10 +91284,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11687, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11692, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11717, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -90412,6 +91296,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -90424,6 +91309,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -90433,15 +91319,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11559, - FzCols: __ccgo_ts + 11572, + FzName: __ccgo_ts + 11584, + FzCols: __ccgo_ts + 11597, }, 1: { - FzName: __ccgo_ts + 11585, - FzCols: __ccgo_ts + 11598, + FzName: __ccgo_ts + 11610, + FzCols: __ccgo_ts + 11623, }, 2: { - FzName: __ccgo_ts + 11626, + FzName: __ccgo_ts + 11651, }, } @@ -90610,6 +91496,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -90620,6 +91507,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -90716,6 +91604,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } i = 0 @@ -90726,6 +91615,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -90739,7 +91629,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11710, + FzName: __ccgo_ts + 11735, } func init() { @@ -90777,6 +91667,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -90851,6 +91742,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -90884,6 +91776,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -90899,6 +91792,7 @@ find_new_min: } goto _2 _2: + ; i++ } (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin @@ -90931,6 +91825,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -90947,10 +91842,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -90970,10 +91867,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -91022,6 +91921,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -91039,6 +91939,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -91053,6 +91954,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -91086,6 +91988,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -91099,7 +92002,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11720, + FzName: __ccgo_ts + 11745, } func init() { @@ -91149,7 +92052,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11730, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11755, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -91160,9 +92063,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11735, libc.VaList(bp+72, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11760, libc.VaList(bp+72, iVal)) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -91198,9 +92102,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11741, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11766, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -91215,7 +92120,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11747, + FzName: __ccgo_ts + 11772, } func init() { @@ -91281,7 +92186,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11756, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11781, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -91295,7 +92200,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11559, uint64(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11584, uint64(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -91449,6 +92354,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -91470,6 +92376,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -91497,6 +92404,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -91517,7 +92425,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11766, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11791, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -91554,6 +92462,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -91576,6 +92485,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -91589,6 +92499,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -91598,7 +92509,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11766, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11791, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -91649,6 +92560,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -91669,9 +92581,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11770) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11795) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11774) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11799) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -91718,6 +92630,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -91827,23 +92740,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*uint8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11778, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11803, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11789, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11814, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11799, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11824, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -91954,6 +92868,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -92021,6 +92936,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -92032,6 +92948,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -92135,6 +93052,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } } @@ -92215,11 +93133,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11585, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11610, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11811, __ccgo_ts+11880, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11836, __ccgo_ts+11905, zDb) } return rc } @@ -92265,6 +93183,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -92278,15 +93197,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11559, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11584, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11932, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11957, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -92306,6 +93226,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -92331,6 +93252,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -92397,7 +93319,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6562, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6587, zName) == 0) } // C documentation @@ -92453,7 +93375,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11973, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11998, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -92484,7 +93406,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11976, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12001, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -92493,11 +93415,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { break } if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12013, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12038, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -92540,7 +93463,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12043, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12068, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -92548,7 +93471,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12072, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12097, 0) rc = int32(SQLITE_ERROR) } } @@ -92595,7 +93518,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1620, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 24)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12140, libc.VaList(bp+56, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12165, libc.VaList(bp+56, zFile)) } } } @@ -92603,6 +93526,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 24)), -int32(1)) @@ -92651,18 +93575,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12168, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12193, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12189, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12214, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12215, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12240, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -92681,6 +93606,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -92734,6 +93660,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -92753,7 +93680,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12237, + FzName: __ccgo_ts + 12262, } func init() { @@ -92775,7 +93702,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12251, + FzName: __ccgo_ts + 12276, } func init() { @@ -92801,7 +93728,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12265, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12290, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -92835,7 +93762,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12289, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12314, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -92850,6 +93777,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -92864,6 +93792,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92951,6 +93880,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -93048,7 +93978,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12335, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12360, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -93076,11 +94006,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12358, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12383, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12364, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12389, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12370, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -93126,6 +94056,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -93139,7 +94070,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 7882 + zCol = __ccgo_ts + 7907 } } if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -93174,7 +94105,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12397, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12422, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -93286,6 +94217,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -93336,6 +94268,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -93401,6 +94334,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -93429,6 +94363,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -93444,6 +94379,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -93472,6 +94408,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*32))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*32 + 24))) goto _5 _5: + ; i++ } } @@ -93583,26 +94520,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6562) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6587) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6529+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6043+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6510) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6554+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6068+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6535) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6043) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6068) } } } @@ -93629,14 +94567,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6548+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6043) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6573+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6068) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6529+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6510) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6554+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6535) } } } @@ -93674,7 +94613,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12412, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12437, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -93692,15 +94631,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12420 + v1 = __ccgo_ts + 12445 } else { - v1 = __ccgo_ts + 12433 + v1 = __ccgo_ts + 12458 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6766, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6791, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6801, libc.VaList(bp+8, zMsg, zName)) } } else { } @@ -93738,12 +94677,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6043+7) == 0 { - return __ccgo_ts + 6548 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6068+7) == 0 { + return __ccgo_ts + 6573 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6510+7) == 0 { - return __ccgo_ts + 6529 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6535+7) == 0 { + return __ccgo_ts + 6554 } } return zName @@ -93790,6 +94729,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -93877,6 +94817,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -93916,6 +94857,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -93948,6 +94890,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -94103,6 +95046,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -94162,6 +95106,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -94262,7 +95207,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6043) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6068) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -94294,11 +95239,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6562, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6587, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -94351,13 +95297,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12447, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12472, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12464, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12489, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -94405,8 +95351,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6502, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12484, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6527, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12509, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -94428,6 +95374,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -94454,6 +95401,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -94486,6 +95434,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -94548,6 +95497,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -94617,9 +95567,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -94632,7 +95582,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12526, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12551, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -94648,9 +95598,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10773 + v2 = __ccgo_ts + 10798 } else { - v2 = __ccgo_ts + 9035 + v2 = __ccgo_ts + 9060 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -94660,9 +95610,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui } zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6510 + v3 = __ccgo_ts + 6535 } else { - v3 = __ccgo_ts + 6043 + v3 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -94686,11 +95636,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10773 + v4 = __ccgo_ts + 10798 } else { - v4 = __ccgo_ts + 9035 + v4 = __ccgo_ts + 9060 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12567, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12592, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -94698,7 +95648,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12588, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12613, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -94787,6 +95737,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -94848,7 +95799,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12623, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12648, 0) } else { } (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) @@ -94864,7 +95815,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12657, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12682, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -94911,7 +95862,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12677, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12702, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -94921,12 +95872,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12700, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12725, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12707, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12732, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -94954,6 +95905,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -94974,12 +95926,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12717, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12742, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -95043,6 +95996,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -95180,10 +96134,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12743, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12768, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12788, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12813, 0) } else { libc.Xmemset(tls, bp, 0, uint64(72)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -95241,7 +96195,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12829, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12854, 0) } } @@ -95278,7 +96232,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12881, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12906, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) @@ -95310,11 +96264,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -95332,13 +96288,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12947, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -95368,6 +96325,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1))))])&int32(0x01) != 0 { @@ -95419,6 +96377,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -95444,17 +96403,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12978, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13003, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13021, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13046, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13029, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13054, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -95484,8 +96443,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13036, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13061, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -95541,6 +96502,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -95578,6 +96540,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -95601,6 +96564,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -95636,18 +96600,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1650 - zSep2 = __ccgo_ts + 13067 - zEnd = __ccgo_ts + 5083 + zSep2 = __ccgo_ts + 13092 + zEnd = __ccgo_ts + 5108 } else { - zSep = __ccgo_ts + 13069 - zSep2 = __ccgo_ts + 13073 - zEnd = __ccgo_ts + 13078 + zSep = __ccgo_ts + 13094 + zSep2 = __ccgo_ts + 13098 + zEnd = __ccgo_ts + 13103 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -95655,7 +96620,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13081, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13106, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -95677,6 +96642,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(bp)) += len1 goto _3 _3: + ; i++ pCol += 16 } @@ -95686,11 +96652,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1650, - 1: __ccgo_ts + 13095, - 2: __ccgo_ts + 13101, - 3: __ccgo_ts + 13106, - 4: __ccgo_ts + 13111, - 5: __ccgo_ts + 13101, + 1: __ccgo_ts + 13120, + 2: __ccgo_ts + 13126, + 3: __ccgo_ts + 13131, + 4: __ccgo_ts + 13136, + 5: __ccgo_ts + 13126, } // C documentation @@ -95747,6 +96713,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -95783,6 +96750,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -95842,6 +96810,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -95888,6 +96857,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -95943,6 +96913,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -95999,6 +96970,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -96042,6 +97014,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -96069,10 +97042,12 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -96088,6 +97063,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -96106,6 +97082,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _recomputeColumnsNotIndexed(tls, pPk) @@ -96195,6 +97172,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -96307,9 +97285,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13117, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13142, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13150, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -96323,17 +97301,18 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13177, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13202, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13227, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13252, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -96376,10 +97355,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13259, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13284, 0) return } } @@ -96393,6 +97373,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -96412,12 +97393,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9035 - zType2 = __ccgo_ts + 13303 + zType = __ccgo_ts + 9060 + zType2 = __ccgo_ts + 13328 } else { /* A view */ - zType = __ccgo_ts + 10773 - zType2 = __ccgo_ts + 13309 + zType = __ccgo_ts + 10798 + zType2 = __ccgo_ts + 13334 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -96500,13 +97481,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13314, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13339, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13329, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13354, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -96515,17 +97496,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13427, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13452, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13469, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13494, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13503, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13528, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13524, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13549, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -96542,7 +97523,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9557) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9582) == 0 { (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } } @@ -96575,7 +97556,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13556, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13581, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -96587,11 +97568,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10773, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10798, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -96634,6 +97616,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -96685,7 +97668,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13592, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13617, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } /* If we get this far, it means we need to compute the table names. @@ -96790,6 +97773,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -96831,6 +97815,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -96845,6 +97830,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -96866,7 +97852,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13622, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13647, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -96879,7 +97865,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13637, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13662, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -96930,6 +97916,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -96961,12 +97948,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13704, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13729, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11687, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -97003,7 +97991,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13718, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13743, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -97012,7 +98000,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13763, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13788, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -97047,11 +98035,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3420, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7243, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7268, int32(10)) == 0 { return 0 } return int32(1) @@ -97106,9 +98094,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -97141,18 +98129,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13830, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13855, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13858, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13883, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13892, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13917, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -97162,12 +98150,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11774, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11799, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -97208,13 +98197,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13924, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13949, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13987, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14012, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -97230,6 +98219,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -97272,10 +98262,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14081, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14106, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -97283,6 +98274,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -97302,6 +98294,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -97326,6 +98319,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -97531,15 +98525,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14127 + v2 = __ccgo_ts + 14152 } else { - v2 = __ccgo_ts + 14133 + v2 = __ccgo_ts + 14158 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14138, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14163, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -97612,7 +98607,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14166, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14191, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -97622,7 +98617,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14172, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14197, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -97636,16 +98631,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14222, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14247, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14250, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14275, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14275, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14300, 0) goto exit_create_index } /* @@ -97666,19 +98661,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if zName == uintptr(0) { goto exit_create_index } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14166, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14191, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14309, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14334, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14343, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14368, libc.VaList(bp+136, zName)) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) @@ -97695,10 +98690,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14367, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14392, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -97716,9 +98712,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6510 + v2 = __ccgo_ts + 6535 } else { - v2 = __ccgo_ts + 6043 + v2 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -97746,7 +98742,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14166) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14191) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -97765,6 +98761,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -97829,7 +98826,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14390, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14415, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -97879,6 +98876,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -97903,6 +98901,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } } else { @@ -97933,6 +98932,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -97960,6 +98960,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -97972,7 +98973,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14451, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14476, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -97990,6 +98991,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -98001,8 +99003,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14493, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14518, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -98044,9 +99046,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1650 } else { - v13 = __ccgo_ts + 14510 + v13 = __ccgo_ts + 14535 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14518, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14543, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -98054,7 +99056,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14538, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14563, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -98062,7 +99064,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14597, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14622, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -98081,6 +99083,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -98109,6 +99112,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -98182,6 +99186,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) goto _3 _3: + ; i++ } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { @@ -98221,7 +99226,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14624, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14649, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -98230,7 +99235,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14642, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14667, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -98238,9 +99243,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -98256,13 +99261,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14715, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11770, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14740, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11795, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -98371,6 +99377,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -98395,6 +99402,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -98444,7 +99452,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14775, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14800, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -98467,6 +99475,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -98480,6 +99489,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -98588,6 +99598,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -98640,6 +99651,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -98672,11 +99684,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14811 + v1 = __ccgo_ts + 14836 } else { - v1 = __ccgo_ts + 14814 + v1 = __ccgo_ts + 14839 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14820, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14845, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -98714,6 +99726,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) return uintptr(0) @@ -98824,6 +99837,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -98841,6 +99855,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -98849,6 +99864,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -98869,7 +99885,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { var eTxnType, i int32 _, _, _, _, _ = db, eTxnType, i, pBt, v db = (*TParse)(unsafe.Pointer(pParse)).Fdb - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14856, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14881, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -98896,6 +99912,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -98915,9 +99932,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _, _, _ = isRollback, v, v1 isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14862 + v1 = __ccgo_ts + 14887 } else { - v1 = __ccgo_ts + 14871 + v1 = __ccgo_ts + 14896 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -98949,9 +99966,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14856, - 1: __ccgo_ts + 14878, - 2: __ccgo_ts + 14862, + 0: __ccgo_ts + 14881, + 1: __ccgo_ts + 14903, + 2: __ccgo_ts + 14887, } // C documentation @@ -98971,7 +99988,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14886, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14911, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -99036,6 +100053,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -99154,7 +100172,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14956, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14981, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -99163,13 +100181,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx } zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*16))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+14967, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+14992, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1663, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -99194,10 +100213,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12383, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15111, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -100287,11 +101319,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15119, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15144, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15148, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15173, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -100410,6 +101442,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -100495,6 +101528,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -100563,6 +101597,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -100691,9 +101726,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15186) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15211) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -100795,6 +101831,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -100836,7 +101873,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11559) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11584) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -100927,6 +101964,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -101013,6 +102051,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -101114,6 +102153,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -101137,10 +102177,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6283, - 1: __ccgo_ts + 6278, - 2: __ccgo_ts + 8174, - 3: __ccgo_ts + 8169, + 0: __ccgo_ts + 6308, + 1: __ccgo_ts + 6303, + 2: __ccgo_ts + 8199, + 3: __ccgo_ts + 8194, 4: __ccgo_ts + 1636, } @@ -101255,7 +102295,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15199, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15224, -int32(1)) return } iVal = -iVal @@ -101351,10 +102391,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -101442,6 +102484,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -101505,6 +102548,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -101564,7 +102608,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15216, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15241, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -101625,6 +102669,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = uint8(int32(*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -101651,6 +102696,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = _sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))] goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -102142,7 +103188,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15247, -int32(1)) return } if argc == int32(3) { @@ -102154,7 +103200,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15255, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15280, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -102323,13 +103369,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5044, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15325, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15300, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15333, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -102350,6 +103396,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*uint8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*uint8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = uint8('\'') @@ -102360,7 +103407,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15307, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15341, libc.VaList(bp+16, zArg)) default: Xsqlite3_str_append(tls, pStr, __ccgo_ts+1651, int32(4)) break @@ -102484,6 +103531,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -102523,6 +103571,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -102650,9 +103699,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -102704,7 +103755,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -102757,6 +103808,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } libc.Xmemcpy(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i)) @@ -102812,6 +103864,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -102837,6 +103890,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -102858,6 +103912,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -102881,6 +103936,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -102901,7 +103957,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11179, + 0: __ccgo_ts + 11204, } // C documentation @@ -102926,6 +103982,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -102954,6 +104011,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(z + uintptr(j))) = uint8(0) @@ -103022,6 +104080,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -103045,6 +104104,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -103057,7 +104117,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15310, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15344, int32(4), libc.UintptrFromInt32(0)) } } @@ -103118,7 +104178,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12397, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12422, -int32(1)) return } if argc == int32(2) { @@ -103307,9 +104367,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15199, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15224, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -103329,7 +104389,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -103348,7 +104408,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -103649,7 +104709,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15315, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15349, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } @@ -103678,12 +104738,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15321, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15321, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15355, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15355, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -103984,562 +105045,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15326, + FzName: __ccgo_ts + 15360, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15346, + FzName: __ccgo_ts + 15380, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15359, + FzName: __ccgo_ts + 15393, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15377, + FzName: __ccgo_ts + 15411, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15386, + FzName: __ccgo_ts + 15420, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15394, + FzName: __ccgo_ts + 15428, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15394, + FzName: __ccgo_ts + 15428, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15409, + FzName: __ccgo_ts + 15443, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15435, + FzName: __ccgo_ts + 15469, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15460, + FzName: __ccgo_ts + 15494, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15469, + FzName: __ccgo_ts + 15503, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15480, + FzName: __ccgo_ts + 15514, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15487, + FzName: __ccgo_ts + 15521, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15501, + FzName: __ccgo_ts + 15535, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15501, + FzName: __ccgo_ts + 15535, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15507, + FzName: __ccgo_ts + 15541, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15507, + FzName: __ccgo_ts + 15541, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15513, + FzName: __ccgo_ts + 15547, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15513, + FzName: __ccgo_ts + 15547, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15518, + FzName: __ccgo_ts + 15552, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15522, + FzName: __ccgo_ts + 15556, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15526, + FzName: __ccgo_ts + 15560, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15533, + FzName: __ccgo_ts + 15567, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15541, + FzName: __ccgo_ts + 15575, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15548, + FzName: __ccgo_ts + 15582, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15561, + FzName: __ccgo_ts + 15595, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15567, + FzName: __ccgo_ts + 15601, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15574, + FzName: __ccgo_ts + 15608, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15581, + FzName: __ccgo_ts + 15615, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15589, + FzName: __ccgo_ts + 15623, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15594, + FzName: __ccgo_ts + 15628, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15598, + FzName: __ccgo_ts + 15632, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15598, + FzName: __ccgo_ts + 15632, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15604, + FzName: __ccgo_ts + 15638, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15610, + FzName: __ccgo_ts + 15644, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15616, + FzName: __ccgo_ts + 15650, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15620, + FzName: __ccgo_ts + 15654, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15620, + FzName: __ccgo_ts + 15654, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15626, + FzName: __ccgo_ts + 15660, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15626, + FzName: __ccgo_ts + 15660, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15633, + FzName: __ccgo_ts + 15667, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15643, + FzName: __ccgo_ts + 15677, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15650, + FzName: __ccgo_ts + 15684, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15657, + FzName: __ccgo_ts + 15691, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15668, + FzName: __ccgo_ts + 15702, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15675, + FzName: __ccgo_ts + 15709, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15690, + FzName: __ccgo_ts + 15724, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15707, + FzName: __ccgo_ts + 15741, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15718, + FzName: __ccgo_ts + 15752, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15724, + FzName: __ccgo_ts + 15758, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15742, + FzName: __ccgo_ts + 15776, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15750, + FzName: __ccgo_ts + 15784, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15764, + FzName: __ccgo_ts + 15798, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15772, + FzName: __ccgo_ts + 15806, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15781, + FzName: __ccgo_ts + 15815, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15788, + FzName: __ccgo_ts + 15822, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15788, + FzName: __ccgo_ts + 15822, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15798, + FzName: __ccgo_ts + 15832, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15802, + FzName: __ccgo_ts + 15836, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15808, + FzName: __ccgo_ts + 15842, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15812, + FzName: __ccgo_ts + 15846, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15812, + FzName: __ccgo_ts + 15846, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15818, + FzName: __ccgo_ts + 15852, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15818, + FzName: __ccgo_ts + 15852, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15831, + FzName: __ccgo_ts + 15865, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15842, + FzName: __ccgo_ts + 15876, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15321, + FzName: __ccgo_ts + 15355, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15321, + FzName: __ccgo_ts + 15355, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15847, + FzName: __ccgo_ts + 15881, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15852, + FzName: __ccgo_ts + 15886, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15860, + FzName: __ccgo_ts + 15894, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15866, + FzName: __ccgo_ts + 15900, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15872, + FzName: __ccgo_ts + 15906, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15875, + FzName: __ccgo_ts + 15909, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15879, + FzName: __ccgo_ts + 15913, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15885, + FzName: __ccgo_ts + 15919, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15875, + FzName: __ccgo_ts + 15909, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15890, + FzName: __ccgo_ts + 15924, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15894, + FzName: __ccgo_ts + 15928, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15898, + FzName: __ccgo_ts + 15932, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15904, + FzName: __ccgo_ts + 15938, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15908, + FzName: __ccgo_ts + 15942, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15913, + FzName: __ccgo_ts + 15947, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15918, + FzName: __ccgo_ts + 15952, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15923, + FzName: __ccgo_ts + 15957, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15929, + FzName: __ccgo_ts + 15963, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15933, + FzName: __ccgo_ts + 15967, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15937, + FzName: __ccgo_ts + 15971, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15941, + FzName: __ccgo_ts + 15975, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15946, + FzName: __ccgo_ts + 15980, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15951, + FzName: __ccgo_ts + 15985, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15956, + FzName: __ccgo_ts + 15990, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15962, + FzName: __ccgo_ts + 15996, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15968, + FzName: __ccgo_ts + 16002, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15974, + FzName: __ccgo_ts + 16008, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15979, + FzName: __ccgo_ts + 16013, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15987, + FzName: __ccgo_ts + 16021, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15995, + FzName: __ccgo_ts + 16029, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15998, + FzName: __ccgo_ts + 16032, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6707, + FzName: __ccgo_ts + 6732, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16003, + FzName: __ccgo_ts + 16037, }, } @@ -104953,6 +106014,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -104992,6 +106054,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -104999,6 +106062,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -105008,11 +106072,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16007, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16041, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -105075,6 +106140,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -105114,6 +106180,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -105144,6 +106211,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -105297,6 +106365,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -105332,6 +106401,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -105438,10 +106508,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -105489,6 +106561,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -105550,6 +106623,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -105598,10 +106672,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -105727,6 +106803,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -105762,6 +106839,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -105789,6 +106867,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -105862,6 +106941,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -105905,10 +106985,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -105932,11 +107014,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -106004,6 +107088,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -106020,6 +107105,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -106102,11 +107188,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6573, + Fz: __ccgo_ts + 6598, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6569, + Fz: __ccgo_ts + 6594, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -106162,6 +107248,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -106169,7 +107256,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5202) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5227) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = uint8(OE_Abort) } @@ -106268,6 +107355,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -106319,6 +107407,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -106432,6 +107521,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = uint8(0) @@ -106472,6 +107562,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*uint8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -106603,6 +107694,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -106611,6 +107703,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -106671,6 +107764,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -106697,6 +107791,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -106737,11 +107832,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8139, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8164, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -106863,6 +107959,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -106968,6 +108065,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -107238,6 +108336,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -107259,13 +108358,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16052, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16086, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -107273,13 +108373,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16093, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16127, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -107370,6 +108471,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -107387,16 +108489,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16125, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16159, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16177, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16211, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -107428,6 +108531,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -107438,11 +108542,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16202, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16236, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16282, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -107456,7 +108560,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -107557,6 +108661,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -107597,6 +108702,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -107754,6 +108860,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -107767,9 +108874,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16269) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16303) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -108158,7 +109266,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*uint8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -110365,10 +111495,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16318, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16352, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -110385,9 +111516,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16322, uint64(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16356, uint64(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -110399,7 +111531,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16328, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16362, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -110414,7 +111546,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16371, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16405, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -110436,6 +111568,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -110443,7 +111576,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16403, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16437, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -110452,7 +111585,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16283, + 0: __ccgo_ts + 16317, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -110482,6 +111615,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -110565,6 +111699,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -110615,6 +111750,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -110682,12 +111818,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16440, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16474, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -110735,63 +111872,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5458, - 1: __ccgo_ts + 16479, - 2: __ccgo_ts + 9035, - 3: __ccgo_ts + 16483, - 4: __ccgo_ts + 16488, - 5: __ccgo_ts + 16491, - 6: __ccgo_ts + 16501, - 7: __ccgo_ts + 16511, - 8: __ccgo_ts + 16517, - 9: __ccgo_ts + 16521, - 10: __ccgo_ts + 16526, - 11: __ccgo_ts + 16531, - 12: __ccgo_ts + 16539, - 13: __ccgo_ts + 16550, - 14: __ccgo_ts + 16553, - 15: __ccgo_ts + 16560, - 16: __ccgo_ts + 16521, - 17: __ccgo_ts + 16526, - 18: __ccgo_ts + 16567, - 19: __ccgo_ts + 16572, - 20: __ccgo_ts + 16575, - 21: __ccgo_ts + 16582, - 22: __ccgo_ts + 16517, - 23: __ccgo_ts + 16521, - 24: __ccgo_ts + 16588, - 25: __ccgo_ts + 16593, - 26: __ccgo_ts + 16598, - 27: __ccgo_ts + 16521, - 28: __ccgo_ts + 16602, - 29: __ccgo_ts + 16526, - 30: __ccgo_ts + 16610, - 31: __ccgo_ts + 16614, - 32: __ccgo_ts + 16619, - 33: __ccgo_ts + 11774, - 34: __ccgo_ts + 11770, - 35: __ccgo_ts + 16625, - 36: __ccgo_ts + 16630, - 37: __ccgo_ts + 16635, - 38: __ccgo_ts + 16479, - 39: __ccgo_ts + 16521, - 40: __ccgo_ts + 16640, - 41: __ccgo_ts + 16647, - 42: __ccgo_ts + 16654, - 43: __ccgo_ts + 9035, - 44: __ccgo_ts + 16662, - 45: __ccgo_ts + 5461, - 46: __ccgo_ts + 16668, - 47: __ccgo_ts + 16479, - 48: __ccgo_ts + 16521, - 49: __ccgo_ts + 16673, - 50: __ccgo_ts + 16678, - 51: __ccgo_ts + 15875, - 52: __ccgo_ts + 16683, - 53: __ccgo_ts + 16696, - 54: __ccgo_ts + 16705, - 55: __ccgo_ts + 16712, - 56: __ccgo_ts + 16723, + 0: __ccgo_ts + 5483, + 1: __ccgo_ts + 16513, + 2: __ccgo_ts + 9060, + 3: __ccgo_ts + 16517, + 4: __ccgo_ts + 16522, + 5: __ccgo_ts + 16525, + 6: __ccgo_ts + 16535, + 7: __ccgo_ts + 16545, + 8: __ccgo_ts + 16551, + 9: __ccgo_ts + 16555, + 10: __ccgo_ts + 16560, + 11: __ccgo_ts + 16565, + 12: __ccgo_ts + 16573, + 13: __ccgo_ts + 16584, + 14: __ccgo_ts + 16587, + 15: __ccgo_ts + 16594, + 16: __ccgo_ts + 16555, + 17: __ccgo_ts + 16560, + 18: __ccgo_ts + 16601, + 19: __ccgo_ts + 16606, + 20: __ccgo_ts + 16609, + 21: __ccgo_ts + 16616, + 22: __ccgo_ts + 16551, + 23: __ccgo_ts + 16555, + 24: __ccgo_ts + 16622, + 25: __ccgo_ts + 16627, + 26: __ccgo_ts + 16632, + 27: __ccgo_ts + 16555, + 28: __ccgo_ts + 16636, + 29: __ccgo_ts + 16560, + 30: __ccgo_ts + 16644, + 31: __ccgo_ts + 16648, + 32: __ccgo_ts + 16653, + 33: __ccgo_ts + 11799, + 34: __ccgo_ts + 11795, + 35: __ccgo_ts + 16659, + 36: __ccgo_ts + 16664, + 37: __ccgo_ts + 16669, + 38: __ccgo_ts + 16513, + 39: __ccgo_ts + 16555, + 40: __ccgo_ts + 16674, + 41: __ccgo_ts + 16681, + 42: __ccgo_ts + 16688, + 43: __ccgo_ts + 9060, + 44: __ccgo_ts + 16696, + 45: __ccgo_ts + 5486, + 46: __ccgo_ts + 16702, + 47: __ccgo_ts + 16513, + 48: __ccgo_ts + 16555, + 49: __ccgo_ts + 16707, + 50: __ccgo_ts + 16712, + 51: __ccgo_ts + 15909, + 52: __ccgo_ts + 16717, + 53: __ccgo_ts + 16730, + 54: __ccgo_ts + 16739, + 55: __ccgo_ts + 16746, + 56: __ccgo_ts + 16757, } // C documentation @@ -110810,191 +111947,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16731, + FzName: __ccgo_ts + 16765, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16746, + FzName: __ccgo_ts + 16780, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16761, + FzName: __ccgo_ts + 16795, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16773, + FzName: __ccgo_ts + 16807, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16789, + FzName: __ccgo_ts + 16823, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16712, + FzName: __ccgo_ts + 16746, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16802, + FzName: __ccgo_ts + 16836, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16814, + FzName: __ccgo_ts + 16848, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16834, + FzName: __ccgo_ts + 16868, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16850, + FzName: __ccgo_ts + 16884, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16871, + FzName: __ccgo_ts + 16905, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16886, + FzName: __ccgo_ts + 16920, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16902, + FzName: __ccgo_ts + 16936, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16916, + FzName: __ccgo_ts + 16950, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16929, + FzName: __ccgo_ts + 16963, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16943, + FzName: __ccgo_ts + 16977, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16962, + FzName: __ccgo_ts + 16996, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16981, + FzName: __ccgo_ts + 17015, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17004, + FzName: __ccgo_ts + 17038, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17013, + FzName: __ccgo_ts + 17047, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17031, + FzName: __ccgo_ts + 17065, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17048, + FzName: __ccgo_ts + 17082, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17061, + FzName: __ccgo_ts + 17095, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17076, + FzName: __ccgo_ts + 17110, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17094, + FzName: __ccgo_ts + 17128, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17104, + FzName: __ccgo_ts + 17138, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17118, + FzName: __ccgo_ts + 17152, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17134, + FzName: __ccgo_ts + 17168, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17159, + FzName: __ccgo_ts + 17193, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17178, + FzName: __ccgo_ts + 17212, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17189, + FzName: __ccgo_ts + 17223, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17200, + FzName: __ccgo_ts + 17234, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -111002,146 +112139,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17212, + FzName: __ccgo_ts + 17246, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17228, + FzName: __ccgo_ts + 17262, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17241, + FzName: __ccgo_ts + 17275, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17260, + FzName: __ccgo_ts + 17294, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17279, + FzName: __ccgo_ts + 17313, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17292, + FzName: __ccgo_ts + 17326, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17307, + FzName: __ccgo_ts + 17341, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17317, + FzName: __ccgo_ts + 17351, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17329, + FzName: __ccgo_ts + 17363, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17338, + FzName: __ccgo_ts + 17372, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17349, + FzName: __ccgo_ts + 17383, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17359, + FzName: __ccgo_ts + 17393, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17371, + FzName: __ccgo_ts + 17405, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17382, + FzName: __ccgo_ts + 17416, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17394, + FzName: __ccgo_ts + 17428, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17411, + FzName: __ccgo_ts + 17445, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17430, + FzName: __ccgo_ts + 17464, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17456, + FzName: __ccgo_ts + 17490, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17471, + FzName: __ccgo_ts + 17505, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17485, + FzName: __ccgo_ts + 17519, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17504, + FzName: __ccgo_ts + 17538, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17518, + FzName: __ccgo_ts + 17552, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17534, + FzName: __ccgo_ts + 17568, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17546, + FzName: __ccgo_ts + 17580, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17557, + FzName: __ccgo_ts + 17591, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17568, + FzName: __ccgo_ts + 17602, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -111149,45 +112286,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17580, + FzName: __ccgo_ts + 17614, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17591, + FzName: __ccgo_ts + 17625, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17612, + FzName: __ccgo_ts + 17646, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17620, + FzName: __ccgo_ts + 17654, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17635, + FzName: __ccgo_ts + 17669, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17648, + FzName: __ccgo_ts + 17682, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17667, + FzName: __ccgo_ts + 17701, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17682, + FzName: __ccgo_ts + 17716, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -111229,6 +112366,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -111287,10 +112425,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17698) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17732) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17708) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17742) { return PAGER_LOCKINGMODE_NORMAL } } @@ -111308,13 +112446,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8195) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8220) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17715) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17749) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17720) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17754) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -111337,10 +112475,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*uint8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*uint8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16673) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16707) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17732) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17766) == 0 { return int32(2) } else { return 0 @@ -111362,7 +112500,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17739, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17773, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -111423,6 +112561,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -111491,15 +112630,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17801 + zName = __ccgo_ts + 17835 case int32(OE_SetDflt): - zName = __ccgo_ts + 17810 + zName = __ccgo_ts + 17844 case int32(OE_Cascade): - zName = __ccgo_ts + 17822 + zName = __ccgo_ts + 17856 case int32(OE_Restrict): - zName = __ccgo_ts + 17830 + zName = __ccgo_ts + 17864 default: - zName = __ccgo_ts + 17839 + zName = __ccgo_ts + 17873 break } return zName @@ -111520,12 +112659,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17849, - 1: __ccgo_ts + 17856, - 2: __ccgo_ts + 17864, - 3: __ccgo_ts + 17868, - 4: __ccgo_ts + 17732, - 5: __ccgo_ts + 17877, + 0: __ccgo_ts + 17883, + 1: __ccgo_ts + 17890, + 2: __ccgo_ts + 17898, + 3: __ccgo_ts + 17902, + 4: __ccgo_ts + 17766, + 5: __ccgo_ts + 17911, } // C documentation @@ -111587,25 +112726,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17936 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17904 + zType = __ccgo_ts + 17938 } else { - zType = __ccgo_ts + 7594 + zType = __ccgo_ts + 7619 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17906, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17940, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17881, - 2: __ccgo_ts + 17886, - 3: __ccgo_ts + 17894, + 1: __ccgo_ts + 17915, + 2: __ccgo_ts + 17920, + 3: __ccgo_ts + 17928, } // C documentation @@ -111646,8 +112786,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(240) defer tls.Free(240) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -111675,7 +112815,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -111704,7 +112844,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17913, libc.VaList(bp+176, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17947, libc.VaList(bp+176, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -111851,7 +112991,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt b = -int32(1) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17917) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17951) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -111866,6 +113006,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -111921,7 +113062,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17708 + zRet = __ccgo_ts + 17742 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -111940,6 +113081,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -111948,7 +113090,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) } if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17698 + zRet = __ccgo_ts + 17732 } _returnSingleText(tls, v, zRet) break @@ -111958,7 +113100,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -111977,6 +113119,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -112006,6 +113149,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -112183,6 +113327,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -112235,7 +113380,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*uint8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17956, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -112267,7 +113412,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17947, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17981, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -112300,7 +113445,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18000) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18034) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -112373,15 +113518,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } } pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18006 + v14 = __ccgo_ts + 18040 } else { - v14 = __ccgo_ts + 18014 + v14 = __ccgo_ts + 18048 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -112396,6 +113542,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1650), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -112451,7 +113598,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18021, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18055, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 80)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+80, uintptr(0)) @@ -112467,6 +113614,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -112480,25 +113628,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10773 + zType = __ccgo_ts + 10798 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13021 + zType = __ccgo_ts + 13046 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18037 + zType = __ccgo_ts + 18071 } else { - zType = __ccgo_ts + 9035 + zType = __ccgo_ts + 9060 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18044, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18078, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -112537,13 +113687,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18051, libc.VaList(bp+176, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18085, libc.VaList(bp+176, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18056, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18090, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -112562,13 +113713,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18061, - 1: __ccgo_ts + 18063, - 2: __ccgo_ts + 16550, + 0: __ccgo_ts + 18095, + 1: __ccgo_ts + 18097, + 2: __ccgo_ts + 16584, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18065, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18099, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -112584,9 +113736,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { goto _24 } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18071, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18105, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -112600,9 +113753,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18075, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18109, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -112621,10 +113775,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -112636,6 +113792,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -112646,9 +113803,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7594, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7619, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -112657,9 +113815,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7594, libc.VaList(bp+176, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7619, libc.VaList(bp+176, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -112682,9 +113841,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18078, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18087)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18112, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18121)) goto _32 _32: + ; j2++ } i7++ @@ -112693,7 +113853,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -112753,6 +113913,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -112800,6 +113961,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -112820,12 +113982,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18092, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18126, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -112945,6 +114108,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -112953,6 +114117,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -112995,10 +114160,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -113009,7 +114176,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18096, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18130, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -113027,50 +114194,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -113095,6 +114218,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113117,6 +114241,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -113134,13 +114259,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18120, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -113149,6 +114274,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 108)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -113216,9 +114342,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18156, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18190, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -113231,7 +114358,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if bStrict != 0 && doTypeCheck != 0 { _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18176, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18210, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -113239,7 +114366,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18198, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18232, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -113250,10 +114377,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18221, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18255, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18223, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18257, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -113263,6 +114390,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -113280,12 +114408,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18243, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18277, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -113309,9 +114438,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 112))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18273) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18307) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18278) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18312) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -113324,9 +114453,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18299) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18333) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18335) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18369) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -113348,14 +114477,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18273) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18307) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18346) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18380) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -113376,13 +114506,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 112))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 112))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18373) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18407) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -113390,6 +114521,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 128))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113397,7 +114529,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 108)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18400) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18434) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -113416,6 +114548,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -113425,17 +114558,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 104)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18429 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18463 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -113493,27 +114693,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18490, libc.VaList(bp+176, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18524, libc.VaList(bp+176, zRight)) } } } @@ -113591,11 +114792,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -113611,20 +114812,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17715) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17749) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18515) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18549) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17868) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17902) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -113648,11 +114849,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -113720,7 +114921,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -113729,22 +114930,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -113753,16 +114954,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -113771,15 +114972,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18523, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18557, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -113787,12 +114989,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -113890,6 +115094,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -114019,34 +115224,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18432, + FzName: __ccgo_ts + 18466, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18437, + FzName: __ccgo_ts + 18471, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18443, + FzName: __ccgo_ts + 18477, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18452, + FzName: __ccgo_ts + 18486, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18461, + FzName: __ccgo_ts + 18495, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18469, + FzName: __ccgo_ts + 18503, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18477, + FzName: __ccgo_ts + 18511, }, 7: { - FzName: __ccgo_ts + 18484, + FzName: __ccgo_ts + 18518, }, 8: {}, } @@ -114142,34 +115347,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18541) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18575) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18556, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18590, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = uint8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18563, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18597, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18569) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18603) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18581) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18615) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) _sqlite3StrAccumFinish(tls, bp) rc = Xsqlite3_declare_vtab(tls, db, bp+32) if rc == SQLITE_OK { @@ -114243,6 +115449,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -114255,6 +115462,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -114298,6 +115507,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -114370,17 +115580,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18596) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18630) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18604, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18638, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18608, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18642, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -114515,24 +115726,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18642, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18676, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5085 + v1 = __ccgo_ts + 5110 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18670, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18704, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*uint8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18701, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18735, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -114540,9 +115751,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18612, - 1: __ccgo_ts + 18619, - 2: __ccgo_ts + 18631, + 0: __ccgo_ts + 18646, + 1: __ccgo_ts + 18653, + 2: __ccgo_ts + 18665, } // C documentation @@ -114565,6 +115776,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -114617,7 +115829,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14493) + _corruptSchema(tls, pData, argv, __ccgo_ts+14518) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -114650,11 +115862,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18709) + _corruptSchema(tls, pData, argv, __ccgo_ts+18743) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14493) + _corruptSchema(tls, pData, argv, __ccgo_ts+14518) } } } @@ -114693,18 +115905,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9035 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9060 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6510 + v2 = __ccgo_ts + 6535 } else { - v2 = __ccgo_ts + 6043 + v2 = __ccgo_ts + 6068 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8107 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18722 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8132 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18756 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -114765,6 +115977,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -114792,7 +116005,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12072) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12097) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -114818,7 +116031,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18794) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18828) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -114833,7 +116046,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl /* Read the schema information out of the schema tables */ (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18818, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18852, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -114871,11 +116084,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18882, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18916, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -115305,6 +116524,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -115316,7 +116536,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -115330,6 +116550,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -115460,6 +116681,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -115841,6 +117063,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -115849,18 +117072,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11179 - zSp2 = __ccgo_ts + 11179 + zSp1 = __ccgo_ts + 11204 + zSp2 = __ccgo_ts + 11204 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18901, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18935, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -115933,6 +117157,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -115985,6 +117210,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -116034,6 +117260,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -116082,6 +117309,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -116147,7 +117375,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18931, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18965, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -116167,6 +117395,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -116196,7 +117425,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18981, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19015, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -116218,7 +117447,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19045, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19079, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -116240,6 +117469,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -116252,6 +117482,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -116260,7 +117491,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6707, + Fz: __ccgo_ts + 6732, Fn: uint32(8), } @@ -116516,7 +117747,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -116538,6 +117769,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) @@ -116674,6 +117906,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -116703,6 +117936,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -116719,6 +117953,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } } @@ -116850,9 +118085,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } else { /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -116898,6 +118133,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -117013,6 +118249,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -117030,13 +118267,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19082 + z = __ccgo_ts + 19116 case int32(TK_INTERSECT): - z = __ccgo_ts + 19092 + z = __ccgo_ts + 19126 case int32(TK_EXCEPT): - z = __ccgo_ts + 19102 + z = __ccgo_ts + 19136 default: - z = __ccgo_ts + 19109 + z = __ccgo_ts + 19143 break } return z @@ -117057,7 +118294,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19115, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19149, libc.VaList(bp+8, zUsage)) } /* @@ -117092,11 +118329,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19138 + v1 = __ccgo_ts + 19172 } else { v1 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19153, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19187, libc.VaList(bp+8, v1)) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) _sqlite3VdbeGoto(tls, v, addrBreak) @@ -117158,6 +118395,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -117175,6 +118413,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -117285,6 +118524,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -117319,7 +118559,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -117333,7 +118573,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } if iCol < 0 { zType = __ccgo_ts + 1138 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16662 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16696 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -117401,6 +118641,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -117478,13 +118719,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } if iCol < 0 { - zCol = __ccgo_ts + 16662 + zCol = __ccgo_ts + 16696 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -117492,7 +118733,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19184, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19218, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -117502,6 +118743,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -117583,7 +118825,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 16662 + v3 = __ccgo_ts + 16696 } zName = v3 } else { @@ -117598,7 +118840,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19184, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19218, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -117625,6 +118867,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*uint8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -117633,7 +118876,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19193, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19227, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -117650,6 +118893,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -117663,6 +118907,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -117728,6 +118973,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -117744,7 +118990,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19201 + zType = __ccgo_ts + 19235 } else { zType = uintptr(0) j = int32(1) @@ -117758,6 +119004,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -117780,6 +119027,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 16 } @@ -117998,6 +119246,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -118056,7 +119305,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19205, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19239, 0) return } /* Obtain authorization to do a recursive query */ @@ -118087,6 +119336,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -118148,7 +119398,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19254, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19288, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -118157,12 +119407,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19296, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19330, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -118190,13 +119441,14 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19302, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19336, 0) _sqlite3Select(tls, pParse, p, bp) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup /* Keep running the loop until the Queue is empty */ _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -118243,9 +119495,9 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if nRow == int32(1) { v1 = __ccgo_ts + 1650 } else { - v1 = __ccgo_ts + 19317 + v1 = __ccgo_ts + 19351 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19319, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19353, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -118353,8 +119605,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19342, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19357, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19391, 0) } /* Generate code for the left and right SELECT statements. */ @@ -118379,7 +119631,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19082, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19116, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118392,7 +119644,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -118431,7 +119683,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19410, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118489,7 +119741,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19376, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19410, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -118556,6 +119808,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -118580,15 +119833,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -118607,9 +119863,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19397, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19431, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19443, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19477, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -118859,6 +120115,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -118880,6 +120137,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -118905,6 +120163,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -118934,6 +120193,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -118950,6 +120210,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr nSelect++ goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -118965,6 +120226,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -118972,8 +120234,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7344) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7344) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7369) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7369) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -119017,14 +120279,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19525, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19559, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19536, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19570, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -119037,7 +120299,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19541, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19575, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -119252,7 +120514,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5063 + v1 = __ccgo_ts + 5088 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -119293,6 +120555,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -119324,11 +120587,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -119421,11 +120686,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -119540,10 +120807,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -119843,6 +121112,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -119857,6 +121127,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -119965,6 +121236,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -120062,6 +121334,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -120100,6 +121373,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 @@ -120150,10 +121424,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -120231,6 +121507,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -120334,6 +121611,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -120582,6 +121860,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -120620,6 +121902,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -120643,10 +121926,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -120734,6 +122019,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -120756,6 +122042,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -120789,10 +122076,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -120828,13 +122117,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r return uint8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15518) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15552) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15522) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15556) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -120918,10 +122207,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19547, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19581, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -120972,6 +122262,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -120996,6 +122287,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -121043,7 +122335,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19565, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19599, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -121082,6 +122374,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -121089,6 +122382,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -121216,7 +122510,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19588, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19622, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -121240,7 +122534,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19608, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19642, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -121254,6 +122548,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -121261,7 +122556,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19651 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19685 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -121286,12 +122581,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19674, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19708, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -121300,9 +122596,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19712 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19746 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19780 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -121361,13 +122657,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19784, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19818, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) /* The usual case - do not allow ROWID on a subquery */ *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -121516,7 +122813,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19788, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19822, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -121531,7 +122828,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19827, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19861, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -121546,7 +122843,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15086, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15111, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol @@ -121564,6 +122861,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } @@ -121598,6 +122896,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -121666,7 +122965,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6567 + v10 = __ccgo_ts + 6592 } zSchemaName = v10 } @@ -121683,18 +122982,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19858, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19892, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -121755,10 +123058,10 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19863, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19897, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -121771,7 +123074,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12358, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12383, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -121780,23 +123083,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19872, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19906, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19924, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -121804,7 +123110,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19910, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19944, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -121887,6 +123193,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -121983,6 +123290,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -122014,6 +123322,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -122079,6 +123388,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -122141,12 +123451,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19941, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19975, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19992, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20026, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -122167,10 +123477,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20025, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20059, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -122214,6 +123525,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -122228,6 +123540,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -122248,6 +123561,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -122358,6 +123672,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -122398,6 +123713,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -122422,6 +123738,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -122440,6 +123757,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -122464,7 +123782,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20058 + v1 = __ccgo_ts + 20092 } else { v1 = __ccgo_ts + 1650 } @@ -122473,7 +123791,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1650 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20081, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20115, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -122505,7 +123823,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8107) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8132) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -122661,7 +123979,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15812) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15846) != 0 { return 0 } /* Is count() */ if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { @@ -122764,6 +124082,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -122923,7 +124242,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20093, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20127, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -122997,6 +124316,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -123011,6 +124331,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -123022,7 +124343,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20147, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20181, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -123105,6 +124426,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -123202,7 +124524,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20187, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20221, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -123250,7 +124572,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20202, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20236, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -123276,6 +124598,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -123344,6 +124667,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -123356,6 +124680,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -123467,6 +124792,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -123482,6 +124808,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } @@ -123511,6 +124838,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -123654,11 +124982,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20218 + v44 = __ccgo_ts + 20252 } else { - v44 = __ccgo_ts + 20227 + v44 = __ccgo_ts + 20261 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19115, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19149, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -123674,6 +125002,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -123692,6 +125021,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -123753,6 +125083,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -123870,6 +125201,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -123913,6 +125245,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -123972,7 +125305,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20218) + _explainTempTable(tls, pParse, __ccgo_ts+20252) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -123990,6 +125323,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) _sqlite3VdbeExplainPop(tls, pParse) return rc @@ -124086,12 +125420,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20236, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20270, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -124120,12 +125455,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -124230,6 +125567,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -124339,7 +125677,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20301, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20335, 0) goto trigger_cleanup } iDb = int32(1) @@ -124379,7 +125717,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto trigger_cleanup } - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20347, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20381, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -124389,11 +125727,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20355, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20389, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20396, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20430, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -124402,13 +125740,13 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if zName == uintptr(0) { goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20347, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20381, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20436, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20470, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { _sqlite3CodeVerifySchema(tls, pParse, iDb) } @@ -124416,8 +125754,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6502, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20462, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6527, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20496, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -124425,15 +125763,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20500 + v1 = __ccgo_ts + 20534 } else { - v1 = __ccgo_ts + 20507 + v1 = __ccgo_ts + 20541 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20513, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20547, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20550, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20584, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -124453,9 +125791,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6510 + v3 = __ccgo_ts + 6535 } else { - v3 = __ccgo_ts + 6043 + v3 = __ccgo_ts + 6068 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -124497,6 +125835,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 pColumns = uintptr(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -124507,6 +125846,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -124551,7 +125891,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20347, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20381, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -124573,11 +125913,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20596, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20630, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -124588,10 +125929,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20644, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20678, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20719, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20753, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -124609,6 +125950,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _sqlite3DeleteTriggerStep(tls, db, pStepList) } @@ -124635,6 +125977,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -124851,11 +126194,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20748, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20782, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -124864,6 +126208,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -124895,9 +126240,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6510 + v1 = __ccgo_ts + 6535 } else { - v1 = __ccgo_ts + 6043 + v1 = __ccgo_ts + 6068 } zTab = v1 if iDb == int32(1) { @@ -124912,7 +126257,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20768, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20802, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -124943,6 +126288,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -124979,6 +126325,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -125043,11 +126390,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20830 + v1 = __ccgo_ts + 20864 } else { - v1 = __ccgo_ts + 20837 + v1 = __ccgo_ts + 20871 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20844, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20878, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -125065,6 +126412,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -125146,7 +126494,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20892, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20926, 0) return int32(1) } @@ -125191,6 +126539,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -125204,6 +126553,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -125282,6 +126632,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -125334,7 +126685,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6240, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6265, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -125355,6 +126706,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -125435,7 +126787,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20934, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20968, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -125500,6 +126852,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -125610,6 +126963,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -125673,6 +127027,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -125867,6 +127222,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -125885,6 +127241,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -125907,6 +127264,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -126039,6 +127397,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -126068,6 +127427,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -126116,7 +127476,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20948, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -126126,6 +127486,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -126135,13 +127496,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20984, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7882 + v11 = __ccgo_ts + 7907 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -126155,6 +127516,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } chngKey = uint8(int32(chngRowid) + int32(chngPk)) @@ -126185,6 +127547,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -126240,6 +127603,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -126249,6 +127613,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -126467,6 +127832,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -126536,6 +127902,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -126592,6 +127959,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -126656,6 +128024,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -126706,6 +128075,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -126814,9 +128184,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21003) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21037) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -126910,6 +128281,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -126943,6 +128315,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -126991,6 +128364,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -127106,7 +128480,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -127207,6 +128581,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -127215,6 +128590,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -127223,22 +128599,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]uint8)(unsafe.Pointer(bp + 200)))[0] = uint8(0) } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21016, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21050, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21020, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21054, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -127259,14 +128645,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -127326,10 +128718,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12447, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12472, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -127348,6 +128741,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -127410,7 +128804,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21093, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21097, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21127, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21131, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -127511,6 +128905,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -127536,17 +128931,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21101) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21135) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21141) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21175) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21184) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21218) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -127585,7 +128980,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21202, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21236, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -127597,7 +128992,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21225) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21259) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -127614,7 +129009,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14856) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14881) if rc != SQLITE_OK { goto end_of_vacuum } @@ -127645,11 +129040,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21252, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21286, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21360, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21394, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -127658,7 +129053,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21414, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21448, libc.VaList(bp+24, zDbMain)) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { goto end_of_vacuum @@ -127668,7 +129063,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21565, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21599, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -127687,6 +129082,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -127707,6 +129103,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -127900,6 +129297,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -127909,6 +129307,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -127965,6 +129364,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -128066,6 +129466,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -128151,6 +129552,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -128187,7 +129589,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12677, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12702, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -128310,7 +129712,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21695, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21729, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -128320,11 +129722,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21719, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21753, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21818, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21852, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -128411,11 +129813,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21837, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21871, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -128452,7 +129855,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21879, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21913, libc.VaList(bp+48, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3797, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) @@ -128467,7 +129870,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21909 + zFormat = __ccgo_ts + 21943 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -128501,11 +129904,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16553, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16587, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -128523,6 +129927,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*uint8)(unsafe.Pointer(zType + uintptr(j))) = *(*uint8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -128537,6 +129942,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -128579,7 +129985,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21955, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21989, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -128666,7 +130072,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21955, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21989, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -128701,9 +130107,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _sqlite3ParseObjectInit(tls, bp, db) @@ -128799,6 +130205,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -128857,6 +130264,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -128897,6 +130305,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -128964,6 +130373,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -129037,6 +130447,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -129142,6 +130553,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -129274,7 +130686,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { ap = va switch op { @@ -129287,7 +130699,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -130009,10 +131421,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21974 + return __ccgo_ts + 22008 } if i == -int32(1) { - return __ccgo_ts + 16662 + return __ccgo_ts + 16696 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -130031,10 +131443,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, var i int32 _ = i if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22015, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(1)) } i = 0 for { @@ -130042,19 +131454,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13092, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(1)) } i = 0 for { @@ -130062,15 +131475,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13092, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5085, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5110, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } } @@ -130103,7 +131517,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21989, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22023, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -130111,27 +131525,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22015, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21992 + v2 = __ccgo_ts + 22026 } else { - v2 = __ccgo_ts + 21997 + v2 = __ccgo_ts + 22031 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22039) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22007) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22041) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) } // C documentation @@ -130174,47 +131589,47 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22009 + v2 = __ccgo_ts + 22043 } else { - v2 = __ccgo_ts + 22016 + v2 = __ccgo_ts + 22050 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22021, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22055, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11230 + zFmt = __ccgo_ts + 11255 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22027 + zFmt = __ccgo_ts + 22061 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22060 + zFmt = __ccgo_ts + 22094 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22085 + zFmt = __ccgo_ts + 22119 } else { - zFmt = __ccgo_ts + 22103 + zFmt = __ccgo_ts + 22137 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22112, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22146, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16662 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22120, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 16696 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22154, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = uint8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22151, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22185, libc.VaList(bp+144, zRowid)) cRangeOp = uint8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -130224,10 +131639,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22161, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22195, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22166, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22200, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -130246,7 +131661,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22193, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22227, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -130280,14 +131695,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22204, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22238, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21992, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22026, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22259, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -130297,15 +131712,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21981, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22015, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21992, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22026, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5108, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -130444,6 +131860,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -130520,6 +131937,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -130554,11 +131972,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -130617,6 +132037,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -130629,6 +132050,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -130743,6 +132165,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -130861,6 +132284,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -130911,6 +132335,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -130978,6 +132403,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -131015,6 +132441,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -131056,6 +132483,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -131199,6 +132627,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -131260,6 +132689,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -131360,6 +132790,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -131390,6 +132821,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -131784,6 +133216,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -131873,6 +133306,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104)) goto _48 _48: + ; k++ } } else { @@ -131963,6 +133397,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -131978,7 +133413,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22233, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22267, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -132001,7 +133436,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22248, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22282, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) if pSubWInfo != 0 { addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) @@ -132035,6 +133470,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -132106,6 +133542,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -132229,6 +133666,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -132284,6 +133722,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -132316,6 +133755,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -132356,6 +133796,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -132376,10 +133817,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -132465,7 +133908,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22257, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22291, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -132479,6 +133922,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -132501,6 +133945,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -132534,6 +133979,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -132776,6 +134222,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*uint8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*uint8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*uint8)(unsafe.Pointer(zNew + uintptr(iTo))) = uint8(0) @@ -132901,6 +134348,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -132964,19 +134412,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16511, + FzOp: __ccgo_ts + 16545, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15842, + FzOp: __ccgo_ts + 15876, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15321, + FzOp: __ccgo_ts + 15355, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22271, + FzOp: __ccgo_ts + 22305, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -133095,6 +134543,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp } goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -133261,6 +134710,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -133287,6 +134737,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -133392,6 +134843,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } @@ -133433,11 +134885,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -133461,6 +134915,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } @@ -133557,6 +135012,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -133609,14 +135065,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -133656,10 +135115,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -133750,7 +135211,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22278, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22312, 0) return } } else { @@ -133762,7 +135223,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22278, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22312, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -133846,7 +135307,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } else { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7868 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7893 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -133868,6 +135329,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -133919,6 +135381,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = _sqlite3UpperToLower[c] goto _11 _11: + ; i1++ } } @@ -133940,7 +135403,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22319 + v13 = __ccgo_ts + 22353 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -133993,6 +135456,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -134015,6 +135479,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -134210,6 +135675,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -134231,6 +135697,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -134394,6 +135861,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -134421,6 +135889,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -134460,7 +135929,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22326, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22360, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -134487,6 +135956,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -134665,6 +136135,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -134761,6 +136232,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -134782,6 +136254,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -134789,6 +136262,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -134819,6 +136293,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -134930,6 +136405,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -134967,6 +136443,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -135135,6 +136612,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -135203,6 +136681,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -135244,6 +136723,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -135252,6 +136732,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -135318,6 +136799,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -135454,7 +136936,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -138258,6 +139772,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -138384,6 +139899,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -138417,6 +139933,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -138491,6 +140008,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -138530,7 +140048,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22399, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22433, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 @@ -138592,6 +140110,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -138604,11 +140123,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22399, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22433, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } (*(*struct { @@ -138755,7 +140275,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -138805,6 +140325,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -138816,6 +140337,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -138923,6 +140445,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -139055,16 +140578,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -139096,11 +140622,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -139171,6 +140699,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -139184,7 +140713,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22425, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22459, 0) rc = SQLITE_OK } else { break @@ -139192,6 +140721,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -139337,6 +140867,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -139354,6 +140885,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -139426,6 +140958,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -139503,6 +141036,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -139541,6 +141075,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -139568,11 +141103,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -139595,6 +141132,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -139752,6 +141290,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -139873,6 +141412,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -139938,16 +141478,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -139958,10 +141501,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22460, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22494, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -139977,6 +141521,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } /* Load the lowest cost path into pWInfo */ @@ -139993,6 +141538,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -140125,6 +141671,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140142,6 +141689,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -140280,6 +141828,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -140297,6 +141846,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -140306,6 +141856,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- goto _1 _1: + ; i-- } return notReady @@ -140360,6 +141911,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -140378,9 +141930,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 for { @@ -140390,11 +141942,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -140424,7 +141974,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i))) } @@ -140435,6 +141985,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -140464,6 +142015,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -140583,7 +142135,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22478, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22512, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -140655,7 +142207,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22506, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22540, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -140677,6 +142229,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -140735,6 +142288,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -140907,6 +142461,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -141010,6 +142565,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -141060,6 +142616,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -141067,6 +142624,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -141137,6 +142695,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -141213,6 +142772,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -141250,6 +142810,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } i = 0 @@ -141354,6 +142915,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -141363,6 +142925,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -141641,7 +143204,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22524, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22558, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -141823,7 +143387,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22580, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22614, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -142145,10 +143709,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22625, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22659, libc.VaList(bp+8, zName)) } return p } @@ -142199,12 +143764,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22644, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22678, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22715, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22749, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -142277,12 +143842,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8107) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8132) } break } goto _1 _1: + ; i++ } } @@ -142350,6 +143916,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -142372,6 +143939,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -142397,6 +143965,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -142527,6 +144096,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -142554,7 +144124,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt bp := tls.Alloc(16) defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22778, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22812, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -142685,6 +144255,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -142839,7 +144410,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22804, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22838, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -142858,6 +144429,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -142905,18 +144477,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22836 + zErr = __ccgo_ts + 22870 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22853 + zErr = __ccgo_ts + 22887 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22869 + zErr = __ccgo_ts + 22903 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22889, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22923, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -142940,7 +144512,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22922, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22956, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -143116,6 +144688,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143157,11 +144730,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22969, - 1: __ccgo_ts + 23022, - 2: __ccgo_ts + 22524, - 3: __ccgo_ts + 23073, - 4: __ccgo_ts + 23125, + 0: __ccgo_ts + 23003, + 1: __ccgo_ts + 23056, + 2: __ccgo_ts + 22558, + 3: __ccgo_ts + 23107, + 4: __ccgo_ts + 23159, } var _aOp1 = [5]int32{ @@ -143324,6 +144897,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -143382,6 +144956,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -143426,6 +145001,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -143452,6 +145028,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143502,6 +145079,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143550,6 +145128,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -143685,6 +145264,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -143730,6 +145310,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -143760,6 +145341,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -144114,6 +145696,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -144602,6 +146185,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -144930,11 +146514,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23175 + v1 = __ccgo_ts + 23209 } else { - v1 = __ccgo_ts + 23184 + v1 = __ccgo_ts + 23218 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23190, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23224, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -144943,7 +146527,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23232, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23266, 0) } } } @@ -145032,7 +146616,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23266, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23300, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -151345,103 +152929,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -151566,7 +153150,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23304, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23338, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -153080,289 +154664,387 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16662, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16696, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23326, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16575, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16609, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23326, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -153386,17 +155068,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -153404,10 +155091,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -153421,73 +155110,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -153521,142 +155234,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23353) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23387) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -153669,74 +155428,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -153747,18 +155527,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -153769,7 +155553,7 @@ _200: /* expr ::= VARIABLE */ ** in the virtual machine. #N is the N-th register. */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23396, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -153779,47 +155563,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -153831,23 +155625,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -153860,7 +155664,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -153874,33 +155679,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -153909,17 +155723,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -153932,7 +155750,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -153944,9 +155763,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 7863 + v345 = __ccgo_ts + 7888 } else { - v345 = __ccgo_ts + 7868 + v345 = __ccgo_ts + 7893 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -153989,18 +155808,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -154017,13 +155839,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -154038,73 +155862,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -154113,236 +155959,309 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23386, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23420, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23481, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23515, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23565, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23599, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = uint8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -154351,11 +156270,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -154365,22 +156286,27 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: + ; goto _342 /********** End reduce actions ************************************************/ _342: + ; yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) @@ -154413,9 +156339,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23396, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23650, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23684, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -156464,6 +158390,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -156643,6 +158570,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -156658,6 +158586,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -156702,6 +158631,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -156797,6 +158727,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -156830,6 +158761,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -156841,6 +158773,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -156875,6 +158808,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -156893,6 +158827,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -156916,6 +158851,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -156938,6 +158874,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -156956,6 +158893,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -156977,6 +158915,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -157089,7 +159028,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23667, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23701, libc.VaList(bp+2456, bp+2432)) break } } @@ -157113,7 +159052,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3797, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23692, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23726, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -157228,7 +159167,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*uint8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*uint8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -157238,9 +159177,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -157254,7 +159193,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -157266,7 +159205,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*uint8)(unsafe.Pointer(zSql)) != 0 && int32(*(*uint8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -157275,9 +159214,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*uint8)(unsafe.Pointer(zSql))) @@ -157298,13 +159237,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*uint8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23703, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23737, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -157312,13 +159252,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20347, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20381, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23710, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23744, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23715, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23749, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -157328,10 +159268,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23725, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23759, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23729, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23763, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -157591,6 +159531,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -157762,8 +159704,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -157771,7 +159713,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -158890,31 +160851,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23805, - 1: __ccgo_ts + 23818, - 3: __ccgo_ts + 23834, - 4: __ccgo_ts + 23859, - 5: __ccgo_ts + 23873, - 6: __ccgo_ts + 23892, + 0: __ccgo_ts + 23839, + 1: __ccgo_ts + 23852, + 3: __ccgo_ts + 23868, + 4: __ccgo_ts + 23893, + 5: __ccgo_ts + 23907, + 6: __ccgo_ts + 23926, 7: __ccgo_ts + 1620, - 8: __ccgo_ts + 23917, - 9: __ccgo_ts + 23954, - 10: __ccgo_ts + 23966, - 11: __ccgo_ts + 23981, - 12: __ccgo_ts + 24014, - 13: __ccgo_ts + 24032, - 14: __ccgo_ts + 24057, - 15: __ccgo_ts + 24086, - 17: __ccgo_ts + 5998, - 18: __ccgo_ts + 5400, - 19: __ccgo_ts + 24103, - 20: __ccgo_ts + 24121, - 21: __ccgo_ts + 24139, - 23: __ccgo_ts + 24173, - 25: __ccgo_ts + 24194, - 26: __ccgo_ts + 24220, - 27: __ccgo_ts + 24243, - 28: __ccgo_ts + 24264, + 8: __ccgo_ts + 23951, + 9: __ccgo_ts + 23988, + 10: __ccgo_ts + 24000, + 11: __ccgo_ts + 24015, + 12: __ccgo_ts + 24048, + 13: __ccgo_ts + 24066, + 14: __ccgo_ts + 24091, + 15: __ccgo_ts + 24120, + 17: __ccgo_ts + 6023, + 18: __ccgo_ts + 5425, + 19: __ccgo_ts + 24137, + 20: __ccgo_ts + 24155, + 21: __ccgo_ts + 24173, + 23: __ccgo_ts + 24207, + 25: __ccgo_ts + 24228, + 26: __ccgo_ts + 24254, + 27: __ccgo_ts + 24277, + 28: __ccgo_ts + 24298, } // C documentation @@ -159093,7 +161054,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i var p, v1 uintptr _, _, _, _ = extraFlags, p, rc, v1 if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) @@ -159136,7 +161097,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24361, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24395, 0) return int32(SQLITE_BUSY) } else { _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -159207,6 +161168,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -159260,7 +161222,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24424, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24458, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -159535,7 +161497,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*uint8)(unsafe.Pointer(zDb)) != 0 { @@ -159545,7 +161507,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24475, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24509, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -159618,6 +161580,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -159666,7 +161629,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -159798,7 +161761,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -159808,7 +161771,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -159857,7 +161820,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -159866,7 +161829,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24496, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24530, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -159892,6 +161855,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -160012,7 +161976,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u flags = *(*uint32)(unsafe.Pointer(pFlags)) zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24564, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Config)) + 6)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24598, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -160026,6 +161990,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -160041,8 +162006,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*uint8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24570, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24580, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24604, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24614, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -160131,20 +162096,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24608, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24642, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24612, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24646, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24612 + zModeType = __ccgo_ts + 24646 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24633, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24667, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -160173,15 +162138,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24648, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24682, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24668, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24702, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -160205,10 +162171,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24692, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24726, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -160223,11 +162190,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24618, + Fz: __ccgo_ts + 24652, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24625, + Fz: __ccgo_ts + 24659, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -160238,19 +162205,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24638, + Fz: __ccgo_ts + 24672, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24641, + Fz: __ccgo_ts + 24675, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24644, + Fz: __ccgo_ts + 24678, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17732, + Fz: __ccgo_ts + 17766, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -160378,8 +162345,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22319, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24708, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22353, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24742, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -160400,7 +162367,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -160436,9 +162403,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6562 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6587 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23710 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23744 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -160460,6 +162427,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -160483,6 +162451,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } @@ -160529,7 +162498,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24714 + zFilename = __ccgo_ts + 24748 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -160644,6 +162613,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -160669,6 +162639,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -160744,20 +162715,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24717, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24751, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24742) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24776) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24762) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24796) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24769) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24803) } // C documentation @@ -160822,6 +162793,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -160863,6 +162835,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -160885,7 +162858,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24786, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24820, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -161527,6 +163500,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -161546,6 +163520,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -161911,7 +163886,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24814, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24848, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -161927,6 +163902,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -162012,6 +163988,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -162032,6 +164009,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -162110,6 +164088,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -162125,7 +164104,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } _leaveMutex(tls) if rc != 0 { - v2 = __ccgo_ts + 24822 + v2 = __ccgo_ts + 24856 } else { v2 = uintptr(0) } @@ -163006,18 +164985,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1636, - 1: __ccgo_ts + 7863, - 2: __ccgo_ts + 7868, - 3: __ccgo_ts + 6283, - 4: __ccgo_ts + 6283, - 5: __ccgo_ts + 6278, - 6: __ccgo_ts + 6278, - 7: __ccgo_ts + 8174, - 8: __ccgo_ts + 8174, - 9: __ccgo_ts + 8174, - 10: __ccgo_ts + 8174, - 11: __ccgo_ts + 24845, - 12: __ccgo_ts + 24851, + 1: __ccgo_ts + 7888, + 2: __ccgo_ts + 7893, + 3: __ccgo_ts + 6308, + 4: __ccgo_ts + 6308, + 5: __ccgo_ts + 6303, + 6: __ccgo_ts + 6303, + 7: __ccgo_ts + 8199, + 8: __ccgo_ts + 8199, + 9: __ccgo_ts + 8199, + 10: __ccgo_ts + 8199, + 11: __ccgo_ts + 24879, + 12: __ccgo_ts + 24885, 13: __ccgo_ts + 1650, 14: __ccgo_ts + 1650, 15: __ccgo_ts + 1650, @@ -163445,6 +165424,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -163532,6 +165512,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -163548,6 +165529,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -163857,6 +165839,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -163870,6 +165853,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = c goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -163902,13 +165886,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24858 + uintptr(int32(c)>>int32(4)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24892 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24858 + uintptr(int32(c)&int32(0xf)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24892 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -163943,7 +165928,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1636, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24875, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15325, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -163964,7 +165949,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24883, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24909, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -164018,7 +166003,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24938, -int32(1)) } } } @@ -164186,6 +166171,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -164208,6 +166194,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -164264,6 +166251,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -164297,8 +166285,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(3), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24927, - FzRepl: __ccgo_ts + 24931, + FzMatch: __ccgo_ts + 24953, + FzRepl: __ccgo_ts + 24957, }, 1: { Fc1: uint8('i'), @@ -164306,8 +166294,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(8), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24939, - FzRepl: __ccgo_ts + 24931, + FzMatch: __ccgo_ts + 24965, + FzRepl: __ccgo_ts + 24957, }, 2: { Fc1: uint8('n'), @@ -164322,7 +166310,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('Q'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24948, + FzMatch: __ccgo_ts + 24974, FzRepl: __ccgo_ts + 1636, }, 4: { @@ -164330,7 +166318,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('S'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24953, + FzMatch: __ccgo_ts + 24979, FzRepl: __ccgo_ts + 1636, }, } @@ -164346,7 +166334,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24958, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24984, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -164766,6 +166754,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -164797,7 +166786,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+25001, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25027, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -164914,6 +166903,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) { case int32('{'): goto _1 @@ -164994,6 +166984,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -165066,6 +167057,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -165105,12 +167097,14 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -165173,19 +167167,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*uint8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -165247,24 +167245,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7863, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7888, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7868, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7893, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -165274,19 +167276,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) c = *(*uint8)(unsafe.Pointer(z + uintptr(i))) if int32(c) <= int32('0') { @@ -165301,6 +167315,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -165315,14 +167330,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24927, int32(3)) == 0 { + if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24953, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25010) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25036) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25023, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25049, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -165352,6 +167367,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -165361,6 +167377,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*uint8)(unsafe.Pointer(z + uintptr(j))) @@ -165405,6 +167422,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -165417,39 +167435,57 @@ parse_number_2: } } parse_number_finish: + ; if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { i++ } _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -165459,12 +167495,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1636, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*uint8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -165482,7 +167520,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -165490,11 +167528,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -165525,7 +167565,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*uint8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -165538,7 +167578,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -165560,6 +167600,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint64(72)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -165696,22 +167740,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1636, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7863, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7888, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7868, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7893, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -165744,16 +167794,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24931 + v19 = __ccgo_ts + 24957 } else { - v19 = __ccgo_ts + 11730 + v19 = __ccgo_ts + 11755 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -165776,16 +167828,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, uint8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, uint8('"')) @@ -165797,6 +167853,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -165808,7 +167865,7 @@ _11: sz2 -= k2 } if int32(*(*uint8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25029, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25055, uint32(2)) zIn2++ sz2-- continue @@ -165822,7 +167879,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, uint8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25032, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25058, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -165830,12 +167887,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25039, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25065, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25044, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25070, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*uint8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -165864,9 +167921,11 @@ _11: _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, uint8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -165884,6 +167943,7 @@ _13: _jsonAppendChar(tls, pOut, uint8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, uint8('{')) j = i + n @@ -165909,11 +167969,14 @@ _14: _jsonAppendChar(tls, pOut, uint8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -165984,6 +168047,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -166400,6 +168464,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -166418,6 +168483,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -166631,7 +168697,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -166666,25 +168732,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -166729,11 +168800,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -166746,11 +168820,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -166818,13 +168896,16 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ *(*uint8)(unsafe.Pointer(zOut + uintptr(iOut))) = uint8(0) Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -166838,14 +168919,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24912, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24938, -int32(1)) return } @@ -166886,7 +168971,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24883, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24909, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -166899,7 +168984,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint64(72)) return int32(1) @@ -166918,10 +169003,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*uint8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25017) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25043) } else { if int32(*(*uint8)(unsafe.Pointer(z))) == int32('-') && int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25010) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25036) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -166960,7 +169045,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25051, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25077, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -167046,15 +169131,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -167139,6 +169226,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -167182,12 +169270,12 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -167227,15 +169315,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -167327,6 +169417,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, uint8(']')) @@ -167364,7 +169455,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25069 + v1 = __ccgo_ts + 25095 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -167374,7 +169465,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } eErr = uint8(1) @@ -167405,6 +169496,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -167423,6 +169515,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -167496,9 +169589,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25097, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5138, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5163, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1663, uint32(1)) @@ -167507,9 +169600,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*uint8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25073, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25099, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25076, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25102, uint32(1)) } } } @@ -167549,7 +169642,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -167559,6 +169652,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -167569,6 +169663,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -167814,7 +169909,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -167838,7 +169933,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25078, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25104, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -167849,7 +169944,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25129, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25155, -int32(1)) _jsonStringReset(tls, bp) return } @@ -167861,6 +169956,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, uint8('}')) @@ -167920,21 +170016,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -167952,7 +170051,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15764) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15798) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -167983,9 +170082,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25163 + v1 = __ccgo_ts + 25189 } else { - v1 = __ccgo_ts + 25167 + v1 = __ccgo_ts + 25193 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -168033,7 +170132,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24912, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24938, -int32(1)) } } goto json_type_done @@ -168043,6 +170142,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -168120,7 +170220,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25174, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25200, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -168227,6 +170327,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -168310,7 +170411,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25231, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25257, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -168376,6 +170477,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -168458,7 +170560,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25234, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25260, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -168561,7 +170663,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25237) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25263) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -168695,7 +170797,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { var _ /* sz at bp+0 */ Tu32 _, _, _, _, _ = i, k, n, needQuote, z if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25320, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25346, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -168716,13 +170818,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25327, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25353, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25335, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25361, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -168884,6 +170987,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -168913,9 +171019,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -168974,6 +171080,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -169104,7 +171211,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25341, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25367, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -169125,8 +171232,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24912, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24938, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -169187,176 +171295,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25343, + FzName: __ccgo_ts + 25369, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25348, + FzName: __ccgo_ts + 25374, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25354, + FzName: __ccgo_ts + 25380, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25365, + FzName: __ccgo_ts + 25391, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25377, + FzName: __ccgo_ts + 25403, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25377, + FzName: __ccgo_ts + 25403, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25395, + FzName: __ccgo_ts + 25421, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25415, + FzName: __ccgo_ts + 25441, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25428, + FzName: __ccgo_ts + 25454, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25442, + FzName: __ccgo_ts + 25468, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25445, + FzName: __ccgo_ts + 25471, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25449, + FzName: __ccgo_ts + 25475, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25461, + FzName: __ccgo_ts + 25487, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25474, + FzName: __ccgo_ts + 25500, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25486, + FzName: __ccgo_ts + 25512, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25499, + FzName: __ccgo_ts + 25525, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25510, + FzName: __ccgo_ts + 25536, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25522, + FzName: __ccgo_ts + 25548, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25533, + FzName: __ccgo_ts + 25559, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25545, + FzName: __ccgo_ts + 25571, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25558, + FzName: __ccgo_ts + 25584, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25571, + FzName: __ccgo_ts + 25597, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25585, + FzName: __ccgo_ts + 25611, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25594, + FzName: __ccgo_ts + 25620, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25604, + FzName: __ccgo_ts + 25630, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25604, + FzName: __ccgo_ts + 25630, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25614, + FzName: __ccgo_ts + 25640, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25614, + FzName: __ccgo_ts + 25640, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25625, + FzName: __ccgo_ts + 25651, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25642, + FzName: __ccgo_ts + 25668, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25660, + FzName: __ccgo_ts + 25686, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25678, + FzName: __ccgo_ts + 25704, }, } @@ -169426,6 +171534,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -169436,11 +171545,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25697, + FzName: __ccgo_ts + 25723, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25707, + FzName: __ccgo_ts + 25733, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -169970,6 +172079,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -170004,6 +172114,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -170043,11 +172154,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -170087,10 +172196,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25717, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25743, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -170144,6 +172252,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -170172,6 +172281,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -170391,7 +172501,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25722, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25748, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -170452,6 +172562,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -170465,6 +172576,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -170488,7 +172600,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -170795,6 +172909,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -171224,6 +173345,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -171299,7 +173423,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25804) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25830) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -171436,6 +173560,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -171523,6 +173648,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } ii = 0 @@ -171541,6 +173667,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -171592,6 +173719,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -171754,6 +173882,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -171769,6 +173898,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -171852,11 +173982,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -171912,6 +174044,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -171935,6 +174068,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -171943,6 +174077,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -172115,11 +174250,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -172150,6 +174287,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -172163,6 +174301,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -172172,6 +174311,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48)) @@ -172198,6 +174338,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -172225,6 +174366,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -172273,6 +174415,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -172353,6 +174496,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -172368,6 +174512,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -172384,6 +174529,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -172428,6 +174574,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -172518,6 +174665,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -172627,6 +174775,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -172729,6 +174878,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -172807,7 +174957,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25818, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25844, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -172817,11 +174967,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25838, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25864, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25870, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25896, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -172895,6 +175045,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -172911,6 +175062,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -172974,6 +175126,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -172981,6 +175134,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -172994,7 +175148,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -173013,6 +175167,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -173026,7 +175184,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25907, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25933, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -173080,9 +175238,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26052 + zFmt = __ccgo_ts + 26078 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11559, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11584, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -173133,15 +175291,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26108, - 1: __ccgo_ts + 5461, - 2: __ccgo_ts + 16662, + 0: __ccgo_ts + 26134, + 1: __ccgo_ts + 5486, + 2: __ccgo_ts + 16696, } var _rtreeModule = Tsqlite3_module{ @@ -173166,7 +175325,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) @@ -173185,20 +175344,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26522, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26548, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26584, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26610, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26589, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26653, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26723, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26615, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26679, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26749, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -173228,7 +175388,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 26772 + zFormat = __ccgo_ts + 26798 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -173239,33 +175399,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26880, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26906, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26925, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26951, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13067, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13092, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26952, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26978, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26974, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27000, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26982, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27008, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -173279,14 +175441,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26113, - 1: __ccgo_ts + 26166, - 2: __ccgo_ts + 26211, - 3: __ccgo_ts + 26263, - 4: __ccgo_ts + 26317, - 5: __ccgo_ts + 26362, - 6: __ccgo_ts + 26420, - 7: __ccgo_ts + 26475, + 0: __ccgo_ts + 26139, + 1: __ccgo_ts + 26192, + 2: __ccgo_ts + 26237, + 3: __ccgo_ts + 26289, + 4: __ccgo_ts + 26343, + 5: __ccgo_ts + 26388, + 6: __ccgo_ts + 26446, + 7: __ccgo_ts + 26501, } // C documentation @@ -173344,7 +175506,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26998, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27024, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -173355,14 +175517,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3797, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27018, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27044, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+32) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3797, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -173439,13 +175601,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27261, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27287, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27267, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27293, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -173454,7 +175616,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27291, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27317, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -173465,9 +175627,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27318, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27344, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -173519,6 +175682,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -173527,8 +175691,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27297, - 1: __ccgo_ts + 27308, + 0: __ccgo_ts + 27323, + 1: __ccgo_ts + 27334, } // C documentation @@ -173586,22 +175750,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11179, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11204, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27321, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27347, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27327, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27353, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27331, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27357, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -173625,7 +175791,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27333, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27359, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -173743,11 +175909,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4180 + v1 = __ccgo_ts + 4205 } else { v1 = __ccgo_ts + 1650 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27366, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27392, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -173781,7 +175947,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27373, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27399, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -173798,7 +175964,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27418, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27444, libc.VaList(bp+8, iNode)) } } return pRet @@ -173827,8 +175993,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27450, - 1: __ccgo_ts + 27504, + 0: __ccgo_ts + 27476, + 1: __ccgo_ts + 27530, } if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) @@ -173841,21 +176007,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27552 + v1 = __ccgo_ts + 27578 } else { - v1 = __ccgo_ts + 27560 + v1 = __ccgo_ts + 27586 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27569, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27595, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27552 + v2 = __ccgo_ts + 27578 } else { - v2 = __ccgo_ts + 27560 + v2 = __ccgo_ts + 27586 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27614, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27640, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -173900,7 +176066,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27672, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27698, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -173918,11 +176084,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27720, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27746, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -173950,19 +176117,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27787, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27813, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27821, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27847, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27851, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27877, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -173982,6 +176149,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -174006,12 +176174,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27906, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27932, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27937, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27963, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -174040,7 +176208,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28004, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28030, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -174050,11 +176218,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25818, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25844, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28032, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28058, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -174070,8 +176238,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28063, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28070, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28089, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28096, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -174098,7 +176266,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28078, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28104, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -174149,13 +176317,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28097, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28123, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6562 + zDb = __ccgo_ts + 6587 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -174164,7 +176332,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18429 + v1 = __ccgo_ts + 18463 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -174387,6 +176555,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -174497,6 +176666,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -174557,6 +176727,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -174627,18 +176798,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25071, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25097, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28148, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28174, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28159, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28185, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -174667,19 +176839,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = uint8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28170, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28196, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28188, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28214, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = uint8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28196, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28222, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -174687,13 +176860,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*uint8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28204, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28230, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28208, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28234, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -174745,6 +176919,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -174774,6 +176949,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -174839,6 +177015,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -174916,6 +177093,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -174985,6 +177163,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -174994,6 +177173,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -175021,18 +177201,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) } _2: + ; return pOut } @@ -175215,6 +177399,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -175391,6 +177576,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -175457,6 +177643,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -175465,6 +177652,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -175476,6 +177664,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -175544,6 +177733,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -175560,6 +177750,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -175626,6 +177817,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -175650,6 +177842,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -175686,6 +177879,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -175710,6 +177904,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -175799,13 +177994,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27261, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27287, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28221, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28247, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -175814,12 +178009,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28243, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28269, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27318, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27344, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -175848,6 +178044,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -175995,6 +178192,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -176045,11 +178243,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16662 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16696 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -176059,7 +178258,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28247 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28273 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -176067,7 +178266,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28253 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28279 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -176187,7 +178386,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28262, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28288, 0) } goto geopoly_update_end } @@ -176266,6 +178465,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -176274,6 +178474,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -176287,12 +178488,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28302) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28328) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28318) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28344) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -176348,6 +178549,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -176358,10 +178560,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28495, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28521, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -176375,61 +178578,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28333, + FzName: __ccgo_ts + 28359, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28346, + FzName: __ccgo_ts + 28372, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28359, + FzName: __ccgo_ts + 28385, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28372, + FzName: __ccgo_ts + 28398, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28318, + FzName: __ccgo_ts + 28344, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28384, + FzName: __ccgo_ts + 28410, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28302, + FzName: __ccgo_ts + 28328, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28407, + FzName: __ccgo_ts + 28433, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28421, + FzName: __ccgo_ts + 28447, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28434, + FzName: __ccgo_ts + 28460, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28448, + FzName: __ccgo_ts + 28474, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28464, + FzName: __ccgo_ts + 28490, }, } @@ -176455,7 +178658,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28476, + FzName: __ccgo_ts + 28502, }, } @@ -176480,20 +178683,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28503, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28529, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28513, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28539, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28524, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28550, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28247, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28273, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28535, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28561, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -176538,6 +178741,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -176587,13 +178791,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25804, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25830, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -177810,7 +180015,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28571, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -177820,7 +180025,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28545, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28571, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -177922,6 +180127,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -178000,7 +180206,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28566, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28592, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -178088,7 +180294,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25717, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25743, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -178096,6 +180302,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*uint8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -178124,13 +180331,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint64(192)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28737 + v1 = __ccgo_ts + 28763 } else { v1 = __ccgo_ts + 1650 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28778, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28804, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28928) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28954) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -178358,7 +180565,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29053, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29079, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -178368,7 +180575,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29172, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29198, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -178376,7 +180583,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29193, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29219, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -178388,7 +180595,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29244, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29270, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -178399,6 +180606,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -178407,6 +180615,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -178429,7 +180638,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -178442,7 +180651,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -178495,7 +180704,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19872, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19906, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -178506,7 +180715,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29322, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29348, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -178517,7 +180726,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29341, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29367, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -178525,12 +180734,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29346, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29372, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178538,17 +180748,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29356 + v4 = __ccgo_ts + 29382 } else { - v4 = __ccgo_ts + 29369 + v4 = __ccgo_ts + 29395 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29378, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29404, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29407, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29433, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -178565,11 +180775,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29429, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29455, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -178615,10 +180826,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29456, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29482, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14992 goto _1 _1: + ; i++ } return zList @@ -178649,12 +180861,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29465, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29491, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -178696,21 +180909,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29478, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29504, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29510, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29536, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+29533) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29539, __ccgo_ts+29546, __ccgo_ts+5083) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+29559) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29565, __ccgo_ts+29572, __ccgo_ts+5108) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+1650) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29554, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29580, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29596, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -178762,7 +180975,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1650 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -178779,19 +180992,20 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 29616 + zCol = __ccgo_ts + 29642 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29624, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29645, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29681, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14967 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29650, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29671, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29707, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14992 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -178800,7 +181014,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29708, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29734, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { zSep = __ccgo_ts + 1650 iCol = 0 @@ -178817,19 +181031,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29756, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14967 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29782, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14992 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29763, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29789, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -178880,7 +181096,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zAnd = __ccgo_ts + 1650 /* Set to " AND " later on */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -178889,7 +181105,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29775, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29801, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) zType = __ccgo_ts + 1650 } else { if iCid < 0 { @@ -178903,14 +181119,15 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29616 + zCol = __ccgo_ts + 29642 } else { - zCol = __ccgo_ts + 29346 + zCol = __ccgo_ts + 29372 } } zType = __ccgo_ts + 1138 @@ -178918,24 +181135,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29797, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29823, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29533 + v2 = __ccgo_ts + 29559 } else { v2 = __ccgo_ts + 1650 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29817, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29843, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29838, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29871, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29864, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29897, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14967 - zAnd = __ccgo_ts + 21981 + zCom = __ccgo_ts + 14992 + zAnd = __ccgo_ts + 22015 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178989,22 +181206,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29895, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29921, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29907, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29933, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14967 + zS = __ccgo_ts + 14992 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29916, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29942, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -179030,7 +181248,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29931, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29957, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1650 @@ -179040,14 +181258,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29945, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21981 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29971, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22015 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29957, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29983, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1650 i1 = 0 @@ -179057,11 +181276,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30007, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21981 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30033, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22015 } goto _2 _2: + ; i1++ } } @@ -179080,7 +181300,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30020, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30046, 0) } // C documentation @@ -179122,21 +181342,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*uint8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30007, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30033, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30046, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30072, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30076, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14967 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30102, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14992 } } } goto _1 _1: + ; i++ } } @@ -179184,6 +181405,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*uint8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = uint8(v2) goto _1 _1: + ; i++ } } @@ -179213,16 +181435,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 z = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30113 + zSep = __ccgo_ts + 30139 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29265, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16550) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16584) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) } break } @@ -179233,16 +181455,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29533 + v1 = __ccgo_ts + 29559 } else { v1 = __ccgo_ts + 1650 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30126, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14967 + z = _rbuMPrintf(tls, p, __ccgo_ts+30152, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14992 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30137, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30163, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -179288,7 +181510,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30141) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30167) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -179296,7 +181518,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29319, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -179305,21 +181527,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30191, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30217, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29533 + v1 = __ccgo_ts + 29559 } else { v1 = __ccgo_ts + 1650 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30213, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14967 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30239, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14992 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30223, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30249, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30238, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30264, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) } } @@ -179356,7 +181578,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1650 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -179365,37 +181587,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1650 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30300 + zPk = __ccgo_ts + 30326 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30313 + v2 = __ccgo_ts + 30339 } else { v2 = __ccgo_ts + 1650 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30323, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14967 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30349, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14992 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30350, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30376, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30357 + v3 = __ccgo_ts + 30383 } else { v3 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30372, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30398, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) } } @@ -179421,7 +181644,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30404, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30430, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -179442,6 +181665,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -179466,7 +181690,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc zRet = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30461) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30487) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -179535,6 +181759,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -179549,6 +181774,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -179560,6 +181786,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -179574,6 +181801,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -179589,6 +181817,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*uint8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -179630,7 +181859,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30527, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30553, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -179647,18 +181876,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30547, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30573, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30612, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30638, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30648, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30674, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -179673,26 +181902,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30682 + v2 = __ccgo_ts + 30708 } else { - v2 = __ccgo_ts + 30686 + v2 = __ccgo_ts + 30712 } v1 = v2 } else { v1 = __ccgo_ts + 1650 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30692, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30718, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30753, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30779, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30682 + v3 = __ccgo_ts + 30708 } else { - v3 = __ccgo_ts + 30686 + v3 = __ccgo_ts + 30712 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30814, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30840, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -179711,8 +181940,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6573) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6569) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6598) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6594) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -179721,39 +181950,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1650 } else { - v4 = __ccgo_ts + 30973 + v4 = __ccgo_ts + 30999 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30982 + v5 = __ccgo_ts + 31008 } else { v5 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30992, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31018, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31028, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31054, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31056 + zRbuRowid = __ccgo_ts + 31082 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31068 + v6 = __ccgo_ts + 31094 } else { v6 = __ccgo_ts + 1650 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31085, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31161, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31111, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31187, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31460, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31486, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -179764,9 +181993,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31559 + v7 = __ccgo_ts + 31585 } else { - v7 = __ccgo_ts + 31569 + v7 = __ccgo_ts + 31595 } zRbuRowid1 = v7 } @@ -179779,14 +182008,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29616, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29642, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14967, __ccgo_ts+1650) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1650, __ccgo_ts+14992, __ccgo_ts+1650) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31580 + v8 = __ccgo_ts + 31606 } else { v8 = __ccgo_ts + 1650 } @@ -179796,11 +182025,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1650 } if zOrder != 0 { - v10 = __ccgo_ts + 23175 + v10 = __ccgo_ts + 23209 } else { v10 = __ccgo_ts + 1650 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31586, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31612, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -179857,6 +182086,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { @@ -179867,6 +182097,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -179886,9 +182117,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1650 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30973 + zPrefix = __ccgo_ts + 30999 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31634, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31660, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -179962,7 +182193,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31664, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31690, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -180021,27 +182252,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31694, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31720, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31722, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31748, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.Xmemcpy(tls, p+48, __ccgo_ts+3420, uint64(4)) } else { - libc.Xmemcpy(tls, p+48, __ccgo_ts+6562, uint64(4)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+6587, uint64(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31740, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31766, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -180074,10 +182305,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31806, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31832, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24564, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24598, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*uint8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -180093,14 +182324,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 31838 + v2 = __ccgo_ts + 31864 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1650 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31840, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31866, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -180111,27 +182342,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31872, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31898, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31887, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31913, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31904, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31930, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31920, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31946, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31948, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31974, 0) } } @@ -180215,7 +182446,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31920, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31946, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -180248,7 +182479,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31966, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31992, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -180381,16 +182612,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -180412,7 +182643,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32001, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32027, 0) } // C documentation @@ -180429,13 +182660,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6562) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6587) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32026, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32033, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32052, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32059, libc.VaList(bp+8, zMove)) if zWal == uintptr(0) || zOal == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -180567,7 +182798,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24121, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24155, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -180580,6 +182811,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -180658,6 +182890,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -180701,7 +182934,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32040) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32066) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -180714,7 +182947,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32062, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32088, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -180741,7 +182974,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd } pFd = v1 - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32089, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32115, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -180777,9 +183010,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32247, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32273, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32262, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32288, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -180802,9 +183035,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { _, _ = i, zSql *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32282, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32308, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32307) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32333) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -180815,10 +183048,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32415) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32441) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32480) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32506) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -180829,13 +183062,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32524, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32550, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -180862,8 +183096,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17635) - _rbuCopyPragma(tls, p, __ccgo_ts+16746) + _rbuCopyPragma(tls, p, __ccgo_ts+17669) + _rbuCopyPragma(tls, p, __ccgo_ts+16780) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -180871,7 +183105,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32549, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32575, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -180893,10 +183127,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -180983,7 +183217,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32577, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32603, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -181006,10 +183240,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32026, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32052, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6562, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6587, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } @@ -181031,7 +183265,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { var _ /* zRnd at bp+4 */ [64]uint8 _ = pVfs Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32602, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32628, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -181077,7 +183311,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain } db = v1 - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32613, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32639, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -181122,11 +183356,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32685, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32711, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32699) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32725) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -181135,7 +183369,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32756) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32782) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -181215,7 +183449,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32830, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32856, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -181237,17 +183471,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32862 + v3 = __ccgo_ts + 32888 } else { - v3 = __ccgo_ts + 32869 + v3 = __ccgo_ts + 32895 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32876, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32902, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14856, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14881, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -181259,21 +183493,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17349) - _rbuCopyPragma(tls, p, __ccgo_ts+16761) + _rbuCopyPragma(tls, p, __ccgo_ts+17383) + _rbuCopyPragma(tls, p, __ccgo_ts+16795) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32908, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32934, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6562, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6587, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32924, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32950, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -181351,7 +183585,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32948, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32974, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -181398,7 +183632,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30973, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30999, uint64(8)) == 0 { nDel = int32(8) for int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -181408,6 +183642,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -181425,7 +183660,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -181434,7 +183669,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -181444,7 +183679,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32956, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32982, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -181545,7 +183780,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14871, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14896, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -181558,19 +183793,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14871, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14896, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14856 + v1 = __ccgo_ts + 14881 } else { - v1 = __ccgo_ts + 32908 + v1 = __ccgo_ts + 32934 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32908, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32934, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -181680,6 +183915,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -181727,6 +183963,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -181739,6 +183976,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -181765,6 +184003,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -181778,6 +184017,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -181810,6 +184050,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -181820,6 +184061,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -181846,6 +184088,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -182128,7 +184371,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32983, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33009, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -182154,7 +184397,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33006, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33032, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -182349,7 +184592,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6562) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6587) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -182363,7 +184606,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33017, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33043, 0) != 0 { oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) } @@ -182916,7 +185159,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12168, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12193, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -182986,16 +185229,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -183063,6 +185307,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -183098,6 +185343,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -183291,17 +185537,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -183391,6 +185640,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -183406,7 +185656,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33028, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33054, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FzPath = v1 if z == uintptr(0) { @@ -183444,8 +185694,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33030 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33039, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33056 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33065, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -183474,7 +185724,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg @@ -183485,7 +185735,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33051, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33077, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -183505,16 +185755,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33059 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33085 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33068 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33094 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33073 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33099 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -183539,6 +185789,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -183611,12 +185862,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33083, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33109, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33238, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33264, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33252, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33278, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -183638,37 +185889,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -183693,7 +185944,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33267, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33293, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -184362,6 +186613,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -187525,6 +189819,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -187606,7 +189901,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -187630,7 +189925,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -187645,7 +189940,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -187660,6 +189955,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -187700,7 +189996,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -187760,6 +190056,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -187804,7 +190101,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -187862,6 +190159,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2)) @@ -187909,7 +190207,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -187919,7 +190217,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -187939,6 +190237,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -187997,7 +190296,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -188005,6 +190304,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -188037,6 +190337,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -188245,6 +190546,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -188365,6 +190667,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -188384,6 +190687,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -188394,6 +190698,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) @@ -188401,7 +190706,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { @@ -188422,6 +190727,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -188568,6 +190874,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -188601,7 +190908,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11559) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11584) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -188610,9 +190917,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.Xmemset(tls, bp+8, 0, uint64(16)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33911, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33937, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33924, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33950, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -188622,17 +190929,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33930, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33956, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14967 + zSep = __ccgo_ts + 14992 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1650 - _sessionAppendStr(tls, bp+8, __ccgo_ts+33935, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33961, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -188641,16 +190949,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { - _sessionAppendStr(tls, bp+8, __ccgo_ts+33943, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33969, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34018, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34044, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21981 + zSep = __ccgo_ts + 22015 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -188694,6 +191003,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -188732,9 +191042,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34024, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34050, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33935, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33961, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -188744,18 +191054,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33930, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33956, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 21981 + zSep = __ccgo_ts + 22015 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34042, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34068, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33506, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33532, bp) zSep = __ccgo_ts + 1650 i = 0 for { @@ -188765,15 +191076,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34018, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34044, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34050 + zSep = __ccgo_ts + 34076 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5083, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5108, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -188799,7 +191111,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6562, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6587, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -188822,34 +191134,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34055, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34081, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+21987, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22021, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+14967, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+14992, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34073, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34099, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34084, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34110, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5083, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5108, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -188872,12 +191186,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11559, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11584, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34088) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34114) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34201) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34227) } return rc } @@ -188943,13 +191257,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -189009,6 +191324,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -189074,6 +191390,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -189274,6 +191591,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -189355,7 +191673,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34345, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34371, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -189368,7 +191686,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34366, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34392, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -189462,10 +191780,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34385, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34411, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34411, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34437, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -189506,7 +191824,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6562, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6587, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -189520,22 +191838,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34441, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34467, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34485, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34511, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34556, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34582, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11559) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11584) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -189592,13 +191911,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34616, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34642, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34646, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34672, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34646, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34696, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34672, uintptr(0), uintptr(0), uintptr(0)) } } if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { @@ -189754,6 +192073,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -189800,6 +192120,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -189926,6 +192247,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -189988,6 +192310,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -190004,6 +192327,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -190015,6 +192339,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -190027,6 +192352,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -190088,6 +192414,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -190121,6 +192448,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -190165,6 +192493,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -190245,14 +192574,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -190483,6 +192815,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -190554,6 +192887,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -190577,6 +192911,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -190634,6 +192969,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -190664,6 +193000,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -192009,23 +194346,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -192157,7 +194494,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34698, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -192340,116 +194677,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) @@ -192480,7 +194847,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34726, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34752, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -192776,7 +195143,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34757, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34783, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -192873,7 +195240,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34764 + zErr = __ccgo_ts + 34790 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -193001,6 +195368,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -193053,6 +195421,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -193117,7 +195486,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34814 + zErr = __ccgo_ts + 34840 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -193198,6 +195567,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -193219,11 +195589,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -193385,6 +195757,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -193449,6 +195822,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -193467,6 +195841,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -193491,15 +195866,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34862, + FzFunc: __ccgo_ts + 34888, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34870, + FzFunc: __ccgo_ts + 34896, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34880, + FzFunc: __ccgo_ts + 34906, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -193512,6 +195887,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -194021,6 +196397,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34892, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34918, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34923, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34949, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -194398,7 +196778,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34956, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34982, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -194408,7 +196788,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34993, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35019, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -194416,7 +196796,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35002, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35028, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -194439,10 +196819,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35035, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35061, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -194453,58 +196834,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35069, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35095, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35077, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35103, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*uint8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35109, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35135, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35115, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35141, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35134, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35160, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35177, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35203, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35191, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35217, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35229, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35255, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35240, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35266, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5476, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5501, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8195, + FzName: __ccgo_ts + 8220, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17715, + FzName: __ccgo_ts + 17749, }, 2: { - FzName: __ccgo_ts + 35275, + FzName: __ccgo_ts + 35301, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -194512,20 +196893,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35283, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35309, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35314, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35340, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35324, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35350, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35358, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35384, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -194597,15 +196978,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35386) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16662) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35391, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35412) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16696) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35417, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35421) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35447) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35431, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35457, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -194631,7 +197012,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35462, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35488, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -194639,12 +197020,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35467, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35493, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35474, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35500, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } @@ -194700,8 +197082,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35386) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35482, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35412) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35508, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } i = int32(3) @@ -194732,7 +197114,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35511, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35537, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -194757,11 +197139,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35531, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35557, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -194769,7 +197152,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35581, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35607, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -194782,18 +197165,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { zTail = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35069 + zTail = __ccgo_ts + 35095 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35636 + zTail = __ccgo_ts + 35662 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35644, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35670, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16662, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16696, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194828,6 +197211,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -194856,7 +197240,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35655, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35681, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -194865,15 +197249,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1650 } else { - v2 = __ccgo_ts + 14967 + v2 = __ccgo_ts + 14992 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35671, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35697, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35678, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35386)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35704, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35412)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) @@ -195019,7 +197404,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35704) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35730) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -195030,7 +197415,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35709) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35735) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -195041,7 +197426,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35718) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35744) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -195055,7 +197440,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35728) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35754) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -195066,7 +197451,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35738) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35764) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -195083,7 +197468,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35750) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35776) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -195098,7 +197483,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35386) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35412) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -195113,7 +197498,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35762) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35788) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -195155,7 +197540,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35776 + zSelect = __ccgo_ts + 35802 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -195175,7 +197560,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35808) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35834) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -195187,7 +197572,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35816, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35842, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -195408,17 +197793,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*uint8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35887, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35913, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*uint8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35907, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35933, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -195429,16 +197815,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35938, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35964, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35941, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35967, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30682, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30708, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -195542,6 +197929,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -195602,6 +197990,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -195659,6 +198048,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -195706,6 +198096,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -195749,6 +198140,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -195805,6 +198197,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -195833,6 +198226,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -195986,6 +198385,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -196109,6 +198509,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -196137,6 +198538,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -196153,6 +198555,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -196168,6 +198571,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -196175,6 +198579,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -196238,6 +198643,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -196275,6 +198681,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -196300,6 +198707,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -196372,6 +198780,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -196380,11 +198789,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -196431,6 +198842,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -196450,6 +198862,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -196461,6 +198874,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -196563,10 +198977,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -196623,6 +199039,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -196703,6 +199120,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -196733,6 +199151,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -196788,6 +199207,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -196913,6 +199333,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -197042,10 +199463,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -197263,6 +199686,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -197417,6 +199841,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -197425,6 +199850,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -197468,8 +199894,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35945, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34726, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35971, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34752, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -197489,12 +199915,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35950, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35976, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -197543,6 +199970,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -197553,6 +199981,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -197591,6 +200020,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -197619,10 +200049,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20984, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -197728,6 +200159,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -197745,7 +200177,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35979, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36005, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -197802,6 +200234,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -197857,6 +200290,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -197929,17 +200363,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36032 + v2 = __ccgo_ts + 36058 } else { - v2 = __ccgo_ts + 35945 + v2 = __ccgo_ts + 35971 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36039, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36065, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -197948,7 +200383,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36089, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36115, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -198109,6 +200544,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -198149,6 +200585,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -198171,6 +200608,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -198223,10 +200661,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -198256,6 +200696,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -198275,6 +200716,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -198302,6 +200744,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -198316,6 +200759,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -198436,10 +200880,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -198612,10 +201058,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8)) @@ -198635,6 +201083,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -200475,6 +202938,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200583,7 +203047,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36293, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36319, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -200667,7 +203131,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36288, uint64(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36314, uint64(4)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -200700,10 +203164,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -200755,10 +203221,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -200804,6 +203272,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -200820,6 +203289,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -200869,6 +203339,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -200937,6 +203408,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -200968,6 +203440,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -201055,6 +203528,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -201091,6 +203565,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -201607,6 +204082,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -201802,6 +204278,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -201930,6 +204407,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -201966,6 +204444,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -201996,6 +204475,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -204364,6 +206869,7 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int } goto _1 _1: + ; ii++ } } @@ -204412,6 +206918,7 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin } goto _1 _1: + ; iLvl++ } if nBest < nMin { @@ -204544,7 +207051,7 @@ func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int defer tls.Free(32) if iPgno != int32(1) { if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { - _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36539, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36565, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) @@ -204667,6 +207174,7 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } goto _1 _1: + ; pgno++ } _fts5DataRelease(tls, pLeaf) @@ -204856,6 +207364,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) goto _3 _3: + ; iKey++ } /* Set iDelKeyOff to the value of the footer entry to remove from @@ -204923,6 +207432,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } goto _6 _6: + ; iPgno-- } if iPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { @@ -205317,6 +207827,7 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint } goto _1 _1: + ; i++ } nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) @@ -205353,10 +207864,12 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint iSegOut++ goto _4 _4: + ; iSeg++ } goto _3 _3: + ; iLvl-- } v5 = nSeg @@ -205394,6 +207907,7 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iLvl++ } for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { @@ -205670,6 +208184,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -205770,6 +208285,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -205842,6 +208358,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -205884,6 +208401,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -205896,11 +208414,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -205909,6 +208429,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } i = 0 @@ -205927,10 +208448,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -206045,11 +208568,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36600, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36626, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25717, __ccgo_ts+36608, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25743, __ccgo_ts+36634, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11770, __ccgo_ts+36643, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11795, __ccgo_ts+36669, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -206126,6 +208649,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -206187,6 +208711,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -206308,6 +208833,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -206392,6 +208918,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -206431,6 +208958,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -206472,6 +209000,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -206505,9 +209034,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -206515,16 +209045,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -206573,7 +209106,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36687) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36713) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -206632,10 +209165,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -206661,6 +209196,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -206688,11 +209224,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -206768,6 +209306,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -206985,6 +209524,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -207037,6 +209577,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -207085,7 +209626,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Binary representation of iNew */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36142, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36168, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -207225,6 +209766,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -207278,6 +209820,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -207289,6 +209832,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -207387,6 +209931,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -207474,6 +210019,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -207517,10 +210063,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -207557,6 +210105,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -207906,6 +210460,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -208484,7 +211039,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) bSeenMatch = 0 bSeenRank = 0 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36780, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36806, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -208523,7 +211078,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*uint8)(unsafe.Pointer(idxStr + uintptr(v3))) = uint8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5115, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5140, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) } } @@ -208543,7 +211098,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*uint8)(unsafe.Pointer(idxStr + uintptr(v5))) = uint8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5115, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5140, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -208563,6 +211118,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -208602,6 +211158,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -208680,6 +211237,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -208777,6 +211335,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -208810,6 +211369,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -208851,6 +211411,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -208881,6 +211442,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -209036,7 +211598,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14967 + v1 = __ccgo_ts + 14992 } else { v1 = __ccgo_ts + 1650 } @@ -209046,11 +211608,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1650 } if bDesc != 0 { - v3 = __ccgo_ts + 36819 + v3 = __ccgo_ts + 36845 } else { - v3 = __ccgo_ts + 36824 + v3 = __ccgo_ts + 36850 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36828, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36854, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr @@ -209104,17 +211666,18 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36883, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36909, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5458, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5483, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36889, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36915, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -209141,6 +211704,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -209163,7 +211727,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36917, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36943, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) @@ -209182,6 +211746,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } @@ -209195,7 +211760,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36927, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36953, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -209229,7 +211794,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36948, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36974, libc.VaList(bp+24, z)) } } } else { @@ -209237,7 +211802,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34880 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34906 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -209288,7 +211853,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36780, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36806, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -209364,6 +211929,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -209431,7 +211997,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36981, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37007, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -209456,6 +212022,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -209611,36 +212178,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37017, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37043, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37028, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37054, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37108, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37134, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37116, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37142, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17329, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17363, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37172, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37198, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37178, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37204, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37194, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37220, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -209738,9 +212305,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17849, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17883, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37200, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37226, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -209769,11 +212336,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 20837 + v1 = __ccgo_ts + 20871 } else { - v1 = __ccgo_ts + 37259 + v1 = __ccgo_ts + 37285 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37271, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37297, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -209824,7 +212391,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -209993,6 +212560,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -210063,6 +212631,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -210078,6 +212647,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -210205,6 +212775,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -210223,6 +212794,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -210239,6 +212811,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -210276,6 +212849,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -210315,6 +212889,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -210569,6 +213144,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -210595,6 +213171,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -210610,7 +213187,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37308, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37334, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -210677,9 +213254,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -210687,10 +213266,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -210701,10 +213282,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -210715,6 +213298,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -210727,12 +213311,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -210791,7 +213378,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37329, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37355, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -210989,6 +213576,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -211032,7 +213620,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr pMod = _fts5LocateTokenizer(tls, pGlobal, v1) if pMod == uintptr(0) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37400, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37426, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -211048,7 +213636,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37422, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37448, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -211077,6 +213665,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -211091,6 +213680,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -211101,7 +213691,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37453) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37479) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -211115,7 +213705,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37466, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37492, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -211137,17 +213727,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37557, - 1: __ccgo_ts + 35069, - 2: __ccgo_ts + 25717, - 3: __ccgo_ts + 35636, - 4: __ccgo_ts + 11770, + 0: __ccgo_ts + 37583, + 1: __ccgo_ts + 35095, + 2: __ccgo_ts + 25743, + 3: __ccgo_ts + 35662, + 4: __ccgo_ts + 11795, } // C documentation @@ -211167,10 +213758,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37564, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37590, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37610, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37636, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -211193,7 +213784,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37673, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37699, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -211210,10 +213801,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37673, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37699, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37678, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37704, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -211316,17 +213907,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, ** statements to operate on it. */ if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37693, - 1: __ccgo_ts + 37761, - 2: __ccgo_ts + 37830, - 3: __ccgo_ts + 37863, - 4: __ccgo_ts + 37902, - 5: __ccgo_ts + 37942, - 6: __ccgo_ts + 37981, - 7: __ccgo_ts + 38024, - 8: __ccgo_ts + 38063, - 9: __ccgo_ts + 38107, - 10: __ccgo_ts + 38147, + 0: __ccgo_ts + 37719, + 1: __ccgo_ts + 37787, + 2: __ccgo_ts + 37856, + 3: __ccgo_ts + 37889, + 4: __ccgo_ts + 37928, + 5: __ccgo_ts + 37968, + 6: __ccgo_ts + 38007, + 7: __ccgo_ts + 38050, + 8: __ccgo_ts + 38089, + 9: __ccgo_ts + 38133, + 10: __ccgo_ts + 38173, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -211354,6 +213945,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = uint8(',') goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = uint8('\000') @@ -211362,14 +213954,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38170 + v2 = __ccgo_ts + 38196 } else { v2 = __ccgo_ts + 1650 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38173 + v3 = __ccgo_ts + 38199 } else { v3 = __ccgo_ts + 1650 } @@ -211427,12 +214019,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38181, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38207, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38285, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38311, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38323, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38349, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -211441,7 +214033,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38361, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38387, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -211453,14 +214045,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25717, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11770, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37557, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25743, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11795, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37583, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35636, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35662, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35069, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35095, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -211480,13 +214072,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30357 + v1 = __ccgo_ts + 30383 } else { v1 = __ccgo_ts + 1650 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38403, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38429, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38433, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38459, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -211527,35 +214119,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38477, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38503, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38500, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38526, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35069, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35095, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38506 + zCols = __ccgo_ts + 38532 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38538 + zCols = __ccgo_ts + 38564 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35636, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35662, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37557, __ccgo_ts+38586, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37583, __ccgo_ts+38612, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -211584,6 +214177,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -211684,6 +214278,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -211822,6 +214417,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -211894,9 +214490,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38603, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38629, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38653, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38679, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -211904,7 +214500,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35808, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35834, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -211951,6 +214547,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -212048,6 +214645,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -212096,6 +214694,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -212115,7 +214714,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38682, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38708, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -212213,6 +214812,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -212289,6 +214889,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -212315,6 +214916,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -212322,14 +214924,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35069, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35095, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -213222,15 +215840,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -213292,7 +215915,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38774 + zBase = __ccgo_ts + 38800 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -213383,6 +216006,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -213398,6 +216022,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -213456,6 +216081,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38784, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38810, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38787, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38813, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38792, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38818, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38797, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38823, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38800, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38803, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38829, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38808, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38813, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38839, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38817, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38843, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38823, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38828, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38854, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -213569,49 +216196,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38832, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38858, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38836, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38862, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38839, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38865, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38843, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38869, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38847, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38873, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38851, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38877, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38855, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38881, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38859, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38885, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -213628,20 +216255,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38863, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38843, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38889, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38866, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38869, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38892, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38873, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38859, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -213657,75 +216284,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38876, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38902, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38884, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38910, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38891, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38917, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38896, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38922, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38792, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38818, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38901, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38927, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38787, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38813, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38906, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38932, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38859, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38911, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38937, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15875, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15909, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38916, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38942, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38869, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38920, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38946, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38925, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38951, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38828, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38854, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38931, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38957, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38935, uint64(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38961, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38937, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38963, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38851, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38877, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -213734,48 +216361,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38943, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38969, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38859, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38885, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38951, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38977, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38957, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38983, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38843, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38869, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38962, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38988, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38968, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38855, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38881, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38976, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39002, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38984, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39010, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38988, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39014, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38851, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38877, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -213783,21 +216410,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38996, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39022, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39002, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39028, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38855, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38881, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39008, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39034, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38869, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38895, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -213815,48 +216442,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39015, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39020, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39046, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39025, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39051, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39031, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38800, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38984, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39010, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39037, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39063, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39043, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39069, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38784, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38810, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -213872,13 +216499,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39049, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39075, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39053, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39079, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39056, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39082, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -213886,7 +216513,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39059, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39085, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -213972,6 +216599,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -214045,14 +216673,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39063) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39089) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38756) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38782) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('2') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -214069,6 +216697,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -214173,6 +216802,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -214324,7 +216954,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38774, + FzName: __ccgo_ts + 38800, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -214332,7 +216962,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39078, + FzName: __ccgo_ts + 39104, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -214340,7 +216970,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39084, + FzName: __ccgo_ts + 39110, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -214348,7 +216978,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39091, + FzName: __ccgo_ts + 39117, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -214368,6 +216998,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -219412,6 +222043,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -219698,6 +222330,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -219720,6 +222353,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -219878,16 +222512,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39099) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39125) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39103) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39129) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39107) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39133) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39116, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39142, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -219956,15 +222590,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39150, - 1: __ccgo_ts + 39190, - 2: __ccgo_ts + 39225, + 0: __ccgo_ts + 39176, + 1: __ccgo_ts + 39216, + 2: __ccgo_ts + 39251, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23710, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23744, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39268, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39294, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -220076,6 +222710,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -220133,10 +222768,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39301, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39327, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39332, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39358, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } @@ -220155,7 +222790,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39383, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39409, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -220301,6 +222936,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -220396,6 +223032,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -220579,7 +223216,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39409, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39435, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -220632,7 +223269,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39419 + return __ccgo_ts + 39445 } type TAggInfo_col = struct { @@ -220914,11 +223551,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-16.0.6\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=0\x00COMPILER=clang-16.0.6\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go index 3bc0dd6f..1035949c 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go @@ -1,4 +1,4 @@ -// Code generated for linux/386 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for linux/386 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build linux && 386 // +build linux,386 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -445,7 +447,6 @@ const FLAG_SIGNED = 1 const FLAG_STRING = 4 const FNDELAY = 2048 const FNONBLOCK = 2048 -const FOPEN_MAX = 16 const FP_ILOGB0 = -2147483648 const FP_ILOGBNAN = -2147483648 const FP_INFINITE = 1 @@ -997,6 +998,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NFDBITS = "__NFDBITS" const NN = 1 @@ -1727,6 +1729,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2181,10 +2184,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2259,7 +2259,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2367,8 +2367,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2826,6 +2826,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2963,7 +2964,6 @@ const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 const _ALLOCA_H = 1 const _ASSERT_H = 1 -const _ATFILE_SOURCE = 1 const _BITS_BYTESWAP_H = 1 const _BITS_ENDIANNESS_H = 1 const _BITS_ENDIAN_H = 1 @@ -2987,9 +2987,7 @@ const _BITS_UINTN_IDENTITY_H = 1 const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 0 -const _DEFAULT_SOURCE = 1 const _DLFCN_H = 1 -const _DYNAMIC_STACK_SIZE_SOURCE = 1 const _ENDIAN_H = 1 const _ERRNO_H = 1 const _FCNTL_H = 1 @@ -3019,12 +3017,6 @@ const _IONBF = 2 const _IO_EOF_SEEN = 16 const _IO_ERR_SEEN = 32 const _IO_USER_LOCK = 32768 -const _ISOC11_SOURCE = 1 -const _ISOC2X_SOURCE = 1 -const _ISOC95_SOURCE = 1 -const _ISOC99_SOURCE = 1 -const _LARGEFILE64_SOURCE = 1 -const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 const _LFS64_ASYNCHRONOUS_IO = 1 const _LFS64_LARGEFILE = 1 @@ -3046,7 +3038,6 @@ const _POSIX_BARRIERS = 200809 const _POSIX_CHOWN_RESTRICTED = 0 const _POSIX_CLOCK_SELECTION = 200809 const _POSIX_CPUTIME = 0 -const _POSIX_C_SOURCE = 200809 const _POSIX_FSYNC = 200809 const _POSIX_IPV6 = 200809 const _POSIX_JOB_CONTROL = 1 @@ -3068,7 +3059,6 @@ const _POSIX_SAVED_IDS = 1 const _POSIX_SEMAPHORES = 200809 const _POSIX_SHARED_MEMORY_OBJECTS = 200809 const _POSIX_SHELL = 1 -const _POSIX_SOURCE = 1 const _POSIX_SPAWN = 200809 const _POSIX_SPIN_LOCKS = 200809 const _POSIX_SPORADIC_SERVER = -1 @@ -3125,8 +3115,6 @@ const _XOPEN_LEGACY = 1 const _XOPEN_REALTIME = 1 const _XOPEN_REALTIME_THREADS = 1 const _XOPEN_SHM = 1 -const _XOPEN_SOURCE = 700 -const _XOPEN_SOURCE_EXTENDED = 1 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 const _XOPEN_XCU_VERSION = 4 @@ -3336,16 +3324,6 @@ const __GCC_IEC_559_COMPLEX = 2 const __GID_T_TYPE = "__U32_TYPE" const __GLIBC_FLT_EVAL_METHOD = 2 const __GLIBC_MINOR__ = 36 -const __GLIBC_USE_DEPRECATED_GETS = 0 -const __GLIBC_USE_DEPRECATED_SCANF = 0 -const __GLIBC_USE_IEC_60559_BFP_EXT = 1 -const __GLIBC_USE_IEC_60559_BFP_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_TYPES_EXT = 1 -const __GLIBC_USE_ISOC2X = 1 -const __GLIBC_USE_LIB_EXT2 = 1 const __GLIBC__ = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" const __GNUC_MINOR__ = 2 @@ -3353,7 +3331,6 @@ const __GNUC_PATCHLEVEL__ = 0 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 12 -const __GNU_LIBRARY__ = 6 const __GXX_ABI_VERSION = 1017 const __HAVE_DISTINCT_FLOAT128 = 1 const __HAVE_DISTINCT_FLOAT128X = 0 @@ -3568,28 +3545,6 @@ const __UINT_LEAST64_MAX__ = 18446744073709551615 const __UINT_LEAST8_MAX__ = 255 const __UQUAD_TYPE = 0 const __USECONDS_T_TYPE = "__U32_TYPE" -const __USE_ATFILE = 1 -const __USE_DYNAMIC_STACK_SIZE = 1 -const __USE_FILE_OFFSET64 = 1 -const __USE_FORTIFY_LEVEL = 0 -const __USE_GNU = 1 -const __USE_ISOC11 = 1 -const __USE_ISOC95 = 1 -const __USE_ISOC99 = 1 -const __USE_LARGEFILE = 1 -const __USE_LARGEFILE64 = 1 -const __USE_MISC = 1 -const __USE_POSIX = 1 -const __USE_POSIX199309 = 1 -const __USE_POSIX199506 = 1 -const __USE_POSIX2 = 1 -const __USE_UNIX98 = 1 -const __USE_XOPEN = 1 -const __USE_XOPEN2K = 1 -const __USE_XOPEN2K8 = 1 -const __USE_XOPEN2K8XSI = 1 -const __USE_XOPEN2KXSI = 1 -const __USE_XOPEN_EXTENDED = 1 const __VERSION__ = "12.2.0" const __WALL = 1073741824 const __WCHAR_MAX__ = 2147483647 @@ -3718,7 +3673,6 @@ const sqlite3ParserCTX_PDECL = 0 const sqlite3ParserTOKENTYPE = 0 const sqlite3Parser_ENGINEALWAYSONSTACK = 1 const sqlite3StrNICmp = 0 -const static_assert = 0 const threadid = 0 const tkCREATE = 4 const tkEND = 7 @@ -8869,6 +8823,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -10432,6 +10387,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -11139,6 +11098,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -13687,7 +13647,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint32FromInt64(40)/libc.Uint32FromInt64(4)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13836,6 +13796,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13848,7 +13809,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -13874,6 +13835,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -13884,11 +13846,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -13903,7 +13867,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 _ = libc.Int32FromInt32(0) @@ -13916,6 +13880,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -13951,6 +13916,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -14151,6 +14117,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -14218,6 +14185,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { zDate++ } @@ -14901,6 +14869,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -14918,6 +14887,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1269, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -15028,6 +15004,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -15141,7 +15118,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) @@ -15155,7 +15132,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) @@ -15171,6 +15148,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -15224,6 +15202,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -15491,7 +15470,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint32(1) cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -15517,7 +15496,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -15533,9 +15512,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+128, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 72)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 72))).FvalidJD = 0 (*(*TDateTime)(unsafe.Pointer(bp + 72))).FM = int32(1) @@ -15554,7 +15533,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -15585,7 +15564,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1409, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -15603,6 +15582,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -16221,6 +16201,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -18005,6 +17986,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -18566,6 +18548,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -18591,6 +18574,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -18652,11 +18636,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(1) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -18765,6 +18753,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -18786,14 +18775,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int32(bufpt) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -18809,6 +18802,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -18941,6 +18937,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -18962,6 +18959,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v70)) = int8('0') goto _69 _69: + ; precision-- e2++ } @@ -19050,6 +19048,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -19067,6 +19066,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -19075,11 +19075,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -19156,7 +19158,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -19211,6 +19215,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -19218,6 +19223,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -19230,9 +19236,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -19280,6 +19289,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -19319,6 +19329,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -19330,6 +19341,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19354,6 +19366,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19387,9 +19400,11 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; _ = libc.Int32FromInt32(0) return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -19416,6 +19431,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -20290,6 +20306,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -20300,6 +20317,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -20977,6 +20995,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -21226,6 +21245,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint32(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -22091,6 +22132,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -22143,6 +22185,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -22178,6 +22221,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -22633,6 +22681,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -22693,6 +22742,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -22716,6 +22766,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -22942,6 +22993,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } return i @@ -23004,6 +23056,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -26649,6 +26711,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -26666,7 +26729,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3510, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3510, bp, int32(41778)) } // C documentation @@ -26705,7 +26768,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -27326,7 +27391,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*4)) } else { @@ -27780,6 +27849,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -27797,6 +27867,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -27857,6 +27928,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 4 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -27951,7 +28023,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -28330,7 +28402,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -28350,7 +28422,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -28506,6 +28578,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -28776,7 +28849,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3393, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3393, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -28829,6 +28902,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags _ = libc.Int32FromInt32(0) rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -28853,7 +28927,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+96, libc.Uint32FromInt64(4098)-libc.Uint32FromInt32(2)) if got <= 0 || got >= libc.Int32FromInt64(4098)-libc.Int32FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3582, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3582, zIn, int32(44691)) return } (*(*[4098]int8)(unsafe.Pointer(bp + 96)))[got] = 0 @@ -29024,6 +29098,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -29056,14 +29131,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+20, libc.Uint32FromInt64(4098)-libc.Uint32FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3411, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3411, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+20) } _appendAllPathElements(tls, bp, zPath) *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= (libc.Uint32FromInt32(BITVEC_SZ)-libc.Uint32FromInt32(3)*libc.Uint32FromInt64(4))/libc.Uint32FromInt64(4)*libc.Uint32FromInt64(4)/libc.Uint32FromInt64(4)/libc.Uint32FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(500)) if aiValues == uintptr(0) { @@ -30929,6 +31018,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -30936,6 +31026,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 12 + uintptr(h)*4)) = i return SQLITE_OK @@ -30993,6 +31084,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -31018,6 +31110,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 12 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -31161,10 +31254,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -31538,6 +31633,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -31549,6 +31645,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -31755,6 +31852,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31777,6 +31875,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31842,6 +31941,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -31951,6 +32051,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -31977,6 +32078,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -31998,6 +32100,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -32109,6 +32212,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -32525,6 +32629,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -32793,6 +32898,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -32850,6 +32956,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -33699,6 +33806,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -33858,6 +33966,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -33880,6 +33989,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -33988,6 +34098,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -34082,6 +34193,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -34123,6 +34235,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -35027,12 +35140,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*48))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -35245,6 +35360,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -35396,6 +35512,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -35472,6 +35589,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 76)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -35642,6 +35760,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -35733,6 +35852,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*48))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -35768,6 +35888,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -36559,6 +36680,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -36887,12 +37009,14 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ _ = libc.Int32FromInt32(0) end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -36934,7 +37058,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 28 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -41253,7 +41392,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4084, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4109, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -42676,6 +42815,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -42733,10 +42873,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -42824,7 +42965,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -42890,6 +43031,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*4)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -42915,11 +43057,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 52 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 52 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -42953,6 +43097,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -42961,10 +43106,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -47685,7 +47863,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -47698,12 +47876,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } _ = libc.Int32FromInt32(0) @@ -47718,6 +47896,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -47747,7 +47926,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -47757,7 +47936,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -48196,7 +48375,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint32(pCell) < uint32((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint32(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint32((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -48242,12 +48421,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -48255,21 +48434,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint32(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -48292,6 +48471,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -48316,13 +48496,13 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } _ = libc.Int32FromInt32(0) size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48330,14 +48510,16 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint32(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; _ = libc.Int32FromInt32(0) if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48400,7 +48582,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -48417,14 +48599,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -48475,11 +48657,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -48494,7 +48676,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -48587,12 +48769,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } _ = libc.Int32FromInt32(0) /* At this point: @@ -48604,11 +48786,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -48629,7 +48811,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -48646,10 +48828,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -48712,7 +48894,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -48738,7 +48920,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -48785,12 +48967,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -48817,7 +48999,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -48848,14 +49030,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))) if pc < iCellFirst || pc > iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -48887,7 +49070,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) @@ -48901,7 +49084,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -49067,7 +49250,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -49144,7 +49327,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -49236,7 +49419,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4165) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4190) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -49318,6 +49501,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -49326,6 +49510,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -49464,11 +49649,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -50052,7 +50239,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4174, uint32(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4199, uint32(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -50091,7 +50278,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 4)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 4)) @@ -50147,6 +50334,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -50324,6 +50512,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -50429,6 +50618,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -50510,6 +50700,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -50547,7 +50738,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -50571,7 +50762,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -50580,7 +50771,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -50589,11 +50780,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -50626,7 +50818,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -50724,7 +50916,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -50763,7 +50955,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) if *(*TPgno)(unsafe.Pointer(bp + 16)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 20))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } _ = libc.Int32FromInt32(0) @@ -50832,7 +51024,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50878,7 +51070,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -50893,6 +51085,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -50907,7 +51100,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50920,6 +51113,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -51165,6 +51359,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -51403,7 +51598,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo _ = libc.Int32FromInt32(0) if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { _ = libc.Int32FromInt32(0) @@ -51433,6 +51628,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -51816,7 +52012,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) @@ -51829,7 +52025,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -51882,7 +52078,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } _ = libc.Int32FromInt32(0) *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) @@ -51959,7 +52155,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -52112,7 +52308,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -52125,7 +52321,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 60 @@ -52255,9 +52451,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** (or the freelist). */ _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -52267,7 +52464,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -52531,7 +52728,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -52580,6 +52777,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -52594,6 +52792,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -52670,6 +52869,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -52742,7 +52942,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -52758,6 +52958,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -52812,7 +53013,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -52845,7 +53046,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -52882,7 +53083,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 64 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 112 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*4)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -52891,7 +53092,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+108, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 60 @@ -52906,6 +53107,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -52959,6 +53161,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 112 + uintptr(i)*4)))).FnCell) goto _1 _1: + ; i++ } return n @@ -53022,7 +53225,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53137,7 +53340,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -53231,7 +53434,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -53288,7 +53491,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -53317,7 +53520,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53344,7 +53547,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+8, 0) @@ -53390,6 +53593,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -53406,6 +53610,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -53414,7 +53619,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53518,6 +53723,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } _ = libc.Int32FromInt32(0) end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) _ = libc.Int32FromInt32(0) @@ -53558,7 +53764,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 4)) = pMemPage @@ -53609,7 +53815,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 8)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -53619,7 +53825,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) _ = libc.Int32FromInt32(0) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -53675,6 +53881,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FisInit = uint8(0) } @@ -53709,7 +53916,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _ = libc.Int32FromInt32(0) if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -53729,7 +53936,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+4, bp) @@ -53752,7 +53959,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 4)), ovflPgno) } @@ -53840,6 +54047,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n _ = libc.Int32FromInt32(0) @@ -53987,7 +54195,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -54411,6 +54619,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 16 + uintptr(k)*4)) @@ -54421,12 +54630,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg _ = libc.Int32FromInt32(0) if uint32(pCell) >= uint32(aData+uintptr(j)) && uint32(pCell) < uint32(pEnd) { if uint32(pCell+uintptr(sz)) > uint32(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int32(pCell)-int32(aData)) } else { if uint32(pCell+uintptr(sz)) > uint32(pSrcEnd) && uint32(pCell) < uint32(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -54434,7 +54643,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int32(pData) - int32(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint32(sz)) _ = libc.Int32FromInt32(0) @@ -54509,6 +54718,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 16 + uintptr(k)*4)) @@ -54532,7 +54742,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr _ = libc.Int32FromInt32(0) if uint32(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4))+uintptr(sz)) > uint32(pEnd) && uint32(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4))) < uint32(pEnd) { _ = libc.Int32FromInt32(0) - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4)), uint32(sz)) @@ -54604,6 +54814,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -54616,6 +54827,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -54631,6 +54843,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -54641,6 +54854,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -54678,7 +54892,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint32(nCell*int32(2))) nCell -= nShift @@ -54732,6 +54946,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -54748,9 +54963,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -54798,7 +55014,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -55174,7 +55390,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -55197,7 +55413,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 68))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell)*2, 0, uint32(2)*uint32(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -55211,6 +55427,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -55223,6 +55440,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell++ goto _4 _4: + ; k++ } } @@ -55270,6 +55488,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -55317,11 +55536,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 36 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 36 + uintptr(j)*4)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -55335,7 +55556,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 36)))[k-int32(1)] = 0 @@ -55378,12 +55599,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -55438,11 +55660,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -55470,7 +55693,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -55500,6 +55723,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -55524,6 +55748,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _19 _19: + ; i++ } i = 0 @@ -55542,6 +55767,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -55563,6 +55789,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _ = libc.Int32FromInt32(0) @@ -55649,6 +55876,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -55703,11 +55931,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 68 + 16 + uintptr(k)*4)) if uint32(pCell1) < uint32(pSrcEnd) && uint32(pCell1+uintptr(sz2)) > uint32(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -55717,6 +55946,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -55791,6 +56021,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -55832,6 +56063,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 16)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -55847,12 +56079,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 68))).FapCell) i = 0 for { @@ -55862,6 +56096,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -55872,6 +56107,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 16)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -55964,10 +56200,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -56038,7 +56275,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 112 + uintptr(iPage-int32(1))*4)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 64 + uintptr(iPage-int32(1))*2))) @@ -56129,6 +56366,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -56200,7 +56438,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -56231,7 +56469,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -56318,7 +56556,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -56421,7 +56659,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -56438,6 +56676,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+72) @@ -56462,7 +56701,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { _ = libc.Int32FromInt32(0) if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -56492,10 +56731,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ _ = libc.Int32FromInt32(0) /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint32(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -56512,7 +56751,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { _ = libc.Int32FromInt32(0) } @@ -56543,7 +56782,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { _ = libc.Int32FromInt32(0) p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -56568,6 +56807,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } _ = libc.Int32FromInt32(0) end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -56618,7 +56858,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -56640,7 +56880,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -56749,7 +56989,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } _ = libc.Int32FromInt32(0) @@ -56757,14 +56997,14 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx)))))) if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { - return _sqlite3CorruptError(tls, int32(79826)) + return _sqlite3CorruptError(tls, int32(79902)) } if pCell < (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79829)) + return _sqlite3CorruptError(tls, int32(79905)) } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must ** be preserved following this delete operation. If the current delete @@ -56859,7 +57099,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { } pCell = (*TMemPage)(unsafe.Pointer(pLeaf)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pLeaf)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1)))))))) if pCell < (*TMemPage)(unsafe.Pointer(pLeaf)).FaData+4 { - return _sqlite3CorruptError(tls, int32(79920)) + return _sqlite3CorruptError(tls, int32(79996)) } nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pLeaf)).FxCellSize})))(tls, pLeaf, pCell)) _ = libc.Int32FromInt32(0) @@ -56979,7 +57219,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags */ _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+4) if *(*TPgno)(unsafe.Pointer(bp + 4)) > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 4))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -57021,7 +57261,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 8)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 4)), bp+20, bp+24) if int32(*(*Tu8)(unsafe.Pointer(bp + 20))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 20))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -57108,14 +57348,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int _, _, _, _ = hdr, i, pCell, v2 _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 4)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { return *(*int32)(unsafe.Pointer(bp + 4)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -57142,6 +57382,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -57166,6 +57407,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 4)) } @@ -57253,7 +57495,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -57529,7 +57771,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+48, __ccgo_ts+4178, int32(1)) + Xsqlite3_str_append(tls, pCheck+48, __ccgo_ts+4203, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+48, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -57581,11 +57823,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4180, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4205, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4203, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4228, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -57611,11 +57853,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4333, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4358, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -57667,6 +57909,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -57686,11 +57929,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4372 + v2 = __ccgo_ts + 4397 } else { - v2 = __ccgo_ts + 4377 + v2 = __ccgo_ts + 4402 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4398, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4423, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -57827,12 +58070,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4424 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4449 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4442, libc.VaList(bp+48, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4467, libc.VaList(bp+48, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4596, libc.VaList(bp+48, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4621, libc.VaList(bp+48, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+16) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4626, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4651, 0) doCoverageCheck = 0 goto _4 } @@ -57918,7 +58161,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4650, libc.VaList(bp+48, (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4675, libc.VaList(bp+48, (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -57942,7 +58185,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4674, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, 0) depth = d2 } } else { @@ -57951,6 +58194,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -57974,6 +58218,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, libc.VaList(bp+48, *(*Tu32)(unsafe.Pointer(bp + 12))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4724, libc.VaList(bp+48, *(*Tu32)(unsafe.Pointer(bp + 12))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -58031,10 +58276,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4736, libc.VaList(bp+48, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4761, libc.VaList(bp+48, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -58124,7 +58370,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4788 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4813 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -58143,15 +58389,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4799, libc.VaList(bp+200, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4824, libc.VaList(bp+200, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4844, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4869, 0) } } } @@ -58171,6 +58418,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+184, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -61328,16 +61592,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -61375,6 +61640,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*40) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -61778,10 +62044,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -61939,6 +62207,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -62065,6 +62334,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62167,6 +62437,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 20 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -62275,6 +62546,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 20 @@ -62704,7 +62976,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5056, libc.VaList(bp+32, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5081, libc.VaList(bp+32, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -62717,39 +62989,40 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1648 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5061) == 0 { - zColl = __ccgo_ts + 5068 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5086) == 0 { + zColl = __ccgo_ts + 5093 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5049 + v3 = __ccgo_ts + 5074 } else { v3 = __ccgo_ts + 1648 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5070 + v4 = __ccgo_ts + 5095 } else { v4 = __ccgo_ts + 1648 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5073, libc.VaList(bp+32, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5098, libc.VaList(bp+32, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5097, libc.VaList(bp+32, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5122, libc.VaList(bp+32, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1404, libc.VaList(bp+32, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5113, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pOp + 16)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5138, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pOp + 16)))) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1371, libc.VaList(bp+32, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -62767,14 +63040,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { zP4 = __ccgo_ts + 1649 } else { _ = libc.Int32FromInt32(0) - zP4 = __ccgo_ts + 5116 + zP4 = __ccgo_ts + 5141 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5123, libc.VaList(bp+32, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5148, libc.VaList(bp+32, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -62789,14 +63062,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5156, libc.VaList(bp+32, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5136, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5161, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5138 + zP4 = __ccgo_ts + 5163 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -62812,10 +63086,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5083, - 1: __ccgo_ts + 5085, - 2: __ccgo_ts + 5087, - 3: __ccgo_ts + 5092, + 0: __ccgo_ts + 5108, + 1: __ccgo_ts + 5110, + 2: __ccgo_ts + 5112, + 3: __ccgo_ts + 5117, } // C documentation @@ -62880,6 +63154,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62906,6 +63181,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62945,6 +63221,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 40 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -62977,6 +63254,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 40 v1 = p if !(v1 < pEnd) { @@ -63012,6 +63290,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 40 v3 = p if !(v3 < pEnd) { @@ -63079,6 +63358,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*4)))).FnOp goto _1 _1: + ; i++ } } @@ -63109,6 +63389,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*4)))).FaOp @@ -63130,6 +63411,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -63187,6 +63469,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -63541,6 +63824,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63593,6 +63877,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -63728,6 +64013,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -63761,6 +64047,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -63779,6 +64066,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -63793,7 +64081,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5146, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5171, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -63801,18 +64089,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 4)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5158, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5183, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5172, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5197, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+8) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5187, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 8))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 8))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5212, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 8))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 8))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ _ = libc.Int32FromInt32(0) @@ -63855,6 +64143,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -63891,6 +64180,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -63928,6 +64218,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -63997,6 +64288,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -64045,7 +64337,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -65393,7 +65707,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 48)), bp+4) + _serialGet7(tls, aKey1+uintptr(d1), bp+4) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 4))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 48)), aKey1+uintptr(d1)) @@ -65426,16 +65740,22 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 48)), bp+4) if *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 4)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+4) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 4)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 4)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 4)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + _ = libc.Int32FromInt32(0) + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 48)), bp+4) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 4)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -65458,7 +65778,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 20 + uintptr(i)*4)) != 0 { @@ -65494,7 +65814,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 48)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -65519,7 +65839,11 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 48)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 48)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 48)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 48)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+4) != 0 { + _ = libc.Int32FromInt32(0) + } else { + rc = int32(1) + } } } } @@ -65546,7 +65870,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 48))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -65590,18 +65914,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) _ = libc.Int32FromInt32(0) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -65839,8 +66164,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -65873,7 +66199,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -65938,6 +66264,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+144, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -66028,15 +66355,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*20 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5230 + zContext = __ccgo_ts + 5255 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5249 + zContext = __ccgo_ts + 5274 } else { - zContext = __ccgo_ts + 5268 + zContext = __ccgo_ts + 5293 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5277, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5302, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -66090,6 +66417,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -66158,6 +66486,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*40) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -66213,7 +66542,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5313, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5338, 0) return int32(1) } else { return 0 @@ -66223,7 +66552,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5358, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5383, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -66285,7 +66614,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -66354,6 +66683,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*40))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -66815,7 +67145,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5398, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5423, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -66873,6 +67203,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -66897,6 +67228,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 144))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -66999,6 +67331,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ _ = libc.Int32FromInt32(0) @@ -67021,7 +67354,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -67155,7 +67488,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -67326,6 +67659,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -67362,6 +67696,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -67385,6 +67720,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -67624,18 +67960,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5421, - 1: __ccgo_ts + 5426, - 2: __ccgo_ts + 5433, - 3: __ccgo_ts + 5436, - 4: __ccgo_ts + 5439, - 5: __ccgo_ts + 5442, - 6: __ccgo_ts + 5445, - 7: __ccgo_ts + 5448, - 8: __ccgo_ts + 5456, - 9: __ccgo_ts + 5459, - 10: __ccgo_ts + 5466, - 11: __ccgo_ts + 5474, + 0: __ccgo_ts + 5446, + 1: __ccgo_ts + 5451, + 2: __ccgo_ts + 5458, + 3: __ccgo_ts + 5461, + 4: __ccgo_ts + 5464, + 5: __ccgo_ts + 5467, + 6: __ccgo_ts + 5470, + 7: __ccgo_ts + 5473, + 8: __ccgo_ts + 5481, + 9: __ccgo_ts + 5484, + 10: __ccgo_ts + 5491, + 11: __ccgo_ts + 5499, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -67772,6 +68108,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -67879,14 +68216,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5481, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5506, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -68181,6 +68518,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*40, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*40) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -68459,7 +68797,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -68507,6 +68845,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68588,7 +68927,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -68657,6 +68996,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68763,7 +69103,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5521, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5546, int32(3)) _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, bp+8, zStart, int32(zRawSql)-int32(zStart)) } @@ -68808,7 +69148,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1404, libc.VaList(bp+80, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5042, libc.VaList(bp+80, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5067, libc.VaList(bp+80, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -68823,28 +69163,29 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 32 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5525, libc.VaList(bp+80, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5550, libc.VaList(bp+80, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+32) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5532, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5557, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ _ = libc.Int32FromInt32(0) - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5545, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5570, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5548, libc.VaList(bp+80, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5573, libc.VaList(bp+80, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5553, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5578, int32(1)) } } } @@ -69360,6 +69701,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -69470,19 +69812,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(704) defer tls.Free(704) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity int8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+520 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -69529,7 +69871,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+496 */ uintptr var _ /* zErr at bp+460 */ uintptr var _ /* zErr at bp+576 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -70005,8 +70347,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*20 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -70019,6 +70363,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadNInt32(db+304, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { goto abort_due_to_interrupt } @@ -70043,7 +70388,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) @@ -70072,7 +70418,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -70094,7 +70441,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70108,6 +70456,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: + ; _ = libc.Int32FromInt32(0) /* There are never any jumps to instruction 0 */ _ = libc.Int32FromInt32(0) /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*20 @@ -70121,6 +70470,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70144,6 +70494,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) @@ -70159,7 +70510,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -70195,6 +70547,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -70224,15 +70577,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5589, libc.VaList(bp+672, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5614, libc.VaList(bp+672, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5610, libc.VaList(bp+672, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5635, libc.VaList(bp+672, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+672, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = (int32(pOp) - int32(aOp)) / 20 - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5617, libc.VaList(bp+672, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5642, libc.VaList(bp+672, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) _ = libc.Int32FromInt32(0) @@ -70254,7 +70607,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -70264,7 +70618,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -70275,7 +70630,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) _ = libc.Int32FromInt32(0) @@ -70289,7 +70645,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) @@ -70331,7 +70688,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) @@ -70374,7 +70732,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -70404,6 +70764,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) @@ -70415,7 +70776,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { @@ -70436,7 +70798,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*40 @@ -70462,7 +70825,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -70482,6 +70846,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 40 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -70503,6 +70868,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70538,7 +70904,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) @@ -70552,7 +70919,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70570,6 +70938,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -70586,6 +70955,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70613,7 +70983,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -70714,11 +71085,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70728,6 +71104,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70765,18 +71142,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70810,9 +71190,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -70831,6 +71214,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, 0) @@ -70866,10 +71250,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -70933,7 +71321,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -70945,7 +71334,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) @@ -70969,7 +71359,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -70990,7 +71381,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { @@ -71099,12 +71491,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -71178,16 +71576,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 16 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -71236,7 +71644,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ _ = libc.Int32FromInt32(0) if iCompare == 0 { goto jump_to_p2 @@ -71254,6 +71663,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71281,7 +71691,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -71303,11 +71714,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71323,8 +71734,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } _ = libc.Int32FromInt32(0) @@ -71337,7 +71749,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iCompare < 0 { @@ -71370,8 +71783,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -71407,7 +71822,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71420,7 +71836,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -71436,7 +71853,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _sqlite3VdbeMemSetNull(tls, pOut) @@ -71462,15 +71880,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32((int32(pOp) - int32((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 20) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -71485,6 +71904,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -71497,6 +71917,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -71507,7 +71928,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -71545,6 +71967,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { @@ -71580,7 +72003,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40) } else { @@ -71592,7 +72016,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -71609,6 +72034,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; _ = libc.Int32FromInt32(0) pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { @@ -71631,7 +72057,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ _ = libc.Int32FromInt32(0) pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -71673,12 +72100,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset @@ -71694,9 +72123,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -71707,11 +72136,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 36)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { _ = libc.Int32FromInt32(0) - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 12)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 12)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 12)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 12)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -71738,9 +72167,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -71796,13 +72225,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -71817,16 +72246,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 64)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 64)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 64))))) } else { @@ -71835,8 +72265,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -71859,10 +72289,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 64)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -71876,10 +72308,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 64)) = *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -71899,9 +72333,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 64)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 64)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 64)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 64)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 116)) { @@ -71923,9 +72357,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding _ = libc.Int32FromInt32(0) /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 64)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 64))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 64)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 64))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -71954,13 +72388,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*20 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -71990,6 +72426,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; _ = libc.Int32FromInt32(0) pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72003,11 +72440,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 40 - goto _224 + goto _226 } } _ = libc.Int32FromInt32(0) @@ -72036,16 +72473,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 16 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -72058,14 +72495,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 40 - goto _224 - _224: + goto _226 + _226: + ; i2++ } _ = libc.Int32FromInt32(0) goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5641, libc.VaList(bp+672, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*12 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5666, libc.VaList(bp+672, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*12 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -72139,7 +72579,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -72156,8 +72597,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72175,10 +72616,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 40 @@ -72268,10 +72709,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -72352,16 +72793,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 16 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 16 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -72374,9 +72815,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -72420,9 +72861,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint32((*TMem)(unsafe.Pointer(pRec)).Fn)) @@ -72457,6 +72898,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; _ = libc.Int32FromInt32(0) pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 36)) _ = libc.Int32FromInt32(0) @@ -72480,6 +72922,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -72495,7 +72938,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5682, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5707, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -72539,19 +72982,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5733, libc.VaList(bp+672, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5758, libc.VaList(bp+672, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5755, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5780, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -72560,18 +73004,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = (int32(pOp) - int32(aOp)) / 20 (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -72593,8 +73037,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -72610,8 +73055,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -72674,6 +73120,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -72690,13 +73137,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5809, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5834, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -72706,9 +73153,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = (int32(pOp) - int32(aOp)) / 20 (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -72720,16 +73167,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 5864 + v250 = __ccgo_ts + 5889 } else { if iRollback != 0 { - v249 = __ccgo_ts + 5912 + v251 = __ccgo_ts + 5937 } else { - v249 = __ccgo_ts + 5955 + v251 = __ccgo_ts + 5980 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -72770,6 +73217,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 88)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -72826,7 +73274,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** SQL statement was prepared. */ _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+5996) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+6021) /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -72867,6 +73315,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** executing this instruction. */ _73: + ; _ = libc.Int32FromInt32(0) iDb = (*TOp)(unsafe.Pointer(pOp)).Fp1 iCookie = (*TOp)(unsafe.Pointer(pOp)).Fp3 @@ -72894,6 +73343,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the database schema version, resulting in a schema reset. */ _74: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73009,6 +73459,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: OP_OpenRead, OP_ReopenIdx */ _77: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCur = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -73020,8 +73471,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* If the cursor is not currently open or is open on a different ** index, then fall through into OP_OpenRead to force a reopen */ - _76: /* ncycle */ + _76: + ; /* ncycle */ _75: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73092,6 +73545,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** since moved into the btree layer. */ (*TVdbeCursor)(unsafe.Pointer(pCur)).FisTable = libc.BoolUint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) != -int32(8)) open_cursor_set_hints: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3BtreeCursorHintFlags(tls, *(*uintptr)(unsafe.Pointer(pCur + 36)), uint32(int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_BULKCSR)|libc.Int32FromInt32(OPFLAG_SEEKEQ)))) @@ -73107,7 +73561,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Duplicate ephemeral cursors are used for self-joins of materialized views. */ - _78: /* The new cursor */ + _78: + ; /* The new cursor */ pOrig = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) /* Only ephemeral cursors can be duplicated */ @@ -73163,8 +73618,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by this opcode will be used for automatically created transient ** indices in joins. */ - _80: /* ncycle */ + _80: + ; /* ncycle */ _79: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { @@ -73200,11 +73657,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 12)), pCx1+48, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { @@ -73242,6 +73699,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) @@ -73264,13 +73722,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; _ = libc.Int32FromInt32(0) pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) - v253 = pC4 + 16 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 16 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -73291,6 +73750,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) @@ -73312,7 +73772,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _ = libc.Int32FromInt32(0) _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) = uintptr(0) @@ -73407,10 +73868,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -73515,11 +73980,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 100))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 100))).Fdefault_rc = int8(v256) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73572,6 +74037,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 96)) != 0 { goto jump_to_p2 @@ -73651,6 +74117,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; _ = libc.Int32FromInt32(0) /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first @@ -73671,29 +74138,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 132))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 132))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*20))).Fp3)*40 *(*int32)(unsafe.Pointer(bp + 128)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+132, bp+128) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 128)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 20 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 128)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -73706,8 +74176,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -73724,6 +74195,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; _ = libc.Int32FromInt32(0) pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -73743,6 +74215,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; _ = libc.Int32FromInt32(0) pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { @@ -73840,15 +74313,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; _ = libc.Int32FromInt32(0) pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= *(*int32)(unsafe.Pointer(pOp + 16)) { goto _187 } - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -73868,11 +74345,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 160))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 160))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 160))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 _ = libc.Int32FromInt32(0) if rc != 0 { goto no_mem @@ -73913,8 +74390,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 160))).FaMem + uintptr(ii1)*40))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -73971,6 +74449,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -73992,12 +74471,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { iKey1 = uint64(*(*Ti64)(unsafe.Pointer(bp + 192))) goto notExistsWithKey } - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74015,7 +74496,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp + 188)) != 0 { _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -74032,15 +74513,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 16 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 16 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -74057,7 +74539,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 232)) = 0 *(*int32)(unsafe.Pointer(bp + 240)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -74111,8 +74594,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -74147,15 +74631,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+232) *(*Ti64)(unsafe.Pointer(bp + 232)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 232))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 36)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 232)))), 0, bp+240) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 240)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 36)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 232)))), 0, bp+240) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 240)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -74209,7 +74694,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74257,11 +74743,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 244))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 244))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 244))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -74281,11 +74767,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 244))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 244))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -74299,7 +74785,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74307,11 +74794,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 36)), *(*uintptr)(unsafe.Pointer(pSrc + 36)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -74358,6 +74845,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74387,11 +74875,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { _ = libc.Int32FromInt32(0) if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -74424,6 +74912,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -74443,6 +74932,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74470,6 +74960,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74510,6 +75001,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74554,6 +75046,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74603,6 +75096,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; _ = libc.Int32FromInt32(0) pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pC18 == uintptr(0) { @@ -74646,8 +75140,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; _ = libc.Int32FromInt32(0) pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74681,6 +75177,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; _ = libc.Int32FromInt32(0) pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74721,8 +75218,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 156 + 2*4))++ /* Opcode: Rewind P1 P2 * * * ** @@ -74740,6 +75239,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74822,11 +75322,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74836,7 +75338,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 36)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74846,6 +75349,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 36)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -74887,6 +75391,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; _ = libc.Int32FromInt32(0) pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74899,11 +75404,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -74912,11 +75417,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 300))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 (*(*TBtreePayload)(unsafe.Pointer(bp + 300))).FnMem = uint16(*(*int32)(unsafe.Pointer(pOp + 16))) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 36)), bp+300, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 36)), bp+300, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { @@ -74931,6 +75436,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; _ = libc.Int32FromInt32(0) pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74939,11 +75445,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -74968,6 +75474,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74991,7 +75498,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+404, db, uint16(0)) @@ -75220,6 +75734,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) @@ -75264,6 +75779,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 448)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75288,6 +75804,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; _ = libc.Int32FromInt32(0) pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -75312,6 +75829,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 456)) = uint32(0) _ = libc.Int32FromInt32(0) @@ -75333,6 +75851,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 460)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -75364,6 +75883,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -75378,13 +75898,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 24)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+144, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6041 + zSchema = __ccgo_ts + 6066 (*(*TInitData)(unsafe.Pointer(bp + 464))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 464))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 464))).FpzErrMsg = p + 120 (*(*TInitData)(unsafe.Pointer(bp + 464))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 464))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6055, libc.VaList(bp+672, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6080, libc.VaList(bp+672, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -75401,7 +75921,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -75422,6 +75942,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; _ = libc.Int32FromInt32(0) rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { @@ -75437,6 +75958,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -75448,6 +75970,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -75459,6 +75982,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -75480,7 +76004,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ _ = libc.Int32FromInt32(0) nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -75516,7 +76041,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) @@ -75537,6 +76063,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+504) == 0 { @@ -75572,6 +76099,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 iSet = *(*int32)(unsafe.Pointer(pOp + 16)) @@ -75612,7 +76140,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 _ = libc.Int32FromInt32(0) @@ -75634,8 +76163,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -75644,7 +76174,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 116 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6098, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6123, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -75691,8 +76221,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 40 } } else { @@ -75712,17 +76243,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint32FromInt64(80)+libc.Uint32FromInt32(7))&uint32(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint32FromInt64(80)+libc.Uint32FromInt32(7))&uint32(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*40 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*4 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint32(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*20 goto check_for_interrupt @@ -75739,6 +76270,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*20))).Fp1)*40 @@ -75753,6 +76285,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 528)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -75775,7 +76308,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -75798,14 +76332,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 @@ -75830,7 +76366,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -75857,20 +76394,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(bp + 512)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 512)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 512)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+512, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+512, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -75891,7 +76429,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { @@ -75907,7 +76446,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6135 + v286 = __ccgo_ts + 6160 } else { - v284 = __ccgo_ts + 6140 + v286 = __ccgo_ts + 6165 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6147, libc.VaList(bp+672, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6172, libc.VaList(bp+672, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -76186,11 +76735,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -76217,13 +76766,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+120, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+120, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -76235,6 +76785,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -76265,6 +76816,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; _ = libc.Int32FromInt32(0) if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -76278,6 +76830,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; _ = libc.Int32FromInt32(0) pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -76290,6 +76843,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; _ = libc.Int32FromInt32(0) pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -76312,6 +76866,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+672, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+672, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -77032,8 +77612,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*20))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*20))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -77052,7 +77633,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ _ = libc.Int32FromInt32(0) goto _187 /***************************************************************************** @@ -77062,6 +77644,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -77069,17 +77652,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 20 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -77124,12 +77710,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5398, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5423, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1618, 0) rc = int32(SQLITE_NOMEM) @@ -77138,6 +77726,7 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; _ = libc.Int32FromInt32(0) rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error @@ -77145,10 +77734,10 @@ abort_due_to_interrupt: } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5555, - 1: __ccgo_ts + 5564, - 2: __ccgo_ts + 5571, - 3: __ccgo_ts + 5577, + 0: __ccgo_ts + 5580, + 1: __ccgo_ts + 5589, + 2: __ccgo_ts + 5596, + 3: __ccgo_ts + 5602, } var _and_logic = [9]uint8{ @@ -77305,13 +77894,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1634 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6276 + v3 = __ccgo_ts + 6301 } else { - v3 = __ccgo_ts + 6281 + v3 = __ccgo_ts + 6306 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6289, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6314, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -77329,7 +77918,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6318, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6343, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -77374,15 +77963,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+4, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6338, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6363, libc.VaList(bp+296, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6368, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6393, libc.VaList(bp+296, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6404, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6429, libc.VaList(bp+296, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 4))).FzErrMsg != 0 { @@ -77407,11 +77996,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6425, libc.VaList(bp+296, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6450, libc.VaList(bp+296, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77438,14 +78028,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 36 + uintptr(j)*8))).FiFrom == iCol { - zFault = __ccgo_ts + 6446 + zFault = __ccgo_ts + 6471 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -77461,19 +78053,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6458 + zFault = __ccgo_ts + 6483 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6466, libc.VaList(bp+296, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6491, libc.VaList(bp+296, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77537,6 +78131,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+4) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -77636,7 +78231,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -77738,7 +78333,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -78752,6 +79347,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -78876,6 +79472,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -78936,6 +79533,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -79028,6 +79626,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -79084,6 +79683,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*52) goto _1 _1: + ; i++ } } @@ -79140,6 +79740,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -79348,6 +79949,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -79370,6 +79972,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79528,6 +80131,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79607,6 +80211,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*52))).FpFd == uintptr(0)) @@ -79674,6 +80279,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -80094,6 +80700,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -80104,6 +80711,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -80286,6 +80894,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -80350,6 +80959,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -80373,6 +80983,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -80456,6 +81067,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -80472,6 +81084,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -80513,6 +81126,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 68 + uintptr(i)*64))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -80546,6 +81160,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -80567,6 +81182,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -80787,6 +81403,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -80953,6 +81570,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -80974,6 +81592,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -81009,6 +81628,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -81046,6 +81666,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -81163,6 +81784,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -81375,6 +81997,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -81476,6 +82099,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 20 } @@ -81570,6 +82194,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 68 } @@ -81755,6 +82380,10 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*20))).FpExpr _ = libc.Int32FromInt32(0) + _ = libc.Int32FromInt32(0) + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -81814,6 +82443,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -81827,6 +82457,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -81933,25 +82564,25 @@ func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema _ = zLegacy _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6500, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6525, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6508+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6527+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6533+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6552+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6041+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6066+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } @@ -82037,9 +82668,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6560, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6585, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -82128,6 +82760,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -82140,7 +82773,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6565) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6590) != 0 { goto _2 } } @@ -82211,15 +82844,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 12 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 68 } @@ -82249,11 +82893,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6567, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6592, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6571, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6596, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -82262,7 +82906,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 8)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6575, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6600, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -82285,6 +82929,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 12 } @@ -82343,8 +82988,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -82383,15 +83028,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*20))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6584, libc.VaList(bp+16, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6609, libc.VaList(bp+16, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6615, libc.VaList(bp+16, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6640, libc.VaList(bp+16, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -82405,6 +83050,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -82444,7 +83090,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6670, libc.VaList(bp+16, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6695, libc.VaList(bp+16, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+44, 0, uint32(8)) return int32(WRC_Prune) @@ -82475,7 +83121,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6705 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6730 *(*uintptr)(unsafe.Pointer(pExpr + 20)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -82485,18 +83131,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6714 + v10 = __ccgo_ts + 6739 } else { - v10 = __ccgo_ts + 6729 + v10 = __ccgo_ts + 6754 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6751, libc.VaList(bp+16, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+16, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+16, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+16, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+16, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+16, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -82532,6 +83178,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { @@ -82622,19 +83269,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6781 + zIn = __ccgo_ts + 6806 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6809 + zIn = __ccgo_ts + 6834 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6827 + zIn = __ccgo_ts + 6852 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6845 + zIn = __ccgo_ts + 6870 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6863, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6888, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -82682,10 +83329,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 24)) _ = libc.Int32FromInt32(0) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse @@ -82720,6 +83367,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -82734,30 +83394,52 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - _ = libc.Int32FromInt32(0) - *(*int32)(unsafe.Pointer(pExpr + 8)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _ = libc.Int32FromInt32(0) + *(*int32)(unsafe.Pointer(pExpr + 8)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -82780,7 +83462,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6883, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6908, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -82808,22 +83490,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 20)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)) + v5 = *(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) @@ -82842,7 +83524,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*20))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6900, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6925, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -82856,17 +83538,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6964, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6989, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -82888,7 +83570,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** all this. */ _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7000, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7025, uintptr(0), pExpr) } } else { _ = libc.Int32FromInt32(0) /* Must fit in 8 bits */ @@ -82913,29 +83595,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { _ = libc.Int32FromInt32(0) if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7028, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7053, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7071 + zType = __ccgo_ts + 7096 } else { - zType = __ccgo_ts + 7078 + zType = __ccgo_ts + 7103 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7088, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7113, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7116, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7141, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7138, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7163, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7182, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7207, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -82952,11 +83634,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 24)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 24)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -82975,11 +83657,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { _ = libc.Int32FromInt32(0) if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -82998,18 +83680,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } _ = libc.Int32FromInt32(0) if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - p10 = pNC2 + 24 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p11 = pNC2 + 24 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 24)) |= savedAllowFlags @@ -83026,7 +83708,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7230, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7255, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 20))) } @@ -83039,7 +83721,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_VARIABLE): _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7241, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7266, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -83089,18 +83771,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -83135,6 +83817,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -83201,6 +83884,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -83215,7 +83899,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7252, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7277, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -83250,7 +83934,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 116 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7308, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7333, 0) return int32(1) } i = 0 @@ -83261,6 +83945,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*20+8+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -83288,7 +83973,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7342, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7367, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -83349,6 +84034,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 20 } @@ -83360,11 +84046,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20 + 8 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7348, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7373, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -83393,7 +84080,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 116 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7409, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7434, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -83422,6 +84109,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 20 } @@ -83556,10 +84244,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 20 } @@ -83672,6 +84362,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -83713,16 +84404,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7440, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7465, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -83735,6 +84428,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -83748,6 +84442,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -83776,7 +84471,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -83787,7 +84482,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7479) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7504) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -83797,11 +84492,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7485, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7510, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 20 } @@ -83964,6 +84660,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 24)) |= savedHasAgg @@ -84203,6 +84900,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*20))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -84277,8 +84975,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20)) + 8))).FpExpr } else { - _ = libc.Int32FromInt32(0) - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -84356,6 +85057,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -84821,7 +85523,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return } _ = libc.Int32FromInt32(0) @@ -84881,6 +85583,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -84905,7 +85608,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 116 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7544, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7569, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -84942,6 +85645,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*20))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -84963,6 +85667,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -85256,11 +85961,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7592 + v2 = __ccgo_ts + 7617 } else { v2 = __ccgo_ts + 1648 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7594, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7619, libc.VaList(bp+8, nExprElem, v2, nElem)) break } _ = libc.Int32FromInt32(0) @@ -85275,6 +85980,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -85339,7 +86045,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pNew + 36)) = int32((*TToken)(unsafe.Pointer(pToken)).Fz) - int32((*TParse)(unsafe.Pointer(pParse)).FzTail) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 116 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7638, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7663, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 20)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -85360,7 +86066,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7672, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7697, libc.VaList(bp+8, p)) } // C documentation @@ -85439,7 +86145,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7722, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7747, libc.VaList(bp+8, pExpr)) } } } @@ -85496,7 +86202,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 116 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7742, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 116 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7767, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 116 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -85529,7 +86235,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 116 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7785, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -85947,6 +86653,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 12 + uintptr(i)*24))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 12 + uintptr(i)*24))).FeM10d goto _1 _1: + ; i++ } } @@ -86080,6 +86787,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 20 pOldItem += 20 @@ -86159,6 +86867,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -86190,6 +86899,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -86250,6 +86960,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -86405,7 +87116,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -86426,6 +87137,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -86441,6 +87153,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -86547,7 +87260,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 116 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7838, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7863, libc.VaList(bp+8, zObject)) } } @@ -86572,6 +87285,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 20 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -86616,6 +87330,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -86647,10 +87362,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7861) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7886) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7866) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7891) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -86971,6 +87686,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -87003,6 +87719,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -87216,13 +87933,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7872) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7897) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7880) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7905) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7886) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7911) == 0 { return int32(1) } return 0 @@ -87240,9 +87957,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7872, - 1: __ccgo_ts + 7880, - 2: __ccgo_ts + 7886, + 0: __ccgo_ts + 7897, + 1: __ccgo_ts + 7905, + 2: __ccgo_ts + 7911, } _ = libc.Int32FromInt32(0) ii = 0 @@ -87260,6 +87977,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -87267,6 +87985,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -87334,6 +88053,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -87495,6 +88215,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -87527,7 +88248,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -87557,6 +88278,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -87606,6 +88328,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -87621,13 +88344,14 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } _ = libc.Int32FromInt32(0) if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8198, libc.VaList(bp+120, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8223, libc.VaList(bp+120, pExpr)) } else { _ = libc.Int32FromInt32(0) return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -89339,7 +90080,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+120, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8250, libc.VaList(bp+120, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -89364,6 +90105,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -89452,7 +90194,7 @@ expr_code_doover: _ = libc.Int32FromInt32(0) n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+120, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+120, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -89520,7 +90262,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -89581,7 +90323,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -89628,6 +90370,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -89641,7 +90384,7 @@ expr_code_doover: case int32(TK_RAISE): _ = libc.Int32FromInt32(0) if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8249, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8274, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -89705,6 +90448,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 20 i-- } @@ -89927,6 +90671,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 20 } @@ -90075,7 +90820,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -90092,9 +90839,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90114,7 +90863,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -90123,11 +90874,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90142,7 +90899,9 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) @@ -90150,9 +90909,11 @@ _13: _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -90165,7 +90926,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90178,6 +90941,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90280,7 +91044,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -90297,9 +91063,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90321,7 +91089,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -90330,11 +91100,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90349,15 +91125,19 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -90367,7 +91147,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90380,6 +91162,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90620,6 +91403,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -90841,6 +91625,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -91046,6 +91837,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*68))).FiCursor goto _1 _1: + ; i++ j++ } @@ -91098,6 +91890,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -91107,6 +91900,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -91290,6 +92084,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 16 } @@ -91322,6 +92117,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 20 } @@ -91333,6 +92129,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { @@ -91385,6 +92182,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -91403,6 +92201,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -91453,6 +92252,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 68 } /* end loop over pSrcList */ @@ -91477,6 +92277,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 24 } @@ -91589,6 +92390,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 20 } @@ -91722,6 +92524,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -91772,8 +92575,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8299, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -91792,9 +92595,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8327, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8352, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8502, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8527, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -91810,9 +92613,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8676, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8701, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8823, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8848, 0) } } @@ -91870,7 +92673,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8974, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8999, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -91879,11 +92682,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9033, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9058, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9064, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -91913,21 +92716,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9091, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9250, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9275, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9555, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9571, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9580, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9596, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9629, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9654, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -91943,8 +92746,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9894, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9919, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -91958,7 +92762,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9907, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9932, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -92003,11 +92807,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9970, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9977, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10002, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -92025,10 +92829,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 44))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10004) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10029) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10063) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10088) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -92042,13 +92846,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10116) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10141) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10162) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10187) } } /* Modify the CREATE TABLE statement. */ @@ -92064,7 +92868,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** have to use printf() to translate between these units: */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10189, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10214, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -92092,7 +92896,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10335, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10360, libc.VaList(bp+16, zTab, zDb)) } } } @@ -92132,12 +92936,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10688, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10713, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10722, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10747, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -92165,7 +92969,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(uint32(12)*uint32(nAlloc))) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10752, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10777, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { _ = libc.Int32FromInt32(0) goto exit_begin_add_column @@ -92181,6 +92985,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -92205,6 +93010,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { })(unsafe.Pointer(pTab + 44))).FaddColOffset _ = libc.Int32FromInt32(0) exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -92226,18 +93032,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10776 + zType = __ccgo_ts + 10801 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10790 + v1 = __ccgo_ts + 10815 } else { - v1 = __ccgo_ts + 10807 + v1 = __ccgo_ts + 10832 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10825, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10850, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92295,10 +93101,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -92315,12 +93122,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } _ = libc.Int32FromInt32(0) bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10864, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11046, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10889, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11071, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9894, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9919, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -92429,6 +93237,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -92494,6 +93303,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 12 + uintptr(i)*24))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -92519,6 +93329,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*8))).FzName) goto _1 _1: + ; ii++ } } @@ -92551,6 +93362,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -92569,6 +93381,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92624,6 +93437,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -92646,6 +93460,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -92684,6 +93499,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 12 } return uintptr(0) @@ -92754,6 +93570,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -92763,6 +93580,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 12 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -92786,11 +93604,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11179, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11204, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -92819,6 +93637,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -92847,6 +93666,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -92865,8 +93685,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11202, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11227, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -92882,7 +93702,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -92921,7 +93741,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11210, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11235, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -92967,11 +93787,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 _sqlite3Dequote(tls, zBuf1) if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11216, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11241, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -93011,6 +93831,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*20+8+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -93105,6 +93926,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -93145,6 +93967,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -93187,11 +94010,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*68))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93350,6 +94175,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+304, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 20))).FpNewIndex @@ -93360,6 +94186,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+304, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -93371,6 +94198,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+304, pExpr) goto _5 _5: + ; i++ } } @@ -93397,10 +94225,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93432,6 +94262,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -93445,6 +94276,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _ = libc.Int32FromInt32(0) rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -93506,6 +94338,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -93606,6 +94439,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93655,11 +94489,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93779,6 +94615,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+304, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*12)) goto _2 _2: + ; i++ } } @@ -93936,7 +94773,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName) @@ -93954,10 +94791,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11221, libc.VaList(bp+296, int32((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11246, libc.VaList(bp+296, int32((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -94009,23 +94847,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11228 + v1 = __ccgo_ts + 11253 } else { - v1 = __ccgo_ts + 5564 + v1 = __ccgo_ts + 5589 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11240, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11265, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11268, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11293, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -94038,10 +94876,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1648, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11316, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11341, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11437, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11462, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -94071,6 +94909,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -94104,6 +94943,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -94123,6 +94963,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -94140,27 +94981,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11455, + FzName: __ccgo_ts + 11480, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11476, + FzName: __ccgo_ts + 11501, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11496, + FzName: __ccgo_ts + 11521, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11515, + FzName: __ccgo_ts + 11540, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11534, + FzName: __ccgo_ts + 11559, }, } @@ -94373,7 +95214,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11637, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -94384,10 +95225,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11690, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11715, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -94396,6 +95237,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -94409,6 +95251,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -94418,15 +95261,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11557, - FzCols: __ccgo_ts + 11570, + FzName: __ccgo_ts + 11582, + FzCols: __ccgo_ts + 11595, }, 1: { - FzName: __ccgo_ts + 11583, - FzCols: __ccgo_ts + 11596, + FzName: __ccgo_ts + 11608, + FzCols: __ccgo_ts + 11621, }, 2: { - FzName: __ccgo_ts + 11624, + FzName: __ccgo_ts + 11649, }, } @@ -94598,6 +95441,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*36) goto _1 _1: + ; i++ } i = 0 @@ -94608,6 +95452,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*36) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+36) @@ -94707,6 +95552,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint32FromInt64(8) * uint32(nColUp)) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -94718,6 +95564,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*36))).FiCol = i goto _4 _4: + ; i++ } } @@ -94731,7 +95578,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11708, + FzName: __ccgo_ts + 11733, } func init() { @@ -94770,6 +95617,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -94850,6 +95698,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -94884,6 +95733,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint32(8)*uint32(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -94899,6 +95749,7 @@ find_new_min: } goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -94932,6 +95783,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -94949,10 +95801,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -94972,10 +95826,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -95026,6 +95882,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -95043,6 +95900,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -95057,6 +95915,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -95090,6 +95949,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -95103,7 +95963,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11718, + FzName: __ccgo_ts + 11743, } func init() { @@ -95156,7 +96016,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11728, libc.VaList(bp+56, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11753, libc.VaList(bp+56, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -95167,10 +96027,11 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11733, libc.VaList(bp+56, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11758, libc.VaList(bp+56, iVal)) _ = libc.Int32FromInt32(0) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -95207,9 +96068,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+24, __ccgo_ts+11739, libc.VaList(bp+56, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+24, __ccgo_ts+11764, libc.VaList(bp+56, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 24))).FnChar != 0 { @@ -95224,7 +96086,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11745, + FzName: __ccgo_ts + 11770, } func init() { @@ -95292,7 +96154,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11754, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11779, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -95309,7 +96171,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*64 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11557, uint32(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11582, uint32(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -95466,6 +96328,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -95487,6 +96350,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -95516,6 +96380,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -95538,7 +96403,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -95575,6 +96440,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -95599,6 +96465,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -95612,6 +96479,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -95622,7 +96490,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -95674,6 +96542,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -95696,9 +96565,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 40)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11768) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11793) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11772) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11797) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -95747,6 +96616,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -95856,23 +96726,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11776, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11801, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11787, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11812, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11797, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11822, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -95986,6 +96857,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -96053,6 +96925,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -96064,6 +96937,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -96170,6 +97044,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -96252,11 +97127,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { rc = SQLITE_OK _ = libc.Int32FromInt32(0) if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11583, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11608, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11809, __ccgo_ts+11878, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11834, __ccgo_ts+11903, zDb) } return rc } @@ -96305,6 +97180,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 28)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 24)).Ffirst @@ -96318,15 +97194,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11557, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11582, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11930, libc.VaList(bp+16, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11955, libc.VaList(bp+16, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -96347,6 +97224,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -96372,6 +97250,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -96438,7 +97317,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6560, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6585, zName) == 0) } // C documentation @@ -96494,7 +97373,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), __ccgo_ts+11971, db, bp+20, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), __ccgo_ts+11996, db, bp+20, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 20))) if pNewSchema != 0 { @@ -96525,7 +97404,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 116 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11974, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(db + 116 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11999, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(db + 116 + 7*4)))) goto attach_error } i = 0 @@ -96535,11 +97414,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } _ = libc.Int32FromInt32(0) if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12011, libc.VaList(bp+32, zName)) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12036, libc.VaList(bp+32, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -96583,7 +97463,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12041, 0) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12066, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -96591,7 +97471,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12070, 0) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12095, 0) rc = int32(SQLITE_ERROR) } } @@ -96640,7 +97520,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1618, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 12)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12138, libc.VaList(bp+32, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12163, libc.VaList(bp+32, zFile)) } } } @@ -96648,6 +97528,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 12)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 12)), -int32(1)) @@ -96696,18 +97577,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12166, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12191, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12187, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12212, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12213, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12238, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -96727,6 +97609,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -96782,6 +97665,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -96801,7 +97685,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12235, + FzName: __ccgo_ts + 12260, } func init() { @@ -96823,7 +97707,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12249, + FzName: __ccgo_ts + 12274, } func init() { @@ -96849,7 +97733,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12263, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12288, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -96883,7 +97767,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12287, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12312, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -96898,6 +97782,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 68 } @@ -96912,6 +97797,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -97000,6 +97886,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -97097,7 +97984,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12358, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -97125,11 +98012,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12356, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12381, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12362, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12387, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12368, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12393, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -97179,6 +98066,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -97194,7 +98082,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName } else { - zCol = __ccgo_ts + 7880 + zCol = __ccgo_ts + 7905 } } _ = libc.Int32FromInt32(0) @@ -97231,7 +98119,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12420, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -97345,6 +98233,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint32(16) * uint32((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -97396,6 +98285,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -97465,6 +98355,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -97495,6 +98386,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -97510,6 +98402,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -97539,6 +98432,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*20))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*20 + 16))) goto _5 _5: + ; i++ } } @@ -97654,26 +98548,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6560) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6585) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6533) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, __ccgo_ts+6041) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, __ccgo_ts+6066) } } } @@ -97701,14 +98596,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6041) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6066) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6533) } } } @@ -97746,7 +98642,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+396, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12410, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12435, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -97764,15 +98660,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12418 + v1 = __ccgo_ts + 12443 } else { - v1 = __ccgo_ts + 12431 + v1 = __ccgo_ts + 12456 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+8, zMsg, zName)) } } else { _ = libc.Int32FromInt32(0) @@ -97812,12 +98708,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - return __ccgo_ts + 6546 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + return __ccgo_ts + 6571 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6508+7) == 0 { - return __ccgo_ts + 6527 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6533+7) == 0 { + return __ccgo_ts + 6552 } } return zName @@ -97867,6 +98763,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -97955,6 +98852,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -97996,6 +98894,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -98028,6 +98927,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 24)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -98188,6 +99088,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 12 } @@ -98250,6 +99151,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -98357,7 +99259,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6041) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6066) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -98389,11 +99291,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6560, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6585, zName) { break } goto _1 _1: + ; i-- pDb -= 16 } @@ -98447,13 +99350,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12445, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12470, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12462, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12487, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -98502,8 +99405,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12482, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12507, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -98525,6 +99428,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -98551,6 +99455,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -98583,6 +99488,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -98646,6 +99552,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -98715,9 +99622,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -98730,7 +99637,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12524, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12549, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -98746,9 +99653,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10771 + v2 = __ccgo_ts + 10796 } else { - v2 = __ccgo_ts + 9033 + v2 = __ccgo_ts + 9058 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -98760,9 +99667,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -98786,11 +99693,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10771 + v4 = __ccgo_ts + 10796 } else { - v4 = __ccgo_ts + 9033 + v4 = __ccgo_ts + 9058 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12565, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12590, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -98799,7 +99706,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12586, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12611, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -98892,6 +99799,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -98953,7 +99861,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12646, 0) } else { _ = libc.Int32FromInt32(0) } @@ -98970,7 +99878,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+104, __ccgo_ts+12655, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+104, __ccgo_ts+12680, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 104 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -99018,7 +99926,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 116 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+24, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+24, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -99028,12 +99936,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12698, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12723, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 8))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 8))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12705, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12730, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 8))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 8))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn-- @@ -99061,6 +99969,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -99081,12 +99990,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*12))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*12))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12715, libc.VaList(bp+24, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12740, libc.VaList(bp+24, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64((int64((*TTable)(unsafe.Pointer(p)).FnCol)+int64(1))*int64(12))) @@ -99151,6 +100061,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99289,10 +100200,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*12 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12741, libc.VaList(bp+64, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12766, libc.VaList(bp+64, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12786, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12811, 0) } else { libc.Xmemset(tls, bp, 0, uint32(52)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -99350,7 +100261,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 10 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12827, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12852, 0) } } @@ -99387,7 +100298,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12879, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12904, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 28)) |= uint32(TF_HasPrimaryKey) @@ -99421,11 +100332,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -99444,13 +100357,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12945, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -99480,6 +100394,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1)))))])&int32(0x01) != 0 { @@ -99532,6 +100447,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99557,17 +100473,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*12 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12976, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13001, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13019, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13044, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13027, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13052, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -99599,8 +100515,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13034, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13059, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -99657,6 +100575,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -99694,6 +100613,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -99717,6 +100637,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -99752,18 +100673,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 12 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1648 - zSep2 = __ccgo_ts + 13065 - zEnd = __ccgo_ts + 5081 + zSep2 = __ccgo_ts + 13090 + zEnd = __ccgo_ts + 5106 } else { - zSep = __ccgo_ts + 13067 - zSep2 = __ccgo_ts + 13071 - zEnd = __ccgo_ts + 13076 + zSep = __ccgo_ts + 13092 + zSep2 = __ccgo_ts + 13096 + zEnd = __ccgo_ts + 13101 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -99771,7 +100693,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13079, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13104, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -99797,6 +100719,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ pCol += 12 } @@ -99806,11 +100729,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1648, - 1: __ccgo_ts + 13093, - 2: __ccgo_ts + 13099, - 3: __ccgo_ts + 13104, - 4: __ccgo_ts + 13109, - 5: __ccgo_ts + 13099, + 1: __ccgo_ts + 13118, + 2: __ccgo_ts + 13124, + 3: __ccgo_ts + 13129, + 4: __ccgo_ts + 13134, + 5: __ccgo_ts + 13124, } // C documentation @@ -99868,6 +100791,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 12 } @@ -99905,6 +100829,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -99971,6 +100896,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -100017,6 +100943,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -100072,6 +100999,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 28)) |= uint32(TF_HasNotNull) @@ -100134,6 +101062,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -100179,6 +101108,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -100206,12 +101136,14 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -100227,6 +101159,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -100246,6 +101179,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _ = libc.Int32FromInt32(0) @@ -100340,6 +101274,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -100452,9 +101387,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*12 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13115, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13140, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13148, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13173, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -100468,6 +101403,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } @@ -100476,11 +101412,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13200, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13225, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13250, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -100523,10 +101459,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13257, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13282, 0) return } } @@ -100540,6 +101477,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -100559,12 +101497,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9033 - zType2 = __ccgo_ts + 13301 + zType = __ccgo_ts + 9058 + zType2 = __ccgo_ts + 13326 } else { /* A view */ - zType = __ccgo_ts + 10771 - zType2 = __ccgo_ts + 13307 + zType = __ccgo_ts + 10796 + zType2 = __ccgo_ts + 13332 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -100649,13 +101587,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13312, libc.VaList(bp+40, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13337, libc.VaList(bp+40, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13327, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13352, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -100665,17 +101603,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16 _ = libc.Int32FromInt32(0) if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13425, libc.VaList(bp+40, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13450, libc.VaList(bp+40, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13467, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13492, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13501, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13526, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13522, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13547, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -100695,7 +101633,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ _ = libc.Int32FromInt32(0) - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9555) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9580) == 0 { _ = libc.Int32FromInt32(0) (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -100730,7 +101668,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 60)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13554, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13579, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -100742,11 +101680,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+60) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+10771, *(*uintptr)(unsafe.Pointer(bp + 60))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+10796, *(*uintptr)(unsafe.Pointer(bp + 60))) if _sqlite3FixSelect(tls, bp+8, pSelect) != 0 { goto create_view_fail } @@ -100791,6 +101730,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -100844,7 +101784,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13590, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13615, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } _ = libc.Int32FromInt32(0) @@ -100956,6 +101896,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*16))).FpSchema + 78 @@ -100998,6 +101939,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 24 @@ -101012,6 +101954,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -101033,7 +101976,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13620, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13645, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -101046,7 +101989,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13635, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13660, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -101098,6 +102041,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -101130,12 +102074,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13702, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13727, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -101174,7 +102119,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13716, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13741, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -101183,7 +102128,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13761, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13786, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -101218,11 +102163,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3418, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7241, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7266, int32(10)) == 0 { return 0 } return int32(1) @@ -101281,9 +102226,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName @@ -101316,18 +102261,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13828, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13853, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13856, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13881, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -101337,12 +102282,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11772, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11797, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -101384,13 +102330,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13922, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*12))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13947, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*12))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13985, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14010, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -101406,6 +102352,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*20))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -101449,10 +102396,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14079, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*20))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14104, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*20))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -101460,6 +102408,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -101479,6 +102428,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -101506,6 +102456,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 44))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -101712,15 +102663,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*20 + 8 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14125 + v2 = __ccgo_ts + 14150 } else { - v2 = __ccgo_ts + 14131 + v2 = __ccgo_ts + 14156 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14136, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14161, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -101797,7 +102749,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14164, *(*uintptr)(unsafe.Pointer(bp + 52))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14189, *(*uintptr)(unsafe.Pointer(bp + 52))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -101809,7 +102761,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14170, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14195, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -101826,16 +102778,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16 _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14220, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14245, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14298, 0) goto exit_create_index } /* @@ -101857,19 +102809,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } _ = libc.Int32FromInt32(0) - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14164, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14189, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14307, libc.VaList(bp+80, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14332, libc.VaList(bp+80, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14341, libc.VaList(bp+80, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14366, libc.VaList(bp+80, zName)) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -101887,10 +102839,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14365, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14390, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -101908,9 +102861,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -101939,7 +102892,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14164) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14189) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -101960,6 +102913,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -102028,7 +102982,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14388, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14413, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -102081,6 +103035,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 20 } @@ -102106,6 +103061,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } _ = libc.Int32FromInt32(0) @@ -102138,6 +103094,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -102169,6 +103126,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -102181,7 +103139,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14449, libc.VaList(bp+80, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14474, libc.VaList(bp+80, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -102199,6 +103157,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -102213,8 +103172,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14491, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14516, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -102257,9 +103216,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1648 } else { - v13 = __ccgo_ts + 14508 + v13 = __ccgo_ts + 14533 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14516, libc.VaList(bp+80, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14541, libc.VaList(bp+80, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -102267,7 +103226,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14536, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14561, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -102275,7 +103234,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14595, libc.VaList(bp+80, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14620, libc.VaList(bp+80, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -102295,6 +103254,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -102323,6 +103283,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 20 } } @@ -102400,6 +103361,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -102441,7 +103403,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14622, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14647, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -102450,7 +103412,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 56))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14640, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14665, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -102458,9 +103420,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -102476,13 +103438,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14713, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11768, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14738, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11793, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102592,6 +103555,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*8))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -102617,6 +103581,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -102670,7 +103635,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14773, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14798, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -102694,6 +103659,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*68)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*68)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -102707,6 +103673,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*68))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -102818,6 +103785,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 68 } @@ -102871,6 +103839,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 68 } @@ -102903,11 +103872,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14809 + v1 = __ccgo_ts + 14834 } else { - v1 = __ccgo_ts + 14812 + v1 = __ccgo_ts + 14837 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14818, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14843, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -102951,6 +103920,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _ = libc.Int32FromInt32(0) _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) @@ -103071,6 +104041,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -103088,6 +104059,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -103097,6 +104069,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -103119,7 +104092,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _ = libc.Int32FromInt32(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb _ = libc.Int32FromInt32(0) - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14854, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14879, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -103146,6 +104119,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -103168,9 +104142,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _ = libc.Int32FromInt32(0) isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14860 + v1 = __ccgo_ts + 14885 } else { - v1 = __ccgo_ts + 14869 + v1 = __ccgo_ts + 14894 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -103203,9 +104177,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14854, - 1: __ccgo_ts + 14876, - 2: __ccgo_ts + 14860, + 0: __ccgo_ts + 14879, + 1: __ccgo_ts + 14901, + 2: __ccgo_ts + 14885, } // C documentation @@ -103225,7 +104199,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14884, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14909, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -103295,6 +104269,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -103415,7 +104390,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 116))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14954, libc.VaList(bp+32, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14979, libc.VaList(bp+32, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -103425,13 +104400,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*12))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+14965, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+14990, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1661, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -103456,10 +104432,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -104575,11 +105564,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15117, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15142, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15171, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -104708,6 +105697,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -104795,6 +105785,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -104868,6 +105859,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -105001,9 +105993,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15184) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15209) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -105106,6 +106099,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -105147,7 +106141,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11557) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11582) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -105239,6 +106233,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -105325,6 +106320,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -105433,6 +106429,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*4))) @@ -105462,10 +106459,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6281, - 1: __ccgo_ts + 6276, - 2: __ccgo_ts + 8172, - 3: __ccgo_ts + 8167, + 0: __ccgo_ts + 6306, + 1: __ccgo_ts + 6301, + 2: __ccgo_ts + 8197, + 3: __ccgo_ts + 8192, 4: __ccgo_ts + 1634, } @@ -105583,7 +106580,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) return } iVal = -iVal @@ -105679,10 +106676,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -105772,6 +106771,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -105836,6 +106836,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int32(z2)-int32(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -105896,7 +106897,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15214, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15239, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -105959,6 +106960,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -105986,6 +106988,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106478,7 +107481,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 116 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15220, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15245, -int32(1)) return } if argc == int32(3) { @@ -106490,7 +107493,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15253, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15278, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+4) @@ -106662,13 +107665,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5042, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15323, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15298, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15331, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -106689,6 +107692,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') @@ -106699,7 +107703,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15305, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15339, libc.VaList(bp+16, zArg)) default: _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, pStr, __ccgo_ts+1649, int32(4)) @@ -106825,6 +107829,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -106865,6 +107870,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -106996,9 +108002,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(p)-int32(pBlob), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -107054,7 +108062,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { _ = libc.Int32FromInt32(0) - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) @@ -107109,6 +108117,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -107167,6 +108176,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -107192,6 +108202,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int32(z) - int32(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*4)))) goto _4 _4: + ; nChar++ } } @@ -107213,6 +108224,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -107236,6 +108248,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -107256,7 +108269,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11177, + 0: __ccgo_ts + 11202, } // C documentation @@ -107281,6 +108294,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -107309,6 +108323,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 @@ -107379,6 +108394,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -107402,6 +108418,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -107414,7 +108431,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15308, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15342, int32(4), libc.UintptrFromInt32(0)) } } @@ -107475,7 +108492,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12395, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12420, -int32(1)) return } if argc == int32(2) { @@ -107667,9 +108684,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -107689,7 +108706,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -107708,7 +108725,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108013,7 +109030,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15313, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15347, int32(2)) _ = libc.Int32FromInt32(0) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) @@ -108043,12 +109060,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15319, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15319, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15353, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15353, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -108363,562 +109381,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row)), - FzName: __ccgo_ts + 15324, + FzName: __ccgo_ts + 15358, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_compare)), - FzName: __ccgo_ts + 15344, + FzName: __ccgo_ts + 15378, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr)), - FzName: __ccgo_ts + 15357, + FzName: __ccgo_ts + 15391, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_affinity)), - FzName: __ccgo_ts + 15375, + FzName: __ccgo_ts + 15409, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15384, + FzName: __ccgo_ts + 15418, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15407, + FzName: __ccgo_ts + 15441, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15433, + FzName: __ccgo_ts + 15467, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15458, + FzName: __ccgo_ts + 15492, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15467, + FzName: __ccgo_ts + 15501, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15478, + FzName: __ccgo_ts + 15512, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_sqlite_offset)), - FzName: __ccgo_ts + 15485, + FzName: __ccgo_ts + 15519, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15524, + FzName: __ccgo_ts + 15558, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15531, + FzName: __ccgo_ts + 15565, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15539, + FzName: __ccgo_ts + 15573, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15546, + FzName: __ccgo_ts + 15580, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15559, + FzName: __ccgo_ts + 15593, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15565, + FzName: __ccgo_ts + 15599, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15572, + FzName: __ccgo_ts + 15606, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15579, + FzName: __ccgo_ts + 15613, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15587, + FzName: __ccgo_ts + 15621, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15592, + FzName: __ccgo_ts + 15626, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15602, + FzName: __ccgo_ts + 15636, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15608, + FzName: __ccgo_ts + 15642, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15614, + FzName: __ccgo_ts + 15648, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15641, + FzName: __ccgo_ts + 15675, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15648, + FzName: __ccgo_ts + 15682, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15655, + FzName: __ccgo_ts + 15689, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15666, + FzName: __ccgo_ts + 15700, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15673, + FzName: __ccgo_ts + 15707, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15688, + FzName: __ccgo_ts + 15722, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15739, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15716, + FzName: __ccgo_ts + 15750, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15722, + FzName: __ccgo_ts + 15756, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15748, + FzName: __ccgo_ts + 15782, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15762, + FzName: __ccgo_ts + 15796, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15770, + FzName: __ccgo_ts + 15804, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15796, + FzName: __ccgo_ts + 15830, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15800, + FzName: __ccgo_ts + 15834, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15840, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15829, + FzName: __ccgo_ts + 15863, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15840, + FzName: __ccgo_ts + 15874, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15845, + FzName: __ccgo_ts + 15879, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15850, + FzName: __ccgo_ts + 15884, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15858, + FzName: __ccgo_ts + 15892, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15870, + FzName: __ccgo_ts + 15904, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15877, + FzName: __ccgo_ts + 15911, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15883, + FzName: __ccgo_ts + 15917, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15888, + FzName: __ccgo_ts + 15922, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15892, + FzName: __ccgo_ts + 15926, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15896, + FzName: __ccgo_ts + 15930, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15902, + FzName: __ccgo_ts + 15936, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15906, + FzName: __ccgo_ts + 15940, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15911, + FzName: __ccgo_ts + 15945, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15916, + FzName: __ccgo_ts + 15950, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15921, + FzName: __ccgo_ts + 15955, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15961, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15931, + FzName: __ccgo_ts + 15965, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15969, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15939, + FzName: __ccgo_ts + 15973, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15949, + FzName: __ccgo_ts + 15983, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15954, + FzName: __ccgo_ts + 15988, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15960, + FzName: __ccgo_ts + 15994, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15977, + FzName: __ccgo_ts + 16011, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15985, + FzName: __ccgo_ts + 16019, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15993, + FzName: __ccgo_ts + 16027, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16030, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_iif)), - FzName: __ccgo_ts + 16001, + FzName: __ccgo_ts + 16035, }, } @@ -109336,6 +110354,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 36 + uintptr(i)*8))).FiFrom goto _2 _2: + ; i++ } } @@ -109375,6 +110394,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -109382,6 +110402,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -109391,11 +110412,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16005, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -109458,6 +110480,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -109497,6 +110520,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -109529,6 +110553,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -109689,6 +110714,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -109726,6 +110752,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -109832,10 +110859,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 28 + 1*4)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -109884,6 +110913,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -109945,6 +110975,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -109993,10 +111024,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -110125,6 +111158,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -110162,6 +111196,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -110189,6 +111224,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 4))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -110264,6 +111300,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110307,10 +111344,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -110335,11 +111374,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110407,6 +111448,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -110423,6 +111465,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110506,11 +111549,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 8)) = TToken{ - Fz: __ccgo_ts + 6571, + Fz: __ccgo_ts + 6596, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6567, + Fz: __ccgo_ts + 6592, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 { @@ -110569,6 +111612,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -110576,7 +111620,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5200) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5225) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -110678,6 +111722,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110733,6 +111778,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -110854,6 +111900,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 @@ -110894,6 +111941,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -111030,6 +112078,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -111040,6 +112089,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -111104,6 +112154,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -111130,6 +112181,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 24)) = pTab @@ -111171,11 +112223,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+40, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8162, libc.VaList(bp+40, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -111301,6 +112354,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111408,6 +112462,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111686,6 +112741,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8 + 4)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -111708,13 +112764,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin _ = libc.Int32FromInt32(0) } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16050, libc.VaList(bp+88, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16084, libc.VaList(bp+88, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -111722,13 +112779,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16091, libc.VaList(bp+88, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16125, libc.VaList(bp+88, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -111823,6 +112881,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -111843,16 +112902,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16123, libc.VaList(bp+88, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16157, libc.VaList(bp+88, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16175, libc.VaList(bp+88, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16209, libc.VaList(bp+88, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -111885,6 +112945,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 44)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -111895,11 +112956,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16200, libc.VaList(bp+88, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16234, libc.VaList(bp+88, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16246, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16280, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -111913,7 +112974,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -112017,6 +113078,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112057,6 +113119,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -112216,6 +113279,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -112229,9 +113293,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16267) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16301) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -112626,7 +113691,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -114875,10 +115962,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16316, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16350, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -114895,9 +115983,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16320, uint32(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16354, uint32(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -114909,7 +115998,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16326, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16360, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -114924,7 +116013,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16369, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16403, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -114946,6 +116035,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*4)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -114953,7 +116043,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16401, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16435, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -114962,7 +116052,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16281, + 0: __ccgo_ts + 16315, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -114993,6 +116083,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115076,6 +116167,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115127,6 +116219,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -115194,12 +116287,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16438, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16472, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -115247,63 +116341,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5456, - 1: __ccgo_ts + 16477, - 2: __ccgo_ts + 9033, - 3: __ccgo_ts + 16481, - 4: __ccgo_ts + 16486, - 5: __ccgo_ts + 16489, - 6: __ccgo_ts + 16499, - 7: __ccgo_ts + 16509, - 8: __ccgo_ts + 16515, - 9: __ccgo_ts + 16519, - 10: __ccgo_ts + 16524, - 11: __ccgo_ts + 16529, - 12: __ccgo_ts + 16537, - 13: __ccgo_ts + 16548, - 14: __ccgo_ts + 16551, - 15: __ccgo_ts + 16558, - 16: __ccgo_ts + 16519, - 17: __ccgo_ts + 16524, - 18: __ccgo_ts + 16565, - 19: __ccgo_ts + 16570, - 20: __ccgo_ts + 16573, - 21: __ccgo_ts + 16580, - 22: __ccgo_ts + 16515, - 23: __ccgo_ts + 16519, - 24: __ccgo_ts + 16586, - 25: __ccgo_ts + 16591, - 26: __ccgo_ts + 16596, - 27: __ccgo_ts + 16519, - 28: __ccgo_ts + 16600, - 29: __ccgo_ts + 16524, - 30: __ccgo_ts + 16608, - 31: __ccgo_ts + 16612, - 32: __ccgo_ts + 16617, - 33: __ccgo_ts + 11772, - 34: __ccgo_ts + 11768, - 35: __ccgo_ts + 16623, - 36: __ccgo_ts + 16628, - 37: __ccgo_ts + 16633, - 38: __ccgo_ts + 16477, - 39: __ccgo_ts + 16519, - 40: __ccgo_ts + 16638, - 41: __ccgo_ts + 16645, - 42: __ccgo_ts + 16652, - 43: __ccgo_ts + 9033, - 44: __ccgo_ts + 16660, - 45: __ccgo_ts + 5459, - 46: __ccgo_ts + 16666, - 47: __ccgo_ts + 16477, - 48: __ccgo_ts + 16519, - 49: __ccgo_ts + 16671, - 50: __ccgo_ts + 16676, - 51: __ccgo_ts + 15873, - 52: __ccgo_ts + 16681, - 53: __ccgo_ts + 16694, - 54: __ccgo_ts + 16703, - 55: __ccgo_ts + 16710, - 56: __ccgo_ts + 16721, + 0: __ccgo_ts + 5481, + 1: __ccgo_ts + 16511, + 2: __ccgo_ts + 9058, + 3: __ccgo_ts + 16515, + 4: __ccgo_ts + 16520, + 5: __ccgo_ts + 16523, + 6: __ccgo_ts + 16533, + 7: __ccgo_ts + 16543, + 8: __ccgo_ts + 16549, + 9: __ccgo_ts + 16553, + 10: __ccgo_ts + 16558, + 11: __ccgo_ts + 16563, + 12: __ccgo_ts + 16571, + 13: __ccgo_ts + 16582, + 14: __ccgo_ts + 16585, + 15: __ccgo_ts + 16592, + 16: __ccgo_ts + 16553, + 17: __ccgo_ts + 16558, + 18: __ccgo_ts + 16599, + 19: __ccgo_ts + 16604, + 20: __ccgo_ts + 16607, + 21: __ccgo_ts + 16614, + 22: __ccgo_ts + 16549, + 23: __ccgo_ts + 16553, + 24: __ccgo_ts + 16620, + 25: __ccgo_ts + 16625, + 26: __ccgo_ts + 16630, + 27: __ccgo_ts + 16553, + 28: __ccgo_ts + 16634, + 29: __ccgo_ts + 16558, + 30: __ccgo_ts + 16642, + 31: __ccgo_ts + 16646, + 32: __ccgo_ts + 16651, + 33: __ccgo_ts + 11797, + 34: __ccgo_ts + 11793, + 35: __ccgo_ts + 16657, + 36: __ccgo_ts + 16662, + 37: __ccgo_ts + 16667, + 38: __ccgo_ts + 16511, + 39: __ccgo_ts + 16553, + 40: __ccgo_ts + 16672, + 41: __ccgo_ts + 16679, + 42: __ccgo_ts + 16686, + 43: __ccgo_ts + 9058, + 44: __ccgo_ts + 16694, + 45: __ccgo_ts + 5484, + 46: __ccgo_ts + 16700, + 47: __ccgo_ts + 16511, + 48: __ccgo_ts + 16553, + 49: __ccgo_ts + 16705, + 50: __ccgo_ts + 16710, + 51: __ccgo_ts + 15907, + 52: __ccgo_ts + 16715, + 53: __ccgo_ts + 16728, + 54: __ccgo_ts + 16737, + 55: __ccgo_ts + 16744, + 56: __ccgo_ts + 16755, } // C documentation @@ -115322,191 +116416,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16729, + FzName: __ccgo_ts + 16763, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16744, + FzName: __ccgo_ts + 16778, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16759, + FzName: __ccgo_ts + 16793, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16771, + FzName: __ccgo_ts + 16805, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16787, + FzName: __ccgo_ts + 16821, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16710, + FzName: __ccgo_ts + 16744, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16800, + FzName: __ccgo_ts + 16834, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16812, + FzName: __ccgo_ts + 16846, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16832, + FzName: __ccgo_ts + 16866, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16848, + FzName: __ccgo_ts + 16882, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16869, + FzName: __ccgo_ts + 16903, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16884, + FzName: __ccgo_ts + 16918, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16900, + FzName: __ccgo_ts + 16934, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16914, + FzName: __ccgo_ts + 16948, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16927, + FzName: __ccgo_ts + 16961, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16941, + FzName: __ccgo_ts + 16975, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16960, + FzName: __ccgo_ts + 16994, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16979, + FzName: __ccgo_ts + 17013, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17002, + FzName: __ccgo_ts + 17036, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17011, + FzName: __ccgo_ts + 17045, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17029, + FzName: __ccgo_ts + 17063, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17046, + FzName: __ccgo_ts + 17080, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17059, + FzName: __ccgo_ts + 17093, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17074, + FzName: __ccgo_ts + 17108, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17092, + FzName: __ccgo_ts + 17126, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17102, + FzName: __ccgo_ts + 17136, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17116, + FzName: __ccgo_ts + 17150, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17132, + FzName: __ccgo_ts + 17166, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17157, + FzName: __ccgo_ts + 17191, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17176, + FzName: __ccgo_ts + 17210, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17187, + FzName: __ccgo_ts + 17221, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17198, + FzName: __ccgo_ts + 17232, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -115514,146 +116608,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17210, + FzName: __ccgo_ts + 17244, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17226, + FzName: __ccgo_ts + 17260, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17239, + FzName: __ccgo_ts + 17273, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17258, + FzName: __ccgo_ts + 17292, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17277, + FzName: __ccgo_ts + 17311, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17290, + FzName: __ccgo_ts + 17324, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17305, + FzName: __ccgo_ts + 17339, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17315, + FzName: __ccgo_ts + 17349, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17327, + FzName: __ccgo_ts + 17361, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17336, + FzName: __ccgo_ts + 17370, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17347, + FzName: __ccgo_ts + 17381, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17357, + FzName: __ccgo_ts + 17391, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17369, + FzName: __ccgo_ts + 17403, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17414, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17392, + FzName: __ccgo_ts + 17426, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17409, + FzName: __ccgo_ts + 17443, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17428, + FzName: __ccgo_ts + 17462, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17454, + FzName: __ccgo_ts + 17488, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17469, + FzName: __ccgo_ts + 17503, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17517, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17502, + FzName: __ccgo_ts + 17536, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17516, + FzName: __ccgo_ts + 17550, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17532, + FzName: __ccgo_ts + 17566, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17544, + FzName: __ccgo_ts + 17578, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17555, + FzName: __ccgo_ts + 17589, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17566, + FzName: __ccgo_ts + 17600, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -115661,45 +116755,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17578, + FzName: __ccgo_ts + 17612, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17589, + FzName: __ccgo_ts + 17623, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17610, + FzName: __ccgo_ts + 17644, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17618, + FzName: __ccgo_ts + 17652, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17633, + FzName: __ccgo_ts + 17667, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17646, + FzName: __ccgo_ts + 17680, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17665, + FzName: __ccgo_ts + 17699, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17680, + FzName: __ccgo_ts + 17714, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -115741,6 +116835,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -115799,10 +116894,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17696) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17730) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17706) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17740) { return PAGER_LOCKINGMODE_NORMAL } } @@ -115820,13 +116915,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8193) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8218) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17713) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17747) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17718) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17752) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -115849,10 +116944,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16671) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16705) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17730) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17764) == 0 { return int32(2) } else { return 0 @@ -115874,7 +116969,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17737, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17771, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt) @@ -115935,6 +117030,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -116008,15 +117104,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17799 + zName = __ccgo_ts + 17833 case int32(OE_SetDflt): - zName = __ccgo_ts + 17808 + zName = __ccgo_ts + 17842 case int32(OE_Cascade): - zName = __ccgo_ts + 17820 + zName = __ccgo_ts + 17854 case int32(OE_Restrict): - zName = __ccgo_ts + 17828 + zName = __ccgo_ts + 17862 default: - zName = __ccgo_ts + 17837 + zName = __ccgo_ts + 17871 _ = libc.Int32FromInt32(0) break } @@ -116045,12 +117141,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17847, - 1: __ccgo_ts + 17854, - 2: __ccgo_ts + 17862, - 3: __ccgo_ts + 17866, - 4: __ccgo_ts + 17730, - 5: __ccgo_ts + 17875, + 0: __ccgo_ts + 17881, + 1: __ccgo_ts + 17888, + 2: __ccgo_ts + 17896, + 3: __ccgo_ts + 17900, + 4: __ccgo_ts + 17764, + 5: __ccgo_ts + 17909, } // C documentation @@ -116116,25 +117212,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17900 + zType = __ccgo_ts + 17934 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17936 } else { - zType = __ccgo_ts + 7592 + zType = __ccgo_ts + 7617 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17904, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17938, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17879, - 2: __ccgo_ts + 17884, - 3: __ccgo_ts + 17892, + 1: __ccgo_ts + 17913, + 2: __ccgo_ts + 17918, + 3: __ccgo_ts + 17926, } // C documentation @@ -116175,8 +117272,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(208) defer tls.Free(208) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -116204,7 +117301,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+44 */ int32 var _ /* sz at bp+48 */ Tsqlite3_int64 var _ /* x at bp+24 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -116233,7 +117330,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17911, libc.VaList(bp+136, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17945, libc.VaList(bp+136, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -116384,7 +117481,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p b = -int32(1) _ = libc.Int32FromInt32(0) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17915) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17949) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -116399,6 +117496,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*16))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -116454,7 +117552,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17706 + zRet = __ccgo_ts + 17740 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -116474,6 +117572,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -116483,7 +117582,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } _ = libc.Int32FromInt32(0) if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17696 + zRet = __ccgo_ts + 17730 } _returnSingleText(tls, v, zRet) break @@ -116493,7 +117592,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -116512,6 +117611,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -116541,6 +117641,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -116723,6 +117824,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -116775,7 +117877,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*int8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+56) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 56)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17954, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -116807,7 +117909,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17979, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -116840,7 +117942,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17998) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18032) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -116914,6 +118016,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } @@ -116922,9 +118025,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18004 + v14 = __ccgo_ts + 18038 } else { - v14 = __ccgo_ts + 18012 + v14 = __ccgo_ts + 18046 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 { v15 = int32(1) @@ -116939,6 +118042,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+136, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 12 } @@ -116994,7 +118098,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18019, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18053, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 60)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+60, uintptr(0)) @@ -117010,6 +118114,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117023,25 +118128,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13019 + zType = __ccgo_ts + 13044 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18035 + zType = __ccgo_ts + 18069 } else { - zType = __ccgo_ts + 9033 + zType = __ccgo_ts + 9058 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18042, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*16))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*16))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117081,13 +118188,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*12))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18049, libc.VaList(bp+136, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18083, libc.VaList(bp+136, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18054, libc.VaList(bp+136, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18088, libc.VaList(bp+136, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117106,13 +118214,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18059, - 1: __ccgo_ts + 18061, - 2: __ccgo_ts + 16548, + 0: __ccgo_ts + 18093, + 1: __ccgo_ts + 18095, + 2: __ccgo_ts + 16582, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18063, libc.VaList(bp+136, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 56))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18097, libc.VaList(bp+136, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 56))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117129,9 +118238,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _24 } _ = libc.Int32FromInt32(0) - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18069, libc.VaList(bp+136, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18103, libc.VaList(bp+136, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117145,9 +118255,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18073, libc.VaList(bp+136, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18107, libc.VaList(bp+136, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117167,10 +118278,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 36)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 424)).Ffirst @@ -117183,6 +118296,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -117193,9 +118307,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+136, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+136, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -117204,9 +118319,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint32FromInt64(1056)/libc.Uint32FromInt64(16))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+136, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+136, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -117229,9 +118345,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+136, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FiFrom)*12))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25))), __ccgo_ts+18085)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18110, libc.VaList(bp+136, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FiFrom)*12))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25))), __ccgo_ts+18119)) goto _32 _32: + ; j2++ } i7++ @@ -117240,7 +118357,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 44)) += int32(4) v34 = pParse + 44 @@ -117301,6 +118418,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117351,6 +118469,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -117372,12 +118491,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18090, libc.VaList(bp+136, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18124, libc.VaList(bp+136, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 68))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117500,6 +118620,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -117508,6 +118629,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -117550,10 +118672,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -117564,7 +118688,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18094, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*16))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18128, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*16))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -117582,50 +118706,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).FazArg)) - if _sqlite3HashFind(tls, db+396, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -117650,6 +118730,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117675,6 +118756,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -117692,13 +118774,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 76)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 76)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18118, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18152, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -117707,6 +118789,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 76)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -117774,9 +118857,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18188, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -117790,7 +118874,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18174, libc.VaList(bp+136, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18208, libc.VaList(bp+136, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -117798,7 +118882,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18196, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18230, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -117809,10 +118893,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 76)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18219, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18253, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18221, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18255, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -117822,6 +118906,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -117839,12 +118924,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*20))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18241, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18275, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -117868,9 +118954,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 80))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18276) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18310) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -117883,9 +118969,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 80))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18297) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18331) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18333) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18367) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -117907,14 +118993,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18344) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18378) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -117936,13 +119023,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 80))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 80))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18371) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18405) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -117950,6 +119038,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 88))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117957,7 +119046,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 76)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18398) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18432) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -117976,6 +119065,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117985,17 +119075,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).FazArg)) + if _sqlite3HashFind(tls, db+396, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint32FromInt64(28)/libc.Uint32FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 72)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*20))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16)) = __ccgo_ts + 18427 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16)) = __ccgo_ts + 18461 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*20))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*20 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118056,27 +119213,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 8 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18488, libc.VaList(bp+136, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18522, libc.VaList(bp+136, zRight)) } } } @@ -118154,11 +119312,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118174,20 +119332,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17713) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17747) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18513) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18547) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17866) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17900) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -118211,11 +119369,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg) + v64 = int32((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -118283,7 +119441,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -118292,22 +119450,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 40 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 40 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema @@ -118316,17 +119474,17 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) _ = libc.Int32FromInt32(0) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -118335,15 +119493,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18521, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18555, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -118351,12 +119510,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -118455,6 +119616,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -118584,34 +119746,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18430, + FzName: __ccgo_ts + 18464, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18435, + FzName: __ccgo_ts + 18469, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18441, + FzName: __ccgo_ts + 18475, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18450, + FzName: __ccgo_ts + 18484, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18459, + FzName: __ccgo_ts + 18493, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18467, + FzName: __ccgo_ts + 18501, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18475, + FzName: __ccgo_ts + 18509, }, 7: { - FzName: __ccgo_ts + 18482, + FzName: __ccgo_ts + 18516, }, 8: {}, } @@ -118707,34 +119869,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+24, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18539) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18573) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18554, libc.VaList(bp+232, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18588, libc.VaList(bp+232, int32(cSep), _pragCName[j])) cSep = int8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18561, libc.VaList(bp+232, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18595, libc.VaList(bp+232, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18567) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18601) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18579) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18613) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) _sqlite3StrAccumFinish(tls, bp) _ = libc.Int32FromInt32(0) rc = Xsqlite3_declare_vtab(tls, db, bp+24) @@ -118810,6 +119973,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -118822,6 +119986,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -118865,6 +120031,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 16 + uintptr(i)*4)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -118940,17 +120107,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 116 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18594) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18628) if *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18602, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18636, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 16)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18606, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18640, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -119087,24 +120255,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18640, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18674, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*4)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*4)) } else { - v1 = __ccgo_ts + 5083 + v1 = __ccgo_ts + 5108 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18668, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18702, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18699, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18733, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119112,9 +120280,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18610, - 1: __ccgo_ts + 18617, - 2: __ccgo_ts + 18629, + 0: __ccgo_ts + 18644, + 1: __ccgo_ts + 18651, + 2: __ccgo_ts + 18663, } // C documentation @@ -119137,6 +120305,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119193,7 +120362,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), db+168) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } libc.SetBitFieldPtr8Uint32(db+168+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -119228,11 +120397,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*4)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18707) + _corruptSchema(tls, pData, argv, __ccgo_ts+18741) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), pIndex+44) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } } @@ -119276,18 +120445,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9033 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9058 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8105 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18720 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8130 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18754 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 44))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 44))).FiDb = iDb @@ -119349,6 +120518,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+24+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -119376,7 +120546,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 24)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12070) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12095) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119402,7 +120572,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18792) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18826) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119418,7 +120588,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl */ _ = libc.Int32FromInt32(0) (*(*TInitData)(unsafe.Pointer(bp + 44))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18816, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18850, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+44, uintptr(0)) @@ -119457,11 +120627,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 116 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18880, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18914, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -119916,6 +121092,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -119927,7 +121104,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -119942,6 +121119,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120080,6 +121258,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -120465,6 +121644,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint32FromInt64(21)/libc.Uint32FromInt64(3)) { @@ -120473,18 +121653,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11177 - zSp2 = __ccgo_ts + 11177 + zSp1 = __ccgo_ts + 11202 + zSp2 = __ccgo_ts + 11202 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18899, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18933, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -120557,6 +121738,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 12 i++ } @@ -120616,6 +121798,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -120668,6 +121851,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 20)) + 8 + uintptr(i)*20))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -120718,6 +121902,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 20)) + 8 + uintptr(i)*20))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -120783,7 +121968,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 48)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18929, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18963, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -120805,6 +121990,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -120835,7 +122021,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*8))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18979, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19013, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -120857,7 +122043,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*68 + 36 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*68 + 48)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19043, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19077, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -120881,6 +122067,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -120893,6 +122080,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 68 pLeft += 68 @@ -120901,7 +122089,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6705, + Fz: __ccgo_ts + 6730, Fn: uint32(8), } @@ -121161,7 +122349,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121183,6 +122371,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121323,6 +122512,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -121352,6 +122542,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -121368,6 +122559,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121509,9 +122701,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _ = libc.Int32FromInt32(0) /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -121558,6 +122750,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*20 + 16)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -121678,6 +122871,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 20 } @@ -121695,13 +122889,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19080 + z = __ccgo_ts + 19114 case int32(TK_INTERSECT): - z = __ccgo_ts + 19090 + z = __ccgo_ts + 19124 case int32(TK_EXCEPT): - z = __ccgo_ts + 19100 + z = __ccgo_ts + 19134 default: - z = __ccgo_ts + 19107 + z = __ccgo_ts + 19141 break } return z @@ -121722,7 +122916,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+8, zUsage)) } /* @@ -121757,11 +122951,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19136 + v1 = __ccgo_ts + 19170 } else { v1 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19185, libc.VaList(bp+8, v1)) _ = libc.Int32FromInt32(0) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) @@ -121825,6 +123019,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -121842,6 +123037,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -121956,6 +123152,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -121991,7 +123188,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*20))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 12))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 12))).FpNext = pNC @@ -122007,7 +123204,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr _ = libc.Int32FromInt32(0) if iCol < 0 { zType = __ccgo_ts + 1136 - *(*uintptr)(unsafe.Pointer(bp + 8)) = __ccgo_ts + 16660 + *(*uintptr)(unsafe.Pointer(bp + 8)) = __ccgo_ts + 16694 } else { *(*uintptr)(unsafe.Pointer(bp + 8)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*12, uintptr(0)) @@ -122077,6 +123274,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122159,13 +123357,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } _ = libc.Int32FromInt32(0) if iCol < 0 { - zCol = __ccgo_ts + 16660 + zCol = __ccgo_ts + 16694 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122173,7 +123371,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*20))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122183,6 +123381,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122266,7 +123465,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName } else { - v3 = __ccgo_ts + 16660 + v3 = __ccgo_ts + 16694 } zName = v3 } else { @@ -122282,7 +123481,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+32, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+32, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122309,6 +123508,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -122317,7 +123517,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19191, libc.VaList(bp+32, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19225, libc.VaList(bp+32, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -122334,6 +123534,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 12 } @@ -122347,6 +123548,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*12))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -122416,6 +123618,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*20))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -122432,7 +123635,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19199 + zType = __ccgo_ts + 19233 } else { zType = uintptr(0) j = int32(1) @@ -122446,6 +123649,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -122469,6 +123673,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 12 } @@ -122693,6 +123898,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -122751,7 +123957,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19203, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19237, 0) return } /* Obtain authorization to do a recursive query */ @@ -122782,6 +123988,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -122843,7 +124050,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19252, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19286, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -122852,12 +124059,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19294, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19328, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -122885,7 +124093,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19300, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19334, 0) _sqlite3Select(tls, pParse, p, bp) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -122893,6 +124101,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -122944,9 +124153,9 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if nRow == int32(1) { v1 = __ccgo_ts + 1648 } else { - v1 = __ccgo_ts + 19315 + v1 = __ccgo_ts + 19349 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19317, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19351, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123061,8 +124270,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19340, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19355, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19389, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123088,7 +124297,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19080, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19114, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123101,7 +124310,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -123145,7 +124354,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 32))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+32) _ = libc.Int32FromInt32(0) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior @@ -123211,7 +124420,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 60))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+60) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123281,6 +124490,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 4 } @@ -123306,15 +124516,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123333,9 +124546,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19429, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19441, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19475, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -123593,6 +124806,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 20 } @@ -123614,6 +124828,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -123642,6 +124857,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 16))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 20 } @@ -123673,6 +124889,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -123690,6 +124907,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -123705,6 +124923,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -123715,8 +124934,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7342) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7367) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -123760,14 +124979,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+28, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19523, libc.VaList(bp+64, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19557, libc.VaList(bp+64, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19534, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19568, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -123780,7 +124999,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19539, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19573, 0) _sqlite3Select(tls, pParse, p, bp+28) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -123998,7 +125217,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5061 + v1 = __ccgo_ts + 5086 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124039,6 +125258,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr) goto _1 _1: + ; i++ } } @@ -124071,11 +125291,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 68 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124169,11 +125391,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 68 } @@ -124295,10 +125519,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -124607,6 +125833,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -124621,6 +125848,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -124731,6 +125959,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _ = libc.Int32FromInt32(0) goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -124830,6 +126059,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*68, 0, uint32(68)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*68 + 36 @@ -124868,6 +126098,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*20 + 16)) = uint16(0) goto _12 _12: + ; i++ } _ = libc.Int32FromInt32(0) @@ -124919,10 +126150,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*68) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -125003,6 +126236,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125109,6 +126343,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125364,6 +126599,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125403,6 +126642,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -125427,10 +126667,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -125522,6 +126764,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -125544,6 +126787,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -125577,10 +126821,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -125621,13 +126867,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r } _ = libc.Int32FromInt32(0) zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15516) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15550) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15520) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15554) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -125719,10 +126965,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19545, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19579, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -125774,6 +127021,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -125798,6 +127046,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -125847,7 +127096,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 36 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19563, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19597, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -125888,6 +127137,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -125895,6 +127145,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -126027,7 +127278,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 36 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19586, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 60)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19620, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 60)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+36+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126052,7 +127303,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+36+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19606, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19640, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126066,6 +127317,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126073,7 +127325,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19649 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19683 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -126103,12 +127355,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19672, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19706, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126117,9 +127370,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+34, pTab+4) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19710 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19744 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19778 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126180,13 +127433,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19782, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19816, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+34, pTab+4) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) _ = libc.Int32FromInt32(0) /* The usual case - do not allow ROWID on a subquery */ @@ -126343,7 +127597,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19786, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19820, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126359,7 +127613,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19825, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19859, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126374,7 +127628,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 44))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } _ = libc.Int32FromInt32(0) @@ -126393,6 +127647,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 68 } @@ -126430,6 +127685,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -126509,7 +127765,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName } else { - v10 = __ccgo_ts + 6565 + v10 = __ccgo_ts + 6590 } zSchemaName = v10 } @@ -126527,18 +127783,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*20 _ = libc.Int32FromInt32(0) - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19856, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19890, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+8+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+8+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -126601,10 +127861,11 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*20 _ = libc.Int32FromInt32(0) if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { + _ = libc.Int32FromInt32(0) (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*20))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19861, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19895, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -126617,7 +127878,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+8+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -126626,23 +127887,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 68 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19904, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19888, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19922, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -126650,7 +127914,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 116 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19908, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19942, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -126735,6 +127999,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 68 } @@ -126840,6 +128105,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 24)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -126874,6 +128140,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -126940,6 +128207,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*24))).FpFExpr) goto _1 _1: + ; i++ } } @@ -127008,12 +128276,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pE + 20)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 20)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19939, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19973, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 20)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19990, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20024, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -127039,10 +128307,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20023, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20057, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 24 } @@ -127091,6 +128360,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127105,6 +128375,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -127127,6 +128398,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 24 } @@ -127248,6 +128520,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127288,6 +128561,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 20 } @@ -127313,6 +128587,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 24 } @@ -127332,6 +128607,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 16 } @@ -127356,7 +128632,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20056 + v1 = __ccgo_ts + 20090 } else { v1 = __ccgo_ts + 1648 } @@ -127365,7 +128641,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20079, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20113, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127397,7 +128673,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -127557,7 +128833,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 return 0 } /* Result is an aggregate */ _ = libc.Int32FromInt32(0) - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15810) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15844) != 0 { return 0 } /* Is count() */ _ = libc.Int32FromInt32(0) @@ -127661,6 +128937,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -127829,7 +129106,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20091, libc.VaList(bp+128, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20125, libc.VaList(bp+128, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -127905,6 +129182,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -127919,6 +129197,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -127930,7 +129209,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20145, libc.VaList(bp+128, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20179, libc.VaList(bp+128, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -128014,6 +129293,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128113,7 +129393,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+56, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20185, libc.VaList(bp+128, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20219, libc.VaList(bp+128, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+56) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+36+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128161,7 +129441,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+56, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20200, libc.VaList(bp+128, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20234, libc.VaList(bp+128, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+56) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128187,6 +129467,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128256,6 +129537,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128268,6 +129550,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128381,6 +129664,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 16))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 20 } @@ -128396,6 +129680,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 16))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 20 } @@ -128426,6 +129711,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*20))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 12))).FpOrderBy, -int32(1)) == 0 { @@ -128573,11 +129859,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20216 + v44 = __ccgo_ts + 20250 } else { - v44 = __ccgo_ts + 20225 + v44 = __ccgo_ts + 20259 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+128, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+128, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -128593,6 +129879,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -128611,6 +129898,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -128672,6 +129960,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -128789,6 +130078,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -128833,6 +130123,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -128896,7 +130187,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20216) + _explainTempTable(tls, pParse, __ccgo_ts+20250) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -128915,6 +130206,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 52))) @@ -129013,12 +130305,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*4)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20234, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20268, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129047,12 +130340,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*4)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129159,6 +130454,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129275,7 +130571,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20333, 0) goto trigger_cleanup } iDb = int32(1) @@ -129316,7 +130612,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } _ = libc.Int32FromInt32(0) - _sqlite3FixInit(tls, bp+4, pParse, iDb, __ccgo_ts+20345, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+4, pParse, iDb, __ccgo_ts+20379, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+4, pTableName) != 0 { goto trigger_cleanup } @@ -129326,11 +130622,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20353, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20387, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20394, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20428, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -129340,14 +130636,14 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20345, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20379, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } _ = libc.Int32FromInt32(0) if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema+40, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20434, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20468, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -129356,8 +130652,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20460, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20494, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129365,15 +130661,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20498 + v1 = __ccgo_ts + 20532 } else { - v1 = __ccgo_ts + 20505 + v1 = __ccgo_ts + 20539 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20511, libc.VaList(bp+64, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20545, libc.VaList(bp+64, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20548, libc.VaList(bp+64, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20582, libc.VaList(bp+64, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129393,9 +130689,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129438,6 +130734,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129449,6 +130746,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129493,7 +130791,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+56, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20345, bp+56) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20379, bp+56) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -129516,11 +130814,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20594, libc.VaList(bp+72, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20628, libc.VaList(bp+72, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129531,10 +130830,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20642, libc.VaList(bp+72, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20676, libc.VaList(bp+72, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20717, libc.VaList(bp+72, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20751, libc.VaList(bp+72, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -129555,6 +130854,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _ = libc.Int32FromInt32(0) _sqlite3DeleteTriggerStep(tls, db, pStepList) @@ -129582,6 +130882,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -129802,11 +131103,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20746, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20780, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -129815,6 +131117,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -129848,9 +131151,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if iDb == int32(1) { @@ -129865,7 +131168,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20766, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20800, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -129897,6 +131200,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } } @@ -129933,6 +131237,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -129999,11 +131304,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20828 + v1 = __ccgo_ts + 20862 } else { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20842, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20876, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -130021,6 +131326,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130108,7 +131414,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20924, 0) return int32(1) } @@ -130153,6 +131459,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130166,6 +131473,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130247,6 +131555,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130303,7 +131612,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+40, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+40, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130325,6 +131634,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130409,7 +131719,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+36) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20932, libc.VaList(bp+328, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20966, libc.VaList(bp+328, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130477,6 +131787,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130594,6 +131905,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -130658,6 +131970,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -130861,6 +132174,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -130879,6 +132193,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -130902,6 +132217,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -131038,6 +132354,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -131067,6 +132384,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131115,7 +132433,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20946, libc.VaList(bp+80, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20980, libc.VaList(bp+80, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) goto update_cleanup } } @@ -131125,6 +132443,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131134,13 +132453,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+80, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+80, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7880 + v11 = __ccgo_ts + 7905 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName } @@ -131154,6 +132473,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) @@ -131187,6 +132507,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131242,6 +132563,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131251,6 +132573,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131473,6 +132796,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131543,6 +132867,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131601,6 +132926,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -131666,6 +132992,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -131716,6 +133043,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -131827,9 +133155,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21001) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21035) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -131926,6 +133255,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -131960,6 +133290,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -132011,6 +133342,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132126,7 +133458,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(176) defer tls.Free(176) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132235,6 +133567,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132243,6 +133576,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132251,22 +133585,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]int8)(unsafe.Pointer(bp + 140)))[0] = 0 } else { - Xsqlite3_snprintf(tls, int32(16), bp+140, __ccgo_ts+21014, libc.VaList(bp+168, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+140, __ccgo_ts+21048, libc.VaList(bp+168, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+168, bp+140)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21052, libc.VaList(bp+168, bp+140)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132287,14 +133631,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132357,10 +133707,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12445, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12470, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132379,6 +133730,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132442,7 +133794,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21091, uint32(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21095, uint32(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21125, uint32(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21129, uint32(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -132544,6 +133896,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132569,17 +133922,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21099) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21133) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21139) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21173) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21182) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21216) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -132618,7 +133971,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21200, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21234, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -132632,7 +133985,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21223) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21257) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 24)) |= uint32(DBFLAG_VacuumInto) @@ -132649,7 +134002,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14854) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14879) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132680,11 +134033,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21250, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21284, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21358, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21392, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132693,7 +134046,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21412, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21446, libc.VaList(bp+24, zDbMain)) _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(db + 24)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { @@ -132704,7 +134057,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21563, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21597, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -132725,6 +134078,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -132746,6 +134100,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -132939,6 +134294,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*4)) != uintptr(0) { @@ -132948,6 +134304,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -133007,6 +134364,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -133118,6 +134476,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 24 } } @@ -133207,6 +134566,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133244,7 +134604,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 44))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 116 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133371,7 +134731,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32((*TToken)(unsafe.Pointer(pEnd)).Fz)-int32((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21693, libc.VaList(bp+8, pParse+200)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21727, libc.VaList(bp+8, pParse+200)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133381,11 +134741,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21717, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21751, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21816, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21850, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 44 @@ -133475,11 +134835,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21835, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21869, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133519,7 +134880,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, _ = libc.Int32FromInt32(0) if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21877, libc.VaList(bp+32, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21911, libc.VaList(bp+32, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 16)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -133534,7 +134895,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21907 + zFormat = __ccgo_ts + 21941 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133568,11 +134929,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16551, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16585, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133590,6 +134952,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -133605,6 +134968,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133649,7 +135013,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 44))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21953, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21987, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -133737,7 +135101,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21953, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21987, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -133772,9 +135136,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _ = libc.Int32FromInt32(0) @@ -133878,6 +135242,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -133938,6 +135303,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -133978,6 +135344,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -134045,6 +135412,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -134120,6 +135488,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134229,6 +135598,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint32((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint32(4)) @@ -134365,7 +135735,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { _ = libc.Int32FromInt32(0) ap = va @@ -134379,7 +135749,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -135101,10 +136471,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21972 + return __ccgo_ts + 22006 } if i == -int32(1) { - return __ccgo_ts + 16660 + return __ccgo_ts + 16694 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*12))).FzCnName } @@ -135124,10 +136494,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, _ = i _ = libc.Int32FromInt32(0) if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135135,19 +136505,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135155,15 +136526,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } } @@ -135196,7 +136568,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135204,27 +136576,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21990 + v2 = __ccgo_ts + 22024 } else { - v2 = __ccgo_ts + 21995 + v2 = __ccgo_ts + 22029 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22003) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22037) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22039) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } // C documentation @@ -135267,11 +136640,11 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+24, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22007 + v2 = __ccgo_ts + 22041 } else { - v2 = __ccgo_ts + 22014 + v2 = __ccgo_ts + 22048 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22019, libc.VaList(bp+136, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22053, libc.VaList(bp+136, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) _ = libc.Int32FromInt32(0) @@ -135279,37 +136652,37 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11228 + zFmt = __ccgo_ts + 11253 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22025 + zFmt = __ccgo_ts + 22059 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22058 + zFmt = __ccgo_ts + 22092 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22083 + zFmt = __ccgo_ts + 22117 } else { - zFmt = __ccgo_ts + 22101 + zFmt = __ccgo_ts + 22135 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22110, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22144, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16660 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22118, libc.VaList(bp+136, zRowid)) + zRowid = __ccgo_ts + 16694 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22152, libc.VaList(bp+136, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = int8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22149, libc.VaList(bp+136, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22183, libc.VaList(bp+136, zRowid)) cRangeOp = int8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -135320,10 +136693,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22159, libc.VaList(bp+136, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22193, libc.VaList(bp+136, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22164, libc.VaList(bp+136, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22198, libc.VaList(bp+136, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135342,7 +136715,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22191, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135376,14 +136749,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+24, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22202, libc.VaList(bp+136, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22236, libc.VaList(bp+136, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+136, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+136, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22223, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22257, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135393,15 +136766,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22013, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+136, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+136, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135545,6 +136919,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135626,6 +137001,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135660,11 +137036,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20 + 16)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -135726,6 +137104,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -135739,6 +137118,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -135854,6 +137234,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -135976,6 +137357,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -136029,6 +137411,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -136099,6 +137482,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -136140,6 +137524,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -136182,6 +137567,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 48 } @@ -136331,6 +137717,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 752 + uintptr(j)*84))).FaddrBrk @@ -136395,6 +137782,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136496,6 +137884,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136530,6 +137919,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -136956,6 +138346,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -137050,6 +138441,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*68, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*84))).FiFrom)*68, uint32(68)) goto _48 _48: + ; k++ } } else { @@ -137140,6 +138532,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -137155,7 +138548,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22231, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22265, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -137178,7 +138571,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22246, libc.VaList(bp+72, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22280, libc.VaList(bp+72, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) _ = libc.Int32FromInt32(0) if pSubWInfo != 0 { @@ -137213,6 +138606,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137286,6 +138680,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -137415,6 +138810,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 48 } @@ -137473,6 +138869,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 48 } @@ -137505,6 +138902,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137546,6 +138944,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137568,10 +138967,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 48 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137657,7 +139058,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*68 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22255, libc.VaList(bp+88, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22289, libc.VaList(bp+88, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -137671,6 +139072,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -137693,6 +139095,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -137727,6 +139130,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -137993,6 +139397,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 @@ -138123,6 +139528,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -138193,19 +139599,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16509, + FzOp: __ccgo_ts + 16543, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15840, + FzOp: __ccgo_ts + 15874, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15319, + FzOp: __ccgo_ts + 15353, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22269, + FzOp: __ccgo_ts + 22303, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138328,6 +139734,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp _ = libc.Int32FromInt32(0) goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138499,6 +139906,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 48 } @@ -138525,6 +139933,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 48 } @@ -138634,6 +140043,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 48 } @@ -138680,11 +140090,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 48 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -138712,6 +140124,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 48 } @@ -138810,6 +140223,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -138863,14 +140277,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -138914,10 +140331,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -139011,7 +140430,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } } else { @@ -139023,7 +140442,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -139114,7 +140533,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7866 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7891 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -139139,6 +140558,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -139194,6 +140614,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) goto _11 _11: + ; i1++ } } @@ -139215,7 +140636,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { - v13 = __ccgo_ts + 22317 + v13 = __ccgo_ts + 22351 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -139268,6 +140689,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*48 @@ -139290,6 +140712,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139488,6 +140911,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139509,6 +140933,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -139680,6 +141105,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr) goto _1 _1: + ; i++ } } @@ -139707,6 +141133,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -139747,7 +141174,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -139775,6 +141202,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -139954,6 +141382,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -140051,6 +141480,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 12 } @@ -140072,6 +141502,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -140079,6 +141510,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -140112,6 +141544,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -140229,6 +141662,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -140267,6 +141701,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 48 } @@ -140435,6 +141870,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140506,6 +141942,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140547,6 +141984,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140555,6 +141993,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140621,6 +142060,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 20 } @@ -140761,7 +142201,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143656,6 +145128,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 48 } } @@ -143785,6 +145258,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -143818,6 +145292,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 36 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -143894,6 +145369,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -143935,7 +145411,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*4)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*48 @@ -144000,6 +145476,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -144012,11 +145489,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*4)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -144164,7 +145642,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 20 + uintptr(iCons)*4)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*48 @@ -144215,6 +145693,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -144226,6 +145705,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -144338,6 +145818,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -144470,16 +145951,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+444, (*(*TWhereOrCost)(unsafe.Pointer(bp + 524 + 4 + uintptr(i)*12))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 484 + 4 + uintptr(j)*12))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 524 + 4 + uintptr(i)*12))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 484 + 4 + uintptr(j)*12))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 524 + 4 + uintptr(i)*12))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 484 + 4 + uintptr(j)*12))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 48 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144511,11 +145995,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 48 } return rc @@ -144590,6 +146076,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 68 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144603,7 +146090,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22423, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22457, 0) rc = SQLITE_OK } else { break @@ -144611,6 +146098,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 68 } @@ -144758,6 +146246,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -144776,6 +146265,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -144852,6 +146342,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -144929,6 +146420,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -144967,6 +146459,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -144994,11 +146487,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -145021,6 +146516,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -145184,6 +146680,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 28 pX += uintptr(nLoop) * 4 @@ -145310,6 +146807,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 28 } @@ -145375,16 +146873,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 28 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 28 } @@ -145395,10 +146896,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22458, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22492, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -145414,6 +146916,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -145431,6 +146934,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*68))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145566,6 +147070,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*4)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145583,6 +147088,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -145726,6 +147232,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 48 } if pTerm < pEnd { @@ -145743,6 +147250,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 48 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -145753,6 +147261,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi _ = libc.Int32FromInt32(0) goto _1 _1: + ; i-- } return notReady @@ -145809,6 +147318,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -145827,9 +147337,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 _ = libc.Int32FromInt32(0) pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 @@ -145840,11 +147350,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*20))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*12) - bMaybeNullRow = 0 } else { goto _1 } @@ -145875,7 +147383,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) } @@ -145886,6 +147394,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -145915,6 +147424,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -146036,7 +147546,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22476, libc.VaList(bp+40, int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22510, libc.VaList(bp+40, int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -146109,7 +147619,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22504, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22538, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -146131,6 +147641,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*68, pWInfo+76) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -146191,6 +147702,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -146369,6 +147881,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -146479,6 +147992,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 84 } @@ -146530,6 +148044,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -146537,6 +148052,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146607,6 +148123,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 44)) += n + int32(1) @@ -146684,6 +148201,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -146723,6 +148241,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } _ = libc.Int32FromInt32(0) @@ -146833,6 +148352,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 20 v10 = pOp if !(v10 < pLastOp) { @@ -146842,6 +148362,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 84 } @@ -147120,7 +148641,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22522, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22556, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -147307,7 +148829,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22578, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22612, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147631,10 +149153,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22623, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22657, libc.VaList(bp+8, zName)) } return p } @@ -147685,12 +149208,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22642, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22676, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22713, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22747, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -147763,12 +149286,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) } break } goto _1 _1: + ; i++ } } @@ -147838,6 +149362,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -147861,6 +149386,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -147886,6 +149412,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -148018,6 +149545,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -148046,7 +149574,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22776, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22810, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -148179,6 +149707,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -148339,7 +149868,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22802, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22836, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) @@ -148358,6 +149887,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -148405,18 +149935,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22834 + zErr = __ccgo_ts + 22868 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22851 + zErr = __ccgo_ts + 22885 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22867 + zErr = __ccgo_ts + 22901 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22921, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -148444,7 +149974,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22954, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148622,6 +150152,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148666,11 +150197,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22967, - 1: __ccgo_ts + 23020, - 2: __ccgo_ts + 22522, - 3: __ccgo_ts + 23071, - 4: __ccgo_ts + 23123, + 0: __ccgo_ts + 23001, + 1: __ccgo_ts + 23054, + 2: __ccgo_ts + 22556, + 3: __ccgo_ts + 23105, + 4: __ccgo_ts + 23157, } var _aOp1 = [5]int32{ @@ -148834,6 +150365,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -148894,6 +150426,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -148944,6 +150477,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -148972,6 +150506,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149023,6 +150558,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149072,6 +150608,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -149208,6 +150745,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149255,6 +150793,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -149285,6 +150824,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149650,6 +151190,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 36 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -150141,6 +151682,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -150472,11 +152014,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23173 + v1 = __ccgo_ts + 23207 } else { - v1 = __ccgo_ts + 23182 + v1 = __ccgo_ts + 23216 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23188, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23222, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -150485,7 +152027,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23230, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, 0) } } } @@ -150574,7 +152116,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23298, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -156887,103 +158429,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -157124,7 +158666,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23302, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23336, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158638,291 +160180,389 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+4) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+4) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+4) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 4)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*Tu32)(unsafe.Pointer(yymsp + 4)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*12 + 4)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) | *(*Tu32)(unsafe.Pointer(yymsp + 4)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16660, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16694, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16573, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16607, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) } *(*Tu32)(unsafe.Pointer(yymsp + 4)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*TToken)(unsafe.Pointer(yymsp + 4))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) = uint32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) - int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4 + 4)) = uint32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) - int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) + uint32(int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ _ = libc.Int32FromInt32(0) *(*TToken)(unsafe.Pointer(yymsp + 1*12 + 4)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 4))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+4) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) & ^*(*int32)(unsafe.Pointer(yymsp + 4 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*12+4, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 8)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), bp+8) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 4)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 4)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -158946,17 +160586,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) @@ -158964,10 +160609,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -158981,73 +160628,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+4, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32((*TParse)(unsafe.Pointer(pParse)).FzTail)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32((*TParse)(unsafe.Pointer(pParse)).FzTail)) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FnSrc-int32(1))*68))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 4))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), yymsp+4) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, uintptr(0), yymsp+4) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), yymsp+4) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 4)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 4 + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) } else { @@ -159081,142 +160752,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+4, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+4) } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+4) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+4, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+4) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+4) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 4)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), __ccgo_ts+23351) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), __ccgo_ts+23385) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -159229,74 +160946,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+4) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) @@ -159307,18 +161045,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+4, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 36)) = int32(*(*uintptr)(unsafe.Pointer(yymsp + 4))) - int32((*TParse)(unsafe.Pointer(pParse)).FzTail) } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)) + 1)))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 4))) @@ -159330,7 +161072,7 @@ _200: /* expr ::= VARIABLE */ *(*TToken)(unsafe.Pointer(bp + 56)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) /*A-overwrites-X*/ _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+80, bp+56)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+80, bp+56)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -159340,47 +161082,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(8))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { @@ -159392,23 +161144,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) @@ -159421,7 +161183,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) @@ -159435,33 +161198,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -159470,17 +161242,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) @@ -159493,7 +161269,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) == uintptr(0) { /* Expressions of the form ** @@ -159505,9 +161282,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { - v345 = __ccgo_ts + 7861 + v345 = __ccgo_ts + 7886 } else { - v345 = __ccgo_ts + 7866 + v345 = __ccgo_ts + 7891 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { @@ -159550,18 +161327,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 4)) != 0 { @@ -159578,13 +161358,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { @@ -159599,73 +161381,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(11))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + 4)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 64))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) (*(*TToken)(unsafe.Pointer(bp + 64))).Fn = uint32(int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))) + *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), bp+64) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4 + 4)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) @@ -159674,239 +161478,312 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 4 + 4)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23384, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23418, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23479, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23513, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23563, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23597, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))).FaffExpr = int8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uint32(int32((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+4) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+4) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 4)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _ = libc.Int32FromInt32(0) _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4 + 4)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(5))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)), *(*Tu8)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 4)) *(*TFrameBound)(unsafe.Pointer(yymsp + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*12 + 4)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*Tu8)(unsafe.Pointer(yymsp + 4)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 4)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) } else { @@ -159915,11 +161792,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -159929,20 +161808,24 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) _ = libc.Int32FromInt32(0) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 _341: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -159961,6 +161844,7 @@ _341: goto _342 /********** End reduce actions ************************************************/ _342: + ; _ = libc.Int32FromInt32(0) yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) @@ -159996,9 +161880,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+16, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+16, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23648, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23682, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -162054,6 +163938,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -162233,6 +164118,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -162248,6 +164134,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -162292,6 +164179,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -162387,6 +164275,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -162418,6 +164307,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -162429,6 +164319,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -162463,6 +164354,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -162481,6 +164373,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -162504,6 +164397,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -162526,6 +164420,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -162544,6 +164439,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -162565,6 +164461,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -162684,7 +164581,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 1216))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 1216))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23665, libc.VaList(bp+1232, bp+1216)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23699, libc.VaList(bp+1232, bp+1216)) break } } @@ -162710,7 +164607,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+1232, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23690, libc.VaList(bp+1232, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23724, libc.VaList(bp+1232, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -162826,7 +164723,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*int8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*int8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -162836,9 +164733,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -162852,7 +164749,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -162864,7 +164761,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -162873,9 +164770,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*int8)(unsafe.Pointer(zSql))) @@ -162896,13 +164793,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*int8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23701, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23735, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -162910,13 +164808,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20345, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20379, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23708, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23742, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23713, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23747, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -162926,10 +164824,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23723, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23757, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23727, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23761, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -163189,6 +165087,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -163362,8 +165262,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -163371,7 +165271,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint32FromInt64(116)/libc.Uint32FromInt64(4)) && _aMsg[rc] != uintptr(0) { @@ -164502,31 +166421,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23803, - 1: __ccgo_ts + 23816, - 3: __ccgo_ts + 23832, - 4: __ccgo_ts + 23857, - 5: __ccgo_ts + 23871, - 6: __ccgo_ts + 23890, + 0: __ccgo_ts + 23837, + 1: __ccgo_ts + 23850, + 3: __ccgo_ts + 23866, + 4: __ccgo_ts + 23891, + 5: __ccgo_ts + 23905, + 6: __ccgo_ts + 23924, 7: __ccgo_ts + 1618, - 8: __ccgo_ts + 23915, - 9: __ccgo_ts + 23952, - 10: __ccgo_ts + 23964, - 11: __ccgo_ts + 23979, - 12: __ccgo_ts + 24012, - 13: __ccgo_ts + 24030, - 14: __ccgo_ts + 24055, - 15: __ccgo_ts + 24084, - 17: __ccgo_ts + 5996, - 18: __ccgo_ts + 5398, - 19: __ccgo_ts + 24101, - 20: __ccgo_ts + 24119, - 21: __ccgo_ts + 24137, - 23: __ccgo_ts + 24171, - 25: __ccgo_ts + 24192, - 26: __ccgo_ts + 24218, - 27: __ccgo_ts + 24241, - 28: __ccgo_ts + 24262, + 8: __ccgo_ts + 23949, + 9: __ccgo_ts + 23986, + 10: __ccgo_ts + 23998, + 11: __ccgo_ts + 24013, + 12: __ccgo_ts + 24046, + 13: __ccgo_ts + 24064, + 14: __ccgo_ts + 24089, + 15: __ccgo_ts + 24118, + 17: __ccgo_ts + 6021, + 18: __ccgo_ts + 5423, + 19: __ccgo_ts + 24135, + 20: __ccgo_ts + 24153, + 21: __ccgo_ts + 24171, + 23: __ccgo_ts + 24205, + 25: __ccgo_ts + 24226, + 26: __ccgo_ts + 24252, + 27: __ccgo_ts + 24275, + 28: __ccgo_ts + 24296, } // C documentation @@ -164708,7 +166627,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -164754,7 +166673,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24359, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24393, 0) _ = libc.Int32FromInt32(0) return int32(SQLITE_BUSY) } else { @@ -164828,6 +166747,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -164882,7 +166802,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24422, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24456, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -165161,7 +167081,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { @@ -165171,7 +167091,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24473, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24507, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -165247,6 +167167,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -165295,7 +167216,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165428,7 +167349,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165438,7 +167359,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165488,7 +167409,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -165497,7 +167418,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24494, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24528, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -165523,6 +167444,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -165657,7 +167579,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) _ = libc.Int32FromInt32(0) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24562, uint32(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24596, uint32(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -165671,6 +167593,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -165686,8 +167609,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24568, zUri+7, uint32(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24578, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24602, zUri+7, uint32(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24612, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -165777,20 +167700,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24606, zOpt, uint32(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24640, zOpt, uint32(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24610, zOpt, uint32(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24644, zOpt, uint32(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24610 + zModeType = __ccgo_ts + 24644 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24631, zOpt, uint32(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24665, zOpt, uint32(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -165819,15 +167742,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24646, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24680, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24666, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24700, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -165851,10 +167775,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24690, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24724, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -165869,11 +167794,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24616, + Fz: __ccgo_ts + 24650, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24623, + Fz: __ccgo_ts + 24657, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -165884,19 +167809,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24636, + Fz: __ccgo_ts + 24670, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24639, + Fz: __ccgo_ts + 24673, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24642, + Fz: __ccgo_ts + 24676, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17730, + Fz: __ccgo_ts + 17764, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -166025,8 +167950,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22317, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24706, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22351, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24740, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -166050,7 +167975,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+4, bp+8) } @@ -166087,9 +168012,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6560 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6585 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FzDbSName = __ccgo_ts + 23708 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FzDbSName = __ccgo_ts + 23742 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -166111,6 +168036,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -166134,6 +168060,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166182,7 +168109,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24712 + zFilename = __ccgo_ts + 24746 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -166300,6 +168227,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166325,6 +168253,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -166401,20 +168330,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24715, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24749, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24740) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24774) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24760) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24794) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24767) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24801) } // C documentation @@ -166479,6 +168408,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -166520,6 +168450,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -166542,7 +168473,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24784, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24818, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -167188,6 +169119,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte += int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*4))) + uint32(1)) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -167207,6 +169139,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*4))) goto _3 _3: + ; i++ } v4 = p @@ -167573,7 +169506,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24812, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24846, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -167589,6 +169522,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -167675,6 +169609,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 560 } } @@ -167696,6 +169631,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 560 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -167775,6 +169711,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -167791,7 +169728,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui _leaveMutex(tls) _ = libc.Int32FromInt32(0) if rc != 0 { - v2 = __ccgo_ts + 24820 + v2 = __ccgo_ts + 24854 } else { v2 = uintptr(0) } @@ -168675,18 +170612,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1634, - 1: __ccgo_ts + 7861, - 2: __ccgo_ts + 7866, - 3: __ccgo_ts + 6281, - 4: __ccgo_ts + 6281, - 5: __ccgo_ts + 6276, - 6: __ccgo_ts + 6276, - 7: __ccgo_ts + 8172, - 8: __ccgo_ts + 8172, - 9: __ccgo_ts + 8172, - 10: __ccgo_ts + 8172, - 11: __ccgo_ts + 24843, - 12: __ccgo_ts + 24849, + 1: __ccgo_ts + 7886, + 2: __ccgo_ts + 7891, + 3: __ccgo_ts + 6306, + 4: __ccgo_ts + 6306, + 5: __ccgo_ts + 6301, + 6: __ccgo_ts + 6301, + 7: __ccgo_ts + 8197, + 8: __ccgo_ts + 8197, + 9: __ccgo_ts + 8197, + 10: __ccgo_ts + 8197, + 11: __ccgo_ts + 24877, + 12: __ccgo_ts + 24883, 13: __ccgo_ts + 1648, 14: __ccgo_ts + 1648, 15: __ccgo_ts + 1648, @@ -169114,6 +171051,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 8 + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -169205,6 +171143,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -169221,6 +171160,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -169534,6 +171474,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -169547,6 +171488,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 16 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -169586,13 +171528,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 16 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)>>int32(4)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)>>int32(4)))) v22 = p + 16 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)&int32(0xf)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -169628,7 +171571,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1634, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24873, libc.VaList(bp+64, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15323, libc.VaList(bp+64, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -169649,7 +171592,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24907, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -169705,7 +171648,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24936, -int32(1)) } } } @@ -169874,6 +171817,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -169896,6 +171840,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -169952,6 +171897,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -169985,8 +171931,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(3), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24925, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24951, + FzRepl: __ccgo_ts + 24955, }, 1: { Fc1: int8('i'), @@ -169994,8 +171940,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(8), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24937, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24963, + FzRepl: __ccgo_ts + 24955, }, 2: { Fc1: int8('n'), @@ -170010,7 +171956,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('Q'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24946, + FzMatch: __ccgo_ts + 24972, FzRepl: __ccgo_ts + 1634, }, 4: { @@ -170018,7 +171964,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: int8('S'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24951, + FzMatch: __ccgo_ts + 24977, FzRepl: __ccgo_ts + 1634, }, } @@ -170034,7 +171980,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24956, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24982, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -170459,6 +172405,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -170490,7 +172437,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+24999, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25025, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -170609,6 +172556,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { case int32('{'): goto _1 @@ -170689,6 +172637,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170762,6 +172711,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -170801,14 +172751,17 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + _ = libc.Int32FromInt32(0) _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) iStart = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { @@ -170869,19 +172822,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -170943,24 +172900,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7861, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7886, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7866, uint32(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7891, uint32(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -170970,19 +172931,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171001,6 +172974,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -171015,14 +172989,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24925, int32(3)) == 0 { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24951, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25021, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25047, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -171052,6 +173026,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -171061,6 +173036,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*int8)(unsafe.Pointer(z + uintptr(j))) @@ -171105,6 +173081,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -171117,6 +173094,7 @@ parse_number_2: } } parse_number_finish: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171126,33 +173104,50 @@ parse_number_finish: _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -171162,12 +173157,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1634, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*int8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -171185,7 +173182,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -171193,11 +173190,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -171228,7 +173227,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -171241,7 +173240,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -171263,6 +173262,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint32(56)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -171401,22 +173404,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1634, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7861, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7886, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7866, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7891, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -171449,16 +173458,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24929 + v19 = __ccgo_ts + 24955 } else { - v19 = __ccgo_ts + 11728 + v19 = __ccgo_ts + 11753 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171481,16 +173492,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, int8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, int8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, int8('"')) @@ -171502,6 +173517,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -171513,7 +173529,7 @@ _11: sz2 -= k2 } if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25027, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25053, uint32(2)) zIn2++ sz2-- continue @@ -171529,7 +173545,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, int8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25030, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25056, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 25 @@ -171537,12 +173553,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25037, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25063, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25042, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25068, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -171572,9 +173588,11 @@ _11: _jsonAppendChar(tls, pOut, int8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, int8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -171592,6 +173610,7 @@ _13: _jsonAppendChar(tls, pOut, int8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, int8('{')) j = i + n @@ -171617,11 +173636,14 @@ _14: _jsonAppendChar(tls, pOut, int8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 25 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -171692,6 +173714,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -172115,6 +174138,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -172133,6 +174157,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -172349,7 +174374,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -172384,25 +174409,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -172447,11 +174477,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -172464,11 +174497,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -172539,6 +174576,7 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ _ = libc.Int32FromInt32(0) @@ -172546,7 +174584,9 @@ _10: Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -172560,14 +174600,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } @@ -172608,7 +174652,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24907, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -172621,7 +174665,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint32(56)) return int32(1) @@ -172640,10 +174684,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -172682,7 +174726,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25049, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25075, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -172769,15 +174813,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -172863,6 +174909,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(56)) if p == uintptr(0) { goto json_pfa_oom @@ -172906,12 +174953,13 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } + _ = libc.Int32FromInt32(0) if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -172951,15 +174999,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -173051,6 +175101,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, int8(']')) @@ -173088,7 +175139,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25067 + v1 = __ccgo_ts + 25093 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -173098,7 +175149,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } eErr = uint8(1) @@ -173129,6 +175180,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173147,6 +175199,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173220,9 +175273,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25069, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25095, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5136, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5161, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1661, uint32(1)) @@ -173231,9 +175284,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25097, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25074, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25100, uint32(1)) } } } @@ -173274,7 +175327,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -173284,6 +175337,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -173294,6 +175348,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -173542,7 +175597,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -173566,7 +175621,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25076, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25102, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -173577,7 +175632,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25127, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25153, -int32(1)) _jsonStringReset(tls, bp) return } @@ -173589,6 +175644,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*4))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, int8('}')) @@ -173648,21 +175704,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -173680,7 +175739,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15762) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15796) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -173711,9 +175770,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25161 + v1 = __ccgo_ts + 25187 } else { - v1 = __ccgo_ts + 25165 + v1 = __ccgo_ts + 25191 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -173761,7 +175820,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_type_done @@ -173771,6 +175830,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -173848,7 +175908,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25172, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25198, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -173954,6 +176014,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -174037,7 +176098,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25229, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25255, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174103,6 +176164,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -174185,7 +176247,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25232, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25258, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174288,7 +176350,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25235) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25261) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(16)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -174424,7 +176486,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+40, __ccgo_ts+25318, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+40, __ccgo_ts+25344, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -174445,13 +176507,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+40, __ccgo_ts+25325, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+40, __ccgo_ts+25351, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+40, __ccgo_ts+25333, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+40, __ccgo_ts+25359, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -174615,6 +176678,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+168, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -174644,9 +176710,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -174707,6 +176773,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -174837,7 +176904,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+40, __ccgo_ts+25339, uint32(1)) + _jsonAppendRaw(tls, p+40, __ccgo_ts+25365, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+168, i, bp) @@ -174858,8 +176925,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24910, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24936, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -174920,176 +176988,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25341, + FzName: __ccgo_ts + 25367, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25346, + FzName: __ccgo_ts + 25372, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25352, + FzName: __ccgo_ts + 25378, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25363, + FzName: __ccgo_ts + 25389, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25393, + FzName: __ccgo_ts + 25419, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25413, + FzName: __ccgo_ts + 25439, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25426, + FzName: __ccgo_ts + 25452, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25440, + FzName: __ccgo_ts + 25466, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25443, + FzName: __ccgo_ts + 25469, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25447, + FzName: __ccgo_ts + 25473, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25459, + FzName: __ccgo_ts + 25485, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25472, + FzName: __ccgo_ts + 25498, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25484, + FzName: __ccgo_ts + 25510, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25497, + FzName: __ccgo_ts + 25523, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25508, + FzName: __ccgo_ts + 25534, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25520, + FzName: __ccgo_ts + 25546, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25531, + FzName: __ccgo_ts + 25557, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25543, + FzName: __ccgo_ts + 25569, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25556, + FzName: __ccgo_ts + 25582, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25569, + FzName: __ccgo_ts + 25595, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25583, + FzName: __ccgo_ts + 25609, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25592, + FzName: __ccgo_ts + 25618, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25623, + FzName: __ccgo_ts + 25649, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25640, + FzName: __ccgo_ts + 25666, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25658, + FzName: __ccgo_ts + 25684, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25676, + FzName: __ccgo_ts + 25702, }, } @@ -175159,6 +177227,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -175169,11 +177238,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25695, + FzName: __ccgo_ts + 25721, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25705, + FzName: __ccgo_ts + 25731, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -175707,6 +177776,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -175743,6 +177813,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -175782,11 +177853,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -175826,10 +177895,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25715, iNode, 0, pRtree+72) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25741, iNode, 0, pRtree+72) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -175883,6 +177951,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -175911,6 +177980,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -176035,6 +178105,7 @@ func _nodeGetRowid(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) (r // ** Return coordinate iCoord from cell iCell in node pNode. // */ func _nodeGetCoord(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iCoord int32, pCoord uintptr) { + _ = libc.Int32FromInt32(0) _readCoord(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+uintptr(int32(12)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*iCell+int32(4)*iCoord), pCoord) } @@ -176136,7 +178207,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25720, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25746, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -176197,6 +178268,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -176210,6 +178282,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 60 + uintptr(ii)*4))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -176234,7 +178307,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -176542,6 +178617,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -176980,6 +179062,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -177056,7 +179141,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25802) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25828) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -177194,6 +179279,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -177282,6 +179368,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -177301,6 +179388,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -177352,6 +179440,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -177515,6 +179604,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -177530,6 +179620,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -177613,11 +179704,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -177673,6 +179766,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -177696,6 +179790,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -177704,6 +179799,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 4)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -177876,11 +179972,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*4)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*4)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -177911,6 +180009,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -177924,6 +180023,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -177933,6 +180033,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*4)))))*48, uint32(48)) @@ -177959,6 +180060,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -177986,6 +180088,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -178034,6 +180137,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -178115,6 +180219,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -178130,6 +180235,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -178146,6 +180252,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -178190,6 +180297,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -178281,6 +180389,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+4, bp+52) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 4))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -178391,6 +180500,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -178494,6 +180604,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -178573,7 +180684,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) _ = libc.Int32FromInt32(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25816, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25842, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -178583,11 +180694,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25836, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25862, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25868, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25894, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178662,6 +180773,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -178678,6 +180790,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -178741,6 +180854,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*4))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -178748,6 +180862,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -178761,8 +180876,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - _ = libc.Int32FromInt32(0) - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -178781,6 +180895,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -178794,7 +180912,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25905, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25931, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -178848,9 +180966,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26050 + zFmt = __ccgo_ts + 26076 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11557, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11582, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -178901,15 +181019,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26106, - 1: __ccgo_ts + 5459, - 2: __ccgo_ts + 16660, + 0: __ccgo_ts + 26132, + 1: __ccgo_ts + 5484, + 2: __ccgo_ts + 16694, } var _rtreeModule = Tsqlite3_module{ @@ -178934,7 +181053,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 76)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 92)) = __ccgo_fp(_rtreeShadowName) @@ -178953,20 +181072,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26520, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26546, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26582, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26608, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26587, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26651, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26721, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26613, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26677, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26747, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -178996,7 +181116,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 26770 + zFormat = __ccgo_ts + 26796 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -179007,33 +181127,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26878, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26904, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26923, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26949, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13090, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26950, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26976, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26972, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26998, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26980, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27006, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -179047,14 +181169,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26111, - 1: __ccgo_ts + 26164, - 2: __ccgo_ts + 26209, - 3: __ccgo_ts + 26261, - 4: __ccgo_ts + 26315, - 5: __ccgo_ts + 26360, - 6: __ccgo_ts + 26418, - 7: __ccgo_ts + 26473, + 0: __ccgo_ts + 26137, + 1: __ccgo_ts + 26190, + 2: __ccgo_ts + 26235, + 3: __ccgo_ts + 26287, + 4: __ccgo_ts + 26341, + 5: __ccgo_ts + 26386, + 6: __ccgo_ts + 26444, + 7: __ccgo_ts + 26499, } // C documentation @@ -179112,7 +181234,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26996, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27022, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -179123,14 +181245,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27016, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27042, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+16) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -179207,13 +181329,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint32(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint32(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27265, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27291, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) ii = int32(4) for { if !(ii < argc) { @@ -179222,7 +181344,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)) if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27289, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27315, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -179233,9 +181355,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -179287,6 +181410,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -179297,8 +181421,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27295, - 1: __ccgo_ts + 27306, + 0: __ccgo_ts + 27321, + 1: __ccgo_ts + 27332, } // C documentation @@ -179356,22 +181480,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+28, bp, ii, bp+528) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11177, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11202, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27319, libc.VaList(bp+584, (*(*TRtreeCell)(unsafe.Pointer(bp + 528))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27345, libc.VaList(bp+584, (*(*TRtreeCell)(unsafe.Pointer(bp + 528))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 28))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27325, libc.VaList(bp+584, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 528 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27351, libc.VaList(bp+584, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 528 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27329, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27355, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -179395,7 +181521,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27331, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27357, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -179513,11 +181639,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4178 + v1 = __ccgo_ts + 4203 } else { v1 = __ccgo_ts + 1648 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27364, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27390, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -179551,7 +181677,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27371, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27397, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -179568,7 +181694,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27416, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27442, libc.VaList(bp+8, iNode)) } } return pRet @@ -179597,8 +181723,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27448, - 1: __ccgo_ts + 27502, + 0: __ccgo_ts + 27474, + 1: __ccgo_ts + 27528, } _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pCheck + 24 + uintptr(bLeaf)*4)) == uintptr(0) { @@ -179612,21 +181738,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27550 + v1 = __ccgo_ts + 27576 } else { - v1 = __ccgo_ts + 27558 + v1 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27567, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27593, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27550 + v2 = __ccgo_ts + 27576 } else { - v2 = __ccgo_ts + 27558 + v2 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27612, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27638, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -179671,7 +181797,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27670, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27696, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -179689,11 +181815,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27718, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27744, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -179723,19 +181850,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27785, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27811, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27819, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27845, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27849, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27875, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -179755,6 +181882,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -179779,12 +181907,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27904, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27930, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27935, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27961, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -179813,7 +181941,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28002, libc.VaList(bp+64, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28028, libc.VaList(bp+64, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -179823,11 +181951,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25816, libc.VaList(bp+64, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25842, libc.VaList(bp+64, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28030, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28056, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -179843,8 +181971,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28061, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28068, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28087, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28094, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -179872,7 +182000,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28076, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28102, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -179923,13 +182051,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28095, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28121, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6560 + zDb = __ccgo_ts + 6585 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*4))) } @@ -179938,7 +182066,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18427 + v1 = __ccgo_ts + 18461 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -180161,6 +182289,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -180271,6 +182400,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -180331,6 +182461,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -180401,18 +182532,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25069, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25095, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28146, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28172, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28157, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28183, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180441,19 +182573,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = int8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28168, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28186, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28212, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = int8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28220, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -180461,13 +182594,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28202, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28228, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28206, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28232, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180519,6 +182653,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -180548,6 +182683,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -180613,6 +182749,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -180691,6 +182828,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -180760,6 +182898,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -180769,6 +182908,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, uint64(libc.Uint32FromInt64(40)+libc.Uint32FromInt64(4)*libc.Uint32FromInt32(2)*uint32(libc.Int32FromInt32(4)-libc.Int32FromInt32(4)))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -180796,18 +182936,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4)) } _2: + ; return pOut } @@ -180990,6 +183134,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -181166,6 +183311,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -181232,6 +183378,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -181240,6 +183387,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -181251,6 +183399,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -181319,6 +183468,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -181335,6 +183485,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -181401,6 +183552,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -181425,6 +183577,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181461,6 +183614,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181485,6 +183639,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -181574,13 +183729,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint32(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint32(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28219, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28245, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -181589,12 +183744,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28241, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28267, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -181623,6 +183779,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -181775,6 +183932,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 4)) @@ -181825,11 +183983,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16660 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16694 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -181839,7 +183998,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28245 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28271 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -181847,7 +184006,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28251 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28277 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -181969,7 +184128,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*4)), bp+4+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28260, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28286, 0) } goto geopoly_update_end } @@ -182049,6 +184208,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*4))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -182057,6 +184217,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -182070,12 +184231,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28300) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28326) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28316) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28342) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -182131,6 +184292,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -182141,10 +184303,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28493, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28519, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -182158,61 +184321,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28331, + FzName: __ccgo_ts + 28357, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28344, + FzName: __ccgo_ts + 28370, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28357, + FzName: __ccgo_ts + 28383, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28370, + FzName: __ccgo_ts + 28396, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28316, + FzName: __ccgo_ts + 28342, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28382, + FzName: __ccgo_ts + 28408, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28300, + FzName: __ccgo_ts + 28326, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28405, + FzName: __ccgo_ts + 28431, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28419, + FzName: __ccgo_ts + 28445, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28432, + FzName: __ccgo_ts + 28458, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28446, + FzName: __ccgo_ts + 28472, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28462, + FzName: __ccgo_ts + 28488, }, } @@ -182238,7 +184401,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28474, + FzName: __ccgo_ts + 28500, }, } @@ -182263,20 +184426,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28501, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28527, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28511, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28537, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28522, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28548, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28245, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28271, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28533, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28559, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -182321,6 +184484,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -182370,13 +184534,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 28 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*4))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25802, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25828, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -183593,7 +185758,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -183603,7 +185768,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -183706,6 +185871,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -183784,7 +185950,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28564, uintptr(0), uintptr(0), p+36) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28590, uintptr(0), uintptr(0), p+36) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -183874,7 +186040,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+25715, zIn, uint32(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+25741, zIn, uint32(4)) == 0 { i = int32(4) for { if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -183882,6 +186048,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -183910,13 +186077,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint32(108)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28735 + v1 = __ccgo_ts + 28761 } else { v1 = __ccgo_ts + 1648 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+28776, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+28802, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+4, p+36, __ccgo_ts+28926) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+4, p+36, __ccgo_ts+28952) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -184146,7 +186313,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29051, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29077, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -184156,7 +186323,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29170, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29196, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -184164,7 +186331,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29191, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29217, libc.VaList(bp+24, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -184176,7 +186343,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29242, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29268, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -184187,6 +186354,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(i < libc.Uint32FromInt64(16)/libc.Uint32FromInt64(4)) { @@ -184195,6 +186363,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -184217,7 +186386,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint32(1)*uint32((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184230,7 +186399,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint32(1)*uint32((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(1)) if iCid >= 0 { @@ -184284,7 +186453,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+36, bp+4, pIter+60) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19870, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19904, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -184296,7 +186465,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29320, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29346, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -184307,7 +186476,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29339, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29365, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+32) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 8 @@ -184315,12 +186484,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*4)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29344, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29370, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184328,17 +186498,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29354 + v4 = __ccgo_ts + 29380 } else { - v4 = __ccgo_ts + 29367 + v4 = __ccgo_ts + 29393 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29376, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29402, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29405, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29431, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184355,11 +186525,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29427, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29453, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -184408,10 +186579,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29454, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29480, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14990 goto _1 _1: + ; i++ } return zList @@ -184442,12 +186614,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29463, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29489, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -184489,21 +186662,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29476, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29502, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29508, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29534, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+29531) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29537, __ccgo_ts+29544, __ccgo_ts+5081) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+29557) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29563, __ccgo_ts+29570, __ccgo_ts+5106) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29552, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29578, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29594, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29620, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -184555,7 +186728,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1648 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -184572,20 +186745,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+16, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29643, libc.VaList(bp+16, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29679, libc.VaList(bp+16, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14965 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29648, libc.VaList(bp+16, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29669, libc.VaList(bp+16, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29705, libc.VaList(bp+16, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14990 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -184594,7 +186768,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29706, libc.VaList(bp+16, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29732, libc.VaList(bp+16, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { zSep = __ccgo_ts + 1648 iCol = 0 @@ -184611,19 +186785,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29754, libc.VaList(bp+16, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14965 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29780, libc.VaList(bp+16, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14990 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29761, libc.VaList(bp+16, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29787, libc.VaList(bp+16, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -184675,7 +186851,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184684,7 +186860,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29773, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29799, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FzSpan, zCollate)) zType = __ccgo_ts + 1648 } else { if iCid < 0 { @@ -184698,15 +186874,16 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } else { - zCol = __ccgo_ts + 29344 + zCol = __ccgo_ts + 29370 } } zType = __ccgo_ts + 1136 @@ -184714,24 +186891,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29795, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29821, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29531 + v2 = __ccgo_ts + 29557 } else { v2 = __ccgo_ts + 1648 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29815, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29841, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29836, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29869, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29862, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29895, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14965 - zAnd = __ccgo_ts + 21979 + zCom = __ccgo_ts + 14990 + zAnd = __ccgo_ts + 22013 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184785,22 +186962,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29893, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29919, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29905, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29931, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14965 + zS = __ccgo_ts + 14990 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29914, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29940, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -184826,7 +187004,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1648 @@ -184836,14 +187014,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29943, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29969, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29981, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1648 i1 = 0 @@ -184853,11 +187032,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*4)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22013 } goto _2 _2: + ; i1++ } } @@ -184876,7 +187056,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30018, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30044, 0) } // C documentation @@ -184918,21 +187098,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30044, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30070, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30100, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } } } goto _1 _1: + ; i++ } } @@ -184980,6 +187161,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) goto _1 _1: + ; i++ } } @@ -185010,16 +187192,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { z = uintptr(0) _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30111 + zSep = __ccgo_ts + 30137 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16548) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16582) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) } break } @@ -185030,16 +187212,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(3)) != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30124, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14965 + z = _rbuMPrintf(tls, p, __ccgo_ts+30150, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14990 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30135, libc.VaList(bp+16, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30161, libc.VaList(bp+16, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) } return z @@ -185085,7 +187267,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30139) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30165) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -185093,7 +187275,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { @@ -185102,21 +187284,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30189, libc.VaList(bp+16, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30215, libc.VaList(bp+16, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30211, libc.VaList(bp+16, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14965 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30237, libc.VaList(bp+16, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14990 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30221, libc.VaList(bp+16, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30247, libc.VaList(bp+16, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30236, libc.VaList(bp+16, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30262, libc.VaList(bp+16, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185153,7 +187335,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1648 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -185162,37 +187344,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1648 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*4)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30298 + zPk = __ccgo_ts + 30324 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30311 + v2 = __ccgo_ts + 30337 } else { v2 = __ccgo_ts + 1648 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30321, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14965 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30347, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14990 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30348, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30374, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30355 + v3 = __ccgo_ts + 30381 } else { v3 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30370, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30396, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185219,7 +187402,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+88, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30402, libc.VaList(bp+8, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+88, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30428, libc.VaList(bp+8, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -185241,6 +187424,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -185266,7 +187450,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt zRet = uintptr(0) _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 4)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30459) + *(*int32)(unsafe.Pointer(bp + 4)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30485) } if *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 4)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -185336,6 +187520,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -185350,6 +187535,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -185361,6 +187547,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185375,6 +187562,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185390,6 +187578,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -185432,7 +187621,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30525, libc.VaList(bp+24, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30551, libc.VaList(bp+24, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -185450,18 +187639,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+4, bp+8, bp+12) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 12))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30545, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30571, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 12)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30610, libc.VaList(bp+24, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30636, libc.VaList(bp+24, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30646, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp + 8))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30672, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp + 8))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185476,26 +187665,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30680 + v2 = __ccgo_ts + 30706 } else { - v2 = __ccgo_ts + 30684 + v2 = __ccgo_ts + 30710 } v1 = v2 } else { v1 = __ccgo_ts + 1648 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30690, libc.VaList(bp+24, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30716, libc.VaList(bp+24, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30751, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30777, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30680 + v3 = __ccgo_ts + 30706 } else { - v3 = __ccgo_ts + 30684 + v3 = __ccgo_ts + 30710 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30812, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30838, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185514,8 +187703,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6571) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6567) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6596) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6592) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -185524,39 +187713,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1648 } else { - v4 = __ccgo_ts + 30971 + v4 = __ccgo_ts + 30997 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30980 + v5 = __ccgo_ts + 31006 } else { v5 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30990, libc.VaList(bp+24, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31016, libc.VaList(bp+24, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31026, libc.VaList(bp+24, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31052, libc.VaList(bp+24, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31054 + zRbuRowid = __ccgo_ts + 31080 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31066 + v6 = __ccgo_ts + 31092 } else { v6 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31083, libc.VaList(bp+24, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31159, libc.VaList(bp+24, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31109, libc.VaList(bp+24, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31185, libc.VaList(bp+24, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31458, libc.VaList(bp+24, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31484, libc.VaList(bp+24, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -185567,9 +187756,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31557 + v7 = __ccgo_ts + 31583 } else { - v7 = __ccgo_ts + 31567 + v7 = __ccgo_ts + 31593 } zRbuRowid1 = v7 } @@ -185582,14 +187771,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29614, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29640, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31578 + v8 = __ccgo_ts + 31604 } else { v8 = __ccgo_ts + 1648 } @@ -185599,11 +187788,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1648 } if zOrder != 0 { - v10 = __ccgo_ts + 23173 + v10 = __ccgo_ts + 23207 } else { v10 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+76, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31584, libc.VaList(bp+24, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+76, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31610, libc.VaList(bp+24, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -185660,6 +187849,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } _ = libc.Int32FromInt32(0) @@ -185671,6 +187861,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -185690,9 +187881,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30971 + zPrefix = __ccgo_ts + 30997 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31632, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31658, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+4, p+36, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -185766,7 +187957,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 4)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+31662, libc.VaList(bp+16, p+24))) + *(*int32)(unsafe.Pointer(bp + 4)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+31688, libc.VaList(bp+16, p+24))) for *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -185828,27 +188019,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31692, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31718, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31720, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31746, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.Xmemcpy(tls, p+24, __ccgo_ts+3418, uint32(4)) } else { - libc.Xmemcpy(tls, p+24, __ccgo_ts+6560, uint32(4)) + libc.Xmemcpy(tls, p+24, __ccgo_ts+6585, uint32(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31738, libc.VaList(bp+8, p+24)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31764, libc.VaList(bp+8, p+24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -185881,10 +188072,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31804, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31830, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24562, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24596, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*int8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -185900,14 +188091,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 31836 + v2 = __ccgo_ts + 31862 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1648 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31838, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31864, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -185918,27 +188109,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31870, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31896, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31885, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31911, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31902, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31928, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31946, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31972, 0) } } @@ -186022,7 +188213,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -186055,7 +188246,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31964, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31990, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186190,16 +188381,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -186221,7 +188412,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+31999, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32025, 0) } // C documentation @@ -186238,13 +188429,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32024, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32031, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32050, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32057, libc.VaList(bp+8, zMove)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zWal == uintptr(0) || zOal == uintptr(0) { @@ -186382,7 +188573,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24119, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24153, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -186395,6 +188586,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -186476,6 +188668,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -186519,7 +188712,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+36, __ccgo_ts+32038) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+36, __ccgo_ts+32064) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -186532,7 +188725,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32060, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32086, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -186560,7 +188753,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { } pFd = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32087, libc.VaList(bp+16, p+24, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32113, libc.VaList(bp+16, p+24, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -186597,9 +188790,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32245, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32271, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32260, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32286, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -186623,9 +188816,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32306, uintptr(0), uintptr(0), p+36) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32305) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32331) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186636,10 +188829,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32413) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32439) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, __ccgo_ts+32478) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, __ccgo_ts+32504) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -186650,13 +188843,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32522, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32548, uintptr(0), uintptr(0), p+36) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -186683,8 +188877,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17633) - _rbuCopyPragma(tls, p, __ccgo_ts+16744) + _rbuCopyPragma(tls, p, __ccgo_ts+17667) + _rbuCopyPragma(tls, p, __ccgo_ts+16778) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -186692,7 +188886,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32547, libc.VaList(bp+16, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32573, libc.VaList(bp+16, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -186715,10 +188909,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -186806,7 +189000,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32575, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32601, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -186829,10 +189023,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32024, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32050, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_VFS_POINTER), bp) _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) @@ -186856,7 +189050,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { _ = pVfs _ = libc.Int32FromInt32(0) Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32600, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32626, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -186904,7 +189098,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { } db = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, db, bp, bp+4, Xsqlite3_mprintf(tls, __ccgo_ts+32611, libc.VaList(bp+16, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+4, Xsqlite3_mprintf(tls, __ccgo_ts+32637, libc.VaList(bp+16, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 4)), -int32(1)) } else { @@ -186949,11 +189143,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32683, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32709, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32697) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32723) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -186962,7 +189156,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32754) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32780) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -187044,7 +189238,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32828, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32854, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -187066,17 +189260,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32860 + v3 = __ccgo_ts + 32886 } else { - v3 = __ccgo_ts + 32867 + v3 = __ccgo_ts + 32893 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32874, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32900, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14854, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14879, uintptr(0), uintptr(0), p+36) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+48) @@ -187088,21 +189282,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17347) - _rbuCopyPragma(tls, p, __ccgo_ts+16759) + _rbuCopyPragma(tls, p, __ccgo_ts+17381) + _rbuCopyPragma(tls, p, __ccgo_ts+16793) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32906, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32932, uintptr(0), uintptr(0), p+36) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32922, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32948, uintptr(0), uintptr(0), p+36) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -187180,7 +189374,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32946, zState+uintptr(n-int32(7)), uint32(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32972, zState+uintptr(n-int32(7)), uint32(7)) { return _rbuMisuseError(tls) } } @@ -187227,7 +189421,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(i < nErrmsg-uint32(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30971, uint32(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30997, uint32(8)) == 0 { nDel = int32(8) for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -187237,6 +189431,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -187254,7 +189449,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -187263,7 +189458,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+48) @@ -187273,7 +189468,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32954, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32980, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -187388,7 +189583,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -187402,19 +189597,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14854 + v1 = __ccgo_ts + 14879 } else { - v1 = __ccgo_ts + 32906 + v1 = __ccgo_ts + 32932 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32906, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32932, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -187525,6 +189720,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -187574,6 +189770,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187586,6 +189783,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -187612,6 +189810,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 56 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187625,6 +189824,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 60 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187657,6 +189857,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -187667,6 +189868,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -187693,6 +189895,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -187980,7 +190183,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32981, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33007, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -188006,7 +190209,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33004, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33030, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -188207,7 +190410,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6560) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6585) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -188221,7 +190424,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33015, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33041, 0) != 0 { _ = libc.Int32FromInt32(0) oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -188776,7 +190979,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*4))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12166, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 3*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12191, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 3*4)))) return int32(SQLITE_ERROR) } } else { @@ -188847,16 +191050,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -188924,6 +191128,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*24))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -188959,6 +191164,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 16 + uintptr(i)*40))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -189155,17 +191361,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -189255,6 +191464,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -189270,7 +191480,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33026, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33052, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FzPath = v1 if z == uintptr(0) { @@ -189308,8 +191518,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33028 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33037, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33054 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33063, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -189338,7 +191548,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint32FromInt64(1280)/libc.Uint32FromInt64(40)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } _ = libc.Int32FromInt32(0) if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { @@ -189350,7 +191560,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*40))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33049, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33075, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*40))).FzPath = v4 if z == uintptr(0) { @@ -189370,16 +191580,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33057 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33083 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33066 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33092 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33071 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33097 break } *(*int32)(unsafe.Pointer(pCsr + 1320)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -189404,6 +191614,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*24))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 1336)) += int64(nPayload) @@ -189476,12 +191687,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33081, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*16))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33107, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*16))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33236, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33262, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33250, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33276, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -189503,37 +191714,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -189558,7 +191769,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33265, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33291, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -190229,6 +192440,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -193436,6 +195690,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -193518,7 +195773,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -193543,7 +195798,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -193558,7 +195813,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -193573,6 +195828,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -193613,7 +195869,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -193673,6 +195929,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -193718,7 +195975,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+44, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -193778,6 +196035,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint32(4)*uint32((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint32(2)) @@ -193826,7 +196084,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ _ = libc.Int32FromInt32(0) - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -193836,7 +196094,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -193856,6 +196114,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -193916,7 +196175,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -193924,6 +196183,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -193956,6 +196216,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -194164,6 +196425,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -194285,6 +196547,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+4, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -194304,6 +196567,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+4, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -194314,6 +196578,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint32(4)*uint32(*(*int32)(unsafe.Pointer(bp + 16)))*uint32(2)) @@ -194321,7 +196586,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } _ = libc.Int32FromInt32(0) @@ -194344,6 +196609,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 20))).FaBuf) @@ -194490,6 +196756,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -194523,7 +196790,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint32(12) * uint32(nU32) * uint32(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11557) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11582) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -194532,9 +196799,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.Xmemset(tls, bp+4, 0, uint32(12)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*12 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint32(nU32)*uint32(4)) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33909, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33935, bp) _sessionAppendIdent(tls, bp+4, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33922, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33948, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -194544,17 +196811,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*4)) != 0 { _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+4, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14965 + zSep = __ccgo_ts + 14990 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1648 - _sessionAppendStr(tls, bp+4, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33959, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -194564,16 +196832,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 _sessionAppendStr(tls, bp+4, zSep, bp) if bStat1 != 0 && ii == int32(1) { _ = libc.Int32FromInt32(0) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33941, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33967, bp) } else { _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+4, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194618,6 +196887,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -194656,9 +196926,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 4)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+4, __ccgo_ts+34022, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34048, bp) _sessionAppendIdent(tls, bp+4, zTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33959, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -194668,18 +196938,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+4, i+int32(1), bp) - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+4, __ccgo_ts+34040, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34066, bp) _sessionAppendInteger(tls, bp+4, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33504, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33530, bp) zSep = __ccgo_ts + 1648 i = 0 for { @@ -194689,15 +196960,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+4, i+int32(1), bp) - zSep = __ccgo_ts + 34048 + zSep = __ccgo_ts + 34074 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+5106, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FnBuf, p+4, uintptr(0)) @@ -194723,7 +196995,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6560, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+12) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6585, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+12) } // C documentation @@ -194746,34 +197018,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 4)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+4, __ccgo_ts+34053, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34079, bp) _sessionAppendIdent(tls, bp+4, zTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+21985, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+22019, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+4, __ccgo_ts+14965, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+14990, bp) } _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+34071, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34097, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+4, __ccgo_ts+34082, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34108, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+5106, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FnBuf, p+8, uintptr(0)) } @@ -194796,12 +197070,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11557, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11582, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34086) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34112) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+4, __ccgo_ts+34199) + rc = _sessionPrepare(tls, db, p+4, __ccgo_ts+34225) } return rc } @@ -194868,13 +197142,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -194934,6 +197209,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -195001,6 +197277,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+60, *(*uintptr)(unsafe.Pointer(bp + 4)), bp) goto _2 _2: + ; i++ } } @@ -195208,6 +197485,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -195292,7 +197570,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34343, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34369, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -195305,7 +197583,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34364, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34390, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -195401,10 +197679,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34383, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34435, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+92, bp+84, bp+88, uintptr(0)) @@ -195445,7 +197723,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+96, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6560, *(*uintptr)(unsafe.Pointer(bp + 92)), bp+4+16, bp, bp+4+20, uintptr(0), bp+4+24, bp+4+76) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6585, *(*uintptr)(unsafe.Pointer(bp + 92)), bp+4+16, bp, bp+4+20, uintptr(0), bp+4+24, bp+4+76) if rc != SQLITE_OK { break } @@ -195459,22 +197737,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34439, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34465, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol < *(*int32)(unsafe.Pointer(bp + 84)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34483, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol, *(*int32)(unsafe.Pointer(bp + 84)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34509, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol, *(*int32)(unsafe.Pointer(bp + 84)))) } else { if *(*int32)(unsafe.Pointer(bp + 84)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 96)), uint32(*(*int32)(unsafe.Pointer(bp + 84)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34554, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34580, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol = *(*int32)(unsafe.Pointer(bp + 84)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11557) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11582) { v2 = _sessionStat1Sql(tls, db, bp+4) rc = v2 if v2 != 0 { @@ -195531,13 +197810,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34614, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34640, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34668, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34694, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } } _ = libc.Int32FromInt32(0) @@ -195696,6 +197975,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(pOut) - int32((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord) @@ -195742,6 +198022,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(pOut1) - int32((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord) @@ -195873,6 +198154,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -195938,6 +198220,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -195954,6 +198237,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -195965,6 +198249,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -195977,6 +198262,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -196039,6 +198325,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -196073,6 +198360,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -196118,6 +198406,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28)), *(*int32)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), bp+36) @@ -196199,14 +198488,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -196437,6 +198729,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(pOut) - int32((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf) @@ -196509,6 +198802,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -196532,6 +198826,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(pOut) - int32((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf) @@ -196589,6 +198884,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -196619,6 +198915,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -197966,23 +200263,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -198128,7 +200425,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34696, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34722, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -198311,116 +200608,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*12 + 4)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*12 + 4 + 4)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 4)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*int32)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*int32)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 4)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*12 + 4)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; _ = libc.Int32FromInt32(0) fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) @@ -198454,7 +200781,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -198762,7 +201089,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34755, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34781, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -198860,7 +201187,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+68 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34762 + zErr = __ccgo_ts + 34788 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -198988,6 +201315,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -199040,6 +201368,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -199104,7 +201433,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 76)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34812 + zErr = __ccgo_ts + 34838 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199185,6 +201514,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 80))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 116)) { @@ -199206,11 +201536,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 68)) == SQLITE_OK { @@ -199373,6 +201705,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -199437,6 +201770,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -199455,6 +201789,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -199479,15 +201814,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34860, + FzFunc: __ccgo_ts + 34886, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34868, + FzFunc: __ccgo_ts + 34894, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34878, + FzFunc: __ccgo_ts + 34904, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -199500,6 +201835,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -200014,6 +202350,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34890, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34916, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34921, libc.VaList(bp+48, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34947, libc.VaList(bp+48, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200393,7 +202733,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34954, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34980, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200404,7 +202744,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC _ = libc.Int32FromInt32(0) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34991, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35017, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint32(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(4)*nArg) @@ -200412,7 +202752,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35000, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35026, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -200435,10 +202775,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35033, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35059, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -200449,58 +202790,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35067, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35093, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35075, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35101, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35107, libc.VaList(bp+48, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35133, libc.VaList(bp+48, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35113, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35139, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35132, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35158, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35175, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35201, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35189, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35215, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35227, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35253, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35238, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35264, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5474, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5499, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 4)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8193, + FzName: __ccgo_ts + 8218, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17713, + FzName: __ccgo_ts + 17747, }, 2: { - FzName: __ccgo_ts + 35273, + FzName: __ccgo_ts + 35299, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -200508,20 +202849,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+4, zArg, pConfig+56) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35281, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35307, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35312, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35338, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35322, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35348, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35356, libc.VaList(bp+48, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35382, libc.VaList(bp+48, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -200595,15 +202936,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35384) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16660) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35389, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35410) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16694) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35415, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35419) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35445) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35429, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35455, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -200629,7 +202970,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 4)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35460, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35486, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -200637,12 +202978,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35465, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35491, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35472, libc.VaList(bp+24, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35498, libc.VaList(bp+24, i)) } goto _1 _1: + ; i++ } } @@ -200699,8 +203041,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*4)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35384) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35480, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35410) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35506, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } _ = libc.Int32FromInt32(0) @@ -200733,7 +203075,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35509, libc.VaList(bp+32, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35535, libc.VaList(bp+32, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -200758,11 +203100,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35529, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35555, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -200770,7 +203113,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35579, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35605, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -200784,18 +203127,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in zTail = uintptr(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35067 + zTail = __ccgo_ts + 35093 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35634 + zTail = __ccgo_ts + 35660 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35642, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35668, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16660, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16694, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200830,6 +203173,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -200858,7 +203202,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35653, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35679, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -200867,15 +203211,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 14965 + v2 = __ccgo_ts + 14990 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35669, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35695, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35676, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35384)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35702, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35410)) _ = libc.Int32FromInt32(0) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -201023,7 +203368,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35702) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35728) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -201034,7 +203379,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35707) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35733) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -201045,7 +203390,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35716) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35742) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -201059,7 +203404,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35726) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35752) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -201070,7 +203415,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35736) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35762) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -201087,7 +203432,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35748) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35774) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -201102,7 +203447,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35384) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35410) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+4) if rc == SQLITE_OK { @@ -201117,7 +203462,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35760) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35786) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -201159,7 +203504,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+4 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35774 + zSelect = __ccgo_ts + 35800 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK iVersion = 0 @@ -201180,7 +203525,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35806) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35832) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 8)) = 0 @@ -201193,7 +203538,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in *(*int32)(unsafe.Pointer(bp + 4)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { _ = libc.Int32FromInt32(0) - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35814, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35840, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -201415,17 +203760,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35885, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35911, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(z2) - int32(z) default: if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35905, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35931, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -201436,16 +203782,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(z21) - int32(z) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35936, uint32(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35962, uint32(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35939, uint32(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35965, uint32(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30680, uint32(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30706, uint32(3)) == 0 { tok = int32(FTS5_AND) } break @@ -201550,6 +203897,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -201610,6 +203958,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -201667,6 +204016,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 36 + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -201714,6 +204064,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*4)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -201760,6 +204111,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -201818,6 +204170,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -201846,6 +204199,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -201999,6 +204358,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -202123,6 +204483,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*40))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -202151,6 +204512,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -202167,6 +204529,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -202182,6 +204545,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*40) != 0 { @@ -202189,6 +204553,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 160)) if a != bp { @@ -202253,6 +204618,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -202290,6 +204656,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -202315,6 +204682,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -202389,6 +204757,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -202397,11 +204766,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -202449,6 +204820,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 36 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -202468,6 +204840,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -202479,6 +204852,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 36 + uintptr(i1)*4))) goto _2 _2: + ; i1++ } } @@ -202582,10 +204956,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -202643,6 +205019,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -202729,6 +205106,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -202760,6 +205138,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -202817,6 +205196,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -202946,6 +205326,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 36)))).FiRowid @@ -203079,10 +205460,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -203305,6 +205688,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 12 + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -203460,6 +205844,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -203468,6 +205853,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -203511,8 +205897,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35943, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35969, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -203532,12 +205918,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35948, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35974, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -203588,6 +205975,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -203598,6 +205986,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -203636,6 +206025,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -203664,10 +206054,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -203776,6 +206167,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 36 + uintptr(i)*4)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -203793,7 +206185,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35977, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36003, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -203851,6 +206243,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -203908,6 +206301,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -203981,17 +206375,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 12)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 20))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36030 + v2 = __ccgo_ts + 36056 } else { - v2 = __ccgo_ts + 35943 + v2 = __ccgo_ts + 35969 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36037, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36063, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204000,7 +206395,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36087, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36113, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204168,6 +206563,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -204208,6 +206604,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -204230,6 +206627,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -204282,10 +206680,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -204315,6 +206715,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -204334,6 +206735,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 36 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -204361,6 +206763,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -204375,6 +206778,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -204498,10 +206902,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -204674,10 +207080,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint32((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint32(4)) @@ -204697,6 +207105,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*12))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -206551,6 +208974,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -206660,7 +209084,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+84, Xsqlite3_mprintf(tls, __ccgo_ts+36291, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+84, Xsqlite3_mprintf(tls, __ccgo_ts+36317, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -206748,7 +209172,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { _ = libc.Int32FromInt32(0) - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36286, uint32(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36312, uint32(4)) *(*int32)(unsafe.Pointer(bp + 4)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 4)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -206785,10 +209209,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -206840,10 +209266,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -206889,6 +209317,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -206906,6 +209335,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -206956,6 +209386,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -207025,6 +209456,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*28) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -207056,6 +209488,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -207145,6 +209578,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*28))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -207181,6 +209615,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -207716,6 +210151,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -207921,6 +210357,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -208053,6 +210490,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -208089,6 +210527,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -208119,6 +210558,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -211919,6 +214393,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*12))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -212026,6 +214501,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -212100,6 +214576,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+20) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212144,6 +214621,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -212156,11 +214634,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*12) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -212169,6 +214649,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+16) } _ = libc.Int32FromInt32(0) @@ -212188,10 +214669,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*12) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212308,11 +214791,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36598, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36624, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25715, __ccgo_ts+36606, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25741, __ccgo_ts+36632, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11768, __ccgo_ts+36641, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11793, __ccgo_ts+36667, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -212391,6 +214874,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -212454,6 +214938,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -212576,6 +215061,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 28 + uintptr(ii)*4))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -212660,6 +215146,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -212699,6 +215186,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -212740,6 +215228,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -212773,9 +215262,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -212783,16 +215273,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 28 + uintptr(ii)*4)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -212841,7 +215334,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+40, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+40, bp, uint32(1), __ccgo_ts+36685) + _sqlite3Fts5BufferAppendBlob(tls, p+40, bp, uint32(1), __ccgo_ts+36711) } else { _sqlite3Fts5BufferSet(tls, p+40, bp, nToken, pToken) } @@ -212900,10 +215393,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -212929,6 +215424,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -212956,11 +215452,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 72 + uintptr(iSeg1)*96))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -213037,6 +215535,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -213261,6 +215760,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -213313,6 +215813,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -213363,7 +215864,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) _ = libc.Int32FromInt32(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36140, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+4) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36166, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+4) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -213503,6 +216004,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*4)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -213556,6 +216058,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -213567,6 +216070,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -213667,6 +216171,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -213757,6 +216262,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(ii)*4)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(ii)*4)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -213800,10 +216306,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -213840,6 +216348,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 24)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -214191,6 +216705,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 12)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 12))) @@ -214779,7 +217294,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -214819,7 +217334,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) _ = libc.Int32FromInt32(0) } @@ -214841,7 +217356,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -214862,6 +217377,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -214901,6 +217417,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -214979,6 +217496,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -215076,6 +217594,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -215109,6 +217628,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 4 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -215150,6 +217670,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 20 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 20 + uintptr(i)*4)) = t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int32(a) @@ -215180,6 +217701,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -215338,7 +217860,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14965 + v1 = __ccgo_ts + 14990 } else { v1 = __ccgo_ts + 1648 } @@ -215348,11 +217870,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1648 } if bDesc != 0 { - v3 = __ccgo_ts + 36817 + v3 = __ccgo_ts + 36843 } else { - v3 = __ccgo_ts + 36822 + v3 = __ccgo_ts + 36848 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36826, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36852, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) @@ -215407,18 +217929,19 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } _ = libc.Int32FromInt32(0) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36881, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36907, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5456, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5481, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36887, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36913, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -215445,6 +217968,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -215467,7 +217991,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36915, libc.VaList(bp+16, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36941, libc.VaList(bp+16, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+4, uintptr(0)) @@ -215487,6 +218011,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*4)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), i) goto _1 _1: + ; i++ } } @@ -215502,7 +218027,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { _ = libc.Int32FromInt32(0) - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36925, libc.VaList(bp+16, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36951, libc.VaList(bp+16, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -215536,7 +218061,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 56)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36946, libc.VaList(bp+16, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36972, libc.VaList(bp+16, z)) } } } else { @@ -215544,7 +218069,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34878 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34904 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -215595,7 +218120,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -215680,6 +218205,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -215752,7 +218278,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36979, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37005, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -215778,6 +218304,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -215939,36 +218466,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37015, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37041, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37026, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37052, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37106, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37132, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37114, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37140, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17327, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17361, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37170, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37196, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37176, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37202, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37192, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37218, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -216071,9 +218598,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*4))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*4))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17847, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17881, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37198, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37224, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -216104,11 +218631,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } else { - v1 = __ccgo_ts + 37257 + v1 = __ccgo_ts + 37283 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37269, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37295, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -216159,7 +218686,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -216328,6 +218855,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -216398,6 +218926,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -216413,6 +218942,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -216540,6 +219070,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -216558,6 +219089,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -216574,6 +219106,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -216611,6 +219144,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216650,6 +219184,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216907,6 +219442,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -216934,6 +219470,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -216950,7 +219487,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37332, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -217017,9 +219554,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -217027,10 +219566,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+4, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -217041,10 +219582,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+4, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 20))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -217055,6 +219598,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+4, int64(*(*int32)(unsafe.Pointer(bp + 28)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -217067,12 +219611,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+4, uint32(*(*int32)(unsafe.Pointer(bp + 36))), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 4))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 4))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -217132,7 +219679,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37327, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37353, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -217330,6 +219877,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -217374,7 +219922,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr if pMod == uintptr(0) { _ = libc.Int32FromInt32(0) rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37424, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*4 @@ -217390,7 +219938,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 8 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37420, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37446, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -217419,6 +219967,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -217433,6 +219982,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -217444,7 +219994,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg _ = libc.Int32FromInt32(0) - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37451) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37477) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -217459,7 +220009,7 @@ func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr _ = libc.Int32FromInt32(0) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37464, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37490, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -217481,17 +220031,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37555, - 1: __ccgo_ts + 35067, - 2: __ccgo_ts + 25715, - 3: __ccgo_ts + 35634, - 4: __ccgo_ts + 11768, + 0: __ccgo_ts + 37581, + 1: __ccgo_ts + 35093, + 2: __ccgo_ts + 25741, + 3: __ccgo_ts + 35660, + 4: __ccgo_ts + 11793, } // C documentation @@ -217512,10 +220063,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37562, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37588, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37608, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37634, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -217538,7 +220089,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37671, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37697, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -217555,10 +220106,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37671, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37697, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37676, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37702, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -217663,17 +220214,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 24 + uintptr(eStmt)*4)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37691, - 1: __ccgo_ts + 37759, - 2: __ccgo_ts + 37828, - 3: __ccgo_ts + 37861, - 4: __ccgo_ts + 37900, - 5: __ccgo_ts + 37940, - 6: __ccgo_ts + 37979, - 7: __ccgo_ts + 38022, - 8: __ccgo_ts + 38061, - 9: __ccgo_ts + 38105, - 10: __ccgo_ts + 38145, + 0: __ccgo_ts + 37717, + 1: __ccgo_ts + 37785, + 2: __ccgo_ts + 37854, + 3: __ccgo_ts + 37887, + 4: __ccgo_ts + 37926, + 5: __ccgo_ts + 37966, + 6: __ccgo_ts + 38005, + 7: __ccgo_ts + 38048, + 8: __ccgo_ts + 38087, + 9: __ccgo_ts + 38131, + 10: __ccgo_ts + 38171, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -217701,6 +220252,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = int8(',') goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = int8('\000') @@ -217709,14 +220261,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38168 + v2 = __ccgo_ts + 38194 } else { v2 = __ccgo_ts + 1648 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38171 + v3 = __ccgo_ts + 38197 } else { v3 = __ccgo_ts + 1648 } @@ -217774,12 +220326,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38179, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38205, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38283, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38309, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38321, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38347, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -217788,7 +220340,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38359, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38385, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -217800,14 +220352,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25715, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11768, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37555, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25741, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11793, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37581, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35634, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35660, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35067, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35093, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -217827,13 +220379,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30355 + v1 = __ccgo_ts + 30381 } else { v1 = __ccgo_ts + 1648 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38401, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38427, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38431, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38457, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -217874,35 +220426,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38475, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38501, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38498, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38524, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35067, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35093, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38504 + zCols = __ccgo_ts + 38530 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38536 + zCols = __ccgo_ts + 38562 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35634, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35660, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37555, __ccgo_ts+38584, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37581, __ccgo_ts+38610, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -217931,6 +220484,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 24 + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -218033,6 +220587,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -218173,6 +220728,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+12, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 12)) == SQLITE_OK { @@ -218246,9 +220802,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38601, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38627, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38651, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38677, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -218256,7 +220812,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -218303,6 +220859,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218400,6 +220957,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -218448,6 +221006,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218467,7 +221026,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38680, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38706, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -218566,6 +221125,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -218642,6 +221202,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -218668,6 +221229,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -218675,14 +221237,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 40)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35067, bp+40) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35093, bp+40) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 40)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -219584,15 +222162,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(zCsr) - int32(pText) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(zOut)-int32(aFold), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -219654,7 +222237,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38772 + zBase = __ccgo_ts + 38798 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -219745,6 +222328,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -219760,6 +222344,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -219819,6 +222404,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38782, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38808, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38785, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38790, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38816, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38795, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38798, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38824, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38801, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38827, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38806, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38832, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38815, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38847, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38852, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219933,49 +222520,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38830, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38856, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38860, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38863, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38867, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38845, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38875, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38853, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38879, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38857, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38883, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219992,20 +222579,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38861, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38841, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38887, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38864, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38890, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38857, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38897, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -220021,75 +222608,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38874, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38900, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38882, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38908, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38889, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38915, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38894, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38920, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38790, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38816, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38925, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38785, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38811, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38904, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38930, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38857, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38909, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15873, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15907, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38914, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38940, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38867, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38918, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38944, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38923, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38852, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38929, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38933, uint32(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38959, uint32(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38961, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38849, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38875, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -220098,48 +222685,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38941, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38967, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38857, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38975, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38981, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38960, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38966, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38992, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38853, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38879, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38974, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38982, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39008, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39012, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38849, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38875, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -220147,21 +222734,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39020, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39026, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38853, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38879, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39006, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39032, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38867, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -220179,48 +222766,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39013, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39039, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39018, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39044, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39023, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39049, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39029, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39055, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38982, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39008, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39035, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39061, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39067, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -220236,13 +222823,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39047, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39073, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39051, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39077, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39054, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39080, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -220250,7 +222837,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39083, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -220337,6 +222924,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -220410,14 +222998,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+39061) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+39087) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+38754) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+38780) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('2') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -220434,6 +223022,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -220538,6 +223127,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -220690,7 +223280,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38772, + FzName: __ccgo_ts + 38798, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -220698,7 +223288,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39076, + FzName: __ccgo_ts + 39102, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -220706,7 +223296,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39082, + FzName: __ccgo_ts + 39108, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -220714,7 +223304,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39089, + FzName: __ccgo_ts + 39115, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -220734,6 +223324,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*16+4, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -225784,6 +228375,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -226073,6 +228665,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -226096,6 +228689,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -226255,16 +228849,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39097) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39123) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39101) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39127) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39105) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39131) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39114, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39140, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -226333,15 +228927,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39148, - 1: __ccgo_ts + 39188, - 2: __ccgo_ts + 39223, + 0: __ccgo_ts + 39174, + 1: __ccgo_ts + 39214, + 2: __ccgo_ts + 39249, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+23708, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+23742, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39266, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39292, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -226454,6 +229048,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -226511,10 +229106,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39299, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39325, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39330, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39356, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+4, uintptr(0)) } @@ -226534,7 +229129,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39381, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39407, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -226682,6 +229277,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -226782,6 +229378,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -226969,7 +229566,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39407, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39433, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -227022,7 +229619,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39417 + return __ccgo_ts + 39443 } type TAggInfo_col = struct { @@ -227302,11 +229899,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]int8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go index 5aab1974..915119ad 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated for linux/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for linux/amd64 by 'generator -mlong-double-64 --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build linux && amd64 // +build linux,amd64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -17,22 +19,7 @@ var ( _ unsafe.Pointer ) -const ACCESSPERMS = 511 -const ADJ_ESTERROR = 8 -const ADJ_FREQUENCY = 2 -const ADJ_MAXERROR = 4 -const ADJ_MICRO = 4096 -const ADJ_NANO = 8192 -const ADJ_OFFSET = 1 -const ADJ_OFFSET_SINGLESHOT = 32769 -const ADJ_OFFSET_SS_READ = 40961 -const ADJ_SETOFFSET = 256 -const ADJ_STATUS = 16 -const ADJ_TAI = 128 -const ADJ_TICK = 16384 -const ADJ_TIMECONST = 32 const ALLBITS = -1 -const ALLPERMS = 4095 const AT_EACCESS = 512 const AT_EMPTY_PATH = 4096 const AT_FDCWD = -100 @@ -104,10 +91,9 @@ const BTS_PAGESIZE_FIXED = 2 const BTS_PENDING = 128 const BTS_READ_ONLY = 1 const BTS_SECURE_DELETE = 4 -const BUFSIZ = 8192 +const BUFSIZ = 1024 const BYTE_ORDER = 1234 const CACHE_STALE = 0 -const CBRK = 0 const CC_AND = 24 const CC_BANG = 15 const CC_BOM = 30 @@ -139,18 +125,9 @@ const CC_TILDA = 25 const CC_VARALPHA = 5 const CC_VARNUM = 6 const CC_X = 0 -const CDISCARD = 15 -const CDSUSP = 25 -const CEOF = 4 -const CEOL = 0 -const CEOT = 4 -const CERASE = 127 -const CFLUSH = 15 -const CINTR = 3 const CKCNSTRNT_COLUMN = 1 const CKCNSTRNT_ROWID = 2 -const CKILL = 21 -const CLNEXT = 22 +const CLOCKS_PER_SEC = 1000000 const CLOCK_BOOTTIME = 7 const CLOCK_BOOTTIME_ALARM = 9 const CLOCK_MONOTONIC = 1 @@ -160,11 +137,34 @@ const CLOCK_PROCESS_CPUTIME_ID = 2 const CLOCK_REALTIME = 0 const CLOCK_REALTIME_ALARM = 8 const CLOCK_REALTIME_COARSE = 5 +const CLOCK_SGI_CYCLE = 10 const CLOCK_TAI = 11 const CLOCK_THREAD_CPUTIME_ID = 3 -const CLOSE_RANGE_CLOEXEC = 4 -const CLOSE_RANGE_UNSHARE = 2 -const CMIN = 1 +const CLONE_CHILD_CLEARTID = 2097152 +const CLONE_CHILD_SETTID = 16777216 +const CLONE_DETACHED = 4194304 +const CLONE_FILES = 1024 +const CLONE_FS = 512 +const CLONE_IO = 2147483648 +const CLONE_NEWCGROUP = 33554432 +const CLONE_NEWIPC = 134217728 +const CLONE_NEWNET = 1073741824 +const CLONE_NEWNS = 131072 +const CLONE_NEWPID = 536870912 +const CLONE_NEWTIME = 128 +const CLONE_NEWUSER = 268435456 +const CLONE_NEWUTS = 67108864 +const CLONE_PARENT = 32768 +const CLONE_PARENT_SETTID = 1048576 +const CLONE_PIDFD = 4096 +const CLONE_PTRACE = 8192 +const CLONE_SETTLS = 524288 +const CLONE_SIGHAND = 2048 +const CLONE_SYSVSEM = 262144 +const CLONE_THREAD = 65536 +const CLONE_UNTRACED = 8388608 +const CLONE_VFORK = 16384 +const CLONE_VM = 256 const COLFLAG_BUSY = 256 const COLFLAG_GENERATED = 96 const COLFLAG_HASCOLL = 512 @@ -191,14 +191,8 @@ const COLTYPE_INT = 3 const COLTYPE_INTEGER = 4 const COLTYPE_REAL = 5 const COLTYPE_TEXT = 6 -const CQUIT = 28 -const CREPRINT = 18 -const CRPRNT = 18 -const CSTART = 17 -const CSTATUS = 0 -const CSTOP = 19 -const CSUSP = 26 -const CTIME = 0 +const CPU_SETSIZE = 1024 +const CSIGNAL = 255 const CURSOR_FAULT = 4 const CURSOR_INVALID = 1 const CURSOR_REQUIRESEEK = 3 @@ -208,7 +202,6 @@ const CURTYPE_BTREE = 0 const CURTYPE_PSEUDO = 3 const CURTYPE_SORTER = 1 const CURTYPE_VTAB = 2 -const CWERASE = 23 const DBFLAG_EncodingFixed = 64 const DBFLAG_InternalFunc = 32 const DBFLAG_PreferBuiltin = 2 @@ -220,11 +213,7 @@ const DBSTAT_PAGE_PADDING_BYTES = 256 const DB_ResetWanted = 8 const DB_SchemaLoaded = 1 const DB_UnresetViews = 2 -const DEFFILEMODE = 438 const DIRECT_MODE = 0 -const DLFO_EH_SEGMENT_TYPE = 0 -const DLFO_STRUCT_HAS_EH_COUNT = 0 -const DLFO_STRUCT_HAS_EH_DBASE = 0 const DN_ACCESS = 1 const DN_ATTRIB = 32 const DN_CREATE = 4 @@ -338,7 +327,6 @@ const ENOTSUP = 95 const ENOTTY = 25 const ENOTUNIQ = 76 const ENXIO = 6 -const EOF = -1 const EOPNOTSUPP = 95 const EOVERFLOW = 75 const EOWNERDEAD = 130 @@ -422,13 +410,8 @@ const F2FS_IOC_COMMIT_ATOMIC_WRITE = 62722 const F2FS_IOC_GET_FEATURES = 2147546380 const F2FS_IOC_START_ATOMIC_WRITE = 62721 const F2FS_IOC_START_VOLATILE_WRITE = 62723 -const FALLOC_FL_COLLAPSE_RANGE = 8 -const FALLOC_FL_INSERT_RANGE = 32 const FALLOC_FL_KEEP_SIZE = 1 -const FALLOC_FL_NO_HIDE_STALE = 4 const FALLOC_FL_PUNCH_HOLE = 2 -const FALLOC_FL_UNSHARE_RANGE = 64 -const FALLOC_FL_ZERO_RANGE = 16 const FAPPEND = 1024 const FASYNC = 8192 const FD_CLOEXEC = 1 @@ -437,25 +420,20 @@ const FFSYNC = 1052672 const FILENAME_MAX = 4096 const FIOASYNC = 21586 const FIOCLEX = 21585 +const FIOGETOWN = 35075 const FIONBIO = 21537 const FIONCLEX = 21584 const FIONREAD = 21531 const FIOQSIZE = 21600 +const FIOSETOWN = 35073 const FLAG_SIGNED = 1 const FLAG_STRING = 4 const FNDELAY = 2048 const FNONBLOCK = 2048 -const FOPEN_MAX = 16 +const FOPEN_MAX = 1000 const FP_ILOGB0 = -2147483648 const FP_ILOGBNAN = -2147483648 const FP_INFINITE = 1 -const FP_INT_DOWNWARD = 1 -const FP_INT_TONEAREST = 4 -const FP_INT_TONEARESTFROMZERO = 3 -const FP_INT_TOWARDZERO = 2 -const FP_INT_UPWARD = 0 -const FP_LLOGB0 = -9223372036854775808 -const FP_LLOGBNAN = -9223372036854775808 const FP_NAN = 0 const FP_NORMAL = 4 const FP_SUBNORMAL = 3 @@ -583,15 +561,15 @@ const FTS5_WORK_UNIT = 64 const FULLY_WITHIN = 2 const FUNC_PERFECT_MATCH = 6 const F_ADD_SEALS = 1033 +const F_CANCELLK = 1029 const F_DUPFD = 0 const F_DUPFD_CLOEXEC = 1030 -const F_EXLCK = 4 const F_GETFD = 1 const F_GETFL = 3 const F_GETLEASE = 1025 const F_GETLK = 5 -const F_GETLK64 = 5 const F_GETOWN = 9 +const F_GETOWNER_UIDS = 17 const F_GETOWN_EX = 16 const F_GETPIPE_SZ = 1032 const F_GETSIG = 11 @@ -604,6 +582,10 @@ const F_OFD_GETLK = 36 const F_OFD_SETLK = 37 const F_OFD_SETLKW = 38 const F_OK = 0 +const F_OWNER_GID = 2 +const F_OWNER_PGRP = 2 +const F_OWNER_PID = 1 +const F_OWNER_TID = 0 const F_RDLCK = 0 const F_SEAL_FUTURE_WRITE = 16 const F_SEAL_GROW = 4 @@ -614,16 +596,13 @@ const F_SETFD = 2 const F_SETFL = 4 const F_SETLEASE = 1024 const F_SETLK = 6 -const F_SETLK64 = 6 const F_SETLKW = 7 -const F_SETLKW64 = 7 const F_SETOWN = 8 const F_SETOWN_EX = 15 const F_SETPIPE_SZ = 1031 const F_SETSIG = 10 const F_SET_FILE_RW_HINT = 1038 const F_SET_RW_HINT = 1036 -const F_SHLCK = 8 const F_TEST = 3 const F_TLOCK = 2 const F_ULOCK = 0 @@ -645,14 +624,8 @@ const HAVE_PREAD = 1 const HAVE_PWRITE = 1 const HAVE_READLINK = 1 const HAVE_USLEEP = 1 -const HUGE_VAL = 0 +const HUGE = 0 const HUGE_VALF = 0 -const HUGE_VALL = 0 -const HUGE_VAL_F128 = 0 -const HUGE_VAL_F32 = 0 -const HUGE_VAL_F32X = 0 -const HUGE_VAL_F64 = 0 -const HUGE_VAL_F64X = 0 const INCRINIT_NORMAL = 0 const INCRINIT_ROOT = 2 const INCRINIT_TASK = 1 @@ -678,11 +651,9 @@ const IN_INDEX_MEMBERSHIP = 2 const IN_INDEX_NOOP = 5 const IN_INDEX_NOOP_OK = 1 const IN_INDEX_ROWID = 1 -const IOCSIZE_MASK = 1073676288 -const IOCSIZE_SHIFT = 16 -const IOC_IN = 1073741824 -const IOC_INOUT = 3221225472 -const IOC_OUT = 2147483648 +const ITIMER_PROF = 2 +const ITIMER_REAL = 0 +const ITIMER_VIRTUAL = 1 const IsStat4 = 1 const JEACH_ATOM = 3 const JEACH_FULLKEY = 6 @@ -746,25 +717,15 @@ const KEYINFO_ORDER_DESC = 1 const LEGACY_SCHEMA_TABLE = "sqlite_master" const LEGACY_TEMP_SCHEMA_TABLE = "sqlite_temp_master" const LITTLE_ENDIAN = 1234 -const LM_ID_BASE = 0 -const LM_ID_NEWLM = -1 const LOCATE_NOERR = 2 const LOCATE_VIEW = 1 -const LOCK_EX = 2 -const LOCK_MAND = 32 -const LOCK_NB = 4 -const LOCK_READ = 64 -const LOCK_RW = 192 -const LOCK_SH = 1 -const LOCK_UN = 8 -const LOCK_WRITE = 128 const LONGDOUBLE_TYPE = 0 const LOOKASIDE_SMALL = 128 const L_INCR = 1 const L_SET = 0 const L_XTND = 2 -const L_ctermid = 9 -const L_cuserid = 9 +const L_ctermid = 20 +const L_cuserid = 20 const L_tmpnam = 20 const M10d_Any = 1 const M10d_No = 2 @@ -775,7 +736,6 @@ const MADV_DOFORK = 11 const MADV_DONTDUMP = 16 const MADV_DONTFORK = 10 const MADV_DONTNEED = 4 -const MADV_DONTNEED_LOCKED = 24 const MADV_FREE = 8 const MADV_HUGEPAGE = 14 const MADV_HWPOISON = 100 @@ -784,11 +744,10 @@ const MADV_MERGEABLE = 12 const MADV_NOHUGEPAGE = 15 const MADV_NORMAL = 0 const MADV_PAGEOUT = 21 -const MADV_POPULATE_READ = 22 -const MADV_POPULATE_WRITE = 23 const MADV_RANDOM = 1 const MADV_REMOVE = 9 const MADV_SEQUENTIAL = 2 +const MADV_SOFT_OFFLINE = 101 const MADV_UNMERGEABLE = 13 const MADV_WILLNEED = 3 const MADV_WIPEONFORK = 18 @@ -803,6 +762,19 @@ const MAP_FIXED = 16 const MAP_FIXED_NOREPLACE = 1048576 const MAP_GROWSDOWN = 256 const MAP_HUGETLB = 262144 +const MAP_HUGE_16GB = 2281701376 +const MAP_HUGE_16KB = 939524096 +const MAP_HUGE_16MB = 1610612736 +const MAP_HUGE_1GB = 2013265920 +const MAP_HUGE_1MB = 1342177280 +const MAP_HUGE_256MB = 1879048192 +const MAP_HUGE_2GB = 2080374784 +const MAP_HUGE_2MB = 1409286144 +const MAP_HUGE_32MB = 1677721600 +const MAP_HUGE_512KB = 1275068416 +const MAP_HUGE_512MB = 1946157056 +const MAP_HUGE_64KB = 1073741824 +const MAP_HUGE_8MB = 1543503872 const MAP_HUGE_MASK = 63 const MAP_HUGE_SHIFT = 26 const MAP_LOCKED = 8192 @@ -817,7 +789,6 @@ const MAP_SYNC = 524288 const MAP_TYPE = 15 const MATH_ERREXCEPT = 2 const MATH_ERRNO = 1 -const MAXFLOAT = 0 const MAX_HANDLE_SZ = 128 const MAX_PATHNAME = 512 const MAX_SECTOR_SIZE = 65536 @@ -851,17 +822,6 @@ const MFD_ALLOW_SEALING = 2 const MFD_CLOEXEC = 1 const MFD_HUGETLB = 4 const MLOCK_ONFAULT = 1 -const MOD_CLKA = 32769 -const MOD_CLKB = 16384 -const MOD_ESTERROR = 8 -const MOD_FREQUENCY = 2 -const MOD_MAXERROR = 4 -const MOD_MICRO = 4096 -const MOD_NANO = 8192 -const MOD_OFFSET = 1 -const MOD_STATUS = 16 -const MOD_TAI = 128 -const MOD_TIMECONST = 32 const MREMAP_DONTUNMAP = 4 const MREMAP_FIXED = 2 const MREMAP_MAYMOVE = 1 @@ -870,112 +830,20 @@ const MS_ASYNC = 1 const MS_INVALIDATE = 2 const MS_SYNC = 4 const M_1_PI = 0 -const M_1_PIf = 0 -const M_1_PIf128 = 0 -const M_1_PIf32 = 0 -const M_1_PIf32x = 0 -const M_1_PIf64 = 0 -const M_1_PIf64x = 0 -const M_1_PIl = 0 const M_2_PI = 0 -const M_2_PIf = 0 -const M_2_PIf128 = 0 -const M_2_PIf32 = 0 -const M_2_PIf32x = 0 -const M_2_PIf64 = 0 -const M_2_PIf64x = 0 -const M_2_PIl = 0 const M_2_SQRTPI = 0 -const M_2_SQRTPIf = 0 -const M_2_SQRTPIf128 = 0 -const M_2_SQRTPIf32 = 0 -const M_2_SQRTPIf32x = 0 -const M_2_SQRTPIf64 = 0 -const M_2_SQRTPIf64x = 0 -const M_2_SQRTPIl = 0 const M_E = 0 -const M_Ef = 0 -const M_Ef128 = 0 -const M_Ef32 = 0 -const M_Ef32x = 0 -const M_Ef64 = 0 -const M_Ef64x = 0 -const M_El = 0 const M_LN10 = 0 -const M_LN10f = 0 -const M_LN10f128 = 0 -const M_LN10f32 = 0 -const M_LN10f32x = 0 -const M_LN10f64 = 0 -const M_LN10f64x = 0 -const M_LN10l = 0 const M_LN2 = 0 -const M_LN2f = 0 -const M_LN2f128 = 0 -const M_LN2f32 = 0 -const M_LN2f32x = 0 -const M_LN2f64 = 0 -const M_LN2f64x = 0 -const M_LN2l = 0 const M_LOG10E = 0 -const M_LOG10Ef = 0 -const M_LOG10Ef128 = 0 -const M_LOG10Ef32 = 0 -const M_LOG10Ef32x = 0 -const M_LOG10Ef64 = 0 -const M_LOG10Ef64x = 0 -const M_LOG10El = 0 const M_LOG2E = 0 -const M_LOG2Ef = 0 -const M_LOG2Ef128 = 0 -const M_LOG2Ef32 = 0 -const M_LOG2Ef32x = 0 -const M_LOG2Ef64 = 0 -const M_LOG2Ef64x = 0 -const M_LOG2El = 0 const M_PI = 3.141592653589793 const M_PI_2 = 0 -const M_PI_2f = 0 -const M_PI_2f128 = 0 -const M_PI_2f32 = 0 -const M_PI_2f32x = 0 -const M_PI_2f64 = 0 -const M_PI_2f64x = 0 -const M_PI_2l = 0 const M_PI_4 = 0 -const M_PI_4f = 0 -const M_PI_4f128 = 0 -const M_PI_4f32 = 0 -const M_PI_4f32x = 0 -const M_PI_4f64 = 0 -const M_PI_4f64x = 0 -const M_PI_4l = 0 -const M_PIf = 0 -const M_PIf128 = 0 -const M_PIf32 = 0 -const M_PIf32x = 0 -const M_PIf64 = 0 -const M_PIf64x = 0 -const M_PIl = 0 const M_SQRT1_2 = 0 -const M_SQRT1_2f = 0 -const M_SQRT1_2f128 = 0 -const M_SQRT1_2f32 = 0 -const M_SQRT1_2f32x = 0 -const M_SQRT1_2f64 = 0 -const M_SQRT1_2f64x = 0 -const M_SQRT1_2l = 0 const M_SQRT2 = 0 -const M_SQRT2f = 0 -const M_SQRT2f128 = 0 -const M_SQRT2f32 = 0 -const M_SQRT2f32x = 0 -const M_SQRT2f64 = 0 -const M_SQRT2f64x = 0 -const M_SQRT2l = 0 const NAN = 0 const NB = 3 -const NCC = 8 const NC_AllowAgg = 1 const NC_AllowWin = 16384 const NC_Complex = 8192 @@ -997,29 +865,41 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 -const NFDBITS = "__NFDBITS" const NN = 1 const NOT_WITHIN = 0 const NO_LOCK = 0 const N_6PACK = 7 const N_AX25 = 5 +const N_CAIF = 20 +const N_GIGASET_M101 = 16 +const N_GSM0710 = 21 const N_HCI = 15 const N_HDLC = 13 const N_IRDA = 11 const N_MASC = 8 const N_MOUSE = 2 +const N_NCI = 25 +const N_NULL = 27 const N_OR_COST = 3 const N_PPP = 3 +const N_PPS = 18 const N_PROFIBUS_FDL = 10 const N_R3964 = 9 +const N_SLCAN = 17 const N_SLIP = 1 const N_SMSBLOCK = 12 const N_SORT_BUCKET = 32 +const N_SPEAKUP = 26 const N_STATEMENT = 8 const N_STRIP = 4 const N_SYNC_PPP = 14 +const N_TI_WL = 22 +const N_TRACEROUTER = 24 +const N_TRACESINK = 23 const N_TTY = 0 +const N_V253 = 19 const N_X25 = 6 const OE_Abort = 2 const OE_Cascade = 10 @@ -1255,7 +1135,7 @@ const OP_Variable = 78 const OP_Yield = 12 const OP_ZeroOrNull = 92 const OS_VXWORKS = 0 -const O_ACCMODE = 3 +const O_ACCMODE = 2097155 const O_APPEND = 1024 const O_ASYNC = 8192 const O_BINARY = 0 @@ -1265,8 +1145,8 @@ const O_DIRECT = 16384 const O_DIRECTORY = 65536 const O_DSYNC = 4096 const O_EXCL = 128 -const O_FSYNC = 1052672 -const O_LARGEFILE = 0 +const O_EXEC = 2097152 +const O_LARGEFILE = 32768 const O_NDELAY = 2048 const O_NOATIME = 262144 const O_NOCTTY = 256 @@ -1276,9 +1156,11 @@ const O_PATH = 2097152 const O_RDONLY = 0 const O_RDWR = 2 const O_RSYNC = 1052672 +const O_SEARCH = 2097152 const O_SYNC = 1052672 const O_TMPFILE = 4259840 const O_TRUNC = 512 +const O_TTY_INIT = 0 const O_WRONLY = 1 const P4_COLLSEQ = -2 const P4_DYNAMIC = -6 @@ -1356,8 +1238,7 @@ const PGHDR_MMAP = 32 const PGHDR_NEED_SYNC = 8 const PGHDR_WAL_APPEND = 64 const PGHDR_WRITEABLE = 4 -const PKEY_DISABLE_ACCESS = 1 -const PKEY_DISABLE_WRITE = 2 +const POSIX_CLOSE_RESTART = 0 const POSIX_FADV_DONTNEED = 4 const POSIX_FADV_NOREUSE = 5 const POSIX_FADV_NORMAL = 0 @@ -1381,6 +1262,31 @@ const PTF_INTKEY = 1 const PTF_LEAF = 8 const PTF_LEAFDATA = 4 const PTF_ZERODATA = 2 +const PTHREAD_BARRIER_SERIAL_THREAD = -1 +const PTHREAD_CANCELED = -1 +const PTHREAD_CANCEL_ASYNCHRONOUS = 1 +const PTHREAD_CANCEL_DEFERRED = 0 +const PTHREAD_CANCEL_DISABLE = 1 +const PTHREAD_CANCEL_ENABLE = 0 +const PTHREAD_CANCEL_MASKED = 2 +const PTHREAD_CREATE_DETACHED = 1 +const PTHREAD_CREATE_JOINABLE = 0 +const PTHREAD_EXPLICIT_SCHED = 1 +const PTHREAD_INHERIT_SCHED = 0 +const PTHREAD_MUTEX_DEFAULT = 0 +const PTHREAD_MUTEX_ERRORCHECK = 2 +const PTHREAD_MUTEX_NORMAL = 0 +const PTHREAD_MUTEX_RECURSIVE = 1 +const PTHREAD_MUTEX_ROBUST = 1 +const PTHREAD_MUTEX_STALLED = 0 +const PTHREAD_ONCE_INIT = 0 +const PTHREAD_PRIO_INHERIT = 1 +const PTHREAD_PRIO_NONE = 0 +const PTHREAD_PRIO_PROTECT = 2 +const PTHREAD_PROCESS_PRIVATE = 0 +const PTHREAD_PROCESS_SHARED = 1 +const PTHREAD_SCOPE_PROCESS = 1 +const PTHREAD_SCOPE_SYSTEM = 0 const PTRMAP_BTREE = 5 const PTRMAP_FREEPAGE = 2 const PTRMAP_OVERFLOW1 = 3 @@ -1475,9 +1381,6 @@ const RBU_UPDATE = 6 const RBU_ZIPVFS_CTRL_FILE_POINTER = 230439 const READMARK_NOT_USED = 4294967295 const READ_LOCK = 1 -const RENAME_EXCHANGE = 2 -const RENAME_NOREPLACE = 1 -const RENAME_WHITEOUT = 4 const RESERVED_BYTE = 1 const RESERVED_LOCK = 2 const RNDAWAY = 0 @@ -1486,8 +1389,7 @@ const ROWSET_ALLOCATION_SIZE = 1024 const ROWSET_ENTRY_PER_CHUNK = 1016 const ROWSET_NEXT = 2 const ROWSET_SORTED = 1 -const RTLD_BINDING_MASK = 3 -const RTLD_DEEPBIND = 8 +const RTLD_DI_LINKMAP = 2 const RTLD_GLOBAL = 256 const RTLD_LAZY = 1 const RTLD_LOCAL = 0 @@ -1520,18 +1422,21 @@ const RWH_WRITE_LIFE_EXTREME = 5 const RWH_WRITE_LIFE_LONG = 4 const RWH_WRITE_LIFE_MEDIUM = 3 const RWH_WRITE_LIFE_NONE = 1 -const RWH_WRITE_LIFE_NOT_SET = 0 const RWH_WRITE_LIFE_SHORT = 2 const R_OK = 4 const SAVEPOINT_BEGIN = 0 const SAVEPOINT_RELEASE = 1 const SAVEPOINT_ROLLBACK = 2 +const SCHED_BATCH = 3 +const SCHED_DEADLINE = 6 +const SCHED_FIFO = 1 +const SCHED_IDLE = 5 +const SCHED_OTHER = 0 +const SCHED_RESET_ON_FORK = 1073741824 +const SCHED_RR = 2 const SCHEMA_ROOT = 1 -const SEEK_CUR = 1 const SEEK_DATA = 3 -const SEEK_END = 2 const SEEK_HOLE = 4 -const SEEK_SET = 0 const SESSIONS_ROWID = "_rowid_" const SESSIONS_STRM_CHUNK_SIZE = 1024 const SESSION_MAX_BUFFER_SZ = 2147483391 @@ -1571,6 +1476,7 @@ const SHARED_SIZE = 510 const SIOCADDDLCI = 35200 const SIOCADDMULTI = 35121 const SIOCADDRT = 35083 +const SIOCATMARK = 35077 const SIOCDARP = 35155 const SIOCDELDLCI = 35201 const SIOCDELMULTI = 35122 @@ -1598,7 +1504,10 @@ const SIOCGIFNETMASK = 35099 const SIOCGIFPFLAGS = 35125 const SIOCGIFSLAVE = 35113 const SIOCGIFTXQLEN = 35138 +const SIOCGPGRP = 35076 const SIOCGRARP = 35169 +const SIOCGSTAMP = 35078 +const SIOCGSTAMPNS = 35079 const SIOCPROTOPRIVATE = 35296 const SIOCRTMSG = 35085 const SIOCSARP = 35157 @@ -1620,18 +1529,11 @@ const SIOCSIFNETMASK = 35100 const SIOCSIFPFLAGS = 35124 const SIOCSIFSLAVE = 35120 const SIOCSIFTXQLEN = 35139 +const SIOCSPGRP = 35074 const SIOCSRARP = 35170 const SIOGIFINDEX = 35123 const SLOT_2_0 = 2080895 const SLOT_4_2_0 = 4028612735 -const SNAN = 0 -const SNANF = 0 -const SNANF128 = 0 -const SNANF32 = 0 -const SNANF32X = 0 -const SNANF64 = 0 -const SNANF64X = 0 -const SNANL = 0 const SORTER_MAX_MERGE_COUNT = 16 const SORTER_TYPE_INTEGER = 1 const SORTER_TYPE_TEXT = 2 @@ -1727,6 +1629,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2112,7 +2015,7 @@ const SQLITE_MISMATCH = 20 const SQLITE_MISUSE = 21 const SQLITE_MISUSE_BKPT = 0 const SQLITE_MUTEX_FAST = 0 -const SQLITE_MUTEX_NOOP = 1 +const SQLITE_MUTEX_NREF = 0 const SQLITE_MUTEX_RECURSIVE = 1 const SQLITE_MUTEX_STATIC_APP1 = 8 const SQLITE_MUTEX_STATIC_APP2 = 9 @@ -2181,10 +2084,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2259,7 +2159,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2342,6 +2242,7 @@ const SQLITE_TESTCTRL_USELONGDOUBLE = 34 const SQLITE_TESTCTRL_VDBE_COVERAGE = 21 const SQLITE_TEXT = 3 const SQLITE_THREADSAFE = 1 +const SQLITE_THREADS_IMPLEMENTED = 1 const SQLITE_TOKEN_KEYWORD = 2 const SQLITE_TOKEN_QUOTED = 1 const SQLITE_TOOBIG = 18 @@ -2367,8 +2268,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2400,59 +2301,29 @@ const SRT_Union = 1 const SRT_Upfrom = 15 const STATX_ALL = 4095 const STATX_ATIME = 32 -const STATX_ATTR_APPEND = 32 -const STATX_ATTR_AUTOMOUNT = 4096 -const STATX_ATTR_COMPRESSED = 4 -const STATX_ATTR_DAX = 2097152 -const STATX_ATTR_ENCRYPTED = 2048 -const STATX_ATTR_IMMUTABLE = 16 -const STATX_ATTR_MOUNT_ROOT = 8192 -const STATX_ATTR_NODUMP = 64 -const STATX_ATTR_VERITY = 1048576 const STATX_BASIC_STATS = 2047 const STATX_BLOCKS = 1024 const STATX_BTIME = 2048 const STATX_CTIME = 128 const STATX_GID = 16 const STATX_INO = 256 -const STATX_MNT_ID = 4096 const STATX_MODE = 2 const STATX_MTIME = 64 const STATX_NLINK = 4 const STATX_SIZE = 512 const STATX_TYPE = 1 const STATX_UID = 8 -const STATX__RESERVED = 2147483648 const STAT_GET_NDLT = 4 const STAT_GET_NEQ = 2 const STAT_GET_NLT = 3 const STAT_GET_ROWID = 1 const STAT_GET_STAT1 = 0 -const STA_CLK = 32768 -const STA_CLOCKERR = 4096 -const STA_DEL = 32 -const STA_FLL = 8 -const STA_FREQHOLD = 128 -const STA_INS = 16 -const STA_MODE = 16384 -const STA_NANO = 8192 -const STA_PLL = 1 -const STA_PPSERROR = 2048 -const STA_PPSFREQ = 2 -const STA_PPSJITTER = 512 -const STA_PPSSIGNAL = 256 -const STA_PPSTIME = 4 -const STA_PPSWANDER = 1024 -const STA_RONLY = 65280 -const STA_UNSYNC = 64 const STDERR_FILENO = 2 const STDIN_FILENO = 0 const STDOUT_FILENO = 1 const SYNC_FILE_RANGE_WAIT_AFTER = 4 const SYNC_FILE_RANGE_WAIT_BEFORE = 1 const SYNC_FILE_RANGE_WRITE = 2 -const SYNC_FILE_RANGE_WRITE_AND_WAIT = 7 -const S_BLKSIZE = 512 const S_IEXEC = 64 const S_IFBLK = 24576 const S_IFCHR = 8192 @@ -2485,7 +2356,6 @@ const TABTYP_VTAB = 1 const TCFLSH = 21515 const TCGETA = 21509 const TCGETS = 21505 -const TCGETS2 = 2147505194 const TCGETX = 21554 const TCSBRK = 21513 const TCSBRKP = 21541 @@ -2493,11 +2363,8 @@ const TCSETA = 21510 const TCSETAF = 21512 const TCSETAW = 21511 const TCSETS = 21506 -const TCSETS2 = 1073763371 const TCSETSF = 21508 -const TCSETSF2 = 1073763373 const TCSETSW = 21507 -const TCSETSW2 = 1073763372 const TCSETX = 21555 const TCSETXF = 21556 const TCSETXW = 21557 @@ -2541,16 +2408,16 @@ const TIME_UTC = 1 const TIOCCBRK = 21544 const TIOCCONS = 21533 const TIOCEXCL = 21516 -const TIOCGDEV = 2147505202 +const TIOCGDEV = 2147767346 const TIOCGETD = 21540 -const TIOCGEXCL = 2147505216 +const TIOCGEXCL = 2147767360 const TIOCGICOUNT = 21597 -const TIOCGISO7816 = 2147505218 +const TIOCGISO7816 = 2150126658 const TIOCGLCKTRMIOS = 21590 const TIOCGPGRP = 21519 -const TIOCGPKT = 2147505208 -const TIOCGPTLCK = 2147505209 -const TIOCGPTN = 2147505200 +const TIOCGPKT = 2147767352 +const TIOCGPTLCK = 2147767353 +const TIOCGPTN = 2147767344 const TIOCGPTPEER = 21569 const TIOCGRS485 = 21550 const TIOCGSERIAL = 21534 @@ -2570,6 +2437,9 @@ const TIOCM_CTS = 32 const TIOCM_DSR = 256 const TIOCM_DTR = 2 const TIOCM_LE = 1 +const TIOCM_LOOP = 32768 +const TIOCM_OUT1 = 8192 +const TIOCM_OUT2 = 16384 const TIOCM_RI = 128 const TIOCM_RNG = 128 const TIOCM_RTS = 4 @@ -2598,11 +2468,11 @@ const TIOCSERSETMULTI = 21595 const TIOCSERSWILD = 21589 const TIOCSER_TEMT = 1 const TIOCSETD = 21539 -const TIOCSIG = 1073763382 -const TIOCSISO7816 = 3221247043 +const TIOCSIG = 1074025526 +const TIOCSISO7816 = 3223868483 const TIOCSLCKTRMIOS = 21591 const TIOCSPGRP = 21520 -const TIOCSPTLCK = 1073763377 +const TIOCSPTLCK = 1074025521 const TIOCSRS485 = 21551 const TIOCSSERIAL = 21535 const TIOCSSOFTCAR = 21530 @@ -2793,7 +2663,7 @@ const TK_WHERE = 149 const TK_WINDOW = 164 const TK_WITH = 81 const TK_WITHOUT = 26 -const TMP_MAX = 238328 +const TMP_MAX = 10000 const TOKEN = 0 const TRANS_NONE = 0 const TRANS_READ = 1 @@ -2801,11 +2671,6 @@ const TRANS_WRITE = 2 const TREETRACE_ENABLED = 0 const TRIGGER_AFTER = 2 const TRIGGER_BEFORE = 1 -const TTYDEF_CFLAG = 0 -const TTYDEF_IFLAG = 0 -const TTYDEF_LFLAG = 0 -const TTYDEF_OFLAG = 0 -const TTYDEF_SPEED = 0 const UNIXFILE_DELETE = 32 const UNIXFILE_DIRSYNC = 8 const UNIXFILE_EXCL = 1 @@ -2826,6 +2691,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2851,8 +2717,6 @@ const WAL_RETRY_PROTOCOL_LIMIT = 100 const WAL_SAVEPOINT_NDATA = 4 const WAL_SHM_RDONLY = 2 const WAL_WRITE_LOCK = 0 -const WCONTINUED = 8 -const WEXITED = 4 const WHERE_AGG_DISTINCT = 1024 const WHERE_AUTO_INDEX = 16384 const WHERE_BIGNULL_SORT = 524288 @@ -2908,7 +2772,6 @@ const WINDOW_RETURN_ROW = 1 const WINDOW_STARTING_INT = 0 const WINDOW_STARTING_NUM = 3 const WNOHANG = 1 -const WNOWAIT = 16777216 const WO_ALL = 16383 const WO_AND = 1024 const WO_AUX = 64 @@ -2929,7 +2792,6 @@ const WRC_Abort = 2 const WRC_Continue = 0 const WRC_Prune = 1 const WRITE_LOCK = 2 -const WSTOPPED = 2 const WUNTRACED = 2 const W_OK = 2 const XN_EXPR = -2 @@ -2961,92 +2823,88 @@ const YY_REDUCE_MIN = -271 const YY_SHIFT_COUNT = 578 const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 -const _ALLOCA_H = 1 -const _ASSERT_H = 1 -const _ATFILE_SOURCE = 1 -const _BITS_BYTESWAP_H = 1 -const _BITS_ENDIANNESS_H = 1 -const _BITS_ENDIAN_H = 1 -const _BITS_ERRNO_H = 1 -const _BITS_LIBM_SIMD_DECL_STUBS_H = 1 -const _BITS_POSIX_OPT_H = 1 -const _BITS_PTHREADTYPES_ARCH_H = 1 -const _BITS_PTHREADTYPES_COMMON_H = 1 -const _BITS_STAT_H = 1 -const _BITS_STDINT_INTN_H = 1 -const _BITS_STDIO_LIM_H = 1 -const _BITS_STRUCT_STAT_H = 1 -const _BITS_TIME64_H = 1 -const _BITS_TIMEX_H = 1 -const _BITS_TIME_H = 1 -const _BITS_TYPESIZES_H = 1 -const _BITS_TYPES_H = 1 -const _BITS_TYPES_LOCALE_T_H = 1 -const _BITS_TYPES___LOCALE_T_H = 1 -const _BITS_UINTN_IDENTITY_H = 1 -const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 0 -const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 0 -const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 0 -const _DEFAULT_SOURCE = 1 -const _DLFCN_H = 1 -const _DYNAMIC_STACK_SIZE_SOURCE = 1 -const _ENDIAN_H = 1 -const _ERRNO_H = 1 -const _FCNTL_H = 1 -const _FEATURES_H = 1 +const _CS_GNU_LIBC_VERSION = 2 +const _CS_GNU_LIBPTHREAD_VERSION = 3 +const _CS_PATH = 0 +const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4 +const _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 +const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 +const _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 +const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 +const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 +const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 +const _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 +const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 +const _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 +const _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 +const _CS_POSIX_V6_LP64_OFF64_LIBS = 1126 +const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 +const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 +const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 +const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 +const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 +const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1 +const _CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 +const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 +const _CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 +const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 +const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 +const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 +const _CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 +const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 +const _CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 +const _CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 +const _CS_POSIX_V7_LP64_OFF64_LIBS = 1142 +const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 +const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 +const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 +const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 +const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 +const _CS_POSIX_V7_THREADS_CFLAGS = 1150 +const _CS_POSIX_V7_THREADS_LDFLAGS = 1151 +const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5 +const _CS_V6_ENV = 1148 +const _CS_V7_ENV = 1149 const _FILE_OFFSET_BITS = 64 -const _GETOPT_CORE_H = 1 -const _GETOPT_POSIX_H = 1 -const _IOC_DIRBITS = 2 -const _IOC_DIRMASK = 3 -const _IOC_DIRSHIFT = 30 +const _GNU_SOURCE = 1 const _IOC_NONE = 0 -const _IOC_NRBITS = 8 -const _IOC_NRMASK = 255 -const _IOC_NRSHIFT = 0 const _IOC_READ = 2 -const _IOC_SIZEBITS = 14 -const _IOC_SIZEMASK = 16383 -const _IOC_SIZESHIFT = 16 -const _IOC_TYPEBITS = 8 -const _IOC_TYPEMASK = 255 -const _IOC_TYPESHIFT = 8 const _IOC_WRITE = 1 const _IOFBF = 0 const _IOLBF = 1 const _IONBF = 2 -const _IO_EOF_SEEN = 16 -const _IO_ERR_SEEN = 32 -const _IO_USER_LOCK = 32768 -const _ISOC11_SOURCE = 1 -const _ISOC2X_SOURCE = 1 -const _ISOC95_SOURCE = 1 -const _ISOC99_SOURCE = 1 -const _LARGEFILE64_SOURCE = 1 const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 -const _LFS64_ASYNCHRONOUS_IO = 1 -const _LFS64_LARGEFILE = 1 -const _LFS64_STDIO = 1 -const _LFS_ASYNCHRONOUS_IO = 1 -const _LFS_LARGEFILE = 1 const _LP64 = 1 -const _MATH_H = 1 -const _POSIX2_CHAR_TERM = 200809 +const _PC_2_SYMLINKS = 20 +const _PC_ALLOC_SIZE_MIN = 18 +const _PC_ASYNC_IO = 10 +const _PC_CHOWN_RESTRICTED = 6 +const _PC_FILESIZEBITS = 13 +const _PC_LINK_MAX = 0 +const _PC_MAX_CANON = 1 +const _PC_MAX_INPUT = 2 +const _PC_NAME_MAX = 3 +const _PC_NO_TRUNC = 7 +const _PC_PATH_MAX = 4 +const _PC_PIPE_BUF = 5 +const _PC_PRIO_IO = 11 +const _PC_REC_INCR_XFER_SIZE = 14 +const _PC_REC_MAX_XFER_SIZE = 15 +const _PC_REC_MIN_XFER_SIZE = 16 +const _PC_REC_XFER_ALIGN = 17 +const _PC_SOCK_MAXBUF = 12 +const _PC_SYMLINK_MAX = 19 +const _PC_SYNC_IO = 9 +const _PC_VDISABLE = 8 const _POSIX2_C_BIND = 200809 -const _POSIX2_C_DEV = 200809 -const _POSIX2_C_VERSION = 200809 -const _POSIX2_LOCALEDEF = 200809 -const _POSIX2_SW_DEV = 200809 const _POSIX2_VERSION = 200809 const _POSIX_ADVISORY_INFO = 200809 const _POSIX_ASYNCHRONOUS_IO = 200809 -const _POSIX_ASYNC_IO = 1 const _POSIX_BARRIERS = 200809 -const _POSIX_CHOWN_RESTRICTED = 0 +const _POSIX_CHOWN_RESTRICTED = 1 const _POSIX_CLOCK_SELECTION = 200809 -const _POSIX_CPUTIME = 0 -const _POSIX_C_SOURCE = 200809 +const _POSIX_CPUTIME = 200809 const _POSIX_FSYNC = 200809 const _POSIX_IPV6 = 200809 const _POSIX_JOB_CONTROL = 1 @@ -3055,85 +2913,179 @@ const _POSIX_MEMLOCK = 200809 const _POSIX_MEMLOCK_RANGE = 200809 const _POSIX_MEMORY_PROTECTION = 200809 const _POSIX_MESSAGE_PASSING = 200809 -const _POSIX_MONOTONIC_CLOCK = 0 +const _POSIX_MONOTONIC_CLOCK = 200809 const _POSIX_NO_TRUNC = 1 -const _POSIX_PRIORITIZED_IO = 200809 -const _POSIX_PRIORITY_SCHEDULING = 200809 const _POSIX_RAW_SOCKETS = 200809 const _POSIX_READER_WRITER_LOCKS = 200809 const _POSIX_REALTIME_SIGNALS = 200809 -const _POSIX_REENTRANT_FUNCTIONS = 1 const _POSIX_REGEXP = 1 const _POSIX_SAVED_IDS = 1 const _POSIX_SEMAPHORES = 200809 const _POSIX_SHARED_MEMORY_OBJECTS = 200809 const _POSIX_SHELL = 1 -const _POSIX_SOURCE = 1 const _POSIX_SPAWN = 200809 const _POSIX_SPIN_LOCKS = 200809 -const _POSIX_SPORADIC_SERVER = -1 -const _POSIX_SYNCHRONIZED_IO = 200809 const _POSIX_THREADS = 200809 const _POSIX_THREAD_ATTR_STACKADDR = 200809 const _POSIX_THREAD_ATTR_STACKSIZE = 200809 -const _POSIX_THREAD_CPUTIME = 0 +const _POSIX_THREAD_CPUTIME = 200809 const _POSIX_THREAD_PRIORITY_SCHEDULING = 200809 -const _POSIX_THREAD_PRIO_INHERIT = 200809 -const _POSIX_THREAD_PRIO_PROTECT = 200809 const _POSIX_THREAD_PROCESS_SHARED = 200809 -const _POSIX_THREAD_ROBUST_PRIO_INHERIT = 200809 -const _POSIX_THREAD_ROBUST_PRIO_PROTECT = -1 const _POSIX_THREAD_SAFE_FUNCTIONS = 200809 -const _POSIX_THREAD_SPORADIC_SERVER = -1 const _POSIX_TIMEOUTS = 200809 const _POSIX_TIMERS = 200809 -const _POSIX_TRACE = -1 -const _POSIX_TRACE_EVENT_FILTER = -1 -const _POSIX_TRACE_INHERIT = -1 -const _POSIX_TRACE_LOG = -1 -const _POSIX_TYPED_MEMORY_OBJECTS = -1 const _POSIX_V6_LP64_OFF64 = 1 -const _POSIX_V6_LPBIG_OFFBIG = -1 const _POSIX_V7_LP64_OFF64 = 1 -const _POSIX_V7_LPBIG_OFFBIG = -1 const _POSIX_VDISABLE = 0 const _POSIX_VERSION = 200809 -const _PRINTF_NAN_LEN_MAX = 4 -const _SC_PAGE_SIZE = 0 -const _SIGSET_NWORDS = 1024 +const _SC_2_CHAR_TERM = 95 +const _SC_2_C_BIND = 47 +const _SC_2_C_DEV = 48 +const _SC_2_FORT_DEV = 49 +const _SC_2_FORT_RUN = 50 +const _SC_2_LOCALEDEF = 52 +const _SC_2_PBS = 168 +const _SC_2_PBS_ACCOUNTING = 169 +const _SC_2_PBS_CHECKPOINT = 175 +const _SC_2_PBS_LOCATE = 170 +const _SC_2_PBS_MESSAGE = 171 +const _SC_2_PBS_TRACK = 172 +const _SC_2_SW_DEV = 51 +const _SC_2_UPE = 97 +const _SC_2_VERSION = 46 +const _SC_ADVISORY_INFO = 132 +const _SC_AIO_LISTIO_MAX = 23 +const _SC_AIO_MAX = 24 +const _SC_AIO_PRIO_DELTA_MAX = 25 +const _SC_ARG_MAX = 0 +const _SC_ASYNCHRONOUS_IO = 12 +const _SC_ATEXIT_MAX = 87 +const _SC_AVPHYS_PAGES = 86 +const _SC_BARRIERS = 133 +const _SC_BC_BASE_MAX = 36 +const _SC_BC_DIM_MAX = 37 +const _SC_BC_SCALE_MAX = 38 +const _SC_BC_STRING_MAX = 39 +const _SC_CHILD_MAX = 1 +const _SC_CLK_TCK = 2 +const _SC_CLOCK_SELECTION = 137 +const _SC_COLL_WEIGHTS_MAX = 40 +const _SC_CPUTIME = 138 +const _SC_DELAYTIMER_MAX = 26 +const _SC_EXPR_NEST_MAX = 42 +const _SC_FSYNC = 15 +const _SC_GETGR_R_SIZE_MAX = 69 +const _SC_GETPW_R_SIZE_MAX = 70 +const _SC_HOST_NAME_MAX = 180 +const _SC_IOV_MAX = 60 +const _SC_IPV6 = 235 +const _SC_JOB_CONTROL = 7 +const _SC_LINE_MAX = 43 +const _SC_LOGIN_NAME_MAX = 71 +const _SC_MAPPED_FILES = 16 +const _SC_MEMLOCK = 17 +const _SC_MEMLOCK_RANGE = 18 +const _SC_MEMORY_PROTECTION = 19 +const _SC_MESSAGE_PASSING = 20 +const _SC_MINSIGSTKSZ = 249 +const _SC_MONOTONIC_CLOCK = 149 +const _SC_MQ_OPEN_MAX = 27 +const _SC_MQ_PRIO_MAX = 28 +const _SC_NGROUPS_MAX = 3 +const _SC_NPROCESSORS_CONF = 83 +const _SC_NPROCESSORS_ONLN = 84 +const _SC_NZERO = 109 +const _SC_OPEN_MAX = 4 +const _SC_PAGESIZE = 30 +const _SC_PAGE_SIZE = 30 +const _SC_PASS_MAX = 88 +const _SC_PHYS_PAGES = 85 +const _SC_PRIORITIZED_IO = 13 +const _SC_PRIORITY_SCHEDULING = 10 +const _SC_RAW_SOCKETS = 236 +const _SC_READER_WRITER_LOCKS = 153 +const _SC_REALTIME_SIGNALS = 9 +const _SC_REGEXP = 155 +const _SC_RE_DUP_MAX = 44 +const _SC_RTSIG_MAX = 31 +const _SC_SAVED_IDS = 8 +const _SC_SEMAPHORES = 21 +const _SC_SEM_NSEMS_MAX = 32 +const _SC_SEM_VALUE_MAX = 33 +const _SC_SHARED_MEMORY_OBJECTS = 22 +const _SC_SHELL = 157 +const _SC_SIGQUEUE_MAX = 34 +const _SC_SIGSTKSZ = 250 +const _SC_SPAWN = 159 +const _SC_SPIN_LOCKS = 154 +const _SC_SPORADIC_SERVER = 160 +const _SC_SS_REPL_MAX = 241 +const _SC_STREAMS = 174 +const _SC_STREAM_MAX = 5 +const _SC_SYMLOOP_MAX = 173 +const _SC_SYNCHRONIZED_IO = 14 +const _SC_THREADS = 67 +const _SC_THREAD_ATTR_STACKADDR = 77 +const _SC_THREAD_ATTR_STACKSIZE = 78 +const _SC_THREAD_CPUTIME = 139 +const _SC_THREAD_DESTRUCTOR_ITERATIONS = 73 +const _SC_THREAD_KEYS_MAX = 74 +const _SC_THREAD_PRIORITY_SCHEDULING = 79 +const _SC_THREAD_PRIO_INHERIT = 80 +const _SC_THREAD_PRIO_PROTECT = 81 +const _SC_THREAD_PROCESS_SHARED = 82 +const _SC_THREAD_ROBUST_PRIO_INHERIT = 247 +const _SC_THREAD_ROBUST_PRIO_PROTECT = 248 +const _SC_THREAD_SAFE_FUNCTIONS = 68 +const _SC_THREAD_SPORADIC_SERVER = 161 +const _SC_THREAD_STACK_MIN = 75 +const _SC_THREAD_THREADS_MAX = 76 +const _SC_TIMEOUTS = 164 +const _SC_TIMERS = 11 +const _SC_TIMER_MAX = 35 +const _SC_TRACE = 181 +const _SC_TRACE_EVENT_FILTER = 182 +const _SC_TRACE_EVENT_NAME_MAX = 242 +const _SC_TRACE_INHERIT = 183 +const _SC_TRACE_LOG = 184 +const _SC_TRACE_NAME_MAX = 243 +const _SC_TRACE_SYS_MAX = 244 +const _SC_TRACE_USER_EVENT_MAX = 245 +const _SC_TTY_NAME_MAX = 72 +const _SC_TYPED_MEMORY_OBJECTS = 165 +const _SC_TZNAME_MAX = 6 +const _SC_UIO_MAXIOV = 60 +const _SC_V6_ILP32_OFF32 = 176 +const _SC_V6_ILP32_OFFBIG = 177 +const _SC_V6_LP64_OFF64 = 178 +const _SC_V6_LPBIG_OFFBIG = 179 +const _SC_V7_ILP32_OFF32 = 237 +const _SC_V7_ILP32_OFFBIG = 238 +const _SC_V7_LP64_OFF64 = 239 +const _SC_V7_LPBIG_OFFBIG = 240 +const _SC_VERSION = 29 +const _SC_XBS5_ILP32_OFF32 = 125 +const _SC_XBS5_ILP32_OFFBIG = 126 +const _SC_XBS5_LP64_OFF64 = 127 +const _SC_XBS5_LPBIG_OFFBIG = 128 +const _SC_XOPEN_CRYPT = 92 +const _SC_XOPEN_ENH_I18N = 93 +const _SC_XOPEN_LEGACY = 129 +const _SC_XOPEN_REALTIME = 130 +const _SC_XOPEN_REALTIME_THREADS = 131 +const _SC_XOPEN_SHM = 94 +const _SC_XOPEN_STREAMS = 246 +const _SC_XOPEN_UNIX = 91 +const _SC_XOPEN_VERSION = 89 +const _SC_XOPEN_XCU_VERSION = 90 +const _SC_XOPEN_XPG2 = 98 +const _SC_XOPEN_XPG3 = 99 +const _SC_XOPEN_XPG4 = 100 const _STDC_PREDEF_H = 1 -const _STDIO_H = 1 -const _STDLIB_H = 1 -const _STRINGS_H = 1 -const _STRING_H = 1 -const _STRUCT_TIMESPEC = 1 -const _SYS_CDEFS_H = 1 -const _SYS_IOCTL_H = 1 -const _SYS_MMAN_H = 1 -const _SYS_SELECT_H = 1 -const _SYS_STAT_H = 1 -const _SYS_TIME_H = 1 -const _SYS_TYPES_H = 1 -const _THREAD_MUTEX_INTERNAL_H = 1 -const _THREAD_SHARED_TYPES_H = 1 -const _TIME_H = 1 -const _UNISTD_H = 1 -const _XBS5_LP64_OFF64 = 1 -const _XBS5_LPBIG_OFFBIG = -1 const _XOPEN_ENH_I18N = 1 -const _XOPEN_LEGACY = 1 -const _XOPEN_REALTIME = 1 -const _XOPEN_REALTIME_THREADS = 1 -const _XOPEN_SHM = 1 -const _XOPEN_SOURCE = 700 -const _XOPEN_SOURCE_EXTENDED = 1 +const _XOPEN_SOURCE = 600 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 -const _XOPEN_XCU_VERSION = 4 -const _XOPEN_XPG2 = 1 -const _XOPEN_XPG3 = 1 -const _XOPEN_XPG4 = 1 -const __ASSERT_VOID_CAST = 0 const __ATOMIC_ACQUIRE = 2 const __ATOMIC_ACQ_REL = 4 const __ATOMIC_CONSUME = 1 @@ -3144,18 +3096,10 @@ const __ATOMIC_RELEASE = 3 const __ATOMIC_SEQ_CST = 5 const __BIGGEST_ALIGNMENT__ = 16 const __BIG_ENDIAN = 4321 -const __BIT_TYPES_DEFINED__ = 1 -const __BLKCNT64_T_TYPE = "__SQUAD_TYPE" -const __BLKCNT_T_TYPE = "__SYSCALL_SLONG_TYPE" -const __BLKSIZE_T_TYPE = "__SYSCALL_SLONG_TYPE" const __BYTE_ORDER = 1234 const __BYTE_ORDER__ = 1234 const __CCGO__ = 1 const __CHAR_BIT__ = 8 -const __CLOCKID_T_TYPE = 0 -const __CLOCK_T_TYPE = "__SYSCALL_SLONG_TYPE" -const __CPU_MASK_TYPE = "__SYSCALL_ULONG_TYPE" -const __DADDR_T_TYPE = 0 const __DBL_DECIMAL_DIG__ = 17 const __DBL_DIG__ = 15 const __DBL_HAS_DENORM__ = 1 @@ -3191,12 +3135,8 @@ const __DEC64_SUBNORMAL_MIN__ = 0 const __DECIMAL_BID_FORMAT__ = 1 const __DECIMAL_DIG__ = 17 const __DEC_EVAL_METHOD__ = 2 -const __DEV_T_TYPE = "__UQUAD_TYPE" const __ELF__ = 1 -const __FD_SETSIZE = 1024 -const __FILE_defined = 1 const __FINITE_MATH_ONLY__ = 0 -const __FLOAT_WORD_ORDER = 1234 const __FLOAT_WORD_ORDER__ = 1234 const __FLT128_DECIMAL_DIG__ = 36 const __FLT128_DENORM_MIN__ = 0 @@ -3313,22 +3253,8 @@ const __FLT_MIN_EXP__ = -125 const __FLT_MIN__ = 0 const __FLT_NORM_MAX__ = 0 const __FLT_RADIX__ = 2 -const __FP_LOGB0_IS_MIN = 1 -const __FP_LOGBNAN_IS_MIN = 1 -const __FP_LONG_MAX = 9223372036854775807 -const __FSBLKCNT64_T_TYPE = "__UQUAD_TYPE" -const __FSBLKCNT_T_TYPE = "__SYSCALL_ULONG_TYPE" -const __FSFILCNT64_T_TYPE = "__UQUAD_TYPE" -const __FSFILCNT_T_TYPE = "__SYSCALL_ULONG_TYPE" -const __FSWORD_T_TYPE = "__SYSCALL_SLONG_TYPE" const __FUNCTION__ = 0 const __FXSR__ = 1 -const __F_GETOWN = 9 -const __F_GETOWN_EX = 16 -const __F_GETSIG = 11 -const __F_SETOWN = 8 -const __F_SETOWN_EX = 15 -const __F_SETSIG = 10 const __GCC_ASM_FLAG_OUTPUTS__ = 1 const __GCC_ATOMIC_BOOL_LOCK_FREE = 2 const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2 @@ -3350,55 +3276,14 @@ const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1 const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1 const __GCC_IEC_559 = 2 const __GCC_IEC_559_COMPLEX = 2 -const __GID_T_TYPE = "__U32_TYPE" -const __GLIBC_FLT_EVAL_METHOD = 0 -const __GLIBC_MINOR__ = 36 -const __GLIBC_USE_DEPRECATED_GETS = 0 -const __GLIBC_USE_DEPRECATED_SCANF = 0 -const __GLIBC_USE_IEC_60559_BFP_EXT = 1 -const __GLIBC_USE_IEC_60559_BFP_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_TYPES_EXT = 1 -const __GLIBC_USE_ISOC2X = 1 -const __GLIBC_USE_LIB_EXT2 = 1 -const __GLIBC__ = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" const __GNUC_MINOR__ = 2 const __GNUC_PATCHLEVEL__ = 0 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 12 -const __GNU_LIBRARY__ = 6 const __GXX_ABI_VERSION = 1017 -const __HAVE_DISTINCT_FLOAT128 = 1 -const __HAVE_DISTINCT_FLOAT128X = 0 -const __HAVE_DISTINCT_FLOAT16 = 0 -const __HAVE_DISTINCT_FLOAT32 = 0 -const __HAVE_DISTINCT_FLOAT32X = 0 -const __HAVE_DISTINCT_FLOAT64 = 0 -const __HAVE_DISTINCT_FLOAT64X = 0 -const __HAVE_FLOAT128 = 1 -const __HAVE_FLOAT128X = 0 -const __HAVE_FLOAT128_UNLIKE_LDBL = 1 -const __HAVE_FLOAT16 = 0 -const __HAVE_FLOAT32 = 1 -const __HAVE_FLOAT32X = 1 -const __HAVE_FLOAT64 = 1 -const __HAVE_FLOAT64X = 1 -const __HAVE_FLOAT64X_LONG_DOUBLE = 1 -const __HAVE_FLOATN_NOT_TYPEDEF = 1 -const __HAVE_GENERIC_SELECTION = 1 const __HAVE_SPECULATION_SAFE_VALUE = 1 -const __ID_T_TYPE = "__U32_TYPE" -const __ILP32_OFF32_CFLAGS = "-m32" -const __ILP32_OFF32_LDFLAGS = "-m32" -const __ILP32_OFFBIG_CFLAGS = "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -const __ILP32_OFFBIG_LDFLAGS = "-m32" -const __INO64_T_TYPE = "__UQUAD_TYPE" -const __INO_T_MATCHES_INO64_T = 1 -const __INO_T_TYPE = "__SYSCALL_ULONG_TYPE" const __INT16_MAX__ = 32767 const __INT32_MAX__ = 2147483647 const __INT32_TYPE__ = 0 @@ -3427,8 +3312,6 @@ const __INT_LEAST8_MAX__ = 127 const __INT_LEAST8_WIDTH__ = 8 const __INT_MAX__ = 2147483647 const __INT_WIDTH__ = 32 -const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 = 1 -const __KEY_T_TYPE = 0 const __LDBL_DECIMAL_DIG__ = 17 const __LDBL_DENORM_MIN__ = 0 const __LDBL_DIG__ = 15 @@ -3445,54 +3328,27 @@ const __LDBL_MIN_10_EXP__ = -307 const __LDBL_MIN_EXP__ = -1021 const __LDBL_MIN__ = 0 const __LDBL_NORM_MAX__ = 0 -const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0 -const __LEAF = 0 const __LITTLE_ENDIAN = 1234 const __LONG_DOUBLE_64__ = 1 const __LONG_LONG_MAX__ = 9223372036854775807 const __LONG_LONG_WIDTH__ = 64 +const __LONG_MAX = 9223372036854775807 const __LONG_MAX__ = 9223372036854775807 const __LONG_WIDTH__ = 64 -const __LP64_OFF64_CFLAGS = "-m64" -const __LP64_OFF64_LDFLAGS = "-m64" const __LP64__ = 1 -const __MATH_DECLARE_LDOUBLE = 1 const __MMX_WITH_SSE__ = 1 const __MMX__ = 1 -const __MODE_T_TYPE = "__U32_TYPE" -const __NLINK_T_TYPE = "__SYSCALL_ULONG_TYPE" const __NO_INLINE__ = 1 -const __OFF64_T_TYPE = "__SQUAD_TYPE" -const __OFF_T_MATCHES_OFF64_T = 1 -const __OFF_T_TYPE = "__SYSCALL_SLONG_TYPE" const __ORDER_BIG_ENDIAN__ = 4321 const __ORDER_LITTLE_ENDIAN__ = 1234 const __ORDER_PDP_ENDIAN__ = 3412 -const __O_CLOEXEC = 524288 -const __O_DIRECT = 16384 -const __O_DIRECTORY = 65536 -const __O_DSYNC = 4096 -const __O_LARGEFILE = 0 -const __O_NOATIME = 262144 -const __O_NOFOLLOW = 131072 -const __O_PATH = 2097152 -const __O_TMPFILE = 4259840 const __PDP_ENDIAN = 3412 const __PIC__ = 2 -const __PID_T_TYPE = 0 const __PIE__ = 2 -const __POSIX2_THIS_VERSION = 200809 -const __POSIX_FADV_DONTNEED = 4 -const __POSIX_FADV_NOREUSE = 5 const __PRAGMA_REDEFINE_EXTNAME = 1 const __PRETTY_FUNCTION__ = 0 -const __PTHREAD_MUTEX_HAVE_PREV = 1 const __PTRDIFF_MAX__ = 9223372036854775807 const __PTRDIFF_WIDTH__ = 64 -const __RLIM64_T_TYPE = "__UQUAD_TYPE" -const __RLIM_T_MATCHES_RLIM64_T = 1 -const __RLIM_T_TYPE = "__SYSCALL_ULONG_TYPE" -const __S32_TYPE = 0 const __SCHAR_MAX__ = 127 const __SCHAR_WIDTH__ = 8 const __SEG_FS = 1 @@ -3513,15 +3369,6 @@ const __SIZEOF_LONG_DOUBLE__ = 8 const __SIZEOF_LONG_LONG__ = 8 const __SIZEOF_LONG__ = 8 const __SIZEOF_POINTER__ = 8 -const __SIZEOF_PTHREAD_ATTR_T = 56 -const __SIZEOF_PTHREAD_BARRIERATTR_T = 4 -const __SIZEOF_PTHREAD_BARRIER_T = 32 -const __SIZEOF_PTHREAD_CONDATTR_T = 4 -const __SIZEOF_PTHREAD_COND_T = 48 -const __SIZEOF_PTHREAD_MUTEXATTR_T = 4 -const __SIZEOF_PTHREAD_MUTEX_T = 40 -const __SIZEOF_PTHREAD_RWLOCKATTR_T = 8 -const __SIZEOF_PTHREAD_RWLOCK_T = 56 const __SIZEOF_PTRDIFF_T__ = 8 const __SIZEOF_SHORT__ = 2 const __SIZEOF_SIZE_T__ = 8 @@ -3529,14 +3376,11 @@ const __SIZEOF_WCHAR_T__ = 4 const __SIZEOF_WINT_T__ = 4 const __SIZE_MAX__ = 18446744073709551615 const __SIZE_WIDTH__ = 64 -const __SLONG32_TYPE = 0 const __SQLITESESSION_H_ = 1 const __SSE2_MATH__ = 1 const __SSE2__ = 1 const __SSE_MATH__ = 1 const __SSE__ = 1 -const __SSIZE_T_TYPE = "__SWORD_TYPE" -const __STATFS_MATCHES_STATFS64 = 1 const __STDC_HOSTED__ = 1 const __STDC_IEC_559_COMPLEX__ = 1 const __STDC_IEC_559__ = 1 @@ -3547,30 +3391,6 @@ const __STDC_UTF_16__ = 1 const __STDC_UTF_32__ = 1 const __STDC_VERSION__ = 201710 const __STDC__ = 1 -const __SUSECONDS64_T_TYPE = "__SQUAD_TYPE" -const __SUSECONDS_T_TYPE = "__SYSCALL_SLONG_TYPE" -const __SYSCALL_SLONG_TYPE = "__SLONGWORD_TYPE" -const __SYSCALL_ULONG_TYPE = "__ULONGWORD_TYPE" -const __SYSCALL_WORDSIZE = 64 -const __S_IEXEC = 64 -const __S_IFBLK = 24576 -const __S_IFCHR = 8192 -const __S_IFDIR = 16384 -const __S_IFIFO = 4096 -const __S_IFLNK = 40960 -const __S_IFMT = 61440 -const __S_IFREG = 32768 -const __S_IFSOCK = 49152 -const __S_IREAD = 256 -const __S_ISGID = 1024 -const __S_ISUID = 2048 -const __S_ISVTX = 512 -const __S_IWRITE = 128 -const __TIME64_T_TYPE = "__TIME_T_TYPE" -const __TIMER_T_TYPE = 0 -const __TIMESIZE = 64 -const __TIME_T_TYPE = "__SYSCALL_SLONG_TYPE" -const __UID_T_TYPE = "__U32_TYPE" const __UINT16_MAX__ = 65535 const __UINT32_MAX__ = 4294967295 const __UINT64_MAX__ = 18446744073709551615 @@ -3585,81 +3405,35 @@ const __UINT_LEAST16_MAX__ = 65535 const __UINT_LEAST32_MAX__ = 4294967295 const __UINT_LEAST64_MAX__ = 18446744073709551615 const __UINT_LEAST8_MAX__ = 255 -const __USECONDS_T_TYPE = "__U32_TYPE" -const __USE_ATFILE = 1 -const __USE_DYNAMIC_STACK_SIZE = 1 -const __USE_FILE_OFFSET64 = 1 -const __USE_FORTIFY_LEVEL = 0 -const __USE_GNU = 1 -const __USE_ISOC11 = 1 -const __USE_ISOC95 = 1 -const __USE_ISOC99 = 1 -const __USE_LARGEFILE = 1 -const __USE_LARGEFILE64 = 1 -const __USE_MISC = 1 -const __USE_POSIX = 1 -const __USE_POSIX199309 = 1 -const __USE_POSIX199506 = 1 -const __USE_POSIX2 = 1 -const __USE_UNIX98 = 1 -const __USE_XOPEN = 1 -const __USE_XOPEN2K = 1 -const __USE_XOPEN2K8 = 1 -const __USE_XOPEN2K8XSI = 1 -const __USE_XOPEN2KXSI = 1 -const __USE_XOPEN_EXTENDED = 1 +const __USE_TIME_BITS64 = 1 const __VERSION__ = "12.2.0" -const __WALL = 1073741824 const __WCHAR_MAX__ = 2147483647 const __WCHAR_MIN__ = -2147483648 const __WCHAR_TYPE__ = 0 const __WCHAR_WIDTH__ = 32 -const __WCLONE = 2147483648 -const __WCOREFLAG = 128 const __WINT_MAX__ = 4294967295 const __WINT_MIN__ = 0 const __WINT_WIDTH__ = 32 -const __WNOTHREAD = 536870912 -const __WORDSIZE = 64 -const __WORDSIZE_TIME64_COMPAT32 = 1 -const __W_CONTINUED = 65535 -const ____FILE_defined = 1 -const _____fpos64_t_defined = 1 -const _____fpos_t_defined = 1 -const ____mbstate_t_defined = 1 const __amd64 = 1 const __amd64__ = 1 -const __clock_t_defined = 1 -const __clockid_t_defined = 1 const __code_model_small__ = 1 -const __cookie_io_functions_t_defined = 1 -const __error_t_defined = 1 -const __glibc_c99_flexarr_available = 1 const __gnu_linux__ = 1 -const __have_pthread_attr_t = 1 -const __iovec_defined = 1 -const __itimerspec_defined = 1 +const __inline = 0 const __k8 = 1 const __k8__ = 1 -const __ldiv_t_defined = 1 const __linux = 1 const __linux__ = 1 -const __lldiv_t_defined = 1 const __pic__ = 2 const __pie__ = 2 -const __ptr_t = 0 -const __sigset_t_defined = 1 -const __statx_defined = 1 -const __statx_timestamp_defined = 1 -const __struct_FILE_defined = 1 -const __struct_tm_defined = 1 -const __time_t_defined = 1 -const __timer_t_defined = 1 -const __timeval_defined = 1 +const __restrict = 0 +const __restrict_arr = 0 +const __tm_gmtoff = 0 +const __tm_zone = 0 const __unix = 1 const __unix__ = 1 const __x86_64 = 1 const __x86_64__ = 1 +const alloca = 0 const bBatch = 0 const cume_distFinalizeFunc = 0 const errno = 0 @@ -3713,7 +3487,8 @@ const fts5YY_SHIFT_MIN = 0 const get4byte = 0 const getVarint = 0 const linux = 1 -const math_errhandling = 3 +const loff_t = 0 +const math_errhandling = 2 const mem0 = 0 const noopFunc = 0 const nth_valueInvFunc = 0 @@ -3759,8 +3534,6 @@ type t__predefined_wchar_t = int32 type t__predefined_ptrdiff_t = int64 -type t__gnuc_va_list = uintptr - type Tva_list = uintptr type va_list = Tva_list @@ -4240,6 +4013,370 @@ type Tsqlite3_io_methods1 = struct { type sqlite3_io_methods1 = Tsqlite3_io_methods1 +/* +** CAPI3REF: Standard File Control Opcodes +** KEYWORDS: {file control opcodes} {file control opcode} +** +** These integer constants are opcodes for the xFileControl method +** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** interface. +** +**
      +**
    • [[SQLITE_FCNTL_LOCKSTATE]] +** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This +** opcode causes the xFileControl method to write the current state of +** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], +** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) +** into an integer that the pArg argument points to. +** This capability is only available if SQLite is compiled with [SQLITE_DEBUG]. +** +**
    • [[SQLITE_FCNTL_SIZE_HINT]] +** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS +** layer a hint of how large the database file will grow to be during the +** current transaction. This hint is not guaranteed to be accurate but it +** is often close. The underlying VFS might choose to preallocate database +** file space based on this hint in order to help writes to the database +** file run faster. +** +**
    • [[SQLITE_FCNTL_SIZE_LIMIT]] +** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that +** implements [sqlite3_deserialize()] to set an upper bound on the size +** of the in-memory database. The argument is a pointer to a [sqlite3_int64]. +** If the integer pointed to is negative, then it is filled in with the +** current limit. Otherwise the limit is set to the larger of the value +** of the integer pointed to and the current database size. The integer +** pointed to is set to the new limit. +** +**
    • [[SQLITE_FCNTL_CHUNK_SIZE]] +** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS +** extends and truncates the database file in chunks of a size specified +** by the user. The fourth argument to [sqlite3_file_control()] should +** point to an integer (type int) containing the new chunk-size to use +** for the nominated database. Allocating database file space in large +** chunks (say 1MB at a time), may reduce file-system fragmentation and +** improve performance on some systems. +** +**
    • [[SQLITE_FCNTL_FILE_POINTER]] +** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with a particular database +** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER]. +** +**
    • [[SQLITE_FCNTL_JOURNAL_POINTER]] +** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with the journal file (either +** the [rollback journal] or the [write-ahead log]) for a particular database +** connection. See also [SQLITE_FCNTL_FILE_POINTER]. +** +**
    • [[SQLITE_FCNTL_SYNC_OMITTED]] +** No longer in use. +** +**
    • [[SQLITE_FCNTL_SYNC]] +** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and +** sent to the VFS immediately before the xSync method is invoked on a +** database file descriptor. Or, if the xSync method is not invoked +** because the user has configured SQLite with +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place +** of the xSync method. In most cases, the pointer argument passed with +** this file-control is NULL. However, if the database file is being synced +** as part of a multi-database commit, the argument points to a nul-terminated +** string containing the transactions super-journal file name. VFSes that +** do not need this signal should silently ignore this opcode. Applications +** should not call [sqlite3_file_control()] with this opcode as doing so may +** disrupt the operation of the specialized VFSes that do require it. +** +**
    • [[SQLITE_FCNTL_COMMIT_PHASETWO]] +** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite +** and sent to the VFS after a transaction has been committed immediately +** but before the database is unlocked. VFSes that do not need this signal +** should silently ignore this opcode. Applications should not call +** [sqlite3_file_control()] with this opcode as doing so may disrupt the +** operation of the specialized VFSes that do require it. +** +**
    • [[SQLITE_FCNTL_WIN32_AV_RETRY]] +** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic +** retry counts and intervals for certain disk I/O operations for the +** windows [VFS] in order to provide robustness in the presence of +** anti-virus programs. By default, the windows VFS will retry file read, +** file write, and file delete operations up to 10 times, with a delay +** of 25 milliseconds before the first retry and with the delay increasing +** by an additional 25 milliseconds with each subsequent retry. This +** opcode allows these two values (10 retries and 25 milliseconds of delay) +** to be adjusted. The values are changed for all database connections +** within the same process. The argument is a pointer to an array of two +** integers where the first integer is the new retry count and the second +** integer is the delay. If either integer is negative, then the setting +** is not changed but instead the prior value of that setting is written +** into the array entry, allowing the current retry settings to be +** interrogated. The zDbName parameter is ignored. +** +**
    • [[SQLITE_FCNTL_PERSIST_WAL]] +** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the +** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary +** write ahead log ([WAL file]) and shared memory +** files used for transaction control +** are automatically deleted when the latest connection to the database +** closes. Setting persistent WAL mode causes those files to persist after +** close. Persisting the files is useful when other processes that do not +** have write permission on the directory containing the database file want +** to read the database file, as the WAL and shared memory files must exist +** in order for the database to be readable. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable persistent WAL mode or 1 to enable persistent +** WAL mode. If the integer is -1, then it is overwritten with the current +** WAL persistence setting. +** +**
    • [[SQLITE_FCNTL_POWERSAFE_OVERWRITE]] +** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the +** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting +** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the +** xDeviceCharacteristics methods. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage +** mode. If the integer is -1, then it is overwritten with the current +** zero-damage mode setting. +** +**
    • [[SQLITE_FCNTL_OVERWRITE]] +** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening +** a write transaction to indicate that, unless it is rolled back for some +** reason, the entire database file will be overwritten by the current +** transaction. This is used by VACUUM operations. +** +**
    • [[SQLITE_FCNTL_VFSNAME]] +** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of +** all [VFSes] in the VFS stack. The names are of all VFS shims and the +** final bottom-level VFS are written into memory obtained from +** [sqlite3_malloc()] and the result is stored in the char* variable +** that the fourth parameter of [sqlite3_file_control()] points to. +** The caller is responsible for freeing the memory when done. As with +** all file-control actions, there is no guarantee that this will actually +** do anything. Callers should initialize the char* variable to a NULL +** pointer in case this file-control is not implemented. This file-control +** is intended for diagnostic use only. +** +**
    • [[SQLITE_FCNTL_VFS_POINTER]] +** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level +** [VFSes] currently in use. ^(The argument X in +** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be +** of type "[sqlite3_vfs] **". This opcodes will set *X +** to a pointer to the top-level VFS.)^ +** ^When there are multiple VFS shims in the stack, this opcode finds the +** upper-most shim only. +** +**
    • [[SQLITE_FCNTL_PRAGMA]] +** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] +** file control is sent to the open [sqlite3_file] object corresponding +** to the database file to which the pragma statement refers. ^The argument +** to the [SQLITE_FCNTL_PRAGMA] file control is an array of +** pointers to strings (char**) in which the second element of the array +** is the name of the pragma and the third element is the argument to the +** pragma or NULL if the pragma has no argument. ^The handler for an +** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element +** of the char** argument point to a string obtained from [sqlite3_mprintf()] +** or the equivalent and that string will become the result of the pragma or +** the error message if the pragma fails. ^If the +** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal +** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] +** file control returns [SQLITE_OK], then the parser assumes that the +** VFS has handled the PRAGMA itself and the parser generates a no-op +** prepared statement if result string is NULL, or that returns a copy +** of the result string if the string is non-NULL. +** ^If the [SQLITE_FCNTL_PRAGMA] file control returns +** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means +** that the VFS encountered an error while handling the [PRAGMA] and the +** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] +** file control occurs at the beginning of pragma statement analysis and so +** it is able to override built-in [PRAGMA] statements. +** +**
    • [[SQLITE_FCNTL_BUSYHANDLER]] +** ^The [SQLITE_FCNTL_BUSYHANDLER] +** file-control may be invoked by SQLite on the database file handle +** shortly after it is opened in order to provide a custom VFS with access +** to the connection's busy-handler callback. The argument is of type (void**) +** - an array of two (void *) values. The first (void *) actually points +** to a function of type (int (*)(void *)). In order to invoke the connection's +** busy-handler, this function should be invoked with the second (void *) in +** the array as the only argument. If it returns non-zero, then the operation +** should be retried. If it returns zero, the custom VFS should abandon the +** current operation. +** +**
    • [[SQLITE_FCNTL_TEMPFILENAME]] +** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control +** to have SQLite generate a +** temporary filename using the same algorithm that is followed to generate +** temporary filenames for TEMP tables and other internal uses. The +** argument should be a char** which will be filled with the filename +** written into memory obtained from [sqlite3_malloc()]. The caller should +** invoke [sqlite3_free()] on the result to avoid a memory leak. +** +**
    • [[SQLITE_FCNTL_MMAP_SIZE]] +** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the +** maximum number of bytes that will be used for memory-mapped I/O. +** The argument is a pointer to a value of type sqlite3_int64 that +** is an advisory maximum number of bytes in the file to memory map. The +** pointer is overwritten with the old value. The limit is not changed if +** the value originally pointed to is negative, and so the current limit +** can be queried by passing in a pointer to a negative number. This +** file-control is used internally to implement [PRAGMA mmap_size]. +** +**
    • [[SQLITE_FCNTL_TRACE]] +** The [SQLITE_FCNTL_TRACE] file control provides advisory information +** to the VFS about what the higher layers of the SQLite stack are doing. +** This file control is used by some VFS activity tracing [shims]. +** The argument is a zero-terminated string. Higher layers in the +** SQLite stack may generate instances of this file control if +** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled. +** +**
    • [[SQLITE_FCNTL_HAS_MOVED]] +** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a +** pointer to an integer and it writes a boolean into that integer depending +** on whether or not the file has been renamed, moved, or deleted since it +** was first opened. +** +**
    • [[SQLITE_FCNTL_WIN32_GET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the +** underlying native file handle associated with a file handle. This file +** control interprets its argument as a pointer to a native file handle and +** writes the resulting value there. +** +**
    • [[SQLITE_FCNTL_WIN32_SET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This +** opcode causes the xFileControl method to swap the file handle with the one +** pointed to by the pArg argument. This capability is used during testing +** and only needs to be supported when SQLITE_TEST is defined. +** +**
    • [[SQLITE_FCNTL_WAL_BLOCK]] +** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might +** be advantageous to block on the next WAL lock if the lock is not immediately +** available. The WAL subsystem issues this signal during rare +** circumstances in order to fix a problem with priority inversion. +** Applications should not use this file-control. +** +**
    • [[SQLITE_FCNTL_ZIPVFS]] +** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other +** VFS should return SQLITE_NOTFOUND for this opcode. +** +**
    • [[SQLITE_FCNTL_RBU]] +** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by +** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for +** this opcode. +** +**
    • [[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]] +** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then +** the file descriptor is placed in "batch write mode", which +** means all subsequent write operations will be deferred and done +** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems +** that do not support batch atomic writes will return SQLITE_NOTFOUND. +** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to +** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or +** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make +** no VFS interface calls on the same [sqlite3_file] file descriptor +** except for calls to the xWrite method and the xFileControl method +** with [SQLITE_FCNTL_SIZE_HINT]. +** +**
    • [[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically. +** This file control returns [SQLITE_OK] if and only if the writes were +** all performed successfully and have been committed to persistent storage. +** ^Regardless of whether or not it is successful, this file control takes +** the file descriptor out of batch write mode so that all subsequent +** write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
    • [[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back. +** ^This file control takes the file descriptor out of batch write mode +** so that all subsequent write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
    • [[SQLITE_FCNTL_LOCK_TIMEOUT]] +** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS +** to block for up to M milliseconds before failing when attempting to +** obtain a file lock using the xLock or xShmLock methods of the VFS. +** The parameter is a pointer to a 32-bit signed integer that contains +** the value that M is to be set to. Before returning, the 32-bit signed +** integer is overwritten with the previous value of M. +** +**
    • [[SQLITE_FCNTL_DATA_VERSION]] +** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to +** a database file. The argument is a pointer to a 32-bit unsigned integer. +** The "data version" for the pager is written into the pointer. The +** "data version" changes whenever any change occurs to the corresponding +** database file, either through SQL statements on the same database +** connection or through transactions committed by separate database +** connections possibly in other processes. The [sqlite3_total_changes()] +** interface can be used to find if any database on the connection has changed, +** but that interface responds to changes on TEMP as well as MAIN and does +** not provide a mechanism to detect changes to MAIN only. Also, the +** [sqlite3_total_changes()] interface responds to internal changes only and +** omits changes made by other database connections. The +** [PRAGMA data_version] command provides a mechanism to detect changes to +** a single attached database that occur due to other database connections, +** but omits changes implemented by the database connection on which it is +** called. This file control is the only mechanism to detect changes that +** happen either internally or externally and that are associated with +** a particular attached database. +** +**
    • [[SQLITE_FCNTL_CKPT_START]] +** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint +** in wal mode before the client starts to copy pages from the wal +** file to the database file. +** +**
    • [[SQLITE_FCNTL_CKPT_DONE]] +** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint +** in wal mode after the client has finished copying pages from the wal +** file to the database file, but before the *-shm file is updated to +** record the fact that the pages have been checkpointed. +** +**
    • [[SQLITE_FCNTL_EXTERNAL_READER]] +** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect +** whether or not there is a database client in another process with a wal-mode +** transaction open on the database or not. It is only available on unix.The +** (void*) argument passed with this file-control should be a pointer to a +** value of type (int). The integer value is set to 1 if the database is a wal +** mode database and there exists at least one client in another process that +** currently has an SQL transaction open on the database. It is set to 0 if +** the database is not a wal-mode db, or if there is no such connection in any +** other process. This opcode cannot be used to detect transactions opened +** by clients within the current process, only within other processes. +** +**
    • [[SQLITE_FCNTL_CKSM_FILE]] +** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the +** [checksum VFS shim] only. +** +**
    • [[SQLITE_FCNTL_RESET_CACHE]] +** If there is currently no transaction open on the database, and the +** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control +** purges the contents of the in-memory page cache. If there is an open +** transaction, or if the db is a temp-db, this opcode is a no-op, not an error. +**
    + */ + +/* deprecated names */ + +// C documentation +// +// /* +// ** CAPI3REF: Mutex Handle +// ** +// ** The mutex module within SQLite defines [sqlite3_mutex] to be an +// ** abstract type for a mutex object. The SQLite core never looks +// ** at the internal representation of an [sqlite3_mutex]. It only +// ** deals with pointers to the [sqlite3_mutex] object. +// ** +// ** Mutexes are created using [sqlite3_mutex_alloc()]. +// */ +type Tsqlite3_mutex = struct { + Fmutex Tpthread_mutex_t +} + +type sqlite3_mutex = Tsqlite3_mutex + // C documentation // // /* @@ -7041,264 +7178,28 @@ type Tsize_t = uint64 type size_t = Tsize_t -type t__u_char = uint8 - -type t__u_short = uint16 - -type t__u_int = uint32 - -type t__u_long = uint64 - -type t__int8_t = int8 - -type t__uint8_t = uint8 - -type t__int16_t = int16 - -type t__uint16_t = uint16 - -type t__int32_t = int32 - -type t__uint32_t = uint32 - -type t__int64_t = int64 - -type t__uint64_t = uint64 - -type t__int_least8_t = int8 - -type t__uint_least8_t = uint8 - -type t__int_least16_t = int16 - -type t__uint_least16_t = uint16 - -type t__int_least32_t = int32 - -type t__uint_least32_t = uint32 - -type t__int_least64_t = int64 - -type t__uint_least64_t = uint64 - -type t__quad_t = int64 - -type t__u_quad_t = uint64 - -type t__intmax_t = int64 - -type t__uintmax_t = uint64 - -type t__dev_t = uint64 - -type t__uid_t = uint32 - -type t__gid_t = uint32 - -type t__ino_t = uint64 - -type t__ino64_t = uint64 - -type t__mode_t = uint32 - -type t__nlink_t = uint64 - -type t__off_t = int64 - -type t__off64_t = int64 - -type t__pid_t = int32 - -type t__fsid_t = struct { - F__val [2]int32 -} - -type t__clock_t = int64 - -type t__rlim_t = uint64 - -type t__rlim64_t = uint64 - -type t__id_t = uint32 - -type t__time_t = int64 - -type t__useconds_t = uint32 - -type t__suseconds_t = int64 - -type t__suseconds64_t = int64 - -type t__daddr_t = int32 - -type t__key_t = int32 - -type t__clockid_t = int32 - -type t__timer_t = uintptr - -type t__blksize_t = int64 - -type t__blkcnt_t = int64 - -type t__blkcnt64_t = int64 - -type t__fsblkcnt_t = uint64 - -type t__fsblkcnt64_t = uint64 - -type t__fsfilcnt_t = uint64 - -type t__fsfilcnt64_t = uint64 - -type t__fsword_t = int64 - -type t__ssize_t = int64 - -type t__syscall_slong_t = int64 - -type t__syscall_ulong_t = uint64 - -type t__loff_t = int64 - -type t__caddr_t = uintptr +type Tssize_t = int64 -type t__intptr_t = int64 +type ssize_t = Tssize_t -type t__socklen_t = uint32 +type Toff_t = int64 -type t__sig_atomic_t = int32 +type off_t = Toff_t -type t__mbstate_t = struct { - F__count int32 - F__value struct { - F__wchb [0][4]int8 - F__wch uint32 - } -} +type t__isoc_va_list = uintptr -type t__fpos_t = struct { - F__pos t__off_t - F__state t__mbstate_t +type Tfpos_t = struct { + F__lldata [0]int64 + F__align [0]float64 + F__opaque [16]int8 } -type T_G_fpos_t = t__fpos_t - -type _G_fpos_t = T_G_fpos_t - -type t__fpos64_t = struct { - F__pos t__off64_t - F__state t__mbstate_t -} +type fpos_t = Tfpos_t -type T_G_fpos64_t = t__fpos64_t +type T_G_fpos64_t = Tfpos_t type _G_fpos64_t = T_G_fpos64_t -type T_IO_FILE = struct { - F_flags int32 - F_IO_read_ptr uintptr - F_IO_read_end uintptr - F_IO_read_base uintptr - F_IO_write_base uintptr - F_IO_write_ptr uintptr - F_IO_write_end uintptr - F_IO_buf_base uintptr - F_IO_buf_end uintptr - F_IO_save_base uintptr - F_IO_backup_base uintptr - F_IO_save_end uintptr - F_markers uintptr - F_chain uintptr - F_fileno int32 - F_flags2 int32 - F_old_offset t__off_t - F_cur_column uint16 - F_vtable_offset int8 - F_shortbuf [1]int8 - F_lock uintptr - F_offset t__off64_t - F_codecvt uintptr - F_wide_data uintptr - F_freeres_list uintptr - F_freeres_buf uintptr - F__pad5 Tsize_t - F_mode int32 - F_unused2 [20]int8 -} - -type _IO_FILE = T_IO_FILE - -type t__FILE = struct { - F_flags int32 - F_IO_read_ptr uintptr - F_IO_read_end uintptr - F_IO_read_base uintptr - F_IO_write_base uintptr - F_IO_write_ptr uintptr - F_IO_write_end uintptr - F_IO_buf_base uintptr - F_IO_buf_end uintptr - F_IO_save_base uintptr - F_IO_backup_base uintptr - F_IO_save_end uintptr - F_markers uintptr - F_chain uintptr - F_fileno int32 - F_flags2 int32 - F_old_offset t__off_t - F_cur_column uint16 - F_vtable_offset int8 - F_shortbuf [1]int8 - F_lock uintptr - F_offset t__off64_t - F_codecvt uintptr - F_wide_data uintptr - F_freeres_list uintptr - F_freeres_buf uintptr - F__pad5 Tsize_t - F_mode int32 - F_unused2 [20]int8 -} - -type TFILE = struct { - F_flags int32 - F_IO_read_ptr uintptr - F_IO_read_end uintptr - F_IO_read_base uintptr - F_IO_write_base uintptr - F_IO_write_ptr uintptr - F_IO_write_end uintptr - F_IO_buf_base uintptr - F_IO_buf_end uintptr - F_IO_save_base uintptr - F_IO_backup_base uintptr - F_IO_save_end uintptr - F_markers uintptr - F_chain uintptr - F_fileno int32 - F_flags2 int32 - F_old_offset t__off_t - F_cur_column uint16 - F_vtable_offset int8 - F_shortbuf [1]int8 - F_lock uintptr - F_offset t__off64_t - F_codecvt uintptr - F_wide_data uintptr - F_freeres_list uintptr - F_freeres_buf uintptr - F__pad5 Tsize_t - F_mode int32 - F_unused2 [20]int8 -} - -type FILE = TFILE - -type T_IO_lock_t = struct{} - -type _IO_lock_t = T_IO_lock_t - type Tcookie_io_functions_t = struct { Fread uintptr Fwrite uintptr @@ -7312,32 +7213,6 @@ type T_IO_cookie_io_functions_t = Tcookie_io_functions_t type _IO_cookie_io_functions_t = T_IO_cookie_io_functions_t -type Toff_t = int64 - -type off_t = Toff_t - -type Toff64_t = int64 - -type off64_t = Toff64_t - -type Tssize_t = int64 - -type ssize_t = Tssize_t - -type Tfpos_t = struct { - F__pos t__off64_t - F__state t__mbstate_t -} - -type fpos_t = Tfpos_t - -type Tfpos64_t = struct { - F__pos t__off64_t - F__state t__mbstate_t -} - -type fpos64_t = Tfpos64_t - type Twchar_t = int32 type wchar_t = Twchar_t @@ -7363,433 +7238,21 @@ type Tlldiv_t = struct { type lldiv_t = Tlldiv_t -type t__locale_struct = struct { - F__locales [13]uintptr - F__ctype_b uintptr - F__ctype_tolower uintptr - F__ctype_toupper uintptr - F__names [13]uintptr -} - -type t__locale_t = uintptr - type Tlocale_t = uintptr type locale_t = Tlocale_t -type Tu_char = uint8 - -type u_char = Tu_char - -type Tu_short = uint16 - -type u_short = Tu_short - -type Tu_int = uint32 - -type u_int = Tu_int - -type Tu_long = uint64 - -type u_long = Tu_long - -type Tquad_t = int64 - -type quad_t = Tquad_t - -type Tu_quad_t = uint64 - -type u_quad_t = Tu_quad_t - -type Tfsid_t = struct { - F__val [2]int32 -} - -type fsid_t = Tfsid_t - -type Tloff_t = int64 - -type loff_t = Tloff_t - -type Tino_t = uint64 - -type ino_t = Tino_t - -type Tino64_t = uint64 - -type ino64_t = Tino64_t - -type Tdev_t = uint64 - -type dev_t = Tdev_t - -type Tgid_t = uint32 - -type gid_t = Tgid_t - -type Tmode_t = uint32 - -type mode_t = Tmode_t - -type Tnlink_t = uint64 - -type nlink_t = Tnlink_t - -type Tuid_t = uint32 - -type uid_t = Tuid_t - -type Tpid_t = int32 - -type pid_t = Tpid_t - -type Tid_t = uint32 - -type id_t = Tid_t - -type Tdaddr_t = int32 - -type daddr_t = Tdaddr_t - -type Tcaddr_t = uintptr - -type caddr_t = Tcaddr_t - -type Tkey_t = int32 - -type key_t = Tkey_t - -type Tclock_t = int64 - -type clock_t = Tclock_t - -type Tclockid_t = int32 - -type clockid_t = Tclockid_t - -type Ttime_t = int64 - -type time_t = Ttime_t - -type Ttimer_t = uintptr - -type timer_t = Ttimer_t - -type Tuseconds_t = uint32 - -type useconds_t = Tuseconds_t - -type Tsuseconds_t = int64 - -type suseconds_t = Tsuseconds_t - -type Tulong = uint64 - -type ulong = Tulong - -type Tushort = uint16 - -type ushort = Tushort - -type Tuint = uint32 - -type uint = Tuint - -type Tint8_t = int8 - -type int8_t = Tint8_t - -type Tint16_t = int16 - -type int16_t = Tint16_t - -type Tint32_t = int32 - -type int32_t = Tint32_t - -type Tint64_t = int64 - -type int64_t = Tint64_t - -type Tu_int8_t = uint8 - -type u_int8_t = Tu_int8_t - -type Tu_int16_t = uint16 - -type u_int16_t = Tu_int16_t - -type Tu_int32_t = uint32 - -type u_int32_t = Tu_int32_t - -type Tu_int64_t = uint64 - -type u_int64_t = Tu_int64_t - -type Tregister_t = int32 - -type register_t = Tregister_t - -type t__sigset_t = struct { - F__val [16]uint64 -} - -type Tsigset_t = struct { - F__val [16]uint64 -} - -type sigset_t = Tsigset_t - -type Ttimeval = struct { - Ftv_sec t__time_t - Ftv_usec t__suseconds_t -} - -type timeval = Ttimeval - -type Ttimespec = struct { - Ftv_sec t__time_t - Ftv_nsec t__syscall_slong_t -} - -type timespec = Ttimespec - -type t__fd_mask = int64 - -type Tfd_set = struct { - Ffds_bits [16]t__fd_mask -} - -type fd_set = Tfd_set - -type Tfd_mask = int64 - -type fd_mask = Tfd_mask - -type Tblksize_t = int64 - -type blksize_t = Tblksize_t - -type Tblkcnt_t = int64 - -type blkcnt_t = Tblkcnt_t - -type Tfsblkcnt_t = uint64 - -type fsblkcnt_t = Tfsblkcnt_t - -type Tfsfilcnt_t = uint64 - -type fsfilcnt_t = Tfsfilcnt_t - -type Tblkcnt64_t = int64 - -type blkcnt64_t = Tblkcnt64_t - -type Tfsblkcnt64_t = uint64 - -type fsblkcnt64_t = Tfsblkcnt64_t - -type Tfsfilcnt64_t = uint64 - -type fsfilcnt64_t = Tfsfilcnt64_t - -type t__atomic_wide_counter = struct { - F__value32 [0]struct { - F__low uint32 - F__high uint32 - } - F__value64 uint64 -} - -type t__pthread_list_t = struct { - F__prev uintptr - F__next uintptr -} - -type t__pthread_internal_list = t__pthread_list_t - -type t__pthread_slist_t = struct { - F__next uintptr -} - -type t__pthread_internal_slist = t__pthread_slist_t - -type t__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list t__pthread_list_t -} - -type t__pthread_rwlock_arch_t = struct { - F__readers uint32 - F__writers uint32 - F__wrphase_futex uint32 - F__writers_futex uint32 - F__pad3 uint32 - F__pad4 uint32 - F__cur_writer int32 - F__shared int32 - F__rwelision int8 - F__pad1 [7]uint8 - F__pad2 uint64 - F__flags uint32 -} - -type t__pthread_cond_s = struct { - F__wseq t__atomic_wide_counter - F__g1_start t__atomic_wide_counter - F__g_refs [2]uint32 - F__g_size [2]uint32 - F__g1_orig_size uint32 - F__wrefs uint32 - F__g_signals [2]uint32 -} - -type t__tss_t = uint32 - -type t__thrd_t = uint64 - -type t__once_flag = struct { - F__data int32 -} - -type Tpthread_t = uint64 - -type pthread_t = Tpthread_t - -type Tpthread_mutexattr_t = struct { - F__align [0]int32 - F__size [4]int8 -} - -type pthread_mutexattr_t = Tpthread_mutexattr_t - -type Tpthread_condattr_t = struct { - F__align [0]int32 - F__size [4]int8 -} - -type pthread_condattr_t = Tpthread_condattr_t - -type Tpthread_key_t = uint32 - -type pthread_key_t = Tpthread_key_t - -type Tpthread_once_t = int32 - -type pthread_once_t = Tpthread_once_t - -type Tpthread_attr_t1 = struct { - F__align [0]int64 - F__size [56]int8 -} - -type pthread_attr_t1 = Tpthread_attr_t1 - -type Tpthread_attr_t = struct { - F__align [0]int64 - F__size [56]int8 -} - -type pthread_attr_t = Tpthread_attr_t - -type Tpthread_mutex_t = struct { - F__size [0][40]int8 - F__align [0]int64 - F__data t__pthread_mutex_s -} - -type pthread_mutex_t = Tpthread_mutex_t - -type Tpthread_cond_t = struct { - F__size [0][48]int8 - F__align [0]int64 - F__data t__pthread_cond_s -} - -type pthread_cond_t = Tpthread_cond_t - -type Tpthread_rwlock_t = struct { - F__size [0][56]int8 - F__align [0]int64 - F__data t__pthread_rwlock_arch_t -} - -type pthread_rwlock_t = Tpthread_rwlock_t - -type Tpthread_rwlockattr_t = struct { - F__align [0]int64 - F__size [8]int8 -} - -type pthread_rwlockattr_t = Tpthread_rwlockattr_t - -type Tpthread_spinlock_t = int32 - -type pthread_spinlock_t = Tpthread_spinlock_t - -type Tpthread_barrier_t = struct { - F__align [0]int64 - F__size [32]int8 -} - -type pthread_barrier_t = Tpthread_barrier_t - -type Tpthread_barrierattr_t = struct { - F__align [0]int32 - F__size [4]int8 -} - -type pthread_barrierattr_t = Tpthread_barrierattr_t - -type Trandom_data = struct { - Ffptr uintptr - Frptr uintptr - Fstate uintptr - Frand_type int32 - Frand_deg int32 - Frand_sep int32 - Fend_ptr uintptr -} - -type random_data = Trandom_data - -type Tdrand48_data = struct { - F__x [3]uint16 - F__old_x [3]uint16 - F__c uint16 - F__init uint16 - F__a uint64 +type Tmax_align_t = struct { + F__ll int64 + F__ld float64 } -type drand48_data = Tdrand48_data - -type t__compar_fn_t = uintptr - -type Tcomparison_fn_t = uintptr - -type comparison_fn_t = Tcomparison_fn_t - -type t__compar_d_fn_t = uintptr +type max_align_t = Tmax_align_t type Tptrdiff_t = int64 type ptrdiff_t = Tptrdiff_t -type Tmax_align_t = struct { - F__max_align_ll int64 - F__max_align_ld float64 -} - -type max_align_t = Tmax_align_t - /* ** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY. ** This allows better measurements of where memcpy() is used when running @@ -8677,9 +8140,11 @@ type TSelect = struct { type Select = TSelect type TSQLiteThread = struct { - FxTask uintptr - FpIn uintptr - FpResult uintptr + Ftid Tpthread_t + Fdone int32 + FpOut uintptr + FxTask uintptr + FpIn uintptr } type SQLiteThread = TSQLiteThread @@ -8877,6 +8342,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -10440,6 +9906,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -11145,6 +10615,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -12115,10 +11586,10 @@ var _sqlite3azCompileOpt = [54]uintptr{ 47: __ccgo_ts + 1021, 48: __ccgo_ts + 1043, 49: __ccgo_ts + 1064, - 50: __ccgo_ts + 1075, - 51: __ccgo_ts + 1083, - 52: __ccgo_ts + 1097, - 53: __ccgo_ts + 1110, + 50: __ccgo_ts + 1079, + 51: __ccgo_ts + 1087, + 52: __ccgo_ts + 1101, + 53: __ccgo_ts + 1114, } func _sqlite3CompileOptions(tls *libc.TLS, pnOpt uintptr) (r uintptr) { @@ -12949,12 +12420,12 @@ var _sqlite3StdTypeAffinity = [6]int8{ } var _sqlite3StdType = [6]uintptr{ - 0: __ccgo_ts + 1123, - 1: __ccgo_ts + 1127, - 2: __ccgo_ts + 1132, - 3: __ccgo_ts + 1136, - 4: __ccgo_ts + 1144, - 5: __ccgo_ts + 1149, + 0: __ccgo_ts + 1127, + 1: __ccgo_ts + 1131, + 2: __ccgo_ts + 1136, + 3: __ccgo_ts + 1140, + 4: __ccgo_ts + 1148, + 5: __ccgo_ts + 1153, } /************** End of global.c **********************************************/ @@ -13628,9 +13099,6 @@ var _statMutex = [10]int8{ // ** be holding the appropriate mutex. // */ func _sqlite3StatusValue(tls *libc.TLS, op int32) (r Tsqlite3_int64) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) } @@ -13648,9 +13116,6 @@ func _sqlite3StatusValue(tls *libc.TLS, op int32) (r Tsqlite3_int64) { // ** mark is unchanged. N must be non-negative for StatusDown(). // */ func _sqlite3StatusUp(tls *libc.TLS, op int32, N int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) += int64(N) if *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) > *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) { *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) = *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) @@ -13658,10 +13123,6 @@ func _sqlite3StatusUp(tls *libc.TLS, op int32, N int32) { } func _sqlite3StatusDown(tls *libc.TLS, op int32, N int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) -= int64(N) } @@ -13674,12 +13135,7 @@ func _sqlite3StatusDown(tls *libc.TLS, op int32, N int32) { func _sqlite3StatusHighwater(tls *libc.TLS, op int32, X int32) { var newValue Tsqlite3StatValueType _ = newValue - _ = libc.Int32FromInt32(0) newValue = int64(X) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if newValue > *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) { *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) = newValue } @@ -13694,7 +13150,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13808,8 +13264,6 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p case int32(SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE): fallthrough case int32(SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pCurrent)) = 0 *(*int32)(unsafe.Pointer(pHighwater)) = int32(*(*Tu32)(unsafe.Pointer(db + 440 + 16 + uintptr(op-int32(SQLITE_DBSTATUS_LOOKASIDE_HIT))*4))) if resetFlag != 0 { @@ -13843,6 +13297,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13855,11 +13310,10 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart i1 = 0 for { @@ -13881,6 +13335,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -13891,11 +13346,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -13910,10 +13367,9 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart pVdbe = (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe for { @@ -13923,6 +13379,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -13945,8 +13402,6 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p fallthrough case int32(SQLITE_DBSTATUS_CACHE_WRITE): *(*Tu64)(unsafe.Pointer(bp + 8)) = uint64(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i2 = 0 for { if !(i2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -13958,6 +13413,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -13980,41 +13436,32 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p return rc } -type Ttimex = struct { - Fmodes uint32 - Foffset t__syscall_slong_t - Ffreq t__syscall_slong_t - Fmaxerror t__syscall_slong_t - Festerror t__syscall_slong_t - Fstatus int32 - Fconstant t__syscall_slong_t - Fprecision t__syscall_slong_t - Ftolerance t__syscall_slong_t - Ftime Ttimeval - Ftick t__syscall_slong_t - Fppsfreq t__syscall_slong_t - Fjitter t__syscall_slong_t - Fshift int32 - Fstabil t__syscall_slong_t - Fjitcnt t__syscall_slong_t - Fcalcnt t__syscall_slong_t - Ferrcnt t__syscall_slong_t - Fstbcnt t__syscall_slong_t - Ftai int32 - F__ccgo164 uint32 - F__ccgo168 uint32 - F__ccgo172 uint32 - F__ccgo176 uint32 - F__ccgo180 uint32 - F__ccgo184 uint32 - F__ccgo188 uint32 - F__ccgo192 uint32 - F__ccgo196 uint32 - F__ccgo200 uint32 - F__ccgo204 uint32 -} - -type timex = Ttimex +type Ttime_t = int64 + +type time_t = Ttime_t + +type Ttimer_t = uintptr + +type timer_t = Ttimer_t + +type Tclockid_t = int32 + +type clockid_t = Tclockid_t + +type Tclock_t = int64 + +type clock_t = Tclock_t + +type Ttimespec = struct { + Ftv_sec Ttime_t + Ftv_nsec int64 +} + +type timespec = Ttimespec + +type Tpid_t = int32 + +type pid_t = Tpid_t type Ttm = struct { Ftm_sec int32 @@ -14133,7 +13580,6 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in N = int8(int32(*(*int8)(unsafe.Pointer(zFormat))) - int32('0')) min = int8(int32(*(*int8)(unsafe.Pointer(zFormat + 1))) - int32('0')) val = 0 - _ = libc.Int32FromInt32(0) max = _aMx[int32(*(*int8)(unsafe.Pointer(zFormat + 2)))-int32('a')] nextC = *(*int8)(unsafe.Pointer(zFormat + 3)) val = 0 @@ -14158,6 +13604,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -14219,12 +13666,13 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { } } zDate++ - if _getDigits(tls, zDate, __ccgo_ts+1154, libc.VaList(bp+16, bp, bp+4)) != int32(2) { + if _getDigits(tls, zDate, __ccgo_ts+1158, libc.VaList(bp+16, bp, bp+4)) != int32(2) { return int32(1) } zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { zDate++ } @@ -14251,13 +13699,13 @@ func _parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { var _ /* s at bp+8 */ int32 _, _, _ = ms, rScale, v1 ms = float64(0) - if _getDigits(tls, zDate, __ccgo_ts+1162, libc.VaList(bp+24, bp, bp+4)) != int32(2) { + if _getDigits(tls, zDate, __ccgo_ts+1166, libc.VaList(bp+24, bp, bp+4)) != int32(2) { return int32(1) } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == int32(':') { zDate++ - if _getDigits(tls, zDate, __ccgo_ts+1170, libc.VaList(bp+24, bp+8)) != int32(1) { + if _getDigits(tls, zDate, __ccgo_ts+1174, libc.VaList(bp+24, bp+8)) != int32(1) { return int32(1) } zDate += uintptr(2) @@ -14378,7 +13826,7 @@ func _parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { } else { neg = 0 } - if _getDigits(tls, zDate, __ccgo_ts+1174, libc.VaList(bp+24, bp, bp+4, bp+8)) != int32(3) { + if _getDigits(tls, zDate, __ccgo_ts+1178, libc.VaList(bp+24, bp, bp+4, bp+8)) != int32(3) { return int32(1) } zDate += uintptr(10) @@ -14473,14 +13921,14 @@ func _parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) if _parseHhMmSs(tls, zDate, p) == 0 { return 0 } else { - if _sqlite3StrICmp(tls, zDate, __ccgo_ts+1186) == 0 && _sqlite3NotPureFunc(tls, context) != 0 { + if _sqlite3StrICmp(tls, zDate, __ccgo_ts+1190) == 0 && _sqlite3NotPureFunc(tls, context) != 0 { return _setDateTimeToCurrent(tls, context, p) } else { if _sqlite3AtoF(tls, zDate, bp, _sqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { _setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp))) return 0 } else { - if (_sqlite3StrICmp(tls, zDate, __ccgo_ts+1190) == 0 || _sqlite3StrICmp(tls, zDate, __ccgo_ts+1197) == 0) && _sqlite3NotPureFunc(tls, context) != 0 { + if (_sqlite3StrICmp(tls, zDate, __ccgo_ts+1194) == 0 || _sqlite3StrICmp(tls, zDate, __ccgo_ts+1201) == 0) && _sqlite3NotPureFunc(tls, context) != 0 { (*TDateTime)(unsafe.Pointer(p)).FuseSubsec = int8(1) return _setDateTimeToCurrent(tls, context, p) } @@ -14684,7 +14132,7 @@ func _toLocaltime(tls *libc.TLS, p uintptr, pCtx uintptr) (r int32) { *(*Ttime_t)(unsafe.Pointer(bp)) = (*TDateTime)(unsafe.Pointer(p)).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) } if _osLocaltime(tls, bp, bp+8) != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+1207, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+1211, -int32(1)) return int32(SQLITE_ERROR) } (*TDateTime)(unsafe.Pointer(p)).FY = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_year + int32(1900) - iYearDiff @@ -14833,7 +14281,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, ** If rawS is available, then interpret as a julian day number, or ** a unix timestamp, depending on its magnitude. */ - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1230) == 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1234) == 0 { if idx > int32(1) { return int32(1) } /* IMP: R-33611-57934 */ @@ -14849,7 +14297,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, ** value in the allowed range of julian day numbers understood by ** SQLite (0..5373484.5) then the result will be NULL. */ - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1235) == 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1239) == 0 { if idx > int32(1) { return int32(1) } /* IMP: R-31176-64601 */ @@ -14864,7 +14312,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, ** Assuming the current time value is UTC (a.k.a. GMT), shift it to ** show local time. */ - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1245) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1249) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { rc = _toLocaltime(tls, p, pCtx) } case int32('u'): @@ -14874,7 +14322,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, ** Treat the current value of p->s as the number of ** seconds since 1970. Convert to a real julian day number. */ - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1255) == 0 && (*TDateTime)(unsafe.Pointer(p)).FrawS != 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1259) == 0 && (*TDateTime)(unsafe.Pointer(p)).FrawS != 0 { if idx > int32(1) { return int32(1) } /* IMP: R-49255-55373 */ @@ -14887,7 +14335,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, rc = 0 } } else { - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1265) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1269) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { if int32((*TDateTime)(unsafe.Pointer(p)).FtzSet) == 0 { /* Guess at the corresponding utc time */ cnt = 0 /* Guess is off by this much */ _computeJD(tls, p) @@ -14908,6 +14356,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -14925,7 +14374,14 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): - if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1269, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ + if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1273, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 } @@ -14955,8 +14411,8 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, ** Show subsecond precision in the output of datetime() and ** unixepoch() and strftime('%s'). */ - if Xsqlite3_strnicmp(tls, z, __ccgo_ts+1278, int32(9)) != 0 { - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1190) == 0 || Xsqlite3_stricmp(tls, z, __ccgo_ts+1197) == 0 { + if Xsqlite3_strnicmp(tls, z, __ccgo_ts+1282, int32(9)) != 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1194) == 0 || Xsqlite3_stricmp(tls, z, __ccgo_ts+1201) == 0 { (*TDateTime)(unsafe.Pointer(p)).FuseSubsec = int8(1) rc = 0 } @@ -14975,16 +14431,16 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1288) == 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1292) == 0 { (*TDateTime)(unsafe.Pointer(p)).FD = int32(1) rc = 0 } else { - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1294) == 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1298) == 0 { (*TDateTime)(unsafe.Pointer(p)).FM = int32(1) (*TDateTime)(unsafe.Pointer(p)).FD = int32(1) rc = 0 } else { - if Xsqlite3_stricmp(tls, z, __ccgo_ts+1299) == 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1303) == 0 { rc = 0 } } @@ -15026,19 +14482,19 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, break } if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('-') { - if n == int32(5) && _getDigits(tls, z+1, __ccgo_ts+1303, libc.VaList(bp+136, bp+56)) == int32(1) { + if n == int32(5) && _getDigits(tls, z+1, __ccgo_ts+1307, libc.VaList(bp+136, bp+56)) == int32(1) { break } - if n == int32(6) && _getDigits(tls, z+1, __ccgo_ts+1307, libc.VaList(bp+136, bp+56)) == int32(1) { + if n == int32(6) && _getDigits(tls, z+1, __ccgo_ts+1311, libc.VaList(bp+136, bp+56)) == int32(1) { break } } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { - _ = libc.Int32FromInt32(0) break } if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('-') { @@ -15050,12 +14506,11 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, break } /* Must start with +/- */ if n == int32(5) { - if _getDigits(tls, z+1, __ccgo_ts+1311, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { + if _getDigits(tls, z+1, __ccgo_ts+1315, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { break } } else { - _ = libc.Int32FromInt32(0) - if _getDigits(tls, z+1, __ccgo_ts+1323, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { + if _getDigits(tls, z+1, __ccgo_ts+1327, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { break } z++ @@ -15092,7 +14547,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, rc = 0 break } - if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + 11)))])&int32(0x01) != 0 && _getDigits(tls, z+12, __ccgo_ts+1162, libc.VaList(bp+136, bp+68, bp+72)) == int32(2) { + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + 11)))])&int32(0x01) != 0 && _getDigits(tls, z+12, __ccgo_ts+1166, libc.VaList(bp+136, bp+68, bp+72)) == int32(2) { z2 = z + 12 n = int32(2) } else { @@ -15134,7 +14589,6 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, n-- } _computeJD(tls, p) - _ = libc.Int32FromInt32(0) if *(*float64)(unsafe.Pointer(bp)) < libc.Float64FromInt32(0) { v10 = -libc.Float64FromFloat64(0.5) } else { @@ -15148,8 +14602,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): - _ = libc.Int32FromInt32(0) + case int32(4): /* Special processing to add months */ _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { @@ -15162,9 +14615,8 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) - _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 8)) += y (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 @@ -15178,6 +14630,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -15231,6 +14684,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -15240,7 +14694,6 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr if argc == int32(1) && (*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0 && (*TDateTime)(unsafe.Pointer(p)).FD > int32(28) { /* Make sure a YYYY-MM-DD is normalized. ** Example: 2023-02-31 -> 2023-03-03 */ - _ = libc.Int32FromInt32(0) (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 } return 0 @@ -15498,13 +14951,13 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { - v3 = __ccgo_ts + 1335 + v3 = __ccgo_ts + 1339 } else { - v3 = __ccgo_ts + 1340 + v3 = __ccgo_ts + 1344 } Xsqlite3_str_appendf(tls, bp+48, v3, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FD)) case int32('f'): @@ -15512,19 +14965,19 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if s > float64(59.999) { s = float64(59.999) } - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1344, libc.VaList(bp+136, s)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1348, libc.VaList(bp+136, s)) case int32('F'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1351, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY, (*(*TDateTime)(unsafe.Pointer(bp))).FM, (*(*TDateTime)(unsafe.Pointer(bp))).FD)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1355, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY, (*(*TDateTime)(unsafe.Pointer(bp))).FM, (*(*TDateTime)(unsafe.Pointer(bp))).FD)) case int32('H'): fallthrough case int32('k'): if int32(cf) == int32('H') { - v4 = __ccgo_ts + 1335 + v4 = __ccgo_ts + 1339 } else { - v4 = __ccgo_ts + 1340 + v4 = __ccgo_ts + 1344 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -15535,14 +14988,14 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { h = int32(12) } if int32(cf) == int32('I') { - v5 = __ccgo_ts + 1335 + v5 = __ccgo_ts + 1339 } else { - v5 = __ccgo_ts + 1340 + v5 = __ccgo_ts + 1344 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = 0 (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -15551,48 +15004,48 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { nDay = int32(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD - (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000)) if int32(cf) == int32('W') { /* 0=Monday, 1=Tuesday, ... 6=Sunday */ wd = int32(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000) % libc.Int64FromInt32(7)) - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, (nDay+int32(7)-wd)/int32(7))) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1339, libc.VaList(bp+136, (nDay+int32(7)-wd)/int32(7))) } else { - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1366, libc.VaList(bp+136, nDay+int32(1))) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1370, libc.VaList(bp+136, nDay+int32(1))) } case int32('J'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1371, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD)/float64(8.64e+07))) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1375, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD)/float64(8.64e+07))) case int32('m'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1339, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1339, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { if int32(cf) == int32('p') { - v6 = __ccgo_ts + 1377 + v6 = __ccgo_ts + 1381 } else { - v6 = __ccgo_ts + 1380 + v6 = __ccgo_ts + 1384 } Xsqlite3_str_append(tls, bp+48, v6, int32(2)) } else { if int32(cf) == int32('p') { - v7 = __ccgo_ts + 1383 + v7 = __ccgo_ts + 1387 } else { - v7 = __ccgo_ts + 1386 + v7 = __ccgo_ts + 1390 } Xsqlite3_str_append(tls, bp+48, v7, int32(2)) } case int32('R'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1389, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1393, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) case int32('s'): if (*(*TDateTime)(unsafe.Pointer(bp))).FuseSubsec != 0 { - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1399, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000000))/float64(1000))) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1403, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000000))/float64(1000))) } else { iS = (*(*TDateTime)(unsafe.Pointer(bp))).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1404, libc.VaList(bp+136, iS)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1408, libc.VaList(bp+136, iS)) } case int32('S'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1339, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1409, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1413, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -15601,7 +15054,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_str_appendchar(tls, bp+48, int32(1), c) case int32('Y'): - Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1424, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1428, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY)) case int32('%'): Xsqlite3_str_appendchar(tls, bp+48, int32(1), int8('%')) default: @@ -15610,6 +15063,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -15758,7 +15212,7 @@ func _timediffFunc(tls *libc.TLS, context uintptr, NotUsed1 int32, argv uintptr) (*(*TDateTime)(unsafe.Pointer(bp))).FvalidTZ = 0 _computeYMD_HMS(tls, bp) _sqlite3StrAccumInit(tls, bp+96, uintptr(0), uintptr(0), 0, int32(100)) - Xsqlite3_str_appendf(tls, bp+96, __ccgo_ts+1429, libc.VaList(bp+136, int32(sign), Y, M, (*(*TDateTime)(unsafe.Pointer(bp))).FD-int32(1), (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, (*(*TDateTime)(unsafe.Pointer(bp))).Fs)) + Xsqlite3_str_appendf(tls, bp+96, __ccgo_ts+1433, libc.VaList(bp+136, int32(sign), Y, M, (*(*TDateTime)(unsafe.Pointer(bp))).FD-int32(1), (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, (*(*TDateTime)(unsafe.Pointer(bp))).Fs)) _sqlite3ResultStrAccum(tls, context, bp+96) } @@ -15791,55 +15245,55 @@ var _aDateTimeFuncs = [10]TFuncDef{ FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1235, + FzName: __ccgo_ts + 1239, }, 1: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1255, + FzName: __ccgo_ts + 1259, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1463, + FzName: __ccgo_ts + 1467, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1468, + FzName: __ccgo_ts + 1472, }, 4: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1473, + FzName: __ccgo_ts + 1477, }, 5: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1482, + FzName: __ccgo_ts + 1486, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), - FzName: __ccgo_ts + 1491, + FzName: __ccgo_ts + 1495, }, 7: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 1500, + FzName: __ccgo_ts + 1504, }, 8: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 1513, + FzName: __ccgo_ts + 1517, }, 9: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 1531, + FzName: __ccgo_ts + 1535, }, } @@ -15954,12 +15408,10 @@ func _sqlite3OsFileSize(tls *libc.TLS, id uintptr, pSize uintptr) (r int32) { } func _sqlite3OsLock(tls *libc.TLS, id uintptr, lockType int32) (r int32) { - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxLock})))(tls, id, lockType) } func _sqlite3OsUnlock(tls *libc.TLS, id uintptr, lockType int32) (r int32) { - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxUnlock})))(tls, id, lockType) } @@ -16050,16 +15502,13 @@ func _sqlite3OsOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, f ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example, ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before ** reaching the VFS. */ - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS, uintptr, Tsqlite3_filename, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen})))(tls, pVfs, zPath, pFile, flags&int32(0x1087f7f), pFlagsOut) - _ = libc.Int32FromInt32(0) return rc } func _sqlite3OsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) (r int32) { var v1 int32 _ = v1 - _ = libc.Int32FromInt32(0) if (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDelete != uintptr(0) { v1 = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDelete})))(tls, pVfs, zPath, dirSync) } else { @@ -16078,8 +15527,7 @@ func _sqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut } func _sqlite3OsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* tag-20210611-1 */ + /* tag-20210611-1 */ return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDlOpen})))(tls, pVfs, zPath) } @@ -16162,12 +15610,10 @@ func _sqlite3OsOpenMalloc(tls *libc.TLS, pVfs uintptr, zFile uintptr, ppFile uin *(*uintptr)(unsafe.Pointer(ppFile)) = uintptr(0) rc = int32(SQLITE_NOMEM) } - _ = libc.Int32FromInt32(0) return rc } func _sqlite3OsCloseFree(tls *libc.TLS, pFile uintptr) { - _ = libc.Int32FromInt32(0) _sqlite3OsClose(tls, pFile) Xsqlite3_free(tls, pFile) } @@ -16228,6 +15674,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -16242,7 +15689,6 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { func _vfsUnlink(tls *libc.TLS, pVfs uintptr) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) if pVfs == uintptr(0) { /* No-op */ } else { @@ -16287,7 +15733,6 @@ func Xsqlite3_vfs_register(tls *libc.TLS, pVfs uintptr, makeDflt int32) (r int32 (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext = (*Tsqlite3_vfs)(unsafe.Pointer(_vfsList)).FpNext (*Tsqlite3_vfs)(unsafe.Pointer(_vfsList)).FpNext = pVfs } - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, mutex) return SQLITE_OK } @@ -16514,13 +15959,12 @@ func _sqlite3MemMalloc(tls *libc.TLS, nByte int32) (r uintptr) { defer tls.Free(16) var p uintptr _ = p - _ = libc.Int32FromInt32(0) p = libc.Xmalloc(tls, uint64(nByte+int32(8))) if p != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(p)) = int64(nByte) p += 8 } else { - Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1544, libc.VaList(bp+8, nByte)) + Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1548, libc.VaList(bp+8, nByte)) } return p } @@ -16539,7 +15983,6 @@ func _sqlite3MemFree(tls *libc.TLS, pPrior uintptr) { var p uintptr _ = p p = pPrior - _ = libc.Int32FromInt32(0) p -= 8 libc.Xfree(tls, p) } @@ -16553,7 +15996,6 @@ func _sqlite3MemFree(tls *libc.TLS, pPrior uintptr) { func _sqlite3MemSize(tls *libc.TLS, pPrior uintptr) (r int32) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) p = pPrior p -= 8 return int32(*(*Tsqlite3_int64)(unsafe.Pointer(p))) @@ -16577,15 +16019,14 @@ func _sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) (r uintptr) var p uintptr _ = p p = pPrior - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* EV: R-46199-30249 */ + /* EV: R-46199-30249 */ p -= 8 p = libc.Xrealloc(tls, p, uint64(nByte+libc.Int32FromInt32(8))) if p != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(p)) = int64(nByte) p += 8 } else { - Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1582, libc.VaList(bp+8, _sqlite3MemSize(tls, pPrior), nByte)) + Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1586, libc.VaList(bp+8, _sqlite3MemSize(tls, pPrior), nByte)) } return p } @@ -16816,10 +16257,11 @@ func _sqlite3MutexInit(tls *libc.TLS) (r int32) { (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexLeave = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexLeave (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexHeld = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexHeld (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexNotheld = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexNotheld + _sqlite3MemoryBarrier(tls) (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexAlloc = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexAlloc } - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexInit})))(tls) + _sqlite3MemoryBarrier(tls) return rc } @@ -16851,7 +16293,6 @@ func Xsqlite3_mutex_alloc(tls *libc.TLS, id int32) (r uintptr) { if id > int32(SQLITE_MUTEX_RECURSIVE) && _sqlite3MutexInit(tls) != 0 { return uintptr(0) } - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexAlloc})))(tls, id) } @@ -16859,8 +16300,6 @@ func _sqlite3MutexAlloc(tls *libc.TLS, id int32) (r uintptr) { if !(_sqlite3Config.FbCoreMutex != 0) { return uintptr(0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexAlloc})))(tls, id) } @@ -16871,7 +16310,6 @@ func _sqlite3MutexAlloc(tls *libc.TLS, id int32) (r uintptr) { // */ func Xsqlite3_mutex_free(tls *libc.TLS, p uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexFree})))(tls, p) } } @@ -16884,7 +16322,6 @@ func Xsqlite3_mutex_free(tls *libc.TLS, p uintptr) { // */ func Xsqlite3_mutex_enter(tls *libc.TLS, p uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexEnter})))(tls, p) } } @@ -16900,7 +16337,6 @@ func Xsqlite3_mutex_try(tls *libc.TLS, p uintptr) (r int32) { _ = rc rc = SQLITE_OK if p != 0 { - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexTry})))(tls, p) } return rc @@ -16916,7 +16352,6 @@ func Xsqlite3_mutex_try(tls *libc.TLS, p uintptr) (r int32) { // */ func Xsqlite3_mutex_leave(tls *libc.TLS, p uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexLeave})))(tls, p) } } @@ -17009,41 +16444,342 @@ func init() { *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_noopMutexLeave) } -// C documentation -// -// /* -// ** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation -// ** is used regardless of the run-time threadsafety setting. -// */ -func _sqlite3DefaultMutex(tls *libc.TLS) (r uintptr) { - return _sqlite3NoopMutex(tls) +type Tpthread_t = uintptr + +type pthread_t = Tpthread_t + +type Tpthread_once_t = int32 + +type pthread_once_t = Tpthread_once_t + +type Tpthread_key_t = uint32 + +type pthread_key_t = Tpthread_key_t + +type Tpthread_spinlock_t = int32 + +type pthread_spinlock_t = Tpthread_spinlock_t + +type Tpthread_mutexattr_t = struct { + F__attr uint32 +} + +type pthread_mutexattr_t = Tpthread_mutexattr_t + +type Tpthread_condattr_t = struct { + F__attr uint32 +} + +type pthread_condattr_t = Tpthread_condattr_t + +type Tpthread_barrierattr_t = struct { + F__attr uint32 +} + +type pthread_barrierattr_t = Tpthread_barrierattr_t + +type Tpthread_rwlockattr_t = struct { + F__attr [2]uint32 } -/************** End of mutex_noop.c ******************************************/ -/************** Begin file mutex_unix.c **************************************/ +type pthread_rwlockattr_t = Tpthread_rwlockattr_t + +type Tsigset_t = struct { + F__bits [16]uint64 +} + +type sigset_t = Tsigset_t + +type t__sigset_t = Tsigset_t + +type Tpthread_attr_t = struct { + F__u struct { + F__vi [0][14]int32 + F__s [0][7]uint64 + F__i [14]int32 + } +} + +type pthread_attr_t = Tpthread_attr_t + +type Tpthread_mutex_t = struct { + F__u struct { + F__vi [0][10]int32 + F__p [0][5]uintptr + F__i [10]int32 + } +} + +type pthread_mutex_t = Tpthread_mutex_t + +type Tpthread_cond_t = struct { + F__u struct { + F__vi [0][12]int32 + F__p [0][6]uintptr + F__i [12]int32 + } +} + +type pthread_cond_t = Tpthread_cond_t + +type Tpthread_rwlock_t = struct { + F__u struct { + F__vi [0][14]int32 + F__p [0][7]uintptr + F__i [14]int32 + } +} + +type pthread_rwlock_t = Tpthread_rwlock_t + +type Tpthread_barrier_t = struct { + F__u struct { + F__vi [0][8]int32 + F__p [0][4]uintptr + F__i [8]int32 + } +} + +type pthread_barrier_t = Tpthread_barrier_t + +type Tsched_param = struct { + Fsched_priority int32 + F__reserved1 int32 + F__reserved2 [2]struct { + F__reserved1 Ttime_t + F__reserved2 int64 + } + F__reserved3 int32 +} + +type sched_param = Tsched_param + +type Tcpu_set_t = struct { + F__bits [16]uint64 +} + +type cpu_set_t = Tcpu_set_t + +type t__ptcb = struct { + F__f uintptr + F__x uintptr + F__next uintptr +} + +type Tcpu_set_t1 = struct { + F__bits [16]uint64 +} + +type cpu_set_t1 = Tcpu_set_t1 + /* -** 2007 August 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement mutexes for pthreads +** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields +** are necessary under two conditions: (1) Debug builds and (2) using +** home-grown mutexes. Encapsulate these conditions into a single #define. */ -/* #include "sqliteInt.h" */ /* -** The code in this file is only used if we are compiling threadsafe -** under unix with pthreads. +** Each recursive mutex is an instance of the following structure. + */ +type Tsqlite3_mutex1 = struct { + Fmutex Tpthread_mutex_t +} + +type sqlite3_mutex1 = Tsqlite3_mutex1 + +/* +** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** intended for use only inside assert() statements. On some platforms, +** there might be race conditions that can cause these routines to +** deliver incorrect results. In particular, if pthread_equal() is +** not an atomic operation, then these routines might delivery +** incorrect results. On most platforms, pthread_equal() is a +** comparison of two integers and is therefore atomic. But we are +** told that HPUX is not such a platform. If so, then these routines +** will not always work correctly on HPUX. ** -** Note that this implementation requires a version of pthreads that -** supports recursive mutexes. +** On those platforms where pthread_equal() is not atomic, SQLite +** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to +** make sure no assert() statements are evaluated and hence these +** routines are never called. */ +// C documentation +// +// /* +// ** Try to provide a memory barrier operation, needed for initialization +// ** and also for the implementation of xShmBarrier in the VFS in cases +// ** where SQLite is compiled without mutexes. +// */ +func _sqlite3MemoryBarrier(tls *libc.TLS) { + libc.X__sync_synchronize(tls) +} + +// C documentation +// +// /* +// ** Initialize and deinitialize the mutex subsystem. +// */ +func _pthreadMutexInit(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +func _pthreadMutexEnd(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_alloc() routine allocates a new +// ** mutex and returns a pointer to it. If it returns NULL +// ** that means that a mutex could not be allocated. SQLite +// ** will unwind its stack and return an error. The argument +// ** to sqlite3_mutex_alloc() is one of these integer constants: +// ** +// **
      +// **
    • SQLITE_MUTEX_FAST +// **
    • SQLITE_MUTEX_RECURSIVE +// **
    • SQLITE_MUTEX_STATIC_MAIN +// **
    • SQLITE_MUTEX_STATIC_MEM +// **
    • SQLITE_MUTEX_STATIC_OPEN +// **
    • SQLITE_MUTEX_STATIC_PRNG +// **
    • SQLITE_MUTEX_STATIC_LRU +// **
    • SQLITE_MUTEX_STATIC_PMEM +// **
    • SQLITE_MUTEX_STATIC_APP1 +// **
    • SQLITE_MUTEX_STATIC_APP2 +// **
    • SQLITE_MUTEX_STATIC_APP3 +// **
    • SQLITE_MUTEX_STATIC_VFS1 +// **
    • SQLITE_MUTEX_STATIC_VFS2 +// **
    • SQLITE_MUTEX_STATIC_VFS3 +// **
    +// ** +// ** The first two constants cause sqlite3_mutex_alloc() to create +// ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE +// ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. +// ** The mutex implementation does not need to make a distinction +// ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does +// ** not want to. But SQLite will only request a recursive mutex in +// ** cases where it really needs one. If a faster non-recursive mutex +// ** implementation is available on the host platform, the mutex subsystem +// ** might return such a mutex in response to SQLITE_MUTEX_FAST. +// ** +// ** The other allowed parameters to sqlite3_mutex_alloc() each return +// ** a pointer to a static preexisting mutex. Six static mutexes are +// ** used by the current version of SQLite. Future versions of SQLite +// ** may add additional static mutexes. Static mutexes are for internal +// ** use by SQLite only. Applications that use SQLite mutexes should +// ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or +// ** SQLITE_MUTEX_RECURSIVE. +// ** +// ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST +// ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +// ** returns a different mutex on every call. But for the static +// ** mutex types, the same mutex is returned on every call that has +// ** the same type number. +// */ +func _pthreadMutexAlloc(tls *libc.TLS, iType int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var _ /* recursiveAttr at bp+0 */ Tpthread_mutexattr_t + _ = p + switch iType { + case int32(SQLITE_MUTEX_RECURSIVE): + p = _sqlite3MallocZero(tls, uint64(40)) + if p != 0 { + libc.Xpthread_mutexattr_init(tls, bp) + libc.Xpthread_mutexattr_settype(tls, bp, int32(PTHREAD_MUTEX_RECURSIVE)) + libc.Xpthread_mutex_init(tls, p, bp) + libc.Xpthread_mutexattr_destroy(tls, bp) + } + case SQLITE_MUTEX_FAST: + p = _sqlite3MallocZero(tls, uint64(40)) + if p != 0 { + libc.Xpthread_mutex_init(tls, p, uintptr(0)) + } + default: + p = uintptr(unsafe.Pointer(&_staticMutexes)) + uintptr(iType-int32(2))*40 + break + } + return p +} + +var _staticMutexes = [12]Tsqlite3_mutex{} + +// C documentation +// +// /* +// ** This routine deallocates a previously +// ** allocated mutex. SQLite is careful to deallocate every +// ** mutex that it allocates. +// */ +func _pthreadMutexFree(tls *libc.TLS, p uintptr) { + libc.Xpthread_mutex_destroy(tls, p) + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +// ** to enter a mutex. If another thread is already within the mutex, +// ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return +// ** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK +// ** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can +// ** be entered multiple times by the same thread. In such cases the, +// ** mutex must be exited an equal number of times before another thread +// ** can enter. If the same thread tries to enter any other kind of mutex +// ** more than once, the behavior is undefined. +// */ +func _pthreadMutexEnter(tls *libc.TLS, p uintptr) { + /* Use the built-in recursive mutexes if they are available. + */ + libc.Xpthread_mutex_lock(tls, p) +} + +func _pthreadMutexTry(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + /* Use the built-in recursive mutexes if they are available. + */ + if libc.Xpthread_mutex_trylock(tls, p) == 0 { + rc = SQLITE_OK + } else { + rc = int32(SQLITE_BUSY) + } + return rc +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_leave() routine exits a mutex that was +// ** previously entered by the same thread. The behavior +// ** is undefined if the mutex is not currently entered or +// ** is not currently allocated. SQLite will never do either. +// */ +func _pthreadMutexLeave(tls *libc.TLS, p uintptr) { + libc.Xpthread_mutex_unlock(tls, p) +} + +func _sqlite3DefaultMutex(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_sMutex1)) +} + +var _sMutex1 = Tsqlite3_mutex_methods{} + +func init() { + p := unsafe.Pointer(&_sMutex1) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_pthreadMutexInit) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_pthreadMutexEnd) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_pthreadMutexAlloc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_pthreadMutexFree) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_pthreadMutexEnter) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_pthreadMutexTry) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_pthreadMutexLeave) +} + /************** End of mutex_unix.c ******************************************/ /************** Begin file mutex_w32.c ***************************************/ /* @@ -17331,8 +17067,6 @@ func _mallocWithAlarm(tls *libc.TLS, n int32, pp uintptr) { var nUsed Tsqlite3_int64 var p uintptr _, _, _ = nFull, nUsed, p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal ** implementation of malloc_good_size(), which must be called in debug ** mode and specifically when the DMD "Dark Matter Detector" is enabled @@ -17405,7 +17139,7 @@ func _sqlite3Malloc(tls *libc.TLS, n Tu64) (r uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxMalloc})))(tls, int32(n)) } } - _ = libc.Int32FromInt32(0) /* IMP: R-11148-40995 */ + /* IMP: R-11148-40995 */ return *(*uintptr)(unsafe.Pointer(bp)) } @@ -17453,7 +17187,6 @@ func _isLookaside(tls *libc.TLS, db uintptr, p uintptr) (r int32) { // ** sqlite3Malloc() or sqlite3_malloc(). // */ func _sqlite3MallocSize(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxSize})))(tls, p) } @@ -17469,15 +17202,12 @@ func _lookasideMallocSize(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } func _sqlite3DbMallocSize(tls *libc.TLS, db uintptr, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if db != 0 { if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd) { if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { - _ = libc.Int32FromInt32(0) return int32(LOOKASIDE_SMALL) } if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { - _ = libc.Int32FromInt32(0) return int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) } } @@ -17488,8 +17218,6 @@ func _sqlite3DbMallocSize(tls *libc.TLS, db uintptr, p uintptr) (r int32) { func Xsqlite3_msize(tls *libc.TLS, p uintptr) (r Tsqlite3_uint64) { var v1 int32 _ = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if p != 0 { v1 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxSize})))(tls, p) } else { @@ -17507,8 +17235,6 @@ func Xsqlite3_free(tls *libc.TLS, p uintptr) { if p == uintptr(0) { return } /* IMP: R-49053-54554 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3Config.FbMemstat != 0 { Xsqlite3_mutex_enter(tls, _mem0.Fmutex) _sqlite3StatusDown(tls, SQLITE_STATUS_MEMORY_USED, _sqlite3MallocSize(tls, p)) @@ -17540,20 +17266,16 @@ func _measureAllocationSize(tls *libc.TLS, db uintptr, p uintptr) { func _sqlite3DbFreeNN(tls *libc.TLS, db uintptr, p uintptr) { var pBuf, pBuf1 uintptr _, _ = pBuf, pBuf1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if db != 0 { if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { pBuf = p - _ = libc.Int32FromInt32(0) (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = pBuf return } if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { pBuf1 = p - _ = libc.Int32FromInt32(0) (*TLookasideSlot)(unsafe.Pointer(pBuf1)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = pBuf1 return @@ -17564,29 +17286,21 @@ func _sqlite3DbFreeNN(tls *libc.TLS, db uintptr, p uintptr) { return } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, p) } func _sqlite3DbNNFreeNN(tls *libc.TLS, db uintptr, p uintptr) { var pBuf, pBuf1 uintptr _, _ = pBuf, pBuf1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { pBuf = p - _ = libc.Int32FromInt32(0) (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = pBuf return } if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { pBuf1 = p - _ = libc.Int32FromInt32(0) (*TLookasideSlot)(unsafe.Pointer(pBuf1)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = pBuf1 return @@ -17596,13 +17310,10 @@ func _sqlite3DbNNFreeNN(tls *libc.TLS, db uintptr, p uintptr) { _measureAllocationSize(tls, db, p) return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, p) } func _sqlite3DbFree(tls *libc.TLS, db uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) if p != 0 { _sqlite3DbFreeNN(tls, db, p) } @@ -17619,8 +17330,6 @@ func _sqlite3Realloc(tls *libc.TLS, pOld uintptr, nBytes Tu64) (r uintptr) { var pNew uintptr var v2 bool _, _, _, _, _, _, _ = nDiff, nNew, nOld, nUsed, pNew, v1, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pOld == uintptr(0) { return _sqlite3Malloc(tls, nBytes) /* IMP: R-04300-56712 */ } @@ -17669,7 +17378,7 @@ func _sqlite3Realloc(tls *libc.TLS, pOld uintptr, nBytes Tu64) (r uintptr) { pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRealloc})))(tls, pOld, nNew) } } - _ = libc.Int32FromInt32(0) /* IMP: R-11148-40995 */ + /* IMP: R-11148-40995 */ return pNew } @@ -17735,7 +17444,6 @@ func _sqlite3DbMallocZero(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { func _dbMallocRawFinish(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) p = _sqlite3Malloc(tls, n) if !(p != 0) { _sqlite3OomFault(tls, db) @@ -17780,9 +17488,6 @@ func _sqlite3DbMallocRaw(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { func _sqlite3DbMallocRawNN(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { var pBuf, v1, v2, v3, v4 uintptr _, _, _, _, _ = pBuf, v1, v2, v3, v4 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if n > uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz) { if !((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0) { *(*Tu32)(unsafe.Pointer(db + 440 + 16 + 1*4))++ @@ -17837,11 +17542,9 @@ func _sqlite3DbMallocRawNN(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { // ** resize fails, set the mallocFailed flag in the connection object. // */ func _sqlite3DbRealloc(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) { - _ = libc.Int32FromInt32(0) if p == uintptr(0) { return _sqlite3DbMallocRawNN(tls, db, n) } - _ = libc.Int32FromInt32(0) if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { if n <= uint64(LOOKASIDE_SMALL) { @@ -17862,8 +17565,6 @@ func _dbReallocFinish(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) var pNew uintptr _ = pNew pNew = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { if _isLookaside(tls, db, p) != 0 { pNew = _sqlite3DbMallocRawNN(tls, db, n) @@ -17872,8 +17573,6 @@ func _dbReallocFinish(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) _sqlite3DbFree(tls, db, p) } } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pNew = _sqlite3Realloc(tls, p, n) if !(pNew != 0) { _sqlite3OomFault(tls, db) @@ -17926,9 +17625,6 @@ func _sqlite3DbStrDup(tls *libc.TLS, db uintptr, z uintptr) (r uintptr) { func _sqlite3DbStrNDup(tls *libc.TLS, db uintptr, z uintptr, n Tu64) (r uintptr) { var zNew, v1 uintptr _, _ = zNew, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if z != 0 { v1 = _sqlite3DbMallocRawNN(tls, db, n+uint64(1)) } else { @@ -18001,7 +17697,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) if (*Tsqlite3)(unsafe.Pointer(db)).FpParse != 0 { - _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1618, 0) + _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1622, 0) (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).Frc = int32(SQLITE_NOMEM) pParse = (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).FpOuterParse for { @@ -18012,6 +17708,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -18034,7 +17731,6 @@ func _sqlite3OomClear(tls *libc.TLS, db uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec == 0 { (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed = uint8(0) libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { v1 = 0 @@ -18078,8 +17774,6 @@ func _sqlite3ApiExit(tls *libc.TLS, db uintptr, rc int32) (r int32) { ** Otherwise the read (and possible write) of db->mallocFailed ** is unsafe, as is the call to sqlite3Error(). */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 || rc != 0 { return _apiHandleError(tls, db, rc) } @@ -18279,7 +17973,6 @@ var _fmtinfo = [23]Tet_info{ // ** Set the StrAccum object to an error mode. // */ func _sqlite3StrAccumSetError(tls *libc.TLS, p uintptr, eError Tu8) { - _ = libc.Int32FromInt32(0) (*TStrAccum)(unsafe.Pointer(p)).FaccError = eError if (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc != 0 { Xsqlite3_str_reset(tls, p) @@ -18398,7 +18091,6 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li /* pAccum never starts out with an empty buffer that was obtained from ** malloc(). This precondition is required by the mprintf("%z...") ** optimization. */ - _ = libc.Int32FromInt32(0) bufpt = uintptr(0) if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_SQLFUNC) != 0 { pArgList = libc.VaUintptr(&ap) @@ -18427,7 +18119,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li v3 = int32(*(*int8)(unsafe.Pointer(v4))) c = v3 if v3 == 0 { - Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1632, int32(1)) + Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1636, int32(1)) break } /* Find out what flags are present */ @@ -18573,6 +18265,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -18598,6 +18291,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -18617,8 +18311,6 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li ** xtype The class of the conversion. ** infop Pointer to the appropriate info struct. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch int32(xtype) { case int32(etPOINTER): goto _26 @@ -18659,11 +18351,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -18772,6 +18468,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -18793,14 +18490,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -18816,6 +18517,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -18830,9 +18534,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li if (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FisSpecial != 0 { if int32((*(*TFpDecode)(unsafe.Pointer(bp + 72))).FisSpecial) == int32(2) { if flag_zeropad != 0 { - v57 = __ccgo_ts + 1634 + v57 = __ccgo_ts + 1638 } else { - v57 = __ccgo_ts + 1639 + v57 = __ccgo_ts + 1643 } bufpt = v57 length = _sqlite3Strlen30(tls, bufpt) @@ -18843,7 +18547,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FiDP = int32(1000) (*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fn = int32(1) } else { - libc.Xmemcpy(tls, bp, __ccgo_ts+1643, uint64(5)) + libc.Xmemcpy(tls, bp, __ccgo_ts+1647, uint64(5)) bufpt = bp if int32((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fsign) == int32('-') { /* no-op */ @@ -18948,6 +18652,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -18969,6 +18674,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(v70)) = int8('0') goto _69 _69: + ; precision-- e2++ } @@ -18997,7 +18703,6 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li v75 = bufpt *(*int8)(unsafe.Pointer(v75)) = 0 } - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(bufpt + uintptr(-libc.Int32FromInt32(1))))) == int32('.') { if flag_altform2 != 0 { v76 = bufpt @@ -19057,6 +18762,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -19074,6 +18780,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -19082,11 +18789,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -19163,7 +18872,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -19171,14 +18882,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li bufpt = libc.VaUintptr(&ap) } if bufpt == uintptr(0) { - bufpt = __ccgo_ts + 1648 + bufpt = __ccgo_ts + 1652 } else { if int32(xtype) == int32(etDYNSTRING) { if (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar == uint32(0) && (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FmxAlloc != 0 && width == 0 && precision < 0 && int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FaccError) == 0 { /* Special optimization for sqlite3_mprintf("%z..."): ** Extend an existing memory allocation rather than creating ** a new one. */ - _ = libc.Int32FromInt32(0) (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FzText = bufpt (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc = uint32(_sqlite3DbMallocSize(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, bufpt)) (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar = uint32(int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt))) @@ -19218,6 +18928,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -19225,6 +18936,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -19237,9 +18949,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -19254,9 +18969,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li isnull = libc.BoolInt32(escarg == uintptr(0)) if isnull != 0 { if int32(xtype) == int32(etSQLESCAPE2) { - v98 = __ccgo_ts + 1649 + v98 = __ccgo_ts + 1653 } else { - v98 = __ccgo_ts + 1654 + v98 = __ccgo_ts + 1658 } escarg = v98 } @@ -19287,6 +19002,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -19326,6 +19042,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -19337,6 +19054,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19350,7 +19068,6 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } else { /* %T means a Token pointer */ pToken = libc.VaUintptr(&ap) - _ = libc.Int32FromInt32(0) if pToken != 0 && (*TToken)(unsafe.Pointer(pToken)).Fn != 0 { Xsqlite3_str_append(tls, pAccum, (*TToken)(unsafe.Pointer(pToken)).Fz, int32((*TToken)(unsafe.Pointer(pToken)).Fn)) _sqlite3RecordErrorByteOffset(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, (*TToken)(unsafe.Pointer(pToken)).Fz) @@ -19361,18 +19078,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } pItem = libc.VaUintptr(&ap) - _ = libc.Int32FromInt32(0) if (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 && !(flag_altform2 != 0) { Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) } else { if (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1661, int32(1)) + Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1665, int32(1)) } Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzName) } else { @@ -19380,11 +19097,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) } else { pSel = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_NestedFrom) != 0 { - Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1663, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1667, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) } else { - Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1673, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1677, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) } } } @@ -19394,9 +19110,10 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: - _ = libc.Int32FromInt32(0) + ; return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -19423,6 +19140,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -19442,7 +19160,6 @@ var _zOrd = [9]int8{'t', 'h', 's', 't', 'n', 'd', 'r', 'd'} func _sqlite3RecordErrorByteOffset(tls *libc.TLS, db uintptr, z uintptr) { var pParse, zEnd, zText uintptr _, _, _ = pParse, zEnd, zText - _ = libc.Int32FromInt32(0) if db == uintptr(0) { return } @@ -19492,7 +19209,7 @@ func _sqlite3StrAccumEnlarge(tls *libc.TLS, p uintptr, N Ti64) (r int32) { var szNew Ti64 var zNew, zOld, v1, p2 uintptr _, _, _, _, _ = szNew, zNew, zOld, v1, p2 - _ = libc.Int32FromInt32(0) /* Only called if really needed */ + /* Only called if really needed */ if (*TStrAccum)(unsafe.Pointer(p)).FaccError != 0 { return 0 } @@ -19525,7 +19242,6 @@ func _sqlite3StrAccumEnlarge(tls *libc.TLS, p uintptr, N Ti64) (r int32) { zNew = _sqlite3Realloc(tls, zOld, uint64((*TStrAccum)(unsafe.Pointer(p)).FnAlloc)) } if zNew != 0 { - _ = libc.Int32FromInt32(0) if !(int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED) != libc.Int32FromInt32(0)) && (*TStrAccum)(unsafe.Pointer(p)).FnChar > uint32(0) { libc.Xmemcpy(tls, zNew, (*TStrAccum)(unsafe.Pointer(p)).FzText, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar)) } @@ -19539,7 +19255,6 @@ func _sqlite3StrAccumEnlarge(tls *libc.TLS, p uintptr, N Ti64) (r int32) { return 0 } } - _ = libc.Int32FromInt32(0) return int32(N) } @@ -19599,15 +19314,10 @@ func _enlargeAndAppend(tls *libc.TLS, p uintptr, z uintptr, N int32) { // ** size of the memory allocation for StrAccum if necessary. // */ func Xsqlite3_str_append(tls *libc.TLS, p uintptr, z uintptr, N int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar+uint32(N) >= (*Tsqlite3_str)(unsafe.Pointer(p)).FnAlloc { _enlargeAndAppend(tls, p, z, N) } else { if N != 0 { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(p + 24)) += uint32(N) libc.Xmemcpy(tls, (*Tsqlite3_str)(unsafe.Pointer(p)).FzText+uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar-uint32(N)), z, uint64(N)) } @@ -19633,7 +19343,6 @@ func Xsqlite3_str_appendall(tls *libc.TLS, p uintptr, z uintptr) { func _strAccumFinishRealloc(tls *libc.TLS, p uintptr) (r uintptr) { var zText, p1 uintptr _, _ = zText, p1 - _ = libc.Int32FromInt32(0) zText = _sqlite3DbMallocRaw(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar+uint32(1))) if zText != 0 { libc.Xmemcpy(tls, zText, (*TStrAccum)(unsafe.Pointer(p)).FzText, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar+uint32(1))) @@ -19670,7 +19379,7 @@ func _sqlite3ResultStrAccum(tls *libc.TLS, pCtx uintptr, p uintptr) { if int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&int32(SQLITE_PRINTF_MALLOCED) != 0 { Xsqlite3_result_text(tls, pCtx, (*TStrAccum)(unsafe.Pointer(p)).FzText, int32((*TStrAccum)(unsafe.Pointer(p)).FnChar), __ccgo_fp(_sqlite3OomClear)) } else { - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1648, 0, libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1652, 0, libc.UintptrFromInt32(0)) Xsqlite3_str_reset(tls, p) } } @@ -19821,7 +19530,6 @@ func _sqlite3VMPrintf(tls *libc.TLS, db uintptr, zFormat uintptr, ap Tva_list) ( var _ /* acc at bp+72 */ TStrAccum var _ /* zBase at bp+0 */ [70]int8 _ = z - _ = libc.Int32FromInt32(0) _sqlite3StrAccumInit(tls, bp+72, db, bp, int32(70), *(*int32)(unsafe.Pointer(db + 136))) (*(*TStrAccum)(unsafe.Pointer(bp + 72))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) Xsqlite3_str_vappendf(tls, bp+72, zFormat, ap) @@ -20004,7 +19712,6 @@ func _sqlite3RCStrRef(tls *libc.TLS, z uintptr) (r uintptr) { var p uintptr _ = p p = z - _ = libc.Int32FromInt32(0) p -= 8 (*TRCStr)(unsafe.Pointer(p)).FnRCRef++ return z @@ -20020,9 +19727,7 @@ func _sqlite3RCStrUnref(tls *libc.TLS, z uintptr) { var p uintptr _ = p p = z - _ = libc.Int32FromInt32(0) p -= 8 - _ = libc.Int32FromInt32(0) if (*TRCStr)(unsafe.Pointer(p)).FnRCRef >= uint64(2) { (*TRCStr)(unsafe.Pointer(p)).FnRCRef-- } else { @@ -20062,9 +19767,7 @@ func _sqlite3RCStrResize(tls *libc.TLS, z uintptr, N Tu64) (r uintptr) { var p, pNew uintptr _, _ = p, pNew p = z - _ = libc.Int32FromInt32(0) p -= 8 - _ = libc.Int32FromInt32(0) pNew = Xsqlite3_realloc64(tls, p, N+uint64(8)+uint64(1)) if pNew == uintptr(0) { Xsqlite3_free(tls, p) @@ -20297,6 +20000,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -20307,6 +20011,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -20345,7 +20050,6 @@ func Xsqlite3_randomness(tls *libc.TLS, N int32, pBuf uintptr) { *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)) + 12*4)) = uint32(0) _sqlite3Prng.Fn = uint8(0) } - _ = libc.Int32FromInt32(0) for int32(1) != 0 { if N <= int32(_sqlite3Prng.Fn) { libc.Xmemcpy(tls, zBuf, uintptr(unsafe.Pointer(&_sqlite3Prng))+64+uintptr(int32(_sqlite3Prng.Fn)-N), uint64(N)) @@ -20425,23 +20129,16 @@ func _sqlite3PrngRestoreState(tls *libc.TLS) { /* #include "sqliteInt.h" */ /********************************* Unix Pthreads ****************************/ -/******************************** End Unix Pthreads *************************/ -/********************************* Win32 Threads ****************************/ -/******************************** End Win32 Threads *************************/ - -/********************************* Single-Threaded **************************/ -/* -** This implementation does not actually create a new thread. It does the -** work of the thread in the main thread, when either the thread is created -** or when it is joined - */ +/* #include */ /* A running thread */ type TSQLiteThread1 = struct { - FxTask uintptr - FpIn uintptr - FpResult uintptr + Ftid Tpthread_t + Fdone int32 + FpOut uintptr + FxTask uintptr + FpIn uintptr } type SQLiteThread1 = TSQLiteThread1 @@ -20451,20 +20148,29 @@ type SQLiteThread1 = TSQLiteThread1 // /* Create a new thread */ func _sqlite3ThreadCreate(tls *libc.TLS, ppThread uintptr, xTask uintptr, pIn uintptr) (r int32) { var p uintptr - _ = p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + var rc int32 + _, _ = p, rc + /* This routine is never used in single-threaded mode */ *(*uintptr)(unsafe.Pointer(ppThread)) = uintptr(0) - p = _sqlite3Malloc(tls, uint64(24)) + p = _sqlite3Malloc(tls, uint64(40)) if p == uintptr(0) { return int32(SQLITE_NOMEM) } - if int32(int64(p))/int32(17)&int32(1) != 0 { - (*TSQLiteThread)(unsafe.Pointer(p)).FxTask = xTask - (*TSQLiteThread)(unsafe.Pointer(p)).FpIn = pIn + libc.Xmemset(tls, p, 0, uint64(40)) + (*TSQLiteThread)(unsafe.Pointer(p)).FxTask = xTask + (*TSQLiteThread)(unsafe.Pointer(p)).FpIn = pIn + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** for testing purposes. */ + if _sqlite3FaultSim(tls, int32(200)) != 0 { + rc = int32(1) } else { - (*TSQLiteThread)(unsafe.Pointer(p)).FxTask = uintptr(0) - (*TSQLiteThread)(unsafe.Pointer(p)).FpResult = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{xTask})))(tls, pIn) + rc = libc.Xpthread_create(tls, p, uintptr(0), xTask, pIn) + } + if rc != 0 { + (*TSQLiteThread)(unsafe.Pointer(p)).Fdone = int32(1) + (*TSQLiteThread)(unsafe.Pointer(p)).FpOut = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{xTask})))(tls, pIn) } *(*uintptr)(unsafe.Pointer(ppThread)) = p return SQLITE_OK @@ -20474,19 +20180,32 @@ func _sqlite3ThreadCreate(tls *libc.TLS, ppThread uintptr, xTask uintptr, pIn ui // // /* Get the results of the thread */ func _sqlite3ThreadJoin(tls *libc.TLS, p uintptr, ppOut uintptr) (r int32) { - _ = libc.Int32FromInt32(0) + var rc, v1 int32 + _, _ = rc, v1 if p == uintptr(0) { return int32(SQLITE_NOMEM) } - if (*TSQLiteThread)(unsafe.Pointer(p)).FxTask != 0 { - *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TSQLiteThread)(unsafe.Pointer(p)).FxTask})))(tls, (*TSQLiteThread)(unsafe.Pointer(p)).FpIn) + if (*TSQLiteThread)(unsafe.Pointer(p)).Fdone != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TSQLiteThread)(unsafe.Pointer(p)).FpOut + rc = SQLITE_OK } else { - *(*uintptr)(unsafe.Pointer(ppOut)) = (*TSQLiteThread)(unsafe.Pointer(p)).FpResult + if libc.Xpthread_join(tls, (*TSQLiteThread)(unsafe.Pointer(p)).Ftid, ppOut) != 0 { + v1 = int32(SQLITE_ERROR) + } else { + v1 = SQLITE_OK + } + rc = v1 } Xsqlite3_free(tls, p) - return SQLITE_OK + return rc } +/******************************** End Unix Pthreads *************************/ + +/********************************* Win32 Threads ****************************/ +/******************************** End Win32 Threads *************************/ + +/********************************* Single-Threaded **************************/ /****************************** End Single-Threaded *************************/ /************** End of threads.c *********************************************/ @@ -20670,7 +20389,6 @@ func _sqlite3Utf8ReadLimited(tls *libc.TLS, z uintptr, n int32, piOut uintptr) ( var i int32 _, _ = c, i i = int32(1) - _ = libc.Int32FromInt32(0) c = uint32(*(*Tu8)(unsafe.Pointer(z))) if c >= uint32(0xc0) { c = uint32(_sqlite3Utf8Trans1[c-uint32(0xc0)]) @@ -20706,11 +20424,6 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in var temp Tu8 var z, zIn, zOut, zTerm, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v5, v6, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, c2, c21, len1, rc, temp, z, zIn, zOut, zTerm, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v5, v6, v7, v8, v9 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the translation is between UTF-16 little and big endian, then ** all that is required is to swap the byte order. This case is handled ** differently from the others. @@ -20718,7 +20431,6 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) != int32(SQLITE_UTF8) && int32(desiredEnc) != int32(SQLITE_UTF8) { rc = _sqlite3VdbeMemMakeWriteable(tls, pMem) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) return int32(SQLITE_NOMEM) } zIn = (*TMem)(unsafe.Pointer(pMem)).Fz @@ -20805,7 +20517,6 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in } } } else { - _ = libc.Int32FromInt32(0) /* UTF-8 -> UTF-16 Big-endian */ for zIn < zTerm { v10 = zIn @@ -20850,7 +20561,6 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in z++ *(*uint8)(unsafe.Pointer(v18)) = uint8(0) } else { - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) == int32(SQLITE_UTF16LE) { /* UTF-16 Little-endian -> UTF-8 */ for zIn < zTerm { @@ -20975,7 +20685,6 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).Fn = int32(int64(z) - int64(zOut)) } *(*uint8)(unsafe.Pointer(z)) = uint8(0) - _ = libc.Int32FromInt32(0) c = uint32(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Term) | int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_AffMask)|libc.Int32FromInt32(MEM_Subtype))) _sqlite3VdbeMemRelease(tls, pMem) (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(c) @@ -20984,6 +20693,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -21006,7 +20716,6 @@ func _sqlite3VdbeMemHandleBom(tls *libc.TLS, pMem uintptr) (r int32) { _, _, _, _, _ = b1, b2, bom, rc, p1 rc = SQLITE_OK bom = uint8(0) - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(pMem)).Fn > int32(1) { b1 = *(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz)) b2 = *(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + libc.UintptrFromInt32(1))) @@ -21052,7 +20761,6 @@ func _sqlite3Utf8CharLen(tls *libc.TLS, zIn uintptr, nByte int32) (r1 int32) { } else { zTerm = uintptr(-libc.Int32FromInt32(1)) } - _ = libc.Int32FromInt32(0) for int32(*(*Tu8)(unsafe.Pointer(z))) != 0 && z < zTerm { v1 = z z++ @@ -21091,9 +20799,6 @@ func _sqlite3Utf16to8(tls *libc.TLS, db uintptr, z uintptr, nByte int32, enc Tu8 _sqlite3VdbeMemRelease(tls, bp) (*(*TMem)(unsafe.Pointer(bp))).Fz = uintptr(0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return (*(*TMem)(unsafe.Pointer(bp))).Fz } @@ -21132,53 +20837,6 @@ type Tdouble_t = float64 type double_t = Tdouble_t -const _FP_INT_UPWARD = 0 -const _FP_INT_DOWNWARD = 1 -const _FP_INT_TOWARDZERO = 2 -const _FP_INT_TONEARESTFROMZERO = 3 -const _FP_INT_TONEAREST = 4 -const _FP_NAN = 0 -const _FP_INFINITE = 1 -const _FP_ZERO = 2 -const _FP_SUBNORMAL = 3 -const _FP_NORMAL = 4 - -/* Return nonzero value if X is canonical. In IEEE interchange binary - formats, all values are canonical, but the argument must still be - converted to its semantic type for any exceptions arising from the - conversion, before being discarded; in extended precision, there - are encodings that are not consistently handled as corresponding to - any particular value of the type, and we return 0 for those. */ - -/* Return nonzero value if X is a signaling NaN. */ - -/* Return nonzero value if X is subnormal. */ - -/* Return nonzero value if X is zero. */ - -/* X/Open wants another strange constant. */ - -/* Some useful constants. */ - -/* GNU extension to provide float constants with similar names. */ - -/* The above constants are not adequate for computation using `long double's. - Therefore we provide as an extension constants with similar names as a - GNU extension. Provide enough digits for the 128-bit IEEE quad. */ - -/* ISO C99 defines some macros to compare number while taking care for - unordered numbers. Many FPUs provide special instructions to support - these operations. Generic support in GCC for these as builtins went - in 2.97, but not all cpus added their patterns until 3.1. Therefore - we enable the builtins from 3.1 onwards and use a generic implementation - othwerwise. */ - -/* An expression whose type has the widest of the evaluation formats - of X and Y (which are of floating-point types). */ - -/* Return X == Y but raising "invalid" and setting errno if X or Y is - a NaN. */ - // C documentation // // /* @@ -21233,6 +20891,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)<>4)) != 0 { - _ = libc.Int32FromInt32(0) return _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4))-int32(1)] } else { return zDflt @@ -21295,7 +20969,6 @@ func _sqlite3ErrorFinish(tls *libc.TLS, db uintptr, err_code int32) { // ** that would be appropriate. // */ func _sqlite3Error(tls *libc.TLS, db uintptr, err_code int32) { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = err_code if err_code != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { _sqlite3ErrorFinish(tls, db, err_code) @@ -21311,7 +20984,6 @@ func _sqlite3Error(tls *libc.TLS, db uintptr, err_code int32) { // ** and error message. // */ func _sqlite3ErrorClear(tls *libc.TLS, db uintptr) { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_OK (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(1) if (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { @@ -21354,7 +21026,6 @@ func _sqlite3ErrorWithMsg(tls *libc.TLS, db uintptr, err_code int32, zFormat uin var z, v1 uintptr var v2 bool _, _, _, _ = ap, z, v1, v2 - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = err_code _sqlite3SystemError(tls, db, err_code) if zFormat == uintptr(0) { @@ -21422,8 +21093,6 @@ func _sqlite3ErrorMsg(tls *libc.TLS, pParse uintptr, zFormat uintptr, va uintptr var db, zMsg uintptr _, _, _ = ap, db, zMsg db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(2) ap = va zMsg = _sqlite3VMPrintf(tls, db, zFormat, ap) @@ -21505,7 +21174,6 @@ func _sqlite3Dequote(tls *libc.TLS, z uintptr) { i = int32(1) j = libc.Int32FromInt32(0) for { - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(quote) { if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == int32(quote) { v2 = j @@ -21522,6 +21190,7 @@ func _sqlite3Dequote(tls *libc.TLS, z uintptr) { } goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 @@ -21530,8 +21199,6 @@ func _sqlite3Dequote(tls *libc.TLS, z uintptr) { func _sqlite3DequoteExpr(tls *libc.TLS, p uintptr) { var v1 int32 _ = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8))))) == int32('"') { v1 = libc.Int32FromInt32(EP_Quoted) | libc.Int32FromInt32(EP_DblQuoted) } else { @@ -21573,6 +21240,7 @@ func _sqlite3DequoteToken(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } *(*uint32)(unsafe.Pointer(p + 8)) -= uint32(2) @@ -21778,15 +21446,14 @@ func _sqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc T var _ /* rr at bp+0 */ [2]float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, e, eType, eValid, esign, i, incr, nDigit, r, s, s2, sign, zEnd, v2, v3, v4 /* sign * significand * (10 ^ (esign * exponent)) */ - sign = int32(1) /* sign of significand */ - s = uint64(0) /* significand */ - d = 0 /* adjust exponent for shifting decimal point */ - esign = int32(1) /* sign of exponent */ - e = 0 /* exponent */ - eValid = int32(1) /* True exponent is either not used or is well-formed */ - nDigit = 0 /* Number of digits processed */ - eType = int32(1) /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */ - _ = libc.Int32FromInt32(0) + sign = int32(1) /* sign of significand */ + s = uint64(0) /* significand */ + d = 0 /* adjust exponent for shifting decimal point */ + esign = int32(1) /* sign of exponent */ + e = 0 /* exponent */ + eValid = int32(1) /* True exponent is either not used or is well-formed */ + nDigit = 0 /* Number of digits processed */ + eType = int32(1) /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */ *(*float64)(unsafe.Pointer(pResult)) = float64(0) /* Default return value, in case of an error */ if length == 0 { return 0 @@ -21797,7 +21464,6 @@ func _sqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc T } else { incr = int32(2) length &= ^libc.Int32FromInt32(1) - _ = libc.Int32FromInt32(0) i = int32(3) - int32(enc) for { if !(i < length && int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == 0) { @@ -21805,6 +21471,7 @@ func _sqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc T } goto _1 _1: + ; i += int32(2) } if i < length { @@ -21901,6 +21568,7 @@ func _sqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc T z += uintptr(incr) } do_atof_calc: + ; /* Zero is a special case */ if s == uint64(0) { if sign < 0 { @@ -21954,7 +21622,6 @@ do_atof_calc: r = r * libc.Float64FromFloat64(0.1) } } - _ = libc.Int32FromInt32(0) if r > +libc.Float64FromFloat64(1.7976931348623157081452742373e+308) { *(*float64)(unsafe.Pointer(pResult)) = float64(+libc.X__builtin_inff(tls)) } else { @@ -22005,8 +21672,8 @@ do_atof_calc: if sign < 0 { *(*float64)(unsafe.Pointer(pResult)) = -*(*float64)(unsafe.Pointer(pResult)) } - _ = libc.Int32FromInt32(0) atof_return: + ; /* return true if number and no extra non-whitespace characters after */ if z == zEnd && nDigit > 0 && eValid != 0 && eType > 0 { return eType @@ -22089,7 +21756,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { _, _, _ = c, i, pow63 c = 0 /* 012345678901234567 */ - pow63 = __ccgo_ts + 1687 + pow63 = __ccgo_ts + 1691 i = 0 for { if !(c == 0 && i < int32(18)) { @@ -22098,6 +21765,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -22136,13 +21804,11 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc c = 0 nonNum = 0 zEnd = zNum + uintptr(length) - _ = libc.Int32FromInt32(0) if int32(enc) == int32(SQLITE_UTF8) { incr = int32(1) } else { incr = int32(2) length &= ^libc.Int32FromInt32(1) - _ = libc.Int32FromInt32(0) i = int32(3) - int32(enc) for { if !(i < length && int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) == 0) { @@ -22150,6 +21816,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -22185,6 +21852,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -22609,7 +22274,6 @@ func _sqlite3FpDecode(tls *libc.TLS, p uintptr, _r float64, iRound int32, mxRoun } } (*TFpDecode)(unsafe.Pointer(p)).Fz = p + 24 + uintptr(i+int32(1)) - _ = libc.Int32FromInt32(0) for (*TFpDecode)(unsafe.Pointer(p)).Fn > 0 && int32(*(*int8)(unsafe.Pointer((*TFpDecode)(unsafe.Pointer(p)).Fz + uintptr((*TFpDecode)(unsafe.Pointer(p)).Fn-int32(1))))) == int32('0') { (*TFpDecode)(unsafe.Pointer(p)).Fn-- } @@ -22640,6 +22304,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -22700,6 +22365,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -22713,7 +22379,6 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { } p3 = bp *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & libc.Int32FromInt32(0x7f)) - _ = libc.Int32FromInt32(0) i = 0 j = n - libc.Int32FromInt32(1) for { @@ -22723,6 +22388,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -22770,8 +22436,6 @@ func _sqlite3GetVarint(tls *libc.TLS, p uintptr, v uintptr) (r Tu8) { return uint8(2) } /* Verify that constants are precomputed correctly */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) a = uint32(*(*uint8)(unsafe.Pointer(p))) << int32(14) b = uint32(*(*uint8)(unsafe.Pointer(p + 1))) p += uintptr(2) @@ -22909,7 +22573,6 @@ func _sqlite3GetVarint32(tls *libc.TLS, p uintptr, v uintptr) (r Tu8) { _ = n /* Assume that the single-byte case has already been handled by ** the getVarint32() macro */ - _ = libc.Int32FromInt32(0) if int32(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0 { /* This is the two-byte case */ *(*Tu32)(unsafe.Pointer(v)) = uint32(int32(*(*uint8)(unsafe.Pointer(p)))&int32(0x7f)<> int32(6))) return uint8(h & libc.Int32FromInt32(0xf)) } @@ -23011,6 +22672,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))< *(*TVList)(unsafe.Pointer(pIn)) { if pIn != 0 { v1 = int64(2) * int64(*(*TVList)(unsafe.Pointer(pIn))) @@ -23339,7 +23000,6 @@ func _sqlite3VListAdd(tls *libc.TLS, db uintptr, pIn uintptr, zName uintptr, nNa *(*TVList)(unsafe.Pointer(pIn + uintptr(i+int32(1))*4)) = nInt z = pIn + uintptr(i+int32(2))*4 *(*TVList)(unsafe.Pointer(pIn + 1*4)) = i + nInt - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, z, zName, uint64(nName)) *(*int8)(unsafe.Pointer(z + uintptr(nName))) = 0 return pIn @@ -23425,7 +23085,6 @@ func _sqlite3VListNameToNum(tls *libc.TLS, pIn uintptr, zName uintptr, nName int // ** "pNew" is a pointer to the hash table that is to be initialized. // */ func _sqlite3HashInit(tls *libc.TLS, pNew uintptr) { - _ = libc.Int32FromInt32(0) (*THash)(unsafe.Pointer(pNew)).Ffirst = uintptr(0) (*THash)(unsafe.Pointer(pNew)).Fcount = uint32(0) (*THash)(unsafe.Pointer(pNew)).Fhtsize = uint32(0) @@ -23441,7 +23100,6 @@ func _sqlite3HashInit(tls *libc.TLS, pNew uintptr) { func _sqlite3HashClear(tls *libc.TLS, pH uintptr) { var elem, next_elem uintptr _, _ = elem, next_elem /* For looping over all elements of the table */ - _ = libc.Int32FromInt32(0) elem = (*THash)(unsafe.Pointer(pH)).Ffirst (*THash)(unsafe.Pointer(pH)).Ffirst = uintptr(0) Xsqlite3_free(tls, (*THash)(unsafe.Pointer(pH)).Fht) @@ -23571,6 +23229,7 @@ func _rehash(tls *libc.TLS, pH uintptr, new_size uint32) (r int32) { _insertElement(tls, pH, new_ht+uintptr(h)*16, elem) goto _2 _2: + ; elem = next_elem } return int32(1) @@ -23601,7 +23260,6 @@ func _findElementWithHash(tls *libc.TLS, pH uintptr, pKey uintptr, pHash uintptr *(*uint32)(unsafe.Pointer(pHash)) = h } for count != 0 { - _ = libc.Int32FromInt32(0) if _sqlite3StrICmp(tls, (*THashElem)(unsafe.Pointer(elem)).FpKey, pKey) == 0 { return elem } @@ -23634,14 +23292,11 @@ func _removeElementGivenHash(tls *libc.TLS, pH uintptr, elem uintptr, h uint32) if (*T_ht)(unsafe.Pointer(pEntry)).Fchain == elem { (*T_ht)(unsafe.Pointer(pEntry)).Fchain = (*THashElem)(unsafe.Pointer(elem)).Fnext } - _ = libc.Int32FromInt32(0) (*T_ht)(unsafe.Pointer(pEntry)).Fcount-- } Xsqlite3_free(tls, elem) (*THash)(unsafe.Pointer(pH)).Fcount-- if (*THash)(unsafe.Pointer(pH)).Fcount == uint32(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3HashClear(tls, pH) } } @@ -23653,8 +23308,6 @@ func _removeElementGivenHash(tls *libc.TLS, pH uintptr, elem uintptr, h uint32) // ** found, or NULL if there is no match. // */ func _sqlite3HashFind(tls *libc.TLS, pH uintptr, pKey uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return (*THashElem)(unsafe.Pointer(_findElementWithHash(tls, pH, pKey, uintptr(0)))).Fdata } @@ -23680,8 +23333,6 @@ func _sqlite3HashInsert(tls *libc.TLS, pH uintptr, pKey uintptr, data uintptr) ( var elem, new_elem, old_data, v1 uintptr var _ /* h at bp+0 */ uint32 _, _, _, _ = elem, new_elem, old_data, v1 /* New element added to the pH */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) elem = _findElementWithHash(tls, pH, pKey, bp) if (*THashElem)(unsafe.Pointer(elem)).Fdata != 0 { old_data = (*THashElem)(unsafe.Pointer(elem)).Fdata @@ -23705,7 +23356,6 @@ func _sqlite3HashInsert(tls *libc.TLS, pH uintptr, pKey uintptr, data uintptr) ( (*THash)(unsafe.Pointer(pH)).Fcount++ if (*THash)(unsafe.Pointer(pH)).Fcount >= uint32(10) && (*THash)(unsafe.Pointer(pH)).Fcount > uint32(2)*(*THash)(unsafe.Pointer(pH)).Fhtsize { if _rehash(tls, pH, (*THash)(unsafe.Pointer(pH)).Fcount*uint32(2)) != 0 { - _ = libc.Int32FromInt32(0) *(*uint32)(unsafe.Pointer(bp)) = _strHash(tls, pKey) % (*THash)(unsafe.Pointer(pH)).Fhtsize } } @@ -23729,292 +23379,413 @@ func _sqlite3OpcodeName(tls *libc.TLS, i int32) (r uintptr) { } var _azName = [190]uintptr{ - 0: __ccgo_ts + 1786, - 1: __ccgo_ts + 1796, - 2: __ccgo_ts + 1807, - 3: __ccgo_ts + 1819, - 4: __ccgo_ts + 1830, - 5: __ccgo_ts + 1842, - 6: __ccgo_ts + 1849, - 7: __ccgo_ts + 1857, - 8: __ccgo_ts + 1865, - 9: __ccgo_ts + 1870, - 10: __ccgo_ts + 1875, - 11: __ccgo_ts + 1881, - 12: __ccgo_ts + 1895, - 13: __ccgo_ts + 1901, - 14: __ccgo_ts + 1911, - 15: __ccgo_ts + 1916, - 16: __ccgo_ts + 1921, - 17: __ccgo_ts + 1924, - 18: __ccgo_ts + 1930, - 19: __ccgo_ts + 1937, - 20: __ccgo_ts + 1941, - 21: __ccgo_ts + 1951, - 22: __ccgo_ts + 1958, - 23: __ccgo_ts + 1965, - 24: __ccgo_ts + 1972, - 25: __ccgo_ts + 1979, - 26: __ccgo_ts + 1989, - 27: __ccgo_ts + 1998, - 28: __ccgo_ts + 2009, - 29: __ccgo_ts + 2018, - 30: __ccgo_ts + 2024, - 31: __ccgo_ts + 2034, - 32: __ccgo_ts + 2044, - 33: __ccgo_ts + 2049, - 34: __ccgo_ts + 2059, - 35: __ccgo_ts + 2070, - 36: __ccgo_ts + 2075, - 37: __ccgo_ts + 2082, - 38: __ccgo_ts + 2093, - 39: __ccgo_ts + 2098, - 40: __ccgo_ts + 2103, - 41: __ccgo_ts + 2109, - 42: __ccgo_ts + 2115, - 43: __ccgo_ts + 2121, - 44: __ccgo_ts + 2124, - 45: __ccgo_ts + 2128, - 46: __ccgo_ts + 2134, - 47: __ccgo_ts + 2145, - 48: __ccgo_ts + 2156, - 49: __ccgo_ts + 2164, - 50: __ccgo_ts + 2173, - 51: __ccgo_ts + 2180, - 52: __ccgo_ts + 2188, - 53: __ccgo_ts + 2191, - 54: __ccgo_ts + 2194, - 55: __ccgo_ts + 2197, - 56: __ccgo_ts + 2200, - 57: __ccgo_ts + 2203, - 58: __ccgo_ts + 2206, - 59: __ccgo_ts + 2213, - 60: __ccgo_ts + 2219, - 61: __ccgo_ts + 2229, - 62: __ccgo_ts + 2242, - 63: __ccgo_ts + 2253, - 64: __ccgo_ts + 2259, - 65: __ccgo_ts + 2266, - 66: __ccgo_ts + 2275, - 67: __ccgo_ts + 2284, - 68: __ccgo_ts + 2291, - 69: __ccgo_ts + 2304, - 70: __ccgo_ts + 2315, - 71: __ccgo_ts + 2320, - 72: __ccgo_ts + 2328, - 73: __ccgo_ts + 2334, - 74: __ccgo_ts + 2341, - 75: __ccgo_ts + 2353, - 76: __ccgo_ts + 2358, - 77: __ccgo_ts + 2367, - 78: __ccgo_ts + 2372, - 79: __ccgo_ts + 2381, - 80: __ccgo_ts + 2386, - 81: __ccgo_ts + 2391, - 82: __ccgo_ts + 2397, - 83: __ccgo_ts + 2405, - 84: __ccgo_ts + 2413, - 85: __ccgo_ts + 2423, - 86: __ccgo_ts + 2431, - 87: __ccgo_ts + 2438, - 88: __ccgo_ts + 2451, - 89: __ccgo_ts + 2456, - 90: __ccgo_ts + 2468, - 91: __ccgo_ts + 2476, - 92: __ccgo_ts + 2483, - 93: __ccgo_ts + 2494, - 94: __ccgo_ts + 2501, - 95: __ccgo_ts + 2508, - 96: __ccgo_ts + 2518, - 97: __ccgo_ts + 2527, - 98: __ccgo_ts + 2538, - 99: __ccgo_ts + 2544, - 100: __ccgo_ts + 2555, - 101: __ccgo_ts + 2565, - 102: __ccgo_ts + 2575, - 103: __ccgo_ts + 2582, - 104: __ccgo_ts + 2588, - 105: __ccgo_ts + 2598, - 106: __ccgo_ts + 2609, - 107: __ccgo_ts + 2613, - 108: __ccgo_ts + 2622, - 109: __ccgo_ts + 2631, - 110: __ccgo_ts + 2638, - 111: __ccgo_ts + 2648, - 112: __ccgo_ts + 2655, - 113: __ccgo_ts + 2664, - 114: __ccgo_ts + 2674, - 115: __ccgo_ts + 2681, - 116: __ccgo_ts + 2689, - 117: __ccgo_ts + 2703, - 118: __ccgo_ts + 2711, - 119: __ccgo_ts + 2725, - 120: __ccgo_ts + 2736, - 121: __ccgo_ts + 2749, - 122: __ccgo_ts + 2760, - 123: __ccgo_ts + 2766, - 124: __ccgo_ts + 2778, - 125: __ccgo_ts + 2787, - 126: __ccgo_ts + 2795, - 127: __ccgo_ts + 2804, - 128: __ccgo_ts + 2813, - 129: __ccgo_ts + 2820, - 130: __ccgo_ts + 2828, - 131: __ccgo_ts + 2835, - 132: __ccgo_ts + 2846, - 133: __ccgo_ts + 2860, - 134: __ccgo_ts + 2871, - 135: __ccgo_ts + 2879, - 136: __ccgo_ts + 2885, - 137: __ccgo_ts + 2893, - 138: __ccgo_ts + 2901, - 139: __ccgo_ts + 2911, - 140: __ccgo_ts + 2924, - 141: __ccgo_ts + 2934, - 142: __ccgo_ts + 2947, - 143: __ccgo_ts + 2956, - 144: __ccgo_ts + 2967, - 145: __ccgo_ts + 2975, - 146: __ccgo_ts + 2981, - 147: __ccgo_ts + 2993, - 148: __ccgo_ts + 3005, - 149: __ccgo_ts + 3013, - 150: __ccgo_ts + 3025, - 151: __ccgo_ts + 3038, - 152: __ccgo_ts + 3048, - 153: __ccgo_ts + 3058, - 154: __ccgo_ts + 3063, - 155: __ccgo_ts + 3075, - 156: __ccgo_ts + 3087, - 157: __ccgo_ts + 3097, - 158: __ccgo_ts + 3103, - 159: __ccgo_ts + 3113, - 160: __ccgo_ts + 3120, - 161: __ccgo_ts + 3132, - 162: __ccgo_ts + 3143, - 163: __ccgo_ts + 3151, - 164: __ccgo_ts + 3160, - 165: __ccgo_ts + 3169, - 166: __ccgo_ts + 3178, - 167: __ccgo_ts + 3185, - 168: __ccgo_ts + 3196, - 169: __ccgo_ts + 3209, - 170: __ccgo_ts + 3219, - 171: __ccgo_ts + 3226, - 172: __ccgo_ts + 3234, - 173: __ccgo_ts + 3243, - 174: __ccgo_ts + 3249, - 175: __ccgo_ts + 3256, - 176: __ccgo_ts + 3264, - 177: __ccgo_ts + 3272, - 178: __ccgo_ts + 3280, - 179: __ccgo_ts + 3290, - 180: __ccgo_ts + 3299, - 181: __ccgo_ts + 3310, - 182: __ccgo_ts + 3321, - 183: __ccgo_ts + 3332, - 184: __ccgo_ts + 3342, - 185: __ccgo_ts + 3348, - 186: __ccgo_ts + 3359, - 187: __ccgo_ts + 3370, - 188: __ccgo_ts + 3375, - 189: __ccgo_ts + 3383, + 0: __ccgo_ts + 1790, + 1: __ccgo_ts + 1800, + 2: __ccgo_ts + 1811, + 3: __ccgo_ts + 1823, + 4: __ccgo_ts + 1834, + 5: __ccgo_ts + 1846, + 6: __ccgo_ts + 1853, + 7: __ccgo_ts + 1861, + 8: __ccgo_ts + 1869, + 9: __ccgo_ts + 1874, + 10: __ccgo_ts + 1879, + 11: __ccgo_ts + 1885, + 12: __ccgo_ts + 1899, + 13: __ccgo_ts + 1905, + 14: __ccgo_ts + 1915, + 15: __ccgo_ts + 1920, + 16: __ccgo_ts + 1925, + 17: __ccgo_ts + 1928, + 18: __ccgo_ts + 1934, + 19: __ccgo_ts + 1941, + 20: __ccgo_ts + 1945, + 21: __ccgo_ts + 1955, + 22: __ccgo_ts + 1962, + 23: __ccgo_ts + 1969, + 24: __ccgo_ts + 1976, + 25: __ccgo_ts + 1983, + 26: __ccgo_ts + 1993, + 27: __ccgo_ts + 2002, + 28: __ccgo_ts + 2013, + 29: __ccgo_ts + 2022, + 30: __ccgo_ts + 2028, + 31: __ccgo_ts + 2038, + 32: __ccgo_ts + 2048, + 33: __ccgo_ts + 2053, + 34: __ccgo_ts + 2063, + 35: __ccgo_ts + 2074, + 36: __ccgo_ts + 2079, + 37: __ccgo_ts + 2086, + 38: __ccgo_ts + 2097, + 39: __ccgo_ts + 2102, + 40: __ccgo_ts + 2107, + 41: __ccgo_ts + 2113, + 42: __ccgo_ts + 2119, + 43: __ccgo_ts + 2125, + 44: __ccgo_ts + 2128, + 45: __ccgo_ts + 2132, + 46: __ccgo_ts + 2138, + 47: __ccgo_ts + 2149, + 48: __ccgo_ts + 2160, + 49: __ccgo_ts + 2168, + 50: __ccgo_ts + 2177, + 51: __ccgo_ts + 2184, + 52: __ccgo_ts + 2192, + 53: __ccgo_ts + 2195, + 54: __ccgo_ts + 2198, + 55: __ccgo_ts + 2201, + 56: __ccgo_ts + 2204, + 57: __ccgo_ts + 2207, + 58: __ccgo_ts + 2210, + 59: __ccgo_ts + 2217, + 60: __ccgo_ts + 2223, + 61: __ccgo_ts + 2233, + 62: __ccgo_ts + 2246, + 63: __ccgo_ts + 2257, + 64: __ccgo_ts + 2263, + 65: __ccgo_ts + 2270, + 66: __ccgo_ts + 2279, + 67: __ccgo_ts + 2288, + 68: __ccgo_ts + 2295, + 69: __ccgo_ts + 2308, + 70: __ccgo_ts + 2319, + 71: __ccgo_ts + 2324, + 72: __ccgo_ts + 2332, + 73: __ccgo_ts + 2338, + 74: __ccgo_ts + 2345, + 75: __ccgo_ts + 2357, + 76: __ccgo_ts + 2362, + 77: __ccgo_ts + 2371, + 78: __ccgo_ts + 2376, + 79: __ccgo_ts + 2385, + 80: __ccgo_ts + 2390, + 81: __ccgo_ts + 2395, + 82: __ccgo_ts + 2401, + 83: __ccgo_ts + 2409, + 84: __ccgo_ts + 2417, + 85: __ccgo_ts + 2427, + 86: __ccgo_ts + 2435, + 87: __ccgo_ts + 2442, + 88: __ccgo_ts + 2455, + 89: __ccgo_ts + 2460, + 90: __ccgo_ts + 2472, + 91: __ccgo_ts + 2480, + 92: __ccgo_ts + 2487, + 93: __ccgo_ts + 2498, + 94: __ccgo_ts + 2505, + 95: __ccgo_ts + 2512, + 96: __ccgo_ts + 2522, + 97: __ccgo_ts + 2531, + 98: __ccgo_ts + 2542, + 99: __ccgo_ts + 2548, + 100: __ccgo_ts + 2559, + 101: __ccgo_ts + 2569, + 102: __ccgo_ts + 2579, + 103: __ccgo_ts + 2586, + 104: __ccgo_ts + 2592, + 105: __ccgo_ts + 2602, + 106: __ccgo_ts + 2613, + 107: __ccgo_ts + 2617, + 108: __ccgo_ts + 2626, + 109: __ccgo_ts + 2635, + 110: __ccgo_ts + 2642, + 111: __ccgo_ts + 2652, + 112: __ccgo_ts + 2659, + 113: __ccgo_ts + 2668, + 114: __ccgo_ts + 2678, + 115: __ccgo_ts + 2685, + 116: __ccgo_ts + 2693, + 117: __ccgo_ts + 2707, + 118: __ccgo_ts + 2715, + 119: __ccgo_ts + 2729, + 120: __ccgo_ts + 2740, + 121: __ccgo_ts + 2753, + 122: __ccgo_ts + 2764, + 123: __ccgo_ts + 2770, + 124: __ccgo_ts + 2782, + 125: __ccgo_ts + 2791, + 126: __ccgo_ts + 2799, + 127: __ccgo_ts + 2808, + 128: __ccgo_ts + 2817, + 129: __ccgo_ts + 2824, + 130: __ccgo_ts + 2832, + 131: __ccgo_ts + 2839, + 132: __ccgo_ts + 2850, + 133: __ccgo_ts + 2864, + 134: __ccgo_ts + 2875, + 135: __ccgo_ts + 2883, + 136: __ccgo_ts + 2889, + 137: __ccgo_ts + 2897, + 138: __ccgo_ts + 2905, + 139: __ccgo_ts + 2915, + 140: __ccgo_ts + 2928, + 141: __ccgo_ts + 2938, + 142: __ccgo_ts + 2951, + 143: __ccgo_ts + 2960, + 144: __ccgo_ts + 2971, + 145: __ccgo_ts + 2979, + 146: __ccgo_ts + 2985, + 147: __ccgo_ts + 2997, + 148: __ccgo_ts + 3009, + 149: __ccgo_ts + 3017, + 150: __ccgo_ts + 3029, + 151: __ccgo_ts + 3042, + 152: __ccgo_ts + 3052, + 153: __ccgo_ts + 3062, + 154: __ccgo_ts + 3067, + 155: __ccgo_ts + 3079, + 156: __ccgo_ts + 3091, + 157: __ccgo_ts + 3101, + 158: __ccgo_ts + 3107, + 159: __ccgo_ts + 3117, + 160: __ccgo_ts + 3124, + 161: __ccgo_ts + 3136, + 162: __ccgo_ts + 3147, + 163: __ccgo_ts + 3155, + 164: __ccgo_ts + 3164, + 165: __ccgo_ts + 3173, + 166: __ccgo_ts + 3182, + 167: __ccgo_ts + 3189, + 168: __ccgo_ts + 3200, + 169: __ccgo_ts + 3213, + 170: __ccgo_ts + 3223, + 171: __ccgo_ts + 3230, + 172: __ccgo_ts + 3238, + 173: __ccgo_ts + 3247, + 174: __ccgo_ts + 3253, + 175: __ccgo_ts + 3260, + 176: __ccgo_ts + 3268, + 177: __ccgo_ts + 3276, + 178: __ccgo_ts + 3284, + 179: __ccgo_ts + 3294, + 180: __ccgo_ts + 3303, + 181: __ccgo_ts + 3314, + 182: __ccgo_ts + 3325, + 183: __ccgo_ts + 3336, + 184: __ccgo_ts + 3346, + 185: __ccgo_ts + 3352, + 186: __ccgo_ts + 3363, + 187: __ccgo_ts + 3374, + 188: __ccgo_ts + 3379, + 189: __ccgo_ts + 3387, +} + +type Tregister_t = int64 + +type register_t = Tregister_t + +type Tsuseconds_t = int64 + +type suseconds_t = Tsuseconds_t + +type Tint8_t = int8 + +type int8_t = Tint8_t + +type Tint16_t = int16 + +type int16_t = Tint16_t + +type Tint32_t = int32 + +type int32_t = Tint32_t + +type Tint64_t = int64 + +type int64_t = Tint64_t + +type Tu_int64_t = uint64 + +type u_int64_t = Tu_int64_t + +type Tmode_t = uint32 + +type mode_t = Tmode_t + +type Tnlink_t = uint64 + +type nlink_t = Tnlink_t + +type Tino_t = uint64 + +type ino_t = Tino_t + +type Tdev_t = uint64 + +type dev_t = Tdev_t + +type Tblksize_t = int64 + +type blksize_t = Tblksize_t + +type Tblkcnt_t = int64 + +type blkcnt_t = Tblkcnt_t + +type Tfsblkcnt_t = uint64 + +type fsblkcnt_t = Tfsblkcnt_t + +type Tfsfilcnt_t = uint64 + +type fsfilcnt_t = Tfsfilcnt_t + +type Tid_t = uint32 + +type id_t = Tid_t + +type Tuid_t = uint32 + +type uid_t = Tuid_t + +type Tgid_t = uint32 + +type gid_t = Tgid_t + +type Tkey_t = int32 + +type key_t = Tkey_t + +type Tuseconds_t = uint32 + +type useconds_t = Tuseconds_t + +type Tu_int8_t = uint8 + +type u_int8_t = Tu_int8_t + +type Tu_int16_t = uint16 + +type u_int16_t = Tu_int16_t + +type Tu_int32_t = uint32 + +type u_int32_t = Tu_int32_t + +type Tcaddr_t = uintptr + +type caddr_t = Tcaddr_t + +type Tu_char = uint8 + +type u_char = Tu_char + +type Tu_short = uint16 + +type u_short = Tu_short + +type Tushort = uint16 + +type ushort = Tushort + +type Tu_int = uint32 + +type u_int = Tu_int + +type Tuint = uint32 + +type uint = Tuint + +type Tu_long = uint64 + +type u_long = Tu_long + +type Tulong = uint64 + +type ulong = Tulong + +type Tquad_t = int64 + +type quad_t = Tquad_t + +type Tu_quad_t = uint64 + +type u_quad_t = Tu_quad_t + +type Tuint16_t = uint16 + +type uint16_t = Tuint16_t + +type Tuint32_t = uint32 + +type uint32_t = Tuint32_t + +type Tuint64_t = uint64 + +type uint64_t = Tuint64_t + +type Ttimeval = struct { + Ftv_sec Ttime_t + Ftv_usec Tsuseconds_t } +type timeval = Ttimeval + +type Tfd_mask = uint64 + +type fd_mask = Tfd_mask + +type Tfd_set = struct { + Ffds_bits [16]uint64 +} + +type fd_set = Tfd_set + type Tstat = struct { - Fst_dev t__dev_t - Fst_ino t__ino_t - Fst_nlink t__nlink_t - Fst_mode t__mode_t - Fst_uid t__uid_t - Fst_gid t__gid_t - F__pad0 int32 - Fst_rdev t__dev_t - Fst_size t__off_t - Fst_blksize t__blksize_t - Fst_blocks t__blkcnt_t - Fst_atim Ttimespec - Fst_mtim Ttimespec - Fst_ctim Ttimespec - F__glibc_reserved [3]t__syscall_slong_t + Fst_dev Tdev_t + Fst_ino Tino_t + Fst_nlink Tnlink_t + Fst_mode Tmode_t + Fst_uid Tuid_t + Fst_gid Tgid_t + F__pad0 uint32 + Fst_rdev Tdev_t + Fst_size Toff_t + Fst_blksize Tblksize_t + Fst_blocks Tblkcnt_t + Fst_atim Ttimespec + Fst_mtim Ttimespec + Fst_ctim Ttimespec + F__unused [3]int64 } type stat = Tstat -type Tstat64 = struct { - Fst_dev t__dev_t - Fst_ino t__ino64_t - Fst_nlink t__nlink_t - Fst_mode t__mode_t - Fst_uid t__uid_t - Fst_gid t__gid_t - F__pad0 int32 - Fst_rdev t__dev_t - Fst_size t__off_t - Fst_blksize t__blksize_t - Fst_blocks t__blkcnt64_t - Fst_atim Ttimespec - Fst_mtim Ttimespec - Fst_ctim Ttimespec - F__glibc_reserved [3]t__syscall_slong_t -} - -type stat64 = Tstat64 - type Tstatx_timestamp = struct { - Ftv_sec t__int64_t - Ftv_nsec t__uint32_t - F__statx_timestamp_pad1 [1]t__int32_t + Ftv_sec Tint64_t + Ftv_nsec Tuint32_t + F__pad Tuint32_t } type statx_timestamp = Tstatx_timestamp type Tstatx = struct { - Fstx_mask t__uint32_t - Fstx_blksize t__uint32_t - Fstx_attributes t__uint64_t - Fstx_nlink t__uint32_t - Fstx_uid t__uint32_t - Fstx_gid t__uint32_t - Fstx_mode t__uint16_t - F__statx_pad1 [1]t__uint16_t - Fstx_ino t__uint64_t - Fstx_size t__uint64_t - Fstx_blocks t__uint64_t - Fstx_attributes_mask t__uint64_t + Fstx_mask Tuint32_t + Fstx_blksize Tuint32_t + Fstx_attributes Tuint64_t + Fstx_nlink Tuint32_t + Fstx_uid Tuint32_t + Fstx_gid Tuint32_t + Fstx_mode Tuint16_t + F__pad0 [1]Tuint16_t + Fstx_ino Tuint64_t + Fstx_size Tuint64_t + Fstx_blocks Tuint64_t + Fstx_attributes_mask Tuint64_t Fstx_atime Tstatx_timestamp Fstx_btime Tstatx_timestamp Fstx_ctime Tstatx_timestamp Fstx_mtime Tstatx_timestamp - Fstx_rdev_major t__uint32_t - Fstx_rdev_minor t__uint32_t - Fstx_dev_major t__uint32_t - Fstx_dev_minor t__uint32_t - F__statx_pad2 [14]t__uint64_t + Fstx_rdev_major Tuint32_t + Fstx_rdev_minor Tuint32_t + Fstx_dev_major Tuint32_t + Fstx_dev_minor Tuint32_t + F__pad1 [14]Tuint64_t } type statx = Tstatx -type Tflock = struct { - Fl_type int16 - Fl_whence int16 - Fl_start t__off64_t - Fl_len t__off64_t - Fl_pid t__pid_t -} - -type flock = Tflock - -type Tflock64 = struct { - Fl_type int16 - Fl_whence int16 - Fl_start t__off64_t - Fl_len t__off64_t - Fl_pid t__pid_t -} - -type flock64 = Tflock64 - type Tiovec = struct { Fiov_base uintptr Fiov_len Tsize_t @@ -24022,19 +23793,15 @@ type Tiovec = struct { type iovec = Tiovec -type ___pid_type = int32 - -const _F_OWNER_TID = 0 -const _F_OWNER_PID = 1 -const _F_OWNER_PGRP = 2 -const _F_OWNER_GID = 2 - -type Tf_owner_ex = struct { - Ftype1 ___pid_type - Fpid t__pid_t +type Tflock = struct { + Fl_type int16 + Fl_whence int16 + Fl_start Toff_t + Fl_len Toff_t + Fl_pid Tpid_t } -type f_owner_ex = Tf_owner_ex +type flock = Tflock type Tfile_handle = struct { Fhandle_bytes uint32 @@ -24043,6 +23810,13 @@ type Tfile_handle = struct { type file_handle = Tfile_handle +type Tf_owner_ex = struct { + Ftype1 int32 + Fpid Tpid_t +} + +type f_owner_ex = Tf_owner_ex + type Twinsize = struct { Fws_row uint16 Fws_col uint16 @@ -24052,341 +23826,10 @@ type Twinsize = struct { type winsize = Twinsize -type Ttermio = struct { - Fc_iflag uint16 - Fc_oflag uint16 - Fc_cflag uint16 - Fc_lflag uint16 - Fc_line uint8 - Fc_cc [8]uint8 -} - -type termio = Ttermio - type Tintptr_t = int64 type intptr_t = Tintptr_t -type Tsocklen_t = uint32 - -type socklen_t = Tsocklen_t - -const __PC_LINK_MAX = 0 -const __PC_MAX_CANON = 1 -const __PC_MAX_INPUT = 2 -const __PC_NAME_MAX = 3 -const __PC_PATH_MAX = 4 -const __PC_PIPE_BUF = 5 -const __PC_CHOWN_RESTRICTED = 6 -const __PC_NO_TRUNC = 7 -const __PC_VDISABLE = 8 -const __PC_SYNC_IO = 9 -const __PC_ASYNC_IO = 10 -const __PC_PRIO_IO = 11 -const __PC_SOCK_MAXBUF = 12 -const __PC_FILESIZEBITS = 13 -const __PC_REC_INCR_XFER_SIZE = 14 -const __PC_REC_MAX_XFER_SIZE = 15 -const __PC_REC_MIN_XFER_SIZE = 16 -const __PC_REC_XFER_ALIGN = 17 -const __PC_ALLOC_SIZE_MIN = 18 -const __PC_SYMLINK_MAX = 19 -const __PC_2_SYMLINKS = 20 -const __SC_ARG_MAX = 0 -const __SC_CHILD_MAX = 1 -const __SC_CLK_TCK = 2 -const __SC_NGROUPS_MAX = 3 -const __SC_OPEN_MAX = 4 -const __SC_STREAM_MAX = 5 -const __SC_TZNAME_MAX = 6 -const __SC_JOB_CONTROL = 7 -const __SC_SAVED_IDS = 8 -const __SC_REALTIME_SIGNALS = 9 -const __SC_PRIORITY_SCHEDULING = 10 -const __SC_TIMERS = 11 -const __SC_ASYNCHRONOUS_IO = 12 -const __SC_PRIORITIZED_IO = 13 -const __SC_SYNCHRONIZED_IO = 14 -const __SC_FSYNC = 15 -const __SC_MAPPED_FILES = 16 -const __SC_MEMLOCK = 17 -const __SC_MEMLOCK_RANGE = 18 -const __SC_MEMORY_PROTECTION = 19 -const __SC_MESSAGE_PASSING = 20 -const __SC_SEMAPHORES = 21 -const __SC_SHARED_MEMORY_OBJECTS = 22 -const __SC_AIO_LISTIO_MAX = 23 -const __SC_AIO_MAX = 24 -const __SC_AIO_PRIO_DELTA_MAX = 25 -const __SC_DELAYTIMER_MAX = 26 -const __SC_MQ_OPEN_MAX = 27 -const __SC_MQ_PRIO_MAX = 28 -const __SC_VERSION = 29 -const __SC_PAGESIZE = 30 -const __SC_RTSIG_MAX = 31 -const __SC_SEM_NSEMS_MAX = 32 -const __SC_SEM_VALUE_MAX = 33 -const __SC_SIGQUEUE_MAX = 34 -const __SC_TIMER_MAX = 35 -const __SC_BC_BASE_MAX = 36 -const __SC_BC_DIM_MAX = 37 -const __SC_BC_SCALE_MAX = 38 -const __SC_BC_STRING_MAX = 39 -const __SC_COLL_WEIGHTS_MAX = 40 -const __SC_EQUIV_CLASS_MAX = 41 -const __SC_EXPR_NEST_MAX = 42 -const __SC_LINE_MAX = 43 -const __SC_RE_DUP_MAX = 44 -const __SC_CHARCLASS_NAME_MAX = 45 -const __SC_2_VERSION = 46 -const __SC_2_C_BIND = 47 -const __SC_2_C_DEV = 48 -const __SC_2_FORT_DEV = 49 -const __SC_2_FORT_RUN = 50 -const __SC_2_SW_DEV = 51 -const __SC_2_LOCALEDEF = 52 -const __SC_PII = 53 -const __SC_PII_XTI = 54 -const __SC_PII_SOCKET = 55 -const __SC_PII_INTERNET = 56 -const __SC_PII_OSI = 57 -const __SC_POLL = 58 -const __SC_SELECT = 59 -const __SC_UIO_MAXIOV = 60 -const __SC_IOV_MAX = 60 -const __SC_PII_INTERNET_STREAM = 61 -const __SC_PII_INTERNET_DGRAM = 62 -const __SC_PII_OSI_COTS = 63 -const __SC_PII_OSI_CLTS = 64 -const __SC_PII_OSI_M = 65 -const __SC_T_IOV_MAX = 66 -const __SC_THREADS = 67 -const __SC_THREAD_SAFE_FUNCTIONS = 68 -const __SC_GETGR_R_SIZE_MAX = 69 -const __SC_GETPW_R_SIZE_MAX = 70 -const __SC_LOGIN_NAME_MAX = 71 -const __SC_TTY_NAME_MAX = 72 -const __SC_THREAD_DESTRUCTOR_ITERATIONS = 73 -const __SC_THREAD_KEYS_MAX = 74 -const __SC_THREAD_STACK_MIN = 75 -const __SC_THREAD_THREADS_MAX = 76 -const __SC_THREAD_ATTR_STACKADDR = 77 -const __SC_THREAD_ATTR_STACKSIZE = 78 -const __SC_THREAD_PRIORITY_SCHEDULING = 79 -const __SC_THREAD_PRIO_INHERIT = 80 -const __SC_THREAD_PRIO_PROTECT = 81 -const __SC_THREAD_PROCESS_SHARED = 82 -const __SC_NPROCESSORS_CONF = 83 -const __SC_NPROCESSORS_ONLN = 84 -const __SC_PHYS_PAGES = 85 -const __SC_AVPHYS_PAGES = 86 -const __SC_ATEXIT_MAX = 87 -const __SC_PASS_MAX = 88 -const __SC_XOPEN_VERSION = 89 -const __SC_XOPEN_XCU_VERSION = 90 -const __SC_XOPEN_UNIX = 91 -const __SC_XOPEN_CRYPT = 92 -const __SC_XOPEN_ENH_I18N = 93 -const __SC_XOPEN_SHM = 94 -const __SC_2_CHAR_TERM = 95 -const __SC_2_C_VERSION = 96 -const __SC_2_UPE = 97 -const __SC_XOPEN_XPG2 = 98 -const __SC_XOPEN_XPG3 = 99 -const __SC_XOPEN_XPG4 = 100 -const __SC_CHAR_BIT = 101 -const __SC_CHAR_MAX = 102 -const __SC_CHAR_MIN = 103 -const __SC_INT_MAX = 104 -const __SC_INT_MIN = 105 -const __SC_LONG_BIT = 106 -const __SC_WORD_BIT = 107 -const __SC_MB_LEN_MAX = 108 -const __SC_NZERO = 109 -const __SC_SSIZE_MAX = 110 -const __SC_SCHAR_MAX = 111 -const __SC_SCHAR_MIN = 112 -const __SC_SHRT_MAX = 113 -const __SC_SHRT_MIN = 114 -const __SC_UCHAR_MAX = 115 -const __SC_UINT_MAX = 116 -const __SC_ULONG_MAX = 117 -const __SC_USHRT_MAX = 118 -const __SC_NL_ARGMAX = 119 -const __SC_NL_LANGMAX = 120 -const __SC_NL_MSGMAX = 121 -const __SC_NL_NMAX = 122 -const __SC_NL_SETMAX = 123 -const __SC_NL_TEXTMAX = 124 -const __SC_XBS5_ILP32_OFF32 = 125 -const __SC_XBS5_ILP32_OFFBIG = 126 -const __SC_XBS5_LP64_OFF64 = 127 -const __SC_XBS5_LPBIG_OFFBIG = 128 -const __SC_XOPEN_LEGACY = 129 -const __SC_XOPEN_REALTIME = 130 -const __SC_XOPEN_REALTIME_THREADS = 131 -const __SC_ADVISORY_INFO = 132 -const __SC_BARRIERS = 133 -const __SC_BASE = 134 -const __SC_C_LANG_SUPPORT = 135 -const __SC_C_LANG_SUPPORT_R = 136 -const __SC_CLOCK_SELECTION = 137 -const __SC_CPUTIME = 138 -const __SC_THREAD_CPUTIME = 139 -const __SC_DEVICE_IO = 140 -const __SC_DEVICE_SPECIFIC = 141 -const __SC_DEVICE_SPECIFIC_R = 142 -const __SC_FD_MGMT = 143 -const __SC_FIFO = 144 -const __SC_PIPE = 145 -const __SC_FILE_ATTRIBUTES = 146 -const __SC_FILE_LOCKING = 147 -const __SC_FILE_SYSTEM = 148 -const __SC_MONOTONIC_CLOCK = 149 -const __SC_MULTI_PROCESS = 150 -const __SC_SINGLE_PROCESS = 151 -const __SC_NETWORKING = 152 -const __SC_READER_WRITER_LOCKS = 153 -const __SC_SPIN_LOCKS = 154 -const __SC_REGEXP = 155 -const __SC_REGEX_VERSION = 156 -const __SC_SHELL = 157 -const __SC_SIGNALS = 158 -const __SC_SPAWN = 159 -const __SC_SPORADIC_SERVER = 160 -const __SC_THREAD_SPORADIC_SERVER = 161 -const __SC_SYSTEM_DATABASE = 162 -const __SC_SYSTEM_DATABASE_R = 163 -const __SC_TIMEOUTS = 164 -const __SC_TYPED_MEMORY_OBJECTS = 165 -const __SC_USER_GROUPS = 166 -const __SC_USER_GROUPS_R = 167 -const __SC_2_PBS = 168 -const __SC_2_PBS_ACCOUNTING = 169 -const __SC_2_PBS_LOCATE = 170 -const __SC_2_PBS_MESSAGE = 171 -const __SC_2_PBS_TRACK = 172 -const __SC_SYMLOOP_MAX = 173 -const __SC_STREAMS = 174 -const __SC_2_PBS_CHECKPOINT = 175 -const __SC_V6_ILP32_OFF32 = 176 -const __SC_V6_ILP32_OFFBIG = 177 -const __SC_V6_LP64_OFF64 = 178 -const __SC_V6_LPBIG_OFFBIG = 179 -const __SC_HOST_NAME_MAX = 180 -const __SC_TRACE = 181 -const __SC_TRACE_EVENT_FILTER = 182 -const __SC_TRACE_INHERIT = 183 -const __SC_TRACE_LOG = 184 -const __SC_LEVEL1_ICACHE_SIZE = 185 -const __SC_LEVEL1_ICACHE_ASSOC = 186 -const __SC_LEVEL1_ICACHE_LINESIZE = 187 -const __SC_LEVEL1_DCACHE_SIZE = 188 -const __SC_LEVEL1_DCACHE_ASSOC = 189 -const __SC_LEVEL1_DCACHE_LINESIZE = 190 -const __SC_LEVEL2_CACHE_SIZE = 191 -const __SC_LEVEL2_CACHE_ASSOC = 192 -const __SC_LEVEL2_CACHE_LINESIZE = 193 -const __SC_LEVEL3_CACHE_SIZE = 194 -const __SC_LEVEL3_CACHE_ASSOC = 195 -const __SC_LEVEL3_CACHE_LINESIZE = 196 -const __SC_LEVEL4_CACHE_SIZE = 197 -const __SC_LEVEL4_CACHE_ASSOC = 198 -const __SC_LEVEL4_CACHE_LINESIZE = 199 -const __SC_IPV6 = 235 -const __SC_RAW_SOCKETS = 236 -const __SC_V7_ILP32_OFF32 = 237 -const __SC_V7_ILP32_OFFBIG = 238 -const __SC_V7_LP64_OFF64 = 239 -const __SC_V7_LPBIG_OFFBIG = 240 -const __SC_SS_REPL_MAX = 241 -const __SC_TRACE_EVENT_NAME_MAX = 242 -const __SC_TRACE_NAME_MAX = 243 -const __SC_TRACE_SYS_MAX = 244 -const __SC_TRACE_USER_EVENT_MAX = 245 -const __SC_XOPEN_STREAMS = 246 -const __SC_THREAD_ROBUST_PRIO_INHERIT = 247 -const __SC_THREAD_ROBUST_PRIO_PROTECT = 248 -const __SC_MINSIGSTKSZ = 249 -const __SC_SIGSTKSZ = 250 -const __CS_PATH = 0 -const __CS_V6_WIDTH_RESTRICTED_ENVS = 1 -const __CS_GNU_LIBC_VERSION = 2 -const __CS_GNU_LIBPTHREAD_VERSION = 3 -const __CS_V5_WIDTH_RESTRICTED_ENVS = 4 -const __CS_V7_WIDTH_RESTRICTED_ENVS = 5 -const __CS_LFS_CFLAGS = 1000 -const __CS_LFS_LDFLAGS = 1001 -const __CS_LFS_LIBS = 1002 -const __CS_LFS_LINTFLAGS = 1003 -const __CS_LFS64_CFLAGS = 1004 -const __CS_LFS64_LDFLAGS = 1005 -const __CS_LFS64_LIBS = 1006 -const __CS_LFS64_LINTFLAGS = 1007 -const __CS_XBS5_ILP32_OFF32_CFLAGS = 1100 -const __CS_XBS5_ILP32_OFF32_LDFLAGS = 1101 -const __CS_XBS5_ILP32_OFF32_LIBS = 1102 -const __CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103 -const __CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104 -const __CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105 -const __CS_XBS5_ILP32_OFFBIG_LIBS = 1106 -const __CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107 -const __CS_XBS5_LP64_OFF64_CFLAGS = 1108 -const __CS_XBS5_LP64_OFF64_LDFLAGS = 1109 -const __CS_XBS5_LP64_OFF64_LIBS = 1110 -const __CS_XBS5_LP64_OFF64_LINTFLAGS = 1111 -const __CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112 -const __CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113 -const __CS_XBS5_LPBIG_OFFBIG_LIBS = 1114 -const __CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115 -const __CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 -const __CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 -const __CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 -const __CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 -const __CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 -const __CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 -const __CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 -const __CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 -const __CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 -const __CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 -const __CS_POSIX_V6_LP64_OFF64_LIBS = 1126 -const __CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 -const __CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 -const __CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 -const __CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 -const __CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 -const __CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 -const __CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 -const __CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 -const __CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 -const __CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 -const __CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 -const __CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 -const __CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 -const __CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 -const __CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 -const __CS_POSIX_V7_LP64_OFF64_LIBS = 1142 -const __CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 -const __CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 -const __CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 -const __CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 -const __CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 -const __CS_V6_ENV = 1148 -const __CS_V7_ENV = 1149 - -type Ttimezone = struct { - Ftz_minuteswest int32 - Ftz_dsttime int32 -} - -type timezone = Ttimezone - -type ___itimer_which = int32 - -const _ITIMER_REAL = 0 -const _ITIMER_VIRTUAL = 1 -const _ITIMER_PROF = 2 - type Titimerval = struct { Fit_interval Ttimeval Fit_value Ttimeval @@ -24394,11 +23837,12 @@ type Titimerval = struct { type itimerval = Titimerval -type t__itimer_which_t = int32 - -type Terror_t = int32 +type Ttimezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} -type error_t = Terror_t +type timezone = Ttimezone /* ** Try to determine if gethostuuid() is available based on standard @@ -24660,91 +24104,91 @@ type unix_syscall = Tunix_syscall // */ var _aSyscall = [29]Tunix_syscall{ 0: { - FzName: __ccgo_ts + 3393, + FzName: __ccgo_ts + 3397, }, 1: { - FzName: __ccgo_ts + 3398, + FzName: __ccgo_ts + 3402, }, 2: { - FzName: __ccgo_ts + 3404, + FzName: __ccgo_ts + 3408, }, 3: { - FzName: __ccgo_ts + 3411, + FzName: __ccgo_ts + 3415, }, 4: { - FzName: __ccgo_ts + 3418, + FzName: __ccgo_ts + 3422, }, 5: { - FzName: __ccgo_ts + 3423, + FzName: __ccgo_ts + 3427, }, 6: { - FzName: __ccgo_ts + 3429, + FzName: __ccgo_ts + 3433, }, 7: { - FzName: __ccgo_ts + 3439, + FzName: __ccgo_ts + 3443, }, 8: { - FzName: __ccgo_ts + 3445, + FzName: __ccgo_ts + 3449, }, 9: { - FzName: __ccgo_ts + 3450, + FzName: __ccgo_ts + 3454, }, 10: { - FzName: __ccgo_ts + 3456, + FzName: __ccgo_ts + 3460, }, 11: { - FzName: __ccgo_ts + 3464, + FzName: __ccgo_ts + 3468, }, 12: { - FzName: __ccgo_ts + 3470, + FzName: __ccgo_ts + 3474, }, 13: { - FzName: __ccgo_ts + 3477, + FzName: __ccgo_ts + 3481, }, 14: { - FzName: __ccgo_ts + 3486, + FzName: __ccgo_ts + 3490, }, 15: { - FzName: __ccgo_ts + 3493, + FzName: __ccgo_ts + 3497, }, 16: { - FzName: __ccgo_ts + 3503, + FzName: __ccgo_ts + 3507, }, 17: { - FzName: __ccgo_ts + 3510, + FzName: __ccgo_ts + 3514, }, 18: { - FzName: __ccgo_ts + 3524, + FzName: __ccgo_ts + 3528, }, 19: { - FzName: __ccgo_ts + 3530, + FzName: __ccgo_ts + 3534, }, 20: { - FzName: __ccgo_ts + 3536, + FzName: __ccgo_ts + 3540, }, 21: { - FzName: __ccgo_ts + 3543, + FzName: __ccgo_ts + 3547, }, 22: { - FzName: __ccgo_ts + 3551, + FzName: __ccgo_ts + 3555, }, 23: { - FzName: __ccgo_ts + 3556, + FzName: __ccgo_ts + 3560, }, 24: { - FzName: __ccgo_ts + 3563, + FzName: __ccgo_ts + 3567, }, 25: { - FzName: __ccgo_ts + 3570, + FzName: __ccgo_ts + 3574, }, 26: { - FzName: __ccgo_ts + 3582, + FzName: __ccgo_ts + 3586, }, 27: { - FzName: __ccgo_ts + 3591, + FzName: __ccgo_ts + 3595, }, 28: { - FzName: __ccgo_ts + 3597, + FzName: __ccgo_ts + 3601, }, } @@ -24826,6 +24270,7 @@ func _unixSetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr, pNewFunc } goto _1 _1: + ; i++ } } else { @@ -24850,6 +24295,7 @@ func _unixSetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr, pNewFunc } goto _2 _2: + ; i++ } } @@ -24877,6 +24323,7 @@ func _unixGetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr) (r Tsqli } goto _1 _1: + ; i++ } return uintptr(0) @@ -24906,6 +24353,7 @@ func _unixNextSystemCall(tls *libc.TLS, p uintptr, zName uintptr) (r uintptr) { } goto _1 _1: + ; i++ } } @@ -24919,6 +24367,7 @@ func _unixNextSystemCall(tls *libc.TLS, p uintptr, zName uintptr) (r uintptr) { } goto _2 _2: + ; i++ } return uintptr(0) @@ -24964,7 +24413,7 @@ func _robust_open(tls *libc.TLS, z uintptr, f int32, m Tmode_t) (r int32) { } m2 = v1 for int32(1) != 0 { - fd = (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, z, f|int32(__O_CLOEXEC), int32(m2)) + fd = (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, z, f|int32(O_CLOEXEC), int32(m2)) if fd < 0 { if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EINTR) { continue @@ -24978,9 +24427,9 @@ func _robust_open(tls *libc.TLS, z uintptr, f int32, m Tmode_t) (r int32) { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, z) } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(1)].FpCurrent})))(tls, fd) - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3603, libc.VaList(bp+152, z, fd)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3607, libc.VaList(bp+152, z, fd)) fd = -int32(1) - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, __ccgo_ts+3646, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, __ccgo_ts+3650, O_RDONLY, int32(m)) < 0 { break } } @@ -25024,12 +24473,11 @@ func _robust_open(tls *libc.TLS, z uintptr, f int32, m Tmode_t) (r int32) { var _unixBigLock = uintptr(0) func _unixEnterMutex(tls *libc.TLS) { - _ = libc.Int32FromInt32(0) /* Not a recursive mutex */ + /* Not a recursive mutex */ Xsqlite3_mutex_enter(tls, _unixBigLock) } func _unixLeaveMutex(tls *libc.TLS) { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, _unixBigLock) } @@ -25064,7 +24512,6 @@ func _robust_ftruncate(tls *libc.TLS, h int32, sz Tsqlite3_int64) (r int32) { // ** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately. // */ func _sqliteErrorFromPosixError(tls *libc.TLS, posixError int32, sqliteIOErr int32) (r int32) { - _ = libc.Int32FromInt32(0) switch posixError { case int32(EACCES): fallthrough @@ -25298,11 +24745,11 @@ func _unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uint ** equivalent to errno. Otherwise, use strerror_r(). */ /* This is a threadsafe build, but strerror_r() is not available. */ - zErr = __ccgo_ts + 1648 + zErr = __ccgo_ts + 1652 if zPath == uintptr(0) { - zPath = __ccgo_ts + 1648 + zPath = __ccgo_ts + 1652 } - Xsqlite3_log(tls, errcode, __ccgo_ts+3656, libc.VaList(bp+8, iLine, iErrno, zFunc, zPath, zErr)) + Xsqlite3_log(tls, errcode, __ccgo_ts+3660, libc.VaList(bp+8, iLine, iErrno, zFunc, zPath, zErr)) return errcode } @@ -25330,7 +24777,7 @@ func _robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { } else { v1 = uintptr(0) } - _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(16)< uint64(1) { - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3740, libc.VaList(bp+152, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3744, libc.VaList(bp+152, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } if _fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3767, libc.VaList(bp+152, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3771, libc.VaList(bp+152, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -25544,8 +24982,6 @@ func _unixCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32 rc = SQLITE_OK reserved = 0 pFile = id - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex) /* Check if a thread in this process holds such a lock */ if int32((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FeFileLock) > int32(SHARED_LOCK) { @@ -25554,11 +24990,11 @@ func _unixCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32 /* Otherwise see if some other process holds it. */ if !(reserved != 0) && !((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FbProcessLock != 0) { - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) - if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_GETLK64), libc.VaList(bp+40, bp)) != 0 { + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(14)<pInode is shared across threads */ pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode @@ -25747,9 +25176,6 @@ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { ** return SQLITE_OK. */ if eFileLock == int32(SHARED_LOCK) && (int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(SHARED_LOCK) || int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(RESERVED_LOCK)) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared++ (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ @@ -25760,7 +25186,7 @@ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { ** be released. */ (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 if eFileLock == int32(SHARED_LOCK) || eFileLock == int32(EXCLUSIVE_LOCK) && int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) == int32(RESERVED_LOCK) { if eFileLock == int32(SHARED_LOCK) { v1 = F_RDLCK @@ -25787,9 +25213,6 @@ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { ** operating system calls for the specified lock. */ if eFileLock == int32(SHARED_LOCK) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Now get the read-lock */ (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(SHARED_SIZE) @@ -25826,9 +25249,7 @@ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { ** assumed that there is a SHARED or greater lock on the file ** already. */ - _ = libc.Int32FromInt32(0) (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) - _ = libc.Int32FromInt32(0) if eFileLock == int32(RESERVED_LOCK) { (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) @@ -25850,6 +25271,7 @@ func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { (*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(eFileLock) } end_lock: + ; Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) return rc } @@ -25865,7 +25287,6 @@ func _setPendingFd(tls *libc.TLS, pFile uintptr) { _, _ = p, pInode pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode p = (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused - _ = libc.Int32FromInt32(0) (*TUnixUnusedFd)(unsafe.Pointer(p)).FpNext = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpUnused (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpUnused = p (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) @@ -25892,21 +25313,17 @@ func _posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock in defer tls.Free(32) var pFile, pInode uintptr var rc int32 - var v1 t__off64_t + var v1 Toff_t var _ /* lock at bp+0 */ Tflock _, _, _, _ = pFile, pInode, rc, v1 pFile = id rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) <= eFileLock { return SQLITE_OK } pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) - _ = libc.Int32FromInt32(0) if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) > int32(SHARED_LOCK) { - _ = libc.Int32FromInt32(0) /* downgrading to a shared lock on NFS involves clearing the write lock ** before establishing the readlock - to avoid a race condition we downgrade ** the lock in 2 blocks, so that part of the range will be covered by a @@ -25918,9 +25335,8 @@ func _posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock in */ if eFileLock == int32(SHARED_LOCK) { _ = handleNFSUnlock - _ = libc.Int32FromInt32(0) (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = F_RDLCK - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(SHARED_SIZE) if _unixFileLock(tls, pFile, bp) != 0 { @@ -25936,10 +25352,9 @@ func _posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock in } } (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_UNLCK) - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(2) - _ = libc.Int32FromInt32(0) if _unixFileLock(tls, pFile, bp) == 0 { (*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(SHARED_LOCK) } else { @@ -25956,7 +25371,7 @@ func _posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock in (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared-- if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared == 0 { (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_UNLCK) - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 v1 = libc.Int64FromInt64(0) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = v1 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = v1 @@ -25974,12 +25389,12 @@ func _posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock in ** was deferred because of outstanding locks. */ (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock-- - _ = libc.Int32FromInt32(0) if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock == 0 { _closePendingFds(tls, pFile) } } end_unlock: + ; Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) if rc == SQLITE_OK { (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) @@ -25997,7 +25412,6 @@ end_unlock: // ** the requested locking level, this routine is a no-op. // */ func _unixUnlock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { - _ = libc.Int32FromInt32(0) return _posixUnlock(tls, id, eFileLock, 0) } @@ -26019,7 +25433,7 @@ func _closeUnixFile(tls *libc.TLS, id uintptr) (r int32) { pFile = id _unixUnmapfile(tls, pFile) if (*TunixFile)(unsafe.Pointer(pFile)).Fh >= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -26039,15 +25453,12 @@ func _unixClose(tls *libc.TLS, id uintptr) (r int32) { rc = SQLITE_OK pFile = id pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode - _ = libc.Int32FromInt32(0) _verifyDbFile(tls, pFile) _unixUnlock(tls, id, NO_LOCK) - _ = libc.Int32FromInt32(0) _unixEnterMutex(tls) /* unixFile.pInode is always valid here. Otherwise, a different close ** routine (e.g. nolockClose()) would be called instead. */ - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock != 0 { /* If there are outstanding locks, do not actually close the file just @@ -26059,7 +25470,6 @@ func _unixClose(tls *libc.TLS, id uintptr) (r int32) { } Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) _releaseInodeInfo(tls, pFile) - _ = libc.Int32FromInt32(0) rc = _closeUnixFile(tls, id) _unixLeaveMutex(tls) return rc @@ -26161,7 +25571,6 @@ func _dotlockCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r in rc = SQLITE_OK reserved = 0 pFile = id - _ = libc.Int32FromInt32(0) reserved = libc.BoolInt32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext, 0) == 0) *(*int32)(unsafe.Pointer(pResOut)) = reserved return rc @@ -26249,8 +25658,6 @@ func _dotlockUnlock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { _, _, _, _ = pFile, rc, tErrno, zLockFile pFile = id zLockFile = (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* no-op if possible */ if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) == eFileLock { return SQLITE_OK @@ -26263,7 +25670,6 @@ func _dotlockUnlock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { return SQLITE_OK } /* To fully unlock the database, delete the lock file */ - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(19)].FpCurrent})))(tls, zLockFile) if rc < 0 { tErrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) @@ -26288,7 +25694,6 @@ func _dotlockClose(tls *libc.TLS, id uintptr) (r int32) { var pFile uintptr _ = pFile pFile = id - _ = libc.Int32FromInt32(0) _dotlockUnlock(tls, id, NO_LOCK) Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext) return _closeUnixFile(tls, id) @@ -26384,8 +25789,6 @@ func _seekAndRead(tls *libc.TLS, id uintptr, offset Tsqlite3_int64, pBuf uintptr var got, prior int32 _, _ = got, prior prior = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = got > 0 { got = int32((*(*func(*libc.TLS, int32, uintptr, Tsize_t, Toff_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(9)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(id)).Fh, pBuf, uint64(cnt), offset)) if got == cnt { @@ -26423,9 +25826,6 @@ func _unixRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Tsqlit var pFile uintptr _, _, _ = got, nCopy, pFile pFile = id - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this is a database file (not a journal, super-journal or temp ** file), the bytes in the locking range should never be read or written. */ /* Deal with as much of this read request as possible by transferring @@ -26486,9 +25886,6 @@ func _seekAndWriteFd(tls *libc.TLS, fd int32, iOff Ti64, pBuf uintptr, nBuf int3 var rc int32 _ = rc rc = 0 /* Value returned by system call */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nBuf &= int32(0x1ffff) for cond := true; cond; cond = rc < 0 && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EINTR) { rc = int32((*(*func(*libc.TLS, int32, uintptr, Tsize_t, Toff_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(12)].FpCurrent})))(tls, fd, pBuf, uint64(nBuf), iOff)) @@ -26524,8 +25921,6 @@ func _unixWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Tsqli _, _, _ = pFile, wrote, v1 pFile = id wrote = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this is a database file (not a journal, super-journal or temp ** file), the bytes in the locking range should never be read or written. */ for { @@ -26646,7 +26041,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { var _ /* zDirname at bp+0 */ [513]int8 _, _ = fd, ii fd = -int32(1) - Xsqlite3_snprintf(tls, int32(MAX_PATHNAME), bp, __ccgo_ts+3795, libc.VaList(bp+528, zFilename)) + Xsqlite3_snprintf(tls, int32(MAX_PATHNAME), bp, __ccgo_ts+3799, libc.VaList(bp+528, zFilename)) ii = int32(libc.Xstrlen(tls, bp)) for { if !(ii > 0 && int32((*(*[513]int8)(unsafe.Pointer(bp)))[ii]) != int32('/')) { @@ -26654,6 +26049,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -26671,7 +26067,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3510, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3514, bp, int32(41778)) } // C documentation @@ -26702,15 +26098,13 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { isDataOnly = flags & int32(SQLITE_SYNC_DATAONLY) isFullsync = libc.BoolInt32(flags&int32(0x0F) == int32(SQLITE_SYNC_FULL)) /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ - _ = libc.Int32FromInt32(0) /* Unix cannot, but some systems may return SQLITE_FULL from here. This ** line is to test that doing so does not cause any problems. */ - _ = libc.Int32FromInt32(0) rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= nSize { iWrite = nSize - int64(1) } - nWrite = _seekAndWrite(tls, pFile, iWrite, __ccgo_ts+1648, int32(1)) + nWrite = _seekAndWrite(tls, pFile, iWrite, __ccgo_ts+1652, int32(1)) if nWrite != int32(1) { return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(3)<= 0 { /* Initialize the locking parameters */ (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(lockType) - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(ofst) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(n) - res = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_SETLK64), libc.VaList(bp+40, bp)) + res = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_SETLK), libc.VaList(bp+40, bp)) if res == -int32(1) { rc = int32(SQLITE_BUSY) } @@ -27227,7 +26607,7 @@ func _unixShmRegionPerMap(tls *libc.TLS) (r int32) { _, _ = pgsz, shmsz shmsz = libc.Int32FromInt32(32) * libc.Int32FromInt32(1024) /* SHM region size */ pgsz = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(25)].FpCurrent})))(tls) /* System page size */ - _ = libc.Int32FromInt32(0) /* Page size must be a power of 2 */ + /* Page size must be a power of 2 */ if pgsz < shmsz { return int32(1) } @@ -27247,10 +26627,8 @@ func _unixShmPurge(tls *libc.TLS, pFd uintptr) { var p uintptr _, _, _ = i, nShmPerMap, p p = (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFd)).FpInode)).FpShmNode - _ = libc.Int32FromInt32(0) if p != 0 && (*TunixShmNode)(unsafe.Pointer(p)).FnRef == 0 { nShmPerMap = _unixShmRegionPerMap(tls) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_free(tls, (*TunixShmNode)(unsafe.Pointer(p)).FpShmMutex) i = 0 for { @@ -27264,11 +26642,12 @@ func _unixShmPurge(tls *libc.TLS, pFd uintptr) { } goto _1 _1: + ; i += nShmPerMap } Xsqlite3_free(tls, (*TunixShmNode)(unsafe.Pointer(p)).FapRegion) if (*TunixShmNode)(unsafe.Pointer(p)).FhShm >= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -27312,11 +26691,11 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** process might open and use the *-shm file without truncating it. ** And if the *-shm file has been corrupted by a power failure or ** system crash, the database itself may also become corrupt. */ - (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = SEEK_SET + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(SQLITE_SHM_NLOCK)) (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) - if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK64), libc.VaList(bp+40, bp)) != 0 { + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(15)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -27672,14 +27047,6 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(20)< int32(1) { bUnlock = 0 *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))-- @@ -27769,9 +27130,6 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))++ } } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Make sure no sibling connections hold locks that will block this ** lock. If any do, return SQLITE_BUSY right away. */ ii = ofst @@ -27785,6 +27143,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -27802,13 +27161,13 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } } } } - _ = libc.Int32FromInt32(0) } /* Drop the mutexes acquired above. */ Xsqlite3_mutex_leave(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) @@ -27826,9 +27185,8 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( // */ func _unixShmBarrier(tls *libc.TLS, fd uintptr) { _ = fd - /* compiler-defined memory barrier */ - _ = libc.Int32FromInt32(0) - _unixEnterMutex(tls) /* Also mutex, for redundancy */ + _sqlite3MemoryBarrier(tls) /* compiler-defined memory barrier */ + _unixEnterMutex(tls) /* Also mutex, for redundancy */ _unixLeaveMutex(tls) } @@ -27850,8 +27208,6 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { return SQLITE_OK } pShmNode = (*TunixShm)(unsafe.Pointer(p)).FpShmNode - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Remove connection p from the set of connections associated ** with pShmNode */ Xsqlite3_mutex_enter(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) @@ -27862,6 +27218,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -27871,9 +27228,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { Xsqlite3_mutex_leave(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) /* If pShmNode->nRef has reached 0, then close the underlying ** shared-memory file, too */ - _ = libc.Int32FromInt32(0) _unixEnterMutex(tls) - _ = libc.Int32FromInt32(0) (*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRef-- if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRef == 0 { if deleteFlag != 0 && (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0 { @@ -27891,7 +27246,6 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { // ** If it is currently memory mapped, unmap file pFd. // */ func _unixUnmapfile(tls *libc.TLS, pFd uintptr) { - _ = libc.Int32FromInt32(0) if (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion != 0 { (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion, uint64((*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual)) (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion = uintptr(0) @@ -27923,18 +27277,12 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { var pNew, pOrig, pReq, zErr uintptr var v1 Tsqlite3_int64 _, _, _, _, _, _, _, _, _ = flags, h, nOrig, nReuse, pNew, pOrig, pReq, zErr, v1 - zErr = __ccgo_ts + 3551 + zErr = __ccgo_ts + 3555 h = (*TunixFile)(unsafe.Pointer(pFd)).Fh /* File descriptor open on db file */ pOrig = (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion /* Pointer to current file mapping */ nOrig = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual /* Size of pOrig region in bytes */ pNew = uintptr(0) /* Location of new mapping */ flags = int32(PROT_READ) /* Flags to pass to mmap() */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pOrig != 0 { nReuse = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize pReq = pOrig + uintptr(nReuse) @@ -27943,7 +27291,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, pReq, uint64(nOrig-nReuse)) } pNew = (*(*func(*libc.TLS, uintptr, Tsize_t, Tsize_t, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(24)].FpCurrent})))(tls, pOrig, uint64(nReuse), uint64(nNew), int32(MREMAP_MAYMOVE), 0) - zErr = __ccgo_ts + 3563 + zErr = __ccgo_ts + 3567 /* The attempt to extend the existing mapping failed. Free it. */ if pNew == uintptr(-libc.Int32FromInt32(1)) || pNew == uintptr(0) { (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, pOrig, uint64(nReuse)) @@ -27956,7 +27304,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -27990,8 +27338,6 @@ func _unixMapfile(tls *libc.TLS, pFd uintptr, nMap Ti64) (r int32) { bp := tls.Alloc(144) defer tls.Free(144) var _ /* statbuf at bp+0 */ Tstat - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TunixFile)(unsafe.Pointer(pFd)).FnFetchOut > 0 { return SQLITE_OK } @@ -28004,7 +27350,6 @@ func _unixMapfile(tls *libc.TLS, pFd uintptr, nMap Ti64) (r int32) { if nMap > (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax { nMap = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax } - _ = libc.Int32FromInt32(0) if nMap != (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize { _unixRemapfile(tls, pFd, nMap) } @@ -28071,15 +27416,12 @@ func _unixUnfetch(tls *libc.TLS, fd uintptr, iOff Ti64, p uintptr) (r int32) { /* If p==0 (unmap the entire file) then there must be no outstanding ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference), ** then there must be at least one outstanding. */ - _ = libc.Int32FromInt32(0) /* If p!=0, it must match the iOff value. */ - _ = libc.Int32FromInt32(0) if p != 0 { (*TunixFile)(unsafe.Pointer(pFd)).FnFetchOut-- } else { _unixUnmapfile(tls, pFd) } - _ = libc.Int32FromInt32(0) return SQLITE_OK } @@ -28287,9 +27629,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _, _, _, _, _, _, _, _ = nFilename, pLockingStyle, pNew, rc, zLockFile, v1, p2, p3 pNew = pId rc = SQLITE_OK - _ = libc.Int32FromInt32(0) /* No locking occurs in temporary files */ - _ = libc.Int32FromInt32(0) (*TunixFile)(unsafe.Pointer(pNew)).Fh = h (*TunixFile)(unsafe.Pointer(pNew)).FpVfs = pVfs (*TunixFile)(unsafe.Pointer(pNew)).FzPath = zFilename @@ -28300,11 +27640,11 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam } else { v1 = uintptr(0) } - if Xsqlite3_uri_boolean(tls, v1, __ccgo_ts+3829, int32(SQLITE_POWERSAFE_OVERWRITE)) != 0 { + if Xsqlite3_uri_boolean(tls, v1, __ccgo_ts+3833, int32(SQLITE_POWERSAFE_OVERWRITE)) != 0 { p2 = pNew + 30 *(*uint16)(unsafe.Pointer(p2)) = uint16(int32(*(*uint16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, __ccgo_ts+3834) == 0 { + if libc.Xstrcmp(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, __ccgo_ts+3838) == 0 { p3 = pNew + 30 *(*uint16)(unsafe.Pointer(p3)) = uint16(int32(*(*uint16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(UNIXFILE_EXCL)) } @@ -28335,19 +27675,18 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) } else { if pLockingStyle == uintptr(unsafe.Pointer(&_dotlockIoMethods)) { - _ = libc.Int32FromInt32(0) nFilename = int32(libc.Xstrlen(tls, zFilename)) + int32(6) zLockFile = Xsqlite3_malloc64(tls, uint64(nFilename)) if zLockFile == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, __ccgo_ts+3844, libc.VaList(bp+8, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, __ccgo_ts+3848, libc.VaList(bp+8, zFilename)) } (*TunixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -28355,7 +27694,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -28370,10 +27709,10 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam // ** Directories to consider for temp files. // */ var _azTempDirs = [6]uintptr{ - 2: __ccgo_ts + 3852, - 3: __ccgo_ts + 3861, - 4: __ccgo_ts + 3870, - 5: __ccgo_ts + 1661, + 2: __ccgo_ts + 3856, + 3: __ccgo_ts + 3865, + 4: __ccgo_ts + 3874, + 5: __ccgo_ts + 1665, } // C documentation @@ -28382,8 +27721,8 @@ var _azTempDirs = [6]uintptr{ // ** Initialize first two members of azTempDirs[] array. // */ func _unixTempFileInit(tls *libc.TLS) { - _azTempDirs[0] = libc.Xgetenv(tls, __ccgo_ts+3875) - _azTempDirs[int32(1)] = libc.Xgetenv(tls, __ccgo_ts+3889) + _azTempDirs[0] = libc.Xgetenv(tls, __ccgo_ts+3879) + _azTempDirs[int32(1)] = libc.Xgetenv(tls, __ccgo_ts+3893) } // C documentation @@ -28402,7 +27741,7 @@ func _unixTempFileDir(tls *libc.TLS) (r uintptr) { i = uint32(0) zDir = Xsqlite3_temp_directory for int32(1) != 0 { - if zDir != uintptr(0) && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zDir, bp) == 0 && (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(__S_IFMT) == uint32(libc.Int32FromInt32(__S_IFDIR)) && (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zDir, int32(03)) == 0 { + if zDir != uintptr(0) && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zDir, bp) == 0 && (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(S_IFMT) == uint32(S_IFDIR) && (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zDir, int32(03)) == 0 { return zDir } if uint64(i) >= libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8) { @@ -28444,9 +27783,8 @@ func _unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) (r int32) { } else { for cond := true; cond; cond = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zBuf, 0) == 0 { Xsqlite3_randomness(tls, int32(8), bp) - _ = libc.Int32FromInt32(0) *(*int8)(unsafe.Pointer(zBuf + uintptr(nBuf-int32(2)))) = 0 - Xsqlite3_snprintf(tls, nBuf, zBuf, __ccgo_ts+3896, libc.VaList(bp+16, zDir, *(*Tu64)(unsafe.Pointer(bp)), 0)) + Xsqlite3_snprintf(tls, nBuf, zBuf, __ccgo_ts+3900, libc.VaList(bp+16, zDir, *(*Tu64)(unsafe.Pointer(bp)), 0)) if v2 = int32(*(*int8)(unsafe.Pointer(zBuf + uintptr(nBuf-int32(2))))) != 0; !v2 { v1 = iLimit iLimit++ @@ -28501,7 +27839,6 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { pInode = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext } if pInode != 0 { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) flags &= libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) pp = pInode + 40 @@ -28511,6 +27848,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -28618,7 +27956,7 @@ func _findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintpt ** filename, check for the "modeof" parameter. If present, interpret ** its value as a filename and try to copy the mode, uid and gid from ** that file. */ - z = Xsqlite3_uri_parameter(tls, zPath, __ccgo_ts+3913) + z = Xsqlite3_uri_parameter(tls, zPath, __ccgo_ts+3917) if z != 0 { rc = _getFileMode(tls, z, pMode, pUid, pGid) } @@ -28686,18 +28024,9 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags ** (c) if EXCLUSIVE is set, then CREATE must also be set. ** (d) if DELETEONCLOSE is set, then CREATE must also be set. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The main DB, main journal, WAL file and super-journal are never ** automatically deleted. Nor are they ever temporary files. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Assert that the upper layer has set one of the "file-type" flags. */ - _ = libc.Int32FromInt32(0) /* Detect a pid change and reset the PRNG. There is a race condition ** here such that two or more threads all trying to open databases at ** the same instant might all reset the PRNG. But multiple resets @@ -28722,11 +28051,9 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags /* Database filenames are double-zero terminated if they are not ** URIs with parameters. Hence, they can always be passed into ** sqlite3_uri_parameter(). */ - _ = libc.Int32FromInt32(0) } else { if !(zName != 0) { /* If zName is NULL, the upper layer is requesting a temp file. */ - _ = libc.Int32FromInt32(0) rc = _unixGetTempname(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname, bp) if rc != SQLITE_OK { return rc @@ -28734,7 +28061,6 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags zName = bp /* Generated temporary filenames are always double-zero terminated ** for use by sqlite3_uri_parameter(). */ - _ = libc.Int32FromInt32(0) } } /* Determine the value of the flags parameter passed to POSIX function @@ -28751,18 +28077,15 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags openFlags |= int32(O_CREAT) } if isExclusive != 0 { - openFlags |= libc.Int32FromInt32(O_EXCL) | libc.Int32FromInt32(__O_NOFOLLOW) + openFlags |= libc.Int32FromInt32(O_EXCL) | libc.Int32FromInt32(O_NOFOLLOW) } - openFlags |= libc.Int32FromInt32(__O_LARGEFILE) | libc.Int32FromInt32(O_BINARY) | libc.Int32FromInt32(__O_NOFOLLOW) + openFlags |= libc.Int32FromInt32(O_LARGEFILE) | libc.Int32FromInt32(O_BINARY) | libc.Int32FromInt32(O_NOFOLLOW) if fd < 0 { /* Groupid for the file */ rc = _findCreateFileMode(tls, zName, flags, bp+516, bp+520, bp+524) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return rc } fd = _robust_open(tls, zName, openFlags, *(*Tmode_t)(unsafe.Pointer(bp + 516))) - _ = libc.Int32FromInt32(0) if fd < 0 { if isNewJrnl != 0 && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EACCES) && (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zName, F_OK) != 0 { /* If unable to create a journal because the directory is not @@ -28781,7 +28104,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3393, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3397, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -28803,7 +28126,6 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags _robustFchown(tls, fd, *(*Tuid_t)(unsafe.Pointer(bp + 520)), *(*Tgid_t)(unsafe.Pointer(bp + 524))) } } - _ = libc.Int32FromInt32(0) if pOutFlags != 0 { *(*int32)(unsafe.Pointer(pOutFlags)) = flags } @@ -28831,9 +28153,9 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags if flags&int32(SQLITE_OPEN_URI) != 0 { ctrlFlags |= int32(UNIXFILE_URI) } - _ = libc.Int32FromInt32(0) rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -28858,7 +28180,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< 0)) + *(*int32)(unsafe.Pointer(pResOut)) = libc.BoolInt32(0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zPath, bp) && (!((*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&libc.Uint32FromInt32(S_IFMT) == libc.Uint32FromInt32(S_IFREG)) || (*(*Tstat)(unsafe.Pointer(bp))).Fst_size > 0)) } else { *(*int32)(unsafe.Pointer(pResOut)) = libc.BoolInt32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zPath, libc.Int32FromInt32(W_OK)|libc.Int32FromInt32(R_OK)) == 0) } @@ -28945,15 +28264,12 @@ func _appendOnePathElement(tls *libc.TLS, pPath uintptr, zName uintptr, nName in var _ /* buf at bp+0 */ Tstat var _ /* zLnk at bp+144 */ [4098]int8 _, _, _, _, _, _, _, _ = got, zIn, v1, v2, v3, v4, v5, v6 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(zName))) == int32('.') { if nName == int32(1) { return } if int32(*(*int8)(unsafe.Pointer(zName + 1))) == int32('.') && nName == int32(2) { if (*TDbPath)(unsafe.Pointer(pPath)).FnUsed > int32(1) { - _ = libc.Int32FromInt32(0) for { v2 = pPath + 20 *(*int32)(unsafe.Pointer(v2))-- @@ -28981,20 +28297,20 @@ func _appendOnePathElement(tls *libc.TLS, pPath uintptr, zName uintptr, nName in zIn = (*TDbPath)(unsafe.Pointer(pPath)).FzOut if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(27)].FpCurrent})))(tls, zIn, bp) != 0 { if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(ENOENT) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44618)), __ccgo_ts+3591, zIn, int32(44618)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44680)), __ccgo_ts+3595, zIn, int32(44680)) } } else { - if (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(__S_IFMT) == uint32(libc.Int32FromInt32(__S_IFLNK)) { + if (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(S_IFMT) == uint32(S_IFLNK) { v6 = pPath + 4 v5 = *(*int32)(unsafe.Pointer(v6)) *(*int32)(unsafe.Pointer(v6))++ if v5 > int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+144, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(4098)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3582, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3586, zIn, int32(44691)) return } (*(*[4098]int8)(unsafe.Pointer(bp + 144)))[got] = 0 @@ -29029,6 +28345,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -29061,14 +28378,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3411, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3415, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)< int32(SQLITE_LOCK_SHARED) && (*TMemStore)(unsafe.Pointer(p)).FmFlags&uint32(SQLITE_DESERIALIZE_READONLY) != 0 { rc = int32(SQLITE_READONLY) } else { switch eLock { case int32(SQLITE_LOCK_SHARED): - _ = libc.Int32FromInt32(0) if (*TMemStore)(unsafe.Pointer(p)).FnWrLock > 0 { rc = int32(SQLITE_BUSY) } else { @@ -30139,7 +29404,6 @@ func _memdbLock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { case int32(SQLITE_LOCK_RESERVED): fallthrough case int32(SQLITE_LOCK_PENDING): - _ = libc.Int32FromInt32(0) if (*TMemFile)(unsafe.Pointer(pThis)).FeLock == int32(SQLITE_LOCK_SHARED) { if (*TMemStore)(unsafe.Pointer(p)).FnWrLock > 0 { rc = int32(SQLITE_BUSY) @@ -30148,8 +29412,6 @@ func _memdbLock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { } } default: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemStore)(unsafe.Pointer(p)).FnRdLock > int32(1) { rc = int32(SQLITE_BUSY) } else { @@ -30181,7 +29443,6 @@ func _memdbUnlock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { return SQLITE_OK } _memdbEnter(tls, p) - _ = libc.Int32FromInt32(0) if eLock == int32(SQLITE_LOCK_SHARED) { if (*TMemFile)(unsafe.Pointer(pThis)).FeLock > int32(SQLITE_LOCK_SHARED) { (*TMemStore)(unsafe.Pointer(p)).FnWrLock-- @@ -30213,7 +29474,7 @@ func _memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = int32(SQLITE_NOTFOUND) _memdbEnter(tls, p) if op == int32(SQLITE_FCNTL_VFSNAME) { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3973, libc.VaList(bp+8, (*TMemStore)(unsafe.Pointer(p)).FaData, (*TMemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3977, libc.VaList(bp+8, (*TMemStore)(unsafe.Pointer(p)).FaData, (*TMemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == int32(SQLITE_FCNTL_SIZE_LIMIT) { @@ -30304,6 +29565,7 @@ func _memdbOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFd uintptr, flags i } goto _1 _1: + ; i++ } if p == uintptr(0) { @@ -30387,7 +29649,7 @@ func _memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, bp := tls.Alloc(16) defer tls.Free(16) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, __ccgo_ts+3795, libc.VaList(bp+8, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, __ccgo_ts+3799, libc.VaList(bp+8, zPath)) return SQLITE_OK } @@ -30516,7 +29778,6 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp } if p != 0 { pStore = (*TMemFile)(unsafe.Pointer(p)).FpStore - _ = libc.Int32FromInt32(0) if piSize != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = (*TMemStore)(unsafe.Pointer(pStore)).Fsz } @@ -30535,7 +29796,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = _sqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+3988, libc.VaList(bp+24, zSchema)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+3992, libc.VaList(bp+24, zSchema)) if zSql != 0 { v1 = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) } else { @@ -30551,6 +29812,14 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp pOut = uintptr(0) } else { sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + if sz == 0 { + Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + Xsqlite3_exec(tls, db, __ccgo_ts+4015, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == int32(SQLITE_ROW) { + sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + } + } if piSize != 0 { *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = sz } @@ -30577,6 +29846,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _2 _2: + ; pgno++ } } @@ -30607,7 +29877,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = int32(SQLITE_ERROR) goto end_deserialize } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4011, libc.VaList(bp+16, zSchema)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4040, libc.VaList(bp+16, zSchema)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -30642,6 +29912,7 @@ func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uint rc = SQLITE_OK } end_deserialize: + ; Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) if pData != 0 && mFlags&uint32(SQLITE_DESERIALIZE_FREEONCLOSE) != uint32(0) { Xsqlite3_free(tls, pData) @@ -30791,7 +30062,6 @@ type Bitvec1 = TBitvec1 func _sqlite3BitvecCreate(tls *libc.TLS, iSize Tu32) (r uintptr) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) p = _sqlite3MallocZero(tls, uint64(512)) if p != 0 { (*TBitvec)(unsafe.Pointer(p)).FiSize = iSize @@ -30809,7 +30079,6 @@ func _sqlite3BitvecCreate(tls *libc.TLS, iSize Tu32) (r uintptr) { func _sqlite3BitvecTestNotNull(tls *libc.TLS, p uintptr, i Tu32) (r int32) { var bin, h, v1 Tu32 _, _, _ = bin, h, v1 - _ = libc.Int32FromInt32(0) i-- if i >= (*TBitvec)(unsafe.Pointer(p)).FiSize { return 0 @@ -30866,8 +30135,6 @@ func _sqlite3BitvecSet(tls *libc.TLS, p uintptr, i Tu32) (r int32) { if p == uintptr(0) { return SQLITE_OK } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i-- for uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) > (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)*libc.Uint64FromInt32(BITVEC_SZELEM) && (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { bin = i / (*TBitvec)(unsafe.Pointer(p)).FiDivisor @@ -30913,6 +30180,7 @@ func _sqlite3BitvecSet(tls *libc.TLS, p uintptr, i Tu32) (r int32) { /* available free spot. check to see if this is going to */ /* make our hash too "full". */ bitvec_set_rehash: + ; if uint64((*TBitvec)(unsafe.Pointer(p)).FnSet) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -30932,6 +30200,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -30939,6 +30208,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -30960,7 +30230,6 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { if p == uintptr(0) { return } - _ = libc.Int32FromInt32(0) i-- for (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { bin = i / (*TBitvec)(unsafe.Pointer(p)).FiDivisor @@ -30996,6 +30265,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -31021,6 +30291,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -31164,10 +30435,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -31276,8 +30549,6 @@ func _pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove Tu8) { _ = p p = (*TPgHdr)(unsafe.Pointer(pPage)).FpCache if int32(addRemove)&int32(PCACHE_DIRTYLIST_REMOVE) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Update the PCache1.pSynced variable if necessary. */ if (*TPCache)(unsafe.Pointer(p)).FpSynced == pPage { (*TPCache)(unsafe.Pointer(p)).FpSynced = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev @@ -31285,7 +30556,6 @@ func _pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove Tu8) { if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { (*TPgHdr)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev } else { - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer(p)).FpDirtyTail = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev } if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev != 0 { @@ -31295,11 +30565,8 @@ func _pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove Tu8) { ** This is an optimization that allows sqlite3PcacheFetch() to skip ** searching for a dirty page to eject from the cache when it might ** otherwise have to. */ - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext - _ = libc.Int32FromInt32(0) if (*TPCache)(unsafe.Pointer(p)).FpDirty == uintptr(0) { /*OPTIMIZATION-IF-TRUE*/ - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(2) } } @@ -31308,12 +30575,10 @@ func _pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove Tu8) { (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev = uintptr(0) (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext = (*TPCache)(unsafe.Pointer(p)).FpDirty if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { - _ = libc.Int32FromInt32(0) (*TPgHdr)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = pPage } else { (*TPCache)(unsafe.Pointer(p)).FpDirtyTail = pPage if (*TPCache)(unsafe.Pointer(p)).FbPurgeable != 0 { - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(1) } } @@ -31381,7 +30646,6 @@ func _sqlite3PcacheInitialize(tls *libc.TLS) (r int32) { ** built-in default page cache is used instead of the application defined ** page cache. */ _sqlite3PCacheSetDefault(tls) - _ = libc.Int32FromInt32(0) } return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxInit})))(tls, _sqlite3Config.Fpcache2.FpArg) } @@ -31420,7 +30684,7 @@ func _sqlite3PcacheOpen(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable i libc.Xmemset(tls, p, 0, uint64(80)) (*TPCache)(unsafe.Pointer(p)).FszPage = int32(1) (*TPCache)(unsafe.Pointer(p)).FszExtra = szExtra - _ = libc.Int32FromInt32(0) /* First 8 bytes will be zeroed */ + /* First 8 bytes will be zeroed */ (*TPCache)(unsafe.Pointer(p)).FbPurgeable = uint8(bPurgeable) (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(2) (*TPCache)(unsafe.Pointer(p)).FxStress = xStress @@ -31439,7 +30703,6 @@ func _sqlite3PcacheOpen(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable i func _sqlite3PcacheSetPageSize(tls *libc.TLS, pCache uintptr, szPage int32) (r int32) { var pNew uintptr _ = pNew - _ = libc.Int32FromInt32(0) if (*TPCache)(unsafe.Pointer(pCache)).FszPage != 0 { pNew = (*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxCreate})))(tls, szPage, int32(uint64((*TPCache)(unsafe.Pointer(pCache)).FszExtra)+(libc.Uint64FromInt64(80)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))), int32((*TPCache)(unsafe.Pointer(pCache)).FbPurgeable)) if pNew == uintptr(0) { @@ -31485,10 +30748,6 @@ func _sqlite3PcacheFetch(tls *libc.TLS, pCache uintptr, pgno TPgno, createFlag i var eCreate int32 var pRes uintptr _, _ = eCreate, pRes - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* eCreate defines what to do if the page does not exist. ** 0 Do not allocate a new page. (createFlag==0) ** 1 Allocate a new page if doing so is inexpensive. @@ -31497,9 +30756,6 @@ func _sqlite3PcacheFetch(tls *libc.TLS, pCache uintptr, pgno TPgno, createFlag i ** (createFlag==1 AND !(bPurgeable AND pDirty) */ eCreate = createFlag & int32((*TPCache)(unsafe.Pointer(pCache)).FeCreate) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pRes = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, pgno, eCreate) return pRes } @@ -31541,6 +30797,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -31552,6 +30809,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -31585,9 +30843,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage func _pcacheFetchFinishWithInit(tls *libc.TLS, pCache uintptr, pgno TPgno, pPage uintptr) (r uintptr) { var pPgHdr uintptr _ = pPgHdr - _ = libc.Int32FromInt32(0) pPgHdr = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, pPgHdr+32, 0, libc.Uint64FromInt64(80)-uint64(libc.UintptrFromInt32(0)+32)) (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpPage = pPage (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpData = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpBuf @@ -31610,14 +30866,12 @@ func _pcacheFetchFinishWithInit(tls *libc.TLS, pCache uintptr, pgno TPgno, pPage func _sqlite3PcacheFetchFinish(tls *libc.TLS, pCache uintptr, pgno TPgno, pPage uintptr) (r uintptr) { var pPgHdr uintptr _ = pPgHdr - _ = libc.Int32FromInt32(0) pPgHdr = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra if !((*TPgHdr)(unsafe.Pointer(pPgHdr)).FpPage != 0) { return _pcacheFetchFinishWithInit(tls, pCache, pgno, pPage) } (*TPCache)(unsafe.Pointer(pCache)).FnRefSum++ (*TPgHdr)(unsafe.Pointer(pPgHdr)).FnRef++ - _ = libc.Int32FromInt32(0) return pPgHdr } @@ -31631,7 +30885,6 @@ func _sqlite3PcacheRelease(tls *libc.TLS, p uintptr) { var v1 Ti64 var v2 uintptr _, _ = v1, v2 - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum-- v2 = p + 56 *(*Ti64)(unsafe.Pointer(v2))-- @@ -31641,7 +30894,6 @@ func _sqlite3PcacheRelease(tls *libc.TLS, p uintptr) { _pcacheUnpin(tls, p) } else { _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) - _ = libc.Int32FromInt32(0) } } } @@ -31652,8 +30904,6 @@ func _sqlite3PcacheRelease(tls *libc.TLS, p uintptr) { // ** Increase the reference count of a supplied page by 1. // */ func _sqlite3PcacheRef(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TPgHdr)(unsafe.Pointer(p)).FnRef++ (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum++ } @@ -31666,8 +30916,6 @@ func _sqlite3PcacheRef(tls *libc.TLS, p uintptr) { // ** page pointed to by p is invalid. // */ func _sqlite3PcacheDrop(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_DIRTY) != 0 { _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) } @@ -31684,19 +30932,14 @@ func _sqlite3PcacheDrop(tls *libc.TLS, p uintptr) { func _sqlite3PcacheMakeDirty(tls *libc.TLS, p uintptr) { var p1, p2 uintptr _, _ = p1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(PGHDR_CLEAN)|libc.Int32FromInt32(PGHDR_DONT_WRITE)) != 0 { /*OPTIMIZATION-IF-FALSE*/ p1 = p + 52 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(PGHDR_DONT_WRITE)) if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_CLEAN) != 0 { p2 = p + 52 *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) ^ (libc.Int32FromInt32(PGHDR_DIRTY) | libc.Int32FromInt32(PGHDR_CLEAN))) - _ = libc.Int32FromInt32(0) _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_ADD)) - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) } } @@ -31709,15 +30952,11 @@ func _sqlite3PcacheMakeDirty(tls *libc.TLS, p uintptr) { func _sqlite3PcacheMakeClean(tls *libc.TLS, p uintptr) { var p1, p2 uintptr _, _ = p1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) p1 = p + 52 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(PGHDR_DIRTY) | libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) p2 = p + 52 *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PGHDR_CLEAN)) - _ = libc.Int32FromInt32(0) if (*TPgHdr)(unsafe.Pointer(p)).FnRef == 0 { _pcacheUnpin(tls, p) } @@ -31758,6 +30997,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31780,6 +31020,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31794,13 +31035,9 @@ func _sqlite3PcacheMove(tls *libc.TLS, p uintptr, newPgno TPgno) { var pCache, pOther, pXPage uintptr _, _, _ = pCache, pOther, pXPage pCache = (*TPgHdr)(unsafe.Pointer(p)).FpCache - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOther = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, newPgno, 0) if pOther != 0 { pXPage = (*Tsqlite3_pcache_page)(unsafe.Pointer(pOther)).FpExtra - _ = libc.Int32FromInt32(0) (*TPgHdr)(unsafe.Pointer(pXPage)).FnRef++ (*TPCache)(unsafe.Pointer(pCache)).FnRefSum++ _sqlite3PcacheDrop(tls, pXPage) @@ -31809,7 +31046,6 @@ func _sqlite3PcacheMove(tls *libc.TLS, p uintptr, newPgno TPgno) { (*TPgHdr)(unsafe.Pointer(p)).Fpgno = newPgno if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_DIRTY) != 0 && int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_NEED_SYNC) != 0 { _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) - _ = libc.Int32FromInt32(0) } } @@ -31838,13 +31074,12 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { ** after sqlite3PcacheCleanAll(). So if there are dirty pages, ** it must be that pgno==0. */ - _ = libc.Int32FromInt32(0) if (*TPgHdr)(unsafe.Pointer(p)).Fpgno > pgno { - _ = libc.Int32FromInt32(0) _sqlite3PcacheMakeClean(tls, p) } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -31865,7 +31100,6 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { // ** Close a cache. // */ func _sqlite3PcacheClose(tls *libc.TLS, pCache uintptr) { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxDestroy})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) } @@ -31891,7 +31125,6 @@ func _pcacheMergeDirtyList(tls *libc.TLS, pA uintptr, pB uintptr) (r uintptr) { var _ /* result at bp+0 */ TPgHdr _ = pTail pTail = bp - _ = libc.Int32FromInt32(0) for { if (*TPgHdr)(unsafe.Pointer(pA)).Fpgno < (*TPgHdr)(unsafe.Pointer(pB)).Fpgno { (*TPgHdr)(unsafe.Pointer(pTail)).FpDirty = pA @@ -31954,6 +31187,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -31980,6 +31214,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -32001,6 +31236,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -32033,7 +31269,6 @@ func _sqlite3PcachePageRefcount(tls *libc.TLS, p uintptr) (r Ti64) { // ** Return the total number of pages in the cache. // */ func _sqlite3PcachePagecount(tls *libc.TLS, pCache uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxPagecount})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) } @@ -32043,7 +31278,6 @@ func _sqlite3PcachePagecount(tls *libc.TLS, pCache uintptr) (r int32) { // ** Set the suggested cache-size value. // */ func _sqlite3PcacheSetCachesize(tls *libc.TLS, pCache uintptr, mxPage int32) { - _ = libc.Int32FromInt32(0) (*TPCache)(unsafe.Pointer(pCache)).FszCache = mxPage (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxCachesize})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, _numberOfCachePages(tls, pCache)) } @@ -32058,7 +31292,6 @@ func _sqlite3PcacheSetCachesize(tls *libc.TLS, pCache uintptr, mxPage int32) { func _sqlite3PcacheSetSpillsize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) { var res int32 _ = res - _ = libc.Int32FromInt32(0) if mxPage != 0 { if mxPage < 0 { mxPage = int32(int64(-libc.Int32FromInt32(1024)) * int64(mxPage) / int64((*TPCache)(unsafe.Pointer(p)).FszPage+(*TPCache)(unsafe.Pointer(p)).FszExtra)) @@ -32078,7 +31311,6 @@ func _sqlite3PcacheSetSpillsize(tls *libc.TLS, p uintptr, mxPage int32) (r int32 // ** Free up as much memory as possible from the page cache. // */ func _sqlite3PcacheShrink(tls *libc.TLS, pCache uintptr) { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxShrink})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) } @@ -32112,6 +31344,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -32528,6 +31761,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -32554,7 +31788,6 @@ func _pcache1Alloc(tls *libc.TLS, nByte int32) (r uintptr) { var sz int32 _, _ = p, sz p = uintptr(0) - _ = libc.Int32FromInt32(0) if nByte <= _pcache1_g.FszSlot { Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) p = _pcache1_g.FpFree @@ -32562,7 +31795,6 @@ func _pcache1Alloc(tls *libc.TLS, nByte int32) (r uintptr) { _pcache1_g.FpFree = (*TPgFreeslot)(unsafe.Pointer(_pcache1_g.FpFree)).FpNext _pcache1_g.FnFreeSlot-- _pcache1_g.FbUnderPressure = libc.BoolInt32(_pcache1_g.FnFreeSlot < _pcache1_g.FnReserve) - _ = libc.Int32FromInt32(0) _sqlite3StatusHighwater(tls, int32(SQLITE_STATUS_PAGECACHE_SIZE), nByte) _sqlite3StatusUp(tls, int32(SQLITE_STATUS_PAGECACHE_USED), int32(1)) } @@ -32604,10 +31836,8 @@ func _pcache1Free(tls *libc.TLS, p uintptr) { _pcache1_g.FpFree = pSlot _pcache1_g.FnFreeSlot++ _pcache1_g.FbUnderPressure = libc.BoolInt32(_pcache1_g.FnFreeSlot < _pcache1_g.FnReserve) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, _pcache1_g.Fmutex) } else { - _ = libc.Int32FromInt32(0) nFreed = 0 nFreed = _sqlite3MallocSize(tls, p) Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) @@ -32628,7 +31858,6 @@ func _pcache1MemSize(tls *libc.TLS, p uintptr) (r int32) { if p >= _pcache1_g.FpStart && p < _pcache1_g.FpEnd { return _pcache1_g.FszSlot } else { - _ = libc.Int32FromInt32(0) iSize = _sqlite3MallocSize(tls, p) return iSize } @@ -32644,9 +31873,7 @@ func _pcache1AllocPage(tls *libc.TLS, pCache uintptr, benignMalloc int32) (r uin var p, pPg uintptr _, _ = p, pPg p = uintptr(0) - _ = libc.Int32FromInt32(0) if (*TPCache1)(unsafe.Pointer(pCache)).FpFree != 0 || (*TPCache1)(unsafe.Pointer(pCache)).FnPage == uint32(0) && _pcache1InitBulk(tls, pCache) != 0 { - _ = libc.Int32FromInt32(0) p = (*TPCache1)(unsafe.Pointer(pCache)).FpFree (*TPCache1)(unsafe.Pointer(pCache)).FpFree = (*TPgHdr1)(unsafe.Pointer(p)).FpNext (*TPgHdr1)(unsafe.Pointer(p)).FpNext = uintptr(0) @@ -32654,8 +31881,6 @@ func _pcache1AllocPage(tls *libc.TLS, pCache uintptr, benignMalloc int32) (r uin /* The group mutex must be released before pcache1Alloc() is called. This ** is because it might call sqlite3_release_memory(), which assumes that ** this mutex is not held. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) if benignMalloc != 0 { _sqlite3BeginBenignMalloc(tls) @@ -32687,9 +31912,7 @@ func _pcache1AllocPage(tls *libc.TLS, pCache uintptr, benignMalloc int32) (r uin func _pcache1FreePage(tls *libc.TLS, p uintptr) { var pCache uintptr _ = pCache - _ = libc.Int32FromInt32(0) pCache = (*TPgHdr1)(unsafe.Pointer(p)).FpCache - _ = libc.Int32FromInt32(0) if (*TPgHdr1)(unsafe.Pointer(p)).FisBulkLocal != 0 { (*TPgHdr1)(unsafe.Pointer(p)).FpNext = (*TPCache1)(unsafe.Pointer(pCache)).FpFree (*TPCache1)(unsafe.Pointer(pCache)).FpFree = p @@ -32707,7 +31930,7 @@ func _pcache1FreePage(tls *libc.TLS, p uintptr) { // ** exists, this function falls back to sqlite3Malloc(). // */ func _sqlite3PageMalloc(tls *libc.TLS, sz int32) (r uintptr) { - _ = libc.Int32FromInt32(0) /* These allocations are never very large */ + /* These allocations are never very large */ return _pcache1Alloc(tls, sz) } @@ -32762,7 +31985,6 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { var apNew, pNext, pPage, v2 uintptr var h, i, nNew uint32 _, _, _, _, _, _, _ = apNew, h, i, nNew, pNext, pPage, v2 - _ = libc.Int32FromInt32(0) nNew = (*TPCache1)(unsafe.Pointer(p)).FnHash * uint32(2) if nNew < uint32(256) { nNew = uint32(256) @@ -32796,6 +32018,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -32814,18 +32037,11 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { // ** The PGroup mutex must be held when this function is called. // */ func _pcache1PinPage(tls *libc.TLS, pPage uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TPgHdr1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpLruPrev)).FpLruNext = (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext (*TPgHdr1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext)).FpLruPrev = (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruPrev (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext = uintptr(0) /* pPage->pLruPrev = 0; ** No need to clear pLruPrev as it is never accessed if pLruNext is 0 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TPCache1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpCache)).FnRecyclable-- return pPage } @@ -32844,7 +32060,6 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { var pCache, pp uintptr _, _, _ = h, pCache, pp pCache = (*TPgHdr1)(unsafe.Pointer(pPage)).FpCache - _ = libc.Int32FromInt32(0) h = (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey % (*TPCache1)(unsafe.Pointer(pCache)).FnHash pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8 for { @@ -32853,6 +32068,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -32873,7 +32089,6 @@ func _pcache1EnforceMaxPage(tls *libc.TLS, pCache uintptr) { var v2 bool _, _, _, _, _ = p, pGroup, v1, v2, v3 pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup - _ = libc.Int32FromInt32(0) for { if v2 = (*TPGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage; v2 { v1 = (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev @@ -32882,8 +32097,6 @@ func _pcache1EnforceMaxPage(tls *libc.TLS, pCache uintptr) { if !(v2 && int32((*TPgHdr1)(unsafe.Pointer(v1)).FisAnchor) == 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _pcache1PinPage(tls, p) _pcache1RemoveFromHash(tls, p, int32(1)) } @@ -32908,9 +32121,6 @@ func _pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { var h, iStop uint32 var pPage, pp, v2 uintptr _, _, _, _, _ = h, iStop, pPage, pp, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey-iLimit < (*TPCache1)(unsafe.Pointer(pCache)).FnHash { /* If we are just shaving the last few pages off the end of the ** cache, then there is no point in scanning the entire hash table. @@ -32926,7 +32136,6 @@ func _pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { iStop = h - uint32(1) } for { - _ = libc.Int32FromInt32(0) pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8 for { v2 = *(*uintptr)(unsafe.Pointer(pp)) @@ -32952,7 +32161,6 @@ func _pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { goto _1 _1: } - _ = libc.Int32FromInt32(0) } /******************************************************************************/ @@ -32965,7 +32173,6 @@ func _pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { // */ func _pcache1Init(tls *libc.TLS, NotUsed uintptr) (r int32) { _ = NotUsed - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, uintptr(unsafe.Pointer(&_pcache1_g)), 0, uint64(144)) /* ** The pcache1.separateCache variable is true if each PCache has its own @@ -33005,7 +32212,6 @@ func _pcache1Init(tls *libc.TLS, NotUsed uintptr) (r int32) { // */ func _pcache1Shutdown(tls *libc.TLS, NotUsed uintptr) { _ = NotUsed - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, uintptr(unsafe.Pointer(&_pcache1_g)), 0, uint64(144)) } @@ -33020,8 +32226,6 @@ func _pcache1Create(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32 var pCache, pGroup, v1 uintptr var sz, v2 int32 _, _, _, _, _ = pCache, pGroup, sz, v1, v2 /* Bytes of memory required to allocate the new cache */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) sz = int32(uint64(88) + uint64(80)*uint64(_pcache1_g.FseparateCache)) pCache = _sqlite3MallocZero(tls, uint64(sz)) if pCache != 0 { @@ -33078,7 +32282,6 @@ func _pcache1Cachesize(tls *libc.TLS, p uintptr, nMax int32) { var pCache, pGroup uintptr _, _, _ = n, pCache, pGroup pCache = p - _ = libc.Int32FromInt32(0) if (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 { pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) @@ -33151,21 +32354,16 @@ func _pcache1FetchStage2(tls *libc.TLS, pCache uintptr, iKey uint32, createFlag pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup pPage = uintptr(0) /* Step 3: Abort if createFlag is 1 but the cache is nearly full */ - _ = libc.Int32FromInt32(0) nPinned = (*TPCache1)(unsafe.Pointer(pCache)).FnPage - (*TPCache1)(unsafe.Pointer(pCache)).FnRecyclable - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if createFlag == int32(1) && (nPinned >= (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned || nPinned >= (*TPCache1)(unsafe.Pointer(pCache)).Fn90pct || _pcache1UnderMemoryPressure(tls, pCache) != 0 && (*TPCache1)(unsafe.Pointer(pCache)).FnRecyclable < nPinned) { return uintptr(0) } if (*TPCache1)(unsafe.Pointer(pCache)).FnPage >= (*TPCache1)(unsafe.Pointer(pCache)).FnHash { _pcache1ResizeHash(tls, pCache) } - _ = libc.Int32FromInt32(0) /* Step 4. Try to recycle a page. */ if (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 && !((*TPgHdr1)(unsafe.Pointer((*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev)).FisAnchor != 0) && ((*TPCache1)(unsafe.Pointer(pCache)).FnPage+uint32(1) >= (*TPCache1)(unsafe.Pointer(pCache)).FnMax || _pcache1UnderMemoryPressure(tls, pCache) != 0) { pPage = (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev - _ = libc.Int32FromInt32(0) _pcache1RemoveFromHash(tls, pPage, 0) _pcache1PinPage(tls, pPage) pOther = (*TPgHdr1)(unsafe.Pointer(pPage)).FpCache @@ -33298,7 +32496,6 @@ func _pcache1FetchWithMutex(tls *libc.TLS, p uintptr, iKey uint32, createFlag in pCache = p Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) pPage = _pcache1FetchNoMutex(tls, p, iKey, createFlag) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) return pPage } @@ -33307,12 +32504,6 @@ func _pcache1Fetch(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) (r u var pCache uintptr _ = pCache pCache = p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex != 0 { return _pcache1FetchWithMutex(tls, p, iKey, createFlag) } else { @@ -33334,13 +32525,10 @@ func _pcache1Unpin(tls *libc.TLS, p uintptr, pPg uintptr, reuseUnlikely int32) { pCache = p pPage = pPg pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) /* It is an error to call this function if the page is already ** part of the PGroup LRU list. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if reuseUnlikely != 0 || (*TPGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage { _pcache1RemoveFromHash(tls, pPage, int32(1)) } else { @@ -33367,18 +32555,16 @@ func _pcache1Rekey(tls *libc.TLS, p uintptr, pPg uintptr, iOld uint32, iNew uint _, _, _, _, _ = hNew, hOld, pCache, pPage, pp pCache = p pPage = pPg - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The page number really is changing */ + /* The page number really is changing */ Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) - _ = libc.Int32FromInt32(0) /* pPg really is iOld */ + /* pPg really is iOld */ hOld = iOld % (*TPCache1)(unsafe.Pointer(pCache)).FnHash pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(hOld)*8 for *(*uintptr)(unsafe.Pointer(pp)) != pPage { pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext - _ = libc.Int32FromInt32(0) /* iNew not in cache */ + /* iNew not in cache */ hNew = iNew % (*TPCache1)(unsafe.Pointer(pCache)).FnHash (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey = iNew (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(hNew)*8)) @@ -33422,14 +32608,11 @@ func _pcache1Destroy(tls *libc.TLS, p uintptr) { _, _ = pCache, pGroup pCache = p pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) if (*TPCache1)(unsafe.Pointer(pCache)).FnPage != 0 { _pcache1TruncateUnsafe(tls, pCache, uint32(0)) } - _ = libc.Int32FromInt32(0) *(*uint32)(unsafe.Pointer(pGroup + 8)) -= (*TPCache1)(unsafe.Pointer(pCache)).FnMax - _ = libc.Int32FromInt32(0) *(*uint32)(unsafe.Pointer(pGroup + 12)) -= (*TPCache1)(unsafe.Pointer(pCache)).FnMin (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned = (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10) - (*TPGroup)(unsafe.Pointer(pGroup)).FnMinPage _pcache1EnforceMaxPage(tls, pCache) @@ -33507,8 +32690,6 @@ func _sqlite3PcacheReleaseMemory(tls *libc.TLS, nReq int32) (r int32) { var v2 bool _, _, _, _ = nFree, p, v1, v2 nFree = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3Config.FpPage == uintptr(0) { Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(uintptr(unsafe.Pointer(&_pcache1_g)))).Fmutex) for { @@ -33520,7 +32701,6 @@ func _sqlite3PcacheReleaseMemory(tls *libc.TLS, nReq int32) (r int32) { break } nFree += _pcache1MemSize(tls, (*TPgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf) - _ = libc.Int32FromInt32(0) _pcache1PinPage(tls, p) _pcache1RemoveFromHash(tls, p, int32(1)) } @@ -33702,6 +32882,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -33737,7 +32918,6 @@ func _sqlite3RowSetDelete(tls *libc.TLS, pArg uintptr) { func _rowSetEntryAlloc(tls *libc.TLS, p uintptr) (r uintptr) { var pNew, v1, v2 uintptr _, _, _ = pNew, v1, v2 - _ = libc.Int32FromInt32(0) if int32((*TRowSet)(unsafe.Pointer(p)).FnFresh) == 0 { pNew = _sqlite3DbMallocRawNN(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, uint64(1016)) if pNew == uintptr(0) { @@ -33767,7 +32947,6 @@ func _sqlite3RowSetInsert(tls *libc.TLS, p uintptr, rowid Ti64) { var pEntry, pLast, p1 uintptr _, _, _ = pEntry, pLast, p1 /* The last prior entry */ /* This routine is never called after sqlite3RowSetNext() */ - _ = libc.Int32FromInt32(0) pEntry = _rowSetEntryAlloc(tls, p) if pEntry == uintptr(0) { return @@ -33804,10 +32983,7 @@ func _rowSetEntryMerge(tls *libc.TLS, pA uintptr, pB uintptr) (r uintptr) { var _ /* head at bp+0 */ TRowSetEntry _, _, _ = pTail, v2, v3 pTail = bp - _ = libc.Int32FromInt32(0) for { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TRowSetEntry)(unsafe.Pointer(pA)).Fv <= (*TRowSetEntry)(unsafe.Pointer(pB)).Fv { if (*TRowSetEntry)(unsafe.Pointer(pA)).Fv < (*TRowSetEntry)(unsafe.Pointer(pB)).Fv { v2 = pA @@ -33861,6 +33037,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -33883,6 +33060,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -33899,7 +33077,6 @@ func _rowSetTreeToList(tls *libc.TLS, pIn uintptr, ppFirst uintptr, ppLast uintp bp := tls.Alloc(16) defer tls.Free(16) var _ /* p at bp+0 */ uintptr - _ = libc.Int32FromInt32(0) if (*TRowSetEntry)(unsafe.Pointer(pIn)).FpLeft != 0 { _rowSetTreeToList(tls, (*TRowSetEntry)(unsafe.Pointer(pIn)).FpLeft, ppFirst, bp) (*TRowSetEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpRight = pIn @@ -33911,7 +33088,6 @@ func _rowSetTreeToList(tls *libc.TLS, pIn uintptr, ppFirst uintptr, ppLast uintp } else { *(*uintptr)(unsafe.Pointer(ppLast)) = pIn } - _ = libc.Int32FromInt32(0) } // C documentation @@ -33973,7 +33149,6 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { var iDepth int32 var p, pLeft, v1 uintptr _, _, _, _ = iDepth, p, pLeft, v1 /* Left subtree */ - _ = libc.Int32FromInt32(0) p = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp)) = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight v1 = libc.UintptrFromInt32(0) @@ -33991,6 +33166,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -34014,8 +33190,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { func _sqlite3RowSetNext(tls *libc.TLS, p uintptr, pRowid uintptr) (r int32) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Cannot be used with sqlite3RowSetText() */ + /* Cannot be used with sqlite3RowSetText() */ /* Merge the forest into a single sorted list on first call */ if int32((*TRowSet)(unsafe.Pointer(p)).FrsFlags)&int32(ROWSET_NEXT) == 0 { /*OPTIMIZATION-IF-FALSE*/ if int32((*TRowSet)(unsafe.Pointer(p)).FrsFlags)&int32(ROWSET_SORTED) == 0 { /*OPTIMIZATION-IF-FALSE*/ @@ -34057,7 +33232,6 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq var _ /* pTail at bp+8 */ uintptr _, _, _, _, _ = p, pTree, ppPrevTree, v2, p3 /* This routine is never called after sqlite3RowSetNext() */ - _ = libc.Int32FromInt32(0) /* Sort entries into the forest on the first test of a new batch. ** To save unnecessary work, only do this when the batch number changes. */ @@ -34085,6 +33259,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -34126,6 +33301,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -35030,12 +34206,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -35096,11 +34274,7 @@ func _pagerUnlockDb(tls *libc.TLS, pPager uintptr, eLock int32) (r int32) { var rc, v1 int32 _, _ = rc, v1 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FnoLock != 0 { v1 = SQLITE_OK } else { @@ -35131,7 +34305,6 @@ func _pagerLockDb(tls *libc.TLS, pPager uintptr, eLock int32) (r int32) { var rc, v1 int32 _, _ = rc, v1 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FeLock) < eLock || int32((*TPager)(unsafe.Pointer(pPager)).FeLock) == libc.Int32FromInt32(EXCLUSIVE_LOCK)+libc.Int32FromInt32(1) { if (*TPager)(unsafe.Pointer(pPager)).FnoLock != 0 { v1 = SQLITE_OK @@ -35168,7 +34341,6 @@ func _pagerLockDb(tls *libc.TLS, pPager uintptr, eLock int32) (r int32) { // ** If neither optimization can be used, 0 is returned. // */ func _jrnlBufferSize(tls *libc.TLS, pPager uintptr) (r int32) { - _ = libc.Int32FromInt32(0) _ = pPager return 0 } @@ -35248,6 +34420,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -35288,9 +34461,6 @@ func _journalHdrOffset(tls *libc.TLS, pPager uintptr) (r Ti64) { if c != 0 { offset = ((c-int64(1))/int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) + int64(1)) * int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return offset } @@ -35325,8 +34495,6 @@ func _zeroJournalHdr(tls *libc.TLS, pPager uintptr, doTruncate int32) (r int32) var _ /* sz at bp+0 */ Ti64 _, _ = iLimit, rc rc = SQLITE_OK /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FjournalOff != 0 { iLimit = (*TPager)(unsafe.Pointer(pPager)).FjournalSizeLimit /* Local cache of jsl */ if doTruncate != 0 || iLimit == 0 { @@ -35381,7 +34549,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { rc = SQLITE_OK /* Return code */ zHeader = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace /* Temporary space used to build header */ nHeader = uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) /* Loop counter */ - _ = libc.Int32FromInt32(0) /* Journal file must be open. */ + /* Journal file must be open. */ if nHeader > (*TPager)(unsafe.Pointer(pPager)).FsectorSize { nHeader = (*TPager)(unsafe.Pointer(pPager)).FsectorSize } @@ -35399,6 +34567,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -35424,7 +34593,6 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { ** * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees ** that garbage data is never appended to the journal file. */ - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FnoSync != 0 || int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) || _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd)&int32(SQLITE_IOCAP_SAFE_APPEND) != 0 { libc.Xmemcpy(tls, zHeader, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) _sqlite3Put4byte(tls, zHeader+uintptr(8), uint32(0xffffffff)) @@ -35471,10 +34639,10 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { break } rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, zHeader, int32(nHeader), (*TPager)(unsafe.Pointer(pPager)).FjournalOff) - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -35509,7 +34677,7 @@ func _readJournalHdr(tls *libc.TLS, pPager uintptr, isHot int32, journalSize Ti6 var _ /* iPageSize at bp+8 */ Tu32 var _ /* iSectorSize at bp+12 */ Tu32 _, _, _, _, _, _, _, _, _, _ = iHdrOff, rc, v1, v2, v3, v4, v5, v6, v7, v8 /* Offset of journal header being read */ - _ = libc.Int32FromInt32(0) /* Journal file must be open. */ + /* Journal file must be open. */ /* Advance Pager.journalOff to the start of the next sector. If the ** journal file is too small for there to be a header stored at this ** point, return SQLITE_DONE. @@ -35629,13 +34797,10 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) var _ /* jrnlSize at bp+0 */ Ti64 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cksum, iHdrOff, nSuper, rc, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9 /* Size of journal file on disk */ cksum = uint32(0) /* Checksum of string zSuper */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(zSuper != 0) || int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) || !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0)) { return SQLITE_OK } (*TPager)(unsafe.Pointer(pPager)).FsetSuper = uint8(1) - _ = libc.Int32FromInt32(0) /* Calculate the length in bytes and the checksum of zSuper */ nSuper = 0 for { @@ -35645,6 +34810,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -35736,6 +34902,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -35767,10 +34934,10 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) p = (*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56 if pgno <= (*TPagerSavepoint)(unsafe.Pointer(p)).FnOrig { rc |= _sqlite3BitvecSet(tls, (*TPagerSavepoint)(unsafe.Pointer(p)).FpInSavepoint, pgno) - _ = libc.Int32FromInt32(0) } goto _1 _1: + ; ii++ } return rc @@ -35798,12 +34965,10 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) func _pager_unlock(tls *libc.TLS, pPager uintptr) { var iDc, rc, v1, v2 int32 _, _, _, _ = iDc, rc, v1, v2 - _ = libc.Int32FromInt32(0) _sqlite3BitvecDestroy(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal) (*TPager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) _releaseAllSavepoints(tls, pPager) if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3WalEndReadTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) } else { @@ -35819,12 +34984,6 @@ func _pager_unlock(tls *libc.TLS, pPager uintptr) { ** another connection with journal_mode=delete might delete the file ** out from under us. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if 0 == iDc&int32(SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) || int32(1) != int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode)&int32(5) { _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) } @@ -35841,7 +35000,6 @@ func _pager_unlock(tls *libc.TLS, pPager uintptr) { ** without clearing the error code. This is intentional - the error ** code is cleared and the cache reset in the block below. */ - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) } } @@ -35850,7 +35008,6 @@ func _pager_unlock(tls *libc.TLS, pPager uintptr) { ** it can safely move back to PAGER_OPEN state. This happens in both ** normal and exclusive-locking mode. */ - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 { _pager_reset(tls, pPager) @@ -35900,8 +35057,6 @@ func _pager_error(tls *libc.TLS, pPager uintptr, rc int32) (r int32) { var rc2 int32 _ = rc2 rc2 = rc & int32(0xff) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if rc2 == int32(SQLITE_FULL) || rc2 == int32(SQLITE_IOERR) { (*TPager)(unsafe.Pointer(pPager)).FerrCode = rc (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_ERROR) @@ -36014,15 +35169,11 @@ func _pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bComm ** read-transaction, this function is called with eState==PAGER_READER ** and eLock==EXCLUSIVE_LOCK when the read-transaction is closed. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FeState) < int32(PAGER_WRITER_LOCKED) && int32((*TPager)(unsafe.Pointer(pPager)).FeLock) < int32(RESERVED_LOCK) { return SQLITE_OK } _releaseAllSavepoints(tls, pPager) - _ = libc.Int32FromInt32(0) if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { - _ = libc.Int32FromInt32(0) /* Finalize the journal file. */ if _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) != 0 { /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */ @@ -36054,8 +35205,6 @@ func _pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bComm ** the database file, it will do so using an in-memory journal. */ bDelete = libc.BoolInt32(!((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) if bDelete != 0 { rc = _sqlite3OsDelete(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, int32((*TPager)(unsafe.Pointer(pPager)).FextraSync)) @@ -36081,7 +35230,6 @@ func _pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bComm ** lock held on the database file. */ rc2 = _sqlite3WalEndWriteTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) - _ = libc.Int32FromInt32(0) } else { if rc == SQLITE_OK && bCommit != 0 && (*TPager)(unsafe.Pointer(pPager)).FdbFileSize > (*TPager)(unsafe.Pointer(pPager)).FdbSize { /* This branch is taken when committing a transaction in rollback-journal @@ -36090,7 +35238,6 @@ func _pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bComm ** successfully committed, but the EXCLUSIVE lock is still held on the ** file. So it is safe to truncate the database file to its minimum ** required size. */ - _ = libc.Int32FromInt32(0) rc = _pager_truncate(tls, pPager, (*TPager)(unsafe.Pointer(pPager)).FdbSize) } } @@ -36137,14 +35284,12 @@ func _pagerUnlockAndRollback(tls *libc.TLS, pPager uintptr) { var errCode int32 _, _ = eLock, errCode if int32((*TPager)(unsafe.Pointer(pPager)).FeState) != int32(PAGER_ERROR) && int32((*TPager)(unsafe.Pointer(pPager)).FeState) != PAGER_OPEN { - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_LOCKED) { _sqlite3BeginBenignMalloc(tls) _sqlite3PagerRollback(tls, pPager) _sqlite3EndBenignMalloc(tls) } else { if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) { - _ = libc.Int32FromInt32(0) _pager_end_transaction(tls, pPager, 0, 0) } } @@ -36250,21 +35395,18 @@ func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pD var _ /* pPg at bp+0 */ uintptr var _ /* pgno at bp+8 */ TPgno _, _, _, _, _, _, _, _, _, _, _ = aData, isSynced, jfd, ofst, pData, rc, v1, v2, v3, p4, p5 /* True if journal page is synced */ - _ = libc.Int32FromInt32(0) /* isMainJrnl is 0 or 1 */ - _ = libc.Int32FromInt32(0) /* isSavepnt is 0 or 1 */ - _ = libc.Int32FromInt32(0) /* pDone always used on sub-journals */ - _ = libc.Int32FromInt32(0) /* pDone never used on non-savepoint */ + /* isMainJrnl is 0 or 1 */ + /* isSavepnt is 0 or 1 */ + /* pDone always used on sub-journals */ + /* pDone never used on non-savepoint */ aData = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace - _ = libc.Int32FromInt32(0) /* Temp storage must have already been allocated */ - _ = libc.Int32FromInt32(0) + /* Temp storage must have already been allocated */ /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction ** or savepoint rollback done at the request of the caller) or this is ** a hot-journal rollback. If it is a hot-journal rollback, the pager ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback ** only reads from the main journal, not the sub-journal. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Read the page number and page data from the journal or sub-journal ** file. Return an error code to the caller if an IO error occurs. */ @@ -36289,7 +35431,6 @@ func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pD ** detect this invalid data (with high probability) and ignore it. */ if *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(0) || *(*TPgno)(unsafe.Pointer(bp + 8)) == (*TPager)(unsafe.Pointer(pPager)).FlckPgno { - _ = libc.Int32FromInt32(0) return int32(SQLITE_DONE) } if *(*TPgno)(unsafe.Pointer(bp + 8)) > (*TPager)(unsafe.Pointer(pPager)).FdbSize || _sqlite3BitvecTest(tls, pDone, *(*TPgno)(unsafe.Pointer(bp + 8))) != 0 { @@ -36359,8 +35500,6 @@ func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pD } else { *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3PagerLookup(tls, pPager, *(*TPgno)(unsafe.Pointer(bp + 8))) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if isMainJrnl != 0 { isSynced = libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0 || *(*Ti64)(unsafe.Pointer(pOffset)) <= (*TPager)(unsafe.Pointer(pPager)).FjournalHdr) } else { @@ -36368,7 +35507,6 @@ func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pD } if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_DBMOD) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN) && isSynced != 0 { ofst = int64(*(*TPgno)(unsafe.Pointer(bp + 8))-libc.Uint32FromInt32(1)) * (*TPager)(unsafe.Pointer(pPager)).FpageSize - _ = libc.Int32FromInt32(0) /* Write the data read from the journal back into the database file. ** This is usually safe even for an encrypted database - as the data ** was encrypted before it was written to the journal file. The exception @@ -36400,12 +35538,9 @@ func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pD ** and if the pager requires a journal-sync, then mark the page as ** requiring a journal-sync before it is written. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p4 = pPager + 25 *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | libc.Int32FromInt32(SPILLFLAG_ROLLBACK)) rc = _sqlite3PagerGet(tls, pPager, *(*TPgno)(unsafe.Pointer(bp + 8)), bp, int32(1)) - _ = libc.Int32FromInt32(0) p5 = pPager + 25 *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(SPILLFLAG_ROLLBACK)) if rc != SQLITE_OK { @@ -36562,10 +35697,10 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, pSuper) } return rc @@ -36602,11 +35737,8 @@ func _pager_truncate(tls *libc.TLS, pPager uintptr, nPage TPgno) (r int32) { var _ /* newSize at bp+8 */ Ti64 _, _, _ = pTmp, rc, szPage rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_DBMOD) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN) { szPage = int32((*TPager)(unsafe.Pointer(pPager)).FpageSize) - _ = libc.Int32FromInt32(0) /* TODO: Is it safe to use Pager.dbFileSize here? */ rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp) *(*Ti64)(unsafe.Pointer(bp + 8)) = int64(szPage) * int64(nPage) @@ -36643,7 +35775,6 @@ func _sqlite3SectorSize(tls *libc.TLS, pFile uintptr) (r int32) { iRet = int32(512) } else { if iRet > int32(MAX_SECTOR_SIZE) { - _ = libc.Int32FromInt32(0) iRet = int32(MAX_SECTOR_SIZE) } } @@ -36676,7 +35807,6 @@ func _sqlite3SectorSize(tls *libc.TLS, pFile uintptr) (r int32) { // ** we cannot reduce the effective sector size below 512. // */ func _setSectorSize(tls *libc.TLS, pPager uintptr) { - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 || _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd)&int32(SQLITE_IOCAP_POWERSAFE_OVERWRITE) != 0 { /* Sector size doesn't matter for temporary files. Also, the file ** may not have been opened yet, in which case the OsSectorSize() @@ -36767,7 +35897,6 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { /* Figure out how many records are in the journal. Abort early if ** the journal is empty. */ - _ = libc.Int32FromInt32(0) rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp) if rc != SQLITE_OK { goto end_playback @@ -36817,7 +35946,6 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { ** the value of nRec based on this assumption. */ if *(*Tu32)(unsafe.Pointer(bp + 8)) == uint32(0xffffffff) { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(int32((*(*Ti64)(unsafe.Pointer(bp)) - int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize)) / ((*TPager)(unsafe.Pointer(pPager)).FpageSize + libc.Int64FromInt32(8)))) } /* If nRec is 0 and this rollback is of a transaction created by this @@ -36890,12 +36018,13 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ - _ = libc.Int32FromInt32(0) end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -36932,12 +36061,11 @@ end_playback: /* If there was a super-journal and this routine will return success, ** see if it is possible to delete the super-journal. */ - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace, 0, uint64(4)) rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)<journalOff is off-limits to us. */ szJ = (*TPager)(unsafe.Pointer(pPager)).FjournalOff - _ = libc.Int32FromInt32(0) /* Begin by rolling back records from the main journal starting at ** PagerSavepoint.iOffset and continuing to the next journal header. ** There might be records in the main journal that have a page number @@ -37418,7 +36530,6 @@ func _pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) for rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FjournalOff < iHdrOff { rc = _pager_playback_one_page(tls, pPager, pPager+96, pDone, int32(1), int32(1)) } - _ = libc.Int32FromInt32(0) } else { (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 } @@ -37430,7 +36541,6 @@ func _pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) for rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FjournalOff < szJ { /* Loop counter */ *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) rc = _readJournalHdr(tls, pPager, 0, szJ, bp, bp+4) - _ = libc.Int32FromInt32(0) /* ** The "pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff" ** test is related to ticket #2565. See the discussion in the @@ -37447,11 +36557,10 @@ func _pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) rc = _pager_playback_one_page(tls, pPager, pPager+96, pDone, int32(1), int32(1)) goto _3 _3: + ; ii++ } - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) /* Finally, rollback pages from the sub-journal. Page that were ** previously rolled back out of the main journal (and are hence in pDone) ** will be skipped. Out-of-range pages are also skipped. @@ -37466,13 +36575,12 @@ func _pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) if !(rc == SQLITE_OK && ii1 < (*TPager)(unsafe.Pointer(pPager)).FnSubRec) { break } - _ = libc.Int32FromInt32(0) rc = _pager_playback_one_page(tls, pPager, bp+8, pDone, 0, int32(1)) goto _4 _4: + ; ii1++ } - _ = libc.Int32FromInt32(0) } _sqlite3BitvecDestroy(tls, pDone) if rc == SQLITE_OK { @@ -37678,7 +36786,6 @@ func _pagerOpentemp(tls *libc.TLS, pPager uintptr, pFile uintptr, vfsFlags int32 _ = rc /* Return code */ vfsFlags |= libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) rc = _sqlite3OsOpen(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, uintptr(0), pFile, vfsFlags, uintptr(0)) - _ = libc.Int32FromInt32(0) return rc } @@ -37711,8 +36818,6 @@ func _sqlite3PagerSetBusyHandler(tls *libc.TLS, pPager uintptr, xBusyHandler uin (*TPager)(unsafe.Pointer(pPager)).FxBusyHandler = xBusyHandler (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg = pBusyHandlerArg ap = pPager + 232 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_BUSYHANDLER), ap) } @@ -37767,7 +36872,6 @@ func _sqlite3PagerSetPagesize(tls *libc.TLS, pPager uintptr, pPageSize uintptr, ** is a no-op for that case anyhow. */ pageSize = *(*Tu32)(unsafe.Pointer(pPageSize)) - _ = libc.Int32FromInt32(0) if (int32((*TPager)(unsafe.Pointer(pPager)).FmemDb) == 0 || (*TPager)(unsafe.Pointer(pPager)).FdbSize == uint32(0)) && _sqlite3PcacheRefCount(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) == 0 && pageSize != 0 && pageSize != uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) { pNew = libc.UintptrFromInt32(0) /* New temp space */ *(*Ti64)(unsafe.Pointer(bp)) = 0 @@ -37803,7 +36907,6 @@ func _sqlite3PagerSetPagesize(tls *libc.TLS, pPager uintptr, pPageSize uintptr, if nReserve < 0 { nReserve = int32((*TPager)(unsafe.Pointer(pPager)).FnReserve) } - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FnReserve = int16(nReserve) _pagerFixMaplimit(tls, pPager) } @@ -37837,7 +36940,7 @@ func _sqlite3PagerMaxPageCount(tls *libc.TLS, pPager uintptr, mxPage TPgno) (r T if mxPage > uint32(0) { (*TPager)(unsafe.Pointer(pPager)).FmxPgno = mxPage } - _ = libc.Int32FromInt32(0) /* Called only by OP_MaxPgcnt */ + /* Called only by OP_MaxPgcnt */ /* assert( pPager->mxPgno>=pPager->dbSize ); */ /* OP_MaxPgcnt ensures that the parameter passed to this function is not ** less than the total number of valid pages in the database. But this @@ -37875,12 +36978,10 @@ func _sqlite3PagerReadFileheader(tls *libc.TLS, pPager uintptr, N int32, pDest u _ = rc rc = SQLITE_OK libc.Xmemset(tls, pDest, 0, uint64(N)) - _ = libc.Int32FromInt32(0) /* This routine is only called by btree immediately after creating ** the Pager object. There has not been an opportunity to transition ** to WAL mode yet. */ - _ = libc.Int32FromInt32(0) if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, pDest, N, 0) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)<errCode = 0; */ (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode = uint8(0) a = uintptr(0) - _ = libc.Int32FromInt32(0) if db != 0 && uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_NoCkptOnClose) && SQLITE_OK == _databaseIsUnmoved(tls, pPager) { a = pTmp } @@ -38193,8 +37279,6 @@ func _sqlite3PagerClose(tls *libc.TLS, pPager uintptr, db uintptr) (r int32) { _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd) _sqlite3PageFree(tls, pTmp) _sqlite3PcacheClose(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, pPager) return SQLITE_OK } @@ -38253,18 +37337,13 @@ func _syncJournal(tls *libc.TLS, pPager uintptr, newHdr int32) (r int32) { var _ /* aMagic at bp+0 */ [8]Tu8 var _ /* zHeader at bp+8 */ [12]Tu8 _, _, _, _ = iDc, iNextHdrOffset, rc, v1 /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerExclusiveLock(tls, pPager) if rc != SQLITE_OK { return rc } if !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { - _ = libc.Int32FromInt32(0) if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_MEMORY) { iDc = _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd) - _ = libc.Int32FromInt32(0) if 0 == iDc&int32(SQLITE_IOCAP_SAFE_APPEND) { libc.Xmemcpy(tls, bp+8, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) _sqlite3Put4byte(tls, bp+8+uintptr(8), uint32((*TPager)(unsafe.Pointer(pPager)).FnRec)) @@ -38327,7 +37406,6 @@ func _syncJournal(tls *libc.TLS, pPager uintptr, newHdr int32) (r int32) { */ _sqlite3PcacheClearSyncFlags(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_DBMOD) - _ = libc.Int32FromInt32(0) return SQLITE_OK } @@ -38378,22 +37456,16 @@ func _pager_write_pagelist(tls *libc.TLS, pPager uintptr, pList uintptr) (r int3 _, _, _, _ = offset, pData, pgno, rc rc = SQLITE_OK /* Return code */ /* This function is only called for rollback pagers in WRITER_DBMOD state. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the file is a temp-file has not yet been opened, open it now. It ** is not possible for rc to be other than SQLITE_OK if this branch ** is taken, as pager_wait_on_lock() is a no-op for temp-files. */ if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != libc.UintptrFromInt32(0)) { - _ = libc.Int32FromInt32(0) rc = _pagerOpentemp(tls, pPager, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32((*TPager)(unsafe.Pointer(pPager)).FvfsFlags)) } /* Before the first write, give the VFS a hint of what the final ** file size will be. */ - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FdbHintSize < (*TPager)(unsafe.Pointer(pPager)).FdbSize && ((*TPgHdr)(unsafe.Pointer(pList)).FpDirty != 0 || (*TPgHdr)(unsafe.Pointer(pList)).Fpgno > (*TPager)(unsafe.Pointer(pPager)).FdbHintSize) { *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = (*TPager)(unsafe.Pointer(pPager)).FpageSize * int64((*TPager)(unsafe.Pointer(pPager)).FdbSize) _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_SIZE_HINT), bp) @@ -38411,7 +37483,6 @@ func _pager_write_pagelist(tls *libc.TLS, pPager uintptr, pList uintptr) (r int3 */ if pgno <= (*TPager)(unsafe.Pointer(pPager)).FdbSize && 0 == int32((*TPgHdr)(unsafe.Pointer(pList)).Fflags)&int32(PGHDR_DONT_WRITE) { offset = int64(pgno-libc.Uint32FromInt32(1)) * (*TPager)(unsafe.Pointer(pPager)).FpageSize /* Data to write */ - _ = libc.Int32FromInt32(0) if (*TPgHdr)(unsafe.Pointer(pList)).Fpgno == uint32(1) { _pager_write_changecounter(tls, pList) } @@ -38485,10 +37556,6 @@ func _subjournalPage(tls *libc.TLS, pPg uintptr) (r int32) { pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_OFF) { /* Open the sub-journal, if it has not already been opened */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _openSubJournal(tls, pPager) /* If the sub-journal was opened successfully (or was already open), ** write the journal record into the file. */ @@ -38504,7 +37571,6 @@ func _subjournalPage(tls *libc.TLS, pPg uintptr) (r int32) { } if rc == SQLITE_OK { (*TPager)(unsafe.Pointer(pPager)).FnSubRec++ - _ = libc.Int32FromInt32(0) rc = _addToSavepointBitvecs(tls, pPager, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) } return rc @@ -38546,8 +37612,6 @@ func _pagerStress(tls *libc.TLS, p uintptr, pPg uintptr) (r int32) { _, _ = pPager, rc pPager = p rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The doNotSpill NOSYNC bit is set during times when doing a sync of ** journal (and adding a new header) is not allowed. This occurs ** during calls to sqlite3PagerWrite() while trying to journal multiple @@ -38585,7 +37649,6 @@ func _pagerStress(tls *libc.TLS, p uintptr, pPg uintptr) (r int32) { } /* Write the contents of the page out to the database file. */ if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) rc = _pager_write_pagelist(tls, pPager, pPg) } } @@ -38608,7 +37671,6 @@ func _sqlite3PagerFlush(tls *libc.TLS, pPager uintptr) (r int32) { rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode if !((*TPager)(unsafe.Pointer(pPager)).FmemDb != 0) { pList = _sqlite3PcacheDirtyList(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) - _ = libc.Int32FromInt32(0) for rc == SQLITE_OK && pList != 0 { pNext = (*TPgHdr)(unsafe.Pointer(pList)).FpDirty if (*TPgHdr)(unsafe.Pointer(pList)).FnRef == 0 { @@ -38722,7 +37784,6 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u z += uintptr(libc.Xstrlen(tls, z) + uint64(1)) } nUriByte = int32(t__predefined_ptrdiff_t(z+1) - int64(zUri)) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && nPathname+int32(8) > (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname { /* This branch is taken when the journal path required by ** the database being opened will be more than pVfs->mxPathname @@ -38730,7 +37791,7 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u ** as it will not be possible to open the journal file or even ** check for a hot-journal before reading. */ - rc = _sqlite3CantopenError(tls, int32(61488)) + rc = _sqlite3CantopenError(tls, int32(61558)) } if rc != SQLITE_OK { _sqlite3DbFree(tls, uintptr(0), zPathname) @@ -38781,9 +37842,7 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u ** specific formatting and order of the various filenames, so if the format ** changes here, be sure to change it there as well. */ - _ = libc.Int32FromInt32(0) pPtr = _sqlite3MallocZero(tls, (libc.Uint64FromInt64(312)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))+uint64((pcacheSize+libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7))+uint64(((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile+libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7))+uint64(journalFileSize*int32(2))+uint64(__SIZEOF_POINTER__)+uint64(4)+uint64(nPathname)+uint64(1)+uint64(nUriByte)+uint64(nPathname)+uint64(8)+uint64(1)+uint64(nPathname)+uint64(4)+uint64(1)+uint64(3)) - _ = libc.Int32FromInt32(0) if !(pPtr != 0) { _sqlite3DbFree(tls, uintptr(0), zPathname) return int32(SQLITE_NOMEM) @@ -38798,7 +37857,6 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u pPtr += uintptr(journalFileSize) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fjfd = pPtr pPtr += uintptr(journalFileSize) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pPtr, bp, uint64(__SIZEOF_POINTER__)) pPtr += uintptr(__SIZEOF_POINTER__) /* Fill in the Pager.zFilename and pPager.zQueryParam fields */ @@ -38819,7 +37877,7 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, __ccgo_ts+4053, uint64(8)) + libc.Xmemcpy(tls, pPtr, __ccgo_ts+4082, uint64(8)) pPtr += uintptr(libc.Int32FromInt32(8) + libc.Int32FromInt32(1)) } else { (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzJournal = uintptr(0) @@ -38829,7 +37887,7 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, __ccgo_ts+4062, uint64(4)) + libc.Xmemcpy(tls, pPtr, __ccgo_ts+4091, uint64(4)) pPtr += uintptr(libc.Int32FromInt32(4) + libc.Int32FromInt32(1)) } else { (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzWal = uintptr(0) @@ -38847,7 +37905,6 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u } *(*int32)(unsafe.Pointer(bp + 12)) = 0 /* VFS flags returned by xOpen() */ rc = _sqlite3OsOpen(tls, pVfs, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd, vfsFlags, bp+12) - _ = libc.Int32FromInt32(0) v4 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 12))&libc.Int32FromInt32(SQLITE_OPEN_MEMORY) != libc.Int32FromInt32(0)) memJM = v4 (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmemVfs = uint8(v4) @@ -38864,7 +37921,6 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u iDc = _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd) if !(readOnly != 0) { _setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp))) - _ = libc.Int32FromInt32(0) if *(*Tu32)(unsafe.Pointer(bp + 8)) < (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FsectorSize { if (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FsectorSize > uint32(SQLITE_MAX_DEFAULT_PAGE_SIZE) { *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(SQLITE_MAX_DEFAULT_PAGE_SIZE) @@ -38873,14 +37929,15 @@ func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename u } } } - (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnoLock = uint8(Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4067, 0)) - if iDc&int32(SQLITE_IOCAP_IMMUTABLE) != 0 || Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4074, 0) != 0 { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnoLock = uint8(Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4096, 0)) + if iDc&int32(SQLITE_IOCAP_IMMUTABLE) != 0 || Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4103, 0) != 0 { vfsFlags |= int32(SQLITE_OPEN_READONLY) goto act_like_temp_file } } goto _3 _2: + ; /* If a temporary file is requested, it is not opened immediately. ** In this case we accept the default page size and delay actually ** opening the file until the first call to OsWrite(). @@ -38892,23 +37949,23 @@ _2: ** This branch also runs for files marked as immutable. */ act_like_temp_file: + ; tempFile = int32(1) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FeState = uint8(PAGER_READER) /* Pretend we already have a lock */ (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FeLock = uint8(EXCLUSIVE_LOCK) /* Pretend we are in EXCLUSIVE mode */ (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnoLock = uint8(1) /* Do no locking */ readOnly = vfsFlags & int32(SQLITE_OPEN_READONLY) _3: + ; /* The following call to PagerSetPagesize() serves to set the value of ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer. */ if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerSetPagesize(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+8, -int32(1)) } /* Initialize the PCache object. */ if rc == SQLITE_OK { nExtra = (nExtra + int32(7)) & ^libc.Int32FromInt32(7) - _ = libc.Int32FromInt32(0) if !(memDb != 0) { v5 = __ccgo_fp(_pagerStress) } else { @@ -38935,20 +37992,16 @@ _3: /* pPager->state = PAGER_UNLOCK; */ /* pPager->errMask = 0; */ (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FtempFile = uint8(tempFile) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FexclusiveMode = uint8(tempFile) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FchangeCountDone = (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FtempFile (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmemDb = uint8(memDb) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FreadOnly = uint8(readOnly) - _ = libc.Int32FromInt32(0) _sqlite3PagerSetFlags(tls, *(*uintptr)(unsafe.Pointer(bp)), uint32(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS)+libc.Int32FromInt32(1)|libc.Int32FromInt32(PAGER_CACHESPILL))) /* pPager->pFirst = 0; */ /* pPager->pFirstSynced = 0; */ /* pPager->pLast = 0; */ (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExtra = uint16(nExtra) (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FjournalSizeLimit = int64(-int32(1)) - _ = libc.Int32FromInt32(0) _setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp))) if !(useJournal != 0) { (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FjournalMode = uint8(PAGER_JOURNALMODE_OFF) @@ -38981,7 +38034,6 @@ func Xsqlite3_database_file_object(tls *libc.TLS, zName uintptr) (r uintptr) { zName-- } p = zName - uintptr(4) - uintptr(8) - _ = libc.Int32FromInt32(0) pPager = *(*uintptr)(unsafe.Pointer(p)) return (*TPager)(unsafe.Pointer(pPager)).Ffd } @@ -39034,10 +38086,6 @@ func _hasHotJournal(tls *libc.TLS, pPager uintptr, pExists uintptr) (r int32) { rc = SQLITE_OK /* Return code */ *(*int32)(unsafe.Pointer(bp)) = int32(1) /* True if a journal file is present */ jrnlOpen = libc.BoolInt32(!!((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pExists)) = 0 if !(jrnlOpen != 0) { rc = _sqlite3OsAccess(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, SQLITE_ACCESS_EXISTS, bp) @@ -39054,7 +38102,6 @@ func _hasHotJournal(tls *libc.TLS, pPager uintptr, pExists uintptr) (r int32) { */ rc = _sqlite3OsCheckReservedLock(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp+4) if rc == SQLITE_OK && !(*(*int32)(unsafe.Pointer(bp + 4)) != 0) { /* Number of pages in database file */ - _ = libc.Int32FromInt32(0) rc = _pagerPagecount(tls, pPager, bp+8) if rc == SQLITE_OK { /* If the database is zero pages in size, that means that either (1) the @@ -39161,17 +38208,10 @@ func _sqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) (r int32) { ** outstanding pages. This implies that the pager state should either ** be OPEN or READER. READER is only possible if the pager is or was in ** exclusive access mode. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) && int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN { *(*int32)(unsafe.Pointer(bp)) = int32(1) /* True if there exists a hot journal-file */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _pager_wait_on_lock(tls, pPager, int32(SHARED_LOCK)) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) goto failed } /* If a journal file exists, and there is no RESERVED lock on the @@ -39226,11 +38266,9 @@ func _sqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) (r int32) { if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 4)) != 0 { *(*int32)(unsafe.Pointer(bp + 8)) = 0 f = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_MAIN_JOURNAL) - _ = libc.Int32FromInt32(0) rc = _sqlite3OsOpen(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, (*TPager)(unsafe.Pointer(pPager)).Fjfd, f, bp+8) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8))&int32(SQLITE_OPEN_READONLY) != 0 { - rc = _sqlite3CantopenError(tls, int32(62009)) + rc = _sqlite3CantopenError(tls, int32(62079)) _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) } } @@ -39244,7 +38282,6 @@ func _sqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) (r int32) { ** the journal before playing it back. */ if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { - _ = libc.Int32FromInt32(0) rc = _pagerSyncHotJournal(tls, pPager) if rc == SQLITE_OK { rc = _pager_playback(tls, pPager, libc.BoolInt32(!((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0))) @@ -39275,8 +38312,6 @@ func _sqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) (r int32) { _pager_error(tls, pPager, rc) goto failed } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } if !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && (*TPager)(unsafe.Pointer(pPager)).FhasHeldSharedLock != 0 { rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp+12, int32(16), int64(24)) @@ -39303,20 +38338,17 @@ func _sqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) (r int32) { ** mode. Otherwise, the following function call is a no-op. */ rc = _pagerOpenWalIfPresent(tls, pPager) - _ = libc.Int32FromInt32(0) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { - _ = libc.Int32FromInt32(0) rc = _pagerBeginReadTransaction(tls, pPager) } if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 && int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN && rc == SQLITE_OK { rc = _pagerPagecount(tls, pPager, pPager+32) } failed: + ; if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) _pager_unlock(tls, pPager) - _ = libc.Int32FromInt32(0) } else { (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_READER) (*TPager)(unsafe.Pointer(pPager)).FhasHeldSharedLock = uint8(1) @@ -39336,7 +38368,7 @@ failed: // */ func _pagerUnlockIfUnused(tls *libc.TLS, pPager uintptr) { if _sqlite3PcacheRefCount(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) == 0 { - _ = libc.Int32FromInt32(0) /* because page1 is never memory mapped */ + /* because page1 is never memory mapped */ _pagerUnlockAndRollback(tls, pPager) } } @@ -39409,12 +38441,8 @@ func _getPageNormal(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, f var _ /* pBase at bp+0 */ uintptr _, _, _, _ = noContent, pPg, rc, v1 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pgno == uint32(0) { - return _sqlite3CorruptError(tls, int32(62222)) + return _sqlite3CorruptError(tls, int32(62292)) } *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3PcacheFetch(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, pgno, int32(3)) if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { @@ -39431,14 +38459,10 @@ func _getPageNormal(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, f v1 = _sqlite3PcacheFetchFinish(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, pgno, *(*uintptr)(unsafe.Pointer(bp))) *(*uintptr)(unsafe.Pointer(ppPage)) = v1 pPg = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) noContent = libc.BoolUint8(flags&int32(PAGER_GET_NOCONTENT) != 0) if (*TPgHdr)(unsafe.Pointer(pPg)).FpPager != 0 && !(noContent != 0) { /* In this case the pcache already contains an initialized copy of ** the page. Return without further ado. */ - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pPager + 248))++ return SQLITE_OK } else { @@ -39449,11 +38473,10 @@ func _getPageNormal(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, f ** (2) Never try to fetch the locking page */ if pgno == (*TPager)(unsafe.Pointer(pPager)).FlckPgno { - rc = _sqlite3CorruptError(tls, int32(62254)) + rc = _sqlite3CorruptError(tls, int32(62324)) goto pager_acquire_err } (*TPgHdr)(unsafe.Pointer(pPg)).FpPager = pPager - _ = libc.Int32FromInt32(0) if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != libc.UintptrFromInt32(0)) || (*TPager)(unsafe.Pointer(pPager)).FdbSize < pgno || noContent != 0 { if pgno > (*TPager)(unsafe.Pointer(pPager)).FmxPgno { rc = int32(SQLITE_FULL) @@ -39479,7 +38502,6 @@ func _getPageNormal(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, f } libc.Xmemset(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpData, 0, uint64((*TPager)(unsafe.Pointer(pPager)).FpageSize)) } else { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pPager + 248 + 1*4))++ rc = _readDbPage(tls, pPg) if rc != SQLITE_OK { @@ -39489,7 +38511,7 @@ func _getPageNormal(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, f } return SQLITE_OK pager_acquire_err: - _ = libc.Int32FromInt32(0) + ; if pPg != 0 { _sqlite3PcacheDrop(tls, pPg) } @@ -39517,18 +38539,13 @@ func _getPageMMap(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, fla ** flag was specified by the caller. And so long as the db is not a ** temporary or in-memory database. */ bMmapOk = libc.BoolInt32(pgno > uint32(1) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) || flags&int32(PAGER_GET_READONLY) != 0)) - _ = libc.Int32FromInt32(0) /* Optimization note: Adding the "pgno<=1" term before "pgno==0" here ** allows the compiler optimizer to reuse the results of the "pgno>1" ** test in the previous statement, and avoid testing pgno==0 in the ** common case where pgno is large. */ if pgno <= uint32(1) && pgno == uint32(0) { - return _sqlite3CorruptError(tls, int32(62337)) + return _sqlite3CorruptError(tls, int32(62407)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if bMmapOk != 0 && (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { rc = _sqlite3WalFindFrame(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pgno, bp+8) if rc != SQLITE_OK { @@ -39549,7 +38566,6 @@ func _getPageMMap(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, fla _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int64(pgno-libc.Uint32FromInt32(1))*(*TPager)(unsafe.Pointer(pPager)).FpageSize, *(*uintptr)(unsafe.Pointer(bp + 16))) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp)) return SQLITE_OK } @@ -39568,7 +38584,6 @@ func _getPageMMap(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, fla func _getPageError(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { _ = pgno _ = flags - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) return (*TPager)(unsafe.Pointer(pPager)).FerrCode } @@ -39598,11 +38613,7 @@ func _sqlite3PagerGet(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, func _sqlite3PagerLookup(tls *libc.TLS, pPager uintptr, pgno TPgno) (r uintptr) { var pPage uintptr _ = pPage - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pPage = _sqlite3PcacheFetch(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, pgno, 0) - _ = libc.Int32FromInt32(0) if pPage == uintptr(0) { return uintptr(0) } @@ -39626,15 +38637,14 @@ func _sqlite3PagerLookup(tls *libc.TLS, pPager uintptr, pgno TPgno) (r uintptr) // ** pages reaches zero it drops the database lock. // */ func _sqlite3PagerUnrefNotNull(tls *libc.TLS, pPg uintptr) { - _ = libc.Int32FromInt32(0) if int32((*TDbPage)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_MMAP) != 0 { - _ = libc.Int32FromInt32(0) /* Page1 is never memory mapped */ + /* Page1 is never memory mapped */ _pagerReleaseMapPage(tls, pPg) } else { _sqlite3PcacheRelease(tls, pPg) } /* Do not use this routine to release the last reference to page1 */ - _ = libc.Int32FromInt32(0) /* tag-20230419-2 */ + /* tag-20230419-2 */ } func _sqlite3PagerUnref(tls *libc.TLS, pPg uintptr) { @@ -39646,9 +38656,7 @@ func _sqlite3PagerUnref(tls *libc.TLS, pPg uintptr) { func _sqlite3PagerUnrefPageOne(tls *libc.TLS, pPg uintptr) { var pPager uintptr _ = pPager - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Page1 is never memory mapped */ + /* Page1 is never memory mapped */ pPager = (*TDbPage)(unsafe.Pointer(pPg)).FpPager _sqlite3PcacheRelease(tls, pPg) _pagerUnlockIfUnused(tls, pPager) @@ -39684,9 +38692,6 @@ func _pager_open_journal(tls *libc.TLS, pPager uintptr) (r int32) { _, _, _, _ = flags, nSpill, pVfs, rc rc = SQLITE_OK /* Return code */ pVfs = (*TPager)(unsafe.Pointer(pPager)).FpVfs /* Local cache of vfs pointer */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If already in the error state, this function is a no-op. But on ** the other hand, this routine is never called if we are already in ** an error state. */ @@ -39719,7 +38724,6 @@ func _pager_open_journal(tls *libc.TLS, pPager uintptr) (r int32) { rc = _sqlite3JournalOpen(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, (*TPager)(unsafe.Pointer(pPager)).Fjfd, flags, nSpill) } } - _ = libc.Int32FromInt32(0) } /* Write the first journal header to the journal file and open ** the sub-journal if necessary. @@ -39738,7 +38742,6 @@ func _pager_open_journal(tls *libc.TLS, pPager uintptr) (r int32) { (*TPager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 } else { - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_CACHEMOD) } return rc @@ -39770,10 +38773,8 @@ func _sqlite3PagerBegin(tls *libc.TLS, pPager uintptr, exFlag int32, subjInMemor if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { return (*TPager)(unsafe.Pointer(pPager)).FerrCode } - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FsubjInMemory = uint8(subjInMemory) if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) { - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { /* If the pager is configured to use locking_mode=exclusive, and an ** exclusive lock on the database is not already held, obtain it now. @@ -39818,9 +38819,6 @@ func _sqlite3PagerBegin(tls *libc.TLS, pPager uintptr, exFlag int32, subjInMemor (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize = (*TPager)(unsafe.Pointer(pPager)).FdbSize (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } return rc } @@ -39841,8 +38839,6 @@ func _pagerAddPageToRollbackJournal(tls *libc.TLS, pPg uintptr) (r int32) { /* We should never write to the journal file the page that ** contains the database locks. The following assert verifies ** that we do not. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pData2 = (*TPgHdr)(unsafe.Pointer(pPg)).FpData cksum = _pager_cksum(tls, pPager, pData2) /* Even if an IO or diskfull error occurs while journalling the @@ -39868,11 +38864,8 @@ func _pagerAddPageToRollbackJournal(tls *libc.TLS, pPg uintptr) (r int32) { } *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(8) + (*TPager)(unsafe.Pointer(pPager)).FpageSize (*TPager)(unsafe.Pointer(pPager)).FnRec++ - _ = libc.Int32FromInt32(0) rc = _sqlite3BitvecSet(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) - _ = libc.Int32FromInt32(0) rc |= _addToSavepointBitvecs(tls, pPager, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) - _ = libc.Int32FromInt32(0) return rc } @@ -39895,10 +38888,6 @@ func _pager_write(tls *libc.TLS, pPg uintptr) (r int32) { ** been started. The journal file may or may not be open at this point. ** It is never called in the ERROR state. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The journal file needs to be opened. Higher level routines have already ** obtained the necessary locks to begin the write-transaction, but the ** rollback journal might not yet be open. Open it now if this is the case. @@ -39914,17 +38903,13 @@ func _pager_write(tls *libc.TLS, pPg uintptr) (r int32) { return rc } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Mark the page that is about to be modified as dirty. */ _sqlite3PcacheMakeDirty(tls, pPg) /* If a rollback journal is in use, them make sure the page that is about ** to change is in the rollback journal, or if the page is a new page off ** then end of the file, make sure it is marked as PGHDR_NEED_SYNC. */ - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FpInJournal != uintptr(0) && _sqlite3BitvecTestNotNull(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) == 0 { - _ = libc.Int32FromInt32(0) if (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno <= (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize { rc = _pagerAddPageToRollbackJournal(tls, pPg) if rc != SQLITE_OK { @@ -39987,8 +38972,6 @@ func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { ** a journal header to be written between the pages journaled by ** this function. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p1 = pPager + 25 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(SPILLFLAG_NOSYNC)) /* This trick assumes that both the page-size and sector-size are @@ -40006,9 +38989,6 @@ func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { nPage = int32(nPagePerSector) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < nPage && rc == SQLITE_OK) { @@ -40038,6 +39018,7 @@ func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { } goto _2 _2: + ; ii++ } /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages @@ -40047,7 +39028,6 @@ func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { ** before any of them can be written out to the database file. */ if rc == SQLITE_OK && needSync != 0 { - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < nPage) { @@ -40061,10 +39041,10 @@ func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { } goto _4 _4: + ; ii++ } } - _ = libc.Int32FromInt32(0) p6 = pPager + 25 *(*Tu8)(unsafe.Pointer(p6)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p6))) & ^libc.Int32FromInt32(SPILLFLAG_NOSYNC)) return rc @@ -40090,9 +39070,6 @@ func _sqlite3PagerWrite(tls *libc.TLS, pPg uintptr) (r int32) { var pPager uintptr _ = pPager pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_WRITEABLE) != 0 && (*TPager)(unsafe.Pointer(pPager)).FdbSize >= (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno { if (*TPager)(unsafe.Pointer(pPager)).FnSavepoint != 0 { return _subjournalPageIfRequired(tls, pPg) @@ -40103,7 +39080,6 @@ func _sqlite3PagerWrite(tls *libc.TLS, pPg uintptr) (r int32) { return (*TPager)(unsafe.Pointer(pPager)).FerrCode } else { if (*TPager)(unsafe.Pointer(pPager)).FsectorSize > uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) { - _ = libc.Int32FromInt32(0) return _pagerWriteLargeSector(tls, pPg) } else { return _pager_write(tls, pPg) @@ -40185,8 +39161,6 @@ func _pager_incr_changecounter(tls *libc.TLS, pPager uintptr, isDirectMode int32 var _ /* pPgHdr at bp+0 */ uintptr _, _, _ = pCopy, rc, zBuf rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Declare and initialize constant integer 'isDirect'. If the ** atomic-write optimization is enabled in this build, then isDirect ** is initialized to the value passed as the isDirectMode parameter @@ -40197,13 +39171,10 @@ func _pager_incr_changecounter(tls *libc.TLS, pPager uintptr, isDirectMode int32 ** 'isDirect' below, as well as the block enclosed in the ** "if( isDirect )" condition. */ - _ = libc.Int32FromInt32(0) _ = isDirectMode if !((*TPager)(unsafe.Pointer(pPager)).FchangeCountDone != 0) && (*TPager)(unsafe.Pointer(pPager)).FdbSize > uint32(0) { /* Reference to page 1 */ - _ = libc.Int32FromInt32(0) /* Open page 1 of the file for writing. */ rc = _sqlite3PagerGet(tls, pPager, uint32(1), bp, 0) - _ = libc.Int32FromInt32(0) /* If page one was fetched successfully, and this function is not ** operating in direct-mode, make page 1 writable. When not in ** direct mode, page 1 is always held in cache and hence the PagerGet() @@ -40217,7 +39188,6 @@ func _pager_incr_changecounter(tls *libc.TLS, pPager uintptr, isDirectMode int32 _pager_write_changecounter(tls, *(*uintptr)(unsafe.Pointer(bp))) /* If running in direct mode, write the contents of page 1 to the file. */ if DIRECT_MODE != 0 { - _ = libc.Int32FromInt32(0) zBuf = (*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpData if rc == SQLITE_OK { rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, zBuf, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), 0) @@ -40261,7 +39231,6 @@ func _sqlite3PagerSync(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) rc = SQLITE_OK } if rc == SQLITE_OK && !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { - _ = libc.Int32FromInt32(0) rc = _sqlite3OsSync(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags)) } return rc @@ -40284,10 +39253,7 @@ func _sqlite3PagerExclusiveLock(tls *libc.TLS, pPager uintptr) (r int32) { var rc int32 _ = rc rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if 0 == libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0)) { rc = _pager_wait_on_lock(tls, pPager, int32(EXCLUSIVE_LOCK)) } @@ -40332,8 +39298,6 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, var _ /* pPageOne at bp+0 */ uintptr _, _, _ = nNew, pList, rc rc = SQLITE_OK /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If a prior error occurred, report that error again. */ if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { return (*TPager)(unsafe.Pointer(pPager)).FerrCode @@ -40346,8 +39310,6 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, if int32((*TPager)(unsafe.Pointer(pPager)).FeState) < int32(PAGER_WRITER_CACHEMOD) { return SQLITE_OK } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if 0 == _pagerFlushOnCommit(tls, pPager, int32(1)) { /* If this is an in-memory db, or no pages have been written to, or this ** function has already been called, it is mostly a no-op. However, any @@ -40364,7 +39326,6 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, pList = *(*uintptr)(unsafe.Pointer(bp)) (*TPgHdr)(unsafe.Pointer(pList)).FpDirty = uintptr(0) } - _ = libc.Int32FromInt32(0) if pList != 0 { rc = _pagerWalFrames(tls, pPager, pList, (*TPager)(unsafe.Pointer(pPager)).FdbSize, int32(1)) } @@ -40409,7 +39370,6 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, rc = _pager_write_pagelist(tls, pPager, pList) } if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) goto commit_phase_one_exit } _sqlite3PcacheCleanAll(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) @@ -40421,7 +39381,6 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, ** undersized. Fix this now if it is the case. */ if (*TPager)(unsafe.Pointer(pPager)).FdbSize > (*TPager)(unsafe.Pointer(pPager)).FdbFileSize { nNew = (*TPager)(unsafe.Pointer(pPager)).FdbSize - libc.BoolUint32((*TPager)(unsafe.Pointer(pPager)).FdbSize == (*TPager)(unsafe.Pointer(pPager)).FlckPgno) - _ = libc.Int32FromInt32(0) rc = _pager_truncate(tls, pPager, nNew) if rc != SQLITE_OK { goto commit_phase_one_exit @@ -40434,6 +39393,7 @@ func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, } } commit_phase_one_exit: + ; if rc == SQLITE_OK && !((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) { (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_FINISHED) } @@ -40468,8 +39428,6 @@ func _sqlite3PagerCommitPhaseTwo(tls *libc.TLS, pPager uintptr) (r int32) { return (*TPager)(unsafe.Pointer(pPager)).FerrCode } (*TPager)(unsafe.Pointer(pPager)).FiDataVersion++ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* An optimization. If the database was not actually modified during ** this transaction, the pager is running in exclusive-mode and is ** using persistent journals, then this function is a no-op. @@ -40482,7 +39440,6 @@ func _sqlite3PagerCommitPhaseTwo(tls *libc.TLS, pPager uintptr) (r int32) { ** to drop any locks either. */ if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_WRITER_LOCKED) && (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_PERSIST) { - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_READER) return SQLITE_OK } @@ -40526,7 +39483,6 @@ func _sqlite3PagerRollback(tls *libc.TLS, pPager uintptr) (r int32) { ** the pager is already in the ERROR state, the rollback is not ** attempted here. Instead, the error code is returned to the caller. */ - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_ERROR) { return (*TPager)(unsafe.Pointer(pPager)).FerrCode } @@ -40557,8 +39513,6 @@ func _sqlite3PagerRollback(tls *libc.TLS, pPager uintptr) (r int32) { rc = _pager_playback(tls, pPager, 0) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If an error occurs during a ROLLBACK, we can no longer trust the pager ** cache. So call pager_error() on the way out to make any error persistent. */ @@ -40611,10 +39565,6 @@ func _sqlite3PagerPageRefcount(tls *libc.TLS, pPage uintptr) (r int32) { // ** returning. // */ func _sqlite3PagerCacheStat(tls *libc.TLS, pPager uintptr, eStat int32, reset int32, pnVal uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) eStat -= int32(SQLITE_DBSTATUS_CACHE_HIT) *(*Tu64)(unsafe.Pointer(pnVal)) += uint64(*(*Tu32)(unsafe.Pointer(pPager + 248 + uintptr(eStat)*4))) if reset != 0 { @@ -40649,9 +39599,6 @@ func _pagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) (r int _, _, _, _ = aNew, ii, nCurrent, rc rc = SQLITE_OK /* Return code */ nCurrent = (*TPager)(unsafe.Pointer(pPager)).FnSavepoint /* New Pager.aSavepoint array */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM ** if the allocation fails. Otherwise, zero the new portion in case a ** malloc failure occurs while populating it in the for(...) loop below. @@ -40686,15 +39633,13 @@ func _pagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) (r int (*TPager)(unsafe.Pointer(pPager)).FnSavepoint = ii + int32(1) goto _1 _1: + ; ii++ } - _ = libc.Int32FromInt32(0) return rc } func _sqlite3PagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nSavepoint > (*TPager)(unsafe.Pointer(pPager)).FnSavepoint && (*TPager)(unsafe.Pointer(pPager)).FuseJournal != 0 { return _pagerOpenSavepoint(tls, pPager, nSavepoint) } else { @@ -40741,8 +39686,6 @@ func _sqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint var sz Ti64 _, _, _, _, _, _, _, _ = ii, nNew, pRel, pSavepoint, rc, sz, v1, v3 rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && iSavepoint < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint { /* Number of remaining savepoints after this op. */ /* Figure out how many savepoints will still be active after this ** operation. Store this value in nNew. Then free resources associated @@ -40762,6 +39705,7 @@ func _sqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _2 _2: + ; ii++ } (*TPager)(unsafe.Pointer(pPager)).FnSavepoint = nNew @@ -40774,7 +39718,6 @@ func _sqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint if _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { sz = ((*TPager)(unsafe.Pointer(pPager)).FpageSize + int64(4)) * int64((*TPagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec) rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd, sz) - _ = libc.Int32FromInt32(0) } (*TPager)(unsafe.Pointer(pPager)).FnSubRec = (*TPagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec } @@ -40787,7 +39730,6 @@ func _sqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint } pSavepoint = v3 rc = _pagerPlaybackSavepoint(tls, pPager, pSavepoint) - _ = libc.Int32FromInt32(0) } } } @@ -40903,13 +39845,9 @@ func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgn var _ /* pPgHdr at bp+0 */ uintptr _, _, _, _, _, _, _, _, _ = needSyncPgno, origPgno, pPgOld, rc, v1, v2, p3, p4, p5 /* The page being overwritten. */ needSyncPgno = uint32(0) /* The original page number */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* In order to be able to rollback, an in-memory database must journal ** the page we are moving from. */ - _ = libc.Int32FromInt32(0) if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { rc = _sqlite3PagerWrite(tls, pPg) if rc != 0 { @@ -40950,8 +39888,6 @@ func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgn */ if int32((*TDbPage)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_NEED_SYNC) != 0 && !(isCommit != 0) { needSyncPgno = (*TDbPage)(unsafe.Pointer(pPg)).Fpgno - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } /* If the cache contains a page with page-number pgno, remove it ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for @@ -40961,11 +39897,10 @@ func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgn p3 = pPg + 52 *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) pPgOld = _sqlite3PagerLookup(tls, pPager, pgno) - _ = libc.Int32FromInt32(0) if pPgOld != 0 { if (*TPgHdr)(unsafe.Pointer(pPgOld)).FnRef > int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -40992,7 +39927,6 @@ func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgn rc = _sqlite3PagerGet(tls, pPager, needSyncPgno, bp, 0) if rc != SQLITE_OK { if needSyncPgno <= (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize { - _ = libc.Int32FromInt32(0) _sqlite3BitvecClear(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, needSyncPgno, (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace) } return rc @@ -41014,7 +39948,6 @@ func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgn // ** the value passed as the third parameter. // */ func _sqlite3PagerRekey(tls *libc.TLS, pPg uintptr, iNew TPgno, flags Tu16) { - _ = libc.Int32FromInt32(0) (*TDbPage)(unsafe.Pointer(pPg)).Fflags = flags _sqlite3PcacheMove(tls, pPg, iNew) } @@ -41025,7 +39958,6 @@ func _sqlite3PagerRekey(tls *libc.TLS, pPg uintptr, iNew TPgno, flags Tu16) { // ** Return a pointer to the data for the specified page. // */ func _sqlite3PagerGetData(tls *libc.TLS, pPg uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) return (*TDbPage)(unsafe.Pointer(pPg)).FpData } @@ -41052,10 +39984,6 @@ func _sqlite3PagerGetExtra(tls *libc.TLS, pPg uintptr) (r uintptr) { // ** locking-mode. // */ func _sqlite3PagerLockingMode(tls *libc.TLS, pPager uintptr, eMode int32) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eMode >= 0 && !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && !(_sqlite3WalHeapMemory(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) != 0) { (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode = uint8(eMode) } @@ -41090,36 +40018,25 @@ func _sqlite3PagerSetJournalMode(tls *libc.TLS, pPager uintptr, eMode int32) (r _, _, _ = eOld, rc, state eOld = (*TPager)(unsafe.Pointer(pPager)).FjournalMode /* Prior journalmode */ /* The eMode parameter is always valid */ - _ = libc.Int32FromInt32(0) /* This routine is only called from the OP_JournalMode opcode, and ** the logic there will never allow a temporary file to be changed ** to WAL mode. */ - _ = libc.Int32FromInt32(0) /* Do allow the journalmode of an in-memory database to be set to ** anything other than MEMORY or OFF */ if (*TPager)(unsafe.Pointer(pPager)).FmemDb != 0 { - _ = libc.Int32FromInt32(0) if eMode != int32(PAGER_JOURNALMODE_MEMORY) && eMode != int32(PAGER_JOURNALMODE_OFF) { eMode = int32(eOld) } } if eMode != int32(eOld) { /* Change the journal mode. */ - _ = libc.Int32FromInt32(0) (*TPager)(unsafe.Pointer(pPager)).FjournalMode = uint8(eMode) /* When transitioning from TRUNCATE or PERSIST to any other journal ** mode except WAL, unless the pager is in locking_mode=exclusive mode, ** delete the journal file. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) && int32(eOld)&int32(5) == int32(1) && eMode&int32(1) == 0 { /* In this case we would like to delete the journal file. If it is ** not possible, then that is not a problem. Deleting the journal file @@ -41135,12 +40052,10 @@ func _sqlite3PagerSetJournalMode(tls *libc.TLS, pPager uintptr, eMode int32) (r } else { rc = SQLITE_OK state = int32((*TPager)(unsafe.Pointer(pPager)).FeState) - _ = libc.Int32FromInt32(0) if state == PAGER_OPEN { rc = _sqlite3PagerSharedLock(tls, pPager) } if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) { - _ = libc.Int32FromInt32(0) rc = _pagerLockDb(tls, pPager, int32(RESERVED_LOCK)) } if rc == SQLITE_OK { @@ -41153,7 +40068,6 @@ func _sqlite3PagerSetJournalMode(tls *libc.TLS, pPager uintptr, eMode int32) (r _pager_unlock(tls, pPager) } } - _ = libc.Int32FromInt32(0) } } else { if eMode == int32(PAGER_JOURNALMODE_OFF) || eMode == int32(PAGER_JOURNALMODE_MEMORY) { @@ -41182,7 +40096,6 @@ func _sqlite3PagerGetJournalMode(tls *libc.TLS, pPager uintptr) (r int32) { // ** is unmodified. // */ func _sqlite3PagerOkToChangeJournalMode(tls *libc.TLS, pPager uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_CACHEMOD) { return 0 } @@ -41226,7 +40139,6 @@ func _sqlite3PagerBackupPtr(tls *libc.TLS, pPager uintptr) (r uintptr) { // ** Unless this is an in-memory or temporary database, clear the pager cache. // */ func _sqlite3PagerClearCache(tls *libc.TLS, pPager uintptr) { - _ = libc.Int32FromInt32(0) if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 { _pager_reset(tls, pPager) } @@ -41256,7 +40168,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4084, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4113, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -41299,7 +40211,6 @@ func _pagerExclusiveLock(tls *libc.TLS, pPager uintptr) (r int32) { var eOrigLock Tu8 var rc int32 _, _ = eOrigLock, rc /* Original lock */ - _ = libc.Int32FromInt32(0) eOrigLock = (*TPager)(unsafe.Pointer(pPager)).FeLock rc = _pagerLockDb(tls, pPager, int32(EXCLUSIVE_LOCK)) if rc != SQLITE_OK { @@ -41322,8 +40233,6 @@ func _pagerOpenWal(tls *libc.TLS, pPager uintptr) (r int32) { var rc int32 _ = rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the pager is already in exclusive-mode, the WAL module will use ** heap-memory for the wal-index instead of the VFS shared-memory ** implementation. Take the exclusive lock now, before opening the WAL @@ -41363,11 +40272,6 @@ func _sqlite3PagerOpenWal(tls *libc.TLS, pPager uintptr, pbOpen uintptr) (r int3 var rc int32 _ = rc rc = SQLITE_OK /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && !((*TPager)(unsafe.Pointer(pPager)).FpWal != 0) { if !(_sqlite3PagerWalSupported(tls, pPager) != 0) { return int32(SQLITE_CANTOPEN) @@ -41403,7 +40307,6 @@ func _sqlite3PagerCloseWal(tls *libc.TLS, pPager uintptr, db uintptr) (r int32) var _ /* logexists at bp+0 */ int32 _ = rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) /* If the log file is not already open, but does exist in the file-system, ** it may need to be checkpointed before the connection can switch to ** rollback mode. Open it now so this can happen. @@ -41519,7 +40422,6 @@ func _sqlite3PagerSnapshotCheck(tls *libc.TLS, pPager uintptr, pSnapshot uintptr // ** sqlite3PagerSnapshotCheck(). // */ func _sqlite3PagerSnapshotUnlock(tls *libc.TLS, pPager uintptr) { - _ = libc.Int32FromInt32(0) _sqlite3WalSnapshotUnlock(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) } @@ -42176,7 +41078,6 @@ func _walIndexPageRealloc(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintp (*TWal)(unsafe.Pointer(pWal)).FnWiData = iPage + int32(1) } /* Request a pointer to the required page from the VFS */ - _ = libc.Int32FromInt32(0) if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == int32(WAL_HEAPMEMORY_MODE) { *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) = _sqlite3MallocZero(tls, libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)) if !(*(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) != 0) { @@ -42184,7 +41085,6 @@ func _walIndexPageRealloc(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintp } } else { rc = _sqlite3OsShmMap(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, iPage, int32(libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)), int32((*TWal)(unsafe.Pointer(pWal)).FwriteLock), (*TWal)(unsafe.Pointer(pWal)).FapWiData+uintptr(iPage)*8) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if iPage > 0 && _sqlite3FaultSim(tls, int32(600)) != 0 { rc = int32(SQLITE_NOMEM) @@ -42200,7 +41100,6 @@ func _walIndexPageRealloc(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintp } } *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) - _ = libc.Int32FromInt32(0) return rc } @@ -42208,7 +41107,6 @@ func _walIndexPage(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) (r var v1 uintptr var v2 bool _, _ = v1, v2 - _ = libc.Int32FromInt32(0) if v2 = (*TWal)(unsafe.Pointer(pWal)).FnWiData <= iPage; !v2 { v1 = *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) *(*uintptr)(unsafe.Pointer(ppPage)) = v1 @@ -42225,8 +41123,6 @@ func _walIndexPage(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) (r // ** Return a pointer to the WalCkptInfo structure in the wal-index. // */ func _walCkptInfo(tls *libc.TLS, pWal uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) + uintptr(libc.Uint64FromInt64(48)/libc.Uint64FromInt32(2))*4 } @@ -42236,8 +41132,6 @@ func _walCkptInfo(tls *libc.TLS, pWal uintptr) (r uintptr) { // ** Return a pointer to the WalIndexHdr structure in the wal-index. // */ func _walIndexHdr(tls *libc.TLS, pWal uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) } @@ -42274,10 +41168,6 @@ func _walChecksumBytes(tls *libc.TLS, nativeCksum int32, a uintptr, nByte int32, s2 = v1 s1 = v1 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(nativeCksum != 0) { for cond := true; cond; cond = aData < aEnd { s1 += *(*Tu32)(unsafe.Pointer(aData))&uint32(0x000000FF)<>int32(8) + *(*Tu32)(unsafe.Pointer(aData))&uint32(0xFF000000)>>int32(24) + s2 @@ -42347,7 +41237,6 @@ func _walChecksumBytes(tls *libc.TLS, nativeCksum int32, a uintptr, nByte int32, } } } - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(aOut)) = s1 *(*Tu32)(unsafe.Pointer(aOut + 1*4)) = s2 } @@ -42385,7 +41274,6 @@ func _walIndexWriteHdr(tls *libc.TLS, pWal uintptr) { _, _ = aHdr, nCksum aHdr = _walIndexHdr(tls, pWal) nCksum = int32(uint64(libc.UintptrFromInt32(0) + 40)) - _ = libc.Int32FromInt32(0) (*TWal)(unsafe.Pointer(pWal)).Fhdr.FisInit = uint8(1) (*TWal)(unsafe.Pointer(pWal)).Fhdr.FiVersion = uint32(WALINDEX_MAX_VERSION) _walChecksumBytes(tls, int32(1), pWal+72, nCksum, uintptr(0), pWal+72+40) @@ -42415,7 +41303,6 @@ func _walEncodeFrame(tls *libc.TLS, pWal uintptr, iPage Tu32, nTruncate Tu32, aD var nativeCksum int32 _, _ = aCksum, nativeCksum /* True for native byte-order checksums */ aCksum = pWal + 72 + 24 - _ = libc.Int32FromInt32(0) _sqlite3Put4byte(tls, aFrame, iPage) _sqlite3Put4byte(tls, aFrame+4, nTruncate) if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(0) { @@ -42443,7 +41330,6 @@ func _walDecodeFrame(tls *libc.TLS, pWal uintptr, piPage uintptr, pnTruncate uin var pgno Tu32 _, _, _ = aCksum, nativeCksum, pgno /* True for native byte-order checksums */ aCksum = pWal + 72 + 24 /* Page number of the frame */ - _ = libc.Int32FromInt32(0) /* A frame is only valid if the salt values in the frame-header ** match the salt values in the wal-header. */ @@ -42527,8 +41413,6 @@ func _walUnlockExclusive(tls *libc.TLS, pWal uintptr, lockIdx int32, n int32) { // ** the hash to the next value in the event of a collision. // */ func _walHash(tls *libc.TLS, iPage Tu32) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int32(iPage * uint32(HASHTABLE_HASH_1) & uint32(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) } @@ -42579,7 +41463,6 @@ func _walHashGet(tls *libc.TLS, pWal uintptr, iHash int32, pLoc uintptr) (r int3 var rc int32 _ = rc /* Return code */ rc = _walIndexPage(tls, pWal, iHash, pLoc+8) - _ = libc.Int32FromInt32(0) if (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno != 0 { (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaHash = (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + 4096*4 if iHash == 0 { @@ -42608,8 +41491,6 @@ func _walFramePage(tls *libc.TLS, iFrame Tu32) (r int32) { var iHash int32 _ = iHash iHash = int32((uint64(iFrame+uint32(HASHTABLE_NPAGE)) - (libc.Uint64FromInt32(HASHTABLE_NPAGE) - (libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)) - uint64(1)) / uint64(HASHTABLE_NPAGE)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return iHash } @@ -42622,7 +41503,6 @@ func _walFramePgno(tls *libc.TLS, pWal uintptr, iFrame Tu32) (r Tu32) { var iHash int32 _ = iHash iHash = _walFramePage(tls, iFrame) - _ = libc.Int32FromInt32(0) if iHash == 0 { return *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) + uintptr((libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)+uint64(iFrame)-uint64(1))*4)) } @@ -42650,7 +41530,6 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { var _ /* sLoc at bp+0 */ TWalHashLoc _, _, _ = i, iLimit, nByte /* Hash table location */ iLimit = 0 /* Used to iterate through aHash[] */ - _ = libc.Int32FromInt32(0) if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == uint32(0) { return } @@ -42658,8 +41537,6 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed ** that the page said hash-table and array reside on is already mapped.(1) */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i = _walHashGet(tls, pWal, _walFramePage(tls, (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame), bp) if i != 0 { return @@ -42668,7 +41545,6 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { ** than pWal->hdr.mxFrame. */ iLimit = int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame - (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2)) { @@ -42679,13 +41555,13 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with ** frame numbers greater than pWal->hdr.mxFrame. */ nByte = int32(int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash) - int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno+uintptr(iLimit)*4)) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno+uintptr(iLimit)*4, 0, uint64(nByte)) } @@ -42707,13 +41583,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in */ if rc == SQLITE_OK { /* Number of hash collisions */ idx = int32(iFrame - (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) - _ = libc.Int32FromInt32(0) /* If this is the first entry to be added to this hash-table, zero the ** entire hash table and aPgno[] array before proceeding. */ if idx == int32(1) { nByte = int32(int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash+uintptr(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))*2) - int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno)) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno, 0, uint64(nByte)) } /* If the entry in aPgno[] is already set, then the previous writer @@ -42724,7 +41598,6 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in */ if *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) != 0 { _walCleanupHash(tls, pWal) - _ = libc.Int32FromInt32(0) } /* Write the aPgno[] array entry and the hash-table slot. */ nCollide = idx @@ -42736,10 +41609,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -42782,10 +41656,6 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** If successful, the same bytes that are locked here are unlocked before ** this function returns. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iLock = int32(WAL_ALL_BUT_WRITE) + int32((*TWal)(unsafe.Pointer(pWal)).FckptLock) rc = _walLockExclusive(tls, pWal, iLock, libc.Int32FromInt32(3)+libc.Int32FromInt32(0)-iLock) if rc != 0 { @@ -42827,7 +41697,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -42859,7 +41729,6 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } iFirst = uint32(uint64(1) + v3) rc = _walIndexPage(tls, pWal, int32(iPg), bp+40) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp + 40)) == uintptr(0) { break } @@ -42893,6 +41762,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -42912,17 +41782,18 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** is safe for this. Memcpy() is certainly a lot faster. */ libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 40))+uintptr(nHdr32)*4, aPrivate+uintptr(nHdr32)*4, libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)-uint64(nHdr)) - _ = libc.Int32FromInt32(0) if iFrame <= iLast { break } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -42947,7 +41818,6 @@ finished: } else { *(*Tu32)(unsafe.Pointer(pInfo + 4 + uintptr(i)*4)) = uint32(READMARK_NOT_USED) } - _ = libc.Int32FromInt32(0) _walUnlockExclusive(tls, pWal, int32(3)+i, int32(1)) } else { if rc != int32(SQLITE_BUSY) { @@ -42956,6 +41826,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -42964,10 +41835,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)<= 0) { @@ -43154,6 +42002,7 @@ func _walIteratorNext(tls *libc.TLS, p uintptr, piPage uintptr, piFrame uintptr) } goto _1 _1: + ; i-- } v2 = iRet @@ -43198,7 +42047,6 @@ func _walMerge(tls *libc.TLS, aContent uintptr, aLeft uintptr, nLeft int32, paRi iOut = 0 /* Current index in output buffer */ nRight = *(*int32)(unsafe.Pointer(pnRight)) aRight = *(*uintptr)(unsafe.Pointer(paRight)) - _ = libc.Int32FromInt32(0) for iRight < nRight || iLeft < nLeft { if iLeft < nLeft && (iRight >= nRight || *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) < *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aRight + uintptr(iRight)*2)))*4))) { v1 = iLeft @@ -43216,8 +42064,6 @@ func _walMerge(tls *libc.TLS, aContent uintptr, aLeft uintptr, nLeft int32, paRi if iLeft < nLeft && *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) == dbpage { iLeft++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } *(*uintptr)(unsafe.Pointer(paRight)) = aLeft *(*int32)(unsafe.Pointer(pnRight)) = iOut @@ -43261,8 +42107,6 @@ func _walMergesort(tls *libc.TLS, aContent uintptr, aBuffer uintptr, aList uintp *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Index into input list */ iSub = uint32(0) /* Array of sub-lists */ libc.Xmemset(tls, bp+16, 0, uint64(208)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iList = 0 for { if !(iList < nList) { @@ -43275,10 +42119,7 @@ func _walMergesort(tls *libc.TLS, aContent uintptr, aBuffer uintptr, aList uintp if !(iList&(int32(1)<0). */ - _ = libc.Int32FromInt32(0) iLast = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame /* Allocate space for the WalIterator object. */ nSegment = _walFramePage(tls, iLast) + int32(1) @@ -43406,6 +42245,7 @@ func _walIteratorInit(tls *libc.TLS, pWal uintptr, nBackfill Tu32, pp uintptr) ( *(*Tht_slot)(unsafe.Pointer(aIndex + uintptr(j)*2)) = uint16(j) goto _3 _3: + ; j++ } _walMergesort(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno, aTmp, aIndex, bp+24) @@ -43416,6 +42256,7 @@ func _walIteratorInit(tls *libc.TLS, pWal uintptr, nBackfill Tu32, pp uintptr) ( } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -43497,9 +42338,9 @@ func _walRestartHdr(tls *libc.TLS, pWal uintptr, _salt1 Tu32) { *(*Tu32)(unsafe.Pointer(pInfo + 4 + uintptr(i)*4)) = uint32(READMARK_NOT_USED) goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) } // C documentation @@ -43560,7 +42401,6 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill < (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame { /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked ** in the SQLITE_CHECKPOINT_PASSIVE mode. */ - _ = libc.Int32FromInt32(0) /* Compute in mxSafeFrame the index of the last frame of the WAL that is ** safe to write into the database. Frames beyond mxSafeFrame might ** overwrite database pages that are in use by active readers and thus @@ -43574,9 +42414,7 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy break } y = libc.AtomicLoadNUint32(pInfo+4+uintptr(i)*4, libc.Int32FromInt32(__ATOMIC_RELAXED)) - _ = libc.Int32FromInt32(0) if mxSafeFrame > y { - _ = libc.Int32FromInt32(0) rc = _walBusyLock(tls, pWal, xBusy, pBusyArg, int32(3)+i, int32(1)) if rc == SQLITE_OK { if i == int32(1) { @@ -43586,7 +42424,6 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy } iMark = v2 libc.AtomicStoreNUint32(pInfo+4+uintptr(i)*4, iMark, libc.Int32FromInt32(__ATOMIC_RELAXED)) - _ = libc.Int32FromInt32(0) _walUnlockExclusive(tls, pWal, int32(3)+i, int32(1)) } else { if rc == int32(SQLITE_BUSY) { @@ -43599,12 +42436,12 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy } goto _1 _1: + ; i++ } /* Allocate the iterator */ if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill < mxSafeFrame { rc = _walIteratorInit(tls, pWal, (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill, bp) - _ = libc.Int32FromInt32(0) } if v4 = *(*uintptr)(unsafe.Pointer(bp)) != 0; v4 { v3 = _walBusyLock(tls, pWal, xBusy, pBusyArg, libc.Int32FromInt32(3)+libc.Int32FromInt32(0), int32(1)) @@ -43613,7 +42450,6 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy if v4 && v3 == SQLITE_OK { nBackfill = (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted = mxSafeFrame - _ = libc.Int32FromInt32(0) /* Sync the WAL to disk */ rc = _sqlite3OsSync(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, sync_flags>>int32(2)&int32(0x03)) /* If the database may grow as a result of this checkpoint, hint @@ -43629,7 +42465,7 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy ** database plus the amount of data in the wal file, plus the ** maximum size of the pending-byte page (65536 bytes), then ** must be corruption somewhere. */ - rc = _sqlite3CorruptError(tls, int32(66771)) + rc = _sqlite3CorruptError(tls, int32(66841)) } else { _sqlite3OsFileControlHint(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_FCNTL_SIZE_HINT), bp+16) } @@ -43637,8 +42473,6 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy } /* Iterate through the contents of the WAL, copying data to the db file */ for rc == SQLITE_OK && 0 == _walIteratorNext(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+8, bp+12) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { v5 = int32(SQLITE_NOMEM) @@ -43675,7 +42509,6 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy } if rc == SQLITE_OK { libc.AtomicStoreNUint32(pInfo, mxSafeFrame, libc.Int32FromInt32(__ATOMIC_RELAXED)) - _ = libc.Int32FromInt32(0) } } /* Release the reader lock held while backfilling */ @@ -43693,14 +42526,11 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy ** the next process to write to the database restarts the wal file. */ if rc == SQLITE_OK && eMode != SQLITE_CHECKPOINT_PASSIVE { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill < (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame { rc = int32(SQLITE_BUSY) } else { if eMode >= int32(SQLITE_CHECKPOINT_RESTART) { Xsqlite3_randomness(tls, int32(4), bp+32) - _ = libc.Int32FromInt32(0) rc = _walBusyLock(tls, pWal, xBusy, pBusyArg, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) if rc == SQLITE_OK { if eMode == int32(SQLITE_CHECKPOINT_TRUNCATE) { @@ -43726,6 +42556,7 @@ func _walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy } } walcheckpoint_out: + ; _walIteratorFree(tls, *(*uintptr)(unsafe.Pointer(bp))) return rc } @@ -43749,7 +42580,7 @@ func _walLimitSize(tls *libc.TLS, pWal uintptr, nMax Ti64) { } _sqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, __ccgo_ts+4139, libc.VaList(bp+16, (*TWal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, __ccgo_ts+4168, libc.VaList(bp+16, (*TWal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -43768,7 +42599,6 @@ func _sqlite3WalClose(tls *libc.TLS, pWal uintptr, db uintptr, sync_flags int32, rc = SQLITE_OK if pWal != 0 { isDelete = 0 /* True to unlink wal and wal-index files */ - _ = libc.Int32FromInt32(0) /* If an EXCLUSIVE lock can be obtained on the database file (using the ** ordinary, rollback-mode locking methods, this guarantees that the ** connection associated with this log file is the only connection to @@ -43848,7 +42678,6 @@ func _walIndexTryHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { var _ /* h2 at bp+56 */ TWalIndexHdr _ = aHdr /* Header in shared memory */ /* The first page of the wal-index must be mapped at this point. */ - _ = libc.Int32FromInt32(0) /* Read the header. This might happen concurrently with a write to the ** same area of shared memory on a different CPU in a SMP, ** meaning it is possible that an inconsistent snapshot is read @@ -43917,10 +42746,9 @@ func _walIndexReadHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { /* Ensure that page 0 of the wal-index (the page that contains the ** wal-index header) is mapped. Return early if an error occurs here. */ - _ = libc.Int32FromInt32(0) rc = _walIndexPage(tls, pWal, 0, bp) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) /* READONLY changed to OK in walIndexPage */ + /* READONLY changed to OK in walIndexPage */ if rc == libc.Int32FromInt32(SQLITE_READONLY)|libc.Int32FromInt32(5)<writeLock ** is zero, which prevents the SHM from growing */ } - _ = libc.Int32FromInt32(0) /* If the first page of the wal-index has been mapped, try to read the ** wal-index header immediately, without holding any lock. This usually ** works, but may fail if the wal-index header is corrupt or currently @@ -43997,13 +42821,12 @@ func _walIndexReadHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { ** this version of SQLite cannot understand. */ if badHdr == 0 && (*TWal)(unsafe.Pointer(pWal)).Fhdr.FiVersion != uint32(WALINDEX_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(67215)) + rc = _sqlite3CantopenError(tls, int32(67285)) } if (*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable != 0 { if rc != SQLITE_OK { _walIndexClose(tls, pWal, 0) (*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable = uint8(0) - _ = libc.Int32FromInt32(0) /* walIndexRecover() might have returned SHORT_READ if a concurrent ** writer truncated the WAL out from under it. If that happens, it ** indicates that a writer has fixed the SHM file for us, so retry */ @@ -44059,9 +42882,6 @@ func _walBeginShmUnreliable(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r in var _ /* szWal at bp+0 */ Ti64 _, _, _, _, _, _, _, _, _ = aData, aFrame, aSaveCksum, i, iOffset, rc, szFrame, v1, v2 /* Buffer to load WAL header into */ aFrame = uintptr(0) /* Saved copy of pWal->hdr.aFrameCksum */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Take WAL_READ_LOCK(0). This has the effect of preventing any ** writers from running a checkpoint, but does not stop them ** from running recovery. */ @@ -44096,7 +42916,7 @@ func _walBeginShmUnreliable(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r in ** This is a requirement on the VFS implementation. */ rc = _sqlite3OsShmMap(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, 0, int32(libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)), 0, bp+40) - _ = libc.Int32FromInt32(0) /* SQLITE_OK not possible for read-only connection */ + /* SQLITE_OK not possible for read-only connection */ if rc != libc.Int32FromInt32(SQLITE_READONLY)|libc.Int32FromInt32(5)<hdr.mxFrame, this problem does not come up. */ (*TWal)(unsafe.Pointer(pWal)).FminFrame = uint32(int32(libc.AtomicLoadNUint32(pInfo, libc.Int32FromInt32(__ATOMIC_RELAXED))) + int32(1)) - _ = libc.Int32FromInt32(0) _walShmBarrier(tls, pWal) if libc.AtomicLoadNUint32(pInfo+4+uintptr(mxI)*4, libc.Int32FromInt32(__ATOMIC_RELAXED)) != mxReadMark || libc.Xmemcmp(tls, _walIndexHdr(tls, pWal), pWal+72, uint64(48)) != 0 { _walUnlockShared(tls, pWal, int32(3)+mxI) return -int32(1) } else { - _ = libc.Int32FromInt32(0) (*TWal)(unsafe.Pointer(pWal)).FreadLock = int16(mxI) } return rc @@ -44551,7 +43362,6 @@ func _walSnapshotRecover(tls *libc.TLS, pWal uintptr, pBuf1 uintptr, pBuf2 uintp if rc != SQLITE_OK { break } - _ = libc.Int32FromInt32(0) pgno = *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp + 8))).FaPgno + uintptr(i-(*(*TWalHashLoc)(unsafe.Pointer(bp + 8))).FiZero-uint32(1))*4)) iDbOff = int64(pgno-libc.Uint32FromInt32(1)) * int64(szPage) if iDbOff+int64(szPage) <= *(*Ti64)(unsafe.Pointer(bp)) { @@ -44567,6 +43377,7 @@ func _walSnapshotRecover(tls *libc.TLS, pWal uintptr, pBuf1 uintptr, pBuf2 uintp (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted = i - uint32(1) goto _1 _1: + ; i-- } } @@ -44598,7 +43409,6 @@ func _sqlite3WalSnapshotRecover(tls *libc.TLS, pWal uintptr) (r int32) { var pBuf1, pBuf2 uintptr var rc int32 _, _, _ = pBuf1, pBuf2, rc - _ = libc.Int32FromInt32(0) rc = _walLockExclusive(tls, pWal, int32(WAL_CKPT_LOCK), int32(1)) if rc == SQLITE_OK { pBuf1 = Xsqlite3_malloc(tls, int32((*TWal)(unsafe.Pointer(pWal)).FszPage)) @@ -44608,7 +43418,6 @@ func _sqlite3WalSnapshotRecover(tls *libc.TLS, pWal uintptr) (r int32) { } else { (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(1) rc = _walSnapshotRecover(tls, pWal, pBuf1, pBuf2) - _ = libc.Int32FromInt32(0) (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(0) } Xsqlite3_free(tls, pBuf1) @@ -44635,8 +43444,6 @@ func _walBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r ckptLock = 0 bChanged = 0 pSnapshot = (*TWal)(unsafe.Pointer(pWal)).FpSnapshot - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pSnapshot != 0 { if libc.Xmemcmp(tls, pSnapshot, pWal+72, uint64(48)) != 0 { bChanged = int32(1) @@ -44674,8 +43481,6 @@ func _walBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r ** checkpoint need not have completed for this to cause problems. */ pInfo = _walCkptInfo(tls, pWal) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Check that the wal file has not been wrapped. Assuming that it has ** not, also check that no checkpointer has attempted to checkpoint any ** frames beyond pSnapshot->mxFrame. If either of these conditions are @@ -44683,7 +43488,6 @@ func _walBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r ** with *pSnapshot and set *pChanged as appropriate for opening the ** snapshot. */ if !(libc.Xmemcmp(tls, pSnapshot+32, pWal+72+32, uint64(8)) != 0) && (*TWalIndexHdr)(unsafe.Pointer(pSnapshot)).FmxFrame >= (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pWal+72, pSnapshot, uint64(48)) *(*int32)(unsafe.Pointer(pChanged)) = bChanged } else { @@ -44703,7 +43507,6 @@ func _walBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r } /* Release the shared CKPT lock obtained above. */ if ckptLock != 0 { - _ = libc.Int32FromInt32(0) _walUnlockShared(tls, pWal, int32(WAL_CKPT_LOCK)) } return rc @@ -44729,7 +43532,6 @@ func _sqlite3WalBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintp var rc int32 _ = rc rc = _walBeginReadTransaction(tls, pWal, pChanged) - _ = libc.Int32FromInt32(0) return rc } @@ -44767,7 +43569,6 @@ func _walFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r i iRead = uint32(0) /* If !=0, WAL frame to return data from */ iLast = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame /* This routine is only be called from within a read transaction. */ - _ = libc.Int32FromInt32(0) /* If the "last page" field of the wal-index header snapshot is 0, then ** no data will be read from the wal under any circumstances. Return early ** in this case as an optimization. Likewise, if pWal->readLock==0, @@ -44815,7 +43616,6 @@ func _walFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r i } nCollide = libc.Int32FromInt32(HASHTABLE_NPAGE) * libc.Int32FromInt32(2) iKey = _walHash(tls, pgno) - _ = libc.Int32FromInt32(0) for { v2 = uint32(libc.AtomicLoadNUint16((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash+uintptr(iKey)*2, libc.Int32FromInt32(__ATOMIC_RELAXED))) iH = v2 @@ -44824,14 +43624,13 @@ func _walFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r i } iFrame = iH + (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero if iFrame <= iLast && iFrame >= (*TWal)(unsafe.Pointer(pWal)).FminFrame && *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(iH-uint32(1))*4)) == pgno { - _ = libc.Int32FromInt32(0) iRead = iFrame } v3 = nCollide nCollide-- if v3 == 0 { *(*Tu32)(unsafe.Pointer(piRead)) = uint32(0) - return _sqlite3CorruptError(tls, int32(68059)) + return _sqlite3CorruptError(tls, int32(68129)) } iKey = _walNextHash(tls, iKey) } @@ -44840,6 +43639,7 @@ func _walFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r i } goto _1 _1: + ; iHash-- } *(*Tu32)(unsafe.Pointer(piRead)) = iRead @@ -44863,7 +43663,6 @@ func _sqlite3WalFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintpt var rc int32 _ = rc rc = _walFindFrame(tls, pWal, pgno, piRead) - _ = libc.Int32FromInt32(0) return rc } @@ -44922,8 +43721,6 @@ func _sqlite3WalBeginWriteTransaction(tls *libc.TLS, pWal uintptr) (r int32) { _ = rc /* Cannot start a write transaction without first holding a read ** transaction. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWal)(unsafe.Pointer(pWal)).FreadOnly != 0 { return int32(SQLITE_READONLY) } @@ -44942,7 +43739,6 @@ func _sqlite3WalBeginWriteTransaction(tls *libc.TLS, pWal uintptr) (r int32) { if libc.Xmemcmp(tls, pWal+72, _walIndexHdr(tls, pWal), uint64(48)) != 0 { rc = libc.Int32FromInt32(SQLITE_BUSY) | libc.Int32FromInt32(2)< uint32(0) { Xsqlite3_randomness(tls, int32(4), bp+4) rc = _walLockExclusive(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) @@ -45123,7 +43913,7 @@ func _walRestartLog(tls *libc.TLS, pWal uintptr) (r int32) { for cond := true; cond; cond = rc == -int32(1) { rc = _walTryBeginRead(tls, pWal, bp+8, int32(1), bp) } - _ = libc.Int32FromInt32(0) /* BUSY not possible when useWal==1 */ + /* BUSY not possible when useWal==1 */ } return rc } @@ -45167,7 +43957,6 @@ func _walWriteToLog(tls *libc.TLS, p uintptr, pContent uintptr, iAmt int32, iOff iOffset += int64(iFirstAmt) iAmt -= iFirstAmt pContent = uintptr(iFirstAmt) + pContent - _ = libc.Int32FromInt32(0) rc = _sqlite3OsSync(tls, (*TWalWriter)(unsafe.Pointer(p)).FpFd, (*TWalWriter)(unsafe.Pointer(p)).FsyncFlags&int32(0x03)) if iAmt == 0 || rc != 0 { return rc @@ -45230,7 +44019,6 @@ func _walRewriteChecksums(tls *libc.TLS, pWal uintptr, iLast Tu32) (r int32) { ** transaction restarted the wal file), these values must be read from the ** wal-file header. Otherwise, read them from the frame header of the ** previous frame. */ - _ = libc.Int32FromInt32(0) if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(1) { iCksumOff = int64(24) } else { @@ -45255,6 +44043,7 @@ func _walRewriteChecksums(tls *libc.TLS, pWal uintptr, iLast Tu32) (r int32) { } goto _1 _1: + ; iRead++ } Xsqlite3_free(tls, aBuf) @@ -45283,11 +44072,8 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc pLast = uintptr(0) /* Last frame in list */ nExtra = 0 /* The writer */ iFirst = uint32(0) /* Pointer to shared header */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this frame set completes a transaction, then nTruncate>0. If ** nTruncate==0 then this frame set does not complete the transaction. */ - _ = libc.Int32FromInt32(0) pLive = _walIndexHdr(tls, pWal) if libc.Xmemcmp(tls, pWal+72, pLive, uint64(48)) != 0 { iFirst = (*TWalIndexHdr)(unsafe.Pointer(pLive)).FmxFrame + uint32(1) @@ -45341,7 +44127,7 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc } } if int32((*TWal)(unsafe.Pointer(pWal)).FszPage) != szPage { - return _sqlite3CorruptError(tls, int32(68582)) /* TH3 test case: cov1/corrupt155.test */ + return _sqlite3CorruptError(tls, int32(68652)) /* TH3 test case: cov1/corrupt155.test */ } /* Setup information needed to write frames into the WAL */ (*(*TWalWriter)(unsafe.Pointer(bp))).FpWal = pWal @@ -45364,7 +44150,6 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc if iFirst != 0 && ((*TPgHdr)(unsafe.Pointer(p)).FpDirty != 0 || isCommit == 0) { *(*Tu32)(unsafe.Pointer(bp + 72)) = uint32(0) _walFindFrame(tls, pWal, (*TPgHdr)(unsafe.Pointer(p)).Fpgno, bp+72) - _ = libc.Int32FromInt32(0) if *(*Tu32)(unsafe.Pointer(bp + 72)) >= iFirst { iOff = int64(WAL_HDRSIZE) + int64(*(*Tu32)(unsafe.Pointer(bp + 72))-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + int64(WAL_FRAME_HDRSIZE) if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 72)) < (*TWal)(unsafe.Pointer(pWal)).FiReCksum { @@ -45381,7 +44166,6 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc } } iFrame++ - _ = libc.Int32FromInt32(0) if isCommit != 0 && (*TPgHdr)(unsafe.Pointer(p)).FpDirty == uintptr(0) { v4 = nTruncate } else { @@ -45398,6 +44182,7 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(PGHDR_WAL_APPEND)) goto _2 _2: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty } /* Recalculate checksums within the wal file if required. */ @@ -45434,11 +44219,9 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc } iOffset += int64(szFrame) nExtra++ - _ = libc.Int32FromInt32(0) } } if bSync != 0 { - _ = libc.Int32FromInt32(0) rc = _sqlite3OsSync(tls, (*(*TWalWriter)(unsafe.Pointer(bp))).FpFd, sync_flags&int32(0x03)) } } @@ -45472,9 +44255,9 @@ func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTrunc rc = _walIndexAppend(tls, pWal, iFrame, (*TPgHdr)(unsafe.Pointer(p)).Fpgno) goto _6 _6: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty } - _ = libc.Int32FromInt32(0) for rc == SQLITE_OK && nExtra > 0 { iFrame++ nExtra-- @@ -45510,7 +44293,6 @@ func _sqlite3WalFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, var rc int32 _ = rc rc = _walFrames(tls, pWal, szPage, pList, nTruncate, isCommit, sync_flags) - _ = libc.Int32FromInt32(0) return rc } @@ -45536,11 +44318,8 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, *(*int32)(unsafe.Pointer(bp)) = 0 /* True if a new wal-index header is loaded */ eMode2 = eMode /* Mode to pass to walCheckpoint() */ xBusy2 = xBusy /* Busy handler for eMode2 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked ** in the SQLITE_CHECKPOINT_PASSIVE mode. */ - _ = libc.Int32FromInt32(0) if (*TWal)(unsafe.Pointer(pWal)).FreadOnly != 0 { return int32(SQLITE_READONLY) } @@ -45597,7 +44376,7 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, /* Copy data from the log to the database file. */ if rc == SQLITE_OK { if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { - rc = _sqlite3CorruptError(tls, int32(68842)) + rc = _sqlite3CorruptError(tls, int32(68912)) } else { rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) } @@ -45606,13 +44385,11 @@ func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, if pnLog != 0 { *(*int32)(unsafe.Pointer(pnLog)) = int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) } - _ = libc.Int32FromInt32(0) if pnCkpt != 0 { *(*int32)(unsafe.Pointer(pnCkpt)) = int32((*TWalCkptInfo)(unsafe.Pointer(_walCkptInfo(tls, pWal))).FnBackfill) } } } - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != 0 { /* If a new wal-index header was loaded before the checkpoint was ** performed, then the pager-cache associated with pWal is now @@ -45683,16 +44460,12 @@ func _sqlite3WalCallback(tls *libc.TLS, pWal uintptr) (r int32) { func _sqlite3WalExclusiveMode(tls *libc.TLS, pWal uintptr, op int32) (r int32) { var rc int32 _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* pWal->readLock is usually set, but might be -1 if there was a ** prior error while attempting to acquire are read-lock. This cannot ** happen if the connection is actually in exclusive mode (as no xShmLock ** locks are taken in this case). Nor should the pager attempt to ** upgrade to exclusive-mode following such an error. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if op == 0 { if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) != WAL_NORMAL_MODE { (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_NORMAL_MODE) @@ -45706,8 +44479,6 @@ func _sqlite3WalExclusiveMode(tls *libc.TLS, pWal uintptr, op int32) (r int32) { } } else { if op > 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _walUnlockShared(tls, pWal, int32(3)+int32((*TWal)(unsafe.Pointer(pWal)).FreadLock)) (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_EXCLUSIVE_MODE) rc = int32(1) @@ -45740,7 +44511,6 @@ func _sqlite3WalSnapshotGet(tls *libc.TLS, pWal uintptr, ppSnapshot uintptr) (r var rc int32 _, _ = pRet, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if libc.Xmemcmp(tls, pWal+72+24, uintptr(unsafe.Pointer(&_aZero)), uint64(16)) == 0 { *(*uintptr)(unsafe.Pointer(ppSnapshot)) = uintptr(0) return int32(SQLITE_ERROR) @@ -45818,7 +44588,6 @@ func _sqlite3WalSnapshotCheck(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) (r _walUnlockShared(tls, pWal, int32(WAL_CKPT_LOCK)) } } - _ = libc.Int32FromInt32(0) return rc } @@ -45829,7 +44598,6 @@ func _sqlite3WalSnapshotCheck(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) (r // ** sqlite3WalSnapshotCheck(). // */ func _sqlite3WalSnapshotUnlock(tls *libc.TLS, pWal uintptr) { - _ = libc.Int32FromInt32(0) _walUnlockShared(tls, pWal, int32(WAL_CKPT_LOCK)) } @@ -46590,9 +45358,6 @@ type IntegrityCk1 = TIntegrityCk1 // ** p->locked boolean to true. // */ func _lockBtreeMutex(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fmutex) (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fdb = (*TBtree)(unsafe.Pointer(p)).Fdb (*TBtree)(unsafe.Pointer(p)).Flocked = uint8(1) @@ -46608,10 +45373,6 @@ func _unlockBtreeMutex(tls *libc.TLS, p uintptr) { var pBt uintptr _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fmutex) (*TBtree)(unsafe.Pointer(p)).Flocked = uint8(0) } @@ -46639,19 +45400,10 @@ func _sqlite3BtreeEnter(tls *libc.TLS, p uintptr) { ** connected by pNext and pPrev should be in sorted order by ** Btree.pBt value. All elements of the list should belong to ** the same connection. Only shared Btrees are on the list. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Check for locking consistency */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* We should already hold a lock on the database connection */ - _ = libc.Int32FromInt32(0) /* Unless the database is sharable and unlocked, then BtShared.db ** should already be set correctly. */ - _ = libc.Int32FromInt32(0) if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) { return } @@ -46692,14 +45444,12 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { if !(pLater != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TBtree)(unsafe.Pointer(pLater)).Flocked != 0 { _unlockBtreeMutex(tls, pLater) } goto _1 _1: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } _lockBtreeMutex(tls, p) @@ -46713,6 +45463,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext } } @@ -46723,9 +45474,7 @@ func _btreeLockCarefully(tls *libc.TLS, p uintptr) { // ** Exit the recursive mutex on a Btree. // */ func _sqlite3BtreeLeave(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { - _ = libc.Int32FromInt32(0) (*TBtree)(unsafe.Pointer(p)).FwantToLock-- if (*TBtree)(unsafe.Pointer(p)).FwantToLock == 0 { _unlockBtreeMutex(tls, p) @@ -46754,7 +45503,6 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { var p uintptr _, _, _ = i, p, skipOk skipOk = int32(1) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -46767,6 +45515,7 @@ func _btreeEnterAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) @@ -46782,7 +45531,6 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { var i int32 var p uintptr _, _ = i, p - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -46794,6 +45542,7 @@ func _btreeLeaveAll(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } } @@ -46922,16 +45671,10 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) var pBt, pIter, p2 uintptr _, _, _ = pBt, pIter, p2 pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If requesting a write-lock, then the Btree must have an open write ** transaction on this file. And, obviously, for this to be so there ** must be an open write transaction on the file itself. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This routine is a no-op if the shared-cache is not enabled */ if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) { return SQLITE_OK @@ -46957,12 +45700,9 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) ** may hold a WRITE_LOCK on any table in this file (since there can ** only be a single writer). */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TBtLock)(unsafe.Pointer(pIter)).FpBtree != p && (*TBtLock)(unsafe.Pointer(pIter)).FiTable == iTab && int32((*TBtLock)(unsafe.Pointer(pIter)).FeLock) != int32(eLock) { _sqlite3ConnectionBlocked(tls, (*TBtree)(unsafe.Pointer(p)).Fdb, (*TBtree)(unsafe.Pointer((*TBtLock)(unsafe.Pointer(pIter)).FpBtree)).Fdb) if int32(eLock) == int32(WRITE_LOCK) { - _ = libc.Int32FromInt32(0) p2 = pBt + 40 *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTS_PENDING)) } @@ -46970,6 +45710,7 @@ func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } return SQLITE_OK @@ -46999,18 +45740,12 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) _, _, _ = pBt, pIter, pLock pBt = (*TBtree)(unsafe.Pointer(p)).FpBt pLock = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* A connection with the read-uncommitted flag set will never try to ** obtain a read-lock using this function. The only read-lock obtained ** by a connection in read-uncommitted mode is on the sqlite_schema ** table, and that lock is obtained in BtreeBeginTrans(). */ - _ = libc.Int32FromInt32(0) /* This function should only be called on a sharable b-tree after it ** has been determined that no other b-tree holds a conflicting lock. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* First search the list for an existing lock on this table. */ pIter = (*TBtShared)(unsafe.Pointer(pBt)).FpLock for { @@ -47023,6 +45758,7 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) } goto _1 _1: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } /* If the above search did not find a BtLock struct associating Btree p @@ -47042,7 +45778,6 @@ func _setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable TPgno, eLock Tu8) ** and the requested lock. This means if a write-lock was already held ** and a read-lock requested, we don't incorrectly downgrade the lock. */ - _ = libc.Int32FromInt32(0) if int32(eLock) > int32((*TBtLock)(unsafe.Pointer(pLock)).FeLock) { (*TBtLock)(unsafe.Pointer(pLock)).FeLock = eLock } @@ -47064,16 +45799,10 @@ func _clearAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { _, _, _, _, _ = pBt, pLock, ppIter, p1, p2 pBt = (*TBtree)(unsafe.Pointer(p)).FpBt ppIter = pBt + 120 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for *(*uintptr)(unsafe.Pointer(ppIter)) != 0 { pLock = *(*uintptr)(unsafe.Pointer(ppIter)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TBtLock)(unsafe.Pointer(pLock)).FpBtree == p { *(*uintptr)(unsafe.Pointer(ppIter)) = (*TBtLock)(unsafe.Pointer(pLock)).FpNext - _ = libc.Int32FromInt32(0) if (*TBtLock)(unsafe.Pointer(pLock)).FiTable != uint32(1) { Xsqlite3_free(tls, pLock) } @@ -47081,7 +45810,6 @@ func _clearAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { ppIter = pLock + 16 } } - _ = libc.Int32FromInt32(0) if (*TBtShared)(unsafe.Pointer(pBt)).FpWriter == p { (*TBtShared)(unsafe.Pointer(pBt)).FpWriter = uintptr(0) p1 = pBt + 40 @@ -47121,10 +45849,10 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { if !(pLock != 0) { break } - _ = libc.Int32FromInt32(0) (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) goto _2 _2: + ; pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext } } @@ -47152,7 +45880,6 @@ func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { var p, p2 uintptr _, _ = p, p2 - _ = libc.Int32FromInt32(0) p = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor for { if !(p != 0) { @@ -47162,6 +45889,7 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -47184,8 +45912,6 @@ func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, iRow Ti64, isClearTable int32) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtree)(unsafe.Pointer(pBtree)).FhasIncrblobCur = uint8(0) p = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor for { @@ -47200,6 +45926,7 @@ func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, i } goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } } @@ -47246,7 +45973,6 @@ func _btreeSetHasContent(tls *libc.TLS, pBt uintptr, pgno TPgno) (r int32) { _ = rc rc = SQLITE_OK if !((*TBtShared)(unsafe.Pointer(pBt)).FpHasContent != 0) { - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent = _sqlite3BitvecCreate(tls, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) if !((*TBtShared)(unsafe.Pointer(pBt)).FpHasContent != 0) { rc = int32(SQLITE_NOMEM) @@ -47302,6 +46028,7 @@ func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) goto _1 _1: + ; i++ } _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -47329,9 +46056,6 @@ func _saveCursorKey(tls *libc.TLS, pCur uintptr) (r int32) { var rc int32 _, _ = pKey, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey != 0 { /* Only the rowid is required for a table btree */ (*TBtCursor)(unsafe.Pointer(pCur)).FnKey = _sqlite3BtreeIntegerKey(tls, pCur) @@ -47350,7 +46074,6 @@ func _saveCursorKey(tls *libc.TLS, pCur uintptr) (r int32) { rc = int32(SQLITE_NOMEM) } } - _ = libc.Int32FromInt32(0) return rc } @@ -47367,9 +46090,6 @@ func _saveCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { var rc int32 var p1 uintptr _, _ = rc, p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_Pinned) != 0 { return libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(11)< int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -47524,8 +46241,6 @@ func _btreeRestoreCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { var _ /* skipNext at bp+0 */ int32 _ = rc *(*int32)(unsafe.Pointer(bp)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_FAULT) { return (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext } @@ -47538,7 +46253,6 @@ func _btreeRestoreCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { if rc == SQLITE_OK { Xsqlite3_free(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpKey) (*TBtCursor)(unsafe.Pointer(pCur)).FpKey = uintptr(0) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != 0 { (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext = *(*int32)(unsafe.Pointer(bp)) } @@ -47564,9 +46278,6 @@ func _btreeRestoreCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { // ** back to where it ought to be if this routine returns true. // */ func _sqlite3BtreeCursorHasMoved(tls *libc.TLS, pCur uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return libc.BoolInt32(CURSOR_VALID != int32(*(*Tu8)(unsafe.Pointer(pCur)))) } @@ -47578,7 +46289,6 @@ func _sqlite3BtreeCursorHasMoved(tls *libc.TLS, pCur uintptr) (r int32) { // ** cursor returned must not be used with any other Btree interface. // */ func _sqlite3BtreeFakeValidCursor(tls *libc.TLS) (r uintptr) { - _ = libc.Int32FromInt32(0) return uintptr(unsafe.Pointer(&_fakeCursor)) } @@ -47602,8 +46312,6 @@ var _fakeCursor Tu8 func _sqlite3BtreeCursorRestore(tls *libc.TLS, pCur uintptr, pDifferentRow uintptr) (r int32) { var rc, v1 int32 _, _ = rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { v1 = _btreeRestoreCursorPosition(tls, pCur) } else { @@ -47628,7 +46336,6 @@ func _sqlite3BtreeCursorRestore(tls *libc.TLS, pCur uintptr, pDifferentRow uintp // ** Provide flag hints to the cursor. // */ func _sqlite3BtreeCursorHintFlags(tls *libc.TLS, pCur uintptr, x uint32) { - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Fhints = uint8(x) } @@ -47647,7 +46354,6 @@ func _ptrmapPageno(tls *libc.TLS, pBt uintptr, pgno TPgno) (r TPgno) { var iPtrMap, ret TPgno var nPagesPerMapPage int32 _, _, _ = iPtrMap, nPagesPerMapPage, ret - _ = libc.Int32FromInt32(0) if pgno < uint32(2) { return uint32(0) } @@ -47683,12 +46389,9 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, if *(*int32)(unsafe.Pointer(pRC)) != 0 { return } - _ = libc.Int32FromInt32(0) /* The super-journal page number must never be used as a pointer map page */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -47701,15 +46404,14 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } - _ = libc.Int32FromInt32(0) pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(eType) != int32(*(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset)))) || _sqlite3Get4byte(tls, pPtrmap+uintptr(offset+int32(1))) != parent { v1 = _sqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -47721,6 +46423,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -47740,7 +46443,6 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin var pPtrmap uintptr var _ /* pDbPage at bp+0 */ uintptr _, _, _, _ = iPtrmap, offset, pPtrmap, rc - _ = libc.Int32FromInt32(0) iPtrmap = int32(_ptrmapPageno(tls, pBt, key)) rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uint32(iPtrmap), bp, 0) if rc != 0 { @@ -47750,17 +46452,15 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) if pPgno != 0 { *(*TPgno)(unsafe.Pointer(pPgno)) = _sqlite3Get4byte(tls, pPtrmap+uintptr(offset+int32(1))) } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -47840,9 +46540,6 @@ func _btreePayloadToLocal(tls *libc.TLS, pPage uintptr, nPayload Ti64) (r int32) // ** by pointer. // */ func _btreeParseCellPtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _ = pPage (*TCellInfo)(unsafe.Pointer(pInfo)).FnSize = uint16(int32(4) + int32(_sqlite3GetVarint(tls, pCell+4, pInfo))) (*TCellInfo)(unsafe.Pointer(pInfo)).FnPayload = uint32(0) @@ -47859,10 +46556,6 @@ func _btreeParseCellPtr(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp var x, v10, v12, v14, v2, v4, v6, v8 Tu8 var _ /* iKey at bp+0 */ Tu64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = nPayload, pEnd, pIter, x, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 /* Extracted Key value */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIter = pCell /* The next block of code is equivalent to: ** @@ -47969,9 +46662,6 @@ func _btreeParseCellPtrIndex(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo var nPayload Tu32 var pEnd, pIter, v1 uintptr _, _, _, _ = nPayload, pEnd, pIter, v1 /* Number of bytes of cell payload */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIter = pCell + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) nPayload = uint32(*(*Tu8)(unsafe.Pointer(pIter))) if nPayload >= uint32(0x80) { @@ -48027,7 +46717,6 @@ func _cellSizePtr(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { var pEnd, pIter, v1 uintptr _, _, _, _, _ = minLocal, nSize, pEnd, pIter, v1 pIter = pCell + uintptr(4) /* Size value to return */ - _ = libc.Int32FromInt32(0) nSize = uint32(*(*Tu8)(unsafe.Pointer(pIter))) if nSize >= uint32(0x80) { pEnd = pIter + 8 @@ -48041,7 +46730,6 @@ func _cellSizePtr(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { pIter++ if nSize <= uint32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { nSize += uint32(int64(pIter) - int64(pCell)) - _ = libc.Int32FromInt32(0) } else { minLocal = int32((*TMemPage)(unsafe.Pointer(pPage)).FminLocal) nSize = uint32(minLocal) + (nSize-uint32(minLocal))%((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4)) @@ -48050,7 +46738,6 @@ func _cellSizePtr(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { } nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) } - _ = libc.Int32FromInt32(0) return uint16(nSize) } @@ -48060,7 +46747,6 @@ func _cellSizePtrIdxLeaf(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { var pEnd, pIter, v1 uintptr _, _, _, _, _ = minLocal, nSize, pEnd, pIter, v1 pIter = pCell /* Size value to return */ - _ = libc.Int32FromInt32(0) nSize = uint32(*(*Tu8)(unsafe.Pointer(pIter))) if nSize >= uint32(0x80) { pEnd = pIter + 8 @@ -48085,7 +46771,6 @@ func _cellSizePtrIdxLeaf(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { } nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) } - _ = libc.Int32FromInt32(0) return uint16(nSize) } @@ -48094,7 +46779,6 @@ func _cellSizePtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) _, _, _ = pEnd, pIter, v1 pIter = pCell + uintptr(4) /* End mark for a varint */ _ = pPage - _ = libc.Int32FromInt32(0) pEnd = pIter + uintptr(9) for { v1 = pIter @@ -48103,7 +46787,6 @@ func _cellSizePtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) break } } - _ = libc.Int32FromInt32(0) return uint16(int64(pIter) - int64(pCell)) } @@ -48174,7 +46857,6 @@ func _cellSizePtrTableLeaf(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) } nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) } - _ = libc.Int32FromInt32(0) return uint16(nSize) } @@ -48195,11 +46877,10 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr if *(*int32)(unsafe.Pointer(pRC)) != 0 { return } - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -48225,16 +46906,10 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { var cbrk, cellOffset, hdr, i, iCellFirst, iCellLast, iCellStart, iFree, iFree2, nCell, pc, size, sz, sz2, top, usableSize int32 var data, pAddr, pAddr1, pEnd, src, temp uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cbrk, cellOffset, data, hdr, i, iCellFirst, iCellLast, iCellStart, iFree, iFree2, nCell, pAddr, pAddr1, pEnd, pc, size, src, sz, sz2, temp, top, usableSize /* First cell offset in input */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) data = (*TMemPage)(unsafe.Pointer(pPage)).FaData hdr = int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) cellOffset = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) nCell = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - _ = libc.Int32FromInt32(0) iCellFirst = cellOffset + int32(2)*nCell usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) /* This block handles pages with two or fewer free blocks and nMaxFrag @@ -48245,12 +46920,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -48258,25 +46933,24 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz - _ = libc.Int32FromInt32(0) libc.Xmemmove(tls, data+uintptr(cbrk), data+uintptr(top), uint64(iFree-top)) pAddr = data + uintptr(cellOffset) for { @@ -48295,6 +46969,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -48319,36 +46994,33 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } - _ = libc.Int32FromInt32(0) size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } - _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: - _ = libc.Int32FromInt32(0) + ; if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } - _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))) = uint8(0) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(2)))) = uint8(0) libc.Xmemset(tls, data+uintptr(iCellFirst), 0, uint64(cbrk-iCellFirst)) - _ = libc.Int32FromInt32(0) return SQLITE_OK } @@ -48378,7 +47050,6 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint pTmp = aData + uintptr(iAddr) /* Temporary ptr into aData[] */ pc = int32(*(*Tu8)(unsafe.Pointer(pTmp)))< maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -48420,14 +47091,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -48457,16 +47128,8 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r hdr = int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) /* Local cache of pPage->hdrOffset */ data = (*TMemPage)(unsafe.Pointer(pPage)).FaData /* First byte of cell content area */ *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* First byte of gap between cell pointers and cell content */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Minimum cell size is 4 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* Minimum cell size is 4 */ gap = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) + int32(2)*int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - _ = libc.Int32FromInt32(0) /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size ** and the reserved space is zero (the usual value for reserved space) ** then the cell content offset of an empty page wants to be 65536. @@ -48478,11 +47141,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -48492,12 +47155,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if (*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(2)))) != 0 || *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))) != 0) && gap+int32(2) <= top { pSpace = _pageFindSlot(tls, pPage, nByte, bp) if pSpace != 0 { - _ = libc.Int32FromInt32(0) v1 = int32(int64(pSpace) - int64(data)) g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -48511,8 +47173,6 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r ** to see if defragmentation is necessary. */ if gap+int32(2)+nByte > top { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(4) < (*TMemPage)(unsafe.Pointer(pPage)).FnFree-(int32(2)+nByte) { v2 = int32(4) } else { @@ -48523,7 +47183,6 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r return *(*int32)(unsafe.Pointer(bp)) } top = (int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))))<> libc.Int32FromInt32(8)) *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(top) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pIdx)) = top return SQLITE_OK } @@ -48565,13 +47223,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) iOrigSize = iSize /* Offset to cell content area */ iEnd = uint32(int32(iStart) + int32(iSize)) /* First byte past the iStart buffer */ data = (*TMemPage)(unsafe.Pointer(pPage)).FaData /* Temporary ptr into data[] */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Minimum cell size is 4 */ - _ = libc.Int32FromInt32(0) + /* Minimum cell size is 4 */ /* The list of freeblocks must be in ascending order. Find the ** spot on the list where iStart should be inserted. */ @@ -48590,14 +47242,13 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } - _ = libc.Int32FromInt32(0) /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none ** iPtr: The address of a pointer to iFreeBlk @@ -48607,11 +47258,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -48632,7 +47283,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -48649,10 +47300,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -48688,8 +47339,6 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { var pBt uintptr _ = pBt /* A copy of pPage->pBt */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt (*TMemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload = (*TBtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload if flagByte >= libc.Int32FromInt32(PTF_ZERODATA)|libc.Int32FromInt32(PTF_LEAF) { @@ -48715,7 +47364,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -48741,7 +47390,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -48760,14 +47409,6 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { var iCellFirst, iCellLast, nFree, pc, top, usableSize int32 var next, size Tu32 _, _, _, _, _, _, _, _, _, _ = data, hdr, iCellFirst, iCellLast, nFree, next, pc, size, top, usableSize /* Last possible cell or freeblock offset */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) hdr = (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset data = (*TMemPage)(unsafe.Pointer(pPage)).FaData @@ -48788,12 +47429,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -48820,7 +47461,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -48851,14 +47492,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))) if pc < iCellFirst || pc > iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -48878,21 +47520,13 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { var data, pBt uintptr _, _ = data, pBt /* The main btree structure */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } - _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FcellOffset = uint16(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) + int32(8) + int32((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) @@ -48904,13 +47538,12 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the ** offset to the cell content area will equal the page size minus the ** bytes of reserved space. */ - _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FnFree = -int32(1) /* Indicate that this value is yet uncomputed */ (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(1) if (*Tsqlite3)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags&uint64(SQLITE_CellSizeCk) != 0 { @@ -48934,11 +47567,6 @@ func _zeroPage(tls *libc.TLS, pPage uintptr, flags int32) { data = (*TMemPage)(unsafe.Pointer(pPage)).FaData pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt hdr = (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_FAST_SECURE) != 0 { libc.Xmemset(tls, data+uintptr(hdr), 0, uint64((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-uint32(hdr))) } @@ -48960,7 +47588,6 @@ func _zeroPage(tls *libc.TLS, pPage uintptr, flags int32) { (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx = data + uintptr(first) (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst = data + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) - _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(0) (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(1) @@ -48989,7 +47616,6 @@ func _btreePageFromDbPage(tls *libc.TLS, pDbPage uintptr, pgno TPgno, pBt uintpt } (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset = uint8(v1) } - _ = libc.Int32FromInt32(0) return pPage } @@ -49012,8 +47638,6 @@ func _btreeGetPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, flags var rc int32 var _ /* pDbPage at bp+0 */ uintptr _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, flags) if rc != 0 { return rc @@ -49032,7 +47656,6 @@ func _btreeGetPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, flags func _btreePageLookup(tls *libc.TLS, pBt uintptr, pgno TPgno) (r uintptr) { var pDbPage uintptr _ = pDbPage - _ = libc.Int32FromInt32(0) pDbPage = _sqlite3PagerLookup(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno) if pDbPage != 0 { return _btreePageFromDbPage(tls, pDbPage, pgno, pBt) @@ -49051,7 +47674,6 @@ func _btreePagecount(tls *libc.TLS, pBt uintptr) (r TPgno) { } func _sqlite3BtreeLastPage(tls *libc.TLS, p uintptr) (r TPgno) { - _ = libc.Int32FromInt32(0) return _btreePagecount(tls, (*TBtree)(unsafe.Pointer(p)).FpBt) } @@ -49067,10 +47689,9 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe var rc int32 var _ /* pDbPage at bp+0 */ uintptr _, _ = pPage, rc - _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -49087,8 +47708,6 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe return rc } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppPage)) = pPage return SQLITE_OK } @@ -49102,12 +47721,6 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe // ** Page1 is a special case and must be released using releasePageOne(). // */ func _releasePageNotNull(tls *libc.TLS, pPage uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3PagerUnrefNotNull(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) } @@ -49118,13 +47731,6 @@ func _releasePage(tls *libc.TLS, pPage uintptr) { } func _releasePageOne(tls *libc.TLS, pPage uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3PagerUnrefPageOne(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) } @@ -49147,7 +47753,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -49170,9 +47776,7 @@ func _pageReinit(tls *libc.TLS, pData uintptr) { var pPage uintptr _ = pPage pPage = _sqlite3PagerGetExtra(tls, pData) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0 { - _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) if _sqlite3PagerPageRefcount(tls, pData) > int32(1) { /* pPage might not be a btree page; it might be an overflow page @@ -49195,8 +47799,6 @@ func _btreeInvokeBusyHandler(tls *libc.TLS, pArg uintptr) (r int32) { var pBt uintptr _ = pBt pBt = pArg - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3InvokeBusyHandler(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb+672) } @@ -49239,15 +47841,10 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4165) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* flags fit in 8 bits */ + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4194) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ - _ = libc.Int32FromInt32(0) /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ - _ = libc.Int32FromInt32(0) if isMemdb != 0 { flags |= int32(BTREE_MEMORY) } @@ -49304,7 +47901,6 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt if !(pBt != 0) { break } - _ = libc.Int32FromInt32(0) if 0 == libc.Xstrcmp(tls, zFullPathname, _sqlite3PagerFilename(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, 0)) && _sqlite3PagerVfs(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) == pVfs { iDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) for { @@ -49321,6 +47917,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -49329,6 +47926,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -49341,11 +47939,6 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt ** the right size. This is to guard against size changes that result ** when compiling on a different architecture. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Suppress false-positive compiler warning from PVS-Studio */ libc.Xmemset(tls, bp+16, 0, uint64(8)) pBt = _sqlite3MallocZero(tls, uint64(152)) @@ -49413,7 +48006,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt goto btree_open_out } (*TBtShared)(unsafe.Pointer(pBt)).FusableSize = (*TBtShared)(unsafe.Pointer(pBt)).FpageSize - uint32(nReserve) - _ = libc.Int32FromInt32(0) /* 8-byte alignment of pageSize */ + /* 8-byte alignment of pageSize */ /* Add the new BtShared object to the linked list sharable BtShareds. */ (*TBtShared)(unsafe.Pointer(pBt)).FnRef = int32(1) @@ -49467,11 +48060,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -49493,10 +48088,8 @@ btree_open_out: } } if mutexOpen != 0 { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, mutexOpen) } - _ = libc.Int32FromInt32(0) return rc } @@ -49513,7 +48106,6 @@ func _removeFromSharingList(tls *libc.TLS, pBt uintptr) (r int32) { var removed int32 _, _, _ = pList, pMainMtx, removed removed = 0 - _ = libc.Int32FromInt32(0) pMainMtx = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) Xsqlite3_mutex_enter(tls, pMainMtx) (*TBtShared)(unsafe.Pointer(pBt)).FnRef-- @@ -49548,11 +48140,8 @@ func _removeFromSharingList(tls *libc.TLS, pBt uintptr) (r int32) { func _allocateTempSpace(tls *libc.TLS, pBt uintptr) (r int32) { var pCur uintptr _ = pCur - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This routine is called only by btreeCursor() when allocating the ** first write cursor for the BtShared object */ - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace = _sqlite3PageMalloc(tls, int32((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)) if (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace == uintptr(0) { pCur = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor @@ -49603,7 +48192,6 @@ func _sqlite3BtreeClose(tls *libc.TLS, p uintptr) (r int32) { _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Close all cursors opened via this handle. */ - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) /* Verify that no other cursors have this Btree open */ /* Rollback any active transaction and free the handle structure. @@ -49616,14 +48204,12 @@ func _sqlite3BtreeClose(tls *libc.TLS, p uintptr) (r int32) { ** structure, return now. The remainder of this procedure cleans ** up the shared-btree. */ - _ = libc.Int32FromInt32(0) if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) || _removeFromSharingList(tls, pBt) != 0 { /* The pBt is no longer on the sharing list, so we can access ** it without having to hold the mutex. ** ** Clean out and delete the BtShared object. */ - _ = libc.Int32FromInt32(0) _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, (*TBtree)(unsafe.Pointer(p)).Fdb) if (*TBtShared)(unsafe.Pointer(pBt)).FxFreeSchema != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpSchema != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TBtShared)(unsafe.Pointer(pBt)).FxFreeSchema})))(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpSchema) @@ -49632,8 +48218,6 @@ func _sqlite3BtreeClose(tls *libc.TLS, p uintptr) (r int32) { _freeTempSpace(tls, pBt) Xsqlite3_free(tls, pBt) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TBtree)(unsafe.Pointer(p)).FpPrev != 0 { (*TBtree)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpPrev)).FpNext = (*TBtree)(unsafe.Pointer(p)).FpNext } @@ -49657,7 +48241,6 @@ func _sqlite3BtreeSetCacheSize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) var pBt uintptr _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) _sqlite3PagerSetCachesize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) _sqlite3BtreeLeave(tls, p) @@ -49681,7 +48264,6 @@ func _sqlite3BtreeSetSpillSize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) var res int32 _, _ = pBt, res pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) res = _sqlite3PagerSetSpillsize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) _sqlite3BtreeLeave(tls, p) @@ -49698,7 +48280,6 @@ func _sqlite3BtreeSetMmapLimit(tls *libc.TLS, p uintptr, szMmap Tsqlite3_int64) var pBt uintptr _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) _sqlite3PagerSetMmapLimit(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, szMmap) _sqlite3BtreeLeave(tls, p) @@ -49719,7 +48300,6 @@ func _sqlite3BtreeSetPagerFlags(tls *libc.TLS, p uintptr, pgFlags uint32) (r int var pBt uintptr _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) _sqlite3PagerSetFlags(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgFlags) _sqlite3BtreeLeave(tls, p) @@ -49754,7 +48334,6 @@ func _sqlite3BtreeSetPageSize(tls *libc.TLS, p uintptr, pageSize int32, nReserve _, _, _, _ = pBt, rc, x, p1 rc = SQLITE_OK pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) (*TBtShared)(unsafe.Pointer(pBt)).FnReserveWanted = uint8(nReserve) x = int32((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - (*TBtShared)(unsafe.Pointer(pBt)).FusableSize) @@ -49765,10 +48344,7 @@ func _sqlite3BtreeSetPageSize(tls *libc.TLS, p uintptr, pageSize int32, nReserve _sqlite3BtreeLeave(tls, p) return int32(SQLITE_READONLY) } - _ = libc.Int32FromInt32(0) if pageSize >= int32(512) && pageSize <= int32(SQLITE_MAX_PAGE_SIZE) && (pageSize-int32(1))&pageSize == 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nReserve > int32(32) && pageSize == int32(512) { pageSize = int32(1024) } @@ -49810,7 +48386,6 @@ func _sqlite3BtreeGetPageSize(tls *libc.TLS, p uintptr) (r int32) { func _sqlite3BtreeGetReserveNoMutex(tls *libc.TLS, p uintptr) (r int32) { var n int32 _ = n - _ = libc.Int32FromInt32(0) n = int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpageSize - (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FusableSize) return n } @@ -49885,8 +48460,6 @@ func _sqlite3BtreeSecureDelete(tls *libc.TLS, p uintptr, newFlag int32) (r int32 return 0 } _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if newFlag >= 0 { p1 = (*TBtree)(unsafe.Pointer(p)).FpBt + 40 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_FAST_SECURE)) @@ -49990,8 +48563,6 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { var _ /* pPage1 at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _ = nPage, page1, pageSize, rc, usableSize, v4, v5, p1, p2, p3 /* Number of pages in the database */ *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Number of pages in the database file */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerSharedLock(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) if rc != SQLITE_OK { return rc @@ -50055,7 +48626,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4174, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4203, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -50067,7 +48638,6 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { if (pageSize-uint32(1))&pageSize != uint32(0) || pageSize > uint32(SQLITE_MAX_PAGE_SIZE) || pageSize <= uint32(256) { goto page1_init_failed } - _ = libc.Int32FromInt32(0) /* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte ** integer at offset 20 is the number of bytes of space at the end of ** each page to reserve for extensions. @@ -50094,7 +48664,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -50145,11 +48715,11 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } else { (*TBtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload = uint8((*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal) } - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = *(*uintptr)(unsafe.Pointer(bp)) (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -50168,12 +48738,8 @@ page1_init_failed: func _unlockBtreeIfUnused(tls *libc.TLS, pBt uintptr) { var pPage1 uintptr _ = pPage1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE && (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 != uintptr(0) { pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) _releasePageOne(tls, pPage1) } @@ -50190,24 +48756,20 @@ func _newDatabase(tls *libc.TLS, pBt uintptr) (r int32) { var data, pP1, p1 uintptr var rc int32 _, _, _, _ = data, pP1, rc, p1 - _ = libc.Int32FromInt32(0) if (*TBtShared)(unsafe.Pointer(pBt)).FnPage > uint32(0) { return SQLITE_OK } pP1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 - _ = libc.Int32FromInt32(0) data = (*TMemPage)(unsafe.Pointer(pP1)).FaData rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pP1)).FpDbPage) if rc != 0 { return rc } libc.Xmemcpy(tls, data, uintptr(unsafe.Pointer(&_zMagicHeader)), uint64(16)) - _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + 16)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(data + 17)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(data + 18)) = uint8(1) *(*uint8)(unsafe.Pointer(data + 19)) = uint8(1) - _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + 20)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - (*TBtShared)(unsafe.Pointer(pBt)).FusableSize) *(*uint8)(unsafe.Pointer(data + 21)) = uint8(64) *(*uint8)(unsafe.Pointer(data + 22)) = uint8(32) @@ -50216,8 +48778,6 @@ func _newDatabase(tls *libc.TLS, pBt uintptr) (r int32) { _zeroPage(tls, pP1, libc.Int32FromInt32(PTF_INTKEY)|libc.Int32FromInt32(PTF_LEAF)|libc.Int32FromInt32(PTF_LEAFDATA)) p1 = pBt + 40 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3Put4byte(tls, data+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(4)*libc.Int32FromInt32(4)), uint32((*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum)) _sqlite3Put4byte(tls, data+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(7)*libc.Int32FromInt32(4)), uint32((*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum)) (*TBtShared)(unsafe.Pointer(pBt)).FnPage = uint32(1) @@ -50288,8 +48848,6 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager rc = SQLITE_OK _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the btree is already in a write-transaction, or it ** is already in a read-transaction and a read-transaction ** is requested, this is a no-op. @@ -50297,7 +48855,6 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) || int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_READ) && !(wrflag != 0) { goto trans_begun } - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).Fdb)).Fflags&uint64(SQLITE_ResetDatabase) != 0 && int32(_sqlite3PagerIsreadonly(tls, pPager)) == 0 { p1 = pBt + 40 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_READ_ONLY)) @@ -50327,6 +48884,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -50392,7 +48950,6 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == TRANS_NONE { (*TBtShared)(unsafe.Pointer(pBt)).FnTransaction++ if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { - _ = libc.Int32FromInt32(0) (*TBtree)(unsafe.Pointer(p)).Flock.FeLock = uint8(READ_LOCK) (*TBtree)(unsafe.Pointer(p)).Flock.FpNext = (*TBtShared)(unsafe.Pointer(pBt)).FpLock (*TBtShared)(unsafe.Pointer(pBt)).FpLock = p + 48 @@ -50409,7 +48966,6 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } if wrflag != 0 { pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FpWriter = p p8 = pBt + 40 *(*Tu16)(unsafe.Pointer(p8)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p8))) & ^libc.Int32FromInt32(BTS_EXCLUSIVE)) @@ -50432,6 +48988,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -50444,8 +49001,6 @@ trans_begun: rc = _sqlite3PagerOpenSavepoint(tls, pPager, (*Tsqlite3)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).Fdb)).FnSavepoint) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeLeave(tls, p) return rc } @@ -50489,7 +49044,6 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { _, _, _, _, _, _, _, _ = childPgno, childPgno1, i, nCell, pBt, pCell, pgno, v1 /* Return code */ pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt pgno = (*TMemPage)(unsafe.Pointer(pPage)).Fpgno - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0 { v1 = SQLITE_OK } else { @@ -50513,6 +49067,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -50545,12 +49100,10 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT var pCell uintptr var _ /* info at bp+0 */ TCellInfo _, _, _, _, _ = i, nCell, pCell, rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -50574,7 +49127,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -50583,7 +49136,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -50592,11 +49145,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -50625,11 +49179,8 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP _, _, _ = iDbPage, nextOvfl, pPager /* The page that contains a pointer to pDbPage */ iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -50715,8 +49266,6 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom var _ /* pFreePg at bp+40 */ uintptr var _ /* pLastPg at bp+32 */ uintptr _, _, _, _, _ = dbSize, eMode, iNear, nFreeList, rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(_ptrmapPageno(tls, pBt, iLastPg) == iLastPg) && iLastPg != uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { nFreeList = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) if nFreeList == uint32(0) { @@ -50727,7 +49276,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -50735,7 +49284,6 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom if rc != SQLITE_OK { return rc } - _ = libc.Int32FromInt32(0) _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) } } else { @@ -50766,10 +49314,9 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } - _ = libc.Int32FromInt32(0) rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) if rc != SQLITE_OK { @@ -50827,7 +49374,6 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { _, _, _, _, _ = nFin, nFree, nOrig, pBt, rc pBt = (*TBtree)(unsafe.Pointer(p)).FpBt _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) if !((*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { rc = int32(SQLITE_DONE) } else { @@ -50835,7 +49381,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50868,12 +49414,9 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { var iFree, nFin, nFree, nOrig, nVac TPgno _, _, _, _, _, _, _, _, _, _ = db, iDb, iFree, nFin, nFree, nOrig, nVac, pBt, pPager, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager - _ = libc.Int32FromInt32(0) _invalidateAllOverflowCache(tls, pBt) - _ = libc.Int32FromInt32(0) if !((*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum != 0) { /* Database size before freeing */ nOrig = _btreePagecount(tls, pBt) if _ptrmapPageno(tls, pBt, nOrig) == nOrig || nOrig == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { @@ -50881,7 +49424,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -50896,6 +49439,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -50910,7 +49454,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50923,6 +49467,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -50939,7 +49484,6 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { _sqlite3PagerRollback(tls, pPager) } } - _ = libc.Int32FromInt32(0) return rc } @@ -51006,7 +49550,6 @@ func _btreeEndTransaction(tls *libc.TLS, p uintptr) { _, _ = db, pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt db = (*TBtree)(unsafe.Pointer(p)).Fdb - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate = uint8(0) if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) > TRANS_NONE && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1) { /* If there are other active statements that belong to this database @@ -51031,8 +49574,6 @@ func _btreeEndTransaction(tls *libc.TLS, p uintptr) { (*TBtree)(unsafe.Pointer(p)).FinTrans = uint8(TRANS_NONE) _unlockBtreeIfUnused(tls, pBt) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } // C documentation @@ -51071,15 +49612,11 @@ func _sqlite3BtreeCommitPhaseTwo(tls *libc.TLS, p uintptr, bCleanup int32) (r in return SQLITE_OK } _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the handle has a write-transaction open, commit the shared-btrees ** transaction and set the shared state to TRANS_READ. */ if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerCommitPhaseTwo(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) if rc != SQLITE_OK && bCleanup == 0 { _sqlite3BtreeLeave(tls, p) @@ -51144,7 +49681,6 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w var rc int32 _, _ = p, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if pBtree != 0 { _sqlite3BtreeEnter(tls, pBtree) p = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor @@ -51168,6 +49704,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -51213,8 +49750,6 @@ func _sqlite3BtreeRollback(tls *libc.TLS, p uintptr, tripCode int32, writeOnly i var _ /* pPage1 at bp+0 */ uintptr _, _, _, _, _ = pBt, rc, rc2, rc21, v1 pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) if tripCode == SQLITE_OK { v1 = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -51228,15 +49763,11 @@ func _sqlite3BtreeRollback(tls *libc.TLS, p uintptr, tripCode int32, writeOnly i } if tripCode != 0 { rc2 = _sqlite3BtreeTripAllCursors(tls, p, tripCode, writeOnly) - _ = libc.Int32FromInt32(0) if rc2 != SQLITE_OK { rc = rc2 } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { - _ = libc.Int32FromInt32(0) rc21 = _sqlite3PagerRollback(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) if rc21 != SQLITE_OK { rc = rc21 @@ -51248,7 +49779,6 @@ func _sqlite3BtreeRollback(tls *libc.TLS, p uintptr, tripCode int32, writeOnly i _btreeSetNPage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp))) _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) } - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FinTransaction = uint8(TRANS_READ) _btreeClearHasContent(tls, pBt) } @@ -51283,11 +49813,6 @@ func _sqlite3BtreeBeginStmt(tls *libc.TLS, p uintptr, iStatement int32) (r int32 _, _ = pBt, rc pBt = (*TBtree)(unsafe.Pointer(p)).FpBt _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* At the pager level, a statement transaction is a savepoint with ** an index greater than all savepoints created explicitly using ** SQL statements. It is illegal to open, release or rollback any @@ -51319,8 +49844,6 @@ func _sqlite3BtreeSavepoint(tls *libc.TLS, p uintptr, op int32, iSavepoint int32 rc = SQLITE_OK if p != 0 && int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) if op == int32(SAVEPOINT_ROLLBACK) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -51336,7 +49859,6 @@ func _sqlite3BtreeSavepoint(tls *libc.TLS, p uintptr, op int32, iSavepoint int32 _btreeSetNPage(tls, pBt, (*TBtShared)(unsafe.Pointer(pBt)).FpPage1) /* pBt->nPage might be zero if the database was corrupt when ** the transaction was started. Otherwise, it must be at least 1. */ - _ = libc.Int32FromInt32(0) } _sqlite3BtreeLeave(tls, p) } @@ -51391,25 +49913,16 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo var pBt, pX, p2, p3 uintptr _, _, _, _ = pBt, pX, p2, p3 pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Looping over other all cursors */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The following assert statements verify that if this is a sharable ** b-tree database, the connection is holding the required table locks, ** and that no other connection has any open cursor that conflicts with ** this lock. The iTable<1 term disables the check for corrupt schemas. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Assert that the caller has opened the required transaction. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { - _ = libc.Int32FromInt32(0) iTable = uint32(0) } } @@ -51436,6 +49949,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -51513,7 +50027,6 @@ func _sqlite3BtreeCloseCursor(tls *libc.TLS, pCur uintptr) (r int32) { if pBtree != 0 { pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt _sqlite3BtreeEnter(tls, pBtree) - _ = libc.Int32FromInt32(0) if (*TBtShared)(unsafe.Pointer(pBt)).FpCursor == pCur { (*TBtShared)(unsafe.Pointer(pBt)).FpCursor = (*TBtCursor)(unsafe.Pointer(pCur)).FpNext } else { @@ -51533,7 +50046,6 @@ func _sqlite3BtreeCloseCursor(tls *libc.TLS, pCur uintptr) (r int32) { if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpCursor == uintptr(0) { /* Since the BtShared is not sharable, there is no need to ** worry about the missing sqlite3BtreeLeave() call here. */ - _ = libc.Int32FromInt32(0) _sqlite3BtreeClose(tls, pBtree) } else { _sqlite3BtreeLeave(tls, pBtree) @@ -51565,7 +50077,6 @@ func _getCellInfo(tls *libc.TLS, pCur uintptr) { } func _sqlite3BtreeCursorIsValidNN(tls *libc.TLS, pCur uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return libc.BoolInt32(int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID) } @@ -51578,9 +50089,6 @@ func _sqlite3BtreeCursorIsValidNN(tls *libc.TLS, pCur uintptr) (r int32) { // ** is invalid, the result of this routine is undefined. // */ func _sqlite3BtreeIntegerKey(tls *libc.TLS, pCur uintptr) (r Ti64) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) return (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey } @@ -51593,7 +50101,6 @@ func _sqlite3BtreeIntegerKey(tls *libc.TLS, pCur uintptr) (r Ti64) { func _sqlite3BtreeCursorPin(tls *libc.TLS, pCur uintptr) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) p1 = pCur + 1 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_Pinned)) } @@ -51601,7 +50108,6 @@ func _sqlite3BtreeCursorPin(tls *libc.TLS, pCur uintptr) { func _sqlite3BtreeCursorUnpin(tls *libc.TLS, pCur uintptr) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) p1 = pCur + 1 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTCF_Pinned)) } @@ -51613,8 +50119,6 @@ func _sqlite3BtreeCursorUnpin(tls *libc.TLS, pCur uintptr) { // ** payload to which the cursor is pointing. // */ func _sqlite3BtreeOffset(tls *libc.TLS, pCur uintptr) (r Ti64) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) return int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize)*(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fpgno)-int64(1)) + (int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload) - int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaData)) } @@ -51631,8 +50135,6 @@ func _sqlite3BtreeOffset(tls *libc.TLS, pCur uintptr) (r Ti64) { // ** that the cursor has Cursor.eState==CURSOR_VALID. // */ func _sqlite3BtreePayloadSize(tls *libc.TLS, pCur uintptr) (r Tu32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) return (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload } @@ -51653,8 +50155,6 @@ func _sqlite3BtreePayloadSize(tls *libc.TLS, pCur uintptr) (r Tu32) { // ** database file. // */ func _sqlite3BtreeMaxRecordSize(tls *libc.TLS, pCur uintptr) (r Tsqlite3_int64) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize) * int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage) } @@ -51691,8 +50191,6 @@ func _getOverflowPage(tls *libc.TLS, pBt uintptr, ovfl TPgno, ppPage uintptr, pP next = uint32(0) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Try to find the next page in the overflow list using the ** autovacuum pointer-map pages. Guess that the next page in ** the overflow list is page number (ovfl+1). If that guess turns @@ -51712,7 +50210,6 @@ func _getOverflowPage(tls *libc.TLS, pBt uintptr, ovfl TPgno, ppPage uintptr, pP } } } - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if ppPage == uintptr(0) { v1 = int32(PAGER_GET_READONLY) @@ -51720,7 +50217,6 @@ func _getOverflowPage(tls *libc.TLS, pBt uintptr, ovfl TPgno, ppPage uintptr, pP v1 = 0 } rc = _btreeGetPage(tls, pBt, ovfl, bp, v1) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { next = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) } @@ -51815,24 +50311,18 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Btree page of current entry */ pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ pBufStart = pBuf /* Start of original out buffer */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } - _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if uint64(int64(aPayload)-int64((*TMemPage)(unsafe.Pointer(pPage)).FaData)) > uint64((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) { /* Trying to read or write past the end of the data is an error. The ** conditional above is really: ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -51881,13 +50371,11 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin offset = offset % ovflSize } } - _ = libc.Int32FromInt32(0) for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } - _ = libc.Int32FromInt32(0) *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) if offset >= ovflSize { /* The only reason to read this page is to obtain the page @@ -51896,8 +50384,6 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** page-list cache, if any, then fall back to the getOverflowPage() ** function. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx+int32(1))*4)) != 0 { *(*TPgno)(unsafe.Pointer(bp)) = *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx+int32(1))*4)) } else { @@ -51928,7 +50414,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin if eOp == 0 && offset == uint32(0) && _sqlite3PagerDirectReadOk(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, *(*TPgno)(unsafe.Pointer(bp))) != 0 && pBuf+uintptr(-libc.Int32FromInt32(4)) >= pBufStart { fd = _sqlite3PagerFile(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) aWrite = pBuf + uintptr(-libc.Int32FromInt32(4)) - _ = libc.Int32FromInt32(0) /* due to (6) */ + /* due to (6) */ libc.Xmemcpy(tls, bp+4, aWrite, uint64(4)) rc = _sqlite3OsRead(tls, fd, aWrite, a1+int32(4), int64((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)*int64(*(*TPgno)(unsafe.Pointer(bp))-libc.Uint32FromInt32(1))) *(*TPgno)(unsafe.Pointer(bp)) = _sqlite3Get4byte(tls, aWrite) @@ -51962,7 +50448,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -51987,9 +50473,6 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin // ** the available payload. // */ func _sqlite3BtreePayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _accessPayload(tls, pCur, offset, amt, pBuf, 0) } @@ -52006,7 +50489,6 @@ func _accessPayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, p if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_INVALID) { return int32(SQLITE_ABORT) } - _ = libc.Int32FromInt32(0) rc = _btreeRestoreCursorPosition(tls, pCur) if rc != 0 { v1 = rc @@ -52018,7 +50500,6 @@ func _accessPayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, p func _sqlite3BtreePayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr) (r int32) { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID { - _ = libc.Int32FromInt32(0) return _accessPayload(tls, pCur, offset, amt, pBuf, 0) } else { return _accessPayloadChecked(tls, pCur, offset, amt, pBuf) @@ -52050,19 +50531,10 @@ func _sqlite3BtreePayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt T func _fetchPayload(tls *libc.TLS, pCur uintptr, pAmt uintptr) (r uintptr) { var amt, v1 int32 _, _ = amt, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) amt = int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) if amt > int32(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd)-int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) { /* There is too little space on the page for the expected amount ** of local content. Database must be corrupt. */ - _ = libc.Int32FromInt32(0) if 0 > int32(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd)-int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) { v1 = 0 } else { @@ -52110,12 +50582,8 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { var v2 Ti8 var v3, p1 uintptr _, _, _, _ = rc, v2, v3, p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -52125,10 +50593,9 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).FiPage++ rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -52153,10 +50620,6 @@ func _moveToParent(tls *libc.TLS, pCur uintptr) { var pLeaf, v3, p1 uintptr var v2 Ti8 _, _, _, _ = pLeaf, v2, v3, p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) @@ -52199,12 +50662,6 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { var v1 Ti8 _, _, _, _, _, _, _ = pRoot, rc, subpage, v1, v2, v3, p4 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= 0 { if (*TBtCursor)(unsafe.Pointer(pCur)).FiPage != 0 { _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) @@ -52227,10 +50684,8 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) return int32(SQLITE_EMPTY) } else { - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_FAULT) { - _ = libc.Int32FromInt32(0) return (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext } _sqlite3BtreeClearCursor(tls, pCur) @@ -52245,7 +50700,6 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { } } pRoot = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage - _ = libc.Int32FromInt32(0) /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is ** NULL, the caller expects a table b-tree. If this is not the case, @@ -52256,11 +50710,11 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** if pCur->iPage>=0). But this is not so if the database is corrupted ** in such a way that page pRoot is linked into a second b-tree table ** (or the freelist). */ - _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -52270,7 +50724,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -52299,8 +50753,6 @@ func _moveToLeftmost(tls *libc.TLS, pCur uintptr) (r int32) { var v2 bool _, _, _, _, _ = pPage, pgno, rc, v1, v2 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for { if v2 = rc == SQLITE_OK; v2 { v1 = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -52309,7 +50761,6 @@ func _moveToLeftmost(tls *libc.TLS, pCur uintptr) (r int32) { if !(v2 && !((*TMemPage)(unsafe.Pointer(v1)).Fleaf != 0)) { break } - _ = libc.Int32FromInt32(0) pgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix)))))))) rc = _moveToChild(tls, pCur, pgno) } @@ -52335,8 +50786,6 @@ func _moveToRightmost(tls *libc.TLS, pCur uintptr) (r int32) { _, _, _, _ = pPage, pgno, rc, v1 rc = SQLITE_OK pPage = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for { v1 = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage pPage = v1 @@ -52351,8 +50800,6 @@ func _moveToRightmost(tls *libc.TLS, pCur uintptr) (r int32) { } } (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return SQLITE_OK } @@ -52365,16 +50812,12 @@ func _moveToRightmost(tls *libc.TLS, pCur uintptr) (r int32) { func _sqlite3BtreeFirst(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { var rc int32 _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _moveToRoot(tls, pCur) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = 0 rc = _moveToLeftmost(tls, pCur) } else { if rc == int32(SQLITE_EMPTY) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = int32(1) rc = SQLITE_OK } @@ -52394,7 +50837,6 @@ func _btreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { _, _, _ = rc, p1, p2 rc = _moveToRoot(tls, pCur) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = 0 rc = _moveToRightmost(tls, pCur) if rc == SQLITE_OK { @@ -52406,7 +50848,6 @@ func _btreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { } } else { if rc == int32(SQLITE_EMPTY) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = int32(1) rc = SQLITE_OK } @@ -52415,8 +50856,6 @@ func _btreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { } func _sqlite3BtreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the cursor already points to the last entry, this is a no-op. */ if CURSOR_VALID == int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) && int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_AtLast) != 0 { *(*int32)(unsafe.Pointer(pRes)) = 0 @@ -52458,11 +50897,6 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh var pCell, pPage, v3, p4 uintptr var _ /* nCellKey at bp+0 */ Ti64 _, _, _, _, _, _, _, _, _, _ = c, chldPg, idx, lwr, pCell, pPage, rc, upr, v3, p4 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the cursor is already positioned at the point we are trying ** to move to, then just return without doing any work */ if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID && int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_ValidNKey) != 0 { @@ -52498,18 +50932,11 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh rc = _moveToRoot(tls, pCur) if rc != 0 { if rc == int32(SQLITE_EMPTY) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = -int32(1) return SQLITE_OK } return rc } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -52518,11 +50945,8 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh ** would have already detected db corruption. Similarly, pPage must ** be the right kind (index or table) of b-tree page. Otherwise ** a moveToChild() or moveToRoot() call would have detected corruption. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) lwr = 0 upr = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1) - _ = libc.Int32FromInt32(0) idx = upr >> (int32(1) - biasRight) /* idx = biasRight ? upr : (lwr+upr)/2; */ for { pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))) @@ -52534,7 +50958,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -52553,7 +50977,6 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } } else { - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { lwr = idx @@ -52568,21 +50991,18 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh } } } - _ = libc.Int32FromInt32(0) idx = (lwr + upr) >> int32(1) /* idx = (lwr+upr)/2; */ goto _2 _2: } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) *(*int32)(unsafe.Pointer(pRes)) = c rc = SQLITE_OK goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -52597,8 +51017,8 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) - _ = libc.Int32FromInt32(0) return rc } @@ -52661,7 +51081,6 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { var i int32 var pPage uintptr _, _ = i, pPage - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)) { @@ -52673,6 +51092,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -52714,13 +51134,8 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes var v10 Ti8 var v2, v7 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, c1, chldPg, idx, lwr, nCell, nOverrun, pCell, pCellBody, pCellKey, pPage, rc, upr, xRecordCompare, v1, v10, v11, v2, v6, v7, p3, p8, p9 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) xRecordCompare = _sqlite3VdbeFindCompare(tls, pIdxKey) (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode = uint8(0) - _ = libc.Int32FromInt32(0) /* Check to see if we can skip a lot of work. Two cases: ** ** (1) If the cursor is already pointing to the very last cell @@ -52745,7 +51160,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -52754,19 +51169,13 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes rc = _moveToRoot(tls, pCur) if rc != 0 { if rc == int32(SQLITE_EMPTY) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = -int32(1) return SQLITE_OK } return rc } bypass_moveto_root: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; for { pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ /* pPage->nCell must be greater than zero. If this is the root-page @@ -52775,8 +51184,6 @@ bypass_moveto_root: ** would have already detected db corruption. Similarly, pPage must ** be the right kind (index or table) of b-tree page. Otherwise ** a moveToChild() or moveToRoot() call would have detected corruption. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) lwr = 0 upr = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1) idx = upr >> int32(1) /* idx = (lwr+upr)/2; */ @@ -52815,7 +51222,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -52836,19 +51243,17 @@ bypass_moveto_root: Xsqlite3_free(tls, pCellKey) } } - _ = libc.Int32FromInt32(0) if c1 < 0 { lwr = idx + int32(1) } else { if c1 > 0 { upr = idx - int32(1) } else { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pRes)) = 0 rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -52856,15 +51261,11 @@ bypass_moveto_root: if lwr > upr { break } - _ = libc.Int32FromInt32(0) idx = (lwr + upr) >> int32(1) /* idx = (lwr+upr)/2 */ goto _5 _5: } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) *(*int32)(unsafe.Pointer(pRes)) = c1 rc = SQLITE_OK @@ -52885,7 +51286,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -52894,7 +51295,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -52909,8 +51310,8 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) - _ = libc.Int32FromInt32(0) return rc } @@ -52942,8 +51343,6 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { var i Tu8 var n Ti64 _, _ = i, n - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Currently this interface is only called by the OP_IfSmaller ** opcode, and it that case the cursor will always be valid and ** will always point to a leaf node. */ @@ -52962,6 +51361,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -52994,9 +51394,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { var pPage, v3 uintptr var v2 Tu16 _, _, _, _, _, _ = idx, pPage, rc, v1, v2, v3 - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { v1 = _btreeRestoreCursorPosition(tls, pCur) } else { @@ -53025,7 +51423,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53062,8 +51460,6 @@ func _sqlite3BtreeNext(tls *libc.TLS, pCur uintptr, flags int32) (r int32) { var v2 Tu16 _, _, _, _ = pPage, v2, v3, p1 _ = flags /* Used in COMDB2 but not native SQLite */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) @@ -53112,9 +51508,6 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { var idx, rc, v1 int32 var pPage uintptr _, _, _, _ = idx, pPage, rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { v1 = _btreeRestoreCursorPosition(tls, pCur) @@ -53140,7 +51533,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -53157,8 +51550,6 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { } _moveToParent(tls, pCur) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).Fix-- pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if (*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0 && !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53173,8 +51564,6 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { func _sqlite3BtreePrevious(tls *libc.TLS, pCur uintptr, flags int32) (r int32) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _ = flags /* Used in COMDB2 but not native SQLite */ p1 = pCur + 1 *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_AtLast) | libc.Int32FromInt32(BTCF_ValidOvfl) | libc.Int32FromInt32(BTCF_ValidNKey))) @@ -53226,15 +51615,13 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, bNoContent, closest, d2, dist, i, iNewTrunk, iPage, iTrunk, k, mxPage, n, nSearch, noContent, pPage1, pPrevTrunk, rc, searchList, v1, v2, v5, v6 /* Number of leaves on the trunk of the freelist */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) pPrevTrunk = uintptr(0) /* Total size of the database file */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 mxPage = _btreePagecount(tls, pBt) /* EVIDENCE-OF: R-21003-45125 The 4-byte big-endian integer at offset 36 ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -53245,8 +51632,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt */ if int32(eMode) == int32(BTALLOC_EXACT) { if nearby <= mxPage { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _ptrmapGet(tls, pBt, nearby, bp+8, uintptr(0)) if rc != 0 { return rc @@ -53291,7 +51676,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -53299,8 +51684,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) goto end_allocate_page } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page ** is the number of leaf page pointers to follow. */ k = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) @@ -53308,7 +51691,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt /* The trunk has no leaves and the list is not being searched. ** So extract the trunk page itself and use it as the newly ** allocated page */ - _ = libc.Int32FromInt32(0) rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) if rc != 0 { goto end_allocate_page @@ -53320,7 +51702,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53347,7 +51729,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -53364,7 +51746,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FaData+8, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+12, uint64((k-uint32(1))*uint32(4))) _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) if !(pPrevTrunk != 0) { - _ = libc.Int32FromInt32(0) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iNewTrunk) } else { rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FpDbPage) @@ -53393,6 +51774,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -53409,6 +51791,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -53417,7 +51800,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53492,7 +51875,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** becomes a new pointer-map page, the second is used by the caller. */ *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) - _ = libc.Int32FromInt32(0) rc = _btreeGetUnusedPage(tls, pBt, (*TBtShared)(unsafe.Pointer(pBt)).FnPage, bp+24, bNoContent) if rc == SQLITE_OK { rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).FpDbPage) @@ -53508,7 +51890,6 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } _sqlite3Put4byte(tls, uintptr(28)+(*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) *(*TPgno)(unsafe.Pointer(pPgno)) = (*TBtShared)(unsafe.Pointer(pBt)).FnPage - _ = libc.Int32FromInt32(0) rc = _btreeGetUnusedPage(tls, pBt, *(*TPgno)(unsafe.Pointer(pPgno)), ppPage, bNoContent) if rc != 0 { return rc @@ -53519,12 +51900,10 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) } } - _ = libc.Int32FromInt32(0) end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return rc } @@ -53557,11 +51936,8 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Free-list trunk page */ iTrunk = uint32(0) /* Page number of free-list trunk page */ pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -53612,7 +51988,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -53620,9 +51996,8 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in goto freepage_out } nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) - _ = libc.Int32FromInt32(0) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -53678,6 +52053,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -53708,18 +52084,14 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp var _ /* iNext at bp+0 */ TPgno var _ /* pOvfl at bp+8 */ uintptr _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt - _ = libc.Int32FromInt32(0) ovflPageSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) nOvfl = int32(((*TCellInfo)(unsafe.Pointer(pInfo)).FnPayload - uint32((*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal) + ovflPageSize - uint32(1)) / ovflPageSize) - _ = libc.Int32FromInt32(0) for { v1 = nOvfl nOvfl-- @@ -53732,7 +52104,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -53755,7 +52127,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -53802,17 +52174,15 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize var _ /* pgnoOvfl at bp+4 */ TPgno var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eType, mn, n, nHeader, nPayload, nSrc, pBt, pPayload, pPrior, pSrc, pToRelease, pgnoPtrmap, spaceLeft, v1, v2, v3, v4 - _ = libc.Int32FromInt32(0) /* pPage is not necessarily writeable since pCell might be auxiliary ** buffer space that is separate from the pPage buffer area */ - _ = libc.Int32FromInt32(0) /* Fill in the header. */ nHeader = int32((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) if (*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0 { nPayload = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero pSrc = (*TBtreePayload)(unsafe.Pointer(pX)).FpData nSrc = (*TBtreePayload)(unsafe.Pointer(pX)).FnData - _ = libc.Int32FromInt32(0) /* fillInCell() only called for leaves */ + /* fillInCell() only called for leaves */ if uint32(nPayload) < libc.Uint32FromInt32(0x80) { *(*uint8)(unsafe.Pointer(pCell + uintptr(nHeader))) = uint8(nPayload) v1 = libc.Int32FromInt32(1) @@ -53822,7 +52192,6 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize nHeader += int32(uint8(v1)) nHeader += _sqlite3PutVarint(tls, pCell+uintptr(nHeader), *(*Tu64)(unsafe.Pointer(pX + 8))) } else { - _ = libc.Int32FromInt32(0) v2 = int32((*TBtreePayload)(unsafe.Pointer(pX)).FnKey) nPayload = v2 nSrc = v2 @@ -53843,9 +52212,9 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pPayload, pSrc, uint64(nSrc)) libc.Xmemset(tls, pPayload+uintptr(nSrc), 0, uint64(nPayload-nSrc)) return SQLITE_OK @@ -53884,10 +52253,8 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize } /* If pToRelease is not zero than pPayload points into the data area ** of pToRelease. Make sure pToRelease is still writeable. */ - _ = libc.Int32FromInt32(0) /* If pPayload is part of the data area of pPage, then make sure pPage ** is still writeable */ - _ = libc.Int32FromInt32(0) if nSrc >= n { libc.Xmemcpy(tls, pPayload, pSrc, uint64(n)) } else { @@ -53943,10 +52310,8 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize } /* If pToRelease is not zero than pPrior points into the data area ** of pToRelease. Make sure pToRelease is still writeable. */ - _ = libc.Int32FromInt32(0) /* If pPrior is part of the data area of pPage, then make sure pPage ** is still writeable */ - _ = libc.Int32FromInt32(0) _sqlite3Put4byte(tls, pPrior, *(*TPgno)(unsafe.Pointer(bp + 4))) _releasePage(tls, pToRelease) pToRelease = *(*uintptr)(unsafe.Pointer(bp + 8)) @@ -53978,19 +52343,12 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { if *(*int32)(unsafe.Pointer(pRC)) != 0 { return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) data = (*TMemPage)(unsafe.Pointer(pPage)).FaData ptr = (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx) - _ = libc.Int32FromInt32(0) pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -54045,15 +52403,6 @@ func _insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, var _ /* rc2 at bp+4 */ int32 _, _, _, _, _, _, _, _ = data, j, pIns, rc, v1, v2, v3, v4 *(*int32)(unsafe.Pointer(bp)) = 0 /* The point in pPage->aCellIdx[] where no cell inserted */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 || sz+int32(2) > (*TMemPage)(unsafe.Pointer(pPage)).FnFree { if pTemp != 0 { libc.Xmemcpy(tls, pTemp, pCell, uint64(sz)) @@ -54067,7 +52416,6 @@ func _insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, /* Comparison against ArraySize-1 since we hold back one extra slot ** as a contingency. In other words, never need more than 3 overflow ** slots but 4 are allocated, just to be safe. */ - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pPage + 40 + uintptr(j)*8)) = pCell *(*Tu16)(unsafe.Pointer(pPage + 28 + uintptr(j)*2)) = uint16(i) /* When multiple overflows occur, they are always sequential and in @@ -54075,25 +52423,20 @@ func _insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, ** only occur when inserting divider cells into the parent page during ** balancing, and the dividers are adjacent and sorted. */ - _ = libc.Int32FromInt32(0) /* Overflows in sorted order */ - _ = libc.Int32FromInt32(0) /* Overflows are sequential */ + /* Overflows in sorted order */ + /* Overflows are sequential */ } else { rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if rc != SQLITE_OK { return rc } - _ = libc.Int32FromInt32(0) data = (*TMemPage)(unsafe.Pointer(pPage)).FaData - _ = libc.Int32FromInt32(0) rc = _allocateSpace(tls, pPage, sz, bp) if rc != 0 { return rc } /* The allocateSpace() routine guarantees the following properties ** if it returns successfully */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pPage + 20)) -= int32(uint16(libc.Int32FromInt32(2) + sz)) /* In a corrupt database where an entry in the cell index section of ** a btree page has a value of 3 or less, the pCell value might point @@ -54114,7 +52457,6 @@ func _insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, if int32(v3) == 0 { *(*Tu8)(unsafe.Pointer(data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(3))))++ } - _ = libc.Int32FromInt32(0) if (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FautoVacuum != 0 { *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK /* The cell may contain a pointer to an overflow page. If so, write @@ -54151,15 +52493,6 @@ func _insertCellFast(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz in var _ /* rc2 at bp+4 */ int32 _, _, _, _, _, _, _, _ = data, j, pIns, rc, v1, v2, v3, v4 *(*int32)(unsafe.Pointer(bp)) = 0 /* The point in pPage->aCellIdx[] where no cell inserted */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if sz+int32(2) > (*TMemPage)(unsafe.Pointer(pPage)).FnFree { v2 = pPage + 12 v1 = *(*Tu8)(unsafe.Pointer(v2)) @@ -54168,7 +52501,6 @@ func _insertCellFast(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz in /* Comparison against ArraySize-1 since we hold back one extra slot ** as a contingency. In other words, never need more than 3 overflow ** slots but 4 are allocated, just to be safe. */ - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pPage + 40 + uintptr(j)*8)) = pCell *(*Tu16)(unsafe.Pointer(pPage + 28 + uintptr(j)*2)) = uint16(i) /* When multiple overflows occur, they are always sequential and in @@ -54176,25 +52508,20 @@ func _insertCellFast(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz in ** only occur when inserting divider cells into the parent page during ** balancing, and the dividers are adjacent and sorted. */ - _ = libc.Int32FromInt32(0) /* Overflows in sorted order */ - _ = libc.Int32FromInt32(0) /* Overflows are sequential */ + /* Overflows in sorted order */ + /* Overflows are sequential */ } else { rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if rc != SQLITE_OK { return rc } - _ = libc.Int32FromInt32(0) data = (*TMemPage)(unsafe.Pointer(pPage)).FaData - _ = libc.Int32FromInt32(0) rc = _allocateSpace(tls, pPage, sz, bp) if rc != 0 { return rc } /* The allocateSpace() routine guarantees the following properties ** if it returns successfully */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pPage + 20)) -= int32(uint16(libc.Int32FromInt32(2) + sz)) libc.Xmemcpy(tls, data+uintptr(*(*int32)(unsafe.Pointer(bp))), pCell, uint64(sz)) pIns = (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(i*int32(2)) @@ -54209,7 +52536,6 @@ func _insertCellFast(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz in if int32(v3) == 0 { *(*Tu8)(unsafe.Pointer(data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(3))))++ } - _ = libc.Int32FromInt32(0) if (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FautoVacuum != 0 { *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK /* The cell may contain a pointer to an overflow page. If so, write @@ -54338,13 +52664,10 @@ func _populateCellCache(tls *libc.TLS, p uintptr, idx int32, N int32) { _, _ = pRef, szCell pRef = (*TCellArray)(unsafe.Pointer(p)).FpRef szCell = (*TCellArray)(unsafe.Pointer(p)).FszCell - _ = libc.Int32FromInt32(0) for N > 0 { - _ = libc.Int32FromInt32(0) if int32(*(*Tu16)(unsafe.Pointer(szCell + uintptr(idx)*2))) == 0 { *(*Tu16)(unsafe.Pointer(szCell + uintptr(idx)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pRef)).FxCellSize})))(tls, pRef, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FapCell + uintptr(idx)*8))) } else { - _ = libc.Int32FromInt32(0) } idx++ N-- @@ -54357,14 +52680,11 @@ func _populateCellCache(tls *libc.TLS, p uintptr, idx int32, N int32) { // ** Return the size of the Nth element of the cell array // */ func _computeCellSize(tls *libc.TLS, p uintptr, N int32) (r Tu16) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FpRef)).FxCellSize})))(tls, (*TCellArray)(unsafe.Pointer(p)).FpRef, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FapCell + uintptr(N)*8))) return *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) } func _cachedCellSize(tls *libc.TLS, p uintptr, N int32) (r Tu16) { - _ = libc.Int32FromInt32(0) if *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) != 0 { return *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) } @@ -54400,8 +52720,6 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg iEnd = i + nCell /* Loop terminator */ pCellptr = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx pTmp = _sqlite3PagerTempSpace(tls, (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPg)).FpBt)).FpPager) /* Current pCArray->apEnd[k] value */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) j = uint32(int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))))< uint32(usableSize) { j = uint32(0) @@ -54414,6 +52732,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -54421,15 +52740,14 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg for int32(1) != 0 { pCell = *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) - _ = libc.Int32FromInt32(0) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -54437,10 +52755,9 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint64(sz)) - _ = libc.Int32FromInt32(0) i++ if i >= iEnd { break @@ -54501,7 +52818,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData /* Complete page */ pData = *(*uintptr)(unsafe.Pointer(ppData)) /* Content area. A subset of aData[] */ iEnd = iFirst + nCell /* Maximum extent of cell data */ - _ = libc.Int32FromInt32(0) /* Never called on page 1 */ + /* Never called on page 1 */ if iEnd <= iFirst { return 0 } @@ -54512,11 +52829,11 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) for int32(1) != 0 { - _ = libc.Int32FromInt32(0) sz = int32(*(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) if v3 = int32(*(*Tu8)(unsafe.Pointer(aData + 1))) == 0 && int32(*(*Tu8)(unsafe.Pointer(aData + 2))) == 0; !v3 { v2 = _pageFindSlot(tls, pPg, sz, bp) @@ -54532,10 +52849,8 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr /* pSlot and pCArray->apCell[i] will never overlap on a well-formed ** database. But they might for a corrupt database. Hence use memmove() ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ - _ = libc.Int32FromInt32(0) if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { - _ = libc.Int32FromInt32(0) - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) @@ -54588,7 +52903,6 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr ** are to be freed have already been computing while deciding which ** cells need freeing */ sz = int32(*(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) - _ = libc.Int32FromInt32(0) iOfst = int32(uint16(int64(pCell) - int64(aData))) iAfter = iOfst + sz j = 0 @@ -54607,6 +52921,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -54619,6 +52934,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -54634,6 +52950,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -54644,6 +52961,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -54677,18 +52995,16 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p iOldEnd = iOld + int32((*TMemPage)(unsafe.Pointer(pPg)).FnCell) + int32((*TMemPage)(unsafe.Pointer(pPg)).FnOverflow) iNewEnd = iNew + nNew /* Remove cells from the start and end of the page */ - _ = libc.Int32FromInt32(0) if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2))) nCell -= nShift } if iNewEnd < iOldEnd { nTail = _pageFreeArray(tls, pPg, iNewEnd, iOldEnd-iNewEnd, pCArray) - _ = libc.Int32FromInt32(0) nCell -= nTail } *(*uintptr)(unsafe.Pointer(bp)) = aData + uintptr(int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))))< 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -55214,6 +53511,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -55221,48 +53519,38 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if !(k < int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow)) { break } - _ = libc.Int32FromInt32(0) /* NOTE 1 */ + /* NOTE 1 */ *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = *(*uintptr)(unsafe.Pointer(pOld + 40 + uintptr(k)*8)) (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } piEnd = aData + uintptr((*TMemPage)(unsafe.Pointer(pOld)).FcellOffset) + uintptr(int32(2)*int32((*TMemPage)(unsafe.Pointer(pOld)).FnCell)) for piCell < piEnd { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = aData + uintptr(int32(maskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(piCell))))) piCell += uintptr(2) (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ } - _ = libc.Int32FromInt32(0) cntOld[i] = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell if i < nOld-int32(1) && !(leafData != 0) { sz = uint16((*(*[5]int32)(unsafe.Pointer(bp + 72)))[i]) - _ = libc.Int32FromInt32(0) *(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2)) = sz pTemp = aSpace1 + uintptr(iSpace1) iSpace1 += int32(sz) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pTemp, apDiv[i], uint64(sz)) *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = pTemp + uintptr(leafCorrection) - _ = libc.Int32FromInt32(0) *(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2)) = uint16(int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2))) - int32(leafCorrection)) if !((*TMemPage)(unsafe.Pointer(pOld)).Fleaf != 0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The right pointer of the child page pOld becomes the left ** pointer of the divider cell */ libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)), (*TMemPage)(unsafe.Pointer(pOld)).FaData+8, uint64(4)) } else { - _ = libc.Int32FromInt32(0) for int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2))) < int32(4) { /* Do not allow any cells smaller than 4 bytes. If a smaller cell ** does exist, pad it with 0x00 bytes. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v5 = iSpace1 iSpace1++ *(*Tu8)(unsafe.Pointer(aSpace1 + uintptr(v5))) = uint8(0x00) @@ -55273,6 +53561,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -55310,7 +53599,6 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) = (*TMemPage)(unsafe.Pointer(pParent)).FaDataEnd *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) = cntOld[i] + int32(1) } - _ = libc.Int32FromInt32(0) (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] = usableSpace - (*TMemPage)(unsafe.Pointer(p)).FnFree j = 0 for { @@ -55320,11 +53608,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -55338,7 +53628,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -55381,12 +53671,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -55411,8 +53702,6 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa d = r + int32(1) - leafData _cachedCellSize(tls, bp+112, d) for cond := true; cond; cond = r >= 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) szR = int32(_cachedCellSize(tls, bp+112, r)) szD = int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(d)*2))) if v14 = szRight != 0; v14 { @@ -55441,11 +53730,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -55455,7 +53745,6 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** the real root page is page 1 and we are the only child of ** that page. */ - _ = libc.Int32FromInt32(0) /* ** Allocate k new pages. Reuse old pages where possible. */ @@ -55473,13 +53762,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup } } else { - _ = libc.Int32FromInt32(0) if bBulk != 0 { v18 = uint32(1) } else { @@ -55503,6 +53791,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -55523,10 +53812,9 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa break } aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _19 _19: + ; i++ } i = 0 @@ -55545,6 +53833,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -55566,11 +53855,9 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) /* If the sibling pages are not leaves, ensure that the right-child pointer ** of the right-most new sibling page is set to the value that was @@ -55615,8 +53902,6 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa pCell = *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(i)*8)) for i == cntOldNext { iOld++ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iOld < nNew { v25 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iOld] } else { @@ -55652,6 +53937,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -55663,8 +53949,6 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } pNew2 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i] j = cntNew[i] - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCell1 = *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(j)*8)) sz2 = int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(j)*2))) + int32(leafCorrection) pTemp1 = aOvflSpace + uintptr(iOvflSpace) @@ -55691,14 +53975,11 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** primary key. */ if int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(j)*2))) == int32(4) { - _ = libc.Int32FromInt32(0) sz2 = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pParent)).FxCellSize})))(tls, pParent, pCell1)) } } } iOvflSpace += sz2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) k = 0 for { if !(k < libc.Int32FromInt32(NB)*libc.Int32FromInt32(2) && *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) <= j) { @@ -55706,20 +53987,21 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { goto balance_cleanup } - _ = libc.Int32FromInt32(0) goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -55755,19 +54037,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v30 = i } iPg = v30 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*(*[5]Tu8)(unsafe.Pointer(bp + 100)))[iPg] != 0 { goto _29 } /* Skip pages already processed */ if i >= 0 || cntOld[iPg-int32(1)] >= cntNew[iPg-int32(1)] { /* Verify condition (1): If cells are moving left, update iPg ** only after iPg-1 has already been updated. */ - _ = libc.Int32FromInt32(0) /* Verify condition (2): If cells are moving right, update iPg ** only after iPg+1 has already been updated. */ - _ = libc.Int32FromInt32(0) if iPg == 0 { v31 = libc.Int32FromInt32(0) iOld1 = v31 @@ -55789,17 +54066,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } (*(*[5]Tu8)(unsafe.Pointer(bp + 100)))[iPg]++ (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iPg])).FnFree = usableSpace - (*(*[5]int32)(unsafe.Pointer(bp + 72)))[iPg] - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if isRoot != 0 && int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell) == 0 && int32((*TMemPage)(unsafe.Pointer(pParent)).FhdrOffset) <= (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0])).FnFree { /* The root page of the b-tree now contains no cells. The only sibling ** page is the right-child of the parent. Copy the contents of the @@ -55816,9 +54089,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** by smaller than the child due to the database header, and so all the ** free space needs to be up front. */ - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _defragmentPage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], -int32(1)) - _ = libc.Int32FromInt32(0) _copyNodeContent(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], pParent, bp) _freePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], bp) } else { @@ -55835,11 +54106,11 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } } - _ = libc.Int32FromInt32(0) /* Free any old pages that were not reused as new pages. */ i = nNew @@ -55850,12 +54121,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -55865,6 +54138,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -55875,6 +54149,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -55912,8 +54187,6 @@ func _balance_deeper(tls *libc.TLS, pRoot uintptr, ppChild uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Pointer to a new child page */ *(*TPgno)(unsafe.Pointer(bp + 16)) = uint32(0) /* Page number of the new child page */ pBt = (*TMemPage)(unsafe.Pointer(pRoot)).FpBt /* The BTree */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Make pRoot, the root page of the b-tree, writable. Allocate a new ** page that will become the new right-child of pPage. Copy the contents ** of the node stored on pRoot into the new child page. @@ -55931,9 +54204,6 @@ func _balance_deeper(tls *libc.TLS, pRoot uintptr, ppChild uintptr) (r int32) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) return *(*int32)(unsafe.Pointer(bp)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Copy the overflow cells from pRoot to pChild */ libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8))+28, pRoot+28, uint64((*TMemPage)(unsafe.Pointer(pRoot)).FnOverflow)*uint64(2)) libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8))+40, pRoot+40, uint64((*TMemPage)(unsafe.Pointer(pRoot)).FnOverflow)*uint64(8)) @@ -55967,10 +54237,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -56023,7 +54294,6 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { ** and copy the current contents of the root-page to it. The ** next iteration of the do-loop will balance the child page. */ - _ = libc.Int32FromInt32(0) rc = _balance_deeper(tls, pPage, pCur+144+1*8) if rc == SQLITE_OK { (*TBtCursor)(unsafe.Pointer(pCur)).FiPage = int8(1) @@ -56031,7 +54301,6 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { *(*Tu16)(unsafe.Pointer(pCur + 88)) = uint16(0) *(*uintptr)(unsafe.Pointer(pCur + 144)) = pPage (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + 1*8)) - _ = libc.Int32FromInt32(0) } } else { break @@ -56041,7 +54310,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -56064,7 +54333,6 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { ** function. If this were not verified, a subtle bug involving reuse ** of the aBalanceQuickSpace[] might sneak in. */ - _ = libc.Int32FromInt32(0) rc = _balance_quick(tls, pParent, pPage, bp) } else { /* In this case, call balance_nonroot() to redistribute cells @@ -56103,7 +54371,6 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The next iteration of the do-loop balances the parent page. */ _releasePage(tls, pPage) (*TBtCursor)(unsafe.Pointer(pCur)).FiPage-- - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) } } @@ -56132,6 +54399,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -56184,7 +54452,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int _, _, _, _, _, _ = iOffset, nTotal, ovflPageSize, ovflPgno, pBt, rc /* Next byte of pX->pData to write */ nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Return code */ *(*uintptr)(unsafe.Pointer(bp)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Size to write on overflow page */ - _ = libc.Int32FromInt32(0) /* pCur is an overflow cell */ + /* pCur is an overflow cell */ /* Overwrite the local portion first */ rc = _btreeOverwriteContent(tls, *(*uintptr)(unsafe.Pointer(bp)), (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload, pX, 0, int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) if rc != 0 { @@ -56192,8 +54460,6 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int } /* Now overwrite the overflow pages */ iOffset = int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) ovflPgno = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr(iOffset)) pBt = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpBt ovflPageSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) @@ -56203,7 +54469,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -56234,7 +54500,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -56297,8 +54563,6 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = 0 p = (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree newCell = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Save the positions of any other cursors open on this table. ** ** In some cases, the call to btreeMoveto() below is a no-op. For @@ -56321,7 +54585,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -56333,17 +54597,12 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s return *(*int32)(unsafe.Pointer(bp)) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Assert that the caller has been consistent. If this cursor was opened ** expecting an index b-tree, then the caller should be inserting blob ** keys with no associated data. If the cursor was opened expecting an ** intkey table, the caller should be inserting integer keys with a ** blob of associated data. */ - _ = libc.Int32FromInt32(0) if (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0) { - _ = libc.Int32FromInt32(0) /* If this is an insert into a table b-tree, invalidate any incrblob ** cursors open on the row being replaced */ if (*TBtree)(unsafe.Pointer(p)).FhasIncrblobCur != 0 { @@ -56359,12 +54618,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_ValidNKey) != 0 && (*TBtreePayload)(unsafe.Pointer(pX)).FnKey == (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey { /* The cursor is pointing to the entry that is to be ** overwritten */ - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize) != 0 && (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload == uint32((*TBtreePayload)(unsafe.Pointer(pX)).FnData)+uint32((*TBtreePayload)(unsafe.Pointer(pX)).FnZero) { /* New entry is the same size as the old. Do an overwrite */ return _btreeOverwriteCell(tls, pCur, pX) } - _ = libc.Int32FromInt32(0) } else { if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { /* The cursor is *not* pointing to the cell to be overwritten, nor @@ -56382,7 +54639,6 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing ** to a row with the same key as the new entry being inserted. */ - _ = libc.Int32FromInt32(0) /* If the cursor is not already pointing either to the cell to be ** overwritten, or if a new cell is being inserted, if the cursor is ** not pointing to an immediately adjacent cell, then move the cursor @@ -56417,14 +54673,11 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } } - _ = libc.Int32FromInt32(0) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -56432,15 +54685,13 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s return *(*int32)(unsafe.Pointer(bp)) } } - _ = libc.Int32FromInt32(0) newCell = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpTmpSpace - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if flags&int32(BTREE_PREFORMAT) != 0 { *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -56458,14 +54709,11 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s goto end_insert } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { - _ = libc.Int32FromInt32(0) if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -56493,12 +54741,12 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** This optimization cannot be used on an autovacuum database if the ** new entry uses overflow pages, as the insertCell() call below is ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ - _ = libc.Int32FromInt32(0) /* clearCell never fails when nLocal==nPayload */ + /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -56509,20 +54757,16 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } } else { if *(*int32)(unsafe.Pointer(bp + 4)) < 0 && int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) > 0 { - _ = libc.Int32FromInt32(0) v3 = pCur + 86 *(*Tu16)(unsafe.Pointer(v3))++ v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { - _ = libc.Int32FromInt32(0) } } *(*int32)(unsafe.Pointer(bp)) = _insertCellFast(tls, pPage, idx, newCell, *(*int32)(unsafe.Pointer(bp + 8))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If no error has occurred and pPage has an overflow cell, call balance() ** to redistribute the cells within the tree. Since balance() may move ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey @@ -56544,9 +54788,8 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** row without seeking the cursor. This can be a big performance boost. */ if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { - _ = libc.Int32FromInt32(0) p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -56557,7 +54800,6 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if flags&int32(BTREE_SAVEPOSITION) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _btreeReleaseAllCursorPages(tls, pCur) if (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo != 0 { - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).FpKey = _sqlite3Malloc(tls, uint64((*TBtreePayload)(unsafe.Pointer(pX)).FnKey)) if (*TBtCursor)(unsafe.Pointer(pCur)).FpKey == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -56569,8 +54811,8 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s (*TBtCursor)(unsafe.Pointer(pCur)).FnKey = (*TBtreePayload)(unsafe.Pointer(pX)).FnKey } } - _ = libc.Int32FromInt32(0) end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -56621,7 +54863,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -56643,14 +54885,13 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } for cond := true; cond; cond = nRem > uint32(0) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { nRem -= nOut for cond := true; cond; cond = *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nOut > uint32(0) { - _ = libc.Int32FromInt32(0) if nIn > uint32(0) { if nOut < nIn { v2 = nOut @@ -56737,37 +54978,28 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _ = bPreserve, iCellDepth, iCellIdx, n, nCell, p, pBt, pCell, pLeaf, pPage, pTmp, v1, v2 p = (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { *(*int32)(unsafe.Pointer(bp)) = _btreeRestoreCursorPosition(tls, pCur) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != 0 || int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } - _ = libc.Int32FromInt32(0) iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx)))))) if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { - return _sqlite3CorruptError(tls, int32(79826)) + return _sqlite3CorruptError(tls, int32(79902)) } if pCell < (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79829)) + return _sqlite3CorruptError(tls, int32(79905)) } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must ** be preserved following this delete operation. If the current delete @@ -56807,7 +55039,6 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { ** balancing the tree following the delete operation easier. */ if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreePrevious(tls, pCur, 0) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != 0 { return *(*int32)(unsafe.Pointer(bp)) } @@ -56862,12 +55093,10 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { } pCell = (*TMemPage)(unsafe.Pointer(pLeaf)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pLeaf)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1)))))))) if pCell < (*TMemPage)(unsafe.Pointer(pLeaf)).FaData+4 { - return _sqlite3CorruptError(tls, int32(79920)) + return _sqlite3CorruptError(tls, int32(79996)) } nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pLeaf)).FxCellSize})))(tls, pLeaf, pCell)) - _ = libc.Int32FromInt32(0) pTmp = (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pLeaf)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pPage, iCellIdx, pCell-uintptr(4), nCell+int32(4), pTmp, n) @@ -56892,8 +55121,6 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { ** been corrected, so be it. Otherwise, after balancing the leaf node, ** walk the cursor up the tree to the internal node and balance it as ** well. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnFree*int32(3) <= int32((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize)*int32(2) { /* Optimization: If the free space is less than 2/3rds of the page, ** then balance() will always be a no-op. No need to invoke it. */ @@ -56915,9 +55142,6 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if int32(bPreserve) > int32(1) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_SKIPNEXT) if iCellIdx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext = -int32(1) @@ -56965,10 +55189,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags var _ /* pgnoRoot at bp+8 */ TPgno var _ /* rc at bp+12 */ int32 _, _ = pBt, ptfFlags - pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Page-type flags for the root page of new table */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Page-type flags for the root page of new table */ if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { /* The page to move to. */ /* Creating a new table may probably require moving an existing database ** to make room for the new tables root page. In case this page turns @@ -56982,7 +55203,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags */ _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+8) if *(*TPgno)(unsafe.Pointer(bp + 8)) > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -56991,7 +55212,6 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags for *(*TPgno)(unsafe.Pointer(bp + 8)) == _ptrmapPageno(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8))) || *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { *(*TPgno)(unsafe.Pointer(bp + 8))++ } - _ = libc.Int32FromInt32(0) /* Allocate a page. The page that currently resides at pgnoRoot will ** be moved to the allocated page (unless the allocated page happens ** to reside at pgnoRoot). @@ -57024,14 +55244,12 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 12)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 12)) = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp)), *(*Tu8)(unsafe.Pointer(bp + 32)), *(*TPgno)(unsafe.Pointer(bp + 36)), *(*TPgno)(unsafe.Pointer(bp + 16)), 0) _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) /* Obtain the page at pgnoRoot */ @@ -57060,7 +55278,6 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags ** order either to increase the database filesize, or to decrement the ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. */ - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3BtreeUpdateMeta(tls, p, int32(4), *(*TPgno)(unsafe.Pointer(bp + 8))) if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -57072,7 +55289,6 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags return *(*int32)(unsafe.Pointer(bp + 12)) } } - _ = libc.Int32FromInt32(0) if createTabFlags&int32(BTREE_INTKEY) != 0 { ptfFlags = libc.Int32FromInt32(PTF_INTKEY) | libc.Int32FromInt32(PTF_LEAFDATA) | libc.Int32FromInt32(PTF_LEAF) } else { @@ -57080,7 +55296,6 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } _zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp)), ptfFlags) _sqlite3PagerUnref(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) - _ = libc.Int32FromInt32(0) *(*TPgno)(unsafe.Pointer(piTable)) = *(*TPgno)(unsafe.Pointer(bp + 8)) return SQLITE_OK } @@ -57109,16 +55324,15 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int var _ /* pPage at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _ = hdr, i, pCell, v2 - _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -57145,6 +55359,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -57169,6 +55384,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -57193,7 +55409,6 @@ func _sqlite3BtreeClearTable(tls *libc.TLS, p uintptr, iTable int32, pnChange ui _, _ = pBt, rc pBt = (*TBtree)(unsafe.Pointer(p)).FpBt _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) rc = _saveAllCursors(tls, pBt, uint32(iTable), uintptr(0)) if SQLITE_OK == rc { /* Invalidate all incrblob cursors open on table iTable (assuming iTable @@ -57252,11 +55467,8 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r _ = pBt *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -57308,7 +55520,6 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r for *(*TPgno)(unsafe.Pointer(bp + 16)) == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) || _ptrmapPageno(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16))) == *(*TPgno)(unsafe.Pointer(bp + 16)) { *(*TPgno)(unsafe.Pointer(bp + 16))-- } - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeUpdateMeta(tls, p, int32(4), *(*TPgno)(unsafe.Pointer(bp + 16))) } else { _freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) @@ -57353,10 +55564,6 @@ func _sqlite3BtreeGetMeta(tls *libc.TLS, p uintptr, idx int32, pMeta uintptr) { _ = pBt pBt = (*TBtree)(unsafe.Pointer(p)).FpBt _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if idx == int32(BTREE_DATA_VERSION) { *(*Tu32)(unsafe.Pointer(pMeta)) = _sqlite3PagerDataVersion(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + (*TBtree)(unsafe.Pointer(p)).FiBDataVersion } else { @@ -57378,17 +55585,12 @@ func _sqlite3BtreeUpdateMeta(tls *libc.TLS, p uintptr, idx int32, iMeta Tu32) (r var rc int32 _, _, _ = pBt, pP1, rc pBt = (*TBtree)(unsafe.Pointer(p)).FpBt - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pP1 = (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) if rc == SQLITE_OK { _sqlite3Put4byte(tls, pP1+uintptr(int32(36)+idx*int32(4)), iMeta) if idx == int32(BTREE_INCR_VACUUM) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(iMeta) } } @@ -57504,7 +55706,6 @@ func _checkProgress(tls *libc.TLS, pCheck uintptr) { (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr = 0 } if (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != 0 { - _ = libc.Int32FromInt32(0) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnStep++ if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnStep%(*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps == uint32(0) && (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { (*TIntegrityCk)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_INTERRUPT) @@ -57532,7 +55733,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4178, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4207, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -57551,8 +55752,6 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) // ** corresponds to page iPg is already set. // */ func _getPageReferenced(tls *libc.TLS, pCheck uintptr, iPg TPgno) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int32(*(*Tu8)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr(iPg/uint32(8))))) & (int32(1) << (iPg & uint32(0x07))) } @@ -57564,8 +55763,6 @@ func _getPageReferenced(tls *libc.TLS, pCheck uintptr, iPg TPgno) (r int32) { func _setPageReferenced(tls *libc.TLS, pCheck uintptr, iPg TPgno) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p1 = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr(iPg/uint32(8)) *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(1)<<(iPg&libc.Uint32FromInt32(0x07))) } @@ -57584,11 +55781,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4180, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4209, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4203, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4232, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -57614,11 +55811,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4333, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4362, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -57670,6 +55867,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -57689,11 +55887,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4372 + v2 = __ccgo_ts + 4401 } else { - v2 = __ccgo_ts + 4377 + v2 = __ccgo_ts + 4406 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4398, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4427, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -57725,7 +55923,6 @@ func _btreeHeapInsert(tls *libc.TLS, aHeap uintptr, x Tu32) { var i, j, v1, v3 Tu32 var v2 uintptr _, _, _, _, _ = i, j, v1, v2, v3 - _ = libc.Int32FromInt32(0) v2 = aHeap *(*Tu32)(unsafe.Pointer(v2))++ v1 = *(*Tu32)(unsafe.Pointer(v2)) @@ -57830,12 +56027,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4424 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4453 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4442, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4471, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4596, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4625, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4626, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4655, 0) doCoverageCheck = 0 goto _4 } @@ -57921,14 +56114,13 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4650, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4679, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ } /* Check the content overflow list */ if (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnPayload > uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnLocal) { /* First page of the overflow chain */ - _ = libc.Int32FromInt32(0) nPage = ((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnPayload - uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnLocal) + usableSize - uint32(5)) / (usableSize - uint32(4)) pgnoOvfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize)-int32(4))) if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { @@ -57945,7 +56137,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4674, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4703, 0) depth = d2 } } else { @@ -57954,6 +56146,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -57977,6 +56170,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc< 0 { - _ = libc.Int32FromInt32(0) /* Enforced by btreeComputeFreeSpace() */ + /* Enforced by btreeComputeFreeSpace() */ size1 = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(i+int32(2)))))<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4728, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -58034,10 +56228,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4736, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4765, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -58087,18 +56282,14 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin savedDbFlags = (*Tsqlite3)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags bPartial = 0 /* True if not checking all btrees */ bCkFreelist = int32(1) /* True to scan the freelist */ - _ = libc.Int32FromInt32(0) /* aRoot[0]==0 means this is a partial check */ if *(*TPgno)(unsafe.Pointer(aRoot)) == uint32(0) { - _ = libc.Int32FromInt32(0) bPartial = int32(1) if *(*TPgno)(unsafe.Pointer(aRoot + 1*4)) != uint32(1) { bCkFreelist = 0 } } _sqlite3BtreeEnter(tls, p) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(120)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).Fdb = db (*(*TIntegrityCk)(unsafe.Pointer(bp))).FpBt = pBt @@ -58127,7 +56318,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4788 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4817 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -58146,15 +56337,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4799, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4828, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4844, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4873, 0) } } } @@ -58174,6 +56366,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32(CURSOR_REQUIRESEEK) { v1 = _btreeRestoreCursorPosition(tls, pCsr) } else { @@ -58410,7 +56591,6 @@ func _sqlite3BtreePutData(tls *libc.TLS, pCsr uintptr, offset Tu32, amt Tu32, z if rc != SQLITE_OK { return rc } - _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCsr)).FeState) != CURSOR_VALID { return int32(SQLITE_ABORT) } @@ -58423,7 +56603,6 @@ func _sqlite3BtreePutData(tls *libc.TLS, pCsr uintptr, offset Tu32, amt Tu32, z ** saveAllCursors can only return SQLITE_OK. */ _saveAllCursors(tls, (*TBtCursor)(unsafe.Pointer(pCsr)).FpBt, (*TBtCursor)(unsafe.Pointer(pCsr)).FpgnoRoot, pCsr) - _ = libc.Int32FromInt32(0) /* Check some assumptions: ** (a) the cursor is open for writing, ** (b) there is a read/write transaction open, @@ -58434,10 +56613,6 @@ func _sqlite3BtreePutData(tls *libc.TLS, pCsr uintptr, offset Tu32, amt Tu32, z if int32((*TBtCursor)(unsafe.Pointer(pCsr)).FcurFlags)&int32(BTCF_WriteFlag) == 0 { return int32(SQLITE_READONLY) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _accessPayload(tls, pCsr, offset, amt, z, int32(1)) } @@ -58466,7 +56641,6 @@ func _sqlite3BtreeSetVersion(tls *libc.TLS, pBtree uintptr, iVersion int32) (r i var rc int32 _, _, _, _, _, _ = aData, pBt, rc, p1, p2, p3 pBt = (*TBtree)(unsafe.Pointer(pBtree)).FpBt /* Return code */ - _ = libc.Int32FromInt32(0) /* If setting the version fields to 1, do not automatically open the ** WAL connection, even if the version fields are currently set to 2. */ @@ -58649,7 +56823,7 @@ func _findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) (r ui rc = 0 _sqlite3ParseObjectInit(tls, bp, pDb) if _sqlite3OpenTempDatabase(tls, bp) != 0 { - _sqlite3ErrorWithMsg(tls, pErrorDb, (*(*TParse)(unsafe.Pointer(bp))).Frc, __ccgo_ts+3795, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) + _sqlite3ErrorWithMsg(tls, pErrorDb, (*(*TParse)(unsafe.Pointer(bp))).Frc, __ccgo_ts+3799, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) rc = int32(SQLITE_ERROR) } _sqlite3DbFree(tls, pErrorDb, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg) @@ -58659,7 +56833,7 @@ func _findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) (r ui } } if i < 0 { - _sqlite3ErrorWithMsg(tls, pErrorDb, int32(SQLITE_ERROR), __ccgo_ts+4951, libc.VaList(bp+432, zDb)) + _sqlite3ErrorWithMsg(tls, pErrorDb, int32(SQLITE_ERROR), __ccgo_ts+4980, libc.VaList(bp+432, zDb)) return uintptr(0) } return (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(pDb)).FaDb + uintptr(i)*32))).FpBt @@ -58688,7 +56862,7 @@ func _setDestPgsz(tls *libc.TLS, p uintptr) (r int32) { // */ func _checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) (r int32) { if _sqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+4971, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+5000, 0) return int32(SQLITE_ERROR) } return SQLITE_OK @@ -58718,7 +56892,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pDestDb)).Fmutex) if pSrcDb == pDestDb { - _sqlite3ErrorWithMsg(tls, pDestDb, int32(SQLITE_ERROR), __ccgo_ts+5002, 0) + _sqlite3ErrorWithMsg(tls, pDestDb, int32(SQLITE_ERROR), __ccgo_ts+5031, 0) p = uintptr(0) } else { /* Allocate space for a new sqlite3_backup object... @@ -58795,12 +56969,6 @@ func _backupOnePage(tls *libc.TLS, p uintptr, iSrcPg TPgno, zSrcData uintptr, bU nCopy = v1 iEnd = int64(iSrcPg) * int64(nSrcPgsz) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This loop runs once for each destination page spanned by the source ** page. For each iteration, variable iOff is set to the byte offset ** of the destination page. @@ -58841,6 +57009,7 @@ func _backupOnePage(tls *libc.TLS, p uintptr, iSrcPg TPgno, zSrcData uintptr, bU _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _2 _2: + ; iOff += int64(nDestPgsz) } return rc @@ -58878,7 +57047,6 @@ func _backupTruncateFile(tls *libc.TLS, pFile uintptr, iSize Ti64) (r int32) { func _attachBackupObject(tls *libc.TLS, p uintptr) { var pp uintptr _ = pp - _ = libc.Int32FromInt32(0) pp = _sqlite3PagerBackupPtr(tls, _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)) (*Tsqlite3_backup)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) *(*uintptr)(unsafe.Pointer(pp)) = p @@ -58962,7 +57130,6 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { ** source pager for the number of pages in the database. */ nSrcPage = int32(_sqlite3BtreeLastPage(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)) - _ = libc.Int32FromInt32(0) ii = 0 for { if !((nPage < 0 || ii < nPage) && (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext <= uint32(nSrcPage) && !(rc != 0)) { @@ -58979,6 +57146,7 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext++ goto _3 _3: + ; ii++ } if rc == SQLITE_OK { @@ -59026,8 +57194,6 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { ** journalled by PagerCommitPhaseOne() before they are destroyed ** by the file truncation. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pgszSrc < pgszDest { ratio = pgszDest / pgszSrc nDestTruncate = (nSrcPage + ratio - int32(1)) / ratio @@ -59037,7 +57203,6 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { } else { nDestTruncate = nSrcPage * (pgszSrc / pgszDest) } - _ = libc.Int32FromInt32(0) if pgszSrc < pgszDest { /* If the source page-size is smaller than the destination page-size, ** two extra things may need to happen: @@ -59050,8 +57215,6 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { */ iSize = int64(pgszSrc) * int64(nSrcPage) pFile = _sqlite3PagerFile(tls, pDestPager) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This block ensures that all data required to recreate the original ** database has been stored in the journal for pDestPager and the ** journal synced to disk. So at this point we may safely modify @@ -59073,6 +57236,7 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { } goto _4 _4: + ; iPg++ } if rc == SQLITE_OK { @@ -59100,6 +57264,7 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) goto _6 _6: + ; iOff += int64(pgszSrc) } if rc == SQLITE_OK { @@ -59131,7 +57296,6 @@ func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { if bCloseTrans != 0 { _sqlite3BtreeCommitPhaseOne(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc, uintptr(0)) _sqlite3BtreeCommitPhaseTwo(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc, 0) - _ = libc.Int32FromInt32(0) } if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<rc) should be set to either SQLITE_DONE ** or an error code. */ Xsqlite3_backup_step(tls, bp, int32(0x7FFFFFFF)) - _ = libc.Int32FromInt32(0) rc = Xsqlite3_backup_finish(tls, bp) if rc == SQLITE_OK { p1 = (*TBtree)(unsafe.Pointer(pTo)).FpBt + 40 @@ -59356,8 +57513,8 @@ func _sqlite3BtreeCopyFile(tls *libc.TLS, pTo uintptr, pFrom uintptr) (r int32) } else { _sqlite3PagerClearCache(tls, _sqlite3BtreePager(tls, (*(*Tsqlite3_backup)(unsafe.Pointer(bp))).FpDest)) } - _ = libc.Int32FromInt32(0) copy_finished: + ; _sqlite3BtreeLeave(tls, pFrom) _sqlite3BtreeLeave(tls, pTo) return rc @@ -59402,10 +57559,7 @@ func _vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { var _ /* acc at bp+0 */ TStrAccum var _ /* x at bp+32 */ Ti64 _ = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Int) != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, bp+32, p, uint64(int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Int)*int32(2))) (*TMem)(unsafe.Pointer(p)).Fn = _sqlite3Int64ToText(tls, *(*Ti64)(unsafe.Pointer(bp + 32)), zBuf) } else { @@ -59415,8 +57569,7 @@ func _vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { } else { v1 = *(*float64)(unsafe.Pointer(p)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5042, libc.VaList(bp+48, v1)) - _ = libc.Int32FromInt32(0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5071, libc.VaList(bp+48, v1)) *(*int8)(unsafe.Pointer(zBuf + uintptr((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar))) = 0 /* Fast version of sqlite3StrAccumFinish(&acc) */ (*TMem)(unsafe.Pointer(p)).Fn = int32((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar) } @@ -59440,9 +57593,6 @@ func _vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { func _sqlite3VdbeChangeEncoding(tls *libc.TLS, pMem uintptr, desiredEnc int32) (r int32) { var rc int32 _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&libc.Int32FromInt32(MEM_Str) != 0) { (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(desiredEnc) return SQLITE_OK @@ -59450,14 +57600,10 @@ func _sqlite3VdbeChangeEncoding(tls *libc.TLS, pMem uintptr, desiredEnc int32) ( if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) == desiredEnc { return SQLITE_OK } - _ = libc.Int32FromInt32(0) /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned, ** then the encoding of the value may not have changed. */ rc = _sqlite3VdbeMemTranslate(tls, pMem, uint8(desiredEnc)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return rc } @@ -59474,12 +57620,8 @@ func _sqlite3VdbeChangeEncoding(tls *libc.TLS, pMem uintptr, desiredEnc int32) ( func _sqlite3VdbeMemGrow(tls *libc.TLS, pMem uintptr, n int32, bPreserve int32) (r int32) { var v1, p2 uintptr _, _ = v1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the bPreserve flag is set to true, then the memory cell must already ** contain a valid string or blob value. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 && bPreserve != 0 && (*TMem)(unsafe.Pointer(pMem)).Fz == (*TMem)(unsafe.Pointer(pMem)).FzMalloc { if (*TMem)(unsafe.Pointer(pMem)).Fdb != 0 { v1 = _sqlite3DbReallocOrFree(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz, uint64(n)) @@ -59508,11 +57650,9 @@ func _sqlite3VdbeMemGrow(tls *libc.TLS, pMem uintptr, n int32, bPreserve int32) (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) } if bPreserve != 0 && (*TMem)(unsafe.Pointer(pMem)).Fz != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pMem)).FzMalloc, (*TMem)(unsafe.Pointer(pMem)).Fz, uint64((*TMem)(unsafe.Pointer(pMem)).Fn)) } if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Dyn) != 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMem)(unsafe.Pointer(pMem)).FxDel})))(tls, (*TMem)(unsafe.Pointer(pMem)).Fz) } (*TMem)(unsafe.Pointer(pMem)).Fz = (*TMem)(unsafe.Pointer(pMem)).FzMalloc @@ -59539,12 +57679,9 @@ func _sqlite3VdbeMemGrow(tls *libc.TLS, pMem uintptr, n int32, bPreserve int32) func _sqlite3VdbeMemClearAndResize(tls *libc.TLS, pMem uintptr, szNew int32) (r int32) { var p1 uintptr _ = p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(pMem)).FszMalloc < szNew { return _sqlite3VdbeMemGrow(tls, pMem, szNew, 0) } - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pMem)).Fz = (*TMem)(unsafe.Pointer(pMem)).FzMalloc p1 = pMem + 20 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & (libc.Int32FromInt32(MEM_Null) | libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) @@ -59633,9 +57770,6 @@ func _sqlite3VdbeMemMakeWriteable(tls *libc.TLS, pMem uintptr) (r int32) { var rc, v1 int32 var p2 uintptr _, _, _ = rc, v1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Zero) != 0 { v1 = _sqlite3VdbeMemExpandBlob(tls, pMem) @@ -59667,11 +57801,6 @@ func _sqlite3VdbeMemExpandBlob(tls *libc.TLS, pMem uintptr) (r int32) { var nByte int32 var p1 uintptr _, _ = nByte, p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Set nByte to the number of bytes required to store the expanded blob. */ nByte = (*TMem)(unsafe.Pointer(pMem)).Fn + *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)) if nByte <= 0 { @@ -59683,8 +57812,6 @@ func _sqlite3VdbeMemExpandBlob(tls *libc.TLS, pMem uintptr) (r int32) { if _sqlite3VdbeMemGrow(tls, pMem, nByte, int32(1)) != 0 { return int32(SQLITE_NOMEM) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*TMem)(unsafe.Pointer(pMem)).Fz+uintptr((*TMem)(unsafe.Pointer(pMem)).Fn), 0, uint64(*(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)))) *(*int32)(unsafe.Pointer(pMem + 16)) += *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)) p1 = pMem + 20 @@ -59698,8 +57825,6 @@ func _sqlite3VdbeMemExpandBlob(tls *libc.TLS, pMem uintptr) (r int32) { // ** Make sure the given Mem is \u0000 terminated. // */ func _sqlite3VdbeMemNulTerminate(tls *libc.TLS, pMem uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Term)|libc.Int32FromInt32(MEM_Str)) != int32(MEM_Str) { return SQLITE_OK /* Nothing to do */ } else { @@ -59729,20 +57854,11 @@ func _sqlite3VdbeMemStringify(tls *libc.TLS, pMem uintptr, enc Tu8, bForce Tu8) var p1, p2 uintptr _, _, _ = nByte, p1, p2 nByte = int32(32) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3VdbeMemClearAndResize(tls, pMem, nByte) != 0 { (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(0) return int32(SQLITE_NOMEM) } _vdbeMemRenderNum(tls, nByte, (*TMem)(unsafe.Pointer(pMem)).Fz, pMem) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(SQLITE_UTF8) p1 = pMem + 20 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Term))) @@ -59769,12 +57885,6 @@ func _sqlite3VdbeMemFinalize(tls *libc.TLS, pMem uintptr, pFunc uintptr) (r int3 defer tls.Free(112) var _ /* ctx at bp+0 */ Tsqlite3_context var _ /* t at bp+56 */ TMem - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(56)) libc.Xmemset(tls, bp+56, 0, uint64(56)) (*(*TMem)(unsafe.Pointer(bp + 56))).Fflags = uint16(MEM_Null) @@ -59784,7 +57894,6 @@ func _sqlite3VdbeMemFinalize(tls *libc.TLS, pMem uintptr, pFunc uintptr) (r int3 (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpFunc = pFunc (*(*Tsqlite3_context)(unsafe.Pointer(bp))).Fenc = (*Tsqlite3)(unsafe.Pointer((*(*TMem)(unsafe.Pointer(bp + 56))).Fdb)).Fenc (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer(pFunc)).FxFinalize})))(tls, bp) /* IMP: R-24505-23230 */ - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 { _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) } @@ -59806,11 +57915,6 @@ func _sqlite3VdbeMemAggValue(tls *libc.TLS, pAccum uintptr, pOut uintptr, pFunc bp := tls.Alloc(64) defer tls.Free(64) var _ /* ctx at bp+0 */ Tsqlite3_context - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(56)) _sqlite3VdbeMemSetNull(tls, pOut) (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpOut = pOut @@ -59833,14 +57937,10 @@ func _sqlite3VdbeMemAggValue(tls *libc.TLS, pAccum uintptr, pOut uintptr, pFunc // ** entry point for releasing Mem resources. // */ func _vdbeMemClearExternAndSetNull(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Agg) != 0 { _sqlite3VdbeMemFinalize(tls, p, *(*uintptr)(unsafe.Pointer(p))) - _ = libc.Int32FromInt32(0) } if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Dyn) != 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMem)(unsafe.Pointer(p)).FxDel})))(tls, (*TMem)(unsafe.Pointer(p)).Fz) } (*TMem)(unsafe.Pointer(p)).Fflags = uint16(MEM_Null) @@ -59880,7 +57980,6 @@ func _vdbeMemClear(tls *libc.TLS, p uintptr) { // ** prior to inserting new content into the Mem. // */ func _sqlite3VdbeMemRelease(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 || (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { _vdbeMemClear(tls, p) } @@ -59892,7 +57991,6 @@ func _sqlite3VdbeMemRelease(tls *libc.TLS, p uintptr) { // ** know in advance that the Mem is not MEM_Dyn or MEM_Agg. // */ func _sqlite3VdbeMemReleaseMalloc(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { _vdbeMemClear(tls, p) } @@ -59923,9 +58021,6 @@ func _memIntValue(tls *libc.TLS, pMem uintptr) (r Ti64) { func _sqlite3VdbeIntValue(tls *libc.TLS, pMem uintptr) (r Ti64) { var flags int32 _ = flags - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) flags = int32((*TMem)(unsafe.Pointer(pMem)).Fflags) if flags&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { return *(*Ti64)(unsafe.Pointer(pMem)) @@ -59962,9 +58057,6 @@ func _memRealValue(tls *libc.TLS, pMem uintptr) (r float64) { } func _sqlite3VdbeRealValue(tls *libc.TLS, pMem uintptr) (r float64) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Real) != 0 { return *(*float64)(unsafe.Pointer(pMem)) } else { @@ -60007,11 +58099,6 @@ func _sqlite3VdbeBooleanValue(tls *libc.TLS, pMem uintptr, ifNull int32) (r int3 func _sqlite3VdbeIntegerAffinity(tls *libc.TLS, pMem uintptr) { var ix Ti64 _ = ix - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_IntReal) != 0 { (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) } else { @@ -60039,10 +58126,6 @@ func _sqlite3VdbeIntegerAffinity(tls *libc.TLS, pMem uintptr) { // ** Convert pMem to type integer. Invalidate any prior representations. // */ func _sqlite3VdbeMemIntegerify(tls *libc.TLS, pMem uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(pMem)) = _sqlite3VdbeIntValue(tls, pMem) (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) return SQLITE_OK @@ -60055,9 +58138,6 @@ func _sqlite3VdbeMemIntegerify(tls *libc.TLS, pMem uintptr) (r int32) { // ** Invalidate any prior representations. // */ func _sqlite3VdbeMemRealify(tls *libc.TLS, pMem uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*float64)(unsafe.Pointer(pMem)) = _sqlite3VdbeRealValue(tls, pMem) (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) return SQLITE_OK @@ -60118,10 +58198,7 @@ func _sqlite3VdbeMemNumerify(tls *libc.TLS, pMem uintptr) (r int32) { var p3 uintptr var _ /* ix at bp+0 */ Tsqlite3_int64 _, _, _, _ = rc, v1, v2, p3 - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Null)) == 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3AtoF(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, pMem, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) if v2 = (rc == 0 || rc == int32(1)) && _sqlite3Atoi64(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, bp, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) <= int32(1); !v2 { v1 = _sqlite3RealToI64(tls, *(*float64)(unsafe.Pointer(pMem))) @@ -60134,7 +58211,6 @@ func _sqlite3VdbeMemNumerify(tls *libc.TLS, pMem uintptr) (r int32) { (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) } } - _ = libc.Int32FromInt32(0) p3 = pMem + 20 *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Zero))) return SQLITE_OK @@ -60157,10 +58233,9 @@ func _sqlite3VdbeMemCast(tls *libc.TLS, pMem uintptr, aff Tu8, encoding Tu8) (r return SQLITE_OK } switch int32(aff) { - case int32(SQLITE_AFF_BLOB): + case int32(SQLITE_AFF_BLOB): /* Really a cast to BLOB */ if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Blob) == 0 { _sqlite3ValueApplyAffinity(tls, pMem, uint8(SQLITE_AFF_TEXT), encoding) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Str) != 0 { (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Blob)) } @@ -60175,12 +58250,9 @@ func _sqlite3VdbeMemCast(tls *libc.TLS, pMem uintptr, aff Tu8, encoding Tu8) (r case int32(SQLITE_AFF_REAL): _sqlite3VdbeMemRealify(tls, pMem) default: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p2 = pMem + 20 *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&libc.Int32FromInt32(MEM_Blob)>>libc.Int32FromInt32(3)) _sqlite3ValueApplyAffinity(tls, pMem, uint8(SQLITE_AFF_TEXT), encoding) - _ = libc.Int32FromInt32(0) p3 = pMem + 20 *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal) | libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Zero))) if int32(encoding) != int32(SQLITE_UTF8) { @@ -60203,7 +58275,6 @@ func _sqlite3VdbeMemCast(tls *libc.TLS, pMem uintptr, aff Tu8, encoding Tu8) (r // ** The minimum amount of initialization feasible is performed. // */ func _sqlite3VdbeMemInit(tls *libc.TLS, pMem uintptr, db uintptr, flags Tu16) { - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pMem)).Fflags = flags (*TMem)(unsafe.Pointer(pMem)).Fdb = db (*TMem)(unsafe.Pointer(pMem)).FszMalloc = 0 @@ -60297,12 +58368,11 @@ func _sqlite3NoopDestructor(tls *libc.TLS, p uintptr) { func _sqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr) { var v1, v2 uintptr _, _ = v1, v2 - _ = libc.Int32FromInt32(0) _vdbeMemClear(tls, pMem) if zPType != 0 { v1 = zPType } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } *(*uintptr)(unsafe.Pointer(pMem)) = v1 (*TMem)(unsafe.Pointer(pMem)).Fz = pPtr @@ -60343,8 +58413,6 @@ func _sqlite3VdbeMemSetRowSet(tls *libc.TLS, pMem uintptr) (r int32) { var db, p uintptr _, _ = db, p db = (*TMem)(unsafe.Pointer(pMem)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemRelease(tls, pMem) p = _sqlite3RowSetInit(tls, db) if p == uintptr(0) { @@ -60365,7 +58433,6 @@ func _sqlite3VdbeMemSetRowSet(tls *libc.TLS, pMem uintptr) (r int32) { func _sqlite3VdbeMemTooBig(tls *libc.TLS, p uintptr) (r int32) { var n int32 _ = n - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { n = (*TMem)(unsafe.Pointer(p)).Fn if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Zero) != 0 { @@ -60386,15 +58453,12 @@ func _sqlite3VdbeMemTooBig(tls *libc.TLS, p uintptr) (r int32) { // */ func _vdbeClrCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, eType int32) { _vdbeMemClearExternAndSetNull(tls, pTo) - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemShallowCopy(tls, pTo, pFrom, eType) } func _sqlite3VdbeMemShallowCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, srcType int32) { var p1, p2 uintptr _, _ = p1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pTo)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { _vdbeClrCopy(tls, pTo, pFrom, srcType) return @@ -60403,7 +58467,6 @@ func _sqlite3VdbeMemShallowCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, srcTy if int32((*TMem)(unsafe.Pointer(pFrom)).Fflags)&int32(MEM_Static) == 0 { p1 = pTo + 20 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(MEM_Dyn) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Ephem))) - _ = libc.Int32FromInt32(0) p2 = pTo + 20 *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | srcType) } @@ -60420,7 +58483,6 @@ func _sqlite3VdbeMemCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr) (r int32) { var p1, p2 uintptr _, _, _ = rc, p1, p2 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pTo)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { _vdbeMemClearExternAndSetNull(tls, pTo) } @@ -60446,9 +58508,6 @@ func _sqlite3VdbeMemCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr) (r int32) { // ** pFrom contains an SQL NULL when this routine returns. // */ func _sqlite3VdbeMemMove(tls *libc.TLS, pTo uintptr, pFrom uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemRelease(tls, pTo) libc.Xmemcpy(tls, pTo, pFrom, uint64(56)) (*TMem)(unsafe.Pointer(pFrom)).Fflags = uint16(MEM_Null) @@ -60486,10 +58545,6 @@ func _sqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n Ti64, enc T var v3 int64 _, _, _, _, _, _, _ = flags, iLimit, nAlloc, nByte, v2, v3, v4 nByte = n /* New value for pMem->flags */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If z is a NULL pointer, set pMem to contain an SQL NULL. */ if !(z != 0) { _sqlite3VdbeMemSetNull(tls, pMem) @@ -60501,7 +58556,6 @@ func _sqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n Ti64, enc T iLimit = int32(SQLITE_MAX_LENGTH) } if nByte < 0 { - _ = libc.Int32FromInt32(0) if int32(enc) == int32(SQLITE_UTF8) { nByte = int64(libc.Xstrlen(tls, z)) } else { @@ -60512,6 +58566,7 @@ func _sqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n Ti64, enc T } goto _1 _1: + ; nByte += int64(2) } } @@ -60605,7 +58660,7 @@ func _sqlite3VdbeMemFromBtree(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32 _, _ = rc, v1 (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Null) if _sqlite3BtreeMaxRecordSize(tls, pCur) < int64(offset+amt) { - return _sqlite3CorruptError(tls, int32(83562)) + return _sqlite3CorruptError(tls, int32(83638)) } v1 = _sqlite3VdbeMemClearAndResize(tls, pMem, int32(amt+uint32(1))) rc = v1 @@ -60630,13 +58685,9 @@ func _sqlite3VdbeMemFromBtreeZeroOffset(tls *libc.TLS, pCur uintptr, amt Tu32, p _ = rc *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) /* Number of bytes available on the local btree page */ rc = SQLITE_OK /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() ** that both the BtShared and database handle mutexes are held. */ - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pMem)).Fz = _sqlite3BtreePayloadFetch(tls, pCur, bp) - _ = libc.Int32FromInt32(0) if amt <= *(*Tu32)(unsafe.Pointer(bp)) { (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Ephem)) (*TMem)(unsafe.Pointer(pMem)).Fn = int32(amt) @@ -60657,11 +58708,6 @@ func _valueToText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { var v1 int32 var p2 uintptr _, _ = v1, p2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Blob)|libc.Int32FromInt32(MEM_Str)) != 0 { if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Zero) != 0 { v1 = _sqlite3VdbeMemExpandBlob(tls, pVal) @@ -60677,7 +58723,6 @@ func _valueToText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { _sqlite3VdbeChangeEncoding(tls, pVal, int32(enc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED)) } if int32(enc)&int32(SQLITE_UTF16_ALIGNED) != 0 && int32(1) == int32(1)&int32(int64((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz)) { - _ = libc.Int32FromInt32(0) if _sqlite3VdbeMemMakeWriteable(tls, pVal) != SQLITE_OK { return uintptr(0) } @@ -60685,11 +58730,8 @@ func _valueToText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { _sqlite3VdbeMemNulTerminate(tls, pVal) /* IMP: R-31275-44060 */ } else { _sqlite3VdbeMemStringify(tls, pVal, enc, uint8(0)) - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED) { - _ = libc.Int32FromInt32(0) return (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz } else { return uintptr(0) @@ -60713,11 +58755,7 @@ func _sqlite3ValueText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { if !(pVal != 0) { return uintptr(0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Term)) == libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Term) && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) { - _ = libc.Int32FromInt32(0) return (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Null) != 0 { @@ -60799,8 +58837,6 @@ func _valueNew(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { if pRec != 0 { (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo = _sqlite3KeyInfoOfIndex(tls, (*TValueNewStat4Ctx)(unsafe.Pointer(p)).FpParse, pIdx) if (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem = pRec + uintptr((libc.Uint64FromInt64(40)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) i = 0 for { @@ -60811,6 +58847,7 @@ func _valueNew(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr(i)*56))).Fdb = db goto _1 _1: + ; i++ } } else { @@ -60865,16 +58902,11 @@ func _valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc Tu8, aff Tu8, pVal = uintptr(0) /* New value */ rc = SQLITE_OK /* Return code */ pList = uintptr(0) /* Iterator variable */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(p + 32)) if pList != 0 { nVal = (*TExprList)(unsafe.Pointer(pList)).FnExpr } - _ = libc.Int32FromInt32(0) pFunc = _sqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(p + 8)), nVal, enc, uint8(0)) - _ = libc.Int32FromInt32(0) if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)|libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG)) == uint32(0) || (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)|libc.Int32FromInt32(SQLITE_FUNC_RUNONLY)) != uint32(0) { return SQLITE_OK } @@ -60895,6 +58927,7 @@ func _valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc Tu8, aff Tu8, } goto _1 _1: + ; i++ } } @@ -60910,10 +58943,9 @@ func _valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc Tu8, aff Tu8, (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer(pFunc)).FxSFunc})))(tls, bp, nVal, apVal) if (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError != 0 { rc = (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError - _sqlite3ErrorMsg(tls, (*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, __ccgo_ts+3795, libc.VaList(bp+64, Xsqlite3_value_text(tls, pVal))) + _sqlite3ErrorMsg(tls, (*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, __ccgo_ts+3799, libc.VaList(bp+64, Xsqlite3_value_text(tls, pVal))) } else { _sqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeChangeEncoding(tls, pVal, int32(enc)) if rc == SQLITE_OK && _sqlite3VdbeMemTooBig(tls, pVal) != 0 { rc = int32(SQLITE_TOOBIG) @@ -60921,6 +58953,7 @@ func _valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc Tu8, aff Tu8, } } value_from_function_out: + ; if rc != SQLITE_OK { pVal = uintptr(0) (*TParse)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).Frc = rc @@ -60934,6 +58967,7 @@ value_from_function_out: _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _2 _2: + ; i++ } _sqlite3DbFreeNN(tls, db, apVal) @@ -60965,9 +58999,8 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) negInt = int32(1) - zNeg = __ccgo_ts + 1648 + zNeg = __ccgo_ts + 1652 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) for { v1 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) op = v1 @@ -60983,9 +59016,7 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity ** on a table column definition, and hence only when pCtx==0. This ** check ensures that an EP_TokenOnly expression is never passed down ** into valueFromFunction(). */ - _ = libc.Int32FromInt32(0) if op == int32(TK_CAST) { - _ = libc.Int32FromInt32(0) aff = uint8(_sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0))) rc = _valueFromExpr(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, enc, aff, ppVal, pCtx) if *(*uintptr)(unsafe.Pointer(ppVal)) != 0 { @@ -61007,7 +59038,7 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) negInt = -int32(1) - zNeg = __ccgo_ts + 5049 + zNeg = __ccgo_ts + 5078 } if op == int32(TK_STRING) || op == int32(TK_FLOAT) || op == int32(TK_INTEGER) { *(*uintptr)(unsafe.Pointer(bp)) = _valueNew(tls, db, pCtx) @@ -61017,7 +59048,7 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != uint32(0) { _sqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp)), int64(*(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)))*int64(negInt)) } else { - zVal = _sqlite3MPrintf(tls, db, __ccgo_ts+5051, libc.VaList(bp+16, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + zVal = _sqlite3MPrintf(tls, db, __ccgo_ts+5080, libc.VaList(bp+16, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) if zVal == uintptr(0) { goto no_mem } @@ -61028,7 +59059,6 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity } else { _sqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp)), affinity, uint8(SQLITE_UTF8)) } - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)) != 0 { p3 = *(*uintptr)(unsafe.Pointer(bp)) + 20 *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(MEM_Str)) @@ -61062,23 +59092,18 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity _sqlite3VdbeMemSetNull(tls, *(*uintptr)(unsafe.Pointer(bp))) } else { if op == int32(TK_BLOB) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(bp)) = _valueNew(tls, db, pCtx) if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { goto no_mem } zVal = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + 2 nVal = _sqlite3Strlen30(tls, zVal) - int32(1) - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetStr(tls, *(*uintptr)(unsafe.Pointer(bp)), _sqlite3HexToBlob(tls, db, zVal, nVal), int64(nVal/int32(2)), uint8(0), __ccgo_fp(_sqlite3OomClear)) } else { if op == int32(TK_FUNCTION) && pCtx != uintptr(0) { rc = _valueFromFunction(tls, db, pExpr, enc, affinity, bp, pCtx) } else { if op == int32(TK_TRUEFALSE) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(bp)) = _valueNew(tls, db, pCtx) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { (*Tsqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags = uint16(MEM_Int) @@ -61094,11 +59119,11 @@ func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp)) return rc no_mem: + ; if pCtx == uintptr(0) || (*TParse)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).FnErr == 0 { _sqlite3OomFault(tls, db) } _sqlite3DbFree(tls, db, zVal) - _ = libc.Int32FromInt32(0) if pCtx == uintptr(0) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -61160,7 +59185,6 @@ func _stat4ValueFromExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr, affinity db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Skip over any TK_COLLATE nodes */ pExpr = _sqlite3ExprSkipCollate(tls, pExpr) - _ = libc.Int32FromInt32(0) if !(pExpr != 0) { *(*uintptr)(unsafe.Pointer(bp)) = _valueNew(tls, db, pAlloc) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -61184,7 +59208,6 @@ func _stat4ValueFromExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr, affinity rc = _valueFromExpr(tls, db, pExpr, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, affinity, bp, pAlloc) } } - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp)) return rc } @@ -61261,6 +59284,7 @@ func _sqlite3Stat4ProbeSetValue(tls *libc.TLS, pParse uintptr, pIdx uintptr, ppR nExtract++ goto _1 _1: + ; i++ } } @@ -61306,7 +59330,6 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC szField = 0 /* Column index */ a = pRec /* Typecast byte array */ pMem = *(*uintptr)(unsafe.Pointer(ppVal)) /* Write result into this Mem object */ - _ = libc.Int32FromInt32(0) if int32(*(*Tu8)(unsafe.Pointer(a))) < int32(libc.Uint8FromInt32(0x80)) { *(*int32)(unsafe.Pointer(bp + 4)) = int32(uint32(*(*Tu8)(unsafe.Pointer(a)))) v1 = libc.Int32FromInt32(1) @@ -61315,7 +59338,7 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr = int32(uint8(v1)) if *(*int32)(unsafe.Pointer(bp + 4)) > nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -61331,16 +59354,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -61378,6 +59402,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -61431,7 +59456,6 @@ func _sqlite3ValueBytes(tls *libc.TLS, pVal uintptr, enc Tu8) (r int32) { var p uintptr _ = p p = pVal - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Str) != 0 && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) { return (*TMem)(unsafe.Pointer(p)).Fn } @@ -61472,13 +59496,8 @@ func _sqlite3VdbeCreate(tls *libc.TLS, pParse uintptr) (r uintptr) { (*TVdbe)(unsafe.Pointer(p)).FpVNext = (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe (*TVdbe)(unsafe.Pointer(p)).FppVPrev = db + 8 (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe = p - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FpParse = pParse (*TParse)(unsafe.Pointer(pParse)).FpVdbe = p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, p, int32(OP_Init), 0, int32(1)) return p } @@ -61519,7 +59538,6 @@ func _sqlite3VdbeSetSql(tls *libc.TLS, p uintptr, z uintptr, n int32, prepFlags if int32(prepFlags)&int32(SQLITE_PREPARE_SAVESQL) == 0 { (*TVdbe)(unsafe.Pointer(p)).Fexpmask = uint32(0) } - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FzSql = _sqlite3DbStrNDup(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, z, uint64(n)) } @@ -61539,7 +59557,6 @@ func _sqlite3VdbeSwap(tls *libc.TLS, pA uintptr, pB uintptr) { var pTmp, ppTmp, zTmp uintptr var tmp TVdbe _, _, _, _ = pTmp, ppTmp, tmp, zTmp - _ = libc.Int32FromInt32(0) tmp = *(*TVdbe)(unsafe.Pointer(pA)) *(*TVdbe)(unsafe.Pointer(pA)) = *(*TVdbe)(unsafe.Pointer(pB)) *(*TVdbe)(unsafe.Pointer(pB)) = tmp @@ -61596,8 +59613,6 @@ func _growOpArray(tls *libc.TLS, v uintptr, nOp int32) (r int32) { _sqlite3OomFault(tls, (*TParse)(unsafe.Pointer(p)).Fdb) return int32(SQLITE_NOMEM) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pNew = _sqlite3DbRealloc(tls, (*TParse)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(v)).FaOp, uint64(nNew)*uint64(24)) if pNew != 0 { (*TParse)(unsafe.Pointer(p)).FszOpAlloc = _sqlite3DbMallocSize(tls, (*TParse)(unsafe.Pointer(p)).Fdb, pNew) @@ -61620,11 +59635,9 @@ func _growOpArray(tls *libc.TLS, v uintptr, nOp int32) (r int32) { // ** before adding the new opcode. // */ func _growOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) (r int32) { - _ = libc.Int32FromInt32(0) if _growOpArray(tls, p, int32(1)) != 0 { return int32(1) } - _ = libc.Int32FromInt32(0) return _sqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) } @@ -61672,15 +59685,11 @@ func _sqlite3VdbeAddOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, var pOp uintptr _, _ = i, pOp i = (*TVdbe)(unsafe.Pointer(p)).FnOp - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FnOpAlloc <= i { return _growOp3(tls, p, op, p1, p2, p3) } - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FnOp++ pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24 - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(op) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(0) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = p1 @@ -61705,7 +59714,6 @@ func _sqlite3VdbeAddOp4Int(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int3 } (*TVdbe)(unsafe.Pointer(p)).FnOp++ pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24 - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(op) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(0) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = p1 @@ -61781,10 +59789,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -61818,11 +59828,9 @@ func _sqlite3VdbeAddFunctionCall(tls *libc.TLS, pParse uintptr, p1 int32, p2 int var pCtx, v uintptr _, _, _, _, _ = addr, nByte, pCtx, v, v1 v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) nByte = int32(uint64(56) + uint64(nArg-libc.Int32FromInt32(1))*uint64(8)) pCtx = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nByte)) if pCtx == uintptr(0) { - _ = libc.Int32FromInt32(0) _freeEphemeralFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pFunc) return 0 } @@ -61942,6 +59950,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -62029,13 +60038,10 @@ func _sqlite3VdbeResolveLabel(tls *libc.TLS, v uintptr, x int32) { _, _ = j, p p = (*TVdbe)(unsafe.Pointer(v)).FpParse j = ^x - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(p)).FnLabelAlloc+(*TParse)(unsafe.Pointer(p)).FnLabel < 0 { _resizeResolveLabel(tls, p, v, j) } else { - _ = libc.Int32FromInt32(0) /* Labels may only be resolved once */ + /* Labels may only be resolved once */ *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(p)).FaLabel + uintptr(j)*4)) = (*TVdbe)(unsafe.Pointer(v)).FnOp } } @@ -62068,6 +60074,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62102,11 +60109,10 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { nMaxArgs = *(*int32)(unsafe.Pointer(pMaxFuncArgs)) pParse = (*TVdbe)(unsafe.Pointer(p)).FpParse aLabel = (*TParse)(unsafe.Pointer(pParse)).FaLabel - _ = libc.Int32FromInt32(0) /* tag-20230419-1 */ + /* tag-20230419-1 */ libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 6, 0x40) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 7, 0x80) pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24 - _ = libc.Int32FromInt32(0) for int32(1) != 0 { /* Only JUMP opcodes and the short list of special opcodes in the switch ** below need to be considered. The mkopcodeh.tcl generator script groups @@ -62135,15 +60141,12 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 6, 0x40) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 7, 0x80) case int32(OP_Init): - _ = libc.Int32FromInt32(0) goto resolve_p2_values_loop_exit case int32(OP_VUpdate): if (*TOp)(unsafe.Pointer(pOp)).Fp2 > nMaxArgs { nMaxArgs = (*TOp)(unsafe.Pointer(pOp)).Fp2 } case int32(OP_VFilter): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) n = (*(*TOp)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24))).Fp1 if n > nMaxArgs { nMaxArgs = n @@ -62154,9 +60157,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* True because of tag-20230419-1 */ + /* True because of tag-20230419-1 */ (*TOp)(unsafe.Pointer(pOp)).Fp2 = *(*int32)(unsafe.Pointer(aLabel + uintptr(^(*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) } break @@ -62164,19 +60165,17 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) } (*TParse)(unsafe.Pointer(pParse)).FnLabel = 0 *(*int32)(unsafe.Pointer(pMaxFuncArgs)) = nMaxArgs - _ = libc.Int32FromInt32(0) } // C documentation @@ -62185,7 +60184,6 @@ resolve_p2_values_loop_exit: // ** Return the address of the next instruction to be inserted. // */ func _sqlite3VdbeCurrentAddr(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return (*TVdbe)(unsafe.Pointer(p)).FnOp } @@ -62229,9 +60227,7 @@ func _sqlite3VdbeTakeOpArray(tls *libc.TLS, p uintptr, pnOp uintptr, pnMaxArg ui var aOp uintptr _ = aOp aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp - _ = libc.Int32FromInt32(0) /* Check that sqlite3VdbeUsesBtree() was not called on this VM */ - _ = libc.Int32FromInt32(0) _resolveP2Values(tls, p, pnMaxArg) *(*int32)(unsafe.Pointer(pnOp)) = (*TVdbe)(unsafe.Pointer(p)).FnOp (*TVdbe)(unsafe.Pointer(p)).FaOp = uintptr(0) @@ -62251,8 +60247,6 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi var i int32 var pFirst, pOut, v1 uintptr _, _, _, _ = i, pFirst, pOut, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FnOp+nOp > (*TVdbe)(unsafe.Pointer(p)).FnOpAlloc && _growOpArray(tls, p, nOp) != 0 { return uintptr(0) } @@ -62267,7 +60261,6 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi (*TVdbeOp)(unsafe.Pointer(pOut)).Fopcode = (*TVdbeOpList)(unsafe.Pointer(aOp)).Fopcode (*TVdbeOp)(unsafe.Pointer(pOut)).Fp1 = int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp1) (*TVdbeOp)(unsafe.Pointer(pOut)).Fp2 = int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp2) - _ = libc.Int32FromInt32(0) if int32(_sqlite3OpcodeProperty[(*TVdbeOpList)(unsafe.Pointer(aOp)).Fopcode])&int32(OPFLG_JUMP) != 0 && int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp2) > 0 { *(*int32)(unsafe.Pointer(pOut + 8)) += (*TVdbe)(unsafe.Pointer(p)).FnOp } @@ -62278,6 +60271,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -62293,27 +60287,22 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi // ** for a specific instruction. // */ func _sqlite3VdbeChangeOpcode(tls *libc.TLS, p uintptr, addr int32, iNewOpcode Tu8) { - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fopcode = iNewOpcode } func _sqlite3VdbeChangeP1(tls *libc.TLS, p uintptr, addr int32, val int32) { - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp1 = val } func _sqlite3VdbeChangeP2(tls *libc.TLS, p uintptr, addr int32, val int32) { - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp2 = val } func _sqlite3VdbeChangeP3(tls *libc.TLS, p uintptr, addr int32, val int32) { - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp3 = val } func _sqlite3VdbeChangeP5(tls *libc.TLS, p uintptr, p5 Tu16) { - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FnOp > 0 { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24))).Fp5 = p5 } @@ -62363,8 +60352,6 @@ func _sqlite3VdbeJumpHere(tls *libc.TLS, p uintptr, addr int32) { // */ func _sqlite3VdbeJumpHereOrPopInst(tls *libc.TLS, p uintptr, addr int32) { if addr == (*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FnOp-- } else { _sqlite3VdbeChangeP2(tls, p, addr, (*TVdbe)(unsafe.Pointer(p)).FnOp) @@ -62378,7 +60365,6 @@ func _sqlite3VdbeJumpHereOrPopInst(tls *libc.TLS, p uintptr, addr int32) { // ** the FuncDef is not ephemeral, then do nothing. // */ func _freeEphemeralFunction(tls *libc.TLS, db uintptr, pDef uintptr) { - _ = libc.Int32FromInt32(0) if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_EPHEM) != uint32(0) { _sqlite3DbNNFreeNN(tls, db, pDef) } @@ -62397,13 +60383,11 @@ func _freeP4Mem(tls *libc.TLS, db uintptr, p uintptr) { } func _freeP4FuncCtx(tls *libc.TLS, db uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) _freeEphemeralFunction(tls, db, (*Tsqlite3_context)(unsafe.Pointer(p)).FpFunc) _sqlite3DbNNFreeNN(tls, db, p) } func _freeP4(tls *libc.TLS, db uintptr, p4type int32, p4 uintptr) { - _ = libc.Int32FromInt32(0) switch p4type { case -int32(15): _freeP4FuncCtx(tls, db, p4) @@ -62451,8 +60435,6 @@ func _freeP4(tls *libc.TLS, db uintptr, p4type int32, p4 uintptr) { func _vdbeFreeOpArray(tls *libc.TLS, db uintptr, aOp uintptr, nOp int32) { var pOp uintptr _ = pOp - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if aOp != 0 { pOp = aOp + uintptr(nOp-int32(1))*24 for int32(1) != 0 { /* Exit via break */ @@ -62500,7 +60482,6 @@ func _sqlite3VdbeChangeToNoop(tls *libc.TLS, p uintptr, addr int32) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { return 0 } - _ = libc.Int32FromInt32(0) pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24 _freeP4(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16))) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = P4_NOTUSED @@ -62545,7 +60526,6 @@ func _sqlite3VdbeDeletePriorOpcode(tls *libc.TLS, p uintptr, op Tu8) (r int32) { // */ func _vdbeChangeP4Full(tls *libc.TLS, p uintptr, pOp uintptr, zP4 uintptr, n int32) { if (*TOp)(unsafe.Pointer(pOp)).Fp4type != 0 { - _ = libc.Int32FromInt32(0) (*TOp)(unsafe.Pointer(pOp)).Fp4type = 0 *(*uintptr)(unsafe.Pointer(pOp + 16)) = uintptr(0) } @@ -62566,18 +60546,13 @@ func _sqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, _zP4 uintptr, n *(*uintptr)(unsafe.Pointer(bp)) = _zP4 var db, pOp uintptr _, _ = db, pOp - _ = libc.Int32FromInt32(0) db = (*TVdbe)(unsafe.Pointer(p)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if n != -int32(11) { _freeP4(tls, db, n, *(*uintptr)(unsafe.Pointer(bp))) } return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if addr < 0 { addr = (*TVdbe)(unsafe.Pointer(p)).FnOp - int32(1) } @@ -62593,7 +60568,6 @@ func _sqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, _zP4 uintptr, n (*TOp)(unsafe.Pointer(pOp)).Fp4type = int8(-libc.Int32FromInt32(3)) } else { if *(*uintptr)(unsafe.Pointer(bp)) != uintptr(0) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pOp + 16)) = *(*uintptr)(unsafe.Pointer(bp)) (*TOp)(unsafe.Pointer(pOp)).Fp4type = int8(n) if n == -int32(11) { @@ -62617,15 +60591,10 @@ func _sqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, _zP4 uintptr, n func _sqlite3VdbeAppendP4(tls *libc.TLS, p uintptr, pP4 uintptr, n int32) { var pOp uintptr _ = pOp - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { _freeP4(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, n, pP4) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24 - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(n) *(*uintptr)(unsafe.Pointer(pOp + 16)) = pP4 } @@ -62641,8 +60610,6 @@ func _sqlite3VdbeSetP4KeyInfo(tls *libc.TLS, pParse uintptr, pIdx uintptr) { var pKeyInfo, v uintptr _, _ = pKeyInfo, v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pKeyInfo = _sqlite3KeyInfoOfIndex(tls, pParse, pIdx) if pKeyInfo != 0 { _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) @@ -62665,8 +60632,6 @@ func _sqlite3VdbeSetP4KeyInfo(tls *libc.TLS, pParse uintptr, pIdx uintptr) { // ** by running with Valgrind. // */ func _sqlite3VdbeGetOp(tls *libc.TLS, p uintptr, addr int32) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { return uintptr(unsafe.Pointer(&_dummy)) } else { @@ -62706,8 +60671,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5056, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5085, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -62717,67 +60681,66 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { if pColl != 0 { v2 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5061) == 0 { - zColl = __ccgo_ts + 5068 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5090) == 0 { + zColl = __ccgo_ts + 5097 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5049 + v3 = __ccgo_ts + 5078 } else { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5070 + v4 = __ccgo_ts + 5099 } else { - v4 = __ccgo_ts + 1648 + v4 = __ccgo_ts + 1652 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5073, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5102, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5110, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5097, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5126, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5135, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5135, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1404, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1408, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5113, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5142, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1371, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1375, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): pMem = *(*uintptr)(unsafe.Pointer(pOp + 16)) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Str) != 0 { zP4 = (*TMem)(unsafe.Pointer(pMem)).Fz } else { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1404, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(pMem)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1408, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(pMem)))) } else { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1371, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(pMem)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1375, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(pMem)))) } else { if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { - zP4 = __ccgo_ts + 1649 + zP4 = __ccgo_ts + 1653 } else { - _ = libc.Int32FromInt32(0) - zP4 = __ccgo_ts + 5116 + zP4 = __ccgo_ts + 5145 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5123, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5152, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -62792,14 +60755,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5160, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5136, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5165, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5138 + zP4 = __ccgo_ts + 5167 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -62815,10 +60779,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5083, - 1: __ccgo_ts + 5085, - 2: __ccgo_ts + 5087, - 3: __ccgo_ts + 5092, + 0: __ccgo_ts + 5112, + 1: __ccgo_ts + 5114, + 2: __ccgo_ts + 5116, + 3: __ccgo_ts + 5121, } // C documentation @@ -62832,8 +60796,6 @@ var _encnames = [4]uintptr{ // ** p->btreeMask of databases that will require a lock. // */ func _sqlite3VdbeUsesBtree(tls *libc.TLS, p uintptr, i int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*TyDbMask)(unsafe.Pointer(p + 204)) |= libc.Uint32FromInt32(1) << i if i != int32(1) && _sqlite3BtreeSharable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FaDb + uintptr(i)*32))).FpBt) != 0 { *(*TyDbMask)(unsafe.Pointer(p + 208)) |= libc.Uint32FromInt32(1) << i @@ -62883,6 +60845,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62909,6 +60872,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62948,6 +60912,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -62980,6 +60945,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -62989,8 +60955,6 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { return } for { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This block is really an inlined version of sqlite3VdbeMemRelease() ** that takes advantage of the fact that the memory cell value is ** being set to NULL after releasing any dynamic resources. @@ -63015,6 +60979,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -63037,7 +61002,6 @@ func _sqlite3VdbeFrameMemDel(tls *libc.TLS, pArg uintptr) { var pFrame uintptr _ = pFrame pFrame = pArg - _ = libc.Int32FromInt32(0) (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent = (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame = pFrame } @@ -63082,6 +61046,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -63101,17 +61066,15 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp } else { i -= (*TVdbe)(unsafe.Pointer(p)).FnOp - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) j = 0 for { if !(i >= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp) { break } i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp - _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -63133,6 +61096,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -63153,7 +61117,6 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, if eMode == 0 { break } - _ = libc.Int32FromInt32(0) if int32((*(*TOp)(unsafe.Pointer(aOp + uintptr(i)*24))).Fopcode) == int32(OP_Explain) { break } @@ -63179,7 +61142,6 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { _, _, _ = aMem, apCsr, i aMem = p + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) apCsr = aMem + uintptr((*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem)*56 - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TVdbeFrame)(unsafe.Pointer(p)).FnChildCsr) { @@ -63190,6 +61152,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -63230,9 +61193,6 @@ func _sqlite3VdbeList(tls *libc.TLS, p uintptr) (r int32) { rc = SQLITE_OK /* Return code */ pMem = (*TVdbe)(unsafe.Pointer(p)).FaMem + 1*56 /* First Mem of result set */ bListSubprogs = libc.BoolInt32(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) == int32(1) || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TriggerEQP) != uint64(0)) /* Current opcode */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Even though this opcode does not use dynamic strings for ** the result, result columns may become dynamic if the user calls ** sqlite3_column_text16(), causing a translation to UTF-16 encoding. @@ -63249,7 +61209,6 @@ func _sqlite3VdbeList(tls *libc.TLS, p uintptr) (r int32) { ** commandeer the 9th cell to use as storage for an array of pointers ** to trigger subprograms. The VDBE is guaranteed to have at least 9 ** cells. */ - _ = libc.Int32FromInt32(0) pSub = (*TVdbe)(unsafe.Pointer(p)).FaMem + 9*56 } else { pSub = uintptr(0) @@ -63269,7 +61228,6 @@ func _sqlite3VdbeList(tls *libc.TLS, p uintptr) (r int32) { _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(1)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp2)) _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(2)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp3)) _sqlite3VdbeMemSetStr(tls, pMem+uintptr(3)*56, zP4, int64(-int32(1)), uint8(SQLITE_UTF8), __ccgo_fp(Xsqlite3_free)) - _ = libc.Int32FromInt32(0) } else { _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(0)*56, int64(*(*int32)(unsafe.Pointer(bp)))) _sqlite3VdbeMemSetStr(tls, pMem+uintptr(1)*56, _sqlite3OpcodeName(tls, int32((*TOp)(unsafe.Pointer(pOp)).Fopcode)), int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) @@ -63280,7 +61238,6 @@ func _sqlite3VdbeList(tls *libc.TLS, p uintptr) (r int32) { _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(6)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp5)) _sqlite3VdbeMemSetNull(tls, pMem+uintptr(7)*56) _sqlite3VdbeMemSetStr(tls, pMem+uintptr(5)*56, zP4, int64(-int32(1)), uint8(SQLITE_UTF8), __ccgo_fp(Xsqlite3_free)) - _ = libc.Int32FromInt32(0) } (*TVdbe)(unsafe.Pointer(p)).FpResultRow = pMem if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -63324,7 +61281,6 @@ type ReusableSpace = TReusableSpace // ** statement. // */ func _allocSpace(tls *libc.TLS, p uintptr, pBuf uintptr, nByte Tsqlite3_int64) (r uintptr) { - _ = libc.Int32FromInt32(0) if pBuf == uintptr(0) { nByte = nByte if nByte <= (*TReusableSpace)(unsafe.Pointer(p)).FnFree { @@ -63334,7 +61290,6 @@ func _allocSpace(tls *libc.TLS, p uintptr, pBuf uintptr, nByte Tsqlite3_int64) ( *(*Tsqlite3_int64)(unsafe.Pointer(p + 16)) += nByte } } - _ = libc.Int32FromInt32(0) return pBuf } @@ -63345,11 +61300,8 @@ func _allocSpace(tls *libc.TLS, p uintptr, pBuf uintptr, nByte Tsqlite3_int64) ( // ** running it. // */ func _sqlite3VdbeRewind(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* There should be at least one opcode. */ - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FeVdbeState = uint8(VDBE_READY_STATE) (*TVdbe)(unsafe.Pointer(p)).Fpc = -int32(1) (*TVdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK @@ -63389,15 +61341,9 @@ func _sqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { var _ /* nArg at bp+0 */ int32 var _ /* x at bp+8 */ TReusableSpace _, _, _, _, _, _ = db, n, nCursor, nMem, nVar, v1 /* Reusable bulk memory */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FpVList = (*TParse)(unsafe.Pointer(pParse)).FpVList (*TParse)(unsafe.Pointer(pParse)).FpVList = uintptr(0) db = (*TVdbe)(unsafe.Pointer(p)).Fdb - _ = libc.Int32FromInt32(0) nVar = int32((*TParse)(unsafe.Pointer(pParse)).FnVar) nMem = (*TParse)(unsafe.Pointer(pParse)).FnMem nCursor = (*TParse)(unsafe.Pointer(pParse)).FnTab @@ -63415,12 +61361,9 @@ func _sqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { ** opcode array. This extra memory will be reallocated for other elements ** of the prepared statement. */ - n = int32(libc.Uint64FromInt64(24) * uint64((*TVdbe)(unsafe.Pointer(p)).FnOp)) /* Bytes of opcode memory used */ - (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FpSpace = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(n) /* Unused opcode memory */ - _ = libc.Int32FromInt32(0) + n = int32(libc.Uint64FromInt64(24) * uint64((*TVdbe)(unsafe.Pointer(p)).FnOp)) /* Bytes of opcode memory used */ + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FpSpace = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(n) /* Unused opcode memory */ (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnFree = int64(((*TParse)(unsafe.Pointer(pParse)).FszOpAlloc - n) & ^libc.Int32FromInt32(7)) /* Bytes of unused memory */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _resolveP2Values(tls, p, bp) libc.SetBitFieldPtr16Uint32(p+200, uint32(libc.BoolUint8((*TParse)(unsafe.Pointer(pParse)).FisMultiWrite != 0 && (*TParse)(unsafe.Pointer(pParse)).FmayAbort != 0)), 5, 0x20) if (*TParse)(unsafe.Pointer(pParse)).Fexplain != 0 { @@ -63489,7 +61432,6 @@ func _freeCursorWithCache(tls *libc.TLS, p uintptr, pCx uintptr) { var pCache uintptr _ = pCache pCache = (*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr8Uint32(pCx+8, libc.Uint32FromInt32(0), 4, 0x10) (*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache = uintptr(0) if (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue != 0 { @@ -63511,12 +61453,10 @@ func _sqlite3VdbeFreeCursorNN(tls *libc.TLS, p uintptr, pCx uintptr) { case int32(CURTYPE_SORTER): _sqlite3VdbeSorterClose(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, pCx) case CURTYPE_BTREE: - _ = libc.Int32FromInt32(0) _sqlite3BtreeCloseCursor(tls, *(*uintptr)(unsafe.Pointer(pCx + 48))) case int32(CURTYPE_VTAB): pVCur = *(*uintptr)(unsafe.Pointer(pCx + 48)) pModule = (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FpModule - _ = libc.Int32FromInt32(0) (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FnRef-- (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxClose})))(tls, pVCur) break @@ -63544,6 +61484,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63596,13 +61537,13 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) (*TVdbe)(unsafe.Pointer(p)).FpFrame = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnFrame = 0 } - _ = libc.Int32FromInt32(0) _closeCursorsInFrame(tls, p) _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaMem, (*TVdbe)(unsafe.Pointer(p)).FnMem) for (*TVdbe)(unsafe.Pointer(p)).FpDelFrame != 0 { @@ -63614,7 +61555,6 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { if (*TVdbe)(unsafe.Pointer(p)).FpAuxData != 0 { _sqlite3VdbeDeleteAuxData(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, p+296, -int32(1), 0) } - _ = libc.Int32FromInt32(0) } // C documentation @@ -63662,16 +61602,11 @@ func _sqlite3VdbeSetColName(tls *libc.TLS, p uintptr, idx int32, var1 int32, zNa var pColName uintptr var rc int32 _, _ = pColName, rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { - _ = libc.Int32FromInt32(0) return int32(SQLITE_NOMEM) } - _ = libc.Int32FromInt32(0) pColName = (*TVdbe)(unsafe.Pointer(p)).FaColName + uintptr(idx+var1*int32((*TVdbe)(unsafe.Pointer(p)).FnResAlloc))*56 rc = _sqlite3VdbeMemSetStr(tls, pColName, zName, int64(-int32(1)), uint8(SQLITE_UTF8), xDel) - _ = libc.Int32FromInt32(0) return rc } @@ -63723,7 +61658,6 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { _sqlite3BtreeEnter(tls, pBt) pPager = _sqlite3BtreePager(tls, pBt) if int32((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).Fsafety_level) != int32(PAGER_SYNCHRONOUS_OFF) && _aMJNeeded[_sqlite3PagerGetJournalMode(tls, pPager)] != 0 && _sqlite3PagerIsMemdb(tls, pPager) == 0 { - _ = libc.Int32FromInt32(0) nTrans++ } rc = _sqlite3PagerExclusiveLock(tls, pPager) @@ -63731,6 +61665,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -63764,6 +61699,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -63782,6 +61718,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -63796,7 +61733,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5146, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5175, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -63804,21 +61741,20 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5158, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5187, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5172, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5201, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5187, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5216, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ - _ = libc.Int32FromInt32(0) rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) } if rc == SQLITE_OK { @@ -63846,7 +61782,6 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { if zFile == uintptr(0) { goto _4 /* Ignore TEMP and :memory: databases */ } - _ = libc.Int32FromInt32(0) rc = _sqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp)), zFile, _sqlite3Strlen30(tls, zFile)+int32(1), offset) offset += int64(_sqlite3Strlen30(tls, zFile) + int32(1)) if rc != SQLITE_OK { @@ -63858,6 +61793,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -63894,10 +61830,10 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) - _ = libc.Int32FromInt32(0) if rc != SQLITE_OK { _sqlite3DbFree(tls, db, zSuper-uintptr(4)) return rc @@ -63931,6 +61867,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -63977,9 +61914,6 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb rc = SQLITE_OK iSavepoint = (*TVdbe)(unsafe.Pointer(p)).FiStatement - int32(1) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -64000,6 +61934,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -64048,7 +61983,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)<>7)) != 0 { (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead-- } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).FeVdbeState = uint8(VDBE_HALT_STATE) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) @@ -64267,7 +62198,6 @@ func _sqlite3VdbeHalt(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { _sqlite3ConnectionUnlocked(tls, db) } - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).Frc == int32(SQLITE_BUSY) { v2 = int32(SQLITE_BUSY) } else { @@ -64379,12 +62309,8 @@ func _sqlite3VdbeFinalize(tls *libc.TLS, p uintptr) (r int32) { var rc int32 _ = rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) >= int32(VDBE_READY_STATE) { rc = _sqlite3VdbeReset(tls, p) - _ = libc.Int32FromInt32(0) } _sqlite3VdbeDelete(tls, p) return rc @@ -64438,8 +62364,6 @@ func _sqlite3VdbeDeleteAuxData(tls *libc.TLS, db uintptr, pp uintptr, iOp int32, func _sqlite3VdbeClearObject(tls *libc.TLS, db uintptr, p uintptr) { var pNext, pSub uintptr _, _ = pNext, pSub - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FaColName != 0 { _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName, int32((*TVdbe)(unsafe.Pointer(p)).FnResAlloc)*int32(COLNAME_N)) _sqlite3DbNNFreeNN(tls, db, (*TVdbe)(unsafe.Pointer(p)).FaColName) @@ -64454,6 +62378,7 @@ func _sqlite3VdbeClearObject(tls *libc.TLS, db uintptr, p uintptr) { _sqlite3DbFree(tls, db, pSub) goto _1 _1: + ; pSub = pNext } if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != VDBE_INIT_STATE { @@ -64479,13 +62404,9 @@ func _sqlite3VdbeClearObject(tls *libc.TLS, db uintptr, p uintptr) { func _sqlite3VdbeDelete(tls *libc.TLS, p uintptr) { var db uintptr _ = db - _ = libc.Int32FromInt32(0) db = (*TVdbe)(unsafe.Pointer(p)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeClearObject(tls, db, p) if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FppVPrev)) = (*TVdbe)(unsafe.Pointer(p)).FpVNext if (*TVdbe)(unsafe.Pointer(p)).FpVNext != 0 { (*TVdbe)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpVNext)).FppVPrev = (*TVdbe)(unsafe.Pointer(p)).FppVPrev @@ -64507,15 +62428,12 @@ func _sqlite3VdbeFinishMoveto(tls *libc.TLS, p uintptr) (r int32) { var rc int32 var _ /* res at bp+0 */ int32 _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(p + 48)), (*TVdbeCursor)(unsafe.Pointer(p)).FmovetoTarget, 0, bp) if rc != 0 { return rc } if *(*int32)(unsafe.Pointer(bp)) != 0 { - return _sqlite3CorruptError(tls, int32(88088)) + return _sqlite3CorruptError(tls, int32(88164)) } (*TVdbeCursor)(unsafe.Pointer(p)).FdeferredMoveto = uint8(0) (*TVdbeCursor)(unsafe.Pointer(p)).FcacheStatus = uint32(CACHE_STALE) @@ -64537,9 +62455,6 @@ func _sqlite3VdbeHandleMovedCursor(tls *libc.TLS, p uintptr) (r int32) { var rc int32 var _ /* isDifferentRow at bp+0 */ int32 _ = rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCursorRestore(tls, *(*uintptr)(unsafe.Pointer(p + 48)), bp) (*TVdbeCursor)(unsafe.Pointer(p)).FcacheStatus = uint32(CACHE_STALE) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -64555,7 +62470,6 @@ func _sqlite3VdbeHandleMovedCursor(tls *libc.TLS, p uintptr) (r int32) { // ** if need be. Return any I/O error from the restore operation. // */ func _sqlite3VdbeCursorRestore(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if _sqlite3BtreeCursorHasMoved(tls, *(*uintptr)(unsafe.Pointer(p + 48))) != 0 { return _sqlite3VdbeHandleMovedCursor(tls, p) } @@ -64742,14 +62656,12 @@ func _sqlite3VdbeSerialTypeLen(tls *libc.TLS, serial_type Tu32) (r Tu32) { if serial_type >= uint32(128) { return (serial_type - uint32(12)) / uint32(2) } else { - _ = libc.Int32FromInt32(0) return uint32(_sqlite3SmallTypeSizes[serial_type]) } return r } func _sqlite3VdbeOneByteSerialTypeLen(tls *libc.TLS, serial_type Tu8) (r Tu8) { - _ = libc.Int32FromInt32(0) return _sqlite3SmallTypeSizes[serial_type] } @@ -64821,7 +62733,6 @@ func _serialGet(tls *libc.TLS, buf uintptr, serial_type Tu32, pMem uintptr) { } else { /* EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit ** floating point number. */ - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pMem, bp, uint64(8)) if *(*Tu64)(unsafe.Pointer(bp))&(libc.Uint64FromInt32(0x7ff)< uint32(nKey) && u != 0 { - _ = libc.Int32FromInt32(0) /* In a corrupt record entry, the last pMem might have been set up using ** uninitialized memory. Overwrite its value with NULL, to prevent ** warnings from MSAN. */ _sqlite3VdbeMemSetNull(tls, pMem-uintptr(1)*56) } - _ = libc.Int32FromInt32(0) (*TUnpackedRecord)(unsafe.Pointer(p)).FnField = u } @@ -65064,6 +62990,7 @@ func _isAllZero(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -65085,8 +63012,6 @@ func _sqlite3BlobCompare(tls *libc.TLS, pB1 uintptr, pB2 uintptr) (r int32) { ** followed by zero content. But that only comes up for Blobs formed ** by the OP_MakeRecord opcode, and such Blobs never get passed into ** sqlite3MemCompare(). */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (int32((*TMem)(unsafe.Pointer(pB1)).Fflags)|int32((*TMem)(unsafe.Pointer(pB2)).Fflags))&int32(MEM_Zero) != 0 { if int32((*TMem)(unsafe.Pointer(pB1)).Fflags)&int32((*TMem)(unsafe.Pointer(pB2)).Fflags)&int32(MEM_Zero) != 0 { return *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB1)).Fu)) - *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB2)).Fu)) @@ -65189,7 +63114,6 @@ func _sqlite3MemCompare(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintp f1 = int32((*TMem)(unsafe.Pointer(pMem1)).Fflags) f2 = int32((*TMem)(unsafe.Pointer(pMem2)).Fflags) combined_flags = f1 | f2 - _ = libc.Int32FromInt32(0) /* If one value is NULL, it is less than the other. If both values ** are NULL, return 0. */ @@ -65253,13 +63177,10 @@ func _sqlite3MemCompare(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintp if f2&int32(MEM_Str) == 0 { return -int32(1) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The collation sequence must be defined at this point, even if ** the user deletes the collation sequence after the vdbe program is ** compiled (this was not always the case). */ - _ = libc.Int32FromInt32(0) if pColl != 0 { return _vdbeCompareMemString(tls, pMem1, pMem2, pColl, uintptr(0)) } @@ -65284,7 +63205,6 @@ func _vdbeRecordDecodeInt(tls *libc.TLS, serial_type Tu32, aKey uintptr) (r Ti64 defer tls.Free(16) var _ /* x at bp+8 */ Tu64 var _ /* y at bp+0 */ Tu32 - _ = libc.Int32FromInt32(0) switch serial_type { case uint32(0): fallthrough @@ -65372,14 +63292,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr i = 0 } if d1 > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for int32(1) != 0 { /* RHS is an integer */ if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { @@ -65396,7 +63312,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -65429,16 +63345,21 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -65461,7 +63382,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -65487,7 +63408,6 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Blob) != 0 { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) if *(*Tu32)(unsafe.Pointer(bp + 68)) >= uint32(0x80) { _sqlite3GetVarint32(tls, aKey1+uintptr(idx1), bp+68) @@ -65497,7 +63417,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -65522,7 +63442,10 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } } } } @@ -65534,8 +63457,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -rc } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* See comment below */ + /* See comment below */ return rc } i++ @@ -65549,18 +63471,16 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } /* No memory allocation is ever used on mem1. Prove this using ** the following assert(). If the assert() fails, it indicates a ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1). */ - _ = libc.Int32FromInt32(0) /* rc==0 here means that one or both of the keys ran out of fields and ** all the fields up to that point were equal. Return the default_rc ** value. */ - _ = libc.Int32FromInt32(0) (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = uint8(1) return int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) } @@ -65591,20 +63511,19 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin _, _, _, _, _ = aKey, lhs, res, serial_type, v aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) - _ = libc.Int32FromInt32(0) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< lhs { res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) @@ -65647,7 +63565,6 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin } } } - _ = libc.Int32FromInt32(0) return res } @@ -65667,18 +63584,15 @@ func _vdbeRecordCompareString(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 var _ /* serial_type at bp+0 */ int32 _, _, _, _, _, _ = aKey1, nCmp, nStr, res, szHdr, v1 aKey1 = pKey1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = int32(int8(*(*Tu8)(unsafe.Pointer(aKey1 + 1)))) vrcs_restart: + ; if *(*int32)(unsafe.Pointer(bp)) < int32(12) { if *(*int32)(unsafe.Pointer(bp)) < 0 { _sqlite3GetVarint32(tls, aKey1+1, bp) if *(*int32)(unsafe.Pointer(bp)) >= int32(12) { goto vrcs_restart } - _ = libc.Int32FromInt32(0) } res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) /* (pKey1/nKey1) is a number or a null */ } else { @@ -65688,7 +63602,7 @@ vrcs_restart: szHdr = int32(*(*Tu8)(unsafe.Pointer(aKey1))) nStr = (*(*int32)(unsafe.Pointer(bp)) - int32(12)) / int32(2) if szHdr+nStr > nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -65723,7 +63637,6 @@ vrcs_restart: } } } - _ = libc.Int32FromInt32(0) return res } @@ -65767,7 +63680,6 @@ func _sqlite3VdbeFindCompare(tls *libc.TLS, p uintptr) (r TRecordCompare) { return __ccgo_fp(_vdbeRecordCompareInt) } if flags&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Null)|libc.Int32FromInt32(MEM_Blob)) == 0 && *(*uintptr)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo + 32)) == uintptr(0) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(p + 16)) = (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem))).Fz (*TUnpackedRecord)(unsafe.Pointer(p)).Fn = (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem))).Fn return __ccgo_fp(_vdbeRecordCompareString) @@ -65803,9 +63715,7 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so ** this code can safely assume that nCellKey is 32-bits */ - _ = libc.Int32FromInt32(0) nCellKey = int64(_sqlite3BtreePayloadSize(tls, pCur)) - _ = libc.Int32FromInt32(0) /* Read in the complete content of the index entry */ _sqlite3VdbeMemInit(tls, bp+8, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp+8) @@ -65817,7 +63727,6 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr if *(*Tu32)(unsafe.Pointer(bp)) >= uint32(0x80) { _sqlite3GetVarint32(tls, (*(*TMem)(unsafe.Pointer(bp + 8))).Fz, bp) } - _ = libc.Int32FromInt32(0) if *(*Tu32)(unsafe.Pointer(bp)) < uint32(3) || *(*Tu32)(unsafe.Pointer(bp)) > uint32((*(*TMem)(unsafe.Pointer(bp + 8))).Fn) { goto idx_rowid_corruption } @@ -65842,8 +63751,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -65868,15 +63778,13 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked var _ /* m at bp+0 */ TMem _, _, _ = nCellKey, pCur, rc nCellKey = 0 - _ = libc.Int32FromInt32(0) pCur = *(*uintptr)(unsafe.Pointer(pC + 48)) - _ = libc.Int32FromInt32(0) nCellKey = int64(_sqlite3BtreePayloadSize(tls, pCur)) /* nCellKey will always be between 0 and 0xffffffff because of the way ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -65895,7 +63803,6 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked // ** sqlite3_changes() on the database handle 'db'. // */ func _sqlite3VdbeSetChanges(tls *libc.TLS, db uintptr, nChange Ti64) { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FnChange = nChange *(*Ti64)(unsafe.Pointer(db + 128)) += nChange } @@ -65941,6 +63848,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -65976,10 +63884,8 @@ func _sqlite3VdbePrepareFlags(tls *libc.TLS, v uintptr) (r Tu8) { func _sqlite3VdbeGetBoundValue(tls *libc.TLS, v uintptr, iVar int32, aff Tu8) (r uintptr) { var pMem, pRet uintptr _, _ = pMem, pRet - _ = libc.Int32FromInt32(0) if v != 0 { pMem = (*TVdbe)(unsafe.Pointer(v)).FaVar + uintptr(iVar-int32(1))*56 - _ = libc.Int32FromInt32(0) if 0 == int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) { pRet = _sqlite3ValueNew(tls, (*TVdbe)(unsafe.Pointer(v)).Fdb) if pRet != 0 { @@ -66000,8 +63906,6 @@ func _sqlite3VdbeGetBoundValue(tls *libc.TLS, v uintptr, iVar int32, aff Tu8) (r // ** in a better query plan. // */ func _sqlite3VdbeSetVarmask(tls *libc.TLS, v uintptr, iVar int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iVar >= int32(32) { *(*Tu32)(unsafe.Pointer(v + 284)) |= uint32(0x80000000) } else { @@ -66031,15 +63935,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5230 + zContext = __ccgo_ts + 5259 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5249 + zContext = __ccgo_ts + 5278 } else { - zContext = __ccgo_ts + 5268 + zContext = __ccgo_ts + 5297 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5277, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5306, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -66080,7 +63984,6 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { var i int32 var pMem uintptr _, _ = i, pMem - _ = libc.Int32FromInt32(0) if p != 0 { i = 0 for { @@ -66093,6 +63996,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -66117,7 +64021,6 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _, _, _, _, _ = db, i, iKey2, zTbl, v1 db = (*TVdbe)(unsafe.Pointer(v)).Fdb zTbl = (*TTable)(unsafe.Pointer(pTab)).FzName - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(136)) if libc.BoolInt32((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0)) == 0 { v1 = libc.Int64FromInt32(0) @@ -66131,9 +64034,6 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, iKey2 = iKey1 } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TPreUpdate)(unsafe.Pointer(bp))).Fv = v (*(*TPreUpdate)(unsafe.Pointer(bp))).FpCsr = pCsr (*(*TPreUpdate)(unsafe.Pointer(bp))).Fop = op @@ -66161,6 +64061,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -66216,7 +64117,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5313, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5342, 0) return int32(1) } else { return 0 @@ -66226,7 +64127,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5358, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5387, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -66245,10 +64146,6 @@ func _invokeProfileCallback(tls *libc.TLS, db uintptr, p uintptr) { defer tls.Free(16) var _ /* iElapse at bp+8 */ Tsqlite3_int64 var _ /* iNow at bp+0 */ Tsqlite3_int64 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3OsCurrentTimeInt64(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, bp) *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = (*(*Tsqlite3_int64)(unsafe.Pointer(bp)) - (*TVdbe)(unsafe.Pointer(p)).FstartTime) * int64(1000000) if (*Tsqlite3)(unsafe.Pointer(db)).FxProfile != 0 { @@ -66288,13 +64185,12 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { _invokeProfileCallback(tls, db, v) } - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeReset(tls, v) _sqlite3VdbeDelete(tls, v) rc = _sqlite3ApiExit(tls, db, rc) @@ -66328,7 +64224,6 @@ func Xsqlite3_reset(tls *libc.TLS, pStmt uintptr) (r int32) { } rc = _sqlite3VdbeReset(tls, v) _sqlite3VdbeRewind(tls, v) - _ = libc.Int32FromInt32(0) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } @@ -66357,9 +64252,9 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 0, 0x3) } @@ -66385,7 +64280,6 @@ func Xsqlite3_value_blob(tls *libc.TLS, pVal uintptr) (r uintptr) { v1 = 0 } if v1 != SQLITE_OK { - _ = libc.Int32FromInt32(0) return uintptr(0) } p2 = p + 20 @@ -66630,7 +64524,6 @@ func _setResultStrOrError(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, enc T } else { /* The only errors possible from sqlite3VdbeMemSetStr are ** SQLITE_TOOBIG and SQLITE_NOMEM */ - _ = libc.Int32FromInt32(0) Xsqlite3_result_error_nomem(tls, pCtx) } return @@ -66642,7 +64535,6 @@ func _setResultStrOrError(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, enc T } func _invokeValueDestructor(tls *libc.TLS, p uintptr, xDel uintptr, pCtx uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if xDel == uintptr(0) { /* noop */ } else { @@ -66652,20 +64544,15 @@ func _invokeValueDestructor(tls *libc.TLS, p uintptr, xDel uintptr, pCtx uintptr (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDel})))(tls, p) } } - _ = libc.Int32FromInt32(0) Xsqlite3_result_error_toobig(tls, pCtx) return int32(SQLITE_TOOBIG) } func Xsqlite3_result_blob(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _setResultStrOrError(tls, pCtx, z, n, uint8(0), xDel) } func Xsqlite3_result_blob64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_uint64, xDel uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if n > uint64(0x7fffffff) { _invokeValueDestructor(tls, z, xDel, pCtx) } else { @@ -66674,34 +64561,28 @@ func Xsqlite3_result_blob64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_u } func Xsqlite3_result_double(tls *libc.TLS, pCtx uintptr, rVal float64) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetDouble(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, rVal) } func Xsqlite3_result_error(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { - _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_ERROR) _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF8), uintptr(-libc.Int32FromInt32(1))) } func Xsqlite3_result_error16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { - _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_ERROR) _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF16LE), uintptr(-libc.Int32FromInt32(1))) } func Xsqlite3_result_int(tls *libc.TLS, pCtx uintptr, iVal int32) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetInt64(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, int64(iVal)) } func Xsqlite3_result_int64(tls *libc.TLS, pCtx uintptr, iVal Ti64) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetInt64(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, iVal) } func Xsqlite3_result_null(tls *libc.TLS, pCtx uintptr) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetNull(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut) } @@ -66709,7 +64590,6 @@ func Xsqlite3_result_pointer(tls *libc.TLS, pCtx uintptr, pPtr uintptr, zPType u var pOut uintptr _ = pOut pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemRelease(tls, pOut) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) _sqlite3VdbeMemSetPointer(tls, pOut, pPtr, zPType, xDestructor) @@ -66719,20 +64599,16 @@ func Xsqlite3_result_subtype(tls *libc.TLS, pCtx uintptr, eSubtype uint32) { var pOut, p1 uintptr _, _ = pOut, p1 pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pOut)).FeSubtype = uint8(eSubtype & uint32(0xff)) p1 = pOut + 20 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Subtype)) } func Xsqlite3_result_text(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { - _ = libc.Int32FromInt32(0) _setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF8), xDel) } func Xsqlite3_result_text64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_uint64, xDel uintptr, enc uint8) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(enc) != int32(SQLITE_UTF8) { if int32(enc) == int32(SQLITE_UTF16) { enc = uint8(SQLITE_UTF16LE) @@ -66748,17 +64624,14 @@ func Xsqlite3_result_text64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_u } func Xsqlite3_result_text16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { - _ = libc.Int32FromInt32(0) _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16LE), xDel) } func Xsqlite3_result_text16be(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { - _ = libc.Int32FromInt32(0) _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16BE), xDel) } func Xsqlite3_result_text16le(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { - _ = libc.Int32FromInt32(0) _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16LE), xDel) } @@ -66766,7 +64639,6 @@ func Xsqlite3_result_value(tls *libc.TLS, pCtx uintptr, pValue uintptr) { var pOut uintptr _ = pOut pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemCopy(tls, pOut, pValue) _sqlite3VdbeChangeEncoding(tls, pOut, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx)).Fenc)) if _sqlite3VdbeMemTooBig(tls, pOut) != 0 { @@ -66789,7 +64661,6 @@ func Xsqlite3_result_zeroblob64(tls *libc.TLS, pCtx uintptr, n Tu64) (r int32) { var pOut uintptr _ = pOut pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut - _ = libc.Int32FromInt32(0) if n > uint64(*(*int32)(unsafe.Pointer((*TMem)(unsafe.Pointer(pOut)).Fdb + 136))) { Xsqlite3_result_error_toobig(tls, pCtx) return int32(SQLITE_TOOBIG) @@ -66816,16 +64687,14 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { // // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { - _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5398, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5427, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation // // /* An SQLITE_NOMEM error. */ func Xsqlite3_result_error_nomem(tls *libc.TLS, pCtx uintptr) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemSetNull(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_NOMEM) _sqlite3OomFault(tls, (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fdb) @@ -66840,7 +64709,6 @@ func Xsqlite3_result_error_nomem(tls *libc.TLS, pCtx uintptr) { func _sqlite3ResultIntReal(tls *libc.TLS, pCtx uintptr) { var p1, p2 uintptr _, _ = p1, p2 - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fflags)&int32(MEM_Int) != 0 { p1 = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + 20 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(MEM_Int)) @@ -66876,6 +64744,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -66896,10 +64765,10 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { var db uintptr var rc int32 _, _ = db, rc - _ = libc.Int32FromInt32(0) db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -66921,11 +64790,9 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) } - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&(libc.Int32FromInt32(SQLITE_TRACE_PROFILE)|libc.Int32FromInt32(SQLITE_TRACE_XPROFILE)) != 0 && !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) && (*TVdbe)(unsafe.Pointer(p)).FzSql != 0 { _sqlite3OsCurrentTimeInt64(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, p+184) } else { - _ = libc.Int32FromInt32(0) } (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive++ if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) == 0 { @@ -66955,7 +64822,6 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { ** or SQLITE_BUSY error. */ Xsqlite3_reset(tls, p) - _ = libc.Int32FromInt32(0) goto restart_step } } @@ -66968,8 +64834,6 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec-- } if rc == int32(SQLITE_ROW) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_ROW) return int32(SQLITE_ROW) } else { @@ -66979,7 +64843,6 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } (*TVdbe)(unsafe.Pointer(p)).FpResultRow = uintptr(0) if rc == int32(SQLITE_DONE) && (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).Frc = _doWalCallbacks(tls, db) if (*TVdbe)(unsafe.Pointer(p)).Frc != SQLITE_OK { rc = int32(SQLITE_ERROR) @@ -67002,9 +64865,9 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ - _ = libc.Int32FromInt32(0) return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask } @@ -67024,7 +64887,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -67072,7 +64935,6 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { ** SQLITE_SCHEMA. tag-20220401a */ (*TVdbe)(unsafe.Pointer(v)).FminWriteFileFormat = uint8(254) } - _ = libc.Int32FromInt32(0) } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -67085,7 +64947,6 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { // ** pointer to it. // */ func Xsqlite3_user_data(tls *libc.TLS, p uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) return (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpFunc)).FpUserData } @@ -67102,7 +64963,6 @@ func Xsqlite3_user_data(tls *libc.TLS, p uintptr) (r uintptr) { // ** application defined function. // */ func Xsqlite3_context_db_handle(tls *libc.TLS, p uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) return (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpOut)).Fdb } @@ -67123,7 +64983,6 @@ func Xsqlite3_context_db_handle(tls *libc.TLS, p uintptr) (r uintptr) { // ** value, as a signal to the xUpdate routine that the column is unchanged. // */ func Xsqlite3_vtab_nochange(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return Xsqlite3_value_nochange(tls, (*Tsqlite3_context)(unsafe.Pointer(p)).FpOut) } @@ -67158,14 +65017,11 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pRhs = (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz } if bNext != 0 { @@ -67173,7 +65029,6 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 } else { *(*int32)(unsafe.Pointer(bp)) = 0 rc = _sqlite3BtreeFirst(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr, bp) - _ = libc.Int32FromInt32(0) if _sqlite3BtreeEof(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr) != 0 { rc = int32(SQLITE_DONE) } @@ -67267,7 +65122,6 @@ func _createAggContext(tls *libc.TLS, p uintptr, nByte int32) (r uintptr) { var pMem uintptr _ = pMem pMem = (*Tsqlite3_context)(unsafe.Pointer(p)).FpMem - _ = libc.Int32FromInt32(0) if nByte <= 0 { _sqlite3VdbeMemSetNull(tls, pMem) (*TMem)(unsafe.Pointer(pMem)).Fz = uintptr(0) @@ -67290,8 +65144,6 @@ func _createAggContext(tls *libc.TLS, p uintptr, nByte int32) (r uintptr) { // ** same context that was returned on prior calls. // */ func Xsqlite3_aggregate_context(tls *libc.TLS, p uintptr, nByte int32) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpMem)).Fflags)&int32(MEM_Agg) == 0 { return _createAggContext(tls, p, nByte) } else { @@ -67315,7 +65167,6 @@ func Xsqlite3_aggregate_context(tls *libc.TLS, p uintptr, nByte int32) (r uintpt func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { var pAuxData uintptr _ = pAuxData - _ = libc.Int32FromInt32(0) if (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { return uintptr(0) } @@ -67329,6 +65180,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -67351,7 +65203,6 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, var pAuxData, pVdbe uintptr _, _ = pAuxData, pVdbe pVdbe = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe - _ = libc.Int32FromInt32(0) if pVdbe == uintptr(0) { goto failed } @@ -67365,6 +65216,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -67388,6 +65240,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -67405,7 +65258,6 @@ failed: // ** context. // */ func Xsqlite3_aggregate_count(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpMem)).Fn } @@ -67477,7 +65329,6 @@ func _columnMem(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { if pVm == uintptr(0) { return _columnNullValue(tls) } - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pVm)).Fdb)).Fmutex) if (*TVdbe)(unsafe.Pointer(pVm)).FpResultRow != uintptr(0) && i < int32((*TVdbe)(unsafe.Pointer(pVm)).FnResColumn) && i >= 0 { pOut = (*TVdbe)(unsafe.Pointer(pVm)).FpResultRow + uintptr(i)*56 @@ -67518,8 +65369,6 @@ func _columnMallocFailure(tls *libc.TLS, pStmt uintptr) { */ p = pStmt if p != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbe)(unsafe.Pointer(p)).Frc = _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(p)).Frc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) } @@ -67627,18 +65476,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5421, - 1: __ccgo_ts + 5426, - 2: __ccgo_ts + 5433, - 3: __ccgo_ts + 5436, - 4: __ccgo_ts + 5439, - 5: __ccgo_ts + 5442, - 6: __ccgo_ts + 5445, - 7: __ccgo_ts + 5448, - 8: __ccgo_ts + 5456, - 9: __ccgo_ts + 5459, - 10: __ccgo_ts + 5466, - 11: __ccgo_ts + 5474, + 0: __ccgo_ts + 5450, + 1: __ccgo_ts + 5455, + 2: __ccgo_ts + 5462, + 3: __ccgo_ts + 5465, + 4: __ccgo_ts + 5468, + 5: __ccgo_ts + 5471, + 6: __ccgo_ts + 5474, + 7: __ccgo_ts + 5477, + 8: __ccgo_ts + 5485, + 9: __ccgo_ts + 5488, + 10: __ccgo_ts + 5495, + 11: __ccgo_ts + 5503, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -67733,7 +65582,6 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType ret = uintptr(0) p = pStmt db = (*TVdbe)(unsafe.Pointer(p)).Fdb - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) != 0 { if useType > 0 { @@ -67768,13 +65616,13 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType /* A malloc may have failed inside of the _text() call. If this ** is the case, clear the mallocFailed flag and return NULL. */ - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) > int32(prior_mallocFailed) { _sqlite3OomClear(tls, db) ret = uintptr(0) } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -67882,14 +65730,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5481, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5510, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -67909,7 +65757,6 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { ** as if there had been a schema change, on the first sqlite3_step() call ** following any change to the bindings of that parameter. */ - _ = libc.Int32FromInt32(0) if v2 = (*TVdbe)(unsafe.Pointer(p)).Fexpmask != uint32(0); v2 { if i >= uint32(31) { v1 = uint32(0x80000000) @@ -67965,7 +65812,6 @@ func Xsqlite3_bind_blob(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nD } func Xsqlite3_bind_blob64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Tsqlite3_uint64, xDel uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return _bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(0)) } @@ -68033,7 +65879,6 @@ func Xsqlite3_bind_text(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nD } func Xsqlite3_bind_text64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Tsqlite3_uint64, xDel uintptr, enc uint8) (r int32) { - _ = libc.Int32FromInt32(0) if int32(enc) != int32(SQLITE_UTF8) { if int32(enc) == int32(SQLITE_UTF16) { enc = uint8(SQLITE_UTF16LE) @@ -68055,7 +65900,6 @@ func Xsqlite3_bind_value(tls *libc.TLS, pStmt uintptr, i int32, pValue uintptr) case int32(SQLITE_INTEGER): rc = Xsqlite3_bind_int64(tls, pStmt, i, *(*Ti64)(unsafe.Pointer(pValue))) case int32(SQLITE_FLOAT): - _ = libc.Int32FromInt32(0) if int32((*Tsqlite3_value)(unsafe.Pointer(pValue)).Fflags)&int32(MEM_Real) != 0 { v1 = *(*float64)(unsafe.Pointer(pValue)) } else { @@ -68099,7 +65943,6 @@ func Xsqlite3_bind_zeroblob64(tls *libc.TLS, pStmt uintptr, i int32, n Tsqlite3_ if n > uint64(*(*int32)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb + 136))) { rc = int32(SQLITE_TOOBIG) } else { - _ = libc.Int32FromInt32(0) rc = Xsqlite3_bind_zeroblob(tls, pStmt, i, int32(n)) } rc = _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, rc) @@ -68173,8 +66016,6 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _, _, _ = i, pFrom, pTo pFrom = pFromStmt pTo = pToStmt - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) i = 0 for { @@ -68184,6 +66025,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -68212,11 +66054,9 @@ func Xsqlite3_transfer_bindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintpt if int32((*TVdbe)(unsafe.Pointer(pFrom)).FnVar) != int32((*TVdbe)(unsafe.Pointer(pTo)).FnVar) { return int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(pTo)).Fexpmask != 0 { libc.SetBitFieldPtr16Uint32(pTo+200, libc.Uint32FromInt32(1), 0, 0x3) } - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(pFrom)).Fexpmask != 0 { libc.SetBitFieldPtr16Uint32(pFrom+200, libc.Uint32FromInt32(1), 0, 0x3) } @@ -68371,7 +66211,6 @@ func Xsqlite3_stmt_status(tls *libc.TLS, pStmt uintptr, op int32, resetFlag int3 Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart _sqlite3VdbeDelete(tls, pVdbe) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -68462,7 +66301,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -68474,7 +66313,6 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } /* If the old.* record has not yet been loaded into memory, do so now. */ if (*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked == uintptr(0) { - _ = libc.Int32FromInt32(0) nRec = _sqlite3BtreePayloadSize(tls, *(*uintptr)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr + 48))) aRec = _sqlite3DbMallocRaw(tls, db, uint64(nRec)) if !(aRec != 0) { @@ -68510,6 +66348,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68591,7 +66430,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -68637,7 +66476,6 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp ** It is not safe to return a pointer to the memory cell itself as the ** caller may modify the value text encoding. */ - _ = libc.Int32FromInt32(0) if !((*TPreUpdate)(unsafe.Pointer(p)).FaNew != 0) { (*TPreUpdate)(unsafe.Pointer(p)).FaNew = _sqlite3DbMallocZero(tls, db, uint64(56)*uint64((*TVdbeCursor)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField)) if !((*TPreUpdate)(unsafe.Pointer(p)).FaNew != 0) { @@ -68645,7 +66483,6 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp goto preupdate_new_out } } - _ = libc.Int32FromInt32(0) pMem = (*TPreUpdate)(unsafe.Pointer(p)).FaNew + uintptr(iIdx)*56 if int32((*TMem)(unsafe.Pointer(pMem)).Fflags) == 0 { if iIdx == int32((*TTable)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey) { @@ -68660,6 +66497,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68704,7 +66542,6 @@ func _findNextHostParameter(tls *libc.TLS, zSql uintptr, pnToken uintptr) (r int *(*int32)(unsafe.Pointer(pnToken)) = 0 for *(*int8)(unsafe.Pointer(zSql)) != 0 { n = _sqlite3GetToken(tls, zSql, bp) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) == int32(TK_VARIABLE) { *(*int32)(unsafe.Pointer(pnToken)) = n break @@ -68766,8 +66603,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5521, int32(3)) - _ = libc.Int32FromInt32(0) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5550, int32(3)) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } } else { @@ -68776,24 +66612,19 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr } else { for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { n = _findNextHostParameter(tls, zRawSql, bp+4) - _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, bp+8, zRawSql, n) zRawSql += uintptr(n) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { break } if int32(*(*int8)(unsafe.Pointer(zRawSql))) == int32('?') { if *(*int32)(unsafe.Pointer(bp + 4)) > int32(1) { - _ = libc.Int32FromInt32(0) _sqlite3GetInt32(tls, zRawSql+1, bp) } else { *(*int32)(unsafe.Pointer(bp)) = nextIndex } } else { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3VdbeParameterIndex(tls, p, zRawSql, *(*int32)(unsafe.Pointer(bp + 4))) - _ = libc.Int32FromInt32(0) } zRawSql += uintptr(*(*int32)(unsafe.Pointer(bp + 4))) if *(*int32)(unsafe.Pointer(bp))+int32(1) > nextIndex { @@ -68802,16 +66633,15 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr v2 = nextIndex } nextIndex = v2 - _ = libc.Int32FromInt32(0) pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(*(*int32)(unsafe.Pointer(bp))-int32(1))*56 if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+1649, int32(4)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+1653, int32(4)) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1404, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1408, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5042, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5071, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -68826,28 +66656,28 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5525, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5554, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5532, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5561, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ - _ = libc.Int32FromInt32(0) - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5545, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5574, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5548, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5577, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5553, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5582, int32(1)) } } } @@ -69041,7 +66871,6 @@ func _allocateCursor(tls *libc.TLS, p uintptr, iCur int32, nField int32, eCurTyp v2 = 0 } nByte = int32(libc.Uint64FromInt64(128) + libc.Uint64FromInt32(2)*libc.Uint64FromInt64(4)*uint64(nField) + uint64(v2)) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) != 0 { /*OPTIMIZATION-IF-FALSE*/ _sqlite3VdbeFreeCursorNN(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) = uintptr(0) @@ -69050,9 +66879,6 @@ func _allocateCursor(tls *libc.TLS, p uintptr, iCur int32, nField int32, eCurTyp ** the pMem used to hold space for the cursor has enough storage available ** in pMem->zMalloc. But for the special case of the aMem[] entries used ** to hold cursors, it is faster to in-line the logic. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TMem)(unsafe.Pointer(pMem)).FszMalloc < nByte { if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 { _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) @@ -69125,7 +66951,6 @@ func _applyNumericAffinity(tls *libc.TLS, pRec uintptr, bTryForInt int32) { var _ /* rValue at bp+0 */ float64 _, _, _, _, _ = enc, rc, p1, p2, p3 enc = (*TMem)(unsafe.Pointer(pRec)).Fenc - _ = libc.Int32FromInt32(0) rc = _sqlite3AtoF(tls, (*TMem)(unsafe.Pointer(pRec)).Fz, bp, (*TMem)(unsafe.Pointer(pRec)).Fn, enc) if rc <= 0 { return @@ -69178,7 +67003,6 @@ func _applyAffinity(tls *libc.TLS, pRec uintptr, affinity int8, enc Tu8) { var p1 uintptr _ = p1 if int32(affinity) >= int32(SQLITE_AFF_NUMERIC) { - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) == 0 { /*OPTIMIZATION-IF-FALSE*/ if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Str) != 0 { @@ -69253,8 +67077,6 @@ func _computeNumericType(tls *libc.TLS, pMem uintptr) (r Tu16) { var rc, v1 int32 var _ /* ix at bp+0 */ Tsqlite3_int64 _, _ = rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Zero) != 0 { v1 = _sqlite3VdbeMemExpandBlob(tls, pMem) } else { @@ -69291,11 +67113,9 @@ func _computeNumericType(tls *libc.TLS, pMem uintptr) (r Tu16) { // ** But it does set pMem->u.r and pMem->u.i appropriately. // */ func _numericType(tls *libc.TLS, pMem uintptr) (r Tu16) { - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Null)) != 0 { return uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & (libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal) | libc.Int32FromInt32(MEM_Null))) } - _ = libc.Int32FromInt32(0) return _computeNumericType(tls, pMem) return uint16(0) } @@ -69315,8 +67135,6 @@ func _out2PrereleaseWithClear(tls *libc.TLS, pOut uintptr) (r uintptr) { func _out2Prerelease(tls *libc.TLS, p uintptr, pOp uintptr) (r uintptr) { var pOut uintptr _ = pOut - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TVdbeOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { /*OPTIMIZATION-IF-FALSE*/ return _out2PrereleaseWithClear(tls, pOut) @@ -69339,7 +67157,6 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { var p uintptr _, _, _, _ = h, i, mx, p h = uint64(0) - _ = libc.Int32FromInt32(0) i = (*TOp)(unsafe.Pointer(pOp)).Fp3 mx = i + (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi for { @@ -69363,6 +67180,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -69384,7 +67202,6 @@ func _vdbeColumnFromOverflow(tls *libc.TLS, pC uintptr, iCol int32, t int32, iOf db = (*TMem)(unsafe.Pointer(pDest)).Fdb encoding = int32((*TMem)(unsafe.Pointer(pDest)).Fenc) len1 = int32(_sqlite3VdbeSerialTypeLen(tls, uint32(t))) - _ = libc.Int32FromInt32(0) if len1 > *(*int32)(unsafe.Pointer(db + 136)) { return int32(SQLITE_TOOBIG) } @@ -69421,7 +67238,6 @@ func _vdbeColumnFromOverflow(tls *libc.TLS, pC uintptr, iCol int32, t int32, iOf } else { pBuf = (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue } - _ = libc.Int32FromInt32(0) _sqlite3RCStrRef(tls, pBuf) if t&int32(1) != 0 { rc = _sqlite3VdbeMemSetStr(tls, pDest, pBuf, int64(len1), uint8(encoding), __ccgo_fp(_sqlite3RCStrUnref)) @@ -69457,11 +67273,11 @@ func _vdbeMemTypeName(tls *libc.TLS, pMem uintptr) (r uintptr) { } var _azTypes = [5]uintptr{ - 0: __ccgo_ts + 1132, - 1: __ccgo_ts + 1144, - 2: __ccgo_ts + 1149, - 3: __ccgo_ts + 1127, - 4: __ccgo_ts + 1649, + 0: __ccgo_ts + 1136, + 1: __ccgo_ts + 1148, + 2: __ccgo_ts + 1153, + 3: __ccgo_ts + 1131, + 4: __ccgo_ts + 1653, } // C documentation @@ -69473,19 +67289,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity int8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -69532,7 +67348,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -69548,13 +67364,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut = uintptr(0) /* Output operand */ colCacheCtr = uint32(0) /* Column cache counter */ /*** INSERT STACK UNION HERE ***/ - _ = libc.Int32FromInt32(0) /* sqlite3_step() verifies this */ + /* sqlite3_step() verifies this */ if (*TVdbe)(unsafe.Pointer(p)).FlockMask != uint32(0) { _sqlite3VdbeEnter(tls, p) } if (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != 0 { iPrior = *(*Tu32)(unsafe.Pointer(p + 212 + 4*4)) - _ = libc.Int32FromInt32(0) nProgressLimit = uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps - iPrior%(*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) } else { nProgressLimit = libc.Uint64FromUint32(0xffffffff) | libc.Uint64FromUint32(0xffffffff)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { - _ = libc.Int32FromInt32(0) nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { nProgressLimit = libc.Uint64FromUint32(0xffffffff) | libc.Uint64FromUint32(0xffffffff)< int32(SQLITE_UTF8) { nByte &= int64(^libc.Int32FromInt32(1)) @@ -70717,11 +68512,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -70731,6 +68531,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70768,18 +68569,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70813,9 +68617,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -70834,7 +68641,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: - _ = libc.Int32FromInt32(0) + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) } @@ -70869,10 +68676,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -70890,10 +68701,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(bp + 8)) |= iB1 } else { if iB1 != 0 { - _ = libc.Int32FromInt32(0) /* If shifting by a negative amount, shift in the other direction */ if iB1 < 0 { - _ = libc.Int32FromInt32(0) op = uint8(libc.Int32FromInt32(2)*libc.Int32FromInt32(OP_ShiftLeft) + libc.Int32FromInt32(1) - int32(op)) if iB1 > int64(-libc.Int32FromInt32(64)) { v204 = -iB1 @@ -70936,7 +68745,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -70948,7 +68758,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) @@ -70972,7 +68783,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -70993,8 +68805,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ - _ = libc.Int32FromInt32(0) + _40: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) @@ -71102,12 +68914,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -71141,8 +68959,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Eq or OP_Ne) then take the jump or not depending on whether ** or not both operands are null. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(flags11)&int32(flags3)&int32(MEM_Null) != 0 && int32(flags3)&int32(MEM_Cleared) == 0 { res = 0 /* Operands are equal */ } else { @@ -71172,7 +68988,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_Str)) == int32(MEM_Str) { _applyNumericAffinity(tls, pIn1, 0) - _ = libc.Int32FromInt32(0) flags3 = (*TMem)(unsafe.Pointer(pIn3)).Fflags } if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_Str)) == int32(MEM_Str) { @@ -71181,20 +68996,29 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } - _ = libc.Int32FromInt32(0) res = _sqlite3MemCompare(tls, pIn3, pIn1, *(*uintptr)(unsafe.Pointer(pOp + 16))) } /* At this point, res is negative, zero, or positive if reg[P1] is @@ -71203,11 +69027,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** operator actually is. The next block of code depends on the fact ** that the 6 comparison operators are consecutive integers in this ** order: NE, EQ, GT, LE, LT, GE */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if res < 0 { res21 = int32(*(*uint8)(unsafe.Pointer(_sqlite3aLTb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode)))) } else { @@ -71219,9 +69038,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } iCompare = res /* Undo any changes made by applyAffinity() to the input registers. */ - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pIn3)).Fflags = flags3 - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pIn1)).Fflags = flags11 if res21 != 0 { goto jump_to_p2 @@ -71239,8 +69056,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ - _ = libc.Int32FromInt32(0) + _47: + ; /* same as TK_ESCAPE, jump */ if iCompare == 0 { goto jump_to_p2 } @@ -71257,10 +69074,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; goto _187 /* Opcode: Compare P1 P2 P3 P4 P5 ** Synopsis: r[P1@P3] <-> r[P2@P3] @@ -71284,20 +69098,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aPermute = *(*uintptr)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24 + 16)) + uintptr(1)*4 - _ = libc.Int32FromInt32(0) } n2 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p11 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p21 = (*TOp)(unsafe.Pointer(pOp)).Fp2 i = 0 @@ -71306,14 +69115,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + idx = v211 pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) @@ -71326,11 +69132,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } - _ = libc.Int32FromInt32(0) goto _187 /* Opcode: Jump P1 P2 P3 * * ** @@ -71340,9 +69146,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _50: + ; /* jump */ if iCompare < 0 { pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 } else { @@ -71373,8 +69178,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -71410,10 +69217,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _53: + ; /* in1, out2 */ _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) goto _187 /* Opcode: Not P1 P2 * * * @@ -71423,7 +69228,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -71439,7 +69245,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -71465,15 +69272,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ - _ = libc.Int32FromInt32(0) + _56: + ; /* Address of this instruction */ if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -71488,6 +69295,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -71500,6 +69308,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -71510,7 +69319,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -71548,12 +69358,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { serialType = *(*Tu32)(unsafe.Pointer(pC + 120 + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*4)) if serialType >= uint32(12) { @@ -71569,7 +69376,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { typeMask = uint16(int32(1) << ((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi - int32(1))) } } else { - _ = libc.Int32FromInt32(0) typeMask = uint16(int32(1) << (Xsqlite3_value_type(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) - int32(1))) } if int32(typeMask)&int32((*TOp)(unsafe.Pointer(pOp)).Fp5) != 0 { @@ -71583,7 +69389,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -71595,7 +69402,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -71612,7 +69420,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: - _ = libc.Int32FromInt32(0) + ; pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) @@ -71634,8 +69442,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ - _ = libc.Int32FromInt32(0) + _64: + ; /* The VDBE cursor */ pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { @@ -71676,30 +69484,22 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _65: + ; /* PseudoTable input register */ pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { if int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FeCurType) == int32(CURTYPE_PSEUDO) && (*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult > 0 { /* For the special case of as pseudo-cursor, the seekResult field ** identifies the register that holds the record */ pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -71709,12 +69509,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } else { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { - _ = libc.Int32FromInt32(0) - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -71732,18 +69531,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto op_column_restart } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = _sqlite3BtreePayloadSize(tls, pCrsr) (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = _sqlite3BtreePayloadFetch(tls, pCrsr, pC3+108) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Maximum page size is 64KiB */ + /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -71783,7 +69578,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** database file. */ zData = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow - _ = libc.Int32FromInt32(0) /* Conditional skipped */ + /* Conditional skipped */ goto op_column_read_header } } else { @@ -71799,13 +69594,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -71820,16 +69615,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -71838,8 +69634,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -71862,10 +69658,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -71879,22 +69677,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pDest)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { _sqlite3VdbeMemSetNull(tls, pDest) } - _ = libc.Int32FromInt32(0) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow >= *(*Tu32)(unsafe.Pointer(aOffset + uintptr(p22+uint32(1))*4)) { /* This is the common case where the desired content fits on the original ** page - where the content is not on an overflow page */ @@ -71902,9 +69698,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -71924,11 +69720,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding - _ = libc.Int32FromInt32(0) /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -71957,13 +69752,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -71993,10 +69790,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: - _ = libc.Int32FromInt32(0) + ; pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 i2 = 0 @@ -72006,14 +69801,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } - _ = libc.Int32FromInt32(0) _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { switch int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8)) & 0xf0 >> 4)) { @@ -72032,23 +69826,22 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_type_error } case int32(COLTYPE_REAL): - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { /* When applying REAL affinity, if the result is still an MEM_Int ** that will fit in 6 bytes, then change the type to MEM_IntReal ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -72061,14 +69854,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } - _ = libc.Int32FromInt32(0) goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5641, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5670, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -72142,7 +69932,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -72159,33 +69950,29 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) pData0 = aMem + uintptr(nField)*56 nField = (*TOp)(unsafe.Pointer(pOp)).Fp2 pLast = pData0 + uintptr(nField-int32(1))*56 /* Identify the output register */ - _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 /* Apply the requested affinity to all inputs */ - _ = libc.Int32FromInt32(0) if zAffinity1 != 0 { pRec = pData0 for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 - _ = libc.Int32FromInt32(0) } } /* Loop through the elements that will make up the record to figure @@ -72216,7 +70003,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ pRec = pLast for cond := true; cond; cond = int32(1) != 0 { - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Null) != 0 { if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Zero) != 0 { /* Values with MEM_Null and MEM_Zero are created by xColumn virtual @@ -72225,7 +70011,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Give such values a special internal-use-only serial-type of 10 ** so that they can be passed through to xUpdate and have ** a true sqlite3_value_nochange(). */ - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(10) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(0) @@ -72271,10 +70056,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -72290,8 +70075,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { nData += uint64(8) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) len11 = uint32((*TMem)(unsafe.Pointer(pRec)).Fn) serial_type = len11*uint32(2) + uint32(12) + libc.BoolUint32(int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&libc.Int32FromInt32(MEM_Str) != libc.Int32FromInt32(0)) if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Zero) != 0 { @@ -72355,20 +70138,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } - _ = libc.Int32FromInt32(0) pRec = pData0 for int32(1) != 0 { serial_type = (*TMem)(unsafe.Pointer(pRec)).FuTemp @@ -72377,20 +70159,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { if serial_type == uint32(7) { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, bp+88, pRec, uint64(8)) } else { *(*Tu64)(unsafe.Pointer(bp + 88)) = uint64(*(*Ti64)(unsafe.Pointer(pRec))) } len11 = uint32(_sqlite3SmallTypeSizes[serial_type]) - _ = libc.Int32FromInt32(0) switch len11 { default: *(*Tu8)(unsafe.Pointer(zPayload + 7)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) @@ -72423,18 +70203,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) } } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(serial_type))) if (*TMem)(unsafe.Pointer(pRec)).Fn != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) } @@ -72445,9 +70223,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } pRec += 56 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _187 /* Opcode: Count P1 P2 P3 * * ** Synopsis: r[P2]=count() @@ -72460,9 +70235,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: - _ = libc.Int32FromInt32(0) + ; pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) - _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) } else { @@ -72483,22 +70257,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open ** transaction, then there cannot be any savepoints. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if p12 == SAVEPOINT_BEGIN { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5682, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5711, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -72506,7 +70276,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** savepoint (and therefore should not prompt xSavepoint()) callbacks. ** If this is a transaction savepoint being opened, it is guaranteed ** that the db->aVTrans[] array is empty. */ - _ = libc.Int32FromInt32(0) rc = _sqlite3VtabSavepoint(tls, db, SAVEPOINT_BEGIN, (*Tsqlite3)(unsafe.Pointer(db)).FnStatement+(*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint) if rc != SQLITE_OK { goto abort_due_to_error @@ -72532,7 +70301,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } } else { - _ = libc.Int32FromInt32(0) iSavepoint = 0 /* Find the named savepoint. If there is no such savepoint, then an ** an error is returned to the user. */ @@ -72542,19 +70310,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5733, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5762, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5755, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5784, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -72563,18 +70332,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -72596,12 +70365,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { - _ = libc.Int32FromInt32(0) isSchemaChange = 0 } ii = 0 @@ -72613,8 +70382,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -72639,14 +70409,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** constraint violations present in the database to the value stored ** when the savepoint was created. */ if p12 == int32(SAVEPOINT_RELEASE) { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext _sqlite3DbFree(tls, db, pSavepoint) if !(isTransaction != 0) { (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint-- } } else { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FnDeferredCons (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FnDeferredImmCons } @@ -72677,15 +70445,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* At least this one VM is active */ - _ = libc.Int32FromInt32(0) + /* At least this one VM is active */ if desiredAutoCommit != int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) { if iRollback != 0 { - _ = libc.Int32FromInt32(0) _sqlite3RollbackAll(tls, db, libc.Int32FromInt32(SQLITE_ABORT)|libc.Int32FromInt32(2)<>5)) != 0 && (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1)) { - _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FiStatement == 0 { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FnStatement++ (*TVdbe)(unsafe.Pointer(p)).FiStatement = (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement } @@ -72821,7 +70578,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FnStmtDefImmCons = (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons } } - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && (*(*int32)(unsafe.Pointer(bp + 104)) != (*TOp)(unsafe.Pointer(pOp)).Fp3 || (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FiGeneration != (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) { /* ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema @@ -72829,7 +70585,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** SQL statement was prepared. */ _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+5996) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+6025) /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -72870,13 +70626,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** executing this instruction. */ _73: - _ = libc.Int32FromInt32(0) + ; iDb = (*TOp)(unsafe.Pointer(pOp)).Fp1 iCookie = (*TOp)(unsafe.Pointer(pOp)).Fp3 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeGetMeta(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt, iCookie, bp+108) pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64(*(*int32)(unsafe.Pointer(bp + 108))) @@ -72897,13 +70649,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the database schema version, resulting in a schema reset. */ _74: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pDb1 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* See note about index shifting on OP_ReadCookie */ rc = _sqlite3BtreeUpdateMeta(tls, (*TDb)(unsafe.Pointer(pDb1)).FpBt, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint32((*TOp)(unsafe.Pointer(pOp)).Fp3)) if (*TOp)(unsafe.Pointer(pOp)).Fp2 == int32(BTREE_SCHEMA_VERSION) { @@ -73012,22 +70759,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: OP_OpenRead, OP_ReopenIdx */ _77: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pCur = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur != 0 && (*TVdbeCursor)(unsafe.Pointer(pCur)).FpgnoRoot == uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) { - _ = libc.Int32FromInt32(0) /* Guaranteed by the code generator */ - _ = libc.Int32FromInt32(0) + /* Guaranteed by the code generator */ _sqlite3BtreeClearCursor(tls, *(*uintptr)(unsafe.Pointer(pCur + 48))) goto open_cursor_set_hints } /* If the cursor is not currently open or is open on a different ** index, then fall through into OP_OpenRead to force a reopen */ - _76: /* ncycle */ + _76: + ; /* ncycle */ _75: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) == int32(1) { rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)< 0 { /* Make register reg[P3] into a value that can be used as the data ** form sqlite3BtreeInsert() where the length of the data is zero. */ - _ = libc.Int32FromInt32(0) /* Only used when number of columns is zero */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* Only used when number of columns is zero */ (*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fn = 0 - (*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fz = __ccgo_ts + 1648 + (*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fz = __ccgo_ts + 1652 } pCx1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCx1 != 0 && !(int32(TBool(*(*uint8)(unsafe.Pointer(pCx1 + 8))&0x8>>3)) != 0) && (*TOp)(unsafe.Pointer(pOp)).Fp2 <= int32((*TVdbeCursor)(unsafe.Pointer(pCx1)).FnField) { /* If the ephemeral table is already open and has no duplicates from ** OP_OpenDup, then erase all existing content so that the table is ** empty again, rather than creating a new table. */ - _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pCx1)).FseqCount = 0 (*TVdbeCursor)(unsafe.Pointer(pCx1)).FcacheStatus = uint32(CACHE_STALE) rc = _sqlite3BtreeClearTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), int32((*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot), uintptr(0)) @@ -73203,17 +70927,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { - _ = libc.Int32FromInt32(0) + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) } (*TVdbeCursor)(unsafe.Pointer(pCx1)).FisTable = uint8(0) @@ -73245,15 +70965,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) if pCx2 == uintptr(0) { goto no_mem } (*TVdbeCursor)(unsafe.Pointer(pCx2)).FpKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterInit(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp3, pCx2) if rc != 0 { goto abort_due_to_error @@ -73267,13 +70984,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: - _ = libc.Int32FromInt32(0) + ; pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -73294,8 +71010,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) if pCx3 == uintptr(0) { goto no_mem @@ -73308,15 +71023,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto() ** which is a performance optimization */ *(*uintptr)(unsafe.Pointer(pCx3 + 48)) = _sqlite3BtreeFakeValidCursor(tls) - _ = libc.Int32FromInt32(0) goto _187 /* Opcode: Close P1 * * * * ** ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ - _ = libc.Int32FromInt32(0) + _84: + ; /* ncycle */ _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) goto _187 @@ -73410,20 +71124,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) eqOnly = 0 (*TVdbeCursor)(unsafe.Pointer(pC5)).FnullRow = uint8(0) @@ -73431,7 +71140,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC5)).FcacheStatus = uint32(CACHE_STALE) if (*TVdbeCursor)(unsafe.Pointer(pC5)).FisTable != 0 { /* The OPFLAG_SEEKEQ/BTREE_SEEK_EQ flag is only set on index cursors */ - _ = libc.Int32FromInt32(0) /* The input value in P3 might be of any type: integer, real, string, ** blob, or NULL. But it needs to be an integer before we can do ** the seek, so convert it. */ @@ -73466,17 +71174,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** (x <= 4.9) -> (x < 5) */ if c2 > 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if oc&int32(0x0001) == libc.Int32FromInt32(OP_SeekGT)&libc.Int32FromInt32(0x0001) { oc-- } } else { if c2 < 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if oc&int32(0x0001) == libc.Int32FromInt32(OP_SeekLT)&libc.Int32FromInt32(0x0001) { oc++ } @@ -73496,18 +71198,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ if _sqlite3BtreeCursorHasHint(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), uint32(BTREE_SEEK_EQ)) != 0 { eqOnly = int32(1) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } nField2 = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC5)).FpKeyInfo (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FnField = uint16(nField2) /* The next line of code computes as follows, only faster: @@ -73518,15 +71210,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) @@ -73534,12 +71222,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } if eqOnly != 0 && int32((*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen) == 0 { - _ = libc.Int32FromInt32(0) goto seek_not_found } } if oc >= int32(OP_SeekGE) { - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 112)) < 0 || *(*int32)(unsafe.Pointer(bp + 112)) == 0 && oc == int32(OP_SeekGT) { *(*int32)(unsafe.Pointer(bp + 112)) = 0 rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), 0) @@ -73555,7 +71241,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*int32)(unsafe.Pointer(bp + 112)) = 0 } } else { - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 112)) > 0 || *(*int32)(unsafe.Pointer(bp + 112)) == 0 && oc == int32(OP_SeekLT) { *(*int32)(unsafe.Pointer(bp + 112)) = 0 rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), 0) @@ -73575,12 +71260,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: - _ = libc.Int32FromInt32(0) + ; if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 } else { if eqOnly != 0 { - _ = libc.Int32FromInt32(0) pOp += 24 /* Skip the OP_IdxLt or OP_IdxGT that follows */ } } @@ -73654,49 +71338,46 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: - _ = libc.Int32FromInt32(0) + ; /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first ** opcode past the OP_SeekGE itself. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pC6 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(_sqlite3BtreeCursorIsValidNN(tls, *(*uintptr)(unsafe.Pointer(pC6 + 48))) != 0) { goto _187 } nStep = (*TOp)(unsafe.Pointer(pOp)).Fp1 - _ = libc.Int32FromInt32(0) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC6)).FpKeyInfo (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FnField = uint16(*(*int32)(unsafe.Pointer(pOp + 1*24 + 16))) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -73709,8 +71390,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -73727,10 +71409,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: - _ = libc.Int32FromInt32(0) + ; pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -73746,7 +71426,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: - _ = libc.Int32FromInt32(0) + ; pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { goto jump_to_p2_and_check_for_interrupt @@ -73843,23 +71523,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: - _ = libc.Int32FromInt32(0) + ; pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField) > 0 { /* Key values in an array of registers */ @@ -73868,15 +71544,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC9 + 48)), bp+208, pC9+36) } else { /* Composite key generated by OP_MakeRecord */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 - _ = libc.Int32FromInt32(0) + rc = v260 if rc != 0 { goto no_mem } @@ -73916,8 +71589,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -73974,6 +71648,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -73995,30 +71670,24 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { iKey1 = uint64(*(*Ti64)(unsafe.Pointer(bp + 256))) goto notExistsWithKey } - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 248)) = 0 rc = _sqlite3BtreeTableMoveto(tls, pCrsr2, int64(iKey1), 0, bp+248) - _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC10)).FmovetoTarget = int64(iKey1) /* Used by OP_Delete */ (*TVdbeCursor)(unsafe.Pointer(pC10)).FnullRow = uint8(0) (*TVdbeCursor)(unsafe.Pointer(pC10)).FcacheStatus = uint32(CACHE_STALE) (*TVdbeCursor)(unsafe.Pointer(pC10)).FdeferredMoveto = uint8(0) (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { - _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -74035,15 +71704,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _98: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -74060,16 +71727,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) - _ = libc.Int32FromInt32(0) pC11 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The next rowid or record number (different terms for the same ** thing) is obtained in a two-step algorithm. ** @@ -74083,7 +71746,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** succeeded. If the random rowid does exist, we select a new one ** and try again, up to 100 times. */ - _ = libc.Int32FromInt32(0) /* Some compilers complain about constants of the form 0x7fffffffffffffff. ** Others complain about 0x7ffffffffffffffffLL. The following macro seems ** to provide the constant while making all compilers happy. @@ -74096,7 +71758,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp + 320)) != 0 { *(*Ti64)(unsafe.Pointer(bp + 312)) = int64(1) /* IMP: R-61914-48074 */ } else { - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(bp + 312)) = _sqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48))) if *(*Ti64)(unsafe.Pointer(bp + 312)) >= int64(libc.Uint64FromInt32(0x7fffffff)<>1)) != 0 { rc = int32(SQLITE_FULL) /* IMP: R-17817-00630 */ goto abort_due_to_error @@ -74143,22 +71801,23 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** largest possible integer (9223372036854775807) then the database ** engine starts picking positive candidate ROWIDs at random until ** it finds one that is not previously used. */ - _ = libc.Int32FromInt32(0) /* We cannot be in random rowid mode if this is + /* We cannot be in random rowid mode if this is ** an AUTOINCREMENT table. */ cnt1 = 0 for { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -74169,7 +71828,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { rc = int32(SQLITE_FULL) /* IMP: R-38219-53002 */ goto abort_due_to_error } - _ = libc.Int32FromInt32(0) /* EV: R-40812-03570 */ + /* EV: R-40812-03570 */ } (*TVdbeCursor)(unsafe.Pointer(pC11)).FdeferredMoveto = uint8(0) (*TVdbeCursor)(unsafe.Pointer(pC11)).FcacheStatus = uint32(CACHE_STALE) @@ -74212,26 +71871,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey = *(*Ti64)(unsafe.Pointer(pKey)) if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) == -int32(5) && ((*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0) { - _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TVdbeCursor)(unsafe.Pointer(pC12)).FiDb)*32))).FzDbSName pTab1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) } else { pTab1 = uintptr(0) zDb = uintptr(0) @@ -74249,29 +71897,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISNOOP) != 0 { goto _187 } - _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_LASTROWID) != 0 { (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid = (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey } } - _ = libc.Int32FromInt32(0) (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = 0 } (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpKey = uintptr(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC12 + 48)), bp+328, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), seekResult) (*TVdbeCursor)(unsafe.Pointer(pC12)).FdeferredMoveto = uint8(0) (*TVdbeCursor)(unsafe.Pointer(pC12)).FcacheStatus = uint32(CACHE_STALE) @@ -74281,14 +71926,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } if pTab1 != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -74302,19 +71945,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _101: + ; /* Rowid value to insert with */ pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -74361,21 +72001,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 - _ = libc.Int32FromInt32(0) pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the update-hook or pre-update-hook will be invoked, set zDb to ** the name of the db to pass as to it. Also set local pTab to a copy ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set ** VdbeCursor.movetoTarget to the current rowid. */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) == -int32(5) && ((*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) zDb1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TVdbeCursor)(unsafe.Pointer(pC13)).FiDb)*32))).FzDbSName pTab2 = *(*uintptr)(unsafe.Pointer(pOp + 16)) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_SAVEPOSITION) != 0 && (*TVdbeCursor)(unsafe.Pointer(pC13)).FisTable != 0 { @@ -74386,23 +72020,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pTab2 = uintptr(0) } /* Invoke the pre-update-hook if required. */ - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { - _ = libc.Int32FromInt32(0) if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 } /* Only flags that can be set are SAVEPOISTION and AUXDELETE */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeDelete(tls, *(*uintptr)(unsafe.Pointer(pC13 + 48)), uint8((*TOp)(unsafe.Pointer(pOp)).Fp5)) (*TVdbeCursor)(unsafe.Pointer(pC13)).FcacheStatus = uint32(CACHE_STALE) colCacheCtr++ @@ -74415,7 +72044,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FnChange++ if (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0 && pTab2 != uintptr(0) && (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, int32(SQLITE_DELETE), zDb1, (*TTable)(unsafe.Pointer(pTab2)).FzName, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget) - _ = libc.Int32FromInt32(0) } } goto _187 @@ -74427,6 +72055,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -74446,9 +72075,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi *(*int32)(unsafe.Pointer(bp + 376)) = 0 @@ -74473,12 +72101,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if rc != 0 { goto abort_due_to_error } @@ -74513,14 +72139,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) - _ = libc.Int32FromInt32(0) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) /* The OP_RowData opcodes always follow OP_NotExists or ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions @@ -74530,8 +72151,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generator) then the fix would be to insert a call to ** sqlite3VdbeCursorMoveto(). */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) n3 = _sqlite3BtreePayloadSize(tls, pCrsr3) if n3 > uint32(*(*int32)(unsafe.Pointer(db + 136))) { goto too_big @@ -74557,11 +72176,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) - _ = libc.Int32FromInt32(0) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) goto _187 @@ -74570,18 +72187,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(bp + 384)) = (*TVdbeCursor)(unsafe.Pointer(pC17)).FmovetoTarget } else { if int32((*TVdbeCursor)(unsafe.Pointer(pC17)).FeCurType) == int32(CURTYPE_VTAB) { - _ = libc.Int32FromInt32(0) pVtab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC17 + 48)))).FpVtab pModule = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxRowid})))(tls, *(*uintptr)(unsafe.Pointer(pC17 + 48)), bp+384) _sqlite3VtabImportErrmsg(tls, p, pVtab) if rc != 0 { goto abort_due_to_error } } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeCursorRestore(tls, pC17) if rc != 0 { goto abort_due_to_error @@ -74606,7 +72219,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: - _ = libc.Int32FromInt32(0) + ; pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { /* If the cursor is not already open, create a special kind of @@ -74623,7 +72236,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbeCursor)(unsafe.Pointer(pC18)).FnullRow = uint8(1) (*TVdbeCursor)(unsafe.Pointer(pC18)).FcacheStatus = uint32(CACHE_STALE) if int32((*TVdbeCursor)(unsafe.Pointer(pC18)).FeCurType) == CURTYPE_BTREE { - _ = libc.Int32FromInt32(0) _sqlite3BtreeClearCursor(tls, *(*uintptr)(unsafe.Pointer(pC18 + 48))) } goto _187 @@ -74649,17 +72261,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: - _ = libc.Int32FromInt32(0) + ; pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) *(*int32)(unsafe.Pointer(bp + 392)) = 0 - _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_SeekEnd) { - _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC19)).FseekResult = -int32(1) if _sqlite3BtreeCursorIsValidNN(tls, pCrsr4) != 0 { goto _187 @@ -74684,11 +72293,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: - _ = libc.Int32FromInt32(0) + ; pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) if rc != 0 { goto abort_due_to_error @@ -74724,8 +72331,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Opcode: Rewind P1 P2 * * * ** @@ -74743,19 +72352,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { rc = _sqlite3VdbeSorterRewind(tls, pC21, bp+400) } else { - _ = libc.Int32FromInt32(0) pCrsr6 = *(*uintptr)(unsafe.Pointer(pC21 + 48)) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeFirst(tls, pCrsr6, bp+400) (*TVdbeCursor)(unsafe.Pointer(pC21)).FdeferredMoveto = uint8(0) (*TVdbeCursor)(unsafe.Pointer(pC21)).FcacheStatus = uint32(CACHE_STALE) @@ -74825,30 +72428,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _115: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + _116: + ; /* jump, ncycle */ pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -74890,23 +72484,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: - _ = libc.Int32FromInt32(0) + ; pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 - _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { (*TVdbe)(unsafe.Pointer(p)).FnChange++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -74915,12 +72504,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) - _ = libc.Int32FromInt32(0) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { goto abort_due_to_error @@ -74934,19 +72522,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: - _ = libc.Int32FromInt32(0) + ; pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -74971,14 +72555,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) - _ = libc.Int32FromInt32(0) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp3) (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).Fdefault_rc = 0 @@ -74994,11 +72573,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -75182,15 +72739,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { res10 = _sqlite3VdbeRecordCompareWithSkip(tls, (*(*TMem)(unsafe.Pointer(bp + 552))).Fn, (*(*TMem)(unsafe.Pointer(bp + 552))).Fz, bp+512, 0) _sqlite3VdbeMemReleaseMalloc(tls, bp+552) /* End of inlined sqlite3VdbeIdxKeyCompare() */ - _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode)&int32(1) == libc.Int32FromInt32(OP_IdxLT)&libc.Int32FromInt32(1) { - _ = libc.Int32FromInt32(0) res10 = -res10 } else { - _ = libc.Int32FromInt32(0) res10++ } - _ = libc.Int32FromInt32(0) if res10 > 0 { goto jump_to_p2 } @@ -75223,8 +72776,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { @@ -75233,7 +72785,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } else { iDb2 = (*TOp)(unsafe.Pointer(pOp)).Fp3 - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 608)) = 0 /* Not needed. Only to silence a warning. */ rc = _sqlite3BtreeDropTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb2)*32))).FpBt, (*TOp)(unsafe.Pointer(pOp)).Fp1, bp+608) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) @@ -75244,7 +72795,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp + 608)) != 0 { _sqlite3RootPageMoved(tls, db, iDb2, uint32(*(*int32)(unsafe.Pointer(bp + 608))), uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)) /* All OP_Destroy operations occur on the same btree */ - _ = libc.Int32FromInt32(0) resetSchemaOnFault = uint8(iDb2 + int32(1)) } } @@ -75267,14 +72817,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { *(*Ti64)(unsafe.Pointer(p + 56)) += *(*Ti64)(unsafe.Pointer(bp + 616)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) += *(*Ti64)(unsafe.Pointer(bp + 616)) } } @@ -75291,14 +72839,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: - _ = libc.Int32FromInt32(0) + ; pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeClearTableOfCursor(tls, *(*uintptr)(unsafe.Pointer(pC29 + 48))) if rc != 0 { goto abort_due_to_error @@ -75315,14 +72860,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCreateTable(tls, (*TDb)(unsafe.Pointer(pDb3)).FpBt, bp+624, (*TOp)(unsafe.Pointer(pOp)).Fp3) if rc != 0 { goto abort_due_to_error @@ -75336,6 +72877,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -75349,7 +72891,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = mTrace if *(*uintptr)(unsafe.Pointer(bp + 632)) != 0 || rc != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(bp + 632)))) + _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(bp + 632)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 632))) if rc == int32(SQLITE_NOMEM) { goto no_mem @@ -75367,13 +72909,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). */ iDb3 = (*TOp)(unsafe.Pointer(pOp)).Fp1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { _sqlite3SchemaClear(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpSchema) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_SchemaKnownOk)) @@ -75381,21 +72922,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6041 + zSchema = __ccgo_ts + 6070 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6055, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6084, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(1) (*(*TInitData)(unsafe.Pointer(bp + 640))).Frc = SQLITE_OK (*(*TInitData)(unsafe.Pointer(bp + 640))).FnInitRow = uint32(0) - _ = libc.Int32FromInt32(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+640, uintptr(0)) if rc == SQLITE_OK { rc = (*(*TInitData)(unsafe.Pointer(bp + 640))).Frc @@ -75404,7 +72943,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -75425,7 +72964,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: - _ = libc.Int32FromInt32(0) + ; rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { goto abort_due_to_error @@ -75440,6 +72979,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -75451,6 +72991,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -75462,6 +73003,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -75483,23 +73025,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ - _ = libc.Int32FromInt32(0) + _138: + ; /* Register keeping track of errors remaining */ nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeIntegrityCheck(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp5)*32))).FpBt, aRoot+1*4, nRoot, int32(*(*Ti64)(unsafe.Pointer(pnErr)))+int32(1), bp+680, bp+688) _sqlite3VdbeMemSetNull(tls, pIn1) if *(*int32)(unsafe.Pointer(bp + 680)) == 0 { - _ = libc.Int32FromInt32(0) } else { if rc != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 688))) @@ -75519,16 +73053,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { if _sqlite3VdbeMemSetRowSet(tls, pIn1) != 0 { goto no_mem } } - _ = libc.Int32FromInt32(0) _sqlite3RowSetInsert(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, *(*Ti64)(unsafe.Pointer(pIn2))) goto _187 /* Opcode: RowSetRead P1 P2 P3 * * @@ -75540,8 +73073,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { /* The boolean index is empty */ _sqlite3VdbeMemSetNull(tls, pIn1) @@ -75575,10 +73108,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi - _ = libc.Int32FromInt32(0) /* If there is anything other than a rowset object in memory cell P1, ** delete it now and initialize P1 with an empty rowset */ @@ -75587,9 +73120,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto no_mem } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iSet != 0 { exists = _sqlite3RowSetTest(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, iSet, *(*Ti64)(unsafe.Pointer(pIn3))) if exists != 0 { @@ -75615,10 +73145,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 - _ = libc.Int32FromInt32(0) /* If the p5 flag is clear, then recursive invocation of triggers is ** disabled for backwards compatibility (p5 is set if this sub-program ** is really a trigger, not a foreign key action, and the flag set @@ -75637,8 +73167,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -75647,7 +73178,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6098, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6127, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -75661,7 +73192,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** variable nMem (and later, VdbeFrame.nChildMem) to this value. */ nMem = (*TSubProgram)(unsafe.Pointer(pProgram)).FnMem + (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr - _ = libc.Int32FromInt32(0) if (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr == 0 { nMem++ } @@ -75694,38 +73224,34 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { pFrame2 = (*TMem)(unsafe.Pointer(pRt)).Fz - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } (*TVdbe)(unsafe.Pointer(p)).FnFrame++ (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent = (*TVdbe)(unsafe.Pointer(p)).FpFrame (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FlastRowid = (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChange = (*TVdbe)(unsafe.Pointer(p)).FnChange (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnDbChange = (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FnChange - _ = libc.Int32FromInt32(0) (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpAuxData = (*TVdbe)(unsafe.Pointer(p)).FpAuxData (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -75742,6 +73268,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -75756,6 +73283,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -75778,7 +73306,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -75801,21 +73330,22 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 } else { pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 } - _ = libc.Int32FromInt32(0) _sqlite3VdbeMemIntegerify(tls, pIn1) pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemIntegerify(tls, pIn2) @@ -75833,9 +73363,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) goto jump_to_p2 @@ -75860,20 +73390,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -75894,9 +73423,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { *(*Ti64)(unsafe.Pointer(pIn1))-- @@ -75910,9 +73439,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, Xsqlite3_value_text(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, Xsqlite3_value_text(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FisError } if (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FskipFlag != 0 { - _ = libc.Int32FromInt32(0) i4 = (*(*TOp)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24))).Fp1 if i4 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr(i4)*56, int64(1)) @@ -76035,8 +73558,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _187 /* Opcode: AggFinal P1 P2 * P4 * ** Synopsis: accum=r[P1] N=P2 @@ -76065,11 +73586,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the step function was not previously called. */ _155: + ; _154: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pMem3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { rc = _sqlite3VdbeMemAggValue(tls, pMem3, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56, *(*uintptr)(unsafe.Pointer(pOp + 16))) pMem3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -76077,7 +73597,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3VdbeMemFinalize(tls, pMem3, *(*uintptr)(unsafe.Pointer(pOp + 16))) } if rc != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, Xsqlite3_value_text(tls, pMem3))) + _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, Xsqlite3_value_text(tls, pMem3))) goto abort_due_to_error } _sqlite3VdbeChangeEncoding(tls, pMem3, int32(encoding)) @@ -76093,13 +73613,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** completes into mem[P3+2]. However on an error, mem[P3+1] and ** mem[P3+2] are initialized to -1. */ - _156: /* Write results here */ - _ = libc.Int32FromInt32(0) + _156: + ; /* Write results here */ (*(*[3]int32)(unsafe.Pointer(bp + 712)))[0] = 0 - v282 = -libc.Int32FromInt32(1) - (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(2)] = v282 - (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(1)] = v282 - _ = libc.Int32FromInt32(0) + v284 = -libc.Int32FromInt32(1) + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(2)] = v284 + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(1)] = v284 rc = _sqlite3Checkpoint(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, bp+712+1*4, bp+712+2*4) if rc != 0 { if rc != int32(SQLITE_BUSY) { @@ -76115,8 +73634,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } _sqlite3VdbeMemSetInt64(tls, pMem4, int64((*(*[3]int32)(unsafe.Pointer(bp + 712)))[i5])) - goto _283 - _283: + goto _285 + _285: + ; i5++ pMem4 += 56 } @@ -76132,19 +73652,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Write a string containing the final journal-mode to register P2. */ - _157: /* Name of database file for pPager */ + _157: + ; /* Name of database file for pPager */ pOut = _out2Prerelease(tls, p, pOp) eNew = (*TOp)(unsafe.Pointer(pOp)).Fp3 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pBt1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt pPager = _sqlite3BtreePager(tls, pBt1) eOld = _sqlite3PagerGetJournalMode(tls, pPager) if eNew == -int32(1) { eNew = eOld } - _ = libc.Int32FromInt32(0) if !(_sqlite3PagerOkToChangeJournalMode(tls, pPager) != 0) { eNew = eOld } @@ -76159,11 +73676,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6135 + v286 = __ccgo_ts + 6164 } else { - v284 = __ccgo_ts + 6140 + v286 = __ccgo_ts + 6169 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6147, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6176, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -76186,14 +73703,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Open a transaction on the database file. Regardless of the journal ** mode, this transaction always uses a rollback journal. */ - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -76220,13 +73736,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: - _ = libc.Int32FromInt32(0) + ; if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -76238,9 +73754,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt rc = _sqlite3BtreeIncrVacuum(tls, pBt2) if rc != 0 { @@ -76268,7 +73782,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: - _ = libc.Int32FromInt32(0) + ; if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -76281,10 +73795,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: - _ = libc.Int32FromInt32(0) + ; pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) goto _187 /* Opcode: CursorUnlock P1 * * * * @@ -76293,10 +73805,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: - _ = libc.Int32FromInt32(0) + ; pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) goto _187 /* Opcode: TableLock P1 P2 P3 P4 * @@ -76315,17 +73825,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, Xsqlite3_value_text(tls, pDest2))) + _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, Xsqlite3_value_text(tls, pDest2))) rc = (*(*Tsqlite3_context)(unsafe.Pointer(bp + 800))).FisError } _sqlite3VdbeChangeEncoding(tls, pDest2, int32(encoding)) @@ -76614,15 +74106,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the end of its result set, then fall through to the next instruction. */ _172: + ; pCur6 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbeCursor)(unsafe.Pointer(pCur6)).FnullRow != 0 { goto _187 } pVtab5 = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur6 + 48)))).FpVtab pModule5 = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab5)).FpModule - _ = libc.Int32FromInt32(0) /* Invoke the xNext() method of the module. There is no way for the ** underlying implementation to return an error if one occurs during ** xNext(). Instead, if an error occurs, true is returned (indicating that @@ -76647,14 +74137,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in register P1 is passed as the zName argument to the xRename method. */ _173: + ; isLegacy = int32((*Tsqlite3)(unsafe.Pointer(db)).Fflags & libc.Uint64FromInt32(SQLITE_LegacyAlter)) *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(SQLITE_LegacyAlter) pVtab6 = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab pName = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeChangeEncoding(tls, pName, int32(SQLITE_UTF8)) if rc != 0 { goto abort_due_to_error @@ -76697,9 +74184,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** apply in the case of a constraint failure on an insert or update. */ _174: + ; *(*Tsqlite_int64)(unsafe.Pointer(bp + 928)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto no_mem } @@ -76710,7 +74196,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } pModule6 = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab7)).FpModule nArg1 = (*TOp)(unsafe.Pointer(pOp)).Fp2 - _ = libc.Int32FromInt32(0) if (*Tsqlite3_module)(unsafe.Pointer(pModule6)).FxUpdate != 0 { vtabOnConflict = (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict apArg1 = (*TVdbe)(unsafe.Pointer(p)).FapArg @@ -76720,11 +74205,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(i7 < nArg1) { break } - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(apArg1 + uintptr(i7)*8)) = pX1 pX1 += 56 - goto _288 - _288: + goto _290 + _290: + ; i7++ } (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict = uint8((*TOp)(unsafe.Pointer(pOp)).Fp5) @@ -76732,7 +74217,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict = vtabOnConflict _sqlite3VtabImportErrmsg(tls, p, pVtab7) if rc == SQLITE_OK && (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid = *(*Tsqlite_int64)(unsafe.Pointer(bp + 928)) } if rc&int32(0xff) == int32(SQLITE_CONSTRAINT) && (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FbConstraint != 0 { @@ -76740,11 +74224,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { rc = SQLITE_OK } else { if int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == int32(OE_Replace) { - v289 = int32(OE_Abort) + v291 = int32(OE_Abort) } else { - v289 = int32((*TOp)(unsafe.Pointer(pOp)).Fp5) + v291 = int32((*TOp)(unsafe.Pointer(pOp)).Fp5) } - (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(v289) + (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(v291) } } else { (*TVdbe)(unsafe.Pointer(p)).FnChange++ @@ -76758,7 +74242,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Write the current number of pages in database P1 to memory cell P2. */ - _175: /* out2 */ + _175: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64(_sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt)) goto _187 @@ -76771,6 +74256,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the maximum page count after the change in register P2. */ _176: + ; pOut = _out2Prerelease(tls, p, pOp) pBt3 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt newMax = uint32(0) @@ -76828,9 +74314,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: AggStep, AggFinal, Function */ - _178: /* group */ + _178: + ; /* group */ _177: - _ = libc.Int32FromInt32(0) + ; pCtx2 = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* If this function is inside of a trigger, the register array in aMem[] ** might change from one evaluation to the next. The next block of code @@ -76847,19 +74334,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } *(*uintptr)(unsafe.Pointer(pCtx2 + 48 + uintptr(i8)*8)) = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2+i8)*56 - goto _290 - _290: + goto _292 + _292: + ; i8-- } } - _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Null)) - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FpFunc)).FxSFunc})))(tls, pCtx2, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx2)).Fargc), pCtx2+48) /* IMP: R-24505-23230 */ /* If the function returned an error, throw an exception */ if (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError != 0 { if (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, Xsqlite3_value_text(tls, pOut))) + _sqlite3VdbeError(tls, p, __ccgo_ts+3799, libc.VaList(bp+944, Xsqlite3_value_text(tls, pOut))) rc = (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError } _sqlite3VdbeDeleteAuxData(tls, db, p+296, (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FiOp, (*TOp)(unsafe.Pointer(pOp)).Fp1) @@ -76868,18 +74354,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _187 /* Opcode: ClrSubtype P1 * * * * ** Synopsis: r[P1].subtype = 0 ** ** Clear the subtype from register P1. */ - _179: /* in1 */ + _179: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - p291 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p291)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p291))) & ^libc.Int32FromInt32(MEM_Subtype)) + p293 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p293)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p293))) & ^libc.Int32FromInt32(MEM_Subtype)) goto _187 /* Opcode: GetSubtype P1 P2 * * * ** Synopsis: r[P2] = r[P1].subtype @@ -76887,7 +74372,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Extract the subtype value from register P1 and write that subtype ** into register P2. If P1 has no subtype, then P1 gets a NULL. */ - _180: /* in1 out2 */ + _180: + ; /* in1 out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Subtype) != 0 { @@ -76902,16 +74388,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Set the subtype value of register P2 to the integer from register P1. ** If P1 is NULL, clear the subtype from p2. */ - _181: /* in1 out2 */ + _181: + ; /* in1 out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { - p292 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p292)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p292))) & ^libc.Int32FromInt32(MEM_Subtype)) + p294 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p294)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p294))) & ^libc.Int32FromInt32(MEM_Subtype)) } else { - _ = libc.Int32FromInt32(0) - p293 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p293)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p293))) | libc.Int32FromInt32(MEM_Subtype)) + p295 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p295)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p295))) | libc.Int32FromInt32(MEM_Subtype)) (*TMem)(unsafe.Pointer(pOut)).FeSubtype = uint8(*(*Ti64)(unsafe.Pointer(pIn1)) & libc.Int64FromInt32(0xff)) } goto _187 @@ -76922,14 +74408,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** add that hash to the bloom filter contained in r[P1]. */ _182: - _ = libc.Int32FromInt32(0) + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) h = _filterHash(tls, aMem, pOp) h %= uint64((*TMem)(unsafe.Pointer(pIn1)).Fn * libc.Int32FromInt32(8)) - p294 = (*TMem)(unsafe.Pointer(pIn1)).Fz + uintptr(h/uint64(8)) - *(*int8)(unsafe.Pointer(p294)) = int8(int32(*(*int8)(unsafe.Pointer(p294))) | libc.Int32FromInt32(1)<<(h&libc.Uint64FromInt32(7))) + p296 = (*TMem)(unsafe.Pointer(pIn1)).Fz + uintptr(h/uint64(8)) + *(*int8)(unsafe.Pointer(p296)) = int8(int32(*(*int8)(unsafe.Pointer(p296))) | libc.Int32FromInt32(1)<<(h&libc.Uint64FromInt32(7))) goto _187 /* Opcode: Filter P1 P2 P3 P4 * ** Synopsis: if key(P3@P4) not in filter(P1) goto P2 @@ -76946,10 +74430,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** false positive - if the jump is taken when it should fall through. */ _183: - _ = libc.Int32FromInt32(0) + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) h1 = _filterHash(tls, aMem, pOp) h1 %= uint64((*TMem)(unsafe.Pointer(pIn1)).Fn * libc.Int32FromInt32(8)) if int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pIn1)).Fz + uintptr(h1/uint64(8)))))&(int32(1)<<(h1&uint64(7))) == 0 { @@ -76985,7 +74467,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** error is encountered. */ _185: + ; _184: + ; /* If the P4 argument is not NULL, then it must be an SQL comment string. ** The "--" string is broken up to prevent false-positives with srcck1.c. ** @@ -76995,26 +74479,24 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** using the X argument when X begins with "--" and invoking ** sqlite3_expanded_sql(P) otherwise. */ - _ = libc.Int32FromInt32(0) /* OP_Init is always instruction 0 */ - _ = libc.Int32FromInt32(0) - if v297 = int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&(libc.Int32FromInt32(SQLITE_TRACE_STMT)|libc.Int32FromInt32(SQLITE_TRACE_LEGACY)) != 0 && int32((*TVdbe)(unsafe.Pointer(p)).FminWriteFileFormat) != int32(254); v297 { + if v299 = int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&(libc.Int32FromInt32(SQLITE_TRACE_STMT)|libc.Int32FromInt32(SQLITE_TRACE_LEGACY)) != 0 && int32((*TVdbe)(unsafe.Pointer(p)).FminWriteFileFormat) != int32(254); v299 { if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - v296 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + v298 = *(*uintptr)(unsafe.Pointer(pOp + 16)) } else { - v296 = (*TVdbe)(unsafe.Pointer(p)).FzSql + v298 = (*TVdbe)(unsafe.Pointer(p)).FzSql } - v295 = v296 - zTrace = v295 + v297 = v298 + zTrace = v297 } - if v297 && v295 != uintptr(0) { + if v299 && v297 != uintptr(0) { if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_LEGACY) != 0 { z2 = _sqlite3VdbeExpandSql(tls, p, zTrace) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).Ftrace.FxLegacy})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, z2) Xsqlite3_free(tls, z2) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec > int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6267, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -77022,7 +74504,6 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } } - _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= _sqlite3Config.FiOnceResetThreshold { if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Trace) { goto _187 @@ -77035,8 +74516,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -77055,8 +74537,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ - _ = libc.Int32FromInt32(0) + _186: + ; /* This is really OP_Noop, OP_Explain */ goto _187 /***************************************************************************** ** The cases of the switch statement above this line should all be indented @@ -77065,6 +74547,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -77072,26 +74555,27 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -77121,37 +74606,38 @@ vdbe_return: if (*TVdbe)(unsafe.Pointer(p)).FlockMask != uint32(0) { _sqlite3VdbeLeave(tls, p) } - _ = libc.Int32FromInt32(0) return rc /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5398, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5427, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) - _sqlite3VdbeError(tls, p, __ccgo_ts+1618, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+1622, 0) rc = int32(SQLITE_NOMEM) goto abort_due_to_error /* Jump to here if the sqlite3_interrupt() API sets the interrupt ** flag. */ abort_due_to_interrupt: - _ = libc.Int32FromInt32(0) + ; rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error return r } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5555, - 1: __ccgo_ts + 5564, - 2: __ccgo_ts + 5571, - 3: __ccgo_ts + 5577, + 0: __ccgo_ts + 5584, + 1: __ccgo_ts + 5593, + 2: __ccgo_ts + 5600, + 3: __ccgo_ts + 5606, } var _and_logic = [9]uint8{ @@ -77288,15 +74774,12 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr ** counter is faster. */ if (*TVdbe)(unsafe.Pointer(v)).Fpc > int32(4) { (*TVdbe)(unsafe.Pointer(v)).Fpc = int32(4) - _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeExec(tls, v) } else { rc = Xsqlite3_step(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) } if rc == int32(SQLITE_ROW) { pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FapCsr)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) > int32((*TIncrblob)(unsafe.Pointer(p)).FiCol) { v1 = *(*Tu32)(unsafe.Pointer(pC + 120 + uintptr((*TIncrblob)(unsafe.Pointer(p)).FiCol)*4)) } else { @@ -77305,16 +74788,16 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr type1 = v1 if type1 < uint32(12) { if type1 == uint32(0) { - v2 = __ccgo_ts + 1634 + v2 = __ccgo_ts + 1638 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6276 + v3 = __ccgo_ts + 6305 } else { - v3 = __ccgo_ts + 6281 + v3 = __ccgo_ts + 6310 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6289, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6318, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -77332,15 +74815,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6318, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6347, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) } } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pzErr)) = zErr return rc } @@ -77377,15 +74858,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6338, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6367, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6368, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6397, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6404, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6433, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -77410,11 +74891,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6425, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6454, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77425,7 +74907,6 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, if wrFlag != 0 { zFault = uintptr(0) if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 { - _ = libc.Int32FromInt32(0) pFKey = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -77441,14 +74922,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6446 + zFault = __ccgo_ts + 6475 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -77464,37 +74947,36 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6458 + zFault = __ccgo_ts + 6487 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6466, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6495, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out } } (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt = _sqlite3VdbeCreate(tls, bp+8) - _ = libc.Int32FromInt32(0) if (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt != 0 { v = (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Transaction), iDb, wrFlag, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).Fschema_cookie, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).FiGeneration) _sqlite3VdbeChangeP5(tls, v, uint16(1)) - _ = libc.Int32FromInt32(0) aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_openBlob)), _iLn) /* Make sure a mutex is held on the table to be accessed */ _sqlite3VdbeUsesBtree(tls, v, iDb) if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { - _ = libc.Int32FromInt32(0) /* Configure the OP_TableLock instruction */ (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp1 = iDb (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp2 = int32((*TTable)(unsafe.Pointer(pTab)).Ftnum) @@ -77540,6 +75022,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -77549,7 +75032,7 @@ blob_open_out: _sqlite3DbFree(tls, db, pBlob) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - v7 = __ccgo_ts + 3795 + v7 = __ccgo_ts + 3799 } else { v7 = libc.UintptrFromInt32(0) } @@ -77639,7 +75122,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -77657,12 +75140,9 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is ** returned, clean-up the statement handle. */ - _ = libc.Int32FromInt32(0) _sqlite3BtreeEnterCursor(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) if xCall == __ccgo_fp(_sqlite3BtreePutData) && (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { iKey = _sqlite3BtreeIntegerKey(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbePreUpdateHook(tls, v, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FapCsr)), int32(SQLITE_DELETE), (*TIncrblob)(unsafe.Pointer(p)).FzDb, (*TIncrblob)(unsafe.Pointer(p)).FpTab, iKey, -int32(1), int32((*TIncrblob)(unsafe.Pointer(p)).FiCol)) } rc = (*(*func(*libc.TLS, uintptr, Tu32, Tu32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xCall})))(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr, uint32(iOffset+(*TIncrblob)(unsafe.Pointer(p)).FiOffset), uint32(n), z) @@ -77741,7 +75221,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -77755,17 +75235,15 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r rc = _blobSeekToRow(tls, p, iRow, bp) if rc != SQLITE_OK { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - v1 = __ccgo_ts + 3795 + v1 = __ccgo_ts + 3799 } else { v1 = libc.UintptrFromInt32(0) } _sqlite3ErrorWithMsg(tls, db, rc, v1, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) } - _ = libc.Int32FromInt32(0) } rc = _sqlite3ApiExit(tls, db, rc) - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } @@ -78367,7 +75845,6 @@ func _vdbePmaReadBlob(tls *libc.TLS, p uintptr, nByte int32, ppOut uintptr) (r i *(*Ti64)(unsafe.Pointer(p)) += int64(nByte) return SQLITE_OK } - _ = libc.Int32FromInt32(0) /* If there is no more data to be read from the buffer, read the next ** p->nBuffer bytes of data from the file into it. Or, if there are less ** than p->nBuffer bytes remaining in the PMA, read all remaining data. */ @@ -78379,10 +75856,8 @@ func _vdbePmaReadBlob(tls *libc.TLS, p uintptr, nByte int32, ppOut uintptr) (r i } else { nRead = int32((*TPmaReader)(unsafe.Pointer(p)).FiEof - (*TPmaReader)(unsafe.Pointer(p)).FiReadOff) } - _ = libc.Int32FromInt32(0) /* Readr data from the file. Return early if an error occurs. */ rc = _sqlite3OsRead(tls, (*TPmaReader)(unsafe.Pointer(p)).FpFd, (*TPmaReader)(unsafe.Pointer(p)).FaBuffer, nRead, (*TPmaReader)(unsafe.Pointer(p)).FiReadOff) - _ = libc.Int32FromInt32(0) if rc != SQLITE_OK { return rc } @@ -78429,7 +75904,6 @@ func _vdbePmaReadBlob(tls *libc.TLS, p uintptr, nByte int32, ppOut uintptr) (r i if rc1 != SQLITE_OK { return rc1 } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TPmaReader)(unsafe.Pointer(p)).FaAlloc+uintptr(nByte-nRem), *(*uintptr)(unsafe.Pointer(bp)), uint64(nCopy)) nRem -= nCopy } @@ -78510,7 +75984,6 @@ func _vdbePmaReaderSeek(tls *libc.TLS, pTask uintptr, pReadr uintptr, pFile uint var iBuf, nRead, pgsz, rc int32 _, _, _, _ = iBuf, nRead, pgsz, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if _sqlite3FaultSim(tls, int32(201)) != 0 { return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(1)< 0 { if int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0 { res = -int32(1) @@ -78788,7 +76254,6 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } } else { if *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FaSortFlags)) != 0 { - _ = libc.Int32FromInt32(0) res = res * -int32(1) } } @@ -78842,9 +76307,6 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt } /* Do not allow the total number of threads (main thread + all workers) ** to exceed the maximum merge count */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) szKeyInfo = int32(uint64(40) + uint64(int32((*TKeyInfo)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo)).FnKeyField)-libc.Int32FromInt32(1))*uint64(8)) sz = int32(uint64(192) + uint64(nWorker)*uint64(96)) pSorter = _sqlite3DbMallocZero(tls, db, uint64(sz+szKeyInfo)) @@ -78879,6 +76341,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -78907,7 +76370,6 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt /* Avoid large memory allocations if the application has requested ** SQLITE_CONFIG_SMALL_MALLOC. */ if int32(_sqlite3Config.FbSmallMalloc) == 0 { - _ = libc.Int32FromInt32(0) (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = pgsz (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = _sqlite3Malloc(tls, uint64(pgsz)) if !((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0) { @@ -78939,6 +76401,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -78956,7 +76419,6 @@ func _vdbeSortSubtaskCleanup(tls *libc.TLS, db uintptr, pTask uintptr) { if (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory != 0 { Xsqlite3_free(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory) } else { - _ = libc.Int32FromInt32(0) _vdbeSorterRecordFree(tls, uintptr(0), (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FpList) } if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd != 0 { @@ -78984,7 +76446,6 @@ func _vdbeSorterJoinThread(tls *libc.TLS, pTask uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(int64(libc.Int32FromInt32(SQLITE_ERROR))) _sqlite3ThreadJoin(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread, bp) rc = int32(int64(*(*uintptr)(unsafe.Pointer(bp)))) - _ = libc.Int32FromInt32(0) (*TSortSubtask)(unsafe.Pointer(pTask)).FbDone = 0 (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread = uintptr(0) } @@ -78997,7 +76458,6 @@ func _vdbeSorterJoinThread(tls *libc.TLS, pTask uintptr) (r int32) { // ** Launch a background thread to run xTask(pIn). // */ func _vdbeSorterCreateThread(tls *libc.TLS, pTask uintptr, xTask uintptr, pIn uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return _sqlite3ThreadCreate(tls, pTask, xTask, pIn) } @@ -79031,6 +76491,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -79050,7 +76511,6 @@ func _vdbeMergeEngineNew(tls *libc.TLS, nReader int32) (r uintptr) { var pNew, v1 uintptr _, _, _, _ = N, nByte, pNew, v1 N = int32(2) /* Pointer to allocated object to return */ - _ = libc.Int32FromInt32(0) for N < nReader { N += N } @@ -79087,6 +76547,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -79125,7 +76586,6 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { var pTask uintptr _, _ = i, pTask _vdbeSorterJoinAll(tls, pSorter, SQLITE_OK) - _ = libc.Int32FromInt32(0) if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader != 0 { _vdbePmaReaderClear(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) _sqlite3DbFree(tls, db, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) @@ -79143,6 +76603,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -79165,7 +76626,6 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { func _sqlite3VdbeSorterClose(tls *libc.TLS, db uintptr, pCsr uintptr) { var pSorter uintptr _ = pSorter - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) if pSorter != 0 { _sqlite3VdbeSorterReset(tls, db, pSorter) @@ -79265,7 +76725,6 @@ func _vdbeSorterMerge(tls *libc.TLS, pTask uintptr, p1 uintptr, p2 uintptr) (r u *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) pp = bp *(*int32)(unsafe.Pointer(bp + 8)) = 0 - _ = libc.Int32FromInt32(0) for { res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare})))(tls, pTask, bp+8, p1+libc.UintptrFromInt32(1)*16, (*TSorterRecord)(unsafe.Pointer(p1)).FnVal, p2+libc.UintptrFromInt32(1)*16, (*TSorterRecord)(unsafe.Pointer(p2)).FnVal) if res <= 0 { @@ -79335,7 +76794,6 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { if p == (*TSorterList)(unsafe.Pointer(pList)).FaMemory { pNext = uintptr(0) } else { - _ = libc.Int32FromInt32(0) pNext = (*TSorterList)(unsafe.Pointer(pList)).FaMemory + uintptr(*(*int32)(unsafe.Pointer(&(*TSorterRecord)(unsafe.Pointer(p)).Fu))) } } else { @@ -79351,6 +76809,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -79373,10 +76832,10 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p - _ = libc.Int32FromInt32(0) return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) } @@ -79426,7 +76885,6 @@ func _vdbePmaWriteBlob(tls *libc.TLS, p uintptr, pData uintptr, nData int32) { (*TPmaWriter)(unsafe.Pointer(p)).FiBufStart = v1 *(*Ti64)(unsafe.Pointer(p + 32)) += int64((*TPmaWriter)(unsafe.Pointer(p)).FnBuffer) } - _ = libc.Int32FromInt32(0) nRem -= nCopy } } @@ -79497,13 +76955,9 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) db = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb rc = SQLITE_OK /* Object used to write to the file */ libc.Xmemset(tls, bp, 0, uint64(48)) - _ = libc.Int32FromInt32(0) /* If the first temporary PMA file has not been opened, open it now. */ if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd == uintptr(0) { rc = _vdbeSorterOpenTempFile(tls, db, 0, pTask+64) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } /* Try to get the file to memory map */ if rc == SQLITE_OK { @@ -79531,13 +76985,12 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p rc = _vdbePmaWriterFinish(tls, bp, pTask+64+8) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return rc } @@ -79610,6 +77063,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -79632,7 +77086,6 @@ func _vdbeSorterFlushThread(tls *libc.TLS, pCtx uintptr) (r uintptr) { var rc int32 _, _ = pTask, rc pTask = pCtx /* Return code */ - _ = libc.Int32FromInt32(0) rc = _vdbeSorterListToPMA(tls, pTask, pTask+32) (*TSortSubtask)(unsafe.Pointer(pTask)).FbDone = int32(1) return uintptr(int64(rc)) @@ -79677,6 +77130,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -79684,10 +77138,6 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { /* Use the foreground thread for this operation */ rc = _vdbeSorterListToPMA(tls, pSorter+96+uintptr(nWorker)*96, pSorter+56) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aMem = (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory pCtx = pTask (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiPrev = uint8((int64(pTask) - t__predefined_ptrdiff_t(pSorter+96)) / 96) @@ -79726,7 +77176,6 @@ func _sqlite3VdbeSorterWrite(tls *libc.TLS, pCsr uintptr, pVal uintptr) (r int32 var _ /* t at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _ = aNew, bFlush, iListOff, nMin, nNew, nPMA, nReq, pNew, pSorter, rc, p1, p2, p3 rc = SQLITE_OK /* serial type of first record field */ - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) *(*int32)(unsafe.Pointer(bp)) = int32(uint32(*(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVal)).Fz + 1)))) if *(*int32)(unsafe.Pointer(bp)) >= int32(0x80) { @@ -79743,7 +77192,6 @@ func _sqlite3VdbeSorterWrite(tls *libc.TLS, pCsr uintptr, pVal uintptr) (r int32 (*TVdbeSorter)(unsafe.Pointer(pSorter)).FtypeMask = uint8(0) } } - _ = libc.Int32FromInt32(0) /* Figure out whether or not the current contents of memory should be ** flushed to a PMA before continuing. If so, do so. ** @@ -79772,7 +77220,6 @@ func _sqlite3VdbeSorterWrite(tls *libc.TLS, pCsr uintptr, pVal uintptr) (r int32 rc = _vdbeSorterFlushPMA(tls, pSorter) (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory = 0 - _ = libc.Int32FromInt32(0) } } (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA += nPMA @@ -79846,7 +77293,6 @@ func _vdbeIncrPopulate(tls *libc.TLS, pIncr uintptr) (r int32) { pOut = pIncr + 40 + 1*16 pTask = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask pMerger = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger - _ = libc.Int32FromInt32(0) _vdbePmaWriterInit(tls, (*TSorterFile)(unsafe.Pointer(pOut)).FpFd, bp, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz, iStart) for rc == SQLITE_OK { pReader = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80 @@ -79863,7 +77309,6 @@ func _vdbeIncrPopulate(tls *libc.TLS, pIncr uintptr) (r int32) { /* Write the next key to the output. */ _vdbePmaWriteVarint(tls, bp, uint64(nKey)) _vdbePmaWriteBlob(tls, bp, (*TPmaReader)(unsafe.Pointer(pReader)).FaKey, nKey) - _ = libc.Int32FromInt32(0) rc = _vdbeMergeEngineStep(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger, bp+48) } rc2 = _vdbePmaWriterFinish(tls, bp, pOut+8) @@ -79897,7 +77342,6 @@ func _vdbeIncrBgPopulate(tls *libc.TLS, pIncr uintptr) (r int32) { var p uintptr _ = p p = pIncr - _ = libc.Int32FromInt32(0) return _vdbeSorterCreateThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask, __ccgo_fp(_vdbeIncrPopulateThread), p) } @@ -79984,7 +77428,6 @@ func _vdbeIncrMergerNew(tls *libc.TLS, pTask uintptr, pMerger uintptr, ppOut uin _vdbeMergeEngineFree(tls, pMerger) rc = int32(SQLITE_NOMEM) } - _ = libc.Int32FromInt32(0) return rc } @@ -80012,7 +77455,6 @@ func _vdbeMergeEngineCompare(tls *libc.TLS, pMerger uintptr, iOut int32) { var p1, p2, pTask uintptr var _ /* bCached at bp+0 */ int32 _, _, _, _, _, _, _ = i1, i2, iRes, p1, p2, pTask, res - _ = libc.Int32FromInt32(0) if iOut >= (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree/int32(2) { i1 = (iOut - (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree/int32(2)) * int32(2) i2 = i1 + int32(1) @@ -80030,7 +77472,7 @@ func _vdbeMergeEngineCompare(tls *libc.TLS, pMerger uintptr, iOut int32) { } else { pTask = (*TMergeEngine)(unsafe.Pointer(pMerger)).FpTask *(*int32)(unsafe.Pointer(bp)) = 0 - _ = libc.Int32FromInt32(0) /* from vdbeSortSubtaskMain() */ + /* from vdbeSortSubtaskMain() */ res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare})))(tls, pTask, bp, (*TPmaReader)(unsafe.Pointer(p1)).FaKey, (*TPmaReader)(unsafe.Pointer(p1)).FnKey, (*TPmaReader)(unsafe.Pointer(p2)).FaKey, (*TPmaReader)(unsafe.Pointer(p2)).FnKey) if res <= 0 { iRes = i1 @@ -80068,11 +77510,8 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i rc = SQLITE_OK /* Number of subtrees to merge */ /* Failure to allocate the merge would have been detected prior to ** invoking this routine */ - _ = libc.Int32FromInt32(0) /* eMode is always INCRINIT_NORMAL in single-threaded mode */ - _ = libc.Int32FromInt32(0) /* Verify that the MergeEngine is assigned to a single thread */ - _ = libc.Int32FromInt32(0) (*TMergeEngine)(unsafe.Pointer(pMerger)).FpTask = pTask nTree = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree i = 0 @@ -80097,6 +77536,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -80107,6 +77547,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -80156,7 +77597,6 @@ func _vdbePmaReaderIncrMergeInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r pTask = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask db = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb /* eMode is always INCRINIT_NORMAL in single-threaded mode */ - _ = libc.Int32FromInt32(0) rc = _vdbeMergeEngineInit(tls, pTask, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger, eMode) /* Set up the required files for pIncr. A multi-threaded IncrMerge object ** requires two temp files to itself, whereas a single-threaded object @@ -80171,7 +77611,6 @@ func _vdbePmaReaderIncrMergeInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r } else { /*if( !pIncr->bUseThread )*/ if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd == uintptr(0) { - _ = libc.Int32FromInt32(0) rc = _vdbeSorterOpenTempFile(tls, db, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof, pTask+80) (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof = 0 } @@ -80193,7 +77632,6 @@ func _vdbePmaReaderIncrMergeInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r ** control to the VDBE or proceed with anything useful until the ** first results are ready from this merger object anyway. */ - _ = libc.Int32FromInt32(0) rc = _vdbeIncrPopulate(tls, pIncr) } if rc == SQLITE_OK && (libc.Bool(false) || eMode != int32(INCRINIT_TASK)) { @@ -80237,7 +77675,6 @@ func _vdbePmaReaderIncrInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r int32 pIncr = (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr /* Incremental merger */ rc = SQLITE_OK /* Return code */ if pIncr != 0 { - _ = libc.Int32FromInt32(0) if (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { pCtx = pReadr rc = _vdbeSorterCreateThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask, __ccgo_fp(_vdbePmaReaderBgIncrInit), pCtx) @@ -80289,6 +77726,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -80353,6 +77791,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -80376,6 +77815,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -80413,7 +77853,6 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r /* If the sorter uses more than one task, then create the top-level ** MergeEngine here. This MergeEngine will read data from exactly ** one PmaReader per sub-task. */ - _ = libc.Int32FromInt32(0) if int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask) > int32(1) { pMain = _vdbeMergeEngineNew(tls, int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) if pMain == uintptr(0) { @@ -80426,7 +77865,6 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r break } pTask = pSorter + 96 + uintptr(iTask)*96 - _ = libc.Int32FromInt32(0) if libc.Bool(false) || (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Root node of tree for this task */ nDepth = _vdbeSorterTreeDepth(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA) @@ -80459,6 +77897,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -80466,7 +77905,6 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r if pMain != uintptr(0) { rc = _vdbeIncrMergerNew(tls, pTask, *(*uintptr)(unsafe.Pointer(bp)), (*TMergeEngine)(unsafe.Pointer(pMain)).FaReadr+uintptr(iTask)*80+72) } else { - _ = libc.Int32FromInt32(0) pMain = *(*uintptr)(unsafe.Pointer(bp)) } } else { @@ -80475,6 +77913,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -80516,11 +77955,11 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { pReadr = uintptr(0) pLast = pSorter + 96 + uintptr(int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)-int32(1))*96 @@ -80545,10 +77984,10 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { pIncr = v3 if v3 != 0 { _vdbeIncrMergerSetThreads(tls, pIncr) - _ = libc.Int32FromInt32(0) } goto _2 _2: + ; iTask++ } iTask = 0 @@ -80566,10 +78005,10 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { ** object. */ p = (*TMergeEngine)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaReadr + uintptr(iTask)*80 - _ = libc.Int32FromInt32(0) rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -80602,9 +78041,7 @@ func _sqlite3VdbeSorterRewind(tls *libc.TLS, pCsr uintptr, pbEof uintptr) (r int var rc int32 _, _ = pSorter, rc rc = SQLITE_OK /* Return code */ - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) - _ = libc.Int32FromInt32(0) /* If no data has been written to disk, then do not do so now. Instead, ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly ** from the in-memory list. */ @@ -80621,13 +78058,11 @@ func _sqlite3VdbeSorterRewind(tls *libc.TLS, pCsr uintptr, pbEof uintptr) (r int ** function flushes the contents of memory to disk, it immediately always ** creates a new list consisting of a single key immediately afterwards. ** So the list is never empty at this point. */ - _ = libc.Int32FromInt32(0) rc = _vdbeSorterFlushPMA(tls, pSorter) /* Join all threads */ rc = _vdbeSorterJoinAll(tls, pSorter, rc) /* Assuming no errors have occurred, set up a merger structure to ** incrementally read and merge all remaining PMAs. */ - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { rc = _vdbeSorterSetupMerge(tls, pSorter) *(*int32)(unsafe.Pointer(pbEof)) = 0 @@ -80651,13 +78086,8 @@ func _sqlite3VdbeSorterNext(tls *libc.TLS, db uintptr, pCsr uintptr) (r int32) { var rc, v1 int32 var _ /* res at bp+0 */ int32 _, _, _, _ = pFree, pSorter, rc, v1 /* Return code */ - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) - _ = libc.Int32FromInt32(0) if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { rc = _vdbePmaReaderNext(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) if rc == SQLITE_OK && (*TPmaReader)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader)).FpFd == uintptr(0) { @@ -80666,8 +78096,6 @@ func _sqlite3VdbeSorterNext(tls *libc.TLS, db uintptr, pCsr uintptr) (r int32) { } else { /*if( !pSorter->bUseThreads )*/ *(*int32)(unsafe.Pointer(bp)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) rc = _vdbeMergeEngineStep(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger, bp) if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp)) != 0 { rc = int32(SQLITE_DONE) @@ -80726,7 +78154,6 @@ func _sqlite3VdbeSorterRowkey(tls *libc.TLS, pCsr uintptr, pOut uintptr) (r int3 var pKey, pSorter uintptr var _ /* nKey at bp+0 */ int32 _, _ = pKey, pSorter /* Sorter key to copy into pOut */ - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) pKey = _vdbeSorterRowkey(tls, pSorter, bp) if _sqlite3VdbeMemClearAndResize(tls, pOut, *(*int32)(unsafe.Pointer(bp))) != 0 { @@ -80763,7 +78190,6 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo var pKey, pKeyInfo, pSorter, r2, v1 uintptr var _ /* nKey at bp+0 */ int32 _, _, _, _, _, _ = i, pKey, pKeyInfo, pSorter, r2, v1 /* Sorter key to compare pVal with */ - _ = libc.Int32FromInt32(0) pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) r2 = (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked pKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo @@ -80776,7 +78202,6 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } (*TUnpackedRecord)(unsafe.Pointer(r2)).FnField = uint16(nKeyCol) } - _ = libc.Int32FromInt32(0) pKey = _vdbeSorterRowkey(tls, pSorter, bp) _sqlite3VdbeRecordUnpack(tls, pKeyInfo, *(*int32)(unsafe.Pointer(bp)), pKey, r2) i = 0 @@ -80790,6 +78215,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -80945,7 +78371,6 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T if int64(iAmt)+iOfst > (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(2)<= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -81012,6 +78438,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -81049,6 +78476,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -81093,12 +78521,10 @@ func _memjrnlWrite(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst ** the in-memory journal is being used by a connection using the ** atomic-write optimization. In this case the first 28 bytes of the ** journal file may be written as part of committing the transaction. */ - _ = libc.Int32FromInt32(0) if iOfst > 0 && iOfst != (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { _memjrnlTruncate(tls, pJfd, iOfst) } if iOfst == 0 && (*TMemJournal)(unsafe.Pointer(p)).FpFirst != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TMemJournal)(unsafe.Pointer(p)).FpFirst+8, zBuf, uint64(iAmt)) } else { for nWrite > 0 { @@ -81110,7 +78536,6 @@ func _memjrnlWrite(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst v1 = (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset } iSpace = v1 - _ = libc.Int32FromInt32(0) if iChunkOffset == 0 { /* New chunk is required to extend the file. */ pNew = Xsqlite3_malloc(tls, int32(libc.Uint64FromInt64(16)+uint64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize-libc.Int32FromInt32(8)))) @@ -81119,17 +78544,14 @@ func _memjrnlWrite(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst } (*TFileChunk)(unsafe.Pointer(pNew)).FpNext = uintptr(0) if pChunk != 0 { - _ = libc.Int32FromInt32(0) (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext = pNew } else { - _ = libc.Int32FromInt32(0) (*TMemJournal)(unsafe.Pointer(p)).FpFirst = pNew } v2 = pNew (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk = v2 pChunk = v2 } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pChunk+8+uintptr(iChunkOffset), zWrite, uint64(iSpace)) zWrite += uintptr(iSpace) nWrite -= iSpace @@ -81150,7 +78572,6 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) var p, pIter uintptr _, _, _ = iOff, p, pIter p = pJfd - _ = libc.Int32FromInt32(0) if size < (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { pIter = uintptr(0) if size == 0 { @@ -81166,6 +78587,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -81258,7 +78680,6 @@ func _sqlite3JournalOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pJfd uintpt var p uintptr _ = p p = pJfd - _ = libc.Int32FromInt32(0) /* Zero the file-handle object. If nSpill was passed zero, initialize ** it using the sqlite3OsOpen() function of the underlying VFS. In this ** case none of the code in this module is executed as a result of calls @@ -81271,7 +78692,6 @@ func _sqlite3JournalOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pJfd uintpt (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize = nSpill } else { (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize = int32(uint64(libc.Int32FromInt32(8)+libc.Int32FromInt32(MEMJOURNAL_DFLT_FILECHUNKSIZE)) - libc.Uint64FromInt64(16)) - _ = libc.Int32FromInt32(0) } (*Tsqlite3_file)(unsafe.Pointer(pJfd)).FpMethods = uintptr(unsafe.Pointer(&_MemJournalMethods)) (*TMemJournal)(unsafe.Pointer(p)).FnSpill = nSpill @@ -81378,6 +78798,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -81413,17 +78834,14 @@ func _sqlite3WalkExprNN(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) return rc & int32(WRC_Abort) } if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 && _sqlite3WalkExprNN(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pExpr)).FpRight != 0 { - _ = libc.Int32FromInt32(0) pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpRight continue } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { - _ = libc.Int32FromInt32(0) if _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) != 0 { return int32(WRC_Abort) } @@ -81479,6 +78897,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -81573,6 +78992,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -81755,9 +79175,10 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE var db, pDup, pOrig uintptr var _ /* temp at bp+0 */ TExpr _, _, _ = db, pDup, pOrig /* The database connection */ - _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr - _ = libc.Int32FromInt32(0) + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -81766,7 +79187,6 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE } else { _incrAggFunctionDepth(tls, pDup, nSubquery) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { - _ = libc.Int32FromInt32(0) pDup = _sqlite3ExprAddCollateString(tls, pParse, pDup, *(*uintptr)(unsafe.Pointer(pExpr + 8))) } libc.Xmemcpy(tls, bp, pDup, uint64(72)) @@ -81808,7 +79228,6 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr if eEName != int32(ENAME_TAB) && (eEName != int32(ENAME_ROWID) || pbRowid == uintptr(0)) { return 0 } - _ = libc.Int32FromInt32(0) zSpan = (*TExprList_item)(unsafe.Pointer(pItem)).FzEName n = 0 for { @@ -81817,6 +79236,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -81830,6 +79250,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -81884,10 +79305,7 @@ func _sqlite3ExprColUsed(tls *libc.TLS, pExpr uintptr) (r TBitmask) { var v1 uint64 _, _, _ = n, pExTab, v1 n = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) - _ = libc.Int32FromInt32(0) pExTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pExTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pExTab)).FaCol + uintptr(n)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*TTable)(unsafe.Pointer(pExTab)).FnCol) >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { v1 = uint64(-libc.Int32FromInt32(1)) @@ -81920,7 +79338,6 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt (*TExpr)(unsafe.Pointer(pNew)).FiTable = (*TSrcItem)(unsafe.Pointer(pMatch)).FiCursor (*TExpr)(unsafe.Pointer(pNew)).FiColumn = iColumn *(*uintptr)(unsafe.Pointer(pNew + 64)) = (*TSrcItem)(unsafe.Pointer(pMatch)).FpTab - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_CanBeNull)) *(*uintptr)(unsafe.Pointer(ppList)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(ppList)), pNew) } @@ -81934,27 +79351,25 @@ func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintpt func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { var zLegacy uintptr _ = zLegacy - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6500, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6529, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6508+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6527+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6537+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6556+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6041+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6070+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6575+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6575+7) == 0 { return int32(1) } } @@ -82010,10 +79425,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol eNewExprOp = int32(TK_COLUMN) /* New value for pExpr->op on success */ pTab = uintptr(0) /* A column of pTab */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Matches for FULL JOIN .. USING */ - _ = libc.Int32FromInt32(0) /* the name context cannot be NULL. */ - _ = libc.Int32FromInt32(0) /* The Z in X.Y.Z cannot be NULL */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* the name context cannot be NULL. */ + /* The Z in X.Y.Z cannot be NULL */ /* Initialize the node to no-match */ (*TExpr)(unsafe.Pointer(pExpr)).FiTable = -int32(1) /* Translate the schema name in zDb into a pointer to the corresponding @@ -82033,16 +79446,16 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { break } - _ = libc.Int32FromInt32(0) if _sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FzDbSName, zDb) == 0 { pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema break } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6560, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6589, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -82051,7 +79464,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } /* Start at the inner-most context and move outward until a match is found */ - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = pNC != 0 { pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList if pSrcList != 0 { @@ -82062,9 +79474,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol break } pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2000>>13)) != 0 { /* In this case, pItem is a subquery that has been formed from a ** parenthesized subset of the FROM clause terms. Example: @@ -82073,10 +79482,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** This pItem -------------^ */ hit = 0 - _ = libc.Int32FromInt32(0) pEList = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpEList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { @@ -82125,25 +79531,24 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(j) libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(j)*32+16+4, libc.Uint32FromInt32(1), 6, 0x40) /* rowid cannot be part of a USING clause - assert() this. */ - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x80>>7)) != 0 { break } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { goto _2 } } - _ = libc.Int32FromInt32(0) if zTab != 0 { if zDb != 0 { if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6565) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6594) != 0 { goto _2 } } @@ -82161,7 +79566,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } } - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr+64) } @@ -82214,21 +79618,31 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } if pMatch != 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TSrcItem)(unsafe.Pointer(pMatch)).FiCursor - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pExpr + 64)) = (*TSrcItem)(unsafe.Pointer(pMatch)).FpTab if int32((*TSrcItem)(unsafe.Pointer(pMatch)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) != 0 { *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_CanBeNull)) @@ -82245,18 +79659,17 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = uintptr(0) if (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != uintptr(0) { op = int32((*TParse)(unsafe.Pointer(pParse)).FeTriggerOp) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UBaseReg) != 0 && (zTab == uintptr(0) || _sqlite3StrICmp(tls, zTab, (*TTable)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab)).FzName) == 0) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = libc.BoolInt32(op != int32(TK_DELETE)) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6567, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6596, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6571, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6600, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -82265,7 +79678,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6575, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6604, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -82288,6 +79701,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -82299,7 +79713,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol cnt++ pMatch = uintptr(0) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == int32(EXCLUDED_TABLE_NUMBER) { - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(iCol) *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab @@ -82309,7 +79722,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol eNewExprOp = int32(TK_REGISTER) } } else { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { eNewExprOp = int32(TK_REGISTER) @@ -82346,8 +79758,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -82373,7 +79785,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol */ if cnt == 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UEList) != 0 && zTab == uintptr(0) { pEList = *(*uintptr)(unsafe.Pointer(pNC + 16)) - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { @@ -82381,26 +79792,22 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } zAs = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FzEName if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6584, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6613, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6615, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6644, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6681, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) cnt = int32(1) pMatch = uintptr(0) - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr) } @@ -82408,6 +79815,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -82431,7 +79839,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** fields are not changed in any context. */ if cnt == 0 && zTab == uintptr(0) { - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_DblQuoted)) != uint32(0) && _areDoubleQuotedStringsEnabled(tls, db, pTopNC) != 0 { /* If a double-quoted identifier does not match any known column name, ** then treat it as a string. @@ -82447,7 +79854,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6670, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6699, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+64, 0, uint64(8)) return int32(WRC_Prune) @@ -82463,8 +79870,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** cnt==0 is always an error. cnt>1 is often an error, but might ** be multiple matches for a NATURAL LEFT JOIN or a LEFT JOIN USING. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if cnt != int32(1) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { if (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExpr == cnt-int32(1) { @@ -82478,7 +79883,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6705 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6734 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -82488,18 +79893,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6714 + v10 = __ccgo_ts + 6743 } else { - v10 = __ccgo_ts + 6729 + v10 = __ccgo_ts + 6758 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6751, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6780, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6793, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6803, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -82507,7 +79912,6 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol (*TNameContext)(unsafe.Pointer(pTopNC)).FnNcErr++ eNewExprOp = int32(TK_NULL) } - _ = libc.Int32FromInt32(0) /* Remove all substructure from pExpr */ if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) @@ -82535,15 +79939,14 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) } /* Increment the nRef value on all name contexts from TopNC up to ** the point where the name matched. */ for { - _ = libc.Int32FromInt32(0) (*TNameContext)(unsafe.Pointer(pTopNC)).FnRef++ if pTopNC == pNC { break @@ -82573,7 +79976,6 @@ func _sqlite3CreateColumnExpr(tls *libc.TLS, db uintptr, pSrc uintptr, iSrc int3 p = _sqlite3ExprAlloc(tls, db, int32(TK_COLUMN), uintptr(0), 0) if p != 0 { pItem = pSrc + 8 + uintptr(iSrc)*104 - _ = libc.Int32FromInt32(0) v1 = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab *(*uintptr)(unsafe.Pointer(p + 64)) = v1 pTab = v1 @@ -82625,19 +80027,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6781 + zIn = __ccgo_ts + 6810 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6809 + zIn = __ccgo_ts + 6838 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6827 + zIn = __ccgo_ts + 6856 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6845 + zIn = __ccgo_ts + 6874 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6863, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6892, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -82659,9 +80061,7 @@ func _exprProbability(tls *libc.TLS, p uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_FLOAT) { return -int32(1) } - _ = libc.Int32FromInt32(0) _sqlite3AtoF(tls, *(*uintptr)(unsafe.Pointer(p + 8)), bp, _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(p + 8))), uint8(SQLITE_UTF8)) - _ = libc.Int32FromInt32(0) if *(*float64)(unsafe.Pointer(bp)) > float64(1) { return -int32(1) } @@ -82685,14 +80085,12 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) - _ = libc.Int32FromInt32(0) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse - _ = libc.Int32FromInt32(0) switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { /* The special operator TK_ROW means use the rowid for the first ** column in the FROM clause. This is used by the LIMIT and ORDER BY @@ -82701,10 +80099,8 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { */ case int32(TK_ROW): pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList - _ = libc.Int32FromInt32(0) pItem = pSrcList + 8 (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_COLUMN) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pExpr + 64)) = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor (*TExpr)(unsafe.Pointer(pExpr)).FiColumn-- @@ -82723,6 +80119,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -82737,30 +80146,51 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - _ = libc.Int32FromInt32(0) - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break + } + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -82777,28 +80207,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_ID) { zDb = uintptr(0) zTable = uintptr(0) - _ = libc.Int32FromInt32(0) zColumn = *(*uintptr)(unsafe.Pointer(pExpr + 8)) } else { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft - _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6883, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6912, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { zDb = uintptr(0) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) zDb = *(*uintptr)(unsafe.Pointer(pLeft + 8)) pLeft = (*TExpr)(unsafe.Pointer(pRight)).FpLeft pRight = (*TExpr)(unsafe.Pointer(pRight)).FpRight } - _ = libc.Int32FromInt32(0) zTable = *(*uintptr)(unsafe.Pointer(pLeft + 8)) zColumn = *(*uintptr)(unsafe.Pointer(pRight + 8)) - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameTokenRemap(tls, pParse, pExpr, pRight) _sqlite3RenameTokenRemap(tls, pParse, pExpr+64, pLeft) @@ -82811,24 +80235,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + pWin = v5 zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) if pDef == uintptr(0) { @@ -82845,7 +80267,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6900, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6929, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -82859,17 +80281,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6964, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6993, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -82889,12 +80311,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** in an index or generated column. Curiously, they can be used ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ - _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7000, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7029, uintptr(0), pExpr) } } else { - _ = libc.Int32FromInt32(0) /* Must fit in 8 bits */ + /* Must fit in 8 bits */ (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = uint8((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & int32(NC_SelfRef)) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_FromDDL) != 0 { *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FromDDL)) @@ -82914,31 +80335,30 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } } if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { - _ = libc.Int32FromInt32(0) if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7028, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7057, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7071 + zType = __ccgo_ts + 7100 } else { - zType = __ccgo_ts + 7078 + zType = __ccgo_ts + 7107 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7088, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7117, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7116, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7145, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7138, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7167, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7182, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7211, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -82955,11 +80375,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -82969,20 +80389,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { _sqlite3WalkExprList(tls, pWalker, pList) if is_agg != 0 { if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) } if pWin != 0 { pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect - _ = libc.Int32FromInt32(0) if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -83001,18 +80418,15 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } - _ = libc.Int32FromInt32(0) if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -83029,26 +80443,23 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7230, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7259, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } - _ = libc.Int32FromInt32(0) if nRef != (*TNameContext)(unsafe.Pointer(pNC)).FnRef { *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_VarSelect)) } *(*int32)(unsafe.Pointer(pNC + 40)) |= int32(NC_Subquery) } case int32(TK_VARIABLE): - _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7241, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7270, pExpr, pExpr) } case int32(TK_IS): fallthrough case int32(TK_ISNOT): pRight1 = _sqlite3ExprSkipCollateAndLikely(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) - _ = libc.Int32FromInt32(0) /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE", ** and "x IS NOT FALSE". */ if pRight1 != 0 && (int32((*TExpr)(unsafe.Pointer(pRight1)).Fop) == int32(TK_ID) || int32((*TExpr)(unsafe.Pointer(pRight1)).Fop) == int32(TK_TRUEFALSE)) { @@ -83079,31 +80490,27 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } - _ = libc.Int32FromInt32(0) nLeft = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_BETWEEN) { - _ = libc.Int32FromInt32(0) nRight = _sqlite3ExprVectorSize(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr) if nRight == nLeft { nRight = _sqlite3ExprVectorSize(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr) } } else { - _ = libc.Int32FromInt32(0) nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6681, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -83126,7 +80533,6 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( _, _ = i, zCol /* Loop counter */ _ = pParse if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_ID) { - _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer(pE + 8)) i = 0 for { @@ -83138,6 +80544,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -83172,7 +80579,6 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt var savedSuppErr Tu8 var _ /* nc at bp+0 */ TNameContext _, _, _, _, _ = db, i, pEList, rc, savedSuppErr /* Saved value of db->suppressErr */ - _ = libc.Int32FromInt32(0) pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList /* Resolve all names in the ORDER BY term expression */ @@ -83204,6 +80610,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -83218,7 +80625,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7252, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7281, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -83253,7 +80660,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7308, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7337, 0) return int32(1) } i = 0 @@ -83264,6 +80671,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -83274,7 +80682,6 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r for pSelect != 0 && moreToDo != 0 { moreToDo = 0 pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList - _ = libc.Int32FromInt32(0) i = 0 pItem = pOrderBy + 8 for { @@ -83291,7 +80698,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7342, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7371, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -83310,7 +80717,6 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r ** column references within the ORDER BY expression as required. */ pDup = _sqlite3ExprDup(tls, db, pE, 0) if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _resolveOrderByTermToExprList(tls, pParse, pSelect, pDup) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*int32)(unsafe.Pointer(bp)) > 0 { _resolveOrderByTermToExprList(tls, pParse, pSelect, pE) @@ -83333,11 +80739,9 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = pNew } else { pParent = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr - _ = libc.Int32FromInt32(0) for int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pParent)).FpLeft)).Fop) == int32(TK_COLLATE) { pParent = (*TExpr)(unsafe.Pointer(pParent)).FpLeft } - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pParent)).FpLeft = pNew } _sqlite3ExprDelete(tls, db, pE) @@ -83352,6 +80756,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -83363,11 +80768,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7348, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7377, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -83396,11 +80802,11 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7409, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7438, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList - _ = libc.Int32FromInt32(0) /* sqlite3SelectNew() guarantees this */ + /* sqlite3SelectNew() guarantees this */ i = 0 pItem = pOrderBy + 8 for { @@ -83425,6 +80831,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -83492,7 +80899,6 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy var pE, pE2, pItem, pParse uintptr var _ /* iCol at bp+0 */ int32 _, _, _, _, _, _, _ = i, j, nResult, pE, pE2, pItem, pParse /* Number of terms in the result set */ - _ = libc.Int32FromInt32(0) nResult = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList)).FnExpr pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse i = 0 @@ -83559,10 +80965,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -83581,7 +80989,6 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { var i, isCompound, nCompound, nRef, v1, v3 int32 var _ /* sNC at bp+0 */ TNameContext _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, isCompound, nCompound, nRef, pGroupBy, pItem, pItem1, pItem2, pLeftmost, pOuterNC, pParse, pSub, pSub1, pWin, zSavedContext, v1, v3 /* Database connection */ - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Resolved) != 0 { return int32(WRC_Prune) } @@ -83609,8 +81016,6 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { nCompound = 0 pLeftmost = p for p != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Resolved) /* Resolve the expressions in the LIMIT and OFFSET clauses. These ** are not allowed to refer to any names, so pass an empty NameContext. @@ -83629,8 +81034,6 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** after the names have been resolved. */ if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Converted) != 0 { pSub = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) } @@ -83661,7 +81064,6 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return int32(WRC_Abort) } - _ = libc.Int32FromInt32(0) /* If the number of references to the outer context changed when ** expressions in the sub-select were resolved, the sub-select ** is correlated. It is not required to check the refcount on any @@ -83669,12 +81071,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the refcount on all contexts between the current one and the ** context containing the column when it resolves a name. */ if pOuterNC != 0 { - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.BoolUint32((*TNameContext)(unsafe.Pointer(pOuterNC)).FnRef > nRef), 3, 0x8) } } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -83694,11 +81096,8 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { /* If there are no aggregate functions in the result-set, and no GROUP BY ** expression, do not allow aggregates in any of the other expressions. */ - _ = libc.Int32FromInt32(0) pGroupBy = (*TSelect)(unsafe.Pointer(p)).FpGroupBy if pGroupBy != 0 || (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags&int32(NC_HasAgg) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(int32(SF_Aggregate) | (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags&(libc.Int32FromInt32(NC_MinMaxAgg)|libc.Int32FromInt32(NC_OrderAgg))) } else { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_AllowAgg) @@ -83711,21 +81110,22 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** Minor point: If this is the case, then the expression will be ** re-evaluated for each reference to it. */ - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(bp + 16)) = (*TSelect)(unsafe.Pointer(p)).FpEList (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7440, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7469, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -83738,6 +81138,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -83751,6 +81152,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -83779,7 +81181,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7371) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -83790,7 +81192,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7479) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7508) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -83800,11 +81202,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7485, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7514, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -83905,11 +81308,8 @@ func _sqlite3ResolveExprNames(tls *libc.TLS, pNC uintptr, pExpr uintptr) (r int3 if _sqlite3ExprCheckHeight(tls, (*(*TWalker)(unsafe.Pointer(bp))).FpParse, (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnHeight) != 0 { return int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) _sqlite3WalkExprNN(tls, bp, pExpr) *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) -= (*TExpr)(unsafe.Pointer(pExpr)).FnHeight - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_HasWin))) *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg return libc.BoolInt32((*TNameContext)(unsafe.Pointer(pNC)).FnNcErr > 0 || (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnErr > 0) @@ -83955,8 +81355,6 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } _sqlite3WalkExprNN(tls, bp, pExpr) *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) -= (*TExpr)(unsafe.Pointer(pExpr)).FnHeight - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_HasAgg)|libc.Int32FromInt32(NC_MinMaxAgg)|libc.Int32FromInt32(NC_HasWin)|libc.Int32FromInt32(NC_OrderAgg)) != 0 { *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_HasWin))) savedHasAgg |= (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) @@ -83967,6 +81365,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -83991,7 +81390,6 @@ func _sqlite3ResolveSelectNames(tls *libc.TLS, pParse uintptr, p uintptr, pOuter bp := tls.Alloc(48) defer tls.Free(48) var _ /* w at bp+0 */ TWalker - _ = libc.Int32FromInt32(0) (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_resolveExprStep) (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_resolveSelectStep) (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) @@ -84027,8 +81425,6 @@ func _sqlite3ResolveSelfReference(tls *libc.TLS, pParse uintptr, pTab uintptr, t var _ /* sNC at bp+112 */ TNameContext var _ /* sSrc at bp+0 */ TSrcList _, _ = rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp+112, 0, uint64(56)) libc.Xmemset(tls, bp, 0, uint64(112)) if pTab != 0 { @@ -84093,34 +81489,21 @@ func _sqlite3ExprAffinity(tls *libc.TLS, pExpr uintptr) (r int8) { op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) for int32(1) != 0 { if op == int32(TK_COLUMN) || op == int32(TK_AGG_COLUMN) && *(*uintptr)(unsafe.Pointer(pExpr + 64)) != uintptr(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)) } if op == int32(TK_SELECT) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList + 8))).FpExpr) } if op == int32(TK_CAST) { - _ = libc.Int32FromInt32(0) return _sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0)) } if op == int32(TK_SELECT_COLUMN) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32)))).FpEList + 8 + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*32))).FpExpr) } if op == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr) } if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)|libc.Int32FromInt32(EP_IfNullRow)) != uint32(0) { - _ = libc.Int32FromInt32(0) pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) continue @@ -84196,8 +81579,6 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { case int32(TK_CASE): res = 0 pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) ii = int32(1) for { if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { @@ -84206,6 +81587,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -84247,7 +81629,6 @@ func _sqlite3ExprAddCollateString(tls *libc.TLS, pParse uintptr, pExpr uintptr, bp := tls.Alloc(16) defer tls.Free(16) var _ /* s at bp+0 */ TToken - _ = libc.Int32FromInt32(0) _sqlite3TokenInit(tls, bp, zC) return _sqlite3ExprAddCollateToken(tls, pParse, pExpr, bp, 0) } @@ -84259,7 +81640,6 @@ func _sqlite3ExprAddCollateString(tls *libc.TLS, pParse uintptr, pExpr uintptr, // */ func _sqlite3ExprSkipCollate(tls *libc.TLS, pExpr uintptr) (r uintptr) { for pExpr != 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)) != uint32(0) { - _ = libc.Int32FromInt32(0) pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft } return pExpr @@ -84275,13 +81655,13 @@ func _sqlite3ExprSkipCollate(tls *libc.TLS, pExpr uintptr) (r uintptr) { func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) { for pExpr != 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)|libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - _ = libc.Int32FromInt32(0) - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -84316,8 +81696,6 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt op = int32((*TExpr)(unsafe.Pointer(p)).Fop2) } if op == int32(TK_AGG_COLUMN) && *(*uintptr)(unsafe.Pointer(p + 64)) != uintptr(0) || op == int32(TK_COLUMN) || op == int32(TK_TRIGGER) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v1 = int32((*TExpr)(unsafe.Pointer(p)).FiColumn) j = v1 if v1 >= 0 { @@ -84331,12 +81709,10 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt continue } if op == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) p = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8))).FpExpr continue } if op == int32(TK_COLLATE) { - _ = libc.Int32FromInt32(0) pColl = _sqlite3GetCollSeq(tls, pParse, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, uintptr(0), *(*uintptr)(unsafe.Pointer(p + 8))) break } @@ -84346,7 +81722,6 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } else { pNext = (*TExpr)(unsafe.Pointer(p)).FpRight /* The Expr.x union is never used at the same time as Expr.pRight */ - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) == uint32(0) && *(*uintptr)(unsafe.Pointer(p + 32)) != uintptr(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { i = 0 for { @@ -84359,6 +81734,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -84393,7 +81769,6 @@ func _sqlite3ExprNNCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uint if p == uintptr(0) { p = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl } - _ = libc.Int32FromInt32(0) return p } @@ -84433,7 +81808,6 @@ func _sqlite3CompareAffinity(tls *libc.TLS, pExpr uintptr, aff2 int8) (r int8) { } } else { /* One side is a column, the other is not. Use the columns affinity. */ - _ = libc.Int32FromInt32(0) if int32(aff1) <= int32(SQLITE_AFF_NONE) { v1 = int32(aff2) } else { @@ -84453,8 +81827,6 @@ func _sqlite3CompareAffinity(tls *libc.TLS, pExpr uintptr, aff2 int8) (r int8) { func _comparisonAffinity(tls *libc.TLS, pExpr uintptr) (r int8) { var aff int8 _ = aff - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aff = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) if (*TExpr)(unsafe.Pointer(pExpr)).FpRight != 0 { aff = _sqlite3CompareAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, aff) @@ -84522,7 +81894,6 @@ func _binaryCompareP5(tls *libc.TLS, pExpr1 uintptr, pExpr2 uintptr, jumpIfNull func _sqlite3BinaryCompareCollSeq(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) (r uintptr) { var pColl uintptr _ = pColl - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pLeft)).Fflags&uint32(EP_Collate) != 0 { pColl = _sqlite3ExprCollSeq(tls, pParse, pLeft) } else { @@ -84611,11 +81982,9 @@ func _sqlite3ExprVectorSize(tls *libc.TLS, pExpr uintptr) (r int32) { op = (*TExpr)(unsafe.Pointer(pExpr)).Fop2 } if int32(op) == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) return (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr } else { if int32(op) == int32(TK_SELECT) { - _ = libc.Int32FromInt32(0) return (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList)).FnExpr } else { return int32(1) @@ -84642,14 +82011,10 @@ func _sqlite3ExprVectorSize(tls *libc.TLS, pExpr uintptr) (r int32) { // ** been positioned. // */ func _sqlite3VectorFieldSubexpr(tls *libc.TLS, pVector uintptr, i int32) (r uintptr) { - _ = libc.Int32FromInt32(0) if _sqlite3ExprIsVector(tls, pVector) != 0 { - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_SELECT) || int32((*TExpr)(unsafe.Pointer(pVector)).Fop2) == int32(TK_SELECT) { - _ = libc.Int32FromInt32(0) return (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)))).FpEList + 8 + uintptr(i)*32))).FpExpr } else { - _ = libc.Int32FromInt32(0) return (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(i)*32))).FpExpr } } @@ -84683,7 +82048,6 @@ func _sqlite3ExprForVectorField(tls *libc.TLS, pParse uintptr, pVector uintptr, var pRet, ppVector uintptr _, _ = pRet, ppVector if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_SELECT) { - _ = libc.Int32FromInt32(0) /* The TK_SELECT_COLUMN Expr node: ** ** pLeft: pVector containing TK_SELECT. Not deleted. @@ -84709,7 +82073,6 @@ func _sqlite3ExprForVectorField(tls *libc.TLS, pParse uintptr, pVector uintptr, } } else { if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) ppVector = *(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(iField)*32 pVector = *(*uintptr)(unsafe.Pointer(ppVector)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -84767,18 +82130,15 @@ func _exprVectorRegister(tls *libc.TLS, pParse uintptr, pVector uintptr, iField var op Tu8 _ = op op = (*TExpr)(unsafe.Pointer(pVector)).Fop - _ = libc.Int32FromInt32(0) if int32(op) == int32(TK_REGISTER) { *(*uintptr)(unsafe.Pointer(ppExpr)) = _sqlite3VectorFieldSubexpr(tls, pVector, iField) return (*TExpr)(unsafe.Pointer(pVector)).FiTable + iField } if int32(op) == int32(TK_SELECT) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppExpr)) = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)))).FpEList + 8 + uintptr(iField)*32))).FpExpr return regSelect + iField } if int32(op) == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppExpr)) = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(iField)*32))).FpExpr return _sqlite3ExprCodeTemp(tls, pParse, *(*uintptr)(unsafe.Pointer(ppExpr)), pRegFree) } @@ -84819,18 +82179,13 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 addrCmp = 0 addrDone = _sqlite3VdbeMakeLabel(tls, pParse) isCommuted = libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0)) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6681, 0) return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(op) == int32(TK_LE) { opx = uint8(TK_LT) } @@ -84852,7 +82207,6 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 *(*int32)(unsafe.Pointer(bp + 4)) = 0 *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) - _ = libc.Int32FromInt32(0) if addrCmp != 0 { _sqlite3VdbeJumpHere(tls, v, addrCmp) } @@ -84876,7 +82230,6 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 if int32(opx) == int32(TK_EQ) { _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), dest, addrDone) } else { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrDone) if i == nLeft-int32(2) { opx = op @@ -84884,6 +82237,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -84908,7 +82262,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7544, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7573, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -84945,6 +82299,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -84966,6 +82321,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -85087,11 +82443,9 @@ func _sqlite3ExprAlloc(tls *libc.TLS, db uintptr, op int32, pToken uintptr, dequ _, _, _ = nExtra, pNew, v1 nExtra = 0 *(*int32)(unsafe.Pointer(bp)) = 0 - _ = libc.Int32FromInt32(0) if pToken != 0 { if op != int32(TK_INTEGER) || (*TToken)(unsafe.Pointer(pToken)).Fz == uintptr(0) || _sqlite3GetInt32(tls, (*TToken)(unsafe.Pointer(pToken)).Fz, bp) == 0 { nExtra = int32((*TToken)(unsafe.Pointer(pToken)).Fn + uint32(1)) - _ = libc.Int32FromInt32(0) } } pNew = _sqlite3DbMallocRawNN(tls, db, uint64(72)+uint64(nExtra)) @@ -85110,7 +82464,6 @@ func _sqlite3ExprAlloc(tls *libc.TLS, db uintptr, op int32, pToken uintptr, dequ *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pNew)).Fu)) = *(*int32)(unsafe.Pointer(bp)) } else { *(*uintptr)(unsafe.Pointer(pNew + 8)) = pNew + 1*72 - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pToken)).Fn != 0 { libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(pNew + 8)), (*TToken)(unsafe.Pointer(pToken)).Fz, uint64((*TToken)(unsafe.Pointer(pToken)).Fn)) } @@ -85150,12 +82503,9 @@ func _sqlite3Expr(tls *libc.TLS, db uintptr, op int32, zToken uintptr) (r uintpt // */ func _sqlite3ExprAttachSubtrees(tls *libc.TLS, db uintptr, pRoot uintptr, pLeft uintptr, pRight uintptr) { if pRoot == uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3ExprDelete(tls, db, pLeft) _sqlite3ExprDelete(tls, db, pRight) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pRight != 0 { (*TExpr)(unsafe.Pointer(pRoot)).FpRight = pRight *(*Tu32)(unsafe.Pointer(pRoot + 4)) |= uint32(libc.Int32FromInt32(EP_Collate)|libc.Int32FromInt32(EP_Subquery)|libc.Int32FromInt32(EP_HasFunc)) & (*TExpr)(unsafe.Pointer(pRight)).Fflags @@ -85211,7 +82561,6 @@ func _sqlite3PExprAddSelect(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSelec *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_xIsSelect) | libc.Int32FromInt32(EP_Subquery)) _sqlite3ExprSetHeightAndFlags(tls, pParse, pExpr) } else { - _ = libc.Int32FromInt32(0) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSelect) } } @@ -85244,7 +82593,6 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList var pExpr, pRet, pSel, v2 uintptr _, _, _, _, _, _ = ii, nExprElem, pExpr, pRet, pSel, v2 pRet = uintptr(0) - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { @@ -85252,21 +82600,19 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } pExpr = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32))).FpExpr if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VECTOR) { - _ = libc.Int32FromInt32(0) nExprElem = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr } else { nExprElem = int32(1) } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7592 + v2 = __ccgo_ts + 7621 } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7594, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7623, libc.VaList(bp+8, nExprElem, v2, nElem)) break } - _ = libc.Int32FromInt32(0) pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) *(*uintptr)(unsafe.Pointer(pExpr + 32)) = uintptr(0) if pSel != 0 { @@ -85278,6 +82624,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -85312,7 +82659,7 @@ func _sqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt if f&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { _sqlite3ExprDeferredDelete(tls, pParse, pLeft) _sqlite3ExprDeferredDelete(tls, pParse, pRight) - return _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1722) + return _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1726) } else { return _sqlite3PExpr(tls, pParse, int32(TK_AND), pLeft, pRight) } @@ -85333,20 +82680,17 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u var db, pNew uintptr _, _ = db, pNew db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) pNew = _sqlite3ExprAlloc(tls, db, int32(TK_FUNCTION), pToken, int32(1)) if pNew == uintptr(0) { _sqlite3ExprListDelete(tls, db, pList) /* Avoid memory leak when malloc fails */ return uintptr(0) } - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7638, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7667, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) - _ = libc.Int32FromInt32(0) _sqlite3ExprSetHeightAndFlags(tls, pParse, pNew) if eDistinct == int32(SF_Distinct) { *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_Distinct)) @@ -85363,7 +82707,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7672, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7701, libc.VaList(bp+8, p)) } // C documentation @@ -85383,17 +82727,12 @@ func _sqlite3ExprAddFunctionOrderBy(tls *libc.TLS, pParse uintptr, pExpr uintptr _, _ = db, pOB db = (*TParse)(unsafe.Pointer(pParse)).Fdb if pOrderBy == uintptr(0) { - _ = libc.Int32FromInt32(0) return } if pExpr == uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3ExprListDelete(tls, db, pOrderBy) return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pExpr + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr == 0 { /* Ignore ORDER BY on zero-argument aggregates */ _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), pOrderBy) @@ -85410,7 +82749,6 @@ func _sqlite3ExprAddFunctionOrderBy(tls *libc.TLS, pParse uintptr, pExpr uintptr return } *(*uintptr)(unsafe.Pointer(pOB + 32)) = pOrderBy - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = pOB *(*Tu32)(unsafe.Pointer(pOB + 4)) |= uint32(libc.Int32FromInt32(EP_FullSize)) } @@ -85431,8 +82769,6 @@ func _sqlite3ExprAddFunctionOrderBy(tls *libc.TLS, pParse uintptr, pExpr uintptr func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FromDDL)) != uint32(0) { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_DIRECT) != uint32(0) || (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) == uint64(0) { /* Functions prohibited in triggers and views if: @@ -85442,7 +82778,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7722, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7751, libc.VaList(bp+8, pExpr)) } } } @@ -85477,14 +82813,9 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n if pExpr == uintptr(0) { return } - _ = libc.Int32FromInt32(0) z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(z + 1))) == 0 { /* Wildcard of the form "?". Assign the next variable number */ - _ = libc.Int32FromInt32(0) v2 = pParse + 304 *(*TynVar)(unsafe.Pointer(v2))++ v1 = *(*TynVar)(unsafe.Pointer(v2)) @@ -85499,7 +82830,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7742, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7771, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -85532,7 +82863,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7785, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7814, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -85543,24 +82874,15 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n // ** Recursively delete an expression tree. // */ func _sqlite3ExprDeleteNN(tls *libc.TLS, db uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { /* The Expr.x union is never used at the same time as Expr.pRight */ - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 && int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_SELECT_COLUMN) { _sqlite3ExprDeleteNN(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft) } if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { - _ = libc.Int32FromInt32(0) _sqlite3ExprDeleteNN(tls, db, (*TExpr)(unsafe.Pointer(p)).FpRight) } else { if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { - _ = libc.Int32FromInt32(0) _sqlite3SelectDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32))) } else { _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32))) @@ -85692,19 +83014,13 @@ func _exprStructSize(tls *libc.TLS, p uintptr) (r int32) { func _dupedExprStructSize(tls *libc.TLS, p uintptr, flags int32) (r int32) { var nSize int32 _ = nSize - _ = libc.Int32FromInt32(0) /* Only one flag value allowed */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* Only one flag value allowed */ if 0 == flags || (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_FullSize)) != uint32(0) { nSize = int32(72) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 || *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { nSize = int32(uint64(libc.UintptrFromInt32(0)+44) | libc.Uint64FromInt32(EP_Reduced)) } else { - _ = libc.Int32FromInt32(0) nSize = int32(uint64(libc.UintptrFromInt32(0)+16) | libc.Uint64FromInt32(EP_TokenOnly)) } } @@ -85744,7 +83060,6 @@ func _dupedExprNodeSize(tls *libc.TLS, p uintptr, flags int32) (r int32) { func _dupedExprSize(tls *libc.TLS, p uintptr) (r int32) { var nByte int32 _ = nByte - _ = libc.Int32FromInt32(0) nByte = _dupedExprNodeSize(tls, p, int32(EXPRDUP_REDUCE)) if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { nByte += _dupedExprSize(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft) @@ -85752,7 +83067,6 @@ func _dupedExprSize(tls *libc.TLS, p uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { nByte += _dupedExprSize(tls, (*TExpr)(unsafe.Pointer(p)).FpRight) } - _ = libc.Int32FromInt32(0) return nByte } @@ -85796,16 +83110,10 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin var _ /* sEdupBuf at bp+0 */ TEdupBuf _, _, _, _, _, _, _, _, _, _, _, _ = nAlloc, nNewSize, nSize, nStructSize, nToken, pNew, staticFlag, zToken, v1, v2, v3, v4 /* EP_Static if space not obtained from malloc */ nToken = -int32(1) /* Space needed for p->u.zToken. -1 means unknown */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Figure out where to write the new Expr structure. */ if pEdupBuf != 0 { (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc = (*TEdupBuf)(unsafe.Pointer(pEdupBuf)).FzAlloc staticFlag = uint32(EP_Static) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } else { if dupFlags != 0 { nAlloc = _dupedExprSize(tls, p) @@ -85818,12 +83126,10 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin nAlloc = int32((libc.Uint64FromInt64(72) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) } } - _ = libc.Int32FromInt32(0) (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc = _sqlite3DbMallocRawNN(tls, db, uint64(nAlloc)) staticFlag = uint32(0) } pNew = (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc - _ = libc.Int32FromInt32(0) if pNew != 0 { /* Set nNewSize to the size allocated for the structure pointed to ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or @@ -85840,12 +83146,9 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin } } if dupFlags != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc, p, uint64(nNewSize)) } else { nSize = uint32(_exprStructSize(tls, p)) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc, p, uint64(nSize)) if uint64(nSize) < uint64(72) { libc.Xmemset(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc+uintptr(nSize), 0, uint64(72)-uint64(nSize)) @@ -85859,7 +83162,6 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin if dupFlags != 0 { } /* Copy the p->u.zToken string, if any. */ - _ = libc.Int32FromInt32(0) if nToken > 0 { v1 = (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc + uintptr(nNewSize) *(*uintptr)(unsafe.Pointer(pNew + 8)) = v1 @@ -85882,13 +83184,11 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin } if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { *(*uintptr)(unsafe.Pointer(pNew + 64)) = _sqlite3WindowDup(tls, db, pNew, *(*uintptr)(unsafe.Pointer(p + 64))) - _ = libc.Int32FromInt32(0) } /* Fill in pNew->pLeft and pNew->pRight. */ if dupFlags != 0 { if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_SELECT_COLUMN) { (*TExpr)(unsafe.Pointer(pNew)).FpLeft = (*TExpr)(unsafe.Pointer(p)).FpLeft - _ = libc.Int32FromInt32(0) } else { if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { v3 = _exprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft, int32(EXPRDUP_REDUCE), bp) @@ -85906,7 +83206,6 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin } else { if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_SELECT_COLUMN) { (*TExpr)(unsafe.Pointer(pNew)).FpLeft = (*TExpr)(unsafe.Pointer(p)).FpLeft - _ = libc.Int32FromInt32(0) } else { (*TExpr)(unsafe.Pointer(pNew)).FpLeft = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft, 0) } @@ -85917,7 +83216,6 @@ func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uin if pEdupBuf != 0 { libc.Xmemcpy(tls, pEdupBuf, bp, uint64(8)) } - _ = libc.Int32FromInt32(0) return pNew } @@ -85950,6 +83248,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -85971,9 +83270,6 @@ func _gatherSelectWindowsCallback(tls *libc.TLS, pWalker uintptr, pExpr uintptr) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { pSelect = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pWin = *(*uintptr)(unsafe.Pointer(pExpr + 64)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WindowLink(tls, pSelect, pWin) } return WRC_Continue @@ -86024,7 +83320,6 @@ func _gatherSelectWindows(tls *libc.TLS, p uintptr) { func _sqlite3ExprDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r uintptr) { var v1 uintptr _ = v1 - _ = libc.Int32FromInt32(0) if p != 0 { v1 = _exprDup(tls, db, p, flags, uintptr(0)) } else { @@ -86040,7 +83335,6 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u _, _, _, _, _, _, _, _, _, _ = i, pItem, pNew, pNewExpr, pOldExpr, pOldItem, pPriorSelectColNew, pPriorSelectColOld, v2, v3 pPriorSelectColOld = uintptr(0) pPriorSelectColNew = uintptr(0) - _ = libc.Int32FromInt32(0) if p == uintptr(0) { return uintptr(0) } @@ -86083,6 +83377,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -86104,7 +83399,6 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui var v1 uint64 var v2 Tu32 _, _, _, _, _, _, _, _, _ = i, nByte, pNew, pNewItem, pOldItem, pTab, v1, v2, v4 - _ = libc.Int32FromInt32(0) if p == uintptr(0) { return uintptr(0) } @@ -86154,7 +83448,6 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui } (*TSrcItem)(unsafe.Pointer(pNewItem)).FpSelect = _sqlite3SelectDup(tls, db, (*TSrcItem)(unsafe.Pointer(pOldItem)).FpSelect, flags) if int32(uint32(*(*uint16)(unsafe.Pointer(pOldItem + 60 + 4))&0x400>>10)) != 0 { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pNewItem + 72)) = _sqlite3IdListDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 72))) } else { *(*uintptr)(unsafe.Pointer(pNewItem + 72)) = _sqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 72)), flags) @@ -86162,6 +83455,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -86171,11 +83465,9 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var i int32 var pNew, pNewItem, pOldItem uintptr _, _, _, _ = i, pNew, pNewItem, pOldItem - _ = libc.Int32FromInt32(0) if p == uintptr(0) { return uintptr(0) } - _ = libc.Int32FromInt32(0) pNew = _sqlite3DbMallocRawNN(tls, db, uint64(24)+uint64((*TIdList)(unsafe.Pointer(p)).FnId-libc.Int32FromInt32(1))*uint64(16)) if pNew == uintptr(0) { return uintptr(0) @@ -86193,6 +83485,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -86207,7 +83500,6 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) pNext = uintptr(0) pp = bp - _ = libc.Int32FromInt32(0) p = pDup for { if !(p != 0) { @@ -86253,6 +83545,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -86408,7 +83701,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7837, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -86417,24 +83710,21 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, break } pSubExpr = _sqlite3ExprForVectorField(tls, pParse, pExpr, i, (*TIdList)(unsafe.Pointer(pColumns)).FnId) - _ = libc.Int32FromInt32(0) if pSubExpr == uintptr(0) { goto _4 } pList = _sqlite3ExprListAppend(tls, pParse, pList, pSubExpr) if pList != 0 { - _ = libc.Int32FromInt32(0) (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32))).FzEName = (*(*TIdList_item)(unsafe.Pointer(pColumns + 8 + uintptr(i)*16))).FzName (*(*TIdList_item)(unsafe.Pointer(pColumns + 8 + uintptr(i)*16))).FzName = uintptr(0) } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { pFirst = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(iFirst)*32))).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Store the SELECT statement in pRight so it will be deleted when ** sqlite3ExprListDelete() is called */ (*TExpr)(unsafe.Pointer(pFirst)).FpRight = pExpr @@ -86444,6 +83734,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -86460,12 +83751,7 @@ func _sqlite3ExprListSetSortOrder(tls *libc.TLS, p uintptr, iSortOrder int32, eN if p == uintptr(0) { return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pItem = p + 8 + uintptr((*TExprList)(unsafe.Pointer(p)).FnExpr-int32(1))*32 - _ = libc.Int32FromInt32(0) if iSortOrder == -int32(1) { iSortOrder = SQLITE_SO_ASC } @@ -86492,13 +83778,8 @@ func _sqlite3ExprListSetSortOrder(tls *libc.TLS, p uintptr, iSortOrder int32, eN func _sqlite3ExprListSetName(tls *libc.TLS, pParse uintptr, pList uintptr, pName uintptr, dequote int32) { var pItem uintptr _ = pItem - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pList != 0 { - _ = libc.Int32FromInt32(0) pItem = pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TToken)(unsafe.Pointer(pName)).Fz, uint64((*TToken)(unsafe.Pointer(pName)).Fn)) if dequote != 0 { /* If dequote==0, then pName->z does not point to part of a DDL @@ -86526,10 +83807,8 @@ func _sqlite3ExprListSetSpan(tls *libc.TLS, pParse uintptr, pList uintptr, zStar var db, pItem uintptr _, _ = db, pItem db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if pList != 0 { pItem = pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32 - _ = libc.Int32FromInt32(0) if (*TExprList_item)(unsafe.Pointer(pItem)).FzEName == uintptr(0) { (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbSpanDup(tls, db, zStart, zEnd) libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(ENAME_SPAN), 0, 0x3) @@ -86550,7 +83829,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7838, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7867, libc.VaList(bp+8, zObject)) } } @@ -86565,8 +83844,6 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { _, _, _ = i, pItem, v1 i = (*TExprList)(unsafe.Pointer(pList)).FnExpr pItem = pList + 8 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for { _sqlite3ExprDelete(tls, db, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) if (*TExprList_item)(unsafe.Pointer(pItem)).FzEName != 0 { @@ -86575,6 +83852,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -86608,17 +83886,16 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { var pExpr uintptr _, _, _ = i, m, pExpr m = uint32(0) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { break } pExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr - _ = libc.Int32FromInt32(0) m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -86650,10 +83927,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7861) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7890) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7866) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7895) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -86670,7 +83947,6 @@ func _sqlite3ExprIdToTrueFalse(tls *libc.TLS, pExpr uintptr) (r int32) { var v, v1 Tu32 var v2 bool _, _, _ = v, v1, v2 - _ = libc.Int32FromInt32(0) if v2 = !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Quoted)|libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)); v2 { v1 = _sqlite3IsTrueOrFalse(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8))) v = v1 @@ -86691,9 +83967,6 @@ func _sqlite3ExprIdToTrueFalse(tls *libc.TLS, pExpr uintptr) (r int32) { // */ func _sqlite3ExprTruthValue(tls *libc.TLS, pExpr uintptr) (r int32) { pExpr = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8)) + 4))) == 0) } @@ -86715,7 +83988,6 @@ func _sqlite3ExprTruthValue(tls *libc.TLS, pExpr uintptr) (r int32) { func _sqlite3ExprSimplifiedAndOr(tls *libc.TLS, pExpr uintptr) (r uintptr) { var pLeft, pRight, v1, v2 uintptr _, _, _, _ = pLeft, pRight, v1, v2 - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_OR) { pRight = _sqlite3ExprSimplifiedAndOr(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) pLeft = _sqlite3ExprSimplifiedAndOr(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) @@ -86974,6 +84246,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -87006,6 +84279,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -87074,7 +84348,6 @@ func _sqlite3ExprIsConstantOrGroupBy(tls *libc.TLS, pParse uintptr, p uintptr, p // ** a constant. // */ func _sqlite3ExprIsConstantOrFunction(tls *libc.TLS, p uintptr, isInit Tu8) (r int32) { - _ = libc.Int32FromInt32(0) return _exprIsConst(tls, p, int32(4)+int32(isInit), 0) } @@ -87098,7 +84371,6 @@ func _sqlite3ExprIsInteger(tls *libc.TLS, p uintptr, pValue uintptr) (r int32) { } /* Used to only happen following on OOM */ /* If an expression is an integer literal that fits in a signed 32-bit ** integer, then the EP_IntValue flag will have already been set */ - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_IntValue) != 0 { *(*int32)(unsafe.Pointer(pValue)) = *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(p)).Fu)) return int32(1) @@ -87109,7 +84381,6 @@ func _sqlite3ExprIsInteger(tls *libc.TLS, p uintptr, pValue uintptr) (r int32) { case int32(TK_UMINUS): *(*int32)(unsafe.Pointer(bp)) = 0 if _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, bp) != 0 { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pValue)) = -*(*int32)(unsafe.Pointer(bp)) rc = int32(1) } @@ -87138,10 +84409,8 @@ func _sqlite3ExprIsInteger(tls *libc.TLS, p uintptr, pValue uintptr) (r int32) { func _sqlite3ExprCanBeNull(tls *libc.TLS, p uintptr) (r int32) { var op Tu8 _ = op - _ = libc.Int32FromInt32(0) for int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UPLUS) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { p = (*TExpr)(unsafe.Pointer(p)).FpLeft - _ = libc.Int32FromInt32(0) } op = (*TExpr)(unsafe.Pointer(p)).Fop if int32(op) == int32(TK_REGISTER) { @@ -87157,7 +84426,6 @@ func _sqlite3ExprCanBeNull(tls *libc.TLS, p uintptr) (r int32) { case int32(TK_BLOB): return 0 case int32(TK_COLUMN): - _ = libc.Int32FromInt32(0) return libc.BoolInt32((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_CanBeNull)) != uint32(0) || *(*uintptr)(unsafe.Pointer(p + 64)) == uintptr(0) || int32((*TExpr)(unsafe.Pointer(p)).FiColumn) >= 0 && (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FaCol != uintptr(0) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FnCol) && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FaCol + uintptr((*TExpr)(unsafe.Pointer(p)).FiColumn)*16 + 8))&0xf>>0)) == 0) default: return int32(1) @@ -87205,7 +84473,7 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in case int32(TK_BLOB): return libc.BoolInt32(!(unaryMinus != 0)) case int32(TK_COLUMN): - _ = libc.Int32FromInt32(0) /* p cannot be part of a CHECK constraint */ + /* p cannot be part of a CHECK constraint */ return libc.BoolInt32(int32(aff) >= int32(SQLITE_AFF_NUMERIC) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < 0) default: return 0 @@ -87219,13 +84487,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r in // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7872) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7901) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7880) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7909) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7886) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7915) == 0 { return int32(1) } return 0 @@ -87243,11 +84511,10 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7872, - 1: __ccgo_ts + 7880, - 2: __ccgo_ts + 7886, + 0: __ccgo_ts + 7901, + 1: __ccgo_ts + 7909, + 2: __ccgo_ts + 7915, } - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(8))) { @@ -87263,6 +84530,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -87270,6 +84538,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -87301,7 +84570,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) != 0 { return uintptr(0) /* No DISTINCT keyword and no aggregate functions */ } - _ = libc.Int32FromInt32(0) /* Has no GROUP BY clause */ + /* Has no GROUP BY clause */ if (*TSelect)(unsafe.Pointer(p)).FpLimit != 0 { return uintptr(0) } /* Has no LIMIT clause */ @@ -87309,7 +84578,6 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { return uintptr(0) } /* Has no WHERE clause */ pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc - _ = libc.Int32FromInt32(0) if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc != int32(1) { return uintptr(0) } /* Single term in FROM clause */ @@ -87317,13 +84585,11 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { return uintptr(0) } /* FROM is not a subquery or view */ pTab = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* FROM clause is not a view */ + /* FROM clause is not a view */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { return uintptr(0) } /* FROM clause not a virtual table */ pEList = (*TSelect)(unsafe.Pointer(p)).FpEList - _ = libc.Int32FromInt32(0) /* All SELECT results must be columns. */ i = 0 for { @@ -87334,9 +84600,10 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { if int32((*TExpr)(unsafe.Pointer(pRes)).Fop) != int32(TK_COLUMN) { return uintptr(0) } - _ = libc.Int32FromInt32(0) /* Not a correlated subquery */ + /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -87370,7 +84637,6 @@ func _sqlite3InRhsIsConstant(tls *libc.TLS, pIn uintptr) (r int32) { var pLHS uintptr var res int32 _, _ = pLHS, res - _ = libc.Int32FromInt32(0) pLHS = (*TExpr)(unsafe.Pointer(pIn)).FpLeft (*TExpr)(unsafe.Pointer(pIn)).FpLeft = uintptr(0) res = _sqlite3ExprIsConstant(tls, pIn) @@ -87475,7 +84741,6 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = affinity_ok, cmpaff, colUsed, db, eType, i, i1, i2, iAddr, iAddr1, iCol, iDb, iTab, idxaff, j, mCol, mustBeUnique, n, nExpr, p, pEList, pEList1, pIdx, pLhs, pLhs1, pReq, pRhs, pTab, rMayHaveNull, savedNQueryLoop, v, v1, v10, v11, v12, v13, v14, v2, v4, v5 /* SELECT to the right of IN operator */ eType = 0 /* True if RHS must be unique */ v = _sqlite3GetVdbe(tls, pParse) /* Virtual machine being coded */ - _ = libc.Int32FromInt32(0) mustBeUnique = libc.BoolInt32(inFlags&uint32(IN_INDEX_LOOP) != uint32(0)) v2 = pParse + 52 v1 = *(*int32)(unsafe.Pointer(v2)) @@ -87498,6 +84763,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -87515,22 +84781,21 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database idx for pTab */ pEList1 = (*TSelect)(unsafe.Pointer(p)).FpEList nExpr = (*TExprList)(unsafe.Pointer(pEList1)).FnExpr - _ = libc.Int32FromInt32(0) /* Because of isCandidateForInOpt(p) */ - _ = libc.Int32FromInt32(0) /* Because of isCandidateForInOpt(p) */ - _ = libc.Int32FromInt32(0) /* Because of isCandidateForInOpt(p) */ + /* Because of isCandidateForInOpt(p) */ + /* Because of isCandidateForInOpt(p) */ + /* Because of isCandidateForInOpt(p) */ pTab = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab /* Code an OP_Transaction and OP_TableLock for . */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab)).FzName) - _ = libc.Int32FromInt32(0) /* sqlite3GetVdbe() has always been previously called */ + /* sqlite3GetVdbe() has always been previously called */ if nExpr == int32(1) && int32((*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList1 + 8))).FpExpr)).FiColumn) < 0 { /* The "x IN (SELECT rowid FROM table)" case */ iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7919, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -87554,12 +84819,12 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 ** other has no affinity and the other side is TEXT. Hence, ** the only way for cmpaff to be TEXT is for idxaff to be TEXT ** and for the term on the LHS of the IN to have no affinity. */ - _ = libc.Int32FromInt32(0) default: affinity_ok = libc.BoolInt32(int32(idxaff) >= int32(SQLITE_AFF_NUMERIC)) } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -87602,13 +84867,13 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) != int32((*TExpr)(unsafe.Pointer(pRhs)).FiColumn) { goto _9 } - _ = libc.Int32FromInt32(0) if pReq != uintptr(0) && _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pReq)).FzName, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8))) != 0 { goto _9 } break goto _9 _9: + ; j++ } if j == nExpr { @@ -87624,16 +84889,15 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } - _ = libc.Int32FromInt32(0) if colUsed == libc.Uint64FromInt32(1)<. */ @@ -87985,6 +85242,7 @@ func _sqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iTab, r2, r1, int32(1)) goto _6 _6: + ; i1-- pItem += 32 } @@ -87999,8 +85257,6 @@ func _sqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), iTab) _sqlite3VdbeJumpHere(tls, v, addrOnce) /* Subroutine return */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*(*struct { FiAddr int32 FregReturn int32 @@ -88038,18 +85294,14 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 addrOnce = 0 /* Address of OP_Once at top of subroutine */ rReg = 0 /* New limit expression */ v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return 0 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pSel = *(*uintptr)(unsafe.Pointer(pExpr + 32)) /* If this routine has already been coded, then invoke it as a ** subroutine. */ if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Subrtn)) != uint32(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8066, libc.VaList(bp+48, (*TSelect)(unsafe.Pointer(pSel)).FselId)) - _ = libc.Int32FromInt32(0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8095, libc.VaList(bp+48, (*TSelect)(unsafe.Pointer(pSel)).FselId)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*(*struct { FiAddr int32 FregReturn int32 @@ -88060,8 +85312,6 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 return (*TExpr)(unsafe.Pointer(pExpr)).FiTable } /* Begin coding the subroutine */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Subrtn)) v2 = pParse + 56 *(*int32)(unsafe.Pointer(v2))++ @@ -88101,11 +85351,11 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 ** preexisting limit is discarded in place of the new LIMIT 1. */ if addrOnce != 0 { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } else { - v3 = __ccgo_ts + 8035 + v3 = __ccgo_ts + 8064 } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+8084, libc.VaList(bp+48, v3, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+8113, libc.VaList(bp+48, v3, (*TSelect)(unsafe.Pointer(pSel)).FselId)) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) { v4 = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpEList)).FnExpr } else { @@ -88127,7 +85377,7 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 /* The subquery already has a limit. If the pre-existing limit is X ** then make the new limit X<>0 so that the new limit is either 1 or 0 */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb - pLimit = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1722) + pLimit = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1726) if pLimit != 0 { (*TExpr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = _sqlite3PExpr(tls, pParse, int32(TK_NE), _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpLimit)).FpLeft, 0), pLimit) @@ -88136,7 +85386,7 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { /* If there is no pre-existing limit add a limit of 1 */ - pLimit = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), __ccgo_ts+8105) + pLimit = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), __ccgo_ts+8134) (*TSelect)(unsafe.Pointer(pSel)).FpLimit = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), pLimit, uintptr(0)) } (*TSelect)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -88152,8 +85402,6 @@ func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int3 _sqlite3VdbeJumpHere(tls, v, addrOnce) } /* Subroutine return */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*(*struct { FiAddr int32 FregReturn int32 @@ -88235,7 +85483,6 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals destStep6 = 0 /* Top of the step-6 loop */ *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* Index to use */ okConstFactor = (*TParse)(unsafe.Pointer(pParse)).FokConstFactor - _ = libc.Int32FromInt32(0) pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft if _sqlite3ExprCheckIN(tls, pParse, pExpr) != 0 { return @@ -88251,14 +85498,13 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals ** contains the values that make up the RHS. If IN_INDEX_NOOP is returned, ** the RHS has not yet been coded. */ v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) /* OOM detected prior to this routine */ + /* OOM detected prior to this routine */ if destIfFalse == destIfNull { v1 = uintptr(0) } else { v1 = bp } eType = _sqlite3FindInIndex(tls, pParse, pExpr, uint32(libc.Int32FromInt32(IN_INDEX_MEMBERSHIP)|libc.Int32FromInt32(IN_INDEX_NOOP_OK)), v1, aiMap, bp+8) - _ = libc.Int32FromInt32(0) /* Code the LHS, the from " IN (...)". If the LHS is a ** vector, then it is stored in an array of nVector registers starting ** at r1. @@ -88271,7 +85517,6 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals ** Avoid factoring the LHS of the IN(...) expression out of the loop, ** even if it is constant, as OP_Affinity may be used on the register ** by code generated below. */ - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) rLhsOrig = _exprCodeVector(tls, pParse, pLeft, bp+4) (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor @@ -88282,6 +85527,7 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals } goto _2 _2: + ; i++ } /* Are LHS fields reordered? */ if i == nVector { @@ -88298,6 +85544,7 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), rLhsOrig+i, rLhs+*(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)), 0) goto _3 _3: + ; i++ } } @@ -88310,7 +85557,6 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals if eType == int32(IN_INDEX_NOOP) { labelOk = _sqlite3VdbeMakeLabel(tls, pParse) regCkNull = 0 - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) if destIfNull != destIfFalse { @@ -88343,12 +85589,12 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals v6 = int32(OP_IsNull) } op1 = v6 - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4(tls, v, op1, rLhs, destIfFalse, r2, pColl, -int32(2)) _sqlite3VdbeChangeP5(tls, v, uint16(int32(*(*int8)(unsafe.Pointer(zAff)))|int32(SQLITE_JUMPIFNULL))) } goto _4 _4: + ; ii++ } if regCkNull != 0 { @@ -88384,6 +85630,7 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals } goto _8 _8: + ; i++ } /* Step 3. The LHS is now known to be non-NULL. Do the binary search @@ -88449,6 +85696,7 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals _sqlite3ReleaseTempReg(tls, pParse, r3) goto _9 _9: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, destIfNull) @@ -88462,10 +85710,12 @@ func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFals /* Jumps here in order to return true. */ _sqlite3VdbeJumpHere(tls, v, addrTruthOp) sqlite3ExprCodeIN_finished: + ; if rLhs != rLhsOrig { _sqlite3ReleaseTempReg(tls, pParse, rLhs) } sqlite3ExprCodeIN_oom_error: + ; _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiMap) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zAff) } @@ -88486,7 +85736,7 @@ func _codeReal(tls *libc.TLS, v uintptr, z uintptr, negateFlag int32, iMem int32 var _ /* value at bp+0 */ float64 if z != uintptr(0) { _sqlite3AtoF(tls, z, bp, _sqlite3Strlen30(tls, z), uint8(SQLITE_UTF8)) - _ = libc.Int32FromInt32(0) /* The new AtoF never returns NaN */ + /* The new AtoF never returns NaN */ if negateFlag != 0 { *(*float64)(unsafe.Pointer(bp)) = -*(*float64)(unsafe.Pointer(bp)) } @@ -88513,23 +85763,21 @@ func _codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, i v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_IntValue) != 0 { i = *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) - _ = libc.Int32FromInt32(0) if negFlag != 0 { i = -i } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), i, iMem) } else { z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) - _ = libc.Int32FromInt32(0) c = _sqlite3DecOrHexToI64(tls, z, bp) if c == int32(3) && !(negFlag != 0) || c == int32(2) || negFlag != 0 && *(*Ti64)(unsafe.Pointer(bp)) == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0 { iAddr = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNullRow), (*TParse)(unsafe.Pointer(pParse)).FiSelfTab-int32(1), 0, regOut) } else { @@ -88609,9 +85853,6 @@ func _sqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT var op, savedSelfTab, x int32 var pCol, pParse, v1, p2, p3 uintptr _, _, _, _, _, _, _, _ = op, pCol, pParse, savedSelfTab, x, v1, p2, p3 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iCol < 0 || iCol == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iTabCur, regOut) } else { @@ -88624,7 +85865,7 @@ func _sqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT if int32((*TColumn)(unsafe.Pointer(v1)).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pParse = _sqlite3VdbeParser(tls, v) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_BUSY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8166, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { savedSelfTab = (*TParse)(unsafe.Pointer(pParse)).FiSelfTab p2 = pCol + 14 @@ -88663,9 +85904,6 @@ func _sqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT func _sqlite3ExprCodeGetColumn(tls *libc.TLS, pParse uintptr, pTab uintptr, iColumn int32, iTable int32, iReg int32, p5 Tu8) (r int32) { var pOp uintptr _ = pOp - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3ExprCodeGetColumnOfTable(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, pTab, iTable, iColumn, iReg) if p5 != 0 { pOp = _sqlite3VdbeGetLastOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe) @@ -88734,7 +85972,6 @@ func _exprCodeVector(tls *libc.TLS, pParse uintptr, p uintptr, piFreeable uintpt } else { iResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += nResult - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nResult) { @@ -88743,6 +85980,7 @@ func _exprCodeVector(tls *libc.TLS, pParse uintptr, p uintptr, piFreeable uintpt _sqlite3ExprCodeFactorable(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, i+iResult) goto _1 _1: + ; i++ } } @@ -88778,10 +86016,8 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc var _ /* caseExpr at bp+0 */ TExpr _, _, _, _, _, _, _, _, _ = aff, azAff, endCoalesce, i, nFarg, pA1, pArg, v, v2 v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nFarg = (*TExprList)(unsafe.Pointer(pFarg)).FnExpr - _ = libc.Int32FromInt32(0) /* All in-line functions have at least one argument */ + /* All in-line functions have at least one argument */ switch iFuncId { case INLINEFUNC_coalesce: /* Attempt a direct implementation of the built-in COALESCE() and @@ -88789,7 +86025,6 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc ** arguments past the first non-NULL argument. */ endCoalesce = _sqlite3VdbeMakeLabel(tls, pParse) - _ = libc.Int32FromInt32(0) _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, target) i = int32(1) for { @@ -88800,6 +86035,7 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + uintptr(i)*32))).FpExpr, target) goto _1 _1: + ; i++ } _setDoNotMergeFlagOnCopy(tls, v) @@ -88820,7 +86056,6 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc /* The UNLIKELY() function is a no-op. The result is the value ** of the first argument. */ - _ = libc.Int32FromInt32(0) target = _sqlite3ExprCodeTarget(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, target) break /*********************************************************************** @@ -88830,14 +86065,11 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc fallthrough case int32(INLINEFUNC_expr_compare): /* Compare two expressions using sqlite3ExprCompare() */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr, -int32(1)), target) case int32(INLINEFUNC_expr_implies_expr): /* Compare two expressions using sqlite3ExprImpliesExpr() */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprImpliesExpr(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr, -int32(1)), target) case int32(INLINEFUNC_implies_nonnull_row): - _ = libc.Int32FromInt32(0) pA1 = (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr if int32((*TExpr)(unsafe.Pointer(pA1)).Fop) == int32(TK_COLUMN) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprImpliesNonNullRow(tls, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*TExpr)(unsafe.Pointer(pA1)).FiTable, int32(1)), target) @@ -88850,18 +86082,16 @@ func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFunc ** the SQLite type logic. */ azAff = [6]uintptr{ - 0: __ccgo_ts + 8167, - 1: __ccgo_ts + 8172, - 2: __ccgo_ts + 8177, - 3: __ccgo_ts + 6281, - 4: __ccgo_ts + 6276, - 5: __ccgo_ts + 8185, - } - _ = libc.Int32FromInt32(0) + 0: __ccgo_ts + 8196, + 1: __ccgo_ts + 8201, + 2: __ccgo_ts + 8206, + 3: __ccgo_ts + 6310, + 4: __ccgo_ts + 6305, + 5: __ccgo_ts + 8214, + } aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr) - _ = libc.Int32FromInt32(0) if int32(aff) <= int32(SQLITE_AFF_NONE) { - v2 = __ccgo_ts + 8193 + v2 = __ccgo_ts + 8222 } else { v2 = azAff[int32(aff)-int32(SQLITE_AFF_BLOB)] } @@ -88902,14 +86132,12 @@ func _sqlite3IndexedExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, tar if _sqlite3ExprCompare(tls, uintptr(0), pExpr, (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr, iDataCur) != 0 { goto _1 } - _ = libc.Int32FromInt32(0) exprAff = uint8(_sqlite3ExprAffinity(tls, pExpr)) if int32(exprAff) <= int32(SQLITE_AFF_BLOB) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_BLOB) || int32(exprAff) == int32(SQLITE_AFF_TEXT) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_TEXT) || int32(exprAff) >= int32(SQLITE_AFF_NUMERIC) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_NUMERIC) { /* Affinity mismatch on a generated column */ goto _1 } v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) if (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow != 0 { /* If the index is on a NULL row due to an outer join, then we ** cannot extract the value from the index. The value must be @@ -88929,6 +86157,7 @@ func _sqlite3IndexedExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, tar return target goto _1 _1: + ; p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext } return -int32(1) /* Not found */ @@ -88971,6 +86200,7 @@ func _exprPartidxExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTarge } goto _1 _1: + ; p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext } return 0 @@ -89007,9 +86237,8 @@ func _sqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target *(*int32)(unsafe.Pointer(bp)) = 0 /* If non-zero free this temporary register */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Temporary expression node */ p5 = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) expr_code_doover: + ; if pExpr == uintptr(0) { op = int32(TK_NULL) } else { @@ -89020,16 +86249,12 @@ expr_code_doover: if v2 && v1 >= 0 { return r1 } else { - _ = libc.Int32FromInt32(0) op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) } } - _ = libc.Int32FromInt32(0) switch op { case int32(TK_AGG_COLUMN): pAggInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn { /* Happens when the left table of a RIGHT JOIN is null and ** is using an expression index */ @@ -89038,7 +86263,6 @@ expr_code_doover: } pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiAgg)*24 if !((*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode != 0) { - _ = libc.Int32FromInt32(0) return (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } else { if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FuseSortingIdx != 0 { @@ -89069,12 +86293,8 @@ expr_code_doover: iTab = (*TExpr)(unsafe.Pointer(pExpr)).FiTable if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != uint32(0) { iReg = _sqlite3ExprCodeTarget(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aff = int32(_sqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn))) if aff > int32(SQLITE_AFF_BLOB) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), iReg, int32(1), 0, uintptr(unsafe.Pointer(&_zAff))+uintptr((aff-int32('B'))*int32(2)), -int32(1)) } return iReg @@ -89082,11 +86302,7 @@ expr_code_doover: if iTab < 0 { if (*TParse)(unsafe.Pointer(pParse)).FiSelfTab < 0 { iCol = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) - _ = libc.Int32FromInt32(0) pTab1 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if iCol < 0 { return -int32(1) - (*TParse)(unsafe.Pointer(pParse)).FiSelfTab } @@ -89094,7 +86310,7 @@ expr_code_doover: iSrc = int32(_sqlite3TableColumnToStorage(tls, pTab1, int16(iCol))) - (*TParse)(unsafe.Pointer(pParse)).FiSelfTab if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_BUSY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+160, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8166, libc.VaList(bp+160, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) return 0 } p3 = pCol1 + 14 @@ -89128,8 +86344,6 @@ expr_code_doover: return r1 } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iReg = _sqlite3ExprCodeGetColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn), iTab, target, (*TExpr)(unsafe.Pointer(pExpr)).Fop2) return iReg case int32(TK_INTEGER): @@ -89139,11 +86353,9 @@ expr_code_doover: _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprTruthValue(tls, pExpr), target) return target case int32(TK_FLOAT): - _ = libc.Int32FromInt32(0) _codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pExpr + 8)), 0, target) return target case int32(TK_STRING): - _ = libc.Int32FromInt32(0) _sqlite3VdbeLoadString(tls, v, target, *(*uintptr)(unsafe.Pointer(pExpr + 8))) return target default: @@ -89151,27 +86363,18 @@ expr_code_doover: ** Expr node to be passed into this function, it will be handled ** sanely and not crash. But keep the assert() to bring the problem ** to the attention of the developers. */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) return target case int32(TK_BLOB): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + 2 n = _sqlite3Strlen30(tls, z) - int32(1) - _ = libc.Int32FromInt32(0) zBlob = _sqlite3HexToBlob(tls, _sqlite3VdbeDb(tls, v), z, n) _sqlite3VdbeAddOp4(tls, v, int32(OP_Blob), n/int32(2), target, 0, zBlob, -int32(6)) return target case int32(TK_VARIABLE): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Variable), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn), target) if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8)) + 1))) != 0 { z1 = _sqlite3VListNumToName(tls, (*TParse)(unsafe.Pointer(pParse)).FpVList, int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)) - _ = libc.Int32FromInt32(0) *(*TVList)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpVList)) = 0 /* Indicate VList may no longer be enlarged */ _sqlite3VdbeAppendP4(tls, v, z1, -int32(1)) } @@ -89181,8 +86384,6 @@ expr_code_doover: case int32(TK_CAST): /* Expressions of the form: CAST(pLeft AS token) */ _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Cast), target, int32(_sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0)))) return inReg case int32(TK_IS): @@ -89216,12 +86417,6 @@ expr_code_doover: r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), inReg) _codeCompare(tls, pParse, pLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), p5, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if p5 == int32(SQLITE_NULLEQ) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, inReg) } else { @@ -89251,29 +86446,16 @@ expr_code_doover: case int32(TK_RSHIFT): fallthrough case int32(TK_CONCAT): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) _sqlite3VdbeAddOp3(tls, v, op, r2, r1, target) case int32(TK_UMINUS): pLeft1 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pLeft1)).Fop) == int32(TK_INTEGER) { _codeInteger(tls, pParse, pLeft1, int32(1), target) return target } else { if int32((*TExpr)(unsafe.Pointer(pLeft1)).Fop) == int32(TK_FLOAT) { - _ = libc.Int32FromInt32(0) _codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pLeft1 + 8)), int32(1), target) return target } else { @@ -89288,11 +86470,9 @@ expr_code_doover: case int32(TK_BITNOT): fallthrough case int32(TK_NOT): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeAddOp2(tls, v, op, r1, inReg) - case int32(TK_TRUTH): + case int32(TK_TRUTH): /* IS TRUE or IS FALSE */ r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) bNormal = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_IS)) @@ -89300,8 +86480,6 @@ expr_code_doover: case int32(TK_ISNULL): fallthrough case int32(TK_NOTNULL): - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), target) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) addr = _sqlite3VdbeAddOp1(tls, v, op, r1) @@ -89310,13 +86488,11 @@ expr_code_doover: case int32(TK_AGG_FUNCTION): pInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo if pInfo == uintptr(0) || int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) < 0 || int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { - _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8198, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8227, libc.VaList(bp+160, pExpr)) } else { - _ = libc.Int32FromInt32(0) return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -89329,8 +86505,6 @@ expr_code_doover: ** multiple times if we know they always give the same result */ return _sqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, -int32(1)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pFarg = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pFarg != 0 { v8 = (*TExprList)(unsafe.Pointer(pFarg)).FnExpr @@ -89338,16 +86512,13 @@ expr_code_doover: v8 = 0 } nFarg = v8 - _ = libc.Int32FromInt32(0) zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8254, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _exprCodeInlineFunction(tls, pParse, pFarg, int32(int64((*TFuncDef)(unsafe.Pointer(pDef)).FpUserData)), target) } else { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_DIRECT)|libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) != 0 { @@ -89367,6 +86538,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -89382,14 +86554,8 @@ expr_code_doover: ** unnecessary data loading. */ if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_LENGTH)|libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)) != uint32(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) exprOp = (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr)).Fop if int32(exprOp) == int32(TK_COLUMN) || int32(exprOp) == int32(TK_AGG_COLUMN) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr)).Fop2 = uint8((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags & uint32(OPFLAG_BYTELENARG)) } } @@ -89452,10 +86618,9 @@ expr_code_doover: (*TExpr)(unsafe.Pointer(pLeft2)).FiTable = _sqlite3CodeSubselect(tls, pParse, pLeft2) (*TExpr)(unsafe.Pointer(pLeft2)).Fop2 = (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn } - _ = libc.Int32FromInt32(0) n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7837, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -89490,7 +86655,6 @@ expr_code_doover: ** from outer queries into sub-queries by the push-down optimization. ** Clear subtypes as subtypes may not cross a subquery boundary. */ - _ = libc.Int32FromInt32(0) _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) _sqlite3VdbeAddOp1(tls, v, int32(OP_ClrSubtype), target) return target @@ -89505,14 +86669,9 @@ expr_code_doover: pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft goto expr_code_doover /* 2018-04-28: Prevent deep recursion. OSSFuzz. */ case int32(TK_TRIGGER): - _ = libc.Int32FromInt32(0) pTab2 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) iCol1 = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) p1 = (*TExpr)(unsafe.Pointer(pExpr)).FiTable*(int32((*TTable)(unsafe.Pointer(pTab2)).FnCol)+int32(1)) + int32(1) + int32(_sqlite3TableColumnToStorage(tls, pTab2, int16(iCol1))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Param), p1, target) /* If the column has REAL affinity, it may currently be stored as an ** integer. Use OP_RealAffinity to make sure it is really real. @@ -89523,7 +86682,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6681, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -89536,9 +86695,7 @@ expr_code_doover: okConstFactor = (*TParse)(unsafe.Pointer(pParse)).FokConstFactor pAggInfo1 = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo if pAggInfo1 != 0 { - _ = libc.Int32FromInt32(0) if !((*TAggInfo)(unsafe.Pointer(pAggInfo1)).FdirectMode != 0) { - _ = libc.Int32FromInt32(0) inReg = (*TAggInfo)(unsafe.Pointer(pAggInfo1)).FiFirstReg + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) break } @@ -89558,7 +86715,6 @@ expr_code_doover: */ (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) /* note (1) above */ _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor _sqlite3VdbeJumpHere(tls, v, addrINR) break @@ -89584,12 +86740,10 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pEList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) aListelem = pEList + 8 nExpr = (*TExprList)(unsafe.Pointer(pEList)).FnExpr @@ -89619,7 +86773,6 @@ expr_code_doover: break } if pX != 0 { - _ = libc.Int32FromInt32(0) (*(*TExpr)(unsafe.Pointer(bp + 80))).FpRight = (*(*TExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32))).FpExpr } else { pTest = (*(*TExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32))).FpExpr @@ -89631,6 +86784,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -89642,15 +86796,13 @@ expr_code_doover: _setDoNotMergeFlagOnCopy(tls, v) _sqlite3VdbeResolveLabel(tls, v, endLabel) case int32(TK_RAISE): - _ = libc.Int32FromInt32(0) if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8249, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8278, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { _sqlite3MayAbort(tls, pParse) } - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Ignore) { _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), SQLITE_OK, int32(OE_Ignore), 0, *(*uintptr)(unsafe.Pointer(pExpr + 8)), 0) } else { @@ -89693,8 +86845,6 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r var addr, i, v2, v4 int32 var p, pItem, pItem1, v, v3, v5 uintptr _, _, _, _, _, _, _, _, _, _ = addr, i, p, pItem, pItem1, v, v2, v3, v4, v5 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p = (*TParse)(unsafe.Pointer(pParse)).FpConstExpr if regDest < 0 && p != 0 { pItem = p + 8 @@ -89708,6 +86858,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -89715,7 +86866,6 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r pExpr = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) if pExpr != uintptr(0) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_HasFunc)) != uint32(0) { v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) addr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { @@ -89795,9 +86945,6 @@ func _sqlite3ExprCode(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32 var op Tu8 var pX uintptr _, _, _ = inReg, op, pX - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FpVdbe == uintptr(0) { return } @@ -89882,9 +87029,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } copyOp = uint8(v1) v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Never gets this far otherwise */ + /* Never gets this far otherwise */ n = (*TExprList)(unsafe.Pointer(pList)).FnExpr if !((*TParse)(unsafe.Pointer(pParse)).FokConstFactor != 0) { flags = Tu8(int32(flags) & ^libc.Int32FromInt32(SQLITE_ECEL_FACTOR)) @@ -89930,6 +87075,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -89973,7 +87119,6 @@ func _exprCodeBetween(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, libc.Xmemset(tls, bp+72, 0, uint64(72)) libc.Xmemset(tls, bp+144, 0, uint64(72)) libc.Xmemset(tls, bp, 0, uint64(72)) - _ = libc.Int32FromInt32(0) pDel = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, 0) if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_AND) @@ -90031,14 +87176,12 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 op = 0 *(*int32)(unsafe.Pointer(bp)) = 0 *(*int32)(unsafe.Pointer(bp + 4)) = 0 - _ = libc.Int32FromInt32(0) if v == uintptr(0) { return } /* Existence of VDBE checked by caller */ if pExpr == uintptr(0) { return } /* No way this can happen */ - _ = libc.Int32FromInt32(0) op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) switch op { case int32(TK_OR): @@ -90078,7 +87221,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -90095,9 +87240,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90117,7 +87264,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -90126,36 +87275,38 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -90168,7 +87319,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90181,6 +87334,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90208,14 +87362,12 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 op = 0 *(*int32)(unsafe.Pointer(bp)) = 0 *(*int32)(unsafe.Pointer(bp + 4)) = 0 - _ = libc.Int32FromInt32(0) if v == uintptr(0) { return } /* Existence of VDBE checked by caller */ if pExpr == uintptr(0) { return } - _ = libc.Int32FromInt32(0) /* The value of pExpr->op and op are related as follows: ** ** pExpr->op op @@ -90237,14 +87389,6 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + libc.Int32FromInt32(TK_ISNULL)&libc.Int32FromInt32(1) ^ int32(1) - libc.Int32FromInt32(TK_ISNULL)&libc.Int32FromInt32(1) /* Verify correct alignment of TK_ and OP_ constants */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { case int32(TK_OR): goto _1 @@ -90283,7 +87427,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -90300,9 +87446,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90324,7 +87472,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -90333,34 +87483,38 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -90370,7 +87524,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90383,6 +87539,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90512,14 +87669,11 @@ func _sqlite3ExprCompare(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, return int32(2) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pA + 8)) != 0 { if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_FUNCTION) || int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_AGG_FUNCTION) { if _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8)), *(*uintptr)(unsafe.Pointer(pB + 8))) != 0 { return int32(2) } - _ = libc.Int32FromInt32(0) if libc.BoolInt32((*TExpr)(unsafe.Pointer(pA)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0)) != libc.BoolInt32((*TExpr)(unsafe.Pointer(pB)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0)) { return int32(2) } @@ -90623,6 +87777,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -90649,8 +87804,6 @@ func _sqlite3ExprCompareSkip(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) func _exprImpliesNotNull(tls *libc.TLS, pParse uintptr, p uintptr, pNN uintptr, iTab int32, seenNot int32) (r int32) { var pList uintptr _ = pList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3ExprCompare(tls, pParse, p, pNN, iTab) == 0 { return libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pNN)).Fop) != int32(TK_NULL)) } @@ -90659,13 +87812,9 @@ func _exprImpliesNotNull(tls *libc.TLS, pParse uintptr, p uintptr, pNN uintptr, if seenNot != 0 && (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_xIsSelect)) != uint32(0) { return 0 } - _ = libc.Int32FromInt32(0) return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, int32(1)) case int32(TK_BETWEEN): - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(p + 32)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if seenNot != 0 { return 0 } @@ -90844,6 +87993,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -90858,8 +88014,6 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_BETWEEN): /* In "x NOT BETWEEN y AND z" either x must be non-null-row or else ** both y and z must be non-null row */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) _bothImplyNotNullRow(tls, pWalker, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr) return int32(WRC_Prune) @@ -90882,8 +88036,6 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight /* The y.pTab=0 assignment in wherecode.c always happens after the ** impliesNotNullRow() test */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) == int32(TK_COLUMN) && *(*uintptr)(unsafe.Pointer(pLeft + 64)) != uintptr(0) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64)))).FeTabType) == int32(TABTYP_VTAB) || int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && *(*uintptr)(unsafe.Pointer(pRight + 64)) != uintptr(0) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64)))).FeTabType) == int32(TABTYP_VTAB) { return int32(WRC_Prune) } @@ -91049,6 +88201,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -91061,7 +88214,6 @@ func _selectRefLeave(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pSrc = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc if (*TRefSrcList)(unsafe.Pointer(p)).FnExclude != 0 { - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(p + 16)) -= int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) } } @@ -91101,6 +88253,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -91110,6 +88263,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -91142,7 +88296,6 @@ func _sqlite3ReferencesSrcList(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSr defer tls.Free(80) var _ /* w at bp+0 */ TWalker var _ /* x at bp+48 */ TRefSrcList - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(48)) libc.Xmemset(tls, bp+48, 0, uint64(32)) (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprRefToSrcList) @@ -91151,13 +88304,8 @@ func _sqlite3ReferencesSrcList(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSr *(*uintptr)(unsafe.Pointer(bp + 40)) = bp + 48 (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).Fdb = (*TParse)(unsafe.Pointer(pParse)).Fdb (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).FpRef = pSrcList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WalkExprList(tls, bp, *(*uintptr)(unsafe.Pointer(pExpr + 32))) if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WalkExprList(tls, bp, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) } if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -91200,7 +88348,6 @@ func _agginfoPersistExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int iAgg = int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { if iAgg < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn && (*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(iAgg)*24))).FpCExpr == pExpr { pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) @@ -91210,7 +88357,6 @@ func _agginfoPersistExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int } } } else { - _ = libc.Int32FromInt32(0) if iAgg < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(iAgg)*32))).FpFExpr == pExpr { pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) if pExpr != 0 { @@ -91278,7 +88424,6 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, var pCol, pE, pGB, pTerm, v4 uintptr var v3 Tu16 _, _, _, _, _, _, _, _, _ = j, k, n, pCol, pE, pGB, pTerm, v3, v4 - _ = libc.Int32FromInt32(0) pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol k = 0 for { @@ -91293,17 +88438,16 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } k = _addAggInfoColumn(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pAggInfo) if k < 0 { /* OOM on resize */ - _ = libc.Int32FromInt32(0) return } pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(k)*24 - _ = libc.Int32FromInt32(0) (*TAggInfo_col)(unsafe.Pointer(pCol)).FpTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) (*TAggInfo_col)(unsafe.Pointer(pCol)).FiTable = (*TExpr)(unsafe.Pointer(pExpr)).FiTable (*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn = (*TExpr)(unsafe.Pointer(pExpr)).FiColumn @@ -91325,6 +88469,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -91336,7 +88481,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: - _ = libc.Int32FromInt32(0) + ; (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) @@ -91363,11 +88508,8 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList pAggInfo = *(*uintptr)(unsafe.Pointer(pNC + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { default: - _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_InAggFunc) == 0 { break } @@ -91388,6 +88530,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -91406,6 +88549,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -91429,8 +88573,6 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return int32(WRC_Abort) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*(*TExpr)(unsafe.Pointer(bp))).FiAgg)*24))).FpCExpr = pExpr (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo (*TExpr)(unsafe.Pointer(pExpr)).FiAgg = (*(*TExpr)(unsafe.Pointer(bp))).FiAgg @@ -91449,13 +88591,13 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) if !(i < (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc) { break } - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor { _findOrCreateAggInfoColumn(tls, pParse, pAggInfo, pExpr) break } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -91480,6 +88622,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -91489,10 +88632,8 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc i = _addAggInfoFunc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pAggInfo) if i >= 0 { - _ = libc.Int32FromInt32(0) pItem1 = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32 (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFExpr = pExpr - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 { v5 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr } else { @@ -91500,18 +88641,12 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } nArg = v5 (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFunc = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(pExpr + 8)), nArg, enc, uint8(0)) - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 && (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) == uint32(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v7 = pParse + 52 v6 = *(*int32)(unsafe.Pointer(v7)) *(*int32)(unsafe.Pointer(v7))++ (*TAggInfo_func)(unsafe.Pointer(pItem1)).FiOBTab = v6 pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TExprList)(unsafe.Pointer(pOBList)).FnExpr == int32(1) && nArg == int32(1) && _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pOBList + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr, 0) == 0 { (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBPayload = uint8(0) (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBUnique = libc.BoolUint8((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)) != libc.Uint32FromInt32(0)) @@ -91534,7 +88669,6 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry */ - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FiAgg = int16(i) (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo return int32(WRC_Prune) @@ -91566,7 +88700,6 @@ func _sqlite3ExprAnalyzeAggregates(tls *libc.TLS, pNC uintptr, pExpr uintptr) { (*(*TWalker)(unsafe.Pointer(bp))).FwalkerDepth = 0 *(*uintptr)(unsafe.Pointer(bp + 40)) = pNC (*(*TWalker)(unsafe.Pointer(bp))).FpParse = uintptr(0) - _ = libc.Int32FromInt32(0) _sqlite3WalkExpr(tls, bp, pExpr) } @@ -91592,6 +88725,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -91725,6 +88859,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -91775,8 +88910,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8299, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6529, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8328, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -91795,9 +88930,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8327, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8356, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8502, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8531, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -91813,9 +88948,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8676, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8705, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8823, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8852, 0) } } @@ -91856,8 +88991,6 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_rename_table } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pSrc+8) if !(pTab != 0) { goto exit_rename_table @@ -91873,7 +89006,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8974, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9003, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -91882,11 +89015,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9033, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9062, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9068, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -91916,21 +89049,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9095, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9250, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9279, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9555, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9571, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9584, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9600, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9629, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9658, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -91946,8 +89079,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9894, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9923, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -91961,7 +89095,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9907, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9936, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -91982,21 +89116,16 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr var _ /* pVal at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, iDb, pCol, pDflt, pNew, pTab, r1, rc, v, zCol, zDb, zEnd, zTab, v1 /* Temporary registers */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return } - _ = libc.Int32FromInt32(0) pNew = (*TParse)(unsafe.Pointer(pParse)).FpNewTable - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pNew)).FpSchema) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName zTab = (*TTable)(unsafe.Pointer(pNew)).FzName + 16 /* Skip the "sqlite_altertab_" prefix on the name */ pCol = (*TTable)(unsafe.Pointer(pNew)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))*16 pDflt = _sqlite3ColumnExpr(tls, pNew, pCol) pTab = _sqlite3FindTable(tls, db, zTab, zDb) - _ = libc.Int32FromInt32(0) /* Invoke the authorization callback. */ if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { return @@ -92006,11 +89135,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9974, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9977, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10006, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -92018,20 +89147,18 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** literal NULL, then set pDflt to 0. This simplifies checking ** for an SQL NULL default below. */ - _ = libc.Int32FromInt32(0) if pDflt != 0 && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pDflt)).FpLeft)).Fop) == int32(TK_NULL) { pDflt = uintptr(0) } - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 && (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10004) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10033) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10063) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10092) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -92039,19 +89166,17 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr if pDflt != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) rc = _sqlite3ValueFromExpr(tls, db, pDflt, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp) - _ = libc.Int32FromInt32(0) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10116) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10145) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10162) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10191) } } /* Modify the CREATE TABLE statement. */ @@ -92065,9 +89190,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10189, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10218, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -92095,7 +89218,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10335, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10364, libc.VaList(bp+16, zTab, zDb)) } } } @@ -92125,8 +89248,6 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { _, _, _, _, _, _, _ = db, i, iDb, nAlloc, pCol, pNew, pTab db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Look up the table being altered. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_begin_add_column } @@ -92135,20 +89256,18 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10688, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10717, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10722, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10751, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_begin_add_column } _sqlite3MayAbort(tls, pParse) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) /* Put a copy of the Table struct in Parse.pNewTable for the ** sqlite3AddColumn() function and friends to modify. But modify @@ -92164,13 +89283,10 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TParse)(unsafe.Pointer(pParse)).FpNewTable = pNew (*TTable)(unsafe.Pointer(pNew)).FnTabRef = uint32(1) (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol - _ = libc.Int32FromInt32(0) nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10752, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10781, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { - _ = libc.Int32FromInt32(0) goto exit_begin_add_column } libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pNew)).FaCol, (*TTable)(unsafe.Pointer(pTab)).FaCol, uint64(16)*uint64((*TTable)(unsafe.Pointer(pNew)).FnCol)) @@ -92184,9 +89300,9 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -92206,8 +89322,8 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pTab + 64))).FaddColOffset - _ = libc.Int32FromInt32(0) exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -92229,18 +89345,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10800 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10776 + zType = __ccgo_ts + 10805 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10790 + v1 = __ccgo_ts + 10819 } else { - v1 = __ccgo_ts + 10807 + v1 = __ccgo_ts + 10836 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10825, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10854, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92276,7 +89392,6 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } /* Which schema holds the table to be altered */ iSchema = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*32))).FzDbSName /* Invoke the authorization callback. */ if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { @@ -92298,14 +89413,15 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10872, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+1648, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+1652, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1))) /* Do the rename operation using a recursive UPDATE statement that ** uses the sqlite_rename_column() SQL function to compute the new @@ -92316,14 +89432,14 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld if !(zNew != 0) { goto exit_rename_column } - _ = libc.Int32FromInt32(0) bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10864, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11046, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10893, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11075, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9894, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9923, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -92398,7 +89514,6 @@ type RenameCtx1 = TRenameCtx1 func _sqlite3RenameTokenMap(tls *libc.TLS, pParse uintptr, pPtr uintptr, pToken uintptr) (r uintptr) { var pNew uintptr _ = pNew - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != int32(PARSE_MODE_UNMAP) { pNew = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(32)) if pNew != 0 { @@ -92432,6 +89547,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -92469,7 +89585,6 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { if pWith != 0 { pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse pCopy = uintptr(0) - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer((*(*TCte)(unsafe.Pointer(pWith + 16))).FpSelect)).FselFlags&uint32(SF_Expanded) == uint32(0) { /* Push a copy of the With object onto the with-stack. We use a copy ** here as the original will be expanded and resolved (flags SF_Expanded @@ -92497,6 +89612,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -92513,7 +89629,6 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { var ii int32 _ = ii - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < (*TIdList)(unsafe.Pointer(pIdList)).FnId) { @@ -92522,6 +89637,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -92554,6 +89670,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -92572,6 +89689,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92627,6 +89745,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -92649,6 +89768,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -92687,6 +89807,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -92757,6 +89878,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -92766,6 +89888,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -92789,11 +89912,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11206 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11179, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11208, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -92822,6 +89945,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -92850,6 +89974,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -92868,8 +89993,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11202, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11231, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -92885,7 +90010,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -92924,13 +90049,12 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11210, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11239, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { nQuot = int64(_sqlite3Strlen30(tls, zQuot) - int32(1)) } - _ = libc.Int32FromInt32(0) zOut = _sqlite3DbMallocZero(tls, db, uint64(nSql+int64((*TRenameCtx)(unsafe.Pointer(pRename)).FnList)*nQuot+int64(1))) } else { zOut = _sqlite3DbMallocZero(tls, db, uint64((nSql*int64(2)+int64(1))*int64(3))) @@ -92970,11 +90094,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 _sqlite3Dequote(tls, zBuf1) if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11206 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11216, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11245, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -93010,10 +90134,10 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { break } - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -93039,7 +90163,6 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { rc = SQLITE_OK libc.Xmemset(tls, bp, 0, uint64(56)) (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab = _sqlite3FindTable(tls, db, (*TTrigger)(unsafe.Pointer(pNew)).Ftable, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(_sqlite3SchemaToIndex(tls, db, (*TTrigger)(unsafe.Pointer(pNew)).FpTabSchema))*32))).FzDbSName) (*TParse)(unsafe.Pointer(pParse)).FeTriggerOp = (*TTrigger)(unsafe.Pointer(pNew)).Fop /* ALWAYS() because if the table of the trigger does not exist, the @@ -93088,8 +90211,6 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { v2 = SQLITE_OK } rc = v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList != 0 { (*TSelect)(unsafe.Pointer(pSel)).FpEList = uintptr(0) } @@ -93108,6 +90229,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -93121,7 +90243,6 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { if rc == SQLITE_OK { rc = _sqlite3ResolveExprListNames(tls, bp, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList) } - _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0 && rc == SQLITE_OK { pUpsert = (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc = pSrc @@ -93148,6 +90269,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -93190,11 +90312,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93353,6 +90477,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -93363,6 +90488,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -93374,10 +90500,10 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } - _ = libc.Int32FromInt32(0) pFKey = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -93400,10 +90526,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93435,6 +90563,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -93445,15 +90574,15 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _renameWalkTrigger(tls, bp+456, (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTrigger) } } - _ = libc.Int32FromInt32(0) rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) } else { if (*(*TParse)(unsafe.Pointer(bp + 32))).FzErrMsg != 0 { - _renameColumnParseError(tls, context, __ccgo_ts+1648, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32) + _renameColumnParseError(tls, context, __ccgo_ts+1652, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -93495,7 +90624,6 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in return int32(WRC_Prune) } if pSrc == uintptr(0) { - _ = libc.Int32FromInt32(0) return int32(WRC_Abort) } i = 0 @@ -93509,6 +90637,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -93578,7 +90707,6 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTab)).Fu))).FpSelect libc.Xmemset(tls, bp+504, 0, uint64(56)) (*(*TNameContext)(unsafe.Pointer(bp + 504))).FpParse = bp - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pSelect + 4)) &= uint32(^libc.Int32FromInt32(SF_View)) _sqlite3SelectPrep(tls, bp, (*(*struct { FpSelect uintptr @@ -93594,7 +90722,6 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } else { /* Modify any FK definitions to point to the new table. */ if (isLegacy == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - _ = libc.Int32FromInt32(0) pFKey = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -93609,6 +90736,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93658,11 +90786,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93678,7 +90808,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + 3*8))) } else { if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { - _renameColumnParseError(tls, context, __ccgo_ts+1648, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp) + _renameColumnParseError(tls, context, __ccgo_ts+1652, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -93782,6 +90912,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -93939,7 +91070,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -93947,7 +91078,6 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pEnd = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol+int32(1))*16))).FzCnName) zEnd = (*TRenameToken)(unsafe.Pointer(pEnd)).Ft.Fz } else { - _ = libc.Int32FromInt32(0) zEnd = zSql + uintptr((*(*struct { FaddColOffset int32 FpFKey uintptr @@ -93957,10 +91087,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11221, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11250, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -93987,8 +91118,6 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database containing pTab ("main" etc.) */ zCol = uintptr(0) /* Index of column zCol in pTab->aCol[] */ /* Look up the table being altered. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_drop_column } @@ -94007,44 +91136,42 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName /* Find the index of the column being dropped. */ zCol = _sqlite3NameFromToken(tls, db, pName) if zCol == uintptr(0) { - _ = libc.Int32FromInt32(0) goto exit_drop_column } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10872, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11228 + v1 = __ccgo_ts + 11257 } else { - v1 = __ccgo_ts + 5564 + v1 = __ccgo_ts + 5593 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11240, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11269, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11268, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11297, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName /* Invoke the authorization callback. */ if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol) != 0 { goto exit_drop_column } - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1648, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1652, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11316, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11345, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11437, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11466, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -94074,6 +91201,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -94107,6 +91235,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -94126,6 +91255,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -94143,27 +91273,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11455, + FzName: __ccgo_ts + 11484, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11476, + FzName: __ccgo_ts + 11505, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11496, + FzName: __ccgo_ts + 11525, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11515, + FzName: __ccgo_ts + 11544, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11534, + FzName: __ccgo_ts + 11563, }, } @@ -94355,8 +91485,6 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW if v == uintptr(0) { return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 /* Create new statistic tables if they do not exist, or clear them ** if they do already exist. @@ -94376,7 +91504,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11637, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11666, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -94387,10 +91515,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11689, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11690, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11719, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -94399,6 +91527,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -94407,11 +91536,11 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW if !(i < nToOpen) { break } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), iStatCur+i, int32(aRoot[i]), iDb, int32(3)) _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -94421,15 +91550,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11557, - FzCols: __ccgo_ts + 11570, + FzName: __ccgo_ts + 11586, + FzCols: __ccgo_ts + 11599, }, 1: { - FzName: __ccgo_ts + 11583, - FzCols: __ccgo_ts + 11596, + FzName: __ccgo_ts + 11612, + FzCols: __ccgo_ts + 11625, }, 2: { - FzName: __ccgo_ts + 11624, + FzName: __ccgo_ts + 11653, }, } @@ -94525,7 +91654,6 @@ type StatAccum1 = TStatAccum1 // /* Reclaim memory used by a StatSample // */ func _sampleClear(tls *libc.TLS, db uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) (*TStatSample)(unsafe.Pointer(p)).FnRowid = uint32(0) @@ -94537,7 +91665,6 @@ func _sampleClear(tls *libc.TLS, db uintptr, p uintptr) { // /* Initialize the BLOB value of a ROWID // */ func _sampleSetRowid(tls *libc.TLS, db uintptr, p uintptr, n int32, pData uintptr) { - _ = libc.Int32FromInt32(0) if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) } @@ -94555,7 +91682,6 @@ func _sampleSetRowid(tls *libc.TLS, db uintptr, p uintptr, n int32, pData uintpt // /* Initialize the INTEGER value of a ROWID. // */ func _sampleSetRowidInt64(tls *libc.TLS, db uintptr, p uintptr, iRowid Ti64) { - _ = libc.Int32FromInt32(0) if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) } @@ -94601,6 +91727,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -94611,6 +91738,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -94657,11 +91785,8 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* Decode the three function arguments */ _ = argc nCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) - _ = libc.Int32FromInt32(0) nColUp = nCol nKeyCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Allocate the space required for the StatAccum object */ n = int32(uint64(136) + uint64(8)*uint64(nColUp)) /* StatAccum.anDLt */ n = int32(uint64(n) + libc.Uint64FromInt64(8)*uint64(nColUp)) /* StatAccum.anEq */ @@ -94710,9 +91835,9 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nCol) { @@ -94721,6 +91846,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -94734,7 +91860,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11708, + FzName: __ccgo_ts + 11737, } func init() { @@ -94759,7 +91885,6 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp var i, nCol int32 _, _ = i, nCol nCol = (*TStatAccum)(unsafe.Pointer(pAccum)).FnCol - _ = libc.Int32FromInt32(0) i = (*TStatSample)(unsafe.Pointer(pNew)).FiCol + int32(1) for { if !(i < nCol) { @@ -94773,6 +91898,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -94794,8 +91920,6 @@ func _sampleIsBetter(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintptr) _, _ = nEqNew, nEqOld nEqNew = *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pNew)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pNew)).FiCol)*8)) nEqOld = *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pOld)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pOld)).FiCol)*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nEqNew > nEqOld { return int32(1) } @@ -94819,7 +91943,6 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { var i, iMin int32 _, _, _, _, _, _, _, _, _ = anDLt, anEq, anLt, i, iMin, pMin, pOld, pSample, pUpgrade pSample = uintptr(0) - _ = libc.Int32FromInt32(0) /* StatAccum.nMaxEqZero is set to the maximum number of leading 0 ** values in the anEq[] array of any sample in StatAccum.a[]. In ** other words, if nMaxEqZero is n, then it is guaranteed that there @@ -94829,7 +91952,6 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } if int32((*TStatSample)(unsafe.Pointer(pNew)).FisPSample) == 0 { pUpgrade = uintptr(0) - _ = libc.Int32FromInt32(0) /* This sample is being added because the prefix that ends in column ** iCol occurs many times in the table. However, if we have already ** added a sample that shares this prefix, there is no need to add @@ -94845,14 +91967,13 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { if (*TStatSample)(unsafe.Pointer(pOld)).FisPSample != 0 { return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pUpgrade == uintptr(0) || _sampleIsBetter(tls, p, pOld, pUpgrade) != 0 { pUpgrade = pOld } } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -94879,7 +92000,6 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* The "rows less-than" for the rowid column must be greater than that ** for the last sample in the p->a[] array. Otherwise, the samples would ** be out of order. */ - _ = libc.Int32FromInt32(0) /* Insert the new sample */ pSample = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FnSample)*48 _sampleCopy(tls, p, pSample, pNew) @@ -94887,6 +92007,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -94902,9 +92023,9 @@ find_new_min: } goto _2 _2: + ; i++ } - _ = libc.Int32FromInt32(0) (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin } } @@ -94935,6 +92056,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -94949,13 +92071,14 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { if !(j < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -94975,10 +92098,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -95017,8 +92142,6 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { iChng = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) _ = argc _ = context - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TStatAccum)(unsafe.Pointer(p)).FnRow == uint64(0) { /* This is the first call to this function. Do initialization. */ i = 0 @@ -95029,6 +92152,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -95046,6 +92170,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -95060,6 +92185,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -95093,6 +92219,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -95106,7 +92233,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11718, + FzName: __ccgo_ts + 11747, } func init() { @@ -95148,9 +92275,6 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { p = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) /* STAT4 has a parameter on this routine. */ eCall = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eCall == STAT_GET_STAT1 { /* Loop counter */ _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, ((*TStatAccum)(unsafe.Pointer(p)).FnKeyCol+int32(1))*int32(100)) @@ -95159,7 +92283,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11728, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11757, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -95170,10 +92294,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11733, libc.VaList(bp+72, iVal)) - _ = libc.Int32FromInt32(0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11762, libc.VaList(bp+72, iVal)) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -95193,7 +92317,6 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } } else { aCnt = uintptr(0) - _ = libc.Int32FromInt32(0) switch eCall { case int32(STAT_GET_NEQ): aCnt = (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiGet)*48))).FanEq @@ -95210,9 +92333,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11739, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11768, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -95227,7 +92351,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11745, + FzName: __ccgo_ts + 11774, } func init() { @@ -95237,7 +92361,6 @@ func init() { func _callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Integer), iParam, regStat+int32(1)) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat, regOut, libc.Int32FromInt32(1)+libc.Int32FromInt32(IsStat4), uintptr(unsafe.Pointer(&_statGetFuncdef)), 0) } @@ -95286,7 +92409,6 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint doOnce = int32(1) /* Flag for a one-time computation */ pStat1 = uintptr(0) _sqlite3TouchRegister(tls, pParse, iMem) - _ = libc.Int32FromInt32(0) v = _sqlite3GetVdbe(tls, pParse) if v == uintptr(0) || pTab == uintptr(0) { return @@ -95295,14 +92417,11 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11754, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11783, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } - _ = libc.Int32FromInt32(0) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ANALYZE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) != 0 { return } @@ -95312,7 +92431,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11557, uint64(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11586, uint64(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -95400,7 +92519,6 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint ** the sqlite_stat4 table. */ _sqlite3TouchRegister(tls, pParse, regPrev+nColTest) /* Open a read-only cursor on the index being analyzed. */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iIdxCur, int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) /* Invoke the stat_init() function. The arguments are: @@ -95411,7 +92529,6 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint ** (3) estimated number of rows in the index, */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nCol, regStat+int32(1)) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol), regRowid) if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iIdxCur, regTemp) @@ -95420,7 +92537,6 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint addrRewind = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iIdxCur) _sqlite3VdbeAddOp3(tls, v, int32(OP_Count), iIdxCur, regTemp, int32(1)) } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit, regTemp2) _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat+int32(1), regStat, int32(4), uintptr(unsafe.Pointer(&_statInitFuncdef)), 0) /* Implementation of the following: @@ -95469,6 +92585,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -95490,6 +92607,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -95503,7 +92621,6 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint ** if !eof(csr) goto next_row; */ if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), iIdxCur, regRowid) } else { @@ -95515,17 +92632,16 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint break } k = int32(_sqlite3TableColumnToIndex(tls, pIdx, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) _sqlite3ReleaseTempRange(tls, pParse, regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) } } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddFunctionCall(tls, pParse, int32(1), regStat, regTemp, libc.Int32FromInt32(2)+libc.Int32FromInt32(IsStat4), uintptr(unsafe.Pointer(&_statPushFuncdef)), 0) if (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit != 0 { j1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regTemp) @@ -95540,8 +92656,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11793, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -95578,15 +92693,14 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ _sqlite3TouchRegister(tls, pParse, regCol+mxCol) doOnce = 0 _sqlite3ClearTempRegCache(tls, pParse) /* tag-20230325-1 */ - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) addrNext = _sqlite3VdbeCurrentAddr(tls, v) _callStatGet(tls, pParse, regStat, int32(STAT_GET_ROWID), regSampleRowid) addrIsNull = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regSampleRowid) @@ -95602,6 +92716,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -95615,6 +92730,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -95624,8 +92740,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) - _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11793, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -95666,7 +92781,6 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { _openStatTable(tls, pParse, iDb, iStatCur, uintptr(0), uintptr(0)) iMem = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) iTab = (*TParse)(unsafe.Pointer(pParse)).FnTab - _ = libc.Int32FromInt32(0) k = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst for { if !(k != 0) { @@ -95677,6 +92791,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -95692,16 +92807,14 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) { var iDb, iStatCur int32 _, _ = iDb, iStatCur - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11768) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11797) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11772) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11801) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -95732,11 +92845,9 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ - _ = libc.Int32FromInt32(0) if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { return } - _ = libc.Int32FromInt32(0) if pName1 == uintptr(0) { /* Form 1: Analyze everything */ i = 0 @@ -95750,6 +92861,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -95831,7 +92943,7 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, _, _, _, _, _, _ = c, i, sz, v, z, v2 z = zIntArray if z == uintptr(0) { - z = __ccgo_ts + 1648 + z = __ccgo_ts + 1652 } i = 0 for { @@ -95859,23 +92971,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11776, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11805, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11787, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11816, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11797, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11826, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -95918,7 +93031,6 @@ func _analysisLoader(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, Not var _ /* fakeIdx at bp+0 */ TIndex _, _, _, _, _, _ = aiRowEst, nCol, pIndex, pInfo, pTable, z pInfo = pData - _ = libc.Int32FromInt32(0) _ = NotUsed _ = argc if argv == uintptr(0) || *(*uintptr)(unsafe.Pointer(argv)) == uintptr(0) || *(*uintptr)(unsafe.Pointer(argv + 2*8)) == uintptr(0) { @@ -95977,8 +93089,6 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { var j int32 var p uintptr _, _ = j, p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TIndex)(unsafe.Pointer(pIdx)).FaSample != 0 { j = 0 for { @@ -95989,6 +93099,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -96056,6 +93167,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -96067,6 +93179,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -96114,7 +93227,6 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, nByte, nCol, nIdxCol, nSample, pIdx, pIdx1, pPrevIdx, pSample, pSpace, rc, zIndex, zIndex1, zSql /* Result codes from subroutines */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Text of the SQL statement */ pPrevIdx = uintptr(0) /* A slot in pIdx->aSample[] */ - _ = libc.Int32FromInt32(0) zSql = _sqlite3MPrintf(tls, db, zSql1, libc.VaList(bp+16, zDb)) if !(zSql != 0) { return int32(SQLITE_NOMEM) @@ -96132,7 +93244,6 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u } nSample = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) pIdx = _findIndexOrPrimaryKey(tls, db, zIndex, zDb) - _ = libc.Int32FromInt32(0) if pIdx == uintptr(0) { continue } @@ -96140,7 +93251,6 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u /* The same index appears in sqlite_stat4 under multiple names */ continue } - _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { nIdxCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) } else { @@ -96173,9 +93283,9 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) } rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) if rc != 0 { @@ -96253,13 +93363,12 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { var v2 bool _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11583, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11612, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11809, __ccgo_ts+11878, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11838, __ccgo_ts+11907, zDb) } return rc } @@ -96295,10 +93404,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { _, _, _, _, _, _, _, _, _, _, _ = i, pIdx, pIdx1, pIdx2, pSchema, pStat1, pTab, rc, zSql, v3, v5 rc = SQLITE_OK pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Clear any prior statistics */ - _ = libc.Int32FromInt32(0) i = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst for { if !(i != 0) { @@ -96308,6 +93414,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -96321,15 +93428,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11557, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11586, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11930, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11959, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -96338,7 +93446,6 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } } /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */ - _ = libc.Int32FromInt32(0) i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst for { if !(i != 0) { @@ -96350,6 +93457,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -96375,6 +93483,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -96441,7 +93550,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6560, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6589, zName) == 0) } // C documentation @@ -96483,21 +93592,21 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { zFile = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if zFile == uintptr(0) { - zFile = __ccgo_ts + 1648 + zFile = __ccgo_ts + 1652 } if zName == uintptr(0) { - zName = __ccgo_ts + 1648 + zName = __ccgo_ts + 1652 } if int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x4>>2)) != 0 { /* This is not a real ATTACH. Instead, this routine is being called ** from sqlite3_deserialize() to close database db->init.iDb and ** reopen it as a MemDB */ *(*uintptr)(unsafe.Pointer(bp + 40)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 32)) = Xsqlite3_vfs_find(tls, __ccgo_ts+3967) + *(*uintptr)(unsafe.Pointer(bp + 32)) = Xsqlite3_vfs_find(tls, __ccgo_ts+3971) if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11971, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12000, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -96528,7 +93637,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11974, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12003, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -96536,13 +93645,13 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { break } - _ = libc.Int32FromInt32(0) if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12011, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12040, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -96577,7 +93686,6 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) return } - _ = libc.Int32FromInt32(0) *(*uint32)(unsafe.Pointer(bp + 16)) |= uint32(SQLITE_OPEN_MAIN_DB) rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp)), db, pNew+8, 0, int32(*(*uint32)(unsafe.Pointer(bp + 16)))) (*Tsqlite3)(unsafe.Pointer(db)).FnDb++ @@ -96586,7 +93694,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12041, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12070, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -96594,7 +93702,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12070, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12099, 0) rc = int32(SQLITE_ERROR) } } @@ -96624,12 +93732,10 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = _sqlite3Init(tls, db, bp+24) } _sqlite3BtreeLeaveAll(tls, db) - _ = libc.Int32FromInt32(0) } if rc != 0 { if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x4>>2)) != 0) { iDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) - _ = libc.Int32FromInt32(0) if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt != 0 { _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt) (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt = uintptr(0) @@ -96640,10 +93746,10 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12166, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12195, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12187, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12216, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12213, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12242, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those ** triggers to reference the TEMP schema itself. */ - _ = libc.Int32FromInt32(0) pEntry = (*THash)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 56)).Ffirst for pEntry != 0 { pTrig = (*THashElem)(unsafe.Pointer(pEntry)).Fdata @@ -96730,6 +93837,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -96760,7 +93868,6 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut } if pAuthArg != 0 { if int32((*TExpr)(unsafe.Pointer(pAuthArg)).Fop) == int32(TK_STRING) { - _ = libc.Int32FromInt32(0) zAuthArg = *(*uintptr)(unsafe.Pointer(pAuthArg + 8)) } else { zAuthArg = uintptr(0) @@ -96775,7 +93882,6 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3ExprCode(tls, pParse, pFilename, regArgs) _sqlite3ExprCode(tls, pParse, pDbname, regArgs+int32(1)) _sqlite3ExprCode(tls, pParse, pKey, regArgs+int32(2)) - _ = libc.Int32FromInt32(0) if v != 0 { _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regArgs+int32(3)-int32((*TFuncDef)(unsafe.Pointer(pFunc)).FnArg), regArgs+int32(3), int32((*TFuncDef)(unsafe.Pointer(pFunc)).FnArg), pFunc, 0) /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this @@ -96785,6 +93891,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -96804,7 +93911,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12235, + FzName: __ccgo_ts + 12264, } func init() { @@ -96826,7 +93933,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12249, + FzName: __ccgo_ts + 12278, } func init() { @@ -96852,7 +93959,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12263, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12292, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -96886,7 +93993,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12287, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12316, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -96901,6 +94008,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -96915,6 +94023,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -96931,7 +94040,6 @@ func _sqlite3FixInit(tls *libc.TLS, pFix uintptr, pParse uintptr, iDb int32, zTy var db uintptr _ = db db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) (*TDbFixer)(unsafe.Pointer(pFix)).FpParse = pParse (*TDbFixer)(unsafe.Pointer(pFix)).FzDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName (*TDbFixer)(unsafe.Pointer(pFix)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -97003,6 +94111,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -97100,7 +94209,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12362, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -97128,11 +94237,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12356, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12385, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12362, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12391, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12368, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12397, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -97158,9 +94267,6 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint var pTab, zCol uintptr _, _, _, _, _ = iCol, iDb, iSrc, pTab, zCol pTab = uintptr(0) /* Index of column in table */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSchema) if iDb < 0 { /* An attempt to read a column out of a subquery or other @@ -97170,7 +94276,6 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER) { pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - _ = libc.Int32FromInt32(0) iSrc = 0 for { if !(iSrc < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -97182,6 +94287,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -97190,17 +94296,14 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint return } if iCol >= 0 { - _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 7880 + zCol = __ccgo_ts + 7909 } } - _ = libc.Int32FromInt32(0) if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -97222,7 +94325,6 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, /* Don't do any authorization checks if the database is initializing ** or if the parser is being invoked from within sqlite3_declare_vtab. */ - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth == uintptr(0) || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL { return SQLITE_OK } @@ -97234,7 +94336,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12424, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -97253,7 +94355,6 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, // ** popped. Or if pParse==0, this routine is a no-op. // */ func _sqlite3AuthContextPush(tls *libc.TLS, pParse uintptr, pContext uintptr, zContext uintptr) { - _ = libc.Int32FromInt32(0) (*TAuthContext)(unsafe.Pointer(pContext)).FpParse = pParse (*TAuthContext)(unsafe.Pointer(pContext)).FzAuthContext = (*TParse)(unsafe.Pointer(pParse)).FzAuthContext (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zContext @@ -97329,7 +94430,6 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc var i, nBytes, v3 int32 var p, pToplevel, v1, v4 uintptr _, _, _, _, _, _, _ = i, nBytes, p, pToplevel, v1, v3, v4 - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel } else { @@ -97348,6 +94448,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -97388,7 +94489,6 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { var p, pVdbe uintptr _, _, _, _ = i, p, p1, pVdbe pVdbe = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TParse)(unsafe.Pointer(pParse)).FnTableLock) { @@ -97399,6 +94499,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -97425,9 +94526,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { var addrRewind, i, iDb, reg, v2 int32 var db, pEL, pRet, pReturning, pSchema, v, vtab uintptr _, _, _, _, _, _, _, _, _, _, _, _ = addrRewind, db, i, iDb, pEL, pRet, pReturning, pSchema, reg, v, vtab, v2 - _ = libc.Int32FromInt32(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).Fnested != 0 { return } @@ -97437,7 +94536,6 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } return } - _ = libc.Int32FromInt32(0) /* Begin by generating some termination code at the end of the ** vdbe program */ @@ -97452,7 +94550,6 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } } - _ = libc.Int32FromInt32(0) if v != 0 { if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { pReturning = *(*uintptr)(unsafe.Pointer(pParse + 208)) @@ -97468,6 +94565,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -97482,9 +94580,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { ** transaction on each used database and to verify the schema cookie ** on each used database. */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeJumpHere(tls, v, 0) - _ = libc.Int32FromInt32(0) iDb = 0 for { if libc.BoolInt32((*TParse)(unsafe.Pointer(pParse)).FcookieMask&(libc.Uint32FromInt32(1)<= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6560) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6589) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6529, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6556+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6575+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6070+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6537) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6041) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6575+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6070) } } } @@ -97697,21 +94792,21 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { break } - _ = libc.Int32FromInt32(0) p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) if p != 0 { break } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6041) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6529, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6575+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6070) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6556+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6537) } } } @@ -97749,7 +94844,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12410, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12439, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -97767,18 +94862,17 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12418 + v1 = __ccgo_ts + 12447 } else { - v1 = __ccgo_ts + 12431 + v1 = __ccgo_ts + 12460 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6793, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6803, libc.VaList(bp+8, zMsg, zName)) } } else { - _ = libc.Int32FromInt32(0) } return p } @@ -97798,7 +94892,6 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt var iDb int32 var zDb uintptr _, _ = iDb, zDb - _ = libc.Int32FromInt32(0) if (*TSrcItem)(unsafe.Pointer(p)).FpSchema != 0 { iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(p)).FpSchema) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -97815,12 +94908,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - return __ccgo_ts + 6546 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6529, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6070+7) == 0 { + return __ccgo_ts + 6575 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6508+7) == 0 { - return __ccgo_ts + 6527 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6537+7) == 0 { + return __ccgo_ts + 6556 } } return zName @@ -97846,7 +94939,6 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r _, _, _, _, _ = i, j, p, pSchema, v2 p = uintptr(0) /* All mutexes are required for schema access. Make sure we hold them. */ - _ = libc.Int32FromInt32(0) i = OMIT_TEMPDB for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -97859,17 +94951,16 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } j = v2 /* Search TEMP before MAIN */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32))).FpSchema - _ = libc.Int32FromInt32(0) if zDb != 0 && _sqlite3DbIsNamed(tls, db, j, zDb) == 0 { goto _1 } - _ = libc.Int32FromInt32(0) p = _sqlite3HashFind(tls, pSchema+32, zName) if p != 0 { break } goto _1 _1: + ; i++ } return p @@ -97903,7 +94994,6 @@ func _sqlite3FreeIndex(tls *libc.TLS, db uintptr, p uintptr) { func _sqlite3UnlinkAndDeleteIndex(tls *libc.TLS, db uintptr, iDb int32, zIdxName uintptr) { var p, pHash, pIndex uintptr _, _, _ = p, pHash, pIndex - _ = libc.Int32FromInt32(0) pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 32 pIndex = _sqlite3HashInsert(tls, pHash, zIdxName, uintptr(0)) if pIndex != 0 { @@ -97958,6 +95048,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -97979,9 +95070,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { var i int32 var p1, p2 uintptr _, _, _ = i, p1, p2 - _ = libc.Int32FromInt32(0) if iDb >= 0 { - _ = libc.Int32FromInt32(0) p1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 114 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(DB_ResetWanted)) p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 114 @@ -97999,6 +95088,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -98031,6 +95121,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -98061,7 +95152,6 @@ func _sqlite3ColumnSetExpr(tls *libc.TLS, pParse uintptr, pTab uintptr, pCol uin var pList uintptr var v1 int32 _, _ = pList, v1 - _ = libc.Int32FromInt32(0) pList = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -98129,7 +95219,6 @@ func _sqlite3ColumnSetColl(tls *libc.TLS, db uintptr, pCol uintptr, zColl uintpt var n, nColl Ti64 var zNew, p1 uintptr _, _, _, _ = n, nColl, zNew, p1 - _ = libc.Int32FromInt32(0) n = int64(_sqlite3Strlen30(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(1)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { n += int64(_sqlite3Strlen30(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName+uintptr(n)) + int32(1)) @@ -98177,8 +95266,6 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { var i int32 var pCol, v1 uintptr _, _, _ = i, pCol, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v1 = (*TTable)(unsafe.Pointer(pTable)).FaCol pCol = v1 if v1 != uintptr(0) { @@ -98187,10 +95274,10 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { if !(i < int32((*TTable)(unsafe.Pointer(pTable)).FnCol)) { break } - _ = libc.Int32FromInt32(0) _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -98243,16 +95330,14 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { break } pNext = (*TIndex)(unsafe.Pointer(pIndex)).FpNext - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) && !(int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { zName = (*TIndex)(unsafe.Pointer(pIndex)).FzName _sqlite3HashInsert(tls, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema+32, zName, uintptr(0)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -98261,7 +95346,6 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VTAB) { _sqlite3VtabClear(tls, db, pTable) } else { - _ = libc.Int32FromInt32(0) _sqlite3SelectDelete(tls, db, (*(*struct { FpSelect uintptr })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTable)).Fu))).FpSelect) @@ -98275,7 +95359,6 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3ExprListDelete(tls, db, (*TTable)(unsafe.Pointer(pTable)).FpCheck) _sqlite3DbFree(tls, db, pTable) /* Verify that no lookaside memory was used by schema tables */ - _ = libc.Int32FromInt32(0) } func _sqlite3DeleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { @@ -98284,7 +95367,6 @@ func _sqlite3DeleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { var v3 bool _, _, _ = v1, v2, v3 /* Do not delete the table until the reference count reaches zero. */ - _ = libc.Int32FromInt32(0) if !(pTable != 0) { return } @@ -98312,10 +95394,6 @@ func _sqlite3DeleteTableGeneric(tls *libc.TLS, db uintptr, pTable uintptr) { func _sqlite3UnlinkAndDeleteTable(tls *libc.TLS, db uintptr, iDb int32, zTabName uintptr) { var p, pDb uintptr _, _ = p, pDb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Zero-length table names are allowed */ pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 p = _sqlite3HashInsert(tls, (*TDb)(unsafe.Pointer(pDb)).FpSchema+8, zTabName, uintptr(0)) @@ -98360,7 +95438,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6041) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6070) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -98392,11 +95470,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6560, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6589, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -98447,20 +95526,18 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u var iDb int32 _, _ = db, iDb /* Database holding the object */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12445, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12474, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12462, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12491, libc.VaList(bp+8, pName1)) return -int32(1) } } else { - _ = libc.Int32FromInt32(0) iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) *(*uintptr)(unsafe.Pointer(pUnqual)) = pName1 } @@ -98501,12 +95578,12 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { if Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit))) != 0 || Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit + 1*8))) != 0 || Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit + 2*8))) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1648, 0) /* corruptSchema() will supply the error */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1652, 0) /* corruptSchema() will supply the error */ return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12482, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6529, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12511, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -98528,6 +95605,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -98554,6 +95632,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -98586,6 +95665,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -98634,7 +95714,6 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 var i int32 var n Ti16 _, _ = i, n - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasVirtual) == uint32(0) || int32(iCol) < 0 { return iCol } @@ -98649,6 +95728,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -98718,9 +95798,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6537 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6070 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -98733,7 +95813,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12524, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12553, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -98749,9 +95829,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10771 + v2 = __ccgo_ts + 10800 } else { - v2 = __ccgo_ts + 9033 + v2 = __ccgo_ts + 9062 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -98759,13 +95839,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { isTemp = int32(1) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6537 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6070 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -98789,26 +95867,24 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10771 + v4 = __ccgo_ts + 10800 } else { - v4 = __ccgo_ts + 9033 + v4 = __ccgo_ts + 9062 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12565, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12594, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { - _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) } goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12586, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12615, libc.VaList(bp+16, zName)) goto begin_table_error } } pTable = _sqlite3DbMallocZero(tls, db, uint64(104)) if pTable == uintptr(0) { - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) (*TParse)(unsafe.Pointer(pParse)).FnErr++ goto begin_table_error @@ -98818,8 +95894,6 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui (*TTable)(unsafe.Pointer(pTable)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema (*TTable)(unsafe.Pointer(pTable)).FnTabRef = uint32(1) (*TTable)(unsafe.Pointer(pTable)).FnRowLogEst = int16(200) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTable = pTable /* Begin generating the code that will insert the table record into ** the schema table. Note in particular that we must go ahead @@ -98881,7 +95955,6 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if isView != 0 || isVirtual != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, reg2) } else { - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab = _sqlite3VdbeAddOp3(tls, v, int32(OP_CreateBtree), iDb, reg2, int32(BTREE_INTKEY)) } _sqlite3OpenSchemaTable(tls, pParse, iDb) @@ -98895,6 +95968,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -98956,9 +96030,8 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12650, 0) } else { - _ = libc.Int32FromInt32(0) } (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) pRet = _sqlite3DbMallocZero(tls, db, uint64(240)) @@ -98973,7 +96046,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12655, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12684, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -98985,7 +96058,6 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { (*TReturning)(unsafe.Pointer(pRet)).FretTStep.FpTrig = pRet + 16 (*TReturning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 56 - _ = libc.Int32FromInt32(0) if _sqlite3HashInsert(tls, pHash, pRet+196, pRet+16) == pRet+16 { _sqlite3OomFault(tls, db) } @@ -99021,7 +96093,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12704, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -99031,12 +96103,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12698, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12727, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12705, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12734, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -99064,6 +96136,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -99084,12 +96157,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12715, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12744, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -99148,12 +96222,12 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { if !(pIdx != 0) { break } - _ = libc.Int32FromInt32(0) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn))) == int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1) { libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(1), 3, 0x8) } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99198,7 +96272,6 @@ func _sqlite3AffinityType(tls *libc.TLS, zIn uintptr, pCol uintptr) (r int8) { h = uint32(0) aff = int8(SQLITE_AFF_NUMERIC) zChar = uintptr(0) - _ = libc.Int32FromInt32(0) for *(*int8)(unsafe.Pointer(zIn)) != 0 { x = *(*Tu8)(unsafe.Pointer(zIn)) h = h< 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13019, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13048, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13027, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13056, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -99582,8 +96656,6 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | int32(eType)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(eType) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { _makeColumnPartOfPrimaryKey(tls, pParse, pCol) /* For the error message */ @@ -99602,8 +96674,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13034, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13063, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -99633,7 +96707,6 @@ func _sqlite3ChangeCookie(tls *libc.TLS, pParse uintptr, iDb int32) { _, _ = db, v db = (*TParse)(unsafe.Pointer(pParse)).Fdb v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_SCHEMA_VERSION), int32(libc.Uint32FromInt32(1)+uint32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema)).Fschema_cookie))) } @@ -99660,6 +96733,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -99697,6 +96771,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -99720,6 +96795,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -99755,18 +96831,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { - zSep = __ccgo_ts + 1648 - zSep2 = __ccgo_ts + 13065 - zEnd = __ccgo_ts + 5081 + zSep = __ccgo_ts + 1652 + zSep2 = __ccgo_ts + 13094 + zEnd = __ccgo_ts + 5110 } else { - zSep = __ccgo_ts + 13067 - zSep2 = __ccgo_ts + 13071 - zEnd = __ccgo_ts + 13076 + zSep = __ccgo_ts + 13096 + zSep2 = __ccgo_ts + 13100 + zEnd = __ccgo_ts + 13105 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -99774,7 +96851,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13079, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13108, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -99790,30 +96867,27 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { *(*int32)(unsafe.Pointer(bp)) += _sqlite3Strlen30(tls, zStmt+uintptr(*(*int32)(unsafe.Pointer(bp)))) zSep = zSep2 _identPut(tls, zStmt, bp, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) zType = _azType1[int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity)-int32(SQLITE_AFF_BLOB)] len1 = _sqlite3Strlen30(tls, zType) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), zType, uint64(len1)) *(*int32)(unsafe.Pointer(bp)) += len1 - _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ pCol += 16 } - Xsqlite3_snprintf(tls, n-*(*int32)(unsafe.Pointer(bp)), zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), __ccgo_ts+3795, libc.VaList(bp+16, zEnd)) + Xsqlite3_snprintf(tls, n-*(*int32)(unsafe.Pointer(bp)), zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), __ccgo_ts+3799, libc.VaList(bp+16, zEnd)) return zStmt } var _azType1 = [6]uintptr{ - 0: __ccgo_ts + 1648, - 1: __ccgo_ts + 13093, - 2: __ccgo_ts + 13099, - 3: __ccgo_ts + 13104, - 4: __ccgo_ts + 13109, - 5: __ccgo_ts + 13099, + 0: __ccgo_ts + 1652, + 1: __ccgo_ts + 13122, + 2: __ccgo_ts + 13128, + 3: __ccgo_ts + 13133, + 4: __ccgo_ts + 13138, + 5: __ccgo_ts + 13128, } // C documentation @@ -99829,7 +96903,6 @@ func _resizeIndexObject(tls *libc.TLS, db uintptr, pIdx uintptr, N int32) (r int if int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) >= N { return SQLITE_OK } - _ = libc.Int32FromInt32(0) nByte = int32((libc.Uint64FromInt64(8) + libc.Uint64FromInt64(2) + libc.Uint64FromInt64(2) + libc.Uint64FromInt32(1)) * uint64(N)) zExtra = _sqlite3DbMallocZero(tls, db, uint64(nByte)) if zExtra == uintptr(0) { @@ -99871,6 +96944,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -99899,7 +96973,6 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { break } x = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) - _ = libc.Int32FromInt32(0) if int32(x) < 0 { v2 = int32(1) } else { @@ -99908,6 +96981,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -99956,24 +97030,18 @@ func _hasColumn(tls *libc.TLS, aiCol uintptr, nCol int32, x int32) (r int32) { func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int32) (r int32) { var i, j int32 _, _ = i, j - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(iCol)*2))) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nKey) { break } - _ = libc.Int32FromInt32(0) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == j && _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(iCol)*8))) == 0 { return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -100020,10 +97088,11 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m - _ = libc.Int32FromInt32(0) /* See note-20221022-a */ + /* See note-20221022-a */ } // C documentation @@ -100075,6 +97144,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -100082,9 +97152,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP3(tls, v, (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab, int32(BTREE_BLOBKEY)) } /* Locate the PRIMARY KEY index. Or, if this table was originally @@ -100101,19 +97169,15 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { _sqlite3RenameTokenRemap(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr, pTab+52) } (*(*TExprList_item)(unsafe.Pointer(pList + 8))).Ffg.FsortFlags = (*TParse)(unsafe.Pointer(pParse)).FiPkSortOrder - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, int32((*TTable)(unsafe.Pointer(pTab)).FkeyConf), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_WithoutRowid)) return } - _ = libc.Int32FromInt32(0) pPk = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) } else { pPk = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later @@ -100137,11 +97201,11 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) } - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr16Uint32(pPk+100, libc.Uint32FromInt32(1), 5, 0x20) if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x2>>1)) != 0) { libc.SetBitFieldPtr16Uint32(pPk+100, libc.Uint32FromInt32(1), 3, 0x8) @@ -100154,7 +97218,6 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if v != 0 && (*TIndex)(unsafe.Pointer(pPk)).Ftnum > uint32(0) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeOpcode(tls, v, int32((*TIndex)(unsafe.Pointer(pPk)).Ftnum), uint8(OP_Goto)) } /* The root page of the PRIMARY KEY is the table root page */ @@ -100182,6 +97245,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -100209,12 +97273,12 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -100230,6 +97294,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -100242,17 +97307,15 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { break } if !(_hasColumn(tls, (*TIndex)(unsafe.Pointer(pPk)).FaiColumn, j, i) != 0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { - _ = libc.Int32FromInt32(0) *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)) = int16(i) *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) j++ } goto _11 _11: + ; i++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _recomputeColumnsNotIndexed(tls, pPk) } @@ -100305,7 +97368,6 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { var k, pMod, pOther uintptr var nName int32 _, _, _, _ = k, nName, pMod, pOther /* For looping through the symbol table */ - _ = libc.Int32FromInt32(0) pMod = _sqlite3HashFind(tls, db+576, *(*uintptr)(unsafe.Pointer((*(*struct { FnArg int32 FazArg uintptr @@ -100323,7 +97385,6 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxShadowName == uintptr(0) { return } - _ = libc.Int32FromInt32(0) nName = _sqlite3Strlen30(tls, (*TTable)(unsafe.Pointer(pTab)).FzName) k = (*THash)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema + 8)).Ffirst for { @@ -100331,7 +97392,6 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { break } pOther = (*THashElem)(unsafe.Pointer(k)).Fdata - _ = libc.Int32FromInt32(0) if !(int32((*TTable)(unsafe.Pointer(pOther)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { goto _1 } @@ -100343,6 +97403,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -100428,7 +97489,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { if pSelect != 0 || !(int32((*TTable)(unsafe.Pointer(p)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) && (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1648, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1652, 0) return } (*TTable)(unsafe.Pointer(p)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum @@ -100455,9 +97516,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13115, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13144, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1652))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13148, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13177, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -100471,19 +97532,18 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13204, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13225, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13254, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -100526,10 +97586,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13257, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13286, 0) return } } @@ -100543,6 +97604,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -100562,12 +97624,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9033 - zType2 = __ccgo_ts + 13301 + zType = __ccgo_ts + 9062 + zType2 = __ccgo_ts + 13330 } else { /* A view */ - zType = __ccgo_ts + 10771 - zType2 = __ccgo_ts + 13307 + zType = __ccgo_ts + 10800 + zType2 = __ccgo_ts + 13336 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -100600,7 +97662,6 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr *(*int32)(unsafe.Pointer(v9))++ v8 = *(*int32)(unsafe.Pointer(v9)) regRowid = v8 - _ = libc.Int32FromInt32(0) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenWrite), int32(1), (*TParse)(unsafe.Pointer(pParse)).FregRoot, iDb) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_P2ISREG)) @@ -100614,7 +97675,6 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if pSelTab == uintptr(0) { return } - _ = libc.Int32FromInt32(0) v10 = (*TTable)(unsafe.Pointer(pSelTab)).FnCol (*TTable)(unsafe.Pointer(p)).FnNVCol = v10 (*TTable)(unsafe.Pointer(p)).FnCol = v10 @@ -100652,13 +97712,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13312, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13341, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13327, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13356, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -100666,29 +97726,26 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - _ = libc.Int32FromInt32(0) if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13425, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13454, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13467, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13496, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13501, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13530, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13522, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13551, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { pSchema = (*TTable)(unsafe.Pointer(p)).FpSchema - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOld = _sqlite3HashInsert(tls, pSchema+8, (*TTable)(unsafe.Pointer(p)).FzName, p) if pOld != 0 { - _ = libc.Int32FromInt32(0) /* Malloc must have failed inside HashInsert() */ + /* Malloc must have failed inside HashInsert() */ _sqlite3OomFault(tls, db) return } @@ -100697,14 +97754,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ - _ = libc.Int32FromInt32(0) - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9555) == 0 { - _ = libc.Int32FromInt32(0) + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9584) == 0 { (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } } if !(pSelect != 0) && int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pCons)).Fz == uintptr(0) { pCons = pEnd } @@ -100733,7 +97787,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13554, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13583, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -100745,11 +97799,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10771, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10800, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -100778,13 +97833,11 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** the end. */ *(*TToken)(unsafe.Pointer(bp)) = (*TParse)(unsafe.Pointer(pParse)).FsLastToken - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz))) != int32(';') { (*(*TToken)(unsafe.Pointer(bp))).Fz += uintptr((*(*TToken)(unsafe.Pointer(bp))).Fn) } (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(0) n = int32(int64((*(*TToken)(unsafe.Pointer(bp))).Fz) - int64((*TToken)(unsafe.Pointer(pBegin)).Fz)) - _ = libc.Int32FromInt32(0) z = (*TToken)(unsafe.Pointer(pBegin)).Fz for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n-int32(1)))))])&int32(0x01) != 0 { n-- @@ -100794,6 +97847,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -100819,7 +97873,6 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 _, _, _, _, _, _, _, _, _, _, _ = db, eParseMode, nErr, nSelect, nTab, pSel, pSelTab, rc, xAuth, v1, p2 /* Copy of the SELECT that implements the view */ nErr = 0 /* Number of errors encountered */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Saved xAuth pointer */ - _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VTAB) { (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock++ rc = _sqlite3VtabCallConnect(tls, pParse, pTable) @@ -100830,7 +97883,6 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** already known. This routine is not called unless either the ** table is virtual or nCol is zero. */ - _ = libc.Int32FromInt32(0) /* A negative nCol is a special marker meaning that we are currently ** trying to compute the column names. If we enter this routine with ** a negative nCol, it means two or more views form a loop, like this: @@ -100847,10 +97899,9 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13590, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13619, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } - _ = libc.Int32FromInt32(0) /* If we get this far, it means we need to compute the table names. ** Note that the call to sqlite3ResultSetOfSelect() will expand any ** "*" elements in the results set of the view and will assign cursors @@ -100858,7 +97909,6 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ - _ = libc.Int32FromInt32(0) pSel = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTable)).Fu))).FpSelect, 0) @@ -100890,20 +97940,17 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 */ _sqlite3ColumnsFromExprList(tls, pParse, (*TTable)(unsafe.Pointer(pTable)).FpCheck, pTable+54, pTable+8) if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*TTable)(unsafe.Pointer(pTable)).FnCol) == (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpEList)).FnExpr { - _ = libc.Int32FromInt32(0) _sqlite3SubqueryColumnTypes(tls, pParse, pTable, pSel, int8(SQLITE_AFF_NONE)) } } else { /* CREATE VIEW name AS... without an argument list. Construct ** the column names from the SELECT statement that defines the view. */ - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTable)).FnCol = (*TTable)(unsafe.Pointer(pSelTab)).FnCol (*TTable)(unsafe.Pointer(pTable)).FaCol = (*TTable)(unsafe.Pointer(pSelTab)).FaCol *(*Tu32)(unsafe.Pointer(pTable + 48)) |= (*TTable)(unsafe.Pointer(pSelTab)).FtabFlags & uint32(COLFLAG_NOINSERT) (*TTable)(unsafe.Pointer(pSelTab)).FnCol = 0 (*TTable)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) - _ = libc.Int32FromInt32(0) } } (*TTable)(unsafe.Pointer(pTable)).FnNVCol = (*TTable)(unsafe.Pointer(pTable)).FnCol @@ -100929,7 +97976,6 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 } func _sqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if !(int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && int32((*TTable)(unsafe.Pointer(pTable)).FnCol) > 0 { return 0 } @@ -100944,7 +97990,6 @@ func _sqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) ( func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { var i, pTab, p2 uintptr _, _, _ = i, pTab, p2 - _ = libc.Int32FromInt32(0) if !(int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_UnresetViews) == libc.Int32FromInt32(DB_UnresetViews)) { return } @@ -100959,6 +98004,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -100987,7 +98033,6 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iTo TPgno) { var pDb, pElem, pHash, pIdx, pTab uintptr _, _, _, _, _ = pDb, pElem, pHash, pIdx, pTab - _ = libc.Int32FromInt32(0) pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 8 pElem = (*THash)(unsafe.Pointer(pHash)).Ffirst @@ -101001,6 +98046,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -101015,6 +98061,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -101036,7 +98083,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13620, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13649, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -101049,7 +98096,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13635, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13664, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -101095,19 +98142,18 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { break } iIdx = (*TIndex)(unsafe.Pointer(pIdx)).Ftnum - _ = libc.Int32FromInt32(0) if (iDestroyed == uint32(0) || iIdx < iDestroyed) && iIdx > iLargest { iLargest = iIdx } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { return } else { iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) _destroyRootPage(tls, pParse, int32(iLargest), iDb) iDestroyed = iLargest } @@ -101133,12 +98179,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13702, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13731, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11689, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -101156,7 +98203,6 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { _sqlite3VdbeAddOp0(tls, v, int32(OP_VBegin)) @@ -101167,7 +98213,6 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 */ pTrigger = _sqlite3TriggerList(tls, pParse, pTab) for pTrigger != 0 { - _ = libc.Int32FromInt32(0) _sqlite3DropTriggerPtr(tls, pParse, pTrigger) pTrigger = (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext } @@ -101177,7 +98222,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13716, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13745, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -101186,7 +98231,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13761, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13790, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -101221,11 +98266,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3418, int32(4)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6529, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3422, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7241, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7270, int32(10)) == 0 { return 0 } return int32(1) @@ -101255,15 +98300,12 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_drop_table } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3ReadSchema(tls, pParse) != 0 { goto exit_drop_table } if noErr != 0 { (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr++ } - _ = libc.Int32FromInt32(0) pTab = _sqlite3LocateTableItem(tls, pParse, uint32(isView), pName+8) if noErr != 0 { (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr-- @@ -101276,7 +98318,6 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) /* If pTab is a virtual table, call ViewGetColumnNames() to ensure ** it is initialized. */ @@ -101284,9 +98325,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6537 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6070 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -101319,18 +98360,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13828, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13857, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13856, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13885, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13919, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -101340,12 +98381,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11772, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11801, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -101377,7 +98419,6 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p db = (*TParse)(unsafe.Pointer(pParse)).Fdb pFKey = uintptr(0) p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable - _ = libc.Int32FromInt32(0) if p == uintptr(0) || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { goto fk_end } @@ -101387,13 +98428,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13922, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13951, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13985, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14014, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -101409,6 +98450,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -101417,7 +98459,6 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } (*TFKey)(unsafe.Pointer(pFKey)).FpFrom = p - _ = libc.Int32FromInt32(0) (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -101452,10 +98493,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14079, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14108, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -101463,6 +98505,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -101482,26 +98525,24 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } (*TFKey)(unsafe.Pointer(pFKey)).FisDeferred = uint8(0) *(*Tu8)(unsafe.Pointer(pFKey + 45)) = uint8(flags & libc.Int32FromInt32(0xff)) /* ON DELETE action */ *(*Tu8)(unsafe.Pointer(pFKey + 45 + 1)) = uint8(flags >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) /* ON UPDATE action */ - _ = libc.Int32FromInt32(0) pNextTo = _sqlite3HashInsert(tls, (*TTable)(unsafe.Pointer(p)).FpSchema+80, (*TFKey)(unsafe.Pointer(pFKey)).FzTo, pFKey) if pNextTo == pFKey { _sqlite3OomFault(tls, db) goto fk_end } if pNextTo != 0 { - _ = libc.Int32FromInt32(0) (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo = pNextTo (*TFKey)(unsafe.Pointer(pNextTo)).FpPrevTo = pFKey } /* Link the foreign key to the table as the last step. */ - _ = libc.Int32FromInt32(0) (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -101509,6 +98550,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -101543,7 +98585,7 @@ func _sqlite3DeferForeignKey(tls *libc.TLS, pParse uintptr, isDeferred int32) { if v2 == uintptr(0) { return } - _ = libc.Int32FromInt32(0) /* EV: R-30323-21917 */ + /* EV: R-30323-21917 */ (*TFKey)(unsafe.Pointer(pFKey)).FisDeferred = uint8(isDeferred) } @@ -101594,7 +98636,6 @@ func _sqlite3RefillIndex(tls *libc.TLS, pParse uintptr, pIndex uintptr, memRootP tnum = (*TIndex)(unsafe.Pointer(pIndex)).Ftnum } pKey = _sqlite3KeyInfoOfIndex(tls, pParse, pIndex) - _ = libc.Int32FromInt32(0) /* Open the sorter cursor if we are to use one. */ v6 = pParse + 52 v5 = *(*int32)(unsafe.Pointer(v6)) @@ -101715,15 +98756,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14125 + v2 = __ccgo_ts + 14154 } else { - v2 = __ccgo_ts + 14131 + v2 = __ccgo_ts + 14160 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14136, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14165, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -101762,11 +98804,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u nExtra = 0 /* Number of extra columns needed */ *(*uintptr)(unsafe.Pointer(bp + 104)) = uintptr(0) /* Extra space after the Index object */ pPk = uintptr(0) /* PRIMARY KEY index for WITHOUT ROWID tables */ - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) && int32(idxType) != int32(SQLITE_IDXTYPE_PRIMARYKEY) { goto exit_create_index } @@ -101784,12 +98824,10 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** to search for the table. 'Fix' the table name to this db ** before looking up the table. */ - _ = libc.Int32FromInt32(0) iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+96) if iDb < 0 { goto exit_create_index } - _ = libc.Int32FromInt32(0) /* If the index name was unqualified, check if the table ** is a temp table. If so, set the database to 1. Do not do this ** if initializing a database schema. @@ -101800,27 +98838,23 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14164, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14193, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ - _ = libc.Int32FromInt32(0) } pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pTblName+8) - _ = libc.Int32FromInt32(0) if pTab == uintptr(0) { goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14170, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14199, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pPk = _sqlite3PrimaryKeyIndex(tls, pTab) } } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable if !(pTab != 0) { goto exit_create_index @@ -101828,17 +98862,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 - _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14220, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6529, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14249, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14277, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14302, 0) goto exit_create_index } /* @@ -101859,22 +98892,20 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if zName == uintptr(0) { goto exit_create_index } - _ = libc.Int32FromInt32(0) - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14164, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14193, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14307, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14336, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14341, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14370, libc.VaList(bp+136, zName)) } else { - _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) _sqlite3ForceNotReadOnly(tls, pParse) } @@ -101890,10 +98921,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14365, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14394, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -101911,9 +98943,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6537 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6070 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -101939,10 +98971,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pList == uintptr(0) { goto exit_create_index } - _ = libc.Int32FromInt32(0) _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14164) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14193) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -101956,13 +98987,12 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break } pExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { - _ = libc.Int32FromInt32(0) nExtra += int32(1) + _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8))) } goto _4 _4: + ; i++ } /* @@ -101975,13 +99005,10 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u v5 = int32(1) } nExtraCol = v5 - _ = libc.Int32FromInt32(0) pIndex = _sqlite3AllocateIndexObject(tls, db, int16((*TExprList)(unsafe.Pointer(pList)).FnExpr+nExtraCol), nName+nExtra+int32(1), bp+104) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_create_index } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TIndex)(unsafe.Pointer(pIndex)).FzName = *(*uintptr)(unsafe.Pointer(bp + 104)) *(*uintptr)(unsafe.Pointer(bp + 104)) += uintptr(nName + int32(1)) libc.Xmemcpy(tls, (*TIndex)(unsafe.Pointer(pIndex)).FzName, zName, uint64(nName+int32(1))) @@ -101996,7 +99023,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u (*TIndex)(unsafe.Pointer(pIndex)).FpPartIdxWhere = pPIWhere pPIWhere = uintptr(0) } - _ = libc.Int32FromInt32(0) /* Check to see if we should honor DESC requests on index columns */ if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) >= int32(4) { @@ -102031,7 +99057,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14388, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14417, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -102044,7 +99070,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 12, 0x1000) } else { j = int32((*TExpr)(unsafe.Pointer(pCExpr)).FiColumn) - _ = libc.Int32FromInt32(0) if j < 0 { j = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } else { @@ -102060,10 +99085,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } zColl = uintptr(0) if int32((*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr)).Fop) == int32(TK_COLLATE) { - _ = libc.Int32FromInt32(0) zColl = *(*uintptr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr + 8)) nColl = _sqlite3Strlen30(tls, zColl) + int32(1) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 104)), zColl, uint64(nColl)) zColl = *(*uintptr)(unsafe.Pointer(bp + 104)) *(*uintptr)(unsafe.Pointer(bp + 104)) += uintptr(nColl) @@ -102084,6 +99107,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -102098,7 +99122,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break } x = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2))) - _ = libc.Int32FromInt32(0) if _isDupColumn(tls, pIndex, int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol), pPk, j) != 0 { (*TIndex)(unsafe.Pointer(pIndex)).FnColumn-- } else { @@ -102109,9 +99132,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } - _ = libc.Int32FromInt32(0) } else { *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) @@ -102122,7 +99145,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* If this index contains every column of its table, then mark ** it as a covering index */ - _ = libc.Int32FromInt32(0) _recomputeColumnsNotIndexed(tls, pIndex) if pTblName != uintptr(0) && int32((*TIndex)(unsafe.Pointer(pIndex)).FnColumn) >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 5, 0x20) @@ -102141,6 +99163,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -102150,9 +99173,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(pIdx != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) != int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol) { goto _9 } @@ -102161,7 +99181,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(k < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { break } - _ = libc.Int32FromInt32(0) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(k)*2))) != int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(k)*2))) { break } @@ -102172,6 +99191,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -102184,7 +99204,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14449, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14478, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -102202,6 +99222,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -102209,21 +99230,18 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u /* Link the new Index structure to its table and to the other ** in-memory database structures. */ - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14491, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14520, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } p = _sqlite3HashInsert(tls, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema+32, (*TIndex)(unsafe.Pointer(pIndex)).FzName, pIndex) if p != 0 { - _ = libc.Int32FromInt32(0) /* Malloc must have failed */ + /* Malloc must have failed */ _sqlite3OomFault(tls, db) goto exit_create_index } @@ -102250,7 +99268,6 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u /* Gather the complete text of the CREATE INDEX statement into ** the zStmt variable */ - _ = libc.Int32FromInt32(0) if pStart != 0 { n1 = int32(uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64((*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn) if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz + uintptr(n1-int32(1))))) == int32(';') { @@ -102258,11 +99275,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* A named index with an explicit CREATE INDEX statement */ if onError == OE_None { - v13 = __ccgo_ts + 1648 + v13 = __ccgo_ts + 1652 } else { - v13 = __ccgo_ts + 14508 + v13 = __ccgo_ts + 14537 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14516, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14545, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -102270,7 +99287,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14536, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14565, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -102278,7 +99295,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14595, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14624, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -102291,13 +99308,13 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pIndex = uintptr(0) } else { if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewIndex = pIndex pIndex = uintptr(0) } } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -102326,6 +99343,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -102368,7 +99386,6 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { } nCopy = v1 /* Indexes with default row estimates should not have stat1 data */ - _ = libc.Int32FromInt32(0) /* Set the first entry (number of rows in the index) to the estimated ** number of rows in the table, or half the number of rows in the table ** for a partial index. @@ -102380,7 +99397,6 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { ** stat1 data to be ignored by the query planner. */ x = (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FnRowLogEst - _ = libc.Int32FromInt32(0) if int32(x) < int32(99) { v2 = libc.Int16FromInt32(99) x = v2 @@ -102388,7 +99404,6 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { } if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) { x = TLogEst(int32(x) - libc.Int32FromInt32(10)) - _ = libc.Int32FromInt32(0) } *(*TLogEst)(unsafe.Pointer(a)) = x /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is @@ -102400,12 +99415,11 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { break } *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) - _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ } - _ = libc.Int32FromInt32(0) if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { *(*TLogEst)(unsafe.Pointer(a + uintptr((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)*2)) = 0 } @@ -102436,15 +99450,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto exit_drop_index } - _ = libc.Int32FromInt32(0) /* Never called with prior non-OOM errors */ - _ = libc.Int32FromInt32(0) + /* Never called with prior non-OOM errors */ if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { goto exit_drop_index } pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14622, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14651, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -102453,7 +99466,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14640, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14669, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -102461,9 +99474,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6537 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6070 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -102479,13 +99492,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14713, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11768, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14742, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11797, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102582,11 +99596,10 @@ func _sqlite3IdListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { var i int32 _ = i - _ = libc.Int32FromInt32(0) if pList == uintptr(0) { return } - _ = libc.Int32FromInt32(0) /* EU4_EXPR mode is not currently used */ + /* EU4_EXPR mode is not currently used */ i = 0 for { if !(i < (*TIdList)(unsafe.Pointer(pList)).FnId) { @@ -102595,6 +99608,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -102609,7 +99623,6 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) { var i int32 _ = i - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TIdList)(unsafe.Pointer(pList)).FnId) { @@ -102620,6 +99633,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -102664,16 +99678,12 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var nAlloc Tsqlite3_int64 _, _, _, _ = db, i, nAlloc, pNew /* Sanity checking on calling parameters */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Allocate additional space if needed */ if uint32((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc)+uint32(nExtra) > (*TSrcList)(unsafe.Pointer(pSrc)).FnAlloc { nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14773, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14802, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -102681,7 +99691,6 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra } pNew = _sqlite3DbRealloc(tls, db, pSrc, uint64(112)+uint64(nAlloc-libc.Int64FromInt32(1))*uint64(104)) if pNew == uintptr(0) { - _ = libc.Int32FromInt32(0) return uintptr(0) } pSrc = pNew @@ -102697,6 +99706,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -102710,6 +99720,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -102756,9 +99767,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra func _sqlite3SrcListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pTable uintptr, pDatabase uintptr) (r uintptr) { var db, pItem, pNew uintptr _, _, _ = db, pItem, pNew - _ = libc.Int32FromInt32(0) /* Cannot have C without B */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* Cannot have C without B */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb if pList == uintptr(0) { pList = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(112)) @@ -102801,7 +99810,6 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) var i, v2 int32 var pItem, v3 uintptr _, _, _, _ = i, pItem, v2, v3 - _ = libc.Int32FromInt32(0) if pList != 0 { i = 0 pItem = pList + 8 @@ -102821,6 +99829,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -102836,7 +99845,6 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { var i int32 var pItem uintptr _, _ = i, pItem - _ = libc.Int32FromInt32(0) if pList == uintptr(0) { return } @@ -102874,6 +99882,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -102906,21 +99915,18 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14809 + v1 = __ccgo_ts + 14838 } else { - v1 = __ccgo_ts + 14812 + v1 = __ccgo_ts + 14841 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14818, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14847, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) if p == uintptr(0) { goto append_from_error } - _ = libc.Int32FromInt32(0) pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { if pDatabase != 0 && (*TToken)(unsafe.Pointer(pDatabase)).Fz != 0 { v2 = pDatabase @@ -102930,7 +99936,6 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa pToken = v2 _sqlite3RenameTokenMap(tls, pParse, (*TSrcItem)(unsafe.Pointer(pItem)).FzName, pToken) } - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pAlias)).Fn != 0 { (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias = _sqlite3NameFromToken(tls, db, pAlias) } @@ -102940,8 +99945,6 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 13, 0x2000) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pOnUsing == uintptr(0) { *(*uintptr)(unsafe.Pointer(pItem + 72)) = uintptr(0) } else { @@ -102954,7 +99957,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: - _ = libc.Int32FromInt32(0) + ; _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) return uintptr(0) @@ -102969,13 +99972,8 @@ append_from_error: func _sqlite3SrcListIndexedBy(tls *libc.TLS, pParse uintptr, p uintptr, pIndexedBy uintptr) { var pItem uintptr _ = pItem - _ = libc.Int32FromInt32(0) if p != 0 && (*TToken)(unsafe.Pointer(pIndexedBy)).Fn > uint32(0) { - _ = libc.Int32FromInt32(0) pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pIndexedBy)).Fn == uint32(1) && !((*TToken)(unsafe.Pointer(pIndexedBy)).Fz != 0) { /* A "NOT INDEXED" clause was supplied. See parse.y ** construct "indexed_opt" for details. */ @@ -102983,7 +99981,7 @@ func _sqlite3SrcListIndexedBy(tls *libc.TLS, pParse uintptr, p uintptr, pIndexed } else { *(*uintptr)(unsafe.Pointer(pItem + 88)) = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIndexedBy) libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 1, 0x2) - _ = libc.Int32FromInt32(0) /* No collision on union u2 */ + /* No collision on union u2 */ } } } @@ -102998,7 +99996,6 @@ func _sqlite3SrcListIndexedBy(tls *libc.TLS, pParse uintptr, p uintptr, pIndexed func _sqlite3SrcListAppendList(tls *libc.TLS, pParse uintptr, p1 uintptr, p2 uintptr) (r uintptr) { var pNew, p11 uintptr _, _ = pNew, p11 - _ = libc.Int32FromInt32(0) if p2 != 0 { pNew = _sqlite3SrcListEnlarge(tls, pParse, p1, (*TSrcList)(unsafe.Pointer(p2)).FnSrc, int32(1)) if pNew == uintptr(0) { @@ -103025,9 +100022,6 @@ func _sqlite3SrcListFuncArgs(tls *libc.TLS, pParse uintptr, p uintptr, pList uin _ = pItem if p != 0 { pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pItem + 88)) = pList libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 2, 0x4) } else { @@ -103074,6 +100068,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -103091,15 +100086,16 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- - _ = libc.Int32FromInt32(0) for { p7 = p + 8 + uintptr(i)*104 + 60 *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -103119,10 +100115,8 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { var db, pBt, v uintptr var eTxnType, i int32 _, _, _, _, _ = db, eTxnType, i, pBt, v - _ = libc.Int32FromInt32(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14854, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14883, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -103149,6 +100143,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -103166,14 +100161,11 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { var isRollback int32 var v, v1 uintptr _, _, _ = isRollback, v, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14860 + v1 = __ccgo_ts + 14889 } else { - v1 = __ccgo_ts + 14869 + v1 = __ccgo_ts + 14898 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -103196,7 +100188,6 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { zName = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pName) if zName != 0 { v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) if !(v != 0) || _sqlite3AuthCheck(tls, pParse, int32(SQLITE_SAVEPOINT), _az[op], zName, uintptr(0)) != 0 { _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zName) return @@ -103206,9 +100197,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14854, - 1: __ccgo_ts + 14876, - 2: __ccgo_ts + 14860, + 0: __ccgo_ts + 14883, + 1: __ccgo_ts + 14905, + 2: __ccgo_ts + 14889, } // C documentation @@ -103228,12 +100219,11 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14884, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14913, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt = *(*uintptr)(unsafe.Pointer(bp)) - _ = libc.Int32FromInt32(0) if int32(SQLITE_NOMEM) == _sqlite3BtreeSetPageSize(tls, *(*uintptr)(unsafe.Pointer(bp)), (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize, 0, 0) { _sqlite3OomFault(tls, db) return int32(1) @@ -103253,10 +100243,6 @@ var _flags = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQ // ** later, by sqlite3FinishCoding(). // */ func _sqlite3CodeVerifySchemaAtToplevel(tls *libc.TLS, pToplevel uintptr, iDb int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if libc.BoolInt32((*TParse)(unsafe.Pointer(pToplevel)).FcookieMask&(libc.Uint32FromInt32(1)<= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12385, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)<= 0 && 0 == _sqlite3StrICmp(tls, z, zColl) { return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -103519,6 +100503,7 @@ func _reindexTable(tls *libc.TLS, pParse uintptr, pTab uintptr, zColl uintptr) { } goto _1 _1: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -103536,14 +100521,13 @@ func _reindexDatabases(tls *libc.TLS, pParse uintptr, zColl uintptr) { var iDb int32 _, _, _, _, _ = db, iDb, k, pDb, pTab /* The database index number */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* A table in the database */ - _ = libc.Int32FromInt32(0) /* Needed for schema access */ + /* Needed for schema access */ iDb = 0 pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb for { if !(iDb < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { break } - _ = libc.Int32FromInt32(0) k = (*THash)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema + 8)).Ffirst for { if !(k != 0) { @@ -103553,10 +100537,12 @@ func _reindexDatabases(tls *libc.TLS, pParse uintptr, zColl uintptr) { _reindexTable(tls, pParse, pTab, zColl) goto _2 _2: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } goto _1 _1: + ; iDb++ pDb += 32 } @@ -103595,7 +100581,6 @@ func _sqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp return } else { if pName2 == uintptr(0) || (*TToken)(unsafe.Pointer(pName2)).Fz == uintptr(0) { - _ = libc.Int32FromInt32(0) zColl = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pName1) if !(zColl != 0) { return @@ -103637,7 +100622,7 @@ func _sqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _sqlite3RefillIndex(tls, pParse, pIndex, -int32(1)) return } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14977, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15006, 0) } // C documentation @@ -103663,7 +100648,6 @@ func _sqlite3KeyInfoOfIndex(tls *libc.TLS, pParse uintptr, pIdx uintptr) (r uint pKey = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, nCol, 0) } if pKey != 0 { - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nCol) { @@ -103677,13 +100661,12 @@ func _sqlite3KeyInfoOfIndex(tls *libc.TLS, pParse uintptr, pIdx uintptr) (r uint } *(*uintptr)(unsafe.Pointer(pKey + 32 + uintptr(i)*8)) = v2 *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKey)).FaSortFlags + uintptr(i))) = *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i))) - _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x200>>9)) == 0 { /* Deactivate the index because it contains an unknown collating ** sequence. The only way to reactive the index is to reload the @@ -103712,7 +100695,6 @@ func _sqlite3CteNew(tls *libc.TLS, pParse uintptr, pName uintptr, pArglist uintp _, _ = db, pNew db = (*TParse)(unsafe.Pointer(pParse)).Fdb pNew = _sqlite3DbMallocZero(tls, db, uint64(48)) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { _sqlite3ExprListDelete(tls, db, pArglist) _sqlite3SelectDelete(tls, db, pQuery) @@ -103732,7 +100714,6 @@ func _sqlite3CteNew(tls *libc.TLS, pParse uintptr, pName uintptr, pArglist uintp // ** for the object itself. // */ func _cteClear(tls *libc.TLS, db uintptr, pCte uintptr) { - _ = libc.Int32FromInt32(0) _sqlite3ExprListDelete(tls, db, (*TCte)(unsafe.Pointer(pCte)).FpCols) _sqlite3SelectDelete(tls, db, (*TCte)(unsafe.Pointer(pCte)).FpSelect) _sqlite3DbFree(tls, db, (*TCte)(unsafe.Pointer(pCte)).FzName) @@ -103744,7 +100725,6 @@ func _cteClear(tls *libc.TLS, db uintptr, pCte uintptr) { // ** Free the contents of the CTE object passed as the second argument. // */ func _sqlite3CteDelete(tls *libc.TLS, db uintptr, pCte uintptr) { - _ = libc.Int32FromInt32(0) _cteClear(tls, db, pCte) _sqlite3DbFree(tls, db, pCte) } @@ -103778,10 +100758,11 @@ func _sqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) break } if _sqlite3StrICmp(tls, zName, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FzName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15023, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15052, libc.VaList(bp+8, zName)) } goto _1 _1: + ; i++ } } @@ -103791,7 +100772,6 @@ func _sqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) } else { pNew = _sqlite3DbMallocZero(tls, db, uint64(64)) } - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { _sqlite3CteDelete(tls, db, pCte) pNew = pWith @@ -103822,6 +100802,7 @@ func _sqlite3WithDelete(tls *libc.TLS, db uintptr, pWith uintptr) { _cteClear(tls, db, pWith+16+uintptr(i)*48) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, pWith) @@ -103861,7 +100842,6 @@ func _sqlite3WithDeleteGeneric(tls *libc.TLS, db uintptr, pWith uintptr) { func _callCollNeeded(tls *libc.TLS, db uintptr, enc int32, zName uintptr) { var pTmp, zExternal, zExternal1 uintptr _, _, _ = pTmp, zExternal, zExternal1 - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FxCollNeeded != 0 { zExternal = _sqlite3DbStrDup(tls, db, zName) if !(zExternal != 0) { @@ -103908,6 +100888,7 @@ func _synthCollSeq(tls *libc.TLS, db uintptr, pColl uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(SQLITE_ERROR) @@ -103942,7 +100923,6 @@ func _sqlite3CheckCollSeq(tls *libc.TLS, pParse uintptr, pColl uintptr) (r int32 if !(p != 0) { return int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) } return SQLITE_OK } @@ -103984,7 +100964,6 @@ func _findCollSeqEntry(tls *libc.TLS, db uintptr, zName uintptr, create int32) ( ** return the pColl pointer to be deleted (because it wasn't added ** to the hash table). */ - _ = libc.Int32FromInt32(0) if pDel != uintptr(0) { _sqlite3OomFault(tls, db) _sqlite3DbFree(tls, db, pDel) @@ -104015,8 +100994,6 @@ func _findCollSeqEntry(tls *libc.TLS, db uintptr, zName uintptr, create int32) ( func _sqlite3FindCollSeq(tls *libc.TLS, db uintptr, enc Tu8, zName uintptr, create int32) (r uintptr) { var pColl uintptr _ = pColl - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if zName != 0 { pColl = _findCollSeqEntry(tls, db, zName, create) if pColl != 0 { @@ -104035,7 +101012,6 @@ func _sqlite3FindCollSeq(tls *libc.TLS, db uintptr, enc Tu8, zName uintptr, crea // ** the pDfltColl must change as well. // */ func _sqlite3SetTextEncoding(tls *libc.TLS, db uintptr, enc Tu8) { - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Fenc = enc /* EVIDENCE-OF: R-08308-17224 The default collating function for all ** strings is BINARY. @@ -104080,9 +101056,8 @@ func _sqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc Tu8, pColl uintptr, z if p != 0 && !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) && _synthCollSeq(tls, db, p) != 0 { p = uintptr(0) } - _ = libc.Int32FromInt32(0) if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15053, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15082, libc.VaList(bp+8, zName)) (*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(1)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15113, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -104561,7 +101534,6 @@ func _tabIsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Readonly) != uint32(0) { return libc.BoolInt32(_sqlite3WritableSchema(tls, db) == 0 && int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0) } - _ = libc.Int32FromInt32(0) return _sqlite3ReadOnlyShadowTables(tls, db) } @@ -104578,11 +101550,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15117, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15175, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -104607,11 +101579,8 @@ func _sqlite3MaterializeView(tls *libc.TLS, pParse uintptr, pView uintptr, pWher pWhere = _sqlite3ExprDup(tls, db, pWhere, 0) pFrom = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) if pFrom != 0 { - _ = libc.Int32FromInt32(0) (*(*TSrcItem)(unsafe.Pointer(pFrom + 8))).FzName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pView)).FzName) (*(*TSrcItem)(unsafe.Pointer(pFrom + 8))).FzDatabase = _sqlite3DbStrDup(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } pSel = _sqlite3SelectNew(tls, pParse, uintptr(0), pFrom, pWhere, uintptr(0), uintptr(0), pOrderBy, uint32(SF_IncludeHidden), pLimit) _sqlite3SelectDestInit(tls, bp, int32(SRT_EphemTab), iCur) @@ -104656,12 +101625,9 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere addrEphOpen = 0 /* List of table triggers, if required */ libc.Xmemset(tls, bp+8, 0, uint64(16)) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto delete_from_cleanup } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Locate the table which we want to delete. This table has to be ** put in an SrcList structure because some of the subroutines we ** will be calling are designed to work with multiple tables and expect @@ -104686,16 +101652,12 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere goto delete_from_cleanup } iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) rcauth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) - _ = libc.Int32FromInt32(0) if rcauth == int32(SQLITE_DENY) { goto delete_from_cleanup } - _ = libc.Int32FromInt32(0) /* Assign cursor numbers to the table and all its indices. */ - _ = libc.Int32FromInt32(0) v3 = pParse + 52 v2 = *(*int32)(unsafe.Pointer(v3)) *(*int32)(unsafe.Pointer(v3))++ @@ -104711,6 +101673,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -104770,7 +101733,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** individually. */ if rcauth == SQLITE_OK && pWhere == uintptr(0) && !(bComplex != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback == uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(1), (*TTable)(unsafe.Pointer(pTab)).FzName) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { if memCnt != 0 { @@ -104785,7 +101747,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if !(pIdx != 0) { break } - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { if memCnt != 0 { v10 = memCnt @@ -104798,6 +101759,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -104814,7 +101776,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { /* For a rowid table, initialize the RowSet to an empty set */ pPk = uintptr(0) - _ = libc.Int32FromInt32(0) v13 = pParse + 56 *(*int32)(unsafe.Pointer(v13))++ v12 = *(*int32)(unsafe.Pointer(v13)) @@ -104824,7 +101785,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere /* For a WITHOUT ROWID table, create an ephemeral table used to ** hold all primary keys for rows to be deleted. */ pPk = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) nPk = int16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) iPk = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(nPk) @@ -104848,8 +101808,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere goto delete_from_cleanup } eOnePass = _sqlite3WhereOkOnePass(tls, pWInfo, bp+80) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eOnePass != int32(ONEPASS_SINGLE) { _sqlite3MultiWrite(tls, pParse) } @@ -104867,10 +101825,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if !(i < int32(nPk)) { break } - _ = libc.Int32FromInt32(0) _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -104931,8 +101889,6 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere iAddrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) } _sqlite3OpenTableAndIndices(tls, pParse, pTab, int32(OP_OpenWrite), uint8(OPFLAG_FORDELETE), iTabCur, aToOpen, bp, bp+4) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eOnePass == int32(ONEPASS_MULTI) { _sqlite3VdbeJumpHereOrPopInst(tls, v, iAddrOnce) } @@ -104941,9 +101897,8 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** where-clause loop above. */ if eOnePass != ONEPASS_OFF { - _ = libc.Int32FromInt32(0) /* OP_Found will use an unpacked key */ + /* OP_Found will use an unpacked key */ if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(*(*int32)(unsafe.Pointer(bp))-iTabCur))) != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), *(*int32)(unsafe.Pointer(bp)), addrBypass, iKey, int32(nKey)) } } else { @@ -104954,17 +101909,15 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_RowData), iEphCur, iKey) } - _ = libc.Int32FromInt32(0) /* OP_Found will use a composite key */ + /* OP_Found will use a composite key */ } else { addrLoop = _sqlite3VdbeAddOp3(tls, v, int32(OP_RowSetRead), iRowSet, 0, iKey) - _ = libc.Int32FromInt32(0) } } /* Delete the row */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pVTab = _sqlite3GetVTable(tls, db, pTab) _sqlite3VtabMakeWritable(tls, pParse, pTab) - _ = libc.Int32FromInt32(0) _sqlite3MayAbort(tls, pParse) if eOnePass == int32(ONEPASS_SINGLE) { _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iTabCur) @@ -105004,9 +101957,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15184) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15213) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -105072,7 +102026,6 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Vdbe */ iOld = 0 /* Seek opcode */ /* Vdbe is guaranteed to have been allocated by this stage. */ - _ = libc.Int32FromInt32(0) /* Seek cursor iCur to the row to delete. If this row no longer exists ** (this can happen if a trigger program has already deleted it), do ** not attempt to delete it or fire any DELETE triggers. */ @@ -105109,6 +102062,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -105150,7 +102104,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11557) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11586) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -105220,7 +102174,6 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, if !(pIdx != 0) { break } - _ = libc.Int32FromInt32(0) if aRegIdx != uintptr(0) && *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) == 0 { goto _2 } @@ -105242,6 +102195,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -105328,6 +102282,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -105381,10 +102336,7 @@ func _sqlite3ResolvePartIdxLabel(tls *libc.TLS, pParse uintptr, iLabel int32) { func _sqlite3GetFuncCollSeq(tls *libc.TLS, context uintptr) (r uintptr) { var pOp uintptr _ = pOp - _ = libc.Int32FromInt32(0) pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(context)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(context)).FiOp-int32(1))*24 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return *(*uintptr)(unsafe.Pointer(pOp + 16)) } @@ -105395,7 +102347,6 @@ func _sqlite3GetFuncCollSeq(tls *libc.TLS, context uintptr) (r uintptr) { // ** iteration of the aggregate loop. // */ func _sqlite3SkipAccumulatorLoad(tls *libc.TLS, context uintptr) { - _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(context)).FisError = -int32(1) (*Tsqlite3_context)(unsafe.Pointer(context)).FskipFlag = uint8(1) } @@ -105409,7 +102360,6 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var i, iBest, mask, v1 int32 var pColl uintptr _, _, _, _, _ = i, iBest, mask, pColl, v1 - _ = libc.Int32FromInt32(0) if Xsqlite3_user_data(tls, context) == uintptr(0) { v1 = 0 } else { @@ -105417,8 +102367,6 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } mask = v1 pColl = _sqlite3GetFuncCollSeq(tls, context) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iBest = 0 if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { return @@ -105436,6 +102384,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -105451,12 +102400,6 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _ = i i = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) - int32(1) _ = NotUsed - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* EVIDENCE-OF: R-01470-60482 The sqlite3_value_type(V) interface returns ** the datatype code for the initial datatype of the sqlite3_value object ** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT, @@ -105465,11 +102408,11 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6281, - 1: __ccgo_ts + 6276, - 2: __ccgo_ts + 8172, - 3: __ccgo_ts + 8167, - 4: __ccgo_ts + 1634, + 0: __ccgo_ts + 6310, + 1: __ccgo_ts + 6305, + 2: __ccgo_ts + 8201, + 3: __ccgo_ts + 8196, + 4: __ccgo_ts + 1638, } // C documentation @@ -105492,7 +102435,6 @@ func _lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var c, v1 uint8 var z, z0 uintptr _, _, _, _ = c, z, z0, v1 - _ = libc.Int32FromInt32(0) _ = argc switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case int32(SQLITE_BLOB): @@ -105537,7 +102479,6 @@ func _bytelengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var m Ti64 var v1 int32 _, _ = m, v1 - _ = libc.Int32FromInt32(0) _ = argc switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case int32(SQLITE_BLOB): @@ -105576,7 +102517,6 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var iVal Ti64 var rVal float64 _, _ = iVal, rVal - _ = libc.Int32FromInt32(0) _ = argc switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case int32(SQLITE_INTEGER): @@ -105586,7 +102526,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15226, -int32(1)) return } iVal = -iVal @@ -105682,10 +102622,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -105741,7 +102683,6 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var z, z2, v2, v3, v5 uintptr _, _, _, _, _, _, _, _, _, _ = len1, negP2, p0type, p1, p2, z, z2, v2, v3, v5 negP2 = 0 - _ = libc.Int32FromInt32(0) if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == int32(SQLITE_NULL) || argc == int32(3) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) == int32(SQLITE_NULL) { return } @@ -105753,7 +102694,6 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if z == uintptr(0) { return } - _ = libc.Int32FromInt32(0) } else { z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if z == uintptr(0) { @@ -105775,6 +102715,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -105813,7 +102754,6 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { p1 = 0 } } - _ = libc.Int32FromInt32(0) if p0type != int32(SQLITE_BLOB) { for *(*uint8)(unsafe.Pointer(z)) != 0 && p1 != 0 { v3 = z @@ -105839,6 +102779,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -105867,7 +102808,6 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _ /* r at bp+0 */ float64 _, _, _ = n, zBuf, v1 n = 0 - _ = libc.Int32FromInt32(0) if argc == int32(2) { if int32(SQLITE_NULL) == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) { return @@ -105899,7 +102839,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15214, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15243, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -105924,7 +102864,6 @@ func _contextMalloc(tls *libc.TLS, context uintptr, nByte Ti64) (r uintptr) { var db, z uintptr _, _ = db, z db = Xsqlite3_context_db_handle(tls, context) - _ = libc.Int32FromInt32(0) if nByte > int64(*(*int32)(unsafe.Pointer(db + 136))) { Xsqlite3_result_error_toobig(tls, context) z = uintptr(0) @@ -105950,7 +102889,6 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) /* Verify that the call to _bytes() does not invalidate the _text() pointer */ - _ = libc.Int32FromInt32(0) if z2 != 0 { z1 = _contextMalloc(tls, context, int64(n)+int64(1)) if z1 != 0 { @@ -105962,6 +102900,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -105977,7 +102916,6 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) /* Verify that the call to _bytes() does not invalidate the _text() pointer */ - _ = libc.Int32FromInt32(0) if z2 != 0 { z1 = _contextMalloc(tls, context, int64(n)+int64(1)) if z1 != 0 { @@ -105989,6 +102927,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106041,7 +102980,6 @@ func _randomBlob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var n Tsqlite3_int64 var p uintptr _, _ = n, p - _ = libc.Int32FromInt32(0) _ = argc n = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) if n < int64(1) { @@ -106257,7 +103195,7 @@ func _patternCompare(tls *libc.TLS, _zPattern uintptr, _zString uintptr, pInfo u } else { /* "[...]" immediately follows the "*". We have to do a slow ** recursive search in this case, but it is an unusual case. */ - _ = libc.Int32FromInt32(0) /* '[' is a single-byte character */ + /* '[' is a single-byte character */ for *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) != 0 { bMatch = _patternCompare(tls, *(*uintptr)(unsafe.Pointer(bp))+uintptr(-libc.Int32FromInt32(1)), *(*uintptr)(unsafe.Pointer(bp + 8)), pInfo, matchOther) if bMatch != int32(SQLITE_NOMATCH) { @@ -106481,7 +103419,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15220, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15249, -int32(1)) return } if argc == int32(3) { @@ -106493,7 +103431,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15253, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15282, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -106575,7 +103513,7 @@ func _errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { defer tls.Free(16) _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // C documentation @@ -106588,7 +103526,6 @@ func _errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { func _compileoptionusedFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var zOptName, v1 uintptr _, _ = zOptName, v1 - _ = libc.Int32FromInt32(0) _ = argc /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL ** function is a wrapper around the sqlite3_compileoption_used() C/C++ @@ -106611,7 +103548,6 @@ func _compileoptionusedFunc(tls *libc.TLS, context uintptr, argc int32, argv uin func _compileoptiongetFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var n int32 _ = n - _ = libc.Int32FromInt32(0) _ = argc /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. @@ -106661,25 +103597,24 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { /* As currently implemented, the string must be initially empty. ** we might relax this requirement in the future, but that will ** require enhancements to the implementation. */ - _ = libc.Int32FromInt32(0) switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5042, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15327, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15298, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15335, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+1404, libc.VaList(bp+16, Xsqlite3_value_int64(tls, pValue))) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+1408, libc.VaList(bp+16, Xsqlite3_value_int64(tls, pValue))) case int32(SQLITE_BLOB): zBlob = Xsqlite3_value_blob(tls, pValue) nBlob = int64(Xsqlite3_value_bytes(tls, pValue)) - _ = libc.Int32FromInt32(0) /* No encoding change */ + /* No encoding change */ _sqlite3StrAccumEnlarge(tls, pStr, nBlob*int64(2)+int64(4)) if int32((*TStrAccum)(unsafe.Pointer(pStr)).FaccError) == 0 { zText = (*TStrAccum)(unsafe.Pointer(pStr)).FzText @@ -106692,6 +103627,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') @@ -106702,10 +103638,9 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15305, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15343, libc.VaList(bp+16, zArg)) default: - _ = libc.Int32FromInt32(0) - Xsqlite3_str_append(tls, pStr, __ccgo_ts+1649, int32(4)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+1653, int32(4)) break } } @@ -106729,7 +103664,6 @@ func _quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _ /* str at bp+0 */ Tsqlite3_str _ = db db = Xsqlite3_context_db_handle(tls, context) - _ = libc.Int32FromInt32(0) _ = argc _sqlite3StrAccumInit(tls, bp, db, uintptr(0), 0, *(*int32)(unsafe.Pointer(db + 136))) _sqlite3QuoteValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv))) @@ -106828,6 +103762,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -106845,11 +103780,10 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var i, n int32 var pBlob, z, zHex, v1, v3, v4 uintptr _, _, _, _, _, _, _, _, _ = c, i, n, pBlob, z, zHex, v1, v3, v4 - _ = libc.Int32FromInt32(0) _ = argc pBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) - _ = libc.Int32FromInt32(0) /* No encoding change */ + /* No encoding change */ v1 = _contextMalloc(tls, context, int64(n)*int64(2)+int64(1)) zHex = v1 z = v1 @@ -106868,6 +103802,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -106942,13 +103877,12 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { var v3 uint32 var _ /* zHex at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, ch, d, nHex, nPass, p, pBlob, zPass, v1, v2, v3, v4, v5, v6 - zPass = __ccgo_ts + 1648 + zPass = __ccgo_ts + 1652 nPass = 0 *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) nHex = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) pBlob = uintptr(0) p = uintptr(0) - _ = libc.Int32FromInt32(0) if argc == int32(2) { zPass = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nPass = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -106975,7 +103909,6 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { v3 = _sqlite3Utf8Read(tls, bp) } ch = v3 - _ = libc.Int32FromInt32(0) if !(_strContainsChar(tls, zPass, nPass, ch) != 0) { goto unhex_null } @@ -106985,8 +103918,6 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } *(*uintptr)(unsafe.Pointer(bp))++ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v5 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ d = *(*Tu8)(unsafe.Pointer(v5)) @@ -106999,9 +103930,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -107015,7 +103948,6 @@ func _zeroblobFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var n Ti64 var rc int32 _, _ = n, rc - _ = libc.Int32FromInt32(0) _ = argc n = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) if n < 0 { @@ -107042,34 +103974,29 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var nOut Ti64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cntExpand, db, i, j, loopLimit, nOut, nPattern, nRep, nStr, zOld, zOut, zPattern, zRep, zStr, v2, v3 /* Number zOut expansions */ db = Xsqlite3_context_db_handle(tls, context) - _ = libc.Int32FromInt32(0) _ = argc zStr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zStr == uintptr(0) { return } nStr = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) - _ = libc.Int32FromInt32(0) /* No encoding change */ + /* No encoding change */ zPattern = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if zPattern == uintptr(0) { - _ = libc.Int32FromInt32(0) return } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { - _ = libc.Int32FromInt32(0) - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) - _ = libc.Int32FromInt32(0) /* No encoding change */ + /* No encoding change */ zRep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) if zRep == uintptr(0) { return } nRep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) - _ = libc.Int32FromInt32(0) nOut = int64(nStr + int32(1)) - _ = libc.Int32FromInt32(0) zOut = _contextMalloc(tls, context, nOut) if zOut == uintptr(0) { return @@ -107112,12 +104039,11 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i)) j += nStr - i - _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(zOut + uintptr(j))) = uint8(0) Xsqlite3_result_text(tls, context, zOut, j, __ccgo_fp(Xsqlite3_free)) } @@ -107143,7 +104069,6 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } nIn = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) - _ = libc.Int32FromInt32(0) if argc == int32(1) { nChar = int32(1) aLen = uintptr(unsafe.Pointer(&_lenOne)) @@ -107170,6 +104095,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -107195,6 +104121,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -107216,6 +104143,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -107239,6 +104167,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -107259,7 +104188,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11177, + 0: __ccgo_ts + 11206, } // C documentation @@ -107284,6 +104213,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -107312,10 +104242,10 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 - _ = libc.Int32FromInt32(0) Xsqlite3_result_text64(tls, context, z, uint64(j), __ccgo_fp(Xsqlite3_free), uint8(SQLITE_UTF8)) } @@ -107326,7 +104256,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n // ** concatentation of all non-null arguments. // */ func _concatFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { - _concatFuncCore(tls, context, argc, argv, 0, __ccgo_ts+1648) + _concatFuncCore(tls, context, argc, argv, 0, __ccgo_ts+1652) } // C documentation @@ -107370,10 +104300,9 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var zIn uintptr var _ /* zResult at bp+0 */ [8]int8 _, _, _, _, _, _, _ = code, i, j, prevcode, zIn, v3, v4 - _ = libc.Int32FromInt32(0) zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = __ccgo_ts + 1648 + zIn = __ccgo_ts + 1652 } i = 0 for { @@ -107382,6 +104311,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -107405,6 +104335,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -107417,7 +104348,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15308, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15346, int32(4), libc.UintptrFromInt32(0)) } } @@ -107478,7 +104409,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12395, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12424, -int32(1)) return } if argc == int32(2) { @@ -107598,7 +104529,6 @@ func _sumStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var type1 int32 var _ /* x at bp+0 */ Ti64 _, _ = p, type1 - _ = libc.Int32FromInt32(0) _ = argc p = Xsqlite3_aggregate_context(tls, context, int32(40)) type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) @@ -107636,14 +104566,12 @@ func _sumInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var p uintptr var type1 int32 _, _, _ = iVal, p, type1 - _ = libc.Int32FromInt32(0) _ = argc p = Xsqlite3_aggregate_context(tls, context, int32(40)) type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) /* p is always non-NULL because sumStep() will have been called first ** to initialize it */ if p != 0 && type1 != int32(SQLITE_NULL) { - _ = libc.Int32FromInt32(0) (*TSumCtx)(unsafe.Pointer(p)).Fcnt-- if !((*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0) { *(*Ti64)(unsafe.Pointer(p + 16)) -= Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) @@ -107670,9 +104598,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15226, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -107692,7 +104620,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -107711,7 +104639,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -107755,7 +104683,6 @@ func _countStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** sure it still operates correctly, verify that its count agrees with our ** internal count when using count(*) and when the total count can be ** expressed as a 32-bit integer. */ - _ = libc.Int32FromInt32(0) } func _countFinalize(tls *libc.TLS, context uintptr) { @@ -107872,7 +104799,6 @@ func _groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) var db, pGCC, pnsl, zSep, zVal uintptr var firstTerm, i, nA, nSep, nVal, v1 int32 _, _, _, _, _, _, _, _, _, _, _ = db, firstTerm, i, nA, nSep, nVal, pGCC, pnsl, zSep, zVal, v1 - _ = libc.Int32FromInt32(0) if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { return } @@ -107939,7 +104865,6 @@ func _groupConcatInverse(tls *libc.TLS, context uintptr, argc int32, argv uintpt var nVS int32 var pGCC uintptr _, _ = nVS, pGCC - _ = libc.Int32FromInt32(0) _ = argc /* Suppress unused parameter warning */ if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { return @@ -107954,7 +104879,6 @@ func _groupConcatInverse(tls *libc.TLS, context uintptr, argc int32, argv uintpt nVS = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) *(*int32)(unsafe.Pointer(pGCC + 32)) -= int32(1) if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths != uintptr(0) { - _ = libc.Int32FromInt32(0) if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum > 0 { nVS += *(*int32)(unsafe.Pointer((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths)) libc.Xmemmove(tls, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths+uintptr(1)*4, uint64((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum-libc.Int32FromInt32(1))*uint64(4)) @@ -108016,8 +104940,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15313, int32(2)) - _ = libc.Int32FromInt32(0) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15351, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } @@ -108046,12 +104969,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15319, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15319, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15357, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15357, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -108079,14 +105003,10 @@ func _sqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase var nExpr int32 var pDef, pEscape, zEscape uintptr _, _, _, _ = nExpr, pDef, pEscape, zEscape - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(*(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0) { return 0 } nExpr = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr - _ = libc.Int32FromInt32(0) pDef = _sqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(pExpr + 8)), nExpr, uint8(SQLITE_UTF8), uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_LIKE) == uint32(0) { return 0 @@ -108096,9 +105016,6 @@ func _sqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase ** asserts() that follow verify that assumption */ libc.Xmemcpy(tls, aWc, (*TFuncDef)(unsafe.Pointer(pDef)).FpUserData, uint64(3)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nExpr < int32(3) { *(*int8)(unsafe.Pointer(aWc + 3)) = 0 } else { @@ -108106,7 +105023,6 @@ func _sqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase if int32((*TExpr)(unsafe.Pointer(pEscape)).Fop) != int32(TK_STRING) { return 0 } - _ = libc.Int32FromInt32(0) zEscape = *(*uintptr)(unsafe.Pointer(pEscape + 8)) if int32(*(*int8)(unsafe.Pointer(zEscape))) == 0 || int32(*(*int8)(unsafe.Pointer(zEscape + 1))) != 0 { return 0 @@ -108142,7 +105058,6 @@ func _sqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase func _ceilingFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr _ = x - _ = libc.Int32FromInt32(0) switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case int32(SQLITE_INTEGER): Xsqlite3_result_int64(tls, context, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))) @@ -108187,7 +105102,6 @@ func _xFloor(tls *libc.TLS, x float64) (r float64) { func _logFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var ans, b, x float64 _, _, _ = ans, b, x - _ = libc.Int32FromInt32(0) switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case int32(SQLITE_INTEGER): fallthrough @@ -108255,7 +105169,6 @@ func _math1Func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var type0 int32 var x uintptr _, _, _, _ = ans, type0, v0, x - _ = libc.Int32FromInt32(0) type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { return @@ -108278,7 +105191,6 @@ func _math2Func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var type0, type1 int32 var x uintptr _, _, _, _, _, _ = ans, type0, type1, v0, v1, x - _ = libc.Int32FromInt32(0) type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { return @@ -108300,7 +105212,6 @@ func _math2Func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { // ** Implementation of 0-argument pi() function. // */ func _piFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { - _ = libc.Int32FromInt32(0) _ = argv Xsqlite3_result_double(tls, context, float64(3.141592653589793)) } @@ -108315,7 +105226,6 @@ func _signFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x float64 _, _, _, _ = type0, x, v1, v2 _ = argc - _ = libc.Int32FromInt32(0) type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { return @@ -108366,562 +105276,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15324, + FzName: __ccgo_ts + 15362, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15344, + FzName: __ccgo_ts + 15382, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15357, + FzName: __ccgo_ts + 15395, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15375, + FzName: __ccgo_ts + 15413, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15384, + FzName: __ccgo_ts + 15422, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15430, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15430, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15407, + FzName: __ccgo_ts + 15445, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15433, + FzName: __ccgo_ts + 15471, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15458, + FzName: __ccgo_ts + 15496, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15467, + FzName: __ccgo_ts + 15505, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15478, + FzName: __ccgo_ts + 15516, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15485, + FzName: __ccgo_ts + 15523, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15537, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15537, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15543, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15543, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15549, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15549, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15554, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15554, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15554, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15558, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15558, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15558, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15524, + FzName: __ccgo_ts + 15562, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15531, + FzName: __ccgo_ts + 15569, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15539, + FzName: __ccgo_ts + 15577, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15546, + FzName: __ccgo_ts + 15584, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15559, + FzName: __ccgo_ts + 15597, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15565, + FzName: __ccgo_ts + 15603, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15572, + FzName: __ccgo_ts + 15610, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15579, + FzName: __ccgo_ts + 15617, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15587, + FzName: __ccgo_ts + 15625, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15592, + FzName: __ccgo_ts + 15630, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15634, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15634, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15602, + FzName: __ccgo_ts + 15640, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15608, + FzName: __ccgo_ts + 15646, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15614, + FzName: __ccgo_ts + 15652, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15656, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15656, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15662, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15662, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15669, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15669, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15669, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15641, + FzName: __ccgo_ts + 15679, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15648, + FzName: __ccgo_ts + 15686, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15655, + FzName: __ccgo_ts + 15693, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15666, + FzName: __ccgo_ts + 15704, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15673, + FzName: __ccgo_ts + 15711, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15688, + FzName: __ccgo_ts + 15726, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15743, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15716, + FzName: __ccgo_ts + 15754, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15722, + FzName: __ccgo_ts + 15760, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15778, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15748, + FzName: __ccgo_ts + 15786, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15762, + FzName: __ccgo_ts + 15800, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15770, + FzName: __ccgo_ts + 15808, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15817, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15817, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15824, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15824, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15796, + FzName: __ccgo_ts + 15834, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15800, + FzName: __ccgo_ts + 15838, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15844, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15848, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15848, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15854, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15854, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15829, + FzName: __ccgo_ts + 15867, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15840, + FzName: __ccgo_ts + 15878, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15357, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15357, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6734, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6734, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15845, + FzName: __ccgo_ts + 15883, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15850, + FzName: __ccgo_ts + 15888, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15858, + FzName: __ccgo_ts + 15896, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15902, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15870, + FzName: __ccgo_ts + 15908, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15911, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15877, + FzName: __ccgo_ts + 15915, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15883, + FzName: __ccgo_ts + 15921, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15911, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15888, + FzName: __ccgo_ts + 15926, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15892, + FzName: __ccgo_ts + 15930, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15896, + FzName: __ccgo_ts + 15934, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15902, + FzName: __ccgo_ts + 15940, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15906, + FzName: __ccgo_ts + 15944, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15911, + FzName: __ccgo_ts + 15949, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15916, + FzName: __ccgo_ts + 15954, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15921, + FzName: __ccgo_ts + 15959, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15965, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15931, + FzName: __ccgo_ts + 15969, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15973, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15939, + FzName: __ccgo_ts + 15977, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15982, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15949, + FzName: __ccgo_ts + 15987, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15954, + FzName: __ccgo_ts + 15992, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15960, + FzName: __ccgo_ts + 15998, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16004, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16010, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15977, + FzName: __ccgo_ts + 16015, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15985, + FzName: __ccgo_ts + 16023, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15993, + FzName: __ccgo_ts + 16031, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16034, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6734, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16001, + FzName: __ccgo_ts + 16039, }, } @@ -109279,9 +106189,6 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey nCol = (*TFKey)(unsafe.Pointer(pFKey)).FnCol /* Number of columns in parent key */ zKey = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FzCol /* Name of left-most parent key column */ /* The caller is responsible for zeroing output parameters. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this is a non-composite (single column) foreign key, check if it ** maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx ** and *paiCol set to zero and return early. @@ -109308,7 +106215,6 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } } else { if paiCol != 0 { - _ = libc.Int32FromInt32(0) aiCol = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nCol)*uint64(4)) if !(aiCol != 0) { return int32(1) @@ -109339,6 +106245,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -109378,6 +106285,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -109385,6 +106293,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -109394,11 +106303,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16005, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16043, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -109461,6 +106371,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -109500,6 +106411,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -109522,8 +106434,6 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId iChild = int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + int32(1) + regData iParent = int32(1) + regData iParent += int32(_sqlite3TableColumnToStorage(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { /* The parent key is a composite key that includes the IPK column */ iParent = regData @@ -109532,6 +106442,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -109546,7 +106457,6 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId ** one row into the table, raise a constraint immediately instead of ** incrementing a counter. This is necessary as the VM code is being ** generated for will not open a statement transaction. */ - _ = libc.Int32FromInt32(0) _sqlite3HaltConstraint(tls, pParse, libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(3)< 0 && int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred) == 0 { @@ -109602,7 +106512,6 @@ func _exprTableColumn(tls *libc.TLS, db uintptr, pTab uintptr, iCursor int32, iC _ = pExpr pExpr = _sqlite3Expr(tls, db, int32(TK_COLUMN), uintptr(0)) if pExpr != 0 { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = iCursor (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = iCol @@ -109652,10 +106561,6 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = uintptr(0) /* Context used by sqlite3WhereXXX() */ iFkIfZero = 0 /* Address of OP_FkIfZero */ v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nIncr < 0 { iFkIfZero = _sqlite3VdbeAddOp2(tls, v, int32(OP_FkIfZero), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), 0) } @@ -109685,13 +106590,13 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, v3 = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom } iCol = int16(v3) - _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iCol)*16))).FzCnName pRight = _sqlite3Expr(tls, db, int32(TK_ID), zCol) pEq = _sqlite3PExpr(tls, pParse, int32(TK_EQ), pLeft, pRight) pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -109715,20 +106620,19 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pNe = _sqlite3PExpr(tls, pParse, int32(TK_NE), pLeft1, pRight1) } else { pAll = uintptr(0) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { break } iCol1 = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) - _ = libc.Int32FromInt32(0) pLeft1 = _exprTableRegister(tls, pParse, pTab, regData, iCol1) pRight1 = _sqlite3Expr(tls, db, int32(TK_ID), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol1)*16))).FzCnName) pEq1 = _sqlite3PExpr(tls, pParse, int32(TK_IS), pLeft1, pRight1) pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -109835,10 +106739,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -109870,8 +106776,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == TABTYP_NORM { iSkip = 0 v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) /* VDBE has already been allocated */ - _ = libc.Int32FromInt32(0) + /* VDBE has already been allocated */ if _sqlite3FkReferences(tls, pTab) == uintptr(0) { p = (*(*struct { FaddColOffset int32 @@ -109887,6 +106792,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -109948,6 +106854,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -109996,10 +106903,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -110024,7 +106933,6 @@ func _isSetNullAction(tls *libc.TLS, pParse uintptr, pFKey uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg != 0 { p = (*TTriggerPrg)(unsafe.Pointer((*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg)).FpTrigger if p == *(*uintptr)(unsafe.Pointer(pFKey + 48)) && int32(*(*Tu8)(unsafe.Pointer(pFKey + 45))) == int32(OE_SetNull) || p == *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) && int32(*(*Tu8)(unsafe.Pointer(pFKey + 45 + 1))) == int32(OE_SetNull) { - _ = libc.Int32FromInt32(0) return int32(1) } } @@ -110067,7 +106975,6 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Name of database containing pTab */ isIgnoreErrors = int32((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers) /* Exactly one of regOld and regNew should be non-zero. */ - _ = libc.Int32FromInt32(0) /* If foreign-keys are disabled, this function is a no-op. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) == uint64(0) { return @@ -110104,7 +107011,6 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, pTo = _sqlite3LocateTable(tls, pParse, uint32(0), (*TFKey)(unsafe.Pointer(pFKey)).FzTo, zDb) } if !(pTo != 0) || _sqlite3FkLocateIndex(tls, pParse, pTo, pFKey, bp, bp+8) != 0 { - _ = libc.Int32FromInt32(0) if !(isIgnoreErrors != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } @@ -110128,13 +107034,13 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) } goto _1 } - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { aiCol = *(*uintptr)(unsafe.Pointer(bp + 8)) } else { @@ -110149,7 +107055,6 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = -int32(1) } - _ = libc.Int32FromInt32(0) /* Request permission to read the parent key columns. If the ** authorization callback returns SQLITE_IGNORE, behave as if any ** values read from the parent table are NULL. */ @@ -110165,6 +107070,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -110192,6 +107098,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -110207,7 +107114,6 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, goto _5 } if !((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred != 0) && !((*Tsqlite3)(unsafe.Pointer(db)).Fflags&libc.Uint64FromInt32(SQLITE_DeferFKs) != 0) && !((*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0) && !((*TParse)(unsafe.Pointer(pParse)).FisMultiWrite != 0) { - _ = libc.Int32FromInt32(0) /* Inserting a single row into a parent table cannot cause (or fix) ** an immediate foreign key violation. So do nothing in this case. */ goto _5 @@ -110218,7 +107124,6 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _5 } - _ = libc.Int32FromInt32(0) /* Create a SrcList structure containing the child table. We need the ** child table as a SrcList for sqlite3WhereBegin() */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) @@ -110267,6 +107172,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110310,10 +107216,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -110329,7 +107237,6 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { if !(i < int32((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnKeyCol)) { break } - _ = libc.Int32FromInt32(0) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2))) > int32(31) { v6 = uint32(0xffffffff) } else { @@ -110338,11 +107245,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110410,6 +107319,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -110426,6 +107336,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110502,18 +107413,17 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr if _sqlite3FkLocateIndex(tls, pParse, pTab, pFKey, bp, bp+8) != 0 { return uintptr(0) } - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6571, + Fz: __ccgo_ts + 6600, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6567, + Fz: __ccgo_ts + 6596, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -110522,9 +107432,6 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr v2 = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom } iFromCol = v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v3 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2))) } else { @@ -110572,6 +107479,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -110579,13 +107487,12 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5200) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5229) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) if pSrc != 0 { - _ = libc.Int32FromInt32(0) (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzName = _sqlite3DbStrDup(tls, db, zFrom) (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzDatabase = _sqlite3DbStrDup(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) } @@ -110626,8 +107533,6 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr _fkTriggerDelete(tls, db, pTrigger) return uintptr(0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch action { case int32(OE_Restrict): (*TTriggerStep)(unsafe.Pointer(pStep)).Fop = uint8(TK_SELECT) @@ -110681,6 +107586,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110696,8 +107602,6 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { var pFKey, pNext, z, v2 uintptr _, _, _, _ = pFKey, pNext, z, v2 /* Copy of pFKey->pNextFrom */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pFKey = (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -110707,7 +107611,6 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { if !(pFKey != 0) { break } - _ = libc.Int32FromInt32(0) /* Remove the FK from the fkeyHash hash table. */ if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { if (*TFKey)(unsafe.Pointer(pFKey)).FpPrevTo != 0 { @@ -110728,7 +107631,6 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { /* EV: R-30323-21917 Each foreign key constraint in SQLite is ** classified as either immediate or deferred. */ - _ = libc.Int32FromInt32(0) /* Delete any triggers created to implement actions for this FK. */ _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48))) _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8))) @@ -110736,6 +107638,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -110773,10 +107676,7 @@ func _sqlite3OpenTable(tls *libc.TLS, pParse uintptr, iCur int32, iDb int32, pTa var pPk, v uintptr var v1 int32 _, _, _ = pPk, v, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnoSharedCache != 0) { if opcode == int32(OP_OpenWrite) { v1 = int32(1) @@ -110789,8 +107689,6 @@ func _sqlite3OpenTable(tls *libc.TLS, pParse uintptr, iCur int32, iDb int32, pTa _sqlite3VdbeAddOp4Int(tls, v, opcode, iCur, int32((*TTable)(unsafe.Pointer(pTab)).Ftnum), iDb, int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol)) } else { pPk = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, opcode, iCur, int32((*TIndex)(unsafe.Pointer(pPk)).Ftnum), iDb) _sqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) } @@ -110842,9 +107740,6 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { if int32(x) == -int32(1) { aff = int8(SQLITE_AFF_INTEGER) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(n)*32))).FpExpr) } } @@ -110857,6 +107752,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 @@ -110897,6 +107793,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -110958,8 +107855,6 @@ func _sqlite3TableAffinity(tls *libc.TLS, v uintptr, pTab uintptr, iReg int32) { if iReg == 0 { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) pPrev = _sqlite3VdbeGetLastOp(tls, v) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVdbeOp)(unsafe.Pointer(pPrev)).Fopcode = uint8(OP_TypeCheck) _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp1, (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp2, (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp3) } else { @@ -110978,13 +107873,11 @@ func _sqlite3TableAffinity(tls *libc.TLS, v uintptr, pTab uintptr, iReg int32) { } (*TTable)(unsafe.Pointer(pTab)).FzColAff = zColAff } - _ = libc.Int32FromInt32(0) i = int32(libc.Xstrlen(tls, zColAff) & libc.Uint64FromInt32(0x3fffffff)) if i != 0 { if iReg != 0 { _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), iReg, i, 0, zColAff, i) } else { - _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP4(tls, v, -int32(1), zColAff, i) } } @@ -111017,7 +107910,6 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { break } pOp = _sqlite3VdbeGetOp(tls, v, i) - _ = libc.Int32FromInt32(0) if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_OpenRead) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 == iDb { tnum = uint32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp2) if tnum == (*TTable)(unsafe.Pointer(pTab)).Ftnum { @@ -111033,16 +107925,16 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_VOpen) && *(*uintptr)(unsafe.Pointer(pOp + 16)) == pVTab { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int32(1) } goto _2 _2: + ; i++ } return 0 @@ -111057,7 +107949,6 @@ func _exprColumnFlagUnion(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 var p1 uintptr _ = p1 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 { - _ = libc.Int32FromInt32(0) p1 = pWalker + 36 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | int32((*(*TColumn)(unsafe.Pointer((*TTable1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)))).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*16))).FcolFlags)) } @@ -111080,7 +107971,6 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in var pCol, pOp, pRedo, zP4, p4, p6, p7, p8 uintptr var _ /* w at bp+0 */ TWalker _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eProgress, i, ii, jj, pCol, pOp, pRedo, x, zP4, v2, p4, p6, p7, p8 - _ = libc.Int32FromInt32(0) /* Before computing generated columns, first go through and make sure ** that appropriate affinity has been applied to the regular columns */ @@ -111089,8 +107979,6 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in pOp = _sqlite3VdbeGetLastOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe) if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Affinity) { zP4 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v2 = libc.Int32FromInt32(0) jj = v2 ii = v2 @@ -111107,6 +107995,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -111133,6 +108022,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -111166,7 +108056,6 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in goto _5 } eProgress = int32(1) - _ = libc.Int32FromInt32(0) x = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(i))) + iRegStore _sqlite3ExprCodeGeneratedColumn(tls, pParse, pTab, pCol, x) p8 = pCol + 14 @@ -111174,11 +108063,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8166, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -111213,7 +108103,6 @@ func _autoIncBegin(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr) (r in var pInfo, pSeqTab, pToplevel, v1, v3 uintptr _, _, _, _, _, _, _ = memId, pInfo, pSeqTab, pToplevel, v1, v2, v3 memId = 0 /* Register holding maximum rowid */ - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel @@ -111270,9 +108159,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* VDBE under construction */ /* This routine is never called during trigger-generation. It is ** only called from the top-level */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* We failed long ago if this is not so */ + /* We failed long ago if this is not so */ p = (*TParse)(unsafe.Pointer(pParse)).FpAinc for { if !(p != 0) { @@ -111280,7 +108167,6 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TAutoincInfo)(unsafe.Pointer(p)).FiDb)*32 memId = (*TAutoincInfo)(unsafe.Pointer(p)).FregCtr - _ = libc.Int32FromInt32(0) _sqlite3OpenTable(tls, pParse, 0, (*TAutoincInfo)(unsafe.Pointer(p)).FiDb, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab, int32(OP_OpenRead)) _sqlite3VdbeLoadString(tls, v, memId-int32(1), (*TTable)(unsafe.Pointer((*TAutoincInfo)(unsafe.Pointer(p)).FpTab)).FzName) aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_autoInc)), _iLn1) @@ -111304,6 +108190,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111385,7 +108272,6 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _, _, _, _, _, _, _ = aOp, db, iRec, memId, p, pDb, v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) p = (*TParse)(unsafe.Pointer(pParse)).FpAinc for { if !(p != 0) { @@ -111394,7 +108280,6 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TAutoincInfo)(unsafe.Pointer(p)).FiDb)*32 memId = (*TAutoincInfo)(unsafe.Pointer(p)).FregCtr iRec = _sqlite3GetTempReg(tls, pParse) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Le), memId+int32(2), _sqlite3VdbeCurrentAddr(tls, v)+int32(7), memId) _sqlite3OpenTable(tls, pParse, 0, (*TAutoincInfo)(unsafe.Pointer(p)).FiDb, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab, int32(OP_OpenWrite)) aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(20)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_autoIncEnd)), _iLn2) @@ -111411,6 +108296,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111572,11 +108458,9 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin regRowCount = 0 /* register holding first column to insert */ aRegIdx = uintptr(0) /* Mask of trigger times */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto insert_cleanup } - _ = libc.Int32FromInt32(0) (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSDParm = 0 /* Suppress a harmless compiler warning */ /* If the Select object is really just a simple VALUES() list with a ** single row (the common case) then keep that one row of values @@ -111590,13 +108474,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } /* Locate the table into which we will be inserting new information. */ - _ = libc.Int32FromInt32(0) pTab = _sqlite3SrcListLookup(tls, pParse, pTabList) if pTab == uintptr(0) { goto insert_cleanup } iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _ = libc.Int32FromInt32(0) if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) != 0 { goto insert_cleanup } @@ -111606,7 +108488,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin */ pTrigger = _sqlite3TriggersExist(tls, pParse, pTab, int32(TK_INSERT), uintptr(0), bp+48) isView = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW)) - _ = libc.Int32FromInt32(0) /* If pTab is really a view, make sure it has been initialized. ** ViewGetColumnNames() is a no-op if pTab is not a view. */ @@ -111638,8 +108519,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ** This is the 2nd template. */ if pColumn == uintptr(0) && pSelect != uintptr(0) && pTrigger == uintptr(0) && _xferOptimization(tls, pParse, pTab, pSelect, onError, iDb) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto insert_end } /* If this is an AUTOINCREMENT table, look up the sequence number in the @@ -111679,7 +108558,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin */ bIdListInOrder = libc.BoolUint8((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_OOOHidden)|libc.Int32FromInt32(TF_HasStored)) == uint32(0)) if pColumn != 0 { - _ = libc.Int32FromInt32(0) (*TIdList)(unsafe.Pointer(pColumn)).FeU4 = uint8(EU4_IDX) i = 0 for { @@ -111689,6 +108567,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -111708,16 +108587,16 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if j == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { ipkColumn = i - _ = libc.Int32FromInt32(0) } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16050, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16088, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -111725,13 +108604,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16091, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16129, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -111757,14 +108637,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FnSdst = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) rc = _sqlite3Select(tls, pParse, pSelect, bp+8) regFromSelect = (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSdst - _ = libc.Int32FromInt32(0) if rc != 0 || (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto insert_cleanup } - _ = libc.Int32FromInt32(0) _sqlite3VdbeEndCoroutine(tls, v, regYield) _sqlite3VdbeJumpHere(tls, v, addrTop-int32(1)) /* label B: */ - _ = libc.Int32FromInt32(0) nColumn = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList)).FnExpr /* Set useTempTable to TRUE if the result of the SELECT statement ** should be written into a temporary table (template 4). Set to @@ -111799,7 +108676,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin libc.Xmemset(tls, bp+56, 0, uint64(56)) (*(*TNameContext)(unsafe.Pointer(bp + 56))).FpParse = pParse srcTab = -int32(1) - _ = libc.Int32FromInt32(0) if pList != 0 { nColumn = (*TExprList)(unsafe.Pointer(pList)).FnExpr if _sqlite3ResolveExprListNames(tls, bp+56, pList) != 0 { @@ -111826,15 +108702,13 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } /* Make sure the number of columns in the source data matches the number ** of columns to be inserted into the table. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_HasGenerated)|libc.Int32FromInt32(TF_HasHidden)) != uint32(0) { i = 0 for { @@ -111846,16 +108720,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16123, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16161, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16175, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16213, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -111880,7 +108755,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin if !(i < nIdx) { break } - _ = libc.Int32FromInt32(0) v16 = pParse + 56 *(*int32)(unsafe.Pointer(v16))++ v15 = *(*int32)(unsafe.Pointer(v16)) @@ -111888,6 +108762,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -111898,11 +108773,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16200, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16238, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16246, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16284, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -111916,7 +108791,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -111966,13 +108841,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin */ nHidden = 0 iRegStore = regData - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { break } - _ = libc.Int32FromInt32(0) if i == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { /* tag-20191021-002: References to the INTEGER PRIMARY KEY are filled ** using the rowid. So put a NULL in the IPK slot of the record to avoid @@ -112012,7 +108885,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } if pColumn != 0 { - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < (*TIdList)(unsafe.Pointer(pColumn)).FnId && *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(j)*16 + 8)) != i) { @@ -112020,6 +108892,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112060,6 +108933,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -112077,11 +108951,10 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin if ipkColumn < 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), -int32(1), regCols) } else { - _ = libc.Int32FromInt32(0) if useTempTable != 0 { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, ipkColumn, regCols) } else { - _ = libc.Int32FromInt32(0) /* Otherwise useTempTable is true */ + /* Otherwise useTempTable is true */ _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ipkColumn)*32))).FpExpr, regCols) } addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), regCols) @@ -112090,7 +108963,6 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), regCols) } /* Copy the new data already generated. */ - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regRowid+int32(1), regCols+int32(1), int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol)-int32(1)) /* Compute the new value for generated columns after all other ** columns have already been computed. This must be done after @@ -112219,6 +109091,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -112232,9 +109105,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16267) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16305) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -112265,7 +109139,6 @@ func _checkConstraintExprNode(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r var p1, p2 uintptr _, _ = p1, p2 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 { if *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)) + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*4)) >= 0 { p1 = pWalker + 36 @@ -112382,7 +109255,6 @@ type IndexListTerm1 = TIndexListTerm1 // // /* Return the first index on the list */ func _indexIteratorFirst(tls *libc.TLS, pIter uintptr, pIx uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) if (*TIndexIterator)(unsafe.Pointer(pIter)).FeType != 0 { *(*int32)(unsafe.Pointer(pIx)) = (*(*TIndexListTerm)(unsafe.Pointer((*(*struct { FnIdx int32 @@ -112552,8 +109424,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt isUpdate = libc.BoolUint8(regOldData != 0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* This table is not a VIEW */ + /* This table is not a VIEW */ nCol = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for ** normal rowid tables. nPkField is the number of key fields in the @@ -112607,19 +109478,16 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt if b2ndPass != 0 || int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) == 0 { onError = int32(OE_Abort) } else { - _ = libc.Int32FromInt32(0) } } else { if b2ndPass != 0 && !(isGenerated != 0) { goto _1 } } - _ = libc.Int32FromInt32(0) iReg = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(i))) + regNewData + int32(1) switch onError { case int32(OE_Replace): addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), iReg) - _ = libc.Int32FromInt32(0) nSeenReplace++ _sqlite3ExprCodeCopy(tls, pParse, _sqlite3ColumnExpr(tls, pTab, pCol), iReg) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -112629,17 +109497,17 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12385, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { *(*int32)(unsafe.Pointer(piDataCur)) = iIdxCur p5 = uint8(0) @@ -113479,6 +110332,7 @@ func _sqlite3OpenTableAndIndices(tls *libc.TLS, pParse uintptr, pTab uintptr, op } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -113504,8 +110358,6 @@ func _sqlite3OpenTableAndIndices(tls *libc.TLS, pParse uintptr, pTab uintptr, op func _xferCompatibleIndex(tls *libc.TLS, pDest uintptr, pSrc uintptr) (r int32) { var i int32 _ = i - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TIndex)(unsafe.Pointer(pDest)).FnKeyCol) != int32((*TIndex)(unsafe.Pointer(pSrc)).FnKeyCol) || int32((*TIndex)(unsafe.Pointer(pDest)).FnColumn) != int32((*TIndex)(unsafe.Pointer(pSrc)).FnColumn) { return 0 /* Different number of columns */ } @@ -113521,7 +110373,6 @@ func _xferCompatibleIndex(tls *libc.TLS, pDest uintptr, pSrc uintptr) (r int32) return 0 /* Different columns indexed */ } if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaiColumn + uintptr(i)*2))) == -int32(2) { - _ = libc.Int32FromInt32(0) if _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pDest)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, -int32(1)) != 0 { return 0 /* Different expressions in the index */ } @@ -113534,6 +110385,7 @@ func _xferCompatibleIndex(tls *libc.TLS, pDest uintptr, pSrc uintptr) (r int32) } goto _1 _1: + ; i++ } if _sqlite3ExprCompare(tls, uintptr(0), (*TIndex)(unsafe.Pointer(pSrc)).FpPartIdxWhere, (*TIndex)(unsafe.Pointer(pDest)).FpPartIdxWhere, -int32(1)) != 0 { @@ -113579,7 +110431,6 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin emptyDestTest = 0 /* Address of test for empty pDest */ emptySrcTest = 0 /* Memory register used by AUTOINC */ destHasUniqueIdx = 0 /* Registers holding data and rowid */ - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FpWith != 0 || (*TSelect)(unsafe.Pointer(pSelect)).FpWith != 0 { /* Do not attempt to process this query if there are an WITH clauses ** attached to it. Proceeding may generate a false "no such table: xxx" @@ -113597,7 +110448,7 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin onError = int32(OE_Abort) } } - _ = libc.Int32FromInt32(0) /* allocated even if there is no FROM clause */ + /* allocated even if there is no FROM clause */ if (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpSrc)).FnSrc != int32(1) { return 0 /* FROM clause must have exactly one term */ } @@ -113625,11 +110476,9 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin return 0 /* SELECT may not be DISTINCT */ } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList - _ = libc.Int32FromInt32(0) if (*TExprList)(unsafe.Pointer(pEList)).FnExpr != int32(1) { return 0 /* The result set must have exactly one column */ } - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr)).Fop) != int32(TK_ASTERISK) { return 0 /* The result set must be the special operator "*" */ } @@ -113709,16 +110558,13 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin if int32((*TColumn)(unsafe.Pointer(pDestCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 && i > 0 { pDestExpr = _sqlite3ColumnExpr(tls, pDest, pDestCol) pSrcExpr = _sqlite3ColumnExpr(tls, pSrc, pSrcCol) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if libc.BoolInt32(pDestExpr == uintptr(0)) != libc.BoolInt32(pSrcExpr == uintptr(0)) || pDestExpr != uintptr(0) && libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(pDestExpr + 8)), *(*uintptr)(unsafe.Pointer(pSrcExpr + 8))) != 0 { return 0 /* Default values must be the same for all columns */ } } goto _1 _1: + ; i++ } pDestIdx = (*TTable)(unsafe.Pointer(pDest)).FpIndex @@ -113739,6 +110585,7 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin } goto _3 _3: + ; pSrcIdx = (*TIndex)(unsafe.Pointer(pSrcIdx)).FpNext } if pSrcIdx == uintptr(0) { @@ -113752,9 +110599,10 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin } goto _2 _2: + ; pDestIdx = (*TIndex)(unsafe.Pointer(pDestIdx)).FpNext } - if (*TTable)(unsafe.Pointer(pDest)).FpCheck != 0 && _sqlite3ExprListCompare(tls, (*TTable)(unsafe.Pointer(pSrc)).FpCheck, (*TTable)(unsafe.Pointer(pDest)).FpCheck, -int32(1)) != 0 { + if (*TTable)(unsafe.Pointer(pDest)).FpCheck != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) && _sqlite3ExprListCompare(tls, (*TTable)(unsafe.Pointer(pSrc)).FpCheck, (*TTable)(unsafe.Pointer(pDest)).FpCheck, -int32(1)) != 0 { return 0 /* Tables have different CHECK constraints. Ticket #2252 */ } /* Disallow the transfer optimization if the destination table contains @@ -113764,7 +110612,6 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin ** the extra complication to make this rule less restrictive is probably ** not worth the effort. Ticket [6284df89debdfa61db8073e062908af0c9b6118e] */ - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != uint64(0) && (*(*struct { FaddColOffset int32 FpFKey uintptr @@ -113795,7 +110642,6 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regData) regRowid = _sqlite3GetTempReg(tls, pParse) _sqlite3OpenTable(tls, pParse, iDest, iDbDest, pDest, int32(OP_OpenWrite)) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) && (int32((*TTable)(unsafe.Pointer(pDest)).FiPKey) < 0 && (*TTable)(unsafe.Pointer(pDest)).FpIndex != uintptr(0) || destHasUniqueIdx != 0 || onError != int32(OE_Abort) && onError != int32(OE_Rollback)) { /* In some circumstances, we are able to run the xfer optimization ** only if the destination table is initially empty. Unless the @@ -113834,7 +110680,6 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iDest, regRowid) } else { addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iSrc, regRowid) - _ = libc.Int32FromInt32(0) } } if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) != 0 { @@ -113877,9 +110722,9 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin } goto _9 _9: + ; pSrcIdx = (*TIndex)(unsafe.Pointer(pSrcIdx)).FpNext } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iSrc, int32((*TIndex)(unsafe.Pointer(pSrcIdx)).Ftnum), iDbSrc) _sqlite3VdbeSetP4KeyInfo(tls, pParse, pSrcIdx) _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenWrite), iDest, int32((*TIndex)(unsafe.Pointer(pDestIdx)).Ftnum), iDbDest) @@ -113912,6 +110757,7 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin } goto _10 _10: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pSrcIdx)).FnColumn) { @@ -113938,6 +110784,7 @@ func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uin _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iDest, 0) goto _8 _8: + ; pDestIdx = (*TIndex)(unsafe.Pointer(pDestIdx)).FpNext } if emptySrcTest != 0 { @@ -114002,10 +110849,10 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* The current SQL statement */ azCols = uintptr(0) /* True if callback data is initialized */ if !(_sqlite3SafetyCheckOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(135301)) + return _sqlite3MisuseError(tls, int32(135482)) } if zSql == uintptr(0) { - zSql = __ccgo_ts + 1648 + zSql = __ccgo_ts + 1652 } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3Error(tls, db, SQLITE_OK) @@ -114014,7 +110861,6 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c azVals = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp+8, bp) - _ = libc.Int32FromInt32(0) if rc != SQLITE_OK { continue } @@ -114042,9 +110888,9 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c *(*uintptr)(unsafe.Pointer(azCols + uintptr(i)*8)) = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) /* sqlite3VdbeSetColName() installs column names as UTF8 ** strings so there is no way for sqlite3_column_name() to fail. */ - _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } callbackIsInit = int32(1) @@ -114063,6 +110909,7 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c } goto _2 _2: + ; i++ } *(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) = uintptr(0) @@ -114092,6 +110939,7 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c azCols = uintptr(0) } exec_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { _sqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } @@ -114108,7 +110956,6 @@ exec_out: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) } } - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } @@ -114804,14 +111651,14 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtension) == uint64(0) { if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+12395, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+12424, 0) } return int32(SQLITE_ERROR) } if zProc != 0 { v1 = zProc } else { - v1 = __ccgo_ts + 16284 + v1 = __ccgo_ts + 16322 } zEntry = v1 /* tag-20210611-1. Some dlopen() implementations will segfault if given @@ -114836,7 +111683,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp if !(ii < int32(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(8)) && handle == uintptr(0)) { break } - zAltFile = Xsqlite3_mprintf(tls, __ccgo_ts+12356, libc.VaList(bp+16, zFile, _azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, __ccgo_ts+12385, libc.VaList(bp+16, zFile, _azEndings[ii])) if zAltFile == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -114846,6 +111693,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp Xsqlite3_free(tls, zAltFile) goto _2 _2: + ; ii++ } if handle == uintptr(0) { @@ -114870,7 +111718,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp _sqlite3OsDlClose(tls, pVfs, handle) return int32(SQLITE_NOMEM) } - libc.Xmemcpy(tls, zAltEntry, __ccgo_ts+16307, uint64(8)) + libc.Xmemcpy(tls, zAltEntry, __ccgo_ts+16345, uint64(8)) iFile = ncFile - int32(1) for { if !(iFile >= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -114878,10 +111726,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16316, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16354, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -114898,9 +111747,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16320, uint64(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16358, uint64(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -114911,8 +111761,8 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(bp)) = v7 *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16326, libc.VaList(bp+16, zEntry, zFile)) + /* zErrmsg would be NULL if not so */ + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16364, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -114927,7 +111777,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16369, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16407, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -114949,14 +111799,15 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) *(*uintptr)(unsafe.Pointer(bp)) = v10 *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16401, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + /* zErrmsg would be NULL if not so */ + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16439, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -114965,7 +111816,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16281, + 0: __ccgo_ts + 16319, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -114987,7 +111838,6 @@ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uin func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { var i int32 _ = i - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnExtension) { @@ -114996,6 +111846,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115079,6 +111930,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115093,7 +111945,6 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } } Xsqlite3_mutex_leave(tls, mutex) - _ = libc.Int32FromInt32(0) return rc } return r @@ -115130,6 +111981,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -115197,12 +112049,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16438, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16476, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -115250,63 +112103,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5456, - 1: __ccgo_ts + 16477, - 2: __ccgo_ts + 9033, - 3: __ccgo_ts + 16481, - 4: __ccgo_ts + 16486, - 5: __ccgo_ts + 16489, - 6: __ccgo_ts + 16499, - 7: __ccgo_ts + 16509, - 8: __ccgo_ts + 16515, - 9: __ccgo_ts + 16519, - 10: __ccgo_ts + 16524, - 11: __ccgo_ts + 16529, - 12: __ccgo_ts + 16537, - 13: __ccgo_ts + 16548, - 14: __ccgo_ts + 16551, - 15: __ccgo_ts + 16558, - 16: __ccgo_ts + 16519, - 17: __ccgo_ts + 16524, - 18: __ccgo_ts + 16565, - 19: __ccgo_ts + 16570, - 20: __ccgo_ts + 16573, - 21: __ccgo_ts + 16580, - 22: __ccgo_ts + 16515, - 23: __ccgo_ts + 16519, - 24: __ccgo_ts + 16586, - 25: __ccgo_ts + 16591, - 26: __ccgo_ts + 16596, - 27: __ccgo_ts + 16519, - 28: __ccgo_ts + 16600, - 29: __ccgo_ts + 16524, - 30: __ccgo_ts + 16608, - 31: __ccgo_ts + 16612, - 32: __ccgo_ts + 16617, - 33: __ccgo_ts + 11772, - 34: __ccgo_ts + 11768, - 35: __ccgo_ts + 16623, - 36: __ccgo_ts + 16628, - 37: __ccgo_ts + 16633, - 38: __ccgo_ts + 16477, - 39: __ccgo_ts + 16519, - 40: __ccgo_ts + 16638, - 41: __ccgo_ts + 16645, - 42: __ccgo_ts + 16652, - 43: __ccgo_ts + 9033, - 44: __ccgo_ts + 16660, - 45: __ccgo_ts + 5459, - 46: __ccgo_ts + 16666, - 47: __ccgo_ts + 16477, - 48: __ccgo_ts + 16519, - 49: __ccgo_ts + 16671, - 50: __ccgo_ts + 16676, - 51: __ccgo_ts + 15873, - 52: __ccgo_ts + 16681, - 53: __ccgo_ts + 16694, - 54: __ccgo_ts + 16703, - 55: __ccgo_ts + 16710, - 56: __ccgo_ts + 16721, + 0: __ccgo_ts + 5485, + 1: __ccgo_ts + 16515, + 2: __ccgo_ts + 9062, + 3: __ccgo_ts + 16519, + 4: __ccgo_ts + 16524, + 5: __ccgo_ts + 16527, + 6: __ccgo_ts + 16537, + 7: __ccgo_ts + 16547, + 8: __ccgo_ts + 16553, + 9: __ccgo_ts + 16557, + 10: __ccgo_ts + 16562, + 11: __ccgo_ts + 16567, + 12: __ccgo_ts + 16575, + 13: __ccgo_ts + 16586, + 14: __ccgo_ts + 16589, + 15: __ccgo_ts + 16596, + 16: __ccgo_ts + 16557, + 17: __ccgo_ts + 16562, + 18: __ccgo_ts + 16603, + 19: __ccgo_ts + 16608, + 20: __ccgo_ts + 16611, + 21: __ccgo_ts + 16618, + 22: __ccgo_ts + 16553, + 23: __ccgo_ts + 16557, + 24: __ccgo_ts + 16624, + 25: __ccgo_ts + 16629, + 26: __ccgo_ts + 16634, + 27: __ccgo_ts + 16557, + 28: __ccgo_ts + 16638, + 29: __ccgo_ts + 16562, + 30: __ccgo_ts + 16646, + 31: __ccgo_ts + 16650, + 32: __ccgo_ts + 16655, + 33: __ccgo_ts + 11801, + 34: __ccgo_ts + 11797, + 35: __ccgo_ts + 16661, + 36: __ccgo_ts + 16666, + 37: __ccgo_ts + 16671, + 38: __ccgo_ts + 16515, + 39: __ccgo_ts + 16557, + 40: __ccgo_ts + 16676, + 41: __ccgo_ts + 16683, + 42: __ccgo_ts + 16690, + 43: __ccgo_ts + 9062, + 44: __ccgo_ts + 16698, + 45: __ccgo_ts + 5488, + 46: __ccgo_ts + 16704, + 47: __ccgo_ts + 16515, + 48: __ccgo_ts + 16557, + 49: __ccgo_ts + 16709, + 50: __ccgo_ts + 16714, + 51: __ccgo_ts + 15911, + 52: __ccgo_ts + 16719, + 53: __ccgo_ts + 16732, + 54: __ccgo_ts + 16741, + 55: __ccgo_ts + 16748, + 56: __ccgo_ts + 16759, } // C documentation @@ -115325,191 +112178,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16729, + FzName: __ccgo_ts + 16767, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16744, + FzName: __ccgo_ts + 16782, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16759, + FzName: __ccgo_ts + 16797, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16771, + FzName: __ccgo_ts + 16809, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16787, + FzName: __ccgo_ts + 16825, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16710, + FzName: __ccgo_ts + 16748, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16800, + FzName: __ccgo_ts + 16838, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16812, + FzName: __ccgo_ts + 16850, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16832, + FzName: __ccgo_ts + 16870, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16848, + FzName: __ccgo_ts + 16886, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16869, + FzName: __ccgo_ts + 16907, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16884, + FzName: __ccgo_ts + 16922, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16900, + FzName: __ccgo_ts + 16938, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16914, + FzName: __ccgo_ts + 16952, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16927, + FzName: __ccgo_ts + 16965, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16941, + FzName: __ccgo_ts + 16979, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16960, + FzName: __ccgo_ts + 16998, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16979, + FzName: __ccgo_ts + 17017, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17002, + FzName: __ccgo_ts + 17040, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17011, + FzName: __ccgo_ts + 17049, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17029, + FzName: __ccgo_ts + 17067, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17046, + FzName: __ccgo_ts + 17084, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17059, + FzName: __ccgo_ts + 17097, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17074, + FzName: __ccgo_ts + 17112, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17092, + FzName: __ccgo_ts + 17130, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17102, + FzName: __ccgo_ts + 17140, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17116, + FzName: __ccgo_ts + 17154, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17132, + FzName: __ccgo_ts + 17170, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17157, + FzName: __ccgo_ts + 17195, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17176, + FzName: __ccgo_ts + 17214, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17187, + FzName: __ccgo_ts + 17225, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17198, + FzName: __ccgo_ts + 17236, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -115517,146 +112370,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17210, + FzName: __ccgo_ts + 17248, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17226, + FzName: __ccgo_ts + 17264, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17239, + FzName: __ccgo_ts + 17277, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17258, + FzName: __ccgo_ts + 17296, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17277, + FzName: __ccgo_ts + 17315, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17290, + FzName: __ccgo_ts + 17328, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17305, + FzName: __ccgo_ts + 17343, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17315, + FzName: __ccgo_ts + 17353, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17327, + FzName: __ccgo_ts + 17365, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17336, + FzName: __ccgo_ts + 17374, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17347, + FzName: __ccgo_ts + 17385, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17357, + FzName: __ccgo_ts + 17395, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17369, + FzName: __ccgo_ts + 17407, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17418, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17392, + FzName: __ccgo_ts + 17430, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17409, + FzName: __ccgo_ts + 17447, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17428, + FzName: __ccgo_ts + 17466, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17454, + FzName: __ccgo_ts + 17492, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17469, + FzName: __ccgo_ts + 17507, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17521, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17502, + FzName: __ccgo_ts + 17540, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17516, + FzName: __ccgo_ts + 17554, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17532, + FzName: __ccgo_ts + 17570, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17544, + FzName: __ccgo_ts + 17582, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17555, + FzName: __ccgo_ts + 17593, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17566, + FzName: __ccgo_ts + 17604, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -115664,45 +112517,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17578, + FzName: __ccgo_ts + 17616, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17589, + FzName: __ccgo_ts + 17627, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17610, + FzName: __ccgo_ts + 17648, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17618, + FzName: __ccgo_ts + 17656, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17633, + FzName: __ccgo_ts + 17671, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17646, + FzName: __ccgo_ts + 17684, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17665, + FzName: __ccgo_ts + 17703, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17680, + FzName: __ccgo_ts + 17718, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -115744,6 +112597,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -115802,10 +112656,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17696) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17734) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17706) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17744) { return PAGER_LOCKINGMODE_NORMAL } } @@ -115823,13 +112677,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8193) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8222) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17713) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17751) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17718) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17756) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -115852,10 +112706,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16671) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16709) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17730) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17768) == 0 { return int32(2) } else { return 0 @@ -115877,7 +112731,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17737, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17775, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -115938,6 +112792,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -115982,11 +112837,6 @@ func _setAllPagerFlags(tls *libc.TLS, db uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb n = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for { v1 = n n-- @@ -116011,16 +112861,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17799 + zName = __ccgo_ts + 17837 case int32(OE_SetDflt): - zName = __ccgo_ts + 17808 + zName = __ccgo_ts + 17846 case int32(OE_Cascade): - zName = __ccgo_ts + 17820 + zName = __ccgo_ts + 17858 case int32(OE_Restrict): - zName = __ccgo_ts + 17828 + zName = __ccgo_ts + 17866 default: - zName = __ccgo_ts + 17837 - _ = libc.Int32FromInt32(0) + zName = __ccgo_ts + 17875 break } return zName @@ -116034,13 +112883,6 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { // ** journal-mode name. // */ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eMode == int32(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8)) { return uintptr(0) } @@ -116048,12 +112890,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17847, - 1: __ccgo_ts + 17854, - 2: __ccgo_ts + 17862, - 3: __ccgo_ts + 17866, - 4: __ccgo_ts + 17730, - 5: __ccgo_ts + 17875, + 0: __ccgo_ts + 17885, + 1: __ccgo_ts + 17892, + 2: __ccgo_ts + 17900, + 3: __ccgo_ts + 17904, + 4: __ccgo_ts + 17768, + 5: __ccgo_ts + 17913, } // C documentation @@ -116108,10 +112950,6 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s if !(p != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { goto _1 } @@ -116119,25 +112957,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17900 + zType = __ccgo_ts + 17938 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17940 } else { - zType = __ccgo_ts + 7592 + zType = __ccgo_ts + 7621 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17904, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17942, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17879, - 2: __ccgo_ts + 17884, - 3: __ccgo_ts + 17892, + 1: __ccgo_ts + 17917, + 2: __ccgo_ts + 17922, + 3: __ccgo_ts + 17930, } // C documentation @@ -116178,8 +113017,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(240) defer tls.Free(240) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -116207,7 +113046,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -116236,11 +113075,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17911, libc.VaList(bp+176, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17949, libc.VaList(bp+176, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pId2)).Fn > uint32(0) { v1 = (*TDb)(unsafe.Pointer(pDb)).FzDbSName } else { @@ -116280,7 +113118,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if rc != int32(SQLITE_NOTFOUND) { if (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0] != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3795, libc.VaList(bp+176, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0])) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3799, libc.VaList(bp+176, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0])) Xsqlite3_free(tls, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0]) } (*TParse)(unsafe.Pointer(pParse)).FnErr++ @@ -116337,7 +113175,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p size = _sqlite3AbsInt32(tls, _sqlite3Atoi(tls, zRight)) _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_DEFAULT_CACHE_SIZE), size) - _ = libc.Int32FromInt32(0) (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size _sqlite3BtreeSetCacheSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) } @@ -116354,7 +113191,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_PAGE_SIZE): pBt = (*TDb)(unsafe.Pointer(pDb)).FpBt - _ = libc.Int32FromInt32(0) if !(zRight != 0) { if pBt != 0 { v2 = _sqlite3BtreeGetPageSize(tls, pBt) @@ -116385,9 +113221,8 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p case int32(PragTyp_SECURE_DELETE): pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt b = -int32(1) - _ = libc.Int32FromInt32(0) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17915) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17953) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -116402,6 +113237,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -116457,7 +113293,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17706 + zRet = __ccgo_ts + 17744 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -116467,7 +113303,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p eMode = int32((*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode) } else { if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) { - _ = libc.Int32FromInt32(0) ii1 = int32(2) for { if !(ii1 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -116477,6 +113312,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -116484,9 +113320,8 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pPager = _sqlite3BtreePager(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) } - _ = libc.Int32FromInt32(0) if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17696 + zRet = __ccgo_ts + 17734 } _returnSingleText(tls, v, zRet) break @@ -116496,7 +113331,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -116515,6 +113350,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -116544,6 +113380,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -116577,12 +113414,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_AUTO_VACUUM): pBt2 = (*TDb)(unsafe.Pointer(pDb)).FpBt - _ = libc.Int32FromInt32(0) if !(zRight != 0) { _returnSingleInt(tls, v, int64(_sqlite3BtreeGetAutoVacuum(tls, pBt2))) } else { eAuto = _getAutoVacuum(tls, zRight) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FnextAutovac = int8(uint8(eAuto)) /* Call SetAutoVacuum() to set initialize the internal auto and ** incr-vacuum flags. This is required in case this connection @@ -116637,7 +113472,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_CACHE_SIZE): - _ = libc.Int32FromInt32(0) if !(zRight != 0) { _returnSingleInt(tls, v, int64((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size)) } else { @@ -116670,7 +113504,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_CACHE_SPILL): - _ = libc.Int32FromInt32(0) if !(zRight != 0) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_CacheSpill) == uint64(0) { v10 = 0 @@ -116707,7 +113540,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_MMAP_SIZE): - _ = libc.Int32FromInt32(0) if zRight != 0 { _sqlite3DecOrHexToI64(tls, zRight, bp+64) if *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64)) < 0 { @@ -116726,6 +113558,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -116778,7 +113611,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*int8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17958, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -116788,7 +113621,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } Xsqlite3_free(tls, Xsqlite3_temp_directory) if *(*int8)(unsafe.Pointer(zRight)) != 0 { - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+176, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+176, zRight)) } else { Xsqlite3_temp_directory = uintptr(0) } @@ -116810,7 +113643,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17983, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -116843,7 +113676,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17998) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18036) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -116899,7 +113732,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { isHidden = int32(3) /* GENERATED ALWAYS AS ... STORED */ } else { - _ = libc.Int32FromInt32(0) isHidden = int32(1) /* HIDDEN */ } } @@ -116917,17 +113749,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } } pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18004 + v14 = __ccgo_ts + 18042 } else { - v14 = __ccgo_ts + 18012 + v14 = __ccgo_ts + 18050 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -116939,9 +113770,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v16 = *(*uintptr)(unsafe.Pointer(pColExpr + 8)) } - _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648), v15, v16, k, isHidden)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1652), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -116997,7 +113829,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18019, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18057, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 80)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+80, uintptr(0)) @@ -117005,7 +113837,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3DbFree(tls, db, zSql) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { - _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1618, 0) + _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1622, 0) (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).Frc = int32(SQLITE_NOMEM) } pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FpSchema + 8 @@ -117013,6 +113845,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117026,25 +113859,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10800 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13019 + zType = __ccgo_ts + 13048 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18035 + zType = __ccgo_ts + 18073 } else { - zType = __ccgo_ts + 9033 + zType = __ccgo_ts + 9062 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18042, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18080, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117072,7 +113907,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab3 = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3CodeVerifySchema(tls, pParse, iIdxDb) - _ = libc.Int32FromInt32(0) i1 = 0 for { if !(i1 < mx) { @@ -117084,13 +113918,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18049, libc.VaList(bp+176, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18087, libc.VaList(bp+176, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18054, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18092, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117109,13 +113944,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18059, - 1: __ccgo_ts + 18061, - 2: __ccgo_ts + 16548, + 0: __ccgo_ts + 18097, + 1: __ccgo_ts + 18099, + 2: __ccgo_ts + 16586, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18063, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18101, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117131,10 +113967,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { goto _24 } - _ = libc.Int32FromInt32(0) - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18069, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18107, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117148,9 +113984,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18073, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18111, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117166,14 +114003,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(p1 != 0) { break } - _ = libc.Int32FromInt32(0) _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -117182,10 +114020,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } p1 = (*THashElem)(unsafe.Pointer(j)).Fdata - _ = libc.Int32FromInt32(0) _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -117196,9 +114034,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7621, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -117207,9 +114046,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+176, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7621, libc.VaList(bp+176, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -117232,9 +114072,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18085)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18114, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18123)) goto _32 _32: + ; j2++ } i7++ @@ -117243,7 +114084,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -117273,7 +114114,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3TouchRegister(tls, pParse, int32((*TTable)(unsafe.Pointer(pTab6)).FnCol)+regRow) _sqlite3OpenTable(tls, pParse, 0, iDb, pTab6, int32(OP_OpenRead)) _sqlite3VdbeLoadString(tls, v, regResult, (*TTable)(unsafe.Pointer(pTab6)).FzName) - _ = libc.Int32FromInt32(0) i8 = int32(1) pFK1 = (*(*struct { FaddColOffset int32 @@ -117304,10 +114144,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } - _ = libc.Int32FromInt32(0) if pFK1 != 0 { break } @@ -117315,7 +114155,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p (*TParse)(unsafe.Pointer(pParse)).FnTab = i8 } addrTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), 0) - _ = libc.Int32FromInt32(0) i8 = int32(1) pFK1 = (*(*struct { FaddColOffset int32 @@ -117331,7 +114170,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*uintptr)(unsafe.Pointer(bp + 96)) = uintptr(0) if pParent != 0 { x1 = _sqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+88, bp+96) - _ = libc.Int32FromInt32(0) } addrOk = _sqlite3VdbeMakeLabel(tls, pParse) /* Generate code to read the child key values into registers @@ -117354,6 +114192,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -117366,7 +114205,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p jmp = _sqlite3VdbeCurrentAddr(tls, v) + int32(2) _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), i8, jmp, regRow) _sqlite3VdbeGoto(tls, v, addrOk) - _ = libc.Int32FromInt32(0) } } /* Generate code to report an FK violation to the caller. */ @@ -117375,12 +114213,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18090, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18128, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117434,8 +114273,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** "PRAGMA quick_check"), then iDb is set to 0. In this case, set iDb ** to -1 here, to indicate that the VDBE should verify the integrity ** of all attached databases. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pId2)).Fz == uintptr(0) { iDb = -int32(1) } @@ -117479,7 +114316,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** Begin by finding the root pages numbers ** for all tables and indices in the database. */ - _ = libc.Int32FromInt32(0) pTbls = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FpSchema + 8 cnt = 0 x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst @@ -117503,6 +114339,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -117511,6 +114348,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -117553,10 +114391,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -117567,7 +114407,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18094, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18132, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -117585,50 +114425,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -117653,11 +114449,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), *(*int32)(unsafe.Pointer(bp + 108)), 0) loopTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(7), int32(1)) /* Fetch the right-most column from the table. This will cause @@ -117665,7 +114460,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** will also prepopulate the cursor column cache that is used ** by the OP_IsType code, so it is a required step. */ - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { mxCol = -int32(1) j4 = 0 @@ -117678,6 +114472,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -117695,13 +114490,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18118, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18156, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -117710,6 +114505,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 108)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -117777,9 +114573,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18192, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -117791,9 +114588,8 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if bStrict != 0 && doTypeCheck != 0 { _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) - _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18174, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18212, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -117801,7 +114597,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18196, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18234, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -117812,10 +114608,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18219, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18257, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18221, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18259, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -117825,6 +114621,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -117842,12 +114639,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18241, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18279, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -117871,9 +114669,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 112))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18309) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18276) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18314) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -117886,9 +114684,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18297) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18335) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18333) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18371) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -117910,14 +114708,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18309) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18344) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18382) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -117932,20 +114731,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } iCol1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx5)).FaiColumn + uintptr(kk)*2))) - _ = libc.Int32FromInt32(0) if iCol1 >= 0 && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(iCol1)*16 + 8))&0xf>>0)) != 0 { goto _56 } _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 112))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 112))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18371) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18409) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -117953,6 +114752,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 128))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117960,7 +114760,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 108)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18398) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18436) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -117979,6 +114779,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117988,17 +114789,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 104)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18427 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18465 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118032,9 +114900,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if _sqlite3ReadSchema(tls, pParse) != 0 { goto pragma_out } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _returnSingleText(tls, v, _encnames1[(*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc].FzName) } else { /* "PRAGMA encoding = XXX" */ /* Only change the value of sqlite.enc if the database handle is not @@ -118059,27 +114924,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18488, libc.VaList(bp+176, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18526, libc.VaList(bp+176, zRight)) } } } @@ -118157,11 +115023,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118177,20 +115043,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17713) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17751) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18513) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18551) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17866) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17904) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -118214,11 +115080,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -118286,7 +115152,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -118295,22 +115161,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -118319,17 +115185,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) - _ = libc.Int32FromInt32(0) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -118338,15 +115203,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18521, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18559, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -118354,12 +115220,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -118376,7 +115244,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p /*case PragTyp_BUSY_TIMEOUT*/ fallthrough default: - _ = libc.Int32FromInt32(0) if zRight != 0 { Xsqlite3_busy_timeout(tls, db, _sqlite3Atoi(tls, zRight)) } @@ -118458,6 +115325,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -118587,34 +115455,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18430, + FzName: __ccgo_ts + 18468, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18435, + FzName: __ccgo_ts + 18473, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18441, + FzName: __ccgo_ts + 18479, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18450, + FzName: __ccgo_ts + 18488, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18459, + FzName: __ccgo_ts + 18497, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18467, + FzName: __ccgo_ts + 18505, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18475, + FzName: __ccgo_ts + 18513, }, 7: { - FzName: __ccgo_ts + 18482, + FzName: __ccgo_ts + 18520, }, 8: {}, } @@ -118710,36 +115578,36 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18539) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18577) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18554, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18592, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = int8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18561, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18599, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18567) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18605) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18579) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18617) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5110, int32(1)) _sqlite3StrAccumFinish(tls, bp) - _ = libc.Int32FromInt32(0) rc = Xsqlite3_declare_vtab(tls, db, bp+32) if rc == SQLITE_OK { pTab = Xsqlite3_malloc(tls, int32(48)) @@ -118753,7 +115621,7 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg (*TPragmaVtab)(unsafe.Pointer(pTab)).FnHidden = uint8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+240, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+240, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab return rc @@ -118809,10 +115677,10 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 goto _1 } j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden) - _ = libc.Int32FromInt32(0) seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -118825,6 +115693,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -118868,6 +115738,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -118895,7 +115766,6 @@ func _pragmaVtabNext(tls *libc.TLS, pVtabCursor uintptr) (r int32) { rc = SQLITE_OK /* Increment the xRowid value */ (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FiRowid++ - _ = libc.Int32FromInt32(0) if int32(SQLITE_ROW) != Xsqlite3_step(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) { rc = Xsqlite3_finalize(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma = uintptr(0) @@ -118933,27 +115803,26 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr break } zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if zText != 0 { - *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(j)*8)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+40, zText)) + *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(j)*8)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+40, zText)) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(j)*8)) == uintptr(0) { return int32(SQLITE_NOMEM) } } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18594) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18632) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18602, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18640, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18606, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18644, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -118962,7 +115831,7 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr rc = Xsqlite3_prepare_v2(tls, (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), pCsr+8, uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*TPragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+40, Xsqlite3_errmsg(tls, (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*TPragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+40, Xsqlite3_errmsg(tls, (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return _pragmaVtabNext(tls, pVtabCursor) @@ -119040,7 +115909,6 @@ func init() { func _sqlite3PragmaVtabRegister(tls *libc.TLS, db uintptr, zName uintptr) (r uintptr) { var pName uintptr _ = pName - _ = libc.Int32FromInt32(0) pName = _pragmaLocate(tls, zName+uintptr(7)) if pName == uintptr(0) { return uintptr(0) @@ -119048,7 +115916,6 @@ func _sqlite3PragmaVtabRegister(tls *libc.TLS, db uintptr, zName uintptr) (r uin if int32((*TPragmaName)(unsafe.Pointer(pName)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_Result0)|libc.Int32FromInt32(PragFlg_Result1)) == 0 { return uintptr(0) } - _ = libc.Int32FromInt32(0) return _sqlite3VtabCreateModule(tls, db, zName, uintptr(unsafe.Pointer(&_pragmaVtabModule)), pName, uintptr(0)) } @@ -119090,24 +115957,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18640, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18678, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5083 + v1 = __ccgo_ts + 5112 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18668, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18706, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18699, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18737, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119115,9 +115982,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18610, - 1: __ccgo_ts + 18617, - 2: __ccgo_ts + 18629, + 0: __ccgo_ts + 18648, + 1: __ccgo_ts + 18655, + 2: __ccgo_ts + 18667, } // C documentation @@ -119140,6 +116007,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119172,10 +116040,8 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr pData = pInit db = (*TInitData)(unsafe.Pointer(pData)).Fdb iDb = (*TInitData)(unsafe.Pointer(pData)).FiDb - _ = libc.Int32FromInt32(0) _ = NotUsed _ = argc - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_EncodingFixed) if argv == uintptr(0) { return 0 @@ -119185,18 +116051,16 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr _corruptSchema(tls, pData, argv, uintptr(0)) return int32(1) } - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(argv + 3*8)) == uintptr(0) { _corruptSchema(tls, pData, argv, uintptr(0)) } else { if *(*uintptr)(unsafe.Pointer(argv + 4*8)) != 0 && int32('c') == int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)))))]) && int32('r') == int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)) + 1)))]) { saved_iDb = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb /* Return code from sqlite3_prepare() */ - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14520) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -119204,12 +116068,10 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) _sqlite3Prepare(tls, db, *(*uintptr)(unsafe.Pointer(argv + 4*8)), -int32(1), uint32(0), uintptr(0), bp, uintptr(0)) rc = (*Tsqlite3)(unsafe.Pointer(db)).FerrCode - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = saved_iDb /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */ if SQLITE_OK != rc { if int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x1>>0)) != 0 { - _ = libc.Int32FromInt32(0) } else { if rc > (*TInitData)(unsafe.Pointer(pData)).Frc { (*TInitData)(unsafe.Pointer(pData)).Frc = rc @@ -119231,11 +116093,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18707) + _corruptSchema(tls, pData, argv, __ccgo_ts+18745) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14520) } } } @@ -119268,29 +116130,24 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _, _, _, _, _, _, _, _, _, _, _, _, _, _ = encoding, i, mask, openedTransaction, pDb, rc, size, xAuth, zSchemaTabName, zSql, v1, v2, p3, p5 openedTransaction = 0 mask = int32((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&libc.Uint32FromInt32(DBFLAG_EncodingFixed) | uint32(^libc.Int32FromInt32(DBFLAG_EncodingFixed))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(1) /* Construct the in-memory representation schema tables (sqlite_schema or ** sqlite_temp_schema) by invoking the parser directly. The appropriate ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9033 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9062 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6537 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6070 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8105 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18720 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8134 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18758 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -119309,7 +116166,6 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl */ pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 if (*TDb)(unsafe.Pointer(pDb)).FpBt == uintptr(0) { - _ = libc.Int32FromInt32(0) p3 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 114 *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(DB_SchemaLoaded)) rc = SQLITE_OK @@ -119352,6 +116208,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -119379,7 +116236,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12070) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12099) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119405,7 +116262,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18792) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18830) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119419,9 +116276,8 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } /* Read the schema information out of the schema tables */ - _ = libc.Int32FromInt32(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18816, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18854, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -119433,7 +116289,6 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl if rc == SQLITE_OK { _sqlite3AnalysisLoad(tls, db, iDb) } - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) _sqlite3ResetAllSchemasOfConnection(tls, db) @@ -119460,11 +116315,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< 0) { break } - _ = libc.Int32FromInt32(0) if !(int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_SchemaLoaded) == libc.Int32FromInt32(DB_SchemaLoaded)) { rc = _sqlite3InitOne(tls, db, i, pzErrMsg, uint32(0)) if rc != 0 { @@ -119517,6 +116369,7 @@ func _sqlite3Init(tls *libc.TLS, db uintptr, pzErrMsg uintptr) (r int32) { } goto _1 _1: + ; i-- } if commit_internal != 0 { @@ -119537,7 +116390,6 @@ func _sqlite3ReadSchema(tls *libc.TLS, pParse uintptr) (r int32) { _, _ = db, rc rc = SQLITE_OK db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { rc = _sqlite3Init(tls, db, pParse+8) if rc != SQLITE_OK { @@ -119567,8 +116419,6 @@ func _schemaIsValid(tls *libc.TLS, pParse uintptr) { var _ /* cookie at bp+0 */ int32 _, _, _, _, _ = db, iDb, openedTransaction, pBt, rc db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDb = 0 for { if !(iDb < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -119597,7 +116447,6 @@ func _schemaIsValid(tls *libc.TLS, pParse uintptr) { ** value stored as part of the in-memory schema representation, ** set Parse.rc to SQLITE_SCHEMA. */ _sqlite3BtreeGetMeta(tls, pBt, int32(BTREE_SCHEMA_VERSION), bp) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema)).Fschema_cookie { if int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema)).FschemaFlags)&int32(DB_SchemaLoaded) == int32(DB_SchemaLoaded) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_SCHEMA) @@ -119610,6 +116459,7 @@ func _schemaIsValid(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; iDb++ } } @@ -119638,22 +116488,20 @@ func _sqlite3SchemaToIndex(tls *libc.TLS, db uintptr, pSchema uintptr) (r int32) ** statements too, but it never hurts to play the odds) and ** -32768 will still fit into a 16-bit signed integer. */ - _ = libc.Int32FromInt32(0) if pSchema != 0 { i = 0 for { if !(int32(1) != 0) { break } - _ = libc.Int32FromInt32(0) if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema == pSchema { break } goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) } return i } @@ -119668,9 +116516,6 @@ func _sqlite3ParseObjectReset(tls *libc.TLS, pParse uintptr) { var v1 int32 _, _, _ = db, pCleanup, v1 db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FaTableLock != 0 { _sqlite3DbNNFreeNN(tls, db, (*TParse)(unsafe.Pointer(pParse)).FaTableLock) } @@ -119686,7 +116531,6 @@ func _sqlite3ParseObjectReset(tls *libc.TLS, pParse uintptr) { if (*TParse)(unsafe.Pointer(pParse)).FpConstExpr != 0 { _sqlite3ExprListDelete(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpConstExpr) } - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable -= uint32((*TParse)(unsafe.Pointer(pParse)).FdisableLookaside) if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { v1 = 0 @@ -119694,7 +116538,6 @@ func _sqlite3ParseObjectReset(tls *libc.TLS, pParse uintptr) { v1 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v1) - _ = libc.Int32FromInt32(0) (*Tsqlite3)(unsafe.Pointer(db)).FpParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } @@ -119758,12 +116601,11 @@ func _sqlite3ParserAddCleanup(tls *libc.TLS, pParse uintptr, xCleanup uintptr, p func _sqlite3ParseObjectInit(tls *libc.TLS, pParse uintptr, db uintptr) { libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+8)), 0, uint64(libc.UintptrFromInt32(0)+232)-uint64(libc.UintptrFromInt32(0)+8)) libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+288)), 0, libc.Uint64FromInt64(424)-uint64(libc.UintptrFromInt32(0)+288)) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpOuterParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParse (*TParse)(unsafe.Pointer(pParse)).Fdb = db if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1618, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1622, 0) } } @@ -119795,17 +116637,14 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep (*(*TParse)(unsafe.Pointer(bp))).FpReprepare = pReprepare (*(*TParse)(unsafe.Pointer(bp))).Fexplain = uint8(Xsqlite3_stmt_isexplain(tls, pReprepare)) } else { - _ = libc.Int32FromInt32(0) } - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { - _sqlite3ErrorMsg(tls, bp, __ccgo_ts+1618, 0) + _sqlite3ErrorMsg(tls, bp, __ccgo_ts+1622, 0) v1 = libc.Int32FromInt32(SQLITE_NOMEM) rc = v1 (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = v1 goto end_prepare } - _ = libc.Int32FromInt32(0) /* For a long-term use prepared statement avoid the use of ** lookaside memory. */ @@ -119846,16 +116685,16 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep } pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt if pBt != 0 { - _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeSchemaLocked(tls, pBt) if rc != 0 { zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FzDbSName - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+18850, libc.VaList(bp+432, zDb)) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+18888, libc.VaList(bp+432, zDb)) goto end_prepare } } goto _2 _2: + ; i++ } } @@ -119865,7 +116704,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep if nBytes >= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18880, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18918, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -119880,7 +116719,6 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep } else { _sqlite3RunParser(tls, bp, zSql) } - _ = libc.Int32FromInt32(0) if pzTail != 0 { *(*uintptr)(unsafe.Pointer(pzTail)) = (*(*TParse)(unsafe.Pointer(bp))).FzTail } @@ -119898,16 +116736,14 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep if (*(*TParse)(unsafe.Pointer(bp))).FpVdbe != 0 { _sqlite3VdbeFinalize(tls, (*(*TParse)(unsafe.Pointer(bp))).FpVdbe) } - _ = libc.Int32FromInt32(0) rc = (*(*TParse)(unsafe.Pointer(bp))).Frc if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+3795, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+3799, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) _sqlite3DbFree(tls, db, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg) } else { _sqlite3Error(tls, db, rc) } } else { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*(*TParse)(unsafe.Pointer(bp))).FpVdbe rc = SQLITE_OK _sqlite3ErrorClear(tls, db) @@ -119919,6 +116755,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -119930,7 +116767,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -119939,12 +116776,12 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 ** or encounters a permanent error. A schema problem after one schema ** reset is considered a permanent error. */ rc = _sqlite3Prepare(tls, db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { break } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120083,6 +116912,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -120121,7 +116951,7 @@ func Xsqlite3_prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, p var rc int32 _ = rc rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(0), ppStmt, pzTail) - _ = libc.Int32FromInt32(0) /* VERIFY: F13021 */ + /* VERIFY: F13021 */ return rc } @@ -120129,7 +116959,7 @@ func Xsqlite3_prepare16_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32 var rc int32 _ = rc rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL), ppStmt, pzTail) - _ = libc.Int32FromInt32(0) /* VERIFY: F13021 */ + /* VERIFY: F13021 */ return rc } @@ -120137,7 +116967,7 @@ func Xsqlite3_prepare16_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32 var rc int32 _ = rc rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL)|prepFlags&uint32(SQLITE_PREPARE_MASK), ppStmt, pzTail) - _ = libc.Int32FromInt32(0) /* VERIFY: F13021 */ + /* VERIFY: F13021 */ return rc } @@ -120246,7 +117076,6 @@ type SortCtx1 = TSortCtx1 func _clearSelect(tls *libc.TLS, db uintptr, p uintptr, bFree int32) { var pPrior uintptr _ = pPrior - _ = libc.Int32FromInt32(0) for p != 0 { pPrior = (*TSelect)(unsafe.Pointer(p)).FpPrior _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpEList) @@ -120263,7 +117092,6 @@ func _clearSelect(tls *libc.TLS, db uintptr, p uintptr, bFree int32) { _sqlite3WindowListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWinDefn) } for (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _ = libc.Int32FromInt32(0) _sqlite3WindowUnlinkFromSelect(tls, (*TSelect)(unsafe.Pointer(p)).FpWin) } if bFree != 0 { @@ -120305,7 +117133,6 @@ func _sqlite3SelectNew(tls *libc.TLS, pParse uintptr, pEList uintptr, pSrc uintp pNew = v1 pAllocated = v1 if pNew == uintptr(0) { - _ = libc.Int32FromInt32(0) pNew = bp } if pEList == uintptr(0) { @@ -120341,7 +117168,6 @@ func _sqlite3SelectNew(tls *libc.TLS, pParse uintptr, pEList uintptr, pSrc uintp _clearSelect(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pNew, libc.BoolInt32(pNew != bp)) pAllocated = uintptr(0) } else { - _ = libc.Int32FromInt32(0) } return pAllocated } @@ -120468,6 +117294,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -120476,18 +117303,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11177 - zSp2 = __ccgo_ts + 11177 + zSp1 = __ccgo_ts + 11206 + zSp2 = __ccgo_ts + 11206 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18899, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18937, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -120560,6 +117388,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -120574,13 +117403,8 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { func _sqlite3SrcItemColumnUsed(tls *libc.TLS, pItem uintptr, iCol int32) { var pResults uintptr _ = pResults - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2000>>13)) != 0 { - _ = libc.Int32FromInt32(0) pResults = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpEList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr16Uint32(pResults+8+uintptr(iCol)*32+16+4, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -120600,9 +117424,7 @@ func _sqlite3SrcItemColumnUsed(tls *libc.TLS, pItem uintptr, iCol int32) { func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, zCol uintptr, piTab uintptr, piCol uintptr, bIgnoreHidden int32) (r int32) { var i, iCol int32 _, _ = i, iCol /* Index of column matching zCol */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Both or neither are NULL */ + /* Both or neither are NULL */ i = iStart for { if !(i <= iEnd) { @@ -120619,6 +117441,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -120655,13 +117478,10 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) { var i int32 _ = i - _ = libc.Int32FromInt32(0) for p != 0 { *(*Tu32)(unsafe.Pointer(p + 4)) |= joinFlag - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(p + 52)) = iTable if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) { - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { i = 0 for { @@ -120671,6 +117491,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -120710,8 +117531,6 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(EP_CanBeNull)) } if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { i = 0 for { @@ -120721,6 +117540,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -120786,7 +117606,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18929, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18967, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -120801,13 +117621,12 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if _tableAndColumnIndex(tls, pSrc, 0, i, zName, uintptr(0), uintptr(0), int32(1)) != 0 { pUsing = _sqlite3IdListAppend(tls, pParse, pUsing, uintptr(0)) if pUsing != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TIdList_item)(unsafe.Pointer(pUsing + 8 + uintptr((*TIdList)(unsafe.Pointer(pUsing)).FnId-int32(1))*16))).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zName) } } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -120829,7 +117648,6 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 { pList = *(*uintptr)(unsafe.Pointer(pRight + 72)) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < (*TIdList)(unsafe.Pointer(pList)).FnId) { @@ -120838,7 +117656,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18979, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19017, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -120860,7 +117678,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19043, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19081, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -120875,15 +117693,14 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pE2 = _sqlite3CreateColumnExpr(tls, db, pSrc, i+int32(1), iRightCol) _sqlite3SrcItemColumnUsed(tls, pRight, iRightCol) pEq = _sqlite3PExpr(tls, pParse, int32(TK_EQ), pE1, pE2) - _ = libc.Int32FromInt32(0) if pEq != 0 { *(*Tu32)(unsafe.Pointer(pEq + 4)) |= joinType - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pEq + 52)) = (*TExpr)(unsafe.Pointer(pE2)).FiTable } (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -120896,6 +117713,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -120904,7 +117722,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6705, + Fz: __ccgo_ts + 6734, Fn: uint32(8), } @@ -120980,7 +117798,6 @@ func _pushOntoSorter(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintp regRecord = 0 /* Assembled sorter record */ nOBSat = (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat /* LIMIT counter */ iSkip = 0 /* End of the sorter insert loop */ - _ = libc.Int32FromInt32(0) /* Three cases: ** (1) The data to be sorted has already been packed into a Record ** by a prior OP_MakeRecord. In this case nData==1 and regData @@ -120994,15 +117811,12 @@ func _pushOntoSorter(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintp ** regOrigData is 0 to prevent this routine from trying to copy ** values that might not yet exist. */ - _ = libc.Int32FromInt32(0) if nPrefixReg != 0 { - _ = libc.Int32FromInt32(0) regBase = regData - nPrefixReg } else { regBase = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += nBase } - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(pSelect)).FiOffset != 0 { v1 = (*TSelect)(unsafe.Pointer(pSelect)).FiOffset + int32(1) } else { @@ -121164,7 +117978,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121186,9 +118000,9 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) case int32(WHERE_DISTINCT_UNIQUE): /* nothing to do */ @@ -121275,8 +118089,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS eDest = int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) /* How to dispose of results */ iParm = (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm /* Number of result columns */ nPrefixReg = 0 /* Start of memory holding full result (or 0) */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pDistinct != 0 { v1 = int32((*TDistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) } else { @@ -121287,7 +118099,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS pSort = uintptr(0) } if pSort == uintptr(0) && !(hasDistinct != 0) { - _ = libc.Int32FromInt32(0) _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, iContinue) } /* Pull the requested columns. @@ -121326,6 +118137,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -121355,6 +118167,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -121371,15 +118184,13 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } - _ = libc.Int32FromInt32(0) } (*(*TRowLoadInfo)(unsafe.Pointer(bp))).FregResult = regResult (*(*TRowLoadInfo)(unsafe.Pointer(bp))).FecelFlags = ecelFlags if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && int32(ecelFlags)&int32(SQLITE_ECEL_OMITREF) != 0 && nPrefixReg > 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TSortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad = bp regOrig = 0 } else { @@ -121394,7 +118205,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS if hasDistinct != 0 { eType = int32((*TDistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) iTab = (*TDistinctCtx)(unsafe.Pointer(pDistinct)).FtabTnct - _ = libc.Int32FromInt32(0) iTab = _codeDistinct(tls, pParse, eType, iTab, iContinue, (*TSelect)(unsafe.Pointer(p)).FpEList, regResult) _fixDistinctOpenEph(tls, pParse, eType, iTab, (*TDistinctCtx)(unsafe.Pointer(pDistinct)).FaddrTnct) if pSort == uintptr(0) { @@ -121440,10 +118250,8 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS addr = _sqlite3VdbeCurrentAddr(tls, v) + int32(4) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iParm+int32(1), addr, r11, 0) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm+int32(1), r11, regResult, nResultCol) - _ = libc.Int32FromInt32(0) } if pSort != 0 { - _ = libc.Int32FromInt32(0) _pushOntoSorter(tls, pParse, pSort, p, r11+nPrefixReg, regOrig, int32(1), nPrefixReg) } else { r2 = _sqlite3GetTempReg(tls, pParse) @@ -121485,7 +118293,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { r13 = _sqlite3GetTempReg(tls, pParse) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regResult, nResultCol, r13, (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nResultCol) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r13, regResult, nResultCol) _sqlite3ReleaseTempReg(tls, pParse, r13) @@ -121505,16 +118312,13 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS fallthrough case int32(SRT_Mem): if pSort != 0 { - _ = libc.Int32FromInt32(0) _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -121537,7 +118341,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS case int32(SRT_Queue): addrTest = 0 pSO = (*TSelectDest)(unsafe.Pointer(pDest)).FpOrderBy - _ = libc.Int32FromInt32(0) nKey = (*TExprList)(unsafe.Pointer(pSO)).FnExpr r14 = _sqlite3GetTempReg(tls, pParse) r21 = _sqlite3GetTempRange(tls, pParse, nKey+int32(2)) @@ -121561,6 +118364,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -121579,7 +118383,6 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS */ fallthrough default: - _ = libc.Int32FromInt32(0) break } /* Jump to the end of the loop if the LIMIT is reached. Except, if @@ -121624,8 +118427,6 @@ func _sqlite3KeyInfoAlloc(tls *libc.TLS, db uintptr, N int32, X int32) (r uintpt // */ func _sqlite3KeyInfoUnref(tls *libc.TLS, p uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TKeyInfo)(unsafe.Pointer(p)).FnRef-- if (*TKeyInfo)(unsafe.Pointer(p)).FnRef == uint32(0) { _sqlite3DbNNFreeNN(tls, (*TKeyInfo)(unsafe.Pointer(p)).Fdb, p) @@ -121640,7 +118441,6 @@ func _sqlite3KeyInfoUnref(tls *libc.TLS, p uintptr) { // */ func _sqlite3KeyInfoRef(tls *libc.TLS, p uintptr) (r uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) (*TKeyInfo)(unsafe.Pointer(p)).FnRef++ } return p @@ -121670,7 +118470,6 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i nExpr = (*TExprList)(unsafe.Pointer(pList)).FnExpr pInfo = _sqlite3KeyInfoAlloc(tls, db, nExpr-iStart, nExtra+int32(1)) if pInfo != 0 { - _ = libc.Int32FromInt32(0) i = iStart pItem = pList + 8 + uintptr(iStart)*32 for { @@ -121681,6 +118480,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -121698,13 +118498,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19080 + z = __ccgo_ts + 19118 case int32(TK_INTERSECT): - z = __ccgo_ts + 19090 + z = __ccgo_ts + 19128 case int32(TK_EXCEPT): - z = __ccgo_ts + 19100 + z = __ccgo_ts + 19138 default: - z = __ccgo_ts + 19107 + z = __ccgo_ts + 19145 break } return z @@ -121725,7 +118525,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+8, zUsage)) } /* @@ -121760,12 +118560,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19136 + v1 = __ccgo_ts + 19174 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+8, v1)) - _ = libc.Int32FromInt32(0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19189, libc.VaList(bp+8, v1)) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) _sqlite3VdbeGoto(tls, v, addrBreak) @@ -121805,7 +118604,6 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeJumpHere(tls, v, addrOnce) } addr = int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterSort), iTab, addrBreak) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_SorterData), iTab, regSortOut, iSortTab) bSeq = 0 } else { @@ -121828,6 +118626,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -121845,6 +118644,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -121856,7 +118656,6 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iParm, regRow, regRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) case int32(SRT_Set): - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regRow, nColumn, regRowid, (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nColumn) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, regRowid, regRow, nColumn) case int32(SRT_Mem): @@ -121871,7 +118670,6 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r1, regRow, i2) } default: - _ = libc.Int32FromInt32(0) if eDest == int32(SRT_Output) { _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst, nColumn) } else { @@ -121939,8 +118737,6 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { case int32(TK_COLUMN): /* The expression is a column. Locate the table the column is being @@ -121959,6 +118755,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -121988,13 +118785,12 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** branch below. */ break } - _ = libc.Int32FromInt32(0) if pS != 0 { /* The "table" is actually a sub-select or a view in the FROM clause ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -122003,14 +118799,12 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } } else { /* A real table or a CTE table */ - _ = libc.Int32FromInt32(0) if iCol < 0 { iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } - _ = libc.Int32FromInt32(0) if iCol < 0 { - zType = __ccgo_ts + 1136 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16660 + zType = __ccgo_ts + 1140 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16698 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -122022,7 +118816,6 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } } case int32(TK_SELECT): - _ = libc.Int32FromInt32(0) pS1 = *(*uintptr)(unsafe.Pointer(pExpr + 32)) p1 = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS1)).FpEList + 8))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 80))).FpSrcList = (*TSelect)(unsafe.Pointer(pS1)).FpSrc @@ -122032,7 +118825,6 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr break } if pzOrigDb != 0 { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pzOrigDb)) = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(pzOrigTab)) = *(*uintptr)(unsafe.Pointer(bp + 8)) *(*uintptr)(unsafe.Pointer(pzOrigCol)) = *(*uintptr)(unsafe.Pointer(bp + 16)) @@ -122080,6 +118872,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122133,8 +118926,6 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } pTabList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) fullName = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_FullColNames) != uint64(0)) srcName = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ShortColNames) != uint64(0) || fullName != 0) @@ -122145,9 +118936,8 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) break } p = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Agg processing has not run yet */ - _ = libc.Int32FromInt32(0) /* Covering idx not yet coded */ + /* Agg processing has not run yet */ + /* Covering idx not yet coded */ if (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME { /* An AS clause always takes first priority */ zName = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName @@ -122156,19 +118946,17 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) if srcName != 0 && int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) { iCol = int32((*TExpr)(unsafe.Pointer(p)).FiColumn) pTab = *(*uintptr)(unsafe.Pointer(p + 64)) - _ = libc.Int32FromInt32(0) if iCol < 0 { iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } - _ = libc.Int32FromInt32(0) if iCol < 0 { - zCol = __ccgo_ts + 16660 + zCol = __ccgo_ts + 16698 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12385, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122176,7 +118964,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19220, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122186,6 +118974,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122237,7 +119026,6 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, nCol = 0 aCol = uintptr(0) } - _ = libc.Int32FromInt32(0) *(*Ti16)(unsafe.Pointer(pnCol)) = int16(nCol) *(*uintptr)(unsafe.Pointer(paCol)) = aCol i = 0 @@ -122257,7 +119045,6 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, pColExpr = _sqlite3ExprSkipCollateAndLikely(tls, (*TExprList_item)(unsafe.Pointer(pX)).FpExpr) for pColExpr != uintptr(0) && int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_DOT) { pColExpr = (*TExpr)(unsafe.Pointer(pColExpr)).FpRight - _ = libc.Int32FromInt32(0) } if int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pColExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) && *(*uintptr)(unsafe.Pointer(pColExpr + 64)) != uintptr(0) { /* For columns use the column name name */ @@ -122269,23 +119056,22 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 16660 + v3 = __ccgo_ts + 16698 } zName = v3 } else { if int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_ID) { - _ = libc.Int32FromInt32(0) zName = *(*uintptr)(unsafe.Pointer(pColExpr + 8)) } else { /* Use the original text of the column expression as its name */ - _ = libc.Int32FromInt32(0) /* pointer comparison intended */ + /* pointer comparison intended */ } } } if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19220, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122312,6 +119098,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -122320,7 +119107,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19191, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19229, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -122337,6 +119124,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -122350,6 +119138,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -122382,10 +119171,6 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS var _ /* sNC at bp+0 */ TNameContext _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, db, i, j, m, m1, n, p, pCol, pColl, pS2, zType, p4, p5 db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { return } @@ -122419,6 +119204,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -122435,7 +119221,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19199 + zType = __ccgo_ts + 19237 } else { zType = uintptr(0) j = int32(1) @@ -122449,6 +119235,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -122467,11 +119254,11 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } pColl = _sqlite3ExprCollSeq(tls, pParse, p) if pColl != 0 { - _ = libc.Int32FromInt32(0) _sqlite3ColumnSetColl(tls, db, pCol, (*TCollSeq)(unsafe.Pointer(pColl)).FzName) } goto _1 _1: + ; i++ pCol += 16 } @@ -122507,7 +119294,6 @@ func _sqlite3ResultSetOfSelect(tls *libc.TLS, pParse uintptr, pSelect uintptr, a (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) (*TTable)(unsafe.Pointer(pTab)).FzName = uintptr(0) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) - _ = libc.Int32FromInt32(0) _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSelect)).FpEList, pTab+54, pTab+8) _sqlite3SubqueryColumnTypes(tls, pParse, pTab, pSelect, aff) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) @@ -122579,8 +119365,6 @@ func _computeLimitRegisters(tls *libc.TLS, pParse uintptr, p uintptr, iBreak int ** no rows. */ if pLimit != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v3 = pParse + 56 *(*int32)(unsafe.Pointer(v3))++ v2 = *(*int32)(unsafe.Pointer(v3)) @@ -122588,7 +119372,6 @@ func _computeLimitRegisters(tls *libc.TLS, pParse uintptr, p uintptr, iBreak int iLimit = v1 (*TSelect)(unsafe.Pointer(p)).FiLimit = v1 v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) if _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer(pLimit)).FpLeft, bp) != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), *(*int32)(unsafe.Pointer(bp)), iLimit) if *(*int32)(unsafe.Pointer(bp)) == 0 { @@ -122637,7 +119420,6 @@ func _multiSelectCollSeq(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) ( } else { pRet = uintptr(0) } - _ = libc.Int32FromInt32(0) /* iCol must be less than p->pEList->nExpr. Otherwise an error would ** have been thrown during name resolution and we would not have gotten ** this far */ @@ -122691,11 +119473,11 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra } (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr = _sqlite3ExprAddCollateString(tls, pParse, pTerm, (*TCollSeq)(unsafe.Pointer(pColl)).FzName) } - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pRet + 32 + uintptr(i)*8)) = pColl *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -122754,7 +119536,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19203, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19241, 0) return } /* Obtain authorization to do a recursive query */ @@ -122785,6 +119567,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -122846,7 +119629,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19252, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19290, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -122855,12 +119638,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19294, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19332, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -122888,14 +119672,14 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19300, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19338, 0) _sqlite3Select(tls, pParse, p, bp) - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup /* Keep running the loop until the Queue is empty */ _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -122929,27 +119713,22 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) nRow = int32(1) rc = 0 bShowAll = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FpLimit == uintptr(0)) - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = int32(1) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { return -int32(1) } if (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { break } - _ = libc.Int32FromInt32(0) p = (*TSelect)(unsafe.Pointer(p)).FpPrior nRow += bShowAll } if nRow == int32(1) { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } else { - v1 = __ccgo_ts + 19315 + v1 = __ccgo_ts + 19353 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19317, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19355, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123024,20 +119803,15 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. */ - _ = libc.Int32FromInt32(0) /* Calling function guarantees this much */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* Calling function guarantees this much */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb pPrior = (*TSelect)(unsafe.Pointer(p)).FpPrior *(*TSelectDest)(unsafe.Pointer(bp)) = *(*TSelectDest)(unsafe.Pointer(pDest)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v = _sqlite3GetVdbe(tls, pParse) - _ = libc.Int32FromInt32(0) /* The VDBE already created by calling function */ + /* The VDBE already created by calling function */ /* Create the destination temporary table if necessary */ if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == int32(SRT_EphemTab) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr) (*(*TSelectDest)(unsafe.Pointer(bp))).FeDest = uint8(SRT_Table) } @@ -123053,8 +119827,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in /* Make sure all SELECTs in the statement have the same number of elements ** in their result sets. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Recursive) != uint32(0) && _hasAnchor(tls, p) != 0 { _generateWithRecursiveQuery(tls, pParse, p, bp) } else { @@ -123064,8 +119836,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19340, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19355, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19378, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19393, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123073,7 +119845,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in case int32(TK_ALL): addr = 0 *(*int32)(unsafe.Pointer(bp + 40)) = 0 /* Initialize to suppress harmless compiler warning */ - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = (*TSelect)(unsafe.Pointer(p)).FiLimit (*TSelect)(unsafe.Pointer(pPrior)).FiOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(pPrior)).FpLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit @@ -123091,7 +119862,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19080, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19118, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123104,14 +119875,14 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { /* We can reuse a temporary table generated by a SELECT to our ** right. */ - _ = libc.Int32FromInt32(0) /* Not allowed on leftward elements */ + /* Not allowed on leftward elements */ unionTab = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm } else { /* We will need to create our own temporary table to hold the @@ -123121,16 +119892,12 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2))++ unionTab = v1 - _ = libc.Int32FromInt32(0) addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), unionTab, 0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(p + 20)) = addr1 *(*Tu32)(unsafe.Pointer(_findRightmost(tls, p) + 4)) |= uint32(SF_UsesEphemeral) - _ = libc.Int32FromInt32(0) } /* Code the SELECT statements to our left */ - _ = libc.Int32FromInt32(0) _sqlite3SelectDestInit(tls, bp+48, priorOp, unionTab) rc = _sqlite3Select(tls, pParse, pPrior, bp+48) if rc != 0 { @@ -123141,16 +119908,14 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in if int32((*TSelect)(unsafe.Pointer(p)).Fop) == int32(TK_EXCEPT) { op = uint8(SRT_Except) } else { - _ = libc.Int32FromInt32(0) op = uint8(SRT_Union) } (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19412, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) - _ = libc.Int32FromInt32(0) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) @@ -123164,8 +119929,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in /* Convert the data in the temporary table into whatever form ** it is that we currently need. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) != priorOp && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { iBreak = _sqlite3VdbeMakeLabel(tls, pParse) iCont = _sqlite3VdbeMakeLabel(tls, pParse) @@ -123179,7 +119942,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), unionTab, 0) } default: - _ = libc.Int32FromInt32(0) /* INTERSECT is different from the others since it requires ** two temporary tables. Hence it has its own case. Begin ** by allocating the tables we will need. @@ -123192,12 +119954,9 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in v5 = *(*int32)(unsafe.Pointer(v6)) *(*int32)(unsafe.Pointer(v6))++ tab2 = v5 - _ = libc.Int32FromInt32(0) addr2 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), tab1, 0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(p + 20)) = addr2 *(*Tu32)(unsafe.Pointer(_findRightmost(tls, p) + 4)) |= uint32(SF_UsesEphemeral) - _ = libc.Int32FromInt32(0) /* Code the SELECTs to our left into temporary table "tab1". */ _sqlite3SelectDestInit(tls, bp+88, int32(SRT_Union), tab1) @@ -123208,13 +119967,12 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in /* Code the current SELECT into temporary table "tab2" */ addr2 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), tab2, 0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(p + 20 + 1*4)) = addr2 (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19412, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123229,7 +119987,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in if rc != 0 { break } - _ = libc.Int32FromInt32(0) iBreak1 = _sqlite3VdbeMakeLabel(tls, pParse) iCont1 = _sqlite3VdbeMakeLabel(tls, pParse) _computeLimitRegisters(tls, pParse, p, iBreak1) @@ -123264,8 +120021,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in ** no temp tables are required. */ if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_UsesEphemeral) != 0 { /* Number of columns in result set */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nCol = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr pKeyInfo = _sqlite3KeyInfoAlloc(tls, db, nCol, int32(1)) if !(pKeyInfo != 0) { @@ -123284,6 +120039,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -123301,7 +120057,6 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in if addr3 < 0 { /* If [0] is unused then [1] is also unused. So we can ** always safely abort as soon as the first unused slot is found */ - _ = libc.Int32FromInt32(0) break } _sqlite3VdbeChangeP2(tls, v, addr3, nCol) @@ -123309,15 +120064,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123336,9 +120094,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19433, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19441, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19479, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -123387,8 +120145,6 @@ func _generateOutputSubroutine(tls *libc.TLS, pParse uintptr, p uintptr, pIn uin /* Suppress the first OFFSET entries if there is an OFFSET clause */ _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, iContinue) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) { /* Store the result as data using a unique key. */ @@ -123443,7 +120199,6 @@ func _generateOutputSubroutine(tls *libc.TLS, pParse uintptr, p uintptr, pIn uin */ fallthrough default: - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) break } @@ -123556,19 +120311,16 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aPermute, addr1, addrAeqB, addrAgtB, addrAltB, addrEofA, addrEofA_noB, addrEofB, addrOutA, addrOutB, addrSelectA, addrSelectB, db, i, j, labelCmpr, labelEnd, nExpr, nOrderBy, nSelect, op, pItem, pItem1, pKeyDup, pKeyMerge, pNew, pOrderBy, pPrior, pSplit, regAddrA, regAddrB, regLimitA, regLimitB, regOutA, regOutB, regPrev, savedLimit, savedOffset, v, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v3, v4, v9 /* Address of the output-A subroutine */ addrOutB = 0 /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */ pKeyDup = uintptr(0) /* Mapping from ORDER BY terms to result set columns */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* "Managed" code needs this. Ticket #3382. */ + /* "Managed" code needs this. Ticket #3382. */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) /* Already thrown the error if VDBE alloc failed */ + /* Already thrown the error if VDBE alloc failed */ labelEnd = _sqlite3VdbeMakeLabel(tls, pParse) labelCmpr = _sqlite3VdbeMakeLabel(tls, pParse) /* Patch up the ORDER BY clause */ op = int32((*TSelect)(unsafe.Pointer(p)).Fop) - _ = libc.Int32FromInt32(0) pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy - _ = libc.Int32FromInt32(0) nOrderBy = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr /* For operators other than UNION ALL we have to make sure that ** the ORDER BY clause covers every term of the result set. Add @@ -123586,8 +120338,6 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr if !(j < nOrderBy) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*(*struct { FiOrderByCol Tu16 FiAlias Tu16 @@ -123596,6 +120346,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -123617,6 +120368,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -123636,15 +120388,13 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr if !(i <= nOrderBy) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) = uint32(int32((*(*struct { FiOrderByCol Tu16 FiAlias Tu16 })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -123660,13 +120410,11 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regPrev = 0 } else { nExpr = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr - _ = libc.Int32FromInt32(0) regPrev = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += nExpr + int32(1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regPrev) pKeyDup = _sqlite3KeyInfoAlloc(tls, db, nExpr, int32(1)) if pKeyDup != 0 { - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nExpr) { @@ -123676,6 +120424,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -123690,9 +120439,9 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr break } nSelect++ - _ = libc.Int32FromInt32(0) goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -123708,18 +120457,16 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } pPrior = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7342) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7371) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7371) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -123763,14 +120510,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19523, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19561, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19534, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19572, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -123783,7 +120530,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19539, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19577, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -123958,9 +120705,6 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { } if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSubstContext)(unsafe.Pointer(pSubst)).FiTable && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { iColumn = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCopy = (*(*TExprList_item)(unsafe.Pointer((*TSubstContext)(unsafe.Pointer(pSubst)).FpEList + 8 + uintptr(iColumn)*32))).FpExpr if _sqlite3ExprIsVector(tls, pCopy) != 0 { _sqlite3VectorErrorMsg(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pCopy) @@ -124001,7 +120745,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5061 + v1 = __ccgo_ts + 5090 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124042,6 +120786,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -124061,7 +120806,6 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { (*TSelect)(unsafe.Pointer(p)).FpHaving = _substExpr(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpHaving) (*TSelect)(unsafe.Pointer(p)).FpWhere = _substExpr(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpWhere) pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc - _ = libc.Int32FromInt32(0) i = (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc pItem = pSrc + 8 for { @@ -124074,11 +120818,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124156,7 +120902,6 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr break } if i != iExcept { - _ = libc.Int32FromInt32(0) if !(int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x40>>6)) != 0) || *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*TSrcItem)(unsafe.Pointer(pItem)).FiCursor+int32(1))*4)) == 0 { v3 = pParse + 52 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -124172,11 +120917,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -124274,34 +121021,29 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { var ii int32 var pList, pSub1 uintptr _, _, _, _ = aff, ii, pList, pSub1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pList = (*TSelect)(unsafe.Pointer(p)).FpEList ii = 0 for { if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { break } - _ = libc.Int32FromInt32(0) aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) pSub1 = (*TSelect)(unsafe.Pointer(p)).FpPrior for { if !(pSub1 != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(_sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub1)).FpEList + 8 + uintptr(ii)*32))).FpExpr)) != int32(aff) { return int32(1) } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -124498,22 +121240,17 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA aCsrMap = uintptr(0) /* Check to see if flattening is permitted. Return 0 if not. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_QueryFlattener)) != uint32(0) { return 0 } pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc - _ = libc.Int32FromInt32(0) pSubitem = pSrc + 8 + uintptr(iFrom)*104 iParent = (*TSrcItem)(unsafe.Pointer(pSubitem)).FiCursor pSub = (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 || (*TSelect)(unsafe.Pointer(pSub)).FpWin != 0 { return 0 } /* Restriction (25) */ pSubSrc = (*TSelect)(unsafe.Pointer(pSub)).FpSrc - _ = libc.Int32FromInt32(0) /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET @@ -124573,12 +121310,11 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } isOuterJoin = int32(1) } - _ = libc.Int32FromInt32(0) /* True by restriction (7) */ + /* True by restriction (7) */ if iFrom > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSubSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { return 0 /* Restriction (27a) */ } /* Condition (28) is blocked by the caller */ - _ = libc.Int32FromInt32(0) /* Restriction (17): If the sub-query is a compound SELECT, then it must ** use only the UNION ALL operator. And none of the simple select queries ** that make up the compound SELECT are allowed to be aggregate or distinct @@ -124596,9 +121332,6 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA if !(pSub1 != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(pSub1)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) != uint32(0) || (*TSelect)(unsafe.Pointer(pSub1)).FpPrior != 0 && int32((*TSelect)(unsafe.Pointer(pSub1)).Fop) != int32(TK_ALL) || (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub1)).FpSrc)).FnSrc < int32(1) || (*TSelect)(unsafe.Pointer(pSub1)).FpWin != 0 { return 0 } @@ -124610,6 +121343,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -124624,6 +121358,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -124662,7 +121397,6 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA (*TSrcItem)(unsafe.Pointer(pSubitem)).FzName = uintptr(0) (*TSrcItem)(unsafe.Pointer(pSubitem)).FzAlias = uintptr(0) (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect = uintptr(0) - _ = libc.Int32FromInt32(0) /* If the sub-query is a compound SELECT statement, then (by restrictions ** 17 and 18 above) it must be a UNION ALL and the parent query must ** be of the form: @@ -124731,9 +121465,9 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA (*TSelect)(unsafe.Pointer(pNew)).FpNext = p (*TSelect)(unsafe.Pointer(p)).FpPrior = pNew } - _ = libc.Int32FromInt32(0) goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -124784,7 +121518,6 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } jointype = uint8(0) ltorj = uint8(int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(iFrom)*104))).Ffg.Fjointype) & int32(JT_LTORJ)) - _ = libc.Int32FromInt32(0) pSubSrc = (*TSelect)(unsafe.Pointer(pSub)).FpSrc /* FROM clause of subquery */ nSubSrc = (*TSrcList)(unsafe.Pointer(pSubSrc)).FnSrc /* Number of terms in subquery FROM clause */ pSrc = (*TSelect)(unsafe.Pointer(pParent)).FpSrc /* FROM clause of the outer query */ @@ -124825,7 +121558,6 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x400>>10)) != 0 { _sqlite3IdListDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 72))) } - _ = libc.Int32FromInt32(0) *(*TSrcItem)(unsafe.Pointer(pItem)) = *(*TSrcItem)(unsafe.Pointer(pSubSrc + 8 + uintptr(i)*104)) p9 = pItem + 60 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) | int32(ltorj)) @@ -124833,6 +121565,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -124871,9 +121604,9 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy = uintptr(0) } @@ -124901,7 +121634,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA /* The flattened query is a compound if either the inner or the ** outer query is a compound. */ *(*Tu32)(unsafe.Pointer(pParent + 4)) |= (*TSelect)(unsafe.Pointer(pSub)).FselFlags & uint32(SF_Compound) - _ = libc.Int32FromInt32(0) /* restriction (17b) */ + /* restriction (17b) */ /* ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; ** @@ -124922,10 +121655,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -124981,8 +121716,6 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr var i int32 var pE2 uintptr _, _ = i, pE2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pColumn)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != uint32(0) { return } @@ -125000,12 +121733,12 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr break } pE2 = *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(i*int32(2))*8)) - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pE2)).FiTable == (*TExpr)(unsafe.Pointer(pColumn)).FiTable && int32((*TExpr)(unsafe.Pointer(pE2)).FiColumn) == int32((*TExpr)(unsafe.Pointer(pColumn)).FiColumn) { return /* Already present. Return without doing anything. */ } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125048,8 +121781,6 @@ func _findConstInWhere(tls *libc.TLS, pConst uintptr, pExpr uintptr) { } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && _sqlite3ExprIsConstant(tls, pLeft) != 0 { _constInsert(tls, pConst, pRight, pLeft, pExpr) } @@ -125104,7 +121835,6 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp (*TWhereConst)(unsafe.Pointer(pConst)).FnChng++ *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Leaf)) *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FixedCol)) - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(i*int32(2)+int32(1))*8)), 0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb)).FmallocFailed != 0 { return int32(WRC_Prune) @@ -125112,6 +121842,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125139,10 +121870,6 @@ func _propagateConstantExprRewrite(tls *libc.TLS, pWalker uintptr, pExpr uintptr var pConst uintptr _ = pConst pConst = *(*uintptr)(unsafe.Pointer(pWalker + 40)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob != 0 { if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) >= int32(TK_EQ) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) <= int32(TK_GE) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { _propagateConstantExprRewriteOne(tls, pConst, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, 0) @@ -125271,9 +121998,6 @@ func _propagateConstants(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { // ** * that the window frame has a PARTITION BY clause. // */ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3ExprIsConstantOrGroupBy(tls, pParse, pExpr, (*TWindow)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSubq)).FpWin)).FpPartition) } @@ -125367,6 +122091,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125397,7 +122125,6 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui break } op = (*TSelect)(unsafe.Pointer(pSel)).Fop - _ = libc.Int32FromInt32(0) if int32(op) != int32(TK_ALL) && int32(op) != int32(TK_SELECT) { notUnionAll = int32(1) } @@ -125406,6 +122133,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -125418,7 +122146,6 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui break } pList = (*TSelect)(unsafe.Pointer(pSel)).FpEList - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { @@ -125430,10 +122157,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -125496,15 +122225,11 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) var v5 uint64 _, _, _, _, _, _, _, _, _, _, _, _, _ = colUsed, iCol, j, m, nChng, nCol, pList, pSub, pTab, pX, pY, v3, v5 /* Column number */ nChng = 0 /* Columns that may not be NULLed out */ - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x8>>3)) != 0 || int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x100>>8)) != 0 { return 0 } - _ = libc.Int32FromInt32(0) pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab - _ = libc.Int32FromInt32(0) pSub = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect - _ = libc.Int32FromInt32(0) pX = pSub for { if !(pX != 0) { @@ -125525,6 +122250,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -125547,6 +122273,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -125580,10 +122307,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -125614,23 +122343,18 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r _, _, _, _, _, _ = eRet, pEList, pOrderBy, sortFlags, zFunc, v1 eRet = WHERE_ORDERBY_NORMAL sortFlags = uint8(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pEList = *(*uintptr)(unsafe.Pointer(pFunc + 32)) if pEList == uintptr(0) || (*TExprList)(unsafe.Pointer(pEList)).FnExpr != int32(1) || (*TExpr)(unsafe.Pointer(pFunc)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) || (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_MinMaxOpt)) != uint32(0) { return uint8(eRet) } - _ = libc.Int32FromInt32(0) zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15516) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15554) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15520) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15558) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -125640,7 +122364,6 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r v1 = _sqlite3ExprListDup(tls, db, pEList, 0) pOrderBy = v1 *(*uintptr)(unsafe.Pointer(ppMinMax)) = v1 - _ = libc.Int32FromInt32(0) if pOrderBy != 0 { (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).Ffg.FsortFlags = sortFlags } @@ -125669,18 +122392,14 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r func _isSimpleCount(tls *libc.TLS, p uintptr, pAggInfo uintptr) (r uintptr) { var pExpr, pTab uintptr _, _ = pExpr, pTab - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 || (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr != int32(1) || (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc != int32(1) || (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect != 0 || (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc != int32(1) || (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { return uintptr(0) } pTab = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { return uintptr(0) } pExpr = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return uintptr(0) } @@ -125690,7 +122409,6 @@ func _isSimpleCount(tls *libc.TLS, p uintptr, pAggInfo uintptr) (r uintptr) { if (*TFuncDef)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_COUNT) == uint32(0) { return uintptr(0) } - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)|libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { return uintptr(0) } @@ -125713,8 +122431,6 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in _, _, _ = pIdx, pTab, zIndexedBy pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab zIndexedBy = *(*uintptr)(unsafe.Pointer(pFrom + 88)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex for { if !(pIdx != 0 && _sqlite3StrICmp(tls, (*TIndex)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0) { @@ -125722,14 +122438,14 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19545, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19583, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pFrom + 96)) = pIdx return SQLITE_OK } @@ -125777,6 +122493,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -125801,6 +122518,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -125831,9 +122549,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) (*TSelect)(unsafe.Pointer(p)).FpWith = uintptr(0) (*TSelect)(unsafe.Pointer(p)).FpWinDefn = uintptr(0) *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Compound)) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Converted) - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pNew)).FpPrior)).FpNext = pNew (*TSelect)(unsafe.Pointer(pNew)).FpLimit = uintptr(0) return WRC_Continue @@ -125850,7 +122566,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19563, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19601, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -125873,8 +122589,6 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) var p, zName uintptr _, _, _ = i, p, zName zName = (*TSrcItem)(unsafe.Pointer(pItem)).FzName - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p = pWith for { if !(p != 0) { @@ -125891,6 +122605,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -125898,6 +122613,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -125931,7 +122647,6 @@ func _sqlite3WithPush(tls *libc.TLS, pParse uintptr, pWith uintptr, bFree Tu8) ( } } if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { - _ = libc.Int32FromInt32(0) (*TWith)(unsafe.Pointer(pWith)).FpOuter = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = pWith } @@ -125962,7 +122677,6 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom var db, pCte, pCteUse, pEList, pItem, pLeft, pRecTerm, pSavedWith, pSel, pSrc, pTab, v1, v2, v5 uintptr var _ /* pWith at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bMayRecursive, db, i, iRecTab, pCte, pCteUse, pEList, pItem, pLeft, pRecTerm, pSavedWith, pSel, pSrc, pTab, rc, v1, v2, v4, v5 /* The matching WITH */ - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FpWith == uintptr(0) { /* There are no WITH clauses in the stack. No match is possible */ return 0 @@ -126000,7 +122714,6 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom if _cannotBeFunction(tls, pParse, pFrom) != 0 { return int32(2) } - _ = libc.Int32FromInt32(0) pTab = _sqlite3DbMallocZero(tls, db, uint64(104)) if pTab == uintptr(0) { return int32(2) @@ -126021,16 +122734,14 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, db, (*TCte)(unsafe.Pointer(pCte)).FzName) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*TCte)(unsafe.Pointer(pCte)).FpSelect, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(2) } *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19586, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19624, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126043,7 +122754,6 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom bMayRecursive = libc.BoolInt32(int32((*TSelect)(unsafe.Pointer(pSel)).Fop) == int32(TK_ALL) || int32((*TSelect)(unsafe.Pointer(pSel)).Fop) == int32(TK_UNION)) for bMayRecursive != 0 && int32((*TSelect)(unsafe.Pointer(pRecTerm)).Fop) == int32((*TSelect)(unsafe.Pointer(pSel)).Fop) { pSrc = (*TSelect)(unsafe.Pointer(pRecTerm)).FpSrc - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { @@ -126055,7 +122765,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19606, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19644, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126069,6 +122779,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126076,15 +122787,10 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19649 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19687 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pRecTerm)).FpWith = (*TSelect)(unsafe.Pointer(pSel)).FpWith rc = _sqlite3WalkSelect(tls, pWalker, pRecTerm) (*TSelect)(unsafe.Pointer(pRecTerm)).FpWith = uintptr(0) @@ -126106,12 +122812,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19672, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19710, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126120,9 +122827,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19710 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19748 } else { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19744 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19782 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126150,7 +122857,6 @@ func _sqlite3SelectPopWith(tls *libc.TLS, pWalker uintptr, p uintptr) { if (*TParse)(unsafe.Pointer(pParse)).FpWith != 0 && (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { pWith = (*TSelect)(unsafe.Pointer(_findRightmost(tls, p))).FpWith if pWith != uintptr(0) { - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpWith = (*TWith)(unsafe.Pointer(pWith)).FpOuter } } @@ -126172,7 +122878,6 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int var v2 int32 _, _, _, _ = pSel, pTab, v1, v2 pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect - _ = libc.Int32FromInt32(0) v1 = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(104)) pTab = v1 (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = v1 @@ -126183,15 +122888,15 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19782, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19820, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) - _ = libc.Int32FromInt32(0) /* The usual case - do not allow ROWID on a subquery */ *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { @@ -126274,7 +122979,6 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } - _ = libc.Int32FromInt32(0) if int32(selFlags)&int32(SF_Expanded) != 0 { return int32(WRC_Prune) } @@ -126311,16 +123015,12 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if !(i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { break } - _ = libc.Int32FromInt32(0) if (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab != 0 { goto _3 } - _ = libc.Int32FromInt32(0) if (*TSrcItem)(unsafe.Pointer(pFrom)).FzName == uintptr(0) { pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect /* A sub-query in the FROM clause of a SELECT */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3WalkSelect(tls, pWalker, pSel) != 0 { return int32(WRC_Abort) } @@ -126335,10 +123035,8 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab - _ = libc.Int32FromInt32(0) } else { /* An ordinary table or view name in the FROM clause */ - _ = libc.Int32FromInt32(0) v5 = _sqlite3LocateTableItem(tls, pParse, uint32(0), pFrom) pTab = v5 (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = v5 @@ -126346,7 +123044,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19786, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19824, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126359,10 +123057,9 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { return int32(WRC_Abort) } - _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19825, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19863, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126377,10 +123074,9 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15113, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } - _ = libc.Int32FromInt32(0) nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol (*TTable)(unsafe.Pointer(pTab)).FnCol = int16(-int32(1)) (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(1) /* Turn on Select.selId renumbering */ @@ -126396,12 +123092,12 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } /* Process NATURAL keywords, and ON and USING clauses of joins. */ - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 || _sqlite3ProcessJoin(tls, pParse, p) != 0 { return int32(WRC_Abort) } @@ -126425,14 +123121,13 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_ASTERISK) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_DOT) && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpRight)).Fop) == int32(TK_ASTERISK) { break } elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -126453,7 +123148,6 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pE = (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FpExpr elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags pRight = (*TExpr)(unsafe.Pointer(pE)).FpRight - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pE)).Fop) != int32(TK_ASTERISK) && (int32((*TExpr)(unsafe.Pointer(pE)).Fop) != int32(TK_DOT) || int32((*TExpr)(unsafe.Pointer(pRight)).Fop) != int32(TK_ASTERISK)) { /* This particular expression does not need to be expanded. */ @@ -126470,14 +123164,9 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { tableSeen = 0 /* Set to 1 when TABLE matches */ zTName = uintptr(0) if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_DOT) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) zTName = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpLeft + 8)) - _ = libc.Int32FromInt32(0) iErrOfst = *(*int32)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpRight + 52)) } else { - _ = libc.Int32FromInt32(0) iErrOfst = *(*int32)(unsafe.Pointer(pE + 52)) } i = 0 @@ -126496,13 +123185,8 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { break } - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2000>>13)) != 0 { - _ = libc.Int32FromInt32(0) pNestedFrom = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect)).FpEList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } else { if zTName != 0 && _sqlite3StrICmp(tls, zTName, zTabName) != 0 { goto _8 @@ -126512,7 +123196,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6565 + v10 = __ccgo_ts + 6594 } zSchemaName = v10 } @@ -126529,19 +123213,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - _ = libc.Int32FromInt32(0) - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19856, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19894, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -126573,7 +123260,6 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { goto _12 } } - _ = libc.Int32FromInt32(0) tableSeen = int32(1) if i > 0 && zTName == uintptr(0) && int32(selFlags)&int32(SF_NestedFrom) == 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x400>>10)) != 0 && _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pFrom + 72)), zName) >= 0 { @@ -126602,12 +123288,11 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break /* OOM */ } pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 - _ = libc.Int32FromInt32(0) if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19861, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19899, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -126620,7 +123305,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12385, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -126629,23 +123314,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19908, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19888, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19926, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -126653,7 +123341,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19908, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19946, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -126719,7 +123407,6 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_HasTypeInfo) pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse - _ = libc.Int32FromInt32(0) pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc i = 0 pFrom = pTabList + 8 @@ -126728,7 +123415,6 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { break } pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Ephemeral) != uint32(0) { /* A sub-query in the FROM clause of a SELECT */ pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect @@ -126738,6 +123424,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -126778,8 +123465,6 @@ func _sqlite3SelectAddTypeInfo(tls *libc.TLS, pParse uintptr, pSelect uintptr) { // ** This routine acts recursively on all subqueries within the SELECT. // */ func _sqlite3SelectPrep(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { return } @@ -126820,8 +123505,6 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { var i int32 var pExpr uintptr _, _ = i, pExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pNC + 40)) |= int32(NC_InAggFunc) i = 0 for { @@ -126829,20 +123512,16 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { break } pExpr = (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3ExprAnalyzeAggList(tls, pNC, *(*uintptr)(unsafe.Pointer(pExpr + 32))) if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3ExprAnalyzeAggList(tls, pNC, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) } - _ = libc.Int32FromInt32(0) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpFilter) } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -126860,9 +123539,6 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect uintptr, pAggInfo uintptr, pNC uintptr) { var j, k, mx int32 _, _, _ = j, k, mx - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator if int32((*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn) > 0 { mx = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpGroupBy)).FnExpr - int32(1) @@ -126877,6 +123553,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -126911,7 +123588,6 @@ func _aggregateIdxEprRefToColCallback(tls *libc.TLS, pWalker uintptr, pExpr uint if int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn { return WRC_Continue } - _ = libc.Int32FromInt32(0) pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiAgg)*24 (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TAggInfo_col)(unsafe.Pointer(pCol)).FiTable @@ -126943,6 +123619,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -126967,8 +123644,6 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { // ** // */ func _assignAggregateRegisters(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc } @@ -126991,9 +123666,6 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _, _, _, _, _, _, _, _, _ = i, nExtra, nReg, pE, pFunc, pKeyInfo, pKeyInfo1, pOBList, v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe nReg = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nReg == 0 { return } @@ -127009,29 +123681,23 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19939, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19977, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19990, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20028, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { nExtra = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr)).FpLeft + 32)) if !((*TAggInfo_func)(unsafe.Pointer(pFunc)).FbOBUnique != 0) { nExtra++ /* One extra column for the OP_Sequence */ } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FbOBPayload != 0 { /* extra columns for the function arguments */ - _ = libc.Int32FromInt32(0) nExtra += (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr + 32)))).FnExpr } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FbUseSubtype != 0 { @@ -127042,10 +123708,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20023, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20061, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -127068,18 +123735,13 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { break } - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32)) if (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab >= 0 { /* Loop counter */ - _ = libc.Int32FromInt32(0) nArg = (*TExprList)(unsafe.Pointer(pList)).FnExpr regAgg = _sqlite3GetTempRange(tls, pParse, nArg) if int32((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload) == 0 { nKey = 0 } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nKey = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).FpLeft + 32)))).FnExpr if !((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique != 0) { nKey++ @@ -127094,6 +123756,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127108,11 +123771,11 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_AggStep), 0, regAgg, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+i) _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(nArg))) @@ -127120,7 +123783,6 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, iTop) _sqlite3ReleaseTempRange(tls, pParse, regAgg, nArg) } - _ = libc.Int32FromInt32(0) if pList != 0 { v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { @@ -127130,6 +123792,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -127160,7 +123823,6 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe regHit = 0 addrHitTest = 0 - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return } @@ -127174,9 +123836,6 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui addrNext = 0 regAggSz = 0 regDistinct = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32)) if (*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { pFilter = (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 64)))).FpFilter @@ -127203,15 +123862,8 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprIfFalse(tls, pParse, pFilter, addrNext, int32(SQLITE_JUMPIFNULL)) } if (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab >= 0 { /* The ORDER BY clause */ - _ = libc.Int32FromInt32(0) nArg = (*TExprList)(unsafe.Pointer(pList)).FnExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).FpLeft + 32)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) regAggSz = (*TExprList)(unsafe.Pointer(pOBList)).FnExpr if !((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique != 0) { regAggSz++ /* One register for OP_Sequence */ @@ -127251,6 +123903,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127281,7 +123934,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui /* Invoke the AggStep function */ if (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { pColl = uintptr(0) - _ = libc.Int32FromInt32(0) /* pList!=0 if pF->pFunc has NEEDCOLL */ + /* pList!=0 if pF->pFunc has NEEDCOLL */ j = 0 pItem = pList + 8 for { @@ -127291,6 +123944,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -127305,7 +123959,6 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } _sqlite3VdbeAddOp4(tls, v, int32(OP_CollSeq), regHit, 0, 0, pColl, -int32(2)) } - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_AggStep), 0, regAgg, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+i) _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(nArg))) @@ -127316,6 +123969,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -127331,10 +123985,10 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator) { break } - _ = libc.Int32FromInt32(0) _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -127359,16 +124013,16 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20056 + v1 = __ccgo_ts + 20094 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } if bCover != 0 { v2 = (*TIndex)(unsafe.Pointer(pIdx)).FzName } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20079, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20117, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127400,7 +124054,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8134) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -127458,7 +124112,6 @@ func _isSelfJoinView(tls *libc.TLS, pTabList uintptr, pThis uintptr, iFirst int3 var pItem, pS1 uintptr var v1 int32 _, _, _ = pItem, pS1, v1 - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pThis)).FpSelect)).FselFlags&uint32(SF_PushDown) != 0 { return uintptr(0) } @@ -127475,8 +124128,6 @@ func _isSelfJoinView(tls *libc.TLS, pTabList uintptr, pThis uintptr, iFirst int3 if (*TSrcItem)(unsafe.Pointer(pItem)).FzName == uintptr(0) { continue } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FpSchema != (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pThis)).FpTab)).FpSchema { continue } @@ -127559,11 +124210,9 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ - _ = libc.Int32FromInt32(0) - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15810) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15848) != 0 { return 0 } /* Is count() */ - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { return 0 } /* Must be count(*) */ @@ -127596,7 +124245,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_Aggregate) != 0 { return 0 } /* Not an aggregate */ - _ = libc.Int32FromInt32(0) /* Due to the previous */ + /* Due to the previous */ pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior /* Repeat over compound */ } /* If we reach this point then it is OK to perform the transformation */ @@ -127664,6 +124313,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -127786,21 +124436,14 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r rc = int32(1) /* The database connection */ *(*uintptr)(unsafe.Pointer(bp + 64)) = uintptr(0) /* Flag for min/max queries */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) v = _sqlite3GetVdbe(tls, pParse) if p == uintptr(0) || (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return int32(1) } - _ = libc.Int32FromInt32(0) if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_SELECT), uintptr(0), uintptr(0), uintptr(0)) != 0 { return int32(1) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) <= int32(SRT_DistQueue) { - _ = libc.Int32FromInt32(0) /* All of these destinations are also able to ignore the ORDER BY clause */ if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), (*TSelect)(unsafe.Pointer(p)).FpOrderBy) @@ -127813,8 +124456,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto select_end } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the SF_UFSrcCheck flag is set, then this function is being called ** as part of populating the temp table for an UPDATE...FROM statement. ** In this case, it is an error if the target object (pSrc->a[0]) name @@ -127832,7 +124473,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20091, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20129, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -127845,7 +124486,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3GenerateColumnNames(tls, pParse, p) } if _sqlite3WindowRewrite(tls, pParse, p) != 0 { - _ = libc.Int32FromInt32(0) goto select_end } pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc @@ -127866,7 +124506,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* The expander should have already created transient Table objects ** even for FROM clause elements such as subqueries that do not correspond ** to a real table */ - _ = libc.Int32FromInt32(0) /* Try to simplify joins: ** ** LEFT JOIN -> JOIN @@ -127908,6 +124547,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -127922,6 +124562,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -127933,7 +124574,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20145, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20183, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -127953,7 +124594,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_Aggregate) != uint32(0) { goto _2 } - _ = libc.Int32FromInt32(0) /* If a FROM-clause subquery has an ORDER BY clause that is not ** really doing anything, then delete it now so that it does not ** interfere with query flattening. See the discussion at @@ -128017,6 +124657,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128070,7 +124711,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** string for the fake column name seems safer. */ if (*TSrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0) && (*TSrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0) { - _sqlite3AuthCheck(tls, pParse, int32(SQLITE_READ), (*TSrcItem)(unsafe.Pointer(pItem1)).FzName, __ccgo_ts+1648, (*TSrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + _sqlite3AuthCheck(tls, pParse, int32(SQLITE_READ), (*TSrcItem)(unsafe.Pointer(pItem1)).FzName, __ccgo_ts+1652, (*TSrcItem)(unsafe.Pointer(pItem1)).FzDatabase) } /* Generate code for all sub-queries in the FROM clause */ @@ -128079,7 +124720,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r goto _10 } /* The code for a subquery should only be generated once. */ - _ = libc.Int32FromInt32(0) /* Increment Parse.nHeight by the height of the largest expression ** tree referred to by this, the parent select. The child select ** may contain expression trees of at most @@ -128092,7 +124732,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** inside the subquery. This can help the subquery to run more efficiently. */ if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_PushDown)) == uint32(0) && (int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x100>>8)) == 0 || int32((*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 96)))).FeM10d) != M10d_Yes && (*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 96)))).FnUse < int32(2)) && _pushDownWhereTerms(tls, pParse, pSub1, (*TSelect)(unsafe.Pointer(p)).FpWhere, pTabList, i) != 0 { - _ = libc.Int32FromInt32(0) } else { } /* Convert unused result columns of the subquery into simple NULL @@ -128116,7 +124755,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20185, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20223, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128164,7 +124803,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20200, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20238, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128190,6 +124829,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128223,7 +124863,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Notice that even thought SF_Distinct has been cleared from p->selFlags, ** the sDistinct.isTnct is still set. Hence, isTnct represents the ** original setting of the SF_Distinct flag, not the current setting */ - _ = libc.Int32FromInt32(0) (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct = uint8(2) } /* If there is an ORDER BY clause, then create an ephemeral index to @@ -128259,6 +124898,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128271,6 +124911,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128314,7 +124955,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r if pWin != 0 { _sqlite3WindowCodeInit(tls, pParse, p) } - _ = libc.Int32FromInt32(0) /* Begin the database scan. */ pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, (*TSelect)(unsafe.Pointer(p)).FpEList, p, wctrlFlags, int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow)) if pWInfo == uintptr(0) { @@ -128340,7 +124980,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex >= 0 && (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy == uintptr(0) { _sqlite3VdbeChangeToNoop(tls, v, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex) } - _ = libc.Int32FromInt32(0) if pWin != 0 { addrGosub = _sqlite3VdbeMakeLabel(tls, pParse) iCont = _sqlite3VdbeMakeLabel(tls, pParse) @@ -128384,6 +125023,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -128399,10 +125039,10 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } - _ = libc.Int32FromInt32(0) if int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32(66) { (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(66) } @@ -128429,6 +125069,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -128436,7 +125077,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } } } else { - _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(p)).FnSelectRow = 0 } /* Create a label to jump to when we want to abort the query */ @@ -128468,9 +125108,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3ExprAnalyzeAggList(tls, bp+112, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy) if pHaving != 0 { if pGroupBy != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _havingToWhere(tls, pParse, p) pWhere = (*TSelect)(unsafe.Pointer(p)).FpWhere } @@ -128576,11 +125213,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20216 + v44 = __ccgo_ts + 20254 } else { - v44 = __ccgo_ts + 20225 + v44 = __ccgo_ts + 20263 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -128596,6 +125233,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -128614,6 +125252,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -128675,6 +125314,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -128792,6 +125432,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -128805,7 +125446,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeChangeP4(tls, v, -int32(1), pKeyInfo2, -int32(8)) } _assignAggregateRegisters(tls, pParse, pAggInfo) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iCsr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+libc.Int32FromInt32(0)) _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iCsr) _explainSimpleCount(tls, pParse, pTab1, pBest) @@ -128836,6 +125476,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -128847,7 +125488,6 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } } else { if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == int32(1) && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FiDistinct >= 0 { - _ = libc.Int32FromInt32(0) pDistinct1 = *(*uintptr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr + 32)) if pDistinct1 != 0 { v58 = libc.Int32FromInt32(WHERE_WANT_DISTINCT) | libc.Int32FromInt32(WHERE_AGG_DISTINCT) @@ -128862,15 +125502,12 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** processing is much simpler since there is only a single row ** of output. */ - _ = libc.Int32FromInt32(0) _resetAccumulator(tls, pParse, pAggInfo) /* If this query is a candidate for the min/max optimization, then ** minMaxFlag will have been previously set to either ** WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX and pMinMaxOrderBy will ** be an appropriate ORDER BY expression for the optimization. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, *(*uintptr)(unsafe.Pointer(bp + 64)), pDistinct1, p, uint16(int32(minMaxFlag)|int32(distFlag1)), 0) if pWInfo == uintptr(0) { goto select_end @@ -128899,13 +125536,12 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20216) + _explainTempTable(tls, pParse, __ccgo_ts+20254) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. */ if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy != 0 { - _ = libc.Int32FromInt32(0) _generateSortTail(tls, pParse, p, bp+16, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) } /* Jump here to skip this query @@ -128918,8 +125554,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) _sqlite3VdbeExplainPop(tls, pParse) return rc @@ -129006,7 +125641,7 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr if !(i < nCol) { break } - z = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if z == uintptr(0) { goto malloc_failed } @@ -129016,12 +125651,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20234, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20272, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129050,12 +125686,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129102,14 +125740,13 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp } *(*uintptr)(unsafe.Pointer((*(*TTabResult)(unsafe.Pointer(bp))).FazResult)) = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3_get_table_cb), bp, pzErrMsg) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*(*TTabResult)(unsafe.Pointer(bp))).FazResult)) = uintptr(int64((*(*TTabResult)(unsafe.Pointer(bp))).FnData)) if rc&int32(0xff) == int32(SQLITE_ABORT) { Xsqlite3_free_table(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FazResult+1*8) if (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+48, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+48, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg)) } Xsqlite3_free(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg) } @@ -129150,7 +125787,6 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { _, _ = i, n if azResult != 0 { azResult -= 8 - _ = libc.Int32FromInt32(0) n = int32(int64(*(*uintptr)(unsafe.Pointer(azResult)))) i = int32(1) for { @@ -129162,6 +125798,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129225,7 +125862,6 @@ func _sqlite3DeleteTriggerStep(tls *libc.TLS, db uintptr, pTriggerStep uintptr) func _sqlite3TriggerList(tls *libc.TLS, pParse uintptr, pTab uintptr) (r uintptr) { var p, pList, pTmpSchema, pTrig uintptr _, _, _, _ = p, pList, pTmpSchema, pTrig /* Loop variable for TEMP triggers */ - _ = libc.Int32FromInt32(0) pTmpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + 1*32))).FpSchema p = (*THash)(unsafe.Pointer(pTmpSchema + 56)).Ffirst pList = (*TTable)(unsafe.Pointer(pTab)).FpTrigger @@ -129236,9 +125872,6 @@ func _sqlite3TriggerList(tls *libc.TLS, pParse uintptr, pTab uintptr) (r uintptr pList = pTrig } else { if int32((*TTrigger)(unsafe.Pointer(pTrig)).Fop) == int32(TK_RETURNING) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TTrigger)(unsafe.Pointer(pTrig)).Ftable = (*TTable)(unsafe.Pointer(pTab)).FzName (*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema (*TTrigger)(unsafe.Pointer(pTrig)).FpNext = pList @@ -129271,14 +125904,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 pTrigger = uintptr(0) /* Table that the trigger fires off of */ zName = uintptr(0) /* Name of the trigger */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* State vector for the DB fixer */ - _ = libc.Int32FromInt32(0) /* pName1->z might be NULL, but not pName1 itself */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + /* pName1->z might be NULL, but not pName1 itself */ if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20337, 0) goto trigger_cleanup } iDb = int32(1) @@ -129318,8 +125948,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto trigger_cleanup } - _ = libc.Int32FromInt32(0) - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20345, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20383, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -129329,38 +125958,35 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20353, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20391, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20394, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20432, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ zName = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) if zName == uintptr(0) { - _ = libc.Int32FromInt32(0) goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20345, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20383, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } - _ = libc.Int32FromInt32(0) if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20434, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20472, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { - _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) } goto trigger_cleanup } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20460, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6529, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20498, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129368,15 +125994,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20498 + v1 = __ccgo_ts + 20536 } else { - v1 = __ccgo_ts + 20505 + v1 = __ccgo_ts + 20543 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20511, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20549, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20548, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20586, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129396,9 +126022,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6537 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6070 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129438,9 +126064,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } (*TTrigger)(unsafe.Pointer(pTrigger)).FpColumns = pColumns pColumns = uintptr(0) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129448,10 +126074,10 @@ trigger_cleanup: if !((*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0) { _sqlite3DeleteTrigger(tls, db, pTrigger) } else { - _ = libc.Int32FromInt32(0) } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129496,12 +126122,11 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20345, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20383, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrig pTrig = uintptr(0) } else { @@ -129519,11 +126144,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20594, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20632, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129534,32 +126160,29 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20642, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20680, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20717, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20755, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { pLink = pTrig pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pTrig = _sqlite3HashInsert(tls, pHash, zName, pTrig) if pTrig != 0 { _sqlite3OomFault(tls, db) } else { if (*TTrigger)(unsafe.Pointer(pLink)).FpSchema == (*TTrigger)(unsafe.Pointer(pLink)).FpTabSchema { pTab = _sqlite3HashFind(tls, (*TTrigger)(unsafe.Pointer(pLink)).FpTabSchema+8, (*TTrigger)(unsafe.Pointer(pLink)).Ftable) - _ = libc.Int32FromInt32(0) (*TTrigger)(unsafe.Pointer(pLink)).FpNext = (*TTable)(unsafe.Pointer(pTab)).FpTrigger (*TTable)(unsafe.Pointer(pTab)).FpTrigger = pLink } } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) - _ = libc.Int32FromInt32(0) _sqlite3DeleteTriggerStep(tls, db, pStepList) } @@ -129585,6 +126208,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -129658,7 +126282,6 @@ func _sqlite3TriggerInsertStep(tls *libc.TLS, pParse uintptr, pTableName uintptr var db, pTriggerStep uintptr _, _ = db, pTriggerStep db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) pTriggerStep = _triggerStepAllocate(tls, pParse, uint8(TK_INSERT), pTableName, zStart, zEnd) if pTriggerStep != 0 { if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -129780,10 +126403,8 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { goto drop_trigger_cleanup } - _ = libc.Int32FromInt32(0) zDb = (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase zName = (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName - _ = libc.Int32FromInt32(0) i = OMIT_TEMPDB for { if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -129798,18 +126419,18 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int if zDb != 0 && _sqlite3DbIsNamed(tls, db, j, zDb) == 0 { goto _1 } - _ = libc.Int32FromInt32(0) pTrigger = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32))).FpSchema+56, zName) if pTrigger != 0 { break } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20746, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20784, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -129818,6 +126439,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -129844,16 +126466,14 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { _, _, _, _, _, _, _, _, _ = code, db, iDb, pTable, v, zDb, zTab, v1, v2 db = (*TParse)(unsafe.Pointer(pParse)).Fdb iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTrigger)(unsafe.Pointer(pTrigger)).FpSchema) - _ = libc.Int32FromInt32(0) pTable = _tableOfTrigger(tls, pTrigger) - _ = libc.Int32FromInt32(0) if pTable != 0 { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6537 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6070 } zTab = v1 if iDb == int32(1) { @@ -129868,7 +126488,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20766, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20804, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -129882,7 +126502,6 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) { var pHash, pTab, pTrigger, pp uintptr _, _, _, _ = pHash, pTab, pTrigger, pp - _ = libc.Int32FromInt32(0) pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 56 pTrigger = _sqlite3HashInsert(tls, pHash, zName, uintptr(0)) if pTrigger != 0 { @@ -129900,6 +126519,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -129936,6 +126556,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -129973,7 +126594,6 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, mask = 0 pList = uintptr(0) pList = _sqlite3TriggerList(tls, pParse, pTab) - _ = libc.Int32FromInt32(0) if pList != uintptr(0) { p = pList if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_EnableTrigger) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpTrigger != uintptr(0) { @@ -129997,16 +126617,15 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_RETURNING) { /* The first time a RETURNING trigger is seen, the "op" value tells ** us what time of trigger it should be. */ - _ = libc.Int32FromInt32(0) (*TTrigger)(unsafe.Pointer(p)).Fop = uint8(op) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20828 + v1 = __ccgo_ts + 20866 } else { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20873 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20842, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20880, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -130024,6 +126643,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130036,7 +126656,6 @@ exit_triggers_exist: } func _sqlite3TriggersExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) (r uintptr) { - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FpTrigger == uintptr(0) && !(_tempTriggersExist(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0) || (*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0 { if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = 0 @@ -130067,8 +126686,6 @@ func _sqlite3TriggerStepSrc(tls *libc.TLS, pParse uintptr, pStep uintptr) (r uin db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* SrcList to be returned */ zName = _sqlite3DbStrDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pSrc != 0 { pSchema = (*TTrigger)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpTrig)).FpSchema (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzName = zName @@ -130099,19 +126716,16 @@ func _sqlite3TriggerStepSrc(tls *libc.TLS, pParse uintptr, pStep uintptr) (r uin // ** form "table.*". // */ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pTerm)).Fop) == int32(TK_ASTERISK) { return int32(1) } if int32((*TExpr)(unsafe.Pointer(pTerm)).Fop) != int32(TK_DOT) { return 0 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20928, 0) return int32(1) } @@ -130156,6 +126770,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130169,6 +126784,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130192,13 +126808,11 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab _, _, _, _, _, _, _, _, _, _ = db, i, nCol, pCol, pNew, pReturning, reg, v, v1, v2 v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if !((*TParse)(unsafe.Pointer(pParse)).FbReturning != 0) { /* This RETURNING trigger must be for a different statement as ** this statement lacks a RETURNING clause. */ return } - _ = libc.Int32FromInt32(0) pReturning = *(*uintptr)(unsafe.Pointer(pParse + 208)) if pTrigger != pReturning+16 { /* This RETURNING trigger is for a different statement */ @@ -130213,7 +126827,6 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab (*(*TSrcItem)(unsafe.Pointer(bp + 128 + 8))).FiCursor = -int32(1) _sqlite3SelectPrep(tls, pParse, bp, uintptr(0)) if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { - _ = libc.Int32FromInt32(0) _sqlite3GenerateColumnNames(tls, pParse, bp) } _sqlite3ExprListDelete(tls, db, (*(*TSelect)(unsafe.Pointer(bp))).FpEList) @@ -130243,13 +126856,14 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab break } pCol = (*(*TExprList_item)(unsafe.Pointer(pNew + 8 + uintptr(i)*32))).FpExpr - _ = libc.Int32FromInt32(0) /* Due to !db->mallocFailed ~9 lines above */ + /* Due to !db->mallocFailed ~9 lines above */ _sqlite3ExprCodeFactorable(tls, pParse, pCol, reg+i) if int32(_sqlite3ExprAffinity(tls, pCol)) == int32(SQLITE_AFF_REAL) { _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), reg+i) } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130277,9 +126891,6 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon _, _, _, _, _ = db, pSelect, pStep, v, v2 v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pStep = pStepList for { if !(pStep != 0) { @@ -130304,9 +126915,8 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon v2 = int32(uint8(orconf)) } (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) - _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6267, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130319,7 +126929,6 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon _sqlite3DeleteFrom(tls, pParse, _sqlite3TriggerStepSrc(tls, pParse, pStep), _sqlite3ExprDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere, 0), uintptr(0), uintptr(0)) _sqlite3VdbeAddOp0(tls, v, int32(OP_ResetCount)) default: - _ = libc.Int32FromInt32(0) pSelect = _sqlite3SelectDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0) _sqlite3SelectDestInit(tls, bp, int32(SRT_Discard), 0) _sqlite3Select(tls, pParse, pSelect, bp) @@ -130328,6 +126937,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130341,8 +126951,6 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon // ** from pFrom to pTo. // */ func _transferParseError(tls *libc.TLS, pTo uintptr, pFrom uintptr) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pTo)).FnErr == 0 { (*TParse)(unsafe.Pointer(pTo)).FzErrMsg = (*TParse)(unsafe.Pointer(pFrom)).FzErrMsg (*TParse)(unsafe.Pointer(pTo)).FnErr = (*TParse)(unsafe.Pointer(pFrom)).FnErr @@ -130376,8 +126984,6 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp pWhen = uintptr(0) /* Name context for sub-vdbe */ pProgram = uintptr(0) /* Sub-vdbe for trigger program */ iEndTrigger = 0 /* Parse context for sub-vdbe */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Allocate the TriggerPrg and SubProgram objects. To ensure that they ** are freed if an error occurs, link them into the Parse.pTriggerPrg ** list of the top-level Parse object sooner rather than later. */ @@ -130412,7 +127018,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20932, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20970, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130434,7 +127040,6 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp _sqlite3VdbeAddOp0(tls, v, int32(OP_Halt)) _transferParseError(tls, pParse, bp+56) if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { - _ = libc.Int32FromInt32(0) (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp = _sqlite3VdbeTakeOpArray(tls, v, pProgram+8, pTop+144) } (*TSubProgram)(unsafe.Pointer(pProgram)).FnMem = (*(*TParse)(unsafe.Pointer(bp + 56))).FnMem @@ -130446,7 +127051,6 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp } else { _transferParseError(tls, pParse, bp+56) } - _ = libc.Int32FromInt32(0) _sqlite3ParseObjectReset(tls, bp+56) return pPrg } @@ -130468,7 +127072,6 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt v1 = pParse } pRoot = v1 - _ = libc.Int32FromInt32(0) /* It may be that this trigger has already been coded (or is in the ** process of being coded). If this is the case, then an entry with ** a matching TriggerPrg.pTrigger field will be present somewhere @@ -130480,6 +127083,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130504,7 +127108,6 @@ func _sqlite3CodeRowTriggerDirect(tls *libc.TLS, pParse uintptr, p uintptr, pTab _, _, _, _, _ = bRecursive, pPrg, v, v1, v2 v = _sqlite3GetVdbe(tls, pParse) pPrg = _getRowTrigger(tls, pParse, p, pTab, orconf) - _ = libc.Int32FromInt32(0) /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program ** is a pointer to the sub-vdbe containing the trigger program. */ if pPrg != 0 { @@ -130567,9 +127170,6 @@ func _sqlite3CodeRowTriggerDirect(tls *libc.TLS, pParse uintptr, p uintptr, pTab func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op int32, pChanges uintptr, tr_tm int32, pTab uintptr, reg int32, orconf int32, ignoreJump int32) { var p uintptr _ = p /* Used to iterate through pTrigger list */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p = pTrigger for { if !(p != 0) { @@ -130578,9 +127178,6 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op /* Sanity checking: The schema for the trigger and for the table are ** always defined. The trigger must be in the same schema as the table ** or else it must be a TEMP trigger. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Determine whether we should code this trigger. One of two choices: ** 1. The trigger is an exact match to the current DML statement ** 2. This is a RETURNING trigger for INSERT but we are currently @@ -130597,6 +127194,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -130640,7 +127238,6 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } op = v1 mask = uint32(0) - _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { return uint32(0xffffffff) } @@ -130661,6 +127258,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -130705,14 +127303,10 @@ func _sqlite3ColumnDefault(tls *libc.TLS, v uintptr, pTab uintptr, i int32, iReg var pCol uintptr var _ /* pValue at bp+0 */ uintptr _, _ = enc, pCol - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 if (*TColumn)(unsafe.Pointer(pCol)).FiDflt != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) enc = (*Tsqlite3)(unsafe.Pointer(_sqlite3VdbeDb(tls, v))).Fenc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3ValueFromExpr(tls, _sqlite3VdbeDb(tls, v), _sqlite3ColumnExpr(tls, pTab, pCol), enc, uint8((*TColumn)(unsafe.Pointer(pCol)).Faffinity), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _sqlite3VdbeAppendP4(tls, v, *(*uintptr)(unsafe.Pointer(bp)), -int32(10)) @@ -130740,13 +127334,10 @@ func _indexColumnIsBeingUpdated(tls *libc.TLS, pIdx uintptr, iCol int32, aXRef u var iIdxCol Ti16 _ = iIdxCol iIdxCol = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2)) - _ = libc.Int32FromInt32(0) /* Cannot index rowid */ + /* Cannot index rowid */ if int32(iIdxCol) >= 0 { return libc.BoolInt32(*(*int32)(unsafe.Pointer(aXRef + uintptr(iIdxCol)*4)) >= 0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _sqlite3ExprReferencesUpdatedColumn(tls, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(iCol)*32))).FpExpr, aXRef, chngRowid) } @@ -130847,9 +127438,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p _ = pLimit pSrc = _sqlite3SrcListDup(tls, db, pTabList, 0) pWhere2 = _sqlite3ExprDup(tls, db, pWhere, 0) - _ = libc.Int32FromInt32(0) if pSrc != 0 { - _ = libc.Int32FromInt32(0) (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FiCursor = -int32(1) (*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab)).FnTabRef-- (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab = uintptr(0) @@ -130864,6 +127453,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -130882,6 +127472,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -130895,7 +127486,6 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3PExpr(tls, pParse, int32(TK_ROW), uintptr(0), uintptr(0))) } } - _ = libc.Int32FromInt32(0) if pChanges != 0 { i = 0 for { @@ -130905,6 +127495,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -130976,11 +127567,9 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui regKey = 0 /* composite PRIMARY KEY value */ libc.Xmemset(tls, bp, 0, uint64(16)) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto update_cleanup } - _ = libc.Int32FromInt32(0) /* Locate the table which we want to update. */ pTab = _sqlite3SrcListLookup(tls, pParse, pTabList) @@ -130993,7 +127582,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui */ pTrigger = _sqlite3TriggersExist(tls, pParse, pTab, int32(TK_UPDATE), pChanges, bp+72) isView = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW)) - _ = libc.Int32FromInt32(0) /* If there was a FROM clause, set nChangeFrom to the number of expressions ** in the change-list. Otherwise, set it to 0. There cannot be a FROM ** clause if this function is being called to generate code for part of @@ -131004,7 +127592,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui v1 = 0 } nChangeFrom = v1 - _ = libc.Int32FromInt32(0) if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { goto update_cleanup } @@ -131041,6 +127628,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -131070,6 +127658,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131118,7 +127707,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20946, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20984, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -131128,6 +127717,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131137,13 +127727,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21020, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7880 + v11 = __ccgo_ts + 7909 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -131157,11 +127747,9 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) chngKey = uint8(int32(chngRowid) + int32(chngPk)) /* Mark generated columns as changing if their generator expressions ** reference any changing column. The actual aXRef[] value for @@ -131190,6 +127778,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131245,6 +127834,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131254,6 +127844,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131277,7 +127868,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** reallocated. aRegIdx[nAllIdx] is the register in which the main ** table record is written. regRowSet holds the RowSet for the ** two-pass update algorithm. */ - _ = libc.Int32FromInt32(0) regRowSet = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) v24 = pParse + 56 *(*int32)(unsafe.Pointer(v24))++ @@ -131342,7 +127932,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui iEph = v30 addrOpen = _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenEphemeral), iEph, 0, regRowSet) } else { - _ = libc.Int32FromInt32(0) if pPk != 0 { v32 = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) } else { @@ -131441,7 +128030,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui if iCur >= 0 && iCur != iDataCur && *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(iCur-iBaseCur))) != 0 { eOnePass = ONEPASS_OFF } - _ = libc.Int32FromInt32(0) } } } @@ -131472,10 +128060,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui if !(i < int32(nPk)) { break } - _ = libc.Int32FromInt32(0) _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131518,7 +128106,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui /* Top of the update loop */ if eOnePass != ONEPASS_OFF { if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[0] != iDataCur && (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] != iDataCur { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelBreak, regKey, nKey) } if eOnePass != int32(ONEPASS_SINGLE) { @@ -131546,6 +128133,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131570,9 +128158,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** contain the new value. If the rowid is not being modified, ** then regNewRowid is the same register as regOldRowid, which is ** already populated. */ - _ = libc.Int32FromInt32(0) if chngRowid != 0 { - _ = libc.Int32FromInt32(0) if nChangeFrom == 0 { _sqlite3ExprCode(tls, pParse, pRowidExpr, regNewRowid) } else { @@ -131604,6 +128190,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -131647,7 +128234,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui v46 = int32(nPk) } nOff = v46 - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, nOff+j, k) } else { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(j)*32))).FpExpr, k) @@ -131669,6 +128255,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -131719,6 +128306,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -131729,7 +128317,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } if !(isView != 0) { /* Do constraint checks. */ - _ = libc.Int32FromInt32(0) _sqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, iDataCur, iIdxCur, regNewRowid, regOldRowid, chngKey, uint8(onError), labelContinue, bp+88, aXRef, uintptr(0)) /* If REPLACE conflict handling may have been used, or if the PK of the ** row is changing, then the GenerateConstraintChecks() above may have @@ -131764,7 +128351,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** value is copied from memory cell (regNewRowid+1+iCol), where iCol ** is the column index supplied by the user. */ - _ = libc.Int32FromInt32(0) if hasFK > int32(1) || chngKey != 0 { v48 = 0 } else { @@ -131772,7 +128358,6 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } _sqlite3VdbeAddOp3(tls, v, int32(OP_Delete), iDataCur, int32(OPFLAG_ISUPDATE)|v48, regNewRowid) if eOnePass == int32(ONEPASS_MULTI) { - _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) } if !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { @@ -131830,9 +128415,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21001) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21039) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -131885,7 +128471,6 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp /* Allocate nArg registers in which to gather the arguments for VUpdate. Then ** create and open the ephemeral table in which the records created from ** these arguments will be temporarily stored. */ - _ = libc.Int32FromInt32(0) v2 = pParse + 52 v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2))++ @@ -131903,8 +128488,6 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } } else { /* PRIMARY KEY column */ pPk = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iPk = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn)) if *(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)) >= 0 { pRow = _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)))*32))).FpExpr, 0) @@ -131929,6 +128512,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -131954,7 +128538,6 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { break } - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)))*32))).FpExpr, regArg+int32(2)+i) } else { @@ -131963,6 +128546,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -131974,15 +128558,12 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } } else { /* PRIMARY KEY column */ pPk1 = _sqlite3PrimaryKeyIndex(tls, pTab) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iPk1 = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk1)).FaiColumn)) _sqlite3VdbeAddOp3(tls, v, int32(OP_VColumn), iCsr, int32(iPk1), regArg) _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regArg+int32(2)+int32(iPk1), regArg+int32(1)) } eOnePass = _sqlite3WhereOkOnePass(tls, pWInfo, bp) /* There is no ONEPASS_MULTI on virtual tables */ - _ = libc.Int32FromInt32(0) if eOnePass != 0 { /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded ** above. */ @@ -132014,6 +128595,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132129,7 +128711,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132140,10 +128722,6 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr var _ /* zWhich at bp+200 */ [16]int8 _, _, _, _, _, _, _, _, _, _, _, _, _ = iCursor, ii, jj, nClause, nn, pExpr, pIdx, pTab, pTarget, pTerm, rc, v2, v3 /* Index column converted into an Expr */ nClause = 0 /* Counter of ON CONFLICT clauses */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Resolve all symbolic names in the conflict-target clause, which ** includes both the list of columns and the optional partial-index ** WHERE clause. @@ -132173,7 +128751,6 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } if v3 && int32((*TExpr)(unsafe.Pointer(v2)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pTerm)).FiColumn) == -int32(1) { /* The conflict-target is the rowid of the primary table */ - _ = libc.Int32FromInt32(0) goto _1 } /* Initialize sCol[0..1] to be an expression parse tree for a @@ -132215,9 +128792,6 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } *(*uintptr)(unsafe.Pointer(bp + 56 + 8)) = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(ii)*8)) if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2))) == -int32(2) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(ii)*32))).FpExpr if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLLATE) { (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[0].FpLeft = pExpr @@ -132238,6 +128812,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132246,6 +128821,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132254,22 +128830,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]int8)(unsafe.Pointer(bp + 200)))[0] = 0 } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21014, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21052, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21056, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132290,14 +128876,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132335,8 +128927,6 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe db = (*TParse)(unsafe.Pointer(pParse)).Fdb pTop = pUpsert - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iDataCur = (*TUpsert)(unsafe.Pointer(pUpsert)).FiDataCur pUpsert = _sqlite3UpsertOfIndex(tls, pTop, pIdx) if pIdx != 0 && iCur != iDataCur { @@ -132355,15 +128945,15 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab if !(i < nPk) { break } - _ = libc.Int32FromInt32(0) k = int32(_sqlite3TableColumnToIndex(tls, pIdx, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12445, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12474, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132382,6 +128972,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132439,20 +129030,18 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 break } zSubSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - _ = libc.Int32FromInt32(0) /* The secondary SQL must be one of CREATE TABLE, CREATE INDEX, ** or INSERT. Historically there have been attacks that first ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21091, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21095, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21129, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21133, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break } } } - _ = libc.Int32FromInt32(0) if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -132547,6 +129136,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132572,24 +129162,24 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21099) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21137) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21139) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21177) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21182) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21220) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) *(*uint32)(unsafe.Pointer(db + 76)) &= uint32(^libc.Int32FromInt32(SQLITE_OPEN_READONLY)) *(*uint32)(unsafe.Pointer(db + 76)) |= uint32(libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE)) } else { - zOut = __ccgo_ts + 1648 + zOut = __ccgo_ts + 1652 } /* Save the current value of the database flags so that it can be ** restored before returning. Then set the writable-schema flag, and @@ -132621,21 +129211,19 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21200, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21238, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum } - _ = libc.Int32FromInt32(0) pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(nDb)*32 - _ = libc.Int32FromInt32(0) pTemp = (*TDb)(unsafe.Pointer(pDb)).FpBt if pOut != 0 { id = _sqlite3PagerFile(tls, _sqlite3BtreePager(tls, pTemp)) *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21223) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21261) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -132652,7 +129240,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14854) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14883) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132683,11 +129271,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21250, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21288, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21358, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21396, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132696,8 +129284,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21412, libc.VaList(bp+24, zDbMain)) - _ = libc.Int32FromInt32(0) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21450, libc.VaList(bp+24, zDbMain)) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { goto end_of_vacuum @@ -132707,12 +129294,10 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21563, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21601, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Copy Btree meta values */ i = 0 for { @@ -132728,6 +129313,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -132743,12 +129329,12 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if pOut == uintptr(0) { _sqlite3BtreeSetAutoVacuum(tls, pMain, _sqlite3BtreeGetAutoVacuum(tls, pTemp)) } - _ = libc.Int32FromInt32(0) if pOut == uintptr(0) { nRes = _sqlite3BtreeGetRequestedReserve(tls, pTemp) rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -132942,6 +129528,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -132951,6 +129538,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -132963,13 +129551,11 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) // ** module when the reference count reaches zero. // */ func _sqlite3VtabModuleUnref(tls *libc.TLS, db uintptr, pMod uintptr) { - _ = libc.Int32FromInt32(0) (*TModule)(unsafe.Pointer(pMod)).FnRefModule-- if (*TModule)(unsafe.Pointer(pMod)).FnRefModule == 0 { if (*TModule)(unsafe.Pointer(pMod)).FxDestroy != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TModule)(unsafe.Pointer(pMod)).FxDestroy})))(tls, (*TModule)(unsafe.Pointer(pMod)).FpAux) } - _ = libc.Int32FromInt32(0) _sqlite3DbFree(tls, db, pMod) } } @@ -132998,7 +129584,6 @@ func _sqlite3VtabLock(tls *libc.TLS, pVTab uintptr) { func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { var pVtab uintptr _ = pVtab - _ = libc.Int32FromInt32(0) pVtab = (*(*struct { FnArg int32 FazArg uintptr @@ -133010,6 +129595,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -133025,9 +129611,6 @@ func _sqlite3VtabUnlock(tls *libc.TLS, pVTab uintptr) { var db, p uintptr _, _ = db, p db = (*TVTable)(unsafe.Pointer(pVTab)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TVTable)(unsafe.Pointer(pVTab)).FnRef-- if (*TVTable)(unsafe.Pointer(pVTab)).FnRef == 0 { p = (*TVTable)(unsafe.Pointer(pVTab)).FpVtab @@ -133052,7 +129635,6 @@ func _vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var db2, pNext, pRet, pVTable uintptr _, _, _, _ = db2, pNext, pRet, pVTable pRet = uintptr(0) - _ = libc.Int32FromInt32(0) pVTable = (*(*struct { FnArg int32 FazArg uintptr @@ -133069,11 +129651,9 @@ func _vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { ** this makes it safe to access the sqlite3.pDisconnect list of any ** database connection that may have an entry in the p->u.vtab.p list. */ - _ = libc.Int32FromInt32(0) for pVTable != 0 { db2 = (*TVTable)(unsafe.Pointer(pVTable)).Fdb pNext = (*TVTable)(unsafe.Pointer(pVTable)).FpNext - _ = libc.Int32FromInt32(0) if db2 == db { pRet = pVTable (*(*struct { @@ -133088,7 +129668,6 @@ func _vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { } pVTable = pNext } - _ = libc.Int32FromInt32(0) return pRet } @@ -133105,9 +129684,6 @@ func _vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { var pVTab, ppVTab uintptr _, _ = pVTab, ppVTab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) ppVTab = p + 64 + 16 for { if !(*(*uintptr)(unsafe.Pointer(ppVTab)) != 0) { @@ -133121,6 +129697,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -133151,8 +129728,6 @@ func _sqlite3VtabUnlockList(tls *libc.TLS, db uintptr) { var p, pNext uintptr _, _ = p, pNext p = (*Tsqlite3)(unsafe.Pointer(db)).FpDisconnect - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if p != 0 { (*Tsqlite3)(unsafe.Pointer(db)).FpDisconnect = uintptr(0) for cond := true; cond; cond = p != 0 { @@ -133182,8 +129757,6 @@ func _sqlite3VtabUnlockList(tls *libc.TLS, db uintptr) { func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { var i int32 _ = i - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { _vtabDisconnectAll(tls, uintptr(0), p) } @@ -133210,6 +129783,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133236,7 +129810,6 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint var nBytes Tsqlite3_int64 _, _, _, _, _, _ = azModuleArg, db, i, nBytes, v1, v2 db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) nBytes = int64(uint64(8) * uint64(libc.Int32FromInt32(2)+(*(*struct { FnArg int32 FazArg uintptr @@ -133247,7 +129820,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12704, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133287,14 +129860,11 @@ func _sqlite3VtabBeginParse(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName if pTable == uintptr(0) { return } - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTable)).FeTabType = uint8(TABTYP_VTAB) db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) _addModuleArgument(tls, pParse, pTable, _sqlite3NameFromToken(tls, db, pModuleName)) _addModuleArgument(tls, pParse, pTable, uintptr(0)) _addModuleArgument(tls, pParse, pTable, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTable)).FzName)) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(t__predefined_ptrdiff_t((*TToken)(unsafe.Pointer(pModuleName)).Fz+uintptr((*TToken)(unsafe.Pointer(pModuleName)).Fn)) - int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) /* Creating a virtual table invokes the authorization callback twice. ** The first invocation, to obtain permission to INSERT a row into the @@ -133307,7 +129877,7 @@ func _sqlite3VtabBeginParse(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName Fp uintptr })(unsafe.Pointer(pTable + 64))).FazArg != 0 { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTable)).FpSchema) - _ = libc.Int32FromInt32(0) /* The database the table is being created in */ + /* The database the table is being created in */ _sqlite3AuthCheck(tls, pParse, int32(SQLITE_CREATE_VTABLE), (*TTable)(unsafe.Pointer(pTable)).FzName, *(*uintptr)(unsafe.Pointer((*(*struct { FnArg int32 FazArg uintptr @@ -133352,7 +129922,6 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pTab == uintptr(0) { return } - _ = libc.Int32FromInt32(0) _addArgumentToVtab(tls, pParse) (*TParse)(unsafe.Pointer(pParse)).FsArg.Fz = uintptr(0) if (*(*struct { @@ -133374,7 +129943,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21693, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21731, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133384,11 +129953,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21717, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21755, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21816, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21854, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -133400,12 +129969,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { } else { pSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema zName = (*TTable)(unsafe.Pointer(pTab)).FzName - _ = libc.Int32FromInt32(0) _sqlite3MarkAllShadowTablesOf(tls, db, pTab) pOld = _sqlite3HashInsert(tls, pSchema+8, zName, pTab) if pOld != 0 { _sqlite3OomFault(tls, db) - _ = libc.Int32FromInt32(0) /* Malloc must have failed inside HashInsert() */ + /* Malloc must have failed inside HashInsert() */ return } (*TParse)(unsafe.Pointer(pParse)).FpNewTable = uintptr(0) @@ -133438,7 +130006,6 @@ func _sqlite3VtabArgExtend(tls *libc.TLS, pParse uintptr, p uintptr) { (*TToken)(unsafe.Pointer(pArg)).Fz = (*TToken)(unsafe.Pointer(p)).Fz (*TToken)(unsafe.Pointer(pArg)).Fn = (*TToken)(unsafe.Pointer(p)).Fn } else { - _ = libc.Int32FromInt32(0) (*TToken)(unsafe.Pointer(pArg)).Fn = uint32(int32(t__predefined_ptrdiff_t((*TToken)(unsafe.Pointer(p)).Fz+uintptr((*TToken)(unsafe.Pointer(p)).Fn)) - int64((*TToken)(unsafe.Pointer(pArg)).Fz))) } } @@ -133465,7 +130032,6 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, Fp uintptr })(unsafe.Pointer(pTab + 64))).FnArg *(*uintptr)(unsafe.Pointer(bp + 32)) = uintptr(0) - _ = libc.Int32FromInt32(0) azArg = (*(*struct { FnArg int32 FazArg uintptr @@ -133478,11 +130044,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21835, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21873, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133505,8 +130072,6 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg + 1*8)) = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName /* Invoke the virtual table constructor */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*(*TVtabCtx)(unsafe.Pointer(bp))).FpTab = pTab (*(*TVtabCtx)(unsafe.Pointer(bp))).FpVTable = pVTable (*(*TVtabCtx)(unsafe.Pointer(bp))).FpPrior = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx @@ -133519,12 +130084,11 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } - _ = libc.Int32FromInt32(0) if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21877, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21915, libc.VaList(bp+48, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) } _sqlite3DbFree(tls, db, pVTable) @@ -133537,7 +130101,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21907 + zFormat = __ccgo_ts + 21945 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133563,7 +130127,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { break } - zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, __ccgo_ts+1648) + zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, __ccgo_ts+1652) i = 0 nType = _sqlite3Strlen30(tls, zType) i = 0 @@ -133571,11 +130135,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16551, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16589, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133593,10 +130158,10 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { - _ = libc.Int32FromInt32(0) *(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1)))) = int8('\000') } p6 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + 14 @@ -133608,6 +130173,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133634,8 +130200,6 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int var _ /* zErr at bp+0 */ uintptr _, _, _, _, _ = db, pMod, rc, zMod, zModule db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3GetVTable(tls, db, pTab) != 0 { return SQLITE_OK } @@ -133652,13 +130216,13 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21953, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21991, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3795, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3799, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) (*TParse)(unsafe.Pointer(pParse)).Frc = rc } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) @@ -133727,7 +130291,6 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, _, _, _, _ = pMod, pTab, rc, zMod rc = SQLITE_OK pTab = _sqlite3FindTable(tls, db, zTab, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) - _ = libc.Int32FromInt32(0) /* Locate the required virtual table module */ zMod = *(*uintptr)(unsafe.Pointer((*(*struct { FnArg int32 @@ -133740,7 +130303,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21953, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21991, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -133775,24 +130338,21 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab - _ = libc.Int32FromInt32(0) _sqlite3ParseObjectInit(tls, bp, db) (*(*TParse)(unsafe.Pointer(bp))).FeParseMode = uint8(PARSE_MODE_DECLARE_VTAB) (*(*TParse)(unsafe.Pointer(bp))).FdisableTriggers = uint8(1) /* We should never be able to reach this point while loading the ** schema. Nevertheless, defend against that (turn off db->init.busy) ** in case a bug arises. */ - _ = libc.Int32FromInt32(0) initBusy = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) (*(*TParse)(unsafe.Pointer(bp))).FnQueryLoop = int16(1) if SQLITE_OK == _sqlite3RunParser(tls, bp, zCreateTable) && (*(*TParse)(unsafe.Pointer(bp))).FpNewTable != uintptr(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FeTabType) == TABTYP_NORM { - _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer(pTab)).FaCol != 0) { pNew = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable (*TTable)(unsafe.Pointer(pTab)).FaCol = (*TTable)(unsafe.Pointer(pNew)).FaCol @@ -133807,8 +130367,6 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i *(*Tu32)(unsafe.Pointer(pTab + 48)) |= (*TTable)(unsafe.Pointer(pNew)).FtabFlags & uint32(libc.Int32FromInt32(TF_WithoutRowid)|libc.Int32FromInt32(TF_NoVisibleRowid)) (*TTable)(unsafe.Pointer(pNew)).FnCol = 0 (*TTable)(unsafe.Pointer(pNew)).FaCol = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer(pNew)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(pCtx)).FpVTable)).FpMod)).FpModule)).FxUpdate != uintptr(0) && int32((*TIndex)(unsafe.Pointer(_sqlite3PrimaryKeyIndex(tls, pNew))).FnKeyCol) != int32(1) { /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) ** or else must have a single-column PRIMARY KEY */ @@ -133816,7 +130374,6 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i } pIdx = (*TTable)(unsafe.Pointer(pNew)).FpIndex if pIdx != 0 { - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTab)).FpIndex = pIdx (*TTable)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) (*TIndex)(unsafe.Pointer(pIdx)).FpTable = pTab @@ -133825,7 +130382,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared = int32(1) } else { if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { - v2 = __ccgo_ts + 3795 + v2 = __ccgo_ts + 3799 } else { v2 = uintptr(0) } @@ -133840,7 +130397,6 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i _sqlite3DeleteTable(tls, db, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable) _sqlite3ParseObjectReset(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(initBusy) - _ = libc.Int32FromInt32(0) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -133875,12 +130431,12 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) if !(p != 0) { break } - _ = libc.Int32FromInt32(0) if (*Tsqlite3_vtab)(unsafe.Pointer((*TVTable)(unsafe.Pointer(p)).FpVtab)).FnRef > 0 { return int32(SQLITE_LOCKED) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -133888,12 +130444,10 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) if xDestroy == uintptr(0) { xDestroy = (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(p)).FpMod)).FpModule)).FxDisconnect } - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, (*TVTable)(unsafe.Pointer(p)).FpVtab) /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) (*TVTable)(unsafe.Pointer(p)).FpVtab = uintptr(0) (*(*struct { FnArg int32 @@ -133941,6 +130495,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -133981,6 +130536,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -134048,6 +130604,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -134091,8 +130648,6 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 var savedFlags Tu64 _, _, _, _, _, _ = i, pMod, pVTab, rc, savedFlags, xMethod rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans != 0 { i = 0 for { @@ -134123,6 +130678,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134162,7 +130718,6 @@ func _sqlite3VtabOverloadFunction(tls *libc.TLS, db uintptr, pDef uintptr, nArg if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { return pDef } - _ = libc.Int32FromInt32(0) pTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) if pTab == uintptr(0) { return pDef @@ -134171,8 +130726,6 @@ func _sqlite3VtabOverloadFunction(tls *libc.TLS, db uintptr, pDef uintptr, nArg return pDef } pVtab = (*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, db, pTab))).FpVtab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pMod = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule if (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction == uintptr(0) { return pDef @@ -134221,7 +130774,6 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { v1 = pParse } pToplevel = v1 - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock) { @@ -134232,6 +130784,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -134293,7 +130846,6 @@ func _sqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VTAB) (*TTable)(unsafe.Pointer(pTab)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema - _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_Eponymous) _addModuleArgument(tls, pParse, pTab, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName)) @@ -134301,7 +130853,7 @@ func _sqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) _addModuleArgument(tls, pParse, pTab, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName)) rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp) if rc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3795, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3799, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3VtabEponymousTableClear(tls, db, pMod) } @@ -134338,9 +130890,6 @@ func _sqlite3VtabEponymousTableClear(tls *libc.TLS, db uintptr, pMod uintptr) { // ** within an xUpdate method. // */ func Xsqlite3_vtab_on_conflict(tls *libc.TLS, db uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int32(_aMap[int32((*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict)-int32(1)]) } @@ -134368,9 +130917,8 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { - _ = libc.Int32FromInt32(0) ap = va switch op { case int32(SQLITE_VTAB_CONSTRAINT_SUPPORT): @@ -134382,7 +130930,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -135104,10 +131652,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21972 + return __ccgo_ts + 22010 } if i == -int32(1) { - return __ccgo_ts + 16660 + return __ccgo_ts + 16698 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -135125,12 +131673,11 @@ func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, iTerm int32, bAnd int32, zOp uintptr) { var i int32 _ = i - _ = libc.Int32FromInt32(0) if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22017, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22023, int32(1)) } i = 0 for { @@ -135138,19 +131685,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13094, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5110, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22023, int32(1)) } i = 0 for { @@ -135158,15 +131706,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13094, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5112, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5110, int32(1)) } } @@ -135199,7 +131748,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22025, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135207,27 +131756,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22017, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21990 + v2 = __ccgo_ts + 22028 } else { - v2 = __ccgo_ts + 21995 + v2 = __ccgo_ts + 22033 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22003) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22041) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22043) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5110, int32(1)) } // C documentation @@ -135270,63 +131820,60 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22007 + v2 = __ccgo_ts + 22045 } else { - v2 = __ccgo_ts + 22014 + v2 = __ccgo_ts + 22052 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22019, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22057, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) - _ = libc.Int32FromInt32(0) pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex - _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11228 + zFmt = __ccgo_ts + 11257 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22025 + zFmt = __ccgo_ts + 22063 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22058 + zFmt = __ccgo_ts + 22096 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22083 + zFmt = __ccgo_ts + 22121 } else { - zFmt = __ccgo_ts + 22101 + zFmt = __ccgo_ts + 22139 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22110, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22148, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16660 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22118, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 16698 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22156, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = int8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22149, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22187, libc.VaList(bp+144, zRowid)) cRangeOp = int8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { cRangeOp = int8('>') } else { - _ = libc.Int32FromInt32(0) cRangeOp = int8('<') } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22159, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22197, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22164, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22202, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135345,7 +131892,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22191, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22229, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135379,14 +131926,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22202, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22240, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22028, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22223, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22261, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135396,15 +131943,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22017, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22028, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5110, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135459,7 +132007,6 @@ func _disableTerm(tls *libc.TLS, pLevel uintptr, pTerm uintptr) { var p1, p2 uintptr _, _, _ = nLoop, p1, p2 nLoop = 0 - _ = libc.Int32FromInt32(0) for int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_CODED) == 0 && ((*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin == 0 || (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0)) && (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady&(*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll == uint64(0) { if nLoop != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_LIKE) != 0 { p1 = pTerm + 18 @@ -135472,7 +132019,6 @@ func _disableTerm(tls *libc.TLS, pLevel uintptr, pTerm uintptr) { break } pTerm = (*TWhereClause)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpWC)).Fa + uintptr((*TWhereTerm)(unsafe.Pointer(pTerm)).FiParent)*56 - _ = libc.Int32FromInt32(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FnChild-- if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FnChild) != 0 { break @@ -135499,14 +132045,11 @@ func _codeApplyAffinity(tls *libc.TLS, pParse uintptr, base int32, n int32, zAff _ = v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe if zAff == uintptr(0) { - _ = libc.Int32FromInt32(0) return } - _ = libc.Int32FromInt32(0) /* Adjust base and n to skip over SQLITE_AFF_BLOB and SQLITE_AFF_NONE ** entries at the beginning and end of the affinity string. */ - _ = libc.Int32FromInt32(0) for n > 0 && int32(*(*int8)(unsafe.Pointer(zAff))) <= int32(SQLITE_AFF_BLOB) { n-- base++ @@ -135548,6 +132091,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135598,10 +132142,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p pOrigLhs = uintptr(0) /* Original unmodified LHS */ pRhs = uintptr(0) /* New RHS after modifications */ pLhs = uintptr(0) /* Loop counter */ - _ = libc.Int32FromInt32(0) pOrigRhs = (*TSelect)(unsafe.Pointer(pSelect)).FpEList - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pSelect == *(*uintptr)(unsafe.Pointer(pNew + 32)) { pOrigLhs = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pNew)).FpLeft + 32)) } @@ -135611,7 +132152,6 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p break } if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { - _ = libc.Int32FromInt32(0) iField = (*(*struct { FleftColumn int32 FiField int32 @@ -135622,13 +132162,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p pRhs = _sqlite3ExprListAppend(tls, pParse, pRhs, (*(*TExprList_item)(unsafe.Pointer(pOrigRhs + 8 + uintptr(iField)*32))).FpExpr) (*(*TExprList_item)(unsafe.Pointer(pOrigRhs + 8 + uintptr(iField)*32))).FpExpr = uintptr(0) if pOrigLhs != 0 { - _ = libc.Int32FromInt32(0) pLhs = _sqlite3ExprListAppend(tls, pParse, pLhs, (*(*TExprList_item)(unsafe.Pointer(pOrigLhs + 8 + uintptr(iField)*32))).FpExpr) (*(*TExprList_item)(unsafe.Pointer(pOrigLhs + 8 + uintptr(iField)*32))).FpExpr = uintptr(0) } } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135663,11 +132203,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -135700,8 +132242,6 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aiMap, db, eType, i, iCol, iMap, iOut, iReg, n, nEq, pExpr, pIn, pLoop, pX, v, v3, v4, v6, v7, v8 pX = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Register holding results */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_EQ) || int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_IS) { iReg = _sqlite3ExprCodeTarget(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, iTarget) } else { @@ -135716,7 +132256,6 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex != uintptr(0) && *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex)).FaSortOrder + uintptr(iEq))) != 0 { bRev = libc.BoolInt32(!(bRev != 0)) } - _ = libc.Int32FromInt32(0) iReg = iTarget i = 0 for { @@ -135729,6 +132268,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -135736,12 +132276,12 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm)) { break } - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { nEq++ } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -135779,7 +132319,6 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint v4 = int32(OP_Rewind) } _sqlite3VdbeAddOp2(tls, v, v4, *(*int32)(unsafe.Pointer(bp)), 0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_IN_ABLE) if (*(*struct { FnIn int32 @@ -135857,6 +132396,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -135941,18 +132481,15 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Affinity string to return */ /* This module is only called on query plans that use an index. */ pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop - _ = libc.Int32FromInt32(0) nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq nSkip = (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex - _ = libc.Int32FromInt32(0) /* Figure out how many memory cells we will need then allocate them. */ regBase = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) nReg = int32(nEq) + nExtraReg *(*int32)(unsafe.Pointer(pParse + 56)) += nReg zAff = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx)) - _ = libc.Int32FromInt32(0) if nSkip != 0 { iIdxCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, regBase, regBase+int32(nSkip)-int32(1)) @@ -135963,7 +132500,6 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } _sqlite3VdbeAddOp1(tls, v, v1, iIdxCur) j = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) - _ = libc.Int32FromInt32(0) if bRev != 0 { v2 = int32(OP_SeekLT) } else { @@ -135979,19 +132515,18 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } /* Evaluate the equality constraints */ - _ = libc.Int32FromInt32(0) j = int32(nSkip) for { if !(j < int32(nEq)) { break } pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) - _ = libc.Int32FromInt32(0) /* The following testcase is true for indices with redundant columns. ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */ r1 = _codeEqualityTerm(tls, pParse, pTerm, pLevel, j, bRev, regBase+j) @@ -136020,7 +132555,6 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regBase+j, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) } if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { - _ = libc.Int32FromInt32(0) if int32(_sqlite3CompareAffinity(tls, pRight, *(*int8)(unsafe.Pointer(zAff + uintptr(j))))) == int32(SQLITE_AFF_BLOB) { *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) } @@ -136032,6 +132566,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -136073,8 +132608,6 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, _, _, _, _, _, _, _, _, _ = ai, i, pParse, pTab, v, x1, x2, v1, v2 pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parse context */ v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Vdbe to generate code within */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 0, 0x1) _sqlite3VdbeAddOp3(tls, v, int32(OP_DeferredSeek), iIdxCur, 0, iCur) if v2 = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&(libc.Int32FromInt32(WHERE_OR_SUBCLAUSE)|libc.Int32FromInt32(WHERE_RIGHT_JOIN)) != 0; v2 { @@ -136094,7 +132627,6 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)-int32(1)) { break } - _ = libc.Int32FromInt32(0) x1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) x2 = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(x1))) if x1 >= 0 { @@ -136102,6 +132634,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -136124,17 +132657,13 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe var i, iSelect int32 var pList, v uintptr _, _, _, _ = i, iSelect, pList, v - _ = libc.Int32FromInt32(0) if p != 0 && _sqlite3ExprIsVector(tls, p) != 0 { if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) iSelect = _sqlite3CodeSubselect(tls, pParse, p) _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), iSelect, iReg, nReg-int32(1)) } else { - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(p + 32)) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nReg) { @@ -136143,11 +132672,11 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } } else { - _ = libc.Int32FromInt32(0) _sqlite3ExprCode(tls, pParse, p, iReg) } } @@ -136185,6 +132714,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -136234,20 +132764,15 @@ func _filterPullDown(tls *libc.TLS, pParse uintptr, pWInfo uintptr, iLevel int32 if (*TWhereLoop)(unsafe.Pointer(pLoop)).Fprereq¬Ready != 0 { continue } - _ = libc.Int32FromInt32(0) (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk = addrNxt if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) regRowid = _sqlite3GetTempReg(tls, pParse) regRowid = _codeEqualityTerm(tls, pParse, pTerm, pLevel, 0, 0, regRowid) _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_MustBeInt), regRowid, addrNxt) _sqlite3VdbeAddOp4Int(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Filter), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, addrNxt, regRowid, int32(1)) } else { nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) r1 = _codeAllEqualityTerms(tls, pParse, pLevel, 0, 0, bp) _codeApplyAffinity(tls, pParse, r1, int32(nEq), *(*uintptr)(unsafe.Pointer(bp))) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(bp))) @@ -136311,7 +132836,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** initialize a memory cell that records if this table matches any ** row of the left table of the join. */ - _ = libc.Int32FromInt32(0) if int32((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom) > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pTabItem))).Ffg.Fjointype)&int32(JT_LEFT) != 0 { v5 = pParse + 56 *(*int32)(unsafe.Pointer(v5))++ @@ -136334,6 +132858,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -136390,14 +132915,12 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pRight = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight _codeExprOrVector(tls, pParse, pRight, iTarget, int32(1)) if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) == int32(SQLITE_INDEX_CONSTRAINT_OFFSET) && int32(Tu32(*(*uint8)(unsafe.Pointer(pLoop + 24 + 4))&0x2>>1)) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FiOffset) } } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136443,7 +132966,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(v14) (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeCurrentAddr(tls, v) - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < nConstraint) { @@ -136499,6 +133021,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136511,11 +133034,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI FiField int32 })(unsafe.Pointer(pTerm + 32))).FiField pLeft = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft - _ = libc.Int32FromInt32(0) if iFld > 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pCompare)).FpLeft = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 32)) + 8 + uintptr(iFld-int32(1))*32))).FpExpr } else { (*TExpr)(unsafe.Pointer(pCompare)).FpLeft = pLeft @@ -136533,6 +133052,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -136549,10 +133069,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** we reference multiple rows using a "rowid IN (...)" ** construct. */ - _ = libc.Int32FromInt32(0) pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v21 = pParse + 56 *(*int32)(unsafe.Pointer(v21))++ v20 = *(*int32)(unsafe.Pointer(v21)) @@ -136589,7 +133106,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI j++ pEnd = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(v24)*8)) } - _ = libc.Int32FromInt32(0) if bRev != 0 { pTerm = pStart pStart = pEnd @@ -136605,12 +133121,10 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI 2: uint8(OP_SeekLT), 3: uint8(OP_SeekGE), } - _ = libc.Int32FromInt32(0) /* Make sure the ordering.. */ - _ = libc.Int32FromInt32(0) /* ... of the TK_xx values... */ - _ = libc.Int32FromInt32(0) /* ... is correct. */ - _ = libc.Int32FromInt32(0) + /* Make sure the ordering.. */ + /* ... of the TK_xx values... */ + /* ... is correct. */ pX = (*TWhereTerm)(unsafe.Pointer(pStart)).FpExpr - _ = libc.Int32FromInt32(0) /* transitive constraints */ if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pX)).FpRight) != 0 { v25 = _sqlite3GetTempReg(tls, pParse) @@ -136618,10 +133132,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI r11 = v25 _codeExprOrVector(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, r11, int32(1)) op = int32(aMoveOp[(int32((*TExpr)(unsafe.Pointer(pX)).Fop)-int32(TK_GT)-int32(1))&int32(0x3)|int32(0x1)]) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } else { r11 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, bp) _disableTerm(tls, pLevel, pStart) @@ -136639,8 +133149,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } if pEnd != 0 { pX1 = (*TWhereTerm)(unsafe.Pointer(pEnd)).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Transitive constraints */ v28 = pParse + 56 *(*int32)(unsafe.Pointer(v28))++ @@ -136675,7 +133183,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(v31) (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = start - _ = libc.Int32FromInt32(0) if testOp != int32(OP_Noop) { v33 = pParse + 56 *(*int32)(unsafe.Pointer(v33))++ @@ -136700,7 +133207,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI addrSeekScan = 0 /* Opcode of the OP_SeekScan, if any */ pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex iIdxCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur - _ = libc.Int32FromInt32(0) /* Find any inequality constraint terms for the start and end ** of the range. */ @@ -136716,7 +133222,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } nExtraReg = v35 /* Like optimization range constraints always occur in pairs */ - _ = libc.Int32FromInt32(0) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { v36 = j @@ -136735,7 +133240,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } } } - _ = libc.Int32FromInt32(0) /* If the WHERE_BIGNULL_SORT flag is set, then index column nEq uses ** a non-default "big-null" sort (either ASC NULLS LAST or DESC NULLS ** FIRST). In both cases separate ordered scans are made of those @@ -136744,8 +133248,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** For DESC, NULL entries are scanned first. */ if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_TOP_LIMIT)|libc.Int32FromInt32(WHERE_BTM_LIMIT)) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BIGNULL_SORT) != uint32(0) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nExtraReg = int32(1) bSeekPastNull = uint8(1) v40 = pParse + 56 @@ -136784,7 +133286,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** starting at regBase. */ regBase = _codeAllEqualityTerms(tls, pParse, pLevel, bRev, nExtraReg, bp+8) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 && nTop != 0 { zEndAff = _sqlite3DbStrDup(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(nEq)) } @@ -136843,9 +133344,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _filterPullDown(tls, pParse, pWInfo, iLevel, addrNxt, notReady) } op1 = int32(_aStartOp[start_constraints< int32(1))*int32(4)+int32(2)+bRev]) _sqlite3VdbeAddOp4Int(tls, v, op1, iIdxCur, addrNxt, regBase, nConstraint1-startEq) - _ = libc.Int32FromInt32(0) } } /* Load the value for the inequality constraint at the end of the ** range (if any). */ nConstraint1 = int32(nEq) - _ = libc.Int32FromInt32(0) if pRangeEnd != 0 { pRight3 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pRangeEnd)).FpExpr)).FpRight - _ = libc.Int32FromInt32(0) _codeExprOrVector(tls, pParse, pRight3, regBase+int32(nEq), int32(nTop)) if int32((*TWhereTerm)(unsafe.Pointer(pRangeEnd)).FwtFlags)&int32(TERM_VNULL) == 0 && _sqlite3ExprCanBeNull(tls, pRight3) != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regBase+int32(nEq), addrNxt) @@ -136889,7 +133381,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _updateRangeAffinityStr(tls, pRight3, int32(nTop), zEndAff) _codeApplyAffinity(tls, pParse, regBase+int32(nEq), int32(nTop), zEndAff) } else { - _ = libc.Int32FromInt32(0) } nConstraint1 += int32(nTop) if _sqlite3ExprIsVector(tls, pRight3) == 0 { @@ -136929,9 +133420,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI if regBignull != 0 { /* During a NULL-scan, check to see if we have reached the end of ** the NULLs */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_If), regBignull, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) op1 = int32(_aEndOp[bRev*int32(2)+int32(bSeekPastNull)]) _sqlite3VdbeAddOp4Int(tls, v, op1, iIdxCur, addrNxt, regBase, nConstraint1+int32(bSeekPastNull)) @@ -136959,6 +133447,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -136980,7 +133469,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI /* The following assert() is not a requirement, merely an observation: ** The OR-optimization doesn't work for the right hand table of ** a LEFT JOIN: */ - _ = libc.Int32FromInt32(0) } /* Record the instruction used to terminate the loop. */ if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) != 0 { @@ -137002,7 +133490,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_CONSTRAINT) == uint32(0) { (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp5 = uint8(SQLITE_STMTSTATUS_FULLSCAN_STEP) } else { - _ = libc.Int32FromInt32(0) } if omitTable != 0 { pIdx = uintptr(0) @@ -137025,9 +133512,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = uintptr(0) /* An ".. AND (...)" expression */ pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pOrWc = *(*uintptr)(unsafe.Pointer(pTerm + 32)) (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Return) (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = regReturn @@ -137053,6 +133537,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104)) goto _48 _48: + ; k++ } } else { @@ -137143,6 +133628,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -137158,7 +133644,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22231, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22269, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -137181,9 +133667,8 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22246, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22284, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) - _ = libc.Int32FromInt32(0) if pSubWInfo != 0 { addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) _ = addrExplain @@ -137216,6 +133701,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137271,9 +133757,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** be available. */ pSubLoop = (*(*TWhereLevel)(unsafe.Pointer(pSubWInfo + 856))).FpWLoop - _ = libc.Int32FromInt32(0) if (*TWhereLoop)(unsafe.Pointer(pSubLoop)).FwsFlags&uint32(WHERE_INDEXED) != uint32(0) && (ii == 0 || (*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex == pCov) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY))) { - _ = libc.Int32FromInt32(0) pCov = (*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex } else { pCov = uintptr(0) @@ -137289,12 +133773,10 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) = pCov if pCov != 0 { (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iCovCur @@ -137311,7 +133793,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** loop. The byte-code formatter will use that P2 value as a hint to ** indent everything in between the this point and the final OP_Return. ** See tag-20220407a in vdbe.c and shell.c */ - _ = libc.Int32FromInt32(0) (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeCurrentAddr(tls, v) if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > int32(1) { _sqlite3DbFreeNN(tls, db, pOrTab) @@ -137320,7 +133801,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _disableTerm(tls, pLevel, pTerm) } } else { - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pTabItem + 60 + 4))&0x40>>6)) != 0 { /* Tables marked isRecursive have only a single row that is stored in ** a pseudo-cursor. No need to Rewind or Next such cursors. */ @@ -137374,7 +133854,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI goto _61 } pE = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr - _ = libc.Int32FromInt32(0) if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 { if !((*TExpr)(unsafe.Pointer(pE)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != libc.Uint32FromInt32(0)) { /* Defer processing WHERE clause constraints until after outer @@ -137418,6 +133897,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -137453,9 +133933,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI goto _63 } pE1 = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pAlt = _sqlite3WhereFindTerm(tls, pWC, iCur, (*(*struct { FleftColumn int32 FiField int32 @@ -137476,6 +133953,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -137508,6 +133986,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137541,7 +134020,6 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pRJ1 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ _sqlite3VdbeAddOp2(tls, v, int32(OP_BeginSubrtn), 0, (*TWhereRightJoin)(unsafe.Pointer(pRJ1)).FregReturn) (*TWhereRightJoin)(unsafe.Pointer(pRJ1)).FaddrSubrtn = _sqlite3VdbeCurrentAddr(tls, v) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn++ /* WHERE clause constraints must be deferred until after outer join ** row elimination has completed, since WHERE clause constraints apply @@ -137549,6 +134027,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137559,22 +134038,22 @@ code_outer_join_constraints: goto _67 } if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady != uint64(0) { - _ = libc.Int32FromInt32(0) goto _67 } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { goto _67 } - _ = libc.Int32FromInt32(0) _sqlite3ExprIfFalse(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, addrCont, int32(SQLITE_JUMPIFNULL)) p68 = pTerm + 18 *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137660,7 +134139,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22255, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22293, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -137674,6 +134153,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -137696,6 +134176,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -137703,7 +134184,6 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe (*(*TSrcList)(unsafe.Pointer(bp))).FnAlloc = uint32(1) libc.Xmemcpy(tls, bp+8, pTabItem, uint64(104)) (*(*TSrcItem)(unsafe.Pointer(bp + 8))).Ffg.Fjointype = uint8(0) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn++ pSubWInfo = _sqlite3WhereBegin(tls, pParse, bp, pSubWhere, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_RIGHT_JOIN), 0) if pSubWInfo != 0 { @@ -137730,6 +134210,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -137741,7 +134222,6 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSubWhere) _sqlite3VdbeExplainPop(tls, pParse) - _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn-- } @@ -137834,10 +134314,6 @@ func _whereClauseInsert(tls *libc.TLS, pWC uintptr, p uintptr, wtFlags Tu16) (r // ** "=", "<", ">", "<=", ">=", "IN", "IS", and "IS NULL" // */ func _allowedOp(tls *libc.TLS, op int32) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return libc.BoolInt32(op == int32(TK_IN) || op >= int32(TK_EQ) && op <= int32(TK_GE) || op == int32(TK_ISNULL) || op == int32(TK_IS)) } @@ -137857,11 +134333,6 @@ func _exprCommute(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r Tu16) { (*TExpr)(unsafe.Pointer(pExpr)).FpRight = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = t if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) >= int32(TK_GT) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) - int32(TK_GT) ^ int32(2) + int32(TK_GT)) } return uint16(0) @@ -137875,7 +134346,6 @@ func _exprCommute(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r Tu16) { func _operatorMask(tls *libc.TLS, op int32) (r Tu16) { var c Tu16 _ = c - _ = libc.Int32FromInt32(0) if op == int32(TK_IN) { c = uint16(WO_IN) } else { @@ -137885,19 +134355,10 @@ func _operatorMask(tls *libc.TLS, op int32) (r Tu16) { if op == int32(TK_IS) { c = uint16(WO_IS) } else { - _ = libc.Int32FromInt32(0) c = uint16(libc.Int32FromInt32(WO_EQ) << (op - libc.Int32FromInt32(TK_EQ))) } } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return c } @@ -137930,7 +134391,6 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt if !(_sqlite3IsLikeFunction(tls, db, pExpr, pnoCase, bp) != 0) { return 0 } - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) pLeft = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr pRight = _sqlite3ExprSkipCollate(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr) @@ -137943,10 +134403,8 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt z = Xsqlite3_value_text(tls, pVal) } _sqlite3VdbeSetVarmask(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, iCol) - _ = libc.Int32FromInt32(0) } else { if op == int32(TK_STRING) { - _ = libc.Int32FromInt32(0) z = *(*uintptr)(unsafe.Pointer(pRight + 8)) } } @@ -137978,7 +134436,6 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt /* Get the pattern prefix. Remove all escapes from the prefix. */ pPrefix = _sqlite3Expr(tls, db, int32(TK_STRING), z) if pPrefix != 0 { - _ = libc.Int32FromInt32(0) zNew = *(*uintptr)(unsafe.Pointer(pPrefix + 8)) *(*int8)(unsafe.Pointer(zNew + uintptr(cnt))) = 0 v3 = libc.Int32FromInt32(0) @@ -137996,10 +134453,10 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 - _ = libc.Int32FromInt32(0) /* If the LHS is not an ordinary column with TEXT affinity, then the ** pattern prefix boundaries (both the start and end boundaries) must ** not look like a number. Otherwise the pattern might be treated as @@ -138037,7 +134494,6 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt if op == int32(TK_VARIABLE) { v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe _sqlite3VdbeSetVarmask(tls, v, int32((*TExpr)(unsafe.Pointer(pRight)).FiColumn)) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(pisComplete)) != 0 && *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 8)) + 1)) != 0 { /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE @@ -138097,7 +134553,6 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui var _ /* xNotUsed at bp+0 */ uintptr _, _, _, _, _, _, _, _, _ = i, pCol, pLeft, pList, pMod, pRight, pVtab, res, t if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) { - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList == uintptr(0) || (*TExprList)(unsafe.Pointer(pList)).FnExpr != int32(2) { return 0 @@ -138110,14 +134565,12 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui ** MATCH(expression,vtab_column) */ pCol = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pCol)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64)))).FeTabType) == int32(TABTYP_VTAB) { i = 0 for { if !(i < int32(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(16))) { break } - _ = libc.Int32FromInt32(0) if _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), _aOp[i].FzOp) == 0 { *(*uint8)(unsafe.Pointer(peOp2)) = _aOp[i].FeOp2 *(*uintptr)(unsafe.Pointer(ppRight)) = (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr @@ -138126,6 +134579,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -138140,13 +134594,8 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui ** with function names in an arbitrary case. */ pCol = (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pCol)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64)))).FeTabType) == int32(TABTYP_VTAB) { pVtab = (*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, db, *(*uintptr)(unsafe.Pointer(pCol + 64))))).FpVtab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pMod = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule if (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction != uintptr(0) { i = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction})))(tls, pVtab, int32(2), *(*uintptr)(unsafe.Pointer(pExpr + 8)), bp, bp+8) @@ -138163,11 +134612,9 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui res = 0 pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64)))).FeTabType) == int32(TABTYP_VTAB) { res++ } - _ = libc.Int32FromInt32(0) if pRight != 0 && (int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64)))).FeTabType) == int32(TABTYP_VTAB)) { res++ t = pLeft @@ -138196,19 +134643,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16509, + FzOp: __ccgo_ts + 16547, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15840, + FzOp: __ccgo_ts + 15878, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15319, + FzOp: __ccgo_ts + 15357, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22269, + FzOp: __ccgo_ts + 22307, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138301,8 +134748,6 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp if int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) != int32(eOp) && int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != int32(eOp) { return } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _sqlite3ExprCompare(tls, uintptr(0), (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOne)).FpExpr)).FpLeft, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTwo)).FpExpr)).FpLeft, -int32(1)) != 0 { return } @@ -138314,7 +134759,6 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp if int32(eOp)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) != 0 { eOp = uint16(libc.Int32FromInt32(WO_EQ) << (libc.Int32FromInt32(TK_LE) - libc.Int32FromInt32(TK_EQ))) } else { - _ = libc.Int32FromInt32(0) eOp = uint16(libc.Int32FromInt32(WO_EQ) << (libc.Int32FromInt32(TK_GE) - libc.Int32FromInt32(TK_EQ))) } } @@ -138328,9 +134772,9 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp if !(int32(eOp) != int32(WO_EQ)<<(op-int32(TK_EQ))) { break } - _ = libc.Int32FromInt32(0) goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138442,8 +134886,6 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) ** stored in a WhereClause structure containing within the WhereOrInfo ** object that is attached to the original OR clause term. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v1 = _sqlite3DbMallocZero(tls, db, uint64(496)) pOrInfo = v1 *(*uintptr)(unsafe.Pointer(pTerm + 32)) = v1 @@ -138460,7 +134902,6 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - _ = libc.Int32FromInt32(0) /* ** Compute the set of tables that might satisfy cases 1 or 3. */ @@ -138473,7 +134914,6 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break } if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator)&int32(WO_SINGLE) == 0 { - _ = libc.Int32FromInt32(0) chngToIN = uint64(0) pAndInfo = _sqlite3DbMallocRawNN(tls, db, uint64(488)) if pAndInfo != 0 { @@ -138496,12 +134936,12 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) if !(j < (*TWhereClause)(unsafe.Pointer(pAndWC)).FnTerm) { break } - _ = libc.Int32FromInt32(0) if _allowedOp(tls, int32((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pAndTerm)).FpExpr)).Fop)) != 0 || int32((*TWhereTerm)(unsafe.Pointer(pAndTerm)).FeOperator) == int32(WO_AUX) { b |= _sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pAndTerm)).FleftCursor) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -138528,6 +134968,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -138610,13 +135051,11 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) if !(i >= 0) { break } - _ = libc.Int32FromInt32(0) p12 = pOrTerm + 18 *(*Tu16)(unsafe.Pointer(p12)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p12))) & ^libc.Int32FromInt32(TERM_OK)) if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCursor { /* This is the 2-bit case and we are on the second iteration and ** current term is from the first iteration. So skip this term. */ - _ = libc.Int32FromInt32(0) goto _11 } if chngToIN&_sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor) == uint64(0) { @@ -138624,10 +135063,8 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) ** chngToIN set but t1 is not. This term will be either preceded ** or followed by an inverted copy (t2.b==t1.a). Skip this term ** and use its inversion. */ - _ = libc.Int32FromInt32(0) goto _11 } - _ = libc.Int32FromInt32(0) iColumn = (*(*struct { FleftColumn int32 FiField int32 @@ -138637,15 +135074,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } if i < 0 { /* No candidate table+column was found. This can only occur ** on the second iteration */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) break } /* We have found a candidate table and column. Check to see if that @@ -138655,8 +135090,6 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) if !(i >= 0 && okToChngToIN != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor != iCursor { p14 = pOrTerm + 18 *(*Tu16)(unsafe.Pointer(p14)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p14))) & ^libc.Int32FromInt32(TERM_OK)) @@ -138683,11 +135116,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -138706,24 +135141,19 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags)&int32(TERM_OK) == 0 { goto _16 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pDup = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpRight, 0) pList = _sqlite3ExprListAppend(tls, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse, pList, pDup) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } - _ = libc.Int32FromInt32(0) pDup = _sqlite3ExprDup(tls, db, pLeft1, 0) pNew = _sqlite3PExpr(tls, pParse, int32(TK_IN), pDup, uintptr(0)) if pNew != 0 { _transferJoinMarkings(tls, pNew, pExpr) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList idxNew = _whereClauseInsert(tls, pWC, pNew, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) _exprAnalyze(tls, pSrc, pWC, idxNew) @@ -138813,6 +135243,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -138858,7 +135289,6 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) != -int32(2) { goto _4 } - _ = libc.Int32FromInt32(0) if _sqlite3ExprCompareSkip(tls, pExpr, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, iCur) == 0 && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_STRING) { *(*int32)(unsafe.Pointer(aiCurCol)) = iCur *(*int32)(unsafe.Pointer(aiCurCol + 1*4)) = -int32(2) @@ -138866,14 +135296,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -138890,11 +135323,7 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u /* If this expression is a vector to the left or right of a ** inequality constraint (>, <, >= or <=), perform the processing ** on the first element of the vector. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VECTOR) && (op >= int32(TK_GT) && op <= int32(TK_GE)) { - _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { @@ -138917,10 +135346,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -138975,17 +135406,14 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - _ = libc.Int32FromInt32(0) pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 pMaskSet = pWInfo + 592 pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr - _ = libc.Int32FromInt32(0) /* Because malloc() has not failed */ - _ = libc.Int32FromInt32(0) + /* Because malloc() has not failed */ (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect = 0 prereqLeft = _sqlite3WhereExprUsage(tls, pMaskSet, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) if op == int32(TK_IN) { - _ = libc.Int32FromInt32(0) if _sqlite3ExprCheckIN(tls, pParse, pExpr) != 0 { return } @@ -139014,7 +135442,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22314, 0) return } } else { @@ -139026,7 +135454,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22314, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -139050,9 +135478,6 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { FleftColumn int32 FiField int32 })(unsafe.Pointer(pTerm + 32))).FiField > 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pLeft = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 32)) + 8 + uintptr((*(*struct { FleftColumn int32 FiField int32 @@ -139060,7 +135485,6 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } if _exprMightBeIndexed(tls, pSrc, bp+24, pLeft, op) != 0 { (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[0] - _ = libc.Int32FromInt32(0) (*(*struct { FleftColumn int32 FiField int32 @@ -139073,7 +135497,6 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } if pRight != 0 && _exprMightBeIndexed(tls, pSrc, bp+24, pRight, op) != 0 && !((*TExpr)(unsafe.Pointer(pRight)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { eExtraOp = uint16(0) /* Extra bits for pNew->eOperator */ - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor >= 0 { pDup = _sqlite3ExprDup(tls, db, pExpr, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -139105,7 +135528,6 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { p7 = pNew + 18 *(*Tu16)(unsafe.Pointer(p7)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p7))) | int32(_exprCommute(tls, pParse, pDup))) (*TWhereTerm)(unsafe.Pointer(pNew)).FleftCursor = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[0] - _ = libc.Int32FromInt32(0) (*(*struct { FleftColumn int32 FiField int32 @@ -139115,9 +135537,8 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { (*TWhereTerm)(unsafe.Pointer(pNew)).FeOperator = uint16((int32(_operatorMask(tls, int32((*TExpr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask)) } else { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7866 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7895 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -139125,10 +135546,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } } else { if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_BETWEEN) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) { - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < int32(2)) { @@ -139142,11 +135560,11 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_OR) { - _ = libc.Int32FromInt32(0) _exprAnalyzeOrTerm(tls, pSrc, pWC, idxTerm) pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 } else { @@ -139174,11 +135592,8 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { } else { if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) && _isLikeOrGlob(tls, pParse, pExpr, bp, bp+8, bp+12) != 0 { /* Name of collating sequence */ wtFlags = uint16(libc.Int32FromInt32(TERM_LIKEOPT) | libc.Int32FromInt32(TERM_VIRTUAL) | libc.Int32FromInt32(TERM_DYNAMIC)) - _ = libc.Int32FromInt32(0) pLeft2 = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr pStr2 = _sqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(bp)), 0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Convert the lower bound to upper-case and the upper bound to ** lower-case (upper-case is less than lower-case in ASCII) so that ** the range constraints also work for BLOBs @@ -139197,6 +135612,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) goto _11 _11: + ; i1++ } } @@ -139218,7 +135634,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22317 + v13 = __ccgo_ts + 22355 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -139271,6 +135687,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -139293,6 +135710,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139378,7 +135796,6 @@ func _sqlite3WhereSplit(tls *libc.TLS, pWC uintptr, pExpr uintptr, op Tu8) { _ = pE2 pE2 = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) (*TWhereClause)(unsafe.Pointer(pWC)).Fop = op - _ = libc.Int32FromInt32(0) if pE2 == uintptr(0) { return } @@ -139462,7 +135879,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { var iCsr, ii int32 var pExpr, pOrderBy uintptr _, _, _, _ = iCsr, ii, pExpr, pOrderBy - _ = libc.Int32FromInt32(0) /* 1 -- checked by caller */ + /* 1 -- checked by caller */ if (*TSelect)(unsafe.Pointer(p)).FpGroupBy == uintptr(0) && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) == uint32(0) && ((*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc == int32(1) && int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab)).FeTabType) == int32(TABTYP_VTAB)) { pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy iCsr = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FiCursor @@ -139475,8 +135892,6 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { if int32((*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(ii)*56))).FwtFlags)&int32(TERM_CODED) != 0 { /* This term is a vector operation that has been decomposed into ** other, subsequent terms. It can be ignored. See tag-20220128a */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) goto _1 } if (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(ii)*56))).FnChild != 0 { @@ -139491,6 +135906,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139512,11 +135928,11 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } /* All conditions are met. Add the terms to the where-clause object. */ - _ = libc.Int32FromInt32(0) _whereAddLimitExpr(tls, pWC, (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpLimit)).FpLeft, iCsr, int32(SQLITE_INDEX_CONSTRAINT_LIMIT)) if (*TSelect)(unsafe.Pointer(p)).FiOffset > 0 { _whereAddLimitExpr(tls, pWC, (*TSelect)(unsafe.Pointer(p)).FiOffset, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpLimit)).FpRight, iCsr, int32(SQLITE_INDEX_CONSTRAINT_OFFSET)) @@ -139550,21 +135966,17 @@ func _sqlite3WhereClauseClear(tls *libc.TLS, pWC uintptr) { var a, aLast, db uintptr _, _, _ = a, aLast, db db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb - _ = libc.Int32FromInt32(0) if (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm > 0 { a = (*TWhereClause)(unsafe.Pointer(pWC)).Fa aLast = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm-int32(1))*56 for int32(1) != 0 { - _ = libc.Int32FromInt32(0) if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&int32(TERM_DYNAMIC) != 0 { _sqlite3ExprDelete(tls, db, (*TWhereTerm)(unsafe.Pointer(a)).FpExpr) } if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&(libc.Int32FromInt32(TERM_ORINFO)|libc.Int32FromInt32(TERM_ANDINFO)) != 0 { if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&int32(TERM_ORINFO) != 0 { - _ = libc.Int32FromInt32(0) _whereOrInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32))) } else { - _ = libc.Int32FromInt32(0) _whereAndInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32))) } } @@ -139624,7 +136036,6 @@ func _sqlite3WhereExprUsageFull(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r T } if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { mask |= _sqlite3WhereExprUsageNN(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FpRight) - _ = libc.Int32FromInt32(0) } else { if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_VarSelect)) != uint32(0) { @@ -139638,7 +136049,6 @@ func _sqlite3WhereExprUsageFull(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r T } } if (int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_AGG_FUNCTION)) && (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_WinFunc) != uint32(0) { - _ = libc.Int32FromInt32(0) mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpPartition) mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpOrderBy) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpFilter) @@ -139651,7 +136061,6 @@ func _sqlite3WhereExprUsageNN(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r TBi return _sqlite3WhereGetMask(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FiTable) } else { if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != uint32(0) { - _ = libc.Int32FromInt32(0) return uint64(0) } } @@ -139683,6 +136092,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -139710,6 +136120,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -139734,7 +136145,6 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC return } pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab - _ = libc.Int32FromInt32(0) pArgs = *(*uintptr)(unsafe.Pointer(pItem + 88)) if pArgs == uintptr(0) { return @@ -139750,7 +136160,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22362, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -139761,7 +136171,6 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC v3 = k k++ (*TExpr)(unsafe.Pointer(pColRef)).FiColumn = int16(v3) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pColRef + 64)) = pTab *(*TBitmask)(unsafe.Pointer(pItem + 80)) |= _sqlite3ExprColUsed(tls, pColRef) pRhs = _sqlite3PExpr(tls, pParse, int32(TK_UPLUS), _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TExprList_item)(unsafe.Pointer(pArgs + 8 + uintptr(j)*32))).FpExpr, 0), uintptr(0)) @@ -139778,6 +136187,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -139913,7 +136323,6 @@ func _sqlite3WhereOrderByLimitOptLabel(tls *libc.TLS, pWInfo uintptr) (r int32) return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue } pInner = pWInfo + 856 + uintptr(int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1))*104 - _ = libc.Int32FromInt32(0) if (*TWhereLevel)(unsafe.Pointer(pInner)).FpRJ != 0 { v1 = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue } else { @@ -139957,6 +136366,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -139969,7 +136379,6 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { // ** immediately with the next row of a WHERE clause. // */ func _sqlite3WhereContinueLabel(tls *libc.TLS, pWInfo uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue } @@ -140054,6 +136463,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -140075,6 +136485,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -140082,6 +136493,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -140099,9 +136511,6 @@ whereOrInsert_done: func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBitmask) { var i int32 _ = i - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(pMaskSet + 8)) == iCursor { return uint64(1) } @@ -140115,6 +136524,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -140144,7 +136554,6 @@ func _sqlite3WhereRealloc(tls *libc.TLS, pWInfo uintptr, pOld uintptr, nByte Tu6 if pNew != 0 && pOld != 0 { pOldBlk = pOld pOldBlk -= 16 - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, pNew, pOld, (*TWhereMemBlock)(unsafe.Pointer(pOldBlk)).Fsz) } return pNew @@ -140164,7 +136573,6 @@ func _createMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) { var v1 int32 var v2 uintptr _, _ = v1, v2 - _ = libc.Int32FromInt32(0) v2 = pMaskSet + 4 v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2))++ @@ -140199,20 +136607,16 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { var v3, v5 bool _, _, _, _, _, _, _, _, _, _, _, _ = iColumn, iCur, j, k, pColl, pParse, pTerm, pWC, pX, v2, v3, v5 /* The term being tested */ k = (*TWhereScan)(unsafe.Pointer(pScan)).Fk /* Where to start scanning */ - _ = libc.Int32FromInt32(0) pWC = (*TWhereScan)(unsafe.Pointer(pScan)).FpWC for int32(1) != 0 { iColumn = *(*Ti16)(unsafe.Pointer(pScan + 88 + uintptr(int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv)-int32(1))*2)) iCur = *(*int32)(unsafe.Pointer(pScan + 44 + uintptr(int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv)-int32(1))*4)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = pWC != uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(k)*56 for { if !(k < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { break } - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor == iCur && (*(*struct { FleftColumn int32 FiField int32 @@ -140232,6 +136636,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -140248,7 +136653,6 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { if !(_sqlite3IndexAffinityOk(tls, pX, (*TWhereScan)(unsafe.Pointer(pScan)).Fidxaff) != 0) { goto _1 } - _ = libc.Int32FromInt32(0) pColl = _sqlite3ExprCompareCollSeq(tls, pParse, pX) if pColl == uintptr(0) { pColl = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl @@ -140270,6 +136674,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -140438,6 +136843,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140451,8 +136857,6 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI func _indexColumnNotNull(tls *libc.TLS, pIdx uintptr, iCol int32) (r int32) { var j int32 _ = j - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2))) if j >= 0 { return int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(j)*16 + 8)) & 0xf >> 0)) @@ -140460,7 +136864,6 @@ func _indexColumnNotNull(tls *libc.TLS, pIdx uintptr, iCol int32) (r int32) { if j == -int32(1) { return int32(1) } else { - _ = libc.Int32FromInt32(0) return 0 /* Assume an indexed expression can always yield a NULL */ } } @@ -140509,6 +136912,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140550,6 +136954,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140558,6 +136963,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140624,6 +137030,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -140652,7 +137059,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur // ** not-NULL condition on the left table of the RIGHT JOIN. // */ func _constraintCompatibleWithOuterJoin(tls *libc.TLS, pTerm uintptr, pSrc uintptr) (r int32) { - _ = libc.Int32FromInt32(0) /* By caller */ + /* By caller */ if !((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != libc.Uint32FromInt32(0)) || *(*int32)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + 52)) != (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { return 0 } @@ -140678,14 +137085,12 @@ func _termCanDriveIndex(tls *libc.TLS, pTerm uintptr, pSrc uintptr, notReady TBi if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) == 0 { return 0 } - _ = libc.Int32FromInt32(0) if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 && !(_constraintCompatibleWithOuterJoin(tls, pTerm, pSrc) != 0) { return 0 /* See https://sqlite.org/forum/forumpost/51e6959f61 */ } if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight¬Ready != uint64(0) { return 0 } - _ = libc.Int32FromInt32(0) if (*(*struct { FleftColumn int32 FiField int32 @@ -140728,7 +137133,6 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea /* Generate code to skip over the creation and initialization of the ** transient index on 2nd and subsequent iterations of the loop. */ v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe - _ = libc.Int32FromInt32(0) addrInit = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) /* Count the number of columns that will be added to the index ** and used to match WHERE clause constraints */ @@ -140752,7 +137156,6 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea pPartial = _sqlite3ExprAnd(tls, pParse, pPartial, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0)) } if _termCanDriveIndex(tls, pTerm, pSrc, notReady) != 0 { - _ = libc.Int32FromInt32(0) iCol = (*(*struct { FleftColumn int32 FiField int32 @@ -140764,7 +137167,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<>5)) != 0 { regYield = (*TSrcItem)(unsafe.Pointer(pSrc)).FregReturn addrCounter = _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, 0) @@ -140954,7 +137356,6 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x20>>5)) != 0 { _sqlite3VdbeChangeP2(tls, v, addrCounter, regBase+n) - _ = libc.Int32FromInt32(0) _translateColumnToCopy(tls, pParse, addrTop, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, (*TSrcItem)(unsafe.Pointer(pSrc)).FregResult, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur) _sqlite3VdbeGoto(tls, v, addrTop) libc.SetBitFieldPtr16Uint32(pSrc+60+4, libc.Uint32FromInt32(0), 5, 0x20) @@ -140967,6 +137368,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea /* Jump here when skipping the initialization */ _sqlite3VdbeJumpHere(tls, v, addrInit) end_auto_index_create: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pPartial) } @@ -141004,10 +137406,6 @@ func _sqlite3ConstructBloomFilter(tls *libc.TLS, pWInfo uintptr, iLevel int32, p saved_pIdxPartExpr = (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = uintptr(0) (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr = uintptr(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) for cond := true; cond; cond = iLevel < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) { _sqlite3WhereExplainBloomFilter(tls, pParse, pWInfo, pLevel) @@ -141028,9 +137426,7 @@ func _sqlite3ConstructBloomFilter(tls *libc.TLS, pWInfo uintptr, iLevel int32, p pTabList = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList iSrc = int32((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom) pItem = pTabList + 8 + uintptr(iSrc)*104 - _ = libc.Int32FromInt32(0) pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab - _ = libc.Int32FromInt32(0) sz = _sqlite3LogEstToInt(tls, (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst) if sz < uint64(10000) { sz = uint64(10000) @@ -141053,6 +137449,7 @@ func _sqlite3ConstructBloomFilter(tls *libc.TLS, pWInfo uintptr, iLevel int32, p } goto _3 _3: + ; pTerm += 56 } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { @@ -141069,10 +137466,10 @@ func _sqlite3ConstructBloomFilter(tls *libc.TLS, pWInfo uintptr, iLevel int32, p if !(jj < n) { break } - _ = libc.Int32FromInt32(0) _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iCur, jj, r11+jj) goto _4 _4: + ; jj++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_FilterAdd), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, 0, r11, n) @@ -141135,10 +137532,7 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB mNoOmit = uint16(0) eDistinct = 0 pOrderBy = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy - _ = libc.Int32FromInt32(0) pTab = (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Find all WHERE clause constraints referring to this virtual table. ** Mark each term with the TERM_OK flag. Set nTerm to the number of ** terms found. @@ -141159,16 +137553,12 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&mUnusable != 0 { goto _1 } - _ = libc.Int32FromInt32(0) if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & ^libc.Int32FromInt32(WO_EQUIV) == 0 { goto _1 } if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) != 0 { goto _1 } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 && !(_constraintCompatibleWithOuterJoin(tls, pTerm, pSrc) != 0) { goto _1 } @@ -141177,6 +137567,7 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_OK)) goto _1 _1: + ; i++ pTerm += 56 } @@ -141203,7 +137594,6 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB } /* First case - a direct column references without a COLLATE operator */ if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { - _ = libc.Int32FromInt32(0) goto _5 } /* 2nd case - a column reference with a COLLATE operator. Only match @@ -141213,9 +137603,6 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB pE2 = v6 } if v7 && int32((*TExpr)(unsafe.Pointer(v6)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pE2)).FiTable == (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { /* The collating sequence name */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = (*TExpr)(unsafe.Pointer(pE2)).FiColumn if int32((*TExpr)(unsafe.Pointer(pE2)).FiColumn) < 0 { goto _5 @@ -141232,6 +137619,7 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB break goto _5 _5: + ; i++ } if i == n { @@ -141249,7 +137637,7 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB */ pIdxInfo = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(96)+(libc.Uint64FromInt64(12)+libc.Uint64FromInt64(8))*uint64(nTerm)+uint64(8)*uint64(nOrderBy)+uint64(40)+uint64(8)*uint64(nTerm)) if pIdxInfo == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1618, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1622, 0) return uintptr(0) } pHidden = pIdxInfo + 1*96 @@ -141305,12 +137693,6 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB /* The direct assignment in the previous line is possible only because ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The ** following asserts verify this fact. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32(op)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != 0 && _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight) != 0 { if j < int32(16) { mNoOmit = Tu16(int32(mNoOmit) | libc.Int32FromInt32(1)< */ _ = pParse - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Do a binary search to find the first sample greater than or equal ** to pRec. If pRec contains a single field, the set of samples to search ** is simply the aSample[] array. If the samples in aSample[] contain more @@ -141536,6 +137913,7 @@ func _whereKeyStats(tls *libc.TLS, pParse uintptr, pIdx uintptr, pRec uintptr, r } goto _2 _2: + ; n++ } } else { @@ -141560,7 +137938,6 @@ func _whereKeyStats(tls *libc.TLS, pParse uintptr, pIdx uintptr, pRec uintptr, r i = iSample / nField if res == 0 { /* Record pRec is equal to sample i */ - _ = libc.Int32FromInt32(0) *(*TtRowcnt)(unsafe.Pointer(aStat)) = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanLt + uintptr(iCol)*8)) *(*TtRowcnt)(unsafe.Pointer(aStat + 1*8)) = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanEq + uintptr(iCol)*8)) } else { @@ -141610,7 +137987,6 @@ func _whereRangeAdjust(tls *libc.TLS, pTerm uintptr, nNew TLogEst) (r TLogEst) { } else { if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) == 0 { nRet = TLogEst(int32(nRet) - libc.Int32FromInt32(20)) - _ = libc.Int32FromInt32(0) } } } @@ -141623,13 +137999,11 @@ func _whereRangeAdjust(tls *libc.TLS, pTerm uintptr, nNew TLogEst) (r TLogEst) { // ** Return the affinity for a single column of an index. // */ func _sqlite3IndexColumnAffinity(tls *libc.TLS, db uintptr, pIdx uintptr, iCol int32) (r int8) { - _ = libc.Int32FromInt32(0) if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { if _sqlite3IndexAffinityStr(tls, db, pIdx) == uintptr(0) { return int8(SQLITE_AFF_BLOB) } } - _ = libc.Int32FromInt32(0) return *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(iCol))) } @@ -141725,6 +138099,7 @@ func _whereRangeSkipScanEst(tls *libc.TLS, pParse uintptr, pLower uintptr, pUppe } goto _2 _2: + ; i++ } nDiff = nUpper - nLower @@ -141743,7 +138118,6 @@ func _whereRangeSkipScanEst(tls *libc.TLS, pParse uintptr, pLower uintptr, pUppe *(*int32)(unsafe.Pointer(pbDone)) = int32(1) } } else { - _ = libc.Int32FromInt32(0) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -141833,9 +138207,6 @@ func _whereRangeScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pLower iLower = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] iUpper = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] + (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[int32(1)] } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FaSortOrder + uintptr(nEq))) != 0 { /* The roles of pLower and pUpper are swapped for a DESC index */ t = pLower @@ -141902,10 +138273,8 @@ func _whereRangeScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pLower if iLwrIdx == iUprIdx { nNew = TLogEst(int32(nNew) - libc.Int32FromInt32(20)) } - _ = libc.Int32FromInt32(0) } else { nNew = int16(10) - _ = libc.Int32FromInt32(0) } if int32(nNew) < nOut { nOut = int32(nNew) @@ -141919,7 +138288,6 @@ func _whereRangeScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pLower } } } - _ = libc.Int32FromInt32(0) nNew = _whereRangeAdjust(tls, pLower, int16(nOut)) nNew = _whereRangeAdjust(tls, pUpper, nNew) /* TUNING: If there is both an upper and lower limit and neither limit @@ -141973,11 +138341,6 @@ func _whereEqualScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pExpr u p = (*TWhereLoop)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew)).Fu.Fbtree.FpIndex nEq = int32((*TWhereLoop)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew)).Fu.Fbtree.FnEq) *(*uintptr)(unsafe.Pointer(bp)) = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If values are not available for all fields of the index to the left ** of this one, no estimate can be made. Return SQLITE_NOTFOUND. */ if (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid < nEq-int32(1) { @@ -142035,7 +138398,6 @@ func _whereInScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pList uint nRecValid = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid rc = SQLITE_OK /* Number of rows for a single term */ nRowEst = uint64(0) /* Loop counter */ - _ = libc.Int32FromInt32(0) i = 0 for { if !(rc == SQLITE_OK && i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { @@ -142047,6 +138409,7 @@ func _whereInScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pList uint (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -142055,7 +138418,6 @@ func _whereInScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pList uint } *(*TtRowcnt)(unsafe.Pointer(pnRow)) = nRowEst } - _ = libc.Int32FromInt32(0) return rc } @@ -142178,7 +138540,6 @@ func _whereLoopXfer(tls *libc.TLS, db uintptr, pTo uintptr, pFrom uintptr) (r in // ** Delete a WhereLoop object // */ func _whereLoopDelete(tls *libc.TLS, db uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) _whereLoopClear(tls, db, p) _sqlite3DbNNFreeNN(tls, db, p) } @@ -142191,8 +138552,6 @@ func _whereLoopDelete(tls *libc.TLS, db uintptr, p uintptr) { func _whereInfoFree(tls *libc.TLS, db uintptr, pWInfo uintptr) { var p, pNext uintptr _, _ = p, pNext - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3WhereClauseClear(tls, pWInfo+104) for (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops != 0 { p = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops @@ -142240,8 +138599,6 @@ func _whereLoopCheaperProperSubset(tls *libc.TLS, pX uintptr, pY uintptr) (r int if int32((*TWhereLoop)(unsafe.Pointer(pX)).FrRun) > int32((*TWhereLoop)(unsafe.Pointer(pY)).FrRun) && int32((*TWhereLoop)(unsafe.Pointer(pX)).FnOut) > int32((*TWhereLoop)(unsafe.Pointer(pY)).FnOut) { return 0 } /* (1d) and (2a) */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TWhereLoop)(unsafe.Pointer(pX)).Fu.Fbtree.FnEq) < int32((*TWhereLoop)(unsafe.Pointer(pY)).Fu.Fbtree.FnEq) && (*TWhereLoop)(unsafe.Pointer(pX)).Fu.Fbtree.FpIndex == (*TWhereLoop)(unsafe.Pointer(pY)).Fu.Fbtree.FpIndex && int32((*TWhereLoop)(unsafe.Pointer(pX)).FnSkip) == 0 && int32((*TWhereLoop)(unsafe.Pointer(pY)).FnSkip) == 0 { return int32(1) /* Case 1 is true */ } @@ -142269,6 +138626,7 @@ func _whereLoopCheaperProperSubset(tls *libc.TLS, pX uintptr, pY uintptr) (r int } goto _2 _2: + ; j-- } if j < 0 { @@ -142276,6 +138634,7 @@ func _whereLoopCheaperProperSubset(tls *libc.TLS, pX uintptr, pY uintptr) (r int } /* (2c) */ goto _1 _1: + ; i-- } if (*TWhereLoop)(unsafe.Pointer(pX)).FwsFlags&uint32(WHERE_IDX_ONLY) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pY)).FwsFlags&uint32(WHERE_IDX_ONLY) == uint32(0) { @@ -142351,6 +138710,7 @@ func _whereLoopAdjustCost(tls *libc.TLS, p uintptr, pTemplate uintptr) { } goto _1 _1: + ; p = (*TWhereLoop)(unsafe.Pointer(p)).FpNextLoop } } @@ -142388,11 +138748,9 @@ func _whereLoopFindLesser(tls *libc.TLS, ppPrev uintptr, pTemplate uintptr) (r u /* In the current implementation, the rSetup value is either zero ** or the cost of building an automatic index (NlogN) and the NlogN ** is the same for compatible WhereLoops. */ - _ = libc.Int32FromInt32(0) /* whereLoopAddBtree() always generates and inserts the automatic index ** case first. Hence compatible candidate WhereLoops never have a larger ** rSetup. Call this SETUP-INVARIANT */ - _ = libc.Int32FromInt32(0) /* Any loop using an application-defined index (or PRIMARY KEY or ** UNIQUE constraint) with one or more == constraints is better ** than an automatic index. Unless it is a skip-scan. */ @@ -142413,11 +138771,12 @@ func _whereLoopFindLesser(tls *libc.TLS, ppPrev uintptr, pTemplate uintptr) (r u ** (2) pTemplate has an equal or lower cost than p. */ if (*TWhereLoop)(unsafe.Pointer(p)).Fprereq&(*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq == (*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq && int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) >= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) && int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut) >= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) { - _ = libc.Int32FromInt32(0) /* SETUP-INVARIANT above */ - break /* Cause p to be overwritten by pTemplate */ + /* SETUP-INVARIANT above */ + break /* Cause p to be overwritten by pTemplate */ } goto _1 _1: + ; ppPrev = p + 72 p = *(*uintptr)(unsafe.Pointer(ppPrev)) } @@ -142568,14 +138927,12 @@ func _whereLoopOutputAdjust(tls *libc.TLS, pWC uintptr, pLoop uintptr, nRow TLog _, _, _, _, _, _, _, _, _ = i, iReduce, j, notAllowed, pRight, pTerm, pX, p3, p4 notAllowed = ^((*TWhereLoop)(unsafe.Pointer(pLoop)).Fprereq | (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) iReduce = 0 /* pLoop->nOut should not exceed nRow-iReduce */ - _ = libc.Int32FromInt32(0) i = (*TWhereClause)(unsafe.Pointer(pWC)).FnBase pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa for { if !(i > 0) { break } - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll¬Allowed != uint64(0) { goto _1 } @@ -142602,6 +138959,7 @@ func _whereLoopOutputAdjust(tls *libc.TLS, pWC uintptr, pLoop uintptr, nRow TLog } goto _2 _2: + ; j-- } if j < 0 { @@ -142647,6 +139005,7 @@ func _whereLoopOutputAdjust(tls *libc.TLS, pWC uintptr, pLoop uintptr, nRow TLog } goto _1 _1: + ; i-- pTerm += 56 } @@ -142692,7 +139051,6 @@ func _whereRangeVectorLen(tls *libc.TLS, pParse uintptr, iCur int32, pIdx uintpt break } /* Comparison affinity */ idxaff = 0 - _ = libc.Int32FromInt32(0) pLhs = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft + 32)) + 8 + uintptr(i)*32))).FpExpr pRhs = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight if (*TExpr)(unsafe.Pointer(pRhs)).Fflags&uint32(EP_xIsSelect) != uint32(0) { @@ -142721,6 +139079,7 @@ func _whereRangeVectorLen(tls *libc.TLS, pParse uintptr, iCur int32, pIdx uintpt } goto _2 _2: + ; i++ } return i @@ -142765,16 +139124,12 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro pTop = uintptr(0) pBtm = uintptr(0) /* Top and bottom range constraints */ pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return (*TParse)(unsafe.Pointer(pParse)).Frc } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { opMask = libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) } else { - _ = libc.Int32FromInt32(0) opMask = libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IN) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_ISNULL) | libc.Int32FromInt32(WO_IS) } if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x4>>2)) != 0 || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x100>>8)) != 0 { @@ -142785,8 +139140,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro opMask &= ^(libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IN) | libc.Int32FromInt32(WO_IS)) } } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) saved_nEq = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq saved_nBtm = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm saved_nTop = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop @@ -142840,12 +139193,10 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro *(*Tu16)(unsafe.Pointer(v5))++ *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(v4)*8)) = pTerm (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = (saved_prereq | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) & ^(*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf - _ = libc.Int32FromInt32(0) if int32(eOp)&int32(WO_IN) != 0 { pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nIn = int32(46) - _ = libc.Int32FromInt32(0) /* The expression may actually be of the form (x, y) IN (SELECT...). ** In this case there is a separate term for each of (x) and (y). ** However, the nIn multiplier should only be applied once, not once @@ -142861,6 +139212,7 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro } goto _6 _6: + ; i++ } } else { @@ -142908,7 +139260,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro if int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0 { iCol = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_COLUMN_EQ) - _ = libc.Int32FromInt32(0) if iCol == -int32(1) || iCol >= 0 && int32(nInMul) == 0 && int32(saved_nEq) == int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol)-int32(1) { if iCol == -int32(1) || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x8>>3)) != 0 || int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol) == int32(1) && (*TIndex)(unsafe.Pointer(pProbe)).FonError != 0 && int32(eOp) == int32(WO_EQ) { *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_ONEROW) @@ -142933,9 +139284,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro /* Range constraints that come from the LIKE optimization are ** always used in pairs. */ pTop = pTerm + 1*56 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _whereLoopResize(tls, db, pNew, int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+int32(1)) != 0 { break } /* OOM */ @@ -142947,7 +139295,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = uint16(1) } } else { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(libc.Int32FromInt32(WHERE_COLUMN_RANGE) | libc.Int32FromInt32(WHERE_TOP_LIMIT)) (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = uint16(nVecLen) pTop = pTerm @@ -142966,7 +139313,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro ** values of nIn and nInMul. In other words, assuming that all ** "x IN(...)" terms are replaced with "x = ?". This block updates ** the value of pNew->nOut to account for pTerm (but not nIn/nInMul). */ - _ = libc.Int32FromInt32(0) if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_COLUMN_RANGE) != 0 { /* Adjust nOut using stat4 data. Or, if there is no stat4 ** data, using some other estimate. */ @@ -142976,10 +139322,7 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro *(*Tu16)(unsafe.Pointer(v11))++ v10 = *(*Tu16)(unsafe.Pointer(v11)) nEq = int32(v10) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 && int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) >= 0 { - _ = libc.Int32FromInt32(0) p12 = pNew + 22 *(*TLogEst)(unsafe.Pointer(p12)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p12))) + int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb)) p13 = pNew + 22 @@ -143036,7 +139379,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro ** it to pNew->rRun, which is currently set to the cost of the index ** seek only. Then, if this is a non-covering index, add the cost of ** visiting the rows in the main table. */ - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_IPK) { /* The pProbe->szIdxRow is low for an IPK table since the interior ** pages are small. Thus szIdxRow gives a good estimate of seek cost. @@ -143072,6 +139414,7 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid goto _1 _1: + ; pTerm = _whereScanNext(tls, bp) } (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = saved_prereq @@ -143092,7 +139435,6 @@ func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pPro ** the code). And, even if it is not, it should not be too much slower. ** On the other hand, the extra seeks could end up being significantly ** more expensive. */ - _ = libc.Int32FromInt32(0) if v22 = int32(saved_nEq) == int32(saved_nSkip) && int32(saved_nEq)+int32(1) < int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol) && int32(saved_nEq) == int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm) && int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x40>>6)) == 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x80>>7)) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_SkipScan)) == uint32(0) && int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(int32(saved_nEq)+int32(1))*2))) >= int32(42); v22 { v21 = _whereLoopResize(tls, db, pNew, int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+int32(1)) rc = v21 @@ -143165,6 +139507,7 @@ func _indexMightHelpWithOrderBy(tls *libc.TLS, pBuilder uintptr, pIndex uintptr, } goto _3 _3: + ; jj++ } } else { @@ -143184,12 +139527,14 @@ func _indexMightHelpWithOrderBy(tls *libc.TLS, pBuilder uintptr, pIndex uintptr, } goto _5 _5: + ; jj++ } } } goto _2 _2: + ; ii++ } return 0 @@ -143229,6 +139574,7 @@ func _whereUsablePartialIndex(tls *libc.TLS, iTab int32, jointype Tu8, pWC uintp } goto _1 _1: + ; i++ pTerm += 56 } @@ -143254,6 +139600,7 @@ func _exprIsCoveredByIndex(tls *libc.TLS, pExpr uintptr, pIdx uintptr, iTabCur i } goto _1 _1: + ; i++ } return 0 @@ -143326,6 +139673,7 @@ func _whereIsCoveringIndexWalkCallback(tls *libc.TLS, pWalk uintptr, pExpr uintp } goto _1 _1: + ; i++ } (*TCoveringIndexCheck)(unsafe.Pointer(pCk)).FbUnidx = uint8(1) @@ -143387,6 +139735,7 @@ func _whereIsCoveringIndex(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iTabCur } goto _1 _1: + ; i++ } if i >= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143469,8 +139818,6 @@ func _wherePartIdxExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, pPart uintpt var bNullRow int32 var db, p, pArg, pLeft, pRight uintptr _, _, _, _, _, _, _ = aff, bNullRow, db, p, pArg, pLeft, pRight - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TExpr)(unsafe.Pointer(pPart)).Fop) == int32(TK_AND) { _wherePartIdxExpr(tls, pParse, pIdx, (*TExpr)(unsafe.Pointer(pPart)).FpRight, pMask, iIdxCur, pItem) pPart = (*TExpr)(unsafe.Pointer(pPart)).FpLeft @@ -143578,9 +139925,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in pSrc = pTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 pTab = (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { - _ = libc.Int32FromInt32(0) /* An INDEXED BY clause specifies a particular index to use */ pProbe = *(*uintptr)(unsafe.Pointer(pSrc + 96)) } else { @@ -143651,7 +139996,6 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in ** of knowing how selective the index will ultimately be. It would ** not be unreasonable to make this value much larger. */ (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = int16(43) - _ = libc.Int32FromInt32(0) (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, rLogSize, (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut) (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_AUTO_INDEX) (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight @@ -143659,6 +140003,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -143688,7 +140033,6 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FpIndex = pProbe b = _indexMightHelpWithOrderBy(tls, pBuilder, pProbe, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor) /* The ONEPASS_DESIRED flags never occurs together with ORDER BY */ - _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_IPK) { /* Integer primary key index */ (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_IPK) @@ -143731,13 +140075,11 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in if *(*TBitmask)(unsafe.Pointer(bp + 168)) == libc.Uint64FromInt32(1)<<(int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1)) || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x1000>>12)) != 0 && !(int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x800>>11)) != 0) && *(*TBitmask)(unsafe.Pointer(bp + 168)) != uint64(0) { isCov = _whereIsCoveringIndex(tls, pWInfo, pProbe, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor) if isCov == uint32(0) { - _ = libc.Int32FromInt32(0) } else { *(*TBitmask)(unsafe.Pointer(bp + 168)) = uint64(0) *(*Tu32)(unsafe.Pointer(pNew + 48)) |= isCov if isCov&uint32(WHERE_IDX_ONLY) != 0 { } else { - _ = libc.Int32FromInt32(0) } } } else { @@ -143788,6 +140130,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -143821,6 +140164,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -143838,7 +140182,6 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in // ** Return true if pTerm is a virtual table LIMIT or OFFSET term. // */ func _isLimitTerm(tls *libc.TLS, pTerm uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return libc.BoolInt32(int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) >= int32(SQLITE_INDEX_CONSTRAINT_LIMIT) && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) <= int32(SQLITE_INDEX_CONSTRAINT_OFFSET)) } @@ -143879,7 +140222,6 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, pParse = (*TWhereInfo)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpParse pSrc = (*TWhereInfo)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 nConstraint = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pbIn)) = 0 (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq /* Set the usable flag on the subset of constraints identified by @@ -143897,12 +140239,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } /* Initialize the output fields of the sqlite3_index_info structure */ libc.Xmemset(tls, pUsage, 0, uint64(8)*uint64(nConstraint)) - _ = libc.Int32FromInt32(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = uintptr(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 0 @@ -143924,7 +140266,6 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, return rc } mxTerm = -int32(1) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm, 0, uint64(8)*uint64(nConstraint)) libc.Xmemset(tls, pNew+24, 0, uint64(24)) pIdxCons = *(*uintptr)(unsafe.Pointer(pIdxInfo + 8)) @@ -143938,12 +140279,11 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22435, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 *(*TBitmask)(unsafe.Pointer(pNew)) |= (*TWhereTerm)(unsafe.Pointer(pTerm1)).FprereqRight - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) = pTerm1 if iTerm > mxTerm { mxTerm = iTerm @@ -143982,10 +140322,8 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 0 *(*int32)(unsafe.Pointer(pIdxInfo + 80)) &= ^libc.Int32FromInt32(SQLITE_INDEX_SCAN_UNIQUE) *(*int32)(unsafe.Pointer(pbIn)) = int32(1) - _ = libc.Int32FromInt32(0) } } - _ = libc.Int32FromInt32(0) if _isLimitTerm(tls, pTerm1) != 0 && *(*int32)(unsafe.Pointer(pbIn)) != 0 { /* If there is an IN(...) term handled as an == (separate call to ** xFilter for each value on the RHS of the IN) and a LIMIT or @@ -144003,6 +140341,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -144015,14 +140354,14 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22435, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } - _ = libc.Int32FromInt32(0) (*(*struct { FidxNum int32 F__ccgo4 uint8 @@ -144167,7 +140506,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -144191,7 +140530,6 @@ func Xsqlite3_vtab_distinct(tls *libc.TLS, pIdxInfo uintptr) (r int32) { var pHidden uintptr _ = pHidden pHidden = pIdxInfo + 1*96 - _ = libc.Int32FromInt32(0) return (*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FeDistinct } @@ -144218,6 +140556,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -144229,6 +140568,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -144274,13 +140614,11 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, mBest, mBestNoIn, mNext, mPrev, mThis, nConstraint, p, pNew, pParse, pSrc, pWC, pWInfo, rc, seenZero, seenZeroNoIN, v1, v2 rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* True to retry with LIMIT/OFFSET disabled */ - _ = libc.Int32FromInt32(0) pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew pSrc = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 - _ = libc.Int32FromInt32(0) p = _allocateIndexInfo(tls, pWInfo, pWC, mUnusable, pSrc, bp+4) if p == uintptr(0) { return int32(SQLITE_NOMEM) @@ -144297,7 +140635,6 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn /* First call xBestIndex() with all constraints usable. */ rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, bp+8) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { - _ = libc.Int32FromInt32(0) rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) } /* If the call to xBestIndex() with all terms enabled produced a plan @@ -144318,7 +140655,6 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn ** xBestIndex again, this time with IN(...) terms disabled. */ if *(*int32)(unsafe.Pointer(bp)) != 0 { rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(WO_IN), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) - _ = libc.Int32FromInt32(0) mBestNoIn = (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq & ^mPrereq if mBestNoIn == uint64(0) { seenZero = int32(1) @@ -144329,7 +140665,6 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn ** in the set of terms that apply to the current virtual table. */ for rc == SQLITE_OK { mNext = uint64(-libc.Int32FromInt32(1)) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nConstraint) { @@ -144341,6 +140676,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -144473,16 +140809,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144514,11 +140853,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -144546,10 +140887,6 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { /* Loop over the tables in the join, from left to right */ pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew /* Verify that pNew has already been initialized */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit = uint32(SQLITE_QUERY_PLANNER_LIMIT) iTab = 0 pItem = pTabList + 8 @@ -144593,6 +140930,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144606,7 +140944,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22423, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22461, 0) rc = SQLITE_OK } else { break @@ -144614,6 +140952,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -144672,7 +141011,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is ** automatically order-distinct. */ - _ = libc.Int32FromInt32(0) if nLoop != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OrderByIdxJoin)) != uint32(0) { return 0 } @@ -144753,7 +141091,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, /* IN terms are only valid for sorting in the ORDER BY LIMIT ** optimization, and then only if they are actually used ** by the query plan */ - _ = libc.Int32FromInt32(0) j = 0 for { if !(j < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) && pTerm != *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8))) { @@ -144761,6 +141098,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -144771,7 +141109,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse pColl1 = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr) pColl2 = _sqlite3ExprCompareCollSeq(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr) - _ = libc.Int32FromInt32(0) if pColl2 == uintptr(0) || _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, (*TCollSeq)(unsafe.Pointer(pColl2)).FzName) != 0 { goto _2 } @@ -144779,6 +141116,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -144794,8 +141132,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } else { nKeyCol = (*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol nColumn = (*TIndex)(unsafe.Pointer(pIndex)).FnColumn - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* All relevant terms of the index must also be non-NULL in order ** for isOrderDistinct to be true. So the isOrderDistint value ** computed here might be a false positive. Corrections will be @@ -144816,7 +141152,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break } bOnce = uint8(1) /* True to run the ORDER BY search loop */ - _ = libc.Int32FromInt32(0) if j < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) && j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { eOp = (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)))).FeOperator /* Skip over == and IS and ISNULL terms. (Also skip IN terms when @@ -144849,12 +141184,12 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break } if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { - _ = libc.Int32FromInt32(0) bOnce = uint8(0) break } goto _7 _7: + ; i++ } } @@ -144932,6 +141267,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -144970,6 +141306,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -144997,11 +141334,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -145024,6 +141363,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -145057,8 +141397,6 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, // ** SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0 // */ func _sqlite3WhereIsSorted(tls *libc.TLS, pWInfo uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return int32(uint32(*(*uint8)(unsafe.Pointer(pWInfo + 68)) & 0x8 >> 3)) } @@ -145072,8 +141410,6 @@ func _sqlite3WhereIsSorted(tls *libc.TLS, pWInfo uintptr) (r int32) { func _whereSortingCost(tls *libc.TLS, pWInfo uintptr, nRow TLogEst, nOrderBy int32, nSorted int32) (r TLogEst) { var nCol, rSortCost TLogEst _, _ = nCol, rSortCost - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* TUNING: sorting cost proportional to the number of output columns: */ nCol = _sqlite3LogEst(tls, uint64(((*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FpEList)).FnExpr+int32(59))/int32(30))) rSortCost = int16(int32(nRow) + int32(nCol)) @@ -145100,7 +141436,6 @@ func _whereSortingCost(tls *libc.TLS, pWInfo uintptr, nRow TLogEst, nOrderBy int ** reduces the number of output rows by a factor of 2 */ if int32(nRow) > int32(10) { nRow = TLogEst(int32(nRow) - libc.Int32FromInt32(10)) - _ = libc.Int32FromInt32(0) } } } @@ -145156,7 +141491,6 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) v1 = v2 } mxChoice = v1 - _ = libc.Int32FromInt32(0) /* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this ** case the purpose of this call is to estimate the number of rows returned ** by the overall query. Once this estimate has been obtained, the caller @@ -145187,6 +141521,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -145201,8 +141536,6 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) aSortCost = pX libc.Xmemset(tls, aSortCost, 0, uint64(2)*uint64(nOrderBy)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Seed the search with a single WherePath containing zero WhereLoops. ** ** TUNING: Do not let the number of iterations go above 28. If the cost @@ -145214,9 +141547,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) v4 = int32(48) } (*(*TWherePath)(unsafe.Pointer(aFrom))).FnRow = int16(v4) - _ = libc.Int32FromInt32(0) nFrom = int32(1) - _ = libc.Int32FromInt32(0) if nOrderBy != 0 { /* If nLoop is zero, then there are no FROM terms in the query. Since ** in this case the query may return a maximum of one row, the results @@ -145262,7 +141593,6 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) ** to run less than 1.25 times. It is tempting to also exclude ** automatic index usage on an outer loop, but sometimes an automatic ** index is useful in the outer loop of a correlated subquery. */ - _ = libc.Int32FromInt32(0) goto _8 } /* At this point, pWLoop is a candidate to be the next loop. @@ -145313,6 +141643,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -145378,16 +141709,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -145398,10 +141732,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22458, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22496, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -145417,9 +141752,9 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } - _ = libc.Int32FromInt32(0) /* Load the lowest cost path into pWInfo */ iLoop = 0 for { @@ -145434,6 +141769,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145476,7 +141812,6 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_SORTBYGROUP) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr && nLoop > 0 { *(*TBitmask)(unsafe.Pointer(bp + 24)) = uint64(0) nOrder = int32(_wherePathSatisfiesOrderBy(tls, pWInfo, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, uint16(0), uint16(nLoop-int32(1)), *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(nLoop-int32(1))*8)), bp+24)) - _ = libc.Int32FromInt32(0) if nOrder == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 3, 0x8) (*TWhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = *(*TBitmask)(unsafe.Pointer(bp + 24)) @@ -145513,7 +141848,6 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { return 0 } - _ = libc.Int32FromInt32(0) pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -145544,7 +141878,6 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { if !(pIdx != 0) { break } - _ = libc.Int32FromInt32(0) if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != libc.Int32FromInt32(OE_None)) || (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) || int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) > int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(8)) { goto _1 } @@ -145569,6 +141902,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145586,13 +141920,13 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags != 0 { (*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut = libc.Int16FromInt32(1) (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FpWLoop = pLoop - _ = libc.Int32FromInt32(0) (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf = uint64(1) /* sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); */ (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FiTabCur = iCur (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut = int16(1) @@ -145686,12 +142020,8 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi var tabUsed TBitmask _, _, _, _, _, _, _, _, _ = hasRightJoin, i, nByte, pEnd, pItem, pLoop, pTerm, tabUsed, p4 /* Preconditions checked by the caller */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* These two preconditions checked by the caller combine to guarantee ** condition (1) of the header comment */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) tabUsed = _sqlite3WhereExprListUsage(tls, pWInfo+592, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet) if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { tabUsed |= _sqlite3WhereExprListUsage(tls, pWInfo+592, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy) @@ -145729,6 +142059,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -145746,6 +142077,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -145753,9 +142085,9 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi libc.Xmemmove(tls, pWInfo+856+uintptr(i)*104, pWInfo+856+uintptr(i+int32(1))*104, uint64(nByte)) } (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- - _ = libc.Int32FromInt32(0) goto _1 _1: + ; i-- } return notReady @@ -145788,8 +142120,6 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { var reqFlags uint32 _, _, _, _, _, _ = i, nSearch, pItem, pLoop, pTab, reqFlags nSearch = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { @@ -145812,6 +142142,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -145830,10 +142161,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 - _ = libc.Int32FromInt32(0) + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 for { @@ -145843,11 +142173,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -145857,7 +142185,6 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 { v2 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr } else { @@ -145878,7 +142205,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) } @@ -145889,6 +142216,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -145918,6 +142246,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -146024,9 +142353,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrExplain, b, bFordelete, bOnerow, db, iCur, iDb, iIndexCur, iOnce, ii, n, nByteWInfo, nTabList, notReady, op, op1, p, pInfo, pIx, pJ, pLevel, pLoop, pMaskSet, pPk, pRJ, pSrc, pT, pTab, pTabItem, pVTab, pWInfo, pX, rc, v, wsFlags, wsFlags1, v1, v12, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v3, v4, p10, p11, p7, p8, p9 /* Will become the return value of this function */ v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Return code */ bFordelete = uint8(0) /* OPFLAG_FORDELETE or zero, as appropriate */ - _ = libc.Int32FromInt32(0) /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */ - _ = libc.Int32FromInt32(0) /* Variable initialization */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb libc.Xmemset(tls, bp, 0, uint64(56)) @@ -146039,7 +142366,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22476, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22514, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -146087,7 +142414,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect = pSelect libc.Xmemset(tls, pWInfo+65, 0, uint64(libc.UintptrFromInt32(0)+104)-uint64(libc.UintptrFromInt32(0)+65)) libc.Xmemset(tls, pWInfo+856, 0, uint64(104)+uint64(nTabList)*uint64(104)) - _ = libc.Int32FromInt32(0) /* ONEPASS defaults to OFF */ + /* ONEPASS defaults to OFF */ pMaskSet = pWInfo + 592 (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn = 0 *(*int32)(unsafe.Pointer(pMaskSet + 8)) = -int32(99) /* Initialize ix[0] to a value that can never be @@ -146096,7 +142423,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWInfo = pWInfo (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWC = pWInfo + 104 (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpNew = pWInfo + uintptr(nByteWInfo) - _ = libc.Int32FromInt32(0) _whereLoopInit(tls, (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpNew) /* Split the WHERE clause into separate subexpressions where each ** subexpression is separated by an AND operator. @@ -146112,7 +142438,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22504, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22542, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -146134,6 +142460,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -146185,8 +142512,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere goto _6 } pX = (*TWhereTerm)(unsafe.Pointer(pT)).FpExpr - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TWhereTerm)(unsafe.Pointer(pT)).FprereqAll == uint64(0) && (nTabList == 0 || _exprIsDeterministic(tls, pX) != 0) && !((*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)) != uint32(0) && int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0) { _sqlite3ExprIfFalse(tls, pParse, pX, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak, int32(SQLITE_JUMPIFNULL)) p7 = pT + 18 @@ -146194,6 +142519,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -146257,14 +142583,12 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere *(*TLogEst)(unsafe.Pointer(p10)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p10))) - libc.Int32FromInt32(30)) } } - _ = libc.Int32FromInt32(0) if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ReverseOrder) != uint64(0) { _whereReverseScanOrder(tls, pWInfo) } if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto whereBeginError } - _ = libc.Int32FromInt32(0) /* Attempt to omit tables from a join that do not affect the result. ** See the comment on whereOmitNoopJoin() for further information. ** @@ -146279,7 +142603,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) >= int32(2) && pResultSet != uintptr(0) && 0 == int32(wctrlFlags)&int32(WHERE_AGG_DISTINCT) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OmitNoopJoin)) == uint32(0) { notReady = _whereOmitNoopJoin(tls, pWInfo, notReady) nTabList = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - _ = libc.Int32FromInt32(0) } /* Check to see if there are any SEARCH loops that might benefit from ** using a Bloom filter. @@ -146308,11 +142631,9 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** use a one-pass approach, and this is not set accurately for scans ** that use the OR optimization. */ - _ = libc.Int32FromInt32(0) if int32(wctrlFlags)&int32(WHERE_ONEPASS_DESIRED) != 0 { wsFlags = int32((*TWhereLoop1)(unsafe.Pointer((*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FpWLoop)).FwsFlags) bOnerow = libc.BoolInt32(wsFlags&int32(WHERE_ONEROW) != 0) - _ = libc.Int32FromInt32(0) if bOnerow != 0 || 0 != int32(wctrlFlags)&int32(WHERE_ONEPASS_MULTIROW) && !(int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && (0 == wsFlags&int32(WHERE_MULTI_OR) || int32(wctrlFlags)&int32(WHERE_DUPLICATES_OK) != 0) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OnePass)) == uint32(0) { if bOnerow != 0 { v12 = int32(ONEPASS_SINGLE) @@ -146359,7 +142680,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere *(*int32)(unsafe.Pointer(pWInfo + 40)) = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor } _sqlite3OpenTable(tls, pParse, (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor, iDb, pTab, op) - _ = libc.Int32FromInt32(0) if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) == ONEPASS_OFF && int32((*TTable)(unsafe.Pointer(pTab)).FnCol) < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_HasGenerated)|libc.Int32FromInt32(TF_WithoutRowid)) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_AUTO_INDEX)|libc.Int32FromInt32(WHERE_BLOOMFILTER)) == uint32(0) { /* If we know that only a prefix of the record will be used, ** it is advantageous to reduce the "column count" field in @@ -146372,11 +142692,11 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), uintptr(int64(n)), -int32(3)) - _ = libc.Int32FromInt32(0) } _sqlite3VdbeChangeP5(tls, v, uint16(bFordelete)) } else { @@ -146389,7 +142709,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere pIx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex op1 = int32(OP_OpenRead) /* iAuxArg is always set to a positive value if ONEPASS is possible */ - _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { /* This is one term of an OR-optimization using the PRIMARY KEY of a ** WITHOUT ROWID table. No need for a separate index */ @@ -146399,7 +142718,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) != ONEPASS_OFF { pJ = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FpIndex iIndexCur = iAuxArg - _ = libc.Int32FromInt32(0) for pJ != 0 && pJ != pIx { iIndexCur++ pJ = (*TIndex)(unsafe.Pointer(pJ)).FpNext @@ -146425,9 +142743,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } } (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iIndexCur - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if op1 != 0 { _sqlite3VdbeAddOp3(tls, v, op1, iIndexCur, int32((*TIndex)(unsafe.Pointer(pIx)).Ftnum), iDb) _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIx) @@ -146459,7 +142774,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere v23 = *(*int32)(unsafe.Pointer(v24)) (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn = v23 _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn) - _ = libc.Int32FromInt32(0) if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, int32(1)) pInfo = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(1), 0) @@ -146482,6 +142796,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -146513,7 +142828,6 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3VdbeJumpHere(tls, v, iOnce) } } - _ = libc.Int32FromInt32(0) if wsFlags1&(libc.Int32FromInt32(WHERE_AUTO_INDEX)|libc.Int32FromInt32(WHERE_BLOOMFILTER)) != 0 { if wsFlags1&int32(WHERE_AUTO_INDEX) != 0 { _constructAutomaticIndex(tls, pParse, pWInfo+104, notReady, pLevel) @@ -146533,6 +142847,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -146540,6 +142855,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146610,6 +142926,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -146657,7 +142974,6 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { if !(j1 > 0) { break } - _ = libc.Int32FromInt32(0) _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop+int32(1)) if int32((*TInLoop)(unsafe.Pointer(pIn)).FeEndLoopOp) != int32(OP_Noop) { if (*TInLoop)(unsafe.Pointer(pIn)).FnPrefix != 0 { @@ -146687,6 +143003,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -146703,9 +143020,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { ws = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags) addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfPos), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) - _ = libc.Int32FromInt32(0) if ws&int32(WHERE_IDX_ONLY) == 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur) } if ws&int32(WHERE_INDEXED) != 0 || ws&int32(WHERE_MULTI_OR) != 0 && *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) != 0 { @@ -146726,9 +143041,9 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } - _ = libc.Int32FromInt32(0) i = 0 pLevel = pWInfo + 856 for { @@ -146738,7 +143053,6 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { pIdx1 = uintptr(0) pTabItem = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab - _ = libc.Int32FromInt32(0) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop /* Do RIGHT JOIN processing. Generate code that will output the ** unmatched rows of the right operand of the RIGHT JOIN with @@ -146793,21 +143107,18 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { k = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBody + int32(1) pOp = _sqlite3VdbeGetOp(tls, v, k) pLastOp = pOp + uintptr(last-k)*24 - _ = libc.Int32FromInt32(0) for { if (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 != (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur { /* no-op */ } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) || int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Offset) { x = (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 - _ = libc.Int32FromInt32(0) if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Offset) { /* Do not need to translate the column number */ } else { if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pPk = _sqlite3PrimaryKeyIndex(tls, pTab) x = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(x)*2))) - _ = libc.Int32FromInt32(0) } else { x = int32(_sqlite3StorageColumnToTable(tls, pTab, int16(x))) } @@ -146821,7 +143132,6 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { ** reference. Verify that this is harmless - that the ** table being referenced really is open. */ - _ = libc.Int32FromInt32(0) } } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Rowid) { @@ -146836,6 +143146,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -146845,6 +143156,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -147123,7 +143435,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22522, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22560, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -147206,7 +143519,6 @@ func _percent_rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintpt var p uintptr _ = p _ = nArg - _ = libc.Int32FromInt32(0) _ = apArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) if p != 0 { @@ -147218,7 +143530,6 @@ func _percent_rankInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr var p uintptr _ = p _ = nArg - _ = libc.Int32FromInt32(0) _ = apArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) (*TCallCount)(unsafe.Pointer(p)).FnStep++ @@ -147252,7 +143563,6 @@ func _cume_distStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) var p uintptr _ = p _ = nArg - _ = libc.Int32FromInt32(0) _ = apArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) if p != 0 { @@ -147264,7 +143574,6 @@ func _cume_distInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { var p uintptr _ = p _ = nArg - _ = libc.Int32FromInt32(0) _ = apArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) (*TCallCount)(unsafe.Pointer(p)).FnStep++ @@ -147303,14 +143612,13 @@ type NtileCtx = TNtileCtx func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) _ = nArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) if p != 0 { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22578, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22616, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147320,7 +143628,6 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { func _ntileInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { var p uintptr _ = p - _ = libc.Int32FromInt32(0) _ = nArg _ = apArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) @@ -147341,7 +143648,6 @@ func _ntileValueFunc(tls *libc.TLS, pCtx uintptr) { nLarge = (*TNtileCtx)(unsafe.Pointer(p)).FnTotal - (*TNtileCtx)(unsafe.Pointer(p)).FnParam*int64(nSize) iSmall = nLarge * int64(nSize+libc.Int32FromInt32(1)) iRow = (*TNtileCtx)(unsafe.Pointer(p)).FiRow - _ = libc.Int32FromInt32(0) if iRow < iSmall { Xsqlite3_result_int64(tls, pCtx, int64(1)+iRow/int64(nSize+libc.Int32FromInt32(1))) } else { @@ -147452,10 +143758,10 @@ var _lagName = [4]int8{'l', 'a', 'g'} // */ func _noopStepFunc(tls *libc.TLS, p uintptr, n int32, a uintptr) { /*NO_TEST*/ - _ = p /*NO_TEST*/ - _ = n /*NO_TEST*/ - _ = a /*NO_TEST*/ - _ = libc.Int32FromInt32(0) /*NO_TEST*/ + _ = p /*NO_TEST*/ + _ = n /*NO_TEST*/ + _ = a /*NO_TEST*/ + /*NO_TEST*/ } /*NO_TEST*/ @@ -147634,10 +143940,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22623, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22661, libc.VaList(bp+8, zName)) } return p } @@ -147688,12 +143995,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22642, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22680, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22713, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22751, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -147766,12 +144073,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8134) } break } goto _1 _1: + ; i++ } } @@ -147819,8 +144127,6 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( _, _, _, _, _, _, _, _, _, _ = f, i, i1, iCol, nSrc, p, pDup, pParse, pWin, v4 p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this function is being called from within a scalar sub-select ** that used by the SELECT statement being processed, only process ** TK_COLUMN expressions that refer to it (the outer SELECT). Do @@ -147841,6 +144147,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -147859,11 +144166,11 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( break } if *(*uintptr)(unsafe.Pointer(pExpr + 64)) == pWin { - _ = libc.Int32FromInt32(0) return int32(WRC_Prune) } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -147889,6 +144196,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -147901,7 +144209,6 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } if (*TWindowRewrite1)(unsafe.Pointer(p)).FpSub != 0 { f = int32((*TExpr)(unsafe.Pointer(pExpr)).Fflags & uint32(EP_Collate)) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Static)) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Static)) @@ -147961,7 +144268,6 @@ func _selectWindowRewriteEList(tls *libc.TLS, pParse uintptr, pWin uintptr, pSrc defer tls.Free(96) var _ /* sRewrite at bp+48 */ TWindowRewrite var _ /* sWalker at bp+0 */ TWalker - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(48)) libc.Xmemset(tls, bp+48, 0, uint64(40)) (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpSub = *(*uintptr)(unsafe.Pointer(ppSub)) @@ -148021,6 +144327,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -148048,8 +144355,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt bp := tls.Alloc(16) defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { - _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22776, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22814, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -148146,8 +144452,6 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if !(pWin != 0) { break } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pArgs = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) if (*TFuncDef)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpWFunc)).FfuncFlags&uint32(SQLITE_SUBTYPE) != 0 { _selectWindowRewriteEList(tls, pParse, pMWin, pSrc, pArgs, pTab, bp) @@ -148182,6 +144486,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -148191,11 +144496,11 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { ** keep everything legal in this case. */ if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1722)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1726)) } pSub = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), pSrc, pWhere, pGroupBy, pHaving, pSort, uint32(0), uintptr(0)) (*TSelect)(unsafe.Pointer(p)).FpSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) - _ = libc.Int32FromInt32(0) /* Due to db->mallocFailed test inside + /* Due to db->mallocFailed test inside ** of sqlite3DbMallocRawNN() called from ** sqlite3SrcListAppend() */ if (*TSelect)(unsafe.Pointer(p)).FpSrc != 0 { @@ -148232,7 +144537,6 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { ** result-set or ORDER BY clause of the SELECT statement p. */ _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3DbFree), pTab) } - _ = libc.Int32FromInt32(0) return rc } @@ -148318,11 +144622,6 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 pWin = uintptr(0) bImplicitFrame = 0 /* Parser assures the following: */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eType == 0 { bImplicitFrame = int32(1) eType = int32(TK_RANGE) @@ -148342,7 +144641,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22802, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22840, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -148361,6 +144660,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -148408,22 +144708,21 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22834 + zErr = __ccgo_ts + 22872 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22851 + zErr = __ccgo_ts + 22889 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22867 + zErr = __ccgo_ts + 22905 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22925, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { - _ = libc.Int32FromInt32(0) (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy, 0) } _sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FzBase) @@ -148440,14 +144739,11 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint // */ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(p + 64)) = pWin *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22958, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148586,7 +144882,6 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } p = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc if (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) != int32(TK_UNBOUNDED) { - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, pList, 0, 0) v11 = pParse + 52 @@ -148596,7 +144891,6 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { (*TWindow)(unsafe.Pointer(pWin)).FregApp = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(3) if pKeyInfo != 0 && int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpWFunc)).FzName + 1))) == int32('i') { - _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags)) = uint8(KEYINFO_ORDER_DESC) } _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, int32(2)) @@ -148625,6 +144919,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148644,17 +144939,14 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { _, _, _ = regString, regZero, v v = _sqlite3GetVdbe(tls, pParse) regZero = _sqlite3GetTempReg(tls, pParse) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regZero) if eCond >= int32(WINDOW_STARTING_NUM) { regString = _sqlite3GetTempReg(tls, pParse) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1648, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1652, -int32(1)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regString, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) _sqlite3VdbeChangeP5(tls, v, uint16(libc.Int32FromInt32(SQLITE_AFF_NUMERIC)|libc.Int32FromInt32(SQLITE_JUMPIFNULL))) - _ = libc.Int32FromInt32(0) } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_MustBeInt), reg, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) - _ = libc.Int32FromInt32(0) } _sqlite3VdbeAddOp3(tls, v, _aOp1[eCond], regZero, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_AFF_NUMERIC)) @@ -148669,11 +144961,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22967, - 1: __ccgo_ts + 23020, - 2: __ccgo_ts + 22522, - 3: __ccgo_ts + 23071, - 4: __ccgo_ts + 23123, + 0: __ccgo_ts + 23005, + 1: __ccgo_ts + 23058, + 2: __ccgo_ts + 22560, + 3: __ccgo_ts + 23109, + 4: __ccgo_ts + 23161, } var _aOp1 = [5]int32{ @@ -148694,7 +144986,6 @@ func _windowArgCount(tls *libc.TLS, pWin uintptr) (r int32) { var pList uintptr var v1 int32 _, _ = pList, v1 - _ = libc.Int32FromInt32(0) pList = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) if pList != 0 { v1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr @@ -148837,6 +145128,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -148881,10 +145173,8 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse v2 = _windowArgCount(tls, pWin) } nArg = v2 - _ = libc.Int32FromInt32(0) /* All OVER clauses in the same window function aggregate step must ** be the same. */ - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nArg) { @@ -148897,6 +145187,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -148915,16 +145206,11 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse _sqlite3VdbeJumpHere(tls, v, addrIsNull) } else { if (*TWindow)(unsafe.Pointer(pWin)).FregApp != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)-bInverse, int32(1)) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FxSFunc != __ccgo_fp(_noopStepFunc) { addrIf = 0 if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) regTmp = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+nArg, regTmp) addrIf = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNot), regTmp, 0, int32(1)) @@ -148932,7 +145218,6 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } if (*TWindow)(unsafe.Pointer(pWin)).FbExprArgs != 0 { iOp = _sqlite3VdbeCurrentAddr(tls, v) - _ = libc.Int32FromInt32(0) nArg = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)))).FnExpr regArg = _sqlite3GetTempRange(tls, pParse, nArg) _sqlite3ExprCodeExprList(tls, pParse, *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)), regArg, 0, uint8(0)) @@ -148947,12 +145232,11 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pColl = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) + 8))).FpExpr) _sqlite3VdbeAddOp4(tls, v, int32(OP_CollSeq), 0, 0, 0, pColl, -int32(2)) } @@ -148975,6 +145259,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149010,7 +145295,6 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { _sqlite3VdbeJumpHere(tls, v, _sqlite3VdbeCurrentAddr(tls, v)-int32(2)) } else { if (*TWindow)(unsafe.Pointer(pWin)).FregApp != 0 { - _ = libc.Int32FromInt32(0) } else { nArg = _windowArgCount(tls, pWin) if bFin != 0 { @@ -149026,6 +145310,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149049,7 +145334,6 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { regCPeer = 0 /* Current peer values */ regRowid = 0 /* AggStep rowid value */ regPeer = 0 - _ = libc.Int32FromInt32(0) csr = (*TWindow)(unsafe.Pointer(pMWin)).FcsrApp if (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { v1 = (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy)).FnExpr @@ -149075,6 +145359,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -149152,7 +145437,6 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { break } pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc - _ = libc.Int32FromInt32(0) if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_first_valueName)) { csr = (*TWindow)(unsafe.Pointer(pWin)).FcsrApp lbl = _sqlite3VdbeMakeLabel(tls, pParse) @@ -149211,6 +145495,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149237,7 +145522,6 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { break } pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) if nArg > _windowArgCount(tls, pWin) { v2 = nArg @@ -149251,13 +145535,13 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)) } if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && (*TWindow)(unsafe.Pointer(pWin)).FcsrApp != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp1(tls, v, int32(OP_ResetSorter), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)) } } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -149288,6 +145572,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149365,8 +145650,6 @@ func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal /* Read the peer-value from each cursor into a register */ _windowReadPeerValues(tls, p, csr1, reg1) _windowReadPeerValues(tls, p, csr2, reg2) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_DESC) != 0 { switch op { case int32(OP_Ge): @@ -149374,7 +145657,6 @@ func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal case int32(OP_Gt): op = int32(OP_Lt) default: - _ = libc.Int32FromInt32(0) op = int32(OP_Ge) break } @@ -149409,8 +145691,7 @@ func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), reg2, lbl) case int32(OP_Le): _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), reg2, lbl) - default: - _ = libc.Int32FromInt32(0) /* no-op */ + default: /* no-op */ break } _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrDone) @@ -149436,7 +145717,7 @@ func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal ** the add/subtract is skipped for these, as required. If reg1 is a NULL, ** then the arithmetic is performed, but since adding or subtracting from ** NULL is always NULL anyway, this case is handled as required too. */ - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1648, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1652, -int32(1)) addrGe = _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regString, 0, reg1) if op == int32(OP_Ge) && arith == int32(OP_Add) || op == int32(OP_Le) && arith == int32(OP_Subtract) { _sqlite3VdbeAddOp3(tls, v, op, reg2, lbl, reg1) @@ -149451,7 +145732,6 @@ func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal _sqlite3VdbeAppendP4(tls, v, pColl, -int32(2)) _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) _sqlite3VdbeResolveLabel(tls, v, addrDone) - _ = libc.Int32FromInt32(0) _sqlite3ReleaseTempReg(tls, pParse, reg1) _sqlite3ReleaseTempReg(tls, pParse, reg2) } @@ -149479,13 +145759,11 @@ func _windowCodeOp(tls *libc.TLS, p uintptr, op int32, regCountdown int32, jumpO /* Special case - WINDOW_AGGINVERSE is always a no-op if the frame ** starts with UNBOUNDED PRECEDING. */ if op == int32(WINDOW_AGGINVERSE) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_UNBOUNDED) { - _ = libc.Int32FromInt32(0) return 0 } if regCountdown > 0 { if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { addrNextRange = _sqlite3VdbeCurrentAddr(tls, v) - _ = libc.Int32FromInt32(0) if op == int32(WINDOW_AGGINVERSE) { if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { _windowCodeRangeTest(tls, p, int32(OP_Le), (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, regCountdown, (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, lblDone) @@ -149524,7 +145802,6 @@ func _windowCodeOp(tls *libc.TLS, p uintptr, op int32, regCountdown int32, jumpO } _sqlite3ReleaseTempReg(tls, pParse, regRowid1) _sqlite3ReleaseTempReg(tls, pParse, regRowid2) - _ = libc.Int32FromInt32(0) } switch op { case int32(WINDOW_RETURN_ROW): @@ -149535,17 +145812,14 @@ func _windowCodeOp(tls *libc.TLS, p uintptr, op int32, regCountdown int32, jumpO csr = (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr reg = (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Freg if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid, int32(1)) } else { _windowAggStep(tls, p, pMWin, csr, int32(1), (*TWindowCodeArg)(unsafe.Pointer(p)).FregArg) } default: - _ = libc.Int32FromInt32(0) csr = (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr reg = (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Freg if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid, int32(1)) } else { _windowAggStep(tls, p, pMWin, csr, 0, (*TWindowCodeArg)(unsafe.Pointer(p)).FregArg) @@ -149653,6 +145927,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -150042,9 +146317,6 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin regFlushPart = 0 /* Label just before sqlite3WhereEnd() code */ regStart = 0 /* Value of PRECEDING */ regEnd = 0 /* Value of FOLLOWING */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) lblWhereEnd = _sqlite3VdbeMakeLabel(tls, pParse) /* Fill in the context object */ libc.Xmemset(tls, bp, 0, uint64(72)) @@ -150144,6 +146416,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -150209,7 +146482,6 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeJumpHere(tls, v, addrGe) } if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_RANGE) && regEnd != 0 { - _ = libc.Int32FromInt32(0) _sqlite3VdbeAddOp3(tls, v, int32(OP_Subtract), regStart, regEnd, regStart) } if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) != int32(TK_UNBOUNDED) { @@ -150316,7 +146588,6 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin addrBreak1 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), regStart, int32(1)) addrBreak2 = _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), 0, int32(1)) } else { - _ = libc.Int32FromInt32(0) addrStart = _sqlite3VdbeCurrentAddr(tls, v) addrBreak1 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), regEnd, int32(1)) addrBreak2 = _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, int32(1)) @@ -150459,7 +146730,6 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { var pLoop, pNext, v1 uintptr var v3 bool _, _, _, _, _, _, _ = cnt, mxSelect, pLoop, pNext, v1, v2, v3 - _ = libc.Int32FromInt32(0) if (*TSelect)(unsafe.Pointer(p)).FpPrior != 0 { pNext = uintptr(0) pLoop = p @@ -150475,11 +146745,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23173 + v1 = __ccgo_ts + 23211 } else { - v1 = __ccgo_ts + 23182 + v1 = __ccgo_ts + 23220 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23188, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23226, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -150488,7 +146758,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23230, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23268, 0) } } } @@ -150577,7 +146847,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23302, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -156890,103 +153160,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -157007,8 +153277,6 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u func _yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { var yytos, v1, v2 uintptr _, _, _ = yytos, v1, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v2 = pParser v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2)) -= 24 @@ -157062,32 +153330,22 @@ func _yy_find_shift_action(tls *libc.TLS, iLookAhead uint16, stateno uint16) (r if int32(stateno) > int32(YY_MAX_SHIFT) { return stateno } - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = int32(1) != 0 { i = int32(_yy_shift_ofst[stateno]) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i += int32(iLookAhead) - _ = libc.Int32FromInt32(0) if int32(_yy_lookahead[i]) != int32(iLookAhead) { /* Fallback token */ - _ = libc.Int32FromInt32(0) iFallback = _yyFallback[iLookAhead] if int32(iFallback) != 0 { - _ = libc.Int32FromInt32(0) /* Fallback loop must terminate */ + /* Fallback loop must terminate */ iLookAhead = iFallback continue } j = i - int32(iLookAhead) + int32(YYWILDCARD) - _ = libc.Int32FromInt32(0) if int32(_yy_lookahead[j]) == int32(YYWILDCARD) && int32(iLookAhead) > 0 { return _yy_action[j] } return _yy_default[stateno] } else { - _ = libc.Int32FromInt32(0) return _yy_action[i] } } @@ -157103,12 +153361,8 @@ func _yy_find_shift_action(tls *libc.TLS, iLookAhead uint16, stateno uint16) (r func _yy_find_reduce_action(tls *libc.TLS, stateno uint16, iLookAhead uint16) (r uint16) { var i int32 _ = i - _ = libc.Int32FromInt32(0) i = int32(_yy_reduce_ofst[stateno]) - _ = libc.Int32FromInt32(0) i += int32(iLookAhead) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _yy_action[i] } @@ -157127,7 +153381,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23302, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23340, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158641,291 +154895,387 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16660, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16698, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16573, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16611, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23362, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ - _ = libc.Int32FromInt32(0) +_40: + ; /* scanpt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ - _ = libc.Int32FromInt32(0) +_41: + ; /* scantok ::= */ *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -158949,17 +155299,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -158967,10 +155322,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -158984,73 +155341,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -159084,142 +155465,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23351) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23389) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -159232,74 +155659,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159310,18 +155758,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1)))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159331,9 +155783,8 @@ _200: /* expr ::= VARIABLE */ ** that look like this: #1 #2 ... These terms refer to registers ** in the virtual machine. #N is the N-th register. */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ - _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23398, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -159343,47 +155794,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159395,23 +155856,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -159424,7 +155895,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -159438,33 +155910,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -159473,17 +155954,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -159496,7 +155981,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -159508,9 +155994,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 7861 + v345 = __ccgo_ts + 7890 } else { - v345 = __ccgo_ts + 7866 + v345 = __ccgo_ts + 7895 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159553,18 +156039,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -159581,13 +156070,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -159602,73 +156093,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -159677,239 +156190,309 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - _ = libc.Int32FromInt32(0) +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ - _ = libc.Int32FromInt32(0) +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23384, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23422, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23479, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23517, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23563, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23601, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = int8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ - _ = libc.Int32FromInt32(0) +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -159918,11 +156501,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -159932,47 +156517,33 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) - _ = libc.Int32FromInt32(0) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; goto _342 /********** End reduce actions ************************************************/ _342: - _ = libc.Int32FromInt32(0) + ; yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) /* There are no SHIFTREDUCE actions on nonterminals because the table ** generator has simplified them to pure REDUCE actions. */ - _ = libc.Int32FromInt32(0) /* It is not possible for a REDUCE to be followed by an error */ - _ = libc.Int32FromInt32(0) yymsp += uintptr(yysize+int32(1)) * 24 (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos = yymsp (*TyyStackEntry)(unsafe.Pointer(yymsp)).Fstateno = yyact @@ -159999,9 +156570,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23398, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23648, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23686, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -160017,7 +156588,6 @@ func _yy_accept(tls *libc.TLS, yypParser uintptr) { var pParse uintptr _ = pParse pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse - _ = libc.Int32FromInt32(0) /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ @@ -160057,11 +156627,8 @@ func _sqlite3Parser(tls *libc.TLS, yyp uintptr, yymajor int32, yyminor TToken) { _, _, _, _ = pParse, yyact, yypParser, yyruleno /* The parser action. */ yypParser = yyp /* The parser */ pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse - _ = libc.Int32FromInt32(0) yyact = (*TyyStackEntry)(unsafe.Pointer((*TyyParser)(unsafe.Pointer(yypParser)).Fyytos)).Fstateno for int32(1) != 0 { /* Exit by "break" */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) yyact = _yy_find_shift_action(tls, uint16(yymajor), yyact) if int32(yyact) >= int32(YY_MIN_REDUCE) { yyruleno = uint32(int32(yyact) - int32(YY_MIN_REDUCE)) /* Reduce by this rule */ @@ -160085,7 +156652,6 @@ func _sqlite3Parser(tls *libc.TLS, yyp uintptr, yymajor int32, yyminor TToken) { _yy_accept(tls, yypParser) return } else { - _ = libc.Int32FromInt32(0) *(*TToken)(unsafe.Pointer(bp)) = yyminor /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -160111,7 +156677,6 @@ func _sqlite3Parser(tls *libc.TLS, yyp uintptr, yymajor int32, yyminor TToken) { // ** 0 if iToken has no fallback. // */ func _sqlite3ParserFallback(tls *libc.TLS, iToken int32) (r int32) { - _ = libc.Int32FromInt32(0) return int32(_yyFallback[iToken]) } @@ -161882,7 +158447,6 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { var i, j int32 var zKW uintptr _, _, _ = i, j, zKW - _ = libc.Int32FromInt32(0) i = (int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))])*int32(4) ^ int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n-int32(1)))))])*int32(3) ^ n*int32(1)) % int32(127) i = int32(_aKWHash[i]) for { @@ -162057,6 +158621,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -162236,6 +158801,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -162251,6 +158817,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -162295,6 +158862,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -162390,6 +158958,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -162421,6 +158990,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -162432,6 +159002,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -162466,6 +159037,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -162484,6 +159056,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -162507,6 +159080,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -162529,6 +159103,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -162547,6 +159122,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -162568,6 +159144,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -162625,7 +159202,6 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { lastTokenParsed = -int32(1) /* type of the previous token */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Max length of an SQL string */ pParentParse = uintptr(0) /* Space to hold the Lemon-generated Parser object */ - _ = libc.Int32FromInt32(0) mxSqlLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) @@ -162634,10 +159210,6 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql pEngine = bp + 8 _sqlite3ParserInit(tls, pEngine, pParse) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pParentParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParse for int32(1) != 0 { @@ -162649,7 +159221,6 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { break } if *(*int32)(unsafe.Pointer(bp)) >= int32(TK_WINDOW) { - _ = libc.Int32FromInt32(0) if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_INTERRUPT) (*TParse)(unsafe.Pointer(pParse)).FnErr++ @@ -162674,20 +159245,17 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { n = 0 } else { if *(*int32)(unsafe.Pointer(bp)) == int32(TK_WINDOW) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _analyzeWindowKeyword(tls, zSql+6) } else { if *(*int32)(unsafe.Pointer(bp)) == int32(TK_OVER) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _analyzeOverKeyword(tls, zSql+4, lastTokenParsed) } else { if *(*int32)(unsafe.Pointer(bp)) == int32(TK_FILTER) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _analyzeFilterKeyword(tls, zSql+6, lastTokenParsed) } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23665, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23703, libc.VaList(bp+2456, bp+2432)) break } } @@ -162699,21 +159267,19 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { _sqlite3Parser(tls, pEngine, *(*int32)(unsafe.Pointer(bp)), (*TParse)(unsafe.Pointer(pParse)).FsLastToken) lastTokenParsed = *(*int32)(unsafe.Pointer(bp)) zSql += uintptr(n) - _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK { break } } - _ = libc.Int32FromInt32(0) _sqlite3ParserFinalize(tls, pEngine) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) } if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg != 0 || (*TParse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK && (*TParse)(unsafe.Pointer(pParse)).Frc != int32(SQLITE_DONE) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { - (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) + (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3799, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23690, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23728, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -162732,7 +159298,6 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { _sqlite3DbNNFreeNN(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpVList) } (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParentParse - _ = libc.Int32FromInt32(0) return nErr } @@ -162829,7 +159394,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*int8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*int8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -162839,9 +159404,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -162855,7 +159420,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -162867,7 +159432,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -162876,9 +159441,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*int8)(unsafe.Pointer(zSql))) @@ -162899,13 +159464,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*int8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23701, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23739, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -162913,13 +159479,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20345, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20383, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23708, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23746, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23713, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23751, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -162929,10 +159495,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23723, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23761, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23727, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23765, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -163192,19 +159758,21 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ /* If the following assert() fails on some obscure processor/compiler ** combination, the work-around is to set the correct pointer ** size at compile-time using -DSQLITE_PTRSIZE=n compile-time option */ - _ = libc.Int32FromInt32(0) /* If SQLite is already completely initialized, then this call ** to sqlite3_initialize() should be a no-op. But the initialization ** must be complete. So isInit must not be set until the very end ** of this routine. */ if _sqlite3Config.FisInit != 0 { + _sqlite3MemoryBarrier(tls) return SQLITE_OK } /* Make sure the mutex subsystem is initialized. If unable to @@ -163280,6 +159848,7 @@ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { } if rc == SQLITE_OK { _sqlite3PCacheBufferSetup(tls, _sqlite3Config.FpPage, _sqlite3Config.FszPage, _sqlite3Config.FnPage) + _sqlite3MemoryBarrier(tls) _sqlite3Config.FisInit = int32(1) } _sqlite3Config.FinProgress = 0 @@ -163291,7 +159860,6 @@ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { Xsqlite3_mutex_enter(tls, pMainMtx) _sqlite3Config.FnRefInitMutex-- if _sqlite3Config.FnRefInitMutex <= 0 { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_free(tls, _sqlite3Config.FpInitMutex) _sqlite3Config.FpInitMutex = uintptr(0) } @@ -163365,8 +159933,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -163374,7 +159942,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -164505,31 +161080,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23803, - 1: __ccgo_ts + 23816, - 3: __ccgo_ts + 23832, - 4: __ccgo_ts + 23857, - 5: __ccgo_ts + 23871, - 6: __ccgo_ts + 23890, - 7: __ccgo_ts + 1618, - 8: __ccgo_ts + 23915, - 9: __ccgo_ts + 23952, - 10: __ccgo_ts + 23964, - 11: __ccgo_ts + 23979, - 12: __ccgo_ts + 24012, - 13: __ccgo_ts + 24030, - 14: __ccgo_ts + 24055, - 15: __ccgo_ts + 24084, - 17: __ccgo_ts + 5996, - 18: __ccgo_ts + 5398, - 19: __ccgo_ts + 24101, - 20: __ccgo_ts + 24119, - 21: __ccgo_ts + 24137, - 23: __ccgo_ts + 24171, - 25: __ccgo_ts + 24192, - 26: __ccgo_ts + 24218, - 27: __ccgo_ts + 24241, - 28: __ccgo_ts + 24262, + 0: __ccgo_ts + 23841, + 1: __ccgo_ts + 23854, + 3: __ccgo_ts + 23870, + 4: __ccgo_ts + 23895, + 5: __ccgo_ts + 23909, + 6: __ccgo_ts + 23928, + 7: __ccgo_ts + 1622, + 8: __ccgo_ts + 23953, + 9: __ccgo_ts + 23990, + 10: __ccgo_ts + 24002, + 11: __ccgo_ts + 24017, + 12: __ccgo_ts + 24050, + 13: __ccgo_ts + 24068, + 14: __ccgo_ts + 24093, + 15: __ccgo_ts + 24122, + 17: __ccgo_ts + 6025, + 18: __ccgo_ts + 5427, + 19: __ccgo_ts + 24139, + 20: __ccgo_ts + 24157, + 21: __ccgo_ts + 24175, + 23: __ccgo_ts + 24209, + 25: __ccgo_ts + 24230, + 26: __ccgo_ts + 24256, + 27: __ccgo_ts + 24279, + 28: __ccgo_ts + 24300, } // C documentation @@ -164549,7 +161124,6 @@ func _sqliteDefaultBusyCallback(tls *libc.TLS, ptr uintptr, count int32) (r int3 _, _, _, _ = db, delay, prior, tmout db = ptr tmout = (*Tsqlite3)(unsafe.Pointer(db)).FbusyTimeout - _ = libc.Int32FromInt32(0) if count < int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(1)) { delay = int32(_delays[count]) prior = int32(_totals[count]) @@ -164708,18 +161282,13 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i var extraFlags, rc int32 var p, v1 uintptr _, _, _, _ = extraFlags, p, rc, v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) /* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But ** the meaning is inverted. So flip the bit. */ - _ = libc.Int32FromInt32(0) extraFlags ^= int32(SQLITE_FUNC_UNSAFE) /* tag-20230109-1 */ /* If SQLITE_UTF16 is specified as the encoding type, transform this ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the @@ -164757,8 +161326,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24359, 0) - _ = libc.Int32FromInt32(0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24397, 0) return int32(SQLITE_BUSY) } else { _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -164771,7 +161339,6 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i } } p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(1)) - _ = libc.Int32FromInt32(0) if !(p != 0) { return int32(SQLITE_NOMEM) } @@ -164826,11 +161393,11 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en } rc = _sqlite3CreateFunc(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, xValue, xInverse, pArg) if pArg != 0 && (*TFuncDestructor)(unsafe.Pointer(pArg)).FnRef == 0 { - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, p) Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -164858,7 +161425,6 @@ func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr var zFunc8 uintptr _, _ = rc, zFunc8 Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - _ = libc.Int32FromInt32(0) zFunc8 = _sqlite3Utf16to8(tls, db, zFunctionName, -int32(1), uint8(SQLITE_UTF16LE)) rc = _sqlite3CreateFunc(tls, db, zFunc8, nArg, eTextRep, p, xSFunc, xStep, xFinal, uintptr(0), uintptr(0), uintptr(0)) _sqlite3DbFree(tls, db, zFunc8) @@ -164885,7 +161451,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24422, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24460, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -164916,7 +161482,7 @@ func Xsqlite3_overload_function(tls *libc.TLS, db uintptr, zName uintptr, nArg i if rc != 0 { return SQLITE_OK } - zCopy = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, zName)) + zCopy = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, zName)) if zCopy == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -165157,14 +161723,10 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if pnCkpt != 0 { *(*int32)(unsafe.Pointer(pnCkpt)) = -int32(1) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { @@ -165174,7 +161736,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24473, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24511, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -165230,9 +161792,6 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog _, _, _, _ = bBusy, i, rc, v2 rc = SQLITE_OK /* Used to iterate through attached dbs */ bBusy = 0 /* True if SQLITE_BUSY has been encountered */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* See forum post a006d86f72 */ i = 0 for { @@ -165250,6 +161809,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -165298,7 +161858,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165310,7 +161870,6 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { v1 = uintptr(0) } z = v1 - _ = libc.Int32FromInt32(0) if z == uintptr(0) { z = _sqlite3ErrStr(tls, (*Tsqlite3)(unsafe.Pointer(db)).FerrCode) } @@ -165431,7 +161990,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165441,7 +162000,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165481,7 +162040,6 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui var aColl, p, pColl uintptr var enc2, j int32 _, _, _, _, _ = aColl, enc2, j, p, pColl - _ = libc.Int32FromInt32(0) /* If SQLITE_UTF16 is specified as the encoding type, transform this ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. @@ -165491,7 +162049,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -165500,7 +162058,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24494, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24532, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -165526,6 +162084,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -165588,19 +162147,6 @@ func Xsqlite3_limit(tls *libc.TLS, db uintptr, limitId int32, newLimit int32) (r ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to ** "_MAX_".) */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if limitId < 0 || limitId >= libc.Int32FromInt32(SQLITE_LIMIT_WORKER_THREADS)+libc.Int32FromInt32(1) { return -int32(1) } @@ -165659,8 +162205,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u flags = *(*uint32)(unsafe.Pointer(pFlags)) zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) - _ = libc.Int32FromInt32(0) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24562, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24600, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -165674,6 +162219,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -165689,8 +162235,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24568, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24578, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24606, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24616, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -165720,7 +162266,6 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u v4 = iIn iIn++ octet += int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zUri + uintptr(v4)))))) - _ = libc.Int32FromInt32(0) if octet == 0 { /* This branch is taken when "%00" appears within the URI. In this ** case we ignore all text in the remainder of the path, name or @@ -165780,24 +162325,24 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24606, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24644, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24610, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24648, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24610 + zModeType = __ccgo_ts + 24648 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24631, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24669, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) - zModeType = __ccgo_ts + 3404 + zModeType = __ccgo_ts + 3408 } if aMode != 0 { mode = 0 @@ -165822,15 +162367,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24646, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24684, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24666, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24704, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -165854,10 +162400,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24690, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24728, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -165872,11 +162419,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24616, + Fz: __ccgo_ts + 24654, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24623, + Fz: __ccgo_ts + 24661, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -165887,19 +162434,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24636, + Fz: __ccgo_ts + 24674, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24639, + Fz: __ccgo_ts + 24677, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24642, + Fz: __ccgo_ts + 24680, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17730, + Fz: __ccgo_ts + 17768, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -166007,7 +162554,6 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 (*Tsqlite3)(unsafe.Pointer(db)).FaDb = db + 696 (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = uint32(1) (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, db+136, uintptr(unsafe.Pointer(&_aHardLimit)), uint64(48)) *(*int32)(unsafe.Pointer(db + 136 + 11*4)) = SQLITE_DEFAULT_WORKER_THREADS (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) @@ -166028,8 +162574,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22317, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24706, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22355, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24744, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -166046,14 +162592,11 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE */ (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = *(*uint32)(unsafe.Pointer(bp)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* READONLY */ /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -166062,7 +162605,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _sqlite3OomFault(tls, db) } if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { - v2 = __ccgo_ts + 3795 + v2 = __ccgo_ts + 3799 } else { v2 = uintptr(0) } @@ -166070,7 +162613,6 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto opendb_out } - _ = libc.Int32FromInt32(0) /* Open the backend database driver */ rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer(bp + 8)), db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb+8, 0, int32(*(*uint32)(unsafe.Pointer(bp))|uint32(SQLITE_OPEN_MAIN_DB))) if rc != SQLITE_OK { @@ -166090,9 +162632,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6560 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6589 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23708 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23746 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -166114,6 +162656,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -166137,12 +162680,11 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) } rc = Xsqlite3_errcode(tls, db) - _ = libc.Int32FromInt32(0) if rc&int32(0xff) == int32(SQLITE_NOMEM) { Xsqlite3_close(tls, db) db = uintptr(0) @@ -166185,14 +162727,13 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24712 + zFilename = __ccgo_ts + 24750 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) zFilename8 = _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) if zFilename8 != 0 { rc = _openDatabase(tls, zFilename8, ppDb, uint32(libc.Int32FromInt32(SQLITE_OPEN_READWRITE)|libc.Int32FromInt32(SQLITE_OPEN_CREATE)), uintptr(0)) - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && !(int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppDb)))).FaDb))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_SchemaLoaded) == libc.Int32FromInt32(DB_SchemaLoaded)) { v1 = libc.Uint8FromInt32(SQLITE_UTF16LE) (*Tsqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppDb)))).Fenc = v1 @@ -166223,7 +162764,6 @@ func Xsqlite3_create_collation_v2(tls *libc.TLS, db uintptr, zName uintptr, enc var rc int32 _ = rc Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - _ = libc.Int32FromInt32(0) rc = _createCollation(tls, db, zName, uint8(enc), pCtx, xCompare, xDel) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166241,7 +162781,6 @@ func Xsqlite3_create_collation16(tls *libc.TLS, db uintptr, zName uintptr, enc i _, _ = rc, zName8 rc = SQLITE_OK Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - _ = libc.Int32FromInt32(0) zName8 = _sqlite3Utf16to8(tls, db, zName, -int32(1), uint8(SQLITE_UTF16LE)) if zName8 != 0 { rc = _createCollation(tls, db, zName8, uint8(enc), pCtx, xCompare, uintptr(0)) @@ -166303,6 +162842,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166328,10 +162868,10 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { - _ = libc.Int32FromInt32(0) if (*TDbClientData)(unsafe.Pointer(p)).FxDestructor != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TDbClientData)(unsafe.Pointer(p)).FxDestructor})))(tls, (*TDbClientData)(unsafe.Pointer(p)).FpData) } @@ -166404,20 +162944,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24715, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24753, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24740) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24778) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24760) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24798) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24767) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24805) } // C documentation @@ -166482,6 +163022,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -166516,13 +163057,14 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, primarykey = libc.BoolInt32(int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0) autoinc = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) == iCol && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != uint32(0)) } else { - zDataType = __ccgo_ts + 1136 + zDataType = __ccgo_ts + 1140 primarykey = int32(1) } if !(zCollSeq != 0) { zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -166545,11 +163087,11 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24784, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24822, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - v3 = __ccgo_ts + 3795 + v3 = __ccgo_ts + 3799 } else { v3 = uintptr(0) } @@ -166619,9 +163161,7 @@ func Xsqlite3_file_control(tls *libc.TLS, db uintptr, zDbName uintptr, op int32, if pBtree != 0 { _sqlite3BtreeEnter(tls, pBtree) pPager = _sqlite3BtreePager(tls, pBtree) - _ = libc.Int32FromInt32(0) fd = _sqlite3PagerFile(tls, pPager) - _ = libc.Int32FromInt32(0) if op == int32(SQLITE_FCNTL_FILE_POINTER) { *(*uintptr)(unsafe.Pointer(pArg)) = fd rc = SQLITE_OK @@ -166721,7 +163261,6 @@ func Xsqlite3_test_control(tls *libc.TLS, op int32, va uintptr) (r int32) { case int32(SQLITE_TESTCTRL_PRNG_SEED): x = libc.VaInt32(&ap) db = libc.VaUintptr(&ap) - _ = libc.Int32FromInt32(0) if v2 = db != 0; v2 { v1 = (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fschema_cookie y = v1 @@ -166829,7 +163368,6 @@ func Xsqlite3_test_control(tls *libc.TLS, op int32, va uintptr) (r int32) { fallthrough case int32(SQLITE_TESTCTRL_ASSERT): x1 = 0 - _ = libc.Int32FromInt32(0) rc = x1 break /* @@ -167191,6 +163729,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -167210,6 +163749,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -167223,7 +163763,6 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr v6 = p p++ *(*int8)(unsafe.Pointer(v6)) = 0 - _ = libc.Int32FromInt32(0) return pResult + uintptr(4) } @@ -167576,7 +164115,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24812, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24850, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -167592,6 +164131,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -167666,7 +164206,6 @@ var _sqlite3BlockedList = uintptr(0) func _removeFromBlockedList(tls *libc.TLS, db uintptr) { var pp uintptr _ = pp - _ = libc.Int32FromInt32(0) pp = uintptr(unsafe.Pointer(&_sqlite3BlockedList)) for { if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { @@ -167678,6 +164217,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -167691,7 +164231,6 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { func _addToBlockedList(tls *libc.TLS, db uintptr) { var pp uintptr _ = pp - _ = libc.Int32FromInt32(0) pp = uintptr(unsafe.Pointer(&_sqlite3BlockedList)) for { if !(*(*uintptr)(unsafe.Pointer(pp)) != 0 && (*Tsqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FxUnlockNotify != (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify) { @@ -167699,6 +164238,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -167720,7 +164260,6 @@ func _enterMutex(tls *libc.TLS) { // ** Release the STATIC_MAIN mutex. // */ func _leaveMutex(tls *libc.TLS) { - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN))) } @@ -167778,6 +164317,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -167792,9 +164332,8 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } } _leaveMutex(tls) - _ = libc.Int32FromInt32(0) if rc != 0 { - v2 = __ccgo_ts + 24820 + v2 = __ccgo_ts + 24858 } else { v2 = uintptr(0) } @@ -167866,14 +164405,11 @@ func _sqlite3ConnectionUnlocked(tls *libc.TLS, db uintptr) { } /* Step 2. */ if (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection == db { - _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer(p)).FxUnlockNotify != xUnlockNotify && nArg != 0 { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xUnlockNotify})))(tls, aArg, nArg) nArg = 0 } _sqlite3BeginBenignMalloc(tls) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if !(aDyn != 0) && nArg == int32(libc.Uint64FromInt64(128)/libc.Uint64FromInt64(8)) || aDyn != 0 && nArg == int32(uint64(_sqlite3MallocSize(tls, aDyn))/libc.Uint64FromInt64(8)) { /* The aArg[] array needs to grow. */ pNew = _sqlite3Malloc(tls, uint64(nArg)*uint64(8)*uint64(2)) @@ -168677,23 +165213,23 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // ** string must correspond to the JSONB_* integer above. // */ var _jsonbType = [17]uintptr{ - 0: __ccgo_ts + 1634, - 1: __ccgo_ts + 7861, - 2: __ccgo_ts + 7866, - 3: __ccgo_ts + 6281, - 4: __ccgo_ts + 6281, - 5: __ccgo_ts + 6276, - 6: __ccgo_ts + 6276, - 7: __ccgo_ts + 8172, - 8: __ccgo_ts + 8172, - 9: __ccgo_ts + 8172, - 10: __ccgo_ts + 8172, - 11: __ccgo_ts + 24843, - 12: __ccgo_ts + 24849, - 13: __ccgo_ts + 1648, - 14: __ccgo_ts + 1648, - 15: __ccgo_ts + 1648, - 16: __ccgo_ts + 1648, + 0: __ccgo_ts + 1638, + 1: __ccgo_ts + 7890, + 2: __ccgo_ts + 7895, + 3: __ccgo_ts + 6310, + 4: __ccgo_ts + 6310, + 5: __ccgo_ts + 6305, + 6: __ccgo_ts + 6305, + 7: __ccgo_ts + 8201, + 8: __ccgo_ts + 8201, + 9: __ccgo_ts + 8201, + 10: __ccgo_ts + 8201, + 11: __ccgo_ts + 24881, + 12: __ccgo_ts + 24887, + 13: __ccgo_ts + 1652, + 14: __ccgo_ts + 1652, + 15: __ccgo_ts + 1652, + 16: __ccgo_ts + 1652, } // C documentation @@ -169117,6 +165653,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -169138,9 +165675,6 @@ func _jsonCacheDeleteGeneric(tls *libc.TLS, p uintptr) { func _jsonCacheInsert(tls *libc.TLS, ctx uintptr, pParse uintptr) (r int32) { var db, p uintptr _, _ = db, p - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p = Xsqlite3_get_auxdata(tls, ctx, -int32(429938)) if p == uintptr(0) { db = Xsqlite3_context_db_handle(tls, ctx) @@ -169160,7 +165694,6 @@ func _jsonCacheInsert(tls *libc.TLS, ctx uintptr, pParse uintptr) (r int32) { libc.Xmemmove(tls, p+16, p+16+1*8, uint64(libc.Int32FromInt32(JSON_CACHE_SIZE)-libc.Int32FromInt32(1))*libc.Uint64FromInt64(8)) (*TJsonCache)(unsafe.Pointer(p)).FnUsed = libc.Int32FromInt32(JSON_CACHE_SIZE) - libc.Int32FromInt32(1) } - _ = libc.Int32FromInt32(0) (*TJsonParse)(unsafe.Pointer(pParse)).FeEdit = uint8(0) (*TJsonParse)(unsafe.Pointer(pParse)).FnJPRef++ (*TJsonParse)(unsafe.Pointer(pParse)).FbReadOnly = uint8(1) @@ -169208,6 +165741,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -169224,6 +165758,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -169235,7 +165770,6 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { *(*uintptr)(unsafe.Pointer(p + 16 + uintptr((*TJsonCache)(unsafe.Pointer(p)).FnUsed-int32(1))*8)) = tmp i = (*TJsonCache)(unsafe.Pointer(p)).FnUsed - int32(1) } - _ = libc.Int32FromInt32(0) return *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)) } else { return uintptr(0) @@ -169342,7 +165876,6 @@ func _jsonStringGrow(tls *libc.TLS, p uintptr, N Tu32) (r int32) { // /* Append N bytes from zIn onto the end of the JsonString string. // */ func _jsonStringExpandAndAppend(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { - _ = libc.Int32FromInt32(0) if _jsonStringGrow(tls, p, N) != 0 { return } @@ -169363,7 +165896,6 @@ func _jsonAppendRaw(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { } func _jsonAppendRawNZ(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { - _ = libc.Int32FromInt32(0) if uint64(N)+(*TJsonString)(unsafe.Pointer(p)).FnUsed >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc { _jsonStringExpandAndAppend(tls, p, zIn, N) } else { @@ -169425,7 +165957,6 @@ func _jsonAppendChar(tls *libc.TLS, p uintptr, c int8) { // */ func _jsonStringTrimOneChar(tls *libc.TLS, p uintptr) { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - _ = libc.Int32FromInt32(0) (*TJsonString)(unsafe.Pointer(p)).FnUsed-- } } @@ -169537,6 +166068,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -169550,19 +166082,13 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) *(*Tu64)(unsafe.Pointer(v10))++ *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v9))) = int8(c) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if _aSpecial[c] != 0 { c = uint8(_aSpecial[c]) goto json_simple_escape @@ -169589,13 +166115,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)>>int32(4)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24894 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)&int32(0xf)))) + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24894 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -169603,7 +166130,6 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v23 = *(*Tu64)(unsafe.Pointer(v24)) *(*Tu64)(unsafe.Pointer(v24))++ *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v23))) = int8('"') - _ = libc.Int32FromInt32(0) } var _aSpecial = [32]int8{ @@ -169629,9 +166155,9 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _, _, _, _ = n, n1, z, z1 switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_NULL): - _jsonAppendRawNZ(tls, p, __ccgo_ts+1634, uint32(4)) + _jsonAppendRawNZ(tls, p, __ccgo_ts+1638, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24873, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15327, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -169652,7 +166178,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24911, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -169675,8 +166201,6 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { var flags, rc int32 _, _ = flags, rc - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { flags = int32(int64(Xsqlite3_user_data(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx))) if flags&int32(JSON_BLOB) != 0 { @@ -169708,7 +166232,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24940, -int32(1)) } } } @@ -169726,7 +166250,6 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { // ** delete the JsonParse object itself. // */ func _jsonParseReset(tls *libc.TLS, pParse uintptr) { - _ = libc.Int32FromInt32(0) if (*TJsonParse)(unsafe.Pointer(pParse)).FbJsonIsRCStr != 0 { _sqlite3RCStrUnref(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FzJson) (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = uintptr(0) @@ -169877,6 +166400,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -169899,6 +166423,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -169955,6 +166480,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -169988,8 +166514,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(3), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24925, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24955, + FzRepl: __ccgo_ts + 24959, }, 1: { Fc1: int8('i'), @@ -169997,32 +166523,32 @@ var _aNanInfName = [5]TNanInfName{ Fn: int8(8), FeType: int8(JSONB_FLOAT), FnRepl: int8(7), - FzMatch: __ccgo_ts + 24937, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24967, + FzRepl: __ccgo_ts + 24959, }, 2: { Fc1: int8('n'), Fc2: int8('N'), Fn: int8(3), FnRepl: int8(4), - FzMatch: __ccgo_ts + 1639, - FzRepl: __ccgo_ts + 1634, + FzMatch: __ccgo_ts + 1643, + FzRepl: __ccgo_ts + 1638, }, 3: { Fc1: int8('q'), Fc2: int8('Q'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24946, - FzRepl: __ccgo_ts + 1634, + FzMatch: __ccgo_ts + 24976, + FzRepl: __ccgo_ts + 1638, }, 4: { Fc1: int8('s'), Fc2: int8('S'), Fn: int8(4), FnRepl: int8(4), - FzMatch: __ccgo_ts + 24951, - FzRepl: __ccgo_ts + 1634, + FzMatch: __ccgo_ts + 24981, + FzRepl: __ccgo_ts + 1638, }, } @@ -170037,7 +166563,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24956, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24986, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -170057,7 +166583,6 @@ func _jsonBlobExpand(tls *libc.TLS, pParse uintptr, N Tu32) (r int32) { var aNew uintptr var t Tu32 _, _ = aNew, t - _ = libc.Int32FromInt32(0) if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc == uint32(0) { t = uint32(100) } else { @@ -170090,7 +166615,6 @@ func _jsonBlobMakeEditable(tls *libc.TLS, pParse uintptr, nExtra Tu32) (r int32) var aOld uintptr var nSize Tu32 _, _ = aOld, nSize - _ = libc.Int32FromInt32(0) if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { return 0 } @@ -170103,7 +166627,6 @@ func _jsonBlobMakeEditable(tls *libc.TLS, pParse uintptr, nExtra Tu32) (r int32) if _jsonBlobExpand(tls, pParse, nSize) != 0 { return 0 } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob, aOld, uint64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob)) return int32(1) } @@ -170118,7 +166641,6 @@ func _jsonBlobExpandAndAppendOneByte(tls *libc.TLS, pParse uintptr, c Tu8) { _, _ = v1, v2 _jsonBlobExpand(tls, pParse, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob+uint32(1)) if int32((*TJsonParse)(unsafe.Pointer(pParse)).Foom) == 0 { - _ = libc.Int32FromInt32(0) v2 = pParse + 8 v1 = *(*Tu32)(unsafe.Pointer(v2)) *(*Tu32)(unsafe.Pointer(v2))++ @@ -170169,7 +166691,6 @@ func _jsonBlobAppendNode(tls *libc.TLS, pParse uintptr, eType Tu8, szPayload Tu3 _jsonBlobExpandAndAppendNode(tls, pParse, eType, szPayload, aPayload) return } - _ = libc.Int32FromInt32(0) a = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob) if szPayload <= uint32(11) { *(*Tu8)(unsafe.Pointer(a)) = uint8(uint32(eType) | szPayload<= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+24999, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25029, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -170543,7 +167065,6 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept } j += n + *(*Tu32)(unsafe.Pointer(bp)) } - _ = libc.Int32FromInt32(0) return uint32(0) case int32(JSONB_OBJECT): cnt = uint32(0) @@ -170571,7 +167092,6 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept cnt++ j += n + *(*Tu32)(unsafe.Pointer(bp)) } - _ = libc.Int32FromInt32(0) if cnt&uint32(1) != uint32(0) { return j + uint32(1) } @@ -170612,6 +167132,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { case int32('{'): goto _1 @@ -170692,6 +167213,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170722,7 +167244,6 @@ _1: for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(k))))])&int32(0x46) != 0 && _json5Whitespace(tls, z+uintptr(k)) == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(k)))) == int32('\\') && _jsonIs4HexB(tls, z+uintptr(k+int32(1)), bp) != 0 { k++ } - _ = libc.Int32FromInt32(0) _jsonBlobAppendNode(tls, pParse, uint8(*(*int32)(unsafe.Pointer(bp))), uint32(k)-j, z+uintptr(j)) (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) x = k @@ -170765,6 +167286,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -170804,12 +167326,14 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170872,19 +167396,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -170946,24 +167474,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7861, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7890, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7866, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7895, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -170973,28 +167505,36 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) c = *(*int8)(unsafe.Pointer(z + uintptr(i))) if int32(c) <= int32('0') { if int32(c) == int32('0') { if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('x') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('X')) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2)))))])&int32(0x08) != 0 { - _ = libc.Int32FromInt32(0) (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x01) j = i + uint32(3) @@ -171004,6 +167544,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -171018,14 +167559,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24925, int32(3)) == 0 { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24955, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25038) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25045) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25021, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25051, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -171055,6 +167596,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -171064,6 +167606,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*int8)(unsafe.Pointer(z + uintptr(j))) @@ -171108,6 +167651,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -171120,42 +167664,57 @@ parse_number_2: } } parse_number_finish: - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + ; if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { i++ } _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -171165,12 +167724,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1634, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1638, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*int8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -171188,7 +167749,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25045) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -171196,11 +167757,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -171231,7 +167794,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24940, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -171244,7 +167807,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24940, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -171266,6 +167829,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint64(72)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -171274,8 +167841,6 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { _sqlite3DbFree(tls, (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb, (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob) Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3_result_blob(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx, (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob, int32((*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob), __ccgo_fp(_sqlite3OomClear)) } } @@ -171404,22 +167969,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1634, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1638, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7861, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7890, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7866, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7895, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -171452,16 +168023,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24929 + v19 = __ccgo_ts + 24959 } else { - v19 = __ccgo_ts + 11728 + v19 = __ccgo_ts + 11757 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171484,16 +168057,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, int8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, int8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, int8('"')) @@ -171505,6 +168082,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -171516,13 +168094,11 @@ _11: sz2 -= k2 } if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25027, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25057, uint32(2)) zIn2++ sz2-- continue } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if sz2 < uint32(2) { p22 = pOut + 33 *(*Tu8)(unsafe.Pointer(p22)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p22))) | libc.Int32FromInt32(JSTRING_MALFORMED)) @@ -171532,7 +168108,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, int8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25030, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25060, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -171540,12 +168116,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25037, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25067, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25042, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25072, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -171568,16 +168144,17 @@ _11: _jsonAppendRawNZ(tls, pOut, zIn2, uint32(2)) break } - _ = libc.Int32FromInt32(0) zIn2 += uintptr(2) sz2 -= uint32(2) } _jsonAppendChar(tls, pOut, int8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, int8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -171595,6 +168172,7 @@ _13: _jsonAppendChar(tls, pOut, int8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, int8('{')) j = i + n @@ -171620,11 +168198,14 @@ _14: _jsonAppendChar(tls, pOut, int8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -171695,6 +168276,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -171714,8 +168296,6 @@ func _jsonAfterEditSizeAdjust(tls *libc.TLS, pParse uintptr, iRoot Tu32) { var _ /* sz at bp+0 */ Tu32 _ = nBlob *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc _jsonbPayloadSize(tls, pParse, iRoot, bp) @@ -171819,8 +168399,6 @@ func _jsonUnescapeOneChar(tls *libc.TLS, z uintptr, n Tu32, piOut uintptr) (r Tu var sz int32 var v2 bool _, _, _, _, _, _ = nSkip, sz, v, vlo, v1, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if n < uint32(2) { *(*Tu32)(unsafe.Pointer(piOut)) = uint32(JSON_INVALID_CHAR) return n @@ -171928,7 +168506,6 @@ func _jsonLabelCompareEscaped(tls *libc.TLS, zLeft uintptr, nLeft Tu32, rawLeft var _ /* cLeft at bp+0 */ Tu32 var _ /* cRight at bp+4 */ Tu32 _, _, _, _ = n, n1, sz, sz1 - _ = libc.Int32FromInt32(0) for int32(1) != 0 { if nLeft == uint32(0) { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) @@ -171946,7 +168523,6 @@ func _jsonLabelCompareEscaped(tls *libc.TLS, zLeft uintptr, nLeft Tu32, rawLeft } else { n = _jsonUnescapeOneChar(tls, zLeft, nLeft, bp) zLeft += uintptr(n) - _ = libc.Int32FromInt32(0) nLeft -= n } } @@ -171966,7 +168542,6 @@ func _jsonLabelCompareEscaped(tls *libc.TLS, zLeft uintptr, nLeft Tu32, rawLeft } else { n1 = _jsonUnescapeOneChar(tls, zRight, nRight, bp+4) zRight += uintptr(n1) - _ = libc.Int32FromInt32(0) nRight -= n1 } } @@ -172118,6 +168693,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -172136,6 +168712,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -172173,7 +168750,6 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i if n == uint32(0) || v+n+*(*Tu32)(unsafe.Pointer(bp)) > iEnd { return uint32(JSON_LOOKUP_ERROR) } - _ = libc.Int32FromInt32(0) rc = _jsonLookupStep(tls, pParse, v, zPath+uintptr(i), j) if (*TJsonParse)(unsafe.Pointer(pParse)).Fdelta != 0 { _jsonAfterEditSizeAdjust(tls, pParse, iRoot) @@ -172206,12 +168782,11 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | int32((*(*TJsonParse)(unsafe.Pointer(bp + 80))).Foom)) rc = _jsonCreateEditSubstructure(tls, pParse, bp+8, zPath+uintptr(i)) if !(rc >= libc.Uint32FromUint32(JSON_LOOKUP_PATHERROR)) && _jsonBlobMakeEditable(tls, pParse, (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob+nKey+(*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob) != 0 { - _ = libc.Int32FromInt32(0) nIns = (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob + nKey + (*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob _jsonBlobEdit(tls, pParse, j, uint32(0), uintptr(0), nIns) if !((*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0) { - _ = libc.Int32FromInt32(0) /* Because pParse->oom!=0 */ - _ = libc.Int32FromInt32(0) /* Because pPasre->oom!=0 */ + /* Because pParse->oom!=0 */ + /* Because pPasre->oom!=0 */ libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(j), (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FaBlob, uint64((*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob)) k = j + (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(k), zKey, uint64(nKey)) @@ -172288,7 +168863,6 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i if int32((*TJsonParse)(unsafe.Pointer(pParse)).FeEdit) >= int32(JEDIT_INS) { rc = _jsonCreateEditSubstructure(tls, pParse, bp+152, zPath+uintptr(i+uint32(1))) if !(rc >= libc.Uint32FromUint32(JSON_LOOKUP_PATHERROR)) && _jsonBlobMakeEditable(tls, pParse, (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FnBlob) != 0 { - _ = libc.Int32FromInt32(0) _jsonBlobEdit(tls, pParse, j, uint32(0), (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FaBlob, (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FnBlob) } _jsonParseReset(tls, bp+152) @@ -172352,7 +168926,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24940, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -172387,25 +168961,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -172450,11 +169029,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -172467,11 +169049,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -172494,7 +169080,6 @@ _10: *(*int8)(unsafe.Pointer(zOut + uintptr(v19))) = int8(*(*Tu32)(unsafe.Pointer(bp + 24))) } else { if *(*Tu32)(unsafe.Pointer(bp + 24)) <= uint32(0x7ff) { - _ = libc.Int32FromInt32(0) v20 = iOut iOut++ *(*int8)(unsafe.Pointer(zOut + uintptr(v20))) = int8(libc.Uint32FromInt32(0xc0) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(6)) @@ -172503,7 +169088,6 @@ _10: *(*int8)(unsafe.Pointer(zOut + uintptr(v21))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))&uint32(0x3f)) } else { if *(*Tu32)(unsafe.Pointer(bp + 24)) < uint32(0x10000) { - _ = libc.Int32FromInt32(0) v22 = iOut iOut++ *(*int8)(unsafe.Pointer(zOut + uintptr(v22))) = int8(uint32(0xe0) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(12)) @@ -172517,7 +169101,6 @@ _10: if *(*Tu32)(unsafe.Pointer(bp + 24)) == uint32(JSON_INVALID_CHAR) { /* Silently ignore illegal unicode */ } else { - _ = libc.Int32FromInt32(0) v25 = iOut iOut++ *(*int8)(unsafe.Pointer(zOut + uintptr(v25))) = int8(uint32(0xf0) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(18)) @@ -172542,14 +169125,16 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ - _ = libc.Int32FromInt32(0) *(*int8)(unsafe.Pointer(zOut + uintptr(iOut))) = 0 Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -172563,14 +169148,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24940, -int32(1)) return } @@ -172611,7 +169200,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24911, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -172624,7 +169213,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint64(72)) return int32(1) @@ -172643,10 +169232,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25045) } else { if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25038) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -172685,7 +169274,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25049, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25079, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -172718,7 +169307,6 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e _, _, _, _, _, _ = flgs, i, p, rc, zPath, v1 rc = uint32(0) zPath = uintptr(0) - _ = libc.Int32FromInt32(0) if argc == int32(1) { v1 = 0 } else { @@ -172772,15 +169360,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -172852,7 +169442,6 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u _, _, _, _, _, _, _, _, _, _ = db, eType, isRCStr, nBlob, p, pFromCache, rc, zNew, v1, v2 /* Datatype of pArg */ p = uintptr(0) /* Value to be returned */ pFromCache = uintptr(0) /* The database connection */ - _ = libc.Int32FromInt32(0) eType = Xsqlite3_value_type(tls, pArg) if eType == int32(SQLITE_NULL) { return uintptr(0) @@ -172866,6 +169455,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -172909,12 +169499,12 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -172954,15 +169544,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -173054,6 +169646,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, int8(']')) @@ -173091,7 +169684,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25067 + v1 = __ccgo_ts + 25097 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -173101,7 +169694,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) } } eErr = uint8(1) @@ -173132,6 +169725,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173150,6 +169744,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173223,20 +169818,20 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25069, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25099, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5136, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5165, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+1661, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+1665, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25101, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25074, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25104, uint32(1)) } } } @@ -173255,7 +169850,6 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonTranslateBlobToText(tls, p, j, bp) _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) _jsonStringReset(tls, bp) - _ = libc.Int32FromInt32(0) Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } else { _jsonReturnFromBlob(tls, p, j, ctx, 0) @@ -173273,11 +169867,11 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { goto json_extract_error /* Return NULL if not found */ } else { _jsonAppendSeparator(tls, bp) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+1634, uint32(4)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+1638, uint32(4)) } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -173287,6 +169881,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -173297,6 +169892,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -173373,8 +169969,6 @@ func _jsonMergePatch(tls *libc.TLS, pTarget uintptr, iTarget Tu32, pPatch uintpt iTValue = uint32(0) /* Index of the target value */ nTValue = uint32(0) /* Header size of the target value */ *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Payload size of the patch value */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob + uintptr(iPatch)))) & int32(0x0f)) if int32(x) != int32(JSONB_OBJECT) { /* Total size of the target, header+payload */ n = _jsonbPayloadSize(tls, pPatch, iPatch, bp) @@ -173531,7 +170125,6 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var rc int32 _, _, _ = pPatch, pTarget, rc /* Result code */ _ = argc - _ = libc.Int32FromInt32(0) pTarget = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(JSON_EDITABLE)) if pTarget == uintptr(0) { return @@ -173545,7 +170138,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -173569,7 +170162,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25076, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25106, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -173580,7 +170173,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25127, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25157, -int32(1)) _jsonStringReset(tls, bp) return } @@ -173592,6 +170185,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, int8('}')) @@ -173651,21 +170245,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -173683,7 +170280,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15762) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15800) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -173714,9 +170311,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25161 + v1 = __ccgo_ts + 25191 } else { - v1 = __ccgo_ts + 25165 + v1 = __ccgo_ts + 25195 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -173764,7 +170361,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24940, -int32(1)) } } goto json_type_done @@ -173774,6 +170371,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -173851,7 +170449,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25172, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25202, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -173928,7 +170526,6 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* s at bp+0 */ TJsonParse _, _ = iErrPos, k iErrPos = 0 - _ = libc.Int32FromInt32(0) _ = argc libc.Xmemset(tls, bp, 0, uint64(72)) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, ctx) @@ -173946,7 +170543,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if (*(*TJsonParse)(unsafe.Pointer(bp))).Foom != 0 { iErrPos = int64(-int32(1)) } else { - _ = libc.Int32FromInt32(0) /* Because s.oom is false */ + /* Because s.oom is false */ k = uint32(0) for { if !(k < (*(*TJsonParse)(unsafe.Pointer(bp))).FiErr && *(*int8)(unsafe.Pointer((*(*TJsonParse)(unsafe.Pointer(bp))).FzJson + uintptr(k))) != 0) { @@ -173957,6 +170554,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -174040,7 +170638,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25229, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25259, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174106,6 +170704,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -174188,7 +170787,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25232, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25262, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174291,7 +170890,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25235) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25265) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -174424,10 +171023,8 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { var z uintptr var _ /* sz at bp+0 */ Tu32 _, _, _, _, _ = i, k, n, needQuote, z - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25318, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25348, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -174448,13 +171045,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25325, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25355, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25333, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25363, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -174557,7 +171155,6 @@ func _jsonEachPathLength(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) cSaved = *(*int8)(unsafe.Pointer(z + uintptr(n))) *(*int8)(unsafe.Pointer(z + uintptr(n))) = 0 - _ = libc.Int32FromInt32(0) x = _jsonLookupStep(tls, p+192, uint32(0), z+uintptr(1), uint32(0)) *(*int8)(unsafe.Pointer(z + uintptr(n))) = cSaved if x >= uint32(JSON_LOOKUP_PATHERROR) { @@ -174612,12 +171209,14 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_OBJECT) { _jsonReturnFromBlob(tls, p+192, (*TJsonEachCursor)(unsafe.Pointer(p)).Fi, ctx, int32(1)) } else { - _ = libc.Int32FromInt32(0) Xsqlite3_result_int64(tls, ctx, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey) } case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -174647,9 +171246,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -174683,7 +171282,6 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) idxMask = 0 /* This implementation assumes that JSON and ROOT are the last two ** columns in the table */ - _ = libc.Int32FromInt32(0) _ = tab v1 = -libc.Int32FromInt32(1) aIdx[int32(1)] = v1 @@ -174698,7 +171296,6 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) goto _2 } iCol = (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - int32(JEACH_JSON) - _ = libc.Int32FromInt32(0) iMask = int32(1) << iCol if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 { unusableMask |= iMask @@ -174710,6 +171307,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -174840,7 +171438,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25339, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25369, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -174861,8 +171459,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24910, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24940, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -174923,176 +171522,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25341, + FzName: __ccgo_ts + 25371, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25346, + FzName: __ccgo_ts + 25376, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25352, + FzName: __ccgo_ts + 25382, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25363, + FzName: __ccgo_ts + 25393, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25405, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25405, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25393, + FzName: __ccgo_ts + 25423, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25413, + FzName: __ccgo_ts + 25443, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25426, + FzName: __ccgo_ts + 25456, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25440, + FzName: __ccgo_ts + 25470, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25443, + FzName: __ccgo_ts + 25473, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25447, + FzName: __ccgo_ts + 25477, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25459, + FzName: __ccgo_ts + 25489, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25472, + FzName: __ccgo_ts + 25502, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25484, + FzName: __ccgo_ts + 25514, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25497, + FzName: __ccgo_ts + 25527, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25508, + FzName: __ccgo_ts + 25538, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25520, + FzName: __ccgo_ts + 25550, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25531, + FzName: __ccgo_ts + 25561, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25543, + FzName: __ccgo_ts + 25573, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25556, + FzName: __ccgo_ts + 25586, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25569, + FzName: __ccgo_ts + 25599, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25583, + FzName: __ccgo_ts + 25613, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25592, + FzName: __ccgo_ts + 25622, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25632, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25632, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25642, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25642, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25623, + FzName: __ccgo_ts + 25653, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25640, + FzName: __ccgo_ts + 25670, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25658, + FzName: __ccgo_ts + 25688, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25676, + FzName: __ccgo_ts + 25706, }, } @@ -175162,6 +171761,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -175172,11 +171772,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25695, + FzName: __ccgo_ts + 25725, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25705, + FzName: __ccgo_ts + 25735, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -175617,7 +172217,6 @@ func _readInt16(tls *libc.TLS, p uintptr) (r int32) { } func _readCoord(tls *libc.TLS, p uintptr, pCoord uintptr) { - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(pCoord)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(p))) } @@ -175645,9 +172244,6 @@ func _writeCoord(tls *libc.TLS, p uintptr, pCoord uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* i at bp+0 */ Tu32 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCoord))) libc.Xmemcpy(tls, p, bp, uint64(4)) return int32(4) @@ -175669,7 +172265,6 @@ func _writeInt64(tls *libc.TLS, p uintptr, _i Ti64) (r int32) { // */ func _nodeReference(tls *libc.TLS, p uintptr) { if p != 0 { - _ = libc.Int32FromInt32(0) (*TRtreeNode)(unsafe.Pointer(p)).FnRef++ } } @@ -175710,6 +172305,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -175723,7 +172319,6 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { func _nodeHashInsert(tls *libc.TLS, pRtree uintptr, pNode uintptr) { var iHash int32 _ = iHash - _ = libc.Int32FromInt32(0) iHash = int32(_nodeHash(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode)) (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext = *(*uintptr)(unsafe.Pointer(pRtree + 192 + uintptr(iHash)*8)) *(*uintptr)(unsafe.Pointer(pRtree + 192 + uintptr(iHash)*8)) = pNode @@ -175743,9 +172338,9 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { if !(*(*uintptr)(unsafe.Pointer(pp)) != pNode) { break } - _ = libc.Int32FromInt32(0) goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -175785,11 +172380,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -175829,10 +172422,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25715, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25745, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -175886,6 +172478,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -175914,6 +172507,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -175949,7 +172543,6 @@ func _nodeInsertCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr _, _ = nCell, nMaxCell /* Maximum number of cells for pNode */ nMaxCell = ((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize - int32(4)) / int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) - _ = libc.Int32FromInt32(0) if nCell < nMaxCell { _nodeOverwriteCell(tls, pRtree, pNode, pCell, nCell) _writeInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2, nCell+int32(1)) @@ -175999,8 +172592,6 @@ func _nodeRelease(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _ = rc rc = SQLITE_OK if pNode != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TRtreeNode)(unsafe.Pointer(pNode)).FnRef-- if (*TRtreeNode)(unsafe.Pointer(pNode)).FnRef == 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- @@ -176028,7 +172619,6 @@ func _nodeRelease(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { // ** an internal node, then the 64-bit integer is a child page number. // */ func _nodeGetRowid(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) (r Ti64) { - _ = libc.Int32FromInt32(0) return _readInt64(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+uintptr(int32(4)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*iCell)) } @@ -176100,9 +172690,7 @@ func _rtreeRelease(tls *libc.TLS, pRtree uintptr) { (*TRtree)(unsafe.Pointer(pRtree)).FnBusy-- if (*TRtree)(unsafe.Pointer(pRtree)).FnBusy == uint32(0) { (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(0) - _ = libc.Int32FromInt32(0) _nodeBlobReset(tls, pRtree) - _ = libc.Int32FromInt32(0) Xsqlite3_finalize(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteNode) Xsqlite3_finalize(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpDeleteNode) Xsqlite3_finalize(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) @@ -176139,7 +172727,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25720, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25750, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -176200,6 +172788,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -176213,6 +172802,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -176232,12 +172822,13 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { _, _ = pCsr, pRtree pRtree = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab pCsr = cur - _ = libc.Int32FromInt32(0) _resetCursor(tls, pCsr) Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -176286,8 +172877,6 @@ func _rtreeCallbackConstraint(tls *libc.TLS, pConstraint uintptr, eInt int32, pC _, _, _, _, _ = nCoord, pInfo, rc, v1, v2 pInfo = (*TRtreeConstraint)(unsafe.Pointer(pConstraint)).FpInfo /* Callback info */ nCoord = (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FnCoord /* Decoded coordinates */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TRtreeConstraint)(unsafe.Pointer(pConstraint)).Fop == int32(RTREE_QUERY) && int32((*TRtreeSearchPoint)(unsafe.Pointer(pSearch)).FiLevel) == int32(1) { (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FiRowid = _readInt64(tls, pCellData) } @@ -176404,8 +172993,6 @@ func _rtreeNonleafConstraint(tls *libc.TLS, p uintptr, eInt int32, pCellData uin ** in a coordinate pair. But make pCellData point to the lower bound. */ pCellData += uintptr(int32(8) + int32(4)*((*TRtreeConstraint)(unsafe.Pointer(p)).FiCoord&int32(0xfe))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) switch (*TRtreeConstraint)(unsafe.Pointer(p)).Fop { case int32(RTREE_TRUE): return /* Always satisfied */ @@ -176484,10 +173071,9 @@ func _rtreeLeafConstraint(tls *libc.TLS, p uintptr, eInt int32, pCellData uintpt var v1 Tsqlite3_rtree_dbl var _ /* c at bp+0 */ TRtreeCoord _, _ = xN, v1 /* Coordinate value converted to a double */ - _ = libc.Int32FromInt32(0) pCellData += uintptr(int32(8) + (*TRtreeConstraint)(unsafe.Pointer(p)).FiCoord*int32(4)) - _ = libc.Int32FromInt32(0) - /* Coordinate decoded */ *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + /* Coordinate decoded */ + *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) if eInt != 0 { v1 = float64(*(*int32)(unsafe.Pointer(bp))) } else { @@ -176533,7 +173119,6 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, var ii, nCell int32 _, _ = ii, nCell nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < nCell) { @@ -176545,6 +173130,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { j = (i - int32(1)) / int32(2) pParent = (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(j)*24 @@ -176729,9 +173310,7 @@ func _rtreeSearchPointNew(tls *libc.TLS, pCur uintptr, rScore TRtreeDValue, iLev return uintptr(0) } ii = int32((int64(pNew)-int64((*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint))/24) + int32(1) - _ = libc.Int32FromInt32(0) if ii < int32(RTREE_CACHE_SZ) { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pCur + 88 + uintptr(ii)*8)) = *(*uintptr)(unsafe.Pointer(pCur + 88)) } else { _nodeRelease(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer(pCur + 88))) @@ -176758,7 +173337,6 @@ func _rtreeSearchPointPop(tls *libc.TLS, p uintptr) { var v2 uintptr _, _, _, _, _, _, _ = i, j, k, n, v1, v2, v3 i = int32(1) - int32((*TRtreeCursor)(unsafe.Pointer(p)).FbPoint) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) != 0 { _nodeRelease(tls, (*TRtreeCursor)(unsafe.Pointer(p)).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8))) *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) = uintptr(0) @@ -176839,7 +173417,6 @@ func _rtreeStepToLeaf(tls *libc.TLS, pCur uintptr) (r int32) { return *(*int32)(unsafe.Pointer(bp + 4)) } nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) - _ = libc.Int32FromInt32(0) pCellData = (*TRtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr(libc.Int32FromInt32(4)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) for int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) < nCell { *(*Tsqlite3_rtree_dbl)(unsafe.Pointer(bp + 8)) = float64(-libc.Int32FromInt32(1)) @@ -176869,6 +173446,7 @@ func _rtreeStepToLeaf(tls *libc.TLS, pCur uintptr) (r int32) { } goto _2 _2: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == NOT_WITHIN { @@ -176888,6 +173466,7 @@ func _rtreeStepToLeaf(tls *libc.TLS, pCur uintptr) (r int32) { } goto _3 _3: + ; ii++ } x.FiCell = uint8(0) @@ -176955,7 +173534,11 @@ func _rtreeRowid(tls *libc.TLS, pVtabCursor uintptr, pRowid uintptr) (r int32) { *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK pNode = _rtreeNodeOfFirstSearchPoint(tls, pCsr, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && p != 0 { - *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -176983,6 +173566,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -176991,7 +173577,6 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { Xsqlite3_result_double(tls, ctx, float64(*(*TRtreeValue)(unsafe.Pointer(bp)))) } else { - _ = libc.Int32FromInt32(0) Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(bp))) } } else { @@ -177059,7 +173644,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25802) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25832) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -177122,7 +173707,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 16)) != uintptr(0) { p = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8(0)) - _ = libc.Int32FromInt32(0) /* Always returns pCsr->sPoint */ + /* Always returns pCsr->sPoint */ *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp + 16)) (*TRtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*Ti64)(unsafe.Pointer(bp + 24)) (*TRtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = uint8(PARTLY_WITHIN) @@ -177144,7 +173729,6 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } else { libc.Xmemset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint, 0, uint64(24)*uint64(argc)) libc.Xmemset(tls, pCsr+128, 0, uint64(4)*uint64((*TRtree)(unsafe.Pointer(pRtree)).FiDepth+libc.Int32FromInt32(1))) - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < argc) { @@ -177197,12 +173781,13 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } } if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) /* Due to the resetCursor() call above */ + /* Due to the resetCursor() call above */ pNew = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8((*TRtree)(unsafe.Pointer(pRtree)).FiDepth+libc.Int32FromInt32(1))) if pNew == uintptr(0) { /* Because pCsr->bPoint was FALSE */ return int32(SQLITE_NOMEM) @@ -177210,7 +173795,6 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = uint8(0) (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = uint8(PARTLY_WITHIN) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) rc = _rtreeStepToLeaf(tls, pCsr) @@ -177285,9 +173869,9 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint && iIdx < int32(libc.Uint64FromInt64(41)-libc.Uint64FromInt32(1))) { @@ -177304,6 +173888,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -177355,6 +173940,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -177381,7 +173967,6 @@ func _cellArea(tls *libc.TLS, pRtree uintptr, p uintptr) (r TRtreeDValue) { var area TRtreeDValue _ = area area = libc.Float64FromInt32(1) - _ = libc.Int32FromInt32(0) if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { switch int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim) { case int32(5): @@ -177518,6 +174103,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -177533,6 +174119,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -177616,11 +174203,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -177676,6 +174265,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -177699,6 +174289,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -177707,6 +174298,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -177879,11 +174471,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -177914,6 +174508,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -177927,6 +174522,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -177936,6 +174532,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48)) @@ -177962,6 +174559,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -177989,6 +174587,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -178037,6 +174636,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -178092,7 +174692,6 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe if rc == SQLITE_OK { _nodeOverwriteCell(tls, pRtree, pParent, bp, *(*int32)(unsafe.Pointer(bp + 96))) rc = _AdjustTree(tls, pRtree, pParent, bp) - _ = libc.Int32FromInt32(0) } if rc != SQLITE_OK { goto splitnode_out @@ -178118,6 +174717,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -178133,6 +174733,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -178149,6 +174750,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -178193,6 +174795,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -178219,7 +174822,6 @@ func _removeNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, iHeight int32) (r var _ /* iCell at bp+0 */ int32 _, _, _, _, _ = pParent, rc, rc2, v1, v2 pParent = uintptr(0) - _ = libc.Int32FromInt32(0) /* Remove the entry in the parent cell. */ rc = _nodeParentIndex(tls, pRtree, pNode, bp) if rc == SQLITE_OK { @@ -178284,6 +174886,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -178321,7 +174924,6 @@ func _deleteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iHei ** node. */ pParent = (*TRtreeNode)(unsafe.Pointer(pNode)).FpParent - _ = libc.Int32FromInt32(0) if pParent != 0 { if _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) < ((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize-int32(4))/int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)/int32(3) { rc = _removeNode(tls, pRtree, pNode, iHeight) @@ -178394,6 +174996,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -178440,7 +175043,6 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r if rc == SQLITE_OK { rc = _findLeafNode(tls, pRtree, iDelete, bp, uintptr(0)) } - _ = libc.Int32FromInt32(0) /* Delete the cell in question from the leaf node. */ if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp)) != 0 { rc = _nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), iDelete, bp+8) @@ -178497,6 +175099,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -178575,8 +175178,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - _ = libc.Int32FromInt32(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25816, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25846, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -178586,11 +175188,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25836, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25866, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25868, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25898, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178625,7 +175227,6 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, aErrMsg[int32(2)+libc.BoolInt32(argc >= int32(6))])) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, aErrMsg[int32(2)+libc.BoolInt32(argc >= int32(6))])) return int32(SQLITE_ERROR) } Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_CONSTRAINT_SUPPORT), libc.VaList(bp+8, int32(1))) @@ -179210,13 +175822,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27289, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27265, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27295, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -179225,7 +175837,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27289, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27319, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -179236,21 +175848,22 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27346, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) } else { if ii < argc { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, aErrMsg[int32(4)])) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, aErrMsg[int32(4)])) rc = int32(SQLITE_ERROR) } else { v3 = Xsqlite3_declare_vtab(tls, db, zSql) rc = v3 if SQLITE_OK != v3 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } } @@ -179273,7 +175886,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } } if iErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, aErrMsg[iErr])) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, aErrMsg[iErr])) goto rtreeInit_fail } (*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell = uint8(int32(8) + int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)*int32(4)) @@ -179284,24 +175897,23 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } rc = _rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) if rc != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail } *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _rtreeRelease(tls, pRtree) return rc } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27295, - 1: __ccgo_ts + 27306, + 0: __ccgo_ts + 27325, + 1: __ccgo_ts + 27336, } // C documentation @@ -179359,22 +175971,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11177, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11206, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27319, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27349, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27325, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27355, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27329, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27359, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -179398,7 +176012,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27331, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27361, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -179516,11 +176130,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4178 + v1 = __ccgo_ts + 4207 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27364, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27394, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -179554,7 +176168,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27371, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27401, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -179571,7 +176185,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27416, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27446, libc.VaList(bp+8, iNode)) } } return pRet @@ -179600,10 +176214,9 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27448, - 1: __ccgo_ts + 27502, + 0: __ccgo_ts + 27478, + 1: __ccgo_ts + 27532, } - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -179615,21 +176228,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27550 + v1 = __ccgo_ts + 27580 } else { - v1 = __ccgo_ts + 27558 + v1 = __ccgo_ts + 27588 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27567, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27597, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27550 + v2 = __ccgo_ts + 27580 } else { - v2 = __ccgo_ts + 27558 + v2 = __ccgo_ts + 27588 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27612, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27642, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -179674,7 +176287,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27670, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27700, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -179692,11 +176305,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27718, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27748, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -179721,24 +176335,22 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt _, _, _, _, _ = aNode, i, iVal, nCell, pCell aNode = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27785, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27815, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27819, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27849, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27849, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27879, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -179758,6 +176370,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -179782,12 +176395,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27904, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27934, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27935, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27965, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -179816,7 +176429,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28002, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28032, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -179826,11 +176439,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25816, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25846, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28030, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28060, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -179846,8 +176459,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28061, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28068, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28091, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28098, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -179869,13 +176482,12 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt var rc int32 _, _ = pRtree, rc pRtree = pVtab - _ = libc.Int32FromInt32(0) _ = zSchema _ = zName _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28076, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28106, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -179926,13 +176538,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28095, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28125, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6560 + zDb = __ccgo_ts + 6589 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -179941,7 +176553,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18427 + v1 = __ccgo_ts + 18465 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -180164,6 +176776,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -180274,6 +176887,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -180334,6 +176948,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -180404,18 +177019,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25069, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25099, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28146, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28176, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28157, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28187, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180444,19 +177060,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = int8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28168, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28198, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28186, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28216, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = int8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28224, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -180464,13 +177081,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28202, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28232, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28206, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28236, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180522,6 +177140,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -180551,6 +177170,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -180616,6 +177236,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -180632,7 +177253,6 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { func _geopolySine(tls *libc.TLS, r float64) (r1 float64) { var r2, r3, r5 float64 _, _, _ = r2, r3, r5 - _ = libc.Int32FromInt32(0) if r >= libc.Float64FromFloat64(1.5)*libc.Float64FromFloat64(3.141592653589793) { r -= libc.Float64FromFloat64(2) * libc.Float64FromFloat64(3.141592653589793) } @@ -180694,6 +177314,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -180763,6 +177384,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -180772,6 +177394,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -180799,18 +177422,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) } _2: + ; return pOut } @@ -180993,6 +177620,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -181169,6 +177797,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -181235,6 +177864,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -181243,6 +177873,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -181254,6 +177885,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -181322,6 +177954,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -181338,6 +177971,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -181404,6 +178038,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -181428,6 +178063,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181464,6 +178100,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181488,6 +178125,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -181577,13 +178215,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27289, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28219, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28249, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -181592,12 +178230,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28241, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28271, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27346, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -181605,7 +178244,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint v2 = Xsqlite3_declare_vtab(tls, db, zSql) rc = v2 if SQLITE_OK != v2 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } Xsqlite3_free(tls, zSql) @@ -181620,17 +178259,16 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint } rc = _rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) if rc != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail } *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _rtreeRelease(tls, pRtree) return rc } @@ -181695,7 +178333,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin *(*int32)(unsafe.Pointer(bp + 8)) = _findLeafNode(tls, pRtree, iRowid, bp+16, bp+24) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 16)) != uintptr(0) { p = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8(0)) - _ = libc.Int32FromInt32(0) /* Always returns pCsr->sPoint */ + /* Always returns pCsr->sPoint */ *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp + 16)) (*TRtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*Ti64)(unsafe.Pointer(bp + 24)) (*TRtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = uint8(PARTLY_WITHIN) @@ -181710,8 +178348,6 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin */ *(*int32)(unsafe.Pointer(bp + 8)) = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && idxNum <= int32(3) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(argv)), bp+32, bp+8) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { goto geopoly_filter_end @@ -181771,13 +178407,13 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = uint8(0) (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = uint8(PARTLY_WITHIN) - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = _rtreeStepToLeaf(tls, pCsr) } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -181828,11 +178464,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16660 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16698 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -181842,7 +178479,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28245 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28275 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -181850,7 +178487,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28251 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28281 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -181951,7 +178588,6 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)< int32(1) && (!(oldRowidValid != 0) || !(Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0) || oldRowid != newRowid) { - _ = libc.Int32FromInt32(0) _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28260, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28290, 0) } goto geopoly_update_end } @@ -182026,7 +178661,6 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux nChange = 0 Xsqlite3_bind_int64(tls, pUp, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid) - _ = libc.Int32FromInt32(0) if Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0 { Xsqlite3_bind_null(tls, pUp, int32(2)) } else { @@ -182052,6 +178686,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -182060,6 +178695,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -182073,12 +178709,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28300) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28330) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28316) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28346) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -182134,6 +178770,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -182144,10 +178781,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28493, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28523, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -182161,61 +178799,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28331, + FzName: __ccgo_ts + 28361, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28344, + FzName: __ccgo_ts + 28374, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28357, + FzName: __ccgo_ts + 28387, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28370, + FzName: __ccgo_ts + 28400, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28316, + FzName: __ccgo_ts + 28346, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28382, + FzName: __ccgo_ts + 28412, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28300, + FzName: __ccgo_ts + 28330, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28405, + FzName: __ccgo_ts + 28435, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28419, + FzName: __ccgo_ts + 28449, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28432, + FzName: __ccgo_ts + 28462, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28446, + FzName: __ccgo_ts + 28476, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28462, + FzName: __ccgo_ts + 28492, }, } @@ -182241,7 +178879,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28474, + FzName: __ccgo_ts + 28504, }, } @@ -182266,20 +178904,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28501, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28531, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28511, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28541, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28522, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28552, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28245, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28275, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28533, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28563, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -182324,6 +178962,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -182373,13 +179012,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25802, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25832, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -183589,7 +180229,6 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt var aDelta, aOrig, aOut uintptr var nDelta, nOrig, nOut, nOut2 int32 _, _, _, _, _, _, _ = aDelta, aOrig, aOut, nDelta, nOrig, nOut, nOut2 - _ = libc.Int32FromInt32(0) nOrig = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) aOrig = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) nDelta = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -183597,7 +180236,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28573, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -183607,7 +180246,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28573, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -183633,7 +180272,7 @@ func _prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg _ = rc rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -183656,7 +180295,7 @@ func _resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) (r in _ = rc rc = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -183681,7 +180320,6 @@ func _resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) (r in func _prepareFreeAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) (r int32) { var rc int32 _ = rc - _ = libc.Int32FromInt32(0) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) @@ -183710,6 +180348,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -183788,7 +180427,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28564, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28594, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -183869,16 +180508,14 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { var p, zIn uintptr _, _, _ = i, p, zIn p = Xsqlite3_user_data(tls, pCtx) - _ = libc.Int32FromInt32(0) zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _ = libc.Int32FromInt32(0) if argc == int32(1) || 0 == Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25715, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25745, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -183886,6 +180523,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -183914,13 +180552,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint64(192)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28735 + v1 = __ccgo_ts + 28765 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28776, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28806, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28926) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28956) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -184004,7 +180642,6 @@ func _rbuMalloc(tls *libc.TLS, p uintptr, nByte Tsqlite3_int64) (r uintptr) { _ = pRet pRet = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _ = libc.Int32FromInt32(0) pRet = Xsqlite3_malloc64(tls, uint64(nByte)) if pRet == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) @@ -184088,7 +180725,7 @@ func _rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { rc = Xsqlite3_finalize(tls, pStmt) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && rc != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } @@ -184149,8 +180786,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29051, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29081, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -184160,7 +180796,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29170, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29200, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -184168,7 +180804,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29191, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29221, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -184180,7 +180816,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29242, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29272, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -184191,6 +180827,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -184199,6 +180836,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -184221,7 +180859,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184234,7 +180872,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -184284,11 +180922,10 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 iOrder = 0 *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* Figure out the type of table this step will deal with. */ - _ = libc.Int32FromInt32(0) _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19870, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19908, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -184296,11 +180933,10 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum = *(*int32)(unsafe.Pointer(bp + 8)) } - _ = libc.Int32FromInt32(0) /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29320, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29350, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -184311,7 +180947,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29339, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29369, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -184319,12 +180955,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29344, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29374, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184332,17 +180969,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29354 + v4 = __ccgo_ts + 29384 } else { - v4 = __ccgo_ts + 29367 + v4 = __ccgo_ts + 29397 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29376, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29406, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29405, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29435, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184359,11 +180996,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29427, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29457, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -184377,7 +181015,6 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iOrder)*8)) = t1 } *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iOrder)*8)) = _rbuStrndup(tls, zType, p+56) - _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iOrder))) = uint8(iPk) *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iOrder))) = libc.BoolUint8(uint8(bNotNull) != 0 || iPk != 0) iOrder++ @@ -184385,8 +181022,6 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuObjIterCacheIndexedCols(tls, p, pIter) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc } @@ -184405,17 +181040,18 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) var z, zList, zSep uintptr _, _, _, _ = i, z, zList, zSep zList = uintptr(0) - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 i = 0 for { if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29454, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29484, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14994 goto _1 _1: + ; i++ } return zList @@ -184437,7 +181073,7 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, _, _, _, _, _ = i, iPk, zCol, zRet, zSep iPk = int32(1) zRet = uintptr(0) - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 for int32(1) != 0 { i = 0 for { @@ -184446,12 +181082,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29463, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29493, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -184493,21 +181130,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29476, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29506, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29508, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29538, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+29531) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29537, __ccgo_ts+29544, __ccgo_ts+5081) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1652, __ccgo_ts+14994, __ccgo_ts+29561) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29567, __ccgo_ts+29574, __ccgo_ts+5110) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1652, __ccgo_ts+14994, __ccgo_ts+1652) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29552, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29582, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29594, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29624, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -184556,10 +181193,10 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -184576,20 +181213,20 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29644 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29643, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29679, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14965 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29652, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29673, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29709, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14994 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -184598,9 +181235,9 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29706, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29736, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 iCol = 0 for { if !(iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -184615,19 +181252,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29754, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14965 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29784, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14994 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29761, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29791, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -184674,12 +181313,11 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zImpPK = uintptr(0) /* String to return via *pzImposterPK */ zWhere = uintptr(0) /* String to return via *pzWhere */ nBind = 0 /* Value to return via *pnBind */ - zCom = __ccgo_ts + 1648 /* Set to ", " later on */ - zAnd = __ccgo_ts + 1648 /* Set to " AND " later on */ + zCom = __ccgo_ts + 1652 /* Set to ", " later on */ + zAnd = __ccgo_ts + 1652 /* Set to " AND " later on */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184688,8 +181326,8 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29773, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) - zType = __ccgo_ts + 1648 + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29803, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zType = __ccgo_ts + 1652 } else { if iCid < 0 { /* An integer primary key. If the table has an explicit IPK, use @@ -184702,40 +181340,40 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29644 } else { - zCol = __ccgo_ts + 29344 + zCol = __ccgo_ts + 29374 } } - zType = __ccgo_ts + 1136 + zType = __ccgo_ts + 1140 } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29795, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29825, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29531 + v2 = __ccgo_ts + 29561 } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29815, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29845, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29836, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29869, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29866, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29899, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14965 - zAnd = __ccgo_ts + 21979 + zCom = __ccgo_ts + 14994 + zAnd = __ccgo_ts + 22017 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184781,7 +181419,7 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr _, _, _, _ = i, zCol, zList, zS zList = uintptr(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - zS = __ccgo_ts + 1648 + zS = __ccgo_ts + 1652 i = 0 for { if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -184789,22 +181427,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29893, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29923, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29905, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29935, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14965 + zS = __ccgo_ts + 14994 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29914, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29944, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -184830,26 +181469,27 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29959, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 i = 0 for { if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29943, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29973, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22017 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29985, libc.VaList(bp+8, zList)) } else { - zSep1 = __ccgo_ts + 1648 + zSep1 = __ccgo_ts + 1652 i1 = 0 for { if !(i1 < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -184857,11 +181497,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30035, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22017 } goto _2 _2: + ; i1++ } } @@ -184880,7 +181521,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30018, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30048, 0) } // C documentation @@ -184914,7 +181555,7 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt if int32(libc.Xstrlen(tls, zMask)) != (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { _rbuBadControlError(tls, p) } else { - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 i = 0 for { if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -184922,21 +181563,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30035, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14994 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30044, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14994 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30104, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14994 } } } goto _1 _1: + ; i++ } } @@ -184984,6 +181626,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) goto _1 _1: + ; i++ } } @@ -185012,18 +181655,17 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { var _ /* pXList at bp+0 */ uintptr _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 z = uintptr(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30111 + zSep = __ccgo_ts + 30141 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29293, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16548) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16586) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, zIdx))) } break } @@ -185034,16 +181676,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29561 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30124, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14965 + z = _rbuMPrintf(tls, p, __ccgo_ts+30154, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14994 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30135, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30165, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -185083,13 +181725,13 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* SELECT name ... WHERE rootpage = $tnum */ zIdx = uintptr(0) /* Name of PK index */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA main.index_xinfo = $zIdx */ - zComma = __ccgo_ts + 1648 + zComma = __ccgo_ts + 1652 zCols = uintptr(0) /* Used to build up list of table cols */ zPk = uintptr(0) /* Used to build up table PK declaration */ /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30139) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30169) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -185097,7 +181739,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -185106,21 +181748,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30189, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30219, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29561 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30211, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14965 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30241, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14994 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30221, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30251, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30236, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30266, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, 0, 0)) } } @@ -185155,48 +181797,49 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { _, _, _, _, _, _, _, _, _ = iCol, tnum, zCol, zComma, zPk, zPk1, zSql, v2, v3 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum - zComma = __ccgo_ts + 1648 + zComma = __ccgo_ts + 1652 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { break } - zPk = __ccgo_ts + 1648 + zPk = __ccgo_ts + 1652 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30298 + zPk = __ccgo_ts + 30328 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30311 + v2 = __ccgo_ts + 30341 } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30321, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14965 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30351, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14994 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30348, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30378, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30355 + v3 = __ccgo_ts + 30385 } else { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30370, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30400, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, 0, 0)) } } @@ -185222,8 +181865,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { - _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30402, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30432, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -185233,7 +181875,6 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { _, _, _ = i, p, rc p = Xsqlite3_user_data(tls, pCtx) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) != 0 { *(*Ti64)(unsafe.Pointer(p + 304)) += int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) } @@ -185245,6 +181886,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -185268,9 +181910,8 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc zRet = uintptr(0) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30459) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30489) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -185303,7 +181944,6 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } if int32(c) == int32('(') { if nParen == 0 { - _ = libc.Int32FromInt32(0) (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol))).FzSpan = zSql + uintptr(i+int32(1)) } nParen++ @@ -185340,6 +181980,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -185354,6 +181995,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -185365,6 +182007,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185379,6 +182022,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185394,6 +182038,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -185428,7 +182073,6 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 var _ /* zImposterPK at bp+8 */ uintptr var _ /* zWhere at bp+16 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bRbuRowid, pz, tnum, zBind, zBindings, zCollist, zIdx, zLimit, zNewlist, zOldlist, zOrder, zPart, zRbuRowid, zRbuRowid1, zSql, zStart, zStart1, zTbl, zTbl1, zWhere1, zWrite, v1, v10, v2, v3, v4, v5, v6, v7, v8, v9 - _ = libc.Int32FromInt32(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect == uintptr(0) && _rbuObjIterCacheTableInfo(tls, p, pIter) == SQLITE_OK { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zCollist = uintptr(0) /* List of indexed columns */ @@ -185436,7 +182080,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30525, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30555, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -185449,23 +182093,22 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zBind = uintptr(0) zPart = uintptr(0) *(*int32)(unsafe.Pointer(bp + 24)) = 0 - _ = libc.Int32FromInt32(0) zPart = _rbuObjIterGetIndexWhere(tls, p, pIter) zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30545, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30575, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30610, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30640, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30646, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30676, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185480,26 +182123,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30680 + v2 = __ccgo_ts + 30710 } else { - v2 = __ccgo_ts + 30684 + v2 = __ccgo_ts + 30714 } v1 = v2 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30690, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30720, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30751, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30781, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30680 + v3 = __ccgo_ts + 30710 } else { - v3 = __ccgo_ts + 30684 + v3 = __ccgo_ts + 30714 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30812, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30842, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185518,62 +182161,62 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6571) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6567) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6600) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6596) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ _rbuCreateImposterTable(tls, p, pIter) _rbuCreateImposterTable2(tls, p, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { - v4 = __ccgo_ts + 1648 + v4 = __ccgo_ts + 1652 } else { - v4 = __ccgo_ts + 30971 + v4 = __ccgo_ts + 31001 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30980 + v5 = __ccgo_ts + 31010 } else { - v5 = __ccgo_ts + 1648 + v5 = __ccgo_ts + 1652 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30990, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31020, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31026, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31056, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - zRbuRowid = __ccgo_ts + 1648 + zRbuRowid = __ccgo_ts + 1652 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31054 + zRbuRowid = __ccgo_ts + 31084 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31066 + v6 = __ccgo_ts + 31096 } else { - v6 = __ccgo_ts + 1648 + v6 = __ccgo_ts + 1652 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31083, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31159, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31113, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31189, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31458, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31488, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } /* Create the SELECT statement to read keys from data_xxx */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zRbuRowid1 = __ccgo_ts + 1648 + zRbuRowid1 = __ccgo_ts + 1652 zStart1 = uintptr(0) zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31557 + v7 = __ccgo_ts + 31587 } else { - v7 = __ccgo_ts + 31567 + v7 = __ccgo_ts + 31597 } zRbuRowid1 = v7 } @@ -185586,28 +182229,28 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29614, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29644, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1652, __ccgo_ts+14994, __ccgo_ts+1652) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31578 + v8 = __ccgo_ts + 31608 } else { - v8 = __ccgo_ts + 1648 + v8 = __ccgo_ts + 1652 } if zStart1 != 0 { v9 = zStart1 } else { - v9 = __ccgo_ts + 1648 + v9 = __ccgo_ts + 1652 } if zOrder != 0 { - v10 = __ccgo_ts + 23173 + v10 = __ccgo_ts + 23211 } else { - v10 = __ccgo_ts + 1648 + v10 = __ccgo_ts + 1652 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31584, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31614, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -185664,9 +182307,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } - _ = libc.Int32FromInt32(0) if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { pp = pIter + 184 for { @@ -185675,6 +182318,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -185692,11 +182336,11 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - zPrefix = __ccgo_ts + 1648 + zPrefix = __ccgo_ts + 1652 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30971 + zPrefix = __ccgo_ts + 31001 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31632, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31662, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -185723,7 +182367,7 @@ func _rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) (r } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp, flags, v1) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp))) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) } @@ -185770,7 +182414,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31662, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31692, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -185825,34 +182469,31 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) var bOpen, rc int32 var pState, zExtra, zFile, zTarget, v1, v2, v3 uintptr _, _, _, _, _, _, _, _, _ = bOpen, pState, rc, zExtra, zFile, zTarget, v1, v2, v3 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Open the RBU database */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6589, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31692, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6589) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31722, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31720, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+48, __ccgo_ts+3418, uint64(4)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31750, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+3422, uint64(4)) } else { - libc.Xmemcpy(tls, p+48, __ccgo_ts+6560, uint64(4)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+6589, uint64(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31738, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31768, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6589, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -185885,10 +182526,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31804, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31834, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24562, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24600, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*int8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -185902,16 +182543,16 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if zExtra == uintptr(0) { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } else { - v2 = __ccgo_ts + 31836 + v2 = __ccgo_ts + 31866 } if zExtra == uintptr(0) { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31838, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31868, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6589), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -185922,27 +182563,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31870, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31900, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31885, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31915, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31902, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31932, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31948, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31946, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31976, 0) } } @@ -186026,7 +182667,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31948, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -186059,7 +182700,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31964, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31994, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186082,7 +182723,6 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { } else { pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal pWal = (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal - _ = libc.Int32FromInt32(0) nSectorSize = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSectorSize})))(tls, pDb) if nSectorSize > (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = nSectorSize / (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz @@ -186165,7 +182805,6 @@ func _rbuCheckpointFrame(tls *libc.TLS, p uintptr, pFrame uintptr) { _, _, _ = iOff, pDb, pWal pWal = (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal - _ = libc.Int32FromInt32(0) iOff = int64((*TRbuFrame)(unsafe.Pointer(pFrame)).FiWalFrame-libc.Uint32FromInt32(1))*int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz+libc.Int32FromInt32(24)) + int64(32) + int64(24) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pWal)).FpMethods)).FxRead})))(tls, pWal, (*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz, iOff) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { @@ -186194,16 +182833,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6589, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6589, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6589, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6589, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -186225,7 +182864,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+31999, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32029, 0) } // C documentation @@ -186242,15 +182881,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6589) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32024, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32031, libc.VaList(bp+8, zMove)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32054, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32061, libc.VaList(bp+8, zMove)) if zWal == uintptr(0) || zOal == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -186272,7 +182909,6 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = uintptr(0) dbMain = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget, int32(1)) if dbMain != 0 { - _ = libc.Int32FromInt32(0) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuLockDatabase(tls, dbMain) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -186361,9 +182997,6 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { var pIter, pVal, pWriter uintptr _, _, _, _ = i, pIter, pVal, pWriter pIter = p + 80 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this is a delete, decrement nPhaseOneStep by nIndex. If the DELETE ** statement below does actually delete a row, nPhaseOneStep will be ** incremented by the same amount when SQL function rbu_tmp_insert() @@ -186386,7 +183019,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24119, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24157, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -186399,6 +183032,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -186446,8 +183080,6 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) eType = _rbuStepType(tls, p, bp) if eType != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (eType == int32(RBU_IDX_DELETE) || eType == int32(RBU_IDX_INSERT)) { _rbuBadControlError(tls, p) } else { @@ -186464,7 +183096,6 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { _rbuStepOneOp(tls, p, eType) } else { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(p + 304)) -= int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) _rbuGetUpdateStmt(tls, p, pIter, *(*uintptr)(unsafe.Pointer(bp)), bp+8) if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -186480,6 +183111,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -186523,7 +183155,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32038) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32068) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -186536,7 +183168,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32060, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32090, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -186563,9 +183195,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd } pFd = v1 - _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32087, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) - _ = libc.Int32FromInt32(0) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32117, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -186601,9 +183231,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32245, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32275, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32260, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32290, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -186626,10 +183256,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { _, _ = i, zSql *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32310, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32305) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32335) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186640,10 +183269,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32413) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32443) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32478) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32508) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -186654,13 +183283,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32522, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32552, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -186687,8 +183317,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17633) - _rbuCopyPragma(tls, p, __ccgo_ts+16744) + _rbuCopyPragma(tls, p, __ccgo_ts+17671) + _rbuCopyPragma(tls, p, __ccgo_ts+16782) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -186696,7 +183326,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32547, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32577, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -186715,14 +183345,13 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuObjIterNext(tls, p, pIter) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _ = libc.Int32FromInt32(0) _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14898, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14898, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -186801,7 +183430,6 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { var pIter uintptr var rc int32 _, _ = pIter, rc - _ = libc.Int32FromInt32(0) if (*TRbuState)(unsafe.Pointer(pState)).FzTbl != 0 { pIter = p + 80 rc = SQLITE_OK @@ -186810,7 +183438,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32575, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32605, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -186833,11 +183461,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32024, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32054, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_VFS_POINTER), bp) - _ = libc.Int32FromInt32(0) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6589, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } @@ -186858,13 +183485,11 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { var _ /* rnd at bp+0 */ int32 var _ /* zRnd at bp+4 */ [64]int8 _ = pVfs - _ = libc.Int32FromInt32(0) Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32600, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32630, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) - _ = libc.Int32FromInt32(0) (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRbu = p } @@ -186907,8 +183532,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain } db = v1 - _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32611, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32641, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -186953,11 +183577,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32683, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32713, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32697) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32727) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -186966,7 +183590,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32754) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32784) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -187014,7 +183638,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr libc.Xmemcpy(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, nRbu+uint64(1)) pCsr += uintptr(nRbu + uint64(1)) if zState != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+3795, libc.VaList(bp+16, zState)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+3799, libc.VaList(bp+16, zState)) } /* If the first attempt to open the database file fails and the bRetry ** flag it set, this means that the db was not opened because it seemed @@ -187030,7 +183654,6 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pState = _rbuLoadState(tls, p) - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 { _rbuDeleteOalFile(tls, p) @@ -187044,11 +183667,10 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz = (*TRbuState)(unsafe.Pointer(pState)).FiOalSz } } - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32828, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32858, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -187070,17 +183692,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32860 + v3 = __ccgo_ts + 32890 } else { - v3 = __ccgo_ts + 32867 + v3 = __ccgo_ts + 32897 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32874, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32904, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14854, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14883, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -187092,21 +183714,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17347) - _rbuCopyPragma(tls, p, __ccgo_ts+16759) + _rbuCopyPragma(tls, p, __ccgo_ts+17385) + _rbuCopyPragma(tls, p, __ccgo_ts+16797) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32906, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32936, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6589, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32922, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32952, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -187184,7 +183806,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32946, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32976, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -187231,7 +183853,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30971, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31001, uint64(8)) == 0 { nDel = int32(8) for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -187241,6 +183863,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -187258,7 +183881,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14898, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -187267,7 +183890,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14898, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -187277,7 +183900,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32954, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32984, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -187285,7 +183908,6 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { /* Close the open database handle and VFS object. */ Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu) Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) - _ = libc.Int32FromInt32(0) _rbuDeleteVfs(tls, p) Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf) Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FaFrame) @@ -187344,7 +183966,6 @@ func Xsqlite3rbu_bp_progress(tls *libc.TLS, p uintptr, pnOne uintptr, pnTwo uint *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS *(*int32)(unsafe.Pointer(pnTwo)) = MAX_PROGRESS default: - _ = libc.Int32FromInt32(0) } } @@ -187362,19 +183983,9 @@ func Xsqlite3rbu_state(tls *libc.TLS, p uintptr) (r int32) { 4: int32(SQLITE_RBU_STATE_CHECKPOINT), 5: int32(SQLITE_RBU_STATE_DONE), } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != int32(SQLITE_DONE) { return int32(SQLITE_RBU_STATE_ERROR) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return aRes[(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage] } return r @@ -187388,11 +183999,9 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if rc == int32(SQLITE_DONE) { return SQLITE_OK } - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14898, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -187404,21 +184013,20 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14898, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14854 + v1 = __ccgo_ts + 14883 } else { - v1 = __ccgo_ts + 32906 + v1 = __ccgo_ts + 32936 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32906, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32936, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -187516,7 +184124,6 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { var i int32 var xShmLock uintptr _, _ = i, xShmLock - _ = libc.Int32FromInt32(0) if (*Trbu_file)(unsafe.Pointer(p)).FpRbu != 0 { xShmLock = (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxShmLock i = 0 @@ -187529,6 +184136,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -187547,7 +184155,6 @@ func _rbuUpdateTempSize(tls *libc.TLS, pFd uintptr, nNew Tsqlite3_int64) (r int3 nDiff = nNew - (*Trbu_file)(unsafe.Pointer(pFd)).Fsz *(*Ti64)(unsafe.Pointer(pRbu + 376)) += nDiff (*Trbu_file)(unsafe.Pointer(pFd)).Fsz = nNew - _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTemp > (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit { return int32(SQLITE_FULL) } @@ -187568,7 +184175,6 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { var pIter, pRbuVfs uintptr _, _ = pIter, pRbuVfs pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs - _ = libc.Int32FromInt32(0) Xsqlite3_mutex_enter(tls, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) if (*Trbu_file)(unsafe.Pointer(p)).FpRbu == uintptr(0) { pIter = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187578,6 +184184,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187590,6 +184197,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -187616,6 +184224,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187629,6 +184238,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187661,6 +184271,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -187671,6 +184282,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -187697,6 +184309,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -187714,7 +184327,6 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { _rbuUpdateTempSize(tls, p, 0) } } - _ = libc.Int32FromInt32(0) /* Close the underlying file handle */ rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxClose})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal) return rc @@ -187761,7 +184373,6 @@ func _rbuVfsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst T p = pFile pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_CAPTURE) { - _ = libc.Int32FromInt32(0) rc = _rbuCaptureWalRead(tls, (*Trbu_file)(unsafe.Pointer(p)).FpRbu, iOfst, iAmt) } else { if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_OAL) && (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_WAL) != 0 && iOfst >= (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz { @@ -187821,7 +184432,6 @@ func _rbuVfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst p = pFile pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_CAPTURE) { - _ = libc.Int32FromInt32(0) rc = _rbuCaptureDbWrite(tls, (*Trbu_file)(unsafe.Pointer(p)).FpRbu, iOfst) } else { if pRbu != 0 { @@ -187921,7 +184531,6 @@ func _rbuVfsLock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { p = pFile pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if eLock == int32(SQLITE_LOCK_EXCLUSIVE) && ((*Trbu_file)(unsafe.Pointer(p)).FbNolock != 0 || pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage != int32(RBU_STAGE_DONE)) { /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this ** prevents it from checkpointing the database from sqlite3_close(). */ @@ -187970,7 +184579,6 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r _, _, _, _, _, _, _, _ = p, pRbu, pRbu1, pRbuVfs, rc, xControl, zIn, zOut p = pFile xControl = (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxFileControl - _ = libc.Int32FromInt32(0) if op == int32(SQLITE_FCNTL_RBU) { pRbu = pArg /* First try to find another RBU vfs lower down in the vfs stack. If @@ -187984,7 +184592,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32981, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33011, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -188010,7 +184618,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33004, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33034, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -188055,8 +184663,6 @@ func _rbuVfsShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int p = pFile pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if pRbu != 0 && ((*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_OAL) || (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_MOVE) || (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_DONE)) { /* Prevent SQLite from taking a shm-lock on the target file when it ** is supplying heap memory to the upper layer in place of *-shm @@ -188100,7 +184706,6 @@ func _rbuVfsShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, /* If not in RBU_STAGE_OAL, allow this call to pass through. Or, if this ** rbu is in the RBU_STAGE_OAL state, use heap memory for *-shm space ** instead of a file on disk. */ - _ = libc.Int32FromInt32(0) if eStage == int32(RBU_STAGE_OAL) { nByte = int64(uint64(iRegion+libc.Int32FromInt32(1)) * uint64(8)) apNew = Xsqlite3_realloc64(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm, uint64(nByte)) @@ -188108,7 +184713,6 @@ func _rbuVfsShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, ** pages of the *-shm file. Since no other process can have run ** recovery, the connection must request *-shm pages in order ** from start to finish. */ - _ = libc.Int32FromInt32(0) if apNew == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -188131,7 +184735,6 @@ func _rbuVfsShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) } } else { - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxShmMap})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, pp) } return rc @@ -188166,7 +184769,6 @@ func _rbuVfsShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) (r int32) { v1 = 0 } eStage = v1 - _ = libc.Int32FromInt32(0) if eStage == int32(RBU_STAGE_OAL) || eStage == int32(RBU_STAGE_MOVE) { /* no-op */ } else { @@ -188211,7 +184813,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6560) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6589) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -188225,8 +184827,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33015, 0) != 0 { - _ = libc.Int32FromInt32(0) + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33045, 0) != 0 { oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) } @@ -188341,7 +184942,6 @@ func _rbuVfsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pRes if rc == SQLITE_OK && flags == SQLITE_ACCESS_EXISTS { pDb = _rbuFindMaindb(tls, pRbuVfs, zPath, int32(1)) if pDb != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(pResOut)) != 0 { rc = int32(SQLITE_CANTOPEN) } else { @@ -188780,7 +185380,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12166, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12195, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -188794,7 +185394,6 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint rc = int32(SQLITE_NOMEM) } } - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { libc.Xmemset(tls, pTab, 0, uint64(40)) (*TStatTable)(unsafe.Pointer(pTab)).Fdb = db @@ -188851,16 +185450,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -188928,6 +185528,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -188963,6 +185564,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -189129,8 +185731,6 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { goto statPageIsCorrupt } (*TStatCell)(unsafe.Pointer(pCell)).FnLocal = nLocal - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(nLocal) { nOvfl = int32((*(*Tu32)(unsafe.Pointer(bp)) - uint32(nLocal) + uint32(nUsable) - uint32(4) - uint32(1)) / uint32(nUsable-libc.Int32FromInt32(4))) if iOff+nLocal+int32(4) > nUsable || *(*Tu32)(unsafe.Pointer(bp)) > uint32(0x7fffffff) { @@ -189152,24 +185752,26 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) rc = _sqlite3PagerGet(tls, _sqlite3BtreePager(tls, pBt), iPrev, bp+16, 0) if rc != SQLITE_OK { - _ = libc.Int32FromInt32(0) return rc } *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(j)*4)) = _sqlite3Get4byte(tls, _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 16)))) _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -189259,6 +185861,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -189274,7 +185877,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33026, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33056, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FzPath = v1 if z == uintptr(0) { @@ -189312,8 +185915,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33028 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33037, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33058 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33067, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -189342,9 +185945,8 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } - _ = libc.Int32FromInt32(0) if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg } else { @@ -189354,7 +185956,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33049, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33079, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -189374,16 +185976,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33057 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33087 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33066 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33096 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33071 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33101 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -189392,7 +185994,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload = (*TStatPage)(unsafe.Pointer(p1)).FnMxPayload } if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v5 = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p1)).FzPath)) + v5 = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p1)).FzPath)) z = v5 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v5 if z == uintptr(0) { @@ -189408,6 +186010,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -189480,12 +186083,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33081, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33111, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33236, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33266, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33250, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33280, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -189507,37 +186110,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -189562,7 +186165,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33265, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33295, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -190114,7 +186717,6 @@ func _sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite if eType == int32(SQLITE_INTEGER) { *(*Tu64)(unsafe.Pointer(bp)) = uint64(Xsqlite3_value_int64(tls, pValue)) } else { - _ = libc.Int32FromInt32(0) *(*float64)(unsafe.Pointer(bp + 8)) = Xsqlite3_value_double(tls, pValue) libc.Xmemcpy(tls, bp, bp+8, uint64(8)) } @@ -190122,7 +186724,6 @@ func _sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite } nByte = int32(9) default: - _ = libc.Int32FromInt32(0) if eType == int32(SQLITE_TEXT) { z = Xsqlite3_value_text(tls, pValue) } else { @@ -190233,6 +186834,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h<pPreUpdate->pUnpacked ); */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp) } - _ = libc.Int32FromInt32(0) _ = rc /* Suppress warning about unused variable */ if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp))) != eType { return 0 } /* A SessionChange object never has a NULL value in a PK column */ - _ = libc.Int32FromInt32(0) if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { *(*Ti64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, a) a += uintptr(8) @@ -190695,7 +187289,6 @@ func _sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, iRowid Ti64, pTab u return 0 } } else { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, bp+16, bp+8, uint64(8)) if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp))) != *(*float64)(unsafe.Pointer(bp + 16)) { return 0 @@ -190719,6 +187312,7 @@ func _sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, iRowid Ti64, pTab u } goto _1 _1: + ; iCol++ } return int32(1) @@ -190774,10 +187368,12 @@ func _sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uin *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p goto _3 _3: + ; p = pNext } goto _2 _2: + ; i++ } _sessionFree(tls, pSession, (*TSessionTable)(unsafe.Pointer(pTab)).FapChange) @@ -190830,7 +187426,6 @@ func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, azDflt = uintptr(0) abPK = uintptr(0) bRowid = 0 /* Set to true to use rowid as PK */ - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) *(*int32)(unsafe.Pointer(pnCol)) = 0 @@ -190841,20 +187436,20 @@ func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, *(*uintptr)(unsafe.Pointer(pazDflt)) = uintptr(0) } nThis = _sqlite3Strlen30(tls, zThis) - if nThis == int32(12) && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11557, zThis) { + if nThis == int32(12) && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11586, zThis) { rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { /* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */ - zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33272, 0) + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33302, 0) } else { if rc == int32(SQLITE_ERROR) { - zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+1648, 0) + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+1652, 0) } else { return rc } } } else { - zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33393, libc.VaList(bp+16, zDb, zThis)) + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33423, libc.VaList(bp+16, zDb, zThis)) } if !(zPragma != 0) { return int32(SQLITE_NOMEM) @@ -190878,7 +187473,7 @@ func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, bRowid = 0 } nDbCol += bRowid - nByte = Tsqlite3_int64(uint64(nByte) + libc.Xstrlen(tls, __ccgo_ts+29614)) + nByte = Tsqlite3_int64(uint64(nByte) + libc.Xstrlen(tls, __ccgo_ts+29644)) rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) if rc == SQLITE_OK { nByte = Tsqlite3_int64(uint64(nByte) + uint64(nDbCol)*(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(1)+libc.Uint64FromInt32(1)+libc.Uint64FromInt32(1))) @@ -190902,8 +187497,8 @@ func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, } i = 0 if bRowid != 0 { - nName = libc.Xstrlen(tls, __ccgo_ts+29614) - libc.Xmemcpy(tls, pAlloc, __ccgo_ts+29614, nName+uint64(1)) + nName = libc.Xstrlen(tls, __ccgo_ts+29644) + libc.Xmemcpy(tls, pAlloc, __ccgo_ts+29644, nName+uint64(1)) *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc pAlloc += uintptr(nName + uint64(1)) *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) = uint8(1) @@ -190974,7 +187569,6 @@ func _sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr, db uintptr _, _, _, _ = i, rc, v1, p3 rc = SQLITE_OK if (*TSessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { - _ = libc.Int32FromInt32(0) if pSession == uintptr(0) || (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { v1 = pTab + 24 } else { @@ -190993,9 +187587,10 @@ func _sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr, db uintptr } goto _2 _2: + ; i++ } - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11557, (*TSessionTable)(unsafe.Pointer(pTab)).FzName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11586, (*TSessionTable)(unsafe.Pointer(pTab)).FzName) { (*TSessionTable)(unsafe.Pointer(pTab)).FbStat1 = int32(1) } if pSession != 0 && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { @@ -191032,7 +187627,6 @@ func _sessionReinitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) (r int32 *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32)) = 0 - _ = libc.Int32FromInt32(0) if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { v1 = bp + 32 } else { @@ -191060,6 +187654,7 @@ func _sessionReinitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) (r int32 } goto _2 _2: + ; ii++ } if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { @@ -191114,7 +187709,6 @@ func _sessionUpdateOneChange(tls *libc.TLS, pSession uintptr, pRc uintptr, pp ui default: n = Xsqlite3_column_bytes(tls, pDflt, iField) nIncr = int32(1) + _sessionVarintLen(tls, n) + n - _ = libc.Int32FromInt32(0) break } nByte = int32(uint64(nIncr) + (uint64(32) + uint64((*TSessionChange)(unsafe.Pointer(pOld)).FnRecord))) @@ -191154,7 +187748,6 @@ func _sessionUpdateOneChange(tls *libc.TLS, pSession uintptr, pRc uintptr, pp ui libc.Xmemcpy(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), z1, uint64(n2)) *(*int32)(unsafe.Pointer(pNew + 8)) += n2 default: - _ = libc.Int32FromInt32(0) break } _sessionFree(tls, pSession, pOld) @@ -191286,10 +187879,10 @@ func _sessionPrepareDfltStmt(tls *libc.TLS, db uintptr, pTab uintptr, ppStmt uin _, _, _, _ = ii, zDflt, zSep, v2 *(*TSessionBuffer)(unsafe.Pointer(bp)) = TSessionBuffer{} *(*int32)(unsafe.Pointer(bp + 16)) = SQLITE_OK - zSep = __ccgo_ts + 11177 + zSep = __ccgo_ts + 11206 ii = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) - _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+33422, 0) + _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+33452, 0) ii = 0 for { if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { @@ -191298,13 +187891,14 @@ func _sessionPrepareDfltStmt(tls *libc.TLS, db uintptr, pTab uintptr, ppStmt uin if *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazDflt + uintptr(ii)*8)) != 0 { v2 = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazDflt + uintptr(ii)*8)) } else { - v2 = __ccgo_ts + 1649 + v2 = __ccgo_ts + 1653 } zDflt = v2 - _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+5051, libc.VaList(bp+32, zSep, zDflt)) - zSep = __ccgo_ts + 14965 + _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+5080, libc.VaList(bp+32, zSep, zDflt)) + zSep = __ccgo_ts + 14994 goto _1 _1: + ; ii++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -191350,10 +187944,12 @@ func _sessionUpdateChanges(tls *libc.TLS, pSession uintptr, pTab uintptr) (r int } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } goto _1 _1: + ; ii++ } } @@ -191463,6 +188059,7 @@ func _sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintp _sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _1 _1: + ; ii++ } } @@ -191514,7 +188111,6 @@ func _sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintp nOld = _sessionVarintGet(tls, pCsr, bp+40) pCsr += uintptr(nOld) nOld += *(*int32)(unsafe.Pointer(bp + 40)) - _ = libc.Int32FromInt32(0) if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) && *(*int32)(unsafe.Pointer(bp + 40)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) && (*(*int32)(unsafe.Pointer(bp + 40)) == 0 || 0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16))), uint64(*(*int32)(unsafe.Pointer(bp + 40))))) { bChanged = 0 } @@ -191537,6 +188133,7 @@ func _sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintp } goto _2 _2: + ; ii1++ } } @@ -191616,7 +188213,7 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u rc = int32(SQLITE_NOMEM) goto error_out } - _sqlite3ValueSetStr(tls, p, 0, __ccgo_ts+1648, uint8(0), libc.UintptrFromInt32(0)) + _sqlite3ValueSetStr(tls, p, 0, __ccgo_ts+1652, uint8(0), libc.UintptrFromInt32(0)) (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p } } @@ -191638,10 +188235,10 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u } goto _1 _1: + ; pC = (*TSessionChange)(unsafe.Pointer(pC)).FpNext } if pC == uintptr(0) { /* Used to iterate through columns */ - _ = libc.Int32FromInt32(0) (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry++ /* Figure out how large an allocation is required */ *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56)) = int64(32) @@ -191653,11 +188250,9 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u *(*uintptr)(unsafe.Pointer(bp + 64)) = uintptr(0) if op != int32(SQLITE_INSERT) { (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+64) - _ = libc.Int32FromInt32(0) } else { if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+64) - _ = libc.Int32FromInt32(0) } } /* This may fail if SQLite value p contains a utf-16 string that must @@ -191668,6 +188263,7 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u } goto _2 _2: + ; i++ } if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { @@ -191708,6 +188304,7 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u _sessionSerializeValue(tls, (*TSessionChange)(unsafe.Pointer(pC)).FaRecord+uintptr(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 56))), *(*uintptr)(unsafe.Pointer(bp + 72)), bp+56) goto _3 _3: + ; i++ } /* Add the change to the hash-table */ @@ -191728,13 +188325,13 @@ func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession u } } } - _ = libc.Int32FromInt32(0) if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { rc = _sessionUpdateMaxSize(tls, op, pSession, pTab, pC) } } /* If an error has occurred, mark the session object as failed. */ error_out: + ; if (*TSessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0 { (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*(*TSessionStat1Ctx)(unsafe.Pointer(bp + 8))).Fhook } @@ -191760,6 +188357,7 @@ func _sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uin } goto _1 _1: + ; pRet = (*TSessionTable)(unsafe.Pointer(pRet)).FpNext } if pRet == uintptr(0) && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0 { @@ -191772,12 +188370,9 @@ func _sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uin for pRet != 0 && (*TSessionTable)(unsafe.Pointer(pRet)).FpNext != 0 { pRet = (*TSessionTable)(unsafe.Pointer(pRet)).FpNext } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } } } - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(ppTab)) = pRet return rc } @@ -191795,7 +188390,6 @@ func _xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, var _ /* pTab at bp+0 */ uintptr _, _ = nDb, pSession nDb = _sqlite3Strlen30(tls, zDb) - _ = libc.Int32FromInt32(0) _ = iKey1 _ = iKey2 pSession = pCtx @@ -191817,8 +188411,6 @@ func _xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, } (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = _sessionFindTable(tls, pSession, zName, bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _sessionPreupdateOneChange(tls, op, iKey1, pSession, *(*uintptr)(unsafe.Pointer(bp))) if op == int32(SQLITE_UPDATE) { _sessionPreupdateOneChange(tls, int32(SQLITE_INSERT), iKey2, pSession, *(*uintptr)(unsafe.Pointer(bp))) @@ -191826,6 +188418,7 @@ func _xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, } goto _1 _1: + ; pSession = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpNext } } @@ -191940,7 +188533,7 @@ func _sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr var i int32 var zRet, zSep uintptr _, _, _ = i, zRet, zSep - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 zRet = uintptr(0) i = 0 for { @@ -191948,14 +188541,15 @@ func _sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr break } if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33429, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) - zSep = __ccgo_ts + 21979 + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33459, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = __ccgo_ts + 22017 if zRet == uintptr(0) { break } } goto _1 _1: + ; i++ } return zRet @@ -191967,7 +188561,7 @@ func _sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uint var bHave, i int32 var zRet, zSep uintptr _, _, _, _ = bHave, i, zRet, zSep - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 zRet = uintptr(0) bHave = 0 i = 0 @@ -191977,19 +188571,19 @@ func _sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uint } if int32(*(*Tu8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { bHave = int32(1) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33463, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) - zSep = __ccgo_ts + 33504 + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33493, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = __ccgo_ts + 33534 if zRet == uintptr(0) { break } } goto _1 _1: + ; i++ } if bHave == 0 { - _ = libc.Int32FromInt32(0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+1722, 0) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+1726, 0) } return zRet } @@ -192000,12 +188594,12 @@ func _sessionSelectFindNew(tls *libc.TLS, zDb1 uintptr, zDb2 uintptr, bRowid int var zRet, zSel, v1 uintptr _, _, _ = zRet, zSel, v1 if bRowid != 0 { - v1 = __ccgo_ts + 33509 + v1 = __ccgo_ts + 33539 } else { - v1 = __ccgo_ts + 6565 + v1 = __ccgo_ts + 6594 } zSel = v1 - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33520, libc.VaList(bp+8, zSel, zDb1, zTbl, zDb2, zTbl, zExpr)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33550, libc.VaList(bp+8, zSel, zDb1, zTbl, zDb2, zTbl, zExpr)) return zRet } @@ -192066,16 +188660,17 @@ func _sessionAllCols(tls *libc.TLS, zDb uintptr, pTab uintptr) (r uintptr) { break } if zRet != 0 { - v2 = __ccgo_ts + 14965 + v2 = __ccgo_ts + 14994 } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33599, libc.VaList(bp+8, zRet, v2, zDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazCol + uintptr(ii)*8)))) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33629, libc.VaList(bp+8, zRet, v2, zDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazCol + uintptr(ii)*8)))) if !(zRet != 0) { break } goto _1 _1: + ; ii++ } return zRet @@ -192097,7 +188692,7 @@ func _sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFr } else { z1 = _sessionAllCols(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, pTab) z2 = _sessionAllCols(tls, zFrom, pTab) - zStmt = Xsqlite3_mprintf(tls, __ccgo_ts+33618, libc.VaList(bp+16, z1, z2, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + zStmt = Xsqlite3_mprintf(tls, __ccgo_ts+33648, libc.VaList(bp+16, z1, z2, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) if zStmt == uintptr(0) || z1 == uintptr(0) || z2 == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -192189,6 +188784,7 @@ func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl u } goto _2 _2: + ; i++ } } @@ -192196,7 +188792,7 @@ func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl u Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if bMismatch != 0 { if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+33675, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+33705, 0) } rc = int32(SQLITE_SCHEMA) } @@ -192223,6 +188819,7 @@ func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl u Xsqlite3_free(tls, zExpr) } diff_out: + ; _sessionPreupdateHooks(tls, pSession) Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) return rc @@ -192293,10 +188890,12 @@ func _sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { _sessionFree(tls, pSession, p) goto _3 _3: + ; p = pNextChange } goto _2 _2: + ; i++ } Xsqlite3_finalize(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt) @@ -192305,6 +188904,7 @@ func _sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { _sessionFree(tls, pSession, pTab) goto _1 _1: + ; pTab = pNext } } @@ -192339,6 +188939,7 @@ func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 80 } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) @@ -192393,6 +188994,7 @@ func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) (r i } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -192412,6 +189014,7 @@ func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) (r i } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -192520,7 +189123,7 @@ func _sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* aBuf at bp+0 */ [24]int8 - Xsqlite3_snprintf(tls, int32(libc.Uint64FromInt64(24)-libc.Uint64FromInt32(1)), bp, __ccgo_ts+5113, libc.VaList(bp+32, iVal)) + Xsqlite3_snprintf(tls, int32(libc.Uint64FromInt64(24)-libc.Uint64FromInt32(1)), bp, __ccgo_ts+5142, libc.VaList(bp+32, iVal)) _sessionAppendStr(tls, p, bp, pRc) } @@ -192653,7 +189256,6 @@ func _sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt ui bNoop = int32(1) /* Set to zero if any values are modified */ nRewind = (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf /* Used to iterate through columns */ pCsr = (*TSessionChange)(unsafe.Pointer(p)).FaRecord /* Used to iterate through old.* values */ - _ = libc.Int32FromInt32(0) _sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp) _sessionAppendByte(tls, pBuf, (*TSessionChange)(unsafe.Pointer(p)).FbIndirect, bp) i = 0 @@ -192689,7 +189291,6 @@ func _sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt ui bChanged = int32(1) default: nHdr = int32(1) + _sessionVarintGet(tls, pCsr+1, bp+40) - _ = libc.Int32FromInt32(0) nAdvance = nHdr + *(*int32)(unsafe.Pointer(bp + 40)) if eType == Xsqlite3_column_type(tls, pStmt, i) && *(*int32)(unsafe.Pointer(bp + 40)) == Xsqlite3_column_bytes(tls, pStmt, i) && (*(*int32)(unsafe.Pointer(bp + 40)) == 0 || 0 == libc.Xmemcmp(tls, pCsr+uintptr(nHdr), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 40))))) { break @@ -192719,6 +189320,7 @@ func _sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt ui pCsr += uintptr(nAdvance) goto _1 _1: + ; i++ } if bNoop != 0 { @@ -192765,7 +189367,6 @@ func _sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintpt case 0: fallthrough case int32(SQLITE_NULL): - _ = libc.Int32FromInt32(0) case int32(SQLITE_FLOAT): fallthrough case int32(SQLITE_INTEGER): @@ -192780,9 +189381,9 @@ func _sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintpt } goto _1 _1: + ; i++ } - _ = libc.Int32FromInt32(0) } return *(*int32)(unsafe.Pointer(bp)) } @@ -192813,23 +189414,23 @@ func _sessionSelectStmt(tls *libc.TLS, db uintptr, bIgnoreNoop int32, zDb uintpt _, _, _, _, _, _, _ = i, nSql, zCols, zSep, zSql, v1, v3 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK zSql = uintptr(0) - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 if bRowid != 0 { - v1 = __ccgo_ts + 33509 + v1 = __ccgo_ts + 33539 } else { - v1 = __ccgo_ts + 6565 + v1 = __ccgo_ts + 6594 } zCols = v1 nSql = -int32(1) *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} *(*TSessionBuffer)(unsafe.Pointer(bp + 24)) = TSessionBuffer{} *(*TSessionBuffer)(unsafe.Pointer(bp + 40)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+33702, bp) - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11557, zTab) { - _sessionAppendStr(tls, bp+8, __ccgo_ts+33706, bp) - _sessionAppendStr(tls, bp+24, __ccgo_ts+33730, bp) - _sessionAppendStr(tls, bp+40, __ccgo_ts+33739, bp) - zCols = __ccgo_ts + 33784 + _sessionAppendStr(tls, bp+8, __ccgo_ts+33732, bp) + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11586, zTab) { + _sessionAppendStr(tls, bp+8, __ccgo_ts+33736, bp) + _sessionAppendStr(tls, bp+24, __ccgo_ts+33760, bp) + _sessionAppendStr(tls, bp+40, __ccgo_ts+33769, bp) + zCols = __ccgo_ts + 33814 } else { i = 0 for { @@ -192839,14 +189440,15 @@ func _sessionSelectStmt(tls *libc.TLS, db uintptr, bIgnoreNoop int32, zDb uintpt if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { _sessionAppendStr(tls, bp+24, zSep, bp) _sessionAppendStr(tls, bp+40, zSep, bp) - zSep = __ccgo_ts + 14965 + zSep = __ccgo_ts + 14994 _sessionAppendIdent(tls, bp+24, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp) - _sessionAppendPrintf(tls, bp+40, bp, __ccgo_ts+33798, libc.VaList(bp+64, i+int32(1))) + _sessionAppendPrintf(tls, bp+40, bp, __ccgo_ts+33828, libc.VaList(bp+64, i+int32(1))) } else { - _sessionAppendPrintf(tls, bp+8, bp, __ccgo_ts+33802, libc.VaList(bp+64, i+int32(1)+nCol, i+int32(1), zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + _sessionAppendPrintf(tls, bp+8, bp, __ccgo_ts+33832, libc.VaList(bp+64, i+int32(1)+nCol, i+int32(1), zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) } goto _2 _2: + ; i++ } } @@ -192854,9 +189456,9 @@ func _sessionSelectStmt(tls *libc.TLS, db uintptr, bIgnoreNoop int32, zDb uintpt if bIgnoreNoop != 0 { v3 = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf } else { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+33829, libc.VaList(bp+64, zCols, v3, zDb, zTab, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 40))).FaBuf)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+33859, libc.VaList(bp+64, zCols, v3, zDb, zTab, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 40))).FaBuf)) if zSql == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) } @@ -192906,7 +189508,6 @@ func _sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr case 0: fallthrough case int32(SQLITE_NULL): - _ = libc.Int32FromInt32(0) case int32(SQLITE_INTEGER): if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { iVal = _sessionGetI64(tls, a) @@ -192927,7 +189528,6 @@ func _sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr } a += uintptr(*(*int32)(unsafe.Pointer(bp + 16))) default: - _ = libc.Int32FromInt32(0) a += uintptr(_sessionVarintGet(tls, a, bp+20)) if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { rc = Xsqlite3_bind_blob(tls, pSelect, i+int32(1), a, *(*int32)(unsafe.Pointer(bp + 20)), uintptr(-libc.Int32FromInt32(1))) @@ -192937,6 +189537,7 @@ func _sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr } goto _1 _1: + ; i++ } return rc @@ -192988,20 +189589,17 @@ func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, _, _, _, _, _, _, _, _, _ = db, i, iCol, nNoop, nOldCol, nRewind, p, pTab, zName db = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb /* Used to iterate through attached tables */ *(*TSessionBuffer)(unsafe.Pointer(bp)) = TSessionBuffer{} /* Return code */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Zero the output variables in case an error occurs. If this session ** object is already in the error state (sqlite3_session.rc != SQLITE_OK), ** this call will be a no-op. */ if xOutput == uintptr(0) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pnChangeset)) = 0 *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) } if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { return (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc } - *(*int32)(unsafe.Pointer(bp + 16)) = Xsqlite3_exec(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, __ccgo_ts+33871, uintptr(0), uintptr(0), uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 16)) = Xsqlite3_exec(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, __ccgo_ts+33901, uintptr(0), uintptr(0), uintptr(0)) if *(*int32)(unsafe.Pointer(bp + 16)) != SQLITE_OK { return *(*int32)(unsafe.Pointer(bp + 16)) } @@ -193054,10 +189652,10 @@ func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, _sessionAppendCol(tls, bp, *(*uintptr)(unsafe.Pointer(bp + 24)), iCol, bp+16) goto _4 _4: + ; iCol++ } } else { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 16)) = _sessionAppendUpdate(tls, bp, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 24)), p, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK) } } else { @@ -193077,10 +189675,12 @@ func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) @@ -193090,6 +189690,7 @@ func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -193104,7 +189705,7 @@ func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, } } Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf) - Xsqlite3_exec(tls, db, __ccgo_ts+33891, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+33921, uintptr(0), uintptr(0), uintptr(0)) Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) return *(*int32)(unsafe.Pointer(bp + 16)) } @@ -193125,7 +189726,6 @@ func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uint return int32(SQLITE_MISUSE) } rc = _sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) - _ = libc.Int32FromInt32(0) return rc } @@ -193223,6 +189823,7 @@ func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) (r int32) { ret = libc.BoolInt32((*TSessionTable)(unsafe.Pointer(pTab)).FnEntry > 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -193292,7 +189893,6 @@ func _sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintp var nByte, v1 int32 var pRet uintptr _, _, _ = nByte, pRet, v1 /* Number of bytes to allocate for iterator */ - _ = libc.Int32FromInt32(0) /* Zero the output variable in case an error occurs. */ *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) /* Allocate and initialize the iterator structure. */ @@ -193362,7 +189962,6 @@ func _sessionDiscardData(tls *libc.TLS, pIn uintptr) { _ = nMove if (*TSessionInput)(unsafe.Pointer(pIn)).FxInput != 0 && (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= _sessions_strm_chunk_size { nMove = (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*TSessionInput)(unsafe.Pointer(pIn)).FiNext - _ = libc.Int32FromInt32(0) if nMove > 0 { libc.Xmemmove(tls, (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext), uint64(nMove)) } @@ -193441,6 +190040,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -193507,7 +190107,6 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap var _ /* v at bp+8 */ Tsqlite3_int64 _, _, _, _, _, _, _, _ = aVal, eType, enc, i, rc, v2, v3, v4 /* Used to iterate through columns */ rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if pbEmpty != 0 { *(*int32)(unsafe.Pointer(pbEmpty)) = int32(1) } @@ -193523,13 +190122,12 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) *(*int32)(unsafe.Pointer(v3))++ eType = int32(*(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(v2)))) - _ = libc.Int32FromInt32(0) if eType != 0 { if pbEmpty != 0 { *(*int32)(unsafe.Pointer(pbEmpty)) = 0 @@ -193548,7 +190146,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -193563,7 +190161,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -193578,6 +190176,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -193618,7 +190217,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -193678,6 +190277,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -193712,7 +190312,6 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { var _ /* nCopy at bp+4 */ int32 var _ /* rc at bp+0 */ int32 _, _, _, _, _ = iPK, nByte, nVarint, v1, v2 - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _sessionChangesetBufferTblhdr(tls, p, bp+4) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { nVarint = _sessionVarintGet(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData+uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext), p+120) @@ -193723,7 +190322,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -193767,8 +190366,6 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin var i, nVal, v10, v16, v2, v4, v5, v7, v8 int32 var op Tu8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = abPK, apNew, apOld, i, nVal, op, v10, v12, v13, v14, v16, v2, v3, v4, v5, v6, v7, v8, v9 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the iterator is in the error-state, return immediately. */ if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc @@ -193783,6 +190380,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2)) @@ -193830,8 +190428,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ - _ = libc.Int32FromInt32(0) - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -193841,7 +190438,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -193861,6 +190458,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -193916,12 +190514,10 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) { break } - _ = libc.Int32FromInt32(0) if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { - _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -193929,6 +190525,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -193961,6 +190558,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -194169,6 +190767,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -194246,7 +190845,6 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } eType2 = v3 *(*int32)(unsafe.Pointer(pInput + 8)) += int32(2) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = _sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 24)), bp+52) _sessionAppendByte(tls, bp+8, uint8(eType2), bp) _sessionAppendByte(tls, bp+8, uint8(bIndirect), bp) @@ -194290,6 +190888,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -194309,6 +190908,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -194319,6 +190919,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) @@ -194326,10 +190927,9 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } - _ = libc.Int32FromInt32(0) if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf) (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf = 0 @@ -194338,7 +190938,6 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } } - _ = libc.Int32FromInt32(0) if pnInverted != 0 && ppInverted != 0 { *(*int32)(unsafe.Pointer(pnInverted)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf *(*uintptr)(unsafe.Pointer(ppInverted)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf @@ -194349,6 +190948,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -194495,6 +191095,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -194528,18 +191129,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11557) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11586) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) } else { - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 libc.Xmemset(tls, bp+8, 0, uint64(16)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33909, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33939, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33922, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33952, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -194549,17 +191150,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33958, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14965 + zSep = __ccgo_ts + 14994 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ - zSep = __ccgo_ts + 1648 - _sessionAppendStr(tls, bp+8, __ccgo_ts+33933, bp) + zSep = __ccgo_ts + 1652 + _sessionAppendStr(tls, bp+8, __ccgo_ts+33963, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -194568,17 +191170,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { - _ = libc.Int32FromInt32(0) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33941, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33971, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34046, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22017 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194596,7 +191198,6 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } } } - _ = libc.Int32FromInt32(0) if pUp != 0 { *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TSessionUpdate)(unsafe.Pointer(pUp)).FpStmt } else { @@ -194623,6 +191224,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -194657,13 +191259,13 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in var _ /* buf at bp+8 */ TSessionBuffer var _ /* rc at bp+0 */ int32 _, _, _ = i, nPk, zSep - zSep = __ccgo_ts + 1648 + zSep = __ccgo_ts + 1652 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34022, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34052, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33963, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -194673,19 +191275,20 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33958, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22017 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34040, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34070, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33504, bp) - zSep = __ccgo_ts + 1648 + _sessionAppendStr(tls, bp+8, __ccgo_ts+33534, bp) + zSep = __ccgo_ts + 1652 i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -194694,15 +191297,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34046, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34048 + zSep = __ccgo_ts + 34078 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5110, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -194728,7 +191332,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6560, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6589, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -194751,34 +191355,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34053, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34083, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+21985, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22023, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+14965, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+14994, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34071, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34101, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34082, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34112, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5110, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -194801,12 +191407,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11557, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11586, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34086) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34116) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34199) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34229) } return rc } @@ -194861,7 +191467,6 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a ** argument iterator points to a suitable entry. Make sure that xValue ** is one of these to guarantee that it is safe to ignore the return ** in the code below. */ - _ = libc.Int32FromInt32(0) i = 0 for { if !(rc == SQLITE_OK && i < nCol) { @@ -194873,13 +191478,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -194939,6 +191545,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -194983,8 +191590,6 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendBlob(tls, p+104, zTab, int32(libc.Xstrlen(tls, zTab))+int32(1), bp) (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = uint8(1) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if eOp == int32(SQLITE_DELETE) { v1 = int32(SQLITE_DELETE) } else { @@ -195006,6 +191611,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -195061,9 +191667,6 @@ func _sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintpt _, _, _ = aBlob, nBlob, res res = 0 Xsqlite3changeset_op(tls, pIter, bp+16, bp+4, bp+8, uintptr(0)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Bind the new.* PRIMARY KEY values to the SELECT statement. */ if pbReplace != 0 { *(*int32)(unsafe.Pointer(bp)) = _sessionSeekToRow(tls, pIter, p) @@ -195101,7 +191704,6 @@ func _sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintpt if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { switch res { case int32(SQLITE_CHANGESET_REPLACE): - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pbReplace)) = int32(1) case SQLITE_CHANGESET_OMIT: case int32(SQLITE_CHANGESET_ABORT): @@ -195154,9 +191756,6 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp var _ /* zDummy at bp+0 */ uintptr _, _, _, _, _, _, _ = abPK, bPatchset, i, pNew, pOld, rc, v1 rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) Xsqlite3changeset_op(tls, pIter, bp, bp+12, bp+8, uintptr(0)) if *(*int32)(unsafe.Pointer(bp + 8)) == int32(SQLITE_DELETE) { if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { @@ -195213,6 +191812,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -195234,7 +191834,6 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } } } else { - _ = libc.Int32FromInt32(0) if (*TSessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { /* Check if there is a conflicting row. For sqlite_stat1, this needs ** to be done using a SELECT, as there is no PRIMARY KEY in the @@ -195292,12 +191891,10 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply ** but pass NULL as the final argument so that sessionApplyOneOp() ignores ** the SQLITE_CHANGESET_DATA problem. */ if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { - _ = libc.Int32FromInt32(0) rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { - _ = libc.Int32FromInt32(0) - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34343, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34373, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -195310,7 +191907,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34364, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34394, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -195357,7 +191954,6 @@ func _sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab u *(*int32)(unsafe.Pointer(bp)) = rc2 } } - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, cons.FaBuf) if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { break @@ -195398,7 +191994,6 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui rc = SQLITE_OK /* Return code */ *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Name of current table */ nTab = 0 - _ = libc.Int32FromInt32(0) (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = int32(1) libc.Xmemset(tls, bp+8, 0, uint64(128)) (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase = libc.BoolUint8(ppRebase != 0 && pnRebase != 0) @@ -195406,10 +192001,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34383, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34413, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34439, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -195440,7 +192035,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui ** non-zero, proceed. */ schemaMismatch = libc.BoolInt32(xFilter != 0 && 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xFilter})))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 144)))) if schemaMismatch != 0 { - *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp + 144)))) + *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp + 144)))) if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { rc = int32(SQLITE_NOMEM) break @@ -195450,7 +192045,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6560, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6589, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -195464,22 +192059,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34439, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34469, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34483, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34513, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34554, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34584, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11557) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11586) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -195536,16 +192132,15 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34614, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34674, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34668, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34698, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34674, uintptr(0), uintptr(0), uintptr(0)) } } - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { *(*uintptr)(unsafe.Pointer(ppRebase)) = (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FaBuf *(*int32)(unsafe.Pointer(pnRebase)) = (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FnBuf @@ -195586,7 +192181,6 @@ func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pCh rc = _sessionChangesetApply(tls, db, *(*uintptr)(unsafe.Pointer(bp)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) } if flags&int32(SQLITE_CHANGESETAPPLY_FKNOACTION) != 0 && savedFlag == uint64(0) { - _ = libc.Int32FromInt32(0) *(*Tu64)(unsafe.Pointer(db + 48)) &= ^(uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32)) *(*int32)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)) -= int32(32) } @@ -195662,7 +192256,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, aExist, i, i1, n1, n2, nByte, nByte1, nIn, op1, pIn, pNew, pOut, pOut1, rc, v2, v3, v4, v6, v7 pNew = uintptr(0) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if !(pExist != 0) { pNew = Xsqlite3_malloc64(tls, uint64(32)+uint64(nRec)) if !(pNew != 0) { @@ -195701,6 +192294,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195747,6 +192341,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195773,7 +192368,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i } else { if op1 == int32(SQLITE_INSERT) && op2 == int32(SQLITE_DELETE) { Xsqlite3_free(tls, pExist) - _ = libc.Int32FromInt32(0) } else { aExist = (*TSessionChange)(unsafe.Pointer(pExist)).FaRecord /* Allocate a new SessionChange object. Ensure that the aRecord[] @@ -195792,7 +192386,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i *(*uintptr)(unsafe.Pointer(bp)) = v7 if op1 == int32(SQLITE_INSERT) { /* INSERT + UPDATE */ *(*uintptr)(unsafe.Pointer(bp + 8)) = aRec - _ = libc.Int32FromInt32(0) (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_INSERT) if bPatchset == 0 { _sessionSkipRecord(tls, bp+8, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) @@ -195800,7 +192393,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i _sessionMergeRecord(tls, bp, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp + 8))) } else { if op1 == int32(SQLITE_DELETE) { /* DELETE + INSERT */ - _ = libc.Int32FromInt32(0) (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_UPDATE) if bPatchset != 0 { libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), aRec, uint64(nRec)) @@ -195815,7 +192407,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i if op2 == int32(SQLITE_UPDATE) { /* UPDATE + UPDATE */ *(*uintptr)(unsafe.Pointer(bp + 16)) = aExist *(*uintptr)(unsafe.Pointer(bp + 24)) = aRec - _ = libc.Int32FromInt32(0) if bPatchset == 0 { _sessionSkipRecord(tls, bp+16, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) _sessionSkipRecord(tls, bp+24, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) @@ -195826,7 +192417,6 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pNew = uintptr(0) } } else { /* UPDATE + DELETE */ - _ = libc.Int32FromInt32(0) (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_DELETE) if bPatchset != 0 { libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), aRec, uint64(nRec)) @@ -195878,6 +192468,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -195896,8 +192487,6 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _, _, _, _, _, _ = eType, iOff, ii, n, z, z1 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK ii = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TSessionBuffer)(unsafe.Pointer(pOut)).FnBuf = 0 if op == int32(SQLITE_INSERT) || op == int32(SQLITE_DELETE) && (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 { /* Append the missing default column values to the record. */ @@ -195938,11 +192527,11 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendBlob(tls, pOut, z1, n, bp) } default: - _ = libc.Int32FromInt32(0) break } goto _1 _1: + ; ii++ } } else { @@ -195959,6 +192548,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -195970,6 +192560,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -195982,10 +192573,10 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { - _ = libc.Int32FromInt32(0) _sessionAppendBlob(tls, pOut, aRec, nRec, bp) } } @@ -196044,6 +192635,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -196062,7 +192654,6 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase (*TSessionTable)(unsafe.Pointer(pTab)).FnCol = 0 rc = _sessionInitTable(tls, uintptr(0), pTab, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb) if rc != 0 { - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, pTab) break } @@ -196078,6 +192669,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -196088,7 +192680,6 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } } if *(*int32)(unsafe.Pointer(bp + 40)) < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol { - _ = libc.Int32FromInt32(0) rc = _sessionChangesetExtendRecord(tls, pGrp, pTab, *(*int32)(unsafe.Pointer(bp + 40)), *(*int32)(unsafe.Pointer(bp + 44)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+16) if rc != 0 { break @@ -196123,6 +192714,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -196172,7 +192764,6 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu _, _, _ = i, p, pTab *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _ = libc.Int32FromInt32(0) /* Create the serialized output changeset based on the contents of the ** hash tables attached to the SessionTable objects in list p->pList. */ @@ -196204,14 +192795,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -196269,7 +192863,7 @@ func Xsqlite3changegroup_schema(tls *libc.TLS, pGrp uintptr, db uintptr, zDb uin ** or after sqlite3changegroup_schema() has already been called. */ rc = int32(SQLITE_MISUSE) } else { - (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, zDb)) + (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, zDb)) if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -196442,10 +193036,10 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) - _ = libc.Int32FromInt32(0) } } @@ -196514,6 +193108,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -196537,6 +193132,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -196594,6 +193190,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -196624,11 +193221,11 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } if pChange != 0 { - _ = libc.Int32FromInt32(0) switch (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { case int32(SQLITE_INSERT): if int32((*TSessionChange)(unsafe.Pointer(pChange)).Fop) == int32(SQLITE_INSERT) { @@ -196654,7 +193251,6 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO _sessionAppendPartialUpdate(tls, bp+24, pIter, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 16)), (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord, (*TSessionChange)(unsafe.Pointer(pChange)).FnRecord, bp) } default: - _ = libc.Int32FromInt32(0) bDone = int32(1) if int32((*TSessionChange)(unsafe.Pointer(pChange)).Fop) == int32(SQLITE_INSERT) { _sessionAppendByte(tls, bp+24, uint8(SQLITE_DELETE), bp) @@ -197971,23 +194567,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -198008,8 +194604,6 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, func _fts5yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { var fts5yytos, v1, v2 uintptr _, _, _ = fts5yytos, v1, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) v2 = pParser v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2)) -= 24 @@ -198080,20 +194674,12 @@ func _fts5yy_find_shift_action(tls *libc.TLS, iLookAhead uint8, stateno uint8) ( if int32(stateno) > int32(fts5YY_MAX_SHIFT) { return stateno } - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = int32(1) != 0 { i = int32(_fts5yy_shift_ofst[stateno]) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) i += int32(iLookAhead) - _ = libc.Int32FromInt32(0) if int32(_fts5yy_lookahead[i]) != int32(iLookAhead) { return _fts5yy_default[stateno] } else { - _ = libc.Int32FromInt32(0) return _fts5yy_action[i] } } @@ -198109,12 +194695,8 @@ func _fts5yy_find_shift_action(tls *libc.TLS, iLookAhead uint8, stateno uint8) ( func _fts5yy_find_reduce_action(tls *libc.TLS, stateno uint8, iLookAhead uint8) (r uint8) { var i int32 _ = i - _ = libc.Int32FromInt32(0) i = int32(_fts5yy_reduce_ofst[stateno]) - _ = libc.Int32FromInt32(0) i += int32(iLookAhead) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return _fts5yy_action[i] } @@ -198133,7 +194715,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34696, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34726, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -198316,125 +194898,152 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: - _ = libc.Int32FromInt32(0) + ; fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) /* There are no SHIFTREDUCE actions on nonterminals because the table ** generator has simplified them to pure REDUCE actions. */ - _ = libc.Int32FromInt32(0) /* It is not possible for a REDUCE to be followed by an error */ - _ = libc.Int32FromInt32(0) fts5yymsp += uintptr(fts5yysize+int32(1)) * 24 (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos = fts5yymsp (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp)).Fstateno = fts5yyact @@ -198459,7 +195068,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34754, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -198473,7 +195082,6 @@ func _fts5yy_accept(tls *libc.TLS, fts5yypParser uintptr) { var pParse uintptr _ = pParse pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse - _ = libc.Int32FromInt32(0) /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ @@ -198512,11 +195120,8 @@ func _sqlite3Fts5Parser(tls *libc.TLS, fts5yyp uintptr, fts5yymajor int32, fts5y _, _, _ = fts5yyact, fts5yypParser, fts5yyruleno /* The parser action. */ fts5yypParser = fts5yyp /* The parser */ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse - _ = libc.Int32FromInt32(0) fts5yyact = (*Tfts5yyStackEntry)(unsafe.Pointer((*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos)).Fstateno for int32(1) != 0 { /* Exit by "break" */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) fts5yyact = _fts5yy_find_shift_action(tls, uint8(fts5yymajor), fts5yyact) if int32(fts5yyact) >= int32(fts5YY_MIN_REDUCE) { fts5yyruleno = uint32(int32(fts5yyact) - int32(fts5YY_MIN_REDUCE)) /* Reduce by this rule */ @@ -198540,7 +195145,6 @@ func _sqlite3Fts5Parser(tls *libc.TLS, fts5yyp uintptr, fts5yymajor int32, fts5y _fts5yy_accept(tls, fts5yypParser) return } else { - _ = libc.Int32FromInt32(0) *(*TFts5Token)(unsafe.Pointer(bp)) = fts5yyminor /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -198584,27 +195188,6 @@ func _sqlite3Fts5ParserFallback(tls *libc.TLS, iToken int32) (r int32) { */ /* #include "fts5Int.h" */ -/* Declarations for math functions. - Copyright (C) 1991-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * ISO C99 Standard: 7.12 Mathematics - */ // C documentation // @@ -198767,7 +195350,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34755, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34785, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -198826,7 +195409,6 @@ func _fts5HighlightCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uint } if iPos == (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiEnd { if (*THighlightContext)(unsafe.Pointer(p)).FbOpen == 0 { - _ = libc.Int32FromInt32(0) _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzOpen, -int32(1)) (*THighlightContext)(unsafe.Pointer(p)).FbOpen = int32(1) } @@ -198865,7 +195447,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34762 + zErr = __ccgo_ts + 34792 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -198876,7 +195458,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeEnd = -int32(1) *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, iCol, bp+24, bp+32) if *(*int32)(unsafe.Pointer(bp + 104)) == int32(SQLITE_RANGE) { - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1648, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1652, -int32(1), libc.UintptrFromInt32(0)) *(*int32)(unsafe.Pointer(bp + 104)) = SQLITE_OK } else { if (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn != 0 { @@ -198993,6 +195575,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -199045,6 +195628,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -199075,7 +195659,7 @@ func _fts5ValueToText(tls *libc.TLS, pVal uintptr) (r uintptr) { if zRet != 0 { v1 = zRet } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } return v1 } @@ -199109,7 +195693,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34812 + zErr = __ccgo_ts + 34842 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199190,6 +195774,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -199211,11 +195796,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -199341,7 +195928,6 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxRowCount})))(tls, pFts, bp) } - _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnTotalSize})))(tls, pFts, -int32(1), bp+8) } @@ -199378,6 +195964,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -199442,6 +196029,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -199460,6 +196048,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -199484,15 +196073,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34860, + FzFunc: __ccgo_ts + 34890, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34868, + FzFunc: __ccgo_ts + 34898, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34878, + FzFunc: __ccgo_ts + 34908, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -199505,6 +196094,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -199603,7 +196193,6 @@ func _sqlite3Fts5BufferAppendBlob(tls *libc.TLS, pRc uintptr, pBuf uintptr, nDat if v1 != 0 { return } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), pData, uint64(nData)) p2 = pBuf + 8 *(*int32)(unsafe.Pointer(p2)) = int32(uint32(*(*int32)(unsafe.Pointer(p2))) + nData) @@ -199708,14 +196297,12 @@ func _sqlite3Fts5PoslistNext64(tls *libc.TLS, a uintptr, n int32, pi uintptr, pi var _ /* iVal at bp+0 */ Tu32 _, _, _, _, _ = i, iOff, v1, v2, v3 i = *(*int32)(unsafe.Pointer(pi)) - _ = libc.Int32FromInt32(0) if i >= n { /* EOF */ *(*Ti64)(unsafe.Pointer(piOff)) = int64(-int32(1)) return int32(1) } else { iOff = *(*Ti64)(unsafe.Pointer(piOff)) - _ = libc.Int32FromInt32(0) v1 = i i++ *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(v1)))) @@ -199736,7 +196323,6 @@ func _sqlite3Fts5PoslistNext64(tls *libc.TLS, a uintptr, n int32, pi uintptr, pi i += _sqlite3Fts5GetVarint32(tls, a+uintptr(i), bp) } iOff = int64(*(*Tu32)(unsafe.Pointer(bp))) << int32(32) - _ = libc.Int32FromInt32(0) v3 = i i++ *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(v3)))) @@ -199754,7 +196340,6 @@ func _sqlite3Fts5PoslistNext64(tls *libc.TLS, a uintptr, n int32, pi uintptr, pi *(*Ti64)(unsafe.Pointer(piOff)) = iOff&(libc.Int64FromInt32(0x7FFFFFFF)< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34890, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34920, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34921, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34951, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200398,7 +196985,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34954, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34984, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200406,10 +196993,9 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix++ bFirst = 0 } - _ = libc.Int32FromInt32(0) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34991, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35021, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -200417,7 +197003,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35000, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35030, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -200440,10 +197026,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35033, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35063, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -200454,58 +197041,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35067, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35097, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35075, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35105, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35107, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35137, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35113, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35143, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35132, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35162, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35175, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35205, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35189, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35219, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35227, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35257, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35238, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35268, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5474, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5503, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8193, + FzName: __ccgo_ts + 8222, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17713, + FzName: __ccgo_ts + 17751, }, 2: { - FzName: __ccgo_ts + 35273, + FzName: __ccgo_ts + 35303, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -200513,20 +197100,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35281, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35311, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35312, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35342, zCmd, nCmd) == 0 { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35322, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35352, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35356, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35386, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -200538,7 +197125,6 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC // ** code if an error occurs. // */ func _fts5ConfigDefaultTokenizer(tls *libc.TLS, pGlobal uintptr, pConfig uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return _sqlite3Fts5GetTokenizer(tls, pGlobal, uintptr(0), 0, pConfig, uintptr(0)) } @@ -200567,7 +197153,6 @@ func _fts5ConfigGobbleWord(tls *libc.TLS, pRc uintptr, zIn uintptr, pzOut uintpt zRet = uintptr(0) nIn = int64(libc.Xstrlen(tls, zIn)) zOut = Xsqlite3_malloc64(tls, uint64(nIn+int64(1))) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pbQuoted)) = 0 *(*uintptr)(unsafe.Pointer(pzOut)) = uintptr(0) if zOut == uintptr(0) { @@ -200600,15 +197185,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35384) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16660) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35389, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35414) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16698) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35419, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35419) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35449) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35429, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35459, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -200634,7 +197219,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35460, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35490, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -200642,16 +197227,16 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35465, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35495, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35472, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35502, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } - _ = libc.Int32FromInt32(0) (*TFts5Config)(unsafe.Pointer(p)).FzContentExprlist = (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp return *(*int32)(unsafe.Pointer(bp)) } @@ -200704,11 +197289,10 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35384) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35480, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35414) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35510, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } - _ = libc.Int32FromInt32(0) i = int32(3) for { if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && i < nArg) { @@ -200723,7 +197307,6 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in z = _fts5ConfigSkipWhitespace(tls, z) if z != 0 && int32(*(*int8)(unsafe.Pointer(z))) == int32('=') { bOption = int32(1) - _ = libc.Int32FromInt32(0) z++ if *(*int32)(unsafe.Pointer(bp + 24)) != 0 { z = uintptr(0) @@ -200738,19 +197321,19 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35509, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35539, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { v4 = *(*uintptr)(unsafe.Pointer(bp + 8)) } else { - v4 = __ccgo_ts + 1648 + v4 = __ccgo_ts + 1652 } if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { v5 = *(*uintptr)(unsafe.Pointer(bp + 16)) } else { - v5 = __ccgo_ts + 1648 + v5 = __ccgo_ts + 1652 } *(*int32)(unsafe.Pointer(bp)) = _fts5ConfigParseSpecial(tls, pGlobal, pRet, v4, v5, pzErr) } else { @@ -200763,11 +197346,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35529, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35559, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -200775,7 +197359,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35579, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35609, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -200787,20 +197371,19 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in /* If no zContent option was specified, fill in the default values. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { zTail = uintptr(0) - _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35067 + zTail = __ccgo_ts + 35097 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35634 + zTail = __ccgo_ts + 35664 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35642, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35672, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16660, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16698, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200835,6 +197418,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -200863,25 +197447,25 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35653, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35683, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } if i == 0 { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } else { - v2 = __ccgo_ts + 14965 + v2 = __ccgo_ts + 14994 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35669, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35699, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35676, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35384)) - _ = libc.Int32FromInt32(0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35706, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35414)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) @@ -201011,7 +197595,6 @@ func _sqlite3Fts5ConfigParseRank(tls *libc.TLS, zIn uintptr, pzRank uintptr, pzR } if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { Xsqlite3_free(tls, zRank) - _ = libc.Int32FromInt32(0) } else { *(*uintptr)(unsafe.Pointer(pzRank)) = zRank *(*uintptr)(unsafe.Pointer(pzRankArgs)) = zRankArgs @@ -201028,7 +197611,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35702) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35732) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -201039,7 +197622,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35707) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35737) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -201050,7 +197633,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35716) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35746) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -201064,7 +197647,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35726) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35756) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -201075,7 +197658,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35736) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35766) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -201092,7 +197675,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35748) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35778) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -201107,7 +197690,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35384) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35414) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -201122,7 +197705,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35760) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35790) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -201164,7 +197747,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35774 + zSelect = __ccgo_ts + 35804 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -201180,12 +197763,11 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_prepare_v2(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), bp, uintptr(0)) Xsqlite3_free(tls, zSql) } - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35806) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35836) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -201197,8 +197779,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { - _ = libc.Int32FromInt32(0) - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35814, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35844, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -201354,7 +197935,6 @@ func _sqlite3Fts5ParseError(tls *libc.TLS, pParse uintptr, zFmt uintptr, va uint _ = ap ap = va if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { - _ = libc.Int32FromInt32(0) (*TFts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_vmprintf(tls, zFmt, ap) (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -201420,17 +198000,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35885, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35915, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35905, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35935, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -201441,16 +198022,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35936, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35966, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35939, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35969, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30680, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30710, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -201502,7 +198084,6 @@ func _sqlite3Fts5ExprNew(tls *libc.TLS, pConfig uintptr, bPhraseToAnd int32, iCo _sqlite3Fts5ParseSetColset(tls, bp, (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr, pColset) } } - _ = libc.Int32FromInt32(0) if (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc == SQLITE_OK { v1 = Xsqlite3_malloc(tls, int32(40)) pNew = v1 @@ -201555,6 +198136,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -201615,6 +198197,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -201672,6 +198255,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -201719,6 +198303,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -201748,9 +198333,6 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint _, _, _, _ = bRetValid, iRet, iRowid, p iRet = 0 bRetValid = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p = pTerm for { if !(p != 0) { @@ -201765,6 +198347,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -201792,7 +198375,6 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt nIter = 0 nAlloc = int32(4) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) p = pTerm for { if !(p != 0) { @@ -201818,11 +198400,11 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt aIter = aNew } _sqlite3Fts5PoslistReaderInit(tls, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FpData, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData, aIter+uintptr(nIter)*32) - _ = libc.Int32FromInt32(0) nIter++ } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -201851,6 +198433,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -202004,6 +198592,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -202096,7 +198685,6 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { a = bp apPhrase = pNear + 24 *(*int32)(unsafe.Pointer(bp + 192)) = *(*int32)(unsafe.Pointer(pRc)) - _ = libc.Int32FromInt32(0) /* If the aStatic[] array is not large enough, allocate a large array ** using sqlite3_malloc(). This approach could be improved upon. */ if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase > int32(libc.Uint64FromInt64(192)/libc.Uint64FromInt64(48)) { @@ -202128,6 +198716,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -202156,6 +198745,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -202172,6 +198762,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -202187,6 +198778,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -202194,6 +198786,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -202228,7 +198821,6 @@ func _fts5ExprAdvanceto(tls *libc.TLS, pIter uintptr, bDesc int32, piLast uintpt return int32(1) } iRowid = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid - _ = libc.Int32FromInt32(0) } *(*Ti64)(unsafe.Pointer(piLast)) = iRowid return 0 @@ -202258,6 +198850,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -202295,6 +198888,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -202320,6 +198914,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -202347,7 +198942,6 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) var p, pNear, pPhrase, pTerm uintptr _, _, _, _, _, _, _, _, _, _ = bHit, i, j, p, pNear, pPhrase, pTerm, rc, v4, v5 pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { @@ -202385,7 +198979,6 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) v5 = 0 } rc = _sqlite3Fts5IndexQuery(tls, (*TFts5Expr)(unsafe.Pointer(pExpr)).FpIndex, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpTerm, (*TFts5ExprTerm)(unsafe.Pointer(p)).FnQueryTerm, v4|v5, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset, p+24) - _ = libc.Int32FromInt32(0) if rc != SQLITE_OK { return rc } @@ -202394,6 +198987,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -202402,11 +198996,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -202426,7 +199022,6 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) // ** (iRhs - iLhs) // */ func _fts5RowidCmp(tls *libc.TLS, pExpr uintptr, iLhs Ti64, iRhs Ti64) (r int32) { - _ = libc.Int32FromInt32(0) if (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc == 0 { if iLhs < iRhs { return -int32(1) @@ -202454,6 +199049,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -202473,6 +199069,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -202484,6 +199081,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -202540,7 +199138,6 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* True if all terms are at the same rowid */ bDesc = (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc /* Check that this node should not be FTS5_TERM */ - _ = libc.Int32FromInt32(0) /* Initialize iLast, the "lastest" rowid any iterator points to. If the ** iterator skips through rowids in the default ascending order, this means ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it @@ -202587,16 +199184,17 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = *(*Ti64)(unsafe.Pointer(bp + 8)) (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = libc.BoolInt32(0 == _fts5ExprNearTest(tls, bp, pExpr, pNode) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK) - _ = libc.Int32FromInt32(0) return *(*int32)(unsafe.Pointer(bp)) } @@ -202648,6 +199246,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -202655,7 +199254,6 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = libc.BoolInt32(rc != 0 || bEof != 0) } else { pIter = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter - _ = libc.Int32FromInt32(0) if bFromValid != 0 { rc = _sqlite3Fts5IterNextFrom(tls, pIter, iFrom) } else { @@ -202664,7 +199262,6 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = libc.BoolInt32(rc != 0 || (*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0) } if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 { - _ = libc.Int32FromInt32(0) rc = _fts5ExprNodeTest_STRING(tls, pExpr, pNode) } return rc @@ -202680,9 +199277,6 @@ func _fts5ExprNodeTest_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int3 ** expressions. */ pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24)) pIter = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FpIter - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData if (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FeDetail == FTS5_DETAIL_FULL { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fp = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FpData @@ -202702,7 +199296,6 @@ func _fts5ExprNodeNext_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVa var rc int32 _, _ = pIter, rc pIter = (*(*TFts5ExprTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24)) + 32))).FpIter - _ = libc.Int32FromInt32(0) if bFromValid != 0 { rc = _sqlite3Fts5IterNextFrom(tls, pIter, iFrom) } else { @@ -202734,6 +199327,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -202753,7 +199347,6 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali break } p1 = *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)) - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0 { if (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid == iLast || bFromValid != 0 && _fts5RowidCmp(tls, pExpr, (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid, iFrom) < 0 { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(p1)).FxNext})))(tls, pExpr, p1, bFromValid, iFrom) @@ -202765,6 +199358,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -202783,7 +199377,6 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) _, _, _, _, _, _ = bMatch, cmp, iChild, iLast, pChild, rc iLast = (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FiRowid rc = SQLITE_OK - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = bMatch == 0 { (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 0 bMatch = int32(1) @@ -202806,7 +199399,6 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) ** the child node is guaranteed to have advanced at least as far as ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the ** new lastest rowid seen so far. */ - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof != 0 { _fts5ExprSetEof(tls, pAnd) bMatch = int32(1) @@ -202822,6 +199414,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -202851,14 +199444,12 @@ func _fts5ExprNodeTest_NOT(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32 rc = SQLITE_OK p1 = *(*uintptr)(unsafe.Pointer(pNode + 48)) p2 = *(*uintptr)(unsafe.Pointer(pNode + 48 + 1*8)) - _ = libc.Int32FromInt32(0) for rc == SQLITE_OK && (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0 { cmp = _fts5NodeCompare(tls, pExpr, p1, p2) if cmp > 0 { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(p2)).FxNext})))(tls, pExpr, p2, int32(1), (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid) cmp = _fts5NodeCompare(tls, pExpr, p1, p2) } - _ = libc.Int32FromInt32(0) if cmp != 0 || (*TFts5ExprNode)(unsafe.Pointer(p2)).FbNomatch != 0 { break } @@ -202908,7 +199499,6 @@ func _fts5ExprNodeTest(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { case int32(FTS5_OR): _fts5ExprNodeTest_OR(tls, pExpr, pNode) default: - _ = libc.Int32FromInt32(0) rc = _fts5ExprNodeTest_NOT(tls, pExpr, pNode) break } @@ -202947,10 +199537,10 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { } pChild = *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)) rc = _fts5ExprNodeFirst(tls, pExpr, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) - _ = libc.Int32FromInt32(0) nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -202964,7 +199554,6 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { _fts5ExprSetEof(tls, pNode) } default: - _ = libc.Int32FromInt32(0) (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FbEof break } @@ -203008,7 +199597,6 @@ func _sqlite3Fts5ExprFirst(tls *libc.TLS, p uintptr, pIdx uintptr, iFirst Ti64, } /* If the iterator is not at a real match, skip forward until it is. */ for (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0 && rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pRoot)).FxNext})))(tls, p, pRoot, 0, int64(libc.Int32FromInt32(0))) } return rc @@ -203027,10 +199615,8 @@ func _sqlite3Fts5ExprNext(tls *libc.TLS, p uintptr, iLast Ti64) (r int32) { var rc int32 _, _ = pRoot, rc pRoot = (*TFts5Expr)(unsafe.Pointer(p)).FpRoot - _ = libc.Int32FromInt32(0) for cond := true; cond; cond = (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0 { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pRoot)).FxNext})))(tls, p, pRoot, 0, int64(libc.Int32FromInt32(0))) - _ = libc.Int32FromInt32(0) } if _fts5RowidCmp(tls, p, (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FiRowid, iLast) > 0 { (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbEof = int32(1) @@ -203084,10 +199670,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -203152,16 +199740,11 @@ func _sqlite3Fts5ParseNearset(tls *libc.TLS, pParse uintptr, pNear uintptr, pPhr } } if pRet == uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3Fts5ParseNearsetFree(tls, pNear) _sqlite3Fts5ParsePhraseFree(tls, pPhrase) } else { if (*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase > 0 { pLast = *(*uintptr)(unsafe.Pointer(pRet + 24 + uintptr((*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-int32(1))*8)) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm == 0 { _fts5ExprPhraseFree(tls, pPhrase) (*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-- @@ -203310,6 +199893,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -203318,7 +199902,6 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { } func _sqlite3Fts5ParseFinished(tls *libc.TLS, pParse uintptr, p uintptr) { - _ = libc.Int32FromInt32(0) (*TFts5Parse)(unsafe.Pointer(pParse)).FpExpr = p } @@ -203465,6 +200048,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -203473,6 +200057,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -203516,8 +200101,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35943, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35973, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34754, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -203537,12 +200122,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35948, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35978, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -203573,8 +200159,6 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u v1 = 0 } nCol = v1 /* New colset object to return */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) pNew = Xsqlite3_realloc64(tls, p, uint64(8)+uint64(4)*uint64(nCol)) if pNew == uintptr(0) { (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) @@ -203593,6 +200177,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -203603,6 +200188,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -203641,6 +200227,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -203669,17 +200256,17 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21020, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } Xsqlite3_free(tls, z) } if pRet == uintptr(0) { - _ = libc.Int32FromInt32(0) Xsqlite3_free(tls, pColset) } return pRet @@ -203754,7 +200341,6 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u var pNear uintptr _, _ = i, pNear if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_STRING) || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_TERM) { pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset != 0 { @@ -203772,7 +200358,6 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u } } } else { - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { @@ -203781,6 +200366,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -203798,7 +200384,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35977, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36007, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -203822,7 +200408,6 @@ func _fts5ExprAssignXNext(tls *libc.TLS, pNode uintptr) { case int32(FTS5_AND): (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_AND) default: - _ = libc.Int32FromInt32(0) (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_NOT) break } @@ -203856,6 +200441,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -203878,8 +200464,6 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint var p, pPhrase, pRet, pTo, v3 uintptr _, _, _, _, _, _, _, _, _ = ii, nByte, nTerm, p, pPhrase, pRet, pTo, v2, v3 nTerm = (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)))).FnTerm - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) nByte = int32(uint64(56) + uint64(nTerm)*uint64(8)) pRet = _sqlite3Fts5MallocZero(tls, pParse+16, int64(nByte)) if pRet != 0 { @@ -203913,6 +200497,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -203941,7 +200526,6 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin pRet = uintptr(0) if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { nChild = 0 /* Bytes of space to allocate for this node */ - _ = libc.Int32FromInt32(0) if eType == int32(FTS5_STRING) && pNear == uintptr(0) { return uintptr(0) } @@ -203986,17 +200570,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36030 + v2 = __ccgo_ts + 36060 } else { - v2 = __ccgo_ts + 35943 + v2 = __ccgo_ts + 35973 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36037, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36067, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204005,7 +200590,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36087, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36117, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204014,7 +200599,6 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } } if pRet == uintptr(0) { - _ = libc.Int32FromInt32(0) _sqlite3Fts5ParseNodeFree(tls, pLeft) _sqlite3Fts5ParseNodeFree(tls, pRight) _sqlite3Fts5ParseNearsetFree(tls, pNear) @@ -204030,16 +200614,12 @@ func _sqlite3Fts5ParseImplicitAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, _sqlite3Fts5ParseNodeFree(tls, pLeft) _sqlite3Fts5ParseNodeFree(tls, pRight) } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(pLeft)).FeType == int32(FTS5_AND) { pPrev = *(*uintptr)(unsafe.Pointer(pLeft + 48 + uintptr((*TFts5ExprNode)(unsafe.Pointer(pLeft)).FnChild-int32(1))*8)) } else { pPrev = pLeft } - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(pRight)).FeType == FTS5_EOF { - _ = libc.Int32FromInt32(0) _sqlite3Fts5ParseNodeFree(tls, pRight) pRet = pLeft (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- @@ -204052,7 +200632,6 @@ func _sqlite3Fts5ParseImplicitAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRet = pLeft } ap = (*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr((*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-int32(1)-(*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase)*8 - _ = libc.Int32FromInt32(0) libc.Xmemmove(tls, ap, ap+1*8, uint64(8)*uint64((*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase)) (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- _sqlite3Fts5ParseNodeFree(tls, pPrev) @@ -204165,7 +200744,6 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } pBuf = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 8 pNode = (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)))).FpNode - _ = libc.Int32FromInt32(0) if bLive != 0 && ((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn == 0 || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid != (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof != 0) { (*(*TFts5PoslistPopulator)(unsafe.Pointer(pRet + uintptr(i)*16))).FbMiss = int32(1) } else { @@ -204173,6 +200751,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -204213,6 +200792,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -204235,6 +200815,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -204287,10 +200868,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -204320,6 +200903,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -204339,6 +200923,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -204366,6 +200951,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -204380,11 +200966,11 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet default: - _ = libc.Int32FromInt32(0) if 0 == _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48)), iRowid) || 0 != _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + 1*8)), iRowid) { _fts5ExprClearPoslists(tls, pNode) return 0 @@ -204410,8 +200996,6 @@ func _sqlite3Fts5ExprPhraseCollist(tls *libc.TLS, pExpr uintptr, iPhrase int32, pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) pNode = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FpNode rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 && (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid == (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid && (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn > 0 { pTerm = pPhrase + 32 if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { @@ -204503,10 +201087,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -204679,10 +201265,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8)) @@ -204702,6 +201290,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 { /* p2 is smaller */ *(*uintptr)(unsafe.Pointer(ppOut)) = p2 @@ -205080,16 +201667,19 @@ func _fts5HashEntrySort(tls *libc.TLS, pHash uintptr, pTerm uintptr, nTerm int32 *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = uintptr(0) goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = pEntry } goto _2 _2: + ; pIter = (*TFts5HashEntry)(unsafe.Pointer(pIter)).FpHashNext } goto _1 _1: + ; iSlot++ } pList = uintptr(0) @@ -205101,6 +201691,7 @@ func _fts5HashEntrySort(tls *libc.TLS, pHash uintptr, pTerm uintptr, nTerm int32 pList = _fts5HashEntryMerge(tls, pList, *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8))) goto _4 _4: + ; i++ } Xsqlite3_free(tls, ap) @@ -205131,6 +201722,7 @@ func _sqlite3Fts5HashQuery(tls *libc.TLS, pHash uintptr, nPre int32, pTerm uintp } goto _1 _1: + ; p = (*TFts5HashEntry)(unsafe.Pointer(p)).FpHashNext } if p != 0 { @@ -205165,12 +201757,10 @@ func _sqlite3Fts5HashScanInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int // ** Return true if the hash table is empty, false otherwise. // */ func _sqlite3Fts5HashIsEmpty(tls *libc.TLS, pHash uintptr) (r int32) { - _ = libc.Int32FromInt32(0) return libc.BoolInt32((*TFts5Hash)(unsafe.Pointer(pHash)).FnEntry == 0) } func _sqlite3Fts5HashScanNext(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) (*TFts5Hash)(unsafe.Pointer(p)).FpScan = (*TFts5HashEntry)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(p)).FpScan)).FpScanNext } @@ -206076,8 +202666,6 @@ func _fts5BufferCompare(tls *libc.TLS, pLeft uintptr, pRight uintptr) (r int32) v1 = (*TFts5Buffer)(unsafe.Pointer(pRight)).Fn } nCmp = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if nCmp <= 0 { v2 = 0 } else { @@ -206138,7 +202726,6 @@ func _fts5DataRead(tls *libc.TLS, p uintptr, iRowid Ti64) (r uintptr) { pBlob = (*TFts5Index)(unsafe.Pointer(p)).FpReader (*TFts5Index)(unsafe.Pointer(p)).FpReader = uintptr(0) rc = Xsqlite3_blob_reopen(tls, pBlob, iRowid) - _ = libc.Int32FromInt32(0) (*TFts5Index)(unsafe.Pointer(p)).FpReader = pBlob if rc != SQLITE_OK { _sqlite3Fts5IndexCloseReader(tls, p) @@ -206151,7 +202738,7 @@ func _fts5DataRead(tls *libc.TLS, p uintptr, iRowid Ti64) (r uintptr) { ** to the requested entry. */ if (*TFts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0) && rc == SQLITE_OK { pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36140, iRowid, 0, p+72) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36170, iRowid, 0, p+72) } /* If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls ** above returned SQLITE_ERROR, return SQLITE_CORRUPT_VTAB instead. @@ -206190,7 +202777,6 @@ func _fts5DataRead(tls *libc.TLS, p uintptr, iRowid Ti64) (r uintptr) { (*TFts5Index)(unsafe.Pointer(p)).Frc = rc (*TFts5Index)(unsafe.Pointer(p)).FnRead++ } - _ = libc.Int32FromInt32(0) return pRet } @@ -206245,7 +202831,7 @@ func _fts5DataWrite(tls *libc.TLS, p uintptr, iRowid Ti64, pData uintptr, nData } if (*TFts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - _fts5IndexPrepareStmt(tls, p, p+80, Xsqlite3_mprintf(tls, __ccgo_ts+36146, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+80, Xsqlite3_mprintf(tls, __ccgo_ts+36176, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return } @@ -206274,7 +202860,7 @@ func _fts5DataDelete(tls *libc.TLS, p uintptr, iFirst Ti64, iLast Ti64) { } if (*TFts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+36197, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+36227, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if _fts5IndexPrepareStmt(tls, p, p+88, zSql) != 0 { return } @@ -206308,7 +202894,7 @@ func _fts5DataRemoveSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { } if (*TFts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - _fts5IndexPrepareStmt(tls, p, p+104, Xsqlite3_mprintf(tls, __ccgo_ts+36246, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+104, Xsqlite3_mprintf(tls, __ccgo_ts+36276, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxDeleter, int32(1), iSegid) @@ -206334,7 +202920,6 @@ func _fts5StructureRelease(tls *libc.TLS, pStruct uintptr) { v1 = *(*int32)(unsafe.Pointer(v2)) } if v3 && 0 >= v1 { - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { @@ -206343,6 +202928,7 @@ func _fts5StructureRelease(tls *libc.TLS, pStruct uintptr) { Xsqlite3_free(tls, (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(i)*16))).FaSeg) goto _4 _4: + ; i++ } Xsqlite3_free(tls, pStruct) @@ -206398,6 +202984,7 @@ func _fts5StructureMakeWritable(tls *libc.TLS, pRc uintptr, pp uintptr) { (*(*TFts5StructureLevel)(unsafe.Pointer(pNew + 32 + uintptr(i)*16))).FaSeg = uintptr(0) goto _1 _1: + ; i++ } i = 0 @@ -206417,6 +203004,7 @@ func _fts5StructureMakeWritable(tls *libc.TLS, pRc uintptr, pp uintptr) { Xsqlite3_free(tls, (*(*TFts5StructureLevel)(unsafe.Pointer(pNew + 32 + uintptr(i)*16))).FaSeg) goto _3 _3: + ; i++ } Xsqlite3_free(tls, pNew) @@ -206425,6 +203013,7 @@ func _fts5StructureMakeWritable(tls *libc.TLS, pRc uintptr, pp uintptr) { libc.Xmemcpy(tls, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg, (*(*TFts5StructureLevel)(unsafe.Pointer(p + 32 + uintptr(i)*16))).FaSeg, uint64(nByte)) goto _2 _2: + ; i++ } (*TFts5Structure)(unsafe.Pointer(p)).FnRef-- @@ -206474,7 +203063,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } i = int32(4) /* Check if this is a V2 structure record. Set bStructureV2 if it is. */ - if 0 == libc.Xmemcmp(tls, pData+uintptr(i), __ccgo_ts+36286, uint64(4)) { + if 0 == libc.Xmemcmp(tls, pData+uintptr(i), __ccgo_ts+36316, uint64(4)) { i += int32(4) bStructureV2 = int32(1) } @@ -206522,7 +203111,6 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -206556,6 +203145,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -206585,7 +203175,6 @@ func _fts5StructureAddLevel(tls *libc.TLS, pRc uintptr, ppStruct uintptr) { var pStruct uintptr _, _, _ = nByte, nLevel, pStruct _fts5StructureMakeWritable(tls, pRc, ppStruct) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { pStruct = *(*uintptr)(unsafe.Pointer(ppStruct)) nLevel = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel @@ -206665,7 +203254,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36291, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36321, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -206701,8 +203290,6 @@ func _fts5StructureRead(tls *libc.TLS, p uintptr) (r uintptr) { if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { return uintptr(0) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _fts5StructureRef(tls, (*TFts5Index)(unsafe.Pointer(p)).FpStruct) return (*TFts5Index)(unsafe.Pointer(p)).FpStruct } @@ -206741,7 +203328,6 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { v1 = libc.Int32FromInt32(4) + libc.Int32FromInt32(9) + libc.Int32FromInt32(9) } /* Cookie value to store */ nHdr = v1 - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(16)) /* Append the current configuration cookie */ iCookie = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FiCookie @@ -206752,16 +203338,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { - _ = libc.Int32FromInt32(0) - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36286, uint64(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36316, uint64(4)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment)) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64(int64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter))) - _ = libc.Int32FromInt32(0) } iLvl = 0 for { @@ -206771,7 +203353,6 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { pLvl = pStruct + 32 + uintptr(iLvl)*16 _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge)) _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg)) - _ = libc.Int32FromInt32(0) iSeg = 0 for { if !(iSeg < (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg) { @@ -206790,10 +203371,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -206845,10 +203428,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -206894,12 +203479,12 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { szMax = 0 pTst = pStruct + 32 + uintptr(iTst)*16 - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFts5StructureLevel)(unsafe.Pointer(pTst)).FnSeg) { @@ -206911,6 +203496,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -206945,7 +203531,6 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { _, _, _ = iOff, pData, p2 pData = (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData if (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff == 0 { - _ = libc.Int32FromInt32(0) (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = int32(1) *(*int32)(unsafe.Pointer(pLvl + 8)) += _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+1, pLvl+20) *(*int32)(unsafe.Pointer(pLvl + 8)) += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr((*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff), pLvl+24)) @@ -206961,6 +203546,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -206985,7 +203571,6 @@ func _fts5DlidxIterNextR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) (r var pLvl uintptr _ = pLvl pLvl = pIter + 8 + uintptr(iLvl)*32 - _ = libc.Int32FromInt32(0) if _fts5DlidxLvlNext(tls, pLvl) != 0 { if iLvl+int32(1) < (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { _fts5DlidxIterNextR(tls, p, pIter, iLvl+int32(1)) @@ -207030,6 +203615,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -207061,6 +203647,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -207078,7 +203665,6 @@ func _fts5DlidxLvlPrev(tls *libc.TLS, pLvl uintptr) (r int32) { var _ /* delta at bp+0 */ Tu64 _, _, _, _, _ = a, iOff, ii, nZero, p1 iOff = (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff - _ = libc.Int32FromInt32(0) if iOff <= (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff { (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = int32(1) } else { @@ -207110,7 +203696,6 @@ func _fts5DlidxIterPrevR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) (r var pLvl uintptr _ = pLvl pLvl = pIter + 8 + uintptr(iLvl)*32 - _ = libc.Int32FromInt32(0) if _fts5DlidxLvlPrev(tls, pLvl) != 0 { if iLvl+int32(1) < (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { _fts5DlidxIterPrevR(tls, p, pIter, iLvl+int32(1)) @@ -207150,6 +203735,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -207186,6 +203772,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -207265,7 +203852,6 @@ func _fts5GetPoslistSize(tls *libc.TLS, p uintptr, pnSz uintptr, pbDel uintptr) n-- n += _sqlite3Fts5GetVarint32(tls, p+uintptr(n), bp) } - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pnSz)) = *(*int32)(unsafe.Pointer(bp)) / int32(2) *(*int32)(unsafe.Pointer(pbDel)) = *(*int32)(unsafe.Pointer(bp)) & int32(0x0001) return n @@ -207292,7 +203878,6 @@ func _fts5SegIterLoadNPos(tls *libc.TLS, p uintptr, pIter uintptr) { _, _, _, _ = iEod, iOff, v1, v2 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { iOff = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) /* Offset to read at */ - _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist < (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf { v1 = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist @@ -207322,7 +203907,6 @@ func _fts5SegIterLoadNPos(tls *libc.TLS, p uintptr, pIter uintptr) { } (*TFts5SegIter)(unsafe.Pointer(pIter)).FbDel = uint8(*(*int32)(unsafe.Pointer(bp)) & libc.Int32FromInt32(0x0001)) (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos = *(*int32)(unsafe.Pointer(bp)) >> int32(1) - _ = libc.Int32FromInt32(0) } (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(iOff) } @@ -207334,7 +203918,6 @@ func _fts5SegIterLoadRowid(tls *libc.TLS, p uintptr, pIter uintptr) { _, _ = a, iOff a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp /* Buffer to read data from */ iOff = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset - _ = libc.Int32FromInt32(0) for iOff >= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) { _fts5SegIterNextPage(tls, p, pIter) if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { @@ -207384,7 +203967,6 @@ func _fts5SegIterLoadTerm(tls *libc.TLS, p uintptr, pIter uintptr, nKeep int32) } (*TFts5SegIter)(unsafe.Pointer(pIter)).Fterm.Fn = nKeep _sqlite3Fts5BufferAppendBlob(tls, p+60, pIter+96, uint32(*(*int32)(unsafe.Pointer(bp))), a+uintptr(iOff)) - _ = libc.Int32FromInt32(0) iOff += int64(*(*int32)(unsafe.Pointer(bp))) (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset = int32(iOff) (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno @@ -207450,7 +204032,6 @@ func _fts5SegIterInit(tls *libc.TLS, p uintptr, pSeg uintptr, pIter uintptr) { ** fts5TrimSegments() for details. In this case leave the iterator empty. ** The caller will see the (pIter->pLeaf==0) and assume the iterator is ** at EOF already. */ - _ = libc.Int32FromInt32(0) return } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -207464,9 +204045,6 @@ func _fts5SegIterInit(tls *libc.TLS, p uintptr, pSeg uintptr, pIter uintptr) { } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(4) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + int32(1) _fts5SegIterLoadTerm(tls, p, pIter, 0) _fts5SegIterLoadNPos(tls, p, pIter) @@ -207508,7 +204086,6 @@ func _fts5SegIterReverseInitPage(tls *libc.TLS, p uintptr, pIter uintptr) { if n > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { n = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist } - _ = libc.Int32FromInt32(0) for int32(1) != 0 { *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) if eDetail == int32(FTS5_DETAIL_NONE) { @@ -207558,8 +204135,6 @@ func _fts5SegIterReverseNewPage(tls *libc.TLS, p uintptr, pIter uintptr) { var a, pNew uintptr var iRowidOff int32 _, _, _ = a, iRowidOff, pNew - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno { @@ -207570,7 +204145,6 @@ func _fts5SegIterReverseNewPage(tls *libc.TLS, p uintptr, pIter uintptr) { ** thing on the page - i.e. the first rowid is on the following page. ** In this case leave pIter->pLeaf==0, this iterator is at EOF. */ if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno == (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno { - _ = libc.Int32FromInt32(0) if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset < (*TFts5Data)(unsafe.Pointer(pNew)).FszLeaf { (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pNew (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64((*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset) @@ -207629,8 +204203,6 @@ func _fts5SegIterNext_Reverse(tls *libc.TLS, p uintptr, pIter uintptr, pbUnused var iOff int32 var _ /* iDelta at bp+0 */ Tu64 _, _, _ = a, iOff, p1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) _ = pbUnused if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset > 0 { a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp @@ -207668,10 +204240,6 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui var _ /* pList at bp+16 */ uintptr var _ /* zTerm at bp+24 */ uintptr _ = iOff - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) iOff = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) /* Next entry is on the next page */ for (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg != 0 && iOff >= (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf { @@ -207721,6 +204289,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -207752,16 +204321,12 @@ func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr pLeaf = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf bNewTerm = 0 *(*int32)(unsafe.Pointer(bp + 4)) = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Search for the end of the position list within the current page. */ a = (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp n = (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp)) = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset + int64((*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos)) if *(*int32)(unsafe.Pointer(bp)) < n { /* The next entry is on the current page. */ - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) >= (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { bNewTerm = int32(1) if *(*int32)(unsafe.Pointer(bp)) != _fts5LeafFirstTermOff(tls, pLeaf) { @@ -207771,7 +204336,6 @@ func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr *(*int32)(unsafe.Pointer(bp)) += int32(_sqlite3Fts5GetVarint(tls, a+uintptr(*(*int32)(unsafe.Pointer(bp))), bp+8)) p1 = pIter + 112 *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp + 8))) - _ = libc.Int32FromInt32(0) } (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer(bp))) } else { @@ -207780,7 +204344,6 @@ func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32)) = 0 *(*int32)(unsafe.Pointer(bp + 36)) = 0 - _ = libc.Int32FromInt32(0) if 0 == (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags&int32(FTS5_SEGITER_ONETERM) { _sqlite3Fts5HashScanNext(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) _sqlite3Fts5HashScanEntry(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, bp+24, bp+32, bp+16, bp+36) @@ -207806,7 +204369,6 @@ func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr if pLeaf == uintptr(0) { break } - _ = libc.Int32FromInt32(0) v2 = int32(_fts5GetU16(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp)) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 && *(*int32)(unsafe.Pointer(bp)) < (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { @@ -207823,7 +204385,6 @@ func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr bNewTerm = int32(1) } } - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) > (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<> int32(1) - _ = libc.Int32FromInt32(0) } } } @@ -207926,6 +204485,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -207974,8 +204534,6 @@ func _fts5SegIterLoadDlidx(tls *libc.TLS, p uintptr, pIter uintptr) { iSeg = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid bRev = (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags & int32(FTS5_SEGITER_REVERSE) pLeaf = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf /* Current leaf data */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Check if the current doclist ends on this page. If it does, return ** early without loading the doclist-index (as it belongs to a different ** term. */ @@ -208020,7 +204578,6 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Current offset in pgidx */ bEndOfPage = 0 - _ = libc.Int32FromInt32(0) iPgidx = uint32((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) iPgidx += uint32(_sqlite3Fts5GetVarint32(tls, a+uintptr(iPgidx), bp+12)) *(*Tu32)(unsafe.Pointer(bp)) = *(*Tu32)(unsafe.Pointer(bp + 12)) @@ -208040,7 +204597,6 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin if *(*Tu32)(unsafe.Pointer(bp + 4)) < nMatch { goto search_failed } - _ = libc.Int32FromInt32(0) if *(*Tu32)(unsafe.Pointer(bp + 4)) == nMatch { if *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(nTerm)-nMatch { v2 = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -208058,6 +204614,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -208094,6 +204651,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -208124,6 +204682,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg/int32(2) { i1 = (iOut - (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg/int32(2)) * int32(2) i2 = i1 + int32(1) @@ -208476,8 +205028,6 @@ func _fts5MultiIterDoCompare(tls *libc.TLS, pIter uintptr, iOut int32) (r int32) } else { res = _fts5BufferCompare(tls, p1+96, p2+96) if res == 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TFts5CResult)(unsafe.Pointer(pRes)).FbTermEq = uint8(1) if (*TFts5SegIter)(unsafe.Pointer(p1)).FiRowid == (*TFts5SegIter)(unsafe.Pointer(p2)).FiRowid { return i2 @@ -208489,7 +205039,6 @@ func _fts5MultiIterDoCompare(tls *libc.TLS, pIter uintptr, iOut int32) (r int32) } res = v1 } - _ = libc.Int32FromInt32(0) if res < 0 { iRes = i1 } else { @@ -208512,7 +205061,6 @@ func _fts5SegIterGotoPage(tls *libc.TLS, p uintptr, pIter uintptr, iLeafPgno int var a uintptr var iOff, n int32 _, _, _ = a, iOff, n - _ = libc.Int32FromInt32(0) if iLeafPgno > (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FpgnoLast { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< _fts5DlidxIterRowid(tls, pDlidx) { iLeafPgno = _fts5DlidxIterPgno(tls, pDlidx) _fts5DlidxIterNext(tls, p, pDlidx) } - _ = libc.Int32FromInt32(0) if iLeafPgno > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { _fts5SegIterGotoPage(tls, p, pIter, iLeafPgno) bMove = 0 } } else { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for !(_fts5DlidxIterEof(tls, p, pDlidx) != 0) && iMatch < _fts5DlidxIterRowid(tls, pDlidx) { _fts5DlidxIterPrev(tls, p, pDlidx) } iLeafPgno = _fts5DlidxIterPgno(tls, pDlidx) - _ = libc.Int32FromInt32(0) if iLeafPgno < (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = iLeafPgno + int32(1) _fts5SegIterReverseNewPage(tls, p, pIter) @@ -208617,6 +205158,7 @@ func _fts5MultiIterFree(tls *libc.TLS, pIter uintptr) { _fts5SegIterClear(tls, pIter+104+uintptr(i)*128) goto _1 _1: + ; i++ } _sqlite3Fts5BufferFree(tls, pIter+40) @@ -208637,12 +205179,12 @@ func _fts5MultiIterAdvanced(tls *libc.TLS, p uintptr, pIter uintptr, iChanged in iEq = v2 if v2 != 0 { pSeg = pIter + 104 + uintptr(iEq)*128 - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5SegIter)(unsafe.Pointer(pSeg)).FxNext})))(tls, p, pSeg, uintptr(0)) i = (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg + iEq } goto _1 _1: + ; i = i / int32(2) } } @@ -208679,8 +205221,6 @@ func _fts5MultiIterAdvanceRowid(tls *libc.TLS, pIter uintptr, iChanged int32, pp break } pRes = (*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(i)*4 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5CResult)(unsafe.Pointer(pRes)).FbTermEq != 0 { if (*TFts5SegIter)(unsafe.Pointer(pNew)).FiRowid == (*TFts5SegIter)(unsafe.Pointer(pOther)).FiRowid { return int32(1) @@ -208702,6 +205242,7 @@ func _fts5MultiIterAdvanceRowid(tls *libc.TLS, pIter uintptr, iChanged int32, pp pOther = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(i^int32(0x0001))*4))).FiFirst)*128 goto _2 _2: + ; i = i / int32(2) } } @@ -208808,7 +205349,6 @@ func _fts5MultiIterIsDeleted(tls *libc.TLS, pIter uintptr) (r int32) { if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0 && pArray != 0 { /* Figure out which page the rowid might be present on. */ iPg = int32(uint64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid) % uint64((*TFts5TombstoneArray)(unsafe.Pointer(pArray)).FnTombstone)) - _ = libc.Int32FromInt32(0) /* If tombstone hash page iPg has not yet been loaded from the ** database, load it now. */ if *(*uintptr)(unsafe.Pointer(pArray + 8 + uintptr(iPg)*8)) == uintptr(0) { @@ -208839,12 +205379,10 @@ func _fts5MultiIterNext(tls *libc.TLS, p uintptr, pIter uintptr, bFrom int32, iF var _ /* pSeg at bp+8 */ uintptr _, _ = bUseFrom, iFirst bUseFrom = bFrom - _ = libc.Int32FromInt32(0) for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { iFirst = int32((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst) *(*int32)(unsafe.Pointer(bp)) = 0 *(*uintptr)(unsafe.Pointer(bp + 8)) = pIter + 104 + uintptr(iFirst)*128 - _ = libc.Int32FromInt32(0) if bUseFrom != 0 && (*TFts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDlidx != 0 { _fts5SegIterNextFrom(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8)), iFrom) } else { @@ -208858,7 +205396,6 @@ func _fts5MultiIterNext(tls *libc.TLS, p uintptr, pIter uintptr, bFrom int32, iF return } } - _ = libc.Int32FromInt32(0) if (int32((*TFts5Iter)(unsafe.Pointer(pIter)).FbSkipEmpty) == 0 || (*TFts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FnPos != 0) && 0 == _fts5MultiIterIsDeleted(tls, pIter) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs})))(tls, pIter, *(*uintptr)(unsafe.Pointer(bp + 8))) return @@ -208874,14 +205411,12 @@ func _fts5MultiIterNext2(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uint var _ /* bNewTerm at bp+8 */ int32 var _ /* pSeg at bp+0 */ uintptr _ = iFirst - _ = libc.Int32FromInt32(0) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*int32)(unsafe.Pointer(pbNewTerm)) = 0 for cond := true; cond; cond = (_fts5MultiIterIsEmpty(tls, p, pIter) != 0 || _fts5MultiIterIsDeleted(tls, pIter) != 0) && (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { iFirst = int32((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst) *(*uintptr)(unsafe.Pointer(bp)) = pIter + 104 + uintptr(iFirst)*128 *(*int32)(unsafe.Pointer(bp + 8)) = 0 - _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxNext})))(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+8) if (*TFts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpLeaf == uintptr(0) || *(*int32)(unsafe.Pointer(bp + 8)) != 0 || _fts5MultiIterAdvanceRowid(tls, pIter, iFirst, bp) != 0 { _fts5MultiIterAdvanced(tls, p, pIter, iFirst, int32(1)) @@ -208908,6 +205443,7 @@ func _fts5MultiIterAlloc(tls *libc.TLS, p uintptr, nSeg int32) (r uintptr) { } goto _1 _1: + ; nSlot = nSlot * int64(2) } pNew = _fts5IdxMalloc(tls, p, int64(uint64(232)+uint64(128)*uint64(nSlot-libc.Int64FromInt32(1))+uint64(4)*uint64(nSlot))) @@ -208922,9 +205458,7 @@ func _fts5MultiIterAlloc(tls *libc.TLS, p uintptr, nSeg int32) (r uintptr) { func _fts5PoslistCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { _ = pUnused - _ = libc.Int32FromInt32(0) if nChunk > 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pContext)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pContext)).Fn), pChunk, uint64(nChunk)) *(*int32)(unsafe.Pointer(pContext + 8)) += nChunk } @@ -208982,6 +205516,7 @@ func _fts5IndexColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) } goto _1 _1: + ; i++ } return 0 @@ -208996,7 +205531,6 @@ func _fts5PoslistOffsetsCallback(tls *libc.TLS, pUnused uintptr, pContext uintpt _, _ = i, pCtx pCtx = pContext _ = pUnused - _ = libc.Int32FromInt32(0) if nChunk > 0 { i = 0 for i < nChunk { @@ -209005,7 +205539,6 @@ func _fts5PoslistOffsetsCallback(tls *libc.TLS, pUnused uintptr, pContext uintpt (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiRead = *(*int32)(unsafe.Pointer(bp)) if _fts5IndexColsetTest(tls, (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp))) != 0 { *(*int32)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), uint64(*(*int32)(unsafe.Pointer(bp))+libc.Int32FromInt32(2)-(*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite)) - _ = libc.Int32FromInt32(0) (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite = *(*int32)(unsafe.Pointer(bp)) } } @@ -209022,7 +205555,6 @@ func _fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr _, _, _, _, _ = i, iStart, pCtx, v1, v2 pCtx = pContext _ = pUnused - _ = libc.Int32FromInt32(0) if nChunk > 0 { /* Search through to find the first varint with value 1. This is the ** start of the next columns hits. */ @@ -209039,7 +205571,6 @@ func _fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr if _fts5IndexColsetTest(tls, (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp))) != 0 { (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = int32(1) *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), uint64(libc.Int32FromInt32(1))) - _ = libc.Int32FromInt32(0) } else { (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = 0 } @@ -209052,7 +205583,6 @@ func _fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr i++ } if (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), pChunk+uintptr(iStart), uint64(i-iStart)) *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += i - iStart } @@ -209071,7 +205601,6 @@ func _fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr } (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = _fts5IndexColsetTest(tls, (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp + 4))) if (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), pChunk+uintptr(iStart), uint64(i-iStart)) *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += i - iStart iStart = i @@ -209099,7 +205628,6 @@ func _fts5ChunkIterate(tls *libc.TLS, p uintptr, pSeg uintptr, pCtx uintptr, xCh pgno = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno pgnoSave = 0 /* This function does not work with detail=none databases. */ - _ = libc.Int32FromInt32(0) if (*TFts5SegIter)(unsafe.Pointer(pSeg)).Fflags&int32(FTS5_SEGITER_REVERSE) == 0 { pgnoSave = pgno + int32(1) } @@ -209127,7 +205655,6 @@ func _fts5ChunkIterate(tls *libc.TLS, p uintptr, pSeg uintptr, pCtx uintptr, xCh } nChunk = v2 if pgno == pgnoSave { - _ = libc.Int32FromInt32(0) (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpNextLeaf = pData pData = uintptr(0) } @@ -209151,16 +205678,12 @@ func _fts5SegiterPoslist(tls *libc.TLS, p uintptr, pSeg uintptr, pColset uintptr var _ /* sCtx at bp+0 */ TPoslistCallbackCtx var _ /* sCtx at bp+24 */ TPoslistOffsetsCtx _ = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)+uint32((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos+libc.Int32FromInt32(FTS5_DATA_ZERO_PADDING)) <= uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) { v1 = 0 } else { v1 = _sqlite3Fts5BufferSize(tls, p+60, pBuf, uint32((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos+int32(FTS5_DATA_ZERO_PADDING)+(*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) } if 0 == v1 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos), 0, uint64(FTS5_DATA_ZERO_PADDING)) if pColset == uintptr(0) { _fts5ChunkIterate(tls, p, pSeg, pBuf, __ccgo_fp(_fts5PoslistCallback)) @@ -209169,7 +205692,6 @@ func _fts5SegiterPoslist(tls *libc.TLS, p uintptr, pSeg uintptr, pColset uintptr (*(*TPoslistCallbackCtx)(unsafe.Pointer(bp))).FpBuf = pBuf (*(*TPoslistCallbackCtx)(unsafe.Pointer(bp))).FpColset = pColset (*(*TPoslistCallbackCtx)(unsafe.Pointer(bp))).FeState = _fts5IndexColsetTest(tls, pColset, 0) - _ = libc.Int32FromInt32(0) _fts5ChunkIterate(tls, p, pSeg, bp, __ccgo_fp(_fts5PoslistFilterCallback)) } else { libc.Xmemset(tls, bp+24, 0, uint64(24)) @@ -209237,7 +205759,6 @@ func _fts5IndexExtractColset(tls *libc.TLS, pRc uintptr, pColset uintptr, pPos u (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = int32(int64(p) - int64(aCopy)) return } - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fn), aCopy, uint64(int64(p)-int64(aCopy))) p2 = pIter + 40 + 8 *(*int32)(unsafe.Pointer(p2)) = int32(int64(*(*int32)(unsafe.Pointer(p2))) + (int64(p) - int64(aCopy))) @@ -209267,7 +205788,6 @@ func _fts5IndexExtractColset(tls *libc.TLS, pRc uintptr, pColset uintptr, pPos u // ** xSetOutputs callback used by detail=none tables. // */ func _fts5IterSetOutputs_None(tls *libc.TLS, pIter uintptr, pSeg uintptr) { - _ = libc.Int32FromInt32(0) (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos } @@ -209281,8 +205801,6 @@ func _fts5IterSetOutputs_None(tls *libc.TLS, pIter uintptr, pSeg uintptr) { func _fts5IterSetOutputs_Nocolset(tls *libc.TLS, pIter uintptr, pSeg uintptr) { (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) <= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { /* All data is stored on the current page. Populate the output ** variables to point into the body of the page object. */ @@ -209339,8 +205857,6 @@ func _fts5IterSetOutputs_Col100(tls *libc.TLS, pIter uintptr, pSeg uintptr) { var a, aOut, aiCol, aiColEnd, pEnd, v1, v2 uintptr var iPrev, iPrevOut int32 _, _, _, _, _, _, _, _, _ = a, aOut, aiCol, aiColEnd, iPrev, iPrevOut, pEnd, v1, v2 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) > int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { _fts5IterSetOutputs_Col(tls, pIter, pSeg) } else { @@ -209370,6 +205886,7 @@ func _fts5IterSetOutputs_Col100(tls *libc.TLS, pIter uintptr, pSeg uintptr) { } } setoutputs_col_out: + ; (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = int32(int64(aOut) - int64((*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp)) } @@ -209385,8 +205902,6 @@ func _fts5IterSetOutputs_Full(tls *libc.TLS, pIter uintptr, pSeg uintptr) { _, _, _ = a, pColset, pRc pColset = (*TFts5Iter)(unsafe.Pointer(pIter)).FpColset (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) <= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { /* All data is stored on the current page. Populate the output ** variables to point into the body of the page object. */ @@ -209408,7 +205923,6 @@ func _fts5IterSetOutputs_Full(tls *libc.TLS, pIter uintptr, pSeg uintptr) { func _fts5IterSetOutputCb(tls *libc.TLS, pRc uintptr, pIter uintptr) { var pConfig uintptr _ = pConfig - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { pConfig = (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex)).FpConfig if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { @@ -209423,7 +205937,6 @@ func _fts5IterSetOutputCb(tls *libc.TLS, pRc uintptr, pIter uintptr) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_FULL { (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Full) } else { - _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol <= int32(100) { (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Col100) _sqlite3Fts5BufferSize(tls, pRc, pIter+40, uint32((*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)) @@ -209463,6 +205976,7 @@ func _fts5MultiIterFinishSetup(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; iIter-- } _fts5MultiIterSetEof(tls, pIter) @@ -209495,11 +206009,9 @@ func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, p _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iIter, iSeg, nSeg, pEnd, pIter, pIter1, pLvl, pNew, pSeg, v1, v2, v3, v6, v8 nSeg = 0 /* Number of segment-iters in use */ iIter = 0 - _ = libc.Int32FromInt32(0) /* Allocate space for the new multi-seg-iterator. */ if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if iLevel < 0 { - _ = libc.Int32FromInt32(0) nSeg = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment nSeg += libc.BoolInt32((*TFts5Index)(unsafe.Pointer(p)).FpHash != 0 && 0 == flags&int32(FTS5INDEX_QUERY_SKIPHASH)) } else { @@ -209515,7 +206027,6 @@ func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, p pNew = v2 *(*uintptr)(unsafe.Pointer(ppOut)) = v2 if pNew == uintptr(0) { - _ = libc.Int32FromInt32(0) goto fts5MultiIterNew_post_check } (*TFts5Iter)(unsafe.Pointer(pNew)).FbRev = libc.BoolInt32(0 != flags&int32(FTS5INDEX_QUERY_DESC)) @@ -209556,10 +206067,12 @@ func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, p } goto _5 _5: + ; iSeg-- } goto _4 _4: + ; pLvl += 16 } } else { @@ -209574,10 +206087,10 @@ func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, p _fts5SegIterInit(tls, p, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(iSeg)*56, pNew+104+uintptr(v8)*128) goto _7 _7: + ; iSeg-- } } - _ = libc.Int32FromInt32(0) } /* If the above was successful, each component iterator now points ** to the first entry in its segment. In this case initialize the @@ -209590,7 +206103,7 @@ func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, p *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) } fts5MultiIterNew_post_check: - _ = libc.Int32FromInt32(0) + ; return } @@ -209636,8 +206149,6 @@ func _fts5MultiIterNew2(tls *libc.TLS, p uintptr, pData uintptr, bDesc int32, pp // ** False otherwise. // */ func _fts5MultiIterEof(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) return libc.BoolInt32((*TFts5Index)(unsafe.Pointer(p)).Frc != 0 || (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof != 0) } @@ -209649,7 +206160,6 @@ func _fts5MultiIterEof(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { // ** results are undefined. // */ func _fts5MultiIterRowid(tls *libc.TLS, pIter uintptr) (r Ti64) { - _ = libc.Int32FromInt32(0) return (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128))).FiRowid } @@ -209730,10 +206240,12 @@ func _fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { } goto _2 _2: + ; iSeg++ } goto _1 _1: + ; iLvl++ } i = 0 @@ -209743,6 +206255,7 @@ func _fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { } goto _3 _3: + ; i++ } mask = (*(*[63]Tu32)(unsafe.Pointer(bp)))[i] @@ -209753,6 +206266,7 @@ func _fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { } goto _4 _4: + ; iSegid++ } iSegid += int32(1) + i*int32(32) @@ -209767,7 +206281,6 @@ func _fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { // ** Discard all data currently cached in the hash-tables. // */ func _fts5IndexDiscardData(tls *libc.TLS, p uintptr) { - _ = libc.Int32FromInt32(0) if (*TFts5Index)(unsafe.Pointer(p)).FpHash != 0 { _sqlite3Fts5HashClear(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) (*TFts5Index)(unsafe.Pointer(p)).FnPendingData = 0 @@ -209799,6 +206312,7 @@ func _fts5PrefixCompress(tls *libc.TLS, nOld int32, pOld uintptr, pNew uintptr) } goto _1 _1: + ; i++ } return i @@ -209808,7 +206322,6 @@ func _fts5WriteDlidxClear(tls *libc.TLS, p uintptr, pWriter uintptr, bFlush int3 var i int32 var pDlidx uintptr _, _ = i, pDlidx - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx) { @@ -209819,13 +206332,13 @@ func _fts5WriteDlidxClear(tls *libc.TLS, p uintptr, pWriter uintptr, bFlush int3 break } if bFlush != 0 { - _ = libc.Int32FromInt32(0) _fts5DataWrite(tls, p, int64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(i)< 0 { v1 = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } z = v1 /* The following was already done in fts5WriteInit(): */ @@ -209947,7 +206459,6 @@ func _fts5WriteBtreeNoTerm(tls *libc.TLS, p uintptr, pWriter uintptr) { ** has already been started, append an 0x00 byte to it. */ if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0 && (*(*TFts5DlidxWriter)(unsafe.Pointer((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx))).Fbuf.Fn > 0 { pDlidx = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx - _ = libc.Int32FromInt32(0) _sqlite3Fts5BufferAppendVarint(tls, p+60, pDlidx+16, 0) } /* Increment the "number of sequential leaves without a term" counter. */ @@ -210019,7 +206530,6 @@ func _fts5WriteDlidxAppend(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid Ti6 v2 = (*(*TFts5DlidxWriter)(unsafe.Pointer(pDlidx + uintptr(-libc.Int32FromInt32(1))*32))).Fpgno } iPgno = int64(v2) - _ = libc.Int32FromInt32(0) _sqlite3Fts5BufferAppendVarint(tls, p+60, pDlidx+16, libc.BoolInt64(!(bDone != 0))) _sqlite3Fts5BufferAppendVarint(tls, p+60, pDlidx+16, iPgno) iVal = iRowid @@ -210029,6 +206539,7 @@ func _fts5WriteDlidxAppend(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid Ti6 (*TFts5DlidxWriter)(unsafe.Pointer(pDlidx)).FiPrev = iRowid goto _1 _1: + ; i++ } } @@ -210038,13 +206549,10 @@ func _fts5WriteFlushLeaf(tls *libc.TLS, p uintptr, pWriter uintptr) { var pPage uintptr _, _ = iRowid, pPage pPage = pWriter + 8 - _ = libc.Int32FromInt32(0) /* Set the szLeaf header field. */ - _ = libc.Int32FromInt32(0) _fts5PutU16(tls, (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fp+2, uint16((*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn)) if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage != 0 { /* No term was written to this page. */ - _ = libc.Int32FromInt32(0) _fts5WriteBtreeNoTerm(tls, p, pWriter) } else { /* Append the pgidx to the page buffer. Set the szLeaf header field. */ @@ -210089,9 +206597,6 @@ func _fts5WriteAppendTerm(tls *libc.TLS, p uintptr, pWriter uintptr, nTerm int32 v1 = nTerm } nMin = v1 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If the current leaf page is full, flush it to disk. */ if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn+nTerm+int32(2) >= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn > int32(4) { @@ -210146,7 +206651,6 @@ func _fts5WriteAppendTerm(tls *libc.TLS, p uintptr, pWriter uintptr, nTerm int32 (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = uint8(0) (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = uint8(0) (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist = uint8(1) - _ = libc.Int32FromInt32(0) (*(*TFts5DlidxWriter)(unsafe.Pointer((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx))).Fpgno = (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgno } @@ -210174,7 +206678,6 @@ func _fts5WriteAppendRowid(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid Ti6 if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist != 0 || (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0 { _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, iRowid) } else { - _ = libc.Int32FromInt32(0) _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, int64(uint64(int64(uint64(iRowid)))-uint64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid))) } (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid = iRowid @@ -210193,7 +206696,6 @@ func _fts5WriteAppendPoslistData(tls *libc.TLS, p uintptr, pWriter uintptr, aDat pPage = pWriter + 8 a = aData n = nData - _ = libc.Int32FromInt32(0) for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn+(*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn+n >= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { nReq = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz - (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn - (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn nCopy = 0 @@ -210222,7 +206724,6 @@ func _fts5WriteFinish(tls *libc.TLS, p uintptr, pWriter uintptr, pnLeaf uintptr) _, _ = i, pLeaf pLeaf = pWriter + 8 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TFts5PageWriter)(unsafe.Pointer(pLeaf)).Fbuf.Fn > int32(4) { _fts5WriteFlushLeaf(tls, p, pWriter) } @@ -210243,6 +206744,7 @@ func _fts5WriteFinish(tls *libc.TLS, p uintptr, pWriter uintptr, pnLeaf uintptr) _sqlite3Fts5BufferFree(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx+uintptr(i)*32+16) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx) @@ -210261,14 +206763,12 @@ func _fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fpgno = int32(1) (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = uint8(1) (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage = int32(1) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Grow the two buffers to pgsz + padding bytes in size. */ _sqlite3Fts5BufferSize(tls, p+60, pWriter+8+24, uint32(nBuffer)) _sqlite3Fts5BufferSize(tls, p+60, pWriter+8+8, uint32(nBuffer)) if (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - _fts5IndexPrepareStmt(tls, p, p+96, Xsqlite3_mprintf(tls, __ccgo_ts+36480, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+96, Xsqlite3_mprintf(tls, __ccgo_ts+36510, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Initialize the 4-byte leaf-page header to 0x00. */ @@ -210356,6 +206856,7 @@ func _fts5TrimSegments(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i++ } _sqlite3Fts5BufferFree(tls, bp) @@ -210396,13 +206897,10 @@ func _fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32 eDetail = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail flags = int32(FTS5INDEX_QUERY_NOOUTPUT) bTermWritten = 0 /* True if current term already output */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp+8, 0, uint64(120)) libc.Xmemset(tls, bp+128, 0, uint64(16)) if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { pLvlOut = pStruct + 32 + uintptr(iLvl+int32(1))*16 - _ = libc.Int32FromInt32(0) nInput = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge pSeg = (*TFts5StructureLevel)(unsafe.Pointer(pLvlOut)).FaSeg + uintptr((*TFts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg-int32(1))*56 _fts5WriteInit(tls, p, bp+8, (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid) @@ -210438,7 +206936,6 @@ func _fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32 } } bOldest = libc.BoolInt32((*TFts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg == int32(1) && (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel == iLvl+int32(2)) - _ = libc.Int32FromInt32(0) _fts5MultiIterNew(tls, p, pStruct, flags, uintptr(0), uintptr(0), 0, iLvl, nInput, bp) for { if !(_fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) == 0) { @@ -210487,15 +206984,14 @@ func _fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32 } goto _2 _2: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp)), 0, 0) } /* Flush the last leaf page to disk. Set the output segment b-tree height ** and last leaf page number at the same time. */ _fts5WriteFinish(tls, p, bp+8, pSeg+8) - _ = libc.Int32FromInt32(0) if _fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) != 0 { /* Remove the redundant segments from the %_data table */ - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nInput) { @@ -210506,6 +207002,7 @@ func _fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32 _fts5DataRemoveSegment(tls, p, pOld) goto _5 _5: + ; i++ } /* Remove the redundant segments from the input level */ @@ -210521,7 +207018,6 @@ func _fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32 (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment-- } } else { - _ = libc.Int32FromInt32(0) _fts5TrimSegments(tls, p, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge = nInput } @@ -210568,9 +207064,9 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int nTomb = Ti64(uint64(nTomb) + (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*56))).FnEntryTombstone) goto _2 _2: + ; iSeg++ } - _ = libc.Int32FromInt32(0) if nEntry > 0 { nPercent = int32(nTomb * int64(100) / nEntry) if nPercent >= (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge && nPercent > nBest { @@ -210580,6 +207076,7 @@ func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int } goto _1 _1: + ; ii++ } } @@ -210609,7 +207106,6 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin nBest = 0 /* Number of input segments on best level */ /* Set iBestLvl to the level to read input segments from. Or to -1 if ** there is no level suitable to merge segments from. */ - _ = libc.Int32FromInt32(0) iLvl = 0 for { if !(iLvl < (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FnLevel) { @@ -210629,6 +207125,7 @@ func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin } goto _1 _1: + ; iLvl++ } if nBest < nMin { @@ -210688,7 +207185,6 @@ func _fts5IndexCrisismerge(tls *libc.TLS, p uintptr, ppStruct uintptr) { iLvl = 0 for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg >= nCrisis { _fts5IndexMergeLevel(tls, p, bp, iLvl, uintptr(0)) - _ = libc.Int32FromInt32(0) _fts5StructurePromote(tls, p, iLvl+int32(1), *(*uintptr)(unsafe.Pointer(bp))) iLvl++ } @@ -210761,9 +207257,8 @@ func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int bp := tls.Alloc(32) defer tls.Free(32) if iPgno != int32(1) { - _ = libc.Int32FromInt32(0) if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { - _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36537, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36567, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) @@ -210798,7 +207293,6 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int _, _, _, _, _, _, _, _, _, _, _ = aIdx, aPg, bDetailNone, i1, i2, iRowid, nIdx, nPg, nShift, pLeaf, pgno bDetailNone = libc.BoolInt32((*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == libc.Int32FromInt32(FTS5_DETAIL_NONE)) pLeaf = uintptr(0) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pbLastInDoclist)) = int32(1) pgno = iPgno for { @@ -210826,7 +207320,6 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int *(*[4]Tu8)(unsafe.Pointer(bp + 4)) = [4]Tu8{ 3: uint8(0x04), } - _ = libc.Int32FromInt32(0) if bDetailNone == 0 { _fts5DataWrite(tls, p, iRowid, bp+4, int32(4)) } @@ -210881,7 +207374,6 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } Xsqlite3_free(tls, aIdx) /* Write the new page to disk and exit the loop */ - _ = libc.Int32FromInt32(0) _fts5DataWrite(tls, p, iRowid, aPg, nPg) break } @@ -210889,6 +207381,7 @@ func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int } goto _1 _1: + ; pgno++ } _fts5DataRelease(tls, pLeaf) @@ -210976,7 +207469,6 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iStart = int32(_fts5GetU16(tls, aPg)) } iSOP = iStart + int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iStart), bp)) - _ = libc.Int32FromInt32(0) if bDetailNone != 0 { for int64(iSOP) < (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset { if int32(*(*Tu8)(unsafe.Pointer(aPg + uintptr(iSOP)))) == 0x00 { @@ -211003,7 +207495,6 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iSOP = iStart + int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iStart), bp)) iSOP += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iSOP), bp+12) } - _ = libc.Int32FromInt32(0) iNextOff = int32((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) } iOff = iStart @@ -211080,9 +207571,9 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) goto _3 _3: + ; iKey++ } - _ = libc.Int32FromInt32(0) /* Set iDelKeyOff to the value of the footer entry to remove from ** the page. */ v4 = iKeyOff1 @@ -211133,7 +207624,6 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } } else { if iStart == int32(4) { - _ = libc.Int32FromInt32(0) /* The entry being removed may be the only position list in ** its doclist. */ iPgno = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno - int32(1) @@ -211149,6 +207639,7 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { } goto _6 _6: + ; iPgno-- } if iPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { @@ -211224,7 +207715,6 @@ func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { if iPgIdx == nPg && nIdx > 0 && (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno != int32(1) { _fts5SecureDeleteIdxEntry(tls, p, iSegid, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno) } - _ = libc.Int32FromInt32(0) _fts5DataWrite(tls, p, int64(iSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(libc.Int32FromInt32(0))<= (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn+*(*int32)(unsafe.Pointer(bp + 160))+int32(1) { /* The entire doclist will fit on the current leaf. */ - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 160)))) *(*int32)(unsafe.Pointer(pBuf + 8)) += *(*int32)(unsafe.Pointer(bp + 160)) } else { @@ -211367,7 +207853,6 @@ func _fts5FlushOneHash(tls *libc.TLS, p uintptr) { if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && bTermWritten == 0 { _fts5WriteAppendTerm(tls, p, bp+16, *(*int32)(unsafe.Pointer(bp + 144)), *(*uintptr)(unsafe.Pointer(bp + 136))) bTermWritten = int32(1) - _ = libc.Int32FromInt32(0) } if (*(*TFts5SegWriter)(unsafe.Pointer(bp + 16))).FbFirstRowidInPage != 0 { _fts5PutU16(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp, uint16((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) /* first rowid on page */ @@ -211381,7 +207866,6 @@ func _fts5FlushOneHash(tls *libc.TLS, p uintptr) { if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { break } - _ = libc.Int32FromInt32(0) iPrev = iRowid if eDetail == int32(FTS5_DETAIL_NONE) { if iOff < *(*int32)(unsafe.Pointer(bp + 160)) && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == 0 { @@ -211415,7 +207899,6 @@ func _fts5FlushOneHash(tls *libc.TLS, p uintptr) { if (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn+nCopy <= pgsz { /* The entire poslist will fit on the current leaf. So copy ** it in one go. */ - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), *(*uintptr)(unsafe.Pointer(bp + 152))+uintptr(iOff), uint64(nCopy)) *(*int32)(unsafe.Pointer(pBuf + 8)) += nCopy } else { @@ -211432,8 +207915,6 @@ func _fts5FlushOneHash(tls *libc.TLS, p uintptr) { } else { n = _fts5PoslistPrefix(tls, pPoslist+uintptr(iPos), nSpace) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), pPoslist+uintptr(iPos), uint64(n)) *(*int32)(unsafe.Pointer(pBuf + 8)) += n iPos += n @@ -211451,13 +207932,11 @@ func _fts5FlushOneHash(tls *libc.TLS, p uintptr) { } /* TODO2: Doclist terminator written here. */ /* pBuf->p[pBuf->n++] = '\0'; */ - _ = libc.Int32FromInt32(0) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { _sqlite3Fts5HashScanNext(tls, pHash) } } _fts5WriteFinish(tls, p, bp+16, bp+8) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 8)) > 0 { /* Update the Fts5Structure. It is written back to the database by the ** fts5StructureRelease() call below. */ @@ -211503,7 +207982,6 @@ func _fts5IndexFlush(tls *libc.TLS, p uintptr) { return } if (*TFts5Index)(unsafe.Pointer(p)).FnPendingData != 0 || (*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete != 0 { - _ = libc.Int32FromInt32(0) _fts5FlushOneHash(tls, p) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { _sqlite3Fts5HashClear(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) @@ -211554,9 +208032,9 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint _fts5StructureRef(tls, pStruct) return pStruct } - _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) @@ -211593,10 +208071,12 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint iSegOut++ goto _4 _4: + ; iSeg++ } goto _3 _3: + ; iLvl-- } v5 = nSeg @@ -211619,17 +208099,13 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { var _ /* pNew at bp+0 */ uintptr _, _ = iLvl, pStruct *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - _ = libc.Int32FromInt32(0) _fts5IndexFlush(tls, p) - _ = libc.Int32FromInt32(0) pStruct = _fts5StructureRead(tls, p) - _ = libc.Int32FromInt32(0) _fts5StructureInvalidate(tls, p) if pStruct != 0 { *(*uintptr)(unsafe.Pointer(bp)) = _fts5IndexOptimizeStruct(tls, p, pStruct) } _fts5StructureRelease(tls, pStruct) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { iLvl = 0 for { @@ -211638,6 +208114,7 @@ func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iLvl++ } for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { @@ -211697,7 +208174,6 @@ func _fts5AppendPoslist(tls *libc.TLS, p uintptr, iDelta Tu64, pMulti uintptr, p _, _, _, _ = nByte, nData, v1, v2 nData = (*TFts5Iter)(unsafe.Pointer(pMulti)).Fbase.FnData nByte = nData + int32(9) + int32(9) + int32(FTS5_DATA_ZERO_PADDING) - _ = libc.Int32FromInt32(0) if v2 = (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK; v2 { if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)+uint32(nByte) <= uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) { v1 = 0 @@ -211707,10 +208183,7 @@ func _fts5AppendPoslist(tls *libc.TLS, p uintptr, iDelta Tu64, pMulti uintptr, p } if v2 && 0 == v1 { *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), iDelta) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(nData*libc.Int32FromInt32(2))) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), (*TFts5Iter)(unsafe.Pointer(pMulti)).Fbase.FpData, uint64(nData)) *(*int32)(unsafe.Pointer(pBuf + 8)) += nData libc.Xmemset(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), 0, uint64(FTS5_DATA_ZERO_PADDING)) @@ -211725,7 +208198,6 @@ func _fts5DoclistIterNext(tls *libc.TLS, pIter uintptr) { var _ /* nPos at bp+8 */ int32 _ = p p = (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist + uintptr((*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnSize) + uintptr((*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist) - _ = libc.Int32FromInt32(0) if p >= (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaEof { (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = uintptr(0) } else { @@ -211810,7 +208282,6 @@ func _fts5MergeRowidLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf p2 = aBuf _ = nBuf libc.Xmemset(tls, bp+24, 0, uint64(16)) - _ = libc.Int32FromInt32(0) _sqlite3Fts5BufferSize(tls, p+60, bp+24, uint32((*TFts5Buffer)(unsafe.Pointer(p1)).Fn+(*TFts5Buffer)(unsafe.Pointer(p2)).Fn)) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -211819,15 +208290,11 @@ func _fts5MergeRowidLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf _fts5NextRowid(tls, p2, bp+4, bp+16) for *(*int32)(unsafe.Pointer(bp)) >= 0 || *(*int32)(unsafe.Pointer(bp + 4)) >= 0 { if *(*int32)(unsafe.Pointer(bp)) >= 0 && (*(*int32)(unsafe.Pointer(bp + 4)) < 0 || *(*Ti64)(unsafe.Pointer(bp + 8)) < *(*Ti64)(unsafe.Pointer(bp + 16))) { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 24 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+24)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+24)).Fn), uint64(*(*Ti64)(unsafe.Pointer(bp + 8))-iOut)) - _ = libc.Int32FromInt32(0) iOut = *(*Ti64)(unsafe.Pointer(bp + 8)) _fts5NextRowid(tls, p1, bp, bp+8) } else { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 24 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+24)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+24)).Fn), uint64(*(*Ti64)(unsafe.Pointer(bp + 16))-iOut)) - _ = libc.Int32FromInt32(0) iOut = *(*Ti64)(unsafe.Pointer(bp + 16)) if *(*int32)(unsafe.Pointer(bp)) >= 0 && *(*Ti64)(unsafe.Pointer(bp + 8)) == *(*Ti64)(unsafe.Pointer(bp + 16)) { _fts5NextRowid(tls, p1, bp, bp+8) @@ -211911,7 +208378,6 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu /* Initialize a doclist-iterator for each input buffer. Arrange them in ** a linked-list starting at pHead in ascending order of rowid. Avoid ** linking any iterators already at EOF into the linked list at all. */ - _ = libc.Int32FromInt32(0) libc.Xmemset(tls, bp, 0, uint64(64)*uint64(nBuf+libc.Int32FromInt32(1))) *(*uintptr)(unsafe.Pointer(bp + 1024)) = bp + uintptr(nBuf)*64 _fts5DoclistIterInit(tls, p1, *(*uintptr)(unsafe.Pointer(bp + 1024))) @@ -211925,6 +208391,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -211947,9 +208414,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu return } for *(*uintptr)(unsafe.Pointer(bp + 1024)) != 0 { - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), uint64((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).Fiter.FiRowid)-uint64(iLastRowid)) - _ = libc.Int32FromInt32(0) iLastRowid = (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).Fiter.FiRowid if (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FpNext != 0 && iLastRowid == (*TPrefixMerger)(unsafe.Pointer((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FpNext)).Fiter.FiRowid { /* Merge data from two or more poslists */ @@ -212001,8 +208466,6 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } nTail = (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).Fiter.FnPoslist - (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FiOff /* WRITEPOSLISTSIZE */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*(*TFts5Buffer)(unsafe.Pointer(bp + 1048))).Fn+nTail > nTmp-int32(FTS5_DATA_ZERO_PADDING) { if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FaPos+uintptr((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FiOff), uint64(nTail)) *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += nTail } @@ -212032,13 +208492,13 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { /* Copy poslist from pHead to output */ pThis1 = *(*uintptr)(unsafe.Pointer(bp + 1024)) pI = pThis1 - _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), (*TFts5DoclistIter)(unsafe.Pointer(pI)).FaPoslist, uint64((*TFts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist+(*TFts5DoclistIter)(unsafe.Pointer(pI)).FnSize)) *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += (*TFts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist + (*TFts5DoclistIter)(unsafe.Pointer(pI)).FnSize _fts5DoclistIterNext(tls, pI) @@ -212076,7 +208536,6 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } aBuf = _fts5IdxMalloc(tls, p, int64(uint64(16)*uint64(nBuf))) pStruct = _fts5StructureRead(tls, p) - _ = libc.Int32FromInt32(0) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { flags = libc.Int32FromInt32(FTS5INDEX_QUERY_SCAN) | libc.Int32FromInt32(FTS5INDEX_QUERY_SKIPEMPTY) | libc.Int32FromInt32(FTS5INDEX_QUERY_NOOUTPUT) iLastRowid = 0 @@ -212106,6 +208565,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212121,7 +208581,6 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo nTerm = (*TFts5SegIter)(unsafe.Pointer(pSeg1)).Fterm.Fn pTerm = (*TFts5SegIter)(unsafe.Pointer(pSeg1)).Fterm.Fp (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxSetOutputs})))(tls, *(*uintptr)(unsafe.Pointer(bp)), pSeg1) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 24)) != 0 { if nTerm < nToken || libc.Xmemcmp(tls, pToken, pTerm, uint64(nToken)) != 0 { break @@ -212137,7 +208596,6 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo break } i1 = i * nMerge - _ = libc.Int32FromInt32(0) iStore = i1 for { if !(iStore < i1+nMerge) { @@ -212150,6 +208608,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -212162,11 +208621,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -212175,9 +208636,9 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } - _ = libc.Int32FromInt32(0) i = 0 for { if !(i < nBuf) { @@ -212194,10 +208655,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212225,7 +208688,6 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo // ** to the document with rowid iRowid. // */ func _sqlite3Fts5IndexBeginWrite(tls *libc.TLS, p uintptr, bDelete int32, iRowid Ti64) (r int32) { - _ = libc.Int32FromInt32(0) /* Allocate the hash table if it has not already been allocated */ if (*TFts5Index)(unsafe.Pointer(p)).FpHash == uintptr(0) { (*TFts5Index)(unsafe.Pointer(p)).Frc = _sqlite3Fts5HashNew(tls, (*TFts5Index)(unsafe.Pointer(p)).FpConfig, p+24, p+32) @@ -212248,7 +208710,6 @@ func _sqlite3Fts5IndexBeginWrite(tls *libc.TLS, p uintptr, bDelete int32, iRowid // ** Commit data to disk. // */ func _sqlite3Fts5IndexSync(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) _fts5IndexFlush(tls, p) _sqlite3Fts5IndexCloseReader(tls, p) return _fts5IndexReturn(tls, p) @@ -212287,7 +208748,7 @@ func _sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) (r int32) { if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FbContentlessDelete != 0 { (*(*TFts5Structure)(unsafe.Pointer(bp))).FnOriginCntr = uint64(1) } - _fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), __ccgo_ts+1648, 0) + _fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), __ccgo_ts+1652, 0) _fts5StructureWrite(tls, p, bp) return _fts5IndexReturn(tls, p) } @@ -212314,18 +208775,17 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36598, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36628, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25715, __ccgo_ts+36606, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25745, __ccgo_ts+36636, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11768, __ccgo_ts+36641, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11797, __ccgo_ts+36671, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) } } } - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) != 0 { _sqlite3Fts5IndexClose(tls, p) *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -212343,7 +208803,6 @@ func _sqlite3Fts5IndexClose(tls *libc.TLS, p uintptr) (r int32) { _ = rc rc = SQLITE_OK if p != 0 { - _ = libc.Int32FromInt32(0) _fts5StructureInvalidate(tls, p) Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpWriter) Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleter) @@ -212397,6 +208856,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -212444,8 +208904,6 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT _, _, _, _, _ = i, nByte, nChar, pConfig, rc /* Used to iterate through indexes */ rc = SQLITE_OK /* Return code */ pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Add the entry to the main terms index. */ rc = _sqlite3Fts5HashWrite(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8('0'), pToken, nToken) i = 0 @@ -212460,6 +208918,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -212561,7 +209020,6 @@ func _fts5AppendTokendataIter(tls *libc.TLS, p uintptr, pIn uintptr, pAppend uin *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer(pRet + 40 + uintptr(v2)*8)) = pAppend } - _ = libc.Int32FromInt32(0) return pRet } @@ -212582,6 +209040,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -212666,6 +209125,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -212705,6 +209165,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -212746,6 +209207,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -212779,9 +209241,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -212789,16 +209252,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -212847,7 +209313,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36685) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36715) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -212906,10 +209372,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -212935,6 +209403,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -212962,11 +209431,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -213006,7 +209477,6 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} /* If the QUERY_SCAN flag is set, all other flags must be clear. */ - _ = libc.Int32FromInt32(0) if _sqlite3Fts5BufferSize(tls, p+60, bp+8, uint32(nToken+int32(1))) == 0 { iIdx = 0 /* Index to search */ iPrefixIdx = 0 /* +1 prefix index */ @@ -213043,6 +209513,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -213063,9 +209534,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int bDesc = libc.BoolInt32(flags&int32(FTS5INDEX_QUERY_DESC) != 0) _fts5SetupPrefixIter(tls, p, bDesc, iPrefixIdx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, nToken+int32(1), pColset, bp) if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { - _ = libc.Int32FromInt32(0) } else { - _ = libc.Int32FromInt32(0) _fts5IterSetOutputCb(tls, p+60, *(*uintptr)(unsafe.Pointer(bp))) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { pSeg = *(*uintptr)(unsafe.Pointer(bp)) + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFirst + 1*4))).FiFirst)*128 @@ -213099,7 +209568,6 @@ func _sqlite3Fts5IterNext(tls *libc.TLS, pIndexIter uintptr) (r int32) { var pIter uintptr _ = pIter pIter = pIndexIter - _ = libc.Int32FromInt32(0) if (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter != 0 { _fts5TokendataIterNext(tls, pIter, 0, 0) } else { @@ -213118,7 +209586,6 @@ func _sqlite3Fts5IterNextScan(tls *libc.TLS, pIndexIter uintptr) (r int32) { _, _, _ = p, pIter, pSeg pIter = pIndexIter p = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex - _ = libc.Int32FromInt32(0) _fts5MultiIterNext(tls, p, pIter, 0, 0) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { pSeg = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128 @@ -213162,7 +209629,6 @@ func _sqlite3Fts5IterTerm(tls *libc.TLS, pIndexIter uintptr, pn uintptr) (r uint var _ /* n at bp+0 */ int32 _, _ = z, v1 z = _fts5MultiIterTerm(tls, pIndexIter, bp) - _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pn)) = *(*int32)(unsafe.Pointer(bp)) - int32(1) if z != 0 { v1 = z + 1 @@ -213254,8 +209720,6 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok pIter = pIndexIter pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter p = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -213267,6 +209731,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -213319,6 +209784,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -213333,7 +209799,6 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz // ** supplied as the second argument. // */ func _sqlite3Fts5IndexSetAverages(tls *libc.TLS, p uintptr, pData uintptr, nData int32) (r int32) { - _ = libc.Int32FromInt32(0) _fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), pData, nData) return _fts5IndexReturn(tls, p) } @@ -213367,9 +209832,8 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) _, _ = pConfig, rc /* Return code */ pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Binary representation of iNew */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - _ = libc.Int32FromInt32(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36140, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36170, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -213509,6 +209973,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -213562,6 +210027,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -213573,6 +210039,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -213632,7 +210099,6 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone == int32(1) { /* Case 2. */ nElem = int32(_fts5GetU32(tls, (*TFts5Data)(unsafe.Pointer(pData1)).Fp+4)) - _ = libc.Int32FromInt32(0) nOut = int32(1) if nElem*int32(4) > MINSLOT { v2 = nElem * int32(4) @@ -213657,7 +210123,6 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u szPage = 0 apOut = uintptr(0) /* Allocate space for the new hash table */ - _ = libc.Int32FromInt32(0) apOut = _sqlite3Fts5MallocZero(tls, p+60, int64(uint64(8)*uint64(nOut))) szPage = int32(8) + nSlot*szKey ii = 0 @@ -213673,6 +210138,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -213691,7 +210157,6 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } /* If control flows to here, it was not possible to rebuild the hash ** table. Free all buffers and then try again with more pages. */ - _ = libc.Int32FromInt32(0) _fts5IndexFreeArray(tls, apOut, nOut) nSlot = nSlotPerPage nOut = nOut*int32(2) + int32(1) @@ -213722,7 +210187,6 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) iPg = int32(iRowid % uint64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone)) pPg = _fts5DataRead(tls, p, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid+libc.Int32FromInt32(1)<= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -214197,6 +210667,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -214231,7 +210702,6 @@ func _sqlite3Fts5IndexInit(tls *libc.TLS, db uintptr) (r int32) { } func _sqlite3Fts5IndexReset(tls *libc.TLS, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) if _fts5IndexDataVersion(tls, p) != (*TFts5Index)(unsafe.Pointer(p)).FiStructVersion { _fts5StructureInvalidate(tls, p) } @@ -214614,7 +211084,6 @@ func _fts5InitVtab(tls *libc.TLS, bCreate int32, db uintptr, pAux uintptr, argc pTab = _sqlite3Fts5MallocZero(tls, bp, int64(72)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5ConfigParse(tls, pGlobal, db, argc, azConfig, bp+8, pzErr) - _ = libc.Int32FromInt32(0) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig = *(*uintptr)(unsafe.Pointer(bp + 8)) @@ -214634,7 +211103,6 @@ func _fts5InitVtab(tls *libc.TLS, bCreate int32, db uintptr, pAux uintptr, argc } /* Load the initial configuration */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - _ = libc.Int32FromInt32(0) (*TFts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpzErrmsg = pzErr *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexLoadConfig(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) _sqlite3Fts5IndexRollback(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -214687,8 +211155,6 @@ func _fts5SetUniqueFlag(tls *libc.TLS, pIdxInfo uintptr) { } func _fts5UsePatternMatch(tls *libc.TLS, pConfig uintptr, p uintptr) (r int32) { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern == int32(FTS5_PATTERN_GLOB) && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_GLOB) { return int32(1) } @@ -214779,13 +211245,8 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) bSeenLt = 0 bSeenMatch = 0 bSeenRank = 0 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36808, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -214807,7 +211268,6 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) /* As there exists an unusable MATCH constraint this is an ** unusable plan. Set a prohibitively high cost. */ (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(1e+50) - _ = libc.Int32FromInt32(0) *(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr))) = 0 return SQLITE_OK } else { @@ -214825,9 +211285,8 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5142, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) - _ = libc.Int32FromInt32(0) } } iCons++ @@ -214838,7 +211297,6 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } else { if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0 { if iCol >= 0 && iCol < nCol && _fts5UsePatternMatch(tls, pConfig, p) != 0 { - _ = libc.Int32FromInt32(0) v5 = iIdxStr iIdxStr++ if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_LIKE) { @@ -214847,12 +211305,11 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5142, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v7 - _ = libc.Int32FromInt32(0) } else { if bSeenEq == 0 && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) && iCol < 0 { v8 = iIdxStr @@ -214868,6 +211325,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -214907,6 +211365,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -214985,6 +211444,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -215082,6 +211542,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -215115,6 +211576,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -215156,6 +211618,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -215186,6 +211649,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -215210,7 +211674,6 @@ func _fts5CursorReseek(tls *libc.TLS, pCsr uintptr, pbSkip uintptr) (r int32) { var pTab uintptr _, _, _, _ = bDesc, iRowid, pTab, rc rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_REQUIRE_RESEEK) != 0 { pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab bDesc = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FbDesc @@ -215247,8 +211710,6 @@ func _fts5NextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { var _ /* bSkip at bp+0 */ int32 _, _, _, _ = pConfig, pCsr, rc, v1 pCsr = pCursor - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* If this cursor uses FTS5_PLAN_MATCH and this is a tokendata=1 table, ** clear any token mappings accumulated at the fts5_index.c level. In ** other cases, specifically FTS5_PLAN_SOURCE and FTS5_PLAN_SORTED_MATCH, @@ -215282,7 +211743,7 @@ func _fts5NextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_EOF) rc = Xsqlite3_reset(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -215309,7 +211770,7 @@ func _fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt } else { rc = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -215344,24 +211805,23 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14965 + v1 = __ccgo_ts + 14994 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } if zRankArgs != 0 { v2 = zRankArgs } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } if bDesc != 0 { - v3 = __ccgo_ts + 36817 + v3 = __ccgo_ts + 36847 } else { - v3 = __ccgo_ts + 36822 + v3 = __ccgo_ts + 36852 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36826, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36856, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr rc = _fts5SorterNext(tls, pCsr) (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = uintptr(0) @@ -215413,18 +211873,18 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } - _ = libc.Int32FromInt32(0) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36881, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36911, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5456, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5485, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36887, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36917, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -215451,6 +211911,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -215473,12 +211934,11 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36915, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36945, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) Xsqlite3_free(tls, zSql) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -215493,13 +211953,13 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = *(*uintptr)(unsafe.Pointer(bp + 8)) } else { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) - _ = libc.Int32FromInt32(0) } } } @@ -215507,8 +211967,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - _ = libc.Int32FromInt32(0) - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36925, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36955, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -215542,7 +212001,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36946, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36976, libc.VaList(bp+24, z)) } } } else { @@ -215550,7 +212009,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34878 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34908 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -215601,21 +212060,13 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36808, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { _fts5FreeCursorComponents(tls, pCsr) libc.Xmemset(tls, pCsr+32, 0, uint64(184)-uint64(int64(pCsr+32)-int64(pCsr))) } - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pTab + 16 /* Decode the arguments passed through to this function. */ i = 0 @@ -215631,7 +212082,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint case int32('M'): zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) if zText == uintptr(0) { - zText = __ccgo_ts + 1648 + zText = __ccgo_ts + 1652 } iCol = 0 for cond := true; cond; cond = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) <= int32('9') { @@ -215680,12 +212131,12 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint case int32('<'): pRowidLe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) default: - _ = libc.Int32FromInt32(0) pRowidGe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) break } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -215729,10 +212180,6 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint ** return results to the user for this query. The current cursor ** (pCursor) is used to execute the query issued by function ** fts5CursorFirstSorted() above. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FbDesc != 0 { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiFirstRowid (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiLastRowid @@ -215745,7 +212192,6 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint rc = _fts5CursorFirst(tls, pTab, pCsr, bDesc) } else { if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr != 0 { - _ = libc.Int32FromInt32(0) rc = _fts5CursorParseRank(tls, pConfig, pCsr, pRank) if rc == SQLITE_OK { if bOrderByRank != 0 { @@ -215758,7 +212204,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36979, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37009, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -215772,7 +212218,6 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint rc = _sqlite3Fts5StorageStmt(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, _fts5StmtType(tls, pCsr), pCsr+56, pTab+16) if rc == SQLITE_OK { if pRowidEq != uintptr(0) { - _ = libc.Int32FromInt32(0) Xsqlite3_bind_value(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), pRowidEq) } else { Xsqlite3_bind_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid) @@ -215784,6 +212229,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -215814,7 +212260,6 @@ func _fts5EofMethod(tls *libc.TLS, pCursor uintptr) (r int32) { // ** Return the rowid that the cursor currently points to. // */ func _fts5CursorRowid(tls *libc.TLS, pCsr uintptr) (r Ti64) { - _ = libc.Int32FromInt32(0) if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { return (*TFts5Sorter)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter)).FiRowid } else { @@ -215837,7 +212282,6 @@ func _fts5RowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) _, _ = ePlan, pCsr pCsr = pCursor ePlan = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan - _ = libc.Int32FromInt32(0) switch ePlan { case int32(FTS5_PLAN_SPECIAL): *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = 0 @@ -215880,12 +212324,9 @@ func _fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) (r int32) { v1 = uintptr(0) } rc = _sqlite3Fts5StorageStmt(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, eStmt, pCsr+56, v1) - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) } if rc == SQLITE_OK && (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_REQUIRE_CONTENT) != 0 { pTab1 = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab - _ = libc.Int32FromInt32(0) Xsqlite3_reset(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) Xsqlite3_bind_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), _fts5CursorRowid(tls, pCsr)) (*TFts5Config)(unsafe.Pointer((*TFts5Table)(unsafe.Pointer(pTab1)).FpConfig)).FbLock++ @@ -215900,7 +212341,7 @@ func _fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) (r int32) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< int32(1) { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20873 } else { - v1 = __ccgo_ts + 37257 + v1 = __ccgo_ts + 37287 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37269, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37299, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -216165,7 +212598,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35836, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -216334,6 +212767,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -216404,6 +212838,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -216419,6 +212854,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -216546,6 +212982,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -216564,6 +213001,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -216580,6 +213018,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -216617,6 +213056,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216656,6 +213096,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216698,7 +213139,6 @@ func _fts5ApiPhraseFirst(tls *libc.TLS, pCtx uintptr, iPhrase int32, pIter uintp pCsr = pCtx rc = _fts5CsrPoslist(tls, pCsr, iPhrase, pIter, bp) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { v1 = (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp))) } else { @@ -216769,7 +213209,6 @@ func _fts5ApiPhraseFirstColumn(tls *libc.TLS, pCtx uintptr, iPhrase int32, pIter rc = _sqlite3Fts5ExprPhraseCollist(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, iPhrase, pIter, bp) } if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { v2 = (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp))) } else { @@ -216782,7 +213221,6 @@ func _fts5ApiPhraseFirstColumn(tls *libc.TLS, pCtx uintptr, iPhrase int32, pIter } else { rc = _fts5CsrPoslist(tls, pCsr, iPhrase, pIter, bp+4) if rc == SQLITE_OK { - _ = libc.Int32FromInt32(0) if (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { v3 = (*TFts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp + 4))) } else { @@ -216913,6 +213351,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -216921,7 +213360,6 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } func _fts5ApiInvoke(tls *libc.TLS, pAux uintptr, pCsr uintptr, context uintptr, argc int32, argv uintptr) { - _ = libc.Int32FromInt32(0) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpAux = pAux (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Auxiliary)(unsafe.Pointer(pAux)).FxFunc})))(tls, uintptr(unsafe.Pointer(&_sFts5Api)), pCsr, context, argc, argv) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpAux = uintptr(0) @@ -216940,6 +213378,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -216951,12 +213390,11 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) var iCsrId Ti64 var pAux, pCsr, zErr uintptr _, _, _, _ = iCsrId, pAux, pCsr, zErr - _ = libc.Int32FromInt32(0) pAux = Xsqlite3_user_data(tls, context) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37336, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -217023,9 +213461,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -217033,10 +213473,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -217047,10 +213489,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -217061,6 +213505,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -217073,12 +213518,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -217100,7 +213548,6 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig pCsr = pCursor rc = SQLITE_OK - _ = libc.Int32FromInt32(0) if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == int32(FTS5_PLAN_SPECIAL) { if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { Xsqlite3_result_int64(tls, pCtx, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial) @@ -217138,7 +213585,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37327, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37357, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -217336,6 +213783,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -217378,9 +213826,8 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr } pMod = _fts5LocateTokenizer(tls, pGlobal, v1) if pMod == uintptr(0) { - _ = libc.Int32FromInt32(0) rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37428, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -217396,7 +213843,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37420, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37450, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -217425,6 +213872,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -217439,6 +213887,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -217449,8 +213898,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg - _ = libc.Int32FromInt32(0) - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37451) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37481) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -217462,10 +213910,9 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { // ** Implementation of fts5_source_id() function. // */ func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { - _ = libc.Int32FromInt32(0) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37464, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37494, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -217487,17 +213934,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37555, - 1: __ccgo_ts + 35067, - 2: __ccgo_ts + 25715, - 3: __ccgo_ts + 35634, - 4: __ccgo_ts + 11768, + 0: __ccgo_ts + 37585, + 1: __ccgo_ts + 35097, + 2: __ccgo_ts + 25745, + 3: __ccgo_ts + 35664, + 4: __ccgo_ts + 11797, } // C documentation @@ -217514,14 +213962,13 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam var rc int32 _, _ = pTab, rc pTab = pVtab - _ = libc.Int32FromInt32(0) _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37562, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37592, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37608, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37638, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -217544,7 +213991,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37671, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37701, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -217561,10 +214008,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37671, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37701, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37676, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37706, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -217665,21 +214112,19 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, rc = SQLITE_OK /* If there is no %_docsize table, there should be no requests for ** statements to operate on it. */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37691, - 1: __ccgo_ts + 37759, - 2: __ccgo_ts + 37828, - 3: __ccgo_ts + 37861, - 4: __ccgo_ts + 37900, - 5: __ccgo_ts + 37940, - 6: __ccgo_ts + 37979, - 7: __ccgo_ts + 38022, - 8: __ccgo_ts + 38061, - 9: __ccgo_ts + 38105, - 10: __ccgo_ts + 38145, + 0: __ccgo_ts + 37721, + 1: __ccgo_ts + 37789, + 2: __ccgo_ts + 37858, + 3: __ccgo_ts + 37891, + 4: __ccgo_ts + 37930, + 5: __ccgo_ts + 37970, + 6: __ccgo_ts + 38009, + 7: __ccgo_ts + 38052, + 8: __ccgo_ts + 38091, + 9: __ccgo_ts + 38135, + 10: __ccgo_ts + 38175, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -217707,6 +214152,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = int8(',') goto _1 _1: + ; i++ } *(*int8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = int8('\000') @@ -217715,16 +214161,16 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38168 + v2 = __ccgo_ts + 38198 } else { - v2 = __ccgo_ts + 1648 + v2 = __ccgo_ts + 1652 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38171 + v3 = __ccgo_ts + 38201 } else { - v3 = __ccgo_ts + 1648 + v3 = __ccgo_ts + 1652 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, v3, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName)) default: @@ -217743,7 +214189,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, (*TFts5Config)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if rc != SQLITE_OK && pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3799, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -217780,12 +214226,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38179, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38209, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38283, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38313, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38321, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38351, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -217794,7 +214240,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38359, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38389, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -217806,14 +214252,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25715, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11768, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37555, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25745, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11797, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37585, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35634, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35664, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35067, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35097, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -217833,13 +214279,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30355 + v1 = __ccgo_ts + 30385 } else { - v1 = __ccgo_ts + 1648 + v1 = __ccgo_ts + 1652 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38401, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38431, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38431, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38461, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -217880,35 +214326,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38475, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38505, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38498, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38528, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35067, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35097, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38504 + zCols = __ccgo_ts + 38534 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38536 + zCols = __ccgo_ts + 38566 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35634, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35664, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37555, __ccgo_ts+38584, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37585, __ccgo_ts+38614, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35836, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -217937,6 +214384,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -218017,8 +214465,6 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint break } if int32(*(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr(iCol-int32(1))))) == 0 { - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { zText = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) nText = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) @@ -218039,6 +214485,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -218071,8 +214518,6 @@ func _fts5StorageContentlessDelete(tls *libc.TLS, p uintptr, iDel Ti64) (r int32 iOrigin = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) rc = SQLITE_OK - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) /* Look up the origin of the document in the %_docsize table. Store ** this in stack variable iOrigin. */ rc = _fts5StorageGetStmt(tls, p, int32(FTS5_STMT_LOOKUP_DOCSIZE), bp, uintptr(0)) @@ -218179,6 +214624,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -218202,7 +214648,6 @@ func _sqlite3Fts5StorageDelete(tls *libc.TLS, p uintptr, iDel Ti64, apVal uintpt _, _ = pConfig, rc pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - _ = libc.Int32FromInt32(0) rc = _fts5StorageLoadTotals(tls, p, int32(1)) /* Delete the index records */ if rc == SQLITE_OK { @@ -218252,9 +214697,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38601, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38631, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38651, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38681, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -218262,7 +214707,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35836, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -218309,6 +214754,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218406,6 +214852,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -218454,6 +214901,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218473,7 +214921,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38680, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38710, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -218548,7 +214996,6 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 iPos = (*TFts5IntegrityCtx)(unsafe.Pointer(pCtx)).FiCol iCol = 0 default: - _ = libc.Int32FromInt32(0) iPos = 0 iCol = 0 break @@ -218572,6 +215019,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -218648,6 +215096,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -218674,6 +215123,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -218681,14 +215131,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35067, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35097, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -219590,15 +216047,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -219660,7 +216122,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38772 + zBase = __ccgo_ts + 38802 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -219751,6 +216213,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -219766,6 +216229,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -219821,10 +216285,10 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { break } bCons = libc.BoolInt32(!(_fts5PorterIsVowel(tls, *(*int8)(unsafe.Pointer(zStem + uintptr(i))), bCons) != 0)) - _ = libc.Int32FromInt32(0) mask = mask< 1 and (*S or *T)) */ func _fts5Porter_MGt1_and_S_or_T(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { - _ = libc.Int32FromInt32(0) return libc.BoolInt32((int32(*(*int8)(unsafe.Pointer(zStem + uintptr(nStem-int32(1))))) == int32('s') || int32(*(*int8)(unsafe.Pointer(zStem + uintptr(nStem-int32(1))))) == int32('t')) && _fts5Porter_MGt1(tls, zStem, nStem) != 0) } @@ -219856,6 +216319,7 @@ func _fts5Porter_Vowel(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -219873,64 +216337,64 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38782, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38812, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38785, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38815, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38790, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38820, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38795, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38825, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38798, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38828, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38801, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38831, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38806, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38836, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38815, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38845, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38851, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38856, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219939,49 +216403,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38830, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38860, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38864, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38867, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38845, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38875, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38879, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38853, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38883, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38857, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38887, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219998,20 +216462,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38861, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38841, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38891, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38871, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38864, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38894, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38897, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38857, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38901, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38887, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -220027,75 +216491,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38874, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38904, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38871, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38882, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38912, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38889, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38919, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38894, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38924, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38790, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38820, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38929, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38785, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38815, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38904, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38934, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38857, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38887, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38909, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38939, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15873, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15911, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38914, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38944, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38867, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38897, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38918, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38948, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38812, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38923, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38953, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38856, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38929, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38959, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38933, uint64(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38963, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38965, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38849, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38879, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -220104,48 +216568,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38941, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38971, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38857, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38887, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38979, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38871, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38985, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38871, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38960, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38990, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38812, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38966, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38996, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38853, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38883, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38974, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39004, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38982, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39012, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39016, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38849, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38879, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -220153,21 +216617,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39024, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38812, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39030, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38853, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38883, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39006, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39036, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38867, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38897, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -220185,48 +216649,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39013, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39043, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38828, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39018, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39048, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39023, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39053, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38828, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39029, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39059, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38828, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38982, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39012, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39035, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39065, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39071, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38812, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -220242,13 +216706,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39047, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39077, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39051, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39081, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39054, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39084, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -220256,7 +216720,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39087, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -220331,7 +216795,6 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT _fts5PorterStep3(tls, aBuf, bp) _fts5PorterStep4(tls, aBuf, bp) /* Step 5a. */ - _ = libc.Int32FromInt32(0) if int32(*(*int8)(unsafe.Pointer(aBuf + uintptr(*(*int32)(unsafe.Pointer(bp))-int32(1))))) == int32('e') { if _fts5Porter_MGt1(tls, aBuf, *(*int32)(unsafe.Pointer(bp))-int32(1)) != 0 || _fts5Porter_MEq1(tls, aBuf, *(*int32)(unsafe.Pointer(bp))-int32(1)) != 0 && !(_fts5Porter_Ostar(tls, aBuf, *(*int32)(unsafe.Pointer(bp))-int32(1)) != 0) { *(*int32)(unsafe.Pointer(bp))-- @@ -220343,6 +216806,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -220416,14 +216880,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39061) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39091) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38754) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38784) { if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('2') || *(*int8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -220440,6 +216904,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -220544,6 +217009,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -220553,7 +217019,6 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int ** aStart[3]: Contains the byte offset in the input text corresponding ** to the start of each of the three characters in the buffer. */ - _ = libc.Int32FromInt32(0) for int32(1) != 0 { /* Read characters from the input up until the first non-diacritic */ for cond := true; cond; cond = iCode == uint32(0) { @@ -220696,7 +217161,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38772, + FzName: __ccgo_ts + 38802, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -220704,7 +217169,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39076, + FzName: __ccgo_ts + 39106, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -220712,7 +217177,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39082, + FzName: __ccgo_ts + 39112, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -220720,7 +217185,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39089, + FzName: __ccgo_ts + 39119, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -220740,6 +217205,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -221039,7 +217505,6 @@ func _fts5_remove_diacritic(tls *libc.TLS, c int32, bComplex int32) (r int32) { iHi = iTest - int32(1) } } - _ = libc.Int32FromInt32(0) if bComplex == 0 && int32(aChar[iRes])&int32(0x80) != 0 { return c } @@ -221089,7 +217554,6 @@ func _sqlite3Fts5UnicodeFold(tls *libc.TLS, c int32, eRemoveDiacritic int32) (r var p uintptr _, _, _, _, _, _, _ = cmp, iHi, iLo, iRes, iTest, p, ret ret = c - _ = libc.Int32FromInt32(0) if c < int32(128) { if c >= int32('A') && c <= int32('Z') { ret = c + (libc.Int32FromUint8('a') - libc.Int32FromUint8('A')) @@ -221099,7 +217563,6 @@ func _sqlite3Fts5UnicodeFold(tls *libc.TLS, c int32, eRemoveDiacritic int32) (r iHi = int32(libc.Uint64FromInt64(652)/libc.Uint64FromInt64(4) - libc.Uint64FromInt32(1)) iLo = 0 iRes = -int32(1) - _ = libc.Int32FromInt32(0) for iHi >= iLo { iTest = (iHi + iLo) / int32(2) cmp = c - int32(_aEntry[iTest].FiCode) @@ -221110,7 +217573,6 @@ func _sqlite3Fts5UnicodeFold(tls *libc.TLS, c int32, eRemoveDiacritic int32) (r iHi = iTest - int32(1) } } - _ = libc.Int32FromInt32(0) p = uintptr(unsafe.Pointer(&_aEntry)) + uintptr(iRes)*4 if c < int32((*struct { FiCode uint16 @@ -221134,7 +217596,6 @@ func _sqlite3Fts5UnicodeFold(tls *libc.TLS, c int32, eRemoveDiacritic int32) (r Fflags uint8 FnRange uint8 })(unsafe.Pointer(p)).Fflags)>>int32(1)])) & int32(0x0000FFFF) - _ = libc.Int32FromInt32(0) } if eRemoveDiacritic != 0 { ret = _fts5_remove_diacritic(tls, ret, libc.BoolInt32(eRemoveDiacritic == int32(2))) @@ -225749,7 +222210,6 @@ func _sqlite3Fts5UnicodeCategory(tls *libc.TLS, iCode Tu32) (r int32) { iKey = uint16(iCode & libc.Uint32FromInt32(0xFFFF)) for iHi > iLo { iTest = (iHi + iLo) / int32(2) - _ = libc.Int32FromInt32(0) if int32(iKey) >= int32(_aFts5UnicodeMap[iTest]) { iRes = iTest iLo = iTest + int32(1) @@ -225790,6 +222250,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -225872,7 +222333,6 @@ func _sqlite3Fts5GetVarint32(tls *libc.TLS, p uintptr, v uintptr) (r int32) { p -= uintptr(2) n = _sqlite3Fts5GetVarint(tls, p, bp) *(*Tu32)(unsafe.Pointer(v)) = uint32(*(*Tu64)(unsafe.Pointer(bp))) & uint32(0x7FFFFFFF) - _ = libc.Int32FromInt32(0) return int32(n) return r } @@ -225913,8 +222373,6 @@ func _sqlite3Fts5GetVarint(tls *libc.TLS, p uintptr, v uintptr) (r Tu8) { return uint8(2) } /* Verify that constants are precomputed correctly */ - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) p++ a = a << int32(14) a |= uint32(*(*uint8)(unsafe.Pointer(p))) @@ -226079,6 +222537,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -226092,7 +222551,6 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { } p3 = bp *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & libc.Int32FromInt32(0x7f)) - _ = libc.Int32FromInt32(0) i = 0 j = n - libc.Int32FromInt32(1) for { @@ -226102,6 +222560,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -226122,7 +222581,6 @@ func _sqlite3Fts5PutVarint(tls *libc.TLS, p uintptr, v Tu64) (r int32) { } func _sqlite3Fts5GetVarintLen(tls *libc.TLS, iVal Tu32) (r int32) { - _ = libc.Int32FromInt32(0) if iVal < uint32(libc.Int32FromInt32(1)<= 0 { @@ -226517,15 +222975,14 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39299, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39329, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39330, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39360, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } Xsqlite3_free(tls, zSql) - _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK } @@ -226540,7 +222997,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39381, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39411, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -226631,8 +223088,6 @@ func _fts5VocabInstanceNext(tls *libc.TLS, pCsr uintptr) (r int32) { pIter = (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter pp = pCsr + 112 po = pCsr + 120 - _ = libc.Int32FromInt32(0) - _ = libc.Int32FromInt32(0) for eDetail == int32(FTS5_DETAIL_NONE) || _sqlite3Fts5PoslistNext64(tls, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FpData, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData, po, pp) != 0 { (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstPos = 0 (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstOff = 0 @@ -226688,6 +223143,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -226696,7 +223152,6 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = int32(1) } else { zTerm = _sqlite3Fts5IterTerm(tls, (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter, bp+4) - _ = libc.Int32FromInt32(0) if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm >= 0 { if *(*int32)(unsafe.Pointer(bp + 4)) < (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm { v2 = *(*int32)(unsafe.Pointer(bp + 4)) @@ -226714,7 +223169,6 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { libc.Xmemset(tls, (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt, 0, uint64(nCol)*uint64(8)) libc.Xmemset(tls, (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc, 0, uint64(nCol)*uint64(8)) (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol = 0 - _ = libc.Int32FromInt32(0) for *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { eDetail = (*TFts5Config)(unsafe.Pointer((*TFts5Table)(unsafe.Pointer((*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FeDetail /* Position list */ *(*Ti64)(unsafe.Pointer(bp + 8)) = 0 /* 64-bit position read from poslist */ @@ -226747,7 +223201,6 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } else { if eDetail == int32(FTS5_DETAIL_COLUMNS) { for 0 == _sqlite3Fts5PoslistNext64(tls, pPos, nPos, bp+16, bp+8) { - _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(bp + 8)) >= int64(nCol) { *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_PTHREADS\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go index fa7ff07a..7abae779 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated for linux/arm by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for linux/arm by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build linux && arm // +build linux,arm @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -445,7 +447,6 @@ const FLAG_SIGNED = 1 const FLAG_STRING = 4 const FNDELAY = 2048 const FNONBLOCK = 2048 -const FOPEN_MAX = 16 const FP_ILOGB0 = -2147483647 const FP_ILOGBNAN = 2147483647 const FP_INFINITE = 1 @@ -968,6 +969,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NFDBITS = "__NFDBITS" const NN = 1 @@ -1696,6 +1698,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2150,10 +2153,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2228,7 +2228,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2336,8 +2336,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2795,6 +2795,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2932,7 +2933,6 @@ const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 const _ALLOCA_H = 1 const _ASSERT_H = 1 -const _ATFILE_SOURCE = 1 const _BITS_BYTESWAP_H = 1 const _BITS_ENDIANNESS_H = 1 const _BITS_ENDIAN_H = 1 @@ -2956,9 +2956,7 @@ const _BITS_UINTN_IDENTITY_H = 1 const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 0 -const _DEFAULT_SOURCE = 1 const _DLFCN_H = 1 -const _DYNAMIC_STACK_SIZE_SOURCE = 1 const _ENDIAN_H = 1 const _ERRNO_H = 1 const _FCNTL_H = 1 @@ -2987,12 +2985,6 @@ const _IONBF = 2 const _IO_EOF_SEEN = 16 const _IO_ERR_SEEN = 32 const _IO_USER_LOCK = 32768 -const _ISOC11_SOURCE = 1 -const _ISOC2X_SOURCE = 1 -const _ISOC95_SOURCE = 1 -const _ISOC99_SOURCE = 1 -const _LARGEFILE64_SOURCE = 1 -const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 const _LFS64_ASYNCHRONOUS_IO = 1 const _LFS64_LARGEFILE = 1 @@ -3014,7 +3006,6 @@ const _POSIX_BARRIERS = 200809 const _POSIX_CHOWN_RESTRICTED = 0 const _POSIX_CLOCK_SELECTION = 200809 const _POSIX_CPUTIME = 0 -const _POSIX_C_SOURCE = 200809 const _POSIX_FSYNC = 200809 const _POSIX_IPV6 = 200809 const _POSIX_JOB_CONTROL = 1 @@ -3036,7 +3027,6 @@ const _POSIX_SAVED_IDS = 1 const _POSIX_SEMAPHORES = 200809 const _POSIX_SHARED_MEMORY_OBJECTS = 200809 const _POSIX_SHELL = 1 -const _POSIX_SOURCE = 1 const _POSIX_SPAWN = 200809 const _POSIX_SPIN_LOCKS = 200809 const _POSIX_SPORADIC_SERVER = -1 @@ -3099,8 +3089,6 @@ const _XOPEN_LEGACY = 1 const _XOPEN_REALTIME = 1 const _XOPEN_REALTIME_THREADS = 1 const _XOPEN_SHM = 1 -const _XOPEN_SOURCE = 700 -const _XOPEN_SOURCE_EXTENDED = 1 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 const _XOPEN_XCU_VERSION = 4 @@ -3285,16 +3273,6 @@ const __GCC_IEC_559_COMPLEX = 2 const __GID_T_TYPE = "__U32_TYPE" const __GLIBC_FLT_EVAL_METHOD = 0 const __GLIBC_MINOR__ = 36 -const __GLIBC_USE_DEPRECATED_GETS = 0 -const __GLIBC_USE_DEPRECATED_SCANF = 0 -const __GLIBC_USE_IEC_60559_BFP_EXT = 1 -const __GLIBC_USE_IEC_60559_BFP_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_TYPES_EXT = 1 -const __GLIBC_USE_ISOC2X = 1 -const __GLIBC_USE_LIB_EXT2 = 1 const __GLIBC__ = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" const __GNUC_MINOR__ = 2 @@ -3302,7 +3280,6 @@ const __GNUC_PATCHLEVEL__ = 0 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 12 -const __GNU_LIBRARY__ = 6 const __GXX_ABI_VERSION = 1017 const __GXX_TYPEINFO_EQUALITY_INLINE = 0 const __HAVE_DISTINCT_FLOAT128 = 0 @@ -3597,28 +3574,6 @@ const __USACCUM_MIN__ = 0 const __USA_FBIT__ = 16 const __USA_IBIT__ = 16 const __USECONDS_T_TYPE = "__U32_TYPE" -const __USE_ATFILE = 1 -const __USE_DYNAMIC_STACK_SIZE = 1 -const __USE_FILE_OFFSET64 = 1 -const __USE_FORTIFY_LEVEL = 0 -const __USE_GNU = 1 -const __USE_ISOC11 = 1 -const __USE_ISOC95 = 1 -const __USE_ISOC99 = 1 -const __USE_LARGEFILE = 1 -const __USE_LARGEFILE64 = 1 -const __USE_MISC = 1 -const __USE_POSIX = 1 -const __USE_POSIX199309 = 1 -const __USE_POSIX199506 = 1 -const __USE_POSIX2 = 1 -const __USE_UNIX98 = 1 -const __USE_XOPEN = 1 -const __USE_XOPEN2K = 1 -const __USE_XOPEN2K8 = 1 -const __USE_XOPEN2K8XSI = 1 -const __USE_XOPEN2KXSI = 1 -const __USE_XOPEN_EXTENDED = 1 const __USFRACT_EPSILON__ = 0 const __USFRACT_FBIT__ = 8 const __USFRACT_IBIT__ = 0 @@ -3750,7 +3705,6 @@ const sqlite3ParserCTX_PDECL = 0 const sqlite3ParserTOKENTYPE = 0 const sqlite3Parser_ENGINEALWAYSONSTACK = 1 const sqlite3StrNICmp = 0 -const static_assert = 0 const threadid = 0 const tkCREATE = 4 const tkEND = 7 @@ -8942,6 +8896,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -10537,6 +10492,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -11252,6 +11211,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -13825,7 +13785,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint32FromInt64(40)/libc.Uint32FromInt64(4)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13974,6 +13934,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13986,7 +13947,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -14012,6 +13973,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -14022,11 +13984,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -14041,7 +14005,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 _ = libc.Int32FromInt32(0) @@ -14054,6 +14018,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -14089,6 +14054,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -14291,6 +14257,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -14358,6 +14325,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zDate))])&int32(0x01) != 0 { zDate++ } @@ -15041,6 +15009,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -15058,6 +15027,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1269, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -15168,6 +15144,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -15281,7 +15258,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) @@ -15295,7 +15272,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = uint8(0) *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) @@ -15311,6 +15288,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -15364,6 +15342,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -15631,7 +15610,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint32(1) cf = *(*uint8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -15657,7 +15636,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -15673,9 +15652,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+128, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 72)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 72))).FvalidJD = uint8(0) (*(*TDateTime)(unsafe.Pointer(bp + 72))).FM = int32(1) @@ -15694,7 +15673,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -15725,7 +15704,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+128, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1409, libc.VaList(bp+128, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = uint8(int32(uint8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -15743,6 +15722,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -16361,6 +16341,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -18148,6 +18129,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -18709,6 +18691,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -18734,6 +18717,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -18795,11 +18779,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(1) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -18908,6 +18896,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -18929,14 +18918,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int32(bufpt) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -18952,6 +18945,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -19084,6 +19080,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -19105,6 +19102,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v70)) = uint8('0') goto _69 _69: + ; precision-- e2++ } @@ -19193,6 +19191,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*uint8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -19210,6 +19209,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -19218,11 +19218,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]uint8)(unsafe.Pointer(bp)))[0] = uint8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -19299,7 +19301,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -19354,6 +19358,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -19361,6 +19366,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -19373,9 +19379,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -19423,6 +19432,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -19462,6 +19472,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -19473,6 +19484,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19497,6 +19509,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19530,9 +19543,11 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; _ = libc.Int32FromInt32(0) return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -19559,6 +19574,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -20433,6 +20449,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -20443,6 +20460,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -21120,6 +21138,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -21417,6 +21436,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint32(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -22282,6 +22323,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*uint8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*uint8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -22334,6 +22376,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -22369,6 +22412,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -22824,6 +22872,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -22884,6 +22933,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -22907,6 +22957,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -23133,6 +23184,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } return i @@ -23195,6 +23247,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*uint8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = uint8(int32(_sqlite3HexToInt(tls, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -26863,6 +26925,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -26880,7 +26943,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3510, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3510, bp, int32(41778)) } // C documentation @@ -26919,7 +26982,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -27540,7 +27605,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*4)) } else { @@ -27994,6 +28063,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -28011,6 +28081,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -28071,6 +28142,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 4 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -28165,7 +28237,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -28544,7 +28616,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -28564,7 +28636,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -28720,6 +28792,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -28990,7 +29063,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3393, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3393, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -29043,6 +29116,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags _ = libc.Int32FromInt32(0) rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -29067,7 +29141,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+104, libc.Uint32FromInt64(4098)-libc.Uint32FromInt32(2)) if got <= 0 || got >= libc.Int32FromInt64(4098)-libc.Int32FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3582, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3582, zIn, int32(44691)) return } (*(*[4098]uint8)(unsafe.Pointer(bp + 104)))[got] = uint8(0) @@ -29238,6 +29312,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*uint8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -29270,14 +29345,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*uint8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+20, libc.Uint32FromInt64(4098)-libc.Uint32FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3411, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3411, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+20) } _appendAllPathElements(tls, bp, zPath) *(*uint8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = uint8(0) if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= (libc.Uint32FromInt32(BITVEC_SZ)-libc.Uint32FromInt32(3)*libc.Uint32FromInt64(4))/libc.Uint32FromInt64(4)*libc.Uint32FromInt64(4)/libc.Uint32FromInt64(4)/libc.Uint32FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(500)) if aiValues == uintptr(0) { @@ -31146,6 +31235,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -31153,6 +31243,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 12 + uintptr(h)*4)) = i return SQLITE_OK @@ -31210,6 +31301,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -31235,6 +31327,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 12 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -31378,10 +31471,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -31757,6 +31852,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -31768,6 +31864,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -31974,6 +32071,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31996,6 +32094,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -32061,6 +32160,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -32170,6 +32270,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -32196,6 +32297,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -32217,6 +32319,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -32328,6 +32431,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -32744,6 +32848,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -33012,6 +33117,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -33069,6 +33175,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -33921,6 +34028,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -34080,6 +34188,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -34102,6 +34211,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -34210,6 +34320,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -34304,6 +34415,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -34345,6 +34457,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -35255,12 +35368,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*48))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -35473,6 +35588,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -35624,6 +35740,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -35700,6 +35817,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 80)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -35870,6 +35988,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -35961,6 +36080,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*48))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -35996,6 +36116,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -36787,6 +36908,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -37115,12 +37237,14 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ _ = libc.Int32FromInt32(0) end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -37162,7 +37286,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 28 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -41481,7 +41620,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4084, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4109, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -42905,6 +43044,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -42962,10 +43102,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -43053,7 +43194,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -43119,6 +43260,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*4)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -43144,11 +43286,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 52 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 52 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -43182,6 +43326,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -43190,10 +43335,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -47922,7 +48100,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -47935,12 +48113,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } _ = libc.Int32FromInt32(0) @@ -47955,6 +48133,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -47984,7 +48163,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -47994,7 +48173,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -48433,7 +48612,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint32(pCell) < uint32((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint32(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint32((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -48479,12 +48658,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -48492,21 +48671,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint32(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -48529,6 +48708,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -48553,13 +48733,13 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } _ = libc.Int32FromInt32(0) size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48567,14 +48747,16 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint32(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; _ = libc.Int32FromInt32(0) if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48637,7 +48819,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -48654,14 +48836,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -48712,11 +48894,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -48731,7 +48913,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -48824,12 +49006,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } _ = libc.Int32FromInt32(0) /* At this point: @@ -48841,11 +49023,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -48866,7 +49048,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -48883,10 +49065,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -48949,7 +49131,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -48975,7 +49157,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -49022,12 +49204,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -49054,7 +49236,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -49085,14 +49267,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))) if pc < iCellFirst || pc > iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -49124,7 +49307,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) @@ -49138,7 +49321,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -49304,7 +49487,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -49381,7 +49564,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -49473,7 +49656,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4165) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4190) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -49555,6 +49738,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -49563,6 +49747,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -49701,11 +49886,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -50289,7 +50476,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4174, uint32(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4199, uint32(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -50328,7 +50515,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 4)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 4)) @@ -50384,6 +50571,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -50561,6 +50749,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -50666,6 +50855,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -50747,6 +50937,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -50784,7 +50975,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -50808,7 +50999,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -50817,7 +51008,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -50826,11 +51017,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -50863,7 +51055,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -50961,7 +51153,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -51000,7 +51192,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) if *(*TPgno)(unsafe.Pointer(bp + 16)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 20))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } _ = libc.Int32FromInt32(0) @@ -51069,7 +51261,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -51115,7 +51307,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -51130,6 +51322,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -51144,7 +51337,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -51157,6 +51350,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -51402,6 +51596,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -51640,7 +51835,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo _ = libc.Int32FromInt32(0) if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { _ = libc.Int32FromInt32(0) @@ -51670,6 +51865,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -52053,7 +52249,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) @@ -52066,7 +52262,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -52119,7 +52315,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } _ = libc.Int32FromInt32(0) *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) @@ -52196,7 +52392,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -52349,7 +52545,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -52362,7 +52558,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 68 @@ -52492,9 +52688,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** (or the freelist). */ _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -52504,7 +52701,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -52768,7 +52965,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -52817,6 +53014,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -52831,6 +53029,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -52907,6 +53106,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -52979,7 +53179,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -52995,6 +53195,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -53049,7 +53250,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -53082,7 +53283,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -53119,7 +53320,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 72 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 120 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*4)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -53128,7 +53329,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+116, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 68 @@ -53143,6 +53344,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -53196,6 +53398,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 120 + uintptr(i)*4)))).FnCell) goto _1 _1: + ; i++ } return n @@ -53259,7 +53462,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53374,7 +53577,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -53468,7 +53671,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -53525,7 +53728,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -53554,7 +53757,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53581,7 +53784,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+8, 0) @@ -53627,6 +53830,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -53643,6 +53847,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -53651,7 +53856,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53755,6 +53960,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } _ = libc.Int32FromInt32(0) end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) _ = libc.Int32FromInt32(0) @@ -53795,7 +54001,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 4)) = pMemPage @@ -53846,7 +54052,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 8)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -53856,7 +54062,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) _ = libc.Int32FromInt32(0) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -53912,6 +54118,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FisInit = uint8(0) } @@ -53946,7 +54153,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _ = libc.Int32FromInt32(0) if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -53966,7 +54173,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+4, bp) @@ -53989,7 +54196,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 4)), ovflPgno) } @@ -54077,6 +54284,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n _ = libc.Int32FromInt32(0) @@ -54224,7 +54432,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -54648,6 +54856,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 16 + uintptr(k)*4)) @@ -54658,12 +54867,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg _ = libc.Int32FromInt32(0) if uint32(pCell) >= uint32(aData+uintptr(j)) && uint32(pCell) < uint32(pEnd) { if uint32(pCell+uintptr(sz)) > uint32(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int32(pCell)-int32(aData)) } else { if uint32(pCell+uintptr(sz)) > uint32(pSrcEnd) && uint32(pCell) < uint32(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -54671,7 +54880,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int32(pData) - int32(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint32(sz)) _ = libc.Int32FromInt32(0) @@ -54746,6 +54955,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 16 + uintptr(k)*4)) @@ -54769,7 +54979,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr _ = libc.Int32FromInt32(0) if uint32(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4))+uintptr(sz)) > uint32(pEnd) && uint32(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4))) < uint32(pEnd) { _ = libc.Int32FromInt32(0) - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*4)), uint32(sz)) @@ -54841,6 +55051,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -54853,6 +55064,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -54868,6 +55080,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -54878,6 +55091,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -54915,7 +55129,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint32(nCell*int32(2))) nCell -= nShift @@ -54969,6 +55183,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -54985,9 +55200,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -55035,7 +55251,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -55411,7 +55627,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -55434,7 +55650,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 68))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell)*2, 0, uint32(2)*uint32(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -55448,6 +55664,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -55460,6 +55677,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 68))).FnCell++ goto _4 _4: + ; k++ } } @@ -55507,6 +55725,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -55554,11 +55773,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 36 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 36 + uintptr(j)*4)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -55572,7 +55793,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 36)))[k-int32(1)] = 0 @@ -55615,12 +55836,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -55675,11 +55897,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -55707,7 +55930,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -55737,6 +55960,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -55761,6 +55985,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _19 _19: + ; i++ } i = 0 @@ -55779,6 +56004,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -55800,6 +56026,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _ = libc.Int32FromInt32(0) @@ -55886,6 +56113,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -55940,11 +56168,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 68 + 16 + uintptr(k)*4)) if uint32(pCell1) < uint32(pSrcEnd) && uint32(pCell1+uintptr(sz2)) > uint32(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -55954,6 +56183,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -56028,6 +56258,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -56069,6 +56300,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 16)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -56084,12 +56316,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 68))).FapCell) i = 0 for { @@ -56099,6 +56333,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 4)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -56109,6 +56344,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 16)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -56201,10 +56437,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -56275,7 +56512,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 120 + uintptr(iPage-int32(1))*4)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 72 + uintptr(iPage-int32(1))*2))) @@ -56366,6 +56603,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -56437,7 +56675,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -56468,7 +56706,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -56555,7 +56793,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -56658,7 +56896,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -56675,6 +56913,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+88) @@ -56699,7 +56938,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { _ = libc.Int32FromInt32(0) if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -56729,10 +56968,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ _ = libc.Int32FromInt32(0) /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint32(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -56749,7 +56988,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { _ = libc.Int32FromInt32(0) } @@ -56780,7 +57019,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { _ = libc.Int32FromInt32(0) p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -56805,6 +57044,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } _ = libc.Int32FromInt32(0) end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -56855,7 +57095,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -56877,7 +57117,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -56986,7 +57226,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } _ = libc.Int32FromInt32(0) @@ -56994,14 +57234,14 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx)))))) if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { - return _sqlite3CorruptError(tls, int32(79826)) + return _sqlite3CorruptError(tls, int32(79902)) } if pCell < (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79829)) + return _sqlite3CorruptError(tls, int32(79905)) } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must ** be preserved following this delete operation. If the current delete @@ -57096,7 +57336,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { } pCell = (*TMemPage)(unsafe.Pointer(pLeaf)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pLeaf)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1)))))))) if pCell < (*TMemPage)(unsafe.Pointer(pLeaf)).FaData+4 { - return _sqlite3CorruptError(tls, int32(79920)) + return _sqlite3CorruptError(tls, int32(79996)) } nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pLeaf)).FxCellSize})))(tls, pLeaf, pCell)) _ = libc.Int32FromInt32(0) @@ -57216,7 +57456,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags */ _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+4) if *(*TPgno)(unsafe.Pointer(bp + 4)) > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 4))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -57258,7 +57498,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 8)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 4)), bp+20, bp+24) if int32(*(*Tu8)(unsafe.Pointer(bp + 20))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 20))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -57345,14 +57585,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int _, _, _, _ = hdr, i, pCell, v2 _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 4)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { return *(*int32)(unsafe.Pointer(bp + 4)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 4)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -57379,6 +57619,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -57403,6 +57644,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 4)) } @@ -57490,7 +57732,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -57766,7 +58008,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+48, __ccgo_ts+4178, int32(1)) + Xsqlite3_str_append(tls, pCheck+48, __ccgo_ts+4203, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+48, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -57818,11 +58060,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4180, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4205, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4203, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4228, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -57848,11 +58090,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4333, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4358, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -57904,6 +58146,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -57923,11 +58166,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4372 + v2 = __ccgo_ts + 4397 } else { - v2 = __ccgo_ts + 4377 + v2 = __ccgo_ts + 4402 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4398, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4423, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -58064,12 +58307,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4424 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4449 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4442, libc.VaList(bp+48, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4467, libc.VaList(bp+48, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4596, libc.VaList(bp+48, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4621, libc.VaList(bp+48, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+16) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4626, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4651, 0) doCoverageCheck = 0 goto _4 } @@ -58155,7 +58398,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4650, libc.VaList(bp+48, (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4675, libc.VaList(bp+48, (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -58179,7 +58422,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4674, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, 0) depth = d2 } } else { @@ -58188,6 +58431,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -58211,6 +58455,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, libc.VaList(bp+48, *(*Tu32)(unsafe.Pointer(bp + 12))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4724, libc.VaList(bp+48, *(*Tu32)(unsafe.Pointer(bp + 12))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -58268,10 +58513,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4736, libc.VaList(bp+48, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4761, libc.VaList(bp+48, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -58361,7 +58607,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4788 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4813 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -58380,15 +58626,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4799, libc.VaList(bp+200, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4824, libc.VaList(bp+200, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4844, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4869, 0) } } } @@ -58408,6 +58655,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+184, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -61565,16 +61829,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -61612,6 +61877,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*40) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -62015,10 +62281,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -62176,6 +62444,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -62302,6 +62571,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62404,6 +62674,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 20 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -62512,6 +62783,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 20 @@ -62941,7 +63213,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5056, libc.VaList(bp+32, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5081, libc.VaList(bp+32, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -62954,39 +63226,40 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1648 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5061) == 0 { - zColl = __ccgo_ts + 5068 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5086) == 0 { + zColl = __ccgo_ts + 5093 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5049 + v3 = __ccgo_ts + 5074 } else { v3 = __ccgo_ts + 1648 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5070 + v4 = __ccgo_ts + 5095 } else { v4 = __ccgo_ts + 1648 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5073, libc.VaList(bp+32, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5098, libc.VaList(bp+32, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5097, libc.VaList(bp+32, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5122, libc.VaList(bp+32, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1404, libc.VaList(bp+32, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5113, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pOp + 16)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5138, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pOp + 16)))) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1371, libc.VaList(bp+32, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -63004,14 +63277,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { zP4 = __ccgo_ts + 1649 } else { _ = libc.Int32FromInt32(0) - zP4 = __ccgo_ts + 5116 + zP4 = __ccgo_ts + 5141 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5123, libc.VaList(bp+32, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5148, libc.VaList(bp+32, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -63026,14 +63299,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+32, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5156, libc.VaList(bp+32, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5136, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5161, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5138 + zP4 = __ccgo_ts + 5163 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -63049,10 +63323,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5083, - 1: __ccgo_ts + 5085, - 2: __ccgo_ts + 5087, - 3: __ccgo_ts + 5092, + 0: __ccgo_ts + 5108, + 1: __ccgo_ts + 5110, + 2: __ccgo_ts + 5112, + 3: __ccgo_ts + 5117, } // C documentation @@ -63117,6 +63391,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63143,6 +63418,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63182,6 +63458,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 40 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -63214,6 +63491,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 40 v1 = p if !(v1 < pEnd) { @@ -63249,6 +63527,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 40 v3 = p if !(v3 < pEnd) { @@ -63316,6 +63595,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*4)))).FnOp goto _1 _1: + ; i++ } } @@ -63346,6 +63626,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*4)))).FaOp @@ -63367,6 +63648,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -63424,6 +63706,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -63780,6 +64063,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63832,6 +64116,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -63967,6 +64252,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -64000,6 +64286,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -64018,6 +64305,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -64032,7 +64320,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5146, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5171, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -64040,18 +64328,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 4)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5158, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5183, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5172, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5197, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+8) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5187, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 8))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 8))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5212, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 8))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 8))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ _ = libc.Int32FromInt32(0) @@ -64094,6 +64382,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -64130,6 +64419,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -64167,6 +64457,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -64236,6 +64527,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -64284,7 +64576,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -65632,7 +65946,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 52)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 52)), aKey1+uintptr(d1)) @@ -65665,16 +65979,22 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 52)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + _ = libc.Int32FromInt32(0) + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 52)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -65697,7 +66017,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 20 + uintptr(i)*4)) != 0 { @@ -65733,7 +66053,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 52)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -65758,7 +66078,11 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 52)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 52)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 52)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 52)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + _ = libc.Int32FromInt32(0) + } else { + rc = int32(1) + } } } } @@ -65785,7 +66109,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 52))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -65829,18 +66153,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) _ = libc.Int32FromInt32(0) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -66078,8 +66403,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -66112,7 +66438,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -66177,6 +66503,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+152, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -66267,15 +66594,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*20 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5230 + zContext = __ccgo_ts + 5255 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5249 + zContext = __ccgo_ts + 5274 } else { - zContext = __ccgo_ts + 5268 + zContext = __ccgo_ts + 5293 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5277, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5302, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -66329,6 +66656,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -66397,6 +66725,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*40) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -66452,7 +66781,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5313, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5338, 0) return int32(1) } else { return 0 @@ -66462,7 +66791,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5358, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5383, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -66524,7 +66853,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -66593,6 +66922,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*40))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -67054,7 +67384,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5398, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5423, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -67112,6 +67442,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -67136,6 +67467,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 152))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -67238,6 +67570,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ _ = libc.Int32FromInt32(0) @@ -67260,7 +67593,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -67394,7 +67727,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -67565,6 +67898,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -67601,6 +67935,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -67624,6 +67959,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -67863,18 +68199,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5421, - 1: __ccgo_ts + 5426, - 2: __ccgo_ts + 5433, - 3: __ccgo_ts + 5436, - 4: __ccgo_ts + 5439, - 5: __ccgo_ts + 5442, - 6: __ccgo_ts + 5445, - 7: __ccgo_ts + 5448, - 8: __ccgo_ts + 5456, - 9: __ccgo_ts + 5459, - 10: __ccgo_ts + 5466, - 11: __ccgo_ts + 5474, + 0: __ccgo_ts + 5446, + 1: __ccgo_ts + 5451, + 2: __ccgo_ts + 5458, + 3: __ccgo_ts + 5461, + 4: __ccgo_ts + 5464, + 5: __ccgo_ts + 5467, + 6: __ccgo_ts + 5470, + 7: __ccgo_ts + 5473, + 8: __ccgo_ts + 5481, + 9: __ccgo_ts + 5484, + 10: __ccgo_ts + 5491, + 11: __ccgo_ts + 5499, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -68011,6 +68347,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -68118,14 +68455,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5481, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5506, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -68420,6 +68757,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*40, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*40) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -68698,7 +69036,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -68746,6 +69084,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68827,7 +69166,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -68896,6 +69235,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -69002,7 +69342,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5521, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5546, int32(3)) _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, bp+8, zStart, int32(zRawSql)-int32(zStart)) } @@ -69047,7 +69387,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1404, libc.VaList(bp+80, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5042, libc.VaList(bp+80, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5067, libc.VaList(bp+80, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -69062,28 +69402,29 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 32 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5525, libc.VaList(bp+80, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5550, libc.VaList(bp+80, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+32) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5532, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5557, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ _ = libc.Int32FromInt32(0) - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5545, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5570, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5548, libc.VaList(bp+80, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5573, libc.VaList(bp+80, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5553, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5578, int32(1)) } } } @@ -69599,6 +69940,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -69709,19 +70051,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(768) defer tls.Free(768) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity uint8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+584 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -69768,7 +70110,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+560 */ uintptr var _ /* zErr at bp+524 */ uintptr var _ /* zErr at bp+644 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -70244,8 +70586,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*20 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -70258,6 +70602,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadNInt32(db+312, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { goto abort_due_to_interrupt } @@ -70282,7 +70627,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) @@ -70311,7 +70657,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -70333,7 +70680,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70347,6 +70695,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: + ; _ = libc.Int32FromInt32(0) /* There are never any jumps to instruction 0 */ _ = libc.Int32FromInt32(0) /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*20 @@ -70360,6 +70709,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70383,6 +70733,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) @@ -70398,7 +70749,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -70434,6 +70786,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -70463,15 +70816,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5589, libc.VaList(bp+736, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5614, libc.VaList(bp+736, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5610, libc.VaList(bp+736, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5635, libc.VaList(bp+736, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+736, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = (int32(pOp) - int32(aOp)) / 20 - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5617, libc.VaList(bp+736, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5642, libc.VaList(bp+736, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) _ = libc.Int32FromInt32(0) @@ -70493,7 +70846,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -70503,7 +70857,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -70514,7 +70869,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) _ = libc.Int32FromInt32(0) @@ -70528,7 +70884,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) @@ -70570,7 +70927,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) @@ -70613,7 +70971,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -70643,6 +71003,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) @@ -70654,7 +71015,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { @@ -70675,7 +71037,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*40 @@ -70701,7 +71064,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -70721,6 +71085,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 40 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -70742,6 +71107,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70777,7 +71143,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) @@ -70791,7 +71158,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70809,6 +71177,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -70825,6 +71194,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70852,7 +71222,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -70953,11 +71324,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 @@ -70967,6 +71343,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -71004,18 +71381,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -71049,9 +71429,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -71070,6 +71453,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, 0) @@ -71105,10 +71489,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -71172,7 +71560,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -71184,7 +71573,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, uint8(SQLITE_AFF_NUMERIC), encoding) @@ -71208,7 +71598,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -71229,7 +71620,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { @@ -71338,12 +71730,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -71417,16 +71815,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 16 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -71475,7 +71883,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ _ = libc.Int32FromInt32(0) if iCompare == 0 { goto jump_to_p2 @@ -71493,6 +71902,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71520,7 +71930,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -71542,11 +71953,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71562,8 +71973,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } _ = libc.Int32FromInt32(0) @@ -71576,7 +71988,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iCompare < 0 { @@ -71609,8 +72022,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -71646,7 +72061,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71659,7 +72075,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -71675,7 +72092,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _sqlite3VdbeMemSetNull(tls, pOut) @@ -71701,15 +72119,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32((int32(pOp) - int32((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 20) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -71724,6 +72143,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -71736,6 +72156,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -71746,7 +72167,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -71784,6 +72206,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { @@ -71819,7 +72242,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40) } else { @@ -71831,7 +72255,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -71848,6 +72273,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; _ = libc.Int32FromInt32(0) pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { @@ -71870,7 +72296,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ _ = libc.Int32FromInt32(0) pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -71912,12 +72339,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset @@ -71933,9 +72362,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 @@ -71946,11 +72375,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 36)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { _ = libc.Int32FromInt32(0) - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 12)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 12)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 12)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 12)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -71977,9 +72406,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -72035,13 +72464,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -72056,16 +72485,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 64)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 64)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 64))))) } else { @@ -72074,8 +72504,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -72098,10 +72528,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 64)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -72115,10 +72547,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 64)) = *(*Tu32)(unsafe.Pointer(pC3 + 84 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -72138,9 +72572,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 64)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 64)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 64)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 64)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 120)) { @@ -72162,9 +72596,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding _ = libc.Int32FromInt32(0) /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 64)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 64))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 64)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 64))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -72193,13 +72627,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*20 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -72229,6 +72665,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; _ = libc.Int32FromInt32(0) pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72242,11 +72679,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 40 - goto _224 + goto _226 } } _ = libc.Int32FromInt32(0) @@ -72275,16 +72712,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 16 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -72297,14 +72734,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 40 - goto _224 - _224: + goto _226 + _226: + ; i2++ } _ = libc.Int32FromInt32(0) goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5641, libc.VaList(bp+736, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*12 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5666, libc.VaList(bp+736, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*12 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*12))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 16 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 16 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -72378,7 +72818,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -72395,8 +72836,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72414,10 +72855,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*uint8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*uint8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*uint8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 40 @@ -72507,10 +72948,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 16 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 16 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -72591,16 +73032,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 16 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 16 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -72613,9 +73054,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -72659,9 +73100,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint32((*TMem)(unsafe.Pointer(pRec)).Fn)) @@ -72696,6 +73137,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; _ = libc.Int32FromInt32(0) pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 36)) _ = libc.Int32FromInt32(0) @@ -72719,6 +73161,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -72734,7 +73177,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5682, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5707, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -72778,19 +73221,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5733, libc.VaList(bp+736, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5758, libc.VaList(bp+736, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5755, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5780, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -72799,18 +73243,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = (int32(pOp) - int32(aOp)) / 20 (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -72832,8 +73276,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -72849,8 +73294,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -72913,6 +73359,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -72929,13 +73376,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5809, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5834, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -72945,9 +73392,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = (int32(pOp) - int32(aOp)) / 20 (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -72959,16 +73406,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 5864 + v250 = __ccgo_ts + 5889 } else { if iRollback != 0 { - v249 = __ccgo_ts + 5912 + v251 = __ccgo_ts + 5937 } else { - v249 = __ccgo_ts + 5955 + v251 = __ccgo_ts + 5980 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -73009,6 +73456,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 88)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73065,7 +73513,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** SQL statement was prepared. */ _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+5996) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+6021) /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -73106,6 +73554,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** executing this instruction. */ _73: + ; _ = libc.Int32FromInt32(0) iDb = (*TOp)(unsafe.Pointer(pOp)).Fp1 iCookie = (*TOp)(unsafe.Pointer(pOp)).Fp3 @@ -73133,6 +73582,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the database schema version, resulting in a schema reset. */ _74: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73248,6 +73698,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: OP_OpenRead, OP_ReopenIdx */ _77: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCur = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -73259,8 +73710,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* If the cursor is not currently open or is open on a different ** index, then fall through into OP_OpenRead to force a reopen */ - _76: /* ncycle */ + _76: + ; /* ncycle */ _75: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73331,6 +73784,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** since moved into the btree layer. */ (*TVdbeCursor)(unsafe.Pointer(pCur)).FisTable = libc.BoolUint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) != -int32(8)) open_cursor_set_hints: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3BtreeCursorHintFlags(tls, *(*uintptr)(unsafe.Pointer(pCur + 36)), uint32(int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_BULKCSR)|libc.Int32FromInt32(OPFLAG_SEEKEQ)))) @@ -73346,7 +73800,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Duplicate ephemeral cursors are used for self-joins of materialized views. */ - _78: /* The new cursor */ + _78: + ; /* The new cursor */ pOrig = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) /* Only ephemeral cursors can be duplicated */ @@ -73402,8 +73857,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by this opcode will be used for automatically created transient ** indices in joins. */ - _80: /* ncycle */ + _80: + ; /* ncycle */ _79: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { @@ -73439,11 +73896,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 12)), pCx1+48, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { @@ -73481,6 +73938,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) @@ -73503,13 +73961,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; _ = libc.Int32FromInt32(0) pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) - v253 = pC4 + 16 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 16 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -73530,6 +73989,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) @@ -73551,7 +74011,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _ = libc.Int32FromInt32(0) _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) = uintptr(0) @@ -73646,10 +74107,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -73754,11 +74219,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 104))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 104))).Fdefault_rc = int8(v256) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73811,6 +74276,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 96)) != 0 { goto jump_to_p2 @@ -73890,6 +74356,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; _ = libc.Int32FromInt32(0) /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first @@ -73910,29 +74377,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 144))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 144))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*20))).Fp3)*40 *(*int32)(unsafe.Pointer(bp + 136)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+144, bp+136) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 136)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 20 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 136)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -73945,8 +74415,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -73963,6 +74434,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; _ = libc.Int32FromInt32(0) pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -73982,6 +74454,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; _ = libc.Int32FromInt32(0) pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { @@ -74079,15 +74552,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; _ = libc.Int32FromInt32(0) pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= *(*int32)(unsafe.Pointer(pOp + 16)) { goto _187 } - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74107,11 +74584,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 176))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 176))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 176))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 _ = libc.Int32FromInt32(0) if rc != 0 { goto no_mem @@ -74152,8 +74629,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 176))).FaMem + uintptr(ii1)*40))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -74210,6 +74688,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -74231,12 +74710,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { iKey1 = uint64(*(*Ti64)(unsafe.Pointer(bp + 216))) goto notExistsWithKey } - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74254,7 +74735,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp + 208)) != 0 { _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -74271,15 +74752,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 16 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) + 16 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -74296,7 +74778,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 256)) = 0 *(*int32)(unsafe.Pointer(bp + 264)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -74350,8 +74833,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -74386,15 +74870,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+256) *(*Ti64)(unsafe.Pointer(bp + 256)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 256))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 36)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 256)))), 0, bp+264) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 264)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 36)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 256)))), 0, bp+264) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 264)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -74448,7 +74933,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74496,11 +74982,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 272))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 272))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 272))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -74520,11 +75006,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 272))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 272))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -74538,7 +75024,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74546,11 +75033,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 36)), *(*uintptr)(unsafe.Pointer(pSrc + 36)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -74597,6 +75084,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74626,11 +75114,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { _ = libc.Int32FromInt32(0) if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -74663,6 +75151,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -74682,6 +75171,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74709,6 +75199,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74749,6 +75240,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74793,6 +75285,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -74842,6 +75335,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; _ = libc.Int32FromInt32(0) pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) if pC18 == uintptr(0) { @@ -74885,8 +75379,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; _ = libc.Int32FromInt32(0) pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74920,6 +75416,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; _ = libc.Int32FromInt32(0) pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -74960,8 +75457,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 164 + 2*4))++ /* Opcode: Rewind P1 P2 * * * ** @@ -74979,6 +75478,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75061,11 +75561,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -75075,7 +75577,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 36)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -75085,6 +75588,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 36)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -75126,6 +75630,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; _ = libc.Int32FromInt32(0) pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -75138,11 +75643,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -75151,11 +75656,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 344))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 (*(*TBtreePayload)(unsafe.Pointer(bp + 344))).FnMem = uint16(*(*int32)(unsafe.Pointer(pOp + 16))) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 36)), bp+344, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 36)), bp+344, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { @@ -75170,6 +75675,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; _ = libc.Int32FromInt32(0) pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -75178,11 +75684,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -75207,6 +75713,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75230,7 +75737,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+464, db, uint16(0)) @@ -75459,6 +75973,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) @@ -75503,6 +76018,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 512)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75527,6 +76043,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; _ = libc.Int32FromInt32(0) pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -75551,6 +76068,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 520)) = uint32(0) _ = libc.Int32FromInt32(0) @@ -75572,6 +76090,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 524)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -75603,6 +76122,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -75617,13 +76137,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 24)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+152, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6041 + zSchema = __ccgo_ts + 6066 (*(*TInitData)(unsafe.Pointer(bp + 528))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 528))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 528))).FpzErrMsg = p + 124 (*(*TInitData)(unsafe.Pointer(bp + 528))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 528))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6055, libc.VaList(bp+736, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6080, libc.VaList(bp+736, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*16))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -75640,7 +76160,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -75661,6 +76181,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; _ = libc.Int32FromInt32(0) rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { @@ -75676,6 +76197,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -75687,6 +76209,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -75698,6 +76221,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -75719,7 +76243,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ _ = libc.Int32FromInt32(0) nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -75755,7 +76280,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 _ = libc.Int32FromInt32(0) @@ -75776,6 +76302,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+568) == 0 { @@ -75811,6 +76338,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 iSet = *(*int32)(unsafe.Pointer(pOp + 16)) @@ -75851,7 +76379,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 _ = libc.Int32FromInt32(0) @@ -75873,8 +76402,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -75883,7 +76413,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 120 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6098, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6123, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -75930,8 +76460,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 40 } } else { @@ -75951,17 +76482,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint32FromInt64(88)+libc.Uint32FromInt32(7))&uint32(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint32FromInt64(88)+libc.Uint32FromInt32(7))&uint32(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*40 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*4 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint32(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*20 goto check_for_interrupt @@ -75978,6 +76509,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*20))).Fp1)*40 @@ -75992,6 +76524,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 536)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -76014,7 +76547,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -76037,14 +76571,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 @@ -76069,7 +76605,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -76096,20 +76633,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*40 pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(bp + 576)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 576)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 576)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+576, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+576, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -76130,7 +76668,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { @@ -76146,7 +76685,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*40 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6135 + v286 = __ccgo_ts + 6160 } else { - v284 = __ccgo_ts + 6140 + v286 = __ccgo_ts + 6165 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6147, libc.VaList(bp+736, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6172, libc.VaList(bp+736, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -76425,11 +76974,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -76456,13 +77005,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*40 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+124, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+124, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -76474,6 +77024,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -76504,6 +77055,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; _ = libc.Int32FromInt32(0) if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -76517,6 +77069,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; _ = libc.Int32FromInt32(0) pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -76529,6 +77082,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; _ = libc.Int32FromInt32(0) pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*4)) _ = libc.Int32FromInt32(0) @@ -76551,6 +77105,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+736, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+736, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -77271,8 +77851,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*20))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*20))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -77291,7 +77872,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ _ = libc.Int32FromInt32(0) goto _187 /***************************************************************************** @@ -77301,6 +77883,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -77308,17 +77891,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 20 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -77363,12 +77949,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5398, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5423, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1618, 0) rc = int32(SQLITE_NOMEM) @@ -77377,6 +77965,7 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; _ = libc.Int32FromInt32(0) rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error @@ -77384,10 +77973,10 @@ abort_due_to_interrupt: } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5555, - 1: __ccgo_ts + 5564, - 2: __ccgo_ts + 5571, - 3: __ccgo_ts + 5577, + 0: __ccgo_ts + 5580, + 1: __ccgo_ts + 5589, + 2: __ccgo_ts + 5596, + 3: __ccgo_ts + 5602, } var _and_logic = [9]uint8{ @@ -77544,13 +78133,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1634 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6276 + v3 = __ccgo_ts + 6301 } else { - v3 = __ccgo_ts + 6281 + v3 = __ccgo_ts + 6306 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6289, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6314, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -77568,7 +78157,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6318, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6343, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -77613,15 +78202,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+4, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6338, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6363, libc.VaList(bp+296, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6368, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6393, libc.VaList(bp+296, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6404, libc.VaList(bp+296, zTable)) + _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6429, libc.VaList(bp+296, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 4))).FzErrMsg != 0 { @@ -77646,11 +78235,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6425, libc.VaList(bp+296, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6450, libc.VaList(bp+296, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77677,14 +78267,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 36 + uintptr(j)*8))).FiFrom == iCol { - zFault = __ccgo_ts + 6446 + zFault = __ccgo_ts + 6471 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -77700,19 +78292,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6458 + zFault = __ccgo_ts + 6483 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6466, libc.VaList(bp+296, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6491, libc.VaList(bp+296, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77776,6 +78370,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+4) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -77875,7 +78470,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -77977,7 +78572,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -79020,6 +79615,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -79144,6 +79740,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -79204,6 +79801,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -79296,6 +79894,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -79352,6 +79951,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*56) goto _1 _1: + ; i++ } } @@ -79408,6 +80008,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -79616,6 +80217,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -79638,6 +80240,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79796,6 +80399,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79875,6 +80479,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*56))).FpFd == uintptr(0)) @@ -79942,6 +80547,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -80362,6 +80968,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -80372,6 +80979,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -80554,6 +81162,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -80618,6 +81227,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -80641,6 +81251,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -80724,6 +81335,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -80740,6 +81352,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -80781,6 +81394,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 72 + uintptr(i)*80))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -80814,6 +81428,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -80835,6 +81450,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -81055,6 +81671,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -81229,6 +81846,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -81250,6 +81868,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -81285,6 +81904,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -81322,6 +81942,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -81439,6 +82060,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -81651,6 +82273,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -81752,6 +82375,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 20 } @@ -81846,6 +82470,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 72 } @@ -82031,6 +82656,10 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*20))).FpExpr _ = libc.Int32FromInt32(0) + _ = libc.Int32FromInt32(0) + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -82090,6 +82719,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -82103,6 +82733,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -82209,25 +82840,25 @@ func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema _ = zLegacy _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6500, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6525, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6508+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6527+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6533+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6552+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6041+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6066+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } @@ -82313,9 +82944,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6560, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6585, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -82404,6 +83036,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -82416,7 +83049,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6565) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6590) != 0 { goto _2 } } @@ -82487,15 +83120,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 12 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 72 } @@ -82525,11 +83169,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6567, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6592, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6571, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6596, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -82538,7 +83182,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 8)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6575, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6600, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -82561,6 +83205,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 12 } @@ -82619,8 +83264,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 36 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -82659,15 +83304,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*20))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6584, libc.VaList(bp+16, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6609, libc.VaList(bp+16, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6615, libc.VaList(bp+16, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6640, libc.VaList(bp+16, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -82681,6 +83326,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -82720,7 +83366,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6670, libc.VaList(bp+16, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6695, libc.VaList(bp+16, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+44, 0, uint32(8)) return int32(WRC_Prune) @@ -82751,7 +83397,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6705 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6730 *(*uintptr)(unsafe.Pointer(pExpr + 20)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -82761,18 +83407,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6714 + v10 = __ccgo_ts + 6739 } else { - v10 = __ccgo_ts + 6729 + v10 = __ccgo_ts + 6754 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6751, libc.VaList(bp+16, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+16, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+16, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+16, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+16, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+16, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -82808,6 +83454,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { @@ -82898,19 +83545,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6781 + zIn = __ccgo_ts + 6806 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6809 + zIn = __ccgo_ts + 6834 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6827 + zIn = __ccgo_ts + 6852 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6845 + zIn = __ccgo_ts + 6870 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6863, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6888, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -82958,10 +83605,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 24)) _ = libc.Int32FromInt32(0) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse @@ -82996,6 +83643,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -83010,30 +83670,52 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - _ = libc.Int32FromInt32(0) - *(*int32)(unsafe.Pointer(pExpr + 8)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _ = libc.Int32FromInt32(0) + *(*int32)(unsafe.Pointer(pExpr + 8)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -83056,7 +83738,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6883, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6908, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -83084,22 +83766,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 20)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)) + v5 = *(*uintptr)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fy)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) @@ -83118,7 +83800,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*20))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6900, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6925, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -83132,17 +83814,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*uint8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6964, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6989, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -83164,7 +83846,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** all this. */ _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7000, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7025, uintptr(0), pExpr) } } else { _ = libc.Int32FromInt32(0) /* Must fit in 8 bits */ @@ -83189,29 +83871,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { _ = libc.Int32FromInt32(0) if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7028, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7053, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7071 + zType = __ccgo_ts + 7096 } else { - zType = __ccgo_ts + 7078 + zType = __ccgo_ts + 7103 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7088, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7113, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7116, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7141, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7138, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7163, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7182, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7207, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -83228,11 +83910,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 24)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 24)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -83251,11 +83933,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { _ = libc.Int32FromInt32(0) if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -83274,18 +83956,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } _ = libc.Int32FromInt32(0) if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - p10 = pNC2 + 24 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p11 = pNC2 + 24 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 24)) |= savedAllowFlags @@ -83302,7 +83984,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7230, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7255, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 20))) } @@ -83315,7 +83997,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_VARIABLE): _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7241, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7266, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -83365,18 +84047,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -83411,6 +84093,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -83477,6 +84160,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -83491,7 +84175,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7252, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7277, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -83526,7 +84210,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 120 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7308, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7333, 0) return int32(1) } i = 0 @@ -83537,6 +84221,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*20+8+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -83564,7 +84249,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7342, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7367, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -83625,6 +84310,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 20 } @@ -83636,11 +84322,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20 + 8 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7348, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7373, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -83669,7 +84356,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 120 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7409, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7434, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -83698,6 +84385,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 20 } @@ -83832,10 +84520,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 20 } @@ -83948,6 +84638,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -83989,16 +84680,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7440, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7465, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -84011,6 +84704,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -84024,6 +84718,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -84052,7 +84747,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -84063,7 +84758,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7479) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7504) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -84073,11 +84768,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7485, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7510, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 20 } @@ -84240,6 +84936,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 24)) |= savedHasAgg @@ -84479,6 +85176,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*20))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -84553,8 +85251,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20)) + 8))).FpExpr } else { - _ = libc.Int32FromInt32(0) - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -84632,6 +85333,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -85097,7 +85799,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return } _ = libc.Int32FromInt32(0) @@ -85157,6 +85859,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -85181,7 +85884,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 120 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7544, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7569, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -85218,6 +85921,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*20))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -85239,6 +85943,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -85532,11 +86237,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7592 + v2 = __ccgo_ts + 7617 } else { v2 = __ccgo_ts + 1648 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7594, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7619, libc.VaList(bp+8, nExprElem, v2, nElem)) break } _ = libc.Int32FromInt32(0) @@ -85551,6 +86256,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -85615,7 +86321,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pNew + 36)) = int32((*TToken)(unsafe.Pointer(pToken)).Fz) - int32((*TParse)(unsafe.Pointer(pParse)).FzTail) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 120 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7638, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7663, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 20)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -85636,7 +86342,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7672, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7697, libc.VaList(bp+8, p)) } // C documentation @@ -85715,7 +86421,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7722, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7747, libc.VaList(bp+8, pExpr)) } } } @@ -85772,7 +86478,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 120 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7742, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 120 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7767, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 120 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -85805,7 +86511,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 120 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7785, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -86223,6 +86929,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 12 + uintptr(i)*24))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 12 + uintptr(i)*24))).FeM10d goto _1 _1: + ; i++ } } @@ -86356,6 +87063,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 20 pOldItem += 20 @@ -86435,6 +87143,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -86466,6 +87175,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -86526,6 +87236,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -86681,7 +87392,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -86702,6 +87413,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -86717,6 +87429,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -86823,7 +87536,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 120 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7838, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7863, libc.VaList(bp+8, zObject)) } } @@ -86848,6 +87561,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 20 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -86892,6 +87606,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -86923,10 +87638,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7861) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7886) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7866) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7891) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -87247,6 +87962,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -87279,6 +87995,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -87492,13 +88209,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff uint8) (r i // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7872) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7897) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7880) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7905) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7886) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7911) == 0 { return int32(1) } return 0 @@ -87516,9 +88233,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7872, - 1: __ccgo_ts + 7880, - 2: __ccgo_ts + 7886, + 0: __ccgo_ts + 7897, + 1: __ccgo_ts + 7905, + 2: __ccgo_ts + 7911, } _ = libc.Int32FromInt32(0) ii = 0 @@ -87536,6 +88253,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -87543,6 +88261,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -87610,6 +88329,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -87771,6 +88491,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -87803,7 +88524,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -87833,6 +88554,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -87882,6 +88604,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -87897,13 +88620,14 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } _ = libc.Int32FromInt32(0) if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8198, libc.VaList(bp+120, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8223, libc.VaList(bp+120, pExpr)) } else { _ = libc.Int32FromInt32(0) return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -89615,7 +90356,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+120, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8250, libc.VaList(bp+120, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -89640,6 +90381,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -89728,7 +90470,7 @@ expr_code_doover: _ = libc.Int32FromInt32(0) n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+120, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+120, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -89796,7 +90538,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -89857,7 +90599,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -89904,6 +90646,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -89917,7 +90660,7 @@ expr_code_doover: case int32(TK_RAISE): _ = libc.Int32FromInt32(0) if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8249, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8274, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -89981,6 +90724,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 20 i-- } @@ -90203,6 +90947,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 20 } @@ -90351,7 +91096,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -90368,9 +91115,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90390,7 +91139,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -90399,11 +91150,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90418,7 +91175,9 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) @@ -90426,9 +91185,11 @@ _13: _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -90441,7 +91202,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90454,6 +91217,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90556,7 +91320,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -90573,9 +91339,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90597,7 +91365,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -90606,11 +91376,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90625,15 +91401,19 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -90643,7 +91423,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90656,6 +91438,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90896,6 +91679,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -91117,6 +91901,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -91324,6 +92115,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*72))).FiCursor goto _1 _1: + ; i++ j++ } @@ -91376,6 +92168,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -91385,6 +92178,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -91568,6 +92362,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 16 } @@ -91600,6 +92395,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 20 } @@ -91611,6 +92407,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { @@ -91663,6 +92460,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -91681,6 +92479,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -91731,6 +92530,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 72 } /* end loop over pSrcList */ @@ -91755,6 +92555,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 24 } @@ -91867,6 +92668,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 20 } @@ -92000,6 +92802,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -92050,8 +92853,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8299, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92070,9 +92873,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8327, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8352, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8502, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8527, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -92088,9 +92891,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8676, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8701, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8823, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8848, 0) } } @@ -92148,7 +92951,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8974, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8999, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -92157,11 +92960,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9033, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9058, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9064, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -92191,21 +92994,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9091, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9250, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9275, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9555, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9571, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9580, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9596, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9629, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9654, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -92221,8 +93024,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9894, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9919, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -92236,7 +93040,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9907, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9932, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -92281,11 +93085,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9970, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9977, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10002, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -92303,10 +93107,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 44))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10004) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10029) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10063) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10088) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -92320,13 +93124,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10116) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10141) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10162) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10187) } } /* Modify the CREATE TABLE statement. */ @@ -92342,7 +93146,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** have to use printf() to translate between these units: */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10189, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10214, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -92370,7 +93174,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10335, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10360, libc.VaList(bp+16, zTab, zDb)) } } } @@ -92410,12 +93214,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10688, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10713, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10722, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10747, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -92443,7 +93247,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(uint32(12)*uint32(nAlloc))) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10752, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10777, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { _ = libc.Int32FromInt32(0) goto exit_begin_add_column @@ -92459,6 +93263,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -92483,6 +93288,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { })(unsafe.Pointer(pTab + 44))).FaddColOffset _ = libc.Int32FromInt32(0) exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -92504,18 +93310,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10776 + zType = __ccgo_ts + 10801 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10790 + v1 = __ccgo_ts + 10815 } else { - v1 = __ccgo_ts + 10807 + v1 = __ccgo_ts + 10832 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10825, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10850, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92573,10 +93379,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -92593,12 +93400,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } _ = libc.Int32FromInt32(0) bQuote = int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10864, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11046, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10889, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11071, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9894, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9919, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -92707,6 +93515,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -92772,6 +93581,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 12 + uintptr(i)*24))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -92797,6 +93607,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*8))).FzName) goto _1 _1: + ; ii++ } } @@ -92829,6 +93640,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -92847,6 +93659,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92902,6 +93715,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -92924,6 +93738,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -92962,6 +93777,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 12 } return uintptr(0) @@ -93032,6 +93848,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -93041,6 +93858,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 12 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -93064,11 +93882,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*uint8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11179, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11204, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -93097,6 +93915,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -93125,6 +93944,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -93143,8 +93963,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11202, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11227, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -93160,7 +93980,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -93199,7 +94019,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11210, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11235, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -93245,11 +94065,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*uint8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = uint8(0) _sqlite3Dequote(tls, zBuf1) if int32(*(*uint8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11216, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11241, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -93289,6 +94109,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*20+8+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -93383,6 +94204,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -93423,6 +94245,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -93465,11 +94288,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*72))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93628,6 +94453,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+304, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 20))).FpNewIndex @@ -93638,6 +94464,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+304, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -93649,6 +94476,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+304, pExpr) goto _5 _5: + ; i++ } } @@ -93675,10 +94503,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93710,6 +94540,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -93723,6 +94554,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _ = libc.Int32FromInt32(0) rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -93784,6 +94616,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -93884,6 +94717,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93933,11 +94767,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -94057,6 +94893,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+304, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*12)) goto _2 _2: + ; i++ } } @@ -94214,7 +95051,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName) @@ -94232,10 +95069,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11221, libc.VaList(bp+296, int32((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11246, libc.VaList(bp+296, int32((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -94287,23 +95125,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11228 + v1 = __ccgo_ts + 11253 } else { - v1 = __ccgo_ts + 5564 + v1 = __ccgo_ts + 5589 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11240, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11265, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11268, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11293, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -94316,10 +95154,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1648, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11316, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11341, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11437, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11462, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -94349,6 +95187,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -94382,6 +95221,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -94401,6 +95241,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -94418,27 +95259,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11455, + FzName: __ccgo_ts + 11480, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11476, + FzName: __ccgo_ts + 11501, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11496, + FzName: __ccgo_ts + 11521, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11515, + FzName: __ccgo_ts + 11540, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11534, + FzName: __ccgo_ts + 11559, }, } @@ -94651,7 +95492,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11637, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -94662,10 +95503,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11690, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11715, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -94674,6 +95515,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -94687,6 +95529,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -94696,15 +95539,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11557, - FzCols: __ccgo_ts + 11570, + FzName: __ccgo_ts + 11582, + FzCols: __ccgo_ts + 11595, }, 1: { - FzName: __ccgo_ts + 11583, - FzCols: __ccgo_ts + 11596, + FzName: __ccgo_ts + 11608, + FzCols: __ccgo_ts + 11621, }, 2: { - FzName: __ccgo_ts + 11624, + FzName: __ccgo_ts + 11649, }, } @@ -94888,6 +95731,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*40) goto _1 _1: + ; i++ } i = 0 @@ -94898,6 +95742,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*40) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -94997,6 +95842,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint32FromInt64(8) * uint32(nColUp)) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -95008,6 +95854,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*40))).FiCol = i goto _4 _4: + ; i++ } } @@ -95021,7 +95868,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11708, + FzName: __ccgo_ts + 11733, } func init() { @@ -95060,6 +95907,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -95140,6 +95988,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -95174,6 +96023,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint32(8)*uint32(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -95189,6 +96039,7 @@ find_new_min: } goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -95222,6 +96073,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -95239,10 +96091,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -95262,10 +96116,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -95316,6 +96172,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -95333,6 +96190,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -95347,6 +96205,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -95380,6 +96239,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -95393,7 +96253,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11718, + FzName: __ccgo_ts + 11743, } func init() { @@ -95446,7 +96306,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11728, libc.VaList(bp+56, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11753, libc.VaList(bp+56, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -95457,10 +96317,11 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11733, libc.VaList(bp+56, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11758, libc.VaList(bp+56, iVal)) _ = libc.Int32FromInt32(0) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -95497,9 +96358,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+24, __ccgo_ts+11739, libc.VaList(bp+56, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+24, __ccgo_ts+11764, libc.VaList(bp+56, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 24))).FnChar != 0 { @@ -95514,7 +96376,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11745, + FzName: __ccgo_ts + 11770, } func init() { @@ -95582,7 +96444,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11754, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11779, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -95599,7 +96461,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*64 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11557, uint32(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11582, uint32(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -95756,6 +96618,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -95777,6 +96640,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -95806,6 +96670,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -95828,7 +96693,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -95865,6 +96730,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -95889,6 +96755,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -95902,6 +96769,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -95912,7 +96780,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -95964,6 +96832,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -95986,9 +96855,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 40)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11768) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11793) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11772) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11797) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -96037,6 +96906,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -96146,23 +97016,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(0), 6, 0x40) for *(*uint8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11776, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11801, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11787, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11812, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11797, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11822, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -96276,6 +97147,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -96343,6 +97215,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -96354,6 +97227,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -96460,6 +97334,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -96542,11 +97417,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { rc = SQLITE_OK _ = libc.Int32FromInt32(0) if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11583, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11608, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11809, __ccgo_ts+11878, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11834, __ccgo_ts+11903, zDb) } return rc } @@ -96595,6 +97470,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 28)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 24)).Ffirst @@ -96608,15 +97484,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11557, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11582, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11930, libc.VaList(bp+16, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11955, libc.VaList(bp+16, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -96637,6 +97514,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -96662,6 +97540,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -96728,7 +97607,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6560, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6585, zName) == 0) } // C documentation @@ -96784,7 +97663,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), __ccgo_ts+11971, db, bp+20, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), __ccgo_ts+11996, db, bp+20, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 20))) if pNewSchema != 0 { @@ -96815,7 +97694,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 120 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11974, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(db + 120 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11999, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(db + 120 + 7*4)))) goto attach_error } i = 0 @@ -96825,11 +97704,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } _ = libc.Int32FromInt32(0) if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12011, libc.VaList(bp+32, zName)) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12036, libc.VaList(bp+32, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -96873,7 +97753,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12041, 0) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12066, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -96881,7 +97761,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12070, 0) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12095, 0) rc = int32(SQLITE_ERROR) } } @@ -96930,7 +97810,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1618, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 12)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12138, libc.VaList(bp+32, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 12)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12163, libc.VaList(bp+32, zFile)) } } } @@ -96938,6 +97818,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 12)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 12)), -int32(1)) @@ -96986,18 +97867,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12166, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12191, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12187, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12212, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12213, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12238, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -97017,6 +97899,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -97072,6 +97955,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -97091,7 +97975,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12235, + FzName: __ccgo_ts + 12260, } func init() { @@ -97113,7 +97997,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12249, + FzName: __ccgo_ts + 12274, } func init() { @@ -97139,7 +98023,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12263, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12288, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -97173,7 +98057,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12287, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12312, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -97188,6 +98072,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 72 } @@ -97202,6 +98087,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -97290,6 +98176,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -97387,7 +98274,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12358, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -97415,11 +98302,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12356, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12381, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12362, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12387, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12368, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12393, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -97469,6 +98356,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -97484,7 +98372,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName } else { - zCol = __ccgo_ts + 7880 + zCol = __ccgo_ts + 7905 } } _ = libc.Int32FromInt32(0) @@ -97521,7 +98409,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12420, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -97635,6 +98523,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint32(16) * uint32((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -97686,6 +98575,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -97755,6 +98645,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -97785,6 +98676,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -97800,6 +98692,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -97829,6 +98722,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*20))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*20 + 16))) goto _5 _5: + ; i++ } } @@ -97944,26 +98838,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6560) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6585) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6533) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, __ccgo_ts+6041) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16))).FpSchema+8, __ccgo_ts+6066) } } } @@ -97991,14 +98886,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6041) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6066) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema+8, __ccgo_ts+6533) } } } @@ -98036,7 +98932,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+404, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12410, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12435, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -98054,15 +98950,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12418 + v1 = __ccgo_ts + 12443 } else { - v1 = __ccgo_ts + 12431 + v1 = __ccgo_ts + 12456 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+8, zMsg, zName)) } } else { _ = libc.Int32FromInt32(0) @@ -98102,12 +98998,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - return __ccgo_ts + 6546 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + return __ccgo_ts + 6571 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6508+7) == 0 { - return __ccgo_ts + 6527 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6533+7) == 0 { + return __ccgo_ts + 6552 } } return zName @@ -98157,6 +99053,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -98245,6 +99142,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -98286,6 +99184,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -98318,6 +99217,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 24)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -98478,6 +99378,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 12 } @@ -98540,6 +99441,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -98647,7 +99549,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6041) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6066) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -98679,11 +99581,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6560, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6585, zName) { break } goto _1 _1: + ; i-- pDb -= 16 } @@ -98737,13 +99640,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12445, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12470, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12462, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12487, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -98792,8 +99695,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12482, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12507, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -98815,6 +99718,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -98841,6 +99745,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -98873,6 +99778,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -98936,6 +99842,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -99005,9 +99912,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -99020,7 +99927,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12524, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12549, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -99036,9 +99943,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10771 + v2 = __ccgo_ts + 10796 } else { - v2 = __ccgo_ts + 9033 + v2 = __ccgo_ts + 9058 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -99050,9 +99957,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -99076,11 +99983,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10771 + v4 = __ccgo_ts + 10796 } else { - v4 = __ccgo_ts + 9033 + v4 = __ccgo_ts + 9058 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12565, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12590, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -99089,7 +99996,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12586, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12611, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -99182,6 +100089,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -99243,7 +100151,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12646, 0) } else { _ = libc.Int32FromInt32(0) } @@ -99260,7 +100168,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+104, __ccgo_ts+12655, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+104, __ccgo_ts+12680, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 104 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -99308,7 +100216,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 120 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+24, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+24, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -99318,12 +100226,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12698, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12723, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 8))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 8))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12705, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 8))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 8))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12730, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 8))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 8))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 8))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 8))).Fn-- @@ -99351,6 +100259,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -99371,12 +100280,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*12))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*12))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12715, libc.VaList(bp+24, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12740, libc.VaList(bp+24, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64((int64((*TTable)(unsafe.Pointer(p)).FnCol)+int64(1))*int64(12))) @@ -99441,6 +100351,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99579,10 +100490,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*12 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12741, libc.VaList(bp+64, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12766, libc.VaList(bp+64, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12786, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12811, 0) } else { libc.Xmemset(tls, bp, 0, uint32(52)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -99640,7 +100551,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 10 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12827, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12852, 0) } } @@ -99677,7 +100588,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12879, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12904, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 28)) |= uint32(TF_HasPrimaryKey) @@ -99711,11 +100622,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -99734,13 +100647,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12945, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -99770,6 +100684,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1))))])&int32(0x01) != 0 { @@ -99822,6 +100737,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99847,17 +100763,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*12 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12976, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13001, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13019, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13044, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13027, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13052, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -99889,8 +100805,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13034, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13059, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -99947,6 +100865,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -99984,6 +100903,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -100007,6 +100927,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -100042,18 +100963,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 12 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1648 - zSep2 = __ccgo_ts + 13065 - zEnd = __ccgo_ts + 5081 + zSep2 = __ccgo_ts + 13090 + zEnd = __ccgo_ts + 5106 } else { - zSep = __ccgo_ts + 13067 - zSep2 = __ccgo_ts + 13071 - zEnd = __ccgo_ts + 13076 + zSep = __ccgo_ts + 13092 + zSep2 = __ccgo_ts + 13096 + zEnd = __ccgo_ts + 13101 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -100061,7 +100983,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13079, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13104, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -100087,6 +101009,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ pCol += 12 } @@ -100096,11 +101019,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1648, - 1: __ccgo_ts + 13093, - 2: __ccgo_ts + 13099, - 3: __ccgo_ts + 13104, - 4: __ccgo_ts + 13109, - 5: __ccgo_ts + 13099, + 1: __ccgo_ts + 13118, + 2: __ccgo_ts + 13124, + 3: __ccgo_ts + 13129, + 4: __ccgo_ts + 13134, + 5: __ccgo_ts + 13124, } // C documentation @@ -100158,6 +101081,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 12 } @@ -100195,6 +101119,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -100261,6 +101186,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -100307,6 +101233,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -100362,6 +101289,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 28)) |= uint32(TF_HasNotNull) @@ -100424,6 +101352,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -100469,6 +101398,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -100496,12 +101426,14 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -100517,6 +101449,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -100536,6 +101469,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _ = libc.Int32FromInt32(0) @@ -100630,6 +101564,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -100742,9 +101677,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*12 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13115, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13140, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13148, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13173, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -100758,6 +101693,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } @@ -100766,11 +101702,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13200, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13225, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13250, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -100813,10 +101749,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13257, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13282, 0) return } } @@ -100830,6 +101767,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -100849,12 +101787,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9033 - zType2 = __ccgo_ts + 13301 + zType = __ccgo_ts + 9058 + zType2 = __ccgo_ts + 13326 } else { /* A view */ - zType = __ccgo_ts + 10771 - zType2 = __ccgo_ts + 13307 + zType = __ccgo_ts + 10796 + zType2 = __ccgo_ts + 13332 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -100939,13 +101877,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13312, libc.VaList(bp+40, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13337, libc.VaList(bp+40, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13327, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13352, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -100955,17 +101893,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16 _ = libc.Int32FromInt32(0) if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13425, libc.VaList(bp+40, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13450, libc.VaList(bp+40, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13467, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13492, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13501, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13526, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13522, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13547, libc.VaList(bp+40, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -100985,7 +101923,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ _ = libc.Int32FromInt32(0) - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9555) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9580) == 0 { _ = libc.Int32FromInt32(0) (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -101020,7 +101958,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 60)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13554, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13579, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -101032,11 +101970,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 28)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+60) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+10771, *(*uintptr)(unsafe.Pointer(bp + 60))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+10796, *(*uintptr)(unsafe.Pointer(bp + 60))) if _sqlite3FixSelect(tls, bp+8, pSelect) != 0 { goto create_view_fail } @@ -101081,6 +102020,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -101134,7 +102074,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13590, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13615, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } _ = libc.Int32FromInt32(0) @@ -101246,6 +102186,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*16))).FpSchema + 78 @@ -101288,6 +102229,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 24 @@ -101302,6 +102244,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -101323,7 +102266,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13620, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13645, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -101336,7 +102279,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13635, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13660, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -101388,6 +102331,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -101420,12 +102364,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13702, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13727, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -101464,7 +102409,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13716, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13741, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -101473,7 +102418,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13761, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13786, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -101508,11 +102453,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3418, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7241, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7266, int32(10)) == 0 { return 0 } return int32(1) @@ -101571,9 +102516,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName @@ -101606,18 +102551,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13828, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13853, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13856, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13881, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -101627,12 +102572,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11772, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11797, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -101674,13 +102620,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13922, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*12))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13947, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*12))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13985, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14010, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -101696,6 +102642,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*20))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -101739,10 +102686,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14079, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*20))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14104, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*20))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -101750,6 +102698,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -101769,6 +102718,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -101796,6 +102746,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 44))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -102002,15 +102953,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*20 + 8 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14125 + v2 = __ccgo_ts + 14150 } else { - v2 = __ccgo_ts + 14131 + v2 = __ccgo_ts + 14156 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14136, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14161, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -102087,7 +103039,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14164, *(*uintptr)(unsafe.Pointer(bp + 52))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14189, *(*uintptr)(unsafe.Pointer(bp + 52))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -102099,7 +103051,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14170, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14195, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -102116,16 +103068,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16 _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14220, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14245, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14298, 0) goto exit_create_index } /* @@ -102147,19 +103099,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } _ = libc.Int32FromInt32(0) - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14164, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14189, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14307, libc.VaList(bp+80, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14332, libc.VaList(bp+80, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14341, libc.VaList(bp+80, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14366, libc.VaList(bp+80, zName)) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -102177,10 +103129,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14365, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14390, libc.VaList(bp+80, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -102198,9 +103151,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -102229,7 +103182,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14164) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14189) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -102250,6 +103203,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -102318,7 +103272,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14388, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14413, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -102371,6 +103325,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 20 } @@ -102396,6 +103351,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } _ = libc.Int32FromInt32(0) @@ -102428,6 +103384,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -102459,6 +103416,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -102471,7 +103429,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14449, libc.VaList(bp+80, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14474, libc.VaList(bp+80, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -102489,6 +103447,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -102503,8 +103462,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14491, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14516, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -102547,9 +103506,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1648 } else { - v13 = __ccgo_ts + 14508 + v13 = __ccgo_ts + 14533 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14516, libc.VaList(bp+80, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14541, libc.VaList(bp+80, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -102557,7 +103516,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14536, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14561, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -102565,7 +103524,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14595, libc.VaList(bp+80, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14620, libc.VaList(bp+80, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -102585,6 +103544,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -102613,6 +103573,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 20 } } @@ -102690,6 +103651,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -102731,7 +103693,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14622, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14647, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -102740,7 +103702,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 56))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14640, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14665, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -102748,9 +103710,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -102766,13 +103728,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14713, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11768, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14738, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11793, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102882,6 +103845,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*8))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -102907,6 +103871,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -102960,7 +103925,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14773, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14798, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -102984,6 +103949,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*72)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*72)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -102997,6 +103963,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*72))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -103108,6 +104075,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 72 } @@ -103161,6 +104129,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 72 } @@ -103193,11 +104162,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14809 + v1 = __ccgo_ts + 14834 } else { - v1 = __ccgo_ts + 14812 + v1 = __ccgo_ts + 14837 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14818, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14843, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -103241,6 +104210,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _ = libc.Int32FromInt32(0) _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) @@ -103361,6 +104331,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -103378,6 +104349,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -103387,6 +104359,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -103409,7 +104382,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _ = libc.Int32FromInt32(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb _ = libc.Int32FromInt32(0) - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14854, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14879, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -103436,6 +104409,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -103458,9 +104432,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _ = libc.Int32FromInt32(0) isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14860 + v1 = __ccgo_ts + 14885 } else { - v1 = __ccgo_ts + 14869 + v1 = __ccgo_ts + 14894 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -103493,9 +104467,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14854, - 1: __ccgo_ts + 14876, - 2: __ccgo_ts + 14860, + 0: __ccgo_ts + 14879, + 1: __ccgo_ts + 14901, + 2: __ccgo_ts + 14885, } // C documentation @@ -103515,7 +104489,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14884, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14909, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -103585,6 +104559,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -103705,7 +104680,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 120))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14954, libc.VaList(bp+32, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14979, libc.VaList(bp+32, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -103715,13 +104690,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*12))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+14965, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+14990, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1661, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -103746,10 +104722,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -104865,11 +105854,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15117, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15142, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15171, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -104998,6 +105987,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -105085,6 +106075,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -105158,6 +106149,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -105291,9 +106283,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15184) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15209) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -105396,6 +106389,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -105437,7 +106431,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11557) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11582) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -105529,6 +106523,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -105615,6 +106610,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -105723,6 +106719,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*4))) @@ -105752,10 +106749,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6281, - 1: __ccgo_ts + 6276, - 2: __ccgo_ts + 8172, - 3: __ccgo_ts + 8167, + 0: __ccgo_ts + 6306, + 1: __ccgo_ts + 6301, + 2: __ccgo_ts + 8197, + 3: __ccgo_ts + 8192, 4: __ccgo_ts + 1634, } @@ -105873,7 +106870,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) return } iVal = -iVal @@ -105969,10 +106966,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -106062,6 +107061,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -106126,6 +107126,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int32(z2)-int32(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -106186,7 +107187,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15214, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15239, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -106249,6 +107250,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = uint8(int32(*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106276,6 +107278,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = _sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))] goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106768,7 +107771,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 120 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15220, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15245, -int32(1)) return } if argc == int32(3) { @@ -106780,7 +107783,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15253, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15278, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+4) @@ -106952,13 +107955,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5042, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15323, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15298, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15331, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -106979,6 +107982,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*uint8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*uint8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = uint8('\'') @@ -106989,7 +107993,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15305, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15339, libc.VaList(bp+16, zArg)) default: _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, pStr, __ccgo_ts+1649, int32(4)) @@ -107115,6 +108119,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -107155,6 +108160,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -107286,9 +108292,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(p)-int32(pBlob), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -107344,7 +108352,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { _ = libc.Int32FromInt32(0) - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) @@ -107399,6 +108407,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -107457,6 +108466,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -107482,6 +108492,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int32(z) - int32(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*4)))) goto _4 _4: + ; nChar++ } } @@ -107503,6 +108514,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -107526,6 +108538,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -107546,7 +108559,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11177, + 0: __ccgo_ts + 11202, } // C documentation @@ -107571,6 +108584,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -107599,6 +108613,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(z + uintptr(j))) = uint8(0) @@ -107669,6 +108684,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -107692,6 +108708,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -107704,7 +108721,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15308, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15342, int32(4), libc.UintptrFromInt32(0)) } } @@ -107765,7 +108782,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12395, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12420, -int32(1)) return } if argc == int32(2) { @@ -107961,9 +108978,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -107983,7 +109000,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108002,7 +109019,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108309,7 +109326,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15313, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15347, int32(2)) _ = libc.Int32FromInt32(0) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) @@ -108339,12 +109356,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15319, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15319, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15353, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15353, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -108659,562 +109677,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row)), - FzName: __ccgo_ts + 15324, + FzName: __ccgo_ts + 15358, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_compare)), - FzName: __ccgo_ts + 15344, + FzName: __ccgo_ts + 15378, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr)), - FzName: __ccgo_ts + 15357, + FzName: __ccgo_ts + 15391, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_affinity)), - FzName: __ccgo_ts + 15375, + FzName: __ccgo_ts + 15409, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15384, + FzName: __ccgo_ts + 15418, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15407, + FzName: __ccgo_ts + 15441, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15433, + FzName: __ccgo_ts + 15467, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15458, + FzName: __ccgo_ts + 15492, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15467, + FzName: __ccgo_ts + 15501, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), - FzName: __ccgo_ts + 15478, + FzName: __ccgo_ts + 15512, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_sqlite_offset)), - FzName: __ccgo_ts + 15485, + FzName: __ccgo_ts + 15519, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15524, + FzName: __ccgo_ts + 15558, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15531, + FzName: __ccgo_ts + 15565, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15539, + FzName: __ccgo_ts + 15573, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15546, + FzName: __ccgo_ts + 15580, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15559, + FzName: __ccgo_ts + 15593, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15565, + FzName: __ccgo_ts + 15599, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15572, + FzName: __ccgo_ts + 15606, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15579, + FzName: __ccgo_ts + 15613, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15587, + FzName: __ccgo_ts + 15621, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15592, + FzName: __ccgo_ts + 15626, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15602, + FzName: __ccgo_ts + 15636, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15608, + FzName: __ccgo_ts + 15642, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15614, + FzName: __ccgo_ts + 15648, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15641, + FzName: __ccgo_ts + 15675, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15648, + FzName: __ccgo_ts + 15682, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15655, + FzName: __ccgo_ts + 15689, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15666, + FzName: __ccgo_ts + 15700, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15673, + FzName: __ccgo_ts + 15707, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15688, + FzName: __ccgo_ts + 15722, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15739, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15716, + FzName: __ccgo_ts + 15750, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15722, + FzName: __ccgo_ts + 15756, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15748, + FzName: __ccgo_ts + 15782, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15762, + FzName: __ccgo_ts + 15796, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15770, + FzName: __ccgo_ts + 15804, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15796, + FzName: __ccgo_ts + 15830, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15800, + FzName: __ccgo_ts + 15834, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15840, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15829, + FzName: __ccgo_ts + 15863, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15840, + FzName: __ccgo_ts + 15874, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15845, + FzName: __ccgo_ts + 15879, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15850, + FzName: __ccgo_ts + 15884, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15858, + FzName: __ccgo_ts + 15892, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15870, + FzName: __ccgo_ts + 15904, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), - FzName: __ccgo_ts + 15877, + FzName: __ccgo_ts + 15911, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), - FzName: __ccgo_ts + 15883, + FzName: __ccgo_ts + 15917, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15888, + FzName: __ccgo_ts + 15922, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15892, + FzName: __ccgo_ts + 15926, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15896, + FzName: __ccgo_ts + 15930, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15902, + FzName: __ccgo_ts + 15936, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15906, + FzName: __ccgo_ts + 15940, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15911, + FzName: __ccgo_ts + 15945, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15916, + FzName: __ccgo_ts + 15950, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15921, + FzName: __ccgo_ts + 15955, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15961, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15931, + FzName: __ccgo_ts + 15965, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15969, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15939, + FzName: __ccgo_ts + 15973, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15949, + FzName: __ccgo_ts + 15983, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15954, + FzName: __ccgo_ts + 15988, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15960, + FzName: __ccgo_ts + 15994, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15977, + FzName: __ccgo_ts + 16011, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15985, + FzName: __ccgo_ts + 16019, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15993, + FzName: __ccgo_ts + 16027, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16030, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_iif)), - FzName: __ccgo_ts + 16001, + FzName: __ccgo_ts + 16035, }, } @@ -109632,6 +110650,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 36 + uintptr(i)*8))).FiFrom goto _2 _2: + ; i++ } } @@ -109671,6 +110690,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -109678,6 +110698,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -109687,11 +110708,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16005, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -109754,6 +110776,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -109793,6 +110816,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -109825,6 +110849,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -109985,6 +111010,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -110022,6 +111048,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -110128,10 +111155,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 28 + 1*4)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -110180,6 +111209,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -110241,6 +111271,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -110289,10 +111320,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -110421,6 +111454,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -110458,6 +111492,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -110485,6 +111520,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 4))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -110560,6 +111596,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110603,10 +111640,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -110631,11 +111670,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110703,6 +111744,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -110719,6 +111761,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110802,11 +111845,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 8)) = TToken{ - Fz: __ccgo_ts + 6571, + Fz: __ccgo_ts + 6596, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6567, + Fz: __ccgo_ts + 6592, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 { @@ -110865,6 +111908,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -110872,7 +111916,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5200) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5225) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = uint8(OE_Abort) } @@ -110974,6 +112018,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -111029,6 +112074,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -111150,6 +112196,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = uint8(0) @@ -111190,6 +112237,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*uint8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -111326,6 +112374,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -111336,6 +112385,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -111400,6 +112450,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -111426,6 +112477,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 24)) = pTab @@ -111467,11 +112519,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+40, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8162, libc.VaList(bp+40, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -111597,6 +112650,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111704,6 +112758,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111982,6 +113037,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8 + 4)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -112004,13 +113060,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin _ = libc.Int32FromInt32(0) } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16050, libc.VaList(bp+88, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16084, libc.VaList(bp+88, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -112018,13 +113075,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16091, libc.VaList(bp+88, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16125, libc.VaList(bp+88, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*8))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -112119,6 +113177,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -112139,16 +113198,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16123, libc.VaList(bp+88, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16157, libc.VaList(bp+88, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16175, libc.VaList(bp+88, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16209, libc.VaList(bp+88, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -112181,6 +113241,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 44)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -112191,11 +113252,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16200, libc.VaList(bp+88, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16234, libc.VaList(bp+88, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16246, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16280, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -112209,7 +113270,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -112313,6 +113374,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112353,6 +113415,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -112512,6 +113575,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -112525,9 +113589,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16267) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16301) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -112922,7 +113987,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*uint8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -115171,10 +116258,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16316, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16350, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -115191,9 +116279,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16320, uint32(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16354, uint32(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -115205,7 +116294,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16326, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16360, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115220,7 +116309,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16369, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16403, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -115242,6 +116331,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*4)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -115249,7 +116339,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16401, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16435, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115258,7 +116348,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16281, + 0: __ccgo_ts + 16315, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -115289,6 +116379,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115372,6 +116463,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115423,6 +116515,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -115490,12 +116583,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16438, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16472, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -115543,63 +116637,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5456, - 1: __ccgo_ts + 16477, - 2: __ccgo_ts + 9033, - 3: __ccgo_ts + 16481, - 4: __ccgo_ts + 16486, - 5: __ccgo_ts + 16489, - 6: __ccgo_ts + 16499, - 7: __ccgo_ts + 16509, - 8: __ccgo_ts + 16515, - 9: __ccgo_ts + 16519, - 10: __ccgo_ts + 16524, - 11: __ccgo_ts + 16529, - 12: __ccgo_ts + 16537, - 13: __ccgo_ts + 16548, - 14: __ccgo_ts + 16551, - 15: __ccgo_ts + 16558, - 16: __ccgo_ts + 16519, - 17: __ccgo_ts + 16524, - 18: __ccgo_ts + 16565, - 19: __ccgo_ts + 16570, - 20: __ccgo_ts + 16573, - 21: __ccgo_ts + 16580, - 22: __ccgo_ts + 16515, - 23: __ccgo_ts + 16519, - 24: __ccgo_ts + 16586, - 25: __ccgo_ts + 16591, - 26: __ccgo_ts + 16596, - 27: __ccgo_ts + 16519, - 28: __ccgo_ts + 16600, - 29: __ccgo_ts + 16524, - 30: __ccgo_ts + 16608, - 31: __ccgo_ts + 16612, - 32: __ccgo_ts + 16617, - 33: __ccgo_ts + 11772, - 34: __ccgo_ts + 11768, - 35: __ccgo_ts + 16623, - 36: __ccgo_ts + 16628, - 37: __ccgo_ts + 16633, - 38: __ccgo_ts + 16477, - 39: __ccgo_ts + 16519, - 40: __ccgo_ts + 16638, - 41: __ccgo_ts + 16645, - 42: __ccgo_ts + 16652, - 43: __ccgo_ts + 9033, - 44: __ccgo_ts + 16660, - 45: __ccgo_ts + 5459, - 46: __ccgo_ts + 16666, - 47: __ccgo_ts + 16477, - 48: __ccgo_ts + 16519, - 49: __ccgo_ts + 16671, - 50: __ccgo_ts + 16676, - 51: __ccgo_ts + 15873, - 52: __ccgo_ts + 16681, - 53: __ccgo_ts + 16694, - 54: __ccgo_ts + 16703, - 55: __ccgo_ts + 16710, - 56: __ccgo_ts + 16721, + 0: __ccgo_ts + 5481, + 1: __ccgo_ts + 16511, + 2: __ccgo_ts + 9058, + 3: __ccgo_ts + 16515, + 4: __ccgo_ts + 16520, + 5: __ccgo_ts + 16523, + 6: __ccgo_ts + 16533, + 7: __ccgo_ts + 16543, + 8: __ccgo_ts + 16549, + 9: __ccgo_ts + 16553, + 10: __ccgo_ts + 16558, + 11: __ccgo_ts + 16563, + 12: __ccgo_ts + 16571, + 13: __ccgo_ts + 16582, + 14: __ccgo_ts + 16585, + 15: __ccgo_ts + 16592, + 16: __ccgo_ts + 16553, + 17: __ccgo_ts + 16558, + 18: __ccgo_ts + 16599, + 19: __ccgo_ts + 16604, + 20: __ccgo_ts + 16607, + 21: __ccgo_ts + 16614, + 22: __ccgo_ts + 16549, + 23: __ccgo_ts + 16553, + 24: __ccgo_ts + 16620, + 25: __ccgo_ts + 16625, + 26: __ccgo_ts + 16630, + 27: __ccgo_ts + 16553, + 28: __ccgo_ts + 16634, + 29: __ccgo_ts + 16558, + 30: __ccgo_ts + 16642, + 31: __ccgo_ts + 16646, + 32: __ccgo_ts + 16651, + 33: __ccgo_ts + 11797, + 34: __ccgo_ts + 11793, + 35: __ccgo_ts + 16657, + 36: __ccgo_ts + 16662, + 37: __ccgo_ts + 16667, + 38: __ccgo_ts + 16511, + 39: __ccgo_ts + 16553, + 40: __ccgo_ts + 16672, + 41: __ccgo_ts + 16679, + 42: __ccgo_ts + 16686, + 43: __ccgo_ts + 9058, + 44: __ccgo_ts + 16694, + 45: __ccgo_ts + 5484, + 46: __ccgo_ts + 16700, + 47: __ccgo_ts + 16511, + 48: __ccgo_ts + 16553, + 49: __ccgo_ts + 16705, + 50: __ccgo_ts + 16710, + 51: __ccgo_ts + 15907, + 52: __ccgo_ts + 16715, + 53: __ccgo_ts + 16728, + 54: __ccgo_ts + 16737, + 55: __ccgo_ts + 16744, + 56: __ccgo_ts + 16755, } // C documentation @@ -115619,191 +116713,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16729, + FzName: __ccgo_ts + 16763, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16744, + FzName: __ccgo_ts + 16778, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16759, + FzName: __ccgo_ts + 16793, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16771, + FzName: __ccgo_ts + 16805, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16787, + FzName: __ccgo_ts + 16821, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16710, + FzName: __ccgo_ts + 16744, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16800, + FzName: __ccgo_ts + 16834, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16812, + FzName: __ccgo_ts + 16846, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16832, + FzName: __ccgo_ts + 16866, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16848, + FzName: __ccgo_ts + 16882, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16869, + FzName: __ccgo_ts + 16903, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16884, + FzName: __ccgo_ts + 16918, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16900, + FzName: __ccgo_ts + 16934, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16914, + FzName: __ccgo_ts + 16948, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16927, + FzName: __ccgo_ts + 16961, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16941, + FzName: __ccgo_ts + 16975, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16960, + FzName: __ccgo_ts + 16994, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16979, + FzName: __ccgo_ts + 17013, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17002, + FzName: __ccgo_ts + 17036, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17011, + FzName: __ccgo_ts + 17045, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17029, + FzName: __ccgo_ts + 17063, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17046, + FzName: __ccgo_ts + 17080, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17059, + FzName: __ccgo_ts + 17093, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17074, + FzName: __ccgo_ts + 17108, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17092, + FzName: __ccgo_ts + 17126, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17102, + FzName: __ccgo_ts + 17136, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17116, + FzName: __ccgo_ts + 17150, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17132, + FzName: __ccgo_ts + 17166, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17157, + FzName: __ccgo_ts + 17191, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17176, + FzName: __ccgo_ts + 17210, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17187, + FzName: __ccgo_ts + 17221, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17198, + FzName: __ccgo_ts + 17232, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -115811,146 +116905,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17210, + FzName: __ccgo_ts + 17244, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17226, + FzName: __ccgo_ts + 17260, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17239, + FzName: __ccgo_ts + 17273, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17258, + FzName: __ccgo_ts + 17292, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17277, + FzName: __ccgo_ts + 17311, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17290, + FzName: __ccgo_ts + 17324, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17305, + FzName: __ccgo_ts + 17339, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17315, + FzName: __ccgo_ts + 17349, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17327, + FzName: __ccgo_ts + 17361, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17336, + FzName: __ccgo_ts + 17370, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17347, + FzName: __ccgo_ts + 17381, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17357, + FzName: __ccgo_ts + 17391, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17369, + FzName: __ccgo_ts + 17403, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17414, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17392, + FzName: __ccgo_ts + 17426, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17409, + FzName: __ccgo_ts + 17443, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17428, + FzName: __ccgo_ts + 17462, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17454, + FzName: __ccgo_ts + 17488, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17469, + FzName: __ccgo_ts + 17503, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17517, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17502, + FzName: __ccgo_ts + 17536, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17516, + FzName: __ccgo_ts + 17550, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17532, + FzName: __ccgo_ts + 17566, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17544, + FzName: __ccgo_ts + 17578, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17555, + FzName: __ccgo_ts + 17589, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17566, + FzName: __ccgo_ts + 17600, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -115958,45 +117052,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17578, + FzName: __ccgo_ts + 17612, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17589, + FzName: __ccgo_ts + 17623, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17610, + FzName: __ccgo_ts + 17644, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17618, + FzName: __ccgo_ts + 17652, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17633, + FzName: __ccgo_ts + 17667, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17646, + FzName: __ccgo_ts + 17680, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17665, + FzName: __ccgo_ts + 17699, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17680, + FzName: __ccgo_ts + 17714, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -116038,6 +117132,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -116096,10 +117191,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17696) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17730) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17706) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17740) { return PAGER_LOCKINGMODE_NORMAL } } @@ -116117,13 +117212,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8193) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8218) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17713) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17747) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17718) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17752) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -116146,10 +117241,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*uint8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*uint8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16671) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16705) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17730) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17764) == 0 { return int32(2) } else { return 0 @@ -116171,7 +117266,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17737, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17771, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpBt) @@ -116232,6 +117327,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -116305,15 +117401,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17799 + zName = __ccgo_ts + 17833 case int32(OE_SetDflt): - zName = __ccgo_ts + 17808 + zName = __ccgo_ts + 17842 case int32(OE_Cascade): - zName = __ccgo_ts + 17820 + zName = __ccgo_ts + 17854 case int32(OE_Restrict): - zName = __ccgo_ts + 17828 + zName = __ccgo_ts + 17862 default: - zName = __ccgo_ts + 17837 + zName = __ccgo_ts + 17871 _ = libc.Int32FromInt32(0) break } @@ -116342,12 +117438,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17847, - 1: __ccgo_ts + 17854, - 2: __ccgo_ts + 17862, - 3: __ccgo_ts + 17866, - 4: __ccgo_ts + 17730, - 5: __ccgo_ts + 17875, + 0: __ccgo_ts + 17881, + 1: __ccgo_ts + 17888, + 2: __ccgo_ts + 17896, + 3: __ccgo_ts + 17900, + 4: __ccgo_ts + 17764, + 5: __ccgo_ts + 17909, } // C documentation @@ -116413,25 +117509,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17900 + zType = __ccgo_ts + 17934 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17936 } else { - zType = __ccgo_ts + 7592 + zType = __ccgo_ts + 7617 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17904, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17938, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17879, - 2: __ccgo_ts + 17884, - 3: __ccgo_ts + 17892, + 1: __ccgo_ts + 17913, + 2: __ccgo_ts + 17918, + 3: __ccgo_ts + 17926, } // C documentation @@ -116472,8 +117569,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(208) defer tls.Free(208) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -116501,7 +117598,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+44 */ int32 var _ /* sz at bp+48 */ Tsqlite3_int64 var _ /* x at bp+24 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -116530,7 +117627,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17911, libc.VaList(bp+136, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17945, libc.VaList(bp+136, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -116681,7 +117778,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p b = -int32(1) _ = libc.Int32FromInt32(0) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17915) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17949) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -116696,6 +117793,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*16))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -116751,7 +117849,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17706 + zRet = __ccgo_ts + 17740 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -116771,6 +117869,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -116780,7 +117879,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } _ = libc.Int32FromInt32(0) if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17696 + zRet = __ccgo_ts + 17730 } _returnSingleText(tls, v, zRet) break @@ -116790,7 +117889,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -116809,6 +117908,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -116838,6 +117938,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -117020,6 +118121,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -117072,7 +118174,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*uint8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+56) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 56)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17954, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -117104,7 +118206,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17979, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -117137,7 +118239,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17998) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18032) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -117211,6 +118313,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } @@ -117219,9 +118322,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18004 + v14 = __ccgo_ts + 18038 } else { - v14 = __ccgo_ts + 18012 + v14 = __ccgo_ts + 18046 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0 { v15 = int32(1) @@ -117236,6 +118339,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+136, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 12 } @@ -117291,7 +118395,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18019, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18053, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 60)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+60, uintptr(0)) @@ -117307,6 +118411,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117320,25 +118425,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13019 + zType = __ccgo_ts + 13044 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18035 + zType = __ccgo_ts + 18069 } else { - zType = __ccgo_ts + 9033 + zType = __ccgo_ts + 9058 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18042, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*16))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*16))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117378,13 +118485,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*12))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18049, libc.VaList(bp+136, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18083, libc.VaList(bp+136, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18054, libc.VaList(bp+136, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18088, libc.VaList(bp+136, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117403,13 +118511,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18059, - 1: __ccgo_ts + 18061, - 2: __ccgo_ts + 16548, + 0: __ccgo_ts + 18093, + 1: __ccgo_ts + 18095, + 2: __ccgo_ts + 16582, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18063, libc.VaList(bp+136, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 56))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18097, libc.VaList(bp+136, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 56))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117426,9 +118535,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _24 } _ = libc.Int32FromInt32(0) - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18069, libc.VaList(bp+136, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18103, libc.VaList(bp+136, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*16))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117442,9 +118552,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18073, libc.VaList(bp+136, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18107, libc.VaList(bp+136, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117464,10 +118575,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 36)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 432)).Ffirst @@ -117480,6 +118593,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -117490,9 +118604,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+136, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+136, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -117501,9 +118616,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint32FromInt64(1056)/libc.Uint32FromInt64(16))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+136, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+136, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -117526,9 +118642,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+136, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FiFrom)*12))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25))), __ccgo_ts+18085)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18110, libc.VaList(bp+136, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FiFrom)*12))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 36 + uintptr(j2)*8))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 25))), __ccgo_ts+18119)) goto _32 _32: + ; j2++ } i7++ @@ -117537,7 +118654,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 44)) += int32(4) v34 = pParse + 44 @@ -117598,6 +118715,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117648,6 +118766,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -117669,12 +118788,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18090, libc.VaList(bp+136, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18124, libc.VaList(bp+136, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 68))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117797,6 +118917,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -117805,6 +118926,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -117847,10 +118969,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -117861,7 +118985,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18094, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*16))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18128, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*16))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -117879,50 +119003,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).FazArg)) - if _sqlite3HashFind(tls, db+404, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 44))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -117947,6 +119027,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117972,6 +119053,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -117989,13 +119071,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 76)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 76)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18118, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18152, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -118004,6 +119086,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 76)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -118071,9 +119154,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18188, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -118087,7 +119171,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18174, libc.VaList(bp+136, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18208, libc.VaList(bp+136, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 4))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -118095,7 +119179,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18196, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18230, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -118106,10 +119190,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 76)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18219, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18253, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18221, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18255, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*12))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -118119,6 +119203,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -118136,12 +119221,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*20))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18241, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18275, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -118165,9 +119251,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 80))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18276) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18310) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -118180,9 +119266,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 80))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18297) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18331) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18333) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18367) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -118204,14 +119290,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18344) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18378) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -118233,13 +119320,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 80))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 80))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18371) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18405) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -118247,6 +119335,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 88))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118254,7 +119343,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 76)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18398) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18432) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -118273,6 +119362,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118282,17 +119372,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).FazArg)) + if _sqlite3HashFind(tls, db+404, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 44))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint32FromInt64(28)/libc.Uint32FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 72)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*20))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16)) = __ccgo_ts + 18427 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16)) = __ccgo_ts + 18461 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*20))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*20 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118353,27 +119510,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 8 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18488, libc.VaList(bp+136, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18522, libc.VaList(bp+136, zRight)) } } } @@ -118451,11 +119609,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118471,20 +119629,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17713) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17747) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18513) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18547) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17866) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17900) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -118508,11 +119666,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg) + v64 = int32((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -118580,7 +119738,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -118589,22 +119747,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 40 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 40 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema @@ -118613,17 +119771,17 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) _ = libc.Int32FromInt32(0) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -118632,15 +119790,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18521, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18555, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -118648,12 +119807,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -118752,6 +119913,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -118881,34 +120043,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18430, + FzName: __ccgo_ts + 18464, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18435, + FzName: __ccgo_ts + 18469, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18441, + FzName: __ccgo_ts + 18475, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18450, + FzName: __ccgo_ts + 18484, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18459, + FzName: __ccgo_ts + 18493, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18467, + FzName: __ccgo_ts + 18501, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18475, + FzName: __ccgo_ts + 18509, }, 7: { - FzName: __ccgo_ts + 18482, + FzName: __ccgo_ts + 18516, }, 8: {}, } @@ -119006,34 +120168,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+24, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18539) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18573) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18554, libc.VaList(bp+232, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18588, libc.VaList(bp+232, int32(cSep), _pragCName[j])) cSep = uint8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18561, libc.VaList(bp+232, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18595, libc.VaList(bp+232, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18567) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18601) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18579) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18613) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) _sqlite3StrAccumFinish(tls, bp) _ = libc.Int32FromInt32(0) rc = Xsqlite3_declare_vtab(tls, db, bp+24) @@ -119109,6 +120272,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -119121,6 +120285,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -119164,6 +120330,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 16 + uintptr(i)*4)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -119239,17 +120406,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 120 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18594) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18628) if *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18602, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18636, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16 + 1*4)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 16)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18606, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18640, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(pCsr + 16)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -119386,24 +120554,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18640, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18674, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*4)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*4)) } else { - v1 = __ccgo_ts + 5083 + v1 = __ccgo_ts + 5108 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18668, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18702, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*uint8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18699, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18733, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119411,9 +120579,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18610, - 1: __ccgo_ts + 18617, - 2: __ccgo_ts + 18629, + 0: __ccgo_ts + 18644, + 1: __ccgo_ts + 18651, + 2: __ccgo_ts + 18663, } // C documentation @@ -119436,6 +120604,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119492,7 +120661,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), db+172) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } libc.SetBitFieldPtr8Uint32(db+172+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -119527,11 +120696,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*4)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18707) + _corruptSchema(tls, pData, argv, __ccgo_ts+18741) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), pIndex+44) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } } @@ -119575,18 +120744,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9033 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9058 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8105 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18720 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8130 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18754 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 44))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 44))).FiDb = iDb @@ -119648,6 +120817,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+24+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -119675,7 +120845,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 24)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12070) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12095) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119701,7 +120871,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18792) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18826) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119717,7 +120887,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl */ _ = libc.Int32FromInt32(0) (*(*TInitData)(unsafe.Pointer(bp + 44))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18816, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18850, libc.VaList(bp+80, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+44, uintptr(0)) @@ -119756,11 +120926,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 120 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18880, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18914, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -120215,6 +121391,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -120226,7 +121403,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -120241,6 +121418,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120379,6 +121557,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -120764,6 +121943,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint32FromInt64(21)/libc.Uint32FromInt64(3)) { @@ -120772,18 +121952,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11177 - zSp2 = __ccgo_ts + 11177 + zSp1 = __ccgo_ts + 11202 + zSp2 = __ccgo_ts + 11202 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18899, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18933, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -120856,6 +122037,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 12 i++ } @@ -120915,6 +122097,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -120967,6 +122150,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 20)) + 8 + uintptr(i)*20))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -121017,6 +122201,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 20)) + 8 + uintptr(i)*20))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -121082,7 +122267,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 48)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18929, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18963, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -121104,6 +122289,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -121134,7 +122320,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*8))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18979, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19013, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -121156,7 +122342,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 36 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*72 + 36 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*72 + 48)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19043, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19077, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -121180,6 +122366,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -121192,6 +122379,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 72 pLeft += 72 @@ -121200,7 +122388,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6705, + Fz: __ccgo_ts + 6730, Fn: uint32(8), } @@ -121460,7 +122648,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121482,6 +122670,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121622,6 +122811,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -121651,6 +122841,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -121667,6 +122858,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121808,9 +123000,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _ = libc.Int32FromInt32(0) /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -121857,6 +123049,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*20 + 16)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -121977,6 +123170,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 20 } @@ -121994,13 +123188,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19080 + z = __ccgo_ts + 19114 case int32(TK_INTERSECT): - z = __ccgo_ts + 19090 + z = __ccgo_ts + 19124 case int32(TK_EXCEPT): - z = __ccgo_ts + 19100 + z = __ccgo_ts + 19134 default: - z = __ccgo_ts + 19107 + z = __ccgo_ts + 19141 break } return z @@ -122021,7 +123215,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+8, zUsage)) } /* @@ -122056,11 +123250,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19136 + v1 = __ccgo_ts + 19170 } else { v1 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19185, libc.VaList(bp+8, v1)) _ = libc.Int32FromInt32(0) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) @@ -122124,6 +123318,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -122141,6 +123336,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -122255,6 +123451,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -122290,7 +123487,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*20))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 12))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 12))).FpNext = pNC @@ -122306,7 +123503,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr _ = libc.Int32FromInt32(0) if iCol < 0 { zType = __ccgo_ts + 1136 - *(*uintptr)(unsafe.Pointer(bp + 8)) = __ccgo_ts + 16660 + *(*uintptr)(unsafe.Pointer(bp + 8)) = __ccgo_ts + 16694 } else { *(*uintptr)(unsafe.Pointer(bp + 8)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*12, uintptr(0)) @@ -122376,6 +123573,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122458,13 +123656,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } _ = libc.Int32FromInt32(0) if iCol < 0 { - zCol = __ccgo_ts + 16660 + zCol = __ccgo_ts + 16694 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122472,7 +123670,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*20))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122482,6 +123680,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122565,7 +123764,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName } else { - v3 = __ccgo_ts + 16660 + v3 = __ccgo_ts + 16694 } zName = v3 } else { @@ -122581,7 +123780,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+32, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+32, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122608,6 +123807,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*uint8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -122616,7 +123816,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19191, libc.VaList(bp+32, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19225, libc.VaList(bp+32, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -122633,6 +123833,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 12 } @@ -122646,6 +123847,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*12))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -122715,6 +123917,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*20))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -122731,7 +123934,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19199 + zType = __ccgo_ts + 19233 } else { zType = uintptr(0) j = int32(1) @@ -122745,6 +123948,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -122768,6 +123972,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 12 } @@ -122992,6 +124197,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -123050,7 +124256,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19203, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19237, 0) return } /* Obtain authorization to do a recursive query */ @@ -123081,6 +124287,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -123142,7 +124349,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19252, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19286, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -123151,12 +124358,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19294, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19328, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -123184,7 +124392,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19300, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19334, 0) _sqlite3Select(tls, pParse, p, bp) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -123192,6 +124400,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -123243,9 +124452,9 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if nRow == int32(1) { v1 = __ccgo_ts + 1648 } else { - v1 = __ccgo_ts + 19315 + v1 = __ccgo_ts + 19349 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19317, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19351, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123360,8 +124569,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19340, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19355, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19389, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123387,7 +124596,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19080, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19114, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123400,7 +124609,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -123444,7 +124653,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 32))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+32) _ = libc.Int32FromInt32(0) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior @@ -123510,7 +124719,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 60))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+96, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+60) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123580,6 +124789,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 4 } @@ -123605,15 +124815,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123632,9 +124845,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19429, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19441, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19475, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -123892,6 +125105,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 20 } @@ -123913,6 +125127,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -123941,6 +125156,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 16))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 20 } @@ -123972,6 +125188,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -123989,6 +125206,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -124004,6 +125222,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -124014,8 +125233,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7342) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7367) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -124059,14 +125278,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+28, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19523, libc.VaList(bp+64, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19557, libc.VaList(bp+64, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19534, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19568, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -124079,7 +125298,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19539, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19573, 0) _sqlite3Select(tls, pParse, p, bp+28) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -124297,7 +125516,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5061 + v1 = __ccgo_ts + 5086 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124338,6 +125557,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr) goto _1 _1: + ; i++ } } @@ -124370,11 +125590,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 72 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124468,11 +125690,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 72 } @@ -124594,10 +125818,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -124906,6 +126132,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -124920,6 +126147,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -125030,6 +126258,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _ = libc.Int32FromInt32(0) goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -125129,6 +126358,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*72, 0, uint32(72)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*72 + 36 @@ -125167,6 +126397,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*20 + 16)) = uint16(0) goto _12 _12: + ; i++ } _ = libc.Int32FromInt32(0) @@ -125218,10 +126449,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*72) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -125302,6 +126535,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125408,6 +126642,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125663,6 +126898,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125702,6 +126941,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -125726,10 +126966,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -125821,6 +127063,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -125843,6 +127086,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -125876,10 +127120,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -125920,13 +127166,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r } _ = libc.Int32FromInt32(0) zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15516) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15550) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15520) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15554) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -126018,10 +127264,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19545, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19579, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -126073,6 +127320,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -126097,6 +127345,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -126146,7 +127395,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 36 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19563, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19597, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -126187,6 +127436,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -126194,6 +127444,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -126326,7 +127577,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 36 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19586, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 64)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19620, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 64)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+36+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126351,7 +127602,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+36+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19606, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19640, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126365,6 +127616,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126372,7 +127624,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19649 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19683 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -126402,12 +127654,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19672, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19706, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126416,9 +127669,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+34, pTab+4) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19710 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19744 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19778 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126479,13 +127732,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19782, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19816, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+34, pTab+4) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) _ = libc.Int32FromInt32(0) /* The usual case - do not allow ROWID on a subquery */ @@ -126642,7 +127896,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19786, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19820, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126658,7 +127912,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19825, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19859, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126673,7 +127927,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 44))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } _ = libc.Int32FromInt32(0) @@ -126692,6 +127946,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 72 } @@ -126729,6 +127984,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -126808,7 +128064,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName } else { - v10 = __ccgo_ts + 6565 + v10 = __ccgo_ts + 6590 } zSchemaName = v10 } @@ -126826,18 +128082,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*20 _ = libc.Int32FromInt32(0) - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19856, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19890, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+8+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+8+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -126900,10 +128160,11 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*20 _ = libc.Int32FromInt32(0) if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { + _ = libc.Int32FromInt32(0) (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*20))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19861, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19895, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -126916,7 +128177,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+8+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -126925,23 +128186,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 72 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19904, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19888, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19922, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -126949,7 +128213,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 120 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19908, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19942, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -127034,6 +128298,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 72 } @@ -127139,6 +128404,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 24)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -127173,6 +128439,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -127239,6 +128506,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*24))).FpFExpr) goto _1 _1: + ; i++ } } @@ -127307,12 +128575,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pE + 20)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 20)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19939, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19973, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 20)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19990, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20024, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -127338,10 +128606,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20023, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20057, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 24 } @@ -127390,6 +128659,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127404,6 +128674,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -127426,6 +128697,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 24 } @@ -127547,6 +128819,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127587,6 +128860,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 20 } @@ -127612,6 +128886,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 24 } @@ -127631,6 +128906,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 16 } @@ -127655,7 +128931,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20056 + v1 = __ccgo_ts + 20090 } else { v1 = __ccgo_ts + 1648 } @@ -127664,7 +128940,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20079, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20113, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127696,7 +128972,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -127856,7 +129132,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 return 0 } /* Result is an aggregate */ _ = libc.Int32FromInt32(0) - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15810) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15844) != 0 { return 0 } /* Is count() */ _ = libc.Int32FromInt32(0) @@ -127960,6 +129236,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -128128,7 +129405,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20091, libc.VaList(bp+128, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20125, libc.VaList(bp+128, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -128204,6 +129481,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -128218,6 +129496,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -128229,7 +129508,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20145, libc.VaList(bp+128, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20179, libc.VaList(bp+128, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -128313,6 +129592,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128412,7 +129692,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+56, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20185, libc.VaList(bp+128, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20219, libc.VaList(bp+128, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+56) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+36+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128460,7 +129740,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+56, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20200, libc.VaList(bp+128, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20234, libc.VaList(bp+128, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+56) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128486,6 +129766,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128555,6 +129836,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128567,6 +129849,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128680,6 +129963,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 16))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 20 } @@ -128695,6 +129979,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 16))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 20 } @@ -128725,6 +130010,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*20))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 12))).FpOrderBy, -int32(1)) == 0 { @@ -128872,11 +130158,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20216 + v44 = __ccgo_ts + 20250 } else { - v44 = __ccgo_ts + 20225 + v44 = __ccgo_ts + 20259 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+128, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+128, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -128892,6 +130178,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -128910,6 +130197,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -128971,6 +130259,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -129088,6 +130377,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -129132,6 +130422,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -129195,7 +130486,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20216) + _explainTempTable(tls, pParse, __ccgo_ts+20250) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -129214,6 +130505,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 52))) @@ -129312,12 +130604,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*4)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20234, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20268, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129346,12 +130639,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*4)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129458,6 +130753,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129574,7 +130870,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20333, 0) goto trigger_cleanup } iDb = int32(1) @@ -129615,7 +130911,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } _ = libc.Int32FromInt32(0) - _sqlite3FixInit(tls, bp+4, pParse, iDb, __ccgo_ts+20345, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+4, pParse, iDb, __ccgo_ts+20379, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+4, pTableName) != 0 { goto trigger_cleanup } @@ -129625,11 +130921,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20353, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20387, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20394, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20428, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -129639,14 +130935,14 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20345, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20379, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } _ = libc.Int32FromInt32(0) if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpSchema+40, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20434, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20468, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -129655,8 +130951,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20460, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20494, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129664,15 +130960,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20498 + v1 = __ccgo_ts + 20532 } else { - v1 = __ccgo_ts + 20505 + v1 = __ccgo_ts + 20539 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20511, libc.VaList(bp+64, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20545, libc.VaList(bp+64, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20548, libc.VaList(bp+64, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20582, libc.VaList(bp+64, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129692,9 +130988,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129737,6 +131033,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129748,6 +131045,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129792,7 +131090,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+56, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20345, bp+56) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20379, bp+56) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -129815,11 +131113,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20594, libc.VaList(bp+72, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20628, libc.VaList(bp+72, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129830,10 +131129,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20642, libc.VaList(bp+72, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20676, libc.VaList(bp+72, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20717, libc.VaList(bp+72, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20751, libc.VaList(bp+72, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -129854,6 +131153,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _ = libc.Int32FromInt32(0) _sqlite3DeleteTriggerStep(tls, db, pStepList) @@ -129881,6 +131181,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -130101,11 +131402,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20746, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20780, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -130114,6 +131416,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -130147,9 +131450,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if iDb == int32(1) { @@ -130164,7 +131467,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20766, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20800, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -130196,6 +131499,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } } @@ -130232,6 +131536,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -130298,11 +131603,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20828 + v1 = __ccgo_ts + 20862 } else { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20842, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20876, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -130320,6 +131625,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130407,7 +131713,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20924, 0) return int32(1) } @@ -130452,6 +131758,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130465,6 +131772,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130546,6 +131854,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130602,7 +131911,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+40, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+40, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130624,6 +131933,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130708,7 +132018,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+36) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20932, libc.VaList(bp+328, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20966, libc.VaList(bp+328, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130776,6 +132086,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130893,6 +132204,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -130957,6 +132269,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -131160,6 +132473,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -131178,6 +132492,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -131201,6 +132516,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -131337,6 +132653,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -131366,6 +132683,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131414,7 +132732,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20946, libc.VaList(bp+80, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20980, libc.VaList(bp+80, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName)) goto update_cleanup } } @@ -131424,6 +132742,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131433,13 +132752,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+80, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+80, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*20))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7880 + v11 = __ccgo_ts + 7905 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FzCnName } @@ -131453,6 +132772,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) @@ -131486,6 +132806,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131541,6 +132862,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131550,6 +132872,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131772,6 +133095,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131842,6 +133166,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131900,6 +133225,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -131965,6 +133291,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -132015,6 +133342,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -132126,9 +133454,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21001) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21035) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -132225,6 +133554,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -132259,6 +133589,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -132310,6 +133641,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132425,7 +133757,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(176) defer tls.Free(176) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132534,6 +133866,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132542,6 +133875,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132550,22 +133884,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]uint8)(unsafe.Pointer(bp + 140)))[0] = uint8(0) } else { - Xsqlite3_snprintf(tls, int32(16), bp+140, __ccgo_ts+21014, libc.VaList(bp+168, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+140, __ccgo_ts+21048, libc.VaList(bp+168, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+168, bp+140)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21052, libc.VaList(bp+168, bp+140)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132586,14 +133930,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132656,10 +134006,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12445, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12470, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132678,6 +134029,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132741,7 +134093,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21091, uint32(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21095, uint32(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21125, uint32(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21129, uint32(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -132843,6 +134195,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132868,17 +134221,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21099) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21133) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21139) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21173) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21182) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21216) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -132917,7 +134270,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21200, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21234, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -132931,7 +134284,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21223) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21257) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 24)) |= uint32(DBFLAG_VacuumInto) @@ -132948,7 +134301,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14854) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14879) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132979,11 +134332,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21250, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21284, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21358, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21392, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132992,7 +134345,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21412, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21446, libc.VaList(bp+24, zDbMain)) _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(db + 24)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { @@ -133003,7 +134356,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21563, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21597, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -133024,6 +134377,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -133045,6 +134399,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -133238,6 +134593,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*4)) != uintptr(0) { @@ -133247,6 +134603,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -133306,6 +134663,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -133417,6 +134775,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 24 } } @@ -133506,6 +134865,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133543,7 +134903,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 44))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 120 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133670,7 +135030,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32((*TToken)(unsafe.Pointer(pEnd)).Fz)-int32((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21693, libc.VaList(bp+8, pParse+200)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21727, libc.VaList(bp+8, pParse+200)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133680,11 +135040,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21717, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21751, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21816, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21850, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 44 @@ -133774,11 +135134,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21835, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21869, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133818,7 +135179,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, _ = libc.Int32FromInt32(0) if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21877, libc.VaList(bp+32, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21911, libc.VaList(bp+32, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 16)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -133833,7 +135194,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21907 + zFormat = __ccgo_ts + 21941 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+32, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133867,11 +135228,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16551, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16585, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133889,6 +135251,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*uint8)(unsafe.Pointer(zType + uintptr(j))) = *(*uint8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -133904,6 +135267,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133948,7 +135312,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 44))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21953, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21987, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -134036,7 +135400,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21953, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21987, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -134071,9 +135435,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _ = libc.Int32FromInt32(0) @@ -134177,6 +135541,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -134237,6 +135602,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -134277,6 +135643,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -134344,6 +135711,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -134419,6 +135787,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134528,6 +135897,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint32((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint32(4)) @@ -134664,7 +136034,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { _ = libc.Int32FromInt32(0) ap = va @@ -134678,7 +136048,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -135434,10 +136804,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21972 + return __ccgo_ts + 22006 } if i == -int32(1) { - return __ccgo_ts + 16660 + return __ccgo_ts + 16694 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*12))).FzCnName } @@ -135457,10 +136827,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, _ = i _ = libc.Int32FromInt32(0) if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135468,19 +136838,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135488,15 +136859,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } } @@ -135529,7 +136901,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135537,27 +136909,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21990 + v2 = __ccgo_ts + 22024 } else { - v2 = __ccgo_ts + 21995 + v2 = __ccgo_ts + 22029 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22003) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22037) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22039) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } // C documentation @@ -135600,11 +136973,11 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+24, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22007 + v2 = __ccgo_ts + 22041 } else { - v2 = __ccgo_ts + 22014 + v2 = __ccgo_ts + 22048 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22019, libc.VaList(bp+136, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22053, libc.VaList(bp+136, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) _ = libc.Int32FromInt32(0) @@ -135612,37 +136985,37 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11228 + zFmt = __ccgo_ts + 11253 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22025 + zFmt = __ccgo_ts + 22059 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22058 + zFmt = __ccgo_ts + 22092 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22083 + zFmt = __ccgo_ts + 22117 } else { - zFmt = __ccgo_ts + 22101 + zFmt = __ccgo_ts + 22135 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22110, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22144, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16660 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22118, libc.VaList(bp+136, zRowid)) + zRowid = __ccgo_ts + 16694 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22152, libc.VaList(bp+136, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = uint8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22149, libc.VaList(bp+136, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22183, libc.VaList(bp+136, zRowid)) cRangeOp = uint8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -135653,10 +137026,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22159, libc.VaList(bp+136, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22193, libc.VaList(bp+136, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22164, libc.VaList(bp+136, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22198, libc.VaList(bp+136, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135675,7 +137048,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22191, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135709,14 +137082,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+24, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22202, libc.VaList(bp+136, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22236, libc.VaList(bp+136, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+136, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+136, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*12))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22223, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22257, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135726,15 +137099,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22013, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+136, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+136, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135878,6 +137252,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135959,6 +137334,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135993,11 +137369,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*20 + 16)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -136059,6 +137437,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -136072,6 +137451,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -136187,6 +137567,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -136309,6 +137690,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -136362,6 +137744,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -136432,6 +137815,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -136473,6 +137857,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -136515,6 +137900,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 48 } @@ -136664,6 +138050,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 760 + uintptr(j)*88))).FaddrBrk @@ -136728,6 +138115,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136829,6 +138217,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136863,6 +138252,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -137289,6 +138679,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -137383,6 +138774,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*72, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*88))).FiFrom)*72, uint32(72)) goto _48 _48: + ; k++ } } else { @@ -137473,6 +138865,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -137488,7 +138881,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22231, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22265, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -137511,7 +138904,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22246, libc.VaList(bp+72, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22280, libc.VaList(bp+72, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) _ = libc.Int32FromInt32(0) if pSubWInfo != 0 { @@ -137546,6 +138939,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137619,6 +139013,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -137748,6 +139143,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 48 } @@ -137806,6 +139202,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 48 } @@ -137838,6 +139235,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137879,6 +139277,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137901,10 +139300,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 48 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137990,7 +139391,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*72 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22255, libc.VaList(bp+88, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22289, libc.VaList(bp+88, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -138004,6 +139405,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -138026,6 +139428,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -138060,6 +139463,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -138326,6 +139730,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*uint8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*uint8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*uint8)(unsafe.Pointer(zNew + uintptr(iTo))) = uint8(0) @@ -138456,6 +139861,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -138526,19 +139932,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16509, + FzOp: __ccgo_ts + 16543, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15840, + FzOp: __ccgo_ts + 15874, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15319, + FzOp: __ccgo_ts + 15353, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22269, + FzOp: __ccgo_ts + 22303, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138661,6 +140067,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp _ = libc.Int32FromInt32(0) goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138832,6 +140239,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 48 } @@ -138858,6 +140266,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 48 } @@ -138967,6 +140376,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 48 } @@ -139013,11 +140423,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 48 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -139045,6 +140457,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 48 } @@ -139143,6 +140556,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -139196,14 +140610,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -139247,10 +140664,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -139344,7 +140763,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } } else { @@ -139356,7 +140775,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -139447,7 +140866,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7866 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7891 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -139472,6 +140891,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -139527,6 +140947,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = _sqlite3UpperToLower[c] goto _11 _11: + ; i1++ } } @@ -139548,7 +140969,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { - v13 = __ccgo_ts + 22317 + v13 = __ccgo_ts + 22351 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -139601,6 +141022,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*48 @@ -139623,6 +141045,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139821,6 +141244,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139842,6 +141266,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -140013,6 +141438,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*20))).FpExpr) goto _1 _1: + ; i++ } } @@ -140040,6 +141466,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -140080,7 +141507,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -140108,6 +141535,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -140287,6 +141715,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -140384,6 +141813,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -140405,6 +141835,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -140412,6 +141843,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -140445,6 +141877,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -140562,6 +141995,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -140600,6 +142034,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 48 } @@ -140768,6 +142203,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140839,6 +142275,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140880,6 +142317,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140888,6 +142326,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140954,6 +142393,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 20 } @@ -141094,7 +142534,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143989,6 +145461,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 48 } } @@ -144118,6 +145591,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -144151,6 +145625,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 36 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -144227,6 +145702,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -144268,7 +145744,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*4)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*48 @@ -144333,6 +145809,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -144345,11 +145822,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*4)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -144497,7 +145975,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 20 + uintptr(iCons)*4)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*48 @@ -144548,6 +146026,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -144559,6 +146038,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -144671,6 +146151,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -144803,16 +146284,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+448, (*(*TWhereOrCost)(unsafe.Pointer(bp + 560 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 504 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 560 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 504 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 560 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 504 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 48 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144844,11 +146328,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 48 } return rc @@ -144923,6 +146409,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 72 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144936,7 +146423,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22423, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22457, 0) rc = SQLITE_OK } else { break @@ -144944,6 +146431,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 72 } @@ -145091,6 +146579,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -145109,6 +146598,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -145185,6 +146675,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -145262,6 +146753,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -145300,6 +146792,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -145327,11 +146820,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -145354,6 +146849,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -145517,6 +147013,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 4 @@ -145643,6 +147140,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -145708,16 +147206,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -145728,10 +147229,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22458, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22492, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -145747,6 +147249,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -145764,6 +147267,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*72))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145899,6 +147403,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*4)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145916,6 +147421,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -146059,6 +147565,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 48 } if pTerm < pEnd { @@ -146076,6 +147583,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 48 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -146086,6 +147594,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi _ = libc.Int32FromInt32(0) goto _1 _1: + ; i-- } return notReady @@ -146142,6 +147651,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -146160,9 +147670,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 _ = libc.Int32FromInt32(0) pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 @@ -146173,11 +147683,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*20))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*12))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*12) - bMaybeNullRow = 0 } else { goto _1 } @@ -146208,7 +147716,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i))) } @@ -146219,6 +147727,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -146248,6 +147757,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -146369,7 +147879,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22476, libc.VaList(bp+40, int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22510, libc.VaList(bp+40, int32(libc.Uint32FromInt64(8)*libc.Uint32FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -146442,7 +147952,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22504, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22538, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -146464,6 +147974,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*72, pWInfo+80) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -146524,6 +148035,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -146702,6 +148214,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -146812,6 +148325,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 88 } @@ -146863,6 +148377,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -146870,6 +148385,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146940,6 +148456,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 44)) += n + int32(1) @@ -147017,6 +148534,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -147056,6 +148574,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } _ = libc.Int32FromInt32(0) @@ -147166,6 +148685,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 20 v10 = pOp if !(v10 < pLastOp) { @@ -147175,6 +148695,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 88 } @@ -147456,7 +148977,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22522, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22556, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -147644,7 +149166,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22578, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22612, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147968,10 +149490,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22623, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22657, libc.VaList(bp+8, zName)) } return p } @@ -148022,12 +149545,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22642, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22676, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22713, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22747, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -148100,12 +149623,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) } break } goto _1 _1: + ; i++ } } @@ -148175,6 +149699,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -148198,6 +149723,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148223,6 +149749,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -148355,6 +149882,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -148383,7 +149911,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22776, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22810, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -148516,6 +150044,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -148676,7 +150205,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22802, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22836, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) @@ -148695,6 +150224,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -148742,18 +150272,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22834 + zErr = __ccgo_ts + 22868 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22851 + zErr = __ccgo_ts + 22885 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22867 + zErr = __ccgo_ts + 22901 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22921, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -148781,7 +150311,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22954, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148959,6 +150489,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149003,11 +150534,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22967, - 1: __ccgo_ts + 23020, - 2: __ccgo_ts + 22522, - 3: __ccgo_ts + 23071, - 4: __ccgo_ts + 23123, + 0: __ccgo_ts + 23001, + 1: __ccgo_ts + 23054, + 2: __ccgo_ts + 22556, + 3: __ccgo_ts + 23105, + 4: __ccgo_ts + 23157, } var _aOp1 = [5]int32{ @@ -149171,6 +150702,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -149231,6 +150763,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -149281,6 +150814,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -149309,6 +150843,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149360,6 +150895,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149409,6 +150945,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -149545,6 +151082,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149592,6 +151130,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -149622,6 +151161,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149987,6 +151527,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 36 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -150478,6 +152019,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -150809,11 +152351,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23173 + v1 = __ccgo_ts + 23207 } else { - v1 = __ccgo_ts + 23182 + v1 = __ccgo_ts + 23216 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23188, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23222, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -150822,7 +152364,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23230, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, 0) } } } @@ -150911,7 +152453,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23298, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -157224,103 +158766,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -157461,7 +159003,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23302, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23336, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158975,291 +160517,389 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+4) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+4) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+4) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 4)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*Tu32)(unsafe.Pointer(yymsp + 4)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*12 + 4)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) | *(*Tu32)(unsafe.Pointer(yymsp + 4)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16660, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16694, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16573, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 4)), __ccgo_ts+16607, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+80, *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)))) } *(*Tu32)(unsafe.Pointer(yymsp + 4)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*TToken)(unsafe.Pointer(yymsp + 4))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) = uint32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) - int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4 + 4)) = uint32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) - int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) + uint32(int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ _ = libc.Int32FromInt32(0) *(*TToken)(unsafe.Pointer(yymsp + 1*12 + 4)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 4))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+4) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) & ^*(*int32)(unsafe.Pointer(yymsp + 4 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*int32)(unsafe.Pointer(yymsp + 4)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*12+4, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 8)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), bp+8) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 4)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 4)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -159283,17 +160923,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*12 + 4)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) @@ -159301,10 +160946,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -159318,73 +160965,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) if *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+4, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32((*TParse)(unsafe.Pointer(pParse)).FzTail)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32((*TParse)(unsafe.Pointer(pParse)).FzTail)) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FnSrc-int32(1))*72))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 4))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), yymsp+4) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, uintptr(0), yymsp+4) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), yymsp+4) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 4)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 4 + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) } else { @@ -159418,142 +161089,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+4, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+4) } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+4) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+4, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+4) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+4) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4 + 4)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 4)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), __ccgo_ts+23351) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), __ccgo_ts+23385) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -159566,74 +161283,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+4) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 4))) @@ -159644,18 +161382,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+4, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 36)) = int32(*(*uintptr)(unsafe.Pointer(yymsp + 4))) - int32((*TParse)(unsafe.Pointer(pParse)).FzTail) } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4))))) == int32('#') && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)) + 1))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 4))) @@ -159667,7 +161409,7 @@ _200: /* expr ::= VARIABLE */ *(*TToken)(unsafe.Pointer(bp + 56)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) /*A-overwrites-X*/ _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+80, bp+56)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+80, bp+56)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -159677,47 +161419,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+4, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(8))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { @@ -159729,23 +161481,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) @@ -159758,7 +161520,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) @@ -159772,33 +161535,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -159807,17 +161579,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) @@ -159830,7 +161606,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) == uintptr(0) { /* Expressions of the form ** @@ -159842,9 +161619,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { - v345 = __ccgo_ts + 7861 + v345 = __ccgo_ts + 7886 } else { - v345 = __ccgo_ts + 7866 + v345 = __ccgo_ts + 7891 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { @@ -159887,18 +161664,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 4)) != 0 { @@ -159915,13 +161695,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { @@ -159936,73 +161718,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(11))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + 4)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 64))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) (*(*TToken)(unsafe.Pointer(bp + 64))).Fn = uint32(int32(*(*uintptr)(unsafe.Pointer(yymsp + 4)))-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))) + *(*uint32)(unsafe.Pointer(yymsp + 4 + 4)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), bp+64) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*12+4, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4 + 4)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) @@ -160011,239 +161815,312 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*12 + 4)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*12 + 4)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 4)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 4 + 4)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*TToken)(unsafe.Pointer(yymsp + 4)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23384, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23418, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23479, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23513, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23563, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23597, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*12 + 4))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)))).FaffExpr = uint8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)))).FaffExpr = uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 4)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, yymsp+4) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)) = uint32(int32((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int32(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), yymsp+4) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+4) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*12+4, yymsp+uintptr(-libc.Int32FromInt32(2))*12+4, yymsp+4, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+4) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 4)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*12+4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 4)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 4))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + 4))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _ = libc.Int32FromInt32(0) _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4 + 4)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(5))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*12 + 4)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4 + 4)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4 + 4)), *(*Tu8)(unsafe.Pointer(yymsp + 4))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 4)) *(*TFrameBound)(unsafe.Pointer(yymsp + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*12 + 4)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*Tu8)(unsafe.Pointer(yymsp + 4)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 4)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 4)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) } else { @@ -160252,11 +162129,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 4)) *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -160266,20 +162145,24 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) _ = libc.Int32FromInt32(0) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(100)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 4)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 4 + 4)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _342 _341: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -160298,6 +162181,7 @@ _341: goto _342 /********** End reduce actions ************************************************/ _342: + ; _ = libc.Int32FromInt32(0) yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) @@ -160333,9 +162217,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+16, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+16, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23648, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23682, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -162391,6 +164275,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -162570,6 +164455,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -162585,6 +164471,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -162629,6 +164516,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -162724,6 +164612,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -162755,6 +164644,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -162766,6 +164656,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -162800,6 +164691,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -162818,6 +164710,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -162841,6 +164734,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -162863,6 +164757,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -162881,6 +164776,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -162902,6 +164798,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -163021,7 +164918,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 1216))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 1216))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23665, libc.VaList(bp+1232, bp+1216)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23699, libc.VaList(bp+1232, bp+1216)) break } } @@ -163047,7 +164944,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+1232, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23690, libc.VaList(bp+1232, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23724, libc.VaList(bp+1232, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -163163,7 +165060,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*uint8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*uint8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -163173,9 +165070,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -163189,7 +165086,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -163201,7 +165098,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*uint8)(unsafe.Pointer(zSql)) != 0 && int32(*(*uint8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -163210,9 +165107,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*uint8)(unsafe.Pointer(zSql))) @@ -163233,13 +165130,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*uint8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23701, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23735, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -163247,13 +165145,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20345, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20379, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23708, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23742, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23713, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23747, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -163263,10 +165161,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23723, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23757, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23727, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23761, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -163526,6 +165424,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -163699,8 +165599,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -163708,7 +165608,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint32FromInt64(116)/libc.Uint32FromInt64(4)) && _aMsg[rc] != uintptr(0) { @@ -164839,31 +166758,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23803, - 1: __ccgo_ts + 23816, - 3: __ccgo_ts + 23832, - 4: __ccgo_ts + 23857, - 5: __ccgo_ts + 23871, - 6: __ccgo_ts + 23890, + 0: __ccgo_ts + 23837, + 1: __ccgo_ts + 23850, + 3: __ccgo_ts + 23866, + 4: __ccgo_ts + 23891, + 5: __ccgo_ts + 23905, + 6: __ccgo_ts + 23924, 7: __ccgo_ts + 1618, - 8: __ccgo_ts + 23915, - 9: __ccgo_ts + 23952, - 10: __ccgo_ts + 23964, - 11: __ccgo_ts + 23979, - 12: __ccgo_ts + 24012, - 13: __ccgo_ts + 24030, - 14: __ccgo_ts + 24055, - 15: __ccgo_ts + 24084, - 17: __ccgo_ts + 5996, - 18: __ccgo_ts + 5398, - 19: __ccgo_ts + 24101, - 20: __ccgo_ts + 24119, - 21: __ccgo_ts + 24137, - 23: __ccgo_ts + 24171, - 25: __ccgo_ts + 24192, - 26: __ccgo_ts + 24218, - 27: __ccgo_ts + 24241, - 28: __ccgo_ts + 24262, + 8: __ccgo_ts + 23949, + 9: __ccgo_ts + 23986, + 10: __ccgo_ts + 23998, + 11: __ccgo_ts + 24013, + 12: __ccgo_ts + 24046, + 13: __ccgo_ts + 24064, + 14: __ccgo_ts + 24089, + 15: __ccgo_ts + 24118, + 17: __ccgo_ts + 6021, + 18: __ccgo_ts + 5423, + 19: __ccgo_ts + 24135, + 20: __ccgo_ts + 24153, + 21: __ccgo_ts + 24171, + 23: __ccgo_ts + 24205, + 25: __ccgo_ts + 24226, + 26: __ccgo_ts + 24252, + 27: __ccgo_ts + 24275, + 28: __ccgo_ts + 24296, } // C documentation @@ -165045,7 +166964,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -165091,7 +167010,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24359, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24393, 0) _ = libc.Int32FromInt32(0) return int32(SQLITE_BUSY) } else { @@ -165165,6 +167084,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -165219,7 +167139,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24422, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24456, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -165498,7 +167418,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*uint8)(unsafe.Pointer(zDb)) != 0 { @@ -165508,7 +167428,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24473, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24507, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -165584,6 +167504,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -165632,7 +167553,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165765,7 +167686,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165775,7 +167696,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165825,7 +167746,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -165834,7 +167755,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24494, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24528, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -165860,6 +167781,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -165994,7 +167916,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) _ = libc.Int32FromInt32(0) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24562, uint32(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24596, uint32(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -166008,6 +167930,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -166023,8 +167946,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*uint8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24568, zUri+7, uint32(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24578, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24602, zUri+7, uint32(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24612, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -166114,20 +168037,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24606, zOpt, uint32(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24640, zOpt, uint32(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24610, zOpt, uint32(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24644, zOpt, uint32(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24610 + zModeType = __ccgo_ts + 24644 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24631, zOpt, uint32(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24665, zOpt, uint32(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -166156,15 +168079,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24646, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24680, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24666, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24700, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -166188,10 +168112,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24690, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24724, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -166206,11 +168131,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24616, + Fz: __ccgo_ts + 24650, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24623, + Fz: __ccgo_ts + 24657, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -166221,19 +168146,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24636, + Fz: __ccgo_ts + 24670, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24639, + Fz: __ccgo_ts + 24673, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24642, + Fz: __ccgo_ts + 24676, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17730, + Fz: __ccgo_ts + 17764, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -166362,8 +168287,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22317, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24706, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22351, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24740, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -166387,7 +168312,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+4, bp+8) } @@ -166424,9 +168349,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6560 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6585 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FzDbSName = __ccgo_ts + 23708 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).FzDbSName = __ccgo_ts + 23742 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*16))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -166448,6 +168373,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -166471,6 +168397,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166519,7 +168446,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24712 + zFilename = __ccgo_ts + 24746 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -166637,6 +168564,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166662,6 +168590,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -166738,20 +168667,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24715, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24749, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24740) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24774) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24760) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24794) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24767) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24801) } // C documentation @@ -166816,6 +168745,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -166857,6 +168787,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -166879,7 +168810,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24784, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24818, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -167525,6 +169456,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte += int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*4))) + uint32(1)) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -167544,6 +169476,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*4))) goto _3 _3: + ; i++ } v4 = p @@ -167910,7 +169843,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24812, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24846, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -167926,6 +169859,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -168012,6 +169946,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 568 } } @@ -168033,6 +169968,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 568 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -168112,6 +170048,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -168128,7 +170065,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui _leaveMutex(tls) _ = libc.Int32FromInt32(0) if rc != 0 { - v2 = __ccgo_ts + 24820 + v2 = __ccgo_ts + 24854 } else { v2 = uintptr(0) } @@ -169012,18 +170949,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1634, - 1: __ccgo_ts + 7861, - 2: __ccgo_ts + 7866, - 3: __ccgo_ts + 6281, - 4: __ccgo_ts + 6281, - 5: __ccgo_ts + 6276, - 6: __ccgo_ts + 6276, - 7: __ccgo_ts + 8172, - 8: __ccgo_ts + 8172, - 9: __ccgo_ts + 8172, - 10: __ccgo_ts + 8172, - 11: __ccgo_ts + 24843, - 12: __ccgo_ts + 24849, + 1: __ccgo_ts + 7886, + 2: __ccgo_ts + 7891, + 3: __ccgo_ts + 6306, + 4: __ccgo_ts + 6306, + 5: __ccgo_ts + 6301, + 6: __ccgo_ts + 6301, + 7: __ccgo_ts + 8197, + 8: __ccgo_ts + 8197, + 9: __ccgo_ts + 8197, + 10: __ccgo_ts + 8197, + 11: __ccgo_ts + 24877, + 12: __ccgo_ts + 24883, 13: __ccgo_ts + 1648, 14: __ccgo_ts + 1648, 15: __ccgo_ts + 1648, @@ -169455,6 +171392,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 8 + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -169546,6 +171484,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -169562,6 +171501,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -169875,6 +171815,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -169888,6 +171829,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = c goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 16 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -169927,13 +171869,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 16 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)>>int32(4)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)>>int32(4)))) v22 = p + 16 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)&int32(0xf)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -169969,7 +171912,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1634, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24873, libc.VaList(bp+64, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15323, libc.VaList(bp+64, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -169990,7 +171933,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24907, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -170046,7 +171989,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24936, -int32(1)) } } } @@ -170215,6 +172158,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -170237,6 +172181,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -170293,6 +172238,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -170326,8 +172272,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(3), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24925, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24951, + FzRepl: __ccgo_ts + 24955, }, 1: { Fc1: uint8('i'), @@ -170335,8 +172281,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(8), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24937, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24963, + FzRepl: __ccgo_ts + 24955, }, 2: { Fc1: uint8('n'), @@ -170351,7 +172297,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('Q'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24946, + FzMatch: __ccgo_ts + 24972, FzRepl: __ccgo_ts + 1634, }, 4: { @@ -170359,7 +172305,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('S'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24951, + FzMatch: __ccgo_ts + 24977, FzRepl: __ccgo_ts + 1634, }, } @@ -170375,7 +172321,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24956, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24982, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -170800,6 +172746,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -170831,7 +172778,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+24999, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25025, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -170950,6 +172897,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) { case int32('{'): goto _1 @@ -171030,6 +172978,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -171103,6 +173052,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -171142,14 +173092,17 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + _ = libc.Int32FromInt32(0) _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) iStart = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { @@ -171210,19 +173163,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*uint8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -171284,24 +173241,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7861, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7886, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7866, uint32(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7891, uint32(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -171311,19 +173272,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171342,6 +173315,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -171356,14 +173330,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24925, int32(3)) == 0 { + if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24951, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25021, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25047, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -171393,6 +173367,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -171402,6 +173377,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*uint8)(unsafe.Pointer(z + uintptr(j))) @@ -171446,6 +173422,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -171458,6 +173435,7 @@ parse_number_2: } } parse_number_finish: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171467,33 +173445,50 @@ parse_number_finish: _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -171503,12 +173498,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1634, uint32(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*uint8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -171526,7 +173523,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -171534,11 +173531,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -171569,7 +173568,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*uint8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -171582,7 +173581,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -171604,6 +173603,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint32(56)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -171742,22 +173745,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1634, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7861, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7886, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7866, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7891, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -171790,16 +173799,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24929 + v19 = __ccgo_ts + 24955 } else { - v19 = __ccgo_ts + 11728 + v19 = __ccgo_ts + 11753 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171822,16 +173833,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, uint8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, uint8('"')) @@ -171843,6 +173858,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -171854,7 +173870,7 @@ _11: sz2 -= k2 } if int32(*(*uint8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25027, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25053, uint32(2)) zIn2++ sz2-- continue @@ -171870,7 +173886,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, uint8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25030, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25056, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 25 @@ -171878,12 +173894,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25037, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25063, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25042, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25068, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*uint8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -171913,9 +173929,11 @@ _11: _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, uint8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -171933,6 +173951,7 @@ _13: _jsonAppendChar(tls, pOut, uint8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, uint8('{')) j = i + n @@ -171958,11 +173977,14 @@ _14: _jsonAppendChar(tls, pOut, uint8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 25 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -172033,6 +174055,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -172456,6 +174479,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -172474,6 +174498,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -172690,7 +174715,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -172725,25 +174750,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -172788,11 +174818,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -172805,11 +174838,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -172880,6 +174917,7 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ _ = libc.Int32FromInt32(0) @@ -172887,7 +174925,9 @@ _10: Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -172901,14 +174941,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } @@ -172949,7 +174993,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24907, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -172962,7 +175006,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint32(56)) return int32(1) @@ -172981,10 +175025,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*uint8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { if int32(*(*uint8)(unsafe.Pointer(z))) == int32('-') && int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -173023,7 +175067,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25049, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25075, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -173110,15 +175154,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -173204,6 +175250,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(56)) if p == uintptr(0) { goto json_pfa_oom @@ -173247,12 +175294,13 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } + _ = libc.Int32FromInt32(0) if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -173292,15 +175340,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -173392,6 +175442,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, uint8(']')) @@ -173429,7 +175480,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25067 + v1 = __ccgo_ts + 25093 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -173439,7 +175490,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } eErr = uint8(1) @@ -173470,6 +175521,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173488,6 +175540,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173561,9 +175614,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25069, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25095, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5136, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5161, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1661, uint32(1)) @@ -173572,9 +175625,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*uint8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25097, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25074, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25100, uint32(1)) } } } @@ -173615,7 +175668,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -173625,6 +175678,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -173635,6 +175689,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -173883,7 +175938,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -173907,7 +175962,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25076, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25102, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -173918,7 +175973,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25127, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25153, -int32(1)) _jsonStringReset(tls, bp) return } @@ -173930,6 +175985,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*4))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, uint8('}')) @@ -173989,21 +176045,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -174021,7 +176080,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15762) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15796) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -174052,9 +176111,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25161 + v1 = __ccgo_ts + 25187 } else { - v1 = __ccgo_ts + 25165 + v1 = __ccgo_ts + 25191 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -174102,7 +176161,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_type_done @@ -174112,6 +176171,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -174189,7 +176249,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25172, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25198, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -174295,6 +176355,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -174378,7 +176439,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25229, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25255, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174444,6 +176505,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -174526,7 +176588,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25232, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25258, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174633,7 +176695,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25235) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25261) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(16)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -174769,7 +176831,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+40, __ccgo_ts+25318, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+40, __ccgo_ts+25344, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -174790,13 +176852,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+40, __ccgo_ts+25325, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+40, __ccgo_ts+25351, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+40, __ccgo_ts+25333, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+40, __ccgo_ts+25359, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -174960,6 +177023,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+168, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -174989,9 +177055,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -175052,6 +177118,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -175182,7 +177249,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+40, __ccgo_ts+25339, uint32(1)) + _jsonAppendRaw(tls, p+40, __ccgo_ts+25365, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+168, i, bp) @@ -175203,8 +177270,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24910, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24936, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -175265,176 +177333,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25341, + FzName: __ccgo_ts + 25367, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25346, + FzName: __ccgo_ts + 25372, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25352, + FzName: __ccgo_ts + 25378, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25363, + FzName: __ccgo_ts + 25389, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25393, + FzName: __ccgo_ts + 25419, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25413, + FzName: __ccgo_ts + 25439, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25426, + FzName: __ccgo_ts + 25452, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25440, + FzName: __ccgo_ts + 25466, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25443, + FzName: __ccgo_ts + 25469, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25447, + FzName: __ccgo_ts + 25473, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25459, + FzName: __ccgo_ts + 25485, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25472, + FzName: __ccgo_ts + 25498, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25484, + FzName: __ccgo_ts + 25510, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25497, + FzName: __ccgo_ts + 25523, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25508, + FzName: __ccgo_ts + 25534, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25520, + FzName: __ccgo_ts + 25546, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25531, + FzName: __ccgo_ts + 25557, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25543, + FzName: __ccgo_ts + 25569, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25556, + FzName: __ccgo_ts + 25582, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25569, + FzName: __ccgo_ts + 25595, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25583, + FzName: __ccgo_ts + 25609, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25592, + FzName: __ccgo_ts + 25618, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25623, + FzName: __ccgo_ts + 25649, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25640, + FzName: __ccgo_ts + 25666, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25658, + FzName: __ccgo_ts + 25684, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), - FzName: __ccgo_ts + 25676, + FzName: __ccgo_ts + 25702, }, } @@ -175504,6 +177572,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -175514,11 +177583,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25695, + FzName: __ccgo_ts + 25721, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25705, + FzName: __ccgo_ts + 25731, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -176078,6 +178147,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -176114,6 +178184,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 28 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -176153,11 +178224,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -176197,10 +178266,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25715, iNode, 0, pRtree+72) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25741, iNode, 0, pRtree+72) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -176254,6 +178322,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -176282,6 +178351,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -176406,6 +178476,7 @@ func _nodeGetRowid(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) (r // ** Return coordinate iCoord from cell iCell in node pNode. // */ func _nodeGetCoord(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iCoord int32, pCoord uintptr) { + _ = libc.Int32FromInt32(0) _readCoord(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+uintptr(int32(12)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*iCell+int32(4)*iCoord), pCoord) } @@ -176507,7 +178578,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25720, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25746, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -176568,6 +178639,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -176581,6 +178653,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 64 + uintptr(ii)*4))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -176605,7 +178678,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -176913,6 +178988,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -177351,6 +179433,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -177427,7 +179512,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25802) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25828) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -177565,6 +179650,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -177653,6 +179739,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -177672,6 +179759,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -177723,6 +179811,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -177886,6 +179975,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -177901,6 +179991,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -177984,11 +180075,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -178044,6 +180137,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -178067,6 +180161,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -178075,6 +180170,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 4)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -178247,11 +180343,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*4)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*4)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -178282,6 +180380,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -178295,6 +180394,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -178304,6 +180404,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*4)))))*48, uint32(48)) @@ -178330,6 +180431,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -178357,6 +180459,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -178405,6 +180508,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -178486,6 +180590,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -178501,6 +180606,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -178517,6 +180623,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -178561,6 +180668,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -178652,6 +180760,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -178762,6 +180871,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -178865,6 +180975,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -178944,7 +181055,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) _ = libc.Int32FromInt32(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25816, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25842, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -178954,11 +181065,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25836, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25862, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25868, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25894, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -179033,6 +181144,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -179049,6 +181161,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -179112,6 +181225,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*4))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -179119,6 +181233,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -179132,8 +181247,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - _ = libc.Int32FromInt32(0) - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -179152,6 +181266,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -179165,7 +181283,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25905, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25931, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -179219,9 +181337,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26050 + zFmt = __ccgo_ts + 26076 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11557, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11582, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -179272,15 +181390,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26106, - 1: __ccgo_ts + 5459, - 2: __ccgo_ts + 16660, + 0: __ccgo_ts + 26132, + 1: __ccgo_ts + 5484, + 2: __ccgo_ts + 16694, } var _rtreeModule = Tsqlite3_module{ @@ -179305,7 +181424,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 76)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 92)) = __ccgo_fp(_rtreeShadowName) @@ -179324,20 +181443,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26520, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26546, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26582, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26608, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26587, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26651, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26721, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26613, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26677, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26747, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -179367,7 +181487,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 26770 + zFormat = __ccgo_ts + 26796 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -179378,33 +181498,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26878, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26904, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26923, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26949, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13090, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26950, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26976, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26972, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26998, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26980, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27006, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -179418,14 +181540,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26111, - 1: __ccgo_ts + 26164, - 2: __ccgo_ts + 26209, - 3: __ccgo_ts + 26261, - 4: __ccgo_ts + 26315, - 5: __ccgo_ts + 26360, - 6: __ccgo_ts + 26418, - 7: __ccgo_ts + 26473, + 0: __ccgo_ts + 26137, + 1: __ccgo_ts + 26190, + 2: __ccgo_ts + 26235, + 3: __ccgo_ts + 26287, + 4: __ccgo_ts + 26341, + 5: __ccgo_ts + 26386, + 6: __ccgo_ts + 26444, + 7: __ccgo_ts + 26499, } // C documentation @@ -179483,7 +181605,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26996, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27022, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -179494,14 +181616,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27016, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27042, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+16) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -179578,13 +181700,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint32(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint32(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27265, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27291, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) ii = int32(4) for { if !(ii < argc) { @@ -179593,7 +181715,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)) if int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27289, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27315, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -179604,9 +181726,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -179658,6 +181781,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -179668,8 +181792,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27295, - 1: __ccgo_ts + 27306, + 0: __ccgo_ts + 27321, + 1: __ccgo_ts + 27332, } // C documentation @@ -179727,22 +181851,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+32, bp, ii, bp+536) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11177, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11202, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27319, libc.VaList(bp+592, (*(*TRtreeCell)(unsafe.Pointer(bp + 536))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27345, libc.VaList(bp+592, (*(*TRtreeCell)(unsafe.Pointer(bp + 536))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 32))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27325, libc.VaList(bp+592, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 536 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27351, libc.VaList(bp+592, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 536 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27329, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27355, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -179766,7 +181892,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27331, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27357, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -179884,11 +182010,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4178 + v1 = __ccgo_ts + 4203 } else { v1 = __ccgo_ts + 1648 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27364, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27390, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -179922,7 +182048,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27371, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27397, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -179939,7 +182065,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27416, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27442, libc.VaList(bp+8, iNode)) } } return pRet @@ -179968,8 +182094,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27448, - 1: __ccgo_ts + 27502, + 0: __ccgo_ts + 27474, + 1: __ccgo_ts + 27528, } _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pCheck + 24 + uintptr(bLeaf)*4)) == uintptr(0) { @@ -179983,21 +182109,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27550 + v1 = __ccgo_ts + 27576 } else { - v1 = __ccgo_ts + 27558 + v1 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27567, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27593, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27550 + v2 = __ccgo_ts + 27576 } else { - v2 = __ccgo_ts + 27558 + v2 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27612, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27638, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -180042,7 +182168,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27670, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27696, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -180060,11 +182186,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27718, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27744, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -180094,19 +182221,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27785, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27811, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27819, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27845, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27849, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27875, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -180126,6 +182253,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -180150,12 +182278,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27904, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27930, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27935, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27961, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -180184,7 +182312,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28002, libc.VaList(bp+64, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28028, libc.VaList(bp+64, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -180194,11 +182322,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25816, libc.VaList(bp+64, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25842, libc.VaList(bp+64, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28030, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28056, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -180214,8 +182342,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28061, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28068, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28087, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28094, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -180243,7 +182371,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28076, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28102, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -180294,13 +182422,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28095, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28121, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6560 + zDb = __ccgo_ts + 6585 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*4))) } @@ -180309,7 +182437,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18427 + v1 = __ccgo_ts + 18461 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -180532,6 +182660,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -180642,6 +182771,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -180702,6 +182832,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -180772,18 +182903,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25069, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25095, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28146, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28172, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28157, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28183, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180812,19 +182944,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = uint8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28168, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28186, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28212, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = uint8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28220, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -180832,13 +182965,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) if z != 0 && *(*uint8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28202, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28228, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28206, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28232, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180890,6 +183024,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -180919,6 +183054,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -180984,6 +183120,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -181062,6 +183199,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -181131,6 +183269,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -181140,6 +183279,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, uint64(libc.Uint32FromInt64(40)+libc.Uint32FromInt64(4)*libc.Uint32FromInt32(2)*uint32(libc.Int32FromInt32(4)-libc.Int32FromInt32(4)))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -181167,18 +183307,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4)) } _2: + ; return pOut } @@ -181361,6 +183505,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -181543,6 +183688,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -181609,6 +183755,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -181617,6 +183764,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -181628,6 +183776,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -181696,6 +183845,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -181712,6 +183862,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -181778,6 +183929,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -181802,6 +183954,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181838,6 +183991,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181862,6 +184016,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -181951,13 +184106,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*4)), uint32(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint32(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint32(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28219, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28245, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -181966,12 +184121,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28241, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28267, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -182000,6 +184156,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -182152,6 +184309,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 4)) @@ -182202,11 +184360,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16660 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16694 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -182216,7 +184375,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28245 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28271 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -182224,7 +184383,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28251 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28277 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -182346,7 +184505,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*4)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28260, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28286, 0) } goto geopoly_update_end } @@ -182426,6 +184585,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*4))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -182434,6 +184594,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -182447,12 +184608,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28300) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28326) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28316) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28342) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -182508,6 +184669,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -182518,10 +184680,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28493, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28519, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -182535,61 +184698,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28331, + FzName: __ccgo_ts + 28357, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28344, + FzName: __ccgo_ts + 28370, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28357, + FzName: __ccgo_ts + 28383, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28370, + FzName: __ccgo_ts + 28396, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28316, + FzName: __ccgo_ts + 28342, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28382, + FzName: __ccgo_ts + 28408, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28300, + FzName: __ccgo_ts + 28326, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28405, + FzName: __ccgo_ts + 28431, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28419, + FzName: __ccgo_ts + 28445, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28432, + FzName: __ccgo_ts + 28458, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28446, + FzName: __ccgo_ts + 28472, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28462, + FzName: __ccgo_ts + 28488, }, } @@ -182615,7 +184778,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28474, + FzName: __ccgo_ts + 28500, }, } @@ -182640,20 +184803,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28501, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28527, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28511, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28537, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28522, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28548, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28245, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28271, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28533, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28559, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -182698,6 +184861,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -182747,13 +184911,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 32 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*4))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25802, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25828, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -183982,7 +186147,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -183992,7 +186157,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -184095,6 +186260,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -184173,7 +186339,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28564, uintptr(0), uintptr(0), p+36) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28590, uintptr(0), uintptr(0), p+36) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -184263,7 +186429,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+25715, zIn, uint32(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+25741, zIn, uint32(4)) == 0 { i = int32(4) for { if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -184271,6 +186437,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*uint8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -184299,13 +186466,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint32(108)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28735 + v1 = __ccgo_ts + 28761 } else { v1 = __ccgo_ts + 1648 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+28776, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+28802, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+4, p+36, __ccgo_ts+28926) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+4, p+36, __ccgo_ts+28952) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -184535,7 +186702,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29051, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29077, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -184545,7 +186712,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29170, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29196, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -184553,7 +186720,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29191, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29217, libc.VaList(bp+24, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -184565,7 +186732,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29242, libc.VaList(bp+24, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29268, libc.VaList(bp+24, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -184576,6 +186743,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(i < libc.Uint32FromInt64(16)/libc.Uint32FromInt64(4)) { @@ -184584,6 +186752,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -184606,7 +186775,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint32(1)*uint32((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184619,7 +186788,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint32(1)*uint32((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(1)) if iCid >= 0 { @@ -184673,7 +186842,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+36, bp+4, pIter+60) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19870, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19904, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -184685,7 +186854,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29320, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29346, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -184696,7 +186865,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29339, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29365, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+32) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 8 @@ -184704,12 +186873,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*4)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29344, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29370, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184717,17 +186887,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29354 + v4 = __ccgo_ts + 29380 } else { - v4 = __ccgo_ts + 29367 + v4 = __ccgo_ts + 29393 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29376, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29402, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29405, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29431, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184744,11 +186914,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29427, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29453, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -184797,10 +186968,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29454, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29480, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14990 goto _1 _1: + ; i++ } return zList @@ -184831,12 +187003,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29463, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29489, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -184878,21 +187051,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29476, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29502, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29508, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29534, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+29531) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29537, __ccgo_ts+29544, __ccgo_ts+5081) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+29557) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29563, __ccgo_ts+29570, __ccgo_ts+5106) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29552, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29578, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29594, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29620, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -184944,7 +187117,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1648 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -184961,20 +187134,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+16, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29643, libc.VaList(bp+16, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29679, libc.VaList(bp+16, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14965 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29648, libc.VaList(bp+16, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29669, libc.VaList(bp+16, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29705, libc.VaList(bp+16, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14990 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -184983,7 +187157,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29706, libc.VaList(bp+16, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29732, libc.VaList(bp+16, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { zSep = __ccgo_ts + 1648 iCol = 0 @@ -185000,19 +187174,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29754, libc.VaList(bp+16, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14965 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29780, libc.VaList(bp+16, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14990 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29761, libc.VaList(bp+16, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29787, libc.VaList(bp+16, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -185064,7 +187240,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -185073,7 +187249,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29773, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29799, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*8))).FzSpan, zCollate)) zType = __ccgo_ts + 1648 } else { if iCid < 0 { @@ -185087,15 +187263,16 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } else { - zCol = __ccgo_ts + 29344 + zCol = __ccgo_ts + 29370 } } zType = __ccgo_ts + 1136 @@ -185103,24 +187280,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29795, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29821, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29531 + v2 = __ccgo_ts + 29557 } else { v2 = __ccgo_ts + 1648 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29815, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29841, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29836, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29869, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29862, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29895, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14965 - zAnd = __ccgo_ts + 21979 + zCom = __ccgo_ts + 14990 + zAnd = __ccgo_ts + 22013 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -185174,22 +187351,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29893, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29919, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29905, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29931, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14965 + zS = __ccgo_ts + 14990 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29914, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29940, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -185215,7 +187393,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1648 @@ -185225,14 +187403,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29943, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29969, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29981, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1648 i1 = 0 @@ -185242,11 +187421,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*4)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22013 } goto _2 _2: + ; i1++ } } @@ -185265,7 +187445,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30018, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30044, 0) } // C documentation @@ -185307,21 +187487,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*uint8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30044, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30070, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30100, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), i+int32(1))) + zSep = __ccgo_ts + 14990 } } } goto _1 _1: + ; i++ } } @@ -185369,6 +187550,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*uint8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = uint8(v2) goto _1 _1: + ; i++ } } @@ -185399,16 +187581,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { z = uintptr(0) _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30111 + zSep = __ccgo_ts + 30137 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16548) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16582) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) } break } @@ -185419,16 +187601,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(3)) != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30124, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14965 + z = _rbuMPrintf(tls, p, __ccgo_ts+30150, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14990 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30135, libc.VaList(bp+16, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30161, libc.VaList(bp+16, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) } return z @@ -185474,7 +187656,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30139) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30165) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -185482,7 +187664,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) { @@ -185491,21 +187673,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30189, libc.VaList(bp+16, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30215, libc.VaList(bp+16, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30211, libc.VaList(bp+16, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14965 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30237, libc.VaList(bp+16, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14990 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30221, libc.VaList(bp+16, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30247, libc.VaList(bp+16, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30236, libc.VaList(bp+16, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30262, libc.VaList(bp+16, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185542,7 +187724,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1648 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -185551,37 +187733,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1648 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*4)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30298 + zPk = __ccgo_ts + 30324 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30311 + v2 = __ccgo_ts + 30337 } else { v2 = __ccgo_ts + 1648 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30321, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14965 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30347, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14990 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30348, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30374, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30355 + v3 = __ccgo_ts + 30381 } else { v3 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30370, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30396, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185608,7 +187791,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+88, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30402, libc.VaList(bp+8, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+88, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30428, libc.VaList(bp+8, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -185630,6 +187813,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -185655,7 +187839,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt zRet = uintptr(0) _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 4)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30459) + *(*int32)(unsafe.Pointer(bp + 4)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+36, __ccgo_ts+30485) } if *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 4)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -185725,6 +187909,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -185739,6 +187924,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -185750,6 +187936,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185764,6 +187951,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185779,6 +187967,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*uint8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -185821,7 +188010,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30525, libc.VaList(bp+24, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30551, libc.VaList(bp+24, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -185839,18 +188028,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+4, bp+8, bp+12) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 12))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30545, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30571, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 12)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30610, libc.VaList(bp+24, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30636, libc.VaList(bp+24, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30646, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp + 8))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+30672, libc.VaList(bp+24, zTbl, *(*uintptr)(unsafe.Pointer(bp + 8))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185865,26 +188054,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30680 + v2 = __ccgo_ts + 30706 } else { - v2 = __ccgo_ts + 30684 + v2 = __ccgo_ts + 30710 } v1 = v2 } else { v1 = __ccgo_ts + 1648 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30690, libc.VaList(bp+24, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30716, libc.VaList(bp+24, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30751, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30777, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30680 + v3 = __ccgo_ts + 30706 } else { - v3 = __ccgo_ts + 30684 + v3 = __ccgo_ts + 30710 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30812, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30838, libc.VaList(bp+24, zCollist, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185903,8 +188092,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6571) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6567) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6596) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6592) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -185913,39 +188102,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1648 } else { - v4 = __ccgo_ts + 30971 + v4 = __ccgo_ts + 30997 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30980 + v5 = __ccgo_ts + 31006 } else { v5 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30990, libc.VaList(bp+24, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+80, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31016, libc.VaList(bp+24, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31026, libc.VaList(bp+24, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+84, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31052, libc.VaList(bp+24, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31054 + zRbuRowid = __ccgo_ts + 31080 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31066 + v6 = __ccgo_ts + 31092 } else { v6 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31083, libc.VaList(bp+24, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31159, libc.VaList(bp+24, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31109, libc.VaList(bp+24, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31185, libc.VaList(bp+24, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31458, libc.VaList(bp+24, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31484, libc.VaList(bp+24, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -185956,9 +188145,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31557 + v7 = __ccgo_ts + 31583 } else { - v7 = __ccgo_ts + 31567 + v7 = __ccgo_ts + 31593 } zRbuRowid1 = v7 } @@ -185971,14 +188160,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29614, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29640, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31578 + v8 = __ccgo_ts + 31604 } else { v8 = __ccgo_ts + 1648 } @@ -185988,11 +188177,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1648 } if zOrder != 0 { - v10 = __ccgo_ts + 23173 + v10 = __ccgo_ts + 23207 } else { v10 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+76, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31584, libc.VaList(bp+24, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+76, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31610, libc.VaList(bp+24, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -186049,6 +188238,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } _ = libc.Int32FromInt32(0) @@ -186060,6 +188250,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -186079,9 +188270,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30971 + zPrefix = __ccgo_ts + 30997 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31632, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31658, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+4, p+36, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -186155,7 +188346,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 4)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+31662, libc.VaList(bp+16, p+24))) + *(*int32)(unsafe.Pointer(bp + 4)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+31688, libc.VaList(bp+16, p+24))) for *(*int32)(unsafe.Pointer(bp + 4)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -186217,27 +188408,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31692, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31718, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31720, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31746, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.Xmemcpy(tls, p+24, __ccgo_ts+3418, uint32(4)) } else { - libc.Xmemcpy(tls, p+24, __ccgo_ts+6560, uint32(4)) + libc.Xmemcpy(tls, p+24, __ccgo_ts+6585, uint32(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31738, libc.VaList(bp+8, p+24)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31764, libc.VaList(bp+8, p+24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -186270,10 +188461,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31804, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31830, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24562, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24596, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*uint8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -186289,14 +188480,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 31836 + v2 = __ccgo_ts + 31862 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1648 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31838, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31864, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -186307,27 +188498,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31870, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31896, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31885, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31911, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31902, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31928, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31946, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31972, 0) } } @@ -186411,7 +188602,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -186444,7 +188635,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31964, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31990, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186579,16 +188770,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -186610,7 +188801,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+31999, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32025, 0) } // C documentation @@ -186627,13 +188818,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32024, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32031, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32050, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32057, libc.VaList(bp+8, zMove)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zWal == uintptr(0) || zOal == uintptr(0) { @@ -186771,7 +188962,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24119, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24153, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -186784,6 +188975,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -186865,6 +189057,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -186908,7 +189101,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+36, __ccgo_ts+32038) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+36, __ccgo_ts+32064) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -186921,7 +189114,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32060, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32086, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -186949,7 +189142,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { } pFd = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32087, libc.VaList(bp+16, p+24, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32113, libc.VaList(bp+16, p+24, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -186986,9 +189179,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32245, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, Xsqlite3_mprintf(tls, __ccgo_ts+32271, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32260, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32286, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -187012,9 +189205,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32306, uintptr(0), uintptr(0), p+36) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32305) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32331) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -187025,10 +189218,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32413) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32439) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, __ccgo_ts+32478) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4, p+36, __ccgo_ts+32504) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -187039,13 +189232,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32522, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32548, uintptr(0), uintptr(0), p+36) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -187072,8 +189266,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17633) - _rbuCopyPragma(tls, p, __ccgo_ts+16744) + _rbuCopyPragma(tls, p, __ccgo_ts+17667) + _rbuCopyPragma(tls, p, __ccgo_ts+16778) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -187081,7 +189275,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32547, libc.VaList(bp+16, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32573, libc.VaList(bp+16, p+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -187104,10 +189298,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -187195,7 +189389,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32575, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32601, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -187218,10 +189412,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32024, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32050, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_VFS_POINTER), bp) _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) @@ -187245,7 +189439,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { _ = pVfs _ = libc.Int32FromInt32(0) Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32600, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32626, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -187293,7 +189487,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { } db = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, db, bp, bp+4, Xsqlite3_mprintf(tls, __ccgo_ts+32611, libc.VaList(bp+16, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+4, Xsqlite3_mprintf(tls, __ccgo_ts+32637, libc.VaList(bp+16, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 4)), -int32(1)) } else { @@ -187338,11 +189532,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32683, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32709, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32697) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32723) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -187351,7 +189545,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32754) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+36, __ccgo_ts+32780) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -187433,7 +189627,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32828, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32854, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -187455,17 +189649,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32860 + v3 = __ccgo_ts + 32886 } else { - v3 = __ccgo_ts + 32867 + v3 = __ccgo_ts + 32893 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32874, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32900, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14854, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14879, uintptr(0), uintptr(0), p+36) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+48) @@ -187477,21 +189671,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17347) - _rbuCopyPragma(tls, p, __ccgo_ts+16759) + _rbuCopyPragma(tls, p, __ccgo_ts+17381) + _rbuCopyPragma(tls, p, __ccgo_ts+16793) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32906, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32932, uintptr(0), uintptr(0), p+36) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32922, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32948, uintptr(0), uintptr(0), p+36) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -187569,7 +189763,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32946, zState+uintptr(n-int32(7)), uint32(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32972, zState+uintptr(n-int32(7)), uint32(7)) { return _rbuMisuseError(tls) } } @@ -187616,7 +189810,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(i < nErrmsg-uint32(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30971, uint32(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30997, uint32(8)) == 0 { nDel = int32(8) for int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -187626,6 +189820,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -187643,7 +189838,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -187652,7 +189847,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+36) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+36) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+48) @@ -187662,7 +189857,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32954, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32980, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -187777,7 +189972,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -187791,19 +189986,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14854 + v1 = __ccgo_ts + 14879 } else { - v1 = __ccgo_ts + 32906 + v1 = __ccgo_ts + 32932 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32906, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32932, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -187914,6 +190109,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -187963,6 +190159,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187975,6 +190172,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -188001,6 +190199,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 56 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -188014,6 +190213,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 60 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -188046,6 +190246,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -188056,6 +190257,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -188082,6 +190284,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -188369,7 +190572,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32981, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33007, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -188395,7 +190598,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33004, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33030, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -188596,7 +190799,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6560) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6585) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -188610,7 +190813,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33015, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33041, 0) != 0 { _ = libc.Int32FromInt32(0) oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -189167,7 +191370,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*4))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12166, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 3*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12191, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 3*4)))) return int32(SQLITE_ERROR) } } else { @@ -189238,16 +191441,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -189315,6 +191519,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*24))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -189350,6 +191555,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 16 + uintptr(i)*40))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -189546,17 +191752,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -189646,6 +191855,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -189661,7 +191871,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33026, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33052, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 16))).FzPath = v1 if z == uintptr(0) { @@ -189699,8 +191909,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33028 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33037, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33054 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33063, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -189729,7 +191939,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint32FromInt64(1280)/libc.Uint32FromInt64(40)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } _ = libc.Int32FromInt32(0) if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { @@ -189741,7 +191951,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*40))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33049, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33075, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*40))).FzPath = v4 if z == uintptr(0) { @@ -189761,16 +191971,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33057 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33083 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33066 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33092 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33071 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33097 break } *(*int32)(unsafe.Pointer(pCsr + 1320)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -189795,6 +192005,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*24))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 1336)) += int64(nPayload) @@ -189867,12 +192078,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33081, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*16))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33107, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*16))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33236, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33262, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33250, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33276, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -189894,37 +192105,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -189949,7 +192160,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33265, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33291, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -190621,6 +192832,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -193828,6 +196082,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -193910,7 +196165,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -193935,7 +196190,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -193950,7 +196205,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -193965,6 +196220,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -194005,7 +196261,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -194065,6 +196321,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -194110,7 +196367,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+44, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194170,6 +196427,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint32(4)*uint32((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint32(2)) @@ -194218,7 +196476,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ _ = libc.Int32FromInt32(0) - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -194228,7 +196486,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -194248,6 +196506,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -194308,7 +196567,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -194316,6 +196575,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -194348,6 +196608,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -194556,6 +196817,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -194677,6 +196939,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+4, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -194696,6 +196959,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+4, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -194706,6 +196970,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint32(4)*uint32(*(*int32)(unsafe.Pointer(bp + 16)))*uint32(2)) @@ -194713,7 +196978,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } _ = libc.Int32FromInt32(0) @@ -194736,6 +197001,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 20))).FaBuf) @@ -194882,6 +197148,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -194915,7 +197182,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint32(12) * uint32(nU32) * uint32(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11557) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11582) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -194924,9 +197191,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.Xmemset(tls, bp+4, 0, uint32(12)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*12 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint32(nU32)*uint32(4)) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33909, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33935, bp) _sessionAppendIdent(tls, bp+4, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33922, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33948, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -194936,17 +197203,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*4)) != 0 { _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+4, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14965 + zSep = __ccgo_ts + 14990 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1648 - _sessionAppendStr(tls, bp+4, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33959, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -194956,16 +197224,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 _sessionAppendStr(tls, bp+4, zSep, bp) if bStat1 != 0 && ii == int32(1) { _ = libc.Int32FromInt32(0) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33941, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33967, bp) } else { _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+4, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -195010,6 +197279,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -195048,9 +197318,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 4)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+4, __ccgo_ts+34022, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34048, bp) _sessionAppendIdent(tls, bp+4, zTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33959, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -195060,18 +197330,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+4, i+int32(1), bp) - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+4, __ccgo_ts+34040, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34066, bp) _sessionAppendInteger(tls, bp+4, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+33504, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+33530, bp) zSep = __ccgo_ts + 1648 i = 0 for { @@ -195081,15 +197352,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+4, zSep, bp) _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+4, i+int32(1), bp) - zSep = __ccgo_ts + 34048 + zSep = __ccgo_ts + 34074 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+5106, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FnBuf, p+4, uintptr(0)) @@ -195115,7 +197387,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6560, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+12) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6585, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+12) } // C documentation @@ -195138,34 +197410,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 4)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+4, __ccgo_ts+34053, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34079, bp) _sessionAppendIdent(tls, bp+4, zTab, bp) - _sessionAppendStr(tls, bp+4, __ccgo_ts+21985, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+22019, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+4, __ccgo_ts+14965, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+14990, bp) } _sessionAppendIdent(tls, bp+4, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+34071, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34097, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+4, __ccgo_ts+34082, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+34108, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+4, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+4, __ccgo_ts+5106, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 4))).FnBuf, p+8, uintptr(0)) } @@ -195188,12 +197462,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11557, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11582, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34086) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34112) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+4, __ccgo_ts+34199) + rc = _sessionPrepare(tls, db, p+4, __ccgo_ts+34225) } return rc } @@ -195260,13 +197534,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -195326,6 +197601,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -195393,6 +197669,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+60, *(*uintptr)(unsafe.Pointer(bp + 4)), bp) goto _2 _2: + ; i++ } } @@ -195600,6 +197877,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -195684,7 +197962,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34343, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34369, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -195697,7 +197975,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34364, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34390, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -195793,10 +198071,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34383, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34435, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+92, bp+84, bp+88, uintptr(0)) @@ -195837,7 +198115,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+96, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6560, *(*uintptr)(unsafe.Pointer(bp + 92)), bp+4+16, bp, bp+4+20, uintptr(0), bp+4+24, bp+4+76) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6585, *(*uintptr)(unsafe.Pointer(bp + 92)), bp+4+16, bp, bp+4+20, uintptr(0), bp+4+24, bp+4+76) if rc != SQLITE_OK { break } @@ -195851,22 +198129,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34439, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34465, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol < *(*int32)(unsafe.Pointer(bp + 84)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34483, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol, *(*int32)(unsafe.Pointer(bp + 84)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34509, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol, *(*int32)(unsafe.Pointer(bp + 84)))) } else { if *(*int32)(unsafe.Pointer(bp + 84)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 96)), uint32(*(*int32)(unsafe.Pointer(bp + 84)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34554, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34580, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 4))).FnCol = *(*int32)(unsafe.Pointer(bp + 84)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11557) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11582) { v2 = _sessionStat1Sql(tls, db, bp+4) rc = v2 if v2 != 0 { @@ -195923,13 +198202,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34614, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34640, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34668, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34694, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } } _ = libc.Int32FromInt32(0) @@ -196088,6 +198367,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(pOut) - int32((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord) @@ -196134,6 +198414,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(pOut1) - int32((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord) @@ -196265,6 +198546,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -196330,6 +198612,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -196346,6 +198629,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -196357,6 +198641,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -196369,6 +198654,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -196431,6 +198717,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -196465,6 +198752,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -196510,6 +198798,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28)), *(*int32)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), bp+36) @@ -196591,14 +198880,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -196829,6 +199121,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(pOut) - int32((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf) @@ -196901,6 +199194,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -196924,6 +199218,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(pOut) - int32((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf) @@ -196981,6 +199276,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -197011,6 +199307,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -198380,23 +200677,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -198542,7 +200839,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34696, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34722, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -198725,116 +201022,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+4) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*12+4) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*12 + 4)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*12 + 4)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*12 + 4 + 4)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 4)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*int32)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*12+4, *(*int32)(unsafe.Pointer(fts5yymsp + 4))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*12 + 4)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 4)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*12 + 4)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; _ = libc.Int32FromInt32(0) fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) @@ -198868,7 +201195,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -199176,7 +201503,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34755, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34781, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -199274,7 +201601,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+68 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34762 + zErr = __ccgo_ts + 34788 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199402,6 +201729,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -199454,6 +201782,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -199518,7 +201847,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 76)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34812 + zErr = __ccgo_ts + 34838 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199599,6 +201928,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 80))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 116)) { @@ -199620,11 +201950,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 68)) == SQLITE_OK { @@ -199791,6 +202123,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -199855,6 +202188,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -199873,6 +202207,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -199897,15 +202232,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34860, + FzFunc: __ccgo_ts + 34886, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34868, + FzFunc: __ccgo_ts + 34894, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34878, + FzFunc: __ccgo_ts + 34904, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -199918,6 +202253,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -200432,6 +202768,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34890, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34916, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34921, libc.VaList(bp+48, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34947, libc.VaList(bp+48, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200811,7 +203151,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34954, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34980, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200822,7 +203162,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC _ = libc.Int32FromInt32(0) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34991, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35017, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint32(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(4)*nArg) @@ -200830,7 +203170,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35000, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35026, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -200853,10 +203193,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35033, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35059, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -200867,58 +203208,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35067, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35093, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35075, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35101, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*uint8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35107, libc.VaList(bp+48, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35133, libc.VaList(bp+48, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35113, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35139, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35132, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35158, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35175, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35201, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35189, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35215, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35227, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35253, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35238, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35264, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5474, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5499, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 4)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8193, + FzName: __ccgo_ts + 8218, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17713, + FzName: __ccgo_ts + 17747, }, 2: { - FzName: __ccgo_ts + 35273, + FzName: __ccgo_ts + 35299, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -200926,20 +203267,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+4, zArg, pConfig+56) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35281, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35307, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35312, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35338, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35322, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35348, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35356, libc.VaList(bp+48, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35382, libc.VaList(bp+48, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -201013,15 +203354,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35384) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16660) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35389, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35410) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16694) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35415, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35419) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35445) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35429, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35455, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -201047,7 +203388,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 4)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35460, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35486, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -201055,12 +203396,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35465, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35491, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35472, libc.VaList(bp+24, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+35498, libc.VaList(bp+24, i)) } goto _1 _1: + ; i++ } } @@ -201117,8 +203459,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*4)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35384) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35480, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35410) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35506, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } _ = libc.Int32FromInt32(0) @@ -201151,7 +203493,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35509, libc.VaList(bp+32, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35535, libc.VaList(bp+32, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -201176,11 +203518,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35529, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35555, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -201188,7 +203531,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35579, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35605, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -201202,18 +203545,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in zTail = uintptr(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35067 + zTail = __ccgo_ts + 35093 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35634 + zTail = __ccgo_ts + 35660 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35642, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35668, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16660, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16694, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -201248,6 +203591,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -201276,7 +203620,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35653, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35679, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -201285,15 +203629,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 14965 + v2 = __ccgo_ts + 14990 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35669, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35695, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35676, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35384)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35702, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35410)) _ = libc.Int32FromInt32(0) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -201441,7 +203786,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35702) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35728) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -201452,7 +203797,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35707) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35733) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -201463,7 +203808,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35716) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35742) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -201477,7 +203822,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35726) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35752) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -201488,7 +203833,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35736) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35762) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -201505,7 +203850,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35748) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35774) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -201520,7 +203865,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35384) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35410) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+4) if rc == SQLITE_OK { @@ -201535,7 +203880,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35760) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35786) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -201577,7 +203922,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+4 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35774 + zSelect = __ccgo_ts + 35800 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK iVersion = 0 @@ -201598,7 +203943,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35806) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35832) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 8)) = 0 @@ -201611,7 +203956,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in *(*int32)(unsafe.Pointer(bp + 4)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { _ = libc.Int32FromInt32(0) - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35814, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35840, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -201836,17 +204181,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*uint8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35885, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35911, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(z2) - int32(z) default: if _sqlite3Fts5IsBareword(tls, *(*uint8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35905, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35931, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -201857,16 +204203,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(z21) - int32(z) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35936, uint32(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35962, uint32(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35939, uint32(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35965, uint32(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30680, uint32(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30706, uint32(3)) == 0 { tok = int32(FTS5_AND) } break @@ -201971,6 +204318,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -202031,6 +204379,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -202088,6 +204437,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*4))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -202135,6 +204485,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*4)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -202181,6 +204532,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -202239,6 +204591,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -202267,6 +204620,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -202420,6 +204779,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -202552,6 +204912,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -202580,6 +204941,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -202596,6 +204958,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -202611,6 +204974,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -202618,6 +204982,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -202682,6 +205047,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -202719,6 +205085,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -202744,6 +205111,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -202818,6 +205186,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -202826,11 +205195,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -202878,6 +205249,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 40 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -202897,6 +205269,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -202908,6 +205281,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 40 + uintptr(i1)*4))) goto _2 _2: + ; i1++ } } @@ -203011,10 +205385,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -203072,6 +205448,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -203158,6 +205535,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -203189,6 +205567,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -203246,6 +205625,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -203375,6 +205755,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 40)))).FiRowid @@ -203508,10 +205889,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -203734,6 +206117,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 12 + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -203889,6 +206273,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -203897,6 +206282,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -203940,8 +206326,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35943, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35969, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -203961,12 +206347,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35948, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35974, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -204017,6 +206404,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -204027,6 +206415,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -204065,6 +206454,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -204093,10 +206483,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -204205,6 +206596,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 40 + uintptr(i)*4)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -204222,7 +206614,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35977, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36003, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -204280,6 +206672,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -204337,6 +206730,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -204410,17 +206804,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 12)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 20))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36030 + v2 = __ccgo_ts + 36056 } else { - v2 = __ccgo_ts + 35943 + v2 = __ccgo_ts + 35969 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36037, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36063, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204429,7 +206824,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36087, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36113, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204598,6 +206993,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -204640,6 +207036,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -204662,6 +207059,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -204714,10 +207112,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -204747,6 +207147,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -204766,6 +207167,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 40 + uintptr(i)*4))) goto _1 _1: + ; i++ } } @@ -204793,6 +207195,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -204807,6 +207210,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -204930,10 +207334,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -205108,10 +207514,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint32((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint32(4)) @@ -205131,6 +207539,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*12))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -207037,6 +209460,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -207146,7 +209570,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+88, Xsqlite3_mprintf(tls, __ccgo_ts+36291, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+88, Xsqlite3_mprintf(tls, __ccgo_ts+36317, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -207234,7 +209658,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { _ = libc.Int32FromInt32(0) - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36286, uint32(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36312, uint32(4)) *(*int32)(unsafe.Pointer(bp + 4)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 4)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -207271,10 +209695,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -207326,10 +209752,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -207375,6 +209803,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -207392,6 +209821,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -207442,6 +209872,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -207511,6 +209942,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -207542,6 +209974,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -207631,6 +210064,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -207667,6 +210101,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -208202,6 +210637,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -208407,6 +210843,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -208539,6 +210976,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -208575,6 +211013,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -208605,6 +211044,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -212413,6 +214887,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*12))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -212520,6 +214995,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -212594,6 +215070,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+20) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212638,6 +215115,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -212650,11 +215128,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*12) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -212663,6 +215143,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+16) } _ = libc.Int32FromInt32(0) @@ -212682,10 +215163,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*12) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212802,11 +215285,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36598, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36624, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25715, __ccgo_ts+36606, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25741, __ccgo_ts+36632, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11768, __ccgo_ts+36641, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11793, __ccgo_ts+36667, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -212885,6 +215368,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -212948,6 +215432,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -213072,6 +215557,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 28 + uintptr(ii)*4))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -213156,6 +215642,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -213195,6 +215682,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -213236,6 +215724,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -213269,9 +215758,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -213279,16 +215769,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 28 + uintptr(ii)*4)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -213337,7 +215830,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+44, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+44, bp, uint32(1), __ccgo_ts+36685) + _sqlite3Fts5BufferAppendBlob(tls, p+44, bp, uint32(1), __ccgo_ts+36711) } else { _sqlite3Fts5BufferSet(tls, p+44, bp, nToken, pToken) } @@ -213396,10 +215889,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -213425,6 +215920,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -213452,11 +215948,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 80 + uintptr(iSeg1)*104))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -213533,6 +216031,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -213757,6 +216256,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -213809,6 +216309,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -213859,7 +216360,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) _ = libc.Int32FromInt32(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36140, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+4) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36166, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+4) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) @@ -213999,6 +216500,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*4)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -214052,6 +216554,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -214063,6 +216566,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -214163,6 +216667,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -214253,6 +216758,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(ii)*4)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(ii)*4)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -214296,10 +216802,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -214336,6 +216844,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 24)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -214687,6 +217201,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 12)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 12))) @@ -215287,7 +217802,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -215327,7 +217842,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*uint8)(unsafe.Pointer(idxStr + uintptr(v3))) = uint8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) _ = libc.Int32FromInt32(0) } @@ -215349,7 +217864,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*uint8)(unsafe.Pointer(idxStr + uintptr(v5))) = uint8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -215370,6 +217885,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -215409,6 +217925,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -215487,6 +218004,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -215584,6 +218102,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -215617,6 +218136,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 4 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -215658,6 +218178,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 24 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 24 + uintptr(i)*4)) = t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int32(a) @@ -215688,6 +218209,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -215846,7 +218368,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14965 + v1 = __ccgo_ts + 14990 } else { v1 = __ccgo_ts + 1648 } @@ -215856,11 +218378,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1648 } if bDesc != 0 { - v3 = __ccgo_ts + 36817 + v3 = __ccgo_ts + 36843 } else { - v3 = __ccgo_ts + 36822 + v3 = __ccgo_ts + 36848 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36826, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36852, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) @@ -215915,18 +218437,19 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } _ = libc.Int32FromInt32(0) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36881, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36907, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5456, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5481, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36887, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36913, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -215953,6 +218476,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -215975,7 +218499,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36915, libc.VaList(bp+16, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36941, libc.VaList(bp+16, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+4, uintptr(0)) @@ -215995,6 +218519,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*4)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), i) goto _1 _1: + ; i++ } } @@ -216010,7 +218535,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { _ = libc.Int32FromInt32(0) - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36925, libc.VaList(bp+16, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36951, libc.VaList(bp+16, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -216044,7 +218569,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 60)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36946, libc.VaList(bp+16, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36972, libc.VaList(bp+16, z)) } } } else { @@ -216052,7 +218577,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34878 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34904 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -216103,7 +218628,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -216188,6 +218713,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -216260,7 +218786,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36979, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37005, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -216286,6 +218812,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -216447,36 +218974,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37015, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37041, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37026, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37052, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37106, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37132, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37114, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37140, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17327, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17361, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37170, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37196, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37176, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37202, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37192, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37218, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -216579,9 +219106,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*4))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*4))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17847, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17881, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37198, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37224, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -216612,11 +219139,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } else { - v1 = __ccgo_ts + 37257 + v1 = __ccgo_ts + 37283 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37269, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37295, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -216667,7 +219194,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -216836,6 +219363,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -216906,6 +219434,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -216921,6 +219450,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -217048,6 +219578,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -217066,6 +219597,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -217082,6 +219614,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -217119,6 +219652,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -217158,6 +219692,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -217415,6 +219950,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -217442,6 +219978,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -217458,7 +219995,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37332, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -217525,9 +220062,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -217535,10 +220074,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+4, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -217549,10 +220090,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+4, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 20))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -217563,6 +220106,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+4, int64(*(*int32)(unsafe.Pointer(bp + 28)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -217575,12 +220119,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+4, uint32(*(*int32)(unsafe.Pointer(bp + 36))), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 4))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 4))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -217640,7 +220187,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37327, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37353, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -217838,6 +220385,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -217882,7 +220430,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr if pMod == uintptr(0) { _ = libc.Int32FromInt32(0) rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37424, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*4 @@ -217898,7 +220446,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 8 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37420, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37446, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -217927,6 +220475,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -217941,6 +220490,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -217952,7 +220502,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg _ = libc.Int32FromInt32(0) - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37451) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37477) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -217967,7 +220517,7 @@ func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr _ = libc.Int32FromInt32(0) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37464, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37490, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -217989,17 +220539,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37555, - 1: __ccgo_ts + 35067, - 2: __ccgo_ts + 25715, - 3: __ccgo_ts + 35634, - 4: __ccgo_ts + 11768, + 0: __ccgo_ts + 37581, + 1: __ccgo_ts + 35093, + 2: __ccgo_ts + 25741, + 3: __ccgo_ts + 35660, + 4: __ccgo_ts + 11793, } // C documentation @@ -218020,10 +220571,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37562, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37588, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37608, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37634, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -218046,7 +220597,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37671, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37697, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -218063,10 +220614,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37671, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37697, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37676, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37702, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -218173,17 +220724,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 28 + uintptr(eStmt)*4)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37691, - 1: __ccgo_ts + 37759, - 2: __ccgo_ts + 37828, - 3: __ccgo_ts + 37861, - 4: __ccgo_ts + 37900, - 5: __ccgo_ts + 37940, - 6: __ccgo_ts + 37979, - 7: __ccgo_ts + 38022, - 8: __ccgo_ts + 38061, - 9: __ccgo_ts + 38105, - 10: __ccgo_ts + 38145, + 0: __ccgo_ts + 37717, + 1: __ccgo_ts + 37785, + 2: __ccgo_ts + 37854, + 3: __ccgo_ts + 37887, + 4: __ccgo_ts + 37926, + 5: __ccgo_ts + 37966, + 6: __ccgo_ts + 38005, + 7: __ccgo_ts + 38048, + 8: __ccgo_ts + 38087, + 9: __ccgo_ts + 38131, + 10: __ccgo_ts + 38171, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -218211,6 +220762,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = uint8(',') goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = uint8('\000') @@ -218219,14 +220771,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38168 + v2 = __ccgo_ts + 38194 } else { v2 = __ccgo_ts + 1648 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38171 + v3 = __ccgo_ts + 38197 } else { v3 = __ccgo_ts + 1648 } @@ -218284,12 +220836,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38179, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38205, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38283, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38309, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38321, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38347, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -218298,7 +220850,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38359, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38385, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -218310,14 +220862,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25715, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11768, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37555, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25741, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11793, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37581, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35634, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35660, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35067, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35093, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -218337,13 +220889,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30355 + v1 = __ccgo_ts + 30381 } else { v1 = __ccgo_ts + 1648 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38401, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38427, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38431, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38457, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -218384,35 +220936,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38475, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38501, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38498, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38524, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35067, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35093, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38504 + zCols = __ccgo_ts + 38530 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38536 + zCols = __ccgo_ts + 38562 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35634, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35660, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37555, __ccgo_ts+38584, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37581, __ccgo_ts+38610, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -218441,6 +220994,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 28 + uintptr(i)*4))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -218543,6 +221097,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -218683,6 +221238,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+12, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 12)) == SQLITE_OK { @@ -218756,9 +221312,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38601, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38627, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38651, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38677, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -218766,7 +221322,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -218813,6 +221369,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 16))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218910,6 +221467,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -218958,6 +221516,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 4))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218977,7 +221536,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38680, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38706, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -219078,6 +221637,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -219154,6 +221714,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -219180,6 +221741,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -219187,14 +221749,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 40)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35067, bp+40) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35093, bp+40) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 40)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -220096,15 +222674,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(zCsr) - int32(pText) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(zOut)-int32(aFold), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -220166,7 +222749,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38772 + zBase = __ccgo_ts + 38798 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -220257,6 +222840,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -220272,6 +222856,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -220331,6 +222916,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38782, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38808, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38785, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38790, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38816, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38795, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38798, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38824, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38801, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38827, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38806, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38832, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38815, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38847, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38852, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -220445,49 +223032,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38830, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38856, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38860, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38863, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38867, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38845, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38875, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38853, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38879, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38857, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38883, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -220504,20 +223091,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38861, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38841, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38887, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38864, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38890, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38857, uint32(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38897, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -220533,75 +223120,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38874, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38900, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38882, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38908, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38889, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38915, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38894, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38920, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38790, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38816, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38925, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38785, uint32(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38811, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38904, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38930, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38857, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38909, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15873, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15907, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38914, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38940, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38867, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38918, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38944, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38923, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38852, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38929, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38933, uint32(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38959, uint32(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38961, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38849, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38875, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -220610,48 +223197,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38941, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38967, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38857, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38883, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38975, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38981, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38841, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38867, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38960, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38966, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38992, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38853, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38879, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38974, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38982, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39008, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39012, aBuf+uintptr(nBuf-int32(7)), uint32(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38849, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38875, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -220659,21 +223246,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39020, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39026, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38853, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38879, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39006, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39032, aBuf+uintptr(nBuf-int32(6)), uint32(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38867, uint32(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38893, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -220691,48 +223278,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39013, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39039, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39018, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39044, aBuf+uintptr(nBuf-int32(4)), uint32(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39023, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39049, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39029, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39055, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38982, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39008, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39035, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39061, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39067, aBuf+uintptr(nBuf-int32(5)), uint32(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -220748,13 +223335,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39047, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39073, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39051, uint32(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39077, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39054, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39080, aBuf+uintptr(nBuf-int32(2)), uint32(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -220762,7 +223349,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39083, aBuf+uintptr(nBuf-int32(3)), uint32(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -220849,6 +223436,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -220922,14 +223510,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+39061) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+39087) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+38754) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), __ccgo_ts+38780) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('2') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -220946,6 +223534,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -221050,6 +223639,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -221202,7 +223792,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38772, + FzName: __ccgo_ts + 38798, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -221210,7 +223800,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39076, + FzName: __ccgo_ts + 39102, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -221218,7 +223808,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39082, + FzName: __ccgo_ts + 39108, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -221226,7 +223816,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39089, + FzName: __ccgo_ts + 39115, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -221246,6 +223836,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*16+4, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -226296,6 +228887,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -226585,6 +229177,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -226608,6 +229201,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -226775,16 +229369,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39097) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39123) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39101) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39127) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39105) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39131) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39114, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39140, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -226853,15 +229447,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39148, - 1: __ccgo_ts + 39188, - 2: __ccgo_ts + 39223, + 0: __ccgo_ts + 39174, + 1: __ccgo_ts + 39214, + 2: __ccgo_ts + 39249, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+23708, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == uint32(4) && libc.Xmemcmp(tls, __ccgo_ts+23742, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39266, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39292, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -226974,6 +229568,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -227031,10 +229626,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39299, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39325, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39330, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39356, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+4, uintptr(0)) } @@ -227054,7 +229649,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(bp + 4)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39381, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39407, libc.VaList(bp+16, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -227202,6 +229797,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -227302,6 +229898,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -227489,7 +230086,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39407, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39433, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -227542,7 +230139,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39417 + return __ccgo_ts + 39443 } type TAggInfo_col = struct { @@ -227823,11 +230420,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go index 23d8e9a3..19810c10 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated for linux/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450100/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. +// Code generated for linux/arm64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. //go:build linux && arm64 // +build linux,arm64 @@ -10,6 +10,8 @@ import ( "unsafe" "modernc.org/libc" + + "runtime" ) var ( @@ -445,7 +447,6 @@ const FLAG_SIGNED = 1 const FLAG_STRING = 4 const FNDELAY = 2048 const FNONBLOCK = 2048 -const FOPEN_MAX = 16 const FP_FAST_FMA = 1 const FP_FAST_FMAF = 1 const FP_ILOGB0 = -2147483647 @@ -998,6 +999,7 @@ const NC_UAggInfo = 256 const NC_UBaseReg = 1024 const NC_UEList = 128 const NC_UUpsert = 512 +const NC_Where = 1048576 const NDEBUG = 1 const NFDBITS = "__NFDBITS" const NN = 1 @@ -1730,6 +1732,7 @@ const SQLITE_CONFIG_PCACHE = 14 const SQLITE_CONFIG_PCACHE2 = 18 const SQLITE_CONFIG_PCACHE_HDRSZ = 24 const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 const SQLITE_CONFIG_SCRATCH = 6 const SQLITE_CONFIG_SERIALIZED = 3 const SQLITE_CONFIG_SINGLETHREAD = 1 @@ -2184,10 +2187,7 @@ const SQLITE_OPEN_TEMP_JOURNAL = 4096 const SQLITE_OPEN_TRANSIENT_DB = 1024 const SQLITE_OPEN_URI = 64 const SQLITE_OPEN_WAL = 524288 -const SQLITE_OS_KV = 0 -const SQLITE_OS_OTHER = 0 const SQLITE_OS_UNIX = 1 -const SQLITE_OS_WIN = 0 const SQLITE_OmitNoopJoin = 256 const SQLITE_OmitOrderBy = 262144 const SQLITE_OnePass = 134217728 @@ -2262,7 +2262,7 @@ const SQLITE_SHM_SHARED = 4 const SQLITE_SHM_UNLOCK = 1 const SQLITE_SORTER_PMASZ = 250 const SQLITE_SOUNDEX = 1 -const SQLITE_SOURCE_ID = "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a" +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" const SQLITE_SO_ASC = 0 const SQLITE_SO_DESC = 1 const SQLITE_SO_UNDEFINED = -1 @@ -2370,8 +2370,8 @@ const SQLITE_UTF16LE = 2 const SQLITE_UTF16NATIVE = 2 const SQLITE_UTF16_ALIGNED = 8 const SQLITE_UTF8 = 1 -const SQLITE_VERSION = "3.45.1" -const SQLITE_VERSION_NUMBER = 3045001 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 const SQLITE_VTABRISK_High = 2 const SQLITE_VTABRISK_Low = 0 const SQLITE_VTABRISK_Normal = 1 @@ -2829,6 +2829,7 @@ const VDBE_HALT_STATE = 3 const VDBE_INIT_STATE = 0 const VDBE_READY_STATE = 1 const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 const WALINDEX_HDR_SIZE = 0 const WALINDEX_MAX_VERSION = 3007000 const WALINDEX_PGSZ = 0 @@ -2966,7 +2967,6 @@ const YY_SHIFT_MAX = 2088 const YY_SHIFT_MIN = 0 const _ALLOCA_H = 1 const _ASSERT_H = 1 -const _ATFILE_SOURCE = 1 const _BITS_BYTESWAP_H = 1 const _BITS_ENDIANNESS_H = 1 const _BITS_ENDIAN_H = 1 @@ -2990,9 +2990,7 @@ const _BITS_UINTN_IDENTITY_H = 1 const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 0 const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 0 -const _DEFAULT_SOURCE = 1 const _DLFCN_H = 1 -const _DYNAMIC_STACK_SIZE_SOURCE = 1 const _ENDIAN_H = 1 const _ERRNO_H = 1 const _FCNTL_H = 1 @@ -3021,12 +3019,6 @@ const _IONBF = 2 const _IO_EOF_SEEN = 16 const _IO_ERR_SEEN = 32 const _IO_USER_LOCK = 32768 -const _ISOC11_SOURCE = 1 -const _ISOC2X_SOURCE = 1 -const _ISOC95_SOURCE = 1 -const _ISOC99_SOURCE = 1 -const _LARGEFILE64_SOURCE = 1 -const _LARGEFILE_SOURCE = 1 const _LARGE_FILE = 1 const _LFS64_ASYNCHRONOUS_IO = 1 const _LFS64_LARGEFILE = 1 @@ -3049,7 +3041,6 @@ const _POSIX_BARRIERS = 200809 const _POSIX_CHOWN_RESTRICTED = 0 const _POSIX_CLOCK_SELECTION = 200809 const _POSIX_CPUTIME = 0 -const _POSIX_C_SOURCE = 200809 const _POSIX_FSYNC = 200809 const _POSIX_IPV6 = 200809 const _POSIX_JOB_CONTROL = 1 @@ -3071,7 +3062,6 @@ const _POSIX_SAVED_IDS = 1 const _POSIX_SEMAPHORES = 200809 const _POSIX_SHARED_MEMORY_OBJECTS = 200809 const _POSIX_SHELL = 1 -const _POSIX_SOURCE = 1 const _POSIX_SPAWN = 200809 const _POSIX_SPIN_LOCKS = 200809 const _POSIX_SPORADIC_SERVER = -1 @@ -3134,8 +3124,6 @@ const _XOPEN_LEGACY = 1 const _XOPEN_REALTIME = 1 const _XOPEN_REALTIME_THREADS = 1 const _XOPEN_SHM = 1 -const _XOPEN_SOURCE = 700 -const _XOPEN_SOURCE_EXTENDED = 1 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 const _XOPEN_XCU_VERSION = 4 @@ -3366,16 +3354,6 @@ const __GCC_IEC_559_COMPLEX = 2 const __GID_T_TYPE = "__U32_TYPE" const __GLIBC_FLT_EVAL_METHOD = 0 const __GLIBC_MINOR__ = 36 -const __GLIBC_USE_DEPRECATED_GETS = 0 -const __GLIBC_USE_DEPRECATED_SCANF = 0 -const __GLIBC_USE_IEC_60559_BFP_EXT = 1 -const __GLIBC_USE_IEC_60559_BFP_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT = 1 -const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = 1 -const __GLIBC_USE_IEC_60559_TYPES_EXT = 1 -const __GLIBC_USE_ISOC2X = 1 -const __GLIBC_USE_LIB_EXT2 = 1 const __GLIBC__ = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" const __GNUC_MINOR__ = 2 @@ -3383,7 +3361,6 @@ const __GNUC_PATCHLEVEL__ = 0 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 12 -const __GNU_LIBRARY__ = 6 const __GXX_ABI_VERSION = 1017 const __HAVE_DISTINCT_FLOAT128 = 0 const __HAVE_DISTINCT_FLOAT128X = 0 @@ -3581,28 +3558,6 @@ const __UINT_LEAST32_MAX__ = 4294967295 const __UINT_LEAST64_MAX__ = 18446744073709551615 const __UINT_LEAST8_MAX__ = 255 const __USECONDS_T_TYPE = "__U32_TYPE" -const __USE_ATFILE = 1 -const __USE_DYNAMIC_STACK_SIZE = 1 -const __USE_FILE_OFFSET64 = 1 -const __USE_FORTIFY_LEVEL = 0 -const __USE_GNU = 1 -const __USE_ISOC11 = 1 -const __USE_ISOC95 = 1 -const __USE_ISOC99 = 1 -const __USE_LARGEFILE = 1 -const __USE_LARGEFILE64 = 1 -const __USE_MISC = 1 -const __USE_POSIX = 1 -const __USE_POSIX199309 = 1 -const __USE_POSIX199506 = 1 -const __USE_POSIX2 = 1 -const __USE_UNIX98 = 1 -const __USE_XOPEN = 1 -const __USE_XOPEN2K = 1 -const __USE_XOPEN2K8 = 1 -const __USE_XOPEN2K8XSI = 1 -const __USE_XOPEN2KXSI = 1 -const __USE_XOPEN_EXTENDED = 1 const __VERSION__ = "12.2.0" const __WALL = 1073741824 const __WCHAR_MAX__ = 4294967295 @@ -3722,7 +3677,6 @@ const sqlite3ParserCTX_PDECL = 0 const sqlite3ParserTOKENTYPE = 0 const sqlite3Parser_ENGINEALWAYSONSTACK = 1 const sqlite3StrNICmp = 0 -const static_assert = 0 const threadid = 0 const tkCREATE = 4 const tkEND = 7 @@ -8864,6 +8818,7 @@ type TUpsert = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -10427,6 +10382,10 @@ type Table1 = TTable1 /* Does the table have a rowid */ +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -11132,6 +11091,7 @@ type TUpsert1 = struct { FpUpsertWhere uintptr FpNextUpsert uintptr FisDoUpdate Tu8 + FisDup Tu8 FpToFree uintptr FpUpsertIdx uintptr FpUpsertSrc uintptr @@ -13681,7 +13641,7 @@ func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uin var pMutex, v1 uintptr _, _ = pMutex, v1 if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { - return _sqlite3MisuseError(tls, int32(23845)) + return _sqlite3MisuseError(tls, int32(23890)) } if _statMutex[op] != 0 { v1 = _sqlite3Pcache1Mutex(tls) @@ -13830,6 +13790,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _1 _1: + ; i++ } _sqlite3BtreeLeaveAll(tls, db) @@ -13842,7 +13803,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** databases. *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_SCHEMA_USED): + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ _sqlite3BtreeEnterAll(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp @@ -13868,6 +13829,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _3 _3: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst @@ -13878,11 +13840,13 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) goto _4 _4: + ; p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext } } goto _2 _2: + ; i1++ } (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) @@ -13897,7 +13861,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p ** *pHighwater is set to zero. */ fallthrough - case int32(SQLITE_DBSTATUS_STMT_USED): + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 _ = libc.Int32FromInt32(0) @@ -13910,6 +13874,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p _sqlite3VdbeDelete(tls, pVdbe) goto _5 _5: + ; pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext } (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd @@ -13945,6 +13910,7 @@ func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, p } goto _6 _6: + ; i2++ } *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ @@ -14145,6 +14111,7 @@ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r in zFormat += uintptr(4) } end_getDigits: + ; _ = ap return cnt } @@ -14212,6 +14179,7 @@ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { zDate += uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) zulu_time: + ; for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zDate))])&int32(0x01) != 0 { zDate++ } @@ -14895,6 +14863,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD goto _4 _4: + ; if v3 = iErr != 0; v3 { v2 = cnt cnt++ @@ -14912,6 +14881,13 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } } case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1269, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { v5 = int32(*(*float64)(unsafe.Pointer(bp))) n = v5 @@ -15022,6 +14998,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _8 _8: + ; n++ } if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { @@ -15135,7 +15112,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { switch i { - case int32(4): + case int32(4): /* Special processing to add months */ _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) @@ -15149,7 +15126,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = uint8(0) *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) - case int32(5): + case int32(5): /* Special processing to add years */ y = int32(*(*float64)(unsafe.Pointer(bp))) _ = libc.Int32FromInt32(0) _computeYMD_HMS(tls, p) @@ -15165,6 +15142,7 @@ func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, } goto _11 _11: + ; i++ } _clearYMD_HMS_TZ(tls, p) @@ -15218,6 +15196,7 @@ func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr } goto _2 _2: + ; i++ } _computeJD(tls, p) @@ -15485,7 +15464,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { j = i + uint64(1) cf = *(*uint8)(unsafe.Pointer(zFmt + uintptr(i))) switch int32(cf) { - case int32('d'): + case int32('d'): /* Fall thru */ fallthrough case int32('e'): if int32(cf) == int32('d') { @@ -15511,7 +15490,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v4 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) - case int32('I'): + case int32('I'): /* Fall thru */ fallthrough case int32('l'): h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh @@ -15527,9 +15506,9 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { v5 = __ccgo_ts + 1340 } Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) - case int32('W'): + case int32('W'): /* Fall thru */ fallthrough - case int32('j'): + case int32('j'): /* Number of days since 1st day of year */ *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = uint8(0) (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) @@ -15548,7 +15527,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) case int32('M'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) - case int32('p'): + case int32('p'): /* Fall thru */ fallthrough case int32('P'): if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { @@ -15579,7 +15558,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1335, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) case int32('T'): Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1409, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) - case int32('u'): + case int32('u'): /* Fall thru */ fallthrough case int32('w'): c = uint8(int32(uint8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) @@ -15597,6 +15576,7 @@ func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if j < i { @@ -16215,6 +16195,7 @@ func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { } goto _1 _1: + ; pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext } Xsqlite3_mutex_leave(tls, mutex) @@ -17999,6 +17980,7 @@ func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) goto _1 _1: + ; pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse } } @@ -18560,6 +18542,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _13 _13: + ; if v12 = !(done != 0); v12 { fmt++ v11 = fmt @@ -18585,6 +18568,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _25 _25: + ; idx++ } /* @@ -18646,11 +18630,15 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _26: + ; flag_long = uint8(2) _28: + ; _27: + ; cThousand = uint8(0) _29: + ; if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { if bArgList != 0 { v = _getIntArg(tls, pArgList) @@ -18759,6 +18747,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _50 _50: + ; idx++ } } @@ -18780,14 +18769,18 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v55)) = x1 goto _53 _53: + ; pre++ } } length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) goto _44 _32: + ; _31: + ; _30: + ; if bArgList != 0 { realvalue = _getDoubleArg(tls, pArgList) } else { @@ -18803,6 +18796,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li iRound = -precision } else { if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } iRound = precision } else { iRound = precision + int32(1) @@ -18935,6 +18931,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _63 _63: + ; e2-- } } @@ -18956,6 +18953,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(v70)) = uint8('0') goto _69 _69: + ; precision-- e2++ } @@ -19044,6 +19042,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li *(*uint8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*uint8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) goto _84 _84: + ; i-- } i = libc.BoolInt32(int32(prefix) != 0) @@ -19061,6 +19060,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _44 _33: + ; if !(bArgList != 0) { *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) } @@ -19069,11 +19069,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v87 goto _44 _34: + ; (*(*[70]uint8)(unsafe.Pointer(bp)))[0] = uint8('%') bufpt = bp length = int32(1) goto _44 _35: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) length = int32(1) @@ -19150,7 +19152,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li flag_altform2 = uint8(1) goto adjust_width_for_utf8 _37: + ; _36: + ; if bArgList != 0 { bufpt = _getTextArg(tls, pArgList) xtype = uint8(etSTRING) @@ -19205,6 +19209,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _95 _95: + ; length++ } } @@ -19212,6 +19217,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) } adjust_width_for_utf8: + ; if flag_altform2 != 0 && width > 0 { /* Adjust width to account for extra bytes in UTF-8 characters */ ii = length - int32(1) @@ -19224,9 +19230,12 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } } goto _44 - _40: /* %q: Escape ' characters */ - _39: /* %Q: Escape ' and enclose in '...' */ + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ _38: + ; if int32(xtype) == int32(etSQLESCAPE3) { v97 = int32('"') } else { @@ -19274,6 +19283,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _99 _99: + ; i1++ k-- } @@ -19313,6 +19323,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _105 _105: + ; i1++ } if needQuote != 0 { @@ -19324,6 +19335,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = int32(j1) goto adjust_width_for_utf8 _41: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19348,6 +19360,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v110 goto _44 _42: + ; if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { return } @@ -19381,9 +19394,11 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li length = v111 goto _44 _43: + ; _ = libc.Int32FromInt32(0) return - _44: /* End switch over the format type */ + _44: + ; /* End switch over the format type */ /* ** The text of the conversion is pointed to by "bufpt" and is ** "length" characters long. The field width is "width". Do @@ -19410,6 +19425,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li } goto _1 _1: + ; fmt++ } /* End for loop over the format string */ } @@ -20284,6 +20300,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) goto _1 _1: + ; i++ } i = 0 @@ -20294,6 +20311,7 @@ func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) goto _2 _2: + ; i++ } } @@ -20971,6 +20989,7 @@ func _sqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc Tu8) (r in (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) translate_out: + ; return SQLITE_OK return r } @@ -21268,6 +21287,23 @@ func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { return rc } +// C documentation +// +// /* +// ** Return true if the floating point value is NaN or +Inf or -Inf. +// */ +func _sqlite3IsOverflow(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)< 0 && eValid != 0 && eType > 0 { return eType @@ -22133,6 +22174,7 @@ func _compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) (r int32) { c = (int32(*(*uint8)(unsafe.Pointer(zNum + uintptr(i*incr)))) - int32(*(*uint8)(unsafe.Pointer(pow63 + uintptr(i))))) * int32(10) goto _1 _1: + ; i++ } if c == 0 { @@ -22185,6 +22227,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc } goto _1 _1: + ; i += int32(2) } nonNum = libc.BoolInt32(i < length) @@ -22220,6 +22263,7 @@ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc u = u*uint64(10) + uint64(c) - uint64('0') goto _2 _2: + ; i += incr } if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('5') { iRound = int32(1) @@ -22675,6 +22723,7 @@ func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == 0 || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != 0 { @@ -22735,6 +22784,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -22758,6 +22808,7 @@ func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -22984,6 +23035,7 @@ func _sqlite3VarintLen(tls *libc.TLS, v Tu64) (r int32) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; i++ } return i @@ -23046,6 +23098,7 @@ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr *(*uint8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = uint8(int32(_sqlite3HexToInt(tls, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { - _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40110)) + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) } Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) @@ -26691,6 +26753,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { } goto _1 _1: + ; ii-- } if ii > 0 { @@ -26708,7 +26771,7 @@ func _openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) (r int32) { if fd >= 0 { return SQLITE_OK } - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41716)), __ccgo_ts+3510, bp, int32(41716)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3510, bp, int32(41778)) } // C documentation @@ -26747,7 +26810,7 @@ func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) if rc != 0 { _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)<= 0 { - _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42521)) + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) } (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) @@ -27368,7 +27433,7 @@ func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r in ** help detect if a -shm file truncation is legitimate or is the work ** or a rogue process. */ if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 { - rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)< iRegion { *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) } else { @@ -27822,6 +27891,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( } goto _5 _5: + ; ii++ } /* Get the exclusive locks at the system level. Then if successful @@ -27839,6 +27909,7 @@ func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) ( *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) goto _7 _7: + ; ii++ } } @@ -27899,6 +27970,7 @@ func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext @@ -27993,7 +28065,7 @@ func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { if pNew == uintptr(-libc.Int32FromInt32(1)) { pNew = uintptr(0) nNew = 0 - _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43339)) + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) /* If the mmap() above failed, assume that all subsequent mmap() calls ** will probably fail too. Fall back to using xRead/xWrite exclusively ** in this case. */ @@ -28372,7 +28444,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ - _robust_close(tls, pNew, h, int32(43847)) + _robust_close(tls, pNew, h, int32(43909)) h = -int32(1) } _unixLeaveMutex(tls) @@ -28392,7 +28464,7 @@ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilenam _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { - _robust_close(tls, pNew, h, int32(43932)) + _robust_close(tls, pNew, h, int32(43994)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle @@ -28548,6 +28620,7 @@ func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } pUnused = *(*uintptr)(unsafe.Pointer(pp)) @@ -28818,7 +28891,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags } } if fd < 0 { - rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44373)), __ccgo_ts+3393, zName, int32(44373)) + rc2 = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44435)), __ccgo_ts+3393, zName, int32(44435)) if rc == SQLITE_OK { rc = rc2 } @@ -28871,6 +28944,7 @@ func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags _ = libc.Int32FromInt32(0) rc = _fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) open_finished: + ; if rc != SQLITE_OK { Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) } @@ -28895,7 +28969,7 @@ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) ( if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< int32(SQLITE_MAX_SYMLINK) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44624)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) return } got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+128, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) if got <= 0 || got >= libc.Int64FromInt64(4098)-libc.Int64FromInt32(2) { - (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44629)), __ccgo_ts+3582, zIn, int32(44629)) + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3582, zIn, int32(44691)) return } (*(*[4098]uint8)(unsafe.Pointer(bp + 128)))[got] = uint8(0) @@ -29066,6 +29140,7 @@ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { j = i + int32(1) goto _2 _2: + ; v1 = i i++ if !(*(*uint8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { @@ -29098,14 +29173,14 @@ func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut if int32(*(*uint8)(unsafe.Pointer(zPath))) != int32('/') { if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) == uintptr(0) { - return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44687)), __ccgo_ts+3411, zPath, int32(44687)) + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3411, zPath, int32(44749)) } _appendAllPathElements(tls, bp, bp+24) } _appendAllPathElements(tls, bp, zPath) *(*uint8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = uint8(0) if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { - return _sqlite3CantopenError(tls, int32(44693)) + return _sqlite3CantopenError(tls, int32(44755)) } if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)<= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) if aiValues == uintptr(0) { @@ -30969,6 +31058,7 @@ bitvec_set_rehash: } goto _3 _3: + ; j++ } _sqlite3DbFree(tls, uintptr(0), aiValues) @@ -30976,6 +31066,7 @@ bitvec_set_rehash: } } bitvec_set_end: + ; (*TBitvec)(unsafe.Pointer(p)).FnSet++ *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i return SQLITE_OK @@ -31033,6 +31124,7 @@ func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { } goto _2 _2: + ; j++ } } @@ -31058,6 +31150,7 @@ func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -31201,10 +31294,12 @@ func _sqlite3BitvecBuiltinTest(tls *libc.TLS, sz int32, aOp uintptr) (r int32) { } goto _7 _7: + ; *(*int32)(unsafe.Pointer(bp))++ } /* Free allocated structure */ bitvec_end: + ; Xsqlite3_free(tls, pTmpSpace) Xsqlite3_free(tls, pV) _sqlite3BitvecDestroy(tls, pBitvec) @@ -31578,6 +31673,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _1 _1: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg @@ -31589,6 +31685,7 @@ func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage } goto _2 _2: + ; pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev } } @@ -31795,6 +31892,7 @@ func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31817,6 +31915,7 @@ func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail @@ -31882,6 +31981,7 @@ func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { } goto _1 _1: + ; p = pNext } if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { @@ -31991,6 +32091,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { @@ -32017,6 +32118,7 @@ func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { p = v3 goto _2 _2: + ; i++ } return p @@ -32038,6 +32140,7 @@ func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext goto _1 _1: + ; p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext } return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) @@ -32149,6 +32252,7 @@ func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { nDirty++ goto _1 _1: + ; pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext } if nCache != 0 { @@ -32565,6 +32669,7 @@ func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) goto _3 _3: + ; nBulk-- v2 = nBulk if !(v2 != 0) { @@ -32833,6 +32938,7 @@ func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) @@ -32890,6 +32996,7 @@ func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext @@ -33739,6 +33846,7 @@ func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) goto _1 _1: + ; pChunk = pNextChunk } (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) @@ -33898,6 +34006,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn @@ -33920,6 +34029,7 @@ func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { pIn = v3 goto _2 _2: + ; i++ } return pIn @@ -34028,6 +34138,7 @@ func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) goto _2 _2: + ; iDepth++ } return p @@ -34122,6 +34233,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _1 _1: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } if pTree == uintptr(0) { @@ -34163,6 +34275,7 @@ func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsq } goto _4 _4: + ; pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight } return 0 @@ -35067,12 +35180,14 @@ func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 goto _2 _2: + ; i++ } return int32(1) } goto _1 _1: + ; i++ } return 0 @@ -35285,6 +35400,7 @@ func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32 *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(u)))) goto _10 _10: + ; u++ } if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { @@ -35436,6 +35552,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { } goto _1 _1: + ; ii++ } v2 = _journalHdrOffset(tls, pPager) @@ -35512,6 +35629,7 @@ func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) goto _3 _3: + ; nWrite += nHeader } return rc @@ -35682,6 +35800,7 @@ func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) cksum += uint32(*(*uint8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) goto _1 _1: + ; nSuper++ } /* If in full-sync mode, advance to the next disk sector before writing @@ -35773,6 +35892,7 @@ func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) goto _1 _1: + ; ii++ } if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { @@ -35808,6 +35928,7 @@ func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) } goto _1 _1: + ; ii++ } return rc @@ -36599,6 +36720,7 @@ func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { _sqlite3OsClose(tls, pSuper) rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) delsuper_out: + ; Xsqlite3_free(tls, zFree) if pSuper != 0 { _sqlite3OsClose(tls, pSuper) @@ -36927,12 +37049,14 @@ func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { } goto _1 _1: + ; u++ } } /*NOTREACHED*/ _ = libc.Int32FromInt32(0) end_playback: + ; if rc == SQLITE_OK { rc = _sqlite3PagerSetPagesize(tls, pPager, bp+20, -int32(1)) } @@ -36974,7 +37098,7 @@ end_playback: rc = _pager_delsuper(tls, pPager, zSuper) } if isHot != 0 && nPlayback != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)< int64(1) { _sqlite3PagerUnrefNotNull(tls, pPgOld) - return _sqlite3CorruptError(tls, int32(63903)) + return _sqlite3CorruptError(tls, int32(63973)) } p4 = pPg + 52 *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) @@ -41293,7 +41432,7 @@ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode in ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ - Xsqlite3_exec(tls, db, __ccgo_ts+4084, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+4109, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode == SQLITE_CHECKPOINT_PASSIVE { @@ -42716,6 +42855,7 @@ func _walCleanupHash(tls *libc.TLS, pWal uintptr) { } goto _1 _1: + ; i++ } /* Zero the entries in the aPgno array that correspond to frames with @@ -42773,10 +42913,11 @@ func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r in v2 = nCollide nCollide-- if v2 == 0 { - return _sqlite3CorruptError(tls, int32(65829)) + return _sqlite3CorruptError(tls, int32(65899)) } goto _1 _1: + ; iKey = _walNextHash(tls, iKey) } *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage @@ -42864,7 +43005,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { ** are able to understand */ version = _sqlite3Get4byte(tls, bp+8+4) if version != uint32(WAL_MAX_VERSION) { - rc = _sqlite3CantopenError(tls, int32(65961)) + rc = _sqlite3CantopenError(tls, int32(66031)) goto finished } /* Malloc a buffer to read frames into. */ @@ -42930,6 +43071,7 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _4 _4: + ; iFrame++ } *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) @@ -42955,11 +43097,13 @@ func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { } goto _1 _1: + ; iPg++ } Xsqlite3_free(tls, aFrame) } finished: + ; if rc == SQLITE_OK { *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] @@ -42993,6 +43137,7 @@ finished: } goto _6 _6: + ; i++ } /* If more than one frame was recovered from the log file, report an @@ -43001,10 +43146,11 @@ finished: ** checkpointing the log file. */ if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)< int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { - rc = _sqlite3CorruptError(tls, int32(70962)) + rc = _sqlite3CorruptError(tls, int32(71032)) } else { rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) } @@ -47725,7 +47903,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if key == uint32(0) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71160)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) @@ -47738,12 +47916,12 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71173)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) goto ptrmap_exit } offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71178)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) goto ptrmap_exit } _ = libc.Int32FromInt32(0) @@ -47758,6 +47936,7 @@ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, } } ptrmap_exit: + ; _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) } @@ -47787,7 +47966,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) if offset < 0 { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) - return _sqlite3CorruptError(tls, int32(71223)) + return _sqlite3CorruptError(tls, int32(71293)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -47797,7 +47976,7 @@ func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uin } _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { - return _sqlite3CorruptError(tls, int32(71231)) + return _sqlite3CorruptError(tls, int32(71301)) } return SQLITE_OK } @@ -48236,7 +48415,7 @@ func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71671)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) return } ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) @@ -48282,12 +48461,12 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71729)) + return _sqlite3CorruptError(tls, int32(71799)) } if iFree != 0 { iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { - return _sqlite3CorruptError(tls, int32(71732)) + return _sqlite3CorruptError(tls, int32(71802)) } if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { pEnd = data + uintptr(cellOffset+nCell*int32(2)) @@ -48295,21 +48474,21 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { - return _sqlite3CorruptError(tls, int32(71740)) + return _sqlite3CorruptError(tls, int32(71810)) } if iFree2 != 0 { if iFree+sz > iFree2 { - return _sqlite3CorruptError(tls, int32(71743)) + return _sqlite3CorruptError(tls, int32(71813)) } sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { - return _sqlite3CorruptError(tls, int32(71745)) + return _sqlite3CorruptError(tls, int32(71815)) } libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz))) sz += sz2 } else { if iFree+sz > usableSize { - return _sqlite3CorruptError(tls, int32(71749)) + return _sqlite3CorruptError(tls, int32(71819)) } } cbrk = top + sz @@ -48332,6 +48511,7 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { } goto _1 _1: + ; pAddr += uintptr(2) } goto defragment_out @@ -48356,13 +48536,13 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { ** if PRAGMA cell_size_check=ON. */ if pc > iCellLast { - return _sqlite3CorruptError(tls, int32(71782)) + return _sqlite3CorruptError(tls, int32(71852)) } _ = libc.Int32FromInt32(0) size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) cbrk -= size if cbrk < iCellStart || pc+size > usableSize { - return _sqlite3CorruptError(tls, int32(71788)) + return _sqlite3CorruptError(tls, int32(71858)) } _ = libc.Int32FromInt32(0) *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48370,14 +48550,16 @@ func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size)) goto _2 _2: + ; i++ } } *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) defragment_out: + ; _ = libc.Int32FromInt32(0) if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { - return _sqlite3CorruptError(tls, int32(71802)) + return _sqlite3CorruptError(tls, int32(71872)) } _ = libc.Int32FromInt32(0) *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) @@ -48440,7 +48622,7 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint } else { if x+pc > maxPC { /* This slot extends off the end of the usable part of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71859)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) return uintptr(0) } else { /* The slot remains on the free-list. Reduce its size to account @@ -48457,14 +48639,14 @@ func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uint if pc <= iAddr { if pc != 0 { /* The next slot in the chain comes before the current slot */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71874)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71944)) } return uintptr(0) } } if pc > maxPC+nByte-int32(4) { /* The free slot chain extends off the end of the page */ - *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71881)) + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) } return uintptr(0) } @@ -48515,11 +48697,11 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { top = int32(65536) } else { - return _sqlite3CorruptError(tls, int32(71929)) + return _sqlite3CorruptError(tls, int32(71999)) } } else { if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(71932)) + return _sqlite3CorruptError(tls, int32(72002)) } } /* If there is enough space between gap and top for one more cell pointer, @@ -48534,7 +48716,7 @@ func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r g2 = v1 *(*int32)(unsafe.Pointer(pIdx)) = v1 if g2 <= gap { - return _sqlite3CorruptError(tls, int32(71949)) + return _sqlite3CorruptError(tls, int32(72019)) } else { return SQLITE_OK } @@ -48627,12 +48809,12 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if int32(iFreeBlk) == 0 { break } /* TH3: corrupt082.100 */ - return _sqlite3CorruptError(tls, int32(72028)) + return _sqlite3CorruptError(tls, int32(72098)) } iPtr = iFreeBlk } if uint32(iFreeBlk) > (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ - return _sqlite3CorruptError(tls, int32(72033)) + return _sqlite3CorruptError(tls, int32(72103)) } _ = libc.Int32FromInt32(0) /* At this point: @@ -48644,11 +48826,11 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { nFrag = uint8(uint32(iFreeBlk) - iEnd) if iEnd > uint32(iFreeBlk) { - return _sqlite3CorruptError(tls, int32(72045)) + return _sqlite3CorruptError(tls, int32(72115)) } iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - return _sqlite3CorruptError(tls, int32(72048)) + return _sqlite3CorruptError(tls, int32(72118)) } iSize = uint16(iEnd - uint32(iStart)) iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))<= int32(iStart) { if iPtrEnd > int32(iStart) { - return _sqlite3CorruptError(tls, int32(72061)) + return _sqlite3CorruptError(tls, int32(72131)) } nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) iSize = uint16(iEnd - uint32(iPtr)) @@ -48669,7 +48851,7 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) } } if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { - return _sqlite3CorruptError(tls, int32(72067)) + return _sqlite3CorruptError(tls, int32(72137)) } p2 = data + uintptr(int32(hdr)+int32(7)) *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) @@ -48686,10 +48868,10 @@ func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) ** so just extend the cell content area rather than create another ** freelist entry */ if int32(iStart) < int32(x) { - return _sqlite3CorruptError(tls, int32(72081)) + return _sqlite3CorruptError(tls, int32(72151)) } if int32(iPtr) != int32(hdr)+int32(1) { - return _sqlite3CorruptError(tls, int32(72082)) + return _sqlite3CorruptError(tls, int32(72152)) } *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) @@ -48752,7 +48934,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72136)) + return _sqlite3CorruptError(tls, int32(72206)) } } } else { @@ -48778,7 +48960,7 @@ func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) - return _sqlite3CorruptError(tls, int32(72160)) + return _sqlite3CorruptError(tls, int32(72230)) } } } @@ -48825,12 +49007,12 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will ** always be at least one cell before the first freeblock. */ - return _sqlite3CorruptError(tls, int32(72211)) + return _sqlite3CorruptError(tls, int32(72281)) } for int32(1) != 0 { if pc > iCellLast { /* Freeblock off the end of the page */ - return _sqlite3CorruptError(tls, int32(72216)) + return _sqlite3CorruptError(tls, int32(72286)) } next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { /* Freeblock not in ascending order */ - return _sqlite3CorruptError(tls, int32(72226)) + return _sqlite3CorruptError(tls, int32(72296)) } if uint32(pc)+size > uint32(usableSize) { /* Last freeblock extends past page end */ - return _sqlite3CorruptError(tls, int32(72230)) + return _sqlite3CorruptError(tls, int32(72300)) } } /* At this point, nFree contains the sum of the offset to the start @@ -48857,7 +49039,7 @@ func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { ** area, according to the page header, lies within the page. */ if nFree > usableSize || nFree < iCellFirst { - return _sqlite3CorruptError(tls, int32(72242)) + return _sqlite3CorruptError(tls, int32(72312)) } (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) return SQLITE_OK @@ -48888,14 +49070,15 @@ func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { } pc = int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))) if pc < iCellFirst || pc > iCellLast { - return _sqlite3CorruptError(tls, int32(72273)) + return _sqlite3CorruptError(tls, int32(72343)) } sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) if pc+sz > usableSize { - return _sqlite3CorruptError(tls, int32(72278)) + return _sqlite3CorruptError(tls, int32(72348)) } goto _1 _1: + ; i++ } return SQLITE_OK @@ -48927,7 +49110,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating ** the b-tree page type. */ if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { - return _sqlite3CorruptError(tls, int32(72310)) + return _sqlite3CorruptError(tls, int32(72380)) } _ = libc.Int32FromInt32(0) (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) @@ -48941,7 +49124,7 @@ func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { /* To many cells for a single page. The page must be corrupt */ - return _sqlite3CorruptError(tls, int32(72324)) + return _sqlite3CorruptError(tls, int32(72394)) } /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only ** possible for a root page of a table that contains no rows) then the @@ -49107,7 +49290,7 @@ func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bRe _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72467)) + return _sqlite3CorruptError(tls, int32(72537)) } rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) if rc != 0 { @@ -49184,7 +49367,7 @@ func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) - return _sqlite3CorruptError(tls, int32(72539)) + return _sqlite3CorruptError(tls, int32(72609)) } (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) } else { @@ -49276,7 +49459,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt /* Set the variable isMemdb to true for an in-memory database, or ** false for a file-based database. */ - isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4165) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4190) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -49358,6 +49541,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _3 _3: + ; iDb-- } (*TBtree)(unsafe.Pointer(p)).FpBt = pBt @@ -49366,6 +49550,7 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _2 _2: + ; pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext } Xsqlite3_mutex_leave(tls, mutexShared) @@ -49504,11 +49689,13 @@ func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt } goto _8 _8: + ; i++ } } *(*uintptr)(unsafe.Pointer(ppBtree)) = p btree_open_out: + ; if rc != SQLITE_OK { if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) @@ -50092,7 +50279,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { ** The original design allowed these amounts to vary, but as of ** version 3.6.0, we require them to be fixed. */ - if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4174, uint64(3)) != 0 { + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4199, uint64(3)) != 0 { goto page1_init_failed } /* EVIDENCE-OF: R-51873-39618 The page size for a database file is @@ -50131,7 +50318,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { } if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { - rc = _sqlite3CorruptError(tls, int32(73477)) + rc = _sqlite3CorruptError(tls, int32(73547)) goto page1_init_failed } else { nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) @@ -50187,6 +50374,7 @@ func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage return SQLITE_OK page1_init_failed: + ; _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) return rc @@ -50364,6 +50552,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } goto _2 _2: + ; pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext } } @@ -50469,6 +50658,7 @@ func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uin } } trans_begun: + ; if rc == SQLITE_OK { if pSchemaVersion != 0 { *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) @@ -50550,6 +50740,7 @@ func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { } goto _2 _2: + ; i++ } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -50587,7 +50778,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT if int32(eType) == int32(PTRMAP_OVERFLOW2) { /* The pointer is always the first 4 bytes of the page in this case. */ if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { - return _sqlite3CorruptError(tls, int32(73925)) + return _sqlite3CorruptError(tls, int32(73995)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) } else { @@ -50611,7 +50802,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73944)) + return _sqlite3CorruptError(tls, int32(74014)) } if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) @@ -50620,7 +50811,7 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } } else { if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { - return _sqlite3CorruptError(tls, int32(73953)) + return _sqlite3CorruptError(tls, int32(74023)) } if _sqlite3Get4byte(tls, pCell) == iFrom { _sqlite3Put4byte(tls, pCell, iTo) @@ -50629,11 +50820,12 @@ func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eT } goto _2 _2: + ; i++ } if i == nCell { if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { - return _sqlite3CorruptError(tls, int32(73965)) + return _sqlite3CorruptError(tls, int32(74035)) } _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) } @@ -50666,7 +50858,7 @@ func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrP _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iDbPage < uint32(3) { - return _sqlite3CorruptError(tls, int32(74000)) + return _sqlite3CorruptError(tls, int32(74070)) } /* Move page iDbPage from its current location to page number iFreePage */ *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) @@ -50764,7 +50956,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom return rc } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { - return _sqlite3CorruptError(tls, int32(74098)) + return _sqlite3CorruptError(tls, int32(74168)) } if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { if bCommit == 0 { @@ -50803,7 +50995,7 @@ func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCom _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) - return _sqlite3CorruptError(tls, int32(74150)) + return _sqlite3CorruptError(tls, int32(74220)) } } _ = libc.Int32FromInt32(0) @@ -50872,7 +51064,7 @@ func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) nFin = _finalDbSize(tls, pBt, nOrig, nFree) if nOrig < nFin || nFree >= nOrig { - rc = _sqlite3CorruptError(tls, int32(74218)) + rc = _sqlite3CorruptError(tls, int32(74288)) } else { if nFree > uint32(0) { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50918,7 +51110,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { ** is either a pointer-map page or the pending-byte page. If one ** is encountered, this indicates corruption. */ - return _sqlite3CorruptError(tls, int32(74269)) + return _sqlite3CorruptError(tls, int32(74339)) } nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) db = (*TBtree)(unsafe.Pointer(p)).Fdb @@ -50933,6 +51125,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; iDb++ } nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) @@ -50947,7 +51140,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { } nFin = _finalDbSize(tls, pBt, nOrig, nVac) if nFin > nOrig { - return _sqlite3CorruptError(tls, int32(74296)) + return _sqlite3CorruptError(tls, int32(74366)) } if nFin < nOrig { rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) @@ -50960,6 +51153,7 @@ func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) goto _2 _2: + ; iFree-- } if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { @@ -51205,6 +51399,7 @@ func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, w _btreeReleaseAllCursorPages(tls, p) goto _1 _1: + ; p = (*TBtCursor)(unsafe.Pointer(p)).FpNext } _sqlite3BtreeLeave(tls, pBtree) @@ -51443,7 +51638,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo _ = libc.Int32FromInt32(0) if iTable <= uint32(1) { if iTable < uint32(1) { - return _sqlite3CorruptError(tls, int32(74760)) + return _sqlite3CorruptError(tls, int32(74830)) } else { if _btreePagecount(tls, pBt) == uint32(0) { _ = libc.Int32FromInt32(0) @@ -51473,6 +51668,7 @@ func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo } goto _1 _1: + ; pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext } (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) @@ -51856,7 +52052,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(75165)) + return _sqlite3CorruptError(tls, int32(75235)) } _ = libc.Int32FromInt32(0) _getCellInfo(tls, pCur) @@ -51869,7 +52065,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] ** but is recast into its current form to avoid integer overflow problems */ - return _sqlite3CorruptError(tls, int32(75180)) + return _sqlite3CorruptError(tls, int32(75250)) } /* Check if data must be read/written to/from the btree page itself. */ if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { @@ -51922,7 +52118,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin for *(*TPgno)(unsafe.Pointer(bp)) != 0 { /* If required, populate the overflow page-list cache. */ if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(75242)) + return _sqlite3CorruptError(tls, int32(75312)) } _ = libc.Int32FromInt32(0) *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) @@ -51999,7 +52195,7 @@ func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uin } if rc == SQLITE_OK && amt > uint32(0) { /* Overflow chain ends prematurely */ - return _sqlite3CorruptError(tls, int32(75326)) + return _sqlite3CorruptError(tls, int32(75396)) } return rc } @@ -52152,7 +52348,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(75464)) + return _sqlite3CorruptError(tls, int32(75534)) } (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p1 = pCur + 1 @@ -52165,7 +52361,7 @@ func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(75478)) + rc = _sqlite3CorruptError(tls, int32(75548)) } if rc != 0 { v3 = pCur + 84 @@ -52295,9 +52491,10 @@ func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { ** (or the freelist). */ _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { - return _sqlite3CorruptError(tls, int32(75613)) + return _sqlite3CorruptError(tls, int32(75683)) } skip_init: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) p4 = pCur + 1 @@ -52307,7 +52504,7 @@ skip_init: } else { if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { - return _sqlite3CorruptError(tls, int32(75625)) + return _sqlite3CorruptError(tls, int32(75695)) } subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) @@ -52571,7 +52768,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh break } if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(75867)) + return _sqlite3CorruptError(tls, int32(75937)) } } } @@ -52620,6 +52817,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh goto moveto_table_finish } moveto_table_next_layer: + ; if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) } else { @@ -52634,6 +52832,7 @@ func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRigh _1: } moveto_table_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -52710,6 +52909,7 @@ func _cursorOnLastPage(tls *libc.TLS, pCur uintptr) (r int32) { } goto _1 _1: + ; i++ } return int32(1) @@ -52782,7 +52982,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes p3 = pCur + 1 *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76063)) + return _sqlite3CorruptError(tls, int32(76133)) } goto bypass_moveto_root /* Start search on the current page */ } @@ -52798,6 +52998,7 @@ func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes return rc } bypass_moveto_root: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -52852,7 +53053,7 @@ bypass_moveto_root: /* Invalid key size: 0x80 0x80 0x01 */ /* Minimum legal index key size */ if nCell < int32(2) || uint32(nCell)/(*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize > (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { - rc = _sqlite3CorruptError(tls, int32(76150)) + rc = _sqlite3CorruptError(tls, int32(76220)) goto moveto_index_finish } pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) @@ -52885,7 +53086,7 @@ bypass_moveto_root: rc = SQLITE_OK (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { - rc = _sqlite3CorruptError(tls, int32(76182)) + rc = _sqlite3CorruptError(tls, int32(76252)) } goto moveto_index_finish } @@ -52922,7 +53123,7 @@ bypass_moveto_root: p9 = pCur + 1 *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { - return _sqlite3CorruptError(tls, int32(76213)) + return _sqlite3CorruptError(tls, int32(76283)) } *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage @@ -52931,7 +53132,7 @@ bypass_moveto_root: rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) - rc = _sqlite3CorruptError(tls, int32(76224)) + rc = _sqlite3CorruptError(tls, int32(76294)) } if rc != 0 { v11 = pCur + 84 @@ -52946,6 +53147,7 @@ bypass_moveto_root: _4: } moveto_index_finish: + ; (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) _ = libc.Int32FromInt32(0) return rc @@ -52999,6 +53201,7 @@ func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) goto _1 _1: + ; i++ } return n @@ -53062,7 +53265,7 @@ func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76325)) + return _sqlite3CorruptError(tls, int32(76395)) } if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { @@ -53177,7 +53380,7 @@ func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) } if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { - return _sqlite3CorruptError(tls, int32(76418)) + return _sqlite3CorruptError(tls, int32(76488)) } if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) @@ -53271,7 +53474,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt ** stores the total number of pages on the freelist. */ n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) if n >= mxPage { - return _sqlite3CorruptError(tls, int32(76508)) + return _sqlite3CorruptError(tls, int32(76578)) } if n > uint32(0) { searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ @@ -53328,7 +53531,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt nSearch++ } if v2 || v1 > n { - rc = _sqlite3CorruptError(tls, int32(76564)) + rc = _sqlite3CorruptError(tls, int32(76634)) } else { rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) } @@ -53357,7 +53560,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { /* Value of k is out of range. Database corruption */ - rc = _sqlite3CorruptError(tls, int32(76593)) + rc = _sqlite3CorruptError(tls, int32(76663)) goto end_allocate_page } else { if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53384,7 +53587,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } else { iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) if iNewTrunk > mxPage { - rc = _sqlite3CorruptError(tls, int32(76627)) + rc = _sqlite3CorruptError(tls, int32(76697)) goto end_allocate_page } rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) @@ -53430,6 +53633,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _3 _3: + ; i++ } } else { @@ -53446,6 +53650,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } goto _4 _4: + ; i++ } } @@ -53454,7 +53659,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) if iPage > mxPage || iPage < uint32(2) { - rc = _sqlite3CorruptError(tls, int32(76692)) + rc = _sqlite3CorruptError(tls, int32(76762)) goto end_allocate_page } if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { @@ -53558,6 +53763,7 @@ func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintpt } _ = libc.Int32FromInt32(0) end_allocate_page: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) _releasePage(tls, pPrevTrunk) _ = libc.Int32FromInt32(0) @@ -53598,7 +53804,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { - return _sqlite3CorruptError(tls, int32(76819)) + return _sqlite3CorruptError(tls, int32(76889)) } if pMemPage != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage @@ -53649,7 +53855,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) if iTrunk > _btreePagecount(tls, pBt) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76866)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) goto freepage_out } *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) @@ -53659,7 +53865,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) _ = libc.Int32FromInt32(0) if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { - *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76877)) + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) goto freepage_out } if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { @@ -53715,6 +53921,7 @@ func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r in _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) freepage_out: + ; if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) } @@ -53749,7 +53956,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp _ = libc.Int32FromInt32(0) if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { /* Cell extends past end of page */ - return _sqlite3CorruptError(tls, int32(76966)) + return _sqlite3CorruptError(tls, int32(77036)) } ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt @@ -53769,7 +53976,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp /* 0 is not a legal page number and page 1 cannot be an ** overflow page. Therefore if ovflPgno<2 or past the end of the ** file the database must be corrupt. */ - return _sqlite3CorruptError(tls, int32(76983)) + return _sqlite3CorruptError(tls, int32(77053)) } if nOvfl != 0 { rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) @@ -53792,7 +53999,7 @@ func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintp ** caller is iterating through or using in some other way, this ** can be problematic. */ - rc = _sqlite3CorruptError(tls, int32(77003)) + rc = _sqlite3CorruptError(tls, int32(77073)) } else { rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) } @@ -53880,6 +54087,7 @@ func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize n = nHeader + nPayload if n < int32(4) { n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) } *(*int32)(unsafe.Pointer(pnSize)) = n _ = libc.Int32FromInt32(0) @@ -54027,7 +54235,7 @@ func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { - *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77256)) + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) return } rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) @@ -54451,6 +54659,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg } goto _1 _1: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -54461,12 +54670,12 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg _ = libc.Int32FromInt32(0) if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { if uint64(pCell+uintptr(sz)) > uint64(pEnd) { - return _sqlite3CorruptError(tls, int32(77645)) + return _sqlite3CorruptError(tls, int32(77718)) } pCell = pTmp + uintptr(int64(pCell)-int64(aData)) } else { if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { - return _sqlite3CorruptError(tls, int32(77650)) + return _sqlite3CorruptError(tls, int32(77723)) } } pData -= uintptr(sz) @@ -54474,7 +54683,7 @@ func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) pCellptr += uintptr(2) if pData < pCellptr { - return _sqlite3CorruptError(tls, int32(77656)) + return _sqlite3CorruptError(tls, int32(77729)) } libc.Xmemmove(tls, pData, pCell, uint64(sz)) _ = libc.Int32FromInt32(0) @@ -54549,6 +54758,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr } goto _1 _1: + ; k++ } pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) @@ -54572,7 +54782,7 @@ func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr _ = libc.Int32FromInt32(0) if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { _ = libc.Int32FromInt32(0) - _sqlite3CorruptError(tls, int32(77741)) + _sqlite3CorruptError(tls, int32(77814)) return int32(1) } libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) @@ -54644,6 +54854,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _2 _2: + ; j++ } if j >= nFree { @@ -54656,6 +54867,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _3 _3: + ; j++ } nFree = 0 @@ -54671,6 +54883,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr } goto _1 _1: + ; i++ } j = 0 @@ -54681,6 +54894,7 @@ func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArr _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) goto _4 _4: + ; j++ } return nRet @@ -54718,7 +54932,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p if iOld < iNew { nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) if nShift > nCell { - return _sqlite3CorruptError(tls, int32(77863)) + return _sqlite3CorruptError(tls, int32(77936)) } libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2))) nCell -= nShift @@ -54772,6 +54986,7 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p } goto _2 _2: + ; i++ } /* Append cells to the end of the page */ @@ -54788,9 +55003,10 @@ func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, p *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) return SQLITE_OK editpage_fail: + ; /* Unable to edit this page. Rebuild it from scratch instead. */ if nNew < int32(1) { - return _sqlite3CorruptError(tls, int32(77937)) + return _sqlite3CorruptError(tls, int32(78010)) } _populateCellCache(tls, pCArray, iNew, nNew) return _rebuildPage(tls, pCArray, iNew, nNew, pPg) @@ -54838,7 +55054,7 @@ func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintpt _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { - return _sqlite3CorruptError(tls, int32(77977)) + return _sqlite3CorruptError(tls, int32(78050)) } /* dbfuzz001.test */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -55214,7 +55430,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa ** table-interior, index-leaf, or index-interior). */ if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78398)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) goto balance_cleanup } /* Load b.apCell[] with pointers to all cells in pOld. If pOld @@ -55237,7 +55453,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78422)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) goto balance_cleanup } limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) @@ -55251,6 +55467,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _3 _3: + ; j++ } k = 0 @@ -55263,6 +55480,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ goto _4 _4: + ; k++ } } @@ -55310,6 +55528,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _2 _2: + ; i++ } /* @@ -55357,11 +55576,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) goto _8 _8: + ; j++ } cntNew[i] = cntOld[i] goto _6 _6: + ; i++ k++ } @@ -55375,7 +55596,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa if i+int32(1) >= k { k = i + int32(2) if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78523)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) goto balance_cleanup } (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 @@ -55418,12 +55639,13 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v10 = 0 } if cntNew[i] <= v10 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78556)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) goto balance_cleanup } } goto _9 _9: + ; i++ } /* @@ -55478,11 +55700,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa v15 = 0 } if cntNew[i-int32(1)] <= v15 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78600)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) goto balance_cleanup } goto _11 _11: + ; i-- } /* Sanity check: For a non-corrupt database file one of the following @@ -55510,7 +55733,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) nNew++ if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78633)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) } if *(*int32)(unsafe.Pointer(bp)) != 0 { goto balance_cleanup @@ -55540,6 +55763,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _16 _16: + ; i++ } /* @@ -55564,6 +55788,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _19 _19: + ; i++ } i = 0 @@ -55582,6 +55807,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _21 _21: + ; j++ } /* If apNew[i] has a page number that is bigger than any of the @@ -55603,6 +55829,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _20 _20: + ; i++ } _ = libc.Int32FromInt32(0) @@ -55689,6 +55916,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _24 _24: + ; i++ } } @@ -55743,11 +55971,12 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _28 _28: + ; k++ } pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78833)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) goto balance_cleanup } *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) @@ -55757,6 +55986,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ = libc.Int32FromInt32(0) goto _27 _27: + ; i++ } /* Now update the actual sibling pages. The order in which they are updated @@ -55831,6 +56061,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa } goto _29 _29: + ; i++ } /* All pages have been processed exactly once */ @@ -55872,6 +56103,7 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) goto _33 _33: + ; i++ } } @@ -55887,12 +56119,14 @@ func _balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpa _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) goto _34 _34: + ; i++ } /* ** Cleanup before returning. */ balance_cleanup: + ; _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) i = 0 for { @@ -55902,6 +56136,7 @@ balance_cleanup: _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) goto _35 _35: + ; i++ } i = 0 @@ -55912,6 +56147,7 @@ balance_cleanup: _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) goto _36 _36: + ; i++ } return *(*int32)(unsafe.Pointer(bp)) @@ -56004,10 +56240,11 @@ func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { break } if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { - return _sqlite3CorruptError(tls, int32(79065)) + return _sqlite3CorruptError(tls, int32(79138)) } goto _1 _1: + ; pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext } return SQLITE_OK @@ -56078,7 +56315,7 @@ func _balance(tls *libc.TLS, pCur uintptr) (r int32) { /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = _sqlite3CorruptError(tls, int32(79125)) + rc = _sqlite3CorruptError(tls, int32(79198)) } else { pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) @@ -56169,6 +56406,7 @@ func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uint } goto _1 _1: + ; i++ } if i < iAmt { @@ -56240,7 +56478,7 @@ func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int return rc } if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { - rc = _sqlite3CorruptError(tls, int32(79289)) + rc = _sqlite3CorruptError(tls, int32(79362)) } else { if uint32(iOffset)+ovflPageSize < uint32(nTotal) { ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) @@ -56271,7 +56509,7 @@ func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { - return _sqlite3CorruptError(tls, int32(79317)) + return _sqlite3CorruptError(tls, int32(79390)) } if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { /* The entire cell is local */ @@ -56358,7 +56596,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return _sqlite3CorruptError(tls, int32(79398)) + return _sqlite3CorruptError(tls, int32(79471)) } } /* Ensure that the cursor is not in the CURSOR_FAULT state and that it @@ -56461,7 +56699,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { /* ^^^^^--- due to the moveToRoot() call above */ - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79521)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) } else { *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) } @@ -56478,6 +56716,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) } if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) @@ -56502,7 +56741,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { _ = libc.Int32FromInt32(0) if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79560)) + return _sqlite3CorruptError(tls, int32(79636)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -56532,10 +56771,10 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ _ = libc.Int32FromInt32(0) /* clearCell never fails when nLocal==nPayload */ if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { - return _sqlite3CorruptError(tls, int32(79587)) + return _sqlite3CorruptError(tls, int32(79663)) } if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79590)) + return _sqlite3CorruptError(tls, int32(79666)) } libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8)))) return SQLITE_OK @@ -56552,7 +56791,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s v2 = *(*Tu16)(unsafe.Pointer(v3)) idx = int32(v2) p4 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) } else { _ = libc.Int32FromInt32(0) } @@ -56583,7 +56822,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { _ = libc.Int32FromInt32(0) p5 = pCur + 1 - *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(BTCF_ValidNKey)) + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -56608,6 +56847,7 @@ func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, s } _ = libc.Int32FromInt32(0) end_insert: + ; return *(*int32)(unsafe.Pointer(bp)) return r } @@ -56658,7 +56898,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79692)) + return _sqlite3CorruptError(tls, int32(79768)) } nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { @@ -56680,7 +56920,7 @@ func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey T } if nRem > nIn { if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { - return _sqlite3CorruptError(tls, int32(79717)) + return _sqlite3CorruptError(tls, int32(79793)) } ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) } @@ -56789,7 +57029,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { return *(*int32)(unsafe.Pointer(bp)) } } else { - return _sqlite3CorruptError(tls, int32(79813)) + return _sqlite3CorruptError(tls, int32(79889)) } } _ = libc.Int32FromInt32(0) @@ -56797,14 +57037,14 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { - return _sqlite3CorruptError(tls, int32(79822)) + return _sqlite3CorruptError(tls, int32(79898)) } pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx)))))) if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { - return _sqlite3CorruptError(tls, int32(79826)) + return _sqlite3CorruptError(tls, int32(79902)) } if pCell < (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { - return _sqlite3CorruptError(tls, int32(79829)) + return _sqlite3CorruptError(tls, int32(79905)) } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must ** be preserved following this delete operation. If the current delete @@ -56899,7 +57139,7 @@ func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { } pCell = (*TMemPage)(unsafe.Pointer(pLeaf)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pLeaf)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1)))))))) if pCell < (*TMemPage)(unsafe.Pointer(pLeaf)).FaData+4 { - return _sqlite3CorruptError(tls, int32(79920)) + return _sqlite3CorruptError(tls, int32(79996)) } nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pLeaf)).FxCellSize})))(tls, pLeaf, pCell)) _ = libc.Int32FromInt32(0) @@ -57019,7 +57259,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags */ _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+8) if *(*TPgno)(unsafe.Pointer(bp + 8)) > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80036)) + return _sqlite3CorruptError(tls, int32(80112)) } *(*TPgno)(unsafe.Pointer(bp + 8))++ /* The new root-page may not be allocated on a pointer-map page, or the @@ -57061,7 +57301,7 @@ func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags } *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { - *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80084)) + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) } if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -57148,14 +57388,14 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int _, _, _, _ = hdr, i, pCell, v2 _ = libc.Int32FromInt32(0) if pgno > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80174)) + return _sqlite3CorruptError(tls, int32(80250)) } *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { return *(*int32)(unsafe.Pointer(bp + 8)) } if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { - *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80181)) + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) goto cleardatabasepage_out } hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) @@ -57182,6 +57422,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } goto _1 _1: + ; i++ } if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { @@ -57206,6 +57447,7 @@ func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int } } cleardatabasepage_out: + ; _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) return *(*int32)(unsafe.Pointer(bp + 8)) } @@ -57293,7 +57535,7 @@ func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iTable > _btreePagecount(tls, pBt) { - return _sqlite3CorruptError(tls, int32(80285)) + return _sqlite3CorruptError(tls, int32(80361)) } *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) if *(*int32)(unsafe.Pointer(bp)) != 0 { @@ -57569,7 +57811,7 @@ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4178, int32(1)) + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4203, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -57621,11 +57863,11 @@ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4180, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4205, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4203, libc.VaList(bp+8, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4228, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) @@ -57651,11 +57893,11 @@ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParen if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4333, libc.VaList(bp+16, iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4358, libc.VaList(bp+16, iPage)) N-- } else { i = 0 @@ -57707,6 +57949,7 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N _checkRef(tls, pCheck, iFreePage) goto _1 _1: + ; i++ } N -= n @@ -57726,11 +57969,11 @@ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { - v2 = __ccgo_ts + 4372 + v2 = __ccgo_ts + 4397 } else { - v2 = __ccgo_ts + 4377 + v2 = __ccgo_ts + 4402 } - _checkAppendMsg(tls, pCheck, __ccgo_ts+4398, libc.VaList(bp+16, v2, expected-N, expected)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4423, libc.VaList(bp+16, v2, expected-N, expected)) } } @@ -57867,12 +58110,12 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr if _checkRef(tls, pCheck, iPage) != 0 { return 0 } - (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4424 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4449 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4442, libc.VaList(bp+56, rc)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4467, libc.VaList(bp+56, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< usableSize-uint32(4) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4596, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4621, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4626, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4651, 0) doCoverageCheck = 0 goto _4 } @@ -57958,7 +58201,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) } if v5 != 0 { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4650, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4675, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) } *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ @@ -57982,7 +58225,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) keyCanBeEqual = 0 if d2 != depth { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4674, 0) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, 0) depth = d2 } } else { @@ -57991,6 +58234,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr } goto _4 _4: + ; i-- } *(*Ti64)(unsafe.Pointer(piMinKey)) = *(*Ti64)(unsafe.Pointer(bp)) @@ -58014,6 +58258,7 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr _btreeHeapInsert(tls, heap, pc<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4699, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4724, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) break } else { nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) @@ -58071,10 +58316,11 @@ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr ** number of fragmented free bytes within the cell content area. */ if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { - _checkAppendMsg(tls, pCheck, __ccgo_ts+4736, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + _checkAppendMsg(tls, pCheck, __ccgo_ts+4761, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) } } end_of_check: + ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit } @@ -58164,7 +58410,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin /* Check the integrity of the freelist */ if bCkFreelist != 0 { - (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4788 + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4813 _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) } @@ -58183,15 +58429,16 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin } goto _1 _1: + ; i++ } mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) if mx != mxInHdr { - _checkAppendMsg(tls, bp, __ccgo_ts+4799, libc.VaList(bp+240, mx, mxInHdr)) + _checkAppendMsg(tls, bp, __ccgo_ts+4824, libc.VaList(bp+240, mx, mxInHdr)) } } else { if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { - _checkAppendMsg(tls, bp, __ccgo_ts+4844, 0) + _checkAppendMsg(tls, bp, __ccgo_ts+4869, 0) } } } @@ -58211,6 +58458,7 @@ func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uin _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84227)) + return _sqlite3CorruptError(tls, int32(84303)) } iField = *(*int32)(unsafe.Pointer(bp + 4)) i = 0 @@ -61368,16 +61632,17 @@ func _sqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iC } iHdr += int32(uint8(v3)) if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { - return _sqlite3CorruptError(tls, int32(84233)) + return _sqlite3CorruptError(tls, int32(84309)) } szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) iField += szField goto _2 _2: + ; i++ } if iField > nRec { - return _sqlite3CorruptError(tls, int32(84239)) + return _sqlite3CorruptError(tls, int32(84315)) } if pMem == uintptr(0) { v4 = _sqlite3ValueNew(tls, db) @@ -61415,6 +61680,7 @@ func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) goto _1 _1: + ; i++ } _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) @@ -61818,10 +62084,12 @@ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr } goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) skip_op_resultrow: + ; _ = ap } @@ -61979,6 +62247,7 @@ func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere ui _sqlite3VdbeUsesBtree(tls, p, j) goto _1 _1: + ; j++ } _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) @@ -62105,6 +62374,7 @@ func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62207,6 +62477,7 @@ func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { pOp -= 24 } resolve_p2_values_loop_exit: + ; if aLabel != 0 { _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) @@ -62315,6 +62586,7 @@ func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLi _ = iLineno goto _2 _2: + ; i++ aOp += 4 pOut += 24 @@ -62744,7 +63016,7 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { case -int32(8): pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5056, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5081, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) j = 0 for { if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { @@ -62757,39 +63029,40 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { v2 = __ccgo_ts + 1648 } zColl = v2 - if libc.Xstrcmp(tls, zColl, __ccgo_ts+5061) == 0 { - zColl = __ccgo_ts + 5068 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5086) == 0 { + zColl = __ccgo_ts + 5093 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { - v3 = __ccgo_ts + 5049 + v3 = __ccgo_ts + 5074 } else { v3 = __ccgo_ts + 1648 } if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { - v4 = __ccgo_ts + 5070 + v4 = __ccgo_ts + 5095 } else { v4 = __ccgo_ts + 1648 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5073, libc.VaList(bp+40, v3, v4, zColl)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5098, libc.VaList(bp+40, v3, v4, zColl)) goto _1 _1: + ; j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) case -int32(2): pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5097, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5122, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) case -int32(7): pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) case -int32(15): pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5106, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) case -int32(13): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1404, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(3): - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5113, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5138, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) case -int32(12): Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1371, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) case -int32(10): @@ -62807,14 +63080,14 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { zP4 = __ccgo_ts + 1649 } else { _ = libc.Int32FromInt32(0) - zP4 = __ccgo_ts + 5116 + zP4 = __ccgo_ts + 5141 } } } } case -int32(11): pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5123, libc.VaList(bp+40, pVtab)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5148, libc.VaList(bp+40, pVtab)) case -int32(14): ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the @@ -62829,14 +63102,15 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } else { v6 = int32(',') } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5131, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5156, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) goto _5 _5: + ; i++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5136, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5161, int32(1)) case -int32(4): - zP4 = __ccgo_ts + 5138 + zP4 = __ccgo_ts + 5163 case -int32(5): zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName default: @@ -62852,10 +63126,10 @@ func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { } var _encnames = [4]uintptr{ - 0: __ccgo_ts + 5083, - 1: __ccgo_ts + 5085, - 2: __ccgo_ts + 5087, - 3: __ccgo_ts + 5092, + 0: __ccgo_ts + 5108, + 1: __ccgo_ts + 5110, + 2: __ccgo_ts + 5112, + 3: __ccgo_ts + 5117, } // C documentation @@ -62920,6 +63194,7 @@ func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62946,6 +63221,7 @@ func _vdbeLeave(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -62985,6 +63261,7 @@ func _initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags Tu16) { p += 56 goto _2 _2: + ; N-- v1 = N if !(v1 > 0) { @@ -63017,6 +63294,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _2 _2: + ; p += 56 v1 = p if !(v1 < pEnd) { @@ -63052,6 +63330,7 @@ func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { } goto _4 _4: + ; p += 56 v3 = p if !(v3 < pEnd) { @@ -63119,6 +63398,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp goto _1 _1: + ; i++ } } @@ -63149,6 +63429,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp @@ -63170,6 +63451,7 @@ func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, } goto _4 _4: + ; j1++ } if j1 == nSub { @@ -63227,6 +63509,7 @@ func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) @@ -63581,6 +63864,7 @@ func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -63633,6 +63917,7 @@ func _closeAllCursors(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent } _sqlite3VdbeFrameRestore(tls, pFrame) @@ -63768,6 +64053,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -63801,6 +64087,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } /* Do the commit only if all databases successfully complete phase 1. @@ -63819,6 +64106,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ } if rc == SQLITE_OK { @@ -63833,7 +64121,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { retryCount = 0 /* Select a super-journal file name */ nMainFile = _sqlite3Strlen30(tls, zMainFile) - zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5146, libc.VaList(bp+24, 0, zMainFile, 0)) + zSuper = _sqlite3MPrintf(tls, db, __ccgo_ts+5171, libc.VaList(bp+24, 0, zMainFile, 0)) if zSuper == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -63841,18 +64129,18 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { for cond := true; cond; cond = rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 8)) != 0 { if retryCount != 0 { if retryCount > int32(100) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5158, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5183, libc.VaList(bp+24, zSuper)) _sqlite3OsDelete(tls, pVfs, zSuper, 0) break } else { if retryCount == int32(1) { - Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5172, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5197, libc.VaList(bp+24, zSuper)) } } } retryCount++ Xsqlite3_randomness(tls, int32(4), bp+12) - Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5187, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5212, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) /* The antipenultimate character of the super-journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ _ = libc.Int32FromInt32(0) @@ -63895,6 +64183,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device @@ -63931,6 +64220,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _7 _7: + ; i++ } _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -63968,6 +64258,7 @@ func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _8 _8: + ; i++ } _sqlite3EndBenignMalloc(tls) @@ -64037,6 +64328,7 @@ func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- @@ -64085,7 +64377,7 @@ func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)< uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89038))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) return 0 /* Corruption */ } /* Only needed by assert() statements */ @@ -65433,7 +65747,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr rc = -int32(1) } else { if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + _serialGet7(tls, aKey1+uintptr(d1), bp+8) rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) } else { lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) @@ -65466,16 +65780,22 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { rc = -int32(1) } else { - _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { - if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { - rc = -int32(1) + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ } else { - if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { - rc = +libc.Int32FromInt32(1) + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + _ = libc.Int32FromInt32(0) + } } } } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) } } @@ -65498,7 +65818,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr pKeyInfo = v4 } if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89115))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) return 0 /* Corruption */ } else { if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { @@ -65534,7 +65854,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } else { nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) if d1+uint32(nStr) > uint32(nKey1) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89145))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) return 0 /* Corruption */ } else { if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { @@ -65559,7 +65879,11 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } } else { *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) - rc = libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(0) && *(*Tu32)(unsafe.Pointer(bp + 68)) != uint32(10)) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + _ = libc.Int32FromInt32(0) + } else { + rc = int32(1) + } } } } @@ -65586,7 +65910,7 @@ func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr } idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89189))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) return 0 /* Corrupt index */ } } @@ -65630,18 +65954,18 @@ func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uin serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) _ = libc.Int32FromInt32(0) switch serial_type { - case int32(1): + case int32(1): /* 1-byte signed integer */ lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) - case int32(2): + case int32(2): /* 2-byte signed integer */ lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) - case int32(3): + case int32(3): /* 3-byte signed integer */ lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< nKey1 { - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89352))) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) return 0 /* Corruption */ } if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { @@ -65879,8 +66204,9 @@ func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr /* Jump here if database corruption is detected after m has been ** allocated. Free the m object and return SQLITE_CORRUPT. */ idx_rowid_corruption: + ; _sqlite3VdbeMemReleaseMalloc(tls, bp+8) - return _sqlite3CorruptError(tls, int32(89510)) + return _sqlite3CorruptError(tls, int32(89614)) } // C documentation @@ -65913,7 +66239,7 @@ func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { *(*int32)(unsafe.Pointer(res)) = 0 - return _sqlite3CorruptError(tls, int32(89543)) + return _sqlite3CorruptError(tls, int32(89647)) } _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) @@ -65978,6 +66304,7 @@ func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) goto _1 _1: + ; p = (*TVdbe)(unsafe.Pointer(p)).FpVNext } } @@ -66068,15 +66395,15 @@ func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { - zContext = __ccgo_ts + 5230 + zContext = __ccgo_ts + 5255 } else { if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { - zContext = __ccgo_ts + 5249 + zContext = __ccgo_ts + 5274 } else { - zContext = __ccgo_ts + 5268 + zContext = __ccgo_ts + 5293 } } - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5277, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5302, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) return 0 @@ -66130,6 +66457,7 @@ func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, p) @@ -66198,6 +66526,7 @@ func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) goto _2 _2: + ; i++ } _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) @@ -66253,7 +66582,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { // */ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5313, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5338, 0) return int32(1) } else { return 0 @@ -66263,7 +66592,7 @@ func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { if p == uintptr(0) { - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5358, 0) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5383, 0) return int32(1) } else { return _vdbeSafety(tls, p) @@ -66325,7 +66654,7 @@ func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt db = (*TVdbe)(unsafe.Pointer(v)).Fdb if _vdbeSafety(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(89931)) + return _sqlite3MisuseError(tls, int32(90035)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { @@ -66394,6 +66723,7 @@ func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -66855,7 +67185,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { _ = libc.Int32FromInt32(0) (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) - _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5398, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5423, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation @@ -66913,6 +67243,7 @@ func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { } goto _1 _1: + ; i++ } return rc @@ -66937,6 +67268,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { db = (*TVdbe)(unsafe.Pointer(p)).Fdb if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { restart_step: + ; if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) @@ -67039,6 +67371,7 @@ func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { } } end_of_step: + ; /* There are only a limited number of result codes allowed from the ** statements prepared using the legacy sqlite3_prepare() interface */ _ = libc.Int32FromInt32(0) @@ -67061,7 +67394,7 @@ func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { v = pStmt /* the prepared statement */ cnt = 0 /* The database connection */ if _vdbeSafetyNotNull(tls, v) != 0 { - return _sqlite3MisuseError(tls, int32(90725)) + return _sqlite3MisuseError(tls, int32(90829)) } db = (*TVdbe)(unsafe.Pointer(v)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -67195,7 +67528,7 @@ func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32 _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) if pVal == uintptr(0) { - return _sqlite3MisuseError(tls, int32(90846)) + return _sqlite3MisuseError(tls, int32(90950)) } if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { return int32(SQLITE_ERROR) @@ -67366,6 +67699,7 @@ func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } return uintptr(0) @@ -67402,6 +67736,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, } goto _1 _1: + ; pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux } if pAuxData == uintptr(0) { @@ -67425,6 +67760,7 @@ func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete return failed: + ; if xDelete != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) } @@ -67664,18 +68000,18 @@ func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ - 0: __ccgo_ts + 5421, - 1: __ccgo_ts + 5426, - 2: __ccgo_ts + 5433, - 3: __ccgo_ts + 5436, - 4: __ccgo_ts + 5439, - 5: __ccgo_ts + 5442, - 6: __ccgo_ts + 5445, - 7: __ccgo_ts + 5448, - 8: __ccgo_ts + 5456, - 9: __ccgo_ts + 5459, - 10: __ccgo_ts + 5466, - 11: __ccgo_ts + 5474, + 0: __ccgo_ts + 5446, + 1: __ccgo_ts + 5451, + 2: __ccgo_ts + 5458, + 3: __ccgo_ts + 5461, + 4: __ccgo_ts + 5464, + 5: __ccgo_ts + 5467, + 6: __ccgo_ts + 5470, + 7: __ccgo_ts + 5473, + 8: __ccgo_ts + 5481, + 9: __ccgo_ts + 5484, + 10: __ccgo_ts + 5491, + 11: __ccgo_ts + 5499, } var _azExplainColNames16data = [60]Tu16{ 0: uint16('a'), @@ -67812,6 +68148,7 @@ func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType } } columnName_end: + ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return ret } @@ -67919,14 +68256,14 @@ func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { var v2 bool _, _, _ = pVar, v1, v2 if _vdbeSafetyNotNull(tls, p) != 0 { - return _sqlite3MisuseError(tls, int32(91450)) + return _sqlite3MisuseError(tls, int32(91554)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { - _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91454))) + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) - Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5481, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) - return _sqlite3MisuseError(tls, int32(91458)) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5506, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) } if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) @@ -68221,6 +68558,7 @@ func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) goto _1 _1: + ; i++ } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) @@ -68499,7 +68837,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { - rc = _sqlite3MisuseError(tls, int32(91994)) + rc = _sqlite3MisuseError(tls, int32(92098)) goto preupdate_old_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { @@ -68547,6 +68885,7 @@ func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } } preupdate_old_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68628,7 +68967,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp rc = SQLITE_OK p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { - rc = _sqlite3MisuseError(tls, int32(92117)) + rc = _sqlite3MisuseError(tls, int32(92221)) goto preupdate_new_out } if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { @@ -68697,6 +69036,7 @@ func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintp } *(*uintptr)(unsafe.Pointer(ppValue)) = pMem preupdate_new_out: + ; _sqlite3Error(tls, db, rc) return _sqlite3ApiExit(tls, db, rc) } @@ -68803,7 +69143,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr break } } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5521, int32(3)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5546, int32(3)) _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) } @@ -68848,7 +69188,7 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1404, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5042, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5067, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc @@ -68863,28 +69203,29 @@ func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr pVar = bp + 40 } nOut = (*TMem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5525, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5550, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != int32(SQLITE_UTF8) { _sqlite3VdbeMemRelease(tls, bp+40) } } else { if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5532, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5557, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) } else { /* Number of bytes of the blob to include in output */ _ = libc.Int32FromInt32(0) - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5545, int32(2)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5570, int32(2)) nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn i = 0 for { if !(i < nOut1) { break } - Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5548, libc.VaList(bp+104, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5573, libc.VaList(bp+104, int32(*(*uint8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) goto _3 _3: + ; i++ } - Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5553, int32(1)) + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5578, int32(1)) } } } @@ -69400,6 +69741,7 @@ func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { } goto _1 _1: + ; i++ } return h @@ -69510,19 +69852,19 @@ var _azTypes = [5]uintptr{ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(976) defer tls.Free(976) - var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v238, v239, v240, v248, v249, v250, v251, v253, v261, v276, v277, v284, v286, v295, v296, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 uintptr + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr var affinity uint8 - var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v221, v222, v242, v243, v246, v247, v254, v258, v263, v264, v267, v268, v270, v271, v272, v273, v282, v285, v289 int32 - var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v211, v212, v214, v219, v220 Tu32 - var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v223 Tu8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 - var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v252, v260 Ti64 - var newMax, v209 uint32 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 var rA, rB float64 var xAuth Tsqlite3_xauth - var v204, v269, v279 int64 - var v213, v265, v280, v297 bool + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool var _ /* aRes at bp+712 */ [3]int32 var _ /* iA at bp+8 */ Ti64 var _ /* iB at bp+0 */ Ti64 @@ -69569,7 +69911,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { var _ /* z at bp+688 */ uintptr var _ /* zErr at bp+632 */ uintptr var _ /* zErr at bp+792 */ uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v209, v211, v212, v213, v214, v219, v220, v221, v222, v223, v238, v239, v240, v242, v243, v246, v247, v248, v249, v250, v251, v252, v253, v254, v258, v260, v261, v263, v264, v265, v267, v268, v269, v270, v271, v272, v273, v276, v277, v279, v280, v282, v284, v285, v286, v289, v295, v296, v297, p189, p192, p193, p196, p199, p210, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p291, p292, p293, p294 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ pOp = aOp /* Current operation */ rc = SQLITE_OK /* Value to return */ @@ -70045,8 +70387,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** that this Goto is the bottom of a loop and that the lines from P2 down ** to the current line should be indented for EXPLAIN output. */ - _2: /* jump */ + _2: + ; /* jump */ jump_to_p2_and_check_for_interrupt: + ; pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon @@ -70059,6 +70403,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** checks on every opcode. This helps sqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: + ; if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { goto abort_due_to_interrupt } @@ -70083,7 +70428,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Write the current address onto register P1 ** and then jump to address P2. */ - _3: /* jump */ + _3: + ; /* jump */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) @@ -70112,7 +70458,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value is a byte-code indentation hint. See tag-20220407a in ** wherecode.c and shell.c. */ - _4: /* in1 */ + _4: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { @@ -70134,7 +70481,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: EndCoroutine */ - _5: /* jump */ + _5: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70148,6 +70496,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: + ; _ = libc.Int32FromInt32(0) /* There are never any jumps to instruction 0 */ _ = libc.Int32FromInt32(0) /* Jumps must be in range */ pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 @@ -70161,6 +70510,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _6: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70184,6 +70534,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: InitCoroutine */ _7: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) (*TMem)(unsafe.Pointer(pIn1)).Fflags = uint16(MEM_Int) @@ -70199,7 +70550,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** value in register P3 is not NULL, then this routine is a no-op. ** The P5 parameter should be 1. */ - _8: /* in3 */ + _8: + ; /* in3 */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&int32(MEM_Null) == 0 { goto _187 @@ -70235,6 +70587,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is the same as executing Halt. */ _9: + ; /* A deliberately coded "OP_Halt SQLITE_INTERNAL * * * *" opcode indicates ** something is wrong with the code generator. Raise an assertion in order ** to bring this to the attention of fuzzers and other testing tools. */ @@ -70264,15 +70617,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { - _sqlite3VdbeError(tls, p, __ccgo_ts+5589, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) + _sqlite3VdbeError(tls, p, __ccgo_ts+5614, libc.VaList(bp+944, _azType[int32((*TOp)(unsafe.Pointer(pOp)).Fp5)-int32(1)])) if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5610, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+5635, libc.VaList(bp+944, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } } else { _sqlite3VdbeError(tls, p, __ccgo_ts+3795, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(pOp + 16)))) } pcx = int32((int64(pOp) - int64(aOp)) / 24) - Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5617, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*TOp)(unsafe.Pointer(pOp)).Fp1, __ccgo_ts+5642, libc.VaList(bp+944, pcx, (*TVdbe)(unsafe.Pointer(p)).FzSql, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg)) } rc = _sqlite3VdbeHalt(tls, p) _ = libc.Int32FromInt32(0) @@ -70294,7 +70647,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** The 32-bit integer value P1 is written into register P2. */ - _10: /* out2 */ + _10: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) *(*Ti64)(unsafe.Pointer(pOut)) = int64((*TOp)(unsafe.Pointer(pOp)).Fp1) goto _187 @@ -70304,7 +70658,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit integer value. ** Write that value into register P2. */ - _11: /* out2 */ + _11: + ; /* out2 */ pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))) @@ -70315,7 +70670,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P4 is a pointer to a 64-bit floating point value. ** Write that value into register P2. */ - _12: /* same as TK_FLOAT, out2 */ + _12: + ; /* same as TK_FLOAT, out2 */ pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Real) _ = libc.Int32FromInt32(0) @@ -70329,7 +70685,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this transformation, the length of string P4 is computed and stored ** as the P1 parameter. */ - _13: /* same as TK_STRING, out2 */ + _13: + ; /* same as TK_STRING, out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TOp)(unsafe.Pointer(pOp)).Fp1 = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16))) @@ -70371,7 +70728,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) */ - _14: /* out2 */ + _14: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) @@ -70414,7 +70772,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_Ne or OP_Eq. */ _16: + ; _15: + ; pOut = _out2Prerelease(tls, p, pOp) cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -70444,6 +70804,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** previously copied using OP_SCopy, the copies will continue to be valid. */ _17: + ; _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) @@ -70455,7 +70816,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** blob in register P2. If P4 is a NULL pointer, then construct ** a zero-filled blob that is P1 bytes long in P2. */ - _18: /* out2 */ + _18: + ; /* out2 */ _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { @@ -70476,7 +70838,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the parameter is named, then its name appears in P4. ** The P4 value is used by sqlite3_bind_parameter_name(). */ - _19: /* Value being transferred */ + _19: + ; /* Value being transferred */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 @@ -70502,7 +70865,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error ** for P3 to be less than 1. */ - _20: /* Register to copy to */ + _20: + ; /* Register to copy to */ n = (*TOp)(unsafe.Pointer(pOp)).Fp3 p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 @@ -70522,6 +70886,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pOut += 56 goto _195 _195: + ; n-- v194 = n if !(v194 != 0) { @@ -70543,6 +70908,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is made of any string or blob constant. See also OP_SCopy. */ _21: + ; n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -70578,7 +70944,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** during the lifetime of the copy. Use OP_Copy to make a complete ** copy. */ - _22: /* out2 */ + _22: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _ = libc.Int32FromInt32(0) @@ -70592,7 +70959,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is an optimized version of SCopy that works only for integer ** values. */ - _23: /* out2 */ + _23: + ; /* out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -70610,6 +70978,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** RETURNING clause. */ _24: + ; v198 = _sqlite3VdbeCheckFk(tls, p, 0) rc = v198 if v198 != SQLITE_OK { @@ -70626,6 +70995,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result row. */ _25: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -70653,7 +71023,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ - _26: /* Initial flags for P2 */ + _26: + ; /* Initial flags for P2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -70754,11 +71125,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the value in register P1 is zero the result is NULL. ** If either operand is NULL, the result is NULL. */ - _31: /* same as TK_PLUS, in1, in2, out3 */ - _30: /* same as TK_MINUS, in1, in2, out3 */ - _29: /* same as TK_STAR, in1, in2, out3 */ - _28: /* same as TK_SLASH, in1, in2, out3 */ - _27: /* Real value of right operand */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 @@ -70768,6 +71144,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto _200 } int_math: + ; iA = *(*Ti64)(unsafe.Pointer(pIn1)) *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70805,18 +71182,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) goto _201 _200: + ; if !((int32(type1)|int32(type2))&int32(MEM_Null) != 0) { goto _202 } goto arithmetic_result_is_null goto _203 _202: + ; type1 = _numericType(tls, pIn1) type2 = _numericType(tls, pIn2) if int32(type1)&int32(type2)&int32(MEM_Int) != 0 { goto int_math } fp_math: + ; rA = _sqlite3VdbeRealValue(tls, pIn1) rB = _sqlite3VdbeRealValue(tls, pIn2) switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { @@ -70850,9 +71230,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*float64)(unsafe.Pointer(pOut)) = rB (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Real)) _203: + ; _201: + ; goto _187 arithmetic_result_is_null: + ; _sqlite3VdbeMemSetNull(tls, pOut) goto _187 /* Opcode: CollSeq P1 * * P4 @@ -70871,6 +71254,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** publicly. Only built-in functions have access to this feature. */ _32: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, 0) @@ -70906,10 +71290,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Store the result in register P3. ** If either input is NULL, the result is NULL. */ - _36: /* same as TK_BITAND, in1, in2, out3 */ - _35: /* same as TK_BITOR, in1, in2, out3 */ - _34: /* same as TK_LSHIFT, in1, in2, out3 */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ _33: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -70973,7 +71361,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** To force any register to be an integer, just add 0. */ - _37: /* in1 */ + _37: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _sqlite3VdbeMemIntegerify(tls, pIn1) *(*Tu64)(unsafe.Pointer(pIn1)) += uint64((*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -70985,7 +71374,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ - _38: /* jump, in1 */ + _38: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { _applyAffinity(tls, pIn1, uint8(SQLITE_AFF_NUMERIC), encoding) @@ -71009,7 +71399,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ - _39: /* in1 */ + _39: + ; /* in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { _sqlite3VdbeMemRealify(tls, pIn1) @@ -71030,7 +71421,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** A NULL value is not changed by this routine. It remains NULL. */ - _40: /* in1 */ + _40: + ; /* in1 */ _ = libc.Int32FromInt32(0) pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { @@ -71139,12 +71531,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the content of register P3 is greater than or equal to the content of ** register P1. See the Lt opcode for additional information. */ - _46: /* same as TK_EQ, jump, in1, in3 */ - _45: /* same as TK_NE, jump, in1, in3 */ - _44: /* same as TK_LT, jump, in1, in3 */ - _43: /* same as TK_LE, jump, in1, in3 */ - _42: /* same as TK_GT, jump, in1, in3 */ - _41: /* Copy of initial value of pIn3->flags */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags @@ -71218,16 +71616,26 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { - if int32(flags11)&int32(MEM_Str) == 0 && int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) - flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) - if pIn1 == pIn3 { - flags3 = uint16(int32(flags11) | int32(MEM_Str)) + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } } } - if int32(flags3)&int32(MEM_Str) == 0 && int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { - _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) - flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } } } } @@ -71276,7 +71684,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the result of an OP_Eq comparison on the two previous operands ** would have been false or NULL, then fall through. */ - _47: /* same as TK_ESCAPE, jump */ + _47: + ; /* same as TK_ESCAPE, jump */ _ = libc.Int32FromInt32(0) if iCompare == 0 { goto jump_to_p2 @@ -71294,6 +71703,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** and does not become part of the permutation. */ _48: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71321,7 +71731,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must be immediately followed by an OP_Jump opcode. */ - _49: /* The permutation */ + _49: + ; /* The permutation */ if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { aPermute = uintptr(0) } else { @@ -71343,11 +71754,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } if aPermute != 0 { - v209 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) } else { - v209 = uint32(i) + v211 = uint32(i) } - idx = v209 + idx = v211 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71363,8 +71774,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } break } - goto _208 - _208: + goto _210 + _210: + ; i++ } _ = libc.Int32FromInt32(0) @@ -71377,7 +71789,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode must immediately follow an OP_Compare opcode. */ - _50: /* jump */ + _50: + ; /* jump */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if iCompare < 0 { @@ -71410,8 +71823,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** even if the other input is NULL. A NULL and false or two NULLs ** give a NULL output. */ - _52: /* same as TK_AND, in1, in2, out3 */ - _51: /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { @@ -71447,7 +71862,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { **
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE ** */ - _53: /* in1, out2 */ + _53: + ; /* in1, out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -71460,7 +71876,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** boolean complement in register P2. If the value in register P1 is ** NULL, then a NULL is stored in P2. */ - _54: /* same as TK_NOT, in1, out2 */ + _54: + ; /* same as TK_NOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { @@ -71476,7 +71893,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ones-complement of the P1 value into register P2. If P1 holds ** a NULL then store a NULL in P2. */ - _55: /* same as TK_BITNOT, in1, out2 */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _sqlite3VdbeMemSetNull(tls, pOut) @@ -71502,15 +71920,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** because the self-altering code trick does not work for recursive ** triggers. */ - _56: /* Address of this instruction */ + _56: + ; /* Address of this instruction */ _ = libc.Int32FromInt32(0) if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { goto jump_to_p2 } - p210 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) - *(*Tu8)(unsafe.Pointer(p210)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p210))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) } else { if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { goto jump_to_p2 @@ -71525,6 +71944,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _57: + ; c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) if c != 0 { goto jump_to_p2 @@ -71537,6 +71957,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** in P1 is NULL then take the jump if and only if P3 is non-zero. */ _58: + ; c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) if c1 != 0 { goto jump_to_p2 @@ -71547,7 +71968,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is NULL. */ - _59: /* same as TK_ISNULL, jump, in1 */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 @@ -71585,6 +72007,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _60: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { @@ -71620,7 +72043,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** register P2. If either registers P1 or P3 are NULL then put ** a NULL in register P2. */ - _61: /* in1, in2, out2, in3 */ + _61: + ; /* in1, in2, out2, in3 */ if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) } else { @@ -71632,7 +72056,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Jump to P2 if the value in register P1 is not NULL. */ - _62: /* same as TK_NOTNULL, jump, in1 */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { goto jump_to_p2 @@ -71649,6 +72074,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If P1 is not an open cursor, then this opcode is a no-op. */ _63: + ; _ = libc.Int32FromInt32(0) pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { @@ -71671,7 +72097,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode is only available if SQLite is compiled with the ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. */ - _64: /* The VDBE cursor */ + _64: + ; /* The VDBE cursor */ _ = libc.Int32FromInt32(0) pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -71713,12 +72140,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** typeof() function or the IS NULL or IS NOT NULL operators or the ** equivalent. In this case, all content loading can be omitted. */ - _65: /* PseudoTable input register */ + _65: + ; /* PseudoTable input register */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) op_column_restart: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset @@ -71734,9 +72163,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - v211 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) - (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v211 - (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v211 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz } else { pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 @@ -71747,11 +72176,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { _ = libc.Int32FromInt32(0) - if v213 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v213 { - v212 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) - iMap = v212 + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 } - if v213 && v212 > uint32(0) { + if v215 && v214 > uint32(0) { pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor p22 = iMap - uint32(1) goto op_column_restart @@ -71778,9 +72207,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) /* Maximum page size is 64KiB */ } (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr - v214 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) - *(*Tu32)(unsafe.Pointer(aOffset)) = v214 - if v214 < uint32(0x80) { + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) } else { (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) @@ -71836,13 +72265,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** parsed and valid information is in aOffset[] and pC->aType[]. */ if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { - goto _215 + goto _217 } /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { - goto _217 + goto _219 } /* Make sure zData points to enough of the record to cover the header. */ if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { @@ -71857,16 +72286,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ op_column_read_header: + ; i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { - v220 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) - *(*Tu32)(unsafe.Pointer(bp + 80)) = v220 - v219 = v220 - *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v219 - if v219 < uint32(0x80) { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { zHdr++ offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) } else { @@ -71875,8 +72305,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) } i1++ - v221 = i1 - *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v221)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) } /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -71899,10 +72329,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { _sqlite3VdbeMemRelease(tls, bp+24) } - goto _218 - _217: + goto _220 + _219: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) - _218: + _220: + ; /* If after trying to extract new entries from the header, nHdrParsed is ** still not up to p2, that means that the record has fewer than p2 ** columns. So the result will be either the default value or a NULL. @@ -71916,10 +72348,12 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } goto op_column_out } - goto _216 - _215: + goto _218 + _217: + ; *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) - _216: + _218: + ; /* Extract the content for the p2+1-th column. Control can only ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are ** all valid. @@ -71939,9 +72373,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) } else { - v222 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) - len1 = v222 - (*TMem)(unsafe.Pointer(pDest)).Fn = v222 + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { if len1 > *(*int32)(unsafe.Pointer(db + 136)) { @@ -71963,9 +72397,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding _ = libc.Int32FromInt32(0) /* This branch happens only when content is on overflow pages */ - v223 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) - p5 = v223 - if int32(v223) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { /* Content is irrelevant for ** 1. the typeof() function, ** 2. the length(X) function if X is a blob, and @@ -71994,13 +72428,15 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } op_column_out: + ; goto _187 op_column_corrupt: + ; if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 goto _187 } else { - rc = _sqlite3CorruptError(tls, int32(95755)) + rc = _sqlite3CorruptError(tls, int32(95863)) goto abort_due_to_error } /* Opcode: TypeCheck P1 P2 P3 P4 * @@ -72030,6 +72466,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If any precondition is false, an assertion fault occurs. */ _66: + ; _ = libc.Int32FromInt32(0) pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72043,11 +72480,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { - goto _224 + goto _226 } if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { pIn1 += 56 - goto _224 + goto _226 } } _ = libc.Int32FromInt32(0) @@ -72076,16 +72513,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { - p225 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p225)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p225))) | libc.Int32FromInt32(MEM_IntReal)) - p226 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p226)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p226))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p227 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) p228 = pIn1 + 20 *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) } } else { if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { @@ -72098,14 +72535,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } pIn1 += 56 - goto _224 - _224: + goto _226 + _226: + ; i2++ } _ = libc.Int32FromInt32(0) goto _187 vdbe_type_error: - _sqlite3VdbeError(tls, p, __ccgo_ts+5641, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5666, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { - p229 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_IntReal)) - p230 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) - } else { - *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) p231 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_Real)) + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) p232 = pIn1 + 20 - *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) } } zAffinity++ @@ -72179,7 +72619,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** accept no-change records with serial_type 10. This value is ** only used inside an assert() and does not affect the end result. */ - _68: /* Where to write next byte of the payload */ + _68: + ; /* Where to write next byte of the payload */ /* Assuming the record contains N fields, the record format looks ** like this: ** @@ -72196,8 +72637,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** of the record to data0. */ nData = uint64(0) /* Number of bytes of data space */ - nHdr = 0 /* Number of bytes of header space */ - nZero = 0 /* Number of zero bytes at the end of the record */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) _ = libc.Int32FromInt32(0) @@ -72215,10 +72656,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { for cond := true; cond; cond = *(*uint8)(unsafe.Pointer(zAffinity1)) != 0 { _applyAffinity(tls, pRec, *(*uint8)(unsafe.Pointer(zAffinity1)), encoding) if int32(*(*uint8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { - p233 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_IntReal)) - p234 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^libc.Int32FromInt32(MEM_Int)) + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) } zAffinity1++ pRec += 56 @@ -72308,10 +72749,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** as an integer, then we might as well make it an 8-byte floating ** point value */ *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) - p235 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) & ^libc.Int32FromInt32(MEM_IntReal)) - p236 = pRec + 20 - *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) | libc.Int32FromInt32(MEM_Real)) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) } else { (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) @@ -72392,16 +72833,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) if nZero != 0 { *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) - p237 = pOut + 20 - *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) | libc.Int32FromInt32(MEM_Zero)) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) } zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz zPayload = zHdr1 + uintptr(nHdr) /* Write the record */ if nHdr < int32(0x80) { - v238 = zHdr1 + v240 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v238)) = uint8(nHdr) + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) } else { zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) } @@ -72414,9 +72855,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ if serial_type <= uint32(7) { - v239 = zHdr1 + v241 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v239)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) if serial_type == uint32(0) { /* NULL value. No change in zPayload */ } else { @@ -72460,9 +72901,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if serial_type < uint32(0x80) { - v240 = zHdr1 + v242 = zHdr1 zHdr1++ - *(*Tu8)(unsafe.Pointer(v240)) = uint8(serial_type) + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { _ = libc.Int32FromInt32(0) libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) @@ -72497,6 +72938,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** is returned based on the current cursor position. */ _69: + ; _ = libc.Int32FromInt32(0) pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) _ = libc.Int32FromInt32(0) @@ -72520,6 +72962,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). */ _70: + ; p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) /* Assert that the p1 parameter is valid. Also that if there is no open @@ -72535,7 +72978,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5682, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5707, 0) rc = int32(SQLITE_BUSY) } else { nName = _sqlite3Strlen30(tls, zName) @@ -72579,19 +73022,20 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { break } iSavepoint++ - goto _241 - _241: + goto _243 + _243: + ; pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext } if !(pSavepoint != 0) { - _sqlite3VdbeError(tls, p, __ccgo_ts+5733, libc.VaList(bp+944, zName)) + _sqlite3VdbeError(tls, p, __ccgo_ts+5758, libc.VaList(bp+944, zName)) rc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5755, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5780, 0) rc = int32(SQLITE_BUSY) } else { /* Determine whether or not this is a transaction savepoint. If so, @@ -72600,18 +73044,18 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { - v242 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v242 - if v242 != SQLITE_OK { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { goto vdbe_return } (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) - v243 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v243 - (*TVdbe)(unsafe.Pointer(p)).Frc = v243 + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 goto vdbe_return } rc = (*TVdbe)(unsafe.Pointer(p)).Frc @@ -72633,8 +73077,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _244 - _244: + goto _246 + _246: + ; ii++ } } else { @@ -72650,8 +73095,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if rc != SQLITE_OK { goto abort_due_to_error } - goto _245 - _245: + goto _247 + _247: + ; ii++ } if isSchemaChange != 0 { @@ -72714,6 +73160,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction causes the VM to halt. */ _71: + ; desiredAutoCommit = (*TOp)(unsafe.Pointer(pOp)).Fp1 iRollback = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) @@ -72730,13 +73177,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - _sqlite3VdbeError(tls, p, __ccgo_ts+5809, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+5834, 0) rc = int32(SQLITE_BUSY) goto abort_due_to_error } else { - v246 = _sqlite3VdbeCheckFk(tls, p, int32(1)) - rc = v246 - if v246 != SQLITE_OK { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { goto vdbe_return } else { (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) @@ -72746,9 +73193,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) - v247 = libc.Int32FromInt32(SQLITE_BUSY) - rc = v247 - (*TVdbe)(unsafe.Pointer(p)).Frc = v247 + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 goto vdbe_return } _sqlite3CloseSavepoints(tls, db) @@ -72760,16 +73207,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto vdbe_return } else { if !(desiredAutoCommit != 0) { - v248 = __ccgo_ts + 5864 + v250 = __ccgo_ts + 5889 } else { if iRollback != 0 { - v249 = __ccgo_ts + 5912 + v251 = __ccgo_ts + 5937 } else { - v249 = __ccgo_ts + 5955 + v251 = __ccgo_ts + 5980 } - v248 = v249 + v250 = v251 } - _sqlite3VdbeError(tls, p, v248, 0) + _sqlite3VdbeError(tls, p, v250, 0) rc = int32(SQLITE_ERROR) goto abort_due_to_error } @@ -72810,6 +73257,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement and rerun it from the beginning. */ _72: + ; *(*int32)(unsafe.Pointer(bp + 104)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -72866,7 +73314,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** SQL statement was prepared. */ _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) - (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+5996) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+6021) /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -72907,6 +73355,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** executing this instruction. */ _73: + ; _ = libc.Int32FromInt32(0) iDb = (*TOp)(unsafe.Pointer(pOp)).Fp1 iCookie = (*TOp)(unsafe.Pointer(pOp)).Fp3 @@ -72934,6 +73383,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the database schema version, resulting in a schema reset. */ _74: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73049,6 +73499,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: OP_OpenRead, OP_ReopenIdx */ _77: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCur = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -73060,8 +73511,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } /* If the cursor is not currently open or is open on a different ** index, then fall through into OP_OpenRead to force a reopen */ - _76: /* ncycle */ + _76: + ; /* ncycle */ _75: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73132,6 +73585,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** since moved into the btree layer. */ (*TVdbeCursor)(unsafe.Pointer(pCur)).FisTable = libc.BoolUint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) != -int32(8)) open_cursor_set_hints: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3BtreeCursorHintFlags(tls, *(*uintptr)(unsafe.Pointer(pCur + 48)), uint32(int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_BULKCSR)|libc.Int32FromInt32(OPFLAG_SEEKEQ)))) @@ -73147,7 +73601,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** Duplicate ephemeral cursors are used for self-joins of materialized views. */ - _78: /* The new cursor */ + _78: + ; /* The new cursor */ pOrig = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) /* Only ephemeral cursors can be duplicated */ @@ -73203,8 +73658,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by this opcode will be used for automatically created transient ** indices in joins. */ - _80: /* ncycle */ + _80: + ; /* ncycle */ _79: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { @@ -73240,11 +73697,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ - v251 = *(*uintptr)(unsafe.Pointer(pOp + 16)) - pKeyInfo2 = v251 - v250 = v251 - (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v250 - if v250 != uintptr(0) { + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) if rc == SQLITE_OK { @@ -73282,6 +73739,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** key is sufficient to produce the required results. */ _81: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) @@ -73304,13 +73762,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the sequence value. */ _82: + ; _ = libc.Int32FromInt32(0) pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) - v253 = pC4 + 24 - v252 = *(*Ti64)(unsafe.Pointer(v253)) - *(*Ti64)(unsafe.Pointer(v253))++ - if v252 == 0 { + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { goto jump_to_p2 } goto _187 @@ -73331,6 +73790,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the pseudo-table. */ _83: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) @@ -73352,7 +73812,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Close a cursor previously opened as P1. If P1 is not ** currently open, this instruction is a no-op. */ - _84: /* ncycle */ + _84: + ; /* ncycle */ _ = libc.Int32FromInt32(0) _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) @@ -73447,10 +73908,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ - _88: /* jump, in3, group, ncycle */ - _87: /* jump, in3, group, ncycle */ - _86: /* jump, in3, group, ncycle */ - _85: /* Only interested in == results */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -73555,11 +74020,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** } */ if int32(1)&(oc-int32(OP_SeekLT)) != 0 { - v254 = -int32(1) + v256 = -int32(1) } else { - v254 = +libc.Int32FromInt32(1) + v256 = +libc.Int32FromInt32(1) } - (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v254) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -73612,6 +74077,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } seek_not_found: + ; _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { goto jump_to_p2 @@ -73691,6 +74157,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** */ _89: + ; _ = libc.Int32FromInt32(0) /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first @@ -73711,29 +74178,32 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ - _256: + _258: + ; if !(int32(1) != 0) { - goto _255 + goto _257 } rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) if rc != 0 { goto abort_due_to_error } if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { - goto _257 + goto _259 } seekscan_search_fail: + ; /* Jump to SeekGE.P2, ending the loop */ pOp += 24 goto jump_to_p2 - _257: + _259: + ; if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { /* Jump to This.P2, bypassing the OP_SeekGE opcode */ goto jump_to_p2 - goto _255 + goto _257 } if nStep <= 0 { - goto _255 + goto _257 } nStep-- (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) @@ -73746,8 +74216,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { goto abort_due_to_error } } - goto _256 - _255: + goto _258 + _257: + ; goto _187 /* Opcode: SeekHit P1 P2 P3 * * ** Synopsis: set P2<=seekHit<=P3 @@ -73764,6 +74235,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 must be a valid b-tree cursor. */ _90: + ; _ = libc.Int32FromInt32(0) pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -73783,6 +74255,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. */ _91: + ; _ = libc.Int32FromInt32(0) pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { @@ -73880,15 +74353,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: NotFound, Found, NotExists */ _92: + ; _ = libc.Int32FromInt32(0) pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { goto _187 } - _95: /* jump, in3, ncycle */ - _94: /* jump, in3, ncycle */ + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ _93: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -73908,11 +74385,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { - v258 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) } else { - v258 = 0 + v260 = 0 } - rc = v258 + rc = v260 _ = libc.Int32FromInt32(0) if rc != 0 { goto no_mem @@ -73953,8 +74430,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { goto jump_to_p2 } - goto _259 - _259: + goto _261 + _261: + ; ii1++ } } @@ -74011,6 +74489,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Found, NotFound, NoConflict, SeekRowid */ _97: + ; pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { /* If pIn3->u.i does not contain an integer, compute iKey as the @@ -74032,12 +74511,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { iKey1 = uint64(*(*Ti64)(unsafe.Pointer(bp + 256))) goto notExistsWithKey } - _96: /* jump, in3, ncycle */ + _96: + ; /* jump, in3, ncycle */ pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) notExistsWithKey: + ; pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74055,7 +74536,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { - rc = _sqlite3CorruptError(tls, int32(98003)) + rc = _sqlite3CorruptError(tls, int32(98111)) } else { goto jump_to_p2 } @@ -74072,15 +74553,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The sequence number on the cursor is incremented after this ** instruction. */ - _98: /* out2 */ + _98: + ; /* out2 */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) - v261 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 - v260 = *(*Ti64)(unsafe.Pointer(v261)) - *(*Ti64)(unsafe.Pointer(v261))++ - *(*Ti64)(unsafe.Pointer(pOut)) = v260 + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 goto _187 /* Opcode: NewRowid P1 P2 P3 * * ** Synopsis: r[P2]=rowid @@ -74097,7 +74579,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** generated record number. This P3 mechanism is used to help implement the ** AUTOINCREMENT feature. */ - _99: /* Root frame of VDBE */ + _99: + ; /* Root frame of VDBE */ *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 *(*int32)(unsafe.Pointer(bp + 320)) = 0 pOut = _out2Prerelease(tls, p, pOp) @@ -74151,8 +74634,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !((*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { break } - goto _262 - _262: + goto _264 + _264: + ; pFrame1 = (*TVdbeFrame)(unsafe.Pointer(pFrame1)).FpParent } /* Assert that P3 is a valid memory cell. */ @@ -74187,15 +74671,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_randomness(tls, int32(8), bp+312) *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ - goto _266 - _266: - v263 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) - rc = v263 - if v265 = v263 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v265 { + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { cnt1++ - v264 = cnt1 + v266 = cnt1 } - if !(v265 && v264 < int32(100)) { + if !(v267 && v266 < int32(100)) { break } } @@ -74249,7 +74734,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ - _100: /* Payload to be inserted */ + _100: + ; /* Payload to be inserted */ pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74297,11 +74783,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v267 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult } else { - v267 = 0 + v269 = 0 } - seekResult = v267 + seekResult = v269 if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) } else { @@ -74321,11 +74807,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { - v268 = int32(SQLITE_UPDATE) + v270 = int32(SQLITE_UPDATE) } else { - v268 = int32(SQLITE_INSERT) + v270 = int32(SQLITE_INSERT) } - (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v268, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) } goto _187 /* Opcode: RowCell P1 P2 P3 * * @@ -74339,7 +74825,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode must be followed by either an Insert or InsertIdx opcode ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ - _101: /* Rowid value to insert with */ + _101: + ; /* Rowid value to insert with */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74347,11 +74834,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { - v269 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) } else { - v269 = 0 + v271 = 0 } - iKey2 = v269 + iKey2 = v271 rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) if rc != SQLITE_OK { goto abort_due_to_error @@ -74398,6 +74885,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** be set to by the update. */ _102: + ; opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 _ = libc.Int32FromInt32(0) pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -74427,11 +74915,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { _ = libc.Int32FromInt32(0) if opflags&int32(OPFLAG_ISUPDATE) != 0 { - v270 = int32(SQLITE_UPDATE) + v272 = int32(SQLITE_UPDATE) } else { - v270 = int32(SQLITE_DELETE) + v272 = int32(SQLITE_DELETE) } - _sqlite3VdbePreUpdateHook(tls, p, pC13, v270, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) } if opflags&int32(OPFLAG_ISNOOP) != 0 { goto _187 @@ -74464,6 +74952,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This is used by trigger programs. */ _103: + ; _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 goto _187 @@ -74483,6 +74972,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** each other. Jump to P2 if they are different. */ _104: + ; pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74510,6 +75000,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** us from having to issue a separate NullRow instruction to clear that cache. */ _105: + ; pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -74550,6 +75041,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** by any use of another cursor pointing to the same table. */ _106: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -74594,6 +75086,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** one opcode now works for both table types. */ _107: + ; pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -74643,6 +75136,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** pseudo-cursor that always returns NULL for every column. */ _108: + ; _ = libc.Int32FromInt32(0) pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) if pC18 == uintptr(0) { @@ -74686,8 +75180,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. */ - _110: /* ncycle */ + _110: + ; /* ncycle */ _109: + ; _ = libc.Int32FromInt32(0) pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -74721,6 +75217,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** estimate is less than approximately 2**(0.1*P3). */ _111: + ; _ = libc.Int32FromInt32(0) pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -74761,8 +75258,10 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** regression tests can determine whether or not the optimizer is ** correctly optimizing out sorts. */ - _113: /* jump ncycle */ - _112: /* jump ncycle */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ /* Opcode: Rewind P1 P2 * * * ** @@ -74780,6 +75279,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** configured to use Next, not Prev. */ _114: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -74862,11 +75362,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** record, or jumps to P2 if there are no more sorted records. */ _117: + ; pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) rc = _sqlite3VdbeSorterNext(tls, db, pC22) goto next_tail - _115: /* jump, ncycle */ + _115: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -74876,7 +75378,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) goto next_tail - _116: /* jump, ncycle */ + _116: + ; /* jump, ncycle */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -74886,6 +75389,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) next_tail: + ; (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) if rc == SQLITE_OK { (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) @@ -74927,6 +75431,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** for tables is OP_Insert. */ _118: + ; _ = libc.Int32FromInt32(0) pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -74939,11 +75444,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v271 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v271 = 0 + v273 = 0 } - rc = v271 + rc = v273 if rc != 0 { goto abort_due_to_error } @@ -74952,11 +75457,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { - v272 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult } else { - v272 = 0 + v274 = 0 } - rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v272) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) _ = libc.Int32FromInt32(0) (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) if rc != 0 { @@ -74971,6 +75476,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** into the sorter P1. Data for the entry is nil. */ _119: + ; _ = libc.Int32FromInt32(0) pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -74979,11 +75485,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { - v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) } else { - v273 = 0 + v275 = 0 } - rc = v273 + rc = v275 if rc != 0 { goto abort_due_to_error } @@ -75008,6 +75514,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** this (self-correcting and non-critical) error if in writable_schema mode. */ _120: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75031,7 +75538,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } } else { if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { - rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { - rc = _sqlite3CorruptError(tls, int32(99290)) + rc = _sqlite3CorruptError(tls, int32(99398)) goto abort_due_to_error } _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) @@ -75260,6 +75774,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Clear */ _128: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) pOut = _out2Prerelease(tls, p, pOp) @@ -75304,6 +75819,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** See also: Destroy */ _129: + ; *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -75328,6 +75844,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** opened with OP_OpenEphemeral or OP_SorterOpen. */ _130: + ; _ = libc.Int32FromInt32(0) pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -75352,6 +75869,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** The root page number of the new b-tree is stored in register P2. */ _131: + ; pOut = _out2Prerelease(tls, p, pOp) *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) _ = libc.Int32FromInt32(0) @@ -75373,6 +75891,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P1 is true. */ _132: + ; (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth @@ -75404,6 +75923,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** then runs the new virtual machine. It is thus a re-entrant opcode. */ _133: + ; /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking ** sqlite3InitCallback(). @@ -75418,13 +75938,13 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) } else { - zSchema = __ccgo_ts + 6041 + zSchema = __ccgo_ts + 6066 (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6055, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6080, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -75441,7 +75961,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse ** at least one SQL statement. Any less than that indicates that ** the sqlite_schema table is corrupt. */ - rc = _sqlite3CorruptError(tls, int32(99570)) + rc = _sqlite3CorruptError(tls, int32(99678)) } _sqlite3DbFreeNN(tls, db, zSql) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) @@ -75462,6 +75982,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** the analysis to be used when preparing all subsequent queries. */ _134: + ; _ = libc.Int32FromInt32(0) rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) if rc != 0 { @@ -75477,6 +75998,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _135: + ; _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropIndex P1 * * P4 * @@ -75488,6 +76010,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _136: + ; _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: DropTrigger P1 * * P4 * @@ -75499,6 +76022,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** schema consistent with what is on disk. */ _137: + ; _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) goto _187 /* Opcode: IntegrityCk P1 P2 P3 P4 P5 @@ -75520,7 +76044,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** This opcode is used to implement the integrity_check pragma. */ - _138: /* Register keeping track of errors remaining */ + _138: + ; /* Register keeping track of errors remaining */ _ = libc.Int32FromInt32(0) nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) @@ -75556,7 +76081,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** An assertion fails if P2 is not an integer. */ - _139: /* in1, in2 */ + _139: + ; /* in1, in2 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 _ = libc.Int32FromInt32(0) @@ -75577,6 +76103,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** unchanged and jump to instruction P2. */ _140: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { @@ -75612,6 +76139,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** inserted as part of some other set). */ _141: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi @@ -75652,7 +76180,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** ** If P5 is non-zero, then recursive program invocation is enabled. */ - _142: /* Token identifying trigger */ + _142: + ; /* Token identifying trigger */ pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 _ = libc.Int32FromInt32(0) @@ -75674,8 +76203,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { break } - goto _274 - _274: + goto _276 + _276: + ; pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent } if pFrame2 != 0 { @@ -75684,7 +76214,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { rc = int32(SQLITE_ERROR) - _sqlite3VdbeError(tls, p, __ccgo_ts+6098, 0) + _sqlite3VdbeError(tls, p, __ccgo_ts+6123, 0) goto abort_due_to_error } /* Register pRt is used to store the memory required to save the state @@ -75731,8 +76261,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { } (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) (*TMem)(unsafe.Pointer(pMem1)).Fdb = db - goto _275 - _275: + goto _277 + _277: + ; pMem1 += 56 } } else { @@ -75752,17 +76283,17 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 - v276 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) - aMem = v276 - (*TVdbe)(unsafe.Pointer(p)).FaMem = v276 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) - v277 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp - aOp = v277 - (*TVdbe)(unsafe.Pointer(p)).FaOp = v277 + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 goto check_for_interrupt @@ -75779,6 +76310,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** calling OP_Program instruction. */ _143: + ; pOut = _out2Prerelease(tls, p, pOp) pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 @@ -75793,6 +76325,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** statement counter is incremented (immediate foreign key constraints). */ _144: + ; if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) } else { @@ -75815,7 +76348,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** zero, the jump is taken if the statement constraint-counter is zero ** (immediate foreign key constraint violations). */ - _145: /* jump */ + _145: + ; /* jump */ if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { goto jump_to_p2 @@ -75838,14 +76372,16 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** an integer. */ _146: + ; if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame for { if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { break } - goto _278 - _278: + goto _280 + _280: + ; pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent } pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 @@ -75870,7 +76406,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If the initial value of register P1 is less than 1, then the ** value is unchanged and control passes through to the next instruction. */ - _147: /* jump, in1 */ + _147: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { @@ -75897,20 +76434,21 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. */ _148: + ; pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 pOut = _out2Prerelease(tls, p, pOp) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) - if v280 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v280 { + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { - v279 = *(*Ti64)(unsafe.Pointer(pIn3)) + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) } else { - v279 = 0 + v281 = 0 } } - if v280 || _sqlite3AddInt64(tls, bp+704, v279) != 0 { + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -75931,7 +76469,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** If it is non-zero (negative or positive) and then also jump to P2. ** If register P1 is initially zero, leave it unchanged and fall through. */ - _149: /* jump, in1 */ + _149: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { @@ -75947,7 +76486,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** Register P1 must hold an integer. Decrement the value in P1 ** and jump to P2 if the new value is exactly zero. */ - _150: /* jump, in1 */ + _150: + ; /* jump, in1 */ pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 _ = libc.Int32FromInt32(0) if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(1) { rc = int32(SQLITE_ERROR) if eNew == int32(PAGER_JOURNALMODE_WAL) { - v284 = __ccgo_ts + 6135 + v286 = __ccgo_ts + 6160 } else { - v284 = __ccgo_ts + 6140 + v286 = __ccgo_ts + 6165 } - _sqlite3VdbeError(tls, p, __ccgo_ts+6147, libc.VaList(bp+944, v284)) + _sqlite3VdbeError(tls, p, __ccgo_ts+6172, libc.VaList(bp+944, v286)) goto abort_due_to_error } else { if eOld == int32(PAGER_JOURNALMODE_WAL) { @@ -76226,11 +76775,11 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { if eNew == int32(PAGER_JOURNALMODE_WAL) { - v285 = int32(2) + v287 = int32(2) } else { - v285 = int32(1) + v287 = int32(1) } - rc = _sqlite3BtreeSetVersion(tls, pBt1, v285) + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) } } } @@ -76257,13 +76806,14 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2 is zero, the vacuum overwrites the original database. */ _158: + ; _ = libc.Int32FromInt32(0) if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { - v286 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 } else { - v286 = uintptr(0) + v288 = uintptr(0) } - rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v286) + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) if rc != 0 { goto abort_due_to_error } @@ -76275,6 +76825,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** P2. Otherwise, fall through to the next instruction. */ _159: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -76305,6 +76856,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** correctness of operation. */ _160: + ; _ = libc.Int32FromInt32(0) if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) @@ -76318,6 +76870,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by an other cursor. */ _161: + ; _ = libc.Int32FromInt32(0) pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -76330,6 +76883,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** written by other cursors. */ _162: + ; _ = libc.Int32FromInt32(0) pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) _ = libc.Int32FromInt32(0) @@ -76352,6 +76906,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** used to generate an error message if the lock cannot be obtained. */ _163: + ; isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< int32(1) { - z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+944, zTrace)) + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+944, zTrace)) (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) _sqlite3DbFree(tls, db, z3) } else { @@ -77072,8 +77652,9 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 } - goto _298 - _298: + goto _300 + _300: + ; i9++ } (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 @@ -77092,7 +77673,8 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** This opcode records information from the optimizer. It is the ** the same as a no-op. This opcodesnever appears in a real VM program. */ - _186: /* This is really OP_Noop, OP_Explain */ + _186: + ; /* This is really OP_Noop, OP_Explain */ _ = libc.Int32FromInt32(0) goto _187 /***************************************************************************** @@ -77102,6 +77684,7 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { ** restored. *****************************************************************************/ _187: + ; /* The following code adds nothing to the actual functionality ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through @@ -77109,17 +77692,19 @@ func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { */ goto _1 _1: + ; pOp += 24 } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished with ** an error of some kind. */ abort_due_to_error: + ; if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { rc = int32(SQLITE_NOMEM) } else { if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { @@ -77164,12 +77750,14 @@ vdbe_return: ** is encountered. */ too_big: - _sqlite3VdbeError(tls, p, __ccgo_ts+5398, 0) + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5423, 0) rc = int32(SQLITE_TOOBIG) goto abort_due_to_error /* Jump to here if a malloc() fails. */ no_mem: + ; _sqlite3OomFault(tls, db) _sqlite3VdbeError(tls, p, __ccgo_ts+1618, 0) rc = int32(SQLITE_NOMEM) @@ -77178,6 +77766,7 @@ no_mem: ** flag. */ abort_due_to_interrupt: + ; _ = libc.Int32FromInt32(0) rc = int32(SQLITE_INTERRUPT) goto abort_due_to_error @@ -77185,10 +77774,10 @@ abort_due_to_interrupt: } var _azType = [4]uintptr{ - 0: __ccgo_ts + 5555, - 1: __ccgo_ts + 5564, - 2: __ccgo_ts + 5571, - 3: __ccgo_ts + 5577, + 0: __ccgo_ts + 5580, + 1: __ccgo_ts + 5589, + 2: __ccgo_ts + 5596, + 3: __ccgo_ts + 5602, } var _and_logic = [9]uint8{ @@ -77345,13 +77934,13 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr v2 = __ccgo_ts + 1634 } else { if type1 == uint32(7) { - v3 = __ccgo_ts + 6276 + v3 = __ccgo_ts + 6301 } else { - v3 = __ccgo_ts + 6281 + v3 = __ccgo_ts + 6306 } v2 = v3 } - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6289, libc.VaList(bp+8, v2)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6314, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) @@ -77369,7 +77958,7 @@ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6318, libc.VaList(bp+8, iRow)) + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6343, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3795, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) @@ -77414,15 +78003,15 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6338, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6363, libc.VaList(bp+440, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6368, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6393, libc.VaList(bp+440, zTable)) } if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) - _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6404, libc.VaList(bp+440, zTable)) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6429, libc.VaList(bp+440, zTable)) } if !(pTab != 0) { if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { @@ -77447,11 +78036,12 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6425, libc.VaList(bp+440, zColumn)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6450, libc.VaList(bp+440, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77478,14 +78068,16 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { - zFault = __ccgo_ts + 6446 + zFault = __ccgo_ts + 6471 } goto _3 _3: + ; j++ } goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -77501,19 +78093,21 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, } /* FIXME: Be smarter about indexes that use expressions */ if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { - zFault = __ccgo_ts + 6458 + zFault = __ccgo_ts + 6483 } goto _5 _5: + ; j1++ } goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6466, libc.VaList(bp+440, zFault)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6491, libc.VaList(bp+440, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -77577,6 +78171,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, _sqlite3ParseObjectReset(tls, bp+8) } blob_open_out: + ; if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob } else { @@ -77676,7 +78271,7 @@ func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset in _, _, _, _, _ = db, iKey, p, rc, v p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102082)) + return _sqlite3MisuseError(tls, int32(102190)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -77778,7 +78373,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r _, _, _, _ = db, p, rc, v1 p = pBlob if p == uintptr(0) { - return _sqlite3MisuseError(tls, int32(102182)) + return _sqlite3MisuseError(tls, int32(102290)) } db = (*TIncrblob)(unsafe.Pointer(p)).Fdb Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -78792,6 +79387,7 @@ func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, p } goto _1 _1: + ; i++ } } else { @@ -78916,6 +79512,7 @@ func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintpt (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _3 _3: + ; i++ } if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ @@ -78976,6 +79573,7 @@ func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -79068,6 +79666,7 @@ func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { } goto _1 _1: + ; i-- } return rc @@ -79124,6 +79723,7 @@ func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) goto _1 _1: + ; i++ } } @@ -79180,6 +79780,7 @@ func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter goto _1 _1: + ; i++ } if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { @@ -79388,6 +79989,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) goto _1 _1: + ; i++ } (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p @@ -79410,6 +80012,7 @@ func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { p = v3 goto _2 _2: + ; i++ } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79568,6 +80171,7 @@ func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) } goto _1 _1: + ; p = pNext } (*TSorterList)(unsafe.Pointer(pList)).FpList = p @@ -79647,6 +80251,7 @@ func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int3 } goto _1 _1: + ; i = i / int32(2) } *(*int32)(unsafe.Pointer(pbEof)) = libc.BoolInt32((*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80))).FpFd == uintptr(0)) @@ -79714,6 +80319,7 @@ func _vdbeSorterFlushPMA(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -80134,6 +80740,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i } goto _1 _1: + ; i++ } i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) @@ -80144,6 +80751,7 @@ func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode i _vdbeMergeEngineCompare(tls, pMerger, i) goto _2 _2: + ; i-- } return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) @@ -80326,6 +80934,7 @@ func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset u iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -80390,6 +80999,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) goto _1 _1: + ; i++ } i = int32(1) @@ -80413,6 +81023,7 @@ func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32 } goto _2 _2: + ; i++ } if rc == SQLITE_OK { @@ -80496,6 +81107,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _2 _2: + ; i += int32(SORTER_MAX_MERGE_COUNT) } } @@ -80512,6 +81124,7 @@ func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r } goto _1 _1: + ; iTask++ } if rc != SQLITE_OK { @@ -80553,6 +81166,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare goto _1 _1: + ; i++ } rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) @@ -80586,6 +81200,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { } goto _2 _2: + ; iTask++ } iTask = 0 @@ -80607,6 +81222,7 @@ func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) goto _4 _4: + ; iTask++ } } @@ -80827,6 +81443,7 @@ func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCo } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) @@ -80993,6 +81610,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pChunk = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext } } else { @@ -81014,6 +81632,7 @@ func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst T iChunkOffset = 0 goto _4 _4: + ; if v3 = nRead >= 0; v3 { v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext pChunk = v2 @@ -81049,6 +81668,7 @@ func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { Xsqlite3_free(tls, pIter) goto _1 _1: + ; pIter = pNext } } @@ -81086,6 +81706,7 @@ func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { iOff += int64(nChunk) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if rc == SQLITE_OK { @@ -81203,6 +81824,7 @@ func _memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Tsqlite_int64) (r int32) iOff += int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize) goto _1 _1: + ; pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext } if pIter != 0 { @@ -81415,6 +82037,7 @@ func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return WRC_Continue @@ -81516,6 +82139,7 @@ func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i-- pItem += 32 } @@ -81610,6 +82234,7 @@ func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) } goto _1 _1: + ; i-- pItem += 104 } @@ -81795,6 +82420,10 @@ func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pE _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr _ = libc.Int32FromInt32(0) + _ = libc.Int32FromInt32(0) + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } db = (*TParse)(unsafe.Pointer(pParse)).Fdb pDup = _sqlite3ExprDup(tls, db, pOrig, 0) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -81854,6 +82483,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _1 _1: + ; n++ } if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { @@ -81867,6 +82497,7 @@ func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr } goto _2 _2: + ; n++ } if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*uint8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { @@ -81973,25 +82604,25 @@ func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema _ = zLegacy _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6500, int32(7)) != 0 { + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6525, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName - if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6508+7) == 0 { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6527+7) == 0 { + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6533+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6552+7) == 0 { return int32(1) } if pSchema == uintptr(0) { return 0 } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6041+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6066+7) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } else { - if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6546+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6571+7) == 0 { return int32(1) } } @@ -82077,9 +82708,10 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _1 _1: + ; i++ } - if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6560, zDb) == 0 { + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6585, zDb) == 0 { /* This branch is taken when the main database has been renamed ** using SQLITE_DBCONFIG_MAINDBNAME. */ pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema @@ -82168,6 +82800,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _3 _3: + ; j++ } if hit != 0 || zTab == uintptr(0) { @@ -82180,7 +82813,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { goto _2 } - if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6565) != 0 { + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6590) != 0 { goto _2 } } @@ -82251,15 +82884,26 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _4 _4: + ; j++ pCol += 16 } if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++ pMatch = pItem } goto _2 _2: + ; i++ pItem += 104 } @@ -82289,11 +82933,11 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } } else { - if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6567, zTab) == 0 { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6592, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } else { - if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6571, zTab) == 0 { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6596, zTab) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab } @@ -82302,7 +82946,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) - if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6575, zTab) == 0 { + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6600, zTab) == 0 { pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) } @@ -82325,6 +82969,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _6 _6: + ; iCol++ pCol += 16 } @@ -82383,8 +83028,8 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol /* ** Perhaps the name is a reference to the ROWID */ - if cnt == 0 && cntTab == int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { - cnt = int32(1) + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) } @@ -82423,15 +83068,15 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol _ = libc.Int32FromInt32(0) pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6584, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6609, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6615, libc.VaList(bp+24, zAs)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6640, libc.VaList(bp+24, zAs)) return int32(WRC_Abort) } if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return int32(WRC_Abort) } _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) @@ -82445,6 +83090,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } goto _9 _9: + ; j++ } } @@ -82484,7 +83130,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6670, libc.VaList(bp+24, zCol)) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6695, libc.VaList(bp+24, zCol)) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) libc.Xmemset(tls, pExpr+64, 0, uint64(8)) return int32(WRC_Prune) @@ -82515,7 +83161,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6705 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6730 *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) cnt = int32(1) goto lookupname_end @@ -82525,18 +83171,18 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } } if cnt == 0 { - v10 = __ccgo_ts + 6714 + v10 = __ccgo_ts + 6739 } else { - v10 = __ccgo_ts + 6729 + v10 = __ccgo_ts + 6754 } zErr = v10 if zDb != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6751, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6776, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) } else { if zTab != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+24, zErr, zTab, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+24, zErr, zTab, zCol)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+24, zErr, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+24, zErr, zCol)) } } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -82572,6 +83218,7 @@ func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) lookupname_end: + ; if cnt == int32(1) { _ = libc.Int32FromInt32(0) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { @@ -82662,19 +83309,19 @@ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pEx defer tls.Free(32) var zIn uintptr _ = zIn - zIn = __ccgo_ts + 6781 + zIn = __ccgo_ts + 6806 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { - zIn = __ccgo_ts + 6809 + zIn = __ccgo_ts + 6834 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { - zIn = __ccgo_ts + 6827 + zIn = __ccgo_ts + 6852 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { - zIn = __ccgo_ts + 6845 + zIn = __ccgo_ts + 6870 } } } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6863, libc.VaList(bp+8, zMsg, zIn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6888, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } @@ -82722,10 +83369,10 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var anRef [8]int32 - var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v11, v3, v5, v6 int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 var enc Tu8 - var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v4, v7, p10, p8, p9 uintptr - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v11, v3, v4, v5, v6, v7, p10, p8, p9 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) _ = libc.Int32FromInt32(0) pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse @@ -82760,6 +83407,19 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ fallthrough case int32(TK_NOTNULL): @@ -82774,30 +83434,52 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef goto _1 _1: + ; p = (*TNameContext)(unsafe.Pointer(p)).FpNext i++ } _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - if 0 == _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - _ = libc.Int32FromInt32(0) - *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) - *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) - (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) - i = 0 - p = pNC - for { - if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { - break - } - (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] - goto _2 - _2: - p = (*TNameContext)(unsafe.Pointer(p)).FpNext - i++ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _ = libc.Int32FromInt32(0) + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break } - _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) - (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) return int32(WRC_Prune) /* A column name: ID ** Or table name and column name: ID.ID @@ -82820,7 +83502,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+6883, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6908, uintptr(0), pExpr) } pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { @@ -82848,22 +83530,22 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_FUNCTION): pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) if pList != 0 { - v3 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr } else { - v3 = 0 + v4 = 0 } /* The argument list */ - n = v3 /* Number of arguments */ + n = v4 /* Number of arguments */ no_such_func = 0 /* True if no such function exists */ wrong_num_args = 0 /* True if wrong number of arguments */ is_agg = 0 /* Information about the function */ enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { - v4 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) } else { - v4 = uintptr(0) + v5 = uintptr(0) } - pWin = v4 + pWin = v5 _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) @@ -82882,7 +83564,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if n == int32(2) { (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6900, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6925, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -82896,17 +83578,17 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** to likelihood(X,0.9375). */ /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ if int32(*(*uint8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { - v5 = int32(8388608) + v6 = int32(8388608) } else { - v5 = int32(125829120) + v6 = int32(125829120) } - (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 } } auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6964, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6989, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) @@ -82928,7 +83610,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** all this. */ _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7000, uintptr(0), pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7025, uintptr(0), pExpr) } } else { _ = libc.Int32FromInt32(0) /* Must fit in 8 bits */ @@ -82953,29 +83635,29 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { _ = libc.Int32FromInt32(0) if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7028, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7053, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { - zType = __ccgo_ts + 7071 + zType = __ccgo_ts + 7096 } else { - zType = __ccgo_ts + 7078 + zType = __ccgo_ts + 7103 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7088, libc.VaList(bp+8, zType, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7113, libc.VaList(bp+8, zType, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else { if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7116, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7141, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if wrong_num_args != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7138, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7163, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7182, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7207, libc.VaList(bp+8, pExpr)) (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else { if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { @@ -82992,11 +83674,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { ** Or arguments of other window functions. But aggregate functions ** may be arguments for window functions. */ if !(pWin != 0) { - v6 = int32(NC_AllowAgg) + v7 = int32(NC_AllowAgg) } else { - v6 = 0 + v7 = 0 } - *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v6) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) } } else { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { @@ -83015,11 +83697,11 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { _ = libc.Int32FromInt32(0) if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { if pSel != 0 { - v7 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn } else { - v7 = uintptr(0) + v8 = uintptr(0) } - _sqlite3WindowUpdate(tls, pParse, v7, pWin, pDef) + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { break } @@ -83038,18 +83720,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { } pNC2 = pNC for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { - p8 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p8)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p8))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext } _ = libc.Int32FromInt32(0) if pNC2 != 0 && pDef != 0 { - p9 = pExpr + 2 - *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - p10 = pNC2 + 40 - *(*int32)(unsafe.Pointer(p10)) = int32(uint32(*(*int32)(unsafe.Pointer(p10))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) } } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags @@ -83066,7 +83748,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7230, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7255, pExpr, pExpr) } else { _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) } @@ -83079,7 +83761,7 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { case int32(TK_VARIABLE): _ = libc.Int32FromInt32(0) if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { - _notValidImpl(tls, pParse, pNC, __ccgo_ts+7241, pExpr, pExpr) + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7266, pExpr, pExpr) } case int32(TK_IS): fallthrough @@ -83129,18 +83811,18 @@ func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) } if nLeft != nRight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } break } _ = libc.Int32FromInt32(0) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { - v11 = int32(WRC_Abort) + v12 = int32(WRC_Abort) } else { - v11 = WRC_Continue + v12 = WRC_Continue } - return v11 + return v12 } // C documentation @@ -83175,6 +83857,7 @@ func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) ( } goto _1 _1: + ; i++ } } @@ -83241,6 +83924,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt } goto _1 _1: + ; i++ } /* If no match, return 0. */ @@ -83255,7 +83939,7 @@ func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintpt func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7252, libc.VaList(bp+8, i, zType, mx)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7277, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } @@ -83290,7 +83974,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7308, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7333, 0) return int32(1) } i = 0 @@ -83301,6 +83985,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) goto _1 _1: + ; i++ } (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) @@ -83328,7 +84013,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { - _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7342, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7367, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) return int32(1) } } else { @@ -83389,6 +84074,7 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r } goto _2 _2: + ; i++ pItem += 32 } @@ -83400,11 +84086,12 @@ func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r break } if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7348, libc.VaList(bp+16, i+int32(1))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7373, libc.VaList(bp+16, i+int32(1))) return int32(1) } goto _3 _3: + ; i++ } return 0 @@ -83433,7 +84120,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7409, libc.VaList(bp+8, zType)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7434, libc.VaList(bp+8, zType)) return int32(1) } pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList @@ -83462,6 +84149,7 @@ func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, } goto _1 _1: + ; i++ pItem += 32 } @@ -83596,10 +84284,12 @@ func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ pItem += 32 } @@ -83712,6 +84402,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { @@ -83753,16 +84444,18 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7440, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7465, 0) return int32(WRC_Abort) } if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { return int32(WRC_Abort) } } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { return int32(WRC_Abort) } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) /* Resolve names in table-valued-function arguments */ i = 0 for { @@ -83775,6 +84468,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _4 _4: + ; i++ } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -83788,6 +84482,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _5 _5: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -83816,7 +84511,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) != 0 { return int32(WRC_Abort) } if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -83827,7 +84522,7 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { ** the GROUP BY clause does not contain aggregate functions. */ if pGroupBy != 0 { - if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7479) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7504) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(WRC_Abort) } i = 0 @@ -83837,11 +84532,12 @@ func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { break } if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7485, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7510, 0) return int32(WRC_Abort) } goto _6 _6: + ; i++ pItem2 += 32 } @@ -84004,6 +84700,7 @@ func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg @@ -84243,6 +84940,7 @@ func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) goto _1 _1: + ; ii += int32(2) } if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { @@ -84317,8 +85015,11 @@ func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) _ = libc.Int32FromInt32(0) pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr } else { - _ = libc.Int32FromInt32(0) - pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } } } return pExpr @@ -84396,6 +85097,7 @@ func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintpt } goto _2 _2: + ; i++ } } @@ -84861,7 +85563,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) return } _ = libc.Int32FromInt32(0) @@ -84921,6 +85623,7 @@ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _1 _1: + ; i++ } _sqlite3VdbeJumpHere(tls, v, addrCmp) @@ -84945,7 +85648,7 @@ func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r in rc = SQLITE_OK mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) if nHeight > mxHeight { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7544, libc.VaList(bp+8, mxHeight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7569, libc.VaList(bp+8, mxHeight)) rc = int32(SQLITE_ERROR) } return rc @@ -84982,6 +85685,7 @@ func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) goto _1 _1: + ; i++ } } @@ -85003,6 +85707,7 @@ func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } @@ -85296,11 +86001,11 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } if nExprElem != nElem { if nExprElem > int32(1) { - v2 = __ccgo_ts + 7592 + v2 = __ccgo_ts + 7617 } else { v2 = __ccgo_ts + 1648 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7594, libc.VaList(bp+8, nExprElem, v2, nElem)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7619, libc.VaList(bp+8, nExprElem, v2, nElem)) break } _ = libc.Int32FromInt32(0) @@ -85315,6 +86020,7 @@ func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList } goto _1 _1: + ; ii++ } if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { @@ -85379,7 +86085,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u _ = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7638, libc.VaList(bp+8, pToken)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7663, libc.VaList(bp+8, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) @@ -85400,7 +86106,7 @@ func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7672, libc.VaList(bp+8, p)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7697, libc.VaList(bp+8, p)) } // C documentation @@ -85479,7 +86185,7 @@ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7722, libc.VaList(bp+8, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7747, libc.VaList(bp+8, pExpr)) } } } @@ -85536,7 +86242,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) } if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7742, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7767, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) return } @@ -85569,7 +86275,7 @@ func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7785, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7810, 0) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } } @@ -85987,6 +86693,7 @@ func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d goto _1 _1: + ; i++ } } @@ -86120,6 +86827,7 @@ func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r u (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu goto _1 _1: + ; i++ pItem += 32 pOldItem += 32 @@ -86199,6 +86907,7 @@ func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r ui (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed goto _3 _3: + ; i++ } return pNew @@ -86230,6 +86939,7 @@ func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 goto _1 _1: + ; i++ } return pNew @@ -86290,6 +87000,7 @@ func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r pNext = pNew goto _1 _1: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } return *(*uintptr)(unsafe.Pointer(bp)) @@ -86445,7 +87156,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, n = v2 } if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error } i = 0 @@ -86466,6 +87177,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, } goto _4 _4: + ; i++ } if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { @@ -86481,6 +87193,7 @@ func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId } vector_append_error: + ; _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) _sqlite3IdListDelete(tls, db, pColumns) return pList @@ -86587,7 +87300,7 @@ func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, _ = mx mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7838, libc.VaList(bp+8, zObject)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7863, libc.VaList(bp+8, zObject)) } } @@ -86612,6 +87325,7 @@ func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { pItem += 32 goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -86656,6 +87370,7 @@ func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags goto _1 _1: + ; i++ } return m @@ -86687,10 +87402,10 @@ func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7861) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7886) == 0 { return uint32(EP_IsTrue) } - if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7866) == 0 { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7891) == 0 { return uint32(EP_IsFalse) } return uint32(0) @@ -87011,6 +87726,7 @@ func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList } goto _1 _1: + ; jj++ } } @@ -87043,6 +87759,7 @@ func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) } goto _1 _1: + ; i++ } /* Check if pExpr is a sub-select. If so, consider it variable. */ @@ -87256,13 +87973,13 @@ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff uint8) (r i // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { - if _sqlite3StrICmp(tls, z, __ccgo_ts+7872) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7897) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7880) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7905) == 0 { return int32(1) } - if _sqlite3StrICmp(tls, z, __ccgo_ts+7886) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7911) == 0 { return int32(1) } return 0 @@ -87280,9 +87997,9 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { var iCol, ii int32 _, _, _ = azOpt, iCol, ii azOpt = [3]uintptr{ - 0: __ccgo_ts + 7872, - 1: __ccgo_ts + 7880, - 2: __ccgo_ts + 7886, + 0: __ccgo_ts + 7897, + 1: __ccgo_ts + 7905, + 2: __ccgo_ts + 7911, } _ = libc.Int32FromInt32(0) ii = 0 @@ -87300,6 +88017,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _2 _2: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -87307,6 +88025,7 @@ func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; ii++ } return uintptr(0) @@ -87374,6 +88093,7 @@ func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) /* Not a correlated subquery */ goto _1 _1: + ; i++ } return p @@ -87535,6 +88255,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _3 _3: + ; i++ } if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -87567,7 +88288,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) eType = int32(IN_INDEX_ROWID) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VdbeJumpHere(tls, v, iAddr) } else { /* Iterator variable */ affinity_ok = int32(1) @@ -87597,6 +88318,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _6 _6: + ; i1++ } if affinity_ok != 0 { @@ -87646,6 +88368,7 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 break goto _9 _9: + ; j++ } if j == nExpr { @@ -87661,13 +88384,14 @@ func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32 } goto _8 _8: + ; i1++ } _ = libc.Int32FromInt32(0) if colUsed == libc.Uint64FromInt32(1)<= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8198, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8223, libc.VaList(bp+160, pExpr)) } else { _ = libc.Int32FromInt32(0) return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) } - case int32(TK_FUNCTION): + case int32(TK_FUNCTION): /* The function name */ constMask = uint32(0) /* Loop counter */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ @@ -89379,7 +90120,7 @@ expr_code_doover: zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8225, libc.VaList(bp+160, pExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8250, libc.VaList(bp+160, pExpr)) break } if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { @@ -89404,6 +90145,7 @@ expr_code_doover: } goto _9 _9: + ; i++ } if pFarg != 0 { @@ -89492,7 +90234,7 @@ expr_code_doover: _ = libc.Int32FromInt32(0) n1 = _sqlite3ExprVectorSize(tls, pLeft2) if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7808, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7833, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) } return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) case int32(TK_IN): @@ -89560,7 +90302,7 @@ expr_code_doover: _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) } case int32(TK_VECTOR): - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6652, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6677, 0) break /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions ** that derive from the right-hand table of a LEFT JOIN. The @@ -89621,7 +90363,7 @@ expr_code_doover: ** no ELSE term, NULL. */ fallthrough - case int32(TK_CASE): + case int32(TK_CASE): /* The X expression */ pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ pDel = uintptr(0) db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb @@ -89668,6 +90410,7 @@ expr_code_doover: _sqlite3VdbeResolveLabel(tls, v, nextCase) goto _13 _13: + ; i1 = i1 + int32(2) } if nExpr&int32(1) != 0 { @@ -89681,7 +90424,7 @@ expr_code_doover: case int32(TK_RAISE): _ = libc.Int32FromInt32(0) if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8249, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8274, 0) return 0 } if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { @@ -89745,6 +90488,7 @@ func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, r } goto _1 _1: + ; pItem += 32 i-- } @@ -89967,6 +90711,7 @@ func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, targ } goto _2 _2: + ; i++ pItem += 32 } @@ -90115,7 +90860,9 @@ func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) @@ -90132,9 +90879,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90154,7 +90903,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if op == int32(TK_IS) { v21 = int32(TK_EQ) } else { @@ -90163,11 +90914,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90182,7 +90939,9 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) @@ -90190,9 +90949,11 @@ _13: _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) goto _18 _16: + ; destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) if jumpIfNull != 0 { v22 = dest @@ -90205,7 +90966,9 @@ _16: _sqlite3VdbeResolveLabel(tls, v, destIfFalse) goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90218,6 +90981,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90320,7 +91084,9 @@ func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int3 } goto _18 _2: + ; _1: + ; pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) if pAlt != pExpr { _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) @@ -90337,9 +91103,11 @@ _1: } goto _18 _3: + ; _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) goto _18 -_4: /* IS TRUE or IS NOT TRUE */ +_4: + ; /* IS TRUE or IS NOT TRUE */ isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if isTrue^isNot != 0 { @@ -90361,7 +91129,9 @@ _4: /* IS TRUE or IS NOT TRUE */ } goto _18 _6: + ; _5: + ; if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { v21 = int32(TK_NE) } else { @@ -90370,11 +91140,17 @@ _5: op = v21 jumpIfNull = int32(SQLITE_NULLEQ) _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; _7: + ; if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { goto default_expr } @@ -90389,15 +91165,19 @@ _7: _ = libc.Int32FromInt32(0) goto _18 _14: + ; _13: + ; r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) _sqlite3VdbeTypeofColumn(tls, v, r1) _sqlite3VdbeAddOp2(tls, v, op, r1, dest) goto _18 _15: + ; _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) goto _18 _16: + ; if jumpIfNull != 0 { _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) } else { @@ -90407,7 +91187,9 @@ _16: } goto _18 _17: + ; default_expr: + ; if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { _sqlite3VdbeGoto(tls, v, dest) } else { @@ -90420,6 +91202,7 @@ default_expr: } goto _18 _18: + ; _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) } @@ -90660,6 +91443,7 @@ func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) } goto _1 _1: + ; i++ } return 0 @@ -90881,6 +91665,13 @@ func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) case int32(TK_OR): fallthrough case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) return int32(WRC_Prune) case int32(TK_IN): @@ -91086,6 +91877,7 @@ func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor goto _1 _1: + ; i++ j++ } @@ -91138,6 +91930,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } i = 0 @@ -91147,6 +91940,7 @@ func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ } if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { @@ -91330,6 +92124,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _1 _1: + ; k++ pCol += 24 } @@ -91362,6 +92157,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, } goto _2 _2: + ; j++ pTerm += 32 } @@ -91373,6 +92169,7 @@ func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) } fix_up_expr: + ; _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { @@ -91425,6 +92222,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _1 _1: + ; pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext } if pIEpr == uintptr(0) { @@ -91443,6 +92241,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _2 _2: + ; i++ } if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { @@ -91493,6 +92292,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } /* endif pExpr->iTable==pItem->iCursor */ goto _3 _3: + ; i++ pItem += 104 } /* end loop over pSrcList */ @@ -91517,6 +92317,7 @@ func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) } goto _4 _4: + ; i++ pItem1 += 32 } @@ -91629,6 +92430,7 @@ func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _1 _1: + ; i++ pItem += 32 } @@ -91762,6 +92564,7 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( } goto _1 _1: + ; i++ } } @@ -91812,8 +92615,8 @@ func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) ( func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) - if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8299, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -91832,9 +92635,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, bp := tls.Alloc(48) defer tls.Free(48) (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8327, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8352, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8502, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8527, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) } } @@ -91850,9 +92653,9 @@ func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8676, libc.VaList(bp+8, zDb, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8701, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+8823, 0) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8848, 0) } } @@ -91910,7 +92713,7 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName ** in database iDb. If so, this is an error. */ if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8974, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8999, libc.VaList(bp+8, zName)) goto exit_rename_table } /* Make sure it is not a system table being altered, or a reserved name @@ -91919,11 +92722,11 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { goto exit_rename_table } - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9033, zName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9058, zName) { goto exit_rename_table } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9064, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table } /* Invoke the authorization callback. */ @@ -91953,21 +92756,21 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9066, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9091, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9250, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9275, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if _sqlite3FindTable(tls, db, __ccgo_ts+9555, zDb) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9571, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if _sqlite3FindTable(tls, db, __ccgo_ts+9580, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9596, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if iDb != int32(1) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9629, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9654, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names @@ -91983,8 +92786,9 @@ func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) } _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9894, 0) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9919, 0) exit_rename_table: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zName) } @@ -91998,7 +92802,7 @@ exit_rename_table: func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+9907, libc.VaList(bp+8, zErr, zDb, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9932, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation @@ -92043,11 +92847,11 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** column must not be NULL. */ if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9970, 0) return } if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9977, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10002, 0) return } if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { @@ -92065,10 +92869,10 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10004) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10029) } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10063) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10088) } /* Ensure the default expression is something that sqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) @@ -92082,13 +92886,13 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr return } if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10116) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10141) } _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) } } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { - _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10162) + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10187) } } /* Modify the CREATE TABLE statement. */ @@ -92104,7 +92908,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr ** have to use printf() to translate between these units: */ _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10189, libc.VaList(bp+16, zDb, (*(*struct { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10214, libc.VaList(bp+16, zDb, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr @@ -92132,7 +92936,7 @@ func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) /* Verify that constraints are still satisfied */ if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10335, libc.VaList(bp+16, zTab, zDb)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10360, libc.VaList(bp+16, zTab, zDb)) } } } @@ -92172,12 +92976,12 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { goto exit_begin_add_column } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10688, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10713, 0) goto exit_begin_add_column } /* Make sure this is not an attempt to ALTER a view. */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10722, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10747, 0) goto exit_begin_add_column } if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { @@ -92205,7 +93009,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) _ = libc.Int32FromInt32(0) (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) - (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10752, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10777, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { _ = libc.Int32FromInt32(0) goto exit_begin_add_column @@ -92221,6 +93025,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -92245,6 +93050,7 @@ func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { })(unsafe.Pointer(pTab + 64))).FaddColOffset _ = libc.Int32FromInt32(0) exit_begin_add_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) return } @@ -92266,18 +93072,18 @@ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r i _, _ = zType, v1 zType = uintptr(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 10776 + zType = __ccgo_ts + 10801 } if zType != 0 { if bDrop != 0 { - v1 = __ccgo_ts + 10790 + v1 = __ccgo_ts + 10815 } else { - v1 = __ccgo_ts + 10807 + v1 = __ccgo_ts + 10832 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10825, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10850, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -92335,10 +93141,11 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pOld)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pOld)) goto exit_rename_column } /* Ensure the schema contains no double-quoted strings */ @@ -92355,12 +93162,13 @@ func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld } _ = libc.Int32FromInt32(0) bQuote = int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz))]) & int32(0x80) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+10864, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11046, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10889, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11071, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9894, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9919, int32(1)) exit_rename_column: + ; _sqlite3SrcListDelete(tls, db, pSrc) _sqlite3DbFree(tls, db, zOld) _sqlite3DbFree(tls, db, zNew) @@ -92469,6 +93277,7 @@ func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom } goto _1 _1: + ; p = (*TRenameToken)(unsafe.Pointer(p)).FpNext } } @@ -92534,6 +93343,7 @@ func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) goto _1 _1: + ; i++ } if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { @@ -92559,6 +93369,7 @@ func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) goto _1 _1: + ; ii++ } } @@ -92591,6 +93402,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } } @@ -92609,6 +93421,7 @@ func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -92664,6 +93477,7 @@ func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) } goto _1 _1: + ; i++ } } @@ -92686,6 +93500,7 @@ func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { _sqlite3DbFree(tls, db, p) goto _1 _1: + ; p = pNext } } @@ -92724,6 +93539,7 @@ func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } return uintptr(0) @@ -92794,6 +93610,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _1 _1: + ; pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext } pp = pCtx @@ -92803,6 +93620,7 @@ func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext @@ -92826,11 +93644,11 @@ func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType u zT = Xsqlite3_value_text(tls, pType) zN = Xsqlite3_value_text(tls, pObject) if *(*uint8)(unsafe.Pointer(zWhen)) != 0 { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11179, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11204, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) } @@ -92859,6 +93677,7 @@ func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList } goto _1 _1: + ; i++ } } @@ -92887,6 +93706,7 @@ func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdLi } goto _1 _1: + ; i++ } } @@ -92905,8 +93725,8 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin if zSql == uintptr(0) { return int32(SQLITE_NOMEM) } - if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11202, int32(7)) != 0 { - return _sqlite3CorruptError(tls, int32(116507)) + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11227, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) } if bTemp != 0 { v1 = int32(1) @@ -92922,7 +93742,7 @@ func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uin rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { - rc = _sqlite3CorruptError(tls, int32(116518)) + rc = _sqlite3CorruptError(tls, int32(116693)) } (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) return rc @@ -92961,7 +93781,7 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11210, libc.VaList(bp+8, zNew)) + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11235, libc.VaList(bp+8, zNew)) if zQuot == uintptr(0) { return int32(SQLITE_NOMEM) } else { @@ -93007,11 +93827,11 @@ func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, *(*uint8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = uint8(0) _sqlite3Dequote(tls, zBuf1) if int32(*(*uint8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { - v1 = __ccgo_ts + 11177 + v1 = __ccgo_ts + 11202 } else { v1 = __ccgo_ts + 1648 } - Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11216, libc.VaList(bp+8, zBuf1, v1)) + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11241, libc.VaList(bp+8, zBuf1, v1)) zReplace = zBuf2 nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) } @@ -93051,6 +93871,7 @@ func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) goto _1 _1: + ; i++ } } @@ -93145,6 +93966,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _3 _3: + ; i++ } } @@ -93185,6 +94007,7 @@ func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return rc @@ -93227,11 +94050,13 @@ func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) goto _2 _2: + ; i++ } } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93390,6 +94215,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex @@ -93400,6 +94226,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } i = 0 @@ -93411,6 +94238,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _sqlite3WalkExpr(tls, bp+456, pExpr) goto _5 _5: + ; i++ } } @@ -93437,10 +94265,12 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _7 _7: + ; i++ } goto _6 _6: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93472,6 +94302,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp } goto _8 _8: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } /* Find tokens to edit in UPDATE OF clause */ @@ -93485,6 +94316,7 @@ func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintp _ = libc.Int32FromInt32(0) rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) renameColumnFunc_done: + ; if rc != SQLITE_OK { if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) @@ -93546,6 +94378,7 @@ func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r in } goto _1 _1: + ; i++ } _renameWalkWith(tls, pWalker, pSelect) @@ -93646,6 +94479,7 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } @@ -93695,11 +94529,13 @@ func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintpt } goto _3 _3: + ; i++ } } goto _2 _2: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -93819,6 +94655,7 @@ func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uin _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) goto _2 _2: + ; i++ } } @@ -93976,7 +94813,7 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ - rc = _sqlite3CorruptError(tls, int32(117477)) + rc = _sqlite3CorruptError(tls, int32(117652)) goto drop_column_done } pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) @@ -93994,10 +94831,11 @@ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- } } - zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11221, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11246, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) drop_column_done: + ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { @@ -94049,23 +94887,23 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } iCol = _sqlite3ColumnIndex(tls, pTab, zCol) if iCol < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10843, libc.VaList(bp+8, pName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10868, libc.VaList(bp+8, pName)) goto exit_drop_column } /* Do not allow the user to drop a PRIMARY KEY column or a column ** constrained by a UNIQUE constraint. */ if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { - v1 = __ccgo_ts + 11228 + v1 = __ccgo_ts + 11253 } else { - v1 = __ccgo_ts + 5564 + v1 = __ccgo_ts + 5589 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11240, libc.VaList(bp+8, v1, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11265, libc.VaList(bp+8, v1, zCol)) goto exit_drop_column } /* Do not allow the number of columns to go to zero */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11268, libc.VaList(bp+8, zCol)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11293, libc.VaList(bp+8, zCol)) goto exit_drop_column } /* Edit the sqlite_schema table */ @@ -94078,10 +94916,10 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1648, 0) _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11316, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11341, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) /* Drop and reload the database schema. */ _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11437, int32(1)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11462, int32(1)) /* Edit rows of table on disk */ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { pPk = uintptr(0) @@ -94111,6 +94949,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) goto _6 _6: + ; i++ } nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) @@ -94144,6 +94983,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName } goto _9 _9: + ; i++ } if nField == 0 { @@ -94163,6 +95003,7 @@ func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName _sqlite3VdbeJumpHere(tls, v, addr) } exit_drop_column: + ; _sqlite3DbFree(tls, db, zCol) _sqlite3SrcListDelete(tls, db, pSrc) } @@ -94180,27 +95021,27 @@ var _aAlterTableFuncs = [5]TFuncDef{ 0: { FnArg: int8(9), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11455, + FzName: __ccgo_ts + 11480, }, 1: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11476, + FzName: __ccgo_ts + 11501, }, 2: { FnArg: int8(7), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11496, + FzName: __ccgo_ts + 11521, }, 3: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11515, + FzName: __ccgo_ts + 11540, }, 4: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), - FzName: __ccgo_ts + 11534, + FzName: __ccgo_ts + 11559, }, } @@ -94413,7 +95254,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11637, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11662, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) aCreateTbl[i] = uint8(OPFLAG_P2ISREG) } @@ -94424,10 +95265,10 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) if zWhere != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else { if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11690, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11715, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { /* The sqlite_stat[134] table already exists. Delete all rows. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) @@ -94436,6 +95277,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW } goto _2 _2: + ; i++ } /* Open the sqlite_stat[134] tables for writing. */ @@ -94449,6 +95291,7 @@ func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zW _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) goto _4 _4: + ; i++ } } @@ -94458,15 +95301,15 @@ var _aTable = [3]struct { FzCols uintptr }{ 0: { - FzName: __ccgo_ts + 11557, - FzCols: __ccgo_ts + 11570, + FzName: __ccgo_ts + 11582, + FzCols: __ccgo_ts + 11595, }, 1: { - FzName: __ccgo_ts + 11583, - FzCols: __ccgo_ts + 11596, + FzName: __ccgo_ts + 11608, + FzCols: __ccgo_ts + 11621, }, 2: { - FzName: __ccgo_ts + 11624, + FzName: __ccgo_ts + 11649, }, } @@ -94638,6 +95481,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) goto _1 _1: + ; i++ } i = 0 @@ -94648,6 +95492,7 @@ func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) goto _2 _2: + ; i++ } _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) @@ -94747,6 +95592,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -94758,6 +95604,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i goto _4 _4: + ; i++ } } @@ -94771,7 +95618,7 @@ func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statInitFuncdef = TFuncDef{ FnArg: int8(4), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11708, + FzName: __ccgo_ts + 11733, } func init() { @@ -94810,6 +95657,7 @@ func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintp } goto _1 _1: + ; i++ } if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { @@ -94890,6 +95738,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { } goto _1 _1: + ; i-- } if pUpgrade != 0 { @@ -94924,6 +95773,7 @@ func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* Zero the first nEqZero entries in the anEq[] array. */ libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero)) find_new_min: + ; if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { iMin = -int32(1) i = 0 @@ -94939,6 +95789,7 @@ find_new_min: } goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -94972,6 +95823,7 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _1 _1: + ; i-- } /* Check that no sample contains an anEq[] entry with an index of @@ -94989,10 +95841,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; j++ } goto _2 _2: + ; i-- } /* Update the anEq[] fields of any samples already collected. */ @@ -95012,10 +95866,12 @@ func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { } goto _5 _5: + ; j1++ } goto _4 _4: + ; i-- } (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng @@ -95066,6 +95922,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _1 _1: + ; i++ } } else { @@ -95083,6 +95940,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ goto _2 _2: + ; i++ } i = iChng @@ -95097,6 +95955,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) goto _3 _3: + ; i++ } } @@ -95130,6 +95989,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _5 _5: + ; i++ } } else { @@ -95143,7 +96003,7 @@ func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statPushFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11718, + FzName: __ccgo_ts + 11743, } func init() { @@ -95196,7 +96056,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11728, libc.VaList(bp+72, v1)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11753, libc.VaList(bp+72, v1)) i = 0 for { if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { @@ -95207,10 +96067,11 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { iVal = uint64(1) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11733, libc.VaList(bp+72, iVal)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11758, libc.VaList(bp+72, iVal)) _ = libc.Int32FromInt32(0) goto _2 _2: + ; i++ } _sqlite3ResultStrAccum(tls, context, bp) @@ -95247,9 +96108,10 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { break } - Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11739, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11764, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) goto _3 _3: + ; i1++ } if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { @@ -95264,7 +96126,7 @@ func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var _statGetFuncdef = TFuncDef{ FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 11745, + FzName: __ccgo_ts + 11770, } func init() { @@ -95332,7 +96194,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Do not gather statistics on views or virtual tables */ return } - if Xsqlite3_strlike(tls, __ccgo_ts+11754, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, __ccgo_ts+11779, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } @@ -95349,7 +96211,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 - libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11557, uint64(13)) + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11582, uint64(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) @@ -95506,6 +96368,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) @@ -95527,6 +96390,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: + ; i++ } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) @@ -95556,6 +96420,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: + ; j++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) @@ -95578,7 +96443,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint /* Add the entry to the stat1 table. */ _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) @@ -95615,6 +96480,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint } goto _19 _19: + ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ @@ -95639,6 +96505,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) @@ -95652,6 +96519,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint _sqlite3VdbeJumpHere(tls, v, addrRewind) goto _13 _13: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index @@ -95662,7 +96530,7 @@ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uint jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) _ = libc.Int32FromInt32(0) - _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11764, 0) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11789, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -95714,6 +96582,7 @@ func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } _loadAnalysis(tls, pParse, iDb) @@ -95736,9 +96605,9 @@ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) if pOnlyIdx != 0 { - _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11768) + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11793) } else { - _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11772) + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11797) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) @@ -95787,6 +96656,7 @@ func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp _analyzeDatabase(tls, pParse, i) goto _1 _1: + ; i++ } } else { @@ -95896,23 +96766,24 @@ func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, } goto _1 _1: + ; i++ } if pIndex != 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) for *(*uint8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, __ccgo_ts+11776, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11801, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11787, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11812, z) == 0 { sz = _sqlite3Atoi(tls, z+uintptr(3)) if sz < int32(2) { sz = int32(2) } (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) } else { - if Xsqlite3_strglob(tls, __ccgo_ts+11797, z) == 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11822, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) } } @@ -96026,6 +96897,7 @@ func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) goto _1 _1: + ; j++ } _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) @@ -96093,6 +96965,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { } goto _2 _2: + ; i++ } if nDist100 > nSum100 && sumEq < nRow { @@ -96104,6 +96977,7 @@ func _initAvgEq(tls *libc.TLS, pIdx uintptr) { *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq goto _1 _1: + ; iCol++ } } @@ -96210,6 +97084,7 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u pSpace += uintptr(nIdxCol) * 8 goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -96292,11 +97167,11 @@ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { rc = SQLITE_OK _ = libc.Int32FromInt32(0) if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { - v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11583, zDb) + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11608, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { - rc = _loadStatTbl(tls, db, __ccgo_ts+11809, __ccgo_ts+11878, zDb) + rc = _loadStatTbl(tls, db, __ccgo_ts+11834, __ccgo_ts+11903, zDb) } return rc } @@ -96345,6 +97220,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst @@ -96358,15 +97234,16 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) goto _2 _2: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load new statistics out of the sqlite_stat1 table */ (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName - v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11557, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11582, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) pStat1 = v3 if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11930, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11955, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -96387,6 +97264,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { } goto _4 _4: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } /* Load the statistics from the sqlite_stat4 table. */ @@ -96412,6 +97290,7 @@ func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) goto _6 _6: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } if rc == int32(SQLITE_NOMEM) { @@ -96478,7 +97357,7 @@ func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { // ** database iDb attached to handle db. // */ func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { - return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6560, zName) == 0) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6585, zName) == 0) } // C documentation @@ -96534,7 +97413,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { return } - rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11971, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+11996, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) if rc == SQLITE_OK { pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) if pNewSchema != 0 { @@ -96565,7 +97444,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** * Specified database name already being used. */ if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11974, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+11999, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) goto attach_error } i = 0 @@ -96575,11 +97454,12 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } _ = libc.Int32FromInt32(0) if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12011, libc.VaList(bp+56, zName)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12036, libc.VaList(bp+56, zName)) goto attach_error } goto _1 _1: + ; i++ } /* Allocate the new entry in the db->aDb[] array and initialize the schema @@ -96623,7 +97503,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) if rc == int32(SQLITE_CONSTRAINT) { rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12041, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12066, 0) } else { if rc == SQLITE_OK { (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) @@ -96631,7 +97511,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { rc = int32(SQLITE_NOMEM) } else { if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12070, 0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12095, 0) rc = int32(SQLITE_ERROR) } } @@ -96680,7 +97560,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+1618, 0) } else { if *(*uintptr)(unsafe.Pointer(bp + 24)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12138, libc.VaList(bp+56, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12163, libc.VaList(bp+56, zFile)) } } } @@ -96688,6 +97568,7 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } return attach_error: + ; /* Return an error if we get here */ if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 24)), -int32(1)) @@ -96736,18 +97617,19 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12166, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12191, libc.VaList(bp+136, zName)) goto detach_error } if i < int32(2) { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12187, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12212, libc.VaList(bp+136, zName)) goto detach_error } if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { - Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12213, libc.VaList(bp+136, zName)) + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12238, libc.VaList(bp+136, zName)) goto detach_error } /* If any TEMP triggers reference the schema being detached, move those @@ -96767,6 +97649,7 @@ func _detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { _sqlite3CollapseDatabaseArray(tls, db) return detach_error: + ; Xsqlite3_result_error(tls, context, bp, -int32(1)) } @@ -96822,6 +97705,7 @@ func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAut _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) } attach_end: + ; _sqlite3ExprDelete(tls, db, pFilename) _sqlite3ExprDelete(tls, db, pDbname) _sqlite3ExprDelete(tls, db, pKey) @@ -96841,7 +97725,7 @@ func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { var _detach_func = TFuncDef{ FnArg: int8(1), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12235, + FzName: __ccgo_ts + 12260, } func init() { @@ -96863,7 +97747,7 @@ func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, p var _attach_func = TFuncDef{ FnArg: int8(3), FfuncFlags: uint32(SQLITE_UTF8), - FzName: __ccgo_ts + 12249, + FzName: __ccgo_ts + 12274, } func init() { @@ -96889,7 +97773,7 @@ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12263, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12288, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } @@ -96923,7 +97807,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { - _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12287, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12312, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) @@ -96938,6 +97822,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _1 _1: + ; i++ pItem += 104 } @@ -96952,6 +97837,7 @@ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -97040,6 +97926,7 @@ func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32 } goto _1 _1: + ; pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert } pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext @@ -97137,7 +98024,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12333, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12358, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } @@ -97165,11 +98052,11 @@ func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12356, libc.VaList(bp+8, zTab, zCol)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12381, libc.VaList(bp+8, zTab, zCol)) if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { - z = Xsqlite3_mprintf(tls, __ccgo_ts+12362, libc.VaList(bp+8, zDb, z)) + z = Xsqlite3_mprintf(tls, __ccgo_ts+12387, libc.VaList(bp+8, zDb, z)) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12368, libc.VaList(bp+8, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12393, libc.VaList(bp+8, z)) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { @@ -97219,6 +98106,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint } goto _1 _1: + ; iSrc++ } } @@ -97234,7 +98122,7 @@ func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName } else { - zCol = __ccgo_ts + 7880 + zCol = __ccgo_ts + 7905 } } _ = libc.Int32FromInt32(0) @@ -97271,7 +98159,7 @@ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12420, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { @@ -97385,6 +98273,7 @@ func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLoc } goto _2 _2: + ; i++ } nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) @@ -97436,6 +98325,7 @@ func _codeTableLocks(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) goto _1 _1: + ; i++ } } @@ -97505,6 +98395,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) goto _1 _1: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) @@ -97535,6 +98426,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { } goto _3 _3: + ; iDb++ v2 = iDb if !(v2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { @@ -97550,6 +98442,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3VdbeAddOp4(tls, v, int32(OP_VBegin), 0, 0, 0, vtab, -int32(11)) goto _4 _4: + ; i++ } (*TParse)(unsafe.Pointer(pParse)).FnVtabLock = 0 @@ -97579,6 +98472,7 @@ func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEL + 8 + uintptr(i)*32))).FpExpr, *(*int32)(unsafe.Pointer(pEL + 8 + uintptr(i)*32 + 24))) goto _5 _5: + ; i++ } } @@ -97694,26 +98588,27 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _1 _1: + ; i++ } if i >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { /* No match against the official names. But always match "main" ** to schema 0 as a legacy fallback. */ - if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6560) == 0 { + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6585) == 0 { i = 0 } else { return uintptr(0) } } p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { if i == int32(1) { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6533) } } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6041) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6066) } } } @@ -97741,14 +98636,15 @@ func _sqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp } goto _2 _2: + ; i++ } - if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6546+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6041) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6571+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6066) } else { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6527+7) == 0 { - p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6508) + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6552+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6533) } } } @@ -97786,7 +98682,7 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt ** can be an eponymous virtual table. */ if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { pMod = _sqlite3HashFind(tls, db+576, zName) - if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12410, int32(7)) == 0 { + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12435, int32(7)) == 0 { pMod = _sqlite3PragmaVtabRegister(tls, db, zName) } if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { @@ -97804,15 +98700,15 @@ func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintpt } if p == uintptr(0) { if flags&uint32(LOCATE_VIEW) != 0 { - v1 = __ccgo_ts + 12418 + v1 = __ccgo_ts + 12443 } else { - v1 = __ccgo_ts + 12431 + v1 = __ccgo_ts + 12456 } zMsg = v1 if zDbase != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6764, libc.VaList(bp+8, zMsg, zDbase, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6789, libc.VaList(bp+8, zMsg, zDbase, zName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6774, libc.VaList(bp+8, zMsg, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6799, libc.VaList(bp+8, zMsg, zName)) } } else { _ = libc.Int32FromInt32(0) @@ -97852,12 +98748,12 @@ func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintpt // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { - if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) == 0 { - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6041+7) == 0 { - return __ccgo_ts + 6546 + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6066+7) == 0 { + return __ccgo_ts + 6571 } - if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6508+7) == 0 { - return __ccgo_ts + 6527 + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6533+7) == 0 { + return __ccgo_ts + 6552 } } return zName @@ -97907,6 +98803,7 @@ func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r } goto _1 _1: + ; i++ } return p @@ -97995,6 +98892,7 @@ func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { j++ goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j @@ -98036,6 +98934,7 @@ func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { } goto _3 _3: + ; i++ } } @@ -98068,6 +98967,7 @@ func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) @@ -98228,6 +99128,7 @@ func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) goto _2 _2: + ; i++ pCol += 16 } @@ -98290,6 +99191,7 @@ func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { _sqlite3FreeIndex(tls, db, pIndex) goto _1 _1: + ; pIndex = pNext } if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { @@ -98397,7 +99299,7 @@ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) - _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6041) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6066) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) @@ -98429,11 +99331,12 @@ func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { } /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6560, zName) { + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6585, zName) { break } goto _1 _1: + ; i-- pDb -= 32 } @@ -98487,13 +99390,13 @@ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12445, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12470, 0) return -int32(1) } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12462, libc.VaList(bp+8, pName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12487, libc.VaList(bp+8, pName1)) return -int32(1) } } else { @@ -98542,8 +99445,8 @@ func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType return int32(SQLITE_ERROR) } } else { - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6500, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12482, libc.VaList(bp+8, zName)) + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6525, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12507, libc.VaList(bp+8, zName)) return int32(SQLITE_ERROR) } } @@ -98565,6 +99468,7 @@ func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return p @@ -98591,6 +99495,7 @@ func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) } goto _1 _1: + ; i++ } return int16(-int32(1)) @@ -98623,6 +99528,7 @@ func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } } @@ -98686,6 +99592,7 @@ func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti1 } goto _1 _1: + ; i++ } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { @@ -98755,9 +99662,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zName = _sqlite3DbStrDup(tls, db, v1) *(*uintptr)(unsafe.Pointer(bp)) = pName1 @@ -98770,7 +99677,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12524, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12549, 0) return } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { @@ -98786,9 +99693,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return } if isView != 0 { - v2 = __ccgo_ts + 10771 + v2 = __ccgo_ts + 10796 } else { - v2 = __ccgo_ts + 9033 + v2 = __ccgo_ts + 9058 } if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { goto begin_table_error @@ -98800,9 +99707,9 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui _ = libc.Int32FromInt32(0) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto begin_table_error @@ -98826,11 +99733,11 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui if pTable != 0 { if !(noErr != 0) { if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { - v4 = __ccgo_ts + 10771 + v4 = __ccgo_ts + 10796 } else { - v4 = __ccgo_ts + 9033 + v4 = __ccgo_ts + 9058 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12565, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12590, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -98839,7 +99746,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui goto begin_table_error } if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12586, libc.VaList(bp+16, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12611, libc.VaList(bp+16, zName)) goto begin_table_error } } @@ -98932,6 +99839,7 @@ func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui return /* If an error occurs, we jump here */ begin_table_error: + ; (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) _sqlite3DbFree(tls, db, zName) return @@ -98993,7 +99901,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { _, _, _ = db, pHash, pRet db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12621, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12646, 0) } else { _ = libc.Int32FromInt32(0) } @@ -99010,7 +99918,7 @@ func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12655, libc.VaList(bp+8, pParse)) + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12680, libc.VaList(bp+8, pParse)) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) @@ -99058,7 +99966,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok return } if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) return } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -99068,12 +99976,12 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok ** by the parser, we can sometimes end up with a typename that ends ** with "generated always". Check for this case and omit the surplus ** text. */ - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12698, int32(6)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12723, int32(6)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- } - if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12705, int32(9)) == 0 { + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12730, int32(9)) == 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1))))])&int32(0x01) != 0 { (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- @@ -99101,6 +100009,7 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok } goto _2 _2: + ; i++ } } @@ -99121,12 +100030,13 @@ func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TTok break } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12715, libc.VaList(bp+40, z)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12740, libc.VaList(bp+40, z)) _sqlite3DbFree(tls, db, z) return } goto _3 _3: + ; i++ } aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) @@ -99191,6 +100101,7 @@ func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99329,10 +100240,10 @@ func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12741, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12766, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } else { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12786, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12811, 0) } else { libc.Xmemset(tls, bp, 0, uint64(72)) (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) @@ -99390,7 +100301,7 @@ func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { p1 = pCol + 14 *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12827, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12852, 0) } } @@ -99427,7 +100338,7 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError goto primary_key_exit } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12879, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12904, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) @@ -99461,11 +100372,13 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError } goto _2 _2: + ; iCol++ } } goto _1 _1: + ; i++ } } @@ -99484,13 +100397,14 @@ func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError _sqlite3HasExplicitNulls(tls, pParse, pList) } else { if autoInc != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12945, 0) } else { _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) pList = uintptr(0) } } primary_key_exit: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) return } @@ -99520,6 +100434,7 @@ func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintpt } goto _1 _1: + ; zStart++ } for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1))))])&int32(0x01) != 0 { @@ -99572,6 +100487,7 @@ func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -99597,17 +100513,17 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui } pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12976, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13001, 0) goto generated_done } if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { goto generated_error } if pType != 0 { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13019, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13044, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { /* no-op */ } else { - if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13027, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13052, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { eType = uint8(COLFLAG_STORED) } else { goto generated_error @@ -99639,8 +100555,10 @@ func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType ui pExpr = uintptr(0) goto generated_done generated_error: - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13034, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13059, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) generated_done: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) } @@ -99697,6 +100615,7 @@ func _identLength(tls *libc.TLS, z uintptr) (r int32) { } goto _1 _1: + ; n++ z++ } @@ -99734,6 +100653,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _1 _1: + ; j++ } needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) @@ -99757,6 +100677,7 @@ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { } goto _3 _3: + ; j++ } if needQuote != 0 { @@ -99792,18 +100713,19 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) goto _1 _1: + ; i++ pCol += 16 } n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) if n < int32(50) { zSep = __ccgo_ts + 1648 - zSep2 = __ccgo_ts + 13065 - zEnd = __ccgo_ts + 5081 + zSep2 = __ccgo_ts + 13090 + zEnd = __ccgo_ts + 5106 } else { - zSep = __ccgo_ts + 13067 - zSep2 = __ccgo_ts + 13071 - zEnd = __ccgo_ts + 13076 + zSep = __ccgo_ts + 13092 + zSep2 = __ccgo_ts + 13096 + zEnd = __ccgo_ts + 13101 } n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -99811,7 +100733,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _sqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13079, 0) + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13104, 0) *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) v2 = *(*int32)(unsafe.Pointer(bp)) @@ -99837,6 +100759,7 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ pCol += 16 } @@ -99846,11 +100769,11 @@ func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1648, - 1: __ccgo_ts + 13093, - 2: __ccgo_ts + 13099, - 3: __ccgo_ts + 13104, - 4: __ccgo_ts + 13109, - 5: __ccgo_ts + 13099, + 1: __ccgo_ts + 13118, + 2: __ccgo_ts + 13124, + 3: __ccgo_ts + 13129, + 4: __ccgo_ts + 13134, + 5: __ccgo_ts + 13124, } // C documentation @@ -99908,6 +100831,7 @@ func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) goto _1 _1: + ; i-- pTabCol += 16 } @@ -99945,6 +100869,7 @@ func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { wIndex += uint32(v2) goto _1 _1: + ; i++ } (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) @@ -100011,6 +100936,7 @@ func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int } goto _1 _1: + ; i++ } return 0 @@ -100057,6 +100983,7 @@ func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { } goto _1 _1: + ; j-- } (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m @@ -100112,6 +101039,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; i++ } *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) @@ -100174,6 +101102,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) @@ -100219,6 +101148,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _7 _7: + ; i++ } if n == 0 { @@ -100246,12 +101176,14 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Add all table columns to the PRIMARY KEY index @@ -100267,6 +101199,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _10 _10: + ; i++ } if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { @@ -100286,6 +101219,7 @@ func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _11 _11: + ; i++ } _ = libc.Int32FromInt32(0) @@ -100380,6 +101314,7 @@ func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -100492,9 +101427,9 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13115, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13140, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648))) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13148, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13173, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) } return } else { @@ -100508,6 +101443,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _1 _1: + ; ii++ } } @@ -100516,11 +101452,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr /* Special processing for WITHOUT ROWID Tables */ if tabOpts&uint32(TF_WithoutRowid) != 0 { if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13175, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13200, 0) return } if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13225, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13250, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) return } *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) @@ -100563,10 +101499,11 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } goto _2 _2: + ; ii1++ } if nNG == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13257, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13282, 0) return } } @@ -100580,6 +101517,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr _estimateIndexWidth(tls, pIdx) goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* If not initializing, then create a record for the new table @@ -100599,12 +101537,12 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr */ if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { /* A regular table */ - zType = __ccgo_ts + 9033 - zType2 = __ccgo_ts + 13301 + zType = __ccgo_ts + 9058 + zType2 = __ccgo_ts + 13326 } else { /* A view */ - zType = __ccgo_ts + 10771 - zType2 = __ccgo_ts + 13307 + zType = __ccgo_ts + 10796 + zType2 = __ccgo_ts + 13332 } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the @@ -100689,13 +101627,13 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if int32(*(*uint8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13312, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13337, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13327, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13352, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) _sqlite3DbFree(tls, db, zStmt) _sqlite3ChangeCookie(tls, pParse, iDb) /* Check to see if we need to create an sqlite_sequence table for @@ -100705,17 +101643,17 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 _ = libc.Int32FromInt32(0) if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13425, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13450, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) } } /* Reparse everything to update our internal data structures */ - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13467, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13492, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) /* Test for cycles in generated columns and illegal expressions ** in CHECK constraints and in DEFAULT clauses. */ if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13501, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13526, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13522, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13547, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) } /* Add the table to the in-memory representation of the database. */ @@ -100735,7 +101673,7 @@ func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ _ = libc.Int32FromInt32(0) - if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9555) == 0 { + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9580) == 0 { _ = libc.Int32FromInt32(0) (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -100770,7 +101708,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13554, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13579, 0) goto create_view_fail } _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) @@ -100782,11 +101720,12 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ - *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) - _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10771, *(*uintptr)(unsafe.Pointer(bp + 112))) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10796, *(*uintptr)(unsafe.Pointer(bp + 112))) if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { goto create_view_fail } @@ -100831,6 +101770,7 @@ func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui /* Use sqlite3EndTable() to add the view to the schema table */ _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) create_view_fail: + ; _sqlite3SelectDelete(tls, db, pSelect) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) @@ -100884,7 +101824,7 @@ func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32 ** SELECT * FROM temp.ex1; */ if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13590, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13615, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) return int32(1) } _ = libc.Int32FromInt32(0) @@ -100996,6 +101936,7 @@ func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { } goto _1 _1: + ; i = (*THashElem)(unsafe.Pointer(i)).Fnext } p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 @@ -101038,6 +101979,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _1 _1: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 @@ -101052,6 +101994,7 @@ func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iT } goto _2 _2: + ; pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext } } @@ -101073,7 +102016,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13620, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13645, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) @@ -101086,7 +102029,7 @@ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13635, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13660, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } @@ -101138,6 +102081,7 @@ func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if iLargest == uint32(0) { @@ -101170,12 +102114,13 @@ func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uin if !(i <= int32(4)) { break } - Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13702, libc.VaList(bp+32, i)) + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13727, libc.VaList(bp+32, i)) if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+11660, libc.VaList(bp+32, zDbName, bp, zType, zName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11685, libc.VaList(bp+32, zDbName, bp, zType, zName)) } goto _1 _1: + ; i++ } } @@ -101214,7 +102159,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** move as a result of the drop (can happen in auto-vacuum mode). */ if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13716, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13741, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) } /* Drop all entries in the schema table that refer to the ** table. The program name loops through the schema table and deletes @@ -101223,7 +102168,7 @@ func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 ** created in the temp database that refers to a table in another ** database. */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+13761, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13786, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { _destroyTable(tls, pParse, pTab) } @@ -101258,11 +102203,11 @@ func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3418, int32(4)) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7241, int32(10)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7266, int32(10)) == 0 { return 0 } return int32(1) @@ -101321,9 +102266,9 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName @@ -101356,18 +102301,18 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 goto exit_drop_table } if _tableMayNotBeDropped(tls, db, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13828, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13853, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13856, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13881, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13890, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13915, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table } /* Generate code to remove the table from the schema table @@ -101377,12 +102322,13 @@ func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int3 if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) if !(isView != 0) { - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11772, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11797, (*TTable)(unsafe.Pointer(pTab)).FzName) _sqlite3FkDropTable(tls, pParse, pName, pTab) } _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) } exit_drop_table: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -101424,13 +102370,13 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p goto fk_end } if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13922, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13947, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) goto fk_end } nCol = int32(1) } else { if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13985, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14010, 0) goto fk_end } else { nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr @@ -101446,6 +102392,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) goto _1 _1: + ; i++ } } @@ -101489,10 +102436,11 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _3 _3: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14079, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14104, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) goto fk_end } if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { @@ -101500,6 +102448,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p } goto _2 _2: + ; i++ } } @@ -101519,6 +102468,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p z += uintptr(n + int32(1)) goto _4 _4: + ; i++ } } @@ -101546,6 +102496,7 @@ func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, p })(unsafe.Pointer(p + 64))).FpFKey = pFKey pFKey = uintptr(0) fk_end: + ; _sqlite3DbFree(tls, db, pFKey) _sqlite3ExprListDelete(tls, db, pFromCol) _sqlite3ExprListDelete(tls, db, pToCol) @@ -101752,15 +102703,16 @@ func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r i if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags if int32(sf) == 0 || int32(sf) == int32(3) { - v2 = __ccgo_ts + 14125 + v2 = __ccgo_ts + 14150 } else { - v2 = __ccgo_ts + 14131 + v2 = __ccgo_ts + 14156 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14136, libc.VaList(bp+8, v2)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14161, libc.VaList(bp+8, v2)) return int32(1) } goto _1 _1: + ; i++ } } @@ -101837,7 +102789,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u iDb = int32(1) } } - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14164, *(*uintptr)(unsafe.Pointer(bp + 96))) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14189, *(*uintptr)(unsafe.Pointer(bp + 96))) if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { /* Because the parser constructs pTblName from a single identifier, ** sqlite3FixSrcList can never fail. */ @@ -101849,7 +102801,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14170, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14195, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { @@ -101866,16 +102818,16 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 _ = libc.Int32FromInt32(0) - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14220, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14245, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14248, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) goto exit_create_index } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14273, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14298, 0) goto exit_create_index } /* @@ -101897,19 +102849,19 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u goto exit_create_index } _ = libc.Int32FromInt32(0) - if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14164, (*TTable)(unsafe.Pointer(pTab)).FzName) { + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14189, (*TTable)(unsafe.Pointer(pTab)).FzName) { goto exit_create_index } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14307, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14332, libc.VaList(bp+136, zName)) goto exit_create_index } } if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { if !(ifNotExist != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14341, libc.VaList(bp+136, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14366, libc.VaList(bp+136, zName)) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -101927,10 +102879,11 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _1 _1: + ; pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext n++ } - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14365, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14390, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) if zName == uintptr(0) { goto exit_create_index } @@ -101948,9 +102901,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { goto exit_create_index @@ -101979,7 +102932,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u _ = libc.Int32FromInt32(0) _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) } else { - _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14164) + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14189) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { goto exit_create_index } @@ -102000,6 +102953,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _4 _4: + ; i++ } /* @@ -102068,7 +103022,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14388, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14413, 0) goto exit_create_index } if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { @@ -102121,6 +103075,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) goto _6 _6: + ; i++ pListItem += 32 } @@ -102146,6 +103101,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _7 _7: + ; j++ } _ = libc.Int32FromInt32(0) @@ -102178,6 +103134,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u break goto _8 _8: + ; j++ } } @@ -102209,6 +103166,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _10 _10: + ; k++ } if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -102221,7 +103179,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u ** explicitly specified behavior for the index. */ if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14449, libc.VaList(bp+136, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14474, libc.VaList(bp+136, 0)) } if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError @@ -102239,6 +103197,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -102253,8 +103212,8 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != uintptr(0) { (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14491, 0) - (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(124945)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14516, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) goto exit_create_index } } @@ -102297,9 +103256,9 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if onError == OE_None { v13 = __ccgo_ts + 1648 } else { - v13 = __ccgo_ts + 14508 + v13 = __ccgo_ts + 14533 } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14516, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14541, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) } else { /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ @@ -102307,7 +103266,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Add an entry in sqlite_schema for this index */ - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14536, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14561, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) _sqlite3DbFree(tls, db, zStmt) /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. @@ -102315,7 +103274,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if pTblName != 0 { _sqlite3RefillIndex(tls, pParse, pIndex, iMem) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14595, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14620, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) } _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) @@ -102335,6 +103294,7 @@ func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u } /* Clean up before exiting */ exit_create_index: + ; if pIndex != 0 { _sqlite3FreeIndex(tls, db, pIndex) } @@ -102363,6 +103323,7 @@ exit_create_index: break goto _14 _14: + ; ppFrom = pThis + 40 } } @@ -102440,6 +103401,7 @@ func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { _ = libc.Int32FromInt32(0) goto _3 _3: + ; i++ } _ = libc.Int32FromInt32(0) @@ -102481,7 +103443,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) if pIndex == uintptr(0) { if !(ifExists != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14622, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14647, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) _sqlite3ForceNotReadOnly(tls, pParse) @@ -102490,7 +103452,7 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in goto exit_drop_index } if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14640, libc.VaList(bp+8, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14665, libc.VaList(bp+8, 0)) goto exit_drop_index } iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) @@ -102498,9 +103460,9 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { @@ -102516,13 +103478,14 @@ func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists in v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+14713, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) - _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11768, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14738, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11793, (*TIndex)(unsafe.Pointer(pIndex)).FzName) _sqlite3ChangeCookie(tls, pParse, iDb) _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) } exit_drop_index: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -102632,6 +103595,7 @@ func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) goto _1 _1: + ; i++ } _sqlite3DbNNFreeNN(tls, db, pList) @@ -102657,6 +103621,7 @@ func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) } goto _1 _1: + ; i++ } return -int32(1) @@ -102710,7 +103675,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14773, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14798, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) return uintptr(0) } if nAlloc > int64(SQLITE_MAX_SRCLIST) { @@ -102734,6 +103699,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) goto _1 _1: + ; i-- } *(*int32)(unsafe.Pointer(pSrc)) += nExtra @@ -102747,6 +103713,7 @@ func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) goto _2 _2: + ; i++ } /* Return a pointer to the enlarged SrcList */ @@ -102858,6 +103825,7 @@ func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) } goto _1 _1: + ; i++ pItem += 104 } @@ -102911,6 +103879,7 @@ func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { } goto _1 _1: + ; i++ pItem += 104 } @@ -102943,11 +103912,11 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa db = (*TParse)(unsafe.Pointer(pParse)).Fdb if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { - v1 = __ccgo_ts + 14809 + v1 = __ccgo_ts + 14834 } else { - v1 = __ccgo_ts + 14812 + v1 = __ccgo_ts + 14837 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14818, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14843, libc.VaList(bp+8, v1)) goto append_from_error } p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) @@ -102991,6 +103960,7 @@ func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa } return p append_from_error: + ; _ = libc.Int32FromInt32(0) _sqlite3ClearOnOrUsing(tls, db, pOnUsing) _sqlite3SelectDelete(tls, db, pSubquery) @@ -103111,6 +104081,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { allFlags = Tu8(int32(allFlags) | int32(v3)) goto _2 _2: + ; i-- v1 = i if !(v1 > 0) { @@ -103128,6 +104099,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { } goto _4 _4: + ; i-- } i-- @@ -103137,6 +104109,7 @@ func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) goto _6 _6: + ; i-- v5 = i if !(v5 >= 0) { @@ -103159,7 +104132,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _ = libc.Int32FromInt32(0) db = (*TParse)(unsafe.Pointer(pParse)).Fdb _ = libc.Int32FromInt32(0) - if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14854, uintptr(0), uintptr(0)) != 0 { + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14879, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) @@ -103186,6 +104159,7 @@ func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { _sqlite3VdbeUsesBtree(tls, v, i) goto _1 _1: + ; i++ } } @@ -103208,9 +104182,9 @@ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { _ = libc.Int32FromInt32(0) isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { - v1 = __ccgo_ts + 14860 + v1 = __ccgo_ts + 14885 } else { - v1 = __ccgo_ts + 14869 + v1 = __ccgo_ts + 14894 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return @@ -103243,9 +104217,9 @@ func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } var _az = [3]uintptr{ - 0: __ccgo_ts + 14854, - 1: __ccgo_ts + 14876, - 2: __ccgo_ts + 14860, + 0: __ccgo_ts + 14879, + 1: __ccgo_ts + 14901, + 2: __ccgo_ts + 14885, } // C documentation @@ -103265,7 +104239,7 @@ func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) if rc != SQLITE_OK { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14884, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14909, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = rc return int32(1) } @@ -103335,6 +104309,7 @@ func _sqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { } goto _1 _1: + ; i++ } } @@ -103455,7 +104430,7 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable _sqlite3StrAccumInit(tls, bp, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136))) if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14954, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+14979, libc.VaList(bp+40, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) } else { j = 0 for { @@ -103465,13 +104440,14 @@ func _sqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx _ = libc.Int32FromInt32(0) zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*16))).FzCnName if j != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+14965, int32(2)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+14990, int32(2)) } Xsqlite3_str_appendall(tls, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) Xsqlite3_str_append(tls, bp, __ccgo_ts+1661, int32(1)) Xsqlite3_str_appendall(tls, bp, zCol) goto _1 _1: + ; j++ } } @@ -103496,10 +104472,10 @@ func _sqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr _, _ = rc, zMsg if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)< libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } return 0 } @@ -104615,11 +105604,11 @@ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger ui bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15117, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15142, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15146, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15171, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 @@ -104748,6 +105737,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -104835,6 +105825,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _9 _9: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } else { @@ -104908,6 +105899,7 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _16 _16: + ; i++ } iKey = iPk @@ -105041,9 +106033,10 @@ func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** invoke the callback function. */ if memCnt != 0 { - _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15184) + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15209) } delete_from_cleanup: + ; _sqlite3AuthContextPop(tls, bp+8) _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprDelete(tls, db, pWhere) @@ -105146,6 +106139,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } goto _2 _2: + ; iCol++ } /* Invoke BEFORE DELETE trigger programs. */ @@ -105187,7 +106181,7 @@ func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri v3 = 0 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Delete), iDataCur, v3) - if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11557) { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 || 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11582) { _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) } if int32(eMode) != ONEPASS_OFF { @@ -105279,6 +106273,7 @@ func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pPrior = pIdx goto _2 _2: + ; i++ pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } @@ -105365,6 +106360,7 @@ func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iData } goto _2 _2: + ; j++ } if regOut != 0 { @@ -105473,6 +106469,7 @@ func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) @@ -105502,10 +106499,10 @@ func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { } var _azType2 = [5]uintptr{ - 0: __ccgo_ts + 6281, - 1: __ccgo_ts + 6276, - 2: __ccgo_ts + 8172, - 3: __ccgo_ts + 8167, + 0: __ccgo_ts + 6306, + 1: __ccgo_ts + 6301, + 2: __ccgo_ts + 8197, + 3: __ccgo_ts + 8192, 4: __ccgo_ts + 1634, } @@ -105623,7 +106620,7 @@ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) return } iVal = -iVal @@ -105719,10 +106716,12 @@ func _instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } Xsqlite3_result_int(tls, context, N) endInstr: + ; Xsqlite3_value_free(tls, pC1) Xsqlite3_value_free(tls, pC2) return endInstrOOM: + ; Xsqlite3_result_error_nomem(tls, context) goto endInstr } @@ -105812,6 +106811,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; len1++ } } @@ -105876,6 +106876,7 @@ func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _4 _4: + ; p2-- } Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) @@ -105936,7 +106937,7 @@ func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) } else { - zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15214, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15239, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -105999,6 +107000,7 @@ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = uint8(int32(*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))]) & libc.Int32FromInt32(0x20))) goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106026,6 +107028,7 @@ func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(z1 + uintptr(i))) = _sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(z2 + uintptr(i)))] goto _1 _1: + ; i++ } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) @@ -106518,7 +107521,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { */ nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15220, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15245, -int32(1)) return } if argc == int32(3) { @@ -106530,7 +107533,7 @@ func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { return } if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { - Xsqlite3_result_error(tls, context, __ccgo_ts+15253, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15278, -int32(1)) return } escape = _sqlite3Utf8Read(tls, bp+8) @@ -106702,13 +107705,13 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { switch Xsqlite3_value_type(tls, pValue) { case int32(SQLITE_FLOAT): r1 = Xsqlite3_value_double(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+5042, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15323, libc.VaList(bp+16, r1)) zVal = Xsqlite3_str_value(tls, pStr) if zVal != 0 { _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp)) { Xsqlite3_str_reset(tls, pStr) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15298, libc.VaList(bp+16, r1)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15331, libc.VaList(bp+16, r1)) } } case int32(SQLITE_INTEGER): @@ -106729,6 +107732,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { *(*uint8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*uint8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = uint8('\'') @@ -106739,7 +107743,7 @@ func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { } case int32(SQLITE_TEXT): zArg = Xsqlite3_value_text(tls, pValue) - Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15305, libc.VaList(bp+16, zArg)) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15339, libc.VaList(bp+16, zArg)) default: _ = libc.Int32FromInt32(0) Xsqlite3_str_append(tls, pStr, __ccgo_ts+1649, int32(4)) @@ -106865,6 +107869,7 @@ func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) @@ -106905,6 +107910,7 @@ func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] goto _2 _2: + ; i++ pBlob++ } @@ -107036,9 +108042,11 @@ func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } } unhex_done: + ; Xsqlite3_result_blob(tls, pCtx, pBlob, int32(int64(p)-int64(pBlob)), __ccgo_fp(Xsqlite3_free)) return unhex_null: + ; Xsqlite3_free(tls, pBlob) return } @@ -107094,7 +108102,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { _ = libc.Int32FromInt32(0) - Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, zStr, nStr, uintptr(-libc.Int32FromInt32(1))) return } nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) @@ -107149,6 +108157,7 @@ func _replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) @@ -107207,6 +108216,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; nChar++ } if nChar > 0 { @@ -107232,6 +108242,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) goto _4 _4: + ; nChar++ } } @@ -107253,6 +108264,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _6 _6: + ; i++ } if i >= nChar { @@ -107276,6 +108288,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _7 _7: + ; i++ } if i >= nChar { @@ -107296,7 +108309,7 @@ var _lenOne = [1]uint32{ } var _azOne = [1]uintptr{ - 0: __ccgo_ts + 11177, + 0: __ccgo_ts + 11202, } // C documentation @@ -107321,6 +108334,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) goto _1 _1: + ; i++ } n += int64((argc - int32(1)) * nSep) @@ -107349,6 +108363,7 @@ func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, n } goto _2 _2: + ; i++ } *(*uint8)(unsafe.Pointer(z + uintptr(j))) = uint8(0) @@ -107419,6 +108434,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { @@ -107442,6 +108458,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } goto _2 _2: + ; i++ } for j < int32(4) { @@ -107454,7 +108471,7 @@ func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } else { /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - Xsqlite3_result_text(tls, context, __ccgo_ts+15308, int32(4), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, context, __ccgo_ts+15342, int32(4), libc.UintptrFromInt32(0)) } } @@ -107515,7 +108532,7 @@ func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { ** flag is set. See the sqlite3_enable_load_extension() API. */ if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { - Xsqlite3_result_error(tls, context, __ccgo_ts+12395, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+12420, -int32(1)) return } if argc == int32(2) { @@ -107707,9 +108724,9 @@ func _sumFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+15197, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+15222, -int32(1)) } else { - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) @@ -107729,7 +108746,7 @@ func _avgFinalize(tls *libc.TLS, context uintptr) { if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -107748,7 +108765,7 @@ func _totalFinalize(tls *libc.TLS, context uintptr) { if p != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { r = (*TSumCtx)(unsafe.Pointer(p)).FrSum - if !(_sqlite3IsNaN(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { r += (*TSumCtx)(unsafe.Pointer(p)).FrErr } } else { @@ -108053,7 +109070,7 @@ func _groupConcatValue(tls *libc.TLS, context uintptr) { func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc - rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15313, int32(2)) + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15347, int32(2)) _ = libc.Int32FromInt32(0) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) @@ -108083,12 +109100,13 @@ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 if !(nArg <= int32(3)) { break } - _sqlite3CreateFunc(tls, db, __ccgo_ts+15319, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15319, nArg, uint8(SQLITE_UTF8), uint8(0)) + _sqlite3CreateFunc(tls, db, __ccgo_ts+15353, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15353, nArg, uint8(SQLITE_UTF8), uint8(0)) *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: + ; nArg++ } } @@ -108403,562 +109421,562 @@ var _aBuiltinFunc = [110]TFuncDef{ FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), - FzName: __ccgo_ts + 15324, + FzName: __ccgo_ts + 15358, }, 1: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), - FzName: __ccgo_ts + 15344, + FzName: __ccgo_ts + 15378, }, 2: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), - FzName: __ccgo_ts + 15357, + FzName: __ccgo_ts + 15391, }, 3: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), - FzName: __ccgo_ts + 15375, + FzName: __ccgo_ts + 15409, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15384, + FzName: __ccgo_ts + 15418, }, 5: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 6: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), - FzName: __ccgo_ts + 15392, + FzName: __ccgo_ts + 15426, }, 7: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15407, + FzName: __ccgo_ts + 15441, }, 8: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15433, + FzName: __ccgo_ts + 15467, }, 9: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15458, + FzName: __ccgo_ts + 15492, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15467, + FzName: __ccgo_ts + 15501, }, 11: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), - FzName: __ccgo_ts + 15478, + FzName: __ccgo_ts + 15512, }, 12: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), - FzName: __ccgo_ts + 15485, + FzName: __ccgo_ts + 15519, }, 13: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 14: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15499, + FzName: __ccgo_ts + 15533, }, 15: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15505, + FzName: __ccgo_ts + 15539, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 18: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(3))), - FzName: __ccgo_ts + 15511, + FzName: __ccgo_ts + 15545, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 20: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 21: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15516, + FzName: __ccgo_ts + 15550, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 23: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15520, + FzName: __ccgo_ts + 15554, }, 25: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15524, + FzName: __ccgo_ts + 15558, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), - FzName: __ccgo_ts + 15531, + FzName: __ccgo_ts + 15565, }, 27: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), - FzName: __ccgo_ts + 15539, + FzName: __ccgo_ts + 15573, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), - FzName: __ccgo_ts + 15546, + FzName: __ccgo_ts + 15580, }, 29: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15559, + FzName: __ccgo_ts + 15593, }, 30: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15565, + FzName: __ccgo_ts + 15599, }, 31: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15572, + FzName: __ccgo_ts + 15606, }, 32: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15579, + FzName: __ccgo_ts + 15613, }, 33: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15587, + FzName: __ccgo_ts + 15621, }, 34: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15592, + FzName: __ccgo_ts + 15626, }, 35: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 36: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15596, + FzName: __ccgo_ts + 15630, }, 37: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15602, + FzName: __ccgo_ts + 15636, }, 38: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15608, + FzName: __ccgo_ts + 15642, }, 39: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15614, + FzName: __ccgo_ts + 15648, }, 40: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 41: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15618, + FzName: __ccgo_ts + 15652, }, 42: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 43: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15624, + FzName: __ccgo_ts + 15658, }, 44: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 45: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 46: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15631, + FzName: __ccgo_ts + 15665, }, 47: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15641, + FzName: __ccgo_ts + 15675, }, 48: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15648, + FzName: __ccgo_ts + 15682, }, 49: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15655, + FzName: __ccgo_ts + 15689, }, 50: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15666, + FzName: __ccgo_ts + 15700, }, 51: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15673, + FzName: __ccgo_ts + 15707, }, 52: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15688, + FzName: __ccgo_ts + 15722, }, 53: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15705, + FzName: __ccgo_ts + 15739, }, 54: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15716, + FzName: __ccgo_ts + 15750, }, 55: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15722, + FzName: __ccgo_ts + 15756, }, 56: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15740, + FzName: __ccgo_ts + 15774, }, 57: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15748, + FzName: __ccgo_ts + 15782, }, 58: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15762, + FzName: __ccgo_ts + 15796, }, 59: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15770, + FzName: __ccgo_ts + 15804, }, 60: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 61: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15779, + FzName: __ccgo_ts + 15813, }, 62: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 63: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15786, + FzName: __ccgo_ts + 15820, }, 64: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15796, + FzName: __ccgo_ts + 15830, }, 65: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15800, + FzName: __ccgo_ts + 15834, }, 66: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15806, + FzName: __ccgo_ts + 15840, }, 67: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 68: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), - FzName: __ccgo_ts + 15810, + FzName: __ccgo_ts + 15844, }, 69: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 70: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15816, + FzName: __ccgo_ts + 15850, }, 71: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 15829, + FzName: __ccgo_ts + 15863, }, 72: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), - FzName: __ccgo_ts + 15840, + FzName: __ccgo_ts + 15874, }, 73: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 74: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), - FzName: __ccgo_ts + 15319, + FzName: __ccgo_ts + 15353, }, 75: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 76: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 77: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15845, + FzName: __ccgo_ts + 15879, }, 78: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15850, + FzName: __ccgo_ts + 15884, }, 79: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15858, + FzName: __ccgo_ts + 15892, }, 80: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15864, + FzName: __ccgo_ts + 15898, }, 81: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15870, + FzName: __ccgo_ts + 15904, }, 82: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 83: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(1))), - FzName: __ccgo_ts + 15877, + FzName: __ccgo_ts + 15911, }, 84: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(int64(libc.Int32FromInt32(2))), - FzName: __ccgo_ts + 15883, + FzName: __ccgo_ts + 15917, }, 85: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15873, + FzName: __ccgo_ts + 15907, }, 86: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15888, + FzName: __ccgo_ts + 15922, }, 87: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15892, + FzName: __ccgo_ts + 15926, }, 88: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15896, + FzName: __ccgo_ts + 15930, }, 89: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15902, + FzName: __ccgo_ts + 15936, }, 90: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15906, + FzName: __ccgo_ts + 15940, }, 91: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15911, + FzName: __ccgo_ts + 15945, }, 92: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15916, + FzName: __ccgo_ts + 15950, }, 93: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15921, + FzName: __ccgo_ts + 15955, }, 94: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15927, + FzName: __ccgo_ts + 15961, }, 95: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15931, + FzName: __ccgo_ts + 15965, }, 96: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15935, + FzName: __ccgo_ts + 15969, }, 97: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15939, + FzName: __ccgo_ts + 15973, }, 98: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15944, + FzName: __ccgo_ts + 15978, }, 99: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15949, + FzName: __ccgo_ts + 15983, }, 100: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15954, + FzName: __ccgo_ts + 15988, }, 101: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15960, + FzName: __ccgo_ts + 15994, }, 102: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15966, + FzName: __ccgo_ts + 16000, }, 103: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15972, + FzName: __ccgo_ts + 16006, }, 104: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15977, + FzName: __ccgo_ts + 16011, }, 105: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), - FzName: __ccgo_ts + 15985, + FzName: __ccgo_ts + 16019, }, 106: { FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15993, + FzName: __ccgo_ts + 16027, }, 107: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), - FzName: __ccgo_ts + 15996, + FzName: __ccgo_ts + 16030, }, 108: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), - FzName: __ccgo_ts + 6705, + FzName: __ccgo_ts + 6730, }, 109: { FnArg: int8(3), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), - FzName: __ccgo_ts + 16001, + FzName: __ccgo_ts + 16035, }, } @@ -109376,6 +110394,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom goto _2 _2: + ; i++ } } @@ -109415,6 +110434,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _4 _4: + ; j++ } if j == nCol { @@ -109422,6 +110442,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _3 _3: + ; i1++ } if i1 == nCol { @@ -109431,11 +110452,12 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16005, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16039, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) } _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) return int32(1) @@ -109498,6 +110520,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) goto _1 _1: + ; i++ } if isIgnore == 0 { @@ -109537,6 +110560,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) goto _2 _2: + ; i++ } /* If the parent table is the same as the child table, and we are about @@ -109569,6 +110593,7 @@ func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pId _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) goto _3 _3: + ; i++ } _sqlite3VdbeGoto(tls, v, iOk) @@ -109729,6 +110754,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) goto _1 _1: + ; i++ } /* If the child table is the same as the parent table, then add terms @@ -109766,6 +110792,7 @@ func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) goto _4 _4: + ; i++ } pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) @@ -109872,10 +110899,12 @@ func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) goto _2 _2: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } goto _1 _1: + ; k = (*THashElem)(unsafe.Pointer(k)).Fnext } } @@ -109924,6 +110953,7 @@ func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uint } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } if !(p != 0) { @@ -109985,6 +111015,7 @@ func _fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, } goto _1 _1: + ; i++ } return 0 @@ -110033,10 +111064,12 @@ func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr } goto _2 _2: + ; iKey++ } goto _1 _1: + ; i++ } return 0 @@ -110165,6 +111198,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) goto _2 _2: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) @@ -110202,6 +111236,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, } goto _3 _3: + ; i++ } /* Take a shared-cache advisory read-lock on the parent table. Allocate @@ -110229,6 +111264,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } /* Loop through all the foreign key constraints that refer to this table. @@ -110304,6 +111340,7 @@ func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32))) goto _5 _5: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110347,10 +111384,12 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v3 goto _2 _2: + ; i++ } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } p = _sqlite3FkReferences(tls, pTab) @@ -110375,11 +111414,13 @@ func _sqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) (r Tu32) { mask |= v6 goto _5 _5: + ; i++ } } goto _4 _4: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110447,6 +111488,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _1 _1: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom } /* Check if any parent key columns are being modified. */ @@ -110463,6 +111505,7 @@ func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uin } goto _2 _2: + ; p = (*TFKey)(unsafe.Pointer(p)).FpNextTo } } @@ -110546,11 +111589,11 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr break } *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ - Fz: __ccgo_ts + 6571, + Fz: __ccgo_ts + 6596, Fn: uint32(3), } /* Literal "old" token */ *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ - Fz: __ccgo_ts + 6567, + Fz: __ccgo_ts + 6592, Fn: uint32(3), } /* tFromCol = OLD.tToCol */ if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { @@ -110609,6 +111652,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -110616,7 +111660,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr nFrom = _sqlite3Strlen30(tls, zFrom) if action == int32(OE_Restrict) { iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5200) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5225) if pRaise != 0 { (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = uint8(OE_Abort) } @@ -110718,6 +111762,7 @@ func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uin } goto _1 _1: + ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo } } @@ -110773,6 +111818,7 @@ func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { _sqlite3DbFree(tls, db, pFKey) goto _1 _1: + ; pFKey = pNext } } @@ -110894,6 +111940,7 @@ func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff goto _1 _1: + ; n++ } *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = uint8(0) @@ -110934,6 +111981,7 @@ func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintpt } goto _1 _1: + ; i++ } for cond := true; cond; cond = j >= 0 && int32(*(*uint8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { @@ -111070,6 +112118,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _3 _3: + ; pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext } } @@ -111080,6 +112129,7 @@ func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { } goto _2 _2: + ; i++ } return 0 @@ -111144,6 +112194,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in jj++ goto _1 _1: + ; ii++ } } else { @@ -111170,6 +112221,7 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _3 _3: + ; i++ } *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab @@ -111211,11 +112263,12 @@ func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } goto _5 _5: + ; i++ } } if pRedo != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8137, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8162, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) } (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -111341,6 +112394,7 @@ func _sqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { } goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111448,6 +112502,7 @@ func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { _sqlite3ReleaseTempReg(tls, pParse, iRec) goto _1 _1: + ; p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext } } @@ -111726,6 +112781,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) goto _2 _2: + ; i++ } i = 0 @@ -111748,13 +112804,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin _ = libc.Int32FromInt32(0) } if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16050, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16084, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto insert_cleanup } break } goto _4 _4: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -111762,13 +112819,14 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin ipkColumn = i bIdListInOrder = uint8(0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16091, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16125, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto insert_cleanup } } goto _3 _3: + ; i++ } } @@ -111863,6 +112921,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _10 _10: + ; i-- } } @@ -111883,16 +112942,17 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _11 _11: + ; i++ } } if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16123, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16157, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) goto insert_cleanup } } if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16175, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16209, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup } /* Initialize the count of rows to be inserted @@ -111925,6 +112985,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext i++ } @@ -111935,11 +112996,11 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } if pUpsert != 0 { if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16200, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16234, libc.VaList(bp+128, (*TTable)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16246, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16280, 0) goto insert_cleanup } if _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0 { @@ -111953,7 +113014,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin (*TUpsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp)) (*TUpsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 4)) if (*TUpsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0 { - if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0 { + if _sqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx, pUpsert) != 0 { goto insert_cleanup } } @@ -112057,6 +113118,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _22 _22: + ; j++ } if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { @@ -112097,6 +113159,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } goto _20 _20: + ; i++ iRegStore++ } @@ -112256,6 +113319,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin } } insert_end: + ; /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. @@ -112269,9 +113333,10 @@ insert_end: ** invoke the callback function. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16267) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16301) } insert_cleanup: + ; _sqlite3SrcListDelete(tls, db, pTabList) _sqlite3ExprListDelete(tls, db, pList) _sqlite3UpsertDelete(tls, db, pUpsert) @@ -112666,7 +113731,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt case int32(OE_Rollback): fallthrough case int32(OE_Fail): - zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)<= 0 && !(int32(*(*uint8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { @@ -114915,10 +116002,11 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _3 _3: + ; iFile-- } iFile++ - if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16316, int32(3)) == 0 { + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16350, int32(3)) == 0 { iFile += int32(3) } iEntry = int32(8) @@ -114935,9 +116023,10 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } goto _4 _4: + ; iFile++ } - libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16320, uint64(6)) + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16354, uint64(6)) zEntry = zAltEntry xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) } @@ -114949,7 +116038,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16326, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16360, libc.VaList(bp+16, zEntry, zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -114964,7 +116053,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return SQLITE_OK } if pzErrMsg != 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16369, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+16403, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) _sqlite3OsDlClose(tls, pVfs, handle) @@ -114986,6 +116075,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle return SQLITE_OK extension_not_found: + ; if pzErrMsg != 0 { nMsg += uint64(300) v10 = Xsqlite3_malloc64(tls, nMsg) @@ -114993,7 +116083,7 @@ extension_not_found: *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 if *(*uintptr)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) /* zErrmsg would be NULL if not so */ - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16401, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16435, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) } } @@ -115002,7 +116092,7 @@ extension_not_found: /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ - 0: __ccgo_ts + 16281, + 0: __ccgo_ts + 16315, } func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { @@ -115033,6 +116123,7 @@ func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) @@ -115116,6 +116207,7 @@ func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i++ } if i == _sqlite3Autoext.FnExt { @@ -115167,6 +116259,7 @@ func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { } goto _1 _1: + ; i-- } Xsqlite3_mutex_leave(tls, mutex) @@ -115234,12 +116327,13 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { rc = v2 } if v3 && v2 != 0 { - _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16438, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16472, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; i++ } } @@ -115287,63 +116381,63 @@ func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ - 0: __ccgo_ts + 5456, - 1: __ccgo_ts + 16477, - 2: __ccgo_ts + 9033, - 3: __ccgo_ts + 16481, - 4: __ccgo_ts + 16486, - 5: __ccgo_ts + 16489, - 6: __ccgo_ts + 16499, - 7: __ccgo_ts + 16509, - 8: __ccgo_ts + 16515, - 9: __ccgo_ts + 16519, - 10: __ccgo_ts + 16524, - 11: __ccgo_ts + 16529, - 12: __ccgo_ts + 16537, - 13: __ccgo_ts + 16548, - 14: __ccgo_ts + 16551, - 15: __ccgo_ts + 16558, - 16: __ccgo_ts + 16519, - 17: __ccgo_ts + 16524, - 18: __ccgo_ts + 16565, - 19: __ccgo_ts + 16570, - 20: __ccgo_ts + 16573, - 21: __ccgo_ts + 16580, - 22: __ccgo_ts + 16515, - 23: __ccgo_ts + 16519, - 24: __ccgo_ts + 16586, - 25: __ccgo_ts + 16591, - 26: __ccgo_ts + 16596, - 27: __ccgo_ts + 16519, - 28: __ccgo_ts + 16600, - 29: __ccgo_ts + 16524, - 30: __ccgo_ts + 16608, - 31: __ccgo_ts + 16612, - 32: __ccgo_ts + 16617, - 33: __ccgo_ts + 11772, - 34: __ccgo_ts + 11768, - 35: __ccgo_ts + 16623, - 36: __ccgo_ts + 16628, - 37: __ccgo_ts + 16633, - 38: __ccgo_ts + 16477, - 39: __ccgo_ts + 16519, - 40: __ccgo_ts + 16638, - 41: __ccgo_ts + 16645, - 42: __ccgo_ts + 16652, - 43: __ccgo_ts + 9033, - 44: __ccgo_ts + 16660, - 45: __ccgo_ts + 5459, - 46: __ccgo_ts + 16666, - 47: __ccgo_ts + 16477, - 48: __ccgo_ts + 16519, - 49: __ccgo_ts + 16671, - 50: __ccgo_ts + 16676, - 51: __ccgo_ts + 15873, - 52: __ccgo_ts + 16681, - 53: __ccgo_ts + 16694, - 54: __ccgo_ts + 16703, - 55: __ccgo_ts + 16710, - 56: __ccgo_ts + 16721, + 0: __ccgo_ts + 5481, + 1: __ccgo_ts + 16511, + 2: __ccgo_ts + 9058, + 3: __ccgo_ts + 16515, + 4: __ccgo_ts + 16520, + 5: __ccgo_ts + 16523, + 6: __ccgo_ts + 16533, + 7: __ccgo_ts + 16543, + 8: __ccgo_ts + 16549, + 9: __ccgo_ts + 16553, + 10: __ccgo_ts + 16558, + 11: __ccgo_ts + 16563, + 12: __ccgo_ts + 16571, + 13: __ccgo_ts + 16582, + 14: __ccgo_ts + 16585, + 15: __ccgo_ts + 16592, + 16: __ccgo_ts + 16553, + 17: __ccgo_ts + 16558, + 18: __ccgo_ts + 16599, + 19: __ccgo_ts + 16604, + 20: __ccgo_ts + 16607, + 21: __ccgo_ts + 16614, + 22: __ccgo_ts + 16549, + 23: __ccgo_ts + 16553, + 24: __ccgo_ts + 16620, + 25: __ccgo_ts + 16625, + 26: __ccgo_ts + 16630, + 27: __ccgo_ts + 16553, + 28: __ccgo_ts + 16634, + 29: __ccgo_ts + 16558, + 30: __ccgo_ts + 16642, + 31: __ccgo_ts + 16646, + 32: __ccgo_ts + 16651, + 33: __ccgo_ts + 11797, + 34: __ccgo_ts + 11793, + 35: __ccgo_ts + 16657, + 36: __ccgo_ts + 16662, + 37: __ccgo_ts + 16667, + 38: __ccgo_ts + 16511, + 39: __ccgo_ts + 16553, + 40: __ccgo_ts + 16672, + 41: __ccgo_ts + 16679, + 42: __ccgo_ts + 16686, + 43: __ccgo_ts + 9058, + 44: __ccgo_ts + 16694, + 45: __ccgo_ts + 5484, + 46: __ccgo_ts + 16700, + 47: __ccgo_ts + 16511, + 48: __ccgo_ts + 16553, + 49: __ccgo_ts + 16705, + 50: __ccgo_ts + 16710, + 51: __ccgo_ts + 15907, + 52: __ccgo_ts + 16715, + 53: __ccgo_ts + 16728, + 54: __ccgo_ts + 16737, + 55: __ccgo_ts + 16744, + 56: __ccgo_ts + 16755, } // C documentation @@ -115362,191 +116456,191 @@ type PragmaName = TPragmaName var _aPragmaName = [66]TPragmaName{ 0: { - FzName: __ccgo_ts + 16729, + FzName: __ccgo_ts + 16763, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { - FzName: __ccgo_ts + 16744, + FzName: __ccgo_ts + 16778, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { - FzName: __ccgo_ts + 16759, + FzName: __ccgo_ts + 16793, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { - FzName: __ccgo_ts + 16771, + FzName: __ccgo_ts + 16805, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { - FzName: __ccgo_ts + 16787, + FzName: __ccgo_ts + 16821, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { - FzName: __ccgo_ts + 16710, + FzName: __ccgo_ts + 16744, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { - FzName: __ccgo_ts + 16800, + FzName: __ccgo_ts + 16834, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { - FzName: __ccgo_ts + 16812, + FzName: __ccgo_ts + 16846, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { - FzName: __ccgo_ts + 16832, + FzName: __ccgo_ts + 16866, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { - FzName: __ccgo_ts + 16848, + FzName: __ccgo_ts + 16882, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { - FzName: __ccgo_ts + 16869, + FzName: __ccgo_ts + 16903, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(38), FnPragCName: uint8(2), }, 11: { - FzName: __ccgo_ts + 16884, + FzName: __ccgo_ts + 16918, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { - FzName: __ccgo_ts + 16900, + FzName: __ccgo_ts + 16934, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { - FzName: __ccgo_ts + 16914, + FzName: __ccgo_ts + 16948, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { - FzName: __ccgo_ts + 16927, + FzName: __ccgo_ts + 16961, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 15: { - FzName: __ccgo_ts + 16941, + FzName: __ccgo_ts + 16975, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { - FzName: __ccgo_ts + 16960, + FzName: __ccgo_ts + 16994, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { - FzName: __ccgo_ts + 16979, + FzName: __ccgo_ts + 17013, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { - FzName: __ccgo_ts + 17002, + FzName: __ccgo_ts + 17036, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { - FzName: __ccgo_ts + 17011, + FzName: __ccgo_ts + 17045, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { - FzName: __ccgo_ts + 17029, + FzName: __ccgo_ts + 17063, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { - FzName: __ccgo_ts + 17046, + FzName: __ccgo_ts + 17080, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { - FzName: __ccgo_ts + 17059, + FzName: __ccgo_ts + 17093, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { - FzName: __ccgo_ts + 17074, + FzName: __ccgo_ts + 17108, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { - FzName: __ccgo_ts + 17092, + FzName: __ccgo_ts + 17126, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { - FzName: __ccgo_ts + 17102, + FzName: __ccgo_ts + 17136, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(27), FnPragCName: uint8(6), }, 26: { - FzName: __ccgo_ts + 17116, + FzName: __ccgo_ts + 17150, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { - FzName: __ccgo_ts + 17132, + FzName: __ccgo_ts + 17166, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { - FzName: __ccgo_ts + 17157, + FzName: __ccgo_ts + 17191, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { - FzName: __ccgo_ts + 17176, + FzName: __ccgo_ts + 17210, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), FnPragCName: uint8(3), }, 30: { - FzName: __ccgo_ts + 17187, + FzName: __ccgo_ts + 17221, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(38), FnPragCName: uint8(5), }, 31: { - FzName: __ccgo_ts + 17198, + FzName: __ccgo_ts + 17232, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(21), @@ -115554,146 +116648,146 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 32: { - FzName: __ccgo_ts + 17210, + FzName: __ccgo_ts + 17244, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { - FzName: __ccgo_ts + 17226, + FzName: __ccgo_ts + 17260, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { - FzName: __ccgo_ts + 17239, + FzName: __ccgo_ts + 17273, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { - FzName: __ccgo_ts + 17258, + FzName: __ccgo_ts + 17292, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { - FzName: __ccgo_ts + 17277, + FzName: __ccgo_ts + 17311, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { - FzName: __ccgo_ts + 17290, + FzName: __ccgo_ts + 17324, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { - FzName: __ccgo_ts + 17305, + FzName: __ccgo_ts + 17339, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { - FzName: __ccgo_ts + 17315, + FzName: __ccgo_ts + 17349, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { - FzName: __ccgo_ts + 17327, + FzName: __ccgo_ts + 17361, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { - FzName: __ccgo_ts + 17336, + FzName: __ccgo_ts + 17370, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { - FzName: __ccgo_ts + 17347, + FzName: __ccgo_ts + 17381, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { - FzName: __ccgo_ts + 17357, + FzName: __ccgo_ts + 17391, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { - FzName: __ccgo_ts + 17369, + FzName: __ccgo_ts + 17403, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { - FzName: __ccgo_ts + 17380, + FzName: __ccgo_ts + 17414, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { - FzName: __ccgo_ts + 17392, + FzName: __ccgo_ts + 17426, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { - FzName: __ccgo_ts + 17409, + FzName: __ccgo_ts + 17443, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { - FzName: __ccgo_ts + 17428, + FzName: __ccgo_ts + 17462, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { - FzName: __ccgo_ts + 17454, + FzName: __ccgo_ts + 17488, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { - FzName: __ccgo_ts + 17469, + FzName: __ccgo_ts + 17503, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { - FzName: __ccgo_ts + 17483, + FzName: __ccgo_ts + 17517, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { - FzName: __ccgo_ts + 17502, + FzName: __ccgo_ts + 17536, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { - FzName: __ccgo_ts + 17516, + FzName: __ccgo_ts + 17550, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { - FzName: __ccgo_ts + 17532, + FzName: __ccgo_ts + 17566, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { - FzName: __ccgo_ts + 17544, + FzName: __ccgo_ts + 17578, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { - FzName: __ccgo_ts + 17555, + FzName: __ccgo_ts + 17589, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 57: { - FzName: __ccgo_ts + 17566, + FzName: __ccgo_ts + 17600, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), @@ -115701,45 +116795,45 @@ var _aPragmaName = [66]TPragmaName{ FiArg: uint64(1), }, 58: { - FzName: __ccgo_ts + 17578, + FzName: __ccgo_ts + 17612, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { - FzName: __ccgo_ts + 17589, + FzName: __ccgo_ts + 17623, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { - FzName: __ccgo_ts + 17610, + FzName: __ccgo_ts + 17644, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { - FzName: __ccgo_ts + 17618, + FzName: __ccgo_ts + 17652, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { - FzName: __ccgo_ts + 17633, + FzName: __ccgo_ts + 17667, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { - FzName: __ccgo_ts + 17646, + FzName: __ccgo_ts + 17680, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { - FzName: __ccgo_ts + 17665, + FzName: __ccgo_ts + 17699, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 65: { - FzName: __ccgo_ts + 17680, + FzName: __ccgo_ts + 17714, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), @@ -115781,6 +116875,7 @@ func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) } goto _1 _1: + ; i++ } return dflt @@ -115839,10 +116934,10 @@ func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17696) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17730) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17706) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17740) { return PAGER_LOCKINGMODE_NORMAL } } @@ -115860,13 +116955,13 @@ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8193) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8218) { return BTREE_AUTOVACUUM_NONE } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17713) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17747) { return int32(BTREE_AUTOVACUUM_FULL) } - if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17718) { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17752) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) @@ -115889,10 +116984,10 @@ func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { if int32(*(*uint8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(z))) <= int32('2') { return int32(*(*uint8)(unsafe.Pointer(z))) - int32('0') } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+16671) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16705) == 0 { return int32(1) } else { - if _sqlite3StrICmp(tls, z, __ccgo_ts+17730) == 0 { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17764) == 0 { return int32(2) } else { return 0 @@ -115914,7 +117009,7 @@ func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17737, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17771, 0) return int32(SQLITE_ERROR) } _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) @@ -115975,6 +117070,7 @@ func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) goto _2 _2: + ; i++ j++ } @@ -116048,15 +117144,15 @@ func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { _ = zName switch int32(action) { case int32(OE_SetNull): - zName = __ccgo_ts + 17799 + zName = __ccgo_ts + 17833 case int32(OE_SetDflt): - zName = __ccgo_ts + 17808 + zName = __ccgo_ts + 17842 case int32(OE_Cascade): - zName = __ccgo_ts + 17820 + zName = __ccgo_ts + 17854 case int32(OE_Restrict): - zName = __ccgo_ts + 17828 + zName = __ccgo_ts + 17862 default: - zName = __ccgo_ts + 17837 + zName = __ccgo_ts + 17871 _ = libc.Int32FromInt32(0) break } @@ -116085,12 +117181,12 @@ func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { } var _azModeName = [6]uintptr{ - 0: __ccgo_ts + 17847, - 1: __ccgo_ts + 17854, - 2: __ccgo_ts + 17862, - 3: __ccgo_ts + 17866, - 4: __ccgo_ts + 17730, - 5: __ccgo_ts + 17875, + 0: __ccgo_ts + 17881, + 1: __ccgo_ts + 17888, + 2: __ccgo_ts + 17896, + 3: __ccgo_ts + 17900, + 4: __ccgo_ts + 17764, + 5: __ccgo_ts + 17909, } // C documentation @@ -116156,25 +117252,26 @@ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, s goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = __ccgo_ts + 17900 + zType = __ccgo_ts + 17934 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = __ccgo_ts + 17902 + zType = __ccgo_ts + 17936 } else { - zType = __ccgo_ts + 7592 + zType = __ccgo_ts + 7617 } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17904, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17938, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: + ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } var _azEnc = [4]uintptr{ - 1: __ccgo_ts + 17879, - 2: __ccgo_ts + 17884, - 3: __ccgo_ts + 17892, + 1: __ccgo_ts + 17913, + 2: __ccgo_ts + 17918, + 3: __ccgo_ts + 17926, } // C documentation @@ -116215,8 +117312,8 @@ func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { bp := tls.Alloc(240) defer tls.Free(240) - var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v59, v61, v62, v63, v64, v67 int32 - var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v60, v65, v8 uintptr + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr var azOrigin [3]uintptr var cnum Ti16 var enc Tu8 @@ -116244,7 +117341,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var _ /* size at bp+60 */ int32 var _ /* sz at bp+64 */ Tsqlite3_int64 var _ /* x at bp+40 */ Ti64 - _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v59, v60, v61, v62, v63, v64, v65, v67, v8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ @@ -116273,7 +117370,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p return } if minusFlag != 0 { - zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17911, libc.VaList(bp+176, pValue)) + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17945, libc.VaList(bp+176, pValue)) } else { zRight = _sqlite3NameFromToken(tls, db, pValue) } @@ -116424,7 +117521,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p b = -int32(1) _ = libc.Int32FromInt32(0) if zRight != 0 { - if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17915) == 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17949) == 0 { b = int32(2) } else { b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) @@ -116439,6 +117536,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) goto _3 _3: + ; ii++ } } @@ -116494,7 +117592,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p */ fallthrough case int32(PragTyp_LOCKING_MODE): - zRet = __ccgo_ts + 17706 + zRet = __ccgo_ts + 17740 eMode = _getLockingMode(tls, zRight) if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { /* Simple "PRAGMA locking_mode;" statement. This is a query for @@ -116514,6 +117612,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3PagerLockingMode(tls, pPager, eMode) goto _6 _6: + ; ii1++ } (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) @@ -116523,7 +117622,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } _ = libc.Int32FromInt32(0) if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { - zRet = __ccgo_ts + 17696 + zRet = __ccgo_ts + 17730 } _returnSingleText(tls, v, zRet) break @@ -116533,7 +117632,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** (delete|persist|off|truncate|memory|wal|off) */ fallthrough - case int32(PragTyp_JOURNAL_MODE): + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ if zRight == uintptr(0) { /* If there is no "=MODE" part of the pragma, do a query for the ** current mode */ @@ -116552,6 +117651,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _7 _7: + ; eMode1++ } if !(zMode != 0) { @@ -116581,6 +117681,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _9 _9: + ; ii2-- } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) @@ -116763,6 +117864,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _11 _11: + ; ii3-- } } @@ -116815,7 +117917,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if *(*uint8)(unsafe.Pointer(zRight)) != 0 { rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17954, 0) Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) goto pragma_out } @@ -116847,7 +117949,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) } else { if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17945, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17979, 0) } else { if iDb != int32(1) { iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) @@ -116880,7 +117982,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if mask == uint64(SQLITE_DeferFKs) { (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 } - if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17998) == 0 { + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18032) == 0 { /* IMP: R-60817-01178 If the argument is "RESET" then schema ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, ** in addition, the schema is reloaded. */ @@ -116954,6 +118056,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _13 _13: + ; k++ } } @@ -116962,9 +118065,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - v14 = __ccgo_ts + 18004 + v14 = __ccgo_ts + 18038 } else { - v14 = __ccgo_ts + 18012 + v14 = __ccgo_ts + 18046 } if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { v15 = int32(1) @@ -116979,6 +118082,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1648), v15, v16, k, isHidden)) goto _12 _12: + ; i++ pCol += 16 } @@ -117034,7 +118138,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18019, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18053, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 80)) = uintptr(0) Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+80, uintptr(0)) @@ -117050,6 +118154,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _19 _19: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } } @@ -117063,25 +118168,27 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _20 } if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { - zType = __ccgo_ts + 10771 + zType = __ccgo_ts + 10796 } else { if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { - zType = __ccgo_ts + 13019 + zType = __ccgo_ts + 13044 } else { if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { - zType = __ccgo_ts + 18035 + zType = __ccgo_ts + 18069 } else { - zType = __ccgo_ts + 9033 + zType = __ccgo_ts + 9058 } } } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18042, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) goto _20 _20: + ; k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext } goto _17 _17: + ; ii4++ } case int32(PragTyp_INDEX_INFO): @@ -117121,13 +118228,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18049, libc.VaList(bp+176, i1, int32(cnum), v22)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18083, libc.VaList(bp+176, i1, int32(cnum), v22)) if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18054, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18088, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) } _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) goto _21 _21: + ; i1++ } } @@ -117146,13 +118254,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } azOrigin = [3]uintptr{ - 0: __ccgo_ts + 18059, - 1: __ccgo_ts + 18061, - 2: __ccgo_ts + 16548, + 0: __ccgo_ts + 18093, + 1: __ccgo_ts + 18095, + 2: __ccgo_ts + 16582, } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18063, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18097, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) goto _23 _23: + ; pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext i2++ } @@ -117169,9 +118278,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _24 } _ = libc.Int32FromInt32(0) - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18069, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18103, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) goto _24 _24: + ; i3++ } case int32(PragTyp_COLLATION_LIST): @@ -117185,9 +118295,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p pColl = (*THashElem)(unsafe.Pointer(p)).Fdata v26 = i4 i4++ - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18073, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18107, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) goto _25 _25: + ; p = (*THashElem)(unsafe.Pointer(p)).Fnext } case int32(PragTyp_FUNCTION_LIST): @@ -117207,10 +118318,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) goto _28 _28: + ; p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) } goto _27 _27: + ; i5++ } j = (*THash)(unsafe.Pointer(db + 624)).Ffirst @@ -117223,6 +118336,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) goto _29 _29: + ; j = (*THashElem)(unsafe.Pointer(j)).Fnext } case int32(PragTyp_MODULE_LIST): @@ -117233,9 +118347,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p break } pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) goto _30 _30: + ; j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext } case int32(PragTyp_PRAGMA_LIST): @@ -117244,9 +118359,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(i6 < int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24))) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7592, libc.VaList(bp+176, _aPragmaName[i6].FzName)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7617, libc.VaList(bp+176, _aPragmaName[i6].FzName)) goto _31 _31: + ; i6++ } case int32(PragTyp_FOREIGN_KEY_LIST): @@ -117269,9 +118385,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { break } - _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18076, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18085)) + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18110, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18119)) goto _32 _32: + ; j2++ } i7++ @@ -117280,7 +118397,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } } } - case int32(PragTyp_FOREIGN_KEY_CHECK): + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) v34 = pParse + 56 @@ -117341,6 +118458,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _35 _35: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117391,6 +118509,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) goto _37 _37: + ; j3++ } /* Generate code to query the parent index for a matching parent @@ -117412,12 +118531,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) } - _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18090, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18124, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) _sqlite3VdbeResolveLabel(tls, v, addrOk) _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) goto _36 _36: + ; i8++ pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom } @@ -117540,6 +118660,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p cnt++ goto _42 _42: + ; pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext nIdx++ } @@ -117548,6 +118669,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _41 _41: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } if cnt == 0 { @@ -117590,10 +118712,12 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) goto _46 _46: + ; pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext } goto _44 _44: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } *(*int32)(unsafe.Pointer(aRoot)) = cnt @@ -117604,7 +118728,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) - _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18094, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18128, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) _integrityCheckResultRow(tls, v) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -117622,50 +118746,6 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p goto _48 } if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { - if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { - goto _48 - } - if int32((*TTable)(unsafe.Pointer(pTab9)).FnCol) <= 0 { - zMod = *(*uintptr)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).FazArg)) - if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { - goto _48 - } - } - _sqlite3ViewGetColumnNames(tls, pParse, pTab9) - if (*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp == uintptr(0) { - goto _48 - } - pVTab = (*TVTable)(unsafe.Pointer((*(*struct { - FnArg int32 - FazArg uintptr - Fp uintptr - })(unsafe.Pointer(pTab9 + 64))).Fp)).FpVtab - if pVTab == uintptr(0) { - goto _48 - } - if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { - goto _48 - } - if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { - goto _48 - } - _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) - (*TTable)(unsafe.Pointer(pTab9)).FnTabRef++ - _sqlite3VdbeAppendP4(tls, v, pTab9, -int32(16)) - a1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) - _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a1) goto _48 } if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -117690,6 +118770,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ goto _49 _49: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117715,6 +118796,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _50 _50: + ; j4++ } if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { @@ -117732,13 +118814,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } if !(isQuick != 0) { if pPk1 != 0 { - a11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) - zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18118, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18152, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) _integrityCheckResultRow(tls, v) - _sqlite3VdbeJumpHere(tls, v, a11) - _sqlite3VdbeJumpHere(tls, v, a11+int32(1)) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) j4 = 0 for { if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { @@ -117747,6 +118829,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 108)), j4, r2+j4) goto _51 _51: + ; j4++ } } @@ -117814,9 +118897,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) } - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18154, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18188, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) if doTypeCheck != 0 { _sqlite3VdbeGoto(tls, v, labelError) @@ -117830,7 +118914,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _ = libc.Int32FromInt32(0) _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18174, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18208, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { @@ -117838,7 +118922,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** NULL, TEXT, or BLOB. */ _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18196, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18230, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } else { if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { @@ -117849,10 +118933,10 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if p11 >= 0 { _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) } - _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18219, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18253, -int32(1)) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ - zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18221, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18255, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) } } @@ -117862,6 +118946,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeResolveLabel(tls, v, labelOk) goto _52 _52: + ; j4++ } /* Verify CHECK constraints */ @@ -117879,12 +118964,13 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) goto _53 _53: + ; k3-- } _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) _sqlite3VdbeResolveLabel(tls, v, addrCkFault) (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18241, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18275, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) _integrityCheckResultRow(tls, v) _sqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -117908,9 +118994,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ /* Verify that an index entry exists for the current table row */ jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 112))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18276) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18310) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) @@ -117923,9 +119009,9 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18297) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18331) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18333) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18367) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp7) } @@ -117947,14 +119033,15 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) goto _55 _55: + ; kk++ } if label6 != 0 { jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) _sqlite3VdbeResolveLabel(tls, v, label6) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18271) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18305) _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) - _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18344) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18378) _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) _sqlite3VdbeJumpHere(tls, v, jmp6) } @@ -117976,13 +119063,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) goto _56 _56: + ; kk++ } jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 112))+j4) _sqlite3VdbeGoto(tls, v, uniqOk) _sqlite3VdbeJumpHere(tls, v, jmp61) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 112))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) - _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18371) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18405) _sqlite3VdbeGoto(tls, v, jmp5) _sqlite3VdbeResolveLabel(tls, v, uniqOk) } @@ -117990,6 +119078,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 128))) goto _54 _54: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -117997,7 +119086,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 108)), loopTop) _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) if !(isQuick != 0) { - _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18398) + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18432) j4 = 0 pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex for { @@ -118016,6 +119105,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p _sqlite3VdbeJumpHere(tls, v, addr1) goto _57 _57: + ; pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext j4++ } @@ -118025,17 +119115,84 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } goto _48 _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext } goto _40 _40: + ; i9++ } aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) if aOp2 != 0 { (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 104)) (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18427 + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18461 (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) } @@ -118096,27 +119253,28 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc != 0 { - v59 = int32((*struct { + v60 = int32((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).Fenc) } else { - v59 = int32(SQLITE_UTF16LE) + v60 = int32(SQLITE_UTF16LE) } - enc = uint8(v59) + enc = uint8(v60) (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc _sqlite3SetTextEncoding(tls, db, enc) break } - goto _58 - _58: + goto _59 + _59: + ; pEnc += 16 } if !((*struct { FzName uintptr Fenc Tu8 })(unsafe.Pointer(pEnc)).FzName != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18488, libc.VaList(bp+176, zRight)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18522, libc.VaList(bp+176, zRight)) } } } @@ -118194,11 +119352,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p i10 = 0 (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) for { - v61 = i10 + v62 = i10 i10++ - v60 = Xsqlite3_compileoption_get(tls, v61) - zOpt = v60 - if !(v60 != uintptr(0)) { + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { break } _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) @@ -118214,20 +119372,20 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p fallthrough case int32(PragTyp_WAL_CHECKPOINT): if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { - v62 = iDb + v63 = iDb } else { - v62 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) } - iBt = v62 + iBt = v63 eMode2 = SQLITE_CHECKPOINT_PASSIVE if zRight != 0 { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17713) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17747) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_FULL) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18513) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18547) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_RESTART) } else { - if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17866) == 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17900) == 0 { eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) } } @@ -118251,11 +119409,11 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) } if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { - v63 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) } else { - v63 = 0 + v64 = 0 } - _returnSingleInt(tls, v, int64(v63)) + _returnSingleInt(tls, v, int64(v64)) break /* ** PRAGMA shrink_memory @@ -118323,7 +119481,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p ** future releases. */ fallthrough - case int32(PragTyp_OPTIMIZE): + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ if zRight != 0 { opMask = uint32(_sqlite3Atoi(tls, zRight)) if opMask&uint32(0x02) == uint32(0) { @@ -118332,22 +119490,22 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { opMask = uint32(0xfffe) } - v65 = pParse + 52 - v64 = *(*int32)(unsafe.Pointer(v65)) - *(*int32)(unsafe.Pointer(v65))++ - iTabCur = v64 + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 if zDb != 0 { - v67 = iDb + v68 = iDb } else { - v67 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) } - iDbLast = v67 + iDbLast = v68 for { if !(iDb <= iDbLast) { break } if iDb == int32(1) { - goto _66 + goto _67 } _sqlite3CodeVerifySchema(tls, pParse, iDb) pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema @@ -118356,17 +119514,17 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if !(k4 != 0) { break } - pTab10 = (*THashElem)(unsafe.Pointer(k4)).Fdata + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata /* If table pTab has not been used in a way that would benefit from ** having analysis statistics during the current session, then skip it. ** This also has the effect of skipping virtual tables and views */ - if (*TTable)(unsafe.Pointer(pTab10)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { - goto _68 + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 } /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab10)).FnRowLogEst) + int32(46)) + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) _ = libc.Int32FromInt32(0) - pIdx6 = (*TTable)(unsafe.Pointer(pTab10)).FpIndex + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex for { if !(pIdx6 != 0) { break @@ -118375,15 +119533,16 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p szThreshold = 0 /* Always analyze if any index lacks statistics */ break } - goto _69 - _69: + goto _70 + _70: + ; pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext } if szThreshold != 0 { - _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab10, int32(OP_OpenRead)) + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) } - zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18521, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab10)).FzName)) + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18555, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) if opMask&uint32(0x01) != 0 { r11 = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) @@ -118391,12 +119550,14 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p } else { _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) } - goto _68 - _68: + goto _69 + _69: + ; k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext } - goto _66 - _66: + goto _67 + _67: + ; iDb++ } _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) @@ -118495,6 +119656,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { } pragma_out: + ; _sqlite3DbFree(tls, db, zLeft) _sqlite3DbFree(tls, db, zRight) } @@ -118624,34 +119786,34 @@ var _encnames1 = [9]struct { Fenc Tu8 }{ 0: { - FzName: __ccgo_ts + 18430, + FzName: __ccgo_ts + 18464, Fenc: uint8(SQLITE_UTF8), }, 1: { - FzName: __ccgo_ts + 18435, + FzName: __ccgo_ts + 18469, Fenc: uint8(SQLITE_UTF8), }, 2: { - FzName: __ccgo_ts + 18441, + FzName: __ccgo_ts + 18475, Fenc: uint8(SQLITE_UTF16LE), }, 3: { - FzName: __ccgo_ts + 18450, + FzName: __ccgo_ts + 18484, Fenc: uint8(SQLITE_UTF16BE), }, 4: { - FzName: __ccgo_ts + 18459, + FzName: __ccgo_ts + 18493, Fenc: uint8(SQLITE_UTF16LE), }, 5: { - FzName: __ccgo_ts + 18467, + FzName: __ccgo_ts + 18501, Fenc: uint8(SQLITE_UTF16BE), }, 6: { - FzName: __ccgo_ts + 18475, + FzName: __ccgo_ts + 18509, }, 7: { - FzName: __ccgo_ts + 18482, + FzName: __ccgo_ts + 18516, }, 8: {}, } @@ -118747,34 +119909,35 @@ func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg _ = argc _ = argv _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18539) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18573) i = 0 j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) for { if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { break } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18554, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18588, libc.VaList(bp+240, int32(cSep), _pragCName[j])) cSep = uint8(',') goto _1 _1: + ; i++ j++ } if i == 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18561, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18595, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18567) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18601) j++ } if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18579) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18613) j++ } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) _sqlite3StrAccumFinish(tls, bp) _ = libc.Int32FromInt32(0) rc = Xsqlite3_declare_vtab(tls, db, bp+32) @@ -118850,6 +120013,7 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 seen[j] = i + int32(1) goto _1 _1: + ; i++ pConstraint += 12 } @@ -118862,6 +120026,8 @@ func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) @@ -118905,6 +120071,7 @@ func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) goto _1 _1: + ; i++ } } @@ -118980,17 +120147,18 @@ func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr } goto _2 _2: + ; i++ j++ } _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) - Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18594) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18628) if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18602, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18636, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) } Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18606, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18640, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) } zSql = _sqlite3StrAccumFinish(tls, bp) if zSql == uintptr(0) { @@ -119127,24 +120295,24 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) /* A error message has already been generated. Do not overwrite it */ } else { if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { - *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18640, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18674, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) } else { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140697)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) } else { if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - v1 = __ccgo_ts + 5083 + v1 = __ccgo_ts + 5108 } zObj = v1 - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18668, libc.VaList(bp+8, zObj)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18702, libc.VaList(bp+8, zObj)) if zExtra != 0 && *(*uint8)(unsafe.Pointer(zExtra)) != 0 { - z = _sqlite3MPrintf(tls, db, __ccgo_ts+18699, libc.VaList(bp+8, z, zExtra)) + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18733, libc.VaList(bp+8, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z - (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140704)) + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) } } } @@ -119152,9 +120320,9 @@ func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) } var _azAlterType = [3]uintptr{ - 0: __ccgo_ts + 18610, - 1: __ccgo_ts + 18617, - 2: __ccgo_ts + 18629, + 0: __ccgo_ts + 18644, + 1: __ccgo_ts + 18651, + 2: __ccgo_ts + 18663, } // C documentation @@ -119177,6 +120345,7 @@ func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) } goto _1 _1: + ; p = (*TIndex)(unsafe.Pointer(p)).FpNext } return 0 @@ -119233,7 +120402,7 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) @@ -119268,11 +120437,11 @@ func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr } else { pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) if pIndex == uintptr(0) { - _corruptSchema(tls, pData, argv, __ccgo_ts+18707) + _corruptSchema(tls, pData, argv, __ccgo_ts+18741) } else { if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { if _sqlite3Config.FbExtraSchemaChecks != 0 { - _corruptSchema(tls, pData, argv, __ccgo_ts+14491) + _corruptSchema(tls, pData, argv, __ccgo_ts+14516) } } } @@ -119316,18 +120485,18 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** table name will be inserted automatically by the parser so we can just ** use the abbreviation "x" here. The parser will also automatically tag ** the schema table as read-only. */ - (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9033 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9058 if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v2 = __ccgo_ts + 6508 + v2 = __ccgo_ts + 6533 } else { - v2 = __ccgo_ts + 6041 + v2 = __ccgo_ts + 6066 } v1 = v2 zSchemaTabName = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8105 - (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18720 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8130 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18754 (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb @@ -119389,6 +120558,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) goto _4 _4: + ; i++ } if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { @@ -119416,7 +120586,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl } else { /* If opening an attached database, the encoding much match ENC(db) */ if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12070) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12095) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119442,7 +120612,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) } if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18792) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18826) rc = int32(SQLITE_ERROR) goto initone_error_out } @@ -119458,7 +120628,7 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl */ _ = libc.Int32FromInt32(0) (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) - zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18816, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18850, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) @@ -119497,11 +120667,13 @@ func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl ** before that point, jump to error_out. */ initone_error_out: + ; if openedTransaction != 0 { _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) } _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) error_out: + ; if rc != 0 { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (nBytes == 0 || int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) if nBytes > mxLen { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18880, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18914, 0) rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) goto end_prepare } @@ -119956,6 +121132,7 @@ func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prep _sqlite3DbFree(tls, db, pT) } end_prepare: + ; _sqlite3ParseObjectReset(tls, bp) return rc } @@ -119967,7 +121144,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 cnt = 0 *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { - return _sqlite3MisuseError(tls, int32(141505)) + return _sqlite3MisuseError(tls, int32(141699)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) @@ -119982,6 +121159,7 @@ func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int3 } goto _6 _6: + ; if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { z = zSql @@ -120120,6 +121298,7 @@ func _sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, pr } goto _1 _1: + ; sz += int32(2) } nBytes = sz @@ -120505,6 +121684,7 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _2 _2: + ; j++ } if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { @@ -120513,18 +121693,19 @@ func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } goto _1 _1: + ; i++ } if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { - zSp1 = __ccgo_ts + 11177 - zSp2 = __ccgo_ts + 11177 + zSp1 = __ccgo_ts + 11202 + zSp2 = __ccgo_ts + 11202 if pB == uintptr(0) { zSp1++ } if pC == uintptr(0) { zSp2++ } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18899, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18933, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) jointype = int32(JT_INNER) } return jointype @@ -120597,6 +121778,7 @@ func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { } goto _1 _1: + ; pCol += 16 i++ } @@ -120656,6 +121838,7 @@ func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, } goto _1 _1: + ; i++ } return 0 @@ -120708,6 +121891,7 @@ func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) goto _1 _1: + ; i++ } } @@ -120758,6 +121942,7 @@ func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) goto _1 _1: + ; i++ } } @@ -120823,7 +122008,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { pUsing = uintptr(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18929, libc.VaList(bp+16, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18963, libc.VaList(bp+16, 0)) return int32(1) } j = 0 @@ -120845,6 +122030,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _3 _3: + ; j++ } if pUsing != 0 { @@ -120875,7 +122061,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18979, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19013, libc.VaList(bp+16, zName1)) return int32(1) } pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) @@ -120897,7 +122083,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19043, libc.VaList(bp+16, zName1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19077, libc.VaList(bp+16, zName1)) break } pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) @@ -120921,6 +122107,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) goto _4 _4: + ; j++ } } else { @@ -120933,6 +122120,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ pRight += 104 pLeft += 104 @@ -120941,7 +122129,7 @@ func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { } var _tkCoalesce = TToken{ - Fz: __ccgo_ts + 6705, + Fz: __ccgo_ts + 6730, Fn: uint32(8), } @@ -121201,7 +122389,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe switch eTnctType { - case int32(WHERE_DISTINCT_ORDERED): + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ /* Allocate space for the previous row */ v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) regPrev = v1 @@ -121223,6 +122411,7 @@ func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, a _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _2 _2: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121363,6 +122552,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) goto _3 _3: + ; i++ } } else { @@ -121392,6 +122582,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _4 _4: + ; i++ } /* Adjust nResultCol to account for columns that are omitted @@ -121408,6 +122599,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -121549,9 +122741,9 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _ = libc.Int32FromInt32(0) /* The LIMIT clause will jump out of the loop for us */ } - case int32(SRT_Coroutine): + case int32(SRT_Coroutine): /* Send data to a co-routine */ fallthrough - case int32(SRT_Output): + case int32(SRT_Output): /* Return the results */ if pSort != 0 { _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) } else { @@ -121598,6 +122790,7 @@ func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pS _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) goto _7 _7: + ; i++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) @@ -121718,6 +122911,7 @@ func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, i *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags goto _1 _1: + ; i++ pItem += 32 } @@ -121735,13 +122929,13 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { _ = z switch id { case int32(TK_ALL): - z = __ccgo_ts + 19080 + z = __ccgo_ts + 19114 case int32(TK_INTERSECT): - z = __ccgo_ts + 19090 + z = __ccgo_ts + 19124 case int32(TK_EXCEPT): - z = __ccgo_ts + 19100 + z = __ccgo_ts + 19134 default: - z = __ccgo_ts + 19107 + z = __ccgo_ts + 19141 break } return z @@ -121762,7 +122956,7 @@ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+8, zUsage)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+8, zUsage)) } /* @@ -121797,11 +122991,11 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nRefKey = 0 aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { - v1 = __ccgo_ts + 19136 + v1 = __ccgo_ts + 19170 } else { v1 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19151, libc.VaList(bp+8, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19185, libc.VaList(bp+8, v1)) _ = libc.Int32FromInt32(0) if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) @@ -121865,6 +123059,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, } goto _6 _6: + ; i++ } i = nColumn - int32(1) @@ -121882,6 +123077,7 @@ func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) goto _7 _7: + ; i-- } switch eDest { @@ -121996,6 +123192,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr } goto _1 _1: + ; j++ } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { @@ -122031,7 +123228,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && iCol >= 0 { + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC @@ -122047,7 +123244,7 @@ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr _ = libc.Int32FromInt32(0) if iCol < 0 { zType = __ccgo_ts + 1136 - *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16660 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16694 } else { *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) @@ -122117,6 +123314,7 @@ func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pELis _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) goto _1 _1: + ; i++ } } @@ -122199,13 +123397,13 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } _ = libc.Int32FromInt32(0) if iCol < 0 { - zCol = __ccgo_ts + 16660 + zCol = __ccgo_ts + 16694 } else { zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } if fullName != 0 { zName1 = uintptr(0) - zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) } else { _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) @@ -122213,7 +123411,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName if z == uintptr(0) { - v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+8, i+int32(1))) + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+8, i+int32(1))) } else { v2 = _sqlite3DbStrDup(tls, db, z) } @@ -122223,6 +123421,7 @@ func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } goto _1 _1: + ; i++ } _generateColumnTypes(tls, pParse, pTabList, pEList) @@ -122306,7 +123505,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if iCol >= 0 { v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName } else { - v3 = __ccgo_ts + 16660 + v3 = __ccgo_ts + 16694 } zName = v3 } else { @@ -122322,7 +123521,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { zName = _sqlite3DbStrDup(tls, db, zName) } else { - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19182, libc.VaList(bp+40, i+int32(1))) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19216, libc.VaList(bp+40, i+int32(1))) } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. @@ -122349,6 +123548,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _7 _7: + ; j-- } if int32(*(*uint8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { @@ -122357,7 +123557,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } *(*Tu32)(unsafe.Pointer(bp))++ v8 = *(*Tu32)(unsafe.Pointer(bp)) - zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19191, libc.VaList(bp+40, nName, zName, v8)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19225, libc.VaList(bp+40, nName, zName, v8)) _sqlite3ProgressCheck(tls, pParse) if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { Xsqlite3_randomness(tls, int32(4), bp) @@ -122374,6 +123574,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, } goto _1 _1: + ; i++ pCol += 16 } @@ -122387,6 +123588,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) goto _10 _10: + ; j++ } _sqlite3DbFree(tls, db, aCol) @@ -122456,6 +123658,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) goto _2 _2: + ; pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext } if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { @@ -122472,7 +123675,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { - zType = __ccgo_ts + 19199 + zType = __ccgo_ts + 19233 } else { zType = uintptr(0) j = int32(1) @@ -122486,6 +123689,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _3 _3: + ; j++ } } @@ -122509,6 +123713,7 @@ func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pS } goto _1 _1: + ; i++ pCol += 16 } @@ -122733,6 +123938,7 @@ func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags goto _2 _2: + ; i++ } } @@ -122791,7 +123997,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest iDistinct = 0 /* To ensure unique results if UNION */ eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19203, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19237, 0) return } /* Obtain authorization to do a recursive query */ @@ -122822,6 +124028,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _2 _2: + ; i++ } /* Allocate cursors numbers for Queue and Distinct. The cursor number for @@ -122883,7 +124090,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest break } if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19252, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19286, 0) goto end_of_recursive_query } (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) @@ -122892,12 +124099,13 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest } goto _11 _11: + ; pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior } /* Store the results of the setup-query in Queue. */ pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19294, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19328, 0) rc = _sqlite3Select(tls, pParse, pSetup, bp) (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p if rc != 0 { @@ -122925,7 +124133,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest ** the value for the recursive-table. Store the results in the Queue. */ (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19300, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19334, 0) _sqlite3Select(tls, pParse, p, bp) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -122933,6 +124141,7 @@ func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest _sqlite3VdbeGoto(tls, v, addrTop) _sqlite3VdbeResolveLabel(tls, v, addrBreak) end_of_recursive_query: + ; _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit @@ -122984,9 +124193,9 @@ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if nRow == int32(1) { v1 = __ccgo_ts + 1648 } else { - v1 = __ccgo_ts + 19315 + v1 = __ccgo_ts + 19349 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19317, libc.VaList(bp+8, nRow, v1)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19351, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { @@ -123101,8 +124310,8 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in return _multiSelectOrderBy(tls, pParse, p, pDest) } else { if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19340, 0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19355, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19389, 0) } /* Generate code for the left and right SELECT statements. */ @@ -123128,7 +124337,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) } } - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19080, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19114, 0) rc = _sqlite3Select(tls, pParse, p, bp) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123141,7 +124350,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } case int32(TK_EXCEPT): fallthrough - case int32(TK_UNION): + case int32(TK_UNION): /* Cursor number of the temp table holding result */ op = uint8(0) priorOp = int32(SRT_Union) if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { @@ -123185,7 +124394,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+48) _ = libc.Int32FromInt32(0) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior @@ -123251,7 +124460,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19374, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19408, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) rc = _sqlite3Select(tls, pParse, p, bp+88) pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior @@ -123321,6 +124530,7 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in } goto _7 _7: + ; i++ apColl += 8 } @@ -123346,15 +124556,18 @@ func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r in *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) goto _9 _9: + ; i++ } goto _8 _8: + ; pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior } _sqlite3KeyInfoUnref(tls, pKeyInfo) } multi_select_end: + ; (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst if pDelete != 0 { @@ -123373,9 +124586,9 @@ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19395, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19429, 0) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19441, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19475, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) } } @@ -123633,6 +124846,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _2 _2: + ; j++ pItem += 32 } @@ -123654,6 +124868,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr } goto _1 _1: + ; i++ } } @@ -123682,6 +124897,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) goto _5 _5: + ; i++ pItem1 += 32 } @@ -123713,6 +124929,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) goto _6 _6: + ; i++ } } @@ -123730,6 +124947,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) goto _7 _7: + ; pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior } } @@ -123745,6 +124963,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior goto _8 _8: + ; i += int32(2) } } @@ -123755,8 +124974,8 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) - _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7342) - _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7342) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7367) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7367) /* Compute the limit registers */ _computeLimitRegisters(tls, pParse, p, labelEnd) if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { @@ -123800,14 +125019,14 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr regOutB = v21 _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19523, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19557, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19534, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19568, 0) _sqlite3Select(tls, pParse, pPrior, bp) _sqlite3VdbeEndCoroutine(tls, v, regAddrA) _sqlite3VdbeJumpHere(tls, v, addr1) @@ -123820,7 +125039,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19539, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19573, 0) _sqlite3Select(tls, pParse, p, bp+40) (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -124038,7 +125257,7 @@ func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { if pColl != 0 { v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName } else { - v1 = __ccgo_ts + 5061 + v1 = __ccgo_ts + 5086 } pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) } @@ -124079,6 +125298,7 @@ func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -124111,11 +125331,13 @@ func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { } goto _4 _4: + ; i-- pItem += 104 } goto _3 _3: + ; if v2 = doPrior != 0; v2 { v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior p = v1 @@ -124209,11 +125431,13 @@ func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSr _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) goto _4 _4: + ; p = (*TSelect)(unsafe.Pointer(p)).FpPrior } } goto _1 _1: + ; i++ pItem += 104 } @@ -124335,10 +125559,12 @@ func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { } goto _2 _2: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } goto _1 _1: + ; ii++ } return 0 @@ -124647,6 +125873,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _1 _1: + ; pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior } /* Restriction (18). */ @@ -124661,6 +125888,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA } goto _2 _2: + ; ii++ } } @@ -124771,6 +125999,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _ = libc.Int32FromInt32(0) goto _3 _3: + ; pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } _sqlite3DbFree(tls, db, aCsrMap) @@ -124870,6 +126099,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA libc.Xmemset(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104)) goto _8 _8: + ; i++ } p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 @@ -124908,6 +126138,7 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _12 _12: + ; i++ } _ = libc.Int32FromInt32(0) @@ -124959,10 +126190,12 @@ func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isA _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) goto _13 _13: + ; i++ } goto _7 _7: + ; pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior } @@ -125043,6 +126276,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr } goto _1 _1: + ; i++ } if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { @@ -125149,6 +126383,7 @@ func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintp break goto _1 _1: + ; i++ } return int32(WRC_Prune) @@ -125404,6 +126639,10 @@ func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr ui // ** // ** (11) The subquery is not a VALUES clause // ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** // ** Return 0 if no changes are made and non-zero if one or more WHERE clause // ** terms are duplicated into the subquery. // */ @@ -125443,6 +126682,7 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } /* restriction (6b) */ goto _1 _1: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } if notUnionAll != 0 { @@ -125467,10 +126707,12 @@ func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere ui } goto _3 _3: + ; ii++ } goto _2 _2: + ; pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } } @@ -125562,6 +126804,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed @@ -125584,6 +126827,7 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) } goto _2 _2: + ; j++ } } @@ -125617,10 +126861,12 @@ func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) nChng++ goto _6 _6: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } goto _4 _4: + ; j++ } return nChng @@ -125661,13 +126907,13 @@ func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r } _ = libc.Int32FromInt32(0) zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15516) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15550) == 0 { eRet = int32(WHERE_ORDERBY_MIN) if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { sortFlags = uint8(KEYINFO_ORDER_BIGNULL) } } else { - if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15520) == 0 { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15554) == 0 { eRet = int32(WHERE_ORDERBY_MAX) sortFlags = uint8(KEYINFO_ORDER_DESC) } else { @@ -125759,10 +127005,11 @@ func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r in } goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if !(pIdx != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19545, libc.VaList(bp+8, zIndexedBy, 0)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19579, libc.VaList(bp+8, zIndexedBy, 0)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) return int32(SQLITE_ERROR) } @@ -125814,6 +127061,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _1 _1: + ; pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior } if pX == uintptr(0) { @@ -125838,6 +127086,7 @@ func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) } goto _2 _2: + ; i-- } if i < 0 { @@ -125887,7 +127136,7 @@ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19563, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19597, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 @@ -125928,6 +127177,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _2 _2: + ; i++ } if (*TWith)(unsafe.Pointer(p)).FbView != 0 { @@ -125935,6 +127185,7 @@ func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) } goto _1 _1: + ; p = (*TWith)(unsafe.Pointer(p)).FpOuter } return uintptr(0) @@ -126067,7 +127318,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) _ = libc.Int32FromInt32(0) if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19586, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19620, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) return int32(2) } libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) @@ -126092,7 +127343,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19606, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19640, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) return int32(2) } *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) @@ -126106,6 +127357,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _3 _3: + ; i++ } if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { @@ -126113,7 +127365,7 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior } - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19649 + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19683 pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { @@ -126143,12 +127395,13 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom } goto _6 _6: + ; pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior } pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19672, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19706, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return int32(2) } @@ -126157,9 +127410,9 @@ func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) if bMayRecursive != 0 { if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { - (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19710 - } else { (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19744 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19778 } _sqlite3WalkSelect(tls, pWalker, pSel) } @@ -126220,13 +127473,14 @@ func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19782, libc.VaList(bp+8, pFrom)) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19816, libc.VaList(bp+8, pFrom)) } for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior } _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) _ = libc.Int32FromInt32(0) /* The usual case - do not allow ROWID on a subquery */ @@ -126383,7 +127637,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { return int32(WRC_Abort) } if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19786, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19820, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return int32(WRC_Abort) } @@ -126399,7 +127653,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { _ = libc.Int32FromInt32(0) if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19825, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19859, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { FpSelect uintptr @@ -126414,7 +127668,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15084, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15109, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) } } _ = libc.Int32FromInt32(0) @@ -126433,6 +127687,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _3 _3: + ; i++ pFrom += 104 } @@ -126470,6 +127725,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags goto _6 _6: + ; k++ } if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { @@ -126549,7 +127805,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if iDb >= 0 { v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName } else { - v10 = __ccgo_ts + 6565 + v10 = __ccgo_ts + 6590 } zSchemaName = v10 } @@ -126567,18 +127823,22 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { if pNew != 0 { pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 _ = libc.Int32FromInt32(0) - (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19856, libc.VaList(bp+8, zUName)) + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19890, libc.VaList(bp+8, zUName)) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) } goto _11 _11: + ; ii++ } } else { pUsing = uintptr(0) } - nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + libc.BoolInt32((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0) + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } j = 0 for { if !(j < nAdd) { @@ -126641,10 +127901,11 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 _ = libc.Int32FromInt32(0) if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { - if pNestedFrom != 0 { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { + _ = libc.Int32FromInt32(0) (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) } else { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19861, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19895, libc.VaList(bp+8, zSchemaName, zTabName, zName)) } if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { v13 = int32(ENAME_ROWID) @@ -126657,7 +127918,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } } else { if longNames != 0 { - (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12356, libc.VaList(bp+8, zTabName, zName)) + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12381, libc.VaList(bp+8, zTabName, zName)) libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) } else { (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) @@ -126666,23 +127927,26 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } goto _12 _12: + ; j++ } goto _8 _8: + ; i++ pFrom += 104 } if !(tableSeen != 0) { if zTName != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19870, libc.VaList(bp+8, zTName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19904, libc.VaList(bp+8, zTName)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19888, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19922, 0) } } } goto _7 _7: + ; k++ } _sqlite3ExprListDelete(tls, db, pEList) @@ -126690,7 +127954,7 @@ func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { } if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19908, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19942, 0) return int32(WRC_Abort) } if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { @@ -126775,6 +128039,7 @@ func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { } goto _1 _1: + ; i++ pFrom += 104 } @@ -126880,6 +128145,7 @@ func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) @@ -126914,6 +128180,7 @@ func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect u } goto _1 _1: + ; j++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) @@ -126980,6 +128247,7 @@ func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) goto _1 _1: + ; i++ } } @@ -127048,12 +128316,12 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19939, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19973, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) } else { pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19990, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20024, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { @@ -127079,10 +128347,11 @@ func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20023, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20057, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } goto _1 _1: + ; i++ pFunc += 32 } @@ -127131,6 +128400,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) goto _2 _2: + ; j-- } if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { @@ -127145,6 +128415,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) goto _3 _3: + ; j-- } _sqlite3ReleaseTempReg(tls, pParse, regSubtype) @@ -127167,6 +128438,7 @@ func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) goto _1 _1: + ; i++ pF += 32 } @@ -127288,6 +128560,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) goto _5 _5: + ; kk++ jj++ } @@ -127328,6 +128601,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) goto _6 _6: + ; j++ pItem += 32 } @@ -127353,6 +128627,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui } goto _1 _1: + ; i++ pF += 32 } @@ -127372,6 +128647,7 @@ func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo ui _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) goto _9 _9: + ; i++ pC += 24 } @@ -127396,7 +128672,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { - v1 = __ccgo_ts + 20056 + v1 = __ccgo_ts + 20090 } else { v1 = __ccgo_ts + 1648 } @@ -127405,7 +128681,7 @@ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintp } else { v2 = __ccgo_ts + 1648 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20079, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20113, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } @@ -127437,7 +128713,7 @@ func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int3 ** statements AggInfo structure. */ if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) if pNew != 0 { pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere t = *(*TExpr)(unsafe.Pointer(pNew)) @@ -127597,7 +128873,7 @@ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32 return 0 } /* Result is an aggregate */ _ = libc.Int32FromInt32(0) - if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15810) != 0 { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15844) != 0 { return 0 } /* Is count() */ _ = libc.Int32FromInt32(0) @@ -127701,6 +128977,7 @@ func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -127869,7 +129146,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20091, libc.VaList(bp+176, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20125, libc.VaList(bp+176, v1)) goto select_end } /* Clear the SF_UFSrcCheck flag. The check has already been performed, @@ -127945,6 +129222,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _5 _5: + ; j++ } j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) @@ -127959,6 +129237,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _8 _8: + ; j-- } } @@ -127970,7 +129249,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20145, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20179, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end } /* Do not attempt the usual optimizations (flattening and ORDER BY @@ -128054,6 +129333,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _2 _2: + ; i++ } /* Handle compound SELECT statements using the separate multiSelect() @@ -128153,7 +129433,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20185, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20219, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) @@ -128201,7 +129481,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } else { } _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20200, libc.VaList(bp+176, pItem1)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20234, libc.VaList(bp+176, pItem1)) _sqlite3Select(tls, pParse, pSub1, bp+72) (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow if onceAddr != 0 { @@ -128227,6 +129507,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext goto _10 _10: + ; i++ } /* Various elements of the SELECT copied into local variables for @@ -128296,6 +129577,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- goto _19 _19: + ; ii-- } ii = 0 @@ -128308,6 +129590,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _20 _20: + ; ii++ } } @@ -128421,6 +129704,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _27 _27: + ; k-- pItem2 += 32 } @@ -128436,6 +129720,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) goto _28 _28: + ; k-- pItem2 += 32 } @@ -128466,6 +129751,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags goto _29 _29: + ; ii1++ } if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { @@ -128613,11 +129899,11 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r groupBySort = 0 } else { if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { - v44 = __ccgo_ts + 20216 + v44 = __ccgo_ts + 20250 } else { - v44 = __ccgo_ts + 20225 + v44 = __ccgo_ts + 20259 } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19113, libc.VaList(bp+176, v44)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19147, libc.VaList(bp+176, v44)) groupBySort = int32(1) nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr nCol = nGroupBy @@ -128633,6 +129919,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _45 _45: + ; i++ } regBase = _sqlite3GetTempRange(tls, pParse, nCol) @@ -128651,6 +129938,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _46 _46: + ; i++ } (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) @@ -128712,6 +130000,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _50 _50: + ; j++ } _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) @@ -128829,6 +130118,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _54 _54: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -128873,6 +130163,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r } goto _55 _55: + ; i++ } if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { @@ -128936,7 +130227,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r _sqlite3VdbeResolveLabel(tls, v, addrEnd) } /* endif aggregate query */ if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { - _explainTempTable(tls, pParse, __ccgo_ts+20216) + _explainTempTable(tls, pParse, __ccgo_ts+20250) } /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -128955,6 +130246,7 @@ func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r ** successful coding of the SELECT. */ select_end: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) @@ -129053,12 +130345,13 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z goto _1 _1: + ; i++ } } else { if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) - (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20234, 0) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20268, 0) (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) return int32(1) } @@ -129087,12 +130380,14 @@ func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z goto _4 _4: + ; i++ } (*TTabResult)(unsafe.Pointer(p)).FnRow++ } return 0 malloc_failed: + ; (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return int32(1) } @@ -129199,6 +130494,7 @@ func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, azResult) @@ -129315,7 +130611,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if isTemp != 0 { /* If TEMP was specified, then the trigger name may not be qualified. */ if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20299, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20333, 0) goto trigger_cleanup } iDb = int32(1) @@ -129356,7 +130652,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } _ = libc.Int32FromInt32(0) - _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20345, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20379, *(*uintptr)(unsafe.Pointer(bp))) if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { goto trigger_cleanup } @@ -129366,11 +130662,11 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_orphan_error } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20353, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20387, 0) goto trigger_orphan_error } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20394, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20428, 0) goto trigger_orphan_error } /* Check that the trigger name is not reserved and that no trigger of the @@ -129380,14 +130676,14 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) goto trigger_cleanup } - if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20345, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20379, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { goto trigger_cleanup } _ = libc.Int32FromInt32(0) if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20434, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20468, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) } else { _ = libc.Int32FromInt32(0) _sqlite3CodeVerifySchema(tls, pParse, iDb) @@ -129396,8 +130692,8 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 } } /* Do not create a trigger on a system table */ - if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6500, int32(7)) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20460, 0) + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6525, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20494, 0) goto trigger_cleanup } /* INSTEAD of triggers are only for views and views only support INSTEAD @@ -129405,15 +130701,15 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 */ if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { if tr_tm == int32(TK_BEFORE) { - v1 = __ccgo_ts + 20498 + v1 = __ccgo_ts + 20532 } else { - v1 = __ccgo_ts + 20505 + v1 = __ccgo_ts + 20539 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20511, libc.VaList(bp+112, v1, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20545, libc.VaList(bp+112, v1, pTableName+8)) goto trigger_orphan_error } if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20548, libc.VaList(bp+112, pTableName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20582, libc.VaList(bp+112, pTableName+8)) goto trigger_orphan_error } if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { @@ -129433,9 +130729,9 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 goto trigger_cleanup } if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { - v3 = __ccgo_ts + 6508 + v3 = __ccgo_ts + 6533 } else { - v3 = __ccgo_ts + 6041 + v3 = __ccgo_ts + 6066 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { goto trigger_cleanup @@ -129478,6 +130774,7 @@ func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 _ = libc.Int32FromInt32(0) (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger trigger_cleanup: + ; _sqlite3DbFree(tls, db, zName) _sqlite3SrcListDelete(tls, db, pTableName) _sqlite3IdListDelete(tls, db, pColumns) @@ -129489,6 +130786,7 @@ trigger_cleanup: } return trigger_orphan_error: + ; if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { /* Ticket #3810. ** Normally, whenever a table is dropped, all associated triggers are @@ -129533,7 +130831,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext } _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) - _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20345, bp+96) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20379, bp+96) if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { goto triggerfinish_cleanup } @@ -129556,11 +130854,12 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl break } if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20594, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20628, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) goto triggerfinish_cleanup } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } } @@ -129571,10 +130870,10 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20642, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20676, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) _sqlite3DbFree(tls, db, z) _sqlite3ChangeCookie(tls, pParse, iDb) - _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20717, libc.VaList(bp+120, zName)), uint16(0)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20751, libc.VaList(bp+120, zName)), uint16(0)) } } if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { @@ -129595,6 +130894,7 @@ func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAl } } triggerfinish_cleanup: + ; _sqlite3DeleteTrigger(tls, db, pTrig) _ = libc.Int32FromInt32(0) _sqlite3DeleteTriggerStep(tls, db, pStepList) @@ -129622,6 +130922,7 @@ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r } goto _1 _1: + ; i++ } } @@ -129842,11 +131143,12 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } goto _1 _1: + ; i++ } if !(pTrigger != 0) { if !(noErr != 0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20746, libc.VaList(bp+8, pName+8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20780, libc.VaList(bp+8, pName+8)) } else { _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) } @@ -129855,6 +131157,7 @@ func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int } _sqlite3DropTriggerPtr(tls, pParse, pTrigger) drop_trigger_cleanup: + ; _sqlite3SrcListDelete(tls, db, pName) } @@ -129888,9 +131191,9 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { code = int32(SQLITE_DROP_TRIGGER) zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { - v1 = __ccgo_ts + 6508 + v1 = __ccgo_ts + 6533 } else { - v1 = __ccgo_ts + 6041 + v1 = __ccgo_ts + 6066 } zTab = v1 if iDb == int32(1) { @@ -129905,7 +131208,7 @@ func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { v2 = _sqlite3GetVdbe(tls, pParse) v = v2 if v2 != uintptr(0) { - _sqlite3NestedParse(tls, pParse, __ccgo_ts+20766, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20800, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) } @@ -129937,6 +131240,7 @@ func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 } } @@ -129973,6 +131277,7 @@ func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int3 } goto _1 _1: + ; e++ } return 0 @@ -130039,11 +131344,11 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { - v1 = __ccgo_ts + 20828 + v1 = __ccgo_ts + 20862 } else { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20842, libc.VaList(bp+8, v1)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20876, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { @@ -130061,6 +131366,7 @@ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, } } exit_triggers_exist: + ; if pMask != 0 { *(*int32)(unsafe.Pointer(pMask)) = mask } @@ -130148,7 +131454,7 @@ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20890, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20924, 0) return int32(1) } @@ -130193,6 +131499,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _2 _2: + ; jj++ } } else { @@ -130206,6 +131513,7 @@ func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab } goto _1 _1: + ; i++ } return pNew @@ -130287,6 +131595,7 @@ func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab } goto _3 _3: + ; i++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) @@ -130343,7 +131652,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) _ = libc.Int32FromInt32(0) if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { - _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6238, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6263, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) } switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { case int32(TK_UPDATE): @@ -130365,6 +131674,7 @@ func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orcon } goto _1 _1: + ; pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext } return 0 @@ -130449,7 +131759,7 @@ func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintp v = _sqlite3GetVdbe(tls, bp+56) if v != 0 { if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { - _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20932, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20966, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) } /* If one was specified, code the WHEN clause. If it evaluates to false ** (or NULL) the sub-vdbe is immediately halted by jumping to the @@ -130517,6 +131827,7 @@ func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt } goto _2 _2: + ; pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext } /* If an existing TriggerPrg could not be located, create a new one. */ @@ -130634,6 +131945,7 @@ func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op } goto _1 _1: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } @@ -130698,6 +132010,7 @@ func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pCh } goto _2 _2: + ; p = (*TTrigger)(unsafe.Pointer(p)).FpNext } return mask @@ -130901,6 +132214,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) goto _1 _1: + ; i++ } if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { @@ -130919,6 +132233,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) goto _3 _3: + ; i++ } eDest = int32(SRT_Table) @@ -130942,6 +132257,7 @@ func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, p pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) goto _5 _5: + ; i++ } } @@ -131078,6 +132394,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui (*TParse)(unsafe.Pointer(pParse)).FnTab++ goto _6 _6: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nIdx++ } @@ -131107,6 +132424,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) goto _7 _7: + ; i++ } /* Initialize the name-context */ @@ -131155,7 +132473,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui chngPk = uint8(1) } else { if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20946, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20980, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) goto update_cleanup } } @@ -131165,6 +132483,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _10 _10: + ; j++ } if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -131174,13 +132493,13 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr iRowidExpr = i } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) goto update_cleanup } } if j < 0 { - v11 = __ccgo_ts + 7880 + v11 = __ccgo_ts + 7905 } else { v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName } @@ -131194,6 +132513,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _9 _9: + ; i++ } _ = libc.Int32FromInt32(0) @@ -131227,6 +132547,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _12 _12: + ; i++ } } @@ -131282,6 +132603,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _17 _17: + ; i++ } } @@ -131291,6 +132613,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg goto _14 _14: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext nAllIdx++ } @@ -131513,6 +132836,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) goto _40 _40: + ; i++ } if eOnePass != 0 { @@ -131583,6 +132907,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) goto _42 _42: + ; i++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) @@ -131641,6 +132966,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _44 _44: + ; i++ } if int32(chngRowid) == 0 && pPk == uintptr(0) { @@ -131706,6 +133032,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _45 _45: + ; i++ k++ } @@ -131756,6 +133083,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui } goto _47 _47: + ; i++ k++ } @@ -131867,9 +133195,10 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui ** that information. */ if regRowCount != 0 { - _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21001) + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21035) } update_cleanup: + ; _sqlite3AuthContextPop(tls, bp) _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ _sqlite3SrcListDelete(tls, db, pTabList) @@ -131966,6 +133295,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _3 _3: + ; i++ } _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) @@ -132000,6 +133330,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp } goto _8 _8: + ; i++ } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { @@ -132051,6 +133382,7 @@ func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintp _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) goto _9 _9: + ; i++ } } @@ -132166,7 +133498,7 @@ func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // ** Return SQLITE_OK if everything works, or an error code is something // ** is wrong. // */ -func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) (r int32) { +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { bp := tls.Alloc(240) defer tls.Free(240) var iCursor, ii, jj, nClause, nn, rc int32 @@ -132275,6 +133607,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _6 _6: + ; jj++ } if jj >= nn { @@ -132283,6 +133616,7 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr } goto _5 _5: + ; ii++ } if ii < nn { @@ -132291,22 +133625,32 @@ func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr goto _4 } (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } break goto _4 _4: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { (*(*[16]uint8)(unsafe.Pointer(bp + 200)))[0] = uint8(0) } else { - Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21014, libc.VaList(bp+224, nClause+int32(1))) + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21048, libc.VaList(bp+224, nClause+int32(1))) } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21018, libc.VaList(bp+224, bp+200)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21052, libc.VaList(bp+224, bp+200)) return int32(SQLITE_ERROR) } goto _1 _1: + ; pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert nClause++ } @@ -132327,14 +133671,20 @@ func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { return 0 } pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert - if pNext == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { - return int32(1) - } - if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { - return int32(1) + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert } return 0 } @@ -132397,10 +133747,11 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) goto _1 _1: + ; i++ } i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) - _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12445, -int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12470, -int32(1)) _sqlite3MayAbort(tls, pParse) _sqlite3VdbeJumpHere(tls, v, i) } @@ -132419,6 +133770,7 @@ func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab } goto _2 _2: + ; i++ } _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) @@ -132482,7 +133834,7 @@ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int3 ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ - if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21091, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21095, uint64(3)) == 0) { + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21125, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21129, uint64(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -132584,6 +133936,7 @@ func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) _sqlite3VdbeUsesBtree(tls, v, iDb) } build_vacuum_end: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) return } @@ -132609,17 +133962,17 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p pDb = uintptr(0) /* Name of output file */ pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21099) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21133) return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ } if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21139) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21173) return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ } saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags if pOut != 0 { if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21182) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21216) return int32(SQLITE_ERROR) } zOut = Xsqlite3_value_text(tls, pOut) @@ -132658,7 +134011,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** to write the journal header file. */ nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21200, libc.VaList(bp+24, zOut)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21234, libc.VaList(bp+24, zOut)) (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if rc != SQLITE_OK { goto end_of_vacuum @@ -132672,7 +134025,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p *(*Ti64)(unsafe.Pointer(bp)) = 0 if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0) && (_sqlite3OsFileSize(tls, id, bp) != SQLITE_OK || *(*Ti64)(unsafe.Pointer(bp)) > 0) { rc = int32(SQLITE_ERROR) - _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21223) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21257) goto end_of_vacuum } *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) @@ -132689,7 +134042,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ - rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14854) + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14879) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132720,11 +134073,11 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** in the temporary database. */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21250, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21284, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21358, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21392, libc.VaList(bp+24, zDbMain)) if rc != SQLITE_OK { goto end_of_vacuum } @@ -132733,7 +134086,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21412, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21446, libc.VaList(bp+24, zDbMain)) _ = libc.Int32FromInt32(0) *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) if rc != SQLITE_OK { @@ -132744,7 +134097,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p ** associated storage, so all we have to do is copy their entries ** from the schema table. */ - rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21563, libc.VaList(bp+24, zDbMain)) + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21597, libc.VaList(bp+24, zDbMain)) if rc != 0 { goto end_of_vacuum } @@ -132765,6 +134118,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p } goto _3 _3: + ; i += int32(2) } if pOut == uintptr(0) { @@ -132786,6 +134140,7 @@ func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) } end_of_vacuum: + ; /* Restore the original value of db->flags */ (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags @@ -132979,6 +134334,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) } goto _2 _2: + ; ii++ } if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { @@ -132988,6 +134344,7 @@ func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) goto _1 _1: + ; pThis = pNext } return SQLITE_OK @@ -133047,6 +134404,7 @@ func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { } goto _1 _1: + ; pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext } return pVtab @@ -133158,6 +134516,7 @@ func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 } } @@ -133247,6 +134606,7 @@ func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { } goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, (*(*struct { @@ -133284,7 +134644,7 @@ func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uint FazArg uintptr Fp uintptr })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12675, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12700, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { FnArg int32 @@ -133411,7 +134771,7 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { if pEnd != 0 { (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn } - zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21693, libc.VaList(bp+8, pParse+272)) + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21727, libc.VaList(bp+8, pParse+272)) /* A slot for the record has already been allocated in the ** schema table. We just need to update that slot with all ** the information we've collected. @@ -133421,11 +134781,11 @@ func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { ** by sqlite3StartTable(). */ iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) - _sqlite3NestedParse(tls, pParse, __ccgo_ts+21717, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21751, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) v = _sqlite3GetVdbe(tls, pParse) _sqlite3ChangeCookie(tls, pParse, iDb) _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) - zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21816, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21850, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) _sqlite3DbFree(tls, db, zStmt) v2 = pParse + 56 @@ -133515,11 +134875,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, break } if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21835, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21869, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(SQLITE_LOCKED) } goto _1 _1: + ; pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior } zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) @@ -133559,7 +134920,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, _ = libc.Int32FromInt32(0) if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21877, libc.VaList(bp+48, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21911, libc.VaList(bp+48, zModuleName)) } else { *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) @@ -133574,7 +134935,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { - zFormat = __ccgo_ts + 21907 + zFormat = __ccgo_ts + 21941 *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) _sqlite3VtabUnlock(tls, pVTable) rc = int32(SQLITE_ERROR) @@ -133608,11 +134969,12 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if !(i < nType) { break } - if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16551, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16585, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { break } goto _3 _3: + ; i++ } if i < nType { @@ -133630,6 +134992,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, *(*uint8)(unsafe.Pointer(zType + uintptr(j))) = *(*uint8)(unsafe.Pointer(zType + uintptr(j+nDel))) goto _5 _5: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { @@ -133645,6 +135008,7 @@ func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, } goto _2 _2: + ; iCol++ } } @@ -133689,7 +135053,7 @@ func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int FazArg uintptr Fp uintptr })(unsafe.Pointer(pTab + 64))).FazArg)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21953, libc.VaList(bp+16, zModule)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21987, libc.VaList(bp+16, zModule)) rc = int32(SQLITE_ERROR) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) @@ -133777,7 +135141,7 @@ func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, ** error. Otherwise, do nothing. */ if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21953, libc.VaList(bp+8, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21987, libc.VaList(bp+8, zMod)) rc = int32(SQLITE_ERROR) } else { rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -133812,9 +135176,9 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r i Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { - _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(154929))) + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) - return _sqlite3MisuseError(tls, int32(154931)) + return _sqlite3MisuseError(tls, int32(155157)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _ = libc.Int32FromInt32(0) @@ -133918,6 +135282,7 @@ func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) } goto _1 _1: + ; p = (*TVTable)(unsafe.Pointer(p)).FpNext } p = _vtabDisconnectAll(tls, db, pTab) @@ -133978,6 +135343,7 @@ func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { _sqlite3VtabUnlock(tls, pVTab) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, db, aVTrans) @@ -134018,6 +135384,7 @@ func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { } goto _1 _1: + ; i++ } (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans @@ -134085,6 +135452,7 @@ func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { } goto _1 _1: + ; i++ } /* Invoke the xBegin method. If successful, add the vtab to the @@ -134160,6 +135528,7 @@ func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32 } goto _1 _1: + ; i++ } } @@ -134269,6 +135638,7 @@ func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { } goto _2 _2: + ; i++ } n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) @@ -134405,7 +135775,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(p != 0) { - rc = _sqlite3MisuseError(tls, int32(155425)) + rc = _sqlite3MisuseError(tls, int32(155651)) } else { _ = libc.Int32FromInt32(0) ap = va @@ -134419,7 +135789,7 @@ func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r in case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) default: - rc = _sqlite3MisuseError(tls, int32(155447)) + rc = _sqlite3MisuseError(tls, int32(155673)) break } _ = ap @@ -135141,10 +136511,10 @@ type WhereInfo1 = TWhereInfo1 func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { - return __ccgo_ts + 21972 + return __ccgo_ts + 22006 } if i == -int32(1) { - return __ccgo_ts + 16660 + return __ccgo_ts + 16694 } return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName } @@ -135164,10 +136534,10 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, _ = i _ = libc.Int32FromInt32(0) if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135175,19 +136545,20 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21985, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22019, int32(1)) } i = 0 for { @@ -135195,15 +136566,16 @@ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, break } if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13090, int32(1)) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5083, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5108, int32(1)) goto _2 _2: + ; i++ } if nTerm > int32(1) { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } } @@ -135236,7 +136608,7 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21987, int32(2)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22021, int32(2)) i = 0 for { if !(i < int32(nEq)) { @@ -135244,27 +136616,28 @@ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22013, int32(5)) } if i >= int32(nSkip) { - v2 = __ccgo_ts + 21990 + v2 = __ccgo_ts + 22024 } else { - v2 = __ccgo_ts + 21995 + v2 = __ccgo_ts + 22029 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: + ; i++ } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22003) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22037) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { - _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22005) + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22039) } - Xsqlite3_str_append(tls, pStr, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5106, int32(1)) } // C documentation @@ -135307,11 +136680,11 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) if isSearch != 0 { - v2 = __ccgo_ts + 22007 + v2 = __ccgo_ts + 22041 } else { - v2 = __ccgo_ts + 22014 + v2 = __ccgo_ts + 22048 } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22019, libc.VaList(bp+144, v2, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22053, libc.VaList(bp+144, v2, pItem)) if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { zFmt = uintptr(0) _ = libc.Int32FromInt32(0) @@ -135319,37 +136692,37 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr _ = libc.Int32FromInt32(0) if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = __ccgo_ts + 11228 + zFmt = __ccgo_ts + 11253 } } else { if flags&uint32(WHERE_PARTIALIDX) != 0 { - zFmt = __ccgo_ts + 22025 + zFmt = __ccgo_ts + 22059 } else { if flags&uint32(WHERE_AUTO_INDEX) != 0 { - zFmt = __ccgo_ts + 22058 + zFmt = __ccgo_ts + 22092 } else { if flags&uint32(WHERE_IDX_ONLY) != 0 { - zFmt = __ccgo_ts + 22083 + zFmt = __ccgo_ts + 22117 } else { - zFmt = __ccgo_ts + 22101 + zFmt = __ccgo_ts + 22135 } } } } if zFmt != 0 { - Xsqlite3_str_append(tls, bp, __ccgo_ts+22110, int32(7)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22144, int32(7)) Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) _explainIndexRange(tls, bp, pLoop) } } else { if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { - zRowid = __ccgo_ts + 16660 - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22118, libc.VaList(bp+144, zRowid)) + zRowid = __ccgo_ts + 16694 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22152, libc.VaList(bp+144, zRowid)) if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { cRangeOp = uint8('=') } else { if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22149, libc.VaList(bp+144, zRowid)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22183, libc.VaList(bp+144, zRowid)) cRangeOp = uint8('<') } else { if flags&uint32(WHERE_BTM_LIMIT) != 0 { @@ -135360,10 +136733,10 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22159, libc.VaList(bp+144, int32(cRangeOp))) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22193, libc.VaList(bp+144, int32(cRangeOp))) } else { if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22164, libc.VaList(bp+144, (*(*struct { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22198, libc.VaList(bp+144, (*(*struct { FidxNum int32 F__ccgo4 uint8 FisOrdered Ti8 @@ -135382,7 +136755,7 @@ func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr } } if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22191, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, 0) } zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) @@ -135416,14 +136789,14 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22202, libc.VaList(bp+144, pItem)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22236, libc.VaList(bp+144, pItem)) pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) } else { - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22223, 0) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22257, 0) } } else { i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) @@ -135433,15 +136806,16 @@ func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintp } z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { - Xsqlite3_str_append(tls, bp, __ccgo_ts+21979, int32(5)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+22013, int32(5)) } - Xsqlite3_str_appendf(tls, bp, __ccgo_ts+21990, libc.VaList(bp+144, z)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22024, libc.VaList(bp+144, z)) goto _1 _1: + ; i++ } } - Xsqlite3_str_append(tls, bp, __ccgo_ts+5081, int32(1)) + Xsqlite3_str_append(tls, bp, __ccgo_ts+5106, int32(1)) zMsg = _sqlite3StrAccumFinish(tls, bp) ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) return ret @@ -135585,6 +136959,7 @@ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintpt } goto _1 _1: + ; i++ } } @@ -135666,6 +137041,7 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p } goto _2 _2: + ; i++ } _sqlite3ExprListDelete(tls, db, pOrigRhs) @@ -135700,11 +137076,13 @@ func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, p *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) goto _3 _3: + ; i++ } } goto _1 _1: + ; pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior } } @@ -135766,6 +137144,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _1 _1: + ; i++ } i = iEq @@ -135779,6 +137158,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(bp)) = 0 @@ -135894,6 +137274,7 @@ func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uint } goto _5 _5: + ; i++ } if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { @@ -136016,6 +137397,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) goto _3 _3: + ; j++ } } @@ -136069,6 +137451,7 @@ func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev i } goto _4 _4: + ; j++ } *(*uintptr)(unsafe.Pointer(pzAff)) = zAff @@ -136139,6 +137522,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } goto _3 _3: + ; i++ } _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) @@ -136180,6 +137564,7 @@ func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nRe _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) goto _1 _1: + ; i++ } } @@ -136222,6 +137607,7 @@ func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur i } goto _1 _1: + ; i++ pTerm += 56 } @@ -136371,6 +137757,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _6 _6: + ; j-- } addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk @@ -136435,6 +137822,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _7 _7: + ; j++ } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { @@ -136536,6 +137924,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _18 _18: + ; iIn++ } /* Generate code that will continue to the next row if @@ -136570,6 +137959,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _15 _15: + ; j++ } /* These registers need to be preserved in case there is an IN operator @@ -136996,6 +138386,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) goto _42 _42: + ; j++ } _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) @@ -137090,6 +138481,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104)) goto _48 _48: + ; k++ } } else { @@ -137180,6 +138572,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) goto _55 _55: + ; iTerm++ } if pAndExpr != 0 { @@ -137195,7 +138588,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22231, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22265, 0) ii = 0 for { if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { @@ -137218,7 +138611,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } /* Loop through table entries that match term pOrTerm. */ - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22246, libc.VaList(bp+96, ii+int32(1))) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22280, libc.VaList(bp+96, ii+int32(1))) pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) _ = libc.Int32FromInt32(0) if pSubWInfo != 0 { @@ -137253,6 +138646,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _59 _59: + ; iPk++ } /* Check if the temp table already contains this key. If so, @@ -137326,6 +138720,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } goto _56 _56: + ; ii++ } _sqlite3VdbeExplainPop(tls, pParse) @@ -137455,6 +138850,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) goto _61 _61: + ; j-- pTerm += 56 } @@ -137513,6 +138909,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) goto _63 _63: + ; j-- pTerm += 56 } @@ -137545,6 +138942,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) goto _65 _65: + ; iPk1++ } } @@ -137586,6 +138984,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI ** appropriate WHERE clause constraint checks. tag-20220513a. */ code_outer_join_constraints: + ; pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa j = libc.Int32FromInt32(0) for { @@ -137608,10 +139007,12 @@ code_outer_join_constraints: *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) goto _67 _67: + ; j++ pTerm += 56 } _66: + ; return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady } @@ -137697,7 +139098,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 mAll = uint64(0) - _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22255, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22289, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) k = 0 for { if !(k < iLevel) { @@ -137711,6 +139112,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe } goto _1 _1: + ; k++ } if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { @@ -137733,6 +139135,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) goto _2 _2: + ; k++ } } @@ -137767,6 +139170,7 @@ func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLe _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) goto _5 _5: + ; iPk++ } } @@ -138033,6 +139437,7 @@ func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintpt *(*uint8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*uint8)(unsafe.Pointer(zNew + uintptr(iFrom))) goto _2 _2: + ; iFrom++ } *(*uint8)(unsafe.Pointer(zNew + uintptr(iTo))) = uint8(0) @@ -138163,6 +139568,7 @@ func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 ui } goto _1 _1: + ; i++ } } @@ -138233,19 +139639,19 @@ var _aOp = [4]struct { FeOp2 uint8 }{ 0: { - FzOp: __ccgo_ts + 16509, + FzOp: __ccgo_ts + 16543, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { - FzOp: __ccgo_ts + 15840, + FzOp: __ccgo_ts + 15874, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { - FzOp: __ccgo_ts + 15319, + FzOp: __ccgo_ts + 15353, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { - FzOp: __ccgo_ts + 22269, + FzOp: __ccgo_ts + 22303, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } @@ -138368,6 +139774,7 @@ func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintp _ = libc.Int32FromInt32(0) goto _1 _1: + ; op++ } (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) @@ -138539,6 +139946,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _5 _5: + ; j++ pAndTerm += 56 } @@ -138565,6 +139973,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _3 _3: + ; i-- pOrTerm += 56 } @@ -138674,6 +140083,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) break goto _11 _11: + ; i-- pOrTerm += 56 } @@ -138720,11 +140130,13 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) } goto _13 _13: + ; i-- pOrTerm += 56 } goto _10 _10: + ; j1++ } /* At this point, okToChngToIN is true if original pTerm satisfies @@ -138752,6 +140164,7 @@ func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft goto _16 _16: + ; i-- pOrTerm += 56 } @@ -138850,6 +140263,7 @@ func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) } goto _1 _1: + ; i++ } } @@ -138903,14 +140317,17 @@ func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr } goto _4 _4: + ; i++ } goto _3 _3: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _2 _2: + ; j++ v1 = j if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { @@ -138954,10 +140371,12 @@ func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } goto _1 _1: + ; i++ } return 0 @@ -139051,7 +140470,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { extraRight = x - uint64(1) /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if prereqAll>>libc.Int32FromInt32(1) >= x { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } } else { @@ -139063,7 +140482,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite ** more like other systems, and also preserves legacy. */ if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22276, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22310, 0) return } *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) @@ -139154,7 +140573,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { _ = libc.Int32FromInt32(0) (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ - *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7866 + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7891 *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) @@ -139179,6 +140598,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew1, idxTerm) goto _8 _8: + ; i++ } } else { @@ -139234,6 +140654,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = _sqlite3UpperToLower[c] goto _11 _11: + ; i1++ } } @@ -139255,7 +140676,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { - v13 = __ccgo_ts + 22317 + v13 = __ccgo_ts + 22351 } else { v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } @@ -139308,6 +140729,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _exprAnalyze(tls, pSrc, pWC, idxNew3) goto _16 _16: + ; i2++ } pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 @@ -139330,6 +140752,7 @@ func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { _markTermAsChild(tls, pWC, idxNew4, idxTerm) goto _18 _18: + ; i3++ } } else { @@ -139528,6 +140951,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _1 _1: + ; ii++ } /* Check condition (5). Return early if it is not met. */ @@ -139549,6 +140973,7 @@ func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { } goto _2 _2: + ; ii++ } } @@ -139720,6 +141145,7 @@ func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) goto _1 _1: + ; i++ } } @@ -139747,6 +141173,7 @@ func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { _exprAnalyze(tls, pTabList, pWC, i) goto _1 _1: + ; i-- } } @@ -139787,7 +141214,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22324, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22358, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) return } pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) @@ -139815,6 +141242,7 @@ func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) goto _1 _1: + ; j++ } } @@ -139994,6 +141422,7 @@ func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { } goto _1 _1: + ; i-- } _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) @@ -140091,6 +141520,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _1 _1: + ; i-- p += 16 } @@ -140112,6 +141542,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } goto _4 _4: + ; i++ } if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { @@ -140119,6 +141550,7 @@ func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, } } whereOrInsert_done: + ; (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { @@ -140152,6 +141584,7 @@ func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBi } goto _1 _1: + ; i++ } return uint64(0) @@ -140269,6 +141702,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _4 _4: + ; j++ } if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { @@ -140307,6 +141741,7 @@ func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { } goto _1 _1: + ; k++ pTerm += 56 } @@ -140475,6 +141910,7 @@ func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pI } goto _1 _1: + ; i++ } return -int32(1) @@ -140546,6 +141982,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _1 _1: + ; i++ } /* Loop through all indices on the table, checking each to see if it makes @@ -140587,6 +142024,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _3 _3: + ; i++ } if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -140595,6 +142033,7 @@ func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC u } goto _2 _2: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } return 0 @@ -140661,6 +142100,7 @@ func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur } goto _1 _1: + ; iStart++ pOp += 24 } @@ -140801,7 +142241,7 @@ func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notRea } cMask = v2 if !(sentWarning != 0) { - Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { @@ -143696,6 +145168,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _1 _1: + ; pTerm += 56 } } @@ -143825,6 +145298,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in } goto _7 _7: + ; ii++ } (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) @@ -143858,6 +145332,7 @@ func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r in (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) goto _4 _4: + ; if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { v8 = uintptr(0) } else { @@ -143934,6 +145409,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _1 _1: + ; i++ pIdxCons += 12 } @@ -143975,7 +145451,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if v3 >= 0 { j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 @@ -144040,6 +145516,7 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, } goto _2 _2: + ; i++ pIdxCons += 12 } @@ -144052,11 +145529,12 @@ func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22397, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22431, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return int32(SQLITE_ERROR) } goto _6 _6: + ; i++ } _ = libc.Int32FromInt32(0) @@ -144204,7 +145682,7 @@ func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal pVal = uintptr(0) rc = SQLITE_OK if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { - rc = _sqlite3MisuseError(tls, int32(165025)) /* EV: R-30545-25046 */ + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ } else { if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 @@ -144255,6 +145733,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3CodeVerifySchema(tls, pParse, i) goto _1 _1: + ; i++ } if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { @@ -144266,6 +145745,7 @@ func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { _sqlite3BeginWriteOperation(tls, pParse, 0, i) goto _2 _2: + ; i++ } } @@ -144378,6 +145858,7 @@ func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUn } goto _3 _3: + ; i++ } mPrev = mNext @@ -144510,16 +145991,19 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) goto _4 _4: + ; j++ } goto _3 _3: + ; i++ } } } goto _2 _2: + ; pOrTerm += 56 } (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) @@ -144551,11 +146035,13 @@ func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusabl rc = _whereLoopInsert(tls, pBuilder, pNew) goto _5 _5: + ; i++ } } goto _1 _1: + ; pTerm += 56 } return rc @@ -144630,6 +146116,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _2 _2: + ; p += 104 } rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) @@ -144643,7 +146130,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { if rc == int32(SQLITE_DONE) { /* We hit the query planner search limit set by iPlanLimit */ - Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22423, 0) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22457, 0) rc = SQLITE_OK } else { break @@ -144651,6 +146138,7 @@ func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { } goto _1 _1: + ; iTab++ pItem += 104 } @@ -144798,6 +146286,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _3 _3: + ; j++ } if j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { @@ -144816,6 +146305,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, obSat |= libc.Uint64FromInt32(1) << i goto _2 _2: + ; i++ } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { @@ -144892,6 +146382,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _7 _7: + ; i++ } } @@ -144969,6 +146460,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, break goto _8 _8: + ; i++ } if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { @@ -145007,6 +146499,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _6 _6: + ; j++ } /* end Loop over all index columns */ if distinctColumns != 0 { @@ -145034,11 +146527,13 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _9 _9: + ; i++ } } goto _1 _1: + ; iLoop++ } /* End the loop over all WhereLoops from outer-most down to inner-most */ if obSat == obDone { @@ -145061,6 +146556,7 @@ func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, } goto _10 _10: + ; i-- } return 0 @@ -145224,6 +146720,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX goto _3 _3: + ; ii-- pFrom += 32 pX += uintptr(nLoop) * 8 @@ -145350,6 +146847,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _9 _9: + ; jj++ pTo += 32 } @@ -145415,16 +146913,19 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _11 _11: + ; jj++ pTo += 32 } } goto _8 _8: + ; pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop } goto _7 _7: + ; ii++ pFrom += 32 } @@ -145435,10 +146936,11 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) nFrom = nTo goto _6 _6: + ; iLoop++ } if nFrom == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22458, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22492, 0) _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) return int32(SQLITE_ERROR) } @@ -145454,6 +146956,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) } goto _12 _12: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -145471,6 +146974,7 @@ func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor goto _13 _13: + ; iLoop++ } if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { @@ -145606,6 +147110,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm goto _3 _3: + ; j++ } if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { @@ -145623,6 +147128,7 @@ func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { break goto _1 _1: + ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } } @@ -145766,6 +147272,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _2 _2: + ; pTerm += 56 } if pTerm < pEnd { @@ -145783,6 +147290,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi } goto _3 _3: + ; pTerm += 56 } if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { @@ -145793,6 +147301,7 @@ func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBi _ = libc.Int32FromInt32(0) goto _1 _1: + ; i-- } return notReady @@ -145849,6 +147358,7 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) goto _1 _1: + ; i++ } } @@ -145867,9 +147377,9 @@ func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { // ** references to the corresponding column of the index. // */ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { - var bMaybeNullRow, i, j, n, v2 int32 var db, p, pArg, pDef, pExpr, pTab uintptr - _, _, _, _, _, _, _, _, _, _, _ = bMaybeNullRow, db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 _ = libc.Int32FromInt32(0) pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable i = 0 @@ -145880,11 +147390,9 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if j == -int32(2) { pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr - bMaybeNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) } else { if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) - bMaybeNullRow = 0 } else { goto _1 } @@ -145915,7 +147423,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i - (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bMaybeNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { (*TIndexedExpr)(unsafe.Pointer(p)).Faff = *(*uint8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i))) } @@ -145926,6 +147434,7 @@ func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur i } goto _1 _1: + ; i++ } } @@ -145955,6 +147464,7 @@ func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; ii++ } } @@ -146076,7 +147586,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere ** bits in a Bitmask */ if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22476, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22510, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) return uintptr(0) } /* This function normally generates a nested loop for all tables in @@ -146149,7 +147659,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) } - _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22504, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22538, 0) } else { /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -146171,6 +147681,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) goto _5 _5: + ; ii++ v4 = ii if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { @@ -146231,6 +147742,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _6 _6: + ; ii++ } if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { @@ -146409,6 +147921,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _14 _14: + ; b = b >> int32(1) n++ } @@ -146519,6 +148032,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _13 _13: + ; ii++ pLevel += 104 } @@ -146570,6 +148084,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere } goto _25 _25: + ; ii++ } /* Done. */ @@ -146577,6 +148092,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere return pWInfo /* Jump here if malloc fails */ whereBeginError: + ; if pWInfo != 0 { (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) _whereInfoFree(tls, db, pWInfo) @@ -146647,6 +148163,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) goto _6 _6: + ; j++ } *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) @@ -146724,6 +148241,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) goto _8 _8: + ; j1-- pIn -= 20 } @@ -146763,6 +148281,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _1 _1: + ; i-- } _ = libc.Int32FromInt32(0) @@ -146873,6 +148392,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _11 _11: + ; pOp += 24 v10 = pOp if !(v10 < pLastOp) { @@ -146882,6 +148402,7 @@ func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { } goto _9 _9: + ; i++ pLevel += 104 } @@ -147160,7 +148681,8 @@ func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) _ = apArg return error_out: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22522, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22556, -int32(1)) } func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { @@ -147347,7 +148869,7 @@ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22578, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22612, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -147671,10 +149193,11 @@ func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r } goto _1 _1: + ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22623, libc.VaList(bp+8, zName)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22657, libc.VaList(bp+8, zName)) } return p } @@ -147725,12 +149248,12 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin _sqlite3WindowChain(tls, pParse, pWin, pList) } if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22642, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22676, 0) } else { if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22713, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22747, 0) } else { aUp = [8]struct { FzFunc uintptr @@ -147803,12 +149326,13 @@ func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { - (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8105) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8130) } break } goto _1 _1: + ; i++ } } @@ -147878,6 +149402,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _1 _1: + ; i++ } if i == nSrc { @@ -147901,6 +149426,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -147926,6 +149452,7 @@ func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) ( } goto _3 _3: + ; i1++ } } @@ -148058,6 +149585,7 @@ func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend u } goto _2 _2: + ; i++ } } @@ -148086,7 +149614,7 @@ func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintpt defer tls.Free(16) if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { _ = libc.Int32FromInt32(0) - _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22776, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22810, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } @@ -148219,6 +149747,7 @@ func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _4 _4: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -148379,7 +149908,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 ** frame boundary. */ if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22802, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22836, 0) goto windowAllocErr } pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) @@ -148398,6 +149927,7 @@ func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int3 (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) return pWin windowAllocErr: + ; _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) return uintptr(0) @@ -148445,18 +149975,18 @@ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = __ccgo_ts + 22834 + zErr = __ccgo_ts + 22868 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { - zErr = __ccgo_ts + 22851 + zErr = __ccgo_ts + 22885 } else { if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = __ccgo_ts + 22867 + zErr = __ccgo_ts + 22901 } } } if zErr != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22887, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22921, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -148484,7 +150014,7 @@ func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22920, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22954, 0) } } else { _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -148662,6 +150192,7 @@ func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { } goto _9 _9: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -148706,11 +150237,11 @@ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { } var _azErr = [5]uintptr{ - 0: __ccgo_ts + 22967, - 1: __ccgo_ts + 23020, - 2: __ccgo_ts + 22522, - 3: __ccgo_ts + 23071, - 4: __ccgo_ts + 23123, + 0: __ccgo_ts + 23001, + 1: __ccgo_ts + 23054, + 2: __ccgo_ts + 22556, + 3: __ccgo_ts + 23105, + 4: __ccgo_ts + 23157, } var _aOp1 = [5]int32{ @@ -148874,6 +150405,7 @@ func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) goto _2 _2: + ; i++ } } @@ -148934,6 +150466,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _3 _3: + ; i++ } regArg = reg @@ -148984,6 +150517,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _4 _4: + ; iOp++ } } @@ -149012,6 +150546,7 @@ func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149063,6 +150598,7 @@ func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149112,6 +150648,7 @@ func _windowFullScan(tls *libc.TLS, p uintptr) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) goto _2 _2: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) @@ -149248,6 +150785,7 @@ func _windowReturnOneRow(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } } @@ -149295,6 +150833,7 @@ func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) @@ -149325,6 +150864,7 @@ func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { } goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return 0 @@ -149690,6 +151230,7 @@ func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 goto _1 _1: + ; pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin } return *(*uintptr)(unsafe.Pointer(bp)) @@ -150181,6 +151722,7 @@ func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uin _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) goto _10 _10: + ; iInput++ } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) @@ -150512,11 +152054,11 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { cnt++ if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - v1 = __ccgo_ts + 23173 + v1 = __ccgo_ts + 23207 } else { - v1 = __ccgo_ts + 23182 + v1 = __ccgo_ts + 23216 } - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23188, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23222, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) break } } @@ -150525,7 +152067,7 @@ func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { mxSelect = v2 } if v3 && v2 > 0 && cnt > mxSelect { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23230, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, 0) } } } @@ -150614,7 +152156,7 @@ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pId _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23264, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23298, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p @@ -156927,103 +158469,103 @@ func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor u ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(204): + case int32(204): /* select */ fallthrough - case int32(239): + case int32(239): /* selectnowith */ fallthrough - case int32(240): + case int32(240): /* oneselect */ fallthrough - case int32(252): + case int32(252): /* values */ _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(216): + case int32(216): /* term */ fallthrough - case int32(217): + case int32(217): /* expr */ fallthrough - case int32(246): + case int32(246): /* where_opt */ fallthrough - case int32(248): + case int32(248): /* having_opt */ fallthrough - case int32(267): + case int32(267): /* where_opt_ret */ fallthrough - case int32(278): + case int32(278): /* case_operand */ fallthrough - case int32(280): + case int32(280): /* case_else */ fallthrough - case int32(283): + case int32(283): /* vinto */ fallthrough - case int32(290): + case int32(290): /* when_clause */ fallthrough - case int32(295): + case int32(295): /* key_opt */ fallthrough - case int32(311): + case int32(311): /* filter_clause */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(221): + case int32(221): /* eidlist_opt */ fallthrough - case int32(231): + case int32(231): /* sortlist */ fallthrough - case int32(232): + case int32(232): /* eidlist */ fallthrough - case int32(244): + case int32(244): /* selcollist */ fallthrough - case int32(247): + case int32(247): /* groupby_opt */ fallthrough - case int32(249): + case int32(249): /* orderby_opt */ fallthrough - case int32(253): + case int32(253): /* nexprlist */ fallthrough - case int32(254): + case int32(254): /* sclp */ fallthrough - case int32(261): + case int32(261): /* exprlist */ fallthrough - case int32(268): + case int32(268): /* setlist */ fallthrough - case int32(277): + case int32(277): /* paren_exprlist */ fallthrough - case int32(279): + case int32(279): /* case_exprlist */ fallthrough - case int32(310): + case int32(310): /* part_opt */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(238): + case int32(238): /* fullname */ fallthrough - case int32(245): + case int32(245): /* from */ fallthrough - case int32(256): + case int32(256): /* seltablist */ fallthrough - case int32(257): + case int32(257): /* stl_prefix */ fallthrough - case int32(262): + case int32(262): /* xfullname */ _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(241): + case int32(241): /* wqlist */ _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(251): + case int32(251): /* window_clause */ fallthrough - case int32(306): + case int32(306): /* windowdefn_list */ _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(263): + case int32(263): /* idlist */ fallthrough - case int32(270): + case int32(270): /* idlist_opt */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(273): + case int32(273): /* filter_over */ fallthrough - case int32(307): + case int32(307): /* windowdefn */ fallthrough - case int32(308): + case int32(308): /* window */ fallthrough - case int32(309): + case int32(309): /* frame_opt */ fallthrough - case int32(312): + case int32(312): /* over_clause */ _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(286): + case int32(286): /* trigger_cmd_list */ fallthrough - case int32(291): + case int32(291): /* trigger_cmd */ _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) - case int32(288): + case int32(288): /* trigger_event */ _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) - case int32(314): + case int32(314): /* frame_bound */ fallthrough - case int32(315): + case int32(315): /* frame_bound_s */ fallthrough - case int32(316): + case int32(316): /* frame_bound_e */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) break /********* End destructor definitions *****************************************/ @@ -157164,7 +158706,7 @@ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23302, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23336, 0) /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -158678,291 +160220,389 @@ func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead i goto _341 } goto _342 -_1: /* explain ::= EXPLAIN */ +_1: + ; /* explain ::= EXPLAIN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) } goto _342 -_2: /* explain ::= EXPLAIN QUERY PLAN */ +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) } goto _342 -_3: /* cmdx ::= cmd */ +_3: + ; /* cmdx ::= cmd */ _sqlite3FinishCoding(tls, pParse) goto _342 -_4: /* cmd ::= BEGIN transtype trans_opt */ +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_5: /* transtype ::= */ +_5: + ; /* transtype ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) goto _342 -_7: /* transtype ::= DEFERRED */ +_7: + ; /* transtype ::= DEFERRED */ _6: + ; _8: + ; _9: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_11: /* cmd ::= COMMIT|END trans_opt */ +_11: + ; /* cmd ::= COMMIT|END trans_opt */ _10: + ; _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) goto _342 -_12: /* cmd ::= SAVEPOINT nm */ +_12: + ; /* cmd ::= SAVEPOINT nm */ _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) goto _342 -_13: /* cmd ::= RELEASE savepoint_opt nm */ +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) goto _342 -_14: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) goto _342 -_15: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_16: /* createkw ::= CREATE */ +_16: + ; /* createkw ::= CREATE */ _disableLookaside(tls, pParse) goto _342 -_18: /* ifnotexists ::= */ +_18: + ; /* ifnotexists ::= */ _17: + ; _19: + ; _20: + ; _21: + ; _22: + ; _23: + ; _24: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 goto _342 -_25: /* ifnotexists ::= IF NOT EXISTS */ +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) goto _342 -_26: /* temp ::= TEMP */ +_26: + ; /* temp ::= TEMP */ *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) goto _342 -_27: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_28: /* create_table_args ::= AS select */ +_28: + ; /* create_table_args ::= AS select */ _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_29: /* table_option_set ::= */ +_29: + ; /* table_option_set ::= */ *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) goto _342 -_30: /* table_option_set ::= table_option_set COMMA table_option */ +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_31: /* table_option ::= WITHOUT nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16660, int32(5)) == 0 { +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16694, int32(5)) == 0 { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) } else { *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } goto _342 -_32: /* table_option ::= nm */ - if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16573, int32(6)) == 0 { +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16607, int32(6)) == 0 { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) } else { *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23324, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23358, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) } *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_33: /* columnname ::= nm typetoken */ +_33: + ; /* columnname ::= nm typetoken */ _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) goto _342 -_35: /* typetoken ::= */ +_35: + ; /* typetoken ::= */ _34: + ; _36: + ; *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_37: /* typetoken ::= typename LP signed RP */ +_37: + ; /* typetoken ::= typename LP signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) goto _342 -_38: /* typetoken ::= typename LP signed COMMA signed RP */ +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) goto _342 -_39: /* typename ::= typename ID|STRING */ +_39: + ; /* typename ::= typename ID|STRING */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) goto _342 -_40: /* scanpt ::= */ +_40: + ; /* scanpt ::= */ _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz goto _342 -_41: /* scantok ::= */ +_41: + ; /* scantok ::= */ _ = libc.Int32FromInt32(0) *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken goto _342 -_43: /* ccons ::= CONSTRAINT nm */ +_43: + ; /* ccons ::= CONSTRAINT nm */ _42: + ; (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_44: /* ccons ::= DEFAULT scantok term */ +_44: + ; /* ccons ::= DEFAULT scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_45: /* ccons ::= DEFAULT LP expr RP */ +_45: + ; /* ccons ::= DEFAULT LP expr RP */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_46: /* ccons ::= DEFAULT PLUS scantok term */ +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_47: /* ccons ::= DEFAULT MINUS scantok term */ +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) goto _342 -_48: /* ccons ::= DEFAULT scantok ID|INDEXED */ +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) if p1 != 0 { _sqlite3ExprIdToTrueFalse(tls, p1) } _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) goto _342 -_49: /* ccons ::= NOT NULL onconf */ +_49: + ; /* ccons ::= NOT NULL onconf */ _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_50: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_51: /* ccons ::= UNIQUE onconf */ +_51: + ; /* ccons ::= UNIQUE onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_52: /* ccons ::= CHECK LP expr RP */ +_52: + ; /* ccons ::= CHECK LP expr RP */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_53: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_54: /* ccons ::= defer_subclause */ +_54: + ; /* ccons ::= defer_subclause */ _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_55: /* ccons ::= COLLATE ID|STRING */ +_55: + ; /* ccons ::= COLLATE ID|STRING */ _sqlite3AddCollateType(tls, pParse, yymsp+8) goto _342 -_56: /* generated ::= LP expr RP */ +_56: + ; /* generated ::= LP expr RP */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_57: /* generated ::= LP expr RP ID */ +_57: + ; /* generated ::= LP expr RP ID */ _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_58: /* autoinc ::= AUTOINCR */ +_58: + ; /* autoinc ::= AUTOINCR */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) goto _342 -_59: /* refargs ::= */ +_59: + ; /* refargs ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ goto _342 -_60: /* refargs ::= refargs refarg */ +_60: + ; /* refargs ::= refargs refarg */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_61: /* refarg ::= MATCH nm */ +_61: + ; /* refarg ::= MATCH nm */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 goto _342 -_62: /* refarg ::= ON INSERT refact */ +_62: + ; /* refarg ::= ON INSERT refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 goto _342 -_63: /* refarg ::= ON DELETE refact */ +_63: + ; /* refarg ::= ON DELETE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) goto _342 -_64: /* refarg ::= ON UPDATE refact */ +_64: + ; /* refarg ::= ON UPDATE refact */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) goto _342 -_65: /* refact ::= SET NULL */ +_65: + ; /* refact ::= SET NULL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ goto _342 -_66: /* refact ::= SET DEFAULT */ +_66: + ; /* refact ::= SET DEFAULT */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ goto _342 -_67: /* refact ::= CASCADE */ +_67: + ; /* refact ::= CASCADE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ goto _342 -_68: /* refact ::= RESTRICT */ +_68: + ; /* refact ::= RESTRICT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ goto _342 -_69: /* refact ::= NO ACTION */ +_69: + ; /* refact ::= NO ACTION */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ goto _342 -_70: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 goto _342 -_72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ _71: + ; _73: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_75: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ _74: + ; _76: + ; _77: + ; _78: + ; *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) goto _342 -_79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 goto _342 -_80: /* tconscomma ::= COMMA */ +_80: + ; /* tconscomma ::= COMMA */ (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) goto _342 -_81: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) goto _342 -_82: /* tcons ::= UNIQUE LP sortlist RP onconf */ +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) goto _342 -_83: /* tcons ::= CHECK LP expr RP onconf */ +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_84: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_86: /* onconf ::= */ +_86: + ; /* onconf ::= */ _85: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) goto _342 -_87: /* onconf ::= ON CONFLICT resolvetype */ +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) goto _342 -_88: /* resolvetype ::= IGNORE */ +_88: + ; /* resolvetype ::= IGNORE */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) goto _342 -_90: /* resolvetype ::= REPLACE */ +_90: + ; /* resolvetype ::= REPLACE */ _89: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) goto _342 -_91: /* cmd ::= DROP TABLE ifexists fullname */ +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_92: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) goto _342 -_93: /* cmd ::= DROP VIEW ifexists fullname */ +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_94: /* cmd ::= select */ +_94: + ; /* cmd ::= select */ *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ FeDest: uint8(SRT_Output), } _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_95: /* select ::= WITH wqlist selectnowith */ +_95: + ; /* select ::= WITH wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_96: /* select ::= WITH RECURSIVE wqlist selectnowith */ +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_97: /* select ::= selectnowith */ +_97: + ; /* select ::= selectnowith */ p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) if p2 != 0 { _parserDoubleLinkSelect(tls, pParse, p2) } goto _342 -_98: /* selectnowith ::= selectnowith multiselect_op oneselect */ +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { @@ -158986,17 +160626,22 @@ _98: /* selectnowith ::= selectnowith multiselect_op oneselect */ } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs goto _342 -_100: /* multiselect_op ::= UNION */ +_100: + ; /* multiselect_op ::= UNION */ _99: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ goto _342 -_101: /* multiselect_op ::= UNION ALL */ +_101: + ; /* multiselect_op ::= UNION ALL */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) goto _342 -_102: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) @@ -159004,10 +160649,12 @@ _103: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt hav _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) } goto _342 -_104: /* values ::= VALUES LP nexprlist RP */ +_104: + ; /* values ::= VALUES LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) goto _342 -_105: /* values ::= values COMMA LP nexprlist RP */ +_105: + ; /* values ::= values COMMA LP nexprlist RP */ pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) if pLeft != 0 { @@ -159021,73 +160668,97 @@ _105: /* values ::= values COMMA LP nexprlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft } goto _342 -_106: /* distinct ::= DISTINCT */ +_106: + ; /* distinct ::= DISTINCT */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) goto _342 -_107: /* distinct ::= ALL */ +_107: + ; /* distinct ::= ALL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) goto _342 -_109: /* sclp ::= */ +_109: + ; /* sclp ::= */ _108: + ; _110: + ; _111: + ; _112: + ; _113: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_114: /* selcollist ::= sclp scanpt expr scanpt as */ +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) } _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_115: /* selcollist ::= sclp scanpt STAR */ +_115: + ; /* selcollist ::= sclp scanpt STAR */ p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) goto _342 -_116: /* selcollist ::= sclp scanpt nm DOT STAR */ +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) goto _342 -_118: /* as ::= AS nm */ +_118: + ; /* as ::= AS nm */ _117: + ; _119: + ; _120: + ; *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_122: /* from ::= */ +_122: + ; /* from ::= */ _121: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_123: /* from ::= FROM seltablist */ +_123: + ; /* from ::= FROM seltablist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_124: /* stl_prefix ::= seltablist joinop */ +_124: + ; /* stl_prefix ::= seltablist joinop */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) } goto _342 -_125: /* seltablist ::= stl_prefix nm dbnm as on_using */ +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) goto _342 -_126: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_127: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) goto _342 -_128: /* seltablist ::= stl_prefix LP select RP as on_using */ +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) } else { @@ -159121,142 +160792,188 @@ _129: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ } } goto _342 -_131: /* dbnm ::= */ +_131: + ; /* dbnm ::= */ _130: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) goto _342 -_132: /* fullname ::= nm */ +_132: + ; /* fullname ::= nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_133: /* fullname ::= nm DOT nm */ +_133: + ; /* fullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_134: /* xfullname ::= nm */ +_134: + ; /* xfullname ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ goto _342 -_135: /* xfullname ::= nm DOT nm */ +_135: + ; /* xfullname ::= nm DOT nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ goto _342 -_136: /* xfullname ::= nm DOT nm AS nm */ +_136: + ; /* xfullname ::= nm DOT nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_137: /* xfullname ::= nm AS nm */ +_137: + ; /* xfullname ::= nm AS nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) } goto _342 -_138: /* joinop ::= COMMA|JOIN */ +_138: + ; /* joinop ::= COMMA|JOIN */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) goto _342 -_139: /* joinop ::= JOIN_KW JOIN */ +_139: + ; /* joinop ::= JOIN_KW JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ goto _342 -_140: /* joinop ::= JOIN_KW nm JOIN */ +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ goto _342 -_141: /* joinop ::= JOIN_KW nm nm JOIN */ +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ goto _342 -_142: /* on_using ::= ON expr */ +_142: + ; /* on_using ::= ON expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) goto _342 -_143: /* on_using ::= USING LP idlist RP */ +_143: + ; /* on_using ::= USING LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_144: /* on_using ::= */ +_144: + ; /* on_using ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) goto _342 -_145: /* indexed_by ::= INDEXED BY nm */ +_145: + ; /* indexed_by ::= INDEXED BY nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) goto _342 -_146: /* indexed_by ::= NOT INDEXED */ +_146: + ; /* indexed_by ::= NOT INDEXED */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) goto _342 -_148: /* orderby_opt ::= ORDER BY sortlist */ +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ _147: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_149: /* sortlist ::= sortlist COMMA expr sortorder nulls */ +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_150: /* sortlist ::= expr sortorder nulls */ +_150: + ; /* sortlist ::= expr sortorder nulls */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_151: /* sortorder ::= ASC */ +_151: + ; /* sortorder ::= ASC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC goto _342 -_152: /* sortorder ::= DESC */ +_152: + ; /* sortorder ::= DESC */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) goto _342 -_154: /* sortorder ::= */ +_154: + ; /* sortorder ::= */ _153: + ; *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) goto _342 -_155: /* nulls ::= NULLS FIRST */ +_155: + ; /* nulls ::= NULLS FIRST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC goto _342 -_156: /* nulls ::= NULLS LAST */ +_156: + ; /* nulls ::= NULLS LAST */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) goto _342 -_158: /* having_opt ::= */ +_158: + ; /* having_opt ::= */ _157: + ; _159: + ; _160: + ; _161: + ; _162: + ; _163: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_165: /* having_opt ::= HAVING expr */ +_165: + ; /* having_opt ::= HAVING expr */ _164: + ; _166: + ; _167: + ; _168: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_169: /* limit_opt ::= LIMIT expr */ +_169: + ; /* limit_opt ::= LIMIT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) goto _342 -_170: /* limit_opt ::= LIMIT expr OFFSET expr */ +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_171: /* limit_opt ::= LIMIT expr COMMA expr */ +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) goto _342 -_172: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) goto _342 -_173: /* where_opt_ret ::= RETURNING selcollist */ +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) goto _342 -_174: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) goto _342 -_175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) - _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23351) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23385) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { @@ -159269,74 +160986,95 @@ _175: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where } _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_176: /* setlist ::= setlist COMMA nm EQ expr */ +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) goto _342 -_177: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_178: /* setlist ::= nm EQ expr */ +_178: + ; /* setlist ::= nm EQ expr */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_179: /* setlist ::= LP idlist RP EQ expr */ +_179: + ; /* setlist ::= LP idlist RP EQ expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_180: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_181: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) goto _342 -_182: /* upsert ::= */ +_182: + ; /* upsert ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_183: /* upsert ::= RETURNING selcollist */ +_183: + ; /* upsert ::= RETURNING selcollist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_184: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_185: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_186: /* upsert ::= ON CONFLICT DO NOTHING returning */ +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) goto _342 -_187: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_188: /* returning ::= RETURNING selcollist */ +_188: + ; /* returning ::= RETURNING selcollist */ _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_189: /* idlist_opt ::= */ +_189: + ; /* idlist_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_190: /* idlist_opt ::= LP idlist RP */ +_190: + ; /* idlist_opt ::= LP idlist RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_191: /* idlist ::= idlist COMMA nm */ +_191: + ; /* idlist ::= idlist COMMA nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) goto _342 -_192: /* idlist ::= nm */ +_192: + ; /* idlist ::= nm */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ goto _342 -_193: /* expr ::= LP expr RP */ +_193: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_194: /* expr ::= ID|INDEXED|JOIN_KW */ +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_195: /* expr ::= nm DOT nm */ +_195: + ; /* expr ::= nm DOT nm */ temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_196: /* expr ::= nm DOT nm DOT nm */ +_196: + ; /* expr ::= nm DOT nm DOT nm */ temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159347,18 +161085,22 @@ _196: /* expr ::= nm DOT nm DOT nm */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_198: /* term ::= NULL|FLOAT|BLOB */ +_198: + ; /* term ::= NULL|FLOAT|BLOB */ _197: + ; *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_199: /* term ::= INTEGER */ +_199: + ; /* term ::= INTEGER */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_200: /* expr ::= VARIABLE */ +_200: + ; /* expr ::= VARIABLE */ if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1))])&int32(0x04) != 0) { n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) @@ -159370,7 +161112,7 @@ _200: /* expr ::= VARIABLE */ *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ _ = libc.Int32FromInt32(0) if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+128, bp+88)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+128, bp+88)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) @@ -159380,47 +161122,57 @@ _200: /* expr ::= VARIABLE */ } } goto _342 -_201: /* expr ::= expr COLLATE ID|STRING */ +_201: + ; /* expr ::= expr COLLATE ID|STRING */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) goto _342 -_202: /* expr ::= CAST LP expr AS typetoken RP */ +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) goto _342 -_203: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_204: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_205: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_206: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_207: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_208: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_209: /* term ::= CTIME_KW */ +_209: + ; /* term ::= CTIME_KW */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_210: /* expr ::= LP nexprlist COMMA expr RP */ +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159432,23 +161184,33 @@ _210: /* expr ::= LP nexprlist COMMA expr RP */ _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) } goto _342 -_211: /* expr ::= expr AND expr */ +_211: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_213: /* expr ::= expr OR expr */ +_213: + ; /* expr ::= expr OR expr */ _212: + ; _214: + ; _215: + ; _216: + ; _217: + ; _218: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_219: /* likeop ::= NOT LIKE_KW|MATCH */ +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ goto _342 -_220: /* expr ::= expr likeop expr */ +_220: + ; /* expr ::= expr likeop expr */ bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) @@ -159461,7 +161223,8 @@ _220: /* expr ::= expr likeop expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_221: /* expr ::= expr likeop expr ESCAPE expr */ +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) @@ -159475,33 +161238,42 @@ _221: /* expr ::= expr likeop expr ESCAPE expr */ *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) } goto _342 -_222: /* expr ::= expr ISNULL|NOTNULL */ +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_223: /* expr ::= expr NOT NULL */ +_223: + ; /* expr ::= expr NOT NULL */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) goto _342 -_224: /* expr ::= expr IS expr */ +_224: + ; /* expr ::= expr IS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) goto _342 -_225: /* expr ::= expr IS NOT expr */ +_225: + ; /* expr ::= expr IS NOT expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_226: /* expr ::= expr IS NOT DISTINCT FROM expr */ +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) goto _342 -_227: /* expr ::= expr IS DISTINCT FROM expr */ +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) goto _342 -_229: /* expr ::= NOT expr */ +_229: + ; /* expr ::= NOT expr */ _228: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_230: /* expr ::= PLUS|MINUS expr */ +_230: + ; /* expr ::= PLUS|MINUS expr */ if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { v344 = int32(TK_UPLUS) } else { @@ -159510,17 +161282,21 @@ _230: /* expr ::= PLUS|MINUS expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ goto _342 -_231: /* expr ::= expr PTR expr */ +_231: + ; /* expr ::= expr PTR expr */ pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_233: /* between_op ::= BETWEEN */ +_233: + ; /* between_op ::= BETWEEN */ _232: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 goto _342 -_234: /* expr ::= expr between_op expr AND expr */ +_234: + ; /* expr ::= expr between_op expr AND expr */ pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) @@ -159533,7 +161309,8 @@ _234: /* expr ::= expr between_op expr AND expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_235: /* expr ::= expr in_op LP exprlist RP */ +_235: + ; /* expr ::= expr in_op LP exprlist RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { /* Expressions of the form ** @@ -159545,9 +161322,9 @@ _235: /* expr ::= expr in_op LP exprlist RP */ */ _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { - v345 = __ccgo_ts + 7861 + v345 = __ccgo_ts + 7886 } else { - v345 = __ccgo_ts + 7866 + v345 = __ccgo_ts + 7891 } *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { @@ -159590,18 +161367,21 @@ _235: /* expr ::= expr in_op LP exprlist RP */ } } goto _342 -_236: /* expr ::= LP select RP */ +_236: + ; /* expr ::= LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_237: /* expr ::= expr in_op LP select RP */ +_237: + ; /* expr ::= expr in_op LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_238: /* expr ::= expr in_op nm dbnm paren_exprlist */ +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { @@ -159618,13 +161398,15 @@ _238: /* expr ::= expr in_op nm dbnm paren_exprlist */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) } goto _342 -_239: /* expr ::= EXISTS LP select RP */ +_239: + ; /* expr ::= EXISTS LP select RP */ v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 p4 = v347 _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_240: /* expr ::= CASE case_operand case_exprlist case_else END */ +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { @@ -159639,73 +161421,95 @@ _240: /* expr ::= CASE case_operand case_exprlist case_else END */ _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) } goto _342 -_241: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_242: /* case_exprlist ::= WHEN expr THEN expr */ +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_243: /* nexprlist ::= nexprlist COMMA expr */ +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_244: /* nexprlist ::= expr */ +_244: + ; /* nexprlist ::= expr */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_246: /* paren_exprlist ::= LP exprlist RP */ +_246: + ; /* paren_exprlist ::= LP exprlist RP */ _245: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_247: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) } goto _342 -_249: /* uniqueflag ::= UNIQUE */ +_249: + ; /* uniqueflag ::= UNIQUE */ _248: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) goto _342 -_250: /* uniqueflag ::= */ +_250: + ; /* uniqueflag ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None goto _342 -_251: /* eidlist ::= eidlist COMMA nm collate sortorder */ +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) goto _342 -_252: /* eidlist ::= nm collate sortorder */ +_252: + ; /* eidlist ::= nm collate sortorder */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ goto _342 -_253: /* cmd ::= DROP INDEX ifexists fullname */ +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_254: /* cmd ::= VACUUM vinto */ +_254: + ; /* cmd ::= VACUUM vinto */ _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_255: /* cmd ::= VACUUM nm vinto */ +_255: + ; /* cmd ::= VACUUM nm vinto */ _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_256: /* cmd ::= PRAGMA nm dbnm */ +_256: + ; /* cmd ::= PRAGMA nm dbnm */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) goto _342 -_257: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) goto _342 -_258: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) goto _342 -_259: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) goto _342 -_260: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) goto _342 -_261: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) goto _342 -_262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) @@ -159714,239 +161518,312 @@ _262: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_ } *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ goto _342 -_263: /* trigger_time ::= BEFORE|AFTER */ +_263: + ; /* trigger_time ::= BEFORE|AFTER */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_264: /* trigger_time ::= INSTEAD OF */ +_264: + ; /* trigger_time ::= INSTEAD OF */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) goto _342 -_265: /* trigger_time ::= */ +_265: + ; /* trigger_time ::= */ *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) goto _342 -_267: /* trigger_event ::= DELETE|INSERT */ +_267: + ; /* trigger_event ::= DELETE|INSERT */ _266: + ; *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) goto _342 -_268: /* trigger_event ::= UPDATE OF idlist */ +_268: + ; /* trigger_event ::= UPDATE OF idlist */ *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_270: /* when_clause ::= */ +_270: + ; /* when_clause ::= */ _269: + ; *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) goto _342 -_272: /* when_clause ::= WHEN expr */ +_272: + ; /* when_clause ::= WHEN expr */ _271: + ; *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_274: /* trigger_cmd_list ::= trigger_cmd SEMI */ +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ _ = libc.Int32FromInt32(0) (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 -_275: /* trnm ::= nm DOT nm */ +_275: + ; /* trnm ::= nm DOT nm */ *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23384, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23418, 0) goto _342 -_276: /* tridxby ::= INDEXED BY nm */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23479, 0) +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23513, 0) goto _342 -_277: /* tridxby ::= NOT INDEXED */ - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23563, 0) +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23597, 0) goto _342 -_278: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_279: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_280: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_281: /* trigger_cmd ::= scanpt select scanpt */ +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_282: /* expr ::= RAISE LP IGNORE RP */ +_282: + ; /* expr ::= RAISE LP IGNORE RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = uint8(OE_Ignore) } goto _342 -_283: /* expr ::= RAISE LP raisetype COMMA nm RP */ +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) } goto _342 -_284: /* raisetype ::= ROLLBACK */ +_284: + ; /* raisetype ::= ROLLBACK */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) goto _342 -_285: /* raisetype ::= FAIL */ +_285: + ; /* raisetype ::= FAIL */ *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) goto _342 -_286: /* cmd ::= DROP TRIGGER ifexists fullname */ +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _342 -_287: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_288: /* cmd ::= DETACH database_kw_opt expr */ +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_289: /* cmd ::= REINDEX */ +_289: + ; /* cmd ::= REINDEX */ _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_290: /* cmd ::= REINDEX nm dbnm */ +_290: + ; /* cmd ::= REINDEX nm dbnm */ _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_291: /* cmd ::= ANALYZE */ +_291: + ; /* cmd ::= ANALYZE */ _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) goto _342 -_292: /* cmd ::= ANALYZE nm dbnm */ +_292: + ; /* cmd ::= ANALYZE nm dbnm */ _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) goto _342 -_293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) goto _342 -_295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) goto _342 -_296: /* add_column_fullname ::= fullname */ +_296: + ; /* add_column_fullname ::= fullname */ _disableLookaside(tls, pParse) _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) goto _342 -_298: /* cmd ::= create_vtab */ +_298: + ; /* cmd ::= create_vtab */ _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) goto _342 -_299: /* cmd ::= create_vtab LP vtabarglist RP */ +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ _sqlite3VtabFinishParse(tls, pParse, yymsp+8) goto _342 -_300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) goto _342 -_301: /* vtabarg ::= */ +_301: + ; /* vtabarg ::= */ _sqlite3VtabArgInit(tls, pParse) goto _342 -_303: /* vtabargtoken ::= ANY */ +_303: + ; /* vtabargtoken ::= ANY */ _302: + ; _304: + ; _sqlite3VtabArgExtend(tls, pParse, yymsp+8) goto _342 -_306: /* with ::= WITH wqlist */ +_306: + ; /* with ::= WITH wqlist */ _305: + ; _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) goto _342 -_307: /* wqas ::= AS */ +_307: + ; /* wqas ::= AS */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) goto _342 -_308: /* wqas ::= AS MATERIALIZED */ +_308: + ; /* wqas ::= AS MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) goto _342 -_309: /* wqas ::= AS NOT MATERIALIZED */ +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) goto _342 -_310: /* wqitem ::= nm eidlist_opt wqas LP select RP */ +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ goto _342 -_311: /* wqlist ::= wqitem */ +_311: + ; /* wqlist ::= wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ goto _342 -_312: /* wqlist ::= wqlist COMMA wqitem */ +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) goto _342 -_313: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ _ = libc.Int32FromInt32(0) _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_314: /* windowdefn ::= nm AS LP window RP */ +_314: + ; /* windowdefn ::= nm AS LP window RP */ if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) } *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_315: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_316: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_317: /* window ::= ORDER BY sortlist frame_opt */ +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) goto _342 -_318: /* window ::= nm ORDER BY sortlist frame_opt */ +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_319: /* window ::= nm frame_opt */ +_319: + ; /* window ::= nm frame_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_320: /* frame_opt ::= */ +_320: + ; /* frame_opt ::= */ *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) goto _342 -_321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_324: /* frame_bound_s ::= frame_bound */ +_324: + ; /* frame_bound_s ::= frame_bound */ _323: + ; *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ _325: + ; _327: + ; (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) goto _342 -_329: /* frame_exclude_opt ::= */ +_329: + ; /* frame_exclude_opt ::= */ *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) goto _342 -_330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) goto _342 -_332: /* frame_exclude ::= NO OTHERS */ +_332: + ; /* frame_exclude ::= NO OTHERS */ _331: + ; *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ goto _342 -_333: /* frame_exclude ::= GROUP|TIES */ +_333: + ; /* frame_exclude ::= GROUP|TIES */ *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ goto _342 -_334: /* window_clause ::= WINDOW windowdefn_list */ +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) goto _342 -_335: /* filter_over ::= filter_clause over_clause */ +_335: + ; /* filter_over ::= filter_clause over_clause */ if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) } else { @@ -159955,11 +161832,13 @@ _335: /* filter_over ::= filter_clause over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_336: /* filter_over ::= over_clause */ +_336: + ; /* filter_over ::= over_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_337: /* filter_over ::= filter_clause */ +_337: + ; /* filter_over ::= filter_clause */ *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) @@ -159969,20 +161848,24 @@ _337: /* filter_over ::= filter_clause */ } *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) goto _342 -_338: /* over_clause ::= OVER LP window RP */ +_338: + ; /* over_clause ::= OVER LP window RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) _ = libc.Int32FromInt32(0) goto _342 -_339: /* over_clause ::= OVER nm */ +_339: + ; /* over_clause ::= OVER nm */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) } goto _342 -_340: /* filter_clause ::= FILTER LP WHERE expr RP */ +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _342 _341: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -160001,6 +161884,7 @@ _341: goto _342 /********** End reduce actions ************************************************/ _342: + ; _ = libc.Int32FromInt32(0) yygoto = int32(_yyRuleInfoLhs[yyruleno]) yysize = int32(_yyRuleInfoNRhs[yyruleno]) @@ -160036,9 +161920,9 @@ func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor /************ Begin %syntax_error code ****************************************/ _ = yymajor /* Silence some compiler warnings */ if *(*uint8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23360, libc.VaList(bp+24, bp)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23394, libc.VaList(bp+24, bp)) } else { - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23648, 0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23682, 0) } /************ End %syntax_error code ******************************************/ /* Suppress warning about unused %extra_argument variable */ @@ -162094,6 +163978,7 @@ func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { break goto _1 _1: + ; i = int32(_aKWNext[i]) } return n @@ -162273,6 +164158,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) @@ -162288,6 +164174,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ @@ -162332,6 +164219,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _4 _4: + ; i++ } if c != 0 { @@ -162427,6 +164315,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _9 _9: + ; i++ } if c == int32('\'') { @@ -162458,6 +164347,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _11 _11: + ; i++ } return i @@ -162469,6 +164359,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _12 _12: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { @@ -162503,6 +164394,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _13 _13: + ; i++ } if c == int32(']') { @@ -162521,6 +164413,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _17 _17: + ; i++ } return i @@ -162544,6 +164437,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { i++ goto _21 _21: + ; v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) c = v20 if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { @@ -162566,6 +164460,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _18 _18: + ; i++ } if n == 0 { @@ -162584,6 +164479,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _22 _22: + ; i++ } if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { @@ -162605,6 +164501,7 @@ func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { } goto _23 _23: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { @@ -162724,7 +164621,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { } else { (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) - _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23665, libc.VaList(bp+2456, bp+2432)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23699, libc.VaList(bp+2456, bp+2432)) break } } @@ -162750,7 +164647,7 @@ func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3795, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) } - Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23690, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23724, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) nErr++ } (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql @@ -162866,7 +164763,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { state = uint8(0) /* Value of the next token */ for *(*uint8)(unsafe.Pointer(zSql)) != 0 { switch int32(*(*uint8)(unsafe.Pointer(zSql))) { - case int32(';'): + case int32(';'): /* A semicolon */ token = uint8(tkSEMI) case int32(' '): fallthrough @@ -162876,9 +164773,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { fallthrough case int32('\n'): fallthrough - case int32('\f'): + case int32('\f'): /* White space is ignored */ token = uint8(tkWS) - case int32('/'): + case int32('/'): /* C-style comments */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('*') { token = uint8(tkOTHER) break @@ -162892,7 +164789,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } zSql++ token = uint8(tkWS) - case int32('-'): + case int32('-'): /* SQL-style comments from "--" to end of line */ if int32(*(*uint8)(unsafe.Pointer(zSql + 1))) != int32('-') { token = uint8(tkOTHER) break @@ -162904,7 +164801,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return libc.BoolInt32(int32(state) == int32(1)) } token = uint8(tkWS) - case int32('['): + case int32('['): /* Microsoft-style identifiers in [...] */ zSql++ for *(*uint8)(unsafe.Pointer(zSql)) != 0 && int32(*(*uint8)(unsafe.Pointer(zSql))) != int32(']') { zSql++ @@ -162913,9 +164810,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { return 0 } token = uint8(tkOTHER) - case int32('`'): + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ fallthrough - case int32('"'): + case int32('"'): /* single- and double-quoted strings */ fallthrough case int32('\''): c = int32(*(*uint8)(unsafe.Pointer(zSql))) @@ -162936,13 +164833,14 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { } goto _1 _1: + ; nId++ } switch int32(*(*uint8)(unsafe.Pointer(zSql))) { case int32('c'): fallthrough case int32('C'): - if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23701, int32(6)) == 0 { + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23735, int32(6)) == 0 { token = uint8(tkCREATE) } else { token = uint8(tkOTHER) @@ -162950,13 +164848,13 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('t'): fallthrough case int32('T'): - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20345, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20379, int32(7)) == 0 { token = uint8(tkTRIGGER) } else { - if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23708, int32(4)) == 0 { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23742, int32(4)) == 0 { token = uint8(tkTEMP) } else { - if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23713, int32(9)) == 0 { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23747, int32(9)) == 0 { token = uint8(tkTEMP) } else { token = uint8(tkOTHER) @@ -162966,10 +164864,10 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { case int32('e'): fallthrough case int32('E'): - if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23723, int32(3)) == 0 { + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23757, int32(3)) == 0 { token = uint8(tkEND) } else { - if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23727, int32(7)) == 0 { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23761, int32(7)) == 0 { token = uint8(tkEXPLAIN) } else { token = uint8(tkOTHER) @@ -163229,6 +165127,8 @@ func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { // ** without blocking. // */ func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() var pMainMtx uintptr var rc int32 _, _ = pMainMtx, rc /* Result code */ @@ -163402,8 +165302,8 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { var ap Tva_list var bOpenUri, rc int32 var mxMmap, szMmap Tsqlite3_int64 - var pLogArg, xLog uintptr - _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, rc, szMmap, xLog + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog rc = SQLITE_OK /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. Except, a few selected opcodes @@ -163411,7 +165311,7 @@ func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { */ if _sqlite3Config.FisInit != 0 { if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { @@ -164542,31 +166461,31 @@ func _sqlite3ErrStr(tls *libc.TLS, rc int32) (r uintptr) { } var _aMsg = [29]uintptr{ - 0: __ccgo_ts + 23803, - 1: __ccgo_ts + 23816, - 3: __ccgo_ts + 23832, - 4: __ccgo_ts + 23857, - 5: __ccgo_ts + 23871, - 6: __ccgo_ts + 23890, + 0: __ccgo_ts + 23837, + 1: __ccgo_ts + 23850, + 3: __ccgo_ts + 23866, + 4: __ccgo_ts + 23891, + 5: __ccgo_ts + 23905, + 6: __ccgo_ts + 23924, 7: __ccgo_ts + 1618, - 8: __ccgo_ts + 23915, - 9: __ccgo_ts + 23952, - 10: __ccgo_ts + 23964, - 11: __ccgo_ts + 23979, - 12: __ccgo_ts + 24012, - 13: __ccgo_ts + 24030, - 14: __ccgo_ts + 24055, - 15: __ccgo_ts + 24084, - 17: __ccgo_ts + 5996, - 18: __ccgo_ts + 5398, - 19: __ccgo_ts + 24101, - 20: __ccgo_ts + 24119, - 21: __ccgo_ts + 24137, - 23: __ccgo_ts + 24171, - 25: __ccgo_ts + 24192, - 26: __ccgo_ts + 24218, - 27: __ccgo_ts + 24241, - 28: __ccgo_ts + 24262, + 8: __ccgo_ts + 23949, + 9: __ccgo_ts + 23986, + 10: __ccgo_ts + 23998, + 11: __ccgo_ts + 24013, + 12: __ccgo_ts + 24046, + 13: __ccgo_ts + 24064, + 14: __ccgo_ts + 24089, + 15: __ccgo_ts + 24118, + 17: __ccgo_ts + 6021, + 18: __ccgo_ts + 5423, + 19: __ccgo_ts + 24135, + 20: __ccgo_ts + 24153, + 21: __ccgo_ts + 24171, + 23: __ccgo_ts + 24205, + 25: __ccgo_ts + 24226, + 26: __ccgo_ts + 24252, + 27: __ccgo_ts + 24275, + 28: __ccgo_ts + 24296, } // C documentation @@ -164748,7 +166667,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { - return _sqlite3MisuseError(tls, int32(180012)) + return _sqlite3MisuseError(tls, int32(180244)) } _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -164794,7 +166713,7 @@ func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24359, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24393, 0) _ = libc.Int32FromInt32(0) return int32(SQLITE_BUSY) } else { @@ -164868,6 +166787,7 @@ func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, en Xsqlite3_free(tls, pArg) } out: + ; rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -164922,7 +166842,7 @@ func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotU zName = Xsqlite3_user_data(tls, context) _ = NotUsed _ = NotUsed2 - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24422, libc.VaList(bp+8, zName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24456, libc.VaList(bp+8, zName)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -165201,7 +167121,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return _sqlite3MisuseError(tls, int32(180627)) + return _sqlite3MisuseError(tls, int32(180859)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zDb != 0 && *(*uint8)(unsafe.Pointer(zDb)) != 0 { @@ -165211,7 +167131,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = int32(SQLITE_ERROR) - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24473, libc.VaList(bp+8, zDb)) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24507, libc.VaList(bp+8, zDb)) } else { (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -165287,6 +167207,7 @@ func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog } goto _1 _1: + ; i++ } if rc == SQLITE_OK && bBusy != 0 { @@ -165335,7 +167256,7 @@ func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180763))) + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -165468,7 +167389,7 @@ var _misuse = [34]Tu16{ // */ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180842)) + return _sqlite3MisuseError(tls, int32(181074)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165478,7 +167399,7 @@ func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { - return _sqlite3MisuseError(tls, int32(180851)) + return _sqlite3MisuseError(tls, int32(181083)) } if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return int32(SQLITE_NOMEM) @@ -165528,7 +167449,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui enc2 = int32(SQLITE_UTF16LE) } if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { - return _sqlite3MisuseError(tls, int32(180899)) + return _sqlite3MisuseError(tls, int32(181131)) } /* Check if this call is removing or replacing an existing collation ** sequence. If so, and there are active VMs, return busy. If there @@ -165537,7 +167458,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { - _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24494, 0) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24528, 0) return int32(SQLITE_BUSY) } _sqlite3ExpirePreparedStatements(tls, db, 0) @@ -165563,6 +167484,7 @@ func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx ui } goto _1 _1: + ; j++ } } @@ -165697,7 +167619,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u zVfs = zDefaultVfs nUri = _sqlite3Strlen30(tls, zUri) _ = libc.Int32FromInt32(0) - if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24562, uint64(5)) == 0 { /* Input character index */ + if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24596, uint64(5)) == 0 { /* Input character index */ iOut = 0 /* Output character index */ nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen @@ -165711,6 +167633,7 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nByte += libc.BoolUint64(int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) goto _1 _1: + ; iIn++ } zFile = Xsqlite3_malloc64(tls, nByte) @@ -165726,8 +167649,8 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u for *(*uint8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*uint8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { iIn++ } - if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24568, zUri+7, uint64(9)) != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24578, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24602, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24612, libc.VaList(bp+8, iIn-int32(7), zUri+7)) rc = int32(SQLITE_ERROR) goto parse_uri_out } @@ -165817,20 +167740,20 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u nOpt = _sqlite3Strlen30(tls, zOpt) zVal = zOpt + uintptr(nOpt+int32(1)) nVal = _sqlite3Strlen30(tls, zVal) - if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24606, zOpt, uint64(3)) == 0 { + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24640, zOpt, uint64(3)) == 0 { zVfs = zVal } else { aMode = uintptr(0) zModeType = uintptr(0) mask = 0 limit = 0 - if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24610, zOpt, uint64(5)) == 0 { + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24644, zOpt, uint64(5)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&_aCacheMode)) limit = mask - zModeType = __ccgo_ts + 24610 + zModeType = __ccgo_ts + 24644 } - if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24631, zOpt, uint64(4)) == 0 { + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24665, zOpt, uint64(4)) == 0 { mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&_aOpenMode)) limit = int32(uint32(mask) & flags) @@ -165859,15 +167782,16 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } goto _9 _9: + ; i++ } if mode == 0 { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24646, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24680, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_ERROR) goto parse_uri_out } if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24666, libc.VaList(bp+8, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24700, libc.VaList(bp+8, zModeType, zVal)) rc = int32(SQLITE_PERM) goto parse_uri_out } @@ -165891,10 +167815,11 @@ func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u } *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24690, libc.VaList(bp+8, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24724, libc.VaList(bp+8, zVfs)) rc = int32(SQLITE_ERROR) } parse_uri_out: + ; if rc != SQLITE_OK { Xsqlite3_free_filename(tls, zFile) zFile = uintptr(0) @@ -165909,11 +167834,11 @@ var _aCacheMode = [3]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24616, + Fz: __ccgo_ts + 24650, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { - Fz: __ccgo_ts + 24623, + Fz: __ccgo_ts + 24657, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, @@ -165924,19 +167849,19 @@ var _aOpenMode = [5]struct { Fmode int32 }{ 0: { - Fz: __ccgo_ts + 24636, + Fz: __ccgo_ts + 24670, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { - Fz: __ccgo_ts + 24639, + Fz: __ccgo_ts + 24673, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { - Fz: __ccgo_ts + 24642, + Fz: __ccgo_ts + 24676, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { - Fz: __ccgo_ts + 17730, + Fz: __ccgo_ts + 17764, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, @@ -166065,8 +167990,8 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+22317, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) - _createCollation(tls, db, __ccgo_ts+24706, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22351, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24740, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto opendb_out } @@ -166090,7 +168015,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* READWRITE */ /* READWRITE | CREATE */ if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { - rc = _sqlite3MisuseError(tls, int32(181571)) /* IMP: R-18321-05872 */ + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ } else { rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) } @@ -166127,9 +168052,9 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. */ - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6560 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = __ccgo_ts + 6585 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) - (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23708 + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName = __ccgo_ts + 23742 (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).Fsafety_level = uint8(PAGER_SYNCHRONOUS_OFF) (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_OPEN) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -166151,6 +168076,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3BuiltinExtensions[i]})))(tls, db) goto _3 _3: + ; i++ } /* Load automatic extensions - extensions that have been registered @@ -166174,6 +168100,7 @@ func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32 _setupLookaside(tls, db, uintptr(0), _sqlite3Config.FszLookaside, _sqlite3Config.FnLookaside) Xsqlite3_wal_autocheckpoint(tls, db, int32(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT)) opendb_out: + ; if db != 0 { _ = libc.Int32FromInt32(0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166222,7 +168149,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) { return rc } if zFilename == uintptr(0) { - zFilename = __ccgo_ts + 24712 + zFilename = __ccgo_ts + 24746 } pVal = _sqlite3ValueNew(tls, uintptr(0)) _sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) @@ -166340,6 +168267,7 @@ func Xsqlite3_get_clientdata(tls *libc.TLS, db uintptr, zName uintptr) (r uintpt } goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) @@ -166365,6 +168293,7 @@ func Xsqlite3_set_clientdata(tls *libc.TLS, db uintptr, zName uintptr, pData uin pp = p goto _1 _1: + ; p = (*TDbClientData)(unsafe.Pointer(p)).FpNext } if p != 0 { @@ -166441,20 +168370,20 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) (r int32) { func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) - Xsqlite3_log(tls, iErr, __ccgo_ts+24715, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) + Xsqlite3_log(tls, iErr, __ccgo_ts+24749, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24740) + return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+24774) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24760) + return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+24794) } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { - return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24767) + return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+24801) } // C documentation @@ -166519,6 +168448,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, } goto _1 _1: + ; iCol++ } if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { @@ -166560,6 +168490,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } error_out: + ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -166582,7 +168513,7 @@ error_out: } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) - *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24784, libc.VaList(bp+16, zTableName, zColumnName)) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24818, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { @@ -167228,6 +169159,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: + ; i++ } v2 = Xsqlite3_malloc64(tls, uint64(nByte)) @@ -167247,6 +169179,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) goto _3 _3: + ; i++ } v4 = p @@ -167613,7 +169546,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { var _ /* nOpt at bp+0 */ int32 _, _, _ = azCompileOpt, i, n azCompileOpt = _sqlite3CompileOptions(tls, bp) - if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24812, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24846, int32(7)) == 0 { zOptName += uintptr(7) } n = _sqlite3Strlen30(tls, zOptName) @@ -167629,6 +169562,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -167715,6 +169649,7 @@ func _removeFromBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } } @@ -167736,6 +169671,7 @@ func _addToBlockedList(tls *libc.TLS, db uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 } (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) @@ -167815,6 +169751,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui } goto _1 _1: + ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { @@ -167831,7 +169768,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg ui _leaveMutex(tls) _ = libc.Int32FromInt32(0) if rc != 0 { - v2 = __ccgo_ts + 24820 + v2 = __ccgo_ts + 24854 } else { v2 = uintptr(0) } @@ -168715,18 +170652,18 @@ func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1634, - 1: __ccgo_ts + 7861, - 2: __ccgo_ts + 7866, - 3: __ccgo_ts + 6281, - 4: __ccgo_ts + 6281, - 5: __ccgo_ts + 6276, - 6: __ccgo_ts + 6276, - 7: __ccgo_ts + 8172, - 8: __ccgo_ts + 8172, - 9: __ccgo_ts + 8172, - 10: __ccgo_ts + 8172, - 11: __ccgo_ts + 24843, - 12: __ccgo_ts + 24849, + 1: __ccgo_ts + 7886, + 2: __ccgo_ts + 7891, + 3: __ccgo_ts + 6306, + 4: __ccgo_ts + 6306, + 5: __ccgo_ts + 6301, + 6: __ccgo_ts + 6301, + 7: __ccgo_ts + 8197, + 8: __ccgo_ts + 8197, + 9: __ccgo_ts + 8197, + 10: __ccgo_ts + 8197, + 11: __ccgo_ts + 24877, + 12: __ccgo_ts + 24883, 13: __ccgo_ts + 1648, 14: __ccgo_ts + 1648, 15: __ccgo_ts + 1648, @@ -169154,6 +171091,7 @@ func _jsonCacheDelete(tls *libc.TLS, p uintptr) { _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) @@ -169245,6 +171183,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _1 _1: + ; i++ } if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { @@ -169261,6 +171200,7 @@ func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { } goto _2 _2: + ; i++ } } @@ -169574,6 +171514,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { goto _3 } json_simple_escape: + ; if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { return } @@ -169587,6 +171528,7 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = c goto _4 _3: + ; if int32(c) == int32('\'') { v10 = p + 24 v9 = *(*Tu64)(unsafe.Pointer(v10)) @@ -169626,13 +171568,14 @@ func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { v20 = p + 24 v19 = *(*Tu64)(unsafe.Pointer(v20)) *(*Tu64)(unsafe.Pointer(v20))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)>>int32(4)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)>>int32(4)))) v22 = p + 24 v21 = *(*Tu64)(unsafe.Pointer(v22)) *(*Tu64)(unsafe.Pointer(v22))++ - *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24856 + uintptr(int32(c)&int32(0xf)))) + *(*uint8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*uint8)(unsafe.Pointer(__ccgo_ts + 24890 + uintptr(int32(c)&int32(0xf)))) } _4: + ; z++ N-- } @@ -169668,7 +171611,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { case int32(SQLITE_NULL): _jsonAppendRawNZ(tls, p, __ccgo_ts+1634, uint32(4)) case int32(SQLITE_FLOAT): - _jsonPrintf(tls, int32(100), p, __ccgo_ts+24873, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15323, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) case int32(SQLITE_INTEGER): z = Xsqlite3_value_text(tls, pValue) n = uint32(Xsqlite3_value_bytes(tls, pValue)) @@ -169689,7 +171632,7 @@ func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { _jsonTranslateBlobToText(tls, bp, uint32(0), p) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24907, -int32(1)) (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) _jsonStringReset(tls, p) } @@ -169745,7 +171688,7 @@ func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) } else { if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { - Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24936, -int32(1)) } } } @@ -169914,6 +171857,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _1 _1: + ; j++ } n = j + int32(1) @@ -169936,6 +171880,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } goto _2 _2: + ; j1++ } n = j1 @@ -169992,6 +171937,7 @@ func _json5Whitespace(tls *libc.TLS, zIn uintptr) (r int32) { } } whitespace_done: + ; return n return r } @@ -170025,8 +171971,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(3), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24925, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24951, + FzRepl: __ccgo_ts + 24955, }, 1: { Fc1: uint8('i'), @@ -170034,8 +171980,8 @@ var _aNanInfName = [5]TNanInfName{ Fn: uint8(8), FeType: uint8(JSONB_FLOAT), FnRepl: uint8(7), - FzMatch: __ccgo_ts + 24937, - FzRepl: __ccgo_ts + 24929, + FzMatch: __ccgo_ts + 24963, + FzRepl: __ccgo_ts + 24955, }, 2: { Fc1: uint8('n'), @@ -170050,7 +171996,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('Q'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24946, + FzMatch: __ccgo_ts + 24972, FzRepl: __ccgo_ts + 1634, }, 4: { @@ -170058,7 +172004,7 @@ var _aNanInfName = [5]TNanInfName{ Fc2: uint8('S'), Fn: uint8(4), FnRepl: uint8(4), - FzMatch: __ccgo_ts + 24951, + FzMatch: __ccgo_ts + 24977, FzRepl: __ccgo_ts + 1634, }, } @@ -170074,7 +172020,7 @@ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24956, libc.VaList(bp+8, zFuncName)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24982, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } @@ -170499,6 +172445,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept return j + uint32(1) goto _2 _2: + ; j++ } if int32(seen) == 0 { @@ -170530,7 +172477,7 @@ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDept if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { - if libc.Xstrchr(tls, __ccgo_ts+24999, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + if libc.Xstrchr(tls, __ccgo_ts+25025, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { j++ } else { if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { @@ -170649,6 +172596,7 @@ func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson json_parse_restart: + ; switch int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) { case int32('{'): goto _1 @@ -170729,6 +172677,7 @@ json_parse_restart: } goto _39 _1: + ; /* Parse object */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) @@ -170802,6 +172751,7 @@ _1: j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) } parse_object_value: + ; x = _jsonTranslateTextToBlob(tls, pParse, j) if x <= 0 { if x != -int32(1) { @@ -170841,14 +172791,17 @@ _1: return -int32(1) goto _42 _42: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _2: + ; /* Parse array */ iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + _ = libc.Int32FromInt32(0) _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) iStart = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { @@ -170909,19 +172862,23 @@ _2: return -int32(1) goto _45 _45: + ; j++ } _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- return int32(j + uint32(1)) _4: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) opcode = uint8(JSONB_TEXT) goto parse_string _3: + ; /* Parse string */ opcode = uint8(JSONB_TEXT) parse_string: + ; cDelim = *(*uint8)(unsafe.Pointer(z + uintptr(i))) j = i + uint32(1) for int32(1) != 0 { @@ -170983,24 +172940,28 @@ parse_string: _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) return int32(j + uint32(1)) _5: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7861, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7886, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) return int32(i + uint32(4)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _6: - if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7866, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7891, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(5))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) return int32(i + uint32(5)) } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _19: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number _7: + ; if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))])&int32(0x04) != 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ @@ -171010,19 +172971,31 @@ _7: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _18: + ; _17: + ; _16: + ; _15: + ; _14: + ; _13: + ; _12: + ; _11: + ; _10: + ; _9: + ; _8: + ; /* Parse number */ t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: + ; seenE = uint8(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171041,6 +173014,7 @@ parse_number: } goto _47 _47: + ; j++ } goto parse_number_finish @@ -171055,14 +173029,14 @@ parse_number: /* JSON5 allows for "+Infinity" and "-Infinity" using exactly ** that case. SQLite also allows these in any case and it allows ** "+inf" and "-inf". */ - if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24925, int32(3)) == 0 { + if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24951, int32(3)) == 0 { (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } - if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25021, int32(5)) == 0 { + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25047, int32(5)) == 0 { v48 = int32(9) } else { v48 = int32(4) @@ -171092,6 +173066,7 @@ parse_number: } goto _49 _49: + ; j++ } goto parse_number_finish @@ -171101,6 +173076,7 @@ parse_number: } } parse_number_2: + ; j = i + uint32(1) for { c = *(*uint8)(unsafe.Pointer(z + uintptr(j))) @@ -171145,6 +173121,7 @@ parse_number_2: break goto _50 _50: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { @@ -171157,6 +173134,7 @@ parse_number_2: } } parse_number_finish: + ; _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) @@ -171166,33 +173144,50 @@ parse_number_finish: _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) return int32(j) _20: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(2) /* End of {...} */ _21: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(3) /* End of [...] */ _22: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(4) /* List separator */ _23: + ; (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(5) /* Object label/value separator */ _24: + ; return 0 /* End of file */ _28: + ; _27: + ; _26: + ; _25: + ; i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) goto json_parse_restart _36: + ; _35: + ; _34: + ; _33: + ; _32: + ; _31: + ; _30: + ; _29: + ; j = uint32(_json5Whitespace(tls, z+uintptr(i))) if j > uint32(0) { i += j @@ -171202,12 +173197,14 @@ _29: (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) _37: + ; if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1634, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+uint32(4))))])&libc.Int32FromInt32(0x06) != 0) { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) return int32(i + uint32(4)) } /* fall-through into the default case that checks for NaN */ _38: + ; c = *(*uint8)(unsafe.Pointer(z + uintptr(i))) k1 = uint32(0) for { @@ -171225,7 +173222,7 @@ _38: goto _51 } if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) } @@ -171233,11 +173230,13 @@ _38: return int32(i + uint32(nn)) goto _51 _51: + ; k1++ } (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i return -int32(1) /* Syntax error */ -_39: /* End switch(z[i]) */ +_39: + ; /* End switch(z[i]) */ return r } @@ -171268,7 +173267,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 i += _json5Whitespace(tls, zJson+uintptr(i)) if *(*uint8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { if pCtx != 0 { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } _jsonParseReset(tls, pParse) return int32(1) @@ -171281,7 +173280,7 @@ func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int3 if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) } } _jsonParseReset(tls, pParse) @@ -171303,6 +173302,10 @@ func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { var _ /* px at bp+0 */ TJsonParse libc.Xmemset(tls, bp, 0, uint64(72)) _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) @@ -171441,22 +173444,28 @@ func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintpt } goto _16 _2: + ; _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1634, uint32(4)) return i + uint32(1) _3: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7861, uint32(4)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7886, uint32(4)) return i + uint32(1) _4: - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7866, uint32(5)) + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7891, uint32(5)) return i + uint32(1) _6: + ; _5: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto malformed_jsonb } _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 -_7: /* Integer literal in hexadecimal notation */ +_7: + ; /* Integer literal in hexadecimal notation */ k = uint32(2) u = uint64(0) zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) @@ -171489,16 +173498,18 @@ _7: /* Integer literal in hexadecimal notation */ } goto _17 _17: + ; k++ } if bOverflow != 0 { - v19 = __ccgo_ts + 24929 + v19 = __ccgo_ts + 24955 } else { - v19 = __ccgo_ts + 11728 + v19 = __ccgo_ts + 11753 } _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) goto _16 -_8: /* Float literal missing digits beside "." */ +_8: + ; /* Float literal missing digits beside "." */ k1 = uint32(0) zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -171521,16 +173532,20 @@ _8: /* Float literal missing digits beside "." */ } goto _20 _20: + ; k1++ } goto _16 _10: + ; _9: + ; _jsonAppendChar(tls, pOut, uint8('"')) _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _11: + ; sz2 = *(*Tu32)(unsafe.Pointer(bp)) zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) _jsonAppendChar(tls, pOut, uint8('"')) @@ -171542,6 +173557,7 @@ _11: } goto _21 _21: + ; k2++ } if k2 > uint32(0) { @@ -171553,7 +173569,7 @@ _11: sz2 -= k2 } if int32(*(*uint8)(unsafe.Pointer(zIn2))) == int32('"') { - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25027, uint32(2)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25053, uint32(2)) zIn2++ sz2-- continue @@ -171569,7 +173585,7 @@ _11: case int32('\''): _jsonAppendChar(tls, pOut, uint8('\'')) case int32('v'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25030, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25056, uint32(6)) case int32('x'): if sz2 < uint32(4) { p23 = pOut + 33 @@ -171577,12 +173593,12 @@ _11: sz2 = uint32(2) break } - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25037, uint32(4)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25063, uint32(4)) _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) zIn2 += uintptr(2) sz2 -= uint32(2) case int32('0'): - _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25042, uint32(6)) + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25068, uint32(6)) case int32('\r'): if sz2 > uint32(2) && int32(*(*uint8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { zIn2++ @@ -171612,9 +173628,11 @@ _11: _jsonAppendChar(tls, pOut, uint8('"')) goto _16 _12: + ; _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) goto _16 _13: + ; _jsonAppendChar(tls, pOut, uint8('[')) j = i + n iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) @@ -171632,6 +173650,7 @@ _13: _jsonAppendChar(tls, pOut, uint8(']')) goto _16 _14: + ; x = 0 _jsonAppendChar(tls, pOut, uint8('{')) j = i + n @@ -171657,11 +173676,14 @@ _14: _jsonAppendChar(tls, pOut, uint8('}')) goto _16 _15: + ; malformed_jsonb: + ; p29 = pOut + 33 *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) goto _16 _16: + ; return i + n + *(*Tu32)(unsafe.Pointer(bp)) } @@ -171732,6 +173754,7 @@ func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { n = _jsonbPayloadSize(tls, pParse, i, bp) goto _1 _1: + ; i += *(*Tu32)(unsafe.Pointer(bp)) + n k++ } @@ -172155,6 +174178,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _1 _1: + ; i++ } nKey = i - uint32(1) @@ -172173,6 +174197,7 @@ func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, i } goto _2 _2: + ; i++ } nKey = i @@ -172389,7 +174414,7 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te db = Xsqlite3_context_db_handle(tls, pCtx) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { @@ -172424,25 +174449,30 @@ func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, te } goto _15 _1: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_null(tls, pCtx) goto _15 _2: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, int32(1)) goto _15 _3: + ; if *(*Tu32)(unsafe.Pointer(bp)) != 0 { goto returnfromblob_malformed } Xsqlite3_result_int(tls, pCtx, 0) goto _15 _5: + ; _4: + ; *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 bNeg = 0 if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { @@ -172487,11 +174517,14 @@ _4: } goto _15 _7: + ; _6: + ; if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { goto returnfromblob_malformed } to_double: + ; z1 = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) if z1 == uintptr(0) { goto returnfromblob_oom @@ -172504,11 +174537,15 @@ to_double: Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 16))) goto _15 _9: + ; _8: + ; Xsqlite3_result_text(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), int32(*(*Tu32)(unsafe.Pointer(bp))), uintptr(-libc.Int32FromInt32(1))) goto _15 _11: + ; _10: + ; nOut = *(*Tu32)(unsafe.Pointer(bp)) z2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) zOut = _sqlite3DbMallocRaw(tls, db, uint64(nOut+uint32(1))) @@ -172579,6 +174616,7 @@ _10: } goto _17 _17: + ; iIn++ } /* end for() */ _ = libc.Int32FromInt32(0) @@ -172586,7 +174624,9 @@ _10: Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) goto _15 _13: + ; _12: + ; if textOnly != 0 { v30 = 0 } else { @@ -172600,14 +174640,18 @@ _12: } goto _15 _14: + ; goto returnfromblob_malformed _15: + ; return returnfromblob_oom: + ; Xsqlite3_result_error_nomem(tls, pCtx) return returnfromblob_malformed: - Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24910, -int32(1)) + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24936, -int32(1)) return } @@ -172648,7 +174692,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24881, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24907, -int32(1)) return int32(1) } case int32(SQLITE_TEXT): @@ -172661,7 +174705,7 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) libc.Xmemset(tls, pParse, 0, uint64(72)) return int32(1) @@ -172680,10 +174724,10 @@ func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uin return int32(1) } if int32(*(*uint8)(unsafe.Pointer(z))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25015) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25041) } else { if int32(*(*uint8)(unsafe.Pointer(z))) == int32('-') && int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('I') { - _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25008) + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25034) } else { _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) } @@ -172722,7 +174766,7 @@ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { defer tls.Free(16) var zMsg uintptr _ = zMsg - zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25049, libc.VaList(bp+8, zPath)) + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25075, libc.VaList(bp+8, zPath)) if ctx == uintptr(0) { return zMsg } @@ -172809,15 +174853,17 @@ func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, e } goto _2 _2: + ; i += int32(2) } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return jsonInsertIntoBlob_patherror: + ; _jsonParseFree(tls, p) if rc == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } else { _jsonBadPathError(tls, ctx, zPath) } @@ -172903,6 +174949,7 @@ func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r u } db = Xsqlite3_context_db_handle(tls, ctx) rebuild_from_cache: + ; p = _sqlite3DbMallocZero(tls, db, uint64(72)) if p == uintptr(0) { goto json_pfa_oom @@ -172946,12 +174993,13 @@ rebuild_from_cache: } (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { goto json_pfa_malformed } - if (*TJsonParse)(unsafe.Pointer(p)).FzJson == uintptr(0) { - goto json_pfa_oom - } + _ = libc.Int32FromInt32(0) if flgs&uint32(JSON_KEEPERROR) != 0 { v2 = uintptr(0) } else { @@ -172991,15 +175039,17 @@ rebuild_from_cache: } return p json_pfa_malformed: + ; if flgs&uint32(JSON_KEEPERROR) != 0 { (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) return p } else { _jsonParseFree(tls, p) - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) return uintptr(0) } json_pfa_oom: + ; _jsonParseFree(tls, pFromCache) _jsonParseFree(tls, p) Xsqlite3_result_error_nomem(tls, ctx) @@ -173091,6 +175141,7 @@ func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) goto _1 _1: + ; i++ } _jsonAppendChar(tls, bp, uint8(']')) @@ -173128,7 +175179,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('$') { v1 = zPath + uintptr(1) } else { - v1 = __ccgo_ts + 25067 + v1 = __ccgo_ts + 25093 } i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) if i >= uint32(JSON_LOOKUP_PATHERROR) { @@ -173138,7 +175189,7 @@ func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } eErr = uint8(1) @@ -173169,6 +175220,7 @@ func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173187,6 +175239,7 @@ func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { } goto _1 _1: + ; i++ } return libc.BoolInt32(i == n) @@ -173260,9 +175313,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { */ _jsonStringInit(tls, bp, ctx) if _jsonAllDigits(tls, zPath, nPath) != 0 { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25069, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25095, uint32(1)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+5136, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5161, uint32(2)) } else { if _jsonAllAlphanum(tls, zPath, nPath) != 0 { _jsonAppendRawNZ(tls, bp, __ccgo_ts+1661, uint32(1)) @@ -173271,9 +175324,9 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if int32(*(*uint8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*uint8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) } else { - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25071, uint32(2)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25097, uint32(2)) _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) - _jsonAppendRawNZ(tls, bp, __ccgo_ts+25074, uint32(1)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25100, uint32(1)) } } } @@ -173314,7 +175367,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } else { if j == uint32(JSON_LOOKUP_ERROR) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) goto json_extract_error } else { _jsonBadPathError(tls, ctx, zPath) @@ -173324,6 +175377,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if argc > int32(2) { @@ -173334,6 +175388,7 @@ func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } } json_extract_error: + ; _jsonStringReset(tls, bp) _jsonParseFree(tls, p) return @@ -173582,7 +175637,7 @@ func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == int32(JSON_MERGE_OOM) { Xsqlite3_result_error_nomem(tls, ctx) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } _jsonParseFree(tls, pPatch) @@ -173606,7 +175661,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { var _ /* jx at bp+0 */ TJsonString _, _, _ = i, n, z if argc&int32(1) != 0 { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25076, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25102, -int32(1)) return } _jsonStringInit(tls, bp, ctx) @@ -173617,7 +175672,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { break } if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25127, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25153, -int32(1)) _jsonStringReset(tls, bp) return } @@ -173629,6 +175684,7 @@ func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) goto _1 _1: + ; i += int32(2) } _jsonAppendChar(tls, bp, uint8('}')) @@ -173688,21 +175744,24 @@ func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if rc == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_remove_done } goto _2 _2: + ; i++ } _jsonReturnParse(tls, ctx, p) _jsonParseFree(tls, p) return json_remove_patherror: + ; _jsonBadPathError(tls, ctx, zPath) json_remove_done: + ; _jsonParseFree(tls, p) return } @@ -173720,7 +175779,7 @@ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { return } if argc&int32(1) == 0 { - _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15762) + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15796) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) @@ -173751,9 +175810,9 @@ func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } if argc&int32(1) == 0 { if bIsSet != 0 { - v1 = __ccgo_ts + 25161 + v1 = __ccgo_ts + 25187 } else { - v1 = __ccgo_ts + 25165 + v1 = __ccgo_ts + 25191 } _jsonWrongNumArgs(tls, ctx, v1) return @@ -173801,7 +175860,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if i == uint32(JSON_LOOKUP_PATHERROR) { _jsonBadPathError(tls, ctx, zPath) } else { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+24910, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24936, -int32(1)) } } goto json_type_done @@ -173811,6 +175870,7 @@ func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) json_type_done: + ; _jsonParseFree(tls, p) } @@ -173888,7 +175948,7 @@ func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc == int32(2) { f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) if f < int64(1) || f > int64(15) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+25172, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25198, -int32(1)) return } flags = uint8(f & int64(0x0f)) @@ -173994,6 +176054,7 @@ func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; k++ } iErrPos++ @@ -174077,7 +176138,7 @@ func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25229, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25255, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174143,6 +176204,7 @@ func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { @@ -174225,7 +176287,7 @@ func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { } } } else { - Xsqlite3_result_text(tls, ctx, __ccgo_ts+25232, int32(2), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25258, int32(2), libc.UintptrFromInt32(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -174328,7 +176390,7 @@ func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argv _ = argc _ = pAux - rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25235) + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25261) if rc == SQLITE_OK { pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew @@ -174464,7 +176526,7 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { - _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25318, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25344, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) } else { *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) needQuote = 0 @@ -174485,13 +176547,14 @@ func _jsonAppendPathName(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } if needQuote != 0 { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25325, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25351, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } else { - _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25333, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25359, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) } } } @@ -174655,6 +176718,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r case int32(JEACH_VALUE): i = uint32(_jsonSkipLabel(tls, p)) _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } case int32(JEACH_TYPE): i1 = uint32(_jsonSkipLabel(tls, p)) eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) @@ -174684,9 +176750,9 @@ func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) case int32(JEACH_JSON): if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { - Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), libc.UintptrFromInt32(0)) + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) } else { - Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), libc.UintptrFromInt32(0)) + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) } break } @@ -174747,6 +176813,7 @@ func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) } goto _2 _2: + ; i++ pConstraint += 12 } @@ -174877,7 +176944,7 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a i = v5 (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) - _jsonAppendRaw(tls, p+56, __ccgo_ts+25339, uint32(1)) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25365, uint32(1)) } (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) n = _jsonbPayloadSize(tls, p+192, i, bp) @@ -174898,8 +176965,9 @@ func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, a } return SQLITE_OK json_each_malformed_input: + ; Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24910, 0) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24936, 0) _jsonEachCursorReset(tls, p) if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { v6 = int32(SQLITE_ERROR) @@ -174960,176 +177028,176 @@ var _aJsonFunc = [32]TFuncDef{ 0: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25341, + FzName: __ccgo_ts + 25367, }, 1: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25346, + FzName: __ccgo_ts + 25372, }, 2: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25352, + FzName: __ccgo_ts + 25378, }, 3: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25363, + FzName: __ccgo_ts + 25389, }, 4: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 5: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25375, + FzName: __ccgo_ts + 25401, }, 6: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25393, + FzName: __ccgo_ts + 25419, }, 7: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25413, + FzName: __ccgo_ts + 25439, }, 8: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25426, + FzName: __ccgo_ts + 25452, }, 9: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25440, + FzName: __ccgo_ts + 25466, }, 10: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25443, + FzName: __ccgo_ts + 25469, }, 11: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25447, + FzName: __ccgo_ts + 25473, }, 12: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25459, + FzName: __ccgo_ts + 25485, }, 13: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25472, + FzName: __ccgo_ts + 25498, }, 14: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25484, + FzName: __ccgo_ts + 25510, }, 15: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25497, + FzName: __ccgo_ts + 25523, }, 16: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25508, + FzName: __ccgo_ts + 25534, }, 17: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25520, + FzName: __ccgo_ts + 25546, }, 18: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25531, + FzName: __ccgo_ts + 25557, }, 19: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25543, + FzName: __ccgo_ts + 25569, }, 20: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25556, + FzName: __ccgo_ts + 25582, }, 21: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25569, + FzName: __ccgo_ts + 25595, }, 22: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25583, + FzName: __ccgo_ts + 25609, }, 23: { FnArg: int8(-int32(1)), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25592, + FzName: __ccgo_ts + 25618, }, 24: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 25: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25602, + FzName: __ccgo_ts + 25628, }, 26: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 27: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), - FzName: __ccgo_ts + 25612, + FzName: __ccgo_ts + 25638, }, 28: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25623, + FzName: __ccgo_ts + 25649, }, 29: { FnArg: int8(1), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25640, + FzName: __ccgo_ts + 25666, }, 30: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), - FzName: __ccgo_ts + 25658, + FzName: __ccgo_ts + 25684, }, 31: { FnArg: int8(2), FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), - FzName: __ccgo_ts + 25676, + FzName: __ccgo_ts + 25702, }, } @@ -175199,6 +177267,7 @@ func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -175209,11 +177278,11 @@ var _aMod = [2]struct { FpModule uintptr }{ 0: { - FzName: __ccgo_ts + 25695, + FzName: __ccgo_ts + 25721, FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), }, 1: { - FzName: __ccgo_ts + 25705, + FzName: __ccgo_ts + 25731, FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), }, } @@ -175747,6 +177816,7 @@ func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { } goto _1 _1: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext } return p @@ -175783,6 +177853,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { _ = libc.Int32FromInt32(0) goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 } *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext @@ -175822,11 +177893,9 @@ func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { var pBlob uintptr _ = pBlob - if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 && (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) { - pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob - (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) - Xsqlite3_blob_close(tls, pBlob) - } + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) } // C documentation @@ -175866,10 +177935,9 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } if (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25715, iNode, 0, pRtree+112) + rc = Xsqlite3_blob_open(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, __ccgo_ts+25741, iNode, 0, pRtree+112) } if rc != 0 { - _nodeBlobReset(tls, pRtree) *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -175923,6 +177991,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } *(*uintptr)(unsafe.Pointer(ppNode)) = pNode } else { + _nodeBlobReset(tls, pRtree) if pNode != 0 { (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- Xsqlite3_free(tls, pNode) @@ -175951,6 +178020,7 @@ func _nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uint p += uintptr(_writeCoord(tls, p, pCell+8+uintptr(ii)*4)) goto _1 _1: + ; ii++ } (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) @@ -176075,6 +178145,7 @@ func _nodeGetRowid(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) (r // ** Return coordinate iCoord from cell iCell in node pNode. // */ func _nodeGetCoord(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iCoord int32, pCoord uintptr) { + _ = libc.Int32FromInt32(0) _readCoord(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+uintptr(int32(12)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*iCell+int32(4)*iCoord), pCoord) } @@ -176176,7 +178247,7 @@ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab - zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25720, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+25746, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -176237,6 +178308,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { } goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) @@ -176250,6 +178322,7 @@ func _resetCursor(tls *libc.TLS, pCsr uintptr) { _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(pCsr + 88 + uintptr(ii)*8))) goto _2 _2: + ; ii++ } Xsqlite3_free(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) @@ -176274,7 +178347,9 @@ func _rtreeClose(tls *libc.TLS, cur uintptr) (r int32) { Xsqlite3_finalize(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) Xsqlite3_free(tls, pCsr) (*TRtree)(unsafe.Pointer(pRtree)).FnCursor-- - _nodeBlobReset(tls, pRtree) + if (*TRtree)(unsafe.Pointer(pRtree)).FnCursor == uint32(0) && int32((*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0 { + _nodeBlobReset(tls, pRtree) + } return SQLITE_OK } @@ -176582,6 +178657,7 @@ func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, } goto _1 _1: + ; ii++ } return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } } return *(*int32)(unsafe.Pointer(bp)) } @@ -177020,6 +179102,9 @@ func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { if p == uintptr(0) { return SQLITE_OK } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } if i == 0 { Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) } else { @@ -177096,7 +179181,7 @@ func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, p func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { var pBlob, pInfo, pSrc uintptr _, _, _ = pBlob, pInfo, pSrc /* Callback information */ - pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25802) + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25828) if pSrc == uintptr(0) { return int32(SQLITE_ERROR) } @@ -177234,6 +179319,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp } goto _1 _1: + ; ii++ } } @@ -177322,6 +179408,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } _ = libc.Int32FromInt32(0) @@ -177341,6 +179428,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) goto _3 _3: + ; jj++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) @@ -177392,6 +179480,7 @@ func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _2 _2: + ; ii++ } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) @@ -177555,6 +179644,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _1 _1: + ; ii += int32(2) } } else { @@ -177570,6 +179660,7 @@ func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int } goto _2 _2: + ; ii += int32(2) } } @@ -177653,11 +179744,13 @@ func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell } goto _2 _2: + ; jj += int32(2) } overlap += o goto _1 _1: + ; ii++ } return overlap @@ -177713,6 +179806,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _2 _2: + ; iCell++ } if !(bFound != 0) { @@ -177736,6 +179830,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp } goto _3 _3: + ; iCell++ } } @@ -177744,6 +179839,7 @@ func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, pp *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) goto _1 _1: + ; ii++ } *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) @@ -177916,11 +180012,13 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj goto _2 _2: + ; jj++ } _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) goto _1 _1: + ; ii++ } ii = 0 @@ -177951,6 +180049,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _5 _5: + ; kk++ } margin += _cellMargin(tls, pRtree, bp) @@ -177964,6 +180063,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _4 _4: + ; nLeft++ } if ii == 0 || margin < fBestMargin { @@ -177973,6 +180073,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 } goto _3 _3: + ; ii++ } libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48)) @@ -177999,6 +180100,7 @@ func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int3 _cellUnion(tls, pRtree, pBbox, pCell) goto _6 _6: + ; ii++ } Xsqlite3_free(tls, aaSorted) @@ -178026,6 +180128,7 @@ func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, i } goto _2 _2: + ; p = (*TRtreeNode)(unsafe.Pointer(p)).FpParent } if pChild != 0 { @@ -178074,6 +180177,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe _nodeGetCell(tls, pRtree, pNode, i, aCell+uintptr(i)*48) goto _1 _1: + ; i++ } _nodeZero(tls, pRtree, pNode) @@ -178155,6 +180259,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _7 _7: + ; i++ } if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { @@ -178170,6 +180275,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe } goto _8 _8: + ; i++ } } else { @@ -178186,6 +180292,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe pLeft = uintptr(0) } splitnode_out: + ; _nodeRelease(tls, pRtree, pRight) _nodeRelease(tls, pRtree, pLeft) Xsqlite3_free(tls, aCell) @@ -178230,6 +180337,7 @@ func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { } goto _1 _1: + ; pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent } if pTest == uintptr(0) { @@ -178321,6 +180429,7 @@ func _fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { _cellUnion(tls, pRtree, bp+8, bp+56) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode @@ -178431,6 +180540,7 @@ func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32 } goto _1 _1: + ; ii++ } return rc @@ -178534,6 +180644,7 @@ func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) goto _1 _1: + ; *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted } /* Release the reference to the root node. */ @@ -178613,7 +180724,7 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) _ = libc.Int32FromInt32(0) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25816, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25842, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { @@ -178623,11 +180734,11 @@ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25836, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25862, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) - (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25868, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25894, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -178702,6 +180813,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _1 _1: + ; ii += int32(2) } } else { @@ -178718,6 +180830,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } goto _2 _2: + ; ii += int32(2) } } @@ -178781,6 +180894,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) goto _3 _3: + ; jj++ } Xsqlite3_step(tls, pUp) @@ -178788,6 +180902,7 @@ func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRow } } constraint: + ; _rtreeRelease(tls, pRtree) return rc } @@ -178801,8 +180916,7 @@ func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { var pRtree uintptr _ = pRtree pRtree = pVtab - _ = libc.Int32FromInt32(0) - (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) return SQLITE_OK } @@ -178821,6 +180935,10 @@ func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { return SQLITE_OK } +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + // C documentation // // /* @@ -178834,7 +180952,7 @@ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25905, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25931, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -178888,9 +181006,9 @@ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 - zFmt = __ccgo_ts + 26050 + zFmt = __ccgo_ts + 26076 nRow = int64(RTREE_MIN_ROWEST) - rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11557, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11582, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { @@ -178941,15 +181059,16 @@ func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName1 = [3]uintptr{ - 0: __ccgo_ts + 26106, - 1: __ccgo_ts + 5459, - 2: __ccgo_ts + 16660, + 0: __ccgo_ts + 26132, + 1: __ccgo_ts + 5484, + 2: __ccgo_ts + 16694, } var _rtreeModule = Tsqlite3_module{ @@ -178974,7 +181093,7 @@ func init() { *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) - *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) @@ -178993,20 +181112,21 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db if isCreate != 0 { p = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26520, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26546, libc.VaList(bp+8, zDb, zPrefix)) ii = 0 for { if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26582, libc.VaList(bp+8, ii)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26608, libc.VaList(bp+8, ii)) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26587, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26651, libc.VaList(bp+8, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, __ccgo_ts+26721, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26613, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26677, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26747, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return int32(SQLITE_NOMEM) @@ -179036,7 +181156,7 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } else { /* An UPSERT is very slightly slower than REPLACE, but it is needed ** if there are auxiliary columns */ - zFormat = __ccgo_ts + 26770 + zFormat = __ccgo_ts + 26796 } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) if zSql != 0 { @@ -179047,33 +181167,35 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref Xsqlite3_free(tls, zSql) goto _2 _2: + ; i++ } if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { - (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26878, libc.VaList(bp+8, zDb, zPrefix)) + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26904, libc.VaList(bp+8, zDb, zPrefix)) if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { p1 = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26923, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26949, libc.VaList(bp+8, zDb, zPrefix)) ii1 = 0 for { if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { break } if ii1 != 0 { - Xsqlite3_str_append(tls, p1, __ccgo_ts+13065, int32(1)) + Xsqlite3_str_append(tls, p1, __ccgo_ts+13090, int32(1)) } if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26950, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26976, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) } else { - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26972, libc.VaList(bp+8, ii1, ii1+int32(2))) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26998, libc.VaList(bp+8, ii1, ii1+int32(2))) } goto _3 _3: + ; ii1++ } - Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26980, 0) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27006, 0) zSql1 = Xsqlite3_str_finish(tls, p1) if zSql1 == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -179087,14 +181209,14 @@ func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPref } var _azSql = [8]uintptr{ - 0: __ccgo_ts + 26111, - 1: __ccgo_ts + 26164, - 2: __ccgo_ts + 26209, - 3: __ccgo_ts + 26261, - 4: __ccgo_ts + 26315, - 5: __ccgo_ts + 26360, - 6: __ccgo_ts + 26418, - 7: __ccgo_ts + 26473, + 0: __ccgo_ts + 26137, + 1: __ccgo_ts + 26190, + 2: __ccgo_ts + 26235, + 3: __ccgo_ts + 26287, + 4: __ccgo_ts + 26341, + 5: __ccgo_ts + 26386, + 6: __ccgo_ts + 26444, + 7: __ccgo_ts + 26499, } // C documentation @@ -179152,7 +181274,7 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE _, _ = rc, zSql if isCreate != 0 { *(*int32)(unsafe.Pointer(bp)) = 0 - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26996, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27022, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) rc = _getIntFromStmt(tls, db, zSql, bp) if rc == SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) @@ -179163,14 +181285,14 @@ func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzE *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } } else { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27016, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27042, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) rc = _getIntFromStmt(tls, db, zSql, pRtree+32) if rc != SQLITE_OK { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3795, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { @@ -179247,13 +181369,13 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27265, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27291, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = int32(4) for { if !(ii < argc) { @@ -179262,7 +181384,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) if int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('+') { (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27289, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27315, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) } else { if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { break @@ -179273,9 +181395,10 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt } goto _2 _2: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -179327,6 +181450,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK rtreeInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -179337,8 +181461,8 @@ rtreeInit_fail: } var _azFormat = [2]uintptr{ - 0: __ccgo_ts + 27295, - 1: __ccgo_ts + 27306, + 0: __ccgo_ts + 27321, + 1: __ccgo_ts + 27332, } // C documentation @@ -179396,22 +181520,24 @@ func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { } _nodeGetCell(tls, bp+40, bp, ii, bp+1008) if ii > 0 { - Xsqlite3_str_append(tls, pOut, __ccgo_ts+11177, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11202, int32(1)) } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27319, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27345, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) jj = 0 for { if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { break } - Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27325, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27351, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) goto _2 _2: + ; jj++ } - Xsqlite3_str_append(tls, pOut, __ccgo_ts+27329, int32(1)) + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27355, int32(1)) goto _1 _1: + ; ii++ } errCode = Xsqlite3_str_errcode(tls, pOut) @@ -179435,7 +181561,7 @@ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { _ = zBlob _ = nArg if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+27331, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27357, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -179553,11 +181679,11 @@ func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintpt (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } else { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - v1 = __ccgo_ts + 4178 + v1 = __ccgo_ts + 4203 } else { v1 = __ccgo_ts + 1648 } - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27364, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27390, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) } @@ -179591,7 +181717,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt _, _, _ = nNode, pNode, pRet pRet = uintptr(0) /* Return value */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { - (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27371, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27397, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) @@ -179608,7 +181734,7 @@ func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintpt } _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27416, libc.VaList(bp+8, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27442, libc.VaList(bp+8, iNode)) } } return pRet @@ -179637,8 +181763,8 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i var rc int32 _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 azSql = [2]uintptr{ - 0: __ccgo_ts + 27448, - 1: __ccgo_ts + 27502, + 0: __ccgo_ts + 27474, + 1: __ccgo_ts + 27528, } _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { @@ -179652,21 +181778,21 @@ func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, i rc = Xsqlite3_step(tls, pStmt) if rc == int32(SQLITE_DONE) { if bLeaf != 0 { - v1 = __ccgo_ts + 27550 + v1 = __ccgo_ts + 27576 } else { - v1 = __ccgo_ts + 27558 + v1 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27567, libc.VaList(bp+8, iKey, iVal, v1)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27593, libc.VaList(bp+8, iKey, iVal, v1)) } else { if rc == int32(SQLITE_ROW) { ii = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { if bLeaf != 0 { - v2 = __ccgo_ts + 27550 + v2 = __ccgo_ts + 27576 } else { - v2 = __ccgo_ts + 27558 + v2 = __ccgo_ts + 27584 } - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27612, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27638, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) } } } @@ -179711,7 +181837,7 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27670, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27696, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) @@ -179729,11 +181855,12 @@ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32 } } if v5 || v4 != 0 { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27718, libc.VaList(bp+24, i, iCell, iNode)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27744, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: + ; i++ } } @@ -179763,19 +181890,19 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if *(*int32)(unsafe.Pointer(bp)) < int32(4) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27785, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27811, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27819, libc.VaList(bp+16, iDepth)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27845, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27849, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27875, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) } else { i = 0 for { @@ -179795,6 +181922,7 @@ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintpt } goto _1 _1: + ; i++ } } @@ -179819,12 +181947,12 @@ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { - pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27904, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27930, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { - _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27935, libc.VaList(bp+8, zTbl, nExpect, nActual)) + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27961, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -179853,7 +181981,7 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab /* Find the number of auxiliary columns */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28002, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28028, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) Xsqlite3_finalize(tls, pStmt) @@ -179863,11 +181991,11 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe } } /* Find number of dimensions in the rtree table. */ - pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25816, libc.VaList(bp+96, zDb, zTab)) + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25842, libc.VaList(bp+96, zDb, zTab)) if pStmt != 0 { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { - _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28030, 0) + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28056, 0) } else { if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) @@ -179883,8 +182011,8 @@ func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRe if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) } - _rtreeCheckCount(tls, bp, __ccgo_ts+28061, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) - _rtreeCheckCount(tls, bp, __ccgo_ts+28068, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28087, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28094, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) } /* Finalize SQL statements used by the integrity-check */ Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) @@ -179912,7 +182040,7 @@ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintpt _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28076, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28102, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } @@ -179963,13 +182091,13 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var _ /* zReport at bp+0 */ uintptr _, _, _, _ = rc, zDb, zTab, v1 if nArg != int32(1) && nArg != int32(2) { - Xsqlite3_result_error(tls, ctx, __ccgo_ts+28095, -int32(1)) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28121, -int32(1)) } else { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) if nArg == int32(1) { zTab = zDb - zDb = __ccgo_ts + 6560 + zDb = __ccgo_ts + 6585 } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -179978,7 +182106,7 @@ func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { if *(*uintptr)(unsafe.Pointer(bp)) != 0 { v1 = *(*uintptr)(unsafe.Pointer(bp)) } else { - v1 = __ccgo_ts + 18427 + v1 = __ccgo_ts + 18461 } Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { @@ -180201,6 +182329,7 @@ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { break goto _1 _1: + ; j++ } if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { @@ -180311,6 +182440,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { } } parse_json_err: + ; if pRc != 0 { *(*int32)(unsafe.Pointer(pRc)) = rc } @@ -180371,6 +182501,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( _geopolySwab32(tls, p+8+uintptr(ii*int32(2)+int32(1))*4) goto _3 _3: + ; ii++ } p4 = p + 4 @@ -180441,18 +182572,19 @@ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) - Xsqlite3_str_append(tls, x, __ccgo_ts+25069, int32(1)) + Xsqlite3_str_append(tls, x, __ccgo_ts+25095, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28146, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28172, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28157, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28183, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180481,19 +182613,20 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) cSep = uint8('\'') - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28168, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, 0) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28186, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28212, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) cSep = uint8(' ') goto _1 _1: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28194, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28220, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) i = int32(1) for { if !(i < argc) { @@ -180501,13 +182634,14 @@ func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { } z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if z != 0 && *(*uint8)(unsafe.Pointer(z)) != 0 { - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28202, libc.VaList(bp+8, z)) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28228, libc.VaList(bp+8, z)) } goto _2 _2: + ; i++ } - Xsqlite3_str_appendf(tls, x, __ccgo_ts+28206, 0) + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28232, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } @@ -180559,6 +182693,7 @@ func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 goto _1 _1: + ; ii++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) @@ -180588,6 +182723,7 @@ func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) goto _1 _1: + ; ii++ } rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) @@ -180653,6 +182789,7 @@ func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t goto _1 _1: + ; ii++ jj-- } @@ -180731,6 +182868,7 @@ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) goto _1 _1: + ; *(*int32)(unsafe.Pointer(bp))++ } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) @@ -180800,6 +182938,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, } goto _5 _5: + ; *(*int32)(unsafe.Pointer(bp))++ } if pRc != 0 { @@ -180809,6 +182948,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto _6 } geopolyBboxFill: + ; pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) @@ -180836,18 +182976,22 @@ geopolyBboxFill: *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY goto _7 _6: + ; Xsqlite3_free(tls, p) *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY _7: + ; goto _2 _1: + ; if aCoord != 0 { libc.Xmemset(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) } _2: + ; return pOut } @@ -181030,6 +183174,7 @@ func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv cnt += v goto _1 _1: + ; ii++ } if v != int32(2) { @@ -181206,6 +183351,7 @@ func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) goto _1 _1: + ; i++ } x = pPoly + 8 + uintptr(i*uint32(2))*4 @@ -181272,6 +183418,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp a[j] = uintptr(0) goto _2 _2: + ; j++ } a[j] = p @@ -181280,6 +183427,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp } goto _1 _1: + ; i++ } p = uintptr(0) @@ -181291,6 +183439,7 @@ func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintp p = _geopolyEventMerge(tls, a[i], p) goto _3 _3: + ; i++ } return p @@ -181359,6 +183508,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { a[i] = uintptr(0) goto _1 _1: + ; i++ } a[i] = p @@ -181375,6 +183525,7 @@ func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { p = _geopolySegmentMerge(tls, a[i], p) goto _2 _2: + ; i++ } return p @@ -181441,6 +183592,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _3 _3: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } pPrev = uintptr(0) @@ -181465,6 +183617,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { pPrev = pSeg goto _4 _4: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181501,6 +183654,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } goto _6 _6: + ; pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext } } @@ -181525,6 +183679,7 @@ func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { } } geopolyOverlapDone: + ; Xsqlite3_free(tls, p) return rc } @@ -181614,13 +183769,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) - libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27259, uint64(6)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27285, uint64(6)) /* Create/Connect to the underlying relational database schema. If ** that is successful, call sqlite3_declare_vtab() to configure ** the r-tree table schema. */ pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28219, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28245, 0) (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ ii = int32(3) @@ -181629,12 +183784,13 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint break } (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28241, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28267, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto _1 _1: + ; ii++ } - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27316, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27342, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(zSql != 0) { rc = int32(SQLITE_NOMEM) @@ -181663,6 +183819,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree return SQLITE_OK geopolyInit_fail: + ; if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) } @@ -181815,6 +183972,7 @@ func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uin } } geopoly_filter_end: + ; _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp + 8)) @@ -181865,11 +184023,12 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } goto _1 _1: + ; ii++ } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16660 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16694 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) @@ -181879,7 +184038,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28245 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28271 (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) @@ -181887,7 +184046,7 @@ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) - (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28251 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28277 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -182009,7 +184168,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) if *(*int32)(unsafe.Pointer(bp)) != 0 { if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28260, 0) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28286, 0) } goto geopoly_update_end } @@ -182089,6 +184248,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) goto _5 _5: + ; jj++ } if nChange != 0 { @@ -182097,6 +184257,7 @@ func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pR } } geopoly_update_end: + ; _rtreeRelease(tls, pRtree) return *(*int32)(unsafe.Pointer(bp)) } @@ -182110,12 +184271,12 @@ geopoly_update_end: func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28300) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28326) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } - if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28316) == 0 { + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28342) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) @@ -182171,6 +184332,7 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) goto _1 _1: + ; i++ } i = uint32(0) @@ -182181,10 +184343,11 @@ func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) goto _2 _2: + ; i++ } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28493, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28519, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -182198,61 +184361,61 @@ var _aFunc = [12]struct { 0: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28331, + FzName: __ccgo_ts + 28357, }, 1: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28344, + FzName: __ccgo_ts + 28370, }, 2: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28357, + FzName: __ccgo_ts + 28383, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), - FzName: __ccgo_ts + 28370, + FzName: __ccgo_ts + 28396, }, 4: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28316, + FzName: __ccgo_ts + 28342, }, 5: { FnArg: int8(3), FbPure: uint8(1), - FzName: __ccgo_ts + 28382, + FzName: __ccgo_ts + 28408, }, 6: { FnArg: int8(2), FbPure: uint8(1), - FzName: __ccgo_ts + 28300, + FzName: __ccgo_ts + 28326, }, 7: { FnArg: int8(1), - FzName: __ccgo_ts + 28405, + FzName: __ccgo_ts + 28431, }, 8: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28419, + FzName: __ccgo_ts + 28445, }, 9: { FnArg: int8(7), FbPure: uint8(1), - FzName: __ccgo_ts + 28432, + FzName: __ccgo_ts + 28458, }, 10: { FnArg: int8(4), FbPure: uint8(1), - FzName: __ccgo_ts + 28446, + FzName: __ccgo_ts + 28472, }, 11: { FnArg: int8(1), FbPure: uint8(1), - FzName: __ccgo_ts + 28462, + FzName: __ccgo_ts + 28488, }, } @@ -182278,7 +184441,7 @@ var _aAgg = [1]struct { FzName uintptr }{ 0: { - FzName: __ccgo_ts + 28474, + FzName: __ccgo_ts + 28500, }, } @@ -182303,20 +184466,20 @@ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28501, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28527, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28511, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28537, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28522, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28548, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28245, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28271, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28533, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28559, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) @@ -182361,6 +184524,7 @@ func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -182410,13 +184574,14 @@ func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) goto _1 _1: + ; i++ } if memErr != 0 { Xsqlite3_result_error_nomem(tls, ctx) _rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25802, __ccgo_fp(_rtreeMatchArgFree)) + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25828, __ccgo_fp(_rtreeMatchArgFree)) } } } @@ -183634,7 +185799,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt /* Figure out the size of the output */ nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) return } aOut = Xsqlite3_malloc(tls, nOut+int32(1)) @@ -183644,7 +185809,7 @@ func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintpt nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, __ccgo_ts+28543, -int32(1)) + Xsqlite3_result_error(tls, context, __ccgo_ts+28569, -int32(1)) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) } @@ -183747,6 +185912,7 @@ func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) @@ -183825,7 +185991,7 @@ func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { /* Free any SQLite statements used while processing the previous object */ _rbuObjIterClearStatements(tls, pIter) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28564, uintptr(0), uintptr(0), p+64) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28590, uintptr(0), uintptr(0), p+64) } if rc == SQLITE_OK { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -183915,7 +186081,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) } } else { - if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25715, zIn, uint64(4)) == 0 { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25741, zIn, uint64(4)) == 0 { i = int32(4) for { if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { @@ -183923,6 +186089,7 @@ func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { } goto _1 _1: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*uint8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { @@ -183951,13 +186118,13 @@ func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { _, _ = rc, v1 libc.Xmemset(tls, pIter, 0, uint64(192)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 28735 + v1 = __ccgo_ts + 28761 } else { v1 = __ccgo_ts + 1648 } - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28776, libc.VaList(bp+8, v1))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28802, libc.VaList(bp+8, v1))) if rc == SQLITE_OK { - rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28926) + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28952) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -184187,7 +186354,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29051, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29077, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { /* Either an error, or no such table. */ goto rbuTableType_end @@ -184197,7 +186364,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29170, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29196, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { goto rbuTableType_end } @@ -184205,7 +186372,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29191, libc.VaList(bp+40, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29217, libc.VaList(bp+40, zIdx))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) @@ -184217,7 +186384,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu goto rbuTableType_end } } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29242, libc.VaList(bp+40, zTab))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29268, libc.VaList(bp+40, zTab))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { @@ -184228,6 +186395,7 @@ func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnu *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) } rbuTableType_end: + ; i = uint32(0) for { if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { @@ -184236,6 +186404,7 @@ rbuTableType_end: _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) goto _1 _1: + ; i++ } } @@ -184258,7 +186427,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { bIndex = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -184271,7 +186440,7 @@ func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { if bPartial != 0 { libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+24, zIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) if iCid >= 0 { @@ -184325,7 +186494,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19870, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19904, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc @@ -184337,7 +186506,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 /* Populate the azTblCol[] and nTblCol variables based on the columns ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29320, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29346, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) _rbuAllocateIterArrays(tls, p, pIter, nCol) @@ -184348,7 +186517,7 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 break } zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) - if Xsqlite3_strnicmp(tls, __ccgo_ts+29339, zName, int32(4)) != 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+29365, zName, int32(4)) != 0 { zCopy = _rbuStrndup(tls, zName, p+56) *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol v3 = pIter + 16 @@ -184356,12 +186525,13 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 *(*int32)(unsafe.Pointer(v3))++ *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29344, zName) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29370, zName) { bRbuRowid = int32(1) } } goto _1 _1: + ; i++ } Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184369,17 +186539,17 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) if bRbuRowid != 0 { - v4 = __ccgo_ts + 29354 + v4 = __ccgo_ts + 29380 } else { - v4 = __ccgo_ts + 29367 + v4 = __ccgo_ts + 29393 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29376, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29402, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) } /* Check that all non-HIDDEN columns in the destination table are also ** present in the input table. Populate the abTblPk[], azTblType[] and ** aiTblOrder[] arrays at the same time. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29405, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29431, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184396,11 +186566,12 @@ func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32 } goto _5 _5: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29427, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29453, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) } else { iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) @@ -184449,10 +186620,11 @@ func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) break } z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+29454, libc.VaList(bp+8, zList, zSep, z)) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29480, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 14990 goto _1 _1: + ; i++ } return zList @@ -184483,12 +186655,13 @@ func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, } if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29463, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29489, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } goto _1 _1: + ; i++ } if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { @@ -184530,21 +186703,21 @@ func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zRet = uintptr(0) if bRowid != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29476, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29502, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29508, libc.VaList(bp+16, iMax)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29534, libc.VaList(bp+16, iMax)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+29531) - zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29537, __ccgo_ts+29544, __ccgo_ts+5081) - zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+29557) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29563, __ccgo_ts+29570, __ccgo_ts+5106) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29552, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29578, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29594, libc.VaList(bp+16, zList, zVal)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29620, libc.VaList(bp+16, zList, zVal)) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -184596,7 +186769,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { zSep = __ccgo_ts + 1648 iCol = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) @@ -184613,20 +186786,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } } else { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) } - zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29622, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29643, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29679, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) - zSep = __ccgo_ts + 14965 + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29648, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29669, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29705, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 14990 iCol++ } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) @@ -184635,7 +186809,7 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29706, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29732, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { zSep = __ccgo_ts + 1648 iCol = 0 @@ -184652,19 +186826,21 @@ func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } } - zVector = _rbuMPrintf(tls, p, __ccgo_ts+29754, libc.VaList(bp+24, zVector, zSep, zQuoted)) - zSep = __ccgo_ts + 14965 + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29780, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 14990 goto _2 _2: + ; iCol++ } if !(bFailed != 0) { - zRet = _rbuMPrintf(tls, p, __ccgo_ts+29761, libc.VaList(bp+24, zLhs, zVector)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29787, libc.VaList(bp+24, zLhs, zVector)) } } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } index_start_out: + ; Xsqlite3_free(tls, zOrder) Xsqlite3_free(tls, zSelect) Xsqlite3_free(tls, zVector) @@ -184716,7 +186892,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) @@ -184725,7 +186901,7 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = uintptr(0) if iCid == -int32(2) { iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29773, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29799, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) zType = __ccgo_ts + 1648 } else { if iCid < 0 { @@ -184739,15 +186915,16 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter } goto _1 _1: + ; i++ } _ = libc.Int32FromInt32(0) zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zCol = __ccgo_ts + 29614 + zCol = __ccgo_ts + 29640 } else { - zCol = __ccgo_ts + 29344 + zCol = __ccgo_ts + 29370 } } zType = __ccgo_ts + 1136 @@ -184755,24 +186932,24 @@ func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposter zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29795, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29821, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { if bDesc != 0 { - v2 = __ccgo_ts + 29531 + v2 = __ccgo_ts + 29557 } else { v2 = __ccgo_ts + 1648 } zOrder = v2 - zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29815, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29841, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29836, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) - zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29869, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29862, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29895, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { rc = int32(SQLITE_NOMEM) } - zCom = __ccgo_ts + 14965 - zAnd = __ccgo_ts + 21979 + zCom = __ccgo_ts + 14990 + zAnd = __ccgo_ts + 22013 nBind++ } rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -184826,22 +187003,23 @@ func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29893, libc.VaList(bp+8, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29919, libc.VaList(bp+8, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, __ccgo_ts+29905, libc.VaList(bp+8, zList, zS)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29931, libc.VaList(bp+8, zList, zS)) } - zS = __ccgo_ts + 14965 + zS = __ccgo_ts + 14990 if zList == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break } goto _1 _1: + ; i++ } /* For a table with implicit rowids, append "old._rowid_" to the list. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29914, libc.VaList(bp+8, zList, zObj)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29940, libc.VaList(bp+8, zList, zObj)) } } return zList @@ -184867,7 +187045,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 zList = uintptr(0) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29929, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { zSep = __ccgo_ts + 1648 @@ -184877,14 +187055,15 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { break } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = _rbuMPrintf(tls, p, __ccgo_ts+29943, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) - zSep = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+29969, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } - zList = _rbuMPrintf(tls, p, __ccgo_ts+29955, libc.VaList(bp+8, zList)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29981, libc.VaList(bp+8, zList)) } else { zSep1 = __ccgo_ts + 1648 i1 = 0 @@ -184894,11 +187073,12 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) - zSep1 = __ccgo_ts + 21979 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22013 } goto _2 _2: + ; i1++ } } @@ -184917,7 +187097,7 @@ func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30018, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30044, 0) } // C documentation @@ -184959,21 +187139,22 @@ func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintpt } c = *(*uint8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == int32('x') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30005, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30031, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('d') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30044, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30070, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14990 } else { if int32(c) == int32('f') { - zList = _rbuMPrintf(tls, p, __ccgo_ts+30074, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) - zSep = __ccgo_ts + 14965 + zList = _rbuMPrintf(tls, p, __ccgo_ts+30100, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 14990 } } } goto _1 _1: + ; i++ } } @@ -185021,6 +187202,7 @@ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { *(*uint8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = uint8(v2) goto _1 _1: + ; i++ } } @@ -185051,16 +187233,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { z = uintptr(0) _ = libc.Int32FromInt32(0) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - zSep = __ccgo_ts + 30111 + zSep = __ccgo_ts + 30137 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29263, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29289, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) - if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16548) == 0 { + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16582) == 0 { zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+24, zIdx))) } break } @@ -185071,16 +187253,16 @@ func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { /* int iCid = sqlite3_column_int(pXInfo, 0); */ zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } zDesc = v1 - z = _rbuMPrintf(tls, p, __ccgo_ts+30124, libc.VaList(bp+24, z, zSep, zCol, zDesc)) - zSep = __ccgo_ts + 14965 + z = _rbuMPrintf(tls, p, __ccgo_ts+30150, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 14990 } } - z = _rbuMPrintf(tls, p, __ccgo_ts+30135, libc.VaList(bp+24, z)) + z = _rbuMPrintf(tls, p, __ccgo_ts+30161, libc.VaList(bp+24, z)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) } return z @@ -185126,7 +187308,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* Figure out the name of the primary key index for the current table. ** This is needed for the argument to "PRAGMA index_xinfo". Set ** zIdx to point to a nul-terminated string containing this name. */ - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30139) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30165) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -185134,7 +187316,7 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { } } if zIdx != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29291, libc.VaList(bp+24, zIdx))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29317, libc.VaList(bp+24, zIdx))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { @@ -185143,21 +187325,21 @@ func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30189, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30215, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) if bDesc != 0 { - v1 = __ccgo_ts + 29531 + v1 = __ccgo_ts + 29557 } else { v1 = __ccgo_ts + 1648 } - zPk = _rbuMPrintf(tls, p, __ccgo_ts+30211, libc.VaList(bp+24, zPk, zComma, iCid, v1)) - zComma = __ccgo_ts + 14965 + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30237, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 14990 } } - zCols = _rbuMPrintf(tls, p, __ccgo_ts+30221, libc.VaList(bp+24, zCols)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30247, libc.VaList(bp+24, zCols)) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30236, libc.VaList(bp+24, zCols, zPk)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30262, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185194,7 +187376,7 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum zComma = __ccgo_ts + 1648 zSql = uintptr(0) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) iCol = 0 for { if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { @@ -185203,37 +187385,38 @@ func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { zPk = __ccgo_ts + 1648 zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { /* If the target table column is an "INTEGER PRIMARY KEY", add ** "PRIMARY KEY" to the imposter table column declaration. */ - zPk = __ccgo_ts + 30298 + zPk = __ccgo_ts + 30324 } if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - v2 = __ccgo_ts + 30311 + v2 = __ccgo_ts + 30337 } else { v2 = __ccgo_ts + 1648 } - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30321, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) - zComma = __ccgo_ts + 14965 + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30347, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 14990 goto _1 _1: + ; iCol++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { zPk1 = _rbuWithoutRowidPK(tls, p, pIter) if zPk1 != 0 { - zSql = _rbuMPrintf(tls, p, __ccgo_ts+30348, libc.VaList(bp+16, zSql, zPk1)) + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30374, libc.VaList(bp+16, zSql, zPk1)) } } - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { - v3 = __ccgo_ts + 30355 + v3 = __ccgo_ts + 30381 } else { v3 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30370, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30396, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) } } @@ -185260,7 +187443,7 @@ func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zColli zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) if zBind != 0 { _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30402, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30428, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -185282,6 +187465,7 @@ func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -185307,7 +187491,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt zRet = uintptr(0) _ = libc.Int32FromInt32(0) if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30459) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30485) } if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) @@ -185377,6 +187561,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _5 _5: + ; i++ } } else { @@ -185391,6 +187576,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _6 _6: + ; i++ } } else { @@ -185402,6 +187588,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _7 _7: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185416,6 +187603,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _8 _8: + ; i++ } if int32(*(*uint8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { @@ -185431,6 +187619,7 @@ func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintpt } goto _2 _2: + ; i++ } if *(*uint8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { @@ -185473,7 +187662,7 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx zLimit = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30525, libc.VaList(bp+40, nOffset)) + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30551, libc.VaList(bp+40, nOffset)) if !(zLimit != 0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } @@ -185491,18 +187680,18 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) /* Create the imposter table used to write to this index. */ - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, int32(1))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(1), tnum)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30545, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) - Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, 0, 0)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30571, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, 0, 0)) /* Create the statement to insert index entries */ (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30610, libc.VaList(bp+40, zTbl, zBind))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30636, libc.VaList(bp+40, zTbl, zBind))) } /* And to delete index entries */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30646, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30672, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) } /* Create the SELECT statement to read keys in sorted order */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185517,26 +187706,26 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } if zStart != 0 { if zPart != 0 { - v2 = __ccgo_ts + 30680 + v2 = __ccgo_ts + 30706 } else { - v2 = __ccgo_ts + 30684 + v2 = __ccgo_ts + 30710 } v1 = v2 } else { v1 = __ccgo_ts + 1648 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30690, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30716, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30751, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30777, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { if zPart != 0 { - v3 = __ccgo_ts + 30680 + v3 = __ccgo_ts + 30706 } else { - v3 = __ccgo_ts + 30684 + v3 = __ccgo_ts + 30710 } - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30812, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30838, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -185555,8 +187744,8 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) - zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6571) - zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6567) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6596) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6592) zCollist = _rbuObjIterGetCollist(tls, p, pIter) (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol /* Create the imposter table or tables (if required). */ @@ -185565,39 +187754,39 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { v4 = __ccgo_ts + 1648 } else { - v4 = __ccgo_ts + 30971 + v4 = __ccgo_ts + 30997 } zWrite = v4 /* Create the INSERT statement to write to the target PK b-tree */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if bRbuRowid != 0 { - v5 = __ccgo_ts + 30980 + v5 = __ccgo_ts + 31006 } else { v5 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+30990, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31016, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) } /* Create the DELETE statement to write to the target PK b-tree. ** Because it only performs INSERT operations, this is not required for ** an rbu vacuum handle. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31026, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31052, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) } if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { zRbuRowid = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - zRbuRowid = __ccgo_ts + 31054 + zRbuRowid = __ccgo_ts + 31080 } /* Create the rbu_tmp_xxx table and the triggers to populate it. */ if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { - v6 = __ccgo_ts + 31066 + v6 = __ccgo_ts + 31092 } else { v6 = __ccgo_ts + 1648 } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31083, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31159, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31109, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31185, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31458, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31484, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) } _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) } @@ -185608,9 +187797,9 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 zOrder = uintptr(0) if bRbuRowid != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v7 = __ccgo_ts + 31557 + v7 = __ccgo_ts + 31583 } else { - v7 = __ccgo_ts + 31567 + v7 = __ccgo_ts + 31593 } zRbuRowid1 = v7 } @@ -185623,14 +187812,14 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 } } if bRbuRowid != 0 { - zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29614, 0) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29640, 0) } else { - zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14965, __ccgo_ts+1648) + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1648, __ccgo_ts+14990, __ccgo_ts+1648) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v8 = __ccgo_ts + 31578 + v8 = __ccgo_ts + 31604 } else { v8 = __ccgo_ts + 1648 } @@ -185640,11 +187829,11 @@ func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int3 v9 = __ccgo_ts + 1648 } if zOrder != 0 { - v10 = __ccgo_ts + 23173 + v10 = __ccgo_ts + 23207 } else { v10 = __ccgo_ts + 1648 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31584, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31610, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) } Xsqlite3_free(tls, zStart1) Xsqlite3_free(tls, zOrder) @@ -185701,6 +187890,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p nUp++ goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } _ = libc.Int32FromInt32(0) @@ -185712,6 +187902,7 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 } *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) @@ -185731,9 +187922,9 @@ func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, p if zSet != 0 { zPrefix = __ccgo_ts + 1648 if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { - zPrefix = __ccgo_ts + 30971 + zPrefix = __ccgo_ts + 30997 } - zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31632, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31658, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate } @@ -185807,7 +187998,7 @@ func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { if pRet == uintptr(0) { return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31662, libc.VaList(bp+24, p+48))) + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31688, libc.VaList(bp+24, p+48))) for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { case int32(RBU_STATE_STAGE): @@ -185869,27 +188060,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31692, libc.VaList(bp+8, zFile, zFile)) + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31718, libc.VaList(bp+8, zFile, zFile)) } } /* If using separate RBU and state databases, attach the state database to ** the RBU db handle now. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31720, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31746, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) libc.Xmemcpy(tls, p+48, __ccgo_ts+3418, uint64(4)) } else { - libc.Xmemcpy(tls, p+48, __ccgo_ts+6560, uint64(4)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+6585, uint64(4)) } /* If it has not already been created, create the rbu_state table */ - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31738, libc.VaList(bp+8, p+48)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31764, libc.VaList(bp+8, p+48)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { bOpen = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBUCNT), p) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBUCNT), p) if rc != int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -185922,10 +188113,10 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) return } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31804, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31830, 0) } else { zExtra = uintptr(0) - if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24562, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24596, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 for *(*uint8)(unsafe.Pointer(zExtra)) != 0 { v1 = zExtra @@ -185941,14 +188132,14 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) if zExtra == uintptr(0) { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 31836 + v2 = __ccgo_ts + 31862 } if zExtra == uintptr(0) { v3 = __ccgo_ts + 1648 } else { v3 = zExtra } - zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31838, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560), v2, v3)) + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31864, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585), v2, v3)) if zTarget == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) return @@ -185959,27 +188150,27 @@ func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31870, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31896, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31885, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31911, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31902, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31928, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, 0) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, 0) /* Mark the database file just opened as an RBU target database. If ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_RBU), p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_RBU), p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31946, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31972, 0) } } @@ -186063,7 +188254,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31918, uintptr(0), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31944, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the @@ -186096,7 +188287,7 @@ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31964, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31990, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -186231,16 +188422,16 @@ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { _ = rc rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxUnlock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), SQLITE_LOCK_NONE) } - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { - Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_FILE_POINTER), bp) + Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpMethods)).FxLock})))(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_LOCK_SHARED)) @@ -186262,7 +188453,7 @@ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) - return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+31999, 0) + return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+32025, 0) } // C documentation @@ -186279,13 +188470,13 @@ func _rbuMoveOalFile(tls *libc.TLS, p uintptr) { defer tls.Free(16) var dbMain, zBase, zMove, zOal, zWal uintptr _, _, _, _, _ = dbMain, zBase, zMove, zOal, zWal - zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560) + zBase = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585) zMove = zBase if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6560) + zMove = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6585) } - zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32024, libc.VaList(bp+8, zMove)) - zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32031, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, __ccgo_ts+32050, libc.VaList(bp+8, zMove)) + zWal = Xsqlite3_mprintf(tls, __ccgo_ts+32057, libc.VaList(bp+8, zMove)) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if zWal == uintptr(0) || zOal == uintptr(0) { @@ -186423,7 +188614,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { ** to write a NULL into the IPK column. That is not permitted. */ if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24119, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24153, 0) return } if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { @@ -186436,6 +188627,7 @@ func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { } goto _1 _1: + ; i++ } if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { @@ -186517,6 +188709,7 @@ func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { } goto _1 _1: + ; i++ } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { @@ -186560,7 +188753,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { } dbread = v1 iCookie = int32(1000000) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32038) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32064) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* Coverage: it may be that this sqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot @@ -186573,7 +188766,7 @@ func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32060, libc.VaList(bp+16, iCookie+int32(1))) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32086, libc.VaList(bp+16, iCookie+int32(1))) } } } @@ -186601,7 +188794,7 @@ func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { } pFd = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32087, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32113, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -186638,9 +188831,9 @@ func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { var _ /* pPragma at bp+0 */ uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32245, libc.VaList(bp+16, zPragma))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32271, libc.VaList(bp+16, zPragma))) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32260, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32286, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) } @@ -186664,9 +188857,9 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _ = libc.Int32FromInt32(0) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32280, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32306, uintptr(0), uintptr(0), p+64) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32305) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32331) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -186677,10 +188870,10 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { return } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32413) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32439) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32478) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32504) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { i = 0 @@ -186691,13 +188884,14 @@ func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) goto _1 _1: + ; i++ } Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32522, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32548, uintptr(0), uintptr(0), p+64) } _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -186724,8 +188918,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** when this handle was opened, create the target database schema. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { _rbuCreateTargetSchema(tls, p) - _rbuCopyPragma(tls, p, __ccgo_ts+17633) - _rbuCopyPragma(tls, p, __ccgo_ts+16744) + _rbuCopyPragma(tls, p, __ccgo_ts+17667) + _rbuCopyPragma(tls, p, __ccgo_ts+16778) } for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { @@ -186733,7 +188927,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { ** cannot be dropped as there are currently active SQL statements. ** But the contents can be deleted. */ if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { - _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32547, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32573, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { _rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -186756,10 +188950,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) _rbuIncrSchemaCookie(tls, p) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+64) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+64) } (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) } @@ -186847,7 +189041,7 @@ func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { } if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32575, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32601, 0) } if rc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow @@ -186870,10 +189064,10 @@ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal - zOal = _rbuMPrintf(tls, p, __ccgo_ts+32024, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32050, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6560, int32(SQLITE_FCNTL_VFS_POINTER), bp) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6585, int32(SQLITE_FCNTL_VFS_POINTER), bp) _ = libc.Int32FromInt32(0) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) Xsqlite3_free(tls, zOal) @@ -186897,7 +189091,7 @@ func _rbuCreateVfs(tls *libc.TLS, p uintptr) { _ = pVfs _ = libc.Int32FromInt32(0) Xsqlite3_randomness(tls, int32(4), bp) - Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32600, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32626, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { pVfs = Xsqlite3_vfs_find(tls, bp+4) @@ -186945,7 +189139,7 @@ func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { } db = v1 _ = libc.Int32FromInt32(0) - rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32611, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32637, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) } else { @@ -186990,11 +189184,11 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) bExists = 0 /* True if rbu_count exists */ (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32683, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32709, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) /* Check for the rbu_count table. If it does not exist, or if an error ** occurs, nPhaseOneStep will be left set to -1. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32697) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32723) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { @@ -187003,7 +189197,7 @@ func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32754) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32780) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) @@ -187085,7 +189279,7 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32828, 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32854, 0) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) @@ -187107,17 +189301,17 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr ** page 1 of the database file. */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v3 = __ccgo_ts + 32860 + v3 = __ccgo_ts + 32886 } else { - v3 = __ccgo_ts + 32867 + v3 = __ccgo_ts + 32893 } - (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32874, libc.VaList(bp+16, v3)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32900, libc.VaList(bp+16, v3)) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14854, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14879, uintptr(0), uintptr(0), p+64) /* Point the object iterator at the first object */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) @@ -187129,21 +189323,21 @@ func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - _rbuCopyPragma(tls, p, __ccgo_ts+17347) - _rbuCopyPragma(tls, p, __ccgo_ts+16759) + _rbuCopyPragma(tls, p, __ccgo_ts+17381) + _rbuCopyPragma(tls, p, __ccgo_ts+16793) } /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32906, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32932, uintptr(0), uintptr(0), p+64) } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6560, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6585, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) if frc == SQLITE_OK { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32922, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32948, uintptr(0), uintptr(0), p+64) } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -187221,7 +189415,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintp } if zState != 0 { n = int32(libc.Xstrlen(tls, zState)) - if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32946, zState+uintptr(n-int32(7)), uint64(7)) { + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+32972, zState+uintptr(n-int32(7)), uint64(7)) { return _rbuMisuseError(tls) } } @@ -187268,7 +189462,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { if !(uint64(i) < nErrmsg-uint64(8)) { break } - if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30971, uint64(8)) == 0 { + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+30997, uint64(8)) == 0 { nDel = int32(8) for int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { nDel++ @@ -187278,6 +189472,7 @@ func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } } @@ -187295,7 +189490,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { if p != 0 { /* Commit the transaction to the *-oal file. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), p+64) } /* Sync the db file if currently doing an incremental checkpoint */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { @@ -187304,7 +189499,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { } _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { - (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), p+64) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), p+64) } /* Close any open statement handles. */ _rbuObjIterFinalize(tls, p+80) @@ -187314,7 +189509,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { - rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32954, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32980, uintptr(0), uintptr(0), uintptr(0)) if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -187429,7 +189624,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ @@ -187443,19 +189638,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { _ = libc.Int32FromInt32(0) if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14869, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14894, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { - v1 = __ccgo_ts + 14854 + v1 = __ccgo_ts + 14879 } else { - v1 = __ccgo_ts + 32906 + v1 = __ccgo_ts + 32932 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32906, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32932, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -187566,6 +189761,7 @@ func _rbuUnlockShm(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; i++ } (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = uint32(0) @@ -187615,6 +189811,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext } (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain @@ -187627,6 +189824,7 @@ func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext } if pIter == uintptr(0) { @@ -187653,6 +189851,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187666,6 +189865,7 @@ func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { } goto _2 _2: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 } if *(*uintptr)(unsafe.Pointer(pp)) != 0 { @@ -187698,6 +189898,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _1 _1: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext } } else { @@ -187708,6 +189909,7 @@ func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r } goto _2 _2: + ; pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext } } @@ -187734,6 +189936,7 @@ func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) @@ -188021,7 +190224,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) - (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32981, 0) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+33007, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p @@ -188047,7 +190250,7 @@ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = *(*uintptr)(unsafe.Pointer(pArg)) - zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33004, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + zOut = Xsqlite3_mprintf(tls, __ccgo_ts+33030, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -188248,7 +190451,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag if pDb != 0 { if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6560) + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6585) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -188262,7 +190465,7 @@ func _rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flag } else { (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu } - if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33015, 0) != 0 { + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33041, 0) != 0 { _ = libc.Int32FromInt32(0) oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -188817,7 +191020,7 @@ func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) iDb = _sqlite3FindDb(tls, db, bp) if iDb < 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12166, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12191, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) return int32(SQLITE_ERROR) } } else { @@ -188888,16 +191091,17 @@ func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { return int32(SQLITE_CONSTRAINT) } switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { - case 0: + case 0: /* name */ iName = i - case int32(10): + case int32(10): /* schema */ iSchema = i - case int32(11): + case int32(11): /* aggregate */ iAgg = i break } goto _1 _1: + ; i++ } i = 0 @@ -188965,6 +191169,7 @@ func _statClearCells(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) @@ -189000,6 +191205,7 @@ func _statResetCsr(tls *libc.TLS, pCsr uintptr) { (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) goto _1 _1: + ; i++ } Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) @@ -189196,17 +191402,20 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _5 _5: + ; j++ } } } goto _3 _3: + ; i++ } } return SQLITE_OK statPageIsCorrupt: + ; (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) _statClearCells(tls, p) return SQLITE_OK @@ -189296,6 +191505,7 @@ func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) statNextRestart: + ; if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { /* Start measuring space on the next btree */ _statResetCounts(tls, pCsr) @@ -189311,7 +191521,7 @@ statNextRestart: (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiPgno = iRoot (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33026, 0) + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33052, 0) z = v1 (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FzPath = v1 if z == uintptr(0) { @@ -189349,8 +191559,8 @@ statNextRestart: if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33028 - v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33037, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33054 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33063, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) z = v2 (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 if z == uintptr(0) { @@ -189379,7 +191589,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { _statResetCsr(tls, pCsr) - return _sqlite3CorruptError(tls, int32(222302)) + return _sqlite3CorruptError(tls, int32(222551)) } _ = libc.Int32FromInt32(0) if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { @@ -189391,7 +191601,7 @@ statNextRestart: (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { - v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33049, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33075, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) z = v4 (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 if z == uintptr(0) { @@ -189411,16 +191621,16 @@ statNextRestart: if rc == SQLITE_OK { _statSizeAndOffset(tls, pCsr) switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { - case int32(0x05): + case int32(0x05): /* table internal */ fallthrough - case int32(0x02): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33057 - case int32(0x0D): + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33083 + case int32(0x0D): /* table leaf */ fallthrough - case int32(0x0A): - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33066 + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33092 default: - (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33071 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33097 break } *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell @@ -189445,6 +191655,7 @@ statNextRestart: nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal goto _6 _6: + ; i++ } *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) @@ -189517,12 +191728,12 @@ func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, a (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) } pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33081, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33107, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) if zName != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33236, libc.VaList(bp+8, zName)) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33262, libc.VaList(bp+8, zName)) } if idxNum&int32(0x08) != 0 { - Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33250, 0) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33276, 0) } zSql = Xsqlite3_str_finish(tls, pSql) if zSql == uintptr(0) { @@ -189544,37 +191755,37 @@ func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) _, _, _ = db, iDb, pCsr pCsr = pCursor switch i { - case 0: + case 0: /* name */ Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) - case int32(1): + case int32(1): /* path */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) } - case int32(2): + case int32(2): /* pageno */ if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) } else { Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) } - case int32(3): + case int32(3): /* pagetype */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) } - case int32(4): + case int32(4): /* ncell */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) - case int32(5): + case int32(5): /* payload */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) - case int32(6): + case int32(6): /* unused */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) - case int32(7): + case int32(7): /* mx_payload */ Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) - case int32(8): + case int32(8): /* pgoffset */ if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) } - case int32(9): + case int32(9): /* pgsize */ Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) - case int32(10): + case int32(10): /* schema */ db = Xsqlite3_context_db_handle(tls, ctx) iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) @@ -189599,7 +191810,7 @@ func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { - return Xsqlite3_create_module(tls, db, __ccgo_ts+33265, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) + return Xsqlite3_create_module(tls, db, __ccgo_ts+33291, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } var _dbstat_module = Tsqlite3_module{} @@ -190270,6 +192481,7 @@ func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint h = h< 0) goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) @@ -193478,6 +195732,7 @@ func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { } goto _1 _1: + ; i++ } *(*uintptr)(unsafe.Pointer(ppRec)) = aRec @@ -193560,7 +195815,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, int32(9)) if rc == SQLITE_OK { if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { - rc = _sqlite3CorruptError(tls, int32(226451)) + rc = _sqlite3CorruptError(tls, int32(226700)) } else { v3 = pIn + 8 v2 = *(*int32)(unsafe.Pointer(v3)) @@ -193585,7 +195840,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) if rc == SQLITE_OK { if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { - rc = _sqlite3CorruptError(tls, int32(226471)) + rc = _sqlite3CorruptError(tls, int32(226720)) } else { if eType == int32(SQLITE_TEXT) { v4 = int32(SQLITE_UTF8) @@ -193600,7 +195855,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { - rc = _sqlite3CorruptError(tls, int32(226481)) + rc = _sqlite3CorruptError(tls, int32(226730)) } else { *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) if eType == int32(SQLITE_INTEGER) { @@ -193615,6 +195870,7 @@ func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, ap } goto _1 _1: + ; i++ } return rc @@ -193655,7 +195911,7 @@ func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) ( ** large value for nCol may cause nRead to wrap around and become ** negative. Leading to a crash. */ if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { - rc = _sqlite3CorruptError(tls, int32(226529)) + rc = _sqlite3CorruptError(tls, int32(226778)) } else { rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) nRead += *(*int32)(unsafe.Pointer(bp)) @@ -193715,6 +195971,7 @@ func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByt } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnByte)) = nByte @@ -193760,7 +196017,7 @@ func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 _sessionBufferGrow(tls, p+72, int64(nByte), bp) } else { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226617)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -193820,6 +196077,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2)) @@ -193868,7 +196126,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin /* The first record in the changeset is not a table header. Must be a ** corrupt changeset. */ _ = libc.Int32FromInt32(0) - v7 = _sqlite3CorruptError(tls, int32(226703)) + v7 = _sqlite3CorruptError(tls, int32(226952)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 return v7 } @@ -193878,7 +196136,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin *(*int32)(unsafe.Pointer(v9))++ (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { - v10 = _sqlite3CorruptError(tls, int32(226709)) + v10 = _sqlite3CorruptError(tls, int32(226958)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 return v10 } @@ -193898,6 +196156,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _11 _11: + ; i++ } } else { @@ -193958,7 +196217,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin _ = libc.Int32FromInt32(0) *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { - v16 = _sqlite3CorruptError(tls, int32(226753)) + v16 = _sqlite3CorruptError(tls, int32(227002)) (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 return v16 } @@ -193966,6 +196225,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _15 _15: + ; i++ } } else { @@ -193998,6 +196258,7 @@ func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uin } goto _17 _17: + ; i++ } } @@ -194206,6 +196467,7 @@ func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -194327,6 +196589,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal, bp) goto _4 _4: + ; iCol++ } /* Write the new new.* record. Consists of a copy of all values @@ -194346,6 +196609,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sessionAppendValue(tls, bp+8, pVal1, bp) goto _6 _6: + ; iCol++ } iCol = 0 @@ -194356,6 +196620,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) goto _8 _8: + ; iCol++ } libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) @@ -194363,7 +196628,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu goto finished_invert } default: - *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227118)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) goto finished_invert } _ = libc.Int32FromInt32(0) @@ -194386,6 +196651,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } } finished_invert: + ; Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) Xsqlite3_free(tls, apVal) Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) @@ -194532,6 +196798,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } goto _1 _1: + ; ii++ } } @@ -194565,7 +196832,7 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 } if pUp == uintptr(0) { nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) - bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11557) == 0) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11582) == 0) pUp = Xsqlite3_malloc(tls, nByte) if pUp == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) @@ -194574,9 +196841,9 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 libc.Xmemset(tls, bp+8, 0, uint64(16)) (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4)) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33909, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33935, bp) _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33922, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33948, bp) /* Create the assignments part of the UPDATE */ ii = 0 for { @@ -194586,17 +196853,18 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) - zSep = __ccgo_ts + 14965 + zSep = __ccgo_ts + 14990 } goto _2 _2: + ; ii++ } /* Create the WHERE clause part of the UPDATE */ zSep = __ccgo_ts + 1648 - _sessionAppendStr(tls, bp+8, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33959, bp) ii = 0 for { if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { @@ -194606,16 +196874,17 @@ func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32 _sessionAppendStr(tls, bp+8, zSep, bp) if bStat1 != 0 && ii == int32(1) { _ = libc.Int32FromInt32(0) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33941, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33967, bp) } else { _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) } - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _3 _3: + ; ii++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -194660,6 +196929,7 @@ func _sessionUpdateFree(tls *libc.TLS, p uintptr) { Xsqlite3_free(tls, pUp) goto _1 _1: + ; pUp = pNext } (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) @@ -194698,9 +196968,9 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} nPk = 0 - _sessionAppendStr(tls, bp+8, __ccgo_ts+34022, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34048, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33933, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33959, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { @@ -194710,18 +196980,19 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in nPk++ _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33928, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33954, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 21979 + zSep = __ccgo_ts + 22013 } goto _1 _1: + ; i++ } if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { - _sessionAppendStr(tls, bp+8, __ccgo_ts+34040, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34066, bp) _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+33504, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33530, bp) zSep = __ccgo_ts + 1648 i = 0 for { @@ -194731,15 +197002,16 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { _sessionAppendStr(tls, bp+8, zSep, bp) _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+34016, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34042, bp) _sessionAppendInteger(tls, bp+8, i+int32(1), bp) - zSep = __ccgo_ts + 34048 + zSep = __ccgo_ts + 34074 } goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5106, bp) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) @@ -194765,7 +197037,7 @@ func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in // */ func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { /* TODO */ - return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6560, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6585, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) } // C documentation @@ -194788,34 +197060,36 @@ func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r in _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} - _sessionAppendStr(tls, bp+8, __ccgo_ts+34053, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34079, bp) _sessionAppendIdent(tls, bp+8, zTab, bp) - _sessionAppendStr(tls, bp+8, __ccgo_ts+21985, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22019, bp) i = 0 for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } if i != 0 { - _sessionAppendStr(tls, bp+8, __ccgo_ts+14965, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+14990, bp) } _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) goto _1 _1: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34071, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34097, bp) i = int32(1) for { if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { break } - _sessionAppendStr(tls, bp+8, __ccgo_ts+34082, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34108, bp) goto _2 _2: + ; i++ } - _sessionAppendStr(tls, bp+8, __ccgo_ts+5081, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+5106, bp) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) } @@ -194838,12 +197112,12 @@ func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { var rc int32 _ = rc - rc = _sessionSelectRow(tls, db, __ccgo_ts+11557, p) + rc = _sessionSelectRow(tls, db, __ccgo_ts+11582, p) if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34086) + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34112) } if rc == SQLITE_OK { - rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34199) + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34225) } return rc } @@ -194910,13 +197184,14 @@ func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, a if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { /* The value in the changeset was "undefined". This indicates a ** corrupt changeset blob. */ - rc = _sqlite3CorruptError(tls, int32(227600)) + rc = _sqlite3CorruptError(tls, int32(227849)) } else { rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) } } goto _1 _1: + ; i++ } return rc @@ -194976,6 +197251,7 @@ func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { } goto _2 _2: + ; ii++ } } @@ -195043,6 +197319,7 @@ func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) goto _2 _2: + ; i++ } } @@ -195250,6 +197527,7 @@ func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintp } goto _2 _2: + ; i++ } if rc != SQLITE_OK { @@ -195334,7 +197612,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply } else { if *(*int32)(unsafe.Pointer(bp)) != 0 { _ = libc.Int32FromInt32(0) - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34343, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34369, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) @@ -195347,7 +197625,7 @@ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34364, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34390, uintptr(0), uintptr(0), uintptr(0)) } } } @@ -195443,10 +197721,10 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34383, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34409, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34435, uintptr(0), uintptr(0), uintptr(0)) } for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) @@ -195487,7 +197765,7 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } else { nMinCol = 0 Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) - rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6560, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6585, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) if rc != SQLITE_OK { break } @@ -195501,22 +197779,23 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } goto _1 _1: + ; i++ } if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34439, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34465, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34483, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34509, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) } else { if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { schemaMismatch = int32(1) - Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34554, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34580, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) } else { (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11557) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11582) { v2 = _sessionStat1Sql(tls, db, bp+8) rc = v2 if v2 != 0 { @@ -195573,13 +197852,13 @@ func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter ui } } } - Xsqlite3_exec(tls, db, __ccgo_ts+34614, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34640, uintptr(0), uintptr(0), uintptr(0)) if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } else { - Xsqlite3_exec(tls, db, __ccgo_ts+34668, uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3_exec(tls, db, __ccgo_ts+34644, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34694, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34670, uintptr(0), uintptr(0), uintptr(0)) } } _ = libc.Int32FromInt32(0) @@ -195738,6 +198017,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pIn += uintptr(nIn) goto _1 _1: + ; i++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195784,6 +198064,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i a2 += uintptr(n2) goto _5 _5: + ; i1++ } (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) @@ -195915,6 +198196,7 @@ func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK } goto _1 _1: + ; ii++ } return int32(1) @@ -195980,6 +198262,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC } goto _1 _1: + ; ii++ } } else { @@ -195996,6 +198279,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) goto _2 _2: + ; ii++ } _sessionAppendBlob(tls, pOut, aRec, iOff, bp) @@ -196007,6 +198291,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _3 _3: + ; ii++ } } @@ -196019,6 +198304,7 @@ func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nC _sessionAppendByte(tls, pOut, uint8(0x00), bp) goto _4 _4: + ; ii++ } } else { @@ -196081,6 +198367,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if !(pTab != 0) { @@ -196115,6 +198402,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _2 _2: + ; ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) } *(*uintptr)(unsafe.Pointer(ppTab)) = pTab @@ -196160,6 +198448,7 @@ func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase } goto _3 _3: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 } rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) @@ -196241,14 +198530,17 @@ func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOu } goto _3 _3: + ; p = (*TSessionChange)(unsafe.Pointer(p)).FpNext } goto _2 _2: + ; i++ } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -196479,6 +198771,7 @@ func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintp a2 += uintptr(nn2) goto _1 _1: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -196551,6 +198844,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n2) goto _3 _3: + ; i++ } if bData != 0 { @@ -196574,6 +198868,7 @@ func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRe a2 += uintptr(n21) goto _5 _5: + ; i++ } (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) @@ -196631,6 +198926,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _1 _1: + ; pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext } *(*int32)(unsafe.Pointer(bp + 20)) = 0 @@ -196661,6 +198957,7 @@ func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pO } goto _3 _3: + ; pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext } } @@ -198008,23 +200305,23 @@ func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case int32(16): + case int32(16): /* input */ _ = pParse - case int32(17): + case int32(17): /* expr */ fallthrough - case int32(18): + case int32(18): /* cnearset */ fallthrough - case int32(19): + case int32(19): /* exprlist */ _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(20): + case int32(20): /* colset */ fallthrough - case int32(21): + case int32(21): /* colsetlist */ Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(22): + case int32(22): /* nearset */ fallthrough - case int32(23): + case int32(23): /* nearphrases */ _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) - case int32(24): + case int32(24): /* phrase */ _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) break /********* End destructor definitions *****************************************/ @@ -198170,7 +200467,7 @@ func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34696, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34722, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } @@ -198353,116 +200650,146 @@ func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, f goto _29 } goto _30 -_1: /* input ::= expr */ +_1: + ; /* input ::= expr */ _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_2: /* colset ::= MINUS LCP colsetlist RCP */ +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_3: /* colset ::= LCP colsetlist RCP */ +_3: + ; /* colset ::= LCP colsetlist RCP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_4: /* colset ::= STRING */ +_4: + ; /* colset ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_5: /* colset ::= MINUS STRING */ +_5: + ; /* colset ::= MINUS STRING */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) goto _30 -_6: /* colsetlist ::= colsetlist STRING */ +_6: + ; /* colsetlist ::= colsetlist STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_7: /* colsetlist ::= STRING */ +_7: + ; /* colsetlist ::= STRING */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_8: /* expr ::= expr AND expr */ +_8: + ; /* expr ::= expr AND expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_9: /* expr ::= expr OR expr */ +_9: + ; /* expr ::= expr OR expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_10: /* expr ::= expr NOT expr */ +_10: + ; /* expr ::= expr NOT expr */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_11: /* expr ::= colset COLON LP expr RP */ +_11: + ; /* expr ::= colset COLON LP expr RP */ _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_12: /* expr ::= LP expr RP */ +_12: + ; /* expr ::= LP expr RP */ *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) goto _30 -_14: /* expr ::= exprlist */ +_14: + ; /* expr ::= exprlist */ _13: + ; *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_15: /* exprlist ::= exprlist cnearset */ +_15: + ; /* exprlist ::= exprlist cnearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_16: /* cnearset ::= nearset */ +_16: + ; /* cnearset ::= nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_17: /* cnearset ::= colset COLON nearset */ +_17: + ; /* cnearset ::= colset COLON nearset */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_18: /* nearset ::= phrase */ +_18: + ; /* nearset ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_19: /* nearset ::= CARET phrase */ +_19: + ; /* nearset ::= CARET phrase */ _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) goto _30 -_20: /* nearset ::= STRING LP nearphrases neardist_opt RP */ +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_21: /* nearphrases ::= phrase */ +_21: + ; /* nearphrases ::= phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_22: /* nearphrases ::= nearphrases phrase */ +_22: + ; /* nearphrases ::= nearphrases phrase */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_23: /* neardist_opt ::= */ +_23: + ; /* neardist_opt ::= */ *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 goto _30 -_24: /* neardist_opt ::= COMMA STRING */ +_24: + ; /* neardist_opt ::= COMMA STRING */ *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) goto _30 -_25: /* phrase ::= phrase PLUS STRING star_opt */ +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_26: /* phrase ::= STRING star_opt */ +_26: + ; /* phrase ::= STRING star_opt */ *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) goto _30 -_27: /* star_opt ::= STAR */ +_27: + ; /* star_opt ::= STAR */ *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) goto _30 -_28: /* star_opt ::= */ +_28: + ; /* star_opt ::= */ *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 goto _30 _29: + ; goto _30 /********** End reduce actions ************************************************/ _30: + ; _ = libc.Int32FromInt32(0) fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) @@ -198496,7 +200823,7 @@ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int3 pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } @@ -198804,7 +201131,7 @@ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n in if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34755, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34781, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) } @@ -198902,7 +201229,7 @@ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uint var _ /* rc at bp+104 */ int32 _, _ = iCol, zErr if nVal != int32(3) { - zErr = __ccgo_ts + 34762 + zErr = __ccgo_ts + 34788 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199030,6 +201357,7 @@ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken } goto _1 _1: + ; i-- } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { @@ -199082,6 +201410,7 @@ func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32 } goto _1 _1: + ; i++ } *(*int32)(unsafe.Pointer(pnScore)) = nScore @@ -199146,7 +201475,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt nBestScore = 0 /* Score of best snippet */ *(*int32)(unsafe.Pointer(bp + 112)) = 0 if nVal != int32(5) { - zErr = __ccgo_ts + 34812 + zErr = __ccgo_ts + 34838 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } @@ -199227,6 +201556,7 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _4 _4: + ; jj++ } if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { @@ -199248,11 +201578,13 @@ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintpt } goto _3 _3: + ; ii++ } } goto _2 _2: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { @@ -199415,6 +201747,7 @@ func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) } goto _1 _1: + ; i++ } if rc != SQLITE_OK { @@ -199479,6 +201812,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, } goto _1 _1: + ; i++ } /* Figure out the total size of the current row in tokens. */ @@ -199497,6 +201831,7 @@ func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) goto _3 _3: + ; i++ } Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) @@ -199521,15 +201856,15 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { FxDestroy uintptr }{ 0: { - FzFunc: __ccgo_ts + 34860, + FzFunc: __ccgo_ts + 34886, FxFunc: __ccgo_fp(_fts5SnippetFunction), }, 1: { - FzFunc: __ccgo_ts + 34868, + FzFunc: __ccgo_ts + 34894, FxFunc: __ccgo_fp(_fts5HighlightFunction), }, 2: { - FzFunc: __ccgo_ts + 34878, + FzFunc: __ccgo_ts + 34904, FxFunc: __ccgo_fp(_fts5Bm25Function), }, } @@ -199542,6 +201877,7 @@ func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) goto _1 _1: + ; i++ } return rc @@ -200056,6 +202392,7 @@ func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, hash = hash< int32('9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34890, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34916, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34921, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34947, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200435,7 +202775,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC p++ } if nPre <= 0 || nPre >= int32(1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34954, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34980, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) break } @@ -200446,7 +202786,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC _ = libc.Int32FromInt32(0) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+34991, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35017, zCmd, nCmd) == 0 { p1 = zArg nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) @@ -200454,7 +202794,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC pSpace = pDel if azArg != 0 && pSpace != 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35000, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35026, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { nArg = 0 @@ -200477,10 +202817,11 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC } goto _1 _1: + ; nArg++ } if p1 == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35033, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35059, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) @@ -200491,58 +202832,58 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC Xsqlite3_free(tls, pDel) return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35067, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35093, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35075, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35101, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if *(*uint8)(unsafe.Pointer(zArg)) != 0 { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) - (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35107, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35133, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) } } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35113, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35139, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35132, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35158, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35175, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35201, zCmd, nCmd) == 0 { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35189, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35215, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35227, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35253, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35238, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35264, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+5474, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+5499, zCmd, nCmd) == 0 { *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ 0: { - FzName: __ccgo_ts + 8193, + FzName: __ccgo_ts + 8218, FeVal: int32(FTS5_DETAIL_NONE), }, 1: { - FzName: __ccgo_ts + 17713, + FzName: __ccgo_ts + 17747, }, 2: { - FzName: __ccgo_ts + 35273, + FzName: __ccgo_ts + 35299, FeVal: int32(FTS5_DETAIL_COLUMNS), }, 3: {}, @@ -200550,20 +202891,20 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zC v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) *(*int32)(unsafe.Pointer(bp)) = v2 if v2 != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35281, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35307, 0) } return *(*int32)(unsafe.Pointer(bp)) } - if Xsqlite3_strnicmp(tls, __ccgo_ts+35312, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, __ccgo_ts+35338, zCmd, nCmd) == 0 { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*uint8)(unsafe.Pointer(zArg + 1))) != int32('\000') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35322, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35348, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('1')) } return *(*int32)(unsafe.Pointer(bp)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35356, libc.VaList(bp+80, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35382, libc.VaList(bp+80, nCmd, zCmd)) return int32(SQLITE_ERROR) } @@ -200637,15 +202978,15 @@ func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35384) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16660) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35389, libc.VaList(bp+8, zCol)) + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35410) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16694) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35415, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35419) { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35445) { *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35429, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35455, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } @@ -200671,7 +203012,7 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { _ = i *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35460, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35486, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { @@ -200679,12 +203020,13 @@ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35465, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35491, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35472, libc.VaList(bp+32, i)) + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35498, libc.VaList(bp+32, i)) } goto _1 _1: + ; i++ } } @@ -200741,8 +203083,8 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35384) == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35480, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35410) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35506, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } _ = libc.Int32FromInt32(0) @@ -200775,7 +203117,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35509, libc.VaList(bp+40, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35535, libc.VaList(bp+40, zOrig)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bOption != 0 { @@ -200800,11 +203142,12 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) goto _3 _3: + ; i++ } /* We only allow contentless_delete=1 if the table is indeed contentless. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35529, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35555, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* We only allow contentless_delete=1 if columnsize=0 is not present. @@ -200812,7 +203155,7 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in ** This restriction may be removed at some point. */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35579, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35605, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -200826,18 +203169,18 @@ func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg in zTail = uintptr(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = __ccgo_ts + 35067 + zTail = __ccgo_ts + 35093 } else { if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = __ccgo_ts + 35634 + zTail = __ccgo_ts + 35660 } } if zTail != 0 { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35642, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35668, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { - (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16660, -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16694, -int32(1)) } /* Formulate the zContentExprlist text */ if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -200872,6 +203215,7 @@ func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) @@ -200900,7 +203244,7 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { var _ /* rc at bp+0 */ int32 _, _, _, _ = i, zSep, zSql, v2 *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35653, 0) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35679, 0) i = 0 for { if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { @@ -200909,15 +203253,16 @@ func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { if i == 0 { v2 = __ccgo_ts + 1648 } else { - v2 = __ccgo_ts + 14965 + v2 = __ccgo_ts + 14990 } zSep = v2 - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35669, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35695, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) goto _1 _1: + ; i++ } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35676, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35384)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35702, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35410)) _ = libc.Int32FromInt32(0) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -201065,7 +203410,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV var _ /* zRankArgs at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 rc = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35702) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35728) { pgsz = 0 if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -201076,7 +203421,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35707) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35733) { nHashSize = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -201087,7 +203432,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35716) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35742) { nAutomerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -201101,7 +203446,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35726) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35752) { nUsermerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -201112,7 +203457,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35736) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35762) { nCrisisMerge = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -201129,7 +203474,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35748) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35774) { nVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { nVal = Xsqlite3_value_int(tls, pVal) @@ -201144,7 +203489,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35384) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35410) { zIn = Xsqlite3_value_text(tls, pVal) rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) if rc == SQLITE_OK { @@ -201159,7 +203504,7 @@ func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pV } } } else { - if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35760) { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35786) { bVal = -int32(1) if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { bVal = Xsqlite3_value_int(tls, pVal) @@ -201201,7 +203546,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in var _ /* p at bp+0 */ uintptr var _ /* rc at bp+8 */ int32 _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql - zSelect = __ccgo_ts + 35774 + zSelect = __ccgo_ts + 35800 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK iVersion = 0 @@ -201222,7 +203567,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) - if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35806) { + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35832) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 12)) = 0 @@ -201235,7 +203580,7 @@ func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r in *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { _ = libc.Int32FromInt32(0) - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35814, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35840, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion @@ -201457,17 +203802,18 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } } if int32(*(*uint8)(unsafe.Pointer(z2))) == int32('\000') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35885, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35911, 0) return FTS5_EOF } goto _1 _1: + ; z2++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) default: if _sqlite3Fts5IsBareword(tls, *(*uint8)(unsafe.Pointer(z))) == 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35905, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35931, libc.VaList(bp+8, z)) return FTS5_EOF } tok = int32(FTS5_STRING) @@ -201478,16 +203824,17 @@ func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr } goto _2 _2: + ; z21++ } (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35936, uint64(2)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35962, uint64(2)) == 0 { tok = int32(FTS5_OR) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35939, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35965, uint64(3)) == 0 { tok = int32(FTS5_NOT) } - if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30680, uint64(3)) == 0 { + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30706, uint64(3)) == 0 { tok = int32(FTS5_AND) } break @@ -201592,6 +203939,7 @@ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { } goto _1 _1: + ; ii++ } return nRet @@ -201652,6 +204000,7 @@ func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol i } goto _2 _2: + ; jj++ } v5 = iOut @@ -201709,6 +204058,7 @@ func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) @@ -201756,6 +204106,7 @@ func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) goto _1 _1: + ; i++ } (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase @@ -201802,6 +204153,7 @@ func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uint } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if pbEof != 0 && bRetValid == 0 { @@ -201860,6 +204212,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if nIter == int32(1) { @@ -201888,6 +204241,7 @@ func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintpt } goto _2 _2: + ; i++ } if iMin == libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0) i = 0 for { @@ -202041,6 +204400,7 @@ ismatch_out: } goto _4 _4: + ; i++ } if aIter != bp+8 { @@ -202165,6 +204525,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist goto _1 _1: + ; i++ } for int32(1) != 0 { @@ -202193,6 +204554,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _2 _2: + ; i++ } } @@ -202209,6 +204571,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _3 _3: + ; i++ } iAdv = 0 @@ -202224,6 +204587,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } goto _4 _4: + ; i++ } if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { @@ -202231,6 +204595,7 @@ func _fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) (r int32) { } } ismatch_out: + ; bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) if a != bp { @@ -202295,6 +204660,7 @@ func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if rc != SQLITE_OK { @@ -202332,6 +204698,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _1 _1: + ; pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym } return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn @@ -202357,6 +204724,7 @@ func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) } goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) @@ -202431,6 +204799,7 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _3 _3: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if bHit == 0 { @@ -202439,11 +204808,13 @@ func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) } goto _2 _2: + ; j++ } } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 @@ -202491,6 +204862,7 @@ func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -202510,6 +204882,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 goto _1 _1: + ; i++ } } else { @@ -202521,6 +204894,7 @@ func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) goto _2 _2: + ; i1++ } } @@ -202624,10 +204998,12 @@ func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r in } goto _2 _2: + ; j++ } goto _1 _1: + ; i++ } } @@ -202685,6 +205061,7 @@ func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFrom } goto _1 _1: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } /* Set the EOF flag if either all synonym iterators are at EOF or an @@ -202771,6 +205148,7 @@ func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { } goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid @@ -202802,6 +205180,7 @@ func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromVali } goto _1 _1: + ; i++ } _fts5ExprNodeTest_OR(tls, pExpr, pNode) @@ -202859,6 +205238,7 @@ func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) } goto _1 _1: + ; iChild++ } } @@ -202988,6 +205368,7 @@ func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof goto _1 _1: + ; i++ } (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid @@ -203121,10 +205502,12 @@ func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { Xsqlite3_free(tls, pSyn) goto _2 _2: + ; pSyn = pNext } goto _1 _1: + ; i++ } if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { @@ -203347,6 +205730,7 @@ func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) @@ -203502,6 +205886,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp tflags = int32(FTS5_TOKEN_COLOCATED) goto _2 _2: + ; p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -203510,6 +205895,7 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp } goto _1 _1: + ; i++ } } else { @@ -203553,8 +205939,8 @@ func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, pp func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { bp := tls.Alloc(32) defer tls.Free(32) - if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35943, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34724, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+35969, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34750, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -203574,12 +205960,13 @@ func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, } c = *(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if int32(c) < int32('0') || int32(c) > int32('9') { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35948, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35974, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = nNear*int32(10) + (int32(*(*uint8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) goto _1 _1: + ; i++ } } else { @@ -203630,6 +206017,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u } goto _2 _2: + ; i++ } j = nCol @@ -203640,6 +206028,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) goto _3 _3: + ; j-- } *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol @@ -203678,6 +206067,7 @@ func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r } goto _1 _1: + ; i++ } } @@ -203706,10 +206096,11 @@ func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p u } goto _1 _1: + ; iCol++ } if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+20982, libc.VaList(bp+8, z)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21016, libc.VaList(bp+8, z)) } else { pRet = _fts5ParseColset(tls, pParse, pColset, iCol) } @@ -203818,6 +206209,7 @@ func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset u _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) goto _1 _1: + ; i++ } } @@ -203835,7 +206227,7 @@ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pC var _ /* pFree at bp+0 */ uintptr *(*uintptr)(unsafe.Pointer(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35977, 0) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36003, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } @@ -203893,6 +206285,7 @@ func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 goto _3 _3: + ; ii++ } } @@ -203950,6 +206343,7 @@ func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uint } goto _1 _1: + ; ii++ } if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { @@ -204023,17 +206417,18 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin } goto _1 _1: + ; iPhrase++ } if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { - v2 = __ccgo_ts + 36030 + v2 = __ccgo_ts + 36056 } else { - v2 = __ccgo_ts + 35943 + v2 = __ccgo_ts + 35969 } - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36037, libc.VaList(bp+8, v2)) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36063, libc.VaList(bp+8, v2)) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204042,7 +206437,7 @@ func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uin _fts5ExprAddChildren(tls, pRet, pLeft) _fts5ExprAddChildren(tls, pRet, pRight) if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { - _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36087, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36113, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) Xsqlite3_free(tls, pRet) pRet = uintptr(0) } @@ -204210,6 +206605,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r } goto _1 _1: + ; i++ } } @@ -204250,6 +206646,7 @@ func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { } goto _1 _1: + ; i++ } return 0 @@ -204272,6 +206669,7 @@ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { } goto _1 _1: + ; ii++ } return ii @@ -204324,10 +206722,12 @@ func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pTok } goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; i++ } return SQLITE_OK @@ -204357,6 +206757,7 @@ func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uint } goto _1 _1: + ; i++ } return _sqlite3Fts5Tokenize(tls, pConfig, int32(FTS5_TOKENIZE_DOCUMENT), z, n, bp, __ccgo_fp(_fts5ExprPopulatePoslistsCb)) @@ -204376,6 +206777,7 @@ func _fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { _fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) goto _1 _1: + ; i++ } } @@ -204403,6 +206805,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _1 _1: + ; i++ } case int32(FTS5_OR): @@ -204417,6 +206820,7 @@ func _fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid Ti64) (r int32) } goto _2 _2: + ; i1++ } return bRet @@ -204540,10 +206944,12 @@ func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) goto _2 _2: + ; pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym } goto _1 _1: + ; ii++ } } @@ -204716,10 +207122,12 @@ func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { Xsqlite3_free(tls, pSlot) goto _2 _2: + ; pSlot = pNext } goto _1 _1: + ; i++ } libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8)) @@ -204739,6 +207147,7 @@ func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { h = h< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { @@ -206593,6 +209016,7 @@ func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie ui } goto _1 _1: + ; iLvl++ } if *(*int32)(unsafe.Pointer(bp + 8)) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -206702,7 +209126,7 @@ func _fts5IndexDataVersion(tls *libc.TLS, p uintptr) (r Ti64) { iVersion = 0 if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { - (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36291, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5IndexPrepareStmt(tls, p, p+144, Xsqlite3_mprintf(tls, __ccgo_ts+36317, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { return 0 } @@ -206790,7 +209214,7 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { _ = libc.Int32FromInt32(0) - libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36286, uint64(4)) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36312, uint64(4)) *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) } *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) @@ -206827,10 +209251,12 @@ func _fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { } goto _3 _3: + ; iSeg++ } goto _2 _2: + ; iLvl++ } _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) @@ -206882,10 +209308,12 @@ func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- goto _2 _2: + ; is-- } goto _1 _1: + ; il++ } } @@ -206931,6 +209359,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _1 _1: + ; iTst-- } if iTst >= 0 { @@ -206948,6 +209377,7 @@ func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr } goto _2 _2: + ; i++ } if szMax >= szSeg { @@ -206998,6 +209428,7 @@ func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { } goto _1 _1: + ; iOff++ } if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { @@ -207067,6 +209498,7 @@ func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) goto _1 _1: + ; i++ } return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof @@ -207098,6 +209530,7 @@ func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _1 _1: + ; i-- } } @@ -207187,6 +209620,7 @@ func _fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { _fts5DataRelease(tls, (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8 + uintptr(i)*32))).FpData) goto _1 _1: + ; i++ } Xsqlite3_free(tls, pIter) @@ -207223,6 +209657,7 @@ func _fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLea } goto _1 _1: + ; i++ } if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -207758,6 +210193,7 @@ func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm ui _fts5SegIterLoadNPos(tls, p, pIter) return next_none_eof: + ; _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) } @@ -207963,6 +210399,7 @@ func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { } goto _2 _2: + ; pgno++ } } @@ -208095,6 +210532,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } goto _3 _3: + ; i++ } nMatch += i @@ -208131,6 +210569,7 @@ func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uin } } search_failed: + ; if bGe == 0 { _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) @@ -208161,6 +210600,7 @@ search_failed: } } search_success: + ; if int64(*(*Tu32)(unsafe.Pointer(bp)))+int64(*(*Tu32)(unsafe.Pointer(bp + 8))) > int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { @@ -211962,6 +214436,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn goto _1 _1: + ; i++ } if nOut == 0 { @@ -212069,6 +214544,7 @@ func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBu } goto _2 _2: + ; i++ } } else { @@ -212143,6 +214619,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _1 _1: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212187,6 +214664,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo } goto _4 _4: + ; iStore++ } if iStore == i1+nMerge { @@ -212199,11 +214677,13 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) goto _5 _5: + ; iStore++ } } goto _3 _3: + ; i++ } iLastRowid = 0 @@ -212212,6 +214692,7 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid goto _2 _2: + ; _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) } _ = libc.Int32FromInt32(0) @@ -212231,10 +214712,12 @@ func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pTo _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) goto _7 _7: + ; iFree++ } goto _6 _6: + ; i += nMerge } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -212351,11 +214834,11 @@ func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uin if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) - (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36598, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36624, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25715, __ccgo_ts+36606, 0, pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25741, __ccgo_ts+36632, 0, pzErr) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11768, __ccgo_ts+36641, int32(1), pzErr) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11793, __ccgo_ts+36667, int32(1), pzErr) } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) @@ -212434,6 +214917,7 @@ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nC } goto _1 _1: + ; i++ } return n @@ -212497,6 +214981,7 @@ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pT } goto _1 _1: + ; i++ } return rc @@ -212619,6 +215104,7 @@ func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) goto _1 _1: + ; ii++ } Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) @@ -212703,6 +215189,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _1 _1: + ; ii++ } if nHit == 0 { @@ -212742,6 +215229,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _2 _2: + ; ii++ } /* Ensure the output buffer is large enough */ @@ -212783,6 +215271,7 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { } goto _5 _5: + ; ii++ } /* If all readers were at EOF, break out of the loop. */ @@ -212816,9 +215305,10 @@ func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { // */ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { var ii int32 - var p, pT uintptr - _, _, _ = ii, p, pT + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex ii = 0 for { if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { @@ -212826,16 +215316,19 @@ func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti6 } p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, bFrom, iFrom) - for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(p)).FpIndex)).Frc == SQLITE_OK { - _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(p)).FpIndex, p, 0, 0) + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) } } goto _1 _1: + ; ii++ } - _fts5IterSetOutputsTokendata(tls, pIter) + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } } // C documentation @@ -212884,7 +215377,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) if pSmall != 0 { _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) - _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36685) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36711) } else { _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) } @@ -212943,10 +215436,12 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _4 _4: + ; iSeg-- } goto _3 _3: + ; iLvl++ } _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) @@ -212972,6 +215467,7 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in } goto _5 _5: + ; ii++ } /* If pSmall is still NULL at this point, then the new iterator does @@ -212999,11 +215495,13 @@ func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken in (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) goto _7 _7: + ; iSeg1++ } _fts5MultiIterFinishSetup(tls, p, pIter) goto _6 _6: + ; ii1++ } } @@ -213080,6 +215578,7 @@ func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int } goto _1 _1: + ; iIdx++ } } @@ -213304,6 +215803,7 @@ func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pTok } goto _1 _1: + ; ii++ } if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { @@ -213356,6 +215856,7 @@ func _sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSiz i += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(i), anSize+uintptr(iCol)*8)) goto _1 _1: + ; iCol++ } } @@ -213406,7 +215907,7 @@ func _sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) _ = libc.Int32FromInt32(0) _sqlite3Fts5Put32(tls, bp, iNew) - rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36140, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36166, int64(FTS5_STRUCTURE_ROWID), int32(1), bp+8) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp, int32(4), 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) @@ -213546,6 +216047,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) goto _1 _1: + ; ii++ } /* Loop through the current pages of the hash table. */ @@ -213599,6 +216101,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui } goto _5 _5: + ; iIn++ } /* If this is page 0 of the old hash, copy the rowid-0-flag from the @@ -213610,6 +216113,7 @@ func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 ui _fts5DataRelease(tls, pFree) goto _2 _2: + ; ii++ } return res @@ -213710,6 +216214,7 @@ func _fts5IndexTombstoneRebuild(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 u } goto _3 _3: + ; ii++ } /* Rebuild the hash table. */ @@ -213800,6 +216305,7 @@ func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) _fts5DataWrite(tls, p, iTombstoneRowid, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fp, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(ii)*8)))).Fnn) goto _3 _3: + ; ii++ } (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone = *(*int32)(unsafe.Pointer(bp)) @@ -213843,10 +216349,12 @@ func _sqlite3Fts5IndexContentlessDelete(tls *libc.TLS, p uintptr, iOrigin Ti64, } goto _2 _2: + ; iSeg-- } goto _1 _1: + ; iLvl-- } _fts5StructureRelease(tls, pStruct) @@ -213883,6 +216391,7 @@ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos in ret += ret<> libc.Int32FromInt32(32)) iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) @@ -214234,6 +216748,7 @@ func _sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum Tu64, bUseC } goto _3 _3: + ; _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) } _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) @@ -214822,7 +217337,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) _ = libc.Int32FromInt32(0) _ = libc.Int32FromInt32(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) @@ -214862,7 +217377,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v3 = iIdxStr iIdxStr++ *(*uint8)(unsafe.Pointer(idxStr + uintptr(v3))) = uint8('M') - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) _ = libc.Int32FromInt32(0) } @@ -214884,7 +217399,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) v6 = int32('G') } *(*uint8)(unsafe.Pointer(idxStr + uintptr(v5))) = uint8(v6) - Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5113, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5138, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) iCons++ v7 = iCons @@ -214905,6 +217420,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _1 _1: + ; i++ } if bSeenEq == 0 { @@ -214944,6 +217460,7 @@ func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) } goto _10 _10: + ; i++ } } @@ -215022,6 +217539,7 @@ func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) @@ -215119,6 +217637,7 @@ func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { Xsqlite3_free(tls, pData) goto _1 _1: + ; pData = pNext } Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) @@ -215152,6 +217671,7 @@ func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 } *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext @@ -215193,6 +217713,7 @@ func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff goto _2 _2: + ; i++ } *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) @@ -215223,6 +217744,7 @@ func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } } @@ -215381,7 +217903,7 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ if zRankArgs != 0 { - v1 = __ccgo_ts + 14965 + v1 = __ccgo_ts + 14990 } else { v1 = __ccgo_ts + 1648 } @@ -215391,11 +217913,11 @@ func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int v2 = __ccgo_ts + 1648 } if bDesc != 0 { - v3 = __ccgo_ts + 36817 + v3 = __ccgo_ts + 36843 } else { - v3 = __ccgo_ts + 36822 + v3 = __ccgo_ts + 36848 } - rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36826, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36852, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter if rc == SQLITE_OK { _ = libc.Int32FromInt32(0) @@ -215450,18 +217972,19 @@ func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr } goto _1 _1: + ; n++ } _ = libc.Int32FromInt32(0) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) - if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36881, z, n) { + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36907, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) } else { - if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5456, z, n) { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5481, z, n) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { /* An unrecognized directive. Return an error message. */ - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36887, libc.VaList(bp+8, n, z)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36913, libc.VaList(bp+8, n, z)) rc = int32(SQLITE_ERROR) } } @@ -215488,6 +218011,7 @@ func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) } goto _1 _1: + ; pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext } /* No function of the specified name was found. Return 0. */ @@ -215510,7 +218034,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36915, libc.VaList(bp+24, zRankArgs)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36941, libc.VaList(bp+24, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) @@ -215530,6 +218054,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) goto _1 _1: + ; i++ } } @@ -215545,7 +218070,7 @@ func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { _ = libc.Int32FromInt32(0) - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36925, libc.VaList(bp+24, zRank)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36951, libc.VaList(bp+24, zRank)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -215579,7 +218104,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) } else { if rc == int32(SQLITE_ERROR) { - (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36946, libc.VaList(bp+24, z)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36972, libc.VaList(bp+24, z)) } } } else { @@ -215587,7 +218112,7 @@ func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank ui (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34878 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34904 (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -215638,7 +218163,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint iIdxStr = 0 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36778, 0) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36804, 0) return int32(SQLITE_ERROR) } if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { @@ -215723,6 +218248,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } goto _1 _1: + ; i++ } if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { @@ -215795,7 +218321,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { - *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+36979, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37005, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = int32(SQLITE_ERROR) } else { /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup @@ -215821,6 +218347,7 @@ func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uint } } filter_out: + ; _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc @@ -215982,36 +218509,36 @@ func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) rc = SQLITE_OK *(*int32)(unsafe.Pointer(bp)) = 0 bLoadConfig = 0 - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37015, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37041, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37026, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37052, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37106, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37132, zCmd) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37114, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37140, 0) rc = int32(SQLITE_ERROR) } else { rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } bLoadConfig = int32(1) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17327, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17361, zCmd) { rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37170, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37196, zCmd) { nMerge = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37176, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37202, zCmd) { iArg = Xsqlite3_value_int(tls, pVal) rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { - if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37192, zCmd) { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+37218, zCmd) { rc = _sqlite3Fts5FlushToDisk(tls, pTab) } else { rc = _sqlite3Fts5FlushToDisk(tls, pTab) @@ -216114,9 +218641,9 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, if eType0 == int32(SQLITE_NULL) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) != int32(SQLITE_NULL) { /* A "special" INSERT op. These are handled separately. */ z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(int32(2)+(*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*8))) - if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17847, z) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+17881, z) { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - _fts5SetVtabError(tls, pTab, __ccgo_ts+37198, 0) + _fts5SetVtabError(tls, pTab, __ccgo_ts+37224, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { *(*int32)(unsafe.Pointer(bp)) = _fts5SpecialDelete(tls, pTab, apVal) @@ -216147,11 +218674,11 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if eType0 == int32(SQLITE_INTEGER) && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_NONE) && (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { if nArg > int32(1) { - v1 = __ccgo_ts + 20835 + v1 = __ccgo_ts + 20869 } else { - v1 = __ccgo_ts + 37257 + v1 = __ccgo_ts + 37283 } - (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37269, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37295, libc.VaList(bp+16, v1, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if nArg == int32(1) { @@ -216202,7 +218729,7 @@ func _fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, } } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && bUpdateOrDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION_SECUREDELETE)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = int32(FTS5_CURRENT_VERSION_SECUREDELETE) } @@ -216371,6 +218898,7 @@ func _fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn } goto _1 _1: + ; i++ } Xsqlite3_free(tls, aPopulator) @@ -216441,6 +218969,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { @@ -216456,6 +218985,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { } goto _2 _2: + ; i++ } if iBest < 0 { @@ -216583,6 +219113,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _1 _1: + ; i++ } } else { @@ -216601,6 +219132,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr } goto _2 _2: + ; i1++ } } @@ -216617,6 +219149,7 @@ func _fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr *(*int32)(unsafe.Pointer(pnToken)) += *(*int32)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i2)*4)) goto _3 _3: + ; i2++ } } else { @@ -216654,6 +219187,7 @@ func _fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintp } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216693,6 +219227,7 @@ func _fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) (r uintptr) { } goto _1 _1: + ; pData = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext } if pData != 0 { @@ -216950,6 +219485,7 @@ func _fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData u } goto _1 _1: + ; rc = _fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) } } @@ -216977,6 +219513,7 @@ func _fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId Ti64) (r uintpt } goto _1 _1: + ; pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext } return pCsr @@ -216993,7 +219530,7 @@ func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37306, libc.VaList(bp+8, iCsrId)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37332, libc.VaList(bp+8, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } else { @@ -217060,9 +219597,11 @@ func _fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) (r int32) { } goto _4 _1: + ; /* Append the varints */ i = 0 _7: + ; if !(i < nPhrase-int32(1)) { goto _5 } @@ -217070,10 +219609,12 @@ _7: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(nByte)) goto _6 _6: + ; i++ goto _7 goto _5 _5: + ; /* Append the position lists */ i = 0 for { @@ -217084,10 +219625,12 @@ _5: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32))) goto _8 _8: + ; i++ } goto _4 _2: + ; /* Append the varints */ i = 0 for { @@ -217098,6 +219641,7 @@ _2: _sqlite3Fts5BufferAppendVarint(tls, bp, bp+8, int64(*(*int32)(unsafe.Pointer(bp + 48)))) goto _9 _9: + ; i++ } /* Append the position lists */ @@ -217110,12 +219654,15 @@ _2: _sqlite3Fts5BufferAppendBlob(tls, bp, bp+8, uint32(*(*int32)(unsafe.Pointer(bp + 64))), *(*uintptr)(unsafe.Pointer(bp + 56))) goto _10 _10: + ; i++ } goto _4 _3: + ; goto _4 _4: + ; Xsqlite3_result_blob(tls, pCtx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn, __ccgo_fp(Xsqlite3_free)) return *(*int32)(unsafe.Pointer(bp)) } @@ -217175,7 +219722,7 @@ func _fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) } else { if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && Xsqlite3_vtab_nochange(tls, pCtx) != 0 { - zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37327, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+37353, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) Xsqlite3_free(tls, zErr) } @@ -217373,6 +219920,7 @@ func _fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) (r uint } goto _1 _1: + ; pMod = (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext } } @@ -217417,7 +219965,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr if pMod == uintptr(0) { _ = libc.Int32FromInt32(0) rc = int32(SQLITE_ERROR) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37398, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37424, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg)))) } else { if azArg != 0 { v2 = azArg + 1*8 @@ -217433,7 +219981,7 @@ func _sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nAr (*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi = pMod + 16 if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37420, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37446, 0) } } else { (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern = _sqlite3Fts5TokenizerPattern(tls, (*TFts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) @@ -217462,6 +220010,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pAux) goto _1 _1: + ; pAux = pNextAux } pTok = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpTok @@ -217476,6 +220025,7 @@ func _fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { Xsqlite3_free(tls, pTok) goto _2 _2: + ; pTok = pNextTok } Xsqlite3_free(tls, pGlobal) @@ -217487,7 +220037,7 @@ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg _ = libc.Int32FromInt32(0) - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37451) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), __ccgo_ts+37477) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = pGlobal } @@ -217502,7 +220052,7 @@ func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr _ = libc.Int32FromInt32(0) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37464, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+37490, -int32(1), uintptr(-libc.Int32FromInt32(1))) } // C documentation @@ -217524,17 +220074,18 @@ func _fts5ShadowName(tls *libc.TLS, zName uintptr) (r int32) { } goto _1 _1: + ; i++ } return 0 } var _azName2 = [5]uintptr{ - 0: __ccgo_ts + 37555, - 1: __ccgo_ts + 35067, - 2: __ccgo_ts + 25715, - 3: __ccgo_ts + 35634, - 4: __ccgo_ts + 11768, + 0: __ccgo_ts + 37581, + 1: __ccgo_ts + 35093, + 2: __ccgo_ts + 25741, + 3: __ccgo_ts + 35660, + 4: __ccgo_ts + 11793, } // C documentation @@ -217555,10 +220106,10 @@ func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabnam _ = isQuick rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0) if rc&int32(0xff) == int32(SQLITE_CORRUPT) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37562, libc.VaList(bp+8, zSchema, zTabname)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37588, libc.VaList(bp+8, zSchema, zTabname)) } else { if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37608, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37634, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc))) } } _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) @@ -217581,7 +220132,7 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = __ccgo_fp(_fts5CreateAux) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = __ccgo_fp(_fts5CreateTokenizer) (*TFts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = __ccgo_fp(_fts5FindTokenizer) - rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37671, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+37697, uintptr(unsafe.Pointer(&_fts5Mod)), p, __ccgo_fp(_fts5ModuleDestroy)) if rc == SQLITE_OK { rc = _sqlite3Fts5IndexInit(tls, db) } @@ -217598,10 +220149,10 @@ func _fts5Init(tls *libc.TLS, db uintptr) (r int32) { rc = _sqlite3Fts5VocabInit(tls, pGlobal, db) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37671, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37697, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_fts5Fts5Func), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37676, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+37702, 0, libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), p, __ccgo_fp(_fts5SourceIdFunc), uintptr(0), uintptr(0)) } } /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file @@ -217706,17 +220257,17 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, _ = libc.Int32FromInt32(0) if *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(eStmt)*8)) == uintptr(0) { azStmt = [11]uintptr{ - 0: __ccgo_ts + 37691, - 1: __ccgo_ts + 37759, - 2: __ccgo_ts + 37828, - 3: __ccgo_ts + 37861, - 4: __ccgo_ts + 37900, - 5: __ccgo_ts + 37940, - 6: __ccgo_ts + 37979, - 7: __ccgo_ts + 38022, - 8: __ccgo_ts + 38061, - 9: __ccgo_ts + 38105, - 10: __ccgo_ts + 38145, + 0: __ccgo_ts + 37717, + 1: __ccgo_ts + 37785, + 2: __ccgo_ts + 37854, + 3: __ccgo_ts + 37887, + 4: __ccgo_ts + 37926, + 5: __ccgo_ts + 37966, + 6: __ccgo_ts + 38005, + 7: __ccgo_ts + 38048, + 8: __ccgo_ts + 38087, + 9: __ccgo_ts + 38131, + 10: __ccgo_ts + 38171, } pC = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig zSql = uintptr(0) @@ -217744,6 +220295,7 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)+int32(1)))) = uint8(',') goto _1 _1: + ; i++ } *(*uint8)(unsafe.Pointer(zBind + uintptr(i*int32(2)-int32(1)))) = uint8('\000') @@ -217752,14 +220304,14 @@ func _fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, } case int32(FTS5_STMT_REPLACE_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v2 = __ccgo_ts + 38168 + v2 = __ccgo_ts + 38194 } else { v2 = __ccgo_ts + 1648 } zSql = Xsqlite3_mprintf(tls, azStmt[eStmt], libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pC)).FzDb, (*TFts5Config)(unsafe.Pointer(pC)).FzName, v2)) case int32(FTS5_STMT_LOOKUP_DOCSIZE): if (*TFts5Config)(unsafe.Pointer(pC)).FbContentlessDelete != 0 { - v3 = __ccgo_ts + 38171 + v3 = __ccgo_ts + 38197 } else { v3 = __ccgo_ts + 1648 } @@ -217817,12 +220369,12 @@ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { defer tls.Free(64) var rc int32 _ = rc - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38179, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38205, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38283, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38309, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38321, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38347, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } @@ -217831,7 +220383,7 @@ func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail ui bp := tls.Alloc(48) defer tls.Free(48) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38359, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + *(*int32)(unsafe.Pointer(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38385, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -217843,14 +220395,14 @@ func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) ( _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25715, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11768, zName) - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37555, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+25741, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+11793, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37581, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35634, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35660, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35067, zName) + _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+35093, zName) } return *(*int32)(unsafe.Pointer(bp)) } @@ -217870,13 +220422,13 @@ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDef _, _ = rc, v1 *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) if bWithout != 0 { - v1 = __ccgo_ts + 30355 + v1 = __ccgo_ts + 30381 } else { v1 = __ccgo_ts + 1648 } - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38401, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+38427, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38431, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38457, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) } return rc @@ -217917,35 +220469,36 @@ func _sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCr if zDefn == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { - Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38475, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, __ccgo_ts+38501, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } - Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38498, libc.VaList(bp+8, i)) + Xsqlite3_snprintf(tls, nDefn-iOff, zDefn+uintptr(iOff), __ccgo_ts+38524, libc.VaList(bp+8, i)) iOff += int32(libc.Xstrlen(tls, zDefn+uintptr(iOff))) goto _2 _2: + ; i++ } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35067, zDefn, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35093, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - zCols = __ccgo_ts + 38504 + zCols = __ccgo_ts + 38530 if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { - zCols = __ccgo_ts + 38536 + zCols = __ccgo_ts + 38562 } - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35634, zCols, 0, pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+35660, zCols, 0, pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37555, __ccgo_ts+38584, int32(1), pzErr) + rc = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+37581, __ccgo_ts+38610, int32(1), pzErr) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } } if rc != 0 { @@ -217974,6 +220527,7 @@ func _sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) (r int32) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(i)*8))) goto _1 _1: + ; i++ } Xsqlite3_free(tls, p) @@ -218076,6 +220630,7 @@ func _fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel Ti64, apVal uint } goto _1 _1: + ; iCol++ } if rc == SQLITE_OK && (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1) { @@ -218216,6 +220771,7 @@ func _fts5StorageSaveTotals(tls *libc.TLS, p uintptr) (r int32) { _sqlite3Fts5BufferAppendVarint(tls, bp+16, bp, *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) goto _1 _1: + ; i++ } if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { @@ -218289,9 +220845,9 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38601, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38627, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38651, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+38677, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ @@ -218299,7 +220855,7 @@ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35806, uintptr(0), int32(FTS5_CURRENT_VERSION)) + rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+35832, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } @@ -218346,6 +220902,7 @@ func _sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) (r int32) { *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 24))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218443,6 +221000,7 @@ func _sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, p rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) goto _1 _1: + ; i++ } if rc == SQLITE_OK { @@ -218491,6 +221049,7 @@ func _sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRo *(*Ti64)(unsafe.Pointer((*TFts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol)*8)) += int64((*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FszCol) goto _1 _1: + ; (*(*TFts5InsertCtx)(unsafe.Pointer(bp + 8))).FiCol++ } (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow++ @@ -218510,7 +221069,7 @@ func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var _ /* pCnt at bp+0 */ uintptr _, _, _ = pConfig, rc, zSql pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38680, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+38706, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { @@ -218609,6 +221168,7 @@ func _fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32 } goto _1 _1: + ; ii++ } return rc @@ -218685,6 +221245,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _1 _1: + ; i++ } _sqlite3Fts5TermsetFree(tls, (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpTermset) @@ -218711,6 +221272,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 } goto _2 _2: + ; i1++ } } @@ -218718,14 +221280,14 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 ** number of rows. */ if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { *(*Ti64)(unsafe.Pointer(bp + 48)) = 0 - rc = _fts5StorageCount(tls, p, __ccgo_ts+35067, bp+48) + rc = _fts5StorageCount(tls, p, __ccgo_ts+35093, bp+48) if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 48)) != (*TFts5Storage)(unsafe.Pointer(p)).FnTotalRow { rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int32('A') && int32(*(*uint8)(unsafe.Pointer(zCsr))) <= int32('Z') { v26 = zOut zOut++ @@ -219627,15 +222205,20 @@ ascii_tokenchar: } zCsr++ _25: + ; _9: + ; ie = int32(int64(zCsr) - int64(pText)) goto _6 _5: + ; /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xToken})))(tls, pCtx, 0, aFold, int32(int64(zOut)-int64(aFold)), is, ie) goto _2 _1: + ; tokenize_done: + ; if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } @@ -219697,7 +222280,7 @@ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, p pApi = pCtx rc = SQLITE_OK *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) - zBase = __ccgo_ts + 38772 + zBase = __ccgo_ts + 38798 if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) } @@ -219788,6 +222371,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _1 _1: + ; i++ } /* Scan for a consonent */ @@ -219803,6 +222387,7 @@ func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons in } goto _3 _3: + ; i++ } return 0 @@ -219862,6 +222447,7 @@ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { mask = mask< int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38782, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38808, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38785, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38790, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38816, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('e'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38795, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38798, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38824, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } case int32('l'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38801, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38827, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38806, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38832, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38811, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38815, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38821, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38847, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38826, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38852, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -219976,49 +222563,49 @@ func _fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38830, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38856, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1_and_S_or_T(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38834, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38860, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) } } } case int32('s'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38837, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38863, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('t'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38841, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38867, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38845, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38849, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38875, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38853, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38879, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('z'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38857, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38883, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt1(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } @@ -220035,20 +222622,20 @@ func _fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38861, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38841, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38887, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('b'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38864, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38867, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38890, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38893, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } case int32('i'): - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38871, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38857, uint64(3)) + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38897, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(2)), __ccgo_ts+38883, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) + int32(3) ret = int32(1) } @@ -220064,75 +222651,75 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38874, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38900, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38867, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38882, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38908, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38889, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38915, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(4) } } } case int32('c'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38894, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38920, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38790, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38816, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38899, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38925, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38785, uint64(4)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38811, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(4) } } } case int32('e'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38904, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38930, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38857, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38883, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('g'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38909, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15873, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+15907, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } case int32('l'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38914, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38940, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38867, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38893, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38918, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38944, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38808, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38923, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38826, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38852, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38929, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38933, uint64(1)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+38959, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(1) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38935, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38961, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38849, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38875, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } @@ -220141,48 +222728,48 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('o'): - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38941, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38967, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38857, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38883, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38949, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38975, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38867, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38955, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38981, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38841, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38867, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(3) } } } } case int32('s'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38960, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38966, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38992, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38853, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38879, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38974, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38982, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+39008, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } else { - if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38986, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { + if nBuf > int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39012, aBuf+uintptr(nBuf-int32(7)), uint64(7)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(7)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38849, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(7)), __ccgo_ts+38875, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(7) + int32(3) } } @@ -220190,21 +222777,21 @@ func _fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38994, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39020, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39000, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39026, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38853, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38879, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(3) } } else { - if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39006, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { + if nBuf > int32(6) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39032, aBuf+uintptr(nBuf-int32(6)), uint64(6)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(6)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38867, uint64(3)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(6)), __ccgo_ts+38893, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(6) + int32(3) } } @@ -220222,48 +222809,48 @@ func _fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('a'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39013, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39039, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(4)), __ccgo_ts+38824, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) + int32(2) } } case int32('s'): - if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39018, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { + if nBuf > int32(4) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39044, aBuf+uintptr(nBuf-int32(4)), uint64(4)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(4) } } case int32('t'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39023, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39049, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } else { - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39029, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39055, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38798, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38824, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } } case int32('u'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+38982, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39008, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) } } case int32('v'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39035, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39061, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) } } case int32('z'): - if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39041, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { + if nBuf > int32(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39067, aBuf+uintptr(nBuf-int32(5)), uint64(5)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(5)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38782, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(5)), __ccgo_ts+38808, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(5) + int32(2) } } @@ -220279,13 +222866,13 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { nBuf = *(*int32)(unsafe.Pointer(pnBuf)) switch int32(*(*uint8)(unsafe.Pointer(aBuf + uintptr(nBuf-int32(2))))) { case int32('e'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39047, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39073, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_MGt0(tls, aBuf, nBuf-int32(3)) != 0 { - libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39051, uint64(2)) + libc.Xmemcpy(tls, aBuf+uintptr(nBuf-int32(3)), __ccgo_ts+39077, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) + int32(2) } } else { - if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39054, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { + if nBuf > int32(2) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39080, aBuf+uintptr(nBuf-int32(2)), uint64(2)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(2) ret = int32(1) @@ -220293,7 +222880,7 @@ func _fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) (r int32) { } } case int32('n'): - if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39057, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { + if nBuf > int32(3) && 0 == libc.Xmemcmp(tls, __ccgo_ts+39083, aBuf+uintptr(nBuf-int32(3)), uint64(3)) { if _fts5Porter_Vowel(tls, aBuf, nBuf-int32(3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = nBuf - int32(3) ret = int32(1) @@ -220380,6 +222967,7 @@ func _fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nT } return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp)), iStart, iEnd) pass_through: + ; return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterContext)(unsafe.Pointer(p)).FxToken})))(tls, (*TPorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) return r } @@ -220453,14 +223041,14 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p break } zArg = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i+int32(1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39061) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+39087) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(zArg))) == int32('0')) } } else { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38754) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), __ccgo_ts+38780) { if int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('1') && int32(*(*uint8)(unsafe.Pointer(zArg))) != int32('2') || *(*uint8)(unsafe.Pointer(zArg + 1)) != 0 { rc = int32(SQLITE_ERROR) } else { @@ -220477,6 +223065,7 @@ func _fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, p } goto _1 _1: + ; i += int32(2) } if (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FiFoldParam != 0 && (*TTrigramTokenizer)(unsafe.Pointer(pNew)).FbFold == 0 { @@ -220581,6 +223170,7 @@ func _fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int } goto _1 _1: + ; ii++ } /* At the start of each iteration of this loop: @@ -220733,7 +223323,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { Fx Tfts5_tokenizer }{ 0: { - FzName: __ccgo_ts + 38772, + FzName: __ccgo_ts + 38798, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5UnicodeCreate), FxDelete: __ccgo_fp(_fts5UnicodeDelete), @@ -220741,7 +223331,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 1: { - FzName: __ccgo_ts + 39076, + FzName: __ccgo_ts + 39102, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5AsciiCreate), FxDelete: __ccgo_fp(_fts5AsciiDelete), @@ -220749,7 +223339,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 2: { - FzName: __ccgo_ts + 39082, + FzName: __ccgo_ts + 39108, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5PorterCreate), FxDelete: __ccgo_fp(_fts5PorterDelete), @@ -220757,7 +223347,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { }, }, 3: { - FzName: __ccgo_ts + 39089, + FzName: __ccgo_ts + 39115, Fx: Tfts5_tokenizer{ FxCreate: __ccgo_fp(_fts5TriCreate), FxDelete: __ccgo_fp(_fts5TriDelete), @@ -220777,6 +223367,7 @@ func _sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) (r int32) { })(unsafe.Pointer(bp)))[i].FzName, pApi, bp+uintptr(i)*32+8, uintptr(0)) goto _1 _1: + ; i++ } return rc @@ -225827,6 +228418,7 @@ func _sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { *(*Tu8)(unsafe.Pointer(aAscii + uintptr(i))) = uint8(bToken) goto _1 _1: + ; i++ } iTbl++ @@ -226116,6 +228708,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { v >>= uint64(7) goto _1 _1: + ; i-- } return int32(9) @@ -226139,6 +228732,7 @@ func _fts5PutVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] goto _4 _4: + ; j-- i++ } @@ -226298,16 +228892,16 @@ func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uin zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1)) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { _sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39097) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39123) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39101) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39127) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_ROW) } else { - if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39105) == 0 { + if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+39131) == 0 { *(*int32)(unsafe.Pointer(peType)) = int32(FTS5_VOCAB_INSTANCE) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39114, libc.VaList(bp+16, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39140, libc.VaList(bp+16, zCopy)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } @@ -226376,15 +228970,15 @@ func _fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, arg var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _ = azSchema, bDb, nByte, nDb, nTab, pRet, zDb, zTab, zType, v1, v2, v3 azSchema = [3]uintptr{ - 0: __ccgo_ts + 39148, - 1: __ccgo_ts + 39188, - 2: __ccgo_ts + 39223, + 0: __ccgo_ts + 39174, + 1: __ccgo_ts + 39214, + 2: __ccgo_ts + 39249, } pRet = uintptr(0) *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK - bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23708, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) + bDb = libc.BoolInt32(argc == int32(6) && libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+23742, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0) if argc != int32(5) && bDb == 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39266, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+39292, 0) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } else { if bDb != 0 { @@ -226497,6 +229091,7 @@ func _fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) (r } goto _1 _1: + ; i++ } if iTermEq >= 0 { @@ -226554,10 +229149,10 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) zSql = uintptr(0) if (*TFts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39299, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39325, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return int32(SQLITE_ERROR) } - zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39330, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39356, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TFts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), bp+8, uintptr(0)) } @@ -226577,7 +229172,7 @@ func _fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { - (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39381, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39407, libc.VaList(bp+24, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*TFts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) } } else { @@ -226725,6 +229320,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _1 _1: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } } @@ -226825,6 +229421,7 @@ func _fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { } goto _3 _3: + ; (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ } if (*TFts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { @@ -227012,7 +229609,7 @@ func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) var p uintptr _ = p p = pGlobal - return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39407, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+39433, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } var _fts5Vocab = Tsqlite3_module{ @@ -227065,7 +229662,7 @@ func init() { // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { - return __ccgo_ts + 39417 + return __ccgo_ts + 39443 } type TAggInfo_col = struct { @@ -227347,11 +229944,11 @@ var Xsqlite3_temp_directory uintptr // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ -var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '1'} +var Xsqlite3_version = [7]uint8{'3', '.', '4', '5', '.', '3'} var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data -var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00%!0.15g\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a\x00" +var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=gcc-12.2.0\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=127\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%04d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00.\x00(join-%u)\x00(subquery-%u)\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00IdxLT\x00Or\x00And\x00IdxGE\x00RowSetRead\x00RowSetTest\x00Program\x00FkIfZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenRead\x00OpenWrite\x00BitNot\x00OpenDup\x00OpenAutoindex\x00String8\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00Real\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00statement aborts at %d: [%s] %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00drop column from\x00rename columns of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00PRAGMA \"%w\".integrity_check(%Q)\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.15g\x00%!0.20e\x00%Q\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00ceiling\x00floor\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00RIGHT PART OF \x00USE TEMP B-TREE FOR %sORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00%s %S\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX %d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u0009\x00\\u00\x00\\u0000\x00bad JSON path: %Q\x00@\x00[\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00json\x00jsonb\x00json_array\x00jsonb_array\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00'delete' may not be used with a contentless_delete=1 table\x00DELETE from\x00cannot %s contentless fts5 table: %s\x00no such cursor: %lld\x00cannot UPDATE a subset of columns on fts5 contentless-delete table: %s\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355\x00" type Sqlite3_int64 = sqlite3_int64 type Sqlite3_mutex_methods = sqlite3_mutex_methods diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_loong64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_loong64.go new file mode 100644 index 00000000..ed15248f --- /dev/null +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_loong64.go @@ -0,0 +1,223863 @@ +// Code generated for linux/loong64 by 'generator --package-name libsqlite3 --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-unsupported-alignment -import runtime -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DNDEBUG -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_WITHOUT_ZONEMALLOC -Dpread64=pread -Dpwrite64=pwrite -extended-errors -o sqlite3.go sqlite3.c -I/tmp/libsqlite3/sqlite-amalgamation-3450300/ccgo -DSQLITE_OS_UNIX=1 -eval-all-macros', DO NOT EDIT. + +//go:build linux && loong64 +// +build linux,loong64 + +package sqlite3 + +import ( + "reflect" + "unsafe" + + "modernc.org/libc" + + "runtime" +) + +var ( + _ reflect.Type + _ unsafe.Pointer +) + +const ALLBITS = -1 +const AT_EACCESS = 512 +const AT_EMPTY_PATH = 4096 +const AT_FDCWD = -100 +const AT_NO_AUTOMOUNT = 2048 +const AT_RECURSIVE = 32768 +const AT_REMOVEDIR = 512 +const AT_STATX_DONT_SYNC = 16384 +const AT_STATX_FORCE_SYNC = 8192 +const AT_STATX_SYNC_AS_STAT = 0 +const AT_STATX_SYNC_TYPE = 24576 +const AT_SYMLINK_FOLLOW = 1024 +const AT_SYMLINK_NOFOLLOW = 256 +const BIG_ENDIAN = 4321 +const BITVEC_MXHASH = 0 +const BITVEC_NBIT = 0 +const BITVEC_NELEM = 0 +const BITVEC_NINT = 0 +const BITVEC_NPTR = 0 +const BITVEC_SZ = 512 +const BITVEC_SZELEM = 8 +const BITVEC_TELEM = 0 +const BITVEC_USIZE = 0 +const BTALLOC_ANY = 0 +const BTALLOC_EXACT = 1 +const BTALLOC_LE = 2 +const BTCF_AtLast = 8 +const BTCF_Incrblob = 16 +const BTCF_Multiple = 32 +const BTCF_Pinned = 64 +const BTCF_ValidNKey = 2 +const BTCF_ValidOvfl = 4 +const BTCF_WriteFlag = 1 +const BTCURSOR_FIRST_UNINIT = 0 +const BTCURSOR_MAX_DEPTH = 20 +const BTREE_APPEND = 8 +const BTREE_APPLICATION_ID = 8 +const BTREE_AUTOVACUUM_FULL = 1 +const BTREE_AUTOVACUUM_INCR = 2 +const BTREE_AUTOVACUUM_NONE = 0 +const BTREE_AUXDELETE = 4 +const BTREE_BLOBKEY = 2 +const BTREE_BULKLOAD = 1 +const BTREE_DATA_VERSION = 15 +const BTREE_DEFAULT_CACHE_SIZE = 3 +const BTREE_FILE_FORMAT = 2 +const BTREE_FORDELETE = 8 +const BTREE_FREE_PAGE_COUNT = 0 +const BTREE_HINT_RANGE = 0 +const BTREE_INCR_VACUUM = 7 +const BTREE_INTKEY = 1 +const BTREE_LARGEST_ROOT_PAGE = 4 +const BTREE_MEMORY = 2 +const BTREE_OMIT_JOURNAL = 1 +const BTREE_PREFORMAT = 128 +const BTREE_SAVEPOSITION = 2 +const BTREE_SCHEMA_VERSION = 1 +const BTREE_SEEK_EQ = 2 +const BTREE_SINGLE = 4 +const BTREE_TEXT_ENCODING = 5 +const BTREE_UNORDERED = 8 +const BTREE_USER_VERSION = 6 +const BTREE_WRCSR = 4 +const BTS_EXCLUSIVE = 64 +const BTS_FAST_SECURE = 12 +const BTS_INITIALLY_EMPTY = 16 +const BTS_NO_WAL = 32 +const BTS_OVERWRITE = 8 +const BTS_PAGESIZE_FIXED = 2 +const BTS_PENDING = 128 +const BTS_READ_ONLY = 1 +const BTS_SECURE_DELETE = 4 +const BUFSIZ = 1024 +const BYTE_ORDER = 1234 +const CACHE_STALE = 0 +const CC_AND = 24 +const CC_BANG = 15 +const CC_BOM = 30 +const CC_COMMA = 23 +const CC_DIGIT = 3 +const CC_DOLLAR = 4 +const CC_DOT = 26 +const CC_EQ = 14 +const CC_GT = 13 +const CC_ID = 27 +const CC_ILLEGAL = 28 +const CC_KYWD = 2 +const CC_KYWD0 = 1 +const CC_LP = 17 +const CC_LT = 12 +const CC_MINUS = 11 +const CC_NUL = 29 +const CC_PERCENT = 22 +const CC_PIPE = 10 +const CC_PLUS = 20 +const CC_QUOTE = 8 +const CC_QUOTE2 = 9 +const CC_RP = 18 +const CC_SEMI = 19 +const CC_SLASH = 16 +const CC_SPACE = 7 +const CC_STAR = 21 +const CC_TILDA = 25 +const CC_VARALPHA = 5 +const CC_VARNUM = 6 +const CC_X = 0 +const CKCNSTRNT_COLUMN = 1 +const CKCNSTRNT_ROWID = 2 +const CLOCKS_PER_SEC = 1000000 +const CLOCK_BOOTTIME = 7 +const CLOCK_BOOTTIME_ALARM = 9 +const CLOCK_MONOTONIC = 1 +const CLOCK_MONOTONIC_COARSE = 6 +const CLOCK_MONOTONIC_RAW = 4 +const CLOCK_PROCESS_CPUTIME_ID = 2 +const CLOCK_REALTIME = 0 +const CLOCK_REALTIME_ALARM = 8 +const CLOCK_REALTIME_COARSE = 5 +const CLOCK_SGI_CYCLE = 10 +const CLOCK_TAI = 11 +const CLOCK_THREAD_CPUTIME_ID = 3 +const CLONE_CHILD_CLEARTID = 2097152 +const CLONE_CHILD_SETTID = 16777216 +const CLONE_DETACHED = 4194304 +const CLONE_FILES = 1024 +const CLONE_FS = 512 +const CLONE_IO = 2147483648 +const CLONE_NEWCGROUP = 33554432 +const CLONE_NEWIPC = 134217728 +const CLONE_NEWNET = 1073741824 +const CLONE_NEWNS = 131072 +const CLONE_NEWPID = 536870912 +const CLONE_NEWTIME = 128 +const CLONE_NEWUSER = 268435456 +const CLONE_NEWUTS = 67108864 +const CLONE_PARENT = 32768 +const CLONE_PARENT_SETTID = 1048576 +const CLONE_PIDFD = 4096 +const CLONE_PTRACE = 8192 +const CLONE_SETTLS = 524288 +const CLONE_SIGHAND = 2048 +const CLONE_SYSVSEM = 262144 +const CLONE_THREAD = 65536 +const CLONE_UNTRACED = 8388608 +const CLONE_VFORK = 16384 +const CLONE_VM = 256 +const COLFLAG_BUSY = 256 +const COLFLAG_GENERATED = 96 +const COLFLAG_HASCOLL = 512 +const COLFLAG_HASTYPE = 4 +const COLFLAG_HIDDEN = 2 +const COLFLAG_NOEXPAND = 1024 +const COLFLAG_NOINSERT = 98 +const COLFLAG_NOTAVAIL = 128 +const COLFLAG_PRIMKEY = 1 +const COLFLAG_SORTERREF = 16 +const COLFLAG_STORED = 64 +const COLFLAG_UNIQUE = 8 +const COLFLAG_VIRTUAL = 32 +const COLNAME_COLUMN = 4 +const COLNAME_DATABASE = 2 +const COLNAME_DECLTYPE = 1 +const COLNAME_N = 5 +const COLNAME_NAME = 0 +const COLNAME_TABLE = 3 +const COLTYPE_ANY = 1 +const COLTYPE_BLOB = 2 +const COLTYPE_CUSTOM = 0 +const COLTYPE_INT = 3 +const COLTYPE_INTEGER = 4 +const COLTYPE_REAL = 5 +const COLTYPE_TEXT = 6 +const CPU_SETSIZE = 1024 +const CSIGNAL = 255 +const CURSOR_FAULT = 4 +const CURSOR_INVALID = 1 +const CURSOR_REQUIRESEEK = 3 +const CURSOR_SKIPNEXT = 2 +const CURSOR_VALID = 0 +const CURTYPE_BTREE = 0 +const CURTYPE_PSEUDO = 3 +const CURTYPE_SORTER = 1 +const CURTYPE_VTAB = 2 +const DBFLAG_EncodingFixed = 64 +const DBFLAG_InternalFunc = 32 +const DBFLAG_PreferBuiltin = 2 +const DBFLAG_SchemaChange = 1 +const DBFLAG_SchemaKnownOk = 16 +const DBFLAG_Vacuum = 4 +const DBFLAG_VacuumInto = 8 +const DBSTAT_PAGE_PADDING_BYTES = 256 +const DB_ResetWanted = 8 +const DB_SchemaLoaded = 1 +const DB_UnresetViews = 2 +const DIRECT_MODE = 0 +const DN_ACCESS = 1 +const DN_ATTRIB = 32 +const DN_CREATE = 4 +const DN_DELETE = 8 +const DN_MODIFY = 2 +const DN_MULTISHOT = 2147483648 +const DN_RENAME = 16 +const DOTLOCK_SUFFIX = ".lock" +const E2BIG = 7 +const EACCES = 13 +const EADDRINUSE = 98 +const EADDRNOTAVAIL = 99 +const EADV = 68 +const EAFNOSUPPORT = 97 +const EAGAIN = 11 +const EALREADY = 114 +const EBADE = 52 +const EBADF = 9 +const EBADFD = 77 +const EBADMSG = 74 +const EBADR = 53 +const EBADRQC = 56 +const EBADSLT = 57 +const EBFONT = 59 +const EBUSY = 16 +const ECANCELED = 125 +const ECHILD = 10 +const ECHRNG = 44 +const ECOMM = 70 +const ECONNABORTED = 103 +const ECONNREFUSED = 111 +const ECONNRESET = 104 +const EDEADLK = 35 +const EDEADLOCK = 35 +const EDESTADDRREQ = 89 +const EDOM = 33 +const EDOTDOT = 73 +const EDQUOT = 122 +const EEXIST = 17 +const EFAULT = 14 +const EFBIG = 27 +const EHOSTDOWN = 112 +const EHOSTUNREACH = 113 +const EHWPOISON = 133 +const EIDRM = 43 +const EILSEQ = 84 +const EINPROGRESS = 115 +const EINTR = 4 +const EINVAL = 22 +const EIO = 5 +const EISCONN = 106 +const EISDIR = 21 +const EISNAM = 120 +const EKEYEXPIRED = 127 +const EKEYREJECTED = 129 +const EKEYREVOKED = 128 +const EL2HLT = 51 +const EL2NSYNC = 45 +const EL3HLT = 46 +const EL3RST = 47 +const ELIBACC = 79 +const ELIBBAD = 80 +const ELIBEXEC = 83 +const ELIBMAX = 82 +const ELIBSCN = 81 +const ELNRNG = 48 +const ELOOP = 40 +const EMEDIUMTYPE = 124 +const EMFILE = 24 +const EMLINK = 31 +const EMSGSIZE = 90 +const EMULTIHOP = 72 +const ENAMETOOLONG = 36 +const ENAME_NAME = 0 +const ENAME_ROWID = 3 +const ENAME_SPAN = 1 +const ENAME_TAB = 2 +const ENAVAIL = 119 +const ENETDOWN = 100 +const ENETRESET = 102 +const ENETUNREACH = 101 +const ENFILE = 23 +const ENOANO = 55 +const ENOBUFS = 105 +const ENOCSI = 50 +const ENODATA = 61 +const ENODEV = 19 +const ENOENT = 2 +const ENOEXEC = 8 +const ENOKEY = 126 +const ENOLCK = 37 +const ENOLINK = 67 +const ENOMEDIUM = 123 +const ENOMEM = 12 +const ENOMSG = 42 +const ENONET = 64 +const ENOPKG = 65 +const ENOPROTOOPT = 92 +const ENOSPC = 28 +const ENOSR = 63 +const ENOSTR = 60 +const ENOSYS = 38 +const ENOTBLK = 15 +const ENOTCONN = 107 +const ENOTDIR = 20 +const ENOTEMPTY = 39 +const ENOTNAM = 118 +const ENOTRECOVERABLE = 131 +const ENOTSOCK = 88 +const ENOTSUP = 95 +const ENOTTY = 25 +const ENOTUNIQ = 76 +const ENXIO = 6 +const EOPNOTSUPP = 95 +const EOVERFLOW = 75 +const EOWNERDEAD = 130 +const EPERM = 1 +const EPFNOSUPPORT = 96 +const EPIPE = 32 +const EPROTO = 71 +const EPROTONOSUPPORT = 93 +const EPROTOTYPE = 91 +const EP_Agg = 16 +const EP_CanBeNull = 2097152 +const EP_Collate = 512 +const EP_Commuted = 1024 +const EP_ConstFunc = 1048576 +const EP_DblQuoted = 128 +const EP_Distinct = 4 +const EP_FixedCol = 32 +const EP_FromDDL = 1073741824 +const EP_FullSize = 131072 +const EP_HasFunc = 8 +const EP_IfNullRow = 262144 +const EP_Immutable = 2 +const EP_InfixFunc = 256 +const EP_InnerON = 2 +const EP_IntValue = 2048 +const EP_IsFalse = 536870912 +const EP_IsTrue = 268435456 +const EP_Leaf = 8388608 +const EP_NoReduce = 1 +const EP_OuterON = 1 +const EP_Propagate = 4194824 +const EP_Quoted = 67108864 +const EP_Reduced = 16384 +const EP_Skip = 8192 +const EP_Static = 134217728 +const EP_Subquery = 4194304 +const EP_Subrtn = 33554432 +const EP_TokenOnly = 65536 +const EP_Unlikely = 524288 +const EP_VarSelect = 64 +const EP_Win = 32768 +const EP_WinFunc = 16777216 +const EP_xIsSelect = 4096 +const ERANGE = 34 +const EREMCHG = 78 +const EREMOTE = 66 +const EREMOTEIO = 121 +const ERESTART = 85 +const ERFKILL = 132 +const EROFS = 30 +const ESHUTDOWN = 108 +const ESOCKTNOSUPPORT = 94 +const ESPIPE = 29 +const ESRCH = 3 +const ESRMNT = 69 +const ESTALE = 116 +const ESTRPIPE = 86 +const ETIME = 62 +const ETIMEDOUT = 110 +const ETOOMANYREFS = 109 +const ETXTBSY = 26 +const EU4_EXPR = 2 +const EU4_IDX = 1 +const EU4_NONE = 0 +const EUCLEAN = 117 +const EUNATCH = 49 +const EUSERS = 87 +const EWOULDBLOCK = 11 +const EXCLUDED_TABLE_NUMBER = 2 +const EXCLUSIVE_LOCK = 4 +const EXDEV = 18 +const EXFULL = 54 +const EXIT_FAILURE = 1 +const EXIT_SUCCESS = 0 +const EXPRDUP_REDUCE = 1 +const EXPR_FULLSIZE = 0 +const F2FS_FEATURE_ATOMIC_WRITE = 4 +const F2FS_IOCTL_MAGIC = 245 +const F2FS_IOC_ABORT_VOLATILE_WRITE = 62725 +const F2FS_IOC_COMMIT_ATOMIC_WRITE = 62722 +const F2FS_IOC_GET_FEATURES = 2147546380 +const F2FS_IOC_START_ATOMIC_WRITE = 62721 +const F2FS_IOC_START_VOLATILE_WRITE = 62723 +const FALLOC_FL_KEEP_SIZE = 1 +const FALLOC_FL_PUNCH_HOLE = 2 +const FAPPEND = 1024 +const FASYNC = 8192 +const FD_CLOEXEC = 1 +const FD_SETSIZE = 1024 +const FFSYNC = 1052672 +const FILENAME_MAX = 4096 +const FIOASYNC = 21586 +const FIOCLEX = 21585 +const FIOGETOWN = 35075 +const FIONBIO = 21537 +const FIONCLEX = 21584 +const FIONREAD = 21531 +const FIOQSIZE = 21600 +const FIOSETOWN = 35073 +const FLAG_SIGNED = 1 +const FLAG_STRING = 4 +const FNDELAY = 2048 +const FNONBLOCK = 2048 +const FOPEN_MAX = 1000 +const FP_FAST_FMA = 1 +const FP_FAST_FMAF = 1 +const FP_ILOGB0 = -2147483648 +const FP_ILOGBNAN = -2147483648 +const FP_INFINITE = 1 +const FP_NAN = 0 +const FP_NORMAL = 4 +const FP_SUBNORMAL = 3 +const FP_ZERO = 2 +const FTS5CSR_EOF = 1 +const FTS5CSR_FREE_ZRANK = 16 +const FTS5CSR_REQUIRE_CONTENT = 2 +const FTS5CSR_REQUIRE_DOCSIZE = 4 +const FTS5CSR_REQUIRE_INST = 8 +const FTS5CSR_REQUIRE_POSLIST = 64 +const FTS5CSR_REQUIRE_RESEEK = 32 +const FTS5INDEX_QUERY_DESC = 2 +const FTS5INDEX_QUERY_NOOUTPUT = 32 +const FTS5INDEX_QUERY_NOTOKENDATA = 128 +const FTS5INDEX_QUERY_PREFIX = 1 +const FTS5INDEX_QUERY_SCAN = 8 +const FTS5INDEX_QUERY_SCANONETERM = 256 +const FTS5INDEX_QUERY_SKIPEMPTY = 16 +const FTS5INDEX_QUERY_SKIPHASH = 64 +const FTS5INDEX_QUERY_TEST_NOIDX = 4 +const FTS5TOKEN = 0 +const FTS5_AND = 2 +const FTS5_AVERAGES_ROWID = 1 +const FTS5_BI_MATCH = 1 +const FTS5_BI_ORDER_DESC = 128 +const FTS5_BI_ORDER_RANK = 32 +const FTS5_BI_ORDER_ROWID = 64 +const FTS5_BI_RANK = 2 +const FTS5_BI_ROWID_EQ = 4 +const FTS5_BI_ROWID_GE = 16 +const FTS5_BI_ROWID_LE = 8 +const FTS5_CARET = 12 +const FTS5_COLON = 5 +const FTS5_COMMA = 13 +const FTS5_CONTENT_EXTERNAL = 2 +const FTS5_CONTENT_NONE = 1 +const FTS5_CONTENT_NORMAL = 0 +const FTS5_CORRUPT = 267 +const FTS5_CURRENT_VERSION = 4 +const FTS5_CURRENT_VERSION_SECUREDELETE = 5 +const FTS5_DATA_DLI_B = 1 +const FTS5_DATA_HEIGHT_B = 5 +const FTS5_DATA_ID_B = 16 +const FTS5_DATA_PADDING = 20 +const FTS5_DATA_PAGE_B = 31 +const FTS5_DATA_ZERO_PADDING = 8 +const FTS5_DEFAULT_AUTOMERGE = 4 +const FTS5_DEFAULT_CRISISMERGE = 16 +const FTS5_DEFAULT_DELETE_AUTOMERGE = 10 +const FTS5_DEFAULT_HASHSIZE = 1048576 +const FTS5_DEFAULT_NEARDIST = 10 +const FTS5_DEFAULT_PAGE_SIZE = 4050 +const FTS5_DEFAULT_RANK = "bm25" +const FTS5_DEFAULT_USERMERGE = 4 +const FTS5_DETAIL_COLUMNS = 2 +const FTS5_DETAIL_FULL = 0 +const FTS5_DETAIL_NONE = 1 +const FTS5_EOF = 0 +const FTS5_LCP = 7 +const FTS5_LP = 10 +const FTS5_MAIN_PREFIX = 48 +const FTS5_MAX_LEVEL = 64 +const FTS5_MAX_PAGE_SIZE = 65536 +const FTS5_MAX_PREFIX_INDEXES = 31 +const FTS5_MAX_SEGMENT = 2000 +const FTS5_MAX_TOKEN_SIZE = 32768 +const FTS5_MERGE_NLIST = 16 +const FTS5_MINUS = 6 +const FTS5_MIN_DLIDX_SIZE = 4 +const FTS5_NOINLINE = "SQLITE_NOINLINE" +const FTS5_NOT = 3 +const FTS5_OPT_WORK_UNIT = 1000 +const FTS5_OR = 1 +const FTS5_PATTERN_GLOB = 66 +const FTS5_PATTERN_LIKE = 65 +const FTS5_PATTERN_NONE = 0 +const FTS5_PLAN_MATCH = 1 +const FTS5_PLAN_ROWID = 6 +const FTS5_PLAN_SCAN = 5 +const FTS5_PLAN_SORTED_MATCH = 4 +const FTS5_PLAN_SOURCE = 2 +const FTS5_PLAN_SPECIAL = 3 +const FTS5_PLUS = 14 +const FTS5_PORTER_MAX_TOKEN = 64 +const FTS5_RANK_NAME = "rank" +const FTS5_RCP = 8 +const FTS5_REMOVE_DIACRITICS_COMPLEX = 2 +const FTS5_REMOVE_DIACRITICS_NONE = 0 +const FTS5_REMOVE_DIACRITICS_SIMPLE = 1 +const FTS5_ROWID_NAME = "rowid" +const FTS5_RP = 11 +const FTS5_SEGITER_ONETERM = 1 +const FTS5_SEGITER_REVERSE = 2 +const FTS5_STAR = 15 +const FTS5_STMT_DELETE_CONTENT = 5 +const FTS5_STMT_DELETE_DOCSIZE = 7 +const FTS5_STMT_INSERT_CONTENT = 3 +const FTS5_STMT_LOOKUP = 2 +const FTS5_STMT_LOOKUP_DOCSIZE = 8 +const FTS5_STMT_REPLACE_CONFIG = 9 +const FTS5_STMT_REPLACE_CONTENT = 4 +const FTS5_STMT_REPLACE_DOCSIZE = 6 +const FTS5_STMT_SCAN = 10 +const FTS5_STMT_SCAN_ASC = 0 +const FTS5_STMT_SCAN_DESC = 1 +const FTS5_STRING = 9 +const FTS5_STRUCTURE_ROWID = 10 +const FTS5_STRUCTURE_V2 = "\xff\x00\x00\x01" +const FTS5_TERM = 4 +const FTS5_TOKENIZE_AUX = 8 +const FTS5_TOKENIZE_DOCUMENT = 4 +const FTS5_TOKENIZE_PREFIX = 2 +const FTS5_TOKENIZE_QUERY = 1 +const FTS5_TOKEN_COLOCATED = 1 +const FTS5_VOCAB_COL = 0 +const FTS5_VOCAB_COL_SCHEMA = "term, col, doc, cnt" +const FTS5_VOCAB_INSTANCE = 2 +const FTS5_VOCAB_INST_SCHEMA = "term, doc, col, offset" +const FTS5_VOCAB_ROW = 1 +const FTS5_VOCAB_ROW_SCHEMA = "term, doc, cnt" +const FTS5_VOCAB_TERM_EQ = 1 +const FTS5_VOCAB_TERM_GE = 2 +const FTS5_VOCAB_TERM_LE = 4 +const FTS5_WORK_UNIT = 64 +const FULLY_WITHIN = 2 +const FUNC_PERFECT_MATCH = 6 +const F_ADD_SEALS = 1033 +const F_CANCELLK = 1029 +const F_DUPFD = 0 +const F_DUPFD_CLOEXEC = 1030 +const F_GETFD = 1 +const F_GETFL = 3 +const F_GETLEASE = 1025 +const F_GETLK = 5 +const F_GETOWN = 9 +const F_GETOWNER_UIDS = 17 +const F_GETOWN_EX = 16 +const F_GETPIPE_SZ = 1032 +const F_GETSIG = 11 +const F_GET_FILE_RW_HINT = 1037 +const F_GET_RW_HINT = 1035 +const F_GET_SEALS = 1034 +const F_LOCK = 1 +const F_NOTIFY = 1026 +const F_OFD_GETLK = 36 +const F_OFD_SETLK = 37 +const F_OFD_SETLKW = 38 +const F_OK = 0 +const F_OWNER_GID = 2 +const F_OWNER_PGRP = 2 +const F_OWNER_PID = 1 +const F_OWNER_TID = 0 +const F_RDLCK = 0 +const F_SEAL_FUTURE_WRITE = 16 +const F_SEAL_GROW = 4 +const F_SEAL_SEAL = 1 +const F_SEAL_SHRINK = 2 +const F_SEAL_WRITE = 8 +const F_SETFD = 2 +const F_SETFL = 4 +const F_SETLEASE = 1024 +const F_SETLK = 6 +const F_SETLKW = 7 +const F_SETOWN = 8 +const F_SETOWN_EX = 15 +const F_SETPIPE_SZ = 1031 +const F_SETSIG = 10 +const F_SET_FILE_RW_HINT = 1038 +const F_SET_RW_HINT = 1036 +const F_TEST = 3 +const F_TLOCK = 2 +const F_ULOCK = 0 +const F_UNLCK = 2 +const F_WRLCK = 1 +const GCC_VERSION = 14000001 +const GEOPOLY_PI = 3.141592653589793 +const HASHSIZE = 97 +const HASHTABLE_HASH_1 = 383 +const HASHTABLE_NPAGE = 4096 +const HASHTABLE_NPAGE_ONE = 4096 +const HASHTABLE_NSLOT = 8192 +const HAVE_FCHOWN = 1 +const HAVE_FULLFSYNC = 0 +const HAVE_GETHOSTUUID = 0 +const HAVE_LSTAT = 1 +const HAVE_MREMAP = 1 +const HAVE_PREAD = 1 +const HAVE_PWRITE = 1 +const HAVE_READLINK = 1 +const HAVE_USLEEP = 1 +const HUGE = 0 +const HUGE_VALF = 0 +const INCRINIT_NORMAL = 0 +const INCRINIT_ROOT = 2 +const INCRINIT_TASK = 1 +const INFINITY = 0 +const INITFLAG_AlterAdd = 3 +const INITFLAG_AlterDrop = 2 +const INITFLAG_AlterMask = 3 +const INITFLAG_AlterRename = 1 +const INLINEFUNC_affinity = 4 +const INLINEFUNC_coalesce = 0 +const INLINEFUNC_expr_compare = 3 +const INLINEFUNC_expr_implies_expr = 2 +const INLINEFUNC_iif = 5 +const INLINEFUNC_implies_nonnull_row = 1 +const INLINEFUNC_sqlite_offset = 6 +const INLINEFUNC_unlikely = 99 +const INTERFACE = 1 +const IN_INDEX_EPH = 2 +const IN_INDEX_INDEX_ASC = 3 +const IN_INDEX_INDEX_DESC = 4 +const IN_INDEX_LOOP = 4 +const IN_INDEX_MEMBERSHIP = 2 +const IN_INDEX_NOOP = 5 +const IN_INDEX_NOOP_OK = 1 +const IN_INDEX_ROWID = 1 +const ITIMER_PROF = 2 +const ITIMER_REAL = 0 +const ITIMER_VIRTUAL = 1 +const IsStat4 = 1 +const JEACH_ATOM = 3 +const JEACH_FULLKEY = 6 +const JEACH_ID = 4 +const JEACH_JSON = 8 +const JEACH_KEY = 0 +const JEACH_PARENT = 5 +const JEACH_PATH = 7 +const JEACH_ROOT = 9 +const JEACH_TYPE = 2 +const JEACH_VALUE = 1 +const JEDIT_DEL = 1 +const JEDIT_INS = 3 +const JEDIT_REPL = 2 +const JEDIT_SET = 4 +const JSONB_ARRAY = 11 +const JSONB_FALSE = 2 +const JSONB_FLOAT = 5 +const JSONB_FLOAT5 = 6 +const JSONB_INT = 3 +const JSONB_INT5 = 4 +const JSONB_NULL = 0 +const JSONB_OBJECT = 12 +const JSONB_TEXT = 7 +const JSONB_TEXT5 = 9 +const JSONB_TEXTJ = 8 +const JSONB_TEXTRAW = 10 +const JSONB_TRUE = 1 +const JSON_ABPATH = 3 +const JSON_BLOB = 8 +const JSON_CACHE_ID = -429938 +const JSON_CACHE_SIZE = 4 +const JSON_EDITABLE = 1 +const JSON_INVALID_CHAR = 629145 +const JSON_ISSET = 4 +const JSON_JSON = 1 +const JSON_KEEPERROR = 2 +const JSON_LOOKUP_ERROR = 4294967295 +const JSON_LOOKUP_NOTFOUND = 4294967294 +const JSON_LOOKUP_PATHERROR = 4294967293 +const JSON_MAX_DEPTH = 1000 +const JSON_MERGE_BADPATCH = 2 +const JSON_MERGE_BADTARGET = 1 +const JSON_MERGE_OK = 0 +const JSON_MERGE_OOM = 3 +const JSON_SQL = 2 +const JSON_SUBTYPE = 74 +const JSTRING_ERR = 4 +const JSTRING_MALFORMED = 2 +const JSTRING_OOM = 1 +const JT_CROSS = 2 +const JT_ERROR = 128 +const JT_INNER = 1 +const JT_LEFT = 8 +const JT_LTORJ = 64 +const JT_NATURAL = 4 +const JT_OUTER = 32 +const JT_RIGHT = 16 +const KEYINFO_ORDER_BIGNULL = 2 +const KEYINFO_ORDER_DESC = 1 +const LEGACY_SCHEMA_TABLE = "sqlite_master" +const LEGACY_TEMP_SCHEMA_TABLE = "sqlite_temp_master" +const LITTLE_ENDIAN = 1234 +const LOCATE_NOERR = 2 +const LOCATE_VIEW = 1 +const LONGDOUBLE_TYPE = 0 +const LOOKASIDE_SMALL = 128 +const L_INCR = 1 +const L_SET = 0 +const L_XTND = 2 +const L_ctermid = 20 +const L_cuserid = 20 +const L_tmpnam = 20 +const M10d_Any = 1 +const M10d_No = 2 +const M10d_Yes = 0 +const MADV_COLD = 20 +const MADV_DODUMP = 17 +const MADV_DOFORK = 11 +const MADV_DONTDUMP = 16 +const MADV_DONTFORK = 10 +const MADV_DONTNEED = 4 +const MADV_FREE = 8 +const MADV_HUGEPAGE = 14 +const MADV_HWPOISON = 100 +const MADV_KEEPONFORK = 19 +const MADV_MERGEABLE = 12 +const MADV_NOHUGEPAGE = 15 +const MADV_NORMAL = 0 +const MADV_PAGEOUT = 21 +const MADV_RANDOM = 1 +const MADV_REMOVE = 9 +const MADV_SEQUENTIAL = 2 +const MADV_SOFT_OFFLINE = 101 +const MADV_UNMERGEABLE = 13 +const MADV_WILLNEED = 3 +const MADV_WIPEONFORK = 18 +const MAP_ANON = 32 +const MAP_ANONYMOUS = 32 +const MAP_DENYWRITE = 2048 +const MAP_EXECUTABLE = 4096 +const MAP_FAILED = -1 +const MAP_FILE = 0 +const MAP_FIXED = 16 +const MAP_FIXED_NOREPLACE = 1048576 +const MAP_GROWSDOWN = 256 +const MAP_HUGETLB = 262144 +const MAP_HUGE_16GB = 2281701376 +const MAP_HUGE_16KB = 939524096 +const MAP_HUGE_16MB = 1610612736 +const MAP_HUGE_1GB = 2013265920 +const MAP_HUGE_1MB = 1342177280 +const MAP_HUGE_256MB = 1879048192 +const MAP_HUGE_2GB = 2080374784 +const MAP_HUGE_2MB = 1409286144 +const MAP_HUGE_32MB = 1677721600 +const MAP_HUGE_512KB = 1275068416 +const MAP_HUGE_512MB = 1946157056 +const MAP_HUGE_64KB = 1073741824 +const MAP_HUGE_8MB = 1543503872 +const MAP_HUGE_MASK = 63 +const MAP_HUGE_SHIFT = 26 +const MAP_LOCKED = 8192 +const MAP_NONBLOCK = 65536 +const MAP_NORESERVE = 16384 +const MAP_POPULATE = 32768 +const MAP_PRIVATE = 2 +const MAP_SHARED = 1 +const MAP_SHARED_VALIDATE = 3 +const MAP_STACK = 131072 +const MAP_SYNC = 524288 +const MAP_TYPE = 15 +const MATH_ERREXCEPT = 2 +const MATH_ERRNO = 1 +const MAX_HANDLE_SZ = 128 +const MAX_PATHNAME = 512 +const MAX_SECTOR_SIZE = 65536 +const MB_CUR_MAX = 0 +const MCL_CURRENT = 1 +const MCL_FUTURE = 2 +const MCL_ONFAULT = 4 +const MEMJOURNAL_DFLT_FILECHUNKSIZE = 1024 +const MEMTYPE_HEAP = 1 +const MEMTYPE_LOOKASIDE = 2 +const MEMTYPE_PCACHE = 4 +const MEM_AffMask = 63 +const MEM_Agg = 32768 +const MEM_Blob = 16 +const MEM_Cleared = 256 +const MEM_Dyn = 4096 +const MEM_Ephem = 16384 +const MEM_FromBind = 64 +const MEM_Int = 4 +const MEM_IntReal = 32 +const MEM_Null = 1 +const MEM_Real = 8 +const MEM_Static = 8192 +const MEM_Str = 2 +const MEM_Subtype = 2048 +const MEM_Term = 512 +const MEM_TypeMask = 3519 +const MEM_Undefined = 0 +const MEM_Zero = 1024 +const MFD_ALLOW_SEALING = 2 +const MFD_CLOEXEC = 1 +const MFD_HUGETLB = 4 +const MLOCK_ONFAULT = 1 +const MREMAP_DONTUNMAP = 4 +const MREMAP_FIXED = 2 +const MREMAP_MAYMOVE = 1 +const MSVC_VERSION = 0 +const MS_ASYNC = 1 +const MS_INVALIDATE = 2 +const MS_SYNC = 4 +const M_1_PI = 0 +const M_2_PI = 0 +const M_2_SQRTPI = 0 +const M_E = 0 +const M_LN10 = 0 +const M_LN2 = 0 +const M_LOG10E = 0 +const M_LOG2E = 0 +const M_PI = 3.141592653589793 +const M_PI_2 = 0 +const M_PI_4 = 0 +const M_SQRT1_2 = 0 +const M_SQRT2 = 0 +const NAN = 0 +const NB = 3 +const NC_AllowAgg = 1 +const NC_AllowWin = 16384 +const NC_Complex = 8192 +const NC_FromDDL = 262144 +const NC_GenCol = 8 +const NC_HasAgg = 16 +const NC_HasWin = 32768 +const NC_IdxExpr = 32 +const NC_InAggFunc = 131072 +const NC_IsCheck = 4 +const NC_IsDDL = 65536 +const NC_MinMaxAgg = 4096 +const NC_NoSelect = 524288 +const NC_OrderAgg = 134217728 +const NC_PartIdx = 2 +const NC_SelfRef = 46 +const NC_Subquery = 64 +const NC_UAggInfo = 256 +const NC_UBaseReg = 1024 +const NC_UEList = 128 +const NC_UUpsert = 512 +const NC_Where = 1048576 +const NDEBUG = 1 +const NN = 1 +const NOT_WITHIN = 0 +const NO_LOCK = 0 +const N_6PACK = 7 +const N_AX25 = 5 +const N_CAIF = 20 +const N_GIGASET_M101 = 16 +const N_GSM0710 = 21 +const N_HCI = 15 +const N_HDLC = 13 +const N_IRDA = 11 +const N_MASC = 8 +const N_MOUSE = 2 +const N_NCI = 25 +const N_NULL = 27 +const N_OR_COST = 3 +const N_PPP = 3 +const N_PPS = 18 +const N_PROFIBUS_FDL = 10 +const N_R3964 = 9 +const N_SLCAN = 17 +const N_SLIP = 1 +const N_SMSBLOCK = 12 +const N_SORT_BUCKET = 32 +const N_SPEAKUP = 26 +const N_STATEMENT = 8 +const N_STRIP = 4 +const N_SYNC_PPP = 14 +const N_TI_WL = 22 +const N_TRACEROUTER = 24 +const N_TRACESINK = 23 +const N_TTY = 0 +const N_V253 = 19 +const N_X25 = 6 +const OE_Abort = 2 +const OE_Cascade = 10 +const OE_Default = 11 +const OE_Fail = 3 +const OE_Ignore = 4 +const OE_None = 0 +const OE_Replace = 5 +const OE_Restrict = 7 +const OE_Rollback = 1 +const OE_SetDflt = 9 +const OE_SetNull = 8 +const OE_Update = 6 +const OMIT_TEMPDB = 0 +const ONEPASS_MULTI = 2 +const ONEPASS_OFF = 0 +const ONEPASS_SINGLE = 1 +const OPFLAG_APPEND = 8 +const OPFLAG_AUXDELETE = 4 +const OPFLAG_BULKCSR = 1 +const OPFLAG_BYTELENARG = 192 +const OPFLAG_EPHEM = 1 +const OPFLAG_FORDELETE = 8 +const OPFLAG_ISNOOP = 64 +const OPFLAG_ISUPDATE = 4 +const OPFLAG_LASTROWID = 32 +const OPFLAG_LENGTHARG = 64 +const OPFLAG_NCHANGE = 1 +const OPFLAG_NOCHNG = 1 +const OPFLAG_NOCHNG_MAGIC = 109 +const OPFLAG_P2ISREG = 16 +const OPFLAG_PERMUTE = 1 +const OPFLAG_PREFORMAT = 128 +const OPFLAG_SAVEPOSITION = 2 +const OPFLAG_SEEKEQ = 2 +const OPFLAG_TYPEOFARG = 128 +const OPFLAG_USESEEKRESULT = 16 +const OPFLG_IN1 = 2 +const OPFLG_IN2 = 4 +const OPFLG_IN3 = 8 +const OPFLG_JUMP = 1 +const OPFLG_NCYCLE = 64 +const OPFLG_OUT2 = 16 +const OPFLG_OUT3 = 32 +const OP_Abortable = 189 +const OP_Add = 106 +const OP_AddImm = 86 +const OP_Affinity = 96 +const OP_AggFinal = 165 +const OP_AggInverse = 161 +const OP_AggStep = 162 +const OP_AggStep1 = 163 +const OP_AggValue = 164 +const OP_And = 44 +const OP_AutoCommit = 1 +const OP_BeginSubrtn = 74 +const OP_BitAnd = 102 +const OP_BitNot = 114 +const OP_BitOr = 103 +const OP_Blob = 77 +const OP_Cast = 88 +const OP_Checkpoint = 3 +const OP_Clear = 145 +const OP_Close = 122 +const OP_ClrSubtype = 180 +const OP_CollSeq = 85 +const OP_Column = 94 +const OP_ColumnsUsed = 123 +const OP_Compare = 90 +const OP_Concat = 111 +const OP_Copy = 80 +const OP_Count = 98 +const OP_CreateBtree = 147 +const OP_CursorHint = 185 +const OP_CursorLock = 167 +const OP_CursorUnlock = 168 +const OP_DecrJumpZero = 61 +const OP_DeferredSeek = 141 +const OP_Delete = 130 +const OP_Destroy = 144 +const OP_Divide = 109 +const OP_DropIndex = 152 +const OP_DropTable = 151 +const OP_DropTrigger = 154 +const OP_ElseEq = 58 +const OP_EndCoroutine = 68 +const OP_Eq = 53 +const OP_Expire = 166 +const OP_Explain = 188 +const OP_Filter = 64 +const OP_FilterAdd = 183 +const OP_FinishSeek = 143 +const OP_FkCheck = 83 +const OP_FkCounter = 158 +const OP_FkIfZero = 49 +const OP_Found = 29 +const OP_Function = 66 +const OP_Ge = 57 +const OP_GetSubtype = 181 +const OP_Gosub = 10 +const OP_Goto = 9 +const OP_Gt = 54 +const OP_Halt = 70 +const OP_HaltIfNull = 69 +const OP_IdxDelete = 140 +const OP_IdxGE = 45 +const OP_IdxGT = 41 +const OP_IdxInsert = 138 +const OP_IdxLE = 40 +const OP_IdxLT = 42 +const OP_IdxRowid = 142 +const OP_If = 16 +const OP_IfNoHope = 26 +const OP_IfNot = 17 +const OP_IfNotOpen = 25 +const OP_IfNotZero = 60 +const OP_IfNullRow = 20 +const OP_IfPos = 59 +const OP_IfSmaller = 33 +const OP_IncrVacuum = 62 +const OP_Init = 8 +const OP_InitCoroutine = 11 +const OP_Insert = 128 +const OP_Int64 = 72 +const OP_IntCopy = 82 +const OP_Integer = 71 +const OP_IntegrityCk = 155 +const OP_IsNull = 50 +const OP_IsTrue = 91 +const OP_IsType = 18 +const OP_JournalMode = 4 +const OP_Jump = 14 +const OP_Last = 32 +const OP_Le = 55 +const OP_LoadAnalysis = 150 +const OP_Lt = 56 +const OP_MakeRecord = 97 +const OP_MaxPgcnt = 179 +const OP_MemMax = 159 +const OP_Move = 79 +const OP_Multiply = 108 +const OP_MustBeInt = 13 +const OP_Ne = 52 +const OP_NewRowid = 127 +const OP_Next = 39 +const OP_NoConflict = 27 +const OP_Noop = 187 +const OP_Not = 19 +const OP_NotExists = 31 +const OP_NotFound = 28 +const OP_NotNull = 51 +const OP_Null = 75 +const OP_NullRow = 136 +const OP_Offset = 93 +const OP_OffsetLimit = 160 +const OP_Once = 15 +const OP_OpenAutoindex = 116 +const OP_OpenDup = 115 +const OP_OpenEphemeral = 118 +const OP_OpenPseudo = 121 +const OP_OpenRead = 112 +const OP_OpenWrite = 113 +const OP_Or = 43 +const OP_Pagecount = 178 +const OP_Param = 157 +const OP_ParseSchema = 149 +const OP_Permutation = 89 +const OP_Prev = 38 +const OP_Program = 48 +const OP_PureFunc = 65 +const OP_ReadCookie = 99 +const OP_Real = 153 +const OP_RealAffinity = 87 +const OP_ReleaseReg = 186 +const OP_Remainder = 110 +const OP_ReopenIdx = 101 +const OP_ResetCount = 131 +const OP_ResetSorter = 146 +const OP_ResultRow = 84 +const OP_Return = 67 +const OP_Rewind = 36 +const OP_RowCell = 129 +const OP_RowData = 134 +const OP_RowSetAdd = 156 +const OP_RowSetRead = 46 +const OP_RowSetTest = 47 +const OP_Rowid = 135 +const OP_SCopy = 81 +const OP_Savepoint = 0 +const OP_SeekEnd = 137 +const OP_SeekGE = 23 +const OP_SeekGT = 24 +const OP_SeekHit = 125 +const OP_SeekLE = 22 +const OP_SeekLT = 21 +const OP_SeekRowid = 30 +const OP_SeekScan = 124 +const OP_Sequence = 126 +const OP_SequenceTest = 120 +const OP_SetCookie = 100 +const OP_SetSubtype = 182 +const OP_ShiftLeft = 104 +const OP_ShiftRight = 105 +const OP_SoftNull = 76 +const OP_Sort = 35 +const OP_SorterCompare = 132 +const OP_SorterData = 133 +const OP_SorterInsert = 139 +const OP_SorterNext = 37 +const OP_SorterOpen = 119 +const OP_SorterSort = 34 +const OP_SqlExec = 148 +const OP_String = 73 +const OP_String8 = 117 +const OP_Subtract = 107 +const OP_TableLock = 169 +const OP_Trace = 184 +const OP_Transaction = 2 +const OP_TypeCheck = 95 +const OP_VBegin = 170 +const OP_VCheck = 174 +const OP_VColumn = 176 +const OP_VCreate = 171 +const OP_VDestroy = 172 +const OP_VFilter = 6 +const OP_VInitIn = 175 +const OP_VNext = 63 +const OP_VOpen = 173 +const OP_VRename = 177 +const OP_VUpdate = 7 +const OP_Vacuum = 5 +const OP_Variable = 78 +const OP_Yield = 12 +const OP_ZeroOrNull = 92 +const OS_VXWORKS = 0 +const O_ACCMODE = 2097155 +const O_APPEND = 1024 +const O_ASYNC = 8192 +const O_BINARY = 0 +const O_CLOEXEC = 524288 +const O_CREAT = 64 +const O_DIRECT = 16384 +const O_DIRECTORY = 65536 +const O_DSYNC = 4096 +const O_EXCL = 128 +const O_EXEC = 2097152 +const O_LARGEFILE = 32768 +const O_NDELAY = 2048 +const O_NOATIME = 262144 +const O_NOCTTY = 256 +const O_NOFOLLOW = 131072 +const O_NONBLOCK = 2048 +const O_PATH = 2097152 +const O_RDONLY = 0 +const O_RDWR = 2 +const O_RSYNC = 1052672 +const O_SEARCH = 2097152 +const O_SYNC = 1052672 +const O_TMPFILE = 4259840 +const O_TRUNC = 512 +const O_TTY_INIT = 0 +const O_WRONLY = 1 +const P4_COLLSEQ = -2 +const P4_DYNAMIC = -6 +const P4_EXPR = -9 +const P4_FREE_IF_LE = -6 +const P4_FUNCCTX = -15 +const P4_FUNCDEF = -7 +const P4_INT32 = -3 +const P4_INT64 = -13 +const P4_INTARRAY = -14 +const P4_KEYINFO = -8 +const P4_MEM = -10 +const P4_NOTUSED = 0 +const P4_REAL = -12 +const P4_STATIC = -1 +const P4_SUBPROGRAM = -4 +const P4_TABLE = -5 +const P4_TABLEREF = -16 +const P4_TRANSIENT = 0 +const P4_VTAB = -11 +const P5_ConstraintCheck = 3 +const P5_ConstraintFK = 4 +const P5_ConstraintNotNull = 1 +const P5_ConstraintUnique = 2 +const PAGER_CACHESPILL = 32 +const PAGER_CKPT_FULLFSYNC = 16 +const PAGER_ERROR = 6 +const PAGER_FLAGS_MASK = 56 +const PAGER_FULLFSYNC = 8 +const PAGER_GET_NOCONTENT = 1 +const PAGER_GET_READONLY = 2 +const PAGER_JOURNALMODE_DELETE = 0 +const PAGER_JOURNALMODE_MEMORY = 4 +const PAGER_JOURNALMODE_OFF = 2 +const PAGER_JOURNALMODE_PERSIST = 1 +const PAGER_JOURNALMODE_QUERY = -1 +const PAGER_JOURNALMODE_TRUNCATE = 3 +const PAGER_JOURNALMODE_WAL = 5 +const PAGER_LOCKINGMODE_EXCLUSIVE = 1 +const PAGER_LOCKINGMODE_NORMAL = 0 +const PAGER_LOCKINGMODE_QUERY = -1 +const PAGER_MEMORY = 2 +const PAGER_OMIT_JOURNAL = 1 +const PAGER_OPEN = 0 +const PAGER_READER = 1 +const PAGER_STAT_HIT = 0 +const PAGER_STAT_MISS = 1 +const PAGER_STAT_SPILL = 3 +const PAGER_STAT_WRITE = 2 +const PAGER_SYNCHRONOUS_EXTRA = 4 +const PAGER_SYNCHRONOUS_FULL = 3 +const PAGER_SYNCHRONOUS_MASK = 7 +const PAGER_SYNCHRONOUS_NORMAL = 2 +const PAGER_SYNCHRONOUS_OFF = 1 +const PAGER_WRITER_CACHEMOD = 3 +const PAGER_WRITER_DBMOD = 4 +const PAGER_WRITER_FINISHED = 5 +const PAGER_WRITER_LOCKED = 2 +const PARSE_MODE_DECLARE_VTAB = 1 +const PARSE_MODE_NORMAL = 0 +const PARSE_MODE_RENAME = 2 +const PARSE_MODE_UNMAP = 3 +const PARTLY_WITHIN = 1 +const PCACHE1_MIGHT_USE_GROUP_MUTEX = 1 +const PCACHE_DIRTYLIST_ADD = 2 +const PCACHE_DIRTYLIST_FRONT = 3 +const PCACHE_DIRTYLIST_REMOVE = 1 +const PDP_ENDIAN = 3412 +const PENDING_BYTE = 0 +const PENDING_LOCK = 3 +const PGHDR_CLEAN = 1 +const PGHDR_DIRTY = 2 +const PGHDR_DONT_WRITE = 16 +const PGHDR_MMAP = 32 +const PGHDR_NEED_SYNC = 8 +const PGHDR_WAL_APPEND = 64 +const PGHDR_WRITEABLE = 4 +const POSIX_CLOSE_RESTART = 0 +const POSIX_FADV_DONTNEED = 4 +const POSIX_FADV_NOREUSE = 5 +const POSIX_FADV_NORMAL = 0 +const POSIX_FADV_RANDOM = 1 +const POSIX_FADV_SEQUENTIAL = 2 +const POSIX_FADV_WILLNEED = 3 +const POSIX_MADV_DONTNEED = 4 +const POSIX_MADV_NORMAL = 0 +const POSIX_MADV_RANDOM = 1 +const POSIX_MADV_SEQUENTIAL = 2 +const POSIX_MADV_WILLNEED = 3 +const PREFERRED_SCHEMA_TABLE = "sqlite_schema" +const PREFERRED_TEMP_SCHEMA_TABLE = "sqlite_temp_schema" +const PROT_EXEC = 4 +const PROT_GROWSDOWN = 16777216 +const PROT_GROWSUP = 33554432 +const PROT_NONE = 0 +const PROT_READ = 1 +const PROT_WRITE = 2 +const PTF_INTKEY = 1 +const PTF_LEAF = 8 +const PTF_LEAFDATA = 4 +const PTF_ZERODATA = 2 +const PTHREAD_BARRIER_SERIAL_THREAD = -1 +const PTHREAD_CANCELED = -1 +const PTHREAD_CANCEL_ASYNCHRONOUS = 1 +const PTHREAD_CANCEL_DEFERRED = 0 +const PTHREAD_CANCEL_DISABLE = 1 +const PTHREAD_CANCEL_ENABLE = 0 +const PTHREAD_CANCEL_MASKED = 2 +const PTHREAD_CREATE_DETACHED = 1 +const PTHREAD_CREATE_JOINABLE = 0 +const PTHREAD_EXPLICIT_SCHED = 1 +const PTHREAD_INHERIT_SCHED = 0 +const PTHREAD_MUTEX_DEFAULT = 0 +const PTHREAD_MUTEX_ERRORCHECK = 2 +const PTHREAD_MUTEX_NORMAL = 0 +const PTHREAD_MUTEX_RECURSIVE = 1 +const PTHREAD_MUTEX_ROBUST = 1 +const PTHREAD_MUTEX_STALLED = 0 +const PTHREAD_ONCE_INIT = 0 +const PTHREAD_PRIO_INHERIT = 1 +const PTHREAD_PRIO_NONE = 0 +const PTHREAD_PRIO_PROTECT = 2 +const PTHREAD_PROCESS_PRIVATE = 0 +const PTHREAD_PROCESS_SHARED = 1 +const PTHREAD_SCOPE_PROCESS = 1 +const PTHREAD_SCOPE_SYSTEM = 0 +const PTRMAP_BTREE = 5 +const PTRMAP_FREEPAGE = 2 +const PTRMAP_OVERFLOW1 = 3 +const PTRMAP_OVERFLOW2 = 4 +const PTRMAP_ROOTPAGE = 1 +const P_tmpdir = "/tmp" +const PragFlg_NeedSchema = 1 +const PragFlg_NoColumns = 2 +const PragFlg_NoColumns1 = 4 +const PragFlg_ReadOnly = 8 +const PragFlg_Result0 = 16 +const PragFlg_Result1 = 32 +const PragFlg_SchemaOpt = 64 +const PragFlg_SchemaReq = 128 +const PragTyp_ACTIVATE_EXTENSIONS = 0 +const PragTyp_ANALYSIS_LIMIT = 1 +const PragTyp_AUTO_VACUUM = 3 +const PragTyp_BUSY_TIMEOUT = 5 +const PragTyp_CACHE_SIZE = 6 +const PragTyp_CACHE_SPILL = 7 +const PragTyp_CASE_SENSITIVE_LIKE = 8 +const PragTyp_COLLATION_LIST = 9 +const PragTyp_COMPILE_OPTIONS = 10 +const PragTyp_DATABASE_LIST = 12 +const PragTyp_DATA_STORE_DIRECTORY = 11 +const PragTyp_DEFAULT_CACHE_SIZE = 13 +const PragTyp_ENCODING = 14 +const PragTyp_FLAG = 4 +const PragTyp_FOREIGN_KEY_CHECK = 15 +const PragTyp_FOREIGN_KEY_LIST = 16 +const PragTyp_FUNCTION_LIST = 17 +const PragTyp_HARD_HEAP_LIMIT = 18 +const PragTyp_HEADER_VALUE = 2 +const PragTyp_INCREMENTAL_VACUUM = 19 +const PragTyp_INDEX_INFO = 20 +const PragTyp_INDEX_LIST = 21 +const PragTyp_INTEGRITY_CHECK = 22 +const PragTyp_JOURNAL_MODE = 23 +const PragTyp_JOURNAL_SIZE_LIMIT = 24 +const PragTyp_LOCKING_MODE = 26 +const PragTyp_LOCK_PROXY_FILE = 25 +const PragTyp_LOCK_STATUS = 44 +const PragTyp_MMAP_SIZE = 28 +const PragTyp_MODULE_LIST = 29 +const PragTyp_OPTIMIZE = 30 +const PragTyp_PAGE_COUNT = 27 +const PragTyp_PAGE_SIZE = 31 +const PragTyp_PRAGMA_LIST = 32 +const PragTyp_SECURE_DELETE = 33 +const PragTyp_SHRINK_MEMORY = 34 +const PragTyp_SOFT_HEAP_LIMIT = 35 +const PragTyp_STATS = 45 +const PragTyp_SYNCHRONOUS = 36 +const PragTyp_TABLE_INFO = 37 +const PragTyp_TABLE_LIST = 38 +const PragTyp_TEMP_STORE = 39 +const PragTyp_TEMP_STORE_DIRECTORY = 40 +const PragTyp_THREADS = 41 +const PragTyp_WAL_AUTOCHECKPOINT = 42 +const PragTyp_WAL_CHECKPOINT = 43 +const RAND_MAX = 2147483647 +const RBU_CREATE_STATE = "CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)" +const RBU_DELETE = 2 +const RBU_ENABLE_DELTA_CKSUM = 0 +const RBU_EXCLUSIVE_CHECKPOINT = "rbu_exclusive_checkpoint" +const RBU_IDX_DELETE = 4 +const RBU_IDX_INSERT = 5 +const RBU_INSERT = 1 +const RBU_PK_EXTERNAL = 3 +const RBU_PK_IPK = 2 +const RBU_PK_NONE = 1 +const RBU_PK_NOTABLE = 0 +const RBU_PK_VTAB = 5 +const RBU_PK_WITHOUT_ROWID = 4 +const RBU_REPLACE = 3 +const RBU_STAGE_CAPTURE = 3 +const RBU_STAGE_CKPT = 4 +const RBU_STAGE_DONE = 5 +const RBU_STAGE_MOVE = 2 +const RBU_STAGE_OAL = 1 +const RBU_STATE_CKPT = 6 +const RBU_STATE_COOKIE = 7 +const RBU_STATE_DATATBL = 10 +const RBU_STATE_IDX = 3 +const RBU_STATE_OALSZ = 8 +const RBU_STATE_PHASEONESTEP = 9 +const RBU_STATE_PROGRESS = 5 +const RBU_STATE_ROW = 4 +const RBU_STATE_STAGE = 1 +const RBU_STATE_TBL = 2 +const RBU_UPDATE = 6 +const RBU_ZIPVFS_CTRL_FILE_POINTER = 230439 +const READMARK_NOT_USED = 4294967295 +const READ_LOCK = 1 +const RESERVED_BYTE = 1 +const RESERVED_LOCK = 2 +const RNDAWAY = 0 +const RNDTOWARDS = 0 +const ROWSET_ALLOCATION_SIZE = 1024 +const ROWSET_ENTRY_PER_CHUNK = 1016 +const ROWSET_NEXT = 2 +const ROWSET_SORTED = 1 +const RTLD_DI_LINKMAP = 2 +const RTLD_GLOBAL = 256 +const RTLD_LAZY = 1 +const RTLD_LOCAL = 0 +const RTLD_NEXT = -1 +const RTLD_NODELETE = 4096 +const RTLD_NOLOAD = 4 +const RTLD_NOW = 2 +const RTREE_CACHE_SZ = 5 +const RTREE_CHECK_MAX_ERROR = 100 +const RTREE_COORD_INT32 = 1 +const RTREE_COORD_REAL32 = 0 +const RTREE_DEFAULT_ROWEST = 1048576 +const RTREE_EQ = 65 +const RTREE_FALSE = 64 +const RTREE_GE = 68 +const RTREE_GT = 69 +const RTREE_LE = 66 +const RTREE_LT = 67 +const RTREE_MATCH = 70 +const RTREE_MAXCELLS = 51 +const RTREE_MAX_AUX_COLUMN = 100 +const RTREE_MAX_DEPTH = 40 +const RTREE_MAX_DIMENSIONS = 5 +const RTREE_MIN_ROWEST = 100 +const RTREE_QUERY = 71 +const RTREE_TRUE = 63 +const RTREE_ZERO = 0 +const RWF_WRITE_LIFE_NOT_SET = 0 +const RWH_WRITE_LIFE_EXTREME = 5 +const RWH_WRITE_LIFE_LONG = 4 +const RWH_WRITE_LIFE_MEDIUM = 3 +const RWH_WRITE_LIFE_NONE = 1 +const RWH_WRITE_LIFE_SHORT = 2 +const R_OK = 4 +const SAVEPOINT_BEGIN = 0 +const SAVEPOINT_RELEASE = 1 +const SAVEPOINT_ROLLBACK = 2 +const SCHED_BATCH = 3 +const SCHED_DEADLINE = 6 +const SCHED_FIFO = 1 +const SCHED_IDLE = 5 +const SCHED_OTHER = 0 +const SCHED_RESET_ON_FORK = 1073741824 +const SCHED_RR = 2 +const SCHEMA_ROOT = 1 +const SEEK_DATA = 3 +const SEEK_HOLE = 4 +const SESSIONS_ROWID = "_rowid_" +const SESSIONS_STRM_CHUNK_SIZE = 1024 +const SESSION_MAX_BUFFER_SZ = 2147483391 +const SESSION_UPDATE_CACHE_SZ = 12 +const SF_Aggregate = 8 +const SF_All = 2 +const SF_ComplexResult = 262144 +const SF_Compound = 256 +const SF_Converted = 65536 +const SF_CopyCte = 67108864 +const SF_Distinct = 1 +const SF_Expanded = 64 +const SF_FixedLimit = 16384 +const SF_HasAgg = 16 +const SF_HasTypeInfo = 128 +const SF_IncludeHidden = 131072 +const SF_MaybeConvert = 32768 +const SF_MinMaxAgg = 4096 +const SF_MultiPart = 33554432 +const SF_MultiValue = 1024 +const SF_NestedFrom = 2048 +const SF_NoopOrderBy = 4194304 +const SF_OrderByReqd = 134217728 +const SF_PushDown = 16777216 +const SF_Recursive = 8192 +const SF_Resolved = 4 +const SF_UFSrcCheck = 8388608 +const SF_UpdateFrom = 268435456 +const SF_UsesEphemeral = 32 +const SF_Values = 512 +const SF_View = 2097152 +const SF_WhereBegin = 524288 +const SF_WinRewrite = 1048576 +const SHARED_FIRST = 2 +const SHARED_LOCK = 1 +const SHARED_SIZE = 510 +const SIOCADDDLCI = 35200 +const SIOCADDMULTI = 35121 +const SIOCADDRT = 35083 +const SIOCATMARK = 35077 +const SIOCDARP = 35155 +const SIOCDELDLCI = 35201 +const SIOCDELMULTI = 35122 +const SIOCDELRT = 35084 +const SIOCDEVPRIVATE = 35312 +const SIOCDIFADDR = 35126 +const SIOCDRARP = 35168 +const SIOCGARP = 35156 +const SIOCGIFADDR = 35093 +const SIOCGIFBR = 35136 +const SIOCGIFBRDADDR = 35097 +const SIOCGIFCONF = 35090 +const SIOCGIFCOUNT = 35128 +const SIOCGIFDSTADDR = 35095 +const SIOCGIFENCAP = 35109 +const SIOCGIFFLAGS = 35091 +const SIOCGIFHWADDR = 35111 +const SIOCGIFINDEX = 35123 +const SIOCGIFMAP = 35184 +const SIOCGIFMEM = 35103 +const SIOCGIFMETRIC = 35101 +const SIOCGIFMTU = 35105 +const SIOCGIFNAME = 35088 +const SIOCGIFNETMASK = 35099 +const SIOCGIFPFLAGS = 35125 +const SIOCGIFSLAVE = 35113 +const SIOCGIFTXQLEN = 35138 +const SIOCGPGRP = 35076 +const SIOCGRARP = 35169 +const SIOCGSTAMP = 35078 +const SIOCGSTAMPNS = 35079 +const SIOCPROTOPRIVATE = 35296 +const SIOCRTMSG = 35085 +const SIOCSARP = 35157 +const SIOCSIFADDR = 35094 +const SIOCSIFBR = 35137 +const SIOCSIFBRDADDR = 35098 +const SIOCSIFDSTADDR = 35096 +const SIOCSIFENCAP = 35110 +const SIOCSIFFLAGS = 35092 +const SIOCSIFHWADDR = 35108 +const SIOCSIFHWBROADCAST = 35127 +const SIOCSIFLINK = 35089 +const SIOCSIFMAP = 35185 +const SIOCSIFMEM = 35104 +const SIOCSIFMETRIC = 35102 +const SIOCSIFMTU = 35106 +const SIOCSIFNAME = 35107 +const SIOCSIFNETMASK = 35100 +const SIOCSIFPFLAGS = 35124 +const SIOCSIFSLAVE = 35120 +const SIOCSIFTXQLEN = 35139 +const SIOCSPGRP = 35074 +const SIOCSRARP = 35170 +const SIOGIFINDEX = 35123 +const SLOT_2_0 = 2080895 +const SLOT_4_2_0 = 4028612735 +const SORTER_MAX_MERGE_COUNT = 16 +const SORTER_TYPE_INTEGER = 1 +const SORTER_TYPE_TEXT = 2 +const SORTFLAG_UseSorter = 1 +const SPILLFLAG_NOSYNC = 4 +const SPILLFLAG_OFF = 1 +const SPILLFLAG_ROLLBACK = 2 +const SPLICE_F_GIFT = 8 +const SPLICE_F_MORE = 4 +const SPLICE_F_MOVE = 1 +const SPLICE_F_NONBLOCK = 2 +const SQLITE3_TEXT = 3 +const SQLITE_ABORT = 4 +const SQLITE_ABORT_ROLLBACK = 516 +const SQLITE_ACCESS_EXISTS = 0 +const SQLITE_ACCESS_READ = 2 +const SQLITE_ACCESS_READWRITE = 1 +const SQLITE_AFF_BLOB = 65 +const SQLITE_AFF_FLEXNUM = 70 +const SQLITE_AFF_INTEGER = 68 +const SQLITE_AFF_MASK = 71 +const SQLITE_AFF_NONE = 64 +const SQLITE_AFF_NUMERIC = 67 +const SQLITE_AFF_REAL = 69 +const SQLITE_AFF_TEXT = 66 +const SQLITE_ALLOW_COVERING_INDEX_SCAN = 1 +const SQLITE_ALTER_TABLE = 26 +const SQLITE_AMALGAMATION = 1 +const SQLITE_ANALYZE = 28 +const SQLITE_ANY = 5 +const SQLITE_ASCII = 1 +const SQLITE_ATOMIC_INTRINSICS = 1 +const SQLITE_ATTACH = 24 +const SQLITE_AUTH = 23 +const SQLITE_AUTH_USER = 279 +const SQLITE_AllOpts = 4294967295 +const SQLITE_AutoIndex = 32768 +const SQLITE_BIGENDIAN = 0 +const SQLITE_BIG_DBL = 1e+99 +const SQLITE_BLDF1_INDEXED = 1 +const SQLITE_BLDF1_UNIQUE = 2 +const SQLITE_BLDF2_2NDPASS = 4 +const SQLITE_BLOB = 4 +const SQLITE_BUSY = 5 +const SQLITE_BUSY_RECOVERY = 261 +const SQLITE_BUSY_SNAPSHOT = 517 +const SQLITE_BUSY_TIMEOUT = 773 +const SQLITE_BYTEORDER = 1234 +const SQLITE_BalancedMerge = 2097152 +const SQLITE_BloomFilter = 524288 +const SQLITE_BloomPulldown = 1048576 +const SQLITE_CANTOPEN = 14 +const SQLITE_CANTOPEN_BKPT = 0 +const SQLITE_CANTOPEN_CONVPATH = 1038 +const SQLITE_CANTOPEN_DIRTYWAL = 1294 +const SQLITE_CANTOPEN_FULLPATH = 782 +const SQLITE_CANTOPEN_ISDIR = 526 +const SQLITE_CANTOPEN_NOTEMPDIR = 270 +const SQLITE_CANTOPEN_SYMLINK = 1550 +const SQLITE_CHANGESETAPPLY_FKNOACTION = 8 +const SQLITE_CHANGESETAPPLY_IGNORENOOP = 4 +const SQLITE_CHANGESETAPPLY_INVERT = 2 +const SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 1 +const SQLITE_CHANGESETSTART_INVERT = 2 +const SQLITE_CHANGESET_ABORT = 2 +const SQLITE_CHANGESET_CONFLICT = 3 +const SQLITE_CHANGESET_CONSTRAINT = 4 +const SQLITE_CHANGESET_DATA = 1 +const SQLITE_CHANGESET_FOREIGN_KEY = 5 +const SQLITE_CHANGESET_NOTFOUND = 2 +const SQLITE_CHANGESET_OMIT = 0 +const SQLITE_CHANGESET_REPLACE = 1 +const SQLITE_CHECKPOINT_FULL = 1 +const SQLITE_CHECKPOINT_PASSIVE = 0 +const SQLITE_CHECKPOINT_RESTART = 2 +const SQLITE_CHECKPOINT_TRUNCATE = 3 +const SQLITE_CONFIG_COVERING_INDEX_SCAN = 20 +const SQLITE_CONFIG_GETMALLOC = 5 +const SQLITE_CONFIG_GETMUTEX = 11 +const SQLITE_CONFIG_GETPCACHE = 15 +const SQLITE_CONFIG_GETPCACHE2 = 19 +const SQLITE_CONFIG_HEAP = 8 +const SQLITE_CONFIG_LOG = 16 +const SQLITE_CONFIG_LOOKASIDE = 13 +const SQLITE_CONFIG_MALLOC = 4 +const SQLITE_CONFIG_MEMDB_MAXSIZE = 29 +const SQLITE_CONFIG_MEMSTATUS = 9 +const SQLITE_CONFIG_MMAP_SIZE = 22 +const SQLITE_CONFIG_MULTITHREAD = 2 +const SQLITE_CONFIG_MUTEX = 10 +const SQLITE_CONFIG_PAGECACHE = 7 +const SQLITE_CONFIG_PCACHE = 14 +const SQLITE_CONFIG_PCACHE2 = 18 +const SQLITE_CONFIG_PCACHE_HDRSZ = 24 +const SQLITE_CONFIG_PMASZ = 25 +const SQLITE_CONFIG_ROWID_IN_VIEW = 30 +const SQLITE_CONFIG_SCRATCH = 6 +const SQLITE_CONFIG_SERIALIZED = 3 +const SQLITE_CONFIG_SINGLETHREAD = 1 +const SQLITE_CONFIG_SMALL_MALLOC = 27 +const SQLITE_CONFIG_SORTERREF_SIZE = 28 +const SQLITE_CONFIG_SQLLOG = 21 +const SQLITE_CONFIG_STMTJRNL_SPILL = 26 +const SQLITE_CONFIG_URI = 17 +const SQLITE_CONFIG_WIN32_HEAPSIZE = 23 +const SQLITE_CONSTRAINT = 19 +const SQLITE_CONSTRAINT_CHECK = 275 +const SQLITE_CONSTRAINT_COMMITHOOK = 531 +const SQLITE_CONSTRAINT_DATATYPE = 3091 +const SQLITE_CONSTRAINT_FOREIGNKEY = 787 +const SQLITE_CONSTRAINT_FUNCTION = 1043 +const SQLITE_CONSTRAINT_NOTNULL = 1299 +const SQLITE_CONSTRAINT_PINNED = 2835 +const SQLITE_CONSTRAINT_PRIMARYKEY = 1555 +const SQLITE_CONSTRAINT_ROWID = 2579 +const SQLITE_CONSTRAINT_TRIGGER = 1811 +const SQLITE_CONSTRAINT_UNIQUE = 2067 +const SQLITE_CONSTRAINT_VTAB = 2323 +const SQLITE_COPY = 0 +const SQLITE_CORE = 1 +const SQLITE_CORRUPT = 11 +const SQLITE_CORRUPT_BKPT = 0 +const SQLITE_CORRUPT_INDEX = 779 +const SQLITE_CORRUPT_SEQUENCE = 523 +const SQLITE_CORRUPT_VTAB = 267 +const SQLITE_CREATE_INDEX = 1 +const SQLITE_CREATE_TABLE = 2 +const SQLITE_CREATE_TEMP_INDEX = 3 +const SQLITE_CREATE_TEMP_TABLE = 4 +const SQLITE_CREATE_TEMP_TRIGGER = 5 +const SQLITE_CREATE_TEMP_VIEW = 6 +const SQLITE_CREATE_TRIGGER = 7 +const SQLITE_CREATE_VIEW = 8 +const SQLITE_CREATE_VTABLE = 29 +const SQLITE_CacheSpill = 32 +const SQLITE_CellSizeCk = 2097152 +const SQLITE_CkptFullFSync = 16 +const SQLITE_Coroutines = 33554432 +const SQLITE_CountOfView = 512 +const SQLITE_CoverIdxScan = 32 +const SQLITE_CursorHints = 1024 +const SQLITE_DBCONFIG_DEFENSIVE = 1010 +const SQLITE_DBCONFIG_DQS_DDL = 1014 +const SQLITE_DBCONFIG_DQS_DML = 1013 +const SQLITE_DBCONFIG_ENABLE_FKEY = 1002 +const SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004 +const SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005 +const SQLITE_DBCONFIG_ENABLE_QPSG = 1007 +const SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003 +const SQLITE_DBCONFIG_ENABLE_VIEW = 1015 +const SQLITE_DBCONFIG_LEGACY_ALTER_TABLE = 1012 +const SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016 +const SQLITE_DBCONFIG_LOOKASIDE = 1001 +const SQLITE_DBCONFIG_MAINDBNAME = 1000 +const SQLITE_DBCONFIG_MAX = 1019 +const SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE = 1006 +const SQLITE_DBCONFIG_RESET_DATABASE = 1009 +const SQLITE_DBCONFIG_REVERSE_SCANORDER = 1019 +const SQLITE_DBCONFIG_STMT_SCANSTATUS = 1018 +const SQLITE_DBCONFIG_TRIGGER_EQP = 1008 +const SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017 +const SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011 +const SQLITE_DBSTATUS_CACHE_HIT = 7 +const SQLITE_DBSTATUS_CACHE_MISS = 8 +const SQLITE_DBSTATUS_CACHE_SPILL = 12 +const SQLITE_DBSTATUS_CACHE_USED = 1 +const SQLITE_DBSTATUS_CACHE_USED_SHARED = 11 +const SQLITE_DBSTATUS_CACHE_WRITE = 9 +const SQLITE_DBSTATUS_DEFERRED_FKS = 10 +const SQLITE_DBSTATUS_LOOKASIDE_HIT = 4 +const SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6 +const SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5 +const SQLITE_DBSTATUS_LOOKASIDE_USED = 0 +const SQLITE_DBSTATUS_MAX = 12 +const SQLITE_DBSTATUS_SCHEMA_USED = 2 +const SQLITE_DBSTATUS_STMT_USED = 3 +const SQLITE_DEFAULT_AUTOVACUUM = 0 +const SQLITE_DEFAULT_CACHE_SIZE = -2000 +const SQLITE_DEFAULT_FILE_FORMAT = 4 +const SQLITE_DEFAULT_FILE_PERMISSIONS = 420 +const SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT = -1 +const SQLITE_DEFAULT_LOOKASIDE = 40 +const SQLITE_DEFAULT_MEMSTATUS = 0 +const SQLITE_DEFAULT_MMAP_SIZE = 0 +const SQLITE_DEFAULT_PAGE_SIZE = 4096 +const SQLITE_DEFAULT_PCACHE_INITSZ = 20 +const SQLITE_DEFAULT_PROXYDIR_PERMISSIONS = 493 +const SQLITE_DEFAULT_RECURSIVE_TRIGGERS = 0 +const SQLITE_DEFAULT_SECTOR_SIZE = 4096 +const SQLITE_DEFAULT_SORTERREF_SIZE = 2147483647 +const SQLITE_DEFAULT_SYNCHRONOUS = 2 +const SQLITE_DEFAULT_WAL_AUTOCHECKPOINT = 1000 +const SQLITE_DEFAULT_WAL_SYNCHRONOUS = 2 +const SQLITE_DEFAULT_WORKER_THREADS = 0 +const SQLITE_DELETE = 9 +const SQLITE_DENY = 1 +const SQLITE_DESERIALIZE_FREEONCLOSE = 1 +const SQLITE_DESERIALIZE_READONLY = 4 +const SQLITE_DESERIALIZE_RESIZEABLE = 2 +const SQLITE_DETACH = 25 +const SQLITE_DETERMINISTIC = 2048 +const SQLITE_DIRECTONLY = 524288 +const SQLITE_DIRECT_OVERFLOW_READ = 1 +const SQLITE_DONE = 101 +const SQLITE_DQS = 3 +const SQLITE_DROP_INDEX = 10 +const SQLITE_DROP_TABLE = 11 +const SQLITE_DROP_TEMP_INDEX = 12 +const SQLITE_DROP_TEMP_TABLE = 13 +const SQLITE_DROP_TEMP_TRIGGER = 14 +const SQLITE_DROP_TEMP_VIEW = 15 +const SQLITE_DROP_TRIGGER = 16 +const SQLITE_DROP_VIEW = 17 +const SQLITE_DROP_VTABLE = 30 +const SQLITE_Defensive = 268435456 +const SQLITE_DeferFKs = 524288 +const SQLITE_DistinctOpt = 16 +const SQLITE_DqsDDL = 536870912 +const SQLITE_DqsDML = 1073741824 +const SQLITE_ECEL_DUP = 1 +const SQLITE_ECEL_FACTOR = 2 +const SQLITE_ECEL_OMITREF = 8 +const SQLITE_ECEL_REF = 4 +const SQLITE_EMPTY = 16 +const SQLITE_ENABLE_COLUMN_METADATA = 1 +const SQLITE_ENABLE_DBSTAT_VTAB = 1 +const SQLITE_ENABLE_FTS5 = 1 +const SQLITE_ENABLE_GEOPOLY = 1 +const SQLITE_ENABLE_JSON1 = 1 +const SQLITE_ENABLE_LOCKING_STYLE = 0 +const SQLITE_ENABLE_MATH_FUNCTIONS = 1 +const SQLITE_ENABLE_MEMORY_MANAGEMENT = 1 +const SQLITE_ENABLE_OFFSET_SQL_FUNC = 1 +const SQLITE_ENABLE_PREUPDATE_HOOK = 1 +const SQLITE_ENABLE_RBU = 1 +const SQLITE_ENABLE_RTREE = 1 +const SQLITE_ENABLE_SESSION = 1 +const SQLITE_ENABLE_SNAPSHOT = 1 +const SQLITE_ENABLE_STAT4 = 1 +const SQLITE_ENABLE_UNLOCK_NOTIFY = 1 +const SQLITE_ERROR = 1 +const SQLITE_ERROR_MISSING_COLLSEQ = 257 +const SQLITE_ERROR_RETRY = 513 +const SQLITE_ERROR_SNAPSHOT = 769 +const SQLITE_EXTERN = 0 +const SQLITE_EnableQPSG = 8388608 +const SQLITE_EnableTrigger = 262144 +const SQLITE_EnableView = 2147483648 +const SQLITE_FAIL = 3 +const SQLITE_FAULTINJECTOR_COUNT = 1 +const SQLITE_FAULTINJECTOR_MALLOC = 0 +const SQLITE_FCNTL_BEGIN_ATOMIC_WRITE = 31 +const SQLITE_FCNTL_BUSYHANDLER = 15 +const SQLITE_FCNTL_CHUNK_SIZE = 6 +const SQLITE_FCNTL_CKPT_DONE = 37 +const SQLITE_FCNTL_CKPT_START = 39 +const SQLITE_FCNTL_CKSM_FILE = 41 +const SQLITE_FCNTL_COMMIT_ATOMIC_WRITE = 32 +const SQLITE_FCNTL_COMMIT_PHASETWO = 22 +const SQLITE_FCNTL_DATA_VERSION = 35 +const SQLITE_FCNTL_DB_UNCHANGED = 3389603744 +const SQLITE_FCNTL_EXTERNAL_READER = 40 +const SQLITE_FCNTL_FILE_POINTER = 7 +const SQLITE_FCNTL_GET_LOCKPROXYFILE = 2 +const SQLITE_FCNTL_HAS_MOVED = 20 +const SQLITE_FCNTL_JOURNAL_POINTER = 28 +const SQLITE_FCNTL_LAST_ERRNO = 4 +const SQLITE_FCNTL_LOCKSTATE = 1 +const SQLITE_FCNTL_LOCK_TIMEOUT = 34 +const SQLITE_FCNTL_MMAP_SIZE = 18 +const SQLITE_FCNTL_OVERWRITE = 11 +const SQLITE_FCNTL_PDB = 30 +const SQLITE_FCNTL_PERSIST_WAL = 10 +const SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13 +const SQLITE_FCNTL_PRAGMA = 14 +const SQLITE_FCNTL_RBU = 26 +const SQLITE_FCNTL_RBUCNT = 5149216 +const SQLITE_FCNTL_RESERVE_BYTES = 38 +const SQLITE_FCNTL_RESET_CACHE = 42 +const SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE = 33 +const SQLITE_FCNTL_SET_LOCKPROXYFILE = 3 +const SQLITE_FCNTL_SIZE_HINT = 5 +const SQLITE_FCNTL_SIZE_LIMIT = 36 +const SQLITE_FCNTL_SYNC = 21 +const SQLITE_FCNTL_SYNC_OMITTED = 8 +const SQLITE_FCNTL_TEMPFILENAME = 16 +const SQLITE_FCNTL_TRACE = 19 +const SQLITE_FCNTL_VFSNAME = 12 +const SQLITE_FCNTL_VFS_POINTER = 27 +const SQLITE_FCNTL_WAL_BLOCK = 24 +const SQLITE_FCNTL_WIN32_AV_RETRY = 9 +const SQLITE_FCNTL_WIN32_GET_HANDLE = 29 +const SQLITE_FCNTL_WIN32_SET_HANDLE = 23 +const SQLITE_FCNTL_ZIPVFS = 25 +const SQLITE_FILE_HEADER = "SQLite format 3" +const SQLITE_FLOAT = 2 +const SQLITE_FORMAT = 24 +const SQLITE_FP_PRECISION_LIMIT = 100000000 +const SQLITE_FRAME_MAGIC = 2275391262 +const SQLITE_FSFLAGS_IS_MSDOS = 1 +const SQLITE_FTS5_MAX_EXPR_DEPTH = 256 +const SQLITE_FULL = 13 +const SQLITE_FUNCTION = 31 +const SQLITE_FUNC_ANYORDER = 134217728 +const SQLITE_FUNC_BUILTIN = 8388608 +const SQLITE_FUNC_BYTELEN = 192 +const SQLITE_FUNC_CASE = 8 +const SQLITE_FUNC_CONSTANT = 2048 +const SQLITE_FUNC_COUNT = 256 +const SQLITE_FUNC_DIRECT = 524288 +const SQLITE_FUNC_ENCMASK = 3 +const SQLITE_FUNC_EPHEM = 16 +const SQLITE_FUNC_HASH_SZ = 23 +const SQLITE_FUNC_INLINE = 4194304 +const SQLITE_FUNC_INTERNAL = 262144 +const SQLITE_FUNC_LENGTH = 64 +const SQLITE_FUNC_LIKE = 4 +const SQLITE_FUNC_MINMAX = 4096 +const SQLITE_FUNC_NEEDCOLL = 32 +const SQLITE_FUNC_RUNONLY = 32768 +const SQLITE_FUNC_SLOCHNG = 8192 +const SQLITE_FUNC_TEST = 16384 +const SQLITE_FUNC_TYPEOF = 128 +const SQLITE_FUNC_UNLIKELY = 1024 +const SQLITE_FUNC_UNSAFE = 2097152 +const SQLITE_FUNC_WINDOW = 65536 +const SQLITE_FactorOutConst = 8 +const SQLITE_FlttnUnionAll = 8388608 +const SQLITE_ForeignKeys = 16384 +const SQLITE_Fts3Tokenizer = 4194304 +const SQLITE_FullColNames = 4 +const SQLITE_FullFSync = 8 +const SQLITE_GET_LOCKPROXYFILE = 2 +const SQLITE_GroupByOrder = 4 +const SQLITE_HAVE_C99_MATH_FUNCS = 1 +const SQLITE_HAVE_ZLIB = 1 +const SQLITE_IDXTYPE_APPDEF = 0 +const SQLITE_IDXTYPE_IPK = 3 +const SQLITE_IDXTYPE_PRIMARYKEY = 2 +const SQLITE_IDXTYPE_UNIQUE = 1 +const SQLITE_IGNORE = 2 +const SQLITE_INDEX_CONSTRAINT_EQ = 2 +const SQLITE_INDEX_CONSTRAINT_FUNCTION = 150 +const SQLITE_INDEX_CONSTRAINT_GE = 32 +const SQLITE_INDEX_CONSTRAINT_GLOB = 66 +const SQLITE_INDEX_CONSTRAINT_GT = 4 +const SQLITE_INDEX_CONSTRAINT_IS = 72 +const SQLITE_INDEX_CONSTRAINT_ISNOT = 69 +const SQLITE_INDEX_CONSTRAINT_ISNOTNULL = 70 +const SQLITE_INDEX_CONSTRAINT_ISNULL = 71 +const SQLITE_INDEX_CONSTRAINT_LE = 8 +const SQLITE_INDEX_CONSTRAINT_LIKE = 65 +const SQLITE_INDEX_CONSTRAINT_LIMIT = 73 +const SQLITE_INDEX_CONSTRAINT_LT = 16 +const SQLITE_INDEX_CONSTRAINT_MATCH = 64 +const SQLITE_INDEX_CONSTRAINT_NE = 68 +const SQLITE_INDEX_CONSTRAINT_OFFSET = 74 +const SQLITE_INDEX_CONSTRAINT_REGEXP = 67 +const SQLITE_INDEX_SCAN_UNIQUE = 1 +const SQLITE_INNOCUOUS = 2097152 +const SQLITE_INSERT = 18 +const SQLITE_INTEGER = 1 +const SQLITE_INTEGRITY_CHECK_ERROR_MAX = 100 +const SQLITE_INTERNAL = 2 +const SQLITE_INTERRUPT = 9 +const SQLITE_IOCAP_ATOMIC = 1 +const SQLITE_IOCAP_ATOMIC16K = 64 +const SQLITE_IOCAP_ATOMIC1K = 4 +const SQLITE_IOCAP_ATOMIC2K = 8 +const SQLITE_IOCAP_ATOMIC32K = 128 +const SQLITE_IOCAP_ATOMIC4K = 16 +const SQLITE_IOCAP_ATOMIC512 = 2 +const SQLITE_IOCAP_ATOMIC64K = 256 +const SQLITE_IOCAP_ATOMIC8K = 32 +const SQLITE_IOCAP_BATCH_ATOMIC = 16384 +const SQLITE_IOCAP_IMMUTABLE = 8192 +const SQLITE_IOCAP_POWERSAFE_OVERWRITE = 4096 +const SQLITE_IOCAP_SAFE_APPEND = 512 +const SQLITE_IOCAP_SEQUENTIAL = 1024 +const SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 2048 +const SQLITE_IOERR = 10 +const SQLITE_IOERR_ACCESS = 3338 +const SQLITE_IOERR_AUTH = 7178 +const SQLITE_IOERR_BEGIN_ATOMIC = 7434 +const SQLITE_IOERR_BLOCKED = 2826 +const SQLITE_IOERR_CHECKRESERVEDLOCK = 3594 +const SQLITE_IOERR_CLOSE = 4106 +const SQLITE_IOERR_COMMIT_ATOMIC = 7690 +const SQLITE_IOERR_CONVPATH = 6666 +const SQLITE_IOERR_CORRUPTFS = 8458 +const SQLITE_IOERR_DATA = 8202 +const SQLITE_IOERR_DELETE = 2570 +const SQLITE_IOERR_DELETE_NOENT = 5898 +const SQLITE_IOERR_DIR_CLOSE = 4362 +const SQLITE_IOERR_DIR_FSYNC = 1290 +const SQLITE_IOERR_FSTAT = 1802 +const SQLITE_IOERR_FSYNC = 1034 +const SQLITE_IOERR_GETTEMPPATH = 6410 +const SQLITE_IOERR_IN_PAGE = 8714 +const SQLITE_IOERR_LOCK = 3850 +const SQLITE_IOERR_MMAP = 6154 +const SQLITE_IOERR_NOMEM = 3082 +const SQLITE_IOERR_NOMEM_BKPT = 3082 +const SQLITE_IOERR_RDLOCK = 2314 +const SQLITE_IOERR_READ = 266 +const SQLITE_IOERR_ROLLBACK_ATOMIC = 7946 +const SQLITE_IOERR_SEEK = 5642 +const SQLITE_IOERR_SHMLOCK = 5130 +const SQLITE_IOERR_SHMMAP = 5386 +const SQLITE_IOERR_SHMOPEN = 4618 +const SQLITE_IOERR_SHMSIZE = 4874 +const SQLITE_IOERR_SHORT_READ = 522 +const SQLITE_IOERR_TRUNCATE = 1546 +const SQLITE_IOERR_UNLOCK = 2058 +const SQLITE_IOERR_VNODE = 6922 +const SQLITE_IOERR_WRITE = 778 +const SQLITE_IgnoreChecks = 512 +const SQLITE_IndexedExpr = 16777216 +const SQLITE_JUMPIFNULL = 16 +const SQLITE_LAST_ERRNO = 4 +const SQLITE_LIKE_DOESNT_MATCH_BLOBS = 1 +const SQLITE_LIMIT_ATTACHED = 7 +const SQLITE_LIMIT_COLUMN = 2 +const SQLITE_LIMIT_COMPOUND_SELECT = 4 +const SQLITE_LIMIT_EXPR_DEPTH = 3 +const SQLITE_LIMIT_FUNCTION_ARG = 6 +const SQLITE_LIMIT_LENGTH = 0 +const SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8 +const SQLITE_LIMIT_SQL_LENGTH = 1 +const SQLITE_LIMIT_TRIGGER_DEPTH = 10 +const SQLITE_LIMIT_VARIABLE_NUMBER = 9 +const SQLITE_LIMIT_VDBE_OP = 5 +const SQLITE_LIMIT_WORKER_THREADS = 11 +const SQLITE_LITTLEENDIAN = 1 +const SQLITE_LOCKED = 6 +const SQLITE_LOCKED_SHAREDCACHE = 262 +const SQLITE_LOCKED_VTAB = 518 +const SQLITE_LOCK_EXCLUSIVE = 4 +const SQLITE_LOCK_NONE = 0 +const SQLITE_LOCK_PENDING = 3 +const SQLITE_LOCK_RESERVED = 2 +const SQLITE_LOCK_SHARED = 1 +const SQLITE_LegacyAlter = 67108864 +const SQLITE_LegacyFileFmt = 2 +const SQLITE_LoadExtFunc = 131072 +const SQLITE_LoadExtension = 65536 +const SQLITE_MALLOC_SOFT_LIMIT = 1024 +const SQLITE_MATCH = 0 +const SQLITE_MAX_ALLOCATION_SIZE = 2147483391 +const SQLITE_MAX_ATTACHED = 10 +const SQLITE_MAX_COLUMN = 2000 +const SQLITE_MAX_COMPOUND_SELECT = 500 +const SQLITE_MAX_DB = 12 +const SQLITE_MAX_DEFAULT_PAGE_SIZE = 8192 +const SQLITE_MAX_EXPR_DEPTH = 1000 +const SQLITE_MAX_FILE_FORMAT = 4 +const SQLITE_MAX_FUNCTION_ARG = 127 +const SQLITE_MAX_LENGTH = 1000000000 +const SQLITE_MAX_LIKE_PATTERN_LENGTH = 50000 +const SQLITE_MAX_MEMORY = 0 +const SQLITE_MAX_MMAP_SIZE = 2147418112 +const SQLITE_MAX_PAGE_COUNT = 4294967294 +const SQLITE_MAX_PAGE_SIZE = 65536 +const SQLITE_MAX_PATHLEN = 4096 +const SQLITE_MAX_PMASZ = 536870912 +const SQLITE_MAX_PREPARE_RETRY = 25 +const SQLITE_MAX_SCHEMA_RETRY = 50 +const SQLITE_MAX_SQL_LENGTH = 1000000000 +const SQLITE_MAX_SRCLIST = 200 +const SQLITE_MAX_SYMLINK = 200 +const SQLITE_MAX_SYMLINKS = 100 +const SQLITE_MAX_TRIGGER_DEPTH = 1000 +const SQLITE_MAX_VARIABLE_NUMBER = 32766 +const SQLITE_MAX_VDBE_OP = 250000000 +const SQLITE_MAX_WORKER_THREADS = 8 +const SQLITE_MEMDB_DEFAULT_MAXSIZE = 1073741824 +const SQLITE_MINIMUM_FILE_DESCRIPTOR = 3 +const SQLITE_MISMATCH = 20 +const SQLITE_MISUSE = 21 +const SQLITE_MISUSE_BKPT = 0 +const SQLITE_MUTEX_FAST = 0 +const SQLITE_MUTEX_NREF = 0 +const SQLITE_MUTEX_RECURSIVE = 1 +const SQLITE_MUTEX_STATIC_APP1 = 8 +const SQLITE_MUTEX_STATIC_APP2 = 9 +const SQLITE_MUTEX_STATIC_APP3 = 10 +const SQLITE_MUTEX_STATIC_LRU = 6 +const SQLITE_MUTEX_STATIC_LRU2 = 7 +const SQLITE_MUTEX_STATIC_MAIN = 2 +const SQLITE_MUTEX_STATIC_MASTER = 2 +const SQLITE_MUTEX_STATIC_MEM = 3 +const SQLITE_MUTEX_STATIC_MEM2 = 4 +const SQLITE_MUTEX_STATIC_OPEN = 4 +const SQLITE_MUTEX_STATIC_PMEM = 7 +const SQLITE_MUTEX_STATIC_PRNG = 5 +const SQLITE_MUTEX_STATIC_TEMPDIR = 11 +const SQLITE_MUTEX_STATIC_VFS1 = 11 +const SQLITE_MUTEX_STATIC_VFS2 = 12 +const SQLITE_MUTEX_STATIC_VFS3 = 13 +const SQLITE_MX_JUMP_OPCODE = 64 +const SQLITE_MinMaxOpt = 65536 +const SQLITE_NOLFS = 22 +const SQLITE_NOMATCH = 1 +const SQLITE_NOMEM = 7 +const SQLITE_NOMEM_BKPT = 7 +const SQLITE_NOTADB = 26 +const SQLITE_NOTFOUND = 12 +const SQLITE_NOTICE = 27 +const SQLITE_NOTICE_RBU = 795 +const SQLITE_NOTICE_RECOVER_ROLLBACK = 539 +const SQLITE_NOTICE_RECOVER_WAL = 283 +const SQLITE_NOTNULL = 144 +const SQLITE_NOWILDCARDMATCH = 2 +const SQLITE_NTUNE = 6 +const SQLITE_NULL = 5 +const SQLITE_NULLEQ = 128 +const SQLITE_N_BTREE_META = 16 +const SQLITE_N_KEYWORD = 147 +const SQLITE_N_LIMIT = 12 +const SQLITE_N_STDTYPE = 6 +const SQLITE_NoCkptOnClose = 2048 +const SQLITE_NoSchemaError = 134217728 +const SQLITE_NullCallback = 256 +const SQLITE_NullUnusedCols = 67108864 +const SQLITE_OK = 0 +const SQLITE_OK_LOAD_PERMANENTLY = 256 +const SQLITE_OK_SYMLINK = 512 +const SQLITE_OPEN_AUTOPROXY = 32 +const SQLITE_OPEN_CREATE = 4 +const SQLITE_OPEN_DELETEONCLOSE = 8 +const SQLITE_OPEN_EXCLUSIVE = 16 +const SQLITE_OPEN_EXRESCODE = 33554432 +const SQLITE_OPEN_FULLMUTEX = 65536 +const SQLITE_OPEN_MAIN_DB = 256 +const SQLITE_OPEN_MAIN_JOURNAL = 2048 +const SQLITE_OPEN_MASTER_JOURNAL = 16384 +const SQLITE_OPEN_MEMORY = 128 +const SQLITE_OPEN_NOFOLLOW = 16777216 +const SQLITE_OPEN_NOMUTEX = 32768 +const SQLITE_OPEN_PRIVATECACHE = 262144 +const SQLITE_OPEN_READONLY = 1 +const SQLITE_OPEN_READWRITE = 2 +const SQLITE_OPEN_SHAREDCACHE = 131072 +const SQLITE_OPEN_SUBJOURNAL = 8192 +const SQLITE_OPEN_SUPER_JOURNAL = 16384 +const SQLITE_OPEN_TEMP_DB = 512 +const SQLITE_OPEN_TEMP_JOURNAL = 4096 +const SQLITE_OPEN_TRANSIENT_DB = 1024 +const SQLITE_OPEN_URI = 64 +const SQLITE_OPEN_WAL = 524288 +const SQLITE_OS_UNIX = 1 +const SQLITE_OmitNoopJoin = 256 +const SQLITE_OmitOrderBy = 262144 +const SQLITE_OnePass = 134217728 +const SQLITE_OrderByIdxJoin = 64 +const SQLITE_PERM = 3 +const SQLITE_POWERSAFE_OVERWRITE = 1 +const SQLITE_PRAGMA = 19 +const SQLITE_PREPARE_MASK = 15 +const SQLITE_PREPARE_NORMALIZE = 2 +const SQLITE_PREPARE_NO_VTAB = 4 +const SQLITE_PREPARE_PERSISTENT = 1 +const SQLITE_PREPARE_SAVESQL = 128 +const SQLITE_PRINTF_INTERNAL = 1 +const SQLITE_PRINTF_MALLOCED = 4 +const SQLITE_PRINTF_SQLFUNC = 2 +const SQLITE_PRINT_BUF_SIZE = 70 +const SQLITE_PRIVATE = 0 +const SQLITE_PROTOCOL = 15 +const SQLITE_PTRSIZE = 8 +const SQLITE_PropagateConst = 32768 +const SQLITE_PushDown = 4096 +const SQLITE_QUERY_PLANNER_LIMIT = 20000 +const SQLITE_QUERY_PLANNER_LIMIT_INCR = 1000 +const SQLITE_QueryFlattener = 1 +const SQLITE_QueryOnly = 1048576 +const SQLITE_RANGE = 25 +const SQLITE_RBU_STATE_CHECKPOINT = 3 +const SQLITE_RBU_STATE_DONE = 4 +const SQLITE_RBU_STATE_ERROR = 5 +const SQLITE_RBU_STATE_MOVE = 2 +const SQLITE_RBU_STATE_OAL = 1 +const SQLITE_RBU_UPDATE_CACHESIZE = 16 +const SQLITE_READ = 20 +const SQLITE_READONLY = 8 +const SQLITE_READONLY_CANTINIT = 1288 +const SQLITE_READONLY_CANTLOCK = 520 +const SQLITE_READONLY_DBMOVED = 1032 +const SQLITE_READONLY_DIRECTORY = 1544 +const SQLITE_READONLY_RECOVERY = 264 +const SQLITE_READONLY_ROLLBACK = 776 +const SQLITE_RECURSIVE = 33 +const SQLITE_REINDEX = 27 +const SQLITE_REPLACE = 5 +const SQLITE_RESULT_SUBTYPE = 16777216 +const SQLITE_ROLLBACK = 1 +const SQLITE_ROW = 100 +const SQLITE_RecTriggers = 8192 +const SQLITE_ReleaseReg = 4194304 +const SQLITE_ResetDatabase = 33554432 +const SQLITE_ReverseOrder = 4096 +const SQLITE_SAVEPOINT = 32 +const SQLITE_SCANSTAT_COMPLEX = 1 +const SQLITE_SCANSTAT_EST = 2 +const SQLITE_SCANSTAT_EXPLAIN = 4 +const SQLITE_SCANSTAT_NAME = 3 +const SQLITE_SCANSTAT_NCYCLE = 7 +const SQLITE_SCANSTAT_NLOOP = 0 +const SQLITE_SCANSTAT_NVISIT = 1 +const SQLITE_SCANSTAT_PARENTID = 6 +const SQLITE_SCANSTAT_SELECTID = 5 +const SQLITE_SCHEMA = 17 +const SQLITE_SELECT = 21 +const SQLITE_SERIALIZE_NOCOPY = 1 +const SQLITE_SESSION_CONFIG_STRMSIZE = 1 +const SQLITE_SESSION_OBJCONFIG_ROWID = 2 +const SQLITE_SESSION_OBJCONFIG_SIZE = 1 +const SQLITE_SET_LOCKPROXYFILE = 3 +const SQLITE_SHM_EXCLUSIVE = 8 +const SQLITE_SHM_LOCK = 2 +const SQLITE_SHM_NLOCK = 8 +const SQLITE_SHM_SHARED = 4 +const SQLITE_SHM_UNLOCK = 1 +const SQLITE_SORTER_PMASZ = 250 +const SQLITE_SOUNDEX = 1 +const SQLITE_SOURCE_ID = "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355" +const SQLITE_SO_ASC = 0 +const SQLITE_SO_DESC = 1 +const SQLITE_SO_UNDEFINED = -1 +const SQLITE_STAT4_SAMPLES = 24 +const SQLITE_STATE_BUSY = 109 +const SQLITE_STATE_CLOSED = 206 +const SQLITE_STATE_ERROR = 213 +const SQLITE_STATE_OPEN = 118 +const SQLITE_STATE_SICK = 186 +const SQLITE_STATE_ZOMBIE = 167 +const SQLITE_STATUS_MALLOC_COUNT = 9 +const SQLITE_STATUS_MALLOC_SIZE = 5 +const SQLITE_STATUS_MEMORY_USED = 0 +const SQLITE_STATUS_PAGECACHE_OVERFLOW = 2 +const SQLITE_STATUS_PAGECACHE_SIZE = 7 +const SQLITE_STATUS_PAGECACHE_USED = 1 +const SQLITE_STATUS_PARSER_STACK = 6 +const SQLITE_STATUS_SCRATCH_OVERFLOW = 4 +const SQLITE_STATUS_SCRATCH_SIZE = 8 +const SQLITE_STATUS_SCRATCH_USED = 3 +const SQLITE_STDCALL = 0 +const SQLITE_STMTJRNL_SPILL = 65536 +const SQLITE_STMTSTATUS_AUTOINDEX = 3 +const SQLITE_STMTSTATUS_FILTER_HIT = 8 +const SQLITE_STMTSTATUS_FILTER_MISS = 7 +const SQLITE_STMTSTATUS_FULLSCAN_STEP = 1 +const SQLITE_STMTSTATUS_MEMUSED = 99 +const SQLITE_STMTSTATUS_REPREPARE = 5 +const SQLITE_STMTSTATUS_RUN = 6 +const SQLITE_STMTSTATUS_SORT = 2 +const SQLITE_STMTSTATUS_VM_STEP = 4 +const SQLITE_SUBTYPE = 1048576 +const SQLITE_SYNC_DATAONLY = 16 +const SQLITE_SYNC_FULL = 3 +const SQLITE_SYNC_NORMAL = 2 +const SQLITE_SYSTEM_MALLOC = 1 +const SQLITE_SeekScan = 131072 +const SQLITE_ShortColNames = 64 +const SQLITE_SimplifyJoin = 8192 +const SQLITE_SkipScan = 16384 +const SQLITE_Stat4 = 2048 +const SQLITE_StmtScanStatus = 1024 +const SQLITE_TEMP_FILE_PREFIX = "etilqs_" +const SQLITE_TEMP_STORE = 1 +const SQLITE_TESTCTRL_ALWAYS = 13 +const SQLITE_TESTCTRL_ASSERT = 12 +const SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS = 10 +const SQLITE_TESTCTRL_BITVEC_TEST = 8 +const SQLITE_TESTCTRL_BYTEORDER = 22 +const SQLITE_TESTCTRL_EXPLAIN_STMT = 19 +const SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS = 29 +const SQLITE_TESTCTRL_FAULT_INSTALL = 9 +const SQLITE_TESTCTRL_FIRST = 5 +const SQLITE_TESTCTRL_FK_NO_ACTION = 7 +const SQLITE_TESTCTRL_IMPOSTER = 25 +const SQLITE_TESTCTRL_INTERNAL_FUNCTIONS = 17 +const SQLITE_TESTCTRL_ISINIT = 23 +const SQLITE_TESTCTRL_ISKEYWORD = 16 +const SQLITE_TESTCTRL_JSON_SELFCHECK = 14 +const SQLITE_TESTCTRL_LAST = 34 +const SQLITE_TESTCTRL_LOCALTIME_FAULT = 18 +const SQLITE_TESTCTRL_LOGEST = 33 +const SQLITE_TESTCTRL_NEVER_CORRUPT = 20 +const SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD = 19 +const SQLITE_TESTCTRL_OPTIMIZATIONS = 15 +const SQLITE_TESTCTRL_PARSER_COVERAGE = 26 +const SQLITE_TESTCTRL_PENDING_BYTE = 11 +const SQLITE_TESTCTRL_PRNG_RESET = 7 +const SQLITE_TESTCTRL_PRNG_RESTORE = 6 +const SQLITE_TESTCTRL_PRNG_SAVE = 5 +const SQLITE_TESTCTRL_PRNG_SEED = 28 +const SQLITE_TESTCTRL_RESERVE = 14 +const SQLITE_TESTCTRL_RESULT_INTREAL = 27 +const SQLITE_TESTCTRL_SCRATCHMALLOC = 17 +const SQLITE_TESTCTRL_SEEK_COUNT = 30 +const SQLITE_TESTCTRL_SORTER_MMAP = 24 +const SQLITE_TESTCTRL_TRACEFLAGS = 31 +const SQLITE_TESTCTRL_TUNE = 32 +const SQLITE_TESTCTRL_USELONGDOUBLE = 34 +const SQLITE_TESTCTRL_VDBE_COVERAGE = 21 +const SQLITE_TEXT = 3 +const SQLITE_THREADSAFE = 1 +const SQLITE_THREADS_IMPLEMENTED = 1 +const SQLITE_TOKEN_KEYWORD = 2 +const SQLITE_TOKEN_QUOTED = 1 +const SQLITE_TOOBIG = 18 +const SQLITE_TRACE_CLOSE = 8 +const SQLITE_TRACE_LEGACY = 64 +const SQLITE_TRACE_NONLEGACY_MASK = 15 +const SQLITE_TRACE_PROFILE = 2 +const SQLITE_TRACE_ROW = 4 +const SQLITE_TRACE_STMT = 1 +const SQLITE_TRACE_XPROFILE = 128 +const SQLITE_TRANSACTION = 22 +const SQLITE_TXN_NONE = 0 +const SQLITE_TXN_READ = 1 +const SQLITE_TXN_WRITE = 2 +const SQLITE_Transitive = 128 +const SQLITE_TriggerEQP = 16777216 +const SQLITE_TrustedSchema = 128 +const SQLITE_UPDATE = 23 +const SQLITE_USE_URI = 0 +const SQLITE_UTF16 = 4 +const SQLITE_UTF16BE = 3 +const SQLITE_UTF16LE = 2 +const SQLITE_UTF16NATIVE = 2 +const SQLITE_UTF16_ALIGNED = 8 +const SQLITE_UTF8 = 1 +const SQLITE_VERSION = "3.45.3" +const SQLITE_VERSION_NUMBER = 3045003 +const SQLITE_VTABRISK_High = 2 +const SQLITE_VTABRISK_Low = 0 +const SQLITE_VTABRISK_Normal = 1 +const SQLITE_VTAB_CONSTRAINT_SUPPORT = 1 +const SQLITE_VTAB_DIRECTONLY = 3 +const SQLITE_VTAB_INNOCUOUS = 2 +const SQLITE_VTAB_USES_ALL_SCHEMAS = 4 +const SQLITE_WARNING = 28 +const SQLITE_WARNING_AUTOINDEX = 284 +const SQLITE_WIN32_DATA_DIRECTORY_TYPE = 1 +const SQLITE_WIN32_TEMP_DIRECTORY_TYPE = 2 +const SQLITE_WITHOUT_ZONEMALLOC = 1 +const SQLITE_WindowFunc = 2 +const SQLITE_WriteSchema = 1 +const SRT_Coroutine = 13 +const SRT_Discard = 4 +const SRT_DistFifo = 5 +const SRT_DistQueue = 6 +const SRT_EphemTab = 12 +const SRT_Except = 2 +const SRT_Exists = 3 +const SRT_Fifo = 8 +const SRT_Mem = 10 +const SRT_Output = 9 +const SRT_Queue = 7 +const SRT_Set = 11 +const SRT_Table = 14 +const SRT_Union = 1 +const SRT_Upfrom = 15 +const STATX_ALL = 4095 +const STATX_ATIME = 32 +const STATX_BASIC_STATS = 2047 +const STATX_BLOCKS = 1024 +const STATX_BTIME = 2048 +const STATX_CTIME = 128 +const STATX_GID = 16 +const STATX_INO = 256 +const STATX_MODE = 2 +const STATX_MTIME = 64 +const STATX_NLINK = 4 +const STATX_SIZE = 512 +const STATX_TYPE = 1 +const STATX_UID = 8 +const STAT_GET_NDLT = 4 +const STAT_GET_NEQ = 2 +const STAT_GET_NLT = 3 +const STAT_GET_ROWID = 1 +const STAT_GET_STAT1 = 0 +const STDERR_FILENO = 2 +const STDIN_FILENO = 0 +const STDOUT_FILENO = 1 +const SYNC_FILE_RANGE_WAIT_AFTER = 4 +const SYNC_FILE_RANGE_WAIT_BEFORE = 1 +const SYNC_FILE_RANGE_WRITE = 2 +const S_IEXEC = 64 +const S_IFBLK = 24576 +const S_IFCHR = 8192 +const S_IFDIR = 16384 +const S_IFIFO = 4096 +const S_IFLNK = 40960 +const S_IFMT = 61440 +const S_IFREG = 32768 +const S_IFSOCK = 49152 +const S_IREAD = 256 +const S_IRGRP = 32 +const S_IROTH = 4 +const S_IRUSR = 256 +const S_IRWXG = 56 +const S_IRWXO = 7 +const S_IRWXU = 448 +const S_ISGID = 1024 +const S_ISUID = 2048 +const S_ISVTX = 512 +const S_IWGRP = 16 +const S_IWOTH = 2 +const S_IWRITE = 128 +const S_IWUSR = 128 +const S_IXGRP = 8 +const S_IXOTH = 1 +const S_IXUSR = 64 +const TABTYP_NORM = 0 +const TABTYP_VIEW = 2 +const TABTYP_VTAB = 1 +const TCFLSH = 21515 +const TCGETA = 21509 +const TCGETS = 21505 +const TCGETX = 21554 +const TCSBRK = 21513 +const TCSBRKP = 21541 +const TCSETA = 21510 +const TCSETAF = 21512 +const TCSETAW = 21511 +const TCSETS = 21506 +const TCSETSF = 21508 +const TCSETSW = 21507 +const TCSETX = 21555 +const TCSETXF = 21556 +const TCSETXW = 21557 +const TCXONC = 21514 +const TERM_ANDINFO = 32 +const TERM_CODED = 4 +const TERM_COPIED = 8 +const TERM_DYNAMIC = 1 +const TERM_HEURTRUTH = 8192 +const TERM_HIGHTRUTH = 16384 +const TERM_IS = 2048 +const TERM_LIKE = 1024 +const TERM_LIKECOND = 512 +const TERM_LIKEOPT = 256 +const TERM_OK = 64 +const TERM_ORINFO = 16 +const TERM_SLICE = 32768 +const TERM_VARSELECT = 4096 +const TERM_VIRTUAL = 2 +const TERM_VNULL = 128 +const TF_Autoincrement = 8 +const TF_Ephemeral = 16384 +const TF_Eponymous = 32768 +const TF_HasGenerated = 96 +const TF_HasHidden = 2 +const TF_HasNotNull = 2048 +const TF_HasPrimaryKey = 4 +const TF_HasStat1 = 16 +const TF_HasStat4 = 8192 +const TF_HasStored = 64 +const TF_HasVirtual = 32 +const TF_NoVisibleRowid = 512 +const TF_OOOHidden = 1024 +const TF_Readonly = 1 +const TF_Shadow = 4096 +const TF_StatsUsed = 256 +const TF_Strict = 65536 +const TF_WithoutRowid = 128 +const TIMER_ABSTIME = 1 +const TIME_UTC = 1 +const TIOCCBRK = 21544 +const TIOCCONS = 21533 +const TIOCEXCL = 21516 +const TIOCGDEV = 2147767346 +const TIOCGETD = 21540 +const TIOCGEXCL = 2147767360 +const TIOCGICOUNT = 21597 +const TIOCGISO7816 = 2150126658 +const TIOCGLCKTRMIOS = 21590 +const TIOCGPGRP = 21519 +const TIOCGPKT = 2147767352 +const TIOCGPTLCK = 2147767353 +const TIOCGPTN = 2147767344 +const TIOCGPTPEER = 21569 +const TIOCGRS485 = 21550 +const TIOCGSERIAL = 21534 +const TIOCGSID = 21545 +const TIOCGSOFTCAR = 21529 +const TIOCGWINSZ = 21523 +const TIOCINQ = 21531 +const TIOCLINUX = 21532 +const TIOCMBIC = 21527 +const TIOCMBIS = 21526 +const TIOCMGET = 21525 +const TIOCMIWAIT = 21596 +const TIOCMSET = 21528 +const TIOCM_CAR = 64 +const TIOCM_CD = 64 +const TIOCM_CTS = 32 +const TIOCM_DSR = 256 +const TIOCM_DTR = 2 +const TIOCM_LE = 1 +const TIOCM_LOOP = 32768 +const TIOCM_OUT1 = 8192 +const TIOCM_OUT2 = 16384 +const TIOCM_RI = 128 +const TIOCM_RNG = 128 +const TIOCM_RTS = 4 +const TIOCM_SR = 16 +const TIOCM_ST = 8 +const TIOCNOTTY = 21538 +const TIOCNXCL = 21517 +const TIOCOUTQ = 21521 +const TIOCPKT = 21536 +const TIOCPKT_DATA = 0 +const TIOCPKT_DOSTOP = 32 +const TIOCPKT_FLUSHREAD = 1 +const TIOCPKT_FLUSHWRITE = 2 +const TIOCPKT_IOCTL = 64 +const TIOCPKT_NOSTOP = 16 +const TIOCPKT_START = 8 +const TIOCPKT_STOP = 4 +const TIOCSBRK = 21543 +const TIOCSCTTY = 21518 +const TIOCSERCONFIG = 21587 +const TIOCSERGETLSR = 21593 +const TIOCSERGETMULTI = 21594 +const TIOCSERGSTRUCT = 21592 +const TIOCSERGWILD = 21588 +const TIOCSERSETMULTI = 21595 +const TIOCSERSWILD = 21589 +const TIOCSER_TEMT = 1 +const TIOCSETD = 21539 +const TIOCSIG = 1074025526 +const TIOCSISO7816 = 3223868483 +const TIOCSLCKTRMIOS = 21591 +const TIOCSPGRP = 21520 +const TIOCSPTLCK = 1074025521 +const TIOCSRS485 = 21551 +const TIOCSSERIAL = 21535 +const TIOCSSOFTCAR = 21530 +const TIOCSTI = 21522 +const TIOCSWINSZ = 21524 +const TIOCVHANGUP = 21559 +const TK_ABORT = 27 +const TK_ACTION = 28 +const TK_ADD = 163 +const TK_AFTER = 29 +const TK_AGG_COLUMN = 169 +const TK_AGG_FUNCTION = 168 +const TK_ALL = 135 +const TK_ALTER = 162 +const TK_ALWAYS = 96 +const TK_ANALYZE = 30 +const TK_AND = 44 +const TK_ANY = 101 +const TK_AS = 24 +const TK_ASC = 31 +const TK_ASTERISK = 180 +const TK_ATTACH = 32 +const TK_AUTOINCR = 126 +const TK_BEFORE = 33 +const TK_BEGIN = 5 +const TK_BETWEEN = 48 +const TK_BITAND = 102 +const TK_BITNOT = 114 +const TK_BITOR = 103 +const TK_BLOB = 154 +const TK_BY = 34 +const TK_CASCADE = 35 +const TK_CASE = 157 +const TK_CAST = 36 +const TK_CHECK = 124 +const TK_COLLATE = 113 +const TK_COLUMN = 167 +const TK_COLUMNKW = 60 +const TK_COMMA = 25 +const TK_COMMIT = 10 +const TK_CONCAT = 111 +const TK_CONFLICT = 37 +const TK_CONSTRAINT = 119 +const TK_CREATE = 17 +const TK_CTIME_KW = 100 +const TK_CURRENT = 85 +const TK_DATABASE = 38 +const TK_DEFAULT = 120 +const TK_DEFERRABLE = 131 +const TK_DEFERRED = 7 +const TK_DELETE = 128 +const TK_DESC = 39 +const TK_DETACH = 40 +const TK_DISTINCT = 140 +const TK_DO = 61 +const TK_DOT = 141 +const TK_DROP = 133 +const TK_EACH = 41 +const TK_ELSE = 160 +const TK_END = 11 +const TK_EQ = 53 +const TK_ERROR = 182 +const TK_ESCAPE = 58 +const TK_EXCEPT = 136 +const TK_EXCLUDE = 91 +const TK_EXCLUSIVE = 9 +const TK_EXISTS = 20 +const TK_EXPLAIN = 2 +const TK_FAIL = 42 +const TK_FILTER = 166 +const TK_FIRST = 83 +const TK_FLOAT = 153 +const TK_FOLLOWING = 86 +const TK_FOR = 62 +const TK_FOREIGN = 132 +const TK_FROM = 142 +const TK_FUNCTION = 172 +const TK_GE = 57 +const TK_GENERATED = 95 +const TK_GROUP = 146 +const TK_GROUPS = 92 +const TK_GT = 54 +const TK_HAVING = 147 +const TK_ID = 59 +const TK_IF = 18 +const TK_IF_NULL_ROW = 179 +const TK_IGNORE = 63 +const TK_ILLEGAL = 184 +const TK_IMMEDIATE = 8 +const TK_IN = 49 +const TK_INDEX = 161 +const TK_INDEXED = 116 +const TK_INITIALLY = 64 +const TK_INSERT = 127 +const TK_INSTEAD = 65 +const TK_INTEGER = 155 +const TK_INTERSECT = 137 +const TK_INTO = 151 +const TK_IS = 45 +const TK_ISNOT = 171 +const TK_ISNULL = 50 +const TK_JOIN = 143 +const TK_JOIN_KW = 118 +const TK_KEY = 67 +const TK_LAST = 84 +const TK_LE = 55 +const TK_LIKE_KW = 47 +const TK_LIMIT = 148 +const TK_LP = 22 +const TK_LSHIFT = 104 +const TK_LT = 56 +const TK_MATCH = 46 +const TK_MATERIALIZED = 97 +const TK_MINUS = 107 +const TK_NE = 52 +const TK_NO = 66 +const TK_NOT = 19 +const TK_NOTHING = 152 +const TK_NOTNULL = 51 +const TK_NULL = 121 +const TK_NULLS = 82 +const TK_OF = 68 +const TK_OFFSET = 69 +const TK_ON = 115 +const TK_OR = 43 +const TK_ORDER = 145 +const TK_OTHERS = 93 +const TK_OVER = 165 +const TK_PARTITION = 87 +const TK_PLAN = 4 +const TK_PLUS = 106 +const TK_PRAGMA = 70 +const TK_PRECEDING = 88 +const TK_PRIMARY = 122 +const TK_PTR = 112 +const TK_QUERY = 3 +const TK_RAISE = 71 +const TK_RANGE = 89 +const TK_RECURSIVE = 72 +const TK_REFERENCES = 125 +const TK_REGISTER = 176 +const TK_REINDEX = 98 +const TK_RELEASE = 14 +const TK_REM = 110 +const TK_RENAME = 99 +const TK_REPLACE = 73 +const TK_RESTRICT = 74 +const TK_RETURNING = 150 +const TK_ROLLBACK = 12 +const TK_ROW = 75 +const TK_ROWS = 76 +const TK_RP = 23 +const TK_RSHIFT = 105 +const TK_SAVEPOINT = 13 +const TK_SELECT = 138 +const TK_SELECT_COLUMN = 178 +const TK_SEMI = 1 +const TK_SET = 130 +const TK_SLASH = 109 +const TK_SPACE = 183 +const TK_SPAN = 181 +const TK_STAR = 108 +const TK_STRING = 117 +const TK_TABLE = 16 +const TK_TEMP = 21 +const TK_THEN = 159 +const TK_TIES = 94 +const TK_TO = 15 +const TK_TRANSACTION = 6 +const TK_TRIGGER = 77 +const TK_TRUEFALSE = 170 +const TK_TRUTH = 175 +const TK_UMINUS = 173 +const TK_UNBOUNDED = 90 +const TK_UNION = 134 +const TK_UNIQUE = 123 +const TK_UPDATE = 129 +const TK_UPLUS = 174 +const TK_USING = 144 +const TK_VACUUM = 78 +const TK_VALUES = 139 +const TK_VARIABLE = 156 +const TK_VECTOR = 177 +const TK_VIEW = 79 +const TK_VIRTUAL = 80 +const TK_WHEN = 158 +const TK_WHERE = 149 +const TK_WINDOW = 164 +const TK_WITH = 81 +const TK_WITHOUT = 26 +const TMP_MAX = 10000 +const TOKEN = 0 +const TRANS_NONE = 0 +const TRANS_READ = 1 +const TRANS_WRITE = 2 +const TREETRACE_ENABLED = 0 +const TRIGGER_AFTER = 2 +const TRIGGER_BEFORE = 1 +const UNIXFILE_DELETE = 32 +const UNIXFILE_DIRSYNC = 8 +const UNIXFILE_EXCL = 1 +const UNIXFILE_NOLOCK = 128 +const UNIXFILE_PERSIST_WAL = 4 +const UNIXFILE_PSOW = 16 +const UNIXFILE_RDONLY = 2 +const UNIXFILE_URI = 64 +const UNIX_SHM_BASE = 120 +const UNIX_SHM_DMS = 128 +const UNKNOWN_LOCK = 5 +const USE_PREAD = 1 +const UTIME_NOW = 1073741823 +const UTIME_OMIT = 1073741822 +const UpperToLower = 0 +const VDBE_DISPLAY_P4 = 1 +const VDBE_HALT_STATE = 3 +const VDBE_INIT_STATE = 0 +const VDBE_READY_STATE = 1 +const VDBE_RUN_STATE = 2 +const ViewCanHaveRowid = 0 +const WALINDEX_HDR_SIZE = 0 +const WALINDEX_MAX_VERSION = 3007000 +const WALINDEX_PGSZ = 0 +const WAL_ALL_BUT_WRITE = 1 +const WAL_CKPT_LOCK = 1 +const WAL_EXCLUSIVE_MODE = 1 +const WAL_FRAME_HDRSIZE = 24 +const WAL_HDRSIZE = 32 +const WAL_HEAPMEMORY_MODE = 2 +const WAL_LOCK_CKPT = 1 +const WAL_LOCK_READ0 = 3 +const WAL_LOCK_WRITE = 0 +const WAL_MAGIC = 931071618 +const WAL_MAX_VERSION = 3007000 +const WAL_NORMAL_MODE = 0 +const WAL_NREADER = 5 +const WAL_RDONLY = 1 +const WAL_RDWR = 0 +const WAL_RECOVER_LOCK = 2 +const WAL_RETRY = -1 +const WAL_RETRY_BLOCKED_MASK = 0 +const WAL_RETRY_PROTOCOL_LIMIT = 100 +const WAL_SAVEPOINT_NDATA = 4 +const WAL_SHM_RDONLY = 2 +const WAL_WRITE_LOCK = 0 +const WHERE_AGG_DISTINCT = 1024 +const WHERE_AUTO_INDEX = 16384 +const WHERE_BIGNULL_SORT = 524288 +const WHERE_BLOOMFILTER = 4194304 +const WHERE_BOTH_LIMIT = 48 +const WHERE_BTM_LIMIT = 32 +const WHERE_COLUMN_EQ = 1 +const WHERE_COLUMN_IN = 4 +const WHERE_COLUMN_NULL = 8 +const WHERE_COLUMN_RANGE = 2 +const WHERE_CONSTRAINT = 15 +const WHERE_DISTINCTBY = 128 +const WHERE_DISTINCT_NOOP = 0 +const WHERE_DISTINCT_ORDERED = 2 +const WHERE_DISTINCT_UNIQUE = 1 +const WHERE_DISTINCT_UNORDERED = 3 +const WHERE_DUPLICATES_OK = 16 +const WHERE_EXPRIDX = 67108864 +const WHERE_GROUPBY = 64 +const WHERE_IDX_ONLY = 64 +const WHERE_INDEXED = 512 +const WHERE_IN_ABLE = 2048 +const WHERE_IN_EARLYOUT = 262144 +const WHERE_IN_SEEKSCAN = 1048576 +const WHERE_IPK = 256 +const WHERE_MULTI_OR = 8192 +const WHERE_OMIT_OFFSET = 16777216 +const WHERE_ONEPASS_DESIRED = 4 +const WHERE_ONEPASS_MULTIROW = 8 +const WHERE_ONEROW = 4096 +const WHERE_ORDERBY_LIMIT = 2048 +const WHERE_ORDERBY_MAX = 2 +const WHERE_ORDERBY_MIN = 1 +const WHERE_ORDERBY_NORMAL = 0 +const WHERE_OR_SUBCLAUSE = 32 +const WHERE_PARTIALIDX = 131072 +const WHERE_RIGHT_JOIN = 4096 +const WHERE_SELFCULL = 8388608 +const WHERE_SKIPSCAN = 32768 +const WHERE_SORTBYGROUP = 512 +const WHERE_TOP_LIMIT = 16 +const WHERE_TRANSCONS = 2097152 +const WHERE_UNQ_WANTED = 65536 +const WHERE_USE_LIMIT = 16384 +const WHERE_VIRTUALTABLE = 1024 +const WHERE_WANT_DISTINCT = 256 +const WINDOW_AGGINVERSE = 2 +const WINDOW_AGGSTEP = 3 +const WINDOW_ENDING_INT = 1 +const WINDOW_ENDING_NUM = 4 +const WINDOW_NTH_VALUE_INT = 2 +const WINDOW_RETURN_ROW = 1 +const WINDOW_STARTING_INT = 0 +const WINDOW_STARTING_NUM = 3 +const WNOHANG = 1 +const WO_ALL = 16383 +const WO_AND = 1024 +const WO_AUX = 64 +const WO_EQ = 2 +const WO_EQUIV = 2048 +const WO_GE = 32 +const WO_GT = 4 +const WO_IN = 1 +const WO_IS = 128 +const WO_ISNULL = 256 +const WO_LE = 8 +const WO_LT = 16 +const WO_NOOP = 4096 +const WO_OR = 512 +const WO_ROWVAL = 8192 +const WO_SINGLE = 511 +const WRC_Abort = 2 +const WRC_Continue = 0 +const WRC_Prune = 1 +const WRITE_LOCK = 2 +const WUNTRACED = 2 +const W_OK = 2 +const XN_EXPR = -2 +const XN_ROWID = -1 +const X_OK = 1 +const YYFALLBACK = 1 +const YYMALLOCARGTYPE = 0 +const YYNOCODE = 319 +const YYNOERRORRECOVERY = 1 +const YYNRULE = 405 +const YYNRULE_WITH_ACTION = 340 +const YYNSTATE = 579 +const YYNTOKEN = 185 +const YYPARSEFREENEVERNULL = 1 +const YYSTACKDEPTH = 100 +const YYWILDCARD = 101 +const YY_ACCEPT_ACTION = 1244 +const YY_ACTTAB_COUNT = 2100 +const YY_ERROR_ACTION = 1243 +const YY_MAX_REDUCE = 1650 +const YY_MAX_SHIFT = 578 +const YY_MAX_SHIFTREDUCE = 1242 +const YY_MIN_REDUCE = 1246 +const YY_MIN_SHIFTREDUCE = 838 +const YY_NO_ACTION = 1245 +const YY_REDUCE_COUNT = 410 +const YY_REDUCE_MAX = 1753 +const YY_REDUCE_MIN = -271 +const YY_SHIFT_COUNT = 578 +const YY_SHIFT_MAX = 2088 +const YY_SHIFT_MIN = 0 +const _ABILP64 = 3 +const _CS_GNU_LIBC_VERSION = 2 +const _CS_GNU_LIBPTHREAD_VERSION = 3 +const _CS_PATH = 0 +const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4 +const _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 +const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 +const _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 +const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 +const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 +const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 +const _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 +const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 +const _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 +const _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 +const _CS_POSIX_V6_LP64_OFF64_LIBS = 1126 +const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 +const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 +const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 +const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 +const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 +const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1 +const _CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 +const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 +const _CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 +const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 +const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 +const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 +const _CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 +const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 +const _CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 +const _CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 +const _CS_POSIX_V7_LP64_OFF64_LIBS = 1142 +const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 +const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 +const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 +const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 +const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 +const _CS_POSIX_V7_THREADS_CFLAGS = 1150 +const _CS_POSIX_V7_THREADS_LDFLAGS = 1151 +const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5 +const _CS_V6_ENV = 1148 +const _CS_V7_ENV = 1149 +const _FILE_OFFSET_BITS = 64 +const _GNU_SOURCE = 1 +const _IOC_NONE = 0 +const _IOC_READ = 2 +const _IOC_WRITE = 1 +const _IOFBF = 0 +const _IOLBF = 1 +const _IONBF = 2 +const _LARGEFILE_SOURCE = 1 +const _LARGE_FILE = 1 +const _LOONGARCH_ARCH = "loongarch64" +const _LOONGARCH_ARCH_LOONGARCH64 = 1 +const _LOONGARCH_FPSET = 32 +const _LOONGARCH_SIM = 3 +const _LOONGARCH_SPFPSET = 32 +const _LOONGARCH_SZINT = 32 +const _LOONGARCH_SZLONG = 64 +const _LOONGARCH_SZPTR = 64 +const _LOONGARCH_TUNE = "loongarch64" +const _LOONGARCH_TUNE_LOONGARCH64 = 1 +const _LP64 = 1 +const _PC_2_SYMLINKS = 20 +const _PC_ALLOC_SIZE_MIN = 18 +const _PC_ASYNC_IO = 10 +const _PC_CHOWN_RESTRICTED = 6 +const _PC_FILESIZEBITS = 13 +const _PC_LINK_MAX = 0 +const _PC_MAX_CANON = 1 +const _PC_MAX_INPUT = 2 +const _PC_NAME_MAX = 3 +const _PC_NO_TRUNC = 7 +const _PC_PATH_MAX = 4 +const _PC_PIPE_BUF = 5 +const _PC_PRIO_IO = 11 +const _PC_REC_INCR_XFER_SIZE = 14 +const _PC_REC_MAX_XFER_SIZE = 15 +const _PC_REC_MIN_XFER_SIZE = 16 +const _PC_REC_XFER_ALIGN = 17 +const _PC_SOCK_MAXBUF = 12 +const _PC_SYMLINK_MAX = 19 +const _PC_SYNC_IO = 9 +const _PC_VDISABLE = 8 +const _POSIX2_C_BIND = 200809 +const _POSIX2_VERSION = 200809 +const _POSIX_ADVISORY_INFO = 200809 +const _POSIX_ASYNCHRONOUS_IO = 200809 +const _POSIX_BARRIERS = 200809 +const _POSIX_CHOWN_RESTRICTED = 1 +const _POSIX_CLOCK_SELECTION = 200809 +const _POSIX_CPUTIME = 200809 +const _POSIX_FSYNC = 200809 +const _POSIX_IPV6 = 200809 +const _POSIX_JOB_CONTROL = 1 +const _POSIX_MAPPED_FILES = 200809 +const _POSIX_MEMLOCK = 200809 +const _POSIX_MEMLOCK_RANGE = 200809 +const _POSIX_MEMORY_PROTECTION = 200809 +const _POSIX_MESSAGE_PASSING = 200809 +const _POSIX_MONOTONIC_CLOCK = 200809 +const _POSIX_NO_TRUNC = 1 +const _POSIX_RAW_SOCKETS = 200809 +const _POSIX_READER_WRITER_LOCKS = 200809 +const _POSIX_REALTIME_SIGNALS = 200809 +const _POSIX_REGEXP = 1 +const _POSIX_SAVED_IDS = 1 +const _POSIX_SEMAPHORES = 200809 +const _POSIX_SHARED_MEMORY_OBJECTS = 200809 +const _POSIX_SHELL = 1 +const _POSIX_SPAWN = 200809 +const _POSIX_SPIN_LOCKS = 200809 +const _POSIX_THREADS = 200809 +const _POSIX_THREAD_ATTR_STACKADDR = 200809 +const _POSIX_THREAD_ATTR_STACKSIZE = 200809 +const _POSIX_THREAD_CPUTIME = 200809 +const _POSIX_THREAD_PRIORITY_SCHEDULING = 200809 +const _POSIX_THREAD_PROCESS_SHARED = 200809 +const _POSIX_THREAD_SAFE_FUNCTIONS = 200809 +const _POSIX_TIMEOUTS = 200809 +const _POSIX_TIMERS = 200809 +const _POSIX_V6_LP64_OFF64 = 1 +const _POSIX_V7_LP64_OFF64 = 1 +const _POSIX_VDISABLE = 0 +const _POSIX_VERSION = 200809 +const _SC_2_CHAR_TERM = 95 +const _SC_2_C_BIND = 47 +const _SC_2_C_DEV = 48 +const _SC_2_FORT_DEV = 49 +const _SC_2_FORT_RUN = 50 +const _SC_2_LOCALEDEF = 52 +const _SC_2_PBS = 168 +const _SC_2_PBS_ACCOUNTING = 169 +const _SC_2_PBS_CHECKPOINT = 175 +const _SC_2_PBS_LOCATE = 170 +const _SC_2_PBS_MESSAGE = 171 +const _SC_2_PBS_TRACK = 172 +const _SC_2_SW_DEV = 51 +const _SC_2_UPE = 97 +const _SC_2_VERSION = 46 +const _SC_ADVISORY_INFO = 132 +const _SC_AIO_LISTIO_MAX = 23 +const _SC_AIO_MAX = 24 +const _SC_AIO_PRIO_DELTA_MAX = 25 +const _SC_ARG_MAX = 0 +const _SC_ASYNCHRONOUS_IO = 12 +const _SC_ATEXIT_MAX = 87 +const _SC_AVPHYS_PAGES = 86 +const _SC_BARRIERS = 133 +const _SC_BC_BASE_MAX = 36 +const _SC_BC_DIM_MAX = 37 +const _SC_BC_SCALE_MAX = 38 +const _SC_BC_STRING_MAX = 39 +const _SC_CHILD_MAX = 1 +const _SC_CLK_TCK = 2 +const _SC_CLOCK_SELECTION = 137 +const _SC_COLL_WEIGHTS_MAX = 40 +const _SC_CPUTIME = 138 +const _SC_DELAYTIMER_MAX = 26 +const _SC_EXPR_NEST_MAX = 42 +const _SC_FSYNC = 15 +const _SC_GETGR_R_SIZE_MAX = 69 +const _SC_GETPW_R_SIZE_MAX = 70 +const _SC_HOST_NAME_MAX = 180 +const _SC_IOV_MAX = 60 +const _SC_IPV6 = 235 +const _SC_JOB_CONTROL = 7 +const _SC_LINE_MAX = 43 +const _SC_LOGIN_NAME_MAX = 71 +const _SC_MAPPED_FILES = 16 +const _SC_MEMLOCK = 17 +const _SC_MEMLOCK_RANGE = 18 +const _SC_MEMORY_PROTECTION = 19 +const _SC_MESSAGE_PASSING = 20 +const _SC_MINSIGSTKSZ = 249 +const _SC_MONOTONIC_CLOCK = 149 +const _SC_MQ_OPEN_MAX = 27 +const _SC_MQ_PRIO_MAX = 28 +const _SC_NGROUPS_MAX = 3 +const _SC_NPROCESSORS_CONF = 83 +const _SC_NPROCESSORS_ONLN = 84 +const _SC_NZERO = 109 +const _SC_OPEN_MAX = 4 +const _SC_PAGESIZE = 30 +const _SC_PAGE_SIZE = 30 +const _SC_PASS_MAX = 88 +const _SC_PHYS_PAGES = 85 +const _SC_PRIORITIZED_IO = 13 +const _SC_PRIORITY_SCHEDULING = 10 +const _SC_RAW_SOCKETS = 236 +const _SC_READER_WRITER_LOCKS = 153 +const _SC_REALTIME_SIGNALS = 9 +const _SC_REGEXP = 155 +const _SC_RE_DUP_MAX = 44 +const _SC_RTSIG_MAX = 31 +const _SC_SAVED_IDS = 8 +const _SC_SEMAPHORES = 21 +const _SC_SEM_NSEMS_MAX = 32 +const _SC_SEM_VALUE_MAX = 33 +const _SC_SHARED_MEMORY_OBJECTS = 22 +const _SC_SHELL = 157 +const _SC_SIGQUEUE_MAX = 34 +const _SC_SIGSTKSZ = 250 +const _SC_SPAWN = 159 +const _SC_SPIN_LOCKS = 154 +const _SC_SPORADIC_SERVER = 160 +const _SC_SS_REPL_MAX = 241 +const _SC_STREAMS = 174 +const _SC_STREAM_MAX = 5 +const _SC_SYMLOOP_MAX = 173 +const _SC_SYNCHRONIZED_IO = 14 +const _SC_THREADS = 67 +const _SC_THREAD_ATTR_STACKADDR = 77 +const _SC_THREAD_ATTR_STACKSIZE = 78 +const _SC_THREAD_CPUTIME = 139 +const _SC_THREAD_DESTRUCTOR_ITERATIONS = 73 +const _SC_THREAD_KEYS_MAX = 74 +const _SC_THREAD_PRIORITY_SCHEDULING = 79 +const _SC_THREAD_PRIO_INHERIT = 80 +const _SC_THREAD_PRIO_PROTECT = 81 +const _SC_THREAD_PROCESS_SHARED = 82 +const _SC_THREAD_ROBUST_PRIO_INHERIT = 247 +const _SC_THREAD_ROBUST_PRIO_PROTECT = 248 +const _SC_THREAD_SAFE_FUNCTIONS = 68 +const _SC_THREAD_SPORADIC_SERVER = 161 +const _SC_THREAD_STACK_MIN = 75 +const _SC_THREAD_THREADS_MAX = 76 +const _SC_TIMEOUTS = 164 +const _SC_TIMERS = 11 +const _SC_TIMER_MAX = 35 +const _SC_TRACE = 181 +const _SC_TRACE_EVENT_FILTER = 182 +const _SC_TRACE_EVENT_NAME_MAX = 242 +const _SC_TRACE_INHERIT = 183 +const _SC_TRACE_LOG = 184 +const _SC_TRACE_NAME_MAX = 243 +const _SC_TRACE_SYS_MAX = 244 +const _SC_TRACE_USER_EVENT_MAX = 245 +const _SC_TTY_NAME_MAX = 72 +const _SC_TYPED_MEMORY_OBJECTS = 165 +const _SC_TZNAME_MAX = 6 +const _SC_UIO_MAXIOV = 60 +const _SC_V6_ILP32_OFF32 = 176 +const _SC_V6_ILP32_OFFBIG = 177 +const _SC_V6_LP64_OFF64 = 178 +const _SC_V6_LPBIG_OFFBIG = 179 +const _SC_V7_ILP32_OFF32 = 237 +const _SC_V7_ILP32_OFFBIG = 238 +const _SC_V7_LP64_OFF64 = 239 +const _SC_V7_LPBIG_OFFBIG = 240 +const _SC_VERSION = 29 +const _SC_XBS5_ILP32_OFF32 = 125 +const _SC_XBS5_ILP32_OFFBIG = 126 +const _SC_XBS5_LP64_OFF64 = 127 +const _SC_XBS5_LPBIG_OFFBIG = 128 +const _SC_XOPEN_CRYPT = 92 +const _SC_XOPEN_ENH_I18N = 93 +const _SC_XOPEN_LEGACY = 129 +const _SC_XOPEN_REALTIME = 130 +const _SC_XOPEN_REALTIME_THREADS = 131 +const _SC_XOPEN_SHM = 94 +const _SC_XOPEN_STREAMS = 246 +const _SC_XOPEN_UNIX = 91 +const _SC_XOPEN_VERSION = 89 +const _SC_XOPEN_XCU_VERSION = 90 +const _SC_XOPEN_XPG2 = 98 +const _SC_XOPEN_XPG3 = 99 +const _SC_XOPEN_XPG4 = 100 +const _STDC_PREDEF_H = 1 +const _XOPEN_ENH_I18N = 1 +const _XOPEN_SOURCE = 600 +const _XOPEN_UNIX = 1 +const _XOPEN_VERSION = 700 +const __ACCUM_EPSILON__ = 0 +const __ACCUM_FBIT__ = 15 +const __ACCUM_IBIT__ = 16 +const __ACCUM_MAX__ = 0 +const __ACCUM_MIN__ = 0 +const __ATOMIC_ACQUIRE = 2 +const __ATOMIC_ACQ_REL = 4 +const __ATOMIC_CONSUME = 1 +const __ATOMIC_RELAXED = 0 +const __ATOMIC_RELEASE = 3 +const __ATOMIC_SEQ_CST = 5 +const __BIGGEST_ALIGNMENT__ = 16 +const __BIG_ENDIAN = 4321 +const __BYTE_ORDER = 1234 +const __BYTE_ORDER__ = 1234 +const __CCGO__ = 1 +const __CHAR_BIT__ = 8 +const __DA_FBIT__ = 31 +const __DA_IBIT__ = 32 +const __DBL_DECIMAL_DIG__ = 17 +const __DBL_DIG__ = 15 +const __DBL_HAS_DENORM__ = 1 +const __DBL_HAS_INFINITY__ = 1 +const __DBL_HAS_QUIET_NAN__ = 1 +const __DBL_IS_IEC_60559__ = 1 +const __DBL_MANT_DIG__ = 53 +const __DBL_MAX_10_EXP__ = 308 +const __DBL_MAX_EXP__ = 1024 +const __DBL_MIN_10_EXP__ = -307 +const __DBL_MIN_EXP__ = -1021 +const __DECIMAL_DIG__ = 36 +const __DEC_EVAL_METHOD__ = 2 +const __DQ_FBIT__ = 63 +const __DQ_IBIT__ = 0 +const __ELF__ = 1 +const __FINITE_MATH_ONLY__ = 0 +const __FLOAT128_TYPE__ = 1 +const __FLOAT_WORD_ORDER__ = 1234 +const __FLT128_DECIMAL_DIG__ = 36 +const __FLT128_DENORM_MIN__ = 0 +const __FLT128_DIG__ = 33 +const __FLT128_EPSILON__ = 0 +const __FLT128_HAS_DENORM__ = 1 +const __FLT128_HAS_INFINITY__ = 1 +const __FLT128_HAS_QUIET_NAN__ = 1 +const __FLT128_IS_IEC_60559__ = 1 +const __FLT128_MANT_DIG__ = 113 +const __FLT128_MAX_10_EXP__ = 4932 +const __FLT128_MAX_EXP__ = 16384 +const __FLT128_MAX__ = 0 +const __FLT128_MIN_10_EXP__ = -4931 +const __FLT128_MIN_EXP__ = -16381 +const __FLT128_MIN__ = 0 +const __FLT128_NORM_MAX__ = 0 +const __FLT32X_DECIMAL_DIG__ = 17 +const __FLT32X_DENORM_MIN__ = 0 +const __FLT32X_DIG__ = 15 +const __FLT32X_EPSILON__ = 0 +const __FLT32X_HAS_DENORM__ = 1 +const __FLT32X_HAS_INFINITY__ = 1 +const __FLT32X_HAS_QUIET_NAN__ = 1 +const __FLT32X_IS_IEC_60559__ = 1 +const __FLT32X_MANT_DIG__ = 53 +const __FLT32X_MAX_10_EXP__ = 308 +const __FLT32X_MAX_EXP__ = 1024 +const __FLT32X_MAX__ = 0 +const __FLT32X_MIN_10_EXP__ = -307 +const __FLT32X_MIN_EXP__ = -1021 +const __FLT32X_MIN__ = 0 +const __FLT32X_NORM_MAX__ = 0 +const __FLT32_DECIMAL_DIG__ = 9 +const __FLT32_DENORM_MIN__ = 0 +const __FLT32_DIG__ = 6 +const __FLT32_EPSILON__ = 0 +const __FLT32_HAS_DENORM__ = 1 +const __FLT32_HAS_INFINITY__ = 1 +const __FLT32_HAS_QUIET_NAN__ = 1 +const __FLT32_IS_IEC_60559__ = 1 +const __FLT32_MANT_DIG__ = 24 +const __FLT32_MAX_10_EXP__ = 38 +const __FLT32_MAX_EXP__ = 128 +const __FLT32_MAX__ = 0 +const __FLT32_MIN_10_EXP__ = -37 +const __FLT32_MIN_EXP__ = -125 +const __FLT32_MIN__ = 0 +const __FLT32_NORM_MAX__ = 0 +const __FLT64X_DECIMAL_DIG__ = 36 +const __FLT64X_DENORM_MIN__ = 0 +const __FLT64X_DIG__ = 33 +const __FLT64X_EPSILON__ = 0 +const __FLT64X_HAS_DENORM__ = 1 +const __FLT64X_HAS_INFINITY__ = 1 +const __FLT64X_HAS_QUIET_NAN__ = 1 +const __FLT64X_IS_IEC_60559__ = 1 +const __FLT64X_MANT_DIG__ = 113 +const __FLT64X_MAX_10_EXP__ = 4932 +const __FLT64X_MAX_EXP__ = 16384 +const __FLT64X_MAX__ = 0 +const __FLT64X_MIN_10_EXP__ = -4931 +const __FLT64X_MIN_EXP__ = -16381 +const __FLT64X_MIN__ = 0 +const __FLT64X_NORM_MAX__ = 0 +const __FLT64_DECIMAL_DIG__ = 17 +const __FLT64_DENORM_MIN__ = 0 +const __FLT64_DIG__ = 15 +const __FLT64_EPSILON__ = 0 +const __FLT64_HAS_DENORM__ = 1 +const __FLT64_HAS_INFINITY__ = 1 +const __FLT64_HAS_QUIET_NAN__ = 1 +const __FLT64_IS_IEC_60559__ = 1 +const __FLT64_MANT_DIG__ = 53 +const __FLT64_MAX_10_EXP__ = 308 +const __FLT64_MAX_EXP__ = 1024 +const __FLT64_MAX__ = 0 +const __FLT64_MIN_10_EXP__ = -307 +const __FLT64_MIN_EXP__ = -1021 +const __FLT64_MIN__ = 0 +const __FLT64_NORM_MAX__ = 0 +const __FLT_DECIMAL_DIG__ = 9 +const __FLT_DENORM_MIN__ = 0 +const __FLT_DIG__ = 6 +const __FLT_EPSILON__ = 0 +const __FLT_EVAL_METHOD_TS_18661_3__ = 0 +const __FLT_EVAL_METHOD__ = 0 +const __FLT_HAS_DENORM__ = 1 +const __FLT_HAS_INFINITY__ = 1 +const __FLT_HAS_QUIET_NAN__ = 1 +const __FLT_IS_IEC_60559__ = 1 +const __FLT_MANT_DIG__ = 24 +const __FLT_MAX_10_EXP__ = 38 +const __FLT_MAX_EXP__ = 128 +const __FLT_MAX__ = 0 +const __FLT_MIN_10_EXP__ = -37 +const __FLT_MIN_EXP__ = -125 +const __FLT_MIN__ = 0 +const __FLT_NORM_MAX__ = 0 +const __FLT_RADIX__ = 2 +const __FP_FAST_FMA = 1 +const __FP_FAST_FMAF = 1 +const __FP_FAST_FMAF32 = 1 +const __FP_FAST_FMAF32x = 1 +const __FP_FAST_FMAF64 = 1 +const __FRACT_EPSILON__ = 0 +const __FRACT_FBIT__ = 15 +const __FRACT_IBIT__ = 0 +const __FRACT_MAX__ = 0 +const __FRACT_MIN__ = 0 +const __FUNCTION__ = 0 +const __GCC_ATOMIC_BOOL_LOCK_FREE = 2 +const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2 +const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2 +const __GCC_ATOMIC_CHAR_LOCK_FREE = 2 +const __GCC_ATOMIC_INT_LOCK_FREE = 2 +const __GCC_ATOMIC_LLONG_LOCK_FREE = 2 +const __GCC_ATOMIC_LONG_LOCK_FREE = 2 +const __GCC_ATOMIC_POINTER_LOCK_FREE = 2 +const __GCC_ATOMIC_SHORT_LOCK_FREE = 2 +const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1 +const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2 +const __GCC_HAVE_DWARF2_CFI_ASM = 1 +const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1 +const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1 +const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1 +const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1 +const __GCC_IEC_559 = 2 +const __GCC_IEC_559_COMPLEX = 2 +const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" +const __GNUC_MINOR__ = 0 +const __GNUC_PATCHLEVEL__ = 1 +const __GNUC_RH_RELEASE__ = 0 +const __GNUC_STDC_INLINE__ = 1 +const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" +const __GNUC__ = 14 +const __GXX_ABI_VERSION = 1019 +const __HAVE_SPECULATION_SAFE_VALUE = 1 +const __HA_FBIT__ = 7 +const __HA_IBIT__ = 8 +const __HQ_FBIT__ = 15 +const __HQ_IBIT__ = 0 +const __INT16_MAX__ = 32767 +const __INT32_MAX__ = 2147483647 +const __INT32_TYPE__ = 0 +const __INT64_MAX__ = 9223372036854775807 +const __INT8_MAX__ = 127 +const __INTMAX_MAX__ = 9223372036854775807 +const __INTMAX_WIDTH__ = 64 +const __INTPTR_MAX__ = 9223372036854775807 +const __INTPTR_WIDTH__ = 64 +const __INT_FAST16_MAX__ = 9223372036854775807 +const __INT_FAST16_WIDTH__ = 64 +const __INT_FAST32_MAX__ = 9223372036854775807 +const __INT_FAST32_WIDTH__ = 64 +const __INT_FAST64_MAX__ = 9223372036854775807 +const __INT_FAST64_WIDTH__ = 64 +const __INT_FAST8_MAX__ = 127 +const __INT_FAST8_WIDTH__ = 8 +const __INT_LEAST16_MAX__ = 32767 +const __INT_LEAST16_WIDTH__ = 16 +const __INT_LEAST32_MAX__ = 2147483647 +const __INT_LEAST32_TYPE__ = 0 +const __INT_LEAST32_WIDTH__ = 32 +const __INT_LEAST64_MAX__ = 9223372036854775807 +const __INT_LEAST64_WIDTH__ = 64 +const __INT_LEAST8_MAX__ = 127 +const __INT_LEAST8_WIDTH__ = 8 +const __INT_MAX__ = 2147483647 +const __INT_WIDTH__ = 32 +const __LACCUM_EPSILON__ = 0 +const __LACCUM_FBIT__ = 31 +const __LACCUM_IBIT__ = 32 +const __LACCUM_MAX__ = 0 +const __LACCUM_MIN__ = 0 +const __LDBL_DECIMAL_DIG__ = 36 +const __LDBL_DENORM_MIN__ = 0 +const __LDBL_DIG__ = 33 +const __LDBL_EPSILON__ = 0 +const __LDBL_HAS_DENORM__ = 1 +const __LDBL_HAS_INFINITY__ = 1 +const __LDBL_HAS_QUIET_NAN__ = 1 +const __LDBL_IS_IEC_60559__ = 1 +const __LDBL_MANT_DIG__ = 113 +const __LDBL_MAX_10_EXP__ = 4932 +const __LDBL_MAX_EXP__ = 16384 +const __LDBL_MAX__ = 0 +const __LDBL_MIN_10_EXP__ = -4931 +const __LDBL_MIN_EXP__ = -16381 +const __LDBL_MIN__ = 0 +const __LDBL_NORM_MAX__ = 0 +const __LFRACT_EPSILON__ = 0 +const __LFRACT_FBIT__ = 31 +const __LFRACT_IBIT__ = 0 +const __LFRACT_MAX__ = 0 +const __LFRACT_MIN__ = 0 +const __LITTLE_ENDIAN = 1234 +const __LLACCUM_EPSILON__ = 0 +const __LLACCUM_FBIT__ = 63 +const __LLACCUM_IBIT__ = 64 +const __LLACCUM_MAX__ = 0 +const __LLACCUM_MIN__ = 0 +const __LLFRACT_EPSILON__ = 0 +const __LLFRACT_FBIT__ = 63 +const __LLFRACT_IBIT__ = 0 +const __LLFRACT_MAX__ = 0 +const __LLFRACT_MIN__ = 0 +const __LONG_LONG_MAX__ = 9223372036854775807 +const __LONG_LONG_WIDTH__ = 64 +const __LONG_MAX = 9223372036854775807 +const __LONG_MAX__ = 9223372036854775807 +const __LONG_WIDTH__ = 64 +const __LOONGARCH_ARCH_LOONGARCH64 = 1 +const __LOONGARCH_TUNE_LOONGARCH64 = 1 +const __LP64__ = 1 +const __NO_INLINE__ = 1 +const __ORDER_BIG_ENDIAN__ = 4321 +const __ORDER_LITTLE_ENDIAN__ = 1234 +const __ORDER_PDP_ENDIAN__ = 3412 +const __PDP_ENDIAN = 3412 +const __PRAGMA_REDEFINE_EXTNAME = 1 +const __PRETTY_FUNCTION__ = 0 +const __PTRDIFF_MAX__ = 9223372036854775807 +const __PTRDIFF_WIDTH__ = 64 +const __QQ_FBIT__ = 7 +const __QQ_IBIT__ = 0 +const __REGISTER_PREFIX__ = 0 +const __SACCUM_EPSILON__ = 0 +const __SACCUM_FBIT__ = 7 +const __SACCUM_IBIT__ = 8 +const __SACCUM_MAX__ = 0 +const __SACCUM_MIN__ = 0 +const __SA_FBIT__ = 15 +const __SA_IBIT__ = 16 +const __SCHAR_MAX__ = 127 +const __SCHAR_WIDTH__ = 8 +const __SFRACT_EPSILON__ = 0 +const __SFRACT_FBIT__ = 7 +const __SFRACT_IBIT__ = 0 +const __SFRACT_MAX__ = 0 +const __SFRACT_MIN__ = 0 +const __SHRT_MAX__ = 32767 +const __SHRT_WIDTH__ = 16 +const __SIG_ATOMIC_MAX__ = 2147483647 +const __SIG_ATOMIC_MIN__ = -2147483648 +const __SIG_ATOMIC_TYPE__ = 0 +const __SIG_ATOMIC_WIDTH__ = 32 +const __SIZEOF_DOUBLE__ = 8 +const __SIZEOF_FLOAT__ = 4 +const __SIZEOF_INT128__ = 16 +const __SIZEOF_INT__ = 4 +const __SIZEOF_LONG_DOUBLE__ = 8 +const __SIZEOF_LONG_LONG__ = 8 +const __SIZEOF_LONG__ = 8 +const __SIZEOF_POINTER__ = 8 +const __SIZEOF_PTRDIFF_T__ = 8 +const __SIZEOF_SHORT__ = 2 +const __SIZEOF_SIZE_T__ = 8 +const __SIZEOF_WCHAR_T__ = 4 +const __SIZEOF_WINT_T__ = 4 +const __SIZE_MAX__ = 18446744073709551615 +const __SIZE_WIDTH__ = 64 +const __SQLITESESSION_H_ = 1 +const __SQ_FBIT__ = 31 +const __SQ_IBIT__ = 0 +const __STDC_HOSTED__ = 1 +const __STDC_IEC_559_COMPLEX__ = 1 +const __STDC_IEC_559__ = 1 +const __STDC_IEC_60559_BFP__ = 201404 +const __STDC_IEC_60559_COMPLEX__ = 201404 +const __STDC_ISO_10646__ = 201706 +const __STDC_UTF_16__ = 1 +const __STDC_UTF_32__ = 1 +const __STDC_VERSION__ = 201710 +const __STDC__ = 1 +const __TA_FBIT__ = 63 +const __TA_IBIT__ = 64 +const __TQ_FBIT__ = 127 +const __TQ_IBIT__ = 0 +const __UACCUM_EPSILON__ = 0 +const __UACCUM_FBIT__ = 16 +const __UACCUM_IBIT__ = 16 +const __UACCUM_MAX__ = 0 +const __UACCUM_MIN__ = 0 +const __UDA_FBIT__ = 32 +const __UDA_IBIT__ = 32 +const __UDQ_FBIT__ = 64 +const __UDQ_IBIT__ = 0 +const __UFRACT_EPSILON__ = 0 +const __UFRACT_FBIT__ = 16 +const __UFRACT_IBIT__ = 0 +const __UFRACT_MAX__ = 0 +const __UFRACT_MIN__ = 0 +const __UHA_FBIT__ = 8 +const __UHA_IBIT__ = 8 +const __UHQ_FBIT__ = 16 +const __UHQ_IBIT__ = 0 +const __UINT16_MAX__ = 65535 +const __UINT32_MAX__ = 4294967295 +const __UINT64_MAX__ = 18446744073709551615 +const __UINT8_MAX__ = 255 +const __UINTMAX_MAX__ = 18446744073709551615 +const __UINTPTR_MAX__ = 18446744073709551615 +const __UINT_FAST16_MAX__ = 18446744073709551615 +const __UINT_FAST32_MAX__ = 18446744073709551615 +const __UINT_FAST64_MAX__ = 18446744073709551615 +const __UINT_FAST8_MAX__ = 255 +const __UINT_LEAST16_MAX__ = 65535 +const __UINT_LEAST32_MAX__ = 4294967295 +const __UINT_LEAST64_MAX__ = 18446744073709551615 +const __UINT_LEAST8_MAX__ = 255 +const __ULACCUM_EPSILON__ = 0 +const __ULACCUM_FBIT__ = 32 +const __ULACCUM_IBIT__ = 32 +const __ULACCUM_MAX__ = 0 +const __ULACCUM_MIN__ = 0 +const __ULFRACT_EPSILON__ = 0 +const __ULFRACT_FBIT__ = 32 +const __ULFRACT_IBIT__ = 0 +const __ULFRACT_MAX__ = 0 +const __ULFRACT_MIN__ = 0 +const __ULLACCUM_EPSILON__ = 0 +const __ULLACCUM_FBIT__ = 64 +const __ULLACCUM_IBIT__ = 64 +const __ULLACCUM_MAX__ = 0 +const __ULLACCUM_MIN__ = 0 +const __ULLFRACT_EPSILON__ = 0 +const __ULLFRACT_FBIT__ = 64 +const __ULLFRACT_IBIT__ = 0 +const __ULLFRACT_MAX__ = 0 +const __ULLFRACT_MIN__ = 0 +const __UQQ_FBIT__ = 8 +const __UQQ_IBIT__ = 0 +const __USACCUM_EPSILON__ = 0 +const __USACCUM_FBIT__ = 8 +const __USACCUM_IBIT__ = 8 +const __USACCUM_MAX__ = 0 +const __USACCUM_MIN__ = 0 +const __USA_FBIT__ = 16 +const __USA_IBIT__ = 16 +const __USE_TIME_BITS64 = 1 +const __USFRACT_EPSILON__ = 0 +const __USFRACT_FBIT__ = 8 +const __USFRACT_IBIT__ = 0 +const __USFRACT_MAX__ = 0 +const __USFRACT_MIN__ = 0 +const __USQ_FBIT__ = 32 +const __USQ_IBIT__ = 0 +const __UTA_FBIT__ = 64 +const __UTA_IBIT__ = 64 +const __UTQ_FBIT__ = 128 +const __UTQ_IBIT__ = 0 +const __VERSION__ = "14.0.1 20240228 (Red Hat 14.0.1-0)" +const __WCHAR_MAX__ = 2147483647 +const __WCHAR_MIN__ = -2147483648 +const __WCHAR_TYPE__ = 0 +const __WCHAR_WIDTH__ = 32 +const __WINT_MAX__ = 4294967295 +const __WINT_MIN__ = 0 +const __WINT_WIDTH__ = 32 +const __builtin_copysignq = 0 +const __builtin_fabsq = 0 +const __builtin_huge_valq = 0 +const __builtin_infq = 0 +const __builtin_nanq = 0 +const __builtin_nansq = 0 +const __gnu_linux__ = 1 +const __inline = 0 +const __linux = 1 +const __linux__ = 1 +const __loongarch64 = 1 +const __loongarch__ = 1 +const __loongarch_arch = "loongarch64" +const __loongarch_double_float = 1 +const __loongarch_frlen = 64 +const __loongarch_grlen = 64 +const __loongarch_hard_float = 1 +const __loongarch_lp64 = 1 +const __loongarch_tune = "loongarch64" +const __restrict = 0 +const __restrict_arr = 0 +const __tm_gmtoff = 0 +const __tm_zone = 0 +const __unix = 1 +const __unix__ = 1 +const alloca = 0 +const bBatch = 0 +const cume_distFinalizeFunc = 0 +const errno = 0 +const etBUFSIZE = 70 +const etCHARX = 8 +const etDECIMAL = 16 +const etDYNSTRING = 6 +const etEXP = 2 +const etFLOAT = 1 +const etGENERIC = 3 +const etINVALID = 17 +const etORDINAL = 15 +const etPERCENT = 7 +const etPOINTER = 13 +const etRADIX = 0 +const etSIZE = 4 +const etSQLESCAPE = 9 +const etSQLESCAPE2 = 10 +const etSQLESCAPE3 = 14 +const etSRCITEM = 12 +const etSTRING = 5 +const etTOKEN = 11 +const fdatasync = 0 +const first_valueInvFunc = 0 +const first_valueValueFunc = 0 +const fts5GetVarint = 0 +const fts5YYMALLOCARGTYPE = 0 +const fts5YYNFTS5TOKEN = 16 +const fts5YYNOCODE = 27 +const fts5YYNOERRORRECOVERY = 1 +const fts5YYNRULE = 28 +const fts5YYNRULE_WITH_ACTION = 28 +const fts5YYNSTATE = 35 +const fts5YYPARSEFREENOTNULL = 1 +const fts5YYSTACKDEPTH = 100 +const fts5YY_ACCEPT_ACTION = 81 +const fts5YY_ACTTAB_COUNT = 105 +const fts5YY_ERROR_ACTION = 80 +const fts5YY_MAX_REDUCE = 110 +const fts5YY_MAX_SHIFT = 34 +const fts5YY_MAX_SHIFTREDUCE = 79 +const fts5YY_MIN_REDUCE = 83 +const fts5YY_MIN_SHIFTREDUCE = 52 +const fts5YY_NO_ACTION = 82 +const fts5YY_REDUCE_COUNT = 17 +const fts5YY_REDUCE_MAX = 67 +const fts5YY_REDUCE_MIN = -17 +const fts5YY_SHIFT_COUNT = 34 +const fts5YY_SHIFT_MAX = 93 +const fts5YY_SHIFT_MIN = 0 +const get4byte = 0 +const getVarint = 0 +const linux = 1 +const loff_t = 0 +const math_errhandling = 2 +const mem0 = 0 +const noopFunc = 0 +const nth_valueInvFunc = 0 +const nth_valueValueFunc = 0 +const ntileFinalizeFunc = 0 +const pcache1 = 0 +const percent_rankFinalizeFunc = 0 +const pread64 = 0 +const put4byte = 0 +const putVarint = 0 +const pwrite64 = 0 +const sqlite3Fts5ParserARG_PARAM = 0 +const sqlite3Fts5ParserARG_PDECL = 0 +const sqlite3Fts5ParserFTS5TOKENTYPE = 0 +const sqlite3GlobalConfig = 0 +const sqlite3ParserCTX_PARAM = 0 +const sqlite3ParserCTX_PDECL = 0 +const sqlite3ParserTOKENTYPE = 0 +const sqlite3Parser_ENGINEALWAYSONSTACK = 1 +const sqlite3StrNICmp = 0 +const static_assert = 0 +const threadid = 0 +const tkCREATE = 4 +const tkEND = 7 +const tkEXPLAIN = 3 +const tkOTHER = 2 +const tkSEMI = 0 +const tkTEMP = 5 +const tkTRIGGER = 6 +const tkWS = 1 +const unix = 1 +const vfsList = 0 +const wsdAutoext = 0 +const wsdHooks = 0 +const wsdPrng = 0 +const wsdStat = 0 + +type t__builtin_va_list = uintptr + +type t__predefined_size_t = uint64 + +type t__predefined_wchar_t = int32 + +type t__predefined_ptrdiff_t = int64 + +type Tva_list = uintptr + +type va_list = Tva_list + +// C documentation +// +// /* +// ** CAPI3REF: Database Connection Handle +// ** KEYWORDS: {database connection} {database connections} +// ** +// ** Each open SQLite database is represented by a pointer to an instance of +// ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 +// ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and +// ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] +// ** and [sqlite3_close_v2()] are its destructors. There are many other +// ** interfaces (such as +// ** [sqlite3_prepare_v2()], [sqlite3_create_function()], and +// ** [sqlite3_busy_timeout()] to name but three) that are methods on an +// ** sqlite3 object. +// */ +type Tsqlite3 = struct { + FpVfs uintptr + FpVdbe uintptr + FpDfltColl uintptr + Fmutex uintptr + FaDb uintptr + FnDb int32 + FmDbFlags Tu32 + Fflags Tu64 + FlastRowid Ti64 + FszMmap Ti64 + FnSchemaLock Tu32 + FopenFlags uint32 + FerrCode int32 + FerrByteOffset int32 + FerrMask int32 + FiSysErrno int32 + FdbOptFlags Tu32 + Fenc Tu8 + FautoCommit Tu8 + Ftemp_store Tu8 + FmallocFailed Tu8 + FbBenignMalloc Tu8 + FdfltLockMode Tu8 + FnextAutovac int8 + FsuppressErr Tu8 + FvtabOnConflict Tu8 + FisTransactionSavepoint Tu8 + FmTrace Tu8 + FnoSharedCache Tu8 + FnSqlExec Tu8 + FeOpenState Tu8 + FnextPagesize int32 + FnChange Ti64 + FnTotalChange Ti64 + FaLimit [12]int32 + FnMaxSorterMmap int32 + Finit1 Tsqlite3InitInfo + FnVdbeActive int32 + FnVdbeRead int32 + FnVdbeWrite int32 + FnVdbeExec int32 + FnVDestroy int32 + FnExtension int32 + FaExtension uintptr + Ftrace struct { + FxV2 [0]uintptr + FxLegacy uintptr + } + FpTraceArg uintptr + FxProfile uintptr + FpProfileArg uintptr + FpCommitArg uintptr + FxCommitCallback uintptr + FpRollbackArg uintptr + FxRollbackCallback uintptr + FpUpdateArg uintptr + FxUpdateCallback uintptr + FpAutovacPagesArg uintptr + FxAutovacDestr uintptr + FxAutovacPages uintptr + FpParse uintptr + FpPreUpdateArg uintptr + FxPreUpdateCallback uintptr + FpPreUpdate uintptr + FxWalCallback uintptr + FpWalArg uintptr + FxCollNeeded uintptr + FxCollNeeded16 uintptr + FpCollNeededArg uintptr + FpErr uintptr + Fu1 struct { + FnotUsed1 [0]float64 + FisInterrupted int32 + F__ccgo_pad2 [4]byte + } + Flookaside TLookaside + FxAuth Tsqlite3_xauth + FpAuthArg uintptr + FxProgress uintptr + FpProgressArg uintptr + FnProgressOps uint32 + FnVTrans int32 + FaModule THash + FpVtabCtx uintptr + FaVTrans uintptr + FpDisconnect uintptr + FaFunc THash + FaCollSeq THash + FbusyHandler TBusyHandler + FaDbStatic [2]TDb + FpSavepoint uintptr + FnAnalysisLimit int32 + FbusyTimeout int32 + FnSavepoint int32 + FnStatement int32 + FnDeferredCons Ti64 + FnDeferredImmCons Ti64 + FpnBytesFreed uintptr + FpDbData uintptr + FpBlockingConnection uintptr + FpUnlockConnection uintptr + FpUnlockArg uintptr + FxUnlockNotify uintptr + FpNextBlocked uintptr +} + +type sqlite3 = Tsqlite3 + +// C documentation +// +// /* +// ** CAPI3REF: 64-Bit Integer Types +// ** KEYWORDS: sqlite_int64 sqlite_uint64 +// ** +// ** Because there is no cross-platform way to specify 64-bit integer types +// ** SQLite includes typedefs for 64-bit signed and unsigned integers. +// ** +// ** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +// ** The sqlite_int64 and sqlite_uint64 types are supported for backwards +// ** compatibility only. +// ** +// ** ^The sqlite3_int64 and sqlite_int64 types can store integer values +// ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The +// ** sqlite3_uint64 and sqlite_uint64 types can store integer values +// ** between 0 and +18446744073709551615 inclusive. +// */ +type Tsqlite_int64 = int64 + +type sqlite_int64 = Tsqlite_int64 + +type Tsqlite_uint64 = uint64 + +type sqlite_uint64 = Tsqlite_uint64 + +type Tsqlite3_int64 = int64 + +type sqlite3_int64 = Tsqlite3_int64 + +type Tsqlite3_uint64 = uint64 + +type sqlite3_uint64 = Tsqlite3_uint64 + +// C documentation +// +// /* +// ** The type for a callback function. +// ** This is legacy and deprecated. It is included for historical +// ** compatibility and is not documented. +// */ +type Tsqlite3_callback = uintptr + +type sqlite3_callback = Tsqlite3_callback + +/* +** CAPI3REF: Result Codes +** KEYWORDS: {result code definitions} +** +** Many SQLite functions return an integer result code from the set shown +** here in order to indicate success or failure. +** +** New error codes may be added in future versions of SQLite. +** +** See also: [extended result code definitions] + */ +/* beginning-of-error-codes */ +/* end-of-error-codes */ + +/* +** CAPI3REF: Extended Result Codes +** KEYWORDS: {extended result code definitions} +** +** In its default configuration, SQLite API routines return one of 30 integer +** [result codes]. However, experience has shown that many of +** these result codes are too coarse-grained. They do not provide as +** much information about problems as programmers might like. In an effort to +** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8] +** and later) include +** support for additional result codes that provide more detailed information +** about errors. These [extended result codes] are enabled or disabled +** on a per database connection basis using the +** [sqlite3_extended_result_codes()] API. Or, the extended code for +** the most recent error can be obtained using +** [sqlite3_extended_errcode()]. + */ + +/* +** CAPI3REF: Flags For File Open Operations +** +** These bit values are intended for use in the +** 3rd parameter to the [sqlite3_open_v2()] interface and +** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +** +** Only those flags marked as "Ok for sqlite3_open_v2()" may be +** used as the third argument to the [sqlite3_open_v2()] interface. +** The other flags have historically been ignored by sqlite3_open_v2(), +** though future versions of SQLite might change so that an error is +** raised if any of the disallowed bits are passed into sqlite3_open_v2(). +** Applications should not depend on the historical behavior. +** +** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into +** [sqlite3_open_v2()] does *not* cause the underlying database file +** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into +** [sqlite3_open_v2()] has historically be a no-op and might become an +** error in future versions of SQLite. + */ + +/* Reserved: 0x00F00000 */ +/* Legacy compatibility: */ + +/* +** CAPI3REF: Device Characteristics +** +** The xDeviceCharacteristics method of the [sqlite3_io_methods] +** object returns an integer which is a vector of these +** bit values expressing I/O characteristics of the mass storage +** device that holds the file that the [sqlite3_io_methods] +** refers to. +** +** The SQLITE_IOCAP_ATOMIC property means that all writes of +** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +** mean that writes of blocks that are nnn bytes in size and +** are aligned to an address which is an integer multiple of +** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +** that when data is appended to a file, the data is appended +** first then the size of the file is extended, never the other +** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +** information is written to disk in the same order as calls +** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that +** after reboot following a crash or power loss, the only bytes in a +** file that were written at the application level might have changed +** and that adjacent bytes, even bytes within the same sector are +** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +** flag indicates that a file cannot be deleted when open. The +** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on +** read-only media and cannot be changed even by processes with +** elevated privileges. +** +** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying +** filesystem supports doing multiple write operations atomically when those +** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and +** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. + */ + +/* +** CAPI3REF: File Locking Levels +** +** SQLite uses one of these integer values as the second +** argument to calls it makes to the xLock() and xUnlock() methods +** of an [sqlite3_io_methods] object. These values are ordered from +** lest restrictive to most restrictive. +** +** The argument to xLock() is always SHARED or higher. The argument to +** xUnlock is either SHARED or NONE. + */ + +/* +** CAPI3REF: Synchronization Type Flags +** +** When SQLite invokes the xSync() method of an +** [sqlite3_io_methods] object it uses a combination of +** these integer values as the second argument. +** +** When the SQLITE_SYNC_DATAONLY flag is used, it means that the +** sync operation only needs to flush data to mass storage. Inode +** information need not be flushed. If the lower four bits of the flag +** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. +** If the lower four bits equal SQLITE_SYNC_FULL, that means +** to use Mac OS X style fullsync instead of fsync(). +** +** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags +** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL +** settings. The [synchronous pragma] determines when calls to the +** xSync VFS method occur and applies uniformly across all platforms. +** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how +** energetic or rigorous or forceful the sync operations are and +** only make a difference on Mac OSX for the default SQLite code. +** (Third-party VFS implementations might also make the distinction +** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the +** operating systems natively supported by SQLite, only Mac OSX +** cares about the difference.) + */ + +// C documentation +// +// /* +// ** CAPI3REF: OS Interface Open File Handle +// ** +// ** An [sqlite3_file] object represents an open file in the +// ** [sqlite3_vfs | OS interface layer]. Individual OS interface +// ** implementations will +// ** want to subclass this object by appending additional fields +// ** for their own use. The pMethods entry is a pointer to an +// ** [sqlite3_io_methods] object that defines methods for performing +// ** I/O operations on the open file. +// */ +type Tsqlite3_file = struct { + FpMethods uintptr +} + +type sqlite3_file = Tsqlite3_file + +type Tsqlite3_file1 = struct { + FpMethods uintptr +} + +type sqlite3_file1 = Tsqlite3_file1 + +// C documentation +// +// /* +// ** CAPI3REF: OS Interface File Virtual Methods Object +// ** +// ** Every file opened by the [sqlite3_vfs.xOpen] method populates an +// ** [sqlite3_file] object (or, more commonly, a subclass of the +// ** [sqlite3_file] object) with a pointer to an instance of this object. +// ** This object defines the methods used to perform various operations +// ** against the open file represented by the [sqlite3_file] object. +// ** +// ** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element +// ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method +// ** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The +// ** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] +// ** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element +// ** to NULL. +// ** +// ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or +// ** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). +// ** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] +// ** flag may be ORed in to indicate that only the data of the file +// ** and not its inode needs to be synced. +// ** +// ** The integer values to xLock() and xUnlock() are one of +// **
      +// **
    • [SQLITE_LOCK_NONE], +// **
    • [SQLITE_LOCK_SHARED], +// **
    • [SQLITE_LOCK_RESERVED], +// **
    • [SQLITE_LOCK_PENDING], or +// **
    • [SQLITE_LOCK_EXCLUSIVE]. +// **
    +// ** xLock() upgrades the database file lock. In other words, xLock() moves the +// ** database file lock in the direction NONE toward EXCLUSIVE. The argument to +// ** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never +// ** SQLITE_LOCK_NONE. If the database file lock is already at or above the +// ** requested lock, then the call to xLock() is a no-op. +// ** xUnlock() downgrades the database file lock to either SHARED or NONE. +// * If the lock is already at or below the requested lock state, then the call +// ** to xUnlock() is a no-op. +// ** The xCheckReservedLock() method checks whether any database connection, +// ** either in this process or in some other process, is holding a RESERVED, +// ** PENDING, or EXCLUSIVE lock on the file. It returns true +// ** if such a lock exists and false otherwise. +// ** +// ** The xFileControl() method is a generic interface that allows custom +// ** VFS implementations to directly control an open file using the +// ** [sqlite3_file_control()] interface. The second "op" argument is an +// ** integer opcode. The third argument is a generic pointer intended to +// ** point to a structure that may contain arguments or space in which to +// ** write return values. Potential uses for xFileControl() might be +// ** functions to enable blocking locks with timeouts, to change the +// ** locking strategy (for example to use dot-file locks), to inquire +// ** about the status of a lock, or to break stale locks. The SQLite +// ** core reserves all opcodes less than 100 for its own use. +// ** A [file control opcodes | list of opcodes] less than 100 is available. +// ** Applications that define a custom xFileControl method should use opcodes +// ** greater than 100 to avoid conflicts. VFS implementations should +// ** return [SQLITE_NOTFOUND] for file control opcodes that they do not +// ** recognize. +// ** +// ** The xSectorSize() method returns the sector size of the +// ** device that underlies the file. The sector size is the +// ** minimum write that can be performed without disturbing +// ** other bytes in the file. The xDeviceCharacteristics() +// ** method returns a bit vector describing behaviors of the +// ** underlying device: +// ** +// **
      +// **
    • [SQLITE_IOCAP_ATOMIC] +// **
    • [SQLITE_IOCAP_ATOMIC512] +// **
    • [SQLITE_IOCAP_ATOMIC1K] +// **
    • [SQLITE_IOCAP_ATOMIC2K] +// **
    • [SQLITE_IOCAP_ATOMIC4K] +// **
    • [SQLITE_IOCAP_ATOMIC8K] +// **
    • [SQLITE_IOCAP_ATOMIC16K] +// **
    • [SQLITE_IOCAP_ATOMIC32K] +// **
    • [SQLITE_IOCAP_ATOMIC64K] +// **
    • [SQLITE_IOCAP_SAFE_APPEND] +// **
    • [SQLITE_IOCAP_SEQUENTIAL] +// **
    • [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] +// **
    • [SQLITE_IOCAP_POWERSAFE_OVERWRITE] +// **
    • [SQLITE_IOCAP_IMMUTABLE] +// **
    • [SQLITE_IOCAP_BATCH_ATOMIC] +// **
    +// ** +// ** The SQLITE_IOCAP_ATOMIC property means that all writes of +// ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +// ** mean that writes of blocks that are nnn bytes in size and +// ** are aligned to an address which is an integer multiple of +// ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +// ** that when data is appended to a file, the data is appended +// ** first then the size of the file is extended, never the other +// ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +// ** information is written to disk in the same order as calls +// ** to xWrite(). +// ** +// ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill +// ** in the unread portions of the buffer with zeros. A VFS that +// ** fails to zero-fill short reads might seem to work. However, +// ** failure to zero-fill short reads will eventually lead to +// ** database corruption. +// */ +type Tsqlite3_io_methods = struct { + FiVersion int32 + FxClose uintptr + FxRead uintptr + FxWrite uintptr + FxTruncate uintptr + FxSync uintptr + FxFileSize uintptr + FxLock uintptr + FxUnlock uintptr + FxCheckReservedLock uintptr + FxFileControl uintptr + FxSectorSize uintptr + FxDeviceCharacteristics uintptr + FxShmMap uintptr + FxShmLock uintptr + FxShmBarrier uintptr + FxShmUnmap uintptr + FxFetch uintptr + FxUnfetch uintptr +} + +type sqlite3_io_methods = Tsqlite3_io_methods + +type Tsqlite3_io_methods1 = struct { + FiVersion int32 + FxClose uintptr + FxRead uintptr + FxWrite uintptr + FxTruncate uintptr + FxSync uintptr + FxFileSize uintptr + FxLock uintptr + FxUnlock uintptr + FxCheckReservedLock uintptr + FxFileControl uintptr + FxSectorSize uintptr + FxDeviceCharacteristics uintptr + FxShmMap uintptr + FxShmLock uintptr + FxShmBarrier uintptr + FxShmUnmap uintptr + FxFetch uintptr + FxUnfetch uintptr +} + +type sqlite3_io_methods1 = Tsqlite3_io_methods1 + +/* +** CAPI3REF: Standard File Control Opcodes +** KEYWORDS: {file control opcodes} {file control opcode} +** +** These integer constants are opcodes for the xFileControl method +** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** interface. +** +**
      +**
    • [[SQLITE_FCNTL_LOCKSTATE]] +** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This +** opcode causes the xFileControl method to write the current state of +** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], +** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) +** into an integer that the pArg argument points to. +** This capability is only available if SQLite is compiled with [SQLITE_DEBUG]. +** +**
    • [[SQLITE_FCNTL_SIZE_HINT]] +** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS +** layer a hint of how large the database file will grow to be during the +** current transaction. This hint is not guaranteed to be accurate but it +** is often close. The underlying VFS might choose to preallocate database +** file space based on this hint in order to help writes to the database +** file run faster. +** +**
    • [[SQLITE_FCNTL_SIZE_LIMIT]] +** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that +** implements [sqlite3_deserialize()] to set an upper bound on the size +** of the in-memory database. The argument is a pointer to a [sqlite3_int64]. +** If the integer pointed to is negative, then it is filled in with the +** current limit. Otherwise the limit is set to the larger of the value +** of the integer pointed to and the current database size. The integer +** pointed to is set to the new limit. +** +**
    • [[SQLITE_FCNTL_CHUNK_SIZE]] +** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS +** extends and truncates the database file in chunks of a size specified +** by the user. The fourth argument to [sqlite3_file_control()] should +** point to an integer (type int) containing the new chunk-size to use +** for the nominated database. Allocating database file space in large +** chunks (say 1MB at a time), may reduce file-system fragmentation and +** improve performance on some systems. +** +**
    • [[SQLITE_FCNTL_FILE_POINTER]] +** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with a particular database +** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER]. +** +**
    • [[SQLITE_FCNTL_JOURNAL_POINTER]] +** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer +** to the [sqlite3_file] object associated with the journal file (either +** the [rollback journal] or the [write-ahead log]) for a particular database +** connection. See also [SQLITE_FCNTL_FILE_POINTER]. +** +**
    • [[SQLITE_FCNTL_SYNC_OMITTED]] +** No longer in use. +** +**
    • [[SQLITE_FCNTL_SYNC]] +** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and +** sent to the VFS immediately before the xSync method is invoked on a +** database file descriptor. Or, if the xSync method is not invoked +** because the user has configured SQLite with +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place +** of the xSync method. In most cases, the pointer argument passed with +** this file-control is NULL. However, if the database file is being synced +** as part of a multi-database commit, the argument points to a nul-terminated +** string containing the transactions super-journal file name. VFSes that +** do not need this signal should silently ignore this opcode. Applications +** should not call [sqlite3_file_control()] with this opcode as doing so may +** disrupt the operation of the specialized VFSes that do require it. +** +**
    • [[SQLITE_FCNTL_COMMIT_PHASETWO]] +** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite +** and sent to the VFS after a transaction has been committed immediately +** but before the database is unlocked. VFSes that do not need this signal +** should silently ignore this opcode. Applications should not call +** [sqlite3_file_control()] with this opcode as doing so may disrupt the +** operation of the specialized VFSes that do require it. +** +**
    • [[SQLITE_FCNTL_WIN32_AV_RETRY]] +** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic +** retry counts and intervals for certain disk I/O operations for the +** windows [VFS] in order to provide robustness in the presence of +** anti-virus programs. By default, the windows VFS will retry file read, +** file write, and file delete operations up to 10 times, with a delay +** of 25 milliseconds before the first retry and with the delay increasing +** by an additional 25 milliseconds with each subsequent retry. This +** opcode allows these two values (10 retries and 25 milliseconds of delay) +** to be adjusted. The values are changed for all database connections +** within the same process. The argument is a pointer to an array of two +** integers where the first integer is the new retry count and the second +** integer is the delay. If either integer is negative, then the setting +** is not changed but instead the prior value of that setting is written +** into the array entry, allowing the current retry settings to be +** interrogated. The zDbName parameter is ignored. +** +**
    • [[SQLITE_FCNTL_PERSIST_WAL]] +** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the +** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary +** write ahead log ([WAL file]) and shared memory +** files used for transaction control +** are automatically deleted when the latest connection to the database +** closes. Setting persistent WAL mode causes those files to persist after +** close. Persisting the files is useful when other processes that do not +** have write permission on the directory containing the database file want +** to read the database file, as the WAL and shared memory files must exist +** in order for the database to be readable. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable persistent WAL mode or 1 to enable persistent +** WAL mode. If the integer is -1, then it is overwritten with the current +** WAL persistence setting. +** +**
    • [[SQLITE_FCNTL_POWERSAFE_OVERWRITE]] +** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the +** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting +** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the +** xDeviceCharacteristics methods. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage +** mode. If the integer is -1, then it is overwritten with the current +** zero-damage mode setting. +** +**
    • [[SQLITE_FCNTL_OVERWRITE]] +** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening +** a write transaction to indicate that, unless it is rolled back for some +** reason, the entire database file will be overwritten by the current +** transaction. This is used by VACUUM operations. +** +**
    • [[SQLITE_FCNTL_VFSNAME]] +** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of +** all [VFSes] in the VFS stack. The names are of all VFS shims and the +** final bottom-level VFS are written into memory obtained from +** [sqlite3_malloc()] and the result is stored in the char* variable +** that the fourth parameter of [sqlite3_file_control()] points to. +** The caller is responsible for freeing the memory when done. As with +** all file-control actions, there is no guarantee that this will actually +** do anything. Callers should initialize the char* variable to a NULL +** pointer in case this file-control is not implemented. This file-control +** is intended for diagnostic use only. +** +**
    • [[SQLITE_FCNTL_VFS_POINTER]] +** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level +** [VFSes] currently in use. ^(The argument X in +** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be +** of type "[sqlite3_vfs] **". This opcodes will set *X +** to a pointer to the top-level VFS.)^ +** ^When there are multiple VFS shims in the stack, this opcode finds the +** upper-most shim only. +** +**
    • [[SQLITE_FCNTL_PRAGMA]] +** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] +** file control is sent to the open [sqlite3_file] object corresponding +** to the database file to which the pragma statement refers. ^The argument +** to the [SQLITE_FCNTL_PRAGMA] file control is an array of +** pointers to strings (char**) in which the second element of the array +** is the name of the pragma and the third element is the argument to the +** pragma or NULL if the pragma has no argument. ^The handler for an +** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element +** of the char** argument point to a string obtained from [sqlite3_mprintf()] +** or the equivalent and that string will become the result of the pragma or +** the error message if the pragma fails. ^If the +** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal +** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] +** file control returns [SQLITE_OK], then the parser assumes that the +** VFS has handled the PRAGMA itself and the parser generates a no-op +** prepared statement if result string is NULL, or that returns a copy +** of the result string if the string is non-NULL. +** ^If the [SQLITE_FCNTL_PRAGMA] file control returns +** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means +** that the VFS encountered an error while handling the [PRAGMA] and the +** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] +** file control occurs at the beginning of pragma statement analysis and so +** it is able to override built-in [PRAGMA] statements. +** +**
    • [[SQLITE_FCNTL_BUSYHANDLER]] +** ^The [SQLITE_FCNTL_BUSYHANDLER] +** file-control may be invoked by SQLite on the database file handle +** shortly after it is opened in order to provide a custom VFS with access +** to the connection's busy-handler callback. The argument is of type (void**) +** - an array of two (void *) values. The first (void *) actually points +** to a function of type (int (*)(void *)). In order to invoke the connection's +** busy-handler, this function should be invoked with the second (void *) in +** the array as the only argument. If it returns non-zero, then the operation +** should be retried. If it returns zero, the custom VFS should abandon the +** current operation. +** +**
    • [[SQLITE_FCNTL_TEMPFILENAME]] +** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control +** to have SQLite generate a +** temporary filename using the same algorithm that is followed to generate +** temporary filenames for TEMP tables and other internal uses. The +** argument should be a char** which will be filled with the filename +** written into memory obtained from [sqlite3_malloc()]. The caller should +** invoke [sqlite3_free()] on the result to avoid a memory leak. +** +**
    • [[SQLITE_FCNTL_MMAP_SIZE]] +** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the +** maximum number of bytes that will be used for memory-mapped I/O. +** The argument is a pointer to a value of type sqlite3_int64 that +** is an advisory maximum number of bytes in the file to memory map. The +** pointer is overwritten with the old value. The limit is not changed if +** the value originally pointed to is negative, and so the current limit +** can be queried by passing in a pointer to a negative number. This +** file-control is used internally to implement [PRAGMA mmap_size]. +** +**
    • [[SQLITE_FCNTL_TRACE]] +** The [SQLITE_FCNTL_TRACE] file control provides advisory information +** to the VFS about what the higher layers of the SQLite stack are doing. +** This file control is used by some VFS activity tracing [shims]. +** The argument is a zero-terminated string. Higher layers in the +** SQLite stack may generate instances of this file control if +** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled. +** +**
    • [[SQLITE_FCNTL_HAS_MOVED]] +** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a +** pointer to an integer and it writes a boolean into that integer depending +** on whether or not the file has been renamed, moved, or deleted since it +** was first opened. +** +**
    • [[SQLITE_FCNTL_WIN32_GET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the +** underlying native file handle associated with a file handle. This file +** control interprets its argument as a pointer to a native file handle and +** writes the resulting value there. +** +**
    • [[SQLITE_FCNTL_WIN32_SET_HANDLE]] +** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This +** opcode causes the xFileControl method to swap the file handle with the one +** pointed to by the pArg argument. This capability is used during testing +** and only needs to be supported when SQLITE_TEST is defined. +** +**
    • [[SQLITE_FCNTL_WAL_BLOCK]] +** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might +** be advantageous to block on the next WAL lock if the lock is not immediately +** available. The WAL subsystem issues this signal during rare +** circumstances in order to fix a problem with priority inversion. +** Applications should not use this file-control. +** +**
    • [[SQLITE_FCNTL_ZIPVFS]] +** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other +** VFS should return SQLITE_NOTFOUND for this opcode. +** +**
    • [[SQLITE_FCNTL_RBU]] +** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by +** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for +** this opcode. +** +**
    • [[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]] +** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then +** the file descriptor is placed in "batch write mode", which +** means all subsequent write operations will be deferred and done +** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems +** that do not support batch atomic writes will return SQLITE_NOTFOUND. +** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to +** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or +** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make +** no VFS interface calls on the same [sqlite3_file] file descriptor +** except for calls to the xWrite method and the xFileControl method +** with [SQLITE_FCNTL_SIZE_HINT]. +** +**
    • [[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically. +** This file control returns [SQLITE_OK] if and only if the writes were +** all performed successfully and have been committed to persistent storage. +** ^Regardless of whether or not it is successful, this file control takes +** the file descriptor out of batch write mode so that all subsequent +** write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
    • [[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]] +** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write +** operations since the previous successful call to +** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back. +** ^This file control takes the file descriptor out of batch write mode +** so that all subsequent write operations are independent. +** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without +** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. +** +**
    • [[SQLITE_FCNTL_LOCK_TIMEOUT]] +** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS +** to block for up to M milliseconds before failing when attempting to +** obtain a file lock using the xLock or xShmLock methods of the VFS. +** The parameter is a pointer to a 32-bit signed integer that contains +** the value that M is to be set to. Before returning, the 32-bit signed +** integer is overwritten with the previous value of M. +** +**
    • [[SQLITE_FCNTL_DATA_VERSION]] +** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to +** a database file. The argument is a pointer to a 32-bit unsigned integer. +** The "data version" for the pager is written into the pointer. The +** "data version" changes whenever any change occurs to the corresponding +** database file, either through SQL statements on the same database +** connection or through transactions committed by separate database +** connections possibly in other processes. The [sqlite3_total_changes()] +** interface can be used to find if any database on the connection has changed, +** but that interface responds to changes on TEMP as well as MAIN and does +** not provide a mechanism to detect changes to MAIN only. Also, the +** [sqlite3_total_changes()] interface responds to internal changes only and +** omits changes made by other database connections. The +** [PRAGMA data_version] command provides a mechanism to detect changes to +** a single attached database that occur due to other database connections, +** but omits changes implemented by the database connection on which it is +** called. This file control is the only mechanism to detect changes that +** happen either internally or externally and that are associated with +** a particular attached database. +** +**
    • [[SQLITE_FCNTL_CKPT_START]] +** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint +** in wal mode before the client starts to copy pages from the wal +** file to the database file. +** +**
    • [[SQLITE_FCNTL_CKPT_DONE]] +** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint +** in wal mode after the client has finished copying pages from the wal +** file to the database file, but before the *-shm file is updated to +** record the fact that the pages have been checkpointed. +** +**
    • [[SQLITE_FCNTL_EXTERNAL_READER]] +** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect +** whether or not there is a database client in another process with a wal-mode +** transaction open on the database or not. It is only available on unix.The +** (void*) argument passed with this file-control should be a pointer to a +** value of type (int). The integer value is set to 1 if the database is a wal +** mode database and there exists at least one client in another process that +** currently has an SQL transaction open on the database. It is set to 0 if +** the database is not a wal-mode db, or if there is no such connection in any +** other process. This opcode cannot be used to detect transactions opened +** by clients within the current process, only within other processes. +** +**
    • [[SQLITE_FCNTL_CKSM_FILE]] +** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the +** [checksum VFS shim] only. +** +**
    • [[SQLITE_FCNTL_RESET_CACHE]] +** If there is currently no transaction open on the database, and the +** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control +** purges the contents of the in-memory page cache. If there is an open +** transaction, or if the db is a temp-db, this opcode is a no-op, not an error. +**
    + */ + +/* deprecated names */ + +// C documentation +// +// /* +// ** CAPI3REF: Mutex Handle +// ** +// ** The mutex module within SQLite defines [sqlite3_mutex] to be an +// ** abstract type for a mutex object. The SQLite core never looks +// ** at the internal representation of an [sqlite3_mutex]. It only +// ** deals with pointers to the [sqlite3_mutex] object. +// ** +// ** Mutexes are created using [sqlite3_mutex_alloc()]. +// */ +type Tsqlite3_mutex = struct { + Fmutex Tpthread_mutex_t +} + +type sqlite3_mutex = Tsqlite3_mutex + +// C documentation +// +// /* +// ** CAPI3REF: Loadable Extension Thunk +// ** +// ** A pointer to the opaque sqlite3_api_routines structure is passed as +// ** the third parameter to entry points of [loadable extensions]. This +// ** structure must be typedefed in order to work around compiler warnings +// ** on some platforms. +// */ +type Tsqlite3_api_routines = struct { + Faggregate_context uintptr + Faggregate_count uintptr + Fbind_blob uintptr + Fbind_double uintptr + Fbind_int uintptr + Fbind_int64 uintptr + Fbind_null uintptr + Fbind_parameter_count uintptr + Fbind_parameter_index uintptr + Fbind_parameter_name uintptr + Fbind_text uintptr + Fbind_text16 uintptr + Fbind_value uintptr + Fbusy_handler uintptr + Fbusy_timeout uintptr + Fchanges uintptr + Fclose1 uintptr + Fcollation_needed uintptr + Fcollation_needed16 uintptr + Fcolumn_blob uintptr + Fcolumn_bytes uintptr + Fcolumn_bytes16 uintptr + Fcolumn_count uintptr + Fcolumn_database_name uintptr + Fcolumn_database_name16 uintptr + Fcolumn_decltype uintptr + Fcolumn_decltype16 uintptr + Fcolumn_double uintptr + Fcolumn_int uintptr + Fcolumn_int64 uintptr + Fcolumn_name uintptr + Fcolumn_name16 uintptr + Fcolumn_origin_name uintptr + Fcolumn_origin_name16 uintptr + Fcolumn_table_name uintptr + Fcolumn_table_name16 uintptr + Fcolumn_text uintptr + Fcolumn_text16 uintptr + Fcolumn_type uintptr + Fcolumn_value uintptr + Fcommit_hook uintptr + Fcomplete uintptr + Fcomplete16 uintptr + Fcreate_collation uintptr + Fcreate_collation16 uintptr + Fcreate_function uintptr + Fcreate_function16 uintptr + Fcreate_module uintptr + Fdata_count uintptr + Fdb_handle uintptr + Fdeclare_vtab uintptr + Fenable_shared_cache uintptr + Ferrcode uintptr + Ferrmsg uintptr + Ferrmsg16 uintptr + Fexec uintptr + Fexpired uintptr + Ffinalize uintptr + Ffree uintptr + Ffree_table uintptr + Fget_autocommit uintptr + Fget_auxdata uintptr + Fget_table uintptr + Fglobal_recover uintptr + Finterruptx uintptr + Flast_insert_rowid uintptr + Flibversion uintptr + Flibversion_number uintptr + Fmalloc uintptr + Fmprintf uintptr + Fopen uintptr + Fopen16 uintptr + Fprepare uintptr + Fprepare16 uintptr + Fprofile uintptr + Fprogress_handler uintptr + Frealloc uintptr + Freset uintptr + Fresult_blob uintptr + Fresult_double uintptr + Fresult_error uintptr + Fresult_error16 uintptr + Fresult_int uintptr + Fresult_int64 uintptr + Fresult_null uintptr + Fresult_text uintptr + Fresult_text16 uintptr + Fresult_text16be uintptr + Fresult_text16le uintptr + Fresult_value uintptr + Frollback_hook uintptr + Fset_authorizer uintptr + Fset_auxdata uintptr + Fxsnprintf uintptr + Fstep uintptr + Ftable_column_metadata uintptr + Fthread_cleanup uintptr + Ftotal_changes uintptr + Ftrace uintptr + Ftransfer_bindings uintptr + Fupdate_hook uintptr + Fuser_data uintptr + Fvalue_blob uintptr + Fvalue_bytes uintptr + Fvalue_bytes16 uintptr + Fvalue_double uintptr + Fvalue_int uintptr + Fvalue_int64 uintptr + Fvalue_numeric_type uintptr + Fvalue_text uintptr + Fvalue_text16 uintptr + Fvalue_text16be uintptr + Fvalue_text16le uintptr + Fvalue_type uintptr + Fvmprintf uintptr + Foverload_function uintptr + Fprepare_v2 uintptr + Fprepare16_v2 uintptr + Fclear_bindings uintptr + Fcreate_module_v2 uintptr + Fbind_zeroblob uintptr + Fblob_bytes uintptr + Fblob_close uintptr + Fblob_open uintptr + Fblob_read uintptr + Fblob_write uintptr + Fcreate_collation_v2 uintptr + Ffile_control uintptr + Fmemory_highwater uintptr + Fmemory_used uintptr + Fmutex_alloc uintptr + Fmutex_enter uintptr + Fmutex_free uintptr + Fmutex_leave uintptr + Fmutex_try uintptr + Fopen_v2 uintptr + Frelease_memory uintptr + Fresult_error_nomem uintptr + Fresult_error_toobig uintptr + Fsleep uintptr + Fsoft_heap_limit uintptr + Fvfs_find uintptr + Fvfs_register uintptr + Fvfs_unregister uintptr + Fxthreadsafe uintptr + Fresult_zeroblob uintptr + Fresult_error_code uintptr + Ftest_control uintptr + Frandomness uintptr + Fcontext_db_handle uintptr + Fextended_result_codes uintptr + Flimit uintptr + Fnext_stmt uintptr + Fsql uintptr + Fstatus uintptr + Fbackup_finish uintptr + Fbackup_init uintptr + Fbackup_pagecount uintptr + Fbackup_remaining uintptr + Fbackup_step uintptr + Fcompileoption_get uintptr + Fcompileoption_used uintptr + Fcreate_function_v2 uintptr + Fdb_config uintptr + Fdb_mutex uintptr + Fdb_status uintptr + Fextended_errcode uintptr + Flog uintptr + Fsoft_heap_limit64 uintptr + Fsourceid uintptr + Fstmt_status uintptr + Fstrnicmp uintptr + Funlock_notify uintptr + Fwal_autocheckpoint uintptr + Fwal_checkpoint uintptr + Fwal_hook uintptr + Fblob_reopen uintptr + Fvtab_config uintptr + Fvtab_on_conflict uintptr + Fclose_v2 uintptr + Fdb_filename uintptr + Fdb_readonly uintptr + Fdb_release_memory uintptr + Ferrstr uintptr + Fstmt_busy uintptr + Fstmt_readonly uintptr + Fstricmp uintptr + Furi_boolean uintptr + Furi_int64 uintptr + Furi_parameter uintptr + Fxvsnprintf uintptr + Fwal_checkpoint_v2 uintptr + Fauto_extension uintptr + Fbind_blob64 uintptr + Fbind_text64 uintptr + Fcancel_auto_extension uintptr + Fload_extension uintptr + Fmalloc64 uintptr + Fmsize uintptr + Frealloc64 uintptr + Freset_auto_extension uintptr + Fresult_blob64 uintptr + Fresult_text64 uintptr + Fstrglob uintptr + Fvalue_dup uintptr + Fvalue_free uintptr + Fresult_zeroblob64 uintptr + Fbind_zeroblob64 uintptr + Fvalue_subtype uintptr + Fresult_subtype uintptr + Fstatus64 uintptr + Fstrlike uintptr + Fdb_cacheflush uintptr + Fsystem_errno uintptr + Ftrace_v2 uintptr + Fexpanded_sql uintptr + Fset_last_insert_rowid uintptr + Fprepare_v3 uintptr + Fprepare16_v3 uintptr + Fbind_pointer uintptr + Fresult_pointer uintptr + Fvalue_pointer uintptr + Fvtab_nochange uintptr + Fvalue_nochange uintptr + Fvtab_collation uintptr + Fkeyword_count uintptr + Fkeyword_name uintptr + Fkeyword_check uintptr + Fstr_new uintptr + Fstr_finish uintptr + Fstr_appendf uintptr + Fstr_vappendf uintptr + Fstr_append uintptr + Fstr_appendall uintptr + Fstr_appendchar uintptr + Fstr_reset uintptr + Fstr_errcode uintptr + Fstr_length uintptr + Fstr_value uintptr + Fcreate_window_function uintptr + Fnormalized_sql uintptr + Fstmt_isexplain uintptr + Fvalue_frombind uintptr + Fdrop_modules uintptr + Fhard_heap_limit64 uintptr + Furi_key uintptr + Ffilename_database uintptr + Ffilename_journal uintptr + Ffilename_wal uintptr + Fcreate_filename uintptr + Ffree_filename uintptr + Fdatabase_file_object uintptr + Ftxn_state uintptr + Fchanges64 uintptr + Ftotal_changes64 uintptr + Fautovacuum_pages uintptr + Ferror_offset uintptr + Fvtab_rhs_value uintptr + Fvtab_distinct uintptr + Fvtab_in uintptr + Fvtab_in_first uintptr + Fvtab_in_next uintptr + Fdeserialize uintptr + Fserialize uintptr + Fdb_name uintptr + Fvalue_encoding uintptr + Fis_interrupted uintptr + Fstmt_explain uintptr + Fget_clientdata uintptr + Fset_clientdata uintptr +} + +type sqlite3_api_routines = Tsqlite3_api_routines + +// C documentation +// +// /* +// ** CAPI3REF: File Name +// ** +// ** Type [sqlite3_filename] is used by SQLite to pass filenames to the +// ** xOpen method of a [VFS]. It may be cast to (const char*) and treated +// ** as a normal, nul-terminated, UTF-8 buffer containing the filename, but +// ** may also be passed to special APIs such as: +// ** +// **
      +// **
    • sqlite3_filename_database() +// **
    • sqlite3_filename_journal() +// **
    • sqlite3_filename_wal() +// **
    • sqlite3_uri_parameter() +// **
    • sqlite3_uri_boolean() +// **
    • sqlite3_uri_int64() +// **
    • sqlite3_uri_key() +// **
    +// */ +type Tsqlite3_filename = uintptr + +type sqlite3_filename = Tsqlite3_filename + +// C documentation +// +// /* +// ** CAPI3REF: OS Interface Object +// ** +// ** An instance of the sqlite3_vfs object defines the interface between +// ** the SQLite core and the underlying operating system. The "vfs" +// ** in the name of the object stands for "virtual file system". See +// ** the [VFS | VFS documentation] for further information. +// ** +// ** The VFS interface is sometimes extended by adding new methods onto +// ** the end. Each time such an extension occurs, the iVersion field +// ** is incremented. The iVersion value started out as 1 in +// ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 +// ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased +// ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields +// ** may be appended to the sqlite3_vfs object and the iVersion value +// ** may increase again in future versions of SQLite. +// ** Note that due to an oversight, the structure +// ** of the sqlite3_vfs object changed in the transition from +// ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] +// ** and yet the iVersion field was not increased. +// ** +// ** The szOsFile field is the size of the subclassed [sqlite3_file] +// ** structure used by this VFS. mxPathname is the maximum length of +// ** a pathname in this VFS. +// ** +// ** Registered sqlite3_vfs objects are kept on a linked list formed by +// ** the pNext pointer. The [sqlite3_vfs_register()] +// ** and [sqlite3_vfs_unregister()] interfaces manage this list +// ** in a thread-safe way. The [sqlite3_vfs_find()] interface +// ** searches the list. Neither the application code nor the VFS +// ** implementation should use the pNext pointer. +// ** +// ** The pNext field is the only field in the sqlite3_vfs +// ** structure that SQLite will ever modify. SQLite will only access +// ** or modify this field while holding a particular static mutex. +// ** The application should never modify anything within the sqlite3_vfs +// ** object once the object has been registered. +// ** +// ** The zName field holds the name of the VFS module. The name must +// ** be unique across all VFS modules. +// ** +// ** [[sqlite3_vfs.xOpen]] +// ** ^SQLite guarantees that the zFilename parameter to xOpen +// ** is either a NULL pointer or string obtained +// ** from xFullPathname() with an optional suffix added. +// ** ^If a suffix is added to the zFilename parameter, it will +// ** consist of a single "-" character followed by no more than +// ** 11 alphanumeric and/or "-" characters. +// ** ^SQLite further guarantees that +// ** the string will be valid and unchanged until xClose() is +// ** called. Because of the previous sentence, +// ** the [sqlite3_file] can safely store a pointer to the +// ** filename if it needs to remember the filename for some reason. +// ** If the zFilename parameter to xOpen is a NULL pointer then xOpen +// ** must invent its own temporary name for the file. ^Whenever the +// ** xFilename parameter is NULL it will also be the case that the +// ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. +// ** +// ** The flags argument to xOpen() includes all bits set in +// ** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] +// ** or [sqlite3_open16()] is used, then flags includes at least +// ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +// ** If xOpen() opens a file read-only then it sets *pOutFlags to +// ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. +// ** +// ** ^(SQLite will also add one of the following flags to the xOpen() +// ** call, depending on the object being opened: +// ** +// **
      +// **
    • [SQLITE_OPEN_MAIN_DB] +// **
    • [SQLITE_OPEN_MAIN_JOURNAL] +// **
    • [SQLITE_OPEN_TEMP_DB] +// **
    • [SQLITE_OPEN_TEMP_JOURNAL] +// **
    • [SQLITE_OPEN_TRANSIENT_DB] +// **
    • [SQLITE_OPEN_SUBJOURNAL] +// **
    • [SQLITE_OPEN_SUPER_JOURNAL] +// **
    • [SQLITE_OPEN_WAL] +// **
    )^ +// ** +// ** The file I/O implementation can use the object type flags to +// ** change the way it deals with files. For example, an application +// ** that does not care about crash recovery or rollback might make +// ** the open of a journal file a no-op. Writes to this journal would +// ** also be no-ops, and any attempt to read the journal would return +// ** SQLITE_IOERR. Or the implementation might recognize that a database +// ** file will be doing page-aligned sector reads and writes in a random +// ** order and set up its I/O subsystem accordingly. +// ** +// ** SQLite might also add one of the following flags to the xOpen method: +// ** +// **
      +// **
    • [SQLITE_OPEN_DELETEONCLOSE] +// **
    • [SQLITE_OPEN_EXCLUSIVE] +// **
    +// ** +// ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be +// ** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] +// ** will be set for TEMP databases and their journals, transient +// ** databases, and subjournals. +// ** +// ** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction +// ** with the [SQLITE_OPEN_CREATE] flag, which are both directly +// ** analogous to the O_EXCL and O_CREAT flags of the POSIX open() +// ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +// ** SQLITE_OPEN_CREATE, is used to indicate that file should always +// ** be created, and that it is an error if it already exists. +// ** It is not used to indicate the file should be opened +// ** for exclusive access. +// ** +// ** ^At least szOsFile bytes of memory are allocated by SQLite +// ** to hold the [sqlite3_file] structure passed as the third +// ** argument to xOpen. The xOpen method does not have to +// ** allocate the structure; it should just fill it in. Note that +// ** the xOpen method must set the sqlite3_file.pMethods to either +// ** a valid [sqlite3_io_methods] object or to NULL. xOpen must do +// ** this even if the open fails. SQLite expects that the sqlite3_file.pMethods +// ** element will be valid after xOpen returns regardless of the success +// ** or failure of the xOpen call. +// ** +// ** [[sqlite3_vfs.xAccess]] +// ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] +// ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to +// ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] +// ** to test whether a file is at least readable. The SQLITE_ACCESS_READ +// ** flag is never actually used and is not implemented in the built-in +// ** VFSes of SQLite. The file is named by the second argument and can be a +// ** directory. The xAccess method returns [SQLITE_OK] on success or some +// ** non-zero error code if there is an I/O error or if the name of +// ** the file given in the second argument is illegal. If SQLITE_OK +// ** is returned, then non-zero or zero is written into *pResOut to indicate +// ** whether or not the file is accessible. +// ** +// ** ^SQLite will always allocate at least mxPathname+1 bytes for the +// ** output buffer xFullPathname. The exact size of the output buffer +// ** is also passed as a parameter to both methods. If the output buffer +// ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is +// ** handled as a fatal error by SQLite, vfs implementations should endeavor +// ** to prevent this by setting mxPathname to a sufficiently large value. +// ** +// ** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() +// ** interfaces are not strictly a part of the filesystem, but they are +// ** included in the VFS structure for completeness. +// ** The xRandomness() function attempts to return nBytes bytes +// ** of good-quality randomness into zOut. The return value is +// ** the actual number of bytes of randomness obtained. +// ** The xSleep() method causes the calling thread to sleep for at +// ** least the number of microseconds given. ^The xCurrentTime() +// ** method returns a Julian Day Number for the current date and time as +// ** a floating point value. +// ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian +// ** Day Number multiplied by 86400000 (the number of milliseconds in +// ** a 24-hour day). +// ** ^SQLite will use the xCurrentTimeInt64() method to get the current +// ** date and time if that method is available (if iVersion is 2 or +// ** greater and the function pointer is not NULL) and will fall back +// ** to xCurrentTime() if xCurrentTimeInt64() is unavailable. +// ** +// ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces +// ** are not used by the SQLite core. These optional interfaces are provided +// ** by some VFSes to facilitate testing of the VFS code. By overriding +// ** system calls with functions under its control, a test program can +// ** simulate faults and error conditions that would otherwise be difficult +// ** or impossible to induce. The set of system calls that can be overridden +// ** varies from one VFS to another, and from one version of the same VFS to the +// ** next. Applications that use these interfaces must be prepared for any +// ** or all of these interfaces to be NULL or for their behavior to change +// ** from one release to the next. Applications must not attempt to access +// ** any of these methods if the iVersion of the VFS is less than 3. +// */ +type Tsqlite3_vfs = struct { + FiVersion int32 + FszOsFile int32 + FmxPathname int32 + FpNext uintptr + FzName uintptr + FpAppData uintptr + FxOpen uintptr + FxDelete uintptr + FxAccess uintptr + FxFullPathname uintptr + FxDlOpen uintptr + FxDlError uintptr + FxDlSym uintptr + FxDlClose uintptr + FxRandomness uintptr + FxSleep uintptr + FxCurrentTime uintptr + FxGetLastError uintptr + FxCurrentTimeInt64 uintptr + FxSetSystemCall uintptr + FxGetSystemCall uintptr + FxNextSystemCall uintptr +} + +type sqlite3_vfs = Tsqlite3_vfs + +type Tsqlite3_syscall_ptr = uintptr + +type sqlite3_syscall_ptr = Tsqlite3_syscall_ptr + +type Tsqlite3_vfs1 = struct { + FiVersion int32 + FszOsFile int32 + FmxPathname int32 + FpNext uintptr + FzName uintptr + FpAppData uintptr + FxOpen uintptr + FxDelete uintptr + FxAccess uintptr + FxFullPathname uintptr + FxDlOpen uintptr + FxDlError uintptr + FxDlSym uintptr + FxDlClose uintptr + FxRandomness uintptr + FxSleep uintptr + FxCurrentTime uintptr + FxGetLastError uintptr + FxCurrentTimeInt64 uintptr + FxSetSystemCall uintptr + FxGetSystemCall uintptr + FxNextSystemCall uintptr +} + +type sqlite3_vfs1 = Tsqlite3_vfs1 + +// C documentation +// +// /* +// ** CAPI3REF: Memory Allocation Routines +// ** +// ** An instance of this object defines the interface between SQLite +// ** and low-level memory allocation routines. +// ** +// ** This object is used in only one place in the SQLite interface. +// ** A pointer to an instance of this object is the argument to +// ** [sqlite3_config()] when the configuration option is +// ** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +// ** By creating an instance of this object +// ** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +// ** during configuration, an application can specify an alternative +// ** memory allocation subsystem for SQLite to use for all of its +// ** dynamic memory needs. +// ** +// ** Note that SQLite comes with several [built-in memory allocators] +// ** that are perfectly adequate for the overwhelming majority of applications +// ** and that this object is only useful to a tiny minority of applications +// ** with specialized memory allocation requirements. This object is +// ** also used during testing of SQLite in order to specify an alternative +// ** memory allocator that simulates memory out-of-memory conditions in +// ** order to verify that SQLite recovers gracefully from such +// ** conditions. +// ** +// ** The xMalloc, xRealloc, and xFree methods must work like the +// ** malloc(), realloc() and free() functions from the standard C library. +// ** ^SQLite guarantees that the second argument to +// ** xRealloc is always a value returned by a prior call to xRoundup. +// ** +// ** xSize should return the allocated size of a memory allocation +// ** previously obtained from xMalloc or xRealloc. The allocated size +// ** is always at least as big as the requested size but may be larger. +// ** +// ** The xRoundup method returns what would be the allocated size of +// ** a memory allocation given a particular requested size. Most memory +// ** allocators round up memory allocations at least to the next multiple +// ** of 8. Some allocators round up to a larger multiple or to a power of 2. +// ** Every memory allocation request coming in through [sqlite3_malloc()] +// ** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +// ** that causes the corresponding memory allocation to fail. +// ** +// ** The xInit method initializes the memory allocator. For example, +// ** it might allocate any required mutexes or initialize internal data +// ** structures. The xShutdown method is invoked (indirectly) by +// ** [sqlite3_shutdown()] and should deallocate any resources acquired +// ** by xInit. The pAppData pointer is used as the only parameter to +// ** xInit and xShutdown. +// ** +// ** SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes +// ** the xInit method, so the xInit method need not be threadsafe. The +// ** xShutdown method is only called from [sqlite3_shutdown()] so it does +// ** not need to be threadsafe either. For all other methods, SQLite +// ** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the +// ** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which +// ** it is by default) and so the methods are automatically serialized. +// ** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other +// ** methods must be threadsafe or else make their own arrangements for +// ** serialization. +// ** +// ** SQLite will never invoke xInit() more than once without an intervening +// ** call to xShutdown(). +// */ +type Tsqlite3_mem_methods = struct { + FxMalloc uintptr + FxFree uintptr + FxRealloc uintptr + FxSize uintptr + FxRoundup uintptr + FxInit uintptr + FxShutdown uintptr + FpAppData uintptr +} + +type sqlite3_mem_methods = Tsqlite3_mem_methods + +type Tsqlite3_mem_methods1 = struct { + FxMalloc uintptr + FxFree uintptr + FxRealloc uintptr + FxSize uintptr + FxRoundup uintptr + FxInit uintptr + FxShutdown uintptr + FpAppData uintptr +} + +type sqlite3_mem_methods1 = Tsqlite3_mem_methods1 + +// C documentation +// +// /* +// ** CAPI3REF: Dynamically Typed Value Object +// ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +// ** +// ** SQLite uses the sqlite3_value object to represent all values +// ** that can be stored in a database table. SQLite uses dynamic typing +// ** for the values it stores. ^Values stored in sqlite3_value objects +// ** can be integers, floating point values, strings, BLOBs, or NULL. +// ** +// ** An sqlite3_value object may be either "protected" or "unprotected". +// ** Some interfaces require a protected sqlite3_value. Other interfaces +// ** will accept either a protected or an unprotected sqlite3_value. +// ** Every interface that accepts sqlite3_value arguments specifies +// ** whether or not it requires a protected sqlite3_value. The +// ** [sqlite3_value_dup()] interface can be used to construct a new +// ** protected sqlite3_value from an unprotected sqlite3_value. +// ** +// ** The terms "protected" and "unprotected" refer to whether or not +// ** a mutex is held. An internal mutex is held for a protected +// ** sqlite3_value object but no mutex is held for an unprotected +// ** sqlite3_value object. If SQLite is compiled to be single-threaded +// ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +// ** or if SQLite is run in one of reduced mutex modes +// ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] +// ** then there is no distinction between protected and unprotected +// ** sqlite3_value objects and they can be used interchangeably. However, +// ** for maximum code portability it is recommended that applications +// ** still make the distinction between protected and unprotected +// ** sqlite3_value objects even when not strictly required. +// ** +// ** ^The sqlite3_value objects that are passed as parameters into the +// ** implementation of [application-defined SQL functions] are protected. +// ** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()] +// ** are protected. +// ** ^The sqlite3_value object returned by +// ** [sqlite3_column_value()] is unprotected. +// ** Unprotected sqlite3_value objects may only be used as arguments +// ** to [sqlite3_result_value()], [sqlite3_bind_value()], and +// ** [sqlite3_value_dup()]. +// ** The [sqlite3_value_blob | sqlite3_value_type()] family of +// ** interfaces require protected sqlite3_value objects. +// */ +type Tsqlite3_value = struct { + Fu TMemValue + Fz uintptr + Fn int32 + Fflags Tu16 + Fenc Tu8 + FeSubtype Tu8 + Fdb uintptr + FszMalloc int32 + FuTemp Tu32 + FzMalloc uintptr + FxDel uintptr +} + +type sqlite3_value = Tsqlite3_value + +// C documentation +// +// /* +// ** CAPI3REF: SQL Function Context Object +// ** +// ** The context in which an SQL function executes is stored in an +// ** sqlite3_context object. ^A pointer to an sqlite3_context object +// ** is always first parameter to [application-defined SQL functions]. +// ** The application-defined SQL function implementation will pass this +// ** pointer through into calls to [sqlite3_result_int | sqlite3_result()], +// ** [sqlite3_aggregate_context()], [sqlite3_user_data()], +// ** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], +// ** and/or [sqlite3_set_auxdata()]. +// */ +type Tsqlite3_context = struct { + FpOut uintptr + FpFunc uintptr + FpMem uintptr + FpVdbe uintptr + FiOp int32 + FisError int32 + Fenc Tu8 + FskipFlag Tu8 + Fargc Tu8 + Fargv [1]uintptr +} + +type sqlite3_context = Tsqlite3_context + +// C documentation +// +// /* +// ** CAPI3REF: Constants Defining Special Destructor Behavior +// ** +// ** These are special values for the destructor that is passed in as the +// ** final argument to routines like [sqlite3_result_blob()]. ^If the destructor +// ** argument is SQLITE_STATIC, it means that the content pointer is constant +// ** and will never change. It does not need to be destroyed. ^The +// ** SQLITE_TRANSIENT value means that the content will likely change in +// ** the near future and that SQLite should make its own private copy of +// ** the content before returning. +// ** +// ** The typedef is necessary to work around problems in certain +// ** C++ compilers. +// */ +type Tsqlite3_destructor_type = uintptr + +type sqlite3_destructor_type = Tsqlite3_destructor_type + +// C documentation +// +// /* +// ** Structures used by the virtual table interface +// */ +type Tsqlite3_vtab = struct { + FpModule uintptr + FnRef int32 + FzErrMsg uintptr +} + +type sqlite3_vtab = Tsqlite3_vtab + +type Tsqlite3_index_info = struct { + FnConstraint int32 + FaConstraint uintptr + FnOrderBy int32 + FaOrderBy uintptr + FaConstraintUsage uintptr + FidxNum int32 + FidxStr uintptr + FneedToFreeIdxStr int32 + ForderByConsumed int32 + FestimatedCost float64 + FestimatedRows Tsqlite3_int64 + FidxFlags int32 + FcolUsed Tsqlite3_uint64 +} + +type sqlite3_index_info = Tsqlite3_index_info + +type Tsqlite3_vtab_cursor = struct { + FpVtab uintptr +} + +type sqlite3_vtab_cursor = Tsqlite3_vtab_cursor + +type Tsqlite3_module = struct { + FiVersion int32 + FxCreate uintptr + FxConnect uintptr + FxBestIndex uintptr + FxDisconnect uintptr + FxDestroy uintptr + FxOpen uintptr + FxClose uintptr + FxFilter uintptr + FxNext uintptr + FxEof uintptr + FxColumn uintptr + FxRowid uintptr + FxUpdate uintptr + FxBegin uintptr + FxSync uintptr + FxCommit uintptr + FxRollback uintptr + FxFindFunction uintptr + FxRename uintptr + FxSavepoint uintptr + FxRelease uintptr + FxRollbackTo uintptr + FxShadowName uintptr + FxIntegrity uintptr +} + +type sqlite3_module = Tsqlite3_module + +/* +** CAPI3REF: Virtual Table Object +** KEYWORDS: sqlite3_module {virtual table module} +** +** This structure, sometimes called a "virtual table module", +** defines the implementation of a [virtual table]. +** This structure consists mostly of methods for the module. +** +** ^A virtual table module is created by filling in a persistent +** instance of this structure and passing a pointer to that instance +** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. +** ^The registration remains valid until it is replaced by a different +** module or until the [database connection] closes. The content +** of this structure must not change while it is registered with +** any database connection. + */ +type Tsqlite3_module1 = struct { + FiVersion int32 + FxCreate uintptr + FxConnect uintptr + FxBestIndex uintptr + FxDisconnect uintptr + FxDestroy uintptr + FxOpen uintptr + FxClose uintptr + FxFilter uintptr + FxNext uintptr + FxEof uintptr + FxColumn uintptr + FxRowid uintptr + FxUpdate uintptr + FxBegin uintptr + FxSync uintptr + FxCommit uintptr + FxRollback uintptr + FxFindFunction uintptr + FxRename uintptr + FxSavepoint uintptr + FxRelease uintptr + FxRollbackTo uintptr + FxShadowName uintptr + FxIntegrity uintptr +} + +type sqlite3_module1 = Tsqlite3_module1 + +/* +** CAPI3REF: Virtual Table Indexing Information +** KEYWORDS: sqlite3_index_info +** +** The sqlite3_index_info structure and its substructures is used as part +** of the [virtual table] interface to +** pass information into and receive the reply from the [xBestIndex] +** method of a [virtual table module]. The fields under **Inputs** are the +** inputs to xBestIndex and are read-only. xBestIndex inserts its +** results into the **Outputs** fields. +** +** ^(The aConstraint[] array records WHERE clause constraints of the form: +** +**
    column OP expr
    +** +** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +** stored in aConstraint[].op using one of the +** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ +** ^(The index of the column is stored in +** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +** expr on the right-hand side can be evaluated (and thus the constraint +** is usable) and false if it cannot.)^ +** +** ^The optimizer automatically inverts terms of the form "expr OP column" +** and makes other simplifications to the WHERE clause in an attempt to +** get as many WHERE clause terms into the form shown above as possible. +** ^The aConstraint[] array only reports WHERE clause terms that are +** relevant to the particular virtual table being queried. +** +** ^Information about the ORDER BY clause is stored in aOrderBy[]. +** ^Each term of aOrderBy records a column of the ORDER BY clause. +** +** The colUsed field indicates which columns of the virtual table may be +** required by the current scan. Virtual table columns are numbered from +** zero in the order in which they appear within the CREATE TABLE statement +** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +** the corresponding bit is set within the colUsed mask if the column may be +** required by SQLite. If the table has at least 64 columns and any column +** to the right of the first 63 is required, then bit 63 of colUsed is also +** set. In other words, column iCol may be required if the expression +** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +** non-zero. +** +** The [xBestIndex] method must fill aConstraintUsage[] with information +** about what parameters to pass to xFilter. ^If argvIndex>0 then +** the right-hand side of the corresponding aConstraint[] is evaluated +** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +** is true, then the constraint is assumed to be fully handled by the +** virtual table and might not be checked again by the byte code.)^ ^(The +** aConstraintUsage[].omit flag is an optimization hint. When the omit flag +** is left in its default setting of false, the constraint will always be +** checked separately in byte code. If the omit flag is change to true, then +** the constraint may or may not be checked in byte code. In other words, +** when the omit flag is true there is no guarantee that the constraint will +** not be checked again using byte code.)^ +** +** ^The idxNum and idxStr values are recorded and passed into the +** [xFilter] method. +** ^[sqlite3_free()] is used to free idxStr if and only if +** needToFreeIdxStr is true. +** +** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +** the correct order to satisfy the ORDER BY clause so that no separate +** sorting step is required. +** +** ^The estimatedCost value is an estimate of the cost of a particular +** strategy. A cost of N indicates that the cost of the strategy is similar +** to a linear scan of an SQLite table with N rows. A cost of log(N) +** indicates that the expense of the operation is similar to that of a +** binary search on a unique indexed field of an SQLite table with N rows. +** +** ^The estimatedRows value is an estimate of the number of rows that +** will be returned by the strategy. +** +** The xBestIndex method may optionally populate the idxFlags field with a +** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag - +** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite +** assumes that the strategy may visit at most one row. +** +** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then +** SQLite also assumes that if a call to the xUpdate() method is made as +** part of the same statement to delete or update a virtual table row and the +** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback +** any database changes. In other words, if the xUpdate() returns +** SQLITE_CONSTRAINT, the database contents must be exactly as they were +** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not +** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by +** the xUpdate method are automatically rolled back by SQLite. +** +** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). +** If a virtual table extension is +** used with an SQLite version earlier than 3.8.2, the results of attempting +** to read or write the estimatedRows field are undefined (but are likely +** to include crashing the application). The estimatedRows field should +** therefore only be used if [sqlite3_libversion_number()] returns a +** value greater than or equal to 3008002. Similarly, the idxFlags field +** was added for [version 3.9.0] ([dateof:3.9.0]). +** It may therefore only be used if +** sqlite3_libversion_number() returns a value greater than or equal to +** 3009000. + */ +type Tsqlite3_index_info1 = struct { + FnConstraint int32 + FaConstraint uintptr + FnOrderBy int32 + FaOrderBy uintptr + FaConstraintUsage uintptr + FidxNum int32 + FidxStr uintptr + FneedToFreeIdxStr int32 + ForderByConsumed int32 + FestimatedCost float64 + FestimatedRows Tsqlite3_int64 + FidxFlags int32 + FcolUsed Tsqlite3_uint64 +} + +type sqlite3_index_info1 = Tsqlite3_index_info1 + +/* +** CAPI3REF: Virtual Table Instance Object +** KEYWORDS: sqlite3_vtab +** +** Every [virtual table module] implementation uses a subclass +** of this object to describe a particular instance +** of the [virtual table]. Each subclass will +** be tailored to the specific needs of the module implementation. +** The purpose of this superclass is to define certain fields that are +** common to all module implementations. +** +** ^Virtual tables methods can set an error message by assigning a +** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should +** take care that any prior string is freed by a call to [sqlite3_free()] +** prior to assigning a new string to zErrMsg. ^After the error message +** is delivered up to the client application, the string will be automatically +** freed by sqlite3_free() and the zErrMsg field will be zeroed. + */ +type Tsqlite3_vtab1 = struct { + FpModule uintptr + FnRef int32 + FzErrMsg uintptr +} + +type sqlite3_vtab1 = Tsqlite3_vtab1 + +/* +** CAPI3REF: Virtual Table Cursor Object +** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} +** +** Every [virtual table module] implementation uses a subclass of the +** following structure to describe cursors that point into the +** [virtual table] and are used +** to loop through the virtual table. Cursors are created using the +** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed +** by the [sqlite3_module.xClose | xClose] method. Cursors are used +** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods +** of the module. Each module implementation will define +** the content of a cursor structure to suit its own needs. +** +** This superclass exists in order to define fields of the cursor that +** are common to all implementations. + */ +type Tsqlite3_vtab_cursor1 = struct { + FpVtab uintptr +} + +type sqlite3_vtab_cursor1 = Tsqlite3_vtab_cursor1 + +// C documentation +// +// /* +// ** CAPI3REF: Mutex Methods Object +// ** +// ** An instance of this structure defines the low-level routines +// ** used to allocate and use mutexes. +// ** +// ** Usually, the default mutex implementations provided by SQLite are +// ** sufficient, however the application has the option of substituting a custom +// ** implementation for specialized deployments or systems for which SQLite +// ** does not provide a suitable implementation. In this case, the application +// ** creates and populates an instance of this structure to pass +// ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +// ** Additionally, an instance of this structure can be used as an +// ** output variable when querying the system for the current mutex +// ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. +// ** +// ** ^The xMutexInit method defined by this structure is invoked as +// ** part of system initialization by the sqlite3_initialize() function. +// ** ^The xMutexInit routine is called by SQLite exactly once for each +// ** effective call to [sqlite3_initialize()]. +// ** +// ** ^The xMutexEnd method defined by this structure is invoked as +// ** part of system shutdown by the sqlite3_shutdown() function. The +// ** implementation of this method is expected to release all outstanding +// ** resources obtained by the mutex methods implementation, especially +// ** those obtained by the xMutexInit method. ^The xMutexEnd() +// ** interface is invoked exactly once for each call to [sqlite3_shutdown()]. +// ** +// ** ^(The remaining seven methods defined by this structure (xMutexAlloc, +// ** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and +// ** xMutexNotheld) implement the following interfaces (respectively): +// ** +// **
      +// **
    • [sqlite3_mutex_alloc()]
    • +// **
    • [sqlite3_mutex_free()]
    • +// **
    • [sqlite3_mutex_enter()]
    • +// **
    • [sqlite3_mutex_try()]
    • +// **
    • [sqlite3_mutex_leave()]
    • +// **
    • [sqlite3_mutex_held()]
    • +// **
    • [sqlite3_mutex_notheld()]
    • +// **
    )^ +// ** +// ** The only difference is that the public sqlite3_XXX functions enumerated +// ** above silently ignore any invocations that pass a NULL pointer instead +// ** of a valid mutex handle. The implementations of the methods defined +// ** by this structure are not required to handle this case. The results +// ** of passing a NULL pointer instead of a valid mutex handle are undefined +// ** (i.e. it is acceptable to provide an implementation that segfaults if +// ** it is passed a NULL pointer). +// ** +// ** The xMutexInit() method must be threadsafe. It must be harmless to +// ** invoke xMutexInit() multiple times within the same process and without +// ** intervening calls to xMutexEnd(). Second and subsequent calls to +// ** xMutexInit() must be no-ops. +// ** +// ** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +// ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory +// ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite +// ** memory allocation for a fast or recursive mutex. +// ** +// ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +// ** called, but only if the prior call to xMutexInit returned SQLITE_OK. +// ** If xMutexInit fails in any way, it is expected to clean up after itself +// ** prior to returning. +// */ +type Tsqlite3_mutex_methods = struct { + FxMutexInit uintptr + FxMutexEnd uintptr + FxMutexAlloc uintptr + FxMutexFree uintptr + FxMutexEnter uintptr + FxMutexTry uintptr + FxMutexLeave uintptr + FxMutexHeld uintptr + FxMutexNotheld uintptr +} + +type sqlite3_mutex_methods = Tsqlite3_mutex_methods + +type Tsqlite3_mutex_methods1 = struct { + FxMutexInit uintptr + FxMutexEnd uintptr + FxMutexAlloc uintptr + FxMutexFree uintptr + FxMutexEnter uintptr + FxMutexTry uintptr + FxMutexLeave uintptr + FxMutexHeld uintptr + FxMutexNotheld uintptr +} + +type sqlite3_mutex_methods1 = Tsqlite3_mutex_methods1 + +// C documentation +// +// /* +// ** CAPI3REF: Dynamic String Object +// ** KEYWORDS: {dynamic string} +// ** +// ** An instance of the sqlite3_str object contains a dynamically-sized +// ** string under construction. +// ** +// ** The lifecycle of an sqlite3_str object is as follows: +// **
      +// **
    1. ^The sqlite3_str object is created using [sqlite3_str_new()]. +// **
    2. ^Text is appended to the sqlite3_str object using various +// ** methods, such as [sqlite3_str_appendf()]. +// **
    3. ^The sqlite3_str object is destroyed and the string it created +// ** is returned using the [sqlite3_str_finish()] interface. +// **
    +// */ +type Tsqlite3_str = struct { + Fdb uintptr + FzText uintptr + FnAlloc Tu32 + FmxAlloc Tu32 + FnChar Tu32 + FaccError Tu8 + FprintfFlags Tu8 +} + +type sqlite3_str = Tsqlite3_str + +// C documentation +// +// /* +// ** CAPI3REF: Custom Page Cache Object +// ** +// ** The sqlite3_pcache_page object represents a single page in the +// ** page cache. The page cache will allocate instances of this +// ** object. Various methods of the page cache use pointers to instances +// ** of this object as parameters or as their return value. +// ** +// ** See [sqlite3_pcache_methods2] for additional information. +// */ +type Tsqlite3_pcache_page = struct { + FpBuf uintptr + FpExtra uintptr +} + +type sqlite3_pcache_page = Tsqlite3_pcache_page + +type Tsqlite3_pcache_page1 = struct { + FpBuf uintptr + FpExtra uintptr +} + +type sqlite3_pcache_page1 = Tsqlite3_pcache_page1 + +// C documentation +// +// /* +// ** CAPI3REF: Application Defined Page Cache. +// ** KEYWORDS: {page cache} +// ** +// ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can +// ** register an alternative page cache implementation by passing in an +// ** instance of the sqlite3_pcache_methods2 structure.)^ +// ** In many applications, most of the heap memory allocated by +// ** SQLite is used for the page cache. +// ** By implementing a +// ** custom page cache using this API, an application can better control +// ** the amount of memory consumed by SQLite, the way in which +// ** that memory is allocated and released, and the policies used to +// ** determine exactly which parts of a database file are cached and for +// ** how long. +// ** +// ** The alternative page cache mechanism is an +// ** extreme measure that is only needed by the most demanding applications. +// ** The built-in page cache is recommended for most uses. +// ** +// ** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an +// ** internal buffer by SQLite within the call to [sqlite3_config]. Hence +// ** the application may discard the parameter after the call to +// ** [sqlite3_config()] returns.)^ +// ** +// ** [[the xInit() page cache method]] +// ** ^(The xInit() method is called once for each effective +// ** call to [sqlite3_initialize()])^ +// ** (usually only once during the lifetime of the process). ^(The xInit() +// ** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ +// ** The intent of the xInit() method is to set up global data structures +// ** required by the custom page cache implementation. +// ** ^(If the xInit() method is NULL, then the +// ** built-in default page cache is used instead of the application defined +// ** page cache.)^ +// ** +// ** [[the xShutdown() page cache method]] +// ** ^The xShutdown() method is called by [sqlite3_shutdown()]. +// ** It can be used to clean up +// ** any outstanding resources before process shutdown, if required. +// ** ^The xShutdown() method may be NULL. +// ** +// ** ^SQLite automatically serializes calls to the xInit method, +// ** so the xInit method need not be threadsafe. ^The +// ** xShutdown method is only called from [sqlite3_shutdown()] so it does +// ** not need to be threadsafe either. All other methods must be threadsafe +// ** in multithreaded applications. +// ** +// ** ^SQLite will never invoke xInit() more than once without an intervening +// ** call to xShutdown(). +// ** +// ** [[the xCreate() page cache methods]] +// ** ^SQLite invokes the xCreate() method to construct a new cache instance. +// ** SQLite will typically create one cache instance for each open database file, +// ** though this is not guaranteed. ^The +// ** first parameter, szPage, is the size in bytes of the pages that must +// ** be allocated by the cache. ^szPage will always a power of two. ^The +// ** second parameter szExtra is a number of bytes of extra storage +// ** associated with each page cache entry. ^The szExtra parameter will +// ** a number less than 250. SQLite will use the +// ** extra szExtra bytes on each page to store metadata about the underlying +// ** database page on disk. The value passed into szExtra depends +// ** on the SQLite version, the target platform, and how SQLite was compiled. +// ** ^The third argument to xCreate(), bPurgeable, is true if the cache being +// ** created will be used to cache database pages of a file stored on disk, or +// ** false if it is used for an in-memory database. The cache implementation +// ** does not have to do anything special based with the value of bPurgeable; +// ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will +// ** never invoke xUnpin() except to deliberately delete a page. +// ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to +// ** false will always have the "discard" flag set to true. +// ** ^Hence, a cache created with bPurgeable false will +// ** never contain any unpinned pages. +// ** +// ** [[the xCachesize() page cache method]] +// ** ^(The xCachesize() method may be called at any time by SQLite to set the +// ** suggested maximum cache-size (number of pages stored by) the cache +// ** instance passed as the first argument. This is the value configured using +// ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable +// ** parameter, the implementation is not required to do anything with this +// ** value; it is advisory only. +// ** +// ** [[the xPagecount() page cache methods]] +// ** The xPagecount() method must return the number of pages currently +// ** stored in the cache, both pinned and unpinned. +// ** +// ** [[the xFetch() page cache methods]] +// ** The xFetch() method locates a page in the cache and returns a pointer to +// ** an sqlite3_pcache_page object associated with that page, or a NULL pointer. +// ** The pBuf element of the returned sqlite3_pcache_page object will be a +// ** pointer to a buffer of szPage bytes used to store the content of a +// ** single database page. The pExtra element of sqlite3_pcache_page will be +// ** a pointer to the szExtra bytes of extra storage that SQLite has requested +// ** for each entry in the page cache. +// ** +// ** The page to be fetched is determined by the key. ^The minimum key value +// ** is 1. After it has been retrieved using xFetch, the page is considered +// ** to be "pinned". +// ** +// ** If the requested page is already in the page cache, then the page cache +// ** implementation must return a pointer to the page buffer with its content +// ** intact. If the requested page is not already in the cache, then the +// ** cache implementation should use the value of the createFlag +// ** parameter to help it determined what action to take: +// ** +// **
  • +// **
    createFlag Behavior when page is not already in cache +// **
    0 Do not allocate a new page. Return NULL. +// **
    1 Allocate a new page if it easy and convenient to do so. +// ** Otherwise return NULL. +// **
    2 Make every effort to allocate a new page. Only return +// ** NULL if allocating a new page is effectively impossible. +// **
    +// ** +// ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite +// ** will only use a createFlag of 2 after a prior call with a createFlag of 1 +// ** failed.)^ In between the xFetch() calls, SQLite may +// ** attempt to unpin one or more cache pages by spilling the content of +// ** pinned pages to disk and synching the operating system disk cache. +// ** +// ** [[the xUnpin() page cache method]] +// ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page +// ** as its second argument. If the third parameter, discard, is non-zero, +// ** then the page must be evicted from the cache. +// ** ^If the discard parameter is +// ** zero, then the page may be discarded or retained at the discretion of +// ** page cache implementation. ^The page cache implementation +// ** may choose to evict unpinned pages at any time. +// ** +// ** The cache must not perform any reference counting. A single +// ** call to xUnpin() unpins the page regardless of the number of prior calls +// ** to xFetch(). +// ** +// ** [[the xRekey() page cache methods]] +// ** The xRekey() method is used to change the key value associated with the +// ** page passed as the second argument. If the cache +// ** previously contains an entry associated with newKey, it must be +// ** discarded. ^Any prior cache entry associated with newKey is guaranteed not +// ** to be pinned. +// ** +// ** When SQLite calls the xTruncate() method, the cache must discard all +// ** existing cache entries with page numbers (keys) greater than or equal +// ** to the value of the iLimit parameter passed to xTruncate(). If any +// ** of these pages are pinned, they are implicitly unpinned, meaning that +// ** they can be safely discarded. +// ** +// ** [[the xDestroy() page cache method]] +// ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). +// ** All resources associated with the specified cache should be freed. ^After +// ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] +// ** handle invalid, and will not use it with any other sqlite3_pcache_methods2 +// ** functions. +// ** +// ** [[the xShrink() page cache method]] +// ** ^SQLite invokes the xShrink() method when it wants the page cache to +// ** free up as much of heap memory as possible. The page cache implementation +// ** is not obligated to free any memory, but well-behaved implementations should +// ** do their best. +// */ +type Tsqlite3_pcache_methods2 = struct { + FiVersion int32 + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr + FxShrink uintptr +} + +type sqlite3_pcache_methods2 = Tsqlite3_pcache_methods2 + +type Tsqlite3_pcache_methods21 = struct { + FiVersion int32 + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr + FxShrink uintptr +} + +type sqlite3_pcache_methods21 = Tsqlite3_pcache_methods21 + +// C documentation +// +// /* +// ** This is the obsolete pcache_methods object that has now been replaced +// ** by sqlite3_pcache_methods2. This object is not used by SQLite. It is +// ** retained in the header file for backwards compatibility only. +// */ +type Tsqlite3_pcache_methods = struct { + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr +} + +type sqlite3_pcache_methods = Tsqlite3_pcache_methods + +type Tsqlite3_pcache_methods1 = struct { + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr +} + +type sqlite3_pcache_methods1 = Tsqlite3_pcache_methods1 + +// C documentation +// +// /* +// ** CAPI3REF: Online Backup Object +// ** +// ** The sqlite3_backup object records state information about an ongoing +// ** online backup operation. ^The sqlite3_backup object is created by +// ** a call to [sqlite3_backup_init()] and is destroyed by a call to +// ** [sqlite3_backup_finish()]. +// ** +// ** See Also: [Using the SQLite Online Backup API] +// */ +type Tsqlite3_backup = struct { + FpDestDb uintptr + FpDest uintptr + FiDestSchema Tu32 + FbDestLocked int32 + FiNext TPgno + FpSrcDb uintptr + FpSrc uintptr + Frc int32 + FnRemaining TPgno + FnPagecount TPgno + FisAttached int32 + FpNext uintptr +} + +type sqlite3_backup = Tsqlite3_backup + +// C documentation +// +// /* +// ** CAPI3REF: Database Snapshot +// ** KEYWORDS: {snapshot} {sqlite3_snapshot} +// ** +// ** An instance of the snapshot object records the state of a [WAL mode] +// ** database for some specific point in history. +// ** +// ** In [WAL mode], multiple [database connections] that are open on the +// ** same database file can each be reading a different historical version +// ** of the database file. When a [database connection] begins a read +// ** transaction, that connection sees an unchanging copy of the database +// ** as it existed for the point in time when the transaction first started. +// ** Subsequent changes to the database from other connections are not seen +// ** by the reader until a new read transaction is started. +// ** +// ** The sqlite3_snapshot object records state information about an historical +// ** version of the database file so that it is possible to later open a new read +// ** transaction that sees that historical version of the database rather than +// ** the most recent version. +// */ +type Tsqlite3_snapshot = struct { + Fhidden [48]uint8 +} + +type sqlite3_snapshot = Tsqlite3_snapshot + +/* +** CAPI3REF: Flags for sqlite3_deserialize() +** +** The following are allowed values for 6th argument (the F argument) to +** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. +** +** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization +** in the P argument is held in memory obtained from [sqlite3_malloc64()] +** and that SQLite should take ownership of this memory and automatically +** free it when it has finished using it. Without this flag, the caller +** is responsible for freeing any dynamically allocated memory. +** +** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to +** grow the size of the database using calls to [sqlite3_realloc64()]. This +** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. +** Without this flag, the deserialized database cannot increase in size beyond +** the number of bytes specified by the M parameter. +** +** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database +** should be treated as read-only. + */ + +/* +** Undo the hack that converts floating point types to integer for +** builds on processors without floating point support. + */ + +/******** Begin file sqlite3rtree.h *********/ +/* +** 2010 August 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* + */ + +type Tsqlite3_rtree_geometry = struct { + FpContext uintptr + FnParam int32 + FaParam uintptr + FpUser uintptr + FxDelUser uintptr +} + +type sqlite3_rtree_geometry = Tsqlite3_rtree_geometry + +type Tsqlite3_rtree_query_info = struct { + FpContext uintptr + FnParam int32 + FaParam uintptr + FpUser uintptr + FxDelUser uintptr + FaCoord uintptr + FanQueue uintptr + FnCoord int32 + FiLevel int32 + FmxLevel int32 + FiRowid Tsqlite3_int64 + FrParentScore Tsqlite3_rtree_dbl + FeParentWithin int32 + FeWithin int32 + FrScore Tsqlite3_rtree_dbl + FapSqlParam uintptr +} + +type sqlite3_rtree_query_info = Tsqlite3_rtree_query_info + +// C documentation +// +// /* The double-precision datatype used by RTree depends on the +// ** SQLITE_RTREE_INT_ONLY compile-time option. +// */ +type Tsqlite3_rtree_dbl = float64 + +type sqlite3_rtree_dbl = Tsqlite3_rtree_dbl + +/* +** A pointer to a structure of the following type is passed as the first +** argument to callbacks registered using rtree_geometry_callback(). + */ +type Tsqlite3_rtree_geometry1 = struct { + FpContext uintptr + FnParam int32 + FaParam uintptr + FpUser uintptr + FxDelUser uintptr +} + +type sqlite3_rtree_geometry1 = Tsqlite3_rtree_geometry1 + +/* +** A pointer to a structure of the following type is passed as the +** argument to scored geometry callback registered using +** sqlite3_rtree_query_callback(). +** +** Note that the first 5 fields of this structure are identical to +** sqlite3_rtree_geometry. This structure is a subclass of +** sqlite3_rtree_geometry. + */ +type Tsqlite3_rtree_query_info1 = struct { + FpContext uintptr + FnParam int32 + FaParam uintptr + FpUser uintptr + FxDelUser uintptr + FaCoord uintptr + FanQueue uintptr + FnCoord int32 + FiLevel int32 + FmxLevel int32 + FiRowid Tsqlite3_int64 + FrParentScore Tsqlite3_rtree_dbl + FeParentWithin int32 + FeWithin int32 + FrScore Tsqlite3_rtree_dbl + FapSqlParam uintptr +} + +type sqlite3_rtree_query_info1 = Tsqlite3_rtree_query_info1 + +/* +** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + */ + +/******** End of sqlite3rtree.h *********/ +/******** Begin file sqlite3session.h *********/ + +/* +** Make sure we can call this stuff from C++. + */ + +// C documentation +// +// /* +// ** CAPI3REF: Session Object Handle +// ** +// ** An instance of this object is a [session] that can be used to +// ** record changes to a database. +// */ +type Tsqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + FbImplicitPK int32 + Frc int32 + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc Ti64 + FnMaxChangesetSize Ti64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook TSessionHook +} + +type sqlite3_session = Tsqlite3_session + +// C documentation +// +// /* +// ** CAPI3REF: Changeset Iterator Handle +// ** +// ** An instance of this object acts as a cursor for iterating +// ** over the elements of a [changeset] or [patchset]. +// */ +type Tsqlite3_changeset_iter = struct { + Fin TSessionInput + Ftblhdr TSessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + FabPK uintptr + FapValue uintptr +} + +type sqlite3_changeset_iter = Tsqlite3_changeset_iter + +// C documentation +// +// /* +// ** CAPI3REF: Changegroup Handle +// ** +// ** A changegroup is an object used to combine two or more +// ** [changesets] or [patchsets] +// */ +type Tsqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr + Fdb uintptr + FzDb uintptr +} + +type sqlite3_changegroup = Tsqlite3_changegroup + +/* +** CAPI3REF: Flags for sqlite3changeset_apply_v2 +** +** The following flags may passed via the 9th parameter to +** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +** +**
    +**
    SQLITE_CHANGESETAPPLY_NOSAVEPOINT
    +** Usually, the sessions module encloses all operations performed by +** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +** SAVEPOINT is committed if the changeset or patchset is successfully +** applied, or rolled back if an error occurs. Specifying this flag +** causes the sessions module to omit this savepoint. In this case, if the +** caller has an open transaction or savepoint when apply_v2() is called, +** it may revert the partially applied changeset by rolling it back. +** +**
    SQLITE_CHANGESETAPPLY_INVERT
    +** Invert the changeset before applying it. This is equivalent to inverting +** a changeset using sqlite3changeset_invert() before applying it. It is +** an error to specify this flag with a patchset. +** +**
    SQLITE_CHANGESETAPPLY_IGNORENOOP
    +** Do not invoke the conflict handler callback for any changes that +** would not actually modify the database even if they were applied. +** Specifically, this means that the conflict handler is not invoked +** for: +**
      +**
    • a delete change if the row being deleted cannot be found, +**
    • an update change if the modified fields are already set to +** their new values in the conflicting row, or +**
    • an insert change if all fields of the conflicting row match +** the row being inserted. +**
    +** +**
    SQLITE_CHANGESETAPPLY_FKNOACTION
    +** If this flag it set, then all foreign key constraints in the target +** database behave as if they were declared with "ON UPDATE NO ACTION ON +** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL +** or SET DEFAULT. + */ + +/* +** CAPI3REF: Constants Passed To The Conflict Handler +** +** Values that may be passed as the second argument to a conflict-handler. +** +**
    +**
    SQLITE_CHANGESET_DATA
    +** The conflict handler is invoked with CHANGESET_DATA as the second argument +** when processing a DELETE or UPDATE change if a row with the required +** PRIMARY KEY fields is present in the database, but one or more other +** (non primary-key) fields modified by the update do not contain the +** expected "before" values. +** +** The conflicting row, in this case, is the database row with the matching +** primary key. +** +**
    SQLITE_CHANGESET_NOTFOUND
    +** The conflict handler is invoked with CHANGESET_NOTFOUND as the second +** argument when processing a DELETE or UPDATE change if a row with the +** required PRIMARY KEY fields is not present in the database. +** +** There is no conflicting row in this case. The results of invoking the +** sqlite3changeset_conflict() API are undefined. +** +**
    SQLITE_CHANGESET_CONFLICT
    +** CHANGESET_CONFLICT is passed as the second argument to the conflict +** handler while processing an INSERT change if the operation would result +** in duplicate primary key values. +** +** The conflicting row in this case is the database row with the matching +** primary key. +** +**
    SQLITE_CHANGESET_FOREIGN_KEY
    +** If foreign key handling is enabled, and applying a changeset leaves the +** database in a state containing foreign key violations, the conflict +** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +** exactly once before the changeset is committed. If the conflict handler +** returns CHANGESET_OMIT, the changes, including those that caused the +** foreign key constraint violation, are committed. Or, if it returns +** CHANGESET_ABORT, the changeset is rolled back. +** +** No current or conflicting row information is provided. The only function +** it is possible to call on the supplied sqlite3_changeset_iter handle +** is sqlite3changeset_fk_conflicts(). +** +**
    SQLITE_CHANGESET_CONSTRAINT
    +** If any other constraint violation occurs while applying a change (i.e. +** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +** invoked with CHANGESET_CONSTRAINT as the second argument. +** +** There is no conflicting row in this case. The results of invoking the +** sqlite3changeset_conflict() API are undefined. +** +**
    + */ + +/* +** CAPI3REF: Constants Returned By The Conflict Handler +** +** A conflict handler callback must return one of the following three values. +** +**
    +**
    SQLITE_CHANGESET_OMIT
    +** If a conflict handler returns this value no special action is taken. The +** change that caused the conflict is not applied. The session module +** continues to the next change in the changeset. +** +**
    SQLITE_CHANGESET_REPLACE
    +** This value may only be returned if the second argument to the conflict +** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +** is not the case, any changes applied so far are rolled back and the +** call to sqlite3changeset_apply() returns SQLITE_MISUSE. +** +** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +** handler, then the conflicting row is either updated or deleted, depending +** on the type of change. +** +** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +** handler, then the conflicting row is removed from the database and a +** second attempt to apply the change is made. If this second attempt fails, +** the original row is restored to the database before continuing. +** +**
    SQLITE_CHANGESET_ABORT
    +** If this value is returned, any changes applied so far are rolled back +** and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +**
    + */ + +// C documentation +// +// /* +// ** CAPI3REF: Rebasing changesets +// ** EXPERIMENTAL +// ** +// ** Suppose there is a site hosting a database in state S0. And that +// ** modifications are made that move that database to state S1 and a +// ** changeset recorded (the "local" changeset). Then, a changeset based +// ** on S0 is received from another site (the "remote" changeset) and +// ** applied to the database. The database is then in state +// ** (S1+"remote"), where the exact state depends on any conflict +// ** resolution decisions (OMIT or REPLACE) made while applying "remote". +// ** Rebasing a changeset is to update it to take those conflict +// ** resolution decisions into account, so that the same conflicts +// ** do not have to be resolved elsewhere in the network. +// ** +// ** For example, if both the local and remote changesets contain an +// ** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// ** +// ** local: INSERT INTO t1 VALUES(1, 'v1'); +// ** remote: INSERT INTO t1 VALUES(1, 'v2'); +// ** +// ** and the conflict resolution is REPLACE, then the INSERT change is +// ** removed from the local changeset (it was overridden). Or, if the +// ** conflict resolution was "OMIT", then the local changeset is modified +// ** to instead contain: +// ** +// ** UPDATE t1 SET b = 'v2' WHERE a=1; +// ** +// ** Changes within the local changeset are rebased as follows: +// ** +// **
    +// **
    Local INSERT
    +// ** This may only conflict with a remote INSERT. If the conflict +// ** resolution was OMIT, then add an UPDATE change to the rebased +// ** changeset. Or, if the conflict resolution was REPLACE, add +// ** nothing to the rebased changeset. +// ** +// **
    Local DELETE
    +// ** This may conflict with a remote UPDATE or DELETE. In both cases the +// ** only possible resolution is OMIT. If the remote operation was a +// ** DELETE, then add no change to the rebased changeset. If the remote +// ** operation was an UPDATE, then the old.* fields of change are updated +// ** to reflect the new.* values in the UPDATE. +// ** +// **
    Local UPDATE
    +// ** This may conflict with a remote UPDATE or DELETE. If it conflicts +// ** with a DELETE, and the conflict resolution was OMIT, then the update +// ** is changed into an INSERT. Any undefined values in the new.* record +// ** from the update change are filled in using the old.* values from +// ** the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// ** the UPDATE change is simply omitted from the rebased changeset. +// ** +// ** If conflict is with a remote UPDATE and the resolution is OMIT, then +// ** the old.* values are rebased using the new.* values in the remote +// ** change. Or, if the resolution is REPLACE, then the change is copied +// ** into the rebased changeset with updates to columns also updated by +// ** the conflicting remote UPDATE removed. If this means no columns would +// ** be updated, the change is omitted. +// **
    +// ** +// ** A local change may be rebased against multiple remote changes +// ** simultaneously. If a single key is modified by multiple remote +// ** changesets, they are combined as follows before the local changeset +// ** is rebased: +// ** +// **
      +// **
    • If there has been one or more REPLACE resolutions on a +// ** key, it is rebased according to a REPLACE. +// ** +// **
    • If there have been no REPLACE resolutions on a key, then +// ** the local changeset is rebased according to the most recent +// ** of the OMIT resolutions. +// **
    +// ** +// ** Note that conflict resolutions from multiple remote changesets are +// ** combined on a per-field basis, not per-row. This means that in the +// ** case of multiple remote UPDATE operations, some fields of a single +// ** local change may be rebased for REPLACE while others are rebased for +// ** OMIT. +// ** +// ** In order to rebase a local changeset, the remote changeset must first +// ** be applied to the local database using sqlite3changeset_apply_v2() and +// ** the buffer of rebase information captured. Then: +// ** +// **
      +// **
    1. An sqlite3_rebaser object is created by calling +// ** sqlite3rebaser_create(). +// **
    2. The new object is configured with the rebase buffer obtained from +// ** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// ** If the local changeset is to be rebased against multiple remote +// ** changesets, then sqlite3rebaser_configure() should be called +// ** multiple times, in the same order that the multiple +// ** sqlite3changeset_apply_v2() calls were made. +// **
    3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +// **
    4. The sqlite3_rebaser object is deleted by calling +// ** sqlite3rebaser_delete(). +// **
    +// */ +type Tsqlite3_rebaser = struct { + Fgrp Tsqlite3_changegroup +} + +type sqlite3_rebaser = Tsqlite3_rebaser + +/* +** CAPI3REF: Values for sqlite3session_config(). + */ + +/* +** Make sure we can call this stuff from C++. + */ + +/******** End of sqlite3session.h *********/ +/******** Begin file fts5.h *********/ +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Interfaces to extend FTS5. Using the interfaces defined in this file, +** FTS5 may be extended with: +** +** * custom tokenizers, and +** * custom auxiliary functions. + */ + +/************************************************************************* +** CUSTOM AUXILIARY FUNCTIONS +** +** Virtual table implementations may overload SQL functions by implementing +** the sqlite3_module.xFindFunction() method. + */ + +type TFts5ExtensionApi = struct { + FiVersion int32 + FxUserData uintptr + FxColumnCount uintptr + FxRowCount uintptr + FxColumnTotalSize uintptr + FxTokenize uintptr + FxPhraseCount uintptr + FxPhraseSize uintptr + FxInstCount uintptr + FxInst uintptr + FxRowid uintptr + FxColumnText uintptr + FxColumnSize uintptr + FxQueryPhrase uintptr + FxSetAuxdata uintptr + FxGetAuxdata uintptr + FxPhraseFirst uintptr + FxPhraseNext uintptr + FxPhraseFirstColumn uintptr + FxPhraseNextColumn uintptr + FxQueryToken uintptr + FxInstToken uintptr +} + +type Fts5ExtensionApi = TFts5ExtensionApi + +type TFts5PhraseIter = struct { + Fa uintptr + Fb uintptr +} + +type Fts5PhraseIter = TFts5PhraseIter + +type Tfts5_extension_function = uintptr + +type fts5_extension_function = Tfts5_extension_function + +type TFts5PhraseIter1 = struct { + Fa uintptr + Fb uintptr +} + +type Fts5PhraseIter1 = TFts5PhraseIter1 + +/* +** EXTENSION API FUNCTIONS +** +** xUserData(pFts): +** Return a copy of the context pointer the extension function was +** registered with. +** +** xColumnTotalSize(pFts, iCol, pnToken): +** If parameter iCol is less than zero, set output variable *pnToken +** to the total number of tokens in the FTS5 table. Or, if iCol is +** non-negative but less than the number of columns in the table, return +** the total number of tokens in column iCol, considering all rows in +** the FTS5 table. +** +** If parameter iCol is greater than or equal to the number of columns +** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. +** an OOM condition or IO error), an appropriate SQLite error code is +** returned. +** +** xColumnCount(pFts): +** Return the number of columns in the table. +** +** xColumnSize(pFts, iCol, pnToken): +** If parameter iCol is less than zero, set output variable *pnToken +** to the total number of tokens in the current row. Or, if iCol is +** non-negative but less than the number of columns in the table, set +** *pnToken to the number of tokens in column iCol of the current row. +** +** If parameter iCol is greater than or equal to the number of columns +** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. +** an OOM condition or IO error), an appropriate SQLite error code is +** returned. +** +** This function may be quite inefficient if used with an FTS5 table +** created with the "columnsize=0" option. +** +** xColumnText: +** If parameter iCol is less than zero, or greater than or equal to the +** number of columns in the table, SQLITE_RANGE is returned. +** +** Otherwise, this function attempts to retrieve the text of column iCol of +** the current document. If successful, (*pz) is set to point to a buffer +** containing the text in utf-8 encoding, (*pn) is set to the size in bytes +** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, +** if an error occurs, an SQLite error code is returned and the final values +** of (*pz) and (*pn) are undefined. +** +** xPhraseCount: +** Returns the number of phrases in the current query expression. +** +** xPhraseSize: +** If parameter iCol is less than zero, or greater than or equal to the +** number of phrases in the current query, as returned by xPhraseCount, +** 0 is returned. Otherwise, this function returns the number of tokens in +** phrase iPhrase of the query. Phrases are numbered starting from zero. +** +** xInstCount: +** Set *pnInst to the total number of occurrences of all phrases within +** the query within the current row. Return SQLITE_OK if successful, or +** an error code (i.e. SQLITE_NOMEM) if an error occurs. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. If the FTS5 table is created +** with either "detail=none" or "detail=column" and "content=" option +** (i.e. if it is a contentless table), then this API always returns 0. +** +** xInst: +** Query for the details of phrase match iIdx within the current row. +** Phrase matches are numbered starting from zero, so the iIdx argument +** should be greater than or equal to zero and smaller than the value +** output by xInstCount(). If iIdx is less than zero or greater than +** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned. +** +** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol +** to the column in which it occurs and *piOff the token offset of the +** first token of the phrase. SQLITE_OK is returned if successful, or an +** error code (i.e. SQLITE_NOMEM) if an error occurs. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. +** +** xRowid: +** Returns the rowid of the current row. +** +** xTokenize: +** Tokenize text using the tokenizer belonging to the FTS5 table. +** +** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback): +** This API function is used to query the FTS table for phrase iPhrase +** of the current query. Specifically, a query equivalent to: +** +** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid +** +** with $p set to a phrase equivalent to the phrase iPhrase of the +** current query is executed. Any column filter that applies to +** phrase iPhrase of the current query is included in $p. For each +** row visited, the callback function passed as the fourth argument +** is invoked. The context and API objects passed to the callback +** function may be used to access the properties of each matched row. +** Invoking Api.xUserData() returns a copy of the pointer passed as +** the third argument to pUserData. +** +** If parameter iPhrase is less than zero, or greater than or equal to +** the number of phrases in the query, as returned by xPhraseCount(), +** this function returns SQLITE_RANGE. +** +** If the callback function returns any value other than SQLITE_OK, the +** query is abandoned and the xQueryPhrase function returns immediately. +** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. +** Otherwise, the error code is propagated upwards. +** +** If the query runs to completion without incident, SQLITE_OK is returned. +** Or, if some error occurs before the query completes or is aborted by +** the callback, an SQLite error code is returned. +** +** +** xSetAuxdata(pFts5, pAux, xDelete) +** +** Save the pointer passed as the second argument as the extension function's +** "auxiliary data". The pointer may then be retrieved by the current or any +** future invocation of the same fts5 extension function made as part of +** the same MATCH query using the xGetAuxdata() API. +** +** Each extension function is allocated a single auxiliary data slot for +** each FTS query (MATCH expression). If the extension function is invoked +** more than once for a single FTS query, then all invocations share a +** single auxiliary data context. +** +** If there is already an auxiliary data pointer when this function is +** invoked, then it is replaced by the new pointer. If an xDelete callback +** was specified along with the original pointer, it is invoked at this +** point. +** +** The xDelete callback, if one is specified, is also invoked on the +** auxiliary data pointer after the FTS5 query has finished. +** +** If an error (e.g. an OOM condition) occurs within this function, +** the auxiliary data is set to NULL and an error code returned. If the +** xDelete parameter was not NULL, it is invoked on the auxiliary data +** pointer before returning. +** +** +** xGetAuxdata(pFts5, bClear) +** +** Returns the current auxiliary data pointer for the fts5 extension +** function. See the xSetAuxdata() method for details. +** +** If the bClear argument is non-zero, then the auxiliary data is cleared +** (set to NULL) before this function returns. In this case the xDelete, +** if any, is not invoked. +** +** +** xRowCount(pFts5, pnRow) +** +** This function is used to retrieve the total number of rows in the table. +** In other words, the same value that would be returned by: +** +** SELECT count(*) FROM ftstable; +** +** xPhraseFirst() +** This function is used, along with type Fts5PhraseIter and the xPhraseNext +** method, to iterate through all instances of a single query phrase within +** the current row. This is the same information as is accessible via the +** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient +** to use, this API may be faster under some circumstances. To iterate +** through instances of phrase iPhrase, use the following code: +** +** Fts5PhraseIter iter; +** int iCol, iOff; +** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff); +** iCol>=0; +** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff) +** ){ +** // An instance of phrase iPhrase at offset iOff of column iCol +** } +** +** The Fts5PhraseIter structure is defined above. Applications should not +** modify this structure directly - it should only be used as shown above +** with the xPhraseFirst() and xPhraseNext() API methods (and by +** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below). +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. If the FTS5 table is created +** with either "detail=none" or "detail=column" and "content=" option +** (i.e. if it is a contentless table), then this API always iterates +** through an empty set (all calls to xPhraseFirst() set iCol to -1). +** +** xPhraseNext() +** See xPhraseFirst above. +** +** xPhraseFirstColumn() +** This function and xPhraseNextColumn() are similar to the xPhraseFirst() +** and xPhraseNext() APIs described above. The difference is that instead +** of iterating through all instances of a phrase in the current row, these +** APIs are used to iterate through the set of columns in the current row +** that contain one or more instances of a specified phrase. For example: +** +** Fts5PhraseIter iter; +** int iCol; +** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol); +** iCol>=0; +** pApi->xPhraseNextColumn(pFts, &iter, &iCol) +** ){ +** // Column iCol contains at least one instance of phrase iPhrase +** } +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" option. If the FTS5 table is created with either +** "detail=none" "content=" option (i.e. if it is a contentless table), +** then this API always iterates through an empty set (all calls to +** xPhraseFirstColumn() set iCol to -1). +** +** The information accessed using this API and its companion +** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext +** (or xInst/xInstCount). The chief advantage of this API is that it is +** significantly more efficient than those alternatives when used with +** "detail=column" tables. +** +** xPhraseNextColumn() +** See xPhraseFirstColumn above. +** +** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase iPhrase of the current +** query. Before returning, output parameter *ppToken is set to point +** to a buffer containing the requested token, and *pnToken to the +** size of this buffer in bytes. +** +** If iPhrase or iToken are less than zero, or if iPhrase is greater than +** or equal to the number of phrases in the query as reported by +** xPhraseCount(), or if iToken is equal to or greater than the number of +** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken + + are both zeroed. + +** +** The output text is not a copy of the query text that specified the +** token. It is the output of the tokenizer module. For tokendata=1 +** tables, this includes any embedded 0x00 and trailing data. +** +** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase hit iIdx within the +** current row. If iIdx is less than zero or greater than or equal to the +** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise, +** output variable (*ppToken) is set to point to a buffer containing the +** matching document token, and (*pnToken) to the size of that buffer in +** bytes. This API is not available if the specified token matches a +** prefix query term. In that case both output variables are always set +** to 0. +** +** The output text is not a copy of the document text that was tokenized. +** It is the output of the tokenizer module. For tokendata=1 tables, this +** includes any embedded 0x00 and trailing data. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. +*/ +type TFts5ExtensionApi1 = struct { + FiVersion int32 + FxUserData uintptr + FxColumnCount uintptr + FxRowCount uintptr + FxColumnTotalSize uintptr + FxTokenize uintptr + FxPhraseCount uintptr + FxPhraseSize uintptr + FxInstCount uintptr + FxInst uintptr + FxRowid uintptr + FxColumnText uintptr + FxColumnSize uintptr + FxQueryPhrase uintptr + FxSetAuxdata uintptr + FxGetAuxdata uintptr + FxPhraseFirst uintptr + FxPhraseNext uintptr + FxPhraseFirstColumn uintptr + FxPhraseNextColumn uintptr + FxQueryToken uintptr + FxInstToken uintptr +} + +type Fts5ExtensionApi1 = TFts5ExtensionApi1 + +type Tfts5_tokenizer = struct { + FxCreate uintptr + FxDelete uintptr + FxTokenize uintptr +} + +type fts5_tokenizer = Tfts5_tokenizer + +type Tfts5_tokenizer1 = struct { + FxCreate uintptr + FxDelete uintptr + FxTokenize uintptr +} + +type fts5_tokenizer1 = Tfts5_tokenizer1 + +/* Flags that may be passed as the third argument to xTokenize() */ + +/* Flags that may be passed by the tokenizer implementation back to FTS5 +** as the third argument to the supplied xToken callback. */ + +/* +** END OF CUSTOM TOKENIZERS +*************************************************************************/ + +// C documentation +// +// /************************************************************************* +// ** FTS5 EXTENSION REGISTRATION API +// */ +type Tfts5_api = struct { + FiVersion int32 + FxCreateTokenizer uintptr + FxFindTokenizer uintptr + FxCreateFunction uintptr +} + +type fts5_api = Tfts5_api + +type Tfts5_api1 = struct { + FiVersion int32 + FxCreateTokenizer uintptr + FxFindTokenizer uintptr + FxCreateFunction uintptr +} + +type fts5_api1 = Tfts5_api1 + +/* +** END OF REGISTRATION API +*************************************************************************/ + +/******** End of fts5.h *********/ + +/************** End of sqlite3.h *********************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ + +/* +** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory. + */ + +/* +** Include the configuration header output by 'configure' if we're using the +** autoconf-based build + */ + +/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/ +/************** Begin file sqliteLimit.h *************************************/ +/* +** 2007 May 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file defines various limits of what SQLite can process. + */ + +/* +** The maximum length of a TEXT or BLOB in bytes. This also +** limits the size of a row in a table or index. +** +** The hard limit is the ability of a 32-bit signed integer +** to count the size: 2^31-1 or 2147483647. + */ + +/* +** This is the maximum number of +** +** * Columns in a table +** * Columns in an index +** * Columns in a view +** * Terms in the SET clause of an UPDATE statement +** * Terms in the result set of a SELECT statement +** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. +** * Terms in the VALUES clause of an INSERT statement +** +** The hard upper limit here is 32676. Most database people will +** tell you that in a well-normalized database, you usually should +** not have more than a dozen or so columns in any table. And if +** that is the case, there is no point in having more than a few +** dozen values in any of the other situations described above. + */ + +/* +** The maximum length of a single SQL statement in bytes. +** +** It used to be the case that setting this value to zero would +** turn the limit off. That is no longer true. It is not possible +** to turn this limit off. + */ + +/* +** The maximum depth of an expression tree. This is limited to +** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might +** want to place more severe limits on the complexity of an +** expression. A value of 0 means that there is no limit. + */ + +/* +** The maximum number of terms in a compound SELECT statement. +** The code generator for compound SELECT statements does one +** level of recursion for each term. A stack overflow can result +** if the number of terms is too large. In practice, most SQL +** never has more than 3 or 4 terms. Use a value of 0 to disable +** any limit on the number of terms in a compound SELECT. + */ + +/* +** The maximum number of opcodes in a VDBE program. +** Not currently enforced. + */ + +/* +** The maximum number of arguments to an SQL function. + */ + +/* +** The suggested maximum number of in-memory pages to use for +** the main database table and for temporary tables. +** +** IMPLEMENTATION-OF: R-30185-15359 The default suggested cache size is -2000, +** which means the cache size is limited to 2048000 bytes of memory. +** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be +** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. + */ + +/* +** The default number of frames to accumulate in the log file before +** checkpointing the database in WAL mode. + */ + +/* +** The maximum number of attached databases. This must be between 0 +** and 125. The upper bound of 125 is because the attached databases are +** counted using a signed 8-bit integer which has a maximum value of 127 +** and we have to allow 2 extra counts for the "main" and "temp" databases. + */ + +/* +** The maximum value of a ?nnn wildcard that the parser will accept. +** If the value exceeds 32767 then extra space is required for the Expr +** structure. But otherwise, we believe that the number can be as large +** as a signed 32-bit integer can hold. + */ + +/* Maximum page size. The upper bound on this value is 65536. This a limit +** imposed by the use of 16-bit offsets within each page. +** +** Earlier versions of SQLite allowed the user to change this value at +** compile time. This is no longer permitted, on the grounds that it creates +** a library that is technically incompatible with an SQLite library +** compiled with a different limit. If a process operating on a database +** with a page-size of 65536 bytes crashes, then an instance of SQLite +** compiled with the default page-size limit will not be able to rollback +** the aborted transaction. This could lead to database corruption. + */ + +/* +** The default size of a database page. + */ + +/* +** Ordinarily, if no value is explicitly provided, SQLite creates databases +** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain +** device characteristics (sector-size and atomic write() support), +** SQLite may choose a larger value. This constant is the maximum value +** SQLite will choose on its own. + */ + +/* +** Maximum number of pages in one database file. +** +** This is really just the default value for the max_page_count pragma. +** This value can be lowered (or raised) at run-time using that the +** max_page_count macro. + */ + +/* +** Maximum length (in bytes) of the pattern in a LIKE or GLOB +** operator. + */ + +/* +** Maximum depth of recursion for triggers. +** +** A value of 1 means that a trigger program will not be able to itself +** fire any triggers. A value of 0 means that no trigger programs at all +** may be executed. + */ + +/************** End of sqliteLimit.h *****************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ + +/* Disable nuisance warnings on Borland compilers */ + +/* +** A few places in the code require atomic load/store of aligned +** integer values. + */ + +/* +** Include standard header files as necessary + */ + +/* +** The following macros are used to cast pointers to integers and +** integers to pointers. The way you do this varies from one compiler +** to the next, so we have developed the following set of #if statements +** to generate appropriate macros for a wide range of compilers. +** +** The correct "ANSI" way to do this is to use the intptr_t type. +** Unfortunately, that typedef is not available on all compilers, or +** if it is available, it requires an #include of specific headers +** that vary from one machine to the next. +** +** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on +** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). +** So we have to define the macros in different ways depending on the +** compiler. + */ + +/* +** Macros to hint to the compiler that a function should or should not be +** inlined. + */ + +/* +** Make sure that the compiler intrinsics we desire are enabled when +** compiling with an appropriate version of MSVC unless prevented by +** the SQLITE_DISABLE_INTRINSIC define. + */ + +/* +** Enable SQLITE_USE_SEH by default on MSVC builds. Only omit +** SEH support if the -DSQLITE_OMIT_SEH option is given. + */ + +/* +** Enable SQLITE_DIRECT_OVERFLOW_READ, unless the build explicitly +** disables it using -DSQLITE_DIRECT_OVERFLOW_READ=0 + */ +/* In all other cases, enable */ + +/* +** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. +** 0 means mutexes are permanently disable and the library is never +** threadsafe. 1 means the library is serialized which is the highest +** level of threadsafety. 2 means the library is multithreaded - multiple +** threads can use SQLite as long as no two threads try to use the same +** database connection at the same time. +** +** Older versions of SQLite used an optional THREADSAFE macro. +** We support that for legacy. +** +** To ensure that the correct value of "THREADSAFE" is reported when querying +** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this +** logic is partially replicated in ctime.c. If it is updated here, it should +** also be updated there. + */ + +/* +** Powersafe overwrite is on by default. But can be turned off using +** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option. + */ + +/* +** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by +** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in +** which case memory allocation statistics are disabled by default. + */ + +/* +** Exactly one of the following macros must be defined in order to +** specify which memory allocation subsystem to use. +** +** SQLITE_SYSTEM_MALLOC // Use normal system malloc() +** SQLITE_WIN32_MALLOC // Use Win32 native heap API +** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails +** SQLITE_MEMDEBUG // Debugging version of system malloc() +** +** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the +** assert() macro is enabled, each call into the Win32 native heap subsystem +** will cause HeapValidate to be called. If heap validation should fail, an +** assertion will be triggered. +** +** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as +** the default. + */ + +/* +** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the +** sizes of memory allocations below this value where possible. + */ + +/* +** We need to define _XOPEN_SOURCE as follows in order to enable +** recursive mutexes on most Unix systems and fchmod() on OpenBSD. +** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit +** it. + */ + +/* +** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that +** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, +** make it true by defining or undefining NDEBUG. +** +** Setting NDEBUG makes the code smaller and faster by disabling the +** assert() statements in the code. So we want the default action +** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG +** is set. Thus NDEBUG becomes an opt-in rather than an opt-out +** feature. + */ + +/* +** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. + */ + +/* +** The testcase() macro is used to aid in coverage testing. When +** doing coverage testing, the condition inside the argument to +** testcase() must be evaluated both true and false in order to +** get full branch coverage. The testcase() macro is inserted +** to help ensure adequate test coverage in places where simple +** condition/decision coverage is inadequate. For example, testcase() +** can be used to make sure boundary values are tested. For +** bitmask tests, testcase() can be used to make sure each bit +** is significant and used at least once. On switch statements +** where multiple cases go to the same block of code, testcase() +** can insure that all cases are evaluated. + */ + +/* +** The TESTONLY macro is used to enclose variable declarations or +** other bits of code that are needed to support the arguments +** within testcase() and assert() macros. + */ + +/* +** Sometimes we need a small amount of code such as a variable initialization +** to setup for a later assert() statement. We do not want this code to +** appear when assert() is disabled. The following macro is therefore +** used to contain that setup code. The "VVA" acronym stands for +** "Verification, Validation, and Accreditation". In other words, the +** code within VVA_ONLY() will only run during verification processes. + */ + +/* +** Disable ALWAYS() and NEVER() (make them pass-throughs) for coverage +** and mutation testing + */ + +/* +** The ALWAYS and NEVER macros surround boolean expressions which +** are intended to always be true or false, respectively. Such +** expressions could be omitted from the code completely. But they +** are included in a few cases in order to enhance the resilience +** of SQLite to unexpected behavior - to make the code "self-healing" +** or "ductile" rather than being "brittle" and crashing at the first +** hint of unplanned behavior. +** +** In other words, ALWAYS and NEVER are added for defensive code. +** +** When doing coverage testing ALWAYS and NEVER are hard-coded to +** be true and false so that the unreachable code they specify will +** not be counted as untested code. + */ + +/* +** Some conditionals are optimizations only. In other words, if the +** conditionals are replaced with a constant 1 (true) or 0 (false) then +** the correct answer is still obtained, though perhaps not as quickly. +** +** The following macros mark these optimizations conditionals. + */ + +/* +** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is +** defined. We need to defend against those failures when testing with +** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches +** during a normal build. The following macro can be used to disable tests +** that are always false except when SQLITE_TEST_REALLOC_STRESS is set. + */ + +/* +** Declarations used for tracing the operating system interfaces. + */ + +/* +** Is the sqlite3ErrName() function needed in the build? Currently, +** it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when +** OSTRACE is enabled), and by several "test*.c" files (which are +** compiled using SQLITE_TEST). + */ + +/* +** SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN + */ + +/* +** SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTERTABLE + */ + +/* +** Return true (non-zero) if the input is an integer that is too large +** to fit in 32-bits. This macro is used inside of various testcase() +** macros to verify that we have tested SQLite for large-file support. + */ + +/* +** The macro unlikely() is a hint that surrounds a boolean +** expression that is usually false. Macro likely() surrounds +** a boolean expression that is usually true. These hints could, +** in theory, be used by the compiler to generate better code, but +** currently they are just comments for human readers. + */ + +/************** Include hash.h in the middle of sqliteInt.h ******************/ +/************** Begin file hash.h ********************************************/ +/* +** 2001 September 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This is the header file for the generic hash-table implementation +** used in SQLite. + */ + +// C documentation +// +// /* Forward declarations of structures. */ +type THash = struct { + Fhtsize uint32 + Fcount uint32 + Ffirst uintptr + Fht uintptr +} + +type Hash = THash + +type THashElem = struct { + Fnext uintptr + Fprev uintptr + Fdata uintptr + FpKey uintptr +} + +type HashElem = THashElem + +/* A complete hash table is an instance of the following structure. +** The internals of this structure are intended to be opaque -- client +** code should not attempt to access or modify the fields of this structure +** directly. Change this structure only by using the routines below. +** However, some of the "procedures" and "functions" for modifying and +** accessing this structure are really macros, so we can't really make +** this structure opaque. +** +** All elements of the hash table are on a single doubly-linked list. +** Hash.first points to the head of this list. +** +** There are Hash.htsize buckets. Each bucket points to a spot in +** the global doubly-linked list. The contents of the bucket are the +** element pointed to plus the next _ht.count-1 elements in the list. +** +** Hash.htsize and Hash.ht may be zero. In that case lookup is done +** by a linear search of the global list. For small tables, the +** Hash.ht table is never allocated because if there are few elements +** in the table, it is faster to do a linear search than to manage +** the hash table. + */ +type THash1 = struct { + Fhtsize uint32 + Fcount uint32 + Ffirst uintptr + Fht uintptr +} + +type Hash1 = THash1 + +/* Each element in the hash table is an instance of the following +** structure. All elements are stored on a single doubly-linked list. +** +** Again, this structure is intended to be opaque, but it can't really +** be opaque because it is used by macros. + */ +type THashElem1 = struct { + Fnext uintptr + Fprev uintptr + Fdata uintptr + FpKey uintptr +} + +type HashElem1 = THashElem1 + +type Tsize_t = uint64 + +type size_t = Tsize_t + +type Tssize_t = int64 + +type ssize_t = Tssize_t + +type Toff_t = int64 + +type off_t = Toff_t + +type t__isoc_va_list = uintptr + +type Tfpos_t = struct { + F__lldata [0]int64 + F__align [0]float64 + F__opaque [16]int8 +} + +type fpos_t = Tfpos_t + +type T_G_fpos64_t = Tfpos_t + +type _G_fpos64_t = T_G_fpos64_t + +type Tcookie_io_functions_t = struct { + Fread uintptr + Fwrite uintptr + Fseek uintptr + Fclose1 uintptr +} + +type cookie_io_functions_t = Tcookie_io_functions_t + +type T_IO_cookie_io_functions_t = Tcookie_io_functions_t + +type _IO_cookie_io_functions_t = T_IO_cookie_io_functions_t + +type Twchar_t = int32 + +type wchar_t = Twchar_t + +type Tdiv_t = struct { + Fquot int32 + Frem int32 +} + +type div_t = Tdiv_t + +type Tldiv_t = struct { + Fquot int64 + Frem int64 +} + +type ldiv_t = Tldiv_t + +type Tlldiv_t = struct { + Fquot int64 + Frem int64 +} + +type lldiv_t = Tlldiv_t + +type Tlocale_t = uintptr + +type locale_t = Tlocale_t + +type Tmax_align_t = struct { + F__ll int64 + F__ld float64 +} + +type max_align_t = Tmax_align_t + +type Tptrdiff_t = int64 + +type ptrdiff_t = Tptrdiff_t + +/* +** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY. +** This allows better measurements of where memcpy() is used when running +** cachegrind. But this macro version of memcpy() is very slow so it +** should not be used in production. This is a performance measurement +** hack only. + */ + +/* +** If compiling for a processor that lacks floating point support, +** substitute integer for floating-point + */ + +/* +** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 +** afterward. Having this macro allows us to cause the C compiler +** to omit code used by TEMP tables without messy #ifndef statements. + */ + +/* +** The "file format" number is an integer that is incremented whenever +** the VDBE-level file format changes. The following macros define the +** the default file format for new databases and the maximum file format +** that the library can read. + */ + +/* +** Determine whether triggers are recursive by default. This can be +** changed at run-time using a pragma. + */ + +/* +** Provide a default value for SQLITE_TEMP_STORE in case it is not specified +** on the command-line + */ + +/* +** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if +** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it +** to zero. + */ + +/* +** The default initial allocation for the pagecache when using separate +** pagecaches for each database connection. A positive number is the +** number of pages. A negative number N translations means that a buffer +** of -1024*N bytes is allocated and used for as many pages as it will hold. +** +** The default value of "20" was chosen to minimize the run-time of the +** speedtest1 test program with options: --shrink-memory --reprepare + */ + +/* +** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option. + */ + +/* +** The compile-time options SQLITE_MMAP_READWRITE and +** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another. +** You must choose one or the other (or neither) but not both. + */ + +/* +** GCC does not define the offsetof() macro so we'll have to do it +** ourselves. + */ + +/* +** Macros to compute minimum and maximum of two numbers. + */ + +/* +** Swap two objects of type TYPE. + */ + +/* +** Check to see if this machine uses EBCDIC. (Yes, believe it or +** not, there are still machines out there that use EBCDIC.) + */ + +// C documentation +// +// /* +// ** Integers of known sizes. These typedefs might change for architectures +// ** where the sizes very. Preprocessor macros are available so that the +// ** types can be conveniently redefined at compile-type. Like this: +// ** +// ** cc '-DUINTPTR_TYPE=long long int' ... +// */ +type Ti64 = int64 + +type i64 = Ti64 + +/* 8-byte signed integer */ +type Tu64 = uint64 + +type u64 = Tu64 + +/* 8-byte unsigned integer */ +type Tu32 = uint32 + +type u32 = Tu32 + +/* 4-byte unsigned integer */ +type Tu16 = uint16 + +type u16 = Tu16 + +/* 2-byte unsigned integer */ +type Ti16 = int16 + +type i16 = Ti16 + +/* 2-byte signed integer */ +type Tu8 = uint8 + +type u8 = Tu8 + +/* 1-byte unsigned integer */ +type Ti8 = int8 + +type i8 = Ti8 + +/* 1-byte signed integer */ + +/* +** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value +** that can be stored in a u32 without loss of data. The value +** is 0x00000000ffffffff. But because of quirks of some compilers, we +** have to specify the value in the less intuitive manner shown: + */ + +// C documentation +// +// /* +// ** The datatype used to store estimates of the number of rows in a +// ** table or index. +// */ +type TtRowcnt = uint64 + +type tRowcnt = TtRowcnt + +// C documentation +// +// /* +// ** Estimated quantities used for query planning are stored as 16-bit +// ** logarithms. For quantity X, the value stored is 10*log2(X). This +// ** gives a possible range of values of approximately 1.0e986 to 1e-986. +// ** But the allowed values are "grainy". Not every value is representable. +// ** For example, quantities 16 and 17 are both represented by a LogEst +// ** of 40. However, since LogEst quantities are suppose to be estimates, +// ** not exact values, this imprecision is not a problem. +// ** +// ** "LogEst" is short for "Logarithmic Estimate". +// ** +// ** Examples: +// ** 1 -> 0 20 -> 43 10000 -> 132 +// ** 2 -> 10 25 -> 46 25000 -> 146 +// ** 3 -> 16 100 -> 66 1000000 -> 199 +// ** 4 -> 20 1000 -> 99 1048576 -> 200 +// ** 10 -> 33 1024 -> 100 4294967296 -> 320 +// ** +// ** The LogEst can be negative to indicate fractional values. +// ** Examples: +// ** +// ** 0.5 -> -10 0.1 -> -33 0.0625 -> -40 +// */ +type TLogEst = int16 + +type LogEst = TLogEst + +/* +** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer + */ + +// C documentation +// +// /* The uptr type is an unsigned integer large enough to hold a pointer +// */ +type Tuptr = uint64 + +type uptr = Tuptr + +/* +** Bits for the sqlite3WhereTrace mask: +** +** (---any--) Top-level block structure +** 0x-------F High-level debug messages +** 0x----FFF- More detail +** 0xFFFF---- Low-level debug messages +** +** 0x00000001 Code generation +** 0x00000002 Solver +** 0x00000004 Solver costs +** 0x00000008 WhereLoop inserts +** +** 0x00000010 Display sqlite3_index_info xBestIndex calls +** 0x00000020 Range an equality scan metrics +** 0x00000040 IN operator decisions +** 0x00000080 WhereLoop cost adjustements +** 0x00000100 +** 0x00000200 Covering index decisions +** 0x00000400 OR optimization +** 0x00000800 Index scanner +** 0x00001000 More details associated with code generation +** 0x00002000 +** 0x00004000 Show all WHERE terms at key points +** 0x00008000 Show the full SELECT statement at key places +** +** 0x00010000 Show more detail when printing WHERE terms +** 0x00020000 Show WHERE terms returned from whereScanNext() + */ + +// C documentation +// +// /* +// ** An instance of the following structure is used to store the busy-handler +// ** callback for a given sqlite handle. +// ** +// ** The sqlite.busyHandler member of the sqlite struct contains the busy +// ** callback for the database handle. Each pager opened via the sqlite +// ** handle is passed a pointer to sqlite.busyHandler. The busy-handler +// ** callback is currently invoked only from within pager.c. +// */ +type TBusyHandler = struct { + FxBusyHandler uintptr + FpBusyArg uintptr + FnBusy int32 +} + +type BusyHandler = TBusyHandler + +type TBusyHandler1 = struct { + FxBusyHandler uintptr + FpBusyArg uintptr + FnBusy int32 +} + +type BusyHandler1 = TBusyHandler1 + +/* +** Name of table that holds the database schema. +** +** The PREFERRED names are used wherever possible. But LEGACY is also +** used for backwards compatibility. +** +** 1. Queries can use either the PREFERRED or the LEGACY names +** 2. The sqlite3_set_authorizer() callback uses the LEGACY name +** 3. The PRAGMA table_list statement uses the PREFERRED name +** +** The LEGACY names are stored in the internal symbol hash table +** in support of (2). Names are translated using sqlite3PreferredTableName() +** for (3). The sqlite3FindTable() function takes care of translating +** names for (1). +** +** Note that "sqlite_temp_schema" can also be called "temp.sqlite_schema". + */ + +/* +** The root-page of the schema table. + */ + +/* +** The name of the schema table. The name is different for TEMP. + */ + +/* +** A convenience macro that returns the number of elements in +** an array. + */ + +/* +** Determine if the argument is a power of two + */ + +/* +** The following value as a destructor means to use sqlite3DbFree(). +** The sqlite3DbFree() routine requires two parameters instead of the +** one parameter that destructors normally want. So we have to introduce +** this magic value that the code knows to handle differently. Any +** pointer will work here as long as it is distinct from SQLITE_STATIC +** and SQLITE_TRANSIENT. + */ + +/* +** When SQLITE_OMIT_WSD is defined, it means that the target platform does +** not support Writable Static Data (WSD) such as global and static variables. +** All variables must either be on the stack or dynamically allocated from +** the heap. When WSD is unsupported, the variable declarations scattered +** throughout the SQLite code must become constants instead. The SQLITE_WSD +** macro is used for this purpose. And instead of referencing the variable +** directly, we use its constant as a key to lookup the run-time allocated +** buffer that holds real variable. The constant is also the initializer +** for the run-time allocated buffer. +** +** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL +** macros become no-ops and have zero performance impact. + */ + +/* +** The following macros are used to suppress compiler warnings and to +** make it clear to human readers when a function parameter is deliberately +** left unused within the body of a function. This usually happens when +** a function is called via a function pointer. For example the +** implementation of an SQL aggregate step callback may not use the +** parameter indicating the number of arguments passed to the aggregate, +** if it knows that this is enforced elsewhere. +** +** When a function parameter is not used at all within the body of a function, +** it is generally named "NotUsed" or "NotUsed2" to make things even clearer. +** However, these macros may also be used to suppress warnings related to +** parameters that may or may not be used depending on compilation options. +** For example those parameters only used in assert() statements. In these +** cases the parameters are named as per the usual conventions. + */ + +// C documentation +// +// /* +// ** Forward references to structures +// */ +type TAggInfo = struct { + FdirectMode Tu8 + FuseSortingIdx Tu8 + FnSortingColumn Tu16 + FsortingIdx int32 + FsortingIdxPTab int32 + FiFirstReg int32 + FpGroupBy uintptr + FaCol uintptr + FnColumn int32 + FnAccumulator int32 + FaFunc uintptr + FnFunc int32 + FselId Tu32 +} + +type AggInfo = TAggInfo + +type TAuthContext = struct { + FzAuthContext uintptr + FpParse uintptr +} + +type AuthContext = TAuthContext + +type TAutoincInfo = struct { + FpNext uintptr + FpTab uintptr + FiDb int32 + FregCtr int32 +} + +type AutoincInfo = TAutoincInfo + +type TBitvec = struct { + FiSize Tu32 + FnSet Tu32 + FiDivisor Tu32 + Fu struct { + FaHash [0][124]Tu32 + FapSub [0][62]uintptr + FaBitmap [496]Tu8 + } +} + +type Bitvec = TBitvec + +type TCollSeq = struct { + FzName uintptr + Fenc Tu8 + FpUser uintptr + FxCmp uintptr + FxDel uintptr +} + +type CollSeq = TCollSeq + +type TColumn = struct { + FzCnName uintptr + F__ccgo8 uint8 + Faffinity int8 + FszEst Tu8 + FhName Tu8 + FiDflt Tu16 + FcolFlags Tu16 +} + +type Column = TColumn + +type TCte = struct { + FzName uintptr + FpCols uintptr + FpSelect uintptr + FzCteErr uintptr + FpUse uintptr + FeM10d Tu8 +} + +type Cte = TCte + +type TCteUse = struct { + FnUse int32 + FaddrM9e int32 + FregRtn int32 + FiCur int32 + FnRowEst TLogEst + FeM10d Tu8 +} + +type CteUse = TCteUse + +type TDb = struct { + FzDbSName uintptr + FpBt uintptr + Fsafety_level Tu8 + FbSyncSet Tu8 + FpSchema uintptr +} + +type Db = TDb + +type TDbClientData = struct { + FpNext uintptr + FpData uintptr + FxDestructor uintptr + FzName [1]int8 +} + +type DbClientData = TDbClientData + +type TDbFixer = struct { + FpParse uintptr + Fw TWalker + FpSchema uintptr + FbTemp Tu8 + FzDb uintptr + FzType uintptr + FpName uintptr +} + +type DbFixer = TDbFixer + +type TSchema = struct { + Fschema_cookie int32 + FiGeneration int32 + FtblHash THash + FidxHash THash + FtrigHash THash + FfkeyHash THash + FpSeqTab uintptr + Ffile_format Tu8 + Fenc Tu8 + FschemaFlags Tu16 + Fcache_size int32 +} + +type Schema = TSchema + +type TExpr = struct { + Fop Tu8 + FaffExpr int8 + Fop2 Tu8 + Fflags Tu32 + Fu struct { + FiValue [0]int32 + FzToken uintptr + } + FpLeft uintptr + FpRight uintptr + Fx struct { + FpSelect [0]uintptr + FpList uintptr + } + FnHeight int32 + FiTable int32 + FiColumn TynVar + FiAgg Ti16 + Fw struct { + FiOfst [0]int32 + FiJoin int32 + } + FpAggInfo uintptr + Fy struct { + FpWin [0]uintptr + Fsub [0]struct { + FiAddr int32 + FregReturn int32 + } + FpTab uintptr + } +} + +type Expr = TExpr + +type TExprList = struct { + FnExpr int32 + FnAlloc int32 + Fa [1]TExprList_item +} + +type ExprList = TExprList + +type TFKey = struct { + FpFrom uintptr + FpNextFrom uintptr + FzTo uintptr + FpNextTo uintptr + FpPrevTo uintptr + FnCol int32 + FisDeferred Tu8 + FaAction [2]Tu8 + FapTrigger [2]uintptr + FaCol [1]TsColMap +} + +type FKey = TFKey + +type TFpDecode = struct { + Fsign int8 + FisSpecial int8 + Fn int32 + FiDP int32 + Fz uintptr + FzBuf [24]int8 +} + +type FpDecode = TFpDecode + +type TFuncDestructor = struct { + FnRef int32 + FxDestroy uintptr + FpUserData uintptr +} + +type FuncDestructor = TFuncDestructor + +type TFuncDef = struct { + FnArg Ti8 + FfuncFlags Tu32 + FpUserData uintptr + FpNext uintptr + FxSFunc uintptr + FxFinalize uintptr + FxValue uintptr + FxInverse uintptr + FzName uintptr + Fu struct { + FpDestructor [0]uintptr + FpHash uintptr + } +} + +type FuncDef = TFuncDef + +type TFuncDefHash = struct { + Fa [23]uintptr +} + +type FuncDefHash = TFuncDefHash + +type TIdList = struct { + FnId int32 + FeU4 Tu8 + Fa [1]TIdList_item +} + +type IdList = TIdList + +type TIndex = struct { + FzName uintptr + FaiColumn uintptr + FaiRowLogEst uintptr + FpTable uintptr + FzColAff uintptr + FpNext uintptr + FpSchema uintptr + FaSortOrder uintptr + FazColl uintptr + FpPartIdxWhere uintptr + FaColExpr uintptr + Ftnum TPgno + FszIdxRow TLogEst + FnKeyCol Tu16 + FnColumn Tu16 + FonError Tu8 + F__ccgo100 uint16 + FnSample int32 + FmxSample int32 + FnSampleCol int32 + FaAvgEq uintptr + FaSample uintptr + FaiRowEst uintptr + FnRowEst0 TtRowcnt + FcolNotIdxed TBitmask +} + +type Index = TIndex + +type TIndexedExpr = struct { + FpExpr uintptr + FiDataCur int32 + FiIdxCur int32 + FiIdxCol int32 + FbMaybeNullRow Tu8 + Faff Tu8 + FpIENext uintptr +} + +type IndexedExpr = TIndexedExpr + +type TIndexSample = struct { + Fp uintptr + Fn int32 + FanEq uintptr + FanLt uintptr + FanDLt uintptr +} + +type IndexSample = TIndexSample + +type TKeyInfo = struct { + FnRef Tu32 + Fenc Tu8 + FnKeyField Tu16 + FnAllField Tu16 + Fdb uintptr + FaSortFlags uintptr + FaColl [1]uintptr +} + +type KeyInfo = TKeyInfo + +type TLookaside = struct { + FbDisable Tu32 + Fsz Tu16 + FszTrue Tu16 + FbMalloced Tu8 + FnSlot Tu32 + FanStat [3]Tu32 + FpInit uintptr + FpFree uintptr + FpSmallInit uintptr + FpSmallFree uintptr + FpMiddle uintptr + FpStart uintptr + FpEnd uintptr + FpTrueEnd uintptr +} + +type Lookaside = TLookaside + +type TLookasideSlot = struct { + FpNext uintptr +} + +type LookasideSlot = TLookasideSlot + +type TModule = struct { + FpModule uintptr + FzName uintptr + FnRefModule int32 + FpAux uintptr + FxDestroy uintptr + FpEpoTab uintptr +} + +type Module = TModule + +type TNameContext = struct { + FpParse uintptr + FpSrcList uintptr + FuNC struct { + FpAggInfo [0]uintptr + FpUpsert [0]uintptr + FiBaseReg [0]int32 + FpEList uintptr + } + FpNext uintptr + FnRef int32 + FnNcErr int32 + FncFlags int32 + FnNestedSelect Tu32 + FpWinSelect uintptr +} + +type NameContext = TNameContext + +type TOnOrUsing = struct { + FpOn uintptr + FpUsing uintptr +} + +type OnOrUsing = TOnOrUsing + +type TParse = struct { + Fdb uintptr + FzErrMsg uintptr + FpVdbe uintptr + Frc int32 + FcolNamesSet Tu8 + FcheckSchema Tu8 + Fnested Tu8 + FnTempReg Tu8 + FisMultiWrite Tu8 + FmayAbort Tu8 + FhasCompound Tu8 + FokConstFactor Tu8 + FdisableLookaside Tu8 + FprepFlags Tu8 + FwithinRJSubrtn Tu8 + FnRangeReg int32 + FiRangeReg int32 + FnErr int32 + FnTab int32 + FnMem int32 + FszOpAlloc int32 + FiSelfTab int32 + FnLabel int32 + FnLabelAlloc int32 + FaLabel uintptr + FpConstExpr uintptr + FpIdxEpr uintptr + FpIdxPartExpr uintptr + FconstraintName TToken + FwriteMask TyDbMask + FcookieMask TyDbMask + FregRowid int32 + FregRoot int32 + FnMaxArg int32 + FnSelect int32 + FnProgressSteps Tu32 + FnTableLock int32 + FaTableLock uintptr + FpAinc uintptr + FpToplevel uintptr + FpTriggerTab uintptr + FpTriggerPrg uintptr + FpCleanup uintptr + Fu1 struct { + FpReturning [0]uintptr + FaddrCrTab int32 + F__ccgo_pad2 [4]byte + } + Foldmask Tu32 + Fnewmask Tu32 + FnQueryLoop TLogEst + FeTriggerOp Tu8 + FbReturning Tu8 + FeOrconf Tu8 + FdisableTriggers Tu8 + FaTempReg [8]int32 + FpOuterParse uintptr + FsNameToken TToken + FsLastToken TToken + FnVar TynVar + FiPkSortOrder Tu8 + Fexplain Tu8 + FeParseMode Tu8 + FnVtabLock int32 + FnHeight int32 + FaddrExplain int32 + FpVList uintptr + FpReprepare uintptr + FzTail uintptr + FpNewTable uintptr + FpNewIndex uintptr + FpNewTrigger uintptr + FzAuthContext uintptr + FsArg TToken + FapVtabLock uintptr + FpWith uintptr + FpRename uintptr +} + +type Parse = TParse + +type TParseCleanup = struct { + FpNext uintptr + FpPtr uintptr + FxCleanup uintptr +} + +type ParseCleanup = TParseCleanup + +type TPreUpdate = struct { + Fv uintptr + FpCsr uintptr + Fop int32 + FaRecord uintptr + Fkeyinfo TKeyInfo + FpUnpacked uintptr + FpNewUnpacked uintptr + FiNewReg int32 + FiBlobWrite int32 + FiKey1 Ti64 + FiKey2 Ti64 + FaNew uintptr + FpTab uintptr + FpPk uintptr +} + +type PreUpdate = TPreUpdate + +type TPrintfArguments = struct { + FnArg int32 + FnUsed int32 + FapArg uintptr +} + +type PrintfArguments = TPrintfArguments + +type TRCStr = struct { + FnRCRef Tu64 +} + +type RCStr = TRCStr + +type TRenameToken = struct { + Fp uintptr + Ft TToken + FpNext uintptr +} + +type RenameToken = TRenameToken + +type TReturning = struct { + FpParse uintptr + FpReturnEL uintptr + FretTrig TTrigger + FretTStep TTriggerStep + FiRetCur int32 + FnRetCol int32 + FiRetReg int32 + FzName [40]int8 +} + +type Returning = TReturning + +type TRowSet = struct { + FpChunk uintptr + Fdb uintptr + FpEntry uintptr + FpLast uintptr + FpFresh uintptr + FpForest uintptr + FnFresh Tu16 + FrsFlags Tu16 + FiBatch int32 +} + +type RowSet = TRowSet + +type TSavepoint = struct { + FzName uintptr + FnDeferredCons Ti64 + FnDeferredImmCons Ti64 + FpNext uintptr +} + +type Savepoint = TSavepoint + +type TSelect = struct { + Fop Tu8 + FnSelectRow TLogEst + FselFlags Tu32 + FiLimit int32 + FiOffset int32 + FselId Tu32 + FaddrOpenEphm [2]int32 + FpEList uintptr + FpSrc uintptr + FpWhere uintptr + FpGroupBy uintptr + FpHaving uintptr + FpOrderBy uintptr + FpPrior uintptr + FpNext uintptr + FpLimit uintptr + FpWith uintptr + FpWin uintptr + FpWinDefn uintptr +} + +type Select = TSelect + +type TSQLiteThread = struct { + Ftid Tpthread_t + Fdone int32 + FpOut uintptr + FxTask uintptr + FpIn uintptr +} + +type SQLiteThread = TSQLiteThread + +type TSelectDest = struct { + FeDest Tu8 + FiSDParm int32 + FiSDParm2 int32 + FiSdst int32 + FnSdst int32 + FzAffSdst uintptr + FpOrderBy uintptr +} + +type SelectDest = TSelectDest + +type TSrcItem = struct { + FpSchema uintptr + FzDatabase uintptr + FzName uintptr + FzAlias uintptr + FpTab uintptr + FpSelect uintptr + FaddrFillSub int32 + FregReturn int32 + FregResult int32 + Ffg struct { + F__ccgo_align [0]uint32 + Fjointype Tu8 + F__ccgo_align1 [2]byte + F__ccgo4 uint16 + } + FiCursor int32 + Fu3 struct { + FpUsing [0]uintptr + FpOn uintptr + } + FcolUsed TBitmask + Fu1 struct { + FpFuncArg [0]uintptr + FzIndexedBy uintptr + } + Fu2 struct { + FpCteUse [0]uintptr + FpIBIndex uintptr + } +} + +type SrcItem = TSrcItem + +type TSrcList = struct { + FnSrc int32 + FnAlloc Tu32 + Fa [1]TSrcItem +} + +type SrcList = TSrcList + +type TStrAccum = struct { + Fdb uintptr + FzText uintptr + FnAlloc Tu32 + FmxAlloc Tu32 + FnChar Tu32 + FaccError Tu8 + FprintfFlags Tu8 +} + +type StrAccum = TStrAccum + +type Tsqlite3_str1 = TStrAccum + +type sqlite3_str1 = Tsqlite3_str1 + +/* Internal alias for sqlite3_str */ +type TTable = struct { + FzName uintptr + FaCol uintptr + FpIndex uintptr + FzColAff uintptr + FpCheck uintptr + Ftnum TPgno + FnTabRef Tu32 + FtabFlags Tu32 + FiPKey Ti16 + FnCol Ti16 + FnNVCol Ti16 + FnRowLogEst TLogEst + FszTabRow TLogEst + FkeyConf Tu8 + FeTabType Tu8 + Fu struct { + Fview [0]struct { + FpSelect uintptr + } + Fvtab [0]struct { + FnArg int32 + FazArg uintptr + Fp uintptr + } + Ftab struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + } + } + FpTrigger uintptr + FpSchema uintptr +} + +type Table = TTable + +type TTableLock = struct { + FiDb int32 + FiTab TPgno + FisWriteLock Tu8 + FzLockName uintptr +} + +type TableLock = TTableLock + +type TToken = struct { + Fz uintptr + Fn uint32 +} + +type Token = TToken + +type TTrigger = struct { + FzName uintptr + Ftable uintptr + Fop Tu8 + Ftr_tm Tu8 + FbReturning Tu8 + FpWhen uintptr + FpColumns uintptr + FpSchema uintptr + FpTabSchema uintptr + Fstep_list uintptr + FpNext uintptr +} + +type Trigger = TTrigger + +type TTriggerPrg = struct { + FpTrigger uintptr + FpNext uintptr + FpProgram uintptr + Forconf int32 + FaColmask [2]Tu32 +} + +type TriggerPrg = TTriggerPrg + +type TTriggerStep = struct { + Fop Tu8 + Forconf Tu8 + FpTrig uintptr + FpSelect uintptr + FzTarget uintptr + FpFrom uintptr + FpWhere uintptr + FpExprList uintptr + FpIdList uintptr + FpUpsert uintptr + FzSpan uintptr + FpNext uintptr + FpLast uintptr +} + +type TriggerStep = TTriggerStep + +type TUnpackedRecord = struct { + FpKeyInfo uintptr + FaMem uintptr + Fu struct { + Fi [0]Ti64 + Fz uintptr + } + Fn int32 + FnField Tu16 + Fdefault_rc Ti8 + FerrCode Tu8 + Fr1 Ti8 + Fr2 Ti8 + FeqSeen Tu8 +} + +type UnpackedRecord = TUnpackedRecord + +type TUpsert = struct { + FpUpsertTarget uintptr + FpUpsertTargetWhere uintptr + FpUpsertSet uintptr + FpUpsertWhere uintptr + FpNextUpsert uintptr + FisDoUpdate Tu8 + FisDup Tu8 + FpToFree uintptr + FpUpsertIdx uintptr + FpUpsertSrc uintptr + FregData int32 + FiDataCur int32 + FiIdxCur int32 +} + +type Upsert = TUpsert + +type TVTable = struct { + Fdb uintptr + FpMod uintptr + FpVtab uintptr + FnRef int32 + FbConstraint Tu8 + FbAllSchemas Tu8 + FeVtabRisk Tu8 + FiSavepoint int32 + FpNext uintptr +} + +type VTable = TVTable + +type TVtabCtx = struct { + FpVTable uintptr + FpTab uintptr + FpPrior uintptr + FbDeclared int32 +} + +type VtabCtx = TVtabCtx + +type TWalker = struct { + FpParse uintptr + FxExprCallback uintptr + FxSelectCallback uintptr + FxSelectCallback2 uintptr + FwalkerDepth int32 + FeCode Tu16 + FmWFlags Tu16 + Fu struct { + Fn [0]int32 + FiCur [0]int32 + FpSrcList [0]uintptr + FpCCurHint [0]uintptr + FpRefSrcList [0]uintptr + FaiCol [0]uintptr + FpIdxCover [0]uintptr + FpGroupBy [0]uintptr + FpSelect [0]uintptr + FpRewrite [0]uintptr + FpConst [0]uintptr + FpRename [0]uintptr + FpTab [0]uintptr + FpCovIdxCk [0]uintptr + FpSrcItem [0]uintptr + FpFix [0]uintptr + FaMem [0]uintptr + FpNC uintptr + } +} + +type Walker = TWalker + +type TWhereInfo = struct { + FpParse uintptr + FpTabList uintptr + FpOrderBy uintptr + FpResultSet uintptr + FpSelect uintptr + FaiCurOnePass [2]int32 + FiContinue int32 + FiBreak int32 + FsavedNQueryLoop int32 + FwctrlFlags Tu16 + FiLimit TLogEst + FnLevel Tu8 + FnOBSat Ti8 + FeOnePass Tu8 + FeDistinct Tu8 + F__ccgo68 uint8 + FnRowOut TLogEst + FiTop int32 + FiEndWhere int32 + FpLoops uintptr + FpMemToFree uintptr + FrevMask TBitmask + FsWC TWhereClause + FsMaskSet TWhereMaskSet + Fa [1]TWhereLevel +} + +type WhereInfo = TWhereInfo + +type TWindow = struct { + FzName uintptr + FzBase uintptr + FpPartition uintptr + FpOrderBy uintptr + FeFrmType Tu8 + FeStart Tu8 + FeEnd Tu8 + FbImplicitFrame Tu8 + FeExclude Tu8 + FpStart uintptr + FpEnd uintptr + FppThis uintptr + FpNextWin uintptr + FpFilter uintptr + FpWFunc uintptr + FiEphCsr int32 + FregAccum int32 + FregResult int32 + FcsrApp int32 + FregApp int32 + FregPart int32 + FpOwner uintptr + FnBufferCol int32 + FiArgCol int32 + FregOne int32 + FregStartRowid int32 + FregEndRowid int32 + FbExprArgs Tu8 +} + +type Window = TWindow + +type TWith = struct { + FnCte int32 + FbView int32 + FpOuter uintptr + Fa [1]TCte +} + +type With = TWith + +// C documentation +// +// /* +// ** The bitmask datatype defined below is used for various optimizations. +// ** +// ** Changing this from a 64-bit to a 32-bit type limits the number of +// ** tables in a join to 32 instead of 64. But it also reduces the size +// ** of the library by 738 bytes on ix86. +// */ +type TBitmask = uint64 + +type Bitmask = TBitmask + +/* +** The number of bits in a Bitmask. "BMS" means "BitMask Size". + */ + +/* +** A bit in a Bitmask + */ + +// C documentation +// +// /* A VList object records a mapping between parameters/variables/wildcards +// ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer +// ** variable number associated with that parameter. See the format description +// ** on the sqlite3VListAdd() routine for more information. A VList is really +// ** just an array of integers. +// */ +type TVList = int32 + +type VList = TVList + +/************** End of os.h **************************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ +/************** Include pager.h in the middle of sqliteInt.h *****************/ +/************** Begin file pager.h *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the sqlite page cache +** subsystem. The page cache subsystem reads and writes a file a page +** at a time and provides a journal for rollback. + */ + +/* +** Default maximum size for persistent journal files. A negative +** value means no limit. This value may be overridden using the +** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". + */ + +// C documentation +// +// /* +// ** The type used to represent a page number. The first page in a file +// ** is called page 1. 0 is used to represent "not a page". +// */ +type TPgno = uint32 + +type Pgno = TPgno + +// C documentation +// +// /* +// ** Each open file is managed by a separate instance of the "Pager" structure. +// */ +type TPager = struct { + FpVfs uintptr + FexclusiveMode Tu8 + FjournalMode Tu8 + FuseJournal Tu8 + FnoSync Tu8 + FfullSync Tu8 + FextraSync Tu8 + FsyncFlags Tu8 + FwalSyncFlags Tu8 + FtempFile Tu8 + FnoLock Tu8 + FreadOnly Tu8 + FmemDb Tu8 + FmemVfs Tu8 + FeState Tu8 + FeLock Tu8 + FchangeCountDone Tu8 + FsetSuper Tu8 + FdoNotSpill Tu8 + FsubjInMemory Tu8 + FbUseFetch Tu8 + FhasHeldSharedLock Tu8 + FdbSize TPgno + FdbOrigSize TPgno + FdbFileSize TPgno + FdbHintSize TPgno + FerrCode int32 + FnRec int32 + FcksumInit Tu32 + FnSubRec Tu32 + FpInJournal uintptr + Ffd uintptr + Fjfd uintptr + Fsjfd uintptr + FjournalOff Ti64 + FjournalHdr Ti64 + FpBackup uintptr + FaSavepoint uintptr + FnSavepoint int32 + FiDataVersion Tu32 + FdbFileVers [16]int8 + FnMmapOut int32 + FszMmap Tsqlite3_int64 + FpMmapFreelist uintptr + FnExtra Tu16 + FnReserve Ti16 + FvfsFlags Tu32 + FsectorSize Tu32 + FmxPgno TPgno + FlckPgno TPgno + FpageSize Ti64 + FjournalSizeLimit Ti64 + FzFilename uintptr + FzJournal uintptr + FxBusyHandler uintptr + FpBusyHandlerArg uintptr + FaStat [4]Tu32 + FxReiniter uintptr + FxGet uintptr + FpTmpSpace uintptr + FpPCache uintptr + FpWal uintptr + FzWal uintptr +} + +type Pager = TPager + +// C documentation +// +// /* +// ** Handle type for pages. +// */ +type TDbPage = struct { + FpPage uintptr + FpData uintptr + FpExtra uintptr + FpCache uintptr + FpDirty uintptr + FpPager uintptr + Fpgno TPgno + Fflags Tu16 + FnRef Ti64 + FpDirtyNext uintptr + FpDirtyPrev uintptr +} + +type DbPage = TDbPage + +// C documentation +// +// /* +// ** Handle type for pages. +// */ +type TPgHdr2 = TDbPage + +type PgHdr2 = TPgHdr2 + +/* Functions to support testing and debugging. */ + +/************** End of pager.h ***********************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ +/************** Include btree.h in the middle of sqliteInt.h *****************/ +/************** Begin file btree.h *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the sqlite B-Tree file +** subsystem. See comments in the source code for a detailed description +** of what each interface routine does. + */ + +/* TODO: This definition is just included so other modules compile. It +** needs to be revisited. + */ + +/* +** If defined as non-zero, auto-vacuum is enabled by default. Otherwise +** it must be turned on for each database using "PRAGMA auto_vacuum = 1". + */ + +// C documentation +// +// /* +// ** Forward declarations of structure +// */ +type TBtree = struct { + Fdb uintptr + FpBt uintptr + FinTrans Tu8 + Fsharable Tu8 + Flocked Tu8 + FhasIncrblobCur Tu8 + FwantToLock int32 + FnBackup int32 + FiBDataVersion Tu32 + FpNext uintptr + FpPrev uintptr + Flock TBtLock +} + +type Btree = TBtree + +type TBtCursor = struct { + FeState Tu8 + FcurFlags Tu8 + FcurPagerFlags Tu8 + Fhints Tu8 + FskipNext int32 + FpBtree uintptr + FaOverflow uintptr + FpKey uintptr + FpBt uintptr + FpNext uintptr + Finfo TCellInfo + FnKey Ti64 + FpgnoRoot TPgno + FiPage Ti8 + FcurIntKey Tu8 + Fix Tu16 + FaiIdx [19]Tu16 + FpKeyInfo uintptr + FpPage uintptr + FapPage [19]uintptr +} + +type BtCursor = TBtCursor + +type TBtShared = struct { + FpPager uintptr + Fdb uintptr + FpCursor uintptr + FpPage1 uintptr + FopenFlags Tu8 + FautoVacuum Tu8 + FincrVacuum Tu8 + FbDoTruncate Tu8 + FinTransaction Tu8 + Fmax1bytePayload Tu8 + FnReserveWanted Tu8 + FbtsFlags Tu16 + FmaxLocal Tu16 + FminLocal Tu16 + FmaxLeaf Tu16 + FminLeaf Tu16 + FpageSize Tu32 + FusableSize Tu32 + FnTransaction int32 + FnPage Tu32 + FpSchema uintptr + FxFreeSchema uintptr + Fmutex uintptr + FpHasContent uintptr + FnRef int32 + FpNext uintptr + FpLock uintptr + FpWriter uintptr + FpTmpSpace uintptr + FnPreformatSize int32 +} + +type BtShared = TBtShared + +type TBtreePayload = struct { + FpKey uintptr + FnKey Tsqlite3_int64 + FpData uintptr + FaMem uintptr + FnMem Tu16 + FnData int32 + FnZero int32 +} + +type BtreePayload = TBtreePayload + +/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */ + +/* An instance of the BtreePayload object describes the content of a single +** entry in either an index or table btree. +** +** Index btrees (used for indexes and also WITHOUT ROWID tables) contain +** an arbitrary key and no data. These btrees have pKey,nKey set to the +** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem +** fields give an array of Mem objects that are a decomposition of the key. +** The nMem field might be zero, indicating that no decomposition is available. +** +** Table btrees (used for rowid tables) contain an integer rowid used as +** the key and passed in the nKey field. The pKey field is zero. +** pData,nData hold the content of the new entry. nZero extra zero bytes +** are appended to the end of the content when constructing the entry. +** The aMem,nMem fields are uninitialized for table btrees. +** +** Field usage summary: +** +** Table BTrees Index Btrees +** +** pKey always NULL encoded key +** nKey the ROWID length of pKey +** pData data not used +** aMem not used decomposed key value +** nMem not used entries in aMem +** nData length of pData not used +** nZero extra zeros after pData not used +** +** This object is used to pass information into sqlite3BtreeInsert(). The +** same information used to be passed as five separate parameters. But placing +** the information into this object helps to keep the interface more +** organized and understandable, and it also helps the resulting code to +** run a little faster by using fewer registers for parameter passing. + */ +type TBtreePayload1 = struct { + FpKey uintptr + FnKey Tsqlite3_int64 + FpData uintptr + FaMem uintptr + FnMem Tu16 + FnData int32 + FnZero int32 +} + +type BtreePayload1 = TBtreePayload1 + +/************** End of btree.h ***********************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ +/************** Include vdbe.h in the middle of sqliteInt.h ******************/ +/************** Begin file vdbe.h ********************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Header file for the Virtual DataBase Engine (VDBE) +** +** This header defines the interface to the virtual database engine +** or VDBE. The VDBE implements an abstract machine that runs a +** simple program to access and modify the underlying database. + */ +/* #include */ + +// C documentation +// +// /* +// ** A single VDBE is an opaque structure named "Vdbe". Only routines +// ** in the source file sqliteVdbe.c are allowed to see the insides +// ** of this structure. +// */ +type TVdbe = struct { + Fdb uintptr + FppVPrev uintptr + FpVNext uintptr + FpParse uintptr + FnVar TynVar + FnMem int32 + FnCursor int32 + FcacheCtr Tu32 + Fpc int32 + Frc int32 + FnChange Ti64 + FiStatement int32 + FiCurrentTime Ti64 + FnFkConstraint Ti64 + FnStmtDefCons Ti64 + FnStmtDefImmCons Ti64 + FaMem uintptr + FapArg uintptr + FapCsr uintptr + FaVar uintptr + FaOp uintptr + FnOp int32 + FnOpAlloc int32 + FaColName uintptr + FpResultRow uintptr + FzErrMsg uintptr + FpVList uintptr + FstartTime Ti64 + FnResColumn Tu16 + FnResAlloc Tu16 + FerrorAction Tu8 + FminWriteFileFormat Tu8 + FprepFlags Tu8 + FeVdbeState Tu8 + F__ccgo200 uint16 + FbtreeMask TyDbMask + FlockMask TyDbMask + FaCounter [9]Tu32 + FzSql uintptr + FpFree uintptr + FpFrame uintptr + FpDelFrame uintptr + FnFrame int32 + Fexpmask Tu32 + FpProgram uintptr + FpAuxData uintptr +} + +type Vdbe = TVdbe + +// C documentation +// +// /* +// ** The names of the following types declared in vdbeInt.h are required +// ** for the VdbeOp definition. +// */ +type TMem = struct { + Fu TMemValue + Fz uintptr + Fn int32 + Fflags Tu16 + Fenc Tu8 + FeSubtype Tu8 + Fdb uintptr + FszMalloc int32 + FuTemp Tu32 + FzMalloc uintptr + FxDel uintptr +} + +type Mem = TMem + +// C documentation +// +// /* +// ** The names of the following types declared in vdbeInt.h are required +// ** for the VdbeOp definition. +// */ +type Tsqlite3_value1 = TMem + +type sqlite3_value1 = Tsqlite3_value1 + +type TSubProgram = struct { + FaOp uintptr + FnOp int32 + FnMem int32 + FnCsr int32 + FaOnce uintptr + Ftoken uintptr + FpNext uintptr +} + +type SubProgram = TSubProgram + +/* +** A single instruction of the virtual machine has an opcode +** and as many as three operands. The instruction is recorded +** as an instance of the following structure: + */ +type TVdbeOp1 = struct { + Fopcode Tu8 + Fp4type int8 + Fp5 Tu16 + Fp1 int32 + Fp2 int32 + Fp3 int32 + Fp4 Tp4union +} + +type VdbeOp1 = TVdbeOp1 + +type TVdbeOp = struct { + Fopcode Tu8 + Fp4type int8 + Fp5 Tu16 + Fp1 int32 + Fp2 int32 + Fp3 int32 + Fp4 Tp4union +} + +type VdbeOp = TVdbeOp + +/* +** A sub-routine used to implement a trigger program. + */ +type TSubProgram1 = struct { + FaOp uintptr + FnOp int32 + FnMem int32 + FnCsr int32 + FaOnce uintptr + Ftoken uintptr + FpNext uintptr +} + +type SubProgram1 = TSubProgram1 + +/* +** A smaller version of VdbeOp used for the VdbeAddOpList() function because +** it takes up less space. + */ +type TVdbeOpList1 = struct { + Fopcode Tu8 + Fp1 int8 + Fp2 int8 + Fp3 int8 +} + +type VdbeOpList1 = TVdbeOpList1 + +type TVdbeOpList = struct { + Fopcode Tu8 + Fp1 int8 + Fp2 int8 + Fp3 int8 +} + +type VdbeOpList = TVdbeOpList + +type TRecordCompare = uintptr + +type RecordCompare = TRecordCompare + +/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on +** each VDBE opcode. +** +** Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op +** comments in VDBE programs that show key decision points in the code +** generator. + */ + +/* +** The VdbeCoverage macros are used to set a coverage testing point +** for VDBE branch instructions. The coverage testing points are line +** numbers in the sqlite3.c source file. VDBE branch coverage testing +** only works with an amalgamation build. That's ok since a VDBE branch +** coverage build designed for testing the test suite only. No application +** should ever ship with VDBE branch coverage measuring turned on. +** +** VdbeCoverage(v) // Mark the previously coded instruction +** // as a branch +** +** VdbeCoverageIf(v, conditional) // Mark previous if conditional true +** +** VdbeCoverageAlwaysTaken(v) // Previous branch is always taken +** +** VdbeCoverageNeverTaken(v) // Previous branch is never taken +** +** VdbeCoverageNeverNull(v) // Previous three-way branch is only +** // taken on the first two ways. The +** // NULL option is not possible +** +** VdbeCoverageEqNe(v) // Previous OP_Jump is only interested +** // in distinguishing equal and not-equal. +** +** Every VDBE branch operation must be tagged with one of the macros above. +** If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and +** -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch() +** routine in vdbe.c, alerting the developer to the missed tag. +** +** During testing, the test application will invoke +** sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback +** routine that is invoked as each bytecode branch is taken. The callback +** contains the sqlite3.c source line number of the VdbeCoverage macro and +** flags to indicate whether or not the branch was taken. The test application +** is responsible for keeping track of this and reporting byte-code branches +** that are never taken. +** +** See the VdbeBranchTaken() macro and vdbeTakeBranch() function in the +** vdbe.c source file for additional information. + */ + +/************** End of vdbe.h ************************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ +/************** Include pcache.h in the middle of sqliteInt.h ****************/ +/************** Begin file pcache.h ******************************************/ +/* +** 2008 August 05 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the sqlite page cache +** subsystem. + */ + +type TPgHdr = struct { + FpPage uintptr + FpData uintptr + FpExtra uintptr + FpCache uintptr + FpDirty uintptr + FpPager uintptr + Fpgno TPgno + Fflags Tu16 + FnRef Ti64 + FpDirtyNext uintptr + FpDirtyPrev uintptr +} + +type PgHdr = TPgHdr + +type TPCache = struct { + FpDirty uintptr + FpDirtyTail uintptr + FpSynced uintptr + FnRefSum Ti64 + FszCache int32 + FszSpill int32 + FszPage int32 + FszExtra int32 + FbPurgeable Tu8 + FeCreate Tu8 + FxStress uintptr + FpStress uintptr + FpCache uintptr +} + +type PCache = TPCache + +/************** End of mutex.h ***********************************************/ +/************** Continuing where we left off in sqliteInt.h ******************/ + +/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default +** synchronous setting to EXTRA. It is no longer supported. + */ + +/* +** Default synchronous levels. +** +** Note that (for historical reasons) the PAGER_SYNCHRONOUS_* macros differ +** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1. +** +** PAGER_SYNCHRONOUS DEFAULT_SYNCHRONOUS +** OFF 1 0 +** NORMAL 2 1 +** FULL 3 2 +** EXTRA 4 3 +** +** The "PRAGMA synchronous" statement also uses the zero-based numbers. +** In other words, the zero-based numbers are used for all external interfaces +** and the one-based values are used internally. + */ + +/* +** Each database file to be accessed by the system is an instance +** of the following structure. There are normally two of these structures +** in the sqlite.aDb[] array. aDb[0] is the main database file and +** aDb[1] is the database file used to hold temporary tables. Additional +** databases may be attached. + */ +type TDb1 = struct { + FzDbSName uintptr + FpBt uintptr + Fsafety_level Tu8 + FbSyncSet Tu8 + FpSchema uintptr +} + +type Db1 = TDb1 + +/* +** An instance of the following structure stores a database schema. +** +** Most Schema objects are associated with a Btree. The exception is +** the Schema for the TEMP database (sqlite3.aDb[1]) which is free-standing. +** In shared cache mode, a single Schema object can be shared by multiple +** Btrees that refer to the same underlying BtShared object. +** +** Schema objects are automatically deallocated when the last Btree that +** references them is destroyed. The TEMP Schema is manually freed by +** sqlite3_close(). +* +** A thread must be holding a mutex on the corresponding Btree in order +** to access Schema content. This implies that the thread must also be +** holding a mutex on the sqlite3 connection pointer that owns the Btree. +** For a TEMP Schema, only the connection mutex is required. + */ +type TSchema1 = struct { + Fschema_cookie int32 + FiGeneration int32 + FtblHash THash + FidxHash THash + FtrigHash THash + FfkeyHash THash + FpSeqTab uintptr + Ffile_format Tu8 + Fenc Tu8 + FschemaFlags Tu16 + Fcache_size int32 +} + +type Schema1 = TSchema1 + +/* +** These macros can be used to test, set, or clear bits in the +** Db.pSchema->flags field. + */ + +/* +** Allowed values for the DB.pSchema->flags field. +** +** The DB_SchemaLoaded flag is set after the database schema has been +** read into internal hash tables. +** +** DB_UnresetViews means that one or more views have column names that +** have been filled out. If the schema changes, these column names might +** changes and so the view will need to be reset. + */ + +/* +** The number of different kinds of things that can be limited +** using the sqlite3_limit() interface. + */ + +/* +** Lookaside malloc is a set of fixed-size buffers that can be used +** to satisfy small transient memory allocation requests for objects +** associated with a particular database connection. The use of +** lookaside malloc provides a significant performance enhancement +** (approx 10%) by avoiding numerous malloc/free requests while parsing +** SQL statements. +** +** The Lookaside structure holds configuration information about the +** lookaside malloc subsystem. Each available memory allocation in +** the lookaside subsystem is stored on a linked list of LookasideSlot +** objects. +** +** Lookaside allocations are only allowed for objects that are associated +** with a particular database connection. Hence, schema information cannot +** be stored in lookaside because in shared cache mode the schema information +** is shared by multiple database connections. Therefore, while parsing +** schema information, the Lookaside.bEnabled flag is cleared so that +** lookaside allocations are not used to construct the schema objects. +** +** New lookaside allocations are only allowed if bDisable==0. When +** bDisable is greater than zero, sz is set to zero which effectively +** disables lookaside without adding a new test for the bDisable flag +** in a performance-critical path. sz should be set by to szTrue whenever +** bDisable changes back to zero. +** +** Lookaside buffers are initially held on the pInit list. As they are +** used and freed, they are added back to the pFree list. New allocations +** come off of pFree first, then pInit as a fallback. This dual-list +** allows use to compute a high-water mark - the maximum number of allocations +** outstanding at any point in the past - by subtracting the number of +** allocations on the pInit list from the total number of allocations. +** +** Enhancement on 2019-12-12: Two-size-lookaside +** The default lookaside configuration is 100 slots of 1200 bytes each. +** The larger slot sizes are important for performance, but they waste +** a lot of space, as most lookaside allocations are less than 128 bytes. +** The two-size-lookaside enhancement breaks up the lookaside allocation +** into two pools: One of 128-byte slots and the other of the default size +** (1200-byte) slots. Allocations are filled from the small-pool first, +** failing over to the full-size pool if that does not work. Thus more +** lookaside slots are available while also using less memory. +** This enhancement can be omitted by compiling with +** SQLITE_OMIT_TWOSIZE_LOOKASIDE. + */ +type TLookaside1 = struct { + FbDisable Tu32 + Fsz Tu16 + FszTrue Tu16 + FbMalloced Tu8 + FnSlot Tu32 + FanStat [3]Tu32 + FpInit uintptr + FpFree uintptr + FpSmallInit uintptr + FpSmallFree uintptr + FpMiddle uintptr + FpStart uintptr + FpEnd uintptr + FpTrueEnd uintptr +} + +type Lookaside1 = TLookaside1 + +type TLookasideSlot1 = struct { + FpNext uintptr +} + +type LookasideSlot1 = TLookasideSlot1 + +/* Size of the smaller allocations in two-size lookaside */ + +/* +** A hash table for built-in function definitions. (Application-defined +** functions use a regular table table from hash.h.) +** +** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. +** Collisions are on the FuncDef.u.pHash chain. Use the SQLITE_FUNC_HASH() +** macro to compute a hash on the function name. + */ +type TFuncDefHash1 = struct { + Fa [23]uintptr +} + +type FuncDefHash1 = TFuncDefHash1 + +// C documentation +// +// /* +// ** typedef for the authorization callback function. +// */ +type Tsqlite3_xauth = uintptr + +type sqlite3_xauth = Tsqlite3_xauth + +/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing +** in the style of sqlite3_trace() + */ + +/* +** Maximum number of sqlite3.aDb[] entries. This is the number of attached +** databases plus 2 for "main" and "temp". + */ + +/* +** Each database connection is an instance of the following structure. + */ +type Tsqlite31 = struct { + FpVfs uintptr + FpVdbe uintptr + FpDfltColl uintptr + Fmutex uintptr + FaDb uintptr + FnDb int32 + FmDbFlags Tu32 + Fflags Tu64 + FlastRowid Ti64 + FszMmap Ti64 + FnSchemaLock Tu32 + FopenFlags uint32 + FerrCode int32 + FerrByteOffset int32 + FerrMask int32 + FiSysErrno int32 + FdbOptFlags Tu32 + Fenc Tu8 + FautoCommit Tu8 + Ftemp_store Tu8 + FmallocFailed Tu8 + FbBenignMalloc Tu8 + FdfltLockMode Tu8 + FnextAutovac int8 + FsuppressErr Tu8 + FvtabOnConflict Tu8 + FisTransactionSavepoint Tu8 + FmTrace Tu8 + FnoSharedCache Tu8 + FnSqlExec Tu8 + FeOpenState Tu8 + FnextPagesize int32 + FnChange Ti64 + FnTotalChange Ti64 + FaLimit [12]int32 + FnMaxSorterMmap int32 + Finit1 Tsqlite3InitInfo + FnVdbeActive int32 + FnVdbeRead int32 + FnVdbeWrite int32 + FnVdbeExec int32 + FnVDestroy int32 + FnExtension int32 + FaExtension uintptr + Ftrace struct { + FxV2 [0]uintptr + FxLegacy uintptr + } + FpTraceArg uintptr + FxProfile uintptr + FpProfileArg uintptr + FpCommitArg uintptr + FxCommitCallback uintptr + FpRollbackArg uintptr + FxRollbackCallback uintptr + FpUpdateArg uintptr + FxUpdateCallback uintptr + FpAutovacPagesArg uintptr + FxAutovacDestr uintptr + FxAutovacPages uintptr + FpParse uintptr + FpPreUpdateArg uintptr + FxPreUpdateCallback uintptr + FpPreUpdate uintptr + FxWalCallback uintptr + FpWalArg uintptr + FxCollNeeded uintptr + FxCollNeeded16 uintptr + FpCollNeededArg uintptr + FpErr uintptr + Fu1 struct { + FnotUsed1 [0]float64 + FisInterrupted int32 + F__ccgo_pad2 [4]byte + } + Flookaside TLookaside + FxAuth Tsqlite3_xauth + FpAuthArg uintptr + FxProgress uintptr + FpProgressArg uintptr + FnProgressOps uint32 + FnVTrans int32 + FaModule THash + FpVtabCtx uintptr + FaVTrans uintptr + FpDisconnect uintptr + FaFunc THash + FaCollSeq THash + FbusyHandler TBusyHandler + FaDbStatic [2]TDb + FpSavepoint uintptr + FnAnalysisLimit int32 + FbusyTimeout int32 + FnSavepoint int32 + FnStatement int32 + FnDeferredCons Ti64 + FnDeferredImmCons Ti64 + FpnBytesFreed uintptr + FpDbData uintptr + FpBlockingConnection uintptr + FpUnlockConnection uintptr + FpUnlockArg uintptr + FxUnlockNotify uintptr + FpNextBlocked uintptr +} + +type sqlite31 = Tsqlite31 + +/* +** A macro to discover the encoding of a database. + */ + +/* +** A u64 constant where the lower 32 bits are all zeros. Only the +** upper 32 bits are included in the argument. Necessary because some +** C-compilers still do not accept LL integer literals. + */ + +/* +** Possible values for the sqlite3.flags. +** +** Value constraints (enforced via assert()): +** SQLITE_FullFSync == PAGER_FULLFSYNC +** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC +** SQLITE_CacheSpill == PAGER_CACHE_SPILL + */ +/* result set is empty */ +/* DELETE, or UPDATE and return */ +/* the count using a callback. */ + +/* Flags used only if debugging */ + +/* +** Allowed values for sqlite3.mDbFlags + */ + +/* +** Bits of the sqlite3.dbOptFlags field that are used by the +** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to +** selectively disable various optimizations. + */ +/* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */ +/* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */ +/* TH3 expects this value ^^^^^^^^^^ See flatten04.test */ + +/* +** Macros for testing whether or not optimizations are enabled or disabled. + */ + +/* +** Return true if it OK to factor constant expressions into the initialization +** code. The argument is a Parse object for the code generator. + */ + +/* Possible values for the sqlite3.eOpenState field. +** The numbers are randomly selected such that a minimum of three bits must +** change to convert any number to another or to zero + */ + +/* +** Each SQL function is defined by an instance of the following +** structure. For global built-in functions (ex: substr(), max(), count()) +** a pointer to this structure is held in the sqlite3BuiltinFunctions object. +** For per-connection application-defined functions, a pointer to this +** structure is held in the db->aHash hash table. +** +** The u.pHash field is used by the global built-ins. The u.pDestructor +** field is used by per-connection app-def functions. + */ +type TFuncDef1 = struct { + FnArg Ti8 + FfuncFlags Tu32 + FpUserData uintptr + FpNext uintptr + FxSFunc uintptr + FxFinalize uintptr + FxValue uintptr + FxInverse uintptr + FzName uintptr + Fu struct { + FpDestructor [0]uintptr + FpHash uintptr + } +} + +type FuncDef1 = TFuncDef1 + +/* +** This structure encapsulates a user-function destructor callback (as +** configured using create_function_v2()) and a reference counter. When +** create_function_v2() is called to create a function with a destructor, +** a single object of this type is allocated. FuncDestructor.nRef is set to +** the number of FuncDef objects created (either 1 or 3, depending on whether +** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor +** member of each of the new FuncDef objects is set to point to the allocated +** FuncDestructor. +** +** Thereafter, when one of the FuncDef objects is deleted, the reference +** count on this object is decremented. When it reaches 0, the destructor +** is invoked and the FuncDestructor structure freed. + */ +type TFuncDestructor1 = struct { + FnRef int32 + FxDestroy uintptr + FpUserData uintptr +} + +type FuncDestructor1 = TFuncDestructor1 + +/* +** Possible values for FuncDef.flags. Note that the _LENGTH and _TYPEOF +** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG. And +** SQLITE_FUNC_CONSTANT must be the same as SQLITE_DETERMINISTIC. There +** are assert() statements in the code to verify this. +** +** Value constraints (enforced via assert()): +** SQLITE_FUNC_MINMAX == NC_MinMaxAgg == SF_MinMaxAgg +** SQLITE_FUNC_ANYORDER == NC_OrderAgg == SF_OrderByReqd +** SQLITE_FUNC_LENGTH == OPFLAG_LENGTHARG +** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG +** SQLITE_FUNC_BYTELEN == OPFLAG_BYTELENARG +** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API +** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API +** SQLITE_FUNC_UNSAFE == SQLITE_INNOCUOUS -- opposite meanings!!! +** SQLITE_FUNC_ENCMASK depends on SQLITE_UTF* macros in the API +** +** Note that even though SQLITE_FUNC_UNSAFE and SQLITE_INNOCUOUS have the +** same bit value, their meanings are inverted. SQLITE_FUNC_UNSAFE is +** used internally and if set means that the function has side effects. +** SQLITE_INNOCUOUS is used by application code and means "not unsafe". +** See multiple instances of tag-20230109-1. + */ +/* 0x0200 -- available for reuse */ +/* SQLITE_SUBTYPE 0x00100000 // Consumer of subtypes */ +/* SQLITE_RESULT_SUBTYPE 0x01000000 // Generator of subtypes */ + +/* Identifier numbers for each in-line function */ + +/* +** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are +** used to create the initializers for the FuncDef structures. +** +** FUNCTION(zName, nArg, iArg, bNC, xFunc) +** Used to create a scalar function definition of a function zName +** implemented by C function xFunc that accepts nArg arguments. The +** value passed as iArg is cast to a (void*) and made available +** as the user-data (sqlite3_user_data()) for the function. If +** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. +** +** VFUNCTION(zName, nArg, iArg, bNC, xFunc) +** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag. +** +** SFUNCTION(zName, nArg, iArg, bNC, xFunc) +** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and +** adds the SQLITE_DIRECTONLY flag. +** +** INLINE_FUNC(zName, nArg, iFuncId, mFlags) +** zName is the name of a function that is implemented by in-line +** byte code rather than by the usual callbacks. The iFuncId +** parameter determines the function id. The mFlags parameter is +** optional SQLITE_FUNC_ flags for this function. +** +** TEST_FUNC(zName, nArg, iFuncId, mFlags) +** zName is the name of a test-only function implemented by in-line +** byte code rather than by the usual callbacks. The iFuncId +** parameter determines the function id. The mFlags parameter is +** optional SQLITE_FUNC_ flags for this function. +** +** DFUNCTION(zName, nArg, iArg, bNC, xFunc) +** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and +** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions +** and functions like sqlite_version() that can change, but not during +** a single query. The iArg is ignored. The user-data is always set +** to a NULL pointer. The bNC parameter is not used. +** +** MFUNCTION(zName, nArg, xPtr, xFunc) +** For math-library functions. xPtr is an arbitrary pointer. +** +** PURE_DATE(zName, nArg, iArg, bNC, xFunc) +** Used for "pure" date/time functions, this macro is like DFUNCTION +** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is +** ignored and the user-data for these functions is set to an +** arbitrary non-NULL pointer. The bNC parameter is not used. +** +** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) +** Used to create an aggregate function definition implemented by +** the C functions xStep and xFinal. The first four parameters +** are interpreted in the same way as the first 4 parameters to +** FUNCTION(). +** +** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse) +** Used to create an aggregate function definition implemented by +** the C functions xStep and xFinal. The first four parameters +** are interpreted in the same way as the first 4 parameters to +** FUNCTION(). +** +** LIKEFUNC(zName, nArg, pArg, flags) +** Used to create a scalar function definition of a function zName +** that accepts nArg arguments and is implemented by a call to C +** function likeFunc. Argument pArg is cast to a (void *) and made +** available as the function user-data (sqlite3_user_data()). The +** FuncDef.flags variable is set to the value passed as the flags +** parameter. + */ + +/* +** All current savepoints are stored in a linked list starting at +** sqlite3.pSavepoint. The first element in the list is the most recently +** opened savepoint. Savepoints are added to the list by the vdbe +** OP_Savepoint instruction. + */ +type TSavepoint1 = struct { + FzName uintptr + FnDeferredCons Ti64 + FnDeferredImmCons Ti64 + FpNext uintptr +} + +type Savepoint1 = TSavepoint1 + +/* +** The following are used as the second parameter to sqlite3Savepoint(), +** and as the P1 argument to the OP_Savepoint instruction. + */ + +/* +** Each SQLite module (virtual table definition) is defined by an +** instance of the following structure, stored in the sqlite3.aModule +** hash table. + */ +type TModule1 = struct { + FpModule uintptr + FzName uintptr + FnRefModule int32 + FpAux uintptr + FxDestroy uintptr + FpEpoTab uintptr +} + +type Module1 = TModule1 + +/* +** Information about each column of an SQL table is held in an instance +** of the Column structure, in the Table.aCol[] array. +** +** Definitions: +** +** "table column index" This is the index of the column in the +** Table.aCol[] array, and also the index of +** the column in the original CREATE TABLE stmt. +** +** "storage column index" This is the index of the column in the +** record BLOB generated by the OP_MakeRecord +** opcode. The storage column index is less than +** or equal to the table column index. It is +** equal if and only if there are no VIRTUAL +** columns to the left. +** +** Notes on zCnName: +** The zCnName field stores the name of the column, the datatype of the +** column, and the collating sequence for the column, in that order, all in +** a single allocation. Each string is 0x00 terminated. The datatype +** is only included if the COLFLAG_HASTYPE bit of colFlags is set and the +** collating sequence name is only included if the COLFLAG_HASCOLL bit is +** set. + */ +type TColumn1 = struct { + FzCnName uintptr + F__ccgo8 uint8 + Faffinity int8 + FszEst Tu8 + FhName Tu8 + FiDflt Tu16 + FcolFlags Tu16 +} + +type Column1 = TColumn1 + +/* Allowed values for Column.eCType. +** +** Values must match entries in the global constant arrays +** sqlite3StdTypeLen[] and sqlite3StdType[]. Each value is one more +** than the offset into these arrays for the corresponding name. +** Adjust the SQLITE_N_STDTYPE value if adding or removing entries. + */ + +/* Allowed values for Column.colFlags. +** +** Constraints: +** TF_HasVirtual == COLFLAG_VIRTUAL +** TF_HasStored == COLFLAG_STORED +** TF_HasHidden == COLFLAG_HIDDEN + */ + +/* +** A "Collating Sequence" is defined by an instance of the following +** structure. Conceptually, a collating sequence consists of a name and +** a comparison routine that defines the order of that sequence. +** +** If CollSeq.xCmp is NULL, it means that the +** collating sequence is undefined. Indices built on an undefined +** collating sequence may not be read or written. + */ +type TCollSeq1 = struct { + FzName uintptr + Fenc Tu8 + FpUser uintptr + FxCmp uintptr + FxDel uintptr +} + +type CollSeq1 = TCollSeq1 + +/* +** A sort order can be either ASC or DESC. + */ + +/* +** Column affinity types. +** +** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and +** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve +** the speed a little by numbering the values consecutively. +** +** But rather than start with 0 or 1, we begin with 'A'. That way, +** when multiple affinity types are concatenated into a string and +** used as the P4 operand, they will be more readable. +** +** Note also that the numeric types are grouped together so that testing +** for a numeric type is a single comparison. And the BLOB type is first. + */ + +/* +** The SQLITE_AFF_MASK values masks off the significant bits of an +** affinity value. + */ + +/* +** Additional bit values that can be ORed with an affinity without +** changing the affinity. +** +** The SQLITE_NOTNULL flag is a combination of NULLEQ and JUMPIFNULL. +** It causes an assert() to fire if either operand to a comparison +** operator is NULL. It is added to certain comparison operators to +** prove that the operands are always NOT NULL. + */ + +/* +** An object of this type is created for each virtual table present in +** the database schema. +** +** If the database schema is shared, then there is one instance of this +** structure for each database connection (sqlite3*) that uses the shared +** schema. This is because each database connection requires its own unique +** instance of the sqlite3_vtab* handle used to access the virtual table +** implementation. sqlite3_vtab* handles can not be shared between +** database connections, even when the rest of the in-memory database +** schema is shared, as the implementation often stores the database +** connection handle passed to it via the xConnect() or xCreate() method +** during initialization internally. This database connection handle may +** then be used by the virtual table implementation to access real tables +** within the database. So that they appear as part of the callers +** transaction, these accesses need to be made via the same database +** connection as that used to execute SQL operations on the virtual table. +** +** All VTable objects that correspond to a single table in a shared +** database schema are initially stored in a linked-list pointed to by +** the Table.pVTable member variable of the corresponding Table object. +** When an sqlite3_prepare() operation is required to access the virtual +** table, it searches the list for the VTable that corresponds to the +** database connection doing the preparing so as to use the correct +** sqlite3_vtab* handle in the compiled query. +** +** When an in-memory Table object is deleted (for example when the +** schema is being reloaded for some reason), the VTable objects are not +** deleted and the sqlite3_vtab* handles are not xDisconnect()ed +** immediately. Instead, they are moved from the Table.pVTable list to +** another linked list headed by the sqlite3.pDisconnect member of the +** corresponding sqlite3 structure. They are then deleted/xDisconnected +** next time a statement is prepared using said sqlite3*. This is done +** to avoid deadlock issues involving multiple sqlite3.mutex mutexes. +** Refer to comments above function sqlite3VtabUnlockList() for an +** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect +** list without holding the corresponding sqlite3.mutex mutex. +** +** The memory for objects of this type is always allocated by +** sqlite3DbMalloc(), using the connection handle stored in VTable.db as +** the first argument. + */ +type TVTable1 = struct { + Fdb uintptr + FpMod uintptr + FpVtab uintptr + FnRef int32 + FbConstraint Tu8 + FbAllSchemas Tu8 + FeVtabRisk Tu8 + FiSavepoint int32 + FpNext uintptr +} + +type VTable1 = TVTable1 + +/* Allowed values for VTable.eVtabRisk + */ + +/* +** The schema for each SQL table, virtual table, and view is represented +** in memory by an instance of the following structure. + */ +type TTable1 = struct { + FzName uintptr + FaCol uintptr + FpIndex uintptr + FzColAff uintptr + FpCheck uintptr + Ftnum TPgno + FnTabRef Tu32 + FtabFlags Tu32 + FiPKey Ti16 + FnCol Ti16 + FnNVCol Ti16 + FnRowLogEst TLogEst + FszTabRow TLogEst + FkeyConf Tu8 + FeTabType Tu8 + Fu struct { + Fview [0]struct { + FpSelect uintptr + } + Fvtab [0]struct { + FnArg int32 + FazArg uintptr + Fp uintptr + } + Ftab struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + } + } + FpTrigger uintptr + FpSchema uintptr +} + +type Table1 = TTable1 + +/* +** Allowed values for Table.tabFlags. +** +** TF_OOOHidden applies to tables or view that have hidden columns that are +** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING +** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden, +** the TF_OOOHidden attribute would apply in this case. Such tables require +** special handling during INSERT processing. The "OOO" means "Out Of Order". +** +** Constraints: +** +** TF_HasVirtual == COLFLAG_VIRTUAL +** TF_HasStored == COLFLAG_STORED +** TF_HasHidden == COLFLAG_HIDDEN + */ + +/* +** Allowed values for Table.eTabType + */ + +/* +** Test to see whether or not a table is a virtual table. This is +** done as a macro so that it will be optimized out when virtual +** table support is omitted from the build. + */ + +/* +** Macros to determine if a column is hidden. IsOrdinaryHiddenColumn() +** only works for non-virtual tables (ordinary tables and views) and is +** always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined. The +** IsHiddenColumn() macro is general purpose. + */ + +/* Does the table have a rowid */ + +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false + */ + +/* +** Each foreign key constraint is an instance of the following structure. +** +** A foreign key is associated with two tables. The "from" table is +** the table that contains the REFERENCES clause that creates the foreign +** key. The "to" table is the table that is named in the REFERENCES clause. +** Consider this example: +** +** CREATE TABLE ex1( +** a INTEGER PRIMARY KEY, +** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) +** ); +** +** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". +** Equivalent names: +** +** from-table == child-table +** to-table == parent-table +** +** Each REFERENCES clause generates an instance of the following structure +** which is attached to the from-table. The to-table need not exist when +** the from-table is created. The existence of the to-table is not checked. +** +** The list of all parents for child Table X is held at X.pFKey. +** +** A list of all children for a table named Z (which might not even exist) +** is held in Schema.fkeyHash with a hash key of Z. + */ +type TFKey1 = struct { + FpFrom uintptr + FpNextFrom uintptr + FzTo uintptr + FpNextTo uintptr + FpPrevTo uintptr + FnCol int32 + FisDeferred Tu8 + FaAction [2]Tu8 + FapTrigger [2]uintptr + FaCol [1]TsColMap +} + +type FKey1 = TFKey1 + +/* +** SQLite supports many different ways to resolve a constraint +** error. ROLLBACK processing means that a constraint violation +** causes the operation in process to fail and for the current transaction +** to be rolled back. ABORT processing means the operation in process +** fails and any prior changes from that one operation are backed out, +** but the transaction is not rolled back. FAIL processing means that +** the operation in progress stops and returns an error code. But prior +** changes due to the same operation are not backed out and no rollback +** occurs. IGNORE means that the particular row that caused the constraint +** error is not inserted or updated. Processing continues and no error +** is returned. REPLACE means that preexisting database rows that caused +** a UNIQUE constraint violation are removed so that the new insert or +** update can proceed. Processing continues and no error is reported. +** UPDATE applies to insert operations only and means that the insert +** is omitted and the DO UPDATE clause of an upsert is run instead. +** +** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys. +** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the +** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign +** key is set to NULL. SETDFLT means that the foreign key is set +** to its default value. CASCADE means that a DELETE or UPDATE of the +** referenced table row is propagated into the row that holds the +** foreign key. +** +** The OE_Default value is a place holder that means to use whatever +** conflict resolution algorithm is required from context. +** +** The following symbolic values are used to record which type +** of conflict resolution action to take. + */ + +/* +** An instance of the following structure is passed as the first +** argument to sqlite3VdbeKeyCompare and is used to control the +** comparison of the two index keys. +** +** Note that aSortOrder[] and aColl[] have nField+1 slots. There +** are nField slots for the columns of an index then one extra slot +** for the rowid at the end. + */ +type TKeyInfo1 = struct { + FnRef Tu32 + Fenc Tu8 + FnKeyField Tu16 + FnAllField Tu16 + Fdb uintptr + FaSortFlags uintptr + FaColl [1]uintptr +} + +type KeyInfo1 = TKeyInfo1 + +/* +** Allowed bit values for entries in the KeyInfo.aSortFlags[] array. + */ + +/* +** This object holds a record which has been parsed out into individual +** fields, for the purposes of doing a comparison. +** +** A record is an object that contains one or more fields of data. +** Records are used to store the content of a table row and to store +** the key of an index. A blob encoding of a record is created by +** the OP_MakeRecord opcode of the VDBE and is disassembled by the +** OP_Column opcode. +** +** An instance of this object serves as a "key" for doing a search on +** an index b+tree. The goal of the search is to find the entry that +** is closed to the key described by this object. This object might hold +** just a prefix of the key. The number of fields is given by +** pKeyInfo->nField. +** +** The r1 and r2 fields are the values to return if this key is less than +** or greater than a key in the btree, respectively. These are normally +** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree +** is in DESC order. +** +** The key comparison functions actually return default_rc when they find +** an equals comparison. default_rc can be -1, 0, or +1. If there are +** multiple entries in the b-tree with the same key (when only looking +** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to +** cause the search to find the last match, or +1 to cause the search to +** find the first match. +** +** The key comparison functions will set eqSeen to true if they ever +** get and equal results when comparing this structure to a b-tree record. +** When default_rc!=0, the search might end up on the record immediately +** before the first match or immediately after the last match. The +** eqSeen field will indicate whether or not an exact match exists in the +** b-tree. + */ +type TUnpackedRecord1 = struct { + FpKeyInfo uintptr + FaMem uintptr + Fu struct { + Fi [0]Ti64 + Fz uintptr + } + Fn int32 + FnField Tu16 + Fdefault_rc Ti8 + FerrCode Tu8 + Fr1 Ti8 + Fr2 Ti8 + FeqSeen Tu8 +} + +type UnpackedRecord1 = TUnpackedRecord1 + +/* +** Each SQL index is represented in memory by an +** instance of the following structure. +** +** The columns of the table that are to be indexed are described +** by the aiColumn[] field of this structure. For example, suppose +** we have the following table and index: +** +** CREATE TABLE Ex1(c1 int, c2 int, c3 text); +** CREATE INDEX Ex2 ON Ex1(c3,c1); +** +** In the Table structure describing Ex1, nCol==3 because there are +** three columns in the table. In the Index structure describing +** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed. +** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the +** first column to be indexed (c3) has an index of 2 in Ex1.aCol[]. +** The second column to be indexed (c1) has an index of 0 in +** Ex1.aCol[], hence Ex2.aiColumn[1]==0. +** +** The Index.onError field determines whether or not the indexed columns +** must be unique and what to do if they are not. When Index.onError=OE_None, +** it means this is not a unique index. Otherwise it is a unique index +** and the value of Index.onError indicates which conflict resolution +** algorithm to employ when an attempt is made to insert a non-unique +** element. +** +** The colNotIdxed bitmask is used in combination with SrcItem.colUsed +** for a fast test to see if an index can serve as a covering index. +** colNotIdxed has a 1 bit for every column of the original table that +** is *not* available in the index. Thus the expression +** "colUsed & colNotIdxed" will be non-zero if the index is not a +** covering index. The most significant bit of of colNotIdxed will always +** be true (note-20221022-a). If a column beyond the 63rd column of the +** table is used, the "colUsed & colNotIdxed" test will always be non-zero +** and we have to assume either that the index is not covering, or use +** an alternative (slower) algorithm to determine whether or not +** the index is covering. +** +** While parsing a CREATE TABLE or CREATE INDEX statement in order to +** generate VDBE code (as opposed to parsing one read from an sqlite_schema +** table as part of parsing an existing database schema), transient instances +** of this structure may be created. In this case the Index.tnum variable is +** used to store the address of a VDBE instruction, not a database page +** number (it cannot - the database page is not allocated until the VDBE +** program is executed). See convertToWithoutRowidTable() for details. + */ +type TIndex1 = struct { + FzName uintptr + FaiColumn uintptr + FaiRowLogEst uintptr + FpTable uintptr + FzColAff uintptr + FpNext uintptr + FpSchema uintptr + FaSortOrder uintptr + FazColl uintptr + FpPartIdxWhere uintptr + FaColExpr uintptr + Ftnum TPgno + FszIdxRow TLogEst + FnKeyCol Tu16 + FnColumn Tu16 + FonError Tu8 + F__ccgo100 uint16 + FnSample int32 + FmxSample int32 + FnSampleCol int32 + FaAvgEq uintptr + FaSample uintptr + FaiRowEst uintptr + FnRowEst0 TtRowcnt + FcolNotIdxed TBitmask +} + +type Index1 = TIndex1 + +/* +** Allowed values for Index.idxType + */ + +/* Return true if index X is a PRIMARY KEY index */ + +/* Return true if index X is a UNIQUE index */ + +/* The Index.aiColumn[] values are normally positive integer. But +** there are some negative values that have special meaning: + */ + +/* +** Each sample stored in the sqlite_stat4 table is represented in memory +** using a structure of this type. See documentation at the top of the +** analyze.c source file for additional information. + */ +type TIndexSample1 = struct { + Fp uintptr + Fn int32 + FanEq uintptr + FanLt uintptr + FanDLt uintptr +} + +type IndexSample1 = TIndexSample1 + +/* +** Possible values to use within the flags argument to sqlite3GetToken(). + */ + +/* +** Each token coming out of the lexer is an instance of +** this structure. Tokens are also used as part of an expression. +** +** The memory that "z" points to is owned by other objects. Take care +** that the owner of the "z" string does not deallocate the string before +** the Token goes out of scope! Very often, the "z" points to some place +** in the middle of the Parse.zSql text. But it might also point to a +** static string. + */ +type TToken1 = struct { + Fz uintptr + Fn uint32 +} + +type Token1 = TToken1 + +/* +** An instance of this structure contains information needed to generate +** code for a SELECT that contains aggregate functions. +** +** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a +** pointer to this structure. The Expr.iAgg field is the index in +** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate +** code for that node. +** +** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the +** original Select structure that describes the SELECT statement. These +** fields do not need to be freed when deallocating the AggInfo structure. + */ +type TAggInfo1 = struct { + FdirectMode Tu8 + FuseSortingIdx Tu8 + FnSortingColumn Tu16 + FsortingIdx int32 + FsortingIdxPTab int32 + FiFirstReg int32 + FpGroupBy uintptr + FaCol uintptr + FnColumn int32 + FnAccumulator int32 + FaFunc uintptr + FnFunc int32 + FselId Tu32 +} + +type AggInfo1 = TAggInfo1 + +/* +** Macros to compute aCol[] and aFunc[] register numbers. +** +** These macros should not be used prior to the call to +** assignAggregateRegisters() that computes the value of pAggInfo->iFirstReg. +** The assert()s that are part of this macro verify that constraint. + */ + +// C documentation +// +// /* +// ** The datatype ynVar is a signed integer, either 16-bit or 32-bit. +// ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater +// ** than 32767 we have to make it 32-bit. 16-bit is preferred because +// ** it uses less memory in the Expr object, which is a big memory user +// ** in systems with lots of prepared statements. And few applications +// ** need more than about 10 or 20 variables. But some extreme users want +// ** to have prepared statements with over 32766 variables, and for them +// ** the option is available (at compile-time). +// */ +type TynVar = int16 + +type ynVar = TynVar + +/* +** Each node of an expression in the parse tree is an instance +** of this structure. +** +** Expr.op is the opcode. The integer parser token codes are reused +** as opcodes here. For example, the parser defines TK_GE to be an integer +** code representing the ">=" operator. This same integer code is reused +** to represent the greater-than-or-equal-to operator in the expression +** tree. +** +** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, +** or TK_STRING), then Expr.u.zToken contains the text of the SQL literal. If +** the expression is a variable (TK_VARIABLE), then Expr.u.zToken contains the +** variable name. Finally, if the expression is an SQL function (TK_FUNCTION), +** then Expr.u.zToken contains the name of the function. +** +** Expr.pRight and Expr.pLeft are the left and right subexpressions of a +** binary operator. Either or both may be NULL. +** +** Expr.x.pList is a list of arguments if the expression is an SQL function, +** a CASE expression or an IN expression of the form " IN (, ...)". +** Expr.x.pSelect is used if the expression is a sub-select or an expression of +** the form " IN (SELECT ...)". If the EP_xIsSelect bit is set in the +** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is +** valid. +** +** An expression of the form ID or ID.ID refers to a column in a table. +** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is +** the integer cursor number of a VDBE cursor pointing to that table and +** Expr.iColumn is the column number for the specific column. If the +** expression is used as a result in an aggregate SELECT, then the +** value is also stored in the Expr.iAgg column in the aggregate so that +** it can be accessed after all aggregates are computed. +** +** If the expression is an unbound variable marker (a question mark +** character '?' in the original SQL) then the Expr.iTable holds the index +** number for that variable. +** +** If the expression is a subquery then Expr.iColumn holds an integer +** register number containing the result of the subquery. If the +** subquery gives a constant result, then iTable is -1. If the subquery +** gives a different answer at different times during statement processing +** then iTable is the address of a subroutine that computes the subquery. +** +** If the Expr is of type OP_Column, and the table it is selecting from +** is a disk table or the "old.*" pseudo-table, then pTab points to the +** corresponding table definition. +** +** ALLOCATION NOTES: +** +** Expr objects can use a lot of memory space in database schema. To +** help reduce memory requirements, sometimes an Expr object will be +** truncated. And to reduce the number of memory allocations, sometimes +** two or more Expr objects will be stored in a single memory allocation, +** together with Expr.u.zToken strings. +** +** If the EP_Reduced and EP_TokenOnly flags are set when +** an Expr object is truncated. When EP_Reduced is set, then all +** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees +** are contained within the same memory allocation. Note, however, that +** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately +** allocated, regardless of whether or not EP_Reduced is set. + */ +type TExpr1 = struct { + Fop Tu8 + FaffExpr int8 + Fop2 Tu8 + Fflags Tu32 + Fu struct { + FiValue [0]int32 + FzToken uintptr + } + FpLeft uintptr + FpRight uintptr + Fx struct { + FpSelect [0]uintptr + FpList uintptr + } + FnHeight int32 + FiTable int32 + FiColumn TynVar + FiAgg Ti16 + Fw struct { + FiOfst [0]int32 + FiJoin int32 + } + FpAggInfo uintptr + Fy struct { + FpWin [0]uintptr + Fsub [0]struct { + FiAddr int32 + FregReturn int32 + } + FpTab uintptr + } +} + +type Expr1 = TExpr1 + +/* The following are the meanings of bits in the Expr.flags field. +** Value restrictions: +** +** EP_Agg == NC_HasAgg == SF_HasAgg +** EP_Win == NC_HasWin + */ +/* 0x80000000 // Available */ + +/* The EP_Propagate mask is a set of properties that automatically propagate +** upwards into parent nodes. + */ + +/* Macros can be used to test, set, or clear bits in the +** Expr.flags field. + */ + +/* Macros used to ensure that the correct members of unions are accessed +** in Expr. + */ + +/* Flags for use with Expr.vvaFlags + */ + +/* The ExprSetVVAProperty() macro is used for Verification, Validation, +** and Accreditation only. It works like ExprSetProperty() during VVA +** processes but is a no-op for delivery. + */ + +/* +** Macros to determine the number of bytes required by a normal Expr +** struct, an Expr struct with the EP_Reduced flag set in Expr.flags +** and an Expr struct with the EP_TokenOnly flag set. + */ + +/* +** Flags passed to the sqlite3ExprDup() function. See the header comment +** above sqlite3ExprDup() for details. + */ + +/* +** True if the expression passed as an argument was a function with +** an OVER() clause (a window function). + */ + +/* +** A list of expressions. Each expression may optionally have a +** name. An expr/name combination can be used in several ways, such +** as the list of "expr AS ID" fields following a "SELECT" or in the +** list of "ID = expr" items in an UPDATE. A list of expressions can +** also be used as the argument to a function, in which case the a.zName +** field is not used. +** +** In order to try to keep memory usage down, the Expr.a.zEName field +** is used for multiple purposes: +** +** eEName Usage +** ---------- ------------------------- +** ENAME_NAME (1) the AS of result set column +** (2) COLUMN= of an UPDATE +** +** ENAME_TAB DB.TABLE.NAME used to resolve names +** of subqueries +** +** ENAME_SPAN Text of the original result set +** expression. + */ +type TExprList1 = struct { + FnExpr int32 + FnAlloc int32 + Fa [1]TExprList_item +} + +type ExprList1 = TExprList1 + +/* +** Allowed values for Expr.a.eEName + */ + +/* +** An instance of this structure can hold a simple list of identifiers, +** such as the list "a,b,c" in the following statements: +** +** INSERT INTO t(a,b,c) VALUES ...; +** CREATE INDEX idx ON t(a,b,c); +** CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...; +** +** The IdList.a.idx field is used when the IdList represents the list of +** column names after a table name in an INSERT statement. In the statement +** +** INSERT INTO t(a,b,c) ... +** +** If "a" is the k-th column of table "t", then IdList.a[0].idx==k. + */ +type TIdList1 = struct { + FnId int32 + FeU4 Tu8 + Fa [1]TIdList_item +} + +type IdList1 = TIdList1 + +/* +** Allowed values for IdList.eType, which determines which value of the a.u4 +** is valid. + */ + +/* +** The SrcItem object represents a single term in the FROM clause of a query. +** The SrcList object is mostly an array of SrcItems. +** +** The jointype starts out showing the join type between the current table +** and the next table on the list. The parser builds the list this way. +** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each +** jointype expresses the join between the table and the previous table. +** +** In the colUsed field, the high-order bit (bit 63) is set if the table +** contains more than 63 columns and the 64-th or later column is used. +** +** Union member validity: +** +** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc +** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy +** u2.pIBIndex fg.isIndexedBy && !fg.isCte +** u2.pCteUse fg.isCte && !fg.isIndexedBy + */ +type TSrcItem1 = struct { + FpSchema uintptr + FzDatabase uintptr + FzName uintptr + FzAlias uintptr + FpTab uintptr + FpSelect uintptr + FaddrFillSub int32 + FregReturn int32 + FregResult int32 + Ffg struct { + F__ccgo_align [0]uint32 + Fjointype Tu8 + F__ccgo_align1 [2]byte + F__ccgo4 uint16 + } + FiCursor int32 + Fu3 struct { + FpUsing [0]uintptr + FpOn uintptr + } + FcolUsed TBitmask + Fu1 struct { + FpFuncArg [0]uintptr + FzIndexedBy uintptr + } + Fu2 struct { + FpCteUse [0]uintptr + FpIBIndex uintptr + } +} + +type SrcItem1 = TSrcItem1 + +/* +** The OnOrUsing object represents either an ON clause or a USING clause. +** It can never be both at the same time, but it can be neither. + */ +type TOnOrUsing1 = struct { + FpOn uintptr + FpUsing uintptr +} + +type OnOrUsing1 = TOnOrUsing1 + +/* +** This object represents one or more tables that are the source of +** content for an SQL statement. For example, a single SrcList object +** is used to hold the FROM clause of a SELECT statement. SrcList also +** represents the target tables for DELETE, INSERT, and UPDATE statements. +** + */ +type TSrcList1 = struct { + FnSrc int32 + FnAlloc Tu32 + Fa [1]TSrcItem +} + +type SrcList1 = TSrcList1 + +/* +** Permitted values of the SrcList.a.jointype field + */ + +/* +** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin() +** and the WhereInfo.wctrlFlags member. +** +** Value constraints (enforced via assert()): +** WHERE_USE_LIMIT == SF_FixedLimit + */ +/* 0x2000 not currently used */ +/* 0x8000 not currently used */ + +/* Allowed return values from sqlite3WhereIsDistinct() + */ + +/* +** A NameContext defines a context in which to resolve table and column +** names. The context consists of a list of tables (the pSrcList) field and +** a list of named expression (pEList). The named expression list may +** be NULL. The pSrc corresponds to the FROM clause of a SELECT or +** to the table being operated on by INSERT, UPDATE, or DELETE. The +** pEList corresponds to the result set of a SELECT and is NULL for +** other statements. +** +** NameContexts can be nested. When resolving names, the inner-most +** context is searched first. If no match is found, the next outer +** context is checked. If there is still no match, the next context +** is checked. This process continues until either a match is found +** or all contexts are check. When a match is found, the nRef member of +** the context containing the match is incremented. +** +** Each subquery gets a new NameContext. The pNext field points to the +** NameContext in the parent query. Thus the process of scanning the +** NameContext list corresponds to searching through successively outer +** subqueries looking for a match. + */ +type TNameContext1 = struct { + FpParse uintptr + FpSrcList uintptr + FuNC struct { + FpAggInfo [0]uintptr + FpUpsert [0]uintptr + FiBaseReg [0]int32 + FpEList uintptr + } + FpNext uintptr + FnRef int32 + FnNcErr int32 + FncFlags int32 + FnNestedSelect Tu32 + FpWinSelect uintptr +} + +type NameContext1 = TNameContext1 + +/* +** Allowed values for the NameContext, ncFlags field. +** +** Value constraints (all checked via assert()): +** NC_HasAgg == SF_HasAgg == EP_Agg +** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX +** NC_OrderAgg == SF_OrderByReqd == SQLITE_FUNC_ANYORDER +** NC_HasWin == EP_Win +** + */ + +/* +** An instance of the following object describes a single ON CONFLICT +** clause in an upsert. +** +** The pUpsertTarget field is only set if the ON CONFLICT clause includes +** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the +** conflict-target clause.) The pUpsertTargetWhere is the optional +** WHERE clause used to identify partial unique indexes. +** +** pUpsertSet is the list of column=expr terms of the UPDATE statement. +** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The +** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the +** WHERE clause is omitted. + */ +type TUpsert1 = struct { + FpUpsertTarget uintptr + FpUpsertTargetWhere uintptr + FpUpsertSet uintptr + FpUpsertWhere uintptr + FpNextUpsert uintptr + FisDoUpdate Tu8 + FisDup Tu8 + FpToFree uintptr + FpUpsertIdx uintptr + FpUpsertSrc uintptr + FregData int32 + FiDataCur int32 + FiIdxCur int32 +} + +type Upsert1 = TUpsert1 + +/* +** An instance of the following structure contains all information +** needed to generate code for a single SELECT statement. +** +** See the header comment on the computeLimitRegisters() routine for a +** detailed description of the meaning of the iLimit and iOffset fields. +** +** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes. +** These addresses must be stored so that we can go back and fill in +** the P4_KEYINFO and P2 parameters later. Neither the KeyInfo nor +** the number of columns in P2 can be computed at the same time +** as the OP_OpenEphm instruction is coded because not +** enough information about the compound query is known at that point. +** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences +** for the result set. The KeyInfo for addrOpenEphm[2] contains collating +** sequences for the ORDER BY clause. + */ +type TSelect1 = struct { + Fop Tu8 + FnSelectRow TLogEst + FselFlags Tu32 + FiLimit int32 + FiOffset int32 + FselId Tu32 + FaddrOpenEphm [2]int32 + FpEList uintptr + FpSrc uintptr + FpWhere uintptr + FpGroupBy uintptr + FpHaving uintptr + FpOrderBy uintptr + FpPrior uintptr + FpNext uintptr + FpLimit uintptr + FpWith uintptr + FpWin uintptr + FpWinDefn uintptr +} + +type Select1 = TSelect1 + +/* +** Allowed values for Select.selFlags. The "SF" prefix stands for +** "Select Flag". +** +** Value constraints (all checked via assert()) +** SF_HasAgg == NC_HasAgg +** SF_MinMaxAgg == NC_MinMaxAgg == SQLITE_FUNC_MINMAX +** SF_OrderByReqd == NC_OrderAgg == SQLITE_FUNC_ANYORDER +** SF_FixedLimit == WHERE_USE_LIMIT + */ + +/* True if S exists and has SF_NestedFrom */ + +/* +** The results of a SELECT can be distributed in several ways, as defined +** by one of the following macros. The "SRT" prefix means "SELECT Result +** Type". +** +** SRT_Union Store results as a key in a temporary index +** identified by pDest->iSDParm. +** +** SRT_Except Remove results from the temporary index pDest->iSDParm. +** +** SRT_Exists Store a 1 in memory cell pDest->iSDParm if the result +** set is not empty. +** +** SRT_Discard Throw the results away. This is used by SELECT +** statements within triggers whose only purpose is +** the side-effects of functions. +** +** SRT_Output Generate a row of output (using the OP_ResultRow +** opcode) for each row in the result set. +** +** SRT_Mem Only valid if the result is a single column. +** Store the first column of the first result row +** in register pDest->iSDParm then abandon the rest +** of the query. This destination implies "LIMIT 1". +** +** SRT_Set The result must be a single column. Store each +** row of result as the key in table pDest->iSDParm. +** Apply the affinity pDest->affSdst before storing +** results. Used to implement "IN (SELECT ...)". +** +** SRT_EphemTab Create an temporary table pDest->iSDParm and store +** the result there. The cursor is left open after +** returning. This is like SRT_Table except that +** this destination uses OP_OpenEphemeral to create +** the table first. +** +** SRT_Coroutine Generate a co-routine that returns a new row of +** results each time it is invoked. The entry point +** of the co-routine is stored in register pDest->iSDParm +** and the result row is stored in pDest->nDest registers +** starting with pDest->iSdst. +** +** SRT_Table Store results in temporary table pDest->iSDParm. +** SRT_Fifo This is like SRT_EphemTab except that the table +** is assumed to already be open. SRT_Fifo has +** the additional property of being able to ignore +** the ORDER BY clause. +** +** SRT_DistFifo Store results in a temporary table pDest->iSDParm. +** But also use temporary table pDest->iSDParm+1 as +** a record of all prior results and ignore any duplicate +** rows. Name means: "Distinct Fifo". +** +** SRT_Queue Store results in priority queue pDest->iSDParm (really +** an index). Append a sequence number so that all entries +** are distinct. +** +** SRT_DistQueue Store results in priority queue pDest->iSDParm only if +** the same record has never been stored before. The +** index at pDest->iSDParm+1 hold all prior stores. +** +** SRT_Upfrom Store results in the temporary table already opened by +** pDest->iSDParm. If (pDest->iSDParm<0), then the temp +** table is an intkey table - in this case the first +** column returned by the SELECT is used as the integer +** key. If (pDest->iSDParm>0), then the table is an index +** table. (pDest->iSDParm) is the number of key columns in +** each index record in this case. + */ + +/* The DISTINCT clause is ignored for all of the above. Not that +** IgnorableDistinct() implies IgnorableOrderby() */ + +/* The ORDER BY clause is ignored for all of the above */ + +/* +** An instance of this object describes where to put of the results of +** a SELECT statement. + */ +type TSelectDest1 = struct { + FeDest Tu8 + FiSDParm int32 + FiSDParm2 int32 + FiSdst int32 + FnSdst int32 + FzAffSdst uintptr + FpOrderBy uintptr +} + +type SelectDest1 = TSelectDest1 + +/* +** During code generation of statements that do inserts into AUTOINCREMENT +** tables, the following information is attached to the Table.u.autoInc.p +** pointer of each autoincrement table to record some side information that +** the code generator needs. We have to keep per-table autoincrement +** information in case inserts are done within triggers. Triggers do not +** normally coordinate their activities, but we do need to coordinate the +** loading and saving of autoincrement information. + */ +type TAutoincInfo1 = struct { + FpNext uintptr + FpTab uintptr + FiDb int32 + FregCtr int32 +} + +type AutoincInfo1 = TAutoincInfo1 + +/* +** At least one instance of the following structure is created for each +** trigger that may be fired while parsing an INSERT, UPDATE or DELETE +** statement. All such objects are stored in the linked list headed at +** Parse.pTriggerPrg and deleted once statement compilation has been +** completed. +** +** A Vdbe sub-program that implements the body and WHEN clause of trigger +** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of +** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable. +** The Parse.pTriggerPrg list never contains two entries with the same +** values for both pTrigger and orconf. +** +** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns +** accessed (or set to 0 for triggers fired as a result of INSERT +** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to +** a mask of new.* columns used by the program. + */ +type TTriggerPrg1 = struct { + FpTrigger uintptr + FpNext uintptr + FpProgram uintptr + Forconf int32 + FaColmask [2]Tu32 +} + +type TriggerPrg1 = TTriggerPrg1 + +// C documentation +// +// /* +// ** The yDbMask datatype for the bitmask of all attached databases. +// */ +type TyDbMask = uint32 + +type yDbMask = TyDbMask + +/* +** For each index X that has as one of its arguments either an expression +** or the name of a virtual generated column, and if X is in scope such that +** the value of the expression can simply be read from the index, then +** there is an instance of this object on the Parse.pIdxExpr list. +** +** During code generation, while generating code to evaluate expressions, +** this list is consulted and if a matching expression is found, the value +** is read from the index rather than being recomputed. + */ +type TIndexedExpr1 = struct { + FpExpr uintptr + FiDataCur int32 + FiIdxCur int32 + FiIdxCol int32 + FbMaybeNullRow Tu8 + Faff Tu8 + FpIENext uintptr +} + +type IndexedExpr1 = TIndexedExpr1 + +/* +** An instance of the ParseCleanup object specifies an operation that +** should be performed after parsing to deallocation resources obtained +** during the parse and which are no longer needed. + */ +type TParseCleanup1 = struct { + FpNext uintptr + FpPtr uintptr + FxCleanup uintptr +} + +type ParseCleanup1 = TParseCleanup1 + +/* +** An SQL parser context. A copy of this structure is passed through +** the parser and down into all the parser action routine in order to +** carry around information that is global to the entire parse. +** +** The structure is divided into two parts. When the parser and code +** generate call themselves recursively, the first part of the structure +** is constant but the second part is reset at the beginning and end of +** each recursion. +** +** The nTableLock and aTableLock variables are only used if the shared-cache +** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are +** used to store the set of table-locks required by the statement being +** compiled. Function sqlite3TableLock() is used to add entries to the +** list. + */ +type TParse1 = struct { + Fdb uintptr + FzErrMsg uintptr + FpVdbe uintptr + Frc int32 + FcolNamesSet Tu8 + FcheckSchema Tu8 + Fnested Tu8 + FnTempReg Tu8 + FisMultiWrite Tu8 + FmayAbort Tu8 + FhasCompound Tu8 + FokConstFactor Tu8 + FdisableLookaside Tu8 + FprepFlags Tu8 + FwithinRJSubrtn Tu8 + FnRangeReg int32 + FiRangeReg int32 + FnErr int32 + FnTab int32 + FnMem int32 + FszOpAlloc int32 + FiSelfTab int32 + FnLabel int32 + FnLabelAlloc int32 + FaLabel uintptr + FpConstExpr uintptr + FpIdxEpr uintptr + FpIdxPartExpr uintptr + FconstraintName TToken + FwriteMask TyDbMask + FcookieMask TyDbMask + FregRowid int32 + FregRoot int32 + FnMaxArg int32 + FnSelect int32 + FnProgressSteps Tu32 + FnTableLock int32 + FaTableLock uintptr + FpAinc uintptr + FpToplevel uintptr + FpTriggerTab uintptr + FpTriggerPrg uintptr + FpCleanup uintptr + Fu1 struct { + FpReturning [0]uintptr + FaddrCrTab int32 + F__ccgo_pad2 [4]byte + } + Foldmask Tu32 + Fnewmask Tu32 + FnQueryLoop TLogEst + FeTriggerOp Tu8 + FbReturning Tu8 + FeOrconf Tu8 + FdisableTriggers Tu8 + FaTempReg [8]int32 + FpOuterParse uintptr + FsNameToken TToken + FsLastToken TToken + FnVar TynVar + FiPkSortOrder Tu8 + Fexplain Tu8 + FeParseMode Tu8 + FnVtabLock int32 + FnHeight int32 + FaddrExplain int32 + FpVList uintptr + FpReprepare uintptr + FzTail uintptr + FpNewTable uintptr + FpNewIndex uintptr + FpNewTrigger uintptr + FzAuthContext uintptr + FsArg TToken + FapVtabLock uintptr + FpWith uintptr + FpRename uintptr +} + +type Parse1 = TParse1 + +/* Allowed values for Parse.eParseMode + */ + +/* +** Sizes and pointers of various parts of the Parse object. + */ + +/* +** Return true if currently inside an sqlite3_declare_vtab() call. + */ + +/* +** An instance of the following structure can be declared on a stack and used +** to save the Parse.zAuthContext value so that it can be restored later. + */ +type TAuthContext1 = struct { + FzAuthContext uintptr + FpParse uintptr +} + +type AuthContext1 = TAuthContext1 + +/* +** Bitfield flags for P5 value in various opcodes. +** +** Value constraints (enforced via assert()): +** OPFLAG_LENGTHARG == SQLITE_FUNC_LENGTH +** OPFLAG_TYPEOFARG == SQLITE_FUNC_TYPEOF +** OPFLAG_BULKCSR == BTREE_BULKLOAD +** OPFLAG_SEEKEQ == BTREE_SEEK_EQ +** OPFLAG_FORDELETE == BTREE_FORDELETE +** OPFLAG_SAVEPOSITION == BTREE_SAVEPOSITION +** OPFLAG_AUXDELETE == BTREE_AUXDELETE + */ +/* Also used in P2 (not P5) of OP_Delete */ + +/* +** Each trigger present in the database schema is stored as an instance of +** struct Trigger. +** +** Pointers to instances of struct Trigger are stored in two ways. +** 1. In the "trigHash" hash table (part of the sqlite3* that represents the +** database). This allows Trigger structures to be retrieved by name. +** 2. All triggers associated with a single table form a linked list, using the +** pNext member of struct Trigger. A pointer to the first element of the +** linked list is stored as the "pTrigger" member of the associated +** struct Table. +** +** The "step_list" member points to the first element of a linked list +** containing the SQL statements specified as the trigger program. + */ +type TTrigger1 = struct { + FzName uintptr + Ftable uintptr + Fop Tu8 + Ftr_tm Tu8 + FbReturning Tu8 + FpWhen uintptr + FpColumns uintptr + FpSchema uintptr + FpTabSchema uintptr + Fstep_list uintptr + FpNext uintptr +} + +type Trigger1 = TTrigger1 + +/* +** A trigger is either a BEFORE or an AFTER trigger. The following constants +** determine which. +** +** If there are multiple triggers, you might of some BEFORE and some AFTER. +** In that cases, the constants below can be ORed together. + */ + +/* +** An instance of struct TriggerStep is used to store a single SQL statement +** that is a part of a trigger-program. +** +** Instances of struct TriggerStep are stored in a singly linked list (linked +** using the "pNext" member) referenced by the "step_list" member of the +** associated struct Trigger instance. The first element of the linked list is +** the first step of the trigger-program. +** +** The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or +** "SELECT" statement. The meanings of the other members is determined by the +** value of "op" as follows: +** +** (op == TK_INSERT) +** orconf -> stores the ON CONFLICT algorithm +** pSelect -> The content to be inserted - either a SELECT statement or +** a VALUES clause. +** zTarget -> Dequoted name of the table to insert into. +** pIdList -> If this is an INSERT INTO ... () VALUES ... +** statement, then this stores the column-names to be +** inserted into. +** pUpsert -> The ON CONFLICT clauses for an Upsert +** +** (op == TK_DELETE) +** zTarget -> Dequoted name of the table to delete from. +** pWhere -> The WHERE clause of the DELETE statement if one is specified. +** Otherwise NULL. +** +** (op == TK_UPDATE) +** zTarget -> Dequoted name of the table to update. +** pWhere -> The WHERE clause of the UPDATE statement if one is specified. +** Otherwise NULL. +** pExprList -> A list of the columns to update and the expressions to update +** them to. See sqlite3Update() documentation of "pChanges" +** argument. +** +** (op == TK_SELECT) +** pSelect -> The SELECT statement +** +** (op == TK_RETURNING) +** pExprList -> The list of expressions that follow the RETURNING keyword. +** + */ +type TTriggerStep1 = struct { + Fop Tu8 + Forconf Tu8 + FpTrig uintptr + FpSelect uintptr + FzTarget uintptr + FpFrom uintptr + FpWhere uintptr + FpExprList uintptr + FpIdList uintptr + FpUpsert uintptr + FzSpan uintptr + FpNext uintptr + FpLast uintptr +} + +type TriggerStep1 = TTriggerStep1 + +/* +** Information about a RETURNING clause + */ +type TReturning1 = struct { + FpParse uintptr + FpReturnEL uintptr + FretTrig TTrigger + FretTStep TTriggerStep + FiRetCur int32 + FnRetCol int32 + FiRetReg int32 + FzName [40]int8 +} + +type Returning1 = TReturning1 + +/* +** The following object is the header for an "RCStr" or "reference-counted +** string". An RCStr is passed around and used like any other char* +** that has been dynamically allocated. The important interface +** differences: +** +** 1. RCStr strings are reference counted. They are deallocated +** when the reference count reaches zero. +** +** 2. Use sqlite3RCStrUnref() to free an RCStr string rather than +** sqlite3_free() +** +** 3. Make a (read-only) copy of a read-only RCStr string using +** sqlite3RCStrRef(). +** +** "String" is in the name, but an RCStr object can also be used to hold +** binary data. + */ +type TRCStr1 = struct { + FnRCRef Tu64 +} + +type RCStr1 = TRCStr1 + +// C documentation +// +// /* +// ** A pointer to this structure is used to communicate information +// ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. +// */ +type TInitData = struct { + Fdb uintptr + FpzErrMsg uintptr + FiDb int32 + Frc int32 + FmInitFlags Tu32 + FnInitRow Tu32 + FmxPage TPgno +} + +type InitData = TInitData + +/* +** Allowed values for mInitFlags + */ + +/* Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled +** on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning +** parameters are for temporary use during development, to help find +** optimal values for parameters in the query planner. The should not +** be used on trunk check-ins. They are a temporary mechanism available +** for transient development builds only. +** +** Tuning parameters are numbered starting with 1. + */ + +/* +** Structure containing global configuration data for the SQLite library. +** +** This structure also contains some state information. + */ +type TSqlite3Config = struct { + FbMemstat int32 + FbCoreMutex Tu8 + FbFullMutex Tu8 + FbOpenUri Tu8 + FbUseCis Tu8 + FbSmallMalloc Tu8 + FbExtraSchemaChecks Tu8 + FbUseLongDouble Tu8 + FmxStrlen int32 + FneverCorrupt int32 + FszLookaside int32 + FnLookaside int32 + FnStmtSpill int32 + Fm Tsqlite3_mem_methods + Fmutex Tsqlite3_mutex_methods + Fpcache2 Tsqlite3_pcache_methods2 + FpHeap uintptr + FnHeap int32 + FmnReq int32 + FmxReq int32 + FszMmap Tsqlite3_int64 + FmxMmap Tsqlite3_int64 + FpPage uintptr + FszPage int32 + FnPage int32 + FmxParserStack int32 + FsharedCacheEnabled int32 + FszPma Tu32 + FisInit int32 + FinProgress int32 + FisMutexInit int32 + FisMallocInit int32 + FisPCacheInit int32 + FnRefInitMutex int32 + FpInitMutex uintptr + FxLog uintptr + FpLogArg uintptr + FmxMemdbSize Tsqlite3_int64 + FxTestCallback uintptr + FbLocaltimeFault int32 + FxAltLocaltime uintptr + FiOnceResetThreshold int32 + FszSorterRef Tu32 + FiPrngSeed uint32 +} + +type Sqlite3Config = TSqlite3Config + +/* +** This macro is used inside of assert() statements to indicate that +** the assert is only valid on a well-formed database. Instead of: +** +** assert( X ); +** +** One writes: +** +** assert( X || CORRUPT_DB ); +** +** CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +** that the database is definitely corrupt, only that it might be corrupt. +** For most test cases, CORRUPT_DB is set to false using a special +** sqlite3_test_control(). This enables assert() statements to prove +** things that are always true for well-formed databases. + */ + +/* +** Context pointer passed down through the tree-walk. + */ +type TWalker1 = struct { + FpParse uintptr + FxExprCallback uintptr + FxSelectCallback uintptr + FxSelectCallback2 uintptr + FwalkerDepth int32 + FeCode Tu16 + FmWFlags Tu16 + Fu struct { + Fn [0]int32 + FiCur [0]int32 + FpSrcList [0]uintptr + FpCCurHint [0]uintptr + FpRefSrcList [0]uintptr + FaiCol [0]uintptr + FpIdxCover [0]uintptr + FpGroupBy [0]uintptr + FpSelect [0]uintptr + FpRewrite [0]uintptr + FpConst [0]uintptr + FpRename [0]uintptr + FpTab [0]uintptr + FpCovIdxCk [0]uintptr + FpSrcItem [0]uintptr + FpFix [0]uintptr + FaMem [0]uintptr + FpNC uintptr + } +} + +type Walker1 = TWalker1 + +/* +** The following structure contains information used by the sqliteFix... +** routines as they walk the parse tree to make database references +** explicit. + */ +type TDbFixer1 = struct { + FpParse uintptr + Fw TWalker + FpSchema uintptr + FbTemp Tu8 + FzDb uintptr + FzType uintptr + FpName uintptr +} + +type DbFixer1 = TDbFixer1 + +/* +** Return code from the parse-tree walking primitives and their +** callbacks. + */ + +/* +** A single common table expression + */ +type TCte1 = struct { + FzName uintptr + FpCols uintptr + FpSelect uintptr + FzCteErr uintptr + FpUse uintptr + FeM10d Tu8 +} + +type Cte1 = TCte1 + +/* +** Allowed values for the materialized flag (eM10d): + */ + +/* +** An instance of the With object represents a WITH clause containing +** one or more CTEs (common table expressions). + */ +type TWith1 = struct { + FnCte int32 + FbView int32 + FpOuter uintptr + Fa [1]TCte +} + +type With1 = TWith1 + +/* +** The Cte object is not guaranteed to persist for the entire duration +** of code generation. (The query flattener or other parser tree +** edits might delete it.) The following object records information +** about each Common Table Expression that must be preserved for the +** duration of the parse. +** +** The CteUse objects are freed using sqlite3ParserAddCleanup() rather +** than sqlite3SelectDelete(), which is what enables them to persist +** until the end of code generation. + */ +type TCteUse1 = struct { + FnUse int32 + FaddrM9e int32 + FregRtn int32 + FiCur int32 + FnRowEst TLogEst + FeM10d Tu8 +} + +type CteUse1 = TCteUse1 + +/* Client data associated with sqlite3_set_clientdata() and +** sqlite3_get_clientdata(). + */ +type TDbClientData1 = struct { + FpNext uintptr + FpData uintptr + FxDestructor uintptr + FzName [1]int8 +} + +type DbClientData1 = TDbClientData1 + +/* +** This object is used in various ways, most (but not all) related to window +** functions. +** +** (1) A single instance of this structure is attached to the +** the Expr.y.pWin field for each window function in an expression tree. +** This object holds the information contained in the OVER clause, +** plus additional fields used during code generation. +** +** (2) All window functions in a single SELECT form a linked-list +** attached to Select.pWin. The Window.pFunc and Window.pExpr +** fields point back to the expression that is the window function. +** +** (3) The terms of the WINDOW clause of a SELECT are instances of this +** object on a linked list attached to Select.pWinDefn. +** +** (4) For an aggregate function with a FILTER clause, an instance +** of this object is stored in Expr.y.pWin with eFrmType set to +** TK_FILTER. In this case the only field used is Window.pFilter. +** +** The uses (1) and (2) are really the same Window object that just happens +** to be accessible in two different ways. Use case (3) are separate objects. + */ +type TWindow1 = struct { + FzName uintptr + FzBase uintptr + FpPartition uintptr + FpOrderBy uintptr + FeFrmType Tu8 + FeStart Tu8 + FeEnd Tu8 + FbImplicitFrame Tu8 + FeExclude Tu8 + FpStart uintptr + FpEnd uintptr + FppThis uintptr + FpNextWin uintptr + FpFilter uintptr + FpWFunc uintptr + FiEphCsr int32 + FregAccum int32 + FregResult int32 + FcsrApp int32 + FregApp int32 + FregPart int32 + FpOwner uintptr + FnBufferCol int32 + FiArgCol int32 + FregOne int32 + FregStartRowid int32 + FregEndRowid int32 + FbExprArgs Tu8 +} + +type Window1 = TWindow1 + +/* +** An instance of the following structure holds information about SQL +** functions arguments that are the parameters to the printf() function. + */ +type TPrintfArguments1 = struct { + FnArg int32 + FnUsed int32 + FapArg uintptr +} + +type PrintfArguments1 = TPrintfArguments1 + +/* +** An instance of this object receives the decoding of a floating point +** value into an approximate decimal representation. + */ +type TFpDecode1 = struct { + Fsign int8 + FisSpecial int8 + Fn int32 + FiDP int32 + Fz uintptr + FzBuf [24]int8 +} + +type FpDecode1 = TFpDecode1 + +/************** End of sqliteInt.h *******************************************/ +/************** Begin file os_common.h ***************************************/ +/* +** 2004 May 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains macros and a little bit of code that is common to +** all of the platform-specific files (os_*.c) and is #included into those +** files. +** +** This file should be #included by the os_*.c files only. It is not a +** general purpose header file. + */ + +/* +** At least two bugs have slipped in because we changed the MEMORY_DEBUG +** macro to SQLITE_DEBUG and some older makefiles have not yet made the +** switch. The following code should catch this problem at compile-time. + */ + +/* +** Macros for performance tracing. Normally turned off. Only works +** on i486 hardware. + */ + +/* +** If we compile with the SQLITE_TEST macro set, then the following block +** of code will give us the ability to simulate a disk I/O error. This +** is used for testing the I/O recovery logic. + */ + +/* +** When testing, keep a count of the number of open files. + */ + +/************** End of os_common.h *******************************************/ +/************** Begin file ctime.c *******************************************/ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkctimec.tcl. +** +** To modify this header, edit any of the various lists in that script +** which specify categories of generated conditionals in this file. + */ + +/* +** 2010 February 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file implements routines used to report what compile-time options +** SQLite was built with. + */ + +/* +** Include the configuration header output by 'configure' if we're using the +** autoconf-based build + */ + +/* These macros are provided to "stringify" the value of the define +** for those options in which the value is meaningful. */ + +/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This +** option requires a separate macro because legal values contain a single +** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** An array of names of all compile-time options. This array should +// ** be sorted A-Z. +// ** +// ** This array looks large, but in a typical installation actually uses +// ** only a handful of compile-time options, so most times this array is usually +// ** rather short and uses little memory space. +// */ +var _sqlite3azCompileOpt = [54]uintptr{ + 0: __ccgo_ts, + 1: __ccgo_ts + 20, + 2: __ccgo_ts + 68, + 3: __ccgo_ts + 87, + 4: __ccgo_ts + 112, + 5: __ccgo_ts + 134, + 6: __ccgo_ts + 164, + 7: __ccgo_ts + 184, + 8: __ccgo_ts + 204, + 9: __ccgo_ts + 227, + 10: __ccgo_ts + 252, + 11: __ccgo_ts + 279, + 12: __ccgo_ts + 304, + 13: __ccgo_ts + 326, + 14: __ccgo_ts + 358, + 15: __ccgo_ts + 384, + 16: __ccgo_ts + 409, + 17: __ccgo_ts + 430, + 18: __ccgo_ts + 453, + 19: __ccgo_ts + 472, + 20: __ccgo_ts + 484, + 21: __ccgo_ts + 499, + 22: __ccgo_ts + 521, + 23: __ccgo_ts + 546, + 24: __ccgo_ts + 569, + 25: __ccgo_ts + 591, + 26: __ccgo_ts + 602, + 27: __ccgo_ts + 615, + 28: __ccgo_ts + 630, + 29: __ccgo_ts + 646, + 30: __ccgo_ts + 659, + 31: __ccgo_ts + 680, + 32: __ccgo_ts + 704, + 33: __ccgo_ts + 727, + 34: __ccgo_ts + 743, + 35: __ccgo_ts + 759, + 36: __ccgo_ts + 783, + 37: __ccgo_ts + 810, + 38: __ccgo_ts + 830, + 39: __ccgo_ts + 851, + 40: __ccgo_ts + 873, + 41: __ccgo_ts + 903, + 42: __ccgo_ts + 928, + 43: __ccgo_ts + 954, + 44: __ccgo_ts + 974, + 45: __ccgo_ts + 1000, + 46: __ccgo_ts + 1023, + 47: __ccgo_ts + 1049, + 48: __ccgo_ts + 1071, + 49: __ccgo_ts + 1092, + 50: __ccgo_ts + 1107, + 51: __ccgo_ts + 1115, + 52: __ccgo_ts + 1129, + 53: __ccgo_ts + 1142, +} + +func _sqlite3CompileOptions(tls *libc.TLS, pnOpt uintptr) (r uintptr) { + *(*int32)(unsafe.Pointer(pnOpt)) = int32(libc.Uint64FromInt64(432) / libc.Uint64FromInt64(8)) + return uintptr(unsafe.Pointer(&_sqlite3azCompileOpt)) +} + +/************** End of ctime.c ***********************************************/ +/************** Begin file global.c ******************************************/ +/* +** 2008 June 13 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains definitions of global variables and constants. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* An array to map all upper-case characters into their corresponding +// ** lower-case character. +// ** +// ** SQLite only considers US-ASCII (or EBCDIC) characters. We do not +// ** handle case conversions for the UTF character set since the tables +// ** involved are nearly as big or bigger than SQLite itself. +// */ +var _sqlite3UpperToLower = [274]uint8{ + 1: uint8(1), + 2: uint8(2), + 3: uint8(3), + 4: uint8(4), + 5: uint8(5), + 6: uint8(6), + 7: uint8(7), + 8: uint8(8), + 9: uint8(9), + 10: uint8(10), + 11: uint8(11), + 12: uint8(12), + 13: uint8(13), + 14: uint8(14), + 15: uint8(15), + 16: uint8(16), + 17: uint8(17), + 18: uint8(18), + 19: uint8(19), + 20: uint8(20), + 21: uint8(21), + 22: uint8(22), + 23: uint8(23), + 24: uint8(24), + 25: uint8(25), + 26: uint8(26), + 27: uint8(27), + 28: uint8(28), + 29: uint8(29), + 30: uint8(30), + 31: uint8(31), + 32: uint8(32), + 33: uint8(33), + 34: uint8(34), + 35: uint8(35), + 36: uint8(36), + 37: uint8(37), + 38: uint8(38), + 39: uint8(39), + 40: uint8(40), + 41: uint8(41), + 42: uint8(42), + 43: uint8(43), + 44: uint8(44), + 45: uint8(45), + 46: uint8(46), + 47: uint8(47), + 48: uint8(48), + 49: uint8(49), + 50: uint8(50), + 51: uint8(51), + 52: uint8(52), + 53: uint8(53), + 54: uint8(54), + 55: uint8(55), + 56: uint8(56), + 57: uint8(57), + 58: uint8(58), + 59: uint8(59), + 60: uint8(60), + 61: uint8(61), + 62: uint8(62), + 63: uint8(63), + 64: uint8(64), + 65: uint8(97), + 66: uint8(98), + 67: uint8(99), + 68: uint8(100), + 69: uint8(101), + 70: uint8(102), + 71: uint8(103), + 72: uint8(104), + 73: uint8(105), + 74: uint8(106), + 75: uint8(107), + 76: uint8(108), + 77: uint8(109), + 78: uint8(110), + 79: uint8(111), + 80: uint8(112), + 81: uint8(113), + 82: uint8(114), + 83: uint8(115), + 84: uint8(116), + 85: uint8(117), + 86: uint8(118), + 87: uint8(119), + 88: uint8(120), + 89: uint8(121), + 90: uint8(122), + 91: uint8(91), + 92: uint8(92), + 93: uint8(93), + 94: uint8(94), + 95: uint8(95), + 96: uint8(96), + 97: uint8(97), + 98: uint8(98), + 99: uint8(99), + 100: uint8(100), + 101: uint8(101), + 102: uint8(102), + 103: uint8(103), + 104: uint8(104), + 105: uint8(105), + 106: uint8(106), + 107: uint8(107), + 108: uint8(108), + 109: uint8(109), + 110: uint8(110), + 111: uint8(111), + 112: uint8(112), + 113: uint8(113), + 114: uint8(114), + 115: uint8(115), + 116: uint8(116), + 117: uint8(117), + 118: uint8(118), + 119: uint8(119), + 120: uint8(120), + 121: uint8(121), + 122: uint8(122), + 123: uint8(123), + 124: uint8(124), + 125: uint8(125), + 126: uint8(126), + 127: uint8(127), + 128: uint8(128), + 129: uint8(129), + 130: uint8(130), + 131: uint8(131), + 132: uint8(132), + 133: uint8(133), + 134: uint8(134), + 135: uint8(135), + 136: uint8(136), + 137: uint8(137), + 138: uint8(138), + 139: uint8(139), + 140: uint8(140), + 141: uint8(141), + 142: uint8(142), + 143: uint8(143), + 144: uint8(144), + 145: uint8(145), + 146: uint8(146), + 147: uint8(147), + 148: uint8(148), + 149: uint8(149), + 150: uint8(150), + 151: uint8(151), + 152: uint8(152), + 153: uint8(153), + 154: uint8(154), + 155: uint8(155), + 156: uint8(156), + 157: uint8(157), + 158: uint8(158), + 159: uint8(159), + 160: uint8(160), + 161: uint8(161), + 162: uint8(162), + 163: uint8(163), + 164: uint8(164), + 165: uint8(165), + 166: uint8(166), + 167: uint8(167), + 168: uint8(168), + 169: uint8(169), + 170: uint8(170), + 171: uint8(171), + 172: uint8(172), + 173: uint8(173), + 174: uint8(174), + 175: uint8(175), + 176: uint8(176), + 177: uint8(177), + 178: uint8(178), + 179: uint8(179), + 180: uint8(180), + 181: uint8(181), + 182: uint8(182), + 183: uint8(183), + 184: uint8(184), + 185: uint8(185), + 186: uint8(186), + 187: uint8(187), + 188: uint8(188), + 189: uint8(189), + 190: uint8(190), + 191: uint8(191), + 192: uint8(192), + 193: uint8(193), + 194: uint8(194), + 195: uint8(195), + 196: uint8(196), + 197: uint8(197), + 198: uint8(198), + 199: uint8(199), + 200: uint8(200), + 201: uint8(201), + 202: uint8(202), + 203: uint8(203), + 204: uint8(204), + 205: uint8(205), + 206: uint8(206), + 207: uint8(207), + 208: uint8(208), + 209: uint8(209), + 210: uint8(210), + 211: uint8(211), + 212: uint8(212), + 213: uint8(213), + 214: uint8(214), + 215: uint8(215), + 216: uint8(216), + 217: uint8(217), + 218: uint8(218), + 219: uint8(219), + 220: uint8(220), + 221: uint8(221), + 222: uint8(222), + 223: uint8(223), + 224: uint8(224), + 225: uint8(225), + 226: uint8(226), + 227: uint8(227), + 228: uint8(228), + 229: uint8(229), + 230: uint8(230), + 231: uint8(231), + 232: uint8(232), + 233: uint8(233), + 234: uint8(234), + 235: uint8(235), + 236: uint8(236), + 237: uint8(237), + 238: uint8(238), + 239: uint8(239), + 240: uint8(240), + 241: uint8(241), + 242: uint8(242), + 243: uint8(243), + 244: uint8(244), + 245: uint8(245), + 246: uint8(246), + 247: uint8(247), + 248: uint8(248), + 249: uint8(249), + 250: uint8(250), + 251: uint8(251), + 252: uint8(252), + 253: uint8(253), + 254: uint8(254), + 255: uint8(255), + 256: uint8(1), + 259: uint8(1), + 260: uint8(1), + 263: uint8(1), + 265: uint8(1), + 267: uint8(1), + 268: uint8(1), + 270: uint8(1), + 273: uint8(1), +} + +var _sqlite3aLTb = uintptr(unsafe.Pointer(&_sqlite3UpperToLower)) + uintptr(libc.Int32FromInt32(256)-libc.Int32FromInt32(OP_Ne)) + +var _sqlite3aEQb = uintptr(unsafe.Pointer(&_sqlite3UpperToLower)) + uintptr(libc.Int32FromInt32(256)+libc.Int32FromInt32(6)-libc.Int32FromInt32(OP_Ne)) + +var _sqlite3aGTb = uintptr(unsafe.Pointer(&_sqlite3UpperToLower)) + uintptr(libc.Int32FromInt32(256)+libc.Int32FromInt32(12)-libc.Int32FromInt32(OP_Ne)) + +// C documentation +// +// /* +// ** The following 256 byte lookup table is used to support SQLites built-in +// ** equivalents to the following standard library functions: +// ** +// ** isspace() 0x01 +// ** isalpha() 0x02 +// ** isdigit() 0x04 +// ** isalnum() 0x06 +// ** isxdigit() 0x08 +// ** toupper() 0x20 +// ** SQLite identifier character 0x40 $, _, or non-ascii +// ** Quote character 0x80 +// ** +// ** Bit 0x20 is set if the mapped character requires translation to upper +// ** case. i.e. if the character is a lower-case ASCII character. +// ** If x is a lower-case ASCII character, then its upper-case equivalent +// ** is (x - 0x20). Therefore toupper() can be implemented as: +// ** +// ** (x & ~(map[x]&0x20)) +// ** +// ** The equivalent of tolower() is implemented using the sqlite3UpperToLower[] +// ** array. tolower() is used more often than toupper() by SQLite. +// ** +// ** Bit 0x40 is set if the character is non-alphanumeric and can be used in an +// ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any +// ** non-ASCII UTF character. Hence the test for whether or not a character is +// ** part of an identifier is 0x46. +// */ +var _sqlite3CtypeMap = [256]uint8{ + 9: uint8(0x01), + 10: uint8(0x01), + 11: uint8(0x01), + 12: uint8(0x01), + 13: uint8(0x01), + 32: uint8(0x01), + 34: uint8(0x80), + 36: uint8(0x40), + 39: uint8(0x80), + 48: uint8(0x0c), + 49: uint8(0x0c), + 50: uint8(0x0c), + 51: uint8(0x0c), + 52: uint8(0x0c), + 53: uint8(0x0c), + 54: uint8(0x0c), + 55: uint8(0x0c), + 56: uint8(0x0c), + 57: uint8(0x0c), + 65: uint8(0x0a), + 66: uint8(0x0a), + 67: uint8(0x0a), + 68: uint8(0x0a), + 69: uint8(0x0a), + 70: uint8(0x0a), + 71: uint8(0x02), + 72: uint8(0x02), + 73: uint8(0x02), + 74: uint8(0x02), + 75: uint8(0x02), + 76: uint8(0x02), + 77: uint8(0x02), + 78: uint8(0x02), + 79: uint8(0x02), + 80: uint8(0x02), + 81: uint8(0x02), + 82: uint8(0x02), + 83: uint8(0x02), + 84: uint8(0x02), + 85: uint8(0x02), + 86: uint8(0x02), + 87: uint8(0x02), + 88: uint8(0x02), + 89: uint8(0x02), + 90: uint8(0x02), + 91: uint8(0x80), + 95: uint8(0x40), + 96: uint8(0x80), + 97: uint8(0x2a), + 98: uint8(0x2a), + 99: uint8(0x2a), + 100: uint8(0x2a), + 101: uint8(0x2a), + 102: uint8(0x2a), + 103: uint8(0x22), + 104: uint8(0x22), + 105: uint8(0x22), + 106: uint8(0x22), + 107: uint8(0x22), + 108: uint8(0x22), + 109: uint8(0x22), + 110: uint8(0x22), + 111: uint8(0x22), + 112: uint8(0x22), + 113: uint8(0x22), + 114: uint8(0x22), + 115: uint8(0x22), + 116: uint8(0x22), + 117: uint8(0x22), + 118: uint8(0x22), + 119: uint8(0x22), + 120: uint8(0x22), + 121: uint8(0x22), + 122: uint8(0x22), + 128: uint8(0x40), + 129: uint8(0x40), + 130: uint8(0x40), + 131: uint8(0x40), + 132: uint8(0x40), + 133: uint8(0x40), + 134: uint8(0x40), + 135: uint8(0x40), + 136: uint8(0x40), + 137: uint8(0x40), + 138: uint8(0x40), + 139: uint8(0x40), + 140: uint8(0x40), + 141: uint8(0x40), + 142: uint8(0x40), + 143: uint8(0x40), + 144: uint8(0x40), + 145: uint8(0x40), + 146: uint8(0x40), + 147: uint8(0x40), + 148: uint8(0x40), + 149: uint8(0x40), + 150: uint8(0x40), + 151: uint8(0x40), + 152: uint8(0x40), + 153: uint8(0x40), + 154: uint8(0x40), + 155: uint8(0x40), + 156: uint8(0x40), + 157: uint8(0x40), + 158: uint8(0x40), + 159: uint8(0x40), + 160: uint8(0x40), + 161: uint8(0x40), + 162: uint8(0x40), + 163: uint8(0x40), + 164: uint8(0x40), + 165: uint8(0x40), + 166: uint8(0x40), + 167: uint8(0x40), + 168: uint8(0x40), + 169: uint8(0x40), + 170: uint8(0x40), + 171: uint8(0x40), + 172: uint8(0x40), + 173: uint8(0x40), + 174: uint8(0x40), + 175: uint8(0x40), + 176: uint8(0x40), + 177: uint8(0x40), + 178: uint8(0x40), + 179: uint8(0x40), + 180: uint8(0x40), + 181: uint8(0x40), + 182: uint8(0x40), + 183: uint8(0x40), + 184: uint8(0x40), + 185: uint8(0x40), + 186: uint8(0x40), + 187: uint8(0x40), + 188: uint8(0x40), + 189: uint8(0x40), + 190: uint8(0x40), + 191: uint8(0x40), + 192: uint8(0x40), + 193: uint8(0x40), + 194: uint8(0x40), + 195: uint8(0x40), + 196: uint8(0x40), + 197: uint8(0x40), + 198: uint8(0x40), + 199: uint8(0x40), + 200: uint8(0x40), + 201: uint8(0x40), + 202: uint8(0x40), + 203: uint8(0x40), + 204: uint8(0x40), + 205: uint8(0x40), + 206: uint8(0x40), + 207: uint8(0x40), + 208: uint8(0x40), + 209: uint8(0x40), + 210: uint8(0x40), + 211: uint8(0x40), + 212: uint8(0x40), + 213: uint8(0x40), + 214: uint8(0x40), + 215: uint8(0x40), + 216: uint8(0x40), + 217: uint8(0x40), + 218: uint8(0x40), + 219: uint8(0x40), + 220: uint8(0x40), + 221: uint8(0x40), + 222: uint8(0x40), + 223: uint8(0x40), + 224: uint8(0x40), + 225: uint8(0x40), + 226: uint8(0x40), + 227: uint8(0x40), + 228: uint8(0x40), + 229: uint8(0x40), + 230: uint8(0x40), + 231: uint8(0x40), + 232: uint8(0x40), + 233: uint8(0x40), + 234: uint8(0x40), + 235: uint8(0x40), + 236: uint8(0x40), + 237: uint8(0x40), + 238: uint8(0x40), + 239: uint8(0x40), + 240: uint8(0x40), + 241: uint8(0x40), + 242: uint8(0x40), + 243: uint8(0x40), + 244: uint8(0x40), + 245: uint8(0x40), + 246: uint8(0x40), + 247: uint8(0x40), + 248: uint8(0x40), + 249: uint8(0x40), + 250: uint8(0x40), + 251: uint8(0x40), + 252: uint8(0x40), + 253: uint8(0x40), + 254: uint8(0x40), + 255: uint8(0x40), +} + +/* EVIDENCE-OF: R-02982-34736 In order to maintain full backwards +** compatibility for legacy applications, the URI filename capability is +** disabled by default. +** +** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled +** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options. +** +** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally +** disabled. The default value may be changed by compiling with the +** SQLITE_USE_URI symbol defined. + */ + +/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the +** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if +** that compile-time option is omitted. + */ + +/* The minimum PMA size is set to this value multiplied by the database +** page size in bytes. + */ + +/* Statement journals spill to disk when their size exceeds the following +** threshold (in bytes). 0 means that statement journals are created and +** written to disk immediately (the default behavior for SQLite versions +** before 3.12.0). -1 means always keep the entire statement journal in +** memory. (The statement journal is also always held entirely in memory +** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this +** setting.) + */ + +/* +** The default lookaside-configuration, the format "SZ,N". SZ is the +** number of bytes in each lookaside slot (should be a multiple of 8) +** and N is the number of slots. The lookaside-configuration can be +** changed as start-time using sqlite3_config(SQLITE_CONFIG_LOOKASIDE) +** or at run-time for an individual database connection using +** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); +** +** With the two-size-lookaside enhancement, less lookaside is required. +** The default configuration of 1200,40 actually provides 30 1200-byte slots +** and 93 128-byte slots, which is more lookaside than is available +** using the older 1200,100 configuration without two-size-lookaside. + */ + +/* The default maximum size of an in-memory database created using +** sqlite3_deserialize() + */ + +// C documentation +// +// /* +// ** The following singleton contains the global configuration for +// ** the SQLite library. +// */ +var _sqlite3Config = TSqlite3Config{ + FbCoreMutex: uint8(1), + FbFullMutex: libc.BoolUint8(true), + FbUseCis: uint8(SQLITE_ALLOW_COVERING_INDEX_SCAN), + FbExtraSchemaChecks: uint8(1), + FmxStrlen: int32(0x7ffffffe), + FszLookaside: int32(1200), + FnLookaside: int32(40), + FnStmtSpill: libc.Int32FromInt32(64) * libc.Int32FromInt32(1024), + FmxMmap: int64(SQLITE_MAX_MMAP_SIZE), + FnPage: int32(SQLITE_DEFAULT_PCACHE_INITSZ), + FszPma: uint32(SQLITE_SORTER_PMASZ), + FmxMemdbSize: int64(SQLITE_MEMDB_DEFAULT_MAXSIZE), + FiOnceResetThreshold: int32(0x7ffffffe), + FszSorterRef: uint32(SQLITE_DEFAULT_SORTERREF_SIZE), +} + +// C documentation +// +// /* +// ** Hash table for global functions - functions common to all +// ** database connections. After initialization, this table is +// ** read-only. +// */ +var _sqlite3BuiltinFunctions TFuncDefHash + +// C documentation +// +// /* +// ** The value of the "pending" byte must be 0x40000000 (1 byte past the +// ** 1-gibabyte boundary) in a compatible database. SQLite never uses +// ** the database page that contains the pending byte. It never attempts +// ** to read or write that page. The pending byte page is set aside +// ** for use by the VFS layers as space for managing file locks. +// ** +// ** During testing, it is often desirable to move the pending byte to +// ** a different position in the file. This allows code that has to +// ** deal with the pending byte to run on files that are much smaller +// ** than 1 GiB. The sqlite3_test_control() interface can be used to +// ** move the pending byte. +// ** +// ** IMPORTANT: Changing the pending byte to any value other than +// ** 0x40000000 results in an incompatible database file format! +// ** Changing the pending byte during operation will result in undefined +// ** and incorrect behavior. +// */ +var _sqlite3PendingByte = int32(0x40000000) + +// C documentation +// +// /* +// ** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS. +// */ +var _sqlite3TreeTrace = uint32(0) + +var _sqlite3WhereTrace = uint32(0) + +// C documentation +// +// /* #include "opcodes.h" */ +// /* +// ** Properties of opcodes. The OPFLG_INITIALIZER macro is +// ** created by mkopcodeh.awk during compilation. Data is obtained +// ** from the comments following the "case OP_xxxx:" statements in +// ** the vdbe.c file. +// */ +var _sqlite3OpcodeProperty = [190]uint8{ + 4: uint8(0x10), + 6: uint8(0x41), + 8: uint8(0x01), + 9: uint8(0x01), + 10: uint8(0x01), + 11: uint8(0x01), + 12: uint8(0x03), + 13: uint8(0x03), + 14: uint8(0x01), + 15: uint8(0x01), + 16: uint8(0x03), + 17: uint8(0x03), + 18: uint8(0x01), + 19: uint8(0x12), + 20: uint8(0x01), + 21: uint8(0x49), + 22: uint8(0x49), + 23: uint8(0x49), + 24: uint8(0x49), + 25: uint8(0x01), + 26: uint8(0x49), + 27: uint8(0x49), + 28: uint8(0x49), + 29: uint8(0x49), + 30: uint8(0x49), + 31: uint8(0x49), + 32: uint8(0x41), + 33: uint8(0x01), + 34: uint8(0x41), + 35: uint8(0x41), + 36: uint8(0x41), + 37: uint8(0x01), + 38: uint8(0x41), + 39: uint8(0x41), + 40: uint8(0x41), + 41: uint8(0x41), + 42: uint8(0x41), + 43: uint8(0x26), + 44: uint8(0x26), + 45: uint8(0x41), + 46: uint8(0x23), + 47: uint8(0x0b), + 48: uint8(0x01), + 49: uint8(0x01), + 50: uint8(0x03), + 51: uint8(0x03), + 52: uint8(0x0b), + 53: uint8(0x0b), + 54: uint8(0x0b), + 55: uint8(0x0b), + 56: uint8(0x0b), + 57: uint8(0x0b), + 58: uint8(0x01), + 59: uint8(0x03), + 60: uint8(0x03), + 61: uint8(0x03), + 62: uint8(0x01), + 63: uint8(0x41), + 64: uint8(0x01), + 67: uint8(0x02), + 68: uint8(0x02), + 69: uint8(0x08), + 71: uint8(0x10), + 72: uint8(0x10), + 73: uint8(0x10), + 75: uint8(0x10), + 77: uint8(0x10), + 78: uint8(0x10), + 81: uint8(0x10), + 82: uint8(0x10), + 86: uint8(0x02), + 87: uint8(0x02), + 88: uint8(0x02), + 91: uint8(0x12), + 92: uint8(0x1e), + 93: uint8(0x20), + 94: uint8(0x40), + 98: uint8(0x10), + 99: uint8(0x10), + 101: uint8(0x40), + 102: uint8(0x26), + 103: uint8(0x26), + 104: uint8(0x26), + 105: uint8(0x26), + 106: uint8(0x26), + 107: uint8(0x26), + 108: uint8(0x26), + 109: uint8(0x26), + 110: uint8(0x26), + 111: uint8(0x26), + 112: uint8(0x40), + 114: uint8(0x12), + 115: uint8(0x40), + 116: uint8(0x40), + 117: uint8(0x10), + 118: uint8(0x40), + 122: uint8(0x40), + 124: uint8(0x40), + 125: uint8(0x40), + 126: uint8(0x10), + 127: uint8(0x10), + 133: uint8(0x40), + 135: uint8(0x50), + 137: uint8(0x40), + 138: uint8(0x04), + 139: uint8(0x04), + 141: uint8(0x40), + 142: uint8(0x50), + 143: uint8(0x40), + 144: uint8(0x10), + 147: uint8(0x10), + 153: uint8(0x10), + 156: uint8(0x06), + 157: uint8(0x10), + 159: uint8(0x04), + 160: uint8(0x1a), + 173: uint8(0x40), + 174: uint8(0x10), + 175: uint8(0x50), + 176: uint8(0x40), + 178: uint8(0x10), + 179: uint8(0x10), + 180: uint8(0x02), + 181: uint8(0x12), + 182: uint8(0x12), +} + +// C documentation +// +// /* +// ** Name of the default collating sequence +// */ +var _sqlite3StrBINARY = [7]int8{'B', 'I', 'N', 'A', 'R', 'Y'} + +// C documentation +// +// /* +// ** Standard typenames. These names must match the COLTYPE_* definitions. +// ** Adjust the SQLITE_N_STDTYPE value if adding or removing entries. +// ** +// ** sqlite3StdType[] The actual names of the datatypes. +// ** +// ** sqlite3StdTypeLen[] The length (in bytes) of each entry +// ** in sqlite3StdType[]. +// ** +// ** sqlite3StdTypeAffinity[] The affinity associated with each entry +// ** in sqlite3StdType[]. +// */ +var _sqlite3StdTypeLen = [6]uint8{ + 0: uint8(3), + 1: uint8(4), + 2: uint8(3), + 3: uint8(7), + 4: uint8(4), + 5: uint8(4), +} + +var _sqlite3StdTypeAffinity = [6]int8{ + 0: int8(SQLITE_AFF_NUMERIC), + 1: int8(SQLITE_AFF_BLOB), + 2: int8(SQLITE_AFF_INTEGER), + 3: int8(SQLITE_AFF_INTEGER), + 4: int8(SQLITE_AFF_REAL), + 5: int8(SQLITE_AFF_TEXT), +} + +var _sqlite3StdType = [6]uintptr{ + 0: __ccgo_ts + 1155, + 1: __ccgo_ts + 1159, + 2: __ccgo_ts + 1164, + 3: __ccgo_ts + 1168, + 4: __ccgo_ts + 1176, + 5: __ccgo_ts + 1181, +} + +/************** End of global.c **********************************************/ +/************** Begin file status.c ******************************************/ +/* +** 2008 June 18 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This module implements the sqlite3_status() interface and related +** functionality. + */ +/* #include "sqliteInt.h" */ +/************** Include vdbeInt.h in the middle of status.c ******************/ +/************** Begin file vdbeInt.h *****************************************/ +/* +** 2003 September 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This is the header file for information that is private to the +** VDBE. This information used to all be at the top of the single +** source code file "vdbe.c". When that file became too big (over +** 6000 lines long) it was split up into several smaller files and +** this header information was factored out. + */ + +/* +** The maximum number of times that a statement will try to reparse +** itself before giving up and returning SQLITE_SCHEMA. + */ + +/* +** VDBE_DISPLAY_P4 is true or false depending on whether or not the +** "explain" P4 display logic is enabled. + */ + +// C documentation +// +// /* +// ** SQL is translated into a sequence of instructions to be +// ** executed by a virtual machine. Each instruction is an instance +// ** of the following structure. +// */ +type TOp = struct { + Fopcode Tu8 + Fp4type int8 + Fp5 Tu16 + Fp1 int32 + Fp2 int32 + Fp3 int32 + Fp4 Tp4union +} + +type Op = TOp + +// C documentation +// +// /* +// ** Boolean values +// */ +type TBool = uint32 + +type Bool = TBool + +// C documentation +// +// /* Opaque type used by code in vdbesort.c */ +type TVdbeSorter = struct { + FmnPmaSize int32 + FmxPmaSize int32 + FmxKeysize int32 + Fpgsz int32 + FpReader uintptr + FpMerger uintptr + Fdb uintptr + FpKeyInfo uintptr + FpUnpacked uintptr + Flist TSorterList + FiMemory int32 + FnMemory int32 + FbUsePMA Tu8 + FbUseThreads Tu8 + FiPrev Tu8 + FnTask Tu8 + FtypeMask Tu8 + FaTask [1]TSortSubtask +} + +type VdbeSorter = TVdbeSorter + +// C documentation +// +// /* Elements of the linked list at Vdbe.pAuxData */ +type TAuxData = struct { + FiAuxOp int32 + FiAuxArg int32 + FpAux uintptr + FxDeleteAux uintptr + FpNextAux uintptr +} + +type AuxData = TAuxData + +// C documentation +// +// /* A cache of large TEXT or BLOB values in a VdbeCursor */ +type TVdbeTxtBlbCache = struct { + FpCValue uintptr + FiOffset Ti64 + FiCol int32 + FcacheStatus Tu32 + FcolCacheCtr Tu32 +} + +type VdbeTxtBlbCache = TVdbeTxtBlbCache + +/* Types of VDBE cursors */ + +// C documentation +// +// /* +// ** A VdbeCursor is an superclass (a wrapper) for various cursor objects: +// ** +// ** * A b-tree cursor +// ** - In the main database or in an ephemeral database +// ** - On either an index or a table +// ** * A sorter +// ** * A virtual table +// ** * A one-row "pseudotable" stored in a single register +// */ +type TVdbeCursor = struct { + FeCurType Tu8 + FiDb Ti8 + FnullRow Tu8 + FdeferredMoveto Tu8 + FisTable Tu8 + F__ccgo_align5 [3]byte + F__ccgo8 uint8 + FseekHit Tu16 + Fub struct { + FaAltMap [0]uintptr + FpBtx uintptr + } + FseqCount Ti64 + FcacheStatus Tu32 + FseekResult int32 + FpAltCursor uintptr + Fuc struct { + FpVCur [0]uintptr + FpSorter [0]uintptr + FpCursor uintptr + } + FpKeyInfo uintptr + FiHdrOffset Tu32 + FpgnoRoot TPgno + FnField Ti16 + FnHdrParsed Tu16 + FmovetoTarget Ti64 + FaOffset uintptr + FaRow uintptr + FpayloadSize Tu32 + FszRow Tu32 + FpCache uintptr + FaType [1]Tu32 +} + +type VdbeCursor = TVdbeCursor + +type TVdbeCursor1 = struct { + FeCurType Tu8 + FiDb Ti8 + FnullRow Tu8 + FdeferredMoveto Tu8 + FisTable Tu8 + F__ccgo_align5 [3]byte + F__ccgo8 uint8 + FseekHit Tu16 + Fub struct { + FaAltMap [0]uintptr + FpBtx uintptr + } + FseqCount Ti64 + FcacheStatus Tu32 + FseekResult int32 + FpAltCursor uintptr + Fuc struct { + FpVCur [0]uintptr + FpSorter [0]uintptr + FpCursor uintptr + } + FpKeyInfo uintptr + FiHdrOffset Tu32 + FpgnoRoot TPgno + FnField Ti16 + FnHdrParsed Tu16 + FmovetoTarget Ti64 + FaOffset uintptr + FaRow uintptr + FpayloadSize Tu32 + FszRow Tu32 + FpCache uintptr + FaType [1]Tu32 +} + +type VdbeCursor1 = TVdbeCursor1 + +/* Return true if P is a null-only cursor + */ + +/* +** A value for VdbeCursor.cacheStatus that means the cache is always invalid. + */ + +/* +** Large TEXT or BLOB values can be slow to load, so we want to avoid +** loading them more than once. For that reason, large TEXT and BLOB values +** can be stored in a cache defined by this object, and attached to the +** VdbeCursor using the pCache field. + */ +type TVdbeTxtBlbCache1 = struct { + FpCValue uintptr + FiOffset Ti64 + FiCol int32 + FcacheStatus Tu32 + FcolCacheCtr Tu32 +} + +type VdbeTxtBlbCache1 = TVdbeTxtBlbCache1 + +// C documentation +// +// /* +// ** When a sub-program is executed (OP_Program), a structure of this type +// ** is allocated to store the current value of the program counter, as +// ** well as the current memory cell array and various other frame specific +// ** values stored in the Vdbe struct. When the sub-program is finished, +// ** these values are copied back to the Vdbe from the VdbeFrame structure, +// ** restoring the state of the VM to as it was before the sub-program +// ** began executing. +// ** +// ** The memory for a VdbeFrame object is allocated and managed by a memory +// ** cell in the parent (calling) frame. When the memory cell is deleted or +// ** overwritten, the VdbeFrame object is not freed immediately. Instead, it +// ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame +// ** list is deleted when the VM is reset in VdbeHalt(). The reason for doing +// ** this instead of deleting the VdbeFrame immediately is to avoid recursive +// ** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the +// ** child frame are released. +// ** +// ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is +// ** set to NULL if the currently executing frame is the main program. +// */ +type TVdbeFrame = struct { + Fv uintptr + FpParent uintptr + FaOp uintptr + FaMem uintptr + FapCsr uintptr + FaOnce uintptr + Ftoken uintptr + FlastRowid Ti64 + FpAuxData uintptr + FnCursor int32 + Fpc int32 + FnOp int32 + FnMem int32 + FnChildMem int32 + FnChildCsr int32 + FnChange Ti64 + FnDbChange Ti64 +} + +type VdbeFrame = TVdbeFrame + +type TVdbeFrame1 = struct { + Fv uintptr + FpParent uintptr + FaOp uintptr + FaMem uintptr + FapCsr uintptr + FaOnce uintptr + Ftoken uintptr + FlastRowid Ti64 + FpAuxData uintptr + FnCursor int32 + Fpc int32 + FnOp int32 + FnMem int32 + FnChildMem int32 + FnChildCsr int32 + FnChange Ti64 + FnDbChange Ti64 +} + +type VdbeFrame1 = TVdbeFrame1 + +/* +** Size of struct Mem not including the Mem.zMalloc member or anything that +** follows. + */ + +/* One or more of the following flags are set to indicate the +** representations of the value stored in the Mem struct. +** +** * MEM_Null An SQL NULL value +** +** * MEM_Null|MEM_Zero An SQL NULL with the virtual table +** UPDATE no-change flag set +** +** * MEM_Null|MEM_Term| An SQL NULL, but also contains a +** MEM_Subtype pointer accessible using +** sqlite3_value_pointer(). +** +** * MEM_Null|MEM_Cleared Special SQL NULL that compares non-equal +** to other NULLs even using the IS operator. +** +** * MEM_Str A string, stored in Mem.z with +** length Mem.n. Zero-terminated if +** MEM_Term is set. This flag is +** incompatible with MEM_Blob and +** MEM_Null, but can appear with MEM_Int, +** MEM_Real, and MEM_IntReal. +** +** * MEM_Blob A blob, stored in Mem.z length Mem.n. +** Incompatible with MEM_Str, MEM_Null, +** MEM_Int, MEM_Real, and MEM_IntReal. +** +** * MEM_Blob|MEM_Zero A blob in Mem.z of length Mem.n plus +** MEM.u.i extra 0x00 bytes at the end. +** +** * MEM_Int Integer stored in Mem.u.i. +** +** * MEM_Real Real stored in Mem.u.r. +** +** * MEM_IntReal Real stored as an integer in Mem.u.i. +** +** If the MEM_Null flag is set, then the value is an SQL NULL value. +** For a pointer type created using sqlite3_bind_pointer() or +** sqlite3_result_pointer() the MEM_Term and MEM_Subtype flags are also set. +** +** If the MEM_Str flag is set then Mem.z points at a string representation. +** Usually this is encoded in the same unicode encoding as the main +** database (see below for exceptions). If the MEM_Term flag is also +** set, then the string is nul terminated. The MEM_Int and MEM_Real +** flags may coexist with the MEM_Str flag. + */ + +/* Extra bits that modify the meanings of the core datatypes above + */ +/* 0x0080 // Available */ + +/* Bits that determine the storage for Mem.z for a string or blob or +** aggregate accumulator. + */ + +/* Return TRUE if Mem X contains dynamically allocated content - anything +** that needs to be deallocated to avoid a leak. + */ + +/* +** Clear any existing type flags from a Mem and replace them with f + */ + +/* +** True if Mem X is a NULL-nochng type. + */ + +/* +** Return true if a memory cell has been initialized and is valid. +** is for use inside assert() statements only. +** +** A Memory cell is initialized if at least one of the +** MEM_Null, MEM_Str, MEM_Int, MEM_Real, MEM_Blob, or MEM_IntReal bits +** is set. It is "undefined" if all those bits are zero. + */ + +/* +** Each auxiliary data pointer stored by a user defined function +** implementation calling sqlite3_set_auxdata() is stored in an instance +** of this structure. All such structures associated with a single VM +** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed +** when the VM is halted (if not before). + */ +type TAuxData1 = struct { + FiAuxOp int32 + FiAuxArg int32 + FpAux uintptr + FxDeleteAux uintptr + FpNextAux uintptr +} + +type AuxData1 = TAuxData1 + +/* +** The "context" argument for an installable function. A pointer to an +** instance of this structure is the first argument to the routines used +** implement the SQL functions. +** +** There is a typedef for this structure in sqlite.h. So all routines, +** even the public interface to SQLite, can use a pointer to this structure. +** But this file is the only place where the internal details of this +** structure are known. +** +** This structure is defined inside of vdbeInt.h because it uses substructures +** (Mem) which are only defined there. + */ +type Tsqlite3_context1 = struct { + FpOut uintptr + FpFunc uintptr + FpMem uintptr + FpVdbe uintptr + FiOp int32 + FisError int32 + Fenc Tu8 + FskipFlag Tu8 + Fargc Tu8 + Fargv [1]uintptr +} + +type sqlite3_context1 = Tsqlite3_context1 + +// C documentation +// +// /* A bitfield type for use inside of structures. Always follow with :N where +// ** N is the number of bits. +// */ +type Tbft = uint32 + +type bft = Tbft + +/* Bit Field Type */ + +// C documentation +// +// /* The ScanStatus object holds a single value for the +// ** sqlite3_stmt_scanstatus() interface. +// ** +// ** aAddrRange[]: +// ** This array is used by ScanStatus elements associated with EQP +// ** notes that make an SQLITE_SCANSTAT_NCYCLE value available. It is +// ** an array of up to 3 ranges of VM addresses for which the Vdbe.anCycle[] +// ** values should be summed to calculate the NCYCLE value. Each pair of +// ** integer addresses is a start and end address (both inclusive) for a range +// ** instructions. A start value of 0 indicates an empty range. +// */ +type TScanStatus = struct { + FaddrExplain int32 + FaAddrRange [6]int32 + FaddrLoop int32 + FaddrVisit int32 + FiSelectID int32 + FnEst TLogEst + FzName uintptr +} + +type ScanStatus = TScanStatus + +type TScanStatus1 = struct { + FaddrExplain int32 + FaAddrRange [6]int32 + FaddrLoop int32 + FaddrVisit int32 + FiSelectID int32 + FnEst TLogEst + FzName uintptr +} + +type ScanStatus1 = TScanStatus1 + +// C documentation +// +// /* The DblquoteStr object holds the text of a double-quoted +// ** string for a prepared statement. A linked list of these objects +// ** is constructed during statement parsing and is held on Vdbe.pDblStr. +// ** When computing a normalized SQL statement for an SQL statement, that +// ** list is consulted for each double-quoted identifier to see if the +// ** identifier should really be a string literal. +// */ +type TDblquoteStr = struct { + FpNextStr uintptr + Fz [8]int8 +} + +type DblquoteStr = TDblquoteStr + +type TDblquoteStr1 = struct { + FpNextStr uintptr + Fz [8]int8 +} + +type DblquoteStr1 = TDblquoteStr1 + +/* +** An instance of the virtual machine. This structure contains the complete +** state of the virtual machine. +** +** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() +** is really a pointer to an instance of this structure. + */ +type TVdbe1 = struct { + Fdb uintptr + FppVPrev uintptr + FpVNext uintptr + FpParse uintptr + FnVar TynVar + FnMem int32 + FnCursor int32 + FcacheCtr Tu32 + Fpc int32 + Frc int32 + FnChange Ti64 + FiStatement int32 + FiCurrentTime Ti64 + FnFkConstraint Ti64 + FnStmtDefCons Ti64 + FnStmtDefImmCons Ti64 + FaMem uintptr + FapArg uintptr + FapCsr uintptr + FaVar uintptr + FaOp uintptr + FnOp int32 + FnOpAlloc int32 + FaColName uintptr + FpResultRow uintptr + FzErrMsg uintptr + FpVList uintptr + FstartTime Ti64 + FnResColumn Tu16 + FnResAlloc Tu16 + FerrorAction Tu8 + FminWriteFileFormat Tu8 + FprepFlags Tu8 + FeVdbeState Tu8 + F__ccgo200 uint16 + FbtreeMask TyDbMask + FlockMask TyDbMask + FaCounter [9]Tu32 + FzSql uintptr + FpFree uintptr + FpFrame uintptr + FpDelFrame uintptr + FnFrame int32 + Fexpmask Tu32 + FpProgram uintptr + FpAuxData uintptr +} + +type Vdbe1 = TVdbe1 + +/* +** The following are allowed values for Vdbe.eVdbeState + */ + +/* +** Structure used to store the context required by the +** sqlite3_preupdate_*() API functions. + */ +type TPreUpdate1 = struct { + Fv uintptr + FpCsr uintptr + Fop int32 + FaRecord uintptr + Fkeyinfo TKeyInfo + FpUnpacked uintptr + FpNewUnpacked uintptr + FiNewReg int32 + FiBlobWrite int32 + FiKey1 Ti64 + FiKey2 Ti64 + FaNew uintptr + FpTab uintptr + FpPk uintptr +} + +type PreUpdate1 = TPreUpdate1 + +// C documentation +// +// /* +// ** An instance of this object is used to pass an vector of values into +// ** OP_VFilter, the xFilter method of a virtual table. The vector is the +// ** set of values on the right-hand side of an IN constraint. +// ** +// ** The value as passed into xFilter is an sqlite3_value with a "pointer" +// ** type, such as is generated by sqlite3_result_pointer() and read by +// ** sqlite3_value_pointer. Such values have MEM_Term|MEM_Subtype|MEM_Null +// ** and a subtype of 'p'. The sqlite3_vtab_in_first() and _next() interfaces +// ** know how to use this object to step through all the values in the +// ** right operand of the IN constraint. +// */ +type TValueList = struct { + FpCsr uintptr + FpOut uintptr +} + +type ValueList = TValueList + +type TValueList1 = struct { + FpCsr uintptr + FpOut uintptr +} + +type ValueList1 = TValueList1 + +/************** End of vdbeInt.h *********************************************/ +/************** Continuing where we left off in status.c *********************/ + +// C documentation +// +// /* +// ** Variables in which to record status information. +// */ +type Tsqlite3StatValueType = int64 + +type sqlite3StatValueType = Tsqlite3StatValueType + +type Tsqlite3StatType = struct { + FnowValue [10]Tsqlite3StatValueType + FmxValue [10]Tsqlite3StatValueType +} + +type sqlite3StatType = Tsqlite3StatType + +type Tsqlite3StatType1 = struct { + FnowValue [10]Tsqlite3StatValueType + FmxValue [10]Tsqlite3StatValueType +} + +type sqlite3StatType1 = Tsqlite3StatType1 + +var _sqlite3Stat = Tsqlite3StatType1{} + +// C documentation +// +// /* +// ** Elements of sqlite3Stat[] are protected by either the memory allocator +// ** mutex, or by the pcache1 mutex. The following array determines which. +// */ +var _statMutex = [10]int8{ + 1: int8(1), + 2: int8(1), + 7: int8(1), +} + +/* The "wsdStat" macro will resolve to the status information +** state vector. If writable static data is unsupported on the target, +** we have to locate the state vector at run-time. In the more common +** case where writable static data is supported, wsdStat can refer directly +** to the "sqlite3Stat" state vector declared above. + */ + +// C documentation +// +// /* +// ** Return the current value of a status parameter. The caller must +// ** be holding the appropriate mutex. +// */ +func _sqlite3StatusValue(tls *libc.TLS, op int32) (r Tsqlite3_int64) { + return *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) +} + +// C documentation +// +// /* +// ** Add N to the value of a status record. The caller must hold the +// ** appropriate mutex. (Locking is checked by assert()). +// ** +// ** The StatusUp() routine can accept positive or negative values for N. +// ** The value of N is added to the current status value and the high-water +// ** mark is adjusted if necessary. +// ** +// ** The StatusDown() routine lowers the current value by N. The highwater +// ** mark is unchanged. N must be non-negative for StatusDown(). +// */ +func _sqlite3StatusUp(tls *libc.TLS, op int32, N int32) { + *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) += int64(N) + if *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) > *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) { + *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) = *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) + } +} + +func _sqlite3StatusDown(tls *libc.TLS, op int32, N int32) { + *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) -= int64(N) +} + +// C documentation +// +// /* +// ** Adjust the highwater mark if necessary. +// ** The caller must hold the appropriate mutex. +// */ +func _sqlite3StatusHighwater(tls *libc.TLS, op int32, X int32) { + var newValue Tsqlite3StatValueType + _ = newValue + newValue = int64(X) + if newValue > *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) { + *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) = newValue + } +} + +// C documentation +// +// /* +// ** Query status information. +// */ +func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) (r int32) { + var pMutex, v1 uintptr + _, _ = pMutex, v1 + if op < 0 || op >= int32(libc.Uint64FromInt64(80)/libc.Uint64FromInt64(8)) { + return _sqlite3MisuseError(tls, int32(23890)) + } + if _statMutex[op] != 0 { + v1 = _sqlite3Pcache1Mutex(tls) + } else { + v1 = _sqlite3MallocMutex(tls) + } + pMutex = v1 + Xsqlite3_mutex_enter(tls, pMutex) + *(*Tsqlite3_int64)(unsafe.Pointer(pCurrent)) = *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) + *(*Tsqlite3_int64)(unsafe.Pointer(pHighwater)) = *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) + if resetFlag != 0 { + *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + 80 + uintptr(op)*8)) = *(*Tsqlite3StatValueType)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Stat)) + uintptr(op)*8)) + } + Xsqlite3_mutex_leave(tls, pMutex) + _ = pMutex /* Prevent warning when SQLITE_THREADSAFE=0 */ + return SQLITE_OK +} + +func Xsqlite3_status(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* iCur at bp+0 */ Tsqlite3_int64 + var _ /* iHwtr at bp+8 */ Tsqlite3_int64 + _ = rc + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = 0 + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 + rc = Xsqlite3_status64(tls, op, bp, bp+8, resetFlag) + if rc == 0 { + *(*int32)(unsafe.Pointer(pCurrent)) = int32(*(*Tsqlite3_int64)(unsafe.Pointer(bp))) + *(*int32)(unsafe.Pointer(pHighwater)) = int32(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 8))) + } + return rc +} + +// C documentation +// +// /* +// ** Return the number of LookasideSlot elements on the linked list +// */ +func _countLookasideSlots(tls *libc.TLS, p uintptr) (r Tu32) { + var cnt Tu32 + _ = cnt + cnt = uint32(0) + for p != 0 { + p = (*TLookasideSlot)(unsafe.Pointer(p)).FpNext + cnt++ + } + return cnt +} + +// C documentation +// +// /* +// ** Count the number of slots of lookaside memory that are outstanding +// */ +func _sqlite3LookasideUsed(tls *libc.TLS, db uintptr, pHighwater uintptr) (r int32) { + var nFree, nInit Tu32 + _, _ = nFree, nInit + nInit = _countLookasideSlots(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit) + nFree = _countLookasideSlots(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree) + nInit += _countLookasideSlots(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit) + nFree += _countLookasideSlots(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree) + if pHighwater != 0 { + *(*int32)(unsafe.Pointer(pHighwater)) = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot - nInit) + } + return int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot - (nInit + nFree)) +} + +// C documentation +// +// /* +// ** Query status information for a single database connection +// */ +func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, i1, i2, nByte, rc, totalUsed int32 + var p, p1, pBt, pPager, pPager1, pSchema, pVdbe uintptr + var _ /* nByte at bp+0 */ int32 + var _ /* nByte at bp+4 */ int32 + var _ /* nRet at bp+8 */ Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _ = i, i1, i2, nByte, p, p1, pBt, pPager, pPager1, pSchema, pVdbe, rc, totalUsed + rc = SQLITE_OK /* Return code */ + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + switch op { + case SQLITE_DBSTATUS_LOOKASIDE_USED: + *(*int32)(unsafe.Pointer(pCurrent)) = _sqlite3LookasideUsed(tls, db, pHighwater) + if resetFlag != 0 { + p = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + if p != 0 { + for (*TLookasideSlot)(unsafe.Pointer(p)).FpNext != 0 { + p = (*TLookasideSlot)(unsafe.Pointer(p)).FpNext + } + (*TLookasideSlot)(unsafe.Pointer(p)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = uintptr(0) + } + p = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + if p != 0 { + for (*TLookasideSlot)(unsafe.Pointer(p)).FpNext != 0 { + p = (*TLookasideSlot)(unsafe.Pointer(p)).FpNext + } + (*TLookasideSlot)(unsafe.Pointer(p)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + } + } + case int32(SQLITE_DBSTATUS_LOOKASIDE_HIT): + fallthrough + case int32(SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE): + fallthrough + case int32(SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL): + *(*int32)(unsafe.Pointer(pCurrent)) = 0 + *(*int32)(unsafe.Pointer(pHighwater)) = int32(*(*Tu32)(unsafe.Pointer(db + 440 + 16 + uintptr(op-int32(SQLITE_DBSTATUS_LOOKASIDE_HIT))*4))) + if resetFlag != 0 { + *(*Tu32)(unsafe.Pointer(db + 440 + 16 + uintptr(op-int32(SQLITE_DBSTATUS_LOOKASIDE_HIT))*4)) = uint32(0) + } + break + /* + ** Return an approximation for the amount of memory currently used + ** by all pagers associated with the given database connection. The + ** highwater mark is meaningless and is returned as zero. + */ + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_USED_SHARED): + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_USED): + totalUsed = 0 + _sqlite3BtreeEnterAll(tls, db) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 { + pPager = _sqlite3BtreePager(tls, pBt) + nByte = _sqlite3PagerMemUsed(tls, pPager) + if op == int32(SQLITE_DBSTATUS_CACHE_USED_SHARED) { + nByte = nByte / _sqlite3BtreeConnectionCount(tls, pBt) + } + totalUsed += nByte + } + goto _1 + _1: + ; + i++ + } + _sqlite3BtreeLeaveAll(tls, db) + *(*int32)(unsafe.Pointer(pCurrent)) = totalUsed + *(*int32)(unsafe.Pointer(pHighwater)) = 0 + break + /* + ** *pCurrent gets an accurate estimate of the amount of memory used + ** to store the schema for all databases (main, temp, and any ATTACHed + ** databases. *pHighwater is set to zero. + */ + fallthrough + case int32(SQLITE_DBSTATUS_SCHEMA_USED): /* Used to iterate through schemas */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* Used to accumulate return value */ + _sqlite3BtreeEnterAll(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart + i1 = 0 + for { + if !(i1 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i1)*32))).FpSchema + if pSchema != uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(uint32(*(*int32)(unsafe.Pointer(bp))) + uint32((*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRoundup})))(tls, int32(32)))*((*TSchema)(unsafe.Pointer(pSchema)).FtblHash.Fcount+(*TSchema)(unsafe.Pointer(pSchema)).FtrigHash.Fcount+(*TSchema)(unsafe.Pointer(pSchema)).FidxHash.Fcount+(*TSchema)(unsafe.Pointer(pSchema)).FfkeyHash.Fcount)) + *(*int32)(unsafe.Pointer(bp)) = int32(uint64(*(*int32)(unsafe.Pointer(bp))) + Xsqlite3_msize(tls, (*TSchema)(unsafe.Pointer(pSchema)).FtblHash.Fht)) + *(*int32)(unsafe.Pointer(bp)) = int32(uint64(*(*int32)(unsafe.Pointer(bp))) + Xsqlite3_msize(tls, (*TSchema)(unsafe.Pointer(pSchema)).FtrigHash.Fht)) + *(*int32)(unsafe.Pointer(bp)) = int32(uint64(*(*int32)(unsafe.Pointer(bp))) + Xsqlite3_msize(tls, (*TSchema)(unsafe.Pointer(pSchema)).FidxHash.Fht)) + *(*int32)(unsafe.Pointer(bp)) = int32(uint64(*(*int32)(unsafe.Pointer(bp))) + Xsqlite3_msize(tls, (*TSchema)(unsafe.Pointer(pSchema)).FfkeyHash.Fht)) + p1 = (*THash)(unsafe.Pointer(pSchema + 56)).Ffirst + for { + if !(p1 != 0) { + break + } + _sqlite3DeleteTrigger(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) + goto _3 + _3: + ; + p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext + } + p1 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst + for { + if !(p1 != 0) { + break + } + _sqlite3DeleteTable(tls, db, (*THashElem)(unsafe.Pointer(p1)).Fdata) + goto _4 + _4: + ; + p1 = (*THashElem)(unsafe.Pointer(p1)).Fnext + } + } + goto _2 + _2: + ; + i1++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd + _sqlite3BtreeLeaveAll(tls, db) + *(*int32)(unsafe.Pointer(pHighwater)) = 0 + *(*int32)(unsafe.Pointer(pCurrent)) = *(*int32)(unsafe.Pointer(bp)) + break + /* + ** *pCurrent gets an accurate estimate of the amount of memory used + ** to store all prepared statements. + ** *pHighwater is set to zero. + */ + fallthrough + case int32(SQLITE_DBSTATUS_STMT_USED): /* Used to iterate through VMs */ + *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Used to accumulate return value */ + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart + pVdbe = (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe + for { + if !(pVdbe != 0) { + break + } + _sqlite3VdbeDelete(tls, pVdbe) + goto _5 + _5: + ; + pVdbe = (*TVdbe1)(unsafe.Pointer(pVdbe)).FpVNext + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-64479-57858 */ + *(*int32)(unsafe.Pointer(pCurrent)) = *(*int32)(unsafe.Pointer(bp + 4)) + break + /* + ** Set *pCurrent to the total cache hits or misses encountered by all + ** pagers the database handle is connected to. *pHighwater is always set + ** to zero. + */ + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_SPILL): + op = libc.Int32FromInt32(SQLITE_DBSTATUS_CACHE_WRITE) + libc.Int32FromInt32(1) + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_HIT): + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_MISS): + fallthrough + case int32(SQLITE_DBSTATUS_CACHE_WRITE): + *(*Tu64)(unsafe.Pointer(bp + 8)) = uint64(0) + i2 = 0 + for { + if !(i2 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i2)*32))).FpBt != 0 { + pPager1 = _sqlite3BtreePager(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i2)*32))).FpBt) + _sqlite3PagerCacheStat(tls, pPager1, op, resetFlag, bp+8) + } + goto _6 + _6: + ; + i2++ + } + *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-42420-56072 */ + /* IMP: R-54100-20147 */ + /* IMP: R-29431-39229 */ + *(*int32)(unsafe.Pointer(pCurrent)) = int32(*(*Tu64)(unsafe.Pointer(bp + 8))) & int32(0x7fffffff) + break + /* Set *pCurrent to non-zero if there are unresolved deferred foreign + ** key constraints. Set *pCurrent to zero if all foreign key constraints + ** have been satisfied. The *pHighwater is always set to zero. + */ + fallthrough + case int32(SQLITE_DBSTATUS_DEFERRED_FKS): + *(*int32)(unsafe.Pointer(pHighwater)) = 0 /* IMP: R-11967-56545 */ + *(*int32)(unsafe.Pointer(pCurrent)) = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons > 0) + default: + rc = int32(SQLITE_ERROR) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +type Ttime_t = int64 + +type time_t = Ttime_t + +type Ttimer_t = uintptr + +type timer_t = Ttimer_t + +type Tclockid_t = int32 + +type clockid_t = Tclockid_t + +type Tclock_t = int64 + +type clock_t = Tclock_t + +type Ttimespec = struct { + Ftv_sec Ttime_t + Ftv_nsec int64 +} + +type timespec = Ttimespec + +type Tpid_t = int32 + +type pid_t = Tpid_t + +type Ttm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + Ftm_gmtoff int64 + Ftm_zone uintptr +} + +type tm = Ttm + +type Titimerspec = struct { + Fit_interval Ttimespec + Fit_value Ttimespec +} + +type itimerspec = Titimerspec + +/* +** The MSVC CRT on Windows CE may not have a localtime() function. +** So declare a substitute. The substitute function itself is +** defined in "os_win.c". + */ + +// C documentation +// +// /* +// ** A structure for holding a single date and time. +// */ +type TDateTime = struct { + FiJD Tsqlite3_int64 + FY int32 + FM int32 + FD int32 + Fh int32 + Fm int32 + Ftz int32 + Fs float64 + FvalidJD int8 + FrawS int8 + FvalidYMD int8 + FvalidHMS int8 + FvalidTZ int8 + FtzSet int8 + FisError int8 + FuseSubsec int8 +} + +type DateTime = TDateTime + +type TDateTime1 = struct { + FiJD Tsqlite3_int64 + FY int32 + FM int32 + FD int32 + Fh int32 + Fm int32 + Ftz int32 + Fs float64 + FvalidJD int8 + FrawS int8 + FvalidYMD int8 + FvalidHMS int8 + FvalidTZ int8 + FtzSet int8 + FisError int8 + FuseSubsec int8 +} + +type DateTime1 = TDateTime1 + +// C documentation +// +// /* +// ** Convert zDate into one or more integers according to the conversion +// ** specifier zFormat. +// ** +// ** zFormat[] contains 4 characters for each integer converted, except for +// ** the last integer which is specified by three characters. The meaning +// ** of a four-character format specifiers ABCD is: +// ** +// ** A: number of digits to convert. Always "2" or "4". +// ** B: minimum value. Always "0" or "1". +// ** C: maximum value, decoded as: +// ** a: 12 +// ** b: 14 +// ** c: 24 +// ** d: 31 +// ** e: 59 +// ** f: 9999 +// ** D: the separator character, or \000 to indicate this is the +// ** last number to convert. +// ** +// ** Example: To translate an ISO-8601 date YYYY-MM-DD, the format would +// ** be "40f-21a-20c". The "40f-" indicates the 4-digit year followed by "-". +// ** The "21a-" indicates the 2-digit month followed by "-". The "20c" indicates +// ** the 2-digit day which is the last integer in the set. +// ** +// ** The function returns the number of successful conversions. +// */ +func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r int32) { + var N, min, nextC, v1 int8 + var ap Tva_list + var cnt, val int32 + var max Tu16 + _, _, _, _, _, _, _, _ = N, ap, cnt, max, min, nextC, val, v1 + cnt = 0 + ap = va + for cond := true; cond; cond = nextC != 0 { + N = int8(int32(*(*int8)(unsafe.Pointer(zFormat))) - int32('0')) + min = int8(int32(*(*int8)(unsafe.Pointer(zFormat + 1))) - int32('0')) + val = 0 + max = _aMx[int32(*(*int8)(unsafe.Pointer(zFormat + 2)))-int32('a')] + nextC = *(*int8)(unsafe.Pointer(zFormat + 3)) + val = 0 + for { + v1 = N + N-- + if !(v1 != 0) { + break + } + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&libc.Int32FromInt32(0x04) != 0) { + goto end_getDigits + } + val = val*int32(10) + int32(*(*int8)(unsafe.Pointer(zDate))) - int32('0') + zDate++ + } + if val < int32(min) || val > int32(max) || int32(nextC) != 0 && int32(nextC) != int32(*(*int8)(unsafe.Pointer(zDate))) { + goto end_getDigits + } + *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = val + zDate++ + cnt++ + zFormat += uintptr(4) + } +end_getDigits: + ; + _ = ap + return cnt +} + +/* The aMx[] array translates the 3rd character of each format + ** spec into a max size: a b c d e f */ +var _aMx = [6]Tu16{ + 0: uint16(12), + 1: uint16(14), + 2: uint16(24), + 3: uint16(31), + 4: uint16(59), + 5: uint16(14712), +} + +// C documentation +// +// /* +// ** Parse a timezone extension on the end of a date-time. +// ** The extension is of the form: +// ** +// ** (+/-)HH:MM +// ** +// ** Or the "zulu" notation: +// ** +// ** Z +// ** +// ** If the parse is successful, write the number of minutes +// ** of change in p->tz and return 0. If a parser error occurs, +// ** return non-zero. +// ** +// ** A missing specifier is not considered an error. +// */ +func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var c, sgn int32 + var _ /* nHr at bp+0 */ int32 + var _ /* nMn at bp+4 */ int32 + _, _ = c, sgn + sgn = 0 + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { + zDate++ + } + (*TDateTime)(unsafe.Pointer(p)).Ftz = 0 + c = int32(*(*int8)(unsafe.Pointer(zDate))) + if c == int32('-') { + sgn = -int32(1) + } else { + if c == int32('+') { + sgn = +libc.Int32FromInt32(1) + } else { + if c == int32('Z') || c == int32('z') { + zDate++ + goto zulu_time + } else { + return libc.BoolInt32(c != 0) + } + } + } + zDate++ + if _getDigits(tls, zDate, __ccgo_ts+1186, libc.VaList(bp+16, bp, bp+4)) != int32(2) { + return int32(1) + } + zDate += uintptr(5) + (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (*(*int32)(unsafe.Pointer(bp + 4)) + *(*int32)(unsafe.Pointer(bp))*int32(60)) +zulu_time: + ; + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 { + zDate++ + } + (*TDateTime)(unsafe.Pointer(p)).FtzSet = int8(1) + return libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zDate))) != 0) +} + +// C documentation +// +// /* +// ** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. +// ** The HH, MM, and SS must each be exactly 2 digits. The +// ** fractional seconds FFFF can be one or more digits. +// ** +// ** Return 1 if there is a parsing error and 0 on success. +// */ +func _parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var ms, rScale float64 + var v1 int32 + var _ /* h at bp+0 */ int32 + var _ /* m at bp+4 */ int32 + var _ /* s at bp+8 */ int32 + _, _, _ = ms, rScale, v1 + ms = float64(0) + if _getDigits(tls, zDate, __ccgo_ts+1194, libc.VaList(bp+24, bp, bp+4)) != int32(2) { + return int32(1) + } + zDate += uintptr(5) + if int32(*(*int8)(unsafe.Pointer(zDate))) == int32(':') { + zDate++ + if _getDigits(tls, zDate, __ccgo_ts+1202, libc.VaList(bp+24, bp+8)) != int32(1) { + return int32(1) + } + zDate += uintptr(2) + if int32(*(*int8)(unsafe.Pointer(zDate))) == int32('.') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate + 1)))])&int32(0x04) != 0 { + rScale = float64(1) + zDate++ + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x04) != 0 { + ms = ms*float64(10) + float64(*(*int8)(unsafe.Pointer(zDate))) - libc.Float64FromUint8('0') + rScale *= float64(10) + zDate++ + } + ms /= rScale + } + } else { + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + } + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) + (*TDateTime)(unsafe.Pointer(p)).Fh = *(*int32)(unsafe.Pointer(bp)) + (*TDateTime)(unsafe.Pointer(p)).Fm = *(*int32)(unsafe.Pointer(bp + 4)) + (*TDateTime)(unsafe.Pointer(p)).Fs = float64(*(*int32)(unsafe.Pointer(bp + 8))) + ms + if _parseTimezone(tls, zDate, p) != 0 { + return int32(1) + } + if (*TDateTime)(unsafe.Pointer(p)).Ftz != 0 { + v1 = int32(1) + } else { + v1 = 0 + } + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = int8(v1) + return 0 +} + +// C documentation +// +// /* +// ** Put the DateTime object into its error state. +// */ +func _datetimeError(tls *libc.TLS, p uintptr) { + libc.Xmemset(tls, p, 0, uint64(48)) + (*TDateTime)(unsafe.Pointer(p)).FisError = int8(1) +} + +// C documentation +// +// /* +// ** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume +// ** that the YYYY-MM-DD is according to the Gregorian calendar. +// ** +// ** Reference: Meeus page 61 +// */ +func _computeJD(tls *libc.TLS, p uintptr) { + var A, B, D, M, X1, X2, Y int32 + _, _, _, _, _, _, _ = A, B, D, M, X1, X2, Y + if (*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0 { + return + } + if (*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0 { + Y = (*TDateTime)(unsafe.Pointer(p)).FY + M = (*TDateTime)(unsafe.Pointer(p)).FM + D = (*TDateTime)(unsafe.Pointer(p)).FD + } else { + Y = int32(2000) /* If no YMD specified, assume 2000-Jan-01 */ + M = int32(1) + D = int32(1) + } + if Y < -int32(4713) || Y > int32(9999) || (*TDateTime)(unsafe.Pointer(p)).FrawS != 0 { + _datetimeError(tls, p) + return + } + if M <= int32(2) { + Y-- + M += int32(12) + } + A = Y / int32(100) + B = int32(2) - A + A/int32(4) + X1 = int32(36525) * (Y + int32(4716)) / int32(100) + X2 = int32(306001) * (M + int32(1)) / int32(10000) + (*TDateTime)(unsafe.Pointer(p)).FiJD = int64((float64(X1+X2+D+B) - libc.Float64FromFloat64(1524.5)) * libc.Float64FromInt32(86400000)) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + if (*TDateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(p)) += int64((*TDateTime)(unsafe.Pointer(p)).Fh*int32(3600000)+(*TDateTime)(unsafe.Pointer(p)).Fm*int32(60000)) + int64((*TDateTime)(unsafe.Pointer(p)).Fs*libc.Float64FromInt32(1000)+libc.Float64FromFloat64(0.5)) + if (*TDateTime)(unsafe.Pointer(p)).FvalidTZ != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(p)) -= int64((*TDateTime)(unsafe.Pointer(p)).Ftz * int32(60000)) + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 + } + } +} + +// C documentation +// +// /* +// ** Parse dates of the form +// ** +// ** YYYY-MM-DD HH:MM:SS.FFF +// ** YYYY-MM-DD HH:MM:SS +// ** YYYY-MM-DD HH:MM +// ** YYYY-MM-DD +// ** +// ** Write the result into the DateTime structure and return 0 +// ** on success and 1 if the input string is not a well-formed +// ** date. +// */ +func _parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var neg, v1 int32 + var _ /* D at bp+8 */ int32 + var _ /* M at bp+4 */ int32 + var _ /* Y at bp+0 */ int32 + _, _ = neg, v1 + if int32(*(*int8)(unsafe.Pointer(zDate))) == int32('-') { + zDate++ + neg = int32(1) + } else { + neg = 0 + } + if _getDigits(tls, zDate, __ccgo_ts+1206, libc.VaList(bp+24, bp, bp+4, bp+8)) != int32(3) { + return int32(1) + } + zDate += uintptr(10) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))])&int32(0x01) != 0 || int32('T') == int32(*(*Tu8)(unsafe.Pointer(zDate))) { + zDate++ + } + if _parseHhMmSs(tls, zDate, p) == 0 { + /* We got the time */ + } else { + if int32(*(*int8)(unsafe.Pointer(zDate))) == 0 { + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 0 + } else { + return int32(1) + } + } + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) + if neg != 0 { + v1 = -*(*int32)(unsafe.Pointer(bp)) + } else { + v1 = *(*int32)(unsafe.Pointer(bp)) + } + (*TDateTime)(unsafe.Pointer(p)).FY = v1 + (*TDateTime)(unsafe.Pointer(p)).FM = *(*int32)(unsafe.Pointer(bp + 4)) + (*TDateTime)(unsafe.Pointer(p)).FD = *(*int32)(unsafe.Pointer(bp + 8)) + if (*TDateTime)(unsafe.Pointer(p)).FvalidTZ != 0 { + _computeJD(tls, p) + } + return 0 +} + +// C documentation +// +// /* +// ** Set the time to the current time reported by the VFS. +// ** +// ** Return the number of errors. +// */ +func _setDateTimeToCurrent(tls *libc.TLS, context uintptr, p uintptr) (r int32) { + (*TDateTime)(unsafe.Pointer(p)).FiJD = _sqlite3StmtCurrentTime(tls, context) + if (*TDateTime)(unsafe.Pointer(p)).FiJD > 0 { + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + return 0 + } else { + return int32(1) + } + return r +} + +// C documentation +// +// /* +// ** Input "r" is a numeric quantity which might be a julian day number, +// ** or the number of seconds since 1970. If the value if r is within +// ** range of a julian day number, install it as such and set validJD. +// ** If the value is a valid unix timestamp, put it in p->s and set p->rawS. +// */ +func _setRawDateNumber(tls *libc.TLS, p uintptr, r float64) { + (*TDateTime)(unsafe.Pointer(p)).Fs = r + (*TDateTime)(unsafe.Pointer(p)).FrawS = int8(1) + if r >= float64(0) && r < float64(5.3734845e+06) { + (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(r*libc.Float64FromFloat64(8.64e+07) + libc.Float64FromFloat64(0.5)) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + } +} + +// C documentation +// +// /* +// ** Attempt to parse the given string into a julian day number. Return +// ** the number of errors. +// ** +// ** The following are acceptable forms for the input string: +// ** +// ** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM +// ** DDDD.DD +// ** now +// ** +// ** In the first form, the +/-HH:MM is always optional. The fractional +// ** seconds extension (the ".FFF") is optional. The seconds portion +// ** (":SS.FFF") is option. The year and date can be omitted as long +// ** as there is a time string. The time string can be omitted as long +// ** as there is a year and date. +// */ +func _parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* r at bp+0 */ float64 + if _parseYyyyMmDd(tls, zDate, p) == 0 { + return 0 + } else { + if _parseHhMmSs(tls, zDate, p) == 0 { + return 0 + } else { + if _sqlite3StrICmp(tls, zDate, __ccgo_ts+1218) == 0 && _sqlite3NotPureFunc(tls, context) != 0 { + return _setDateTimeToCurrent(tls, context, p) + } else { + if _sqlite3AtoF(tls, zDate, bp, _sqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { + _setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp))) + return 0 + } else { + if (_sqlite3StrICmp(tls, zDate, __ccgo_ts+1222) == 0 || _sqlite3StrICmp(tls, zDate, __ccgo_ts+1229) == 0) && _sqlite3NotPureFunc(tls, context) != 0 { + (*TDateTime)(unsafe.Pointer(p)).FuseSubsec = int8(1) + return _setDateTimeToCurrent(tls, context, p) + } + } + } + } + } + return int32(1) +} + +/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999. +** Multiplying this by 86400000 gives 464269060799999 as the maximum value +** for DateTime.iJD. +** +** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with +** such a large integer literal, so we have to encode it. + */ + +// C documentation +// +// /* +// ** Return TRUE if the given julian day number is within range. +// ** +// ** The input is the JulianDay times 86400000. +// */ +func _validJulianDay(tls *libc.TLS, iJD Tsqlite3_int64) (r int32) { + return libc.BoolInt32(iJD >= 0 && iJD <= libc.Int64FromInt32(0x1a640)< int32(2) { + v2 = C - int32(4716) + } else { + v2 = C - int32(4715) + } + (*TDateTime)(unsafe.Pointer(p)).FY = v2 + } + } + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) +} + +// C documentation +// +// /* +// ** Compute the Hour, Minute, and Seconds from the julian day number. +// */ +func _computeHMS(tls *libc.TLS, p uintptr) { + var day_min, day_ms int32 + _, _ = day_min, day_ms /* milliseconds, minutes into the day */ + if (*TDateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { + return + } + _computeJD(tls, p) + day_ms = int32(((*TDateTime)(unsafe.Pointer(p)).FiJD + libc.Int64FromInt32(43200000)) % libc.Int64FromInt32(86400000)) + (*TDateTime)(unsafe.Pointer(p)).Fs = float64(day_ms%libc.Int32FromInt32(60000)) / float64(1000) + day_min = day_ms / int32(60000) + (*TDateTime)(unsafe.Pointer(p)).Fm = day_min % int32(60) + (*TDateTime)(unsafe.Pointer(p)).Fh = day_min / int32(60) + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) +} + +// C documentation +// +// /* +// ** Compute both YMD and HMS +// */ +func _computeYMD_HMS(tls *libc.TLS, p uintptr) { + _computeYMD(tls, p) + _computeHMS(tls, p) +} + +// C documentation +// +// /* +// ** Clear the YMD and HMS and the TZ +// */ +func _clearYMD_HMS_TZ(tls *libc.TLS, p uintptr) { + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 +} + +/* +** On recent Windows platforms, the localtime_s() function is available +** as part of the "Secure CRT". It is essentially equivalent to +** localtime_r() available under most POSIX platforms, except that the +** order of the parameters is reversed. +** +** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. +** +** If the user has not indicated to use localtime_r() or localtime_s() +** already, check for an MSVC build environment that provides +** localtime_s(). + */ + +// C documentation +// +// /* +// ** The following routine implements the rough equivalent of localtime_r() +// ** using whatever operating-system specific localtime facility that +// ** is available. This routine returns 0 on success and +// ** non-zero on any kind of error. +// ** +// ** If the sqlite3GlobalConfig.bLocaltimeFault variable is non-zero then this +// ** routine will always fail. If bLocaltimeFault is nonzero and +// ** sqlite3GlobalConfig.xAltLocaltime is not NULL, then xAltLocaltime() is +// ** invoked in place of the OS-defined localtime() function. +// ** +// ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C +// ** library function localtime_r() is used to assist in the calculation of +// ** local time. +// */ +func _osLocaltime(tls *libc.TLS, t uintptr, pTm uintptr) (r int32) { + var mutex, pX uintptr + var rc int32 + _, _, _ = mutex, pX, rc + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + pX = libc.Xlocaltime(tls, t) + if _sqlite3Config.FbLocaltimeFault != 0 { + if _sqlite3Config.FxAltLocaltime != uintptr(0) && 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.FxAltLocaltime})))(tls, t, pTm) { + pX = pTm + } else { + pX = uintptr(0) + } + } + if pX != 0 { + *(*Ttm)(unsafe.Pointer(pTm)) = *(*Ttm)(unsafe.Pointer(pX)) + } + Xsqlite3_mutex_leave(tls, mutex) + rc = libc.BoolInt32(pX == uintptr(0)) + return rc +} + +// C documentation +// +// /* +// ** Assuming the input DateTime is UTC, move it to its localtime equivalent. +// */ +func _toLocaltime(tls *libc.TLS, p uintptr, pCtx uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var iYearDiff int32 + var _ /* sLocal at bp+8 */ Ttm + var _ /* t at bp+0 */ Ttime_t + var _ /* x at bp+64 */ TDateTime + _ = iYearDiff + /* Initialize the contents of sLocal to avoid a compiler warning. */ + libc.Xmemset(tls, bp+8, 0, uint64(56)) + _computeJD(tls, p) + if (*TDateTime)(unsafe.Pointer(p)).FiJD < libc.Int64FromInt32(2108667600)*libc.Int64FromInt32(100000) || (*TDateTime)(unsafe.Pointer(p)).FiJD > libc.Int64FromInt32(2130141456)*libc.Int64FromInt32(100000) { + /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only + ** works for years between 1970 and 2037. For dates outside this range, + ** SQLite attempts to map the year into an equivalent year within this + ** range, do the calculation, then map the year back. + */ + *(*TDateTime)(unsafe.Pointer(bp + 64)) = *(*TDateTime)(unsafe.Pointer(p)) + _computeYMD_HMS(tls, bp+64) + iYearDiff = int32(2000) + (*(*TDateTime)(unsafe.Pointer(bp + 64))).FY%int32(4) - (*(*TDateTime)(unsafe.Pointer(bp + 64))).FY + (*(*TDateTime)(unsafe.Pointer(bp + 64))).FY += iYearDiff + (*(*TDateTime)(unsafe.Pointer(bp + 64))).FvalidJD = 0 + _computeJD(tls, bp+64) + *(*Ttime_t)(unsafe.Pointer(bp)) = (*(*TDateTime)(unsafe.Pointer(bp + 64))).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) + } else { + iYearDiff = 0 + *(*Ttime_t)(unsafe.Pointer(bp)) = (*TDateTime)(unsafe.Pointer(p)).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) + } + if _osLocaltime(tls, bp, bp+8) != 0 { + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+1239, -int32(1)) + return int32(SQLITE_ERROR) + } + (*TDateTime)(unsafe.Pointer(p)).FY = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_year + int32(1900) - iYearDiff + (*TDateTime)(unsafe.Pointer(p)).FM = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_mon + int32(1) + (*TDateTime)(unsafe.Pointer(p)).FD = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_mday + (*TDateTime)(unsafe.Pointer(p)).Fh = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_hour + (*TDateTime)(unsafe.Pointer(p)).Fm = (*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_min + (*TDateTime)(unsafe.Pointer(p)).Fs = float64((*(*Ttm)(unsafe.Pointer(bp + 8))).Ftm_sec) + float64((*TDateTime)(unsafe.Pointer(p)).FiJD%libc.Int64FromInt32(1000))*float64(0.001) + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 + (*TDateTime)(unsafe.Pointer(p)).FisError = 0 + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The following table defines various date transformations of the form +// ** +// ** 'NNN days' +// ** +// ** Where NNN is an arbitrary floating-point number and "days" can be one +// ** of several units of time. +// */ +var _aXformType = [6]struct { + FnName Tu8 + FzName [7]int8 + FrLimit float32 + FrXform float32 +}{ + 0: { + FnName: uint8(6), + FzName: [7]int8{'s', 'e', 'c', 'o', 'n', 'd'}, + FrLimit: float32(4.6427e+14), + FrXform: float32(1), + }, + 1: { + FnName: uint8(6), + FzName: [7]int8{'m', 'i', 'n', 'u', 't', 'e'}, + FrLimit: float32(7.7379e+12), + FrXform: float32(60), + }, + 2: { + FnName: uint8(4), + FzName: [7]int8{'h', 'o', 'u', 'r'}, + FrLimit: float32(1.2897e+11), + FrXform: float32(3600), + }, + 3: { + FnName: uint8(3), + FzName: [7]int8{'d', 'a', 'y'}, + FrLimit: float32(5.373485e+06), + FrXform: float32(86400), + }, + 4: { + FnName: uint8(5), + FzName: [7]int8{'m', 'o', 'n', 't', 'h'}, + FrLimit: float32(176546), + FrXform: float32(2.592e+06), + }, + 5: { + FnName: uint8(4), + FzName: [7]int8{'y', 'e', 'a', 'r'}, + FrLimit: float32(14713), + FrXform: float32(3.1536e+07), + }, +} + +// C documentation +// +// /* +// ** If the DateTime p is raw number, try to figure out if it is +// ** a julian day number of a unix timestamp. Set the p value +// ** appropriately. +// */ +func _autoAdjustDate(tls *libc.TLS, p uintptr) { + var r float64 + _ = r + if !((*TDateTime)(unsafe.Pointer(p)).FrawS != 0) || (*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0 { + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + } else { + if (*TDateTime)(unsafe.Pointer(p)).Fs >= float64(int64(-libc.Int32FromInt32(21086676))*libc.Int64FromInt32(10000)) && (*TDateTime)(unsafe.Pointer(p)).Fs <= float64(libc.Int64FromInt32(25340230)*libc.Int64FromInt32(10000)+libc.Int64FromInt32(799)) { + r = (*TDateTime)(unsafe.Pointer(p)).Fs*float64(1000) + float64(2.1086676e+14) + _clearYMD_HMS_TZ(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(r + libc.Float64FromFloat64(0.5)) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + } + } +} + +// C documentation +// +// /* +// ** Process a modifier to a date-time stamp. The modifiers are +// ** as follows: +// ** +// ** NNN days +// ** NNN hours +// ** NNN minutes +// ** NNN.NNNN seconds +// ** NNN months +// ** NNN years +// ** start of month +// ** start of year +// ** start of week +// ** start of day +// ** weekday N +// ** unixepoch +// ** localtime +// ** utc +// ** +// ** Return 0 on success and 1 if there is any kind of error. If the error +// ** is in a system call (i.e. localtime()), then an error message is written +// ** to context pCtx. If the error is an unrecognized modifier, no error is +// ** written to pCtx. +// */ +func _parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr, idx int32) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var Z, day Tsqlite3_int64 + var cnt, i, rc, x, y, v12, v2, v5, v7, v9 int32 + var iErr, iGuess, iOrigJD, v1 Ti64 + var rRounder, v10 float64 + var z0 int8 + var z2 uintptr + var v3, v6 bool + var _ /* D at bp+64 */ int32 + var _ /* M at bp+60 */ int32 + var _ /* Y at bp+56 */ int32 + var _ /* h at bp+68 */ int32 + var _ /* m at bp+72 */ int32 + var _ /* new at bp+8 */ TDateTime + var _ /* r at bp+0 */ float64 + var _ /* tx at bp+80 */ TDateTime + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Z, cnt, day, i, iErr, iGuess, iOrigJD, rRounder, rc, x, y, z0, z2, v1, v10, v12, v2, v3, v5, v6, v7, v9 + rc = int32(1) + switch int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))]) { + case int32('a'): + /* + ** auto + ** + ** If rawS is available, then interpret as a julian day number, or + ** a unix timestamp, depending on its magnitude. + */ + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1262) == 0 { + if idx > int32(1) { + return int32(1) + } /* IMP: R-33611-57934 */ + _autoAdjustDate(tls, p) + rc = 0 + } + case int32('j'): + /* + ** julianday + ** + ** Always interpret the prior number as a julian-day value. If this + ** is not the first modifier, or if the prior argument is not a numeric + ** value in the allowed range of julian day numbers understood by + ** SQLite (0..5373484.5) then the result will be NULL. + */ + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1267) == 0 { + if idx > int32(1) { + return int32(1) + } /* IMP: R-31176-64601 */ + if (*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0 && (*TDateTime)(unsafe.Pointer(p)).FrawS != 0 { + rc = 0 + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + } + } + case int32('l'): + /* localtime + ** + ** Assuming the current time value is UTC (a.k.a. GMT), shift it to + ** show local time. + */ + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1277) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { + rc = _toLocaltime(tls, p, pCtx) + } + case int32('u'): + /* + ** unixepoch + ** + ** Treat the current value of p->s as the number of + ** seconds since 1970. Convert to a real julian day number. + */ + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1287) == 0 && (*TDateTime)(unsafe.Pointer(p)).FrawS != 0 { + if idx > int32(1) { + return int32(1) + } /* IMP: R-49255-55373 */ + *(*float64)(unsafe.Pointer(bp)) = (*TDateTime)(unsafe.Pointer(p)).Fs*float64(1000) + float64(2.1086676e+14) + if *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(4.642690608e+14) { + _clearYMD_HMS_TZ(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(*(*float64)(unsafe.Pointer(bp)) + libc.Float64FromFloat64(0.5)) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + rc = 0 + } + } else { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1297) == 0 && _sqlite3NotPureFunc(tls, pCtx) != 0 { + if int32((*TDateTime)(unsafe.Pointer(p)).FtzSet) == 0 { /* Guess at the corresponding utc time */ + cnt = 0 /* Guess is off by this much */ + _computeJD(tls, p) + v1 = (*TDateTime)(unsafe.Pointer(p)).FiJD + iOrigJD = v1 + iGuess = v1 + iErr = 0 + for { + libc.Xmemset(tls, bp+8, 0, uint64(48)) + iGuess -= iErr + (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD = iGuess + (*(*TDateTime)(unsafe.Pointer(bp + 8))).FvalidJD = int8(1) + rc = _toLocaltime(tls, bp+8, pCtx) + if rc != 0 { + return rc + } + _computeJD(tls, bp+8) + iErr = (*(*TDateTime)(unsafe.Pointer(bp + 8))).FiJD - iOrigJD + goto _4 + _4: + ; + if v3 = iErr != 0; v3 { + v2 = cnt + cnt++ + } + if !(v3 && v2 < int32(3)) { + break + } + } + libc.Xmemset(tls, p, 0, uint64(48)) + (*TDateTime)(unsafe.Pointer(p)).FiJD = iGuess + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + (*TDateTime)(unsafe.Pointer(p)).FtzSet = int8(1) + } + rc = SQLITE_OK + } + } + case int32('w'): + /* + ** weekday N + ** + ** Move the date to the same time on the next occurrence of + ** weekday N where 0==Sunday, 1==Monday, and so forth. If the + ** date is already on the appropriate weekday, this is a no-op. + */ + if v6 = Xsqlite3_strnicmp(tls, z, __ccgo_ts+1301, int32(8)) == 0 && _sqlite3AtoF(tls, z+8, bp, _sqlite3Strlen30(tls, z+8), uint8(SQLITE_UTF8)) > 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp)) < float64(7); v6 { + v5 = int32(*(*float64)(unsafe.Pointer(bp))) + n = v5 + } + if v6 && float64(v5) == *(*float64)(unsafe.Pointer(bp)) { + _computeYMD_HMS(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + _computeJD(tls, p) + Z = ((*TDateTime)(unsafe.Pointer(p)).FiJD + int64(129600000)) / int64(86400000) % int64(7) + if Z > int64(n) { + Z -= int64(7) + } + *(*Tsqlite3_int64)(unsafe.Pointer(p)) += (int64(n) - Z) * int64(86400000) + _clearYMD_HMS_TZ(tls, p) + rc = 0 + } + case int32('s'): + /* + ** start of TTTTT + ** + ** Move the date backwards to the beginning of the current day, + ** or month or year. + ** + ** subsecond + ** subsec + ** + ** Show subsecond precision in the output of datetime() and + ** unixepoch() and strftime('%s'). + */ + if Xsqlite3_strnicmp(tls, z, __ccgo_ts+1310, int32(9)) != 0 { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1222) == 0 || Xsqlite3_stricmp(tls, z, __ccgo_ts+1229) == 0 { + (*TDateTime)(unsafe.Pointer(p)).FuseSubsec = int8(1) + rc = 0 + } + break + } + if !((*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0) && !((*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0) && !((*TDateTime)(unsafe.Pointer(p)).FvalidHMS != 0) { + break + } + z += uintptr(9) + _computeYMD(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) + v7 = libc.Int32FromInt32(0) + (*TDateTime)(unsafe.Pointer(p)).Fm = v7 + (*TDateTime)(unsafe.Pointer(p)).Fh = v7 + (*TDateTime)(unsafe.Pointer(p)).Fs = float64(0) + (*TDateTime)(unsafe.Pointer(p)).FrawS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidTZ = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1320) == 0 { + (*TDateTime)(unsafe.Pointer(p)).FD = int32(1) + rc = 0 + } else { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1326) == 0 { + (*TDateTime)(unsafe.Pointer(p)).FM = int32(1) + (*TDateTime)(unsafe.Pointer(p)).FD = int32(1) + rc = 0 + } else { + if Xsqlite3_stricmp(tls, z, __ccgo_ts+1331) == 0 { + rc = 0 + } + } + } + case int32('+'): + fallthrough + case int32('-'): + fallthrough + case int32('0'): + fallthrough + case int32('1'): + fallthrough + case int32('2'): + fallthrough + case int32('3'): + fallthrough + case int32('4'): + fallthrough + case int32('5'): + fallthrough + case int32('6'): + fallthrough + case int32('7'): + fallthrough + case int32('8'): + fallthrough + case int32('9'): + z2 = z + z0 = *(*int8)(unsafe.Pointer(z)) + n = int32(1) + for { + if !(*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32(':') { + break + } + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n))))])&int32(0x01) != 0 { + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('-') { + if n == int32(5) && _getDigits(tls, z+1, __ccgo_ts+1335, libc.VaList(bp+136, bp+56)) == int32(1) { + break + } + if n == int32(6) && _getDigits(tls, z+1, __ccgo_ts+1339, libc.VaList(bp+136, bp+56)) == int32(1) { + break + } + } + goto _8 + _8: + ; + n++ + } + if _sqlite3AtoF(tls, z, bp, n, uint8(SQLITE_UTF8)) <= 0 { + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('-') { + /* A modifier of the form (+|-)YYYY-MM-DD adds or subtracts the + ** specified number of years, months, and days. MM is limited to + ** the range 0-11 and DD is limited to 0-30. + */ + if int32(z0) != int32('+') && int32(z0) != int32('-') { + break + } /* Must start with +/- */ + if n == int32(5) { + if _getDigits(tls, z+1, __ccgo_ts+1343, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { + break + } + } else { + if _getDigits(tls, z+1, __ccgo_ts+1355, libc.VaList(bp+136, bp+56, bp+60, bp+64)) != int32(3) { + break + } + z++ + } + if *(*int32)(unsafe.Pointer(bp + 60)) >= int32(12) { + break + } /* M range 0..11 */ + if *(*int32)(unsafe.Pointer(bp + 64)) >= int32(31) { + break + } /* D range 0..30 */ + _computeYMD_HMS(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + if int32(z0) == int32('-') { + *(*int32)(unsafe.Pointer(p + 8)) -= *(*int32)(unsafe.Pointer(bp + 56)) + *(*int32)(unsafe.Pointer(p + 12)) -= *(*int32)(unsafe.Pointer(bp + 60)) + *(*int32)(unsafe.Pointer(bp + 64)) = -*(*int32)(unsafe.Pointer(bp + 64)) + } else { + *(*int32)(unsafe.Pointer(p + 8)) += *(*int32)(unsafe.Pointer(bp + 56)) + *(*int32)(unsafe.Pointer(p + 12)) += *(*int32)(unsafe.Pointer(bp + 60)) + } + if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { + v9 = ((*TDateTime)(unsafe.Pointer(p)).FM - int32(1)) / int32(12) + } else { + v9 = ((*TDateTime)(unsafe.Pointer(p)).FM - int32(12)) / int32(12) + } + x = v9 + *(*int32)(unsafe.Pointer(p + 8)) += x + *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) + _computeJD(tls, p) + (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 0 + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 + *(*Tsqlite3_int64)(unsafe.Pointer(p)) += int64(*(*int32)(unsafe.Pointer(bp + 64))) * int64(86400000) + if int32(*(*int8)(unsafe.Pointer(z + 11))) == 0 { + rc = 0 + break + } + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + 11)))])&int32(0x01) != 0 && _getDigits(tls, z+12, __ccgo_ts+1194, libc.VaList(bp+136, bp+68, bp+72)) == int32(2) { + z2 = z + 12 + n = int32(2) + } else { + break + } + } + if int32(*(*int8)(unsafe.Pointer(z2 + uintptr(n)))) == int32(':') { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2)))])&libc.Int32FromInt32(0x04) != 0) { + z2++ + } + libc.Xmemset(tls, bp+80, 0, uint64(48)) + if _parseHhMmSs(tls, z2, bp+80) != 0 { + break + } + _computeJD(tls, bp+80) + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD -= int64(43200000) + day = (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD / int64(86400000) + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD -= day * int64(86400000) + if int32(z0) == int32('-') { + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD = -(*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD + } + _computeJD(tls, p) + _clearYMD_HMS_TZ(tls, p) + *(*Tsqlite3_int64)(unsafe.Pointer(p)) += (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD + rc = 0 + break + } + /* If control reaches this point, it means the transformation is + ** one of the forms like "+NNN days". */ + z += uintptr(n) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x01) != 0 { + z++ + } + n = _sqlite3Strlen30(tls, z) + if n > int32(10) || n < int32(3) { + break + } + if int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n-int32(1)))))]) == int32('s') { + n-- + } + _computeJD(tls, p) + if *(*float64)(unsafe.Pointer(bp)) < libc.Float64FromInt32(0) { + v10 = -libc.Float64FromFloat64(0.5) + } else { + v10 = +libc.Float64FromFloat64(0.5) + } + rRounder = v10 + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(96)/libc.Uint64FromInt64(16))) { + break + } + if int32(_aXformType[i].FnName) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_aXformType))+uintptr(i)*16+1, z, n) == 0 && *(*float64)(unsafe.Pointer(bp)) > float64(-_aXformType[i].FrLimit) && *(*float64)(unsafe.Pointer(bp)) < float64(_aXformType[i].FrLimit) { + switch i { + case int32(4): /* Special processing to add months */ + _computeYMD_HMS(tls, p) + *(*int32)(unsafe.Pointer(p + 12)) += int32(*(*float64)(unsafe.Pointer(bp))) + if (*TDateTime)(unsafe.Pointer(p)).FM > 0 { + v12 = ((*TDateTime)(unsafe.Pointer(p)).FM - int32(1)) / int32(12) + } else { + v12 = ((*TDateTime)(unsafe.Pointer(p)).FM - int32(12)) / int32(12) + } + x = v12 + *(*int32)(unsafe.Pointer(p + 8)) += x + *(*int32)(unsafe.Pointer(p + 12)) -= x * int32(12) + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) + case int32(5): /* Special processing to add years */ + y = int32(*(*float64)(unsafe.Pointer(bp))) + _computeYMD_HMS(tls, p) + *(*int32)(unsafe.Pointer(p + 8)) += y + (*TDateTime)(unsafe.Pointer(p)).FvalidJD = 0 + *(*float64)(unsafe.Pointer(bp)) -= float64(int32(*(*float64)(unsafe.Pointer(bp)))) + break + } + _computeJD(tls, p) + *(*Tsqlite3_int64)(unsafe.Pointer(p)) += int64(*(*float64)(unsafe.Pointer(bp))*libc.Float64FromFloat64(1000)*float64(_aXformType[i].FrXform) + rRounder) + rc = 0 + break + } + goto _11 + _11: + ; + i++ + } + _clearYMD_HMS_TZ(tls, p) + default: + break + } + return rc +} + +// C documentation +// +// /* +// ** Process time function arguments. argv[0] is a date-time stamp. +// ** argv[1] and following are modifiers. Parse them all and write +// ** the resulting time into the DateTime structure p. Return 0 +// ** on success and 1 if there are any errors. +// ** +// ** If there are zero parameters (if even argv[0] is undefined) +// ** then assume a default value of "now" for argv[0]. +// */ +func _isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr) (r int32) { + var eType, i, n, v1 int32 + var z uintptr + _, _, _, _, _ = eType, i, n, z, v1 + libc.Xmemset(tls, p, 0, uint64(48)) + if argc == 0 { + if !(_sqlite3NotPureFunc(tls, context) != 0) { + return int32(1) + } + return _setDateTimeToCurrent(tls, context, p) + } + v1 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + eType = v1 + if v1 == int32(SQLITE_FLOAT) || eType == int32(SQLITE_INTEGER) { + _setRawDateNumber(tls, p, Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } else { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if !(z != 0) || _parseDateOrTime(tls, context, z, p) != 0 { + return int32(1) + } + } + i = int32(1) + for { + if !(i < argc) { + break + } + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if z == uintptr(0) || _parseModifier(tls, context, z, n, p, i) != 0 { + return int32(1) + } + goto _2 + _2: + ; + i++ + } + _computeJD(tls, p) + if (*TDateTime)(unsafe.Pointer(p)).FisError != 0 || !(_validJulianDay(tls, (*TDateTime)(unsafe.Pointer(p)).FiJD) != 0) { + return int32(1) + } + if argc == int32(1) && (*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0 && (*TDateTime)(unsafe.Pointer(p)).FD > int32(28) { + /* Make sure a YYYY-MM-DD is normalized. + ** Example: 2023-02-31 -> 2023-03-03 */ + (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 + } + return 0 +} + +/* +** The following routines implement the various date and time functions +** of SQLite. + */ + +// C documentation +// +// /* +// ** julianday( TIMESTRING, MOD, MOD, ...) +// ** +// ** Return the julian day number of the date specified in the arguments +// */ +func _juliandayFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* x at bp+0 */ TDateTime + if _isDate(tls, context, argc, argv, bp) == 0 { + _computeJD(tls, bp) + Xsqlite3_result_double(tls, context, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD)/float64(8.64e+07)) + } +} + +// C documentation +// +// /* +// ** unixepoch( TIMESTRING, MOD, MOD, ...) +// ** +// ** Return the number of seconds (including fractional seconds) since +// ** the unix epoch of 1970-01-01 00:00:00 GMT. +// */ +func _unixepochFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* x at bp+0 */ TDateTime + if _isDate(tls, context, argc, argv, bp) == 0 { + _computeJD(tls, bp) + if (*(*TDateTime)(unsafe.Pointer(bp))).FuseSubsec != 0 { + Xsqlite3_result_double(tls, context, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000000))/float64(1000)) + } else { + Xsqlite3_result_int64(tls, context, (*(*TDateTime)(unsafe.Pointer(bp))).FiJD/int64(1000)-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000)) + } + } +} + +// C documentation +// +// /* +// ** datetime( TIMESTRING, MOD, MOD, ...) +// ** +// ** Return YYYY-MM-DD HH:MM:SS +// */ +func _datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var Y, n, s int32 + var _ /* x at bp+0 */ TDateTime + var _ /* zBuf at bp+48 */ [32]int8 + _, _, _ = Y, n, s + if _isDate(tls, context, argc, argv, bp) == 0 { + _computeYMD_HMS(tls, bp) + Y = (*(*TDateTime)(unsafe.Pointer(bp))).FY + if Y < 0 { + Y = -Y + } + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(1)] = int8(int32('0') + Y/int32(1000)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(2)] = int8(int32('0') + Y/int32(100)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(3)] = int8(int32('0') + Y/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(4)] = int8(int32('0') + Y%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(5)] = int8('-') + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(6)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FM/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(7)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FM%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(8)] = int8('-') + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(9)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FD/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(10)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FD%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(11)] = int8(' ') + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(12)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fh/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(13)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fh%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(14)] = int8(':') + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(15)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fm/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(16)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fm%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(17)] = int8(':') + if (*(*TDateTime)(unsafe.Pointer(bp))).FuseSubsec != 0 { + s = int32(libc.Float64FromFloat64(1000)*(*(*TDateTime)(unsafe.Pointer(bp))).Fs + libc.Float64FromFloat64(0.5)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(18)] = int8(int32('0') + s/int32(10000)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(19)] = int8(int32('0') + s/int32(1000)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(20)] = int8('.') + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(21)] = int8(int32('0') + s/int32(100)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(22)] = int8(int32('0') + s/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(23)] = int8(int32('0') + s%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(24)] = 0 + n = int32(24) + } else { + s = int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(18)] = int8(int32('0') + s/int32(10)%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(19)] = int8(int32('0') + s%int32(10)) + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[int32(20)] = 0 + n = int32(20) + } + if (*(*TDateTime)(unsafe.Pointer(bp))).FY < 0 { + (*(*[32]int8)(unsafe.Pointer(bp + 48)))[0] = int8('-') + Xsqlite3_result_text(tls, context, bp+48, n, uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_text(tls, context, bp+48+1, n-int32(1), uintptr(-libc.Int32FromInt32(1))) + } + } +} + +// C documentation +// +// /* +// ** time( TIMESTRING, MOD, MOD, ...) +// ** +// ** Return HH:MM:SS +// */ +func _timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var n, s int32 + var _ /* x at bp+0 */ TDateTime + var _ /* zBuf at bp+48 */ [16]int8 + _, _ = n, s + if _isDate(tls, context, argc, argv, bp) == 0 { + _computeHMS(tls, bp) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[0] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fh/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(1)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fh%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(2)] = int8(':') + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(3)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fm/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(4)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).Fm%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(5)] = int8(':') + if (*(*TDateTime)(unsafe.Pointer(bp))).FuseSubsec != 0 { + s = int32(libc.Float64FromFloat64(1000)*(*(*TDateTime)(unsafe.Pointer(bp))).Fs + libc.Float64FromFloat64(0.5)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(6)] = int8(int32('0') + s/int32(10000)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(7)] = int8(int32('0') + s/int32(1000)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(8)] = int8('.') + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(9)] = int8(int32('0') + s/int32(100)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(10)] = int8(int32('0') + s/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(11)] = int8(int32('0') + s%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(12)] = 0 + n = int32(12) + } else { + s = int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(6)] = int8(int32('0') + s/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(7)] = int8(int32('0') + s%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(8)] = 0 + n = int32(8) + } + Xsqlite3_result_text(tls, context, bp+48, n, uintptr(-libc.Int32FromInt32(1))) + } +} + +// C documentation +// +// /* +// ** date( TIMESTRING, MOD, MOD, ...) +// ** +// ** Return YYYY-MM-DD +// */ +func _dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var Y int32 + var _ /* x at bp+0 */ TDateTime + var _ /* zBuf at bp+48 */ [16]int8 + _ = Y + if _isDate(tls, context, argc, argv, bp) == 0 { + _computeYMD(tls, bp) + Y = (*(*TDateTime)(unsafe.Pointer(bp))).FY + if Y < 0 { + Y = -Y + } + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(1)] = int8(int32('0') + Y/int32(1000)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(2)] = int8(int32('0') + Y/int32(100)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(3)] = int8(int32('0') + Y/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(4)] = int8(int32('0') + Y%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(5)] = int8('-') + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(6)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FM/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(7)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FM%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(8)] = int8('-') + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(9)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FD/int32(10)%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(10)] = int8(int32('0') + (*(*TDateTime)(unsafe.Pointer(bp))).FD%int32(10)) + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[int32(11)] = 0 + if (*(*TDateTime)(unsafe.Pointer(bp))).FY < 0 { + (*(*[16]int8)(unsafe.Pointer(bp + 48)))[0] = int8('-') + Xsqlite3_result_text(tls, context, bp+48, int32(11), uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_text(tls, context, bp+48+1, int32(10), uintptr(-libc.Int32FromInt32(1))) + } + } +} + +// C documentation +// +// /* +// ** strftime( FORMAT, TIMESTRING, MOD, MOD, ...) +// ** +// ** Return a string described by FORMAT. Conversions as follows: +// ** +// ** %d day of month +// ** %f ** fractional seconds SS.SSS +// ** %H hour 00-24 +// ** %j day of year 000-366 +// ** %J ** julian day number +// ** %m month 01-12 +// ** %M minute 00-59 +// ** %s seconds since 1970-01-01 +// ** %S seconds 00-59 +// ** %w day of week 0-6 Sunday==0 +// ** %W week of year 00-53 +// ** %Y year 0000-9999 +// ** %% % +// */ +func _strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(160) + defer tls.Free(160) + var c, cf int8 + var db, zFmt, v3, v4, v5, v6, v7 uintptr + var h, nDay, wd int32 + var i, j, v2 Tsize_t + var iS Ti64 + var s float64 + var _ /* sRes at bp+48 */ Tsqlite3_str + var _ /* x at bp+0 */ TDateTime + var _ /* y at bp+80 */ TDateTime + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cf, db, h, i, iS, j, nDay, s, wd, zFmt, v2, v3, v4, v5, v6, v7 + if argc == 0 { + return + } + zFmt = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zFmt == uintptr(0) || _isDate(tls, context, argc-int32(1), argv+uintptr(1)*8, bp) != 0 { + return + } + db = Xsqlite3_context_db_handle(tls, context) + _sqlite3StrAccumInit(tls, bp+48, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(db + 136))) + _computeJD(tls, bp) + _computeYMD_HMS(tls, bp) + v2 = libc.Uint64FromInt32(0) + j = v2 + i = v2 + for { + if !(*(*int8)(unsafe.Pointer(zFmt + uintptr(i))) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) != int32('%') { + goto _1 + } + if j < i { + Xsqlite3_str_append(tls, bp+48, zFmt+uintptr(j), int32(i-j)) + } + i++ + j = i + uint64(1) + cf = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) + switch int32(cf) { + case int32('d'): /* Fall thru */ + fallthrough + case int32('e'): + if int32(cf) == int32('d') { + v3 = __ccgo_ts + 1367 + } else { + v3 = __ccgo_ts + 1372 + } + Xsqlite3_str_appendf(tls, bp+48, v3, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FD)) + case int32('f'): + s = (*(*TDateTime)(unsafe.Pointer(bp))).Fs + if s > float64(59.999) { + s = float64(59.999) + } + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1376, libc.VaList(bp+136, s)) + case int32('F'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1383, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY, (*(*TDateTime)(unsafe.Pointer(bp))).FM, (*(*TDateTime)(unsafe.Pointer(bp))).FD)) + case int32('H'): + fallthrough + case int32('k'): + if int32(cf) == int32('H') { + v4 = __ccgo_ts + 1367 + } else { + v4 = __ccgo_ts + 1372 + } + Xsqlite3_str_appendf(tls, bp+48, v4, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh)) + case int32('I'): /* Fall thru */ + fallthrough + case int32('l'): + h = (*(*TDateTime)(unsafe.Pointer(bp))).Fh + if h > int32(12) { + h -= int32(12) + } + if h == 0 { + h = int32(12) + } + if int32(cf) == int32('I') { + v5 = __ccgo_ts + 1367 + } else { + v5 = __ccgo_ts + 1372 + } + Xsqlite3_str_appendf(tls, bp+48, v5, libc.VaList(bp+136, h)) + case int32('W'): /* Fall thru */ + fallthrough + case int32('j'): /* Number of days since 1st day of year */ + *(*TDateTime)(unsafe.Pointer(bp + 80)) = *(*TDateTime)(unsafe.Pointer(bp)) + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FvalidJD = 0 + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FM = int32(1) + (*(*TDateTime)(unsafe.Pointer(bp + 80))).FD = int32(1) + _computeJD(tls, bp+80) + nDay = int32(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD - (*(*TDateTime)(unsafe.Pointer(bp + 80))).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000)) + if int32(cf) == int32('W') { /* 0=Monday, 1=Tuesday, ... 6=Sunday */ + wd = int32(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000) % libc.Int64FromInt32(7)) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1367, libc.VaList(bp+136, (nDay+int32(7)-wd)/int32(7))) + } else { + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1398, libc.VaList(bp+136, nDay+int32(1))) + } + case int32('J'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1403, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD)/float64(8.64e+07))) + case int32('m'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1367, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FM)) + case int32('M'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1367, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) + case int32('p'): /* Fall thru */ + fallthrough + case int32('P'): + if (*(*TDateTime)(unsafe.Pointer(bp))).Fh >= int32(12) { + if int32(cf) == int32('p') { + v6 = __ccgo_ts + 1409 + } else { + v6 = __ccgo_ts + 1412 + } + Xsqlite3_str_append(tls, bp+48, v6, int32(2)) + } else { + if int32(cf) == int32('p') { + v7 = __ccgo_ts + 1415 + } else { + v7 = __ccgo_ts + 1418 + } + Xsqlite3_str_append(tls, bp+48, v7, int32(2)) + } + case int32('R'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1421, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm)) + case int32('s'): + if (*(*TDateTime)(unsafe.Pointer(bp))).FuseSubsec != 0 { + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1431, libc.VaList(bp+136, float64((*(*TDateTime)(unsafe.Pointer(bp))).FiJD-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000000))/float64(1000))) + } else { + iS = (*(*TDateTime)(unsafe.Pointer(bp))).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1436, libc.VaList(bp+136, iS)) + } + case int32('S'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1367, libc.VaList(bp+136, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) + case int32('T'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1441, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, int32((*(*TDateTime)(unsafe.Pointer(bp))).Fs))) + case int32('u'): /* Fall thru */ + fallthrough + case int32('w'): + c = int8(int32(int8(((*(*TDateTime)(unsafe.Pointer(bp))).FiJD+libc.Int64FromInt32(129600000))/libc.Int64FromInt32(86400000)%libc.Int64FromInt32(7))) + int32('0')) + if int32(c) == int32('0') && int32(cf) == int32('u') { + c = int8('7') + } + Xsqlite3_str_appendchar(tls, bp+48, int32(1), c) + case int32('Y'): + Xsqlite3_str_appendf(tls, bp+48, __ccgo_ts+1456, libc.VaList(bp+136, (*(*TDateTime)(unsafe.Pointer(bp))).FY)) + case int32('%'): + Xsqlite3_str_appendchar(tls, bp+48, int32(1), int8('%')) + default: + Xsqlite3_str_reset(tls, bp+48) + return + } + goto _1 + _1: + ; + i++ + } + if j < i { + Xsqlite3_str_append(tls, bp+48, zFmt+uintptr(j), int32(i-j)) + } + _sqlite3ResultStrAccum(tls, context, bp+48) +} + +// C documentation +// +// /* +// ** current_time() +// ** +// ** This function returns the same value as time('now'). +// */ +func _ctimeFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + _ = NotUsed + _ = NotUsed2 + _timeFunc(tls, context, 0, uintptr(0)) +} + +// C documentation +// +// /* +// ** current_date() +// ** +// ** This function returns the same value as date('now'). +// */ +func _cdateFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + _ = NotUsed + _ = NotUsed2 + _dateFunc(tls, context, 0, uintptr(0)) +} + +// C documentation +// +// /* +// ** timediff(DATE1, DATE2) +// ** +// ** Return the amount of time that must be added to DATE2 in order to +// ** convert it into DATE2. The time difference format is: +// ** +// ** +YYYY-MM-DD HH:MM:SS.SSS +// ** +// ** The initial "+" becomes "-" if DATE1 occurs before DATE2. For +// ** date/time values A and B, the following invariant should hold: +// ** +// ** datetime(A) == (datetime(B, timediff(A,B)) +// ** +// ** Both DATE arguments must be either a julian day number, or an +// ** ISO-8601 string. The unix timestamps are not supported by this +// ** routine. +// */ +func _timediffFunc(tls *libc.TLS, context uintptr, NotUsed1 int32, argv uintptr) { + bp := tls.Alloc(192) + defer tls.Free(192) + var M, Y int32 + var sign int8 + var p1, p2 uintptr + var _ /* d1 at bp+0 */ TDateTime + var _ /* d2 at bp+48 */ TDateTime + var _ /* sRes at bp+96 */ Tsqlite3_str + _, _, _, _, _ = M, Y, sign, p1, p2 + _ = NotUsed1 + if _isDate(tls, context, int32(1), argv, bp) != 0 { + return + } + if _isDate(tls, context, int32(1), argv+1*8, bp+48) != 0 { + return + } + _computeYMD_HMS(tls, bp) + _computeYMD_HMS(tls, bp+48) + if (*(*TDateTime)(unsafe.Pointer(bp))).FiJD >= (*(*TDateTime)(unsafe.Pointer(bp + 48))).FiJD { + sign = int8('+') + Y = (*(*TDateTime)(unsafe.Pointer(bp))).FY - (*(*TDateTime)(unsafe.Pointer(bp + 48))).FY + if Y != 0 { + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FY = (*(*TDateTime)(unsafe.Pointer(bp))).FY + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FvalidJD = 0 + _computeJD(tls, bp+48) + } + M = (*(*TDateTime)(unsafe.Pointer(bp))).FM - (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM + if M < 0 { + Y-- + M += int32(12) + } + if M != 0 { + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM = (*(*TDateTime)(unsafe.Pointer(bp))).FM + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FvalidJD = 0 + _computeJD(tls, bp+48) + } + for (*(*TDateTime)(unsafe.Pointer(bp))).FiJD < (*(*TDateTime)(unsafe.Pointer(bp + 48))).FiJD { + M-- + if M < 0 { + M = int32(11) + Y-- + } + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM-- + if (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM < int32(1) { + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM = int32(12) + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FY-- + } + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FvalidJD = 0 + _computeJD(tls, bp+48) + } + (*(*TDateTime)(unsafe.Pointer(bp))).FiJD -= (*(*TDateTime)(unsafe.Pointer(bp + 48))).FiJD + p1 = bp + *(*Tsqlite3_int64)(unsafe.Pointer(p1)) = Tsqlite3_int64(uint64(*(*Tsqlite3_int64)(unsafe.Pointer(p1))) + libc.Uint64FromInt32(1486995408)*libc.Uint64FromInt32(100000)) + } else { /* d1 (*(*TDateTime)(unsafe.Pointer(bp + 48))).FiJD { + M-- + if M < 0 { + M = int32(11) + Y-- + } + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM++ + if (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM > int32(12) { + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FM = int32(1) + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FY++ + } + (*(*TDateTime)(unsafe.Pointer(bp + 48))).FvalidJD = 0 + _computeJD(tls, bp+48) + } + (*(*TDateTime)(unsafe.Pointer(bp))).FiJD = (*(*TDateTime)(unsafe.Pointer(bp + 48))).FiJD - (*(*TDateTime)(unsafe.Pointer(bp))).FiJD + p2 = bp + *(*Tsqlite3_int64)(unsafe.Pointer(p2)) = Tsqlite3_int64(uint64(*(*Tsqlite3_int64)(unsafe.Pointer(p2))) + libc.Uint64FromInt32(1486995408)*libc.Uint64FromInt32(100000)) + } + (*(*TDateTime)(unsafe.Pointer(bp))).FvalidYMD = 0 + (*(*TDateTime)(unsafe.Pointer(bp))).FvalidHMS = 0 + (*(*TDateTime)(unsafe.Pointer(bp))).FvalidTZ = 0 + _computeYMD_HMS(tls, bp) + _sqlite3StrAccumInit(tls, bp+96, uintptr(0), uintptr(0), 0, int32(100)) + Xsqlite3_str_appendf(tls, bp+96, __ccgo_ts+1461, libc.VaList(bp+136, int32(sign), Y, M, (*(*TDateTime)(unsafe.Pointer(bp))).FD-int32(1), (*(*TDateTime)(unsafe.Pointer(bp))).Fh, (*(*TDateTime)(unsafe.Pointer(bp))).Fm, (*(*TDateTime)(unsafe.Pointer(bp))).Fs)) + _sqlite3ResultStrAccum(tls, context, bp+96) +} + +// C documentation +// +// /* +// ** current_timestamp() +// ** +// ** This function returns the same value as datetime('now'). +// */ +func _ctimestampFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + _ = NotUsed + _ = NotUsed2 + _datetimeFunc(tls, context, 0, uintptr(0)) +} + +// C documentation +// +// /* +// ** This function registered all of the above C functions as SQL +// ** functions. This should be the only routine in this file with +// ** external linkage. +// */ +func _sqlite3RegisterDateTimeFunctions(tls *libc.TLS) { + _sqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&_aDateTimeFuncs)), int32(libc.Uint64FromInt64(720)/libc.Uint64FromInt64(72))) +} + +var _aDateTimeFuncs = [10]TFuncDef{ + 0: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1267, + }, + 1: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1287, + }, + 2: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1495, + }, + 3: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1500, + }, + 4: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1505, + }, + 5: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1514, + }, + 6: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), + FzName: __ccgo_ts + 1523, + }, + 7: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 1532, + }, + 8: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 1545, + }, + 9: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 1563, + }, +} + +func init() { + p := unsafe.Pointer(&_aDateTimeFuncs) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_juliandayFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_unixepochFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_dateFunc) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_timeFunc) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_datetimeFunc) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(_strftimeFunc) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_timediffFunc) + *(*uintptr)(unsafe.Add(p, 528)) = __ccgo_fp(_ctimeFunc) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(_ctimestampFunc) + *(*uintptr)(unsafe.Add(p, 672)) = __ccgo_fp(_cdateFunc) +} + +/************** End of date.c ************************************************/ +/************** Begin file os.c **********************************************/ +/* +** 2005 November 29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains OS interface code that is common to all +** architectures. + */ +/* #include "sqliteInt.h" */ + +/* +** If we compile with the SQLITE_TEST macro set, then the following block +** of code will give us the ability to simulate a disk I/O error. This +** is used for testing the I/O recovery logic. + */ + +/* +** When testing, also keep a count of the number of open files. + */ + +/* +** The default SQLite sqlite3_vfs implementations do not allocate +** memory (actually, os_unix.c allocates a small amount of memory +** from within OsOpen()), but some third-party implementations may. +** So we test the effects of a malloc() failing and the sqlite3OsXXX() +** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro. +** +** The following functions are instrumented for malloc() failure +** testing: +** +** sqlite3OsRead() +** sqlite3OsWrite() +** sqlite3OsSync() +** sqlite3OsFileSize() +** sqlite3OsLock() +** sqlite3OsCheckReservedLock() +** sqlite3OsFileControl() +** sqlite3OsShmMap() +** sqlite3OsOpen() +** sqlite3OsDelete() +** sqlite3OsAccess() +** sqlite3OsFullPathname() +** + */ + +// C documentation +// +// /* +// ** The following routines are convenience wrappers around methods +// ** of the sqlite3_file object. This is mostly just syntactic sugar. All +// ** of this would be completely automatic if SQLite were coded using +// ** C++ instead of plain old C. +// */ +func _sqlite3OsClose(tls *libc.TLS, pId uintptr) { + if (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods)).FxClose})))(tls, pId) + (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = uintptr(0) + } +} + +func _sqlite3OsRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Ti64) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr, int32, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxRead})))(tls, id, pBuf, amt, offset) +} + +func _sqlite3OsWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Ti64) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr, int32, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxWrite})))(tls, id, pBuf, amt, offset) +} + +func _sqlite3OsTruncate(tls *libc.TLS, id uintptr, size Ti64) (r int32) { + return (*(*func(*libc.TLS, uintptr, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxTruncate})))(tls, id, size) +} + +func _sqlite3OsSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { + var v1 int32 + _ = v1 + if flags != 0 { + v1 = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxSync})))(tls, id, flags) + } else { + v1 = SQLITE_OK + } + return v1 +} + +func _sqlite3OsFileSize(tls *libc.TLS, id uintptr, pSize uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxFileSize})))(tls, id, pSize) +} + +func _sqlite3OsLock(tls *libc.TLS, id uintptr, lockType int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxLock})))(tls, id, lockType) +} + +func _sqlite3OsUnlock(tls *libc.TLS, id uintptr, lockType int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxUnlock})))(tls, id, lockType) +} + +func _sqlite3OsCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxCheckReservedLock})))(tls, id, pResOut) +} + +// C documentation +// +// /* +// ** Use sqlite3OsFileControl() when we are doing something that might fail +// ** and we need to know about the failures. Use sqlite3OsFileControlHint() +// ** when simply tossing information over the wall to the VFS and we do not +// ** really care if the VFS receives and understands the information since it +// ** is only a hint and can be safely ignored. The sqlite3OsFileControlHint() +// ** routine has no return value since the return value would be meaningless. +// */ +func _sqlite3OsFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) (r int32) { + if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods == uintptr(0) { + return int32(SQLITE_NOTFOUND) + } + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxFileControl})))(tls, id, op, pArg) +} + +func _sqlite3OsFileControlHint(tls *libc.TLS, id uintptr, op int32, pArg uintptr) { + if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods != 0 { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxFileControl})))(tls, id, op, pArg) + } +} + +func _sqlite3OsSectorSize(tls *libc.TLS, id uintptr) (r int32) { + var xSectorSize uintptr + var v1 int32 + _, _ = xSectorSize, v1 + xSectorSize = (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxSectorSize + if xSectorSize != 0 { + v1 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xSectorSize})))(tls, id) + } else { + v1 = int32(SQLITE_DEFAULT_SECTOR_SIZE) + } + return v1 +} + +func _sqlite3OsDeviceCharacteristics(tls *libc.TLS, id uintptr) (r int32) { + if (*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods == uintptr(0) { + return 0 + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxDeviceCharacteristics})))(tls, id) +} + +func _sqlite3OsShmLock(tls *libc.TLS, id uintptr, offset int32, n int32, flags int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxShmLock})))(tls, id, offset, n, flags) +} + +func _sqlite3OsShmBarrier(tls *libc.TLS, id uintptr) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxShmBarrier})))(tls, id) +} + +func _sqlite3OsShmUnmap(tls *libc.TLS, id uintptr, deleteFlag int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxShmUnmap})))(tls, id, deleteFlag) +} + +func _sqlite3OsShmMap(tls *libc.TLS, id uintptr, iPage int32, pgsz int32, bExtend int32, pp uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxShmMap})))(tls, id, iPage, pgsz, bExtend, pp) +} + +// C documentation +// +// /* The real implementation of xFetch and xUnfetch */ +func _sqlite3OsFetch(tls *libc.TLS, id uintptr, iOff Ti64, iAmt int32, pp uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, Tsqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxFetch})))(tls, id, iOff, iAmt, pp) +} + +func _sqlite3OsUnfetch(tls *libc.TLS, id uintptr, iOff Ti64, p uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, Tsqlite3_int64, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxUnfetch})))(tls, id, iOff, p) +} + +// C documentation +// +// /* +// ** The next group of routines are convenience wrappers around the +// ** VFS methods. +// */ +func _sqlite3OsOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags int32, pFlagsOut uintptr) (r int32) { + var rc int32 + _ = rc + /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed + ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example, + ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before + ** reaching the VFS. */ + rc = (*(*func(*libc.TLS, uintptr, Tsqlite3_filename, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen})))(tls, pVfs, zPath, pFile, flags&int32(0x1087f7f), pFlagsOut) + return rc +} + +func _sqlite3OsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) (r int32) { + var v1 int32 + _ = v1 + if (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDelete != uintptr(0) { + v1 = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDelete})))(tls, pVfs, zPath, dirSync) + } else { + v1 = SQLITE_OK + } + return v1 +} + +func _sqlite3OsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxAccess})))(tls, pVfs, zPath, flags, pResOut) +} + +func _sqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) (r int32) { + *(*int8)(unsafe.Pointer(zPathOut)) = 0 + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxFullPathname})))(tls, pVfs, zPath, nPathOut, zPathOut) +} + +func _sqlite3OsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) (r uintptr) { + /* tag-20210611-1 */ + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDlOpen})))(tls, pVfs, zPath) +} + +func _sqlite3OsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) { + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDlError})))(tls, pVfs, nByte, zBufOut) +} + +func _sqlite3OsDlSym(tls *libc.TLS, pVfs uintptr, pHdle uintptr, zSym uintptr) (r uintptr) { + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDlSym})))(tls, pVfs, pHdle, zSym) +} + +func _sqlite3OsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxDlClose})))(tls, pVfs, pHandle) +} + +func _sqlite3OsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) (r int32) { + if _sqlite3Config.FiPrngSeed != 0 { + libc.Xmemset(tls, zBufOut, 0, uint64(nByte)) + if nByte > libc.Int32FromInt64(4) { + nByte = int32(4) + } + libc.Xmemcpy(tls, zBufOut, uintptr(unsafe.Pointer(&_sqlite3Config))+432, uint64(nByte)) + return SQLITE_OK + } else { + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxRandomness})))(tls, pVfs, nByte, zBufOut) + } + return r +} + +func _sqlite3OsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxSleep})))(tls, pVfs, nMicro) +} + +func _sqlite3OsGetLastError(tls *libc.TLS, pVfs uintptr) (r int32) { + var v1 int32 + _ = v1 + if (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxGetLastError != 0 { + v1 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxGetLastError})))(tls, pVfs, 0, uintptr(0)) + } else { + v1 = 0 + } + return v1 +} + +func _sqlite3OsCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* r at bp+0 */ float64 + _ = rc + /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64() + ** method to get the current date and time if that method is available + ** (if iVersion is 2 or greater and the function pointer is not NULL) and + ** will fall back to xCurrentTime() if xCurrentTimeInt64() is + ** unavailable. + */ + if (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion >= int32(2) && (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTimeInt64 != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTimeInt64})))(tls, pVfs, pTimeOut) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTime})))(tls, pVfs, bp) + *(*Tsqlite3_int64)(unsafe.Pointer(pTimeOut)) = int64(*(*float64)(unsafe.Pointer(bp)) * libc.Float64FromFloat64(8.64e+07)) + } + return rc +} + +func _sqlite3OsOpenMalloc(tls *libc.TLS, pVfs uintptr, zFile uintptr, ppFile uintptr, flags int32, pOutFlags uintptr) (r int32) { + var pFile uintptr + var rc int32 + _, _ = pFile, rc + pFile = _sqlite3MallocZero(tls, uint64((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)) + if pFile != 0 { + rc = _sqlite3OsOpen(tls, pVfs, zFile, pFile, flags, pOutFlags) + if rc != SQLITE_OK { + Xsqlite3_free(tls, pFile) + *(*uintptr)(unsafe.Pointer(ppFile)) = uintptr(0) + } else { + *(*uintptr)(unsafe.Pointer(ppFile)) = pFile + } + } else { + *(*uintptr)(unsafe.Pointer(ppFile)) = uintptr(0) + rc = int32(SQLITE_NOMEM) + } + return rc +} + +func _sqlite3OsCloseFree(tls *libc.TLS, pFile uintptr) { + _sqlite3OsClose(tls, pFile) + Xsqlite3_free(tls, pFile) +} + +// C documentation +// +// /* +// ** This function is a wrapper around the OS specific implementation of +// ** sqlite3_os_init(). The purpose of the wrapper is to provide the +// ** ability to simulate a malloc failure, so that the handling of an +// ** error in sqlite3_os_init() by the upper layers can be tested. +// */ +func _sqlite3OsInit(tls *libc.TLS) (r int32) { + var p uintptr + _ = p + p = Xsqlite3_malloc(tls, int32(10)) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + Xsqlite3_free(tls, p) + return Xsqlite3_os_init(tls) +} + +// C documentation +// +// /* +// ** The list of all registered VFS implementations. +// */ +var _vfsList = uintptr(0) + +// C documentation +// +// /* +// ** Locate a VFS by name. If no name is given, simply return the +// ** first VFS on the list. +// */ +func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) (r uintptr) { + var mutex, pVfs uintptr + var rc int32 + _, _, _ = mutex, pVfs, rc + pVfs = uintptr(0) + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return uintptr(0) + } + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + pVfs = _vfsList + for { + if !(pVfs != 0) { + break + } + if zVfs == uintptr(0) { + break + } + if libc.Xstrcmp(tls, zVfs, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName) == 0 { + break + } + goto _1 + _1: + ; + pVfs = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext + } + Xsqlite3_mutex_leave(tls, mutex) + return pVfs +} + +// C documentation +// +// /* +// ** Unlink a VFS from the linked list +// */ +func _vfsUnlink(tls *libc.TLS, pVfs uintptr) { + var p uintptr + _ = p + if pVfs == uintptr(0) { + /* No-op */ + } else { + if _vfsList == pVfs { + _vfsList = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext + } else { + if _vfsList != 0 { + p = _vfsList + for (*Tsqlite3_vfs)(unsafe.Pointer(p)).FpNext != 0 && (*Tsqlite3_vfs)(unsafe.Pointer(p)).FpNext != pVfs { + p = (*Tsqlite3_vfs)(unsafe.Pointer(p)).FpNext + } + if (*Tsqlite3_vfs)(unsafe.Pointer(p)).FpNext == pVfs { + (*Tsqlite3_vfs)(unsafe.Pointer(p)).FpNext = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext + } + } + } + } +} + +// C documentation +// +// /* +// ** Register a VFS with the system. It is harmless to register the same +// ** VFS multiple times. The new VFS becomes the default if makeDflt is +// ** true. +// */ +func Xsqlite3_vfs_register(tls *libc.TLS, pVfs uintptr, makeDflt int32) (r int32) { + var mutex uintptr + var rc int32 + _, _ = mutex, rc + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + _vfsUnlink(tls, pVfs) + if makeDflt != 0 || _vfsList == uintptr(0) { + (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext = _vfsList + _vfsList = pVfs + } else { + (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext = (*Tsqlite3_vfs)(unsafe.Pointer(_vfsList)).FpNext + (*Tsqlite3_vfs)(unsafe.Pointer(_vfsList)).FpNext = pVfs + } + Xsqlite3_mutex_leave(tls, mutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Unregister a VFS so that it is no longer accessible. +// */ +func Xsqlite3_vfs_unregister(tls *libc.TLS, pVfs uintptr) (r int32) { + var mutex uintptr + var rc int32 + _, _ = mutex, rc + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + _vfsUnlink(tls, pVfs) + Xsqlite3_mutex_leave(tls, mutex) + return SQLITE_OK +} + +/************** End of os.c **************************************************/ +/************** Begin file fault.c *******************************************/ +/* +** 2008 Jan 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code to support the concept of "benign" +** malloc failures (when the xMalloc() or xRealloc() method of the +** sqlite3_mem_methods structure fails to allocate a block of memory +** and returns 0). +** +** Most malloc failures are non-benign. After they occur, SQLite +** abandons the current operation and returns an error code (usually +** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily +** fatal. For example, if a malloc fails while resizing a hash table, this +** is completely recoverable simply by not carrying out the resize. The +** hash table will continue to function normally. So a malloc failure +** during a hash table resize is a benign fault. + */ + +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Global variables. +// */ +type TBenignMallocHooks = struct { + FxBenignBegin uintptr + FxBenignEnd uintptr +} + +type BenignMallocHooks = TBenignMallocHooks + +type TBenignMallocHooks1 = struct { + FxBenignBegin uintptr + FxBenignEnd uintptr +} + +type BenignMallocHooks1 = TBenignMallocHooks1 + +var _sqlite3Hooks = TBenignMallocHooks1{} + +/* The "wsdHooks" macro will resolve to the appropriate BenignMallocHooks +** structure. If writable static data is unsupported on the target, +** we have to locate the state vector at run-time. In the more common +** case where writable static data is supported, wsdHooks can refer directly +** to the "sqlite3Hooks" state vector declared above. + */ + +// C documentation +// +// /* +// ** Register hooks to call when sqlite3BeginBenignMalloc() and +// ** sqlite3EndBenignMalloc() are called, respectively. +// */ +func _sqlite3BenignMallocHooks(tls *libc.TLS, xBenignBegin uintptr, xBenignEnd uintptr) { + _sqlite3Hooks.FxBenignBegin = xBenignBegin + _sqlite3Hooks.FxBenignEnd = xBenignEnd +} + +// C documentation +// +// /* +// ** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that +// ** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc() +// ** indicates that subsequent malloc failures are non-benign. +// */ +func _sqlite3BeginBenignMalloc(tls *libc.TLS) { + if _sqlite3Hooks.FxBenignBegin != 0 { + (*(*func(*libc.TLS))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Hooks.FxBenignBegin})))(tls) + } +} + +func _sqlite3EndBenignMalloc(tls *libc.TLS) { + if _sqlite3Hooks.FxBenignEnd != 0 { + (*(*func(*libc.TLS))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Hooks.FxBenignEnd})))(tls) + } +} + +/************** End of fault.c ***********************************************/ +/************** Begin file mem0.c ********************************************/ +/* +** 2008 October 28 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains a no-op memory allocation drivers for use when +** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented +** here always fail. SQLite will not operate with these drivers. These +** are merely placeholders. Real drivers must be substituted using +** sqlite3_config() before SQLite will operate. + */ +/* #include "sqliteInt.h" */ + +/* +** This version of the memory allocator is the default. It is +** used when no other memory allocator is specified using compile-time +** macros. + */ + +/************** End of mem0.c ************************************************/ +/************** Begin file mem1.c ********************************************/ +/* +** 2007 August 14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains low-level memory allocation drivers for when +** SQLite will use the standard C-library malloc/realloc/free interface +** to obtain the memory it needs. +** +** This file contains implementations of the low-level memory allocation +** routines specified in the sqlite3_mem_methods object. The content of +** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The +** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the +** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The +** default configuration is to use memory allocation routines in this +** file. +** +** C-preprocessor macro summary: +** +** HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if +** the malloc_usable_size() interface exists +** on the target platform. Or, this symbol +** can be set manually, if desired. +** If an equivalent interface exists by +** a different name, using a separate -D +** option to rename it. +** +** SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone +** memory allocator. Set this symbol to enable +** building on older macs. +** +** SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of +** _msize() on windows systems. This might +** be necessary when compiling for Delphi, +** for example. + */ +/* #include "sqliteInt.h" */ + +/* +** This version of the memory allocator is the default. It is +** used when no other memory allocator is specified using compile-time +** macros. + */ + +/* +** Use standard C library malloc and free on non-Apple systems. +** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined. + */ + +/* +** The malloc.h header file is needed for malloc_usable_size() function +** on some systems (e.g. Linux). + */ + +/* +** Include the malloc.h header file, if necessary. Also set define macro +** SQLITE_MALLOCSIZE to the appropriate function name, which is _msize() +** for MSVC and malloc_usable_size() for most other systems (e.g. Linux). +** The memory size function can always be overridden manually by defining +** the macro SQLITE_MALLOCSIZE to the desired function name. + */ + +// C documentation +// +// /* +// ** Like malloc(), but remember the size of the allocation +// ** so that we can find it later using sqlite3MemSize(). +// ** +// ** For this low-level routine, we are guaranteed that nByte>0 because +// ** cases of nByte<=0 will be intercepted and dealt with by higher level +// ** routines. +// */ +func _sqlite3MemMalloc(tls *libc.TLS, nByte int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + _ = p + p = libc.Xmalloc(tls, uint64(nByte+int32(8))) + if p != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(p)) = int64(nByte) + p += 8 + } else { + Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1576, libc.VaList(bp+8, nByte)) + } + return p +} + +// C documentation +// +// /* +// ** Like free() but works for allocations obtained from sqlite3MemMalloc() +// ** or sqlite3MemRealloc(). +// ** +// ** For this low-level routine, we already know that pPrior!=0 since +// ** cases where pPrior==0 will have been intercepted and dealt with +// ** by higher-level routines. +// */ +func _sqlite3MemFree(tls *libc.TLS, pPrior uintptr) { + var p uintptr + _ = p + p = pPrior + p -= 8 + libc.Xfree(tls, p) +} + +// C documentation +// +// /* +// ** Report the allocated size of a prior return from xMalloc() +// ** or xRealloc(). +// */ +func _sqlite3MemSize(tls *libc.TLS, pPrior uintptr) (r int32) { + var p uintptr + _ = p + p = pPrior + p -= 8 + return int32(*(*Tsqlite3_int64)(unsafe.Pointer(p))) +} + +// C documentation +// +// /* +// ** Like realloc(). Resize an allocation previously obtained from +// ** sqlite3MemMalloc(). +// ** +// ** For this low-level interface, we know that pPrior!=0. Cases where +// ** pPrior==0 while have been intercepted by higher-level routine and +// ** redirected to xMalloc. Similarly, we know that nByte>0 because +// ** cases where nByte<=0 will have been intercepted by higher-level +// ** routines and redirected to xFree. +// */ +func _sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var p uintptr + _ = p + p = pPrior + /* EV: R-46199-30249 */ + p -= 8 + p = libc.Xrealloc(tls, p, uint64(nByte+libc.Int32FromInt32(8))) + if p != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(p)) = int64(nByte) + p += 8 + } else { + Xsqlite3_log(tls, int32(SQLITE_NOMEM), __ccgo_ts+1614, libc.VaList(bp+8, _sqlite3MemSize(tls, pPrior), nByte)) + } + return p +} + +// C documentation +// +// /* +// ** Round up a request size to the next valid allocation size. +// */ +func _sqlite3MemRoundup(tls *libc.TLS, n int32) (r int32) { + return (n + int32(7)) & ^libc.Int32FromInt32(7) +} + +// C documentation +// +// /* +// ** Initialize this module. +// */ +func _sqlite3MemInit(tls *libc.TLS, NotUsed uintptr) (r int32) { + _ = NotUsed + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Deinitialize this module. +// */ +func _sqlite3MemShutdown(tls *libc.TLS, NotUsed uintptr) { + _ = NotUsed + return +} + +// C documentation +// +// /* +// ** This routine is the only routine in this file with external linkage. +// ** +// ** Populate the low-level memory allocation function pointers in +// ** sqlite3GlobalConfig.m with pointers to the routines in this file. +// */ +func _sqlite3MemSetDefault(tls *libc.TLS) { + bp := tls.Alloc(16) + defer tls.Free(16) + Xsqlite3_config(tls, int32(SQLITE_CONFIG_MALLOC), libc.VaList(bp+8, uintptr(unsafe.Pointer(&_defaultMethods)))) +} + +var _defaultMethods = Tsqlite3_mem_methods{} + +func init() { + p := unsafe.Pointer(&_defaultMethods) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_sqlite3MemMalloc) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_sqlite3MemFree) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_sqlite3MemRealloc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_sqlite3MemSize) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_sqlite3MemRoundup) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_sqlite3MemInit) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_sqlite3MemShutdown) +} + +/************** End of mem1.c ************************************************/ +/************** Begin file mem2.c ********************************************/ +/* +** 2007 August 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains low-level memory allocation drivers for when +** SQLite will use the standard C-library malloc/realloc/free interface +** to obtain the memory it needs while adding lots of additional debugging +** information to each allocation in order to help detect and fix memory +** leaks and memory usage errors. +** +** This file contains implementations of the low-level memory allocation +** routines specified in the sqlite3_mem_methods object. + */ +/* #include "sqliteInt.h" */ + +/* +** This version of the memory allocator is used only if the +** SQLITE_MEMDEBUG macro is defined + */ + +/************** End of mem2.c ************************************************/ +/************** Begin file mem3.c ********************************************/ +/* +** 2007 October 14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C functions that implement a memory +** allocation subsystem for use by SQLite. +** +** This version of the memory allocation subsystem omits all +** use of malloc(). The SQLite user supplies a block of memory +** before calling sqlite3_initialize() from which allocations +** are made and returned by the xMalloc() and xRealloc() +** implementations. Once sqlite3_initialize() has been called, +** the amount of memory available to SQLite is fixed and cannot +** be changed. +** +** This version of the memory allocation subsystem is included +** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. + */ +/* #include "sqliteInt.h" */ + +/* +** This version of the memory allocator is only built into the library +** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not +** mean that the library will use a memory-pool by default, just that +** it is available. The mempool allocator is activated by calling +** sqlite3_config(). + */ + +/************** End of mem3.c ************************************************/ +/************** Begin file mem5.c ********************************************/ +/* +** 2007 October 14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C functions that implement a memory +** allocation subsystem for use by SQLite. +** +** This version of the memory allocation subsystem omits all +** use of malloc(). The application gives SQLite a block of memory +** before calling sqlite3_initialize() from which allocations +** are made and returned by the xMalloc() and xRealloc() +** implementations. Once sqlite3_initialize() has been called, +** the amount of memory available to SQLite is fixed and cannot +** be changed. +** +** This version of the memory allocation subsystem is included +** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. +** +** This memory allocator uses the following algorithm: +** +** 1. All memory allocation sizes are rounded up to a power of 2. +** +** 2. If two adjacent free blocks are the halves of a larger block, +** then the two blocks are coalesced into the single larger block. +** +** 3. New memory is allocated from the first available free block. +** +** This algorithm is described in: J. M. Robson. "Bounds for Some Functions +** Concerning Dynamic Storage Allocation". Journal of the Association for +** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499. +** +** Let n be the size of the largest allocation divided by the minimum +** allocation size (after rounding all sizes up to a power of 2.) Let M +** be the maximum amount of memory ever outstanding at one time. Let +** N be the total amount of memory available for allocation. Robson +** proved that this memory allocator will never breakdown due to +** fragmentation as long as the following constraint holds: +** +** N >= M*(1 + log2(n)/2) - n + 1 +** +** The sqlite3_status() logic tracks the maximum values of n and M so +** that an application can, at any time, verify this constraint. + */ +/* #include "sqliteInt.h" */ + +/* +** This version of the memory allocator is used only when +** SQLITE_ENABLE_MEMSYS5 is defined. + */ + +/************** End of mem5.c ************************************************/ +/************** Begin file mutex.c *******************************************/ +/* +** 2007 August 14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C functions that implement mutexes. +** +** This file contains code that is common across all mutex implementations. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Initialize the mutex system. +// */ +func _sqlite3MutexInit(tls *libc.TLS) (r int32) { + var pFrom, pTo uintptr + var rc int32 + _, _, _ = pFrom, pTo, rc + rc = SQLITE_OK + if !(_sqlite3Config.Fmutex.FxMutexAlloc != 0) { + pTo = uintptr(unsafe.Pointer(&_sqlite3Config)) + 96 + if _sqlite3Config.FbCoreMutex != 0 { + pFrom = _sqlite3DefaultMutex(tls) + } else { + pFrom = _sqlite3NoopMutex(tls) + } + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexInit = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexInit + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexEnd = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexEnd + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexFree = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexFree + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexEnter = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexEnter + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexTry = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexTry + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexLeave = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexLeave + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexHeld = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexHeld + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexNotheld = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexNotheld + _sqlite3MemoryBarrier(tls) + (*Tsqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexAlloc = (*Tsqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexAlloc + } + rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexInit})))(tls) + _sqlite3MemoryBarrier(tls) + return rc +} + +// C documentation +// +// /* +// ** Shutdown the mutex system. This call frees resources allocated by +// ** sqlite3MutexInit(). +// */ +func _sqlite3MutexEnd(tls *libc.TLS) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if _sqlite3Config.Fmutex.FxMutexEnd != 0 { + rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexEnd})))(tls) + } + return rc +} + +// C documentation +// +// /* +// ** Retrieve a pointer to a static mutex or allocate a new dynamic one. +// */ +func Xsqlite3_mutex_alloc(tls *libc.TLS, id int32) (r uintptr) { + if id <= int32(SQLITE_MUTEX_RECURSIVE) && Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + if id > int32(SQLITE_MUTEX_RECURSIVE) && _sqlite3MutexInit(tls) != 0 { + return uintptr(0) + } + return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexAlloc})))(tls, id) +} + +func _sqlite3MutexAlloc(tls *libc.TLS, id int32) (r uintptr) { + if !(_sqlite3Config.FbCoreMutex != 0) { + return uintptr(0) + } + return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexAlloc})))(tls, id) +} + +// C documentation +// +// /* +// ** Free a dynamic mutex. +// */ +func Xsqlite3_mutex_free(tls *libc.TLS, p uintptr) { + if p != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexFree})))(tls, p) + } +} + +// C documentation +// +// /* +// ** Obtain the mutex p. If some other thread already has the mutex, block +// ** until it can be obtained. +// */ +func Xsqlite3_mutex_enter(tls *libc.TLS, p uintptr) { + if p != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexEnter})))(tls, p) + } +} + +// C documentation +// +// /* +// ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another +// ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. +// */ +func Xsqlite3_mutex_try(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if p != 0 { + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexTry})))(tls, p) + } + return rc +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_leave() routine exits a mutex that was previously +// ** entered by the same thread. The behavior is undefined if the mutex +// ** is not currently entered. If a NULL pointer is passed as an argument +// ** this function is a no-op. +// */ +func Xsqlite3_mutex_leave(tls *libc.TLS, p uintptr) { + if p != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fmutex.FxMutexLeave})))(tls, p) + } +} + +/************** End of mutex.c ***********************************************/ +/************** Begin file mutex_noop.c **************************************/ +/* +** 2008 October 07 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C functions that implement mutexes. +** +** This implementation in this file does not provide any mutual +** exclusion and is thus suitable for use only in applications +** that use SQLite in a single thread. The routines defined +** here are place-holders. Applications can substitute working +** mutex routines at start-time using the +** +** sqlite3_config(SQLITE_CONFIG_MUTEX,...) +** +** interface. +** +** If compiled with SQLITE_DEBUG, then additional logic is inserted +** that does error checking on mutexes to make sure they are being +** called correctly. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Stub routines for all mutex methods. +// ** +// ** This routines provide no mutual exclusion or error checking. +// */ +func _noopMutexInit(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +func _noopMutexEnd(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +func _noopMutexAlloc(tls *libc.TLS, id int32) (r uintptr) { + _ = id + return libc.UintptrFromInt32(8) +} + +func _noopMutexFree(tls *libc.TLS, p uintptr) { + _ = p + return +} + +func _noopMutexEnter(tls *libc.TLS, p uintptr) { + _ = p + return +} + +func _noopMutexTry(tls *libc.TLS, p uintptr) (r int32) { + _ = p + return SQLITE_OK +} + +func _noopMutexLeave(tls *libc.TLS, p uintptr) { + _ = p + return +} + +func _sqlite3NoopMutex(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_sMutex)) +} + +var _sMutex = Tsqlite3_mutex_methods{} + +func init() { + p := unsafe.Pointer(&_sMutex) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_noopMutexInit) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_noopMutexEnd) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_noopMutexAlloc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_noopMutexFree) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_noopMutexEnter) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_noopMutexTry) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_noopMutexLeave) +} + +type Tpthread_t = uintptr + +type pthread_t = Tpthread_t + +type Tpthread_once_t = int32 + +type pthread_once_t = Tpthread_once_t + +type Tpthread_key_t = uint32 + +type pthread_key_t = Tpthread_key_t + +type Tpthread_spinlock_t = int32 + +type pthread_spinlock_t = Tpthread_spinlock_t + +type Tpthread_mutexattr_t = struct { + F__attr uint32 +} + +type pthread_mutexattr_t = Tpthread_mutexattr_t + +type Tpthread_condattr_t = struct { + F__attr uint32 +} + +type pthread_condattr_t = Tpthread_condattr_t + +type Tpthread_barrierattr_t = struct { + F__attr uint32 +} + +type pthread_barrierattr_t = Tpthread_barrierattr_t + +type Tpthread_rwlockattr_t = struct { + F__attr [2]uint32 +} + +type pthread_rwlockattr_t = Tpthread_rwlockattr_t + +type Tsigset_t = struct { + F__bits [16]uint64 +} + +type sigset_t = Tsigset_t + +type t__sigset_t = Tsigset_t + +type Tpthread_attr_t = struct { + F__u struct { + F__vi [0][14]int32 + F__s [0][7]uint64 + F__i [14]int32 + } +} + +type pthread_attr_t = Tpthread_attr_t + +type Tpthread_mutex_t = struct { + F__u struct { + F__vi [0][10]int32 + F__p [0][5]uintptr + F__i [10]int32 + } +} + +type pthread_mutex_t = Tpthread_mutex_t + +type Tpthread_cond_t = struct { + F__u struct { + F__vi [0][12]int32 + F__p [0][6]uintptr + F__i [12]int32 + } +} + +type pthread_cond_t = Tpthread_cond_t + +type Tpthread_rwlock_t = struct { + F__u struct { + F__vi [0][14]int32 + F__p [0][7]uintptr + F__i [14]int32 + } +} + +type pthread_rwlock_t = Tpthread_rwlock_t + +type Tpthread_barrier_t = struct { + F__u struct { + F__vi [0][8]int32 + F__p [0][4]uintptr + F__i [8]int32 + } +} + +type pthread_barrier_t = Tpthread_barrier_t + +type Tsched_param = struct { + Fsched_priority int32 + F__reserved1 int32 + F__reserved2 [2]struct { + F__reserved1 Ttime_t + F__reserved2 int64 + } + F__reserved3 int32 +} + +type sched_param = Tsched_param + +type Tcpu_set_t = struct { + F__bits [16]uint64 +} + +type cpu_set_t = Tcpu_set_t + +type t__ptcb = struct { + F__f uintptr + F__x uintptr + F__next uintptr +} + +type Tcpu_set_t1 = struct { + F__bits [16]uint64 +} + +type cpu_set_t1 = Tcpu_set_t1 + +/* +** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields +** are necessary under two conditions: (1) Debug builds and (2) using +** home-grown mutexes. Encapsulate these conditions into a single #define. + */ + +/* +** Each recursive mutex is an instance of the following structure. + */ +type Tsqlite3_mutex1 = struct { + Fmutex Tpthread_mutex_t +} + +type sqlite3_mutex1 = Tsqlite3_mutex1 + +/* +** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** intended for use only inside assert() statements. On some platforms, +** there might be race conditions that can cause these routines to +** deliver incorrect results. In particular, if pthread_equal() is +** not an atomic operation, then these routines might delivery +** incorrect results. On most platforms, pthread_equal() is a +** comparison of two integers and is therefore atomic. But we are +** told that HPUX is not such a platform. If so, then these routines +** will not always work correctly on HPUX. +** +** On those platforms where pthread_equal() is not atomic, SQLite +** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to +** make sure no assert() statements are evaluated and hence these +** routines are never called. + */ + +// C documentation +// +// /* +// ** Try to provide a memory barrier operation, needed for initialization +// ** and also for the implementation of xShmBarrier in the VFS in cases +// ** where SQLite is compiled without mutexes. +// */ +func _sqlite3MemoryBarrier(tls *libc.TLS) { + libc.X__sync_synchronize(tls) +} + +// C documentation +// +// /* +// ** Initialize and deinitialize the mutex subsystem. +// */ +func _pthreadMutexInit(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +func _pthreadMutexEnd(tls *libc.TLS) (r int32) { + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_alloc() routine allocates a new +// ** mutex and returns a pointer to it. If it returns NULL +// ** that means that a mutex could not be allocated. SQLite +// ** will unwind its stack and return an error. The argument +// ** to sqlite3_mutex_alloc() is one of these integer constants: +// ** +// **
      +// **
    • SQLITE_MUTEX_FAST +// **
    • SQLITE_MUTEX_RECURSIVE +// **
    • SQLITE_MUTEX_STATIC_MAIN +// **
    • SQLITE_MUTEX_STATIC_MEM +// **
    • SQLITE_MUTEX_STATIC_OPEN +// **
    • SQLITE_MUTEX_STATIC_PRNG +// **
    • SQLITE_MUTEX_STATIC_LRU +// **
    • SQLITE_MUTEX_STATIC_PMEM +// **
    • SQLITE_MUTEX_STATIC_APP1 +// **
    • SQLITE_MUTEX_STATIC_APP2 +// **
    • SQLITE_MUTEX_STATIC_APP3 +// **
    • SQLITE_MUTEX_STATIC_VFS1 +// **
    • SQLITE_MUTEX_STATIC_VFS2 +// **
    • SQLITE_MUTEX_STATIC_VFS3 +// **
    +// ** +// ** The first two constants cause sqlite3_mutex_alloc() to create +// ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE +// ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. +// ** The mutex implementation does not need to make a distinction +// ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does +// ** not want to. But SQLite will only request a recursive mutex in +// ** cases where it really needs one. If a faster non-recursive mutex +// ** implementation is available on the host platform, the mutex subsystem +// ** might return such a mutex in response to SQLITE_MUTEX_FAST. +// ** +// ** The other allowed parameters to sqlite3_mutex_alloc() each return +// ** a pointer to a static preexisting mutex. Six static mutexes are +// ** used by the current version of SQLite. Future versions of SQLite +// ** may add additional static mutexes. Static mutexes are for internal +// ** use by SQLite only. Applications that use SQLite mutexes should +// ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or +// ** SQLITE_MUTEX_RECURSIVE. +// ** +// ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST +// ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +// ** returns a different mutex on every call. But for the static +// ** mutex types, the same mutex is returned on every call that has +// ** the same type number. +// */ +func _pthreadMutexAlloc(tls *libc.TLS, iType int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var _ /* recursiveAttr at bp+0 */ Tpthread_mutexattr_t + _ = p + switch iType { + case int32(SQLITE_MUTEX_RECURSIVE): + p = _sqlite3MallocZero(tls, uint64(40)) + if p != 0 { + libc.Xpthread_mutexattr_init(tls, bp) + libc.Xpthread_mutexattr_settype(tls, bp, int32(PTHREAD_MUTEX_RECURSIVE)) + libc.Xpthread_mutex_init(tls, p, bp) + libc.Xpthread_mutexattr_destroy(tls, bp) + } + case SQLITE_MUTEX_FAST: + p = _sqlite3MallocZero(tls, uint64(40)) + if p != 0 { + libc.Xpthread_mutex_init(tls, p, uintptr(0)) + } + default: + p = uintptr(unsafe.Pointer(&_staticMutexes)) + uintptr(iType-int32(2))*40 + break + } + return p +} + +var _staticMutexes = [12]Tsqlite3_mutex{} + +// C documentation +// +// /* +// ** This routine deallocates a previously +// ** allocated mutex. SQLite is careful to deallocate every +// ** mutex that it allocates. +// */ +func _pthreadMutexFree(tls *libc.TLS, p uintptr) { + libc.Xpthread_mutex_destroy(tls, p) + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +// ** to enter a mutex. If another thread is already within the mutex, +// ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return +// ** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK +// ** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can +// ** be entered multiple times by the same thread. In such cases the, +// ** mutex must be exited an equal number of times before another thread +// ** can enter. If the same thread tries to enter any other kind of mutex +// ** more than once, the behavior is undefined. +// */ +func _pthreadMutexEnter(tls *libc.TLS, p uintptr) { + /* Use the built-in recursive mutexes if they are available. + */ + libc.Xpthread_mutex_lock(tls, p) +} + +func _pthreadMutexTry(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + /* Use the built-in recursive mutexes if they are available. + */ + if libc.Xpthread_mutex_trylock(tls, p) == 0 { + rc = SQLITE_OK + } else { + rc = int32(SQLITE_BUSY) + } + return rc +} + +// C documentation +// +// /* +// ** The sqlite3_mutex_leave() routine exits a mutex that was +// ** previously entered by the same thread. The behavior +// ** is undefined if the mutex is not currently entered or +// ** is not currently allocated. SQLite will never do either. +// */ +func _pthreadMutexLeave(tls *libc.TLS, p uintptr) { + libc.Xpthread_mutex_unlock(tls, p) +} + +func _sqlite3DefaultMutex(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_sMutex1)) +} + +var _sMutex1 = Tsqlite3_mutex_methods{} + +func init() { + p := unsafe.Pointer(&_sMutex1) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_pthreadMutexInit) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_pthreadMutexEnd) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_pthreadMutexAlloc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_pthreadMutexFree) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_pthreadMutexEnter) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_pthreadMutexTry) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_pthreadMutexLeave) +} + +/************** End of mutex_unix.c ******************************************/ +/************** Begin file mutex_w32.c ***************************************/ +/* +** 2007 August 14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C functions that implement mutexes for Win32. + */ +/* #include "sqliteInt.h" */ + +/* +** The code in this file is only used if we are compiling multithreaded +** on a Win32 system. + */ + +/************** End of mutex_w32.c *******************************************/ +/************** Begin file malloc.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** Memory allocation functions used throughout sqlite. + */ +/* #include "sqliteInt.h" */ +/* #include */ + +// C documentation +// +// /* +// ** Attempt to release up to n bytes of non-essential memory currently +// ** held by SQLite. An example of non-essential memory is memory used to +// ** cache database pages that are not currently in use. +// */ +func Xsqlite3_release_memory(tls *libc.TLS, n int32) (r int32) { + return _sqlite3PcacheReleaseMemory(tls, n) +} + +/* +** Default value of the hard heap limit. 0 means "no limit". + */ + +// C documentation +// +// /* +// ** State information local to the memory allocation subsystem. +// */ +type TMem0Global = struct { + Fmutex uintptr + FalarmThreshold Tsqlite3_int64 + FhardLimit Tsqlite3_int64 + FnearlyFull int32 +} + +type Mem0Global = TMem0Global + +/* +** Default value of the hard heap limit. 0 means "no limit". + */ + +// C documentation +// +// /* +// ** State information local to the memory allocation subsystem. +// */ +var _mem0 = TMem0Global{} + +// C documentation +// +// /* +// ** Return the memory allocator mutex. sqlite3_status() needs it. +// */ +func _sqlite3MallocMutex(tls *libc.TLS) (r uintptr) { + return _mem0.Fmutex +} + +// C documentation +// +// /* +// ** Deprecated external interface. It used to set an alarm callback +// ** that was invoked when memory usage grew too large. Now it is a +// ** no-op. +// */ +func Xsqlite3_memory_alarm(tls *libc.TLS, xCallback uintptr, pArg uintptr, iThreshold Tsqlite3_int64) (r int32) { + _ = xCallback + _ = pArg + _ = iThreshold + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Set the soft heap-size limit for the library. An argument of +// ** zero disables the limit. A negative argument is a no-op used to +// ** obtain the return value. +// ** +// ** The return value is the value of the heap limit just before this +// ** interface was called. +// ** +// ** If the hard heap limit is enabled, then the soft heap limit cannot +// ** be disabled nor raised above the hard heap limit. +// */ +func Xsqlite3_soft_heap_limit64(tls *libc.TLS, n Tsqlite3_int64) (r Tsqlite3_int64) { + var excess, nUsed, priorLimit Tsqlite3_int64 + var rc int32 + _, _, _, _ = excess, nUsed, priorLimit, rc + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return int64(-int32(1)) + } + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) + priorLimit = _mem0.FalarmThreshold + if n < 0 { + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + return priorLimit + } + if _mem0.FhardLimit > 0 && (n > _mem0.FhardLimit || n == 0) { + n = _mem0.FhardLimit + } + _mem0.FalarmThreshold = n + nUsed = _sqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + libc.AtomicStoreNInt32(uintptr(unsafe.Pointer(&_mem0))+24, libc.BoolInt32(n > 0 && n <= nUsed), libc.Int32FromInt32(__ATOMIC_RELAXED)) + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + excess = Xsqlite3_memory_used(tls) - n + if excess > 0 { + Xsqlite3_release_memory(tls, int32(excess&libc.Int64FromInt32(0x7fffffff))) + } + return priorLimit +} + +func Xsqlite3_soft_heap_limit(tls *libc.TLS, n int32) { + if n < 0 { + n = 0 + } + Xsqlite3_soft_heap_limit64(tls, int64(n)) +} + +// C documentation +// +// /* +// ** Set the hard heap-size limit for the library. An argument of zero +// ** disables the hard heap limit. A negative argument is a no-op used +// ** to obtain the return value without affecting the hard heap limit. +// ** +// ** The return value is the value of the hard heap limit just prior to +// ** calling this interface. +// ** +// ** Setting the hard heap limit will also activate the soft heap limit +// ** and constrain the soft heap limit to be no more than the hard heap +// ** limit. +// */ +func Xsqlite3_hard_heap_limit64(tls *libc.TLS, n Tsqlite3_int64) (r Tsqlite3_int64) { + var priorLimit Tsqlite3_int64 + var rc int32 + _, _ = priorLimit, rc + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return int64(-int32(1)) + } + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) + priorLimit = _mem0.FhardLimit + if n >= 0 { + _mem0.FhardLimit = n + if n < _mem0.FalarmThreshold || _mem0.FalarmThreshold == 0 { + _mem0.FalarmThreshold = n + } + } + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + return priorLimit +} + +// C documentation +// +// /* +// ** Initialize the memory allocation subsystem. +// */ +func _sqlite3MallocInit(tls *libc.TLS) (r int32) { + var rc int32 + _ = rc + if _sqlite3Config.Fm.FxMalloc == uintptr(0) { + _sqlite3MemSetDefault(tls) + } + _mem0.Fmutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MEM)) + if _sqlite3Config.FpPage == uintptr(0) || _sqlite3Config.FszPage < int32(512) || _sqlite3Config.FnPage <= 0 { + _sqlite3Config.FpPage = uintptr(0) + _sqlite3Config.FszPage = 0 + } + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxInit})))(tls, _sqlite3Config.Fm.FpAppData) + if rc != SQLITE_OK { + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_mem0)), 0, uint64(32)) + } + return rc +} + +// C documentation +// +// /* +// ** Return true if the heap is currently under memory pressure - in other +// ** words if the amount of heap used is close to the limit set by +// ** sqlite3_soft_heap_limit(). +// */ +func _sqlite3HeapNearlyFull(tls *libc.TLS) (r int32) { + return libc.AtomicLoadNInt32(uintptr(unsafe.Pointer(&_mem0))+24, libc.Int32FromInt32(__ATOMIC_RELAXED)) +} + +// C documentation +// +// /* +// ** Deinitialize the memory allocation subsystem. +// */ +func _sqlite3MallocEnd(tls *libc.TLS) { + if _sqlite3Config.Fm.FxShutdown != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxShutdown})))(tls, _sqlite3Config.Fm.FpAppData) + } + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_mem0)), 0, uint64(32)) +} + +// C documentation +// +// /* +// ** Return the amount of memory currently checked out. +// */ +func Xsqlite3_memory_used(tls *libc.TLS) (r Tsqlite3_int64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* mx at bp+8 */ Tsqlite3_int64 + var _ /* res at bp+0 */ Tsqlite3_int64 + Xsqlite3_status64(tls, SQLITE_STATUS_MEMORY_USED, bp, bp+8, 0) + return *(*Tsqlite3_int64)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Return the maximum amount of memory that has ever been +// ** checked out since either the beginning of this process +// ** or since the most recent reset. +// */ +func Xsqlite3_memory_highwater(tls *libc.TLS, resetFlag int32) (r Tsqlite3_int64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* mx at bp+8 */ Tsqlite3_int64 + var _ /* res at bp+0 */ Tsqlite3_int64 + Xsqlite3_status64(tls, SQLITE_STATUS_MEMORY_USED, bp, bp+8, resetFlag) + return *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) +} + +// C documentation +// +// /* +// ** Trigger the alarm +// */ +func _sqlite3MallocAlarm(tls *libc.TLS, nByte int32) { + if _mem0.FalarmThreshold <= 0 { + return + } + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + Xsqlite3_release_memory(tls, nByte) + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) +} + +// C documentation +// +// /* +// ** Do a memory allocation with statistics and alarms. Assume the +// ** lock is already held. +// */ +func _mallocWithAlarm(tls *libc.TLS, n int32, pp uintptr) { + var nFull int32 + var nUsed Tsqlite3_int64 + var p uintptr + _, _, _ = nFull, nUsed, p + /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal + ** implementation of malloc_good_size(), which must be called in debug + ** mode and specifically when the DMD "Dark Matter Detector" is enabled + ** or else a crash results. Hence, do not attempt to optimize out the + ** following xRoundup() call. */ + nFull = (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRoundup})))(tls, n) + _sqlite3StatusHighwater(tls, int32(SQLITE_STATUS_MALLOC_SIZE), n) + if _mem0.FalarmThreshold > 0 { + nUsed = _sqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + if nUsed >= _mem0.FalarmThreshold-int64(nFull) { + libc.AtomicStoreNInt32(uintptr(unsafe.Pointer(&_mem0))+24, libc.Int32FromInt32(1), libc.Int32FromInt32(__ATOMIC_RELAXED)) + _sqlite3MallocAlarm(tls, nFull) + if _mem0.FhardLimit != 0 { + nUsed = _sqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + if nUsed >= _mem0.FhardLimit-int64(nFull) { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + return + } + } + } else { + libc.AtomicStoreNInt32(uintptr(unsafe.Pointer(&_mem0))+24, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + } + p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxMalloc})))(tls, nFull) + if p == uintptr(0) && _mem0.FalarmThreshold > 0 { + _sqlite3MallocAlarm(tls, nFull) + p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxMalloc})))(tls, nFull) + } + if p != 0 { + nFull = _sqlite3MallocSize(tls, p) + _sqlite3StatusUp(tls, SQLITE_STATUS_MEMORY_USED, nFull) + _sqlite3StatusUp(tls, int32(SQLITE_STATUS_MALLOC_COUNT), int32(1)) + } + *(*uintptr)(unsafe.Pointer(pp)) = p +} + +/* +** Maximum size of any single memory allocation. +** +** This is not a limit on the total amount of memory used. This is +** a limit on the size parameter to sqlite3_malloc() and sqlite3_realloc(). +** +** The upper bound is slightly less than 2GiB: 0x7ffffeff == 2,147,483,391 +** This provides a 256-byte safety margin for defense against 32-bit +** signed integer overflow bugs when computing memory allocation sizes. +** Paranoid applications might want to reduce the maximum allocation size +** further for an even larger safety margin. 0x3fffffff or 0x0fffffff +** or even smaller would be reasonable upper bounds on the size of a memory +** allocations for most applications. + */ + +// C documentation +// +// /* +// ** Allocate memory. This routine is like sqlite3_malloc() except that it +// ** assumes the memory subsystem has already been initialized. +// */ +func _sqlite3Malloc(tls *libc.TLS, n Tu64) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* p at bp+0 */ uintptr + if n == uint64(0) || n > uint64(SQLITE_MAX_ALLOCATION_SIZE) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + if _sqlite3Config.FbMemstat != 0 { + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) + _mallocWithAlarm(tls, int32(n), bp) + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + } else { + *(*uintptr)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxMalloc})))(tls, int32(n)) + } + } + /* IMP: R-11148-40995 */ + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** This version of the memory allocation is for use by the application. +// ** First make sure the memory subsystem is initialized, then do the +// ** allocation. +// */ +func Xsqlite3_malloc(tls *libc.TLS, n int32) (r uintptr) { + var v1 uintptr + _ = v1 + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + if n <= 0 { + v1 = uintptr(0) + } else { + v1 = _sqlite3Malloc(tls, uint64(n)) + } + return v1 +} + +func Xsqlite3_malloc64(tls *libc.TLS, n Tsqlite3_uint64) (r uintptr) { + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + return _sqlite3Malloc(tls, n) +} + +// C documentation +// +// /* +// ** TRUE if p is a lookaside memory allocation from db +// */ +func _isLookaside(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + return libc.BoolInt32(uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) && uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd)) +} + +// C documentation +// +// /* +// ** Return the size of a memory allocation previously obtained from +// ** sqlite3Malloc() or sqlite3_malloc(). +// */ +func _sqlite3MallocSize(tls *libc.TLS, p uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxSize})))(tls, p) +} + +func _lookasideMallocSize(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + var v1 int32 + _ = v1 + if p < (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle { + v1 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } else { + v1 = int32(LOOKASIDE_SMALL) + } + return v1 +} + +func _sqlite3DbMallocSize(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + if db != 0 { + if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd) { + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { + return int32(LOOKASIDE_SMALL) + } + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { + return int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + } + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxSize})))(tls, p) +} + +func Xsqlite3_msize(tls *libc.TLS, p uintptr) (r Tsqlite3_uint64) { + var v1 int32 + _ = v1 + if p != 0 { + v1 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxSize})))(tls, p) + } else { + v1 = 0 + } + return uint64(v1) +} + +// C documentation +// +// /* +// ** Free memory previously obtained from sqlite3Malloc(). +// */ +func Xsqlite3_free(tls *libc.TLS, p uintptr) { + if p == uintptr(0) { + return + } /* IMP: R-49053-54554 */ + if _sqlite3Config.FbMemstat != 0 { + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) + _sqlite3StatusDown(tls, SQLITE_STATUS_MEMORY_USED, _sqlite3MallocSize(tls, p)) + _sqlite3StatusDown(tls, int32(SQLITE_STATUS_MALLOC_COUNT), int32(1)) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxFree})))(tls, p) + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + } else { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxFree})))(tls, p) + } +} + +// C documentation +// +// /* +// ** Add the size of memory allocation "p" to the count in +// ** *db->pnBytesFreed. +// */ +func _measureAllocationSize(tls *libc.TLS, db uintptr, p uintptr) { + *(*int32)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed)) += _sqlite3DbMallocSize(tls, db, p) +} + +// C documentation +// +// /* +// ** Free memory that might be associated with a particular database +// ** connection. Calling sqlite3DbFree(D,X) for X==0 is a harmless no-op. +// ** The sqlite3DbFreeNN(D,X) version requires that X be non-NULL. +// */ +func _sqlite3DbFreeNN(tls *libc.TLS, db uintptr, p uintptr) { + var pBuf, pBuf1 uintptr + _, _ = pBuf, pBuf1 + if db != 0 { + if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { + pBuf = p + (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = pBuf + return + } + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { + pBuf1 = p + (*TLookasideSlot)(unsafe.Pointer(pBuf1)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = pBuf1 + return + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed != 0 { + _measureAllocationSize(tls, db, p) + return + } + } + Xsqlite3_free(tls, p) +} + +func _sqlite3DbNNFreeNN(tls *libc.TLS, db uintptr, p uintptr) { + var pBuf, pBuf1 uintptr + _, _ = pBuf, pBuf1 + if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { + pBuf = p + (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = pBuf + return + } + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { + pBuf1 = p + (*TLookasideSlot)(unsafe.Pointer(pBuf1)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = pBuf1 + return + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed != 0 { + _measureAllocationSize(tls, db, p) + return + } + Xsqlite3_free(tls, p) +} + +func _sqlite3DbFree(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _sqlite3DbFreeNN(tls, db, p) + } +} + +// C documentation +// +// /* +// ** Change the size of an existing memory allocation +// */ +func _sqlite3Realloc(tls *libc.TLS, pOld uintptr, nBytes Tu64) (r uintptr) { + var nDiff, nNew, nOld int32 + var nUsed, v1 Tsqlite3_int64 + var pNew uintptr + var v2 bool + _, _, _, _, _, _, _ = nDiff, nNew, nOld, nUsed, pNew, v1, v2 + if pOld == uintptr(0) { + return _sqlite3Malloc(tls, nBytes) /* IMP: R-04300-56712 */ + } + if nBytes == uint64(0) { + Xsqlite3_free(tls, pOld) /* IMP: R-26507-47431 */ + return uintptr(0) + } + if nBytes >= uint64(0x7fffff00) { + /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ + return uintptr(0) + } + nOld = _sqlite3MallocSize(tls, pOld) + /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second + ** argument to xRealloc is always a value returned by a prior call to + ** xRoundup. */ + nNew = (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRoundup})))(tls, int32(nBytes)) + if nOld == nNew { + pNew = pOld + } else { + if _sqlite3Config.FbMemstat != 0 { + Xsqlite3_mutex_enter(tls, _mem0.Fmutex) + _sqlite3StatusHighwater(tls, int32(SQLITE_STATUS_MALLOC_SIZE), int32(nBytes)) + nDiff = nNew - nOld + if v2 = nDiff > 0; v2 { + v1 = _sqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + nUsed = v1 + } + if v2 && v1 >= _mem0.FalarmThreshold-int64(nDiff) { + _sqlite3MallocAlarm(tls, nDiff) + if _mem0.FhardLimit > 0 && nUsed >= _mem0.FhardLimit-int64(nDiff) { + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + return uintptr(0) + } + } + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRealloc})))(tls, pOld, nNew) + if pNew == uintptr(0) && _mem0.FalarmThreshold > 0 { + _sqlite3MallocAlarm(tls, int32(nBytes)) + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRealloc})))(tls, pOld, nNew) + } + if pNew != 0 { + nNew = _sqlite3MallocSize(tls, pNew) + _sqlite3StatusUp(tls, SQLITE_STATUS_MEMORY_USED, nNew-nOld) + } + Xsqlite3_mutex_leave(tls, _mem0.Fmutex) + } else { + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fm.FxRealloc})))(tls, pOld, nNew) + } + } + /* IMP: R-11148-40995 */ + return pNew +} + +// C documentation +// +// /* +// ** The public interface to sqlite3Realloc. Make sure that the memory +// ** subsystem is initialized prior to invoking sqliteRealloc. +// */ +func Xsqlite3_realloc(tls *libc.TLS, pOld uintptr, n int32) (r uintptr) { + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + if n < 0 { + n = 0 + } /* IMP: R-26507-47431 */ + return _sqlite3Realloc(tls, pOld, uint64(n)) +} + +func Xsqlite3_realloc64(tls *libc.TLS, pOld uintptr, n Tsqlite3_uint64) (r uintptr) { + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + return _sqlite3Realloc(tls, pOld, n) +} + +// C documentation +// +// /* +// ** Allocate and zero memory. +// */ +func _sqlite3MallocZero(tls *libc.TLS, n Tu64) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3Malloc(tls, n) + if p != 0 { + libc.Xmemset(tls, p, 0, n) + } + return p +} + +// C documentation +// +// /* +// ** Allocate and zero memory. If the allocation fails, make +// ** the mallocFailed flag in the connection pointer. +// */ +func _sqlite3DbMallocZero(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3DbMallocRaw(tls, db, n) + if p != 0 { + libc.Xmemset(tls, p, 0, n) + } + return p +} + +// C documentation +// +// /* Finish the work of sqlite3DbMallocRawNN for the unusual and +// ** slower case when the allocation cannot be fulfilled using lookaside. +// */ +func _dbMallocRawFinish(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3Malloc(tls, n) + if !(p != 0) { + _sqlite3OomFault(tls, db) + } + return p +} + +// C documentation +// +// /* +// ** Allocate memory, either lookaside (if possible) or heap. +// ** If the allocation fails, set the mallocFailed flag in +// ** the connection pointer. +// ** +// ** If db!=0 and db->mallocFailed is true (indicating a prior malloc +// ** failure on the same database connection) then always return 0. +// ** Hence for a particular database connection, once malloc starts +// ** failing, it fails consistently until mallocFailed is reset. +// ** This is an important assumption. There are many places in the +// ** code that do things like this: +// ** +// ** int *a = (int*)sqlite3DbMallocRaw(db, 100); +// ** int *b = (int*)sqlite3DbMallocRaw(db, 200); +// ** if( b ) a[10] = 9; +// ** +// ** In other words, if a subsequent malloc (ex: "b") worked, it is assumed +// ** that all prior mallocs (ex: "a") worked too. +// ** +// ** The sqlite3MallocRawNN() variant guarantees that the "db" parameter is +// ** not a NULL pointer. +// */ +func _sqlite3DbMallocRaw(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { + var p uintptr + _ = p + if db != 0 { + return _sqlite3DbMallocRawNN(tls, db, n) + } + p = _sqlite3Malloc(tls, n) + return p +} + +func _sqlite3DbMallocRawNN(tls *libc.TLS, db uintptr, n Tu64) (r uintptr) { + var pBuf, v1, v2, v3, v4 uintptr + _, _, _, _, _ = pBuf, v1, v2, v3, v4 + if n > uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz) { + if !((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0) { + *(*Tu32)(unsafe.Pointer(db + 440 + 16 + 1*4))++ + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return uintptr(0) + } + } + return _dbMallocRawFinish(tls, db, n) + } + if n <= uint64(LOOKASIDE_SMALL) { + v1 = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + pBuf = v1 + if v1 != uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*Tu32)(unsafe.Pointer(db + 440 + 16))++ + return pBuf + } else { + v2 = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit + pBuf = v2 + if v2 != uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*Tu32)(unsafe.Pointer(db + 440 + 16))++ + return pBuf + } + } + } + v3 = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + pBuf = v3 + if v3 != uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*Tu32)(unsafe.Pointer(db + 440 + 16))++ + return pBuf + } else { + v4 = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit + pBuf = v4 + if v4 != uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = (*TLookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*Tu32)(unsafe.Pointer(db + 440 + 16))++ + return pBuf + } else { + *(*Tu32)(unsafe.Pointer(db + 440 + 16 + 2*4))++ + } + } + return _dbMallocRawFinish(tls, db, n) +} + +// C documentation +// +// /* +// ** Resize the block of memory pointed to by p to n bytes. If the +// ** resize fails, set the mallocFailed flag in the connection object. +// */ +func _sqlite3DbRealloc(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) { + if p == uintptr(0) { + return _sqlite3DbMallocRawNN(tls, db, n) + } + if uint64(p) < uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { + if n <= uint64(LOOKASIDE_SMALL) { + return p + } + } else { + if uint64(p) >= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { + if n <= uint64((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) { + return p + } + } + } + } + return _dbReallocFinish(tls, db, p, n) +} + +func _dbReallocFinish(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) { + var pNew uintptr + _ = pNew + pNew = uintptr(0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + if _isLookaside(tls, db, p) != 0 { + pNew = _sqlite3DbMallocRawNN(tls, db, n) + if pNew != 0 { + libc.Xmemcpy(tls, pNew, p, uint64(_lookasideMallocSize(tls, db, p))) + _sqlite3DbFree(tls, db, p) + } + } else { + pNew = _sqlite3Realloc(tls, p, n) + if !(pNew != 0) { + _sqlite3OomFault(tls, db) + } + } + } + return pNew +} + +// C documentation +// +// /* +// ** Attempt to reallocate p. If the reallocation fails, then free p +// ** and set the mallocFailed flag in the database connection. +// */ +func _sqlite3DbReallocOrFree(tls *libc.TLS, db uintptr, p uintptr, n Tu64) (r uintptr) { + var pNew uintptr + _ = pNew + pNew = _sqlite3DbRealloc(tls, db, p, n) + if !(pNew != 0) { + _sqlite3DbFree(tls, db, p) + } + return pNew +} + +// C documentation +// +// /* +// ** Make a copy of a string in memory obtained from sqliteMalloc(). These +// ** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This +// ** is because when memory debugging is turned on, these two functions are +// ** called via macros that record the current file and line number in the +// ** ThreadData structure. +// */ +func _sqlite3DbStrDup(tls *libc.TLS, db uintptr, z uintptr) (r uintptr) { + var n Tsize_t + var zNew uintptr + _, _ = n, zNew + if z == uintptr(0) { + return uintptr(0) + } + n = libc.Xstrlen(tls, z) + uint64(1) + zNew = _sqlite3DbMallocRaw(tls, db, n) + if zNew != 0 { + libc.Xmemcpy(tls, zNew, z, n) + } + return zNew +} + +func _sqlite3DbStrNDup(tls *libc.TLS, db uintptr, z uintptr, n Tu64) (r uintptr) { + var zNew, v1 uintptr + _, _ = zNew, v1 + if z != 0 { + v1 = _sqlite3DbMallocRawNN(tls, db, n+uint64(1)) + } else { + v1 = uintptr(0) + } + zNew = v1 + if zNew != 0 { + libc.Xmemcpy(tls, zNew, z, n) + *(*int8)(unsafe.Pointer(zNew + uintptr(n))) = 0 + } + return zNew +} + +// C documentation +// +// /* +// ** The text between zStart and zEnd represents a phrase within a larger +// ** SQL statement. Make a copy of this phrase in space obtained form +// ** sqlite3DbMalloc(). Omit leading and trailing whitespace. +// */ +func _sqlite3DbSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var n int32 + _ = n + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart)))])&int32(0x01) != 0 { + zStart++ + } + n = int32(int64(zEnd) - int64(zStart)) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart + uintptr(n-int32(1)))))])&int32(0x01) != 0 { + n-- + } + return _sqlite3DbStrNDup(tls, db, zStart, uint64(n)) +} + +// C documentation +// +// /* +// ** Free any prior content in *pz and replace it with a copy of zNew. +// */ +func _sqlite3SetString(tls *libc.TLS, pz uintptr, db uintptr, zNew uintptr) { + var z uintptr + _ = z + z = _sqlite3DbStrDup(tls, db, zNew) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pz))) + *(*uintptr)(unsafe.Pointer(pz)) = z +} + +// C documentation +// +// /* +// ** Call this routine to record the fact that an OOM (out-of-memory) error +// ** has happened. This routine will set db->mallocFailed, and also +// ** temporarily disable the lookaside memory allocator and interrupt +// ** any running VDBEs. +// ** +// ** Always return a NULL pointer so that this routine can be invoked using +// ** +// ** return sqlite3OomFault(db); +// ** +// ** and thereby avoid unnecessary stack frame allocations for the overwhelmingly +// ** common case where no OOM occurs. +// */ +func _sqlite3OomFault(tls *libc.TLS, db uintptr) (r uintptr) { + var pParse uintptr + _ = pParse + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).FbBenignMalloc) == 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed = uint8(1) + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec > 0 { + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(1), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + if (*Tsqlite3)(unsafe.Pointer(db)).FpParse != 0 { + _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1650, 0) + (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).Frc = int32(SQLITE_NOMEM) + pParse = (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).FpOuterParse + for { + if !(pParse != 0) { + break + } + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + goto _1 + _1: + ; + pParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse + } + } + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** This routine reactivates the memory allocator and clears the +// ** db->mallocFailed flag as necessary. +// ** +// ** The memory allocator is not restarted if there are running +// ** VDBEs. +// */ +func _sqlite3OomClear(tls *libc.TLS, db uintptr) { + var v1 int32 + _ = v1 + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec == 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed = uint8(0) + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + v1 = 0 + } else { + v1 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v1) + } +} + +// C documentation +// +// /* +// ** Take actions at the end of an API call to deal with error codes. +// */ +func _apiHandleError(tls *libc.TLS, db uintptr, rc int32) (r int32) { + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<mallocFailed + ** is unsafe, as is the call to sqlite3Error(). + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 || rc != 0 { + return _apiHandleError(tls, db, rc) + } + return 0 +} + +/************** End of malloc.c **********************************************/ +/************** Begin file printf.c ******************************************/ +/* +** The "printf" code that follows dates from the 1980's. It is in +** the public domain. +** +************************************************************************** +** +** This file contains code for a set of "printf"-like routines. These +** routines format strings much like the printf() from the standard C +** library, though the implementation here has enhancements to support +** SQLite. + */ +/* #include "sqliteInt.h" */ + +/* +** Conversion types fall into various categories as defined by the +** following enumeration. + */ +/* The rest are extensions, not normally found in printf() */ + +// C documentation +// +// /* +// ** An "etByte" is an 8-bit unsigned value. +// */ +type TetByte = uint8 + +type etByte = TetByte + +// C documentation +// +// /* +// ** Each builtin conversion character (ex: the 'd' in "%d") is described +// ** by an instance of the following structure +// */ +type Tet_info = struct { + Ffmttype int8 + Fbase TetByte + Fflags TetByte + Ftype1 TetByte + Fcharset TetByte + Fprefix TetByte +} + +type et_info = Tet_info + +/* +** Allowed values for et_info.flags + */ + +// C documentation +// +// /* +// ** The following table is searched linearly, so it is good to put the +// ** most frequently used conversion types first. +// */ +var _aDigits = [33]int8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} +var _aPrefix = [7]int8{'-', 'x', '0', 0, 'X', '0'} +var _fmtinfo = [23]Tet_info{ + 0: { + Ffmttype: int8('d'), + Fbase: uint8(10), + Fflags: uint8(1), + Ftype1: uint8(etDECIMAL), + }, + 1: { + Ffmttype: int8('s'), + Fflags: uint8(4), + Ftype1: uint8(etSTRING), + }, + 2: { + Ffmttype: int8('g'), + Fflags: uint8(1), + Ftype1: uint8(etGENERIC), + Fcharset: uint8(30), + }, + 3: { + Ffmttype: int8('z'), + Fflags: uint8(4), + Ftype1: uint8(etDYNSTRING), + }, + 4: { + Ffmttype: int8('q'), + Fflags: uint8(4), + Ftype1: uint8(etSQLESCAPE), + }, + 5: { + Ffmttype: int8('Q'), + Fflags: uint8(4), + Ftype1: uint8(etSQLESCAPE2), + }, + 6: { + Ffmttype: int8('w'), + Fflags: uint8(4), + Ftype1: uint8(etSQLESCAPE3), + }, + 7: { + Ffmttype: int8('c'), + Ftype1: uint8(etCHARX), + }, + 8: { + Ffmttype: int8('o'), + Fbase: uint8(8), + Fprefix: uint8(2), + }, + 9: { + Ffmttype: int8('u'), + Fbase: uint8(10), + Ftype1: uint8(etDECIMAL), + }, + 10: { + Ffmttype: int8('x'), + Fbase: uint8(16), + Fcharset: uint8(16), + Fprefix: uint8(1), + }, + 11: { + Ffmttype: int8('X'), + Fbase: uint8(16), + Fprefix: uint8(4), + }, + 12: { + Ffmttype: int8('f'), + Fflags: uint8(1), + Ftype1: uint8(etFLOAT), + }, + 13: { + Ffmttype: int8('e'), + Fflags: uint8(1), + Ftype1: uint8(etEXP), + Fcharset: uint8(30), + }, + 14: { + Ffmttype: int8('E'), + Fflags: uint8(1), + Ftype1: uint8(etEXP), + Fcharset: uint8(14), + }, + 15: { + Ffmttype: int8('G'), + Fflags: uint8(1), + Ftype1: uint8(etGENERIC), + Fcharset: uint8(14), + }, + 16: { + Ffmttype: int8('i'), + Fbase: uint8(10), + Fflags: uint8(1), + Ftype1: uint8(etDECIMAL), + }, + 17: { + Ffmttype: int8('n'), + Ftype1: uint8(etSIZE), + }, + 18: { + Ffmttype: int8('%'), + Ftype1: uint8(etPERCENT), + }, + 19: { + Ffmttype: int8('p'), + Fbase: uint8(16), + Ftype1: uint8(etPOINTER), + Fprefix: uint8(1), + }, + 20: { + Ffmttype: int8('T'), + Ftype1: uint8(etTOKEN), + }, + 21: { + Ffmttype: int8('S'), + Ftype1: uint8(etSRCITEM), + }, + 22: { + Ffmttype: int8('r'), + Fbase: uint8(10), + Fflags: uint8(1), + Ftype1: uint8(etORDINAL), + }, +} + +/* Notes: +** +** %S Takes a pointer to SrcItem. Shows name or database.name +** %!S Like %S but prefer the zName over the zAlias + */ + +// C documentation +// +// /* +// ** Set the StrAccum object to an error mode. +// */ +func _sqlite3StrAccumSetError(tls *libc.TLS, p uintptr, eError Tu8) { + (*TStrAccum)(unsafe.Pointer(p)).FaccError = eError + if (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc != 0 { + Xsqlite3_str_reset(tls, p) + } + if int32(eError) == int32(SQLITE_TOOBIG) { + _sqlite3ErrorToParser(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, int32(eError)) + } +} + +// C documentation +// +// /* +// ** Extra argument values from a PrintfArguments object +// */ +func _getIntArg(tls *libc.TLS, p uintptr) (r Tsqlite3_int64) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + if (*TPrintfArguments)(unsafe.Pointer(p)).FnArg <= (*TPrintfArguments)(unsafe.Pointer(p)).FnUsed { + return 0 + } + v2 = p + 4 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + return Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer((*TPrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(v1)*8))) +} + +func _getDoubleArg(tls *libc.TLS, p uintptr) (r float64) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + if (*TPrintfArguments)(unsafe.Pointer(p)).FnArg <= (*TPrintfArguments)(unsafe.Pointer(p)).FnUsed { + return float64(0) + } + v2 = p + 4 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + return Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer((*TPrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(v1)*8))) +} + +func _getTextArg(tls *libc.TLS, p uintptr) (r uintptr) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + if (*TPrintfArguments)(unsafe.Pointer(p)).FnArg <= (*TPrintfArguments)(unsafe.Pointer(p)).FnUsed { + return uintptr(0) + } + v2 = p + 4 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + return Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer((*TPrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(v1)*8))) +} + +// C documentation +// +// /* +// ** Allocate memory for a temporary buffer needed for printf rendering. +// ** +// ** If the requested size of the temp buffer is larger than the size +// ** of the output buffer in pAccum, then cause an SQLITE_TOOBIG error. +// ** Do the size check before the memory allocation to prevent rogue +// ** SQL from requesting large allocations using the precision or width +// ** field of the printf() function. +// */ +func _printfTempBuf(tls *libc.TLS, pAccum uintptr, n Tsqlite3_int64) (r uintptr) { + var z uintptr + _ = z + if (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FaccError != 0 { + return uintptr(0) + } + if n > int64((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc) && n > int64((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FmxAlloc) { + _sqlite3StrAccumSetError(tls, pAccum, uint8(SQLITE_TOOBIG)) + return uintptr(0) + } + z = _sqlite3DbMallocRaw(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, uint64(n)) + if z == uintptr(0) { + _sqlite3StrAccumSetError(tls, pAccum, uint8(SQLITE_NOMEM)) + } + return z +} + +/* +** On machines with a small stack size, you can redefine the +** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. + */ + +/* +** Hard limit on the precision of floating-point conversions. + */ + +// C documentation +// +// /* +// ** Render a string given by "fmt" into the StrAccum object. +// */ +func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_list) { + bp := tls.Alloc(144) + defer tls.Free(144) + var bArgList, base Tu8 + var bufpt, cset, escarg, infop, pArgList, pExpr, pItem, pSel, pToken, pre, z, zExtra, zOut, v103, v11, v14, v15, v17, v20, v21, v23, v24, v4, v45, v46, v47, v48, v49, v52, v55, v57, v59, v61, v62, v64, v67, v68, v70, v72, v75, v76, v77, v78, v79, v80, v81, v82, v83, v89, v91, v94, v98, p92 uintptr + var c, e2, exp, i, iRound, idx, ii, isnull, ix, j, length, nOut, nPad, needQuote, nn, precision, width, x, v10, v110, v111, v16, v18, v19, v2, v22, v3, v51, v56, v58, v60, v65, v66, v71, v73, v74, v85, v86, v87, v88, v90, v93, v96, v97 int32 + var cThousand, done, flag_alternateform, flag_altform2, flag_dp, flag_leftjustify, flag_long, flag_prefix, flag_rtz, flag_zeropad, xtype, v5, v6, v7, v8, v9 TetByte + var ch, px, wx uint32 + var ch1, prefix, q, x1, v101, v107, v54 int8 + var i1, j1, k, n1, nCopyBytes, nPrior, szBufNeeded, v, v100, v104, v106, v108, v109 Ti64 + var longvalue Tsqlite_uint64 + var n Tu64 + var realvalue float64 + var v102, v12 bool + var _ /* buf at bp+0 */ [70]int8 + var _ /* s at bp+72 */ TFpDecode + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bArgList, base, bufpt, c, cThousand, ch, ch1, cset, done, e2, escarg, exp, flag_alternateform, flag_altform2, flag_dp, flag_leftjustify, flag_long, flag_prefix, flag_rtz, flag_zeropad, i, i1, iRound, idx, ii, infop, isnull, ix, j, j1, k, length, longvalue, n, n1, nCopyBytes, nOut, nPad, nPrior, needQuote, nn, pArgList, pExpr, pItem, pSel, pToken, pre, precision, prefix, px, q, realvalue, szBufNeeded, v, width, wx, x, x1, xtype, z, zExtra, zOut, v10, v100, v101, v102, v103, v104, v106, v107, v108, v109, v11, v110, v111, v12, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v3, v4, v45, v46, v47, v48, v49, v5, v51, v52, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v64, v65, v66, v67, v68, v7, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v8, v80, v81, v82, v83, v85, v86, v87, v88, v89, v9, v90, v91, v93, v94, v96, v97, v98, p92 /* Thousands separator for %d and %u */ + xtype = uint8(etINVALID) /* Size of the rendering buffer */ + zExtra = uintptr(0) /* True if trailing zeros should be removed */ + pArgList = uintptr(0) /* Conversion buffer */ + /* pAccum never starts out with an empty buffer that was obtained from + ** malloc(). This precondition is required by the mprintf("%z...") + ** optimization. */ + bufpt = uintptr(0) + if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_SQLFUNC) != 0 { + pArgList = libc.VaUintptr(&ap) + bArgList = uint8(1) + } else { + bArgList = uint8(0) + } + for { + v2 = int32(*(*int8)(unsafe.Pointer(fmt))) + c = v2 + if !(v2 != 0) { + break + } + if c != int32('%') { + bufpt = fmt + for cond := true; cond; cond = *(*int8)(unsafe.Pointer(fmt)) != 0 && int32(*(*int8)(unsafe.Pointer(fmt))) != int32('%') { + fmt++ + } + Xsqlite3_str_append(tls, pAccum, bufpt, int32(int64(fmt)-int64(bufpt))) + if int32(*(*int8)(unsafe.Pointer(fmt))) == 0 { + break + } + } + fmt++ + v4 = fmt + v3 = int32(*(*int8)(unsafe.Pointer(v4))) + c = v3 + if v3 == 0 { + Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1664, int32(1)) + break + } + /* Find out what flags are present */ + v9 = libc.Uint8FromInt32(0) + flag_zeropad = v9 + v8 = v9 + flag_altform2 = v8 + v7 = v8 + flag_alternateform = v7 + v6 = v7 + cThousand = v6 + v5 = v6 + flag_prefix = v5 + flag_leftjustify = v5 + done = uint8(0) + width = 0 + flag_long = uint8(0) + precision = -int32(1) + for { + switch c { + case int32('-'): + flag_leftjustify = uint8(1) + case int32('+'): + flag_prefix = uint8('+') + case int32(' '): + flag_prefix = uint8(' ') + case int32('#'): + flag_alternateform = uint8(1) + case int32('!'): + flag_altform2 = uint8(1) + case int32('0'): + flag_zeropad = uint8(1) + case int32(','): + cThousand = uint8(',') + default: + done = uint8(1) + case int32('l'): + flag_long = uint8(1) + fmt++ + v14 = fmt + c = int32(*(*int8)(unsafe.Pointer(v14))) + if c == int32('l') { + fmt++ + v15 = fmt + c = int32(*(*int8)(unsafe.Pointer(v15))) + flag_long = uint8(2) + } + done = uint8(1) + case int32('1'): + fallthrough + case int32('2'): + fallthrough + case int32('3'): + fallthrough + case int32('4'): + fallthrough + case int32('5'): + fallthrough + case int32('6'): + fallthrough + case int32('7'): + fallthrough + case int32('8'): + fallthrough + case int32('9'): + wx = uint32(c - int32('0')) + for { + fmt++ + v17 = fmt + v16 = int32(*(*int8)(unsafe.Pointer(v17))) + c = v16 + if !(v16 >= int32('0') && c <= int32('9')) { + break + } + wx = wx*uint32(10) + uint32(c) - uint32('0') + } + width = int32(wx & uint32(0x7fffffff)) + if c != int32('.') && c != int32('l') { + done = uint8(1) + } else { + fmt-- + } + case int32('*'): + if bArgList != 0 { + width = int32(_getIntArg(tls, pArgList)) + } else { + width = libc.VaInt32(&ap) + } + if width < 0 { + flag_leftjustify = uint8(1) + if width >= -int32(2147483647) { + v18 = -width + } else { + v18 = 0 + } + width = v18 + } + v19 = int32(*(*int8)(unsafe.Pointer(fmt + 1))) + c = v19 + if v19 != int32('.') && c != int32('l') { + fmt++ + v20 = fmt + c = int32(*(*int8)(unsafe.Pointer(v20))) + done = uint8(1) + } + case int32('.'): + fmt++ + v21 = fmt + c = int32(*(*int8)(unsafe.Pointer(v21))) + if c == int32('*') { + if bArgList != 0 { + precision = int32(_getIntArg(tls, pArgList)) + } else { + precision = libc.VaInt32(&ap) + } + if precision < 0 { + if precision >= -int32(2147483647) { + v22 = -precision + } else { + v22 = -int32(1) + } + precision = v22 + } + fmt++ + v23 = fmt + c = int32(*(*int8)(unsafe.Pointer(v23))) + } else { + px = uint32(0) + for c >= int32('0') && c <= int32('9') { + px = px*uint32(10) + uint32(c) - uint32('0') + fmt++ + v24 = fmt + c = int32(*(*int8)(unsafe.Pointer(v24))) + } + precision = int32(px & uint32(0x7fffffff)) + } + if c == int32('l') { + fmt-- + } else { + done = uint8(1) + } + break + } + goto _13 + _13: + ; + if v12 = !(done != 0); v12 { + fmt++ + v11 = fmt + v10 = int32(*(*int8)(unsafe.Pointer(v11))) + c = v10 + } + if !(v12 && v10 != 0) { + break + } + } + /* Fetch the info entry for the field */ + infop = uintptr(unsafe.Pointer(&_fmtinfo)) + xtype = uint8(etINVALID) + idx = 0 + for { + if !(idx < int32(libc.Uint64FromInt64(138)/libc.Uint64FromInt64(6))) { + break + } + if c == int32(_fmtinfo[idx].Ffmttype) { + infop = uintptr(unsafe.Pointer(&_fmtinfo)) + uintptr(idx)*6 + xtype = (*Tet_info)(unsafe.Pointer(infop)).Ftype1 + break + } + goto _25 + _25: + ; + idx++ + } + /* + ** At this point, variables are initialized as follows: + ** + ** flag_alternateform TRUE if a '#' is present. + ** flag_altform2 TRUE if a '!' is present. + ** flag_prefix '+' or ' ' or zero + ** flag_leftjustify TRUE if a '-' is present or if the + ** field width was negative. + ** flag_zeropad TRUE if the width began with 0. + ** flag_long 1 for "l", 2 for "ll" + ** width The specified field width. This is + ** always non-negative. Zero is the default. + ** precision The specified precision. The default + ** is -1. + ** xtype The class of the conversion. + ** infop Pointer to the appropriate info struct. + */ + switch int32(xtype) { + case int32(etPOINTER): + goto _26 + case etRADIX: + goto _27 + case int32(etORDINAL): + goto _28 + case int32(etDECIMAL): + goto _29 + case int32(etGENERIC): + goto _30 + case int32(etEXP): + goto _31 + case int32(etFLOAT): + goto _32 + case int32(etSIZE): + goto _33 + case int32(etPERCENT): + goto _34 + case int32(etCHARX): + goto _35 + case int32(etDYNSTRING): + goto _36 + case int32(etSTRING): + goto _37 + case int32(etSQLESCAPE3): + goto _38 + case int32(etSQLESCAPE2): + goto _39 + case int32(etSQLESCAPE): + goto _40 + case int32(etTOKEN): + goto _41 + case int32(etSRCITEM): + goto _42 + default: + goto _43 + } + goto _44 + _26: + ; + flag_long = uint8(2) + _28: + ; + _27: + ; + cThousand = uint8(0) + _29: + ; + if int32((*Tet_info)(unsafe.Pointer(infop)).Fflags)&int32(FLAG_SIGNED) != 0 { + if bArgList != 0 { + v = _getIntArg(tls, pArgList) + } else { + if flag_long != 0 { + if int32(flag_long) == int32(2) { + v = libc.VaInt64(&ap) + } else { + v = libc.VaInt64(&ap) + } + } else { + v = int64(libc.VaInt32(&ap)) + } + } + if v < 0 { + longvalue = uint64(^v) + longvalue++ + prefix = int8('-') + } else { + longvalue = uint64(v) + prefix = int8(flag_prefix) + } + } else { + if bArgList != 0 { + longvalue = uint64(_getIntArg(tls, pArgList)) + } else { + if flag_long != 0 { + if int32(flag_long) == int32(2) { + longvalue = libc.VaUint64(&ap) + } else { + longvalue = libc.VaUint64(&ap) + } + } else { + longvalue = uint64(libc.VaUint32(&ap)) + } + } + prefix = 0 + } + if longvalue == uint64(0) { + flag_alternateform = uint8(0) + } + if flag_zeropad != 0 && precision < width-libc.BoolInt32(int32(prefix) != 0) { + precision = width - libc.BoolInt32(int32(prefix) != 0) + } + if precision < libc.Int32FromInt32(SQLITE_PRINT_BUF_SIZE)-libc.Int32FromInt32(10)-libc.Int32FromInt32(SQLITE_PRINT_BUF_SIZE)/libc.Int32FromInt32(3) { + nOut = int32(SQLITE_PRINT_BUF_SIZE) + zOut = bp + } else { + n = uint64(precision) + uint64(10) + if cThousand != 0 { + n += uint64(precision / int32(3)) + } + v45 = _printfTempBuf(tls, pAccum, int64(n)) + zExtra = v45 + zOut = v45 + if zOut == uintptr(0) { + return + } + nOut = int32(n) + } + bufpt = zOut + uintptr(nOut-int32(1)) + if int32(xtype) == int32(etORDINAL) { + x = int32(longvalue % libc.Uint64FromInt32(10)) + if x >= int32(4) || longvalue/uint64(10)%uint64(10) == uint64(1) { + x = 0 + } + bufpt-- + v46 = bufpt + *(*int8)(unsafe.Pointer(v46)) = _zOrd[x*int32(2)+int32(1)] + bufpt-- + v47 = bufpt + *(*int8)(unsafe.Pointer(v47)) = _zOrd[x*int32(2)] + } + cset = uintptr(unsafe.Pointer(&_aDigits)) + uintptr((*Tet_info)(unsafe.Pointer(infop)).Fcharset) + base = (*Tet_info)(unsafe.Pointer(infop)).Fbase + for cond := true; cond; cond = longvalue > uint64(0) { /* Convert to ascii */ + bufpt-- + v48 = bufpt + *(*int8)(unsafe.Pointer(v48)) = *(*int8)(unsafe.Pointer(cset + uintptr(longvalue%uint64(base)))) + longvalue = longvalue / uint64(base) + } + length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) + for precision > length { + bufpt-- + v49 = bufpt + *(*int8)(unsafe.Pointer(v49)) = int8('0') /* Zero pad */ + length++ + } + if cThousand != 0 { + nn = (length - int32(1)) / int32(3) /* Number of "," to insert */ + ix = (length-int32(1))%int32(3) + int32(1) + bufpt -= uintptr(nn) + idx = 0 + for { + if !(nn > 0) { + break + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(idx))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(idx+nn))) + ix-- + if ix == 0 { + idx++ + v51 = idx + *(*int8)(unsafe.Pointer(bufpt + uintptr(v51))) = int8(cThousand) + nn-- + ix = int32(3) + } + goto _50 + _50: + ; + idx++ + } + } + if prefix != 0 { + bufpt-- + v52 = bufpt + *(*int8)(unsafe.Pointer(v52)) = prefix + } /* Add sign */ + if flag_alternateform != 0 && (*Tet_info)(unsafe.Pointer(infop)).Fprefix != 0 { + pre = uintptr(unsafe.Pointer(&_aPrefix)) + uintptr((*Tet_info)(unsafe.Pointer(infop)).Fprefix) + for { + v54 = *(*int8)(unsafe.Pointer(pre)) + x1 = v54 + if !(int32(v54) != 0) { + break + } + bufpt-- + v55 = bufpt + *(*int8)(unsafe.Pointer(v55)) = x1 + goto _53 + _53: + ; + pre++ + } + } + length = int32(t__predefined_ptrdiff_t(zOut+uintptr(nOut-int32(1))) - int64(bufpt)) + goto _44 + _32: + ; + _31: + ; + _30: + ; + if bArgList != 0 { + realvalue = _getDoubleArg(tls, pArgList) + } else { + realvalue = libc.VaFloat64(&ap) + } + if precision < 0 { + precision = int32(6) + } /* Set default precision */ + if precision > int32(SQLITE_FP_PRECISION_LIMIT) { + precision = int32(SQLITE_FP_PRECISION_LIMIT) + } + if int32(xtype) == int32(etFLOAT) { + iRound = -precision + } else { + if int32(xtype) == int32(etGENERIC) { + if precision == 0 { + precision = int32(1) + } + iRound = precision + } else { + iRound = precision + int32(1) + } + } + if flag_altform2 != 0 { + v56 = int32(26) + } else { + v56 = int32(16) + } + _sqlite3FpDecode(tls, bp+72, realvalue, iRound, v56) + if (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FisSpecial != 0 { + if int32((*(*TFpDecode)(unsafe.Pointer(bp + 72))).FisSpecial) == int32(2) { + if flag_zeropad != 0 { + v57 = __ccgo_ts + 1666 + } else { + v57 = __ccgo_ts + 1671 + } + bufpt = v57 + length = _sqlite3Strlen30(tls, bufpt) + goto _44 + } else { + if flag_zeropad != 0 { + *(*int8)(unsafe.Pointer((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fz)) = int8('9') + (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FiDP = int32(1000) + (*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fn = int32(1) + } else { + libc.Xmemcpy(tls, bp, __ccgo_ts+1675, uint64(5)) + bufpt = bp + if int32((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fsign) == int32('-') { + /* no-op */ + } else { + if flag_prefix != 0 { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(flag_prefix) + } else { + bufpt++ + } + } + length = _sqlite3Strlen30(tls, bufpt) + goto _44 + } + } + } + if int32((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fsign) == int32('-') { + prefix = int8('-') + } else { + prefix = int8(flag_prefix) + } + exp = (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FiDP - int32(1) + if int32(xtype) == int32(etGENERIC) && precision > 0 { + precision-- + } + /* + ** If the field type is etGENERIC, then convert to either etEXP + ** or etFLOAT, as appropriate. + */ + if int32(xtype) == int32(etGENERIC) { + flag_rtz = libc.BoolUint8(!(flag_alternateform != 0)) + if exp < -int32(4) || exp > precision { + xtype = uint8(etEXP) + } else { + precision = precision - exp + xtype = uint8(etFLOAT) + } + } else { + flag_rtz = flag_altform2 + } + if int32(xtype) == int32(etEXP) { + e2 = 0 + } else { + e2 = (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FiDP - int32(1) + } + bufpt = bp + /* Size of a temporary buffer needed */ + if e2 > 0 { + v58 = e2 + } else { + v58 = 0 + } + szBufNeeded = int64(v58) + int64(precision) + int64(width) + int64(15) + if cThousand != 0 && e2 > 0 { + szBufNeeded += int64((e2 + int32(2)) / int32(3)) + } + if szBufNeeded > int64(SQLITE_PRINT_BUF_SIZE) { + v59 = _printfTempBuf(tls, pAccum, szBufNeeded) + zExtra = v59 + bufpt = v59 + if bufpt == uintptr(0) { + return + } + } + zOut = bufpt + if precision > 0 { + v60 = int32(1) + } else { + v60 = 0 + } + flag_dp = uint8(v60 | int32(flag_alternateform) | int32(flag_altform2)) + /* The sign in front of the number */ + if prefix != 0 { + v61 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v61)) = prefix + } + /* Digits prior to the decimal point */ + j = 0 + if e2 < 0 { + v62 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v62)) = int8('0') + } else { + for { + if !(e2 >= 0) { + break + } + v64 = bufpt + bufpt++ + if j < (*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fn { + v66 = j + j++ + v65 = int32(*(*int8)(unsafe.Pointer((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fz + uintptr(v66)))) + } else { + v65 = int32('0') + } + *(*int8)(unsafe.Pointer(v64)) = int8(v65) + if cThousand != 0 && e2%int32(3) == 0 && e2 > int32(1) { + v67 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v67)) = int8(',') + } + goto _63 + _63: + ; + e2-- + } + } + /* The decimal point */ + if flag_dp != 0 { + v68 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v68)) = int8('.') + } + /* "0" digits after the decimal point but before the first + ** significant digit of the number */ + e2++ + for { + if !(e2 < 0 && precision > 0) { + break + } + v70 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v70)) = int8('0') + goto _69 + _69: + ; + precision-- + e2++ + } + /* Significant digits after the decimal point */ + for { + v71 = precision + precision-- + if !(v71 > 0) { + break + } + v72 = bufpt + bufpt++ + if j < (*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fn { + v74 = j + j++ + v73 = int32(*(*int8)(unsafe.Pointer((*(*TFpDecode)(unsafe.Pointer(bp + 72))).Fz + uintptr(v74)))) + } else { + v73 = int32('0') + } + *(*int8)(unsafe.Pointer(v72)) = int8(v73) + } + /* Remove trailing zeros and the "." if no digits follow the "." */ + if flag_rtz != 0 && flag_dp != 0 { + for int32(*(*int8)(unsafe.Pointer(bufpt + uintptr(-libc.Int32FromInt32(1))))) == int32('0') { + bufpt-- + v75 = bufpt + *(*int8)(unsafe.Pointer(v75)) = 0 + } + if int32(*(*int8)(unsafe.Pointer(bufpt + uintptr(-libc.Int32FromInt32(1))))) == int32('.') { + if flag_altform2 != 0 { + v76 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v76)) = int8('0') + } else { + bufpt-- + v77 = bufpt + *(*int8)(unsafe.Pointer(v77)) = 0 + } + } + } + /* Add the "eNNN" suffix */ + if int32(xtype) == int32(etEXP) { + exp = (*(*TFpDecode)(unsafe.Pointer(bp + 72))).FiDP - int32(1) + v78 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v78)) = _aDigits[(*Tet_info)(unsafe.Pointer(infop)).Fcharset] + if exp < 0 { + v79 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v79)) = int8('-') + exp = -exp + } else { + v80 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v80)) = int8('+') + } + if exp >= int32(100) { + v81 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v81)) = int8(exp/libc.Int32FromInt32(100) + libc.Int32FromUint8('0')) /* 100's digit */ + exp %= int32(100) + } + v82 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v82)) = int8(exp/libc.Int32FromInt32(10) + libc.Int32FromUint8('0')) /* 10's digit */ + v83 = bufpt + bufpt++ + *(*int8)(unsafe.Pointer(v83)) = int8(exp%libc.Int32FromInt32(10) + libc.Int32FromUint8('0')) /* 1's digit */ + } + *(*int8)(unsafe.Pointer(bufpt)) = 0 + /* The converted number is in buf[] and zero terminated. Output it. + ** Note that the number is in the usual order, not reversed as with + ** integer conversions. */ + length = int32(int64(bufpt) - int64(zOut)) + bufpt = zOut + /* Special case: Add leading zeros if the flag_zeropad flag is + ** set and we are not left justified */ + if flag_zeropad != 0 && !(flag_leftjustify != 0) && length < width { + nPad = width - length + i = width + for { + if !(i >= nPad) { + break + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr(i-nPad))) + goto _84 + _84: + ; + i-- + } + i = libc.BoolInt32(int32(prefix) != 0) + for { + v85 = nPad + nPad-- + if !(v85 != 0) { + break + } + v86 = i + i++ + *(*int8)(unsafe.Pointer(bufpt + uintptr(v86))) = int8('0') + } + length = width + } + goto _44 + _33: + ; + if !(bArgList != 0) { + *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) + } + v87 = libc.Int32FromInt32(0) + width = v87 + length = v87 + goto _44 + _34: + ; + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8('%') + bufpt = bp + length = int32(1) + goto _44 + _35: + ; + if bArgList != 0 { + bufpt = _getTextArg(tls, pArgList) + length = int32(1) + if bufpt != 0 { + v89 = bufpt + bufpt++ + v88 = int32(*(*int8)(unsafe.Pointer(v89))) + c = v88 + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(v88) + if c&int32(0xc0) == int32(0xc0) { + for length < int32(4) && int32(*(*int8)(unsafe.Pointer(bufpt)))&int32(0xc0) == int32(0x80) { + v90 = length + length++ + v91 = bufpt + bufpt++ + (*(*[70]int8)(unsafe.Pointer(bp)))[v90] = *(*int8)(unsafe.Pointer(v91)) + } + } + } else { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = 0 + } + } else { + ch = libc.VaUint32(&ap) + if ch < uint32(0x00080) { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(ch & uint32(0xff)) + length = int32(1) + } else { + if ch < uint32(0x00800) { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(int32(0xc0) + int32(uint8(ch>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x1f)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(1)] = int8(int32(0x80) + int32(uint8(ch&libc.Uint32FromInt32(0x3f)))) + length = int32(2) + } else { + if ch < uint32(0x10000) { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(int32(0xe0) + int32(uint8(ch>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x0f)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(1)] = int8(int32(0x80) + int32(uint8(ch>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3f)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(2)] = int8(int32(0x80) + int32(uint8(ch&libc.Uint32FromInt32(0x3f)))) + length = int32(3) + } else { + (*(*[70]int8)(unsafe.Pointer(bp)))[0] = int8(int32(0xf0) + int32(uint8(ch>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x07)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(1)] = int8(int32(0x80) + int32(uint8(ch>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x3f)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(2)] = int8(int32(0x80) + int32(uint8(ch>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3f)))) + (*(*[70]int8)(unsafe.Pointer(bp)))[int32(3)] = int8(int32(0x80) + int32(uint8(ch&libc.Uint32FromInt32(0x3f)))) + length = int32(4) + } + } + } + } + if precision > int32(1) { + nPrior = int64(1) + width -= precision - int32(1) + if width > int32(1) && !(flag_leftjustify != 0) { + Xsqlite3_str_appendchar(tls, pAccum, width-int32(1), int8(' ')) + width = 0 + } + Xsqlite3_str_append(tls, pAccum, bp, length) + precision-- + for precision > int32(1) { + if nPrior > int64(precision-int32(1)) { + nPrior = int64(precision - int32(1)) + } + nCopyBytes = int64(length) * nPrior + if nCopyBytes+int64((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar) >= int64((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc) { + _sqlite3StrAccumEnlarge(tls, pAccum, nCopyBytes) + } + if (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FaccError != 0 { + break + } + Xsqlite3_str_append(tls, pAccum, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FzText+uintptr(int64((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar)-nCopyBytes), int32(nCopyBytes)) + precision = int32(int64(precision) - nPrior) + nPrior *= int64(2) + } + } + bufpt = bp + flag_altform2 = uint8(1) + goto adjust_width_for_utf8 + _37: + ; + _36: + ; + if bArgList != 0 { + bufpt = _getTextArg(tls, pArgList) + xtype = uint8(etSTRING) + } else { + bufpt = libc.VaUintptr(&ap) + } + if bufpt == uintptr(0) { + bufpt = __ccgo_ts + 1680 + } else { + if int32(xtype) == int32(etDYNSTRING) { + if (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar == uint32(0) && (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FmxAlloc != 0 && width == 0 && precision < 0 && int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FaccError) == 0 { + /* Special optimization for sqlite3_mprintf("%z..."): + ** Extend an existing memory allocation rather than creating + ** a new one. */ + (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FzText = bufpt + (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc = uint32(_sqlite3DbMallocSize(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, bufpt)) + (*Tsqlite3_str)(unsafe.Pointer(pAccum)).FnChar = uint32(int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt))) + p92 = pAccum + 29 + *(*Tu8)(unsafe.Pointer(p92)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p92))) | libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED)) + length = 0 + goto _44 + } + zExtra = bufpt + } + } + if precision >= 0 { + if flag_altform2 != 0 { + /* Set length to the number of bytes needed in order to display + ** precision characters */ + z = bufpt + for { + v93 = precision + precision-- + if !(v93 > 0 && *(*uint8)(unsafe.Pointer(z)) != 0) { + break + } + v94 = z + z++ + if int32(*(*uint8)(unsafe.Pointer(v94))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + } + } + } + length = int32(int64(z) - int64(bufpt)) + } else { + length = 0 + for { + if !(length < precision && *(*int8)(unsafe.Pointer(bufpt + uintptr(length))) != 0) { + break + } + goto _95 + _95: + ; + length++ + } + } + } else { + length = int32(0x7fffffff) & int32(libc.Xstrlen(tls, bufpt)) + } + adjust_width_for_utf8: + ; + if flag_altform2 != 0 && width > 0 { + /* Adjust width to account for extra bytes in UTF-8 characters */ + ii = length - int32(1) + for ii >= 0 { + v96 = ii + ii-- + if int32(*(*int8)(unsafe.Pointer(bufpt + uintptr(v96))))&int32(0xc0) == int32(0x80) { + width++ + } + } + } + goto _44 + _40: + ; /* %q: Escape ' characters */ + _39: + ; /* %Q: Escape ' and enclose in '...' */ + _38: + ; + if int32(xtype) == int32(etSQLESCAPE3) { + v97 = int32('"') + } else { + v97 = int32('\'') + } + q = int8(v97) + if bArgList != 0 { + escarg = _getTextArg(tls, pArgList) + } else { + escarg = libc.VaUintptr(&ap) + } + isnull = libc.BoolInt32(escarg == uintptr(0)) + if isnull != 0 { + if int32(xtype) == int32(etSQLESCAPE2) { + v98 = __ccgo_ts + 1681 + } else { + v98 = __ccgo_ts + 1686 + } + escarg = v98 + } + /* For %q, %Q, and %w, the precision is the number of bytes (or + ** characters if the ! flags is present) to use from the input. + ** Because of the extra quoting characters inserted, the number + ** of output characters may be larger than the precision. + */ + k = int64(precision) + v100 = libc.Int64FromInt32(0) + n1 = v100 + i1 = v100 + for { + if v102 = k != 0; v102 { + v101 = *(*int8)(unsafe.Pointer(escarg + uintptr(i1))) + ch1 = v101 + } + if !(v102 && int32(v101) != 0) { + break + } + if int32(ch1) == int32(q) { + n1++ + } + if flag_altform2 != 0 && int32(ch1)&int32(0xc0) == int32(0xc0) { + for int32(*(*int8)(unsafe.Pointer(escarg + uintptr(i1+int64(1)))))&int32(0xc0) == int32(0x80) { + i1++ + } + } + goto _99 + _99: + ; + i1++ + k-- + } + needQuote = libc.BoolInt32(!(isnull != 0) && int32(xtype) == int32(etSQLESCAPE2)) + n1 += i1 + int64(3) + if n1 > int64(SQLITE_PRINT_BUF_SIZE) { + v103 = _printfTempBuf(tls, pAccum, n1) + zExtra = v103 + bufpt = v103 + if bufpt == uintptr(0) { + return + } + } else { + bufpt = bp + } + j1 = 0 + if needQuote != 0 { + v104 = j1 + j1++ + *(*int8)(unsafe.Pointer(bufpt + uintptr(v104))) = q + } + k = i1 + i1 = 0 + for { + if !(i1 < k) { + break + } + v106 = j1 + j1++ + v107 = *(*int8)(unsafe.Pointer(escarg + uintptr(i1))) + ch1 = v107 + *(*int8)(unsafe.Pointer(bufpt + uintptr(v106))) = v107 + if int32(ch1) == int32(q) { + v108 = j1 + j1++ + *(*int8)(unsafe.Pointer(bufpt + uintptr(v108))) = ch1 + } + goto _105 + _105: + ; + i1++ + } + if needQuote != 0 { + v109 = j1 + j1++ + *(*int8)(unsafe.Pointer(bufpt + uintptr(v109))) = q + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(j1))) = 0 + length = int32(j1) + goto adjust_width_for_utf8 + _41: + ; + if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { + return + } + if flag_alternateform != 0 { + /* %#T means an Expr pointer that uses Expr.u.zToken */ + pExpr = libc.VaUintptr(&ap) + if pExpr != 0 && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)) { + Xsqlite3_str_appendall(tls, pAccum, *(*uintptr)(unsafe.Pointer(pExpr + 8))) + _sqlite3RecordErrorOffsetOfExpr(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, pExpr) + } + } else { + /* %T means a Token pointer */ + pToken = libc.VaUintptr(&ap) + if pToken != 0 && (*TToken)(unsafe.Pointer(pToken)).Fn != 0 { + Xsqlite3_str_append(tls, pAccum, (*TToken)(unsafe.Pointer(pToken)).Fz, int32((*TToken)(unsafe.Pointer(pToken)).Fn)) + _sqlite3RecordErrorByteOffset(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, (*TToken)(unsafe.Pointer(pToken)).Fz) + } + } + v110 = libc.Int32FromInt32(0) + width = v110 + length = v110 + goto _44 + _42: + ; + if int32((*Tsqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags)&int32(SQLITE_PRINTF_INTERNAL) == 0 { + return + } + pItem = libc.VaUintptr(&ap) + if (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 && !(flag_altform2 != 0) { + Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) + } else { + if (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { + if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { + Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) + Xsqlite3_str_append(tls, pAccum, __ccgo_ts+1693, int32(1)) + } + Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzName) + } else { + if (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { + Xsqlite3_str_appendall(tls, pAccum, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) + } else { + pSel = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect + if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_NestedFrom) != 0 { + Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1695, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + } else { + Xsqlite3_str_appendf(tls, pAccum, __ccgo_ts+1705, libc.VaList(bp+128, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + } + } + } + } + v111 = libc.Int32FromInt32(0) + width = v111 + length = v111 + goto _44 + _43: + ; + return + _44: + ; /* End switch over the format type */ + /* + ** The text of the conversion is pointed to by "bufpt" and is + ** "length" characters long. The field width is "width". Do + ** the output. Both length and width are in bytes, not characters, + ** at this point. If the "!" flag was present on string conversions + ** indicating that width and precision should be expressed in characters, + ** then the values have been translated prior to reaching this point. + */ + width -= length + if width > 0 { + if !(flag_leftjustify != 0) { + Xsqlite3_str_appendchar(tls, pAccum, width, int8(' ')) + } + Xsqlite3_str_append(tls, pAccum, bufpt, length) + if flag_leftjustify != 0 { + Xsqlite3_str_appendchar(tls, pAccum, width, int8(' ')) + } + } else { + Xsqlite3_str_append(tls, pAccum, bufpt, length) + } + if zExtra != 0 { + _sqlite3DbFree(tls, (*Tsqlite3_str)(unsafe.Pointer(pAccum)).Fdb, zExtra) + zExtra = uintptr(0) + } + goto _1 + _1: + ; + fmt++ + } /* End for loop over the format string */ +} + +var _zOrd = [9]int8{'t', 'h', 's', 't', 'n', 'd', 'r', 'd'} + +/* End of function */ + +// C documentation +// +// /* +// ** The z string points to the first character of a token that is +// ** associated with an error. If db does not already have an error +// ** byte offset recorded, try to compute the error byte offset for +// ** z and set the error byte offset in db. +// */ +func _sqlite3RecordErrorByteOffset(tls *libc.TLS, db uintptr, z uintptr) { + var pParse, zEnd, zText uintptr + _, _, _ = pParse, zEnd, zText + if db == uintptr(0) { + return + } + if (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset != -int32(2) { + return + } + pParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse + if pParse == uintptr(0) { + return + } + zText = (*TParse)(unsafe.Pointer(pParse)).FzTail + if zText == uintptr(0) { + return + } + zEnd = zText + uintptr(libc.Xstrlen(tls, zText)) + if uint64(z) >= uint64(zText) && uint64(z) < uint64(zEnd) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = int32(int64(z) - int64(zText)) + } +} + +// C documentation +// +// /* +// ** If pExpr has a byte offset for the start of a token, record that as +// ** as the error offset. +// */ +func _sqlite3RecordErrorOffsetOfExpr(tls *libc.TLS, db uintptr, pExpr uintptr) { + for pExpr != 0 && ((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) || *(*int32)(unsafe.Pointer(pExpr + 52)) <= 0) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } + if pExpr == uintptr(0) { + return + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = *(*int32)(unsafe.Pointer(pExpr + 52)) +} + +// C documentation +// +// /* +// ** Enlarge the memory allocation on a StrAccum object so that it is +// ** able to accept at least N more bytes of text. +// ** +// ** Return the number of bytes of text that StrAccum is able to accept +// ** after the attempted enlargement. The value returned might be zero. +// */ +func _sqlite3StrAccumEnlarge(tls *libc.TLS, p uintptr, N Ti64) (r int32) { + var szNew Ti64 + var zNew, zOld, v1, p2 uintptr + _, _, _, _, _ = szNew, zNew, zOld, v1, p2 + /* Only called if really needed */ + if (*TStrAccum)(unsafe.Pointer(p)).FaccError != 0 { + return 0 + } + if (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc == uint32(0) { + _sqlite3StrAccumSetError(tls, p, uint8(SQLITE_TOOBIG)) + return int32((*TStrAccum)(unsafe.Pointer(p)).FnAlloc - (*TStrAccum)(unsafe.Pointer(p)).FnChar - uint32(1)) + } else { + if int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&int32(SQLITE_PRINTF_MALLOCED) != 0 { + v1 = (*TStrAccum)(unsafe.Pointer(p)).FzText + } else { + v1 = uintptr(0) + } + zOld = v1 + szNew = int64((*TStrAccum)(unsafe.Pointer(p)).FnChar) + N + int64(1) + if szNew+int64((*TStrAccum)(unsafe.Pointer(p)).FnChar) <= int64((*TStrAccum)(unsafe.Pointer(p)).FmxAlloc) { + /* Force exponential buffer size growth as long as it does not overflow, + ** to avoid having to call this routine too often */ + szNew += int64((*TStrAccum)(unsafe.Pointer(p)).FnChar) + } + if szNew > int64((*TStrAccum)(unsafe.Pointer(p)).FmxAlloc) { + Xsqlite3_str_reset(tls, p) + _sqlite3StrAccumSetError(tls, p, uint8(SQLITE_TOOBIG)) + return 0 + } else { + (*TStrAccum)(unsafe.Pointer(p)).FnAlloc = uint32(int32(szNew)) + } + if (*TStrAccum)(unsafe.Pointer(p)).Fdb != 0 { + zNew = _sqlite3DbRealloc(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, zOld, uint64((*TStrAccum)(unsafe.Pointer(p)).FnAlloc)) + } else { + zNew = _sqlite3Realloc(tls, zOld, uint64((*TStrAccum)(unsafe.Pointer(p)).FnAlloc)) + } + if zNew != 0 { + if !(int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED) != libc.Int32FromInt32(0)) && (*TStrAccum)(unsafe.Pointer(p)).FnChar > uint32(0) { + libc.Xmemcpy(tls, zNew, (*TStrAccum)(unsafe.Pointer(p)).FzText, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar)) + } + (*TStrAccum)(unsafe.Pointer(p)).FzText = zNew + (*TStrAccum)(unsafe.Pointer(p)).FnAlloc = uint32(_sqlite3DbMallocSize(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, zNew)) + p2 = p + 29 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) | libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED)) + } else { + Xsqlite3_str_reset(tls, p) + _sqlite3StrAccumSetError(tls, p, uint8(SQLITE_NOMEM)) + return 0 + } + } + return int32(N) +} + +// C documentation +// +// /* +// ** Append N copies of character c to the given string buffer. +// */ +func Xsqlite3_str_appendchar(tls *libc.TLS, p uintptr, N int32, c int8) { + var v1, v3 int32 + var v2 bool + var v4 Tu32 + var v5 uintptr + _, _, _, _, _ = v1, v2, v3, v4, v5 + if v2 = int64((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar)+int64(N) >= int64((*Tsqlite3_str)(unsafe.Pointer(p)).FnAlloc); v2 { + v1 = _sqlite3StrAccumEnlarge(tls, p, int64(N)) + N = v1 + } + if v2 && v1 <= 0 { + return + } + for { + v3 = N + N-- + if !(v3 > 0) { + break + } + v5 = p + 24 + v4 = *(*Tu32)(unsafe.Pointer(v5)) + *(*Tu32)(unsafe.Pointer(v5))++ + *(*int8)(unsafe.Pointer((*Tsqlite3_str)(unsafe.Pointer(p)).FzText + uintptr(v4))) = c + } +} + +// C documentation +// +// /* +// ** The StrAccum "p" is not large enough to accept N new bytes of z[]. +// ** So enlarge if first, then do the append. +// ** +// ** This is a helper routine to sqlite3_str_append() that does special-case +// ** work (enlarging the buffer) using tail recursion, so that the +// ** sqlite3_str_append() routine can use fast calling semantics. +// */ +func _enlargeAndAppend(tls *libc.TLS, p uintptr, z uintptr, N int32) { + N = _sqlite3StrAccumEnlarge(tls, p, int64(N)) + if N > 0 { + libc.Xmemcpy(tls, (*TStrAccum)(unsafe.Pointer(p)).FzText+uintptr((*TStrAccum)(unsafe.Pointer(p)).FnChar), z, uint64(N)) + *(*Tu32)(unsafe.Pointer(p + 24)) += uint32(N) + } +} + +// C documentation +// +// /* +// ** Append N bytes of text from z to the StrAccum object. Increase the +// ** size of the memory allocation for StrAccum if necessary. +// */ +func Xsqlite3_str_append(tls *libc.TLS, p uintptr, z uintptr, N int32) { + if (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar+uint32(N) >= (*Tsqlite3_str)(unsafe.Pointer(p)).FnAlloc { + _enlargeAndAppend(tls, p, z, N) + } else { + if N != 0 { + *(*Tu32)(unsafe.Pointer(p + 24)) += uint32(N) + libc.Xmemcpy(tls, (*Tsqlite3_str)(unsafe.Pointer(p)).FzText+uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar-uint32(N)), z, uint64(N)) + } + } +} + +// C documentation +// +// /* +// ** Append the complete text of zero-terminated string z[] to the p string. +// */ +func Xsqlite3_str_appendall(tls *libc.TLS, p uintptr, z uintptr) { + Xsqlite3_str_append(tls, p, z, _sqlite3Strlen30(tls, z)) +} + +// C documentation +// +// /* +// ** Finish off a string by making sure it is zero-terminated. +// ** Return a pointer to the resulting string. Return a NULL +// ** pointer if any kind of error was encountered. +// */ +func _strAccumFinishRealloc(tls *libc.TLS, p uintptr) (r uintptr) { + var zText, p1 uintptr + _, _ = zText, p1 + zText = _sqlite3DbMallocRaw(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar+uint32(1))) + if zText != 0 { + libc.Xmemcpy(tls, zText, (*TStrAccum)(unsafe.Pointer(p)).FzText, uint64((*TStrAccum)(unsafe.Pointer(p)).FnChar+uint32(1))) + p1 = p + 29 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED)) + } else { + _sqlite3StrAccumSetError(tls, p, uint8(SQLITE_NOMEM)) + } + (*TStrAccum)(unsafe.Pointer(p)).FzText = zText + return zText +} + +func _sqlite3StrAccumFinish(tls *libc.TLS, p uintptr) (r uintptr) { + if (*TStrAccum)(unsafe.Pointer(p)).FzText != 0 { + *(*int8)(unsafe.Pointer((*TStrAccum)(unsafe.Pointer(p)).FzText + uintptr((*TStrAccum)(unsafe.Pointer(p)).FnChar))) = 0 + if (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc > uint32(0) && !(int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED) != libc.Int32FromInt32(0)) { + return _strAccumFinishRealloc(tls, p) + } + } + return (*TStrAccum)(unsafe.Pointer(p)).FzText +} + +// C documentation +// +// /* +// ** Use the content of the StrAccum passed as the second argument +// ** as the result of an SQL function. +// */ +func _sqlite3ResultStrAccum(tls *libc.TLS, pCtx uintptr, p uintptr) { + if (*TStrAccum)(unsafe.Pointer(p)).FaccError != 0 { + Xsqlite3_result_error_code(tls, pCtx, int32((*TStrAccum)(unsafe.Pointer(p)).FaccError)) + Xsqlite3_str_reset(tls, p) + } else { + if int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&int32(SQLITE_PRINTF_MALLOCED) != 0 { + Xsqlite3_result_text(tls, pCtx, (*TStrAccum)(unsafe.Pointer(p)).FzText, int32((*TStrAccum)(unsafe.Pointer(p)).FnChar), __ccgo_fp(_sqlite3OomClear)) + } else { + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1680, 0, libc.UintptrFromInt32(0)) + Xsqlite3_str_reset(tls, p) + } + } +} + +// C documentation +// +// /* +// ** This singleton is an sqlite3_str object that is returned if +// ** sqlite3_malloc() fails to provide space for a real one. This +// ** sqlite3_str object accepts no new text and always returns +// ** an SQLITE_NOMEM error. +// */ +var _sqlite3OomStr = Tsqlite3_str{ + FaccError: uint8(SQLITE_NOMEM), +} + +// C documentation +// +// /* Finalize a string created using sqlite3_str_new(). +// */ +func Xsqlite3_str_finish(tls *libc.TLS, p uintptr) (r uintptr) { + var z uintptr + _ = z + if p != uintptr(0) && p != uintptr(unsafe.Pointer(&_sqlite3OomStr)) { + z = _sqlite3StrAccumFinish(tls, p) + Xsqlite3_free(tls, p) + } else { + z = uintptr(0) + } + return z +} + +// C documentation +// +// /* Return any error code associated with p */ +func Xsqlite3_str_errcode(tls *libc.TLS, p uintptr) (r int32) { + var v1 int32 + _ = v1 + if p != 0 { + v1 = int32((*Tsqlite3_str)(unsafe.Pointer(p)).FaccError) + } else { + v1 = int32(SQLITE_NOMEM) + } + return v1 +} + +// C documentation +// +// /* Return the current length of p in bytes */ +func Xsqlite3_str_length(tls *libc.TLS, p uintptr) (r int32) { + var v1 uint32 + _ = v1 + if p != 0 { + v1 = (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar + } else { + v1 = uint32(0) + } + return int32(v1) +} + +// C documentation +// +// /* Return the current value for p */ +func Xsqlite3_str_value(tls *libc.TLS, p uintptr) (r uintptr) { + if p == uintptr(0) || (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar == uint32(0) { + return uintptr(0) + } + *(*int8)(unsafe.Pointer((*Tsqlite3_str)(unsafe.Pointer(p)).FzText + uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar))) = 0 + return (*Tsqlite3_str)(unsafe.Pointer(p)).FzText +} + +// C documentation +// +// /* +// ** Reset an StrAccum string. Reclaim all malloced memory. +// */ +func Xsqlite3_str_reset(tls *libc.TLS, p uintptr) { + var p1 uintptr + _ = p1 + if int32((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&int32(SQLITE_PRINTF_MALLOCED) != 0 { + _sqlite3DbFree(tls, (*TStrAccum)(unsafe.Pointer(p)).Fdb, (*TStrAccum)(unsafe.Pointer(p)).FzText) + p1 = p + 29 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED)) + } + (*TStrAccum)(unsafe.Pointer(p)).FnAlloc = uint32(0) + (*TStrAccum)(unsafe.Pointer(p)).FnChar = uint32(0) + (*TStrAccum)(unsafe.Pointer(p)).FzText = uintptr(0) +} + +// C documentation +// +// /* +// ** Initialize a string accumulator. +// ** +// ** p: The accumulator to be initialized. +// ** db: Pointer to a database connection. May be NULL. Lookaside +// ** memory is used if not NULL. db->mallocFailed is set appropriately +// ** when not NULL. +// ** zBase: An initial buffer. May be NULL in which case the initial buffer +// ** is malloced. +// ** n: Size of zBase in bytes. If total space requirements never exceed +// ** n then no memory allocations ever occur. +// ** mx: Maximum number of bytes to accumulate. If mx==0 then no memory +// ** allocations will ever occur. +// */ +func _sqlite3StrAccumInit(tls *libc.TLS, p uintptr, db uintptr, zBase uintptr, n int32, mx int32) { + (*TStrAccum)(unsafe.Pointer(p)).FzText = zBase + (*TStrAccum)(unsafe.Pointer(p)).Fdb = db + (*TStrAccum)(unsafe.Pointer(p)).FnAlloc = uint32(n) + (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc = uint32(mx) + (*TStrAccum)(unsafe.Pointer(p)).FnChar = uint32(0) + (*TStrAccum)(unsafe.Pointer(p)).FaccError = uint8(0) + (*TStrAccum)(unsafe.Pointer(p)).FprintfFlags = uint8(0) +} + +// C documentation +// +// /* Allocate and initialize a new dynamic string object */ +func Xsqlite3_str_new(tls *libc.TLS, db uintptr) (r uintptr) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = Xsqlite3_malloc64(tls, uint64(32)) + if p != 0 { + if db != 0 { + v1 = *(*int32)(unsafe.Pointer(db + 136)) + } else { + v1 = int32(SQLITE_MAX_LENGTH) + } + _sqlite3StrAccumInit(tls, p, uintptr(0), uintptr(0), 0, v1) + } else { + p = uintptr(unsafe.Pointer(&_sqlite3OomStr)) + } + return p +} + +// C documentation +// +// /* +// ** Print into memory obtained from sqliteMalloc(). Use the internal +// ** %-conversion extensions. +// */ +func _sqlite3VMPrintf(tls *libc.TLS, db uintptr, zFormat uintptr, ap Tva_list) (r uintptr) { + bp := tls.Alloc(112) + defer tls.Free(112) + var z uintptr + var _ /* acc at bp+72 */ TStrAccum + var _ /* zBase at bp+0 */ [70]int8 + _ = z + _sqlite3StrAccumInit(tls, bp+72, db, bp, int32(70), *(*int32)(unsafe.Pointer(db + 136))) + (*(*TStrAccum)(unsafe.Pointer(bp + 72))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) + Xsqlite3_str_vappendf(tls, bp+72, zFormat, ap) + z = _sqlite3StrAccumFinish(tls, bp+72) + if int32((*(*TStrAccum)(unsafe.Pointer(bp + 72))).FaccError) == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } + return z +} + +// C documentation +// +// /* +// ** Print into memory obtained from sqliteMalloc(). Use the internal +// ** %-conversion extensions. +// */ +func _sqlite3MPrintf(tls *libc.TLS, db uintptr, zFormat uintptr, va uintptr) (r uintptr) { + var ap Tva_list + var z uintptr + _, _ = ap, z + ap = va + z = _sqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + return z +} + +// C documentation +// +// /* +// ** Print into memory obtained from sqlite3_malloc(). Omit the internal +// ** %-conversion extensions. +// */ +func Xsqlite3_vmprintf(tls *libc.TLS, zFormat uintptr, ap Tva_list) (r uintptr) { + bp := tls.Alloc(112) + defer tls.Free(112) + var z uintptr + var _ /* acc at bp+72 */ TStrAccum + var _ /* zBase at bp+0 */ [70]int8 + _ = z + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + _sqlite3StrAccumInit(tls, bp+72, uintptr(0), bp, int32(70), int32(SQLITE_MAX_LENGTH)) + Xsqlite3_str_vappendf(tls, bp+72, zFormat, ap) + z = _sqlite3StrAccumFinish(tls, bp+72) + return z +} + +// C documentation +// +// /* +// ** Print into memory obtained from sqlite3_malloc()(). Omit the internal +// ** %-conversion extensions. +// */ +func Xsqlite3_mprintf(tls *libc.TLS, zFormat uintptr, va uintptr) (r uintptr) { + var ap Tva_list + var z uintptr + _, _ = ap, z + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + ap = va + z = Xsqlite3_vmprintf(tls, zFormat, ap) + _ = ap + return z +} + +// C documentation +// +// /* +// ** sqlite3_snprintf() works like snprintf() except that it ignores the +// ** current locale settings. This is important for SQLite because we +// ** are not able to use a "," as the decimal point in place of "." as +// ** specified by some locales. +// ** +// ** Oops: The first two arguments of sqlite3_snprintf() are backwards +// ** from the snprintf() standard. Unfortunately, it is too late to change +// ** this without breaking compatibility, so we just have to live with the +// ** mistake. +// ** +// ** sqlite3_vsnprintf() is the varargs version. +// */ +func Xsqlite3_vsnprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, ap Tva_list) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var _ /* acc at bp+0 */ TStrAccum + if n <= 0 { + return zBuf + } + _sqlite3StrAccumInit(tls, bp, uintptr(0), zBuf, n, 0) + Xsqlite3_str_vappendf(tls, bp, zFormat, ap) + *(*int8)(unsafe.Pointer(zBuf + uintptr((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar))) = 0 + return zBuf +} + +func Xsqlite3_snprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, va uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ap Tva_list + var _ /* acc at bp+0 */ TStrAccum + _ = ap + if n <= 0 { + return zBuf + } + _sqlite3StrAccumInit(tls, bp, uintptr(0), zBuf, n, 0) + ap = va + Xsqlite3_str_vappendf(tls, bp, zFormat, ap) + _ = ap + *(*int8)(unsafe.Pointer(zBuf + uintptr((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar))) = 0 + return zBuf +} + +// C documentation +// +// /* +// ** This is the routine that actually formats the sqlite3_log() message. +// ** We house it in a separate routine from sqlite3_log() to avoid using +// ** stack space on small-stack systems when logging is disabled. +// ** +// ** sqlite3_log() must render into a static buffer. It cannot dynamically +// ** allocate memory because it might be called while the memory allocator +// ** mutex is held. +// ** +// ** sqlite3_str_vappendf() might ask for *temporary* memory allocations for +// ** certain format characters (%q) or for very large precisions or widths. +// ** Care must be taken that any sqlite3_log() calls that occur while the +// ** memory mutex is held do not use these mechanisms. +// */ +func _renderLogMsg(tls *libc.TLS, iErrCode int32, zFormat uintptr, ap Tva_list) { + bp := tls.Alloc(256) + defer tls.Free(256) + var _ /* acc at bp+0 */ TStrAccum + var _ /* zMsg at bp+32 */ [210]int8 /* Complete log message */ + _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(210), 0) + Xsqlite3_str_vappendf(tls, bp, zFormat, ap) + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.FxLog})))(tls, _sqlite3Config.FpLogArg, iErrCode, _sqlite3StrAccumFinish(tls, bp)) +} + +// C documentation +// +// /* +// ** Format and write a message to the log if logging is enabled. +// */ +func Xsqlite3_log(tls *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { + var ap Tva_list + _ = ap /* Vararg list */ + if _sqlite3Config.FxLog != 0 { + ap = va + _renderLogMsg(tls, iErrCode, zFormat, ap) + _ = ap + } +} + +// C documentation +// +// /* +// ** variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument +// ** can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats. +// */ +func Xsqlite3_str_appendf(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { + var ap Tva_list + _ = ap + ap = va + Xsqlite3_str_vappendf(tls, p, zFormat, ap) + _ = ap +} + +/***************************************************************************** +** Reference counted string/blob storage +*****************************************************************************/ + +// C documentation +// +// /* +// ** Increase the reference count of the string by one. +// ** +// ** The input parameter is returned. +// */ +func _sqlite3RCStrRef(tls *libc.TLS, z uintptr) (r uintptr) { + var p uintptr + _ = p + p = z + p -= 8 + (*TRCStr)(unsafe.Pointer(p)).FnRCRef++ + return z +} + +// C documentation +// +// /* +// ** Decrease the reference count by one. Free the string when the +// ** reference count reaches zero. +// */ +func _sqlite3RCStrUnref(tls *libc.TLS, z uintptr) { + var p uintptr + _ = p + p = z + p -= 8 + if (*TRCStr)(unsafe.Pointer(p)).FnRCRef >= uint64(2) { + (*TRCStr)(unsafe.Pointer(p)).FnRCRef-- + } else { + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Create a new string that is capable of holding N bytes of text, not counting +// ** the zero byte at the end. The string is uninitialized. +// ** +// ** The reference count is initially 1. Call sqlite3RCStrUnref() to free the +// ** newly allocated string. +// ** +// ** This routine returns 0 on an OOM. +// */ +func _sqlite3RCStrNew(tls *libc.TLS, N Tu64) (r uintptr) { + var p uintptr + _ = p + p = Xsqlite3_malloc64(tls, N+uint64(8)+uint64(1)) + if p == uintptr(0) { + return uintptr(0) + } + (*TRCStr)(unsafe.Pointer(p)).FnRCRef = uint64(1) + return p + 1*8 +} + +// C documentation +// +// /* +// ** Change the size of the string so that it is able to hold N bytes. +// ** The string might be reallocated, so return the new allocation. +// */ +func _sqlite3RCStrResize(tls *libc.TLS, z uintptr, N Tu64) (r uintptr) { + var p, pNew uintptr + _, _ = p, pNew + p = z + p -= 8 + pNew = Xsqlite3_realloc64(tls, p, N+uint64(8)+uint64(1)) + if pNew == uintptr(0) { + Xsqlite3_free(tls, p) + return uintptr(0) + } else { + return pNew + 1*8 + } + return r +} + +/************** End of printf.c **********************************************/ +/************** Begin file treeview.c ****************************************/ +/* +** 2015-06-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains C code to implement the TreeView debugging routines. +** These routines print a parse tree to standard output for debugging and +** analysis. +** +** The interfaces in this file is only available when compiling +** with SQLITE_DEBUG. + */ +/* #include "sqliteInt.h" */ + +/************** End of treeview.c ********************************************/ +/************** Begin file random.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code to implement a pseudo-random number +** generator (PRNG) for SQLite. +** +** Random numbers are used by some of the database backends in order +** to generate random integer keys for tables or random filenames. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* All threads share a single random number generator. +// ** This structure is the current state of the generator. +// */ +type Tsqlite3PrngType = struct { + Fs [16]Tu32 + Fout [64]Tu8 + Fn Tu8 +} + +type sqlite3PrngType = Tsqlite3PrngType + +/************** End of printf.c **********************************************/ +/************** Begin file treeview.c ****************************************/ +/* +** 2015-06-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains C code to implement the TreeView debugging routines. +** These routines print a parse tree to standard output for debugging and +** analysis. +** +** The interfaces in this file is only available when compiling +** with SQLITE_DEBUG. + */ +/* #include "sqliteInt.h" */ + +/************** End of treeview.c ********************************************/ +/************** Begin file random.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code to implement a pseudo-random number +** generator (PRNG) for SQLite. +** +** Random numbers are used by some of the database backends in order +** to generate random integer keys for tables or random filenames. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* All threads share a single random number generator. +// ** This structure is the current state of the generator. +// */ +var _sqlite3Prng Tsqlite3PrngType + +// C documentation +// +// /* The RFC-7539 ChaCha20 block function +// */ +func _chacha_block(tls *libc.TLS, out uintptr, in uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var i int32 + var _ /* x at bp+0 */ [16]Tu32 + _ = i + libc.Xmemcpy(tls, bp, in, uint64(64)) + i = 0 + for { + if !(i < int32(10)) { + break + } + *(*Tu32)(unsafe.Pointer(bp)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] + *(*Tu32)(unsafe.Pointer(bp + 12*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[0] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 8*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] + *(*Tu32)(unsafe.Pointer(bp + 4*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(8)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] + *(*Tu32)(unsafe.Pointer(bp + 12*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[0] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 8*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] + *(*Tu32)(unsafe.Pointer(bp + 4*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(8)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 1*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] + *(*Tu32)(unsafe.Pointer(bp + 13*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(1)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 9*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] + *(*Tu32)(unsafe.Pointer(bp + 5*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(9)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 1*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] + *(*Tu32)(unsafe.Pointer(bp + 13*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(1)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 9*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] + *(*Tu32)(unsafe.Pointer(bp + 5*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(9)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 2*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] + *(*Tu32)(unsafe.Pointer(bp + 14*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(2)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 10*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] + *(*Tu32)(unsafe.Pointer(bp + 6*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(10)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 2*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] + *(*Tu32)(unsafe.Pointer(bp + 14*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(2)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 10*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] + *(*Tu32)(unsafe.Pointer(bp + 6*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(10)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 3*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] + *(*Tu32)(unsafe.Pointer(bp + 15*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(3)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 11*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] + *(*Tu32)(unsafe.Pointer(bp + 7*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(11)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 3*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] + *(*Tu32)(unsafe.Pointer(bp + 15*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(3)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 11*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] + *(*Tu32)(unsafe.Pointer(bp + 7*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(11)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] + *(*Tu32)(unsafe.Pointer(bp + 15*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[0] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 10*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] + *(*Tu32)(unsafe.Pointer(bp + 5*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(10)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] + *(*Tu32)(unsafe.Pointer(bp + 15*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[0] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 10*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(15)] + *(*Tu32)(unsafe.Pointer(bp + 5*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(10)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(5)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 1*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] + *(*Tu32)(unsafe.Pointer(bp + 12*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(1)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 11*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] + *(*Tu32)(unsafe.Pointer(bp + 6*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(11)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 1*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] + *(*Tu32)(unsafe.Pointer(bp + 12*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(1)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 11*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(12)] + *(*Tu32)(unsafe.Pointer(bp + 6*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(11)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(6)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 2*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] + *(*Tu32)(unsafe.Pointer(bp + 13*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(2)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 8*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] + *(*Tu32)(unsafe.Pointer(bp + 7*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(8)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 2*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] + *(*Tu32)(unsafe.Pointer(bp + 13*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(2)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 8*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(13)] + *(*Tu32)(unsafe.Pointer(bp + 7*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(8)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(7)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + *(*Tu32)(unsafe.Pointer(bp + 3*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] + *(*Tu32)(unsafe.Pointer(bp + 14*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(3)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(16)) + *(*Tu32)(unsafe.Pointer(bp + 9*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] + *(*Tu32)(unsafe.Pointer(bp + 4*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(9)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(12)) + *(*Tu32)(unsafe.Pointer(bp + 3*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] + *(*Tu32)(unsafe.Pointer(bp + 14*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(3)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(8)) + *(*Tu32)(unsafe.Pointer(bp + 9*4)) += (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(14)] + *(*Tu32)(unsafe.Pointer(bp + 4*4)) ^= (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(9)] + (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)] = (*(*[16]Tu32)(unsafe.Pointer(bp)))[int32(4)]<>(libc.Int32FromInt32(32)-libc.Int32FromInt32(7)) + goto _1 + _1: + ; + i++ + } + i = 0 + for { + if !(i < int32(16)) { + break + } + *(*Tu32)(unsafe.Pointer(out + uintptr(i)*4)) = (*(*[16]Tu32)(unsafe.Pointer(bp)))[i] + *(*Tu32)(unsafe.Pointer(in + uintptr(i)*4)) + goto _2 + _2: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Return N random bytes. +// */ +func Xsqlite3_randomness(tls *libc.TLS, N int32, pBuf uintptr) { + var mutex, pVfs, zBuf, p1 uintptr + _, _, _, _ = mutex, pVfs, zBuf, p1 + zBuf = pBuf + if Xsqlite3_initialize(tls) != 0 { + return + } + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_PRNG)) + Xsqlite3_mutex_enter(tls, mutex) + if N <= 0 || pBuf == uintptr(0) { + *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)))) = uint32(0) + Xsqlite3_mutex_leave(tls, mutex) + return + } + /* Initialize the state of the random number generator once, + ** the first time this routine is called. + */ + if *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)))) == uint32(0) { + pVfs = Xsqlite3_vfs_find(tls, uintptr(0)) + libc.Xmemcpy(tls, uintptr(unsafe.Pointer(&_sqlite3Prng)), uintptr(unsafe.Pointer(&_chacha20_init)), uint64(16)) + if pVfs == uintptr(0) { + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_sqlite3Prng))+4*4, 0, uint64(44)) + } else { + _sqlite3OsRandomness(tls, pVfs, int32(44), uintptr(unsafe.Pointer(&_sqlite3Prng))+4*4) + } + *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)) + 15*4)) = *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)) + 12*4)) + *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)) + 12*4)) = uint32(0) + _sqlite3Prng.Fn = uint8(0) + } + for int32(1) != 0 { + if N <= int32(_sqlite3Prng.Fn) { + libc.Xmemcpy(tls, zBuf, uintptr(unsafe.Pointer(&_sqlite3Prng))+64+uintptr(int32(_sqlite3Prng.Fn)-N), uint64(N)) + p1 = uintptr(unsafe.Pointer(&_sqlite3Prng)) + 128 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) - N) + break + } + if int32(_sqlite3Prng.Fn) > 0 { + libc.Xmemcpy(tls, zBuf, uintptr(unsafe.Pointer(&_sqlite3Prng))+64, uint64(_sqlite3Prng.Fn)) + N -= int32(_sqlite3Prng.Fn) + zBuf += uintptr(_sqlite3Prng.Fn) + } + *(*Tu32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3Prng)) + 12*4))++ + _chacha_block(tls, uintptr(unsafe.Pointer(&_sqlite3Prng))+64, uintptr(unsafe.Pointer(&_sqlite3Prng))) + _sqlite3Prng.Fn = uint8(64) + } + Xsqlite3_mutex_leave(tls, mutex) +} + +var _chacha20_init = [4]Tu32{ + 0: uint32(0x61707865), + 1: uint32(0x3320646e), + 2: uint32(0x79622d32), + 3: uint32(0x6b206574), +} + +// C documentation +// +// /* +// ** For testing purposes, we sometimes want to preserve the state of +// ** PRNG and restore the PRNG to its saved state at a later time, or +// ** to reset the PRNG to its initial state. These routines accomplish +// ** those tasks. +// ** +// ** The sqlite3_test_control() interface calls these routines to +// ** control the PRNG. +// */ +var _sqlite3SavedPrng Tsqlite3PrngType + +func _sqlite3PrngSaveState(tls *libc.TLS) { + libc.Xmemcpy(tls, uintptr(unsafe.Pointer(&_sqlite3SavedPrng)), uintptr(unsafe.Pointer(&_sqlite3Prng)), uint64(132)) +} + +func _sqlite3PrngRestoreState(tls *libc.TLS) { + libc.Xmemcpy(tls, uintptr(unsafe.Pointer(&_sqlite3Prng)), uintptr(unsafe.Pointer(&_sqlite3SavedPrng)), uint64(132)) +} + +/************** End of random.c **********************************************/ +/************** Begin file threads.c *****************************************/ +/* +** 2012 July 21 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file presents a simple cross-platform threading interface for +** use internally by SQLite. +** +** A "thread" can be created using sqlite3ThreadCreate(). This thread +** runs independently of its creator until it is joined using +** sqlite3ThreadJoin(), at which point it terminates. +** +** Threads do not have to be real. It could be that the work of the +** "thread" is done by the main thread at either the sqlite3ThreadCreate() +** or sqlite3ThreadJoin() call. This is, in fact, what happens in +** single threaded systems. Nothing in SQLite requires multiple threads. +** This interface exists so that applications that want to take advantage +** of multiple cores can do so, while also allowing applications to stay +** single-threaded if desired. + */ +/* #include "sqliteInt.h" */ + +/********************************* Unix Pthreads ****************************/ + +/* #include */ + +/* A running thread */ +type TSQLiteThread1 = struct { + Ftid Tpthread_t + Fdone int32 + FpOut uintptr + FxTask uintptr + FpIn uintptr +} + +type SQLiteThread1 = TSQLiteThread1 + +// C documentation +// +// /* Create a new thread */ +func _sqlite3ThreadCreate(tls *libc.TLS, ppThread uintptr, xTask uintptr, pIn uintptr) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + /* This routine is never used in single-threaded mode */ + *(*uintptr)(unsafe.Pointer(ppThread)) = uintptr(0) + p = _sqlite3Malloc(tls, uint64(40)) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, p, 0, uint64(40)) + (*TSQLiteThread)(unsafe.Pointer(p)).FxTask = xTask + (*TSQLiteThread)(unsafe.Pointer(p)).FpIn = pIn + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** for testing purposes. */ + if _sqlite3FaultSim(tls, int32(200)) != 0 { + rc = int32(1) + } else { + rc = libc.Xpthread_create(tls, p, uintptr(0), xTask, pIn) + } + if rc != 0 { + (*TSQLiteThread)(unsafe.Pointer(p)).Fdone = int32(1) + (*TSQLiteThread)(unsafe.Pointer(p)).FpOut = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{xTask})))(tls, pIn) + } + *(*uintptr)(unsafe.Pointer(ppThread)) = p + return SQLITE_OK +} + +// C documentation +// +// /* Get the results of the thread */ +func _sqlite3ThreadJoin(tls *libc.TLS, p uintptr, ppOut uintptr) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + if (*TSQLiteThread)(unsafe.Pointer(p)).Fdone != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TSQLiteThread)(unsafe.Pointer(p)).FpOut + rc = SQLITE_OK + } else { + if libc.Xpthread_join(tls, (*TSQLiteThread)(unsafe.Pointer(p)).Ftid, ppOut) != 0 { + v1 = int32(SQLITE_ERROR) + } else { + v1 = SQLITE_OK + } + rc = v1 + } + Xsqlite3_free(tls, p) + return rc +} + +/******************************** End Unix Pthreads *************************/ + +/********************************* Win32 Threads ****************************/ +/******************************** End Win32 Threads *************************/ + +/********************************* Single-Threaded **************************/ +/****************************** End Single-Threaded *************************/ + +/************** End of threads.c *********************************************/ +/************** Begin file utf.c *********************************************/ +/* +** 2004 April 13 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains routines used to translate between UTF-8, +** UTF-16, UTF-16BE, and UTF-16LE. +** +** Notes on UTF-8: +** +** Byte-0 Byte-1 Byte-2 Byte-3 Value +** 0xxxxxxx 00000000 00000000 0xxxxxxx +** 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx +** 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx +** 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx +** +** +** Notes on UTF-16: (with wwww+1==uuuuu) +** +** Word-0 Word-1 Value +** 110110ww wwzzzzyy 110111yy yyxxxxxx 000uuuuu zzzzyyyy yyxxxxxx +** zzzzyyyy yyxxxxxx 00000000 zzzzyyyy yyxxxxxx +** +** +** BOM or Byte Order Mark: +** 0xff 0xfe little-endian utf-16 follows +** 0xfe 0xff big-endian utf-16 follows +** + */ +/* #include "sqliteInt.h" */ +/* #include */ +/* #include "vdbeInt.h" */ + +// C documentation +// +// /* +// ** This lookup table is used to help decode the first byte of +// ** a multi-byte UTF8 character. +// */ +var _sqlite3Utf8Trans1 = [64]uint8{ + 1: uint8(0x01), + 2: uint8(0x02), + 3: uint8(0x03), + 4: uint8(0x04), + 5: uint8(0x05), + 6: uint8(0x06), + 7: uint8(0x07), + 8: uint8(0x08), + 9: uint8(0x09), + 10: uint8(0x0a), + 11: uint8(0x0b), + 12: uint8(0x0c), + 13: uint8(0x0d), + 14: uint8(0x0e), + 15: uint8(0x0f), + 16: uint8(0x10), + 17: uint8(0x11), + 18: uint8(0x12), + 19: uint8(0x13), + 20: uint8(0x14), + 21: uint8(0x15), + 22: uint8(0x16), + 23: uint8(0x17), + 24: uint8(0x18), + 25: uint8(0x19), + 26: uint8(0x1a), + 27: uint8(0x1b), + 28: uint8(0x1c), + 29: uint8(0x1d), + 30: uint8(0x1e), + 31: uint8(0x1f), + 33: uint8(0x01), + 34: uint8(0x02), + 35: uint8(0x03), + 36: uint8(0x04), + 37: uint8(0x05), + 38: uint8(0x06), + 39: uint8(0x07), + 40: uint8(0x08), + 41: uint8(0x09), + 42: uint8(0x0a), + 43: uint8(0x0b), + 44: uint8(0x0c), + 45: uint8(0x0d), + 46: uint8(0x0e), + 47: uint8(0x0f), + 49: uint8(0x01), + 50: uint8(0x02), + 51: uint8(0x03), + 52: uint8(0x04), + 53: uint8(0x05), + 54: uint8(0x06), + 55: uint8(0x07), + 57: uint8(0x01), + 58: uint8(0x02), + 59: uint8(0x03), + 61: uint8(0x01), +} + +// C documentation +// +// /* +// ** Translate a single UTF-8 character. Return the unicode value. +// ** +// ** During translation, assume that the byte that zTerm points +// ** is a 0x00. +// ** +// ** Write a pointer to the next unread byte back into *pzNext. +// ** +// ** Notes On Invalid UTF-8: +// ** +// ** * This routine never allows a 7-bit character (0x00 through 0x7f) to +// ** be encoded as a multi-byte character. Any multi-byte character that +// ** attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd. +// ** +// ** * This routine never allows a UTF16 surrogate value to be encoded. +// ** If a multi-byte character attempts to encode a value between +// ** 0xd800 and 0xe000 then it is rendered as 0xfffd. +// ** +// ** * Bytes in the range of 0x80 through 0xbf which occur as the first +// ** byte of a character are interpreted as single-byte characters +// ** and rendered as themselves even though they are technically +// ** invalid characters. +// ** +// ** * This routine accepts over-length UTF8 encodings +// ** for unicode values 0x80 and greater. It does not change over-length +// ** encodings to 0xfffd as some systems recommend. +// */ +func _sqlite3Utf8Read(tls *libc.TLS, pz uintptr) (r Tu32) { + var c uint32 + var v1, v2, v3, v4 uintptr + _, _, _, _, _ = c, v1, v2, v3, v4 + /* Same as READ_UTF8() above but without the zTerm parameter. + ** For this routine, we assume the UTF8 string is always zero-terminated. + */ + v2 = pz + v1 = *(*uintptr)(unsafe.Pointer(v2)) + *(*uintptr)(unsafe.Pointer(v2))++ + c = uint32(*(*uint8)(unsafe.Pointer(v1))) + if c >= uint32(0xc0) { + c = uint32(_sqlite3Utf8Trans1[c-uint32(0xc0)]) + for int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pz)))))&int32(0xc0) == int32(0x80) { + v4 = pz + v3 = *(*uintptr)(unsafe.Pointer(v4)) + *(*uintptr)(unsafe.Pointer(v4))++ + c = c<= uint32(0xc0) { + c = uint32(_sqlite3Utf8Trans1[c-uint32(0xc0)]) + if n > int32(4) { + n = int32(4) + } + for i < n && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(i))))&int32(0xc0) == int32(0x80) { + c = c< UTF-16 Little-endian */ + for zIn < zTerm { + v2 = zIn + zIn++ + c = uint32(*(*uint8)(unsafe.Pointer(v2))) + if c >= uint32(0xc0) { + c = uint32(_sqlite3Utf8Trans1[c-uint32(0xc0)]) + for zIn != zTerm && int32(*(*uint8)(unsafe.Pointer(zIn)))&int32(0xc0) == int32(0x80) { + v3 = zIn + zIn++ + c = c<> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0x00FF)) + } else { + v6 = z + z++ + *(*uint8)(unsafe.Pointer(v6)) = uint8(c>>libc.Int32FromInt32(10)&libc.Uint32FromInt32(0x003F) + (c-libc.Uint32FromInt32(0x10000))>>libc.Int32FromInt32(10)&libc.Uint32FromInt32(0x00C0)) + v7 = z + z++ + *(*uint8)(unsafe.Pointer(v7)) = uint8(libc.Uint32FromInt32(0x00D8) + (c-libc.Uint32FromInt32(0x10000))>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x03)) + v8 = z + z++ + *(*uint8)(unsafe.Pointer(v8)) = uint8(c & libc.Uint32FromInt32(0x00FF)) + v9 = z + z++ + *(*uint8)(unsafe.Pointer(v9)) = uint8(libc.Uint32FromInt32(0x00DC) + c>>libc.Int32FromInt32(8)&libc.Uint32FromInt32(0x03)) + } + } + } else { + /* UTF-8 -> UTF-16 Big-endian */ + for zIn < zTerm { + v10 = zIn + zIn++ + c = uint32(*(*uint8)(unsafe.Pointer(v10))) + if c >= uint32(0xc0) { + c = uint32(_sqlite3Utf8Trans1[c-uint32(0xc0)]) + for zIn != zTerm && int32(*(*uint8)(unsafe.Pointer(zIn)))&int32(0xc0) == int32(0x80) { + v11 = zIn + zIn++ + c = c<> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0x00FF)) + v13 = z + z++ + *(*uint8)(unsafe.Pointer(v13)) = uint8(c & libc.Uint32FromInt32(0x00FF)) + } else { + v14 = z + z++ + *(*uint8)(unsafe.Pointer(v14)) = uint8(libc.Uint32FromInt32(0x00D8) + (c-libc.Uint32FromInt32(0x10000))>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x03)) + v15 = z + z++ + *(*uint8)(unsafe.Pointer(v15)) = uint8(c>>libc.Int32FromInt32(10)&libc.Uint32FromInt32(0x003F) + (c-libc.Uint32FromInt32(0x10000))>>libc.Int32FromInt32(10)&libc.Uint32FromInt32(0x00C0)) + v16 = z + z++ + *(*uint8)(unsafe.Pointer(v16)) = uint8(libc.Uint32FromInt32(0x00DC) + c>>libc.Int32FromInt32(8)&libc.Uint32FromInt32(0x03)) + v17 = z + z++ + *(*uint8)(unsafe.Pointer(v17)) = uint8(c & libc.Uint32FromInt32(0x00FF)) + } + } + } + (*TMem)(unsafe.Pointer(pMem)).Fn = int32(int64(z) - int64(zOut)) + v18 = z + z++ + *(*uint8)(unsafe.Pointer(v18)) = uint8(0) + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) == int32(SQLITE_UTF16LE) { + /* UTF-16 Little-endian -> UTF-8 */ + for zIn < zTerm { + v19 = zIn + zIn++ + c = uint32(*(*uint8)(unsafe.Pointer(v19))) + v20 = zIn + zIn++ + c += uint32(int32(*(*uint8)(unsafe.Pointer(v20))) << int32(8)) + if c >= uint32(0xd800) && c < uint32(0xe000) { + if zIn < zTerm { + v21 = zIn + zIn++ + c2 = int32(*(*uint8)(unsafe.Pointer(v21))) + v22 = zIn + zIn++ + c2 += int32(*(*uint8)(unsafe.Pointer(v22))) << int32(8) + c = uint32(c2&libc.Int32FromInt32(0x03FF)) + c&uint32(0x003F)<>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x1F)))) + v25 = z + z++ + *(*uint8)(unsafe.Pointer(v25)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + if c < uint32(0x10000) { + v26 = z + z++ + *(*uint8)(unsafe.Pointer(v26)) = uint8(int32(0xE0) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x0F)))) + v27 = z + z++ + *(*uint8)(unsafe.Pointer(v27)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v28 = z + z++ + *(*uint8)(unsafe.Pointer(v28)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + v29 = z + z++ + *(*uint8)(unsafe.Pointer(v29)) = uint8(int32(0xF0) + int32(uint8(c>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x07)))) + v30 = z + z++ + *(*uint8)(unsafe.Pointer(v30)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x3F)))) + v31 = z + z++ + *(*uint8)(unsafe.Pointer(v31)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v32 = z + z++ + *(*uint8)(unsafe.Pointer(v32)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } + } + } + } + } else { + /* UTF-16 Big-endian -> UTF-8 */ + for zIn < zTerm { + v33 = zIn + zIn++ + c = uint32(int32(*(*uint8)(unsafe.Pointer(v33))) << int32(8)) + v34 = zIn + zIn++ + c += uint32(*(*uint8)(unsafe.Pointer(v34))) + if c >= uint32(0xd800) && c < uint32(0xe000) { + if zIn < zTerm { + v35 = zIn + zIn++ + c21 = int32(*(*uint8)(unsafe.Pointer(v35))) << int32(8) + v36 = zIn + zIn++ + c21 += int32(*(*uint8)(unsafe.Pointer(v36))) + c = uint32(c21&libc.Int32FromInt32(0x03FF)) + c&uint32(0x003F)<>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x1F)))) + v39 = z + z++ + *(*uint8)(unsafe.Pointer(v39)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + if c < uint32(0x10000) { + v40 = z + z++ + *(*uint8)(unsafe.Pointer(v40)) = uint8(int32(0xE0) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x0F)))) + v41 = z + z++ + *(*uint8)(unsafe.Pointer(v41)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v42 = z + z++ + *(*uint8)(unsafe.Pointer(v42)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + v43 = z + z++ + *(*uint8)(unsafe.Pointer(v43)) = uint8(int32(0xF0) + int32(uint8(c>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x07)))) + v44 = z + z++ + *(*uint8)(unsafe.Pointer(v44)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x3F)))) + v45 = z + z++ + *(*uint8)(unsafe.Pointer(v45)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v46 = z + z++ + *(*uint8)(unsafe.Pointer(v46)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } + } + } + } + } + (*TMem)(unsafe.Pointer(pMem)).Fn = int32(int64(z) - int64(zOut)) + } + *(*uint8)(unsafe.Pointer(z)) = uint8(0) + c = uint32(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Term) | int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_AffMask)|libc.Int32FromInt32(MEM_Subtype))) + _sqlite3VdbeMemRelease(tls, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(c) + (*TMem)(unsafe.Pointer(pMem)).Fenc = desiredEnc + (*TMem)(unsafe.Pointer(pMem)).Fz = zOut + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz) +translate_out: + ; + return SQLITE_OK + return r +} + +// C documentation +// +// /* +// ** This routine checks for a byte-order mark at the beginning of the +// ** UTF-16 string stored in *pMem. If one is present, it is removed and +// ** the encoding of the Mem adjusted. This routine does not do any +// ** byte-swapping, it just sets Mem.enc appropriately. +// ** +// ** The allocation (static, dynamic etc.) and encoding of the Mem may be +// ** changed by this function. +// */ +func _sqlite3VdbeMemHandleBom(tls *libc.TLS, pMem uintptr) (r int32) { + var b1, b2, bom Tu8 + var rc int32 + var p1 uintptr + _, _, _, _, _ = b1, b2, bom, rc, p1 + rc = SQLITE_OK + bom = uint8(0) + if (*TMem)(unsafe.Pointer(pMem)).Fn > int32(1) { + b1 = *(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz)) + b2 = *(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + libc.UintptrFromInt32(1))) + if int32(b1) == int32(0xFE) && int32(b2) == int32(0xFF) { + bom = uint8(SQLITE_UTF16BE) + } + if int32(b1) == int32(0xFF) && int32(b2) == int32(0xFE) { + bom = uint8(SQLITE_UTF16LE) + } + } + if bom != 0 { + rc = _sqlite3VdbeMemMakeWriteable(tls, pMem) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(pMem + 16)) -= int32(2) + libc.Xmemmove(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, (*TMem)(unsafe.Pointer(pMem)).Fz+2, uint64((*TMem)(unsafe.Pointer(pMem)).Fn)) + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn))) = int8('\000') + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn+int32(1)))) = int8('\000') + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Term)) + (*TMem)(unsafe.Pointer(pMem)).Fenc = bom + } + } + return rc +} + +// C documentation +// +// /* +// ** pZ is a UTF-8 encoded unicode string. If nByte is less than zero, +// ** return the number of unicode characters in pZ up to (but not including) +// ** the first 0x00 byte. If nByte is not less than zero, return the +// ** number of unicode characters in the first nByte of pZ (or up to +// ** the first 0x00, whichever comes first). +// */ +func _sqlite3Utf8CharLen(tls *libc.TLS, zIn uintptr, nByte int32) (r1 int32) { + var r int32 + var z, zTerm, v1 uintptr + _, _, _, _ = r, z, zTerm, v1 + r = 0 + z = zIn + if nByte >= 0 { + zTerm = z + uintptr(nByte) + } else { + zTerm = uintptr(-libc.Int32FromInt32(1)) + } + for int32(*(*Tu8)(unsafe.Pointer(z))) != 0 && z < zTerm { + v1 = z + z++ + if int32(*(*Tu8)(unsafe.Pointer(v1))) >= int32(0xc0) { + for int32(*(*Tu8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + } + } + r++ + } + return r +} + +/* This test function is not currently used by the automated test-suite. +** Hence it is only available in debug builds. + */ + +// C documentation +// +// /* +// ** Convert a UTF-16 string in the native encoding into a UTF-8 string. +// ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must +// ** be freed by the calling function. +// ** +// ** NULL is returned if there is an allocation error. +// */ +func _sqlite3Utf16to8(tls *libc.TLS, db uintptr, z uintptr, nByte int32, enc Tu8) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var _ /* m at bp+0 */ TMem + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TMem)(unsafe.Pointer(bp))).Fdb = db + _sqlite3VdbeMemSetStr(tls, bp, z, int64(nByte), enc, libc.UintptrFromInt32(0)) + _sqlite3VdbeChangeEncoding(tls, bp, int32(SQLITE_UTF8)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3VdbeMemRelease(tls, bp) + (*(*TMem)(unsafe.Pointer(bp))).Fz = uintptr(0) + } + return (*(*TMem)(unsafe.Pointer(bp))).Fz +} + +// C documentation +// +// /* +// ** zIn is a UTF-16 encoded unicode string at least nChar characters long. +// ** Return the number of bytes in the first nChar unicode characters +// ** in pZ. nChar must be non-negative. +// */ +func _sqlite3Utf16ByteLen(tls *libc.TLS, zIn uintptr, nChar int32) (r int32) { + var c, n int32 + var z uintptr + _, _, _ = c, n, z + z = zIn + n = 0 + if true { + z++ + } + for n < nChar { + c = int32(*(*uint8)(unsafe.Pointer(z))) + z += uintptr(2) + if c >= int32(0xd8) && c < int32(0xdc) && int32(*(*uint8)(unsafe.Pointer(z))) >= int32(0xdc) && int32(*(*uint8)(unsafe.Pointer(z))) < int32(0xe0) { + z += uintptr(2) + } + n++ + } + return int32(int64(z)-int64(zIn)) - libc.BoolInt32(true) +} + +type Tfloat_t = float32 + +type float_t = Tfloat_t + +type Tdouble_t = float64 + +type double_t = Tdouble_t + +// C documentation +// +// /* +// ** Calls to sqlite3FaultSim() are used to simulate a failure during testing, +// ** or to bypass normal error detection during testing in order to let +// ** execute proceed further downstream. +// ** +// ** In deployment, sqlite3FaultSim() *always* return SQLITE_OK (0). The +// ** sqlite3FaultSim() function only returns non-zero during testing. +// ** +// ** During testing, if the test harness has set a fault-sim callback using +// ** a call to sqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then +// ** each call to sqlite3FaultSim() is relayed to that application-supplied +// ** callback and the integer return value form the application-supplied +// ** callback is returned by sqlite3FaultSim(). +// ** +// ** The integer argument to sqlite3FaultSim() is a code to identify which +// ** sqlite3FaultSim() instance is being invoked. Each call to sqlite3FaultSim() +// ** should have a unique code. To prevent legacy testing applications from +// ** breaking, the codes should not be changed or reused. +// */ +func _sqlite3FaultSim(tls *libc.TLS, iTest int32) (r int32) { + var xCallback uintptr + var v1 int32 + _, _ = xCallback, v1 + xCallback = _sqlite3Config.FxTestCallback + if xCallback != 0 { + v1 = (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xCallback})))(tls, iTest) + } else { + v1 = SQLITE_OK + } + return v1 +} + +// C documentation +// +// /* +// ** Return true if the floating point value is Not a Number (NaN). +// ** +// ** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN. +// ** Otherwise, we have our own implementation that works on most systems. +// */ +func _sqlite3IsNaN(tls *libc.TLS, _x float64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var rc int32 + var _ /* y at bp+8 */ Tu64 + _ = rc + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + rc = libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8))&(libc.Uint64FromInt32(0x7ff)<>4)) != 0 { + return _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4))-int32(1)] + } else { + return zDflt + } + } + return r +} + +// C documentation +// +// /* +// ** Helper function for sqlite3Error() - called rarely. Broken out into +// ** a separate routine to avoid unnecessary register saves on entry to +// ** sqlite3Error(). +// */ +func _sqlite3ErrorFinish(tls *libc.TLS, db uintptr, err_code int32) { + if (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { + _sqlite3ValueSetNull(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + } + _sqlite3SystemError(tls, db, err_code) +} + +// C documentation +// +// /* +// ** Set the current error code to err_code and clear any prior error message. +// ** Also set iSysErrno (by calling sqlite3System) if the err_code indicates +// ** that would be appropriate. +// */ +func _sqlite3Error(tls *libc.TLS, db uintptr, err_code int32) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = err_code + if err_code != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { + _sqlite3ErrorFinish(tls, db, err_code) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(1) + } +} + +// C documentation +// +// /* +// ** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state +// ** and error message. +// */ +func _sqlite3ErrorClear(tls *libc.TLS, db uintptr) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_OK + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(1) + if (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { + _sqlite3ValueSetNull(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + } +} + +// C documentation +// +// /* +// ** Load the sqlite3.iSysErrno field if that is an appropriate thing +// ** to do based on the SQLite error code in rc. +// */ +func _sqlite3SystemError(tls *libc.TLS, db uintptr, rc int32) { + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= (*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps { + if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { + (*TParse)(unsafe.Pointer(p)).FnErr++ + (*TParse)(unsafe.Pointer(p)).Frc = int32(SQLITE_INTERRUPT) + } + (*TParse)(unsafe.Pointer(p)).FnProgressSteps = uint32(0) + } + } + } +} + +// C documentation +// +// /* +// ** Add an error message to pParse->zErrMsg and increment pParse->nErr. +// ** +// ** This function should be used to report any error that occurs while +// ** compiling an SQL statement (i.e. within sqlite3_prepare()). The +// ** last thing the sqlite3_prepare() function does is copy the error +// ** stored by this function into the database handle using sqlite3Error(). +// ** Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used +// ** during statement execution (sqlite3_step() etc.). +// */ +func _sqlite3ErrorMsg(tls *libc.TLS, pParse uintptr, zFormat uintptr, va uintptr) { + var ap Tva_list + var db, zMsg uintptr + _, _, _ = ap, db, zMsg + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(2) + ap = va + zMsg = _sqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + if (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset < -int32(1) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(1) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr != 0 { + _sqlite3DbFree(tls, db, zMsg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } + } else { + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + _sqlite3DbFree(tls, db, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg) + (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = zMsg + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) + (*TParse)(unsafe.Pointer(pParse)).FpWith = uintptr(0) + } +} + +// C documentation +// +// /* +// ** If database connection db is currently parsing SQL, then transfer +// ** error code errCode to that parser if the parser has not already +// ** encountered some other kind of error. +// */ +func _sqlite3ErrorToParser(tls *libc.TLS, db uintptr, errCode int32) (r int32) { + var pParse, v1 uintptr + var v2 bool + _, _, _ = pParse, v1, v2 + if v2 = db == uintptr(0); !v2 { + v1 = (*Tsqlite3)(unsafe.Pointer(db)).FpParse + pParse = v1 + } + if v2 || v1 == uintptr(0) { + return errCode + } + (*TParse)(unsafe.Pointer(pParse)).Frc = errCode + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + return errCode +} + +// C documentation +// +// /* +// ** Convert an SQL-style quoted string into a normal string by removing +// ** the quote characters. The conversion is done in-place. If the +// ** input does not begin with a quote character, then this routine +// ** is a no-op. +// ** +// ** The input string must be zero-terminated. A new zero-terminator +// ** is added to the dequoted string. +// ** +// ** The return value is -1 if no dequoting occurs or the length of the +// ** dequoted string, exclusive of the zero terminator, if dequoting does +// ** occur. +// ** +// ** 2002-02-14: This routine is extended to remove MS-Access style +// ** brackets from around identifiers. For example: "[a-b-c]" becomes +// ** "a-b-c". +// */ +func _sqlite3Dequote(tls *libc.TLS, z uintptr) { + var i, j, v2, v3 int32 + var quote int8 + _, _, _, _, _ = i, j, quote, v2, v3 + if z == uintptr(0) { + return + } + quote = *(*int8)(unsafe.Pointer(z)) + if !(int32(_sqlite3CtypeMap[uint8(quote)])&libc.Int32FromInt32(0x80) != 0) { + return + } + if int32(quote) == int32('[') { + quote = int8(']') + } + i = int32(1) + j = libc.Int32FromInt32(0) + for { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(quote) { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == int32(quote) { + v2 = j + j++ + *(*int8)(unsafe.Pointer(z + uintptr(v2))) = quote + i++ + } else { + break + } + } else { + v3 = j + j++ + *(*int8)(unsafe.Pointer(z + uintptr(v3))) = *(*int8)(unsafe.Pointer(z + uintptr(i))) + } + goto _1 + _1: + ; + i++ + } + *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 +} + +func _sqlite3DequoteExpr(tls *libc.TLS, p uintptr) { + var v1 int32 + _ = v1 + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8))))) == int32('"') { + v1 = libc.Int32FromInt32(EP_Quoted) | libc.Int32FromInt32(EP_DblQuoted) + } else { + v1 = int32(EP_Quoted) + } + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(v1) + _sqlite3Dequote(tls, *(*uintptr)(unsafe.Pointer(p + 8))) +} + +// C documentation +// +// /* +// ** If the input token p is quoted, try to adjust the token to remove +// ** the quotes. This is not always possible: +// ** +// ** "abc" -> abc +// ** "ab""cd" -> (not possible because of the interior "") +// ** +// ** Remove the quotes if possible. This is a optimization. The overall +// ** system should still return the correct answer even if this routine +// ** is always a no-op. +// */ +func _sqlite3DequoteToken(tls *libc.TLS, p uintptr) { + var i uint32 + _ = i + if (*TToken)(unsafe.Pointer(p)).Fn < uint32(2) { + return + } + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(p)).Fz)))])&libc.Int32FromInt32(0x80) != 0) { + return + } + i = uint32(1) + for { + if !(i < (*TToken)(unsafe.Pointer(p)).Fn-uint32(1)) { + break + } + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(p)).Fz + uintptr(i))))])&int32(0x80) != 0 { + return + } + goto _1 + _1: + ; + i++ + } + *(*uint32)(unsafe.Pointer(p + 8)) -= uint32(2) + (*TToken)(unsafe.Pointer(p)).Fz++ +} + +// C documentation +// +// /* +// ** Generate a Token object from a string +// */ +func _sqlite3TokenInit(tls *libc.TLS, p uintptr, z uintptr) { + (*TToken)(unsafe.Pointer(p)).Fz = z + (*TToken)(unsafe.Pointer(p)).Fn = uint32(_sqlite3Strlen30(tls, z)) +} + +/* Convenient short-hand */ + +// C documentation +// +// /* +// ** Some systems have stricmp(). Others have strcasecmp(). Because +// ** there is no consistency, we will define our own. +// ** +// ** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and +// ** sqlite3_strnicmp() APIs allow applications and extensions to compare +// ** the contents of two buffers containing UTF-8 strings in a +// ** case-independent fashion, using the same definition of "case +// ** independence" that SQLite uses internally when comparing identifiers. +// */ +func Xsqlite3_stricmp(tls *libc.TLS, zLeft uintptr, zRight uintptr) (r int32) { + var v1 int32 + _ = v1 + if zLeft == uintptr(0) { + if zRight != 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 + } else { + if zRight == uintptr(0) { + return int32(1) + } + } + return _sqlite3StrICmp(tls, zLeft, zRight) +} + +func _sqlite3StrICmp(tls *libc.TLS, zLeft uintptr, zRight uintptr) (r int32) { + var a, b uintptr + var c, x int32 + _, _, _, _ = a, b, c, x + a = zLeft + b = zRight + for { + c = int32(*(*uint8)(unsafe.Pointer(a))) + x = int32(*(*uint8)(unsafe.Pointer(b))) + if c == x { + if c == 0 { + break + } + } else { + c = int32(_sqlite3UpperToLower[c]) - int32(_sqlite3UpperToLower[x]) + if c != 0 { + break + } + } + a++ + b++ + goto _1 + _1: + } + return c +} + +func Xsqlite3_strnicmp(tls *libc.TLS, zLeft uintptr, zRight uintptr, N int32) (r int32) { + var a, b uintptr + var v1, v2, v3 int32 + _, _, _, _, _ = a, b, v1, v2, v3 + if zLeft == uintptr(0) { + if zRight != 0 { + v1 = -int32(1) + } else { + v1 = 0 + } + return v1 + } else { + if zRight == uintptr(0) { + return int32(1) + } + } + a = zLeft + b = zRight + for { + v2 = N + N-- + if !(v2 > 0 && int32(*(*uint8)(unsafe.Pointer(a))) != 0 && int32(_sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(a))]) == int32(_sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(b))])) { + break + } + a++ + b++ + } + if N < 0 { + v3 = 0 + } else { + v3 = int32(_sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(a))]) - int32(_sqlite3UpperToLower[*(*uint8)(unsafe.Pointer(b))]) + } + return v3 +} + +// C documentation +// +// /* +// ** Compute an 8-bit hash on a string that is insensitive to case differences +// */ +func _sqlite3StrIHash(tls *libc.TLS, z uintptr) (r Tu8) { + var h Tu8 + _ = h + h = uint8(0) + if z == uintptr(0) { + return uint8(0) + } + for *(*int8)(unsafe.Pointer(z)) != 0 { + h = Tu8(int32(h) + int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))])) + z++ + } + return h +} + +// C documentation +// +// /* Double-Double multiplication. (x[0],x[1]) *= (y,yy) +// ** +// ** Reference: +// ** T. J. Dekker, "A Floating-Point Technique for Extending the +// ** Available Precision". 1971-07-26. +// */ +func _dekkerMul2(tls *libc.TLS, x uintptr, _y float64, yy float64) { + bp := tls.Alloc(32) + defer tls.Free(32) + *(*float64)(unsafe.Pointer(bp)) = _y + var c, cc, p, q, tx, ty float64 + var _ /* hx at bp+8 */ float64 + var _ /* hy at bp+16 */ float64 + var _ /* m at bp+24 */ Tu64 + _, _, _, _, _, _ = c, cc, p, q, tx, ty + libc.Xmemcpy(tls, bp+24, x, uint64(8)) + *(*Tu64)(unsafe.Pointer(bp + 24)) &= uint64(0xfffffffffc000000) + libc.Xmemcpy(tls, bp+8, bp+24, uint64(8)) + tx = libc.AtomicLoadPFloat64(x) - *(*float64)(unsafe.Pointer(bp + 8)) + libc.Xmemcpy(tls, bp+24, bp, uint64(8)) + *(*Tu64)(unsafe.Pointer(bp + 24)) &= uint64(0xfffffffffc000000) + libc.Xmemcpy(tls, bp+16, bp+24, uint64(8)) + ty = *(*float64)(unsafe.Pointer(bp)) - *(*float64)(unsafe.Pointer(bp + 16)) + p = *(*float64)(unsafe.Pointer(bp + 8)) * *(*float64)(unsafe.Pointer(bp + 16)) + q = *(*float64)(unsafe.Pointer(bp + 8))*ty + tx**(*float64)(unsafe.Pointer(bp + 16)) + c = p + q + cc = p - c + q + tx*ty + cc = libc.AtomicLoadPFloat64(x)*yy + libc.AtomicLoadPFloat64(x+1*8)**(*float64)(unsafe.Pointer(bp)) + cc + libc.AtomicStorePFloat64(x, c+cc) + libc.AtomicStorePFloat64(x+1*8, c-libc.AtomicLoadPFloat64(x)) + *(*float64)(unsafe.Pointer(x + 1*8)) += cc +} + +// C documentation +// +// /* +// ** The string z[] is an text representation of a real number. +// ** Convert this string to a double and write it into *pResult. +// ** +// ** The string z[] is length bytes in length (bytes, not characters) and +// ** uses the encoding enc. The string is not necessarily zero-terminated. +// ** +// ** Return TRUE if the result is a valid real number (or integer) and FALSE +// ** if the string is empty or contains extraneous text. More specifically +// ** return +// ** 1 => The input string is a pure integer +// ** 2 or more => The input has a decimal point or eNNN clause +// ** 0 or less => The input string is not a valid number +// ** -1 => Not a valid number, but has a valid prefix which +// ** includes a decimal point and/or an eNNN clause +// ** +// ** Valid numbers are in one of these formats: +// ** +// ** [+-]digits[E[+-]digits] +// ** [+-]digits.[digits][E[+-]digits] +// ** [+-].digits[E[+-]digits] +// ** +// ** Leading and trailing whitespace is ignored for the purpose of determining +// ** validity. +// ** +// ** If some prefix of the input string is a valid number, this routine +// ** returns FALSE but it still converts the prefix and writes the result +// ** into *pResult. +// */ +func _sqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc Tu8) (r1 int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var d, e, eType, eValid, esign, i, incr, nDigit, sign, v2 int32 + var r, v3, v4 float64 + var s, s2 Tu64 + var zEnd uintptr + var _ /* rr at bp+0 */ [2]float64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, e, eType, eValid, esign, i, incr, nDigit, r, s, s2, sign, zEnd, v2, v3, v4 + /* sign * significand * (10 ^ (esign * exponent)) */ + sign = int32(1) /* sign of significand */ + s = uint64(0) /* significand */ + d = 0 /* adjust exponent for shifting decimal point */ + esign = int32(1) /* sign of exponent */ + e = 0 /* exponent */ + eValid = int32(1) /* True exponent is either not used or is well-formed */ + nDigit = 0 /* Number of digits processed */ + eType = int32(1) /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */ + *(*float64)(unsafe.Pointer(pResult)) = float64(0) /* Default return value, in case of an error */ + if length == 0 { + return 0 + } + if int32(enc) == int32(SQLITE_UTF8) { + incr = int32(1) + zEnd = z + uintptr(length) + } else { + incr = int32(2) + length &= ^libc.Int32FromInt32(1) + i = int32(3) - int32(enc) + for { + if !(i < length && int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == 0) { + break + } + goto _1 + _1: + ; + i += int32(2) + } + if i < length { + eType = -int32(100) + } + zEnd = z + uintptr(i^int32(1)) + z += uintptr(int32(enc) & libc.Int32FromInt32(1)) + } + /* skip leading spaces */ + for z < zEnd && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x01) != 0 { + z += uintptr(incr) + } + if z >= zEnd { + return 0 + } + /* get sign of significand */ + if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') { + sign = -int32(1) + z += uintptr(incr) + } else { + if int32(*(*int8)(unsafe.Pointer(z))) == int32('+') { + z += uintptr(incr) + } + } + /* copy max significant digits to significand */ + for z < zEnd && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x04) != 0 { + s = s*uint64(10) + uint64(int32(*(*int8)(unsafe.Pointer(z)))-libc.Int32FromUint8('0')) + z += uintptr(incr) + nDigit++ + if s >= (libc.Uint64FromUint32(0xffffffff)|libc.Uint64FromUint32(0xffffffff)<= zEnd { + goto do_atof_calc + } + /* if decimal point is present */ + if int32(*(*int8)(unsafe.Pointer(z))) == int32('.') { + z += uintptr(incr) + eType++ + /* copy digits from after decimal to significand + ** (decrease exponent by d to shift decimal right) */ + for z < zEnd && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x04) != 0 { + if s < (libc.Uint64FromUint32(0xffffffff)|libc.Uint64FromUint32(0xffffffff)<= zEnd { + goto do_atof_calc + } + /* if exponent is present */ + if int32(*(*int8)(unsafe.Pointer(z))) == int32('e') || int32(*(*int8)(unsafe.Pointer(z))) == int32('E') { + z += uintptr(incr) + eValid = 0 + eType++ + /* This branch is needed to avoid a (harmless) buffer overread. The + ** special comment alerts the mutation tester that the correct answer + ** is obtained even if the branch is omitted */ + if z >= zEnd { + goto do_atof_calc + } /*PREVENTS-HARMLESS-OVERREAD*/ + /* get sign of exponent */ + if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') { + esign = -int32(1) + z += uintptr(incr) + } else { + if int32(*(*int8)(unsafe.Pointer(z))) == int32('+') { + z += uintptr(incr) + } + } + /* copy digits to exponent */ + for z < zEnd && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x04) != 0 { + if e < int32(10000) { + v2 = e*int32(10) + (int32(*(*int8)(unsafe.Pointer(z))) - int32('0')) + } else { + v2 = int32(10000) + } + e = v2 + z += uintptr(incr) + eValid = int32(1) + } + } + /* skip trailing spaces */ + for z < zEnd && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x01) != 0 { + z += uintptr(incr) + } +do_atof_calc: + ; + /* Zero is a special case */ + if s == uint64(0) { + if sign < 0 { + v3 = -libc.Float64FromFloat64(0) + } else { + v3 = +libc.Float64FromFloat64(0) + } + *(*float64)(unsafe.Pointer(pResult)) = v3 + goto atof_return + } + /* adjust exponent by d, and update sign */ + e = e*esign + d + /* Try to adjust the exponent to make it smaller */ + for e > 0 && s < (libc.Uint64FromUint32(0xffffffff)|libc.Uint64FromUint32(0xffffffff)< 0 { + for e >= int32(100) { + e -= int32(100) + r = r * libc.Float64FromFloat64(1e+100) + } + for e >= int32(10) { + e -= int32(10) + r = r * libc.Float64FromFloat64(1e+10) + } + for e >= int32(1) { + e -= int32(1) + r = r * libc.Float64FromFloat64(10) + } + } else { + for e <= -int32(100) { + e += int32(100) + r = r * libc.Float64FromFloat64(1e-100) + } + for e <= -int32(10) { + e += int32(10) + r = r * libc.Float64FromFloat64(1e-10) + } + for e <= -int32(1) { + e += int32(1) + r = r * libc.Float64FromFloat64(0.1) + } + } + if r > +libc.Float64FromFloat64(1.7976931348623157081452742373e+308) { + *(*float64)(unsafe.Pointer(pResult)) = float64(+libc.X__builtin_inff(tls)) + } else { + *(*float64)(unsafe.Pointer(pResult)) = r + } + } else { + (*(*[2]float64)(unsafe.Pointer(bp)))[0] = float64(s) + s2 = uint64((*(*[2]float64)(unsafe.Pointer(bp)))[0]) + if s >= s2 { + v4 = float64(s - s2) + } else { + v4 = -float64(s2 - s) + } + (*(*[2]float64)(unsafe.Pointer(bp)))[int32(1)] = v4 + if e > 0 { + for e >= int32(100) { + e -= int32(100) + _dekkerMul2(tls, bp, float64(1e+100), -libc.Float64FromFloat64(1.5902891109759918e+83)) + } + for e >= int32(10) { + e -= int32(10) + _dekkerMul2(tls, bp, float64(1e+10), float64(0)) + } + for e >= int32(1) { + e -= int32(1) + _dekkerMul2(tls, bp, float64(10), float64(0)) + } + } else { + for e <= -int32(100) { + e += int32(100) + _dekkerMul2(tls, bp, float64(1e-100), -libc.Float64FromFloat64(1.9991899802602883e-117)) + } + for e <= -int32(10) { + e += int32(10) + _dekkerMul2(tls, bp, float64(1e-10), -libc.Float64FromFloat64(3.643219731549774e-27)) + } + for e <= -int32(1) { + e += int32(1) + _dekkerMul2(tls, bp, float64(0.1), -libc.Float64FromFloat64(5.551115123125783e-18)) + } + } + *(*float64)(unsafe.Pointer(pResult)) = (*(*[2]float64)(unsafe.Pointer(bp)))[0] + (*(*[2]float64)(unsafe.Pointer(bp)))[int32(1)] + if _sqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(pResult))) != 0 { + *(*float64)(unsafe.Pointer(pResult)) = libc.Float64FromFloat64(1e+300) * libc.Float64FromFloat64(1e+300) + } + } + } + if sign < 0 { + *(*float64)(unsafe.Pointer(pResult)) = -*(*float64)(unsafe.Pointer(pResult)) + } +atof_return: + ; + /* return true if number and no extra non-whitespace characters after */ + if z == zEnd && nDigit > 0 && eValid != 0 && eType > 0 { + return eType + } else { + if eType >= int32(2) && (eType == int32(3) || eValid != 0) && nDigit > 0 { + return -int32(1) + } else { + return 0 + } + } + return r1 +} + +// C documentation +// +// /* +// ** Render an signed 64-bit integer as text. Store the result in zOut[] and +// ** return the length of the string that was stored, in bytes. The value +// ** returned does not include the zero terminator at the end of the output +// ** string. +// ** +// ** The caller must ensure that zOut[] is at least 21 bytes in size. +// */ +func _sqlite3Int64ToText(tls *libc.TLS, v Ti64, zOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, v2 int32 + var x Tu64 + var v1 uint64 + var _ /* zTemp at bp+0 */ [22]int8 + _, _, _, _ = i, x, v1, v2 + if v < 0 { + if v == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32('0') && c <= int32('9')) { + break + } + u = u*uint64(10) + uint64(c) - uint64('0') + goto _2 + _2: + ; + i += incr + } + if u > uint64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(19)*incr { + v6 = int32(1) + } else { + v6 = _compare2pow63(tls, zNum, incr) + } + c = v6 + if c < 0 { + /* zNum is less than 9223372036854775808 so it fits */ + return rc + } else { + if neg != 0 { + v7 = int64(-libc.Int32FromInt32(1)) - (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)< 0 { + /* zNum is greater than 9223372036854775808 so it overflows */ + return int32(2) + } else { + /* zNum is exactly 9223372036854775808. Fits if negative. The + ** special case 2 overflow if positive */ + if neg != 0 { + v8 = rc + } else { + v8 = int32(3) + } + return v8 + } + } + } + return r +} + +// C documentation +// +// /* +// ** Transform a UTF-8 integer literal, in either decimal or hexadecimal, +// ** into a 64-bit signed integer. This routine accepts hexadecimal literals, +// ** whereas sqlite3Atoi64() does not. +// ** +// ** Returns: +// ** +// ** 0 Successful transformation. Fits in a 64-bit signed integer. +// ** 1 Excess text after the integer value +// ** 2 Integer too large for a 64-bit signed integer or is malformed +// ** 3 Special case of 9223372036854775808 +// */ +func _sqlite3DecOrHexToI64(tls *libc.TLS, z uintptr, pOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, k, n int32 + var _ /* u at bp+0 */ Tu64 + _, _, _ = i, k, n + if int32(*(*int8)(unsafe.Pointer(z))) == int32('0') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('x') || int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('X')) { + *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) + i = int32(2) + for { + if !(int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('0')) { + break + } + goto _1 + _1: + ; + i++ + } + k = i + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(k))))])&int32(0x08) != 0) { + break + } + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))*uint64(16) + uint64(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(k)))))) + goto _2 + _2: + ; + k++ + } + libc.Xmemcpy(tls, pOut, bp, uint64(8)) + if k-i > int32(16) { + return int32(2) + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(k)))) != 0 { + return int32(1) + } + return 0 + } else { + n = int32(libc.Uint64FromInt32(0x3fffffff) & libc.Xstrspn(tls, z, __ccgo_ts+1738)) + if *(*int8)(unsafe.Pointer(z + uintptr(n))) != 0 { + n++ + } + return _sqlite3Atoi64(tls, z, pOut, n, uint8(SQLITE_UTF8)) + } + return r +} + +// C documentation +// +// /* +// ** If zNum represents an integer that will fit in 32-bits, then set +// ** *pValue to that integer and return true. Otherwise return false. +// ** +// ** This routine accepts both decimal and hexadecimal notation for integers. +// ** +// ** Any non-numeric characters that following zNum are ignored. +// ** This is different from sqlite3Atoi64() which requires the +// ** input number to be zero-terminated. +// */ +func _sqlite3GetInt32(tls *libc.TLS, zNum uintptr, pValue uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, i, neg, v3 int32 + var v Tsqlite_int64 + var v4 bool + var _ /* u at bp+0 */ Tu32 + _, _, _, _, _, _ = c, i, neg, v, v3, v4 + v = 0 + neg = 0 + if int32(*(*int8)(unsafe.Pointer(zNum))) == int32('-') { + neg = int32(1) + zNum++ + } else { + if int32(*(*int8)(unsafe.Pointer(zNum))) == int32('+') { + zNum++ + } else { + if int32(*(*int8)(unsafe.Pointer(zNum))) == int32('0') && (int32(*(*int8)(unsafe.Pointer(zNum + 1))) == int32('x') || int32(*(*int8)(unsafe.Pointer(zNum + 1))) == int32('X')) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + 2)))])&int32(0x08) != 0 { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + zNum += uintptr(2) + for int32(*(*int8)(unsafe.Pointer(zNum))) == int32('0') { + zNum++ + } + i = 0 + for { + if !(i < int32(8) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + uintptr(i))))])&int32(0x08) != 0) { + break + } + *(*Tu32)(unsafe.Pointer(bp)) = *(*Tu32)(unsafe.Pointer(bp))*uint32(16) + uint32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))))) + goto _1 + _1: + ; + i++ + } + if *(*Tu32)(unsafe.Pointer(bp))&uint32(0x80000000) == uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + uintptr(i))))])&int32(0x08) == 0 { + libc.Xmemcpy(tls, pValue, bp, uint64(4)) + return int32(1) + } else { + return 0 + } + } + } + } + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum)))])&libc.Int32FromInt32(0x04) != 0) { + return 0 + } + for int32(*(*int8)(unsafe.Pointer(zNum))) == int32('0') { + zNum++ + } + i = 0 + for { + if v4 = i < int32(11); v4 { + v3 = int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) - libc.Int32FromUint8('0') + c = v3 + } + if !(v4 && v3 >= 0 && c <= int32(9)) { + break + } + v = v*int64(10) + int64(c) + goto _2 + _2: + ; + i++ + } + /* The longest decimal representation of a 32 bit integer is 10 digits: + ** + ** 1234567890 + ** 2^31 -> 2147483648 + */ + if i > int32(10) { + return 0 + } + if v-int64(neg) > int64(2147483647) { + return 0 + } + if neg != 0 { + v = -v + } + *(*int32)(unsafe.Pointer(pValue)) = int32(v) + return int32(1) +} + +// C documentation +// +// /* +// ** Return a 32-bit integer value extracted from a string. If the +// ** string is not an integer, just return 0. +// */ +func _sqlite3Atoi(tls *libc.TLS, z uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* x at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = 0 + _sqlite3GetInt32(tls, z, bp) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Decode a floating-point value into an approximate decimal +// ** representation. +// ** +// ** Round the decimal representation to n significant digits if +// ** n is positive. Or round to -n signficant digits after the +// ** decimal point if n is negative. No rounding is performed if +// ** n is zero. +// ** +// ** The significant digits of the decimal representation are +// ** stored in p->z[] which is a often (but not always) a pointer +// ** into the middle of p->zBuf[]. There are p->n significant digits. +// ** The p->z[] array is *not* zero-terminated. +// */ +func _sqlite3FpDecode(tls *libc.TLS, p uintptr, _r float64, iRound int32, mxRound int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + *(*float64)(unsafe.Pointer(bp)) = _r + var e, exp, i, j, v2, v3, v4 int32 + var rr float64 + var z uintptr + var v1 uint64 + var _ /* rr at bp+16 */ [2]float64 + var _ /* v at bp+8 */ Tu64 + _, _, _, _, _, _, _, _, _, _ = e, exp, i, j, rr, z, v1, v2, v3, v4 + exp = 0 + (*TFpDecode)(unsafe.Pointer(p)).FisSpecial = 0 + (*TFpDecode)(unsafe.Pointer(p)).Fz = p + 24 + /* Convert negative numbers to positive. Deal with Infinity, 0.0, and + ** NaN. */ + if *(*float64)(unsafe.Pointer(bp)) < float64(0) { + (*TFpDecode)(unsafe.Pointer(p)).Fsign = int8('-') + *(*float64)(unsafe.Pointer(bp)) = -*(*float64)(unsafe.Pointer(bp)) + } else { + if *(*float64)(unsafe.Pointer(bp)) == float64(0) { + (*TFpDecode)(unsafe.Pointer(p)).Fsign = int8('+') + (*TFpDecode)(unsafe.Pointer(p)).Fn = int32(1) + (*TFpDecode)(unsafe.Pointer(p)).FiDP = int32(1) + (*TFpDecode)(unsafe.Pointer(p)).Fz = __ccgo_ts + 1754 + return + } else { + (*TFpDecode)(unsafe.Pointer(p)).Fsign = int8('+') + } + } + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + e = int32(*(*Tu64)(unsafe.Pointer(bp + 8)) >> int32(52)) + if e&int32(0x7ff) == int32(0x7ff) { + (*TFpDecode)(unsafe.Pointer(p)).FisSpecial = int8(int32(1) + libc.BoolInt32(*(*Tu64)(unsafe.Pointer(bp + 8)) != uint64(0x7ff0000000000000))) + (*TFpDecode)(unsafe.Pointer(p)).Fn = 0 + (*TFpDecode)(unsafe.Pointer(p)).FiDP = 0 + return + } + /* Multiply r by powers of ten until it lands somewhere in between + ** 1.0e+19 and 1.0e+17. + */ + if _sqlite3Config.FbUseLongDouble != 0 { + rr = *(*float64)(unsafe.Pointer(bp)) + if rr >= float64(1e+19) { + for rr >= libc.Float64FromFloat64(1e+119) { + exp += int32(100) + rr = rr * libc.Float64FromFloat64(1e-100) + } + for rr >= libc.Float64FromFloat64(1e+29) { + exp += int32(10) + rr = rr * libc.Float64FromFloat64(1e-10) + } + for rr >= libc.Float64FromFloat64(1e+19) { + exp++ + rr = rr * libc.Float64FromFloat64(0.1) + } + } else { + for rr < libc.Float64FromFloat64(1e-97) { + exp -= int32(100) + rr = rr * libc.Float64FromFloat64(1e+100) + } + for rr < libc.Float64FromFloat64(1e+07) { + exp -= int32(10) + rr = rr * libc.Float64FromFloat64(1e+10) + } + for rr < libc.Float64FromFloat64(1e+17) { + exp-- + rr = rr * libc.Float64FromFloat64(10) + } + } + *(*Tu64)(unsafe.Pointer(bp + 8)) = uint64(rr) + } else { + (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] = *(*float64)(unsafe.Pointer(bp)) + (*(*[2]float64)(unsafe.Pointer(bp + 16)))[int32(1)] = float64(0) + if (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] > float64(9.223372036854775e+18) { + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] > float64(9.223372036854774e+118) { + exp += int32(100) + _dekkerMul2(tls, bp+16, float64(1e-100), -libc.Float64FromFloat64(1.9991899802602883e-117)) + } + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] > float64(9.223372036854774e+28) { + exp += int32(10) + _dekkerMul2(tls, bp+16, float64(1e-10), -libc.Float64FromFloat64(3.643219731549774e-27)) + } + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] > float64(9.223372036854775e+18) { + exp += int32(1) + _dekkerMul2(tls, bp+16, float64(0.1), -libc.Float64FromFloat64(5.551115123125783e-18)) + } + } else { + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] < float64(9.223372036854775e-83) { + exp -= int32(100) + _dekkerMul2(tls, bp+16, float64(1e+100), -libc.Float64FromFloat64(1.5902891109759918e+83)) + } + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] < float64(9.223372036854775e+07) { + exp -= int32(10) + _dekkerMul2(tls, bp+16, float64(1e+10), float64(0)) + } + for (*(*[2]float64)(unsafe.Pointer(bp + 16)))[0] < float64(9.223372036854775e+17) { + exp -= int32(1) + _dekkerMul2(tls, bp+16, float64(10), float64(0)) + } + } + if (*(*[2]float64)(unsafe.Pointer(bp + 16)))[int32(1)] < float64(0) { + v1 = uint64((*(*[2]float64)(unsafe.Pointer(bp + 16)))[0]) - uint64(-(*(*[2]float64)(unsafe.Pointer(bp + 16)))[int32(1)]) + } else { + v1 = uint64((*(*[2]float64)(unsafe.Pointer(bp + 16)))[0]) + uint64((*(*[2]float64)(unsafe.Pointer(bp + 16)))[int32(1)]) + } + *(*Tu64)(unsafe.Pointer(bp + 8)) = v1 + } + /* Extract significant digits. */ + i = int32(libc.Uint64FromInt64(24) - libc.Uint64FromInt32(1)) + for *(*Tu64)(unsafe.Pointer(bp + 8)) != 0 { + v2 = i + i-- + *(*int8)(unsafe.Pointer(p + 24 + uintptr(v2))) = int8(*(*Tu64)(unsafe.Pointer(bp + 8))%uint64(10) + uint64('0')) + *(*Tu64)(unsafe.Pointer(bp + 8)) /= uint64(10) + } + (*TFpDecode)(unsafe.Pointer(p)).Fn = int32(libc.Uint64FromInt64(24) - libc.Uint64FromInt32(1) - uint64(i)) + (*TFpDecode)(unsafe.Pointer(p)).FiDP = (*TFpDecode)(unsafe.Pointer(p)).Fn + exp + if iRound <= 0 { + iRound = (*TFpDecode)(unsafe.Pointer(p)).FiDP - iRound + if iRound == 0 && int32(*(*int8)(unsafe.Pointer(p + 24 + uintptr(i+int32(1))))) >= int32('5') { + iRound = int32(1) + v3 = i + i-- + *(*int8)(unsafe.Pointer(p + 24 + uintptr(v3))) = int8('0') + (*TFpDecode)(unsafe.Pointer(p)).Fn++ + (*TFpDecode)(unsafe.Pointer(p)).FiDP++ + } + } + if iRound > 0 && (iRound < (*TFpDecode)(unsafe.Pointer(p)).Fn || (*TFpDecode)(unsafe.Pointer(p)).Fn > mxRound) { + z = p + 24 + uintptr(i+int32(1)) + if iRound > mxRound { + iRound = mxRound + } + (*TFpDecode)(unsafe.Pointer(p)).Fn = iRound + if int32(*(*int8)(unsafe.Pointer(z + uintptr(iRound)))) >= int32('5') { + j = iRound - int32(1) + for int32(1) != 0 { + *(*int8)(unsafe.Pointer(z + uintptr(j)))++ + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) <= int32('9') { + break + } + *(*int8)(unsafe.Pointer(z + uintptr(j))) = int8('0') + if j == 0 { + v4 = i + i-- + *(*int8)(unsafe.Pointer((*TFpDecode)(unsafe.Pointer(p)).Fz + uintptr(v4))) = int8('1') + (*TFpDecode)(unsafe.Pointer(p)).Fn++ + (*TFpDecode)(unsafe.Pointer(p)).FiDP++ + break + } else { + j-- + } + } + } + } + (*TFpDecode)(unsafe.Pointer(p)).Fz = p + 24 + uintptr(i+int32(1)) + for (*TFpDecode)(unsafe.Pointer(p)).Fn > 0 && int32(*(*int8)(unsafe.Pointer((*TFpDecode)(unsafe.Pointer(p)).Fz + uintptr((*TFpDecode)(unsafe.Pointer(p)).Fn-int32(1))))) == int32('0') { + (*TFpDecode)(unsafe.Pointer(p)).Fn-- + } +} + +// C documentation +// +// /* +// ** Try to convert z into an unsigned 32-bit integer. Return true on +// ** success and false if there is an error. +// ** +// ** Only decimal notation is accepted. +// */ +func _sqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) (r int32) { + var i int32 + var v Tu64 + _, _ = i, v + v = uint64(0) + i = 0 + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))])&int32(0x04) != 0) { + break + } + v = v*uint64(10) + uint64(*(*int8)(unsafe.Pointer(z + uintptr(i)))) - uint64('0') + if v > uint64(4294967296) { + *(*Tu32)(unsafe.Pointer(pI)) = uint32(0) + return 0 + } + goto _1 + _1: + ; + i++ + } + if i == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0 { + *(*Tu32)(unsafe.Pointer(pI)) = uint32(0) + return 0 + } + *(*Tu32)(unsafe.Pointer(pI)) = uint32(v) + return int32(1) +} + +/* +** The variable-length integer encoding is as follows: +** +** KEY: +** A = 0xxxxxxx 7 bits of data and one flag bit +** B = 1xxxxxxx 7 bits of data and one flag bit +** C = xxxxxxxx 8 bits of data +** +** 7 bits - A +** 14 bits - BA +** 21 bits - BBA +** 28 bits - BBBA +** 35 bits - BBBBA +** 42 bits - BBBBBA +** 49 bits - BBBBBBA +** 56 bits - BBBBBBBA +** 64 bits - BBBBBBBBC + */ + +// C documentation +// +// /* +// ** Write a 64-bit variable-length integer to memory starting at p[0]. +// ** The length of data write will be between 1 and 9 bytes. The number +// ** of bytes written is returned. +// ** +// ** A variable-length integer consists of the lower 7 bits of each byte +// ** for all bytes that have the 8th bit set and one byte with the 8th +// ** bit clear. Except, if we get to the 9th byte, it stores the full +// ** 8 bits and is the last byte. +// */ +func _putVarint64(tls *libc.TLS, p uintptr, v Tu64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, j, n, v2 int32 + var p3 uintptr + var _ /* buf at bp+0 */ [10]Tu8 + _, _, _, _, _ = i, j, n, v2, p3 + if v&(libc.Uint64FromUint32(0xff000000)<>= uint64(8) + i = int32(7) + for { + if !(i >= 0) { + break + } + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = uint8(v&libc.Uint64FromInt32(0x7f) | libc.Uint64FromInt32(0x80)) + v >>= uint64(7) + goto _1 + _1: + ; + i-- + } + return int32(9) + } + n = 0 + for cond := true; cond; cond = v != uint64(0) { + v2 = n + n++ + (*(*[10]Tu8)(unsafe.Pointer(bp)))[v2] = uint8(v&libc.Uint64FromInt32(0x7f) | libc.Uint64FromInt32(0x80)) + v >>= uint64(7) + } + p3 = bp + *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & libc.Int32FromInt32(0x7f)) + i = 0 + j = n - libc.Int32FromInt32(1) + for { + if !(j >= 0) { + break + } + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (*(*[10]Tu8)(unsafe.Pointer(bp)))[j] + goto _4 + _4: + ; + j-- + i++ + } + return n +} + +func _sqlite3PutVarint(tls *libc.TLS, p uintptr, v Tu64) (r int32) { + if v <= uint64(0x7f) { + *(*uint8)(unsafe.Pointer(p)) = uint8(v & uint64(0x7f)) + return int32(1) + } + if v <= uint64(0x3fff) { + *(*uint8)(unsafe.Pointer(p)) = uint8(v>>libc.Int32FromInt32(7)&uint64(0x7f) | uint64(0x80)) + *(*uint8)(unsafe.Pointer(p + 1)) = uint8(v & uint64(0x7f)) + return int32(2) + } + return _putVarint64(tls, p, v) +} + +/* +** Bitmasks used by sqlite3GetVarint(). These precomputed constants +** are defined here rather than simply putting the constant expressions +** inline in order to work around bugs in the RVT compiler. +** +** SLOT_2_0 A mask for (0x7f<<14) | 0x7f +** +** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0 + */ + +// C documentation +// +// /* +// ** Read a 64-bit variable-length integer from memory starting at p[0]. +// ** Return the number of bytes read. The value is stored in *v. +// */ +func _sqlite3GetVarint(tls *libc.TLS, p uintptr, v uintptr) (r Tu8) { + var a, b, s Tu32 + _, _, _ = a, b, s + if int32(*(*int8)(unsafe.Pointer(p))) >= 0 { + *(*Tu64)(unsafe.Pointer(v)) = uint64(*(*uint8)(unsafe.Pointer(p))) + return uint8(1) + } + if int32(*(*int8)(unsafe.Pointer(p + 1))) >= 0 { + *(*Tu64)(unsafe.Pointer(v)) = uint64(uint32(int32(*(*uint8)(unsafe.Pointer(p)))&libc.Int32FromInt32(0x7f))<> int32(18) + *(*Tu64)(unsafe.Pointer(v)) = uint64(s)<> int32(18) + *(*Tu64)(unsafe.Pointer(v)) = uint64(s)<> int32(11) + *(*Tu64)(unsafe.Pointer(v)) = uint64(s)<> int32(4) + *(*Tu64)(unsafe.Pointer(v)) = uint64(s)<> int32(3) + s |= b + *(*Tu64)(unsafe.Pointer(v)) = uint64(s)<>= uint64(7) + if !(v != uint64(0)) { + break + } + goto _1 + _1: + ; + i++ + } + return i +} + +// C documentation +// +// /* +// ** Read or write a four-byte big-endian integer value. +// */ +func _sqlite3Get4byte(tls *libc.TLS, p uintptr) (r Tu32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* x at bp+0 */ Tu32 + libc.Xmemcpy(tls, bp, p, uint64(4)) + return libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(bp))) +} + +func _sqlite3Put4byte(tls *libc.TLS, p uintptr, v Tu32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* x at bp+0 */ Tu32 + *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, v) + libc.Xmemcpy(tls, p, bp, uint64(4)) +} + +// C documentation +// +// /* +// ** Translate a single byte of Hex into an integer. +// ** This routine only works if h really is a valid hexadecimal +// ** character: 0..9a..fA..F +// */ +func _sqlite3HexToInt(tls *libc.TLS, h int32) (r Tu8) { + h += int32(9) * (int32(1) & (h >> int32(6))) + return uint8(h & libc.Int32FromInt32(0xf)) +} + +// C documentation +// +// /* +// ** Convert a BLOB literal of the form "x'hhhhhh'" into its binary +// ** value. Return a pointer to its binary value. Space to hold the +// ** binary value has been obtained from malloc and must be freed by +// ** the calling routine. +// */ +func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr) { + var i int32 + var zBlob uintptr + _, _ = i, zBlob + zBlob = _sqlite3DbMallocRawNN(tls, db, uint64(n/int32(2)+int32(1))) + n-- + if zBlob != 0 { + i = 0 + for { + if !(i < n) { + break + } + *(*int8)(unsafe.Pointer(zBlob + uintptr(i/int32(2)))) = int8(int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))))<= 0 { + return x + } + if x == libc.Int32FromUint32(0x80000000) { + return int32(0x7fffffff) + } + return -x +} + +// C documentation +// +// /* +// ** Find (an approximate) sum of two LogEst values. This computation is +// ** not a simple "+" operator because LogEst is stored as a logarithmic +// ** value. +// ** +// */ +func _sqlite3LogEstAdd(tls *libc.TLS, a TLogEst, b TLogEst) (r TLogEst) { + if int32(a) >= int32(b) { + if int32(a) > int32(b)+int32(49) { + return a + } + if int32(a) > int32(b)+int32(31) { + return int16(int32(a) + int32(1)) + } + return int16(int32(a) + int32(_x[int32(a)-int32(b)])) + } else { + if int32(b) > int32(a)+int32(49) { + return b + } + if int32(b) > int32(a)+int32(31) { + return int16(int32(b) + int32(1)) + } + return int16(int32(b) + int32(_x[int32(b)-int32(a)])) + } + return r +} + +var _x = [32]uint8{ + 0: uint8(10), + 1: uint8(10), + 2: uint8(9), + 3: uint8(9), + 4: uint8(8), + 5: uint8(8), + 6: uint8(7), + 7: uint8(7), + 8: uint8(7), + 9: uint8(6), + 10: uint8(6), + 11: uint8(6), + 12: uint8(5), + 13: uint8(5), + 14: uint8(5), + 15: uint8(4), + 16: uint8(4), + 17: uint8(4), + 18: uint8(4), + 19: uint8(3), + 20: uint8(3), + 21: uint8(3), + 22: uint8(3), + 23: uint8(3), + 24: uint8(3), + 25: uint8(2), + 26: uint8(2), + 27: uint8(2), + 28: uint8(2), + 29: uint8(2), + 30: uint8(2), + 31: uint8(2), +} + +// C documentation +// +// /* +// ** Convert an integer into a LogEst. In other words, compute an +// ** approximation for 10*log2(x). +// */ +func _sqlite3LogEst(tls *libc.TLS, x Tu64) (r TLogEst) { + var i int32 + var y TLogEst + _, _ = i, y + y = int16(40) + if x < uint64(8) { + if x < uint64(2) { + return 0 + } + for x < uint64(8) { + y = TLogEst(int32(y) - libc.Int32FromInt32(10)) + x <<= uint64(1) + } + } else { + i = int32(60) - libc.X__builtin_clzll(tls, x) + y = TLogEst(int32(y) + i*libc.Int32FromInt32(10)) + x >>= uint64(i) + } + return int16(int32(_a[x&uint64(7)]) + int32(y) - int32(10)) +} + +var _a = [8]TLogEst{ + 1: int16(2), + 2: int16(3), + 3: int16(5), + 4: int16(6), + 5: int16(7), + 6: int16(8), + 7: int16(9), +} + +// C documentation +// +// /* +// ** Convert a double into a LogEst +// ** In other words, compute an approximation for 10*log2(x). +// */ +func _sqlite3LogEstFromDouble(tls *libc.TLS, _x float64) (r TLogEst) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = _x + var e TLogEst + var _ /* a at bp+8 */ Tu64 + _ = e + if *(*float64)(unsafe.Pointer(bp)) <= libc.Float64FromInt32(1) { + return 0 + } + if *(*float64)(unsafe.Pointer(bp)) <= libc.Float64FromInt32(2000000000) { + return _sqlite3LogEst(tls, uint64(*(*float64)(unsafe.Pointer(bp)))) + } + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + e = int16(*(*Tu64)(unsafe.Pointer(bp + 8))>>libc.Int32FromInt32(52) - uint64(1022)) + return int16(int32(e) * int32(10)) +} + +// C documentation +// +// /* +// ** Convert a LogEst into an integer. +// */ +func _sqlite3LogEstToInt(tls *libc.TLS, x TLogEst) (r Tu64) { + var n Tu64 + var v1 uint64 + _, _ = n, v1 + n = uint64(int32(x) % int32(10)) + x = TLogEst(int32(x) / libc.Int32FromInt32(10)) + if n >= uint64(5) { + n -= uint64(2) + } else { + if n >= uint64(1) { + n -= uint64(1) + } + } + if int32(x) > int32(60) { + return uint64(libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)<= int32(3) { + v1 = (n + uint64(8)) << (int32(x) - int32(3)) + } else { + v1 = (n + uint64(8)) >> (int32(3) - int32(x)) + } + return v1 +} + +// C documentation +// +// /* +// ** Add a new name/number pair to a VList. This might require that the +// ** VList object be reallocated, so return the new VList. If an OOM +// ** error occurs, the original VList returned and the +// ** db->mallocFailed flag is set. +// ** +// ** A VList is really just an array of integers. To destroy a VList, +// ** simply pass it to sqlite3DbFree(). +// ** +// ** The first integer is the number of integers allocated for the whole +// ** VList. The second integer is the number of integers actually used. +// ** Each name/number pair is encoded by subsequent groups of 3 or more +// ** integers. +// ** +// ** Each name/number pair starts with two integers which are the numeric +// ** value for the pair and the size of the name/number pair, respectively. +// ** The text name overlays one or more following integers. The text name +// ** is always zero-terminated. +// ** +// ** Conceptually: +// ** +// ** struct VList { +// ** int nAlloc; // Number of allocated slots +// ** int nUsed; // Number of used slots +// ** struct VListEntry { +// ** int iValue; // Value for this entry +// ** int nSlot; // Slots used by this entry +// ** // ... variable name goes here +// ** } a[0]; +// ** } +// ** +// ** During code generation, pointers to the variable names within the +// ** VList are taken. When that happens, nAlloc is set to zero as an +// ** indication that the VList may never again be enlarged, since the +// ** accompanying realloc() would invalidate the pointers. +// */ +func _sqlite3VListAdd(tls *libc.TLS, db uintptr, pIn uintptr, zName uintptr, nName int32, iVal int32) (r uintptr) { + var i, nInt int32 + var nAlloc Tsqlite3_int64 + var pOut, z uintptr + var v1 int64 + _, _, _, _, _, _ = i, nAlloc, nInt, pOut, z, v1 /* Index in pIn[] where zName is stored */ + nInt = nName/int32(4) + int32(3) + /* Verify ok to add new elements */ + if pIn == uintptr(0) || *(*TVList)(unsafe.Pointer(pIn + 1*4))+nInt > *(*TVList)(unsafe.Pointer(pIn)) { + if pIn != 0 { + v1 = int64(2) * int64(*(*TVList)(unsafe.Pointer(pIn))) + } else { + v1 = int64(10) + } + /* Enlarge the allocation */ + nAlloc = v1 + int64(nInt) + pOut = _sqlite3DbRealloc(tls, db, pIn, uint64(nAlloc)*uint64(4)) + if pOut == uintptr(0) { + return pIn + } + if pIn == uintptr(0) { + *(*TVList)(unsafe.Pointer(pOut + 1*4)) = int32(2) + } + pIn = pOut + *(*TVList)(unsafe.Pointer(pIn)) = int32(nAlloc) + } + i = *(*TVList)(unsafe.Pointer(pIn + 1*4)) + *(*TVList)(unsafe.Pointer(pIn + uintptr(i)*4)) = iVal + *(*TVList)(unsafe.Pointer(pIn + uintptr(i+int32(1))*4)) = nInt + z = pIn + uintptr(i+int32(2))*4 + *(*TVList)(unsafe.Pointer(pIn + 1*4)) = i + nInt + libc.Xmemcpy(tls, z, zName, uint64(nName)) + *(*int8)(unsafe.Pointer(z + uintptr(nName))) = 0 + return pIn +} + +// C documentation +// +// /* +// ** Return a pointer to the name of a variable in the given VList that +// ** has the value iVal. Or return a NULL if there is no such variable in +// ** the list +// */ +func _sqlite3VListNumToName(tls *libc.TLS, pIn uintptr, iVal int32) (r uintptr) { + var i, mx int32 + _, _ = i, mx + if pIn == uintptr(0) { + return uintptr(0) + } + mx = *(*TVList)(unsafe.Pointer(pIn + 1*4)) + i = int32(2) + for cond := true; cond; cond = i < mx { + if *(*TVList)(unsafe.Pointer(pIn + uintptr(i)*4)) == iVal { + return pIn + uintptr(i+int32(2))*4 + } + i += *(*TVList)(unsafe.Pointer(pIn + uintptr(i+int32(1))*4)) + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Return the number of the variable named zName, if it is in VList. +// ** or return 0 if there is no such variable. +// */ +func _sqlite3VListNameToNum(tls *libc.TLS, pIn uintptr, zName uintptr, nName int32) (r int32) { + var i, mx int32 + var z uintptr + _, _, _ = i, mx, z + if pIn == uintptr(0) { + return 0 + } + mx = *(*TVList)(unsafe.Pointer(pIn + 1*4)) + i = int32(2) + for cond := true; cond; cond = i < mx { + z = pIn + uintptr(i+int32(2))*4 + if libc.Xstrncmp(tls, z, zName, uint64(nName)) == 0 && int32(*(*int8)(unsafe.Pointer(z + uintptr(nName)))) == 0 { + return *(*TVList)(unsafe.Pointer(pIn + uintptr(i)*4)) + } + i += *(*TVList)(unsafe.Pointer(pIn + uintptr(i+int32(1))*4)) + } + return 0 +} + +/* +** High-resolution hardware timer used for debugging and testing only. + */ + +/************** End of util.c ************************************************/ +/************** Begin file hash.c ********************************************/ +/* +** 2001 September 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This is the implementation of generic hash-tables +** used in SQLite. + */ +/* #include "sqliteInt.h" */ +/* #include */ + +// C documentation +// +// /* Turn bulk memory into a hash table object by initializing the +// ** fields of the Hash structure. +// ** +// ** "pNew" is a pointer to the hash table that is to be initialized. +// */ +func _sqlite3HashInit(tls *libc.TLS, pNew uintptr) { + (*THash)(unsafe.Pointer(pNew)).Ffirst = uintptr(0) + (*THash)(unsafe.Pointer(pNew)).Fcount = uint32(0) + (*THash)(unsafe.Pointer(pNew)).Fhtsize = uint32(0) + (*THash)(unsafe.Pointer(pNew)).Fht = uintptr(0) +} + +// C documentation +// +// /* Remove all entries from a hash table. Reclaim all memory. +// ** Call this routine to delete a hash table or to reset a hash table +// ** to the empty state. +// */ +func _sqlite3HashClear(tls *libc.TLS, pH uintptr) { + var elem, next_elem uintptr + _, _ = elem, next_elem /* For looping over all elements of the table */ + elem = (*THash)(unsafe.Pointer(pH)).Ffirst + (*THash)(unsafe.Pointer(pH)).Ffirst = uintptr(0) + Xsqlite3_free(tls, (*THash)(unsafe.Pointer(pH)).Fht) + (*THash)(unsafe.Pointer(pH)).Fht = uintptr(0) + (*THash)(unsafe.Pointer(pH)).Fhtsize = uint32(0) + for elem != 0 { + next_elem = (*THashElem)(unsafe.Pointer(elem)).Fnext + Xsqlite3_free(tls, elem) + elem = next_elem + } + (*THash)(unsafe.Pointer(pH)).Fcount = uint32(0) +} + +// C documentation +// +// /* +// ** The hashing function. +// */ +func _strHash(tls *libc.TLS, z uintptr) (r uint32) { + var c, v1 uint8 + var h uint32 + var v2 uintptr + _, _, _, _ = c, h, v1, v2 + h = uint32(0) + for { + v2 = z + z++ + v1 = uint8(*(*int8)(unsafe.Pointer(v2))) + c = v1 + if !(int32(v1) != 0) { + break + } /*OPTIMIZATION-IF-TRUE*/ + /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). + ** 0x9e3779b1 is 2654435761 which is the closest prime number to + ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */ + h += uint32(_sqlite3UpperToLower[c]) + h *= uint32(0x9e3779b1) + } + return h +} + +// C documentation +// +// /* Link pNew element into the hash table pH. If pEntry!=0 then also +// ** insert pNew into the pEntry hash bucket. +// */ +func _insertElement(tls *libc.TLS, pH uintptr, pEntry uintptr, pNew uintptr) { + var pHead, v1 uintptr + _, _ = pHead, v1 /* First element already in pEntry */ + if pEntry != 0 { + if (*T_ht)(unsafe.Pointer(pEntry)).Fcount != 0 { + v1 = (*T_ht)(unsafe.Pointer(pEntry)).Fchain + } else { + v1 = uintptr(0) + } + pHead = v1 + (*T_ht)(unsafe.Pointer(pEntry)).Fcount++ + (*T_ht)(unsafe.Pointer(pEntry)).Fchain = pNew + } else { + pHead = uintptr(0) + } + if pHead != 0 { + (*THashElem)(unsafe.Pointer(pNew)).Fnext = pHead + (*THashElem)(unsafe.Pointer(pNew)).Fprev = (*THashElem)(unsafe.Pointer(pHead)).Fprev + if (*THashElem)(unsafe.Pointer(pHead)).Fprev != 0 { + (*THashElem)(unsafe.Pointer((*THashElem)(unsafe.Pointer(pHead)).Fprev)).Fnext = pNew + } else { + (*THash)(unsafe.Pointer(pH)).Ffirst = pNew + } + (*THashElem)(unsafe.Pointer(pHead)).Fprev = pNew + } else { + (*THashElem)(unsafe.Pointer(pNew)).Fnext = (*THash)(unsafe.Pointer(pH)).Ffirst + if (*THash)(unsafe.Pointer(pH)).Ffirst != 0 { + (*THashElem)(unsafe.Pointer((*THash)(unsafe.Pointer(pH)).Ffirst)).Fprev = pNew + } + (*THashElem)(unsafe.Pointer(pNew)).Fprev = uintptr(0) + (*THash)(unsafe.Pointer(pH)).Ffirst = pNew + } +} + +// C documentation +// +// /* Resize the hash table so that it contains "new_size" buckets. +// ** +// ** The hash table might fail to resize if sqlite3_malloc() fails or +// ** if the new size is the same as the prior size. +// ** Return TRUE if the resize occurs and false if not. +// */ +func _rehash(tls *libc.TLS, pH uintptr, new_size uint32) (r int32) { + var elem, new_ht, next_elem uintptr + var h, v1 uint32 + _, _, _, _, _ = elem, h, new_ht, next_elem, v1 /* For looping over existing elements */ + if uint64(new_size)*uint64(16) > uint64(SQLITE_MALLOC_SOFT_LIMIT) { + new_size = uint32(libc.Uint64FromInt32(SQLITE_MALLOC_SOFT_LIMIT) / libc.Uint64FromInt64(16)) + } + if new_size == (*THash)(unsafe.Pointer(pH)).Fhtsize { + return 0 + } + /* The inability to allocates space for a larger hash table is + ** a performance hit but it is not a fatal error. So mark the + ** allocation as a benign. Use sqlite3Malloc()/memset(0) instead of + ** sqlite3MallocZero() to make the allocation, as sqlite3MallocZero() + ** only zeroes the requested number of bytes whereas this module will + ** use the actual amount of space allocated for the hash table (which + ** may be larger than the requested amount). + */ + _sqlite3BeginBenignMalloc(tls) + new_ht = _sqlite3Malloc(tls, uint64(new_size)*uint64(16)) + _sqlite3EndBenignMalloc(tls) + if new_ht == uintptr(0) { + return 0 + } + Xsqlite3_free(tls, (*THash)(unsafe.Pointer(pH)).Fht) + (*THash)(unsafe.Pointer(pH)).Fht = new_ht + v1 = uint32(uint64(_sqlite3MallocSize(tls, new_ht)) / libc.Uint64FromInt64(16)) + new_size = v1 + (*THash)(unsafe.Pointer(pH)).Fhtsize = v1 + libc.Xmemset(tls, new_ht, 0, uint64(new_size)*uint64(16)) + elem = (*THash)(unsafe.Pointer(pH)).Ffirst + (*THash)(unsafe.Pointer(pH)).Ffirst = libc.UintptrFromInt32(0) + for { + if !(elem != 0) { + break + } + h = _strHash(tls, (*THashElem)(unsafe.Pointer(elem)).FpKey) % new_size + next_elem = (*THashElem)(unsafe.Pointer(elem)).Fnext + _insertElement(tls, pH, new_ht+uintptr(h)*16, elem) + goto _2 + _2: + ; + elem = next_elem + } + return int32(1) +} + +// C documentation +// +// /* This function (for internal use only) locates an element in an +// ** hash table that matches the given key. If no element is found, +// ** a pointer to a static null element with HashElem.data==0 is returned. +// ** If pH is not NULL, then the hash for this key is written to *pH. +// */ +func _findElementWithHash(tls *libc.TLS, pH uintptr, pKey uintptr, pHash uintptr) (r uintptr) { + var count, h uint32 + var elem, pEntry uintptr + _, _, _, _ = count, elem, h, pEntry /* The computed hash */ + if (*THash)(unsafe.Pointer(pH)).Fht != 0 { + h = _strHash(tls, pKey) % (*THash)(unsafe.Pointer(pH)).Fhtsize + pEntry = (*THash)(unsafe.Pointer(pH)).Fht + uintptr(h)*16 + elem = (*T_ht)(unsafe.Pointer(pEntry)).Fchain + count = (*T_ht)(unsafe.Pointer(pEntry)).Fcount + } else { + h = uint32(0) + elem = (*THash)(unsafe.Pointer(pH)).Ffirst + count = (*THash)(unsafe.Pointer(pH)).Fcount + } + if pHash != 0 { + *(*uint32)(unsafe.Pointer(pHash)) = h + } + for count != 0 { + if _sqlite3StrICmp(tls, (*THashElem)(unsafe.Pointer(elem)).FpKey, pKey) == 0 { + return elem + } + elem = (*THashElem)(unsafe.Pointer(elem)).Fnext + count-- + } + return uintptr(unsafe.Pointer(&_nullElement)) +} + +var _nullElement = THashElem{} + +// C documentation +// +// /* Remove a single entry from the hash table given a pointer to that +// ** element and a hash on the element's key. +// */ +func _removeElementGivenHash(tls *libc.TLS, pH uintptr, elem uintptr, h uint32) { + var pEntry uintptr + _ = pEntry + if (*THashElem)(unsafe.Pointer(elem)).Fprev != 0 { + (*THashElem)(unsafe.Pointer((*THashElem)(unsafe.Pointer(elem)).Fprev)).Fnext = (*THashElem)(unsafe.Pointer(elem)).Fnext + } else { + (*THash)(unsafe.Pointer(pH)).Ffirst = (*THashElem)(unsafe.Pointer(elem)).Fnext + } + if (*THashElem)(unsafe.Pointer(elem)).Fnext != 0 { + (*THashElem)(unsafe.Pointer((*THashElem)(unsafe.Pointer(elem)).Fnext)).Fprev = (*THashElem)(unsafe.Pointer(elem)).Fprev + } + if (*THash)(unsafe.Pointer(pH)).Fht != 0 { + pEntry = (*THash)(unsafe.Pointer(pH)).Fht + uintptr(h)*16 + if (*T_ht)(unsafe.Pointer(pEntry)).Fchain == elem { + (*T_ht)(unsafe.Pointer(pEntry)).Fchain = (*THashElem)(unsafe.Pointer(elem)).Fnext + } + (*T_ht)(unsafe.Pointer(pEntry)).Fcount-- + } + Xsqlite3_free(tls, elem) + (*THash)(unsafe.Pointer(pH)).Fcount-- + if (*THash)(unsafe.Pointer(pH)).Fcount == uint32(0) { + _sqlite3HashClear(tls, pH) + } +} + +// C documentation +// +// /* Attempt to locate an element of the hash table pH with a key +// ** that matches pKey. Return the data for this element if it is +// ** found, or NULL if there is no match. +// */ +func _sqlite3HashFind(tls *libc.TLS, pH uintptr, pKey uintptr) (r uintptr) { + return (*THashElem)(unsafe.Pointer(_findElementWithHash(tls, pH, pKey, uintptr(0)))).Fdata +} + +// C documentation +// +// /* Insert an element into the hash table pH. The key is pKey +// ** and the data is "data". +// ** +// ** If no element exists with a matching key, then a new +// ** element is created and NULL is returned. +// ** +// ** If another element already exists with the same key, then the +// ** new data replaces the old data and the old data is returned. +// ** The key is not copied in this instance. If a malloc fails, then +// ** the new data is returned and the hash table is unchanged. +// ** +// ** If the "data" parameter to this function is NULL, then the +// ** element corresponding to "key" is removed from the hash table. +// */ +func _sqlite3HashInsert(tls *libc.TLS, pH uintptr, pKey uintptr, data uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var elem, new_elem, old_data, v1 uintptr + var _ /* h at bp+0 */ uint32 + _, _, _, _ = elem, new_elem, old_data, v1 /* New element added to the pH */ + elem = _findElementWithHash(tls, pH, pKey, bp) + if (*THashElem)(unsafe.Pointer(elem)).Fdata != 0 { + old_data = (*THashElem)(unsafe.Pointer(elem)).Fdata + if data == uintptr(0) { + _removeElementGivenHash(tls, pH, elem, *(*uint32)(unsafe.Pointer(bp))) + } else { + (*THashElem)(unsafe.Pointer(elem)).Fdata = data + (*THashElem)(unsafe.Pointer(elem)).FpKey = pKey + } + return old_data + } + if data == uintptr(0) { + return uintptr(0) + } + new_elem = _sqlite3Malloc(tls, uint64(32)) + if new_elem == uintptr(0) { + return data + } + (*THashElem)(unsafe.Pointer(new_elem)).FpKey = pKey + (*THashElem)(unsafe.Pointer(new_elem)).Fdata = data + (*THash)(unsafe.Pointer(pH)).Fcount++ + if (*THash)(unsafe.Pointer(pH)).Fcount >= uint32(10) && (*THash)(unsafe.Pointer(pH)).Fcount > uint32(2)*(*THash)(unsafe.Pointer(pH)).Fhtsize { + if _rehash(tls, pH, (*THash)(unsafe.Pointer(pH)).Fcount*uint32(2)) != 0 { + *(*uint32)(unsafe.Pointer(bp)) = _strHash(tls, pKey) % (*THash)(unsafe.Pointer(pH)).Fhtsize + } + } + if (*THash)(unsafe.Pointer(pH)).Fht != 0 { + v1 = (*THash)(unsafe.Pointer(pH)).Fht + uintptr(*(*uint32)(unsafe.Pointer(bp)))*16 + } else { + v1 = uintptr(0) + } + _insertElement(tls, pH, v1, new_elem) + return uintptr(0) +} + +// C documentation +// +// /************** End of hash.c ************************************************/ +// /************** Begin file opcodes.c *****************************************/ +// /* Automatically generated. Do not edit */ +// /* See the tool/mkopcodec.tcl script for details. */ +func _sqlite3OpcodeName(tls *libc.TLS, i int32) (r uintptr) { + return _azName[i] +} + +var _azName = [190]uintptr{ + 0: __ccgo_ts + 1818, + 1: __ccgo_ts + 1828, + 2: __ccgo_ts + 1839, + 3: __ccgo_ts + 1851, + 4: __ccgo_ts + 1862, + 5: __ccgo_ts + 1874, + 6: __ccgo_ts + 1881, + 7: __ccgo_ts + 1889, + 8: __ccgo_ts + 1897, + 9: __ccgo_ts + 1902, + 10: __ccgo_ts + 1907, + 11: __ccgo_ts + 1913, + 12: __ccgo_ts + 1927, + 13: __ccgo_ts + 1933, + 14: __ccgo_ts + 1943, + 15: __ccgo_ts + 1948, + 16: __ccgo_ts + 1953, + 17: __ccgo_ts + 1956, + 18: __ccgo_ts + 1962, + 19: __ccgo_ts + 1969, + 20: __ccgo_ts + 1973, + 21: __ccgo_ts + 1983, + 22: __ccgo_ts + 1990, + 23: __ccgo_ts + 1997, + 24: __ccgo_ts + 2004, + 25: __ccgo_ts + 2011, + 26: __ccgo_ts + 2021, + 27: __ccgo_ts + 2030, + 28: __ccgo_ts + 2041, + 29: __ccgo_ts + 2050, + 30: __ccgo_ts + 2056, + 31: __ccgo_ts + 2066, + 32: __ccgo_ts + 2076, + 33: __ccgo_ts + 2081, + 34: __ccgo_ts + 2091, + 35: __ccgo_ts + 2102, + 36: __ccgo_ts + 2107, + 37: __ccgo_ts + 2114, + 38: __ccgo_ts + 2125, + 39: __ccgo_ts + 2130, + 40: __ccgo_ts + 2135, + 41: __ccgo_ts + 2141, + 42: __ccgo_ts + 2147, + 43: __ccgo_ts + 2153, + 44: __ccgo_ts + 2156, + 45: __ccgo_ts + 2160, + 46: __ccgo_ts + 2166, + 47: __ccgo_ts + 2177, + 48: __ccgo_ts + 2188, + 49: __ccgo_ts + 2196, + 50: __ccgo_ts + 2205, + 51: __ccgo_ts + 2212, + 52: __ccgo_ts + 2220, + 53: __ccgo_ts + 2223, + 54: __ccgo_ts + 2226, + 55: __ccgo_ts + 2229, + 56: __ccgo_ts + 2232, + 57: __ccgo_ts + 2235, + 58: __ccgo_ts + 2238, + 59: __ccgo_ts + 2245, + 60: __ccgo_ts + 2251, + 61: __ccgo_ts + 2261, + 62: __ccgo_ts + 2274, + 63: __ccgo_ts + 2285, + 64: __ccgo_ts + 2291, + 65: __ccgo_ts + 2298, + 66: __ccgo_ts + 2307, + 67: __ccgo_ts + 2316, + 68: __ccgo_ts + 2323, + 69: __ccgo_ts + 2336, + 70: __ccgo_ts + 2347, + 71: __ccgo_ts + 2352, + 72: __ccgo_ts + 2360, + 73: __ccgo_ts + 2366, + 74: __ccgo_ts + 2373, + 75: __ccgo_ts + 2385, + 76: __ccgo_ts + 2390, + 77: __ccgo_ts + 2399, + 78: __ccgo_ts + 2404, + 79: __ccgo_ts + 2413, + 80: __ccgo_ts + 2418, + 81: __ccgo_ts + 2423, + 82: __ccgo_ts + 2429, + 83: __ccgo_ts + 2437, + 84: __ccgo_ts + 2445, + 85: __ccgo_ts + 2455, + 86: __ccgo_ts + 2463, + 87: __ccgo_ts + 2470, + 88: __ccgo_ts + 2483, + 89: __ccgo_ts + 2488, + 90: __ccgo_ts + 2500, + 91: __ccgo_ts + 2508, + 92: __ccgo_ts + 2515, + 93: __ccgo_ts + 2526, + 94: __ccgo_ts + 2533, + 95: __ccgo_ts + 2540, + 96: __ccgo_ts + 2550, + 97: __ccgo_ts + 2559, + 98: __ccgo_ts + 2570, + 99: __ccgo_ts + 2576, + 100: __ccgo_ts + 2587, + 101: __ccgo_ts + 2597, + 102: __ccgo_ts + 2607, + 103: __ccgo_ts + 2614, + 104: __ccgo_ts + 2620, + 105: __ccgo_ts + 2630, + 106: __ccgo_ts + 2641, + 107: __ccgo_ts + 2645, + 108: __ccgo_ts + 2654, + 109: __ccgo_ts + 2663, + 110: __ccgo_ts + 2670, + 111: __ccgo_ts + 2680, + 112: __ccgo_ts + 2687, + 113: __ccgo_ts + 2696, + 114: __ccgo_ts + 2706, + 115: __ccgo_ts + 2713, + 116: __ccgo_ts + 2721, + 117: __ccgo_ts + 2735, + 118: __ccgo_ts + 2743, + 119: __ccgo_ts + 2757, + 120: __ccgo_ts + 2768, + 121: __ccgo_ts + 2781, + 122: __ccgo_ts + 2792, + 123: __ccgo_ts + 2798, + 124: __ccgo_ts + 2810, + 125: __ccgo_ts + 2819, + 126: __ccgo_ts + 2827, + 127: __ccgo_ts + 2836, + 128: __ccgo_ts + 2845, + 129: __ccgo_ts + 2852, + 130: __ccgo_ts + 2860, + 131: __ccgo_ts + 2867, + 132: __ccgo_ts + 2878, + 133: __ccgo_ts + 2892, + 134: __ccgo_ts + 2903, + 135: __ccgo_ts + 2911, + 136: __ccgo_ts + 2917, + 137: __ccgo_ts + 2925, + 138: __ccgo_ts + 2933, + 139: __ccgo_ts + 2943, + 140: __ccgo_ts + 2956, + 141: __ccgo_ts + 2966, + 142: __ccgo_ts + 2979, + 143: __ccgo_ts + 2988, + 144: __ccgo_ts + 2999, + 145: __ccgo_ts + 3007, + 146: __ccgo_ts + 3013, + 147: __ccgo_ts + 3025, + 148: __ccgo_ts + 3037, + 149: __ccgo_ts + 3045, + 150: __ccgo_ts + 3057, + 151: __ccgo_ts + 3070, + 152: __ccgo_ts + 3080, + 153: __ccgo_ts + 3090, + 154: __ccgo_ts + 3095, + 155: __ccgo_ts + 3107, + 156: __ccgo_ts + 3119, + 157: __ccgo_ts + 3129, + 158: __ccgo_ts + 3135, + 159: __ccgo_ts + 3145, + 160: __ccgo_ts + 3152, + 161: __ccgo_ts + 3164, + 162: __ccgo_ts + 3175, + 163: __ccgo_ts + 3183, + 164: __ccgo_ts + 3192, + 165: __ccgo_ts + 3201, + 166: __ccgo_ts + 3210, + 167: __ccgo_ts + 3217, + 168: __ccgo_ts + 3228, + 169: __ccgo_ts + 3241, + 170: __ccgo_ts + 3251, + 171: __ccgo_ts + 3258, + 172: __ccgo_ts + 3266, + 173: __ccgo_ts + 3275, + 174: __ccgo_ts + 3281, + 175: __ccgo_ts + 3288, + 176: __ccgo_ts + 3296, + 177: __ccgo_ts + 3304, + 178: __ccgo_ts + 3312, + 179: __ccgo_ts + 3322, + 180: __ccgo_ts + 3331, + 181: __ccgo_ts + 3342, + 182: __ccgo_ts + 3353, + 183: __ccgo_ts + 3364, + 184: __ccgo_ts + 3374, + 185: __ccgo_ts + 3380, + 186: __ccgo_ts + 3391, + 187: __ccgo_ts + 3402, + 188: __ccgo_ts + 3407, + 189: __ccgo_ts + 3415, +} + +type Tnlink_t = uint32 + +type nlink_t = Tnlink_t + +type Tblksize_t = int32 + +type blksize_t = Tblksize_t + +type Tregister_t = int64 + +type register_t = Tregister_t + +type Tsuseconds_t = int64 + +type suseconds_t = Tsuseconds_t + +type Tint8_t = int8 + +type int8_t = Tint8_t + +type Tint16_t = int16 + +type int16_t = Tint16_t + +type Tint32_t = int32 + +type int32_t = Tint32_t + +type Tint64_t = int64 + +type int64_t = Tint64_t + +type Tu_int64_t = uint64 + +type u_int64_t = Tu_int64_t + +type Tmode_t = uint32 + +type mode_t = Tmode_t + +type Tino_t = uint64 + +type ino_t = Tino_t + +type Tdev_t = uint64 + +type dev_t = Tdev_t + +type Tblkcnt_t = int64 + +type blkcnt_t = Tblkcnt_t + +type Tfsblkcnt_t = uint64 + +type fsblkcnt_t = Tfsblkcnt_t + +type Tfsfilcnt_t = uint64 + +type fsfilcnt_t = Tfsfilcnt_t + +type Tid_t = uint32 + +type id_t = Tid_t + +type Tuid_t = uint32 + +type uid_t = Tuid_t + +type Tgid_t = uint32 + +type gid_t = Tgid_t + +type Tkey_t = int32 + +type key_t = Tkey_t + +type Tuseconds_t = uint32 + +type useconds_t = Tuseconds_t + +type Tu_int8_t = uint8 + +type u_int8_t = Tu_int8_t + +type Tu_int16_t = uint16 + +type u_int16_t = Tu_int16_t + +type Tu_int32_t = uint32 + +type u_int32_t = Tu_int32_t + +type Tcaddr_t = uintptr + +type caddr_t = Tcaddr_t + +type Tu_char = uint8 + +type u_char = Tu_char + +type Tu_short = uint16 + +type u_short = Tu_short + +type Tushort = uint16 + +type ushort = Tushort + +type Tu_int = uint32 + +type u_int = Tu_int + +type Tuint = uint32 + +type uint = Tuint + +type Tu_long = uint64 + +type u_long = Tu_long + +type Tulong = uint64 + +type ulong = Tulong + +type Tquad_t = int64 + +type quad_t = Tquad_t + +type Tu_quad_t = uint64 + +type u_quad_t = Tu_quad_t + +type Tuint16_t = uint16 + +type uint16_t = Tuint16_t + +type Tuint32_t = uint32 + +type uint32_t = Tuint32_t + +type Tuint64_t = uint64 + +type uint64_t = Tuint64_t + +type Ttimeval = struct { + Ftv_sec Ttime_t + Ftv_usec Tsuseconds_t +} + +type timeval = Ttimeval + +type Tfd_mask = uint64 + +type fd_mask = Tfd_mask + +type Tfd_set = struct { + Ffds_bits [16]uint64 +} + +type fd_set = Tfd_set + +type Tstat = struct { + Fst_dev Tdev_t + Fst_ino Tino_t + Fst_mode Tmode_t + Fst_nlink Tnlink_t + Fst_uid Tuid_t + Fst_gid Tgid_t + Fst_rdev Tdev_t + F__pad uint64 + Fst_size Toff_t + Fst_blksize Tblksize_t + F__pad2 int32 + Fst_blocks Tblkcnt_t + Fst_atim Ttimespec + Fst_mtim Ttimespec + Fst_ctim Ttimespec + F__unused [2]uint32 +} + +type stat = Tstat + +type Tstatx_timestamp = struct { + Ftv_sec Tint64_t + Ftv_nsec Tuint32_t + F__pad Tuint32_t +} + +type statx_timestamp = Tstatx_timestamp + +type Tstatx = struct { + Fstx_mask Tuint32_t + Fstx_blksize Tuint32_t + Fstx_attributes Tuint64_t + Fstx_nlink Tuint32_t + Fstx_uid Tuint32_t + Fstx_gid Tuint32_t + Fstx_mode Tuint16_t + F__pad0 [1]Tuint16_t + Fstx_ino Tuint64_t + Fstx_size Tuint64_t + Fstx_blocks Tuint64_t + Fstx_attributes_mask Tuint64_t + Fstx_atime Tstatx_timestamp + Fstx_btime Tstatx_timestamp + Fstx_ctime Tstatx_timestamp + Fstx_mtime Tstatx_timestamp + Fstx_rdev_major Tuint32_t + Fstx_rdev_minor Tuint32_t + Fstx_dev_major Tuint32_t + Fstx_dev_minor Tuint32_t + F__pad1 [14]Tuint64_t +} + +type statx = Tstatx + +type Tiovec = struct { + Fiov_base uintptr + Fiov_len Tsize_t +} + +type iovec = Tiovec + +type Tflock = struct { + Fl_type int16 + Fl_whence int16 + Fl_start Toff_t + Fl_len Toff_t + Fl_pid Tpid_t +} + +type flock = Tflock + +type Tfile_handle = struct { + Fhandle_bytes uint32 + Fhandle_type int32 +} + +type file_handle = Tfile_handle + +type Tf_owner_ex = struct { + Ftype1 int32 + Fpid Tpid_t +} + +type f_owner_ex = Tf_owner_ex + +type Twinsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} + +type winsize = Twinsize + +type Tintptr_t = int64 + +type intptr_t = Tintptr_t + +type Titimerval = struct { + Fit_interval Ttimeval + Fit_value Ttimeval +} + +type itimerval = Titimerval + +type Ttimezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} + +type timezone = Ttimezone + +/* +** Try to determine if gethostuuid() is available based on standard +** macros. This might sometimes compute the wrong value for some +** obscure platforms. For those cases, simply compile with one of +** the following: +** +** -DHAVE_GETHOSTUUID=0 +** -DHAVE_GETHOSTUUID=1 +** +** None if this matters except when building on Apple products with +** -DSQLITE_ENABLE_LOCKING_STYLE. + */ + +/* +** Allowed values of unixFile.fsFlags + */ + +/* +** If we are to be thread-safe, include the pthreads header. + */ +/* # include */ + +/* +** Default permissions when creating a new file + */ + +/* +** Default permissions when creating auto proxy dir + */ + +/* +** Maximum supported path-length. + */ + +/* +** Maximum supported symbolic links + */ + +/* +** Remove and stub certain info for WASI (WebAssembly System +** Interface) builds. + */ + +/* Always cast the getpid() return type for compatibility with +** kernel modules in VxWorks. */ + +/* +** Only set the lastErrno if the error code is a real error and not +** a normal expected return code of SQLITE_BUSY or SQLITE_OK + */ + +// C documentation +// +// /* Forward references */ +type TunixShm = struct { + FpShmNode uintptr + FpNext uintptr + FhasMutex Tu8 + Fid Tu8 + FsharedMask Tu16 + FexclMask Tu16 +} + +type unixShm = TunixShm + +/* Connection shared memory */ +type TunixShmNode = struct { + FpInode uintptr + FpShmMutex uintptr + FzFilename uintptr + FhShm int32 + FszRegion int32 + FnRegion Tu16 + FisReadonly Tu8 + FisUnlocked Tu8 + FapRegion uintptr + FnRef int32 + FpFirst uintptr + FaLock [8]int32 +} + +type unixShmNode = TunixShmNode + +/* Shared memory instance */ +type TunixInodeInfo = struct { + FfileId TunixFileId + FpLockMutex uintptr + FnShared int32 + FnLock int32 + FeFileLock uint8 + FbProcessLock uint8 + FpUnused uintptr + FnRef int32 + FpShmNode uintptr + FpNext uintptr + FpPrev uintptr +} + +type unixInodeInfo = TunixInodeInfo + +/* An i-node */ +type TUnixUnusedFd = struct { + Ffd int32 + Fflags int32 + FpNext uintptr +} + +type UnixUnusedFd = TUnixUnusedFd + +/* An unused file descriptor */ + +/* +** Sometimes, after a file handle is closed by SQLite, the file descriptor +** cannot be closed immediately. In these cases, instances of the following +** structure are used to store the file descriptor while waiting for an +** opportunity to either close or reuse it. + */ +type TUnixUnusedFd1 = struct { + Ffd int32 + Fflags int32 + FpNext uintptr +} + +type UnixUnusedFd1 = TUnixUnusedFd1 + +// C documentation +// +// /* +// ** The unixFile structure is subclass of sqlite3_file specific to the unix +// ** VFS implementations. +// */ +type TunixFile = struct { + FpMethod uintptr + FpVfs uintptr + FpInode uintptr + Fh int32 + FeFileLock uint8 + FctrlFlags uint16 + FlastErrno int32 + FlockingContext uintptr + FpPreallocatedUnused uintptr + FzPath uintptr + FpShm uintptr + FszChunk int32 + FnFetchOut int32 + FmmapSize Tsqlite3_int64 + FmmapSizeActual Tsqlite3_int64 + FmmapSizeMax Tsqlite3_int64 + FpMapRegion uintptr + FsectorSize int32 + FdeviceCharacteristics int32 +} + +type unixFile = TunixFile + +type TunixFile1 = struct { + FpMethod uintptr + FpVfs uintptr + FpInode uintptr + Fh int32 + FeFileLock uint8 + FctrlFlags uint16 + FlastErrno int32 + FlockingContext uintptr + FpPreallocatedUnused uintptr + FzPath uintptr + FpShm uintptr + FszChunk int32 + FnFetchOut int32 + FmmapSize Tsqlite3_int64 + FmmapSizeActual Tsqlite3_int64 + FmmapSizeMax Tsqlite3_int64 + FpMapRegion uintptr + FsectorSize int32 + FdeviceCharacteristics int32 +} + +type unixFile1 = TunixFile1 + +// C documentation +// +// /* This variable holds the process id (pid) from when the xRandomness() +// ** method was called. If xOpen() is called from a different process id, +// ** indicating that a fork() has occurred, the PRNG will be reset. +// */ +var _randomnessPid = int32(0) + +/* +** Allowed values for the unixFile.ctrlFlags bitmask: + */ + +/* +** Include code that is common to all os_*.c files + */ +/* #include "os_common.h" */ + +/* +** Define various macros that are missing from some systems. + */ + +/* +** The threadid macro resolves to the thread-id or to 0. Used for +** testing and debugging only. + */ + +/* +** HAVE_MREMAP defaults to true on Linux and false everywhere else. + */ + +/* +** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek() +** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined. + */ + +/* +** Linux-specific IOCTL magic numbers used for controlling F2FS + */ + +// C documentation +// +// /* +// ** Different Unix systems declare open() in different ways. Same use +// ** open(const char*,int,mode_t). Others use open(const char*,int,...). +// ** The difference is important when using a pointer to the function. +// ** +// ** The safest way to deal with the problem is to always use this wrapper +// ** which always has the same well-defined interface. +// */ +func _posixOpen(tls *libc.TLS, zFile uintptr, flags int32, mode int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + return libc.Xopen(tls, zFile, flags, libc.VaList(bp+8, mode)) +} + +// C documentation +// +// /* +// ** Many system calls are accessed through pointer-to-functions so that +// ** they may be overridden at runtime to facilitate fault injection during +// ** testing and sandboxing. The following array holds the names and pointers +// ** to all overrideable system calls. +// */ +type Tunix_syscall = struct { + FzName uintptr + FpCurrent Tsqlite3_syscall_ptr + FpDefault Tsqlite3_syscall_ptr +} + +type unix_syscall = Tunix_syscall + +// C documentation +// +// /* +// ** Many system calls are accessed through pointer-to-functions so that +// ** they may be overridden at runtime to facilitate fault injection during +// ** testing and sandboxing. The following array holds the names and pointers +// ** to all overrideable system calls. +// */ +var _aSyscall = [29]Tunix_syscall{ + 0: { + FzName: __ccgo_ts + 3425, + }, + 1: { + FzName: __ccgo_ts + 3430, + }, + 2: { + FzName: __ccgo_ts + 3436, + }, + 3: { + FzName: __ccgo_ts + 3443, + }, + 4: { + FzName: __ccgo_ts + 3450, + }, + 5: { + FzName: __ccgo_ts + 3455, + }, + 6: { + FzName: __ccgo_ts + 3461, + }, + 7: { + FzName: __ccgo_ts + 3471, + }, + 8: { + FzName: __ccgo_ts + 3477, + }, + 9: { + FzName: __ccgo_ts + 3482, + }, + 10: { + FzName: __ccgo_ts + 3488, + }, + 11: { + FzName: __ccgo_ts + 3496, + }, + 12: { + FzName: __ccgo_ts + 3502, + }, + 13: { + FzName: __ccgo_ts + 3509, + }, + 14: { + FzName: __ccgo_ts + 3518, + }, + 15: { + FzName: __ccgo_ts + 3525, + }, + 16: { + FzName: __ccgo_ts + 3535, + }, + 17: { + FzName: __ccgo_ts + 3542, + }, + 18: { + FzName: __ccgo_ts + 3556, + }, + 19: { + FzName: __ccgo_ts + 3562, + }, + 20: { + FzName: __ccgo_ts + 3568, + }, + 21: { + FzName: __ccgo_ts + 3575, + }, + 22: { + FzName: __ccgo_ts + 3583, + }, + 23: { + FzName: __ccgo_ts + 3588, + }, + 24: { + FzName: __ccgo_ts + 3595, + }, + 25: { + FzName: __ccgo_ts + 3602, + }, + 26: { + FzName: __ccgo_ts + 3614, + }, + 27: { + FzName: __ccgo_ts + 3623, + }, + 28: { + FzName: __ccgo_ts + 3629, + }, +} + +func init() { + p := unsafe.Pointer(&_aSyscall) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_posixOpen) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(libc.Xclose) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(libc.Xaccess) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(libc.Xgetcwd) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(libc.Xstat) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(libc.Xfstat) + *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(libc.Xftruncate) + *(*uintptr)(unsafe.Add(p, 176)) = __ccgo_fp(libc.Xfcntl) + *(*uintptr)(unsafe.Add(p, 200)) = __ccgo_fp(libc.Xread) + *(*uintptr)(unsafe.Add(p, 224)) = __ccgo_fp(libc.Xpread) + *(*uintptr)(unsafe.Add(p, 272)) = __ccgo_fp(libc.Xwrite) + *(*uintptr)(unsafe.Add(p, 296)) = __ccgo_fp(libc.Xpwrite) + *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(libc.Xfchmod) + *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(libc.Xunlink) + *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_openDirectory) + *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(libc.Xmkdir) + *(*uintptr)(unsafe.Add(p, 464)) = __ccgo_fp(libc.Xrmdir) + *(*uintptr)(unsafe.Add(p, 488)) = __ccgo_fp(libc.Xfchown) + *(*uintptr)(unsafe.Add(p, 512)) = __ccgo_fp(libc.Xgeteuid) + *(*uintptr)(unsafe.Add(p, 536)) = __ccgo_fp(libc.Xmmap) + *(*uintptr)(unsafe.Add(p, 560)) = __ccgo_fp(libc.Xmunmap) + *(*uintptr)(unsafe.Add(p, 584)) = __ccgo_fp(libc.Xmremap) + *(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(_unixGetpagesize) + *(*uintptr)(unsafe.Add(p, 632)) = __ccgo_fp(libc.Xreadlink) + *(*uintptr)(unsafe.Add(p, 656)) = __ccgo_fp(libc.Xlstat) +} + +/* End of the overrideable system calls */ + +// C documentation +// +// /* +// ** On some systems, calls to fchown() will trigger a message in a security +// ** log if they come from non-root processes. So avoid calling fchown() if +// ** we are not running as root. +// */ +func _robustFchown(tls *libc.TLS, fd int32, uid Tuid_t, gid Tgid_t) (r int32) { + var v1 int32 + _ = v1 + if (*(*func(*libc.TLS) Tuid_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(21)].FpCurrent})))(tls) != 0 { + v1 = 0 + } else { + v1 = (*(*func(*libc.TLS, int32, Tuid_t, Tgid_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(20)].FpCurrent})))(tls, fd, uid, gid) + } + return v1 +} + +// C documentation +// +// /* +// ** This is the xSetSystemCall() method of sqlite3_vfs for all of the +// ** "unix" VFSes. Return SQLITE_OK upon successfully updating the +// ** system call pointer, or SQLITE_NOTFOUND if there is no configurable +// ** system call named zName. +// */ +func _unixSetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr, pNewFunc Tsqlite3_syscall_ptr) (r int32) { + var i uint32 + var rc int32 + _, _ = i, rc + rc = int32(SQLITE_NOTFOUND) + _ = pNotUsed + if zName == uintptr(0) { + /* If no zName is given, restore all system calls to their default + ** settings and return NULL + */ + rc = SQLITE_OK + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(696)/libc.Uint64FromInt64(24)) { + break + } + if _aSyscall[i].FpDefault != 0 { + _aSyscall[i].FpCurrent = _aSyscall[i].FpDefault + } + goto _1 + _1: + ; + i++ + } + } else { + /* If zName is specified, operate on only the one system call + ** specified. + */ + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(696)/libc.Uint64FromInt64(24)) { + break + } + if libc.Xstrcmp(tls, zName, _aSyscall[i].FzName) == 0 { + if _aSyscall[i].FpDefault == uintptr(0) { + _aSyscall[i].FpDefault = _aSyscall[i].FpCurrent + } + rc = SQLITE_OK + if pNewFunc == uintptr(0) { + pNewFunc = _aSyscall[i].FpDefault + } + _aSyscall[i].FpCurrent = pNewFunc + break + } + goto _2 + _2: + ; + i++ + } + } + return rc +} + +// C documentation +// +// /* +// ** Return the value of a system call. Return NULL if zName is not a +// ** recognized system call name. NULL is also returned if the system call +// ** is currently undefined. +// */ +func _unixGetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr) (r Tsqlite3_syscall_ptr) { + var i uint32 + _ = i + _ = pNotUsed + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(696)/libc.Uint64FromInt64(24)) { + break + } + if libc.Xstrcmp(tls, zName, _aSyscall[i].FzName) == 0 { + return _aSyscall[i].FpCurrent + } + goto _1 + _1: + ; + i++ + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Return the name of the first system call after zName. If zName==NULL +// ** then return the name of the first system call. Return NULL if zName +// ** is the last system call or if zName is not the name of a valid +// ** system call. +// */ +func _unixNextSystemCall(tls *libc.TLS, p uintptr, zName uintptr) (r uintptr) { + var i int32 + _ = i + i = -int32(1) + _ = p + if zName != 0 { + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(696)/libc.Uint64FromInt64(24))-libc.Int32FromInt32(1)) { + break + } + if libc.Xstrcmp(tls, zName, _aSyscall[i].FzName) == 0 { + break + } + goto _1 + _1: + ; + i++ + } + } + i++ + for { + if !(i < int32(libc.Uint64FromInt64(696)/libc.Uint64FromInt64(24))) { + break + } + if _aSyscall[i].FpCurrent != uintptr(0) { + return _aSyscall[i].FzName + } + goto _2 + _2: + ; + i++ + } + return uintptr(0) +} + +/* +** Do not accept any file descriptor less than this value, in order to avoid +** opening database file using file descriptors that are commonly used for +** standard input, output, and error. + */ + +// C documentation +// +// /* +// ** Invoke open(). Do so multiple times, until it either succeeds or +// ** fails for some reason other than EINTR. +// ** +// ** If the file creation mode "m" is 0 then set it to the default for +// ** SQLite. The default is SQLITE_DEFAULT_FILE_PERMISSIONS (normally +// ** 0644) as modified by the system umask. If m is not 0, then +// ** make the file creation mode be exactly m ignoring the umask. +// ** +// ** The m parameter will be non-zero only when creating -wal, -journal, +// ** and -shm files. We want those files to have *exactly* the same +// ** permissions as their original database, unadulterated by the umask. +// ** In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a +// ** transaction crashes and leaves behind hot journals, then any +// ** process that is able to write to the database will also be able to +// ** recover the hot journals. +// */ +func _robust_open(tls *libc.TLS, z uintptr, f int32, m Tmode_t) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var fd int32 + var m2 Tmode_t + var v1 uint32 + var _ /* statbuf at bp+0 */ Tstat + _, _, _ = fd, m2, v1 + if m != 0 { + v1 = m + } else { + v1 = uint32(SQLITE_DEFAULT_FILE_PERMISSIONS) + } + m2 = v1 + for int32(1) != 0 { + fd = (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, z, f|int32(O_CLOEXEC), int32(m2)) + if fd < 0 { + if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EINTR) { + continue + } + break + } + if fd >= int32(SQLITE_MINIMUM_FILE_DESCRIPTOR) { + break + } + if f&(libc.Int32FromInt32(O_EXCL)|libc.Int32FromInt32(O_CREAT)) == libc.Int32FromInt32(O_EXCL)|libc.Int32FromInt32(O_CREAT) { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, z) + } + (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(1)].FpCurrent})))(tls, fd) + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3635, libc.VaList(bp+136, z, fd)) + fd = -int32(1) + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[0].FpCurrent})))(tls, __ccgo_ts+3678, O_RDONLY, int32(m)) < 0 { + break + } + } + if fd >= 0 { + if m != uint32(0) { + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, fd, bp) == 0 && (*(*Tstat)(unsafe.Pointer(bp))).Fst_size == 0 && (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(0777) != m { + (*(*func(*libc.TLS, int32, Tmode_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(14)].FpCurrent})))(tls, fd, m) + } + } + } + return fd +} + +// C documentation +// +// /* +// ** Helper functions to obtain and relinquish the global mutex. The +// ** global mutex is used to protect the unixInodeInfo and +// ** vxworksFileId objects used by this file, all of which may be +// ** shared by multiple threads. +// ** +// ** Function unixMutexHeld() is used to assert() that the global mutex +// ** is held when required. This function is only used as part of assert() +// ** statements. e.g. +// ** +// ** unixEnterMutex() +// ** assert( unixMutexHeld() ); +// ** unixEnterLeave() +// ** +// ** To prevent deadlock, the global unixBigLock must must be acquired +// ** before the unixInodeInfo.pLockMutex mutex, if both are held. It is +// ** OK to get the pLockMutex without holding unixBigLock first, but if +// ** that happens, the unixBigLock mutex must not be acquired until after +// ** pLockMutex is released. +// ** +// ** OK: enter(unixBigLock), enter(pLockInfo) +// ** OK: enter(unixBigLock) +// ** OK: enter(pLockInfo) +// ** ERROR: enter(pLockInfo), enter(unixBigLock) +// */ +var _unixBigLock = uintptr(0) + +func _unixEnterMutex(tls *libc.TLS) { + /* Not a recursive mutex */ + Xsqlite3_mutex_enter(tls, _unixBigLock) +} + +func _unixLeaveMutex(tls *libc.TLS) { + Xsqlite3_mutex_leave(tls, _unixBigLock) +} + +// C documentation +// +// /* +// ** Retry ftruncate() calls that fail due to EINTR +// ** +// ** All calls to ftruncate() within this file should be made through +// ** this wrapper. On the Android platform, bypassing the logic below +// ** could lead to a corrupt database. +// */ +func _robust_ftruncate(tls *libc.TLS, h int32, sz Tsqlite3_int64) (r int32) { + var rc int32 + _ = rc + for cond := true; cond; cond = rc < 0 && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EINTR) { + rc = (*(*func(*libc.TLS, int32, Toff_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(6)].FpCurrent})))(tls, h, sz) + } + return rc +} + +// C documentation +// +// /* +// ** This routine translates a standard POSIX errno code into something +// ** useful to the clients of the sqlite3 functions. Specifically, it is +// ** intended to translate a variety of "try again" errors into SQLITE_BUSY +// ** and a variety of "please close the file descriptor NOW" errors into +// ** SQLITE_IOERR +// ** +// ** Errors during initialization of locks, or file system support for locks, +// ** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately. +// */ +func _sqliteErrorFromPosixError(tls *libc.TLS, posixError int32, sqliteIOErr int32) (r int32) { + switch posixError { + case int32(EACCES): + fallthrough + case int32(EAGAIN): + fallthrough + case int32(ETIMEDOUT): + fallthrough + case int32(EBUSY): + fallthrough + case int32(EINTR): + fallthrough + case int32(ENOLCK): + /* random NFS retry error, unless during file system support + * introspection, in which it actually means what it says */ + return int32(SQLITE_BUSY) + case int32(EPERM): + return int32(SQLITE_PERM) + default: + return sqliteIOErr + } + return r +} + +/****************************************************************************** +****************** Begin Unique File ID Utility Used By VxWorks *************** +** +** On most versions of unix, we can get a unique ID for a file by concatenating +** the device number and the inode number. But this does not work on VxWorks. +** On VxWorks, a unique file id must be based on the canonical filename. +** +** A pointer to an instance of the following structure can be used as a +** unique file ID in VxWorks. Each instance of this structure contains +** a copy of the canonical filename. There is also a reference count. +** The structure is reclaimed when the number of pointers to it drops to +** zero. +** +** There are never very many files open at one time and lookups are not +** a performance-critical path, so it is sufficient to put these +** structures on a linked list. + */ +type TvxworksFileId = struct { + FpNext uintptr + FnRef int32 + FnName int32 + FzCanonicalName uintptr +} + +type vxworksFileId = TvxworksFileId + +/*************** End of Unique File ID Utility Used By VxWorks **************** +******************************************************************************/ + +/****************************************************************************** +*************************** Posix Advisory Locking **************************** +** +** POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996) +** section 6.5.2.2 lines 483 through 490 specify that when a process +** sets or clears a lock, that operation overrides any prior locks set +** by the same process. It does not explicitly say so, but this implies +** that it overrides locks set by the same process using a different +** file descriptor. Consider this test case: +** +** int fd1 = open("./file1", O_RDWR|O_CREAT, 0644); +** int fd2 = open("./file2", O_RDWR|O_CREAT, 0644); +** +** Suppose ./file1 and ./file2 are really the same file (because +** one is a hard or symbolic link to the other) then if you set +** an exclusive lock on fd1, then try to get an exclusive lock +** on fd2, it works. I would have expected the second lock to +** fail since there was already a lock on the file due to fd1. +** But not so. Since both locks came from the same process, the +** second overrides the first, even though they were on different +** file descriptors opened on different file names. +** +** This means that we cannot use POSIX locks to synchronize file access +** among competing threads of the same process. POSIX locks will work fine +** to synchronize access for threads in separate processes, but not +** threads within the same process. +** +** To work around the problem, SQLite has to manage file locks internally +** on its own. Whenever a new database is opened, we have to find the +** specific inode of the database file (the inode is determined by the +** st_dev and st_ino fields of the stat structure that fstat() fills in) +** and check for locks already existing on that inode. When locks are +** created or removed, we have to look at our own internal record of the +** locks to see if another thread has previously set a lock on that same +** inode. +** +** (Aside: The use of inode numbers as unique IDs does not work on VxWorks. +** For VxWorks, we have to use the alternative unique ID system based on +** canonical filename and implemented in the previous division.) +** +** The sqlite3_file structure for POSIX is no longer just an integer file +** descriptor. It is now a structure that holds the integer file +** descriptor and a pointer to a structure that describes the internal +** locks on the corresponding inode. There is one locking structure +** per inode, so if the same inode is opened twice, both unixFile structures +** point to the same locking structure. The locking structure keeps +** a reference count (so we will know when to delete it) and a "cnt" +** field that tells us its internal lock status. cnt==0 means the +** file is unlocked. cnt==-1 means the file has an exclusive lock. +** cnt>0 means there are cnt shared locks on the file. +** +** Any attempt to lock or unlock a file first checks the locking +** structure. The fcntl() system call is only invoked to set a +** POSIX lock if the internal lock structure transitions between +** a locked and an unlocked state. +** +** But wait: there are yet more problems with POSIX advisory locks. +** +** If you close a file descriptor that points to a file that has locks, +** all locks on that file that are owned by the current process are +** released. To work around this problem, each unixInodeInfo object +** maintains a count of the number of pending locks on the inode. +** When an attempt is made to close an unixFile, if there are +** other unixFile open on the same inode that are holding locks, the call +** to close() the file descriptor is deferred until all of the locks clear. +** The unixInodeInfo structure keeps a list of file descriptors that need to +** be closed and that list is walked (and cleared) when the last lock +** clears. +** +** Yet another problem: LinuxThreads do not play well with posix locks. +** +** Many older versions of linux use the LinuxThreads library which is +** not posix compliant. Under LinuxThreads, a lock created by thread +** A cannot be modified or overridden by a different thread B. +** Only thread A can modify the lock. Locking behavior is correct +** if the application uses the newer Native Posix Thread Library (NPTL) +** on linux - with NPTL a lock created by thread A can override locks +** in thread B. But there is no way to know at compile-time which +** threading library is being used. So there is no way to know at +** compile-time whether or not thread A can override locks on thread B. +** One has to do a run-time check to discover the behavior of the +** current process. +** +** SQLite used to support LinuxThreads. But support for LinuxThreads +** was dropped beginning with version 3.7.0. SQLite will still work with +** LinuxThreads provided that (1) there is no more than one connection +** per database file in the same process and (2) database connections +** do not move across threads. + */ + +/* +** An instance of the following structure serves as the key used +** to locate a particular unixInodeInfo object. + */ +type TunixFileId = struct { + Fdev Tdev_t + Fino Tu64 +} + +type unixFileId = TunixFileId + +/* +** An instance of the following structure is allocated for each open +** inode. +** +** A single inode can have multiple file descriptors, so each unixFile +** structure contains a pointer to an instance of this object and this +** object keeps a count of the number of unixFile pointing to it. +** +** Mutex rules: +** +** (1) Only the pLockMutex mutex must be held in order to read or write +** any of the locking fields: +** nShared, nLock, eFileLock, bProcessLock, pUnused +** +** (2) When nRef>0, then the following fields are unchanging and can +** be read (but not written) without holding any mutex: +** fileId, pLockMutex +** +** (3) With the exceptions above, all the fields may only be read +** or written while holding the global unixBigLock mutex. +** +** Deadlock prevention: The global unixBigLock mutex may not +** be acquired while holding the pLockMutex mutex. If both unixBigLock +** and pLockMutex are needed, then unixBigLock must be acquired first. + */ +type TunixInodeInfo1 = struct { + FfileId TunixFileId + FpLockMutex uintptr + FnShared int32 + FnLock int32 + FeFileLock uint8 + FbProcessLock uint8 + FpUnused uintptr + FnRef int32 + FpShmNode uintptr + FpNext uintptr + FpPrev uintptr +} + +type unixInodeInfo1 = TunixInodeInfo1 + +// C documentation +// +// /* +// ** A lists of all unixInodeInfo objects. +// ** +// ** Must hold unixBigLock in order to read or write this variable. +// */ +var _inodeList = uintptr(0) + +// C documentation +// +// /* +// ** +// ** This function - unixLogErrorAtLine(), is only ever called via the macro +// ** unixLogError(). +// ** +// ** It is invoked after an error occurs in an OS function and errno has been +// ** set. It logs a message using sqlite3_log() containing the current value of +// ** errno and, if possible, the human-readable equivalent from strerror() or +// ** strerror_r(). +// ** +// ** The first argument passed to the macro should be the error code that +// ** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). +// ** The two subsequent arguments should be the name of the OS function that +// ** failed (e.g. "unlink", "open") and the associated file-system path, +// ** if any. +// */ +func _unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintptr, iLine int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iErrno int32 + var zErr uintptr + _, _ = iErrno, zErr /* Message from strerror() or equivalent */ + iErrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* Saved syscall error number */ + /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use + ** the strerror() function to obtain the human-readable error message + ** equivalent to errno. Otherwise, use strerror_r(). + */ + /* This is a threadsafe build, but strerror_r() is not available. */ + zErr = __ccgo_ts + 1680 + if zPath == uintptr(0) { + zPath = __ccgo_ts + 1680 + } + Xsqlite3_log(tls, errcode, __ccgo_ts+3688, libc.VaList(bp+8, iLine, iErrno, zFunc, zPath, zErr)) + return errcode +} + +// C documentation +// +// /* +// ** Close a file descriptor. +// ** +// ** We assume that close() almost always works, since it is only in a +// ** very sick application or on a very sick platform that it might fail. +// ** If it does fail, simply leak the file descriptor, but do log the +// ** error. +// ** +// ** Note that it is not safe to retry close() after EINTR since the +// ** file descriptor might have already been reused by another thread. +// ** So we don't even try to recover from an EINTR. Just log the error +// ** and move on. +// */ +func _robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { + var v1 uintptr + _ = v1 + if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(1)].FpCurrent})))(tls, h) != 0 { + if pFile != 0 { + v1 = (*TunixFile)(unsafe.Pointer(pFile)).FzPath + } else { + v1 = uintptr(0) + } + _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(16)<lastErrno. Do this in a subroutine as that provides +// ** a convenient place to set a breakpoint. +// */ +func _storeLastErrno(tls *libc.TLS, pFile uintptr, error1 int32) { + (*TunixFile)(unsafe.Pointer(pFile)).FlastErrno = error1 +} + +// C documentation +// +// /* +// ** Close all file descriptors accumulated in the unixInodeInfo->pUnused list. +// */ +func _closePendingFds(tls *libc.TLS, pFile uintptr) { + var p, pInode, pNext uintptr + _, _, _ = p, pInode, pNext + pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode + p = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpUnused + for { + if !(p != 0) { + break + } + pNext = (*TUnixUnusedFd)(unsafe.Pointer(p)).FpNext + _robust_close(tls, pFile, (*TUnixUnusedFd)(unsafe.Pointer(p)).Ffd, int32(39388)) + Xsqlite3_free(tls, p) + goto _1 + _1: + ; + p = pNext + } + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpUnused = uintptr(0) +} + +// C documentation +// +// /* +// ** Release a unixInodeInfo structure previously allocated by findInodeInfo(). +// ** +// ** The global mutex must be held when this routine is called, but the mutex +// ** on the inode being deleted must NOT be held. +// */ +func _releaseInodeInfo(tls *libc.TLS, pFile uintptr) { + var pInode uintptr + _ = pInode + pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode + if pInode != 0 { + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnRef-- + if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnRef == 0 { + Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + _closePendingFds(tls, pFile) + Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpPrev != 0 { + (*TunixInodeInfo)(unsafe.Pointer((*TunixInodeInfo)(unsafe.Pointer(pInode)).FpPrev)).FpNext = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } else { + _inodeList = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext != 0 { + (*TunixInodeInfo)(unsafe.Pointer((*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext)).FpPrev = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpPrev + } + Xsqlite3_mutex_free(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + Xsqlite3_free(tls, pInode) + } + } +} + +// C documentation +// +// /* +// ** Given a file descriptor, locate the unixInodeInfo object that +// ** describes that file descriptor. Create a new one if necessary. The +// ** return value might be uninitialized if an error occurs. +// ** +// ** The global mutex must held when calling this routine. +// ** +// ** Return an appropriate error code. +// */ +func _findInodeInfo(tls *libc.TLS, pFile uintptr, ppInode uintptr) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var fd, rc int32 + var pInode uintptr + var _ /* fileId at bp+0 */ TunixFileId + var _ /* statbuf at bp+16 */ Tstat + _, _, _ = fd, pInode, rc /* Low-level file information */ + pInode = uintptr(0) /* Candidate unixInodeInfo object */ + /* Get low-level information about the file that we can used to + ** create a unique name for the file. + */ + fd = (*TunixFile)(unsafe.Pointer(pFile)).Fh + rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, fd, bp+16) + if rc != 0 { + _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) + return int32(SQLITE_IOERR) + } + libc.Xmemset(tls, bp, 0, uint64(16)) + (*(*TunixFileId)(unsafe.Pointer(bp))).Fdev = (*(*Tstat)(unsafe.Pointer(bp + 16))).Fst_dev + (*(*TunixFileId)(unsafe.Pointer(bp))).Fino = (*(*Tstat)(unsafe.Pointer(bp + 16))).Fst_ino + pInode = _inodeList + for pInode != 0 && libc.Xmemcmp(tls, bp, pInode, uint64(16)) != 0 { + pInode = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if pInode == uintptr(0) { + pInode = Xsqlite3_malloc64(tls, uint64(80)) + if pInode == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pInode, 0, uint64(80)) + libc.Xmemcpy(tls, pInode, bp, uint64(16)) + if _sqlite3Config.FbCoreMutex != 0 { + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST) + if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex == uintptr(0) { + Xsqlite3_free(tls, pInode) + return int32(SQLITE_NOMEM) + } + } + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnRef = int32(1) + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext = _inodeList + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpPrev = uintptr(0) + if _inodeList != 0 { + (*TunixInodeInfo)(unsafe.Pointer(_inodeList)).FpPrev = pInode + } + _inodeList = pInode + } else { + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnRef++ + } + *(*uintptr)(unsafe.Pointer(ppInode)) = pInode + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return TRUE if pFile has been renamed or unlinked since it was first opened. +// */ +func _fileHasMoved(tls *libc.TLS, pFile uintptr) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var _ /* buf at bp+0 */ Tstat + return libc.BoolInt32((*TunixFile)(unsafe.Pointer(pFile)).FpInode != uintptr(0) && ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).FzPath, bp) != 0 || (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino != (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FfileId.Fino)) +} + +// C documentation +// +// /* +// ** Check a unixFile that is a database. Verify the following: +// ** +// ** (1) There is exactly one hard link on the file +// ** (2) The file is not a symbolic link +// ** (3) The file has not been renamed or unlinked +// ** +// ** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right. +// */ +func _verifyDbFile(tls *libc.TLS, pFile uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var rc int32 + var _ /* buf at bp+0 */ Tstat + _ = rc + /* These verifications occurs for the main database only */ + if int32((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&int32(UNIXFILE_NOLOCK) != 0 { + return + } + rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, bp) + if rc != 0 { + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3719, libc.VaList(bp+136, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if (*(*Tstat)(unsafe.Pointer(bp))).Fst_nlink == uint32(0) { + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3743, libc.VaList(bp+136, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if (*(*Tstat)(unsafe.Pointer(bp))).Fst_nlink > uint32(1) { + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3772, libc.VaList(bp+136, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if _fileHasMoved(tls, pFile) != 0 { + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+3799, libc.VaList(bp+136, (*TunixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } +} + +// C documentation +// +// /* +// ** This routine checks if there is a RESERVED lock held on the specified +// ** file by this or any other process. If such a lock is held, set *pResOut +// ** to a non-zero value otherwise *pResOut is set to zero. The return value +// ** is set to SQLITE_OK unless an I/O error occurs during lock checking. +// */ +func _unixCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var pFile uintptr + var rc, reserved int32 + var _ /* lock at bp+0 */ Tflock + _, _, _ = pFile, rc, reserved + rc = SQLITE_OK + reserved = 0 + pFile = id + Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex) + /* Check if a thread in this process holds such a lock */ + if int32((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FeFileLock) > int32(SHARED_LOCK) { + reserved = int32(1) + } + /* Otherwise see if some other process holds it. + */ + if !(reserved != 0) && !((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FbProcessLock != 0) { + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(14)<iBusyTimeout +** value is set, then it is the number of milliseconds to wait before +** failing the lock. The iBusyTimeout value is always reset back to +** zero on each call. +** +** If SQLITE_ENABLE_SETLK_TIMEOUT is not defined, then do a non-blocking +** attempt to set the lock. + */ + +// C documentation +// +// /* +// ** Attempt to set a system-lock on the file pFile. The lock is +// ** described by pLock. +// ** +// ** If the pFile was opened read/write from unix-excl, then the only lock +// ** ever obtained is an exclusive lock, and it is obtained exactly once +// ** the first time any lock is attempted. All subsequent system locking +// ** operations become no-ops. Locking operations still happen internally, +// ** in order to coordinate access between separate database connections +// ** within this process, but all of that is handled in memory and the +// ** operating system does not participate. +// ** +// ** This function is a pass-through to fcntl(F_SETLK) if pFile is using +// ** any VFS other than "unix-excl" or if pFile is opened on "unix-excl" +// ** and is read-only. +// ** +// ** Zero is returned if the call completes successfully, or -1 if a call +// ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()). +// */ +func _unixFileLock(tls *libc.TLS, pFile uintptr, pLock uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var pInode uintptr + var rc int32 + var _ /* lock at bp+0 */ Tflock + _, _ = pInode, rc + pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode + if int32((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&(libc.Int32FromInt32(UNIXFILE_EXCL)|libc.Int32FromInt32(UNIXFILE_RDONLY)) == int32(UNIXFILE_EXCL) { + if int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0 { + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(SHARED_SIZE) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) + rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_SETLK), libc.VaList(bp+40, bp)) + if rc < 0 { + return rc + } + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock = uint8(1) + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ + } else { + rc = 0 + } + } else { + rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_SETLK), libc.VaList(bp+40, pLock)) + } + return rc +} + +// C documentation +// +// /* +// ** Lock the file with the lock specified by parameter eFileLock - one +// ** of the following: +// ** +// ** (1) SHARED_LOCK +// ** (2) RESERVED_LOCK +// ** (3) PENDING_LOCK +// ** (4) EXCLUSIVE_LOCK +// ** +// ** Sometimes when requesting one lock state, additional lock states +// ** are inserted in between. The locking might fail on one of the later +// ** transitions leaving the lock state different from what it started but +// ** still short of its goal. The following chart shows the allowed +// ** transitions and the inserted intermediate states: +// ** +// ** UNLOCKED -> SHARED +// ** SHARED -> RESERVED +// ** SHARED -> EXCLUSIVE +// ** RESERVED -> (PENDING) -> EXCLUSIVE +// ** PENDING -> EXCLUSIVE +// ** +// ** This routine will only increase a lock. Use the sqlite3OsUnlock() +// ** routine to lower a locking level. +// */ +func _unixLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pFile, pInode uintptr + var rc, tErrno, v1 int32 + var _ /* lock at bp+0 */ Tflock + _, _, _, _, _ = pFile, pInode, rc, tErrno, v1 + /* The following describes the implementation of the various locks and + ** lock transitions in terms of the POSIX advisory shared and exclusive + ** lock primitives (called read-locks and write-locks below, to avoid + ** confusion with SQLite lock names). The algorithms are complicated + ** slightly in order to be compatible with Windows95 systems simultaneously + ** accessing the same database file, in case that is ever required. + ** + ** Symbols defined in os.h identify the 'pending byte' and the 'reserved + ** byte', each single bytes at well known offsets, and the 'shared byte + ** range', a range of 510 bytes at a well known offset. + ** + ** To obtain a SHARED lock, a read-lock is obtained on the 'pending + ** byte'. If this is successful, 'shared byte range' is read-locked + ** and the lock on the 'pending byte' released. (Legacy note: When + ** SQLite was first developed, Windows95 systems were still very common, + ** and Windows95 lacks a shared-lock capability. So on Windows95, a + ** single randomly selected by from the 'shared byte range' is locked. + ** Windows95 is now pretty much extinct, but this work-around for the + ** lack of shared-locks on Windows95 lives on, for backwards + ** compatibility.) + ** + ** A process may only obtain a RESERVED lock after it has a SHARED lock. + ** A RESERVED lock is implemented by grabbing a write-lock on the + ** 'reserved byte'. + ** + ** An EXCLUSIVE lock may only be requested after either a SHARED or + ** RESERVED lock is held. An EXCLUSIVE lock is implemented by obtaining + ** a write-lock on the entire 'shared byte range'. Since all other locks + ** require a read-lock on one of the bytes within this range, this ensures + ** that no other locks are held on the database. + ** + ** If a process that holds a RESERVED lock requests an EXCLUSIVE, then + ** a PENDING lock is obtained first. A PENDING lock is implemented by + ** obtaining a write-lock on the 'pending byte'. This ensures that no new + ** SHARED locks can be obtained, but existing SHARED locks are allowed to + ** persist. If the call to this function fails to obtain the EXCLUSIVE + ** lock in this case, it holds the PENDING lock instead. The client may + ** then re-attempt the EXCLUSIVE lock later on, after existing SHARED + ** locks have cleared. + */ + rc = SQLITE_OK + pFile = id + tErrno = 0 + /* If there is already a lock of this type or more restrictive on the + ** unixFile, do nothing. Don't use the end_lock: exit path, as + ** unixEnterMutex() hasn't been called yet. + */ + if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) >= eFileLock { + return SQLITE_OK + } + /* Make sure the locking sequence is correct. + ** (1) We never move from unlocked to anything higher than shared lock. + ** (2) SQLite never explicitly requests a pending lock. + ** (3) A shared lock is always held when a reserve lock is requested. + */ + /* This mutex is needed because pFile->pInode is shared across threads + */ + pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode + Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + /* If some thread using this PID has a lock via a different unixFile* + ** handle that precludes the requested lock, return BUSY. + */ + if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) != int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) && (int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) >= int32(PENDING_LOCK) || eFileLock > int32(SHARED_LOCK)) { + rc = int32(SQLITE_BUSY) + goto end_lock + } + /* If a SHARED lock is requested, and some thread using this PID already + ** has a SHARED or RESERVED lock, then increment reference counts and + ** return SQLITE_OK. + */ + if eFileLock == int32(SHARED_LOCK) && (int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(SHARED_LOCK) || int32((*TunixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == int32(RESERVED_LOCK)) { + (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnShared++ + (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ + goto end_lock + } + /* A PENDING lock is needed before acquiring a SHARED lock and before + ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will + ** be released. + */ + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + if eFileLock == int32(SHARED_LOCK) || eFileLock == int32(EXCLUSIVE_LOCK) && int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) == int32(RESERVED_LOCK) { + if eFileLock == int32(SHARED_LOCK) { + v1 = F_RDLCK + } else { + v1 = int32(F_WRLCK) + } + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(v1) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte) + if _unixFileLock(tls, pFile, bp) != 0 { + tErrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) + rc = _sqliteErrorFromPosixError(tls, tErrno, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(15)< int32(1) { + /* We are trying for an exclusive lock but another thread in this + ** same process is still holding a shared lock. */ + rc = int32(SQLITE_BUSY) + } else { + /* The request was for a RESERVED or EXCLUSIVE lock. It is + ** assumed that there is a SHARED or greater lock on the file + ** already. + */ + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) + if eFileLock == int32(RESERVED_LOCK) { + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) + } else { + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(SHARED_SIZE) + } + if _unixFileLock(tls, pFile, bp) != 0 { + tErrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) + rc = _sqliteErrorFromPosixError(tls, tErrno, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(15)< int32(SHARED_LOCK) { + /* downgrading to a shared lock on NFS involves clearing the write lock + ** before establishing the readlock - to avoid a race condition we downgrade + ** the lock in 2 blocks, so that part of the range will be covered by a + ** write lock until the rest is covered by a read lock: + ** 1: [WWWWW] + ** 2: [....W] + ** 3: [RRRRW] + ** 4: [RRRR.] + */ + if eFileLock == int32(SHARED_LOCK) { + _ = handleNFSUnlock + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = F_RDLCK + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(SHARED_SIZE) + if _unixFileLock(tls, pFile, bp) != 0 { + /* In theory, the call to unixFileLock() cannot fail because another + ** process is holding an incompatible lock. If it does, this + ** indicates that the other process is not following the locking + ** protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning + ** SQLITE_BUSY would confuse the upper layer (in practice it causes + ** an assert to fail). */ + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(9)<= 0 { + _robust_close(tls, pFile, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(40172)) + (*TunixFile)(unsafe.Pointer(pFile)).Fh = -int32(1) + } + Xsqlite3_free(tls, (*TunixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) + libc.Xmemset(tls, pFile, 0, uint64(120)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Close a file. +// */ +func _unixClose(tls *libc.TLS, id uintptr) (r int32) { + var pFile, pInode uintptr + var rc int32 + _, _, _ = pFile, pInode, rc + rc = SQLITE_OK + pFile = id + pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode + _verifyDbFile(tls, pFile) + _unixUnlock(tls, id, NO_LOCK) + _unixEnterMutex(tls) + /* unixFile.pInode is always valid here. Otherwise, a different close + ** routine (e.g. nolockClose()) would be called instead. + */ + Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + if (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock != 0 { + /* If there are outstanding locks, do not actually close the file just + ** yet because that would clear those locks. Instead, add the file + ** descriptor to pInode->pUnused list. It will be automatically closed + ** when the last lock is cleared. + */ + _setPendingFd(tls, pFile) + } + Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + _releaseInodeInfo(tls, pFile) + rc = _closeUnixFile(tls, id) + _unixLeaveMutex(tls) + return rc +} + +/************** End of the posix advisory lock implementation ***************** +******************************************************************************/ + +/****************************************************************************** +****************************** No-op Locking ********************************** +** +** Of the various locking implementations available, this is by far the +** simplest: locking is ignored. No attempt is made to lock the database +** file for reading or writing. +** +** This locking mode is appropriate for use on read-only databases +** (ex: databases that are burned into CD-ROM, for example.) It can +** also be used if the application employs some external mechanism to +** prevent simultaneous access of the same database by two or more +** database connections. But there is a serious risk of database +** corruption if this locking mode is used in situations where multiple +** database connections are accessing the same database file at the same +** time and one or more of those connections are writing. + */ + +func _nolockCheckReservedLock(tls *libc.TLS, NotUsed uintptr, pResOut uintptr) (r int32) { + _ = NotUsed + *(*int32)(unsafe.Pointer(pResOut)) = 0 + return SQLITE_OK +} + +func _nolockLock(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32) (r int32) { + _ = NotUsed + _ = NotUsed2 + return SQLITE_OK +} + +func _nolockUnlock(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32) (r int32) { + _ = NotUsed + _ = NotUsed2 + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Close the file. +// */ +func _nolockClose(tls *libc.TLS, id uintptr) (r int32) { + return _closeUnixFile(tls, id) +} + +/******************* End of the no-op lock implementation ********************* +******************************************************************************/ + +/****************************************************************************** +************************* Begin dot-file Locking ****************************** +** +** The dotfile locking implementation uses the existence of separate lock +** files (really a directory) to control access to the database. This works +** on just about every filesystem imaginable. But there are serious downsides: +** +** (1) There is zero concurrency. A single reader blocks all other +** connections from reading or writing the database. +** +** (2) An application crash or power loss can leave stale lock files +** sitting around that need to be cleared manually. +** +** Nevertheless, a dotlock is an appropriate locking mode for use if no +** other locking strategy is available. +** +** Dotfile locking works by creating a subdirectory in the same directory as +** the database and with the same name but with a ".lock" extension added. +** The existence of a lock directory implies an EXCLUSIVE lock. All other +** lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE. + */ + +/* +** The file suffix added to the data base filename in order to create the +** lock directory. + */ + +// C documentation +// +// /* +// ** This routine checks if there is a RESERVED lock held on the specified +// ** file by this or any other process. If such a lock is held, set *pResOut +// ** to a non-zero value otherwise *pResOut is set to zero. The return value +// ** is set to SQLITE_OK unless an I/O error occurs during lock checking. +// ** +// ** In dotfile locking, either a lock exists or it does not. So in this +// ** variation of CheckReservedLock(), *pResOut is set to true if any lock +// ** is held on the file and false if the file is unlocked. +// */ +func _dotlockCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32) { + var pFile uintptr + var rc, reserved int32 + _, _, _ = pFile, rc, reserved + rc = SQLITE_OK + reserved = 0 + pFile = id + reserved = libc.BoolInt32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext, 0) == 0) + *(*int32)(unsafe.Pointer(pResOut)) = reserved + return rc +} + +// C documentation +// +// /* +// ** Lock the file with the lock specified by parameter eFileLock - one +// ** of the following: +// ** +// ** (1) SHARED_LOCK +// ** (2) RESERVED_LOCK +// ** (3) PENDING_LOCK +// ** (4) EXCLUSIVE_LOCK +// ** +// ** Sometimes when requesting one lock state, additional lock states +// ** are inserted in between. The locking might fail on one of the later +// ** transitions leaving the lock state different from what it started but +// ** still short of its goal. The following chart shows the allowed +// ** transitions and the inserted intermediate states: +// ** +// ** UNLOCKED -> SHARED +// ** SHARED -> RESERVED +// ** SHARED -> (PENDING) -> EXCLUSIVE +// ** RESERVED -> (PENDING) -> EXCLUSIVE +// ** PENDING -> EXCLUSIVE +// ** +// ** This routine will only increase a lock. Use the sqlite3OsUnlock() +// ** routine to lower a locking level. +// ** +// ** With dotfile locking, we really only support state (4): EXCLUSIVE. +// ** But we track the other locking levels internally. +// */ +func _dotlockLock(tls *libc.TLS, id uintptr, eFileLock int32) (r int32) { + var pFile, zLockFile uintptr + var rc, tErrno int32 + _, _, _, _ = pFile, rc, tErrno, zLockFile + pFile = id + zLockFile = (*TunixFile)(unsafe.Pointer(pFile)).FlockingContext + rc = SQLITE_OK + /* If we have any lock, then the lock file already exists. All we have + ** to do is adjust our internal record of the lock level. + */ + if int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) > NO_LOCK { + (*TunixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) + /* Always update the timestamp on the old file */ + libc.Xutimes(tls, zLockFile, libc.UintptrFromInt32(0)) + return SQLITE_OK + } + /* grab an exclusive lock */ + rc = (*(*func(*libc.TLS, uintptr, Tmode_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(18)].FpCurrent})))(tls, zLockFile, uint32(0777)) + if rc < 0 { + /* failed to open/create the lock directory */ + tErrno = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) + if int32(EEXIST) == tErrno { + rc = int32(SQLITE_BUSY) + } else { + rc = _sqliteErrorFromPosixError(tls, tErrno, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(15)< 0 { + got = int32((*(*func(*libc.TLS, int32, uintptr, Tsize_t, Toff_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(9)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(id)).Fh, pBuf, uint64(cnt), offset)) + if got == cnt { + break + } + if got < 0 { + if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EINTR) { + got = int32(1) + continue + } + prior = 0 + _storeLastErrno(tls, id, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) + break + } else { + if got > 0 { + cnt -= got + offset += int64(got) + prior += got + pBuf = uintptr(got) + pBuf + } + } + } + return got + prior +} + +// C documentation +// +// /* +// ** Read data from a file into a buffer. Return SQLITE_OK if all +// ** bytes were read successfully and SQLITE_IOERR if anything goes +// ** wrong. +// */ +func _unixRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Tsqlite3_int64) (r int32) { + var got, nCopy int32 + var pFile uintptr + _, _, _ = got, nCopy, pFile + pFile = id + /* If this is a database file (not a journal, super-journal or temp + ** file), the bytes in the locking range should never be read or written. */ + /* Deal with as much of this read request as possible by transferring + ** data from the memory mapping using memcpy(). */ + if offset < (*TunixFile)(unsafe.Pointer(pFile)).FmmapSize { + if offset+int64(amt) <= (*TunixFile)(unsafe.Pointer(pFile)).FmmapSize { + libc.Xmemcpy(tls, pBuf, (*TunixFile)(unsafe.Pointer(pFile)).FpMapRegion+uintptr(offset), uint64(amt)) + return SQLITE_OK + } else { + nCopy = int32((*TunixFile)(unsafe.Pointer(pFile)).FmmapSize - offset) + libc.Xmemcpy(tls, pBuf, (*TunixFile)(unsafe.Pointer(pFile)).FpMapRegion+uintptr(offset), uint64(nCopy)) + pBuf = pBuf + uintptr(nCopy) + amt -= nCopy + offset += int64(nCopy) + } + } + got = _seekAndRead(tls, pFile, offset, pBuf, amt) + if got == amt { + return SQLITE_OK + } else { + if got < 0 { + /* pFile->lastErrno has been set by seekAndRead(). + ** Usually we return SQLITE_IOERR_READ here, though for some + ** kinds of errors we return SQLITE_IOERR_CORRUPTFS. The + ** SQLITE_IOERR_CORRUPTFS will be converted into SQLITE_CORRUPT + ** prior to returning to the application by the sqlite3ApiExit() + ** routine. + */ + switch (*TunixFile)(unsafe.Pointer(pFile)).FlastErrno { + case int32(ERANGE): + fallthrough + case int32(EIO): + fallthrough + case int32(ENXIO): + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(33)<offset then read cnt bytes into pBuf. +// ** Return the number of bytes actually read. Update the offset. +// ** +// ** To avoid stomping the errno value on a failed write the lastErrno value +// ** is set before returning. +// */ +func _seekAndWrite(tls *libc.TLS, id uintptr, offset Ti64, pBuf uintptr, cnt int32) (r int32) { + return _seekAndWriteFd(tls, (*TunixFile)(unsafe.Pointer(id)).Fh, offset, pBuf, cnt, id+32) +} + +// C documentation +// +// /* +// ** Write data from a buffer into a file. Return SQLITE_OK on success +// ** or some other error code on failure. +// */ +func _unixWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Tsqlite3_int64) (r int32) { + var pFile uintptr + var wrote, v1 int32 + _, _, _ = pFile, wrote, v1 + pFile = id + wrote = 0 + /* If this is a database file (not a journal, super-journal or temp + ** file), the bytes in the locking range should never be read or written. */ + for { + v1 = _seekAndWrite(tls, pFile, offset, pBuf, amt) + wrote = v1 + if !(v1 < amt && wrote > 0) { + break + } + amt -= wrote + offset += int64(wrote) + pBuf = pBuf + uintptr(wrote) + } + if amt > wrote { + if wrote < 0 && (*TunixFile)(unsafe.Pointer(pFile)).FlastErrno != int32(ENOSPC) { + /* lastErrno set by seekAndWrite */ + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(3)< 0 && int32((*(*[513]int8)(unsafe.Pointer(bp)))[ii]) != int32('/')) { + break + } + goto _1 + _1: + ; + ii-- + } + if ii > 0 { + (*(*[513]int8)(unsafe.Pointer(bp)))[ii] = int8('\000') + } else { + if int32((*(*[513]int8)(unsafe.Pointer(bp)))[0]) != int32('/') { + (*(*[513]int8)(unsafe.Pointer(bp)))[0] = int8('.') + } + (*(*[513]int8)(unsafe.Pointer(bp)))[int32(1)] = 0 + } + fd = _robust_open(tls, bp, libc.Int32FromInt32(O_RDONLY)|libc.Int32FromInt32(O_BINARY), uint32(0)) + if fd >= 0 { + } + *(*int32)(unsafe.Pointer(pFd)) = fd + if fd >= 0 { + return SQLITE_OK + } + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(41778)), __ccgo_ts+3542, bp, int32(41778)) +} + +// C documentation +// +// /* +// ** Make sure all writes to a particular file are committed to disk. +// ** +// ** If dataOnly==0 then both the file itself and its metadata (file +// ** size, access time, etc) are synced. If dataOnly!=0 then only the +// ** file data is synced. +// ** +// ** Under Unix, also make sure that the directory entry for the file +// ** has been created by fsync-ing the directory that contains the file. +// ** If we do not do this and we encounter a power failure, the directory +// ** entry for the journal might not exist after we reboot. The next +// ** SQLite to access the file will not know that the journal exists (because +// ** the directory entry for the journal was never created) and the transaction +// ** will not roll back - possibly leading to database corruption. +// */ +func _unixSync(tls *libc.TLS, id uintptr, flags int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var isDataOnly, isFullsync, rc int32 + var pFile, p1 uintptr + var _ /* dirfd at bp+0 */ int32 + _, _, _, _, _ = isDataOnly, isFullsync, pFile, rc, p1 + pFile = id + isDataOnly = flags & int32(SQLITE_SYNC_DATAONLY) + isFullsync = libc.BoolInt32(flags&int32(0x0F) == int32(SQLITE_SYNC_FULL)) + /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ + /* Unix cannot, but some systems may return SQLITE_FULL from here. This + ** line is to test that doing so does not cause any problems. + */ + rc = _full_fsync(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) + if rc != 0 { + _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) + return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(4)< 0 { + nByte = (nByte + int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) - int64(1)) / int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) * int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) + } + rc = _robust_ftruncate(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, nByte) + if rc != 0 { + _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) + return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(6)< 0 { /* Used to hold return values of fstat() */ + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, bp) != 0 { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(7)< (*(*Tstat)(unsafe.Pointer(bp))).Fst_size { + /* If the OS does not have posix_fallocate(), fake it. Write a + ** single byte to the last byte in each block that falls entirely + ** within the extended region. Then, if required, a single byte + ** at offset (nSize-1), to set the size of the file correctly. + ** This is a similar technique to that used by glibc on systems + ** that do not have a real fallocate() call. + */ + nBlk = (*(*Tstat)(unsafe.Pointer(bp))).Fst_blksize /* File-system block size */ + nWrite = 0 /* Next offset to write to */ + iWrite = (*(*Tstat)(unsafe.Pointer(bp))).Fst_size/int64(nBlk)*int64(nBlk) + int64(nBlk) - int64(1) + for { + if !(iWrite < nSize+int64(nBlk)-int64(1)) { + break + } + if iWrite >= nSize { + iWrite = nSize - int64(1) + } + nWrite = _seekAndWrite(tls, pFile, iWrite, __ccgo_ts+1680, int32(1)) + if nWrite != int32(1) { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(3)< 0 && nByte > (*TunixFile)(unsafe.Pointer(pFile)).FmmapSize { + if (*TunixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { + if _robust_ftruncate(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { + _storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) + return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(6)<ctrlFlags is set. +// ** +// ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. +// */ +func _unixModeBit(tls *libc.TLS, pFile uintptr, mask uint8, pArg uintptr) { + var p1, p2 uintptr + _, _ = p1, p2 + if *(*int32)(unsafe.Pointer(pArg)) < 0 { + *(*int32)(unsafe.Pointer(pArg)) = libc.BoolInt32(int32((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&int32(mask) != 0) + } else { + if *(*int32)(unsafe.Pointer(pArg)) == 0 { + p1 = pFile + 30 + *(*uint16)(unsafe.Pointer(p1)) = uint16(int32(*(*uint16)(unsafe.Pointer(p1))) & ^int32(mask)) + } else { + p2 = pFile + 30 + *(*uint16)(unsafe.Pointer(p2)) = uint16(int32(*(*uint16)(unsafe.Pointer(p2))) | int32(mask)) + } + } +} + +// C documentation +// +// /* +// ** Information and control of an open file handle. +// */ +func _unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var newLimit Ti64 + var pFile, zTFile uintptr + var rc, rc1 int32 + _, _, _, _, _ = newLimit, pFile, rc, rc1, zTFile + pFile = id + switch op { + case int32(SQLITE_FCNTL_LOCKSTATE): + *(*int32)(unsafe.Pointer(pArg)) = int32((*TunixFile)(unsafe.Pointer(pFile)).FeFileLock) + return SQLITE_OK + case int32(SQLITE_FCNTL_LAST_ERRNO): + *(*int32)(unsafe.Pointer(pArg)) = (*TunixFile)(unsafe.Pointer(pFile)).FlastErrno + return SQLITE_OK + case int32(SQLITE_FCNTL_CHUNK_SIZE): + (*TunixFile)(unsafe.Pointer(pFile)).FszChunk = *(*int32)(unsafe.Pointer(pArg)) + return SQLITE_OK + case int32(SQLITE_FCNTL_SIZE_HINT): + rc = _fcntlSizeHint(tls, pFile, *(*Ti64)(unsafe.Pointer(pArg))) + return rc + case int32(SQLITE_FCNTL_PERSIST_WAL): + _unixModeBit(tls, pFile, uint8(UNIXFILE_PERSIST_WAL), pArg) + return SQLITE_OK + case int32(SQLITE_FCNTL_POWERSAFE_OVERWRITE): + _unixModeBit(tls, pFile, uint8(UNIXFILE_PSOW), pArg) + return SQLITE_OK + case int32(SQLITE_FCNTL_VFSNAME): + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, (*Tsqlite3_vfs)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + return SQLITE_OK + case int32(SQLITE_FCNTL_TEMPFILENAME): + zTFile = Xsqlite3_malloc64(tls, uint64((*Tsqlite3_vfs)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpVfs)).FmxPathname)) + if zTFile != 0 { + _unixGetTempname(tls, (*Tsqlite3_vfs)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpVfs)).FmxPathname, zTFile) + *(*uintptr)(unsafe.Pointer(pArg)) = zTFile + } + return SQLITE_OK + case int32(SQLITE_FCNTL_HAS_MOVED): + *(*int32)(unsafe.Pointer(pArg)) = _fileHasMoved(tls, pFile) + return SQLITE_OK + case int32(SQLITE_FCNTL_MMAP_SIZE): + newLimit = *(*Ti64)(unsafe.Pointer(pArg)) + rc1 = SQLITE_OK + if newLimit > _sqlite3Config.FmxMmap { + newLimit = _sqlite3Config.FmxMmap + } + /* The value of newLimit may be eventually cast to (size_t) and passed + ** to mmap(). Restrict its value to 2GB if (size_t) is not at least a + ** 64-bit type. */ + if newLimit > 0 && libc.Bool(uint64(8) < uint64(8)) { + newLimit = newLimit & libc.Int64FromInt32(0x7FFFFFFF) + } + *(*Ti64)(unsafe.Pointer(pArg)) = (*TunixFile)(unsafe.Pointer(pFile)).FmmapSizeMax + if newLimit >= 0 && newLimit != (*TunixFile)(unsafe.Pointer(pFile)).FmmapSizeMax && (*TunixFile)(unsafe.Pointer(pFile)).FnFetchOut == 0 { + (*TunixFile)(unsafe.Pointer(pFile)).FmmapSizeMax = newLimit + if (*TunixFile)(unsafe.Pointer(pFile)).FmmapSize > 0 { + _unixUnmapfile(tls, pFile) + rc1 = _unixMapfile(tls, pFile, int64(-int32(1))) + } + } + return rc1 + case int32(SQLITE_FCNTL_EXTERNAL_READER): + return _unixFcntlExternalReader(tls, id, pArg) + } + return int32(SQLITE_NOTFOUND) +} + +// C documentation +// +// /* +// ** If pFd->sectorSize is non-zero when this function is called, it is a +// ** no-op. Otherwise, the values of pFd->sectorSize and +// ** pFd->deviceCharacteristics are set according to the file-system +// ** characteristics. +// ** +// ** There are two versions of this function. One for QNX and one for all +// ** other systems. +// */ +func _setDeviceCharacteristics(tls *libc.TLS, pFd uintptr) { + if (*TunixFile)(unsafe.Pointer(pFd)).FsectorSize == 0 { + /* Set the POWERSAFE_OVERWRITE flag if requested. */ + if int32((*TunixFile)(unsafe.Pointer(pFd)).FctrlFlags)&int32(UNIXFILE_PSOW) != 0 { + *(*int32)(unsafe.Pointer(pFd + 116)) |= int32(SQLITE_IOCAP_POWERSAFE_OVERWRITE) + } + (*TunixFile)(unsafe.Pointer(pFd)).FsectorSize = int32(SQLITE_DEFAULT_SECTOR_SIZE) + } +} + +// C documentation +// +// /* +// ** Return the sector size in bytes of the underlying block device for +// ** the specified file. This is almost always 512 bytes, but may be +// ** larger for some devices. +// ** +// ** SQLite code assumes this function cannot fail. It also assumes that +// ** if two files are created in the same file-system directory (i.e. +// ** a database and its journal file) that the sector size will be the +// ** same for both. +// */ +func _unixSectorSize(tls *libc.TLS, id uintptr) (r int32) { + var pFd uintptr + _ = pFd + pFd = id + _setDeviceCharacteristics(tls, pFd) + return (*TunixFile)(unsafe.Pointer(pFd)).FsectorSize +} + +// C documentation +// +// /* +// ** Return the device characteristics for the file. +// ** +// ** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default. +// ** However, that choice is controversial since technically the underlying +// ** file system does not always provide powersafe overwrites. (In other +// ** words, after a power-loss event, parts of the file that were never +// ** written might end up being altered.) However, non-PSOW behavior is very, +// ** very rare. And asserting PSOW makes a large reduction in the amount +// ** of required I/O for journaling, since a lot of padding is eliminated. +// ** Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control +// ** available to turn it off and URI query parameter available to turn it off. +// */ +func _unixDeviceCharacteristics(tls *libc.TLS, id uintptr) (r int32) { + var pFd uintptr + _ = pFd + pFd = id + _setDeviceCharacteristics(tls, pFd) + return (*TunixFile)(unsafe.Pointer(pFd)).FdeviceCharacteristics +} + +// C documentation +// +// /* +// ** Return the system page size. +// ** +// ** This function should not be called directly by other code in this file. +// ** Instead, it should be called via macro osGetpagesize(). +// */ +func _unixGetpagesize(tls *libc.TLS) (r int32) { + return int32(libc.Xsysconf(tls, int32(_SC_PAGESIZE))) +} + +/* +** Object used to represent an shared memory buffer. +** +** When multiple threads all reference the same wal-index, each thread +** has its own unixShm object, but they all point to a single instance +** of this unixShmNode object. In other words, each wal-index is opened +** only once per process. +** +** Each unixShmNode object is connected to a single unixInodeInfo object. +** We could coalesce this object into unixInodeInfo, but that would mean +** every open file that does not use shared memory (in other words, most +** open files) would have to carry around this extra information. So +** the unixInodeInfo object contains a pointer to this unixShmNode object +** and the unixShmNode object is created only when needed. +** +** unixMutexHeld() must be true when creating or destroying +** this object or while reading or writing the following fields: +** +** nRef +** +** The following fields are read-only after the object is created: +** +** hShm +** zFilename +** +** Either unixShmNode.pShmMutex must be held or unixShmNode.nRef==0 and +** unixMutexHeld() is true when reading or writing any other field +** in this structure. +** +** aLock[SQLITE_SHM_NLOCK]: +** This array records the various locks held by clients on each of the +** SQLITE_SHM_NLOCK slots. If the aLock[] entry is set to 0, then no +** locks are held by the process on this slot. If it is set to -1, then +** some client holds an EXCLUSIVE lock on the locking slot. If the aLock[] +** value is set to a positive value, then it is the number of shared +** locks currently held on the slot. +** +** aMutex[SQLITE_SHM_NLOCK]: +** Normally, when SQLITE_ENABLE_SETLK_TIMEOUT is not defined, mutex +** pShmMutex is used to protect the aLock[] array and the right to +** call fcntl() on unixShmNode.hShm to obtain or release locks. +** +** If SQLITE_ENABLE_SETLK_TIMEOUT is defined though, we use an array +** of mutexes - one for each locking slot. To read or write locking +** slot aLock[iSlot], the caller must hold the corresponding mutex +** aMutex[iSlot]. Similarly, to call fcntl() to obtain or release a +** lock corresponding to slot iSlot, mutex aMutex[iSlot] must be held. + */ +type TunixShmNode1 = struct { + FpInode uintptr + FpShmMutex uintptr + FzFilename uintptr + FhShm int32 + FszRegion int32 + FnRegion Tu16 + FisReadonly Tu8 + FisUnlocked Tu8 + FapRegion uintptr + FnRef int32 + FpFirst uintptr + FaLock [8]int32 +} + +type unixShmNode1 = TunixShmNode1 + +/* +** Structure used internally by this VFS to record the state of an +** open shared memory connection. +** +** The following fields are initialized when this object is created and +** are read-only thereafter: +** +** unixShm.pShmNode +** unixShm.id +** +** All other fields are read/write. The unixShm.pShmNode->pShmMutex must +** be held while accessing any read/write fields. + */ +type TunixShm1 = struct { + FpShmNode uintptr + FpNext uintptr + FhasMutex Tu8 + Fid Tu8 + FsharedMask Tu16 + FexclMask Tu16 +} + +type unixShm1 = TunixShm1 + +/* +** Constants used for locking + */ + +// C documentation +// +// /* +// ** Use F_GETLK to check whether or not there are any readers with open +// ** wal-mode transactions in other processes on database file pFile. If +// ** no error occurs, return SQLITE_OK and set (*piOut) to 1 if there are +// ** such transactions, or 0 otherwise. If an error occurs, return an +// ** SQLite error code. The final value of *piOut is undefined in this +// ** case. +// */ +func _unixFcntlExternalReader(tls *libc.TLS, pFile uintptr, piOut uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var pShmNode uintptr + var rc int32 + var _ /* f at bp+0 */ Tflock + _, _ = pShmNode, rc + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(piOut)) = 0 + if (*TunixFile)(unsafe.Pointer(pFile)).FpShm != 0 { + pShmNode = (*TunixShm)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpShm)).FpShmNode + libc.Xmemset(tls, bp, 0, uint64(32)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(3)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(libc.Int32FromInt32(SQLITE_SHM_NLOCK) - libc.Int32FromInt32(3)) + Xsqlite3_mutex_enter(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+40, bp)) < 0 { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(15)<= 0 { + /* Initialize the locking parameters */ + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(lockType) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64(ofst) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(n) + res = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_SETLK), libc.VaList(bp+40, bp)) + if res == -int32(1) { + rc = int32(SQLITE_BUSY) + } + } + /* Do debug tracing */ + return rc +} + +// C documentation +// +// /* +// ** Return the minimum number of 32KB shm regions that should be mapped at +// ** a time, assuming that each mapping must be an integer multiple of the +// ** current system page-size. +// ** +// ** Usually, this is 1. The exception seems to be systems that are configured +// ** to use 64KB pages - in this case each mapping must cover at least two +// ** shm regions. +// */ +func _unixShmRegionPerMap(tls *libc.TLS) (r int32) { + var pgsz, shmsz int32 + _, _ = pgsz, shmsz + shmsz = libc.Int32FromInt32(32) * libc.Int32FromInt32(1024) /* SHM region size */ + pgsz = (*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(25)].FpCurrent})))(tls) /* System page size */ + /* Page size must be a power of 2 */ + if pgsz < shmsz { + return int32(1) + } + return pgsz / shmsz +} + +// C documentation +// +// /* +// ** Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0. +// ** +// ** This is not a VFS shared-memory method; it is a utility function called +// ** by VFS shared-memory methods. +// */ +func _unixShmPurge(tls *libc.TLS, pFd uintptr) { + var i, nShmPerMap int32 + var p uintptr + _, _, _ = i, nShmPerMap, p + p = (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFd)).FpInode)).FpShmNode + if p != 0 && (*TunixShmNode)(unsafe.Pointer(p)).FnRef == 0 { + nShmPerMap = _unixShmRegionPerMap(tls) + Xsqlite3_mutex_free(tls, (*TunixShmNode)(unsafe.Pointer(p)).FpShmMutex) + i = 0 + for { + if !(i < int32((*TunixShmNode)(unsafe.Pointer(p)).FnRegion)) { + break + } + if (*TunixShmNode)(unsafe.Pointer(p)).FhShm >= 0 { + (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FapRegion + uintptr(i)*8)), uint64((*TunixShmNode)(unsafe.Pointer(p)).FszRegion)) + } else { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FapRegion + uintptr(i)*8))) + } + goto _1 + _1: + ; + i += nShmPerMap + } + Xsqlite3_free(tls, (*TunixShmNode)(unsafe.Pointer(p)).FapRegion) + if (*TunixShmNode)(unsafe.Pointer(p)).FhShm >= 0 { + _robust_close(tls, pFd, (*TunixShmNode)(unsafe.Pointer(p)).FhShm, int32(42583)) + (*TunixShmNode)(unsafe.Pointer(p)).FhShm = -int32(1) + } + (*TunixInodeInfo)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** The DMS lock has not yet been taken on shm file pShmNode. Attempt to +// ** take it now. Return SQLITE_OK if successful, or an SQLite error +// ** code otherwise. +// ** +// ** If the DMS cannot be locked because this is a readonly_shm=1 +// ** connection and no other process already holds a lock, return +// ** SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1. +// */ +func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var rc int32 + var _ /* lock at bp+0 */ Tflock + _ = rc + rc = SQLITE_OK + /* Use F_GETLK to determine the locks other processes are holding + ** on the DMS byte. If it indicates that another process is holding + ** a SHARED lock, then this process may also take a SHARED lock + ** and proceed with opening the *-shm file. + ** + ** Or, if no other process is holding any lock, then this process + ** is the first to open it. In this case take an EXCLUSIVE lock on the + ** DMS byte and truncate the *-shm file to zero bytes in size. Then + ** downgrade to a SHARED lock on the DMS byte. + ** + ** If another process is holding an EXCLUSIVE lock on the DMS byte, + ** return SQLITE_BUSY to the caller (it will try again). An earlier + ** version of this code attempted the SHARED lock at this point. But + ** this introduced a subtle race condition: if the process holding + ** EXCLUSIVE failed just before truncating the *-shm file, then this + ** process might open and use the *-shm file without truncating it. + ** And if the *-shm file has been corrupted by a power failure or + ** system crash, the database itself may also become corrupt. */ + (*(*Tflock)(unsafe.Pointer(bp))).Fl_whence = 0 + (*(*Tflock)(unsafe.Pointer(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(SQLITE_SHM_NLOCK)) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_len = int64(1) + (*(*Tflock)(unsafe.Pointer(bp))).Fl_type = int16(F_WRLCK) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(15)<pFirst. This must be done while holding the + ** pShmNode->pShmMutex. + */ + Xsqlite3_mutex_enter(tls, (*TunixShmNode1)(unsafe.Pointer(pShmNode)).FpShmMutex) + (*TunixShm1)(unsafe.Pointer(p)).FpNext = (*TunixShmNode1)(unsafe.Pointer(pShmNode)).FpFirst + (*TunixShmNode1)(unsafe.Pointer(pShmNode)).FpFirst = p + Xsqlite3_mutex_leave(tls, (*TunixShmNode1)(unsafe.Pointer(pShmNode)).FpShmMutex) + return rc + /* Jump here on any error */ +shm_open_err: + ; + _unixShmPurge(tls, pDbFd) /* This call frees pShmNode if required */ + Xsqlite3_free(tls, p) + _unixLeaveMutex(tls) + return rc +} + +// C documentation +// +// /* +// ** This function is called to obtain a pointer to region iRegion of the +// ** shared-memory associated with the database file fd. Shared-memory regions +// ** are numbered starting from zero. Each shared-memory region is szRegion +// ** bytes in size. +// ** +// ** If an error occurs, an error code is returned and *pp is set to NULL. +// ** +// ** Otherwise, if the bExtend parameter is 0 and the requested shared-memory +// ** region has not been allocated (by any client, including one running in a +// ** separate process), then *pp is set to NULL and SQLITE_OK returned. If +// ** bExtend is non-zero and the requested shared-memory region has not yet +// ** been allocated, it is allocated by this function. +// ** +// ** If the shared-memory region has already been allocated or is allocated by +// ** this call as described above, then it is mapped into this processes +// ** address space (if it is not already), *pp is set to point to the mapped +// ** memory and SQLITE_OK returned. +// */ +func _unixShmMap(tls *libc.TLS, fd uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var apNew, p, pDbFd, pMem, pShmNode, zFile, p4 uintptr + var i, iPg, nByte, nMap, nReqRegion, nShmPerMap, rc, v2 int32 + var _ /* sStat at bp+0 */ Tstat + var _ /* x at bp+128 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = apNew, i, iPg, nByte, nMap, nReqRegion, nShmPerMap, p, pDbFd, pMem, pShmNode, rc, zFile, v2, p4 + pDbFd = fd + rc = SQLITE_OK + nShmPerMap = _unixShmRegionPerMap(tls) + /* If the shared-memory file has not yet been opened, open it now. */ + if (*TunixFile)(unsafe.Pointer(pDbFd)).FpShm == uintptr(0) { + rc = _unixOpenSharedMemory(tls, pDbFd) + if rc != SQLITE_OK { + return rc + } + } + p = (*TunixFile)(unsafe.Pointer(pDbFd)).FpShm + pShmNode = (*TunixShm)(unsafe.Pointer(p)).FpShmNode + Xsqlite3_mutex_enter(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked != 0 { + rc = _unixLockSharedMemory(tls, pDbFd, pShmNode) + if rc != SQLITE_OK { + goto shmpage_out + } + (*TunixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked = uint8(0) + } + /* Minimum number of regions required to be mapped. */ + nReqRegion = (iRegion + nShmPerMap) / nShmPerMap * nShmPerMap + if int32((*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRegion) < nReqRegion { /* New apRegion[] array */ + nByte = nReqRegion * szRegion /* Used by fstat() */ + (*TunixShmNode)(unsafe.Pointer(pShmNode)).FszRegion = szRegion + if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0 { + /* The requested region is not mapped into this processes address space. + ** Check to see if it has been allocated (i.e. if the wal-index file is + ** large enough to contain the requested region). + */ + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, bp) != 0 { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(19)<= 0 { + if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0 { + v2 = int32(PROT_READ) + } else { + v2 = libc.Int32FromInt32(PROT_READ) | libc.Int32FromInt32(PROT_WRITE) + } + pMem = (*(*func(*libc.TLS, uintptr, Tsize_t, int32, int32, int32, Toff_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(22)].FpCurrent})))(tls, uintptr(0), uint64(nMap), v2, int32(MAP_SHARED), (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(szRegion)*int64((*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRegion)) + if pMem == uintptr(-libc.Int32FromInt32(1)) { + rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(21)< iRegion { + *(*uintptr)(unsafe.Pointer(pp)) = *(*uintptr)(unsafe.Pointer((*TunixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) + } else { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0 && rc == SQLITE_OK { + rc = int32(SQLITE_READONLY) + } + Xsqlite3_mutex_leave(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + return rc +} + +var _pgsz = int32(4096) + +/* +** Check that the pShmNode->aLock[] array comports with the locking bitmasks +** held by each client. Return true if it does, or false otherwise. This +** is to be used in an assert(). e.g. +** +** assert( assertLockingArrayOk(pShmNode) ); + */ + +// C documentation +// +// /* +// ** Change the lock state for a shared-memory segment. +// ** +// ** Note that the relationship between SHARED and EXCLUSIVE locks is a little +// ** different here than in posix. In xShmLock(), one can go from unlocked +// ** to shared and back or from unlocked to exclusive and back. But one may +// ** not go from shared to exclusive or from exclusive to shared. +// */ +func _unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) (r int32) { + var aLock, p, pDbFd, pShmNode, p1, p2, p3, p4, p6 uintptr + var bUnlock, ii, rc int32 + var mask Tu16 + _, _, _, _, _, _, _, _, _, _, _, _, _ = aLock, bUnlock, ii, mask, p, pDbFd, pShmNode, rc, p1, p2, p3, p4, p6 + pDbFd = fd /* The underlying file iNode */ + rc = SQLITE_OK /* Result code */ + mask = uint16(int32(1)<<(ofst+n) - int32(1)<=3 && ofst int32(1) { + bUnlock = 0 + *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))-- + p1 = p + 18 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^int32(mask)) + } + } + if bUnlock != 0 { + rc = _unixShmSystemLock(tls, pDbFd, int32(F_UNLCK), ofst+(libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4), n) + if rc == SQLITE_OK { + libc.Xmemset(tls, aLock+uintptr(ofst)*4, 0, uint64(4)*uint64(n)) + p2 = p + 18 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^int32(mask)) + p3 = p + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^int32(mask)) + } + } + } else { + if flags&int32(SQLITE_SHM_SHARED) != 0 { + /* Case (b) - a shared lock. */ + if *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4)) < 0 { + /* An exclusive lock is held by some other connection. BUSY. */ + rc = int32(SQLITE_BUSY) + } else { + if *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4)) == 0 { + rc = _unixShmSystemLock(tls, pDbFd, F_RDLCK, ofst+(libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4), n) + } + } + /* Get the local shared locks */ + if rc == SQLITE_OK { + p4 = p + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32(mask)) + *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))++ + } + } else { + /* Make sure no sibling connections hold locks that will block this + ** lock. If any do, return SQLITE_BUSY right away. */ + ii = ofst + for { + if !(ii < ofst+n) { + break + } + if *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) != 0 { + rc = int32(SQLITE_BUSY) + break + } + goto _5 + _5: + ; + ii++ + } + /* Get the exclusive locks at the system level. Then if successful + ** also update the in-memory values. */ + if rc == SQLITE_OK { + rc = _unixShmSystemLock(tls, pDbFd, int32(F_WRLCK), ofst+(libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4), n) + if rc == SQLITE_OK { + p6 = p + 20 + *(*Tu16)(unsafe.Pointer(p6)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p6))) | int32(mask)) + ii = ofst + for { + if !(ii < ofst+n) { + break + } + *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -int32(1) + goto _7 + _7: + ; + ii++ + } + } + } + } + } + } + /* Drop the mutexes acquired above. */ + Xsqlite3_mutex_leave(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + } + return rc +} + +// C documentation +// +// /* +// ** Implement a memory barrier or memory fence on shared memory. +// ** +// ** All loads and stores begun before the barrier must complete before +// ** any load or store begun after the barrier. +// */ +func _unixShmBarrier(tls *libc.TLS, fd uintptr) { + _ = fd + _sqlite3MemoryBarrier(tls) /* compiler-defined memory barrier */ + _unixEnterMutex(tls) /* Also mutex, for redundancy */ + _unixLeaveMutex(tls) +} + +// C documentation +// +// /* +// ** Close a connection to shared-memory. Delete the underlying +// ** storage if deleteFlag is true. +// ** +// ** If there is no shared memory associated with the connection then this +// ** routine is a harmless no-op. +// */ +func _unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) (r int32) { + var p, pDbFd, pShmNode, pp uintptr + _, _, _, _ = p, pDbFd, pShmNode, pp /* The underlying database file */ + pDbFd = fd + p = (*TunixFile)(unsafe.Pointer(pDbFd)).FpShm + if p == uintptr(0) { + return SQLITE_OK + } + pShmNode = (*TunixShm)(unsafe.Pointer(p)).FpShmNode + /* Remove connection p from the set of connections associated + ** with pShmNode */ + Xsqlite3_mutex_enter(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + pp = pShmNode + 56 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != p) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TunixShm)(unsafe.Pointer(p)).FpNext + /* Free the connection p */ + Xsqlite3_free(tls, p) + (*TunixFile)(unsafe.Pointer(pDbFd)).FpShm = uintptr(0) + Xsqlite3_mutex_leave(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + /* If pShmNode->nRef has reached 0, then close the underlying + ** shared-memory file, too */ + _unixEnterMutex(tls) + (*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRef-- + if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRef == 0 { + if deleteFlag != 0 && (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FzFilename) + } + _unixShmPurge(tls, pDbFd) + } + _unixLeaveMutex(tls) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If it is currently memory mapped, unmap file pFd. +// */ +func _unixUnmapfile(tls *libc.TLS, pFd uintptr) { + if (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion != 0 { + (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion, uint64((*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual)) + (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion = uintptr(0) + (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize = 0 + (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual = 0 + } +} + +// C documentation +// +// /* +// ** Attempt to set the size of the memory mapping maintained by file +// ** descriptor pFd to nNew bytes. Any existing mapping is discarded. +// ** +// ** If successful, this function sets the following variables: +// ** +// ** unixFile.pMapRegion +// ** unixFile.mmapSize +// ** unixFile.mmapSizeActual +// ** +// ** If unsuccessful, an error message is logged via sqlite3_log() and +// ** the three variables above are zeroed. In this case SQLite should +// ** continue accessing the database using the xRead() and xWrite() +// ** methods. +// */ +func _unixRemapfile(tls *libc.TLS, pFd uintptr, nNew Ti64) { + var flags, h int32 + var nOrig, nReuse Ti64 + var pNew, pOrig, pReq, zErr uintptr + var v1 Tsqlite3_int64 + _, _, _, _, _, _, _, _, _ = flags, h, nOrig, nReuse, pNew, pOrig, pReq, zErr, v1 + zErr = __ccgo_ts + 3583 + h = (*TunixFile)(unsafe.Pointer(pFd)).Fh /* File descriptor open on db file */ + pOrig = (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion /* Pointer to current file mapping */ + nOrig = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual /* Size of pOrig region in bytes */ + pNew = uintptr(0) /* Location of new mapping */ + flags = int32(PROT_READ) /* Flags to pass to mmap() */ + if pOrig != 0 { + nReuse = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize + pReq = pOrig + uintptr(nReuse) + /* Unmap any pages of the existing mapping that cannot be reused. */ + if nReuse != nOrig { + (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, pReq, uint64(nOrig-nReuse)) + } + pNew = (*(*func(*libc.TLS, uintptr, Tsize_t, Tsize_t, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(24)].FpCurrent})))(tls, pOrig, uint64(nReuse), uint64(nNew), int32(MREMAP_MAYMOVE), 0) + zErr = __ccgo_ts + 3595 + /* The attempt to extend the existing mapping failed. Free it. */ + if pNew == uintptr(-libc.Int32FromInt32(1)) || pNew == uintptr(0) { + (*(*func(*libc.TLS, uintptr, Tsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(23)].FpCurrent})))(tls, pOrig, uint64(nReuse)) + } + } + /* If pNew is still NULL, try to create an entirely new mapping. */ + if pNew == uintptr(0) { + pNew = (*(*func(*libc.TLS, uintptr, Tsize_t, int32, int32, int32, Toff_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(22)].FpCurrent})))(tls, uintptr(0), uint64(nNew), flags, int32(MAP_SHARED), h, 0) + } + if pNew == uintptr(-libc.Int32FromInt32(1)) { + pNew = uintptr(0) + nNew = 0 + _unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*TunixFile)(unsafe.Pointer(pFd)).FzPath, int32(43401)) + /* If the mmap() above failed, assume that all subsequent mmap() calls + ** will probably fail too. Fall back to using xRead/xWrite exclusively + ** in this case. */ + (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax = 0 + } + (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion = pNew + v1 = nNew + (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeActual = v1 + (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize = v1 +} + +// C documentation +// +// /* +// ** Memory map or remap the file opened by file-descriptor pFd (if the file +// ** is already mapped, the existing mapping is replaced by the new). Or, if +// ** there already exists a mapping for this file, and there are still +// ** outstanding xFetch() references to it, this function is a no-op. +// ** +// ** If parameter nByte is non-negative, then it is the requested size of +// ** the mapping to create. Otherwise, if nByte is less than zero, then the +// ** requested size is the size of the file on disk. The actual size of the +// ** created mapping is either the requested size or the value configured +// ** using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller. +// ** +// ** SQLITE_OK is returned if no error occurs (even if the mapping is not +// ** recreated as a result of outstanding references) or an SQLite error +// ** code otherwise. +// */ +func _unixMapfile(tls *libc.TLS, pFd uintptr, nMap Ti64) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var _ /* statbuf at bp+0 */ Tstat + if (*TunixFile)(unsafe.Pointer(pFd)).FnFetchOut > 0 { + return SQLITE_OK + } + if nMap < 0 { /* Low-level file information */ + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(5)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFd)).Fh, bp) != 0 { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(7)< (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax { + nMap = (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax + } + if nMap != (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize { + _unixRemapfile(tls, pFd, nMap) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If possible, return a pointer to a mapping of file fd starting at offset +// ** iOff. The mapping must be valid for at least nAmt bytes. +// ** +// ** If such a pointer can be obtained, store it in *pp and return SQLITE_OK. +// ** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK. +// ** Finally, if an error does occur, return an SQLite error code. The final +// ** value of *pp is undefined in this case. +// ** +// ** If this function does return a pointer, the caller must eventually +// ** release the reference by calling unixUnfetch(). +// */ +func _unixFetch(tls *libc.TLS, fd uintptr, iOff Ti64, nAmt int32, pp uintptr) (r int32) { + var nEofBuffer, rc int32 + var pFd uintptr + _, _, _ = nEofBuffer, pFd, rc + pFd = fd /* The underlying database file */ + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + if (*TunixFile)(unsafe.Pointer(pFd)).FmmapSizeMax > 0 { + /* Ensure that there is always at least a 256 byte buffer of addressable + ** memory following the returned page. If the database is corrupt, + ** SQLite may overread the page slightly (in practice only a few bytes, + ** but 256 is safe, round, number). */ + nEofBuffer = int32(256) + if (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion == uintptr(0) { + rc = _unixMapfile(tls, pFd, int64(-int32(1))) + if rc != SQLITE_OK { + return rc + } + } + if (*TunixFile)(unsafe.Pointer(pFd)).FmmapSize >= iOff+int64(nAmt)+int64(nEofBuffer) { + *(*uintptr)(unsafe.Pointer(pp)) = (*TunixFile)(unsafe.Pointer(pFd)).FpMapRegion + uintptr(iOff) + (*TunixFile)(unsafe.Pointer(pFd)).FnFetchOut++ + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If the third argument is non-NULL, then this function releases a +// ** reference obtained by an earlier call to unixFetch(). The second +// ** argument passed to this function must be the same as the corresponding +// ** argument that was passed to the unixFetch() invocation. +// ** +// ** Or, if the third argument is NULL, then this function is being called +// ** to inform the VFS layer that, according to POSIX, any existing mapping +// ** may now be invalid and should be unmapped. +// */ +func _unixUnfetch(tls *libc.TLS, fd uintptr, iOff Ti64, p uintptr) (r int32) { + var pFd uintptr + _ = pFd + pFd = fd /* The underlying database file */ + _ = iOff + /* If p==0 (unmap the entire file) then there must be no outstanding + ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference), + ** then there must be at least one outstanding. */ + /* If p!=0, it must match the iOff value. */ + if p != 0 { + (*TunixFile)(unsafe.Pointer(pFd)).FnFetchOut-- + } else { + _unixUnmapfile(tls, pFd) + } + return SQLITE_OK +} + +/* +** Here ends the implementation of all sqlite3_file methods. +** +********************** End sqlite3_file Methods ******************************* +******************************************************************************/ + +/* +** This division contains definitions of sqlite3_io_methods objects that +** implement various file locking strategies. It also contains definitions +** of "finder" functions. A finder-function is used to locate the appropriate +** sqlite3_io_methods object for a particular database file. The pAppData +** field of the sqlite3_vfs VFS objects are initialized to be pointers to +** the correct finder-function for that VFS. +** +** Most finder functions return a pointer to a fixed sqlite3_io_methods +** object. The only interesting finder-function is autolockIoFinder, which +** looks at the filesystem type and tries to guess the best locking +** strategy from that. +** +** For finder-function F, two objects are created: +** +** (1) The real finder-function named "FImpt()". +** +** (2) A constant pointer to this function named just "F". +** +** +** A pointer to the F pointer is used as the pAppData value for VFS +** objects. We have to do this instead of letting pAppData point +** directly at the finder-function since C90 rules prevent a void* +** from be cast into a function pointer. +** +** +** Each instance of this macro generates two objects: +** +** * A constant sqlite3_io_methods object call METHOD that has locking +** methods CLOSE, LOCK, UNLOCK, CKRESLOCK. +** +** * An I/O method finder function called FINDER that returns a pointer +** to the METHOD object in the previous bullet. + */ + +// C documentation +// +// /* +// ** Here are all of the sqlite3_io_methods objects for each of the +// ** locking strategies. Functions that return pointers to these methods +// ** are also created. +// */ +var _posixIoMethods = Tsqlite3_io_methods{ + FiVersion: int32(3), +} + +func init() { + p := unsafe.Pointer(&_posixIoMethods) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_unixClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_unixRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_unixWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_unixTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_unixSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_unixFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_unixLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_unixUnlock) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_unixCheckReservedLock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_unixFileControl) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_unixSectorSize) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_unixDeviceCharacteristics) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_unixShmMap) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_unixShmLock) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_unixShmBarrier) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_unixShmUnmap) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_unixFetch) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_unixUnfetch) +} + +func _posixIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) (r uintptr) { + _ = z + _ = p + return uintptr(unsafe.Pointer(&_posixIoMethods)) +} + +var _posixIoFinder = uintptr(0) + +func init() { + p := unsafe.Pointer(&_posixIoFinder) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_posixIoFinderImpl) +} + +var _nolockIoMethods = Tsqlite3_io_methods{ + FiVersion: int32(3), +} + +func init() { + p := unsafe.Pointer(&_nolockIoMethods) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_nolockClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_unixRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_unixWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_unixTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_unixSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_unixFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_nolockLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_nolockUnlock) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_nolockCheckReservedLock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_unixFileControl) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_unixSectorSize) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_unixDeviceCharacteristics) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_unixShmLock) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_unixShmBarrier) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_unixShmUnmap) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_unixFetch) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_unixUnfetch) +} + +func _nolockIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) (r uintptr) { + _ = z + _ = p + return uintptr(unsafe.Pointer(&_nolockIoMethods)) +} + +var _nolockIoFinder = uintptr(0) + +func init() { + p := unsafe.Pointer(&_nolockIoFinder) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_nolockIoFinderImpl) +} + +var _dotlockIoMethods = Tsqlite3_io_methods{ + FiVersion: int32(1), +} + +func init() { + p := unsafe.Pointer(&_dotlockIoMethods) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_dotlockClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_unixRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_unixWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_unixTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_unixSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_unixFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_dotlockLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_dotlockUnlock) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_dotlockCheckReservedLock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_unixFileControl) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_unixSectorSize) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_unixDeviceCharacteristics) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_unixShmLock) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_unixShmBarrier) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_unixShmUnmap) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_unixFetch) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_unixUnfetch) +} + +func _dotlockIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) (r uintptr) { + _ = z + _ = p + return uintptr(unsafe.Pointer(&_dotlockIoMethods)) +} + +var _dotlockIoFinder = uintptr(0) + +func init() { + p := unsafe.Pointer(&_dotlockIoFinder) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_dotlockIoFinderImpl) +} + +/* +** The proxy locking method is a "super-method" in the sense that it +** opens secondary file descriptors for the conch and lock files and +** it uses proxy, dot-file, AFP, and flock() locking methods on those +** secondary files. For this reason, the division that implements +** proxy locking is located much further down in the file. But we need +** to go ahead and define the sqlite3_io_methods and finder function +** for proxy locking here. So we forward declare the I/O methods. + */ + +/* nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set */ + +// C documentation +// +// /* +// ** An abstract type for a pointer to an IO method finder function: +// */ +type Tfinder_type = uintptr + +type finder_type = Tfinder_type + +/**************************************************************************** +**************************** sqlite3_vfs methods **************************** +** +** This division contains the implementation of methods on the +** sqlite3_vfs object. + */ + +// C documentation +// +// /* +// ** Initialize the contents of the unixFile structure pointed to by pId. +// */ +func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename uintptr, ctrlFlags int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nFilename, rc int32 + var pLockingStyle, pNew, zLockFile, v1, p2, p3 uintptr + _, _, _, _, _, _, _, _ = nFilename, pLockingStyle, pNew, rc, zLockFile, v1, p2, p3 + pNew = pId + rc = SQLITE_OK + /* No locking occurs in temporary files */ + (*TunixFile)(unsafe.Pointer(pNew)).Fh = h + (*TunixFile)(unsafe.Pointer(pNew)).FpVfs = pVfs + (*TunixFile)(unsafe.Pointer(pNew)).FzPath = zFilename + (*TunixFile)(unsafe.Pointer(pNew)).FctrlFlags = uint16(uint8(ctrlFlags)) + (*TunixFile)(unsafe.Pointer(pNew)).FmmapSizeMax = _sqlite3Config.FszMmap + if ctrlFlags&int32(UNIXFILE_URI) != 0 { + v1 = zFilename + } else { + v1 = uintptr(0) + } + if Xsqlite3_uri_boolean(tls, v1, __ccgo_ts+3861, int32(SQLITE_POWERSAFE_OVERWRITE)) != 0 { + p2 = pNew + 30 + *(*uint16)(unsafe.Pointer(p2)) = uint16(int32(*(*uint16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(UNIXFILE_PSOW)) + } + if libc.Xstrcmp(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, __ccgo_ts+3866) == 0 { + p3 = pNew + 30 + *(*uint16)(unsafe.Pointer(p3)) = uint16(int32(*(*uint16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(UNIXFILE_EXCL)) + } + if ctrlFlags&int32(UNIXFILE_NOLOCK) != 0 { + pLockingStyle = uintptr(unsafe.Pointer(&_nolockIoMethods)) + } else { + pLockingStyle = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData))})))(tls, zFilename, pNew) + } + if pLockingStyle == uintptr(unsafe.Pointer(&_posixIoMethods)) { + _unixEnterMutex(tls) + rc = _findInodeInfo(tls, pNew, pNew+16) + if rc != SQLITE_OK { + /* If an error occurred in findInodeInfo(), close the file descriptor + ** immediately, before releasing the mutex. findInodeInfo() may fail + ** in two scenarios: + ** + ** (a) A call to fstat() failed. + ** (b) A malloc failed. + ** + ** Scenario (b) may only occur if the process is holding no other + ** file descriptors open on the same file. If there were other file + ** descriptors on this file, then no malloc would be required by + ** findInodeInfo(). If this is the case, it is quite safe to close + ** handle h - as it is guaranteed that no posix locks will be released + ** by doing so. + ** + ** If scenario (a) caused the error then things are not so safe. The + ** implicit assumption here is that if fstat() fails, things are in + ** such bad shape that dropping a lock or two doesn't matter much. + */ + _robust_close(tls, pNew, h, int32(43909)) + h = -int32(1) + } + _unixLeaveMutex(tls) + } else { + if pLockingStyle == uintptr(unsafe.Pointer(&_dotlockIoMethods)) { + nFilename = int32(libc.Xstrlen(tls, zFilename)) + int32(6) + zLockFile = Xsqlite3_malloc64(tls, uint64(nFilename)) + if zLockFile == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + Xsqlite3_snprintf(tls, nFilename, zLockFile, __ccgo_ts+3876, libc.VaList(bp+8, zFilename)) + } + (*TunixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile + } + } + _storeLastErrno(tls, pNew, 0) + if rc != SQLITE_OK { + if h >= 0 { + _robust_close(tls, pNew, h, int32(43994)) + } + } else { + (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle + _verifyDbFile(tls, pNew) + } + return rc +} + +// C documentation +// +// /* +// ** Directories to consider for temp files. +// */ +var _azTempDirs = [6]uintptr{ + 2: __ccgo_ts + 3884, + 3: __ccgo_ts + 3893, + 4: __ccgo_ts + 3902, + 5: __ccgo_ts + 1693, +} + +// C documentation +// +// /* +// ** Initialize first two members of azTempDirs[] array. +// */ +func _unixTempFileInit(tls *libc.TLS) { + _azTempDirs[0] = libc.Xgetenv(tls, __ccgo_ts+3907) + _azTempDirs[int32(1)] = libc.Xgetenv(tls, __ccgo_ts+3921) +} + +// C documentation +// +// /* +// ** Return the name of a directory in which to put temporary files. +// ** If no suitable temporary file directory can be found, return NULL. +// */ +func _unixTempFileDir(tls *libc.TLS) (r uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var i, v1 uint32 + var zDir uintptr + var _ /* buf at bp+0 */ Tstat + _, _, _ = i, zDir, v1 + i = uint32(0) + zDir = Xsqlite3_temp_directory + for int32(1) != 0 { + if zDir != uintptr(0) && (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zDir, bp) == 0 && (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(S_IFMT) == uint32(S_IFDIR) && (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zDir, int32(03)) == 0 { + return zDir + } + if uint64(i) >= libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8) { + break + } + v1 = i + i++ + zDir = _azTempDirs[v1] + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Create a temporary file name in zBuf. zBuf must be allocated +// ** by the calling process and must be big enough to hold at least +// ** pVfs->mxPathname bytes. +// */ +func _unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iLimit, rc, v1 int32 + var zDir uintptr + var v2 bool + var _ /* r at bp+0 */ Tu64 + _, _, _, _, _ = iLimit, rc, zDir, v1, v2 + iLimit = 0 + rc = SQLITE_OK + /* It's odd to simulate an io-error here, but really this is just + ** using the io-error infrastructure to test that SQLite handles this + ** function failing. + */ + *(*int8)(unsafe.Pointer(zBuf)) = 0 + Xsqlite3_mutex_enter(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) + zDir = _unixTempFileDir(tls) + if zDir == uintptr(0) { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(25)< int32(10) { + rc = int32(SQLITE_ERROR) + break + } + } + } + Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) + return rc +} + +// C documentation +// +// /* +// ** Search for an unused file descriptor that was opened on the database +// ** file (not a journal or super-journal file) identified by pathname +// ** zPath with SQLITE_OPEN_XXX flags matching those passed as the second +// ** argument to this function. +// ** +// ** Such a file descriptor may exist if a database connection was closed +// ** but the associated file descriptor could not be closed because some +// ** other file descriptor open on the same file is holding a file-lock. +// ** Refer to comments in the unixClose() function and the lengthy comment +// ** describing "Posix Advisory Locking" at the start of this file for +// ** further details. Also, ticket #4018. +// ** +// ** If a suitable file descriptor is found, then it is returned. If no +// ** such file descriptor is located, -1 is returned. +// */ +func _findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) (r uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var pInode, pUnused, pp uintptr + var _ /* sStat at bp+0 */ Tstat + _, _, _ = pInode, pUnused, pp + pUnused = uintptr(0) /* Results of stat() call */ + _unixEnterMutex(tls) + /* A stat() call may fail for various reasons. If this happens, it is + ** almost certain that an open() call on the same path will also fail. + ** For this reason, if an error occurs in the stat() call here, it is + ** ignored and -1 is returned. The caller will try to open a new file + ** descriptor on the same path, fail, and return an error to SQLite. + ** + ** Even if a subsequent open() call does succeed, the consequences of + ** not searching for a reusable file descriptor are not dire. */ + if _inodeList != uintptr(0) && 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zPath, bp) { + pInode = _inodeList + for pInode != 0 && ((*TunixInodeInfo)(unsafe.Pointer(pInode)).FfileId.Fdev != (*(*Tstat)(unsafe.Pointer(bp))).Fst_dev || (*TunixInodeInfo)(unsafe.Pointer(pInode)).FfileId.Fino != (*(*Tstat)(unsafe.Pointer(bp))).Fst_ino) { + pInode = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if pInode != 0 { + Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + flags &= libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) + pp = pInode + 40 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0 && (*TUnixUnusedFd)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).Fflags != flags) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 + } + pUnused = *(*uintptr)(unsafe.Pointer(pp)) + if pUnused != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*TUnixUnusedFd)(unsafe.Pointer(pUnused)).FpNext + } + Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + } + } + _unixLeaveMutex(tls) + return pUnused +} + +// C documentation +// +// /* +// ** Find the mode, uid and gid of file zFile. +// */ +func _getFileMode(tls *libc.TLS, zFile uintptr, pMode uintptr, pUid uintptr, pGid uintptr) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var rc int32 + var _ /* sStat at bp+0 */ Tstat + _ = rc /* Output of stat() on database file */ + rc = SQLITE_OK + if 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(4)].FpCurrent})))(tls, zFile, bp) { + *(*Tmode_t)(unsafe.Pointer(pMode)) = (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode & uint32(0777) + *(*Tuid_t)(unsafe.Pointer(pUid)) = (*(*Tstat)(unsafe.Pointer(bp))).Fst_uid + *(*Tgid_t)(unsafe.Pointer(pGid)) = (*(*Tstat)(unsafe.Pointer(bp))).Fst_gid + } else { + rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(7)<-journal" + ** "-wal" + ** "-journalNN" + ** "-walNN" + ** + ** where NN is a decimal number. The NN naming schemes are + ** used by the test_multiplex.c module. + ** + ** In normal operation, the journal file name will always contain + ** a '-' character. However in 8+3 filename mode, or if a corrupt + ** rollback journal specifies a super-journal with a goofy name, then + ** the '-' might be missing or the '-' might be the first character in + ** the filename. In that case, just return SQLITE_OK with *pMode==0. + */ + nDb = _sqlite3Strlen30(tls, zPath) - int32(1) + for nDb > 0 && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nDb)))) != int32('.') { + if int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nDb)))) == int32('-') { + libc.Xmemcpy(tls, bp, zPath, uint64(nDb)) + (*(*[513]int8)(unsafe.Pointer(bp)))[nDb] = int8('\000') + rc = _getFileMode(tls, bp, pMode, pUid, pGid) + break + } + nDb-- + } + } else { + if flags&int32(SQLITE_OPEN_DELETEONCLOSE) != 0 { + *(*Tmode_t)(unsafe.Pointer(pMode)) = uint32(0600) + } else { + if flags&int32(SQLITE_OPEN_URI) != 0 { + /* If this is a main database file and the file was opened using a URI + ** filename, check for the "modeof" parameter. If present, interpret + ** its value as a filename and try to copy the mode, uid and gid from + ** that file. */ + z = Xsqlite3_uri_parameter(tls, zPath, __ccgo_ts+3945) + if z != 0 { + rc = _getFileMode(tls, z, pMode, pUid, pGid) + } + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Open the file zPath. +// ** +// ** Previously, the SQLite OS layer used three functions in place of this +// ** one: +// ** +// ** sqlite3OsOpenReadWrite(); +// ** sqlite3OsOpenReadOnly(); +// ** sqlite3OsOpenExclusive(); +// ** +// ** These calls correspond to the following combinations of flags: +// ** +// ** ReadWrite() -> (READWRITE | CREATE) +// ** ReadOnly() -> (READONLY) +// ** OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE) +// ** +// ** The old OpenExclusive() accepted a boolean argument - "delFlag". If +// ** true, the file was configured to be automatically deleted when the +// ** file handle closed. To achieve the same effect using this new +// ** interface, add the DELETEONCLOSE flag to those specified above for +// ** OpenExclusive(). +// */ +func _unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags int32, pOutFlags uintptr) (r int32) { + bp := tls.Alloc(528) + defer tls.Free(528) + var ctrlFlags, eType, fd, isCreate, isDelete, isExclusive, isNewJrnl, isReadWrite, isReadonly, noLock, openFlags, rc, rc2 int32 + var p, pUnused, zName uintptr + var _ /* gid at bp+524 */ Tgid_t + var _ /* openMode at bp+516 */ Tmode_t + var _ /* uid at bp+520 */ Tuid_t + var _ /* zTmpname at bp+0 */ [514]int8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctrlFlags, eType, fd, isCreate, isDelete, isExclusive, isNewJrnl, isReadWrite, isReadonly, noLock, openFlags, p, pUnused, rc, rc2, zName + p = pFile + fd = -int32(1) /* File descriptor returned by open() */ + openFlags = 0 /* Flags to pass to open() */ + eType = flags & int32(0x0FFF00) /* True to omit locking primitives */ + rc = SQLITE_OK /* Function Return Code */ + ctrlFlags = 0 /* UNIXFILE_* flags */ + isExclusive = flags & int32(SQLITE_OPEN_EXCLUSIVE) + isDelete = flags & int32(SQLITE_OPEN_DELETEONCLOSE) + isCreate = flags & int32(SQLITE_OPEN_CREATE) + isReadonly = flags & int32(SQLITE_OPEN_READONLY) + isReadWrite = flags & int32(SQLITE_OPEN_READWRITE) + /* If creating a super- or main-file journal, this function will open + ** a file-descriptor on the directory too. The first time unixSync() + ** is called the directory file descriptor will be fsync()ed and close()d. + */ + isNewJrnl = libc.BoolInt32(isCreate != 0 && (eType == int32(SQLITE_OPEN_SUPER_JOURNAL) || eType == int32(SQLITE_OPEN_MAIN_JOURNAL) || eType == int32(SQLITE_OPEN_WAL))) + zName = zPath + /* Check the following statements are true: + ** + ** (a) Exactly one of the READWRITE and READONLY flags must be set, and + ** (b) if CREATE is set, then READWRITE must also be set, and + ** (c) if EXCLUSIVE is set, then CREATE must also be set. + ** (d) if DELETEONCLOSE is set, then CREATE must also be set. + */ + /* The main DB, main journal, WAL file and super-journal are never + ** automatically deleted. Nor are they ever temporary files. */ + /* Assert that the upper layer has set one of the "file-type" flags. */ + /* Detect a pid change and reset the PRNG. There is a race condition + ** here such that two or more threads all trying to open databases at + ** the same instant might all reset the PRNG. But multiple resets + ** are harmless. + */ + if libc.AtomicLoadPInt32(uintptr(unsafe.Pointer(&_randomnessPid))) != libc.Xgetpid(tls) { + libc.AtomicStorePInt32(uintptr(unsafe.Pointer(&_randomnessPid)), libc.Xgetpid(tls)) + Xsqlite3_randomness(tls, 0, uintptr(0)) + } + libc.Xmemset(tls, p, 0, uint64(120)) + if eType == int32(SQLITE_OPEN_MAIN_DB) { + pUnused = _findReusableFd(tls, zName, flags) + if pUnused != 0 { + fd = (*TUnixUnusedFd)(unsafe.Pointer(pUnused)).Ffd + } else { + pUnused = Xsqlite3_malloc64(tls, uint64(16)) + if !(pUnused != 0) { + return int32(SQLITE_NOMEM) + } + } + (*TunixFile)(unsafe.Pointer(p)).FpPreallocatedUnused = pUnused + /* Database filenames are double-zero terminated if they are not + ** URIs with parameters. Hence, they can always be passed into + ** sqlite3_uri_parameter(). */ + } else { + if !(zName != 0) { + /* If zName is NULL, the upper layer is requesting a temp file. */ + rc = _unixGetTempname(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname, bp) + if rc != SQLITE_OK { + return rc + } + zName = bp + /* Generated temporary filenames are always double-zero terminated + ** for use by sqlite3_uri_parameter(). */ + } + } + /* Determine the value of the flags parameter passed to POSIX function + ** open(). These must be calculated even if open() is not called, as + ** they may be stored as part of the file handle and used by the + ** 'conch file' locking functions later on. */ + if isReadonly != 0 { + openFlags |= O_RDONLY + } + if isReadWrite != 0 { + openFlags |= int32(O_RDWR) + } + if isCreate != 0 { + openFlags |= int32(O_CREAT) + } + if isExclusive != 0 { + openFlags |= libc.Int32FromInt32(O_EXCL) | libc.Int32FromInt32(O_NOFOLLOW) + } + openFlags |= libc.Int32FromInt32(O_LARGEFILE) | libc.Int32FromInt32(O_BINARY) | libc.Int32FromInt32(O_NOFOLLOW) + if fd < 0 { /* Groupid for the file */ + rc = _findCreateFileMode(tls, zName, flags, bp+516, bp+520, bp+524) + if rc != SQLITE_OK { + return rc + } + fd = _robust_open(tls, zName, openFlags, *(*Tmode_t)(unsafe.Pointer(bp + 516))) + if fd < 0 { + if isNewJrnl != 0 && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(EACCES) && (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zName, F_OK) != 0 { + /* If unable to create a journal because the directory is not + ** writable, change the error code to indicate that. */ + rc = libc.Int32FromInt32(SQLITE_READONLY) | libc.Int32FromInt32(6)< 0)) + } else { + *(*int32)(unsafe.Pointer(pResOut)) = libc.BoolInt32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(2)].FpCurrent})))(tls, zPath, libc.Int32FromInt32(W_OK)|libc.Int32FromInt32(R_OK)) == 0) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** A pathname under construction +// */ +type TDbPath = struct { + Frc int32 + FnSymlink int32 + FzOut uintptr + FnOut int32 + FnUsed int32 +} + +type DbPath = TDbPath + +type TDbPath1 = struct { + Frc int32 + FnSymlink int32 + FzOut uintptr + FnOut int32 + FnUsed int32 +} + +type DbPath1 = TDbPath1 + +// C documentation +// +// /* +// ** Append a single path element to the DbPath under construction +// */ +func _appendOnePathElement(tls *libc.TLS, pPath uintptr, zName uintptr, nName int32) { + bp := tls.Alloc(4240) + defer tls.Free(4240) + var got Tssize_t + var zIn, v2, v4, v6 uintptr + var v1, v3, v5 int32 + var _ /* buf at bp+0 */ Tstat + var _ /* zLnk at bp+128 */ [4098]int8 + _, _, _, _, _, _, _, _ = got, zIn, v1, v2, v3, v4, v5, v6 + if int32(*(*int8)(unsafe.Pointer(zName))) == int32('.') { + if nName == int32(1) { + return + } + if int32(*(*int8)(unsafe.Pointer(zName + 1))) == int32('.') && nName == int32(2) { + if (*TDbPath)(unsafe.Pointer(pPath)).FnUsed > int32(1) { + for { + v2 = pPath + 20 + *(*int32)(unsafe.Pointer(v2))-- + v1 = *(*int32)(unsafe.Pointer(v2)) + if !(int32(*(*int8)(unsafe.Pointer((*TDbPath)(unsafe.Pointer(pPath)).FzOut + uintptr(v1)))) != int32('/')) { + break + } + } + } + return + } + } + if (*TDbPath)(unsafe.Pointer(pPath)).FnUsed+nName+int32(2) >= (*TDbPath)(unsafe.Pointer(pPath)).FnOut { + (*TDbPath)(unsafe.Pointer(pPath)).Frc = int32(SQLITE_ERROR) + return + } + v4 = pPath + 20 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + *(*int8)(unsafe.Pointer((*TDbPath)(unsafe.Pointer(pPath)).FzOut + uintptr(v3))) = int8('/') + libc.Xmemcpy(tls, (*TDbPath)(unsafe.Pointer(pPath)).FzOut+uintptr((*TDbPath)(unsafe.Pointer(pPath)).FnUsed), zName, uint64(nName)) + *(*int32)(unsafe.Pointer(pPath + 20)) += nName + if (*TDbPath)(unsafe.Pointer(pPath)).Frc == SQLITE_OK { + *(*int8)(unsafe.Pointer((*TDbPath)(unsafe.Pointer(pPath)).FzOut + uintptr((*TDbPath)(unsafe.Pointer(pPath)).FnUsed))) = 0 + zIn = (*TDbPath)(unsafe.Pointer(pPath)).FzOut + if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(27)].FpCurrent})))(tls, zIn, bp) != 0 { + if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != int32(ENOENT) { + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44680)), __ccgo_ts+3623, zIn, int32(44680)) + } + } else { + if (*(*Tstat)(unsafe.Pointer(bp))).Fst_mode&uint32(S_IFMT) == uint32(S_IFLNK) { + v6 = pPath + 4 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + if v5 > int32(SQLITE_MAX_SYMLINK) { + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _sqlite3CantopenError(tls, int32(44686)) + return + } + got = (*(*func(*libc.TLS, uintptr, uintptr, Tsize_t) Tssize_t)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(26)].FpCurrent})))(tls, zIn, bp+128, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) + if got <= 0 || got >= libc.Int64FromInt64(4098)-libc.Int64FromInt32(2) { + (*TDbPath)(unsafe.Pointer(pPath)).Frc = _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44691)), __ccgo_ts+3614, zIn, int32(44691)) + return + } + (*(*[4098]int8)(unsafe.Pointer(bp + 128)))[got] = 0 + if int32((*(*[4098]int8)(unsafe.Pointer(bp + 128)))[0]) == int32('/') { + (*TDbPath)(unsafe.Pointer(pPath)).FnUsed = 0 + } else { + *(*int32)(unsafe.Pointer(pPath + 20)) -= nName + int32(1) + } + _appendAllPathElements(tls, pPath, bp+128) + } + } + } +} + +// C documentation +// +// /* +// ** Append all path elements in zPath to the DbPath under construction. +// */ +func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { + var i, j, v1 int32 + _, _, _ = i, j, v1 + i = 0 + j = 0 + for { + for *(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0 && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32('/') { + i++ + } + if i > j { + _appendOnePathElement(tls, pPath, zPath+uintptr(j), i-j) + } + j = i + int32(1) + goto _2 + _2: + ; + v1 = i + i++ + if !(*(*int8)(unsafe.Pointer(zPath + uintptr(v1))) != 0) { + break + } + } +} + +// C documentation +// +// /* +// ** Turn a relative pathname into a full pathname. The relative path +// ** is stored as a nul-terminated string in the buffer pointed to by +// ** zPath. +// ** +// ** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes +// ** (in this case, MAX_PATHNAME bytes). The full-path is written to +// ** this buffer before returning. +// */ +func _unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) (r int32) { + bp := tls.Alloc(4128) + defer tls.Free(4128) + var _ /* path at bp+0 */ TDbPath + var _ /* zPwd at bp+24 */ [4098]int8 + _ = pVfs + (*(*TDbPath)(unsafe.Pointer(bp))).Frc = 0 + (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed = 0 + (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink = 0 + (*(*TDbPath)(unsafe.Pointer(bp))).FnOut = nOut + (*(*TDbPath)(unsafe.Pointer(bp))).FzOut = zOut + if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('/') { + if (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(3)].FpCurrent})))(tls, bp+24, libc.Uint64FromInt64(4098)-libc.Uint64FromInt32(2)) == uintptr(0) { + return _unixLogErrorAtLine(tls, _sqlite3CantopenError(tls, int32(44749)), __ccgo_ts+3443, zPath, int32(44749)) + } + _appendAllPathElements(tls, bp, bp+24) + } + _appendAllPathElements(tls, bp, zPath) + *(*int8)(unsafe.Pointer(zOut + uintptr((*(*TDbPath)(unsafe.Pointer(bp))).FnUsed))) = 0 + if (*(*TDbPath)(unsafe.Pointer(bp))).Frc != 0 || (*(*TDbPath)(unsafe.Pointer(bp))).FnUsed < int32(2) { + return _sqlite3CantopenError(tls, int32(44755)) + } + if (*(*TDbPath)(unsafe.Pointer(bp))).FnSymlink != 0 { + return libc.Int32FromInt32(SQLITE_OK) | libc.Int32FromInt32(2)< 0x40000200 +** +** This works well on the local file system, but shows a nearly 100x +** slowdown in read performance on AFP because the AFP client disables +** the read cache when byte-range locks are present. Enabling the read +** cache exposes a cache coherency problem that is present on all OS X +** supported network file systems. NFS and AFP both observe the +** close-to-open semantics for ensuring cache coherency +** [http://nfs.sourceforge.net/#faq_a8], which does not effectively +** address the requirements for concurrent database access by multiple +** readers and writers +** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html]. +** +** To address the performance and cache coherency issues, proxy file locking +** changes the way database access is controlled by limiting access to a +** single host at a time and moving file locks off of the database file +** and onto a proxy file on the local file system. +** +** +** Using proxy locks +** ----------------- +** +** C APIs +** +** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE, +** | ":auto:"); +** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE, +** &); +** +** +** SQL pragmas +** +** PRAGMA [database.]lock_proxy_file= | :auto: +** PRAGMA [database.]lock_proxy_file +** +** Specifying ":auto:" means that if there is a conch file with a matching +** host ID in it, the proxy path in the conch file will be used, otherwise +** a proxy path based on the user's temp dir +** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the +** actual proxy file name is generated from the name and path of the +** database file. For example: +** +** For database path "/Users/me/foo.db" +** The lock path will be "/sqliteplocks/_Users_me_foo.db:auto:") +** +** Once a lock proxy is configured for a database connection, it can not +** be removed, however it may be switched to a different proxy path via +** the above APIs (assuming the conch file is not being held by another +** connection or process). +** +** +** How proxy locking works +** ----------------------- +** +** Proxy file locking relies primarily on two new supporting files: +** +** * conch file to limit access to the database file to a single host +** at a time +** +** * proxy file to act as a proxy for the advisory locks normally +** taken on the database +** +** The conch file - to use a proxy file, sqlite must first "hold the conch" +** by taking an sqlite-style shared lock on the conch file, reading the +** contents and comparing the host's unique host ID (see below) and lock +** proxy path against the values stored in the conch. The conch file is +** stored in the same directory as the database file and the file name +** is patterned after the database file name as ".-conch". +** If the conch file does not exist, or its contents do not match the +** host ID and/or proxy path, then the lock is escalated to an exclusive +** lock and the conch file contents is updated with the host ID and proxy +** path and the lock is downgraded to a shared lock again. If the conch +** is held by another process (with a shared lock), the exclusive lock +** will fail and SQLITE_BUSY is returned. +** +** The proxy file - a single-byte file used for all advisory file locks +** normally taken on the database file. This allows for safe sharing +** of the database file for multiple readers and writers on the same +** host (the conch ensures that they all use the same local lock file). +** +** Requesting the lock proxy does not immediately take the conch, it is +** only taken when the first request to lock database file is made. +** This matches the semantics of the traditional locking behavior, where +** opening a connection to a database file does not take a lock on it. +** The shared lock and an open file descriptor are maintained until +** the connection to the database is closed. +** +** The proxy file and the lock file are never deleted so they only need +** to be created the first time they are used. +** +** Configuration options +** --------------------- +** +** SQLITE_PREFER_PROXY_LOCKING +** +** Database files accessed on non-local file systems are +** automatically configured for proxy locking, lock files are +** named automatically using the same logic as +** PRAGMA lock_proxy_file=":auto:" +** +** SQLITE_PROXY_DEBUG +** +** Enables the logging of error messages during host id file +** retrieval and creation +** +** LOCKPROXYDIR +** +** Overrides the default directory used for lock proxy files that +** are named automatically via the ":auto:" setting +** +** SQLITE_DEFAULT_PROXYDIR_PERMISSIONS +** +** Permissions to use when creating a directory for storing the +** lock proxy files, only used when LOCKPROXYDIR is not set. +** +** +** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING, +** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will +** force proxy locking to be used for every database file opened, and 0 +** will force automatic proxy locking to be disabled for all database +** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or +** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). + */ + +/* +** Proxy locking is only available on MacOSX + */ +/* +** The proxy locking style is intended for use with AFP filesystems. +** And since AFP is only supported on MacOSX, the proxy locking is also +** restricted to MacOSX. +** +** +******************* End of the proxy lock implementation ********************** +******************************************************************************/ + +// C documentation +// +// /* +// ** Initialize the operating system interface. +// ** +// ** This routine registers all VFS implementations for unix-like operating +// ** systems. This routine, and the sqlite3_os_end() routine that follows, +// ** should be the only routines in this file that are visible from other +// ** files. +// ** +// ** This routine is called once during SQLite initialization and by a +// ** single thread. The memory allocation and mutex subsystems have not +// ** necessarily been initialized when this routine is called, and so they +// ** should not be used. +// */ +func Xsqlite3_os_init(tls *libc.TLS) (r int32) { + var i uint32 + _ = i + /* Double-check that the aSyscall[] array has been constructed + ** correctly. See ticket [bb3a86e890c8e96ab] */ + /* Register all VFSes defined in the aVfs[] array */ + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(672)/libc.Uint64FromInt64(168)) { + break + } + Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&_aVfs))+uintptr(i)*168, libc.BoolInt32(i == uint32(0))) + goto _1 + _1: + ; + i++ + } + _unixBigLock = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1)) + /* Validate lock assumptions */ + /* Number of available locks */ + /* Start of locking area */ + /* Locks: + ** WRITE UNIX_SHM_BASE 120 + ** CKPT UNIX_SHM_BASE+1 121 + ** RECOVER UNIX_SHM_BASE+2 122 + ** READ-0 UNIX_SHM_BASE+3 123 + ** READ-1 UNIX_SHM_BASE+4 124 + ** READ-2 UNIX_SHM_BASE+5 125 + ** READ-3 UNIX_SHM_BASE+6 126 + ** READ-4 UNIX_SHM_BASE+7 127 + ** DMS UNIX_SHM_BASE+8 128 + */ + /* Byte offset of the deadman-switch */ + /* Initialize temp file dir array. */ + _unixTempFileInit(tls) + return SQLITE_OK +} + +/* + ** The following macro defines an initializer for an sqlite3_vfs object. + ** The name of the VFS is NAME. The pAppData is a pointer to a pointer + ** to the "finder" function. (pAppData is a pointer to a pointer because + ** silly C90 rules prohibit a void* from being cast to a function pointer + ** and so we have to go through the intermediate pointer to avoid problems + ** when compiling with -pedantic-errors on GCC.) + ** + ** The FINDER parameter to this macro is the name of the pointer to the + ** finder-function. The finder-function returns a pointer to the + ** sqlite_io_methods object that implements the desired locking + ** behaviors. See the division above that contains the IOMETHODS + ** macro for addition information on finder-functions. + ** + ** Most finders simply return a pointer to a fixed sqlite3_io_methods + ** object. But the "autolockIoFinder" available on MacOSX does a little + ** more than that; it looks at the filesystem type that hosts the + ** database file and tries to choose an locking method appropriate for + ** that filesystem time. + */ + +/* + ** All default VFSes for unix are contained in the following array. + ** + ** Note that the sqlite3_vfs.pNext field of the VFS object is modified + ** by the SQLite core when the VFS is registered. So the following + ** array cannot be const. + */ +var _aVfs = [4]Tsqlite3_vfs{ + 0: { + FiVersion: int32(3), + FszOsFile: int32(120), + FmxPathname: int32(MAX_PATHNAME), + FzName: __ccgo_ts + 3971, + }, + 1: { + FiVersion: int32(3), + FszOsFile: int32(120), + FmxPathname: int32(MAX_PATHNAME), + FzName: __ccgo_ts + 3976, + }, + 2: { + FiVersion: int32(3), + FszOsFile: int32(120), + FmxPathname: int32(MAX_PATHNAME), + FzName: __ccgo_ts + 3986, + }, + 3: { + FiVersion: int32(3), + FszOsFile: int32(120), + FmxPathname: int32(MAX_PATHNAME), + FzName: __ccgo_ts + 3866, + }, +} + +func init() { + p := unsafe.Pointer(&_aVfs) + *(*uintptr)(unsafe.Add(p, 32)) = uintptr(unsafe.Pointer(&_posixIoFinder)) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_unixOpen) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_unixDelete) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_unixAccess) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_unixFullPathname) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_unixDlOpen) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_unixDlError) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_unixDlSym) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_unixDlClose) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_unixRandomness) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_unixSleep) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_unixCurrentTime) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_unixGetLastError) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_unixCurrentTimeInt64) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_unixSetSystemCall) + *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_unixGetSystemCall) + *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_unixNextSystemCall) + *(*uintptr)(unsafe.Add(p, 200)) = uintptr(unsafe.Pointer(&_nolockIoFinder)) + *(*uintptr)(unsafe.Add(p, 208)) = __ccgo_fp(_unixOpen) + *(*uintptr)(unsafe.Add(p, 216)) = __ccgo_fp(_unixDelete) + *(*uintptr)(unsafe.Add(p, 224)) = __ccgo_fp(_unixAccess) + *(*uintptr)(unsafe.Add(p, 232)) = __ccgo_fp(_unixFullPathname) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_unixDlOpen) + *(*uintptr)(unsafe.Add(p, 248)) = __ccgo_fp(_unixDlError) + *(*uintptr)(unsafe.Add(p, 256)) = __ccgo_fp(_unixDlSym) + *(*uintptr)(unsafe.Add(p, 264)) = __ccgo_fp(_unixDlClose) + *(*uintptr)(unsafe.Add(p, 272)) = __ccgo_fp(_unixRandomness) + *(*uintptr)(unsafe.Add(p, 280)) = __ccgo_fp(_unixSleep) + *(*uintptr)(unsafe.Add(p, 288)) = __ccgo_fp(_unixCurrentTime) + *(*uintptr)(unsafe.Add(p, 296)) = __ccgo_fp(_unixGetLastError) + *(*uintptr)(unsafe.Add(p, 304)) = __ccgo_fp(_unixCurrentTimeInt64) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_unixSetSystemCall) + *(*uintptr)(unsafe.Add(p, 320)) = __ccgo_fp(_unixGetSystemCall) + *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_unixNextSystemCall) + *(*uintptr)(unsafe.Add(p, 368)) = uintptr(unsafe.Pointer(&_dotlockIoFinder)) + *(*uintptr)(unsafe.Add(p, 376)) = __ccgo_fp(_unixOpen) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(_unixDelete) + *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_unixAccess) + *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_unixFullPathname) + *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_unixDlOpen) + *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_unixDlError) + *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_unixDlSym) + *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_unixDlClose) + *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_unixRandomness) + *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_unixSleep) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_unixCurrentTime) + *(*uintptr)(unsafe.Add(p, 464)) = __ccgo_fp(_unixGetLastError) + *(*uintptr)(unsafe.Add(p, 472)) = __ccgo_fp(_unixCurrentTimeInt64) + *(*uintptr)(unsafe.Add(p, 480)) = __ccgo_fp(_unixSetSystemCall) + *(*uintptr)(unsafe.Add(p, 488)) = __ccgo_fp(_unixGetSystemCall) + *(*uintptr)(unsafe.Add(p, 496)) = __ccgo_fp(_unixNextSystemCall) + *(*uintptr)(unsafe.Add(p, 536)) = uintptr(unsafe.Pointer(&_posixIoFinder)) + *(*uintptr)(unsafe.Add(p, 544)) = __ccgo_fp(_unixOpen) + *(*uintptr)(unsafe.Add(p, 552)) = __ccgo_fp(_unixDelete) + *(*uintptr)(unsafe.Add(p, 560)) = __ccgo_fp(_unixAccess) + *(*uintptr)(unsafe.Add(p, 568)) = __ccgo_fp(_unixFullPathname) + *(*uintptr)(unsafe.Add(p, 576)) = __ccgo_fp(_unixDlOpen) + *(*uintptr)(unsafe.Add(p, 584)) = __ccgo_fp(_unixDlError) + *(*uintptr)(unsafe.Add(p, 592)) = __ccgo_fp(_unixDlSym) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(_unixDlClose) + *(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(_unixRandomness) + *(*uintptr)(unsafe.Add(p, 616)) = __ccgo_fp(_unixSleep) + *(*uintptr)(unsafe.Add(p, 624)) = __ccgo_fp(_unixCurrentTime) + *(*uintptr)(unsafe.Add(p, 632)) = __ccgo_fp(_unixGetLastError) + *(*uintptr)(unsafe.Add(p, 640)) = __ccgo_fp(_unixCurrentTimeInt64) + *(*uintptr)(unsafe.Add(p, 648)) = __ccgo_fp(_unixSetSystemCall) + *(*uintptr)(unsafe.Add(p, 656)) = __ccgo_fp(_unixGetSystemCall) + *(*uintptr)(unsafe.Add(p, 664)) = __ccgo_fp(_unixNextSystemCall) +} + +// C documentation +// +// /* +// ** Shutdown the operating system interface. +// ** +// ** Some operating systems might need to do some cleanup in this routine, +// ** to release dynamically allocated objects. But not on unix. +// ** This routine is a no-op for unix. +// */ +func Xsqlite3_os_end(tls *libc.TLS) (r int32) { + _unixBigLock = uintptr(0) + return SQLITE_OK +} + +/************** End of os_unix.c *********************************************/ +/************** Begin file os_win.c ******************************************/ +/* +** 2004 May 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. + */ +/* #include "sqliteInt.h" */ + +/************** End of os_win.c **********************************************/ +/************** Begin file memdb.c *******************************************/ +/* +** 2016-09-07 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file implements an in-memory VFS. A database is held as a contiguous +** block of memory. +** +** This file also implements interface sqlite3_serialize() and +** sqlite3_deserialize(). + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Forward declaration of objects used by this utility +// */ +type TMemVfs = struct { + FiVersion int32 + FszOsFile int32 + FmxPathname int32 + FpNext uintptr + FzName uintptr + FpAppData uintptr + FxOpen uintptr + FxDelete uintptr + FxAccess uintptr + FxFullPathname uintptr + FxDlOpen uintptr + FxDlError uintptr + FxDlSym uintptr + FxDlClose uintptr + FxRandomness uintptr + FxSleep uintptr + FxCurrentTime uintptr + FxGetLastError uintptr + FxCurrentTimeInt64 uintptr + FxSetSystemCall uintptr + FxGetSystemCall uintptr + FxNextSystemCall uintptr +} + +type MemVfs = TMemVfs + +type TMemFile = struct { + Fbase Tsqlite3_file + FpStore uintptr + FeLock int32 +} + +type MemFile = TMemFile + +type TMemStore = struct { + Fsz Tsqlite3_int64 + FszAlloc Tsqlite3_int64 + FszMax Tsqlite3_int64 + FaData uintptr + FpMutex uintptr + FnMmap int32 + FmFlags uint32 + FnRdLock int32 + FnWrLock int32 + FnRef int32 + FzFName uintptr +} + +type MemStore = TMemStore + +/* Access to a lower-level VFS that (might) implement dynamic loading, +** access to randomness, etc. + */ + +/* Storage for a memdb file. +** +** An memdb object can be shared or separate. Shared memdb objects can be +** used by more than one database connection. Mutexes are used by shared +** memdb objects to coordinate access. Separate memdb objects are only +** connected to a single database connection and do not require additional +** mutexes. +** +** Shared memdb objects have .zFName!=0 and .pMutex!=0. They are created +** using "file:/name?vfs=memdb". The first character of the name must be +** "/" or else the object will be a separate memdb object. All shared +** memdb objects are stored in memdb_g.apMemStore[] in an arbitrary order. +** +** Separate memdb objects are created using a name that does not begin +** with "/" or using sqlite3_deserialize(). +** +** Access rules for shared MemStore objects: +** +** * .zFName is initialized when the object is created and afterwards +** is unchanged until the object is destroyed. So it can be accessed +** at any time as long as we know the object is not being destroyed, +** which means while either the SQLITE_MUTEX_STATIC_VFS1 or +** .pMutex is held or the object is not part of memdb_g.apMemStore[]. +** +** * Can .pMutex can only be changed while holding the +** SQLITE_MUTEX_STATIC_VFS1 mutex or while the object is not part +** of memdb_g.apMemStore[]. +** +** * Other fields can only be changed while holding the .pMutex mutex +** or when the .nRef is less than zero and the object is not part of +** memdb_g.apMemStore[]. +** +** * The .aData pointer has the added requirement that it can can only +** be changed (for resizing) when nMmap is zero. +** + */ +type TMemStore1 = struct { + Fsz Tsqlite3_int64 + FszAlloc Tsqlite3_int64 + FszMax Tsqlite3_int64 + FaData uintptr + FpMutex uintptr + FnMmap int32 + FmFlags uint32 + FnRdLock int32 + FnWrLock int32 + FnRef int32 + FzFName uintptr +} + +type MemStore1 = TMemStore1 + +/* An open file */ +type TMemFile1 = struct { + Fbase Tsqlite3_file + FpStore uintptr + FeLock int32 +} + +type MemFile1 = TMemFile1 + +// C documentation +// +// /* +// ** File-scope variables for holding the memdb files that are accessible +// ** to multiple database connections in separate threads. +// ** +// ** Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. +// */ +type TMemFS = struct { + FnMemStore int32 + FapMemStore uintptr +} + +type MemFS = TMemFS + +// C documentation +// +// /* +// ** File-scope variables for holding the memdb files that are accessible +// ** to multiple database connections in separate threads. +// ** +// ** Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. +// */ +var _memdb_g TMemFS + +var _memdb_vfs = Tsqlite3_vfs{ + FiVersion: int32(2), + FmxPathname: int32(1024), + FzName: __ccgo_ts + 3999, +} + +func init() { + p := unsafe.Pointer(&_memdb_vfs) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_memdbOpen) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_memdbAccess) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_memdbFullPathname) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_memdbDlOpen) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_memdbDlError) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_memdbDlSym) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_memdbDlClose) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_memdbRandomness) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_memdbSleep) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_memdbGetLastError) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_memdbCurrentTimeInt64) +} + +var _memdb_io_methods = Tsqlite3_io_methods{ + FiVersion: int32(3), +} + +func init() { + p := unsafe.Pointer(&_memdb_io_methods) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_memdbClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_memdbRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_memdbWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_memdbTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_memdbSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_memdbFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_memdbLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_memdbUnlock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_memdbFileControl) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_memdbDeviceCharacteristics) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_memdbFetch) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_memdbUnfetch) +} + +// C documentation +// +// /* +// ** Enter/leave the mutex on a MemStore +// */ +func _memdbEnter(tls *libc.TLS, p uintptr) { + Xsqlite3_mutex_enter(tls, (*TMemStore)(unsafe.Pointer(p)).FpMutex) +} + +func _memdbLeave(tls *libc.TLS, p uintptr) { + Xsqlite3_mutex_leave(tls, (*TMemStore)(unsafe.Pointer(p)).FpMutex) +} + +// C documentation +// +// /* +// ** Close an memdb-file. +// ** Free the underlying MemStore object when its refcount drops to zero +// ** or less. +// */ +func _memdbClose(tls *libc.TLS, pFile uintptr) (r int32) { + var i, v2 int32 + var p, pVfsMutex, v3 uintptr + _, _, _, _, _ = i, p, pVfsMutex, v2, v3 + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + if (*TMemStore)(unsafe.Pointer(p)).FzFName != 0 { + pVfsMutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1)) + Xsqlite3_mutex_enter(tls, pVfsMutex) + i = 0 + for { + if !(i < _memdb_g.FnMemStore) { + break + } + if *(*uintptr)(unsafe.Pointer(_memdb_g.FapMemStore + uintptr(i)*8)) == p { + _memdbEnter(tls, p) + if (*TMemStore)(unsafe.Pointer(p)).FnRef == int32(1) { + v3 = uintptr(unsafe.Pointer(&_memdb_g)) + *(*int32)(unsafe.Pointer(v3))-- + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*uintptr)(unsafe.Pointer(_memdb_g.FapMemStore + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(_memdb_g.FapMemStore + uintptr(v2)*8)) + if _memdb_g.FnMemStore == 0 { + Xsqlite3_free(tls, _memdb_g.FapMemStore) + _memdb_g.FapMemStore = uintptr(0) + } + } + break + } + goto _1 + _1: + ; + i++ + } + Xsqlite3_mutex_leave(tls, pVfsMutex) + } else { + _memdbEnter(tls, p) + } + (*TMemStore)(unsafe.Pointer(p)).FnRef-- + if (*TMemStore)(unsafe.Pointer(p)).FnRef <= 0 { + if (*TMemStore)(unsafe.Pointer(p)).FmFlags&uint32(SQLITE_DESERIALIZE_FREEONCLOSE) != 0 { + Xsqlite3_free(tls, (*TMemStore)(unsafe.Pointer(p)).FaData) + } + _memdbLeave(tls, p) + Xsqlite3_mutex_free(tls, (*TMemStore)(unsafe.Pointer(p)).FpMutex) + Xsqlite3_free(tls, p) + } else { + _memdbLeave(tls, p) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Read data from an memdb-file. +// */ +func _memdbRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Tsqlite_int64) (r int32) { + var p uintptr + _ = p + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + _memdbEnter(tls, p) + if iOfst+int64(iAmt) > (*TMemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemset(tls, zBuf, 0, uint64(iAmt)) + if iOfst < (*TMemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemcpy(tls, zBuf, (*TMemStore)(unsafe.Pointer(p)).FaData+uintptr(iOfst), uint64((*TMemStore)(unsafe.Pointer(p)).Fsz-iOfst)) + } + _memdbLeave(tls, p) + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(2)< 0 { + return int32(SQLITE_FULL) + } + if newSz > (*TMemStore)(unsafe.Pointer(p)).FszMax { + return int32(SQLITE_FULL) + } + newSz *= int64(2) + if newSz > (*TMemStore)(unsafe.Pointer(p)).FszMax { + newSz = (*TMemStore)(unsafe.Pointer(p)).FszMax + } + pNew = _sqlite3Realloc(tls, (*TMemStore)(unsafe.Pointer(p)).FaData, uint64(newSz)) + if pNew == uintptr(0) { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(12)< (*TMemStore)(unsafe.Pointer(p)).Fsz { + if v2 = iOfst+int64(iAmt) > (*TMemStore)(unsafe.Pointer(p)).FszAlloc; v2 { + v1 = _memdbEnlarge(tls, p, iOfst+int64(iAmt)) + rc = v1 + } + if v2 && v1 != SQLITE_OK { + _memdbLeave(tls, p) + return rc + } + if iOfst > (*TMemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemset(tls, (*TMemStore)(unsafe.Pointer(p)).FaData+uintptr((*TMemStore)(unsafe.Pointer(p)).Fsz), 0, uint64(iOfst-(*TMemStore)(unsafe.Pointer(p)).Fsz)) + } + (*TMemStore)(unsafe.Pointer(p)).Fsz = iOfst + int64(iAmt) + } + libc.Xmemcpy(tls, (*TMemStore)(unsafe.Pointer(p)).FaData+uintptr(iOfst), z, uint64(iAmt)) + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Truncate an memdb-file. +// ** +// ** In rollback mode (which is always the case for memdb, as it does not +// ** support WAL mode) the truncate() method is only used to reduce +// ** the size of a file, never to increase the size. +// */ +func _memdbTruncate(tls *libc.TLS, pFile uintptr, size Tsqlite_int64) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + rc = SQLITE_OK + _memdbEnter(tls, p) + if size > (*TMemStore)(unsafe.Pointer(p)).Fsz { + /* This can only happen with a corrupt wal mode db */ + rc = int32(SQLITE_CORRUPT) + } else { + (*TMemStore)(unsafe.Pointer(p)).Fsz = size + } + _memdbLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Sync an memdb-file. +// */ +func _memdbSync(tls *libc.TLS, pFile uintptr, flags int32) (r int32) { + _ = pFile + _ = flags + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the current file-size of an memdb-file. +// */ +func _memdbFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) (r int32) { + var p uintptr + _ = p + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + _memdbEnter(tls, p) + *(*Tsqlite_int64)(unsafe.Pointer(pSize)) = (*TMemStore)(unsafe.Pointer(p)).Fsz + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Lock an memdb-file. +// */ +func _memdbLock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { + var p, pThis uintptr + var rc int32 + _, _, _ = p, pThis, rc + pThis = pFile + p = (*TMemFile)(unsafe.Pointer(pThis)).FpStore + rc = SQLITE_OK + if eLock <= (*TMemFile)(unsafe.Pointer(pThis)).FeLock { + return SQLITE_OK + } + _memdbEnter(tls, p) + if eLock > int32(SQLITE_LOCK_SHARED) && (*TMemStore)(unsafe.Pointer(p)).FmFlags&uint32(SQLITE_DESERIALIZE_READONLY) != 0 { + rc = int32(SQLITE_READONLY) + } else { + switch eLock { + case int32(SQLITE_LOCK_SHARED): + if (*TMemStore)(unsafe.Pointer(p)).FnWrLock > 0 { + rc = int32(SQLITE_BUSY) + } else { + (*TMemStore)(unsafe.Pointer(p)).FnRdLock++ + } + case int32(SQLITE_LOCK_RESERVED): + fallthrough + case int32(SQLITE_LOCK_PENDING): + if (*TMemFile)(unsafe.Pointer(pThis)).FeLock == int32(SQLITE_LOCK_SHARED) { + if (*TMemStore)(unsafe.Pointer(p)).FnWrLock > 0 { + rc = int32(SQLITE_BUSY) + } else { + (*TMemStore)(unsafe.Pointer(p)).FnWrLock = int32(1) + } + } + default: + if (*TMemStore)(unsafe.Pointer(p)).FnRdLock > int32(1) { + rc = int32(SQLITE_BUSY) + } else { + if (*TMemFile)(unsafe.Pointer(pThis)).FeLock == int32(SQLITE_LOCK_SHARED) { + (*TMemStore)(unsafe.Pointer(p)).FnWrLock = int32(1) + } + } + break + } + } + if rc == SQLITE_OK { + (*TMemFile)(unsafe.Pointer(pThis)).FeLock = eLock + } + _memdbLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Unlock an memdb-file. +// */ +func _memdbUnlock(tls *libc.TLS, pFile uintptr, eLock int32) (r int32) { + var p, pThis uintptr + _, _ = p, pThis + pThis = pFile + p = (*TMemFile)(unsafe.Pointer(pThis)).FpStore + if eLock >= (*TMemFile)(unsafe.Pointer(pThis)).FeLock { + return SQLITE_OK + } + _memdbEnter(tls, p) + if eLock == int32(SQLITE_LOCK_SHARED) { + if (*TMemFile)(unsafe.Pointer(pThis)).FeLock > int32(SQLITE_LOCK_SHARED) { + (*TMemStore)(unsafe.Pointer(p)).FnWrLock-- + } + } else { + if (*TMemFile)(unsafe.Pointer(pThis)).FeLock > int32(SQLITE_LOCK_SHARED) { + (*TMemStore)(unsafe.Pointer(p)).FnWrLock-- + } + (*TMemStore)(unsafe.Pointer(p)).FnRdLock-- + } + (*TMemFile)(unsafe.Pointer(pThis)).FeLock = eLock + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** File control method. For custom operations on an memdb-file. +// */ +func _memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iLimit Tsqlite3_int64 + var p uintptr + var rc int32 + _, _, _ = iLimit, p, rc + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + rc = int32(SQLITE_NOTFOUND) + _memdbEnter(tls, p) + if op == int32(SQLITE_FCNTL_VFSNAME) { + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+4005, libc.VaList(bp+8, (*TMemStore)(unsafe.Pointer(p)).FaData, (*TMemStore)(unsafe.Pointer(p)).Fsz)) + rc = SQLITE_OK + } + if op == int32(SQLITE_FCNTL_SIZE_LIMIT) { + iLimit = *(*Tsqlite3_int64)(unsafe.Pointer(pArg)) + if iLimit < (*TMemStore)(unsafe.Pointer(p)).Fsz { + if iLimit < 0 { + iLimit = (*TMemStore)(unsafe.Pointer(p)).FszMax + } else { + iLimit = (*TMemStore)(unsafe.Pointer(p)).Fsz + } + } + (*TMemStore)(unsafe.Pointer(p)).FszMax = iLimit + *(*Tsqlite3_int64)(unsafe.Pointer(pArg)) = iLimit + rc = SQLITE_OK + } + _memdbLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Return the device characteristic flags supported by an memdb-file. +// */ +func _memdbDeviceCharacteristics(tls *libc.TLS, pFile uintptr) (r int32) { + _ = pFile + return libc.Int32FromInt32(SQLITE_IOCAP_ATOMIC) | libc.Int32FromInt32(SQLITE_IOCAP_POWERSAFE_OVERWRITE) | libc.Int32FromInt32(SQLITE_IOCAP_SAFE_APPEND) | libc.Int32FromInt32(SQLITE_IOCAP_SEQUENTIAL) +} + +// C documentation +// +// /* Fetch a page of a memory-mapped file */ +func _memdbFetch(tls *libc.TLS, pFile uintptr, iOfst Tsqlite3_int64, iAmt int32, pp uintptr) (r int32) { + var p uintptr + _ = p + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + _memdbEnter(tls, p) + if iOfst+int64(iAmt) > (*TMemStore)(unsafe.Pointer(p)).Fsz || (*TMemStore)(unsafe.Pointer(p)).FmFlags&uint32(SQLITE_DESERIALIZE_RESIZEABLE) != uint32(0) { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } else { + (*TMemStore)(unsafe.Pointer(p)).FnMmap++ + *(*uintptr)(unsafe.Pointer(pp)) = (*TMemStore)(unsafe.Pointer(p)).FaData + uintptr(iOfst) + } + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* Release a memory-mapped page */ +func _memdbUnfetch(tls *libc.TLS, pFile uintptr, iOfst Tsqlite3_int64, pPage uintptr) (r int32) { + var p uintptr + _ = p + p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore + _ = iOfst + _ = pPage + _memdbEnter(tls, p) + (*TMemStore)(unsafe.Pointer(p)).FnMmap-- + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Open an mem file handle. +// */ +func _memdbOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFd uintptr, flags int32, pOutFlags uintptr) (r int32) { + var apNew, p, pFile, pVfsMutex, v3 uintptr + var i, szName, v2 int32 + _, _, _, _, _, _, _, _ = apNew, i, p, pFile, pVfsMutex, szName, v2, v3 + pFile = pFd + p = uintptr(0) + _ = pVfs + libc.Xmemset(tls, pFile, 0, uint64(24)) + szName = _sqlite3Strlen30(tls, zName) + if szName > int32(1) && (int32(*(*int8)(unsafe.Pointer(zName))) == int32('/') || int32(*(*int8)(unsafe.Pointer(zName))) == int32('\\')) { + pVfsMutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1)) + Xsqlite3_mutex_enter(tls, pVfsMutex) + i = 0 + for { + if !(i < _memdb_g.FnMemStore) { + break + } + if libc.Xstrcmp(tls, (*TMemStore)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_memdb_g.FapMemStore + uintptr(i)*8)))).FzFName, zName) == 0 { + p = *(*uintptr)(unsafe.Pointer(_memdb_g.FapMemStore + uintptr(i)*8)) + break + } + goto _1 + _1: + ; + i++ + } + if p == uintptr(0) { + p = _sqlite3Malloc(tls, uint64(72)+uint64(szName)+uint64(3)) + if p == uintptr(0) { + Xsqlite3_mutex_leave(tls, pVfsMutex) + return int32(SQLITE_NOMEM) + } + apNew = _sqlite3Realloc(tls, _memdb_g.FapMemStore, uint64(8)*uint64(_memdb_g.FnMemStore+libc.Int32FromInt32(1))) + if apNew == uintptr(0) { + Xsqlite3_free(tls, p) + Xsqlite3_mutex_leave(tls, pVfsMutex) + return int32(SQLITE_NOMEM) + } + v3 = uintptr(unsafe.Pointer(&_memdb_g)) + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*uintptr)(unsafe.Pointer(apNew + uintptr(v2)*8)) = p + _memdb_g.FapMemStore = apNew + libc.Xmemset(tls, p, 0, uint64(72)) + (*TMemStore)(unsafe.Pointer(p)).FmFlags = uint32(libc.Int32FromInt32(SQLITE_DESERIALIZE_RESIZEABLE) | libc.Int32FromInt32(SQLITE_DESERIALIZE_FREEONCLOSE)) + (*TMemStore)(unsafe.Pointer(p)).FszMax = _sqlite3Config.FmxMemdbSize + (*TMemStore)(unsafe.Pointer(p)).FzFName = p + 1*72 + libc.Xmemcpy(tls, (*TMemStore)(unsafe.Pointer(p)).FzFName, zName, uint64(szName+int32(1))) + (*TMemStore)(unsafe.Pointer(p)).FpMutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST) + if (*TMemStore)(unsafe.Pointer(p)).FpMutex == uintptr(0) { + _memdb_g.FnMemStore-- + Xsqlite3_free(tls, p) + Xsqlite3_mutex_leave(tls, pVfsMutex) + return int32(SQLITE_NOMEM) + } + (*TMemStore)(unsafe.Pointer(p)).FnRef = int32(1) + _memdbEnter(tls, p) + } else { + _memdbEnter(tls, p) + (*TMemStore)(unsafe.Pointer(p)).FnRef++ + } + Xsqlite3_mutex_leave(tls, pVfsMutex) + } else { + p = _sqlite3Malloc(tls, uint64(72)) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, p, 0, uint64(72)) + (*TMemStore)(unsafe.Pointer(p)).FmFlags = uint32(libc.Int32FromInt32(SQLITE_DESERIALIZE_RESIZEABLE) | libc.Int32FromInt32(SQLITE_DESERIALIZE_FREEONCLOSE)) + (*TMemStore)(unsafe.Pointer(p)).FszMax = _sqlite3Config.FmxMemdbSize + } + (*TMemFile)(unsafe.Pointer(pFile)).FpStore = p + if pOutFlags != uintptr(0) { + *(*int32)(unsafe.Pointer(pOutFlags)) = flags | int32(SQLITE_OPEN_MEMORY) + } + (*Tsqlite3_file)(unsafe.Pointer(pFd)).FpMethods = uintptr(unsafe.Pointer(&_memdb_io_methods)) + _memdbLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Test for access permissions. Return true if the requested permission +// ** is available, or false otherwise. +// ** +// ** With memdb, no files ever exist on disk. So always return false. +// */ +func _memdbAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) (r int32) { + _ = pVfs + _ = zPath + _ = flags + *(*int32)(unsafe.Pointer(pResOut)) = 0 + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Populate buffer zOut with the full canonical pathname corresponding +// ** to the pathname in zPath. zOut is guaranteed to point to a buffer +// ** of at least (INST_MAX_PATHNAME+1) bytes. +// */ +func _memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + _ = pVfs + Xsqlite3_snprintf(tls, nOut, zOut, __ccgo_ts+3827, libc.VaList(bp+8, zPath)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Open the dynamic library located at zPath and return a handle. +// */ +func _memdbDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) (r uintptr) { + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxDlOpen})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath) +} + +// C documentation +// +// /* +// ** Populate the buffer zErrMsg (size nByte bytes) with a human readable +// ** utf-8 string describing the most recent error encountered associated +// ** with dynamic libraries. +// */ +func _memdbDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxDlError})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg) +} + +// C documentation +// +// /* +// ** Return a pointer to the symbol zSymbol in the dynamic library pHandle. +// */ +func _memdbDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) (r uintptr) { + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxDlSym})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym) +} + +// C documentation +// +// /* +// ** Close the dynamic library handle pHandle. +// */ +func _memdbDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxDlClose})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle) +} + +// C documentation +// +// /* +// ** Populate the buffer pointed to by zBufOut with nByte bytes of +// ** random data. +// */ +func _memdbRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxRandomness})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut) +} + +// C documentation +// +// /* +// ** Sleep for nMicro microseconds. Return the number of microseconds +// ** actually slept. +// */ +func _memdbSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxSleep})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro) +} + +func _memdbGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxGetLastError})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b) +} + +func _memdbCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FxCurrentTimeInt64})))(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p) +} + +// C documentation +// +// /* +// ** Translate a database connection pointer and schema name into a +// ** MemFile pointer. +// */ +func _memdbFromDbSchema(tls *libc.TLS, db uintptr, zSchema uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pStore uintptr + var rc int32 + var _ /* p at bp+0 */ uintptr + _, _ = pStore, rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = Xsqlite3_file_control(tls, db, zSchema, int32(SQLITE_FCNTL_FILE_POINTER), bp) + if rc != 0 { + return uintptr(0) + } + if (*TMemFile)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FpMethods != uintptr(unsafe.Pointer(&_memdb_io_methods)) { + return uintptr(0) + } + pStore = (*TMemFile)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpStore + _memdbEnter(tls, pStore) + if (*TMemStore)(unsafe.Pointer(pStore)).FzFName != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + _memdbLeave(tls, pStore) + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Return the serialization of a database +// */ +func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintptr, mFlags uint32) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iDb, nPage, pgno, rc, szPage, v1 int32 + var p, pBt, pOut, pPager, pStore, pTo, zSql uintptr + var sz Tsqlite3_int64 + var _ /* pPage at bp+8 */ uintptr + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iDb, nPage, p, pBt, pOut, pPager, pStore, pTo, pgno, rc, sz, szPage, zSql, v1 + szPage = 0 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if zSchema == uintptr(0) { + zSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName + } + p = _memdbFromDbSchema(tls, db, zSchema) + iDb = _sqlite3FindDbName(tls, db, zSchema) + if piSize != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = int64(-int32(1)) + } + if iDb < 0 { + return uintptr(0) + } + if p != 0 { + pStore = (*TMemFile)(unsafe.Pointer(p)).FpStore + if piSize != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = (*TMemStore)(unsafe.Pointer(pStore)).Fsz + } + if mFlags&uint32(SQLITE_SERIALIZE_NOCOPY) != 0 { + pOut = (*TMemStore)(unsafe.Pointer(pStore)).FaData + } else { + pOut = Xsqlite3_malloc64(tls, uint64((*TMemStore)(unsafe.Pointer(pStore)).Fsz)) + if pOut != 0 { + libc.Xmemcpy(tls, pOut, (*TMemStore)(unsafe.Pointer(pStore)).FaData, uint64((*TMemStore)(unsafe.Pointer(pStore)).Fsz)) + } + } + return pOut + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if pBt == uintptr(0) { + return uintptr(0) + } + szPage = _sqlite3BtreeGetPageSize(tls, pBt) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4020, libc.VaList(bp+24, zSchema)) + if zSql != 0 { + v1 = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) + } else { + v1 = int32(SQLITE_NOMEM) + } + rc = v1 + Xsqlite3_free(tls, zSql) + if rc != 0 { + return uintptr(0) + } + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc != int32(SQLITE_ROW) { + pOut = uintptr(0) + } else { + sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + if sz == 0 { + Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + Xsqlite3_exec(tls, db, __ccgo_ts+4043, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == int32(SQLITE_ROW) { + sz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) * int64(szPage) + } + } + if piSize != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(piSize)) = sz + } + if mFlags&uint32(SQLITE_SERIALIZE_NOCOPY) != 0 { + pOut = uintptr(0) + } else { + pOut = Xsqlite3_malloc64(tls, uint64(sz)) + if pOut != 0 { + nPage = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + pPager = _sqlite3BtreePager(tls, pBt) + pgno = int32(1) + for { + if !(pgno <= nPage) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + pTo = pOut + uintptr(int64(szPage)*int64(pgno-libc.Int32FromInt32(1))) + rc = _sqlite3PagerGet(tls, pPager, uint32(pgno), bp+8, 0) + if rc == SQLITE_OK { + libc.Xmemcpy(tls, pTo, _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 8))), uint64(szPage)) + } else { + libc.Xmemset(tls, pTo, 0, uint64(szPage)) + } + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + goto _2 + _2: + ; + pgno++ + } + } + } + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return pOut +} + +// C documentation +// +// /* Convert zSchema to a MemDB and initialize its content. +// */ +func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uintptr, szDb Tsqlite3_int64, szBuf Tsqlite3_int64, mFlags uint32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iDb, rc int32 + var p, pStore, zSql uintptr + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _ = iDb, p, pStore, rc, zSql + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if zSchema == uintptr(0) { + zSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName + } + iDb = _sqlite3FindDbName(tls, db, zSchema) + if iDb < int32(2) && iDb != 0 { + rc = int32(SQLITE_ERROR) + goto end_deserialize + } + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4068, libc.VaList(bp+16, zSchema)) + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) + Xsqlite3_free(tls, zSql) + } + if rc != 0 { + goto end_deserialize + } + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) + libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(1), 2, 0x4) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 2, 0x4) + if rc != int32(SQLITE_DONE) { + rc = int32(SQLITE_ERROR) + goto end_deserialize + } + p = _memdbFromDbSchema(tls, db, zSchema) + if p == uintptr(0) { + rc = int32(SQLITE_ERROR) + } else { + pStore = (*TMemFile)(unsafe.Pointer(p)).FpStore + (*TMemStore)(unsafe.Pointer(pStore)).FaData = pData + pData = uintptr(0) + (*TMemStore)(unsafe.Pointer(pStore)).Fsz = szDb + (*TMemStore)(unsafe.Pointer(pStore)).FszAlloc = szBuf + (*TMemStore)(unsafe.Pointer(pStore)).FszMax = szBuf + if (*TMemStore)(unsafe.Pointer(pStore)).FszMax < _sqlite3Config.FmxMemdbSize { + (*TMemStore)(unsafe.Pointer(pStore)).FszMax = _sqlite3Config.FmxMemdbSize + } + (*TMemStore)(unsafe.Pointer(pStore)).FmFlags = mFlags + rc = SQLITE_OK + } +end_deserialize: + ; + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if pData != 0 && mFlags&uint32(SQLITE_DESERIALIZE_FREEONCLOSE) != uint32(0) { + Xsqlite3_free(tls, pData) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Return true if the VFS is the memvfs. +// */ +func _sqlite3IsMemdb(tls *libc.TLS, pVfs uintptr) (r int32) { + return libc.BoolInt32(pVfs == uintptr(unsafe.Pointer(&_memdb_vfs))) +} + +// C documentation +// +// /* +// ** This routine is called when the extension is loaded. +// ** Register the new VFS. +// */ +func _sqlite3MemdbInit(tls *libc.TLS) (r int32) { + var pLower uintptr + var sz uint32 + _, _ = pLower, sz + pLower = Xsqlite3_vfs_find(tls, uintptr(0)) + if pLower == uintptr(0) { + return int32(SQLITE_ERROR) + } + sz = uint32((*Tsqlite3_vfs)(unsafe.Pointer(pLower)).FszOsFile) + _memdb_vfs.FpAppData = pLower + /* The following conditional can only be true when compiled for + ** Windows x86 and SQLITE_MAX_MMAP_SIZE=0. We always leave + ** it in, to be safe, but it is marked as NO_TEST since there + ** is no way to reach it under most builds. */ + if uint64(sz) < uint64(24) { + sz = uint32(24) + } /*NO_TEST*/ + _memdb_vfs.FszOsFile = int32(sz) + return Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&_memdb_vfs)), 0) +} + +/************** End of memdb.c ***********************************************/ +/************** Begin file bitvec.c ******************************************/ +/* +** 2008 February 16 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file implements an object that represents a fixed-length +** bitmap. Bits are numbered starting with 1. +** +** A bitmap is used to record which pages of a database file have been +** journalled during a transaction, or which pages have the "dont-write" +** property. Usually only a few pages are meet either condition. +** So the bitmap is usually sparse and has low cardinality. +** But sometimes (for example when during a DROP of a large table) most +** or all of the pages in a database can get journalled. In those cases, +** the bitmap becomes dense with high cardinality. The algorithm needs +** to handle both cases well. +** +** The size of the bitmap is fixed when the object is created. +** +** All bits are clear when the bitmap is created. Individual bits +** may be set or cleared one at a time. +** +** Test operations are about 100 times more common that set operations. +** Clear operations are exceedingly rare. There are usually between +** 5 and 500 set operations per Bitvec object, though the number of sets can +** sometimes grow into tens of thousands or larger. The size of the +** Bitvec object is the number of pages in the database file at the +** start of a transaction, and is thus usually less than a few thousand, +** but can be as large as 2 billion for a really big database. + */ +/* #include "sqliteInt.h" */ + +/* Size of the Bitvec structure in bytes. */ + +/* Round the union size down to the nearest pointer boundary, since that's how +** it will be aligned within the Bitvec struct. */ + +/* Type of the array "element" for the bitmap representation. +** Should be a power of 2, and ideally, evenly divide into BITVEC_USIZE. +** Setting this to the "natural word" size of your CPU may improve +** performance. */ +/* Size, in bits, of the bitmap element. */ +/* Number of elements in a bitmap array. */ +/* Number of bits in the bitmap array. */ + +/* Number of u32 values in hash table. */ +/* Maximum number of entries in hash table before +** sub-dividing and re-hashing. */ +/* Hashing function for the aHash representation. +** Empirical testing showed that the *37 multiplier +** (an arbitrary prime)in the hash function provided +** no fewer collisions than the no-op *1. */ + +/* +** A bitmap is an instance of the following structure. +** +** This bitmap records the existence of zero or more bits +** with values between 1 and iSize, inclusive. +** +** There are three possible representations of the bitmap. +** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight +** bitmap. The least significant bit is bit 1. +** +** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is +** a hash table that will hold up to BITVEC_MXHASH distinct values. +** +** Otherwise, the value i is redirected into one of BITVEC_NPTR +** sub-bitmaps pointed to by Bitvec.u.apSub[]. Each subbitmap +** handles up to iDivisor separate values of i. apSub[0] holds +** values between 1 and iDivisor. apSub[1] holds values between +** iDivisor+1 and 2*iDivisor. apSub[N] holds values between +** N*iDivisor+1 and (N+1)*iDivisor. Each subbitmap is normalized +** to hold deal with values between 1 and iDivisor. + */ +type TBitvec1 = struct { + FiSize Tu32 + FnSet Tu32 + FiDivisor Tu32 + Fu struct { + FaHash [0][124]Tu32 + FapSub [0][62]uintptr + FaBitmap [496]Tu8 + } +} + +type Bitvec1 = TBitvec1 + +// C documentation +// +// /* +// ** Create a new bitmap object able to handle bits between 0 and iSize, +// ** inclusive. Return a pointer to the new object. Return NULL if +// ** malloc fails. +// */ +func _sqlite3BitvecCreate(tls *libc.TLS, iSize Tu32) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3MallocZero(tls, uint64(512)) + if p != 0 { + (*TBitvec)(unsafe.Pointer(p)).FiSize = iSize + } + return p +} + +// C documentation +// +// /* +// ** Check to see if the i-th bit is set. Return true or false. +// ** If p is NULL (if the bitmap has not been created) or if +// ** i is out of range, then return false. +// */ +func _sqlite3BitvecTestNotNull(tls *libc.TLS, p uintptr, i Tu32) (r int32) { + var bin, h, v1 Tu32 + _, _, _ = bin, h, v1 + i-- + if i >= (*TBitvec)(unsafe.Pointer(p)).FiSize { + return 0 + } + for (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + bin = i / (*TBitvec)(unsafe.Pointer(p)).FiDivisor + i = i % (*TBitvec)(unsafe.Pointer(p)).FiDivisor + p = *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) + if !(p != 0) { + return 0 + } + } + if uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) <= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)*libc.Uint64FromInt32(BITVEC_SZELEM) { + return libc.BoolInt32(int32(*(*Tu8)(unsafe.Pointer(p + 16 + uintptr(i/uint32(BITVEC_SZELEM)))))&(int32(1)<<(i&uint32(libc.Int32FromInt32(BITVEC_SZELEM)-libc.Int32FromInt32(1)))) != 0) + } else { + v1 = i + i++ + h = uint32(uint64(v1*libc.Uint32FromInt32(1)) % ((libc.Uint64FromInt32(BITVEC_SZ) - libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4)) / libc.Uint64FromInt64(8) * libc.Uint64FromInt64(8) / libc.Uint64FromInt64(4))) + for *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) != 0 { + if *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) == i { + return int32(1) + } + h = uint32(uint64(h+libc.Uint32FromInt32(1)) % ((libc.Uint64FromInt32(BITVEC_SZ) - libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4)) / libc.Uint64FromInt64(8) * libc.Uint64FromInt64(8) / libc.Uint64FromInt64(4))) + } + return 0 + } + return r +} + +func _sqlite3BitvecTest(tls *libc.TLS, p uintptr, i Tu32) (r int32) { + return libc.BoolInt32(p != uintptr(0) && _sqlite3BitvecTestNotNull(tls, p, i) != 0) +} + +// C documentation +// +// /* +// ** Set the i-th bit. Return 0 on success and an error code if +// ** anything goes wrong. +// ** +// ** This routine might cause sub-bitmaps to be allocated. Failing +// ** to get the memory needed to hold the sub-bitmap is the only +// ** that can go wrong with an insert, assuming p and i are valid. +// ** +// ** The calling function must ensure that p is a valid Bitvec object +// ** and that the value for "i" is within range of the Bitvec object. +// ** Otherwise the behavior is undefined. +// */ +func _sqlite3BitvecSet(tls *libc.TLS, p uintptr, i Tu32) (r int32) { + var aiValues, p1 uintptr + var bin, h, v2 Tu32 + var j uint32 + var rc int32 + _, _, _, _, _, _, _ = aiValues, bin, h, j, rc, v2, p1 + if p == uintptr(0) { + return SQLITE_OK + } + i-- + for uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) > (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)*libc.Uint64FromInt32(BITVEC_SZELEM) && (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + bin = i / (*TBitvec)(unsafe.Pointer(p)).FiDivisor + i = i % (*TBitvec)(unsafe.Pointer(p)).FiDivisor + if *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) = _sqlite3BitvecCreate(tls, (*TBitvec)(unsafe.Pointer(p)).FiDivisor) + if *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) == uintptr(0) { + return int32(SQLITE_NOMEM) + } + } + p = *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) + } + if uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) <= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)*libc.Uint64FromInt32(BITVEC_SZELEM) { + p1 = p + 16 + uintptr(i/uint32(BITVEC_SZELEM)) + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(1)<<(i&uint32(libc.Int32FromInt32(BITVEC_SZELEM)-libc.Int32FromInt32(1)))) + return SQLITE_OK + } + v2 = i + i++ + h = uint32(uint64(v2*libc.Uint32FromInt32(1)) % ((libc.Uint64FromInt32(BITVEC_SZ) - libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4)) / libc.Uint64FromInt64(8) * libc.Uint64FromInt64(8) / libc.Uint64FromInt64(4))) + /* if there wasn't a hash collision, and this doesn't */ + /* completely fill the hash, then just add it without */ + /* worrying about sub-dividing and re-hashing. */ + if !(*(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) != 0) { + if uint64((*TBitvec)(unsafe.Pointer(p)).FnSet) < (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)-libc.Uint64FromInt32(1) { + goto bitvec_set_end + } else { + goto bitvec_set_rehash + } + } + /* there was a collision, check to see if it's already */ + /* in hash, if not, try to find a spot for it */ + for cond := true; cond; cond = *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) != 0 { + if *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) == i { + return SQLITE_OK + } + h++ + if uint64(h) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4) { + h = uint32(0) + } + } + /* we didn't find it in the hash. h points to the first */ + /* available free spot. check to see if this is going to */ + /* make our hash too "full". */ +bitvec_set_rehash: + ; + if uint64((*TBitvec)(unsafe.Pointer(p)).FnSet) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)/libc.Uint64FromInt32(2) { + aiValues = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(496)) + if aiValues == uintptr(0) { + return int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, aiValues, p+16, uint64(496)) + libc.Xmemset(tls, p+16, 0, uint64(496)) + (*TBitvec)(unsafe.Pointer(p)).FiDivisor = uint32((uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) + (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(8) - uint64(1)) / ((libc.Uint64FromInt32(BITVEC_SZ) - libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4)) / libc.Uint64FromInt64(8) * libc.Uint64FromInt64(8) / libc.Uint64FromInt64(8))) + rc = _sqlite3BitvecSet(tls, p, i) + j = uint32(0) + for { + if !(uint64(j) < (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)) { + break + } + if *(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != 0 { + rc |= _sqlite3BitvecSet(tls, p, *(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4))) + } + goto _3 + _3: + ; + j++ + } + _sqlite3DbFree(tls, uintptr(0), aiValues) + return rc + } + } +bitvec_set_end: + ; + (*TBitvec)(unsafe.Pointer(p)).FnSet++ + *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = i + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Clear the i-th bit. +// ** +// ** pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage +// ** that BitvecClear can use to rebuilt its hash table. +// */ +func _sqlite3BitvecClear(tls *libc.TLS, p uintptr, i Tu32, pBuf uintptr) { + var aiValues, p1 uintptr + var bin, h Tu32 + var j uint32 + _, _, _, _, _ = aiValues, bin, h, j, p1 + if p == uintptr(0) { + return + } + i-- + for (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + bin = i / (*TBitvec)(unsafe.Pointer(p)).FiDivisor + i = i % (*TBitvec)(unsafe.Pointer(p)).FiDivisor + p = *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(bin)*8)) + if !(p != 0) { + return + } + } + if uint64((*TBitvec)(unsafe.Pointer(p)).FiSize) <= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)*libc.Uint64FromInt32(BITVEC_SZELEM) { + p1 = p + 16 + uintptr(i/uint32(BITVEC_SZELEM)) + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(1) << (i & uint32(libc.Int32FromInt32(BITVEC_SZELEM)-libc.Int32FromInt32(1))))) + } else { + aiValues = pBuf + libc.Xmemcpy(tls, aiValues, p+16, uint64(496)) + libc.Xmemset(tls, p+16, 0, uint64(496)) + (*TBitvec)(unsafe.Pointer(p)).FnSet = uint32(0) + j = uint32(0) + for { + if !(uint64(j) < (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)) { + break + } + if *(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != 0 && *(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != i+uint32(1) { + h = uint32(uint64((*(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4))-libc.Uint32FromInt32(1))*libc.Uint32FromInt32(1)) % ((libc.Uint64FromInt32(BITVEC_SZ) - libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4)) / libc.Uint64FromInt64(8) * libc.Uint64FromInt64(8) / libc.Uint64FromInt64(4))) + (*TBitvec)(unsafe.Pointer(p)).FnSet++ + for *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) != 0 { + h++ + if uint64(h) >= (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4) { + h = uint32(0) + } + } + *(*Tu32)(unsafe.Pointer(p + 16 + uintptr(h)*4)) = *(*Tu32)(unsafe.Pointer(aiValues + uintptr(j)*4)) + } + goto _2 + _2: + ; + j++ + } + } +} + +// C documentation +// +// /* +// ** Destroy a bitmap object. Reclaim all memory used. +// */ +func _sqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { + var i uint32 + _ = i + if p == uintptr(0) { + return + } + if (*TBitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + i = uint32(0) + for { + if !(uint64(i) < (libc.Uint64FromInt32(BITVEC_SZ)-libc.Uint64FromInt32(3)*libc.Uint64FromInt64(4))/libc.Uint64FromInt64(8)*libc.Uint64FromInt64(8)/libc.Uint64FromInt64(8)) { + break + } + _sqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + } + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** Return the value of the iSize parameter specified when Bitvec *p +// ** was created. +// */ +func _sqlite3BitvecSize(tls *libc.TLS, p uintptr) (r Tu32) { + return (*TBitvec)(unsafe.Pointer(p)).FiSize +} + +/* +** Let V[] be an array of unsigned characters sufficient to hold +** up to N bits. Let I be an integer between 0 and N. 0<=I 0 { + nx = 0 + } + pc += nx + *(*int32)(unsafe.Pointer(bp)) = *(*int32)(unsafe.Pointer(bp)) & int32(0x7fffffff) % sz + if op&int32(1) != 0 { + p5 = pV + uintptr((*(*int32)(unsafe.Pointer(bp))+int32(1))>>int32(3)) + *(*uint8)(unsafe.Pointer(p5)) = uint8(int32(*(*uint8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(1)<<((*(*int32)(unsafe.Pointer(bp))+libc.Int32FromInt32(1))&libc.Int32FromInt32(7))) + if op != int32(5) { + if _sqlite3BitvecSet(tls, pBitvec, uint32(*(*int32)(unsafe.Pointer(bp))+int32(1))) != 0 { + goto bitvec_end + } + } + } else { + p6 = pV + uintptr((*(*int32)(unsafe.Pointer(bp))+int32(1))>>int32(3)) + *(*uint8)(unsafe.Pointer(p6)) = uint8(int32(*(*uint8)(unsafe.Pointer(p6))) & ^(libc.Int32FromInt32(1) << ((*(*int32)(unsafe.Pointer(bp)) + libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)))) + _sqlite3BitvecClear(tls, pBitvec, uint32(*(*int32)(unsafe.Pointer(bp))+int32(1)), pTmpSpace) + } + } + /* Test to make sure the linear array exactly matches the + ** Bitvec object. Start with the assumption that they do + ** match (rc==0). Change rc to non-zero if a discrepancy + ** is found. + */ + rc = int32(uint32(_sqlite3BitvecTest(tls, uintptr(0), uint32(0))+_sqlite3BitvecTest(tls, pBitvec, uint32(sz+int32(1)))+_sqlite3BitvecTest(tls, pBitvec, uint32(0))) + (_sqlite3BitvecSize(tls, pBitvec) - uint32(sz))) + *(*int32)(unsafe.Pointer(bp)) = int32(1) + for { + if !(*(*int32)(unsafe.Pointer(bp)) <= sz) { + break + } + if libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(pV + uintptr(*(*int32)(unsafe.Pointer(bp))>>int32(3)))))&(int32(1)<<(*(*int32)(unsafe.Pointer(bp))&int32(7))) != 0) != _sqlite3BitvecTest(tls, pBitvec, uint32(*(*int32)(unsafe.Pointer(bp)))) { + rc = *(*int32)(unsafe.Pointer(bp)) + break + } + goto _7 + _7: + ; + *(*int32)(unsafe.Pointer(bp))++ + } + /* Free allocated structure */ +bitvec_end: + ; + Xsqlite3_free(tls, pTmpSpace) + Xsqlite3_free(tls, pV) + _sqlite3BitvecDestroy(tls, pBitvec) + return rc +} + +/************** End of bitvec.c **********************************************/ +/************** Begin file pcache.c ******************************************/ +/* +** 2008 August 05 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file implements that page cache. + */ +/* #include "sqliteInt.h" */ + +/* +** A complete page cache is an instance of this structure. Every +** entry in the cache holds a single page of the database file. The +** btree layer only operates on the cached copy of the database pages. +** +** A page cache entry is "clean" if it exactly matches what is currently +** on disk. A page is "dirty" if it has been modified and needs to be +** persisted to disk. +** +** pDirty, pDirtyTail, pSynced: +** All dirty pages are linked into the doubly linked list using +** PgHdr.pDirtyNext and pDirtyPrev. The list is maintained in LRU order +** such that p was added to the list more recently than p->pDirtyNext. +** PCache.pDirty points to the first (newest) element in the list and +** pDirtyTail to the last (oldest). +** +** The PCache.pSynced variable is used to optimize searching for a dirty +** page to eject from the cache mid-transaction. It is better to eject +** a page that does not require a journal sync than one that does. +** Therefore, pSynced is maintained so that it *almost* always points +** to either the oldest page in the pDirty/pDirtyTail list that has a +** clear PGHDR_NEED_SYNC flag or to a page that is older than this one +** (so that the right page to eject can be found by following pDirtyPrev +** pointers). + */ +type TPCache2 = struct { + FpDirty uintptr + FpDirtyTail uintptr + FpSynced uintptr + FnRefSum Ti64 + FszCache int32 + FszSpill int32 + FszPage int32 + FszExtra int32 + FbPurgeable Tu8 + FeCreate Tu8 + FxStress uintptr + FpStress uintptr + FpCache uintptr +} + +type PCache2 = TPCache2 + +/********************************** Test and Debug Logic **********************/ +/* +** Debug tracing macros. Enable by by changing the "0" to "1" and +** recompiling. +** +** When sqlite3PcacheTrace is 1, single line trace messages are issued. +** When sqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries +** is displayed for many operations, resulting in a lot of output. + */ + +/* +** Return 1 if pPg is on the dirty list for pCache. Return 0 if not. +** This routine runs inside of assert() statements only. + */ + +/* +** Check invariants on a PgHdr entry. Return true if everything is OK. +** Return false if any invariant is violated. +** +** This routine is for use inside of assert() statements only. For +** example: +** +** assert( sqlite3PcachePageSanity(pPg) ); + */ + +/********************************** Linked List Management ********************/ + +/* Allowed values for second argument to pcacheManageDirtyList() */ + +// C documentation +// +// /* +// ** Manage pPage's participation on the dirty list. Bits of the addRemove +// ** argument determines what operation to do. The 0x01 bit means first +// ** remove pPage from the dirty list. The 0x02 means add pPage back to +// ** the dirty list. Doing both moves pPage to the front of the dirty list. +// */ +func _pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove Tu8) { + var p uintptr + _ = p + p = (*TPgHdr)(unsafe.Pointer(pPage)).FpCache + if int32(addRemove)&int32(PCACHE_DIRTYLIST_REMOVE) != 0 { + /* Update the PCache1.pSynced variable if necessary. */ + if (*TPCache)(unsafe.Pointer(p)).FpSynced == pPage { + (*TPCache)(unsafe.Pointer(p)).FpSynced = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } + if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { + (*TPgHdr)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } else { + (*TPCache)(unsafe.Pointer(p)).FpDirtyTail = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } + if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev != 0 { + (*TPgHdr)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev)).FpDirtyNext = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext + } else { + /* If there are now no dirty pages in the cache, set eCreate to 2. + ** This is an optimization that allows sqlite3PcacheFetch() to skip + ** searching for a dirty page to eject from the cache when it might + ** otherwise have to. */ + (*TPCache)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext + if (*TPCache)(unsafe.Pointer(p)).FpDirty == uintptr(0) { /*OPTIMIZATION-IF-TRUE*/ + (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(2) + } + } + } + if int32(addRemove)&int32(PCACHE_DIRTYLIST_ADD) != 0 { + (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev = uintptr(0) + (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext = (*TPCache)(unsafe.Pointer(p)).FpDirty + if (*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { + (*TPgHdr)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = pPage + } else { + (*TPCache)(unsafe.Pointer(p)).FpDirtyTail = pPage + if (*TPCache)(unsafe.Pointer(p)).FbPurgeable != 0 { + (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(1) + } + } + (*TPCache)(unsafe.Pointer(p)).FpDirty = pPage + /* If pSynced is NULL and this page has a clear NEED_SYNC flag, set + ** pSynced to point to it. Checking the NEED_SYNC flag is an + ** optimization, as if pSynced points to a page with the NEED_SYNC + ** flag set sqlite3PcacheFetchStress() searches through all newer + ** entries of the dirty-list for a page with NEED_SYNC clear anyway. */ + if !((*TPCache)(unsafe.Pointer(p)).FpSynced != 0) && 0 == int32((*TPgHdr)(unsafe.Pointer(pPage)).Fflags)&int32(PGHDR_NEED_SYNC) { + (*TPCache)(unsafe.Pointer(p)).FpSynced = pPage + } + } +} + +// C documentation +// +// /* +// ** Wrapper around the pluggable caches xUnpin method. If the cache is +// ** being used for an in-memory database, this function is a no-op. +// */ +func _pcacheUnpin(tls *libc.TLS, p uintptr) { + if (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FbPurgeable != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxUnpin})))(tls, (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FpCache, (*TPgHdr)(unsafe.Pointer(p)).FpPage, 0) + } +} + +// C documentation +// +// /* +// ** Compute the number of pages of cache requested. p->szCache is the +// ** cache size requested by the "PRAGMA cache_size" statement. +// */ +func _numberOfCachePages(tls *libc.TLS, p uintptr) (r int32) { + var n Ti64 + _ = n + if (*TPCache)(unsafe.Pointer(p)).FszCache >= 0 { + /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the + ** suggested cache size is set to N. */ + return (*TPCache)(unsafe.Pointer(p)).FszCache + } else { + /* IMPLEMENTATION-OF: R-59858-46238 If the argument N is negative, then the + ** number of cache pages is adjusted to be a number of pages that would + ** use approximately abs(N*1024) bytes of memory based on the current + ** page size. */ + n = int64(-libc.Int32FromInt32(1024)) * int64((*TPCache)(unsafe.Pointer(p)).FszCache) / int64((*TPCache)(unsafe.Pointer(p)).FszPage+(*TPCache)(unsafe.Pointer(p)).FszExtra) + if n > int64(1000000000) { + n = int64(1000000000) + } + return int32(n) + } + return r +} + +// C documentation +// +// /*************************************************** General Interfaces ****** +// ** +// ** Initialize and shutdown the page cache subsystem. Neither of these +// ** functions are threadsafe. +// */ +func _sqlite3PcacheInitialize(tls *libc.TLS) (r int32) { + if _sqlite3Config.Fpcache2.FxInit == uintptr(0) { + /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the + ** built-in default page cache is used instead of the application defined + ** page cache. */ + _sqlite3PCacheSetDefault(tls) + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxInit})))(tls, _sqlite3Config.Fpcache2.FpArg) +} + +func _sqlite3PcacheShutdown(tls *libc.TLS) { + if _sqlite3Config.Fpcache2.FxShutdown != 0 { + /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */ + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxShutdown})))(tls, _sqlite3Config.Fpcache2.FpArg) + } +} + +// C documentation +// +// /* +// ** Return the size in bytes of a PCache object. +// */ +func _sqlite3PcacheSize(tls *libc.TLS) (r int32) { + return int32(80) +} + +// C documentation +// +// /* +// ** Create a new PCache object. Storage space to hold the object +// ** has already been allocated and is passed in as the p pointer. +// ** The caller discovers how much space needs to be allocated by +// ** calling sqlite3PcacheSize(). +// ** +// ** szExtra is some extra space allocated for each page. The first +// ** 8 bytes of the extra space will be zeroed as the page is allocated, +// ** but remaining content will be uninitialized. Though it is opaque +// ** to this module, the extra space really ends up being the MemPage +// ** structure in the pager. +// */ +func _sqlite3PcacheOpen(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32, xStress uintptr, pStress uintptr, p uintptr) (r int32) { + libc.Xmemset(tls, p, 0, uint64(80)) + (*TPCache)(unsafe.Pointer(p)).FszPage = int32(1) + (*TPCache)(unsafe.Pointer(p)).FszExtra = szExtra + /* First 8 bytes will be zeroed */ + (*TPCache)(unsafe.Pointer(p)).FbPurgeable = uint8(bPurgeable) + (*TPCache)(unsafe.Pointer(p)).FeCreate = uint8(2) + (*TPCache)(unsafe.Pointer(p)).FxStress = xStress + (*TPCache)(unsafe.Pointer(p)).FpStress = pStress + (*TPCache)(unsafe.Pointer(p)).FszCache = int32(100) + (*TPCache)(unsafe.Pointer(p)).FszSpill = int32(1) + return _sqlite3PcacheSetPageSize(tls, p, szPage) +} + +// C documentation +// +// /* +// ** Change the page size for PCache object. The caller must ensure that there +// ** are no outstanding page references when this function is called. +// */ +func _sqlite3PcacheSetPageSize(tls *libc.TLS, pCache uintptr, szPage int32) (r int32) { + var pNew uintptr + _ = pNew + if (*TPCache)(unsafe.Pointer(pCache)).FszPage != 0 { + pNew = (*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxCreate})))(tls, szPage, int32(uint64((*TPCache)(unsafe.Pointer(pCache)).FszExtra)+(libc.Uint64FromInt64(80)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))), int32((*TPCache)(unsafe.Pointer(pCache)).FbPurgeable)) + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxCachesize})))(tls, pNew, _numberOfCachePages(tls, pCache)) + if (*TPCache)(unsafe.Pointer(pCache)).FpCache != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxDestroy})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) + } + (*TPCache)(unsafe.Pointer(pCache)).FpCache = pNew + (*TPCache)(unsafe.Pointer(pCache)).FszPage = szPage + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Try to obtain a page from the cache. +// ** +// ** This routine returns a pointer to an sqlite3_pcache_page object if +// ** such an object is already in cache, or if a new one is created. +// ** This routine returns a NULL pointer if the object was not in cache +// ** and could not be created. +// ** +// ** The createFlags should be 0 to check for existing pages and should +// ** be 3 (not 1, but 3) to try to create a new page. +// ** +// ** If the createFlag is 0, then NULL is always returned if the page +// ** is not already in the cache. If createFlag is 1, then a new page +// ** is created only if that can be done without spilling dirty pages +// ** and without exceeding the cache size limit. +// ** +// ** The caller needs to invoke sqlite3PcacheFetchFinish() to properly +// ** initialize the sqlite3_pcache_page object and convert it into a +// ** PgHdr object. The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish() +// ** routines are split this way for performance reasons. When separated +// ** they can both (usually) operate without having to push values to +// ** the stack on entry and pop them back off on exit, which saves a +// ** lot of pushing and popping. +// */ +func _sqlite3PcacheFetch(tls *libc.TLS, pCache uintptr, pgno TPgno, createFlag int32) (r uintptr) { + var eCreate int32 + var pRes uintptr + _, _ = eCreate, pRes + /* eCreate defines what to do if the page does not exist. + ** 0 Do not allocate a new page. (createFlag==0) + ** 1 Allocate a new page if doing so is inexpensive. + ** (createFlag==1 AND bPurgeable AND pDirty) + ** 2 Allocate a new page even it doing so is difficult. + ** (createFlag==1 AND !(bPurgeable AND pDirty) + */ + eCreate = createFlag & int32((*TPCache)(unsafe.Pointer(pCache)).FeCreate) + pRes = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, pgno, eCreate) + return pRes +} + +// C documentation +// +// /* +// ** If the sqlite3PcacheFetch() routine is unable to allocate a new +// ** page because no clean pages are available for reuse and the cache +// ** size limit has been reached, then this routine can be invoked to +// ** try harder to allocate a page. This routine might invoke the stress +// ** callback to spill dirty pages to the journal. It will then try to +// ** allocate the new page and will only fail to allocate a new page on +// ** an OOM error. +// ** +// ** This routine should be invoked only after sqlite3PcacheFetch() fails. +// */ +func _sqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno TPgno, ppPage uintptr) (r int32) { + var pPg uintptr + var rc, v3 int32 + _, _, _ = pPg, rc, v3 + if int32((*TPCache)(unsafe.Pointer(pCache)).FeCreate) == int32(2) { + return 0 + } + if _sqlite3PcachePagecount(tls, pCache) > (*TPCache)(unsafe.Pointer(pCache)).FszSpill { + /* Find a dirty page to write-out and recycle. First try to find a + ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC + ** cleared), but if that is not possible settle for any other + ** unreferenced dirty page. + ** + ** If the LRU page in the dirty list that has a clear PGHDR_NEED_SYNC + ** flag is currently referenced, then the following may leave pSynced + ** set incorrectly (pointing to other than the LRU page with NEED_SYNC + ** cleared). This is Ok, as pSynced is just an optimization. */ + pPg = (*TPCache)(unsafe.Pointer(pCache)).FpSynced + for { + if !(pPg != 0 && ((*TPgHdr)(unsafe.Pointer(pPg)).FnRef != 0 || int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_NEED_SYNC) != 0)) { + break + } + goto _1 + _1: + ; + pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev + } + (*TPCache)(unsafe.Pointer(pCache)).FpSynced = pPg + if !(pPg != 0) { + pPg = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail + for { + if !(pPg != 0 && (*TPgHdr)(unsafe.Pointer(pPg)).FnRef != 0) { + break + } + goto _2 + _2: + ; + pPg = (*TPgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev + } + } + if pPg != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPCache)(unsafe.Pointer(pCache)).FxStress})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpStress, pPg) + if rc != SQLITE_OK && rc != int32(SQLITE_BUSY) { + return rc + } + } + } + *(*uintptr)(unsafe.Pointer(ppPage)) = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, pgno, int32(2)) + if *(*uintptr)(unsafe.Pointer(ppPage)) == uintptr(0) { + v3 = int32(SQLITE_NOMEM) + } else { + v3 = SQLITE_OK + } + return v3 +} + +// C documentation +// +// /* +// ** This is a helper routine for sqlite3PcacheFetchFinish() +// ** +// ** In the uncommon case where the page being fetched has not been +// ** initialized, this routine is invoked to do the initialization. +// ** This routine is broken out into a separate function since it +// ** requires extra stack manipulation that can be avoided in the common +// ** case. +// */ +func _pcacheFetchFinishWithInit(tls *libc.TLS, pCache uintptr, pgno TPgno, pPage uintptr) (r uintptr) { + var pPgHdr uintptr + _ = pPgHdr + pPgHdr = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra + libc.Xmemset(tls, pPgHdr+32, 0, libc.Uint64FromInt64(80)-uint64(libc.UintptrFromInt32(0)+32)) + (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpPage = pPage + (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpData = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpBuf + (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpExtra = pPgHdr + 1*80 + libc.Xmemset(tls, (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpExtra, 0, uint64(8)) + (*TPgHdr)(unsafe.Pointer(pPgHdr)).FpCache = pCache + (*TPgHdr)(unsafe.Pointer(pPgHdr)).Fpgno = pgno + (*TPgHdr)(unsafe.Pointer(pPgHdr)).Fflags = uint16(PGHDR_CLEAN) + return _sqlite3PcacheFetchFinish(tls, pCache, pgno, pPage) +} + +// C documentation +// +// /* +// ** This routine converts the sqlite3_pcache_page object returned by +// ** sqlite3PcacheFetch() into an initialized PgHdr object. This routine +// ** must be called after sqlite3PcacheFetch() in order to get a usable +// ** result. +// */ +func _sqlite3PcacheFetchFinish(tls *libc.TLS, pCache uintptr, pgno TPgno, pPage uintptr) (r uintptr) { + var pPgHdr uintptr + _ = pPgHdr + pPgHdr = (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra + if !((*TPgHdr)(unsafe.Pointer(pPgHdr)).FpPage != 0) { + return _pcacheFetchFinishWithInit(tls, pCache, pgno, pPage) + } + (*TPCache)(unsafe.Pointer(pCache)).FnRefSum++ + (*TPgHdr)(unsafe.Pointer(pPgHdr)).FnRef++ + return pPgHdr +} + +// C documentation +// +// /* +// ** Decrement the reference count on a page. If the page is clean and the +// ** reference count drops to 0, then it is made eligible for recycling. +// */ +func _sqlite3PcacheRelease(tls *libc.TLS, p uintptr) { + var v1 Ti64 + var v2 uintptr + _, _ = v1, v2 + (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum-- + v2 = p + 56 + *(*Ti64)(unsafe.Pointer(v2))-- + v1 = *(*Ti64)(unsafe.Pointer(v2)) + if v1 == 0 { + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_CLEAN) != 0 { + _pcacheUnpin(tls, p) + } else { + _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) + } + } +} + +// C documentation +// +// /* +// ** Increase the reference count of a supplied page by 1. +// */ +func _sqlite3PcacheRef(tls *libc.TLS, p uintptr) { + (*TPgHdr)(unsafe.Pointer(p)).FnRef++ + (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum++ +} + +// C documentation +// +// /* +// ** Drop a page from the cache. There must be exactly one reference to the +// ** page. This function deletes that reference, so after it returns the +// ** page pointed to by p is invalid. +// */ +func _sqlite3PcacheDrop(tls *libc.TLS, p uintptr) { + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_DIRTY) != 0 { + _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) + } + (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum-- + (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxUnpin})))(tls, (*TPCache)(unsafe.Pointer((*TPgHdr)(unsafe.Pointer(p)).FpCache)).FpCache, (*TPgHdr)(unsafe.Pointer(p)).FpPage, int32(1)) +} + +// C documentation +// +// /* +// ** Make sure the page is marked as dirty. If it isn't dirty already, +// ** make it so. +// */ +func _sqlite3PcacheMakeDirty(tls *libc.TLS, p uintptr) { + var p1, p2 uintptr + _, _ = p1, p2 + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(PGHDR_CLEAN)|libc.Int32FromInt32(PGHDR_DONT_WRITE)) != 0 { /*OPTIMIZATION-IF-FALSE*/ + p1 = p + 52 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(PGHDR_DONT_WRITE)) + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_CLEAN) != 0 { + p2 = p + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) ^ (libc.Int32FromInt32(PGHDR_DIRTY) | libc.Int32FromInt32(PGHDR_CLEAN))) + _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_ADD)) + } + } +} + +// C documentation +// +// /* +// ** Make sure the page is marked as clean. If it isn't clean already, +// ** make it so. +// */ +func _sqlite3PcacheMakeClean(tls *libc.TLS, p uintptr) { + var p1, p2 uintptr + _, _ = p1, p2 + _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) + p1 = p + 52 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(PGHDR_DIRTY) | libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) + p2 = p + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PGHDR_CLEAN)) + if (*TPgHdr)(unsafe.Pointer(p)).FnRef == 0 { + _pcacheUnpin(tls, p) + } +} + +// C documentation +// +// /* +// ** Make every page in the cache clean. +// */ +func _sqlite3PcacheCleanAll(tls *libc.TLS, pCache uintptr) { + var p, v1 uintptr + _, _ = p, v1 + for { + v1 = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + p = v1 + if !(v1 != uintptr(0)) { + break + } + _sqlite3PcacheMakeClean(tls, p) + } +} + +// C documentation +// +// /* +// ** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages. +// */ +func _sqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { + var p, p2 uintptr + _, _ = p, p2 + p = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + for { + if !(p != 0) { + break + } + p2 = p + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(PGHDR_NEED_SYNC) | libc.Int32FromInt32(PGHDR_WRITEABLE))) + goto _1 + _1: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext + } + (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail +} + +// C documentation +// +// /* +// ** Clear the PGHDR_NEED_SYNC flag from all dirty pages. +// */ +func _sqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { + var p, p2 uintptr + _, _ = p, p2 + p = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + for { + if !(p != 0) { + break + } + p2 = p + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) + goto _1 + _1: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext + } + (*TPCache)(unsafe.Pointer(pCache)).FpSynced = (*TPCache)(unsafe.Pointer(pCache)).FpDirtyTail +} + +// C documentation +// +// /* +// ** Change the page number of page p to newPgno. +// */ +func _sqlite3PcacheMove(tls *libc.TLS, p uintptr, newPgno TPgno) { + var pCache, pOther, pXPage uintptr + _, _, _ = pCache, pOther, pXPage + pCache = (*TPgHdr)(unsafe.Pointer(p)).FpCache + pOther = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, newPgno, 0) + if pOther != 0 { + pXPage = (*Tsqlite3_pcache_page)(unsafe.Pointer(pOther)).FpExtra + (*TPgHdr)(unsafe.Pointer(pXPage)).FnRef++ + (*TPCache)(unsafe.Pointer(pCache)).FnRefSum++ + _sqlite3PcacheDrop(tls, pXPage) + } + (*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxRekey})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, (*TPgHdr)(unsafe.Pointer(p)).FpPage, (*TPgHdr)(unsafe.Pointer(p)).Fpgno, newPgno) + (*TPgHdr)(unsafe.Pointer(p)).Fpgno = newPgno + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_DIRTY) != 0 && int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_NEED_SYNC) != 0 { + _pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) + } +} + +// C documentation +// +// /* +// ** Drop every cache entry whose page number is greater than "pgno". The +// ** caller must ensure that there are no outstanding references to any pages +// ** other than page 1 with a page number greater than pgno. +// ** +// ** If there is a reference to page 1 and the pgno parameter passed to this +// ** function is 0, then the data area associated with page 1 is zeroed, but +// ** the page object is not dropped. +// */ +func _sqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno TPgno) { + var p, pNext, pPage1 uintptr + _, _, _ = p, pNext, pPage1 + if (*TPCache)(unsafe.Pointer(pCache)).FpCache != 0 { + p = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + for { + if !(p != 0) { + break + } + pNext = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext + /* This routine never gets call with a positive pgno except right + ** after sqlite3PcacheCleanAll(). So if there are dirty pages, + ** it must be that pgno==0. + */ + if (*TPgHdr)(unsafe.Pointer(p)).Fpgno > pgno { + _sqlite3PcacheMakeClean(tls, p) + } + goto _1 + _1: + ; + p = pNext + } + if pgno == uint32(0) && (*TPCache)(unsafe.Pointer(pCache)).FnRefSum != 0 { + pPage1 = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxFetch})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, uint32(1), 0) + if pPage1 != 0 { /* Page 1 is always available in cache, because + ** pCache->nRefSum>0 */ + libc.Xmemset(tls, (*Tsqlite3_pcache_page)(unsafe.Pointer(pPage1)).FpBuf, 0, uint64((*TPCache)(unsafe.Pointer(pCache)).FszPage)) + pgno = uint32(1) + } + } + (*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxTruncate})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, pgno+uint32(1)) + } +} + +// C documentation +// +// /* +// ** Close a cache. +// */ +func _sqlite3PcacheClose(tls *libc.TLS, pCache uintptr) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxDestroy})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) +} + +// C documentation +// +// /* +// ** Discard the contents of the cache. +// */ +func _sqlite3PcacheClear(tls *libc.TLS, pCache uintptr) { + _sqlite3PcacheTruncate(tls, pCache, uint32(0)) +} + +// C documentation +// +// /* +// ** Merge two lists of pages connected by pDirty and in pgno order. +// ** Do not bother fixing the pDirtyPrev pointers. +// */ +func _pcacheMergeDirtyList(tls *libc.TLS, pA uintptr, pB uintptr) (r uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var pTail uintptr + var _ /* result at bp+0 */ TPgHdr + _ = pTail + pTail = bp + for { + if (*TPgHdr)(unsafe.Pointer(pA)).Fpgno < (*TPgHdr)(unsafe.Pointer(pB)).Fpgno { + (*TPgHdr)(unsafe.Pointer(pTail)).FpDirty = pA + pTail = pA + pA = (*TPgHdr)(unsafe.Pointer(pA)).FpDirty + if pA == uintptr(0) { + (*TPgHdr)(unsafe.Pointer(pTail)).FpDirty = pB + break + } + } else { + (*TPgHdr)(unsafe.Pointer(pTail)).FpDirty = pB + pTail = pB + pB = (*TPgHdr)(unsafe.Pointer(pB)).FpDirty + if pB == uintptr(0) { + (*TPgHdr)(unsafe.Pointer(pTail)).FpDirty = pA + break + } + } + goto _1 + _1: + } + return (*(*TPgHdr)(unsafe.Pointer(bp))).FpDirty +} + +// C documentation +// +// /* +// ** Sort the list of pages in ascending order by pgno. Pages are +// ** connected by pDirty pointers. The pDirtyPrev pointers are +// ** corrupted by this sort. +// ** +// ** Since there cannot be more than 2^31 distinct pages in a database, +// ** there cannot be more than 31 buckets required by the merge sorter. +// ** One extra bucket is added to catch overflow in case something +// ** ever changes to make the previous sentence incorrect. +// */ +func _pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) (r uintptr) { + bp := tls.Alloc(256) + defer tls.Free(256) + var i int32 + var p, v3 uintptr + var _ /* a at bp+0 */ [32]uintptr + _, _, _ = i, p, v3 + libc.Xmemset(tls, bp, 0, uint64(256)) + for pIn != 0 { + p = pIn + pIn = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + (*TPgHdr)(unsafe.Pointer(p)).FpDirty = uintptr(0) + i = 0 + for { + if !(i < libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1)) { + break + } + if (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] == uintptr(0) { + (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] = p + break + } else { + p = _pcacheMergeDirtyList(tls, (*(*[32]uintptr)(unsafe.Pointer(bp)))[i], p) + (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) + } + goto _1 + _1: + ; + i++ + } + if i == libc.Int32FromInt32(N_SORT_BUCKET)-libc.Int32FromInt32(1) { + /* To get here, there need to be 2^(N_SORT_BUCKET) elements in + ** the input list. But that is impossible. + */ + (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] = _pcacheMergeDirtyList(tls, (*(*[32]uintptr)(unsafe.Pointer(bp)))[i], p) + } + } + p = (*(*[32]uintptr)(unsafe.Pointer(bp)))[0] + i = int32(1) + for { + if !(i < int32(N_SORT_BUCKET)) { + break + } + if (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] == uintptr(0) { + goto _2 + } + if p != 0 { + v3 = _pcacheMergeDirtyList(tls, p, (*(*[32]uintptr)(unsafe.Pointer(bp)))[i]) + } else { + v3 = (*(*[32]uintptr)(unsafe.Pointer(bp)))[i] + } + p = v3 + goto _2 + _2: + ; + i++ + } + return p +} + +// C documentation +// +// /* +// ** Return a list of all dirty pages in the cache, sorted by page number. +// */ +func _sqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) (r uintptr) { + var p uintptr + _ = p + p = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + for { + if !(p != 0) { + break + } + (*TPgHdr)(unsafe.Pointer(p)).FpDirty = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext + goto _1 + _1: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirtyNext + } + return _pcacheSortDirtyList(tls, (*TPCache)(unsafe.Pointer(pCache)).FpDirty) +} + +// C documentation +// +// /* +// ** Return the total number of references to all pages held by the cache. +// ** +// ** This is not the total number of pages referenced, but the sum of the +// ** reference count for all pages. +// */ +func _sqlite3PcacheRefCount(tls *libc.TLS, pCache uintptr) (r Ti64) { + return (*TPCache)(unsafe.Pointer(pCache)).FnRefSum +} + +// C documentation +// +// /* +// ** Return the number of references to the page supplied as an argument. +// */ +func _sqlite3PcachePageRefcount(tls *libc.TLS, p uintptr) (r Ti64) { + return (*TPgHdr)(unsafe.Pointer(p)).FnRef +} + +// C documentation +// +// /* +// ** Return the total number of pages in the cache. +// */ +func _sqlite3PcachePagecount(tls *libc.TLS, pCache uintptr) (r int32) { + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxPagecount})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) +} + +// C documentation +// +// /* +// ** Set the suggested cache-size value. +// */ +func _sqlite3PcacheSetCachesize(tls *libc.TLS, pCache uintptr, mxPage int32) { + (*TPCache)(unsafe.Pointer(pCache)).FszCache = mxPage + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxCachesize})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache, _numberOfCachePages(tls, pCache)) +} + +// C documentation +// +// /* +// ** Set the suggested cache-spill value. Make no changes if if the +// ** argument is zero. Return the effective cache-spill size, which will +// ** be the larger of the szSpill and szCache. +// */ +func _sqlite3PcacheSetSpillsize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) { + var res int32 + _ = res + if mxPage != 0 { + if mxPage < 0 { + mxPage = int32(int64(-libc.Int32FromInt32(1024)) * int64(mxPage) / int64((*TPCache)(unsafe.Pointer(p)).FszPage+(*TPCache)(unsafe.Pointer(p)).FszExtra)) + } + (*TPCache)(unsafe.Pointer(p)).FszSpill = mxPage + } + res = _numberOfCachePages(tls, p) + if res < (*TPCache)(unsafe.Pointer(p)).FszSpill { + res = (*TPCache)(unsafe.Pointer(p)).FszSpill + } + return res +} + +// C documentation +// +// /* +// ** Free up as much memory as possible from the page cache. +// */ +func _sqlite3PcacheShrink(tls *libc.TLS, pCache uintptr) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{_sqlite3Config.Fpcache2.FxShrink})))(tls, (*TPCache)(unsafe.Pointer(pCache)).FpCache) +} + +// C documentation +// +// /* +// ** Return the size of the header added by this middleware layer +// ** in the page-cache hierarchy. +// */ +func _sqlite3HeaderSizePcache(tls *libc.TLS) (r int32) { + return int32((libc.Uint64FromInt64(80) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) +} + +// C documentation +// +// /* +// ** Return the number of dirty pages currently in the cache, as a percentage +// ** of the configured cache size. +// */ +func _sqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) (r int32) { + var nCache, nDirty, v2 int32 + var pDirty uintptr + _, _, _, _ = nCache, nDirty, pDirty, v2 + nDirty = 0 + nCache = _numberOfCachePages(tls, pCache) + pDirty = (*TPCache)(unsafe.Pointer(pCache)).FpDirty + for { + if !(pDirty != 0) { + break + } + nDirty++ + goto _1 + _1: + ; + pDirty = (*TPgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext + } + if nCache != 0 { + v2 = int32(int64(nDirty) * libc.Int64FromInt32(100) / int64(nCache)) + } else { + v2 = 0 + } + return v2 +} + +// C documentation +// +// /* +// ** Return true if there are one or more dirty pages in the cache. Else false. +// */ +func _sqlite3PCacheIsDirty(tls *libc.TLS, pCache uintptr) (r int32) { + return libc.BoolInt32((*TPCache)(unsafe.Pointer(pCache)).FpDirty != uintptr(0)) +} + +/************** End of pcache.c **********************************************/ +/************** Begin file pcache1.c *****************************************/ +/* +** 2008 November 05 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file implements the default page cache implementation (the +** sqlite3_pcache interface). It also contains part of the implementation +** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. +** If the default page cache implementation is overridden, then neither of +** these two features are available. +** +** A Page cache line looks like this: +** +** ------------------------------------------------------------- +** | database page content | PgHdr1 | MemPage | PgHdr | +** ------------------------------------------------------------- +** +** The database page content is up front (so that buffer overreads tend to +** flow harmlessly into the PgHdr1, MemPage, and PgHdr extensions). MemPage +** is the extension added by the btree.c module containing information such +** as the database page number and how that database page is used. PgHdr +** is added by the pcache.c layer and contains information used to keep track +** of which pages are "dirty". PgHdr1 is an extension added by this +** module (pcache1.c). The PgHdr1 header is a subclass of sqlite3_pcache_page. +** PgHdr1 contains information needed to look up a page by its page number. +** The superclass sqlite3_pcache_page.pBuf points to the start of the +** database page content and sqlite3_pcache_page.pExtra points to PgHdr. +** +** The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at +** runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The +** sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this +** size can vary according to architecture, compile-time options, and +** SQLite library version number. +** +** Historical note: It used to be that if the SQLITE_PCACHE_SEPARATE_HEADER +** was defined, then the page content would be held in a separate memory +** allocation from the PgHdr1. This was intended to avoid clownshoe memory +** allocations. However, the btree layer needs a small (16-byte) overrun +** area after the page content buffer. The header serves as that overrun +** area. Therefore SQLITE_PCACHE_SEPARATE_HEADER was discontinued to avoid +** any possibility of a memory error. +** +** This module tracks pointers to PgHdr1 objects. Only pcache.c communicates +** with this module. Information is passed back and forth as PgHdr1 pointers. +** +** The pcache.c and pager.c modules deal pointers to PgHdr objects. +** The btree.c module deals with pointers to MemPage objects. +** +** SOURCE OF PAGE CACHE MEMORY: +** +** Memory for a page might come from any of three sources: +** +** (1) The general-purpose memory allocator - sqlite3Malloc() +** (2) Global page-cache memory provided using sqlite3_config() with +** SQLITE_CONFIG_PAGECACHE. +** (3) PCache-local bulk allocation. +** +** The third case is a chunk of heap memory (defaulting to 100 pages worth) +** that is allocated when the page cache is created. The size of the local +** bulk allocation can be adjusted using +** +** sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N). +** +** If N is positive, then N pages worth of memory are allocated using a single +** sqlite3Malloc() call and that memory is used for the first N pages allocated. +** Or if N is negative, then -1024*N bytes of memory are allocated and used +** for as many pages as can be accommodated. +** +** Only one of (2) or (3) can be used. Once the memory available to (2) or +** (3) is exhausted, subsequent allocations fail over to the general-purpose +** memory allocator (1). +** +** Earlier versions of SQLite used only methods (1) and (2). But experiments +** show that method (3) with N==100 provides about a 5% performance boost for +** common workloads. + */ +/* #include "sqliteInt.h" */ + +type TPCache1 = struct { + FpGroup uintptr + FpnPurgeable uintptr + FszPage int32 + FszExtra int32 + FszAlloc int32 + FbPurgeable int32 + FnMin uint32 + FnMax uint32 + Fn90pct uint32 + FiMaxKey uint32 + FnPurgeableDummy uint32 + FnRecyclable uint32 + FnPage uint32 + FnHash uint32 + FapHash uintptr + FpFree uintptr + FpBulk uintptr +} + +type PCache1 = TPCache1 + +type TPgHdr1 = struct { + Fpage Tsqlite3_pcache_page + FiKey uint32 + FisBulkLocal Tu16 + FisAnchor Tu16 + FpNext uintptr + FpCache uintptr + FpLruNext uintptr + FpLruPrev uintptr +} + +type PgHdr1 = TPgHdr1 + +type TPgFreeslot = struct { + FpNext uintptr +} + +type PgFreeslot = TPgFreeslot + +type TPGroup = struct { + Fmutex uintptr + FnMaxPage uint32 + FnMinPage uint32 + FmxPinned uint32 + FnPurgeable uint32 + Flru TPgHdr1 +} + +type PGroup = TPGroup + +/* +** Each cache entry is represented by an instance of the following +** structure. A buffer of PgHdr1.pCache->szPage bytes is allocated +** directly before this structure and is used to cache the page content. +** +** When reading a corrupt database file, it is possible that SQLite might +** read a few bytes (no more than 16 bytes) past the end of the page buffer. +** It will only read past the end of the page buffer, never write. This +** object is positioned immediately after the page buffer to serve as an +** overrun area, so that overreads are harmless. +** +** Variables isBulkLocal and isAnchor were once type "u8". That works, +** but causes a 2-byte gap in the structure for most architectures (since +** pointers must be either 4 or 8-byte aligned). As this structure is located +** in memory directly after the associated page data, if the database is +** corrupt, code at the b-tree layer may overread the page buffer and +** read part of this structure before the corruption is detected. This +** can cause a valgrind error if the uninitialized gap is accessed. Using u16 +** ensures there is no such gap, and therefore no bytes of uninitialized +** memory in the structure. +** +** The pLruNext and pLruPrev pointers form a double-linked circular list +** of all pages that are unpinned. The PGroup.lru element (which should be +** the only element on the list with PgHdr1.isAnchor set to 1) forms the +** beginning and the end of the list. + */ +type TPgHdr11 = struct { + Fpage Tsqlite3_pcache_page + FiKey uint32 + FisBulkLocal Tu16 + FisAnchor Tu16 + FpNext uintptr + FpCache uintptr + FpLruNext uintptr + FpLruPrev uintptr +} + +type PgHdr11 = TPgHdr11 + +/* +** A page is pinned if it is not on the LRU list. To be "pinned" means +** that the page is in active use and must not be deallocated. + */ + +/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set +** of one or more PCaches that are able to recycle each other's unpinned +** pages when they are under memory pressure. A PGroup is an instance of +** the following object. +** +** This page cache implementation works in one of two modes: +** +** (1) Every PCache is the sole member of its own PGroup. There is +** one PGroup per PCache. +** +** (2) There is a single global PGroup that all PCaches are a member +** of. +** +** Mode 1 uses more memory (since PCache instances are not able to rob +** unused pages from other PCaches) but it also operates without a mutex, +** and is therefore often faster. Mode 2 requires a mutex in order to be +** threadsafe, but recycles pages more efficiently. +** +** For mode (1), PGroup.mutex is NULL. For mode (2) there is only a single +** PGroup which is the pcache1.grp global variable and its mutex is +** SQLITE_MUTEX_STATIC_LRU. + */ +type TPGroup1 = struct { + Fmutex uintptr + FnMaxPage uint32 + FnMinPage uint32 + FmxPinned uint32 + FnPurgeable uint32 + Flru TPgHdr1 +} + +type PGroup1 = TPGroup1 + +/* Each page cache is an instance of the following object. Every +** open database file (including each in-memory database and each +** temporary or transient database) has a single page cache which +** is an instance of this object. +** +** Pointers to structures of this type are cast and returned as +** opaque sqlite3_pcache* handles. + */ +type TPCache11 = struct { + FpGroup uintptr + FpnPurgeable uintptr + FszPage int32 + FszExtra int32 + FszAlloc int32 + FbPurgeable int32 + FnMin uint32 + FnMax uint32 + Fn90pct uint32 + FiMaxKey uint32 + FnPurgeableDummy uint32 + FnRecyclable uint32 + FnPage uint32 + FnHash uint32 + FapHash uintptr + FpFree uintptr + FpBulk uintptr +} + +type PCache11 = TPCache11 + +/* +** Free slots in the allocator used to divide up the global page cache +** buffer provided using the SQLITE_CONFIG_PAGECACHE mechanism. + */ +type TPgFreeslot1 = struct { + FpNext uintptr +} + +type PgFreeslot1 = TPgFreeslot1 + +// C documentation +// +// /* +// ** Global data used by this cache. +// */ +type TPCacheGlobal = struct { + Fgrp TPGroup + FisInit int32 + FseparateCache int32 + FnInitPage int32 + FszSlot int32 + FnSlot int32 + FnReserve int32 + FpStart uintptr + FpEnd uintptr + Fmutex uintptr + FpFree uintptr + FnFreeSlot int32 + FbUnderPressure int32 +} + +type PCacheGlobal = TPCacheGlobal + +// C documentation +// +// /* +// ** Global data used by this cache. +// */ +var _pcache1_g TPCacheGlobal + +/* +** All code in this file should access the global structure above via the +** alias "pcache1". This ensures that the WSD emulation is used when +** compiling for systems that do not support real WSD. + */ + +/* +** Macros to enter and leave the PCache LRU mutex. + */ + +/******************************************************************************/ +/******** Page Allocation/SQLITE_CONFIG_PCACHE Related Functions **************/ + +// C documentation +// +// /* +// ** This function is called during initialization if a static buffer is +// ** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE +// ** verb to sqlite3_config(). Parameter pBuf points to an allocation large +// ** enough to contain 'n' buffers of 'sz' bytes each. +// ** +// ** This routine is called from sqlite3_initialize() and so it is guaranteed +// ** to be serialized already. There is no need for further mutexing. +// */ +func _sqlite3PCacheBufferSetup(tls *libc.TLS, pBuf uintptr, sz int32, n int32) { + var p uintptr + var v1, v2, v3, v4 int32 + _, _, _, _, _ = p, v1, v2, v3, v4 + if _pcache1_g.FisInit != 0 { + if pBuf == uintptr(0) { + v1 = libc.Int32FromInt32(0) + n = v1 + sz = v1 + } + if n == 0 { + sz = 0 + } + sz = sz & ^libc.Int32FromInt32(7) + _pcache1_g.FszSlot = sz + v2 = n + _pcache1_g.FnFreeSlot = v2 + _pcache1_g.FnSlot = v2 + if n > int32(90) { + v3 = int32(10) + } else { + v3 = n/int32(10) + int32(1) + } + _pcache1_g.FnReserve = v3 + _pcache1_g.FpStart = pBuf + _pcache1_g.FpFree = uintptr(0) + _pcache1_g.FbUnderPressure = 0 + for { + v4 = n + n-- + if !(v4 != 0) { + break + } + p = pBuf + (*TPgFreeslot)(unsafe.Pointer(p)).FpNext = _pcache1_g.FpFree + _pcache1_g.FpFree = p + pBuf = pBuf + uintptr(sz) + } + _pcache1_g.FpEnd = pBuf + } +} + +// C documentation +// +// /* +// ** Try to initialize the pCache->pFree and pCache->pBulk fields. Return +// ** true if pCache->pFree ends up containing one or more free pages. +// */ +func _pcache1InitBulk(tls *libc.TLS, pCache uintptr) (r int32) { + var nBulk, v2 int32 + var pX, zBulk, v1 uintptr + var szBulk Ti64 + _, _, _, _, _, _ = nBulk, pX, szBulk, zBulk, v1, v2 + if _pcache1_g.FnInitPage == 0 { + return 0 + } + /* Do not bother with a bulk allocation if the cache size very small */ + if (*TPCache1)(unsafe.Pointer(pCache)).FnMax < uint32(3) { + return 0 + } + _sqlite3BeginBenignMalloc(tls) + if _pcache1_g.FnInitPage > 0 { + szBulk = int64((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) * int64(_pcache1_g.FnInitPage) + } else { + szBulk = int64(-int32(1024)) * int64(_pcache1_g.FnInitPage) + } + if szBulk > int64((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc)*int64((*TPCache1)(unsafe.Pointer(pCache)).FnMax) { + szBulk = int64((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) * int64((*TPCache1)(unsafe.Pointer(pCache)).FnMax) + } + v1 = _sqlite3Malloc(tls, uint64(szBulk)) + (*TPCache1)(unsafe.Pointer(pCache)).FpBulk = v1 + zBulk = v1 + _sqlite3EndBenignMalloc(tls) + if zBulk != 0 { + nBulk = _sqlite3MallocSize(tls, zBulk) / (*TPCache1)(unsafe.Pointer(pCache)).FszAlloc + for { + pX = zBulk + uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszPage) + (*TPgHdr1)(unsafe.Pointer(pX)).Fpage.FpBuf = zBulk + (*TPgHdr1)(unsafe.Pointer(pX)).Fpage.FpExtra = pX + 1*56 + (*TPgHdr1)(unsafe.Pointer(pX)).FisBulkLocal = uint16(1) + (*TPgHdr1)(unsafe.Pointer(pX)).FisAnchor = uint16(0) + (*TPgHdr1)(unsafe.Pointer(pX)).FpNext = (*TPCache1)(unsafe.Pointer(pCache)).FpFree + (*TPgHdr1)(unsafe.Pointer(pX)).FpLruPrev = uintptr(0) /* Initializing this saves a valgrind error */ + (*TPCache1)(unsafe.Pointer(pCache)).FpFree = pX + zBulk += uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) + goto _3 + _3: + ; + nBulk-- + v2 = nBulk + if !(v2 != 0) { + break + } + } + } + return libc.BoolInt32((*TPCache1)(unsafe.Pointer(pCache)).FpFree != uintptr(0)) +} + +// C documentation +// +// /* +// ** Malloc function used within this file to allocate space from the buffer +// ** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no +// ** such buffer exists or there is no space left in it, this function falls +// ** back to sqlite3Malloc(). +// ** +// ** Multiple threads can run this routine at the same time. Global variables +// ** in pcache1 need to be protected via mutex. +// */ +func _pcache1Alloc(tls *libc.TLS, nByte int32) (r uintptr) { + var p uintptr + var sz int32 + _, _ = p, sz + p = uintptr(0) + if nByte <= _pcache1_g.FszSlot { + Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) + p = _pcache1_g.FpFree + if p != 0 { + _pcache1_g.FpFree = (*TPgFreeslot)(unsafe.Pointer(_pcache1_g.FpFree)).FpNext + _pcache1_g.FnFreeSlot-- + _pcache1_g.FbUnderPressure = libc.BoolInt32(_pcache1_g.FnFreeSlot < _pcache1_g.FnReserve) + _sqlite3StatusHighwater(tls, int32(SQLITE_STATUS_PAGECACHE_SIZE), nByte) + _sqlite3StatusUp(tls, int32(SQLITE_STATUS_PAGECACHE_USED), int32(1)) + } + Xsqlite3_mutex_leave(tls, _pcache1_g.Fmutex) + } + if p == uintptr(0) { + /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get + ** it from sqlite3Malloc instead. + */ + p = _sqlite3Malloc(tls, uint64(nByte)) + if p != 0 { + sz = _sqlite3MallocSize(tls, p) + Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) + _sqlite3StatusHighwater(tls, int32(SQLITE_STATUS_PAGECACHE_SIZE), nByte) + _sqlite3StatusUp(tls, int32(SQLITE_STATUS_PAGECACHE_OVERFLOW), sz) + Xsqlite3_mutex_leave(tls, _pcache1_g.Fmutex) + } + } + return p +} + +// C documentation +// +// /* +// ** Free an allocated buffer obtained from pcache1Alloc(). +// */ +func _pcache1Free(tls *libc.TLS, p uintptr) { + var nFreed int32 + var pSlot uintptr + _, _ = nFreed, pSlot + if p == uintptr(0) { + return + } + if uint64(p) >= uint64(_pcache1_g.FpStart) && uint64(p) < uint64(_pcache1_g.FpEnd) { + Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) + _sqlite3StatusDown(tls, int32(SQLITE_STATUS_PAGECACHE_USED), int32(1)) + pSlot = p + (*TPgFreeslot)(unsafe.Pointer(pSlot)).FpNext = _pcache1_g.FpFree + _pcache1_g.FpFree = pSlot + _pcache1_g.FnFreeSlot++ + _pcache1_g.FbUnderPressure = libc.BoolInt32(_pcache1_g.FnFreeSlot < _pcache1_g.FnReserve) + Xsqlite3_mutex_leave(tls, _pcache1_g.Fmutex) + } else { + nFreed = 0 + nFreed = _sqlite3MallocSize(tls, p) + Xsqlite3_mutex_enter(tls, _pcache1_g.Fmutex) + _sqlite3StatusDown(tls, int32(SQLITE_STATUS_PAGECACHE_OVERFLOW), nFreed) + Xsqlite3_mutex_leave(tls, _pcache1_g.Fmutex) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Return the size of a pcache allocation +// */ +func _pcache1MemSize(tls *libc.TLS, p uintptr) (r int32) { + var iSize int32 + _ = iSize + if p >= _pcache1_g.FpStart && p < _pcache1_g.FpEnd { + return _pcache1_g.FszSlot + } else { + iSize = _sqlite3MallocSize(tls, p) + return iSize + } + return r +} + +// C documentation +// +// /* +// ** Allocate a new page object initially associated with cache pCache. +// */ +func _pcache1AllocPage(tls *libc.TLS, pCache uintptr, benignMalloc int32) (r uintptr) { + var p, pPg uintptr + _, _ = p, pPg + p = uintptr(0) + if (*TPCache1)(unsafe.Pointer(pCache)).FpFree != 0 || (*TPCache1)(unsafe.Pointer(pCache)).FnPage == uint32(0) && _pcache1InitBulk(tls, pCache) != 0 { + p = (*TPCache1)(unsafe.Pointer(pCache)).FpFree + (*TPCache1)(unsafe.Pointer(pCache)).FpFree = (*TPgHdr1)(unsafe.Pointer(p)).FpNext + (*TPgHdr1)(unsafe.Pointer(p)).FpNext = uintptr(0) + } else { + /* The group mutex must be released before pcache1Alloc() is called. This + ** is because it might call sqlite3_release_memory(), which assumes that + ** this mutex is not held. */ + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if benignMalloc != 0 { + _sqlite3BeginBenignMalloc(tls) + } + pPg = _pcache1Alloc(tls, (*TPCache1)(unsafe.Pointer(pCache)).FszAlloc) + if benignMalloc != 0 { + _sqlite3EndBenignMalloc(tls) + } + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if pPg == uintptr(0) { + return uintptr(0) + } + p = pPg + uintptr((*TPCache1)(unsafe.Pointer(pCache)).FszPage) + (*TPgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf = pPg + (*TPgHdr1)(unsafe.Pointer(p)).Fpage.FpExtra = p + 1*56 + (*TPgHdr1)(unsafe.Pointer(p)).FisBulkLocal = uint16(0) + (*TPgHdr1)(unsafe.Pointer(p)).FisAnchor = uint16(0) + (*TPgHdr1)(unsafe.Pointer(p)).FpLruPrev = uintptr(0) /* Initializing this saves a valgrind error */ + } + *(*uint32)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpnPurgeable))++ + return p +} + +// C documentation +// +// /* +// ** Free a page object allocated by pcache1AllocPage(). +// */ +func _pcache1FreePage(tls *libc.TLS, p uintptr) { + var pCache uintptr + _ = pCache + pCache = (*TPgHdr1)(unsafe.Pointer(p)).FpCache + if (*TPgHdr1)(unsafe.Pointer(p)).FisBulkLocal != 0 { + (*TPgHdr1)(unsafe.Pointer(p)).FpNext = (*TPCache1)(unsafe.Pointer(pCache)).FpFree + (*TPCache1)(unsafe.Pointer(pCache)).FpFree = p + } else { + _pcache1Free(tls, (*TPgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf) + } + *(*uint32)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpnPurgeable))-- +} + +// C documentation +// +// /* +// ** Malloc function used by SQLite to obtain space from the buffer configured +// ** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer +// ** exists, this function falls back to sqlite3Malloc(). +// */ +func _sqlite3PageMalloc(tls *libc.TLS, sz int32) (r uintptr) { + /* These allocations are never very large */ + return _pcache1Alloc(tls, sz) +} + +// C documentation +// +// /* +// ** Free an allocated buffer obtained from sqlite3PageMalloc(). +// */ +func _sqlite3PageFree(tls *libc.TLS, p uintptr) { + _pcache1Free(tls, p) +} + +// C documentation +// +// /* +// ** Return true if it desirable to avoid allocating a new page cache +// ** entry. +// ** +// ** If memory was allocated specifically to the page cache using +// ** SQLITE_CONFIG_PAGECACHE but that memory has all been used, then +// ** it is desirable to avoid allocating a new page cache entry because +// ** presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient +// ** for all page cache needs and we should not need to spill the +// ** allocation onto the heap. +// ** +// ** Or, the heap is used for all page cache memory but the heap is +// ** under memory pressure, then again it is desirable to avoid +// ** allocating a new page cache entry in order to avoid stressing +// ** the heap even further. +// */ +func _pcache1UnderMemoryPressure(tls *libc.TLS, pCache uintptr) (r int32) { + if _pcache1_g.FnSlot != 0 && (*TPCache1)(unsafe.Pointer(pCache)).FszPage+(*TPCache1)(unsafe.Pointer(pCache)).FszExtra <= _pcache1_g.FszSlot { + return _pcache1_g.FbUnderPressure + } else { + return _sqlite3HeapNearlyFull(tls) + } + return r +} + +/******************************************************************************/ +/******** General Implementation Functions ************************************/ + +// C documentation +// +// /* +// ** This function is used to resize the hash table used by the cache passed +// ** as the first argument. +// ** +// ** The PCache mutex must be held when this function is called. +// */ +func _pcache1ResizeHash(tls *libc.TLS, p uintptr) { + var apNew, pNext, pPage, v2 uintptr + var h, i, nNew uint32 + _, _, _, _, _, _, _ = apNew, h, i, nNew, pNext, pPage, v2 + nNew = (*TPCache1)(unsafe.Pointer(p)).FnHash * uint32(2) + if nNew < uint32(256) { + nNew = uint32(256) + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(p)).FpGroup)).Fmutex) + if (*TPCache1)(unsafe.Pointer(p)).FnHash != 0 { + _sqlite3BeginBenignMalloc(tls) + } + apNew = _sqlite3MallocZero(tls, uint64(8)*uint64(nNew)) + if (*TPCache1)(unsafe.Pointer(p)).FnHash != 0 { + _sqlite3EndBenignMalloc(tls) + } + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(p)).FpGroup)).Fmutex) + if apNew != 0 { + i = uint32(0) + for { + if !(i < (*TPCache1)(unsafe.Pointer(p)).FnHash) { + break + } + pNext = *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(p)).FapHash + uintptr(i)*8)) + for { + v2 = pNext + pPage = v2 + if !(v2 != uintptr(0)) { + break + } + h = (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey % nNew + pNext = (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext + (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(h)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(h)*8)) = pPage + } + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(p)).FapHash) + (*TPCache1)(unsafe.Pointer(p)).FapHash = apNew + (*TPCache1)(unsafe.Pointer(p)).FnHash = nNew + } +} + +// C documentation +// +// /* +// ** This function is used internally to remove the page pPage from the +// ** PGroup LRU list, if is part of it. If pPage is not part of the PGroup +// ** LRU list, then this function is a no-op. +// ** +// ** The PGroup mutex must be held when this function is called. +// */ +func _pcache1PinPage(tls *libc.TLS, pPage uintptr) (r uintptr) { + (*TPgHdr1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpLruPrev)).FpLruNext = (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext + (*TPgHdr1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext)).FpLruPrev = (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruPrev + (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext = uintptr(0) + /* pPage->pLruPrev = 0; + ** No need to clear pLruPrev as it is never accessed if pLruNext is 0 */ + (*TPCache1)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).FpCache)).FnRecyclable-- + return pPage +} + +// C documentation +// +// /* +// ** Remove the page supplied as an argument from the hash table +// ** (PCache1.apHash structure) that it is currently stored in. +// ** Also free the page if freePage is true. +// ** +// ** The PGroup mutex must be held when this function is called. +// */ +func _pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { + var h uint32 + var pCache, pp uintptr + _, _, _ = h, pCache, pp + pCache = (*TPgHdr1)(unsafe.Pointer(pPage)).FpCache + h = (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != pPage) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*TPCache1)(unsafe.Pointer(pCache)).FnPage-- + if freeFlag != 0 { + _pcache1FreePage(tls, pPage) + } +} + +// C documentation +// +// /* +// ** If there are currently more than nMaxPage pages allocated, try +// ** to recycle pages to reduce the number allocated to nMaxPage. +// */ +func _pcache1EnforceMaxPage(tls *libc.TLS, pCache uintptr) { + var p, pGroup, v1, v3 uintptr + var v2 bool + _, _, _, _, _ = p, pGroup, v1, v2, v3 + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + for { + if v2 = (*TPGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage; v2 { + v1 = (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev + p = v1 + } + if !(v2 && int32((*TPgHdr1)(unsafe.Pointer(v1)).FisAnchor) == 0) { + break + } + _pcache1PinPage(tls, p) + _pcache1RemoveFromHash(tls, p, int32(1)) + } + if (*TPCache1)(unsafe.Pointer(pCache)).FnPage == uint32(0) && (*TPCache1)(unsafe.Pointer(pCache)).FpBulk != 0 { + Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(pCache)).FpBulk) + v3 = libc.UintptrFromInt32(0) + (*TPCache1)(unsafe.Pointer(pCache)).FpFree = v3 + (*TPCache1)(unsafe.Pointer(pCache)).FpBulk = v3 + } +} + +// C documentation +// +// /* +// ** Discard all pages from cache pCache with a page number (key value) +// ** greater than or equal to iLimit. Any pinned pages that meet this +// ** criteria are unpinned before they are discarded. +// ** +// ** The PCache mutex must be held when this function is called. +// */ +func _pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { + var h, iStop uint32 + var pPage, pp, v2 uintptr + _, _, _, _, _ = h, iStop, pPage, pp, v2 + if (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey-iLimit < (*TPCache1)(unsafe.Pointer(pCache)).FnHash { + /* If we are just shaving the last few pages off the end of the + ** cache, then there is no point in scanning the entire hash table. + ** Only scan those hash slots that might contain pages that need to + ** be removed. */ + h = iLimit % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + iStop = (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + /* Disable the pCache->nPage validity check */ + } else { + /* This is the general case where many pages are being removed. + ** It is necessary to scan the entire hash table */ + h = (*TPCache1)(unsafe.Pointer(pCache)).FnHash / uint32(2) + iStop = h - uint32(1) + } + for { + pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8 + for { + v2 = *(*uintptr)(unsafe.Pointer(pp)) + pPage = v2 + if !(v2 != uintptr(0)) { + break + } + if (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey >= iLimit { + (*TPCache1)(unsafe.Pointer(pCache)).FnPage-- + *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext + if (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext != uintptr(0) { + _pcache1PinPage(tls, pPage) + } + _pcache1FreePage(tls, pPage) + } else { + pp = pPage + 24 + } + } + if h == iStop { + break + } + h = (h + uint32(1)) % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + goto _1 + _1: + } +} + +/******************************************************************************/ +/******** sqlite3_pcache Methods **********************************************/ + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xInit method. +// */ +func _pcache1Init(tls *libc.TLS, NotUsed uintptr) (r int32) { + _ = NotUsed + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_pcache1_g)), 0, uint64(144)) + /* + ** The pcache1.separateCache variable is true if each PCache has its own + ** private PGroup (mode-1). pcache1.separateCache is false if the single + ** PGroup in pcache1.grp is used for all page caches (mode-2). + ** + ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT + ** + ** * Use a unified cache in single-threaded applications that have + ** configured a start-time buffer for use as page-cache memory using + ** sqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL + ** pBuf argument. + ** + ** * Otherwise use separate caches (mode-1) + */ + _pcache1_g.FseparateCache = 0 + if _sqlite3Config.FbCoreMutex != 0 { + _pcache1_g.Fgrp.Fmutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_LRU)) + _pcache1_g.Fmutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_PMEM)) + } + if _pcache1_g.FseparateCache != 0 && _sqlite3Config.FnPage != 0 && _sqlite3Config.FpPage == uintptr(0) { + _pcache1_g.FnInitPage = _sqlite3Config.FnPage + } else { + _pcache1_g.FnInitPage = 0 + } + _pcache1_g.Fgrp.FmxPinned = uint32(10) + _pcache1_g.FisInit = int32(1) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xShutdown method. +// ** Note that the static mutex allocated in xInit does +// ** not need to be freed. +// */ +func _pcache1Shutdown(tls *libc.TLS, NotUsed uintptr) { + _ = NotUsed + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_pcache1_g)), 0, uint64(144)) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xCreate method. +// ** +// ** Allocate a new cache. +// */ +func _pcache1Create(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32) (r uintptr) { + var pCache, pGroup, v1 uintptr + var sz, v2 int32 + _, _, _, _, _ = pCache, pGroup, sz, v1, v2 /* Bytes of memory required to allocate the new cache */ + sz = int32(uint64(88) + uint64(80)*uint64(_pcache1_g.FseparateCache)) + pCache = _sqlite3MallocZero(tls, uint64(sz)) + if pCache != 0 { + if _pcache1_g.FseparateCache != 0 { + pGroup = pCache + 1*88 + (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned = uint32(10) + } else { + pGroup = uintptr(unsafe.Pointer(&_pcache1_g)) + } + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + if int32((*TPGroup)(unsafe.Pointer(pGroup)).Flru.FisAnchor) == 0 { + (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FisAnchor = uint16(1) + v1 = pGroup + 24 + (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruNext = v1 + (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev = v1 + } + (*TPCache1)(unsafe.Pointer(pCache)).FpGroup = pGroup + (*TPCache1)(unsafe.Pointer(pCache)).FszPage = szPage + (*TPCache1)(unsafe.Pointer(pCache)).FszExtra = szExtra + (*TPCache1)(unsafe.Pointer(pCache)).FszAlloc = int32(uint64(szPage+szExtra) + (libc.Uint64FromInt64(56)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + if bPurgeable != 0 { + v2 = int32(1) + } else { + v2 = 0 + } + (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable = v2 + _pcache1ResizeHash(tls, pCache) + if bPurgeable != 0 { + (*TPCache1)(unsafe.Pointer(pCache)).FnMin = uint32(10) + *(*uint32)(unsafe.Pointer(pGroup + 12)) += (*TPCache1)(unsafe.Pointer(pCache)).FnMin + (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned = (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10) - (*TPGroup)(unsafe.Pointer(pGroup)).FnMinPage + (*TPCache1)(unsafe.Pointer(pCache)).FpnPurgeable = pGroup + 20 + } else { + (*TPCache1)(unsafe.Pointer(pCache)).FpnPurgeable = pCache + 48 + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + if (*TPCache1)(unsafe.Pointer(pCache)).FnHash == uint32(0) { + _pcache1Destroy(tls, pCache) + pCache = uintptr(0) + } + } + return pCache +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xCachesize method. +// ** +// ** Configure the cache_size limit for a cache. +// */ +func _pcache1Cachesize(tls *libc.TLS, p uintptr, nMax int32) { + var n Tu32 + var pCache, pGroup uintptr + _, _, _ = n, pCache, pGroup + pCache = p + if (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 { + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + n = uint32(nMax) + if n > uint32(0x7fff0000)-(*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage+(*TPCache1)(unsafe.Pointer(pCache)).FnMax { + n = uint32(0x7fff0000) - (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + (*TPCache1)(unsafe.Pointer(pCache)).FnMax + } + *(*uint32)(unsafe.Pointer(pGroup + 8)) += n - (*TPCache1)(unsafe.Pointer(pCache)).FnMax + (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned = (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10) - (*TPGroup)(unsafe.Pointer(pGroup)).FnMinPage + (*TPCache1)(unsafe.Pointer(pCache)).FnMax = n + (*TPCache1)(unsafe.Pointer(pCache)).Fn90pct = (*TPCache1)(unsafe.Pointer(pCache)).FnMax * uint32(9) / uint32(10) + _pcache1EnforceMaxPage(tls, pCache) + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + } +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xShrink method. +// ** +// ** Free up as much memory as possible. +// */ +func _pcache1Shrink(tls *libc.TLS, p uintptr) { + var pCache, pGroup uintptr + var savedMaxPage uint32 + _, _, _ = pCache, pGroup, savedMaxPage + pCache = p + if (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 { + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + savedMaxPage = (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage = uint32(0) + _pcache1EnforceMaxPage(tls, pCache) + (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage = savedMaxPage + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + } +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xPagecount method. +// */ +func _pcache1Pagecount(tls *libc.TLS, p uintptr) (r int32) { + var n int32 + var pCache uintptr + _, _ = n, pCache + pCache = p + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + n = int32((*TPCache1)(unsafe.Pointer(pCache)).FnPage) + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + return n +} + +// C documentation +// +// /* +// ** Implement steps 3, 4, and 5 of the pcache1Fetch() algorithm described +// ** in the header of the pcache1Fetch() procedure. +// ** +// ** This steps are broken out into a separate procedure because they are +// ** usually not needed, and by avoiding the stack initialization required +// ** for these steps, the main pcache1Fetch() procedure can run faster. +// */ +func _pcache1FetchStage2(tls *libc.TLS, pCache uintptr, iKey uint32, createFlag int32) (r uintptr) { + var h, nPinned uint32 + var pGroup, pOther, pPage uintptr + _, _, _, _, _ = h, nPinned, pGroup, pOther, pPage + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + pPage = uintptr(0) + /* Step 3: Abort if createFlag is 1 but the cache is nearly full */ + nPinned = (*TPCache1)(unsafe.Pointer(pCache)).FnPage - (*TPCache1)(unsafe.Pointer(pCache)).FnRecyclable + if createFlag == int32(1) && (nPinned >= (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned || nPinned >= (*TPCache1)(unsafe.Pointer(pCache)).Fn90pct || _pcache1UnderMemoryPressure(tls, pCache) != 0 && (*TPCache1)(unsafe.Pointer(pCache)).FnRecyclable < nPinned) { + return uintptr(0) + } + if (*TPCache1)(unsafe.Pointer(pCache)).FnPage >= (*TPCache1)(unsafe.Pointer(pCache)).FnHash { + _pcache1ResizeHash(tls, pCache) + } + /* Step 4. Try to recycle a page. */ + if (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 && !((*TPgHdr1)(unsafe.Pointer((*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev)).FisAnchor != 0) && ((*TPCache1)(unsafe.Pointer(pCache)).FnPage+uint32(1) >= (*TPCache1)(unsafe.Pointer(pCache)).FnMax || _pcache1UnderMemoryPressure(tls, pCache) != 0) { + pPage = (*TPGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev + _pcache1RemoveFromHash(tls, pPage, 0) + _pcache1PinPage(tls, pPage) + pOther = (*TPgHdr1)(unsafe.Pointer(pPage)).FpCache + if (*TPCache1)(unsafe.Pointer(pOther)).FszAlloc != (*TPCache1)(unsafe.Pointer(pCache)).FszAlloc { + _pcache1FreePage(tls, pPage) + pPage = uintptr(0) + } else { + *(*uint32)(unsafe.Pointer(pGroup + 20)) -= uint32((*TPCache1)(unsafe.Pointer(pOther)).FbPurgeable - (*TPCache1)(unsafe.Pointer(pCache)).FbPurgeable) + } + } + /* Step 5. If a usable page buffer has still not been found, + ** attempt to allocate a new one. + */ + if !(pPage != 0) { + pPage = _pcache1AllocPage(tls, pCache, libc.BoolInt32(createFlag == int32(1))) + } + if pPage != 0 { + h = iKey % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + (*TPCache1)(unsafe.Pointer(pCache)).FnPage++ + (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey = iKey + (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) + (*TPgHdr1)(unsafe.Pointer(pPage)).FpCache = pCache + (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext = uintptr(0) + /* pPage->pLruPrev = 0; + ** No need to clear pLruPrev since it is not accessed when pLruNext==0 */ + *(*uintptr)(unsafe.Pointer((*TPgHdr1)(unsafe.Pointer(pPage)).Fpage.FpExtra)) = uintptr(0) + *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) = pPage + if iKey > (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey { + (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey = iKey + } + } + return pPage +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xFetch method. +// ** +// ** Fetch a page by key value. +// ** +// ** Whether or not a new page may be allocated by this function depends on +// ** the value of the createFlag argument. 0 means do not allocate a new +// ** page. 1 means allocate a new page if space is easily available. 2 +// ** means to try really hard to allocate a new page. +// ** +// ** For a non-purgeable cache (a cache used as the storage for an in-memory +// ** database) there is really no difference between createFlag 1 and 2. So +// ** the calling function (pcache.c) will never have a createFlag of 1 on +// ** a non-purgeable cache. +// ** +// ** There are three different approaches to obtaining space for a page, +// ** depending on the value of parameter createFlag (which may be 0, 1 or 2). +// ** +// ** 1. Regardless of the value of createFlag, the cache is searched for a +// ** copy of the requested page. If one is found, it is returned. +// ** +// ** 2. If createFlag==0 and the page is not already in the cache, NULL is +// ** returned. +// ** +// ** 3. If createFlag is 1, and the page is not already in the cache, then +// ** return NULL (do not allocate a new page) if any of the following +// ** conditions are true: +// ** +// ** (a) the number of pages pinned by the cache is greater than +// ** PCache1.nMax, or +// ** +// ** (b) the number of pages pinned by the cache is greater than +// ** the sum of nMax for all purgeable caches, less the sum of +// ** nMin for all other purgeable caches, or +// ** +// ** 4. If none of the first three conditions apply and the cache is marked +// ** as purgeable, and if one of the following is true: +// ** +// ** (a) The number of pages allocated for the cache is already +// ** PCache1.nMax, or +// ** +// ** (b) The number of pages allocated for all purgeable caches is +// ** already equal to or greater than the sum of nMax for all +// ** purgeable caches, +// ** +// ** (c) The system is under memory pressure and wants to avoid +// ** unnecessary pages cache entry allocations +// ** +// ** then attempt to recycle a page from the LRU list. If it is the right +// ** size, return the recycled buffer. Otherwise, free the buffer and +// ** proceed to step 5. +// ** +// ** 5. Otherwise, allocate and return a new page buffer. +// ** +// ** There are two versions of this routine. pcache1FetchWithMutex() is +// ** the general case. pcache1FetchNoMutex() is a faster implementation for +// ** the common case where pGroup->mutex is NULL. The pcache1Fetch() wrapper +// ** invokes the appropriate routine. +// */ +func _pcache1FetchNoMutex(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) (r uintptr) { + var pCache, pPage uintptr + _, _ = pCache, pPage + pCache = p + pPage = uintptr(0) + /* Step 1: Search the hash table for an existing entry. */ + pPage = *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(iKey%(*TPCache1)(unsafe.Pointer(pCache)).FnHash)*8)) + for pPage != 0 && (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey != iKey { + pPage = (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext + } + /* Step 2: If the page was found in the hash table, then return it. + ** If the page was not in the hash table and createFlag is 0, abort. + ** Otherwise (page not in hash and createFlag!=0) continue with + ** subsequent steps to try to create the page. */ + if pPage != 0 { + if (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext != uintptr(0) { + return _pcache1PinPage(tls, pPage) + } else { + return pPage + } + } else { + if createFlag != 0 { + /* Steps 3, 4, and 5 implemented by this subroutine */ + return _pcache1FetchStage2(tls, pCache, iKey, createFlag) + } else { + return uintptr(0) + } + } + return r +} + +func _pcache1FetchWithMutex(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) (r uintptr) { + var pCache, pPage uintptr + _, _ = pCache, pPage + pCache = p + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + pPage = _pcache1FetchNoMutex(tls, p, iKey, createFlag) + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + return pPage +} + +func _pcache1Fetch(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) (r uintptr) { + var pCache uintptr + _ = pCache + pCache = p + if (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex != 0 { + return _pcache1FetchWithMutex(tls, p, iKey, createFlag) + } else { + return _pcache1FetchNoMutex(tls, p, iKey, createFlag) + } + return r +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xUnpin method. +// ** +// ** Mark a page as unpinned (eligible for asynchronous recycling). +// */ +func _pcache1Unpin(tls *libc.TLS, p uintptr, pPg uintptr, reuseUnlikely int32) { + var pCache, pGroup, pPage, ppFirst, v1 uintptr + _, _, _, _, _ = pCache, pGroup, pPage, ppFirst, v1 + pCache = p + pPage = pPg + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + /* It is an error to call this function if the page is already + ** part of the PGroup LRU list. + */ + if reuseUnlikely != 0 || (*TPGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage { + _pcache1RemoveFromHash(tls, pPage, int32(1)) + } else { + /* Add the page to the PGroup LRU list. */ + ppFirst = pGroup + 24 + 40 + (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruPrev = pGroup + 24 + v1 = *(*uintptr)(unsafe.Pointer(ppFirst)) + (*TPgHdr1)(unsafe.Pointer(pPage)).FpLruNext = v1 + (*TPgHdr1)(unsafe.Pointer(v1)).FpLruPrev = pPage + *(*uintptr)(unsafe.Pointer(ppFirst)) = pPage + (*TPCache1)(unsafe.Pointer(pCache)).FnRecyclable++ + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xRekey method. +// */ +func _pcache1Rekey(tls *libc.TLS, p uintptr, pPg uintptr, iOld uint32, iNew uint32) { + var hNew, hOld uint32 + var pCache, pPage, pp uintptr + _, _, _, _, _ = hNew, hOld, pCache, pPage, pp + pCache = p + pPage = pPg + /* The page number really is changing */ + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + /* pPg really is iOld */ + hOld = iOld % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + pp = (*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(hOld)*8 + for *(*uintptr)(unsafe.Pointer(pp)) != pPage { + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext + /* iNew not in cache */ + hNew = iNew % (*TPCache1)(unsafe.Pointer(pCache)).FnHash + (*TPgHdr1)(unsafe.Pointer(pPage)).FiKey = iNew + (*TPgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(hNew)*8)) + *(*uintptr)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(hNew)*8)) = pPage + if iNew > (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey { + (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey = iNew + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xTruncate method. +// ** +// ** Discard all unpinned pages in the cache with a page number equal to +// ** or greater than parameter iLimit. Any pinned pages with a page number +// ** equal to or greater than iLimit are implicitly unpinned. +// */ +func _pcache1Truncate(tls *libc.TLS, p uintptr, iLimit uint32) { + var pCache uintptr + _ = pCache + pCache = p + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if iLimit <= (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey { + _pcache1TruncateUnsafe(tls, pCache, iLimit) + (*TPCache1)(unsafe.Pointer(pCache)).FiMaxKey = iLimit - uint32(1) + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer((*TPCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite3_pcache.xDestroy method. +// ** +// ** Destroy a cache allocated using pcache1Create(). +// */ +func _pcache1Destroy(tls *libc.TLS, p uintptr) { + var pCache, pGroup uintptr + _, _ = pCache, pGroup + pCache = p + pGroup = (*TPCache1)(unsafe.Pointer(pCache)).FpGroup + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + if (*TPCache1)(unsafe.Pointer(pCache)).FnPage != 0 { + _pcache1TruncateUnsafe(tls, pCache, uint32(0)) + } + *(*uint32)(unsafe.Pointer(pGroup + 8)) -= (*TPCache1)(unsafe.Pointer(pCache)).FnMax + *(*uint32)(unsafe.Pointer(pGroup + 12)) -= (*TPCache1)(unsafe.Pointer(pCache)).FnMin + (*TPGroup)(unsafe.Pointer(pGroup)).FmxPinned = (*TPGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10) - (*TPGroup)(unsafe.Pointer(pGroup)).FnMinPage + _pcache1EnforceMaxPage(tls, pCache) + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer(pGroup)).Fmutex) + Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(pCache)).FpBulk) + Xsqlite3_free(tls, (*TPCache1)(unsafe.Pointer(pCache)).FapHash) + Xsqlite3_free(tls, pCache) +} + +// C documentation +// +// /* +// ** This function is called during initialization (sqlite3_initialize()) to +// ** install the default pluggable cache module, assuming the user has not +// ** already provided an alternative. +// */ +func _sqlite3PCacheSetDefault(tls *libc.TLS) { + bp := tls.Alloc(16) + defer tls.Free(16) + Xsqlite3_config(tls, int32(SQLITE_CONFIG_PCACHE2), libc.VaList(bp+8, uintptr(unsafe.Pointer(&_defaultMethods1)))) +} + +var _defaultMethods1 = Tsqlite3_pcache_methods2{ + FiVersion: int32(1), +} + +func init() { + p := unsafe.Pointer(&_defaultMethods1) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_pcache1Init) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_pcache1Shutdown) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_pcache1Create) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_pcache1Cachesize) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_pcache1Pagecount) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_pcache1Fetch) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_pcache1Unpin) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_pcache1Rekey) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_pcache1Truncate) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_pcache1Destroy) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_pcache1Shrink) +} + +// C documentation +// +// /* +// ** Return the size of the header on each page of this PCACHE implementation. +// */ +func _sqlite3HeaderSizePcache1(tls *libc.TLS) (r int32) { + return int32((libc.Uint64FromInt64(56) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) +} + +// C documentation +// +// /* +// ** Return the global mutex used by this PCACHE implementation. The +// ** sqlite3_status() routine needs access to this mutex. +// */ +func _sqlite3Pcache1Mutex(tls *libc.TLS) (r uintptr) { + return _pcache1_g.Fmutex +} + +// C documentation +// +// /* +// ** This function is called to free superfluous dynamically allocated memory +// ** held by the pager system. Memory in use by any SQLite pager allocated +// ** by the current thread may be sqlite3_free()ed. +// ** +// ** nReq is the number of bytes of memory required. Once this much has +// ** been released, the function returns. The return value is the total number +// ** of bytes of memory released. +// */ +func _sqlite3PcacheReleaseMemory(tls *libc.TLS, nReq int32) (r int32) { + var nFree int32 + var p, v1 uintptr + var v2 bool + _, _, _, _ = nFree, p, v1, v2 + nFree = 0 + if _sqlite3Config.FpPage == uintptr(0) { + Xsqlite3_mutex_enter(tls, (*TPGroup)(unsafe.Pointer(uintptr(unsafe.Pointer(&_pcache1_g)))).Fmutex) + for { + if v2 = nReq < 0 || nFree < nReq; v2 { + v1 = _pcache1_g.Fgrp.Flru.FpLruPrev + p = v1 + } + if !(v2 && v1 != uintptr(0) && int32((*TPgHdr1)(unsafe.Pointer(p)).FisAnchor) == 0) { + break + } + nFree += _pcache1MemSize(tls, (*TPgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf) + _pcache1PinPage(tls, p) + _pcache1RemoveFromHash(tls, p, int32(1)) + } + Xsqlite3_mutex_leave(tls, (*TPGroup)(unsafe.Pointer(uintptr(unsafe.Pointer(&_pcache1_g)))).Fmutex) + } + return nFree +} + +/************** End of pcache1.c *********************************************/ +/************** Begin file rowset.c ******************************************/ +/* +** 2008 December 3 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This module implements an object we call a "RowSet". +** +** The RowSet object is a collection of rowids. Rowids +** are inserted into the RowSet in an arbitrary order. Inserts +** can be intermixed with tests to see if a given rowid has been +** previously inserted into the RowSet. +** +** After all inserts are finished, it is possible to extract the +** elements of the RowSet in sorted order. Once this extraction +** process has started, no new elements may be inserted. +** +** Hence, the primitive operations for a RowSet are: +** +** CREATE +** INSERT +** TEST +** SMALLEST +** DESTROY +** +** The CREATE and DESTROY primitives are the constructor and destructor, +** obviously. The INSERT primitive adds a new element to the RowSet. +** TEST checks to see if an element is already in the RowSet. SMALLEST +** extracts the least value from the RowSet. +** +** The INSERT primitive might allocate additional memory. Memory is +** allocated in chunks so most INSERTs do no allocation. There is an +** upper bound on the size of allocated memory. No memory is freed +** until DESTROY. +** +** The TEST primitive includes a "batch" number. The TEST primitive +** will only see elements that were inserted before the last change +** in the batch number. In other words, if an INSERT occurs between +** two TESTs where the TESTs have the same batch number, then the +** value added by the INSERT will not be visible to the second TEST. +** The initial batch number is zero, so if the very first TEST contains +** a non-zero batch number, it will see all prior INSERTs. +** +** No INSERTs may occurs after a SMALLEST. An assertion will fail if +** that is attempted. +** +** The cost of an INSERT is roughly constant. (Sometimes new memory +** has to be allocated on an INSERT.) The cost of a TEST with a new +** batch number is O(NlogN) where N is the number of elements in the RowSet. +** The cost of a TEST using the same batch number is O(logN). The cost +** of the first SMALLEST is O(NlogN). Second and subsequent SMALLEST +** primitives are constant time. The cost of DESTROY is O(N). +** +** TEST and SMALLEST may not be used by the same RowSet. This used to +** be possible, but the feature was not used, so it was removed in order +** to simplify the code. + */ +/* #include "sqliteInt.h" */ + +/* +** Target size for allocation chunks. + */ + +/* +** The number of rowset entries per allocation chunk. + */ + +/* +** Each entry in a RowSet is an instance of the following object. +** +** This same object is reused to store a linked list of trees of RowSetEntry +** objects. In that alternative use, pRight points to the next entry +** in the list, pLeft points to the tree, and v is unused. The +** RowSet.pForest value points to the head of this forest list. + */ +type TRowSetEntry = struct { + Fv Ti64 + FpRight uintptr + FpLeft uintptr +} + +type RowSetEntry = TRowSetEntry + +/* +** RowSetEntry objects are allocated in large chunks (instances of the +** following structure) to reduce memory allocation overhead. The +** chunks are kept on a linked list so that they can be deallocated +** when the RowSet is destroyed. + */ +type TRowSetChunk = struct { + FpNextChunk uintptr + FaEntry [42]TRowSetEntry +} + +type RowSetChunk = TRowSetChunk + +/* +** A RowSet in an instance of the following structure. +** +** A typedef of this structure if found in sqliteInt.h. + */ +type TRowSet1 = struct { + FpChunk uintptr + Fdb uintptr + FpEntry uintptr + FpLast uintptr + FpFresh uintptr + FpForest uintptr + FnFresh Tu16 + FrsFlags Tu16 + FiBatch int32 +} + +type RowSet1 = TRowSet1 + +/* +** Allowed values for RowSet.rsFlags + */ + +// C documentation +// +// /* +// ** Allocate a RowSet object. Return NULL if a memory allocation +// ** error occurs. +// */ +func _sqlite3RowSetInit(tls *libc.TLS, db uintptr) (r uintptr) { + var N int32 + var p uintptr + _, _ = N, p + p = _sqlite3DbMallocRawNN(tls, db, uint64(56)) + if p != 0 { + N = _sqlite3DbMallocSize(tls, db, p) + (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).Fdb = db + (*TRowSet)(unsafe.Pointer(p)).FpEntry = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FpLast = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FpForest = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FpFresh = uintptr((libc.Uint64FromInt64(56)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + p + (*TRowSet)(unsafe.Pointer(p)).FnFresh = uint16((uint64(N) - (libc.Uint64FromInt64(56)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) / libc.Uint64FromInt64(24)) + (*TRowSet)(unsafe.Pointer(p)).FrsFlags = uint16(ROWSET_SORTED) + (*TRowSet)(unsafe.Pointer(p)).FiBatch = 0 + } + return p +} + +// C documentation +// +// /* +// ** Deallocate all chunks from a RowSet. This frees all memory that +// ** the RowSet has allocated over its lifetime. This routine is +// ** the destructor for the RowSet. +// */ +func _sqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { + var p, pChunk, pNextChunk uintptr + _, _, _ = p, pChunk, pNextChunk + p = pArg + pChunk = (*TRowSet)(unsafe.Pointer(p)).FpChunk + for { + if !(pChunk != 0) { + break + } + pNextChunk = (*TRowSetChunk)(unsafe.Pointer(pChunk)).FpNextChunk + _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, pChunk) + goto _1 + _1: + ; + pChunk = pNextChunk + } + (*TRowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FnFresh = uint16(0) + (*TRowSet)(unsafe.Pointer(p)).FpEntry = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FpLast = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FpForest = uintptr(0) + (*TRowSet)(unsafe.Pointer(p)).FrsFlags = uint16(ROWSET_SORTED) +} + +// C documentation +// +// /* +// ** Deallocate all chunks from a RowSet. This frees all memory that +// ** the RowSet has allocated over its lifetime. This routine is +// ** the destructor for the RowSet. +// */ +func _sqlite3RowSetDelete(tls *libc.TLS, pArg uintptr) { + _sqlite3RowSetClear(tls, pArg) + _sqlite3DbFree(tls, (*TRowSet)(unsafe.Pointer(pArg)).Fdb, pArg) +} + +// C documentation +// +// /* +// ** Allocate a new RowSetEntry object that is associated with the +// ** given RowSet. Return a pointer to the new and completely uninitialized +// ** object. +// ** +// ** In an OOM situation, the RowSet.db->mallocFailed flag is set and this +// ** routine returns NULL. +// */ +func _rowSetEntryAlloc(tls *libc.TLS, p uintptr) (r uintptr) { + var pNew, v1, v2 uintptr + _, _, _ = pNew, v1, v2 + if int32((*TRowSet)(unsafe.Pointer(p)).FnFresh) == 0 { + pNew = _sqlite3DbMallocRawNN(tls, (*TRowSet)(unsafe.Pointer(p)).Fdb, uint64(1016)) + if pNew == uintptr(0) { + return uintptr(0) + } + (*TRowSetChunk)(unsafe.Pointer(pNew)).FpNextChunk = (*TRowSet)(unsafe.Pointer(p)).FpChunk + (*TRowSet)(unsafe.Pointer(p)).FpChunk = pNew + (*TRowSet)(unsafe.Pointer(p)).FpFresh = pNew + 8 + (*TRowSet)(unsafe.Pointer(p)).FnFresh = uint16(uint64(libc.Int32FromInt32(ROWSET_ALLOCATION_SIZE)-libc.Int32FromInt32(8)) / libc.Uint64FromInt64(24)) + } + (*TRowSet)(unsafe.Pointer(p)).FnFresh-- + v2 = p + 32 + v1 = *(*uintptr)(unsafe.Pointer(v2)) + *(*uintptr)(unsafe.Pointer(v2)) += 24 + return v1 +} + +// C documentation +// +// /* +// ** Insert a new value into a RowSet. +// ** +// ** The mallocFailed flag of the database connection is set if a +// ** memory allocation fails. +// */ +func _sqlite3RowSetInsert(tls *libc.TLS, p uintptr, rowid Ti64) { + var pEntry, pLast, p1 uintptr + _, _, _ = pEntry, pLast, p1 /* The last prior entry */ + /* This routine is never called after sqlite3RowSetNext() */ + pEntry = _rowSetEntryAlloc(tls, p) + if pEntry == uintptr(0) { + return + } + (*TRowSetEntry)(unsafe.Pointer(pEntry)).Fv = rowid + (*TRowSetEntry)(unsafe.Pointer(pEntry)).FpRight = uintptr(0) + pLast = (*TRowSet)(unsafe.Pointer(p)).FpLast + if pLast != 0 { + if rowid <= (*TRowSetEntry)(unsafe.Pointer(pLast)).Fv { /*OPTIMIZATION-IF-FALSE*/ + /* Avoid unnecessary sorts by preserving the ROWSET_SORTED flags + ** where possible */ + p1 = p + 50 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(ROWSET_SORTED)) + } + (*TRowSetEntry)(unsafe.Pointer(pLast)).FpRight = pEntry + } else { + (*TRowSet)(unsafe.Pointer(p)).FpEntry = pEntry + } + (*TRowSet)(unsafe.Pointer(p)).FpLast = pEntry +} + +// C documentation +// +// /* +// ** Merge two lists of RowSetEntry objects. Remove duplicates. +// ** +// ** The input lists are connected via pRight pointers and are +// ** assumed to each already be in sorted order. +// */ +func _rowSetEntryMerge(tls *libc.TLS, pA uintptr, pB uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pTail, v2, v3 uintptr + var _ /* head at bp+0 */ TRowSetEntry + _, _, _ = pTail, v2, v3 + pTail = bp + for { + if (*TRowSetEntry)(unsafe.Pointer(pA)).Fv <= (*TRowSetEntry)(unsafe.Pointer(pB)).Fv { + if (*TRowSetEntry)(unsafe.Pointer(pA)).Fv < (*TRowSetEntry)(unsafe.Pointer(pB)).Fv { + v2 = pA + (*TRowSetEntry)(unsafe.Pointer(pTail)).FpRight = v2 + pTail = v2 + } + pA = (*TRowSetEntry)(unsafe.Pointer(pA)).FpRight + if pA == uintptr(0) { + (*TRowSetEntry)(unsafe.Pointer(pTail)).FpRight = pB + break + } + } else { + v3 = pB + (*TRowSetEntry)(unsafe.Pointer(pTail)).FpRight = v3 + pTail = v3 + pB = (*TRowSetEntry)(unsafe.Pointer(pB)).FpRight + if pB == uintptr(0) { + (*TRowSetEntry)(unsafe.Pointer(pTail)).FpRight = pA + break + } + } + goto _1 + _1: + } + return (*(*TRowSetEntry)(unsafe.Pointer(bp))).FpRight +} + +// C documentation +// +// /* +// ** Sort all elements on the list of RowSetEntry objects into order of +// ** increasing v. +// */ +func _rowSetEntrySort(tls *libc.TLS, pIn uintptr) (r uintptr) { + bp := tls.Alloc(320) + defer tls.Free(320) + var i uint32 + var pNext, v3 uintptr + var _ /* aBucket at bp+0 */ [40]uintptr + _, _, _ = i, pNext, v3 + libc.Xmemset(tls, bp, 0, uint64(320)) + for pIn != 0 { + pNext = (*TRowSetEntry)(unsafe.Pointer(pIn)).FpRight + (*TRowSetEntry)(unsafe.Pointer(pIn)).FpRight = uintptr(0) + i = uint32(0) + for { + if !((*(*[40]uintptr)(unsafe.Pointer(bp)))[i] != 0) { + break + } + pIn = _rowSetEntryMerge(tls, (*(*[40]uintptr)(unsafe.Pointer(bp)))[i], pIn) + (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) + goto _1 + _1: + ; + i++ + } + (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] = pIn + pIn = pNext + } + pIn = (*(*[40]uintptr)(unsafe.Pointer(bp)))[0] + i = uint32(1) + for { + if !(uint64(i) < libc.Uint64FromInt64(320)/libc.Uint64FromInt64(8)) { + break + } + if (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] == uintptr(0) { + goto _2 + } + if pIn != 0 { + v3 = _rowSetEntryMerge(tls, pIn, (*(*[40]uintptr)(unsafe.Pointer(bp)))[i]) + } else { + v3 = (*(*[40]uintptr)(unsafe.Pointer(bp)))[i] + } + pIn = v3 + goto _2 + _2: + ; + i++ + } + return pIn +} + +// C documentation +// +// /* +// ** The input, pIn, is a binary tree (or subtree) of RowSetEntry objects. +// ** Convert this tree into a linked list connected by the pRight pointers +// ** and return pointers to the first and last elements of the new list. +// */ +func _rowSetTreeToList(tls *libc.TLS, pIn uintptr, ppFirst uintptr, ppLast uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* p at bp+0 */ uintptr + if (*TRowSetEntry)(unsafe.Pointer(pIn)).FpLeft != 0 { + _rowSetTreeToList(tls, (*TRowSetEntry)(unsafe.Pointer(pIn)).FpLeft, ppFirst, bp) + (*TRowSetEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpRight = pIn + } else { + *(*uintptr)(unsafe.Pointer(ppFirst)) = pIn + } + if (*TRowSetEntry)(unsafe.Pointer(pIn)).FpRight != 0 { + _rowSetTreeToList(tls, (*TRowSetEntry)(unsafe.Pointer(pIn)).FpRight, pIn+8, ppLast) + } else { + *(*uintptr)(unsafe.Pointer(ppLast)) = pIn + } +} + +// C documentation +// +// /* +// ** Convert a sorted list of elements (connected by pRight) into a binary +// ** tree with depth of iDepth. A depth of 1 means the tree contains a single +// ** node taken from the head of *ppList. A depth of 2 means a tree with +// ** three nodes. And so forth. +// ** +// ** Use as many entries from the input list as required and update the +// ** *ppList to point to the unused elements of the list. If the input +// ** list contains too few elements, then construct an incomplete tree +// ** and leave *ppList set to NULL. +// ** +// ** Return a pointer to the root of the constructed binary tree. +// */ +func _rowSetNDeepTree(tls *libc.TLS, ppList uintptr, iDepth int32) (r uintptr) { + var p, pLeft, v1 uintptr + _, _, _ = p, pLeft, v1 /* Left subtree */ + if *(*uintptr)(unsafe.Pointer(ppList)) == uintptr(0) { /*OPTIMIZATION-IF-TRUE*/ + /* Prevent unnecessary deep recursion when we run out of entries */ + return uintptr(0) + } + if iDepth > int32(1) { /*OPTIMIZATION-IF-TRUE*/ + /* This branch causes a *balanced* tree to be generated. A valid tree + ** is still generated without this branch, but the tree is wildly + ** unbalanced and inefficient. */ + pLeft = _rowSetNDeepTree(tls, ppList, iDepth-int32(1)) + p = *(*uintptr)(unsafe.Pointer(ppList)) + if p == uintptr(0) { /*OPTIMIZATION-IF-FALSE*/ + /* It is safe to always return here, but the resulting tree + ** would be unbalanced */ + return pLeft + } + (*TRowSetEntry)(unsafe.Pointer(p)).FpLeft = pLeft + *(*uintptr)(unsafe.Pointer(ppList)) = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight + (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, ppList, iDepth-int32(1)) + } else { + p = *(*uintptr)(unsafe.Pointer(ppList)) + *(*uintptr)(unsafe.Pointer(ppList)) = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight + v1 = libc.UintptrFromInt32(0) + (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = v1 + (*TRowSetEntry)(unsafe.Pointer(p)).FpLeft = v1 + } + return p +} + +// C documentation +// +// /* +// ** Convert a sorted list of elements into a binary tree. Make the tree +// ** as deep as it needs to be in order to contain the entire list. +// */ +func _rowSetListToTree(tls *libc.TLS, _pList uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _pList + var iDepth int32 + var p, pLeft, v1 uintptr + _, _, _, _ = iDepth, p, pLeft, v1 /* Left subtree */ + p = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight + v1 = libc.UintptrFromInt32(0) + (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = v1 + (*TRowSetEntry)(unsafe.Pointer(p)).FpLeft = v1 + iDepth = int32(1) + for { + if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { + break + } + pLeft = p + p = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight + (*TRowSetEntry)(unsafe.Pointer(p)).FpLeft = pLeft + (*TRowSetEntry)(unsafe.Pointer(p)).FpRight = _rowSetNDeepTree(tls, bp, iDepth) + goto _2 + _2: + ; + iDepth++ + } + return p +} + +// C documentation +// +// /* +// ** Extract the smallest element from the RowSet. +// ** Write the element into *pRowid. Return 1 on success. Return +// ** 0 if the RowSet is already empty. +// ** +// ** After this routine has been called, the sqlite3RowSetInsert() +// ** routine may not be called again. +// ** +// ** This routine may not be called after sqlite3RowSetTest() has +// ** been used. Older versions of RowSet allowed that, but as the +// ** capability was not used by the code generator, it was removed +// ** for code economy. +// */ +func _sqlite3RowSetNext(tls *libc.TLS, p uintptr, pRowid uintptr) (r int32) { + var p1 uintptr + _ = p1 + /* Cannot be used with sqlite3RowSetText() */ + /* Merge the forest into a single sorted list on first call */ + if int32((*TRowSet)(unsafe.Pointer(p)).FrsFlags)&int32(ROWSET_NEXT) == 0 { /*OPTIMIZATION-IF-FALSE*/ + if int32((*TRowSet)(unsafe.Pointer(p)).FrsFlags)&int32(ROWSET_SORTED) == 0 { /*OPTIMIZATION-IF-FALSE*/ + (*TRowSet)(unsafe.Pointer(p)).FpEntry = _rowSetEntrySort(tls, (*TRowSet)(unsafe.Pointer(p)).FpEntry) + } + p1 = p + 50 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(ROWSET_SORTED) | libc.Int32FromInt32(ROWSET_NEXT))) + } + /* Return the next entry on the list */ + if (*TRowSet)(unsafe.Pointer(p)).FpEntry != 0 { + *(*Ti64)(unsafe.Pointer(pRowid)) = (*TRowSetEntry)(unsafe.Pointer((*TRowSet)(unsafe.Pointer(p)).FpEntry)).Fv + (*TRowSet)(unsafe.Pointer(p)).FpEntry = (*TRowSetEntry)(unsafe.Pointer((*TRowSet)(unsafe.Pointer(p)).FpEntry)).FpRight + if (*TRowSet)(unsafe.Pointer(p)).FpEntry == uintptr(0) { /*OPTIMIZATION-IF-TRUE*/ + /* Free memory immediately, rather than waiting on sqlite3_finalize() */ + _sqlite3RowSetClear(tls, p) + } + return int32(1) + } else { + return 0 + } + return r +} + +// C documentation +// +// /* +// ** Check to see if element iRowid was inserted into the rowset as +// ** part of any insert batch prior to iBatch. Return 1 or 0. +// ** +// ** If this is the first test of a new batch and if there exist entries +// ** on pRowSet->pEntry, then sort those entries into the forest at +// ** pRowSet->pForest so that they can be tested. +// */ +func _sqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Tsqlite3_int64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pTree, ppPrevTree, v2, p3 uintptr + var _ /* pAux at bp+0 */ uintptr + var _ /* pTail at bp+8 */ uintptr + _, _, _, _, _ = p, pTree, ppPrevTree, v2, p3 + /* This routine is never called after sqlite3RowSetNext() */ + /* Sort entries into the forest on the first test of a new batch. + ** To save unnecessary work, only do this when the batch number changes. + */ + if iBatch != (*TRowSet)(unsafe.Pointer(pRowSet)).FiBatch { /*OPTIMIZATION-IF-FALSE*/ + p = (*TRowSet)(unsafe.Pointer(pRowSet)).FpEntry + if p != 0 { + ppPrevTree = pRowSet + 40 + if int32((*TRowSet)(unsafe.Pointer(pRowSet)).FrsFlags)&int32(ROWSET_SORTED) == 0 { /*OPTIMIZATION-IF-FALSE*/ + /* Only sort the current set of entries if they need it */ + p = _rowSetEntrySort(tls, p) + } + pTree = (*TRowSet)(unsafe.Pointer(pRowSet)).FpForest + for { + if !(pTree != 0) { + break + } + ppPrevTree = pTree + 8 + if (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft == uintptr(0) { + (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft = _rowSetListToTree(tls, p) + break + } else { + _rowSetTreeToList(tls, (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft, bp, bp+8) + (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft = uintptr(0) + p = _rowSetEntryMerge(tls, *(*uintptr)(unsafe.Pointer(bp)), p) + } + goto _1 + _1: + ; + pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight + } + if pTree == uintptr(0) { + v2 = _rowSetEntryAlloc(tls, pRowSet) + pTree = v2 + *(*uintptr)(unsafe.Pointer(ppPrevTree)) = v2 + if pTree != 0 { + (*TRowSetEntry)(unsafe.Pointer(pTree)).Fv = 0 + (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight = uintptr(0) + (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft = _rowSetListToTree(tls, p) + } + } + (*TRowSet)(unsafe.Pointer(pRowSet)).FpEntry = uintptr(0) + (*TRowSet)(unsafe.Pointer(pRowSet)).FpLast = uintptr(0) + p3 = pRowSet + 50 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(ROWSET_SORTED)) + } + (*TRowSet)(unsafe.Pointer(pRowSet)).FiBatch = iBatch + } + /* Test to see if the iRowid value appears anywhere in the forest. + ** Return 1 if it does and 0 if not. + */ + pTree = (*TRowSet)(unsafe.Pointer(pRowSet)).FpForest + for { + if !(pTree != 0) { + break + } + p = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpLeft + for p != 0 { + if (*TRowSetEntry)(unsafe.Pointer(p)).Fv < iRowid { + p = (*TRowSetEntry)(unsafe.Pointer(p)).FpRight + } else { + if (*TRowSetEntry)(unsafe.Pointer(p)).Fv > iRowid { + p = (*TRowSetEntry)(unsafe.Pointer(p)).FpLeft + } else { + return int32(1) + } + } + } + goto _4 + _4: + ; + pTree = (*TRowSetEntry)(unsafe.Pointer(pTree)).FpRight + } + return 0 +} + +/************** End of rowset.c **********************************************/ +/************** Begin file pager.c *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This is the implementation of the page cache subsystem or "pager". +** +** The pager is used to access a database disk file. It implements +** atomic commit and rollback through the use of a journal file that +** is separate from the database file. The pager also implements file +** locking to prevent two processes from writing the same database +** file simultaneously, or one process from reading the database while +** another is writing. + */ +/* #include "sqliteInt.h" */ +/************** Include wal.h in the middle of pager.c ***********************/ +/************** Begin file wal.h *********************************************/ +/* +** 2010 February 1 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface to the write-ahead logging +** system. Refer to the comments below and the header comment attached to +** the implementation of each function in log.c for further details. + */ + +/* #include "sqliteInt.h" */ + +/* Macros for extracting appropriate sync flags for either transaction +** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): + */ + +// C documentation +// +// /* Connection to a write-ahead log (WAL) file. +// ** There is one object of this type for each pager. +// */ +type TWal = struct { + FpVfs uintptr + FpDbFd uintptr + FpWalFd uintptr + FiCallback Tu32 + FmxWalSize Ti64 + FnWiData int32 + FszFirstBlock int32 + FapWiData uintptr + FszPage Tu32 + FreadLock Ti16 + FsyncFlags Tu8 + FexclusiveMode Tu8 + FwriteLock Tu8 + FckptLock Tu8 + FreadOnly Tu8 + FtruncateOnCommit Tu8 + FsyncHeader Tu8 + FpadToSectorBoundary Tu8 + FbShmUnreliable Tu8 + Fhdr TWalIndexHdr + FminFrame Tu32 + FiReCksum Tu32 + FzWalName uintptr + FnCkpt Tu32 + FpSnapshot uintptr +} + +type Wal = TWal + +/************** End of wal.h *************************************************/ +/************** Continuing where we left off in pager.c **********************/ + +/******************* NOTES ON THE DESIGN OF THE PAGER ************************ +** +** This comment block describes invariants that hold when using a rollback +** journal. These invariants do not apply for journal_mode=WAL, +** journal_mode=MEMORY, or journal_mode=OFF. +** +** Within this comment block, a page is deemed to have been synced +** automatically as soon as it is written when PRAGMA synchronous=OFF. +** Otherwise, the page is not synced until the xSync method of the VFS +** is called successfully on the file containing the page. +** +** Definition: A page of the database file is said to be "overwriteable" if +** one or more of the following are true about the page: +** +** (a) The original content of the page as it was at the beginning of +** the transaction has been written into the rollback journal and +** synced. +** +** (b) The page was a freelist leaf page at the start of the transaction. +** +** (c) The page number is greater than the largest page that existed in +** the database file at the start of the transaction. +** +** (1) A page of the database file is never overwritten unless one of the +** following are true: +** +** (a) The page and all other pages on the same sector are overwriteable. +** +** (b) The atomic page write optimization is enabled, and the entire +** transaction other than the update of the transaction sequence +** number consists of a single page change. +** +** (2) The content of a page written into the rollback journal exactly matches +** both the content in the database when the rollback journal was written +** and the content in the database at the beginning of the current +** transaction. +** +** (3) Writes to the database file are an integer multiple of the page size +** in length and are aligned on a page boundary. +** +** (4) Reads from the database file are either aligned on a page boundary and +** an integer multiple of the page size in length or are taken from the +** first 100 bytes of the database file. +** +** (5) All writes to the database file are synced prior to the rollback journal +** being deleted, truncated, or zeroed. +** +** (6) If a super-journal file is used, then all writes to the database file +** are synced prior to the super-journal being deleted. +** +** Definition: Two databases (or the same database at two points it time) +** are said to be "logically equivalent" if they give the same answer to +** all queries. Note in particular the content of freelist leaf +** pages can be changed arbitrarily without affecting the logical equivalence +** of the database. +** +** (7) At any time, if any subset, including the empty set and the total set, +** of the unsynced changes to a rollback journal are removed and the +** journal is rolled back, the resulting database file will be logically +** equivalent to the database file at the beginning of the transaction. +** +** (8) When a transaction is rolled back, the xTruncate method of the VFS +** is called to restore the database file to the same size it was at +** the beginning of the transaction. (In some VFSes, the xTruncate +** method is a no-op, but that does not change the fact the SQLite will +** invoke it.) +** +** (9) Whenever the database file is modified, at least one bit in the range +** of bytes from 24 through 39 inclusive will be changed prior to releasing +** the EXCLUSIVE lock, thus signaling other connections on the same +** database to flush their caches. +** +** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less +** than one billion transactions. +** +** (11) A database file is well-formed at the beginning and at the conclusion +** of every transaction. +** +** (12) An EXCLUSIVE lock is held on the database file when writing to +** the database file. +** +** (13) A SHARED lock is held on the database file while reading any +** content out of the database file. +** +******************************************************************************/ + +/* +** Macros for troubleshooting. Normally turned off + */ + +/* +** The following two macros are used within the PAGERTRACE() macros above +** to print out file-descriptors. +** +** PAGERID() takes a pointer to a Pager struct as its argument. The +** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file +** struct as its argument. + */ + +/* +** The Pager.eState variable stores the current 'state' of a pager. A +** pager may be in any one of the seven states shown in the following +** state diagram. +** +** OPEN <------+------+ +** | | | +** V | | +** +---------> READER-------+ | +** | | | +** | V | +** |<-------WRITER_LOCKED------> ERROR +** | | ^ +** | V | +** |<------WRITER_CACHEMOD-------->| +** | | | +** | V | +** |<-------WRITER_DBMOD---------->| +** | | | +** | V | +** +<------WRITER_FINISHED-------->+ +** +** +** List of state transitions and the C [function] that performs each: +** +** OPEN -> READER [sqlite3PagerSharedLock] +** READER -> OPEN [pager_unlock] +** +** READER -> WRITER_LOCKED [sqlite3PagerBegin] +** WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal] +** WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal] +** WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne] +** WRITER_*** -> READER [pager_end_transaction] +** +** WRITER_*** -> ERROR [pager_error] +** ERROR -> OPEN [pager_unlock] +** +** +** OPEN: +** +** The pager starts up in this state. Nothing is guaranteed in this +** state - the file may or may not be locked and the database size is +** unknown. The database may not be read or written. +** +** * No read or write transaction is active. +** * Any lock, or no lock at all, may be held on the database file. +** * The dbSize, dbOrigSize and dbFileSize variables may not be trusted. +** +** READER: +** +** In this state all the requirements for reading the database in +** rollback (non-WAL) mode are met. Unless the pager is (or recently +** was) in exclusive-locking mode, a user-level read transaction is +** open. The database size is known in this state. +** +** A connection running with locking_mode=normal enters this state when +** it opens a read-transaction on the database and returns to state +** OPEN after the read-transaction is completed. However a connection +** running in locking_mode=exclusive (including temp databases) remains in +** this state even after the read-transaction is closed. The only way +** a locking_mode=exclusive connection can transition from READER to OPEN +** is via the ERROR state (see below). +** +** * A read transaction may be active (but a write-transaction cannot). +** * A SHARED or greater lock is held on the database file. +** * The dbSize variable may be trusted (even if a user-level read +** transaction is not active). The dbOrigSize and dbFileSize variables +** may not be trusted at this point. +** * If the database is a WAL database, then the WAL connection is open. +** * Even if a read-transaction is not open, it is guaranteed that +** there is no hot-journal in the file-system. +** +** WRITER_LOCKED: +** +** The pager moves to this state from READER when a write-transaction +** is first opened on the database. In WRITER_LOCKED state, all locks +** required to start a write-transaction are held, but no actual +** modifications to the cache or database have taken place. +** +** In rollback mode, a RESERVED or (if the transaction was opened with +** BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when +** moving to this state, but the journal file is not written to or opened +** to in this state. If the transaction is committed or rolled back while +** in WRITER_LOCKED state, all that is required is to unlock the database +** file. +** +** IN WAL mode, WalBeginWriteTransaction() is called to lock the log file. +** If the connection is running with locking_mode=exclusive, an attempt +** is made to obtain an EXCLUSIVE lock on the database file. +** +** * A write transaction is active. +** * If the connection is open in rollback-mode, a RESERVED or greater +** lock is held on the database file. +** * If the connection is open in WAL-mode, a WAL write transaction +** is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully +** called). +** * The dbSize, dbOrigSize and dbFileSize variables are all valid. +** * The contents of the pager cache have not been modified. +** * The journal file may or may not be open. +** * Nothing (not even the first header) has been written to the journal. +** +** WRITER_CACHEMOD: +** +** A pager moves from WRITER_LOCKED state to this state when a page is +** first modified by the upper layer. In rollback mode the journal file +** is opened (if it is not already open) and a header written to the +** start of it. The database file on disk has not been modified. +** +** * A write transaction is active. +** * A RESERVED or greater lock is held on the database file. +** * The journal file is open and the first header has been written +** to it, but the header has not been synced to disk. +** * The contents of the page cache have been modified. +** +** WRITER_DBMOD: +** +** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state +** when it modifies the contents of the database file. WAL connections +** never enter this state (since they do not modify the database file, +** just the log file). +** +** * A write transaction is active. +** * An EXCLUSIVE or greater lock is held on the database file. +** * The journal file is open and the first header has been written +** and synced to disk. +** * The contents of the page cache have been modified (and possibly +** written to disk). +** +** WRITER_FINISHED: +** +** It is not possible for a WAL connection to enter this state. +** +** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD +** state after the entire transaction has been successfully written into the +** database file. In this state the transaction may be committed simply +** by finalizing the journal file. Once in WRITER_FINISHED state, it is +** not possible to modify the database further. At this point, the upper +** layer must either commit or rollback the transaction. +** +** * A write transaction is active. +** * An EXCLUSIVE or greater lock is held on the database file. +** * All writing and syncing of journal and database data has finished. +** If no error occurred, all that remains is to finalize the journal to +** commit the transaction. If an error did occur, the caller will need +** to rollback the transaction. +** +** ERROR: +** +** The ERROR state is entered when an IO or disk-full error (including +** SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it +** difficult to be sure that the in-memory pager state (cache contents, +** db size etc.) are consistent with the contents of the file-system. +** +** Temporary pager files may enter the ERROR state, but in-memory pagers +** cannot. +** +** For example, if an IO error occurs while performing a rollback, +** the contents of the page-cache may be left in an inconsistent state. +** At this point it would be dangerous to change back to READER state +** (as usually happens after a rollback). Any subsequent readers might +** report database corruption (due to the inconsistent cache), and if +** they upgrade to writers, they may inadvertently corrupt the database +** file. To avoid this hazard, the pager switches into the ERROR state +** instead of READER following such an error. +** +** Once it has entered the ERROR state, any attempt to use the pager +** to read or write data returns an error. Eventually, once all +** outstanding transactions have been abandoned, the pager is able to +** transition back to OPEN state, discarding the contents of the +** page-cache and any other in-memory state at the same time. Everything +** is reloaded from disk (and, if necessary, hot-journal rollback performed) +** when a read-transaction is next opened on the pager (transitioning +** the pager into READER state). At that point the system has recovered +** from the error. +** +** Specifically, the pager jumps into the ERROR state if: +** +** 1. An error occurs while attempting a rollback. This happens in +** function sqlite3PagerRollback(). +** +** 2. An error occurs while attempting to finalize a journal file +** following a commit in function sqlite3PagerCommitPhaseTwo(). +** +** 3. An error occurs while attempting to write to the journal or +** database file in function pagerStress() in order to free up +** memory. +** +** In other cases, the error is returned to the b-tree layer. The b-tree +** layer then attempts a rollback operation. If the error condition +** persists, the pager enters the ERROR state via condition (1) above. +** +** Condition (3) is necessary because it can be triggered by a read-only +** statement executed within a transaction. In this case, if the error +** code were simply returned to the user, the b-tree layer would not +** automatically attempt a rollback, as it assumes that an error in a +** read-only statement cannot leave the pager in an internally inconsistent +** state. +** +** * The Pager.errCode variable is set to something other than SQLITE_OK. +** * There are one or more outstanding references to pages (after the +** last reference is dropped the pager should move back to OPEN state). +** * The pager is not an in-memory pager. +** +** +** Notes: +** +** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the +** connection is open in WAL mode. A WAL connection is always in one +** of the first four states. +** +** * Normally, a connection open in exclusive mode is never in PAGER_OPEN +** state. There are two exceptions: immediately after exclusive-mode has +** been turned on (and before any read or write transactions are +** executed), and when the pager is leaving the "error state". +** +** * See also: assert_pager_state(). + */ + +/* +** The Pager.eLock variable is almost always set to one of the +** following locking-states, according to the lock currently held on +** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. +** This variable is kept up to date as locks are taken and released by +** the pagerLockDb() and pagerUnlockDb() wrappers. +** +** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY +** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not +** the operation was successful. In these circumstances pagerLockDb() and +** pagerUnlockDb() take a conservative approach - eLock is always updated +** when unlocking the file, and only updated when locking the file if the +** VFS call is successful. This way, the Pager.eLock variable may be set +** to a less exclusive (lower) value than the lock that is actually held +** at the system level, but it is never set to a more exclusive value. +** +** This is usually safe. If an xUnlock fails or appears to fail, there may +** be a few redundant xLock() calls or a lock may be held for longer than +** required, but nothing really goes wrong. +** +** The exception is when the database file is unlocked as the pager moves +** from ERROR to OPEN state. At this point there may be a hot-journal file +** in the file-system that needs to be rolled back (as part of an OPEN->SHARED +** transition, by the same pager or any other). If the call to xUnlock() +** fails at this point and the pager is left holding an EXCLUSIVE lock, this +** can confuse the call to xCheckReservedLock() call made later as part +** of hot-journal detection. +** +** xCheckReservedLock() is defined as returning true "if there is a RESERVED +** lock held by this process or any others". So xCheckReservedLock may +** return true because the caller itself is holding an EXCLUSIVE lock (but +** doesn't know it because of a previous error in xUnlock). If this happens +** a hot-journal may be mistaken for a journal being created by an active +** transaction in another process, causing SQLite to read from the database +** without rolling it back. +** +** To work around this, if a call to xUnlock() fails when unlocking the +** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It +** is only changed back to a real locking state after a successful call +** to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition +** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK +** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE +** lock on the database file before attempting to roll it back. See function +** PagerSharedLock() for more detail. +** +** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in +** PAGER_OPEN state. + */ + +/* +** The maximum allowed sector size. 64KiB. If the xSectorsize() method +** returns a value larger than this, then MAX_SECTOR_SIZE is used instead. +** This could conceivably cause corruption following a power failure on +** such a system. This is currently an undocumented limit. + */ + +// C documentation +// +// /* +// ** An instance of the following structure is allocated for each active +// ** savepoint and statement transaction in the system. All such structures +// ** are stored in the Pager.aSavepoint[] array, which is allocated and +// ** resized using sqlite3Realloc(). +// ** +// ** When a savepoint is created, the PagerSavepoint.iHdrOffset field is +// ** set to 0. If a journal-header is written into the main journal while +// ** the savepoint is active, then iHdrOffset is set to the byte offset +// ** immediately following the last journal record written into the main +// ** journal before the journal-header. This is required during savepoint +// ** rollback (see pagerPlaybackSavepoint()). +// */ +type TPagerSavepoint = struct { + FiOffset Ti64 + FiHdrOffset Ti64 + FpInSavepoint uintptr + FnOrig TPgno + FiSubRec TPgno + FbTruncateOnRelease int32 + FaWalData [4]Tu32 +} + +type PagerSavepoint = TPagerSavepoint + +type TPagerSavepoint1 = struct { + FiOffset Ti64 + FiHdrOffset Ti64 + FpInSavepoint uintptr + FnOrig TPgno + FiSubRec TPgno + FbTruncateOnRelease int32 + FaWalData [4]Tu32 +} + +type PagerSavepoint1 = TPagerSavepoint1 + +/* +** Bits of the Pager.doNotSpill flag. See further description below. + */ + +/* +** An open page cache is an instance of struct Pager. A description of +** some of the more important member variables follows: +** +** eState +** +** The current 'state' of the pager object. See the comment and state +** diagram above for a description of the pager state. +** +** eLock +** +** For a real on-disk database, the current lock held on the database file - +** NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. +** +** For a temporary or in-memory database (neither of which require any +** locks), this variable is always set to EXCLUSIVE_LOCK. Since such +** databases always have Pager.exclusiveMode==1, this tricks the pager +** logic into thinking that it already has all the locks it will ever +** need (and no reason to release them). +** +** In some (obscure) circumstances, this variable may also be set to +** UNKNOWN_LOCK. See the comment above the #define of UNKNOWN_LOCK for +** details. +** +** changeCountDone +** +** This boolean variable is used to make sure that the change-counter +** (the 4-byte header field at byte offset 24 of the database file) is +** not updated more often than necessary. +** +** It is set to true when the change-counter field is updated, which +** can only happen if an exclusive lock is held on the database file. +** It is cleared (set to false) whenever an exclusive lock is +** relinquished on the database file. Each time a transaction is committed, +** The changeCountDone flag is inspected. If it is true, the work of +** updating the change-counter is omitted for the current transaction. +** +** This mechanism means that when running in exclusive mode, a connection +** need only update the change-counter once, for the first transaction +** committed. +** +** setSuper +** +** When PagerCommitPhaseOne() is called to commit a transaction, it may +** (or may not) specify a super-journal name to be written into the +** journal file before it is synced to disk. +** +** Whether or not a journal file contains a super-journal pointer affects +** the way in which the journal file is finalized after the transaction is +** committed or rolled back when running in "journal_mode=PERSIST" mode. +** If a journal file does not contain a super-journal pointer, it is +** finalized by overwriting the first journal header with zeroes. If +** it does contain a super-journal pointer the journal file is finalized +** by truncating it to zero bytes, just as if the connection were +** running in "journal_mode=truncate" mode. +** +** Journal files that contain super-journal pointers cannot be finalized +** simply by overwriting the first journal-header with zeroes, as the +** super-journal pointer could interfere with hot-journal rollback of any +** subsequently interrupted transaction that reuses the journal file. +** +** The flag is cleared as soon as the journal file is finalized (either +** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the +** journal file from being successfully finalized, the setSuper flag +** is cleared anyway (and the pager will move to ERROR state). +** +** doNotSpill +** +** This variables control the behavior of cache-spills (calls made by +** the pcache module to the pagerStress() routine to write cached data +** to the file-system in order to free up memory). +** +** When bits SPILLFLAG_OFF or SPILLFLAG_ROLLBACK of doNotSpill are set, +** writing to the database from pagerStress() is disabled altogether. +** The SPILLFLAG_ROLLBACK case is done in a very obscure case that +** comes up during savepoint rollback that requires the pcache module +** to allocate a new page to prevent the journal file from being written +** while it is being traversed by code in pager_playback(). The SPILLFLAG_OFF +** case is a user preference. +** +** If the SPILLFLAG_NOSYNC bit is set, writing to the database from +** pagerStress() is permitted, but syncing the journal file is not. +** This flag is set by sqlite3PagerWrite() when the file-system sector-size +** is larger than the database page-size in order to prevent a journal sync +** from happening in between the journalling of two pages on the same sector. +** +** subjInMemory +** +** This is a boolean variable. If true, then any required sub-journal +** is opened as an in-memory journal file. If false, then in-memory +** sub-journals are only used for in-memory pager files. +** +** This variable is updated by the upper layer each time a new +** write-transaction is opened. +** +** dbSize, dbOrigSize, dbFileSize +** +** Variable dbSize is set to the number of pages in the database file. +** It is valid in PAGER_READER and higher states (all states except for +** OPEN and ERROR). +** +** dbSize is set based on the size of the database file, which may be +** larger than the size of the database (the value stored at offset +** 28 of the database header by the btree). If the size of the file +** is not an integer multiple of the page-size, the value stored in +** dbSize is rounded down (i.e. a 5KB file with 2K page-size has dbSize==2). +** Except, any file that is greater than 0 bytes in size is considered +** to have at least one page. (i.e. a 1KB file with 2K page-size leads +** to dbSize==1). +** +** During a write-transaction, if pages with page-numbers greater than +** dbSize are modified in the cache, dbSize is updated accordingly. +** Similarly, if the database is truncated using PagerTruncateImage(), +** dbSize is updated. +** +** Variables dbOrigSize and dbFileSize are valid in states +** PAGER_WRITER_LOCKED and higher. dbOrigSize is a copy of the dbSize +** variable at the start of the transaction. It is used during rollback, +** and to determine whether or not pages need to be journalled before +** being modified. +** +** Throughout a write-transaction, dbFileSize contains the size of +** the file on disk in pages. It is set to a copy of dbSize when the +** write-transaction is first opened, and updated when VFS calls are made +** to write or truncate the database file on disk. +** +** The only reason the dbFileSize variable is required is to suppress +** unnecessary calls to xTruncate() after committing a transaction. If, +** when a transaction is committed, the dbFileSize variable indicates +** that the database file is larger than the database image (Pager.dbSize), +** pager_truncate() is called. The pager_truncate() call uses xFilesize() +** to measure the database file on disk, and then truncates it if required. +** dbFileSize is not used when rolling back a transaction. In this case +** pager_truncate() is called unconditionally (which means there may be +** a call to xFilesize() that is not strictly required). In either case, +** pager_truncate() may cause the file to become smaller or larger. +** +** dbHintSize +** +** The dbHintSize variable is used to limit the number of calls made to +** the VFS xFileControl(FCNTL_SIZE_HINT) method. +** +** dbHintSize is set to a copy of the dbSize variable when a +** write-transaction is opened (at the same time as dbFileSize and +** dbOrigSize). If the xFileControl(FCNTL_SIZE_HINT) method is called, +** dbHintSize is increased to the number of pages that correspond to the +** size-hint passed to the method call. See pager_write_pagelist() for +** details. +** +** errCode +** +** The Pager.errCode variable is only ever used in PAGER_ERROR state. It +** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode +** is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX +** sub-codes. +** +** syncFlags, walSyncFlags +** +** syncFlags is either SQLITE_SYNC_NORMAL (0x02) or SQLITE_SYNC_FULL (0x03). +** syncFlags is used for rollback mode. walSyncFlags is used for WAL mode +** and contains the flags used to sync the checkpoint operations in the +** lower two bits, and sync flags used for transaction commits in the WAL +** file in bits 0x04 and 0x08. In other words, to get the correct sync flags +** for checkpoint operations, use (walSyncFlags&0x03) and to get the correct +** sync flags for transaction commit, use ((walSyncFlags>>2)&0x03). Note +** that with synchronous=NORMAL in WAL mode, transaction commit is not synced +** meaning that the 0x04 and 0x08 bits are both zero. + */ +type TPager1 = struct { + FpVfs uintptr + FexclusiveMode Tu8 + FjournalMode Tu8 + FuseJournal Tu8 + FnoSync Tu8 + FfullSync Tu8 + FextraSync Tu8 + FsyncFlags Tu8 + FwalSyncFlags Tu8 + FtempFile Tu8 + FnoLock Tu8 + FreadOnly Tu8 + FmemDb Tu8 + FmemVfs Tu8 + FeState Tu8 + FeLock Tu8 + FchangeCountDone Tu8 + FsetSuper Tu8 + FdoNotSpill Tu8 + FsubjInMemory Tu8 + FbUseFetch Tu8 + FhasHeldSharedLock Tu8 + FdbSize TPgno + FdbOrigSize TPgno + FdbFileSize TPgno + FdbHintSize TPgno + FerrCode int32 + FnRec int32 + FcksumInit Tu32 + FnSubRec Tu32 + FpInJournal uintptr + Ffd uintptr + Fjfd uintptr + Fsjfd uintptr + FjournalOff Ti64 + FjournalHdr Ti64 + FpBackup uintptr + FaSavepoint uintptr + FnSavepoint int32 + FiDataVersion Tu32 + FdbFileVers [16]int8 + FnMmapOut int32 + FszMmap Tsqlite3_int64 + FpMmapFreelist uintptr + FnExtra Tu16 + FnReserve Ti16 + FvfsFlags Tu32 + FsectorSize Tu32 + FmxPgno TPgno + FlckPgno TPgno + FpageSize Ti64 + FjournalSizeLimit Ti64 + FzFilename uintptr + FzJournal uintptr + FxBusyHandler uintptr + FpBusyHandlerArg uintptr + FaStat [4]Tu32 + FxReiniter uintptr + FxGet uintptr + FpTmpSpace uintptr + FpPCache uintptr + FpWal uintptr + FzWal uintptr +} + +type Pager1 = TPager1 + +/* +** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains +** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS +** or CACHE_WRITE to sqlite3_db_status(). + */ + +/* +** The following global variables hold counters used for +** testing purposes only. These variables do not exist in +** a non-testing build. These variables are not thread-safe. + */ + +// C documentation +// +// /* +// ** Journal files begin with the following magic string. The data +// ** was obtained from /dev/random. It is used only as a sanity check. +// ** +// ** Since version 2.8.0, the journal format contains additional sanity +// ** checking information. If the power fails while the journal is being +// ** written, semi-random garbage data might appear in the journal +// ** file after power is restored. If an attempt is then made +// ** to roll the journal back, the database could be corrupted. The additional +// ** sanity checking data is an attempt to discover the garbage in the +// ** journal and ignore it. +// ** +// ** The sanity checking information for the new journal format consists +// ** of a 32-bit checksum on each page of data. The checksum covers both +// ** the page number and the pPager->pageSize bytes of data for the page. +// ** This cksum is initialized to a 32-bit random value that appears in the +// ** journal file right after the header. The random initializer is important, +// ** because garbage data that appears at the end of a journal is likely +// ** data that was once in other files that have now been deleted. If the +// ** garbage data came from an obsolete journal file, the checksums might +// ** be correct. But by initializing the checksum to random value which +// ** is different for every journal, we minimize that risk. +// */ +var _aJournalMagic = [8]uint8{ + 0: uint8(0xd9), + 1: uint8(0xd5), + 2: uint8(0x05), + 3: uint8(0xf9), + 4: uint8(0x20), + 5: uint8(0xa1), + 6: uint8(0x63), + 7: uint8(0xd7), +} + +/* +** The size of the of each page record in the journal is given by +** the following macro. + */ + +/* +** The journal header size for this pager. This is usually the same +** size as a single disk sector. See also setSectorSize(). + */ + +/* +** The macro MEMDB is true if we are dealing with an in-memory database. +** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set, +** the value of MEMDB will be a constant and the compiler will optimize +** out code that would never execute. + */ + +/* +** The macro USEFETCH is true if we are allowed to use the xFetch and xUnfetch +** interfaces to access the database using memory-mapped I/O. + */ + +/* +** The argument to this macro is a file descriptor (type sqlite3_file*). +** Return 0 if it is not open, or non-zero (but not 1) if it is. +** +** This is so that expressions can be written as: +** +** if( isOpen(pPager->jfd) ){ ... +** +** instead of +** +** if( pPager->jfd->pMethods ){ ... + */ + +// C documentation +// +// /* +// ** Return true if page pgno can be read directly from the database file +// ** by the b-tree layer. This is the case if: +// ** +// ** * the database file is open, +// ** * there are no dirty pages in the cache, and +// ** * the desired page is not currently in the wal file. +// */ +func _sqlite3PagerDirectReadOk(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* iRead at bp+0 */ Tu32 + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods == uintptr(0) { + return 0 + } + if _sqlite3PCacheIsDirty(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) != 0 { + return 0 + } + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + _sqlite3WalFindFrame(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pgno, bp) + return libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp)) == uint32(0)) + } + return int32(1) +} + +// C documentation +// +// /* +// ** Set the Pager.xGet method for the appropriate routine used to fetch +// ** content from the pager. +// */ +func _setGetterMethod(tls *libc.TLS, pPager uintptr) { + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + (*TPager)(unsafe.Pointer(pPager)).FxGet = __ccgo_fp(_getPageError) + } else { + if (*TPager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + (*TPager)(unsafe.Pointer(pPager)).FxGet = __ccgo_fp(_getPageMMap) + } else { + (*TPager)(unsafe.Pointer(pPager)).FxGet = __ccgo_fp(_getPageNormal) + } + } +} + +// C documentation +// +// /* +// ** Return true if it is necessary to write page *pPg into the sub-journal. +// ** A page needs to be written into the sub-journal if there exists one +// ** or more open savepoints for which: +// ** +// ** * The page-number is less than or equal to PagerSavepoint.nOrig, and +// ** * The bit corresponding to the page-number is not set in +// ** PagerSavepoint.pInSavepoint. +// */ +func _subjRequiresPage(tls *libc.TLS, pPg uintptr) (r int32) { + var i int32 + var p, pPager uintptr + var pgno TPgno + _, _, _, _ = i, p, pPager, pgno + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + pgno = (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno + i = 0 + for { + if !(i < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + p = (*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56 + if (*TPagerSavepoint)(unsafe.Pointer(p)).FnOrig >= pgno && 0 == _sqlite3BitvecTestNotNull(tls, (*TPagerSavepoint)(unsafe.Pointer(p)).FpInSavepoint, pgno) { + i = i + int32(1) + for { + if !(i < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56))).FbTruncateOnRelease = 0 + goto _2 + _2: + ; + i++ + } + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Read a 32-bit integer from the given file descriptor. Store the integer +// ** that is read in *pRes. Return SQLITE_OK if everything worked, or an +// ** error code is something goes wrong. +// ** +// ** All values are stored on disk as big-endian. +// */ +func _read32bits(tls *libc.TLS, fd uintptr, offset Ti64, pRes uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* ac at bp+0 */ [4]uint8 + _ = rc + rc = _sqlite3OsRead(tls, fd, bp, int32(4), offset) + if rc == SQLITE_OK { + *(*Tu32)(unsafe.Pointer(pRes)) = _sqlite3Get4byte(tls, bp) + } + return rc +} + +/* +** Write a 32-bit integer into a string buffer in big-endian byte order. + */ + +// C documentation +// +// /* +// ** Write a 32-bit integer into the given file descriptor. Return SQLITE_OK +// ** on success or an error code is something goes wrong. +// */ +func _write32bits(tls *libc.TLS, fd uintptr, offset Ti64, val Tu32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* ac at bp+0 */ [4]int8 + _sqlite3Put4byte(tls, bp, val) + return _sqlite3OsWrite(tls, fd, bp, int32(4), offset) +} + +// C documentation +// +// /* +// ** Unlock the database file to level eLock, which must be either NO_LOCK +// ** or SHARED_LOCK. Regardless of whether or not the call to xUnlock() +// ** succeeds, set the Pager.eLock variable to match the (attempted) new lock. +// ** +// ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is +// ** called, do not modify it. See the comment above the #define of +// ** UNKNOWN_LOCK for an explanation of this. +// */ +func _pagerUnlockDb(tls *libc.TLS, pPager uintptr, eLock int32) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + rc = SQLITE_OK + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { + if (*TPager)(unsafe.Pointer(pPager)).FnoLock != 0 { + v1 = SQLITE_OK + } else { + v1 = _sqlite3OsUnlock(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, eLock) + } + rc = v1 + if int32((*TPager)(unsafe.Pointer(pPager)).FeLock) != libc.Int32FromInt32(EXCLUSIVE_LOCK)+libc.Int32FromInt32(1) { + (*TPager)(unsafe.Pointer(pPager)).FeLock = uint8(eLock) + } + } + (*TPager)(unsafe.Pointer(pPager)).FchangeCountDone = (*TPager)(unsafe.Pointer(pPager)).FtempFile /* ticket fb3b3024ea238d5c */ + return rc +} + +// C documentation +// +// /* +// ** Lock the database file to level eLock, which must be either SHARED_LOCK, +// ** RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the +// ** Pager.eLock variable to the new locking state. +// ** +// ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is +// ** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK. +// ** See the comment above the #define of UNKNOWN_LOCK for an explanation +// ** of this. +// */ +func _pagerLockDb(tls *libc.TLS, pPager uintptr, eLock int32) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + rc = SQLITE_OK + if int32((*TPager)(unsafe.Pointer(pPager)).FeLock) < eLock || int32((*TPager)(unsafe.Pointer(pPager)).FeLock) == libc.Int32FromInt32(EXCLUSIVE_LOCK)+libc.Int32FromInt32(1) { + if (*TPager)(unsafe.Pointer(pPager)).FnoLock != 0 { + v1 = SQLITE_OK + } else { + v1 = _sqlite3OsLock(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, eLock) + } + rc = v1 + if rc == SQLITE_OK && (int32((*TPager)(unsafe.Pointer(pPager)).FeLock) != libc.Int32FromInt32(EXCLUSIVE_LOCK)+libc.Int32FromInt32(1) || eLock == int32(EXCLUSIVE_LOCK)) { + (*TPager)(unsafe.Pointer(pPager)).FeLock = uint8(eLock) + } + } + return rc +} + +// C documentation +// +// /* +// ** This function determines whether or not the atomic-write or +// ** atomic-batch-write optimizations can be used with this pager. The +// ** atomic-write optimization can be used if: +// ** +// ** (a) the value returned by OsDeviceCharacteristics() indicates that +// ** a database page may be written atomically, and +// ** (b) the value returned by OsSectorSize() is less than or equal +// ** to the page size. +// ** +// ** If it can be used, then the value returned is the size of the journal +// ** file when it contains rollback data for exactly one page. +// ** +// ** The atomic-batch-write optimization can be used if OsDeviceCharacteristics() +// ** returns a value with the SQLITE_IOCAP_BATCH_ATOMIC bit set. -1 is +// ** returned in this case. +// ** +// ** If neither optimization can be used, 0 is returned. +// */ +func _jrnlBufferSize(tls *libc.TLS, pPager uintptr) (r int32) { + _ = pPager + return 0 +} + +/* +** If SQLITE_CHECK_PAGES is defined then we do some sanity checking +** on the cache using a hash function. This is used for testing +** and debugging only. + */ + +// C documentation +// +// /* +// ** When this is called the journal file for pager pPager must be open. +// ** This function attempts to read a super-journal file name from the +// ** end of the file and, if successful, copies it into memory supplied +// ** by the caller. See comments above writeSuperJournal() for the format +// ** used to store a super-journal file name at the end of a journal file. +// ** +// ** zSuper must point to a buffer of at least nSuper bytes allocated by +// ** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is +// ** enough space to write the super-journal name). If the super-journal +// ** name in the journal is longer than nSuper bytes (including a +// ** nul-terminator), then this is handled as if no super-journal name +// ** were present in the journal. +// ** +// ** If a super-journal file name is present at the end of the journal +// ** file, then it is copied into the buffer pointed to by zSuper. A +// ** nul-terminator byte is appended to the buffer following the +// ** super-journal file name. +// ** +// ** If it is determined that no super-journal file name is present +// ** zSuper[0] is set to 0 and SQLITE_OK returned. +// ** +// ** If an error occurs while reading from the journal file, an SQLite +// ** error code is returned. +// */ +func _readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper Tu32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var rc, v1, v2, v4, v6, v8 int32 + var u Tu32 + var v3, v5, v7, v9 bool + var _ /* aMagic at bp+24 */ [8]uint8 + var _ /* cksum at bp+16 */ Tu32 + var _ /* len at bp+0 */ Tu32 + var _ /* szJ at bp+8 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _ = rc, u, v1, v2, v3, v4, v5, v6, v7, v8, v9 /* A buffer to hold the magic header */ + *(*int8)(unsafe.Pointer(zSuper)) = int8('\000') + v1 = _sqlite3OsFileSize(tls, pJrnl, bp+8) + rc = v1 + if v3 = SQLITE_OK != v1 || *(*Ti64)(unsafe.Pointer(bp + 8)) < int64(16); !v3 { + v2 = _read32bits(tls, pJrnl, *(*Ti64)(unsafe.Pointer(bp + 8))-int64(16), bp) + rc = v2 + } + if v5 = v3 || SQLITE_OK != v2 || *(*Tu32)(unsafe.Pointer(bp)) >= nSuper || int64(*(*Tu32)(unsafe.Pointer(bp))) > *(*Ti64)(unsafe.Pointer(bp + 8))-int64(16) || *(*Tu32)(unsafe.Pointer(bp)) == uint32(0); !v5 { + v4 = _read32bits(tls, pJrnl, *(*Ti64)(unsafe.Pointer(bp + 8))-int64(12), bp+16) + rc = v4 + } + if v7 = v5 || SQLITE_OK != v4; !v7 { + v6 = _sqlite3OsRead(tls, pJrnl, bp+24, int32(8), *(*Ti64)(unsafe.Pointer(bp + 8))-int64(8)) + rc = v6 + } + if v9 = v7 || SQLITE_OK != v6 || libc.Xmemcmp(tls, bp+24, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) != 0; !v9 { + v8 = _sqlite3OsRead(tls, pJrnl, zSuper, int32(*(*Tu32)(unsafe.Pointer(bp))), *(*Ti64)(unsafe.Pointer(bp + 8))-int64(16)-int64(*(*Tu32)(unsafe.Pointer(bp)))) + rc = v8 + } + if v9 || SQLITE_OK != v8 { + return rc + } + /* See if the checksum matches the super-journal name */ + u = uint32(0) + for { + if !(u < *(*Tu32)(unsafe.Pointer(bp))) { + break + } + *(*Tu32)(unsafe.Pointer(bp + 16)) -= uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) + goto _10 + _10: + ; + u++ + } + if *(*Tu32)(unsafe.Pointer(bp + 16)) != 0 { + /* If the checksum doesn't add up, then one or more of the disk sectors + ** containing the super-journal filename is corrupted. This means + ** definitely roll back, so just return SQLITE_OK and report a (nul) + ** super-journal filename. + */ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + } + *(*int8)(unsafe.Pointer(zSuper + uintptr(*(*Tu32)(unsafe.Pointer(bp))))) = int8('\000') + *(*int8)(unsafe.Pointer(zSuper + uintptr(*(*Tu32)(unsafe.Pointer(bp))+uint32(1)))) = int8('\000') + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the offset of the sector boundary at or immediately +// ** following the value in pPager->journalOff, assuming a sector +// ** size of pPager->sectorSize bytes. +// ** +// ** i.e for a sector size of 512: +// ** +// ** Pager.journalOff Return value +// ** --------------------------------------- +// ** 0 0 +// ** 512 512 +// ** 100 512 +// ** 2000 2048 +// ** +// */ +func _journalHdrOffset(tls *libc.TLS, pPager uintptr) (r Ti64) { + var c, offset Ti64 + _, _ = c, offset + offset = 0 + c = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + if c != 0 { + offset = ((c-int64(1))/int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) + int64(1)) * int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) + } + return offset +} + +// C documentation +// +// /* +// ** The journal file must be open when this function is called. +// ** +// ** This function is a no-op if the journal file has not been written to +// ** within the current transaction (i.e. if Pager.journalOff==0). +// ** +// ** If doTruncate is non-zero or the Pager.journalSizeLimit variable is +// ** set to 0, then truncate the journal file to zero bytes in size. Otherwise, +// ** zero the 28-byte header at the start of the journal file. In either case, +// ** if the pager is not in no-sync mode, sync the journal file immediately +// ** after writing or truncating it. +// ** +// ** If Pager.journalSizeLimit is set to a positive, non-zero value, and +// ** following the truncation or zeroing described above the size of the +// ** journal file in bytes is larger than this value, then truncate the +// ** journal file to Pager.journalSizeLimit bytes. The journal file does +// ** not need to be synced following this operation. +// ** +// ** If an IO error occurs, abandon processing and return the IO error code. +// ** Otherwise, return SQLITE_OK. +// */ +func _zeroJournalHdr(tls *libc.TLS, pPager uintptr, doTruncate int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iLimit Ti64 + var rc int32 + var _ /* sz at bp+0 */ Ti64 + _, _ = iLimit, rc + rc = SQLITE_OK /* Return code */ + if (*TPager)(unsafe.Pointer(pPager)).FjournalOff != 0 { + iLimit = (*TPager)(unsafe.Pointer(pPager)).FjournalSizeLimit /* Local cache of jsl */ + if doTruncate != 0 || iLimit == 0 { + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, 0) + } else { + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&_zeroHdr)), int32(28), 0) + } + if rc == SQLITE_OK && !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { + rc = _sqlite3OsSync(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, int32(SQLITE_SYNC_DATAONLY)|int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + /* At this point the transaction is committed but the write lock + ** is still held on the file. If there is a size limit configured for + ** the persistent journal and the journal file currently consumes more + ** space than that limit allows for, truncate it now. There is no need + ** to sync the file following this operation. + */ + if rc == SQLITE_OK && iLimit > 0 { + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp) + if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp)) > iLimit { + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iLimit) + } + } + } + return rc +} + +var _zeroHdr = [28]int8{} + +// C documentation +// +// /* +// ** The journal file must be open when this routine is called. A journal +// ** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the +// ** current location. +// ** +// ** The format for the journal header is as follows: +// ** - 8 bytes: Magic identifying journal format. +// ** - 4 bytes: Number of records in journal, or -1 no-sync mode is on. +// ** - 4 bytes: Random number used for page hash. +// ** - 4 bytes: Initial database page count. +// ** - 4 bytes: Sector size used by the process that wrote this journal. +// ** - 4 bytes: Database page size. +// ** +// ** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space. +// */ +func _writeJournalHdr(tls *libc.TLS, pPager uintptr) (r int32) { + var ii, rc int32 + var nHeader, nWrite Tu32 + var zHeader uintptr + var v2 Ti64 + _, _, _, _, _, _ = ii, nHeader, nWrite, rc, zHeader, v2 + rc = SQLITE_OK /* Return code */ + zHeader = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace /* Temporary space used to build header */ + nHeader = uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) /* Loop counter */ + /* Journal file must be open. */ + if nHeader > (*TPager)(unsafe.Pointer(pPager)).FsectorSize { + nHeader = (*TPager)(unsafe.Pointer(pPager)).FsectorSize + } + /* If there are active savepoints and any of them were created + ** since the most recent journal header was written, update the + ** PagerSavepoint.iHdrOffset fields now. + */ + ii = 0 + for { + if !(ii < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + if (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FiHdrOffset == 0 { + (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FiHdrOffset = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + } + goto _1 + _1: + ; + ii++ + } + v2 = _journalHdrOffset(tls, pPager) + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = v2 + (*TPager)(unsafe.Pointer(pPager)).FjournalHdr = v2 + /* + ** Write the nRec Field - the number of page records that follow this + ** journal header. Normally, zero is written to this value at this time. + ** After the records are added to the journal (and the journal synced, + ** if in full-sync mode), the zero is overwritten with the true number + ** of records (see syncJournal()). + ** + ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When + ** reading the journal this value tells SQLite to assume that the + ** rest of the journal file contains valid page records. This assumption + ** is dangerous, as if a failure occurred whilst writing to the journal + ** file it may contain some garbage data. There are two scenarios + ** where this risk can be ignored: + ** + ** * When the pager is in no-sync mode. Corruption can follow a + ** power failure in this case anyway. + ** + ** * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees + ** that garbage data is never appended to the journal file. + */ + if (*TPager)(unsafe.Pointer(pPager)).FnoSync != 0 || int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) || _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd)&int32(SQLITE_IOCAP_SAFE_APPEND) != 0 { + libc.Xmemcpy(tls, zHeader, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) + _sqlite3Put4byte(tls, zHeader+uintptr(8), uint32(0xffffffff)) + } else { + libc.Xmemset(tls, zHeader, 0, libc.Uint64FromInt64(8)+libc.Uint64FromInt32(4)) + } + /* The random check-hash initializer */ + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_MEMORY) { + Xsqlite3_randomness(tls, int32(4), pPager+56) + } + _sqlite3Put4byte(tls, zHeader+uintptr(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(4)), (*TPager)(unsafe.Pointer(pPager)).FcksumInit) + /* The initial database size */ + _sqlite3Put4byte(tls, zHeader+uintptr(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(8)), (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize) + /* The assumed sector size for this process */ + _sqlite3Put4byte(tls, zHeader+uintptr(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(12)), (*TPager)(unsafe.Pointer(pPager)).FsectorSize) + /* The page size */ + _sqlite3Put4byte(tls, zHeader+uintptr(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(16)), uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize)) + /* Initializing the tail of the buffer is not necessary. Everything + ** works find if the following memset() is omitted. But initializing + ** the memory prevents valgrind from complaining, so we are willing to + ** take the performance hit. + */ + libc.Xmemset(tls, zHeader+uintptr(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(20)), 0, uint64(nHeader)-(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(20))) + /* In theory, it is only necessary to write the 28 bytes that the + ** journal header consumes to the journal file here. Then increment the + ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next + ** record is written to the following sector (leaving a gap in the file + ** that will be implicitly filled in by the OS). + ** + ** However it has been discovered that on some systems this pattern can + ** be significantly slower than contiguously writing data to the file, + ** even if that means explicitly writing data to the block of + ** (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what + ** is done. + ** + ** The loop is required here in case the sector-size is larger than the + ** database page size. Since the zHeader buffer is only Pager.pageSize + ** bytes in size, more than one call to sqlite3OsWrite() may be required + ** to populate the entire journal header sector. + */ + nWrite = uint32(0) + for { + if !(rc == SQLITE_OK && nWrite < (*TPager)(unsafe.Pointer(pPager)).FsectorSize) { + break + } + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, zHeader, int32(nHeader), (*TPager)(unsafe.Pointer(pPager)).FjournalOff) + *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nHeader) + goto _3 + _3: + ; + nWrite += nHeader + } + return rc +} + +// C documentation +// +// /* +// ** The journal file must be open when this is called. A journal header file +// ** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal +// ** file. The current location in the journal file is given by +// ** pPager->journalOff. See comments above function writeJournalHdr() for +// ** a description of the journal header format. +// ** +// ** If the header is read successfully, *pNRec is set to the number of +// ** page records following this header and *pDbSize is set to the size of the +// ** database before the transaction began, in pages. Also, pPager->cksumInit +// ** is set to the value read from the journal header. SQLITE_OK is returned +// ** in this case. +// ** +// ** If the journal header file appears to be corrupted, SQLITE_DONE is +// ** returned and *pNRec and *PDbSize are undefined. If JOURNAL_HDR_SZ bytes +// ** cannot be read from the journal file an error code is returned. +// */ +func _readJournalHdr(tls *libc.TLS, pPager uintptr, isHot int32, journalSize Ti64, pNRec uintptr, pDbSize uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iHdrOff Ti64 + var rc, v1, v2, v4, v6, v7 int32 + var v3, v5, v8 bool + var _ /* aMagic at bp+0 */ [8]uint8 + var _ /* iPageSize at bp+8 */ Tu32 + var _ /* iSectorSize at bp+12 */ Tu32 + _, _, _, _, _, _, _, _, _, _ = iHdrOff, rc, v1, v2, v3, v4, v5, v6, v7, v8 /* Offset of journal header being read */ + /* Journal file must be open. */ + /* Advance Pager.journalOff to the start of the next sector. If the + ** journal file is too small for there to be a header stored at this + ** point, return SQLITE_DONE. + */ + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = _journalHdrOffset(tls, pPager) + if (*TPager)(unsafe.Pointer(pPager)).FjournalOff+int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) > journalSize { + return int32(SQLITE_DONE) + } + iHdrOff = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + /* Read in the first 8 bytes of the journal header. If they do not match + ** the magic string found at the start of each journal header, return + ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise, + ** proceed. + */ + if isHot != 0 || iHdrOff != (*TPager)(unsafe.Pointer(pPager)).FjournalHdr { + rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp, int32(8), iHdrOff) + if rc != 0 { + return rc + } + if libc.Xmemcmp(tls, bp, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) != 0 { + return int32(SQLITE_DONE) + } + } + /* Read the first three 32-bit fields of the journal header: The nRec + ** field, the checksum-initializer and the database size at the start + ** of the transaction. Return an error code if anything goes wrong. + */ + v1 = _read32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(8), pNRec) + rc = v1 + if v3 = SQLITE_OK != v1; !v3 { + v2 = _read32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(12), pPager+56) + rc = v2 + } + if v5 = v3 || SQLITE_OK != v2; !v5 { + v4 = _read32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(16), pDbSize) + rc = v4 + } + if v5 || SQLITE_OK != v4 { + return rc + } + if (*TPager)(unsafe.Pointer(pPager)).FjournalOff == 0 { /* Sector-size field of journal header */ + /* Read the page-size and sector-size journal header fields. */ + v6 = _read32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(20), bp+12) + rc = v6 + if v8 = SQLITE_OK != v6; !v8 { + v7 = _read32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(24), bp+8) + rc = v7 + } + if v8 || SQLITE_OK != v7 { + return rc + } + /* Versions of SQLite prior to 3.5.8 set the page-size field of the + ** journal header to zero. In this case, assume that the Pager.pageSize + ** variable is already set to the correct page size. + */ + if *(*Tu32)(unsafe.Pointer(bp + 8)) == uint32(0) { + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) + } + /* Check that the values read from the page-size and sector-size fields + ** are within range. To be 'in range', both values need to be a power + ** of two greater than or equal to 512 or 32, and not greater than their + ** respective compile time maximum limits. + */ + if *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(512) || *(*Tu32)(unsafe.Pointer(bp + 12)) < uint32(32) || *(*Tu32)(unsafe.Pointer(bp + 8)) > uint32(SQLITE_MAX_PAGE_SIZE) || *(*Tu32)(unsafe.Pointer(bp + 12)) > uint32(MAX_SECTOR_SIZE) || (*(*Tu32)(unsafe.Pointer(bp + 8))-uint32(1))&*(*Tu32)(unsafe.Pointer(bp + 8)) != uint32(0) || (*(*Tu32)(unsafe.Pointer(bp + 12))-uint32(1))&*(*Tu32)(unsafe.Pointer(bp + 12)) != uint32(0) { + /* If the either the page-size or sector-size in the journal-header is + ** invalid, then the process that wrote the journal-header must have + ** crashed before the header was synced. In this case stop reading + ** the journal file here. + */ + return int32(SQLITE_DONE) + } + /* Update the page-size to match the value read from the journal. + ** Use a testcase() macro to make sure that malloc failure within + ** PagerSetPagesize() is tested. + */ + rc = _sqlite3PagerSetPagesize(tls, pPager, bp+8, -int32(1)) + /* Update the assumed sector-size to match the value used by + ** the process that created this journal. If this journal was + ** created by a process other than this one, then this routine + ** is being called from within pager_playback(). The local value + ** of Pager.sectorSize is restored at the end of that routine. + */ + (*TPager)(unsafe.Pointer(pPager)).FsectorSize = *(*Tu32)(unsafe.Pointer(bp + 12)) + } + *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) + return rc +} + +// C documentation +// +// /* +// ** Write the supplied super-journal name into the journal file for pager +// ** pPager at the current location. The super-journal name must be the last +// ** thing written to a journal file. If the pager is in full-sync mode, the +// ** journal file descriptor is advanced to the next sector boundary before +// ** anything is written. The format is: +// ** +// ** + 4 bytes: PAGER_SJ_PGNO. +// ** + N bytes: super-journal filename in utf-8. +// ** + 4 bytes: N (length of super-journal name in bytes, no nul-terminator). +// ** + 4 bytes: super-journal name checksum. +// ** + 8 bytes: aJournalMagic[]. +// ** +// ** The super-journal page checksum is the sum of the bytes in the super-journal +// ** name, where each byte is interpreted as a signed 8-bit integer. +// ** +// ** If zSuper is a NULL pointer (occurs for a single database transaction), +// ** this call is a no-op. +// */ +func _writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var cksum Tu32 + var iHdrOff Ti64 + var nSuper, rc, v11, v2, v3, v5, v7, v9 int32 + var v10, v4, v6, v8 bool + var _ /* jrnlSize at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cksum, iHdrOff, nSuper, rc, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9 /* Size of journal file on disk */ + cksum = uint32(0) /* Checksum of string zSuper */ + if !(zSuper != 0) || int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) || !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0)) { + return SQLITE_OK + } + (*TPager)(unsafe.Pointer(pPager)).FsetSuper = uint8(1) + /* Calculate the length in bytes and the checksum of zSuper */ + nSuper = 0 + for { + if !(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper))) != 0) { + break + } + cksum += uint32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper)))) + goto _1 + _1: + ; + nSuper++ + } + /* If in full-sync mode, advance to the next disk sector before writing + ** the super-journal name. This is in case the previous page written to + ** the journal has already been synced. + */ + if (*TPager)(unsafe.Pointer(pPager)).FfullSync != 0 { + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = _journalHdrOffset(tls, pPager) + } + iHdrOff = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + /* Write the super-journal data to the end of the journal file. If + ** an error occurs, return the error code to the caller. + */ + v2 = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff, (*TPager)(unsafe.Pointer(pPager)).FlckPgno) + rc = v2 + if v4 = 0 != v2; !v4 { + v3 = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, zSuper, nSuper, iHdrOff+int64(4)) + rc = v3 + } + if v6 = v4 || 0 != v3; !v6 { + v5 = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(4)+int64(nSuper), uint32(nSuper)) + rc = v5 + } + if v8 = v6 || 0 != v5; !v8 { + v7 = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff+int64(4)+int64(nSuper)+int64(4), cksum) + rc = v7 + } + if v10 = v8 || 0 != v7; !v10 { + v9 = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&_aJournalMagic)), int32(8), iHdrOff+int64(4)+int64(nSuper)+int64(8)) + rc = v9 + } + if v10 || 0 != v9 { + return rc + } + *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(nSuper + libc.Int32FromInt32(20)) + /* If the pager is in persistent-journal mode, then the physical + ** journal-file may extend past the end of the super-journal name + ** and 8 bytes of magic data just written to the file. This is + ** dangerous because the code to rollback a hot-journal file + ** will not be able to find the super-journal name to determine + ** whether or not the journal is hot. + ** + ** Easiest thing to do in this scenario is to truncate the journal + ** file to the required size. + */ + v11 = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp) + rc = v11 + if SQLITE_OK == v11 && *(*Ti64)(unsafe.Pointer(bp)) > (*TPager)(unsafe.Pointer(pPager)).FjournalOff { + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, (*TPager)(unsafe.Pointer(pPager)).FjournalOff) + } + return rc +} + +// C documentation +// +// /* +// ** Discard the entire contents of the in-memory page-cache. +// */ +func _pager_reset(tls *libc.TLS, pPager uintptr) { + (*TPager)(unsafe.Pointer(pPager)).FiDataVersion++ + _sqlite3BackupRestart(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup) + _sqlite3PcacheClear(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) +} + +// C documentation +// +// /* +// ** Return the pPager->iDataVersion value +// */ +func _sqlite3PagerDataVersion(tls *libc.TLS, pPager uintptr) (r Tu32) { + return (*TPager)(unsafe.Pointer(pPager)).FiDataVersion +} + +// C documentation +// +// /* +// ** Free all structures in the Pager.aSavepoint[] array and set both +// ** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal +// ** if it is open and the pager is not in exclusive mode. +// */ +func _releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { + var ii int32 + _ = ii /* Iterator for looping through Pager.aSavepoint */ + ii = 0 + for { + if !(ii < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) + goto _1 + _1: + ; + ii++ + } + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) + } + Xsqlite3_free(tls, (*TPager)(unsafe.Pointer(pPager)).FaSavepoint) + (*TPager)(unsafe.Pointer(pPager)).FaSavepoint = uintptr(0) + (*TPager)(unsafe.Pointer(pPager)).FnSavepoint = 0 + (*TPager)(unsafe.Pointer(pPager)).FnSubRec = uint32(0) +} + +// C documentation +// +// /* +// ** Set the bit number pgno in the PagerSavepoint.pInSavepoint +// ** bitvecs of all open savepoints. Return SQLITE_OK if successful +// ** or SQLITE_NOMEM if a malloc failure occurs. +// */ +func _addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno TPgno) (r int32) { + var ii, rc int32 + var p uintptr + _, _, _ = ii, p, rc /* Loop counter */ + rc = SQLITE_OK /* Result code */ + ii = 0 + for { + if !(ii < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + p = (*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56 + if pgno <= (*TPagerSavepoint)(unsafe.Pointer(p)).FnOrig { + rc |= _sqlite3BitvecSet(tls, (*TPagerSavepoint)(unsafe.Pointer(p)).FpInSavepoint, pgno) + } + goto _1 + _1: + ; + ii++ + } + return rc +} + +// C documentation +// +// /* +// ** This function is a no-op if the pager is in exclusive mode and not +// ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN +// ** state. +// ** +// ** If the pager is not in exclusive-access mode, the database file is +// ** completely unlocked. If the file is unlocked and the file-system does +// ** not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is +// ** closed (if it is open). +// ** +// ** If the pager is in ERROR state when this function is called, the +// ** contents of the pager cache are discarded before switching back to +// ** the OPEN state. Regardless of whether the pager is in exclusive-mode +// ** or not, any journal file left in the file-system will be treated +// ** as a hot-journal and rolled back the next time a read-transaction +// ** is opened (by this or by any other connection). +// */ +func _pager_unlock(tls *libc.TLS, pPager uintptr) { + var iDc, rc, v1, v2 int32 + _, _, _, _ = iDc, rc, v1, v2 + _sqlite3BitvecDestroy(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal) + (*TPager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + _releaseAllSavepoints(tls, pPager) + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + _sqlite3WalEndReadTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) + } else { + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) { + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { + v1 = _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd) + } else { + v1 = 0 + } /* Error code returned by pagerUnlockDb() */ + iDc = v1 + /* If the operating system support deletion of open files, then + ** close the journal file when dropping the database lock. Otherwise + ** another connection with journal_mode=delete might delete the file + ** out from under us. + */ + if 0 == iDc&int32(SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) || int32(1) != int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode)&int32(5) { + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + } + /* If the pager is in the ERROR state and the call to unlock the database + ** file fails, set the current lock to UNKNOWN_LOCK. See the comment + ** above the #define for UNKNOWN_LOCK for an explanation of why this + ** is necessary. + */ + rc = _pagerUnlockDb(tls, pPager, NO_LOCK) + if rc != SQLITE_OK && int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_ERROR) { + (*TPager)(unsafe.Pointer(pPager)).FeLock = uint8(libc.Int32FromInt32(EXCLUSIVE_LOCK) + libc.Int32FromInt32(1)) + } + /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here + ** without clearing the error code. This is intentional - the error + ** code is cleared and the cache reset in the block below. + */ + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) + } + } + /* If Pager.errCode is set, the contents of the pager cache cannot be + ** trusted. Now that there are no outstanding references to the pager, + ** it can safely move back to PAGER_OPEN state. This happens in both + ** normal and exclusive-locking mode. + */ + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + _pager_reset(tls, pPager) + (*TPager)(unsafe.Pointer(pPager)).FchangeCountDone = uint8(0) + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) + } else { + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { + v2 = PAGER_OPEN + } else { + v2 = int32(PAGER_READER) + } + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(v2) + } + if (*TPager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, 0, uintptr(0)) + } + (*TPager)(unsafe.Pointer(pPager)).FerrCode = SQLITE_OK + _setGetterMethod(tls, pPager) + } + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + (*TPager)(unsafe.Pointer(pPager)).FjournalHdr = 0 + (*TPager)(unsafe.Pointer(pPager)).FsetSuper = uint8(0) +} + +// C documentation +// +// /* +// ** This function is called whenever an IOERR or FULL error that requires +// ** the pager to transition into the ERROR state may have occurred. +// ** The first argument is a pointer to the pager structure, the second +// ** the error-code about to be returned by a pager API function. The +// ** value returned is a copy of the second argument to this function. +// ** +// ** If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the +// ** IOERR sub-codes, the pager enters the ERROR state and the error code +// ** is stored in Pager.errCode. While the pager remains in the ERROR state, +// ** all major API calls on the Pager will immediately return Pager.errCode. +// ** +// ** The ERROR state indicates that the contents of the pager-cache +// ** cannot be trusted. This state can be cleared by completely discarding +// ** the contents of the pager-cache. If a transaction was active when +// ** the persistent error occurred, then the rollback journal may need +// ** to be replayed to restore the contents of the database file (as if +// ** it were a hot-journal). +// */ +func _pager_error(tls *libc.TLS, pPager uintptr, rc int32) (r int32) { + var rc2 int32 + _ = rc2 + rc2 = rc & int32(0xff) + if rc2 == int32(SQLITE_FULL) || rc2 == int32(SQLITE_IOERR) { + (*TPager)(unsafe.Pointer(pPager)).FerrCode = rc + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_ERROR) + _setGetterMethod(tls, pPager) + } + return rc +} + +// C documentation +// +// /* +// ** The write transaction open on pPager is being committed (bCommit==1) +// ** or rolled back (bCommit==0). +// ** +// ** Return TRUE if and only if all dirty pages should be flushed to disk. +// ** +// ** Rules: +// ** +// ** * For non-TEMP databases, always sync to disk. This is necessary +// ** for transactions to be durable. +// ** +// ** * Sync TEMP database only on a COMMIT (not a ROLLBACK) when the backing +// ** file has been created already (via a spill on pagerStress()) and +// ** when the number of dirty pages in memory exceeds 25% of the total +// ** cache size. +// */ +func _pagerFlushOnCommit(tls *libc.TLS, pPager uintptr, bCommit int32) (r int32) { + if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + return int32(1) + } + if !(bCommit != 0) { + return 0 + } + if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != libc.UintptrFromInt32(0)) { + return 0 + } + return libc.BoolInt32(_sqlite3PCachePercentDirty(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) >= int32(25)) +} + +// C documentation +// +// /* +// ** This routine ends a transaction. A transaction is usually ended by +// ** either a COMMIT or a ROLLBACK operation. This routine may be called +// ** after rollback of a hot-journal, or if an error occurs while opening +// ** the journal file or writing the very first journal-header of a +// ** database transaction. +// ** +// ** This routine is never called in PAGER_ERROR state. If it is called +// ** in PAGER_NONE or PAGER_SHARED state and the lock held is less +// ** exclusive than a RESERVED lock, it is a no-op. +// ** +// ** Otherwise, any active savepoints are released. +// ** +// ** If the journal file is open, then it is "finalized". Once a journal +// ** file has been finalized it is not possible to use it to roll back a +// ** transaction. Nor will it be considered to be a hot-journal by this +// ** or any other database connection. Exactly how a journal is finalized +// ** depends on whether or not the pager is running in exclusive mode and +// ** the current journal-mode (Pager.journalMode value), as follows: +// ** +// ** journalMode==MEMORY +// ** Journal file descriptor is simply closed. This destroys an +// ** in-memory journal. +// ** +// ** journalMode==TRUNCATE +// ** Journal file is truncated to zero bytes in size. +// ** +// ** journalMode==PERSIST +// ** The first 28 bytes of the journal file are zeroed. This invalidates +// ** the first journal header in the file, and hence the entire journal +// ** file. An invalid journal file cannot be rolled back. +// ** +// ** journalMode==DELETE +// ** The journal file is closed and deleted using sqlite3OsDelete(). +// ** +// ** If the pager is running in exclusive mode, this method of finalizing +// ** the journal file is never used. Instead, if the journalMode is +// ** DELETE and the pager is in exclusive mode, the method described under +// ** journalMode==PERSIST is used instead. +// ** +// ** After the journal is finalized, the pager moves to PAGER_READER state. +// ** If running in non-exclusive rollback mode, the lock on the file is +// ** downgraded to a SHARED_LOCK. +// ** +// ** SQLITE_OK is returned if no error occurs. If an error occurs during +// ** any of the IO operations to finalize the journal file or unlock the +// ** database then the IO error code is returned to the user. If the +// ** operation to finalize the journal file fails, then the code still +// ** tries to unlock the database file if not in exclusive mode. If the +// ** unlock operation fails as well, then the first error code related +// ** to the first error encountered (the journal finalization one) is +// ** returned. +// */ +func _pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bCommit int32) (r int32) { + var bDelete, rc, rc2, v1 int32 + _, _, _, _ = bDelete, rc, rc2, v1 + rc = SQLITE_OK /* Error code from journal finalization operation */ + rc2 = SQLITE_OK /* Error code from db file unlock operation */ + /* Do nothing if the pager does not have an open write transaction + ** or at least a RESERVED lock. This function may be called when there + ** is no write-transaction active but a RESERVED or greater lock is + ** held under two circumstances: + ** + ** 1. After a successful hot-journal rollback, it is called with + ** eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK. + ** + ** 2. If a connection with locking_mode=exclusive holding an EXCLUSIVE + ** lock switches back to locking_mode=normal and then executes a + ** read-transaction, this function is called with eState==PAGER_READER + ** and eLock==EXCLUSIVE_LOCK when the read-transaction is closed. + */ + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) < int32(PAGER_WRITER_LOCKED) && int32((*TPager)(unsafe.Pointer(pPager)).FeLock) < int32(RESERVED_LOCK) { + return SQLITE_OK + } + _releaseAllSavepoints(tls, pPager) + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { + /* Finalize the journal file. */ + if _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) != 0 { + /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */ + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + } else { + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_TRUNCATE) { + if (*TPager)(unsafe.Pointer(pPager)).FjournalOff == 0 { + rc = SQLITE_OK + } else { + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, 0) + if rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FfullSync != 0 { + /* Make sure the new file size is written into the inode right away. + ** Otherwise the journal might resurrect following a power loss and + ** cause the last transaction to roll back. See + ** https://bugzilla.mozilla.org/show_bug.cgi?id=1072773 + */ + rc = _sqlite3OsSync(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + } + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + } else { + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_PERSIST) || (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_WAL) { + rc = _zeroJournalHdr(tls, pPager, libc.BoolInt32(hasSuper != 0 || (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0)) + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + } else { + /* This branch may be executed with Pager.journalMode==MEMORY if + ** a hot-journal was just rolled back. In this case the journal + ** file should be closed and deleted. If this connection writes to + ** the database file, it will do so using an in-memory journal. + */ + bDelete = libc.BoolInt32(!((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0)) + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + if bDelete != 0 { + rc = _sqlite3OsDelete(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, int32((*TPager)(unsafe.Pointer(pPager)).FextraSync)) + } + } + } + } + } + _sqlite3BitvecDestroy(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal) + (*TPager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + (*TPager)(unsafe.Pointer(pPager)).FnRec = 0 + if rc == SQLITE_OK { + if (*TPager)(unsafe.Pointer(pPager)).FmemDb != 0 || _pagerFlushOnCommit(tls, pPager, bCommit) != 0 { + _sqlite3PcacheCleanAll(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + } else { + _sqlite3PcacheClearWritable(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + } + _sqlite3PcacheTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, (*TPager)(unsafe.Pointer(pPager)).FdbSize) + } + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + /* Drop the WAL write-lock, if any. Also, if the connection was in + ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE + ** lock held on the database file. + */ + rc2 = _sqlite3WalEndWriteTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + } else { + if rc == SQLITE_OK && bCommit != 0 && (*TPager)(unsafe.Pointer(pPager)).FdbFileSize > (*TPager)(unsafe.Pointer(pPager)).FdbSize { + /* This branch is taken when committing a transaction in rollback-journal + ** mode if the database file on disk is larger than the database image. + ** At this point the journal has been finalized and the transaction + ** successfully committed, but the EXCLUSIVE lock is still held on the + ** file. So it is safe to truncate the database file to its minimum + ** required size. */ + rc = _pager_truncate(tls, pPager, (*TPager)(unsafe.Pointer(pPager)).FdbSize) + } + } + if rc == SQLITE_OK && bCommit != 0 { + rc = _sqlite3OsFileControl(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_COMMIT_PHASETWO), uintptr(0)) + if rc == int32(SQLITE_NOTFOUND) { + rc = SQLITE_OK + } + } + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) && (!((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) || _sqlite3WalExclusiveMode(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, 0) != 0) { + rc2 = _pagerUnlockDb(tls, pPager, int32(SHARED_LOCK)) + } + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_READER) + (*TPager)(unsafe.Pointer(pPager)).FsetSuper = uint8(0) + if rc == SQLITE_OK { + v1 = rc2 + } else { + v1 = rc + } + return v1 +} + +// C documentation +// +// /* +// ** Execute a rollback if a transaction is active and unlock the +// ** database file. +// ** +// ** If the pager has already entered the ERROR state, do not attempt +// ** the rollback at this time. Instead, pager_unlock() is called. The +// ** call to pager_unlock() will discard all in-memory pages, unlock +// ** the database file and move the pager back to OPEN state. If this +// ** means that there is a hot-journal left in the file-system, the next +// ** connection to obtain a shared lock on the pager (which may be this one) +// ** will roll it back. +// ** +// ** If the pager has not already entered the ERROR state, but an IO or +// ** malloc error occurs during a rollback, then this will itself cause +// ** the pager to enter the ERROR state. Which will be cleared by the +// ** call to pager_unlock(), as described above. +// */ +func _pagerUnlockAndRollback(tls *libc.TLS, pPager uintptr) { + var eLock Tu8 + var errCode int32 + _, _ = eLock, errCode + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) != int32(PAGER_ERROR) && int32((*TPager)(unsafe.Pointer(pPager)).FeState) != PAGER_OPEN { + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_LOCKED) { + _sqlite3BeginBenignMalloc(tls) + _sqlite3PagerRollback(tls, pPager) + _sqlite3EndBenignMalloc(tls) + } else { + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) { + _pager_end_transaction(tls, pPager, 0, 0) + } + } + } else { + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_ERROR) && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) && (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { + /* Special case for a ROLLBACK due to I/O error with an in-memory + ** journal: We have to rollback immediately, before the journal is + ** closed, because once it is closed, all content is forgotten. */ + errCode = (*TPager)(unsafe.Pointer(pPager)).FerrCode + eLock = (*TPager)(unsafe.Pointer(pPager)).FeLock + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) + (*TPager)(unsafe.Pointer(pPager)).FerrCode = SQLITE_OK + (*TPager)(unsafe.Pointer(pPager)).FeLock = uint8(EXCLUSIVE_LOCK) + _pager_playback(tls, pPager, int32(1)) + (*TPager)(unsafe.Pointer(pPager)).FerrCode = errCode + (*TPager)(unsafe.Pointer(pPager)).FeLock = eLock + } + } + _pager_unlock(tls, pPager) +} + +// C documentation +// +// /* +// ** Parameter aData must point to a buffer of pPager->pageSize bytes +// ** of data. Compute and return a checksum based on the contents of the +// ** page of data and the current value of pPager->cksumInit. +// ** +// ** This is not a real checksum. It is really just the sum of the +// ** random initial value (pPager->cksumInit) and every 200th byte +// ** of the page data, starting with byte offset (pPager->pageSize%200). +// ** Each byte is interpreted as an 8-bit unsigned integer. +// ** +// ** Changing the formula used to compute this checksum results in an +// ** incompatible journal file format. +// ** +// ** If journal corruption occurs due to a power failure, the most likely +// ** scenario is that one end or the other of the record will be changed. +// ** It is much less likely that the two ends of the journal record will be +// ** correct and the middle be corrupt. Thus, this "checksum" scheme, +// ** though fast and simple, catches the mostly likely kind of corruption. +// */ +func _pager_cksum(tls *libc.TLS, pPager uintptr, aData uintptr) (r Tu32) { + var cksum Tu32 + var i int32 + _, _ = cksum, i + cksum = (*TPager)(unsafe.Pointer(pPager)).FcksumInit /* Checksum value to return */ + i = int32((*TPager)(unsafe.Pointer(pPager)).FpageSize - int64(200)) /* Loop counter */ + for i > 0 { + cksum += uint32(*(*Tu8)(unsafe.Pointer(aData + uintptr(i)))) + i -= int32(200) + } + return cksum +} + +// C documentation +// +// /* +// ** Read a single page from either the journal file (if isMainJrnl==1) or +// ** from the sub-journal (if isMainJrnl==0) and playback that page. +// ** The page begins at offset *pOffset into the file. The *pOffset +// ** value is increased to the start of the next page in the journal. +// ** +// ** The main rollback journal uses checksums - the statement journal does +// ** not. +// ** +// ** If the page number of the page record read from the (sub-)journal file +// ** is greater than the current value of Pager.dbSize, then playback is +// ** skipped and SQLITE_OK is returned. +// ** +// ** If pDone is not NULL, then it is a record of pages that have already +// ** been played back. If the page at *pOffset has already been played back +// ** (if the corresponding pDone bit is set) then skip the playback. +// ** Make sure the pDone bit corresponding to the *pOffset page is set +// ** prior to returning. +// ** +// ** If the page record is successfully read from the (sub-)journal file +// ** and played back, then SQLITE_OK is returned. If an IO error occurs +// ** while reading the record from the (sub-)journal file or while writing +// ** to the database file, then the IO error code is returned. If data +// ** is successfully read from the (sub-)journal file but appears to be +// ** corrupted, SQLITE_DONE is returned. Data is considered corrupted in +// ** two circumstances: +// ** +// ** * If the record page-number is illegal (0 or PAGER_SJ_PGNO), or +// ** * If the record is being rolled back from the main journal file +// ** and the checksum field does not match the record content. +// ** +// ** Neither of these two scenarios are possible during a savepoint rollback. +// ** +// ** If this is a savepoint rollback, then memory may have to be dynamically +// ** allocated by this function. If this is the case and an allocation fails, +// ** SQLITE_NOMEM is returned. +// */ +func _pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pDone uintptr, isMainJrnl int32, isSavepnt int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aData, jfd, pData, v1, p4, p5 uintptr + var isSynced, rc, v2 int32 + var ofst Ti64 + var v3 bool + var _ /* cksum at bp+12 */ Tu32 + var _ /* pPg at bp+0 */ uintptr + var _ /* pgno at bp+8 */ TPgno + _, _, _, _, _, _, _, _, _, _, _ = aData, isSynced, jfd, ofst, pData, rc, v1, v2, v3, p4, p5 /* True if journal page is synced */ + /* isMainJrnl is 0 or 1 */ + /* isSavepnt is 0 or 1 */ + /* pDone always used on sub-journals */ + /* pDone never used on non-savepoint */ + aData = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace + /* Temp storage must have already been allocated */ + /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction + ** or savepoint rollback done at the request of the caller) or this is + ** a hot-journal rollback. If it is a hot-journal rollback, the pager + ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback + ** only reads from the main journal, not the sub-journal. + */ + /* Read the page number and page data from the journal or sub-journal + ** file. Return an error code to the caller if an IO error occurs. + */ + if isMainJrnl != 0 { + v1 = (*TPager)(unsafe.Pointer(pPager)).Fjfd + } else { + v1 = (*TPager)(unsafe.Pointer(pPager)).Fsjfd + } + jfd = v1 + rc = _read32bits(tls, jfd, *(*Ti64)(unsafe.Pointer(pOffset)), bp+8) + if rc != SQLITE_OK { + return rc + } + rc = _sqlite3OsRead(tls, jfd, aData, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), *(*Ti64)(unsafe.Pointer(pOffset))+int64(4)) + if rc != SQLITE_OK { + return rc + } + *(*Ti64)(unsafe.Pointer(pOffset)) += (*TPager)(unsafe.Pointer(pPager)).FpageSize + int64(4) + int64(isMainJrnl*int32(4)) + /* Sanity checking on the page. This is more important that I originally + ** thought. If a power failure occurs while the journal is being written, + ** it could cause invalid data to be written into the journal. We need to + ** detect this invalid data (with high probability) and ignore it. + */ + if *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(0) || *(*TPgno)(unsafe.Pointer(bp + 8)) == (*TPager)(unsafe.Pointer(pPager)).FlckPgno { + return int32(SQLITE_DONE) + } + if *(*TPgno)(unsafe.Pointer(bp + 8)) > (*TPager)(unsafe.Pointer(pPager)).FdbSize || _sqlite3BitvecTest(tls, pDone, *(*TPgno)(unsafe.Pointer(bp + 8))) != 0 { + return SQLITE_OK + } + if isMainJrnl != 0 { + rc = _read32bits(tls, jfd, *(*Ti64)(unsafe.Pointer(pOffset))-int64(4), bp+12) + if rc != 0 { + return rc + } + if !(isSavepnt != 0) && _pager_cksum(tls, pPager, aData) != *(*Tu32)(unsafe.Pointer(bp + 12)) { + return int32(SQLITE_DONE) + } + } + /* If this page has already been played back before during the current + ** rollback, then don't bother to play it back again. + */ + if v3 = pDone != 0; v3 { + v2 = _sqlite3BitvecSet(tls, pDone, *(*TPgno)(unsafe.Pointer(bp + 8))) + rc = v2 + } + if v3 && v2 != SQLITE_OK { + return rc + } + /* When playing back page 1, restore the nReserve setting + */ + if *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(1) && int32((*TPager)(unsafe.Pointer(pPager)).FnReserve) != int32(*(*Tu8)(unsafe.Pointer(aData + 20))) { + (*TPager)(unsafe.Pointer(pPager)).FnReserve = int16(*(*Tu8)(unsafe.Pointer(aData + 20))) + } + /* If the pager is in CACHEMOD state, then there must be a copy of this + ** page in the pager cache. In this case just update the pager cache, + ** not the database file. The page is left marked dirty in this case. + ** + ** An exception to the above rule: If the database is in no-sync mode + ** and a page is moved during an incremental vacuum then the page may + ** not be in the pager cache. Later: if a malloc() or IO error occurs + ** during a Movepage() call, then the page may not be in the cache + ** either. So the condition described in the above paragraph is not + ** assert()able. + ** + ** If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the + ** pager cache if it exists and the main file. The page is then marked + ** not dirty. Since this code is only executed in PAGER_OPEN state for + ** a hot-journal rollback, it is guaranteed that the page-cache is empty + ** if the pager is in OPEN state. + ** + ** Ticket #1171: The statement journal might contain page content that is + ** different from the page content at the start of the transaction. + ** This occurs when a page is changed prior to the start of a statement + ** then changed again within the statement. When rolling back such a + ** statement we must not write to the original database unless we know + ** for certain that original page contents are synced into the main rollback + ** journal. Otherwise, a power loss might leave modified data in the + ** database file without an entry in the rollback journal that can + ** restore the database to its original form. Two conditions must be + ** met before writing to the database files. (1) the database must be + ** locked. (2) we know that the original page content is fully synced + ** in the main journal either because the page is not in cache or else + ** the page is marked as needSync==0. + ** + ** 2008-04-14: When attempting to vacuum a corrupt database file, it + ** is possible to fail a statement on a database that does not yet exist. + ** Do not attempt to write if database file has never been opened. + */ + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3PagerLookup(tls, pPager, *(*TPgno)(unsafe.Pointer(bp + 8))) + } + if isMainJrnl != 0 { + isSynced = libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0 || *(*Ti64)(unsafe.Pointer(pOffset)) <= (*TPager)(unsafe.Pointer(pPager)).FjournalHdr) + } else { + isSynced = libc.BoolInt32(*(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) || 0 == int32((*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&int32(PGHDR_NEED_SYNC)) + } + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_DBMOD) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN) && isSynced != 0 { + ofst = int64(*(*TPgno)(unsafe.Pointer(bp + 8))-libc.Uint32FromInt32(1)) * (*TPager)(unsafe.Pointer(pPager)).FpageSize + /* Write the data read from the journal back into the database file. + ** This is usually safe even for an encrypted database - as the data + ** was encrypted before it was written to the journal file. The exception + ** is if the data was just read from an in-memory sub-journal. In that + ** case it must be encrypted here before it is copied into the database + ** file. */ + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, aData, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), ofst) + if *(*TPgno)(unsafe.Pointer(bp + 8)) > (*TPager)(unsafe.Pointer(pPager)).FdbFileSize { + (*TPager)(unsafe.Pointer(pPager)).FdbFileSize = *(*TPgno)(unsafe.Pointer(bp + 8)) + } + if (*TPager)(unsafe.Pointer(pPager)).FpBackup != 0 { + _sqlite3BackupUpdate(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup, *(*TPgno)(unsafe.Pointer(bp + 8)), aData) + } + } else { + if !(isMainJrnl != 0) && *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + /* If this is a rollback of a savepoint and data was not written to + ** the database and the page is not in-memory, there is a potential + ** problem. When the page is next fetched by the b-tree layer, it + ** will be read from the database file, which may or may not be + ** current. + ** + ** There are a couple of different ways this can happen. All are quite + ** obscure. When running in synchronous mode, this can only happen + ** if the page is on the free-list at the start of the transaction, then + ** populated, then moved using sqlite3PagerMovepage(). + ** + ** The solution is to add an in-memory page to the cache containing + ** the data just read from the sub-journal. Mark the page as dirty + ** and if the pager requires a journal-sync, then mark the page as + ** requiring a journal-sync before it is written. + */ + p4 = pPager + 25 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | libc.Int32FromInt32(SPILLFLAG_ROLLBACK)) + rc = _sqlite3PagerGet(tls, pPager, *(*TPgno)(unsafe.Pointer(bp + 8)), bp, int32(1)) + p5 = pPager + 25 + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^libc.Int32FromInt32(SPILLFLAG_ROLLBACK)) + if rc != SQLITE_OK { + return rc + } + _sqlite3PcacheMakeDirty(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + pData = (*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpData + libc.Xmemcpy(tls, pData, aData, uint64((*TPager)(unsafe.Pointer(pPager)).FpageSize)) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TPager)(unsafe.Pointer(pPager)).FxReiniter})))(tls, *(*uintptr)(unsafe.Pointer(bp))) + /* It used to be that sqlite3PcacheMakeClean(pPg) was called here. But + ** that call was dangerous and had no detectable benefit since the cache + ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so + ** has been removed. */ + /* If this was page 1, then restore the value of Pager.dbFileVers. + ** Do this before any decoding. */ + if *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(1) { + libc.Xmemcpy(tls, pPager+136, pData+24, uint64(16)) + } + _sqlite3PcacheRelease(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Parameter zSuper is the name of a super-journal file. A single journal +// ** file that referred to the super-journal file has just been rolled back. +// ** This routine checks if it is possible to delete the super-journal file, +// ** and does so if it is. +// ** +// ** Argument zSuper may point to Pager.pTmpSpace. So that buffer is not +// ** available for use within this function. +// ** +// ** When a super-journal file is created, it is populated with the names +// ** of all of its child journals, one after another, formatted as utf-8 +// ** encoded text. The end of each child journal file is marked with a +// ** nul-terminator byte (0x00). i.e. the entire contents of a super-journal +// ** file for a transaction involving two databases might be: +// ** +// ** "/home/bill/a.db-journal\x00/home/bill/b.db-journal\x00" +// ** +// ** A super-journal file may only be deleted once all of its child +// ** journals have been rolled back. +// ** +// ** This function reads the contents of the super-journal file into +// ** memory and loops through each of the child journal names. For +// ** each child journal, it checks if: +// ** +// ** * if the child journal exists, and if so +// ** * if the child journal contains a reference to super-journal +// ** file zSuper +// ** +// ** If a child journal can be found that matches both of the criteria +// ** above, this function returns without doing anything. Otherwise, if +// ** no such child journal can be found, file zSuper is deleted from +// ** the file-system using sqlite3OsDelete(). +// ** +// ** If an IO error within this function, an error code is returned. This +// ** function allocates memory by calling sqlite3Malloc(). If an allocation +// ** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors +// ** occur, SQLITE_OK is returned. +// ** +// ** TODO: This function allocates a single block of memory to load +// ** the entire contents of the super-journal file. This could be +// ** a couple of kilobytes or so - potentially larger than the page +// ** size. +// */ +func _pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, flags, flags1, nSuperPtr, rc int32 + var pJournal, pSuper, pVfs, zFree, zJournal, zSuperJournal, zSuperPtr uintptr + var v1, v2, v3 int8 + var _ /* exists at bp+8 */ int32 + var _ /* nSuperJournal at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, flags, flags1, nSuperPtr, pJournal, pSuper, pVfs, rc, zFree, zJournal, zSuperJournal, zSuperPtr, v1, v2, v3 + pVfs = (*TPager)(unsafe.Pointer(pPager)).FpVfs /* Malloc'd child-journal file descriptor */ + zSuperJournal = uintptr(0) /* Space to hold super-journal filename */ + zFree = uintptr(0) /* Amount of space allocated to zSuperPtr[] */ + /* Allocate space for both the pJournal and pSuper file descriptors. + ** If successful, open the super-journal file for reading. + */ + pSuper = _sqlite3MallocZero(tls, uint64((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile*int32(2))) + if !(pSuper != 0) { + rc = int32(SQLITE_NOMEM) + pJournal = uintptr(0) + } else { + flags = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_SUPER_JOURNAL) + rc = _sqlite3OsOpen(tls, pVfs, zSuper, pSuper, flags, uintptr(0)) + pJournal = pSuper + uintptr((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile) + } + if rc != SQLITE_OK { + goto delsuper_out + } + /* Load the entire super-journal file into space obtained from + ** sqlite3_malloc() and pointed to by zSuperJournal. Also obtain + ** sufficient space (in zSuperPtr) to hold the names of super-journal + ** files extracted from regular rollback-journals. + */ + rc = _sqlite3OsFileSize(tls, pSuper, bp) + if rc != SQLITE_OK { + goto delsuper_out + } + nSuperPtr = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + int32(1) + zFree = _sqlite3Malloc(tls, uint64(int64(4)+*(*Ti64)(unsafe.Pointer(bp))+int64(nSuperPtr)+int64(2))) + if !(zFree != 0) { + rc = int32(SQLITE_NOMEM) + goto delsuper_out + } + v3 = libc.Int8FromInt32(0) + *(*int8)(unsafe.Pointer(zFree + 3)) = v3 + v2 = v3 + *(*int8)(unsafe.Pointer(zFree + 2)) = v2 + v1 = v2 + *(*int8)(unsafe.Pointer(zFree + 1)) = v1 + *(*int8)(unsafe.Pointer(zFree)) = v1 + zSuperJournal = zFree + 4 + zSuperPtr = zSuperJournal + uintptr(*(*Ti64)(unsafe.Pointer(bp))+int64(2)) + rc = _sqlite3OsRead(tls, pSuper, zSuperJournal, int32(*(*Ti64)(unsafe.Pointer(bp))), 0) + if rc != SQLITE_OK { + goto delsuper_out + } + *(*int8)(unsafe.Pointer(zSuperJournal + uintptr(*(*Ti64)(unsafe.Pointer(bp))))) = 0 + *(*int8)(unsafe.Pointer(zSuperJournal + uintptr(*(*Ti64)(unsafe.Pointer(bp))+int64(1)))) = 0 + zJournal = zSuperJournal + for int64(zJournal)-int64(zSuperJournal) < *(*Ti64)(unsafe.Pointer(bp)) { + rc = _sqlite3OsAccess(tls, pVfs, zJournal, SQLITE_ACCESS_EXISTS, bp+8) + if rc != SQLITE_OK { + goto delsuper_out + } + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + flags1 = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_SUPER_JOURNAL) + rc = _sqlite3OsOpen(tls, pVfs, zJournal, pJournal, flags1, uintptr(0)) + if rc != SQLITE_OK { + goto delsuper_out + } + rc = _readSuperJournal(tls, pJournal, zSuperPtr, uint32(nSuperPtr)) + _sqlite3OsClose(tls, pJournal) + if rc != SQLITE_OK { + goto delsuper_out + } + c = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zSuperPtr))) != 0 && libc.Xstrcmp(tls, zSuperPtr, zSuper) == 0) + if c != 0 { + /* We have a match. Do not delete the super-journal file. */ + goto delsuper_out + } + } + zJournal += uintptr(_sqlite3Strlen30(tls, zJournal) + libc.Int32FromInt32(1)) + } + _sqlite3OsClose(tls, pSuper) + rc = _sqlite3OsDelete(tls, pVfs, zSuper, 0) +delsuper_out: + ; + Xsqlite3_free(tls, zFree) + if pSuper != 0 { + _sqlite3OsClose(tls, pSuper) + Xsqlite3_free(tls, pSuper) + } + return rc +} + +// C documentation +// +// /* +// ** This function is used to change the actual size of the database +// ** file in the file-system. This only happens when committing a transaction, +// ** or rolling back a transaction (including rolling back a hot-journal). +// ** +// ** If the main database file is not open, or the pager is not in either +// ** DBMOD or OPEN state, this function is a no-op. Otherwise, the size +// ** of the file is changed to nPage pages (nPage*pPager->pageSize bytes). +// ** If the file on disk is currently larger than nPage pages, then use the VFS +// ** xTruncate() method to truncate it. +// ** +// ** Or, it might be the case that the file on disk is smaller than +// ** nPage pages. Some operating system implementations can get confused if +// ** you try to truncate a file to some size that is larger than it +// ** currently is, so detect this case and write a single zero byte to +// ** the end of the new file instead. +// ** +// ** If successful, return SQLITE_OK. If an IO error occurs while modifying +// ** the database file, return the error code to the caller. +// */ +func _pager_truncate(tls *libc.TLS, pPager uintptr, nPage TPgno) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pTmp uintptr + var rc, szPage int32 + var _ /* currentSize at bp+0 */ Ti64 + var _ /* newSize at bp+8 */ Ti64 + _, _, _ = pTmp, rc, szPage + rc = SQLITE_OK + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_DBMOD) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN) { + szPage = int32((*TPager)(unsafe.Pointer(pPager)).FpageSize) + /* TODO: Is it safe to use Pager.dbFileSize here? */ + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp) + *(*Ti64)(unsafe.Pointer(bp + 8)) = int64(szPage) * int64(nPage) + if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp)) != *(*Ti64)(unsafe.Pointer(bp + 8)) { + if *(*Ti64)(unsafe.Pointer(bp)) > *(*Ti64)(unsafe.Pointer(bp + 8)) { + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, *(*Ti64)(unsafe.Pointer(bp + 8))) + } else { + if *(*Ti64)(unsafe.Pointer(bp))+int64(szPage) <= *(*Ti64)(unsafe.Pointer(bp + 8)) { + pTmp = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace + libc.Xmemset(tls, pTmp, 0, uint64(szPage)) + _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_SIZE_HINT), bp+8) + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, pTmp, szPage, *(*Ti64)(unsafe.Pointer(bp + 8))-int64(szPage)) + } + } + if rc == SQLITE_OK { + (*TPager)(unsafe.Pointer(pPager)).FdbFileSize = nPage + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Return a sanitized version of the sector-size of OS file pFile. The +// ** return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE. +// */ +func _sqlite3SectorSize(tls *libc.TLS, pFile uintptr) (r int32) { + var iRet int32 + _ = iRet + iRet = _sqlite3OsSectorSize(tls, pFile) + if iRet < int32(32) { + iRet = int32(512) + } else { + if iRet > int32(MAX_SECTOR_SIZE) { + iRet = int32(MAX_SECTOR_SIZE) + } + } + return iRet +} + +// C documentation +// +// /* +// ** Set the value of the Pager.sectorSize variable for the given +// ** pager based on the value returned by the xSectorSize method +// ** of the open database file. The sector size will be used +// ** to determine the size and alignment of journal header and +// ** super-journal pointers within created journal files. +// ** +// ** For temporary files the effective sector size is always 512 bytes. +// ** +// ** Otherwise, for non-temporary files, the effective sector size is +// ** the value returned by the xSectorSize() method rounded up to 32 if +// ** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it +// ** is greater than MAX_SECTOR_SIZE. +// ** +// ** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set +// ** the effective sector size to its minimum value (512). The purpose of +// ** pPager->sectorSize is to define the "blast radius" of bytes that +// ** might change if a crash occurs while writing to a single byte in +// ** that range. But with POWERSAFE_OVERWRITE, the blast radius is zero +// ** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector +// ** size. For backwards compatibility of the rollback journal file format, +// ** we cannot reduce the effective sector size below 512. +// */ +func _setSectorSize(tls *libc.TLS, pPager uintptr) { + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 || _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd)&int32(SQLITE_IOCAP_POWERSAFE_OVERWRITE) != 0 { + /* Sector size doesn't matter for temporary files. Also, the file + ** may not have been opened yet, in which case the OsSectorSize() + ** call will segfault. */ + (*TPager)(unsafe.Pointer(pPager)).FsectorSize = uint32(512) + } else { + (*TPager)(unsafe.Pointer(pPager)).FsectorSize = uint32(_sqlite3SectorSize(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd)) + } +} + +// C documentation +// +// /* +// ** Playback the journal and thus restore the database file to +// ** the state it was in before we started making changes. +// ** +// ** The journal file format is as follows: +// ** +// ** (1) 8 byte prefix. A copy of aJournalMagic[]. +// ** (2) 4 byte big-endian integer which is the number of valid page records +// ** in the journal. If this value is 0xffffffff, then compute the +// ** number of page records from the journal size. +// ** (3) 4 byte big-endian integer which is the initial value for the +// ** sanity checksum. +// ** (4) 4 byte integer which is the number of pages to truncate the +// ** database to during a rollback. +// ** (5) 4 byte big-endian integer which is the sector size. The header +// ** is this many bytes in size. +// ** (6) 4 byte big-endian integer which is the page size. +// ** (7) zero padding out to the next sector size. +// ** (8) Zero or more pages instances, each as follows: +// ** + 4 byte page number. +// ** + pPager->pageSize bytes of data. +// ** + 4 byte checksum +// ** +// ** When we speak of the journal header, we mean the first 7 items above. +// ** Each entry in the journal is an instance of the 8th item. +// ** +// ** Call the value from the second bullet "nRec". nRec is the number of +// ** valid page entries in the journal. In most cases, you can compute the +// ** value of nRec from the size of the journal file. But if a power +// ** failure occurred while the journal was being written, it could be the +// ** case that the size of the journal file had already been increased but +// ** the extra entries had not yet made it safely to disk. In such a case, +// ** the value of nRec computed from the file size would be too large. For +// ** that reason, we always use the nRec value in the header. +// ** +// ** If the nRec value is 0xffffffff it means that nRec should be computed +// ** from the file size. This value is used when the user selects the +// ** no-sync option for the journal. A power failure could lead to corruption +// ** in this case. But for things like temporary table (which will be +// ** deleted when the power is restored) we don't care. +// ** +// ** If the file opened as the journal file is not a well-formed +// ** journal file then all pages up to the first corrupted page are rolled +// ** back (or no pages if the journal header is corrupted). The journal file +// ** is then deleted and SQLITE_OK returned, just as if no corruption had +// ** been encountered. +// ** +// ** If an I/O or malloc() error occurs, the journal-file is not deleted +// ** and an error code is returned. +// ** +// ** The isHot parameter indicates that we are trying to rollback a journal +// ** that might be a hot journal. Or, it could be that the journal is +// ** preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE. +// ** If the journal really is hot, reset the pager cache prior rolling +// ** back any content. If the journal is merely persistent, no reset is +// ** needed. +// */ +func _pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var nPlayback, needPagerReset, rc int32 + var pVfs, zSuper uintptr + var u Tu32 + var _ /* mxPg at bp+12 */ TPgno + var _ /* nRec at bp+8 */ Tu32 + var _ /* res at bp+16 */ int32 + var _ /* savedPageSize at bp+20 */ Tu32 + var _ /* szJ at bp+0 */ Ti64 + _, _, _, _, _, _ = nPlayback, needPagerReset, pVfs, rc, u, zSuper + pVfs = (*TPager)(unsafe.Pointer(pPager)).FpVfs /* Unsigned loop counter */ + *(*TPgno)(unsafe.Pointer(bp + 12)) = uint32(0) /* Result code of a subroutine */ + *(*int32)(unsafe.Pointer(bp + 16)) = int32(1) /* Value returned by sqlite3OsAccess() */ + zSuper = uintptr(0) /* True to reset page prior to first page rollback */ + nPlayback = 0 /* Total number of pages restored from journal */ + *(*Tu32)(unsafe.Pointer(bp + 20)) = uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) + /* Figure out how many records are in the journal. Abort early if + ** the journal is empty. + */ + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp) + if rc != SQLITE_OK { + goto end_playback + } + /* Read the super-journal name from the journal, if it is present. + ** If a super-journal file name is specified, but the file is not + ** present on disk, then the journal is not hot and does not need to be + ** played back. + ** + ** TODO: Technically the following is an error because it assumes that + ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that + ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c, + ** mxPathname is 512, which is the same as the minimum allowable value + ** for pageSize. + */ + zSuper = (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace + rc = _readSuperJournal(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, zSuper, uint32((*Tsqlite3_vfs)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FpVfs)).FmxPathname+int32(1))) + if rc == SQLITE_OK && *(*int8)(unsafe.Pointer(zSuper)) != 0 { + rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+16) + } + zSuper = uintptr(0) + if rc != SQLITE_OK || !(*(*int32)(unsafe.Pointer(bp + 16)) != 0) { + goto end_playback + } + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + needPagerReset = isHot + /* This loop terminates either when a readJournalHdr() or + ** pager_playback_one_page() call returns SQLITE_DONE or an IO error + ** occurs. + */ + for int32(1) != 0 { + /* Read the next journal header from the journal file. If there are + ** not enough bytes left in the journal file for a complete header, or + ** it is corrupted, then a process must have failed while writing it. + ** This indicates nothing more needs to be rolled back. + */ + rc = _readJournalHdr(tls, pPager, isHot, *(*Ti64)(unsafe.Pointer(bp)), bp+8, bp+12) + if rc != SQLITE_OK { + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + } + goto end_playback + } + /* If nRec is 0xffffffff, then this journal was created by a process + ** working in no-sync mode. This means that the rest of the journal + ** file consists of pages, there are no more journal headers. Compute + ** the value of nRec based on this assumption. + */ + if *(*Tu32)(unsafe.Pointer(bp + 8)) == uint32(0xffffffff) { + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(int32((*(*Ti64)(unsafe.Pointer(bp)) - int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize)) / ((*TPager)(unsafe.Pointer(pPager)).FpageSize + libc.Int64FromInt32(8)))) + } + /* If nRec is 0 and this rollback is of a transaction created by this + ** process and if this is the final header in the journal, then it means + ** that this part of the journal was being filled but has not yet been + ** synced to disk. Compute the number of pages based on the remaining + ** size of the file. + ** + ** The third term of the test was added to fix ticket #2565. + ** When rolling back a hot journal, nRec==0 always means that the next + ** chunk of the journal contains zero pages to be rolled back. But + ** when doing a ROLLBACK and the nRec==0 chunk is the last chunk in + ** the journal, it means that the journal might contain additional + ** pages that need to be rolled back and that the number of pages + ** should be computed based on the journal file size. + */ + if *(*Tu32)(unsafe.Pointer(bp + 8)) == uint32(0) && !(isHot != 0) && (*TPager)(unsafe.Pointer(pPager)).FjournalHdr+int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) == (*TPager)(unsafe.Pointer(pPager)).FjournalOff { + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(int32((*(*Ti64)(unsafe.Pointer(bp)) - (*TPager)(unsafe.Pointer(pPager)).FjournalOff) / ((*TPager)(unsafe.Pointer(pPager)).FpageSize + libc.Int64FromInt32(8)))) + } + /* If this is the first header read from the journal, truncate the + ** database file back to its original size. + */ + if (*TPager)(unsafe.Pointer(pPager)).FjournalOff == int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) { + rc = _pager_truncate(tls, pPager, *(*TPgno)(unsafe.Pointer(bp + 12))) + if rc != SQLITE_OK { + goto end_playback + } + (*TPager)(unsafe.Pointer(pPager)).FdbSize = *(*TPgno)(unsafe.Pointer(bp + 12)) + if (*TPager)(unsafe.Pointer(pPager)).FmxPgno < *(*TPgno)(unsafe.Pointer(bp + 12)) { + (*TPager)(unsafe.Pointer(pPager)).FmxPgno = *(*TPgno)(unsafe.Pointer(bp + 12)) + } + } + /* Copy original pages out of the journal and back into the + ** database file and/or page cache. + */ + u = uint32(0) + for { + if !(u < *(*Tu32)(unsafe.Pointer(bp + 8))) { + break + } + if needPagerReset != 0 { + _pager_reset(tls, pPager) + needPagerReset = 0 + } + rc = _pager_playback_one_page(tls, pPager, pPager+96, uintptr(0), int32(1), 0) + if rc == SQLITE_OK { + nPlayback++ + } else { + if rc == int32(SQLITE_DONE) { + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = *(*Ti64)(unsafe.Pointer(bp)) + break + } else { + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)<= int32(PAGER_WRITER_DBMOD) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN) { + rc = _sqlite3PagerSync(tls, pPager, uintptr(0)) + } + if rc == SQLITE_OK { + rc = _pager_end_transaction(tls, pPager, libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zSuper))) != int32('\000')), 0) + } + if rc == SQLITE_OK && *(*int8)(unsafe.Pointer(zSuper)) != 0 && *(*int32)(unsafe.Pointer(bp + 16)) != 0 { + /* If there was a super-journal and this routine will return success, + ** see if it is possible to delete the super-journal. + */ + libc.Xmemset(tls, (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace, 0, uint64(4)) + rc = _pager_delsuper(tls, pPager, zSuper) + } + if isHot != 0 && nPlayback != 0 { + Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(2)<pData. A shared lock or greater must be held on the database +// ** file before this function is called. +// ** +// ** If page 1 is read, then the value of Pager.dbFileVers[] is set to +// ** the value read from the database file. +// ** +// ** If an IO error occurs, then the IO error is returned to the caller. +// ** Otherwise, SQLITE_OK is returned. +// */ +func _readDbPage(tls *libc.TLS, pPg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var dbFileVers, pPager uintptr + var iOffset Ti64 + var rc int32 + var _ /* iFrame at bp+0 */ Tu32 + _, _, _, _ = dbFileVers, iOffset, pPager, rc + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager /* Pager object associated with page pPg */ + rc = SQLITE_OK /* Return code */ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) /* Frame of WAL containing pgno */ + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + rc = _sqlite3WalFindFrame(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno, bp) + if rc != 0 { + return rc + } + } + if *(*Tu32)(unsafe.Pointer(bp)) != 0 { + rc = _sqlite3WalReadFrame(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, *(*Tu32)(unsafe.Pointer(bp)), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), (*TPgHdr)(unsafe.Pointer(pPg)).FpData) + } else { + iOffset = int64((*TPgHdr)(unsafe.Pointer(pPg)).Fpgno-libc.Uint32FromInt32(1)) * (*TPager)(unsafe.Pointer(pPager)).FpageSize + rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, (*TPgHdr)(unsafe.Pointer(pPg)).FpData, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), iOffset) + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)<dbFileVers[] with all 0xff bytes should suffice. + ** + ** For an encrypted database, the situation is more complex: bytes + ** 24..39 of the database are white noise. But the probability of + ** white noise equaling 16 bytes of 0xff is vanishingly small so + ** we should still be ok. + */ + libc.Xmemset(tls, pPager+136, int32(0xff), uint64(16)) + } else { + dbFileVers = (*TPgHdr)(unsafe.Pointer(pPg)).FpData + 24 + libc.Xmemcpy(tls, pPager+136, dbFileVers, uint64(16)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Update the value of the change-counter at offsets 24 and 92 in +// ** the header and the sqlite version number at offset 96. +// ** +// ** This is an unconditional update. See also the pager_incr_changecounter() +// ** routine which only updates the change-counter if the update is actually +// ** needed, as determined by the pPager->changeCountDone state variable. +// */ +func _pager_write_changecounter(tls *libc.TLS, pPg uintptr) { + var change_counter Tu32 + _ = change_counter + if pPg == uintptr(0) { + return + } + /* Increment the value just read and write it back to byte 24. */ + change_counter = _sqlite3Get4byte(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpPager+136) + uint32(1) + _sqlite3Put4byte(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpData+uintptr(24), change_counter) + /* Also store the SQLite version number in bytes 96..99 and in + ** bytes 92..95 store the change counter for which the version number + ** is valid. */ + _sqlite3Put4byte(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpData+uintptr(92), change_counter) + _sqlite3Put4byte(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpData+uintptr(96), uint32(SQLITE_VERSION_NUMBER)) +} + +// C documentation +// +// /* +// ** This function is invoked once for each page that has already been +// ** written into the log file when a WAL transaction is rolled back. +// ** Parameter iPg is the page number of said page. The pCtx argument +// ** is actually a pointer to the Pager structure. +// ** +// ** If page iPg is present in the cache, and has no outstanding references, +// ** it is discarded. Otherwise, if there are one or more outstanding +// ** references, the page content is reloaded from the database. If the +// ** attempt to reload content from the database is required and fails, +// ** return an SQLite error code. Otherwise, SQLITE_OK. +// */ +func _pagerUndoCallback(tls *libc.TLS, pCtx uintptr, iPg TPgno) (r int32) { + var pPager, pPg uintptr + var rc int32 + _, _, _ = pPager, pPg, rc + rc = SQLITE_OK + pPager = pCtx + pPg = _sqlite3PagerLookup(tls, pPager, iPg) + if pPg != 0 { + if _sqlite3PcachePageRefcount(tls, pPg) == int64(1) { + _sqlite3PcacheDrop(tls, pPg) + } else { + rc = _readDbPage(tls, pPg) + if rc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TPager)(unsafe.Pointer(pPager)).FxReiniter})))(tls, pPg) + } + _sqlite3PagerUnrefNotNull(tls, pPg) + } + } + /* Normally, if a transaction is rolled back, any backup processes are + ** updated as data is copied out of the rollback journal and into the + ** database. This is not generally possible with a WAL database, as + ** rollback involves simply truncating the log file. Therefore, if one + ** or more frames have already been written to the log (and therefore + ** also copied into the backup databases) as part of this transaction, + ** the backups must be restarted. + */ + _sqlite3BackupRestart(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup) + return rc +} + +// C documentation +// +// /* +// ** This function is called to rollback a transaction on a WAL database. +// */ +func _pagerRollbackWal(tls *libc.TLS, pPager uintptr) (r int32) { + var pList, pNext uintptr + var rc int32 + _, _, _ = pList, pNext, rc /* List of dirty pages to revert */ + /* For all pages in the cache that are currently dirty or have already + ** been written (but not committed) to the log file, do one of the + ** following: + ** + ** + Discard the cached page (if refcount==0), or + ** + Reload page content from the database (if refcount>0). + */ + (*TPager)(unsafe.Pointer(pPager)).FdbSize = (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize + rc = _sqlite3WalUndo(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, __ccgo_fp(_pagerUndoCallback), pPager) + pList = _sqlite3PcacheDirtyList(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + for pList != 0 && rc == SQLITE_OK { + pNext = (*TPgHdr)(unsafe.Pointer(pList)).FpDirty + rc = _pagerUndoCallback(tls, pPager, (*TPgHdr)(unsafe.Pointer(pList)).Fpgno) + pList = pNext + } + return rc +} + +// C documentation +// +// /* +// ** This function is a wrapper around sqlite3WalFrames(). As well as logging +// ** the contents of the list of pages headed by pList (connected by pDirty), +// ** this function notifies any active backup processes that the pages have +// ** changed. +// ** +// ** The list of pages passed into this routine is always sorted by page number. +// ** Hence, if page 1 appears anywhere on the list, it will be the first page. +// */ +func _pagerWalFrames(tls *libc.TLS, pPager uintptr, _pList uintptr, nTruncate TPgno, isCommit int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _pList + var nList, rc int32 + var p, ppNext, v2 uintptr + _, _, _, _, _ = nList, p, ppNext, rc, v2 /* For looping over pages */ + if isCommit != 0 { + /* If a WAL transaction is being committed, there is no point in writing + ** any pages with page numbers greater than nTruncate into the WAL file. + ** They will never be read by any client. So remove them from the pDirty + ** list here. */ + ppNext = bp + nList = 0 + p = *(*uintptr)(unsafe.Pointer(bp)) + for { + v2 = p + *(*uintptr)(unsafe.Pointer(ppNext)) = v2 + if !(v2 != uintptr(0)) { + break + } + if (*TPgHdr)(unsafe.Pointer(p)).Fpgno <= nTruncate { + ppNext = p + 32 + nList++ + } + goto _1 + _1: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + } + } else { + nList = int32(1) + } + *(*Tu32)(unsafe.Pointer(pPager + 248 + 2*4)) += uint32(nList) + if (*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fpgno == uint32(1) { + _pager_write_changecounter(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + rc = _sqlite3WalFrames(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), *(*uintptr)(unsafe.Pointer(bp)), nTruncate, isCommit, int32((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags)) + if rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FpBackup != 0 { + p = *(*uintptr)(unsafe.Pointer(bp)) + for { + if !(p != 0) { + break + } + _sqlite3BackupUpdate(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup, (*TPgHdr)(unsafe.Pointer(p)).Fpgno, (*TPgHdr)(unsafe.Pointer(p)).FpData) + goto _3 + _3: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + } + } + return rc +} + +// C documentation +// +// /* +// ** Begin a read transaction on the WAL. +// ** +// ** This routine used to be called "pagerOpenSnapshot()" because it essentially +// ** makes a snapshot of the database at the current point in time and preserves +// ** that snapshot for use by the reader in spite of concurrently changes by +// ** other writers or checkpointers. +// */ +func _pagerBeginReadTransaction(tls *libc.TLS, pPager uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* changed at bp+0 */ int32 + _ = rc /* Return code */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* True if cache must be reset */ + /* sqlite3WalEndReadTransaction() was not called for the previous + ** transaction in locking_mode=EXCLUSIVE. So call it now. If we + ** are in locking_mode=NORMAL and EndRead() was previously called, + ** the duplicate call is harmless. + */ + _sqlite3WalEndReadTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + rc = _sqlite3WalBeginReadTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, bp) + if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp)) != 0 { + _pager_reset(tls, pPager) + if (*TPager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, 0, uintptr(0)) + } + } + return rc +} + +// C documentation +// +// /* +// ** This function is called as part of the transition from PAGER_OPEN +// ** to PAGER_READER state to determine the size of the database file +// ** in pages (assuming the page size currently stored in Pager.pageSize). +// ** +// ** If no error occurs, SQLITE_OK is returned and the size of the database +// ** in pages is stored in *pnPage. Otherwise, an error code (perhaps +// ** SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified. +// */ +func _pagerPagecount(tls *libc.TLS, pPager uintptr, pnPage uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nPage TPgno + var rc int32 + var _ /* n at bp+0 */ Ti64 + _, _ = nPage, rc /* Value to return via *pnPage */ + /* Query the WAL sub-system for the database size. The WalDbsize() + ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or + ** if the database size is not available. The database size is not + ** available from the WAL sub-system if the log file is empty or + ** contains no valid committed transactions. + */ + nPage = _sqlite3WalDbsize(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + /* If the number of pages in the database is not available from the + ** WAL sub-system, determine the page count based on the size of + ** the database file. If the size of the database file is not an + ** integer multiple of the page-size, round up the result. + */ + if nPage == uint32(0) && (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { + *(*Ti64)(unsafe.Pointer(bp)) = 0 /* Size of db file in bytes */ + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp) + if rc != SQLITE_OK { + return rc + } + nPage = uint32((*(*Ti64)(unsafe.Pointer(bp)) + (*TPager)(unsafe.Pointer(pPager)).FpageSize - libc.Int64FromInt32(1)) / (*TPager)(unsafe.Pointer(pPager)).FpageSize) + } + /* If the current number of pages in the file is greater than the + ** configured maximum pager number, increase the allowed limit so + ** that the file can be read. + */ + if nPage > (*TPager)(unsafe.Pointer(pPager)).FmxPgno { + (*TPager)(unsafe.Pointer(pPager)).FmxPgno = nPage + } + *(*TPgno)(unsafe.Pointer(pnPage)) = nPage + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Check if the *-wal file that corresponds to the database opened by pPager +// ** exists if the database is not empty, or verify that the *-wal file does +// ** not exist (by deleting it) if the database file is empty. +// ** +// ** If the database is not empty and the *-wal file exists, open the pager +// ** in WAL mode. If the database is empty or if no *-wal file exists and +// ** if no error occurs, make sure Pager.journalMode is not set to +// ** PAGER_JOURNALMODE_WAL. +// ** +// ** Return SQLITE_OK or an error code. +// ** +// ** The caller must hold a SHARED lock on the database file to call this +// ** function. Because an EXCLUSIVE lock on the db file is required to delete +// ** a WAL on a none-empty database, this ensures there is no race condition +// ** between the xAccess() below and an xDelete() being executed by some +// ** other connection. +// */ +func _pagerOpenWalIfPresent(tls *libc.TLS, pPager uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* isWal at bp+0 */ int32 + var _ /* nPage at bp+4 */ TPgno + _ = rc + rc = SQLITE_OK + if !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) { /* True if WAL file exists */ + rc = _sqlite3OsAccess(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzWal, SQLITE_ACCESS_EXISTS, bp) + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp)) != 0 { /* Size of the database file */ + rc = _pagerPagecount(tls, pPager, bp+4) + if rc != 0 { + return rc + } + if *(*TPgno)(unsafe.Pointer(bp + 4)) == uint32(0) { + rc = _sqlite3OsDelete(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzWal, 0) + } else { + rc = _sqlite3PagerOpenWal(tls, pPager, uintptr(0)) + } + } else { + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_WAL) { + (*TPager)(unsafe.Pointer(pPager)).FjournalMode = uint8(PAGER_JOURNALMODE_DELETE) + } + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback +// ** the entire super-journal file. The case pSavepoint==NULL occurs when +// ** a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction +// ** savepoint. +// ** +// ** When pSavepoint is not NULL (meaning a non-transaction savepoint is +// ** being rolled back), then the rollback consists of up to three stages, +// ** performed in the order specified: +// ** +// ** * Pages are played back from the main journal starting at byte +// ** offset PagerSavepoint.iOffset and continuing to +// ** PagerSavepoint.iHdrOffset, or to the end of the main journal +// ** file if PagerSavepoint.iHdrOffset is zero. +// ** +// ** * If PagerSavepoint.iHdrOffset is not zero, then pages are played +// ** back starting from the journal header immediately following +// ** PagerSavepoint.iHdrOffset to the end of the main journal file. +// ** +// ** * Pages are then played back from the sub-journal file, starting +// ** with the PagerSavepoint.iSubRec and continuing to the end of +// ** the journal file. +// ** +// ** Throughout the rollback process, each time a page is rolled back, the +// ** corresponding bit is set in a bitvec structure (variable pDone in the +// ** implementation below). This is used to ensure that a page is only +// ** rolled back the first time it is encountered in either journal. +// ** +// ** If pSavepoint is NULL, then pages are only played back from the main +// ** journal file. There is no need for a bitvec in this case. +// ** +// ** In either case, before playback commences the Pager.dbSize variable +// ** is reset to the value that it held at the start of the savepoint +// ** (or transaction). No page with a page-number greater than this value +// ** is played back. If one is encountered it is simply skipped. +// */ +func _pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iHdrOff, szJ Ti64 + var ii, ii1 Tu32 + var pDone uintptr + var rc int32 + var v1 uint32 + var v2 int64 + var _ /* dummy at bp+4 */ Tu32 + var _ /* nJRec at bp+0 */ Tu32 + var _ /* offset at bp+8 */ Ti64 + _, _, _, _, _, _, _, _ = iHdrOff, ii, ii1, pDone, rc, szJ, v1, v2 /* End of first segment of main-journal records */ + rc = SQLITE_OK /* Return code */ + pDone = uintptr(0) /* Bitvec to ensure pages played back only once */ + /* Allocate a bitvec to use to store the set of pages rolled back */ + if pSavepoint != 0 { + pDone = _sqlite3BitvecCreate(tls, (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FnOrig) + if !(pDone != 0) { + return int32(SQLITE_NOMEM) + } + } + /* Set the database size back to the value it was before the savepoint + ** being reverted was opened. + */ + if pSavepoint != 0 { + v1 = (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FnOrig + } else { + v1 = (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize + } + (*TPager)(unsafe.Pointer(pPager)).FdbSize = v1 + (*TPager)(unsafe.Pointer(pPager)).FchangeCountDone = (*TPager)(unsafe.Pointer(pPager)).FtempFile + if !(pSavepoint != 0) && (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + return _pagerRollbackWal(tls, pPager) + } + /* Use pPager->journalOff as the effective size of the main rollback + ** journal. The actual file might be larger than this in + ** PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST. But anything + ** past pPager->journalOff is off-limits to us. + */ + szJ = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + /* Begin by rolling back records from the main journal starting at + ** PagerSavepoint.iOffset and continuing to the next journal header. + ** There might be records in the main journal that have a page number + ** greater than the current database size (pPager->dbSize) but those + ** will be skipped automatically. Pages are added to pDone as they + ** are played back. + */ + if pSavepoint != 0 && !((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) { + if (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FiHdrOffset != 0 { + v2 = (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FiHdrOffset + } else { + v2 = szJ + } + iHdrOff = v2 + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FiOffset + for rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FjournalOff < iHdrOff { + rc = _pager_playback_one_page(tls, pPager, pPager+96, pDone, int32(1), int32(1)) + } + } else { + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + } + /* Continue rolling back records out of the main journal starting at + ** the first journal header seen and continuing until the effective end + ** of the main journal file. Continue to skip out-of-range pages and + ** continue adding pages rolled back to pDone. + */ + for rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FjournalOff < szJ { /* Loop counter */ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + rc = _readJournalHdr(tls, pPager, 0, szJ, bp, bp+4) + /* + ** The "pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff" + ** test is related to ticket #2565. See the discussion in the + ** pager_playback() function for additional information. + */ + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) && (*TPager)(unsafe.Pointer(pPager)).FjournalHdr+int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) == (*TPager)(unsafe.Pointer(pPager)).FjournalOff { + *(*Tu32)(unsafe.Pointer(bp)) = uint32((szJ - (*TPager)(unsafe.Pointer(pPager)).FjournalOff) / ((*TPager)(unsafe.Pointer(pPager)).FpageSize + libc.Int64FromInt32(8))) + } + ii = uint32(0) + for { + if !(rc == SQLITE_OK && ii < *(*Tu32)(unsafe.Pointer(bp)) && (*TPager)(unsafe.Pointer(pPager)).FjournalOff < szJ) { + break + } + rc = _pager_playback_one_page(tls, pPager, pPager+96, pDone, int32(1), int32(1)) + goto _3 + _3: + ; + ii++ + } + } + /* Finally, rollback pages from the sub-journal. Page that were + ** previously rolled back out of the main journal (and are hence in pDone) + ** will be skipped. Out-of-range pages are also skipped. + */ + if pSavepoint != 0 { /* Loop counter */ + *(*Ti64)(unsafe.Pointer(bp + 8)) = int64((*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FiSubRec) * (int64(4) + (*TPager)(unsafe.Pointer(pPager)).FpageSize) + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + rc = _sqlite3WalSavepointUndo(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pSavepoint+36) + } + ii1 = (*TPagerSavepoint)(unsafe.Pointer(pSavepoint)).FiSubRec + for { + if !(rc == SQLITE_OK && ii1 < (*TPager)(unsafe.Pointer(pPager)).FnSubRec) { + break + } + rc = _pager_playback_one_page(tls, pPager, bp+8, pDone, 0, int32(1)) + goto _4 + _4: + ; + ii1++ + } + } + _sqlite3BitvecDestroy(tls, pDone) + if rc == SQLITE_OK { + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = szJ + } + return rc +} + +// C documentation +// +// /* +// ** Change the maximum number of in-memory pages that are allowed +// ** before attempting to recycle clean and unused pages. +// */ +func _sqlite3PagerSetCachesize(tls *libc.TLS, pPager uintptr, mxPage int32) { + _sqlite3PcacheSetCachesize(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, mxPage) +} + +// C documentation +// +// /* +// ** Change the maximum number of in-memory pages that are allowed +// ** before attempting to spill pages to journal. +// */ +func _sqlite3PagerSetSpillsize(tls *libc.TLS, pPager uintptr, mxPage int32) (r int32) { + return _sqlite3PcacheSetSpillsize(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, mxPage) +} + +// C documentation +// +// /* +// ** Invoke SQLITE_FCNTL_MMAP_SIZE based on the current value of szMmap. +// */ +func _pagerFixMaplimit(tls *libc.TLS, pPager uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var fd uintptr + var _ /* sz at bp+0 */ Tsqlite3_int64 + _ = fd + fd = (*TPager)(unsafe.Pointer(pPager)).Ffd + if (*Tsqlite3_file)(unsafe.Pointer(fd)).FpMethods != uintptr(0) && (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(fd)).FpMethods)).FiVersion >= int32(3) { + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = (*TPager)(unsafe.Pointer(pPager)).FszMmap + (*TPager)(unsafe.Pointer(pPager)).FbUseFetch = libc.BoolUint8(*(*Tsqlite3_int64)(unsafe.Pointer(bp)) > libc.Int64FromInt32(0)) + _setGetterMethod(tls, pPager) + _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_MMAP_SIZE), bp) + } +} + +// C documentation +// +// /* +// ** Change the maximum size of any memory mapping made of the database file. +// */ +func _sqlite3PagerSetMmapLimit(tls *libc.TLS, pPager uintptr, szMmap Tsqlite3_int64) { + (*TPager)(unsafe.Pointer(pPager)).FszMmap = szMmap + _pagerFixMaplimit(tls, pPager) +} + +// C documentation +// +// /* +// ** Free as much memory as possible from the pager. +// */ +func _sqlite3PagerShrink(tls *libc.TLS, pPager uintptr) { + _sqlite3PcacheShrink(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) +} + +// C documentation +// +// /* +// ** Adjust settings of the pager to those specified in the pgFlags parameter. +// ** +// ** The "level" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness +// ** of the database to damage due to OS crashes or power failures by +// ** changing the number of syncs()s when writing the journals. +// ** There are four levels: +// ** +// ** OFF sqlite3OsSync() is never called. This is the default +// ** for temporary and transient files. +// ** +// ** NORMAL The journal is synced once before writes begin on the +// ** database. This is normally adequate protection, but +// ** it is theoretically possible, though very unlikely, +// ** that an inopertune power failure could leave the journal +// ** in a state which would cause damage to the database +// ** when it is rolled back. +// ** +// ** FULL The journal is synced twice before writes begin on the +// ** database (with some additional information - the nRec field +// ** of the journal header - being written in between the two +// ** syncs). If we assume that writing a +// ** single disk sector is atomic, then this mode provides +// ** assurance that the journal will not be corrupted to the +// ** point of causing damage to the database during rollback. +// ** +// ** EXTRA This is like FULL except that is also syncs the directory +// ** that contains the rollback journal after the rollback +// ** journal is unlinked. +// ** +// ** The above is for a rollback-journal mode. For WAL mode, OFF continues +// ** to mean that no syncs ever occur. NORMAL means that the WAL is synced +// ** prior to the start of checkpoint and that the database file is synced +// ** at the conclusion of the checkpoint if the entire content of the WAL +// ** was written back into the database. But no sync operations occur for +// ** an ordinary commit in NORMAL mode with WAL. FULL means that the WAL +// ** file is synced following each commit operation, in addition to the +// ** syncs associated with NORMAL. There is no difference between FULL +// ** and EXTRA for WAL mode. +// ** +// ** Do not confuse synchronous=FULL with SQLITE_SYNC_FULL. The +// ** SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync +// ** using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an +// ** ordinary fsync() call. There is no difference between SQLITE_SYNC_FULL +// ** and SQLITE_SYNC_NORMAL on platforms other than MacOSX. But the +// ** synchronous=FULL versus synchronous=NORMAL setting determines when +// ** the xSync primitive is called and is relevant to all platforms. +// ** +// ** Numeric values associated with these states are OFF==1, NORMAL=2, +// ** and FULL=3. +// */ +func _sqlite3PagerSetFlags(tls *libc.TLS, pPager uintptr, pgFlags uint32) { + var level uint32 + var v1, v2, v3 int32 + var p4, p5, p6, p7 uintptr + _, _, _, _, _, _, _, _ = level, v1, v2, v3, p4, p5, p6, p7 + level = pgFlags & uint32(PAGER_SYNCHRONOUS_MASK) + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + (*TPager)(unsafe.Pointer(pPager)).FnoSync = uint8(1) + (*TPager)(unsafe.Pointer(pPager)).FfullSync = uint8(0) + (*TPager)(unsafe.Pointer(pPager)).FextraSync = uint8(0) + } else { + if level == uint32(PAGER_SYNCHRONOUS_OFF) { + v1 = int32(1) + } else { + v1 = 0 + } + (*TPager)(unsafe.Pointer(pPager)).FnoSync = uint8(v1) + if level >= uint32(PAGER_SYNCHRONOUS_FULL) { + v2 = int32(1) + } else { + v2 = 0 + } + (*TPager)(unsafe.Pointer(pPager)).FfullSync = uint8(v2) + if level == uint32(PAGER_SYNCHRONOUS_EXTRA) { + v3 = int32(1) + } else { + v3 = 0 + } + (*TPager)(unsafe.Pointer(pPager)).FextraSync = uint8(v3) + } + if (*TPager)(unsafe.Pointer(pPager)).FnoSync != 0 { + (*TPager)(unsafe.Pointer(pPager)).FsyncFlags = uint8(0) + } else { + if pgFlags&uint32(PAGER_FULLFSYNC) != 0 { + (*TPager)(unsafe.Pointer(pPager)).FsyncFlags = uint8(SQLITE_SYNC_FULL) + } else { + (*TPager)(unsafe.Pointer(pPager)).FsyncFlags = uint8(SQLITE_SYNC_NORMAL) + } + } + (*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags = uint8(int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags) << libc.Int32FromInt32(2)) + if (*TPager)(unsafe.Pointer(pPager)).FfullSync != 0 { + p4 = pPager + 15 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + if pgFlags&uint32(PAGER_CKPT_FULLFSYNC) != 0 && !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { + p5 = pPager + 15 + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) | libc.Int32FromInt32(SQLITE_SYNC_FULL)< SHARED_LOCK | Yes +// ** SHARED_LOCK -> RESERVED_LOCK | No +// ** SHARED_LOCK -> EXCLUSIVE_LOCK | No +// ** RESERVED_LOCK -> EXCLUSIVE_LOCK | Yes +// ** +// ** If the busy-handler callback returns non-zero, the lock is +// ** retried. If it returns zero, then the SQLITE_BUSY error is +// ** returned to the caller of the pager API function. +// */ +func _sqlite3PagerSetBusyHandler(tls *libc.TLS, pPager uintptr, xBusyHandler uintptr, pBusyHandlerArg uintptr) { + var ap uintptr + _ = ap + (*TPager)(unsafe.Pointer(pPager)).FxBusyHandler = xBusyHandler + (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg = pBusyHandlerArg + ap = pPager + 232 + _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_BUSYHANDLER), ap) +} + +// C documentation +// +// /* +// ** Change the page size used by the Pager object. The new page size +// ** is passed in *pPageSize. +// ** +// ** If the pager is in the error state when this function is called, it +// ** is a no-op. The value returned is the error state error code (i.e. +// ** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL). +// ** +// ** Otherwise, if all of the following are true: +// ** +// ** * the new page size (value of *pPageSize) is valid (a power +// ** of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and +// ** +// ** * there are no outstanding page references, and +// ** +// ** * the database is either not an in-memory database or it is +// ** an in-memory database that currently consists of zero pages. +// ** +// ** then the pager object page size is set to *pPageSize. +// ** +// ** If the page size is changed, then this function uses sqlite3PagerMalloc() +// ** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt +// ** fails, SQLITE_NOMEM is returned and the page size remains unchanged. +// ** In all other cases, SQLITE_OK is returned. +// ** +// ** If the page size is not changed, either because one of the enumerated +// ** conditions above is not true, the pager was in error state when this +// ** function was called, or because the memory allocation attempt failed, +// ** then *pPageSize is set to the old, retained page size before returning. +// */ +func _sqlite3PagerSetPagesize(tls *libc.TLS, pPager uintptr, pPageSize uintptr, nReserve int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pNew uintptr + var pageSize Tu32 + var rc int32 + var _ /* nByte at bp+0 */ Ti64 + _, _, _ = pNew, pageSize, rc + rc = SQLITE_OK + /* It is not possible to do a full assert_pager_state() here, as this + ** function may be called from within PagerOpen(), before the state + ** of the Pager object is internally consistent. + ** + ** At one point this function returned an error if the pager was in + ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that + ** there is at least one outstanding page reference, this function + ** is a no-op for that case anyhow. + */ + pageSize = *(*Tu32)(unsafe.Pointer(pPageSize)) + if (int32((*TPager)(unsafe.Pointer(pPager)).FmemDb) == 0 || (*TPager)(unsafe.Pointer(pPager)).FdbSize == uint32(0)) && _sqlite3PcacheRefCount(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) == 0 && pageSize != 0 && pageSize != uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) { + pNew = libc.UintptrFromInt32(0) /* New temp space */ + *(*Ti64)(unsafe.Pointer(bp)) = 0 + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) > PAGER_OPEN && (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp) + } + if rc == SQLITE_OK { + /* 8 bytes of zeroed overrun space is sufficient so that the b-tree + * cell header parser will never run off the end of the allocation */ + pNew = _sqlite3PageMalloc(tls, int32(pageSize+uint32(8))) + if !(pNew != 0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pNew+uintptr(pageSize), 0, uint64(8)) + } + } + if rc == SQLITE_OK { + _pager_reset(tls, pPager) + rc = _sqlite3PcacheSetPageSize(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, int32(pageSize)) + } + if rc == SQLITE_OK { + _sqlite3PageFree(tls, (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace) + (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace = pNew + (*TPager)(unsafe.Pointer(pPager)).FdbSize = uint32((*(*Ti64)(unsafe.Pointer(bp)) + int64(pageSize) - libc.Int64FromInt32(1)) / int64(pageSize)) + (*TPager)(unsafe.Pointer(pPager)).FpageSize = int64(pageSize) + (*TPager)(unsafe.Pointer(pPager)).FlckPgno = uint32(_sqlite3PendingByte)/pageSize + uint32(1) + } else { + _sqlite3PageFree(tls, pNew) + } + } + *(*Tu32)(unsafe.Pointer(pPageSize)) = uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) + if rc == SQLITE_OK { + if nReserve < 0 { + nReserve = int32((*TPager)(unsafe.Pointer(pPager)).FnReserve) + } + (*TPager)(unsafe.Pointer(pPager)).FnReserve = int16(nReserve) + _pagerFixMaplimit(tls, pPager) + } + return rc +} + +// C documentation +// +// /* +// ** Return a pointer to the "temporary page" buffer held internally +// ** by the pager. This is a buffer that is big enough to hold the +// ** entire content of a database page. This buffer is used internally +// ** during rollback and will be overwritten whenever a rollback +// ** occurs. But other modules are free to use it too, as long as +// ** no rollbacks are happening. +// */ +func _sqlite3PagerTempSpace(tls *libc.TLS, pPager uintptr) (r uintptr) { + return (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace +} + +// C documentation +// +// /* +// ** Attempt to set the maximum database page count if mxPage is positive. +// ** Make no changes if mxPage is zero or negative. And never reduce the +// ** maximum page count below the current size of the database. +// ** +// ** Regardless of mxPage, return the current maximum page count. +// */ +func _sqlite3PagerMaxPageCount(tls *libc.TLS, pPager uintptr, mxPage TPgno) (r TPgno) { + if mxPage > uint32(0) { + (*TPager)(unsafe.Pointer(pPager)).FmxPgno = mxPage + } + /* Called only by OP_MaxPgcnt */ + /* assert( pPager->mxPgno>=pPager->dbSize ); */ + /* OP_MaxPgcnt ensures that the parameter passed to this function is not + ** less than the total number of valid pages in the database. But this + ** may be less than Pager.dbSize, and so the assert() above is not valid */ + return (*TPager)(unsafe.Pointer(pPager)).FmxPgno +} + +/* +** The following set of routines are used to disable the simulated +** I/O error mechanism. These routines are used to avoid simulated +** errors in places where we do not care about errors. +** +** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops +** and generate no code. + */ + +// C documentation +// +// /* +// ** Read the first N bytes from the beginning of the file into memory +// ** that pDest points to. +// ** +// ** If the pager was opened on a transient file (zFilename==""), or +// ** opened on a file less than N bytes in size, the output buffer is +// ** zeroed and SQLITE_OK returned. The rationale for this is that this +// ** function is used to read database headers, and a new transient or +// ** zero sized database has a header than consists entirely of zeroes. +// ** +// ** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered, +// ** the error code is returned to the caller and the contents of the +// ** output buffer undefined. +// */ +func _sqlite3PagerReadFileheader(tls *libc.TLS, pPager uintptr, N int32, pDest uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + libc.Xmemset(tls, pDest, 0, uint64(N)) + /* This routine is only called by btree immediately after creating + ** the Pager object. There has not been an opportunity to transition + ** to WAL mode yet. + */ + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods != uintptr(0) { + rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, pDest, N, 0) + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)< bytes in size, then +// ** this is considered a 1 page file. +// */ +func _sqlite3PagerPagecount(tls *libc.TLS, pPager uintptr, pnPage uintptr) { + *(*int32)(unsafe.Pointer(pnPage)) = int32((*TPager)(unsafe.Pointer(pPager)).FdbSize) +} + +// C documentation +// +// /* +// ** Try to obtain a lock of type locktype on the database file. If +// ** a similar or greater lock is already held, this function is a no-op +// ** (returning SQLITE_OK immediately). +// ** +// ** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke +// ** the busy callback if the lock is currently not available. Repeat +// ** until the busy callback returns false or until the attempt to +// ** obtain the lock succeeds. +// ** +// ** Return SQLITE_OK on success and an error code if we cannot obtain +// ** the lock. If the lock is obtained successfully, set the Pager.state +// ** variable to locktype before returning. +// */ +func _pager_wait_on_lock(tls *libc.TLS, pPager uintptr, locktype int32) (r int32) { + var rc int32 + _ = rc /* Return code */ + /* Check that this is either a no-op (because the requested lock is + ** already held), or one of the transitions that the busy-handler + ** may be invoked during, according to the comment above + ** sqlite3PagerSetBusyhandler(). + */ + for cond := true; cond; cond = rc == int32(SQLITE_BUSY) && (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPager)(unsafe.Pointer(pPager)).FxBusyHandler})))(tls, (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg) != 0 { + rc = _pagerLockDb(tls, pPager, locktype) + } + return rc +} + +/* +** Function assertTruncateConstraint(pPager) checks that one of the +** following is true for all dirty pages currently in the page-cache: +** +** a) The page number is less than or equal to the size of the +** current database image, in pages, OR +** +** b) if the page content were written at this time, it would not +** be necessary to write the current content out to the sub-journal. +** +** If the condition asserted by this function were not true, and the +** dirty page were to be discarded from the cache via the pagerStress() +** routine, pagerStress() would not write the current page content to +** the database file. If a savepoint transaction were rolled back after +** this happened, the correct behavior would be to restore the current +** content of the page. However, since this content is not present in either +** the database file or the portion of the rollback journal and +** sub-journal rolled back the content could not be restored and the +** database image would become corrupt. It is therefore fortunate that +** this circumstance cannot arise. + */ + +// C documentation +// +// /* +// ** Truncate the in-memory database file image to nPage pages. This +// ** function does not actually modify the database file on disk. It +// ** just sets the internal state of the pager object so that the +// ** truncation will be done when the current transaction is committed. +// ** +// ** This function is only called right before committing a transaction. +// ** Once this function has been called, the transaction must either be +// ** rolled back or committed. It is not safe to call this function and +// ** then continue writing to the database. +// */ +func _sqlite3PagerTruncateImage(tls *libc.TLS, pPager uintptr, nPage TPgno) { + (*TPager)(unsafe.Pointer(pPager)).FdbSize = nPage + /* At one point the code here called assertTruncateConstraint() to + ** ensure that all pages being truncated away by this operation are, + ** if one or more savepoints are open, present in the savepoint + ** journal so that they can be restored if the savepoint is rolled + ** back. This is no longer necessary as this function is now only + ** called right before committing a transaction. So although the + ** Pager object may still have open savepoints (Pager.nSavepoint!=0), + ** they cannot be rolled back. So the assertTruncateConstraint() call + ** is no longer correct. */ +} + +// C documentation +// +// /* +// ** This function is called before attempting a hot-journal rollback. It +// ** syncs the journal file to disk, then sets pPager->journalHdr to the +// ** size of the journal file so that the pager_playback() routine knows +// ** that the entire journal file has been synced. +// ** +// ** Syncing a hot-journal to disk before attempting to roll it back ensures +// ** that if a power-failure occurs during the rollback, the process that +// ** attempts rollback following system recovery sees the same journal +// ** content as this process. +// ** +// ** If everything goes as planned, SQLITE_OK is returned. Otherwise, +// ** an SQLite error code. +// */ +func _pagerSyncHotJournal(tls *libc.TLS, pPager uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { + rc = _sqlite3OsSync(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, int32(SQLITE_SYNC_NORMAL)) + } + if rc == SQLITE_OK { + rc = _sqlite3OsFileSize(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, pPager+104) + } + return rc +} + +// C documentation +// +// /* +// ** Obtain a reference to a memory mapped page object for page number pgno. +// ** The new object will use the pointer pData, obtained from xFetch(). +// ** If successful, set *ppPage to point to the new page reference +// ** and return SQLITE_OK. Otherwise, return an SQLite error code and set +// ** *ppPage to zero. +// ** +// ** Page references obtained by calling this function should be released +// ** by calling pagerReleaseMapPage(). +// */ +func _pagerAcquireMapPage(tls *libc.TLS, pPager uintptr, pgno TPgno, pData uintptr, ppPage uintptr) (r int32) { + var p, v1, v2 uintptr + _, _, _ = p, v1, v2 /* Memory mapped page to return */ + if (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist != 0 { + v1 = (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist + p = v1 + *(*uintptr)(unsafe.Pointer(ppPage)) = v1 + (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + (*TPgHdr)(unsafe.Pointer(p)).FpDirty = uintptr(0) + libc.Xmemset(tls, (*TPgHdr)(unsafe.Pointer(p)).FpExtra, 0, uint64(8)) + } else { + v2 = _sqlite3MallocZero(tls, uint64(80)+uint64((*TPager)(unsafe.Pointer(pPager)).FnExtra)) + p = v2 + *(*uintptr)(unsafe.Pointer(ppPage)) = v2 + if p == uintptr(0) { + _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int64(pgno-libc.Uint32FromInt32(1))*(*TPager)(unsafe.Pointer(pPager)).FpageSize, pData) + return int32(SQLITE_NOMEM) + } + (*TPgHdr)(unsafe.Pointer(p)).FpExtra = p + 1*80 + (*TPgHdr)(unsafe.Pointer(p)).Fflags = uint16(PGHDR_MMAP) + (*TPgHdr)(unsafe.Pointer(p)).FnRef = int64(1) + (*TPgHdr)(unsafe.Pointer(p)).FpPager = pPager + } + (*TPgHdr)(unsafe.Pointer(p)).Fpgno = pgno + (*TPgHdr)(unsafe.Pointer(p)).FpData = pData + (*TPager)(unsafe.Pointer(pPager)).FnMmapOut++ + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Release a reference to page pPg. pPg must have been returned by an +// ** earlier call to pagerAcquireMapPage(). +// */ +func _pagerReleaseMapPage(tls *libc.TLS, pPg uintptr) { + var pPager uintptr + _ = pPager + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + (*TPager)(unsafe.Pointer(pPager)).FnMmapOut-- + (*TPgHdr)(unsafe.Pointer(pPg)).FpDirty = (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist + (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist = pPg + _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int64((*TPgHdr)(unsafe.Pointer(pPg)).Fpgno-libc.Uint32FromInt32(1))*(*TPager)(unsafe.Pointer(pPager)).FpageSize, (*TPgHdr)(unsafe.Pointer(pPg)).FpData) +} + +// C documentation +// +// /* +// ** Free all PgHdr objects stored in the Pager.pMmapFreelist list. +// */ +func _pagerFreeMapHdrs(tls *libc.TLS, pPager uintptr) { + var p, pNext uintptr + _, _ = p, pNext + p = (*TPager)(unsafe.Pointer(pPager)).FpMmapFreelist + for { + if !(p != 0) { + break + } + pNext = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + Xsqlite3_free(tls, p) + goto _1 + _1: + ; + p = pNext + } +} + +// C documentation +// +// /* Verify that the database file has not be deleted or renamed out from +// ** under the pager. Return SQLITE_OK if the database is still where it ought +// ** to be on disk. Return non-zero (SQLITE_READONLY_DBMOVED or some other error +// ** code from sqlite3OsAccess()) if the database has gone missing. +// */ +func _databaseIsUnmoved(tls *libc.TLS, pPager uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* bHasMoved at bp+0 */ int32 + _ = rc + *(*int32)(unsafe.Pointer(bp)) = 0 + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + return SQLITE_OK + } + if (*TPager)(unsafe.Pointer(pPager)).FdbSize == uint32(0) { + return SQLITE_OK + } + rc = _sqlite3OsFileControl(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_HAS_MOVED), bp) + if rc == int32(SQLITE_NOTFOUND) { + /* If the HAS_MOVED file-control is unimplemented, assume that the file + ** has not been moved. That is the historical behavior of SQLite: prior to + ** version 3.8.3, it never checked */ + rc = SQLITE_OK + } else { + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp)) != 0 { + rc = libc.Int32FromInt32(SQLITE_READONLY) | libc.Int32FromInt32(4)<errCode = 0; */ + (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode = uint8(0) + a = uintptr(0) + if db != 0 && uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_NoCkptOnClose) && SQLITE_OK == _databaseIsUnmoved(tls, pPager) { + a = pTmp + } + _sqlite3WalClose(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, db, int32((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), a) + (*TPager)(unsafe.Pointer(pPager)).FpWal = uintptr(0) + _pager_reset(tls, pPager) + if (*TPager)(unsafe.Pointer(pPager)).FmemDb != 0 { + _pager_unlock(tls, pPager) + } else { + /* If it is open, sync the journal file before calling UnlockAndRollback. + ** If this is not done, then an unsynced portion of the open journal + ** file may be played back into the database. If a power failure occurs + ** while this is happening, the database could become corrupt. + ** + ** If an error occurs while trying to sync the journal, shift the pager + ** into the ERROR state. This causes UnlockAndRollback to unlock the + ** database and close the journal file without attempting to roll it + ** back or finalize it. The next database user will have to do hot-journal + ** rollback before accessing the database file. + */ + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { + _pager_error(tls, pPager, _pagerSyncHotJournal(tls, pPager)) + } + _pagerUnlockAndRollback(tls, pPager) + } + _sqlite3EndBenignMalloc(tls) + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd) + _sqlite3PageFree(tls, pTmp) + _sqlite3PcacheClose(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + Xsqlite3_free(tls, pPager) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Increment the reference count for page pPg. +// */ +func _sqlite3PagerRef(tls *libc.TLS, pPg uintptr) { + _sqlite3PcacheRef(tls, pPg) +} + +// C documentation +// +// /* +// ** Sync the journal. In other words, make sure all the pages that have +// ** been written to the journal have actually reached the surface of the +// ** disk and can be restored in the event of a hot-journal rollback. +// ** +// ** If the Pager.noSync flag is set, then this function is a no-op. +// ** Otherwise, the actions required depend on the journal-mode and the +// ** device characteristics of the file-system, as follows: +// ** +// ** * If the journal file is an in-memory journal file, no action need +// ** be taken. +// ** +// ** * Otherwise, if the device does not support the SAFE_APPEND property, +// ** then the nRec field of the most recently written journal header +// ** is updated to contain the number of journal records that have +// ** been written following it. If the pager is operating in full-sync +// ** mode, then the journal file is synced before this field is updated. +// ** +// ** * If the device does not support the SEQUENTIAL property, then +// ** journal file is synced. +// ** +// ** Or, in pseudo-code: +// ** +// ** if( NOT ){ +// ** if( NOT SAFE_APPEND ){ +// ** if( ) xSync(); +// ** +// ** } +// ** if( NOT SEQUENTIAL ) xSync(); +// ** } +// ** +// ** If successful, this routine clears the PGHDR_NEED_SYNC flag of every +// ** page currently held in memory before returning SQLITE_OK. If an IO +// ** error is encountered, then the IO error code is returned to the caller. +// */ +func _syncJournal(tls *libc.TLS, pPager uintptr, newHdr int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iDc, rc, v1 int32 + var iNextHdrOffset Ti64 + var _ /* aMagic at bp+0 */ [8]Tu8 + var _ /* zHeader at bp+8 */ [12]Tu8 + _, _, _, _ = iDc, iNextHdrOffset, rc, v1 /* Return code */ + rc = _sqlite3PagerExclusiveLock(tls, pPager) + if rc != SQLITE_OK { + return rc + } + if !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_MEMORY) { + iDc = _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd) + if 0 == iDc&int32(SQLITE_IOCAP_SAFE_APPEND) { + libc.Xmemcpy(tls, bp+8, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) + _sqlite3Put4byte(tls, bp+8+uintptr(8), uint32((*TPager)(unsafe.Pointer(pPager)).FnRec)) + iNextHdrOffset = _journalHdrOffset(tls, pPager) + rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp, int32(8), iNextHdrOffset) + if rc == SQLITE_OK && 0 == libc.Xmemcmp(tls, bp, uintptr(unsafe.Pointer(&_aJournalMagic)), uint64(8)) { + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&_zerobyte)), int32(1), iNextHdrOffset) + } + if rc != SQLITE_OK && rc != libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)< (*TPager)(unsafe.Pointer(pPager)).FdbHintSize) { + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = (*TPager)(unsafe.Pointer(pPager)).FpageSize * int64((*TPager)(unsafe.Pointer(pPager)).FdbSize) + _sqlite3OsFileControlHint(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_SIZE_HINT), bp) + (*TPager)(unsafe.Pointer(pPager)).FdbHintSize = (*TPager)(unsafe.Pointer(pPager)).FdbSize + } + for rc == SQLITE_OK && pList != 0 { + pgno = (*TPgHdr)(unsafe.Pointer(pList)).Fpgno + /* If there are dirty pages in the page cache with page numbers greater + ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to + ** make the file smaller (presumably by auto-vacuum code). Do not write + ** any such pages to the file. + ** + ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag + ** set (set by sqlite3PagerDontWrite()). + */ + if pgno <= (*TPager)(unsafe.Pointer(pPager)).FdbSize && 0 == int32((*TPgHdr)(unsafe.Pointer(pList)).Fflags)&int32(PGHDR_DONT_WRITE) { + offset = int64(pgno-libc.Uint32FromInt32(1)) * (*TPager)(unsafe.Pointer(pPager)).FpageSize /* Data to write */ + if (*TPgHdr)(unsafe.Pointer(pList)).Fpgno == uint32(1) { + _pager_write_changecounter(tls, pList) + } + pData = (*TPgHdr)(unsafe.Pointer(pList)).FpData + /* Write out the page data. */ + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, pData, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), offset) + /* If page 1 was just written, update Pager.dbFileVers to match + ** the value now stored in the database file. If writing this + ** page caused the database file to grow, update dbFileSize. + */ + if pgno == uint32(1) { + libc.Xmemcpy(tls, pPager+136, pData+24, uint64(16)) + } + if pgno > (*TPager)(unsafe.Pointer(pPager)).FdbFileSize { + (*TPager)(unsafe.Pointer(pPager)).FdbFileSize = pgno + } + *(*Tu32)(unsafe.Pointer(pPager + 248 + 2*4))++ + /* Update any backup objects copying the contents of this pager. */ + _sqlite3BackupUpdate(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup, pgno, (*TPgHdr)(unsafe.Pointer(pList)).FpData) + } else { + } + pList = (*TPgHdr)(unsafe.Pointer(pList)).FpDirty + } + return rc +} + +// C documentation +// +// /* +// ** Ensure that the sub-journal file is open. If it is already open, this +// ** function is a no-op. +// ** +// ** SQLITE_OK is returned if everything goes according to plan. An +// ** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() +// ** fails. +// */ +func _openSubJournal(tls *libc.TLS, pPager uintptr) (r int32) { + var flags, nStmtSpill, rc int32 + _, _, _ = flags, nStmtSpill, rc + rc = SQLITE_OK + if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fsjfd)).FpMethods != libc.UintptrFromInt32(0)) { + flags = libc.Int32FromInt32(SQLITE_OPEN_SUBJOURNAL) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) + nStmtSpill = _sqlite3Config.FnStmtSpill + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) || (*TPager)(unsafe.Pointer(pPager)).FsubjInMemory != 0 { + nStmtSpill = -int32(1) + } + rc = _sqlite3JournalOpen(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, uintptr(0), (*TPager)(unsafe.Pointer(pPager)).Fsjfd, flags, nStmtSpill) + } + return rc +} + +// C documentation +// +// /* +// ** Append a record of the current state of page pPg to the sub-journal. +// ** +// ** If successful, set the bit corresponding to pPg->pgno in the bitvecs +// ** for all open savepoints before returning. +// ** +// ** This function returns SQLITE_OK if everything is successful, an IO +// ** error code if the attempt to write to the sub-journal fails, or +// ** SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint +// ** bitvec. +// */ +func _subjournalPage(tls *libc.TLS, pPg uintptr) (r int32) { + var offset Ti64 + var pData, pData2, pPager uintptr + var rc int32 + _, _, _, _, _ = offset, pData, pData2, pPager, rc + rc = SQLITE_OK + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_OFF) { + /* Open the sub-journal, if it has not already been opened */ + rc = _openSubJournal(tls, pPager) + /* If the sub-journal was opened successfully (or was already open), + ** write the journal record into the file. */ + if rc == SQLITE_OK { + pData = (*TPgHdr)(unsafe.Pointer(pPg)).FpData + offset = int64((*TPager)(unsafe.Pointer(pPager)).FnSubRec) * (int64(4) + (*TPager)(unsafe.Pointer(pPager)).FpageSize) + pData2 = pData + rc = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd, offset, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) + if rc == SQLITE_OK { + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd, pData2, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), offset+int64(4)) + } + } + } + if rc == SQLITE_OK { + (*TPager)(unsafe.Pointer(pPager)).FnSubRec++ + rc = _addToSavepointBitvecs(tls, pPager, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) + } + return rc +} + +func _subjournalPageIfRequired(tls *libc.TLS, pPg uintptr) (r int32) { + if _subjRequiresPage(tls, pPg) != 0 { + return _subjournalPage(tls, pPg) + } else { + return SQLITE_OK + } + return r +} + +// C documentation +// +// /* +// ** This function is called by the pcache layer when it has reached some +// ** soft memory limit. The first argument is a pointer to a Pager object +// ** (cast as a void*). The pager is always 'purgeable' (not an in-memory +// ** database). The second argument is a reference to a page that is +// ** currently dirty but has no outstanding references. The page +// ** is always associated with the Pager object passed as the first +// ** argument. +// ** +// ** The job of this function is to make pPg clean by writing its contents +// ** out to the database file, if possible. This may involve syncing the +// ** journal file. +// ** +// ** If successful, sqlite3PcacheMakeClean() is called on the page and +// ** SQLITE_OK returned. If an IO error occurs while trying to make the +// ** page clean, the IO error code is returned. If the page cannot be +// ** made clean for some other reason, but no error occurs, then SQLITE_OK +// ** is returned by sqlite3PcacheMakeClean() is not called. +// */ +func _pagerStress(tls *libc.TLS, p uintptr, pPg uintptr) (r int32) { + var pPager uintptr + var rc int32 + _, _ = pPager, rc + pPager = p + rc = SQLITE_OK + /* The doNotSpill NOSYNC bit is set during times when doing a sync of + ** journal (and adding a new header) is not allowed. This occurs + ** during calls to sqlite3PagerWrite() while trying to journal multiple + ** pages belonging to the same sector. + ** + ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling + ** regardless of whether or not a sync is required. This is set during + ** a rollback or by user request, respectively. + ** + ** Spilling is also prohibited when in an error state since that could + ** lead to database corruption. In the current implementation it + ** is impossible for sqlite3PcacheFetch() to be called with createFlag==3 + ** while in the error state, hence it is impossible for this routine to + ** be called in the error state. Nevertheless, we include a NEVER() + ** test for the error state as a safeguard against future changes. + */ + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return SQLITE_OK + } + if (*TPager)(unsafe.Pointer(pPager)).FdoNotSpill != 0 && (int32((*TPager)(unsafe.Pointer(pPager)).FdoNotSpill)&(libc.Int32FromInt32(SPILLFLAG_ROLLBACK)|libc.Int32FromInt32(SPILLFLAG_OFF)) != 0 || int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_NEED_SYNC) != 0) { + return SQLITE_OK + } + *(*Tu32)(unsafe.Pointer(pPager + 248 + 3*4))++ + (*TPgHdr)(unsafe.Pointer(pPg)).FpDirty = uintptr(0) + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + /* Write a single frame for this page to the log. */ + rc = _subjournalPageIfRequired(tls, pPg) + if rc == SQLITE_OK { + rc = _pagerWalFrames(tls, pPager, pPg, uint32(0), 0) + } + } else { + /* Sync the journal file if required. */ + if int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_NEED_SYNC) != 0 || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_WRITER_CACHEMOD) { + rc = _syncJournal(tls, pPager, int32(1)) + } + /* Write the contents of the page out to the database file. */ + if rc == SQLITE_OK { + rc = _pager_write_pagelist(tls, pPager, pPg) + } + } + /* Mark the page as clean. */ + if rc == SQLITE_OK { + _sqlite3PcacheMakeClean(tls, pPg) + } + return _pager_error(tls, pPager, rc) +} + +// C documentation +// +// /* +// ** Flush all unreferenced dirty pages to disk. +// */ +func _sqlite3PagerFlush(tls *libc.TLS, pPager uintptr) (r int32) { + var pList, pNext uintptr + var rc int32 + _, _, _ = pList, pNext, rc + rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode + if !((*TPager)(unsafe.Pointer(pPager)).FmemDb != 0) { + pList = _sqlite3PcacheDirtyList(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + for rc == SQLITE_OK && pList != 0 { + pNext = (*TPgHdr)(unsafe.Pointer(pList)).FpDirty + if (*TPgHdr)(unsafe.Pointer(pList)).FnRef == 0 { + rc = _pagerStress(tls, pPager, pList) + } + pList = pNext + } + } + return rc +} + +// C documentation +// +// /* +// ** Allocate and initialize a new Pager object and put a pointer to it +// ** in *ppPager. The pager should eventually be freed by passing it +// ** to sqlite3PagerClose(). +// ** +// ** The zFilename argument is the path to the database file to open. +// ** If zFilename is NULL then a randomly-named temporary file is created +// ** and used as the file to be cached. Temporary files are be deleted +// ** automatically when they are closed. If zFilename is ":memory:" then +// ** all information is held in cache. It is never written to disk. +// ** This can be used to implement an in-memory database. +// ** +// ** The nExtra parameter specifies the number of bytes of space allocated +// ** along with each page reference. This space is available to the user +// ** via the sqlite3PagerGetExtra() API. When a new page is allocated, the +// ** first 8 bytes of this space are zeroed but the remainder is uninitialized. +// ** (The extra space is used by btree as the MemPage object.) +// ** +// ** The flags argument is used to specify properties that affect the +// ** operation of the pager. It should be passed some bitwise combination +// ** of the PAGER_* flags. +// ** +// ** The vfsFlags parameter is a bitmask to pass to the flags parameter +// ** of the xOpen() method of the supplied VFS when opening files. +// ** +// ** If the pager object is allocated and the specified file opened +// ** successfully, SQLITE_OK is returned and *ppPager set to point to +// ** the new pager object. If an error occurs, *ppPager is set to NULL +// ** and error code returned. This function may return SQLITE_NOMEM +// ** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or +// ** various SQLITE_IO_XXX errors. +// */ +func _sqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename uintptr, nExtra int32, flags int32, vfsFlags int32, xReinit uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iDc, journalFileSize, memDb, memJM, nPathname, nUriByte, pcacheSize, rc, readOnly, tempFile, useJournal, v4 int32 + var pPtr, z, zPathname, zUri, v1, v5 uintptr + var _ /* fout at bp+12 */ int32 + var _ /* pPager at bp+0 */ uintptr + var _ /* szPageDflt at bp+8 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iDc, journalFileSize, memDb, memJM, nPathname, nUriByte, pPtr, pcacheSize, rc, readOnly, tempFile, useJournal, z, zPathname, zUri, v1, v4, v5 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Pager object to allocate and return */ + rc = SQLITE_OK /* Return code */ + tempFile = 0 /* True for temp files (incl. in-memory files) */ + memDb = 0 /* True if this is an in-memory file */ + memJM = 0 /* Memory journal mode */ + readOnly = 0 /* Bytes to allocate for each journal fd */ + zPathname = uintptr(0) /* Full path to database file */ + nPathname = 0 /* Number of bytes in zPathname */ + useJournal = libc.BoolInt32(flags&int32(PAGER_OMIT_JOURNAL) == 0) /* False to omit journal */ + pcacheSize = _sqlite3PcacheSize(tls) /* Bytes to allocate for PCache */ + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(SQLITE_DEFAULT_PAGE_SIZE) /* Default page size */ + zUri = uintptr(0) /* URI args to copy */ + nUriByte = int32(1) /* Number of bytes of URI args at *zUri */ + /* Figure out how much space is required for each journal file-handle + ** (there are two of them, the main journal and the sub-journal). */ + journalFileSize = (_sqlite3JournalSize(tls, pVfs) + int32(7)) & ^libc.Int32FromInt32(7) + /* Set the output variable to NULL in case an error occurs. */ + *(*uintptr)(unsafe.Pointer(ppPager)) = uintptr(0) + if flags&int32(PAGER_MEMORY) != 0 { + memDb = int32(1) + if zFilename != 0 && *(*int8)(unsafe.Pointer(zFilename)) != 0 { + zPathname = _sqlite3DbStrDup(tls, uintptr(0), zFilename) + if zPathname == uintptr(0) { + return int32(SQLITE_NOMEM) + } + nPathname = _sqlite3Strlen30(tls, zPathname) + zFilename = uintptr(0) + } + } + /* Compute and store the full pathname in an allocated buffer pointed + ** to by zPathname, length nPathname. Or, if this is a temporary file, + ** leave both nPathname and zPathname set to 0. + */ + if zFilename != 0 && *(*int8)(unsafe.Pointer(zFilename)) != 0 { + nPathname = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + int32(1) + zPathname = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(nPathname*int32(2))) + if zPathname == uintptr(0) { + return int32(SQLITE_NOMEM) + } + *(*int8)(unsafe.Pointer(zPathname)) = 0 /* Make sure initialized even if FullPathname() fails */ + rc = _sqlite3OsFullPathname(tls, pVfs, zFilename, nPathname, zPathname) + if rc != SQLITE_OK { + if rc == libc.Int32FromInt32(SQLITE_OK)|libc.Int32FromInt32(2)< (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname { + /* This branch is taken when the journal path required by + ** the database being opened will be more than pVfs->mxPathname + ** bytes in length. This means the database cannot be opened, + ** as it will not be possible to open the journal file or even + ** check for a hot-journal before reading. + */ + rc = _sqlite3CantopenError(tls, int32(61558)) + } + if rc != SQLITE_OK { + _sqlite3DbFree(tls, uintptr(0), zPathname) + return rc + } + } + /* Allocate memory for the Pager structure, PCache object, the + ** three file descriptors, the database file name and the journal + ** file name. The layout in memory is as follows: + ** + ** Pager object (sizeof(Pager) bytes) + ** PCache object (sqlite3PcacheSize() bytes) + ** Database file handle (pVfs->szOsFile bytes) + ** Sub-journal file handle (journalFileSize bytes) + ** Main journal file handle (journalFileSize bytes) + ** Ptr back to the Pager (sizeof(Pager*) bytes) + ** \0\0\0\0 database prefix (4 bytes) + ** Database file name (nPathname+1 bytes) + ** URI query parameters (nUriByte bytes) + ** Journal filename (nPathname+8+1 bytes) + ** WAL filename (nPathname+4+1 bytes) + ** \0\0\0 terminator (3 bytes) + ** + ** Some 3rd-party software, over which we have no control, depends on + ** the specific order of the filenames and the \0 separators between them + ** so that it can (for example) find the database filename given the WAL + ** filename without using the sqlite3_filename_database() API. This is a + ** misuse of SQLite and a bug in the 3rd-party software, but the 3rd-party + ** software is in widespread use, so we try to avoid changing the filename + ** order and formatting if possible. In particular, the details of the + ** filename format expected by 3rd-party software should be as follows: + ** + ** - Main Database Path + ** - \0 + ** - Multiple URI components consisting of: + ** - Key + ** - \0 + ** - Value + ** - \0 + ** - \0 + ** - Journal Path + ** - \0 + ** - WAL Path (zWALName) + ** - \0 + ** + ** The sqlite3_create_filename() interface and the databaseFilename() utility + ** that is used by sqlite3_filename_database() and kin also depend on the + ** specific formatting and order of the various filenames, so if the format + ** changes here, be sure to change it there as well. + */ + pPtr = _sqlite3MallocZero(tls, (libc.Uint64FromInt64(312)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))+uint64((pcacheSize+libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7))+uint64(((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile+libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7))+uint64(journalFileSize*int32(2))+uint64(__SIZEOF_POINTER__)+uint64(4)+uint64(nPathname)+uint64(1)+uint64(nUriByte)+uint64(nPathname)+uint64(8)+uint64(1)+uint64(nPathname)+uint64(4)+uint64(1)+uint64(3)) + if !(pPtr != 0) { + _sqlite3DbFree(tls, uintptr(0), zPathname) + return int32(SQLITE_NOMEM) + } + *(*uintptr)(unsafe.Pointer(bp)) = pPtr + pPtr += uintptr((libc.Uint64FromInt64(312) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpPCache = pPtr + pPtr += uintptr((pcacheSize + libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7)) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd = pPtr + pPtr += uintptr(((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile + libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7)) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fsjfd = pPtr + pPtr += uintptr(journalFileSize) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fjfd = pPtr + pPtr += uintptr(journalFileSize) + libc.Xmemcpy(tls, pPtr, bp, uint64(__SIZEOF_POINTER__)) + pPtr += uintptr(__SIZEOF_POINTER__) + /* Fill in the Pager.zFilename and pPager.zQueryParam fields */ + pPtr += uintptr(4) /* Skip zero prefix */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename = pPtr + if nPathname > 0 { + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += uintptr(nPathname + int32(1)) + if zUri != 0 { + libc.Xmemcpy(tls, pPtr, zUri, uint64(nUriByte)) + pPtr += uintptr(nUriByte) + } else { + pPtr++ + } + } + /* Fill in Pager.zJournal */ + if nPathname > 0 { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzJournal = pPtr + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += uintptr(nPathname) + libc.Xmemcpy(tls, pPtr, __ccgo_ts+4110, uint64(8)) + pPtr += uintptr(libc.Int32FromInt32(8) + libc.Int32FromInt32(1)) + } else { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzJournal = uintptr(0) + } + /* Fill in Pager.zWal */ + if nPathname > 0 { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzWal = pPtr + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += uintptr(nPathname) + libc.Xmemcpy(tls, pPtr, __ccgo_ts+4119, uint64(4)) + pPtr += uintptr(libc.Int32FromInt32(4) + libc.Int32FromInt32(1)) + } else { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzWal = uintptr(0) + } + _ = pPtr /* Suppress warning about unused pPtr value */ + if nPathname != 0 { + _sqlite3DbFree(tls, uintptr(0), zPathname) + } + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpVfs = pVfs + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FvfsFlags = uint32(vfsFlags) + /* Open the pager file. + */ + if !(zFilename != 0 && *(*int8)(unsafe.Pointer(zFilename)) != 0) { + goto _2 + } + *(*int32)(unsafe.Pointer(bp + 12)) = 0 /* VFS flags returned by xOpen() */ + rc = _sqlite3OsOpen(tls, pVfs, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd, vfsFlags, bp+12) + v4 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 12))&libc.Int32FromInt32(SQLITE_OPEN_MEMORY) != libc.Int32FromInt32(0)) + memJM = v4 + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmemVfs = uint8(v4) + readOnly = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 12))&int32(SQLITE_OPEN_READONLY) != 0) + /* If the file was successfully opened for read/write access, + ** choose a default page size in case we have to create the + ** database file. The default page size is the maximum of: + ** + ** + SQLITE_DEFAULT_PAGE_SIZE, + ** + The value returned by sqlite3OsSectorSize() + ** + The largest page size that can be written atomically. + */ + if rc == SQLITE_OK { + iDc = _sqlite3OsDeviceCharacteristics(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd) + if !(readOnly != 0) { + _setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if *(*Tu32)(unsafe.Pointer(bp + 8)) < (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FsectorSize { + if (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FsectorSize > uint32(SQLITE_MAX_DEFAULT_PAGE_SIZE) { + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(SQLITE_MAX_DEFAULT_PAGE_SIZE) + } else { + *(*Tu32)(unsafe.Pointer(bp + 8)) = (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FsectorSize + } + } + } + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnoLock = uint8(Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4124, 0)) + if iDc&int32(SQLITE_IOCAP_IMMUTABLE) != 0 || Xsqlite3_uri_boolean(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzFilename, __ccgo_ts+4131, 0) != 0 { + vfsFlags |= int32(SQLITE_OPEN_READONLY) + goto act_like_temp_file + } + } + goto _3 +_2: + ; + /* If a temporary file is requested, it is not opened immediately. + ** In this case we accept the default page size and delay actually + ** opening the file until the first call to OsWrite(). + ** + ** This branch is also run for an in-memory database. An in-memory + ** database is the same as a temp-file that is never written out to + ** disk and uses an in-memory rollback journal. + ** + ** This branch also runs for files marked as immutable. + */ +act_like_temp_file: + ; + tempFile = int32(1) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FeState = uint8(PAGER_READER) /* Pretend we already have a lock */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FeLock = uint8(EXCLUSIVE_LOCK) /* Pretend we are in EXCLUSIVE mode */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnoLock = uint8(1) /* Do no locking */ + readOnly = vfsFlags & int32(SQLITE_OPEN_READONLY) +_3: + ; + /* The following call to PagerSetPagesize() serves to set the value of + ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer. + */ + if rc == SQLITE_OK { + rc = _sqlite3PagerSetPagesize(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+8, -int32(1)) + } + /* Initialize the PCache object. */ + if rc == SQLITE_OK { + nExtra = (nExtra + int32(7)) & ^libc.Int32FromInt32(7) + if !(memDb != 0) { + v5 = __ccgo_fp(_pagerStress) + } else { + v5 = uintptr(0) + } + rc = _sqlite3PcacheOpen(tls, int32(*(*Tu32)(unsafe.Pointer(bp + 8))), nExtra, libc.BoolInt32(!(memDb != 0)), v5, *(*uintptr)(unsafe.Pointer(bp)), (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpPCache) + } + /* If an error occurred above, free the Pager structure and close the file. + */ + if rc != SQLITE_OK { + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Ffd) + _sqlite3PageFree(tls, (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpTmpSpace) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc + } + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FuseJournal = uint8(useJournal) + /* pPager->stmtOpen = 0; */ + /* pPager->stmtInUse = 0; */ + /* pPager->nRef = 0; */ + /* pPager->stmtSize = 0; */ + /* pPager->stmtJSize = 0; */ + /* pPager->nPage = 0; */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmxPgno = uint32(SQLITE_MAX_PAGE_COUNT) + /* pPager->state = PAGER_UNLOCK; */ + /* pPager->errMask = 0; */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FtempFile = uint8(tempFile) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FexclusiveMode = uint8(tempFile) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FchangeCountDone = (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FtempFile + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmemDb = uint8(memDb) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FreadOnly = uint8(readOnly) + _sqlite3PagerSetFlags(tls, *(*uintptr)(unsafe.Pointer(bp)), uint32(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS)+libc.Int32FromInt32(1)|libc.Int32FromInt32(PAGER_CACHESPILL))) + /* pPager->pFirst = 0; */ + /* pPager->pFirstSynced = 0; */ + /* pPager->pLast = 0; */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExtra = uint16(nExtra) + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FjournalSizeLimit = int64(-int32(1)) + _setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if !(useJournal != 0) { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FjournalMode = uint8(PAGER_JOURNALMODE_OFF) + } else { + if memDb != 0 || memJM != 0 { + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FjournalMode = uint8(PAGER_JOURNALMODE_MEMORY) + } + } + /* pPager->xBusyHandler = 0; */ + /* pPager->pBusyHandlerArg = 0; */ + (*TPager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxReiniter = xReinit + _setGetterMethod(tls, *(*uintptr)(unsafe.Pointer(bp))) + /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */ + /* pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c */ + *(*uintptr)(unsafe.Pointer(ppPager)) = *(*uintptr)(unsafe.Pointer(bp)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the sqlite3_file for the main database given the name +// ** of the corresponding WAL or Journal name as passed into +// ** xOpen. +// */ +func Xsqlite3_database_file_object(tls *libc.TLS, zName uintptr) (r uintptr) { + var p, pPager uintptr + _, _ = p, pPager + for int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(1))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(2))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(3))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(4))))) != 0 { + zName-- + } + p = zName - uintptr(4) - uintptr(8) + pPager = *(*uintptr)(unsafe.Pointer(p)) + return (*TPager)(unsafe.Pointer(pPager)).Ffd +} + +// C documentation +// +// /* +// ** This function is called after transitioning from PAGER_UNLOCK to +// ** PAGER_SHARED state. It tests if there is a hot journal present in +// ** the file-system for the given pager. A hot journal is one that +// ** needs to be played back. According to this function, a hot-journal +// ** file exists if the following criteria are met: +// ** +// ** * The journal file exists in the file system, and +// ** * No process holds a RESERVED or greater lock on the database file, and +// ** * The database file itself is greater than 0 bytes in size, and +// ** * The first byte of the journal file exists and is not 0x00. +// ** +// ** If the current size of the database file is 0 but a journal file +// ** exists, that is probably an old journal left over from a prior +// ** database with the same name. In this case the journal file is +// ** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK +// ** is returned. +// ** +// ** This routine does not check if there is a super-journal filename +// ** at the end of the file. If there is, and that super-journal file +// ** does not exist, then the journal file is not really hot. In this +// ** case this routine will return a false-positive. The pager_playback() +// ** routine will discover that the journal file is not really hot and +// ** will not roll it back. +// ** +// ** If a hot-journal file is found to exist, *pExists is set to 1 and +// ** SQLITE_OK returned. If no hot-journal file is present, *pExists is +// ** set to 0 and SQLITE_OK returned. If an IO error occurs while trying +// ** to determine whether or not a hot-journal file exists, the IO error +// ** code is returned and the value of *pExists is undefined. +// */ +func _hasHotJournal(tls *libc.TLS, pPager uintptr, pExists uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var jrnlOpen, rc int32 + var pVfs uintptr + var _ /* exists at bp+0 */ int32 + var _ /* f at bp+12 */ int32 + var _ /* first at bp+16 */ Tu8 + var _ /* locked at bp+4 */ int32 + var _ /* nPage at bp+8 */ TPgno + _, _, _ = jrnlOpen, pVfs, rc + pVfs = (*TPager)(unsafe.Pointer(pPager)).FpVfs + rc = SQLITE_OK /* Return code */ + *(*int32)(unsafe.Pointer(bp)) = int32(1) /* True if a journal file is present */ + jrnlOpen = libc.BoolInt32(!!((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0))) + *(*int32)(unsafe.Pointer(pExists)) = 0 + if !(jrnlOpen != 0) { + rc = _sqlite3OsAccess(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, SQLITE_ACCESS_EXISTS, bp) + } + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp)) != 0 { + *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* True if some process holds a RESERVED lock */ + /* Race condition here: Another process might have been holding the + ** the RESERVED lock and have a journal open at the sqlite3OsAccess() + ** call above, but then delete the journal and drop the lock before + ** we get to the following sqlite3OsCheckReservedLock() call. If that + ** is the case, this routine might think there is a hot journal when + ** in fact there is none. This results in a false-positive which will + ** be dealt with by the playback routine. Ticket #3883. + */ + rc = _sqlite3OsCheckReservedLock(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, bp+4) + if rc == SQLITE_OK && !(*(*int32)(unsafe.Pointer(bp + 4)) != 0) { /* Number of pages in database file */ + rc = _pagerPagecount(tls, pPager, bp+8) + if rc == SQLITE_OK { + /* If the database is zero pages in size, that means that either (1) the + ** journal is a remnant from a prior database with the same name where + ** the database file but not the journal was deleted, or (2) the initial + ** transaction that populates a new database is being rolled back. + ** In either case, the journal file can be deleted. However, take care + ** not to delete the journal file if it is already open due to + ** journal_mode=PERSIST. + */ + if *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(0) && !(jrnlOpen != 0) { + _sqlite3BeginBenignMalloc(tls) + if _pagerLockDb(tls, pPager, int32(RESERVED_LOCK)) == SQLITE_OK { + _sqlite3OsDelete(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, 0) + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) { + _pagerUnlockDb(tls, pPager, int32(SHARED_LOCK)) + } + } + _sqlite3EndBenignMalloc(tls) + } else { + /* The journal file exists and no other connection has a reserved + ** or greater lock on the database file. Now check that there is + ** at least one non-zero bytes at the start of the journal file. + ** If there is, then we consider this journal to be hot. If not, + ** it can be ignored. + */ + if !(jrnlOpen != 0) { + *(*int32)(unsafe.Pointer(bp + 12)) = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_MAIN_JOURNAL) + rc = _sqlite3OsOpen(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, (*TPager)(unsafe.Pointer(pPager)).Fjfd, *(*int32)(unsafe.Pointer(bp + 12)), bp+12) + } + if rc == SQLITE_OK { + *(*Tu8)(unsafe.Pointer(bp + 16)) = uint8(0) + rc = _sqlite3OsRead(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, bp+16, int32(1), 0) + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)< (*TPager)(unsafe.Pointer(pPager)).FmxPgno { + rc = int32(SQLITE_FULL) + if pgno <= (*TPager)(unsafe.Pointer(pPager)).FdbSize { + _sqlite3PcacheRelease(tls, pPg) + pPg = uintptr(0) + } + goto pager_acquire_err + } + if noContent != 0 { + /* Failure to set the bits in the InJournal bit-vectors is benign. + ** It merely means that we might do some extra work to journal a + ** page that does not need to be journaled. Nevertheless, be sure + ** to test the case where a malloc error occurs while trying to set + ** a bit in a bit vector. + */ + _sqlite3BeginBenignMalloc(tls) + if pgno <= (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize { + _sqlite3BitvecSet(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, pgno) + } + _addToSavepointBitvecs(tls, pPager, pgno) + _sqlite3EndBenignMalloc(tls) + } + libc.Xmemset(tls, (*TPgHdr)(unsafe.Pointer(pPg)).FpData, 0, uint64((*TPager)(unsafe.Pointer(pPager)).FpageSize)) + } else { + *(*Tu32)(unsafe.Pointer(pPager + 248 + 1*4))++ + rc = _readDbPage(tls, pPg) + if rc != SQLITE_OK { + goto pager_acquire_err + } + } + } + return SQLITE_OK +pager_acquire_err: + ; + if pPg != 0 { + _sqlite3PcacheDrop(tls, pPg) + } + _pagerUnlockIfUnused(tls, pPager) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc +} + +// C documentation +// +// /* The page getter for when memory-mapped I/O is enabled */ +func _getPageMMap(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bMmapOk, rc int32 + var _ /* iFrame at bp+8 */ Tu32 + var _ /* pData at bp+16 */ uintptr + var _ /* pPg at bp+0 */ uintptr + _, _ = bMmapOk, rc + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Frame to read from WAL file */ + /* It is acceptable to use a read-only (mmap) page for any page except + ** page 1 if there is no write-transaction open or the ACQUIRE_READONLY + ** flag was specified by the caller. And so long as the db is not a + ** temporary or in-memory database. */ + bMmapOk = libc.BoolInt32(pgno > uint32(1) && (int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) || flags&int32(PAGER_GET_READONLY) != 0)) + /* Optimization note: Adding the "pgno<=1" term before "pgno==0" here + ** allows the compiler optimizer to reuse the results of the "pgno>1" + ** test in the previous statement, and avoid testing pgno==0 in the + ** common case where pgno is large. */ + if pgno <= uint32(1) && pgno == uint32(0) { + return _sqlite3CorruptError(tls, int32(62407)) + } + if bMmapOk != 0 && (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + rc = _sqlite3WalFindFrame(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pgno, bp+8) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + } + if bMmapOk != 0 && *(*Tu32)(unsafe.Pointer(bp + 8)) == uint32(0) { + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + rc = _sqlite3OsFetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int64(pgno-libc.Uint32FromInt32(1))*(*TPager)(unsafe.Pointer(pPager)).FpageSize, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), bp+16) + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) > int32(PAGER_READER) || (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3PagerLookup(tls, pPager, pgno) + } + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + rc = _pagerAcquireMapPage(tls, pPager, pgno, *(*uintptr)(unsafe.Pointer(bp + 16)), bp) + } else { + _sqlite3OsUnfetch(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int64(pgno-libc.Uint32FromInt32(1))*(*TPager)(unsafe.Pointer(pPager)).FpageSize, *(*uintptr)(unsafe.Pointer(bp + 16))) + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp)) + return SQLITE_OK + } + } + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + } + return _getPageNormal(tls, pPager, pgno, ppPage, flags) +} + +// C documentation +// +// /* The page getter method for when the pager is an error state */ +func _getPageError(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { + _ = pgno + _ = flags + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return (*TPager)(unsafe.Pointer(pPager)).FerrCode +} + +// C documentation +// +// /* Dispatch all page fetch requests to the appropriate getter method. +// */ +func _sqlite3PagerGet(tls *libc.TLS, pPager uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { + /* Normal, high-speed version of sqlite3PagerGet() */ + return (*(*func(*libc.TLS, uintptr, TPgno, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPager)(unsafe.Pointer(pPager)).FxGet})))(tls, pPager, pgno, ppPage, flags) +} + +// C documentation +// +// /* +// ** Acquire a page if it is already in the in-memory cache. Do +// ** not read the page from disk. Return a pointer to the page, +// ** or 0 if the page is not in cache. +// ** +// ** See also sqlite3PagerGet(). The difference between this routine +// ** and sqlite3PagerGet() is that _get() will go to the disk and read +// ** in the page if the page is not already in cache. This routine +// ** returns NULL if the page is not in cache or if a disk I/O error +// ** has ever happened. +// */ +func _sqlite3PagerLookup(tls *libc.TLS, pPager uintptr, pgno TPgno) (r uintptr) { + var pPage uintptr + _ = pPage + pPage = _sqlite3PcacheFetch(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, pgno, 0) + if pPage == uintptr(0) { + return uintptr(0) + } + return _sqlite3PcacheFetchFinish(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache, pgno, pPage) +} + +// C documentation +// +// /* +// ** Release a page reference. +// ** +// ** The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be used +// ** if we know that the page being released is not the last reference to page1. +// ** The btree layer always holds page1 open until the end, so these first +// ** two routines can be used to release any page other than BtShared.pPage1. +// ** The assert() at tag-20230419-2 proves that this constraint is always +// ** honored. +// ** +// ** Use sqlite3PagerUnrefPageOne() to release page1. This latter routine +// ** checks the total number of outstanding pages and if the number of +// ** pages reaches zero it drops the database lock. +// */ +func _sqlite3PagerUnrefNotNull(tls *libc.TLS, pPg uintptr) { + if int32((*TDbPage)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_MMAP) != 0 { + /* Page1 is never memory mapped */ + _pagerReleaseMapPage(tls, pPg) + } else { + _sqlite3PcacheRelease(tls, pPg) + } + /* Do not use this routine to release the last reference to page1 */ + /* tag-20230419-2 */ +} + +func _sqlite3PagerUnref(tls *libc.TLS, pPg uintptr) { + if pPg != 0 { + _sqlite3PagerUnrefNotNull(tls, pPg) + } +} + +func _sqlite3PagerUnrefPageOne(tls *libc.TLS, pPg uintptr) { + var pPager uintptr + _ = pPager + /* Page1 is never memory mapped */ + pPager = (*TDbPage)(unsafe.Pointer(pPg)).FpPager + _sqlite3PcacheRelease(tls, pPg) + _pagerUnlockIfUnused(tls, pPager) +} + +// C documentation +// +// /* +// ** This function is called at the start of every write transaction. +// ** There must already be a RESERVED or EXCLUSIVE lock on the database +// ** file when this routine is called. +// ** +// ** Open the journal file for pager pPager and write a journal header +// ** to the start of it. If there are active savepoints, open the sub-journal +// ** as well. This function is only used when the journal file is being +// ** opened to write a rollback log for a transaction. It is not used +// ** when opening a hot journal file to roll it back. +// ** +// ** If the journal file is already open (as it may be in exclusive mode), +// ** then this function just writes a journal header to the start of the +// ** already open file. +// ** +// ** Whether or not the journal file is opened by this function, the +// ** Pager.pInJournal bitvec structure is allocated. +// ** +// ** Return SQLITE_OK if everything is successful. Otherwise, return +// ** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or +// ** an IO error code if opening or writing the journal file fails. +// */ +func _pager_open_journal(tls *libc.TLS, pPager uintptr) (r int32) { + var flags, nSpill, rc int32 + var pVfs uintptr + _, _, _, _ = flags, nSpill, pVfs, rc + rc = SQLITE_OK /* Return code */ + pVfs = (*TPager)(unsafe.Pointer(pPager)).FpVfs /* Local cache of vfs pointer */ + /* If already in the error state, this function is a no-op. But on + ** the other hand, this routine is never called if we are already in + ** an error state. */ + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } + if !((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) != int32(PAGER_JOURNALMODE_OFF) { + (*TPager)(unsafe.Pointer(pPager)).FpInJournal = _sqlite3BitvecCreate(tls, (*TPager)(unsafe.Pointer(pPager)).FdbSize) + if (*TPager)(unsafe.Pointer(pPager)).FpInJournal == uintptr(0) { + return int32(SQLITE_NOMEM) + } + /* Open the journal file if it is not already open. */ + if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0)) { + if int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_MEMORY) { + _sqlite3MemJournalOpen(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + } else { + flags = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + flags |= libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) | libc.Int32FromInt32(SQLITE_OPEN_TEMP_JOURNAL) + flags |= int32(SQLITE_OPEN_EXCLUSIVE) + nSpill = _sqlite3Config.FnStmtSpill + } else { + flags |= int32(SQLITE_OPEN_MAIN_JOURNAL) + nSpill = _jrnlBufferSize(tls, pPager) + } + /* Verify that the database still has the same name as it did when + ** it was originally opened. */ + rc = _databaseIsUnmoved(tls, pPager) + if rc == SQLITE_OK { + rc = _sqlite3JournalOpen(tls, pVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, (*TPager)(unsafe.Pointer(pPager)).Fjfd, flags, nSpill) + } + } + } + /* Write the first journal header to the journal file and open + ** the sub-journal if necessary. + */ + if rc == SQLITE_OK { + /* TODO: Check if all of these are really required. */ + (*TPager)(unsafe.Pointer(pPager)).FnRec = 0 + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + (*TPager)(unsafe.Pointer(pPager)).FsetSuper = uint8(0) + (*TPager)(unsafe.Pointer(pPager)).FjournalHdr = 0 + rc = _writeJournalHdr(tls, pPager) + } + } + if rc != SQLITE_OK { + _sqlite3BitvecDestroy(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal) + (*TPager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + } else { + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_CACHEMOD) + } + return rc +} + +// C documentation +// +// /* +// ** Begin a write-transaction on the specified pager object. If a +// ** write-transaction has already been opened, this function is a no-op. +// ** +// ** If the exFlag argument is false, then acquire at least a RESERVED +// ** lock on the database file. If exFlag is true, then acquire at least +// ** an EXCLUSIVE lock. If such a lock is already held, no locking +// ** functions need be called. +// ** +// ** If the subjInMemory argument is non-zero, then any sub-journal opened +// ** within this transaction will be opened as an in-memory file. This +// ** has no effect if the sub-journal is already opened (as it may be when +// ** running in exclusive mode) or if the transaction does not require a +// ** sub-journal. If the subjInMemory argument is zero, then any required +// ** sub-journal is implemented in-memory if pPager is an in-memory database, +// ** or using a temporary file otherwise. +// */ +func _sqlite3PagerBegin(tls *libc.TLS, pPager uintptr, exFlag int32, subjInMemory int32) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } + (*TPager)(unsafe.Pointer(pPager)).FsubjInMemory = uint8(subjInMemory) + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) { + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + /* If the pager is configured to use locking_mode=exclusive, and an + ** exclusive lock on the database is not already held, obtain it now. + */ + if (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 && _sqlite3WalExclusiveMode(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, -int32(1)) != 0 { + rc = _pagerLockDb(tls, pPager, int32(EXCLUSIVE_LOCK)) + if rc != SQLITE_OK { + return rc + } + _sqlite3WalExclusiveMode(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, int32(1)) + } + /* Grab the write lock on the log file. If successful, upgrade to + ** PAGER_RESERVED state. Otherwise, return an error code to the caller. + ** The busy-handler is not invoked if another connection already + ** holds the write-lock. If possible, the upper layer will call it. + */ + rc = _sqlite3WalBeginWriteTransaction(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + } else { + /* Obtain a RESERVED lock on the database file. If the exFlag parameter + ** is true, then immediately upgrade this to an EXCLUSIVE lock. The + ** busy-handler callback can be used when upgrading to the EXCLUSIVE + ** lock, but not when obtaining the RESERVED lock. + */ + rc = _pagerLockDb(tls, pPager, int32(RESERVED_LOCK)) + if rc == SQLITE_OK && exFlag != 0 { + rc = _pager_wait_on_lock(tls, pPager, int32(EXCLUSIVE_LOCK)) + } + } + if rc == SQLITE_OK { + /* Change to WRITER_LOCKED state. + ** + ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD + ** when it has an open transaction, but never to DBMOD or FINISHED. + ** This is because in those states the code to roll back savepoint + ** transactions may copy data from the sub-journal into the database + ** file as well as into the page cache. Which would be incorrect in + ** WAL mode. + */ + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_LOCKED) + (*TPager)(unsafe.Pointer(pPager)).FdbHintSize = (*TPager)(unsafe.Pointer(pPager)).FdbSize + (*TPager)(unsafe.Pointer(pPager)).FdbFileSize = (*TPager)(unsafe.Pointer(pPager)).FdbSize + (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize = (*TPager)(unsafe.Pointer(pPager)).FdbSize + (*TPager)(unsafe.Pointer(pPager)).FjournalOff = 0 + } + } + return rc +} + +// C documentation +// +// /* +// ** Write page pPg onto the end of the rollback journal. +// */ +func _pagerAddPageToRollbackJournal(tls *libc.TLS, pPg uintptr) (r int32) { + var cksum Tu32 + var iOff Ti64 + var pData2, pPager, p1 uintptr + var rc int32 + _, _, _, _, _, _ = cksum, iOff, pData2, pPager, rc, p1 + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + iOff = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + /* We should never write to the journal file the page that + ** contains the database locks. The following assert verifies + ** that we do not. */ + pData2 = (*TPgHdr)(unsafe.Pointer(pPg)).FpData + cksum = _pager_cksum(tls, pPager, pData2) + /* Even if an IO or diskfull error occurs while journalling the + ** page in the block above, set the need-sync flag for the page. + ** Otherwise, when the transaction is rolled back, the logic in + ** playback_one_page() will think that the page needs to be restored + ** in the database file. And if an IO error occurs while doing so, + ** then corruption may follow. + */ + p1 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PGHDR_NEED_SYNC)) + rc = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iOff, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) + if rc != SQLITE_OK { + return rc + } + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, pData2, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), iOff+int64(4)) + if rc != SQLITE_OK { + return rc + } + rc = _write32bits(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd, iOff+(*TPager)(unsafe.Pointer(pPager)).FpageSize+int64(4), cksum) + if rc != SQLITE_OK { + return rc + } + *(*Ti64)(unsafe.Pointer(pPager + 96)) += int64(8) + (*TPager)(unsafe.Pointer(pPager)).FpageSize + (*TPager)(unsafe.Pointer(pPager)).FnRec++ + rc = _sqlite3BitvecSet(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) + rc |= _addToSavepointBitvecs(tls, pPager, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) + return rc +} + +// C documentation +// +// /* +// ** Mark a single data page as writeable. The page is written into the +// ** main journal or sub-journal as required. If the page is written into +// ** one of the journals, the corresponding bit is set in the +// ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs +// ** of any open savepoints as appropriate. +// */ +func _pager_write(tls *libc.TLS, pPg uintptr) (r int32) { + var pPager, p1, p2 uintptr + var rc int32 + _, _, _, _ = pPager, rc, p1, p2 + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + rc = SQLITE_OK + /* This routine is not called unless a write-transaction has already + ** been started. The journal file may or may not be open at this point. + ** It is never called in the ERROR state. + */ + /* The journal file needs to be opened. Higher level routines have already + ** obtained the necessary locks to begin the write-transaction, but the + ** rollback journal might not yet be open. Open it now if this is the case. + ** + ** This is done before calling sqlite3PcacheMakeDirty() on the page. + ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then + ** an error might occur and the pager would end up in WRITER_LOCKED state + ** with pages marked as dirty in the cache. + */ + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_WRITER_LOCKED) { + rc = _pager_open_journal(tls, pPager) + if rc != SQLITE_OK { + return rc + } + } + /* Mark the page that is about to be modified as dirty. */ + _sqlite3PcacheMakeDirty(tls, pPg) + /* If a rollback journal is in use, them make sure the page that is about + ** to change is in the rollback journal, or if the page is a new page off + ** then end of the file, make sure it is marked as PGHDR_NEED_SYNC. + */ + if (*TPager)(unsafe.Pointer(pPager)).FpInJournal != uintptr(0) && _sqlite3BitvecTestNotNull(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno) == 0 { + if (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno <= (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize { + rc = _pagerAddPageToRollbackJournal(tls, pPg) + if rc != SQLITE_OK { + return rc + } + } else { + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) != int32(PAGER_WRITER_DBMOD) { + p1 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PGHDR_NEED_SYNC)) + } + } + } + /* The PGHDR_DIRTY bit is set above when the page was added to the dirty-list + ** and before writing the page into the rollback journal. Wait until now, + ** after the page has been successfully journalled, before setting the + ** PGHDR_WRITEABLE bit that indicates that the page can be safely modified. + */ + p2 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PGHDR_WRITEABLE)) + /* If the statement journal is open and the page is not in it, + ** then write the page into the statement journal. + */ + if (*TPager)(unsafe.Pointer(pPager)).FnSavepoint > 0 { + rc = _subjournalPageIfRequired(tls, pPg) + } + /* Update the database size and return. */ + if (*TPager)(unsafe.Pointer(pPager)).FdbSize < (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno { + (*TPager)(unsafe.Pointer(pPager)).FdbSize = (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno + } + return rc +} + +// C documentation +// +// /* +// ** This is a variant of sqlite3PagerWrite() that runs when the sector size +// ** is larger than the page size. SQLite makes the (reasonable) assumption that +// ** all bytes of a sector are written together by hardware. Hence, all bytes of +// ** a sector need to be journalled in case of a power loss in the middle of +// ** a write. +// ** +// ** Usually, the sector size is less than or equal to the page size, in which +// ** case pages can be individually written. This routine only runs in the +// ** exceptional case where the page size is smaller than the sector size. +// */ +func _pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var ii, nPage, needSync, rc int32 + var nPageCount, nPagePerSector, pg, pg1 TPgno + var pPage1, pPager, v3, p1, p5, p6 uintptr + var _ /* pPage at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ii, nPage, nPageCount, nPagePerSector, needSync, pPage1, pPager, pg, pg1, rc, v3, p1, p5, p6 + rc = SQLITE_OK /* First page of the sector pPg is located on. */ + nPage = 0 /* Loop counter */ + needSync = 0 /* True if any page has PGHDR_NEED_SYNC */ + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager /* The pager that owns pPg */ + nPagePerSector = uint32(int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) / (*TPager)(unsafe.Pointer(pPager)).FpageSize) + /* Set the doNotSpill NOSYNC bit to 1. This is because we cannot allow + ** a journal header to be written between the pages journaled by + ** this function. + */ + p1 = pPager + 25 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(SPILLFLAG_NOSYNC)) + /* This trick assumes that both the page-size and sector-size are + ** an integer power of 2. It sets variable pg1 to the identifier + ** of the first page of the sector pPg is located on. + */ + pg1 = ((*TPgHdr)(unsafe.Pointer(pPg)).Fpgno-uint32(1)) & ^(nPagePerSector-libc.Uint32FromInt32(1)) + uint32(1) + nPageCount = (*TPager)(unsafe.Pointer(pPager)).FdbSize + if (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno > nPageCount { + nPage = int32((*TPgHdr)(unsafe.Pointer(pPg)).Fpgno - pg1 + uint32(1)) + } else { + if pg1+nPagePerSector-uint32(1) > nPageCount { + nPage = int32(nPageCount + uint32(1) - pg1) + } else { + nPage = int32(nPagePerSector) + } + } + ii = 0 + for { + if !(ii < nPage && rc == SQLITE_OK) { + break + } + pg = pg1 + uint32(ii) + if pg == (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno || !(_sqlite3BitvecTest(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, pg) != 0) { + if pg != (*TPager)(unsafe.Pointer(pPager)).FlckPgno { + rc = _sqlite3PagerGet(tls, pPager, pg, bp, 0) + if rc == SQLITE_OK { + rc = _pager_write(tls, *(*uintptr)(unsafe.Pointer(bp))) + if int32((*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&int32(PGHDR_NEED_SYNC) != 0 { + needSync = int32(1) + } + _sqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + } else { + v3 = _sqlite3PagerLookup(tls, pPager, pg) + *(*uintptr)(unsafe.Pointer(bp)) = v3 + if v3 != uintptr(0) { + if int32((*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&int32(PGHDR_NEED_SYNC) != 0 { + needSync = int32(1) + } + _sqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + goto _2 + _2: + ; + ii++ + } + /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages + ** starting at pg1, then it needs to be set for all of them. Because + ** writing to any of these nPage pages may damage the others, the + ** journal file must contain sync()ed copies of all of them + ** before any of them can be written out to the database file. + */ + if rc == SQLITE_OK && needSync != 0 { + ii = 0 + for { + if !(ii < nPage) { + break + } + pPage1 = _sqlite3PagerLookup(tls, pPager, pg1+uint32(ii)) + if pPage1 != 0 { + p5 = pPage1 + 52 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(PGHDR_NEED_SYNC)) + _sqlite3PagerUnrefNotNull(tls, pPage1) + } + goto _4 + _4: + ; + ii++ + } + } + p6 = pPager + 25 + *(*Tu8)(unsafe.Pointer(p6)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p6))) & ^libc.Int32FromInt32(SPILLFLAG_NOSYNC)) + return rc +} + +// C documentation +// +// /* +// ** Mark a data page as writeable. This routine must be called before +// ** making changes to a page. The caller must check the return value +// ** of this function and be careful not to change any page data unless +// ** this routine returns SQLITE_OK. +// ** +// ** The difference between this function and pager_write() is that this +// ** function also deals with the special case where 2 or more pages +// ** fit on a single disk sector. In this case all co-resident pages +// ** must have been written to the journal file before returning. +// ** +// ** If an error occurs, SQLITE_NOMEM or an IO error code is returned +// ** as appropriate. Otherwise, SQLITE_OK. +// */ +func _sqlite3PagerWrite(tls *libc.TLS, pPg uintptr) (r int32) { + var pPager uintptr + _ = pPager + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + if int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_WRITEABLE) != 0 && (*TPager)(unsafe.Pointer(pPager)).FdbSize >= (*TPgHdr)(unsafe.Pointer(pPg)).Fpgno { + if (*TPager)(unsafe.Pointer(pPager)).FnSavepoint != 0 { + return _subjournalPageIfRequired(tls, pPg) + } + return SQLITE_OK + } else { + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } else { + if (*TPager)(unsafe.Pointer(pPager)).FsectorSize > uint32((*TPager)(unsafe.Pointer(pPager)).FpageSize) { + return _pagerWriteLargeSector(tls, pPg) + } else { + return _pager_write(tls, pPg) + } + } + } + return r +} + +/* +** Return TRUE if the page given in the argument was previously passed +** to sqlite3PagerWrite(). In other words, return TRUE if it is ok +** to change the content of the page. + */ + +// C documentation +// +// /* +// ** A call to this routine tells the pager that it is not necessary to +// ** write the information on page pPg back to the disk, even though +// ** that page might be marked as dirty. This happens, for example, when +// ** the page has been added as a leaf of the freelist and so its +// ** content no longer matters. +// ** +// ** The overlying software layer calls this routine when all of the data +// ** on the given page is unused. The pager marks the page as clean so +// ** that it does not get written to disk. +// ** +// ** Tests show that this optimization can quadruple the speed of large +// ** DELETE operations. +// ** +// ** This optimization cannot be used with a temp-file, as the page may +// ** have been dirty at the start of the transaction. In that case, if +// ** memory pressure forces page pPg out of the cache, the data does need +// ** to be written out to disk so that it may be read back in if the +// ** current transaction is rolled back. +// */ +func _sqlite3PagerDontWrite(tls *libc.TLS, pPg uintptr) { + var pPager, p1, p2 uintptr + _, _, _ = pPager, p1, p2 + pPager = (*TPgHdr)(unsafe.Pointer(pPg)).FpPager + if !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && int32((*TPgHdr)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_DIRTY) != 0 && (*TPager)(unsafe.Pointer(pPager)).FnSavepoint == 0 { + p1 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PGHDR_DONT_WRITE)) + p2 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(PGHDR_WRITEABLE)) + } +} + +// C documentation +// +// /* +// ** This routine is called to increment the value of the database file +// ** change-counter, stored as a 4-byte big-endian integer starting at +// ** byte offset 24 of the pager file. The secondary change counter at +// ** 92 is also updated, as is the SQLite version number at offset 96. +// ** +// ** But this only happens if the pPager->changeCountDone flag is false. +// ** To avoid excess churning of page 1, the update only happens once. +// ** See also the pager_write_changecounter() routine that does an +// ** unconditional update of the change counters. +// ** +// ** If the isDirectMode flag is zero, then this is done by calling +// ** sqlite3PagerWrite() on page 1, then modifying the contents of the +// ** page data. In this case the file will be updated when the current +// ** transaction is committed. +// ** +// ** The isDirectMode flag may only be non-zero if the library was compiled +// ** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case, +// ** if isDirect is non-zero, then the database file is updated directly +// ** by writing an updated version of page 1 using a call to the +// ** sqlite3OsWrite() function. +// */ +func _pager_incr_changecounter(tls *libc.TLS, pPager uintptr, isDirectMode int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pCopy, zBuf uintptr + var rc int32 + var _ /* pPgHdr at bp+0 */ uintptr + _, _, _ = pCopy, rc, zBuf + rc = SQLITE_OK + /* Declare and initialize constant integer 'isDirect'. If the + ** atomic-write optimization is enabled in this build, then isDirect + ** is initialized to the value passed as the isDirectMode parameter + ** to this function. Otherwise, it is always set to zero. + ** + ** The idea is that if the atomic-write optimization is not + ** enabled at compile time, the compiler can omit the tests of + ** 'isDirect' below, as well as the block enclosed in the + ** "if( isDirect )" condition. + */ + _ = isDirectMode + if !((*TPager)(unsafe.Pointer(pPager)).FchangeCountDone != 0) && (*TPager)(unsafe.Pointer(pPager)).FdbSize > uint32(0) { /* Reference to page 1 */ + /* Open page 1 of the file for writing. */ + rc = _sqlite3PagerGet(tls, pPager, uint32(1), bp, 0) + /* If page one was fetched successfully, and this function is not + ** operating in direct-mode, make page 1 writable. When not in + ** direct mode, page 1 is always held in cache and hence the PagerGet() + ** above is always successful - hence the ALWAYS on rc==SQLITE_OK. + */ + if libc.Bool(!(libc.Int32FromInt32(DIRECT_MODE) != 0)) && rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if rc == SQLITE_OK { + /* Actually do the update of the change counter */ + _pager_write_changecounter(tls, *(*uintptr)(unsafe.Pointer(bp))) + /* If running in direct mode, write the contents of page 1 to the file. */ + if DIRECT_MODE != 0 { + zBuf = (*TPgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpData + if rc == SQLITE_OK { + rc = _sqlite3OsWrite(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, zBuf, int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), 0) + *(*Tu32)(unsafe.Pointer(pPager + 248 + 2*4))++ + } + if rc == SQLITE_OK { + /* Update the pager's copy of the change-counter. Otherwise, the + ** next time a read transaction is opened the cache will be + ** flushed (as the change-counter values will not match). */ + pCopy = zBuf + 24 + libc.Xmemcpy(tls, pPager+136, pCopy, uint64(16)) + (*TPager)(unsafe.Pointer(pPager)).FchangeCountDone = uint8(1) + } + } else { + (*TPager)(unsafe.Pointer(pPager)).FchangeCountDone = uint8(1) + } + } + /* Release the page reference. */ + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Sync the database file to disk. This is a no-op for in-memory databases +// ** or pages with the Pager.noSync flag set. +// ** +// ** If successful, or if called on a pager for which it is a no-op, this +// ** function returns SQLITE_OK. Otherwise, an IO error code is returned. +// */ +func _sqlite3PagerSync(tls *libc.TLS, pPager uintptr, zSuper uintptr) (r int32) { + var pArg uintptr + var rc int32 + _, _ = pArg, rc + rc = SQLITE_OK + pArg = zSuper + rc = _sqlite3OsFileControl(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32(SQLITE_FCNTL_SYNC), pArg) + if rc == int32(SQLITE_NOTFOUND) { + rc = SQLITE_OK + } + if rc == SQLITE_OK && !((*TPager)(unsafe.Pointer(pPager)).FnoSync != 0) { + rc = _sqlite3OsSync(tls, (*TPager)(unsafe.Pointer(pPager)).Ffd, int32((*TPager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + return rc +} + +// C documentation +// +// /* +// ** This function may only be called while a write-transaction is active in +// ** rollback. If the connection is in WAL mode, this call is a no-op. +// ** Otherwise, if the connection does not already have an EXCLUSIVE lock on +// ** the database file, an attempt is made to obtain one. +// ** +// ** If the EXCLUSIVE lock is already held or the attempt to obtain it is +// ** successful, or the connection is in WAL mode, SQLITE_OK is returned. +// ** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is +// ** returned. +// */ +func _sqlite3PagerExclusiveLock(tls *libc.TLS, pPager uintptr) (r int32) { + var rc int32 + _ = rc + rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode + if rc == SQLITE_OK { + if 0 == libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0)) { + rc = _pager_wait_on_lock(tls, pPager, int32(EXCLUSIVE_LOCK)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Sync the database file for the pager pPager. zSuper points to the name +// ** of a super-journal file that should be written into the individual +// ** journal file. zSuper may be NULL, which is interpreted as no +// ** super-journal (a single database transaction). +// ** +// ** This routine ensures that: +// ** +// ** * The database file change-counter is updated, +// ** * the journal is synced (unless the atomic-write optimization is used), +// ** * all dirty pages are written to the database file, +// ** * the database file is truncated (if required), and +// ** * the database file synced. +// ** +// ** The only thing that remains to commit the transaction is to finalize +// ** (delete, truncate or zero the first part of) the journal file (or +// ** delete the super-journal file if specified). +// ** +// ** Note that if zSuper==NULL, this does not overwrite a previous value +// ** passed to an sqlite3PagerCommitPhaseOne() call. +// ** +// ** If the final parameter - noSync - is true, then the database file itself +// ** is not synced. The caller must call sqlite3PagerSync() directly to +// ** sync the database file before calling CommitPhaseTwo() to delete the +// ** journal file in this case. +// */ +func _sqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, noSync int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nNew TPgno + var pList uintptr + var rc int32 + var _ /* pPageOne at bp+0 */ uintptr + _, _, _ = nNew, pList, rc + rc = SQLITE_OK /* Return code */ + /* If a prior error occurred, report that error again. */ + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } + /* Provide the ability to easily simulate an I/O error during testing */ + if _sqlite3FaultSim(tls, int32(400)) != 0 { + return int32(SQLITE_IOERR) + } + /* If no database changes have been made, return early. */ + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) < int32(PAGER_WRITER_CACHEMOD) { + return SQLITE_OK + } + if 0 == _pagerFlushOnCommit(tls, pPager, int32(1)) { + /* If this is an in-memory db, or no pages have been written to, or this + ** function has already been called, it is mostly a no-op. However, any + ** backup in progress needs to be restarted. */ + _sqlite3BackupRestart(tls, (*TPager)(unsafe.Pointer(pPager)).FpBackup) + } else { + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pList = _sqlite3PcacheDirtyList(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + if pList == uintptr(0) { + /* Must have at least one page for the WAL commit flag. + ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */ + rc = _sqlite3PagerGet(tls, pPager, uint32(1), bp, 0) + pList = *(*uintptr)(unsafe.Pointer(bp)) + (*TPgHdr)(unsafe.Pointer(pList)).FpDirty = uintptr(0) + } + if pList != 0 { + rc = _pagerWalFrames(tls, pPager, pList, (*TPager)(unsafe.Pointer(pPager)).FdbSize, int32(1)) + } + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + _sqlite3PcacheCleanAll(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + } + } else { + /* The bBatch boolean is true if the batch-atomic-write commit method + ** should be used. No rollback journal is created if batch-atomic-write + ** is enabled. + */ + rc = _pager_incr_changecounter(tls, pPager, 0) + if rc != SQLITE_OK { + goto commit_phase_one_exit + } + /* Write the super-journal name into the journal file. If a + ** super-journal file name has already been written to the journal file, + ** or if zSuper is NULL (no super-journal), then this call is a no-op. + */ + rc = _writeSuperJournal(tls, pPager, zSuper) + if rc != SQLITE_OK { + goto commit_phase_one_exit + } + /* Sync the journal file and write all dirty pages to the database. + ** If the atomic-update optimization is being used, this sync will not + ** create the journal file or perform any real IO. + ** + ** Because the change-counter page was just modified, unless the + ** atomic-update optimization is used it is almost certain that the + ** journal requires a sync here. However, in locking_mode=exclusive + ** on a system under memory pressure it is just possible that this is + ** not the case. In this case it is likely enough that the redundant + ** xSync() call will be changed to a no-op by the OS anyhow. + */ + rc = _syncJournal(tls, pPager, 0) + if rc != SQLITE_OK { + goto commit_phase_one_exit + } + pList = _sqlite3PcacheDirtyList(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + if true { + rc = _pager_write_pagelist(tls, pPager, pList) + } + if rc != SQLITE_OK { + goto commit_phase_one_exit + } + _sqlite3PcacheCleanAll(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache) + /* If the file on disk is smaller than the database image, use + ** pager_truncate to grow the file here. This can happen if the database + ** image was extended as part of the current transaction and then the + ** last page in the db image moved to the free-list. In this case the + ** last page is never written out to disk, leaving the database file + ** undersized. Fix this now if it is the case. */ + if (*TPager)(unsafe.Pointer(pPager)).FdbSize > (*TPager)(unsafe.Pointer(pPager)).FdbFileSize { + nNew = (*TPager)(unsafe.Pointer(pPager)).FdbSize - libc.BoolUint32((*TPager)(unsafe.Pointer(pPager)).FdbSize == (*TPager)(unsafe.Pointer(pPager)).FlckPgno) + rc = _pager_truncate(tls, pPager, nNew) + if rc != SQLITE_OK { + goto commit_phase_one_exit + } + } + /* Finally, sync the database file. */ + if !(noSync != 0) { + rc = _sqlite3PagerSync(tls, pPager, zSuper) + } + } + } +commit_phase_one_exit: + ; + if rc == SQLITE_OK && !((*TPager)(unsafe.Pointer(pPager)).FpWal != libc.UintptrFromInt32(0)) { + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_WRITER_FINISHED) + } + return rc +} + +// C documentation +// +// /* +// ** When this function is called, the database file has been completely +// ** updated to reflect the changes made by the current transaction and +// ** synced to disk. The journal file still exists in the file-system +// ** though, and if a failure occurs at this point it will eventually +// ** be used as a hot-journal and the current transaction rolled back. +// ** +// ** This function finalizes the journal file, either by deleting, +// ** truncating or partially zeroing it, so that it cannot be used +// ** for hot-journal rollback. Once this is done the transaction is +// ** irrevocably committed. +// ** +// ** If an error occurs, an IO error code is returned and the pager +// ** moves into the error state. Otherwise, SQLITE_OK is returned. +// */ +func _sqlite3PagerCommitPhaseTwo(tls *libc.TLS, pPager uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK /* Return code */ + /* This routine should not be called if a prior error has occurred. + ** But if (due to a coding error elsewhere in the system) it does get + ** called, just return the same error code without doing anything. */ + if (*TPager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } + (*TPager)(unsafe.Pointer(pPager)).FiDataVersion++ + /* An optimization. If the database was not actually modified during + ** this transaction, the pager is running in exclusive-mode and is + ** using persistent journals, then this function is a no-op. + ** + ** The start of the journal file currently contains a single journal + ** header with the nRec field set to 0. If such a journal is used as + ** a hot-journal during hot-journal rollback, 0 changes will be made + ** to the database file. So there is no need to zero the journal + ** header. Since the pager is in exclusive mode, there is no need + ** to drop any locks either. + */ + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_WRITER_LOCKED) && (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_PERSIST) { + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_READER) + return SQLITE_OK + } + rc = _pager_end_transaction(tls, pPager, int32((*TPager)(unsafe.Pointer(pPager)).FsetSuper), int32(1)) + return _pager_error(tls, pPager, rc) +} + +// C documentation +// +// /* +// ** If a write transaction is open, then all changes made within the +// ** transaction are reverted and the current write-transaction is closed. +// ** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR +// ** state if an error occurs. +// ** +// ** If the pager is already in PAGER_ERROR state when this function is called, +// ** it returns Pager.errCode immediately. No work is performed in this case. +// ** +// ** Otherwise, in rollback mode, this function performs two functions: +// ** +// ** 1) It rolls back the journal file, restoring all database file and +// ** in-memory cache pages to the state they were in when the transaction +// ** was opened, and +// ** +// ** 2) It finalizes the journal file, so that it is not used for hot +// ** rollback at any point in the future. +// ** +// ** Finalization of the journal file (task 2) is only performed if the +// ** rollback is successful. +// ** +// ** In WAL mode, all cache-entries containing data modified within the +// ** current transaction are either expelled from the cache or reverted to +// ** their pre-transaction state by re-reading data from the database or +// ** WAL files. The WAL transaction is then closed. +// */ +func _sqlite3PagerRollback(tls *libc.TLS, pPager uintptr) (r int32) { + var eState, rc, rc2 int32 + _, _, _ = eState, rc, rc2 + rc = SQLITE_OK /* Return code */ + /* PagerRollback() is a no-op if called in READER or OPEN state. If + ** the pager is already in the ERROR state, the rollback is not + ** attempted here. Instead, the error code is returned to the caller. + */ + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_ERROR) { + return (*TPager)(unsafe.Pointer(pPager)).FerrCode + } + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) <= int32(PAGER_READER) { + return SQLITE_OK + } + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + rc = _sqlite3PagerSavepoint(tls, pPager, int32(SAVEPOINT_ROLLBACK), -int32(1)) + rc2 = _pager_end_transaction(tls, pPager, int32((*TPager)(unsafe.Pointer(pPager)).FsetSuper), 0) + if rc == SQLITE_OK { + rc = rc2 + } + } else { + if !((*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != libc.UintptrFromInt32(0)) || int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_WRITER_LOCKED) { + eState = int32((*TPager)(unsafe.Pointer(pPager)).FeState) + rc = _pager_end_transaction(tls, pPager, 0, 0) + if !((*TPager)(unsafe.Pointer(pPager)).FmemDb != 0) && eState > int32(PAGER_WRITER_LOCKED) { + /* This can happen using journal_mode=off. Move the pager to the error + ** state to indicate that the contents of the cache may not be trusted. + ** Any active readers will get SQLITE_ABORT. + */ + (*TPager)(unsafe.Pointer(pPager)).FerrCode = int32(SQLITE_ABORT) + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_ERROR) + _setGetterMethod(tls, pPager) + return rc + } + } else { + rc = _pager_playback(tls, pPager, 0) + } + } + /* If an error occurs during a ROLLBACK, we can no longer trust the pager + ** cache. So call pager_error() on the way out to make any error persistent. + */ + return _pager_error(tls, pPager, rc) +} + +// C documentation +// +// /* +// ** Return TRUE if the database file is opened read-only. Return FALSE +// ** if the database is (in theory) writable. +// */ +func _sqlite3PagerIsreadonly(tls *libc.TLS, pPager uintptr) (r Tu8) { + return (*TPager)(unsafe.Pointer(pPager)).FreadOnly +} + +// C documentation +// +// /* +// ** Return the approximate number of bytes of memory currently +// ** used by the pager and its associated cache. +// */ +func _sqlite3PagerMemUsed(tls *libc.TLS, pPager uintptr) (r int32) { + var perPageSize int32 + _ = perPageSize + perPageSize = int32((*TPager)(unsafe.Pointer(pPager)).FpageSize + int64((*TPager)(unsafe.Pointer(pPager)).FnExtra) + int64(int32(libc.Uint64FromInt64(80)+libc.Uint64FromInt32(5)*libc.Uint64FromInt64(8)))) + return int32(int64(perPageSize*_sqlite3PcachePagecount(tls, (*TPager)(unsafe.Pointer(pPager)).FpPCache)+_sqlite3MallocSize(tls, pPager)) + (*TPager)(unsafe.Pointer(pPager)).FpageSize) +} + +// C documentation +// +// /* +// ** Return the number of references to the specified page. +// */ +func _sqlite3PagerPageRefcount(tls *libc.TLS, pPage uintptr) (r int32) { + return int32(_sqlite3PcachePageRefcount(tls, pPage)) +} + +// C documentation +// +// /* +// ** Parameter eStat must be one of SQLITE_DBSTATUS_CACHE_HIT, _MISS, _WRITE, +// ** or _WRITE+1. The SQLITE_DBSTATUS_CACHE_WRITE+1 case is a translation +// ** of SQLITE_DBSTATUS_CACHE_SPILL. The _SPILL case is not contiguous because +// ** it was added later. +// ** +// ** Before returning, *pnVal is incremented by the +// ** current cache hit or miss count, according to the value of eStat. If the +// ** reset parameter is non-zero, the cache hit or miss count is zeroed before +// ** returning. +// */ +func _sqlite3PagerCacheStat(tls *libc.TLS, pPager uintptr, eStat int32, reset int32, pnVal uintptr) { + eStat -= int32(SQLITE_DBSTATUS_CACHE_HIT) + *(*Tu64)(unsafe.Pointer(pnVal)) += uint64(*(*Tu32)(unsafe.Pointer(pPager + 248 + uintptr(eStat)*4))) + if reset != 0 { + *(*Tu32)(unsafe.Pointer(pPager + 248 + uintptr(eStat)*4)) = uint32(0) + } +} + +// C documentation +// +// /* +// ** Return true if this is an in-memory or temp-file backed pager. +// */ +func _sqlite3PagerIsMemdb(tls *libc.TLS, pPager uintptr) (r int32) { + return libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 || (*TPager)(unsafe.Pointer(pPager)).FmemVfs != 0) +} + +// C documentation +// +// /* +// ** Check that there are at least nSavepoint savepoints open. If there are +// ** currently less than nSavepoints open, then open one or more savepoints +// ** to make up the difference. If the number of savepoints is already +// ** equal to nSavepoint, then this function is a no-op. +// ** +// ** If a memory allocation fails, SQLITE_NOMEM is returned. If an error +// ** occurs while opening the sub-journal file, then an IO error code is +// ** returned. Otherwise, SQLITE_OK. +// */ +func _pagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) (r int32) { + var aNew uintptr + var ii, nCurrent, rc int32 + _, _, _, _ = aNew, ii, nCurrent, rc + rc = SQLITE_OK /* Return code */ + nCurrent = (*TPager)(unsafe.Pointer(pPager)).FnSavepoint /* New Pager.aSavepoint array */ + /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM + ** if the allocation fails. Otherwise, zero the new portion in case a + ** malloc failure occurs while populating it in the for(...) loop below. + */ + aNew = _sqlite3Realloc(tls, (*TPager)(unsafe.Pointer(pPager)).FaSavepoint, uint64(56)*uint64(nSavepoint)) + if !(aNew != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, aNew+uintptr(nCurrent)*56, 0, uint64(nSavepoint-nCurrent)*uint64(56)) + (*TPager)(unsafe.Pointer(pPager)).FaSavepoint = aNew + /* Populate the PagerSavepoint structures just allocated. */ + ii = nCurrent + for { + if !(ii < nSavepoint) { + break + } + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FnOrig = (*TPager)(unsafe.Pointer(pPager)).FdbSize + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) && (*TPager)(unsafe.Pointer(pPager)).FjournalOff > 0 { + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FiOffset = (*TPager)(unsafe.Pointer(pPager)).FjournalOff + } else { + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FiOffset = int64((*TPager)(unsafe.Pointer(pPager)).FsectorSize) + } + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FiSubRec = (*TPager)(unsafe.Pointer(pPager)).FnSubRec + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FpInSavepoint = _sqlite3BitvecCreate(tls, (*TPager)(unsafe.Pointer(pPager)).FdbSize) + (*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FbTruncateOnRelease = int32(1) + if !((*(*TPagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56))).FpInSavepoint != 0) { + return int32(SQLITE_NOMEM) + } + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) { + _sqlite3WalSavepoint(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, aNew+uintptr(ii)*56+36) + } + (*TPager)(unsafe.Pointer(pPager)).FnSavepoint = ii + int32(1) + goto _1 + _1: + ; + ii++ + } + return rc +} + +func _sqlite3PagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) (r int32) { + if nSavepoint > (*TPager)(unsafe.Pointer(pPager)).FnSavepoint && (*TPager)(unsafe.Pointer(pPager)).FuseJournal != 0 { + return _pagerOpenSavepoint(tls, pPager, nSavepoint) + } else { + return SQLITE_OK + } + return r +} + +// C documentation +// +// /* +// ** This function is called to rollback or release (commit) a savepoint. +// ** The savepoint to release or rollback need not be the most recently +// ** created savepoint. +// ** +// ** Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE. +// ** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with +// ** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes +// ** that have occurred since the specified savepoint was created. +// ** +// ** The savepoint to rollback or release is identified by parameter +// ** iSavepoint. A value of 0 means to operate on the outermost savepoint +// ** (the first created). A value of (Pager.nSavepoint-1) means operate +// ** on the most recently created savepoint. If iSavepoint is greater than +// ** (Pager.nSavepoint-1), then this function is a no-op. +// ** +// ** If a negative value is passed to this function, then the current +// ** transaction is rolled back. This is different to calling +// ** sqlite3PagerRollback() because this function does not terminate +// ** the transaction or unlock the database, it just restores the +// ** contents of the database to its original state. +// ** +// ** In any case, all savepoints with an index greater than iSavepoint +// ** are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE), +// ** then savepoint iSavepoint is also destroyed. +// ** +// ** This function may return SQLITE_NOMEM if a memory allocation fails, +// ** or an IO error code if an IO error occurs while rolling back a +// ** savepoint. If no errors occur, SQLITE_OK is returned. +// */ +func _sqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint int32) (r int32) { + var ii, nNew, rc, v1 int32 + var pRel, pSavepoint, v3 uintptr + var sz Ti64 + _, _, _, _, _, _, _, _ = ii, nNew, pRel, pSavepoint, rc, sz, v1, v3 + rc = (*TPager)(unsafe.Pointer(pPager)).FerrCode + if rc == SQLITE_OK && iSavepoint < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint { /* Number of remaining savepoints after this op. */ + /* Figure out how many savepoints will still be active after this + ** operation. Store this value in nNew. Then free resources associated + ** with any savepoints that are destroyed by this operation. + */ + if op == int32(SAVEPOINT_RELEASE) { + v1 = 0 + } else { + v1 = int32(1) + } + nNew = iSavepoint + v1 + ii = nNew + for { + if !(ii < (*TPager)(unsafe.Pointer(pPager)).FnSavepoint) { + break + } + _sqlite3BitvecDestroy(tls, (*(*TPagerSavepoint)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56))).FpInSavepoint) + goto _2 + _2: + ; + ii++ + } + (*TPager)(unsafe.Pointer(pPager)).FnSavepoint = nNew + /* Truncate the sub-journal so that it only includes the parts + ** that are still in use. */ + if op == int32(SAVEPOINT_RELEASE) { + pRel = (*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(nNew)*56 + if (*TPagerSavepoint)(unsafe.Pointer(pRel)).FbTruncateOnRelease != 0 && (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fsjfd)).FpMethods != uintptr(0) { + /* Only truncate if it is an in-memory sub-journal. */ + if _sqlite3JournalIsInMemory(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { + sz = ((*TPager)(unsafe.Pointer(pPager)).FpageSize + int64(4)) * int64((*TPagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec) + rc = _sqlite3OsTruncate(tls, (*TPager)(unsafe.Pointer(pPager)).Fsjfd, sz) + } + (*TPager)(unsafe.Pointer(pPager)).FnSubRec = (*TPagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec + } + } else { + if (*TPager)(unsafe.Pointer(pPager)).FpWal != uintptr(0) || (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) { + if nNew == 0 { + v3 = uintptr(0) + } else { + v3 = (*TPager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(nNew-int32(1))*56 + } + pSavepoint = v3 + rc = _pagerPlaybackSavepoint(tls, pPager, pSavepoint) + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Return the full pathname of the database file. +// ** +// ** Except, if the pager is in-memory only, then return an empty string if +// ** nullIfMemDb is true. This routine is called with nullIfMemDb==1 when +// ** used to report the filename to the user, for compatibility with legacy +// ** behavior. But when the Btree needs to know the filename for matching to +// ** shared cache, it uses nullIfMemDb==0 so that in-memory databases can +// ** participate in shared-cache. +// ** +// ** The return value to this routine is always safe to use with +// ** sqlite3_uri_parameter() and sqlite3_filename_database() and friends. +// */ +func _sqlite3PagerFilename(tls *libc.TLS, pPager uintptr, nullIfMemDb int32) (r uintptr) { + if nullIfMemDb != 0 && ((*TPager)(unsafe.Pointer(pPager)).FmemDb != 0 || _sqlite3IsMemdb(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs) != 0) { + return uintptr(unsafe.Pointer(&_zFake)) + 4 + } else { + return (*TPager)(unsafe.Pointer(pPager)).FzFilename + } + return r +} + +var _zFake = [8]int8{} + +// C documentation +// +// /* +// ** Return the VFS structure for the pager. +// */ +func _sqlite3PagerVfs(tls *libc.TLS, pPager uintptr) (r uintptr) { + return (*TPager)(unsafe.Pointer(pPager)).FpVfs +} + +// C documentation +// +// /* +// ** Return the file handle for the database file associated +// ** with the pager. This might return NULL if the file has +// ** not yet been opened. +// */ +func _sqlite3PagerFile(tls *libc.TLS, pPager uintptr) (r uintptr) { + return (*TPager)(unsafe.Pointer(pPager)).Ffd +} + +// C documentation +// +// /* +// ** Return the file handle for the journal file (if it exists). +// ** This will be either the rollback journal or the WAL file. +// */ +func _sqlite3PagerJrnlFile(tls *libc.TLS, pPager uintptr) (r uintptr) { + var v1 uintptr + _ = v1 + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + v1 = _sqlite3WalFile(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + } else { + v1 = (*TPager)(unsafe.Pointer(pPager)).Fjfd + } + return v1 +} + +// C documentation +// +// /* +// ** Return the full pathname of the journal file. +// */ +func _sqlite3PagerJournalname(tls *libc.TLS, pPager uintptr) (r uintptr) { + return (*TPager)(unsafe.Pointer(pPager)).FzJournal +} + +// C documentation +// +// /* +// ** Move the page pPg to location pgno in the file. +// ** +// ** There must be no references to the page previously located at +// ** pgno (which we call pPgOld) though that page is allowed to be +// ** in cache. If the page previously located at pgno is not already +// ** in the rollback journal, it is not put there by by this routine. +// ** +// ** References to the page pPg remain valid. Updating any +// ** meta-data associated with pPg (i.e. data stored in the nExtra bytes +// ** allocated along with the page) is the responsibility of the caller. +// ** +// ** A transaction must be active when this routine is called. It used to be +// ** required that a statement transaction was not active, but this restriction +// ** has been removed (CREATE INDEX needs to move a page when a statement +// ** transaction is active). +// ** +// ** If the fourth argument, isCommit, is non-zero, then this page is being +// ** moved as part of a database reorganization just before the transaction +// ** is being committed. In this case, it is guaranteed that the database page +// ** pPg refers to will not be written to again within this transaction. +// ** +// ** This function may return SQLITE_NOMEM or an IO error code if an error +// ** occurs. Otherwise, it returns SQLITE_OK. +// */ +func _sqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno TPgno, isCommit int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var needSyncPgno, origPgno TPgno + var pPgOld, p3, p4, p5 uintptr + var rc, v1 int32 + var v2 bool + var _ /* pPgHdr at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = needSyncPgno, origPgno, pPgOld, rc, v1, v2, p3, p4, p5 /* The page being overwritten. */ + needSyncPgno = uint32(0) /* The original page number */ + /* In order to be able to rollback, an in-memory database must journal + ** the page we are moving from. + */ + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + rc = _sqlite3PagerWrite(tls, pPg) + if rc != 0 { + return rc + } + } + /* If the page being moved is dirty and has not been saved by the latest + ** savepoint, then save the current contents of the page into the + ** sub-journal now. This is required to handle the following scenario: + ** + ** BEGIN; + ** + ** SAVEPOINT one; + ** + ** ROLLBACK TO one; + ** + ** If page X were not written to the sub-journal here, it would not + ** be possible to restore its contents when the "ROLLBACK TO one" + ** statement were is processed. + ** + ** subjournalPage() may need to allocate space to store pPg->pgno into + ** one or more savepoint bitvecs. This is the reason this function + ** may return SQLITE_NOMEM. + */ + if v2 = int32((*TDbPage)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_DIRTY) != 0; v2 { + v1 = _subjournalPageIfRequired(tls, pPg) + rc = v1 + } + if v2 && SQLITE_OK != v1 { + return rc + } + /* If the journal needs to be sync()ed before page pPg->pgno can + ** be written to, store pPg->pgno in local variable needSyncPgno. + ** + ** If the isCommit flag is set, there is no need to remember that + ** the journal needs to be sync()ed before database page pPg->pgno + ** can be written to. The caller has already promised not to write to it. + */ + if int32((*TDbPage)(unsafe.Pointer(pPg)).Fflags)&int32(PGHDR_NEED_SYNC) != 0 && !(isCommit != 0) { + needSyncPgno = (*TDbPage)(unsafe.Pointer(pPg)).Fpgno + } + /* If the cache contains a page with page-number pgno, remove it + ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for + ** page pgno before the 'move' operation, it needs to be retained + ** for the page moved there. + */ + p3 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(PGHDR_NEED_SYNC)) + pPgOld = _sqlite3PagerLookup(tls, pPager, pgno) + if pPgOld != 0 { + if (*TPgHdr)(unsafe.Pointer(pPgOld)).FnRef > int64(1) { + _sqlite3PagerUnrefNotNull(tls, pPgOld) + return _sqlite3CorruptError(tls, int32(63973)) + } + p4 = pPg + 52 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | int32((*TPgHdr)(unsafe.Pointer(pPgOld)).Fflags)&libc.Int32FromInt32(PGHDR_NEED_SYNC)) + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 { + /* Do not discard pages from an in-memory database since we might + ** need to rollback later. Just move the page out of the way. */ + _sqlite3PcacheMove(tls, pPgOld, (*TPager)(unsafe.Pointer(pPager)).FdbSize+uint32(1)) + } else { + _sqlite3PcacheDrop(tls, pPgOld) + } + } + origPgno = (*TDbPage)(unsafe.Pointer(pPg)).Fpgno + _sqlite3PcacheMove(tls, pPg, pgno) + _sqlite3PcacheMakeDirty(tls, pPg) + /* For an in-memory database, make sure the original page continues + ** to exist, in case the transaction needs to roll back. Use pPgOld + ** as the original page since it has already been allocated. + */ + if (*TPager)(unsafe.Pointer(pPager)).FtempFile != 0 && pPgOld != 0 { + _sqlite3PcacheMove(tls, pPgOld, origPgno) + _sqlite3PagerUnrefNotNull(tls, pPgOld) + } + if needSyncPgno != 0 { + rc = _sqlite3PagerGet(tls, pPager, needSyncPgno, bp, 0) + if rc != SQLITE_OK { + if needSyncPgno <= (*TPager)(unsafe.Pointer(pPager)).FdbOrigSize { + _sqlite3BitvecClear(tls, (*TPager)(unsafe.Pointer(pPager)).FpInJournal, needSyncPgno, (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace) + } + return rc + } + p5 = *(*uintptr)(unsafe.Pointer(bp)) + 52 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(PGHDR_NEED_SYNC)) + _sqlite3PcacheMakeDirty(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The page handle passed as the first argument refers to a dirty page +// ** with a page number other than iNew. This function changes the page's +// ** page number to iNew and sets the value of the PgHdr.flags field to +// ** the value passed as the third parameter. +// */ +func _sqlite3PagerRekey(tls *libc.TLS, pPg uintptr, iNew TPgno, flags Tu16) { + (*TDbPage)(unsafe.Pointer(pPg)).Fflags = flags + _sqlite3PcacheMove(tls, pPg, iNew) +} + +// C documentation +// +// /* +// ** Return a pointer to the data for the specified page. +// */ +func _sqlite3PagerGetData(tls *libc.TLS, pPg uintptr) (r uintptr) { + return (*TDbPage)(unsafe.Pointer(pPg)).FpData +} + +// C documentation +// +// /* +// ** Return a pointer to the Pager.nExtra bytes of "extra" space +// ** allocated along with the specified page. +// */ +func _sqlite3PagerGetExtra(tls *libc.TLS, pPg uintptr) (r uintptr) { + return (*TDbPage)(unsafe.Pointer(pPg)).FpExtra +} + +// C documentation +// +// /* +// ** Get/set the locking-mode for this pager. Parameter eMode must be one +// ** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or +// ** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then +// ** the locking-mode is set to the value specified. +// ** +// ** The returned value is either PAGER_LOCKINGMODE_NORMAL or +// ** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated) +// ** locking-mode. +// */ +func _sqlite3PagerLockingMode(tls *libc.TLS, pPager uintptr, eMode int32) (r int32) { + if eMode >= 0 && !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && !(_sqlite3WalHeapMemory(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) != 0) { + (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode = uint8(eMode) + } + return int32((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode) +} + +// C documentation +// +// /* +// ** Set the journal-mode for this pager. Parameter eMode must be one of: +// ** +// ** PAGER_JOURNALMODE_DELETE +// ** PAGER_JOURNALMODE_TRUNCATE +// ** PAGER_JOURNALMODE_PERSIST +// ** PAGER_JOURNALMODE_OFF +// ** PAGER_JOURNALMODE_MEMORY +// ** PAGER_JOURNALMODE_WAL +// ** +// ** The journalmode is set to the value specified if the change is allowed. +// ** The change may be disallowed for the following reasons: +// ** +// ** * An in-memory database can only have its journal_mode set to _OFF +// ** or _MEMORY. +// ** +// ** * Temporary databases cannot have _WAL journalmode. +// ** +// ** The returned indicate the current (possibly updated) journal-mode. +// */ +func _sqlite3PagerSetJournalMode(tls *libc.TLS, pPager uintptr, eMode int32) (r int32) { + var eOld Tu8 + var rc, state int32 + _, _, _ = eOld, rc, state + eOld = (*TPager)(unsafe.Pointer(pPager)).FjournalMode /* Prior journalmode */ + /* The eMode parameter is always valid */ + /* This routine is only called from the OP_JournalMode opcode, and + ** the logic there will never allow a temporary file to be changed + ** to WAL mode. + */ + /* Do allow the journalmode of an in-memory database to be set to + ** anything other than MEMORY or OFF + */ + if (*TPager)(unsafe.Pointer(pPager)).FmemDb != 0 { + if eMode != int32(PAGER_JOURNALMODE_MEMORY) && eMode != int32(PAGER_JOURNALMODE_OFF) { + eMode = int32(eOld) + } + } + if eMode != int32(eOld) { + /* Change the journal mode. */ + (*TPager)(unsafe.Pointer(pPager)).FjournalMode = uint8(eMode) + /* When transitioning from TRUNCATE or PERSIST to any other journal + ** mode except WAL, unless the pager is in locking_mode=exclusive mode, + ** delete the journal file. + */ + if !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) && int32(eOld)&int32(5) == int32(1) && eMode&int32(1) == 0 { + /* In this case we would like to delete the journal file. If it is + ** not possible, then that is not a problem. Deleting the journal file + ** here is an optimization only. + ** + ** Before deleting the journal file, obtain a RESERVED lock on the + ** database file. This ensures that the journal file is not deleted + ** while it is in use by some other client. + */ + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + if int32((*TPager)(unsafe.Pointer(pPager)).FeLock) >= int32(RESERVED_LOCK) { + _sqlite3OsDelete(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, 0) + } else { + rc = SQLITE_OK + state = int32((*TPager)(unsafe.Pointer(pPager)).FeState) + if state == PAGER_OPEN { + rc = _sqlite3PagerSharedLock(tls, pPager) + } + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) == int32(PAGER_READER) { + rc = _pagerLockDb(tls, pPager, int32(RESERVED_LOCK)) + } + if rc == SQLITE_OK { + _sqlite3OsDelete(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzJournal, 0) + } + if rc == SQLITE_OK && state == int32(PAGER_READER) { + _pagerUnlockDb(tls, pPager, int32(SHARED_LOCK)) + } else { + if state == PAGER_OPEN { + _pager_unlock(tls, pPager) + } + } + } + } else { + if eMode == int32(PAGER_JOURNALMODE_OFF) || eMode == int32(PAGER_JOURNALMODE_MEMORY) { + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + } + } + } + /* Return the new journal mode */ + return int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) +} + +// C documentation +// +// /* +// ** Return the current journal mode. +// */ +func _sqlite3PagerGetJournalMode(tls *libc.TLS, pPager uintptr) (r int32) { + return int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) +} + +// C documentation +// +// /* +// ** Return TRUE if the pager is in a state where it is OK to change the +// ** journalmode. Journalmode changes can only happen when the database +// ** is unmodified. +// */ +func _sqlite3PagerOkToChangeJournalMode(tls *libc.TLS, pPager uintptr) (r int32) { + if int32((*TPager)(unsafe.Pointer(pPager)).FeState) >= int32(PAGER_WRITER_CACHEMOD) { + return 0 + } + if (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Fjfd)).FpMethods != uintptr(0) && (*TPager)(unsafe.Pointer(pPager)).FjournalOff > 0 { + return 0 + } + return int32(1) +} + +// C documentation +// +// /* +// ** Get/set the size-limit used for persistent journal files. +// ** +// ** Setting the size limit to -1 means no limit is enforced. +// ** An attempt to set a limit smaller than -1 is a no-op. +// */ +func _sqlite3PagerJournalSizeLimit(tls *libc.TLS, pPager uintptr, iLimit Ti64) (r Ti64) { + if iLimit >= int64(-int32(1)) { + (*TPager)(unsafe.Pointer(pPager)).FjournalSizeLimit = iLimit + _sqlite3WalLimit(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, iLimit) + } + return (*TPager)(unsafe.Pointer(pPager)).FjournalSizeLimit +} + +// C documentation +// +// /* +// ** Return a pointer to the pPager->pBackup variable. The backup module +// ** in backup.c maintains the content of this variable. This module +// ** uses it opaquely as an argument to sqlite3BackupRestart() and +// ** sqlite3BackupUpdate() only. +// */ +func _sqlite3PagerBackupPtr(tls *libc.TLS, pPager uintptr) (r uintptr) { + return pPager + 112 +} + +// C documentation +// +// /* +// ** Unless this is an in-memory or temporary database, clear the pager cache. +// */ +func _sqlite3PagerClearCache(tls *libc.TLS, pPager uintptr) { + if int32((*TPager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + _pager_reset(tls, pPager) + } +} + +// C documentation +// +// /* +// ** This function is called when the user invokes "PRAGMA wal_checkpoint", +// ** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() +// ** or wal_blocking_checkpoint() API functions. +// ** +// ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. +// */ +func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) (r int32) { + var rc int32 + var v1 uintptr + _, _ = rc, v1 + rc = SQLITE_OK + if (*TPager)(unsafe.Pointer(pPager)).FpWal == uintptr(0) && int32((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_WAL) { + /* This only happens when a database file is zero bytes in size opened and + ** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint() + ** is invoked without any intervening transactions. We need to start + ** a transaction to initialize pWal. The PRAGMA table_list statement is + ** used for this since it starts transactions on every database file, + ** including all ATTACHed databases. This seems expensive for a single + ** sqlite3_wal_checkpoint() call, but it happens very rarely. + ** https://sqlite.org/forum/forumpost/fd0f19d229156939 + */ + Xsqlite3_exec(tls, db, __ccgo_ts+4141, uintptr(0), uintptr(0), uintptr(0)) + } + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + if eMode == SQLITE_CHECKPOINT_PASSIVE { + v1 = uintptr(0) + } else { + v1 = (*TPager)(unsafe.Pointer(pPager)).FxBusyHandler + } + rc = _sqlite3WalCheckpoint(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, db, eMode, v1, (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg, int32((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace, pnLog, pnCkpt) + } + return rc +} + +func _sqlite3PagerWalCallback(tls *libc.TLS, pPager uintptr) (r int32) { + return _sqlite3WalCallback(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) +} + +// C documentation +// +// /* +// ** Return true if the underlying VFS for the given pager supports the +// ** primitives necessary for write-ahead logging. +// */ +func _sqlite3PagerWalSupported(tls *libc.TLS, pPager uintptr) (r int32) { + var pMethods uintptr + _ = pMethods + pMethods = (*Tsqlite3_file)(unsafe.Pointer((*TPager)(unsafe.Pointer(pPager)).Ffd)).FpMethods + if (*TPager)(unsafe.Pointer(pPager)).FnoLock != 0 { + return 0 + } + return libc.BoolInt32((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 || (*Tsqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion >= int32(2) && (*Tsqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmMap != 0) +} + +// C documentation +// +// /* +// ** Attempt to take an exclusive lock on the database file. If a PENDING lock +// ** is obtained instead, immediately release it. +// */ +func _pagerExclusiveLock(tls *libc.TLS, pPager uintptr) (r int32) { + var eOrigLock Tu8 + var rc int32 + _, _ = eOrigLock, rc /* Original lock */ + eOrigLock = (*TPager)(unsafe.Pointer(pPager)).FeLock + rc = _pagerLockDb(tls, pPager, int32(EXCLUSIVE_LOCK)) + if rc != SQLITE_OK { + /* If the attempt to grab the exclusive lock failed, release the + ** pending lock that may have been obtained instead. */ + _pagerUnlockDb(tls, pPager, int32(eOrigLock)) + } + return rc +} + +// C documentation +// +// /* +// ** Call sqlite3WalOpen() to open the WAL handle. If the pager is in +// ** exclusive-locking mode when this function is called, take an EXCLUSIVE +// ** lock on the database file and use heap-memory to store the wal-index +// ** in. Otherwise, use the normal shared-memory. +// */ +func _pagerOpenWal(tls *libc.TLS, pPager uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + /* If the pager is already in exclusive-mode, the WAL module will use + ** heap-memory for the wal-index instead of the VFS shared-memory + ** implementation. Take the exclusive lock now, before opening the WAL + ** file, to make sure this is safe. + */ + if (*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 { + rc = _pagerExclusiveLock(tls, pPager) + } + /* Open the connection to the log file. If this operation fails, + ** (e.g. due to malloc() failure), return an error code. + */ + if rc == SQLITE_OK { + rc = _sqlite3WalOpen(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).Ffd, (*TPager)(unsafe.Pointer(pPager)).FzWal, int32((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode), (*TPager)(unsafe.Pointer(pPager)).FjournalSizeLimit, pPager+296) + } + _pagerFixMaplimit(tls, pPager) + return rc +} + +// C documentation +// +// /* +// ** The caller must be holding a SHARED lock on the database file to call +// ** this function. +// ** +// ** If the pager passed as the first argument is open on a real database +// ** file (not a temp file or an in-memory database), and the WAL file +// ** is not already open, make an attempt to open it now. If successful, +// ** return SQLITE_OK. If an error occurs or the VFS used by the pager does +// ** not support the xShmXXX() methods, return an error code. *pbOpen is +// ** not modified in either case. +// ** +// ** If the pager is open on a temp-file (or in-memory database), or if +// ** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK +// ** without doing anything. +// */ +func _sqlite3PagerOpenWal(tls *libc.TLS, pPager uintptr, pbOpen uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK /* Return code */ + if !((*TPager)(unsafe.Pointer(pPager)).FtempFile != 0) && !((*TPager)(unsafe.Pointer(pPager)).FpWal != 0) { + if !(_sqlite3PagerWalSupported(tls, pPager) != 0) { + return int32(SQLITE_CANTOPEN) + } + /* Close any rollback journal previously open */ + _sqlite3OsClose(tls, (*TPager)(unsafe.Pointer(pPager)).Fjfd) + rc = _pagerOpenWal(tls, pPager) + if rc == SQLITE_OK { + (*TPager)(unsafe.Pointer(pPager)).FjournalMode = uint8(PAGER_JOURNALMODE_WAL) + (*TPager)(unsafe.Pointer(pPager)).FeState = uint8(PAGER_OPEN) + } + } else { + *(*int32)(unsafe.Pointer(pbOpen)) = int32(1) + } + return rc +} + +// C documentation +// +// /* +// ** This function is called to close the connection to the log file prior +// ** to switching from WAL to rollback mode. +// ** +// ** Before closing the log file, this function attempts to take an +// ** EXCLUSIVE lock on the database file. If this cannot be obtained, an +// ** error (SQLITE_BUSY) is returned and the log connection is not closed. +// ** If successful, the EXCLUSIVE lock is not released before returning. +// */ +func _sqlite3PagerCloseWal(tls *libc.TLS, pPager uintptr, db uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* logexists at bp+0 */ int32 + _ = rc + rc = SQLITE_OK + /* If the log file is not already open, but does exist in the file-system, + ** it may need to be checkpointed before the connection can switch to + ** rollback mode. Open it now so this can happen. + */ + if !((*TPager)(unsafe.Pointer(pPager)).FpWal != 0) { + *(*int32)(unsafe.Pointer(bp)) = 0 + rc = _pagerLockDb(tls, pPager, int32(SHARED_LOCK)) + if rc == SQLITE_OK { + rc = _sqlite3OsAccess(tls, (*TPager)(unsafe.Pointer(pPager)).FpVfs, (*TPager)(unsafe.Pointer(pPager)).FzWal, SQLITE_ACCESS_EXISTS, bp) + } + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp)) != 0 { + rc = _pagerOpenWal(tls, pPager) + } + } + /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on + ** the database file, the log and log-summary files will be deleted. + */ + if rc == SQLITE_OK && (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = _pagerExclusiveLock(tls, pPager) + if rc == SQLITE_OK { + rc = _sqlite3WalClose(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, db, int32((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace) + (*TPager)(unsafe.Pointer(pPager)).FpWal = uintptr(0) + _pagerFixMaplimit(tls, pPager) + if rc != 0 && !((*TPager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) { + _pagerUnlockDb(tls, pPager, int32(SHARED_LOCK)) + } + } + } + return rc +} + +// C documentation +// +// /* +// ** If this is a WAL database, obtain a snapshot handle for the snapshot +// ** currently open. Otherwise, return an error. +// */ +func _sqlite3PagerSnapshotGet(tls *libc.TLS, pPager uintptr, ppSnapshot uintptr) (r int32) { + var rc int32 + _ = rc + rc = int32(SQLITE_ERROR) + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = _sqlite3WalSnapshotGet(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, ppSnapshot) + } + return rc +} + +// C documentation +// +// /* +// ** If this is a WAL database, store a pointer to pSnapshot. Next time a +// ** read transaction is opened, attempt to read from the snapshot it +// ** identifies. If this is not a WAL database, return an error. +// */ +func _sqlite3PagerSnapshotOpen(tls *libc.TLS, pPager uintptr, pSnapshot uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + _sqlite3WalSnapshotOpen(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pSnapshot) + } else { + rc = int32(SQLITE_ERROR) + } + return rc +} + +// C documentation +// +// /* +// ** If this is a WAL database, call sqlite3WalSnapshotRecover(). If this +// ** is not a WAL database, return an error. +// */ +func _sqlite3PagerSnapshotRecover(tls *libc.TLS, pPager uintptr) (r int32) { + var rc int32 + _ = rc + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = _sqlite3WalSnapshotRecover(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) + } else { + rc = int32(SQLITE_ERROR) + } + return rc +} + +// C documentation +// +// /* +// ** The caller currently has a read transaction open on the database. +// ** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise, +// ** this function takes a SHARED lock on the CHECKPOINTER slot and then +// ** checks if the snapshot passed as the second argument is still +// ** available. If so, SQLITE_OK is returned. +// ** +// ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if +// ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error +// ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER +// ** lock is released before returning. +// */ +func _sqlite3PagerSnapshotCheck(tls *libc.TLS, pPager uintptr, pSnapshot uintptr) (r int32) { + var rc int32 + _ = rc + if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = _sqlite3WalSnapshotCheck(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, pSnapshot) + } else { + rc = int32(SQLITE_ERROR) + } + return rc +} + +// C documentation +// +// /* +// ** Release a lock obtained by an earlier successful call to +// ** sqlite3PagerSnapshotCheck(). +// */ +func _sqlite3PagerSnapshotUnlock(tls *libc.TLS, pPager uintptr) { + _sqlite3WalSnapshotUnlock(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal) +} + +/************** End of pager.c ***********************************************/ +/************** Begin file wal.c *********************************************/ +/* +** 2010 February 1 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains the implementation of a write-ahead log (WAL) used in +** "journal_mode=WAL" mode. +** +** WRITE-AHEAD LOG (WAL) FILE FORMAT +** +** A WAL file consists of a header followed by zero or more "frames". +** Each frame records the revised content of a single page from the +** database file. All changes to the database are recorded by writing +** frames into the WAL. Transactions commit when a frame is written that +** contains a commit marker. A single WAL can and usually does record +** multiple transactions. Periodically, the content of the WAL is +** transferred back into the database file in an operation called a +** "checkpoint". +** +** A single WAL file can be used multiple times. In other words, the +** WAL can fill up with frames and then be checkpointed and then new +** frames can overwrite the old ones. A WAL always grows from beginning +** toward the end. Checksums and counters attached to each frame are +** used to determine which frames within the WAL are valid and which +** are leftovers from prior checkpoints. +** +** The WAL header is 32 bytes in size and consists of the following eight +** big-endian 32-bit unsigned integer values: +** +** 0: Magic number. 0x377f0682 or 0x377f0683 +** 4: File format version. Currently 3007000 +** 8: Database page size. Example: 1024 +** 12: Checkpoint sequence number +** 16: Salt-1, random integer incremented with each checkpoint +** 20: Salt-2, a different random integer changing with each ckpt +** 24: Checksum-1 (first part of checksum for first 24 bytes of header). +** 28: Checksum-2 (second part of checksum for first 24 bytes of header). +** +** Immediately following the wal-header are zero or more frames. Each +** frame consists of a 24-byte frame-header followed by a bytes +** of page data. The frame-header is six big-endian 32-bit unsigned +** integer values, as follows: +** +** 0: Page number. +** 4: For commit records, the size of the database image in pages +** after the commit. For all other records, zero. +** 8: Salt-1 (copied from the header) +** 12: Salt-2 (copied from the header) +** 16: Checksum-1. +** 20: Checksum-2. +** +** A frame is considered valid if and only if the following conditions are +** true: +** +** (1) The salt-1 and salt-2 values in the frame-header match +** salt values in the wal-header +** +** (2) The checksum values in the final 8 bytes of the frame-header +** exactly match the checksum computed consecutively on the +** WAL header and the first 8 bytes and the content of all frames +** up to and including the current frame. +** +** The checksum is computed using 32-bit big-endian integers if the +** magic number in the first 4 bytes of the WAL is 0x377f0683 and it +** is computed using little-endian if the magic number is 0x377f0682. +** The checksum values are always stored in the frame header in a +** big-endian format regardless of which byte order is used to compute +** the checksum. The checksum is computed by interpreting the input as +** an even number of unsigned 32-bit integers: x[0] through x[N]. The +** algorithm used for the checksum is as follows: +** +** for i from 0 to n-1 step 2: +** s0 += x[i] + s1; +** s1 += x[i+1] + s0; +** endfor +** +** Note that s0 and s1 are both weighted checksums using fibonacci weights +** in reverse order (the largest fibonacci weight occurs on the first element +** of the sequence being summed.) The s1 value spans all 32-bit +** terms of the sequence whereas s0 omits the final term. +** +** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the +** WAL is transferred into the database, then the database is VFS.xSync-ed. +** The VFS.xSync operations serve as write barriers - all writes launched +** before the xSync must complete before any write that launches after the +** xSync begins. +** +** After each checkpoint, the salt-1 value is incremented and the salt-2 +** value is randomized. This prevents old and new frames in the WAL from +** being considered valid at the same time and being checkpointing together +** following a crash. +** +** READER ALGORITHM +** +** To read a page from the database (call it page number P), a reader +** first checks the WAL to see if it contains page P. If so, then the +** last valid instance of page P that is a followed by a commit frame +** or is a commit frame itself becomes the value read. If the WAL +** contains no copies of page P that are valid and which are a commit +** frame or are followed by a commit frame, then page P is read from +** the database file. +** +** To start a read transaction, the reader records the index of the last +** valid frame in the WAL. The reader uses this recorded "mxFrame" value +** for all subsequent read operations. New transactions can be appended +** to the WAL, but as long as the reader uses its original mxFrame value +** and ignores the newly appended content, it will see a consistent snapshot +** of the database from a single point in time. This technique allows +** multiple concurrent readers to view different versions of the database +** content simultaneously. +** +** The reader algorithm in the previous paragraphs works correctly, but +** because frames for page P can appear anywhere within the WAL, the +** reader has to scan the entire WAL looking for page P frames. If the +** WAL is large (multiple megabytes is typical) that scan can be slow, +** and read performance suffers. To overcome this problem, a separate +** data structure called the wal-index is maintained to expedite the +** search for frames of a particular page. +** +** WAL-INDEX FORMAT +** +** Conceptually, the wal-index is shared memory, though VFS implementations +** might choose to implement the wal-index using a mmapped file. Because +** the wal-index is shared memory, SQLite does not support journal_mode=WAL +** on a network filesystem. All users of the database must be able to +** share memory. +** +** In the default unix and windows implementation, the wal-index is a mmapped +** file whose name is the database name with a "-shm" suffix added. For that +** reason, the wal-index is sometimes called the "shm" file. +** +** The wal-index is transient. After a crash, the wal-index can (and should +** be) reconstructed from the original WAL file. In fact, the VFS is required +** to either truncate or zero the header of the wal-index when the last +** connection to it closes. Because the wal-index is transient, it can +** use an architecture-specific format; it does not have to be cross-platform. +** Hence, unlike the database and WAL file formats which store all values +** as big endian, the wal-index can store multi-byte values in the native +** byte order of the host computer. +** +** The purpose of the wal-index is to answer this question quickly: Given +** a page number P and a maximum frame index M, return the index of the +** last frame in the wal before frame M for page P in the WAL, or return +** NULL if there are no frames for page P in the WAL prior to M. +** +** The wal-index consists of a header region, followed by an one or +** more index blocks. +** +** The wal-index header contains the total number of frames within the WAL +** in the mxFrame field. +** +** Each index block except for the first contains information on +** HASHTABLE_NPAGE frames. The first index block contains information on +** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and +** HASHTABLE_NPAGE are selected so that together the wal-index header and +** first index block are the same size as all other index blocks in the +** wal-index. The values are: +** +** HASHTABLE_NPAGE 4096 +** HASHTABLE_NPAGE_ONE 4062 +** +** Each index block contains two sections, a page-mapping that contains the +** database page number associated with each wal frame, and a hash-table +** that allows readers to query an index block for a specific page number. +** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE +** for the first index block) 32-bit page numbers. The first entry in the +** first index-block contains the database page number corresponding to the +** first frame in the WAL file. The first entry in the second index block +** in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in +** the log, and so on. +** +** The last index block in a wal-index usually contains less than the full +** complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers, +** depending on the contents of the WAL file. This does not change the +** allocated size of the page-mapping array - the page-mapping array merely +** contains unused entries. +** +** Even without using the hash table, the last frame for page P +** can be found by scanning the page-mapping sections of each index block +** starting with the last index block and moving toward the first, and +** within each index block, starting at the end and moving toward the +** beginning. The first entry that equals P corresponds to the frame +** holding the content for that page. +** +** The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers. +** HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the +** hash table for each page number in the mapping section, so the hash +** table is never more than half full. The expected number of collisions +** prior to finding a match is 1. Each entry of the hash table is an +** 1-based index of an entry in the mapping section of the same +** index block. Let K be the 1-based index of the largest entry in +** the mapping section. (For index blocks other than the last, K will +** always be exactly HASHTABLE_NPAGE (4096) and for the last index block +** K will be (mxFrame%HASHTABLE_NPAGE).) Unused slots of the hash table +** contain a value of 0. +** +** To look for page P in the hash table, first compute a hash iKey on +** P as follows: +** +** iKey = (P * 383) % HASHTABLE_NSLOT +** +** Then start scanning entries of the hash table, starting with iKey +** (wrapping around to the beginning when the end of the hash table is +** reached) until an unused hash slot is found. Let the first unused slot +** be at index iUnused. (iUnused might be less than iKey if there was +** wrap-around.) Because the hash table is never more than half full, +** the search is guaranteed to eventually hit an unused entry. Let +** iMax be the value between iKey and iUnused, closest to iUnused, +** where aHash[iMax]==P. If there is no iMax entry (if there exists +** no hash slot such that aHash[i]==p) then page P is not in the +** current index block. Otherwise the iMax-th mapping entry of the +** current index block corresponds to the last entry that references +** page P. +** +** A hash search begins with the last index block and moves toward the +** first index block, looking for entries corresponding to page P. On +** average, only two or three slots in each index block need to be +** examined in order to either find the last entry for page P, or to +** establish that no such entry exists in the block. Each index block +** holds over 4000 entries. So two or three index blocks are sufficient +** to cover a typical 10 megabyte WAL file, assuming 1K pages. 8 or 10 +** comparisons (on average) suffice to either locate a frame in the +** WAL or to establish that the frame does not exist in the WAL. This +** is much faster than scanning the entire 10MB WAL. +** +** Note that entries are added in order of increasing K. Hence, one +** reader might be using some value K0 and a second reader that started +** at a later time (after additional transactions were added to the WAL +** and to the wal-index) might be using a different value K1, where K1>K0. +** Both readers can use the same hash table and mapping section to get +** the correct result. There may be entries in the hash table with +** K>K0 but to the first reader, those entries will appear to be unused +** slots in the hash table and so the first reader will get an answer as +** if no values greater than K0 had ever been inserted into the hash table +** in the first place - which is what reader one wants. Meanwhile, the +** second reader using K1 will see additional values that were inserted +** later, which is exactly what reader two wants. +** +** When a rollback occurs, the value of K is decreased. Hash table entries +** that correspond to frames greater than the new K value are removed +** from the hash table at this point. + */ + +/* #include "wal.h" */ + +/* +** Trace output macros + */ + +/* +** The maximum (and only) versions of the wal and wal-index formats +** that may be interpreted by this version of SQLite. +** +** If a client begins recovering a WAL file and finds that (a) the checksum +** values in the wal-header are correct and (b) the version field is not +** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. +** +** Similarly, if a client successfully reads a wal-index header (i.e. the +** checksum test is successful) and finds that the version field is not +** WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite +** returns SQLITE_CANTOPEN. + */ + +/* +** Index numbers for various locking bytes. WAL_NREADER is the number +** of available reader locks and should be at least 3. The default +** is SQLITE_SHM_NLOCK==8 and WAL_NREADER==5. +** +** Technically, the various VFSes are free to implement these locks however +** they see fit. However, compatibility is encouraged so that VFSes can +** interoperate. The standard implementation used on both unix and windows +** is for the index number to indicate a byte offset into the +** WalCkptInfo.aLock[] array in the wal-index header. In other words, all +** locks are on the shm file. The WALINDEX_LOCK_OFFSET constant (which +** should be 120) is the location in the shm file for the first locking +** byte. + */ + +// C documentation +// +// /* Object declarations */ +type TWalIndexHdr = struct { + FiVersion Tu32 + Funused Tu32 + FiChange Tu32 + FisInit Tu8 + FbigEndCksum Tu8 + FszPage Tu16 + FmxFrame Tu32 + FnPage Tu32 + FaFrameCksum [2]Tu32 + FaSalt [2]Tu32 + FaCksum [2]Tu32 +} + +type WalIndexHdr = TWalIndexHdr + +type TWalIterator = struct { + FiPrior Tu32 + FnSegment int32 + FaSegment [1]TWalSegment +} + +type WalIterator = TWalIterator + +type TWalCkptInfo = struct { + FnBackfill Tu32 + FaReadMark [5]Tu32 + FaLock [8]Tu8 + FnBackfillAttempted Tu32 + FnotUsed0 Tu32 +} + +type WalCkptInfo = TWalCkptInfo + +/* +** The following object holds a copy of the wal-index header content. +** +** The actual header in the wal-index consists of two copies of this +** object followed by one instance of the WalCkptInfo object. +** For all versions of SQLite through 3.10.0 and probably beyond, +** the locking bytes (WalCkptInfo.aLock) start at offset 120 and +** the total header size is 136 bytes. +** +** The szPage value can be any power of 2 between 512 and 32768, inclusive. +** Or it can be 1 to represent a 65536-byte page. The latter case was +** added in 3.7.1 when support for 64K pages was added. + */ +type TWalIndexHdr1 = struct { + FiVersion Tu32 + Funused Tu32 + FiChange Tu32 + FisInit Tu8 + FbigEndCksum Tu8 + FszPage Tu16 + FmxFrame Tu32 + FnPage Tu32 + FaFrameCksum [2]Tu32 + FaSalt [2]Tu32 + FaCksum [2]Tu32 +} + +type WalIndexHdr1 = TWalIndexHdr1 + +/* +** A copy of the following object occurs in the wal-index immediately +** following the second copy of the WalIndexHdr. This object stores +** information used by checkpoint. +** +** nBackfill is the number of frames in the WAL that have been written +** back into the database. (We call the act of moving content from WAL to +** database "backfilling".) The nBackfill number is never greater than +** WalIndexHdr.mxFrame. nBackfill can only be increased by threads +** holding the WAL_CKPT_LOCK lock (which includes a recovery thread). +** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from +** mxFrame back to zero when the WAL is reset. +** +** nBackfillAttempted is the largest value of nBackfill that a checkpoint +** has attempted to achieve. Normally nBackfill==nBackfillAtempted, however +** the nBackfillAttempted is set before any backfilling is done and the +** nBackfill is only set after all backfilling completes. So if a checkpoint +** crashes, nBackfillAttempted might be larger than nBackfill. The +** WalIndexHdr.mxFrame must never be less than nBackfillAttempted. +** +** The aLock[] field is a set of bytes used for locking. These bytes should +** never be read or written. +** +** There is one entry in aReadMark[] for each reader lock. If a reader +** holds read-lock K, then the value in aReadMark[K] is no greater than +** the mxFrame for that reader. The value READMARK_NOT_USED (0xffffffff) +** for any aReadMark[] means that entry is unused. aReadMark[0] is +** a special case; its value is never used and it exists as a place-holder +** to avoid having to offset aReadMark[] indexes by one. Readers holding +** WAL_READ_LOCK(0) always ignore the entire WAL and read all content +** directly from the database. +** +** The value of aReadMark[K] may only be changed by a thread that +** is holding an exclusive lock on WAL_READ_LOCK(K). Thus, the value of +** aReadMark[K] cannot changed while there is a reader is using that mark +** since the reader will be holding a shared lock on WAL_READ_LOCK(K). +** +** The checkpointer may only transfer frames from WAL to database where +** the frame numbers are less than or equal to every aReadMark[] that is +** in use (that is, every aReadMark[j] for which there is a corresponding +** WAL_READ_LOCK(j)). New readers (usually) pick the aReadMark[] with the +** largest value and will increase an unused aReadMark[] to mxFrame if there +** is not already an aReadMark[] equal to mxFrame. The exception to the +** previous sentence is when nBackfill equals mxFrame (meaning that everything +** in the WAL has been backfilled into the database) then new readers +** will choose aReadMark[0] which has value 0 and hence such reader will +** get all their all content directly from the database file and ignore +** the WAL. +** +** Writers normally append new frames to the end of the WAL. However, +** if nBackfill equals mxFrame (meaning that all WAL content has been +** written back into the database) and if no readers are using the WAL +** (in other words, if there are no WAL_READ_LOCK(i) where i>0) then +** the writer will first "reset" the WAL back to the beginning and start +** writing new content beginning at frame 1. +** +** We assume that 32-bit loads are atomic and so no locks are needed in +** order to read from any aReadMark[] entries. + */ +type TWalCkptInfo1 = struct { + FnBackfill Tu32 + FaReadMark [5]Tu32 + FaLock [8]Tu8 + FnBackfillAttempted Tu32 + FnotUsed0 Tu32 +} + +type WalCkptInfo1 = TWalCkptInfo1 + +/* +** This is a schematic view of the complete 136-byte header of the +** wal-index file (also known as the -shm file): +** +** +-----------------------------+ +** 0: | iVersion | ** +-----------------------------+ | +** 4: | (unused padding) | | +** +-----------------------------+ | +** 8: | iChange | | +** +-------+-------+-------------+ | +** 12: | bInit | bBig | szPage | | +** +-------+-------+-------------+ | +** 16: | mxFrame | | First copy of the +** +-----------------------------+ | WalIndexHdr object +** 20: | nPage | | +** +-----------------------------+ | +** 24: | aFrameCksum | | +** | | | +** +-----------------------------+ | +** 32: | aSalt | | +** | | | +** +-----------------------------+ | +** 40: | aCksum | | +** | | / +** +-----------------------------+ +** 48: | iVersion | ** +-----------------------------+ | +** 52: | (unused padding) | | +** +-----------------------------+ | +** 56: | iChange | | +** +-------+-------+-------------+ | +** 60: | bInit | bBig | szPage | | +** +-------+-------+-------------+ | Second copy of the +** 64: | mxFrame | | WalIndexHdr +** +-----------------------------+ | +** 68: | nPage | | +** +-----------------------------+ | +** 72: | aFrameCksum | | +** | | | +** +-----------------------------+ | +** 80: | aSalt | | +** | | | +** +-----------------------------+ | +** 88: | aCksum | | +** | | / +** +-----------------------------+ +** 96: | nBackfill | +** +-----------------------------+ +** 100: | 5 read marks | +** | | +** | | +** | | +** | | +** +-------+-------+------+------+ +** 120: | Write | Ckpt | Rcvr | Rd0 | ** +-------+-------+------+------+ ) 8 lock bytes +** | Read1 | Read2 | Rd3 | Rd4 | / +** +-------+-------+------+------+ +** 128: | nBackfillAttempted | +** +-----------------------------+ +** 132: | (unused padding) | +** +-----------------------------+ + */ + +/* A block of WALINDEX_LOCK_RESERVED bytes beginning at +** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems +** only support mandatory file-locks, we do not read or write data +** from the region of the file on which locks are applied. + */ + +/* Size of header before each frame in wal */ + +/* Size of write ahead log header, including checksum. */ + +/* WAL magic value. Either this value, or the same value with the least +** significant bit also set (WAL_MAGIC | 0x00000001) is stored in 32-bit +** big-endian format in the first 4 bytes of a WAL file. +** +** If the LSB is set, then the checksums for each frame within the WAL +** file are calculated by treating all data as an array of 32-bit +** big-endian words. Otherwise, they are calculated by interpreting +** all data as 32-bit little-endian words. + */ + +/* +** Return the offset of frame iFrame in the write-ahead log file, +** assuming a database page size of szPage bytes. The offset returned +** is to the start of the write-ahead log frame-header. + */ + +/* +** An open write-ahead log file is represented by an instance of the +** following object. + */ +type TWal1 = struct { + FpVfs uintptr + FpDbFd uintptr + FpWalFd uintptr + FiCallback Tu32 + FmxWalSize Ti64 + FnWiData int32 + FszFirstBlock int32 + FapWiData uintptr + FszPage Tu32 + FreadLock Ti16 + FsyncFlags Tu8 + FexclusiveMode Tu8 + FwriteLock Tu8 + FckptLock Tu8 + FreadOnly Tu8 + FtruncateOnCommit Tu8 + FsyncHeader Tu8 + FpadToSectorBoundary Tu8 + FbShmUnreliable Tu8 + Fhdr TWalIndexHdr + FminFrame Tu32 + FiReCksum Tu32 + FzWalName uintptr + FnCkpt Tu32 + FpSnapshot uintptr +} + +type Wal1 = TWal1 + +/* +** Candidate values for Wal.exclusiveMode. + */ + +/* +** Possible values for WAL.readOnly + */ + +// C documentation +// +// /* +// ** Each page of the wal-index mapping contains a hash-table made up of +// ** an array of HASHTABLE_NSLOT elements of the following type. +// */ +type Tht_slot = uint16 + +type ht_slot = Tht_slot + +/* +** This structure is used to implement an iterator that loops through +** all frames in the WAL in database page order. Where two or more frames +** correspond to the same database page, the iterator visits only the +** frame most recently written to the WAL (in other words, the frame with +** the largest index). +** +** The internals of this structure are only accessed by: +** +** walIteratorInit() - Create a new iterator, +** walIteratorNext() - Step an iterator, +** walIteratorFree() - Free an iterator. +** +** This functionality is used by the checkpoint code (see walCheckpoint()). + */ +type TWalIterator1 = struct { + FiPrior Tu32 + FnSegment int32 + FaSegment [1]TWalSegment +} + +type WalIterator1 = TWalIterator1 + +/* +** Define the parameters of the hash tables in the wal-index file. There +** is a hash-table following every HASHTABLE_NPAGE page numbers in the +** wal-index. +** +** Changing any of these constants will alter the wal-index format and +** create incompatibilities. + */ + +/* +** The block of page numbers associated with the first hash-table in a +** wal-index is smaller than usual. This is so that there is a complete +** hash-table on each aligned 32KB page of the wal-index. + */ + +/* The wal-index is divided into pages of WALINDEX_PGSZ bytes each. */ + +/* +** Structured Exception Handling (SEH) is a Windows-specific technique +** for catching exceptions raised while accessing memory-mapped files. +** +** The -DSQLITE_USE_SEH compile-time option means to use SEH to catch and +** deal with system-level errors that arise during WAL -shm file processing. +** Without this compile-time option, any system-level faults that appear +** while accessing the memory-mapped -shm file will cause a process-wide +** signal to be deliver, which will more than likely cause the entire +** process to exit. + */ + +// C documentation +// +// /* +// ** Obtain a pointer to the iPage'th page of the wal-index. The wal-index +// ** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are +// ** numbered from zero. +// ** +// ** If the wal-index is currently smaller the iPage pages then the size +// ** of the wal-index might be increased, but only if it is safe to do +// ** so. It is safe to enlarge the wal-index if pWal->writeLock is true +// ** or pWal->exclusiveMode==WAL_HEAPMEMORY_MODE. +// ** +// ** Three possible result scenarios: +// ** +// ** (1) rc==SQLITE_OK and *ppPage==Requested-Wal-Index-Page +// ** (2) rc>=SQLITE_ERROR and *ppPage==NULL +// ** (3) rc==SQLITE_OK and *ppPage==NULL // only if iPage==0 +// ** +// ** Scenario (3) can only occur when pWal->writeLock is false and iPage==0 +// */ +func _walIndexPageRealloc(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) (r int32) { + var apNew, p1 uintptr + var nByte Tsqlite3_int64 + var rc int32 + _, _, _, _ = apNew, nByte, rc, p1 + rc = SQLITE_OK + /* Enlarge the pWal->apWiData[] array if required */ + if (*TWal)(unsafe.Pointer(pWal)).FnWiData <= iPage { + nByte = int64(uint64(8) * uint64(iPage+libc.Int32FromInt32(1))) + apNew = _sqlite3Realloc(tls, (*TWal)(unsafe.Pointer(pWal)).FapWiData, uint64(nByte)) + if !(apNew != 0) { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, apNew+uintptr((*TWal)(unsafe.Pointer(pWal)).FnWiData)*8, 0, uint64(8)*uint64(iPage+libc.Int32FromInt32(1)-(*TWal)(unsafe.Pointer(pWal)).FnWiData)) + (*TWal)(unsafe.Pointer(pWal)).FapWiData = apNew + (*TWal)(unsafe.Pointer(pWal)).FnWiData = iPage + int32(1) + } + /* Request a pointer to the required page from the VFS */ + if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == int32(WAL_HEAPMEMORY_MODE) { + *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) = _sqlite3MallocZero(tls, libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)) + if !(*(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) != 0) { + rc = int32(SQLITE_NOMEM) + } + } else { + rc = _sqlite3OsShmMap(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, iPage, int32(libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)), int32((*TWal)(unsafe.Pointer(pWal)).FwriteLock), (*TWal)(unsafe.Pointer(pWal)).FapWiData+uintptr(iPage)*8) + if rc == SQLITE_OK { + if iPage > 0 && _sqlite3FaultSim(tls, int32(600)) != 0 { + rc = int32(SQLITE_NOMEM) + } + } else { + if rc&int32(0xff) == int32(SQLITE_READONLY) { + p1 = pWal + 66 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(WAL_SHM_RDONLY)) + if rc == int32(SQLITE_READONLY) { + rc = SQLITE_OK + } + } + } + } + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) + return rc +} + +func _walIndexPage(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) (r int32) { + var v1 uintptr + var v2 bool + _, _ = v1, v2 + if v2 = (*TWal)(unsafe.Pointer(pWal)).FnWiData <= iPage; !v2 { + v1 = *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) + *(*uintptr)(unsafe.Pointer(ppPage)) = v1 + } + if v2 || v1 == uintptr(0) { + return _walIndexPageRealloc(tls, pWal, iPage, ppPage) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return a pointer to the WalCkptInfo structure in the wal-index. +// */ +func _walCkptInfo(tls *libc.TLS, pWal uintptr) (r uintptr) { + return *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) + uintptr(libc.Uint64FromInt64(48)/libc.Uint64FromInt32(2))*4 +} + +// C documentation +// +// /* +// ** Return a pointer to the WalIndexHdr structure in the wal-index. +// */ +func _walIndexHdr(tls *libc.TLS, pWal uintptr) (r uintptr) { + return *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) +} + +/* +** The argument to this macro must be of type u32. On a little-endian +** architecture, it returns the u32 value that results from interpreting +** the 4 bytes as a big-endian value. On a big-endian architecture, it +** returns the value that would be produced by interpreting the 4 bytes +** of the input value as a little-endian integer. + */ + +// C documentation +// +// /* +// ** Generate or extend an 8 byte checksum based on the data in +// ** array aByte[] and the initial values of aIn[0] and aIn[1] (or +// ** initial values of 0 and 0 if aIn==NULL). +// ** +// ** The checksum is written back into aOut[] before returning. +// ** +// ** nByte must be a positive multiple of 8. +// */ +func _walChecksumBytes(tls *libc.TLS, nativeCksum int32, a uintptr, nByte int32, aIn uintptr, aOut uintptr) { + var aData, aEnd, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v3, v4, v5, v6, v7, v8, v9 uintptr + var s1, s2, v1 Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, aEnd, s1, s2, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v3, v4, v5, v6, v7, v8, v9 + aData = a + aEnd = a + uintptr(nByte) + if aIn != 0 { + s1 = *(*Tu32)(unsafe.Pointer(aIn)) + s2 = *(*Tu32)(unsafe.Pointer(aIn + 1*4)) + } else { + v1 = libc.Uint32FromInt32(0) + s2 = v1 + s1 = v1 + } + if !(nativeCksum != 0) { + for cond := true; cond; cond = aData < aEnd { + s1 += *(*Tu32)(unsafe.Pointer(aData))&uint32(0x000000FF)<>int32(8) + *(*Tu32)(unsafe.Pointer(aData))&uint32(0xFF000000)>>int32(24) + s2 + s2 += *(*Tu32)(unsafe.Pointer(aData + 1*4))&uint32(0x000000FF)<>int32(8) + *(*Tu32)(unsafe.Pointer(aData + 1*4))&uint32(0xFF000000)>>int32(24) + s1 + aData += uintptr(2) * 4 + } + } else { + if nByte%int32(64) == 0 { + for cond := true; cond; cond = aData < aEnd { + v2 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v2)) + s2 + v3 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v3)) + s1 + v4 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v4)) + s2 + v5 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v5)) + s1 + v6 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v6)) + s2 + v7 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v7)) + s1 + v8 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v8)) + s2 + v9 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v9)) + s1 + v10 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v10)) + s2 + v11 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v11)) + s1 + v12 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v12)) + s2 + v13 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v13)) + s1 + v14 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v14)) + s2 + v15 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v15)) + s1 + v16 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v16)) + s2 + v17 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v17)) + s1 + } + } else { + for cond := true; cond; cond = aData < aEnd { + v18 = aData + aData += 4 + s1 += *(*Tu32)(unsafe.Pointer(v18)) + s2 + v19 = aData + aData += 4 + s2 += *(*Tu32)(unsafe.Pointer(v19)) + s1 + } + } + } + *(*Tu32)(unsafe.Pointer(aOut)) = s1 + *(*Tu32)(unsafe.Pointer(aOut + 1*4)) = s2 +} + +// C documentation +// +// /* +// ** If there is the possibility of concurrent access to the SHM file +// ** from multiple threads and/or processes, then do a memory barrier. +// */ +func _walShmBarrier(tls *libc.TLS, pWal uintptr) { + if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) != int32(WAL_HEAPMEMORY_MODE) { + _sqlite3OsShmBarrier(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd) + } +} + +/* +** Add the SQLITE_NO_TSAN as part of the return-type of a function +** definition as a hint that the function contains constructs that +** might give false-positive TSAN warnings. +** +** See tag-20200519-1. + */ + +// C documentation +// +// /* +// ** Write the header information in pWal->hdr into the wal-index. +// ** +// ** The checksum on pWal->hdr is updated before it is written. +// */ +func _walIndexWriteHdr(tls *libc.TLS, pWal uintptr) { + var aHdr uintptr + var nCksum int32 + _, _ = aHdr, nCksum + aHdr = _walIndexHdr(tls, pWal) + nCksum = int32(uint64(libc.UintptrFromInt32(0) + 40)) + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FisInit = uint8(1) + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FiVersion = uint32(WALINDEX_MAX_VERSION) + _walChecksumBytes(tls, int32(1), pWal+72, nCksum, uintptr(0), pWal+72+40) + /* Possible TSAN false-positive. See tag-20200519-1 */ + libc.Xmemcpy(tls, aHdr+1*48, pWal+72, uint64(48)) + _walShmBarrier(tls, pWal) + libc.Xmemcpy(tls, aHdr, pWal+72, uint64(48)) +} + +// C documentation +// +// /* +// ** This function encodes a single frame header and writes it to a buffer +// ** supplied by the caller. A frame-header is made up of a series of +// ** 4-byte big-endian integers, as follows: +// ** +// ** 0: Page number. +// ** 4: For commit records, the size of the database image in pages +// ** after the commit. For all other records, zero. +// ** 8: Salt-1 (copied from the wal-header) +// ** 12: Salt-2 (copied from the wal-header) +// ** 16: Checksum-1. +// ** 20: Checksum-2. +// */ +func _walEncodeFrame(tls *libc.TLS, pWal uintptr, iPage Tu32, nTruncate Tu32, aData uintptr, aFrame uintptr) { + var aCksum uintptr + var nativeCksum int32 + _, _ = aCksum, nativeCksum /* True for native byte-order checksums */ + aCksum = pWal + 72 + 24 + _sqlite3Put4byte(tls, aFrame, iPage) + _sqlite3Put4byte(tls, aFrame+4, nTruncate) + if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(0) { + libc.Xmemcpy(tls, aFrame+8, pWal+72+32, uint64(8)) + nativeCksum = libc.BoolInt32(int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN) + _walChecksumBytes(tls, nativeCksum, aFrame, int32(8), aCksum, aCksum) + _walChecksumBytes(tls, nativeCksum, aData, int32((*TWal)(unsafe.Pointer(pWal)).FszPage), aCksum, aCksum) + _sqlite3Put4byte(tls, aFrame+16, *(*Tu32)(unsafe.Pointer(aCksum))) + _sqlite3Put4byte(tls, aFrame+20, *(*Tu32)(unsafe.Pointer(aCksum + 1*4))) + } else { + libc.Xmemset(tls, aFrame+8, 0, uint64(16)) + } +} + +// C documentation +// +// /* +// ** Check to see if the frame with header in aFrame[] and content +// ** in aData[] is valid. If it is a valid frame, fill *piPage and +// ** *pnTruncate and return true. Return if the frame is not valid. +// */ +func _walDecodeFrame(tls *libc.TLS, pWal uintptr, piPage uintptr, pnTruncate uintptr, aData uintptr, aFrame uintptr) (r int32) { + var aCksum uintptr + var nativeCksum int32 + var pgno Tu32 + _, _, _ = aCksum, nativeCksum, pgno /* True for native byte-order checksums */ + aCksum = pWal + 72 + 24 /* Page number of the frame */ + /* A frame is only valid if the salt values in the frame-header + ** match the salt values in the wal-header. + */ + if libc.Xmemcmp(tls, pWal+72+32, aFrame+8, uint64(8)) != 0 { + return 0 + } + /* A frame is only valid if the page number is greater than zero. + */ + pgno = _sqlite3Get4byte(tls, aFrame) + if pgno == uint32(0) { + return 0 + } + /* A frame is only valid if a checksum of the WAL header, + ** all prior frames, the first 16 bytes of this frame-header, + ** and the frame-data matches the checksum in the last 8 + ** bytes of this frame-header. + */ + nativeCksum = libc.BoolInt32(int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN) + _walChecksumBytes(tls, nativeCksum, aFrame, int32(8), aCksum, aCksum) + _walChecksumBytes(tls, nativeCksum, aData, int32((*TWal)(unsafe.Pointer(pWal)).FszPage), aCksum, aCksum) + if *(*Tu32)(unsafe.Pointer(aCksum)) != _sqlite3Get4byte(tls, aFrame+16) || *(*Tu32)(unsafe.Pointer(aCksum + 1*4)) != _sqlite3Get4byte(tls, aFrame+20) { + /* Checksum failed. */ + return 0 + } + /* If we reach this point, the frame is valid. Return the page number + ** and the new database size. + */ + *(*Tu32)(unsafe.Pointer(piPage)) = pgno + *(*Tu32)(unsafe.Pointer(pnTruncate)) = _sqlite3Get4byte(tls, aFrame+4) + return int32(1) +} + +// C documentation +// +// /* +// ** Set or release locks on the WAL. Locks are either shared or exclusive. +// ** A lock cannot be moved directly between shared and exclusive - it must go +// ** through the unlocked state first. +// ** +// ** In locking_mode=EXCLUSIVE, all of these routines become no-ops. +// */ +func _walLockShared(tls *libc.TLS, pWal uintptr, lockIdx int32) (r int32) { + var rc int32 + _ = rc + if (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return SQLITE_OK + } + rc = _sqlite3OsShmLock(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, int32(1), libc.Int32FromInt32(SQLITE_SHM_LOCK)|libc.Int32FromInt32(SQLITE_SHM_SHARED)) + return rc +} + +func _walUnlockShared(tls *libc.TLS, pWal uintptr, lockIdx int32) { + if (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return + } + _sqlite3OsShmLock(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, int32(1), libc.Int32FromInt32(SQLITE_SHM_UNLOCK)|libc.Int32FromInt32(SQLITE_SHM_SHARED)) +} + +func _walLockExclusive(tls *libc.TLS, pWal uintptr, lockIdx int32, n int32) (r int32) { + var rc int32 + _ = rc + if (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return SQLITE_OK + } + rc = _sqlite3OsShmLock(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, n, libc.Int32FromInt32(SQLITE_SHM_LOCK)|libc.Int32FromInt32(SQLITE_SHM_EXCLUSIVE)) + return rc +} + +func _walUnlockExclusive(tls *libc.TLS, pWal uintptr, lockIdx int32, n int32) { + if (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return + } + _sqlite3OsShmLock(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, n, libc.Int32FromInt32(SQLITE_SHM_UNLOCK)|libc.Int32FromInt32(SQLITE_SHM_EXCLUSIVE)) +} + +// C documentation +// +// /* +// ** Compute a hash on a page number. The resulting hash value must land +// ** between 0 and (HASHTABLE_NSLOT-1). The walHashNext() function advances +// ** the hash to the next value in the event of a collision. +// */ +func _walHash(tls *libc.TLS, iPage Tu32) (r int32) { + return int32(iPage * uint32(HASHTABLE_HASH_1) & uint32(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) +} + +func _walNextHash(tls *libc.TLS, iPriorHash int32) (r int32) { + return (iPriorHash + int32(1)) & (libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2) - libc.Int32FromInt32(1)) +} + +// C documentation +// +// /* +// ** An instance of the WalHashLoc object is used to describe the location +// ** of a page hash table in the wal-index. This becomes the return value +// ** from walHashGet(). +// */ +type TWalHashLoc = struct { + FaHash uintptr + FaPgno uintptr + FiZero Tu32 +} + +type WalHashLoc = TWalHashLoc + +type TWalHashLoc1 = struct { + FaHash uintptr + FaPgno uintptr + FiZero Tu32 +} + +type WalHashLoc1 = TWalHashLoc1 + +// C documentation +// +// /* +// ** Return pointers to the hash table and page number array stored on +// ** page iHash of the wal-index. The wal-index is broken into 32KB pages +// ** numbered starting from 0. +// ** +// ** Set output variable pLoc->aHash to point to the start of the hash table +// ** in the wal-index file. Set pLoc->iZero to one less than the frame +// ** number of the first frame indexed by this hash table. If a +// ** slot in the hash table is set to N, it refers to frame number +// ** (pLoc->iZero+N) in the log. +// ** +// ** Finally, set pLoc->aPgno so that pLoc->aPgno[0] is the page number of the +// ** first frame indexed by the hash table, frame (pLoc->iZero). +// */ +func _walHashGet(tls *libc.TLS, pWal uintptr, iHash int32, pLoc uintptr) (r int32) { + var rc int32 + _ = rc /* Return code */ + rc = _walIndexPage(tls, pWal, iHash, pLoc+8) + if (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno != 0 { + (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaHash = (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + 4096*4 + if iHash == 0 { + (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno = (*TWalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + uintptr((libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4))*4 + (*TWalHashLoc)(unsafe.Pointer(pLoc)).FiZero = uint32(0) + } else { + (*TWalHashLoc)(unsafe.Pointer(pLoc)).FiZero = uint32(libc.Uint64FromInt32(HASHTABLE_NPAGE) - (libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4) + uint64((iHash-int32(1))*int32(HASHTABLE_NPAGE))) + } + } else { + if rc == SQLITE_OK { + rc = int32(SQLITE_ERROR) + } + } + return rc +} + +// C documentation +// +// /* +// ** Return the number of the wal-index page that contains the hash-table +// ** and page-number array that contain entries corresponding to WAL frame +// ** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages +// ** are numbered starting from 0. +// */ +func _walFramePage(tls *libc.TLS, iFrame Tu32) (r int32) { + var iHash int32 + _ = iHash + iHash = int32((uint64(iFrame+uint32(HASHTABLE_NPAGE)) - (libc.Uint64FromInt32(HASHTABLE_NPAGE) - (libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)) - uint64(1)) / uint64(HASHTABLE_NPAGE)) + return iHash +} + +// C documentation +// +// /* +// ** Return the page number associated with frame iFrame in this WAL. +// */ +func _walFramePgno(tls *libc.TLS, pWal uintptr, iFrame Tu32) (r Tu32) { + var iHash int32 + _ = iHash + iHash = _walFramePage(tls, iFrame) + if iHash == 0 { + return *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) + uintptr((libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)+uint64(iFrame)-uint64(1))*4)) + } + return *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iHash)*8)) + uintptr((uint64(iFrame-uint32(1))-(libc.Uint64FromInt32(HASHTABLE_NPAGE)-(libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)))%uint64(HASHTABLE_NPAGE))*4)) +} + +// C documentation +// +// /* +// ** Remove entries from the hash table that point to WAL slots greater +// ** than pWal->hdr.mxFrame. +// ** +// ** This function is called whenever pWal->hdr.mxFrame is decreased due +// ** to a rollback or savepoint. +// ** +// ** At most only the hash table containing pWal->hdr.mxFrame needs to be +// ** updated. Any later hash tables will be automatically cleared when +// ** pWal->hdr.mxFrame advances to the point where those hash tables are +// ** actually needed. +// */ +func _walCleanupHash(tls *libc.TLS, pWal uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, iLimit, nByte int32 + var _ /* sLoc at bp+0 */ TWalHashLoc + _, _, _ = i, iLimit, nByte /* Hash table location */ + iLimit = 0 /* Used to iterate through aHash[] */ + if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == uint32(0) { + return + } + /* Obtain pointers to the hash-table and page-number array containing + ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed + ** that the page said hash-table and array reside on is already mapped.(1) + */ + i = _walHashGet(tls, pWal, _walFramePage(tls, (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame), bp) + if i != 0 { + return + } /* Defense-in-depth, in case (1) above is wrong */ + /* Zero all hash-table entries that correspond to frame numbers greater + ** than pWal->hdr.mxFrame. + */ + iLimit = int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame - (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) + i = 0 + for { + if !(i < libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2)) { + break + } + if int32(*(*Tht_slot)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash + uintptr(i)*2))) > iLimit { + *(*Tht_slot)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash + uintptr(i)*2)) = uint16(0) + } + goto _1 + _1: + ; + i++ + } + /* Zero the entries in the aPgno array that correspond to frames with + ** frame numbers greater than pWal->hdr.mxFrame. + */ + nByte = int32(int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash) - int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno+uintptr(iLimit)*4)) + libc.Xmemset(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno+uintptr(iLimit)*4, 0, uint64(nByte)) +} + +// C documentation +// +// /* +// ** Set an entry in the wal-index that will map database page number +// ** pPage into WAL frame iFrame. +// */ +func _walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame Tu32, iPage Tu32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iKey, idx, nByte, nCollide, rc, v2 int32 + var _ /* sLoc at bp+0 */ TWalHashLoc + _, _, _, _, _, _ = iKey, idx, nByte, nCollide, rc, v2 /* Wal-index hash table location */ + rc = _walHashGet(tls, pWal, _walFramePage(tls, iFrame), bp) + /* Assuming the wal-index file was successfully mapped, populate the + ** page number array and hash table entry. + */ + if rc == SQLITE_OK { /* Number of hash collisions */ + idx = int32(iFrame - (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) + /* If this is the first entry to be added to this hash-table, zero the + ** entire hash table and aPgno[] array before proceeding. + */ + if idx == int32(1) { + nByte = int32(int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash+uintptr(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))*2) - int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno)) + libc.Xmemset(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno, 0, uint64(nByte)) + } + /* If the entry in aPgno[] is already set, then the previous writer + ** must have exited unexpectedly in the middle of a transaction (after + ** writing one or more dirty pages to the WAL to free up memory). + ** Remove the remnants of that writers uncommitted transaction from + ** the hash-table before writing any new entries. + */ + if *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) != 0 { + _walCleanupHash(tls, pWal) + } + /* Write the aPgno[] array entry and the hash-table slot. */ + nCollide = idx + iKey = _walHash(tls, iPage) + for { + if !(*(*Tht_slot)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash + uintptr(iKey)*2)) != 0) { + break + } + v2 = nCollide + nCollide-- + if v2 == 0 { + return _sqlite3CorruptError(tls, int32(65899)) + } + goto _1 + _1: + ; + iKey = _walNextHash(tls, iKey) + } + *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(idx-int32(1))*4)) = iPage + libc.AtomicStoreNUint16((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash+uintptr(iKey)*2, uint16(idx), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + return rc +} + +// C documentation +// +// /* +// ** Recover the wal-index by reading the write-ahead log file. +// ** +// ** This routine first tries to establish an exclusive lock on the +// ** wal-index to prevent other threads/processes from doing anything +// ** with the WAL or wal-index while recovery is running. The +// ** WAL_RECOVER_LOCK is also held so that other threads will know +// ** that this thread is running recovery. If unable to establish +// ** the necessary locks, this routine returns SQLITE_BUSY. +// */ +func _walIndexRecover(tls *libc.TLS, pWal uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var aData, aFrame, aPrivate, pInfo uintptr + var aFrameCksum [2]Tu32 + var i, iLock, isValid, rc, szFrame, szPage int32 + var iFirst, iFrame, iLast, iLastFrame, iPg, magic, nHdr, nHdr32, version Tu32 + var iOffset Ti64 + var v2, v3, v5 uint64 + var _ /* aBuf at bp+8 */ [32]Tu8 + var _ /* aShare at bp+40 */ uintptr + var _ /* nSize at bp+0 */ Ti64 + var _ /* nTruncate at bp+52 */ Tu32 + var _ /* pgno at bp+48 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, aFrame, aFrameCksum, aPrivate, i, iFirst, iFrame, iLast, iLastFrame, iLock, iOffset, iPg, isValid, magic, nHdr, nHdr32, pInfo, rc, szFrame, szPage, version, v2, v3, v5 /* Size of log file */ + aFrameCksum = [2]Tu32{} /* Lock offset to lock for checkpoint */ + /* Obtain an exclusive lock on all byte in the locking range not already + ** locked by the caller. The caller is guaranteed to have locked the + ** WAL_WRITE_LOCK byte, and may have also locked the WAL_CKPT_LOCK byte. + ** If successful, the same bytes that are locked here are unlocked before + ** this function returns. + */ + iLock = int32(WAL_ALL_BUT_WRITE) + int32((*TWal)(unsafe.Pointer(pWal)).FckptLock) + rc = _walLockExclusive(tls, pWal, iLock, libc.Int32FromInt32(3)+libc.Int32FromInt32(0)-iLock) + if rc != 0 { + return rc + } + libc.Xmemset(tls, pWal+72, 0, uint64(48)) + rc = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp) + if rc != SQLITE_OK { + goto recovery_error + } + if *(*Ti64)(unsafe.Pointer(bp)) > int64(WAL_HDRSIZE) { /* Buffer to load WAL header into */ + aPrivate = uintptr(0) /* Heap copy of *-shm hash being populated */ + aFrame = uintptr(0) /* Last frame in wal, based on nSize alone */ + /* Read in the WAL header. */ + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp+8, int32(WAL_HDRSIZE), 0) + if rc != SQLITE_OK { + goto recovery_error + } + /* If the database page size is not a power of two, or is greater than + ** SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid + ** data. Similarly, if the 'magic' value is invalid, ignore the whole + ** WAL file. + */ + magic = _sqlite3Get4byte(tls, bp+8) + szPage = int32(_sqlite3Get4byte(tls, bp+8+8)) + if magic&uint32(0xFFFFFFFE) != uint32(WAL_MAGIC) || szPage&(szPage-int32(1)) != 0 || szPage > int32(SQLITE_MAX_PAGE_SIZE) || szPage < int32(512) { + goto finished + } + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum = uint8(magic & libc.Uint32FromInt32(0x00000001)) + (*TWal)(unsafe.Pointer(pWal)).FszPage = uint32(szPage) + (*TWal)(unsafe.Pointer(pWal)).FnCkpt = _sqlite3Get4byte(tls, bp+8+12) + libc.Xmemcpy(tls, pWal+72+32, bp+8+16, uint64(8)) + /* Verify that the WAL header checksum is correct */ + _walChecksumBytes(tls, libc.BoolInt32(int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN), bp+8, libc.Int32FromInt32(WAL_HDRSIZE)-libc.Int32FromInt32(2)*libc.Int32FromInt32(4), uintptr(0), pWal+72+24) + if *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) != _sqlite3Get4byte(tls, bp+8+24) || *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) != _sqlite3Get4byte(tls, bp+8+28) { + goto finished + } + /* Verify that the version number on the WAL format is one that + ** are able to understand */ + version = _sqlite3Get4byte(tls, bp+8+4) + if version != uint32(WAL_MAX_VERSION) { + rc = _sqlite3CantopenError(tls, int32(66031)) + goto finished + } + /* Malloc a buffer to read frames into. */ + szFrame = szPage + int32(WAL_FRAME_HDRSIZE) + aFrame = Xsqlite3_malloc64(tls, uint64(szFrame)+(libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4))) + if !(aFrame != 0) { + rc = int32(SQLITE_NOMEM) + goto recovery_error + } + aData = aFrame + 24 + aPrivate = aData + uintptr(szPage) + /* Read all frames from the log file. */ + iLastFrame = uint32((*(*Ti64)(unsafe.Pointer(bp)) - int64(WAL_HDRSIZE)) / int64(szFrame)) + iPg = uint32(0) + for { + if !(iPg <= uint32(_walFramePage(tls, iLastFrame))) { + break + } + if uint64(iLastFrame) < libc.Uint64FromInt32(HASHTABLE_NPAGE)-(libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4)+uint64(iPg*uint32(HASHTABLE_NPAGE)) { + v2 = uint64(iLastFrame) + } else { + v2 = libc.Uint64FromInt32(HASHTABLE_NPAGE) - (libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4) + uint64(iPg*uint32(HASHTABLE_NPAGE)) + } /* Index of last frame read */ + iLast = uint32(v2) + if iPg == uint32(0) { + v3 = uint64(0) + } else { + v3 = libc.Uint64FromInt32(HASHTABLE_NPAGE) - (libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(40))/libc.Uint64FromInt64(4) + uint64((iPg-uint32(1))*uint32(HASHTABLE_NPAGE)) + } + iFirst = uint32(uint64(1) + v3) + rc = _walIndexPage(tls, pWal, int32(iPg), bp+40) + if *(*uintptr)(unsafe.Pointer(bp + 40)) == uintptr(0) { + break + } + *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = aPrivate + iFrame = iFirst + for { + if !(iFrame <= iLast) { + break + } + iOffset = libc.Int64FromInt32(WAL_HDRSIZE) + int64(iFrame-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) /* dbsize field from frame header */ + /* Read and decode the next log frame. */ + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, aFrame, szFrame, iOffset) + if rc != SQLITE_OK { + break + } + isValid = _walDecodeFrame(tls, pWal, bp+48, bp+52, aData, aFrame) + if !(isValid != 0) { + break + } + rc = _walIndexAppend(tls, pWal, iFrame, *(*Tu32)(unsafe.Pointer(bp + 48))) + if rc != SQLITE_OK { + break + } + /* If nTruncate is non-zero, this is a commit record. */ + if *(*Tu32)(unsafe.Pointer(bp + 52)) != 0 { + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = iFrame + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage = *(*Tu32)(unsafe.Pointer(bp + 52)) + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage = uint16(szPage&libc.Int32FromInt32(0xff00) | szPage>>libc.Int32FromInt32(16)) + aFrameCksum[0] = *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) + aFrameCksum[int32(1)] = *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) + } + goto _4 + _4: + ; + iFrame++ + } + *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 40)) + if iPg == uint32(0) { + v5 = libc.Uint64FromInt64(48)*libc.Uint64FromInt32(2) + libc.Uint64FromInt64(40) + } else { + v5 = uint64(0) + } + nHdr = uint32(v5) + nHdr32 = uint32(uint64(nHdr) / uint64(4)) + /* Memcpy() should work fine here, on all reasonable implementations. + ** Technically, memcpy() might change the destination to some + ** intermediate value before setting to the final value, and that might + ** cause a concurrent reader to malfunction. Memcpy() is allowed to + ** do that, according to the spec, but no memcpy() implementation that + ** we know of actually does that, which is why we say that memcpy() + ** is safe for this. Memcpy() is certainly a lot faster. + */ + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 40))+uintptr(nHdr32)*4, aPrivate+uintptr(nHdr32)*4, libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)-uint64(nHdr)) + if iFrame <= iLast { + break + } + goto _1 + _1: + ; + iPg++ + } + Xsqlite3_free(tls, aFrame) + } +finished: + ; + if rc == SQLITE_OK { + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aFrameCksum[0] + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aFrameCksum[int32(1)] + _walIndexWriteHdr(tls, pWal) + /* Reset the checkpoint-header. This is safe because this thread is + ** currently holding locks that exclude all other writers and + ** checkpointers. Then set the values of read-mark slots 1 through N. + */ + pInfo = _walCkptInfo(tls, pWal) + (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill = uint32(0) + (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + *(*Tu32)(unsafe.Pointer(pInfo + 4)) = uint32(0) + i = int32(1) + for { + if !(i < libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)) { + break + } + rc = _walLockExclusive(tls, pWal, int32(3)+i, int32(1)) + if rc == SQLITE_OK { + if i == int32(1) && (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 { + *(*Tu32)(unsafe.Pointer(pInfo + 4 + uintptr(i)*4)) = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + } else { + *(*Tu32)(unsafe.Pointer(pInfo + 4 + uintptr(i)*4)) = uint32(READMARK_NOT_USED) + } + _walUnlockExclusive(tls, pWal, int32(3)+i, int32(1)) + } else { + if rc != int32(SQLITE_BUSY) { + goto recovery_error + } + } + goto _6 + _6: + ; + i++ + } + /* If more than one frame was recovered from the log file, report an + ** event via sqlite3_log(). This is to help with identifying performance + ** problems caused by applications routinely shutting down without + ** checkpointing the log file. + */ + if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0 { + Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_NOTICE)|libc.Int32FromInt32(1)<= 0) { + break + } + pSegment = p + 8 + uintptr(i)*32 + for (*TWalSegment)(unsafe.Pointer(pSegment)).FiNext < (*TWalSegment)(unsafe.Pointer(pSegment)).FnEntry { + iPg = *(*Tu32)(unsafe.Pointer((*TWalSegment)(unsafe.Pointer(pSegment)).FaPgno + uintptr(*(*Tht_slot)(unsafe.Pointer((*TWalSegment)(unsafe.Pointer(pSegment)).FaIndex + uintptr((*TWalSegment)(unsafe.Pointer(pSegment)).FiNext)*2)))*4)) + if iPg > iMin { + if iPg < iRet { + iRet = iPg + *(*Tu32)(unsafe.Pointer(piFrame)) = uint32((*TWalSegment)(unsafe.Pointer(pSegment)).FiZero + int32(*(*Tht_slot)(unsafe.Pointer((*TWalSegment)(unsafe.Pointer(pSegment)).FaIndex + uintptr((*TWalSegment)(unsafe.Pointer(pSegment)).FiNext)*2)))) + } + break + } + (*TWalSegment)(unsafe.Pointer(pSegment)).FiNext++ + } + goto _1 + _1: + ; + i-- + } + v2 = iRet + (*TWalIterator)(unsafe.Pointer(p)).FiPrior = v2 + *(*Tu32)(unsafe.Pointer(piPage)) = v2 + return libc.BoolInt32(iRet == uint32(0xFFFFFFFF)) +} + +// C documentation +// +// /* +// ** This function merges two sorted lists into a single sorted list. +// ** +// ** aLeft[] and aRight[] are arrays of indices. The sort key is +// ** aContent[aLeft[]] and aContent[aRight[]]. Upon entry, the following +// ** is guaranteed for all J= nRight || *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) < *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aRight + uintptr(iRight)*2)))*4))) { + v1 = iLeft + iLeft++ + logpage = *(*Tht_slot)(unsafe.Pointer(aLeft + uintptr(v1)*2)) + } else { + v2 = iRight + iRight++ + logpage = *(*Tht_slot)(unsafe.Pointer(aRight + uintptr(v2)*2)) + } + dbpage = *(*Tu32)(unsafe.Pointer(aContent + uintptr(logpage)*4)) + v3 = iOut + iOut++ + *(*Tht_slot)(unsafe.Pointer(aTmp + uintptr(v3)*2)) = logpage + if iLeft < nLeft && *(*Tu32)(unsafe.Pointer(aContent + uintptr(*(*Tht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) == dbpage { + iLeft++ + } + } + *(*uintptr)(unsafe.Pointer(paRight)) = aLeft + *(*int32)(unsafe.Pointer(pnRight)) = iOut + libc.Xmemcpy(tls, aLeft, aTmp, uint64(2)*uint64(iOut)) +} + +// C documentation +// +// /* +// ** Sort the elements in list aList using aContent[] as the sort key. +// ** Remove elements with duplicate keys, preferring to keep the +// ** larger aList[] values. +// ** +// ** The aList[] entries are indices into aContent[]. The values in +// ** aList[] are to be sorted so that for all J0). + */ + iLast = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + /* Allocate space for the WalIterator object. */ + nSegment = _walFramePage(tls, iLast) + int32(1) + nByte = int64(uint64(40) + uint64(nSegment-libc.Int32FromInt32(1))*uint64(32) + uint64(iLast)*uint64(2)) + if iLast > uint32(HASHTABLE_NPAGE) { + v1 = uint32(HASHTABLE_NPAGE) + } else { + v1 = iLast + } + p = Xsqlite3_malloc64(tls, uint64(nByte)+uint64(2)*uint64(v1)) + if !(p != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, p, 0, uint64(nByte)) + (*TWalIterator)(unsafe.Pointer(p)).FnSegment = nSegment + aTmp = p + uintptr(nByte) + i = _walFramePage(tls, nBackfill+uint32(1)) + for { + if !(rc == SQLITE_OK && i < nSegment) { + break + } + rc = _walHashGet(tls, pWal, i, bp) + if rc == SQLITE_OK { /* Sorted index for this segment */ + if i+int32(1) == nSegment { + *(*int32)(unsafe.Pointer(bp + 24)) = int32(iLast - (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) + } else { + *(*int32)(unsafe.Pointer(bp + 24)) = int32((int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash) - int64((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno)) / 4) + } + aIndex = p + 8 + uintptr((*TWalIterator)(unsafe.Pointer(p)).FnSegment)*32 + uintptr((*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero)*2 + (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero++ + j = 0 + for { + if !(j < *(*int32)(unsafe.Pointer(bp + 24))) { + break + } + *(*Tht_slot)(unsafe.Pointer(aIndex + uintptr(j)*2)) = uint16(j) + goto _3 + _3: + ; + j++ + } + _walMergesort(tls, (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno, aTmp, aIndex, bp+24) + (*(*TWalSegment)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FiZero = int32((*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero) + (*(*TWalSegment)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FnEntry = *(*int32)(unsafe.Pointer(bp + 24)) + (*(*TWalSegment)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FaIndex = aIndex + (*(*TWalSegment)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FaPgno = (*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + } + goto _2 + _2: + ; + i++ + } + if rc != SQLITE_OK { + _walIteratorFree(tls, p) + p = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// C documentation +// +// /* +// ** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and +// ** n. If the attempt fails and parameter xBusy is not NULL, then it is a +// ** busy-handler function. Invoke it and retry the lock until either the +// ** lock is successfully obtained or the busy-handler returns 0. +// */ +func _walBusyLock(tls *libc.TLS, pWal uintptr, xBusy uintptr, pBusyArg uintptr, lockIdx int32, n int32) (r int32) { + var rc int32 + _ = rc + for cond := true; cond; cond = xBusy != 0 && rc == int32(SQLITE_BUSY) && (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xBusy})))(tls, pBusyArg) != 0 { + rc = _walLockExclusive(tls, pWal, lockIdx, n) + } + return rc +} + +// C documentation +// +// /* +// ** The cache of the wal-index header must be valid to call this function. +// ** Return the page-size in bytes used by the database. +// */ +func _walPagesize(tls *libc.TLS, pWal uintptr) (r int32) { + return int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage)&int32(0xfe00) + int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage)&int32(0x0001)< y { + rc = _walBusyLock(tls, pWal, xBusy, pBusyArg, int32(3)+i, int32(1)) + if rc == SQLITE_OK { + if i == int32(1) { + v2 = mxSafeFrame + } else { + v2 = uint32(READMARK_NOT_USED) + } + iMark = v2 + libc.AtomicStoreNUint32(pInfo+4+uintptr(i)*4, iMark, libc.Int32FromInt32(__ATOMIC_RELAXED)) + _walUnlockExclusive(tls, pWal, int32(3)+i, int32(1)) + } else { + if rc == int32(SQLITE_BUSY) { + mxSafeFrame = y + xBusy = uintptr(0) + } else { + goto walcheckpoint_out + } + } + } + goto _1 + _1: + ; + i++ + } + /* Allocate the iterator */ + if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill < mxSafeFrame { + rc = _walIteratorInit(tls, pWal, (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill, bp) + } + if v4 = *(*uintptr)(unsafe.Pointer(bp)) != 0; v4 { + v3 = _walBusyLock(tls, pWal, xBusy, pBusyArg, libc.Int32FromInt32(3)+libc.Int32FromInt32(0), int32(1)) + rc = v3 + } + if v4 && v3 == SQLITE_OK { + nBackfill = (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill + (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted = mxSafeFrame + /* Sync the WAL to disk */ + rc = _sqlite3OsSync(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, sync_flags>>int32(2)&int32(0x03)) + /* If the database may grow as a result of this checkpoint, hint + ** about the eventual size of the db file to the VFS layer. + */ + if rc == SQLITE_OK { + *(*Ti64)(unsafe.Pointer(bp + 16)) = int64(mxPage) * int64(szPage) /* Current size of database file */ + _sqlite3OsFileControl(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_FCNTL_CKPT_START), uintptr(0)) + rc = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, bp+24) + if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp + 24)) < *(*Ti64)(unsafe.Pointer(bp + 16)) { + if *(*Ti64)(unsafe.Pointer(bp + 24))+int64(65536)+int64((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame)*int64(szPage) < *(*Ti64)(unsafe.Pointer(bp + 16)) { + /* If the size of the final database is larger than the current + ** database plus the amount of data in the wal file, plus the + ** maximum size of the pending-byte page (65536 bytes), then + ** must be corruption somewhere. */ + rc = _sqlite3CorruptError(tls, int32(66841)) + } else { + _sqlite3OsFileControlHint(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_FCNTL_SIZE_HINT), bp+16) + } + } + } + /* Iterate through the contents of the WAL, copying data to the db file */ + for rc == SQLITE_OK && 0 == _walIteratorNext(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+8, bp+12) { + if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + v5 = int32(SQLITE_NOMEM) + } else { + v5 = int32(SQLITE_INTERRUPT) + } + rc = v5 + break + } + if *(*Tu32)(unsafe.Pointer(bp + 12)) <= nBackfill || *(*Tu32)(unsafe.Pointer(bp + 12)) > mxSafeFrame || *(*Tu32)(unsafe.Pointer(bp + 8)) > mxPage { + continue + } + iOffset = int64(WAL_HDRSIZE) + int64(*(*Tu32)(unsafe.Pointer(bp + 12))-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + int64(WAL_FRAME_HDRSIZE) + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, zBuf, szPage, iOffset) + if rc != SQLITE_OK { + break + } + iOffset = int64(*(*Tu32)(unsafe.Pointer(bp + 8))-libc.Uint32FromInt32(1)) * int64(szPage) + rc = _sqlite3OsWrite(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, zBuf, szPage, iOffset) + if rc != SQLITE_OK { + break + } + } + _sqlite3OsFileControl(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_FCNTL_CKPT_DONE), uintptr(0)) + /* If work was actually accomplished... */ + if rc == SQLITE_OK { + if mxSafeFrame == (*TWalIndexHdr)(unsafe.Pointer(_walIndexHdr(tls, pWal))).FmxFrame { + szDb = int64((*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage) * int64(szPage) + rc = _sqlite3OsTruncate(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, szDb) + if rc == SQLITE_OK { + rc = _sqlite3OsSync(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, sync_flags>>int32(2)&int32(0x03)) + } + } + if rc == SQLITE_OK { + libc.AtomicStoreNUint32(pInfo, mxSafeFrame, libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + } + /* Release the reader lock held while backfilling */ + _walUnlockExclusive(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(0), int32(1)) + } + if rc == int32(SQLITE_BUSY) { + /* Reset the return code so as not to report a checkpoint failure + ** just because there are active readers. */ + rc = SQLITE_OK + } + } + /* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the + ** entire wal file has been copied into the database file, then block + ** until all readers have finished using the wal file. This ensures that + ** the next process to write to the database restarts the wal file. + */ + if rc == SQLITE_OK && eMode != SQLITE_CHECKPOINT_PASSIVE { + if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill < (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame { + rc = int32(SQLITE_BUSY) + } else { + if eMode >= int32(SQLITE_CHECKPOINT_RESTART) { + Xsqlite3_randomness(tls, int32(4), bp+32) + rc = _walBusyLock(tls, pWal, xBusy, pBusyArg, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) + if rc == SQLITE_OK { + if eMode == int32(SQLITE_CHECKPOINT_TRUNCATE) { + /* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as + ** SQLITE_CHECKPOINT_RESTART with the addition that it also + ** truncates the log file to zero bytes just prior to a + ** successful return. + ** + ** In theory, it might be safe to do this without updating the + ** wal-index header in shared memory, as all subsequent reader or + ** writer clients should see that the entire log file has been + ** checkpointed and behave accordingly. This seems unsafe though, + ** as it would leave the system in a state where the contents of + ** the wal-index header do not match the contents of the + ** file-system. To avoid this, update the wal-index header to + ** indicate that the log file contains zero valid frames. */ + _walRestartHdr(tls, pWal, *(*Tu32)(unsafe.Pointer(bp + 32))) + rc = _sqlite3OsTruncate(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, 0) + } + _walUnlockExclusive(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) + } + } + } + } +walcheckpoint_out: + ; + _walIteratorFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** If the WAL file is currently larger than nMax bytes in size, truncate +// ** it to exactly nMax bytes. If an error occurs while doing so, ignore it. +// */ +func _walLimitSize(tls *libc.TLS, pWal uintptr, nMax Ti64) { + bp := tls.Alloc(32) + defer tls.Free(32) + var rx int32 + var _ /* sz at bp+0 */ Ti64 + _ = rx + _sqlite3BeginBenignMalloc(tls) + rx = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp) + if rx == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp)) > nMax { + rx = _sqlite3OsTruncate(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, nMax) + } + _sqlite3EndBenignMalloc(tls) + if rx != 0 { + Xsqlite3_log(tls, rx, __ccgo_ts+4196, libc.VaList(bp+16, (*TWal)(unsafe.Pointer(pWal)).FzWalName)) + } +} + +// C documentation +// +// /* +// ** Close a connection to a log file. +// */ +func _sqlite3WalClose(tls *libc.TLS, pWal uintptr, db uintptr, sync_flags int32, nBuf int32, zBuf uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var isDelete, rc, v1 int32 + var v2 bool + var _ /* bPersist at bp+0 */ int32 + _, _, _, _ = isDelete, rc, v1, v2 + rc = SQLITE_OK + if pWal != 0 { + isDelete = 0 /* True to unlink wal and wal-index files */ + /* If an EXCLUSIVE lock can be obtained on the database file (using the + ** ordinary, rollback-mode locking methods, this guarantees that the + ** connection associated with this log file is the only connection to + ** the database. In this case checkpoint the database and unlink both + ** the wal and wal-index files. + ** + ** The EXCLUSIVE lock is not released before returning. + */ + if v2 = zBuf != uintptr(0); v2 { + v1 = _sqlite3OsLock(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_LOCK_EXCLUSIVE)) + rc = v1 + } + if v2 && SQLITE_OK == v1 { + if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE { + (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_EXCLUSIVE_MODE) + } + rc = _sqlite3WalCheckpoint(tls, pWal, db, SQLITE_CHECKPOINT_PASSIVE, uintptr(0), uintptr(0), sync_flags, nBuf, zBuf, uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = -int32(1) + _sqlite3OsFileControlHint(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, int32(SQLITE_FCNTL_PERSIST_WAL), bp) + if *(*int32)(unsafe.Pointer(bp)) != int32(1) { + /* Try to delete the WAL file if the checkpoint completed and + ** fsynced (rc==SQLITE_OK) and if we are not in persistent-wal + ** mode (!bPersist) */ + isDelete = int32(1) + } else { + if (*TWal)(unsafe.Pointer(pWal)).FmxWalSize >= 0 { + /* Try to truncate the WAL file to zero bytes if the checkpoint + ** completed and fsynced (rc==SQLITE_OK) and we are in persistent + ** WAL mode (bPersist) and if the PRAGMA journal_size_limit is a + ** non-negative value (pWal->mxWalSize>=0). Note that we truncate + ** to zero bytes as truncating to the journal_size_limit might + ** leave a corrupt WAL file on disk. */ + _walLimitSize(tls, pWal, 0) + } + } + } + } + _walIndexClose(tls, pWal, isDelete) + _sqlite3OsClose(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd) + if isDelete != 0 { + _sqlite3BeginBenignMalloc(tls) + _sqlite3OsDelete(tls, (*TWal)(unsafe.Pointer(pWal)).FpVfs, (*TWal)(unsafe.Pointer(pWal)).FzWalName, 0) + _sqlite3EndBenignMalloc(tls) + } + Xsqlite3_free(tls, (*TWal)(unsafe.Pointer(pWal)).FapWiData) + Xsqlite3_free(tls, pWal) + } + return rc +} + +// C documentation +// +// /* +// ** Try to read the wal-index header. Return 0 on success and 1 if +// ** there is a problem. +// ** +// ** The wal-index is in shared memory. Another thread or process might +// ** be writing the header at the same time this procedure is trying to +// ** read it, which might result in inconsistency. A dirty read is detected +// ** by verifying that both copies of the header are the same and also by +// ** a checksum on the header. +// ** +// ** If and only if the read is consistent and the header is different from +// ** pWal->hdr, then pWal->hdr is updated to the content of the new header +// ** and *pChanged is set to 1. +// ** +// ** If the checksum cannot be verified return non-zero. If the header +// ** is read successfully and the checksum verified, return zero. +// */ +func _walIndexTryHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var aHdr uintptr + var _ /* aCksum at bp+0 */ [2]Tu32 + var _ /* h1 at bp+8 */ TWalIndexHdr + var _ /* h2 at bp+56 */ TWalIndexHdr + _ = aHdr /* Header in shared memory */ + /* The first page of the wal-index must be mapped at this point. */ + /* Read the header. This might happen concurrently with a write to the + ** same area of shared memory on a different CPU in a SMP, + ** meaning it is possible that an inconsistent snapshot is read + ** from the file. If this happens, return non-zero. + ** + ** tag-20200519-1: + ** There are two copies of the header at the beginning of the wal-index. + ** When reading, read [0] first then [1]. Writes are in the reverse order. + ** Memory barriers are used to prevent the compiler or the hardware from + ** reordering the reads and writes. TSAN and similar tools can sometimes + ** give false-positive warnings about these accesses because the tools do not + ** account for the double-read and the memory barrier. The use of mutexes + ** here would be problematic as the memory being accessed is potentially + ** shared among multiple processes and not all mutex implementations work + ** reliably in that environment. + */ + aHdr = _walIndexHdr(tls, pWal) + libc.Xmemcpy(tls, bp+8, aHdr, uint64(48)) /* Possible TSAN false-positive */ + _walShmBarrier(tls, pWal) + libc.Xmemcpy(tls, bp+56, aHdr+1*48, uint64(48)) + if libc.Xmemcmp(tls, bp+8, bp+56, uint64(48)) != 0 { + return int32(1) /* Dirty read */ + } + if int32((*(*TWalIndexHdr)(unsafe.Pointer(bp + 8))).FisInit) == 0 { + return int32(1) /* Malformed header - probably all zeros */ + } + _walChecksumBytes(tls, int32(1), bp+8, int32(libc.Uint64FromInt64(48)-libc.Uint64FromInt64(8)), uintptr(0), bp) + if (*(*[2]Tu32)(unsafe.Pointer(bp)))[0] != *(*Tu32)(unsafe.Pointer(bp + 8 + 40)) || (*(*[2]Tu32)(unsafe.Pointer(bp)))[int32(1)] != *(*Tu32)(unsafe.Pointer(bp + 8 + 40 + 1*4)) { + return int32(1) /* Checksum does not match */ + } + if libc.Xmemcmp(tls, pWal+72, bp+8, uint64(48)) != 0 { + *(*int32)(unsafe.Pointer(pChanged)) = int32(1) + libc.Xmemcpy(tls, pWal+72, bp+8, uint64(48)) + (*TWal)(unsafe.Pointer(pWal)).FszPage = uint32(int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage)&int32(0xfe00) + int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage)&int32(0x0001)<hdr. +// ** If the wal-header appears to be corrupt, try to reconstruct the +// ** wal-index from the WAL before returning. +// ** +// ** Set *pChanged to 1 if the wal-index header value in pWal->hdr is +// ** changed by this operation. If pWal->hdr is unchanged, set *pChanged +// ** to 0. +// ** +// ** If the wal-index header is successfully read, return SQLITE_OK. +// ** Otherwise an SQLite error code. +// */ +func _walIndexReadHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bWriteLock, badHdr, rc, v1, v2, v3, v5 int32 + var v4 bool + var _ /* page0 at bp+0 */ uintptr + _, _, _, _, _, _, _, _ = bWriteLock, badHdr, rc, v1, v2, v3, v4, v5 /* Chunk of wal-index containing header */ + /* Ensure that page 0 of the wal-index (the page that contains the + ** wal-index header) is mapped. Return early if an error occurs here. + */ + rc = _walIndexPage(tls, pWal, 0, bp) + if rc != SQLITE_OK { + /* READONLY changed to OK in walIndexPage */ + if rc == libc.Int32FromInt32(SQLITE_READONLY)|libc.Int32FromInt32(5)<writeLock + ** is zero, which prevents the SHM from growing */ + } + /* If the first page of the wal-index has been mapped, try to read the + ** wal-index header immediately, without holding any lock. This usually + ** works, but may fail if the wal-index header is corrupt or currently + ** being modified by another thread or process. + */ + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v1 = _walIndexTryHdr(tls, pWal, pChanged) + } else { + v1 = int32(1) + } + badHdr = v1 + /* If the first attempt failed, it might have been due to a race + ** with a writer. So get a WRITE lock and try again. + */ + if badHdr != 0 { + if int32((*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0 && int32((*TWal)(unsafe.Pointer(pWal)).FreadOnly)&int32(WAL_SHM_RDONLY) != 0 { + v2 = _walLockShared(tls, pWal, WAL_WRITE_LOCK) + rc = v2 + if SQLITE_OK == v2 { + _walUnlockShared(tls, pWal, WAL_WRITE_LOCK) + rc = libc.Int32FromInt32(SQLITE_READONLY) | libc.Int32FromInt32(1)<apWiData[] using heap memory instead of shared +// ** memory. +// ** +// ** If this function returns SQLITE_OK, then the read transaction has +// ** been successfully opened. In this case output variable (*pChanged) +// ** is set to true before returning if the caller should discard the +// ** contents of the page cache before proceeding. Or, if it returns +// ** WAL_RETRY, then the heap memory wal-index has been discarded and +// ** the caller should retry opening the read transaction from the +// ** beginning (including attempting to map the *-shm file). +// ** +// ** If an error occurs, an SQLite error code is returned. +// */ +func _walBeginShmUnreliable(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var aData, aFrame uintptr + var aSaveCksum [2]Tu32 + var i, rc, szFrame, v1, v2 int32 + var iOffset Ti64 + var _ /* aBuf at bp+8 */ [32]Tu8 + var _ /* nTruncate at bp+52 */ Tu32 + var _ /* pDummy at bp+40 */ uintptr + var _ /* pgno at bp+48 */ Tu32 + var _ /* szWal at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _ = aData, aFrame, aSaveCksum, i, iOffset, rc, szFrame, v1, v2 /* Buffer to load WAL header into */ + aFrame = uintptr(0) /* Saved copy of pWal->hdr.aFrameCksum */ + /* Take WAL_READ_LOCK(0). This has the effect of preventing any + ** writers from running a checkpoint, but does not stop them + ** from running recovery. */ + rc = _walLockShared(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(0)) + if rc != SQLITE_OK { + if rc == int32(SQLITE_BUSY) { + rc = -int32(1) + } + goto begin_unreliable_shm_out + } + (*TWal)(unsafe.Pointer(pWal)).FreadLock = 0 + /* Check to see if a separate writer has attached to the shared-memory area, + ** thus making the shared-memory "reliable" again. Do this by invoking + ** the xShmMap() routine of the VFS and looking to see if the return + ** is SQLITE_READONLY instead of SQLITE_READONLY_CANTINIT. + ** + ** If the shared-memory is now "reliable" return WAL_RETRY, which will + ** cause the heap-memory WAL-index to be discarded and the actual + ** shared memory to be used in its place. + ** + ** This step is important because, even though this connection is holding + ** the WAL_READ_LOCK(0) which prevents a checkpoint, a writer might + ** have already checkpointed the WAL file and, while the current + ** is active, wrap the WAL and start overwriting frames that this + ** process wants to use. + ** + ** Once sqlite3OsShmMap() has been called for an sqlite3_file and has + ** returned any SQLITE_READONLY value, it must return only SQLITE_READONLY + ** or SQLITE_READONLY_CANTINIT or some error for all subsequent invocations, + ** even if some external agent does a "chmod" to make the shared-memory + ** writable by us, until sqlite3OsShmUnmap() has been called. + ** This is a requirement on the VFS implementation. + */ + rc = _sqlite3OsShmMap(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, 0, int32(libc.Uint64FromInt64(2)*uint64(libc.Int32FromInt32(HASHTABLE_NPAGE)*libc.Int32FromInt32(2))+libc.Uint64FromInt32(HASHTABLE_NPAGE)*libc.Uint64FromInt64(4)), 0, bp+40) + /* SQLITE_OK not possible for read-only connection */ + if rc != libc.Int32FromInt32(SQLITE_READONLY)|libc.Int32FromInt32(5)<hdr. + */ + libc.Xmemcpy(tls, pWal+72, _walIndexHdr(tls, pWal), uint64(48)) + /* Make sure some writer hasn't come in and changed the WAL file out + ** from under us, then disconnected, while we were not looking. + */ + rc = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp) + if rc != SQLITE_OK { + goto begin_unreliable_shm_out + } + if *(*Ti64)(unsafe.Pointer(bp)) < int64(WAL_HDRSIZE) { + /* If the wal file is too small to contain a wal-header and the + ** wal-index header has mxFrame==0, then it must be safe to proceed + ** reading the database file only. However, the page cache cannot + ** be trusted, as a read/write connection may have connected, written + ** the db, run a checkpoint, truncated the wal file and disconnected + ** since this client's last read transaction. */ + *(*int32)(unsafe.Pointer(pChanged)) = int32(1) + if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == uint32(0) { + v2 = SQLITE_OK + } else { + v2 = -int32(1) + } + rc = v2 + goto begin_unreliable_shm_out + } + /* Check the salt keys at the start of the wal file still match. */ + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp+8, int32(WAL_HDRSIZE), 0) + if rc != SQLITE_OK { + goto begin_unreliable_shm_out + } + if libc.Xmemcmp(tls, pWal+72+32, bp+8+16, uint64(8)) != 0 { + /* Some writer has wrapped the WAL file while we were not looking. + ** Return WAL_RETRY which will cause the in-memory WAL-index to be + ** rebuilt. */ + rc = -int32(1) + goto begin_unreliable_shm_out + } + /* Allocate a buffer to read frames into */ + szFrame = int32((*TWal)(unsafe.Pointer(pWal)).FszPage + uint32(WAL_FRAME_HDRSIZE)) + aFrame = Xsqlite3_malloc64(tls, uint64(szFrame)) + if aFrame == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto begin_unreliable_shm_out + } + aData = aFrame + 24 + /* Check to see if a complete transaction has been appended to the + ** wal file since the heap-memory wal-index was created. If so, the + ** heap-memory wal-index is discarded and WAL_RETRY returned to + ** the caller. */ + aSaveCksum[0] = *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) + aSaveCksum[int32(1)] = *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) + iOffset = libc.Int64FromInt32(WAL_HDRSIZE) + int64((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame+libc.Uint32FromInt32(1)-libc.Uint32FromInt32(1))*int64((*TWal)(unsafe.Pointer(pWal)).FszPage+libc.Uint32FromInt32(WAL_FRAME_HDRSIZE)) + for { + if !(iOffset+int64(szFrame) <= *(*Ti64)(unsafe.Pointer(bp))) { + break + } /* dbsize field from frame header */ + /* Read and decode the next log frame. */ + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, aFrame, szFrame, iOffset) + if rc != SQLITE_OK { + break + } + if !(_walDecodeFrame(tls, pWal, bp+48, bp+52, aData, aFrame) != 0) { + break + } + /* If nTruncate is non-zero, then a complete transaction has been + ** appended to this wal file. Set rc to WAL_RETRY and break out of + ** the loop. */ + if *(*Tu32)(unsafe.Pointer(bp + 52)) != 0 { + rc = -int32(1) + break + } + goto _3 + _3: + ; + iOffset += int64(szFrame) + } + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = aSaveCksum[0] + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = aSaveCksum[int32(1)] +begin_unreliable_shm_out: + ; + Xsqlite3_free(tls, aFrame) + if rc != SQLITE_OK { + i = 0 + for { + if !(i < (*TWal)(unsafe.Pointer(pWal)).FnWiData) { + break + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8)) = uintptr(0) + goto _4 + _4: + ; + i++ + } + (*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable = uint8(0) + _sqlite3WalEndReadTransaction(tls, pWal) + *(*int32)(unsafe.Pointer(pChanged)) = int32(1) + } + return rc +} + +/* +** The final argument passed to walTryBeginRead() is of type (int*). The +** caller should invoke walTryBeginRead as follows: +** +** int cnt = 0; +** do { +** rc = walTryBeginRead(..., &cnt); +** }while( rc==WAL_RETRY ); +** +** The final value of "cnt" is of no use to the caller. It is used by +** the implementation of walTryBeginRead() as follows: +** +** + Each time walTryBeginRead() is called, it is incremented. Once +** it reaches WAL_RETRY_PROTOCOL_LIMIT - indicating that walTryBeginRead() +** has many times been invoked and failed with WAL_RETRY - walTryBeginRead() +** returns SQLITE_PROTOCOL. +** +** + If SQLITE_ENABLE_SETLK_TIMEOUT is defined and walTryBeginRead() failed +** because a blocking lock timed out (SQLITE_BUSY_TIMEOUT from the OS +** layer), the WAL_RETRY_BLOCKED_MASK bit is set in "cnt". In this case +** the next invocation of walTryBeginRead() may omit an expected call to +** sqlite3OsSleep(). There has already been a delay when the previous call +** waited on a lock. + */ + +// C documentation +// +// /* +// ** Attempt to start a read transaction. This might fail due to a race or +// ** other transient condition. When that happens, it returns WAL_RETRY to +// ** indicate to the caller that it is safe to retry immediately. +// ** +// ** On success return SQLITE_OK. On a permanent failure (such an +// ** I/O error or an SQLITE_BUSY because another process is running +// ** recovery) return a positive error code. +// ** +// ** The useWal parameter is true to force the use of the WAL and disable +// ** the case where the WAL is bypassed because it has been completely +// ** checkpointed. If useWal==0 then this routine calls walIndexReadHdr() +// ** to make a copy of the wal-index header into pWal->hdr. If the +// ** wal-index header has changed, *pChanged is set to 1 (as an indication +// ** to the caller that the local page cache is obsolete and needs to be +// ** flushed.) When useWal==1, the wal-index header is assumed to already +// ** be loaded and the pChanged parameter is unused. +// ** +// ** The caller must set the cnt parameter to the number of prior calls to +// ** this routine during the current read attempt that returned WAL_RETRY. +// ** This routine will start taking more aggressive measures to clear the +// ** race conditions after multiple WAL_RETRY returns, and after an excessive +// ** number of errors will ultimately return SQLITE_PROTOCOL. The +// ** SQLITE_PROTOCOL return indicates that some other process has gone rogue +// ** and is not honoring the locking protocol. There is a vanishingly small +// ** chance that SQLITE_PROTOCOL could be returned because of a run of really +// ** bad luck when there is lots of contention for the wal-index, but that +// ** possibility is so small that it can be safely neglected, we believe. +// ** +// ** On success, this routine obtains a read lock on +// ** WAL_READ_LOCK(pWal->readLock). The pWal->readLock integer is +// ** in the range 0 <= pWal->readLock < WAL_NREADER. If pWal->readLock==(-1) +// ** that means the Wal does not hold any read lock. The reader must not +// ** access any database page that is modified by a WAL frame up to and +// ** including frame number aReadMark[pWal->readLock]. The reader will +// ** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0 +// ** Or if pWal->readLock==0, then the reader will ignore the WAL +// ** completely and get all content directly from the database file. +// ** If the useWal parameter is 1 then the WAL will never be ignored and +// ** this routine will always set pWal->readLock>0 on success. +// ** When the read transaction is completed, the caller must release the +// ** lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1. +// ** +// ** This routine uses the nBackfill and aReadMark[] fields of the header +// ** to select a particular WAL_READ_LOCK() that strives to let the +// ** checkpoint process do as much work as possible. This routine might +// ** update values of the aReadMark[] array in the header, but if it does +// ** so it takes care to hold an exclusive lock on the corresponding +// ** WAL_READ_LOCK() while changing values. +// */ +func _walTryBeginRead(tls *libc.TLS, pWal uintptr, pChanged uintptr, useWal int32, pCnt uintptr) (r int32) { + var cnt, i, mxI, nDelay, rc, v1, v4, v5 int32 + var mxFrame, mxReadMark, thisMark Tu32 + var pInfo uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = cnt, i, mxFrame, mxI, mxReadMark, nDelay, pInfo, rc, thisMark, v1, v4, v5 /* Loop counter */ + rc = SQLITE_OK /* Wal frame to lock to */ + /* Not currently locked */ + /* useWal may only be set for read/write connections */ + /* Take steps to avoid spinning forever if there is a protocol error. + ** + ** Circumstances that cause a RETRY should only last for the briefest + ** instances of time. No I/O or other system calls are done while the + ** locks are held, so the locks should not be held for very long. But + ** if we are unlucky, another process that is holding a lock might get + ** paged out or take a page-fault that is time-consuming to resolve, + ** during the few nanoseconds that it is holding the lock. In that case, + ** it might take longer than normal for the lock to free. + ** + ** After 5 RETRYs, we begin calling sqlite3OsSleep(). The first few + ** calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this + ** is more of a scheduler yield than an actual delay. But on the 10th + ** an subsequent retries, the delays start becoming longer and longer, + ** so that on the 100th (and last) RETRY we delay for 323 milliseconds. + ** The total delay time before giving up is less than 10 seconds. + */ + *(*int32)(unsafe.Pointer(pCnt))++ + if *(*int32)(unsafe.Pointer(pCnt)) > int32(5) { + nDelay = int32(1) /* Pause time in microseconds */ + cnt = *(*int32)(unsafe.Pointer(pCnt)) & ^libc.Int32FromInt32(WAL_RETRY_BLOCKED_MASK) + if cnt > int32(WAL_RETRY_PROTOCOL_LIMIT) { + return int32(SQLITE_PROTOCOL) + } + if *(*int32)(unsafe.Pointer(pCnt)) >= int32(10) { + nDelay = (cnt - int32(9)) * (cnt - int32(9)) * int32(39) + } + _sqlite3OsSleep(tls, (*TWal)(unsafe.Pointer(pWal)).FpVfs, nDelay) + *(*int32)(unsafe.Pointer(pCnt)) &= ^libc.Int32FromInt32(WAL_RETRY_BLOCKED_MASK) + } + if !(useWal != 0) { + if int32((*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0 { + rc = _walIndexReadHdr(tls, pWal, pChanged) + } + if rc == int32(SQLITE_BUSY) { + /* If there is not a recovery running in another thread or process + ** then convert BUSY errors to WAL_RETRY. If recovery is known to + ** be running, convert BUSY to BUSY_RECOVERY. There is a race here + ** which might cause WAL_RETRY to be returned even if BUSY_RECOVERY + ** would be technically correct. But the race is benign since with + ** WAL_RETRY this routine will be called again and will probably be + ** right on the second iteration. + */ + if *(*uintptr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FapWiData)) == uintptr(0) { + /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. + ** We assume this is a transient condition, so return WAL_RETRY. The + ** xShmMap() implementation used by the default unix and win32 VFS + ** modules may return SQLITE_BUSY due to a race condition in the + ** code that determines whether or not the shared-memory region + ** must be zeroed before the requested page is returned. + */ + rc = -int32(1) + } else { + v1 = _walLockShared(tls, pWal, int32(WAL_RECOVER_LOCK)) + rc = v1 + if SQLITE_OK == v1 { + _walUnlockShared(tls, pWal, int32(WAL_RECOVER_LOCK)) + rc = -int32(1) + } else { + if rc == int32(SQLITE_BUSY) { + rc = libc.Int32FromInt32(SQLITE_BUSY) | libc.Int32FromInt32(1)<hdr.mxFrame and lock that entry. + */ + mxReadMark = uint32(0) + mxI = 0 + mxFrame = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + if (*TWal)(unsafe.Pointer(pWal)).FpSnapshot != 0 && (*TWalIndexHdr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FpSnapshot)).FmxFrame < mxFrame { + mxFrame = (*TWalIndexHdr)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FpSnapshot)).FmxFrame + } + i = int32(1) + for { + if !(i < libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)) { + break + } + thisMark = libc.AtomicLoadNUint32(pInfo+4+uintptr(i)*4, libc.Int32FromInt32(__ATOMIC_RELAXED)) + if mxReadMark <= thisMark && thisMark <= mxFrame { + mxReadMark = thisMark + mxI = i + } + goto _2 + _2: + ; + i++ + } + if int32((*TWal)(unsafe.Pointer(pWal)).FreadOnly)&int32(WAL_SHM_RDONLY) == 0 && (mxReadMark < mxFrame || mxI == 0) { + i = int32(1) + for { + if !(i < libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)) { + break + } + rc = _walLockExclusive(tls, pWal, int32(3)+i, int32(1)) + if rc == SQLITE_OK { + libc.AtomicStoreNUint32(pInfo+4+uintptr(i)*4, mxFrame, libc.Int32FromInt32(__ATOMIC_RELAXED)) + mxReadMark = mxFrame + mxI = i + _walUnlockExclusive(tls, pWal, int32(3)+i, int32(1)) + break + } else { + if rc != int32(SQLITE_BUSY) { + return rc + } + } + goto _3 + _3: + ; + i++ + } + } + if mxI == 0 { + if rc == int32(SQLITE_BUSY) { + v4 = -int32(1) + } else { + v4 = libc.Int32FromInt32(SQLITE_READONLY) | libc.Int32FromInt32(5)<hdr.mxFrame may have been + ** copied into the database by a checkpointer. If either of these things + ** happened, then reading the database with the current value of + ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry + ** instead. + ** + ** Before checking that the live wal-index header has not changed + ** since it was read, set Wal.minFrame to the first frame in the wal + ** file that has not yet been checkpointed. This client will not need + ** to read any frames earlier than minFrame from the wal file - they + ** can be safely read directly from the database file. + ** + ** Because a ShmBarrier() call is made between taking the copy of + ** nBackfill and checking that the wal-header in shared-memory still + ** matches the one cached in pWal->hdr, it is guaranteed that the + ** checkpointer that set nBackfill was not working with a wal-index + ** header newer than that cached in pWal->hdr. If it were, that could + ** cause a problem. The checkpointer could omit to checkpoint + ** a version of page X that lies before pWal->minFrame (call that version + ** A) on the basis that there is a newer version (version B) of the same + ** page later in the wal file. But if version B happens to like past + ** frame pWal->hdr.mxFrame - then the client would incorrectly assume + ** that it can read version A from the database file. However, since + ** we can guarantee that the checkpointer that set nBackfill could not + ** see any pages past pWal->hdr.mxFrame, this problem does not come up. + */ + (*TWal)(unsafe.Pointer(pWal)).FminFrame = uint32(int32(libc.AtomicLoadNUint32(pInfo, libc.Int32FromInt32(__ATOMIC_RELAXED))) + int32(1)) + _walShmBarrier(tls, pWal) + if libc.AtomicLoadNUint32(pInfo+4+uintptr(mxI)*4, libc.Int32FromInt32(__ATOMIC_RELAXED)) != mxReadMark || libc.Xmemcmp(tls, _walIndexHdr(tls, pWal), pWal+72, uint64(48)) != 0 { + _walUnlockShared(tls, pWal, int32(3)+mxI) + return -int32(1) + } else { + (*TWal)(unsafe.Pointer(pWal)).FreadLock = int16(mxI) + } + return rc +} + +// C documentation +// +// /* +// ** This function does the work of sqlite3WalSnapshotRecover(). +// */ +func _walSnapshotRecover(tls *libc.TLS, pWal uintptr, pBuf1 uintptr, pBuf2 uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, pgno Tu32 + var iDbOff, iWalOff Ti64 + var pInfo uintptr + var rc, szPage int32 + var _ /* sLoc at bp+8 */ TWalHashLoc + var _ /* szDb at bp+0 */ Ti64 + _, _, _, _, _, _, _ = i, iDbOff, iWalOff, pInfo, pgno, rc, szPage + szPage = int32((*TWal)(unsafe.Pointer(pWal)).FszPage) /* Size of db file in bytes */ + rc = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, bp) + if rc == SQLITE_OK { + pInfo = _walCkptInfo(tls, pWal) + i = (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted + i = (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted + for { + if !(i > libc.AtomicLoadNUint32(pInfo, libc.Int32FromInt32(__ATOMIC_RELAXED))) { + break + } /* Offset of wal file entry */ + rc = _walHashGet(tls, pWal, _walFramePage(tls, i), bp+8) + if rc != SQLITE_OK { + break + } + pgno = *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp + 8))).FaPgno + uintptr(i-(*(*TWalHashLoc)(unsafe.Pointer(bp + 8))).FiZero-uint32(1))*4)) + iDbOff = int64(pgno-libc.Uint32FromInt32(1)) * int64(szPage) + if iDbOff+int64(szPage) <= *(*Ti64)(unsafe.Pointer(bp)) { + iWalOff = int64(WAL_HDRSIZE) + int64(i-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + int64(WAL_FRAME_HDRSIZE) + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, pBuf1, szPage, iWalOff) + if rc == SQLITE_OK { + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, pBuf2, szPage, iDbOff) + } + if rc != SQLITE_OK || 0 == libc.Xmemcmp(tls, pBuf1, pBuf2, uint64(szPage)) { + break + } + } + (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted = i - uint32(1) + goto _1 + _1: + ; + i-- + } + } + return rc +} + +// C documentation +// +// /* +// ** Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted +// ** variable so that older snapshots can be accessed. To do this, loop +// ** through all wal frames from nBackfillAttempted to (nBackfill+1), +// ** comparing their content to the corresponding page with the database +// ** file, if any. Set nBackfillAttempted to the frame number of the +// ** first frame for which the wal file content matches the db file. +// ** +// ** This is only really safe if the file-system is such that any page +// ** writes made by earlier checkpointers were atomic operations, which +// ** is not always true. It is also possible that nBackfillAttempted +// ** may be left set to a value larger than expected, if a wal frame +// ** contains content that duplicate of an earlier version of the same +// ** page. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code if an +// ** error occurs. It is not an error if nBackfillAttempted cannot be +// ** decreased at all. +// */ +func _sqlite3WalSnapshotRecover(tls *libc.TLS, pWal uintptr) (r int32) { + var pBuf1, pBuf2 uintptr + var rc int32 + _, _, _ = pBuf1, pBuf2, rc + rc = _walLockExclusive(tls, pWal, int32(WAL_CKPT_LOCK), int32(1)) + if rc == SQLITE_OK { + pBuf1 = Xsqlite3_malloc(tls, int32((*TWal)(unsafe.Pointer(pWal)).FszPage)) + pBuf2 = Xsqlite3_malloc(tls, int32((*TWal)(unsafe.Pointer(pWal)).FszPage)) + if pBuf1 == uintptr(0) || pBuf2 == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(1) + rc = _walSnapshotRecover(tls, pWal, pBuf1, pBuf2) + (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(0) + } + Xsqlite3_free(tls, pBuf1) + Xsqlite3_free(tls, pBuf2) + _walUnlockExclusive(tls, pWal, int32(WAL_CKPT_LOCK), int32(1)) + } + return rc +} + +// C documentation +// +// /* +// ** This function does the work of sqlite3WalBeginReadTransaction() (see +// ** below). That function simply calls this one inside an SEH_TRY{...} block. +// */ +func _walBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bChanged, ckptLock, rc int32 + var pInfo, pSnapshot uintptr + var _ /* cnt at bp+0 */ int32 + _, _, _, _, _ = bChanged, ckptLock, pInfo, pSnapshot, rc /* Return code */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* Number of TryBeginRead attempts */ + ckptLock = 0 + bChanged = 0 + pSnapshot = (*TWal)(unsafe.Pointer(pWal)).FpSnapshot + if pSnapshot != 0 { + if libc.Xmemcmp(tls, pSnapshot, pWal+72, uint64(48)) != 0 { + bChanged = int32(1) + } + /* It is possible that there is a checkpointer thread running + ** concurrent with this code. If this is the case, it may be that the + ** checkpointer has already determined that it will checkpoint + ** snapshot X, where X is later in the wal file than pSnapshot, but + ** has not yet set the pInfo->nBackfillAttempted variable to indicate + ** its intent. To avoid the race condition this leads to, ensure that + ** there is no checkpointer process by taking a shared CKPT lock + ** before checking pInfo->nBackfillAttempted. */ + rc = _walLockShared(tls, pWal, int32(WAL_CKPT_LOCK)) + if rc != SQLITE_OK { + return rc + } + ckptLock = int32(1) + } + for cond := true; cond; cond = rc == -int32(1) { + rc = _walTryBeginRead(tls, pWal, pChanged, 0, bp) + } + if rc == SQLITE_OK { + if pSnapshot != 0 && libc.Xmemcmp(tls, pSnapshot, pWal+72, uint64(48)) != 0 { + /* At this point the client has a lock on an aReadMark[] slot holding + ** a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr + ** is populated with the wal-index header corresponding to the head + ** of the wal file. Verify that pSnapshot is still valid before + ** continuing. Reasons why pSnapshot might no longer be valid: + ** + ** (1) The WAL file has been reset since the snapshot was taken. + ** In this case, the salt will have changed. + ** + ** (2) A checkpoint as been attempted that wrote frames past + ** pSnapshot->mxFrame into the database file. Note that the + ** checkpoint need not have completed for this to cause problems. + */ + pInfo = _walCkptInfo(tls, pWal) + /* Check that the wal file has not been wrapped. Assuming that it has + ** not, also check that no checkpointer has attempted to checkpoint any + ** frames beyond pSnapshot->mxFrame. If either of these conditions are + ** true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr + ** with *pSnapshot and set *pChanged as appropriate for opening the + ** snapshot. */ + if !(libc.Xmemcmp(tls, pSnapshot+32, pWal+72+32, uint64(8)) != 0) && (*TWalIndexHdr)(unsafe.Pointer(pSnapshot)).FmxFrame >= (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfillAttempted { + libc.Xmemcpy(tls, pWal+72, pSnapshot, uint64(48)) + *(*int32)(unsafe.Pointer(pChanged)) = bChanged + } else { + rc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(3)<= 0 { + _walUnlockShared(tls, pWal, int32(3)+int32((*TWal)(unsafe.Pointer(pWal)).FreadLock)) + (*TWal)(unsafe.Pointer(pWal)).FreadLock = int16(-int32(1)) + } +} + +// C documentation +// +// /* +// ** Search the wal file for page pgno. If found, set *piRead to the frame that +// ** contains the page. Otherwise, if pgno is not in the wal file, set *piRead +// ** to zero. +// ** +// ** Return SQLITE_OK if successful, or an error code if an error occurs. If an +// ** error does occur, the final value of *piRead is undefined. +// */ +func _walFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iFrame, iH, iLast, iRead, v2 Tu32 + var iHash, iKey, iMinHash, nCollide, rc, v3 int32 + var _ /* sLoc at bp+0 */ TWalHashLoc + _, _, _, _, _, _, _, _, _, _, _ = iFrame, iH, iHash, iKey, iLast, iMinHash, iRead, nCollide, rc, v2, v3 + iRead = uint32(0) /* If !=0, WAL frame to return data from */ + iLast = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + /* This routine is only be called from within a read transaction. */ + /* If the "last page" field of the wal-index header snapshot is 0, then + ** no data will be read from the wal under any circumstances. Return early + ** in this case as an optimization. Likewise, if pWal->readLock==0, + ** then the WAL is ignored by the reader so return early, as if the + ** WAL were empty. + */ + if iLast == uint32(0) || int32((*TWal)(unsafe.Pointer(pWal)).FreadLock) == 0 && int32((*TWal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0 { + *(*Tu32)(unsafe.Pointer(piRead)) = uint32(0) + return SQLITE_OK + } + /* Search the hash table or tables for an entry matching page number + ** pgno. Each iteration of the following for() loop searches one + ** hash table (each hash table indexes up to HASHTABLE_NPAGE frames). + ** + ** This code might run concurrently to the code in walIndexAppend() + ** that adds entries to the wal-index (and possibly to this hash + ** table). This means the value just read from the hash + ** slot (aHash[iKey]) may have been added before or after the + ** current read transaction was opened. Values added after the + ** read transaction was opened may have been written incorrectly - + ** i.e. these slots may contain garbage data. However, we assume + ** that any slots written before the current read transaction was + ** opened remain unmodified. + ** + ** For the reasons above, the if(...) condition featured in the inner + ** loop of the following block is more stringent that would be required + ** if we had exclusive access to the hash-table: + ** + ** (aPgno[iFrame]==pgno): + ** This condition filters out normal hash-table collisions. + ** + ** (iFrame<=iLast): + ** This condition filters out entries that were added to the hash + ** table after the current read-transaction had started. + */ + iMinHash = _walFramePage(tls, (*TWal)(unsafe.Pointer(pWal)).FminFrame) + iHash = _walFramePage(tls, iLast) + for { + if !(iHash >= iMinHash) { + break + } + rc = _walHashGet(tls, pWal, iHash, bp) + if rc != SQLITE_OK { + return rc + } + nCollide = libc.Int32FromInt32(HASHTABLE_NPAGE) * libc.Int32FromInt32(2) + iKey = _walHash(tls, pgno) + for { + v2 = uint32(libc.AtomicLoadNUint16((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaHash+uintptr(iKey)*2, libc.Int32FromInt32(__ATOMIC_RELAXED))) + iH = v2 + if !(v2 != uint32(0)) { + break + } + iFrame = iH + (*(*TWalHashLoc)(unsafe.Pointer(bp))).FiZero + if iFrame <= iLast && iFrame >= (*TWal)(unsafe.Pointer(pWal)).FminFrame && *(*Tu32)(unsafe.Pointer((*(*TWalHashLoc)(unsafe.Pointer(bp))).FaPgno + uintptr(iH-uint32(1))*4)) == pgno { + iRead = iFrame + } + v3 = nCollide + nCollide-- + if v3 == 0 { + *(*Tu32)(unsafe.Pointer(piRead)) = uint32(0) + return _sqlite3CorruptError(tls, int32(68129)) + } + iKey = _walNextHash(tls, iKey) + } + if iRead != 0 { + break + } + goto _1 + _1: + ; + iHash-- + } + *(*Tu32)(unsafe.Pointer(piRead)) = iRead + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Search the wal file for page pgno. If found, set *piRead to the frame that +// ** contains the page. Otherwise, if pgno is not in the wal file, set *piRead +// ** to zero. +// ** +// ** Return SQLITE_OK if successful, or an error code if an error occurs. If an +// ** error does occur, the final value of *piRead is undefined. +// ** +// ** The difference between this function and walFindFrame() is that this +// ** function wraps walFindFrame() in an SEH_TRY{...} block. +// */ +func _sqlite3WalFindFrame(tls *libc.TLS, pWal uintptr, pgno TPgno, piRead uintptr) (r int32) { + var rc int32 + _ = rc + rc = _walFindFrame(tls, pWal, pgno, piRead) + return rc +} + +// C documentation +// +// /* +// ** Read the contents of frame iRead from the wal file into buffer pOut +// ** (which is nOut bytes in size). Return SQLITE_OK if successful, or an +// ** error code otherwise. +// */ +func _sqlite3WalReadFrame(tls *libc.TLS, pWal uintptr, iRead Tu32, nOut int32, pOut uintptr) (r int32) { + var iOffset Ti64 + var sz, v1 int32 + _, _, _ = iOffset, sz, v1 + sz = int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage) + sz = sz&int32(0xfe00) + sz&int32(0x0001)< sz { + v1 = sz + } else { + v1 = nOut + } + return _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, pOut, v1, iOffset) +} + +// C documentation +// +// /* +// ** Return the size of the database in pages (or zero, if unknown). +// */ +func _sqlite3WalDbsize(tls *libc.TLS, pWal uintptr) (r TPgno) { + if pWal != 0 && int32((*TWal)(unsafe.Pointer(pWal)).FreadLock) >= 0 { + return (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage + } + return uint32(0) +} + +// C documentation +// +// /* +// ** This function starts a write transaction on the WAL. +// ** +// ** A read transaction must have already been started by a prior call +// ** to sqlite3WalBeginReadTransaction(). +// ** +// ** If another thread or process has written into the database since +// ** the read transaction was started, then it is not possible for this +// ** thread to write as doing so would cause a fork. So this routine +// ** returns SQLITE_BUSY in that case and no write transaction is started. +// ** +// ** There can only be a single writer active at a time. +// */ +func _sqlite3WalBeginWriteTransaction(tls *libc.TLS, pWal uintptr) (r int32) { + var rc int32 + _ = rc + /* Cannot start a write transaction without first holding a read + ** transaction. */ + if (*TWal)(unsafe.Pointer(pWal)).FreadOnly != 0 { + return int32(SQLITE_READONLY) + } + /* Only one writer allowed at a time. Get the write lock. Return + ** SQLITE_BUSY if unable. + */ + rc = _walLockExclusive(tls, pWal, WAL_WRITE_LOCK, int32(1)) + if rc != 0 { + return rc + } + (*TWal)(unsafe.Pointer(pWal)).FwriteLock = uint8(1) + /* If another connection has written to the database file since the + ** time the read transaction on this connection was started, then + ** the write is disallowed. + */ + if libc.Xmemcmp(tls, pWal+72, _walIndexHdr(tls, pWal), uint64(48)) != 0 { + rc = libc.Int32FromInt32(SQLITE_BUSY) | libc.Int32FromInt32(2)<hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left +// ** unchanged. +// ** +// ** SQLITE_OK is returned if no error is encountered (regardless of whether +// ** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned +// ** if an error occurs. +// */ +func _walRestartLog(tls *libc.TLS, pWal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pInfo uintptr + var rc int32 + var _ /* cnt at bp+0 */ int32 + var _ /* notUsed at bp+8 */ int32 + var _ /* salt1 at bp+4 */ Tu32 + _, _ = pInfo, rc + rc = SQLITE_OK + if int32((*TWal)(unsafe.Pointer(pWal)).FreadLock) == 0 { + pInfo = _walCkptInfo(tls, pWal) + if (*TWalCkptInfo)(unsafe.Pointer(pInfo)).FnBackfill > uint32(0) { + Xsqlite3_randomness(tls, int32(4), bp+4) + rc = _walLockExclusive(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) + if rc == SQLITE_OK { + /* If all readers are using WAL_READ_LOCK(0) (in other words if no + ** readers are currently using the WAL), then the transactions + ** frames will overwrite the start of the existing log. Update the + ** wal-index header to reflect this. + ** + ** In theory it would be Ok to update the cache of the header only + ** at this point. But updating the actual wal-index header is also + ** safe and means there is no special case for sqlite3WalUndo() + ** to handle if this transaction is rolled back. */ + _walRestartHdr(tls, pWal, *(*Tu32)(unsafe.Pointer(bp + 4))) + _walUnlockExclusive(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(1), libc.Int32FromInt32(SQLITE_SHM_NLOCK)-libc.Int32FromInt32(3)-libc.Int32FromInt32(1)) + } else { + if rc != int32(SQLITE_BUSY) { + return rc + } + } + } + _walUnlockShared(tls, pWal, libc.Int32FromInt32(3)+libc.Int32FromInt32(0)) + (*TWal)(unsafe.Pointer(pWal)).FreadLock = int16(-int32(1)) + *(*int32)(unsafe.Pointer(bp)) = 0 + for cond := true; cond; cond = rc == -int32(1) { + rc = _walTryBeginRead(tls, pWal, bp+8, int32(1), bp) + } + /* BUSY not possible when useWal==1 */ + } + return rc +} + +// C documentation +// +// /* +// ** Information about the current state of the WAL file and where +// ** the next fsync should occur - passed from sqlite3WalFrames() into +// ** walWriteToLog(). +// */ +type TWalWriter = struct { + FpWal uintptr + FpFd uintptr + FiSyncPoint Tsqlite3_int64 + FsyncFlags int32 + FszPage int32 +} + +type WalWriter = TWalWriter + +// C documentation +// +// /* +// ** Write iAmt bytes of content into the WAL file beginning at iOffset. +// ** Do a sync when crossing the p->iSyncPoint boundary. +// ** +// ** In other words, if iSyncPoint is in between iOffset and iOffset+iAmt, +// ** first write the part before iSyncPoint, then sync, then write the +// ** rest. +// */ +func _walWriteToLog(tls *libc.TLS, p uintptr, pContent uintptr, iAmt int32, iOffset Tsqlite3_int64) (r int32) { + var iFirstAmt, rc int32 + _, _ = iFirstAmt, rc + if iOffset < (*TWalWriter)(unsafe.Pointer(p)).FiSyncPoint && iOffset+int64(iAmt) >= (*TWalWriter)(unsafe.Pointer(p)).FiSyncPoint { + iFirstAmt = int32((*TWalWriter)(unsafe.Pointer(p)).FiSyncPoint - iOffset) + rc = _sqlite3OsWrite(tls, (*TWalWriter)(unsafe.Pointer(p)).FpFd, pContent, iFirstAmt, iOffset) + if rc != 0 { + return rc + } + iOffset += int64(iFirstAmt) + iAmt -= iFirstAmt + pContent = uintptr(iFirstAmt) + pContent + rc = _sqlite3OsSync(tls, (*TWalWriter)(unsafe.Pointer(p)).FpFd, (*TWalWriter)(unsafe.Pointer(p)).FsyncFlags&int32(0x03)) + if iAmt == 0 || rc != 0 { + return rc + } + } + rc = _sqlite3OsWrite(tls, (*TWalWriter)(unsafe.Pointer(p)).FpFd, pContent, iAmt, iOffset) + return rc +} + +// C documentation +// +// /* +// ** Write out a single frame of the WAL +// */ +func _walWriteOneFrame(tls *libc.TLS, p uintptr, pPage uintptr, nTruncate int32, iOffset Tsqlite3_int64) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pData uintptr + var rc int32 + var _ /* aFrame at bp+0 */ [24]Tu8 + _, _ = pData, rc /* Buffer to assemble frame-header in */ + pData = (*TPgHdr)(unsafe.Pointer(pPage)).FpData + _walEncodeFrame(tls, (*TWalWriter)(unsafe.Pointer(p)).FpWal, (*TPgHdr)(unsafe.Pointer(pPage)).Fpgno, uint32(nTruncate), pData, bp) + rc = _walWriteToLog(tls, p, bp, int32(24), iOffset) + if rc != 0 { + return rc + } + /* Write the page data */ + rc = _walWriteToLog(tls, p, pData, (*TWalWriter)(unsafe.Pointer(p)).FszPage, int64(uint64(iOffset)+uint64(24))) + return rc +} + +// C documentation +// +// /* +// ** This function is called as part of committing a transaction within which +// ** one or more frames have been overwritten. It updates the checksums for +// ** all frames written to the wal file by the current transaction starting +// ** with the earliest to have been overwritten. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _walRewriteChecksums(tls *libc.TLS, pWal uintptr, iLast Tu32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aBuf uintptr + var iCksumOff, iOff Ti64 + var iPgno, iRead, nDbSize Tu32 + var rc, szPage int32 + var _ /* aFrame at bp+0 */ [24]Tu8 + _, _, _, _, _, _, _, _ = aBuf, iCksumOff, iOff, iPgno, iRead, nDbSize, rc, szPage + szPage = int32((*TWal)(unsafe.Pointer(pWal)).FszPage) /* Database page size */ + rc = SQLITE_OK + aBuf = Xsqlite3_malloc(tls, szPage+int32(WAL_FRAME_HDRSIZE)) + if aBuf == uintptr(0) { + return int32(SQLITE_NOMEM) + } + /* Find the checksum values to use as input for the recalculating the + ** first checksum. If the first frame is frame 1 (implying that the current + ** transaction restarted the wal file), these values must be read from the + ** wal-file header. Otherwise, read them from the frame header of the + ** previous frame. */ + if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(1) { + iCksumOff = int64(24) + } else { + iCksumOff = int64(WAL_HDRSIZE) + int64((*TWal)(unsafe.Pointer(pWal)).FiReCksum-libc.Uint32FromInt32(1)-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + int64(16) + } + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, aBuf, int32(libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)), iCksumOff) + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = _sqlite3Get4byte(tls, aBuf) + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = _sqlite3Get4byte(tls, aBuf+uintptr(4)) + iRead = (*TWal)(unsafe.Pointer(pWal)).FiReCksum + (*TWal)(unsafe.Pointer(pWal)).FiReCksum = uint32(0) + for { + if !(rc == SQLITE_OK && iRead <= iLast) { + break + } + iOff = libc.Int64FromInt32(WAL_HDRSIZE) + int64(iRead-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + rc = _sqlite3OsRead(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, aBuf, szPage+int32(WAL_FRAME_HDRSIZE), iOff) + if rc == SQLITE_OK { + iPgno = _sqlite3Get4byte(tls, aBuf) + nDbSize = _sqlite3Get4byte(tls, aBuf+4) + _walEncodeFrame(tls, pWal, iPgno, nDbSize, aBuf+24, bp) + rc = _sqlite3OsWrite(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp, int32(24), iOff) + } + goto _1 + _1: + ; + iRead++ + } + Xsqlite3_free(tls, aBuf) + return rc +} + +// C documentation +// +// /* +// ** Write a set of frames to the log. The caller must hold the write-lock +// ** on the log file (obtained using sqlite3WalBeginWriteTransaction()). +// */ +func _walFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTruncate TPgno, isCommit int32, sync_flags int32) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var bSync, nDbSize, nExtra, rc, sectorSize, szFrame, v1 int32 + var iFirst, iFrame Tu32 + var iOff, iOffset, sz Ti64 + var p, pData, pLast, pLive, p3, p5 uintptr + var v4 uint32 + var _ /* aCksum at bp+64 */ [2]Tu32 + var _ /* aWalHdr at bp+32 */ [32]Tu8 + var _ /* iWrite at bp+72 */ Tu32 + var _ /* w at bp+0 */ TWalWriter + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bSync, iFirst, iFrame, iOff, iOffset, nDbSize, nExtra, p, pData, pLast, pLive, rc, sectorSize, sz, szFrame, v1, v4, p3, p5 /* Iterator to run through pList with. */ + pLast = uintptr(0) /* Last frame in list */ + nExtra = 0 /* The writer */ + iFirst = uint32(0) /* Pointer to shared header */ + /* If this frame set completes a transaction, then nTruncate>0. If + ** nTruncate==0 then this frame set does not complete the transaction. */ + pLive = _walIndexHdr(tls, pWal) + if libc.Xmemcmp(tls, pWal+72, pLive, uint64(48)) != 0 { + iFirst = (*TWalIndexHdr)(unsafe.Pointer(pLive)).FmxFrame + uint32(1) + } + /* See if it is possible to write these frames into the start of the + ** log file, instead of appending to it at pWal->hdr.mxFrame. + */ + v1 = _walRestartLog(tls, pWal) + rc = v1 + if SQLITE_OK != v1 { + return rc + } + /* If this is the first frame written into the log, write the WAL + ** header to the start of the WAL file. See comments at the top of + ** this source file for a description of the WAL header format. + */ + iFrame = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + if iFrame == uint32(0) { /* Checksum for wal-header */ + _sqlite3Put4byte(tls, bp+32, uint32(libc.Int32FromInt32(WAL_MAGIC)|libc.Int32FromInt32(SQLITE_BIGENDIAN))) + _sqlite3Put4byte(tls, bp+32+4, uint32(WAL_MAX_VERSION)) + _sqlite3Put4byte(tls, bp+32+8, uint32(szPage)) + _sqlite3Put4byte(tls, bp+32+12, (*TWal)(unsafe.Pointer(pWal)).FnCkpt) + if (*TWal)(unsafe.Pointer(pWal)).FnCkpt == uint32(0) { + Xsqlite3_randomness(tls, int32(8), pWal+72+32) + } + libc.Xmemcpy(tls, bp+32+16, pWal+72+32, uint64(8)) + _walChecksumBytes(tls, int32(1), bp+32, libc.Int32FromInt32(WAL_HDRSIZE)-libc.Int32FromInt32(2)*libc.Int32FromInt32(4), uintptr(0), bp+64) + _sqlite3Put4byte(tls, bp+32+24, (*(*[2]Tu32)(unsafe.Pointer(bp + 64)))[0]) + _sqlite3Put4byte(tls, bp+32+28, (*(*[2]Tu32)(unsafe.Pointer(bp + 64)))[int32(1)]) + (*TWal)(unsafe.Pointer(pWal)).FszPage = uint32(szPage) + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum = uint8(SQLITE_BIGENDIAN) + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24)) = (*(*[2]Tu32)(unsafe.Pointer(bp + 64)))[0] + *(*Tu32)(unsafe.Pointer(pWal + 72 + 24 + 1*4)) = (*(*[2]Tu32)(unsafe.Pointer(bp + 64)))[int32(1)] + (*TWal)(unsafe.Pointer(pWal)).FtruncateOnCommit = uint8(1) + rc = _sqlite3OsWrite(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp+32, int32(32), 0) + if rc != SQLITE_OK { + return rc + } + /* Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless + ** all syncing is turned off by PRAGMA synchronous=OFF). Otherwise + ** an out-of-order write following a WAL restart could result in + ** database corruption. See the ticket: + ** + ** https://sqlite.org/src/info/ff5be73dee + */ + if (*TWal)(unsafe.Pointer(pWal)).FsyncHeader != 0 { + rc = _sqlite3OsSync(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, sync_flags>>int32(2)&int32(0x03)) + if rc != 0 { + return rc + } + } + } + if int32((*TWal)(unsafe.Pointer(pWal)).FszPage) != szPage { + return _sqlite3CorruptError(tls, int32(68652)) /* TH3 test case: cov1/corrupt155.test */ + } + /* Setup information needed to write frames into the WAL */ + (*(*TWalWriter)(unsafe.Pointer(bp))).FpWal = pWal + (*(*TWalWriter)(unsafe.Pointer(bp))).FpFd = (*TWal)(unsafe.Pointer(pWal)).FpWalFd + (*(*TWalWriter)(unsafe.Pointer(bp))).FiSyncPoint = 0 + (*(*TWalWriter)(unsafe.Pointer(bp))).FsyncFlags = sync_flags + (*(*TWalWriter)(unsafe.Pointer(bp))).FszPage = szPage + iOffset = libc.Int64FromInt32(WAL_HDRSIZE) + int64(iFrame+libc.Uint32FromInt32(1)-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + szFrame = szPage + int32(WAL_FRAME_HDRSIZE) + /* Write all frames into the log file exactly once */ + p = pList + for { + if !(p != 0) { + break + } /* 0 normally. Positive == commit flag */ + /* Check if this page has already been written into the wal file by + ** the current transaction. If so, overwrite the existing frame and + ** set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that + ** checksums must be recomputed when the transaction is committed. */ + if iFirst != 0 && ((*TPgHdr)(unsafe.Pointer(p)).FpDirty != 0 || isCommit == 0) { + *(*Tu32)(unsafe.Pointer(bp + 72)) = uint32(0) + _walFindFrame(tls, pWal, (*TPgHdr)(unsafe.Pointer(p)).Fpgno, bp+72) + if *(*Tu32)(unsafe.Pointer(bp + 72)) >= iFirst { + iOff = int64(WAL_HDRSIZE) + int64(*(*Tu32)(unsafe.Pointer(bp + 72))-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + int64(WAL_FRAME_HDRSIZE) + if (*TWal)(unsafe.Pointer(pWal)).FiReCksum == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 72)) < (*TWal)(unsafe.Pointer(pWal)).FiReCksum { + (*TWal)(unsafe.Pointer(pWal)).FiReCksum = *(*Tu32)(unsafe.Pointer(bp + 72)) + } + pData = (*TPgHdr)(unsafe.Pointer(p)).FpData + rc = _sqlite3OsWrite(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, pData, szPage, iOff) + if rc != 0 { + return rc + } + p3 = p + 52 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(PGHDR_WAL_APPEND)) + goto _2 + } + } + iFrame++ + if isCommit != 0 && (*TPgHdr)(unsafe.Pointer(p)).FpDirty == uintptr(0) { + v4 = nTruncate + } else { + v4 = uint32(0) + } + nDbSize = int32(v4) + rc = _walWriteOneFrame(tls, bp, p, nDbSize, iOffset) + if rc != 0 { + return rc + } + pLast = p + iOffset += int64(szFrame) + p5 = p + 52 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(PGHDR_WAL_APPEND)) + goto _2 + _2: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + } + /* Recalculate checksums within the wal file if required. */ + if isCommit != 0 && (*TWal)(unsafe.Pointer(pWal)).FiReCksum != 0 { + rc = _walRewriteChecksums(tls, pWal, iFrame) + if rc != 0 { + return rc + } + } + /* If this is the end of a transaction, then we might need to pad + ** the transaction and/or sync the WAL file. + ** + ** Padding and syncing only occur if this set of frames complete a + ** transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL + ** or synchronous==OFF, then no padding or syncing are needed. + ** + ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not + ** needed and only the sync is done. If padding is needed, then the + ** final frame is repeated (with its commit mark) until the next sector + ** boundary is crossed. Only the part of the WAL prior to the last + ** sector boundary is synced; the part of the last frame that extends + ** past the sector boundary is written after the sync. + */ + if isCommit != 0 && sync_flags&int32(0x03) != 0 { + bSync = int32(1) + if (*TWal)(unsafe.Pointer(pWal)).FpadToSectorBoundary != 0 { + sectorSize = _sqlite3SectorSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd) + (*(*TWalWriter)(unsafe.Pointer(bp))).FiSyncPoint = (iOffset + int64(sectorSize) - int64(1)) / int64(sectorSize) * int64(sectorSize) + bSync = libc.BoolInt32((*(*TWalWriter)(unsafe.Pointer(bp))).FiSyncPoint == iOffset) + for iOffset < (*(*TWalWriter)(unsafe.Pointer(bp))).FiSyncPoint { + rc = _walWriteOneFrame(tls, bp, pLast, int32(nTruncate), iOffset) + if rc != 0 { + return rc + } + iOffset += int64(szFrame) + nExtra++ + } + } + if bSync != 0 { + rc = _sqlite3OsSync(tls, (*(*TWalWriter)(unsafe.Pointer(bp))).FpFd, sync_flags&int32(0x03)) + } + } + /* If this frame set completes the first transaction in the WAL and + ** if PRAGMA journal_size_limit is set, then truncate the WAL to the + ** journal size limit, if possible. + */ + if isCommit != 0 && (*TWal)(unsafe.Pointer(pWal)).FtruncateOnCommit != 0 && (*TWal)(unsafe.Pointer(pWal)).FmxWalSize >= 0 { + sz = (*TWal)(unsafe.Pointer(pWal)).FmxWalSize + if int64(WAL_HDRSIZE)+int64(iFrame+uint32(nExtra)+libc.Uint32FromInt32(1)-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) > (*TWal)(unsafe.Pointer(pWal)).FmxWalSize { + sz = libc.Int64FromInt32(WAL_HDRSIZE) + int64(iFrame+uint32(nExtra)+libc.Uint32FromInt32(1)-libc.Uint32FromInt32(1))*int64(szPage+libc.Int32FromInt32(WAL_FRAME_HDRSIZE)) + } + _walLimitSize(tls, pWal, sz) + (*TWal)(unsafe.Pointer(pWal)).FtruncateOnCommit = uint8(0) + } + /* Append data to the wal-index. It is not necessary to lock the + ** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index + ** guarantees that there are no other writers, and no data that may + ** be in use by existing readers is being overwritten. + */ + iFrame = (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + p = pList + for { + if !(p != 0 && rc == SQLITE_OK) { + break + } + if int32((*TPgHdr)(unsafe.Pointer(p)).Fflags)&int32(PGHDR_WAL_APPEND) == 0 { + goto _6 + } + iFrame++ + rc = _walIndexAppend(tls, pWal, iFrame, (*TPgHdr)(unsafe.Pointer(p)).Fpgno) + goto _6 + _6: + ; + p = (*TPgHdr)(unsafe.Pointer(p)).FpDirty + } + for rc == SQLITE_OK && nExtra > 0 { + iFrame++ + nExtra-- + rc = _walIndexAppend(tls, pWal, iFrame, (*TPgHdr)(unsafe.Pointer(pLast)).Fpgno) + } + if rc == SQLITE_OK { + /* Update the private copy of the header. */ + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FszPage = uint16(szPage&libc.Int32FromInt32(0xff00) | szPage>>libc.Int32FromInt32(16)) + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = iFrame + if isCommit != 0 { + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FiChange++ + (*TWal)(unsafe.Pointer(pWal)).Fhdr.FnPage = nTruncate + } + /* If this is a commit, update the wal-index header too. */ + if isCommit != 0 { + _walIndexWriteHdr(tls, pWal) + (*TWal)(unsafe.Pointer(pWal)).FiCallback = iFrame + } + } + return rc +} + +// C documentation +// +// /* +// ** Write a set of frames to the log. The caller must hold the write-lock +// ** on the log file (obtained using sqlite3WalBeginWriteTransaction()). +// ** +// ** The difference between this function and walFrames() is that this +// ** function wraps walFrames() in an SEH_TRY{...} block. +// */ +func _sqlite3WalFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTruncate TPgno, isCommit int32, sync_flags int32) (r int32) { + var rc int32 + _ = rc + rc = _walFrames(tls, pWal, szPage, pList, nTruncate, isCommit, sync_flags) + return rc +} + +// C documentation +// +// /* +// ** This routine is called to implement sqlite3_wal_checkpoint() and +// ** related interfaces. +// ** +// ** Obtain a CHECKPOINT lock and then backfill as much information as +// ** we can from WAL into the database. +// ** +// ** If parameter xBusy is not NULL, it is a pointer to a busy-handler +// ** callback. In this case this function runs a blocking checkpoint. +// */ +func _sqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy uintptr, pBusyArg uintptr, sync_flags int32, nBuf int32, zBuf uintptr, pnLog uintptr, pnCkpt uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eMode2, rc, v1 int32 + var xBusy2 uintptr + var _ /* isChanged at bp+0 */ int32 + _, _, _, _ = eMode2, rc, xBusy2, v1 /* Return code */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* True if a new wal-index header is loaded */ + eMode2 = eMode /* Mode to pass to walCheckpoint() */ + xBusy2 = xBusy /* Busy handler for eMode2 */ + /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked + ** in the SQLITE_CHECKPOINT_PASSIVE mode. */ + if (*TWal)(unsafe.Pointer(pWal)).FreadOnly != 0 { + return int32(SQLITE_READONLY) + } + /* Enable blocking locks, if possible. */ + if xBusy2 != 0 { + } + /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive + ** "checkpoint" lock on the database file. + ** EVIDENCE-OF: R-10421-19736 If any other process is running a + ** checkpoint operation at the same time, the lock cannot be obtained and + ** SQLITE_BUSY is returned. + ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured, + ** it will not be invoked in this case. + */ + rc = _walLockExclusive(tls, pWal, int32(WAL_CKPT_LOCK), int32(1)) + if rc == SQLITE_OK { + (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(1) + /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and + ** TRUNCATE modes also obtain the exclusive "writer" lock on the database + ** file. + ** + ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained + ** immediately, and a busy-handler is configured, it is invoked and the + ** writer lock retried until either the busy-handler returns 0 or the + ** lock is successfully obtained. + */ + if eMode != SQLITE_CHECKPOINT_PASSIVE { + rc = _walBusyLock(tls, pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, int32(1)) + if rc == SQLITE_OK { + (*TWal)(unsafe.Pointer(pWal)).FwriteLock = uint8(1) + } else { + if rc == int32(SQLITE_BUSY) { + eMode2 = SQLITE_CHECKPOINT_PASSIVE + xBusy2 = uintptr(0) + rc = SQLITE_OK + } + } + } + } + /* Read the wal-index header. */ + if rc == SQLITE_OK { + /* For a passive checkpoint, do not re-enable blocking locks after + ** reading the wal-index header. A passive checkpoint should not block + ** or invoke the busy handler. The only lock such a checkpoint may + ** attempt to obtain is a lock on a read-slot, and it should give up + ** immediately and do a partial checkpoint if it cannot obtain it. */ + rc = _walIndexReadHdr(tls, pWal, bp) + if eMode2 != SQLITE_CHECKPOINT_PASSIVE { + } + if *(*int32)(unsafe.Pointer(bp)) != 0 && (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*TWal)(unsafe.Pointer(pWal)).FpDbFd)).FpMethods)).FiVersion >= int32(3) { + _sqlite3OsUnfetch(tls, (*TWal)(unsafe.Pointer(pWal)).FpDbFd, 0, uintptr(0)) + } + } + /* Copy data from the log to the database file. */ + if rc == SQLITE_OK { + if (*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0 && _walPagesize(tls, pWal) != nBuf { + rc = _sqlite3CorruptError(tls, int32(68912)) + } else { + rc = _walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) + } + /* If no error occurred, set the output variables. */ + if rc == SQLITE_OK || rc == int32(SQLITE_BUSY) { + if pnLog != 0 { + *(*int32)(unsafe.Pointer(pnLog)) = int32((*TWal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) + } + if pnCkpt != 0 { + *(*int32)(unsafe.Pointer(pnCkpt)) = int32((*TWalCkptInfo)(unsafe.Pointer(_walCkptInfo(tls, pWal))).FnBackfill) + } + } + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + /* If a new wal-index header was loaded before the checkpoint was + ** performed, then the pager-cache associated with pWal is now + ** out of date. So zero the cached wal-index header to ensure that + ** next time the pager opens a snapshot on this database it knows that + ** the cache needs to be reset. + */ + libc.Xmemset(tls, pWal+72, 0, uint64(48)) + } + /* Release the locks. */ + _sqlite3WalEndWriteTransaction(tls, pWal) + if (*TWal)(unsafe.Pointer(pWal)).FckptLock != 0 { + _walUnlockExclusive(tls, pWal, int32(WAL_CKPT_LOCK), int32(1)) + (*TWal)(unsafe.Pointer(pWal)).FckptLock = uint8(0) + } + if rc == SQLITE_OK && eMode != eMode2 { + v1 = int32(SQLITE_BUSY) + } else { + v1 = rc + } + return v1 +} + +// C documentation +// +// /* Return the value to pass to a sqlite3_wal_hook callback, the +// ** number of frames in the WAL at the point of the last commit since +// ** sqlite3WalCallback() was called. If no commits have occurred since +// ** the last call, then return 0. +// */ +func _sqlite3WalCallback(tls *libc.TLS, pWal uintptr) (r int32) { + var ret Tu32 + _ = ret + ret = uint32(0) + if pWal != 0 { + ret = (*TWal)(unsafe.Pointer(pWal)).FiCallback + (*TWal)(unsafe.Pointer(pWal)).FiCallback = uint32(0) + } + return int32(ret) +} + +// C documentation +// +// /* +// ** This function is called to change the WAL subsystem into or out +// ** of locking_mode=EXCLUSIVE. +// ** +// ** If op is zero, then attempt to change from locking_mode=EXCLUSIVE +// ** into locking_mode=NORMAL. This means that we must acquire a lock +// ** on the pWal->readLock byte. If the WAL is already in locking_mode=NORMAL +// ** or if the acquisition of the lock fails, then return 0. If the +// ** transition out of exclusive-mode is successful, return 1. This +// ** operation must occur while the pager is still holding the exclusive +// ** lock on the main database file. +// ** +// ** If op is one, then change from locking_mode=NORMAL into +// ** locking_mode=EXCLUSIVE. This means that the pWal->readLock must +// ** be released. Return 1 if the transition is made and 0 if the +// ** WAL is already in exclusive-locking mode - meaning that this +// ** routine is a no-op. The pager must already hold the exclusive lock +// ** on the main database file before invoking this operation. +// ** +// ** If op is negative, then do a dry-run of the op==1 case but do +// ** not actually change anything. The pager uses this to see if it +// ** should acquire the database exclusive lock prior to invoking +// ** the op==1 case. +// */ +func _sqlite3WalExclusiveMode(tls *libc.TLS, pWal uintptr, op int32) (r int32) { + var rc int32 + _ = rc + /* pWal->readLock is usually set, but might be -1 if there was a + ** prior error while attempting to acquire are read-lock. This cannot + ** happen if the connection is actually in exclusive mode (as no xShmLock + ** locks are taken in this case). Nor should the pager attempt to + ** upgrade to exclusive-mode following such an error. + */ + if op == 0 { + if int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) != WAL_NORMAL_MODE { + (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_NORMAL_MODE) + if _walLockShared(tls, pWal, int32(3)+int32((*TWal)(unsafe.Pointer(pWal)).FreadLock)) != SQLITE_OK { + (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_EXCLUSIVE_MODE) + } + rc = libc.BoolInt32(int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE) + } else { + /* Already in locking_mode=NORMAL */ + rc = 0 + } + } else { + if op > 0 { + _walUnlockShared(tls, pWal, int32(3)+int32((*TWal)(unsafe.Pointer(pWal)).FreadLock)) + (*TWal)(unsafe.Pointer(pWal)).FexclusiveMode = uint8(WAL_EXCLUSIVE_MODE) + rc = int32(1) + } else { + rc = libc.BoolInt32(int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE) + } + } + return rc +} + +// C documentation +// +// /* +// ** Return true if the argument is non-NULL and the WAL module is using +// ** heap-memory for the wal-index. Otherwise, if the argument is NULL or the +// ** WAL module is using shared-memory, return false. +// */ +func _sqlite3WalHeapMemory(tls *libc.TLS, pWal uintptr) (r int32) { + return libc.BoolInt32(pWal != 0 && int32((*TWal)(unsafe.Pointer(pWal)).FexclusiveMode) == int32(WAL_HEAPMEMORY_MODE)) +} + +// C documentation +// +// /* Create a snapshot object. The content of a snapshot is opaque to +// ** every other subsystem, so the WAL module can put whatever it needs +// ** in the object. +// */ +func _sqlite3WalSnapshotGet(tls *libc.TLS, pWal uintptr, ppSnapshot uintptr) (r int32) { + var pRet uintptr + var rc int32 + _, _ = pRet, rc + rc = SQLITE_OK + if libc.Xmemcmp(tls, pWal+72+24, uintptr(unsafe.Pointer(&_aZero)), uint64(16)) == 0 { + *(*uintptr)(unsafe.Pointer(ppSnapshot)) = uintptr(0) + return int32(SQLITE_ERROR) + } + pRet = Xsqlite3_malloc(tls, int32(48)) + if pRet == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, pRet, pWal+72, uint64(48)) + *(*uintptr)(unsafe.Pointer(ppSnapshot)) = pRet + } + return rc +} + +var _aZero = [4]Tu32{} + +// C documentation +// +// /* Try to open on pSnapshot when the next read-transaction starts +// */ +func _sqlite3WalSnapshotOpen(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) { + (*TWal)(unsafe.Pointer(pWal)).FpSnapshot = pSnapshot +} + +// C documentation +// +// /* +// ** Return a +ve value if snapshot p1 is newer than p2. A -ve value if +// ** p1 is older than p2 and zero if p1 and p2 are the same snapshot. +// */ +func Xsqlite3_snapshot_cmp(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { + var pHdr1, pHdr2 uintptr + _, _ = pHdr1, pHdr2 + pHdr1 = p1 + pHdr2 = p2 + /* aSalt[0] is a copy of the value stored in the wal file header. It + ** is incremented each time the wal file is restarted. */ + if *(*Tu32)(unsafe.Pointer(pHdr1 + 32)) < *(*Tu32)(unsafe.Pointer(pHdr2 + 32)) { + return -int32(1) + } + if *(*Tu32)(unsafe.Pointer(pHdr1 + 32)) > *(*Tu32)(unsafe.Pointer(pHdr2 + 32)) { + return +libc.Int32FromInt32(1) + } + if (*TWalIndexHdr)(unsafe.Pointer(pHdr1)).FmxFrame < (*TWalIndexHdr)(unsafe.Pointer(pHdr2)).FmxFrame { + return -int32(1) + } + if (*TWalIndexHdr)(unsafe.Pointer(pHdr1)).FmxFrame > (*TWalIndexHdr)(unsafe.Pointer(pHdr2)).FmxFrame { + return +libc.Int32FromInt32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** The caller currently has a read transaction open on the database. +// ** This function takes a SHARED lock on the CHECKPOINTER slot and then +// ** checks if the snapshot passed as the second argument is still +// ** available. If so, SQLITE_OK is returned. +// ** +// ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if +// ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error +// ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER +// ** lock is released before returning. +// */ +func _sqlite3WalSnapshotCheck(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) (r int32) { + var pNew uintptr + var rc int32 + _, _ = pNew, rc + rc = _walLockShared(tls, pWal, int32(WAL_CKPT_LOCK)) + if rc == SQLITE_OK { + pNew = pSnapshot + if libc.Xmemcmp(tls, pNew+32, pWal+72+32, uint64(8)) != 0 || (*TWalIndexHdr)(unsafe.Pointer(pNew)).FmxFrame < (*TWalCkptInfo)(unsafe.Pointer(_walCkptInfo(tls, pWal))).FnBackfillAttempted { + rc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(3)<mutex. + */ +type TMemPage1 = struct { + FisInit Tu8 + FintKey Tu8 + FintKeyLeaf Tu8 + Fpgno TPgno + Fleaf Tu8 + FhdrOffset Tu8 + FchildPtrSize Tu8 + Fmax1bytePayload Tu8 + FnOverflow Tu8 + FmaxLocal Tu16 + FminLocal Tu16 + FcellOffset Tu16 + FnFree int32 + FnCell Tu16 + FmaskPage Tu16 + FaiOvfl [4]Tu16 + FapOvfl [4]uintptr + FpBt uintptr + FaData uintptr + FaDataEnd uintptr + FaCellIdx uintptr + FaDataOfst uintptr + FpDbPage uintptr + FxCellSize uintptr + FxParseCell uintptr +} + +type MemPage1 = TMemPage1 + +/* +** A linked list of the following structures is stored at BtShared.pLock. +** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor +** is opened on the table with root page BtShared.iTable. Locks are removed +** from this list when a transaction is committed or rolled back, or when +** a btree handle is closed. + */ +type TBtLock1 = struct { + FpBtree uintptr + FiTable TPgno + FeLock Tu8 + FpNext uintptr +} + +type BtLock1 = TBtLock1 + +/* Candidate values for BtLock.eLock */ + +/* A Btree handle +** +** A database connection contains a pointer to an instance of +** this object for every database file that it has open. This structure +** is opaque to the database connection. The database connection cannot +** see the internals of this structure and only deals with pointers to +** this structure. +** +** For some database files, the same underlying database cache might be +** shared between multiple connections. In that case, each connection +** has it own instance of this object. But each instance of this object +** points to the same BtShared object. The database cache and the +** schema associated with the database file are all contained within +** the BtShared object. +** +** All fields in this structure are accessed under sqlite3.mutex. +** The pBt pointer itself may not be changed while there exists cursors +** in the referenced BtShared that point back to this Btree since those +** cursors have to go through this Btree to find their BtShared and +** they often do so without holding sqlite3.mutex. + */ +type TBtree1 = struct { + Fdb uintptr + FpBt uintptr + FinTrans Tu8 + Fsharable Tu8 + Flocked Tu8 + FhasIncrblobCur Tu8 + FwantToLock int32 + FnBackup int32 + FiBDataVersion Tu32 + FpNext uintptr + FpPrev uintptr + Flock TBtLock +} + +type Btree1 = TBtree1 + +/* +** Btree.inTrans may take one of the following values. +** +** If the shared-data extension is enabled, there may be multiple users +** of the Btree structure. At most one of these may open a write transaction, +** but any number may have active read transactions. +** +** These values must match SQLITE_TXN_NONE, SQLITE_TXN_READ, and +** SQLITE_TXN_WRITE + */ + +/* +** An instance of this object represents a single database file. +** +** A single database file can be in use at the same time by two +** or more database connections. When two or more connections are +** sharing the same database file, each connection has it own +** private Btree object for the file and each of those Btrees points +** to this one BtShared object. BtShared.nRef is the number of +** connections currently sharing this database file. +** +** Fields in this structure are accessed under the BtShared.mutex +** mutex, except for nRef and pNext which are accessed under the +** global SQLITE_MUTEX_STATIC_MAIN mutex. The pPager field +** may not be modified once it is initially set as long as nRef>0. +** The pSchema field may be set once under BtShared.mutex and +** thereafter is unchanged as long as nRef>0. +** +** isPending: +** +** If a BtShared client fails to obtain a write-lock on a database +** table (because there exists one or more read-locks on the table), +** the shared-cache enters 'pending-lock' state and isPending is +** set to true. +** +** The shared-cache leaves the 'pending lock' state when either of +** the following occur: +** +** 1) The current writer (BtShared.pWriter) concludes its transaction, OR +** 2) The number of locks held by other connections drops to zero. +** +** while in the 'pending-lock' state, no connection may start a new +** transaction. +** +** This feature is included to help prevent writer-starvation. + */ +type TBtShared1 = struct { + FpPager uintptr + Fdb uintptr + FpCursor uintptr + FpPage1 uintptr + FopenFlags Tu8 + FautoVacuum Tu8 + FincrVacuum Tu8 + FbDoTruncate Tu8 + FinTransaction Tu8 + Fmax1bytePayload Tu8 + FnReserveWanted Tu8 + FbtsFlags Tu16 + FmaxLocal Tu16 + FminLocal Tu16 + FmaxLeaf Tu16 + FminLeaf Tu16 + FpageSize Tu32 + FusableSize Tu32 + FnTransaction int32 + FnPage Tu32 + FpSchema uintptr + FxFreeSchema uintptr + Fmutex uintptr + FpHasContent uintptr + FnRef int32 + FpNext uintptr + FpLock uintptr + FpWriter uintptr + FpTmpSpace uintptr + FnPreformatSize int32 +} + +type BtShared1 = TBtShared1 + +/* +** Allowed values for BtShared.btsFlags + */ + +/* +** An instance of the following structure is used to hold information +** about a cell. The parseCellPtr() function fills in this structure +** based on information extract from the raw disk page. + */ +type TCellInfo1 = struct { + FnKey Ti64 + FpPayload uintptr + FnPayload Tu32 + FnLocal Tu16 + FnSize Tu16 +} + +type CellInfo1 = TCellInfo1 + +/* +** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than +** this will be declared corrupt. This value is calculated based on a +** maximum database size of 2^31 pages a minimum fanout of 2 for a +** root-node and 3 for all other internal nodes. +** +** If a tree that appears to be taller than this is encountered, it is +** assumed that the database is corrupt. + */ + +/* +** A cursor is a pointer to a particular entry within a particular +** b-tree within a database file. +** +** The entry is identified by its MemPage and the index in +** MemPage.aCell[] of the entry. +** +** A single database file can be shared by two more database connections, +** but cursors cannot be shared. Each cursor is associated with a +** particular database connection identified BtCursor.pBtree.db. +** +** Fields in this structure are accessed under the BtShared.mutex +** found at self->pBt->mutex. +** +** skipNext meaning: +** The meaning of skipNext depends on the value of eState: +** +** eState Meaning of skipNext +** VALID skipNext is meaningless and is ignored +** INVALID skipNext is meaningless and is ignored +** SKIPNEXT sqlite3BtreeNext() is a no-op if skipNext>0 and +** sqlite3BtreePrevious() is no-op if skipNext<0. +** REQUIRESEEK restoreCursorPosition() restores the cursor to +** eState=SKIPNEXT if skipNext!=0 +** FAULT skipNext holds the cursor fault error code. + */ +type TBtCursor1 = struct { + FeState Tu8 + FcurFlags Tu8 + FcurPagerFlags Tu8 + Fhints Tu8 + FskipNext int32 + FpBtree uintptr + FaOverflow uintptr + FpKey uintptr + FpBt uintptr + FpNext uintptr + Finfo TCellInfo + FnKey Ti64 + FpgnoRoot TPgno + FiPage Ti8 + FcurIntKey Tu8 + Fix Tu16 + FaiIdx [19]Tu16 + FpKeyInfo uintptr + FpPage uintptr + FapPage [19]uintptr +} + +type BtCursor1 = TBtCursor1 + +/* +** Legal values for BtCursor.curFlags + */ + +/* +** Potential values for BtCursor.eState. +** +** CURSOR_INVALID: +** Cursor does not point to a valid entry. This can happen (for example) +** because the table is empty or because BtreeCursorFirst() has not been +** called. +** +** CURSOR_VALID: +** Cursor points to a valid entry. getPayload() etc. may be called. +** +** CURSOR_SKIPNEXT: +** Cursor is valid except that the Cursor.skipNext field is non-zero +** indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious() +** operation should be a no-op. +** +** CURSOR_REQUIRESEEK: +** The table that this cursor was opened on still exists, but has been +** modified since the cursor was last used. The cursor position is saved +** in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in +** this state, restoreCursorPosition() can be called to attempt to +** seek the cursor to the saved position. +** +** CURSOR_FAULT: +** An unrecoverable error (an I/O error or a malloc failure) has occurred +** on a different connection that shares the BtShared cache with this +** cursor. The error has left the cache in an inconsistent state. +** Do nothing else with this cursor. Any attempt to use the cursor +** should return the error code stored in BtCursor.skipNext + */ + +/* +** The database page the PENDING_BYTE occupies. This page is never used. + */ + +/* +** These macros define the location of the pointer-map entry for a +** database page. The first argument to each is the number of usable +** bytes on each page of the database (often 1024). The second is the +** page number to look up in the pointer map. +** +** PTRMAP_PAGENO returns the database page number of the pointer-map +** page that stores the required pointer. PTRMAP_PTROFFSET returns +** the offset of the requested map entry. +** +** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page, +** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be +** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements +** this test. + */ + +/* +** The pointer map is a lookup table that identifies the parent page for +** each child page in the database file. The parent page is the page that +** contains a pointer to the child. Every page in the database contains +** 0 or 1 parent pages. (In this context 'database page' refers +** to any page that is not part of the pointer map itself.) Each pointer map +** entry consists of a single byte 'type' and a 4 byte parent page number. +** The PTRMAP_XXX identifiers below are the valid types. +** +** The purpose of the pointer map is to facility moving pages from one +** position in the file to another as part of autovacuum. When a page +** is moved, the pointer in its parent must be updated to point to the +** new location. The pointer map is used to locate the parent page quickly. +** +** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not +** used in this case. +** +** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number +** is not used in this case. +** +** PTRMAP_OVERFLOW1: The database page is the first page in a list of +** overflow pages. The page number identifies the page that +** contains the cell with a pointer to this overflow page. +** +** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of +** overflow pages. The page-number identifies the previous +** page in the overflow page list. +** +** PTRMAP_BTREE: The database page is a non-root btree page. The page number +** identifies the parent page in the btree. + */ + +/* A bunch of assert() statements to check the transaction state variables +** of handle p (type Btree*) are internally consistent. + */ + +/* +** The ISAUTOVACUUM macro is used within balance_nonroot() to determine +** if the database supports auto-vacuum or not. Because it is used +** within an expression that is an argument to another macro +** (sqliteMallocRaw), it is not possible to use conditional compilation. +** So, this macro is defined instead. + */ + +// C documentation +// +// /* +// ** This structure is passed around through all the PRAGMA integrity_check +// ** checking routines in order to keep track of some global state information. +// ** +// ** The aRef[] array is allocated so that there is 1 bit for each page in +// ** the database. As the integrity-check proceeds, for each page used in +// ** the database the corresponding bit is set. This allows integrity-check to +// ** detect pages that are used twice and orphaned pages (both of which +// ** indicate corruption). +// */ +type TIntegrityCk = struct { + FpBt uintptr + FpPager uintptr + FaPgRef uintptr + FnCkPage TPgno + FmxErr int32 + FnErr int32 + Frc int32 + FnStep Tu32 + FzPfx uintptr + Fv0 TPgno + Fv1 TPgno + Fv2 int32 + FerrMsg TStrAccum + Fheap uintptr + Fdb uintptr +} + +type IntegrityCk = TIntegrityCk + +type TIntegrityCk1 = struct { + FpBt uintptr + FpPager uintptr + FaPgRef uintptr + FnCkPage TPgno + FmxErr int32 + FnErr int32 + Frc int32 + FnStep Tu32 + FzPfx uintptr + Fv0 TPgno + Fv1 TPgno + Fv2 int32 + FerrMsg TStrAccum + Fheap uintptr + Fdb uintptr +} + +type IntegrityCk1 = TIntegrityCk1 + +/* +** Routines to read or write a two- and four-byte big-endian integer values. + */ + +/* +** get2byteAligned(), unlike get2byte(), requires that its argument point to a +** two-byte aligned address. get2byteAligned() is only used for accessing the +** cell addresses in a btree header. + */ + +/************** End of btreeInt.h ********************************************/ +/************** Continuing where we left off in btmutex.c ********************/ + +// C documentation +// +// /* +// ** Obtain the BtShared mutex associated with B-Tree handle p. Also, +// ** set BtShared.db to the database handle associated with p and the +// ** p->locked boolean to true. +// */ +func _lockBtreeMutex(tls *libc.TLS, p uintptr) { + Xsqlite3_mutex_enter(tls, (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fmutex) + (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fdb = (*TBtree)(unsafe.Pointer(p)).Fdb + (*TBtree)(unsafe.Pointer(p)).Flocked = uint8(1) +} + +// C documentation +// +// /* +// ** Release the BtShared mutex associated with B-Tree handle p and +// ** clear the p->locked boolean. +// */ +func _unlockBtreeMutex(tls *libc.TLS, p uintptr) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + Xsqlite3_mutex_leave(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fmutex) + (*TBtree)(unsafe.Pointer(p)).Flocked = uint8(0) +} + +// C documentation +// +// /* +// ** Enter a mutex on the given BTree object. +// ** +// ** If the object is not sharable, then no mutex is ever required +// ** and this routine is a no-op. The underlying mutex is non-recursive. +// ** But we keep a reference count in Btree.wantToLock so the behavior +// ** of this interface is recursive. +// ** +// ** To avoid deadlocks, multiple Btrees are locked in the same order +// ** by all database connections. The p->pNext is a list of other +// ** Btrees belonging to the same database connection as the p Btree +// ** which need to be locked after p. If we cannot get a lock on +// ** p, then first unlock all of the others on p->pNext, then wait +// ** for the lock to become available on p, then relock all of the +// ** subsequent Btrees that desire a lock. +// */ +func _sqlite3BtreeEnter(tls *libc.TLS, p uintptr) { + /* Some basic sanity checking on the Btree. The list of Btrees + ** connected by pNext and pPrev should be in sorted order by + ** Btree.pBt value. All elements of the list should belong to + ** the same connection. Only shared Btrees are on the list. */ + /* Check for locking consistency */ + /* We should already hold a lock on the database connection */ + /* Unless the database is sharable and unlocked, then BtShared.db + ** should already be set correctly. */ + if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) { + return + } + (*TBtree)(unsafe.Pointer(p)).FwantToLock++ + if (*TBtree)(unsafe.Pointer(p)).Flocked != 0 { + return + } + _btreeLockCarefully(tls, p) +} + +// C documentation +// +// /* This is a helper function for sqlite3BtreeLock(). By moving +// ** complex, but seldom used logic, out of sqlite3BtreeLock() and +// ** into this routine, we avoid unnecessary stack pointer changes +// ** and thus help the sqlite3BtreeLock() routine to run much faster +// ** in the common case. +// */ +func _btreeLockCarefully(tls *libc.TLS, p uintptr) { + var pLater uintptr + _ = pLater + /* In most cases, we should be able to acquire the lock we + ** want without having to go through the ascending lock + ** procedure that follows. Just be sure not to block. + */ + if Xsqlite3_mutex_try(tls, (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fmutex) == SQLITE_OK { + (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).Fdb = (*TBtree)(unsafe.Pointer(p)).Fdb + (*TBtree)(unsafe.Pointer(p)).Flocked = uint8(1) + return + } + /* To avoid deadlock, first release all locks with a larger + ** BtShared address. Then acquire our lock. Then reacquire + ** the other BtShared locks that we used to hold in ascending + ** order. + */ + pLater = (*TBtree)(unsafe.Pointer(p)).FpNext + for { + if !(pLater != 0) { + break + } + if (*TBtree)(unsafe.Pointer(pLater)).Flocked != 0 { + _unlockBtreeMutex(tls, pLater) + } + goto _1 + _1: + ; + pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext + } + _lockBtreeMutex(tls, p) + pLater = (*TBtree)(unsafe.Pointer(p)).FpNext + for { + if !(pLater != 0) { + break + } + if (*TBtree)(unsafe.Pointer(pLater)).FwantToLock != 0 { + _lockBtreeMutex(tls, pLater) + } + goto _2 + _2: + ; + pLater = (*TBtree)(unsafe.Pointer(pLater)).FpNext + } +} + +// C documentation +// +// /* +// ** Exit the recursive mutex on a Btree. +// */ +func _sqlite3BtreeLeave(tls *libc.TLS, p uintptr) { + if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { + (*TBtree)(unsafe.Pointer(p)).FwantToLock-- + if (*TBtree)(unsafe.Pointer(p)).FwantToLock == 0 { + _unlockBtreeMutex(tls, p) + } + } +} + +// C documentation +// +// /* +// ** Enter the mutex on every Btree associated with a database +// ** connection. This is needed (for example) prior to parsing +// ** a statement since we will be comparing table and column names +// ** against all schemas and we do not want those schemas being +// ** reset out from under us. +// ** +// ** There is a corresponding leave-all procedures. +// ** +// ** Enter the mutexes in ascending order by BtShared pointer address +// ** to avoid the possibility of deadlock when two threads with +// ** two or more btrees in common both try to lock all their btrees +// ** at the same instant. +// */ +func _btreeEnterAll(tls *libc.TLS, db uintptr) { + var i, skipOk int32 + var p uintptr + _, _, _ = i, p, skipOk + skipOk = int32(1) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + p = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if p != 0 && (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { + _sqlite3BtreeEnter(tls, p) + skipOk = 0 + } + goto _1 + _1: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(skipOk) +} + +func _sqlite3BtreeEnterAll(tls *libc.TLS, db uintptr) { + if int32((*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache) == 0 { + _btreeEnterAll(tls, db) + } +} + +func _btreeLeaveAll(tls *libc.TLS, db uintptr) { + var i int32 + var p uintptr + _, _ = i, p + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + p = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if p != 0 { + _sqlite3BtreeLeave(tls, p) + } + goto _1 + _1: + ; + i++ + } +} + +func _sqlite3BtreeLeaveAll(tls *libc.TLS, db uintptr) { + if int32((*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache) == 0 { + _btreeLeaveAll(tls, db) + } +} + +// C documentation +// +// /* +// ** Enter a mutex on a Btree given a cursor owned by that Btree. +// ** +// ** These entry points are used by incremental I/O only. Enter() is required +// ** any time OMIT_SHARED_CACHE is not defined, regardless of whether or not +// ** the build is threadsafe. Leave() is only required by threadsafe builds. +// */ +func _sqlite3BtreeEnterCursor(tls *libc.TLS, pCur uintptr) { + _sqlite3BtreeEnter(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree) +} + +func _sqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { + _sqlite3BtreeLeave(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree) +} + +/************** End of btmutex.c *********************************************/ +/************** Begin file btree.c *******************************************/ +/* +** 2004 April 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file implements an external (disk-based) database using BTrees. +** See the header comment on "btreeInt.h" for additional information. +** Including a description of file format and an overview of operation. + */ +/* #include "btreeInt.h" */ + +// C documentation +// +// /* +// ** The header string that appears at the beginning of every +// ** SQLite database. +// */ +var _zMagicHeader = [16]int8{'S', 'Q', 'L', 'i', 't', 'e', ' ', 'f', 'o', 'r', 'm', 'a', 't', ' ', '3'} + +/* +** Set this global variable to 1 to enable tracing using the TRACE +** macro. + */ + +/* +** Extract a 2-byte big-endian integer from an array of unsigned bytes. +** But if the value is zero, make it 65536. +** +** This routine is used to extract the "offset to cell content area" value +** from the header of a btree page. If the page size is 65536 and the page +** is empty, the offset should be 65536, but the 2-byte value stores zero. +** This routine makes the necessary adjustment to 65536. + */ + +/* +** Values passed as the 5th argument to allocateBtreePage() + */ + +/* +** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not +** defined, or 0 if it is. For example: +** +** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum); + */ + +// C documentation +// +// /* +// ** A list of BtShared objects that are eligible for participation +// ** in shared cache. This variable has file scope during normal builds, +// ** but the test harness needs to access it so we make it global for +// ** test builds. +// ** +// ** Access to this variable is protected by SQLITE_MUTEX_STATIC_MAIN. +// */ +var _sqlite3SharedCacheList = uintptr(0) + +// C documentation +// +// /* +// ** Enable or disable the shared pager and schema features. +// ** +// ** This routine has no effect on existing database connections. +// ** The shared cache setting effects only future calls to +// ** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). +// */ +func Xsqlite3_enable_shared_cache(tls *libc.TLS, enable int32) (r int32) { + _sqlite3Config.FsharedCacheEnabled = enable + return SQLITE_OK +} + +/* +** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single +** (MemPage*) as an argument. The (MemPage*) must not be NULL. +** +** If SQLITE_DEBUG is not defined, then this macro is equivalent to +** SQLITE_CORRUPT_BKPT. Or, if SQLITE_DEBUG is set, then the log message +** normally produced as a side-effect of SQLITE_CORRUPT_BKPT is augmented +** with the page number and filename associated with the (MemPage*). + */ + +// C documentation +// +// /* +// ** Query to see if Btree handle p may obtain a lock of type eLock +// ** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return +// ** SQLITE_OK if the lock may be obtained (by calling +// ** setSharedCacheTableLock()), or SQLITE_LOCKED if not. +// */ +func _querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab TPgno, eLock Tu8) (r int32) { + var pBt, pIter, p2 uintptr + _, _, _ = pBt, pIter, p2 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + /* If requesting a write-lock, then the Btree must have an open write + ** transaction on this file. And, obviously, for this to be so there + ** must be an open write transaction on the file itself. + */ + /* This routine is a no-op if the shared-cache is not enabled */ + if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) { + return SQLITE_OK + } + /* If some other connection is holding an exclusive lock, the + ** requested lock may not be obtained. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FpWriter != p && int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_EXCLUSIVE) != 0 { + _sqlite3ConnectionBlocked(tls, (*TBtree)(unsafe.Pointer(p)).Fdb, (*TBtree)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpWriter)).Fdb) + return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(1)<eLock!=eLock) in the following if(...) + ** statement is a simplification of: + ** + ** (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK) + ** + ** since we know that if eLock==WRITE_LOCK, then no other connection + ** may hold a WRITE_LOCK on any table in this file (since there can + ** only be a single writer). + */ + if (*TBtLock)(unsafe.Pointer(pIter)).FpBtree != p && (*TBtLock)(unsafe.Pointer(pIter)).FiTable == iTab && int32((*TBtLock)(unsafe.Pointer(pIter)).FeLock) != int32(eLock) { + _sqlite3ConnectionBlocked(tls, (*TBtree)(unsafe.Pointer(p)).Fdb, (*TBtree)(unsafe.Pointer((*TBtLock)(unsafe.Pointer(pIter)).FpBtree)).Fdb) + if int32(eLock) == int32(WRITE_LOCK) { + p2 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTS_PENDING)) + } + return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(1)< int32((*TBtLock)(unsafe.Pointer(pLock)).FeLock) { + (*TBtLock)(unsafe.Pointer(pLock)).FeLock = eLock + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Release all the table locks (locks obtained via calls to +// ** the setSharedCacheTableLock() procedure) held by Btree object p. +// ** +// ** This function assumes that Btree p has an open read or write +// ** transaction. If it does not, then the BTS_PENDING flag +// ** may be incorrectly cleared. +// */ +func _clearAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { + var pBt, pLock, ppIter, p1, p2 uintptr + _, _, _, _, _ = pBt, pLock, ppIter, p1, p2 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + ppIter = pBt + 120 + for *(*uintptr)(unsafe.Pointer(ppIter)) != 0 { + pLock = *(*uintptr)(unsafe.Pointer(ppIter)) + if (*TBtLock)(unsafe.Pointer(pLock)).FpBtree == p { + *(*uintptr)(unsafe.Pointer(ppIter)) = (*TBtLock)(unsafe.Pointer(pLock)).FpNext + if (*TBtLock)(unsafe.Pointer(pLock)).FiTable != uint32(1) { + Xsqlite3_free(tls, pLock) + } + } else { + ppIter = pLock + 16 + } + } + if (*TBtShared)(unsafe.Pointer(pBt)).FpWriter == p { + (*TBtShared)(unsafe.Pointer(pBt)).FpWriter = uintptr(0) + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTS_EXCLUSIVE) | libc.Int32FromInt32(BTS_PENDING))) + } else { + if (*TBtShared)(unsafe.Pointer(pBt)).FnTransaction == int32(2) { + /* This function is called when Btree p is concluding its + ** transaction. If there currently exists a writer, and p is not + ** that writer, then the number of locks held by connections other + ** than the writer must be about to drop to zero. In this case + ** set the BTS_PENDING flag to 0. + ** + ** If there is not currently a writer, then BTS_PENDING must + ** be zero already. So this next line is harmless in that case. + */ + p2 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTS_PENDING)) + } + } +} + +// C documentation +// +// /* +// ** This function changes all write-locks held by Btree p into read-locks. +// */ +func _downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { + var pBt, pLock, p1 uintptr + _, _, _ = pBt, pLock, p1 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + if (*TBtShared)(unsafe.Pointer(pBt)).FpWriter == p { + (*TBtShared)(unsafe.Pointer(pBt)).FpWriter = uintptr(0) + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTS_EXCLUSIVE) | libc.Int32FromInt32(BTS_PENDING))) + pLock = (*TBtShared)(unsafe.Pointer(pBt)).FpLock + for { + if !(pLock != 0) { + break + } + (*TBtLock)(unsafe.Pointer(pLock)).FeLock = uint8(READ_LOCK) + goto _2 + _2: + ; + pLock = (*TBtLock)(unsafe.Pointer(pLock)).FpNext + } + } +} + +/* Forward reference */ + +/* +***** This routine is used inside of assert() only **** +** +** Verify that the cursor holds the mutex on its BtShared + */ + +/* +** Invalidate the overflow cache of the cursor passed as the first argument. +** on the shared btree structure pBt. + */ + +// C documentation +// +// /* +// ** Invalidate the overflow page-list cache for all cursors opened +// ** on the shared btree structure pBt. +// */ +func _invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { + var p, p2 uintptr + _, _ = p, p2 + p = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor + for { + if !(p != 0) { + break + } + p2 = p + 1 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) + goto _1 + _1: + ; + p = (*TBtCursor)(unsafe.Pointer(p)).FpNext + } +} + +// C documentation +// +// /* +// ** This function is called before modifying the contents of a table +// ** to invalidate any incrblob cursors that are open on the +// ** row or one of the rows being modified. +// ** +// ** If argument isClearTable is true, then the entire contents of the +// ** table is about to be deleted. In this case invalidate all incrblob +// ** cursors open on any row within the table with root-page pgnoRoot. +// ** +// ** Otherwise, if argument isClearTable is false, then the row with +// ** rowid iRow is being replaced or deleted. In this case invalidate +// ** only those incrblob cursors open on that specific row. +// */ +func _invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot TPgno, iRow Ti64, isClearTable int32) { + var p uintptr + _ = p + (*TBtree)(unsafe.Pointer(pBtree)).FhasIncrblobCur = uint8(0) + p = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor + for { + if !(p != 0) { + break + } + if int32((*TBtCursor)(unsafe.Pointer(p)).FcurFlags)&int32(BTCF_Incrblob) != 0 { + (*TBtree)(unsafe.Pointer(pBtree)).FhasIncrblobCur = uint8(1) + if (*TBtCursor)(unsafe.Pointer(p)).FpgnoRoot == pgnoRoot && (isClearTable != 0 || (*TBtCursor)(unsafe.Pointer(p)).Finfo.FnKey == iRow) { + (*TBtCursor)(unsafe.Pointer(p)).FeState = uint8(CURSOR_INVALID) + } + } + goto _1 + _1: + ; + p = (*TBtCursor)(unsafe.Pointer(p)).FpNext + } +} + +// C documentation +// +// /* +// ** Set bit pgno of the BtShared.pHasContent bitvec. This is called +// ** when a page that previously contained data becomes a free-list leaf +// ** page. +// ** +// ** The BtShared.pHasContent bitvec exists to work around an obscure +// ** bug caused by the interaction of two useful IO optimizations surrounding +// ** free-list leaf pages: +// ** +// ** 1) When all data is deleted from a page and the page becomes +// ** a free-list leaf page, the page is not written to the database +// ** (as free-list leaf pages contain no meaningful data). Sometimes +// ** such a page is not even journalled (as it will not be modified, +// ** why bother journalling it?). +// ** +// ** 2) When a free-list leaf page is reused, its content is not read +// ** from the database or written to the journal file (why should it +// ** be, if it is not at all meaningful?). +// ** +// ** By themselves, these optimizations work fine and provide a handy +// ** performance boost to bulk delete or insert operations. However, if +// ** a page is moved to the free-list and then reused within the same +// ** transaction, a problem comes up. If the page is not journalled when +// ** it is moved to the free-list and it is also not journalled when it +// ** is extracted from the free-list and reused, then the original data +// ** may be lost. In the event of a rollback, it may not be possible +// ** to restore the database to its original configuration. +// ** +// ** The solution is the BtShared.pHasContent bitvec. Whenever a page is +// ** moved to become a free-list leaf page, the corresponding bit is +// ** set in the bitvec. Whenever a leaf page is extracted from the free-list, +// ** optimization 2 above is omitted if the corresponding bit is already +// ** set in BtShared.pHasContent. The contents of the bitvec are cleared +// ** at the end of every transaction. +// */ +func _btreeSetHasContent(tls *libc.TLS, pBt uintptr, pgno TPgno) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if !((*TBtShared)(unsafe.Pointer(pBt)).FpHasContent != 0) { + (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent = _sqlite3BitvecCreate(tls, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) + if !((*TBtShared)(unsafe.Pointer(pBt)).FpHasContent != 0) { + rc = int32(SQLITE_NOMEM) + } + } + if rc == SQLITE_OK && pgno <= _sqlite3BitvecSize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent) { + rc = _sqlite3BitvecSet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent, pgno) + } + return rc +} + +// C documentation +// +// /* +// ** Query the BtShared.pHasContent vector. +// ** +// ** This function is called when a free-list leaf page is removed from the +// ** free-list for reuse. It returns false if it is safe to retrieve the +// ** page from the pager layer with the 'no-content' flag set. True otherwise. +// */ +func _btreeGetHasContent(tls *libc.TLS, pBt uintptr, pgno TPgno) (r int32) { + var p uintptr + _ = p + p = (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent + return libc.BoolInt32(p != 0 && (pgno > _sqlite3BitvecSize(tls, p) || _sqlite3BitvecTestNotNull(tls, p, pgno) != 0)) +} + +// C documentation +// +// /* +// ** Clear (destroy) the BtShared.pHasContent bitvec. This should be +// ** invoked at the conclusion of each write-transaction. +// */ +func _btreeClearHasContent(tls *libc.TLS, pBt uintptr) { + _sqlite3BitvecDestroy(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent) + (*TBtShared)(unsafe.Pointer(pBt)).FpHasContent = uintptr(0) +} + +// C documentation +// +// /* +// ** Release all of the apPage[] pages for a cursor. +// */ +func _btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { + var i int32 + _ = i + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= 0 { + i = 0 + for { + if !(i < int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)) { + break + } + _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage = int8(-int32(1)) + } +} + +// C documentation +// +// /* +// ** The cursor passed as the only argument must point to a valid entry +// ** when this function is called (i.e. have eState==CURSOR_VALID). This +// ** function saves the current cursor key in variables pCur->nKey and +// ** pCur->pKey. SQLITE_OK is returned if successful or an SQLite error +// ** code otherwise. +// ** +// ** If the cursor is open on an intkey table, then the integer key +// ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to +// ** NULL. If the cursor is open on a non-intkey table, then pCur->pKey is +// ** set to point to a malloced buffer pCur->nKey bytes in size containing +// ** the key. +// */ +func _saveCursorKey(tls *libc.TLS, pCur uintptr) (r int32) { + var pKey uintptr + var rc int32 + _, _ = pKey, rc + rc = SQLITE_OK + if (*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey != 0 { + /* Only the rowid is required for a table btree */ + (*TBtCursor)(unsafe.Pointer(pCur)).FnKey = _sqlite3BtreeIntegerKey(tls, pCur) + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).FnKey = int64(_sqlite3BtreePayloadSize(tls, pCur)) + pKey = _sqlite3Malloc(tls, uint64((*TBtCursor)(unsafe.Pointer(pCur)).FnKey+int64(9)+int64(8))) + if pKey != 0 { + rc = _sqlite3BtreePayload(tls, pCur, uint32(0), uint32(int32((*TBtCursor)(unsafe.Pointer(pCur)).FnKey)), pKey) + if rc == SQLITE_OK { + libc.Xmemset(tls, pKey+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FnKey), 0, uint64(libc.Int32FromInt32(9)+libc.Int32FromInt32(8))) + (*TBtCursor)(unsafe.Pointer(pCur)).FpKey = pKey + } else { + Xsqlite3_free(tls, pKey) + } + } else { + rc = int32(SQLITE_NOMEM) + } + } + return rc +} + +// C documentation +// +// /* +// ** Save the current cursor position in the variables BtCursor.nKey +// ** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK. +// ** +// ** The caller must ensure that the cursor is valid (has eState==CURSOR_VALID) +// ** prior to calling this routine. +// */ +func _saveCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { + var rc int32 + var p1 uintptr + _, _ = rc, p1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_Pinned) != 0 { + return libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(11)< int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) { + rc = _sqlite3CorruptError(tls, int32(71032)) + } else { + rc = _sqlite3BtreeIndexMoveto(tls, pCur, pIdxKey, pRes) + } + _sqlite3DbFree(tls, (*TKeyInfo1)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo)).Fdb, pIdxKey) + } else { + pIdxKey = uintptr(0) + rc = _sqlite3BtreeTableMoveto(tls, pCur, nKey, bias, pRes) + } + return rc +} + +// C documentation +// +// /* +// ** Restore the cursor to the position it was in (or as close to as possible) +// ** when saveCursorPosition() was called. Note that this call deletes the +// ** saved position info stored by saveCursorPosition(), so there can be +// ** at most one effective restoreCursorPosition() call after each +// ** saveCursorPosition(). +// */ +func _btreeRestoreCursorPosition(tls *libc.TLS, pCur uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* skipNext at bp+0 */ int32 + _ = rc + *(*int32)(unsafe.Pointer(bp)) = 0 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_FAULT) { + return (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext + } + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + if _sqlite3FaultSim(tls, int32(410)) != 0 { + rc = int32(SQLITE_IOERR) + } else { + rc = _btreeMoveto(tls, pCur, (*TBtCursor)(unsafe.Pointer(pCur)).FpKey, (*TBtCursor)(unsafe.Pointer(pCur)).FnKey, 0, bp) + } + if rc == SQLITE_OK { + Xsqlite3_free(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpKey) + (*TBtCursor)(unsafe.Pointer(pCur)).FpKey = uintptr(0) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext = *(*int32)(unsafe.Pointer(bp)) + } + if (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext != 0 && int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_SKIPNEXT) + } + } + return rc +} + +// C documentation +// +// /* +// ** Determine whether or not a cursor has moved from the position where +// ** it was last placed, or has been invalidated for any other reason. +// ** Cursors can move when the row they are pointing at is deleted out +// ** from under them, for example. Cursor might also move if a btree +// ** is rebalanced. +// ** +// ** Calling this routine with a NULL cursor pointer returns false. +// ** +// ** Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor +// ** back to where it ought to be if this routine returns true. +// */ +func _sqlite3BtreeCursorHasMoved(tls *libc.TLS, pCur uintptr) (r int32) { + return libc.BoolInt32(CURSOR_VALID != int32(*(*Tu8)(unsafe.Pointer(pCur)))) +} + +// C documentation +// +// /* +// ** Return a pointer to a fake BtCursor object that will always answer +// ** false to the sqlite3BtreeCursorHasMoved() routine above. The fake +// ** cursor returned must not be used with any other Btree interface. +// */ +func _sqlite3BtreeFakeValidCursor(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_fakeCursor)) +} + +var _fakeCursor Tu8 + +// C documentation +// +// /* +// ** This routine restores a cursor back to its original position after it +// ** has been moved by some outside activity (such as a btree rebalance or +// ** a row having been deleted out from under the cursor). +// ** +// ** On success, the *pDifferentRow parameter is false if the cursor is left +// ** pointing at exactly the same row. *pDifferntRow is the row the cursor +// ** was pointing to has been deleted, forcing the cursor to point to some +// ** nearby row. +// ** +// ** This routine should only be called for a cursor that just returned +// ** TRUE from sqlite3BtreeCursorHasMoved(). +// */ +func _sqlite3BtreeCursorRestore(tls *libc.TLS, pCur uintptr, pDifferentRow uintptr) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + v1 = _btreeRestoreCursorPosition(tls, pCur) + } else { + v1 = SQLITE_OK + } + rc = v1 + if rc != 0 { + *(*int32)(unsafe.Pointer(pDifferentRow)) = int32(1) + return rc + } + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + *(*int32)(unsafe.Pointer(pDifferentRow)) = int32(1) + } else { + *(*int32)(unsafe.Pointer(pDifferentRow)) = 0 + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Provide flag hints to the cursor. +// */ +func _sqlite3BtreeCursorHintFlags(tls *libc.TLS, pCur uintptr, x uint32) { + (*TBtCursor)(unsafe.Pointer(pCur)).Fhints = uint8(x) +} + +// C documentation +// +// /* +// ** Given a page number of a regular database page, return the page +// ** number for the pointer-map page that contains the entry for the +// ** input page number. +// ** +// ** Return 0 (not a valid page) for pgno==1 since there is +// ** no pointer map associated with page 1. The integrity_check logic +// ** requires that ptrmapPageno(*,1)!=1. +// */ +func _ptrmapPageno(tls *libc.TLS, pBt uintptr, pgno TPgno) (r TPgno) { + var iPtrMap, ret TPgno + var nPagesPerMapPage int32 + _, _, _ = iPtrMap, nPagesPerMapPage, ret + if pgno < uint32(2) { + return uint32(0) + } + nPagesPerMapPage = int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(5) + uint32(1)) + iPtrMap = (pgno - uint32(2)) / uint32(nPagesPerMapPage) + ret = iPtrMap*uint32(nPagesPerMapPage) + uint32(2) + if ret == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + ret++ + } + return ret +} + +// C documentation +// +// /* +// ** Write an entry into the pointer map. +// ** +// ** This routine updates the pointer map entry for page number 'key' +// ** so that it maps to type 'eType' and parent page number 'pgno'. +// ** +// ** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is +// ** a no-op. If an error occurs, the appropriate error code is written +// ** into *pRC. +// */ +func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, pRC uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPtrmap TPgno + var offset, rc, v1 int32 + var pPtrmap uintptr + var _ /* pDbPage at bp+0 */ uintptr + _, _, _, _, _ = iPtrmap, offset, pPtrmap, rc, v1 /* Return code from subfunctions */ + if *(*int32)(unsafe.Pointer(pRC)) != 0 { + return + } + /* The super-journal page number must never be used as a pointer map page */ + if key == uint32(0) { + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71230)) + return + } + iPtrmap = _ptrmapPageno(tls, pBt, key) + rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, iPtrmap, bp, 0) + if rc != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + if int32(*(*int8)(unsafe.Pointer(_sqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp)))))) != 0 { + /* The first byte of the extra data is the MemPage.isInit byte. + ** If that byte is set, it means this page is also being used + ** as a btree page. */ + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71243)) + goto ptrmap_exit + } + offset = int32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) + if offset < 0 { + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71248)) + goto ptrmap_exit + } + pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) + if int32(eType) != int32(*(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset)))) || _sqlite3Get4byte(tls, pPtrmap+uintptr(offset+int32(1))) != parent { + v1 = _sqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp))) + rc = v1 + *(*int32)(unsafe.Pointer(pRC)) = v1 + if rc == SQLITE_OK { + *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) = eType + _sqlite3Put4byte(tls, pPtrmap+uintptr(offset+int32(1)), parent) + } + } +ptrmap_exit: + ; + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Read an entry from the pointer map. +// ** +// ** This routine retrieves the pointer map entry for page 'key', writing +// ** the type and parent page number to *pEType and *pPgno respectively. +// ** An error code is returned if something goes wrong, otherwise SQLITE_OK. +// */ +func _ptrmapGet(tls *libc.TLS, pBt uintptr, key TPgno, pEType uintptr, pPgno uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPtrmap, offset, rc int32 + var pPtrmap uintptr + var _ /* pDbPage at bp+0 */ uintptr + _, _, _, _ = iPtrmap, offset, pPtrmap, rc + iPtrmap = int32(_ptrmapPageno(tls, pBt, key)) + rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uint32(iPtrmap), bp, 0) + if rc != 0 { + return rc + } + pPtrmap = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) + offset = int32(libc.Uint32FromInt32(5) * (key - uint32(iPtrmap) - libc.Uint32FromInt32(1))) + if offset < 0 { + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + return _sqlite3CorruptError(tls, int32(71293)) + } + *(*Tu8)(unsafe.Pointer(pEType)) = *(*Tu8)(unsafe.Pointer(pPtrmap + uintptr(offset))) + if pPgno != 0 { + *(*TPgno)(unsafe.Pointer(pPgno)) = _sqlite3Get4byte(tls, pPtrmap+uintptr(offset+int32(1))) + } + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + if int32(*(*Tu8)(unsafe.Pointer(pEType))) < int32(1) || int32(*(*Tu8)(unsafe.Pointer(pEType))) > int32(5) { + return _sqlite3CorruptError(tls, int32(71301)) + } + return SQLITE_OK +} + +/* +** Given a btree page and a cell index (0 means the first cell on +** the page, 1 means the second cell, and so forth) return a pointer +** to the cell content. +** +** findCellPastPtr() does the same except it skips past the initial +** 4-byte child pointer found on interior pages, if there is one. +** +** This routine works only for pages that do not contain overflow cells. + */ + +// C documentation +// +// /* +// ** This is common tail processing for btreeParseCellPtr() and +// ** btreeParseCellPtrIndex() for the case when the cell does not fit entirely +// ** on a single B-tree page. Make necessary adjustments to the CellInfo +// ** structure. +// */ +func _btreeParseCellAdjustSizeForOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { + var maxLocal, minLocal, surplus int32 + _, _, _ = maxLocal, minLocal, surplus /* Overflow payload available for local storage */ + minLocal = int32((*TMemPage)(unsafe.Pointer(pPage)).FminLocal) + maxLocal = int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) + surplus = int32(uint32(minLocal) + ((*TCellInfo)(unsafe.Pointer(pInfo)).FnPayload-uint32(minLocal))%((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4))) + if surplus <= maxLocal { + (*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal = uint16(surplus) + } else { + (*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal = uint16(minLocal) + } + (*TCellInfo)(unsafe.Pointer(pInfo)).FnSize = uint16(int32(uint16(t__predefined_ptrdiff_t((*TCellInfo)(unsafe.Pointer(pInfo)).FpPayload+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal))-int64(pCell))) + int32(4)) +} + +// C documentation +// +// /* +// ** Given a record with nPayload bytes of payload stored within btree +// ** page pPage, return the number of bytes of payload stored locally. +// */ +func _btreePayloadToLocal(tls *libc.TLS, pPage uintptr, nPayload Ti64) (r int32) { + var maxLocal, minLocal, surplus, v1 int32 + _, _, _, _ = maxLocal, minLocal, surplus, v1 /* Maximum amount of payload held locally */ + maxLocal = int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) + if nPayload <= int64(maxLocal) { + return int32(nPayload) + } else { /* Overflow payload available for local storage */ + minLocal = int32((*TMemPage)(unsafe.Pointer(pPage)).FminLocal) + surplus = int32(int64(minLocal) + (nPayload-int64(minLocal))%int64((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-libc.Uint32FromInt32(4))) + if surplus <= maxLocal { + v1 = surplus + } else { + v1 = minLocal + } + return v1 + } + return r +} + +// C documentation +// +// /* +// ** The following routines are implementations of the MemPage.xParseCell() +// ** method. +// ** +// ** Parse a cell content block and fill in the CellInfo structure. +// ** +// ** btreeParseCellPtr() => table btree leaf nodes +// ** btreeParseCellNoPayload() => table btree internal nodes +// ** btreeParseCellPtrIndex() => index btree nodes +// ** +// ** There is also a wrapper function btreeParseCell() that works for +// ** all MemPage types and that references the cell by index rather than +// ** by pointer. +// */ +func _btreeParseCellPtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { + _ = pPage + (*TCellInfo)(unsafe.Pointer(pInfo)).FnSize = uint16(int32(4) + int32(_sqlite3GetVarint(tls, pCell+4, pInfo))) + (*TCellInfo)(unsafe.Pointer(pInfo)).FnPayload = uint32(0) + (*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal = uint16(0) + (*TCellInfo)(unsafe.Pointer(pInfo)).FpPayload = uintptr(0) + return +} + +func _btreeParseCellPtr(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nPayload Tu32 + var pEnd, pIter, v1, v11, v13, v15, v16, v3, v5, v7, v9 uintptr + var x, v10, v12, v14, v2, v4, v6, v8 Tu8 + var _ /* iKey at bp+0 */ Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = nPayload, pEnd, pIter, x, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 /* Extracted Key value */ + pIter = pCell + /* The next block of code is equivalent to: + ** + ** pIter += getVarint32(pIter, nPayload); + ** + ** The code is inlined to avoid a function call. + */ + nPayload = uint32(*(*Tu8)(unsafe.Pointer(pIter))) + if nPayload >= uint32(0x80) { + pEnd = pIter + 8 + nPayload &= uint32(0x7f) + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(pIter))) >= int32(0x80) && pIter < pEnd { + pIter++ + v1 = pIter + nPayload = nPayload<nKey); + ** + ** The code is inlined and the loop is unrolled for performance. + ** This routine is a high-runner. + */ + *(*Tu64)(unsafe.Pointer(bp)) = uint64(*(*Tu8)(unsafe.Pointer(pIter))) + if *(*Tu64)(unsafe.Pointer(bp)) >= uint64(0x80) { + pIter++ + v3 = pIter + v2 = *(*Tu8)(unsafe.Pointer(v3)) + x = v2 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v5 = pIter + v4 = *(*Tu8)(unsafe.Pointer(v5)) + x = v4 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v7 = pIter + v6 = *(*Tu8)(unsafe.Pointer(v7)) + x = v6 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v9 = pIter + v8 = *(*Tu8)(unsafe.Pointer(v9)) + x = v8 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v11 = pIter + v10 = *(*Tu8)(unsafe.Pointer(v11)) + x = v10 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v13 = pIter + v12 = *(*Tu8)(unsafe.Pointer(v13)) + x = v12 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v15 = pIter + v14 = *(*Tu8)(unsafe.Pointer(v15)) + x = v14 + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= int32(0x80) { + pIter++ + v16 = pIter + *(*Tu64)(unsafe.Pointer(bp)) = *(*Tu64)(unsafe.Pointer(bp))<= uint32(0x80) { + pEnd = pIter + 8 + nPayload &= uint32(0x7f) + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(pIter))) >= int32(0x80) && pIter < pEnd { + pIter++ + v1 = pIter + nPayload = nPayload< table internal nodes +// ** cellSizePtrTableLeaf() => table leaf nodes +// ** cellSizePtr() => index internal nodes +// ** cellSizeIdxLeaf() => index leaf nodes +// */ +func _cellSizePtr(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { + var minLocal int32 + var nSize Tu32 + var pEnd, pIter, v1 uintptr + _, _, _, _, _ = minLocal, nSize, pEnd, pIter, v1 + pIter = pCell + uintptr(4) /* Size value to return */ + nSize = uint32(*(*Tu8)(unsafe.Pointer(pIter))) + if nSize >= uint32(0x80) { + pEnd = pIter + 8 + nSize &= uint32(0x7f) + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(pIter))) >= int32(0x80) && pIter < pEnd { + pIter++ + v1 = pIter + nSize = nSize< uint32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + nSize = uint32(minLocal) + } + nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) + } + return uint16(nSize) +} + +func _cellSizePtrIdxLeaf(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { + var minLocal int32 + var nSize Tu32 + var pEnd, pIter, v1 uintptr + _, _, _, _, _ = minLocal, nSize, pEnd, pIter, v1 + pIter = pCell /* Size value to return */ + nSize = uint32(*(*Tu8)(unsafe.Pointer(pIter))) + if nSize >= uint32(0x80) { + pEnd = pIter + 8 + nSize &= uint32(0x7f) + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(pIter))) >= int32(0x80) && pIter < pEnd { + pIter++ + v1 = pIter + nSize = nSize< uint32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + nSize = uint32(minLocal) + } + nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) + } + return uint16(nSize) +} + +func _cellSizePtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { + var pEnd, pIter, v1 uintptr + _, _, _ = pEnd, pIter, v1 + pIter = pCell + uintptr(4) /* End mark for a varint */ + _ = pPage + pEnd = pIter + uintptr(9) + for { + v1 = pIter + pIter++ + if !(int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0 && pIter < pEnd) { + break + } + } + return uint16(int64(pIter) - int64(pCell)) +} + +func _cellSizePtrTableLeaf(tls *libc.TLS, pPage uintptr, pCell uintptr) (r Tu16) { + var minLocal int32 + var nSize Tu32 + var pEnd, pIter, v1, v11, v13, v15, v2, v3, v5, v7, v9 uintptr + var v10, v12, v14, v16, v4, v6, v8 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = minLocal, nSize, pEnd, pIter, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 + pIter = pCell /* Size value to return */ + nSize = uint32(*(*Tu8)(unsafe.Pointer(pIter))) + if nSize >= uint32(0x80) { + pEnd = pIter + 8 + nSize &= uint32(0x7f) + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(pIter))) >= int32(0x80) && pIter < pEnd { + pIter++ + v1 = pIter + nSize = nSize< uint32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + nSize = uint32(minLocal) + } + nSize += uint32(int32(4) + int32(uint16(int64(pIter)-int64(pCell)))) + } + return uint16(nSize) +} + +// C documentation +// +// /* +// ** The cell pCell is currently part of page pSrc but will ultimately be part +// ** of pPage. (pSrc and pPage are often the same.) If pCell contains a +// ** pointer to an overflow page, insert an entry into the pointer-map for +// ** the overflow page that will be valid after pCell has been moved to pPage. +// */ +func _ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr, pRC uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ovfl TPgno + var _ /* info at bp+0 */ TCellInfo + _ = ovfl + if *(*int32)(unsafe.Pointer(pRC)) != 0 { + return + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) + if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { + if uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) && uint64(pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal)) > uint64((*TMemPage)(unsafe.Pointer(pSrc)).FaDataEnd) { + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(71741)) + return + } + ovfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-int32(4))) + _ptrmapPut(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpBt, ovfl, uint8(PTRMAP_OVERFLOW1), (*TMemPage)(unsafe.Pointer(pPage)).Fpgno, pRC) + } +} + +// C documentation +// +// /* +// ** Defragment the page given. This routine reorganizes cells within the +// ** page so that there are no free-blocks on the free-block list. +// ** +// ** Parameter nMaxFrag is the maximum amount of fragmented space that may be +// ** present in the page after this routine returns. +// ** +// ** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a +// ** b-tree page so that there are no freeblocks or fragment bytes, all +// ** unused bytes are contained in the unallocated space region, and all +// ** cells are packed tightly at the end of the page. +// */ +func _defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) (r int32) { + var cbrk, cellOffset, hdr, i, iCellFirst, iCellLast, iCellStart, iFree, iFree2, nCell, pc, size, sz, sz2, top, usableSize int32 + var data, pAddr, pAddr1, pEnd, src, temp uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cbrk, cellOffset, data, hdr, i, iCellFirst, iCellLast, iCellStart, iFree, iFree2, nCell, pAddr, pAddr1, pEnd, pc, size, src, sz, sz2, temp, top, usableSize /* First cell offset in input */ + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + hdr = int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) + cellOffset = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) + nCell = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + iCellFirst = cellOffset + int32(2)*nCell + usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + /* This block handles pages with two or fewer free blocks and nMaxFrag + ** or fewer fragmented bytes. In this case it is faster to move the + ** two (or one) blocks of cells using memmove() and add the required + ** offsets to each pointer in the cell-pointer array than it is to + ** reconstruct the entire page. */ + if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) <= nMaxFrag { + iFree = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))))< usableSize-int32(4) { + return _sqlite3CorruptError(tls, int32(71799)) + } + if iFree != 0 { + iFree2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree))))< usableSize-int32(4) { + return _sqlite3CorruptError(tls, int32(71802)) + } + if 0 == iFree2 || int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(1))))) == 0 { + pEnd = data + uintptr(cellOffset+nCell*int32(2)) + sz2 = 0 + sz = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree+int32(2)))))<= iFree { + return _sqlite3CorruptError(tls, int32(71810)) + } + if iFree2 != 0 { + if iFree+sz > iFree2 { + return _sqlite3CorruptError(tls, int32(71813)) + } + sz2 = int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2+int32(2)))))< usableSize { + return _sqlite3CorruptError(tls, int32(71815)) + } + libc.Xmemmove(tls, data+uintptr(iFree+sz+sz2), data+uintptr(iFree+sz), uint64(iFree2-(iFree+sz))) + sz += sz2 + } else { + if iFree+sz > usableSize { + return _sqlite3CorruptError(tls, int32(71819)) + } + } + cbrk = top + sz + libc.Xmemmove(tls, data+uintptr(cbrk), data+uintptr(top), uint64(iFree-top)) + pAddr = data + uintptr(cellOffset) + for { + if !(pAddr < pEnd) { + break + } + pc = int32(*(*Tu8)(unsafe.Pointer(pAddr)))<> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pAddr + 1)) = uint8(pc + sz) + } else { + if pc < iFree2 { + *(*Tu8)(unsafe.Pointer(pAddr)) = uint8((pc + sz2) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pAddr + 1)) = uint8(pc + sz2) + } + } + goto _1 + _1: + ; + pAddr += uintptr(2) + } + goto defragment_out + } + } + } + cbrk = usableSize + iCellLast = usableSize - int32(4) + iCellStart = int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))))< 0 { + temp = _sqlite3PagerTempSpace(tls, (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FpPager) + libc.Xmemcpy(tls, temp, data, uint64(usableSize)) + src = temp + i = 0 + for { + if !(i < nCell) { + break + } /* The i-th cell pointer */ + pAddr1 = data + uintptr(cellOffset+i*int32(2)) + pc = int32(*(*Tu8)(unsafe.Pointer(pAddr1)))< iCellLast { + return _sqlite3CorruptError(tls, int32(71852)) + } + size = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, src+uintptr(pc))) + cbrk -= size + if cbrk < iCellStart || pc+size > usableSize { + return _sqlite3CorruptError(tls, int32(71858)) + } + *(*Tu8)(unsafe.Pointer(pAddr1)) = uint8(cbrk >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pAddr1 + 1)) = uint8(cbrk) + libc.Xmemcpy(tls, data+uintptr(cbrk), src+uintptr(pc), uint64(size)) + goto _2 + _2: + ; + i++ + } + } + *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) +defragment_out: + ; + if int32(*(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))))+cbrk-iCellFirst != (*TMemPage)(unsafe.Pointer(pPage)).FnFree { + return _sqlite3CorruptError(tls, int32(71872)) + } + *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8(cbrk >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(cbrk) + *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))) = uint8(0) + *(*uint8)(unsafe.Pointer(data + uintptr(hdr+int32(2)))) = uint8(0) + libc.Xmemset(tls, data+uintptr(iCellFirst), 0, uint64(cbrk-iCellFirst)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Search the free-list on page pPg for space to store a cell nByte bytes in +// ** size. If one can be found, return a pointer to the space and remove it +// ** from the free-list. +// ** +// ** If no suitable space can be found on the free-list, return NULL. +// ** +// ** This function may detect corruption within pPg. If corruption is +// ** detected then *pRc is set to SQLITE_CORRUPT and NULL is returned. +// ** +// ** Slots on the free list that are between 1 and 3 bytes larger than nByte +// ** will be ignored if adding the extra space to the fragmentation count +// ** causes the fragmentation count to exceed 60. +// */ +func _pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) (r uintptr) { + var aData, pTmp, p2 uintptr + var hdr, iAddr, maxPC, pc, size, x, v1 int32 + _, _, _, _, _, _, _, _, _, _ = aData, hdr, iAddr, maxPC, pTmp, pc, size, x, v1, p2 + hdr = int32((*TMemPage)(unsafe.Pointer(pPg)).FhdrOffset) /* Offset to page header */ + aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData /* Page data */ + iAddr = hdr + int32(1) /* Address of ptr to pc */ + pTmp = aData + uintptr(iAddr) /* Temporary ptr into aData[] */ + pc = int32(*(*Tu8)(unsafe.Pointer(pTmp)))<= 0 { + if x < int32(4) { + /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total + ** number of bytes in fragments may not exceed 60. */ + if int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(7))))) > int32(57) { + return uintptr(0) + } + /* Remove the slot from the free-list. Update the number of + ** fragmented bytes within the page. */ + libc.Xmemcpy(tls, aData+uintptr(iAddr), aData+uintptr(pc), uint64(2)) + p2 = aData + uintptr(hdr+int32(7)) + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) + int32(uint8(x))) + return aData + uintptr(pc) + } else { + if x+pc > maxPC { + /* This slot extends off the end of the usable part of the page */ + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71929)) + return uintptr(0) + } else { + /* The slot remains on the free-list. Reduce its size to account + ** for the portion used by the new allocation. */ + *(*Tu8)(unsafe.Pointer(aData + uintptr(pc+int32(2)))) = uint8(x >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(pc+int32(2)) + 1)) = uint8(x) + } + } + return aData + uintptr(pc+x) + } + iAddr = pc + pTmp = aData + uintptr(pc) + pc = int32(*(*Tu8)(unsafe.Pointer(pTmp)))< maxPC+nByte-int32(4) { + /* The free slot chain extends off the end of the page */ + *(*int32)(unsafe.Pointer(pRc)) = _sqlite3CorruptError(tls, int32(71951)) + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Allocate nByte bytes of space from within the B-Tree page passed +// ** as the first argument. Write into *pIdx the index into pPage->aData[] +// ** of the first byte of allocated space. Return either SQLITE_OK or +// ** an error code (usually SQLITE_CORRUPT). +// ** +// ** The caller guarantees that there is sufficient space to make the +// ** allocation. This routine might need to defragment in order to bring +// ** all the space together, however. This routine will avoid using +// ** the first two bytes past the cell pointer area since presumably this +// ** allocation is being made in order to insert a new cell, so we will +// ** also end up needing a new cell pointer. +// */ +func _allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var data, pSpace, pTmp uintptr + var g2, gap, hdr, top, v1, v2 int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _ = data, g2, gap, hdr, pSpace, pTmp, top, v1, v2 + hdr = int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) /* Local cache of pPage->hdrOffset */ + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData /* First byte of cell content area */ + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* First byte of gap between cell pointers and cell content */ + /* Minimum cell size is 4 */ + gap = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) + int32(2)*int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size + ** and the reserved space is zero (the usual value for reserved space) + ** then the cell content offset of an empty page wants to be 65536. + ** However, that integer is too large to be stored in a 2-byte unsigned + ** integer, so a value of 0 is used in its place. */ + pTmp = data + uintptr(hdr+int32(5)) + top = int32(*(*Tu8)(unsafe.Pointer(pTmp)))< top { + if top == 0 && (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == uint32(65536) { + top = int32(65536) + } else { + return _sqlite3CorruptError(tls, int32(71999)) + } + } else { + if top > int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { + return _sqlite3CorruptError(tls, int32(72002)) + } + } + /* If there is enough space between gap and top for one more cell pointer, + ** and if the freelist is not empty, then search the + ** freelist looking for a slot big enough to satisfy the request. + */ + if (*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(2)))) != 0 || *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(1)))) != 0) && gap+int32(2) <= top { + pSpace = _pageFindSlot(tls, pPage, nByte, bp) + if pSpace != 0 { + v1 = int32(int64(pSpace) - int64(data)) + g2 = v1 + *(*int32)(unsafe.Pointer(pIdx)) = v1 + if g2 <= gap { + return _sqlite3CorruptError(tls, int32(72019)) + } else { + return SQLITE_OK + } + } else { + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + } + /* The request could not be fulfilled using a freelist slot. Check + ** to see if defragmentation is necessary. + */ + if gap+int32(2)+nByte > top { + if int32(4) < (*TMemPage)(unsafe.Pointer(pPage)).FnFree-(int32(2)+nByte) { + v2 = int32(4) + } else { + v2 = (*TMemPage)(unsafe.Pointer(pPage)).FnFree - (int32(2) + nByte) + } + *(*int32)(unsafe.Pointer(bp)) = _defragmentPage(tls, pPage, v2) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + top = (int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))))<> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8(top) + *(*int32)(unsafe.Pointer(pIdx)) = top + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return a section of the pPage->aData to the freelist. +// ** The first byte of the new free block is pPage->aData[iStart] +// ** and the size of the block is iSize bytes. +// ** +// ** Adjacent freeblocks are coalesced. +// ** +// ** Even though the freeblock list was checked by btreeComputeFreeSpace(), +// ** that routine will not detect overlap between cells or freeblocks. Nor +// ** does it detect cells or freeblocks that encroach into the reserved bytes +// ** at the end of the page. So do additional corruption checks inside this +// ** routine and return SQLITE_CORRUPT if any problems are found. +// */ +func _freeSpace(tls *libc.TLS, pPage uintptr, iStart Tu16, iSize Tu16) (r int32) { + var data, pTmp, p2 uintptr + var hdr, nFrag Tu8 + var iEnd Tu32 + var iFreeBlk, iOrigSize, iPtr, x, v1 Tu16 + var iPtrEnd int32 + _, _, _, _, _, _, _, _, _, _, _, _ = data, hdr, iEnd, iFreeBlk, iOrigSize, iPtr, iPtrEnd, nFrag, pTmp, x, v1, p2 /* Page header size. 0 or 100 */ + nFrag = uint8(0) /* Reduction in fragmentation */ + iOrigSize = iSize /* Offset to cell content area */ + iEnd = uint32(int32(iStart) + int32(iSize)) /* First byte past the iStart buffer */ + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData /* Temporary ptr into data[] */ + /* Minimum cell size is 4 */ + /* The list of freeblocks must be in ascending order. Find the + ** spot on the list where iStart should be inserted. + */ + hdr = (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset + iPtr = uint16(int32(hdr) + int32(1)) + if int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iPtr)+int32(1))))) == 0 && int32(*(*uint8)(unsafe.Pointer(data + uintptr(iPtr)))) == 0 { + iFreeBlk = uint16(0) /* Shortcut for the case when the freelist is empty */ + } else { + for { + v1 = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iPtr))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4) { /* TH3: corrupt081.100 */ + return _sqlite3CorruptError(tls, int32(72103)) + } + /* At this point: + ** iFreeBlk: First freeblock after iStart, or zero if none + ** iPtr: The address of a pointer to iFreeBlk + ** + ** Check to see if iFreeBlk should be coalesced onto the end of iStart. + */ + if iFreeBlk != 0 && iEnd+uint32(3) >= uint32(iFreeBlk) { + nFrag = uint8(uint32(iFreeBlk) - iEnd) + if iEnd > uint32(iFreeBlk) { + return _sqlite3CorruptError(tls, int32(72115)) + } + iEnd = uint32(int32(iFreeBlk) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iFreeBlk)+int32(2)))))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { + return _sqlite3CorruptError(tls, int32(72118)) + } + iSize = uint16(iEnd - uint32(iStart)) + iFreeBlk = uint16(int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFreeBlk))))< int32(hdr)+int32(1) { + iPtrEnd = int32(iPtr) + (int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(iPtr)+int32(2)))))<= int32(iStart) { + if iPtrEnd > int32(iStart) { + return _sqlite3CorruptError(tls, int32(72131)) + } + nFrag = Tu8(int32(nFrag) + (int32(iStart) - iPtrEnd)) + iSize = uint16(iEnd - uint32(iPtr)) + iStart = iPtr + } + } + if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7))))) { + return _sqlite3CorruptError(tls, int32(72137)) + } + p2 = data + uintptr(int32(hdr)+int32(7)) + *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) - int32(nFrag)) + } + pTmp = data + uintptr(int32(hdr)+int32(5)) + x = uint16(int32(*(*Tu8)(unsafe.Pointer(pTmp)))<> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(1)) + 1)) = uint8(iFreeBlk) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(5)))) = uint8(iEnd >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(5)) + 1)) = uint8(iEnd) + } else { + /* Insert the new freeblock into the freelist */ + *(*uint8)(unsafe.Pointer(data + uintptr(iPtr))) = uint8(int32(iStart) >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(iPtr) + 1)) = uint8(iStart) + *(*uint8)(unsafe.Pointer(data + uintptr(iStart))) = uint8(int32(iFreeBlk) >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(iStart) + 1)) = uint8(iFreeBlk) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(iStart)+int32(2)))) = uint8(int32(iSize) >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(iStart)+int32(2)) + 1)) = uint8(iSize) + } + *(*int32)(unsafe.Pointer(pPage + 20)) += int32(iOrigSize) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Decode the flags byte (the first byte of the header) for a page +// ** and initialize fields of the MemPage structure accordingly. +// ** +// ** Only the following combinations are supported. Anything different +// ** indicates a corrupt database files: +// ** +// ** PTF_ZERODATA (0x02, 2) +// ** PTF_LEAFDATA | PTF_INTKEY (0x05, 5) +// ** PTF_ZERODATA | PTF_LEAF (0x0a, 10) +// ** PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF (0x0d, 13) +// */ +func _decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) (r int32) { + var pBt uintptr + _ = pBt /* A copy of pPage->pBt */ + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + (*TMemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload = (*TBtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload + if flagByte >= libc.Int32FromInt32(PTF_ZERODATA)|libc.Int32FromInt32(PTF_LEAF) { + (*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).Fleaf = uint8(1) + if flagByte == libc.Int32FromInt32(PTF_LEAFDATA)|libc.Int32FromInt32(PTF_INTKEY)|libc.Int32FromInt32(PTF_LEAF) { + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(1) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrTableLeaf) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtr) + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(1) + (*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*TBtShared)(unsafe.Pointer(pBt)).FmaxLeaf + (*TMemPage)(unsafe.Pointer(pPage)).FminLocal = (*TBtShared)(unsafe.Pointer(pBt)).FminLeaf + } else { + if flagByte == libc.Int32FromInt32(PTF_ZERODATA)|libc.Int32FromInt32(PTF_LEAF) { + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) + (*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal + (*TMemPage)(unsafe.Pointer(pPage)).FminLocal = (*TBtShared)(unsafe.Pointer(pBt)).FminLocal + } else { + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrIdxLeaf) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) + return _sqlite3CorruptError(tls, int32(72206)) + } + } + } else { + (*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize = uint8(4) + (*TMemPage)(unsafe.Pointer(pPage)).Fleaf = uint8(0) + if flagByte == int32(PTF_ZERODATA) { + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) + (*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal + (*TMemPage)(unsafe.Pointer(pPage)).FminLocal = (*TBtShared)(unsafe.Pointer(pBt)).FminLocal + } else { + if flagByte == libc.Int32FromInt32(PTF_LEAFDATA)|libc.Int32FromInt32(PTF_INTKEY) { + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtrNoPayload) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrNoPayload) + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(1) + (*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*TBtShared)(unsafe.Pointer(pBt)).FmaxLeaf + (*TMemPage)(unsafe.Pointer(pPage)).FminLocal = (*TBtShared)(unsafe.Pointer(pBt)).FminLeaf + } else { + (*TMemPage)(unsafe.Pointer(pPage)).FintKey = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FxCellSize = __ccgo_fp(_cellSizePtr) + (*TMemPage)(unsafe.Pointer(pPage)).FxParseCell = __ccgo_fp(_btreeParseCellPtrIndex) + return _sqlite3CorruptError(tls, int32(72230)) + } + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Compute the amount of freespace on the page. In other words, fill +// ** in the pPage->nFree field. +// */ +func _btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) (r int32) { + var data uintptr + var hdr Tu8 + var iCellFirst, iCellLast, nFree, pc, top, usableSize int32 + var next, size Tu32 + _, _, _, _, _, _, _, _, _, _ = data, hdr, iCellFirst, iCellLast, nFree, next, pc, size, top, usableSize /* Last possible cell or freeblock offset */ + usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + hdr = (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates + ** the start of the cell content area. A zero value for this integer is + ** interpreted as 65536. */ + top = (int32(*(*Tu8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(5)))))< 0 { + if pc < top { + /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will + ** always be at least one cell before the first freeblock. + */ + return _sqlite3CorruptError(tls, int32(72281)) + } + for int32(1) != 0 { + if pc > iCellLast { + /* Freeblock off the end of the page */ + return _sqlite3CorruptError(tls, int32(72286)) + } + next = uint32(int32(*(*Tu8)(unsafe.Pointer(data + uintptr(pc))))< uint32(0) { + /* Freeblock not in ascending order */ + return _sqlite3CorruptError(tls, int32(72296)) + } + if uint32(pc)+size > uint32(usableSize) { + /* Last freeblock extends past page end */ + return _sqlite3CorruptError(tls, int32(72300)) + } + } + /* At this point, nFree contains the sum of the offset to the start + ** of the cell-content area plus the number of free bytes within + ** the cell-content area. If this is greater than the usable-size + ** of the page, then the page must be corrupted. This check also + ** serves to verify that the offset to the start of the cell-content + ** area, according to the page header, lies within the page. + */ + if nFree > usableSize || nFree < iCellFirst { + return _sqlite3CorruptError(tls, int32(72312)) + } + (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16(nFree - iCellFirst)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Do additional sanity check after btreeInitPage() if +// ** PRAGMA cell_size_check=ON +// */ +func _btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) (r int32) { + var cellOffset, i, iCellFirst, iCellLast, pc, sz, usableSize int32 + var data uintptr + _, _, _, _, _, _, _, _ = cellOffset, data, i, iCellFirst, iCellLast, pc, sz, usableSize /* Start of cell content area */ + iCellFirst = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) + int32(2)*int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + iCellLast = usableSize - int32(4) + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + cellOffset = int32((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + iCellLast-- + } + i = 0 + for { + if !(i < int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell)) { + break + } + pc = int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellOffset+i*int32(2)))))) + if pc < iCellFirst || pc > iCellLast { + return _sqlite3CorruptError(tls, int32(72343)) + } + sz = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, data+uintptr(pc))) + if pc+sz > usableSize { + return _sqlite3CorruptError(tls, int32(72348)) + } + goto _1 + _1: + ; + i++ + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Initialize the auxiliary information for a disk block. +// ** +// ** Return SQLITE_OK on success. If we see that the page does +// ** not contain a well-formed database page, then return +// ** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not +// ** guarantee that the page is well-formed. It only shows that +// ** we failed to detect any corruption. +// */ +func _btreeInitPage(tls *libc.TLS, pPage uintptr) (r int32) { + var data, pBt uintptr + _, _ = data, pBt /* The main btree structure */ + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) + /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating + ** the b-tree page type. */ + if _decodeFlags(tls, pPage, int32(*(*Tu8)(unsafe.Pointer(data)))) != 0 { + return _sqlite3CorruptError(tls, int32(72380)) + } + (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) + (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FcellOffset = uint16(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) + int32(8) + int32((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx = data + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) + uintptr(8) + (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*TBtShared)(unsafe.Pointer(pBt)).FpageSize) + (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) + /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the + ** number of cells on the page. */ + (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(int32(*(*Tu8)(unsafe.Pointer(data + 3)))< ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(8))/uint32(6) { + /* To many cells for a single page. The page must be corrupt */ + return _sqlite3CorruptError(tls, int32(72394)) + } + /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only + ** possible for a root page of a table that contains no rows) then the + ** offset to the cell content area will equal the page size minus the + ** bytes of reserved space. */ + (*TMemPage)(unsafe.Pointer(pPage)).FnFree = -int32(1) /* Indicate that this value is yet uncomputed */ + (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(1) + if (*Tsqlite3)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags&uint64(SQLITE_CellSizeCk) != 0 { + return _btreeCellSizeCheck(tls, pPage) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Set up a raw page so that it looks like a database page holding +// ** no entries. +// */ +func _zeroPage(tls *libc.TLS, pPage uintptr, flags int32) { + var data, pBt uintptr + var first Tu16 + var hdr Tu8 + var v1 int32 + _, _, _, _, _ = data, first, hdr, pBt, v1 + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + hdr = (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_FAST_SECURE) != 0 { + libc.Xmemset(tls, data+uintptr(hdr), 0, uint64((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-uint32(hdr))) + } + *(*uint8)(unsafe.Pointer(data + uintptr(hdr))) = uint8(int8(flags)) + if flags&int32(PTF_LEAF) == 0 { + v1 = int32(12) + } else { + v1 = int32(8) + } + first = uint16(int32(hdr) + v1) + libc.Xmemset(tls, data+uintptr(int32(hdr)+int32(1)), 0, uint64(4)) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(7)))) = uint8(0) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(5)))) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FusableSize >> libc.Int32FromInt32(8)) + *(*uint8)(unsafe.Pointer(data + uintptr(int32(hdr)+int32(5)) + 1)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FusableSize) + (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32(uint16((*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(first))) + _decodeFlags(tls, pPage, flags) + (*TMemPage)(unsafe.Pointer(pPage)).FcellOffset = first + (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd = data + uintptr((*TBtShared)(unsafe.Pointer(pBt)).FpageSize) + (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx = data + uintptr(first) + (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst = data + uintptr((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) + (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) + (*TMemPage)(unsafe.Pointer(pPage)).FmaskPage = uint16((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - libc.Uint32FromInt32(1)) + (*TMemPage)(unsafe.Pointer(pPage)).FnCell = uint16(0) + (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(1) +} + +// C documentation +// +// /* +// ** Convert a DbPage obtained from the pager into a MemPage used by +// ** the btree layer. +// */ +func _btreePageFromDbPage(tls *libc.TLS, pDbPage uintptr, pgno TPgno, pBt uintptr) (r uintptr) { + var pPage uintptr + var v1 int32 + _, _ = pPage, v1 + pPage = _sqlite3PagerGetExtra(tls, pDbPage) + if pgno != (*TMemPage)(unsafe.Pointer(pPage)).Fpgno { + (*TMemPage)(unsafe.Pointer(pPage)).FaData = _sqlite3PagerGetData(tls, pDbPage) + (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage = pDbPage + (*TMemPage)(unsafe.Pointer(pPage)).FpBt = pBt + (*TMemPage)(unsafe.Pointer(pPage)).Fpgno = pgno + if pgno == uint32(1) { + v1 = int32(100) + } else { + v1 = 0 + } + (*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset = uint8(v1) + } + return pPage +} + +// C documentation +// +// /* +// ** Get a page from the pager. Initialize the MemPage.pBt and +// ** MemPage.aData elements if needed. See also: btreeGetUnusedPage(). +// ** +// ** If the PAGER_GET_NOCONTENT flag is set, it means that we do not care +// ** about the content of the page at this time. So do not go to the disk +// ** to fetch the content. Just fill in the content with zeros for now. +// ** If in the future we call sqlite3PagerWrite() on this page, that +// ** means we have started to be concerned about content and the disk +// ** read should occur at that point. +// */ +func _btreeGetPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pDbPage at bp+0 */ uintptr + _ = rc + rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, flags) + if rc != 0 { + return rc + } + *(*uintptr)(unsafe.Pointer(ppPage)) = _btreePageFromDbPage(tls, *(*uintptr)(unsafe.Pointer(bp)), pgno, pBt) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Retrieve a page from the pager cache. If the requested page is not +// ** already in the pager cache return NULL. Initialize the MemPage.pBt and +// ** MemPage.aData elements if needed. +// */ +func _btreePageLookup(tls *libc.TLS, pBt uintptr, pgno TPgno) (r uintptr) { + var pDbPage uintptr + _ = pDbPage + pDbPage = _sqlite3PagerLookup(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno) + if pDbPage != 0 { + return _btreePageFromDbPage(tls, pDbPage, pgno, pBt) + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Return the size of the database file in pages. If there is any kind of +// ** error, return ((unsigned int)-1). +// */ +func _btreePagecount(tls *libc.TLS, pBt uintptr) (r TPgno) { + return (*TBtShared)(unsafe.Pointer(pBt)).FnPage +} + +func _sqlite3BtreeLastPage(tls *libc.TLS, p uintptr) (r TPgno) { + return _btreePagecount(tls, (*TBtree)(unsafe.Pointer(p)).FpBt) +} + +// C documentation +// +// /* +// ** Get a page from the pager and initialize it. +// */ +func _getAndInitPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, bReadOnly int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pPage uintptr + var rc int32 + var _ /* pDbPage at bp+0 */ uintptr + _, _ = pPage, rc + if pgno > _btreePagecount(tls, pBt) { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return _sqlite3CorruptError(tls, int32(72537)) + } + rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp, bReadOnly) + if rc != 0 { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + pPage = _sqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp))) + if int32((*TMemPage)(unsafe.Pointer(pPage)).FisInit) == 0 { + _btreePageFromDbPage(tls, *(*uintptr)(unsafe.Pointer(bp)), pgno, pBt) + rc = _btreeInitPage(tls, pPage) + if rc != SQLITE_OK { + _releasePage(tls, pPage) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + } + *(*uintptr)(unsafe.Pointer(ppPage)) = pPage + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Release a MemPage. This should be called once for each prior +// ** call to btreeGetPage. +// ** +// ** Page1 is a special case and must be released using releasePageOne(). +// */ +func _releasePageNotNull(tls *libc.TLS, pPage uintptr) { + _sqlite3PagerUnrefNotNull(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) +} + +func _releasePage(tls *libc.TLS, pPage uintptr) { + if pPage != 0 { + _releasePageNotNull(tls, pPage) + } +} + +func _releasePageOne(tls *libc.TLS, pPage uintptr) { + _sqlite3PagerUnrefPageOne(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) +} + +// C documentation +// +// /* +// ** Get an unused page. +// ** +// ** This works just like btreeGetPage() with the addition: +// ** +// ** * If the page is already in use for some other purpose, immediately +// ** release it and return an SQLITE_CURRUPT error. +// ** * Make sure the isInit flag is clear +// */ +func _btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno TPgno, ppPage uintptr, flags int32) (r int32) { + var rc int32 + _ = rc + rc = _btreeGetPage(tls, pBt, pgno, ppPage, flags) + if rc == SQLITE_OK { + if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > int32(1) { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return _sqlite3CorruptError(tls, int32(72609)) + } + (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = uint8(0) + } else { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + } + return rc +} + +// C documentation +// +// /* +// ** During a rollback, when the pager reloads information into the cache +// ** so that the cache is restored to its original state at the start of +// ** the transaction, for each page restored this routine is called. +// ** +// ** This routine needs to reset the extra data section at the end of the +// ** page to agree with the restored data. +// */ +func _pageReinit(tls *libc.TLS, pData uintptr) { + var pPage uintptr + _ = pPage + pPage = _sqlite3PagerGetExtra(tls, pData) + if (*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) + if _sqlite3PagerPageRefcount(tls, pData) > int32(1) { + /* pPage might not be a btree page; it might be an overflow page + ** or ptrmap page or a free page. In those cases, the following + ** call to btreeInitPage() will likely return SQLITE_CORRUPT. + ** But no harm is done by this. And it is very important that + ** btreeInitPage() be called on every btree page so we make + ** the call for every page that comes in for re-initializing. */ + _btreeInitPage(tls, pPage) + } + } +} + +// C documentation +// +// /* +// ** Invoke the busy handler for a btree. +// */ +func _btreeInvokeBusyHandler(tls *libc.TLS, pArg uintptr) (r int32) { + var pBt uintptr + _ = pBt + pBt = pArg + return _sqlite3InvokeBusyHandler(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb+672) +} + +// C documentation +// +// /* +// ** Open a database file. +// ** +// ** zFilename is the name of the database file. If zFilename is NULL +// ** then an ephemeral database is created. The ephemeral database might +// ** be exclusively in memory, or it might use a disk-based memory cache. +// ** Either way, the ephemeral database will be automatically deleted +// ** when sqlite3BtreeClose() is called. +// ** +// ** If zFilename is ":memory:" then an in-memory database is created +// ** that is automatically destroyed when it is closed. +// ** +// ** The "flags" parameter is a bitmask that might contain bits like +// ** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY. +// ** +// ** If the database is already opened in the same database connection +// ** and we are in shared cache mode, then the open will fail with an +// ** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared +// ** objects in the same database connection since doing so will lead +// ** to problems with locking. +// */ +func _sqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintptr, ppBtree uintptr, flags int32, vfsFlags int32) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var i, iDb, isMemdb, isTempDb, nFilename, nFullPathname, rc, v1, v6, v7 int32 + var mutexOpen, mutexShared, mutexShared1, p, pBt, pExisting, pFile, pSib, zFullPathname, v9, p4, p5 uintptr + var nReserve Tu8 + var _ /* zDbHeader at bp+0 */ [100]uint8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, iDb, isMemdb, isTempDb, mutexOpen, mutexShared, mutexShared1, nFilename, nFullPathname, nReserve, p, pBt, pExisting, pFile, pSib, rc, zFullPathname, v1, v6, v7, v9, p4, p5 + pBt = uintptr(0) /* Handle to return */ + mutexOpen = uintptr(0) /* Prevents a race condition. Ticket #3537 */ + rc = SQLITE_OK /* Database header content */ + /* True if opening an ephemeral, temporary database */ + isTempDb = libc.BoolInt32(zFilename == uintptr(0) || int32(*(*int8)(unsafe.Pointer(zFilename))) == 0) + /* Set the variable isMemdb to true for an in-memory database, or + ** false for a file-based database. + */ + isMemdb = libc.BoolInt32(zFilename != 0 && libc.Xstrcmp(tls, zFilename, __ccgo_ts+4222) == 0 || isTempDb != 0 && _sqlite3TempInMemory(tls, db) != 0 || vfsFlags&int32(SQLITE_OPEN_MEMORY) != 0) + /* flags fit in 8 bits */ + /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ + /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ + if isMemdb != 0 { + flags |= int32(BTREE_MEMORY) + } + if vfsFlags&int32(SQLITE_OPEN_MAIN_DB) != 0 && (isMemdb != 0 || isTempDb != 0) { + vfsFlags = vfsFlags & ^libc.Int32FromInt32(SQLITE_OPEN_MAIN_DB) | int32(SQLITE_OPEN_TEMP_DB) + } + p = _sqlite3MallocZero(tls, uint64(72)) + if !(p != 0) { + return int32(SQLITE_NOMEM) + } + (*TBtree)(unsafe.Pointer(p)).FinTrans = uint8(TRANS_NONE) + (*TBtree)(unsafe.Pointer(p)).Fdb = db + (*TBtree)(unsafe.Pointer(p)).Flock.FpBtree = p + (*TBtree)(unsafe.Pointer(p)).Flock.FiTable = uint32(1) + /* + ** If this Btree is a candidate for shared cache, try to find an + ** existing BtShared object that we can share with + */ + if isTempDb == 0 && (isMemdb == 0 || vfsFlags&int32(SQLITE_OPEN_URI) != 0) { + if vfsFlags&int32(SQLITE_OPEN_SHAREDCACHE) != 0 { + nFilename = _sqlite3Strlen30(tls, zFilename) + int32(1) + nFullPathname = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + int32(1) + if nFullPathname > nFilename { + v1 = nFullPathname + } else { + v1 = nFilename + } + zFullPathname = _sqlite3Malloc(tls, uint64(v1)) + (*TBtree)(unsafe.Pointer(p)).Fsharable = uint8(1) + if !(zFullPathname != 0) { + Xsqlite3_free(tls, p) + return int32(SQLITE_NOMEM) + } + if isMemdb != 0 { + libc.Xmemcpy(tls, zFullPathname, zFilename, uint64(nFilename)) + } else { + rc = _sqlite3OsFullPathname(tls, pVfs, zFilename, nFullPathname, zFullPathname) + if rc != 0 { + if rc == libc.Int32FromInt32(SQLITE_OK)|libc.Int32FromInt32(2)<= 0) { + break + } + pExisting = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if pExisting != 0 && (*TBtree)(unsafe.Pointer(pExisting)).FpBt == pBt { + Xsqlite3_mutex_leave(tls, mutexShared) + Xsqlite3_mutex_leave(tls, mutexOpen) + Xsqlite3_free(tls, zFullPathname) + Xsqlite3_free(tls, p) + return int32(SQLITE_CONSTRAINT) + } + goto _3 + _3: + ; + iDb-- + } + (*TBtree)(unsafe.Pointer(p)).FpBt = pBt + (*TBtShared)(unsafe.Pointer(pBt)).FnRef++ + break + } + goto _2 + _2: + ; + pBt = (*TBtShared)(unsafe.Pointer(pBt)).FpNext + } + Xsqlite3_mutex_leave(tls, mutexShared) + Xsqlite3_free(tls, zFullPathname) + } + } + if pBt == uintptr(0) { + /* + ** The following asserts make sure that structures used by the btree are + ** the right size. This is to guard against size changes that result + ** when compiling on a different architecture. + */ + /* Suppress false-positive compiler warning from PVS-Studio */ + libc.Xmemset(tls, bp+16, 0, uint64(8)) + pBt = _sqlite3MallocZero(tls, uint64(152)) + if pBt == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto btree_open_out + } + rc = _sqlite3PagerOpen(tls, pVfs, pBt, zFilename, int32(136), flags, vfsFlags, __ccgo_fp(_pageReinit)) + if rc == SQLITE_OK { + _sqlite3PagerSetMmapLimit(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, (*Tsqlite3)(unsafe.Pointer(db)).FszMmap) + rc = _sqlite3PagerReadFileheader(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, int32(100), bp) + } + if rc != SQLITE_OK { + goto btree_open_out + } + (*TBtShared)(unsafe.Pointer(pBt)).FopenFlags = uint8(flags) + (*TBtShared)(unsafe.Pointer(pBt)).Fdb = db + _sqlite3PagerSetBusyHandler(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, __ccgo_fp(_btreeInvokeBusyHandler), pBt) + (*TBtree)(unsafe.Pointer(p)).FpBt = pBt + (*TBtShared)(unsafe.Pointer(pBt)).FpCursor = uintptr(0) + (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + if _sqlite3PagerIsreadonly(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) != 0 { + p4 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(BTS_READ_ONLY)) + } + /* EVIDENCE-OF: R-51873-39618 The page size for a database file is + ** determined by the 2-byte integer located at an offset of 16 bytes from + ** the beginning of the database file. */ + (*TBtShared)(unsafe.Pointer(pBt)).FpageSize = uint32(int32((*(*[100]uint8)(unsafe.Pointer(bp)))[int32(16)])< uint32(SQLITE_MAX_PAGE_SIZE) || ((*TBtShared)(unsafe.Pointer(pBt)).FpageSize-uint32(1))&(*TBtShared)(unsafe.Pointer(pBt)).FpageSize != uint32(0) { + (*TBtShared)(unsafe.Pointer(pBt)).FpageSize = uint32(0) + /* If the magic name ":memory:" will create an in-memory database, then + ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if + ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if + ** SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a + ** regular file-name. In this case the auto-vacuum applies as per normal. + */ + if zFilename != 0 && !(isMemdb != 0) { + (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum = uint8(libc.Int32FromInt32(0)) + (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(libc.Int32FromInt32(0)) + } + nReserve = uint8(0) + } else { + /* EVIDENCE-OF: R-37497-42412 The size of the reserved region is + ** determined by the one-byte unsigned integer found at an offset of 20 + ** into the database file header. */ + nReserve = (*(*[100]uint8)(unsafe.Pointer(bp)))[int32(20)] + p5 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + if _sqlite3Get4byte(tls, bp+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(4)*libc.Int32FromInt32(4))) != 0 { + v6 = int32(1) + } else { + v6 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum = uint8(v6) + if _sqlite3Get4byte(tls, bp+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(7)*libc.Int32FromInt32(4))) != 0 { + v7 = int32(1) + } else { + v7 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(v7) + } + rc = _sqlite3PagerSetPagesize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pBt+52, int32(nReserve)) + if rc != 0 { + goto btree_open_out + } + (*TBtShared)(unsafe.Pointer(pBt)).FusableSize = (*TBtShared)(unsafe.Pointer(pBt)).FpageSize - uint32(nReserve) + /* 8-byte alignment of pageSize */ + /* Add the new BtShared object to the linked list sharable BtShareds. + */ + (*TBtShared)(unsafe.Pointer(pBt)).FnRef = int32(1) + if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { + mutexShared1 = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + if libc.Bool(int32(SQLITE_THREADSAFE) != 0) && _sqlite3Config.FbCoreMutex != 0 { + (*TBtShared)(unsafe.Pointer(pBt)).Fmutex = _sqlite3MutexAlloc(tls, SQLITE_MUTEX_FAST) + if (*TBtShared)(unsafe.Pointer(pBt)).Fmutex == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto btree_open_out + } + } + Xsqlite3_mutex_enter(tls, mutexShared1) + (*TBtShared)(unsafe.Pointer(pBt)).FpNext = _sqlite3SharedCacheList + _sqlite3SharedCacheList = pBt + Xsqlite3_mutex_leave(tls, mutexShared1) + } + } + /* If the new Btree uses a sharable pBtShared, then link the new + ** Btree into the list of all sharable Btrees for the same connection. + ** The list is kept in ascending order by pBt address. + */ + if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + v9 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + pSib = v9 + if v9 != uintptr(0) && (*TBtree)(unsafe.Pointer(pSib)).Fsharable != 0 { + for (*TBtree)(unsafe.Pointer(pSib)).FpPrev != 0 { + pSib = (*TBtree)(unsafe.Pointer(pSib)).FpPrev + } + if uint64((*TBtree)(unsafe.Pointer(p)).FpBt) < uint64((*TBtree)(unsafe.Pointer(pSib)).FpBt) { + (*TBtree)(unsafe.Pointer(p)).FpNext = pSib + (*TBtree)(unsafe.Pointer(p)).FpPrev = uintptr(0) + (*TBtree)(unsafe.Pointer(pSib)).FpPrev = p + } else { + for (*TBtree)(unsafe.Pointer(pSib)).FpNext != 0 && uint64((*TBtree)(unsafe.Pointer((*TBtree)(unsafe.Pointer(pSib)).FpNext)).FpBt) < uint64((*TBtree)(unsafe.Pointer(p)).FpBt) { + pSib = (*TBtree)(unsafe.Pointer(pSib)).FpNext + } + (*TBtree)(unsafe.Pointer(p)).FpNext = (*TBtree)(unsafe.Pointer(pSib)).FpNext + (*TBtree)(unsafe.Pointer(p)).FpPrev = pSib + if (*TBtree)(unsafe.Pointer(p)).FpNext != 0 { + (*TBtree)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpNext)).FpPrev = p + } + (*TBtree)(unsafe.Pointer(pSib)).FpNext = p + } + break + } + goto _8 + _8: + ; + i++ + } + } + *(*uintptr)(unsafe.Pointer(ppBtree)) = p +btree_open_out: + ; + if rc != SQLITE_OK { + if pBt != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpPager != 0 { + _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) + } + Xsqlite3_free(tls, pBt) + Xsqlite3_free(tls, p) + *(*uintptr)(unsafe.Pointer(ppBtree)) = uintptr(0) + } else { + /* If the B-Tree was successfully opened, set the pager-cache size to the + ** default value. Except, when opening on an existing shared pager-cache, + ** do not change the pager-cache size. + */ + if _sqlite3BtreeSchema(tls, p, 0, uintptr(0)) == uintptr(0) { + _sqlite3BtreeSetCacheSize(tls, p, -int32(2000)) + } + pFile = _sqlite3PagerFile(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + if (*Tsqlite3_file)(unsafe.Pointer(pFile)).FpMethods != 0 { + _sqlite3OsFileControlHint(tls, pFile, int32(SQLITE_FCNTL_PDB), pBt+8) + } + } + if mutexOpen != 0 { + Xsqlite3_mutex_leave(tls, mutexOpen) + } + return rc +} + +// C documentation +// +// /* +// ** Decrement the BtShared.nRef counter. When it reaches zero, +// ** remove the BtShared structure from the sharing list. Return +// ** true if the BtShared.nRef counter reaches zero and return +// ** false if it is still positive. +// */ +func _removeFromSharingList(tls *libc.TLS, pBt uintptr) (r int32) { + var pList, pMainMtx uintptr + var removed int32 + _, _, _ = pList, pMainMtx, removed + removed = 0 + pMainMtx = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, pMainMtx) + (*TBtShared)(unsafe.Pointer(pBt)).FnRef-- + if (*TBtShared)(unsafe.Pointer(pBt)).FnRef <= 0 { + if _sqlite3SharedCacheList == pBt { + _sqlite3SharedCacheList = (*TBtShared)(unsafe.Pointer(pBt)).FpNext + } else { + pList = _sqlite3SharedCacheList + for pList != 0 && (*TBtShared)(unsafe.Pointer(pList)).FpNext != pBt { + pList = (*TBtShared)(unsafe.Pointer(pList)).FpNext + } + if pList != 0 { + (*TBtShared)(unsafe.Pointer(pList)).FpNext = (*TBtShared)(unsafe.Pointer(pBt)).FpNext + } + } + if int32(SQLITE_THREADSAFE) != 0 { + Xsqlite3_mutex_free(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fmutex) + } + removed = int32(1) + } + Xsqlite3_mutex_leave(tls, pMainMtx) + return removed +} + +// C documentation +// +// /* +// ** Make sure pBt->pTmpSpace points to an allocation of +// ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child +// ** pointer. +// */ +func _allocateTempSpace(tls *libc.TLS, pBt uintptr) (r int32) { + var pCur uintptr + _ = pCur + /* This routine is called only by btreeCursor() when allocating the + ** first write cursor for the BtShared object */ + (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace = _sqlite3PageMalloc(tls, int32((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)) + if (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace == uintptr(0) { + pCur = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor + (*TBtShared)(unsafe.Pointer(pBt)).FpCursor = (*TBtCursor)(unsafe.Pointer(pCur)).FpNext /* Unlink the cursor */ + libc.Xmemset(tls, pCur, 0, uint64(296)) + return int32(SQLITE_NOMEM) + } + /* One of the uses of pBt->pTmpSpace is to format cells before + ** inserting them into a leaf page (function fillInCell()). If + ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes + ** by the various routines that manipulate binary cells. Which + ** can mean that fillInCell() only initializes the first 2 or 3 + ** bytes of pTmpSpace, but that the first 4 bytes are copied from + ** it into a database page. This is not actually a problem, but it + ** does cause a valgrind error when the 1 or 2 bytes of uninitialized + ** data is passed to system call write(). So to avoid this error, + ** zero the first 4 bytes of temp space here. + ** + ** Also: Provide four bytes of initialized space before the + ** beginning of pTmpSpace as an area available to prepend the + ** left-child pointer to the beginning of a cell. + */ + libc.Xmemset(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace, 0, uint64(8)) + *(*uintptr)(unsafe.Pointer(pBt + 136)) += uintptr(4) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Free the pBt->pTmpSpace allocation +// */ +func _freeTempSpace(tls *libc.TLS, pBt uintptr) { + if (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace != 0 { + *(*uintptr)(unsafe.Pointer(pBt + 136)) -= uintptr(4) + _sqlite3PageFree(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace) + (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Close an open database and invalidate all cursors. +// */ +func _sqlite3BtreeClose(tls *libc.TLS, p uintptr) (r int32) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + /* Close all cursors opened via this handle. */ + _sqlite3BtreeEnter(tls, p) + /* Verify that no other cursors have this Btree open */ + /* Rollback any active transaction and free the handle structure. + ** The call to sqlite3BtreeRollback() drops any table-locks held by + ** this handle. + */ + _sqlite3BtreeRollback(tls, p, SQLITE_OK, 0) + _sqlite3BtreeLeave(tls, p) + /* If there are still other outstanding references to the shared-btree + ** structure, return now. The remainder of this procedure cleans + ** up the shared-btree. + */ + if !((*TBtree)(unsafe.Pointer(p)).Fsharable != 0) || _removeFromSharingList(tls, pBt) != 0 { + /* The pBt is no longer on the sharing list, so we can access + ** it without having to hold the mutex. + ** + ** Clean out and delete the BtShared object. + */ + _sqlite3PagerClose(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, (*TBtree)(unsafe.Pointer(p)).Fdb) + if (*TBtShared)(unsafe.Pointer(pBt)).FxFreeSchema != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpSchema != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TBtShared)(unsafe.Pointer(pBt)).FxFreeSchema})))(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpSchema) + } + _sqlite3DbFree(tls, uintptr(0), (*TBtShared)(unsafe.Pointer(pBt)).FpSchema) + _freeTempSpace(tls, pBt) + Xsqlite3_free(tls, pBt) + } + if (*TBtree)(unsafe.Pointer(p)).FpPrev != 0 { + (*TBtree)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpPrev)).FpNext = (*TBtree)(unsafe.Pointer(p)).FpNext + } + if (*TBtree)(unsafe.Pointer(p)).FpNext != 0 { + (*TBtree)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpNext)).FpPrev = (*TBtree)(unsafe.Pointer(p)).FpPrev + } + Xsqlite3_free(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change the "soft" limit on the number of pages in the cache. +// ** Unused and unmodified pages will be recycled when the number of +// ** pages in the cache exceeds this soft limit. But the size of the +// ** cache is allowed to grow larger than this limit if it contains +// ** dirty pages or pages still in active use. +// */ +func _sqlite3BtreeSetCacheSize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + _sqlite3PagerSetCachesize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) + _sqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change the "spill" limit on the number of pages in the cache. +// ** If the number of pages exceeds this limit during a write transaction, +// ** the pager might attempt to "spill" pages to the journal early in +// ** order to free up memory. +// ** +// ** The value returned is the current spill size. If zero is passed +// ** as an argument, no changes are made to the spill size setting, so +// ** using mxPage of 0 is a way to query the current spill size. +// */ +func _sqlite3BtreeSetSpillSize(tls *libc.TLS, p uintptr, mxPage int32) (r int32) { + var pBt uintptr + var res int32 + _, _ = pBt, res + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + res = _sqlite3PagerSetSpillsize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) + _sqlite3BtreeLeave(tls, p) + return res +} + +// C documentation +// +// /* +// ** Change the limit on the amount of the database file that may be +// ** memory mapped. +// */ +func _sqlite3BtreeSetMmapLimit(tls *libc.TLS, p uintptr, szMmap Tsqlite3_int64) (r int32) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + _sqlite3PagerSetMmapLimit(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, szMmap) + _sqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change the way data is synced to disk in order to increase or decrease +// ** how well the database resists damage due to OS crashes and power +// ** failures. Level 1 is the same as asynchronous (no syncs() occur and +// ** there is a high probability of damage) Level 2 is the default. There +// ** is a very low but non-zero probability of damage. Level 3 reduces the +// ** probability of damage to near zero but with a write performance reduction. +// */ +func _sqlite3BtreeSetPagerFlags(tls *libc.TLS, p uintptr, pgFlags uint32) (r int32) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + _sqlite3PagerSetFlags(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pgFlags) + _sqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change the default pages size and the number of reserved bytes per page. +// ** Or, if the page size has already been fixed, return SQLITE_READONLY +// ** without changing anything. +// ** +// ** The page size must be a power of 2 between 512 and 65536. If the page +// ** size supplied does not meet this constraint then the page size is not +// ** changed. +// ** +// ** Page sizes are constrained to be a power of two so that the region +// ** of the database file used for locking (beginning at PENDING_BYTE, +// ** the first byte past the 1GB boundary, 0x40000000) needs to occur +// ** at the beginning of a page. +// ** +// ** If parameter nReserve is less than zero, then the number of reserved +// ** bytes per page is left unchanged. +// ** +// ** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size +// ** and autovacuum mode can no longer be changed. +// */ +func _sqlite3BtreeSetPageSize(tls *libc.TLS, p uintptr, pageSize int32, nReserve int32, iFix int32) (r int32) { + var pBt, p1 uintptr + var rc, x int32 + _, _, _, _ = pBt, rc, x, p1 + rc = SQLITE_OK + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + (*TBtShared)(unsafe.Pointer(pBt)).FnReserveWanted = uint8(nReserve) + x = int32((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - (*TBtShared)(unsafe.Pointer(pBt)).FusableSize) + if nReserve < x { + nReserve = x + } + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_PAGESIZE_FIXED) != 0 { + _sqlite3BtreeLeave(tls, p) + return int32(SQLITE_READONLY) + } + if pageSize >= int32(512) && pageSize <= int32(SQLITE_MAX_PAGE_SIZE) && (pageSize-int32(1))&pageSize == 0 { + if nReserve > int32(32) && pageSize == int32(512) { + pageSize = int32(1024) + } + (*TBtShared)(unsafe.Pointer(pBt)).FpageSize = uint32(pageSize) + _freeTempSpace(tls, pBt) + } + rc = _sqlite3PagerSetPagesize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pBt+52, nReserve) + (*TBtShared)(unsafe.Pointer(pBt)).FusableSize = (*TBtShared)(unsafe.Pointer(pBt)).FpageSize - uint32(uint16(nReserve)) + if iFix != 0 { + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Return the currently defined page size +// */ +func _sqlite3BtreeGetPageSize(tls *libc.TLS, p uintptr) (r int32) { + return int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpageSize) +} + +// C documentation +// +// /* +// ** This function is similar to sqlite3BtreeGetReserve(), except that it +// ** may only be called if it is guaranteed that the b-tree mutex is already +// ** held. +// ** +// ** This is useful in one special case in the backup API code where it is +// ** known that the shared b-tree mutex is held, but the mutex on the +// ** database handle that owns *p is not. In this case if sqlite3BtreeEnter() +// ** were to be called, it might collide with some other operation on the +// ** database handle that owns *p, causing undefined behavior. +// */ +func _sqlite3BtreeGetReserveNoMutex(tls *libc.TLS, p uintptr) (r int32) { + var n int32 + _ = n + n = int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpageSize - (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FusableSize) + return n +} + +// C documentation +// +// /* +// ** Return the number of bytes of space at the end of every page that +// ** are intentionally left unused. This is the "reserved" space that is +// ** sometimes used by extensions. +// ** +// ** The value returned is the larger of the current reserve size and +// ** the latest reserve size requested by SQLITE_FILECTRL_RESERVE_BYTES. +// ** The amount of reserve can only grow - never shrink. +// */ +func _sqlite3BtreeGetRequestedReserve(tls *libc.TLS, p uintptr) (r int32) { + var n1, n2, v1 int32 + _, _, _ = n1, n2, v1 + _sqlite3BtreeEnter(tls, p) + n1 = int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnReserveWanted) + n2 = _sqlite3BtreeGetReserveNoMutex(tls, p) + _sqlite3BtreeLeave(tls, p) + if n1 > n2 { + v1 = n1 + } else { + v1 = n2 + } + return v1 +} + +// C documentation +// +// /* +// ** Set the maximum page count for a database if mxPage is positive. +// ** No changes are made if mxPage is 0 or negative. +// ** Regardless of the value of mxPage, return the maximum page count. +// */ +func _sqlite3BtreeMaxPageCount(tls *libc.TLS, p uintptr, mxPage TPgno) (r TPgno) { + var n TPgno + _ = n + _sqlite3BtreeEnter(tls, p) + n = _sqlite3PagerMaxPageCount(tls, (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpPager, mxPage) + _sqlite3BtreeLeave(tls, p) + return n +} + +// C documentation +// +// /* +// ** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags: +// ** +// ** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared +// ** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared +// ** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set +// ** newFlag==(-1) No changes +// ** +// ** This routine acts as a query if newFlag is less than zero +// ** +// ** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but +// ** freelist leaf pages are not written back to the database. Thus in-page +// ** deleted content is cleared, but freelist deleted content is not. +// ** +// ** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition +// ** that freelist leaf pages are written back into the database, increasing +// ** the amount of disk I/O. +// */ +func _sqlite3BtreeSecureDelete(tls *libc.TLS, p uintptr, newFlag int32) (r int32) { + var b int32 + var p1, p2 uintptr + _, _, _ = b, p1, p2 + if p == uintptr(0) { + return 0 + } + _sqlite3BtreeEnter(tls, p) + if newFlag >= 0 { + p1 = (*TBtree)(unsafe.Pointer(p)).FpBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_FAST_SECURE)) + p2 = (*TBtree)(unsafe.Pointer(p)).FpBt + 40 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTS_SECURE_DELETE)*newFlag) + } + b = int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FbtsFlags) & int32(BTS_FAST_SECURE) / int32(BTS_SECURE_DELETE) + _sqlite3BtreeLeave(tls, p) + return b +} + +// C documentation +// +// /* +// ** Change the 'auto-vacuum' property of the database. If the 'autoVacuum' +// ** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it +// ** is disabled. The default value for the auto-vacuum property is +// ** determined by the SQLITE_DEFAULT_AUTOVACUUM macro. +// */ +func _sqlite3BtreeSetAutoVacuum(tls *libc.TLS, p uintptr, autoVacuum int32) (r int32) { + var av Tu8 + var pBt uintptr + var rc, v1, v3, v4 int32 + var v2 bool + _, _, _, _, _, _, _ = av, pBt, rc, v1, v2, v3, v4 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + rc = SQLITE_OK + av = uint8(autoVacuum) + _sqlite3BtreeEnter(tls, p) + if v2 = int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_PAGESIZE_FIXED) != 0; v2 { + if av != 0 { + v1 = int32(1) + } else { + v1 = 0 + } + } + if v2 && v1 != int32((*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum) { + rc = int32(SQLITE_READONLY) + } else { + if av != 0 { + v3 = int32(1) + } else { + v3 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum = uint8(v3) + if int32(av) == int32(2) { + v4 = int32(1) + } else { + v4 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(v4) + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Return the value of the 'auto-vacuum' property. If auto-vacuum is +// ** enabled 1 is returned. Otherwise 0. +// */ +func _sqlite3BtreeGetAutoVacuum(tls *libc.TLS, p uintptr) (r int32) { + var rc, v1, v2 int32 + _, _, _ = rc, v1, v2 + _sqlite3BtreeEnter(tls, p) + if !((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0) { + v1 = BTREE_AUTOVACUUM_NONE + } else { + if !((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FincrVacuum != 0) { + v2 = int32(BTREE_AUTOVACUUM_FULL) + } else { + v2 = int32(BTREE_AUTOVACUUM_INCR) + } + v1 = v2 + } + rc = v1 + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Get a reference to pPage1 of the database file. This will +// ** also acquire a readlock on that file. +// ** +// ** SQLITE_OK is returned on success. If the file is not a +// ** well-formed database file, then SQLITE_CORRUPT is returned. +// ** SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM +// ** is returned if we run out of memory. +// */ +func _lockBtree(tls *libc.TLS, pBt uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nPage, pageSize, usableSize Tu32 + var page1, p1, p2, p3 uintptr + var rc, v4, v5 int32 + var _ /* isOpen at bp+12 */ int32 + var _ /* nPageFile at bp+8 */ Tu32 + var _ /* pPage1 at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _ = nPage, page1, pageSize, rc, usableSize, v4, v5, p1, p2, p3 /* Number of pages in the database */ + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Number of pages in the database file */ + rc = _sqlite3PagerSharedLock(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + if rc != SQLITE_OK { + return rc + } + rc = _btreeGetPage(tls, pBt, uint32(1), bp, 0) + if rc != SQLITE_OK { + return rc + } + /* Do some checking to help insure the file we opened really is + ** a valid database file. + */ + nPage = _sqlite3Get4byte(tls, uintptr(28)+(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) + _sqlite3PagerPagecount(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, bp+8) + if nPage == uint32(0) || libc.Xmemcmp(tls, uintptr(24)+(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uintptr(92)+(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uint64(4)) != 0 { + nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) + } + if (*Tsqlite3)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { + nPage = uint32(0) + } + if nPage > uint32(0) { + page1 = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData + rc = int32(SQLITE_NOTADB) + /* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins + ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d + ** 61 74 20 33 00. */ + if libc.Xmemcmp(tls, page1, uintptr(unsafe.Pointer(&_zMagicHeader)), uint64(16)) != 0 { + goto page1_init_failed + } + if int32(*(*Tu8)(unsafe.Pointer(page1 + 18))) > int32(2) { + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTS_READ_ONLY)) + } + if int32(*(*Tu8)(unsafe.Pointer(page1 + 19))) > int32(2) { + goto page1_init_failed + } + /* If the read version is set to 2, this database should be accessed + ** in WAL mode. If the log is not already open, open it now. Then + ** return SQLITE_OK and return without populating BtShared.pPage1. + ** The caller detects this and calls this function again. This is + ** required as the version of page 1 currently in the page1 buffer + ** may not be the latest version - there may be a newer one in the log + ** file. + */ + if int32(*(*Tu8)(unsafe.Pointer(page1 + 19))) == int32(2) && int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_NO_WAL) == 0 { + *(*int32)(unsafe.Pointer(bp + 12)) = 0 + rc = _sqlite3PagerOpenWal(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, bp+12) + if rc != SQLITE_OK { + goto page1_init_failed + } else { + if *(*int32)(unsafe.Pointer(bp + 12)) == 0 { + _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) + return SQLITE_OK + } + } + rc = int32(SQLITE_NOTADB) + } else { + } + /* EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload + ** fractions and the leaf payload fraction values must be 64, 32, and 32. + ** + ** The original design allowed these amounts to vary, but as of + ** version 3.6.0, we require them to be fixed. + */ + if libc.Xmemcmp(tls, page1+21, __ccgo_ts+4231, uint64(3)) != 0 { + goto page1_init_failed + } + /* EVIDENCE-OF: R-51873-39618 The page size for a database file is + ** determined by the 2-byte integer located at an offset of 16 bytes from + ** the beginning of the database file. */ + pageSize = uint32(int32(*(*Tu8)(unsafe.Pointer(page1 + 16)))< uint32(SQLITE_MAX_PAGE_SIZE) || pageSize <= uint32(256) { + goto page1_init_failed + } + /* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte + ** integer at offset 20 is the number of bytes of space at the end of + ** each page to reserve for extensions. + ** + ** EVIDENCE-OF: R-37497-42412 The size of the reserved region is + ** determined by the one-byte unsigned integer found at an offset of 20 + ** into the database file header. */ + usableSize = pageSize - uint32(*(*Tu8)(unsafe.Pointer(page1 + 20))) + if pageSize != (*TBtShared)(unsafe.Pointer(pBt)).FpageSize { + /* After reading the first page of the database assuming a page size + ** of BtShared.pageSize, we have discovered that the page-size is + ** actually pageSize. Unlock the database, leave pBt->pPage1 at + ** zero and return SQLITE_OK. The caller will call this function + ** again with the correct page-size. + */ + _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) + (*TBtShared)(unsafe.Pointer(pBt)).FusableSize = usableSize + (*TBtShared)(unsafe.Pointer(pBt)).FpageSize = pageSize + p2 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + _freeTempSpace(tls, pBt) + rc = _sqlite3PagerSetPagesize(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, pBt+52, int32(pageSize-usableSize)) + return rc + } + if nPage > *(*Tu32)(unsafe.Pointer(bp + 8)) { + if _sqlite3WritableSchema(tls, (*TBtShared)(unsafe.Pointer(pBt)).Fdb) == 0 { + rc = _sqlite3CorruptError(tls, int32(73547)) + goto page1_init_failed + } else { + nPage = *(*Tu32)(unsafe.Pointer(bp + 8)) + } + } + /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to + ** be less than 480. In other words, if the page size is 512, then the + ** reserved space size cannot exceed 32. */ + if usableSize < uint32(480) { + goto page1_init_failed + } + p3 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + (*TBtShared)(unsafe.Pointer(pBt)).FpageSize = pageSize + (*TBtShared)(unsafe.Pointer(pBt)).FusableSize = usableSize + if _sqlite3Get4byte(tls, page1+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(4)*libc.Int32FromInt32(4))) != 0 { + v4 = int32(1) + } else { + v4 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum = uint8(v4) + if _sqlite3Get4byte(tls, page1+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(7)*libc.Int32FromInt32(4))) != 0 { + v5 = int32(1) + } else { + v5 = 0 + } + (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(v5) + } + /* maxLocal is the maximum amount of payload to store locally for + ** a cell. Make sure it is small enough so that at least minFanout + ** cells can will fit on one page. We assume a 10-byte page header. + ** Besides the payload, the cell must store: + ** 2-byte pointer to the cell + ** 4-byte child pointer + ** 9-byte nKey value + ** 4-byte nData value + ** 4-byte overflow page pointer + ** So a cell consists of a 2-byte pointer, a header which is as much as + ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow + ** page pointer. + */ + (*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal = uint16(((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-libc.Uint32FromInt32(12))*libc.Uint32FromInt32(64)/libc.Uint32FromInt32(255) - libc.Uint32FromInt32(23)) + (*TBtShared)(unsafe.Pointer(pBt)).FminLocal = uint16(((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-libc.Uint32FromInt32(12))*libc.Uint32FromInt32(32)/libc.Uint32FromInt32(255) - libc.Uint32FromInt32(23)) + (*TBtShared)(unsafe.Pointer(pBt)).FmaxLeaf = uint16((*TBtShared)(unsafe.Pointer(pBt)).FusableSize - libc.Uint32FromInt32(35)) + (*TBtShared)(unsafe.Pointer(pBt)).FminLeaf = uint16(((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-libc.Uint32FromInt32(12))*libc.Uint32FromInt32(32)/libc.Uint32FromInt32(255) - libc.Uint32FromInt32(23)) + if int32((*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal) > int32(127) { + (*TBtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload = uint8(127) + } else { + (*TBtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload = uint8((*TBtShared)(unsafe.Pointer(pBt)).FmaxLocal) + } + (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = *(*uintptr)(unsafe.Pointer(bp)) + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nPage + return SQLITE_OK +page1_init_failed: + ; + _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) + (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + return rc +} + +// C documentation +// +// /* +// ** If there are no outstanding cursors and we are not in the middle +// ** of a transaction but there is a read lock on the database, then +// ** this routine unrefs the first page of the database file which +// ** has the effect of releasing the read lock. +// ** +// ** If there is a transaction in progress, this routine is a no-op. +// */ +func _unlockBtreeIfUnused(tls *libc.TLS, pBt uintptr) { + var pPage1 uintptr + _ = pPage1 + if int32((*TBtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE && (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 != uintptr(0) { + pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 + (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + _releasePageOne(tls, pPage1) + } +} + +// C documentation +// +// /* +// ** If pBt points to an empty file then convert that empty file +// ** into a new empty database by initializing the first page of +// ** the database. +// */ +func _newDatabase(tls *libc.TLS, pBt uintptr) (r int32) { + var data, pP1, p1 uintptr + var rc int32 + _, _, _, _ = data, pP1, rc, p1 + if (*TBtShared)(unsafe.Pointer(pBt)).FnPage > uint32(0) { + return SQLITE_OK + } + pP1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 + data = (*TMemPage)(unsafe.Pointer(pP1)).FaData + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pP1)).FpDbPage) + if rc != 0 { + return rc + } + libc.Xmemcpy(tls, data, uintptr(unsafe.Pointer(&_zMagicHeader)), uint64(16)) + *(*uint8)(unsafe.Pointer(data + 16)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) + *(*uint8)(unsafe.Pointer(data + 17)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) + *(*uint8)(unsafe.Pointer(data + 18)) = uint8(1) + *(*uint8)(unsafe.Pointer(data + 19)) = uint8(1) + *(*uint8)(unsafe.Pointer(data + 20)) = uint8((*TBtShared)(unsafe.Pointer(pBt)).FpageSize - (*TBtShared)(unsafe.Pointer(pBt)).FusableSize) + *(*uint8)(unsafe.Pointer(data + 21)) = uint8(64) + *(*uint8)(unsafe.Pointer(data + 22)) = uint8(32) + *(*uint8)(unsafe.Pointer(data + 23)) = uint8(32) + libc.Xmemset(tls, data+24, 0, uint64(libc.Int32FromInt32(100)-libc.Int32FromInt32(24))) + _zeroPage(tls, pP1, libc.Int32FromInt32(PTF_INTKEY)|libc.Int32FromInt32(PTF_LEAF)|libc.Int32FromInt32(PTF_LEAFDATA)) + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + _sqlite3Put4byte(tls, data+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(4)*libc.Int32FromInt32(4)), uint32((*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum)) + _sqlite3Put4byte(tls, data+uintptr(libc.Int32FromInt32(36)+libc.Int32FromInt32(7)*libc.Int32FromInt32(4)), uint32((*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum)) + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = uint32(1) + *(*uint8)(unsafe.Pointer(data + 31)) = uint8(1) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Initialize the first page of the database file (creating a database +// ** consisting of a single page and no schema objects). Return SQLITE_OK +// ** if successful, or an SQLite error code otherwise. +// */ +func _sqlite3BtreeNewDb(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + _sqlite3BtreeEnter(tls, p) + (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPage = uint32(0) + rc = _newDatabase(tls, (*TBtree)(unsafe.Pointer(p)).FpBt) + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Attempt to start a new transaction. A write-transaction +// ** is started if the second argument is nonzero, otherwise a read- +// ** transaction. If the second argument is 2 or more and exclusive +// ** transaction is started, meaning that no other process is allowed +// ** to access the database. A preexisting transaction may not be +// ** upgraded to exclusive by calling this routine a second time - the +// ** exclusivity flag only works for a new transaction. +// ** +// ** A write-transaction must be started before attempting any +// ** changes to the database. None of the following routines +// ** will work unless a transaction is started first: +// ** +// ** sqlite3BtreeCreateTable() +// ** sqlite3BtreeCreateIndex() +// ** sqlite3BtreeClearTable() +// ** sqlite3BtreeDropTable() +// ** sqlite3BtreeInsert() +// ** sqlite3BtreeDelete() +// ** sqlite3BtreeUpdateMeta() +// ** +// ** If an initial attempt to acquire the lock fails because of lock contention +// ** and the database was previously unlocked, then invoke the busy handler +// ** if there is one. But if there was previously a read-lock, do not +// ** invoke the busy handler - just return SQLITE_BUSY. SQLITE_BUSY is +// ** returned when there is already a read-lock in order to avoid a deadlock. +// ** +// ** Suppose there are two processes A and B. A has a read lock and B has +// ** a reserved lock. B tries to promote to exclusive but is blocked because +// ** of A's read lock. A tries to promote to reserved but is blocked by B. +// ** One or the other of the two processes must give way or there can be +// ** no progress. By returning SQLITE_BUSY and not invoking the busy callback +// ** when A already has a read lock, we encourage A to give up and let B +// ** proceed. +// */ +func _btreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uintptr) (r int32) { + var pBlock, pBt, pIter, pPage1, pPager, p1, p3, p4, p8, p9 uintptr + var rc, v5, v7 int32 + var v6 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = pBlock, pBt, pIter, pPage1, pPager, rc, v5, v6, v7, p1, p3, p4, p8, p9 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager + rc = SQLITE_OK + _sqlite3BtreeEnter(tls, p) + /* If the btree is already in a write-transaction, or it + ** is already in a read-transaction and a read-transaction + ** is requested, this is a no-op. + */ + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) || int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_READ) && !(wrflag != 0) { + goto trans_begun + } + if (*Tsqlite3)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).Fdb)).Fflags&uint64(SQLITE_ResetDatabase) != 0 && int32(_sqlite3PagerIsreadonly(tls, pPager)) == 0 { + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_READ_ONLY)) + } + /* Write transactions are not possible on a read-only database */ + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_READ_ONLY) != 0 && wrflag != 0 { + rc = int32(SQLITE_READONLY) + goto trans_begun + } + pBlock = uintptr(0) + /* If another database handle has already opened a write transaction + ** on this shared-btree structure and a second write transaction is + ** requested, return SQLITE_LOCKED. + */ + if wrflag != 0 && int32((*TBtShared)(unsafe.Pointer(pBt)).FinTransaction) == int32(TRANS_WRITE) || int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_PENDING) != 0 { + pBlock = (*TBtree)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpWriter)).Fdb + } else { + if wrflag > int32(1) { + pIter = (*TBtShared)(unsafe.Pointer(pBt)).FpLock + for { + if !(pIter != 0) { + break + } + if (*TBtLock)(unsafe.Pointer(pIter)).FpBtree != p { + pBlock = (*TBtree)(unsafe.Pointer((*TBtLock)(unsafe.Pointer(pIter)).FpBtree)).Fdb + break + } + goto _2 + _2: + ; + pIter = (*TBtLock)(unsafe.Pointer(pIter)).FpNext + } + } + } + if pBlock != 0 { + _sqlite3ConnectionBlocked(tls, (*TBtree)(unsafe.Pointer(p)).Fdb, pBlock) + rc = libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(1)<pPage1 is populated or + ** lockBtree() returns something other than SQLITE_OK. lockBtree() + ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after + ** reading page 1 it discovers that the page-size of the database + ** file is not pBt->pageSize. In this case lockBtree() will update + ** pBt->pageSize to the page-size of the file on disk. + */ + for { + if v6 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 == uintptr(0); v6 { + v5 = _lockBtree(tls, pBt) + rc = v5 + } + if !(v6 && SQLITE_OK == v5) { + break + } + } + if rc == SQLITE_OK && wrflag != 0 { + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_READ_ONLY) != 0 { + rc = int32(SQLITE_READONLY) + } else { + rc = _sqlite3PagerBegin(tls, pPager, libc.BoolInt32(wrflag > int32(1)), _sqlite3TempInMemory(tls, (*TBtree)(unsafe.Pointer(p)).Fdb)) + if rc == SQLITE_OK { + rc = _newDatabase(tls, pBt) + } else { + if rc == libc.Int32FromInt32(SQLITE_BUSY)|libc.Int32FromInt32(2)< int32((*TBtShared)(unsafe.Pointer(pBt)).FinTransaction) { + (*TBtShared)(unsafe.Pointer(pBt)).FinTransaction = (*TBtree)(unsafe.Pointer(p)).FinTrans + } + if wrflag != 0 { + pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 + (*TBtShared)(unsafe.Pointer(pBt)).FpWriter = p + p8 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p8)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p8))) & ^libc.Int32FromInt32(BTS_EXCLUSIVE)) + if wrflag > int32(1) { + p9 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p9)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p9))) | libc.Int32FromInt32(BTS_EXCLUSIVE)) + } + /* If the db-size header field is incorrect (as it may be if an old + ** client has been writing the database file), update it now. Doing + ** this sooner rather than later means the database size can safely + ** re-read the database size from page 1 if a savepoint or transaction + ** rollback occurs within the transaction. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FnPage != _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+28) { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if rc == SQLITE_OK { + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+28, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) + } + } + } + } +trans_begun: + ; + if rc == SQLITE_OK { + if pSchemaVersion != 0 { + *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) + } + if wrflag != 0 { + /* This call makes sure that the pager has the correct number of + ** open savepoints. If the second parameter is greater than 0 and + ** the sub-journal is not already open, then it will be opened here. + */ + rc = _sqlite3PagerOpenSavepoint(tls, pPager, (*Tsqlite3)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).Fdb)).FnSavepoint) + } + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +func _sqlite3BtreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uintptr) (r int32) { + var pBt uintptr + _ = pBt + if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 || int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == TRANS_NONE || int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_READ) && wrflag != 0 { + return _btreeBeginTrans(tls, p, wrflag, pSchemaVersion) + } + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + if pSchemaVersion != 0 { + *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+40)) + } + if wrflag != 0 { + /* This call makes sure that the pager has the correct number of + ** open savepoints. If the second parameter is greater than 0 and + ** the sub-journal is not already open, then it will be opened here. + */ + return _sqlite3PagerOpenSavepoint(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, (*Tsqlite3)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).Fdb)).FnSavepoint) + } else { + return SQLITE_OK + } + return r +} + +// C documentation +// +// /* +// ** Set the pointer-map entries for all children of page pPage. Also, if +// ** pPage contains cells that point to overflow pages, set the pointer +// ** map entries for the overflow pages as well. +// */ +func _setChildPtrmaps(tls *libc.TLS, pPage uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var childPgno, childPgno1, pgno TPgno + var i, nCell, v1 int32 + var pBt, pCell uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _ = childPgno, childPgno1, i, nCell, pBt, pCell, pgno, v1 /* Return code */ + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + pgno = (*TMemPage)(unsafe.Pointer(pPage)).Fpgno + if (*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + v1 = SQLITE_OK + } else { + v1 = _btreeInitPage(tls, pPage) + } + *(*int32)(unsafe.Pointer(bp)) = v1 + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp)) + } + nCell = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + i = 0 + for { + if !(i < nCell) { + break + } + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*i)))))) + _ptrmapPutOvflPtr(tls, pPage, pPage, pCell, bp) + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + childPgno = _sqlite3Get4byte(tls, pCell) + _ptrmapPut(tls, pBt, childPgno, uint8(PTRMAP_BTREE), pgno, bp) + } + goto _2 + _2: + ; + i++ + } + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + childPgno1 = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) + _ptrmapPut(tls, pBt, childPgno1, uint8(PTRMAP_BTREE), pgno, bp) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Somewhere on pPage is a pointer to page iFrom. Modify this pointer so +// ** that it points to iTo. Parameter eType describes the type of pointer to +// ** be modified, as follows: +// ** +// ** PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child +// ** page of pPage. +// ** +// ** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow +// ** page pointed to by one of the cells on pPage. +// ** +// ** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next +// ** overflow page in the list. +// */ +func _modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom TPgno, iTo TPgno, eType Tu8) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, nCell, rc, v1 int32 + var pCell uintptr + var _ /* info at bp+0 */ TCellInfo + _, _, _, _, _ = i, nCell, pCell, rc, v1 + if int32(eType) == int32(PTRMAP_OVERFLOW2) { + /* The pointer is always the first 4 bytes of the page in this case. */ + if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { + return _sqlite3CorruptError(tls, int32(73995)) + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData, iTo) + } else { + if (*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + v1 = SQLITE_OK + } else { + v1 = _btreeInitPage(tls, pPage) + } + rc = v1 + if rc != 0 { + return rc + } + nCell = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + i = 0 + for { + if !(i < nCell) { + break + } + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*i)))))) + if int32(eType) == int32(PTRMAP_OVERFLOW1) { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp) + if uint32((*(*TCellInfo)(unsafe.Pointer(bp))).FnLocal) < (*(*TCellInfo)(unsafe.Pointer(bp))).FnPayload { + if pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { + return _sqlite3CorruptError(tls, int32(74014)) + } + if iFrom == _sqlite3Get4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4)) { + _sqlite3Put4byte(tls, pCell+uintptr((*(*TCellInfo)(unsafe.Pointer(bp))).FnSize)-uintptr(4), iTo) + break + } + } + } else { + if pCell+uintptr(4) > (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) { + return _sqlite3CorruptError(tls, int32(74023)) + } + if _sqlite3Get4byte(tls, pCell) == iFrom { + _sqlite3Put4byte(tls, pCell, iTo) + break + } + } + goto _2 + _2: + ; + i++ + } + if i == nCell { + if int32(eType) != int32(PTRMAP_BTREE) || _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) != iFrom { + return _sqlite3CorruptError(tls, int32(74035)) + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)), iTo) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Move the open database page pDbPage to location iFreePage in the +// ** database. The pDbPage reference remains valid. +// ** +// ** The isCommit flag indicates that there is no need to remember that +// ** the journal needs to be sync()ed before database page pDbPage->pgno +// ** can be written to. The caller has already promised not to write to that +// ** page. +// */ +func _relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType Tu8, iPtrPage TPgno, iFreePage TPgno, isCommit int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iDbPage, nextOvfl TPgno + var pPager uintptr + var _ /* pPtrPage at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _, _ = iDbPage, nextOvfl, pPager /* The page that contains a pointer to pDbPage */ + iDbPage = (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno + pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager + if iDbPage < uint32(3) { + return _sqlite3CorruptError(tls, int32(74070)) + } + /* Move page iDbPage from its current location to page number iFreePage */ + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerMovepage(tls, pPager, (*TMemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) + if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 8)) + } + (*TMemPage)(unsafe.Pointer(pDbPage)).Fpgno = iFreePage + /* If pDbPage was a btree-page, then it may have child pages and/or cells + ** that point to overflow pages. The pointer map entries for all these + ** pages need to be changed. + ** + ** If pDbPage is an overflow page, then the first 4 bytes may store a + ** pointer to a subsequent overflow page. If this is the case, then + ** the pointer map needs to be updated for the subsequent overflow page. + */ + if int32(eType) == int32(PTRMAP_BTREE) || int32(eType) == int32(PTRMAP_ROOTPAGE) { + *(*int32)(unsafe.Pointer(bp + 8)) = _setChildPtrmaps(tls, pDbPage) + if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 8)) + } + } else { + nextOvfl = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pDbPage)).FaData) + if nextOvfl != uint32(0) { + _ptrmapPut(tls, pBt, nextOvfl, uint8(PTRMAP_OVERFLOW2), iFreePage, bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 8)) + } + } + } + /* Fix the database pointer on page iPtrPage that pointed at iDbPage so + ** that it points at iFreePage. Also fix the pointer map entry for + ** iPtrPage. + */ + if int32(eType) != int32(PTRMAP_ROOTPAGE) { + *(*int32)(unsafe.Pointer(bp + 8)) = _btreeGetPage(tls, pBt, iPtrPage, bp, 0) + if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 8)) + } + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 8)) != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 8)) + } + *(*int32)(unsafe.Pointer(bp + 8)) = _modifyPagePointer(tls, *(*uintptr)(unsafe.Pointer(bp)), iDbPage, iFreePage, eType) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + _ptrmapPut(tls, pBt, iFreePage, eType, iPtrPage, bp+8) + } + } + return *(*int32)(unsafe.Pointer(bp + 8)) +} + +// C documentation +// +// /* +// ** Perform a single step of an incremental-vacuum. If successful, return +// ** SQLITE_OK. If there is no work to do (and therefore no point in +// ** calling this function again), return SQLITE_DONE. Or, if an error +// ** occurs, return some other error code. +// ** +// ** More specifically, this function attempts to re-organize the database so +// ** that the last page of the file currently in use is no longer in use. +// ** +// ** Parameter nFin is the number of pages that this database would contain +// ** were this function called until it returns SQLITE_DONE. +// ** +// ** If the bCommit parameter is non-zero, this function assumes that the +// ** caller will keep calling incrVacuumStep() until it returns SQLITE_DONE +// ** or an error. bCommit is passed true for an auto-vacuum-on-commit +// ** operation, or false for an incremental vacuum. +// */ +func _incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin TPgno, iLastPg TPgno, bCommit int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var dbSize, iNear, nFreeList TPgno + var eMode Tu8 + var rc int32 + var _ /* eType at bp+0 */ Tu8 + var _ /* iFreePg at bp+24 */ TPgno + var _ /* iFreePg at bp+8 */ TPgno + var _ /* iPtrPage at bp+4 */ TPgno + var _ /* pFreePg at bp+16 */ uintptr + var _ /* pFreePg at bp+40 */ uintptr + var _ /* pLastPg at bp+32 */ uintptr + _, _, _, _, _ = dbSize, eMode, iNear, nFreeList, rc + if !(_ptrmapPageno(tls, pBt, iLastPg) == iLastPg) && iLastPg != uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + nFreeList = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) + if nFreeList == uint32(0) { + return int32(SQLITE_DONE) + } + rc = _ptrmapGet(tls, pBt, iLastPg, bp, bp+4) + if rc != SQLITE_OK { + return rc + } + if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_ROOTPAGE) { + return _sqlite3CorruptError(tls, int32(74168)) + } + if int32(*(*Tu8)(unsafe.Pointer(bp))) == int32(PTRMAP_FREEPAGE) { + if bCommit == 0 { + rc = _allocateBtreePage(tls, pBt, bp+16, bp+8, iLastPg, uint8(BTALLOC_EXACT)) + if rc != SQLITE_OK { + return rc + } + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + } + } else { + eMode = uint8(BTALLOC_ANY) /* Mode parameter for allocateBtreePage() */ + iNear = uint32(0) /* nearby parameter for allocateBtreePage() */ + rc = _btreeGetPage(tls, pBt, iLastPg, bp+32, 0) + if rc != SQLITE_OK { + return rc + } + /* If bCommit is zero, this loop runs exactly once and page pLastPg + ** is swapped with the first free page pulled off the free list. + ** + ** On the other hand, if bCommit is greater than zero, then keep + ** looping until a free-page located within the first nFin pages + ** of the file is found. + */ + if bCommit == 0 { + eMode = uint8(BTALLOC_LE) + iNear = nFin + } + for cond := true; cond; cond = bCommit != 0 && *(*TPgno)(unsafe.Pointer(bp + 24)) > nFin { + dbSize = _btreePagecount(tls, pBt) + rc = _allocateBtreePage(tls, pBt, bp+40, bp+24, iNear, eMode) + if rc != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) + return rc + } + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) + if *(*TPgno)(unsafe.Pointer(bp + 24)) > dbSize { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) + return _sqlite3CorruptError(tls, int32(74220)) + } + } + rc = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*Tu8)(unsafe.Pointer(bp)), *(*TPgno)(unsafe.Pointer(bp + 4)), *(*TPgno)(unsafe.Pointer(bp + 24)), bCommit) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) + if rc != SQLITE_OK { + return rc + } + } + } + if bCommit == 0 { + for cond := true; cond; cond = iLastPg == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) || _ptrmapPageno(tls, pBt, iLastPg) == iLastPg { + iLastPg-- + } + (*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate = uint8(1) + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = iLastPg + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The database opened by the first argument is an auto-vacuum database +// ** nOrig pages in size containing nFree free pages. Return the expected +// ** size of the database in pages following an auto-vacuum operation. +// */ +func _finalDbSize(tls *libc.TLS, pBt uintptr, nOrig TPgno, nFree TPgno) (r TPgno) { + var nEntry int32 + var nFin, nPtrmap TPgno + _, _, _ = nEntry, nFin, nPtrmap /* Return value */ + nEntry = int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize / uint32(5)) + nPtrmap = (nFree - nOrig + _ptrmapPageno(tls, pBt, nOrig) + uint32(nEntry)) / uint32(nEntry) + nFin = nOrig - nFree - nPtrmap + if nOrig > uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) && nFin < uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + nFin-- + } + for _ptrmapPageno(tls, pBt, nFin) == nFin || nFin == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + nFin-- + } + return nFin +} + +// C documentation +// +// /* +// ** A write-transaction must be opened before calling this function. +// ** It performs a single unit of work towards an incremental vacuum. +// ** +// ** If the incremental vacuum is finished after this function has run, +// ** SQLITE_DONE is returned. If it is not finished, but no error occurred, +// ** SQLITE_OK is returned. Otherwise an SQLite error code. +// */ +func _sqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) (r int32) { + var nFin, nFree, nOrig TPgno + var pBt uintptr + var rc int32 + _, _, _, _, _ = nFin, nFree, nOrig, pBt, rc + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + if !((*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + rc = int32(SQLITE_DONE) + } else { + nOrig = _btreePagecount(tls, pBt) + nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) + nFin = _finalDbSize(tls, pBt, nOrig, nFree) + if nOrig < nFin || nFree >= nOrig { + rc = _sqlite3CorruptError(tls, int32(74288)) + } else { + if nFree > uint32(0) { + rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + if rc == SQLITE_OK { + _invalidateAllOverflowCache(tls, pBt) + rc = _incrVacuumStep(tls, pBt, nFin, nOrig, 0) + } + if rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+28, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) + } + } else { + rc = int32(SQLITE_DONE) + } + } + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** This routine is called prior to sqlite3PagerCommit when a transaction +// ** is committed for an auto-vacuum database. +// */ +func _autoVacuumCommit(tls *libc.TLS, p uintptr) (r int32) { + var db, pBt, pPager uintptr + var iDb, rc int32 + var iFree, nFin, nFree, nOrig, nVac TPgno + _, _, _, _, _, _, _, _, _, _ = db, iDb, iFree, nFin, nFree, nOrig, nVac, pBt, pPager, rc + rc = SQLITE_OK + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + pPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager + _invalidateAllOverflowCache(tls, pBt) + if !((*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum != 0) { /* Database size before freeing */ + nOrig = _btreePagecount(tls, pBt) + if _ptrmapPageno(tls, pBt, nOrig) == nOrig || nOrig == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + /* It is not possible to create a database for which the final page + ** is either a pointer-map page or the pending-byte page. If one + ** is encountered, this indicates corruption. + */ + return _sqlite3CorruptError(tls, int32(74339)) + } + nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36) + db = (*TBtree)(unsafe.Pointer(p)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages != 0 { + iDb = 0 + for { + if !(iDb < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt == p { + break + } + goto _1 + _1: + ; + iDb++ + } + nVac = (*(*func(*libc.TLS, uintptr, uintptr, Tu32, Tu32, Tu32) uint32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, nOrig, nFree, (*TBtShared)(unsafe.Pointer(pBt)).FpageSize) + if nVac > nFree { + nVac = nFree + } + if nVac == uint32(0) { + return SQLITE_OK + } + } else { + nVac = nFree + } + nFin = _finalDbSize(tls, pBt, nOrig, nVac) + if nFin > nOrig { + return _sqlite3CorruptError(tls, int32(74366)) + } + if nFin < nOrig { + rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + } + iFree = nOrig + for { + if !(iFree > nFin && rc == SQLITE_OK) { + break + } + rc = _incrVacuumStep(tls, pBt, nFin, iFree, libc.BoolInt32(nVac == nFree)) + goto _2 + _2: + ; + iFree-- + } + if (rc == int32(SQLITE_DONE) || rc == SQLITE_OK) && nFree > uint32(0) { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if nVac == nFree { + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32, uint32(0)) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36, uint32(0)) + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+28, nFin) + (*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate = uint8(1) + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = nFin + } + if rc != SQLITE_OK { + _sqlite3PagerRollback(tls, pPager) + } + } + return rc +} + +// C documentation +// +// /* +// ** This routine does the first phase of a two-phase commit. This routine +// ** causes a rollback journal to be created (if it does not already exist) +// ** and populated with enough information so that if a power loss occurs +// ** the database can be restored to its original state by playing back +// ** the journal. Then the contents of the journal are flushed out to +// ** the disk. After the journal is safely on oxide, the changes to the +// ** database are written into the database file and flushed to oxide. +// ** At the end of this call, the rollback journal still exists on the +// ** disk and we are still holding all locks, so the transaction has not +// ** committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the +// ** commit process. +// ** +// ** This call is a no-op if no write-transaction is currently active on pBt. +// ** +// ** Otherwise, sync the database file for the btree pBt. zSuperJrnl points to +// ** the name of a super-journal file that should be written into the +// ** individual journal file, or is NULL, indicating no super-journal file +// ** (single database transaction). +// ** +// ** When this is called, the super-journal should already have been +// ** created, populated with this journal pointer and synced to disk. +// ** +// ** Once this is routine has returned, the only thing required to commit +// ** the write-transaction for this database file is to delete the journal. +// */ +func _sqlite3BtreeCommitPhaseOne(tls *libc.TLS, p uintptr, zSuperJrnl uintptr) (r int32) { + var pBt uintptr + var rc int32 + _, _ = pBt, rc + rc = SQLITE_OK + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + rc = _autoVacuumCommit(tls, p) + if rc != SQLITE_OK { + _sqlite3BtreeLeave(tls, p) + return rc + } + } + if (*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate != 0 { + _sqlite3PagerTruncateImage(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) + } + rc = _sqlite3PagerCommitPhaseOne(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, zSuperJrnl, 0) + _sqlite3BtreeLeave(tls, p) + } + return rc +} + +// C documentation +// +// /* +// ** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback() +// ** at the conclusion of a transaction. +// */ +func _btreeEndTransaction(tls *libc.TLS, p uintptr) { + var db, pBt uintptr + _, _ = db, pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + db = (*TBtree)(unsafe.Pointer(p)).Fdb + (*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate = uint8(0) + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) > TRANS_NONE && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1) { + /* If there are other active statements that belong to this database + ** handle, downgrade to a read-only transaction. The other statements + ** may still be reading from the database. */ + _downgradeAllSharedCacheTableLocks(tls, p) + (*TBtree)(unsafe.Pointer(p)).FinTrans = uint8(TRANS_READ) + } else { + /* If the handle had any kind of transaction open, decrement the + ** transaction count of the shared btree. If the transaction count + ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused() + ** call below will unlock the pager. */ + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) != TRANS_NONE { + _clearAllSharedCacheTableLocks(tls, p) + (*TBtShared)(unsafe.Pointer(pBt)).FnTransaction-- + if 0 == (*TBtShared)(unsafe.Pointer(pBt)).FnTransaction { + (*TBtShared)(unsafe.Pointer(pBt)).FinTransaction = uint8(TRANS_NONE) + } + } + /* Set the current transaction state to TRANS_NONE and unlock the + ** pager if this call closed the only read or write transaction. */ + (*TBtree)(unsafe.Pointer(p)).FinTrans = uint8(TRANS_NONE) + _unlockBtreeIfUnused(tls, pBt) + } +} + +// C documentation +// +// /* +// ** Commit the transaction currently in progress. +// ** +// ** This routine implements the second phase of a 2-phase commit. The +// ** sqlite3BtreeCommitPhaseOne() routine does the first phase and should +// ** be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne() +// ** routine did all the work of writing information out to disk and flushing the +// ** contents so that they are written onto the disk platter. All this +// ** routine has to do is delete or truncate or zero the header in the +// ** the rollback journal (which causes the transaction to commit) and +// ** drop locks. +// ** +// ** Normally, if an error occurs while the pager layer is attempting to +// ** finalize the underlying journal file, this function returns an error and +// ** the upper layer will attempt a rollback. However, if the second argument +// ** is non-zero then this b-tree transaction is part of a multi-file +// ** transaction. In this case, the transaction has already been committed +// ** (by deleting a super-journal file) and the caller will ignore this +// ** functions return code. So, even if an error occurs in the pager layer, +// ** reset the b-tree objects internal state to indicate that the write +// ** transaction has been closed. This is quite safe, as the pager will have +// ** transitioned to the error state. +// ** +// ** This will release the write lock on the database file. If there +// ** are no active cursors, it also releases the read lock. +// */ +func _sqlite3BtreeCommitPhaseTwo(tls *libc.TLS, p uintptr, bCleanup int32) (r int32) { + var pBt uintptr + var rc int32 + _, _ = pBt, rc + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == TRANS_NONE { + return SQLITE_OK + } + _sqlite3BtreeEnter(tls, p) + /* If the handle has a write-transaction open, commit the shared-btrees + ** transaction and set the shared state to TRANS_READ. + */ + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + rc = _sqlite3PagerCommitPhaseTwo(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + if rc != SQLITE_OK && bCleanup == 0 { + _sqlite3BtreeLeave(tls, p) + return rc + } + (*TBtree)(unsafe.Pointer(p)).FiBDataVersion-- /* Compensate for pPager->iDataVersion++; */ + (*TBtShared)(unsafe.Pointer(pBt)).FinTransaction = uint8(TRANS_READ) + _btreeClearHasContent(tls, pBt) + } + _btreeEndTransaction(tls, p) + _sqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Do both phases of a commit. +// */ +func _sqlite3BtreeCommit(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + _sqlite3BtreeEnter(tls, p) + rc = _sqlite3BtreeCommitPhaseOne(tls, p, uintptr(0)) + if rc == SQLITE_OK { + rc = _sqlite3BtreeCommitPhaseTwo(tls, p, 0) + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** This routine sets the state to CURSOR_FAULT and the error +// ** code to errCode for every cursor on any BtShared that pBtree +// ** references. Or if the writeOnly flag is set to 1, then only +// ** trip write cursors and leave read cursors unchanged. +// ** +// ** Every cursor is a candidate to be tripped, including cursors +// ** that belong to other database connections that happen to be +// ** sharing the cache with pBtree. +// ** +// ** This routine gets called when a rollback occurs. If the writeOnly +// ** flag is true, then only write-cursors need be tripped - read-only +// ** cursors save their current positions so that they may continue +// ** following the rollback. Or, if writeOnly is false, all cursors are +// ** tripped. In general, writeOnly is false if the transaction being +// ** rolled back modified the database schema. In this case b-tree root +// ** pages may be moved or deleted from the database altogether, making +// ** it unsafe for read cursors to continue. +// ** +// ** If the writeOnly flag is true and an error is encountered while +// ** saving the current position of a read-only cursor, all cursors, +// ** including all read-cursors are tripped. +// ** +// ** SQLITE_OK is returned if successful, or if an error occurs while +// ** saving a cursor position, an SQLite error code. +// */ +func _sqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, writeOnly int32) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + rc = SQLITE_OK + if pBtree != 0 { + _sqlite3BtreeEnter(tls, pBtree) + p = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor + for { + if !(p != 0) { + break + } + if writeOnly != 0 && int32((*TBtCursor)(unsafe.Pointer(p)).FcurFlags)&int32(BTCF_WriteFlag) == 0 { + if int32((*TBtCursor)(unsafe.Pointer(p)).FeState) == CURSOR_VALID || int32((*TBtCursor)(unsafe.Pointer(p)).FeState) == int32(CURSOR_SKIPNEXT) { + rc = _saveCursorPosition(tls, p) + if rc != SQLITE_OK { + _sqlite3BtreeTripAllCursors(tls, pBtree, rc, 0) + break + } + } + } else { + _sqlite3BtreeClearCursor(tls, p) + (*TBtCursor)(unsafe.Pointer(p)).FeState = uint8(CURSOR_FAULT) + (*TBtCursor)(unsafe.Pointer(p)).FskipNext = errCode + } + _btreeReleaseAllCursorPages(tls, p) + goto _1 + _1: + ; + p = (*TBtCursor)(unsafe.Pointer(p)).FpNext + } + _sqlite3BtreeLeave(tls, pBtree) + } + return rc +} + +// C documentation +// +// /* +// ** Set the pBt->nPage field correctly, according to the current +// ** state of the database. Assume pBt->pPage1 is valid. +// */ +func _btreeSetNPage(tls *libc.TLS, pBt uintptr, pPage1 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* nPage at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = int32(_sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+28)) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + _sqlite3PagerPagecount(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, bp) + } + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = uint32(*(*int32)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Rollback the transaction in progress. +// ** +// ** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped). +// ** Only write cursors are tripped if writeOnly is true but all cursors are +// ** tripped if writeOnly is false. Any attempt to use +// ** a tripped cursor will result in an error. +// ** +// ** This will release the write lock on the database file. If there +// ** are no active cursors, it also releases the read lock. +// */ +func _sqlite3BtreeRollback(tls *libc.TLS, p uintptr, tripCode int32, writeOnly int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pBt uintptr + var rc, rc2, rc21, v1 int32 + var _ /* pPage1 at bp+0 */ uintptr + _, _, _, _, _ = pBt, rc, rc2, rc21, v1 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + if tripCode == SQLITE_OK { + v1 = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + tripCode = v1 + rc = v1 + if rc != 0 { + writeOnly = 0 + } + } else { + rc = SQLITE_OK + } + if tripCode != 0 { + rc2 = _sqlite3BtreeTripAllCursors(tls, p, tripCode, writeOnly) + if rc2 != SQLITE_OK { + rc = rc2 + } + } + if int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { + rc21 = _sqlite3PagerRollback(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + if rc21 != SQLITE_OK { + rc = rc21 + } + /* The rollback may have destroyed the pPage1->aData value. So + ** call btreeGetPage() on page 1 again to make + ** sure pPage1->aData is set correctly. */ + if _btreeGetPage(tls, pBt, uint32(1), bp, 0) == SQLITE_OK { + _btreeSetNPage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp))) + _releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + (*TBtShared)(unsafe.Pointer(pBt)).FinTransaction = uint8(TRANS_READ) + _btreeClearHasContent(tls, pBt) + } + _btreeEndTransaction(tls, p) + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Start a statement subtransaction. The subtransaction can be rolled +// ** back independently of the main transaction. You must start a transaction +// ** before starting a subtransaction. The subtransaction is ended automatically +// ** if the main transaction commits or rolls back. +// ** +// ** Statement subtransactions are used around individual SQL statements +// ** that are contained within a BEGIN...COMMIT block. If a constraint +// ** error occurs within the statement, the effect of that one statement +// ** can be rolled back without having to rollback the entire transaction. +// ** +// ** A statement sub-transaction is implemented as an anonymous savepoint. The +// ** value passed as the second parameter is the total number of savepoints, +// ** including the new anonymous savepoint, open on the B-Tree. i.e. if there +// ** are no active savepoints and no other statement-transactions open, +// ** iStatement is 1. This anonymous savepoint can be released or rolled back +// ** using the sqlite3BtreeSavepoint() function. +// */ +func _sqlite3BtreeBeginStmt(tls *libc.TLS, p uintptr, iStatement int32) (r int32) { + var pBt uintptr + var rc int32 + _, _ = pBt, rc + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + /* At the pager level, a statement transaction is a savepoint with + ** an index greater than all savepoints created explicitly using + ** SQL statements. It is illegal to open, release or rollback any + ** such savepoints while the statement transaction savepoint is active. + */ + rc = _sqlite3PagerOpenSavepoint(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, iStatement) + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** The second argument to this function, op, is always SAVEPOINT_ROLLBACK +// ** or SAVEPOINT_RELEASE. This function either releases or rolls back the +// ** savepoint identified by parameter iSavepoint, depending on the value +// ** of op. +// ** +// ** Normally, iSavepoint is greater than or equal to zero. However, if op is +// ** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the +// ** contents of the entire transaction are rolled back. This is different +// ** from a normal transaction rollback, as no locks are released and the +// ** transaction remains open. +// */ +func _sqlite3BtreeSavepoint(tls *libc.TLS, p uintptr, op int32, iSavepoint int32) (r int32) { + var pBt uintptr + var rc int32 + _, _ = pBt, rc + rc = SQLITE_OK + if p != 0 && int32((*TBtree)(unsafe.Pointer(p)).FinTrans) == int32(TRANS_WRITE) { + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + if op == int32(SAVEPOINT_ROLLBACK) { + rc = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = _sqlite3PagerSavepoint(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, op, iSavepoint) + } + if rc == SQLITE_OK { + if iSavepoint < 0 && int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_INITIALLY_EMPTY) != 0 { + (*TBtShared)(unsafe.Pointer(pBt)).FnPage = uint32(0) + } + rc = _newDatabase(tls, pBt) + _btreeSetNPage(tls, pBt, (*TBtShared)(unsafe.Pointer(pBt)).FpPage1) + /* pBt->nPage might be zero if the database was corrupt when + ** the transaction was started. Otherwise, it must be at least 1. */ + } + _sqlite3BtreeLeave(tls, p) + } + return rc +} + +// C documentation +// +// /* +// ** Create a new cursor for the BTree whose root is on the page +// ** iTable. If a read-only cursor is requested, it is assumed that +// ** the caller already has at least a read-only transaction open +// ** on the database already. If a write-cursor is requested, then +// ** the caller is assumed to have an open write transaction. +// ** +// ** If the BTREE_WRCSR bit of wrFlag is clear, then the cursor can only +// ** be used for reading. If the BTREE_WRCSR bit is set, then the cursor +// ** can be used for reading or for writing if other conditions for writing +// ** are also met. These are the conditions that must be met in order +// ** for writing to be allowed: +// ** +// ** 1: The cursor must have been opened with wrFlag containing BTREE_WRCSR +// ** +// ** 2: Other database connections that share the same pager cache +// ** but which are not in the READ_UNCOMMITTED state may not have +// ** cursors open with wrFlag==0 on the same table. Otherwise +// ** the changes made by this write cursor would be visible to +// ** the read cursors in the other database connection. +// ** +// ** 3: The database must be writable (not on read-only media) +// ** +// ** 4: There must be an active transaction. +// ** +// ** The BTREE_FORDELETE bit of wrFlag may optionally be set if BTREE_WRCSR +// ** is set. If FORDELETE is set, that is a hint to the implementation that +// ** this cursor will only be used to seek to and delete entries of an index +// ** as part of a larger DELETE statement. The FORDELETE hint is not used by +// ** this implementation. But in a hypothetical alternative storage engine +// ** in which index entries are automatically deleted when corresponding table +// ** rows are deleted, the FORDELETE flag is a hint that all SEEK and DELETE +// ** operations on this cursor can be no-ops and all READ operations can +// ** return a null row (2-bytes: 0x01 0x00). +// ** +// ** No checking is done to make sure that page iTable really is the +// ** root page of a b-tree. If it is not, then the cursor acquired +// ** will not work correctly. +// ** +// ** It is assumed that the sqlite3BtreeCursorZero() has been called +// ** on pCur to initialize the memory space prior to invoking this routine. +// */ +func _btreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) (r int32) { + var pBt, pX, p2, p3 uintptr + _, _, _, _ = pBt, pX, p2, p3 + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Looping over other all cursors */ + /* The following assert statements verify that if this is a sharable + ** b-tree database, the connection is holding the required table locks, + ** and that no other connection has any open cursor that conflicts with + ** this lock. The iTable<1 term disables the check for corrupt schemas. */ + /* Assert that the caller has opened the required transaction. */ + if iTable <= uint32(1) { + if iTable < uint32(1) { + return _sqlite3CorruptError(tls, int32(74830)) + } else { + if _btreePagecount(tls, pBt) == uint32(0) { + iTable = uint32(0) + } + } + } + /* Now that no other errors can occur, finish filling in the BtCursor + ** variables and link the cursor into the BtShared list. */ + (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot = iTable + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage = int8(-int32(1)) + (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo = pKeyInfo + (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree = p + (*TBtCursor)(unsafe.Pointer(pCur)).FpBt = pBt + (*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags = uint8(0) + /* If there are two or more cursors on the same btree, then all such + ** cursors *must* have the BTCF_Multiple flag set. */ + pX = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor + for { + if !(pX != 0) { + break + } + if (*TBtCursor)(unsafe.Pointer(pX)).FpgnoRoot == iTable { + p2 = pX + 1 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTCF_Multiple)) + (*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags = uint8(BTCF_Multiple) + } + goto _1 + _1: + ; + pX = (*TBtCursor)(unsafe.Pointer(pX)).FpNext + } + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + (*TBtCursor)(unsafe.Pointer(pCur)).FpNext = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor + (*TBtShared)(unsafe.Pointer(pBt)).FpCursor = pCur + if wrFlag != 0 { + p3 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) | libc.Int32FromInt32(BTCF_WriteFlag)) + (*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags = uint8(0) + if (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace == uintptr(0) { + return _allocateTempSpace(tls, pBt) + } + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags = uint8(PAGER_GET_READONLY) + } + return SQLITE_OK +} + +func _btreeCursorWithLock(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) (r int32) { + var rc int32 + _ = rc + _sqlite3BtreeEnter(tls, p) + rc = _btreeCursor(tls, p, iTable, wrFlag, pKeyInfo, pCur) + _sqlite3BtreeLeave(tls, p) + return rc +} + +func _sqlite3BtreeCursor(tls *libc.TLS, p uintptr, iTable TPgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) (r int32) { + if (*TBtree)(unsafe.Pointer(p)).Fsharable != 0 { + return _btreeCursorWithLock(tls, p, iTable, wrFlag, pKeyInfo, pCur) + } else { + return _btreeCursor(tls, p, iTable, wrFlag, pKeyInfo, pCur) + } + return r +} + +// C documentation +// +// /* +// ** Return the size of a BtCursor object in bytes. +// ** +// ** This interfaces is needed so that users of cursors can preallocate +// ** sufficient storage to hold a cursor. The BtCursor object is opaque +// ** to users so they cannot do the sizeof() themselves - they must call +// ** this routine. +// */ +func _sqlite3BtreeCursorSize(tls *libc.TLS) (r int32) { + return int32((libc.Uint64FromInt64(296) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) +} + +// C documentation +// +// /* +// ** Initialize memory that will be converted into a BtCursor object. +// ** +// ** The simple approach here would be to memset() the entire object +// ** to zero. But it turns out that the apPage[] and aiIdx[] arrays +// ** do not need to be zeroed and they are large, so we can save a lot +// ** of run-time by skipping the initialization of those elements. +// */ +func _sqlite3BtreeCursorZero(tls *libc.TLS, p uintptr) { + libc.Xmemset(tls, p, 0, uint64(libc.UintptrFromInt32(0)+32)) +} + +// C documentation +// +// /* +// ** Close a cursor. The read lock on the database file is released +// ** when the last cursor is closed. +// */ +func _sqlite3BtreeCloseCursor(tls *libc.TLS, pCur uintptr) (r int32) { + var pBt, pBtree, pPrev uintptr + _, _, _ = pBt, pBtree, pPrev + pBtree = (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree + if pBtree != 0 { + pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt + _sqlite3BtreeEnter(tls, pBtree) + if (*TBtShared)(unsafe.Pointer(pBt)).FpCursor == pCur { + (*TBtShared)(unsafe.Pointer(pBt)).FpCursor = (*TBtCursor)(unsafe.Pointer(pCur)).FpNext + } else { + pPrev = (*TBtShared)(unsafe.Pointer(pBt)).FpCursor + for cond := true; cond; cond = pPrev != 0 { + if (*TBtCursor)(unsafe.Pointer(pPrev)).FpNext == pCur { + (*TBtCursor)(unsafe.Pointer(pPrev)).FpNext = (*TBtCursor)(unsafe.Pointer(pCur)).FpNext + break + } + pPrev = (*TBtCursor)(unsafe.Pointer(pPrev)).FpNext + } + } + _btreeReleaseAllCursorPages(tls, pCur) + _unlockBtreeIfUnused(tls, pBt) + Xsqlite3_free(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow) + Xsqlite3_free(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpKey) + if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) != 0 && (*TBtShared)(unsafe.Pointer(pBt)).FpCursor == uintptr(0) { + /* Since the BtShared is not sharable, there is no need to + ** worry about the missing sqlite3BtreeLeave() call here. */ + _sqlite3BtreeClose(tls, pBtree) + } else { + _sqlite3BtreeLeave(tls, pBtree) + } + (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree = uintptr(0) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Make sure the BtCursor* given in the argument has a valid +// ** BtCursor.info structure. If it is not already valid, call +// ** btreeParseCell() to fill it in. +// ** +// ** BtCursor.info is a cache of the information in the current cell. +// ** Using this cache reduces the number of calls to btreeParseCell(). +// */ +func _getCellInfo(tls *libc.TLS, pCur uintptr) { + var p1 uintptr + _ = p1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize) == 0 { + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_ValidNKey)) + _btreeParseCell(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage, int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix), pCur+48) + } else { + } +} + +func _sqlite3BtreeCursorIsValidNN(tls *libc.TLS, pCur uintptr) (r int32) { + return libc.BoolInt32(int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID) +} + +// C documentation +// +// /* +// ** Return the value of the integer key or "rowid" for a table btree. +// ** This routine is only valid for a cursor that is pointing into a +// ** ordinary table btree. If the cursor points to an index btree or +// ** is invalid, the result of this routine is undefined. +// */ +func _sqlite3BtreeIntegerKey(tls *libc.TLS, pCur uintptr) (r Ti64) { + _getCellInfo(tls, pCur) + return (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey +} + +// C documentation +// +// /* +// ** Pin or unpin a cursor. +// */ +func _sqlite3BtreeCursorPin(tls *libc.TLS, pCur uintptr) { + var p1 uintptr + _ = p1 + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_Pinned)) +} + +func _sqlite3BtreeCursorUnpin(tls *libc.TLS, pCur uintptr) { + var p1 uintptr + _ = p1 + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTCF_Pinned)) +} + +// C documentation +// +// /* +// ** Return the offset into the database file for the start of the +// ** payload to which the cursor is pointing. +// */ +func _sqlite3BtreeOffset(tls *libc.TLS, pCur uintptr) (r Ti64) { + _getCellInfo(tls, pCur) + return int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize)*(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fpgno)-int64(1)) + (int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload) - int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaData)) +} + +// C documentation +// +// /* +// ** Return the number of bytes of payload for the entry that pCur is +// ** currently pointing to. For table btrees, this will be the amount +// ** of data. For index btrees, this will be the size of the key. +// ** +// ** The caller must guarantee that the cursor is pointing to a non-NULL +// ** valid entry. In other words, the calling procedure must guarantee +// ** that the cursor has Cursor.eState==CURSOR_VALID. +// */ +func _sqlite3BtreePayloadSize(tls *libc.TLS, pCur uintptr) (r Tu32) { + _getCellInfo(tls, pCur) + return (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload +} + +// C documentation +// +// /* +// ** Return an upper bound on the size of any record for the table +// ** that the cursor is pointing into. +// ** +// ** This is an optimization. Everything will still work if this +// ** routine always returns 2147483647 (which is the largest record +// ** that SQLite can handle) or more. But returning a smaller value might +// ** prevent large memory allocations when trying to interpret a +// ** corrupt database. +// ** +// ** The current implementation merely returns the size of the underlying +// ** database file. +// */ +func _sqlite3BtreeMaxRecordSize(tls *libc.TLS, pCur uintptr) (r Tsqlite3_int64) { + return int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize) * int64((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage) +} + +// C documentation +// +// /* +// ** Given the page number of an overflow page in the database (parameter +// ** ovfl), this function finds the page number of the next page in the +// ** linked list of overflow pages. If possible, it uses the auto-vacuum +// ** pointer-map data instead of reading the content of page ovfl to do so. +// ** +// ** If an error occurs an SQLite error code is returned. Otherwise: +// ** +// ** The page number of the next overflow page in the linked list is +// ** written to *pPgnoNext. If page ovfl is the last page in its linked +// ** list, *pPgnoNext is set to zero. +// ** +// ** If ppPage is not NULL, and a reference to the MemPage object corresponding +// ** to page number pOvfl was obtained, then *ppPage is set to point to that +// ** reference. It is the responsibility of the caller to call releasePage() +// ** on *ppPage to free the reference. In no reference was obtained (because +// ** the pointer-map was used to obtain the value for *pPgnoNext), then +// ** *ppPage is set to zero. +// */ +func _getOverflowPage(tls *libc.TLS, pBt uintptr, ovfl TPgno, ppPage uintptr, pPgnoNext uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iGuess, next TPgno + var rc, v1, v2 int32 + var _ /* eType at bp+12 */ Tu8 + var _ /* pPage at bp+0 */ uintptr + var _ /* pgno at bp+8 */ TPgno + _, _, _, _, _ = iGuess, next, rc, v1, v2 + next = uint32(0) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = SQLITE_OK + /* Try to find the next page in the overflow list using the + ** autovacuum pointer-map pages. Guess that the next page in + ** the overflow list is page number (ovfl+1). If that guess turns + ** out to be wrong, fall back to loading the data of page + ** number ovfl to determine the next page number. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + iGuess = ovfl + uint32(1) + for _ptrmapPageno(tls, pBt, iGuess) == iGuess || iGuess == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + iGuess++ + } + if iGuess <= _btreePagecount(tls, pBt) { + rc = _ptrmapGet(tls, pBt, iGuess, bp+12, bp+8) + if rc == SQLITE_OK && int32(*(*Tu8)(unsafe.Pointer(bp + 12))) == int32(PTRMAP_OVERFLOW2) && *(*TPgno)(unsafe.Pointer(bp + 8)) == ovfl { + next = iGuess + rc = int32(SQLITE_DONE) + } + } + } + if rc == SQLITE_OK { + if ppPage == uintptr(0) { + v1 = int32(PAGER_GET_READONLY) + } else { + v1 = 0 + } + rc = _btreeGetPage(tls, pBt, ovfl, bp, v1) + if rc == SQLITE_OK { + next = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) + } + } + *(*TPgno)(unsafe.Pointer(pPgnoNext)) = next + if ppPage != 0 { + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp)) + } else { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if rc == int32(SQLITE_DONE) { + v2 = SQLITE_OK + } else { + v2 = rc + } + return v2 +} + +// C documentation +// +// /* +// ** Copy data from a buffer to a page, or from a page to a buffer. +// ** +// ** pPayload is a pointer to data stored on database page pDbPage. +// ** If argument eOp is false, then nByte bytes of data are copied +// ** from pPayload to the buffer pointed at by pBuf. If eOp is true, +// ** then sqlite3PagerWrite() is called on pDbPage and nByte bytes +// ** of data are copied from the buffer pBuf to pPayload. +// ** +// ** SQLITE_OK is returned on success, otherwise an error code. +// */ +func _copyPayload(tls *libc.TLS, pPayload uintptr, pBuf uintptr, nByte int32, eOp int32, pDbPage uintptr) (r int32) { + var rc int32 + _ = rc + if eOp != 0 { + /* Copy data from buffer to page (a write operation) */ + rc = _sqlite3PagerWrite(tls, pDbPage) + if rc != SQLITE_OK { + return rc + } + libc.Xmemcpy(tls, pPayload, pBuf, uint64(nByte)) + } else { + /* Copy data from page to buffer (a read operation) */ + libc.Xmemcpy(tls, pBuf, pPayload, uint64(nByte)) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function is used to read or overwrite payload information +// ** for the entry that the pCur cursor is pointing to. The eOp +// ** argument is interpreted as follows: +// ** +// ** 0: The operation is a read. Populate the overflow cache. +// ** 1: The operation is a write. Populate the overflow cache. +// ** +// ** A total of "amt" bytes are read or written beginning at "offset". +// ** Data is read to or from the buffer pBuf. +// ** +// ** The content being read or written might appear on the main page +// ** or be scattered out on multiple overflow pages. +// ** +// ** If the current cursor entry uses one or more overflow pages +// ** this function may allocate space for and lazily populate +// ** the overflow page-list cache array (BtCursor.aOverflow). +// ** Subsequent calls use this cache to make seeking to the supplied offset +// ** more efficient. +// ** +// ** Once an overflow page-list cache has been allocated, it must be +// ** invalidated if some other cursor writes to the same table, or if +// ** the cursor is moved to a different row. Additionally, in auto-vacuum +// ** mode, the following events may invalidate an overflow page-list cache. +// ** +// ** * An incremental vacuum, +// ** * A commit in auto_vacuum="full" mode, +// ** * Creating a table (may require moving an overflow page). +// */ +func _accessPayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr, eOp int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, a1, iIdx, nOvfl, rc, v2 int32 + var aNew, aPayload, aWrite, fd, pBt, pBufStart, pPage, p1 uintptr + var ovflSize Tu32 + var _ /* aSave at bp+4 */ [4]Tu8 + var _ /* nextPage at bp+0 */ TPgno + var _ /* pDbPage at bp+8 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, a1, aNew, aPayload, aWrite, fd, iIdx, nOvfl, ovflSize, pBt, pBufStart, pPage, rc, v2, p1 + rc = SQLITE_OK + iIdx = 0 + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Btree page of current entry */ + pBt = (*TBtCursor)(unsafe.Pointer(pCur)).FpBt /* Btree this cursor belongs to */ + pBufStart = pBuf /* Start of original out buffer */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + return _sqlite3CorruptError(tls, int32(75235)) + } + _getCellInfo(tls, pCur) + aPayload = (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload + if uint64(int64(aPayload)-int64((*TMemPage)(unsafe.Pointer(pPage)).FaData)) > uint64((*TBtShared)(unsafe.Pointer(pBt)).FusableSize-uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) { + /* Trying to read or write past the end of the data is an error. The + ** conditional above is really: + ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] + ** but is recast into its current form to avoid integer overflow problems + */ + return _sqlite3CorruptError(tls, int32(75250)) + } + /* Check if data must be read/written to/from the btree page itself. */ + if offset < uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { + a = int32(amt) + if uint32(a)+offset > uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { + a = int32(uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) - offset) + } + rc = _copyPayload(tls, aPayload+uintptr(offset), pBuf, a, eOp, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + offset = uint32(0) + pBuf += uintptr(a) + amt -= uint32(a) + } else { + offset -= uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + } + if rc == SQLITE_OK && amt > uint32(0) { + ovflSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) + *(*TPgno)(unsafe.Pointer(bp)) = _sqlite3Get4byte(tls, aPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + /* If the BtCursor.aOverflow[] has not been allocated, allocate it now. + ** + ** The aOverflow[] array is sized at one entry for each overflow page + ** in the overflow chain. The page number of the first overflow page is + ** stored in aOverflow[0], etc. A value of 0 in the aOverflow[] array + ** means "not yet known" (the cache is lazily populated). + */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_ValidOvfl) == 0 { + nOvfl = int32(((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload - uint32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + ovflSize - uint32(1)) / ovflSize) + if (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow == uintptr(0) || nOvfl*libc.Int32FromInt64(4) > _sqlite3MallocSize(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow) { + aNew = _sqlite3Realloc(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow, uint64(nOvfl*int32(2))*uint64(4)) + if aNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow = aNew + } + } + libc.Xmemset(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow, 0, uint64(nOvfl)*uint64(4)) + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_ValidOvfl)) + } else { + /* If the overflow page-list cache has been allocated and the + ** entry for the first required overflow page is valid, skip + ** directly to it. + */ + if *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(offset/ovflSize)*4)) != 0 { + iIdx = int32(offset / ovflSize) + *(*TPgno)(unsafe.Pointer(bp)) = *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) + offset = offset % ovflSize + } + } + for *(*TPgno)(unsafe.Pointer(bp)) != 0 { + /* If required, populate the overflow page-list cache. */ + if *(*TPgno)(unsafe.Pointer(bp)) > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { + return _sqlite3CorruptError(tls, int32(75312)) + } + *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*TPgno)(unsafe.Pointer(bp)) + if offset >= ovflSize { + /* The only reason to read this page is to obtain the page + ** number for the next page in the overflow chain. The page + ** data is not required. So first try to lookup the overflow + ** page-list cache, if any, then fall back to the getOverflowPage() + ** function. + */ + if *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx+int32(1))*4)) != 0 { + *(*TPgno)(unsafe.Pointer(bp)) = *(*TPgno)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx+int32(1))*4)) + } else { + rc = _getOverflowPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp)), uintptr(0), bp) + } + offset -= ovflSize + } else { + /* Need to read this page properly. It contains some of the + ** range of data that is being read (eOp==0) or written (eOp!=0). + */ + a1 = int32(amt) + if uint32(a1)+offset > ovflSize { + a1 = int32(ovflSize - offset) + } + /* If all the following are true: + ** + ** 1) this is a read operation, and + ** 2) data is required from the start of this overflow page, and + ** 3) there are no dirty pages in the page-cache + ** 4) the database is file-backed, and + ** 5) the page is not in the WAL file + ** 6) at least 4 bytes have already been read into the output buffer + ** + ** then data can be read directly from the database file into the + ** output buffer, bypassing the page-cache altogether. This speeds + ** up loading large records that span many overflow pages. + */ + if eOp == 0 && offset == uint32(0) && _sqlite3PagerDirectReadOk(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, *(*TPgno)(unsafe.Pointer(bp))) != 0 && pBuf+uintptr(-libc.Int32FromInt32(4)) >= pBufStart { + fd = _sqlite3PagerFile(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + aWrite = pBuf + uintptr(-libc.Int32FromInt32(4)) + /* due to (6) */ + libc.Xmemcpy(tls, bp+4, aWrite, uint64(4)) + rc = _sqlite3OsRead(tls, fd, aWrite, a1+int32(4), int64((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)*int64(*(*TPgno)(unsafe.Pointer(bp))-libc.Uint32FromInt32(1))) + *(*TPgno)(unsafe.Pointer(bp)) = _sqlite3Get4byte(tls, aWrite) + libc.Xmemcpy(tls, aWrite, bp+4, uint64(4)) + } else { + if eOp == 0 { + v2 = int32(PAGER_GET_READONLY) + } else { + v2 = 0 + } + rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, *(*TPgno)(unsafe.Pointer(bp)), bp+8, v2) + if rc == SQLITE_OK { + aPayload = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + *(*TPgno)(unsafe.Pointer(bp)) = _sqlite3Get4byte(tls, aPayload) + rc = _copyPayload(tls, aPayload+uintptr(offset+uint32(4)), pBuf, a1, eOp, *(*uintptr)(unsafe.Pointer(bp + 8))) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + offset = uint32(0) + } + } + amt -= uint32(a1) + if amt == uint32(0) { + return rc + } + pBuf += uintptr(a1) + } + if rc != 0 { + break + } + iIdx++ + } + } + if rc == SQLITE_OK && amt > uint32(0) { + /* Overflow chain ends prematurely */ + return _sqlite3CorruptError(tls, int32(75396)) + } + return rc +} + +// C documentation +// +// /* +// ** Read part of the payload for the row at which that cursor pCur is currently +// ** pointing. "amt" bytes will be transferred into pBuf[]. The transfer +// ** begins at "offset". +// ** +// ** pCur can be pointing to either a table or an index b-tree. +// ** If pointing to a table btree, then the content section is read. If +// ** pCur is pointing to an index b-tree then the key section is read. +// ** +// ** For sqlite3BtreePayload(), the caller must ensure that pCur is pointing +// ** to a valid row in the table. For sqlite3BtreePayloadChecked(), the +// ** cursor might be invalid or might need to be restored before being read. +// ** +// ** Return SQLITE_OK on success or an error code if anything goes +// ** wrong. An error is returned if "offset+amt" is larger than +// ** the available payload. +// */ +func _sqlite3BtreePayload(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr) (r int32) { + return _accessPayload(tls, pCur, offset, amt, pBuf, 0) +} + +// C documentation +// +// /* +// ** This variant of sqlite3BtreePayload() works even if the cursor has not +// ** in the CURSOR_VALID state. It is only used by the sqlite3_blob_read() +// ** interface. +// */ +func _accessPayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_INVALID) { + return int32(SQLITE_ABORT) + } + rc = _btreeRestoreCursorPosition(tls, pCur) + if rc != 0 { + v1 = rc + } else { + v1 = _accessPayload(tls, pCur, offset, amt, pBuf, 0) + } + return v1 +} + +func _sqlite3BtreePayloadChecked(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pBuf uintptr) (r int32) { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID { + return _accessPayload(tls, pCur, offset, amt, pBuf, 0) + } else { + return _accessPayloadChecked(tls, pCur, offset, amt, pBuf) + } + return r +} + +// C documentation +// +// /* +// ** Return a pointer to payload information from the entry that the +// ** pCur cursor is pointing to. The pointer is to the beginning of +// ** the key if index btrees (pPage->intKey==0) and is the data for +// ** table btrees (pPage->intKey==1). The number of bytes of available +// ** key/data is written into *pAmt. If *pAmt==0, then the value +// ** returned will not be a valid pointer. +// ** +// ** This routine is an optimization. It is common for the entire key +// ** and data to fit on the local page and for there to be no overflow +// ** pages. When that is so, this routine can be used to access the +// ** key and data without making a copy. If the key and/or data spills +// ** onto overflow pages, then accessPayload() must be used to reassemble +// ** the key/data and copy it into a preallocated buffer. +// ** +// ** The pointer returned by this routine looks directly into the cached +// ** page of the database. The data might change or move the next time +// ** any btree routine is called. +// */ +func _fetchPayload(tls *libc.TLS, pCur uintptr, pAmt uintptr) (r uintptr) { + var amt, v1 int32 + _, _ = amt, v1 + amt = int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + if amt > int32(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd)-int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) { + /* There is too little space on the page for the expected amount + ** of local content. Database must be corrupt. */ + if 0 > int32(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd)-int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) { + v1 = 0 + } else { + v1 = int32(int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd) - int64((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) + } + amt = v1 + } + *(*Tu32)(unsafe.Pointer(pAmt)) = uint32(amt) + return (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload +} + +// C documentation +// +// /* +// ** For the entry that cursor pCur is point to, return as +// ** many bytes of the key or data as are available on the local +// ** b-tree page. Write the number of available bytes into *pAmt. +// ** +// ** The pointer returned is ephemeral. The key/data may move +// ** or be destroyed on the next call to any Btree routine, +// ** including calls from other threads against the same cache. +// ** Hence, a mutex on the BtShared should be held prior to calling +// ** this routine. +// ** +// ** These routines is used to get quick access to key and data +// ** in the common case where no overflow pages are used. +// */ +func _sqlite3BtreePayloadFetch(tls *libc.TLS, pCur uintptr, pAmt uintptr) (r uintptr) { + return _fetchPayload(tls, pCur, pAmt) +} + +// C documentation +// +// /* +// ** Move the cursor down to a new child page. The newPgno argument is the +// ** page number of the child page to move to. +// ** +// ** This function returns SQLITE_CORRUPT if the page-header flags field of +// ** the new child page does not match the flags field of the parent (i.e. +// ** if an intkey page appears to be the parent of a non-intkey page, or +// ** vice-versa). +// */ +func _moveToChild(tls *libc.TLS, pCur uintptr, newPgno Tu32) (r int32) { + var rc int32 + var v2 Ti8 + var v3, p1 uintptr + _, _, _, _ = rc, v2, v3, p1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { + return _sqlite3CorruptError(tls, int32(75534)) + } + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = (*TBtCursor)(unsafe.Pointer(pCur)).Fix + *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage++ + rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, newPgno, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) + if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { + _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) + rc = _sqlite3CorruptError(tls, int32(75548)) + } + if rc != 0 { + v3 = pCur + 84 + *(*Ti8)(unsafe.Pointer(v3))-- + v2 = *(*Ti8)(unsafe.Pointer(v3)) + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(v2)*8)) + } + return rc +} + +// C documentation +// +// /* +// ** Move the cursor up to the parent page. +// ** +// ** pCur->idx is set to the cell index that contains the pointer +// ** to the page we are coming from. If we are coming from the +// ** right-most child page then pCur->idx is set to one more than +// ** the largest cell index. +// */ +func _moveToParent(tls *libc.TLS, pCur uintptr) { + var pLeaf, v3, p1 uintptr + var v2 Ti8 + _, _, _, _ = pLeaf, v2, v3, p1 + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)-int32(1))*2)) + pLeaf = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + v3 = pCur + 84 + *(*Ti8)(unsafe.Pointer(v3))-- + v2 = *(*Ti8)(unsafe.Pointer(v3)) + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(v2)*8)) + _releasePageNotNull(tls, pLeaf) +} + +// C documentation +// +// /* +// ** Move the cursor to point to the root page of its b-tree structure. +// ** +// ** If the table has a virtual root page, then the cursor is moved to point +// ** to the virtual root page instead of the actual root page. A table has a +// ** virtual root page when the actual root page contains no cells and a +// ** single child page. This can only happen with the table rooted at page 1. +// ** +// ** If the b-tree structure is empty, the cursor state is set to +// ** CURSOR_INVALID and this routine returns SQLITE_EMPTY. Otherwise, +// ** the cursor is set to point to the first cell located on the root +// ** (or virtual root) page and the cursor state is set to CURSOR_VALID. +// ** +// ** If this function returns successfully, it may be assumed that the +// ** page-header flags indicate that the [virtual] root-page is the expected +// ** kind of b-tree page (i.e. if when opening the cursor the caller did not +// ** specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D, +// ** indicating a table b-tree, or if the caller did specify a KeyInfo +// ** structure the flags byte is set to 0x02 or 0x0A, indicating an index +// ** b-tree). +// */ +func _moveToRoot(tls *libc.TLS, pCur uintptr) (r int32) { + var pRoot, v2, v3, p4 uintptr + var rc int32 + var subpage TPgno + var v1 Ti8 + _, _, _, _, _, _, _ = pRoot, rc, subpage, v1, v2, v3, p4 + rc = SQLITE_OK + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= 0 { + if (*TBtCursor)(unsafe.Pointer(pCur)).FiPage != 0 { + _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) + for { + v2 = pCur + 84 + *(*Ti8)(unsafe.Pointer(v2))-- + v1 = *(*Ti8)(unsafe.Pointer(v2)) + if !(v1 != 0) { + break + } + _releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8))) + } + v3 = *(*uintptr)(unsafe.Pointer(pCur + 144)) + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = v3 + pRoot = v3 + goto skip_init + } + } else { + if (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot == uint32(0) { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + return int32(SQLITE_EMPTY) + } else { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_FAULT) { + return (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext + } + _sqlite3BtreeClearCursor(tls, pCur) + } + rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) + if rc != SQLITE_OK { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + return rc + } + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage = 0 + (*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey = (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey + } + } + pRoot = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor + ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is + ** NULL, the caller expects a table b-tree. If this is not the case, + ** return an SQLITE_CORRUPT error. + ** + ** Earlier versions of SQLite assumed that this test could not fail + ** if the root page was already loaded when this function was called (i.e. + ** if pCur->iPage>=0). But this is not so if the database is corrupted + ** in such a way that page pRoot is linked into a second b-tree table + ** (or the freelist). */ + if int32((*TMemPage)(unsafe.Pointer(pRoot)).FisInit) == 0 || libc.BoolInt32((*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) != int32((*TMemPage)(unsafe.Pointer(pRoot)).FintKey) { + return _sqlite3CorruptError(tls, int32(75683)) + } +skip_init: + ; + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + p4 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_AtLast) | libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + if int32((*TMemPage)(unsafe.Pointer(pRoot)).FnCell) > 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) + } else { + if !((*TMemPage)(unsafe.Pointer(pRoot)).Fleaf != 0) { + if (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno != uint32(1) { + return _sqlite3CorruptError(tls, int32(75695)) + } + subpage = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8))) + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) + rc = _moveToChild(tls, pCur, subpage) + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + rc = int32(SQLITE_EMPTY) + } + } + return rc +} + +// C documentation +// +// /* +// ** Move the cursor down to the left-most leaf entry beneath the +// ** entry to which it is currently pointing. +// ** +// ** The left-most leaf is the one with the smallest key - the first +// ** in ascending order. +// */ +func _moveToLeftmost(tls *libc.TLS, pCur uintptr) (r int32) { + var pPage, v1 uintptr + var pgno TPgno + var rc int32 + var v2 bool + _, _, _, _, _ = pPage, pgno, rc, v1, v2 + rc = SQLITE_OK + for { + if v2 = rc == SQLITE_OK; v2 { + v1 = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + pPage = v1 + } + if !(v2 && !((*TMemPage)(unsafe.Pointer(v1)).Fleaf != 0)) { + break + } + pgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix)))))))) + rc = _moveToChild(tls, pCur, pgno) + } + return rc +} + +// C documentation +// +// /* +// ** Move the cursor down to the right-most leaf entry beneath the +// ** page to which it is currently pointing. Notice the difference +// ** between moveToLeftmost() and moveToRightmost(). moveToLeftmost() +// ** finds the left-most entry beneath the *entry* whereas moveToRightmost() +// ** finds the right-most entry beneath the *page*. +// ** +// ** The right-most entry is the one with the largest key - the last +// ** key in ascending order. +// */ +func _moveToRightmost(tls *libc.TLS, pCur uintptr) (r int32) { + var pPage, v1 uintptr + var pgno TPgno + var rc int32 + _, _, _, _ = pPage, pgno, rc, v1 + rc = SQLITE_OK + pPage = uintptr(0) + for { + v1 = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + pPage = v1 + if !!((*TMemPage)(unsafe.Pointer(v1)).Fleaf != 0) { + break + } + pgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = (*TMemPage)(unsafe.Pointer(pPage)).FnCell + rc = _moveToChild(tls, pCur, pgno) + if rc != 0 { + return rc + } + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1)) + return SQLITE_OK +} + +// C documentation +// +// /* Move the cursor to the first entry in the table. Return SQLITE_OK +// ** on success. Set *pRes to 0 if the cursor actually points to something +// ** or set *pRes to 1 if the table is empty. +// */ +func _sqlite3BtreeFirst(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { + var rc int32 + _ = rc + rc = _moveToRoot(tls, pCur) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = _moveToLeftmost(tls, pCur) + } else { + if rc == int32(SQLITE_EMPTY) { + *(*int32)(unsafe.Pointer(pRes)) = int32(1) + rc = SQLITE_OK + } + } + return rc +} + +// C documentation +// +// /* Move the cursor to the last entry in the table. Return SQLITE_OK +// ** on success. Set *pRes to 0 if the cursor actually points to something +// ** or set *pRes to 1 if the table is empty. +// */ +func _btreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { + var rc int32 + var p1, p2 uintptr + _, _, _ = rc, p1, p2 + rc = _moveToRoot(tls, pCur) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = _moveToRightmost(tls, pCur) + if rc == SQLITE_OK { + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_AtLast)) + } else { + p2 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(BTCF_AtLast)) + } + } else { + if rc == int32(SQLITE_EMPTY) { + *(*int32)(unsafe.Pointer(pRes)) = int32(1) + rc = SQLITE_OK + } + } + return rc +} + +func _sqlite3BtreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) (r int32) { + /* If the cursor already points to the last entry, this is a no-op. */ + if CURSOR_VALID == int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) && int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_AtLast) != 0 { + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK + } + return _btreeLast(tls, pCur, pRes) +} + +// C documentation +// +// /* Move the cursor so that it points to an entry in a table (a.k.a INTKEY) +// ** table near the key intKey. Return a success code. +// ** +// ** If an exact match is not found, then the cursor is always +// ** left pointing at a leaf page which would hold the entry if it +// ** were present. The cursor might point to an entry that comes +// ** before or after the key. +// ** +// ** An integer is written into *pRes which is the result of +// ** comparing the key with the entry to which the cursor is +// ** pointing. The meaning of the integer written into +// ** *pRes is as follows: +// ** +// ** *pRes<0 The cursor is left pointing at an entry that +// ** is smaller than intKey or if the table is empty +// ** and the cursor is therefore left point to nothing. +// ** +// ** *pRes==0 The cursor is left pointing at an entry that +// ** exactly matches intKey. +// ** +// ** *pRes>0 The cursor is left pointing at an entry that +// ** is larger than intKey. +// */ +func _sqlite3BtreeTableMoveto(tls *libc.TLS, pCur uintptr, intKey Ti64, biasRight int32, pRes uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, idx, lwr, rc, upr int32 + var chldPg TPgno + var pCell, pPage, v3, p4 uintptr + var _ /* nCellKey at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _, _ = c, chldPg, idx, lwr, pCell, pPage, rc, upr, v3, p4 + /* If the cursor is already positioned at the point we are trying + ** to move to, then just return without doing any work */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID && int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_ValidNKey) != 0 { + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == intKey { + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK + } + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey < intKey { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_AtLast) != 0 { + *(*int32)(unsafe.Pointer(pRes)) = -int32(1) + return SQLITE_OK + } + /* If the requested key is one more than the previous key, then + ** try to get there using sqlite3BtreeNext() rather than a full + ** binary search. This is an optimization only. The correct answer + ** is still obtained without this case, only a little more slowly. */ + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey+int64(1) == intKey { + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = _sqlite3BtreeNext(tls, pCur, 0) + if rc == SQLITE_OK { + _getCellInfo(tls, pCur) + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == intKey { + return SQLITE_OK + } + } else { + if rc != int32(SQLITE_DONE) { + return rc + } + } + } + } + } + rc = _moveToRoot(tls, pCur) + if rc != 0 { + if rc == int32(SQLITE_EMPTY) { + *(*int32)(unsafe.Pointer(pRes)) = -int32(1) + return SQLITE_OK + } + return rc + } + for { + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ + /* pPage->nCell must be greater than zero. If this is the root-page + ** the cursor would have been INVALID above and this for(;;) loop + ** not run. If this is not the root-page, then the moveToChild() routine + ** would have already detected db corruption. Similarly, pPage must + ** be the right kind (index or table) of b-tree page. Otherwise + ** a moveToChild() or moveToRoot() call would have detected corruption. */ + lwr = 0 + upr = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1) + idx = upr >> (int32(1) - biasRight) /* idx = biasRight ? upr : (lwr+upr)/2; */ + for { + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))) + if (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf != 0 { + for { + v3 = pCell + pCell++ + if !(int32(0x80) <= int32(*(*Tu8)(unsafe.Pointer(v3)))) { + break + } + if pCell >= (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { + return _sqlite3CorruptError(tls, int32(75937)) + } + } + } + _sqlite3GetVarint(tls, pCell, bp) + if *(*Ti64)(unsafe.Pointer(bp)) < intKey { + lwr = idx + int32(1) + if lwr > upr { + c = -int32(1) + break + } + } else { + if *(*Ti64)(unsafe.Pointer(bp)) > intKey { + upr = idx - int32(1) + if lwr > upr { + c = +libc.Int32FromInt32(1) + break + } + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + lwr = idx + goto moveto_table_next_layer + } else { + p4 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | libc.Int32FromInt32(BTCF_ValidNKey)) + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey = *(*Ti64)(unsafe.Pointer(bp)) + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK + } + } + } + idx = (lwr + upr) >> int32(1) /* idx = (lwr+upr)/2; */ + goto _2 + _2: + } + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) + *(*int32)(unsafe.Pointer(pRes)) = c + rc = SQLITE_OK + goto moveto_table_finish + } + moveto_table_next_layer: + ; + if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) + } else { + chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*lwr))))))) + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(lwr) + rc = _moveToChild(tls, pCur, chldPg) + if rc != 0 { + break + } + goto _1 + _1: + } +moveto_table_finish: + ; + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + return rc +} + +// C documentation +// +// /* +// ** Compare the "idx"-th cell on the page the cursor pCur is currently +// ** pointing to to pIdxKey using xRecordCompare. Return negative or +// ** zero if the cell is less than or equal pIdxKey. Return positive +// ** if unknown. +// ** +// ** Return value negative: Cell at pCur[idx] less than pIdxKey +// ** +// ** Return value is zero: Cell at pCur[idx] equals pIdxKey +// ** +// ** Return value positive: Nothing is known about the relationship +// ** of the cell at pCur[idx] and pIdxKey. +// ** +// ** This routine is part of an optimization. It is always safe to return +// ** a positive value as that will cause the optimization to be skipped. +// */ +func _indexCellCompare(tls *libc.TLS, pCur uintptr, idx int32, pIdxKey uintptr, xRecordCompare TRecordCompare) (r int32) { + var c, nCell, v1 int32 + var pCell, pPage uintptr + var v2 bool + _, _, _, _, _, _ = c, nCell, pCell, pPage, v1, v2 + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Size of the pCell cell in bytes */ + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))) + nCell = int32(*(*Tu8)(unsafe.Pointer(pCell))) + if nCell <= int32((*TMemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload) { + /* This branch runs if the record-size field of the cell is a + ** single byte varint and the record fits entirely on the main + ** b-tree page. */ + c = (*(*func(*libc.TLS, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xRecordCompare})))(tls, nCell, pCell+1, pIdxKey) + } else { + if v2 = !(int32(*(*Tu8)(unsafe.Pointer(pCell + 1)))&libc.Int32FromInt32(0x80) != 0); v2 { + v1 = nCell&libc.Int32FromInt32(0x7f)<0 The cursor is left pointing at an entry that +// ** is larger than pIdxKey. +// ** +// ** The pIdxKey->eqSeen field is set to 1 if there +// ** exists an entry in the table that exactly matches pIdxKey. +// */ +func _sqlite3BtreeIndexMoveto(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, pRes uintptr) (r int32) { + var c, c1, idx, lwr, nCell, nOverrun, rc, upr, v1, v6 int32 + var chldPg TPgno + var pCell, pCellBody, pCellKey, pPage, v11, p3, p8, p9 uintptr + var xRecordCompare TRecordCompare + var v10 Ti8 + var v2, v7 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, c1, chldPg, idx, lwr, nCell, nOverrun, pCell, pCellBody, pCellKey, pPage, rc, upr, xRecordCompare, v1, v10, v11, v2, v6, v7, p3, p8, p9 + xRecordCompare = _sqlite3VdbeFindCompare(tls, pIdxKey) + (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode = uint8(0) + /* Check to see if we can skip a lot of work. Two cases: + ** + ** (1) If the cursor is already pointing to the very last cell + ** in the table and the pIdxKey search key is greater than or + ** equal to that last cell, then no movement is required. + ** + ** (2) If the cursor is on the last page of the table and the first + ** cell on that last page is less than or equal to the pIdxKey + ** search key, then we can start the search on the current page + ** without needing to go back to root. + */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID && (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fleaf != 0 && _cursorOnLastPage(tls, pCur) != 0 { + if v2 = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) == int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell)-int32(1); v2 { + v1 = _indexCellCompare(tls, pCur, int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix), pIdxKey, xRecordCompare) + c = v1 + } + if v2 && v1 <= 0 && int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode) == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRes)) = c + return SQLITE_OK /* Cursor already pointing at the correct spot */ + } + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) > 0 && _indexCellCompare(tls, pCur, 0, pIdxKey, xRecordCompare) <= 0 && int32((*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode) == SQLITE_OK { + p3 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) + if !((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FisInit != 0) { + return _sqlite3CorruptError(tls, int32(76133)) + } + goto bypass_moveto_root /* Start search on the current page */ + } + (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode = uint8(SQLITE_OK) + } + rc = _moveToRoot(tls, pCur) + if rc != 0 { + if rc == int32(SQLITE_EMPTY) { + *(*int32)(unsafe.Pointer(pRes)) = -int32(1) + return SQLITE_OK + } + return rc + } +bypass_moveto_root: + ; + for { + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Pointer to current cell in pPage */ + /* pPage->nCell must be greater than zero. If this is the root-page + ** the cursor would have been INVALID above and this for(;;) loop + ** not run. If this is not the root-page, then the moveToChild() routine + ** would have already detected db corruption. Similarly, pPage must + ** be the right kind (index or table) of b-tree page. Otherwise + ** a moveToChild() or moveToRoot() call would have detected corruption. */ + lwr = 0 + upr = int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1) + idx = upr >> int32(1) /* idx = (lwr+upr)/2; */ + for { /* Size of the pCell cell in bytes */ + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaDataOfst + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))) + /* The maximum supported page-size is 65536 bytes. This means that + ** the maximum number of record bytes stored on an index B-Tree + ** page is less than 16384 bytes and may be stored as a 2-byte + ** varint. This information is used to attempt to avoid parsing + ** the entire cell by checking for the cases where the record is + ** stored entirely within the b-tree page by inspecting the first + ** 2 bytes of the cell. + */ + nCell = int32(*(*Tu8)(unsafe.Pointer(pCell))) + if nCell <= int32((*TMemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload) { + /* This branch runs if the record-size field of the cell is a + ** single byte varint and the record fits entirely on the main + ** b-tree page. */ + c1 = (*(*func(*libc.TLS, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xRecordCompare})))(tls, nCell, pCell+1, pIdxKey) + } else { + if v7 = !(int32(*(*Tu8)(unsafe.Pointer(pCell + 1)))&libc.Int32FromInt32(0x80) != 0); v7 { + v6 = nCell&libc.Int32FromInt32(0x7f)< (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage { + rc = _sqlite3CorruptError(tls, int32(76220)) + goto moveto_index_finish + } + pCellKey = _sqlite3Malloc(tls, uint64(nCell+nOverrun)) + if pCellKey == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto moveto_index_finish + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) + rc = _accessPayload(tls, pCur, uint32(0), uint32(nCell), pCellKey, 0) + libc.Xmemset(tls, pCellKey+uintptr(nCell), 0, uint64(nOverrun)) /* Fix uninit warnings */ + p8 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p8)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p8))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) + if rc != 0 { + Xsqlite3_free(tls, pCellKey) + goto moveto_index_finish + } + c1 = _sqlite3VdbeRecordCompare(tls, nCell, pCellKey, pIdxKey) + Xsqlite3_free(tls, pCellKey) + } + } + if c1 < 0 { + lwr = idx + int32(1) + } else { + if c1 > 0 { + upr = idx - int32(1) + } else { + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = SQLITE_OK + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) + if (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0 { + rc = _sqlite3CorruptError(tls, int32(76252)) + } + goto moveto_index_finish + } + } + if lwr > upr { + break + } + idx = (lwr + upr) >> int32(1) /* idx = (lwr+upr)/2 */ + goto _5 + _5: + } + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(idx) + *(*int32)(unsafe.Pointer(pRes)) = c1 + rc = SQLITE_OK + goto moveto_index_finish + } + if lwr >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8))) + } else { + chldPg = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*lwr))))))) + } + /* This block is similar to an in-lined version of: + ** + ** pCur->ix = (u16)lwr; + ** rc = moveToChild(pCur, chldPg); + ** if( rc ) break; + */ + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + p9 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) >= libc.Int32FromInt32(BTCURSOR_MAX_DEPTH)-libc.Int32FromInt32(1) { + return _sqlite3CorruptError(tls, int32(76283)) + } + *(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = uint16(lwr) + *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage++ + rc = _getAndInitPage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBt, chldPg, pCur+136, int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) + if rc == SQLITE_OK && (int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) < int32(1) || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey) != int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurIntKey)) { + _releasePage(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) + rc = _sqlite3CorruptError(tls, int32(76294)) + } + if rc != 0 { + v11 = pCur + 84 + *(*Ti8)(unsafe.Pointer(v11))-- + v10 = *(*Ti8)(unsafe.Pointer(v11)) + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(v10)*8)) + break + } + /* + ***** End of in-lined moveToChild() call */ + goto _4 + _4: + } +moveto_index_finish: + ; + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + return rc +} + +// C documentation +// +// /* +// ** Return TRUE if the cursor is not pointing at an entry of the table. +// ** +// ** TRUE will be returned after a call to sqlite3BtreeNext() moves +// ** past the last entry in the table or sqlite3BtreePrev() moves past +// ** the first entry. TRUE is also returned if the table is empty. +// */ +func _sqlite3BtreeEof(tls *libc.TLS, pCur uintptr) (r int32) { + /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries + ** have been deleted? This API will need to change to return an error code + ** as well as the boolean result value. + */ + return libc.BoolInt32(CURSOR_VALID != int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState)) +} + +// C documentation +// +// /* +// ** Return an estimate for the number of rows in the table that pCur is +// ** pointing to. Return a negative number if no estimate is currently +// ** available. +// */ +func _sqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) (r Ti64) { + var i Tu8 + var n Ti64 + _, _ = i, n + /* Currently this interface is only called by the OP_IfSmaller + ** opcode, and it that case the cursor will always be valid and + ** will always point to a leaf node. */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + return int64(-int32(1)) + } + if int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fleaf) == 0 { + return int64(-int32(1)) + } + n = int64((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) + i = uint8(0) + for { + if !(int32(i) < int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)) { + break + } + n *= int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(i)*8)))).FnCell) + goto _1 + _1: + ; + i++ + } + return n +} + +// C documentation +// +// /* +// ** Advance the cursor to the next entry in the database. +// ** Return value: +// ** +// ** SQLITE_OK success +// ** SQLITE_DONE cursor is already pointing at the last element +// ** otherwise some kind of error occurred +// ** +// ** The main entry point is sqlite3BtreeNext(). That routine is optimized +// ** for the common case of merely incrementing the cell counter BtCursor.aiIdx +// ** to the next cell on the current page. The (slower) btreeNext() helper +// ** routine is called when it is necessary to move to a different page or +// ** to restore the cursor. +// ** +// ** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the +// ** cursor corresponds to an SQL index and this routine could have been +// ** skipped if the SQL index had been a unique index. The F argument +// ** is a hint to the implement. SQLite btree implementation does not use +// ** this hint, but COMDB2 does. +// */ +func _btreeNext(tls *libc.TLS, pCur uintptr) (r int32) { + var idx, rc, v1 int32 + var pPage, v3 uintptr + var v2 Tu16 + _, _, _, _, _, _ = idx, pPage, rc, v1, v2, v3 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + v1 = _btreeRestoreCursorPosition(tls, pCur) + } else { + v1 = SQLITE_OK + } + rc = v1 + if rc != SQLITE_OK { + return rc + } + if int32(CURSOR_INVALID) == int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) { + return int32(SQLITE_DONE) + } + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) == int32(CURSOR_SKIPNEXT) { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) + if (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext > 0 { + return SQLITE_OK + } + } + } + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + v3 = pCur + 86 + *(*Tu16)(unsafe.Pointer(v3))++ + v2 = *(*Tu16)(unsafe.Pointer(v3)) + idx = int32(v2) + if _sqlite3FaultSim(tls, int32(412)) != 0 { + (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) + } + if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { + return _sqlite3CorruptError(tls, int32(76395)) + } + if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + rc = _moveToChild(tls, pCur, _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)))) + if rc != 0 { + return rc + } + return _moveToLeftmost(tls, pCur) + } + for cond := true; cond; cond = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + return int32(SQLITE_DONE) + } + _moveToParent(tls, pCur) + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + } + if (*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0 { + return _sqlite3BtreeNext(tls, pCur, 0) + } else { + return SQLITE_OK + } + } + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + return SQLITE_OK + } else { + return _moveToLeftmost(tls, pCur) + } + return r +} + +func _sqlite3BtreeNext(tls *libc.TLS, pCur uintptr, flags int32) (r int32) { + var pPage, v3, p1 uintptr + var v2 Tu16 + _, _, _, _ = pPage, v2, v3, p1 + _ = flags /* Used in COMDB2 but not native SQLite */ + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + return _btreeNext(tls, pCur) + } + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + v3 = pCur + 86 + *(*Tu16)(unsafe.Pointer(v3))++ + v2 = *(*Tu16)(unsafe.Pointer(v3)) + if int32(v2) >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + (*TBtCursor)(unsafe.Pointer(pCur)).Fix-- + return _btreeNext(tls, pCur) + } + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + return SQLITE_OK + } else { + return _moveToLeftmost(tls, pCur) + } + return r +} + +// C documentation +// +// /* +// ** Step the cursor to the back to the previous entry in the database. +// ** Return values: +// ** +// ** SQLITE_OK success +// ** SQLITE_DONE the cursor is already on the first element of the table +// ** otherwise some kind of error occurred +// ** +// ** The main entry point is sqlite3BtreePrevious(). That routine is optimized +// ** for the common case of merely decrementing the cell counter BtCursor.aiIdx +// ** to the previous cell on the current page. The (slower) btreePrevious() +// ** helper routine is called when it is necessary to move to a different page +// ** or to restore the cursor. +// ** +// ** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then +// ** the cursor corresponds to an SQL index and this routine could have been +// ** skipped if the SQL index had been a unique index. The F argument is a +// ** hint to the implement. The native SQLite btree implementation does not +// ** use this hint, but COMDB2 does. +// */ +func _btreePrevious(tls *libc.TLS, pCur uintptr) (r int32) { + var idx, rc, v1 int32 + var pPage uintptr + _, _, _, _ = idx, pPage, rc, v1 + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + v1 = _btreeRestoreCursorPosition(tls, pCur) + } else { + v1 = SQLITE_OK + } + rc = v1 + if rc != SQLITE_OK { + return rc + } + if int32(CURSOR_INVALID) == int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) { + return int32(SQLITE_DONE) + } + if int32(CURSOR_SKIPNEXT) == int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_VALID) + if (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext < 0 { + return SQLITE_OK + } + } + } + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if _sqlite3FaultSim(tls, int32(412)) != 0 { + (*TMemPage)(unsafe.Pointer(pPage)).FisInit = uint8(0) + } + if !((*TMemPage)(unsafe.Pointer(pPage)).FisInit != 0) { + return _sqlite3CorruptError(tls, int32(76488)) + } + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) + rc = _moveToChild(tls, pCur, _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))))) + if rc != 0 { + return rc + } + rc = _moveToRightmost(tls, pCur) + } else { + for int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) == 0 { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + return int32(SQLITE_DONE) + } + _moveToParent(tls, pCur) + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix-- + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if (*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0 && !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + rc = _sqlite3BtreePrevious(tls, pCur, 0) + } else { + rc = SQLITE_OK + } + } + return rc +} + +func _sqlite3BtreePrevious(tls *libc.TLS, pCur uintptr, flags int32) (r int32) { + var p1 uintptr + _ = p1 + _ = flags /* Used in COMDB2 but not native SQLite */ + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(BTCF_AtLast) | libc.Int32FromInt32(BTCF_ValidOvfl) | libc.Int32FromInt32(BTCF_ValidNKey))) + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID || int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) == 0 || int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fleaf) == 0 { + return _btreePrevious(tls, pCur) + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix-- + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Allocate a new page from the database file. +// ** +// ** The new page is marked as dirty. (In other words, sqlite3PagerWrite() +// ** has already been called on the new page.) The new page has also +// ** been referenced and the calling routine is responsible for calling +// ** sqlite3PagerUnref() on the new page when it is done. +// ** +// ** SQLITE_OK is returned on success. Any other return value indicates +// ** an error. *ppPage is set to NULL in the event of an error. +// ** +// ** If the "nearby" parameter is not 0, then an effort is made to +// ** locate a page close to the page number "nearby". This can be used in an +// ** attempt to keep related pages close to each other in the database file, +// ** which in turn can make database access faster. +// ** +// ** If the eMode parameter is BTALLOC_EXACT and the nearby page exists +// ** anywhere on the free-list, then it is guaranteed to be returned. If +// ** eMode is BTALLOC_LT then the page returned will be less than or equal +// ** to nearby if any such page exists. If eMode is BTALLOC_ANY then there +// ** are no restrictions on which page is returned. +// */ +func _allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintptr, nearby TPgno, eMode Tu8) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aData, pPage1, pPrevTrunk uintptr + var bNoContent, d2, dist, noContent, rc, v5, v6 int32 + var closest, i, k, n, nSearch, v1 Tu32 + var iNewTrunk, iPage, iTrunk, mxPage TPgno + var searchList Tu8 + var v2 bool + var _ /* eType at bp+8 */ Tu8 + var _ /* pNewTrunk at bp+16 */ uintptr + var _ /* pPg at bp+24 */ uintptr + var _ /* pTrunk at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, bNoContent, closest, d2, dist, i, iNewTrunk, iPage, iTrunk, k, mxPage, n, nSearch, noContent, pPage1, pPrevTrunk, rc, searchList, v1, v2, v5, v6 /* Number of leaves on the trunk of the freelist */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pPrevTrunk = uintptr(0) /* Total size of the database file */ + pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 + mxPage = _btreePagecount(tls, pBt) + /* EVIDENCE-OF: R-21003-45125 The 4-byte big-endian integer at offset 36 + ** stores the total number of pages on the freelist. */ + n = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) + if n >= mxPage { + return _sqlite3CorruptError(tls, int32(76578)) + } + if n > uint32(0) { + searchList = uint8(0) /* If the free-list must be searched for 'nearby' */ + nSearch = uint32(0) /* Count of the number of search attempts */ + /* If eMode==BTALLOC_EXACT and a query of the pointer-map + ** shows that the page 'nearby' is somewhere on the free-list, then + ** the entire-list will be searched for that page. + */ + if int32(eMode) == int32(BTALLOC_EXACT) { + if nearby <= mxPage { + rc = _ptrmapGet(tls, pBt, nearby, bp+8, uintptr(0)) + if rc != 0 { + return rc + } + if int32(*(*Tu8)(unsafe.Pointer(bp + 8))) == int32(PTRMAP_FREEPAGE) { + searchList = uint8(1) + } + } + } else { + if int32(eMode) == int32(BTALLOC_LE) { + searchList = uint8(1) + } + } + /* Decrement the free-list count by 1. Set iTrunk to the index of the + ** first free-list trunk page. iPrevTrunk is initially 1. + */ + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if rc != 0 { + return rc + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36, n-uint32(1)) + /* The code within this loop is run only once if the 'searchList' variable + ** is not true. Otherwise, it runs once for each trunk-page on the + ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT) + ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT) + */ + for cond := true; cond; cond = searchList != 0 { + pPrevTrunk = *(*uintptr)(unsafe.Pointer(bp)) + if pPrevTrunk != 0 { + /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page + ** is the page number of the next freelist trunk page in the list or + ** zero if this is the last freelist trunk page. */ + iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FaData) + } else { + /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32 + ** stores the page number of the first page of the freelist, or zero if + ** the freelist is empty. */ + iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) + } + if v2 = iTrunk > mxPage; !v2 { + v1 = nSearch + nSearch++ + } + if v2 || v1 > n { + rc = _sqlite3CorruptError(tls, int32(76634)) + } else { + rc = _btreeGetUnusedPage(tls, pBt, iTrunk, bp, 0) + } + if rc != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + goto end_allocate_page + } + /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page + ** is the number of leaf page pointers to follow. */ + k = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) + if k == uint32(0) && !(searchList != 0) { + /* The trunk has no leaves and the list is not being searched. + ** So extract the trunk page itself and use it as the newly + ** allocated page */ + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if rc != 0 { + goto end_allocate_page + } + *(*TPgno)(unsafe.Pointer(pPgno)) = iTrunk + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uint64(4)) + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + if k > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/libc.Uint32FromInt32(4)-libc.Uint32FromInt32(2) { + /* Value of k is out of range. Database corruption */ + rc = _sqlite3CorruptError(tls, int32(76663)) + goto end_allocate_page + } else { + if searchList != 0 && (nearby == iTrunk || iTrunk < nearby && int32(eMode) == int32(BTALLOC_LE)) { + /* The list is being searched and this trunk page is the page + ** to allocate, regardless of whether it has leaves. + */ + *(*TPgno)(unsafe.Pointer(pPgno)) = iTrunk + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp)) + searchList = uint8(0) + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if rc != 0 { + goto end_allocate_page + } + if k == uint32(0) { + if !(pPrevTrunk != 0) { + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uint64(4)) + } else { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FpDbPage) + if rc != SQLITE_OK { + goto end_allocate_page + } + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FaData, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uint64(4)) + } + } else { + iNewTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+8) + if iNewTrunk > mxPage { + rc = _sqlite3CorruptError(tls, int32(76697)) + goto end_allocate_page + } + rc = _btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16, 0) + if rc != SQLITE_OK { + goto end_allocate_page + } + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FpDbPage) + if rc != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + goto end_allocate_page + } + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FaData, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData, uint64(4)) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FaData+4, k-uint32(1)) + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FaData+8, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+12, uint64((k-uint32(1))*uint32(4))) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + if !(pPrevTrunk != 0) { + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iNewTrunk) + } else { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FpDbPage) + if rc != 0 { + goto end_allocate_page + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPrevTrunk)).FaData, iNewTrunk) + } + } + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + if k > uint32(0) { + aData = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData + if nearby > uint32(0) { + closest = uint32(0) + if int32(eMode) == int32(BTALLOC_LE) { + i = uint32(0) + for { + if !(i < k) { + break + } + iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+i*uint32(4))) + if iPage <= nearby { + closest = i + break + } + goto _3 + _3: + ; + i++ + } + } else { + dist = _sqlite3AbsInt32(tls, int32(_sqlite3Get4byte(tls, aData+8)-nearby)) + i = uint32(1) + for { + if !(i < k) { + break + } + d2 = _sqlite3AbsInt32(tls, int32(_sqlite3Get4byte(tls, aData+uintptr(uint32(8)+i*uint32(4)))-nearby)) + if d2 < dist { + closest = i + dist = d2 + } + goto _4 + _4: + ; + i++ + } + } + } else { + closest = uint32(0) + } + iPage = _sqlite3Get4byte(tls, aData+uintptr(uint32(8)+closest*uint32(4))) + if iPage > mxPage || iPage < uint32(2) { + rc = _sqlite3CorruptError(tls, int32(76762)) + goto end_allocate_page + } + if !(searchList != 0) || (iPage == nearby || iPage < nearby && int32(eMode) == int32(BTALLOC_LE)) { + *(*TPgno)(unsafe.Pointer(pPgno)) = iPage + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if rc != 0 { + goto end_allocate_page + } + if closest < k-uint32(1) { + libc.Xmemcpy(tls, aData+uintptr(uint32(8)+closest*uint32(4)), aData+uintptr(uint32(4)+k*uint32(4)), uint64(4)) + } + _sqlite3Put4byte(tls, aData+4, k-uint32(1)) + if !(_btreeGetHasContent(tls, pBt, *(*TPgno)(unsafe.Pointer(pPgno))) != 0) { + v5 = int32(PAGER_GET_NOCONTENT) + } else { + v5 = 0 + } + noContent = v5 + rc = _btreeGetUnusedPage(tls, pBt, *(*TPgno)(unsafe.Pointer(pPgno)), ppPage, noContent) + if rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) + if rc != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + } + } + searchList = uint8(0) + } + } + } + } + } + _releasePage(tls, pPrevTrunk) + pPrevTrunk = uintptr(0) + } + } else { + if 0 == int32((*TBtShared)(unsafe.Pointer(pBt)).FbDoTruncate) { + v6 = int32(PAGER_GET_NOCONTENT) + } else { + v6 = 0 + } + /* There are no pages on the freelist, so append a new page to the + ** database image. + ** + ** Normally, new pages allocated by this block can be requested from the + ** pager layer with the 'no-content' flag set. This prevents the pager + ** from trying to read the pages content from disk. However, if the + ** current transaction has already run one or more incremental-vacuum + ** steps, then the page we are about to allocate may contain content + ** that is required in the event of a rollback. In this case, do + ** not set the no-content flag. This causes the pager to load and journal + ** the current page content before overwriting it. + ** + ** Note that the pager will not actually attempt to load or journal + ** content for any page that really does lie past the end of the database + ** file on disk. So the effects of disabling the no-content optimization + ** here are confined to those pages that lie between the end of the + ** database image and the end of the database file. + */ + bNoContent = v6 + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if rc != 0 { + return rc + } + (*TBtShared)(unsafe.Pointer(pBt)).FnPage++ + if (*TBtShared)(unsafe.Pointer(pBt)).FnPage == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + (*TBtShared)(unsafe.Pointer(pBt)).FnPage++ + } + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 && _ptrmapPageno(tls, pBt, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) == (*TBtShared)(unsafe.Pointer(pBt)).FnPage { + /* If *pPgno refers to a pointer-map page, allocate two new pages + ** at the end of the file instead of one. The first allocated page + ** becomes a new pointer-map page, the second is used by the caller. + */ + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + rc = _btreeGetUnusedPage(tls, pBt, (*TBtShared)(unsafe.Pointer(pBt)).FnPage, bp+24, bNoContent) + if rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).FpDbPage) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + } + if rc != 0 { + return rc + } + (*TBtShared)(unsafe.Pointer(pBt)).FnPage++ + if (*TBtShared)(unsafe.Pointer(pBt)).FnPage == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + (*TBtShared)(unsafe.Pointer(pBt)).FnPage++ + } + } + _sqlite3Put4byte(tls, uintptr(28)+(*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData, (*TBtShared)(unsafe.Pointer(pBt)).FnPage) + *(*TPgno)(unsafe.Pointer(pPgno)) = (*TBtShared)(unsafe.Pointer(pBt)).FnPage + rc = _btreeGetUnusedPage(tls, pBt, *(*TPgno)(unsafe.Pointer(pPgno)), ppPage, bNoContent) + if rc != 0 { + return rc + } + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) + if rc != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + } + } +end_allocate_page: + ; + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + _releasePage(tls, pPrevTrunk) + return rc +} + +// C documentation +// +// /* +// ** This function is used to add page iPage to the database file free-list. +// ** It is assumed that the page is not already a part of the free-list. +// ** +// ** The value passed as the second argument to this function is optional. +// ** If the caller happens to have a pointer to the MemPage object +// ** corresponding to page iPage handy, it may pass it as the second value. +// ** Otherwise, it may pass NULL. +// ** +// ** If a pointer to a MemPage object is passed as the second argument, +// ** its reference count is not altered by this function. +// */ +func _freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage TPgno) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iTrunk TPgno + var nFree, nLeaf Tu32 + var pPage1 uintptr + var v1, v3, v5 int32 + var v2, v4, v6 bool + var _ /* pPage at bp+8 */ uintptr + var _ /* pTrunk at bp+0 */ uintptr + var _ /* rc at bp+16 */ int32 + _, _, _, _, _, _, _, _, _, _ = iTrunk, nFree, nLeaf, pPage1, v1, v2, v3, v4, v5, v6 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Free-list trunk page */ + iTrunk = uint32(0) /* Page number of free-list trunk page */ + pPage1 = (*TBtShared)(unsafe.Pointer(pBt)).FpPage1 /* Initial number of pages on free-list */ + if iPage < uint32(2) || iPage > (*TBtShared)(unsafe.Pointer(pBt)).FnPage { + return _sqlite3CorruptError(tls, int32(76889)) + } + if pMemPage != 0 { + *(*uintptr)(unsafe.Pointer(bp + 8)) = pMemPage + _sqlite3PagerRef(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) + } else { + *(*uintptr)(unsafe.Pointer(bp + 8)) = _btreePageLookup(tls, pBt, iPage) + } + /* Increment the free page count on pPage1 */ + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 16)) != 0 { + goto freepage_out + } + nFree = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+36, nFree+uint32(1)) + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_SECURE_DELETE) != 0 { + /* If the secure_delete option is enabled, then + ** always fully overwrite deleted information with zeros. + */ + if v2 = !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0); v2 { + v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) + *(*int32)(unsafe.Pointer(bp + 16)) = v1 + } + if v4 = v2 && v1 != 0; !v4 { + v3 = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) + *(*int32)(unsafe.Pointer(bp + 16)) = v3 + } + if v4 || v3 != 0 { + goto freepage_out + } + libc.Xmemset(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData, 0, uint64((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpBt)).FpageSize)) + } + /* If the database supports auto-vacuum, write an entry in the pointer-map + ** to indicate that the page is free. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _ptrmapPut(tls, pBt, iPage, uint8(PTRMAP_FREEPAGE), uint32(0), bp+16) + if *(*int32)(unsafe.Pointer(bp + 16)) != 0 { + goto freepage_out + } + } + /* Now manipulate the actual database free-list structure. There are two + ** possibilities. If the free-list is currently empty, or if the first + ** trunk page in the free-list is full, then this page will become a + ** new free-list trunk page. Otherwise, it will become a leaf of the + ** first trunk page in the current free-list. This block tests if it + ** is possible to add the page as a new free-list leaf. + */ + if nFree != uint32(0) { /* Initial number of leaf cells on trunk page */ + iTrunk = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32) + if iTrunk > _btreePagecount(tls, pBt) { + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76936)) + goto freepage_out + } + *(*int32)(unsafe.Pointer(bp + 16)) = _btreeGetPage(tls, pBt, iTrunk, bp, 0) + if *(*int32)(unsafe.Pointer(bp + 16)) != SQLITE_OK { + goto freepage_out + } + nLeaf = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4) + if nLeaf > (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(2) { + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3CorruptError(tls, int32(76947)) + goto freepage_out + } + if nLeaf < (*TBtShared)(unsafe.Pointer(pBt)).FusableSize/uint32(4)-uint32(8) { + /* In this case there is room on the trunk page to insert the page + ** being freed as a new leaf. + ** + ** Note that the trunk page is not really full until it contains + ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have + ** coded. But due to a coding error in versions of SQLite prior to + ** 3.6.0, databases with freelist trunk pages holding more than + ** usableSize/4 - 8 entries will be reported as corrupt. In order + ** to maintain backwards compatibility with older versions of SQLite, + ** we will continue to restrict the number of entries to usableSize/4 - 8 + ** for now. At some point in the future (once everyone has upgraded + ** to 3.6.0 or later) we should consider fixing the conditional above + ** to read "usableSize/4-2" instead of "usableSize/4-8". + ** + ** EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still + ** avoid using the last six entries in the freelist trunk page array in + ** order that database files created by newer versions of SQLite can be + ** read by older versions of SQLite. + */ + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+4, nLeaf+uint32(1)) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+uintptr(uint32(8)+nLeaf*uint32(4)), iPage) + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 && int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_SECURE_DELETE) == 0 { + _sqlite3PagerDontWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) + } + *(*int32)(unsafe.Pointer(bp + 16)) = _btreeSetHasContent(tls, pBt, iPage) + } + goto freepage_out + } + } + /* If control flows to this point, then it was not possible to add the + ** the page being freed as a leaf page of the first trunk in the free-list. + ** Possibly because the free-list is empty, or possibly because the + ** first trunk in the free-list is full. Either way, the page being freed + ** will become the new first trunk page in the free-list. + */ + if v6 = *(*uintptr)(unsafe.Pointer(bp + 8)) == uintptr(0); v6 { + v5 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) + *(*int32)(unsafe.Pointer(bp + 16)) = v5 + } + if v6 && SQLITE_OK != v5 { + goto freepage_out + } + *(*int32)(unsafe.Pointer(bp + 16)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 16)) != SQLITE_OK { + goto freepage_out + } + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData, iTrunk) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData+4, uint32(0)) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pPage1)).FaData+32, iPage) +freepage_out: + ; + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = uint8(0) + } + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 16)) +} + +func _freePage(tls *libc.TLS, pPage uintptr, pRC uintptr) { + if *(*int32)(unsafe.Pointer(pRC)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRC)) = _freePage2(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpBt, pPage, (*TMemPage)(unsafe.Pointer(pPage)).Fpgno) + } +} + +// C documentation +// +// /* +// ** Free the overflow pages associated with the given Cell. +// */ +func _clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nOvfl, rc, v1 int32 + var ovflPageSize Tu32 + var ovflPgno TPgno + var pBt, v2 uintptr + var v3 bool + var _ /* iNext at bp+0 */ TPgno + var _ /* pOvfl at bp+8 */ uintptr + _, _, _, _, _, _, _, _ = nOvfl, ovflPageSize, ovflPgno, pBt, rc, v1, v2, v3 + if pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { + /* Cell extends past end of page */ + return _sqlite3CorruptError(tls, int32(77036)) + } + ovflPgno = _sqlite3Get4byte(tls, pCell+uintptr((*TCellInfo)(unsafe.Pointer(pInfo)).FnSize)-uintptr(4)) + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + ovflPageSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) + nOvfl = int32(((*TCellInfo)(unsafe.Pointer(pInfo)).FnPayload - uint32((*TCellInfo)(unsafe.Pointer(pInfo)).FnLocal) + ovflPageSize - uint32(1)) / ovflPageSize) + for { + v1 = nOvfl + nOvfl-- + if !(v1 != 0) { + break + } + *(*TPgno)(unsafe.Pointer(bp)) = uint32(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + if ovflPgno < uint32(2) || ovflPgno > _btreePagecount(tls, pBt) { + /* 0 is not a legal page number and page 1 cannot be an + ** overflow page. Therefore if ovflPgno<2 or past the end of the + ** file the database must be corrupt. */ + return _sqlite3CorruptError(tls, int32(77053)) + } + if nOvfl != 0 { + rc = _getOverflowPage(tls, pBt, ovflPgno, bp+8, bp) + if rc != 0 { + return rc + } + } + if v3 = *(*uintptr)(unsafe.Pointer(bp + 8)) != 0; !v3 { + v2 = _btreePageLookup(tls, pBt, ovflPgno) + *(*uintptr)(unsafe.Pointer(bp + 8)) = v2 + } + if (v3 || v2 != uintptr(0)) && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) != int32(1) { + /* There is no reason any cursor should have an outstanding reference + ** to an overflow page belonging to a cell that is being deleted/updated. + ** So if there exists more than one reference to this page, then it + ** must not really be an overflow page and the database must be corrupt. + ** It is helpful to detect this before calling freePage2(), as + ** freePage2() may zero the page contents if secure-delete mode is + ** enabled. If this 'overflow' page happens to be a page that the + ** caller is iterating through or using in some other way, this + ** can be problematic. + */ + rc = _sqlite3CorruptError(tls, int32(77073)) + } else { + rc = _freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 8)), ovflPgno) + } + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + _sqlite3PagerUnref(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpDbPage) + } + if rc != 0 { + return rc + } + ovflPgno = *(*TPgno)(unsafe.Pointer(bp)) + } + return SQLITE_OK +} + +/* Call xParseCell to compute the size of a cell. If the cell contains +** overflow, then invoke cellClearOverflow to clear out that overflow. +** Store the result code (SQLITE_OK or some error code) in rc. +** +** Implemented as macro to force inlining for performance. + */ + +// C documentation +// +// /* +// ** Create the byte sequence used to represent a cell on page pPage +// ** and write that byte sequence into pCell[]. Overflow pages are +// ** allocated and filled in as necessary. The calling procedure +// ** is responsible for making sure sufficient space has been allocated +// ** for pCell[]. +// ** +// ** Note that pCell does not necessary need to point to the pPage->aData +// ** area. pCell might point to some temporary storage. The cell will +// ** be constructed in this temporary area then copied into pPage->aData +// ** later. +// */ +func _fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType Tu8 + var mn, n, nHeader, nPayload, nSrc, spaceLeft, v1, v2, v3, v4 int32 + var pBt, pPayload, pPrior, pSrc, pToRelease uintptr + var pgnoPtrmap TPgno + var _ /* pOvfl at bp+8 */ uintptr + var _ /* pgnoOvfl at bp+4 */ TPgno + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eType, mn, n, nHeader, nPayload, nSrc, pBt, pPayload, pPrior, pSrc, pToRelease, pgnoPtrmap, spaceLeft, v1, v2, v3, v4 + /* pPage is not necessarily writeable since pCell might be auxiliary + ** buffer space that is separate from the pPage buffer area */ + /* Fill in the header. */ + nHeader = int32((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) + if (*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0 { + nPayload = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero + pSrc = (*TBtreePayload)(unsafe.Pointer(pX)).FpData + nSrc = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + /* fillInCell() only called for leaves */ + if uint32(nPayload) < libc.Uint32FromInt32(0x80) { + *(*uint8)(unsafe.Pointer(pCell + uintptr(nHeader))) = uint8(nPayload) + v1 = libc.Int32FromInt32(1) + } else { + v1 = _sqlite3PutVarint(tls, pCell+uintptr(nHeader), uint64(nPayload)) + } + nHeader += int32(uint8(v1)) + nHeader += _sqlite3PutVarint(tls, pCell+uintptr(nHeader), *(*Tu64)(unsafe.Pointer(pX + 8))) + } else { + v2 = int32((*TBtreePayload)(unsafe.Pointer(pX)).FnKey) + nPayload = v2 + nSrc = v2 + pSrc = (*TBtreePayload)(unsafe.Pointer(pX)).FpKey + if uint32(nPayload) < libc.Uint32FromInt32(0x80) { + *(*uint8)(unsafe.Pointer(pCell + uintptr(nHeader))) = uint8(nPayload) + v3 = libc.Int32FromInt32(1) + } else { + v3 = _sqlite3PutVarint(tls, pCell+uintptr(nHeader), uint64(nPayload)) + } + nHeader += int32(uint8(v3)) + } + /* Fill in the payload */ + pPayload = pCell + uintptr(nHeader) + if nPayload <= int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + /* This is the common case where everything fits on the btree page + ** and no overflow pages are required. */ + n = nHeader + nPayload + if n < int32(4) { + n = int32(4) + *(*uint8)(unsafe.Pointer(pPayload + uintptr(nPayload))) = uint8(0) + } + *(*int32)(unsafe.Pointer(pnSize)) = n + libc.Xmemcpy(tls, pPayload, pSrc, uint64(nSrc)) + libc.Xmemset(tls, pPayload+uintptr(nSrc), 0, uint64(nPayload-nSrc)) + return SQLITE_OK + } + /* If we reach this point, it means that some of the content will need + ** to spill onto overflow pages. + */ + mn = int32((*TMemPage)(unsafe.Pointer(pPage)).FminLocal) + n = int32(uint32(mn) + uint32(nPayload-mn)%((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize-uint32(4))) + if n > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + n = mn + } + spaceLeft = n + *(*int32)(unsafe.Pointer(pnSize)) = n + nHeader + int32(4) + pPrior = pCell + uintptr(nHeader+n) + pToRelease = uintptr(0) + *(*TPgno)(unsafe.Pointer(bp + 4)) = uint32(0) + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt + /* At this point variables should be set as follows: + ** + ** nPayload Total payload size in bytes + ** pPayload Begin writing payload here + ** spaceLeft Space available at pPayload. If nPayload>spaceLeft, + ** that means content must spill into overflow pages. + ** *pnSize Size of the local cell (not counting overflow pages) + ** pPrior Where to write the pgno of the first overflow page + ** + ** Use a call to btreeParseCellPtr() to verify that the values above + ** were computed correctly. + */ + /* Write the payload into the local Cell and any extra into overflow pages */ + for int32(1) != 0 { + n = nPayload + if n > spaceLeft { + n = spaceLeft + } + /* If pToRelease is not zero than pPayload points into the data area + ** of pToRelease. Make sure pToRelease is still writeable. */ + /* If pPayload is part of the data area of pPage, then make sure pPage + ** is still writeable */ + if nSrc >= n { + libc.Xmemcpy(tls, pPayload, pSrc, uint64(n)) + } else { + if nSrc > 0 { + n = nSrc + libc.Xmemcpy(tls, pPayload, pSrc, uint64(n)) + } else { + libc.Xmemset(tls, pPayload, 0, uint64(n)) + } + } + nPayload -= n + if nPayload <= 0 { + break + } + pPayload += uintptr(n) + pSrc += uintptr(n) + nSrc -= n + spaceLeft -= n + if spaceLeft == 0 { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + pgnoPtrmap = *(*TPgno)(unsafe.Pointer(bp + 4)) /* Overflow page pointer-map entry page */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + for cond := true; cond; cond = _ptrmapPageno(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 4))) == *(*TPgno)(unsafe.Pointer(bp + 4)) || *(*TPgno)(unsafe.Pointer(bp + 4)) == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + *(*TPgno)(unsafe.Pointer(bp + 4))++ + } + } + *(*int32)(unsafe.Pointer(bp)) = _allocateBtreePage(tls, pBt, bp+8, bp+4, *(*TPgno)(unsafe.Pointer(bp + 4)), uint8(0)) + /* If the database supports auto-vacuum, and the second or subsequent + ** overflow page is being allocated, add an entry to the pointer-map + ** for that page now. + ** + ** If this is the first overflow page, then write a partial entry + ** to the pointer-map. If we write nothing to this pointer-map slot, + ** then the optimistic overflow chain processing in clearCell() + ** may misinterpret the uninitialized values and delete the + ** wrong pages from the database. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if pgnoPtrmap != 0 { + v4 = int32(PTRMAP_OVERFLOW2) + } else { + v4 = int32(PTRMAP_OVERFLOW1) + } + eType = uint8(v4) + _ptrmapPut(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 4)), eType, pgnoPtrmap, bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + _releasePage(tls, pToRelease) + return *(*int32)(unsafe.Pointer(bp)) + } + /* If pToRelease is not zero than pPrior points into the data area + ** of pToRelease. Make sure pToRelease is still writeable. */ + /* If pPrior is part of the data area of pPage, then make sure pPage + ** is still writeable */ + _sqlite3Put4byte(tls, pPrior, *(*TPgno)(unsafe.Pointer(bp + 4))) + _releasePage(tls, pToRelease) + pToRelease = *(*uintptr)(unsafe.Pointer(bp + 8)) + pPrior = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData + _sqlite3Put4byte(tls, pPrior, uint32(0)) + pPayload = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData + 4 + spaceLeft = int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4)) + } + } + _releasePage(tls, pToRelease) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Remove the i-th cell from pPage. This routine effects pPage only. +// ** The cell content is not freed or deallocated. It is assumed that +// ** the cell content has been copied someplace else. This routine just +// ** removes the reference to the cell from pPage. +// ** +// ** "sz" must be the number of bytes in the cell. +// */ +func _dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { + var data, ptr uintptr + var hdr, rc int32 + var pc Tu32 + _, _, _, _, _ = data, hdr, pc, ptr, rc /* Beginning of the header. 0 most pages. 100 page 1 */ + if *(*int32)(unsafe.Pointer(pRC)) != 0 { + return + } + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + ptr = (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx) + pc = uint32(int32(*(*Tu8)(unsafe.Pointer(ptr)))< (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { + *(*int32)(unsafe.Pointer(pRC)) = _sqlite3CorruptError(tls, int32(77329)) + return + } + rc = _freeSpace(tls, pPage, uint16(pc), uint16(sz)) + if rc != 0 { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + (*TMemPage)(unsafe.Pointer(pPage)).FnCell-- + if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { + libc.Xmemset(tls, data+uintptr(hdr+int32(1)), 0, uint64(4)) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7)))) = uint8(0) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)))) = uint8((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(5)) + 1)) = uint8((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + (*TMemPage)(unsafe.Pointer(pPage)).FnFree = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - uint32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset) - uint32((*TMemPage)(unsafe.Pointer(pPage)).FchildPtrSize) - uint32(8)) + } else { + libc.Xmemmove(tls, ptr, ptr+uintptr(2), uint64(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell)-idx))) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(3)))) = uint8(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(3)) + 1)) = uint8((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + *(*int32)(unsafe.Pointer(pPage + 20)) += int32(2) + } +} + +// C documentation +// +// /* +// ** Insert a new cell on pPage at cell index "i". pCell points to the +// ** content of the cell. +// ** +// ** If the cell content will fit on the page, then put it there. If it +// ** will not fit, then make a copy of the cell content into pTemp if +// ** pTemp is not null. Regardless of pTemp, allocate a new entry +// ** in pPage->apOvfl[] and make it point to the cell content (either +// ** in pTemp or the original pCell) and also record its index. +// ** Allocating a new entry in pPage->aCell[] implies that +// ** pPage->nOverflow is incremented. +// ** +// ** The insertCellFast() routine below works exactly the same as +// ** insertCell() except that it lacks the pTemp and iChild parameters +// ** which are assumed zero. Other than that, the two routines are the +// ** same. +// ** +// ** Fixes or enhancements to this routine should be reflected in +// ** insertCellFast()! +// */ +func _insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, pTemp uintptr, iChild TPgno) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var data, pIns, v2, v4 uintptr + var j, rc int32 + var v1, v3 Tu8 + var _ /* idx at bp+0 */ int32 + var _ /* rc2 at bp+4 */ int32 + _, _, _, _, _, _, _, _ = data, j, pIns, rc, v1, v2, v3, v4 + *(*int32)(unsafe.Pointer(bp)) = 0 /* The point in pPage->aCellIdx[] where no cell inserted */ + if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 || sz+int32(2) > (*TMemPage)(unsafe.Pointer(pPage)).FnFree { + if pTemp != 0 { + libc.Xmemcpy(tls, pTemp, pCell, uint64(sz)) + pCell = pTemp + } + _sqlite3Put4byte(tls, pCell, iChild) + v2 = pPage + 12 + v1 = *(*Tu8)(unsafe.Pointer(v2)) + *(*Tu8)(unsafe.Pointer(v2))++ + j = int32(v1) + /* Comparison against ArraySize-1 since we hold back one extra slot + ** as a contingency. In other words, never need more than 3 overflow + ** slots but 4 are allocated, just to be safe. */ + *(*uintptr)(unsafe.Pointer(pPage + 40 + uintptr(j)*8)) = pCell + *(*Tu16)(unsafe.Pointer(pPage + 28 + uintptr(j)*2)) = uint16(i) + /* When multiple overflows occur, they are always sequential and in + ** sorted order. This invariants arise because multiple overflows can + ** only occur when inserting divider cells into the parent page during + ** balancing, and the dividers are adjacent and sorted. + */ + /* Overflows in sorted order */ + /* Overflows are sequential */ + } else { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != SQLITE_OK { + return rc + } + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + rc = _allocateSpace(tls, pPage, sz, bp) + if rc != 0 { + return rc + } + /* The allocateSpace() routine guarantees the following properties + ** if it returns successfully */ + *(*int32)(unsafe.Pointer(pPage + 20)) -= int32(uint16(libc.Int32FromInt32(2) + sz)) + /* In a corrupt database where an entry in the cell index section of + ** a btree page has a value of 3 or less, the pCell value might point + ** as many as 4 bytes in front of the start of the aData buffer for + ** the source page. Make sure this does not cause problems by not + ** reading the first 4 bytes */ + libc.Xmemcpy(tls, data+uintptr(*(*int32)(unsafe.Pointer(bp))+int32(4)), pCell+uintptr(4), uint64(sz-int32(4))) + _sqlite3Put4byte(tls, data+uintptr(*(*int32)(unsafe.Pointer(bp))), iChild) + pIns = (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(i*int32(2)) + libc.Xmemmove(tls, pIns+uintptr(2), pIns, uint64(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell)-i))) + *(*Tu8)(unsafe.Pointer(pIns)) = uint8(*(*int32)(unsafe.Pointer(bp)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pIns + 1)) = uint8(*(*int32)(unsafe.Pointer(bp))) + (*TMemPage)(unsafe.Pointer(pPage)).FnCell++ + /* increment the cell count */ + v4 = data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(4)) + *(*Tu8)(unsafe.Pointer(v4))++ + v3 = *(*Tu8)(unsafe.Pointer(v4)) + if int32(v3) == 0 { + *(*Tu8)(unsafe.Pointer(data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(3))))++ + } + if (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FautoVacuum != 0 { + *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK + /* The cell may contain a pointer to an overflow page. If so, write + ** the entry for the overflow page into the pointer map. + */ + _ptrmapPutOvflPtr(tls, pPage, pPage, pCell, bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This variant of insertCell() assumes that the pTemp and iChild +// ** parameters are both zero. Use this variant in sqlite3BtreeInsert() +// ** for performance improvement, and also so that this variant is only +// ** called from that one place, and is thus inlined, and thus runs must +// ** faster. +// ** +// ** Fixes or enhancements to this routine should be reflected into +// ** the insertCell() routine. +// */ +func _insertCellFast(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var data, pIns, v2, v4 uintptr + var j, rc int32 + var v1, v3 Tu8 + var _ /* idx at bp+0 */ int32 + var _ /* rc2 at bp+4 */ int32 + _, _, _, _, _, _, _, _ = data, j, pIns, rc, v1, v2, v3, v4 + *(*int32)(unsafe.Pointer(bp)) = 0 /* The point in pPage->aCellIdx[] where no cell inserted */ + if sz+int32(2) > (*TMemPage)(unsafe.Pointer(pPage)).FnFree { + v2 = pPage + 12 + v1 = *(*Tu8)(unsafe.Pointer(v2)) + *(*Tu8)(unsafe.Pointer(v2))++ + j = int32(v1) + /* Comparison against ArraySize-1 since we hold back one extra slot + ** as a contingency. In other words, never need more than 3 overflow + ** slots but 4 are allocated, just to be safe. */ + *(*uintptr)(unsafe.Pointer(pPage + 40 + uintptr(j)*8)) = pCell + *(*Tu16)(unsafe.Pointer(pPage + 28 + uintptr(j)*2)) = uint16(i) + /* When multiple overflows occur, they are always sequential and in + ** sorted order. This invariants arise because multiple overflows can + ** only occur when inserting divider cells into the parent page during + ** balancing, and the dividers are adjacent and sorted. + */ + /* Overflows in sorted order */ + /* Overflows are sequential */ + } else { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != SQLITE_OK { + return rc + } + data = (*TMemPage)(unsafe.Pointer(pPage)).FaData + rc = _allocateSpace(tls, pPage, sz, bp) + if rc != 0 { + return rc + } + /* The allocateSpace() routine guarantees the following properties + ** if it returns successfully */ + *(*int32)(unsafe.Pointer(pPage + 20)) -= int32(uint16(libc.Int32FromInt32(2) + sz)) + libc.Xmemcpy(tls, data+uintptr(*(*int32)(unsafe.Pointer(bp))), pCell, uint64(sz)) + pIns = (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(i*int32(2)) + libc.Xmemmove(tls, pIns+uintptr(2), pIns, uint64(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell)-i))) + *(*Tu8)(unsafe.Pointer(pIns)) = uint8(*(*int32)(unsafe.Pointer(bp)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pIns + 1)) = uint8(*(*int32)(unsafe.Pointer(bp))) + (*TMemPage)(unsafe.Pointer(pPage)).FnCell++ + /* increment the cell count */ + v4 = data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(4)) + *(*Tu8)(unsafe.Pointer(v4))++ + v3 = *(*Tu8)(unsafe.Pointer(v4)) + if int32(v3) == 0 { + *(*Tu8)(unsafe.Pointer(data + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(3))))++ + } + if (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FpBt)).FautoVacuum != 0 { + *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK + /* The cell may contain a pointer to an overflow page. If so, write + ** the entry for the overflow page into the pointer map. + */ + _ptrmapPutOvflPtr(tls, pPage, pPage, pCell, bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + } + } + return SQLITE_OK +} + +/* +** The following parameters determine how many adjacent pages get involved +** in a balancing operation. NN is the number of neighbors on either side +** of the page that participate in the balancing operation. NB is the +** total number of pages that participate, including the target page and +** NN neighbors on either side. +** +** The minimum value of NN is 1 (of course). Increasing NN above 1 +** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance +** in exchange for a larger degradation in INSERT and UPDATE performance. +** The value of NN appears to give the best results overall. +** +** (Later:) The description above makes it seem as if these values are +** tunable - as if you could change them and recompile and it would all work. +** But that is unlikely. NB has been 3 since the inception of SQLite and +** we have never tested any other value. + */ + +// C documentation +// +// /* +// ** A CellArray object contains a cache of pointers and sizes for a +// ** consecutive sequence of cells that might be held on multiple pages. +// ** +// ** The cells in this array are the divider cell or cells from the pParent +// ** page plus up to three child pages. There are a total of nCell cells. +// ** +// ** pRef is a pointer to one of the pages that contributes cells. This is +// ** used to access information such as MemPage.intKey and MemPage.pBt->pageSize +// ** which should be common to all pages that contribute cells to this array. +// ** +// ** apCell[] and szCell[] hold, respectively, pointers to the start of each +// ** cell and the size of each cell. Some of the apCell[] pointers might refer +// ** to overflow cells. In other words, some apCel[] pointers might not point +// ** to content area of the pages. +// ** +// ** A szCell[] of zero means the size of that cell has not yet been computed. +// ** +// ** The cells come from as many as four different pages: +// ** +// ** ----------- +// ** | Parent | +// ** ----------- +// ** / | ** / | ** --------- --------- --------- +// ** |Child-1| |Child-2| |Child-3| +// ** --------- --------- --------- +// ** +// ** The order of cells is in the array is for an index btree is: +// ** +// ** 1. All cells from Child-1 in order +// ** 2. The first divider cell from Parent +// ** 3. All cells from Child-2 in order +// ** 4. The second divider cell from Parent +// ** 5. All cells from Child-3 in order +// ** +// ** For a table-btree (with rowids) the items 2 and 4 are empty because +// ** content exists only in leaves and there are no divider cells. +// ** +// ** For an index btree, the apEnd[] array holds pointer to the end of page +// ** for Child-1, the Parent, Child-2, the Parent (again), and Child-3, +// ** respectively. The ixNx[] array holds the number of cells contained in +// ** each of these 5 stages, and all stages to the left. Hence: +// ** +// ** ixNx[0] = Number of cells in Child-1. +// ** ixNx[1] = Number of cells in Child-1 plus 1 for first divider. +// ** ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider. +// ** ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells +// ** ixNx[4] = Total number of cells. +// ** +// ** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2] +// ** are used and they point to the leaf pages only, and the ixNx value are: +// ** +// ** ixNx[0] = Number of cells in Child-1. +// ** ixNx[1] = Number of cells in Child-1 and Child-2. +// ** ixNx[2] = Total number of cells. +// ** +// ** Sometimes when deleting, a child page can have zero cells. In those +// ** cases, ixNx[] entries with higher indexes, and the corresponding apEnd[] +// ** entries, shift down. The end result is that each ixNx[] entry should +// ** be larger than the previous +// */ +type TCellArray = struct { + FnCell int32 + FpRef uintptr + FapCell uintptr + FszCell uintptr + FapEnd [6]uintptr + FixNx [6]int32 +} + +type CellArray = TCellArray + +type TCellArray1 = struct { + FnCell int32 + FpRef uintptr + FapCell uintptr + FszCell uintptr + FapEnd [6]uintptr + FixNx [6]int32 +} + +type CellArray1 = TCellArray1 + +// C documentation +// +// /* +// ** Make sure the cell sizes at idx, idx+1, ..., idx+N-1 have been +// ** computed. +// */ +func _populateCellCache(tls *libc.TLS, p uintptr, idx int32, N int32) { + var pRef, szCell uintptr + _, _ = pRef, szCell + pRef = (*TCellArray)(unsafe.Pointer(p)).FpRef + szCell = (*TCellArray)(unsafe.Pointer(p)).FszCell + for N > 0 { + if int32(*(*Tu16)(unsafe.Pointer(szCell + uintptr(idx)*2))) == 0 { + *(*Tu16)(unsafe.Pointer(szCell + uintptr(idx)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pRef)).FxCellSize})))(tls, pRef, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FapCell + uintptr(idx)*8))) + } else { + } + idx++ + N-- + } +} + +// C documentation +// +// /* +// ** Return the size of the Nth element of the cell array +// */ +func _computeCellSize(tls *libc.TLS, p uintptr, N int32) (r Tu16) { + *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FpRef)).FxCellSize})))(tls, (*TCellArray)(unsafe.Pointer(p)).FpRef, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FapCell + uintptr(N)*8))) + return *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) +} + +func _cachedCellSize(tls *libc.TLS, p uintptr, N int32) (r Tu16) { + if *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) != 0 { + return *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) + } + return _computeCellSize(tls, p, N) +} + +// C documentation +// +// /* +// ** Array apCell[] contains pointers to nCell b-tree page cells. The +// ** szCell[] array contains the size in bytes of each cell. This function +// ** replaces the current contents of page pPg with the contents of the cell +// ** array. +// ** +// ** Some of the cells in apCell[] may currently be stored in pPg. This +// ** function works around problems caused by this by making a copy of any +// ** such cells before overwriting the page data. +// ** +// ** The MemPage.nFree field is invalidated by this function. It is the +// ** responsibility of the caller to set it correctly. +// */ +func _rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg uintptr) (r int32) { + var aData, pCell, pCellptr, pData, pEnd, pSrcEnd, pTmp uintptr + var hdr, i, iEnd, k, usableSize int32 + var j Tu32 + var sz Tu16 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, hdr, i, iEnd, j, k, pCell, pCellptr, pData, pEnd, pSrcEnd, pTmp, sz, usableSize + hdr = int32((*TMemPage)(unsafe.Pointer(pPg)).FhdrOffset) /* Offset of header on pPg */ + aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData /* Pointer to data for pPg */ + usableSize = int32((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPg)).FpBt)).FusableSize) + pEnd = aData + uintptr(usableSize) + i = iFirst /* Start of cell content area */ + iEnd = i + nCell /* Loop terminator */ + pCellptr = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx + pTmp = _sqlite3PagerTempSpace(tls, (*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPg)).FpBt)).FpPager) /* Current pCArray->apEnd[k] value */ + j = uint32(int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))))< uint32(usableSize) { + j = uint32(0) + } + libc.Xmemcpy(tls, pTmp+uintptr(j), aData+uintptr(j), uint64(uint32(usableSize)-j)) + k = 0 + for { + if !(k < libc.Int32FromInt32(NB)*libc.Int32FromInt32(2) && *(*int32)(unsafe.Pointer(pCArray + 80 + uintptr(k)*4)) <= i) { + break + } + goto _1 + _1: + ; + k++ + } + pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) + pData = pEnd + for int32(1) != 0 { + pCell = *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) + sz = *(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) + if uint64(pCell) >= uint64(aData+uintptr(j)) && uint64(pCell) < uint64(pEnd) { + if uint64(pCell+uintptr(sz)) > uint64(pEnd) { + return _sqlite3CorruptError(tls, int32(77718)) + } + pCell = pTmp + uintptr(int64(pCell)-int64(aData)) + } else { + if uint64(pCell+uintptr(sz)) > uint64(pSrcEnd) && uint64(pCell) < uint64(pSrcEnd) { + return _sqlite3CorruptError(tls, int32(77723)) + } + } + pData -= uintptr(sz) + *(*Tu8)(unsafe.Pointer(pCellptr)) = uint8((int64(pData) - int64(aData)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pData) - int64(aData)) + pCellptr += uintptr(2) + if pData < pCellptr { + return _sqlite3CorruptError(tls, int32(77729)) + } + libc.Xmemmove(tls, pData, pCell, uint64(sz)) + i++ + if i >= iEnd { + break + } + if *(*int32)(unsafe.Pointer(pCArray + 80 + uintptr(k)*4)) <= i { + k++ + pSrcEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) + } + } + /* The pPg->nFree field is now set incorrectly. The caller will fix it. */ + (*TMemPage)(unsafe.Pointer(pPg)).FnCell = uint16(nCell) + (*TMemPage)(unsafe.Pointer(pPg)).FnOverflow = uint8(0) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(1)))) = uint8(libc.Int32FromInt32(0) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(1)) + 1)) = uint8(libc.Int32FromInt32(0)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(3)))) = uint8(int32((*TMemPage)(unsafe.Pointer(pPg)).FnCell) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(3)) + 1)) = uint8((*TMemPage)(unsafe.Pointer(pPg)).FnCell) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))) = uint8((int64(pData) - int64(aData)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(pData) - int64(aData)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(7)))) = uint8(0x00) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The pCArray objects contains pointers to b-tree cells and the cell sizes. +// ** This function attempts to add the cells stored in the array to page pPg. +// ** If it cannot (because the page needs to be defragmented before the cells +// ** will fit), non-zero is returned. Otherwise, if the cells are added +// ** successfully, zero is returned. +// ** +// ** Argument pCellptr points to the first entry in the cell-pointer array +// ** (part of page pPg) to populate. After cell apCell[0] is written to the +// ** page body, a 16-bit offset is written to pCellptr. And so on, for each +// ** cell in the array. It is the responsibility of the caller to ensure +// ** that it is safe to overwrite this part of the cell-pointer array. +// ** +// ** When this function is called, *ppData points to the start of the +// ** content area on page pPg. If the size of the content area is extended, +// ** *ppData is updated to point to the new start of the content area +// ** before returning. +// ** +// ** Finally, argument pBegin points to the byte immediately following the +// ** end of the space required by this page for the cell-pointer area (for +// ** all cells - not just those inserted by the current call). If the content +// ** area must be extended to before this point in order to accommodate all +// ** cells in apCell[], then the cells do not fit and non-zero is returned. +// */ +func _pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr, pCellptr uintptr, iFirst int32, nCell int32, pCArray uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aData, pData, pEnd, pSlot, v2 uintptr + var i, iEnd, k, sz int32 + var v3 bool + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = aData, i, iEnd, k, pData, pEnd, pSlot, sz, v2, v3 + i = iFirst /* Loop counter - cell index to insert */ + aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData /* Complete page */ + pData = *(*uintptr)(unsafe.Pointer(ppData)) /* Content area. A subset of aData[] */ + iEnd = iFirst + nCell /* Maximum extent of cell data */ + /* Never called on page 1 */ + if iEnd <= iFirst { + return 0 + } + k = 0 + for { + if !(k < libc.Int32FromInt32(NB)*libc.Int32FromInt32(2) && *(*int32)(unsafe.Pointer(pCArray + 80 + uintptr(k)*4)) <= i) { + break + } + goto _1 + _1: + ; + k++ + } + pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) + for int32(1) != 0 { + sz = int32(*(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) + if v3 = int32(*(*Tu8)(unsafe.Pointer(aData + 1))) == 0 && int32(*(*Tu8)(unsafe.Pointer(aData + 2))) == 0; !v3 { + v2 = _pageFindSlot(tls, pPg, sz, bp) + pSlot = v2 + } + if v3 || v2 == uintptr(0) { + if int64(pData)-int64(pBegin) < int64(sz) { + return int32(1) + } + pData -= uintptr(sz) + pSlot = pData + } + /* pSlot and pCArray->apCell[i] will never overlap on a well-formed + ** database. But they might for a corrupt database. Hence use memmove() + ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */ + if uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))+uintptr(sz)) > uint64(pEnd) && uint64(*(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8))) < uint64(pEnd) { + _sqlite3CorruptError(tls, int32(77814)) + return int32(1) + } + libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) + *(*Tu8)(unsafe.Pointer(pCellptr)) = uint8((int64(pSlot) - int64(aData)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(pCellptr + 1)) = uint8(int64(pSlot) - int64(aData)) + pCellptr += uintptr(2) + i++ + if i >= iEnd { + break + } + if *(*int32)(unsafe.Pointer(pCArray + 80 + uintptr(k)*4)) <= i { + k++ + pEnd = *(*uintptr)(unsafe.Pointer(pCArray + 32 + uintptr(k)*8)) + } + } + *(*uintptr)(unsafe.Pointer(ppData)) = pData + return 0 +} + +// C documentation +// +// /* +// ** The pCArray object contains pointers to b-tree cells and their sizes. +// ** +// ** This function adds the space associated with each cell in the array +// ** that is currently stored within the body of pPg to the pPg free-list. +// ** The cell-pointers and other fields of the page are not updated. +// ** +// ** This function returns the total number of cells added to the free-list. +// */ +func _pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArray uintptr) (r int32) { + var aAfter, aOfst [10]int32 + var aData, pCell, pEnd, pStart uintptr + var i, iAfter, iEnd, iOfst, j, nFree, nRet, sz int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aAfter, aData, aOfst, i, iAfter, iEnd, iOfst, j, nFree, nRet, pCell, pEnd, pStart, sz + aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData + pEnd = aData + uintptr((*TBtShared)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPg)).FpBt)).FusableSize) + pStart = aData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPg)).FhdrOffset)+int32(8)+int32((*TMemPage)(unsafe.Pointer(pPg)).FchildPtrSize)) + nRet = 0 + iEnd = iFirst + nCell + nFree = 0 + i = iFirst + for { + if !(i < iEnd) { + break + } + pCell = *(*uintptr)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) + if uint64(pCell) >= uint64(pStart) && uint64(pCell) < uint64(pEnd) { + /* No need to use cachedCellSize() here. The sizes of all cells that + ** are to be freed have already been computing while deciding which + ** cells need freeing */ + sz = int32(*(*Tu16)(unsafe.Pointer((*TCellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) + iOfst = int32(uint16(int64(pCell) - int64(aData))) + iAfter = iOfst + sz + j = 0 + for { + if !(j < nFree) { + break + } + if aOfst[j] == iAfter { + aOfst[j] = iOfst + break + } else { + if aAfter[j] == iOfst { + aAfter[j] = iAfter + break + } + } + goto _2 + _2: + ; + j++ + } + if j >= nFree { + if nFree >= int32(libc.Uint64FromInt64(40)/libc.Uint64FromInt64(4)) { + j = 0 + for { + if !(j < nFree) { + break + } + _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) + goto _3 + _3: + ; + j++ + } + nFree = 0 + } + aOfst[nFree] = iOfst + aAfter[nFree] = iAfter + if aData+uintptr(iAfter) > pEnd { + return 0 + } + nFree++ + } + nRet++ + } + goto _1 + _1: + ; + i++ + } + j = 0 + for { + if !(j < nFree) { + break + } + _freeSpace(tls, pPg, uint16(aOfst[j]), uint16(aAfter[j]-aOfst[j])) + goto _4 + _4: + ; + j++ + } + return nRet +} + +// C documentation +// +// /* +// ** pCArray contains pointers to and sizes of all cells in the page being +// ** balanced. The current page, pPg, has pPg->nCell cells starting with +// ** pCArray->apCell[iOld]. After balancing, this page should hold nNew cells +// ** starting at apCell[iNew]. +// ** +// ** This routine makes the necessary adjustments to pPg so that it contains +// ** the correct cells after being balanced. +// ** +// ** The pPg->nFree field is invalid when this function returns. It is the +// ** responsibility of the caller to set it correctly. +// */ +func _editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, pCArray uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aData, pBegin, pCellptr uintptr + var hdr, i, iCell, iNewEnd, iOldEnd, nAdd, nCell, nShift, nTail, v1 int32 + var _ /* pData at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, hdr, i, iCell, iNewEnd, iOldEnd, nAdd, nCell, nShift, nTail, pBegin, pCellptr, v1 + aData = (*TMemPage)(unsafe.Pointer(pPg)).FaData + hdr = int32((*TMemPage)(unsafe.Pointer(pPg)).FhdrOffset) + pBegin = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr(nNew*int32(2)) + nCell = int32((*TMemPage)(unsafe.Pointer(pPg)).FnCell) + iOldEnd = iOld + int32((*TMemPage)(unsafe.Pointer(pPg)).FnCell) + int32((*TMemPage)(unsafe.Pointer(pPg)).FnOverflow) + iNewEnd = iNew + nNew + /* Remove cells from the start and end of the page */ + if iOld < iNew { + nShift = _pageFreeArray(tls, pPg, iOld, iNew-iOld, pCArray) + if nShift > nCell { + return _sqlite3CorruptError(tls, int32(77936)) + } + libc.Xmemmove(tls, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx, (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx+uintptr(nShift*int32(2)), uint64(nCell*int32(2))) + nCell -= nShift + } + if iNewEnd < iOldEnd { + nTail = _pageFreeArray(tls, pPg, iNewEnd, iOldEnd-iNewEnd, pCArray) + nCell -= nTail + } + *(*uintptr)(unsafe.Pointer(bp)) = aData + uintptr(int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))))< (*TMemPage)(unsafe.Pointer(pPg)).FaDataEnd { + goto editpage_fail + } + /* Add cells to the start of the page */ + if iNew < iOld { + if nNew < iOld-iNew { + v1 = nNew + } else { + v1 = iOld - iNew + } + nAdd = v1 + pCellptr = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx + libc.Xmemmove(tls, pCellptr+uintptr(nAdd*int32(2)), pCellptr, uint64(nCell*int32(2))) + if _pageInsertArray(tls, pPg, pBegin, bp, pCellptr, iNew, nAdd, pCArray) != 0 { + goto editpage_fail + } + nCell += nAdd + } + /* Add any overflow cells */ + i = 0 + for { + if !(i < int32((*TMemPage)(unsafe.Pointer(pPg)).FnOverflow)) { + break + } + iCell = iOld + int32(*(*Tu16)(unsafe.Pointer(pPg + 28 + uintptr(i)*2))) - iNew + if iCell >= 0 && iCell < nNew { + pCellptr = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr(iCell*int32(2)) + if nCell > iCell { + libc.Xmemmove(tls, pCellptr+2, pCellptr, uint64((nCell-iCell)*int32(2))) + } + nCell++ + _cachedCellSize(tls, pCArray, iCell+iNew) + if _pageInsertArray(tls, pPg, pBegin, bp, pCellptr, iCell+iNew, int32(1), pCArray) != 0 { + goto editpage_fail + } + } + goto _2 + _2: + ; + i++ + } + /* Append cells to the end of the page */ + pCellptr = (*TMemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr(nCell*int32(2)) + if _pageInsertArray(tls, pPg, pBegin, bp, pCellptr, iNew+nCell, nNew-nCell, pCArray) != 0 { + goto editpage_fail + } + (*TMemPage)(unsafe.Pointer(pPg)).FnCell = uint16(nNew) + (*TMemPage)(unsafe.Pointer(pPg)).FnOverflow = uint8(0) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(3)))) = uint8(int32((*TMemPage)(unsafe.Pointer(pPg)).FnCell) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(3)) + 1)) = uint8((*TMemPage)(unsafe.Pointer(pPg)).FnCell) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)))) = uint8((int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aData + uintptr(hdr+int32(5)) + 1)) = uint8(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(aData)) + return SQLITE_OK +editpage_fail: + ; + /* Unable to edit this page. Rebuild it from scratch instead. */ + if nNew < int32(1) { + return _sqlite3CorruptError(tls, int32(78010)) + } + _populateCellCache(tls, pCArray, iNew, nNew) + return _rebuildPage(tls, pCArray, iNew, nNew, pPg) +} + +// C documentation +// +// /* +// ** This version of balance() handles the common special case where +// ** a new entry is being inserted on the extreme right-end of the +// ** tree, in other words, when the new entry will become the largest +// ** entry in the tree. +// ** +// ** Instead of trying to balance the 3 right-most leaf pages, just add +// ** a new page to the right-hand side and put the one new entry in +// ** that page. This leaves the right side of the tree somewhat +// ** unbalanced. But odds are that we will be inserting new entries +// ** at the end soon afterwards so the nearly empty page will quickly +// ** fill up. On average. +// ** +// ** pPage is the leaf page which is the right-most page in the tree. +// ** pParent is its parent. pPage must have a single overflow entry +// ** which is also the right-most entry on the page. +// ** +// ** The pSpace buffer is used to store a temporary copy of the divider +// ** cell that will be inserted into pParent. Such a cell consists of a 4 +// ** byte page number followed by a variable length integer. In other +// ** words, at most 13 bytes. Hence the pSpace buffer must be at +// ** least 13 bytes in size. +// */ +func _balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintptr) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var pBt, pOut, pStop, v1, v3, v4 uintptr + var v2 Tu8 + var _ /* b at bp+32 */ TCellArray + var _ /* pCell at bp+16 */ uintptr + var _ /* pNew at bp+0 */ uintptr + var _ /* pgnoNew at bp+12 */ TPgno + var _ /* rc at bp+8 */ int32 + var _ /* szCell at bp+24 */ Tu16 + _, _, _, _, _, _, _ = pBt, pOut, pStop, v1, v2, v3, v4 + pBt = (*TMemPage)(unsafe.Pointer(pPage)).FpBt /* Page number of pNew */ + if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { + return _sqlite3CorruptError(tls, int32(78050)) + } /* dbfuzz001.test */ + /* Allocate a new page. This page will become the right-sibling of + ** pPage. Make the parent page writable, so that the new divider cell + ** may be inserted. If both these operations are successful, proceed. + */ + *(*int32)(unsafe.Pointer(bp + 8)) = _allocateBtreePage(tls, pBt, bp, bp+12, uint32(0), uint8(0)) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + pOut = pSpace + 4 + *(*uintptr)(unsafe.Pointer(bp + 16)) = *(*uintptr)(unsafe.Pointer(pPage + 40)) + *(*Tu16)(unsafe.Pointer(bp + 24)) = (*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, *(*uintptr)(unsafe.Pointer(bp + 16))) + _zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp)), libc.Int32FromInt32(PTF_INTKEY)|libc.Int32FromInt32(PTF_LEAFDATA)|libc.Int32FromInt32(PTF_LEAF)) + (*(*TCellArray)(unsafe.Pointer(bp + 32))).FnCell = int32(1) + (*(*TCellArray)(unsafe.Pointer(bp + 32))).FpRef = pPage + (*(*TCellArray)(unsafe.Pointer(bp + 32))).FapCell = bp + 16 + (*(*TCellArray)(unsafe.Pointer(bp + 32))).FszCell = bp + 24 + *(*uintptr)(unsafe.Pointer(bp + 32 + 32)) = (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd + *(*int32)(unsafe.Pointer(bp + 32 + 80)) = int32(2) + *(*int32)(unsafe.Pointer(bp + 8)) = _rebuildPage(tls, bp+32, 0, int32(1), *(*uintptr)(unsafe.Pointer(bp))) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 8)) + } + (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnFree = int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FcellOffset) - uint32(2) - uint32(*(*Tu16)(unsafe.Pointer(bp + 24)))) + /* If this is an auto-vacuum database, update the pointer map + ** with entries for the new page, and any pointer from the + ** cell on the page to an overflow page. If either of these + ** operations fails, the return code is set, but the contents + ** of the parent page are still manipulated by the code below. + ** That is Ok, at this point the parent page is guaranteed to + ** be marked as dirty. Returning an error code will cause a + ** rollback, undoing any changes made to the parent page. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _ptrmapPut(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 12)), uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer(pParent)).Fpgno, bp+8) + if int32(*(*Tu16)(unsafe.Pointer(bp + 24))) > int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FminLocal) { + _ptrmapPutOvflPtr(tls, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 16)), bp+8) + } + } + /* Create a divider cell to insert into pParent. The divider cell + ** consists of a 4-byte page number (the page number of pPage) and + ** a variable length key value (which must be the same value as the + ** largest key on pPage). + ** + ** To find the largest key value on pPage, first find the right-most + ** cell on pPage. The first two fields of this cell are the + ** record-length (a variable length integer at most 32-bits in size) + ** and the key value (a variable length integer, may have any value). + ** The first of the while(...) loops below skips over the record-length + ** field. The second while(...) loop copies the key value from the + ** cell on pPage into the pSpace buffer. + */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell)-int32(1)))))))) + pStop = *(*uintptr)(unsafe.Pointer(bp + 16)) + 9 + for { + v1 = *(*uintptr)(unsafe.Pointer(bp + 16)) + *(*uintptr)(unsafe.Pointer(bp + 16))++ + if !(int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0 && *(*uintptr)(unsafe.Pointer(bp + 16)) < pStop) { + break + } + } + pStop = *(*uintptr)(unsafe.Pointer(bp + 16)) + 9 + for { + v3 = *(*uintptr)(unsafe.Pointer(bp + 16)) + *(*uintptr)(unsafe.Pointer(bp + 16))++ + v2 = *(*Tu8)(unsafe.Pointer(v3)) + v4 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v4)) = v2 + if !(int32(v2)&int32(0x80) != 0 && *(*uintptr)(unsafe.Pointer(bp + 16)) < pStop) { + break + } + } + /* Insert the new divider cell into pParent. */ + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8)) = _insertCell(tls, pParent, int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell), pSpace, int32(int64(pOut)-int64(pSpace)), uintptr(0), (*TMemPage)(unsafe.Pointer(pPage)).Fpgno) + } + /* Set the right-child pointer of pParent to point to the new page. */ + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pParent)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pParent)).FhdrOffset)+int32(8)), *(*TPgno)(unsafe.Pointer(bp + 12))) + /* Release the reference to the new page. */ + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return *(*int32)(unsafe.Pointer(bp + 8)) +} + +// C documentation +// +// /* +// ** This function is used to copy the contents of the b-tree node stored +// ** on page pFrom to page pTo. If page pFrom was not a leaf page, then +// ** the pointer-map entries for each child page are updated so that the +// ** parent page stored in the pointer map is page pTo. If pFrom contained +// ** any cells with overflow page pointers, then the corresponding pointer +// ** map entries are also updated so that the parent page is page pTo. +// ** +// ** If pFrom is currently carrying any overflow cells (entries in the +// ** MemPage.apOvfl[] array), they are not copied to pTo. +// ** +// ** Before returning, page pTo is reinitialized using btreeInitPage(). +// ** +// ** The performance of this function is not critical. It is only used by +// ** the balance_shallower() and balance_deeper() procedures, neither of +// ** which are called often under normal circumstances. +// */ +func _copyNodeContent(tls *libc.TLS, pFrom uintptr, pTo uintptr, pRC uintptr) { + var aFrom, aTo, pBt uintptr + var iData, iFromHdr, iToHdr, rc, v1 int32 + _, _, _, _, _, _, _, _ = aFrom, aTo, iData, iFromHdr, iToHdr, pBt, rc, v1 + if *(*int32)(unsafe.Pointer(pRC)) == SQLITE_OK { + pBt = (*TMemPage)(unsafe.Pointer(pFrom)).FpBt + aFrom = (*TMemPage)(unsafe.Pointer(pFrom)).FaData + aTo = (*TMemPage)(unsafe.Pointer(pTo)).FaData + iFromHdr = int32((*TMemPage)(unsafe.Pointer(pFrom)).FhdrOffset) + if (*TMemPage)(unsafe.Pointer(pTo)).Fpgno == uint32(1) { + v1 = int32(100) + } else { + v1 = 0 + } + iToHdr = v1 + /* Copy the b-tree node content from page pFrom to page pTo. */ + iData = int32(*(*Tu8)(unsafe.Pointer(aFrom + uintptr(iFromHdr+int32(5)))))<aCell[] */ + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* Value of pPage->aData[0] */ + iSpace1 = 0 /* First unused byte of aSpace1[] */ + iOvflSpace = 0 /* Parsed information on cells being balanced */ + libc.Xmemset(tls, bp+100, 0, uint64(5)) + libc.Xmemset(tls, bp+112, 0, uint64(104)) + pBt = (*TMemPage)(unsafe.Pointer(pParent)).FpBt + /* At this point pParent may have at most one overflow cell. And if + ** this overflow cell is present, it must be the cell with + ** index iParentIdx. This scenario comes about when this function + ** is called (indirectly) from sqlite3BtreeDelete(). + */ + if !(aOvflSpace != 0) { + return int32(SQLITE_NOMEM) + } + /* Find the sibling pages to balance. Also locate the cells in pParent + ** that divide the siblings. An attempt is made to find NN siblings on + ** either side of pPage. More siblings are taken from one side, however, + ** if there are fewer than NN siblings on the other side. If pParent + ** has NB or fewer children then all children of pParent are taken. + ** + ** This loop also drops the divider cells from the parent page. This + ** way, the remainder of the function does not have to deal with any + ** overflow cells in the parent page, since if any existed they will + ** have already been removed. + */ + i = int32((*TMemPage)(unsafe.Pointer(pParent)).FnOverflow) + int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell) + if i < int32(2) { + nxDiv = 0 + } else { + if iParentIdx == 0 { + nxDiv = 0 + } else { + if iParentIdx == i { + nxDiv = i - int32(2) + bBulk + } else { + nxDiv = iParentIdx - int32(1) + } + } + i = int32(2) - bBulk + } + nOld = i + int32(1) + if i+nxDiv-int32((*TMemPage)(unsafe.Pointer(pParent)).FnOverflow) == int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell) { + pRight = (*TMemPage)(unsafe.Pointer(pParent)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pParent)).FhdrOffset)+int32(8)) + } else { + pRight = (*TMemPage)(unsafe.Pointer(pParent)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pParent)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pParent)).FaCellIdx + uintptr(int32(2)*(i+nxDiv-int32((*TMemPage)(unsafe.Pointer(pParent)).FnOverflow)))))))) + } + *(*TPgno)(unsafe.Pointer(bp + 92)) = _sqlite3Get4byte(tls, pRight) + for int32(1) != 0 { + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _getAndInitPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 92)), bp+8+uintptr(i)*8, 0) + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + libc.Xmemset(tls, bp+8, 0, uint64(i+libc.Int32FromInt32(1))*uint64(8)) + goto balance_cleanup + } + if (*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i])).FnFree < 0 { + *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + libc.Xmemset(tls, bp+8, 0, uint64(i)*uint64(8)) + goto balance_cleanup + } + } + nMaxCells += int32((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i])).FnCell) + int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) + v1 = i + i-- + if v1 == 0 { + break + } + if (*TMemPage)(unsafe.Pointer(pParent)).FnOverflow != 0 && i+nxDiv == int32(*(*Tu16)(unsafe.Pointer(pParent + 28))) { + apDiv[i] = *(*uintptr)(unsafe.Pointer(pParent + 40)) + *(*TPgno)(unsafe.Pointer(bp + 92)) = _sqlite3Get4byte(tls, apDiv[i]) + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pParent)).FxCellSize})))(tls, pParent, apDiv[i])) + (*TMemPage)(unsafe.Pointer(pParent)).FnOverflow = uint8(0) + } else { + apDiv[i] = (*TMemPage)(unsafe.Pointer(pParent)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pParent)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pParent)).FaCellIdx + uintptr(int32(2)*(i+nxDiv-int32((*TMemPage)(unsafe.Pointer(pParent)).FnOverflow)))))))) + *(*TPgno)(unsafe.Pointer(bp + 92)) = _sqlite3Get4byte(tls, apDiv[i]) + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pParent)).FxCellSize})))(tls, pParent, apDiv[i])) + /* Drop the cell from the parent page. apDiv[i] still points to + ** the cell within the parent, even though it has been dropped. + ** This is safe because dropping a cell only overwrites the first + ** four bytes of it, and this function does not need the first + ** four bytes of the divider cell. So the pointer is safe to use + ** later on. + ** + ** But not if we are in secure-delete mode. In secure-delete mode, + ** the dropCell() routine will overwrite the entire cell with zeroes. + ** In this case, temporarily copy the cell into the aOvflSpace[] + ** buffer. It will be copied out again as soon as the aSpace[] buffer + ** is allocated. */ + if int32((*TBtShared)(unsafe.Pointer(pBt)).FbtsFlags)&int32(BTS_FAST_SECURE) != 0 { + /* If the following if() condition is not true, the db is corrupted. + ** The call to dropCell() below will detect this. */ + iOff = int32(int64(apDiv[i])) - int32(int64((*TMemPage)(unsafe.Pointer(pParent)).FaData)) + if iOff+(*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] <= int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize) { + libc.Xmemcpy(tls, aOvflSpace+uintptr(iOff), apDiv[i], uint64((*(*[5]int32)(unsafe.Pointer(bp + 72)))[i])) + apDiv[i] = aOvflSpace + uintptr(int64(apDiv[i])-int64((*TMemPage)(unsafe.Pointer(pParent)).FaData)) + } + } + _dropCell(tls, pParent, i+nxDiv-int32((*TMemPage)(unsafe.Pointer(pParent)).FnOverflow), (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i], bp) + } + } + /* Make nMaxCells a multiple of 4 in order to preserve 8-byte + ** alignment */ + nMaxCells = (nMaxCells + int32(3)) & ^libc.Int32FromInt32(3) + /* + ** Allocate space for memory structures + */ + szScratch = int32(uint64(nMaxCells)*uint64(8) + uint64(nMaxCells)*uint64(2) + uint64((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)) /* aSpace1 */ + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(szScratch)) + if (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + goto balance_cleanup + } + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(nMaxCells)*8 + aSpace1 = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(nMaxCells)*2 + /* + ** Load pointers to all cells on sibling pages and the divider cells + ** into the local b.apCell[] array. Make copies of the divider cells + ** into space obtained from aSpace1[]. The divider cells have already + ** been removed from pParent. + ** + ** If the siblings are on leaf pages, then the child pointers of the + ** divider cells are stripped from the cells before they are copied + ** into aSpace1[]. In this way, all cells in b.apCell[] are without + ** child pointers. If siblings are not leaves, then all cell in + ** b.apCell[] include child pointers. Either way, all cells in b.apCell[] + ** are alike. + ** + ** leafCorrection: 4 if pPage is a leaf. 0 if pPage is not a leaf. + ** leafData: 1 if pPage holds key+data and pParent holds only keys. + */ + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FpRef = (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0] + leafCorrection = uint16(int32((*TMemPage)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FpRef)).Fleaf) * int32(4)) + leafData = int32((*TMemPage)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FpRef)).FintKeyLeaf) + i = 0 + for { + if !(i < nOld) { + break + } + pOld = (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i] + limit = int32((*TMemPage)(unsafe.Pointer(pOld)).FnCell) + aData = (*TMemPage)(unsafe.Pointer(pOld)).FaData + maskPage = (*TMemPage)(unsafe.Pointer(pOld)).FmaskPage + piCell = aData + uintptr((*TMemPage)(unsafe.Pointer(pOld)).FcellOffset) + /* Verify that all sibling pages are of the same "type" (table-leaf, + ** table-interior, index-leaf, or index-interior). + */ + if int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78471)) + goto balance_cleanup + } + /* Load b.apCell[] with pointers to all cells in pOld. If pOld + ** contains overflow cells, include them in the b.apCell[] array + ** in the correct spot. + ** + ** Note that when there are multiple overflow cells, it is always the + ** case that they are sequential and adjacent. This invariant arises + ** because multiple overflows can only occurs when inserting divider + ** cells into a parent on a prior balance, and divider cells are always + ** adjacent and are inserted in order. There is an assert() tagged + ** with "NOTE 1" in the overflow cell insertion loop to prove this + ** invariant. + ** + ** This must be done in advance. Once the balance starts, the cell + ** offset section of the btree page will be overwritten and we will no + ** long be able to find the cells if a pointer to each cell is not saved + ** first. + */ + libc.Xmemset(tls, (*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell+uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2, 0, uint64(2)*uint64(limit+int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow))) + if int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0 { + if limit < int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78495)) + goto balance_cleanup + } + limit = int32(*(*Tu16)(unsafe.Pointer(pOld + 28))) + j = 0 + for { + if !(j < limit) { + break + } + *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = aData + uintptr(int32(maskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(piCell))))) + piCell += uintptr(2) + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ + goto _3 + _3: + ; + j++ + } + k = 0 + for { + if !(k < int32((*TMemPage)(unsafe.Pointer(pOld)).FnOverflow)) { + break + } + /* NOTE 1 */ + *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = *(*uintptr)(unsafe.Pointer(pOld + 40 + uintptr(k)*8)) + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ + goto _4 + _4: + ; + k++ + } + } + piEnd = aData + uintptr((*TMemPage)(unsafe.Pointer(pOld)).FcellOffset) + uintptr(int32(2)*int32((*TMemPage)(unsafe.Pointer(pOld)).FnCell)) + for piCell < piEnd { + *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = aData + uintptr(int32(maskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(piCell))))) + piCell += uintptr(2) + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ + } + cntOld[i] = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell + if i < nOld-int32(1) && !(leafData != 0) { + sz = uint16((*(*[5]int32)(unsafe.Pointer(bp + 72)))[i]) + *(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2)) = sz + pTemp = aSpace1 + uintptr(iSpace1) + iSpace1 += int32(sz) + libc.Xmemcpy(tls, pTemp, apDiv[i], uint64(sz)) + *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)) = pTemp + uintptr(leafCorrection) + *(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2)) = uint16(int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2))) - int32(leafCorrection)) + if !((*TMemPage)(unsafe.Pointer(pOld)).Fleaf != 0) { + /* The right pointer of the child page pOld becomes the left + ** pointer of the divider cell */ + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*8)), (*TMemPage)(unsafe.Pointer(pOld)).FaData+8, uint64(4)) + } else { + for int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2))) < int32(4) { + /* Do not allow any cells smaller than 4 bytes. If a smaller cell + ** does exist, pad it with 0x00 bytes. */ + v5 = iSpace1 + iSpace1++ + *(*Tu8)(unsafe.Pointer(aSpace1 + uintptr(v5))) = uint8(0x00) + *(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr((*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell)*2))++ + } + } + (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell++ + } + goto _2 + _2: + ; + i++ + } + /* + ** Figure out the number of pages needed to hold all b.nCell cells. + ** Store this number in "k". Also compute szNew[] which is the total + ** size of all cells on the i-th page and cntNew[] which is the index + ** in b.apCell[] of the cell that divides page i from page i+1. + ** cntNew[k] should equal b.nCell. + ** + ** Values computed by this block: + ** + ** k: The total number of sibling pages + ** szNew[i]: Spaced used on the i-th sibling page. + ** cntNew[i]: Index in b.apCell[] and b.szCell[] for the first cell to + ** the right of the i-th sibling page. + ** usableSpace: Number of bytes of space available on each sibling. + ** + */ + usableSpace = int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(12) + uint32(leafCorrection)) + v7 = libc.Int32FromInt32(0) + k = v7 + i = v7 + for { + if !(i < nOld) { + break + } + p = (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i] + *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) = (*TMemPage)(unsafe.Pointer(p)).FaDataEnd + *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) = cntOld[i] + if k != 0 && *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) == *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k-int32(1))*4)) { + k-- /* Omit b.ixNx[] entry for child pages with no cells */ + } + if !(leafData != 0) { + k++ + *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) = (*TMemPage)(unsafe.Pointer(pParent)).FaDataEnd + *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) = cntOld[i] + int32(1) + } + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] = usableSpace - (*TMemPage)(unsafe.Pointer(p)).FnFree + j = 0 + for { + if !(j < int32((*TMemPage)(unsafe.Pointer(p)).FnOverflow)) { + break + } + *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += int32(2) + int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(p)).FxCellSize})))(tls, p, *(*uintptr)(unsafe.Pointer(p + 40 + uintptr(j)*8)))) + goto _8 + _8: + ; + j++ + } + cntNew[i] = cntOld[i] + goto _6 + _6: + ; + i++ + k++ + } + k = nOld + i = 0 + for { + if !(i < k) { + break + } + for (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] > usableSpace { + if i+int32(1) >= k { + k = i + int32(2) + if k > libc.Int32FromInt32(NB)+libc.Int32FromInt32(2) { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78596)) + goto balance_cleanup + } + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[k-int32(1)] = 0 + cntNew[k-int32(1)] = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell + } + sz1 = int32(2) + int32(_cachedCellSize(tls, bp+112, cntNew[i]-int32(1))) + *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) -= sz1 + if !(leafData != 0) { + if cntNew[i] < (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell { + sz1 = int32(2) + int32(_cachedCellSize(tls, bp+112, cntNew[i])) + } else { + sz1 = 0 + } + } + *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i+int32(1))*4)) += sz1 + cntNew[i]-- + } + for cntNew[i] < (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell { + sz1 = int32(2) + int32(_cachedCellSize(tls, bp+112, cntNew[i])) + if (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i]+sz1 > usableSpace { + break + } + *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i)*4)) += sz1 + cntNew[i]++ + if !(leafData != 0) { + if cntNew[i] < (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell { + sz1 = int32(2) + int32(_cachedCellSize(tls, bp+112, cntNew[i])) + } else { + sz1 = 0 + } + } + *(*int32)(unsafe.Pointer(bp + 72 + uintptr(i+int32(1))*4)) -= sz1 + } + if cntNew[i] >= (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell { + k = i + int32(1) + } else { + if i > 0 { + v10 = cntNew[i-int32(1)] + } else { + v10 = 0 + } + if cntNew[i] <= v10 { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78629)) + goto balance_cleanup + } + } + goto _9 + _9: + ; + i++ + } + /* + ** The packing computed by the previous block is biased toward the siblings + ** on the left side (siblings with smaller keys). The left siblings are + ** always nearly full, while the right-most sibling might be nearly empty. + ** The next block of code attempts to adjust the packing of siblings to + ** get a better balance. + ** + ** This adjustment is more than an optimization. The packing above might + ** be so out of balance as to be illegal. For example, the right-most + ** sibling might be completely empty. This adjustment is not optional. + */ + i = k - int32(1) + for { + if !(i > 0) { + break + } + szRight = (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] /* Size of sibling on the right */ + szLeft = (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i-int32(1)] /* Index of first cell to the left of right sibling */ + r = cntNew[i-int32(1)] - int32(1) + d = r + int32(1) - leafData + _cachedCellSize(tls, bp+112, d) + for cond := true; cond; cond = r >= 0 { + szR = int32(_cachedCellSize(tls, bp+112, r)) + szD = int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(d)*2))) + if v14 = szRight != 0; v14 { + if v13 = bBulk != 0; !v13 { + if i == k-int32(1) { + v12 = 0 + } else { + v12 = int32(2) + } + } + } + if v14 && (v13 || szRight+szD+int32(2) > szLeft-(szR+v12)) { + break + } + szRight += szD + int32(2) + szLeft -= szR + int32(2) + cntNew[i-int32(1)] = r + r-- + d-- + } + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i] = szRight + (*(*[5]int32)(unsafe.Pointer(bp + 72)))[i-int32(1)] = szLeft + if i > int32(1) { + v15 = cntNew[i-int32(2)] + } else { + v15 = 0 + } + if cntNew[i-int32(1)] <= v15 { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78673)) + goto balance_cleanup + } + goto _11 + _11: + ; + i-- + } + /* Sanity check: For a non-corrupt database file one of the following + ** must be true: + ** (1) We found one or more cells (cntNew[0])>0), or + ** (2) pPage is a virtual root page. A virtual root page is when + ** the real root page is page 1 and we are the only child of + ** that page. + */ + /* + ** Allocate k new pages. Reuse old pages where possible. + */ + pageFlags = int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[0])).FaData))) + i = 0 + for { + if !(i < k) { + break + } + if i < nOld { + v17 = (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i] + (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i] = v17 + *(*uintptr)(unsafe.Pointer(bp + 216)) = v17 + (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i] = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) + nNew++ + if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).FpDbPage) != int32(1)+libc.BoolInt32(i == iParentIdx-nxDiv) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78706)) + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto balance_cleanup + } + } else { + if bBulk != 0 { + v18 = uint32(1) + } else { + v18 = *(*TPgno)(unsafe.Pointer(bp + 92)) + } + *(*int32)(unsafe.Pointer(bp)) = _allocateBtreePage(tls, pBt, bp+216, bp+92, v18, uint8(0)) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto balance_cleanup + } + _zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp + 216)), pageFlags) + (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i] = *(*uintptr)(unsafe.Pointer(bp + 216)) + nNew++ + cntOld[i] = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell + /* Set the pointer-map entry for the new sibling page. */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _ptrmapPut(tls, pBt, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 216)))).Fpgno, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer(pParent)).Fpgno, bp) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + goto balance_cleanup + } + } + } + goto _16 + _16: + ; + i++ + } + /* + ** Reassign page numbers so that the new pages are in ascending order. + ** This helps to keep entries in the disk file in order so that a scan + ** of the table is closer to a linear scan through the file. That in turn + ** helps the operating system to deliver pages from the disk more rapidly. + ** + ** An O(N*N) sort algorithm is used, but since N is never more than NB+2 + ** (5), that is not a performance concern. + ** + ** When NB==3, this one optimization makes the database about 25% faster + ** for large insertions and deletions. + */ + i = 0 + for { + if !(i < nNew) { + break + } + aPgno[i] = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno + goto _19 + _19: + ; + i++ + } + i = 0 + for { + if !(i < nNew-int32(1)) { + break + } + iB = i + j = i + int32(1) + for { + if !(j < nNew) { + break + } + if (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[j])).Fpgno < (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iB])).Fpgno { + iB = j + } + goto _21 + _21: + ; + j++ + } + /* If apNew[i] has a page number that is bigger than any of the + ** subsequence apNew[i] entries, then swap apNew[i] with the subsequent + ** entry that has the smallest page number (which we know to be + ** entry apNew[iB]). + */ + if iB != i { + pgnoA = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno + pgnoB = (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iB])).Fpgno + pgnoTemp = uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize + uint32(1) + fgA = (*TDbPage)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).FpDbPage)).Fflags + fgB = (*TDbPage)(unsafe.Pointer((*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iB])).FpDbPage)).Fflags + _sqlite3PagerRekey(tls, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).FpDbPage, pgnoTemp, fgB) + _sqlite3PagerRekey(tls, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iB])).FpDbPage, pgnoA, fgA) + _sqlite3PagerRekey(tls, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).FpDbPage, pgnoB, fgB) + (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno = pgnoB + (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iB])).Fpgno = pgnoA + } + goto _20 + _20: + ; + i++ + } + _sqlite3Put4byte(tls, pRight, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).Fpgno) + /* If the sibling pages are not leaves, ensure that the right-child pointer + ** of the right-most new sibling page is set to the value that was + ** originally in the same field of the right-most old sibling page. */ + if pageFlags&int32(PTF_LEAF) == 0 && nOld != nNew { + if nNew > nOld { + v22 = bp + 32 + } else { + v22 = bp + 8 + } + pOld1 = *(*uintptr)(unsafe.Pointer(v22 + uintptr(nOld-int32(1))*8)) + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[nNew-int32(1)])).FaData+8, (*TMemPage)(unsafe.Pointer(pOld1)).FaData+8, uint64(4)) + } + /* Make any required updates to pointer map entries associated with + ** cells stored on sibling pages following the balance operation. Pointer + ** map entries associated with divider cells are set by the insertCell() + ** routine. The associated pointer map entries are: + ** + ** a) if the cell contains a reference to an overflow chain, the + ** entry associated with the first page in the overflow chain, and + ** + ** b) if the sibling pages are not leaves, the child page associated + ** with the cell. + ** + ** If the sibling pages are not leaves, then the pointer map entry + ** associated with the right-child of each sibling may also need to be + ** updated. This happens below, after the sibling pages have been + ** populated, not here. + */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + v23 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0] + pOld2 = v23 + pNew1 = v23 + cntOldNext = int32((*TMemPage)(unsafe.Pointer(pNew1)).FnCell) + int32((*TMemPage)(unsafe.Pointer(pNew1)).FnOverflow) + iNew = 0 + iOld = 0 + i = 0 + for { + if !(i < (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell) { + break + } + pCell = *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(i)*8)) + for i == cntOldNext { + iOld++ + if iOld < nNew { + v25 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iOld] + } else { + v25 = (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[iOld] + } + pOld2 = v25 + cntOldNext += int32((*TMemPage)(unsafe.Pointer(pOld2)).FnCell) + int32((*TMemPage)(unsafe.Pointer(pOld2)).FnOverflow) + libc.BoolInt32(!(leafData != 0)) + } + if i == cntNew[iNew] { + iNew++ + v26 = iNew + pNew1 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[v26] + if !(leafData != 0) { + goto _24 + } + } + /* Cell pCell is destined for new sibling page pNew. Originally, it + ** was either part of sibling page iOld (possibly an overflow cell), + ** or else the divider cell to the left of sibling page iOld. So, + ** if sibling page iOld had the same page number as pNew, and if + ** pCell really was a part of sibling page iOld (not a divider or + ** overflow cell), we can skip updating the pointer map entries. */ + if iOld >= nNew || (*TMemPage)(unsafe.Pointer(pNew1)).Fpgno != aPgno[iOld] || !(uint64(pCell) >= uint64((*TMemPage)(unsafe.Pointer(pOld2)).FaData) && uint64(pCell) < uint64((*TMemPage)(unsafe.Pointer(pOld2)).FaDataEnd)) { + if !(leafCorrection != 0) { + _ptrmapPut(tls, pBt, _sqlite3Get4byte(tls, pCell), uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer(pNew1)).Fpgno, bp) + } + if int32(_cachedCellSize(tls, bp+112, i)) > int32((*TMemPage)(unsafe.Pointer(pNew1)).FminLocal) { + _ptrmapPutOvflPtr(tls, pNew1, pOld2, pCell, bp) + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto balance_cleanup + } + } + goto _24 + _24: + ; + i++ + } + } + /* Insert new divider cells into pParent. */ + i = 0 + for { + if !(i < nNew-int32(1)) { + break + } + pNew2 = (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i] + j = cntNew[i] + pCell1 = *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(j)*8)) + sz2 = int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(j)*2))) + int32(leafCorrection) + pTemp1 = aOvflSpace + uintptr(iOvflSpace) + if !((*TMemPage)(unsafe.Pointer(pNew2)).Fleaf != 0) { + libc.Xmemcpy(tls, (*TMemPage)(unsafe.Pointer(pNew2)).FaData+8, pCell1, uint64(4)) + } else { + if leafData != 0 { + j-- + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pNew2)).FxParseCell})))(tls, pNew2, *(*uintptr)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell + uintptr(j)*8)), bp+224) + pCell1 = pTemp1 + sz2 = int32(4) + _sqlite3PutVarint(tls, pCell1+4, uint64((*(*TCellInfo)(unsafe.Pointer(bp + 224))).FnKey)) + pTemp1 = uintptr(0) + } else { + pCell1 -= uintptr(4) + /* Obscure case for non-leaf-data trees: If the cell at pCell was + ** previously stored on a leaf node, and its reported size was 4 + ** bytes, then it may actually be smaller than this + ** (see btreeParseCellPtr(), 4 bytes is the minimum size of + ** any cell). But it is important to pass the correct size to + ** insertCell(), so reparse the cell now. + ** + ** This can only happen for b-trees used to evaluate "IN (SELECT ...)" + ** and WITHOUT ROWID tables with exactly one column which is the + ** primary key. + */ + if int32(*(*Tu16)(unsafe.Pointer((*(*TCellArray)(unsafe.Pointer(bp + 112))).FszCell + uintptr(j)*2))) == int32(4) { + sz2 = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pParent)).FxCellSize})))(tls, pParent, pCell1)) + } + } + } + iOvflSpace += sz2 + k = 0 + for { + if !(k < libc.Int32FromInt32(NB)*libc.Int32FromInt32(2) && *(*int32)(unsafe.Pointer(bp + 112 + 80 + uintptr(k)*4)) <= j) { + break + } + goto _28 + _28: + ; + k++ + } + pSrcEnd = *(*uintptr)(unsafe.Pointer(bp + 112 + 32 + uintptr(k)*8)) + if uint64(pCell1) < uint64(pSrcEnd) && uint64(pCell1+uintptr(sz2)) > uint64(pSrcEnd) { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(78906)) + goto balance_cleanup + } + *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pParent, nxDiv+i, pCell1, sz2, pTemp1, (*TMemPage)(unsafe.Pointer(pNew2)).Fpgno) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + goto balance_cleanup + } + goto _27 + _27: + ; + i++ + } + /* Now update the actual sibling pages. The order in which they are updated + ** is important, as this code needs to avoid disrupting any page from which + ** cells may still to be read. In practice, this means: + ** + ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1]) + ** then it is not safe to update page apNew[iPg] until after + ** the left-hand sibling apNew[iPg-1] has been updated. + ** + ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1]) + ** then it is not safe to update page apNew[iPg] until after + ** the right-hand sibling apNew[iPg+1] has been updated. + ** + ** If neither of the above apply, the page is safe to update. + ** + ** The iPg value in the following loop starts at nNew-1 goes down + ** to 0, then back up to nNew-1 again, thus making two passes over + ** the pages. On the initial downward pass, only condition (1) above + ** needs to be tested because (2) will always be true from the previous + ** step. On the upward pass, both conditions are always true, so the + ** upwards pass simply processes pages that were missed on the downward + ** pass. + */ + i = int32(1) - nNew + for { + if !(i < nNew) { + break + } + if i < 0 { + v30 = -i + } else { + v30 = i + } + iPg = v30 + if (*(*[5]Tu8)(unsafe.Pointer(bp + 100)))[iPg] != 0 { + goto _29 + } /* Skip pages already processed */ + if i >= 0 || cntOld[iPg-int32(1)] >= cntNew[iPg-int32(1)] { + /* Verify condition (1): If cells are moving left, update iPg + ** only after iPg-1 has already been updated. */ + /* Verify condition (2): If cells are moving right, update iPg + ** only after iPg+1 has already been updated. */ + if iPg == 0 { + v31 = libc.Int32FromInt32(0) + iOld1 = v31 + iNew1 = v31 + nNewCell = cntNew[0] + } else { + if iPg < nOld { + v32 = cntOld[iPg-int32(1)] + libc.BoolInt32(!(leafData != 0)) + } else { + v32 = (*(*TCellArray)(unsafe.Pointer(bp + 112))).FnCell + } + iOld1 = v32 + iNew1 = cntNew[iPg-int32(1)] + libc.BoolInt32(!(leafData != 0)) + nNewCell = cntNew[iPg] - iNew1 + } + *(*int32)(unsafe.Pointer(bp)) = _editPage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iPg], iOld1, iNew1, nNewCell, bp+112) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto balance_cleanup + } + (*(*[5]Tu8)(unsafe.Pointer(bp + 100)))[iPg]++ + (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[iPg])).FnFree = usableSpace - (*(*[5]int32)(unsafe.Pointer(bp + 72)))[iPg] + } + goto _29 + _29: + ; + i++ + } + /* All pages have been processed exactly once */ + if isRoot != 0 && int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell) == 0 && int32((*TMemPage)(unsafe.Pointer(pParent)).FhdrOffset) <= (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0])).FnFree { + /* The root page of the b-tree now contains no cells. The only sibling + ** page is the right-child of the parent. Copy the contents of the + ** child page into the parent, decreasing the overall height of the + ** b-tree structure by one. This is described as the "balance-shallower" + ** sub-algorithm in some documentation. + ** + ** If this is an auto-vacuum database, the call to copyNodeContent() + ** sets all pointer-map entries corresponding to database image pages + ** for which the pointer is stored within the content being copied. + ** + ** It is critical that the child page be defragmented before being + ** copied into the parent, because if the parent is page 1 then it will + ** by smaller than the child due to the database header, and so all the + ** free space needs to be up front. + */ + *(*int32)(unsafe.Pointer(bp)) = _defragmentPage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], -int32(1)) + _copyNodeContent(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], pParent, bp) + _freePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[0], bp) + } else { + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 && !(leafCorrection != 0) { + /* Fix the pointer map entries associated with the right-child of each + ** sibling page. All other pointer map entries have already been taken + ** care of. */ + i = 0 + for { + if !(i < nNew) { + break + } + key = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).FaData+8) + _ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer((*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i])).Fpgno, bp) + goto _33 + _33: + ; + i++ + } + } + } + /* Free any old pages that were not reused as new pages. + */ + i = nNew + for { + if !(i < nOld) { + break + } + _freePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i], bp) + goto _34 + _34: + ; + i++ + } + /* + ** Cleanup before returning. + */ +balance_cleanup: + ; + _sqlite3DbFree(tls, uintptr(0), (*(*TCellArray)(unsafe.Pointer(bp + 112))).FapCell) + i = 0 + for { + if !(i < nOld) { + break + } + _releasePage(tls, (*(*[3]uintptr)(unsafe.Pointer(bp + 8)))[i]) + goto _35 + _35: + ; + i++ + } + i = 0 + for { + if !(i < nNew) { + break + } + _releasePage(tls, (*(*[5]uintptr)(unsafe.Pointer(bp + 32)))[i]) + goto _36 + _36: + ; + i++ + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** This function is called when the root page of a b-tree structure is +// ** overfull (has one or more overflow pages). +// ** +// ** A new child page is allocated and the contents of the current root +// ** page, including overflow cells, are copied into the child. The root +// ** page is then overwritten to make it an empty page with the right-child +// ** pointer pointing to the new page. +// ** +// ** Before returning, all pointer-map entries corresponding to pages +// ** that the new child-page now contains pointers to are updated. The +// ** entry corresponding to the new right-child pointer of the root +// ** page is also updated. +// ** +// ** If successful, *ppChild is set to contain a reference to the child +// ** page and SQLITE_OK is returned. In this case the caller is required +// ** to call releasePage() on *ppChild exactly once. If an error occurs, +// ** an error code is returned and *ppChild is set to 0. +// */ +func _balance_deeper(tls *libc.TLS, pRoot uintptr, ppChild uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pBt uintptr + var _ /* pChild at bp+8 */ uintptr + var _ /* pgnoChild at bp+16 */ TPgno + var _ /* rc at bp+0 */ int32 + _ = pBt /* Return value from subprocedures */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Pointer to a new child page */ + *(*TPgno)(unsafe.Pointer(bp + 16)) = uint32(0) /* Page number of the new child page */ + pBt = (*TMemPage)(unsafe.Pointer(pRoot)).FpBt /* The BTree */ + /* Make pRoot, the root page of the b-tree, writable. Allocate a new + ** page that will become the new right-child of pPage. Copy the contents + ** of the node stored on pRoot into the new child page. + */ + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _allocateBtreePage(tls, pBt, bp+8, bp+16, (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno, uint8(0)) + _copyNodeContent(tls, pRoot, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _ptrmapPut(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16)), uint8(PTRMAP_BTREE), (*TMemPage)(unsafe.Pointer(pRoot)).Fpgno, bp) + } + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + *(*uintptr)(unsafe.Pointer(ppChild)) = uintptr(0) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + return *(*int32)(unsafe.Pointer(bp)) + } + /* Copy the overflow cells from pRoot to pChild */ + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8))+28, pRoot+28, uint64((*TMemPage)(unsafe.Pointer(pRoot)).FnOverflow)*uint64(2)) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8))+40, pRoot+40, uint64((*TMemPage)(unsafe.Pointer(pRoot)).FnOverflow)*uint64(8)) + (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FnOverflow = (*TMemPage)(unsafe.Pointer(pRoot)).FnOverflow + /* Zero the contents of pRoot. Then install pChild as the right-child. */ + _zeroPage(tls, pRoot, int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FaData))) & ^libc.Int32FromInt32(PTF_LEAF)) + _sqlite3Put4byte(tls, (*TMemPage)(unsafe.Pointer(pRoot)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pRoot)).FhdrOffset)+int32(8)), *(*TPgno)(unsafe.Pointer(bp + 16))) + *(*uintptr)(unsafe.Pointer(ppChild)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return SQLITE_CORRUPT if any cursor other than pCur is currently valid +// ** on the same B-tree as pCur. +// ** +// ** This can occur if a database is corrupt with two or more SQL tables +// ** pointing to the same b-tree. If an insert occurs on one SQL table +// ** and causes a BEFORE TRIGGER to do a secondary insert on the other SQL +// ** table linked to the same b-tree. If the secondary insert causes a +// ** rebalance, that can change content out from under the cursor on the +// ** first SQL table, violating invariants on the first insert. +// */ +func _anotherValidCursor(tls *libc.TLS, pCur uintptr) (r int32) { + var pOther uintptr + _ = pOther + pOther = (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpCursor + for { + if !(pOther != 0) { + break + } + if pOther != pCur && int32((*TBtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID && (*TBtCursor)(unsafe.Pointer(pOther)).FpPage == (*TBtCursor)(unsafe.Pointer(pCur)).FpPage { + return _sqlite3CorruptError(tls, int32(79138)) + } + goto _1 + _1: + ; + pOther = (*TBtCursor)(unsafe.Pointer(pOther)).FpNext + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The page that pCur currently points to has just been modified in +// ** some way. This function figures out if this modification means the +// ** tree needs to be balanced, and if so calls the appropriate balancing +// ** routine. Balancing routines are: +// ** +// ** balance_quick() +// ** balance_deeper() +// ** balance_nonroot() +// */ +func _balance(tls *libc.TLS, pCur uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iIdx, iPage, rc, v1, v2 int32 + var pFree, pPage, pParent, pSpace uintptr + var v3 bool + var _ /* aBalanceQuickSpace at bp+0 */ [13]Tu8 + _, _, _, _, _, _, _, _, _, _ = iIdx, iPage, pFree, pPage, pParent, pSpace, rc, v1, v2, v3 + rc = SQLITE_OK + pFree = uintptr(0) + for cond := true; cond; cond = rc == SQLITE_OK { + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { + break + } + if int32((*TMemPage)(unsafe.Pointer(pPage)).FnOverflow) == 0 && (*TMemPage)(unsafe.Pointer(pPage)).FnFree*int32(3) <= int32((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize)*int32(2) { + /* No rebalance required as long as: + ** (1) There are no overflow cells + ** (2) The amount of free space on the page is less than 2/3rds of + ** the total usable space on the page. */ + break + } else { + v1 = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) + iPage = v1 + if v1 == 0 { + if v3 = (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0; v3 { + v2 = _anotherValidCursor(tls, pCur) + rc = v2 + } + if v3 && v2 == SQLITE_OK { + /* The root page of the b-tree is overfull. In this case call the + ** balance_deeper() function to create a new child for the root-page + ** and copy the current contents of the root-page to it. The + ** next iteration of the do-loop will balance the child page. + */ + rc = _balance_deeper(tls, pPage, pCur+144+1*8) + if rc == SQLITE_OK { + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage = int8(1) + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(0) + *(*Tu16)(unsafe.Pointer(pCur + 88)) = uint16(0) + *(*uintptr)(unsafe.Pointer(pCur + 144)) = pPage + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + 1*8)) + } + } else { + break + } + } else { + if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) > int32(1) { + /* The page being written is not a root page, and there is currently + ** more than one reference to it. This only happens if the page is one + ** of its own ancestor pages. Corruption. */ + rc = _sqlite3CorruptError(tls, int32(79198)) + } else { + pParent = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iPage-int32(1))*8)) + iIdx = int32(*(*Tu16)(unsafe.Pointer(pCur + 88 + uintptr(iPage-int32(1))*2))) + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pParent)).FpDbPage) + if rc == SQLITE_OK && (*TMemPage)(unsafe.Pointer(pParent)).FnFree < 0 { + rc = _btreeComputeFreeSpace(tls, pParent) + } + if rc == SQLITE_OK { + if (*TMemPage)(unsafe.Pointer(pPage)).FintKeyLeaf != 0 && int32((*TMemPage)(unsafe.Pointer(pPage)).FnOverflow) == int32(1) && int32(*(*Tu16)(unsafe.Pointer(pPage + 28))) == int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) && (*TMemPage)(unsafe.Pointer(pParent)).Fpgno != uint32(1) && int32((*TMemPage)(unsafe.Pointer(pParent)).FnCell) == iIdx { + /* Call balance_quick() to create a new sibling of pPage on which + ** to store the overflow cell. balance_quick() inserts a new cell + ** into pParent, which may cause pParent overflow. If this + ** happens, the next iteration of the do-loop will balance pParent + ** use either balance_nonroot() or balance_deeper(). Until this + ** happens, the overflow cell is stored in the aBalanceQuickSpace[] + ** buffer. + ** + ** The purpose of the following assert() is to check that only a + ** single call to balance_quick() is made for each call to this + ** function. If this were not verified, a subtle bug involving reuse + ** of the aBalanceQuickSpace[] might sneak in. + */ + rc = _balance_quick(tls, pParent, pPage, bp) + } else { + /* In this case, call balance_nonroot() to redistribute cells + ** between pPage and up to 2 of its sibling pages. This involves + ** modifying the contents of pParent, which may cause pParent to + ** become overfull or underfull. The next iteration of the do-loop + ** will balance the parent page to correct this. + ** + ** If the parent page becomes overfull, the overflow cell or cells + ** are stored in the pSpace buffer allocated immediately below. + ** A subsequent iteration of the do-loop will deal with this by + ** calling balance_nonroot() (balance_deeper() may be called first, + ** but it doesn't deal with overflow cells - just moves them to a + ** different page). Once this subsequent call to balance_nonroot() + ** has completed, it is safe to release the pSpace buffer used by + ** the previous call, as the overflow cell data will have been + ** copied either into the body of a database page or into the new + ** pSpace buffer passed to the latter call to balance_nonroot(). + */ + pSpace = _sqlite3PageMalloc(tls, int32((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize)) + rc = _balance_nonroot(tls, pParent, iIdx, pSpace, libc.BoolInt32(iPage == int32(1)), int32((*TBtCursor)(unsafe.Pointer(pCur)).Fhints)&int32(BTREE_BULKLOAD)) + if pFree != 0 { + /* If pFree is not NULL, it points to the pSpace buffer used + ** by a previous call to balance_nonroot(). Its contents are + ** now stored either on real database pages or within the + ** new pSpace buffer, so it may be safely freed here. */ + _sqlite3PageFree(tls, pFree) + } + /* The pSpace buffer will be freed after the next call to + ** balance_nonroot(), or just before this function returns, whichever + ** comes first. */ + pFree = pSpace + } + } + (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow = uint8(0) + /* The next iteration of the do-loop balances the parent page. */ + _releasePage(tls, pPage) + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage-- + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) + } + } + } + } + if pFree != 0 { + _sqlite3PageFree(tls, pFree) + } + return rc +} + +// C documentation +// +// /* Overwrite content from pX into pDest. Only do the write if the +// ** content is different from what is already there. +// */ +func _btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uintptr, iOffset int32, iAmt int32) (r int32) { + var i, nData, rc, rc1, rc2 int32 + _, _, _, _, _ = i, nData, rc, rc1, rc2 + nData = (*TBtreePayload)(unsafe.Pointer(pX)).FnData - iOffset + if nData <= 0 { + i = 0 + for { + if !(i < iAmt && int32(*(*Tu8)(unsafe.Pointer(pDest + uintptr(i)))) == 0) { + break + } + goto _1 + _1: + ; + i++ + } + if i < iAmt { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != 0 { + return rc + } + libc.Xmemset(tls, pDest+uintptr(i), 0, uint64(iAmt-i)) + } + } else { + if nData < iAmt { + /* Mixed read data and zeros at the end. Make a recursive call + ** to write the zeros then fall through to write the real data */ + rc1 = _btreeOverwriteContent(tls, pPage, pDest+uintptr(nData), pX, iOffset+nData, iAmt-nData) + if rc1 != 0 { + return rc1 + } + iAmt = nData + } + if libc.Xmemcmp(tls, pDest, (*TBtreePayload)(unsafe.Pointer(pX)).FpData+uintptr(iOffset), uint64(iAmt)) != 0 { + rc2 = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc2 != 0 { + return rc2 + } + /* In a corrupt database, it is possible for the source and destination + ** buffers to overlap. This is harmless since the database is already + ** corrupt but it does cause valgrind and ASAN warnings. So use + ** memmove(). */ + libc.Xmemmove(tls, pDest, (*TBtreePayload)(unsafe.Pointer(pX)).FpData+uintptr(iOffset), uint64(iAmt)) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Overwrite the cell that cursor pCur is pointing to with fresh content +// ** contained in pX. In this variant, pCur is pointing to an overflow +// ** cell. +// */ +func _btreeOverwriteOverflowCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iOffset, nTotal, rc int32 + var ovflPageSize Tu32 + var ovflPgno TPgno + var pBt uintptr + var _ /* pPage at bp+0 */ uintptr + _, _, _, _, _, _ = iOffset, nTotal, ovflPageSize, ovflPgno, pBt, rc /* Next byte of pX->pData to write */ + nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Return code */ + *(*uintptr)(unsafe.Pointer(bp)) = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Size to write on overflow page */ + /* pCur is an overflow cell */ + /* Overwrite the local portion first */ + rc = _btreeOverwriteContent(tls, *(*uintptr)(unsafe.Pointer(bp)), (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload, pX, 0, int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + if rc != 0 { + return rc + } + /* Now overwrite the overflow pages */ + iOffset = int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + ovflPgno = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr(iOffset)) + pBt = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpBt + ovflPageSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) + for cond := true; cond; cond = iOffset < nTotal { + rc = _btreeGetPage(tls, pBt, ovflPgno, bp, 0) + if rc != 0 { + return rc + } + if _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1) || (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FisInit != 0 { + rc = _sqlite3CorruptError(tls, int32(79362)) + } else { + if uint32(iOffset)+ovflPageSize < uint32(nTotal) { + ovflPgno = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData) + } else { + ovflPageSize = uint32(nTotal - iOffset) + } + rc = _btreeOverwriteContent(tls, *(*uintptr)(unsafe.Pointer(bp)), (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+uintptr(4), pX, iOffset, int32(ovflPageSize)) + } + _sqlite3PagerUnref(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if rc != 0 { + return rc + } + iOffset = int32(uint32(iOffset) + ovflPageSize) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Overwrite the cell that cursor pCur is pointing to with fresh content +// ** contained in pX. +// */ +func _btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) (r int32) { + var nTotal int32 + var pPage uintptr + _, _ = nTotal, pPage + nTotal = (*TBtreePayload)(unsafe.Pointer(pX)).FnData + (*TBtreePayload)(unsafe.Pointer(pX)).FnZero /* Total bytes of to write */ + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage /* Page being written */ + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload+uintptr((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd || (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FcellOffset) { + return _sqlite3CorruptError(tls, int32(79390)) + } + if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { + /* The entire cell is local */ + return _btreeOverwriteContent(tls, pPage, (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload, pX, 0, int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + } else { + /* The cell contains overflow content */ + return _btreeOverwriteOverflowCell(tls, pCur, pX) + } + return r +} + +// C documentation +// +// /* +// ** Insert a new record into the BTree. The content of the new record +// ** is described by the pX object. The pCur cursor is used only to +// ** define what table the record should be inserted into, and is left +// ** pointing at a random location. +// ** +// ** For a table btree (used for rowid tables), only the pX.nKey value of +// ** the key is used. The pX.pKey value must be NULL. The pX.nKey is the +// ** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields +// ** hold the content of the row. +// ** +// ** For an index btree (used for indexes and WITHOUT ROWID tables), the +// ** key is an arbitrary byte sequence stored in pX.pKey,nKey. The +// ** pX.pData,nData,nZero fields must be zero. +// ** +// ** If the seekResult parameter is non-zero, then a successful call to +// ** sqlite3BtreeIndexMoveto() to seek cursor pCur to (pKey,nKey) has already +// ** been performed. In other words, if seekResult!=0 then the cursor +// ** is currently pointing to a cell that will be adjacent to the cell +// ** to be inserted. If seekResult<0 then pCur points to a cell that is +// ** smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell +// ** that is larger than (pKey,nKey). +// ** +// ** If seekResult==0, that means pCur is pointing at some unknown location. +// ** In that case, this routine must seek the cursor to the correct insertion +// ** point for (pKey,nKey) before doing the insertion. For index btrees, +// ** if pX->nMem is non-zero, then pX->aMem contains pointers to the unpacked +// ** key values and pX->aMem can be used instead of pX->pKey to avoid having +// ** to decode the key. +// */ +func _sqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, seekResult int32) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var idx int32 + var newCell, oldCell, p, pPage, v3, p1, p4, p5 uintptr + var ovfl TPgno + var v2 Tu16 + var _ /* info at bp+104 */ TCellInfo + var _ /* info at bp+128 */ TCellInfo + var _ /* loc at bp+4 */ int32 + var _ /* r at bp+16 */ TUnpackedRecord + var _ /* rc at bp+0 */ int32 + var _ /* szNew at bp+8 */ int32 + var _ /* x2 at bp+56 */ TBtreePayload + _, _, _, _, _, _, _, _, _, _, _ = idx, newCell, oldCell, ovfl, p, pPage, v2, v3, p1, p4, p5 + *(*int32)(unsafe.Pointer(bp + 4)) = seekResult /* -1: before desired location +1: after */ + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + p = (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree + newCell = uintptr(0) + /* Save the positions of any other cursors open on this table. + ** + ** In some cases, the call to btreeMoveto() below is a no-op. For + ** example, when inserting data into a table with auto-generated integer + ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the + ** integer key to use. It then calls this function to actually insert the + ** data into the intkey B-Tree. In this case btreeMoveto() recognizes + ** that the cursor is already where it needs to be and returns without + ** doing any work. To avoid thwarting these optimizations, it is important + ** not to clear the cursor here. + */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_Multiple) != 0 { + *(*int32)(unsafe.Pointer(bp)) = _saveAllCursors(tls, (*TBtree)(unsafe.Pointer(p)).FpBt, (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, pCur) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 && int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) < 0 { + /* This can only happen if the schema is corrupt such that there is more + ** than one table or index with the same root page as used by the cursor. + ** Which can only happen if the SQLITE_NoSchemaError flag was set when + ** the schema was loaded. This cannot be asserted though, as a user might + ** set the flag, load the schema, and then unset the flag. */ + return _sqlite3CorruptError(tls, int32(79471)) + } + } + /* Ensure that the cursor is not in the CURSOR_FAULT state and that it + ** points to a valid cell. + */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + *(*int32)(unsafe.Pointer(bp)) = _moveToRoot(tls, pCur) + if *(*int32)(unsafe.Pointer(bp)) != 0 && *(*int32)(unsafe.Pointer(bp)) != int32(SQLITE_EMPTY) { + return *(*int32)(unsafe.Pointer(bp)) + } + } + /* Assert that the caller has been consistent. If this cursor was opened + ** expecting an index b-tree, then the caller should be inserting blob + ** keys with no associated data. If the cursor was opened expecting an + ** intkey table, the caller should be inserting integer keys with a + ** blob of associated data. */ + if (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0) { + /* If this is an insert into a table b-tree, invalidate any incrblob + ** cursors open on the row being replaced */ + if (*TBtree)(unsafe.Pointer(p)).FhasIncrblobCur != 0 { + _invalidateIncrblobCursors(tls, p, (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, (*TBtreePayload)(unsafe.Pointer(pX)).FnKey, 0) + } + /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing + ** to a row with the same key as the new entry being inserted. + */ + /* On the other hand, BTREE_SAVEPOSITION==0 does not imply + ** that the cursor is not pointing to a row to be overwritten. + ** So do a complete check. + */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_ValidNKey) != 0 && (*TBtreePayload)(unsafe.Pointer(pX)).FnKey == (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey { + /* The cursor is pointing to the entry that is to be + ** overwritten */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize) != 0 && (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload == uint32((*TBtreePayload)(unsafe.Pointer(pX)).FnData)+uint32((*TBtreePayload)(unsafe.Pointer(pX)).FnZero) { + /* New entry is the same size as the old. Do an overwrite */ + return _btreeOverwriteCell(tls, pCur, pX) + } + } else { + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + /* The cursor is *not* pointing to the cell to be overwritten, nor + ** to an adjacent cell. Move the cursor so that it is pointing either + ** to the cell to be overwritten or an adjacent cell. + */ + *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeTableMoveto(tls, pCur, (*TBtreePayload)(unsafe.Pointer(pX)).FnKey, libc.BoolInt32(flags&int32(BTREE_APPEND) != 0), bp+4) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + } + } else { + /* This is an index or a WITHOUT ROWID table */ + /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing + ** to a row with the same key as the new entry being inserted. + */ + /* If the cursor is not already pointing either to the cell to be + ** overwritten, or if a new cell is being inserted, if the cursor is + ** not pointing to an immediately adjacent cell, then move the cursor + ** so that it does. + */ + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 && flags&int32(BTREE_SAVEPOSITION) == 0 { + if (*TBtreePayload)(unsafe.Pointer(pX)).FnMem != 0 { + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 16))).FpKeyInfo = (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 16))).FaMem = (*TBtreePayload)(unsafe.Pointer(pX)).FaMem + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 16))).FnField = (*TBtreePayload)(unsafe.Pointer(pX)).FnMem + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 16))).Fdefault_rc = 0 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 16))).FeqSeen = uint8(0) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeIndexMoveto(tls, pCur, bp+16, bp+4) + } else { + *(*int32)(unsafe.Pointer(bp)) = _btreeMoveto(tls, pCur, (*TBtreePayload)(unsafe.Pointer(pX)).FpKey, (*TBtreePayload)(unsafe.Pointer(pX)).FnKey, libc.BoolInt32(flags&int32(BTREE_APPEND) != 0), bp+4) + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + /* If the cursor is currently pointing to an entry to be overwritten + ** and the new content is the same as as the old, then use the + ** overwrite optimization. + */ + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + _getCellInfo(tls, pCur) + if (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == (*TBtreePayload)(unsafe.Pointer(pX)).FnKey { + (*(*TBtreePayload)(unsafe.Pointer(bp + 56))).FpData = (*TBtreePayload)(unsafe.Pointer(pX)).FpKey + (*(*TBtreePayload)(unsafe.Pointer(bp + 56))).FnData = int32((*TBtreePayload)(unsafe.Pointer(pX)).FnKey) + (*(*TBtreePayload)(unsafe.Pointer(bp + 56))).FnZero = 0 + return _btreeOverwriteCell(tls, pCur, bp+56) + } + } + } + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) > int32(CURSOR_INVALID) { + /* ^^^^^--- due to the moveToRoot() call above */ + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(79594)) + } else { + *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pPage) + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + newCell = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpTmpSpace + if flags&int32(BTREE_PREFORMAT) != 0 { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 8)) = (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnPreformatSize + if *(*int32)(unsafe.Pointer(bp + 8)) < int32(4) { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(4) + *(*uint8)(unsafe.Pointer(newCell + 3)) = uint8(0) + } + if (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0 && *(*int32)(unsafe.Pointer(bp + 8)) > int32((*TMemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, newCell, bp+104) + if (*(*TCellInfo)(unsafe.Pointer(bp + 104))).FnPayload != uint32((*(*TCellInfo)(unsafe.Pointer(bp + 104))).FnLocal) { + ovfl = _sqlite3Get4byte(tls, newCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))-int32(4))) + _ptrmapPut(tls, (*TBtree)(unsafe.Pointer(p)).FpBt, ovfl, uint8(PTRMAP_OVERFLOW1), (*TMemPage)(unsafe.Pointer(pPage)).Fpgno, bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto end_insert + } + } + } + } else { + *(*int32)(unsafe.Pointer(bp)) = _fillInCell(tls, pPage, newCell, pX, bp+8) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto end_insert + } + } + idx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) + (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = uint16(0) + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + if idx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + return _sqlite3CorruptError(tls, int32(79636)) + } + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto end_insert + } + oldCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*idx)))))) + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + libc.Xmemcpy(tls, newCell, oldCell, uint64(4)) + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, oldCell, bp+128) + if uint32((*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnLocal) != (*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnPayload { + *(*int32)(unsafe.Pointer(bp)) = _clearCellOverflow(tls, pPage, oldCell, bp+128) + } else { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTCF_ValidOvfl)) + if int32((*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnSize) == *(*int32)(unsafe.Pointer(bp + 8)) && uint32((*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnLocal) == (*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnPayload && (!((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FautoVacuum != 0) || *(*int32)(unsafe.Pointer(bp + 8)) < int32((*TMemPage)(unsafe.Pointer(pPage)).FminLocal)) { + /* Overwrite the old cell with the new if they are the same size. + ** We could also try to do this if the old cell is smaller, then add + ** the leftover space to the free list. But experiments show that + ** doing that is no faster then skipping this optimization and just + ** calling dropCell() and insertCell(). + ** + ** This optimization cannot be used on an autovacuum database if the + ** new entry uses overflow pages, as the insertCell() call below is + ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ + /* clearCell never fails when nLocal==nPayload */ + if oldCell < (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+uintptr(10) { + return _sqlite3CorruptError(tls, int32(79663)) + } + if oldCell+uintptr(*(*int32)(unsafe.Pointer(bp + 8))) > (*TMemPage)(unsafe.Pointer(pPage)).FaDataEnd { + return _sqlite3CorruptError(tls, int32(79666)) + } + libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 8)))) + return SQLITE_OK + } + _dropCell(tls, pPage, idx, int32((*(*TCellInfo)(unsafe.Pointer(bp + 128))).FnSize), bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto end_insert + } + } else { + if *(*int32)(unsafe.Pointer(bp + 4)) < 0 && int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) > 0 { + v3 = pCur + 86 + *(*Tu16)(unsafe.Pointer(v3))++ + v2 = *(*Tu16)(unsafe.Pointer(v3)) + idx = int32(v2) + p4 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + } else { + } + } + *(*int32)(unsafe.Pointer(bp)) = _insertCellFast(tls, pPage, idx, newCell, *(*int32)(unsafe.Pointer(bp + 8))) + /* If no error has occurred and pPage has an overflow cell, call balance() + ** to redistribute the cells within the tree. Since balance() may move + ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey + ** variables. + ** + ** Previous versions of SQLite called moveToRoot() to move the cursor + ** back to the root page as balance() used to invalidate the contents + ** of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that, + ** set the cursor state to "invalid". This makes common insert operations + ** slightly faster. + ** + ** There is a subtle but important optimization here too. When inserting + ** multiple records into an intkey b-tree using a single cursor (as can + ** happen while processing an "INSERT INTO ... SELECT" statement), it + ** is advantageous to leave the cursor pointing to the last entry in + ** the b-tree if possible. If the cursor is left pointing to the last + ** entry in the table, and the next row inserted has an integer key + ** larger than the largest existing key, it is possible to insert the + ** row without seeking the cursor. This can be a big performance boost. + */ + if (*TMemPage)(unsafe.Pointer(pPage)).FnOverflow != 0 { + p5 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p5)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p5))) & ^(libc.Int32FromInt32(BTCF_ValidNKey) | libc.Int32FromInt32(BTCF_ValidOvfl))) + *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) + /* Must make sure nOverflow is reset to zero even if the balance() + ** fails. Internal data structure corruption will result otherwise. + ** Also, set the cursor state to invalid. This stops saveCursorPosition() + ** from trying to save the current position of the cursor. */ + (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnOverflow = uint8(0) + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_INVALID) + if flags&int32(BTREE_SAVEPOSITION) != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + _btreeReleaseAllCursorPages(tls, pCur) + if (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo != 0 { + (*TBtCursor)(unsafe.Pointer(pCur)).FpKey = _sqlite3Malloc(tls, uint64((*TBtreePayload)(unsafe.Pointer(pX)).FnKey)) + if (*TBtCursor)(unsafe.Pointer(pCur)).FpKey == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpKey, (*TBtreePayload)(unsafe.Pointer(pX)).FpKey, uint64((*TBtreePayload)(unsafe.Pointer(pX)).FnKey)) + } + } + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_REQUIRESEEK) + (*TBtCursor)(unsafe.Pointer(pCur)).FnKey = (*TBtreePayload)(unsafe.Pointer(pX)).FnKey + } + } +end_insert: + ; + return *(*int32)(unsafe.Pointer(bp)) + return r +} + +// C documentation +// +// /* +// ** This function is used as part of copying the current row from cursor +// ** pSrc into cursor pDest. If the cursors are open on intkey tables, then +// ** parameter iKey is used as the rowid value when the record is copied +// ** into pDest. Otherwise, the record is copied verbatim. +// ** +// ** This function does not actually write the new value to cursor pDest. +// ** Instead, it creates and populates any required overflow pages and +// ** writes the data for the new cell into the BtShared.pTmpSpace buffer +// ** for the destination database. The size of the cell, in bytes, is left +// ** in BtShared.nPreformatSize. The caller completes the insertion by +// ** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _sqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey Ti64) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aIn, aOut, pBt, pPageOut, pPgnoOut, pSrcPager, v1 uintptr + var nCopy int32 + var nIn, nOut, nRem Tu32 + var ovflIn TPgno + var v2, v3 uint32 + var _ /* pNew at bp+24 */ uintptr + var _ /* pPageIn at bp+8 */ uintptr + var _ /* pgnoNew at bp+16 */ TPgno + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aIn, aOut, nCopy, nIn, nOut, nRem, ovflIn, pBt, pPageOut, pPgnoOut, pSrcPager, v1, v2, v3 + pBt = (*TBtCursor)(unsafe.Pointer(pDest)).FpBt + aOut = (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace /* Bytes of data still to copy */ + _getCellInfo(tls, pSrc) + if (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload < uint32(0x80) { + v1 = aOut + aOut++ + *(*Tu8)(unsafe.Pointer(v1)) = uint8((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload) + } else { + aOut += uintptr(_sqlite3PutVarint(tls, aOut, uint64((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload))) + } + if (*TBtCursor)(unsafe.Pointer(pDest)).FpKeyInfo == uintptr(0) { + aOut += uintptr(_sqlite3PutVarint(tls, aOut, uint64(iKey))) + } + nIn = uint32((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) + aIn = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload + if aIn+uintptr(nIn) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { + return _sqlite3CorruptError(tls, int32(79768)) + } + nRem = (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload + if nIn == nRem && nIn < uint32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal) { + libc.Xmemcpy(tls, aOut, aIn, uint64(nIn)) + (*TBtShared)(unsafe.Pointer(pBt)).FnPreformatSize = int32(int64(nIn) + (int64(aOut) - int64((*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace))) + return SQLITE_OK + } else { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + pSrcPager = (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpBt)).FpPager + pPgnoOut = uintptr(0) + ovflIn = uint32(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + pPageOut = uintptr(0) /* Size of output buffer aOut[] */ + nOut = uint32(_btreePayloadToLocal(tls, (*TBtCursor)(unsafe.Pointer(pDest)).FpPage, int64((*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload))) + (*TBtShared)(unsafe.Pointer(pBt)).FnPreformatSize = int32(int64(nOut) + (int64(aOut) - int64((*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace))) + if nOut < (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload { + pPgnoOut = aOut + uintptr(nOut) + *(*int32)(unsafe.Pointer(pBt + 144)) += int32(4) + } + if nRem > nIn { + if aIn+uintptr(nIn)+uintptr(4) > (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { + return _sqlite3CorruptError(tls, int32(79793)) + } + ovflIn = _sqlite3Get4byte(tls, (*TBtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload+uintptr(nIn)) + } + for cond := true; cond; cond = nRem > uint32(0) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + nRem -= nOut + for cond := true; cond; cond = *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nOut > uint32(0) { + if nIn > uint32(0) { + if nOut < nIn { + v2 = nOut + } else { + v2 = nIn + } + nCopy = int32(v2) + libc.Xmemcpy(tls, aOut, aIn, uint64(nCopy)) + nOut -= uint32(nCopy) + nIn -= uint32(nCopy) + aOut += uintptr(nCopy) + aIn += uintptr(nCopy) + } + if nOut > uint32(0) { + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerGet(tls, pSrcPager, ovflIn, bp+8, int32(PAGER_GET_READONLY)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + aIn = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + ovflIn = _sqlite3Get4byte(tls, aIn) + aIn += uintptr(4) + nIn = (*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pSrc)).FpBt)).FusableSize - uint32(4) + } + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nRem > uint32(0) && pPgnoOut != 0 { + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = _allocateBtreePage(tls, pBt, bp+24, bp+16, uint32(0), uint8(0)) + _sqlite3Put4byte(tls, pPgnoOut, *(*TPgno)(unsafe.Pointer(bp + 16))) + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 && pPageOut != 0 { + _ptrmapPut(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16)), uint8(PTRMAP_OVERFLOW2), (*TMemPage)(unsafe.Pointer(pPageOut)).Fpgno, bp) + } + _releasePage(tls, pPageOut) + pPageOut = *(*uintptr)(unsafe.Pointer(bp + 24)) + if pPageOut != 0 { + pPgnoOut = (*TMemPage)(unsafe.Pointer(pPageOut)).FaData + _sqlite3Put4byte(tls, pPgnoOut, uint32(0)) + aOut = pPgnoOut + 4 + if (*TBtShared)(unsafe.Pointer(pBt)).FusableSize-uint32(4) < nRem { + v3 = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize - uint32(4) + } else { + v3 = nRem + } + nOut = v3 + } + } + } + _releasePage(tls, pPageOut) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + return *(*int32)(unsafe.Pointer(bp)) + } + return r +} + +// C documentation +// +// /* +// ** Delete the entry that the cursor is pointing to. +// ** +// ** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then +// ** the cursor is left pointing at an arbitrary location after the delete. +// ** But if that bit is set, then the cursor is left in a state such that +// ** the next call to BtreeNext() or BtreePrev() moves it to the same row +// ** as it would have been on if the call to BtreeDelete() had been omitted. +// ** +// ** The BTREE_AUXDELETE bit of flags indicates that is one of several deletes +// ** associated with a single table entry and its indexes. Only one of those +// ** deletes is considered the "primary" delete. The primary delete occurs +// ** on a cursor that is not a BTREE_FORDELETE cursor. All but one delete +// ** operation on non-FORDELETE cursors is tagged with the AUXDELETE flag. +// ** The BTREE_AUXDELETE bit is a hint that is not used by this implementation, +// ** but which might be used by alternative storage engines. +// */ +func _sqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags Tu8) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bPreserve Tu8 + var iCellDepth, iCellIdx, nCell int32 + var n TPgno + var p, pBt, pCell, pLeaf, pPage, pTmp, v2 uintptr + var v1 Ti8 + var _ /* info at bp+8 */ TCellInfo + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = bPreserve, iCellDepth, iCellIdx, n, nCell, p, pBt, pCell, pLeaf, pPage, pTmp, v1, v2 + p = (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) >= int32(CURSOR_REQUIRESEEK) { + *(*int32)(unsafe.Pointer(bp)) = _btreeRestoreCursorPosition(tls, pCur) + if *(*int32)(unsafe.Pointer(bp)) != 0 || int32((*TBtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + return *(*int32)(unsafe.Pointer(bp)) + } + } else { + return _sqlite3CorruptError(tls, int32(79889)) + } + } + iCellDepth = int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) + iCellIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) <= iCellIdx { + return _sqlite3CorruptError(tls, int32(79898)) + } + pCell = (*TMemPage)(unsafe.Pointer(pPage)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iCellIdx)))))) + if (*TMemPage)(unsafe.Pointer(pPage)).FnFree < 0 && _btreeComputeFreeSpace(tls, pPage) != 0 { + return _sqlite3CorruptError(tls, int32(79902)) + } + if pCell < (*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx+uintptr((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + return _sqlite3CorruptError(tls, int32(79905)) + } + /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must + ** be preserved following this delete operation. If the current delete + ** will cause a b-tree rebalance, then this is done by saving the cursor + ** key and leaving the cursor in CURSOR_REQUIRESEEK state before + ** returning. + ** + ** If the current delete will not cause a rebalance, then the cursor + ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately + ** before or after the deleted entry. + ** + ** The bPreserve value records which path is required: + ** + ** bPreserve==0 Not necessary to save the cursor position + ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position + ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT. + */ + bPreserve = libc.BoolUint8(int32(flags)&int32(BTREE_SAVEPOSITION) != 0) + if bPreserve != 0 { + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) || (*TMemPage)(unsafe.Pointer(pPage)).FnFree+int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxCellSize})))(tls, pPage, pCell))+int32(2) > int32((*TBtShared)(unsafe.Pointer(pBt)).FusableSize*libc.Uint32FromInt32(2)/libc.Uint32FromInt32(3)) || int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) == int32(1) { + /* A b-tree rebalance will be required after deleting this entry. + ** Save the cursor key. */ + *(*int32)(unsafe.Pointer(bp)) = _saveCursorKey(tls, pCur) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } else { + bPreserve = uint8(2) + } + } + /* If the page containing the entry to delete is not a leaf page, move + ** the cursor to the largest entry in the tree that is smaller than + ** the entry being deleted. This cell will replace the cell being deleted + ** from the internal node. The 'previous' entry is used for this instead + ** of the 'next' entry, as the previous entry is always a part of the + ** sub-tree headed by the child page of the cell being deleted. This makes + ** balancing the tree following the delete operation easier. */ + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreePrevious(tls, pCur, 0) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + /* Save the positions of any other cursors open on this table before + ** making any modifications. */ + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FcurFlags)&int32(BTCF_Multiple) != 0 { + *(*int32)(unsafe.Pointer(bp)) = _saveAllCursors(tls, pBt, (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, pCur) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + /* If this is a delete operation to remove a row from a table b-tree, + ** invalidate any incrblob cursors open on the row being deleted. */ + if (*TBtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0) && (*TBtree)(unsafe.Pointer(p)).FhasIncrblobCur != 0 { + _invalidateIncrblobCursors(tls, p, (*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, (*TBtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey, 0) + } + /* Make the page containing the entry to be deleted writable. Then free any + ** overflow pages associated with the entry and finally remove the cell + ** itself from within the page. */ + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pPage)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pPage)).FxParseCell})))(tls, pPage, pCell, bp+8) + if uint32((*(*TCellInfo)(unsafe.Pointer(bp + 8))).FnLocal) != (*(*TCellInfo)(unsafe.Pointer(bp + 8))).FnPayload { + *(*int32)(unsafe.Pointer(bp)) = _clearCellOverflow(tls, pPage, pCell, bp+8) + } else { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + _dropCell(tls, pPage, iCellIdx, int32((*(*TCellInfo)(unsafe.Pointer(bp + 8))).FnSize), bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + /* If the cell deleted was not located on a leaf page, then the cursor + ** is currently pointing to the largest entry in the sub-tree headed + ** by the child-page of the cell that was just deleted from an internal + ** node. The cell from the leaf node needs to be moved to the internal + ** node to replace the deleted cell. */ + if !((*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + pLeaf = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if (*TMemPage)(unsafe.Pointer(pLeaf)).FnFree < 0 { + *(*int32)(unsafe.Pointer(bp)) = _btreeComputeFreeSpace(tls, pLeaf) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + if iCellDepth < int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)-int32(1) { + n = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(iCellDepth+int32(1))*8)))).Fpgno + } else { + n = (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).Fpgno + } + pCell = (*TMemPage)(unsafe.Pointer(pLeaf)).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pLeaf)).FaCellIdx + uintptr(int32(2)*(int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1)))))))) + if pCell < (*TMemPage)(unsafe.Pointer(pLeaf)).FaData+4 { + return _sqlite3CorruptError(tls, int32(79996)) + } + nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(pLeaf)).FxCellSize})))(tls, pLeaf, pCell)) + pTmp = (*TBtShared)(unsafe.Pointer(pBt)).FpTmpSpace + *(*int32)(unsafe.Pointer(bp)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(pLeaf)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _insertCell(tls, pPage, iCellIdx, pCell-uintptr(4), nCell+int32(4), pTmp, n) + } + _dropCell(tls, pLeaf, int32((*TMemPage)(unsafe.Pointer(pLeaf)).FnCell)-int32(1), nCell, bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + /* Balance the tree. If the entry deleted was located on a leaf page, + ** then the cursor still points to that page. In this case the first + ** call to balance() repairs the tree, and the if(...) condition is + ** never true. + ** + ** Otherwise, if the entry deleted was on an internal node page, then + ** pCur is pointing to the leaf page from which a cell was removed to + ** replace the cell deleted from the internal node. This is slightly + ** tricky as the leaf node may be underfull, and the internal node may + ** be either under or overfull. In this case run the balancing algorithm + ** on the leaf node first. If the balance proceeds far enough up the + ** tree that we can be sure that any problem in the internal node has + ** been corrected, so be it. Otherwise, after balancing the leaf node, + ** walk the cursor up the tree to the internal node and balance it as + ** well. */ + if (*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnFree*int32(3) <= int32((*TBtShared)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize)*int32(2) { + /* Optimization: If the free space is less than 2/3rds of the page, + ** then balance() will always be a no-op. No need to invoke it. */ + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } else { + *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) > iCellDepth { + _releasePageNotNull(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpPage) + (*TBtCursor)(unsafe.Pointer(pCur)).FiPage-- + for int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) > iCellDepth { + v2 = pCur + 84 + v1 = *(*Ti8)(unsafe.Pointer(v2)) + *(*Ti8)(unsafe.Pointer(v2))-- + _releasePage(tls, *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr(v1)*8))) + } + (*TBtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer(pCur + 144 + uintptr((*TBtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) + *(*int32)(unsafe.Pointer(bp)) = _balance(tls, pCur) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if int32(bPreserve) > int32(1) { + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_SKIPNEXT) + if iCellIdx >= int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext = -int32(1) + (*TBtCursor)(unsafe.Pointer(pCur)).Fix = uint16(int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) - int32(1)) + } else { + (*TBtCursor)(unsafe.Pointer(pCur)).FskipNext = int32(1) + } + } else { + *(*int32)(unsafe.Pointer(bp)) = _moveToRoot(tls, pCur) + if bPreserve != 0 { + _btreeReleaseAllCursorPages(tls, pCur) + (*TBtCursor)(unsafe.Pointer(pCur)).FeState = uint8(CURSOR_REQUIRESEEK) + } + if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_EMPTY) { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Create a new BTree table. Write into *piTable the page +// ** number for the root page of the new table. +// ** +// ** The type of type is determined by the flags parameter. Only the +// ** following values of flags are currently in use. Other values for +// ** flags might not work: +// ** +// ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys +// ** BTREE_ZERODATA Used for SQL indices +// */ +func _btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var pBt uintptr + var ptfFlags int32 + var _ /* eType at bp+32 */ Tu8 + var _ /* iPtrPage at bp+36 */ TPgno + var _ /* pPageMove at bp+24 */ uintptr + var _ /* pRoot at bp+0 */ uintptr + var _ /* pgnoMove at bp+16 */ TPgno + var _ /* pgnoRoot at bp+8 */ TPgno + var _ /* rc at bp+12 */ int32 + _, _ = pBt, ptfFlags + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt /* Page-type flags for the root page of new table */ + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { /* The page to move to. */ + /* Creating a new table may probably require moving an existing database + ** to make room for the new tables root page. In case this page turns + ** out to be an overflow page, delete all overflow page-map caches + ** held by open cursors. + */ + _invalidateAllOverflowCache(tls, pBt) + /* Read the value of meta[3] from the database to determine where the + ** root page of the new table should go. meta[3] is the largest root-page + ** created so far, so the new root-page is (meta[3]+1). + */ + _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+8) + if *(*TPgno)(unsafe.Pointer(bp + 8)) > _btreePagecount(tls, pBt) { + return _sqlite3CorruptError(tls, int32(80112)) + } + *(*TPgno)(unsafe.Pointer(bp + 8))++ + /* The new root-page may not be allocated on a pointer-map page, or the + ** PENDING_BYTE page. + */ + for *(*TPgno)(unsafe.Pointer(bp + 8)) == _ptrmapPageno(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8))) || *(*TPgno)(unsafe.Pointer(bp + 8)) == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) { + *(*TPgno)(unsafe.Pointer(bp + 8))++ + } + /* Allocate a page. The page that currently resides at pgnoRoot will + ** be moved to the allocated page (unless the allocated page happens + ** to reside at pgnoRoot). + */ + *(*int32)(unsafe.Pointer(bp + 12)) = _allocateBtreePage(tls, pBt, bp+24, bp+16, *(*TPgno)(unsafe.Pointer(bp + 8)), uint8(BTALLOC_EXACT)) + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + if *(*TPgno)(unsafe.Pointer(bp + 16)) != *(*TPgno)(unsafe.Pointer(bp + 8)) { + /* pgnoRoot is the page that will be used for the root-page of + ** the new table (assuming an error did not occur). But we were + ** allocated pgnoMove. If required (i.e. if it was not allocated + ** by extending the file), the current page at position pgnoMove + ** is already journaled. + */ + *(*Tu8)(unsafe.Pointer(bp + 32)) = uint8(0) + *(*TPgno)(unsafe.Pointer(bp + 36)) = uint32(0) + /* Save the positions of any open cursors. This is required in + ** case they are holding a reference to an xFetch reference + ** corresponding to page pgnoRoot. */ + *(*int32)(unsafe.Pointer(bp + 12)) = _saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + /* Move the page currently at pgnoRoot to pgnoMove. */ + *(*int32)(unsafe.Pointer(bp + 12)) = _btreeGetPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp, 0) + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + *(*int32)(unsafe.Pointer(bp + 12)) = _ptrmapGet(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp+32, bp+36) + if int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_ROOTPAGE) || int32(*(*Tu8)(unsafe.Pointer(bp + 32))) == int32(PTRMAP_FREEPAGE) { + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3CorruptError(tls, int32(80160)) + } + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 12)) + } + *(*int32)(unsafe.Pointer(bp + 12)) = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp)), *(*Tu8)(unsafe.Pointer(bp + 32)), *(*TPgno)(unsafe.Pointer(bp + 36)), *(*TPgno)(unsafe.Pointer(bp + 16)), 0) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + /* Obtain the page at pgnoRoot */ + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + *(*int32)(unsafe.Pointer(bp + 12)) = _btreeGetPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), bp, 0) + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 12)) != SQLITE_OK { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 12)) + } + } else { + *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 24)) + } + /* Update the pointer-map and meta-data with the new root-page number. */ + _ptrmapPut(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 8)), uint8(PTRMAP_ROOTPAGE), uint32(0), bp+12) + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 12)) + } + /* When the new root page was allocated, page 1 was made writable in + ** order either to increase the database filesize, or to decrement the + ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. + */ + *(*int32)(unsafe.Pointer(bp + 12)) = _sqlite3BtreeUpdateMeta(tls, p, int32(4), *(*TPgno)(unsafe.Pointer(bp + 8))) + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 12)) + } + } else { + *(*int32)(unsafe.Pointer(bp + 12)) = _allocateBtreePage(tls, pBt, bp, bp+8, uint32(1), uint8(0)) + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 12)) + } + } + if createTabFlags&int32(BTREE_INTKEY) != 0 { + ptfFlags = libc.Int32FromInt32(PTF_INTKEY) | libc.Int32FromInt32(PTF_LEAFDATA) | libc.Int32FromInt32(PTF_LEAF) + } else { + ptfFlags = libc.Int32FromInt32(PTF_ZERODATA) | libc.Int32FromInt32(PTF_LEAF) + } + _zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp)), ptfFlags) + _sqlite3PagerUnref(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + *(*TPgno)(unsafe.Pointer(piTable)) = *(*TPgno)(unsafe.Pointer(bp + 8)) + return SQLITE_OK +} + +func _sqlite3BtreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, flags int32) (r int32) { + var rc int32 + _ = rc + _sqlite3BtreeEnter(tls, p) + rc = _btreeCreateTable(tls, p, piTable, flags) + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Erase the given database page and all its children. Return +// ** the page to the freelist. +// */ +func _clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno TPgno, freePageFlag int32, pnChange uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var hdr, i, v2 int32 + var pCell uintptr + var _ /* info at bp+16 */ TCellInfo + var _ /* pPage at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _, _, _ = hdr, i, pCell, v2 + if pgno > _btreePagecount(tls, pBt) { + return _sqlite3CorruptError(tls, int32(80250)) + } + *(*int32)(unsafe.Pointer(bp + 8)) = _getAndInitPage(tls, pBt, pgno, bp, 0) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 8)) + } + if int32((*TBtShared)(unsafe.Pointer(pBt)).FopenFlags)&int32(BTREE_SINGLE) == 0 && _sqlite3PagerPageRefcount(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) != int32(1)+libc.BoolInt32(pgno == uint32(1)) { + *(*int32)(unsafe.Pointer(bp + 8)) = _sqlite3CorruptError(tls, int32(80257)) + goto cleardatabasepage_out + } + hdr = int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FhdrOffset) + i = 0 + for { + if !(i < int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnCell)) { + break + } + pCell = (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData + uintptr(int32((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaCellIdx + uintptr(int32(2)*i)))))) + if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { + *(*int32)(unsafe.Pointer(bp + 8)) = _clearDatabasePage(tls, pBt, _sqlite3Get4byte(tls, pCell), int32(1), pnChange) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + goto cleardatabasepage_out + } + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp)), pCell, bp+16) + if uint32((*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnLocal) != (*(*TCellInfo)(unsafe.Pointer(bp + 16))).FnPayload { + *(*int32)(unsafe.Pointer(bp + 8)) = _clearCellOverflow(tls, *(*uintptr)(unsafe.Pointer(bp)), pCell, bp+16) + } else { + *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK + } + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + goto cleardatabasepage_out + } + goto _1 + _1: + ; + i++ + } + if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fleaf != 0) { + *(*int32)(unsafe.Pointer(bp + 8)) = _clearDatabasePage(tls, pBt, _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData+uintptr(hdr+int32(8))), int32(1), pnChange) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + goto cleardatabasepage_out + } + if (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FintKey != 0 { + pnChange = uintptr(0) + } + } + if pnChange != 0 { + *(*Ti64)(unsafe.Pointer(pnChange)) += int64((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnCell) + } + if freePageFlag != 0 { + _freePage(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + } else { + v2 = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpDbPage) + *(*int32)(unsafe.Pointer(bp + 8)) = v2 + if v2 == 0 { + _zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(*(*Tu8)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaData + uintptr(hdr))))|int32(PTF_LEAF)) + } + } +cleardatabasepage_out: + ; + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp))) + return *(*int32)(unsafe.Pointer(bp + 8)) +} + +// C documentation +// +// /* +// ** Delete all information from a single table in the database. iTable is +// ** the page number of the root of the table. After this routine returns, +// ** the root page is empty, but still exists. +// ** +// ** This routine will fail with SQLITE_LOCKED if there are any open +// ** read cursors on the table. Open write cursors are moved to the +// ** root of the table. +// ** +// ** If pnChange is not NULL, then the integer value pointed to by pnChange +// ** is incremented by the number of entries in the table. +// */ +func _sqlite3BtreeClearTable(tls *libc.TLS, p uintptr, iTable int32, pnChange uintptr) (r int32) { + var pBt uintptr + var rc int32 + _, _ = pBt, rc + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + rc = _saveAllCursors(tls, pBt, uint32(iTable), uintptr(0)) + if SQLITE_OK == rc { + /* Invalidate all incrblob cursors open on table iTable (assuming iTable + ** is the root of a table b-tree - if it is not, the following call is + ** a no-op). */ + if (*TBtree)(unsafe.Pointer(p)).FhasIncrblobCur != 0 { + _invalidateIncrblobCursors(tls, p, uint32(iTable), 0, int32(1)) + } + rc = _clearDatabasePage(tls, pBt, uint32(iTable), 0, pnChange) + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** Delete all information from the single table that pCur is open on. +// ** +// ** This routine only work for pCur on an ephemeral table. +// */ +func _sqlite3BtreeClearTableOfCursor(tls *libc.TLS, pCur uintptr) (r int32) { + return _sqlite3BtreeClearTable(tls, (*TBtCursor)(unsafe.Pointer(pCur)).FpBtree, int32((*TBtCursor)(unsafe.Pointer(pCur)).FpgnoRoot), uintptr(0)) +} + +// C documentation +// +// /* +// ** Erase all information in a table and add the root of the table to +// ** the freelist. Except, the root of the principle table (the one on +// ** page 1) is never added to the freelist. +// ** +// ** This routine will fail with SQLITE_LOCKED if there are any open +// ** cursors on the table. +// ** +// ** If AUTOVACUUM is enabled and the page at iTable is not the last +// ** root page in the database file, then the last root page +// ** in the database file is moved into the slot formerly occupied by +// ** iTable and that last slot formerly occupied by the last root page +// ** is added to the freelist instead of iTable. In this say, all +// ** root pages are kept at the beginning of the database file, which +// ** is necessary for AUTOVACUUM to work right. *piMoved is set to the +// ** page number that used to be the last root page in the file before +// ** the move. If no page gets moved, *piMoved is set to 0. +// ** The last root page is recorded in meta[3] and the value of +// ** meta[3] is updated by this procedure. +// */ +func _btreeDropTable(tls *libc.TLS, p uintptr, iTable TPgno, piMoved uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pBt uintptr + var _ /* maxRootPgno at bp+16 */ TPgno + var _ /* pMove at bp+24 */ uintptr + var _ /* pPage at bp+8 */ uintptr + var _ /* rc at bp+0 */ int32 + _ = pBt + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + if iTable > _btreePagecount(tls, pBt) { + return _sqlite3CorruptError(tls, int32(80361)) + } + *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + *(*int32)(unsafe.Pointer(bp)) = _btreeGetPage(tls, pBt, iTable, bp+8, 0) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + return *(*int32)(unsafe.Pointer(bp)) + } + *(*int32)(unsafe.Pointer(piMoved)) = 0 + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _sqlite3BtreeGetMeta(tls, p, int32(BTREE_LARGEST_ROOT_PAGE), bp+16) + if iTable == *(*TPgno)(unsafe.Pointer(bp + 16)) { + /* If the table being dropped is the table with the largest root-page + ** number in the database, put the root page on the free list. + */ + _freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp)) + } + } else { + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + *(*int32)(unsafe.Pointer(bp)) = _btreeGetPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16)), bp+24, 0) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp)) + } + *(*int32)(unsafe.Pointer(bp)) = _relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 24)), uint8(PTRMAP_ROOTPAGE), uint32(0), iTable, 0) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp)) + } + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = _btreeGetPage(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16)), bp+24, 0) + _freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24)), bp) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp)) + } + *(*int32)(unsafe.Pointer(piMoved)) = int32(*(*TPgno)(unsafe.Pointer(bp + 16))) + } + /* Set the new 'max-root-page' value in the database header. This + ** is the old value less one, less one more if that happens to + ** be a root-page number, less one again if that is the + ** PENDING_BYTE_PAGE. + */ + *(*TPgno)(unsafe.Pointer(bp + 16))-- + for *(*TPgno)(unsafe.Pointer(bp + 16)) == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize+libc.Uint32FromInt32(1) || _ptrmapPageno(tls, pBt, *(*TPgno)(unsafe.Pointer(bp + 16))) == *(*TPgno)(unsafe.Pointer(bp + 16)) { + *(*TPgno)(unsafe.Pointer(bp + 16))-- + } + *(*int32)(unsafe.Pointer(bp)) = _sqlite3BtreeUpdateMeta(tls, p, int32(4), *(*TPgno)(unsafe.Pointer(bp + 16))) + } else { + _freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +func _sqlite3BtreeDropTable(tls *libc.TLS, p uintptr, iTable int32, piMoved uintptr) (r int32) { + var rc int32 + _ = rc + _sqlite3BtreeEnter(tls, p) + rc = _btreeDropTable(tls, p, uint32(iTable), piMoved) + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** This function may only be called if the b-tree connection already +// ** has a read or write transaction open on the database. +// ** +// ** Read the meta-information out of a database file. Meta[0] +// ** is the number of free pages currently in the database. Meta[1] +// ** through meta[15] are available for use by higher layers. Meta[0] +// ** is read-only, the others are read/write. +// ** +// ** The schema layer numbers meta values differently. At the schema +// ** layer (and the SetCookie and ReadCookie opcodes) the number of +// ** free pages is not visible. So Cookie[0] is the same as Meta[1]. +// ** +// ** This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead +// ** of reading the value out of the header, it instead loads the "DataVersion" +// ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the +// ** database file. It is a number computed by the pager. But its access +// ** pattern is the same as header meta values, and so it is convenient to +// ** read it from this routine. +// */ +func _sqlite3BtreeGetMeta(tls *libc.TLS, p uintptr, idx int32, pMeta uintptr) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + if idx == int32(BTREE_DATA_VERSION) { + *(*Tu32)(unsafe.Pointer(pMeta)) = _sqlite3PagerDataVersion(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + (*TBtree)(unsafe.Pointer(p)).FiBDataVersion + } else { + *(*Tu32)(unsafe.Pointer(pMeta)) = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+uintptr(int32(36)+idx*int32(4))) + } + /* If auto-vacuum is disabled in this build and this is an auto-vacuum + ** database, mark the database as read-only. */ + _sqlite3BtreeLeave(tls, p) +} + +// C documentation +// +// /* +// ** Write meta-information back into the database. Meta[0] is +// ** read-only and may not be written. +// */ +func _sqlite3BtreeUpdateMeta(tls *libc.TLS, p uintptr, idx int32, iMeta Tu32) (r int32) { + var pBt, pP1 uintptr + var rc int32 + _, _, _ = pBt, pP1, rc + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + _sqlite3BtreeEnter(tls, p) + pP1 = (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if rc == SQLITE_OK { + _sqlite3Put4byte(tls, pP1+uintptr(int32(36)+idx*int32(4)), iMeta) + if idx == int32(BTREE_INCR_VACUUM) { + (*TBtShared)(unsafe.Pointer(pBt)).FincrVacuum = uint8(iMeta) + } + } + _sqlite3BtreeLeave(tls, p) + return rc +} + +// C documentation +// +// /* +// ** The first argument, pCur, is a cursor opened on some b-tree. Count the +// ** number of entries in the b-tree and write the result to *pnEntry. +// ** +// ** SQLITE_OK is returned if the operation is successfully executed. +// ** Otherwise, if an error is encountered (i.e. an IO error or database +// ** corruption) an SQLite error code is returned. +// */ +func _sqlite3BtreeCount(tls *libc.TLS, db uintptr, pCur uintptr, pnEntry uintptr) (r int32) { + var iIdx, rc int32 + var nEntry Ti64 + var pPage uintptr + _, _, _, _ = iIdx, nEntry, pPage, rc + nEntry = 0 /* Return code */ + rc = _moveToRoot(tls, pCur) + if rc == int32(SQLITE_EMPTY) { + *(*Ti64)(unsafe.Pointer(pnEntry)) = 0 + return SQLITE_OK + } + /* Unless an error occurs, the following loop runs one iteration for each + ** page in the B-Tree structure (not including overflow pages). + */ + for rc == SQLITE_OK && !(libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) { /* Current page of the b-tree */ + /* If this is a leaf page or the tree is not an int-key tree, then + ** this page contains countable entries. Increment the entry counter + ** accordingly. + */ + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 || !((*TMemPage)(unsafe.Pointer(pPage)).FintKey != 0) { + nEntry += int64((*TMemPage)(unsafe.Pointer(pPage)).FnCell) + } + /* pPage is a leaf node. This loop navigates the cursor so that it + ** points to the first interior cell that it points to the parent of + ** the next page in the tree that has not yet been visited. The + ** pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell + ** of the page, or to the number of cells in the page if the next page + ** to visit is the right-child of its parent. + ** + ** If all pages in the tree have been visited, return SQLITE_OK to the + ** caller. + */ + if (*TMemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + for cond := true; cond; cond = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*TMemPage)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) { + if int32((*TBtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + /* All pages of the b-tree have been visited. Return successfully. */ + *(*Ti64)(unsafe.Pointer(pnEntry)) = nEntry + return _moveToRoot(tls, pCur) + } + _moveToParent(tls, pCur) + } + (*TBtCursor)(unsafe.Pointer(pCur)).Fix++ + pPage = (*TBtCursor)(unsafe.Pointer(pCur)).FpPage + } + /* Descend to the child node of the cell that the cursor currently + ** points at. This is the right-child if (iIdx==pPage->nCell). + */ + iIdx = int32((*TBtCursor)(unsafe.Pointer(pCur)).Fix) + if iIdx == int32((*TMemPage)(unsafe.Pointer(pPage)).FnCell) { + rc = _moveToChild(tls, pCur, _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FhdrOffset)+int32(8)))) + } else { + rc = _moveToChild(tls, pCur, _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer(pPage)).FaData+uintptr(int32((*TMemPage)(unsafe.Pointer(pPage)).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer((*TMemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr(int32(2)*iIdx)))))))) + } + } + /* An error has occurred. Return an error code. */ + return rc +} + +// C documentation +// +// /* +// ** Return the pager associated with a BTree. This routine is used for +// ** testing and debugging only. +// */ +func _sqlite3BtreePager(tls *libc.TLS, p uintptr) (r uintptr) { + return (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FpPager +} + +// C documentation +// +// /* +// ** Record an OOM error during integrity_check +// */ +func _checkOom(tls *libc.TLS, pCheck uintptr) { + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr = 0 /* Causes integrity_check processing to stop */ + if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr == 0 { + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ + } +} + +// C documentation +// +// /* +// ** Invoke the progress handler, if appropriate. Also check for an +// ** interrupt. +// */ +func _checkProgress(tls *libc.TLS, pCheck uintptr) { + var db uintptr + _ = db + db = (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fdb + if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_INTERRUPT) + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr = 0 + } + if (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != 0 { + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnStep++ + if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnStep%(*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps == uint32(0) && (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_INTERRUPT) + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr = 0 + } + } +} + +// C documentation +// +// /* +// ** Append a message to the error message string. +// */ +func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ap Tva_list + _ = ap + _checkProgress(tls, pCheck) + if !((*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { + return + } + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr-- + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ + ap = va + if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { + Xsqlite3_str_append(tls, pCheck+72, __ccgo_ts+4235, int32(1)) + } + if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { + Xsqlite3_str_appendf(tls, pCheck+72, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) + } + Xsqlite3_str_vappendf(tls, pCheck+72, zFormat, ap) + _ = ap + if int32((*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FaccError) == int32(SQLITE_NOMEM) { + _checkOom(tls, pCheck) + } +} + +// C documentation +// +// /* +// ** Return non-zero if the bit in the IntegrityCk.aPgRef[] array that +// ** corresponds to page iPg is already set. +// */ +func _getPageReferenced(tls *libc.TLS, pCheck uintptr, iPg TPgno) (r int32) { + return int32(*(*Tu8)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr(iPg/uint32(8))))) & (int32(1) << (iPg & uint32(0x07))) +} + +// C documentation +// +// /* +// ** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. +// */ +func _setPageReferenced(tls *libc.TLS, pCheck uintptr, iPg TPgno) { + var p1 uintptr + _ = p1 + p1 = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr(iPg/uint32(8)) + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(1)<<(iPg&libc.Uint32FromInt32(0x07))) +} + +// C documentation +// +// /* +// ** Add 1 to the reference count for page iPage. If this is the second +// ** reference to the page, add an error message to pCheck->zErrMsg. +// ** Return 1 if there are 2 or more references to the page and 0 if +// ** if this is the first reference to the page. +// ** +// ** Also check that the page number is in bounds. +// */ +func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4237, libc.VaList(bp+8, iPage)) + return int32(1) + } + if _getPageReferenced(tls, pCheck, iPage) != 0 { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4260, libc.VaList(bp+8, iPage)) + return int32(1) + } + _setPageReferenced(tls, pCheck, iPage) + return 0 +} + +// C documentation +// +// /* +// ** Check that the entry in the pointer-map for page iChild maps to +// ** page iParent, pointer type ptrType. If not, append an error message +// ** to pCheck. +// */ +func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParent TPgno) { + bp := tls.Alloc(64) + defer tls.Free(64) + var rc int32 + var _ /* ePtrmapType at bp+0 */ Tu8 + var _ /* iPtrmapParent at bp+4 */ TPgno + _ = rc + rc = _ptrmapGet(tls, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp, bp+4) + if rc != SQLITE_OK { + if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4390, libc.VaList(bp+16, iPage)) + N-- + } else { + i = 0 + for { + if !(i < int32(n)) { + break + } + iFreePage = _sqlite3Get4byte(tls, pOvflData+uintptr(int32(8)+i*int32(4))) + if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { + _checkPtrmap(tls, pCheck, iFreePage, uint8(PTRMAP_FREEPAGE), uint32(0)) + } + _checkRef(tls, pCheck, iFreePage) + goto _1 + _1: + ; + i++ + } + N -= n + } + } else { + /* If this database supports auto-vacuum and iPage is not the last + ** page in this overflow list, check that the pointer-map entry for + ** the following page matches iPage. + */ + if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 && N > uint32(0) { + i = int32(_sqlite3Get4byte(tls, pOvflData)) + _checkPtrmap(tls, pCheck, uint32(i), uint8(PTRMAP_OVERFLOW2), iPage) + } + } + iPage = _sqlite3Get4byte(tls, pOvflData) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { + if isFreeList != 0 { + v2 = __ccgo_ts + 4429 + } else { + v2 = __ccgo_ts + 4434 + } + _checkAppendMsg(tls, pCheck, __ccgo_ts+4455, libc.VaList(bp+16, v2, expected-N, expected)) + } +} + +// C documentation +// +// /* +// ** An implementation of a min-heap. +// ** +// ** aHeap[0] is the number of elements on the heap. aHeap[1] is the +// ** root element. The daughter nodes of aHeap[N] are aHeap[N*2] +// ** and aHeap[N*2+1]. +// ** +// ** The heap property is this: Every node is less than or equal to both +// ** of its daughter nodes. A consequence of the heap property is that the +// ** root node aHeap[1] is always the minimum value currently in the heap. +// ** +// ** The btreeHeapInsert() routine inserts an unsigned 32-bit number onto +// ** the heap, preserving the heap property. The btreeHeapPull() routine +// ** removes the root element from the heap (the minimum value in the heap) +// ** and then moves other nodes around as necessary to preserve the heap +// ** property. +// ** +// ** This heap is used for cell overlap and coverage testing. Each u32 +// ** entry represents the span of a cell or freeblock on a btree page. +// ** The upper 16 bits are the index of the first byte of a range and the +// ** lower 16 bits are the index of the last byte of that range. +// */ +func _btreeHeapInsert(tls *libc.TLS, aHeap uintptr, x Tu32) { + var i, j, v1, v3 Tu32 + var v2 uintptr + _, _, _, _, _ = i, j, v1, v2, v3 + v2 = aHeap + *(*Tu32)(unsafe.Pointer(v2))++ + v1 = *(*Tu32)(unsafe.Pointer(v2)) + i = v1 + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = x + for { + v3 = i / libc.Uint32FromInt32(2) + j = v3 + if !(v3 > uint32(0) && *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) > *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4))) { + break + } + x = *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) = *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = x + i = j + } +} + +func _btreeHeapPull(tls *libc.TLS, aHeap uintptr, pOut uintptr) (r int32) { + var i, j, x, v1, v2 Tu32 + _, _, _, _, _ = i, j, x, v1, v2 + v1 = *(*Tu32)(unsafe.Pointer(aHeap)) + x = v1 + if v1 == uint32(0) { + return 0 + } + *(*Tu32)(unsafe.Pointer(pOut)) = *(*Tu32)(unsafe.Pointer(aHeap + 1*4)) + *(*Tu32)(unsafe.Pointer(aHeap + 1*4)) = *(*Tu32)(unsafe.Pointer(aHeap + uintptr(x)*4)) + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(x)*4)) = uint32(0xffffffff) + *(*Tu32)(unsafe.Pointer(aHeap))-- + i = uint32(1) + for { + v2 = i * libc.Uint32FromInt32(2) + j = v2 + if !(v2 <= *(*Tu32)(unsafe.Pointer(aHeap))) { + break + } + if *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) > *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j+uint32(1))*4)) { + j++ + } + if *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) < *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) { + break + } + x = *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) + *(*Tu32)(unsafe.Pointer(aHeap + uintptr(j)*4)) = x + i = j + } + return int32(1) +} + +// C documentation +// +// /* +// ** Do various sanity checks on a single page of a tree. Return +// ** the tree depth. Root pages return 0. Parents of root pages +// ** return 1, and so forth. +// ** +// ** These checks are done: +// ** +// ** 1. Make sure that cells and freeblocks do not overlap +// ** but combine to completely cover the page. +// ** 2. Make sure integer cell keys are in order. +// ** 3. Check the integrity of overflow pages. +// ** 4. Recursively call checkTreePage on all children. +// ** 5. Verify that the depth of all children is the same. +// */ +func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr, _maxKey Ti64) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + *(*Ti64)(unsafe.Pointer(bp)) = _maxKey + var cellStart, d2, depth, doCoverageCheck, hdr, i, j, keyCanBeEqual, nCell, nFrag, pgno, rc, saved_v1, saved_v2, size1, v1, v2, v3, v5 int32 + var contentOffset, nPage, pc, prev, size, usableSize Tu32 + var data, heap, pBt, pCell, pCellIdx, saved_zPfx uintptr + var pgnoOvfl TPgno + var savedIsInit Tu8 + var _ /* info at bp+24 */ TCellInfo + var _ /* pPage at bp+8 */ uintptr + var _ /* x at bp+16 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cellStart, contentOffset, d2, data, depth, doCoverageCheck, hdr, heap, i, j, keyCanBeEqual, nCell, nFrag, nPage, pBt, pCell, pCellIdx, pc, pgno, pgnoOvfl, prev, rc, savedIsInit, saved_v1, saved_v2, saved_zPfx, size, size1, usableSize, v1, v2, v3, v5 + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Result code from subroutine call */ + depth = -int32(1) /* Number of cells */ + doCoverageCheck = int32(1) /* True if cell coverage checking should be done */ + keyCanBeEqual = int32(1) /* Offset to the start of the cell content area */ + heap = uintptr(0) + prev = uint32(0) /* Next and previous entry on the min-heap */ + saved_zPfx = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx + saved_v1 = int32((*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1) + saved_v2 = (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 + savedIsInit = uint8(0) + /* Check that the page exists + */ + _checkProgress(tls, pCheck) + if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr == 0 { + goto end_of_check + } + pBt = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt + usableSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize + if iPage == uint32(0) { + return 0 + } + if _checkRef(tls, pCheck, iPage) != 0 { + return 0 + } + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4481 + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage + v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) + rc = v1 + if v1 != 0 { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4499, libc.VaList(bp+56, rc)) + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { + break + } + /* Check cell size */ + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = i + pc = uint32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(pCellIdx)))) + pCellIdx -= uintptr(2) + if pc < contentOffset || pc > usableSize-uint32(4) { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4653, libc.VaList(bp+56, pc, contentOffset, usableSize-uint32(4))) + doCoverageCheck = 0 + goto _4 + } + pCell = data + uintptr(pc) + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxParseCell})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), pCell, bp+24) + if pc+uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize) > usableSize { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4683, 0) + doCoverageCheck = 0 + goto _4 + } + /* Check for integer primary key out of range */ + if (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FintKey != 0 { + if keyCanBeEqual != 0 { + v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey > *(*Ti64)(unsafe.Pointer(bp))) + } else { + v5 = libc.BoolInt32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey >= *(*Ti64)(unsafe.Pointer(bp))) + } + if v5 != 0 { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4707, libc.VaList(bp+56, (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey)) + } + *(*Ti64)(unsafe.Pointer(bp)) = (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnKey + keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ + } + /* Check the content overflow list */ + if (*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnPayload > uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnLocal) { /* First page of the overflow chain */ + nPage = ((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnPayload - uint32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnLocal) + usableSize - uint32(5)) / (usableSize - uint32(4)) + pgnoOvfl = _sqlite3Get4byte(tls, pCell+uintptr(int32((*(*TCellInfo)(unsafe.Pointer(bp + 24))).FnSize)-int32(4))) + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _checkPtrmap(tls, pCheck, pgnoOvfl, uint8(PTRMAP_OVERFLOW1), iPage) + } + _checkList(tls, pCheck, 0, pgnoOvfl, nPage) + } + if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fleaf != 0) { + /* Check sanity of left child page for internal pages */ + pgno = int32(_sqlite3Get4byte(tls, pCell)) + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + _checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) + } + d2 = _checkTreePage(tls, pCheck, uint32(pgno), bp, *(*Ti64)(unsafe.Pointer(bp))) + keyCanBeEqual = 0 + if d2 != depth { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4731, 0) + depth = d2 + } + } else { + /* Populate the coverage-checking heap for leaf pages */ + _btreeHeapInsert(tls, heap, pc< 0 { + /* For leaf pages, the min-heap has already been initialized and the + ** cells have already been inserted. But for internal pages, that has + ** not yet been done, so do it now */ + if !((*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Fleaf != 0) { + heap = (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fheap + *(*Tu32)(unsafe.Pointer(heap)) = uint32(0) + i = nCell - int32(1) + for { + if !(i >= 0) { + break + } + pc = uint32(libc.X__builtin_bswap16(tls, *(*Tu16)(unsafe.Pointer(data + uintptr(cellStart+i*int32(2)))))) + size = uint32((*(*func(*libc.TLS, uintptr, uintptr) Tu16)(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FxCellSize})))(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), data+uintptr(pc))) + _btreeHeapInsert(tls, heap, pc< 0 { + /* Enforced by btreeComputeFreeSpace() */ + size1 = int32(*(*Tu8)(unsafe.Pointer(data + uintptr(i+int32(2)))))<= *(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4756, libc.VaList(bp+56, *(*Tu32)(unsafe.Pointer(bp + 16))>>int32(16), iPage)) + break + } else { + nFrag = int32(uint32(nFrag) + (*(*Tu32)(unsafe.Pointer(bp + 16))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) + prev = *(*Tu32)(unsafe.Pointer(bp + 16)) + } + } + nFrag = int32(uint32(nFrag) + (usableSize - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) + /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments + ** is stored in the fifth field of the b-tree page header. + ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the + ** number of fragmented free bytes within the cell content area. + */ + if *(*Tu32)(unsafe.Pointer(heap)) == uint32(0) && nFrag != int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))) { + _checkAppendMsg(tls, pCheck, __ccgo_ts+4793, libc.VaList(bp+56, nFrag, int32(*(*Tu8)(unsafe.Pointer(data + uintptr(hdr+int32(7))))), iPage)) + } + } +end_of_check: + ; + if !(doCoverageCheck != 0) { + (*TMemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FisInit = savedIsInit + } + _releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = saved_zPfx + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = uint32(saved_v1) + (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = saved_v2 + return depth + int32(1) +} + +// C documentation +// +// /* +// ** This routine does a complete check of the given BTree file. aRoot[] is +// ** an array of pages numbers were each page number is the root page of +// ** a table. nRoot is the number of entries in aRoot. +// ** +// ** A read-only or read-write transaction must be opened before calling +// ** this function. +// ** +// ** Write the number of error seen in *pnErr. Except for some memory +// ** allocation errors, an error message held in memory obtained from +// ** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is +// ** returned. If a memory allocation error occurs, NULL is returned. +// ** +// ** If the first entry in aRoot[] is 0, that indicates that the list of +// ** root pages is incomplete. This is a "partial integrity-check". This +// ** happens when performing an integrity check on a single table. The +// ** zero is skipped, of course. But in addition, the freelist checks +// ** and the checks to make sure every page is referenced are also skipped, +// ** since obviously it is not possible to know which pages are covered by +// ** the unverified btrees. Except, if aRoot[1] is 1, then the freelist +// ** checks are still performed. +// */ +func _sqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uintptr, nRoot int32, mxErr int32, pnErr uintptr, pzOut uintptr) (r int32) { + bp := tls.Alloc(256) + defer tls.Free(256) + var bCkFreelist, bPartial int32 + var i, mx, mxInHdr TPgno + var pBt uintptr + var savedDbFlags Tu64 + var _ /* notUsed at bp+224 */ Ti64 + var _ /* sCheck at bp+0 */ TIntegrityCk + var _ /* zErr at bp+120 */ [100]int8 + _, _, _, _, _, _, _ = bCkFreelist, bPartial, i, mx, mxInHdr, pBt, savedDbFlags + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + savedDbFlags = (*Tsqlite3)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags + bPartial = 0 /* True if not checking all btrees */ + bCkFreelist = int32(1) /* True to scan the freelist */ + /* aRoot[0]==0 means this is a partial check */ + if *(*TPgno)(unsafe.Pointer(aRoot)) == uint32(0) { + bPartial = int32(1) + if *(*TPgno)(unsafe.Pointer(aRoot + 1*4)) != uint32(1) { + bCkFreelist = 0 + } + } + _sqlite3BtreeEnter(tls, p) + libc.Xmemset(tls, bp, 0, uint64(120)) + (*(*TIntegrityCk)(unsafe.Pointer(bp))).Fdb = db + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FpBt = pBt + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FpPager = (*TBtShared)(unsafe.Pointer(pBt)).FpPager + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FnCkPage = _btreePagecount(tls, (*(*TIntegrityCk)(unsafe.Pointer(bp))).FpBt) + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FmxErr = mxErr + _sqlite3StrAccumInit(tls, bp+72, uintptr(0), bp+120, int32(100), int32(SQLITE_MAX_LENGTH)) + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FerrMsg.FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) + if (*(*TIntegrityCk)(unsafe.Pointer(bp))).FnCkPage == uint32(0) { + goto integrity_ck_cleanup + } + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FaPgRef = _sqlite3MallocZero(tls, uint64((*(*TIntegrityCk)(unsafe.Pointer(bp))).FnCkPage/uint32(8)+uint32(1))) + if !((*(*TIntegrityCk)(unsafe.Pointer(bp))).FaPgRef != 0) { + _checkOom(tls, bp) + goto integrity_ck_cleanup + } + (*(*TIntegrityCk)(unsafe.Pointer(bp))).Fheap = _sqlite3PageMalloc(tls, int32((*TBtShared)(unsafe.Pointer(pBt)).FpageSize)) + if (*(*TIntegrityCk)(unsafe.Pointer(bp))).Fheap == uintptr(0) { + _checkOom(tls, bp) + goto integrity_ck_cleanup + } + i = uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer(pBt)).FpageSize + libc.Uint32FromInt32(1) + if i <= (*(*TIntegrityCk)(unsafe.Pointer(bp))).FnCkPage { + _setPageReferenced(tls, bp, i) + } + /* Check the integrity of the freelist + */ + if bCkFreelist != 0 { + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = __ccgo_ts + 4845 + _checkList(tls, bp, int32(1), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32), _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36)) + (*(*TIntegrityCk)(unsafe.Pointer(bp))).FzPfx = uintptr(0) + } + /* Check all the tables. + */ + if !(bPartial != 0) { + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + mx = uint32(0) + i = uint32(0) + for { + if !(int32(i) < nRoot) { + break + } + if mx < *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) { + mx = *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) + } + goto _1 + _1: + ; + i++ + } + mxInHdr = _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+52) + if mx != mxInHdr { + _checkAppendMsg(tls, bp, __ccgo_ts+4856, libc.VaList(bp+240, mx, mxInHdr)) + } + } else { + if _sqlite3Get4byte(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64) != uint32(0) { + _checkAppendMsg(tls, bp, __ccgo_ts+4901, 0) + } + } + } + *(*Tu64)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).Fdb + 48)) &= ^libc.Uint64FromInt32(SQLITE_CellSizeCk) + i = uint32(0) + for { + if !(int32(i) < nRoot && (*(*TIntegrityCk)(unsafe.Pointer(bp))).FmxErr != 0) { + break + } + if *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) == uint32(0) { + goto _2 + } + if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 && *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) > uint32(1) && !(bPartial != 0) { + _checkPtrmap(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), uint8(PTRMAP_ROOTPAGE), uint32(0)) + } + (*(*TIntegrityCk)(unsafe.Pointer(bp))).Fv0 = *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) + _checkTreePage(tls, bp, *(*TPgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+224, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= int32(CURSOR_REQUIRESEEK) { + v1 = _btreeRestoreCursorPosition(tls, pCsr) + } else { + v1 = SQLITE_OK + } + rc = v1 + if rc != SQLITE_OK { + return rc + } + if int32((*TBtCursor)(unsafe.Pointer(pCsr)).FeState) != CURSOR_VALID { + return int32(SQLITE_ABORT) + } + /* Save the positions of all other cursors open on this table. This is + ** required in case any of them are holding references to an xFetch + ** version of the b-tree page modified by the accessPayload call below. + ** + ** Note that pCsr must be open on a INTKEY table and saveCursorPosition() + ** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence + ** saveAllCursors can only return SQLITE_OK. + */ + _saveAllCursors(tls, (*TBtCursor)(unsafe.Pointer(pCsr)).FpBt, (*TBtCursor)(unsafe.Pointer(pCsr)).FpgnoRoot, pCsr) + /* Check some assumptions: + ** (a) the cursor is open for writing, + ** (b) there is a read/write transaction open, + ** (c) the connection holds a write-lock on the table (if required), + ** (d) there are no conflicting read-locks, and + ** (e) the cursor points at a valid row of an intKey table. + */ + if int32((*TBtCursor)(unsafe.Pointer(pCsr)).FcurFlags)&int32(BTCF_WriteFlag) == 0 { + return int32(SQLITE_READONLY) + } + return _accessPayload(tls, pCsr, offset, amt, z, int32(1)) +} + +// C documentation +// +// /* +// ** Mark this cursor as an incremental blob cursor. +// */ +func _sqlite3BtreeIncrblobCursor(tls *libc.TLS, pCur uintptr) { + var p1 uintptr + _ = p1 + p1 = pCur + 1 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(BTCF_Incrblob)) + (*TBtree)(unsafe.Pointer((*TBtCursor)(unsafe.Pointer(pCur)).FpBtree)).FhasIncrblobCur = uint8(1) +} + +// C documentation +// +// /* +// ** Set both the "read version" (single byte at byte offset 18) and +// ** "write version" (single byte at byte offset 19) fields in the database +// ** header to iVersion. +// */ +func _sqlite3BtreeSetVersion(tls *libc.TLS, pBtree uintptr, iVersion int32) (r int32) { + var aData, pBt, p1, p2, p3 uintptr + var rc int32 + _, _, _, _, _, _ = aData, pBt, rc, p1, p2, p3 + pBt = (*TBtree)(unsafe.Pointer(pBtree)).FpBt /* Return code */ + /* If setting the version fields to 1, do not automatically open the + ** WAL connection, even if the version fields are currently set to 2. + */ + p1 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_NO_WAL)) + if iVersion == int32(1) { + p2 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(BTS_NO_WAL)) + } + rc = _sqlite3BtreeBeginTrans(tls, pBtree, 0, uintptr(0)) + if rc == SQLITE_OK { + aData = (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + if int32(*(*Tu8)(unsafe.Pointer(aData + 18))) != int32(uint8(iVersion)) || int32(*(*Tu8)(unsafe.Pointer(aData + 19))) != int32(uint8(iVersion)) { + rc = _sqlite3BtreeBeginTrans(tls, pBtree, int32(2), uintptr(0)) + if rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, (*TMemPage)(unsafe.Pointer((*TBtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if rc == SQLITE_OK { + *(*Tu8)(unsafe.Pointer(aData + 18)) = uint8(iVersion) + *(*Tu8)(unsafe.Pointer(aData + 19)) = uint8(iVersion) + } + } + } + } + p3 = pBt + 40 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(BTS_NO_WAL)) + return rc +} + +// C documentation +// +// /* +// ** Return true if the cursor has a hint specified. This routine is +// ** only used from within assert() statements +// */ +func _sqlite3BtreeCursorHasHint(tls *libc.TLS, pCsr uintptr, mask uint32) (r int32) { + return libc.BoolInt32(uint32((*TBtCursor)(unsafe.Pointer(pCsr)).Fhints)&mask != uint32(0)) +} + +// C documentation +// +// /* +// ** Return true if the given Btree is read-only. +// */ +func _sqlite3BtreeIsReadonly(tls *libc.TLS, p uintptr) (r int32) { + return libc.BoolInt32(int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FbtsFlags)&int32(BTS_READ_ONLY) != 0) +} + +// C documentation +// +// /* +// ** Return the size of the header added to each page by this module. +// */ +func _sqlite3HeaderSizeBtree(tls *libc.TLS) (r int32) { + return int32((libc.Uint64FromInt64(136) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) +} + +// C documentation +// +// /* +// ** If no transaction is active and the database is not a temp-db, clear +// ** the in-memory pager cache. +// */ +func _sqlite3BtreeClearCache(tls *libc.TLS, p uintptr) { + var pBt uintptr + _ = pBt + pBt = (*TBtree)(unsafe.Pointer(p)).FpBt + if int32((*TBtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE { + _sqlite3PagerClearCache(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager) + } +} + +// C documentation +// +// /* +// ** Return true if the Btree passed as the only argument is sharable. +// */ +func _sqlite3BtreeSharable(tls *libc.TLS, p uintptr) (r int32) { + return int32((*TBtree)(unsafe.Pointer(p)).Fsharable) +} + +// C documentation +// +// /* +// ** Return the number of connections to the BtShared object accessed by +// ** the Btree handle passed as the only argument. For private caches +// ** this is always 1. For shared caches it may be 1 or greater. +// */ +func _sqlite3BtreeConnectionCount(tls *libc.TLS, p uintptr) (r int32) { + return (*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer(p)).FpBt)).FnRef +} + +/************** End of btree.c ***********************************************/ +/************** Begin file backup.c ******************************************/ +/* +** 2009 January 28 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the implementation of the sqlite3_backup_XXX() +** API functions and the related features. + */ +/* #include "sqliteInt.h" */ +/* #include "btreeInt.h" */ + +/* +** Structure allocated for each backup operation. + */ +type Tsqlite3_backup1 = struct { + FpDestDb uintptr + FpDest uintptr + FiDestSchema Tu32 + FbDestLocked int32 + FiNext TPgno + FpSrcDb uintptr + FpSrc uintptr + Frc int32 + FnRemaining TPgno + FnPagecount TPgno + FisAttached int32 + FpNext uintptr +} + +type sqlite3_backup1 = Tsqlite3_backup1 + +/* +** THREAD SAFETY NOTES: +** +** Once it has been created using backup_init(), a single sqlite3_backup +** structure may be accessed via two groups of thread-safe entry points: +** +** * Via the sqlite3_backup_XXX() API function backup_step() and +** backup_finish(). Both these functions obtain the source database +** handle mutex and the mutex associated with the source BtShared +** structure, in that order. +** +** * Via the BackupUpdate() and BackupRestart() functions, which are +** invoked by the pager layer to report various state changes in +** the page cache associated with the source database. The mutex +** associated with the source database BtShared structure will always +** be held when either of these functions are invoked. +** +** The other sqlite3_backup_XXX() API functions, backup_remaining() and +** backup_pagecount() are not thread-safe functions. If they are called +** while some other thread is calling backup_step() or backup_finish(), +** the values returned may be invalid. There is no way for a call to +** BackupUpdate() or BackupRestart() to interfere with backup_remaining() +** or backup_pagecount(). +** +** Depending on the SQLite configuration, the database handles and/or +** the Btree objects may have their own mutexes that require locking. +** Non-sharable Btrees (in-memory databases for example), do not have +** associated mutexes. + */ + +// C documentation +// +// /* +// ** Return a pointer corresponding to database zDb (i.e. "main", "temp") +// ** in connection handle pDb. If such a database cannot be found, return +// ** a NULL pointer and write an error message to pErrorDb. +// ** +// ** If the "temp" database is requested, it may need to be opened by this +// ** function. If an error occurs while doing so, return 0 and write an +// ** error message to pErrorDb. +// */ +func _findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) (r uintptr) { + bp := tls.Alloc(448) + defer tls.Free(448) + var i, rc int32 + var _ /* sParse at bp+0 */ TParse + _, _ = i, rc + i = _sqlite3FindDbName(tls, pDb, zDb) + if i == int32(1) { + rc = 0 + _sqlite3ParseObjectInit(tls, bp, pDb) + if _sqlite3OpenTempDatabase(tls, bp) != 0 { + _sqlite3ErrorWithMsg(tls, pErrorDb, (*(*TParse)(unsafe.Pointer(bp))).Frc, __ccgo_ts+3827, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) + rc = int32(SQLITE_ERROR) + } + _sqlite3DbFree(tls, pErrorDb, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg) + _sqlite3ParseObjectReset(tls, bp) + if rc != 0 { + return uintptr(0) + } + } + if i < 0 { + _sqlite3ErrorWithMsg(tls, pErrorDb, int32(SQLITE_ERROR), __ccgo_ts+5008, libc.VaList(bp+432, zDb)) + return uintptr(0) + } + return (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(pDb)).FaDb + uintptr(i)*32))).FpBt +} + +// C documentation +// +// /* +// ** Attempt to set the page size of the destination to match the page size +// ** of the source. +// */ +func _setDestPgsz(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = _sqlite3BtreeSetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest, _sqlite3BtreeGetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc), 0, 0) + return rc +} + +// C documentation +// +// /* +// ** Check that there is no open read-transaction on the b-tree passed as the +// ** second argument. If there is not, return SQLITE_OK. Otherwise, if there +// ** is an open read-transaction, return SQLITE_ERROR and leave an error +// ** message in database handle db. +// */ +func _checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + if _sqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+5028, 0) + return int32(SQLITE_ERROR) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Create an sqlite3_backup process to copy the contents of zSrcDb from +// ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return +// ** a pointer to the new sqlite3_backup object. +// ** +// ** If an error occurs, NULL is returned and an error code and error message +// ** stored in database handle pDestDb. +// */ +func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcDb uintptr, zSrcDb uintptr) (r uintptr) { + var p uintptr + _ = p /* Value to return */ + /* Lock the source database handle. The destination database + ** handle is not locked in this routine, but it is locked in + ** sqlite3_backup_step(). The user is required to ensure that no + ** other thread accesses the destination handle for the duration + ** of the backup operation. Any attempt to use the destination + ** database connection while a backup is in progress may cause + ** a malfunction or a deadlock. + */ + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pDestDb)).Fmutex) + if pSrcDb == pDestDb { + _sqlite3ErrorWithMsg(tls, pDestDb, int32(SQLITE_ERROR), __ccgo_ts+5059, 0) + p = uintptr(0) + } else { + /* Allocate space for a new sqlite3_backup object... + ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a + ** call to sqlite3_backup_init() and is destroyed by a call to + ** sqlite3_backup_finish(). */ + p = _sqlite3MallocZero(tls, uint64(72)) + if !(p != 0) { + _sqlite3Error(tls, pDestDb, int32(SQLITE_NOMEM)) + } + } + /* If the allocation succeeded, populate the new object. */ + if p != 0 { + (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc = _findBtree(tls, pDestDb, pSrcDb, zSrcDb) + (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest = _findBtree(tls, pDestDb, pDestDb, zDestDb) + (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb = pDestDb + (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrcDb = pSrcDb + (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext = uint32(1) + (*Tsqlite3_backup)(unsafe.Pointer(p)).FisAttached = 0 + if uintptr(0) == (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc || uintptr(0) == (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest || _checkReadTransaction(tls, pDestDb, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) != SQLITE_OK { + /* One (or both) of the named databases did not exist or an OOM + ** error was hit. Or there is a transaction open on the destination + ** database. The error has already been written into the pDestDb + ** handle. All that is left to do here is free the sqlite3_backup + ** structure. */ + Xsqlite3_free(tls, p) + p = uintptr(0) + } + } + if p != 0 { + (*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FnBackup++ + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(pDestDb)).Fmutex) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) + return p +} + +// C documentation +// +// /* +// ** Argument rc is an SQLite error code. Return true if this error is +// ** considered fatal if encountered during a backup operation. All errors +// ** are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED. +// */ +func _isFatalError(tls *libc.TLS, rc int32) (r int32) { + return libc.BoolInt32(rc != SQLITE_OK && rc != int32(SQLITE_BUSY) && rc != int32(SQLITE_LOCKED)) +} + +// C documentation +// +// /* +// ** Parameter zSrcData points to a buffer containing the data for +// ** page iSrcPg from the source database. Copy this data into the +// ** destination database. +// */ +func _backupOnePage(tls *libc.TLS, p uintptr, iSrcPg TPgno, zSrcData uintptr, bUpdate int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iDest TPgno + var iEnd, iOff Ti64 + var nCopy, nDestPgsz, nSrcPgsz, rc, v1, v3, v4 int32 + var pDestPager, zDestData, zIn, zOut uintptr + var v5 bool + var _ /* pDestPg at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iDest, iEnd, iOff, nCopy, nDestPgsz, nSrcPgsz, pDestPager, rc, zDestData, zIn, zOut, v1, v3, v4, v5 + pDestPager = _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) + nSrcPgsz = _sqlite3BtreeGetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc) + nDestPgsz = _sqlite3BtreeGetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) + if nSrcPgsz < nDestPgsz { + v1 = nSrcPgsz + } else { + v1 = nDestPgsz + } + nCopy = v1 + iEnd = int64(iSrcPg) * int64(nSrcPgsz) + rc = SQLITE_OK + /* This loop runs once for each destination page spanned by the source + ** page. For each iteration, variable iOff is set to the byte offset + ** of the destination page. + */ + iOff = iEnd - int64(nSrcPgsz) + for { + if !(rc == SQLITE_OK && iOff < iEnd) { + break + } + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + iDest = uint32(iOff/int64(nDestPgsz)) + uint32(1) + if iDest == uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize+libc.Uint32FromInt32(1) { + goto _2 + } + v3 = _sqlite3PagerGet(tls, pDestPager, iDest, bp, 0) + rc = v3 + if v5 = SQLITE_OK == v3; v5 { + v4 = _sqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp))) + rc = v4 + } + if v5 && SQLITE_OK == v4 { + zIn = zSrcData + uintptr(iOff%int64(nSrcPgsz)) + zDestData = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) + zOut = zDestData + uintptr(iOff%int64(nDestPgsz)) + /* Copy the data from the source page into the destination page. + ** Then clear the Btree layer MemPage.isInit flag. Both this module + ** and the pager code use this trick (clearing the first byte + ** of the page 'extra' space to invalidate the Btree layers + ** cached parse of the page). MemPage.isInit is marked + ** "MUST BE FIRST" for this purpose. + */ + libc.Xmemcpy(tls, zOut, zIn, uint64(nCopy)) + *(*Tu8)(unsafe.Pointer(_sqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp))))) = uint8(0) + if iOff == 0 && bUpdate == 0 { + _sqlite3Put4byte(tls, zOut+28, _sqlite3BtreeLastPage(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + } + } + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + goto _2 + _2: + ; + iOff += int64(nDestPgsz) + } + return rc +} + +// C documentation +// +// /* +// ** If pFile is currently larger than iSize bytes, then truncate it to +// ** exactly iSize bytes. If pFile is not larger than iSize bytes, then +// ** this function is a no-op. +// ** +// ** Return SQLITE_OK if everything is successful, or an SQLite error +// ** code if an error occurs. +// */ +func _backupTruncateFile(tls *libc.TLS, pFile uintptr, iSize Ti64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* iCurrent at bp+0 */ Ti64 + _ = rc + rc = _sqlite3OsFileSize(tls, pFile, bp) + if rc == SQLITE_OK && *(*Ti64)(unsafe.Pointer(bp)) > iSize { + rc = _sqlite3OsTruncate(tls, pFile, iSize) + } + return rc +} + +// C documentation +// +// /* +// ** Register this backup object with the associated source pager for +// ** callbacks when pages are changed or the cache invalidated. +// */ +func _attachBackupObject(tls *libc.TLS, p uintptr) { + var pp uintptr + _ = pp + pp = _sqlite3PagerBackupPtr(tls, _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + (*Tsqlite3_backup)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + (*Tsqlite3_backup)(unsafe.Pointer(p)).FisAttached = int32(1) +} + +// C documentation +// +// /* +// ** Copy nPage pages from the source b-tree to the destination. +// */ +func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bCloseTrans, destMode, ii, nDestTruncate, nSrcPage, pgszDest, pgszSrc, ratio, rc, v1, v7 int32 + var iEnd, iOff, iSize Ti64 + var iPg, iSrcPg, iSrcPg1 TPgno + var pDestPager, pFile, pSrcPager, zData uintptr + var v2, v8 bool + var v5 int64 + var _ /* nDstPage at bp+8 */ int32 + var _ /* pPg at bp+16 */ uintptr + var _ /* pSrcPg at bp+0 */ uintptr + var _ /* pSrcPg at bp+24 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bCloseTrans, destMode, iEnd, iOff, iPg, iSize, iSrcPg, iSrcPg1, ii, nDestTruncate, nSrcPage, pDestPager, pFile, pSrcPager, pgszDest, pgszSrc, ratio, rc, zData, v1, v2, v5, v7, v8 /* Destination journal mode */ + pgszSrc = 0 /* Source page size */ + pgszDest = 0 /* Destination page size */ + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrcDb)).Fmutex) + _sqlite3BtreeEnter(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc) + if (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + } + rc = (*Tsqlite3_backup)(unsafe.Pointer(p)).Frc + if !(_isFatalError(tls, rc) != 0) { + pSrcPager = _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc) /* Source pager */ + pDestPager = _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) /* Iterator variable */ + nSrcPage = -int32(1) /* Size of source db in pages */ + bCloseTrans = 0 /* True if src db requires unlocking */ + /* If the source pager is currently in a write-transaction, return + ** SQLITE_BUSY immediately. + */ + if (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 && int32((*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FpBt)).FinTransaction) == int32(TRANS_WRITE) { + rc = int32(SQLITE_BUSY) + } else { + rc = SQLITE_OK + } + /* If there is no open read-transaction on the source database, open + ** one now. If a transaction is opened here, then it will be closed + ** before this function exits. + */ + if rc == SQLITE_OK && SQLITE_TXN_NONE == _sqlite3BtreeTxnState(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc) { + rc = _sqlite3BtreeBeginTrans(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc, 0, uintptr(0)) + bCloseTrans = int32(1) + } + /* If the destination database has not yet been locked (i.e. if this + ** is the first call to backup_step() for the current backup operation), + ** try to set its page size to the same as the source database. This + ** is especially important on ZipVFS systems, as in that case it is + ** not possible to create a database file that uses one page size by + ** writing to it with another. */ + if (*Tsqlite3_backup)(unsafe.Pointer(p)).FbDestLocked == 0 && rc == SQLITE_OK && _setDestPgsz(tls, p) == int32(SQLITE_NOMEM) { + rc = int32(SQLITE_NOMEM) + } + /* Lock the destination database, if it is not locked already. */ + if v2 = SQLITE_OK == rc && (*Tsqlite3_backup)(unsafe.Pointer(p)).FbDestLocked == 0; v2 { + v1 = _sqlite3BtreeBeginTrans(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest, int32(2), p+16) + rc = v1 + } + if v2 && SQLITE_OK == v1 { + (*Tsqlite3_backup)(unsafe.Pointer(p)).FbDestLocked = int32(1) + } + /* Do not allow backup if the destination database is in WAL mode + ** and the page sizes are different between source and destination */ + pgszSrc = _sqlite3BtreeGetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc) + pgszDest = _sqlite3BtreeGetPageSize(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) + destMode = _sqlite3PagerGetJournalMode(tls, _sqlite3BtreePager(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest)) + if SQLITE_OK == rc && (destMode == int32(PAGER_JOURNALMODE_WAL) || _sqlite3PagerIsMemdb(tls, pDestPager) != 0) && pgszSrc != pgszDest { + rc = int32(SQLITE_READONLY) + } + /* Now that there is a read-lock on the source database, query the + ** source pager for the number of pages in the database. + */ + nSrcPage = int32(_sqlite3BtreeLastPage(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + ii = 0 + for { + if !((nPage < 0 || ii < nPage) && (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext <= uint32(nSrcPage) && !(rc != 0)) { + break + } + iSrcPg = (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext /* Source page number */ + if iSrcPg != uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FpBt)).FpageSize+libc.Uint32FromInt32(1) { /* Source page object */ + rc = _sqlite3PagerGet(tls, pSrcPager, iSrcPg, bp, int32(PAGER_GET_READONLY)) + if rc == SQLITE_OK { + rc = _backupOnePage(tls, p, iSrcPg, _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))), 0) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext++ + goto _3 + _3: + ; + ii++ + } + if rc == SQLITE_OK { + (*Tsqlite3_backup)(unsafe.Pointer(p)).FnPagecount = uint32(nSrcPage) + (*Tsqlite3_backup)(unsafe.Pointer(p)).FnRemaining = uint32(nSrcPage+int32(1)) - (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext + if (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext > uint32(nSrcPage) { + rc = int32(SQLITE_DONE) + } else { + if !((*Tsqlite3_backup)(unsafe.Pointer(p)).FisAttached != 0) { + _attachBackupObject(tls, p) + } + } + } + /* Update the schema version field in the destination database. This + ** is to make sure that the schema-version really does change in + ** the case where the source and destination databases have the + ** same schema version. + */ + if rc == int32(SQLITE_DONE) { + if nSrcPage == 0 { + rc = _sqlite3BtreeNewDb(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest) + nSrcPage = int32(1) + } + if rc == SQLITE_OK || rc == int32(SQLITE_DONE) { + rc = _sqlite3BtreeUpdateMeta(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest, int32(1), (*Tsqlite3_backup)(unsafe.Pointer(p)).FiDestSchema+uint32(1)) + } + if rc == SQLITE_OK { + if (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + _sqlite3ResetAllSchemasOfConnection(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb) + } + if destMode == int32(PAGER_JOURNALMODE_WAL) { + rc = _sqlite3BtreeSetVersion(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest, int32(2)) + } + } + if rc == SQLITE_OK { + /* Set nDestTruncate to the final number of pages in the destination + ** database. The complication here is that the destination page + ** size may be different to the source page size. + ** + ** If the source page size is smaller than the destination page size, + ** round up. In this case the call to sqlite3OsTruncate() below will + ** fix the size of the file. However it is important to call + ** sqlite3PagerTruncateImage() here so that any pages in the + ** destination file that lie beyond the nDestTruncate page mark are + ** journalled by PagerCommitPhaseOne() before they are destroyed + ** by the file truncation. + */ + if pgszSrc < pgszDest { + ratio = pgszDest / pgszSrc + nDestTruncate = (nSrcPage + ratio - int32(1)) / ratio + if nDestTruncate == int32(uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize+libc.Uint32FromInt32(1)) { + nDestTruncate-- + } + } else { + nDestTruncate = nSrcPage * (pgszSrc / pgszDest) + } + if pgszSrc < pgszDest { + /* If the source page-size is smaller than the destination page-size, + ** two extra things may need to happen: + ** + ** * The destination may need to be truncated, and + ** + ** * Data stored on the pages immediately following the + ** pending-byte page in the source database may need to be + ** copied into the destination database. + */ + iSize = int64(pgszSrc) * int64(nSrcPage) + pFile = _sqlite3PagerFile(tls, pDestPager) + /* This block ensures that all data required to recreate the original + ** database has been stored in the journal for pDestPager and the + ** journal synced to disk. So at this point we may safely modify + ** the database file in any way, knowing that if a power failure + ** occurs, the original database will be reconstructed from the + ** journal file. */ + _sqlite3PagerPagecount(tls, pDestPager, bp+8) + iPg = uint32(nDestTruncate) + for { + if !(rc == SQLITE_OK && iPg <= uint32(*(*int32)(unsafe.Pointer(bp + 8)))) { + break + } + if iPg != uint32(_sqlite3PendingByte)/(*TBtShared)(unsafe.Pointer((*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize+libc.Uint32FromInt32(1) { + rc = _sqlite3PagerGet(tls, pDestPager, iPg, bp+16, 0) + if rc == SQLITE_OK { + rc = _sqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + } + } + goto _4 + _4: + ; + iPg++ + } + if rc == SQLITE_OK { + rc = _sqlite3PagerCommitPhaseOne(tls, pDestPager, uintptr(0), int32(1)) + } + /* Write the extra pages and truncate the database file as required */ + if int64(_sqlite3PendingByte+pgszDest) < iSize { + v5 = int64(_sqlite3PendingByte + pgszDest) + } else { + v5 = iSize + } + iEnd = v5 + iOff = int64(_sqlite3PendingByte + pgszSrc) + for { + if !(rc == SQLITE_OK && iOff < iEnd) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + iSrcPg1 = uint32(iOff/int64(pgszSrc) + libc.Int64FromInt32(1)) + rc = _sqlite3PagerGet(tls, pSrcPager, iSrcPg1, bp+24, 0) + if rc == SQLITE_OK { + zData = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + rc = _sqlite3OsWrite(tls, pFile, zData, pgszSrc, iOff) + } + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + goto _6 + _6: + ; + iOff += int64(pgszSrc) + } + if rc == SQLITE_OK { + rc = _backupTruncateFile(tls, pFile, iSize) + } + /* Sync the database file to disk. */ + if rc == SQLITE_OK { + rc = _sqlite3PagerSync(tls, pDestPager, uintptr(0)) + } + } else { + _sqlite3PagerTruncateImage(tls, pDestPager, uint32(nDestTruncate)) + rc = _sqlite3PagerCommitPhaseOne(tls, pDestPager, uintptr(0), 0) + } + /* Finish committing the transaction to the destination database. */ + if v8 = SQLITE_OK == rc; v8 { + v7 = _sqlite3BtreeCommitPhaseTwo(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDest, 0) + rc = v7 + } + if v8 && SQLITE_OK == v7 { + rc = int32(SQLITE_DONE) + } + } + } + /* If bCloseTrans is true, then this function opened a read transaction + ** on the source database. Close the read transaction here. There is + ** no need to check the return values of the btree methods here, as + ** "committing" a read-only transaction cannot fail. + */ + if bCloseTrans != 0 { + _sqlite3BtreeCommitPhaseOne(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc, uintptr(0)) + _sqlite3BtreeCommitPhaseTwo(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc, 0) + } + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<rc) should be set to either SQLITE_DONE + ** or an error code. */ + Xsqlite3_backup_step(tls, bp, int32(0x7FFFFFFF)) + rc = Xsqlite3_backup_finish(tls, bp) + if rc == SQLITE_OK { + p1 = (*TBtree)(unsafe.Pointer(pTo)).FpBt + 40 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(BTS_PAGESIZE_FIXED)) + } else { + _sqlite3PagerClearCache(tls, _sqlite3BtreePager(tls, (*(*Tsqlite3_backup)(unsafe.Pointer(bp))).FpDest)) + } +copy_finished: + ; + _sqlite3BtreeLeave(tls, pFrom) + _sqlite3BtreeLeave(tls, pTo) + return rc +} + +/************** End of backup.c **********************************************/ +/************** Begin file vdbemem.c *****************************************/ +/* +** 2004 May 26 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code use to manipulate "Mem" structure. A "Mem" +** stores a single value in the VDBE. Mem is an opaque structure visible +** only within the VDBE. Interface routines refer to a Mem using the +** name sqlite_value + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ + +/* True if X is a power of two. 0 is considered a power of two here. +** In other words, return true if X has at most one bit set. + */ + +// C documentation +// +// /* +// ** Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal +// ** into a buffer. +// */ +func _vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var v1 float64 + var _ /* acc at bp+0 */ TStrAccum + var _ /* x at bp+32 */ Ti64 + _ = v1 + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Int) != 0 { + libc.Xmemcpy(tls, bp+32, p, uint64(int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Int)*int32(2))) + (*TMem)(unsafe.Pointer(p)).Fn = _sqlite3Int64ToText(tls, *(*Ti64)(unsafe.Pointer(bp + 32)), zBuf) + } else { + _sqlite3StrAccumInit(tls, bp, uintptr(0), zBuf, sz, 0) + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_IntReal) != 0 { + v1 = float64(*(*Ti64)(unsafe.Pointer(p))) + } else { + v1 = *(*float64)(unsafe.Pointer(p)) + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5099, libc.VaList(bp+48, v1)) + *(*int8)(unsafe.Pointer(zBuf + uintptr((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar))) = 0 /* Fast version of sqlite3StrAccumFinish(&acc) */ + (*TMem)(unsafe.Pointer(p)).Fn = int32((*(*TStrAccum)(unsafe.Pointer(bp))).FnChar) + } +} + +// C documentation +// +// /* +// ** If pMem is an object with a valid string representation, this routine +// ** ensures the internal encoding for the string representation is +// ** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE. +// ** +// ** If pMem is not a string object, or the encoding of the string +// ** representation is already stored using the requested encoding, then this +// ** routine is a no-op. +// ** +// ** SQLITE_OK is returned if the conversion is successful (or not required). +// ** SQLITE_NOMEM may be returned if a malloc() fails during conversion +// ** between formats. +// */ +func _sqlite3VdbeChangeEncoding(tls *libc.TLS, pMem uintptr, desiredEnc int32) (r int32) { + var rc int32 + _ = rc + if !(int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&libc.Int32FromInt32(MEM_Str) != 0) { + (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(desiredEnc) + return SQLITE_OK + } + if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) == desiredEnc { + return SQLITE_OK + } + /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned, + ** then the encoding of the value may not have changed. + */ + rc = _sqlite3VdbeMemTranslate(tls, pMem, uint8(desiredEnc)) + return rc +} + +// C documentation +// +// /* +// ** Make sure pMem->z points to a writable allocation of at least n bytes. +// ** +// ** If the bPreserve argument is true, then copy of the content of +// ** pMem->z into the new allocation. pMem must be either a string or +// ** blob if bPreserve is true. If bPreserve is false, any prior content +// ** in pMem->z is discarded. +// */ +func _sqlite3VdbeMemGrow(tls *libc.TLS, pMem uintptr, n int32, bPreserve int32) (r int32) { + var v1, p2 uintptr + _, _ = v1, p2 + /* If the bPreserve flag is set to true, then the memory cell must already + ** contain a valid string or blob value. */ + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 && bPreserve != 0 && (*TMem)(unsafe.Pointer(pMem)).Fz == (*TMem)(unsafe.Pointer(pMem)).FzMalloc { + if (*TMem)(unsafe.Pointer(pMem)).Fdb != 0 { + v1 = _sqlite3DbReallocOrFree(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz, uint64(n)) + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = v1 + (*TMem)(unsafe.Pointer(pMem)).Fz = v1 + } else { + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = _sqlite3Realloc(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, uint64(n)) + if (*TMem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + Xsqlite3_free(tls, (*TMem)(unsafe.Pointer(pMem)).Fz) + } + (*TMem)(unsafe.Pointer(pMem)).Fz = (*TMem)(unsafe.Pointer(pMem)).FzMalloc + } + bPreserve = 0 + } else { + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) + } + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = _sqlite3DbMallocRaw(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, uint64(n)) + } + if (*TMem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + _sqlite3VdbeMemSetNull(tls, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = 0 + return int32(SQLITE_NOMEM) + } else { + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) + } + if bPreserve != 0 && (*TMem)(unsafe.Pointer(pMem)).Fz != 0 { + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pMem)).FzMalloc, (*TMem)(unsafe.Pointer(pMem)).Fz, uint64((*TMem)(unsafe.Pointer(pMem)).Fn)) + } + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Dyn) != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMem)(unsafe.Pointer(pMem)).FxDel})))(tls, (*TMem)(unsafe.Pointer(pMem)).Fz) + } + (*TMem)(unsafe.Pointer(pMem)).Fz = (*TMem)(unsafe.Pointer(pMem)).FzMalloc + p2 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(MEM_Dyn) | libc.Int32FromInt32(MEM_Ephem) | libc.Int32FromInt32(MEM_Static))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change the pMem->zMalloc allocation to be at least szNew bytes. +// ** If pMem->zMalloc already meets or exceeds the requested size, this +// ** routine is a no-op. +// ** +// ** Any prior string or blob content in the pMem object may be discarded. +// ** The pMem->xDel destructor is called, if it exists. Though MEM_Str +// ** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal, +// ** and MEM_Null values are preserved. +// ** +// ** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM) +// ** if unable to complete the resizing. +// */ +func _sqlite3VdbeMemClearAndResize(tls *libc.TLS, pMem uintptr, szNew int32) (r int32) { + var p1 uintptr + _ = p1 + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc < szNew { + return _sqlite3VdbeMemGrow(tls, pMem, szNew, 0) + } + (*TMem)(unsafe.Pointer(pMem)).Fz = (*TMem)(unsafe.Pointer(pMem)).FzMalloc + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & (libc.Int32FromInt32(MEM_Null) | libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If pMem is already a string, detect if it is a zero-terminated +// ** string, or make it into one if possible, and mark it as such. +// ** +// ** This is an optimization. Correct operation continues even if +// ** this routine is a no-op. +// */ +func _sqlite3VdbeMemZeroTerminateIfAble(tls *libc.TLS, pMem uintptr) { + var p1, p2, p3 uintptr + _, _, _ = p1, p2, p3 + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Term)|libc.Int32FromInt32(MEM_Ephem)|libc.Int32FromInt32(MEM_Static)) != int32(MEM_Str) { + /* pMem must be a string, and it cannot be an ephemeral or static string */ + return + } + if int32((*TMem)(unsafe.Pointer(pMem)).Fenc) != int32(SQLITE_UTF8) { + return + } + if (*TMem)(unsafe.Pointer(pMem)).Fz == uintptr(0) { + return + } + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Dyn) != 0 { + if (*TMem)(unsafe.Pointer(pMem)).FxDel == __ccgo_fp(Xsqlite3_free) && Xsqlite3_msize(tls, (*TMem)(unsafe.Pointer(pMem)).Fz) >= uint64((*TMem)(unsafe.Pointer(pMem)).Fn+libc.Int32FromInt32(1)) { + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn))) = 0 + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Term)) + return + } + if (*TMem)(unsafe.Pointer(pMem)).FxDel == __ccgo_fp(_sqlite3RCStrUnref) { + /* Blindly assume that all RCStr objects are zero-terminated */ + p2 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Term)) + return + } + } else { + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc >= (*TMem)(unsafe.Pointer(pMem)).Fn+int32(1) { + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn))) = 0 + p3 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(MEM_Term)) + return + } + } +} + +// C documentation +// +// /* +// ** It is already known that pMem contains an unterminated string. +// ** Add the zero terminator. +// ** +// ** Three bytes of zero are added. In this way, there is guaranteed +// ** to be a double-zero byte at an even byte boundary in order to +// ** terminate a UTF16 string, even if the initial size of the buffer +// ** is an odd number of bytes. +// */ +func _vdbeMemAddTerminator(tls *libc.TLS, pMem uintptr) (r int32) { + var p1 uintptr + _ = p1 + if _sqlite3VdbeMemGrow(tls, pMem, (*TMem)(unsafe.Pointer(pMem)).Fn+int32(3), int32(1)) != 0 { + return int32(SQLITE_NOMEM) + } + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn))) = 0 + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn+int32(1)))) = 0 + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr((*TMem)(unsafe.Pointer(pMem)).Fn+int32(2)))) = 0 + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Term)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Change pMem so that its MEM_Str or MEM_Blob value is stored in +// ** MEM.zMalloc, where it can be safely written. +// ** +// ** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails. +// */ +func _sqlite3VdbeMemMakeWriteable(tls *libc.TLS, pMem uintptr) (r int32) { + var rc, v1 int32 + var p2 uintptr + _, _, _ = rc, v1, p2 + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Zero) != 0 { + v1 = _sqlite3VdbeMemExpandBlob(tls, pMem) + } else { + v1 = 0 + } + if v1 != 0 { + return int32(SQLITE_NOMEM) + } + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc == 0 || (*TMem)(unsafe.Pointer(pMem)).Fz != (*TMem)(unsafe.Pointer(pMem)).FzMalloc { + rc = _vdbeMemAddTerminator(tls, pMem) + if rc != 0 { + return rc + } + } + } + p2 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(MEM_Ephem)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If the given Mem* has a zero-filled tail, turn it into an ordinary +// ** blob stored in dynamically allocated space. +// */ +func _sqlite3VdbeMemExpandBlob(tls *libc.TLS, pMem uintptr) (r int32) { + var nByte int32 + var p1 uintptr + _, _ = nByte, p1 + /* Set nByte to the number of bytes required to store the expanded blob. */ + nByte = (*TMem)(unsafe.Pointer(pMem)).Fn + *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)) + if nByte <= 0 { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Blob) == 0 { + return SQLITE_OK + } + nByte = int32(1) + } + if _sqlite3VdbeMemGrow(tls, pMem, nByte, int32(1)) != 0 { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, (*TMem)(unsafe.Pointer(pMem)).Fz+uintptr((*TMem)(unsafe.Pointer(pMem)).Fn), 0, uint64(*(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)))) + *(*int32)(unsafe.Pointer(pMem + 16)) += *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)) + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(MEM_Zero) | libc.Int32FromInt32(MEM_Term))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Make sure the given Mem is \u0000 terminated. +// */ +func _sqlite3VdbeMemNulTerminate(tls *libc.TLS, pMem uintptr) (r int32) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Term)|libc.Int32FromInt32(MEM_Str)) != int32(MEM_Str) { + return SQLITE_OK /* Nothing to do */ + } else { + return _vdbeMemAddTerminator(tls, pMem) + } + return r +} + +// C documentation +// +// /* +// ** Add MEM_Str to the set of representations for the given Mem. This +// ** routine is only called if pMem is a number of some kind, not a NULL +// ** or a BLOB. +// ** +// ** Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated +// ** if bForce is true but are retained if bForce is false. +// ** +// ** A MEM_Null value will never be passed to this function. This function is +// ** used for converting values to text for returning to the user (i.e. via +// ** sqlite3_value_text()), or for ensuring that values to be used as btree +// ** keys are strings. In the former case a NULL pointer is returned the +// ** user and the latter is an internal programming error. +// */ +func _sqlite3VdbeMemStringify(tls *libc.TLS, pMem uintptr, enc Tu8, bForce Tu8) (r int32) { + var nByte int32 + var p1, p2 uintptr + _, _, _ = nByte, p1, p2 + nByte = int32(32) + if _sqlite3VdbeMemClearAndResize(tls, pMem, nByte) != 0 { + (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(0) + return int32(SQLITE_NOMEM) + } + _vdbeMemRenderNum(tls, nByte, (*TMem)(unsafe.Pointer(pMem)).Fz, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(SQLITE_UTF8) + p1 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Term))) + if bForce != 0 { + p2 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } + _sqlite3VdbeChangeEncoding(tls, pMem, int32(enc)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Memory cell pMem contains the context of an aggregate function. +// ** This routine calls the finalize method for that function. The +// ** result of the aggregate is stored back into pMem. +// ** +// ** Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK +// ** otherwise. +// */ +func _sqlite3VdbeMemFinalize(tls *libc.TLS, pMem uintptr, pFunc uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var _ /* ctx at bp+0 */ Tsqlite3_context + var _ /* t at bp+56 */ TMem + libc.Xmemset(tls, bp, 0, uint64(56)) + libc.Xmemset(tls, bp+56, 0, uint64(56)) + (*(*TMem)(unsafe.Pointer(bp + 56))).Fflags = uint16(MEM_Null) + (*(*TMem)(unsafe.Pointer(bp + 56))).Fdb = (*TMem)(unsafe.Pointer(pMem)).Fdb + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpOut = bp + 56 + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpMem = pMem + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpFunc = pFunc + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).Fenc = (*Tsqlite3)(unsafe.Pointer((*(*TMem)(unsafe.Pointer(bp + 56))).Fdb)).Fenc + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer(pFunc)).FxFinalize})))(tls, bp) /* IMP: R-24505-23230 */ + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) + } + libc.Xmemcpy(tls, pMem, bp+56, uint64(56)) + return (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError +} + +// C documentation +// +// /* +// ** Memory cell pAccum contains the context of an aggregate function. +// ** This routine calls the xValue method for that function and stores +// ** the results in memory cell pMem. +// ** +// ** SQLITE_ERROR is returned if xValue() reports an error. SQLITE_OK +// ** otherwise. +// */ +func _sqlite3VdbeMemAggValue(tls *libc.TLS, pAccum uintptr, pOut uintptr, pFunc uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var _ /* ctx at bp+0 */ Tsqlite3_context + libc.Xmemset(tls, bp, 0, uint64(56)) + _sqlite3VdbeMemSetNull(tls, pOut) + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpOut = pOut + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpMem = pAccum + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpFunc = pFunc + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).Fenc = (*Tsqlite3)(unsafe.Pointer((*TMem)(unsafe.Pointer(pAccum)).Fdb)).Fenc + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer(pFunc)).FxValue})))(tls, bp) + return (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError +} + +// C documentation +// +// /* +// ** If the memory cell contains a value that must be freed by +// ** invoking the external callback in Mem.xDel, then this routine +// ** will free that value. It also sets Mem.flags to MEM_Null. +// ** +// ** This is a helper routine for sqlite3VdbeMemSetNull() and +// ** for sqlite3VdbeMemRelease(). Use those other routines as the +// ** entry point for releasing Mem resources. +// */ +func _vdbeMemClearExternAndSetNull(tls *libc.TLS, p uintptr) { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Agg) != 0 { + _sqlite3VdbeMemFinalize(tls, p, *(*uintptr)(unsafe.Pointer(p))) + } + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Dyn) != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMem)(unsafe.Pointer(p)).FxDel})))(tls, (*TMem)(unsafe.Pointer(p)).Fz) + } + (*TMem)(unsafe.Pointer(p)).Fflags = uint16(MEM_Null) +} + +// C documentation +// +// /* +// ** Release memory held by the Mem p, both external memory cleared +// ** by p->xDel and memory in p->zMalloc. +// ** +// ** This is a helper routine invoked by sqlite3VdbeMemRelease() in +// ** the unusual case where there really is memory in p that needs +// ** to be freed. +// */ +func _vdbeMemClear(tls *libc.TLS, p uintptr) { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _vdbeMemClearExternAndSetNull(tls, p) + } + if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(p)).Fdb, (*TMem)(unsafe.Pointer(p)).FzMalloc) + (*TMem)(unsafe.Pointer(p)).FszMalloc = 0 + } + (*TMem)(unsafe.Pointer(p)).Fz = uintptr(0) +} + +// C documentation +// +// /* +// ** Release any memory resources held by the Mem. Both the memory that is +// ** free by Mem.xDel and the Mem.zMalloc allocation are freed. +// ** +// ** Use this routine prior to clean up prior to abandoning a Mem, or to +// ** reset a Mem back to its minimum memory utilization. +// ** +// ** Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space +// ** prior to inserting new content into the Mem. +// */ +func _sqlite3VdbeMemRelease(tls *libc.TLS, p uintptr) { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 || (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _vdbeMemClear(tls, p) + } +} + +// C documentation +// +// /* Like sqlite3VdbeMemRelease() but faster for cases where we +// ** know in advance that the Mem is not MEM_Dyn or MEM_Agg. +// */ +func _sqlite3VdbeMemReleaseMalloc(tls *libc.TLS, p uintptr) { + if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _vdbeMemClear(tls, p) + } +} + +// C documentation +// +// /* +// ** Return some kind of integer value which is the best we can do +// ** at representing the value that *pMem describes as an integer. +// ** If pMem is an integer, then the value is exact. If pMem is +// ** a floating-point then the value returned is the integer part. +// ** If pMem is a string or blob, then we make an attempt to convert +// ** it into an integer and return that. If pMem represents an +// ** an SQL-NULL value, return 0. +// ** +// ** If pMem represents a string value, its encoding might be changed. +// */ +func _memIntValue(tls *libc.TLS, pMem uintptr) (r Ti64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* value at bp+0 */ Ti64 + *(*Ti64)(unsafe.Pointer(bp)) = 0 + _sqlite3Atoi64(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, bp, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) + return *(*Ti64)(unsafe.Pointer(bp)) +} + +func _sqlite3VdbeIntValue(tls *libc.TLS, pMem uintptr) (r Ti64) { + var flags int32 + _ = flags + flags = int32((*TMem)(unsafe.Pointer(pMem)).Fflags) + if flags&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + return *(*Ti64)(unsafe.Pointer(pMem)) + } else { + if flags&int32(MEM_Real) != 0 { + return _sqlite3RealToI64(tls, *(*float64)(unsafe.Pointer(pMem))) + } else { + if flags&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 && (*TMem)(unsafe.Pointer(pMem)).Fz != uintptr(0) { + return _memIntValue(tls, pMem) + } else { + return 0 + } + } + } + return r +} + +// C documentation +// +// /* +// ** Return the best representation of pMem that we can get into a +// ** double. If pMem is already a double or an integer, return its +// ** value. If it is a string or blob, try to convert it to a double. +// ** If it is a NULL, return 0.0. +// */ +func _memRealValue(tls *libc.TLS, pMem uintptr) (r float64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* val at bp+0 */ float64 + /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ + *(*float64)(unsafe.Pointer(bp)) = libc.Float64FromInt32(0) + _sqlite3AtoF(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, bp, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) + return *(*float64)(unsafe.Pointer(bp)) +} + +func _sqlite3VdbeRealValue(tls *libc.TLS, pMem uintptr) (r float64) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Real) != 0 { + return *(*float64)(unsafe.Pointer(pMem)) + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + return float64(*(*Ti64)(unsafe.Pointer(pMem))) + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + return _memRealValue(tls, pMem) + } else { + /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ + return libc.Float64FromInt32(0) + } + } + } + return r +} + +// C documentation +// +// /* +// ** Return 1 if pMem represents true, and return 0 if pMem represents false. +// ** Return the value ifNull if pMem is NULL. +// */ +func _sqlite3VdbeBooleanValue(tls *libc.TLS, pMem uintptr, ifNull int32) (r int32) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + return libc.BoolInt32(*(*Ti64)(unsafe.Pointer(pMem)) != 0) + } + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { + return ifNull + } + return libc.BoolInt32(_sqlite3VdbeRealValue(tls, pMem) != float64(0)) +} + +// C documentation +// +// /* +// ** The MEM structure is already a MEM_Real or MEM_IntReal. Try to +// ** make it a MEM_Int if we can. +// */ +func _sqlite3VdbeIntegerAffinity(tls *libc.TLS, pMem uintptr) { + var ix Ti64 + _ = ix + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_IntReal) != 0 { + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) + } else { + ix = _sqlite3RealToI64(tls, *(*float64)(unsafe.Pointer(pMem))) + /* Only mark the value as an integer if + ** + ** (1) the round-trip conversion real->int->real is a no-op, and + ** (2) The integer is neither the largest nor the smallest + ** possible integer (ticket #3922) + ** + ** The second and third terms in the following conditional enforces + ** the second condition under the assumption that addition overflow causes + ** values to wrap around. + */ + if *(*float64)(unsafe.Pointer(pMem)) == float64(ix) && ix > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= -int64(2251799813685248) && i < int64(2251799813685248)) +} + +// C documentation +// +// /* Convert a floating point value to its closest integer. Do so in +// ** a way that avoids 'outside the range of representable values' warnings +// ** from UBSAN. +// */ +func _sqlite3RealToI64(tls *libc.TLS, r float64) (r1 Ti64) { + if r < -libc.Float64FromFloat64(9.223372036854775e+18) { + return int64(-libc.Int32FromInt32(1)) - (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)< +libc.Float64FromFloat64(9.223372036854775e+18) { + return libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)<>libc.Int32FromInt32(3)) + _sqlite3ValueApplyAffinity(tls, pMem, uint8(SQLITE_AFF_TEXT), encoding) + p3 = pMem + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal) | libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Zero))) + if int32(encoding) != int32(SQLITE_UTF8) { + *(*int32)(unsafe.Pointer(pMem + 16)) &= ^libc.Int32FromInt32(1) + } + rc = _sqlite3VdbeChangeEncoding(tls, pMem, int32(encoding)) + if rc != 0 { + return rc + } + _sqlite3VdbeMemZeroTerminateIfAble(tls, pMem) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Initialize bulk memory to be a consistent Mem object. +// ** +// ** The minimum amount of initialization feasible is performed. +// */ +func _sqlite3VdbeMemInit(tls *libc.TLS, pMem uintptr, db uintptr, flags Tu16) { + (*TMem)(unsafe.Pointer(pMem)).Fflags = flags + (*TMem)(unsafe.Pointer(pMem)).Fdb = db + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = 0 +} + +// C documentation +// +// /* +// ** Delete any previous value and set the value stored in *pMem to NULL. +// ** +// ** This routine calls the Mem.xDel destructor to dispose of values that +// ** require the destructor. But it preserves the Mem.zMalloc memory allocation. +// ** To free all resources, use sqlite3VdbeMemRelease(), which both calls this +// ** routine to invoke the destructor and deallocates Mem.zMalloc. +// ** +// ** Use this routine to reset the Mem prior to insert a new value. +// ** +// ** Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it. +// */ +func _sqlite3VdbeMemSetNull(tls *libc.TLS, pMem uintptr) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _vdbeMemClearExternAndSetNull(tls, pMem) + } else { + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Null) + } +} + +func _sqlite3ValueSetNull(tls *libc.TLS, p uintptr) { + _sqlite3VdbeMemSetNull(tls, p) +} + +// C documentation +// +// /* +// ** Delete any previous value and set the value to be a BLOB of length +// ** n containing all zeros. +// */ +func _sqlite3VdbeMemSetZeroBlob(tls *libc.TLS, pMem uintptr, n int32) { + _sqlite3VdbeMemRelease(tls, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Zero)) + (*TMem)(unsafe.Pointer(pMem)).Fn = 0 + if n < 0 { + n = 0 + } + *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pMem)).Fu)) = n + (*TMem)(unsafe.Pointer(pMem)).Fenc = uint8(SQLITE_UTF8) + (*TMem)(unsafe.Pointer(pMem)).Fz = uintptr(0) +} + +// C documentation +// +// /* +// ** The pMem is known to contain content that needs to be destroyed prior +// ** to a value change. So invoke the destructor, then set the value to +// ** a 64-bit integer. +// */ +func _vdbeReleaseAndSetInt64(tls *libc.TLS, pMem uintptr, val Ti64) { + _sqlite3VdbeMemSetNull(tls, pMem) + *(*Ti64)(unsafe.Pointer(pMem)) = val + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Int) +} + +// C documentation +// +// /* +// ** Delete any previous value and set the value stored in *pMem to val, +// ** manifest type INTEGER. +// */ +func _sqlite3VdbeMemSetInt64(tls *libc.TLS, pMem uintptr, val Ti64) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _vdbeReleaseAndSetInt64(tls, pMem, val) + } else { + *(*Ti64)(unsafe.Pointer(pMem)) = val + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Int) + } +} + +// C documentation +// +// /* A no-op destructor */ +func _sqlite3NoopDestructor(tls *libc.TLS, p uintptr) { + _ = p +} + +// C documentation +// +// /* +// ** Set the value stored in *pMem should already be a NULL. +// ** Also store a pointer to go with it. +// */ +func _sqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr) { + var v1, v2 uintptr + _, _ = v1, v2 + _vdbeMemClear(tls, pMem) + if zPType != 0 { + v1 = zPType + } else { + v1 = __ccgo_ts + 1680 + } + *(*uintptr)(unsafe.Pointer(pMem)) = v1 + (*TMem)(unsafe.Pointer(pMem)).Fz = pPtr + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(libc.Int32FromInt32(MEM_Null) | libc.Int32FromInt32(MEM_Dyn) | libc.Int32FromInt32(MEM_Subtype) | libc.Int32FromInt32(MEM_Term)) + (*TMem)(unsafe.Pointer(pMem)).FeSubtype = uint8('p') + if xDestructor != 0 { + v2 = xDestructor + } else { + v2 = __ccgo_fp(_sqlite3NoopDestructor) + } + (*TMem)(unsafe.Pointer(pMem)).FxDel = v2 +} + +// C documentation +// +// /* +// ** Delete any previous value and set the value stored in *pMem to val, +// ** manifest type REAL. +// */ +func _sqlite3VdbeMemSetDouble(tls *libc.TLS, pMem uintptr, val float64) { + _sqlite3VdbeMemSetNull(tls, pMem) + if !(_sqlite3IsNaN(tls, val) != 0) { + *(*float64)(unsafe.Pointer(pMem)) = val + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Real) + } +} + +// C documentation +// +// /* +// ** Delete any previous value and set the value of pMem to be an +// ** empty boolean index. +// ** +// ** Return SQLITE_OK on success and SQLITE_NOMEM if a memory allocation +// ** error occurs. +// */ +func _sqlite3VdbeMemSetRowSet(tls *libc.TLS, pMem uintptr) (r int32) { + var db, p uintptr + _, _ = db, p + db = (*TMem)(unsafe.Pointer(pMem)).Fdb + _sqlite3VdbeMemRelease(tls, pMem) + p = _sqlite3RowSetInit(tls, db) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TMem)(unsafe.Pointer(pMem)).Fz = p + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Dyn)) + (*TMem)(unsafe.Pointer(pMem)).FxDel = __ccgo_fp(_sqlite3RowSetDelete) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return true if the Mem object contains a TEXT or BLOB that is +// ** too large - whose size exceeds SQLITE_MAX_LENGTH. +// */ +func _sqlite3VdbeMemTooBig(tls *libc.TLS, p uintptr) (r int32) { + var n int32 + _ = n + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + n = (*TMem)(unsafe.Pointer(p)).Fn + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Zero) != 0 { + n += *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(p)).Fu)) + } + return libc.BoolInt32(n > *(*int32)(unsafe.Pointer((*TMem)(unsafe.Pointer(p)).Fdb + 136))) + } + return 0 +} + +// C documentation +// +// /* +// ** Make an shallow copy of pFrom into pTo. Prior contents of +// ** pTo are freed. The pFrom->z field is not duplicated. If +// ** pFrom->z is used, then pTo->z points to the same thing as pFrom->z +// ** and flags gets srcType (either MEM_Ephem or MEM_Static). +// */ +func _vdbeClrCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, eType int32) { + _vdbeMemClearExternAndSetNull(tls, pTo) + _sqlite3VdbeMemShallowCopy(tls, pTo, pFrom, eType) +} + +func _sqlite3VdbeMemShallowCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, srcType int32) { + var p1, p2 uintptr + _, _ = p1, p2 + if int32((*TMem)(unsafe.Pointer(pTo)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _vdbeClrCopy(tls, pTo, pFrom, srcType) + return + } + libc.Xmemcpy(tls, pTo, pFrom, uint64(libc.UintptrFromInt32(0)+24)) + if int32((*TMem)(unsafe.Pointer(pFrom)).Fflags)&int32(MEM_Static) == 0 { + p1 = pTo + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(MEM_Dyn) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Ephem))) + p2 = pTo + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | srcType) + } +} + +// C documentation +// +// /* +// ** Make a full copy of pFrom into pTo. Prior contents of pTo are +// ** freed before the copy is made. +// */ +func _sqlite3VdbeMemCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr) (r int32) { + var rc int32 + var p1, p2 uintptr + _, _, _ = rc, p1, p2 + rc = SQLITE_OK + if int32((*TMem)(unsafe.Pointer(pTo)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _vdbeMemClearExternAndSetNull(tls, pTo) + } + libc.Xmemcpy(tls, pTo, pFrom, uint64(libc.UintptrFromInt32(0)+24)) + p1 = pTo + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(MEM_Dyn)) + if int32((*TMem)(unsafe.Pointer(pTo)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + if 0 == int32((*TMem)(unsafe.Pointer(pFrom)).Fflags)&int32(MEM_Static) { + p2 = pTo + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Ephem)) + rc = _sqlite3VdbeMemMakeWriteable(tls, pTo) + } + } + return rc +} + +// C documentation +// +// /* +// ** Transfer the contents of pFrom to pTo. Any existing value in pTo is +// ** freed. If pFrom contains ephemeral data, a copy is made. +// ** +// ** pFrom contains an SQL NULL when this routine returns. +// */ +func _sqlite3VdbeMemMove(tls *libc.TLS, pTo uintptr, pFrom uintptr) { + _sqlite3VdbeMemRelease(tls, pTo) + libc.Xmemcpy(tls, pTo, pFrom, uint64(56)) + (*TMem)(unsafe.Pointer(pFrom)).Fflags = uint16(MEM_Null) + (*TMem)(unsafe.Pointer(pFrom)).FszMalloc = 0 +} + +// C documentation +// +// /* +// ** Change the value of a Mem to be a string or a BLOB. +// ** +// ** The memory management strategy depends on the value of the xDel +// ** parameter. If the value passed is SQLITE_TRANSIENT, then the +// ** string is copied into a (possibly existing) buffer managed by the +// ** Mem structure. Otherwise, any existing buffer is freed and the +// ** pointer copied. +// ** +// ** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH +// ** size limit) then no memory allocation occurs. If the string can be +// ** stored without allocating memory, then it is. If a memory allocation +// ** is required to store the string, then value of pMem is unchanged. In +// ** either case, SQLITE_TOOBIG is returned. +// ** +// ** The "enc" parameter is the text encoding for the string, or zero +// ** to store a blob. +// ** +// ** If n is negative, then the string consists of all bytes up to but +// ** excluding the first zero character. The n parameter must be +// ** non-negative for blobs. +// */ +func _sqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n Ti64, enc Tu8, xDel uintptr) (r int32) { + var flags Tu16 + var iLimit, v2, v4 int32 + var nAlloc, nByte Ti64 + var v3 int64 + _, _, _, _, _, _, _ = flags, iLimit, nAlloc, nByte, v2, v3, v4 + nByte = n /* New value for pMem->flags */ + /* If z is a NULL pointer, set pMem to contain an SQL NULL. */ + if !(z != 0) { + _sqlite3VdbeMemSetNull(tls, pMem) + return SQLITE_OK + } + if (*TMem)(unsafe.Pointer(pMem)).Fdb != 0 { + iLimit = *(*int32)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fdb + 136)) + } else { + iLimit = int32(SQLITE_MAX_LENGTH) + } + if nByte < 0 { + if int32(enc) == int32(SQLITE_UTF8) { + nByte = int64(libc.Xstrlen(tls, z)) + } else { + nByte = 0 + for { + if !(nByte <= int64(iLimit) && int32(*(*int8)(unsafe.Pointer(z + uintptr(nByte))))|int32(*(*int8)(unsafe.Pointer(z + uintptr(nByte+int64(1))))) != 0) { + break + } + goto _1 + _1: + ; + nByte += int64(2) + } + } + flags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Term)) + } else { + if int32(enc) == 0 { + flags = uint16(MEM_Blob) + enc = uint8(SQLITE_UTF8) + } else { + flags = uint16(MEM_Str) + } + } + if nByte > int64(iLimit) { + if xDel != 0 && xDel != uintptr(-libc.Int32FromInt32(1)) { + if xDel == __ccgo_fp(_sqlite3OomClear) { + _sqlite3DbFree(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, z) + } else { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDel})))(tls, z) + } + } + _sqlite3VdbeMemSetNull(tls, pMem) + return _sqlite3ErrorToParser(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, int32(SQLITE_TOOBIG)) + } + /* The following block sets the new values of Mem.z and Mem.xDel. It + ** also sets a flag in local variable "flags" to indicate the memory + ** management (one of MEM_Dyn or MEM_Static). + */ + if xDel == uintptr(-libc.Int32FromInt32(1)) { + nAlloc = nByte + if int32(flags)&int32(MEM_Term) != 0 { + if int32(enc) == int32(SQLITE_UTF8) { + v2 = int32(1) + } else { + v2 = int32(2) + } + nAlloc += int64(v2) + } + if nAlloc > int64(libc.Int32FromInt32(32)) { + v3 = nAlloc + } else { + v3 = int64(libc.Int32FromInt32(32)) + } + if _sqlite3VdbeMemClearAndResize(tls, pMem, int32(v3)) != 0 { + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, z, uint64(nAlloc)) + } else { + _sqlite3VdbeMemRelease(tls, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fz = z + if xDel == __ccgo_fp(_sqlite3OomClear) { + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = (*TMem)(unsafe.Pointer(pMem)).Fz + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = _sqlite3DbMallocSize(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) + } else { + (*TMem)(unsafe.Pointer(pMem)).FxDel = xDel + if xDel == libc.UintptrFromInt32(0) { + v4 = int32(MEM_Static) + } else { + v4 = int32(MEM_Dyn) + } + flags = Tu16(int32(flags) | v4) + } + } + (*TMem)(unsafe.Pointer(pMem)).Fn = int32(nByte & libc.Int64FromInt32(0x7fffffff)) + (*TMem)(unsafe.Pointer(pMem)).Fflags = flags + (*TMem)(unsafe.Pointer(pMem)).Fenc = enc + if int32(enc) > int32(SQLITE_UTF8) && _sqlite3VdbeMemHandleBom(tls, pMem) != 0 { + return int32(SQLITE_NOMEM) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Move data out of a btree key or data field and into a Mem structure. +// ** The data is payload from the entry that pCur is currently pointing +// ** to. offset and amt determine what portion of the data or key to retrieve. +// ** The result is written into the pMem element. +// ** +// ** The pMem object must have been initialized. This routine will use +// ** pMem->zMalloc to hold the content from the btree, if possible. New +// ** pMem->zMalloc space will be allocated if necessary. The calling routine +// ** is responsible for making sure that the pMem object is eventually +// ** destroyed. +// ** +// ** If this routine fails for any reason (malloc returns NULL or unable +// ** to read from the disk) then the pMem is left in an inconsistent state. +// */ +func _sqlite3VdbeMemFromBtree(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pMem uintptr) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Null) + if _sqlite3BtreeMaxRecordSize(tls, pCur) < int64(offset+amt) { + return _sqlite3CorruptError(tls, int32(83638)) + } + v1 = _sqlite3VdbeMemClearAndResize(tls, pMem, int32(amt+uint32(1))) + rc = v1 + if SQLITE_OK == v1 { + rc = _sqlite3BtreePayload(tls, pCur, offset, amt, (*TMem)(unsafe.Pointer(pMem)).Fz) + if rc == SQLITE_OK { + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr(amt))) = 0 /* Overrun area used when reading malformed records */ + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Blob) + (*TMem)(unsafe.Pointer(pMem)).Fn = int32(amt) + } else { + _sqlite3VdbeMemRelease(tls, pMem) + } + } + return rc +} + +func _sqlite3VdbeMemFromBtreeZeroOffset(tls *libc.TLS, pCur uintptr, amt Tu32, pMem uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* available at bp+0 */ Tu32 + _ = rc + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) /* Number of bytes available on the local btree page */ + rc = SQLITE_OK /* Return code */ + /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() + ** that both the BtShared and database handle mutexes are held. */ + (*TMem)(unsafe.Pointer(pMem)).Fz = _sqlite3BtreePayloadFetch(tls, pCur, bp) + if amt <= *(*Tu32)(unsafe.Pointer(bp)) { + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Ephem)) + (*TMem)(unsafe.Pointer(pMem)).Fn = int32(amt) + } else { + rc = _sqlite3VdbeMemFromBtree(tls, pCur, uint32(0), amt, pMem) + } + return rc +} + +// C documentation +// +// /* +// ** The pVal argument is known to be a value other than NULL. +// ** Convert it into a string with encoding enc and return a pointer +// ** to a zero-terminated version of that string. +// */ +func _valueToText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { + var v1 int32 + var p2 uintptr + _, _ = v1, p2 + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Blob)|libc.Int32FromInt32(MEM_Str)) != 0 { + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Zero) != 0 { + v1 = _sqlite3VdbeMemExpandBlob(tls, pVal) + } else { + v1 = 0 + } + if v1 != 0 { + return uintptr(0) + } + p2 = pVal + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Str)) + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) != int32(enc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED) { + _sqlite3VdbeChangeEncoding(tls, pVal, int32(enc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED)) + } + if int32(enc)&int32(SQLITE_UTF16_ALIGNED) != 0 && int32(1) == int32(1)&int32(int64((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz)) { + if _sqlite3VdbeMemMakeWriteable(tls, pVal) != SQLITE_OK { + return uintptr(0) + } + } + _sqlite3VdbeMemNulTerminate(tls, pVal) /* IMP: R-31275-44060 */ + } else { + _sqlite3VdbeMemStringify(tls, pVal, enc, uint8(0)) + } + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED) { + return (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz + } else { + return uintptr(0) + } + return r +} + +// C documentation +// +// /* This function is only available internally, it is not part of the +// ** external API. It works in a similar way to sqlite3_value_text(), +// ** except the data returned is in the encoding specified by the second +// ** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or +// ** SQLITE_UTF8. +// ** +// ** (2006-02-16:) The enc value can be or-ed with SQLITE_UTF16_ALIGNED. +// ** If that is the case, then the result must be aligned on an even byte +// ** boundary. +// */ +func _sqlite3ValueText(tls *libc.TLS, pVal uintptr, enc Tu8) (r uintptr) { + if !(pVal != 0) { + return uintptr(0) + } + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Term)) == libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Term) && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) { + return (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz + } + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Null) != 0 { + return uintptr(0) + } + return _valueToText(tls, pVal, enc) +} + +// C documentation +// +// /* Return true if sqlit3_value object pVal is a string or blob value +// ** that uses the destructor specified in the second argument. +// ** +// ** TODO: Maybe someday promote this interface into a published API so +// ** that third-party extensions can get access to it? +// */ +func _sqlite3ValueIsOfClass(tls *libc.TLS, pVal uintptr, xFree uintptr) (r int32) { + if pVal != uintptr(0) && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) != 0 && (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel == xFree { + return int32(1) + } else { + return 0 + } + return r +} + +// C documentation +// +// /* +// ** Create a new sqlite3_value object. +// */ +func _sqlite3ValueNew(tls *libc.TLS, db uintptr) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3DbMallocZero(tls, db, uint64(56)) + if p != 0 { + (*TMem)(unsafe.Pointer(p)).Fflags = uint16(MEM_Null) + (*TMem)(unsafe.Pointer(p)).Fdb = db + } + return p +} + +/* +** Context object passed by sqlite3Stat4ProbeSetValue() through to +** valueNew(). See comments above valueNew() for details. + */ +type TValueNewStat4Ctx = struct { + FpParse uintptr + FpIdx uintptr + FppRec uintptr + FiVal int32 +} + +type ValueNewStat4Ctx = TValueNewStat4Ctx + +// C documentation +// +// /* +// ** Allocate and return a pointer to a new sqlite3_value object. If +// ** the second argument to this function is NULL, the object is allocated +// ** by calling sqlite3ValueNew(). +// ** +// ** Otherwise, if the second argument is non-zero, then this function is +// ** being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not +// ** already been allocated, allocate the UnpackedRecord structure that +// ** that function will return to its caller here. Then return a pointer to +// ** an sqlite3_value within the UnpackedRecord.a[] array. +// */ +func _valueNew(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + var i, nByte, nCol int32 + var pIdx, pRec uintptr + _, _, _, _, _ = i, nByte, nCol, pIdx, pRec + if p != 0 { + pRec = *(*uintptr)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(p)).FppRec)) + if pRec == uintptr(0) { + pIdx = (*TValueNewStat4Ctx)(unsafe.Pointer(p)).FpIdx /* Counter variable */ + nCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) /* Number of index columns including rowid */ + nByte = int32(uint64(56)*uint64(nCol) + (libc.Uint64FromInt64(40)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + pRec = _sqlite3DbMallocZero(tls, db, uint64(nByte)) + if pRec != 0 { + (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo = _sqlite3KeyInfoOfIndex(tls, (*TValueNewStat4Ctx)(unsafe.Pointer(p)).FpParse, pIdx) + if (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo != 0 { + (*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem = pRec + uintptr((libc.Uint64FromInt64(40)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + i = 0 + for { + if !(i < nCol) { + break + } + (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr(i)*56))).Fflags = uint16(MEM_Null) + (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr(i)*56))).Fdb = db + goto _1 + _1: + ; + i++ + } + } else { + _sqlite3DbFreeNN(tls, db, pRec) + pRec = uintptr(0) + } + } + if pRec == uintptr(0) { + return uintptr(0) + } + *(*uintptr)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(p)).FppRec)) = pRec + } + (*TUnpackedRecord)(unsafe.Pointer(pRec)).FnField = uint16((*TValueNewStat4Ctx)(unsafe.Pointer(p)).FiVal + int32(1)) + _sqlite3VdbeMemSetNull(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem+uintptr((*TValueNewStat4Ctx)(unsafe.Pointer(p)).FiVal)*56) + return (*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr((*TValueNewStat4Ctx)(unsafe.Pointer(p)).FiVal)*56 + } + return _sqlite3ValueNew(tls, db) +} + +// C documentation +// +// /* +// ** The expression object indicated by the second argument is guaranteed +// ** to be a scalar SQL function. If +// ** +// ** * all function arguments are SQL literals, +// ** * one of the SQLITE_FUNC_CONSTANT or _SLOCHNG function flags is set, and +// ** * the SQLITE_FUNC_NEEDCOLL function flag is not set, +// ** +// ** then this routine attempts to invoke the SQL function. Assuming no +// ** error occurs, output parameter (*ppVal) is set to point to a value +// ** object containing the result before returning SQLITE_OK. +// ** +// ** Affinity aff is applied to the result of the function before returning. +// ** If the result is a text value, the sqlite3_value object uses encoding +// ** enc. +// ** +// ** If the conditions above are not met, this function returns SQLITE_OK +// ** and sets (*ppVal) to NULL. Or, if an error occurs, (*ppVal) is set to +// ** NULL and an SQLite error code returned. +// */ +func _valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc Tu8, aff Tu8, ppVal uintptr, pCtx uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var apVal, pFunc, pList, pVal uintptr + var i, nVal, rc int32 + var _ /* ctx at bp+0 */ Tsqlite3_context + _, _, _, _, _, _, _ = apVal, i, nVal, pFunc, pList, pVal, rc /* Context object for function invocation */ + apVal = uintptr(0) /* Function arguments */ + nVal = 0 /* Size of apVal[] array */ + pFunc = uintptr(0) /* Function definition */ + pVal = uintptr(0) /* New value */ + rc = SQLITE_OK /* Return code */ + pList = uintptr(0) /* Iterator variable */ + pList = *(*uintptr)(unsafe.Pointer(p + 32)) + if pList != 0 { + nVal = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } + pFunc = _sqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(p + 8)), nVal, enc, uint8(0)) + if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)|libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG)) == uint32(0) || (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)|libc.Int32FromInt32(SQLITE_FUNC_RUNONLY)) != uint32(0) { + return SQLITE_OK + } + if pList != 0 { + apVal = _sqlite3DbMallocZero(tls, db, uint64(8)*uint64(nVal)) + if apVal == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto value_from_function_out + } + i = 0 + for { + if !(i < nVal) { + break + } + rc = _sqlite3ValueFromExpr(tls, db, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, enc, aff, apVal+uintptr(i)*8) + if *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) == uintptr(0) || rc != SQLITE_OK { + goto value_from_function_out + } + goto _1 + _1: + ; + i++ + } + } + pVal = _valueNew(tls, db, pCtx) + if pVal == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto value_from_function_out + } + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpOut = pVal + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FpFunc = pFunc + (*(*Tsqlite3_context)(unsafe.Pointer(bp))).Fenc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer(pFunc)).FxSFunc})))(tls, bp, nVal, apVal) + if (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError != 0 { + rc = (*(*Tsqlite3_context)(unsafe.Pointer(bp))).FisError + _sqlite3ErrorMsg(tls, (*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, __ccgo_ts+3827, libc.VaList(bp+64, Xsqlite3_value_text(tls, pVal))) + } else { + _sqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) + rc = _sqlite3VdbeChangeEncoding(tls, pVal, int32(enc)) + if rc == SQLITE_OK && _sqlite3VdbeMemTooBig(tls, pVal) != 0 { + rc = int32(SQLITE_TOOBIG) + (*TParse)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).FnErr++ + } + } +value_from_function_out: + ; + if rc != SQLITE_OK { + pVal = uintptr(0) + (*TParse)(unsafe.Pointer((*TValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).Frc = rc + } + if apVal != 0 { + i = 0 + for { + if !(i < nVal) { + break + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + goto _2 + _2: + ; + i++ + } + _sqlite3DbFreeNN(tls, db, apVal) + } + *(*uintptr)(unsafe.Pointer(ppVal)) = pVal + return rc +} + +// C documentation +// +// /* +// ** Extract a value from the supplied expression in the manner described +// ** above sqlite3ValueFromExpr(). Allocate the sqlite3_value object +// ** using valueNew(). +// ** +// ** If pCtx is NULL and an error occurs after the sqlite3_value object +// ** has been allocated, it is freed before returning. Or, if pCtx is not +// ** NULL, it is assumed that the caller will free any allocated object +// ** in all cases. +// */ +func _valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc Tu8, affinity Tu8, ppVal uintptr, pCtx uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aff Tu8 + var nVal, negInt, op, rc, v1, v2 int32 + var zNeg, zVal, p3 uintptr + var _ /* pVal at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _ = aff, nVal, negInt, op, rc, zNeg, zVal, v1, v2, p3 + zVal = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + negInt = int32(1) + zNeg = __ccgo_ts + 1680 + rc = SQLITE_OK + for { + v1 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + op = v1 + if !(v1 == int32(TK_UPLUS) || op == int32(TK_SPAN)) { + break + } + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } + if op == int32(TK_REGISTER) { + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) + } + /* Compressed expressions only appear when parsing the DEFAULT clause + ** on a table column definition, and hence only when pCtx==0. This + ** check ensures that an EP_TokenOnly expression is never passed down + ** into valueFromFunction(). */ + if op == int32(TK_CAST) { + aff = uint8(_sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0))) + rc = _valueFromExpr(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, enc, aff, ppVal, pCtx) + if *(*uintptr)(unsafe.Pointer(ppVal)) != 0 { + if int32((*Tsqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppVal)))).Fflags)&int32(MEM_Zero) != 0 { + v2 = _sqlite3VdbeMemExpandBlob(tls, *(*uintptr)(unsafe.Pointer(ppVal))) + } else { + v2 = 0 + } + rc = v2 + _sqlite3VdbeMemCast(tls, *(*uintptr)(unsafe.Pointer(ppVal)), aff, enc) + _sqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(ppVal)), affinity, enc) + } + return rc + } + /* Handle negative integers in a single step. This is needed in the + ** case when the value is -9223372036854775808. + */ + if op == int32(TK_UMINUS) && (int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == int32(TK_INTEGER) || int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == int32(TK_FLOAT)) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + negInt = -int32(1) + zNeg = __ccgo_ts + 5106 + } + if op == int32(TK_STRING) || op == int32(TK_FLOAT) || op == int32(TK_INTEGER) { + *(*uintptr)(unsafe.Pointer(bp)) = _valueNew(tls, db, pCtx) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + goto no_mem + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != uint32(0) { + _sqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp)), int64(*(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)))*int64(negInt)) + } else { + zVal = _sqlite3MPrintf(tls, db, __ccgo_ts+5108, libc.VaList(bp+16, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + if zVal == uintptr(0) { + goto no_mem + } + _sqlite3ValueSetStr(tls, *(*uintptr)(unsafe.Pointer(bp)), -int32(1), zVal, uint8(SQLITE_UTF8), __ccgo_fp(_sqlite3OomClear)) + } + if (op == int32(TK_INTEGER) || op == int32(TK_FLOAT)) && int32(affinity) == int32(SQLITE_AFF_BLOB) { + _sqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp)), uint8(SQLITE_AFF_NUMERIC), uint8(SQLITE_UTF8)) + } else { + _sqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp)), affinity, uint8(SQLITE_UTF8)) + } + if int32((*Tsqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)) != 0 { + p3 = *(*uintptr)(unsafe.Pointer(bp)) + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(MEM_Str)) + } + if int32(enc) != int32(SQLITE_UTF8) { + rc = _sqlite3VdbeChangeEncoding(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(enc)) + } + } else { + if op == int32(TK_UMINUS) { + /* This branch happens for multiple negative signs. Ex: -(-5) */ + if SQLITE_OK == _valueFromExpr(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, enc, affinity, bp, pCtx) && *(*uintptr)(unsafe.Pointer(bp)) != uintptr(0) { + _sqlite3VdbeMemNumerify(tls, *(*uintptr)(unsafe.Pointer(bp))) + if int32((*Tsqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fflags)&int32(MEM_Real) != 0 { + *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) = -*(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) + } else { + if *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< nRec || iHdr >= *(*int32)(unsafe.Pointer(bp + 4)) { + return _sqlite3CorruptError(tls, int32(84303)) + } + iField = *(*int32)(unsafe.Pointer(bp + 4)) + i = 0 + for { + if !(i <= iCol) { + break + } + if int32(*(*Tu8)(unsafe.Pointer(a + uintptr(iHdr)))) < int32(libc.Uint8FromInt32(0x80)) { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(iHdr)))) + v3 = libc.Int32FromInt32(1) + } else { + v3 = int32(_sqlite3GetVarint32(tls, a+uintptr(iHdr), bp)) + } + iHdr += int32(uint8(v3)) + if iHdr > *(*int32)(unsafe.Pointer(bp + 4)) { + return _sqlite3CorruptError(tls, int32(84309)) + } + szField = int32(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp)))) + iField += szField + goto _2 + _2: + ; + i++ + } + if iField > nRec { + return _sqlite3CorruptError(tls, int32(84315)) + } + if pMem == uintptr(0) { + v4 = _sqlite3ValueNew(tls, db) + *(*uintptr)(unsafe.Pointer(ppVal)) = v4 + pMem = v4 + if pMem == uintptr(0) { + return int32(SQLITE_NOMEM) + } + } + _sqlite3VdbeSerialGet(tls, a+uintptr(iField-szField), *(*Tu32)(unsafe.Pointer(bp)), pMem) + (*TMem)(unsafe.Pointer(pMem)).Fenc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Unless it is NULL, the argument must be an UnpackedRecord object returned +// ** by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes +// ** the object. +// */ +func _sqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { + var aMem, db uintptr + var i, nCol int32 + _, _, _, _ = aMem, db, i, nCol + if pRec != 0 { + nCol = int32((*TKeyInfo)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo)).FnAllField) + aMem = (*TUnpackedRecord)(unsafe.Pointer(pRec)).FaMem + db = (*(*TMem)(unsafe.Pointer(aMem))).Fdb + i = 0 + for { + if !(i < nCol) { + break + } + _sqlite3VdbeMemRelease(tls, aMem+uintptr(i)*56) + goto _1 + _1: + ; + i++ + } + _sqlite3KeyInfoUnref(tls, (*TUnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) + _sqlite3DbFreeNN(tls, db, pRec) + } +} + +// C documentation +// +// /* +// ** Change the string value of an sqlite3_value object +// */ +func _sqlite3ValueSetStr(tls *libc.TLS, v uintptr, n int32, z uintptr, enc Tu8, xDel uintptr) { + if v != 0 { + _sqlite3VdbeMemSetStr(tls, v, z, int64(n), enc, xDel) + } +} + +// C documentation +// +// /* +// ** Free an sqlite3_value object +// */ +func _sqlite3ValueFree(tls *libc.TLS, v uintptr) { + if !(v != 0) { + return + } + _sqlite3VdbeMemRelease(tls, v) + _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(v)).Fdb, v) +} + +// C documentation +// +// /* +// ** The sqlite3ValueBytes() routine returns the number of bytes in the +// ** sqlite3_value object assuming that it uses the encoding "enc". +// ** The valueBytes() routine is a helper function. +// */ +func _valueBytes(tls *libc.TLS, pVal uintptr, enc Tu8) (r int32) { + var v1 int32 + _ = v1 + if _valueToText(tls, pVal, enc) != uintptr(0) { + v1 = (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fn + } else { + v1 = 0 + } + return v1 +} + +func _sqlite3ValueBytes(tls *libc.TLS, pVal uintptr, enc Tu8) (r int32) { + var p uintptr + _ = p + p = pVal + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Str) != 0 && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc) { + return (*TMem)(unsafe.Pointer(p)).Fn + } + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Str) != 0 && int32(enc) != int32(SQLITE_UTF8) && int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) != int32(SQLITE_UTF8) { + return (*TMem)(unsafe.Pointer(p)).Fn + } + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Blob) != 0 { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Zero) != 0 { + return (*TMem)(unsafe.Pointer(p)).Fn + *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(p)).Fu)) + } else { + return (*TMem)(unsafe.Pointer(p)).Fn + } + } + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Null) != 0 { + return 0 + } + return _valueBytes(tls, pVal, enc) +} + +// C documentation +// +// /* +// ** Create a new virtual database engine. +// */ +func _sqlite3VdbeCreate(tls *libc.TLS, pParse uintptr) (r uintptr) { + var db, p uintptr + _, _ = db, p + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = _sqlite3DbMallocRawNN(tls, db, uint64(304)) + if p == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, p+136, 0, libc.Uint64FromInt64(304)-uint64(libc.UintptrFromInt32(0)+136)) + (*TVdbe)(unsafe.Pointer(p)).Fdb = db + if (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe != 0 { + (*TVdbe1)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpVdbe)).FppVPrev = p + 16 + } + (*TVdbe)(unsafe.Pointer(p)).FpVNext = (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe + (*TVdbe)(unsafe.Pointer(p)).FppVPrev = db + 8 + (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe = p + (*TVdbe)(unsafe.Pointer(p)).FpParse = pParse + (*TParse)(unsafe.Pointer(pParse)).FpVdbe = p + _sqlite3VdbeAddOp2(tls, p, int32(OP_Init), 0, int32(1)) + return p +} + +// C documentation +// +// /* +// ** Return the Parse object that owns a Vdbe object. +// */ +func _sqlite3VdbeParser(tls *libc.TLS, p uintptr) (r uintptr) { + return (*TVdbe)(unsafe.Pointer(p)).FpParse +} + +// C documentation +// +// /* +// ** Change the error string stored in Vdbe.zErrMsg +// */ +func _sqlite3VdbeError(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { + var ap Tva_list + _ = ap + _sqlite3DbFree(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) + ap = va + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3VMPrintf(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, zFormat, ap) + _ = ap +} + +// C documentation +// +// /* +// ** Remember the SQL string for a prepared statement. +// */ +func _sqlite3VdbeSetSql(tls *libc.TLS, p uintptr, z uintptr, n int32, prepFlags Tu8) { + if p == uintptr(0) { + return + } + (*TVdbe)(unsafe.Pointer(p)).FprepFlags = prepFlags + if int32(prepFlags)&int32(SQLITE_PREPARE_SAVESQL) == 0 { + (*TVdbe)(unsafe.Pointer(p)).Fexpmask = uint32(0) + } + (*TVdbe)(unsafe.Pointer(p)).FzSql = _sqlite3DbStrNDup(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, z, uint64(n)) +} + +// C documentation +// +// /* +// ** Swap byte-code between two VDBE structures. +// ** +// ** This happens after pB was previously run and returned +// ** SQLITE_SCHEMA. The statement was then reprepared in pA. +// ** This routine transfers the new bytecode in pA over to pB +// ** so that pB can be run again. The old pB byte code is +// ** moved back to pA so that it will be cleaned up when pA is +// ** finalized. +// */ +func _sqlite3VdbeSwap(tls *libc.TLS, pA uintptr, pB uintptr) { + var pTmp, ppTmp, zTmp uintptr + var tmp TVdbe + _, _, _, _ = pTmp, ppTmp, tmp, zTmp + tmp = *(*TVdbe)(unsafe.Pointer(pA)) + *(*TVdbe)(unsafe.Pointer(pA)) = *(*TVdbe)(unsafe.Pointer(pB)) + *(*TVdbe)(unsafe.Pointer(pB)) = tmp + pTmp = (*TVdbe)(unsafe.Pointer(pA)).FpVNext + (*TVdbe)(unsafe.Pointer(pA)).FpVNext = (*TVdbe)(unsafe.Pointer(pB)).FpVNext + (*TVdbe)(unsafe.Pointer(pB)).FpVNext = pTmp + ppTmp = (*TVdbe)(unsafe.Pointer(pA)).FppVPrev + (*TVdbe)(unsafe.Pointer(pA)).FppVPrev = (*TVdbe)(unsafe.Pointer(pB)).FppVPrev + (*TVdbe)(unsafe.Pointer(pB)).FppVPrev = ppTmp + zTmp = (*TVdbe)(unsafe.Pointer(pA)).FzSql + (*TVdbe)(unsafe.Pointer(pA)).FzSql = (*TVdbe)(unsafe.Pointer(pB)).FzSql + (*TVdbe)(unsafe.Pointer(pB)).FzSql = zTmp + (*TVdbe)(unsafe.Pointer(pB)).Fexpmask = (*TVdbe)(unsafe.Pointer(pA)).Fexpmask + (*TVdbe)(unsafe.Pointer(pB)).FprepFlags = (*TVdbe)(unsafe.Pointer(pA)).FprepFlags + libc.Xmemcpy(tls, pB+212, pA+212, uint64(36)) + *(*Tu32)(unsafe.Pointer(pB + 212 + 5*4))++ +} + +// C documentation +// +// /* +// ** Resize the Vdbe.aOp array so that it is at least nOp elements larger +// ** than its current size. nOp is guaranteed to be less than or equal +// ** to 1024/sizeof(Op). +// ** +// ** If an out-of-memory error occurs while resizing the array, return +// ** SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain +// ** unchanged (this is so that any opcodes already allocated can be +// ** correctly deallocated along with the rest of the Vdbe). +// */ +func _growOpArray(tls *libc.TLS, v uintptr, nOp int32) (r int32) { + var nNew Tsqlite3_int64 + var p, pNew uintptr + var v1 int64 + var v2 int32 + _, _, _, _, _ = nNew, p, pNew, v1, v2 + p = (*TVdbe)(unsafe.Pointer(v)).FpParse + if (*TVdbe)(unsafe.Pointer(v)).FnOpAlloc != 0 { + v1 = int64(2) * int64((*TVdbe)(unsafe.Pointer(v)).FnOpAlloc) + } else { + v1 = int64(libc.Uint64FromInt32(1024) / libc.Uint64FromInt64(24)) + } + /* The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force + ** more frequent reallocs and hence provide more opportunities for + ** simulated OOM faults. SQLITE_TEST_REALLOC_STRESS is generally used + ** during testing only. With SQLITE_TEST_REALLOC_STRESS grow the op array + ** by the minimum* amount required until the size reaches 512. Normal + ** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current + ** size of the op array or add 1KB of space, whichever is smaller. */ + nNew = v1 + _ = nOp + /* Ensure that the size of a VDBE does not grow too large */ + if nNew > int64(*(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(p)).Fdb + 136 + 5*4))) { + _sqlite3OomFault(tls, (*TParse)(unsafe.Pointer(p)).Fdb) + return int32(SQLITE_NOMEM) + } + pNew = _sqlite3DbRealloc(tls, (*TParse)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(v)).FaOp, uint64(nNew)*uint64(24)) + if pNew != 0 { + (*TParse)(unsafe.Pointer(p)).FszOpAlloc = _sqlite3DbMallocSize(tls, (*TParse)(unsafe.Pointer(p)).Fdb, pNew) + (*TVdbe)(unsafe.Pointer(v)).FnOpAlloc = int32(uint64((*TParse)(unsafe.Pointer(p)).FszOpAlloc) / uint64(24)) + (*TVdbe)(unsafe.Pointer(v)).FaOp = pNew + } + if pNew != 0 { + v2 = SQLITE_OK + } else { + v2 = int32(SQLITE_NOMEM) + } + return v2 +} + +// C documentation +// +// /* +// ** Slow paths for sqlite3VdbeAddOp3() and sqlite3VdbeAddOp4Int() for the +// ** unusual case when we need to increase the size of the Vdbe.aOp[] array +// ** before adding the new opcode. +// */ +func _growOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) (r int32) { + if _growOpArray(tls, p, int32(1)) != 0 { + return int32(1) + } + return _sqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) +} + +func _addOp4IntSlow(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, p4 int32) (r int32) { + var addr int32 + var pOp uintptr + _, _ = addr, pOp + addr = _sqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) + if int32((*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed) == 0 { + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(-libc.Int32FromInt32(3)) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4.Fi = p4 + } + return addr +} + +// C documentation +// +// /* +// ** Add a new instruction to the list of instructions current in the +// ** VDBE. Return the address of the new instruction. +// ** +// ** Parameters: +// ** +// ** p Pointer to the VDBE +// ** +// ** op The opcode for this instruction +// ** +// ** p1, p2, p3, p4 Operands +// */ +func _sqlite3VdbeAddOp0(tls *libc.TLS, p uintptr, op int32) (r int32) { + return _sqlite3VdbeAddOp3(tls, p, op, 0, 0, 0) +} + +func _sqlite3VdbeAddOp1(tls *libc.TLS, p uintptr, op int32, p1 int32) (r int32) { + return _sqlite3VdbeAddOp3(tls, p, op, p1, 0, 0) +} + +func _sqlite3VdbeAddOp2(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32) (r int32) { + return _sqlite3VdbeAddOp3(tls, p, op, p1, p2, 0) +} + +func _sqlite3VdbeAddOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) (r int32) { + var i int32 + var pOp uintptr + _, _ = i, pOp + i = (*TVdbe)(unsafe.Pointer(p)).FnOp + if (*TVdbe)(unsafe.Pointer(p)).FnOpAlloc <= i { + return _growOp3(tls, p, op, p1, p2, p3) + } + (*TVdbe)(unsafe.Pointer(p)).FnOp++ + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(op) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(0) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = p1 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = p2 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 = p3 + *(*uintptr)(unsafe.Pointer(pOp + 16)) = uintptr(0) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = P4_NOTUSED + /* Replicate this logic in sqlite3VdbeAddOp4Int() + ** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ + /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ** Replicate in sqlite3VdbeAddOp4Int() */ + return i +} + +func _sqlite3VdbeAddOp4Int(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, p4 int32) (r int32) { + var i int32 + var pOp uintptr + _, _ = i, pOp + i = (*TVdbe)(unsafe.Pointer(p)).FnOp + if (*TVdbe)(unsafe.Pointer(p)).FnOpAlloc <= i { + return _addOp4IntSlow(tls, p, op, p1, p2, p3, p4) + } + (*TVdbe)(unsafe.Pointer(p)).FnOp++ + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(op) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(0) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = p1 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = p2 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 = p3 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4.Fi = p4 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(-libc.Int32FromInt32(3)) + /* Replicate this logic in sqlite3VdbeAddOp3() + ** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ + /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ** Replicate in sqlite3VdbeAddOp3() */ + return i +} + +// C documentation +// +// /* Generate code for an unconditional jump to instruction iDest +// */ +func _sqlite3VdbeGoto(tls *libc.TLS, p uintptr, iDest int32) (r int32) { + return _sqlite3VdbeAddOp3(tls, p, int32(OP_Goto), 0, iDest, 0) +} + +// C documentation +// +// /* Generate code to cause the string zStr to be loaded into +// ** register iDest +// */ +func _sqlite3VdbeLoadString(tls *libc.TLS, p uintptr, iDest int32, zStr uintptr) (r int32) { + return _sqlite3VdbeAddOp4(tls, p, int32(OP_String8), 0, iDest, 0, zStr, 0) +} + +// C documentation +// +// /* +// ** Generate code that initializes multiple registers to string or integer +// ** constants. The registers begin with iDest and increase consecutively. +// ** One register is initialized for each characgter in zTypes[]. For each +// ** "s" character in zTypes[], the register is a string if the argument is +// ** not NULL, or OP_Null if the value is a null pointer. For each "i" character +// ** in zTypes[], the register is initialized to an integer. +// ** +// ** If the input string does not end with "X" then an OP_ResultRow instruction +// ** is generated for the values inserted. +// */ +func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr, va uintptr) { + var ap Tva_list + var c, v2 int8 + var i, v3 int32 + var z uintptr + _, _, _, _, _, _ = ap, c, i, z, v2, v3 + ap = va + i = 0 + for { + v2 = *(*int8)(unsafe.Pointer(zTypes + uintptr(i))) + c = v2 + if !(int32(v2) != 0) { + break + } + if int32(c) == int32('s') { + z = libc.VaUintptr(&ap) + if z == uintptr(0) { + v3 = int32(OP_Null) + } else { + v3 = int32(OP_String8) + } + _sqlite3VdbeAddOp4(tls, p, v3, 0, iDest+i, 0, z, 0) + } else { + if int32(c) == int32('i') { + _sqlite3VdbeAddOp2(tls, p, int32(OP_Integer), libc.VaInt32(&ap), iDest+i) + } else { + goto skip_op_resultrow + } + } + goto _1 + _1: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) +skip_op_resultrow: + ; + _ = ap +} + +// C documentation +// +// /* +// ** Add an opcode that includes the p4 value as a pointer. +// */ +func _sqlite3VdbeAddOp4(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, zP4 uintptr, p4type int32) (r int32) { + var addr int32 + _ = addr + addr = _sqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) + _sqlite3VdbeChangeP4(tls, p, addr, zP4, p4type) + return addr +} + +// C documentation +// +// /* +// ** Add an OP_Function or OP_PureFunc opcode. +// ** +// ** The eCallCtx argument is information (typically taken from Expr.op2) +// ** that describes the calling context of the function. 0 means a general +// ** function call. NC_IsCheck means called by a check constraint, +// ** NC_IdxExpr means called as part of an index expression. NC_PartIdx +// ** means in the WHERE clause of a partial index. NC_GenCol means called +// ** while computing a generated column value. 0 is the usual case. +// */ +func _sqlite3VdbeAddFunctionCall(tls *libc.TLS, pParse uintptr, p1 int32, p2 int32, p3 int32, nArg int32, pFunc uintptr, eCallCtx int32) (r int32) { + var addr, nByte, v1 int32 + var pCtx, v uintptr + _, _, _, _, _ = addr, nByte, pCtx, v, v1 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + nByte = int32(uint64(56) + uint64(nArg-libc.Int32FromInt32(1))*uint64(8)) + pCtx = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nByte)) + if pCtx == uintptr(0) { + _freeEphemeralFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pFunc) + return 0 + } + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut = uintptr(0) + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc = pFunc + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe = uintptr(0) + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = 0 + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).Fargc = uint8(nArg) + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp = _sqlite3VdbeCurrentAddr(tls, v) + if eCallCtx != 0 { + v1 = int32(OP_PureFunc) + } else { + v1 = int32(OP_Function) + } + addr = _sqlite3VdbeAddOp4(tls, v, v1, p1, p2, p3, pCtx, -int32(15)) + _sqlite3VdbeChangeP5(tls, v, uint16(eCallCtx&int32(NC_SelfRef))) + _sqlite3MayAbort(tls, pParse) + return addr +} + +// C documentation +// +// /* +// ** Add an opcode that includes the p4 value with a P4_INT64 or +// ** P4_REAL type. +// */ +func _sqlite3VdbeAddOp4Dup8(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, zP4 uintptr, p4type int32) (r int32) { + var p4copy uintptr + _ = p4copy + p4copy = _sqlite3DbMallocRawNN(tls, _sqlite3VdbeDb(tls, p), uint64(8)) + if p4copy != 0 { + libc.Xmemcpy(tls, p4copy, zP4, uint64(8)) + } + return _sqlite3VdbeAddOp4(tls, p, op, p1, p2, p3, p4copy, p4type) +} + +// C documentation +// +// /* +// ** Return the address of the current EXPLAIN QUERY PLAN baseline. +// ** 0 means "none". +// */ +func _sqlite3VdbeExplainParent(tls *libc.TLS, pParse uintptr) (r int32) { + var pOp uintptr + _ = pOp + if (*TParse)(unsafe.Pointer(pParse)).FaddrExplain == 0 { + return 0 + } + pOp = _sqlite3VdbeGetOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, (*TParse)(unsafe.Pointer(pParse)).FaddrExplain) + return (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 +} + +/* +** Set a debugger breakpoint on the following routine in order to +** monitor the EXPLAIN QUERY PLAN code generation. + */ + +// C documentation +// +// /* +// ** Add a new OP_Explain opcode. +// ** +// ** If the bPush flag is true, then make this opcode the parent for +// ** subsequent Explains until sqlite3VdbeExplainPop() is called. +// */ +func _sqlite3VdbeExplain(tls *libc.TLS, pParse uintptr, bPush Tu8, zFmt uintptr, va uintptr) (r int32) { + var addr, iThis int32 + var ap Tva_list + var v, zMsg uintptr + _, _, _, _, _ = addr, ap, iThis, v, zMsg + addr = 0 + /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined. + ** But omit them (for performance) during production builds */ + if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) || libc.Bool(0 != 0) { + ap = va + zMsg = _sqlite3VMPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zFmt, ap) + _ = ap + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + iThis = (*TVdbe)(unsafe.Pointer(v)).FnOp + addr = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), iThis, (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) + if bPush != 0 { + (*TParse)(unsafe.Pointer(pParse)).FaddrExplain = iThis + } + } + return addr +} + +// C documentation +// +// /* +// ** Pop the EXPLAIN QUERY PLAN stack one level. +// */ +func _sqlite3VdbeExplainPop(tls *libc.TLS, pParse uintptr) { + (*TParse)(unsafe.Pointer(pParse)).FaddrExplain = _sqlite3VdbeExplainParent(tls, pParse) +} + +// C documentation +// +// /* +// ** Add an OP_ParseSchema opcode. This routine is broken out from +// ** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees +// ** as having been used. +// ** +// ** The zWhere string must have been obtained from sqlite3_malloc(). +// ** This routine will take ownership of the allocated memory. +// */ +func _sqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere uintptr, p5 Tu16) { + var j int32 + _ = j + _sqlite3VdbeAddOp4(tls, p, int32(OP_ParseSchema), iDb, 0, 0, zWhere, -int32(6)) + _sqlite3VdbeChangeP5(tls, p, p5) + j = 0 + for { + if !(j < (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FnDb) { + break + } + _sqlite3VdbeUsesBtree(tls, p, j) + goto _1 + _1: + ; + j++ + } + _sqlite3MayAbort(tls, (*TVdbe)(unsafe.Pointer(p)).FpParse) +} + +// C documentation +// +// /* Insert the end of a co-routine +// */ +func _sqlite3VdbeEndCoroutine(tls *libc.TLS, v uintptr, regYield int32) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_EndCoroutine), regYield) + /* Clear the temporary register cache, thereby ensuring that each + ** co-routine has its own independent set of registers, because co-routines + ** might expect their registers to be preserved across an OP_Yield, and + ** that could cause problems if two or more co-routines are using the same + ** temporary register. + */ + (*TParse)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FpParse)).FnTempReg = uint8(0) + (*TParse)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FpParse)).FnRangeReg = 0 +} + +// C documentation +// +// /* +// ** Create a new symbolic label for an instruction that has yet to be +// ** coded. The symbolic label is really just a negative number. The +// ** label can be used as the P2 value of an operation. Later, when +// ** the label is resolved to a specific address, the VDBE will scan +// ** through its operation list and change all values of P2 which match +// ** the label into the resolved address. +// ** +// ** The VDBE knows that a P2 value is a label because labels are +// ** always negative and P2 values are suppose to be non-negative. +// ** Hence, a negative P2 value is a label that has yet to be resolved. +// ** (Later:) This is only true for opcodes that have the OPFLG_JUMP +// ** property. +// ** +// ** Variable usage notes: +// ** +// ** Parse.aLabel[x] Stores the address that the x-th label resolves +// ** into. For testing (SQLITE_DEBUG), unresolved +// ** labels stores -1, but that is not required. +// ** Parse.nLabelAlloc Number of slots allocated to Parse.aLabel[] +// ** Parse.nLabel The *negative* of the number of labels that have +// ** been issued. The negative is stored because +// ** that gives a performance improvement over storing +// ** the equivalent positive value. +// */ +func _sqlite3VdbeMakeLabel(tls *libc.TLS, pParse uintptr) (r int32) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + v2 = pParse + 68 + *(*int32)(unsafe.Pointer(v2))-- + v1 = *(*int32)(unsafe.Pointer(v2)) + return v1 +} + +// C documentation +// +// /* +// ** Resolve label "x" to be the address of the next instruction to +// ** be inserted. The parameter "x" must have been obtained from +// ** a prior call to sqlite3VdbeMakeLabel(). +// */ +func _resizeResolveLabel(tls *libc.TLS, p uintptr, v uintptr, j int32) { + var nNewSize int32 + _ = nNewSize + nNewSize = int32(10) - (*TParse)(unsafe.Pointer(p)).FnLabel + (*TParse)(unsafe.Pointer(p)).FaLabel = _sqlite3DbReallocOrFree(tls, (*TParse)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(p)).FaLabel, uint64(nNewSize)*uint64(4)) + if (*TParse)(unsafe.Pointer(p)).FaLabel == uintptr(0) { + (*TParse)(unsafe.Pointer(p)).FnLabelAlloc = 0 + } else { + if nNewSize >= int32(100) && nNewSize/int32(100) > (*TParse)(unsafe.Pointer(p)).FnLabelAlloc/int32(100) { + _sqlite3ProgressCheck(tls, p) + } + (*TParse)(unsafe.Pointer(p)).FnLabelAlloc = nNewSize + *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(p)).FaLabel + uintptr(j)*4)) = (*TVdbe)(unsafe.Pointer(v)).FnOp + } +} + +func _sqlite3VdbeResolveLabel(tls *libc.TLS, v uintptr, x int32) { + var j int32 + var p uintptr + _, _ = j, p + p = (*TVdbe)(unsafe.Pointer(v)).FpParse + j = ^x + if (*TParse)(unsafe.Pointer(p)).FnLabelAlloc+(*TParse)(unsafe.Pointer(p)).FnLabel < 0 { + _resizeResolveLabel(tls, p, v, j) + } else { + /* Labels may only be resolved once */ + *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(p)).FaLabel + uintptr(j)*4)) = (*TVdbe)(unsafe.Pointer(v)).FnOp + } +} + +// C documentation +// +// /* +// ** Mark the VDBE as one that can only be run one time. +// */ +func _sqlite3VdbeRunOnlyOnce(tls *libc.TLS, p uintptr) { + _sqlite3VdbeAddOp2(tls, p, int32(OP_Expire), int32(1), int32(1)) +} + +// C documentation +// +// /* +// ** Mark the VDBE as one that can be run multiple times. +// */ +func _sqlite3VdbeReusable(tls *libc.TLS, p uintptr) { + var i int32 + _ = i + i = int32(1) + for { + if !(i < (*TVdbe)(unsafe.Pointer(p)).FnOp) { + break + } + if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24))).Fopcode) == int32(OP_Expire) { + (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + 1*24))).Fopcode = uint8(OP_Noop) + break + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** This routine is called after all opcodes have been inserted. It loops +// ** through all the opcodes and fixes up some details. +// ** +// ** (1) For each jump instruction with a negative P2 value (a label) +// ** resolve the P2 value to an actual address. +// ** +// ** (2) Compute the maximum number of arguments used by any SQL function +// ** and store that value in *pMaxFuncArgs. +// ** +// ** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately +// ** indicate what the prepared statement actually does. +// ** +// ** (4) (discontinued) +// ** +// ** (5) Reclaim the memory allocated for storing labels. +// ** +// ** This routine will only function correctly if the mkopcodeh.tcl generator +// ** script numbers the opcodes correctly. Changes to this routine must be +// ** coordinated with changes to mkopcodeh.tcl. +// */ +func _resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { + var aLabel, pOp, pParse uintptr + var n, nMaxArgs int32 + _, _, _, _, _ = aLabel, n, nMaxArgs, pOp, pParse + nMaxArgs = *(*int32)(unsafe.Pointer(pMaxFuncArgs)) + pParse = (*TVdbe)(unsafe.Pointer(p)).FpParse + aLabel = (*TParse)(unsafe.Pointer(pParse)).FaLabel + /* tag-20230419-1 */ + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 6, 0x40) + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 7, 0x80) + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24 + for int32(1) != 0 { + /* Only JUMP opcodes and the short list of special opcodes in the switch + ** below need to be considered. The mkopcodeh.tcl generator script groups + ** all these opcodes together near the front of the opcode list. Skip + ** any opcode that does not need processing by virtual of the fact that + ** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization. + */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) <= int32(SQLITE_MX_JUMP_OPCODE) { + /* NOTE: Be sure to update mkopcodeh.tcl when adding or removing + ** cases from this switch! */ + switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { + case int32(OP_Transaction): + if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 6, 0x40) + } + fallthrough + case int32(OP_AutoCommit): + fallthrough + case OP_Savepoint: + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 7, 0x80) + case int32(OP_Checkpoint): + fallthrough + case int32(OP_Vacuum): + fallthrough + case int32(OP_JournalMode): + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 6, 0x40) + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 7, 0x80) + case int32(OP_Init): + goto resolve_p2_values_loop_exit + case int32(OP_VUpdate): + if (*TOp)(unsafe.Pointer(pOp)).Fp2 > nMaxArgs { + nMaxArgs = (*TOp)(unsafe.Pointer(pOp)).Fp2 + } + case int32(OP_VFilter): + n = (*(*TOp)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24))).Fp1 + if n > nMaxArgs { + nMaxArgs = n + } + fallthrough + default: + if (*TOp)(unsafe.Pointer(pOp)).Fp2 < 0 { + /* The mkopcodeh.tcl script has so arranged things that the only + ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to + ** have non-negative values for P2. */ + /* True because of tag-20230419-1 */ + (*TOp)(unsafe.Pointer(pOp)).Fp2 = *(*int32)(unsafe.Pointer(aLabel + uintptr(^(*TOp)(unsafe.Pointer(pOp)).Fp2)*4)) + } + break + } + /* The mkopcodeh.tcl script has so arranged things that the only + ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to + ** have non-negative values for P2. */ + } + pOp -= 24 + } +resolve_p2_values_loop_exit: + ; + if aLabel != 0 { + _sqlite3DbNNFreeNN(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TParse)(unsafe.Pointer(pParse)).FaLabel) + (*TParse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) + } + (*TParse)(unsafe.Pointer(pParse)).FnLabel = 0 + *(*int32)(unsafe.Pointer(pMaxFuncArgs)) = nMaxArgs +} + +// C documentation +// +// /* +// ** Return the address of the next instruction to be inserted. +// */ +func _sqlite3VdbeCurrentAddr(tls *libc.TLS, p uintptr) (r int32) { + return (*TVdbe)(unsafe.Pointer(p)).FnOp +} + +/* +** Verify that at least N opcode slots are available in p without +** having to malloc for more space (except when compiled using +** SQLITE_TEST_REALLOC_STRESS). This interface is used during testing +** to verify that certain calls to sqlite3VdbeAddOpList() can never +** fail due to a OOM fault and hence that the return value from +** sqlite3VdbeAddOpList() will always be non-NULL. + */ + +/* +** Verify that the VM passed as the only argument does not contain +** an OP_ResultRow opcode. Fail an assert() if it does. This is used +** by code in pragma.c to ensure that the implementation of certain +** pragmas comports with the flags specified in the mkpragmatab.tcl +** script. + */ + +/* +** Generate code (a single OP_Abortable opcode) that will +** verify that the VDBE program can safely call Abort in the current +** context. + */ + +// C documentation +// +// /* +// ** This function returns a pointer to the array of opcodes associated with +// ** the Vdbe passed as the first argument. It is the callers responsibility +// ** to arrange for the returned array to be eventually freed using the +// ** vdbeFreeOpArray() function. +// ** +// ** Before returning, *pnOp is set to the number of entries in the returned +// ** array. Also, *pnMaxArg is set to the larger of its current value and +// ** the number of entries in the Vdbe.apArg[] array required to execute the +// ** returned program. +// */ +func _sqlite3VdbeTakeOpArray(tls *libc.TLS, p uintptr, pnOp uintptr, pnMaxArg uintptr) (r uintptr) { + var aOp uintptr + _ = aOp + aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + /* Check that sqlite3VdbeUsesBtree() was not called on this VM */ + _resolveP2Values(tls, p, pnMaxArg) + *(*int32)(unsafe.Pointer(pnOp)) = (*TVdbe)(unsafe.Pointer(p)).FnOp + (*TVdbe)(unsafe.Pointer(p)).FaOp = uintptr(0) + return aOp +} + +// C documentation +// +// /* +// ** Add a whole list of operations to the operation stack. Return a +// ** pointer to the first operation inserted. +// ** +// ** Non-zero P2 arguments to jump instructions are automatically adjusted +// ** so that the jump target is relative to the first operation inserted. +// */ +func _sqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLineno int32) (r uintptr) { + var i int32 + var pFirst, pOut, v1 uintptr + _, _, _, _ = i, pFirst, pOut, v1 + if (*TVdbe)(unsafe.Pointer(p)).FnOp+nOp > (*TVdbe)(unsafe.Pointer(p)).FnOpAlloc && _growOpArray(tls, p, nOp) != 0 { + return uintptr(0) + } + v1 = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp)*24 + pOut = v1 + pFirst = v1 + i = 0 + for { + if !(i < nOp) { + break + } + (*TVdbeOp)(unsafe.Pointer(pOut)).Fopcode = (*TVdbeOpList)(unsafe.Pointer(aOp)).Fopcode + (*TVdbeOp)(unsafe.Pointer(pOut)).Fp1 = int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp1) + (*TVdbeOp)(unsafe.Pointer(pOut)).Fp2 = int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp2) + if int32(_sqlite3OpcodeProperty[(*TVdbeOpList)(unsafe.Pointer(aOp)).Fopcode])&int32(OPFLG_JUMP) != 0 && int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp2) > 0 { + *(*int32)(unsafe.Pointer(pOut + 8)) += (*TVdbe)(unsafe.Pointer(p)).FnOp + } + (*TVdbeOp)(unsafe.Pointer(pOut)).Fp3 = int32((*TVdbeOpList)(unsafe.Pointer(aOp)).Fp3) + (*TVdbeOp)(unsafe.Pointer(pOut)).Fp4type = P4_NOTUSED + *(*uintptr)(unsafe.Pointer(pOut + 16)) = uintptr(0) + (*TVdbeOp)(unsafe.Pointer(pOut)).Fp5 = uint16(0) + _ = iLineno + goto _2 + _2: + ; + i++ + aOp += 4 + pOut += 24 + } + *(*int32)(unsafe.Pointer(p + 144)) += nOp + return pFirst +} + +// C documentation +// +// /* +// ** Change the value of the opcode, or P1, P2, P3, or P5 operands +// ** for a specific instruction. +// */ +func _sqlite3VdbeChangeOpcode(tls *libc.TLS, p uintptr, addr int32, iNewOpcode Tu8) { + (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fopcode = iNewOpcode +} + +func _sqlite3VdbeChangeP1(tls *libc.TLS, p uintptr, addr int32, val int32) { + (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp1 = val +} + +func _sqlite3VdbeChangeP2(tls *libc.TLS, p uintptr, addr int32, val int32) { + (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp2 = val +} + +func _sqlite3VdbeChangeP3(tls *libc.TLS, p uintptr, addr int32, val int32) { + (*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, p, addr))).Fp3 = val +} + +func _sqlite3VdbeChangeP5(tls *libc.TLS, p uintptr, p5 Tu16) { + if (*TVdbe)(unsafe.Pointer(p)).FnOp > 0 { + (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24))).Fp5 = p5 + } +} + +// C documentation +// +// /* +// ** If the previous opcode is an OP_Column that delivers results +// ** into register iDest, then add the OPFLAG_TYPEOFARG flag to that +// ** opcode. +// */ +func _sqlite3VdbeTypeofColumn(tls *libc.TLS, p uintptr, iDest int32) { + var pOp, p1 uintptr + _, _ = pOp, p1 + pOp = _sqlite3VdbeGetLastOp(tls, p) + if (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 == iDest && int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) { + p1 = pOp + 2 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(OPFLAG_TYPEOFARG)) + } +} + +// C documentation +// +// /* +// ** Change the P2 operand of instruction addr so that it points to +// ** the address of the next instruction to be coded. +// */ +func _sqlite3VdbeJumpHere(tls *libc.TLS, p uintptr, addr int32) { + _sqlite3VdbeChangeP2(tls, p, addr, (*TVdbe)(unsafe.Pointer(p)).FnOp) +} + +// C documentation +// +// /* +// ** Change the P2 operand of the jump instruction at addr so that +// ** the jump lands on the next opcode. Or if the jump instruction was +// ** the previous opcode (and is thus a no-op) then simply back up +// ** the next instruction counter by one slot so that the jump is +// ** overwritten by the next inserted opcode. +// ** +// ** This routine is an optimization of sqlite3VdbeJumpHere() that +// ** strives to omit useless byte-code like this: +// ** +// ** 7 Once 0 8 0 +// ** 8 ... +// */ +func _sqlite3VdbeJumpHereOrPopInst(tls *libc.TLS, p uintptr, addr int32) { + if addr == (*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1) { + (*TVdbe)(unsafe.Pointer(p)).FnOp-- + } else { + _sqlite3VdbeChangeP2(tls, p, addr, (*TVdbe)(unsafe.Pointer(p)).FnOp) + } +} + +// C documentation +// +// /* +// ** If the input FuncDef structure is ephemeral, then free it. If +// ** the FuncDef is not ephemeral, then do nothing. +// */ +func _freeEphemeralFunction(tls *libc.TLS, db uintptr, pDef uintptr) { + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_EPHEM) != uint32(0) { + _sqlite3DbNNFreeNN(tls, db, pDef) + } +} + +// C documentation +// +// /* +// ** Delete a P4 value if necessary. +// */ +func _freeP4Mem(tls *libc.TLS, db uintptr, p uintptr) { + if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _sqlite3DbFree(tls, db, (*TMem)(unsafe.Pointer(p)).FzMalloc) + } + _sqlite3DbNNFreeNN(tls, db, p) +} + +func _freeP4FuncCtx(tls *libc.TLS, db uintptr, p uintptr) { + _freeEphemeralFunction(tls, db, (*Tsqlite3_context)(unsafe.Pointer(p)).FpFunc) + _sqlite3DbNNFreeNN(tls, db, p) +} + +func _freeP4(tls *libc.TLS, db uintptr, p4type int32, p4 uintptr) { + switch p4type { + case -int32(15): + _freeP4FuncCtx(tls, db, p4) + case -int32(12): + fallthrough + case -int32(13): + fallthrough + case -int32(6): + fallthrough + case -int32(14): + if p4 != 0 { + _sqlite3DbNNFreeNN(tls, db, p4) + } + case -int32(8): + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + _sqlite3KeyInfoUnref(tls, p4) + } + case -int32(7): + _freeEphemeralFunction(tls, db, p4) + case -int32(10): + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + _sqlite3ValueFree(tls, p4) + } else { + _freeP4Mem(tls, db, p4) + } + case -int32(11): + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + _sqlite3VtabUnlock(tls, p4) + } + case -int32(16): + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + _sqlite3DeleteTable(tls, db, p4) + } + break + } +} + +// C documentation +// +// /* +// ** Free the space allocated for aOp and any p4 values allocated for the +// ** opcodes contained within. If aOp is not NULL it is assumed to contain +// ** nOp entries. +// */ +func _vdbeFreeOpArray(tls *libc.TLS, db uintptr, aOp uintptr, nOp int32) { + var pOp uintptr + _ = pOp + if aOp != 0 { + pOp = aOp + uintptr(nOp-int32(1))*24 + for int32(1) != 0 { /* Exit via break */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) <= -int32(6) { + _freeP4(tls, db, int32((*TOp)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16))) + } + if pOp == aOp { + break + } + pOp -= 24 + } + _sqlite3DbNNFreeNN(tls, db, aOp) + } +} + +// C documentation +// +// /* +// ** Link the SubProgram object passed as the second argument into the linked +// ** list at Vdbe.pSubProgram. This list is used to delete all sub-program +// ** objects when the VM is no longer required. +// */ +func _sqlite3VdbeLinkSubProgram(tls *libc.TLS, pVdbe uintptr, p uintptr) { + (*TSubProgram)(unsafe.Pointer(p)).FpNext = (*TVdbe)(unsafe.Pointer(pVdbe)).FpProgram + (*TVdbe)(unsafe.Pointer(pVdbe)).FpProgram = p +} + +// C documentation +// +// /* +// ** Return true if the given Vdbe has any SubPrograms. +// */ +func _sqlite3VdbeHasSubProgram(tls *libc.TLS, pVdbe uintptr) (r int32) { + return libc.BoolInt32((*TVdbe)(unsafe.Pointer(pVdbe)).FpProgram != uintptr(0)) +} + +// C documentation +// +// /* +// ** Change the opcode at addr into OP_Noop +// */ +func _sqlite3VdbeChangeToNoop(tls *libc.TLS, p uintptr, addr int32) (r int32) { + var pOp uintptr + _ = pOp + if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + return 0 + } + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24 + _freeP4(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16))) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = P4_NOTUSED + *(*uintptr)(unsafe.Pointer(pOp + 16)) = uintptr(0) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_Noop) + return int32(1) +} + +// C documentation +// +// /* +// ** If the last opcode is "op" and it is not a jump destination, +// ** then remove it. Return true if and only if an opcode was removed. +// */ +func _sqlite3VdbeDeletePriorOpcode(tls *libc.TLS, p uintptr, op Tu8) (r int32) { + if (*TVdbe)(unsafe.Pointer(p)).FnOp > 0 && int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24))).Fopcode) == int32(op) { + return _sqlite3VdbeChangeToNoop(tls, p, (*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1)) + } else { + return 0 + } + return r +} + +// C documentation +// +// /* +// ** Change the value of the P4 operand for a specific instruction. +// ** This routine is useful when a large program is loaded from a +// ** static array using sqlite3VdbeAddOpList but we want to make a +// ** few minor changes to the program. +// ** +// ** If n>=0 then the P4 operand is dynamic, meaning that a copy of +// ** the string is made into memory obtained from sqlite3_malloc(). +// ** A value of n==0 means copy bytes of zP4 up to and including the +// ** first null byte. If n>0 then copy n+1 bytes of zP4. +// ** +// ** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points +// ** to a string or structure that is guaranteed to exist for the lifetime of +// ** the Vdbe. In these cases we can just copy the pointer. +// ** +// ** If addr<0 then change P4 on the most recently inserted instruction. +// */ +func _vdbeChangeP4Full(tls *libc.TLS, p uintptr, pOp uintptr, zP4 uintptr, n int32) { + if (*TOp)(unsafe.Pointer(pOp)).Fp4type != 0 { + (*TOp)(unsafe.Pointer(pOp)).Fp4type = 0 + *(*uintptr)(unsafe.Pointer(pOp + 16)) = uintptr(0) + } + if n < 0 { + _sqlite3VdbeChangeP4(tls, p, int32((int64(pOp)-int64((*TVdbe)(unsafe.Pointer(p)).FaOp))/24), zP4, n) + } else { + if n == 0 { + n = _sqlite3Strlen30(tls, zP4) + } + *(*uintptr)(unsafe.Pointer(pOp + 16)) = _sqlite3DbStrNDup(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, zP4, uint64(n)) + (*TOp)(unsafe.Pointer(pOp)).Fp4type = int8(-libc.Int32FromInt32(6)) + } +} + +func _sqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, _zP4 uintptr, n int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _zP4 + var db, pOp uintptr + _, _ = db, pOp + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if n != -int32(11) { + _freeP4(tls, db, n, *(*uintptr)(unsafe.Pointer(bp))) + } + return + } + if addr < 0 { + addr = (*TVdbe)(unsafe.Pointer(p)).FnOp - int32(1) + } + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24 + if n >= 0 || (*TOp)(unsafe.Pointer(pOp)).Fp4type != 0 { + _vdbeChangeP4Full(tls, p, pOp, *(*uintptr)(unsafe.Pointer(bp)), n) + return + } + if n == -int32(3) { + /* Note: this cast is safe, because the origin data point was an int + ** that was cast to a (const char *). */ + (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi = int32(int64(*(*uintptr)(unsafe.Pointer(bp)))) + (*TOp)(unsafe.Pointer(pOp)).Fp4type = int8(-libc.Int32FromInt32(3)) + } else { + if *(*uintptr)(unsafe.Pointer(bp)) != uintptr(0) { + *(*uintptr)(unsafe.Pointer(pOp + 16)) = *(*uintptr)(unsafe.Pointer(bp)) + (*TOp)(unsafe.Pointer(pOp)).Fp4type = int8(n) + if n == -int32(11) { + _sqlite3VtabLock(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + } +} + +// C documentation +// +// /* +// ** Change the P4 operand of the most recently coded instruction +// ** to the value defined by the arguments. This is a high-speed +// ** version of sqlite3VdbeChangeP4(). +// ** +// ** The P4 operand must not have been previously defined. And the new +// ** P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of +// ** those cases. +// */ +func _sqlite3VdbeAppendP4(tls *libc.TLS, p uintptr, pP4 uintptr, n int32) { + var pOp uintptr + _ = pOp + if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + _freeP4(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, n, pP4) + } else { + pOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr((*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1))*24 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(n) + *(*uintptr)(unsafe.Pointer(pOp + 16)) = pP4 + } +} + +// C documentation +// +// /* +// ** Set the P4 on the most recently added opcode to the KeyInfo for the +// ** index given. +// */ +func _sqlite3VdbeSetP4KeyInfo(tls *libc.TLS, pParse uintptr, pIdx uintptr) { + var pKeyInfo, v uintptr + _, _ = pKeyInfo, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + pKeyInfo = _sqlite3KeyInfoOfIndex(tls, pParse, pIdx) + if pKeyInfo != 0 { + _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) + } +} + +// C documentation +// +// /* +// ** Return the opcode for a given address. The address must be non-negative. +// ** See sqlite3VdbeGetLastOp() to get the most recently added opcode. +// ** +// ** If a memory allocation error has occurred prior to the calling of this +// ** routine, then a pointer to a dummy VdbeOp will be returned. That opcode +// ** is readable but not writable, though it is cast to a writable value. +// ** The return of a dummy opcode allows the call to continue functioning +// ** after an OOM fault without having to check to see if the return from +// ** this routine is a valid pointer. But because the dummy.opcode is 0, +// ** dummy will never be written to. This is verified by code inspection and +// ** by running with Valgrind. +// */ +func _sqlite3VdbeGetOp(tls *libc.TLS, p uintptr, addr int32) (r uintptr) { + if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + return uintptr(unsafe.Pointer(&_dummy)) + } else { + return (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24 + } + return r +} + +/* C89 specifies that the constant "dummy" will be initialized to all + ** zeros, which is correct. MSVC generates a warning, nevertheless. */ +var _dummy TVdbeOp + +// C documentation +// +// /* Return the most recently added opcode +// */ +func _sqlite3VdbeGetLastOp(tls *libc.TLS, p uintptr) (r uintptr) { + return _sqlite3VdbeGetOp(tls, p, (*TVdbe)(unsafe.Pointer(p)).FnOp-int32(1)) +} + +// C documentation +// +// /* +// ** Compute a string that describes the P4 parameter for an opcode. +// ** Use zTemp for any required temporary buffer space. +// */ +func _sqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var ai, pColl, pColl1, pDef, pDef1, pKeyInfo, pMem, pVtab, zColl, zP4, v2, v3, v4 uintptr + var i, n Tu32 + var j, v6 int32 + var _ /* x at bp+0 */ TStrAccum + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ai, i, j, n, pColl, pColl1, pDef, pDef1, pKeyInfo, pMem, pVtab, zColl, zP4, v2, v3, v4, v6 + zP4 = uintptr(0) + _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, int32(SQLITE_MAX_LENGTH)) + switch int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) { + case -int32(8): + pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5113, libc.VaList(bp+40, int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + j = 0 + for { + if !(j < int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)) { + break + } + pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(j)*8)) + if pColl != 0 { + v2 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName + } else { + v2 = __ccgo_ts + 1680 + } + zColl = v2 + if libc.Xstrcmp(tls, zColl, __ccgo_ts+5118) == 0 { + zColl = __ccgo_ts + 5125 + } + if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_DESC) != 0 { + v3 = __ccgo_ts + 5106 + } else { + v3 = __ccgo_ts + 1680 + } + if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j))))&int32(KEYINFO_ORDER_BIGNULL) != 0 { + v4 = __ccgo_ts + 5127 + } else { + v4 = __ccgo_ts + 1680 + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5130, libc.VaList(bp+40, v3, v4, zColl)) + goto _1 + _1: + ; + j++ + } + Xsqlite3_str_append(tls, bp, __ccgo_ts+5138, int32(1)) + case -int32(2): + pColl1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5154, libc.VaList(bp+40, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, _encnames[(*TCollSeq)(unsafe.Pointer(pColl1)).Fenc])) + case -int32(7): + pDef = *(*uintptr)(unsafe.Pointer(pOp + 16)) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5163, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef)).FnArg))) + case -int32(15): + pDef1 = (*Tsqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpFunc + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5163, libc.VaList(bp+40, (*TFuncDef)(unsafe.Pointer(pDef1)).FzName, int32((*TFuncDef)(unsafe.Pointer(pDef1)).FnArg))) + case -int32(13): + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1436, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) + case -int32(3): + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5170, libc.VaList(bp+40, (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + case -int32(12): + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1403, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))))) + case -int32(10): + pMem = *(*uintptr)(unsafe.Pointer(pOp + 16)) + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Str) != 0 { + zP4 = (*TMem)(unsafe.Pointer(pMem)).Fz + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1436, libc.VaList(bp+40, *(*Ti64)(unsafe.Pointer(pMem)))) + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Real) != 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+1403, libc.VaList(bp+40, *(*float64)(unsafe.Pointer(pMem)))) + } else { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) != 0 { + zP4 = __ccgo_ts + 1681 + } else { + zP4 = __ccgo_ts + 5173 + } + } + } + } + case -int32(11): + pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5180, libc.VaList(bp+40, pVtab)) + case -int32(14): + ai = *(*uintptr)(unsafe.Pointer(pOp + 16)) + n = *(*Tu32)(unsafe.Pointer(ai)) /* The first element of an INTARRAY is always the + ** count of the number of elements to follow */ + i = uint32(1) + for { + if !(i <= n) { + break + } + if i == uint32(1) { + v6 = int32('[') + } else { + v6 = int32(',') + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+5188, libc.VaList(bp+40, v6, *(*Tu32)(unsafe.Pointer(ai + uintptr(i)*4)))) + goto _5 + _5: + ; + i++ + } + Xsqlite3_str_append(tls, bp, __ccgo_ts+5193, int32(1)) + case -int32(4): + zP4 = __ccgo_ts + 5195 + case -int32(5): + zP4 = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FzName + default: + zP4 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + } + if zP4 != 0 { + Xsqlite3_str_appendall(tls, bp, zP4) + } + if int32((*(*TStrAccum)(unsafe.Pointer(bp))).FaccError)&int32(SQLITE_NOMEM) != 0 { + _sqlite3OomFault(tls, db) + } + return _sqlite3StrAccumFinish(tls, bp) +} + +var _encnames = [4]uintptr{ + 0: __ccgo_ts + 5140, + 1: __ccgo_ts + 5142, + 2: __ccgo_ts + 5144, + 3: __ccgo_ts + 5149, +} + +// C documentation +// +// /* +// ** Declare to the Vdbe that the BTree object at db->aDb[i] is used. +// ** +// ** The prepared statements need to know in advance the complete set of +// ** attached databases that will be use. A mask of these databases +// ** is maintained in p->btreeMask. The p->lockMask value is the subset of +// ** p->btreeMask of databases that will require a lock. +// */ +func _sqlite3VdbeUsesBtree(tls *libc.TLS, p uintptr, i int32) { + *(*TyDbMask)(unsafe.Pointer(p + 204)) |= libc.Uint32FromInt32(1) << i + if i != int32(1) && _sqlite3BtreeSharable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FaDb + uintptr(i)*32))).FpBt) != 0 { + *(*TyDbMask)(unsafe.Pointer(p + 208)) |= libc.Uint32FromInt32(1) << i + } +} + +// C documentation +// +// /* +// ** If SQLite is compiled to support shared-cache mode and to be threadsafe, +// ** this routine obtains the mutex associated with each BtShared structure +// ** that may be accessed by the VM passed as an argument. In doing so it also +// ** sets the BtShared.db member of each of the BtShared structures, ensuring +// ** that the correct busy-handler callback is invoked if required. +// ** +// ** If SQLite is not threadsafe but does support shared-cache mode, then +// ** sqlite3BtreeEnter() is invoked to set the BtShared.db variables +// ** of all of BtShared structures accessible via the database handle +// ** associated with the VM. +// ** +// ** If SQLite is not threadsafe and does not support shared-cache mode, this +// ** function is a no-op. +// ** +// ** The p->btreeMask field is a bitmask of all btrees that the prepared +// ** statement p will ever use. Let N be the number of bits in p->btreeMask +// ** corresponding to btrees that use shared cache. Then the runtime of +// ** this routine is N*N. But as N is rarely more than 1, this should not +// ** be a problem. +// */ +func _sqlite3VdbeEnter(tls *libc.TLS, p uintptr) { + var aDb, db uintptr + var i, nDb int32 + _, _, _, _ = aDb, db, i, nDb + if (*TVdbe)(unsafe.Pointer(p)).FlockMask == uint32(0) { + return + } /* The common case */ + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + aDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb + i = 0 + for { + if !(i < nDb) { + break + } + if i != int32(1) && (*TVdbe)(unsafe.Pointer(p)).FlockMask&(libc.Uint32FromInt32(1)< 0 { + for { + (*TMem)(unsafe.Pointer(p)).Fflags = flags + (*TMem)(unsafe.Pointer(p)).Fdb = db + (*TMem)(unsafe.Pointer(p)).FszMalloc = 0 + p += 56 + goto _2 + _2: + ; + N-- + v1 = N + if !(v1 > 0) { + break + } + } + } +} + +// C documentation +// +// /* +// ** Release auxiliary memory held in an array of N Mem elements. +// ** +// ** After this routine returns, all Mem elements in the array will still +// ** be valid. Those Mem elements that were not holding auxiliary resources +// ** will be unchanged. Mem elements which had something freed will be +// ** set to MEM_Undefined. +// */ +func _releaseMemArray(tls *libc.TLS, p uintptr, N int32) { + var db, pEnd, v1, v3 uintptr + _, _, _, _ = db, pEnd, v1, v3 + if p != 0 && N != 0 { + pEnd = p + uintptr(N)*56 + db = (*TMem)(unsafe.Pointer(p)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed != 0 { + for { + if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _sqlite3DbFree(tls, db, (*TMem)(unsafe.Pointer(p)).FzMalloc) + } + goto _2 + _2: + ; + p += 56 + v1 = p + if !(v1 < pEnd) { + break + } + } + return + } + for { + /* This block is really an inlined version of sqlite3VdbeMemRelease() + ** that takes advantage of the fact that the memory cell value is + ** being set to NULL after releasing any dynamic resources. + ** + ** The justification for duplicating code is that according to + ** callgrind, this causes a certain test case to hit the CPU 4.7 + ** percent less (x86 linux, gcc version 4.1.2, -O6) than if + ** sqlite3MemRelease() were called from here. With -O2, this jumps + ** to 6.6 percent. The test case is inserting 1000 rows into a table + ** with no indexes using a single prepared INSERT statement, bind() + ** and reset(). Inserts are grouped into a transaction. + */ + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _sqlite3VdbeMemRelease(tls, p) + (*TMem)(unsafe.Pointer(p)).Fflags = uint16(MEM_Undefined) + } else { + if (*TMem)(unsafe.Pointer(p)).FszMalloc != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TMem)(unsafe.Pointer(p)).FzMalloc) + (*TMem)(unsafe.Pointer(p)).FszMalloc = 0 + (*TMem)(unsafe.Pointer(p)).Fflags = uint16(MEM_Undefined) + } + } + goto _4 + _4: + ; + p += 56 + v3 = p + if !(v3 < pEnd) { + break + } + } + } +} + +// C documentation +// +// /* +// ** This is a destructor on a Mem object (which is really an sqlite3_value) +// ** that deletes the Frame object that is attached to it as a blob. +// ** +// ** This routine does not delete the Frame right away. It merely adds the +// ** frame to a list of frames to be deleted when the Vdbe halts. +// */ +func _sqlite3VdbeFrameMemDel(tls *libc.TLS, pArg uintptr) { + var pFrame uintptr + _ = pFrame + pFrame = pArg + (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent = (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame + (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame = pFrame +} + +// C documentation +// +// /* +// ** Locate the next opcode to be displayed in EXPLAIN or EXPLAIN +// ** QUERY PLAN output. +// ** +// ** Return SQLITE_ROW on success. Return SQLITE_DONE if there are no +// ** more opcodes to be displayed. +// */ +func _sqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, piPc uintptr, piAddr uintptr, paOp uintptr) (r int32) { + var aOp, apSub uintptr + var i, iPc, j, j1, nByte, nRow, nSub, rc, v2, v5 int32 + _, _, _, _, _, _, _, _, _, _, _, _ = aOp, apSub, i, iPc, j, j1, nByte, nRow, nSub, rc, v2, v5 /* Stop when row count reaches this */ + nSub = 0 /* Number of sub-vdbes seen so far */ + apSub = uintptr(0) /* Next instruction address */ + rc = SQLITE_OK /* Result code */ + aOp = uintptr(0) /* Rowid. Copy of value in *piPc */ + /* When the number of output rows reaches nRow, that means the + ** listing has finished and sqlite3_step() should return SQLITE_DONE. + ** nRow is the sum of the number of rows in the main program, plus + ** the sum of the number of rows in all trigger subprograms encountered + ** so far. The nRow value will increase as new trigger subprograms are + ** encountered, but p->pc will eventually catch up to nRow. + */ + nRow = (*TVdbe)(unsafe.Pointer(p)).FnOp + if pSub != uintptr(0) { + if int32((*TMem)(unsafe.Pointer(pSub)).Fflags)&int32(MEM_Blob) != 0 { + /* pSub is initiallly NULL. It is initialized to a BLOB by + ** the P4_SUBPROGRAM processing logic below */ + nSub = int32(uint64((*TMem)(unsafe.Pointer(pSub)).Fn) / uint64(8)) + apSub = (*TMem)(unsafe.Pointer(pSub)).Fz + } + i = 0 + for { + if !(i < nSub) { + break + } + nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp + goto _1 + _1: + ; + i++ + } + } + iPc = *(*int32)(unsafe.Pointer(piPc)) + for int32(1) != 0 { /* Loop exits via break */ + v2 = iPc + iPc++ + i = v2 + if i >= nRow { + (*TVdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + rc = int32(SQLITE_DONE) + break + } + if i < (*TVdbe)(unsafe.Pointer(p)).FnOp { + /* The rowid is small enough that we are still in the + ** main program. */ + aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + } else { + i -= (*TVdbe)(unsafe.Pointer(p)).FnOp + j = 0 + for { + if !(i >= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp) { + break + } + i -= (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp + goto _3 + _3: + ; + j++ + } + aOp = (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp + } + /* When an OP_Program opcode is encounter (the only opcode that has + ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms + ** kept in p->aMem[9].z to hold the new program - assuming this subprogram + ** has not already been seen. + */ + if pSub != uintptr(0) && int32((*(*TOp)(unsafe.Pointer(aOp + uintptr(i)*24))).Fp4type) == -int32(4) { + nByte = int32(uint64(nSub+libc.Int32FromInt32(1)) * uint64(8)) + j1 = 0 + for { + if !(j1 < nSub) { + break + } + if *(*uintptr)(unsafe.Pointer(apSub + uintptr(j1)*8)) == *(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16)) { + break + } + goto _4 + _4: + ; + j1++ + } + if j1 == nSub { + (*TVdbe)(unsafe.Pointer(p)).Frc = _sqlite3VdbeMemGrow(tls, pSub, nByte, libc.BoolInt32(nSub != 0)) + if (*TVdbe)(unsafe.Pointer(p)).Frc != SQLITE_OK { + rc = int32(SQLITE_ERROR) + break + } + apSub = (*TMem)(unsafe.Pointer(pSub)).Fz + v5 = nSub + nSub++ + *(*uintptr)(unsafe.Pointer(apSub + uintptr(v5)*8)) = *(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16)) + (*TMem)(unsafe.Pointer(pSub)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pSub)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Blob)) + (*TMem)(unsafe.Pointer(pSub)).Fn = int32(uint64(nSub) * uint64(8)) + nRow += (*TSubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16)))).FnOp + } + } + if eMode == 0 { + break + } + if int32((*(*TOp)(unsafe.Pointer(aOp + uintptr(i)*24))).Fopcode) == int32(OP_Explain) { + break + } + if int32((*(*TOp)(unsafe.Pointer(aOp + uintptr(i)*24))).Fopcode) == int32(OP_Init) && iPc > int32(1) { + break + } + } + *(*int32)(unsafe.Pointer(piPc)) = iPc + *(*int32)(unsafe.Pointer(piAddr)) = i + *(*uintptr)(unsafe.Pointer(paOp)) = aOp + return rc +} + +// C documentation +// +// /* +// ** Delete a VdbeFrame object and its contents. VdbeFrame objects are +// ** allocated by the OP_Program opcode in sqlite3VdbeExec(). +// */ +func _sqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { + var aMem, apCsr uintptr + var i int32 + _, _, _ = aMem, apCsr, i + aMem = p + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + apCsr = aMem + uintptr((*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem)*56 + i = 0 + for { + if !(i < (*TVdbeFrame)(unsafe.Pointer(p)).FnChildCsr) { + break + } + if *(*uintptr)(unsafe.Pointer(apCsr + uintptr(i)*8)) != 0 { + _sqlite3VdbeFreeCursorNN(tls, (*TVdbeFrame)(unsafe.Pointer(p)).Fv, *(*uintptr)(unsafe.Pointer(apCsr + uintptr(i)*8))) + } + goto _1 + _1: + ; + i++ + } + _releaseMemArray(tls, aMem, (*TVdbeFrame)(unsafe.Pointer(p)).FnChildMem) + _sqlite3VdbeDeleteAuxData(tls, (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(p)).Fv)).Fdb, p+64, -int32(1), 0) + _sqlite3DbFree(tls, (*TVdbe)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(p)).Fv)).Fdb, p) +} + +// C documentation +// +// /* +// ** Give a listing of the program in the virtual machine. +// ** +// ** The interface is the same as sqlite3VdbeExec(). But instead of +// ** running the code, it invokes the callback once for each instruction. +// ** This feature is used to implement "EXPLAIN". +// ** +// ** When p->explain==1, each instruction is listed. When +// ** p->explain==2, only OP_Explain instructions are listed and these +// ** are shown in a different format. p->explain==2 is used to implement +// ** EXPLAIN QUERY PLAN. +// ** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers +// ** are also shown, so that the boundaries between the main program and +// ** each trigger are clear. +// ** +// ** When p->explain==1, first the main program is listed, then each of +// ** the trigger subprograms are listed one by one. +// */ +func _sqlite3VdbeList(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bListSubprogs, rc int32 + var db, pMem, pOp, pSub, zP4 uintptr + var _ /* aOp at bp+8 */ uintptr + var _ /* i at bp+0 */ int32 + _, _, _, _, _, _, _ = bListSubprogs, db, pMem, pOp, pSub, rc, zP4 + pSub = uintptr(0) /* Memory cell hold array of subprogs */ + db = (*TVdbe)(unsafe.Pointer(p)).Fdb /* Loop counter */ + rc = SQLITE_OK /* Return code */ + pMem = (*TVdbe)(unsafe.Pointer(p)).FaMem + 1*56 /* First Mem of result set */ + bListSubprogs = libc.BoolInt32(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) == int32(1) || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TriggerEQP) != uint64(0)) /* Current opcode */ + /* Even though this opcode does not use dynamic strings for + ** the result, result columns may become dynamic if the user calls + ** sqlite3_column_text16(), causing a translation to UTF-16 encoding. + */ + _releaseMemArray(tls, pMem, int32(8)) + if (*TVdbe)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOMEM) { + /* This happens if a malloc() inside a call to sqlite3_column_text() or + ** sqlite3_column_text16() failed. */ + _sqlite3OomFault(tls, db) + return int32(SQLITE_ERROR) + } + if bListSubprogs != 0 { + /* The first 8 memory cells are used for the result set. So we will + ** commandeer the 9th cell to use as storage for an array of pointers + ** to trigger subprograms. The VDBE is guaranteed to have at least 9 + ** cells. */ + pSub = (*TVdbe)(unsafe.Pointer(p)).FaMem + 9*56 + } else { + pSub = uintptr(0) + } + /* Figure out which opcode is next to display */ + rc = _sqlite3VdbeNextOpcode(tls, p, pSub, libc.BoolInt32(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) == int32(2)), p+48, bp, bp+8) + if rc == SQLITE_OK { + pOp = *(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(*(*int32)(unsafe.Pointer(bp)))*24 + if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_INTERRUPT) + rc = int32(SQLITE_ERROR) + _sqlite3VdbeError(tls, p, _sqlite3ErrStr(tls, (*TVdbe)(unsafe.Pointer(p)).Frc), 0) + } else { + zP4 = _sqlite3VdbeDisplayP4(tls, db, pOp) + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) == int32(2) { + _sqlite3VdbeMemSetInt64(tls, pMem, int64((*TOp)(unsafe.Pointer(pOp)).Fp1)) + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(1)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp2)) + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(2)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp3)) + _sqlite3VdbeMemSetStr(tls, pMem+uintptr(3)*56, zP4, int64(-int32(1)), uint8(SQLITE_UTF8), __ccgo_fp(Xsqlite3_free)) + } else { + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(0)*56, int64(*(*int32)(unsafe.Pointer(bp)))) + _sqlite3VdbeMemSetStr(tls, pMem+uintptr(1)*56, _sqlite3OpcodeName(tls, int32((*TOp)(unsafe.Pointer(pOp)).Fopcode)), int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(2)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp1)) + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(3)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp2)) + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(4)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp3)) + /* pMem+5 for p4 is done last */ + _sqlite3VdbeMemSetInt64(tls, pMem+uintptr(6)*56, int64((*TOp)(unsafe.Pointer(pOp)).Fp5)) + _sqlite3VdbeMemSetNull(tls, pMem+uintptr(7)*56) + _sqlite3VdbeMemSetStr(tls, pMem+uintptr(5)*56, zP4, int64(-int32(1)), uint8(SQLITE_UTF8), __ccgo_fp(Xsqlite3_free)) + } + (*TVdbe)(unsafe.Pointer(p)).FpResultRow = pMem + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + rc = int32(SQLITE_ERROR) + } else { + (*TVdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + rc = int32(SQLITE_ROW) + } + } + } + return rc +} + +/* An instance of this object describes bulk memory available for use +** by subcomponents of a prepared statement. Space is allocated out +** of a ReusableSpace object by the allocSpace() routine below. + */ +type TReusableSpace = struct { + FpSpace uintptr + FnFree Tsqlite3_int64 + FnNeeded Tsqlite3_int64 +} + +type ReusableSpace = TReusableSpace + +// C documentation +// +// /* Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf +// ** from the ReusableSpace object. Return a pointer to the allocated +// ** memory on success. If insufficient memory is available in the +// ** ReusableSpace object, increase the ReusableSpace.nNeeded +// ** value by the amount needed and return NULL. +// ** +// ** If pBuf is not initially NULL, that means that the memory has already +// ** been allocated by a prior call to this routine, so just return a copy +// ** of pBuf and leave ReusableSpace unchanged. +// ** +// ** This allocator is employed to repurpose unused slots at the end of the +// ** opcode array of prepared state for other memory needs of the prepared +// ** statement. +// */ +func _allocSpace(tls *libc.TLS, p uintptr, pBuf uintptr, nByte Tsqlite3_int64) (r uintptr) { + if pBuf == uintptr(0) { + nByte = nByte + if nByte <= (*TReusableSpace)(unsafe.Pointer(p)).FnFree { + *(*Tsqlite3_int64)(unsafe.Pointer(p + 8)) -= nByte + pBuf = (*TReusableSpace)(unsafe.Pointer(p)).FpSpace + uintptr((*TReusableSpace)(unsafe.Pointer(p)).FnFree) + } else { + *(*Tsqlite3_int64)(unsafe.Pointer(p + 16)) += nByte + } + } + return pBuf +} + +// C documentation +// +// /* +// ** Rewind the VDBE back to the beginning in preparation for +// ** running it. +// */ +func _sqlite3VdbeRewind(tls *libc.TLS, p uintptr) { + /* There should be at least one opcode. + */ + (*TVdbe)(unsafe.Pointer(p)).FeVdbeState = uint8(VDBE_READY_STATE) + (*TVdbe)(unsafe.Pointer(p)).Fpc = -int32(1) + (*TVdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(OE_Abort) + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = uint32(1) + (*TVdbe)(unsafe.Pointer(p)).FminWriteFileFormat = uint8(255) + (*TVdbe)(unsafe.Pointer(p)).FiStatement = 0 + (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint = 0 +} + +// C documentation +// +// /* +// ** Prepare a virtual machine for execution for the first time after +// ** creating the virtual machine. This involves things such +// ** as allocating registers and initializing the program counter. +// ** After the VDBE has be prepped, it can be executed by one or more +// ** calls to sqlite3VdbeExec(). +// ** +// ** This function may be called exactly once on each virtual machine. +// ** After this routine is called the VM has been "packaged" and is ready +// ** to run. After this routine is called, further calls to +// ** sqlite3VdbeAddOp() functions are prohibited. This routine disconnects +// ** the Vdbe from the Parse object that helped generate it so that the +// ** the Vdbe becomes an independent entity and the Parse object can be +// ** destroyed. +// ** +// ** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back +// ** to its initial state after it has been run. +// */ +func _sqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, v1 uintptr + var n, nCursor, nMem, nVar int32 + var _ /* nArg at bp+0 */ int32 + var _ /* x at bp+8 */ TReusableSpace + _, _, _, _, _, _ = db, n, nCursor, nMem, nVar, v1 /* Reusable bulk memory */ + (*TVdbe)(unsafe.Pointer(p)).FpVList = (*TParse)(unsafe.Pointer(pParse)).FpVList + (*TParse)(unsafe.Pointer(pParse)).FpVList = uintptr(0) + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + nVar = int32((*TParse)(unsafe.Pointer(pParse)).FnVar) + nMem = (*TParse)(unsafe.Pointer(pParse)).FnMem + nCursor = (*TParse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(bp)) = (*TParse)(unsafe.Pointer(pParse)).FnMaxArg + /* Each cursor uses a memory cell. The first cursor (cursor 0) can + ** use aMem[0] which is not otherwise used by the VDBE program. Allocate + ** space at the end of aMem[] for cursors 1 and greater. + ** See also: allocateCursor(). + */ + nMem += nCursor + if nCursor == 0 && nMem > 0 { + nMem++ + } /* Space for aMem[0] even if not used */ + /* Figure out how much reusable memory is available at the end of the + ** opcode array. This extra memory will be reallocated for other elements + ** of the prepared statement. + */ + n = int32(libc.Uint64FromInt64(24) * uint64((*TVdbe)(unsafe.Pointer(p)).FnOp)) /* Bytes of opcode memory used */ + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FpSpace = (*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(n) /* Unused opcode memory */ + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnFree = int64(((*TParse)(unsafe.Pointer(pParse)).FszOpAlloc - n) & ^libc.Int32FromInt32(7)) /* Bytes of unused memory */ + _resolveP2Values(tls, p, bp) + libc.SetBitFieldPtr16Uint32(p+200, uint32(libc.BoolUint8((*TParse)(unsafe.Pointer(pParse)).FisMultiWrite != 0 && (*TParse)(unsafe.Pointer(pParse)).FmayAbort != 0)), 5, 0x20) + if (*TParse)(unsafe.Pointer(pParse)).Fexplain != 0 { + if nMem < int32(10) { + nMem = int32(10) + } + libc.SetBitFieldPtr16Uint32(p+200, uint32((*TParse)(unsafe.Pointer(pParse)).Fexplain), 2, 0xc) + (*TVdbe)(unsafe.Pointer(p)).FnResColumn = uint16(int32(12) - int32(4)*int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2))) + } + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) + /* Memory for registers, parameters, cursor, etc, is allocated in one or two + ** passes. On the first pass, we try to reuse unused memory at the + ** end of the opcode array. If we are unable to satisfy all memory + ** requirements by reusing the opcode array tail, then the second + ** pass will fill in the remainder using a fresh memory allocation. + ** + ** This two-pass approach that reuses as much memory as possible from + ** the leftover memory at the end of the opcode array. This can significantly + ** reduce the amount of memory held by a prepared statement. + */ + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnNeeded = 0 + (*TVdbe)(unsafe.Pointer(p)).FaMem = _allocSpace(tls, bp+8, uintptr(0), int64(uint64(nMem)*uint64(56))) + (*TVdbe)(unsafe.Pointer(p)).FaVar = _allocSpace(tls, bp+8, uintptr(0), int64(uint64(nVar)*uint64(56))) + (*TVdbe)(unsafe.Pointer(p)).FapArg = _allocSpace(tls, bp+8, uintptr(0), int64(uint64(*(*int32)(unsafe.Pointer(bp)))*uint64(8))) + (*TVdbe)(unsafe.Pointer(p)).FapCsr = _allocSpace(tls, bp+8, uintptr(0), int64(uint64(nCursor)*uint64(8))) + if (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnNeeded != 0 { + v1 = _sqlite3DbMallocRawNN(tls, db, uint64((*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnNeeded)) + (*TVdbe)(unsafe.Pointer(p)).FpFree = v1 + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FpSpace = v1 + (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnFree = (*(*TReusableSpace)(unsafe.Pointer(bp + 8))).FnNeeded + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + (*TVdbe)(unsafe.Pointer(p)).FaMem = _allocSpace(tls, bp+8, (*TVdbe)(unsafe.Pointer(p)).FaMem, int64(uint64(nMem)*uint64(56))) + (*TVdbe)(unsafe.Pointer(p)).FaVar = _allocSpace(tls, bp+8, (*TVdbe)(unsafe.Pointer(p)).FaVar, int64(uint64(nVar)*uint64(56))) + (*TVdbe)(unsafe.Pointer(p)).FapArg = _allocSpace(tls, bp+8, (*TVdbe)(unsafe.Pointer(p)).FapArg, int64(uint64(*(*int32)(unsafe.Pointer(bp)))*uint64(8))) + (*TVdbe)(unsafe.Pointer(p)).FapCsr = _allocSpace(tls, bp+8, (*TVdbe)(unsafe.Pointer(p)).FapCsr, int64(uint64(nCursor)*uint64(8))) + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TVdbe)(unsafe.Pointer(p)).FnVar = 0 + (*TVdbe)(unsafe.Pointer(p)).FnCursor = 0 + (*TVdbe)(unsafe.Pointer(p)).FnMem = 0 + } else { + (*TVdbe)(unsafe.Pointer(p)).FnCursor = nCursor + (*TVdbe)(unsafe.Pointer(p)).FnVar = int16(nVar) + _initMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar, nVar, db, uint16(MEM_Null)) + (*TVdbe)(unsafe.Pointer(p)).FnMem = nMem + _initMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaMem, nMem, db, uint16(MEM_Undefined)) + libc.Xmemset(tls, (*TVdbe)(unsafe.Pointer(p)).FapCsr, 0, uint64(nCursor)*uint64(8)) + } + _sqlite3VdbeRewind(tls, p) +} + +// C documentation +// +// /* +// ** Close a VDBE cursor and release all the resources that cursor +// ** happens to hold. +// */ +func _sqlite3VdbeFreeCursor(tls *libc.TLS, p uintptr, pCx uintptr) { + if pCx != 0 { + _sqlite3VdbeFreeCursorNN(tls, p, pCx) + } +} + +func _freeCursorWithCache(tls *libc.TLS, p uintptr, pCx uintptr) { + var pCache uintptr + _ = pCache + pCache = (*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache + libc.SetBitFieldPtr8Uint32(pCx+8, libc.Uint32FromInt32(0), 4, 0x10) + (*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache = uintptr(0) + if (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue != 0 { + _sqlite3RCStrUnref(tls, (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue) + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue = uintptr(0) + } + _sqlite3DbFree(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, pCache) + _sqlite3VdbeFreeCursorNN(tls, p, pCx) +} + +func _sqlite3VdbeFreeCursorNN(tls *libc.TLS, p uintptr, pCx uintptr) { + var pModule, pVCur uintptr + _, _ = pModule, pVCur + if int32(TBool(*(*uint8)(unsafe.Pointer(pCx + 8))&0x10>>4)) != 0 { + _freeCursorWithCache(tls, p, pCx) + return + } + switch int32((*TVdbeCursor)(unsafe.Pointer(pCx)).FeCurType) { + case int32(CURTYPE_SORTER): + _sqlite3VdbeSorterClose(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, pCx) + case CURTYPE_BTREE: + _sqlite3BtreeCloseCursor(tls, *(*uintptr)(unsafe.Pointer(pCx + 48))) + case int32(CURTYPE_VTAB): + pVCur = *(*uintptr)(unsafe.Pointer(pCx + 48)) + pModule = (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FpModule + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FnRef-- + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxClose})))(tls, pVCur) + break + } +} + +// C documentation +// +// /* +// ** Close all cursors in the current frame. +// */ +func _closeCursorsInFrame(tls *libc.TLS, p uintptr) { + var i int32 + var pC uintptr + _, _ = i, pC + i = 0 + for { + if !(i < (*TVdbe)(unsafe.Pointer(p)).FnCursor) { + break + } + pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(i)*8)) + if pC != 0 { + _sqlite3VdbeFreeCursorNN(tls, p, pC) + *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(i)*8)) = uintptr(0) + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Copy the values stored in the VdbeFrame structure to its Vdbe. This +// ** is used, for example, when a trigger sub-program is halted to restore +// ** control to the main program. +// */ +func _sqlite3VdbeFrameRestore(tls *libc.TLS, pFrame uintptr) (r int32) { + var v uintptr + _ = v + v = (*TVdbeFrame)(unsafe.Pointer(pFrame)).Fv + _closeCursorsInFrame(tls, v) + (*TVdbe)(unsafe.Pointer(v)).FaOp = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FaOp + (*TVdbe)(unsafe.Pointer(v)).FnOp = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FnOp + (*TVdbe)(unsafe.Pointer(v)).FaMem = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FaMem + (*TVdbe)(unsafe.Pointer(v)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FnMem + (*TVdbe)(unsafe.Pointer(v)).FapCsr = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FapCsr + (*TVdbe)(unsafe.Pointer(v)).FnCursor = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FnCursor + (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).Fdb)).FlastRowid = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FlastRowid + (*TVdbe)(unsafe.Pointer(v)).FnChange = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FnChange + (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).Fdb)).FnChange = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FnDbChange + _sqlite3VdbeDeleteAuxData(tls, (*TVdbe)(unsafe.Pointer(v)).Fdb, v+296, -int32(1), 0) + (*TVdbe)(unsafe.Pointer(v)).FpAuxData = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpAuxData + (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpAuxData = uintptr(0) + return (*TVdbeFrame)(unsafe.Pointer(pFrame)).Fpc +} + +// C documentation +// +// /* +// ** Close all cursors. +// ** +// ** Also release any dynamic memory held by the VM in the Vdbe.aMem memory +// ** cell array. This is necessary as the memory cell array may contain +// ** pointers to VdbeFrame objects, which may in turn contain pointers to +// ** open cursors. +// */ +func _closeAllCursors(tls *libc.TLS, p uintptr) { + var pDel, pFrame uintptr + _, _ = pDel, pFrame + if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { + pFrame = (*TVdbe)(unsafe.Pointer(p)).FpFrame + for { + if !((*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent != 0) { + break + } + goto _1 + _1: + ; + pFrame = (*TVdbeFrame)(unsafe.Pointer(pFrame)).FpParent + } + _sqlite3VdbeFrameRestore(tls, pFrame) + (*TVdbe)(unsafe.Pointer(p)).FpFrame = uintptr(0) + (*TVdbe)(unsafe.Pointer(p)).FnFrame = 0 + } + _closeCursorsInFrame(tls, p) + _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaMem, (*TVdbe)(unsafe.Pointer(p)).FnMem) + for (*TVdbe)(unsafe.Pointer(p)).FpDelFrame != 0 { + pDel = (*TVdbe)(unsafe.Pointer(p)).FpDelFrame + (*TVdbe)(unsafe.Pointer(p)).FpDelFrame = (*TVdbeFrame)(unsafe.Pointer(pDel)).FpParent + _sqlite3VdbeFrameDelete(tls, pDel) + } + /* Delete any auxdata allocations made by the VM */ + if (*TVdbe)(unsafe.Pointer(p)).FpAuxData != 0 { + _sqlite3VdbeDeleteAuxData(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, p+296, -int32(1), 0) + } +} + +// C documentation +// +// /* +// ** Set the number of result columns that will be returned by this SQL +// ** statement. This is now set at compile time, rather than during +// ** execution of the vdbe program so that sqlite3_column_count() can +// ** be called on an SQL statement before sqlite3_step(). +// */ +func _sqlite3VdbeSetNumCols(tls *libc.TLS, p uintptr, nResColumn int32) { + var db uintptr + var n int32 + var v1 Tu16 + _, _, _ = db, n, v1 + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + if (*TVdbe)(unsafe.Pointer(p)).FnResAlloc != 0 { + _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName, int32((*TVdbe)(unsafe.Pointer(p)).FnResAlloc)*int32(COLNAME_N)) + _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FaColName) + } + n = nResColumn * int32(COLNAME_N) + v1 = uint16(nResColumn) + (*TVdbe)(unsafe.Pointer(p)).FnResAlloc = v1 + (*TVdbe)(unsafe.Pointer(p)).FnResColumn = v1 + (*TVdbe)(unsafe.Pointer(p)).FaColName = _sqlite3DbMallocRawNN(tls, db, uint64(56)*uint64(n)) + if (*TVdbe)(unsafe.Pointer(p)).FaColName == uintptr(0) { + return + } + _initMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName, n, db, uint16(MEM_Null)) +} + +// C documentation +// +// /* +// ** Set the name of the idx'th column to be returned by the SQL statement. +// ** zName must be a pointer to a nul terminated string. +// ** +// ** This call must be made after a call to sqlite3VdbeSetNumCols(). +// ** +// ** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC +// ** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed +// ** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed. +// */ +func _sqlite3VdbeSetColName(tls *libc.TLS, p uintptr, idx int32, var1 int32, zName uintptr, xDel uintptr) (r int32) { + var pColName uintptr + var rc int32 + _, _ = pColName, rc + if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + return int32(SQLITE_NOMEM) + } + pColName = (*TVdbe)(unsafe.Pointer(p)).FaColName + uintptr(idx+var1*int32((*TVdbe)(unsafe.Pointer(p)).FnResAlloc))*56 + rc = _sqlite3VdbeMemSetStr(tls, pColName, zName, int64(-int32(1)), uint8(SQLITE_UTF8), xDel) + return rc +} + +// C documentation +// +// /* +// ** A read or write transaction may or may not be active on database handle +// ** db. If a transaction is active, commit it. If there is a +// ** write-transaction spanning more than one database file, this routine +// ** takes care of the super-journal trickery. +// */ +func _vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, nMainFile, nTrans, needXcommit, rc, retryCount, v5 int32 + var offset Ti64 + var pBt, pBt1, pBt2, pBt3, pBt4, pBt5, pPager, pVfs, zFile, zMainFile, zSuper uintptr + var v6 bool + var _ /* iRandom at bp+12 */ Tu32 + var _ /* pSuperJrnl at bp+0 */ uintptr + var _ /* res at bp+8 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, nMainFile, nTrans, needXcommit, offset, pBt, pBt1, pBt2, pBt3, pBt4, pBt5, pPager, pVfs, rc, retryCount, zFile, zMainFile, zSuper, v5, v6 + nTrans = 0 /* Number of databases with an active write-transaction + ** that are candidates for a two-phase commit using a + ** super-journal */ + rc = SQLITE_OK + needXcommit = 0 + /* Before doing anything else, call the xSync() callback for any + ** virtual module tables written in this transaction. This has to + ** be done before determining whether a super-journal file is + ** required, as an xSync() callback may add an attached database + ** to the transaction. + */ + rc = _sqlite3VtabSync(tls, db, p) + /* This loop determines (a) if the commit hook should be invoked and + ** (b) how many database files have open write transactions, not + ** including the temp database. (b) is important because if more than + ** one database file has an open write transaction, a super-journal + ** file is required for an atomic commit. + */ + i = 0 + for { + if !(rc == SQLITE_OK && i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if _sqlite3BtreeTxnState(tls, pBt) == int32(SQLITE_TXN_WRITE) { + needXcommit = int32(1) + _sqlite3BtreeEnter(tls, pBt) + pPager = _sqlite3BtreePager(tls, pBt) + if int32((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).Fsafety_level) != int32(PAGER_SYNCHRONOUS_OFF) && _aMJNeeded[_sqlite3PagerGetJournalMode(tls, pPager)] != 0 && _sqlite3PagerIsMemdb(tls, pPager) == 0 { + nTrans++ + } + rc = _sqlite3PagerExclusiveLock(tls, pPager) + _sqlite3BtreeLeave(tls, pBt) + } + goto _1 + _1: + ; + i++ + } + if rc != SQLITE_OK { + return rc + } + /* If there are any write-transactions at all, invoke the commit hook */ + if needXcommit != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FxCommitCallback != 0 { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxCommitCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpCommitArg) + if rc != 0 { + return libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(2)< int32(100) { + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5215, libc.VaList(bp+24, zSuper)) + _sqlite3OsDelete(tls, pVfs, zSuper, 0) + break + } else { + if retryCount == int32(1) { + Xsqlite3_log(tls, int32(SQLITE_FULL), __ccgo_ts+5229, libc.VaList(bp+24, zSuper)) + } + } + } + retryCount++ + Xsqlite3_randomness(tls, int32(4), bp+12) + Xsqlite3_snprintf(tls, int32(13), zSuper+uintptr(nMainFile), __ccgo_ts+5244, libc.VaList(bp+24, *(*Tu32)(unsafe.Pointer(bp + 12))>>libc.Int32FromInt32(8)&uint32(0xffffff), *(*Tu32)(unsafe.Pointer(bp + 12))&uint32(0xff))) + /* The antipenultimate character of the super-journal name must + ** be "9" to avoid name collisions when using 8+3 filenames. */ + rc = _sqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+8) + } + if rc == SQLITE_OK { + /* Open the super-journal. */ + rc = _sqlite3OsOpenMalloc(tls, pVfs, zSuper, bp, libc.Int32FromInt32(SQLITE_OPEN_READWRITE)|libc.Int32FromInt32(SQLITE_OPEN_CREATE)|libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE)|libc.Int32FromInt32(SQLITE_OPEN_SUPER_JOURNAL), uintptr(0)) + } + if rc != SQLITE_OK { + _sqlite3DbFree(tls, db, zSuper-uintptr(4)) + return rc + } + /* Write the name of each database file in the transaction into the new + ** super-journal file. If an error occurs at this point close + ** and delete the super-journal file. All the individual journal files + ** still have 'null' as the super-journal pointer, so they will roll + ** back independently if a failure occurs. + */ + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt3 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if _sqlite3BtreeTxnState(tls, pBt3) == int32(SQLITE_TXN_WRITE) { + zFile = _sqlite3BtreeGetJournalname(tls, pBt3) + if zFile == uintptr(0) { + goto _4 /* Ignore TEMP and :memory: databases */ + } + rc = _sqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp)), zFile, _sqlite3Strlen30(tls, zFile)+int32(1), offset) + offset += int64(_sqlite3Strlen30(tls, zFile) + int32(1)) + if rc != SQLITE_OK { + _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3OsDelete(tls, pVfs, zSuper, 0) + _sqlite3DbFree(tls, db, zSuper-uintptr(4)) + return rc + } + } + goto _4 + _4: + ; + i++ + } + /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device + ** flag is set this is not required. + */ + if v6 = 0 == _sqlite3OsDeviceCharacteristics(tls, *(*uintptr)(unsafe.Pointer(bp)))&int32(SQLITE_IOCAP_SEQUENTIAL); v6 { + v5 = _sqlite3OsSync(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(SQLITE_SYNC_NORMAL)) + rc = v5 + } + if v6 && SQLITE_OK != v5 { + _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3OsDelete(tls, pVfs, zSuper, 0) + _sqlite3DbFree(tls, db, zSuper-uintptr(4)) + return rc + } + /* Sync all the db files involved in the transaction. The same call + ** sets the super-journal pointer in each individual journal. If + ** an error occurs here, do not delete the super-journal file. + ** + ** If the error occurs during the first call to + ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the + ** super-journal file will be orphaned. But we cannot delete it, + ** in case the super-journal file name was written into the journal + ** file before the failure occurred. + */ + i = 0 + for { + if !(rc == SQLITE_OK && i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt4 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt4 != 0 { + rc = _sqlite3BtreeCommitPhaseOne(tls, pBt4, zSuper) + } + goto _7 + _7: + ; + i++ + } + _sqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc != SQLITE_OK { + _sqlite3DbFree(tls, db, zSuper-uintptr(4)) + return rc + } + /* Delete the super-journal file. This commits the transaction. After + ** doing this the directory is synced again before any individual + ** transaction files are deleted. + */ + rc = _sqlite3OsDelete(tls, pVfs, zSuper, int32(1)) + _sqlite3DbFree(tls, db, zSuper-uintptr(4)) + zSuper = uintptr(0) + if rc != 0 { + return rc + } + /* All files and directories have already been synced, so the following + ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and + ** deleting or truncating journals. If something goes wrong while + ** this is happening we don't really care. The integrity of the + ** transaction is already guaranteed, but some stray 'cold' journals + ** may be lying around. Returning an error code won't help matters. + */ + _sqlite3BeginBenignMalloc(tls) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt5 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt5 != 0 { + _sqlite3BtreeCommitPhaseTwo(tls, pBt5, int32(1)) + } + goto _8 + _8: + ; + i++ + } + _sqlite3EndBenignMalloc(tls) + _sqlite3VtabCommit(tls, db) + } + return rc +} + +/* Whether or not a database might need a super-journal depends upon + ** its journal mode (among other things). This matrix determines which + ** journal modes use a super-journal and which do not */ +var _aMJNeeded = [6]Tu8{ + 0: uint8(1), + 1: uint8(1), + 3: uint8(1), +} + +/* +** This routine checks that the sqlite3.nVdbeActive count variable +** matches the number of vdbe's in the list sqlite3.pVdbe that are +** currently active. An assertion fails if the two counts do not match. +** This is an internal self-check only - it is not an essential processing +** step. +** +** This is a no-op if NDEBUG is defined. + */ + +// C documentation +// +// /* +// ** If the Vdbe passed as the first argument opened a statement-transaction, +// ** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or +// ** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement +// ** transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the +// ** statement transaction is committed. +// ** +// ** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned. +// ** Otherwise SQLITE_OK. +// */ +func _vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { + var db, pBt uintptr + var i, iSavepoint, rc, rc2 int32 + _, _, _, _, _, _ = db, i, iSavepoint, pBt, rc, rc2 + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + rc = SQLITE_OK + iSavepoint = (*TVdbe)(unsafe.Pointer(p)).FiStatement - int32(1) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + rc2 = SQLITE_OK + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 { + if eOp == int32(SAVEPOINT_ROLLBACK) { + rc2 = _sqlite3BtreeSavepoint(tls, pBt, int32(SAVEPOINT_ROLLBACK), iSavepoint) + } + if rc2 == SQLITE_OK { + rc2 = _sqlite3BtreeSavepoint(tls, pBt, int32(SAVEPOINT_RELEASE), iSavepoint) + } + if rc == SQLITE_OK { + rc = rc2 + } + } + goto _1 + _1: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement-- + (*TVdbe)(unsafe.Pointer(p)).FiStatement = 0 + if rc == SQLITE_OK { + if eOp == int32(SAVEPOINT_ROLLBACK) { + rc = _sqlite3VtabSavepoint(tls, db, int32(SAVEPOINT_ROLLBACK), iSavepoint) + } + if rc == SQLITE_OK { + rc = _sqlite3VtabSavepoint(tls, db, int32(SAVEPOINT_RELEASE), iSavepoint) + } + } + /* If the statement transaction is being rolled back, also restore the + ** database handles deferred constraint counter to the value it had when + ** the statement transaction was opened. */ + if eOp == int32(SAVEPOINT_ROLLBACK) { + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons = (*TVdbe)(unsafe.Pointer(p)).FnStmtDefCons + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = (*TVdbe)(unsafe.Pointer(p)).FnStmtDefImmCons + } + return rc +} + +func _sqlite3VdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) (r int32) { + if (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FnStatement != 0 && (*TVdbe)(unsafe.Pointer(p)).FiStatement != 0 { + return _vdbeCloseStatement(tls, p, eOp) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function is called when a transaction opened by the database +// ** handle associated with the VM passed as an argument is about to be +// ** committed. If there are outstanding deferred foreign key constraint +// ** violations, return SQLITE_ERROR. Otherwise, SQLITE_OK. +// ** +// ** If there are outstanding FK violations and this function returns +// ** SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY +// ** and write an error message to it. Then return SQLITE_ERROR. +// */ +func _sqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) (r int32) { + var db uintptr + _ = db + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + if deferred != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons+(*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > 0 || !(deferred != 0) && (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint > 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)<>7)) != 0 { /* Primary error code from p->rc */ + eStatementOp = 0 /* Set to true if a 'special' error */ + /* Lock all btrees used by the statement */ + _sqlite3VdbeEnter(tls, p) + /* Check for one of the special errors */ + if (*TVdbe)(unsafe.Pointer(p)).Frc != 0 { + mrc = (*TVdbe)(unsafe.Pointer(p)).Frc & int32(0xff) + isSpecialError = libc.BoolInt32(mrc == int32(SQLITE_NOMEM) || mrc == int32(SQLITE_IOERR) || mrc == int32(SQLITE_INTERRUPT) || mrc == int32(SQLITE_FULL)) + } else { + v1 = libc.Int32FromInt32(0) + isSpecialError = v1 + mrc = v1 + } + if isSpecialError != 0 { + /* If the query was read-only and the error code is SQLITE_INTERRUPT, + ** no rollback is necessary. Otherwise, at least a savepoint + ** transaction must be rolled back to restore the database to a + ** consistent state. + ** + ** Even if the statement is read-only, it is important to perform + ** a statement or transaction rollback operation. If the error + ** occurred while writing to the journal, sub-journal or database + ** file as part of an effort to free up cache space (see function + ** pagerStress() in pager.c), the rollback is required to restore + ** the pager to a consistent state. + */ + if !(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) != 0) || mrc != int32(SQLITE_INTERRUPT) { + if (mrc == int32(SQLITE_NOMEM) || mrc == int32(SQLITE_FULL)) && int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x20>>5)) != 0 { + eStatementOp = int32(SAVEPOINT_ROLLBACK) + } else { + /* We are forced to roll back the active transaction. Before doing + ** so, abort any other statements this handle currently has active. + */ + _sqlite3RollbackAll(tls, db, libc.Int32FromInt32(SQLITE_ABORT)|libc.Int32FromInt32(2)< 0 && (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans == uintptr(0)) && (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite == libc.BoolInt32(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) == 0) { + if (*TVdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK || int32((*TVdbe)(unsafe.Pointer(p)).FerrorAction) == int32(OE_Fail) && !(isSpecialError != 0) { + rc = _sqlite3VdbeCheckFk(tls, p, int32(1)) + if rc != SQLITE_OK { + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) != 0 { + _sqlite3VdbeLeave(tls, p) + return int32(SQLITE_ERROR) + } + rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)<>6)) != 0 { + _sqlite3VdbeLeave(tls, p) + return int32(SQLITE_BUSY) + } else { + if rc != SQLITE_OK { + _sqlite3SystemError(tls, db, rc) + (*TVdbe)(unsafe.Pointer(p)).Frc = rc + _sqlite3RollbackAll(tls, db, SQLITE_OK) + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_DeferFKs) + _sqlite3CommitInternalChanges(tls, db) + } + } + } else { + if (*TVdbe)(unsafe.Pointer(p)).Frc == int32(SQLITE_SCHEMA) && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + } else { + _sqlite3RollbackAll(tls, db, SQLITE_OK) + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + } + } + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement = 0 + } else { + if eStatementOp == 0 { + if (*TVdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK || int32((*TVdbe)(unsafe.Pointer(p)).FerrorAction) == int32(OE_Fail) { + eStatementOp = int32(SAVEPOINT_RELEASE) + } else { + if int32((*TVdbe)(unsafe.Pointer(p)).FerrorAction) == int32(OE_Abort) { + eStatementOp = int32(SAVEPOINT_ROLLBACK) + } else { + _sqlite3RollbackAll(tls, db, libc.Int32FromInt32(SQLITE_ABORT)|libc.Int32FromInt32(2)<>4)) != 0 { + if eStatementOp != int32(SAVEPOINT_ROLLBACK) { + _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) + } else { + _sqlite3VdbeSetChanges(tls, db, 0) + } + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + } + /* Release the locks */ + _sqlite3VdbeLeave(tls, p) + } + /* We have successfully halted and closed the VM. Record this fact. */ + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive-- + if !(int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) != 0) { + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite-- + } + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x80>>7)) != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead-- + } + (*TVdbe)(unsafe.Pointer(p)).FeVdbeState = uint8(VDBE_HALT_STATE) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } + /* If the auto-commit flag is set to true, then any locks that were held + ** by connection db have now been released. Call sqlite3ConnectionUnlocked() + ** to invoke any required unlock-notify callbacks. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + _sqlite3ConnectionUnlocked(tls, db) + } + if (*TVdbe)(unsafe.Pointer(p)).Frc == int32(SQLITE_BUSY) { + v2 = int32(SQLITE_BUSY) + } else { + v2 = SQLITE_OK + } + return v2 +} + +// C documentation +// +// /* +// ** Each VDBE holds the result of the most recent sqlite3_step() call +// ** in p->rc. This routine sets that result back to SQLITE_OK. +// */ +func _sqlite3VdbeResetStepResult(tls *libc.TLS, p uintptr) { + (*TVdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK +} + +// C documentation +// +// /* +// ** Copy the error code and error message belonging to the VDBE passed +// ** as the first argument to its database handle (so that they will be +// ** returned by calls to sqlite3_errcode() and sqlite3_errmsg()). +// ** +// ** This function does not clear the VDBE error code or message, just +// ** copies them to the database handle. +// */ +func _sqlite3VdbeTransferError(tls *libc.TLS, p uintptr) (r int32) { + var db uintptr + var rc int32 + _, _ = db, rc + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + rc = (*TVdbe)(unsafe.Pointer(p)).Frc + if (*TVdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FbBenignMalloc++ + _sqlite3BeginBenignMalloc(tls) + if (*Tsqlite3)(unsafe.Pointer(db)).FpErr == uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).FpErr = _sqlite3ValueNew(tls, db) + } + _sqlite3ValueSetStr(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr, -int32(1), (*TVdbe)(unsafe.Pointer(p)).FzErrMsg, uint8(SQLITE_UTF8), uintptr(-libc.Int32FromInt32(1))) + _sqlite3EndBenignMalloc(tls) + (*Tsqlite3)(unsafe.Pointer(db)).FbBenignMalloc-- + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 { + _sqlite3ValueSetNull(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + } + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = rc + (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset = -int32(1) + return rc +} + +// C documentation +// +// /* +// ** Clean up a VDBE after execution but do not delete the VDBE just yet. +// ** Write any error messages into *pzErrMsg. Return the result code. +// ** +// ** After this routine is run, the VDBE should be ready to be executed +// ** again. +// ** +// ** To look at it another way, this routine resets the state of the +// ** virtual machine from VDBE_RUN_STATE or VDBE_HALT_STATE back to +// ** VDBE_READY_STATE. +// */ +func _sqlite3VdbeReset(tls *libc.TLS, p uintptr) (r int32) { + var db uintptr + _ = db + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + /* If the VM did not run to completion or if it encountered an + ** error, then it might not have been halted properly. So halt + ** it now. + */ + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_RUN_STATE) { + _sqlite3VdbeHalt(tls, p) + } + /* If the VDBE has been run even partially, then transfer the error code + ** and error message from the VDBE into the main database structure. But + ** if the VDBE has just been set to run but has not actually executed any + ** instructions yet, leave the main database error information unchanged. + */ + if (*TVdbe)(unsafe.Pointer(p)).Fpc >= 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FpErr != 0 || (*TVdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + _sqlite3VdbeTransferError(tls, p) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = (*TVdbe)(unsafe.Pointer(p)).Frc + } + } + /* Reset register contents and reclaim error message memory. + */ + if (*TVdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = uintptr(0) + } + (*TVdbe)(unsafe.Pointer(p)).FpResultRow = uintptr(0) + /* Save profiling information from this VDBE run. + */ + return (*TVdbe)(unsafe.Pointer(p)).Frc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask +} + +// C documentation +// +// /* +// ** Clean up and delete a VDBE after execution. Return an integer which is +// ** the result code. Write any error message text into *pzErrMsg. +// */ +func _sqlite3VdbeFinalize(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) >= int32(VDBE_READY_STATE) { + rc = _sqlite3VdbeReset(tls, p) + } + _sqlite3VdbeDelete(tls, p) + return rc +} + +// C documentation +// +// /* +// ** If parameter iOp is less than zero, then invoke the destructor for +// ** all auxiliary data pointers currently cached by the VM passed as +// ** the first argument. +// ** +// ** Or, if iOp is greater than or equal to zero, then the destructor is +// ** only invoked for those auxiliary data pointers created by the user +// ** function invoked by the OP_Function opcode at instruction iOp of +// ** VM pVdbe, and only then if: +// ** +// ** * the associated function parameter is the 32nd or later (counting +// ** from left to right), or +// ** +// ** * the corresponding bit in argument mask is clear (where the first +// ** function parameter corresponds to bit 0 etc.). +// */ +func _sqlite3VdbeDeleteAuxData(tls *libc.TLS, db uintptr, pp uintptr, iOp int32, mask int32) { + var pAux uintptr + _ = pAux + for *(*uintptr)(unsafe.Pointer(pp)) != 0 { + pAux = *(*uintptr)(unsafe.Pointer(pp)) + if iOp < 0 || (*TAuxData)(unsafe.Pointer(pAux)).FiAuxOp == iOp && (*TAuxData)(unsafe.Pointer(pAux)).FiAuxArg >= 0 && ((*TAuxData)(unsafe.Pointer(pAux)).FiAuxArg > int32(31) || !(uint32(mask)&(libc.Uint32FromInt32(1)<<(*TAuxData)(unsafe.Pointer(pAux)).FiAuxArg) != 0)) { + if (*TAuxData)(unsafe.Pointer(pAux)).FxDeleteAux != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TAuxData)(unsafe.Pointer(pAux)).FxDeleteAux})))(tls, (*TAuxData)(unsafe.Pointer(pAux)).FpAux) + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TAuxData)(unsafe.Pointer(pAux)).FpNextAux + _sqlite3DbFree(tls, db, pAux) + } else { + pp = pAux + 24 + } + } +} + +// C documentation +// +// /* +// ** Free all memory associated with the Vdbe passed as the second argument, +// ** except for object itself, which is preserved. +// ** +// ** The difference between this function and sqlite3VdbeDelete() is that +// ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with +// ** the database connection and frees the object itself. +// */ +func _sqlite3VdbeClearObject(tls *libc.TLS, db uintptr, p uintptr) { + var pNext, pSub uintptr + _, _ = pNext, pSub + if (*TVdbe)(unsafe.Pointer(p)).FaColName != 0 { + _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName, int32((*TVdbe)(unsafe.Pointer(p)).FnResAlloc)*int32(COLNAME_N)) + _sqlite3DbNNFreeNN(tls, db, (*TVdbe)(unsafe.Pointer(p)).FaColName) + } + pSub = (*TVdbe)(unsafe.Pointer(p)).FpProgram + for { + if !(pSub != 0) { + break + } + pNext = (*TSubProgram)(unsafe.Pointer(pSub)).FpNext + _vdbeFreeOpArray(tls, db, (*TSubProgram)(unsafe.Pointer(pSub)).FaOp, (*TSubProgram)(unsafe.Pointer(pSub)).FnOp) + _sqlite3DbFree(tls, db, pSub) + goto _1 + _1: + ; + pSub = pNext + } + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != VDBE_INIT_STATE { + _releaseMemArray(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar, int32((*TVdbe)(unsafe.Pointer(p)).FnVar)) + if (*TVdbe)(unsafe.Pointer(p)).FpVList != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TVdbe)(unsafe.Pointer(p)).FpVList) + } + if (*TVdbe)(unsafe.Pointer(p)).FpFree != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TVdbe)(unsafe.Pointer(p)).FpFree) + } + } + _vdbeFreeOpArray(tls, db, (*TVdbe)(unsafe.Pointer(p)).FaOp, (*TVdbe)(unsafe.Pointer(p)).FnOp) + if (*TVdbe)(unsafe.Pointer(p)).FzSql != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzSql) + } +} + +// C documentation +// +// /* +// ** Delete an entire VDBE. +// */ +func _sqlite3VdbeDelete(tls *libc.TLS, p uintptr) { + var db uintptr + _ = db + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + _sqlite3VdbeClearObject(tls, db, p) + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FppVPrev)) = (*TVdbe)(unsafe.Pointer(p)).FpVNext + if (*TVdbe)(unsafe.Pointer(p)).FpVNext != 0 { + (*TVdbe)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpVNext)).FppVPrev = (*TVdbe)(unsafe.Pointer(p)).FppVPrev + } + } + _sqlite3DbNNFreeNN(tls, db, p) +} + +// C documentation +// +// /* +// ** The cursor "p" has a pending seek operation that has not yet been +// ** carried out. Seek the cursor now. If an error occurs, return +// ** the appropriate error code. +// */ +func _sqlite3VdbeFinishMoveto(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* res at bp+0 */ int32 + _ = rc + rc = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(p + 48)), (*TVdbeCursor)(unsafe.Pointer(p)).FmovetoTarget, 0, bp) + if rc != 0 { + return rc + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return _sqlite3CorruptError(tls, int32(88164)) + } + (*TVdbeCursor)(unsafe.Pointer(p)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(p)).FcacheStatus = uint32(CACHE_STALE) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Something has moved cursor "p" out of place. Maybe the row it was +// ** pointed to was deleted out from under it. Or maybe the btree was +// ** rebalanced. Whatever the cause, try to restore "p" to the place it +// ** is supposed to be pointing. If the row was deleted out from under the +// ** cursor, set the cursor to point to a NULL row. +// */ +func _sqlite3VdbeHandleMovedCursor(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* isDifferentRow at bp+0 */ int32 + _ = rc + rc = _sqlite3BtreeCursorRestore(tls, *(*uintptr)(unsafe.Pointer(p + 48)), bp) + (*TVdbeCursor)(unsafe.Pointer(p)).FcacheStatus = uint32(CACHE_STALE) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + (*TVdbeCursor)(unsafe.Pointer(p)).FnullRow = uint8(1) + } + return rc +} + +// C documentation +// +// /* +// ** Check to ensure that the cursor is valid. Restore the cursor +// ** if need be. Return any I/O error from the restore operation. +// */ +func _sqlite3VdbeCursorRestore(tls *libc.TLS, p uintptr) (r int32) { + if _sqlite3BtreeCursorHasMoved(tls, *(*uintptr)(unsafe.Pointer(p + 48))) != 0 { + return _sqlite3VdbeHandleMovedCursor(tls, p) + } + return SQLITE_OK +} + +/* +** The following functions: +** +** sqlite3VdbeSerialType() +** sqlite3VdbeSerialTypeLen() +** sqlite3VdbeSerialLen() +** sqlite3VdbeSerialPut() <--- in-lined into OP_MakeRecord as of 2022-04-02 +** sqlite3VdbeSerialGet() +** +** encapsulate the code that serializes values for storage in SQLite +** data and index records. Each serialized value consists of a +** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned +** integer, stored as a varint. +** +** In an SQLite index record, the serial type is stored directly before +** the blob of data that it corresponds to. In a table record, all serial +** types are stored at the start of the record, and the blobs of data at +** the end. Hence these functions allow the caller to handle the +** serial-type and data blob separately. +** +** The following table describes the various storage classes for data: +** +** serial type bytes of data type +** -------------- --------------- --------------- +** 0 0 NULL +** 1 1 signed integer +** 2 2 signed integer +** 3 3 signed integer +** 4 4 signed integer +** 5 6 signed integer +** 6 8 signed integer +** 7 8 IEEE float +** 8 0 Integer constant 0 +** 9 0 Integer constant 1 +** 10,11 reserved for expansion +** N>=12 and even (N-12)/2 BLOB +** N>=13 and odd (N-13)/2 text +** +** The 8 and 9 types were added in 3.3.0, file format 4. Prior versions +** of SQLite will not understand those serial types. + */ + +// C documentation +// +// /* +// ** The sizes for serial types less than 128 +// */ +var _sqlite3SmallTypeSizes = [128]Tu8{ + 1: uint8(1), + 2: uint8(2), + 3: uint8(3), + 4: uint8(4), + 5: uint8(6), + 6: uint8(8), + 7: uint8(8), + 14: uint8(1), + 15: uint8(1), + 16: uint8(2), + 17: uint8(2), + 18: uint8(3), + 19: uint8(3), + 20: uint8(4), + 21: uint8(4), + 22: uint8(5), + 23: uint8(5), + 24: uint8(6), + 25: uint8(6), + 26: uint8(7), + 27: uint8(7), + 28: uint8(8), + 29: uint8(8), + 30: uint8(9), + 31: uint8(9), + 32: uint8(10), + 33: uint8(10), + 34: uint8(11), + 35: uint8(11), + 36: uint8(12), + 37: uint8(12), + 38: uint8(13), + 39: uint8(13), + 40: uint8(14), + 41: uint8(14), + 42: uint8(15), + 43: uint8(15), + 44: uint8(16), + 45: uint8(16), + 46: uint8(17), + 47: uint8(17), + 48: uint8(18), + 49: uint8(18), + 50: uint8(19), + 51: uint8(19), + 52: uint8(20), + 53: uint8(20), + 54: uint8(21), + 55: uint8(21), + 56: uint8(22), + 57: uint8(22), + 58: uint8(23), + 59: uint8(23), + 60: uint8(24), + 61: uint8(24), + 62: uint8(25), + 63: uint8(25), + 64: uint8(26), + 65: uint8(26), + 66: uint8(27), + 67: uint8(27), + 68: uint8(28), + 69: uint8(28), + 70: uint8(29), + 71: uint8(29), + 72: uint8(30), + 73: uint8(30), + 74: uint8(31), + 75: uint8(31), + 76: uint8(32), + 77: uint8(32), + 78: uint8(33), + 79: uint8(33), + 80: uint8(34), + 81: uint8(34), + 82: uint8(35), + 83: uint8(35), + 84: uint8(36), + 85: uint8(36), + 86: uint8(37), + 87: uint8(37), + 88: uint8(38), + 89: uint8(38), + 90: uint8(39), + 91: uint8(39), + 92: uint8(40), + 93: uint8(40), + 94: uint8(41), + 95: uint8(41), + 96: uint8(42), + 97: uint8(42), + 98: uint8(43), + 99: uint8(43), + 100: uint8(44), + 101: uint8(44), + 102: uint8(45), + 103: uint8(45), + 104: uint8(46), + 105: uint8(46), + 106: uint8(47), + 107: uint8(47), + 108: uint8(48), + 109: uint8(48), + 110: uint8(49), + 111: uint8(49), + 112: uint8(50), + 113: uint8(50), + 114: uint8(51), + 115: uint8(51), + 116: uint8(52), + 117: uint8(52), + 118: uint8(53), + 119: uint8(53), + 120: uint8(54), + 121: uint8(54), + 122: uint8(55), + 123: uint8(55), + 124: uint8(56), + 125: uint8(56), + 126: uint8(57), + 127: uint8(57), +} + +// C documentation +// +// /* +// ** Return the length of the data corresponding to the supplied serial-type. +// */ +func _sqlite3VdbeSerialTypeLen(tls *libc.TLS, serial_type Tu32) (r Tu32) { + if serial_type >= uint32(128) { + return (serial_type - uint32(12)) / uint32(2) + } else { + return uint32(_sqlite3SmallTypeSizes[serial_type]) + } + return r +} + +func _sqlite3VdbeOneByteSerialTypeLen(tls *libc.TLS, serial_type Tu8) (r Tu8) { + return _sqlite3SmallTypeSizes[serial_type] +} + +/* +** If we are on an architecture with mixed-endian floating +** points (ex: ARM7) then swap the lower 4 bytes with the +** upper 4 bytes. Return the result. +** +** For most architectures, this is a no-op. +** +** (later): It is reported to me that the mixed-endian problem +** on ARM7 is an issue with GCC, not with the ARM7 chip. It seems +** that early versions of GCC stored the two words of a 64-bit +** float in the wrong order. And that error has been propagated +** ever since. The blame is not necessarily with GCC, though. +** GCC might have just copying the problem from a prior compiler. +** I am also told that newer versions of GCC that follow a different +** ABI get the byte order right. +** +** Developers using SQLite on an ARM7 should compile and run their +** application using -DSQLITE_DEBUG=1 at least once. With DEBUG +** enabled, some asserts below will ensure that the byte order of +** floating point values is correct. +** +** (2007-08-30) Frank van Vugt has studied this problem closely +** and has send his findings to the SQLite developers. Frank +** writes that some Linux kernels offer floating point hardware +** emulation that uses only 32-bit mantissas instead of a full +** 48-bits as required by the IEEE standard. (This is the +** CONFIG_FPE_FASTFPE option.) On such systems, floating point +** byte swapping becomes very complicated. To avoid problems, +** the necessary byte swapping is carried out using a 64-bit integer +** rather than a 64-bit float. Frank assures us that the code here +** works for him. We, the developers, have no way to independently +** verify this, but Frank seems to know what he is talking about +** so we trust him. + */ + +/* Input "x" is a sequence of unsigned characters that represent a +** big-endian integer. Return the equivalent native integer + */ + +// C documentation +// +// /* +// ** Deserialize the data blob pointed to by buf as serial type serial_type +// ** and store the result in pMem. +// ** +// ** This function is implemented as two separate routines for performance. +// ** The few cases that require local variables are broken out into a separate +// ** routine so that in most cases the overhead of moving the stack pointer +// ** is avoided. +// */ +func _serialGet(tls *libc.TLS, buf uintptr, serial_type Tu32, pMem uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var y Tu32 + var v1 int32 + var _ /* x at bp+0 */ Tu64 + _, _ = y, v1 + *(*Tu64)(unsafe.Pointer(bp)) = uint64(uint32(*(*uint8)(unsafe.Pointer(buf)))<flags = 0; // sqlite3VdbeSerialGet() will set this for us */ + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = 0 + (*TMem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + _sqlite3VdbeSerialGet(tls, aKey+uintptr(d), *(*Tu32)(unsafe.Pointer(bp + 4)), pMem) + d += _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 4))) + pMem += 56 + u++ + v3 = u + if int32(v3) >= int32((*TUnpackedRecord)(unsafe.Pointer(p)).FnField) { + break + } + } + if d > uint32(nKey) && u != 0 { + /* In a corrupt record entry, the last pMem might have been set up using + ** uninitialized memory. Overwrite its value with NULL, to prevent + ** warnings from MSAN. */ + _sqlite3VdbeMemSetNull(tls, pMem-uintptr(1)*56) + } + (*TUnpackedRecord)(unsafe.Pointer(p)).FnField = u +} + +// C documentation +// +// /* +// ** Both *pMem1 and *pMem2 contain string values. Compare the two values +// ** using the collation sequence pColl. As usual, return a negative , zero +// ** or positive value if *pMem1 is less than, equal to or greater than +// ** *pMem2, respectively. Similar in spirit to "rc = (*pMem1) - (*pMem2);". +// */ +func _vdbeCompareMemString(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintptr, prcErr uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var rc int32 + var v1, v2 uintptr + var _ /* c1 at bp+0 */ TMem + var _ /* c2 at bp+56 */ TMem + _, _, _ = rc, v1, v2 + if int32((*TMem)(unsafe.Pointer(pMem1)).Fenc) == int32((*TCollSeq)(unsafe.Pointer(pColl)).Fenc) { + /* The strings are already in the correct encoding. Call the + ** comparison function directly */ + return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TCollSeq)(unsafe.Pointer(pColl)).FxCmp})))(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FpUser, (*TMem)(unsafe.Pointer(pMem1)).Fn, (*TMem)(unsafe.Pointer(pMem1)).Fz, (*TMem)(unsafe.Pointer(pMem2)).Fn, (*TMem)(unsafe.Pointer(pMem2)).Fz) + } else { + _sqlite3VdbeMemInit(tls, bp, (*TMem)(unsafe.Pointer(pMem1)).Fdb, uint16(MEM_Null)) + _sqlite3VdbeMemInit(tls, bp+56, (*TMem)(unsafe.Pointer(pMem1)).Fdb, uint16(MEM_Null)) + _sqlite3VdbeMemShallowCopy(tls, bp, pMem1, int32(MEM_Ephem)) + _sqlite3VdbeMemShallowCopy(tls, bp+56, pMem2, int32(MEM_Ephem)) + v1 = _sqlite3ValueText(tls, bp, (*TCollSeq)(unsafe.Pointer(pColl)).Fenc) + v2 = _sqlite3ValueText(tls, bp+56, (*TCollSeq)(unsafe.Pointer(pColl)).Fenc) + if v1 == uintptr(0) || v2 == uintptr(0) { + if prcErr != 0 { + *(*Tu8)(unsafe.Pointer(prcErr)) = uint8(SQLITE_NOMEM) + } + rc = 0 + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TCollSeq)(unsafe.Pointer(pColl)).FxCmp})))(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FpUser, (*(*TMem)(unsafe.Pointer(bp))).Fn, v1, (*(*TMem)(unsafe.Pointer(bp + 56))).Fn, v2) + } + _sqlite3VdbeMemReleaseMalloc(tls, bp) + _sqlite3VdbeMemReleaseMalloc(tls, bp+56) + return rc + } + return r +} + +// C documentation +// +// /* +// ** The input pBlob is guaranteed to be a Blob that is not marked +// ** with MEM_Zero. Return true if it could be a zero-blob. +// */ +func _isAllZero(tls *libc.TLS, z uintptr, n int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < n) { + break + } + if *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0 { + return 0 + } + goto _1 + _1: + ; + i++ + } + return int32(1) +} + +// C documentation +// +// /* +// ** Compare two blobs. Return negative, zero, or positive if the first +// ** is less than, equal to, or greater than the second, respectively. +// ** If one blob is a prefix of the other, then the shorter is the lessor. +// */ +func _sqlite3BlobCompare(tls *libc.TLS, pB1 uintptr, pB2 uintptr) (r int32) { + var c, n1, n2, v1 int32 + _, _, _, _ = c, n1, n2, v1 + n1 = (*TMem)(unsafe.Pointer(pB1)).Fn + n2 = (*TMem)(unsafe.Pointer(pB2)).Fn + /* It is possible to have a Blob value that has some non-zero content + ** followed by zero content. But that only comes up for Blobs formed + ** by the OP_MakeRecord opcode, and such Blobs never get passed into + ** sqlite3MemCompare(). */ + if (int32((*TMem)(unsafe.Pointer(pB1)).Fflags)|int32((*TMem)(unsafe.Pointer(pB2)).Fflags))&int32(MEM_Zero) != 0 { + if int32((*TMem)(unsafe.Pointer(pB1)).Fflags)&int32((*TMem)(unsafe.Pointer(pB2)).Fflags)&int32(MEM_Zero) != 0 { + return *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB1)).Fu)) - *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB2)).Fu)) + } else { + if int32((*TMem)(unsafe.Pointer(pB1)).Fflags)&int32(MEM_Zero) != 0 { + if !(_isAllZero(tls, (*TMem)(unsafe.Pointer(pB2)).Fz, (*TMem)(unsafe.Pointer(pB2)).Fn) != 0) { + return -int32(1) + } + return *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB1)).Fu)) - n2 + } else { + if !(_isAllZero(tls, (*TMem)(unsafe.Pointer(pB1)).Fz, (*TMem)(unsafe.Pointer(pB1)).Fn) != 0) { + return +libc.Int32FromInt32(1) + } + return n1 - *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pB2)).Fu)) + } + } + } + if n1 > n2 { + v1 = n2 + } else { + v1 = n1 + } + c = libc.Xmemcmp(tls, (*TMem)(unsafe.Pointer(pB1)).Fz, (*TMem)(unsafe.Pointer(pB2)).Fz, uint64(v1)) + if c != 0 { + return c + } + return n1 - n2 +} + +/* The following two functions are used only within testcase() to prove +** test coverage. These functions do no exist for production builds. +** We must use separate SQLITE_NOINLINE functions here, since otherwise +** optimizer code movement causes gcov to become very confused. + */ + +// C documentation +// +// /* +// ** Do a comparison between a 64-bit signed integer and a 64-bit floating-point +// ** number. Return negative, zero, or positive if the first (i64) is less than, +// ** equal to, or greater than the second (double). +// */ +func _sqlite3IntFloatCompare(tls *libc.TLS, i Ti64, r float64) (r1 int32) { + var s, x float64 + var y Ti64 + var v1, v2 int32 + _, _, _, _, _ = s, x, y, v1, v2 + if _sqlite3IsNaN(tls, r) != 0 { + /* SQLite considers NaN to be a NULL. And all integer values are greater + ** than NULL */ + return int32(1) + } + if _sqlite3Config.FbUseLongDouble != 0 { + x = float64(i) + if x < r { + v1 = -int32(1) + } else { + v1 = libc.BoolInt32(x > r) + } + return v1 + } else { + if r < -libc.Float64FromFloat64(9.223372036854776e+18) { + return +libc.Int32FromInt32(1) + } + if r >= float64(9.223372036854776e+18) { + return -int32(1) + } + y = int64(r) + if i < y { + return -int32(1) + } + if i > y { + return +libc.Int32FromInt32(1) + } + s = float64(i) + if s < r { + v2 = -int32(1) + } else { + v2 = libc.BoolInt32(s > r) + } + return v2 + } + return r1 +} + +// C documentation +// +// /* +// ** Compare the values contained by the two memory cells, returning +// ** negative, zero or positive if pMem1 is less than, equal to, or greater +// ** than pMem2. Sorting order is NULL's first, followed by numbers (integers +// ** and reals) sorted numerically, followed by text ordered by the collating +// ** sequence pColl and finally blob's ordered by memcmp(). +// ** +// ** Two NULL values are considered equal by this function. +// */ +func _sqlite3MemCompare(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintptr) (r int32) { + var combined_flags, f1, f2 int32 + _, _, _ = combined_flags, f1, f2 + f1 = int32((*TMem)(unsafe.Pointer(pMem1)).Fflags) + f2 = int32((*TMem)(unsafe.Pointer(pMem2)).Fflags) + combined_flags = f1 | f2 + /* If one value is NULL, it is less than the other. If both values + ** are NULL, return 0. + */ + if combined_flags&int32(MEM_Null) != 0 { + return f2&int32(MEM_Null) - f1&int32(MEM_Null) + } + /* At least one of the two values is a number + */ + if combined_flags&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + if f1&f2&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + if *(*Ti64)(unsafe.Pointer(pMem1)) < *(*Ti64)(unsafe.Pointer(pMem2)) { + return -int32(1) + } + if *(*Ti64)(unsafe.Pointer(pMem1)) > *(*Ti64)(unsafe.Pointer(pMem2)) { + return +libc.Int32FromInt32(1) + } + return 0 + } + if f1&f2&int32(MEM_Real) != 0 { + if *(*float64)(unsafe.Pointer(pMem1)) < *(*float64)(unsafe.Pointer(pMem2)) { + return -int32(1) + } + if *(*float64)(unsafe.Pointer(pMem1)) > *(*float64)(unsafe.Pointer(pMem2)) { + return +libc.Int32FromInt32(1) + } + return 0 + } + if f1&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + if f2&int32(MEM_Real) != 0 { + return _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pMem1)), *(*float64)(unsafe.Pointer(pMem2))) + } else { + if f2&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + if *(*Ti64)(unsafe.Pointer(pMem1)) < *(*Ti64)(unsafe.Pointer(pMem2)) { + return -int32(1) + } + if *(*Ti64)(unsafe.Pointer(pMem1)) > *(*Ti64)(unsafe.Pointer(pMem2)) { + return +libc.Int32FromInt32(1) + } + return 0 + } else { + return -int32(1) + } + } + } + if f1&int32(MEM_Real) != 0 { + if f2&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + return -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pMem2)), *(*float64)(unsafe.Pointer(pMem1))) + } else { + return -int32(1) + } + } + return +libc.Int32FromInt32(1) + } + /* If one value is a string and the other is a blob, the string is less. + ** If both are strings, compare using the collating functions. + */ + if combined_flags&int32(MEM_Str) != 0 { + if f1&int32(MEM_Str) == 0 { + return int32(1) + } + if f2&int32(MEM_Str) == 0 { + return -int32(1) + } + /* The collation sequence must be defined at this point, even if + ** the user deletes the collation sequence after the vdbe program is + ** compiled (this was not always the case). + */ + if pColl != 0 { + return _vdbeCompareMemString(tls, pMem1, pMem2, pColl, uintptr(0)) + } + /* If a NULL pointer was passed as the collate function, fall through + ** to the blob case and use memcmp(). */ + } + /* Both values must be blobs. Compare using memcmp(). */ + return _sqlite3BlobCompare(tls, pMem1, pMem2) +} + +// C documentation +// +// /* +// ** The first argument passed to this function is a serial-type that +// ** corresponds to an integer - all values between 1 and 9 inclusive +// ** except 7. The second points to a buffer containing an integer value +// ** serialized according to serial_type. This function deserializes +// ** and returns the value. +// */ +func _vdbeRecordDecodeInt(tls *libc.TLS, serial_type Tu32, aKey uintptr) (r Ti64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* x at bp+8 */ Tu64 + var _ /* y at bp+0 */ Tu32 + switch serial_type { + case uint32(0): + fallthrough + case uint32(1): + return int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) + case uint32(2): + return int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) + case uint32(3): + return int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))<default_rc is +// ** returned. +// ** +// ** If database corruption is discovered, set pPKey2->errCode to +// ** SQLITE_CORRUPT and return 0. If an OOM error is encountered, +// ** pPKey2->errCode is set to SQLITE_NOMEM and, if it is not NULL, the +// ** malloc-failed flag set on database handle (pPKey2->pKeyInfo->db). +// */ +func _sqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr, bSkip int32) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var aKey1, pKeyInfo, pRhs, v4 uintptr + var d1, idx1, v1 Tu32 + var i, nCmp, nCmp1, nStr, rc, sortFlags, v2, v3, v6, v7 int32 + var lhs, rhs Ti64 + var v5 bool + var _ /* mem1 at bp+8 */ TMem + var _ /* s1 at bp+64 */ Tu32 + var _ /* serial_type at bp+68 */ Tu32 + var _ /* szHdr1 at bp+0 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aKey1, d1, i, idx1, lhs, nCmp, nCmp1, nStr, pKeyInfo, pRhs, rc, rhs, sortFlags, v1, v2, v3, v4, v5, v6, v7 /* Offset of first type in header */ + rc = 0 /* Return value */ + pRhs = (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem + aKey1 = pKey1 + /* If bSkip is true, then the caller has already determined that the first + ** two elements in the keys are equal. Fix the various stack variables so + ** that this routine begins comparing at the second field. */ + if bSkip != 0 { + *(*Tu32)(unsafe.Pointer(bp + 64)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + 1))) + if *(*Tu32)(unsafe.Pointer(bp + 64)) < uint32(0x80) { + idx1 = uint32(2) + } else { + idx1 = uint32(int32(1) + int32(_sqlite3GetVarint32(tls, aKey1+1, bp+64))) + } + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*uint8)(unsafe.Pointer(aKey1))) + d1 = *(*Tu32)(unsafe.Pointer(bp)) + _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 64))) + i = int32(1) + pRhs += 56 + } else { + v1 = uint32(*(*uint8)(unsafe.Pointer(aKey1))) + *(*Tu32)(unsafe.Pointer(bp)) = v1 + if v1 < uint32(0x80) { + idx1 = uint32(1) + } else { + idx1 = uint32(_sqlite3GetVarint32(tls, aKey1, bp)) + } + d1 = *(*Tu32)(unsafe.Pointer(bp)) + i = 0 + } + if d1 > uint32(nKey1) { + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89131))) + return 0 /* Corruption */ + } + /* Only needed by assert() statements */ + for int32(1) != 0 { + /* RHS is an integer */ + if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*Tu32)(unsafe.Pointer(bp + 68)) >= uint32(10) { + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) { + v2 = -int32(1) + } else { + v2 = +libc.Int32FromInt32(1) + } + rc = v2 + } else { + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { + rc = -int32(1) + } else { + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { + _serialGet7(tls, aKey1+uintptr(d1), bp+8) + rc = -_sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(pRhs)), *(*float64)(unsafe.Pointer(bp + 8))) + } else { + lhs = _vdbeRecordDecodeInt(tls, *(*Tu32)(unsafe.Pointer(bp + 68)), aKey1+uintptr(d1)) + rhs = *(*Ti64)(unsafe.Pointer(pRhs)) + if lhs < rhs { + rc = -int32(1) + } else { + if lhs > rhs { + rc = +libc.Int32FromInt32(1) + } + } + } + } + } + } else { + if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Real) != 0 { + *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*Tu32)(unsafe.Pointer(bp + 68)) >= uint32(10) { + /* Serial types 12 or greater are strings and blobs (greater than + ** numbers). Types 10 and 11 are currently "reserved for future + ** use", so it doesn't really matter what the results of comparing + ** them to numeric values are. */ + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) { + v3 = -int32(1) + } else { + v3 = +libc.Int32FromInt32(1) + } + rc = v3 + } else { + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) { + rc = -int32(1) + } else { + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) { + if _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + rc = -int32(1) /* mem1 is a NaN */ + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) < *(*float64)(unsafe.Pointer(pRhs)) { + rc = -int32(1) + } else { + if *(*float64)(unsafe.Pointer(bp + 8)) > *(*float64)(unsafe.Pointer(pRhs)) { + rc = +libc.Int32FromInt32(1) + } else { + } + } + } + } else { + _sqlite3VdbeSerialGet(tls, aKey1+uintptr(d1), *(*Tu32)(unsafe.Pointer(bp + 68)), bp+8) + rc = _sqlite3IntFloatCompare(tls, *(*Ti64)(unsafe.Pointer(bp + 8)), *(*float64)(unsafe.Pointer(pRhs))) + } + } + } + } else { + if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Str) != 0 { + *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*Tu32)(unsafe.Pointer(bp + 68)) >= uint32(0x80) { + _sqlite3GetVarint32(tls, aKey1+uintptr(idx1), bp+68) + } + if *(*Tu32)(unsafe.Pointer(bp + 68)) < uint32(12) { + rc = -int32(1) + } else { + if !(*(*Tu32)(unsafe.Pointer(bp + 68))&libc.Uint32FromInt32(0x01) != 0) { + rc = +libc.Int32FromInt32(1) + } else { + (*(*TMem)(unsafe.Pointer(bp + 8))).Fn = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) + if v5 = d1+uint32((*(*TMem)(unsafe.Pointer(bp + 8))).Fn) > uint32(nKey1); !v5 { + v4 = (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FpKeyInfo + pKeyInfo = v4 + } + if v5 || int32((*TKeyInfo)(unsafe.Pointer(v4)).FnAllField) <= i { + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89212))) + return 0 /* Corruption */ + } else { + if *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) != 0 { + (*(*TMem)(unsafe.Pointer(bp + 8))).Fenc = (*TKeyInfo)(unsafe.Pointer(pKeyInfo)).Fenc + (*(*TMem)(unsafe.Pointer(bp + 8))).Fdb = (*TKeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb + (*(*TMem)(unsafe.Pointer(bp + 8))).Fflags = uint16(MEM_Str) + (*(*TMem)(unsafe.Pointer(bp + 8))).Fz = aKey1 + uintptr(d1) + rc = _vdbeCompareMemString(tls, bp+8, pRhs, *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)), pPKey2+31) + } else { + if (*(*TMem)(unsafe.Pointer(bp + 8))).Fn < (*TMem)(unsafe.Pointer(pRhs)).Fn { + v6 = (*(*TMem)(unsafe.Pointer(bp + 8))).Fn + } else { + v6 = (*TMem)(unsafe.Pointer(pRhs)).Fn + } + nCmp = v6 + rc = libc.Xmemcmp(tls, aKey1+uintptr(d1), (*TMem)(unsafe.Pointer(pRhs)).Fz, uint64(nCmp)) + if rc == 0 { + rc = (*(*TMem)(unsafe.Pointer(bp + 8))).Fn - (*TMem)(unsafe.Pointer(pRhs)).Fn + } + } + } + } + } + } else { + if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Blob) != 0 { + *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*Tu32)(unsafe.Pointer(bp + 68)) >= uint32(0x80) { + _sqlite3GetVarint32(tls, aKey1+uintptr(idx1), bp+68) + } + if *(*Tu32)(unsafe.Pointer(bp + 68)) < uint32(12) || *(*Tu32)(unsafe.Pointer(bp + 68))&uint32(0x01) != 0 { + rc = -int32(1) + } else { + nStr = int32((*(*Tu32)(unsafe.Pointer(bp + 68)) - uint32(12)) / uint32(2)) + if d1+uint32(nStr) > uint32(nKey1) { + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89242))) + return 0 /* Corruption */ + } else { + if int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Zero) != 0 { + if !(_isAllZero(tls, aKey1+uintptr(d1), nStr) != 0) { + rc = int32(1) + } else { + rc = nStr - *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pRhs)).Fu)) + } + } else { + if nStr < (*TMem)(unsafe.Pointer(pRhs)).Fn { + v7 = nStr + } else { + v7 = (*TMem)(unsafe.Pointer(pRhs)).Fn + } + nCmp1 = v7 + rc = libc.Xmemcmp(tls, aKey1+uintptr(d1), (*TMem)(unsafe.Pointer(pRhs)).Fz, uint64(nCmp1)) + if rc == 0 { + rc = nStr - (*TMem)(unsafe.Pointer(pRhs)).Fn + } + } + } + } + } else { + *(*Tu32)(unsafe.Pointer(bp + 68)) = uint32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(10) || *(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(7) && _serialGet7(tls, aKey1+uintptr(d1), bp+8) != 0 { + } else { + rc = int32(1) + } + } + } + } + } + if rc != 0 { + sortFlags = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FpKeyInfo)).FaSortFlags + uintptr(i)))) + if sortFlags != 0 { + if sortFlags&int32(KEYINFO_ORDER_BIGNULL) == 0 || sortFlags&int32(KEYINFO_ORDER_DESC) != libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp + 68)) == uint32(0) || int32((*TMem)(unsafe.Pointer(pRhs)).Fflags)&int32(MEM_Null) != 0) { + rc = -rc + } + } + /* See comment below */ + return rc + } + i++ + if i == int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) { + break + } + pRhs += 56 + d1 += _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 68))) + if d1 > uint32(nKey1) { + break + } + idx1 += uint32(_sqlite3VarintLen(tls, uint64(*(*Tu32)(unsafe.Pointer(bp + 68))))) + if idx1 >= *(*Tu32)(unsafe.Pointer(bp)) { + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89293))) + return 0 /* Corrupt index */ + } + } + /* No memory allocation is ever used on mem1. Prove this using + ** the following assert(). If the assert() fails, it indicates a + ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1). */ + /* rc==0 here means that one or both of the keys ran out of fields and + ** all the fields up to that point were equal. Return the default_rc + ** value. */ + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = uint8(1) + return int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) +} + +func _sqlite3VdbeRecordCompare(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) (r int32) { + return _sqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, 0) +} + +// C documentation +// +// /* +// ** This function is an optimized version of sqlite3VdbeRecordCompare() +// ** that (a) the first field of pPKey2 is an integer, and (b) the +// ** size-of-header varint at the start of (pKey1/nKey1) fits in a single +// ** byte (i.e. is less than 128). +// ** +// ** To avoid concerns about buffer overreads, this routine is only used +// ** on schemas where the maximum valid header size is 63 bytes or less. +// */ +func _vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aKey uintptr + var lhs, v Ti64 + var res, serial_type int32 + var _ /* x at bp+8 */ Tu64 + var _ /* y at bp+0 */ Tu32 + _, _, _, _, _ = aKey, lhs, res, serial_type, v + aKey = pKey1 + uintptr(int32(*(*Tu8)(unsafe.Pointer(pKey1)))&int32(0x3F)) + serial_type = int32(*(*Tu8)(unsafe.Pointer(pKey1 + 1))) + switch serial_type { + case int32(1): /* 1-byte signed integer */ + lhs = int64(int8(*(*Tu8)(unsafe.Pointer(aKey)))) + case int32(2): /* 2-byte signed integer */ + lhs = int64(libc.Int32FromInt32(256)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))) + case int32(3): /* 3-byte signed integer */ + lhs = int64(libc.Int32FromInt32(65536)*int32(int8(*(*Tu8)(unsafe.Pointer(aKey)))) | int32(*(*Tu8)(unsafe.Pointer(aKey + 1)))< lhs { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } else { + if v < lhs { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else { + if int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) > int32(1) { + /* The first fields of the two keys are equal. Compare the trailing + ** fields. */ + res = _sqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, int32(1)) + } else { + /* The first fields of the two keys are equal and there are no trailing + ** fields. Return pPKey2->default_rc in this case. */ + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = uint8(1) + } + } + } + return res +} + +// C documentation +// +// /* +// ** This function is an optimized version of sqlite3VdbeRecordCompare() +// ** that (a) the first field of pPKey2 is a string, that (b) the first field +// ** uses the collation sequence BINARY and (c) that the size-of-header varint +// ** at the start of (pKey1/nKey1) fits in a single byte. +// */ +func _vdbeRecordCompareString(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aKey1 uintptr + var nCmp, nStr, res, szHdr, v1 int32 + var _ /* serial_type at bp+0 */ int32 + _, _, _, _, _, _ = aKey1, nCmp, nStr, res, szHdr, v1 + aKey1 = pKey1 + *(*int32)(unsafe.Pointer(bp)) = int32(int8(*(*Tu8)(unsafe.Pointer(aKey1 + 1)))) +vrcs_restart: + ; + if *(*int32)(unsafe.Pointer(bp)) < int32(12) { + if *(*int32)(unsafe.Pointer(bp)) < 0 { + _sqlite3GetVarint32(tls, aKey1+1, bp) + if *(*int32)(unsafe.Pointer(bp)) >= int32(12) { + goto vrcs_restart + } + } + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) /* (pKey1/nKey1) is a number or a null */ + } else { + if !(*(*int32)(unsafe.Pointer(bp))&libc.Int32FromInt32(0x01) != 0) { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) /* (pKey1/nKey1) is a blob */ + } else { + szHdr = int32(*(*Tu8)(unsafe.Pointer(aKey1))) + nStr = (*(*int32)(unsafe.Pointer(bp)) - int32(12)) / int32(2) + if szHdr+nStr > nKey1 { + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = uint8(_sqlite3CorruptError(tls, int32(89456))) + return 0 /* Corruption */ + } + if (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn < nStr { + v1 = (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn + } else { + v1 = nStr + } + nCmp = v1 + res = libc.Xmemcmp(tls, aKey1+uintptr(szHdr), *(*uintptr)(unsafe.Pointer(pPKey2 + 16)), uint64(nCmp)) + if res > 0 { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else { + if res < 0 { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } else { + res = nStr - (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fn + if res == 0 { + if int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) > int32(1) { + res = _sqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, int32(1)) + } else { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) + (*TUnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = uint8(1) + } + } else { + if res > 0 { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else { + res = int32((*TUnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } + } + } + } + } + } + return res +} + +// C documentation +// +// /* +// ** Return a pointer to an sqlite3VdbeRecordCompare() compatible function +// ** suitable for comparing serialized records to the unpacked record passed +// ** as the only argument. +// */ +func _sqlite3VdbeFindCompare(tls *libc.TLS, p uintptr) (r TRecordCompare) { + var flags int32 + _ = flags + /* varintRecordCompareInt() and varintRecordCompareString() both assume + ** that the size-of-header varint that occurs at the start of each record + ** fits in a single byte (i.e. is 127 or less). varintRecordCompareInt() + ** also assumes that it is safe to overread a buffer by at least the + ** maximum possible legal header size plus 8 bytes. Because there is + ** guaranteed to be at least 74 (but not 136) bytes of padding following each + ** buffer passed to varintRecordCompareInt() this makes it convenient to + ** limit the size of the header to 64 bytes in cases where the first field + ** is an integer. + ** + ** The easiest way to enforce this limit is to consider only records with + ** 13 fields or less. If the first field is an integer, the maximum legal + ** header size is (12*5 + 1 + 1) bytes. */ + if int32((*TKeyInfo)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FnAllField) <= int32(13) { + flags = int32((*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem))).Fflags) + if *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FaSortFlags)) != 0 { + if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FaSortFlags)))&int32(KEYINFO_ORDER_BIGNULL) != 0 { + return __ccgo_fp(_sqlite3VdbeRecordCompare) + } + (*TUnpackedRecord)(unsafe.Pointer(p)).Fr1 = int8(1) + (*TUnpackedRecord)(unsafe.Pointer(p)).Fr2 = int8(-int32(1)) + } else { + (*TUnpackedRecord)(unsafe.Pointer(p)).Fr1 = int8(-int32(1)) + (*TUnpackedRecord)(unsafe.Pointer(p)).Fr2 = int8(1) + } + if flags&int32(MEM_Int) != 0 { + *(*Ti64)(unsafe.Pointer(p + 16)) = *(*Ti64)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem)) + return __ccgo_fp(_vdbeRecordCompareInt) + } + if flags&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Null)|libc.Int32FromInt32(MEM_Blob)) == 0 && *(*uintptr)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo + 32)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(p + 16)) = (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem))).Fz + (*TUnpackedRecord)(unsafe.Pointer(p)).Fn = (*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(p)).FaMem))).Fn + return __ccgo_fp(_vdbeRecordCompareString) + } + } + return __ccgo_fp(_sqlite3VdbeRecordCompare) +} + +// C documentation +// +// /* +// ** pCur points at an index entry created using the OP_MakeRecord opcode. +// ** Read the rowid (the last field in the record) and store it in *rowid. +// ** Return SQLITE_OK if everything works, or an error code otherwise. +// ** +// ** pCur might be pointing to text obtained from a corrupt database file. +// ** So the content cannot be trusted. Do appropriate checks on the content. +// */ +func _sqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var lenRowid Tu32 + var nCellKey Ti64 + var rc int32 + var _ /* m at bp+8 */ TMem + var _ /* szHdr at bp+0 */ Tu32 + var _ /* typeRowid at bp+4 */ Tu32 + var _ /* v at bp+64 */ TMem + _, _, _ = lenRowid, nCellKey, rc + nCellKey = 0 + /* Get the size of the index entry. Only indices entries of less + ** than 2GiB are support - anything large must be database corruption. + ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so + ** this code can safely assume that nCellKey is 32-bits + */ + nCellKey = int64(_sqlite3BtreePayloadSize(tls, pCur)) + /* Read in the complete content of the index entry */ + _sqlite3VdbeMemInit(tls, bp+8, db, uint16(0)) + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp+8) + if rc != 0 { + return rc + } + /* The index entry must begin with a header size */ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer((*(*TMem)(unsafe.Pointer(bp + 8))).Fz))) + if *(*Tu32)(unsafe.Pointer(bp)) >= uint32(0x80) { + _sqlite3GetVarint32(tls, (*(*TMem)(unsafe.Pointer(bp + 8))).Fz, bp) + } + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(3) || *(*Tu32)(unsafe.Pointer(bp)) > uint32((*(*TMem)(unsafe.Pointer(bp + 8))).Fn) { + goto idx_rowid_corruption + } + /* The last field of the index should be an integer - the ROWID. + ** Verify that the last entry really is an integer. */ + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(*(*Tu8)(unsafe.Pointer((*(*TMem)(unsafe.Pointer(bp + 8))).Fz + uintptr(*(*Tu32)(unsafe.Pointer(bp))-uint32(1))))) + if *(*Tu32)(unsafe.Pointer(bp + 4)) >= uint32(0x80) { + _sqlite3GetVarint32(tls, (*(*TMem)(unsafe.Pointer(bp + 8))).Fz+uintptr(*(*Tu32)(unsafe.Pointer(bp))-uint32(1)), bp+4) + } + if *(*Tu32)(unsafe.Pointer(bp + 4)) < uint32(1) || *(*Tu32)(unsafe.Pointer(bp + 4)) > uint32(9) || *(*Tu32)(unsafe.Pointer(bp + 4)) == uint32(7) { + goto idx_rowid_corruption + } + lenRowid = uint32(_sqlite3SmallTypeSizes[*(*Tu32)(unsafe.Pointer(bp + 4))]) + if uint32((*(*TMem)(unsafe.Pointer(bp + 8))).Fn) < *(*Tu32)(unsafe.Pointer(bp))+lenRowid { + goto idx_rowid_corruption + } + /* Fetch the integer off the end of the index record */ + _sqlite3VdbeSerialGet(tls, (*(*TMem)(unsafe.Pointer(bp + 8))).Fz+uintptr(uint32((*(*TMem)(unsafe.Pointer(bp + 8))).Fn)-lenRowid), *(*Tu32)(unsafe.Pointer(bp + 4)), bp+64) + *(*Ti64)(unsafe.Pointer(rowid)) = *(*Ti64)(unsafe.Pointer(bp + 64)) + _sqlite3VdbeMemReleaseMalloc(tls, bp+8) + return SQLITE_OK + /* Jump here if database corruption is detected after m has been + ** allocated. Free the m object and return SQLITE_CORRUPT. */ +idx_rowid_corruption: + ; + _sqlite3VdbeMemReleaseMalloc(tls, bp+8) + return _sqlite3CorruptError(tls, int32(89614)) +} + +// C documentation +// +// /* +// ** Compare the key of the index entry that cursor pC is pointing to against +// ** the key string in pUnpacked. Write into *pRes a number +// ** that is negative, zero, or positive if pC is less than, equal to, +// ** or greater than pUnpacked. Return SQLITE_OK on success. +// ** +// ** pUnpacked is either created without a rowid or is truncated so that it +// ** omits the rowid at the end. The rowid at the end of the index entry +// ** is ignored as well. Hence, this routine only compares the prefixes +// ** of the keys prior to the final rowid, not the entire key. +// */ +func _sqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked uintptr, res uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var nCellKey Ti64 + var pCur uintptr + var rc int32 + var _ /* m at bp+0 */ TMem + _, _, _ = nCellKey, pCur, rc + nCellKey = 0 + pCur = *(*uintptr)(unsafe.Pointer(pC + 48)) + nCellKey = int64(_sqlite3BtreePayloadSize(tls, pCur)) + /* nCellKey will always be between 0 and 0xffffffff because of the way + ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ + if nCellKey <= 0 || nCellKey > int64(0x7fffffff) { + *(*int32)(unsafe.Pointer(res)) = 0 + return _sqlite3CorruptError(tls, int32(89647)) + } + _sqlite3VdbeMemInit(tls, bp, db, uint16(0)) + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, uint32(nCellKey), bp) + if rc != 0 { + return rc + } + *(*int32)(unsafe.Pointer(res)) = _sqlite3VdbeRecordCompareWithSkip(tls, (*(*TMem)(unsafe.Pointer(bp))).Fn, (*(*TMem)(unsafe.Pointer(bp))).Fz, pUnpacked, 0) + _sqlite3VdbeMemReleaseMalloc(tls, bp) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This routine sets the value to be returned by subsequent calls to +// ** sqlite3_changes() on the database handle 'db'. +// */ +func _sqlite3VdbeSetChanges(tls *libc.TLS, db uintptr, nChange Ti64) { + (*Tsqlite3)(unsafe.Pointer(db)).FnChange = nChange + *(*Ti64)(unsafe.Pointer(db + 128)) += nChange +} + +// C documentation +// +// /* +// ** Set a flag in the vdbe to update the change counter when it is finalised +// ** or reset. +// */ +func _sqlite3VdbeCountChanges(tls *libc.TLS, v uintptr) { + libc.SetBitFieldPtr16Uint32(v+200, libc.Uint32FromInt32(1), 4, 0x10) +} + +// C documentation +// +// /* +// ** Mark every prepared statement associated with a database connection +// ** as expired. +// ** +// ** An expired statement means that recompilation of the statement is +// ** recommend. Statements expire when things happen that make their +// ** programs obsolete. Removing user-defined functions or collating +// ** sequences, or changing an authorization function are the types of +// ** things that make prepared statements obsolete. +// ** +// ** If iCode is 1, then expiration is advisory. The statement should +// ** be reprepared before being restarted, but if it is already running +// ** it is allowed to run to completion. +// ** +// ** Internally, this function just sets the Vdbe.expired flag on all +// ** prepared statements. The flag is set to 1 for an immediate expiration +// ** and set to 2 for an advisory expiration. +// */ +func _sqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { + var p uintptr + _ = p + p = (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe + for { + if !(p != 0) { + break + } + libc.SetBitFieldPtr16Uint32(p+200, uint32(iCode+libc.Int32FromInt32(1)), 0, 0x3) + goto _1 + _1: + ; + p = (*TVdbe)(unsafe.Pointer(p)).FpVNext + } +} + +// C documentation +// +// /* +// ** Return the database associated with the Vdbe. +// */ +func _sqlite3VdbeDb(tls *libc.TLS, v uintptr) (r uintptr) { + return (*TVdbe)(unsafe.Pointer(v)).Fdb +} + +// C documentation +// +// /* +// ** Return the SQLITE_PREPARE flags for a Vdbe. +// */ +func _sqlite3VdbePrepareFlags(tls *libc.TLS, v uintptr) (r Tu8) { + return (*TVdbe)(unsafe.Pointer(v)).FprepFlags +} + +// C documentation +// +// /* +// ** Return a pointer to an sqlite3_value structure containing the value bound +// ** parameter iVar of VM v. Except, if the value is an SQL NULL, return +// ** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* +// ** constants) to the value before returning it. +// ** +// ** The returned value must be freed by the caller using sqlite3ValueFree(). +// */ +func _sqlite3VdbeGetBoundValue(tls *libc.TLS, v uintptr, iVar int32, aff Tu8) (r uintptr) { + var pMem, pRet uintptr + _, _ = pMem, pRet + if v != 0 { + pMem = (*TVdbe)(unsafe.Pointer(v)).FaVar + uintptr(iVar-int32(1))*56 + if 0 == int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Null) { + pRet = _sqlite3ValueNew(tls, (*TVdbe)(unsafe.Pointer(v)).Fdb) + if pRet != 0 { + _sqlite3VdbeMemCopy(tls, pRet, pMem) + _sqlite3ValueApplyAffinity(tls, pRet, aff, uint8(SQLITE_UTF8)) + } + return pRet + } + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Configure SQL variable iVar so that binding a new value to it signals +// ** to sqlite3_reoptimize() that re-preparing the statement may result +// ** in a better query plan. +// */ +func _sqlite3VdbeSetVarmask(tls *libc.TLS, v uintptr, iVar int32) { + if iVar >= int32(32) { + *(*Tu32)(unsafe.Pointer(v + 284)) |= uint32(0x80000000) + } else { + *(*Tu32)(unsafe.Pointer(v + 284)) |= libc.Uint32FromInt32(1) << (iVar - libc.Int32FromInt32(1)) + } +} + +// C documentation +// +// /* +// ** Cause a function to throw an error if it was call from OP_PureFunc +// ** rather than OP_Function. +// ** +// ** OP_PureFunc means that the function must be deterministic, and should +// ** throw an error if it is given inputs that would make it non-deterministic. +// ** This routine is invoked by date/time functions that use non-deterministic +// ** features such as 'now'. +// */ +func _sqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pOp, zContext, zMsg uintptr + _, _, _ = pOp, zContext, zMsg + if (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { + return int32(1) + } + pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24 + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_PureFunc) { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_IsCheck) != 0 { + zContext = __ccgo_ts + 5287 + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5)&int32(NC_GenCol) != 0 { + zContext = __ccgo_ts + 5306 + } else { + zContext = __ccgo_ts + 5325 + } + } + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+5334, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) + Xsqlite3_free(tls, zMsg) + return 0 + } + return int32(1) +} + +// C documentation +// +// /* +// ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored +// ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored +// ** in memory obtained from sqlite3DbMalloc). +// */ +func _sqlite3VtabImportErrmsg(tls *libc.TLS, p uintptr, pVtab uintptr) { + var db uintptr + _ = db + if (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg != 0 { + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = uintptr(0) + } +} + +// C documentation +// +// /* +// ** If the second argument is not NULL, release any allocations associated +// ** with the memory cells in the p->aMem[] array. Also free the UnpackedRecord +// ** structure itself, using sqlite3DbFree(). +// ** +// ** This function is used to free UnpackedRecord structures allocated by +// ** the vdbeUnpackRecord() function found in vdbeapi.c. +// */ +func _vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { + var i int32 + var pMem uintptr + _, _ = i, pMem + if p != 0 { + i = 0 + for { + if !(i < nField) { + break + } + pMem = (*TUnpackedRecord)(unsafe.Pointer(p)).FaMem + uintptr(i)*56 + if (*TMem)(unsafe.Pointer(pMem)).FzMalloc != 0 { + _sqlite3VdbeMemReleaseMalloc(tls, pMem) + } + goto _1 + _1: + ; + i++ + } + _sqlite3DbNNFreeNN(tls, db, p) + } +} + +// C documentation +// +// /* +// ** Invoke the pre-update hook. If this is an UPDATE or DELETE pre-update call, +// ** then cursor passed as the second argument should point to the row about +// ** to be update or deleted. If the application calls sqlite3_preupdate_old(), +// ** the required value will be read from the row the cursor points to. +// */ +func _sqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, zDb uintptr, pTab uintptr, iKey1 Ti64, iReg int32, iBlobWrite int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var db, zTbl uintptr + var i int32 + var iKey2, v1 Ti64 + var _ /* preupdate at bp+0 */ TPreUpdate + _, _, _, _, _ = db, i, iKey2, zTbl, v1 + db = (*TVdbe)(unsafe.Pointer(v)).Fdb + zTbl = (*TTable)(unsafe.Pointer(pTab)).FzName + libc.Xmemset(tls, bp, 0, uint64(136)) + if libc.BoolInt32((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0)) == 0 { + v1 = libc.Int64FromInt32(0) + iKey2 = v1 + iKey1 = v1 + (*(*TPreUpdate)(unsafe.Pointer(bp))).FpPk = _sqlite3PrimaryKeyIndex(tls, pTab) + } else { + if op == int32(SQLITE_UPDATE) { + iKey2 = *(*Ti64)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FaMem + uintptr(iReg)*56)) + } else { + iKey2 = iKey1 + } + } + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fv = v + (*(*TPreUpdate)(unsafe.Pointer(bp))).FpCsr = pCsr + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fop = op + (*(*TPreUpdate)(unsafe.Pointer(bp))).FiNewReg = iReg + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.Fdb = db + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.Fenc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.FnKeyField = uint16((*TTable)(unsafe.Pointer(pTab)).FnCol) + (*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.FaSortFlags = uintptr(unsafe.Pointer(&_fakeSortOrder)) + (*(*TPreUpdate)(unsafe.Pointer(bp))).FiKey1 = iKey1 + (*(*TPreUpdate)(unsafe.Pointer(bp))).FiKey2 = iKey2 + (*(*TPreUpdate)(unsafe.Pointer(bp))).FpTab = pTab + (*(*TPreUpdate)(unsafe.Pointer(bp))).FiBlobWrite = iBlobWrite + (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate = bp + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Tsqlite3_int64, Tsqlite3_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2) + (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate = uintptr(0) + _sqlite3DbFree(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaRecord) + _vdbeFreeUnpacked(tls, db, int32((*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.FnKeyField)+int32(1), (*(*TPreUpdate)(unsafe.Pointer(bp))).FpUnpacked) + _vdbeFreeUnpacked(tls, db, int32((*(*TPreUpdate)(unsafe.Pointer(bp))).Fkeyinfo.FnKeyField)+int32(1), (*(*TPreUpdate)(unsafe.Pointer(bp))).FpNewUnpacked) + if (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew != 0 { + i = 0 + for { + if !(i < int32((*TVdbeCursor)(unsafe.Pointer(pCsr)).FnField)) { + break + } + _sqlite3VdbeMemRelease(tls, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew+uintptr(i)*56) + goto _2 + _2: + ; + i++ + } + _sqlite3DbNNFreeNN(tls, db, (*(*TPreUpdate)(unsafe.Pointer(bp))).FaNew) + } +} + +var _fakeSortOrder Tu8 + +/************** End of vdbeaux.c *********************************************/ +/************** Begin file vdbeapi.c *****************************************/ +/* +** 2004 May 26 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code use to implement APIs that are part of the +** VDBE. + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ +/* #include "opcodes.h" */ + +// C documentation +// +// /* +// ** Return TRUE (non-zero) of the statement supplied as an argument needs +// ** to be recompiled. A statement needs to be recompiled whenever the +// ** execution environment changes in a way that would alter the program +// ** that sqlite3_prepare() generates. For example, if new functions or +// ** collating sequences are registered or if an authorizer function is +// ** added or changed. +// */ +func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) (r int32) { + var p uintptr + _ = p + p = pStmt + return libc.BoolInt32(p == uintptr(0) || int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0) +} + +// C documentation +// +// /* +// ** Check on a Vdbe to make sure it has not been finalized. Log +// ** an error and return true if it has been finalized (or is otherwise +// ** invalid). Return false if it is ok. +// */ +func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) { + if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5370, 0) + return int32(1) + } else { + return 0 + } + return r +} + +func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) { + if p == uintptr(0) { + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5415, 0) + return int32(1) + } else { + return _vdbeSafety(tls, p) + } + return r +} + +// C documentation +// +// /* +// ** Invoke the profile callback. This routine is only called if we already +// ** know that the profile callback is defined and needs to be invoked. +// */ +func _invokeProfileCallback(tls *libc.TLS, db uintptr, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* iElapse at bp+8 */ Tsqlite3_int64 + var _ /* iNow at bp+0 */ Tsqlite3_int64 + _sqlite3OsCurrentTimeInt64(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, bp) + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = (*(*Tsqlite3_int64)(unsafe.Pointer(bp)) - (*TVdbe)(unsafe.Pointer(p)).FstartTime) * int64(1000000) + if (*Tsqlite3)(unsafe.Pointer(db)).FxProfile != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, Tu64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProfile})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProfileArg, (*TVdbe)(unsafe.Pointer(p)).FzSql, uint64(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)))) + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_PROFILE) != 0 { + (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_PROFILE), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, bp+8) + } + (*TVdbe)(unsafe.Pointer(p)).FstartTime = 0 +} + +/* +** The checkProfileCallback(DB,P) macro checks to see if a profile callback +** is needed, and it invokes the callback if it is needed. + */ + +// C documentation +// +// /* +// ** The following routine destroys a virtual machine that is created by +// ** the sqlite3_compile() routine. The integer returned is an SQLITE_ +// ** success/failure code that describes the result of executing the virtual +// ** machine. +// ** +// ** This routine sets the error code and string returned by +// ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +// */ +func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) (r int32) { + var db, v uintptr + var rc int32 + _, _, _ = db, rc, v + if pStmt == uintptr(0) { + /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL + ** pointer is a harmless no-op. */ + rc = SQLITE_OK + } else { + v = pStmt + db = (*TVdbe)(unsafe.Pointer(v)).Fdb + if _vdbeSafety(tls, v) != 0 { + return _sqlite3MisuseError(tls, int32(90035)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { + _invokeProfileCallback(tls, db, v) + } + rc = _sqlite3VdbeReset(tls, v) + _sqlite3VdbeDelete(tls, v) + rc = _sqlite3ApiExit(tls, db, rc) + _sqlite3LeaveMutexAndCloseZombie(tls, db) + } + return rc +} + +// C documentation +// +// /* +// ** Terminate the current execution of an SQL statement and reset it +// ** back to its starting state so that it can be reused. A success code from +// ** the prior execution is returned. +// ** +// ** This routine sets the error code and string returned by +// ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +// */ +func Xsqlite3_reset(tls *libc.TLS, pStmt uintptr) (r int32) { + var db, v uintptr + var rc int32 + _, _, _ = db, rc, v + if pStmt == uintptr(0) { + rc = SQLITE_OK + } else { + v = pStmt + db = (*TVdbe)(unsafe.Pointer(v)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*TVdbe)(unsafe.Pointer(v)).FstartTime > 0 { + _invokeProfileCallback(tls, db, v) + } + rc = _sqlite3VdbeReset(tls, v) + _sqlite3VdbeRewind(tls, v) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + } + return rc +} + +// C documentation +// +// /* +// ** Set all the parameters in the compiled SQL statement to NULL. +// */ +func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) (r int32) { + var i, rc int32 + var mutex, p uintptr + _, _, _, _ = i, mutex, p, rc + rc = SQLITE_OK + p = pStmt + mutex = (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex + Xsqlite3_mutex_enter(tls, mutex) + i = 0 + for { + if !(i < int32((*TVdbe)(unsafe.Pointer(p)).FnVar)) { + break + } + _sqlite3VdbeMemRelease(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar+uintptr(i)*56) + (*(*TMem)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56))).Fflags = uint16(MEM_Null) + goto _1 + _1: + ; + i++ + } + if (*TVdbe)(unsafe.Pointer(p)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 0, 0x3) + } + Xsqlite3_mutex_leave(tls, mutex) + return rc +} + +// C documentation +// +// /**************************** sqlite3_value_ ******************************* +// ** The following routines extract information from a Mem or sqlite3_value +// ** structure. +// */ +func Xsqlite3_value_blob(tls *libc.TLS, pVal uintptr) (r uintptr) { + var p, v3, p2 uintptr + var v1 int32 + _, _, _, _ = p, v1, v3, p2 + p = pVal + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Blob)|libc.Int32FromInt32(MEM_Str)) != 0 { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Zero) != 0 { + v1 = _sqlite3VdbeMemExpandBlob(tls, p) + } else { + v1 = 0 + } + if v1 != SQLITE_OK { + return uintptr(0) + } + p2 = p + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Blob)) + if (*TMem)(unsafe.Pointer(p)).Fn != 0 { + v3 = (*TMem)(unsafe.Pointer(p)).Fz + } else { + v3 = uintptr(0) + } + return v3 + } else { + return Xsqlite3_value_text(tls, pVal) + } + return r +} + +func Xsqlite3_value_bytes(tls *libc.TLS, pVal uintptr) (r int32) { + return _sqlite3ValueBytes(tls, pVal, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_value_bytes16(tls *libc.TLS, pVal uintptr) (r int32) { + return _sqlite3ValueBytes(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_value_double(tls *libc.TLS, pVal uintptr) (r float64) { + return _sqlite3VdbeRealValue(tls, pVal) +} + +func Xsqlite3_value_int(tls *libc.TLS, pVal uintptr) (r int32) { + return int32(_sqlite3VdbeIntValue(tls, pVal)) +} + +func Xsqlite3_value_int64(tls *libc.TLS, pVal uintptr) (r Tsqlite_int64) { + return _sqlite3VdbeIntValue(tls, pVal) +} + +func Xsqlite3_value_subtype(tls *libc.TLS, pVal uintptr) (r uint32) { + var pMem uintptr + var v1 int32 + _, _ = pMem, v1 + pMem = pVal + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Subtype) != 0 { + v1 = int32((*TMem)(unsafe.Pointer(pMem)).FeSubtype) + } else { + v1 = 0 + } + return uint32(v1) +} + +func Xsqlite3_value_pointer(tls *libc.TLS, pVal uintptr, zPType uintptr) (r uintptr) { + var p uintptr + _ = p + p = pVal + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Term)|libc.Int32FromInt32(MEM_Subtype)) == libc.Int32FromInt32(MEM_Null)|libc.Int32FromInt32(MEM_Term)|libc.Int32FromInt32(MEM_Subtype) && zPType != uintptr(0) && int32((*TMem)(unsafe.Pointer(p)).FeSubtype) == int32('p') && libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(p)), zPType) == 0 { + return (*TMem)(unsafe.Pointer(p)).Fz + } else { + return uintptr(0) + } + return r +} + +func Xsqlite3_value_text(tls *libc.TLS, pVal uintptr) (r uintptr) { + return _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_value_text16(tls *libc.TLS, pVal uintptr) (r uintptr) { + return _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_value_text16be(tls *libc.TLS, pVal uintptr) (r uintptr) { + return _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16BE)) +} + +func Xsqlite3_value_text16le(tls *libc.TLS, pVal uintptr) (r uintptr) { + return _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +// C documentation +// +// /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five +// ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating +// ** point number string BLOB NULL +// */ +func Xsqlite3_value_type(tls *libc.TLS, pVal uintptr) (r int32) { + return int32(_aType[int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_AffMask)]) +} + +var _aType = [64]Tu8{ + 0: uint8(SQLITE_BLOB), + 1: uint8(SQLITE_NULL), + 2: uint8(SQLITE_TEXT), + 3: uint8(SQLITE_NULL), + 4: uint8(SQLITE_INTEGER), + 5: uint8(SQLITE_NULL), + 6: uint8(SQLITE_INTEGER), + 7: uint8(SQLITE_NULL), + 8: uint8(SQLITE_FLOAT), + 9: uint8(SQLITE_NULL), + 10: uint8(SQLITE_FLOAT), + 11: uint8(SQLITE_NULL), + 12: uint8(SQLITE_INTEGER), + 13: uint8(SQLITE_NULL), + 14: uint8(SQLITE_INTEGER), + 15: uint8(SQLITE_NULL), + 16: uint8(SQLITE_BLOB), + 17: uint8(SQLITE_NULL), + 18: uint8(SQLITE_TEXT), + 19: uint8(SQLITE_NULL), + 20: uint8(SQLITE_INTEGER), + 21: uint8(SQLITE_NULL), + 22: uint8(SQLITE_INTEGER), + 23: uint8(SQLITE_NULL), + 24: uint8(SQLITE_FLOAT), + 25: uint8(SQLITE_NULL), + 26: uint8(SQLITE_FLOAT), + 27: uint8(SQLITE_NULL), + 28: uint8(SQLITE_INTEGER), + 29: uint8(SQLITE_NULL), + 30: uint8(SQLITE_INTEGER), + 31: uint8(SQLITE_NULL), + 32: uint8(SQLITE_FLOAT), + 33: uint8(SQLITE_NULL), + 34: uint8(SQLITE_FLOAT), + 35: uint8(SQLITE_NULL), + 36: uint8(SQLITE_FLOAT), + 37: uint8(SQLITE_NULL), + 38: uint8(SQLITE_FLOAT), + 39: uint8(SQLITE_NULL), + 40: uint8(SQLITE_FLOAT), + 41: uint8(SQLITE_NULL), + 42: uint8(SQLITE_FLOAT), + 43: uint8(SQLITE_NULL), + 44: uint8(SQLITE_FLOAT), + 45: uint8(SQLITE_NULL), + 46: uint8(SQLITE_FLOAT), + 47: uint8(SQLITE_NULL), + 48: uint8(SQLITE_BLOB), + 49: uint8(SQLITE_NULL), + 50: uint8(SQLITE_TEXT), + 51: uint8(SQLITE_NULL), + 52: uint8(SQLITE_FLOAT), + 53: uint8(SQLITE_NULL), + 54: uint8(SQLITE_FLOAT), + 55: uint8(SQLITE_NULL), + 56: uint8(SQLITE_FLOAT), + 57: uint8(SQLITE_NULL), + 58: uint8(SQLITE_FLOAT), + 59: uint8(SQLITE_NULL), + 60: uint8(SQLITE_FLOAT), + 61: uint8(SQLITE_NULL), + 62: uint8(SQLITE_FLOAT), + 63: uint8(SQLITE_NULL), +} + +func Xsqlite3_value_encoding(tls *libc.TLS, pVal uintptr) (r int32) { + return int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fenc) +} + +// C documentation +// +// /* Return true if a parameter to xUpdate represents an unchanged column */ +func Xsqlite3_value_nochange(tls *libc.TLS, pVal uintptr) (r int32) { + return libc.BoolInt32(int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&(libc.Int32FromInt32(MEM_Null)|libc.Int32FromInt32(MEM_Zero)) == libc.Int32FromInt32(MEM_Null)|libc.Int32FromInt32(MEM_Zero)) +} + +// C documentation +// +// /* Return true if a parameter value originated from an sqlite3_bind() */ +func Xsqlite3_value_frombind(tls *libc.TLS, pVal uintptr) (r int32) { + return libc.BoolInt32(int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_FromBind) != 0) +} + +// C documentation +// +// /* Make a copy of an sqlite3_value object +// */ +func Xsqlite3_value_dup(tls *libc.TLS, pOrig uintptr) (r uintptr) { + var pNew, p1, p2, p3, p4 uintptr + _, _, _, _, _ = pNew, p1, p2, p3, p4 + if pOrig == uintptr(0) { + return uintptr(0) + } + pNew = Xsqlite3_malloc(tls, int32(56)) + if pNew == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, pNew, 0, uint64(56)) + libc.Xmemcpy(tls, pNew, pOrig, uint64(libc.UintptrFromInt32(0)+24)) + p1 = pNew + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(MEM_Dyn)) + (*Tsqlite3_value)(unsafe.Pointer(pNew)).Fdb = uintptr(0) + if int32((*Tsqlite3_value)(unsafe.Pointer(pNew)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + p2 = pNew + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^(libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Dyn))) + p3 = pNew + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(MEM_Ephem)) + if _sqlite3VdbeMemMakeWriteable(tls, pNew) != SQLITE_OK { + _sqlite3ValueFree(tls, pNew) + pNew = uintptr(0) + } + } else { + if int32((*Tsqlite3_value)(unsafe.Pointer(pNew)).Fflags)&int32(MEM_Null) != 0 { + /* Do not duplicate pointer values */ + p4 = pNew + 20 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(MEM_Term) | libc.Int32FromInt32(MEM_Subtype))) + } + } + return pNew +} + +// C documentation +// +// /* Destroy an sqlite3_value object previously obtained from +// ** sqlite3_value_dup(). +// */ +func Xsqlite3_value_free(tls *libc.TLS, pOld uintptr) { + _sqlite3ValueFree(tls, pOld) +} + +// C documentation +// +// /**************************** sqlite3_result_ ******************************* +// ** The following routines are used by user-defined functions to specify +// ** the function result. +// ** +// ** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the +// ** result as a string or blob. Appropriate errors are set if the string/blob +// ** is too big or if an OOM occurs. +// ** +// ** The invokeValueDestructor(P,X) routine invokes destructor function X() +// ** on value P if P is not going to be used and need to be destroyed. +// */ +func _setResultStrOrError(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, enc Tu8, xDel uintptr) { + var pOut uintptr + var rc int32 + _, _ = pOut, rc + pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + rc = _sqlite3VdbeMemSetStr(tls, pOut, z, int64(n), enc, xDel) + if rc != 0 { + if rc == int32(SQLITE_TOOBIG) { + Xsqlite3_result_error_toobig(tls, pCtx) + } else { + /* The only errors possible from sqlite3VdbeMemSetStr are + ** SQLITE_TOOBIG and SQLITE_NOMEM */ + Xsqlite3_result_error_nomem(tls, pCtx) + } + return + } + _sqlite3VdbeChangeEncoding(tls, pOut, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx)).Fenc)) + if _sqlite3VdbeMemTooBig(tls, pOut) != 0 { + Xsqlite3_result_error_toobig(tls, pCtx) + } +} + +func _invokeValueDestructor(tls *libc.TLS, p uintptr, xDel uintptr, pCtx uintptr) (r int32) { + if xDel == uintptr(0) { + /* noop */ + } else { + if xDel == uintptr(-libc.Int32FromInt32(1)) { + /* noop */ + } else { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDel})))(tls, p) + } + } + Xsqlite3_result_error_toobig(tls, pCtx) + return int32(SQLITE_TOOBIG) +} + +func Xsqlite3_result_blob(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { + _setResultStrOrError(tls, pCtx, z, n, uint8(0), xDel) +} + +func Xsqlite3_result_blob64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_uint64, xDel uintptr) { + if n > uint64(0x7fffffff) { + _invokeValueDestructor(tls, z, xDel, pCtx) + } else { + _setResultStrOrError(tls, pCtx, z, int32(n), uint8(0), xDel) + } +} + +func Xsqlite3_result_double(tls *libc.TLS, pCtx uintptr, rVal float64) { + _sqlite3VdbeMemSetDouble(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, rVal) +} + +func Xsqlite3_result_error(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_ERROR) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF8), uintptr(-libc.Int32FromInt32(1))) +} + +func Xsqlite3_result_error16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_ERROR) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF16LE), uintptr(-libc.Int32FromInt32(1))) +} + +func Xsqlite3_result_int(tls *libc.TLS, pCtx uintptr, iVal int32) { + _sqlite3VdbeMemSetInt64(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, int64(iVal)) +} + +func Xsqlite3_result_int64(tls *libc.TLS, pCtx uintptr, iVal Ti64) { + _sqlite3VdbeMemSetInt64(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, iVal) +} + +func Xsqlite3_result_null(tls *libc.TLS, pCtx uintptr) { + _sqlite3VdbeMemSetNull(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut) +} + +func Xsqlite3_result_pointer(tls *libc.TLS, pCtx uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr) { + var pOut uintptr + _ = pOut + pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + _sqlite3VdbeMemRelease(tls, pOut) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) + _sqlite3VdbeMemSetPointer(tls, pOut, pPtr, zPType, xDestructor) +} + +func Xsqlite3_result_subtype(tls *libc.TLS, pCtx uintptr, eSubtype uint32) { + var pOut, p1 uintptr + _, _ = pOut, p1 + pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + (*TMem)(unsafe.Pointer(pOut)).FeSubtype = uint8(eSubtype & uint32(0xff)) + p1 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Subtype)) +} + +func Xsqlite3_result_text(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { + _setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF8), xDel) +} + +func Xsqlite3_result_text64(tls *libc.TLS, pCtx uintptr, z uintptr, n Tsqlite3_uint64, xDel uintptr, enc uint8) { + if int32(enc) != int32(SQLITE_UTF8) { + if int32(enc) == int32(SQLITE_UTF16) { + enc = uint8(SQLITE_UTF16LE) + } + n &= ^libc.Uint64FromInt32(1) + } + if n > uint64(0x7fffffff) { + _invokeValueDestructor(tls, z, xDel, pCtx) + } else { + _setResultStrOrError(tls, pCtx, z, int32(n), enc, xDel) + _sqlite3VdbeMemZeroTerminateIfAble(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut) + } +} + +func Xsqlite3_result_text16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { + _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16LE), xDel) +} + +func Xsqlite3_result_text16be(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { + _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16BE), xDel) +} + +func Xsqlite3_result_text16le(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { + _setResultStrOrError(tls, pCtx, z, int32(uint64(n) & ^libc.Uint64FromInt32(1)), uint8(SQLITE_UTF16LE), xDel) +} + +func Xsqlite3_result_value(tls *libc.TLS, pCtx uintptr, pValue uintptr) { + var pOut uintptr + _ = pOut + pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + _sqlite3VdbeMemCopy(tls, pOut, pValue) + _sqlite3VdbeChangeEncoding(tls, pOut, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx)).Fenc)) + if _sqlite3VdbeMemTooBig(tls, pOut) != 0 { + Xsqlite3_result_error_toobig(tls, pCtx) + } +} + +func Xsqlite3_result_zeroblob(tls *libc.TLS, pCtx uintptr, n int32) { + var v1 int32 + _ = v1 + if n > 0 { + v1 = n + } else { + v1 = 0 + } + Xsqlite3_result_zeroblob64(tls, pCtx, uint64(v1)) +} + +func Xsqlite3_result_zeroblob64(tls *libc.TLS, pCtx uintptr, n Tu64) (r int32) { + var pOut uintptr + _ = pOut + pOut = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + if n > uint64(*(*int32)(unsafe.Pointer((*TMem)(unsafe.Pointer(pOut)).Fdb + 136))) { + Xsqlite3_result_error_toobig(tls, pCtx) + return int32(SQLITE_TOOBIG) + } + _sqlite3VdbeMemSetZeroBlob(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, int32(n)) + return SQLITE_OK +} + +func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { + var v1 int32 + _ = v1 + if errCode != 0 { + v1 = errCode + } else { + v1 = -int32(1) + } + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = v1 + if int32((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fflags)&int32(MEM_Null) != 0 { + _setResultStrOrError(tls, pCtx, _sqlite3ErrStr(tls, errCode), -int32(1), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) + } +} + +// C documentation +// +// /* Force an SQLITE_TOOBIG error. */ +func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) + _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5455, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) +} + +// C documentation +// +// /* An SQLITE_NOMEM error. */ +func Xsqlite3_result_error_nomem(tls *libc.TLS, pCtx uintptr) { + _sqlite3VdbeMemSetNull(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut) + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_NOMEM) + _sqlite3OomFault(tls, (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fdb) +} + +// C documentation +// +// /* Force the INT64 value currently stored as the result to be +// ** a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL +// ** test-control. +// */ +func _sqlite3ResultIntReal(tls *libc.TLS, pCtx uintptr) { + var p1, p2 uintptr + _, _ = p1, p2 + if int32((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fflags)&int32(MEM_Int) != 0 { + p1 = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(MEM_Int)) + p2 = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_IntReal)) + } +} + +// C documentation +// +// /* +// ** This function is called after a transaction has been committed. It +// ** invokes callbacks registered with sqlite3_wal_hook() as required. +// */ +func _doWalCallbacks(tls *libc.TLS, db uintptr) (r int32) { + var i, nEntry, rc int32 + var pBt uintptr + _, _, _, _ = i, nEntry, pBt, rc + rc = SQLITE_OK + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 { + _sqlite3BtreeEnter(tls, pBt) + nEntry = _sqlite3PagerWalCallback(tls, _sqlite3BtreePager(tls, pBt)) + _sqlite3BtreeLeave(tls, pBt) + if nEntry > 0 && (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback != 0 && rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpWalArg, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FzDbSName, nEntry) + } + } + goto _1 + _1: + ; + i++ + } + return rc +} + +// C documentation +// +// /* +// ** Execute the statement pStmt, either until a row of data is ready, the +// ** statement is completely executed or an error occurs. +// ** +// ** This routine implements the bulk of the logic behind the sqlite_step() +// ** API. The only thing omitted is the automatic recompile if a +// ** schema change has occurred. That detail is handled by the +// ** outer sqlite3_step() wrapper procedure. +// */ +func _sqlite3Step(tls *libc.TLS, p uintptr) (r int32) { + var db uintptr + var rc int32 + _, _ = db, rc + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_RUN_STATE) { + restart_step: + ; + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_READY_STATE) { + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_SCHEMA) + rc = int32(SQLITE_ERROR) + if int32((*TVdbe)(unsafe.Pointer(p)).FprepFlags)&int32(SQLITE_PREPARE_SAVESQL) != 0 { + /* If this statement was prepared using saved SQL and an + ** error has occurred, then return the error code in p->rc to the + ** caller. Set the error code in the database handle to the same + ** value. + */ + rc = _sqlite3VdbeTransferError(tls, p) + } + goto end_of_step + } + /* If there are no other statements currently running, then + ** reset the interrupt flag. This prevents a call to sqlite3_interrupt + ** from interrupting a statement that has not yet started. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&(libc.Int32FromInt32(SQLITE_TRACE_PROFILE)|libc.Int32FromInt32(SQLITE_TRACE_XPROFILE)) != 0 && !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) && (*TVdbe)(unsafe.Pointer(p)).FzSql != 0 { + _sqlite3OsCurrentTimeInt64(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, p+184) + } else { + } + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive++ + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x40>>6)) == 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite++ + } + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x80>>7)) != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead++ + } + (*TVdbe)(unsafe.Pointer(p)).Fpc = 0 + (*TVdbe)(unsafe.Pointer(p)).FeVdbeState = uint8(VDBE_RUN_STATE) + } else { + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) == int32(VDBE_HALT_STATE) { + /* We used to require that sqlite3_reset() be called before retrying + ** sqlite3_step() after any error or after SQLITE_DONE. But beginning + ** with version 3.7.0, we changed this so that sqlite3_reset() would + ** be called automatically instead of throwing the SQLITE_MISUSE error. + ** This "automatic-reset" change is not technically an incompatibility, + ** since any application that receives an SQLITE_MISUSE is broken by + ** definition. + ** + ** Nevertheless, some published applications that were originally written + ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE + ** returns, and those were broken by the automatic-reset change. As a + ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the + ** legacy behavior of returning SQLITE_MISUSE for cases where the + ** previous sqlite3_step() returned something other than a SQLITE_LOCKED + ** or SQLITE_BUSY error. + */ + Xsqlite3_reset(tls, p) + goto restart_step + } + } + } + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) != 0 { + rc = _sqlite3VdbeList(tls, p) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec++ + rc = _sqlite3VdbeExec(tls, p) + (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec-- + } + if rc == int32(SQLITE_ROW) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_ROW) + return int32(SQLITE_ROW) + } else { + /* If the statement completed successfully, invoke the profile callback */ + if (*TVdbe)(unsafe.Pointer(p)).FstartTime > 0 { + _invokeProfileCallback(tls, db, p) + } + (*TVdbe)(unsafe.Pointer(p)).FpResultRow = uintptr(0) + if rc == int32(SQLITE_DONE) && (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = _doWalCallbacks(tls, db) + if (*TVdbe)(unsafe.Pointer(p)).Frc != SQLITE_OK { + rc = int32(SQLITE_ERROR) + } + } else { + if rc != int32(SQLITE_DONE) && int32((*TVdbe)(unsafe.Pointer(p)).FprepFlags)&int32(SQLITE_PREPARE_SAVESQL) != 0 { + /* If this statement was prepared using saved SQL and an + ** error has occurred, then return the error code in p->rc to the + ** caller. Set the error code in the database handle to the same value. + */ + rc = _sqlite3VdbeTransferError(tls, p) + } + } + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = rc + if int32(SQLITE_NOMEM) == _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(p)).Frc) { + (*TVdbe)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + if int32((*TVdbe)(unsafe.Pointer(p)).FprepFlags)&int32(SQLITE_PREPARE_SAVESQL) != 0 { + rc = (*TVdbe)(unsafe.Pointer(p)).Frc + } + } +end_of_step: + ; + /* There are only a limited number of result codes allowed from the + ** statements prepared using the legacy sqlite3_prepare() interface */ + return rc & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask +} + +// C documentation +// +// /* +// ** This is the top-level implementation of sqlite3_step(). Call +// ** sqlite3Step() to do most of the work. If a schema error occurs, +// ** call sqlite3Reprepare() and try again. +// */ +func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) (r int32) { + var cnt, rc, savedPc, v1, v2, v4, v5 int32 + var db, v, zErr uintptr + var v3 bool + _, _, _, _, _, _, _, _, _, _, _ = cnt, db, rc, savedPc, v, zErr, v1, v2, v3, v4, v5 + rc = SQLITE_OK /* Result from sqlite3Step() */ + v = pStmt /* the prepared statement */ + cnt = 0 /* The database connection */ + if _vdbeSafetyNotNull(tls, v) != 0 { + return _sqlite3MisuseError(tls, int32(90829)) + } + db = (*TVdbe)(unsafe.Pointer(v)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + for { + v1 = _sqlite3Step(tls, v) + rc = v1 + if v3 = v1 == int32(SQLITE_SCHEMA); v3 { + v2 = cnt + cnt++ + } + if !(v3 && v2 < int32(SQLITE_MAX_SCHEMA_RETRY)) { + break + } + savedPc = (*TVdbe)(unsafe.Pointer(v)).Fpc + rc = _sqlite3Reprepare(tls, v) + if rc != SQLITE_OK { + /* This case occurs after failing to recompile an sql statement. + ** The error message from the SQL compiler has already been loaded + ** into the database handle. This block copies the error message + ** from the database handle into the statement and sets the statement + ** program counter to 0 to ensure that when the statement is + ** finalized or reset the parser error message is available via + ** sqlite3_errmsg() and sqlite3_errcode(). + */ + zErr = Xsqlite3_value_text(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(v)).FzErrMsg) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + (*TVdbe)(unsafe.Pointer(v)).FzErrMsg = _sqlite3DbStrDup(tls, db, zErr) + v4 = _sqlite3ApiExit(tls, db, rc) + rc = v4 + (*TVdbe)(unsafe.Pointer(v)).Frc = v4 + } else { + (*TVdbe)(unsafe.Pointer(v)).FzErrMsg = uintptr(0) + v5 = libc.Int32FromInt32(SQLITE_NOMEM) + rc = v5 + (*TVdbe)(unsafe.Pointer(v)).Frc = v5 + } + break + } + Xsqlite3_reset(tls, pStmt) + if savedPc >= 0 { + /* Setting minWriteFileFormat to 254 is a signal to the OP_Init and + ** OP_Trace opcodes to *not* perform SQLITE_TRACE_STMT because it has + ** already been done once on a prior invocation that failed due to + ** SQLITE_SCHEMA. tag-20220401a */ + (*TVdbe)(unsafe.Pointer(v)).FminWriteFileFormat = uint8(254) + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Extract the user data from a sqlite3_context structure and return a +// ** pointer to it. +// */ +func Xsqlite3_user_data(tls *libc.TLS, p uintptr) (r uintptr) { + return (*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpFunc)).FpUserData +} + +// C documentation +// +// /* +// ** Extract the user data from a sqlite3_context structure and return a +// ** pointer to it. +// ** +// ** IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface +// ** returns a copy of the pointer to the database connection (the 1st +// ** parameter) of the sqlite3_create_function() and +// ** sqlite3_create_function16() routines that originally registered the +// ** application defined function. +// */ +func Xsqlite3_context_db_handle(tls *libc.TLS, p uintptr) (r uintptr) { + return (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpOut)).Fdb +} + +// C documentation +// +// /* +// ** If this routine is invoked from within an xColumn method of a virtual +// ** table, then it returns true if and only if the the call is during an +// ** UPDATE operation and the value of the column will not be modified +// ** by the UPDATE. +// ** +// ** If this routine is called from any context other than within the +// ** xColumn method of a virtual table, then the return value is meaningless +// ** and arbitrary. +// ** +// ** Virtual table implements might use this routine to optimize their +// ** performance by substituting a NULL result, or some other light-weight +// ** value, as a signal to the xUpdate routine that the column is unchanged. +// */ +func Xsqlite3_vtab_nochange(tls *libc.TLS, p uintptr) (r int32) { + return Xsqlite3_value_nochange(tls, (*Tsqlite3_context)(unsafe.Pointer(p)).FpOut) +} + +// C documentation +// +// /* +// ** The destructor function for a ValueList object. This needs to be +// ** a separate function, unknowable to the application, to ensure that +// ** calls to sqlite3_vtab_in_first()/sqlite3_vtab_in_next() that are not +// ** preceded by activation of IN processing via sqlite3_vtab_int() do not +// ** try to access a fake ValueList object inserted by a hostile extension. +// */ +func _sqlite3VdbeValueListFree(tls *libc.TLS, pToDelete uintptr) { + Xsqlite3_free(tls, pToDelete) +} + +// C documentation +// +// /* +// ** Implementation of sqlite3_vtab_in_first() (if bNext==0) and +// ** sqlite3_vtab_in_next() (if bNext!=0). +// */ +func _valueFromValueList(tls *libc.TLS, pVal uintptr, ppOut uintptr, bNext int32) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var iOff, rc, v1 int32 + var pOut, pRhs, zBuf uintptr + var sz Tu32 + var _ /* dummy at bp+0 */ int32 + var _ /* iSerial at bp+64 */ Tu32 + var _ /* sMem at bp+8 */ TMem + _, _, _, _, _, _, _ = iOff, pOut, pRhs, rc, sz, zBuf, v1 + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + if pVal == uintptr(0) { + return _sqlite3MisuseError(tls, int32(90950)) + } + if int32((*Tsqlite3_value)(unsafe.Pointer(pVal)).Fflags)&int32(MEM_Dyn) == 0 || (*Tsqlite3_value)(unsafe.Pointer(pVal)).FxDel != __ccgo_fp(_sqlite3VdbeValueListFree) { + return int32(SQLITE_ERROR) + } else { + pRhs = (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz + } + if bNext != 0 { + rc = _sqlite3BtreeNext(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr, 0) + } else { + *(*int32)(unsafe.Pointer(bp)) = 0 + rc = _sqlite3BtreeFirst(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr, bp) + if _sqlite3BtreeEof(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr) != 0 { + rc = int32(SQLITE_DONE) + } + } + if rc == SQLITE_OK { /* Raw content of current row */ + libc.Xmemset(tls, bp+8, 0, uint64(56)) + sz = _sqlite3BtreePayloadSize(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr) + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, (*TValueList)(unsafe.Pointer(pRhs)).FpCsr, uint32(int32(sz)), bp+8) + if rc == SQLITE_OK { + zBuf = (*(*TMem)(unsafe.Pointer(bp + 8))).Fz + pOut = (*TValueList)(unsafe.Pointer(pRhs)).FpOut + if int32(*(*Tu8)(unsafe.Pointer(zBuf + 1))) < int32(libc.Uint8FromInt32(0x80)) { + *(*Tu32)(unsafe.Pointer(bp + 64)) = uint32(*(*Tu8)(unsafe.Pointer(zBuf + 1))) + v1 = libc.Int32FromInt32(1) + } else { + v1 = int32(_sqlite3GetVarint32(tls, zBuf+1, bp+64)) + } + iOff = int32(1) + int32(uint8(v1)) + _sqlite3VdbeSerialGet(tls, zBuf+uintptr(iOff), *(*Tu32)(unsafe.Pointer(bp + 64)), pOut) + (*Tsqlite3_value)(unsafe.Pointer(pOut)).Fenc = (*Tsqlite3)(unsafe.Pointer((*Tsqlite3_value)(unsafe.Pointer(pOut)).Fdb)).Fenc + if int32((*Tsqlite3_value)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Ephem) != 0 && _sqlite3VdbeMemMakeWriteable(tls, pOut) != 0 { + rc = int32(SQLITE_NOMEM) + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = pOut + } + } + _sqlite3VdbeMemRelease(tls, bp+8) + } + return rc +} + +// C documentation +// +// /* +// ** Set the iterator value pVal to point to the first value in the set. +// ** Set (*ppOut) to point to this value before returning. +// */ +func Xsqlite3_vtab_in_first(tls *libc.TLS, pVal uintptr, ppOut uintptr) (r int32) { + return _valueFromValueList(tls, pVal, ppOut, 0) +} + +// C documentation +// +// /* +// ** Set the iterator value pVal to point to the next value in the set. +// ** Set (*ppOut) to point to this value before returning. +// */ +func Xsqlite3_vtab_in_next(tls *libc.TLS, pVal uintptr, ppOut uintptr) (r int32) { + return _valueFromValueList(tls, pVal, ppOut, int32(1)) +} + +// C documentation +// +// /* +// ** Return the current time for a statement. If the current time +// ** is requested more than once within the same run of a single prepared +// ** statement, the exact same time is returned for each invocation regardless +// ** of the amount of time that elapses between invocations. In other words, +// ** the time returned is always the time of the first call. +// */ +func _sqlite3StmtCurrentTime(tls *libc.TLS, p uintptr) (r Tsqlite3_int64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var piTime, v1 uintptr + var rc int32 + var _ /* iTime at bp+0 */ Tsqlite3_int64 + _, _, _ = piTime, rc, v1 + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = 0 + if (*Tsqlite3_context)(unsafe.Pointer(p)).FpVdbe != uintptr(0) { + v1 = (*Tsqlite3_context)(unsafe.Pointer(p)).FpVdbe + 72 + } else { + v1 = bp + } + piTime = v1 + if *(*Tsqlite3_int64)(unsafe.Pointer(piTime)) == 0 { + rc = _sqlite3OsCurrentTimeInt64(tls, (*Tsqlite3)(unsafe.Pointer((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpOut)).Fdb)).FpVfs, piTime) + if rc != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(piTime)) = 0 + } + } + return *(*Tsqlite3_int64)(unsafe.Pointer(piTime)) +} + +// C documentation +// +// /* +// ** Create a new aggregate context for p and return a pointer to +// ** its pMem->z element. +// */ +func _createAggContext(tls *libc.TLS, p uintptr, nByte int32) (r uintptr) { + var pMem uintptr + _ = pMem + pMem = (*Tsqlite3_context)(unsafe.Pointer(p)).FpMem + if nByte <= 0 { + _sqlite3VdbeMemSetNull(tls, pMem) + (*TMem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + } else { + _sqlite3VdbeMemClearAndResize(tls, pMem, nByte) + (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Agg) + *(*uintptr)(unsafe.Pointer(pMem)) = (*Tsqlite3_context)(unsafe.Pointer(p)).FpFunc + if (*TMem)(unsafe.Pointer(pMem)).Fz != 0 { + libc.Xmemset(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, 0, uint64(nByte)) + } + } + return (*TMem)(unsafe.Pointer(pMem)).Fz +} + +// C documentation +// +// /* +// ** Allocate or return the aggregate context for a user function. A new +// ** context is allocated on the first call. Subsequent calls return the +// ** same context that was returned on prior calls. +// */ +func Xsqlite3_aggregate_context(tls *libc.TLS, p uintptr, nByte int32) (r uintptr) { + if int32((*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpMem)).Fflags)&int32(MEM_Agg) == 0 { + return _createAggContext(tls, p, nByte) + } else { + return (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpMem)).Fz + } + return r +} + +// C documentation +// +// /* +// ** Return the auxiliary data pointer, if any, for the iArg'th argument to +// ** the user-function defined by pCtx. +// ** +// ** The left-most argument is 0. +// ** +// ** Undocumented behavior: If iArg is negative then access a cache of +// ** auxiliary data pointers that is available to all functions within a +// ** single prepared statement. The iArg values must match. +// */ +func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) (r uintptr) { + var pAuxData uintptr + _ = pAuxData + if (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { + return uintptr(0) + } + pAuxData = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FpAuxData + for { + if !(pAuxData != 0) { + break + } + if (*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxArg == iArg && ((*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxOp == (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp || iArg < 0) { + return (*TAuxData)(unsafe.Pointer(pAuxData)).FpAux + } + goto _1 + _1: + ; + pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Set the auxiliary data pointer and delete function, for the iArg'th +// ** argument to the user-function defined by pCtx. Any previous value is +// ** deleted by calling the delete function specified when it was set. +// ** +// ** The left-most argument is 0. +// ** +// ** Undocumented behavior: If iArg is negative then make the data available +// ** to all functions within the current prepared statement using iArg as an +// ** access code. +// */ +func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, xDelete uintptr) { + var pAuxData, pVdbe uintptr + _, _ = pAuxData, pVdbe + pVdbe = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe + if pVdbe == uintptr(0) { + goto failed + } + pAuxData = (*TVdbe)(unsafe.Pointer(pVdbe)).FpAuxData + for { + if !(pAuxData != 0) { + break + } + if (*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxArg == iArg && ((*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxOp == (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp || iArg < 0) { + break + } + goto _1 + _1: + ; + pAuxData = (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux + } + if pAuxData == uintptr(0) { + pAuxData = _sqlite3DbMallocZero(tls, (*TVdbe)(unsafe.Pointer(pVdbe)).Fdb, uint64(32)) + if !(pAuxData != 0) { + goto failed + } + (*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxOp = (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FiOp + (*TAuxData)(unsafe.Pointer(pAuxData)).FiAuxArg = iArg + (*TAuxData)(unsafe.Pointer(pAuxData)).FpNextAux = (*TVdbe)(unsafe.Pointer(pVdbe)).FpAuxData + (*TVdbe)(unsafe.Pointer(pVdbe)).FpAuxData = pAuxData + if (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError == 0 { + (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = -int32(1) + } + } else { + if (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux})))(tls, (*TAuxData)(unsafe.Pointer(pAuxData)).FpAux) + } + } + (*TAuxData)(unsafe.Pointer(pAuxData)).FpAux = pAux + (*TAuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete + return +failed: + ; + if xDelete != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDelete})))(tls, pAux) + } +} + +// C documentation +// +// /* +// ** Return the number of times the Step function of an aggregate has been +// ** called. +// ** +// ** This function is deprecated. Do not use it for new code. It is +// ** provide only to avoid breaking legacy code. New aggregate function +// ** implementations should keep their own counts within their aggregate +// ** context. +// */ +func Xsqlite3_aggregate_count(tls *libc.TLS, p uintptr) (r int32) { + return (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(p)).FpMem)).Fn +} + +// C documentation +// +// /* +// ** Return the number of columns in the result set for the statement pStmt. +// */ +func Xsqlite3_column_count(tls *libc.TLS, pStmt uintptr) (r int32) { + var pVm uintptr + _ = pVm + pVm = pStmt + if pVm == uintptr(0) { + return 0 + } + return int32((*TVdbe)(unsafe.Pointer(pVm)).FnResColumn) +} + +// C documentation +// +// /* +// ** Return the number of values available from the current row of the +// ** currently executing statement pStmt. +// */ +func Xsqlite3_data_count(tls *libc.TLS, pStmt uintptr) (r int32) { + var pVm uintptr + _ = pVm + pVm = pStmt + if pVm == uintptr(0) || (*TVdbe)(unsafe.Pointer(pVm)).FpResultRow == uintptr(0) { + return 0 + } + return int32((*TVdbe)(unsafe.Pointer(pVm)).FnResColumn) +} + +// C documentation +// +// /* +// ** Return a pointer to static memory containing an SQL NULL value. +// */ +func _columnNullValue(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&_nullMem)) +} + +/* Even though the Mem structure contains an element + ** of type i64, on certain architectures (x86) with certain compiler + ** switches (-Os), gcc may align this Mem object on a 4-byte boundary + ** instead of an 8-byte one. This all works fine, except that when + ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s + ** that a Mem structure is located on an 8-byte boundary. To prevent + ** these assert()s from failing, when building with SQLITE_DEBUG defined + ** using gcc, we force nullMem to be 8-byte aligned using the magical + ** __attribute__((aligned(8))) macro. */ +var _nullMem = TMem{ + Fflags: libc.Uint16FromInt32(MEM_Null), +} + +// C documentation +// +// /* +// ** Check to see if column iCol of the given statement is valid. If +// ** it is, return a pointer to the Mem for the value of that column. +// ** If iCol is not valid, return a pointer to a Mem which has a value +// ** of NULL. +// */ +func _columnMem(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var pOut, pVm uintptr + _, _ = pOut, pVm + pVm = pStmt + if pVm == uintptr(0) { + return _columnNullValue(tls) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pVm)).Fdb)).Fmutex) + if (*TVdbe)(unsafe.Pointer(pVm)).FpResultRow != uintptr(0) && i < int32((*TVdbe)(unsafe.Pointer(pVm)).FnResColumn) && i >= 0 { + pOut = (*TVdbe)(unsafe.Pointer(pVm)).FpResultRow + uintptr(i)*56 + } else { + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(pVm)).Fdb, int32(SQLITE_RANGE)) + pOut = _columnNullValue(tls) + } + return pOut +} + +// C documentation +// +// /* +// ** This function is called after invoking an sqlite3_value_XXX function on a +// ** column value (i.e. a value returned by evaluating an SQL expression in the +// ** select list of a SELECT statement) that may cause a malloc() failure. If +// ** malloc() has failed, the threads mallocFailed flag is cleared and the result +// ** code of statement pStmt set to SQLITE_NOMEM. +// ** +// ** Specifically, this is called from within: +// ** +// ** sqlite3_column_int() +// ** sqlite3_column_int64() +// ** sqlite3_column_text() +// ** sqlite3_column_text16() +// ** sqlite3_column_real() +// ** sqlite3_column_bytes() +// ** sqlite3_column_bytes16() +// ** sqlite3_column_blob() +// */ +func _columnMallocFailure(tls *libc.TLS, pStmt uintptr) { + var p uintptr + _ = p + /* If malloc() failed during an encoding conversion within an + ** sqlite3_column_XXX API, then set the return code of the statement to + ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR + ** and _finalize() will return NOMEM. + */ + p = pStmt + if p != 0 { + (*TVdbe)(unsafe.Pointer(p)).Frc = _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, (*TVdbe)(unsafe.Pointer(p)).Frc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } +} + +// C documentation +// +// /**************************** sqlite3_column_ ******************************* +// ** The following routines are used to access elements of the current row +// ** in the result set. +// */ +func Xsqlite3_column_blob(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var val uintptr + _ = val + val = Xsqlite3_value_blob(tls, _columnMem(tls, pStmt, i)) + /* Even though there is no encoding conversion, value_blob() might + ** need to call malloc() to expand the result of a zeroblob() + ** expression. + */ + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_bytes(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { + var val int32 + _ = val + val = Xsqlite3_value_bytes(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_bytes16(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { + var val int32 + _ = val + val = Xsqlite3_value_bytes16(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_double(tls *libc.TLS, pStmt uintptr, i int32) (r float64) { + var val float64 + _ = val + val = Xsqlite3_value_double(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_int(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { + var val int32 + _ = val + val = Xsqlite3_value_int(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_int64(tls *libc.TLS, pStmt uintptr, i int32) (r Tsqlite_int64) { + var val Tsqlite_int64 + _ = val + val = Xsqlite3_value_int64(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_text(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var val uintptr + _ = val + val = Xsqlite3_value_text(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_value(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var pOut, p1, p2 uintptr + _, _, _ = pOut, p1, p2 + pOut = _columnMem(tls, pStmt, i) + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Static) != 0 { + p1 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(MEM_Static)) + p2 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Ephem)) + } + _columnMallocFailure(tls, pStmt) + return pOut +} + +func Xsqlite3_column_text16(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var val uintptr + _ = val + val = Xsqlite3_value_text16(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { + var iType int32 + _ = iType + iType = Xsqlite3_value_type(tls, _columnMem(tls, pStmt, i)) + _columnMallocFailure(tls, pStmt) + return iType +} + +// C documentation +// +// /* +// ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. +// */ +var _azExplainColNames8 = [12]uintptr{ + 0: __ccgo_ts + 5478, + 1: __ccgo_ts + 5483, + 2: __ccgo_ts + 5490, + 3: __ccgo_ts + 5493, + 4: __ccgo_ts + 5496, + 5: __ccgo_ts + 5499, + 6: __ccgo_ts + 5502, + 7: __ccgo_ts + 5505, + 8: __ccgo_ts + 5513, + 9: __ccgo_ts + 5516, + 10: __ccgo_ts + 5523, + 11: __ccgo_ts + 5531, +} +var _azExplainColNames16data = [60]Tu16{ + 0: uint16('a'), + 1: uint16('d'), + 2: uint16('d'), + 3: uint16('r'), + 5: uint16('o'), + 6: uint16('p'), + 7: uint16('c'), + 8: uint16('o'), + 9: uint16('d'), + 10: uint16('e'), + 12: uint16('p'), + 13: uint16('1'), + 15: uint16('p'), + 16: uint16('2'), + 18: uint16('p'), + 19: uint16('3'), + 21: uint16('p'), + 22: uint16('4'), + 24: uint16('p'), + 25: uint16('5'), + 27: uint16('c'), + 28: uint16('o'), + 29: uint16('m'), + 30: uint16('m'), + 31: uint16('e'), + 32: uint16('n'), + 33: uint16('t'), + 35: uint16('i'), + 36: uint16('d'), + 38: uint16('p'), + 39: uint16('a'), + 40: uint16('r'), + 41: uint16('e'), + 42: uint16('n'), + 43: uint16('t'), + 45: uint16('n'), + 46: uint16('o'), + 47: uint16('t'), + 48: uint16('u'), + 49: uint16('s'), + 50: uint16('e'), + 51: uint16('d'), + 53: uint16('d'), + 54: uint16('e'), + 55: uint16('t'), + 56: uint16('a'), + 57: uint16('i'), + 58: uint16('l'), +} +var _iExplainColNames16 = [12]Tu8{ + 1: uint8(5), + 2: uint8(12), + 3: uint8(15), + 4: uint8(18), + 5: uint8(21), + 6: uint8(24), + 7: uint8(27), + 8: uint8(35), + 9: uint8(38), + 10: uint8(45), + 11: uint8(53), +} + +// C documentation +// +// /* +// ** Convert the N-th element of pStmt->pColName[] into a string using +// ** xFunc() then return that string. If N is out of range, return 0. +// ** +// ** There are up to 5 names for each column. useType determines which +// ** name is returned. Here are the names: +// ** +// ** 0 The column name as it should be displayed for output +// ** 1 The datatype name for the column +// ** 2 The name of the database that the column derives from +// ** 3 The name of the table that the column derives from +// ** 4 The name of the table column that the result column derives from +// ** +// ** If the result is not a simple column reference (if it is an expression +// ** or a constant) then useTypes 2, 3, and 4 return NULL. +// */ +func _columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType int32) (r uintptr) { + var db, p, ret uintptr + var i, n, v1 int32 + var prior_mallocFailed Tu8 + _, _, _, _, _, _, _ = db, i, n, p, prior_mallocFailed, ret, v1 + if N < 0 { + return uintptr(0) + } + ret = uintptr(0) + p = pStmt + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) != 0 { + if useType > 0 { + goto columnName_end + } + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2)) == int32(1) { + v1 = int32(8) + } else { + v1 = int32(4) + } + n = v1 + if N >= n { + goto columnName_end + } + if useUtf16 != 0 { + i = int32(_iExplainColNames16[N+int32(8)*int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2))-int32(8)]) + ret = uintptr(unsafe.Pointer(&_azExplainColNames16data)) + uintptr(i)*2 + } else { + ret = _azExplainColNames8[N+int32(8)*int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0xc>>2))-int32(8)] + } + goto columnName_end + } + n = int32((*TVdbe)(unsafe.Pointer(p)).FnResColumn) + if N < n { + prior_mallocFailed = (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed + N += useType * n + if useUtf16 != 0 { + ret = Xsqlite3_value_text16(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName+uintptr(N)*56) + } else { + ret = Xsqlite3_value_text(tls, (*TVdbe)(unsafe.Pointer(p)).FaColName+uintptr(N)*56) + } + /* A malloc may have failed inside of the _text() call. If this + ** is the case, clear the mallocFailed flag and return NULL. + */ + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) > int32(prior_mallocFailed) { + _sqlite3OomClear(tls, db) + ret = uintptr(0) + } + } +columnName_end: + ; + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return ret +} + +// C documentation +// +// /* +// ** Return the name of the Nth column of the result set returned by SQL +// ** statement pStmt. +// */ +func Xsqlite3_column_name(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, 0, COLNAME_NAME) +} + +func Xsqlite3_column_name16(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, int32(1), COLNAME_NAME) +} + +/* +** Constraint: If you have ENABLE_COLUMN_METADATA then you must +** not define OMIT_DECLTYPE. + */ + +// C documentation +// +// /* +// ** Return the column declaration type (if applicable) of the 'i'th column +// ** of the result set of SQL statement pStmt. +// */ +func Xsqlite3_column_decltype(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, 0, int32(COLNAME_DECLTYPE)) +} + +func Xsqlite3_column_decltype16(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, int32(1), int32(COLNAME_DECLTYPE)) +} + +// C documentation +// +// /* +// ** Return the name of the database from which a result column derives. +// ** NULL is returned if the result column is an expression or constant or +// ** anything else which is not an unambiguous reference to a database column. +// */ +func Xsqlite3_column_database_name(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, 0, int32(COLNAME_DATABASE)) +} + +func Xsqlite3_column_database_name16(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, int32(1), int32(COLNAME_DATABASE)) +} + +// C documentation +// +// /* +// ** Return the name of the table from which a result column derives. +// ** NULL is returned if the result column is an expression or constant or +// ** anything else which is not an unambiguous reference to a database column. +// */ +func Xsqlite3_column_table_name(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, 0, int32(COLNAME_TABLE)) +} + +func Xsqlite3_column_table_name16(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, int32(1), int32(COLNAME_TABLE)) +} + +// C documentation +// +// /* +// ** Return the name of the table column from which a result column derives. +// ** NULL is returned if the result column is an expression or constant or +// ** anything else which is not an unambiguous reference to a database column. +// */ +func Xsqlite3_column_origin_name(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, 0, int32(COLNAME_COLUMN)) +} + +func Xsqlite3_column_origin_name16(tls *libc.TLS, pStmt uintptr, N int32) (r uintptr) { + return _columnName(tls, pStmt, N, int32(1), int32(COLNAME_COLUMN)) +} + +// C documentation +// +// /******************************* sqlite3_bind_ *************************** +// ** +// ** Routines used to attach values to wildcards in a compiled SQL statement. +// */ +// /* +// ** Unbind the value bound to variable i in virtual machine p. This is the +// ** the same as binding a NULL value to the column. If the "i" parameter is +// ** out of range, then SQLITE_RANGE is returned. Otherwise SQLITE_OK. +// ** +// ** A successful evaluation of this routine acquires the mutex on p. +// ** the mutex is released if any kind of error occurs. +// ** +// ** The error code stored in database p->db is overwritten with the return +// ** value in any case. +// */ +func _vdbeUnbind(tls *libc.TLS, p uintptr, i uint32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pVar uintptr + var v1 uint32 + var v2 bool + _, _, _ = pVar, v1, v2 + if _vdbeSafetyNotNull(tls, p) != 0 { + return _sqlite3MisuseError(tls, int32(91554)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + if int32((*TVdbe)(unsafe.Pointer(p)).FeVdbeState) != int32(VDBE_READY_STATE) { + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, _sqlite3MisuseError(tls, int32(91558))) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5538, libc.VaList(bp+8, (*TVdbe)(unsafe.Pointer(p)).FzSql)) + return _sqlite3MisuseError(tls, int32(91562)) + } + if i >= uint32((*TVdbe)(unsafe.Pointer(p)).FnVar) { + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, int32(SQLITE_RANGE)) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + return int32(SQLITE_RANGE) + } + pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56 + _sqlite3VdbeMemRelease(tls, pVar) + (*TMem)(unsafe.Pointer(pVar)).Fflags = uint16(MEM_Null) + (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FerrCode = SQLITE_OK + /* If the bit corresponding to this variable in Vdbe.expmask is set, then + ** binding a new value to this variable invalidates the current query plan. + ** + ** IMPLEMENTATION-OF: R-57496-20354 If the specific value bound to a host + ** parameter in the WHERE clause might influence the choice of query plan + ** for a statement, then the statement will be automatically recompiled, + ** as if there had been a schema change, on the first sqlite3_step() call + ** following any change to the bindings of that parameter. + */ + if v2 = (*TVdbe)(unsafe.Pointer(p)).Fexpmask != uint32(0); v2 { + if i >= uint32(31) { + v1 = uint32(0x80000000) + } else { + v1 = libc.Uint32FromInt32(1) << i + } + } + if v2 && (*TVdbe)(unsafe.Pointer(p)).Fexpmask&v1 != uint32(0) { + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 0, 0x3) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Bind a text or BLOB value. +// */ +func _bindText(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Ti64, xDel uintptr, encoding Tu8) (r int32) { + var p, pVar uintptr + var rc int32 + _, _, _ = p, pVar, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + if zData != uintptr(0) { + pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(i-int32(1))*56 + rc = _sqlite3VdbeMemSetStr(tls, pVar, zData, nData, encoding, xDel) + if rc == SQLITE_OK && int32(encoding) != 0 { + rc = _sqlite3VdbeChangeEncoding(tls, pVar, int32((*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fenc)) + } + if rc != 0 { + _sqlite3Error(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, rc) + rc = _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, rc) + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } else { + if xDel != libc.UintptrFromInt32(0) && xDel != uintptr(-libc.Int32FromInt32(1)) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDel})))(tls, zData) + } + } + return rc +} + +// C documentation +// +// /* +// ** Bind a blob value to an SQL statement variable. +// */ +func Xsqlite3_bind_blob(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) (r int32) { + return _bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(0)) +} + +func Xsqlite3_bind_blob64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Tsqlite3_uint64, xDel uintptr) (r int32) { + return _bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(0)) +} + +func Xsqlite3_bind_double(tls *libc.TLS, pStmt uintptr, i int32, rValue float64) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + _sqlite3VdbeMemSetDouble(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar+uintptr(i-int32(1))*56, rValue) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_int(tls *libc.TLS, p uintptr, i int32, iValue int32) (r int32) { + return Xsqlite3_bind_int64(tls, p, i, int64(iValue)) +} + +func Xsqlite3_bind_int64(tls *libc.TLS, pStmt uintptr, i int32, iValue Tsqlite_int64) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + _sqlite3VdbeMemSetInt64(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar+uintptr(i-int32(1))*56, iValue) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_null(tls *libc.TLS, pStmt uintptr, i int32) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_pointer(tls *libc.TLS, pStmt uintptr, i int32, pPtr uintptr, zPTtype uintptr, xDestructor uintptr) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + _sqlite3VdbeMemSetPointer(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar+uintptr(i-int32(1))*56, pPtr, zPTtype, xDestructor) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } else { + if xDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestructor})))(tls, pPtr) + } + } + return rc +} + +func Xsqlite3_bind_text(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) (r int32) { + return _bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_bind_text64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Tsqlite3_uint64, xDel uintptr, enc uint8) (r int32) { + if int32(enc) != int32(SQLITE_UTF8) { + if int32(enc) == int32(SQLITE_UTF16) { + enc = uint8(SQLITE_UTF16LE) + } + nData &= uint64(^int32(libc.Uint16FromInt32(1))) + } + return _bindText(tls, pStmt, i, zData, int64(nData), xDel, enc) +} + +func Xsqlite3_bind_text16(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, n int32, xDel uintptr) (r int32) { + return _bindText(tls, pStmt, i, zData, int64(uint64(n) & ^libc.Uint64FromInt32(1)), xDel, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_bind_value(tls *libc.TLS, pStmt uintptr, i int32, pValue uintptr) (r int32) { + var rc int32 + var v1 float64 + _, _ = rc, v1 + switch Xsqlite3_value_type(tls, pValue) { + case int32(SQLITE_INTEGER): + rc = Xsqlite3_bind_int64(tls, pStmt, i, *(*Ti64)(unsafe.Pointer(pValue))) + case int32(SQLITE_FLOAT): + if int32((*Tsqlite3_value)(unsafe.Pointer(pValue)).Fflags)&int32(MEM_Real) != 0 { + v1 = *(*float64)(unsafe.Pointer(pValue)) + } else { + v1 = float64(*(*Ti64)(unsafe.Pointer(pValue))) + } + rc = Xsqlite3_bind_double(tls, pStmt, i, v1) + case int32(SQLITE_BLOB): + if int32((*Tsqlite3_value)(unsafe.Pointer(pValue)).Fflags)&int32(MEM_Zero) != 0 { + rc = Xsqlite3_bind_zeroblob(tls, pStmt, i, *(*int32)(unsafe.Pointer(&(*Tsqlite3_value)(unsafe.Pointer(pValue)).Fu))) + } else { + rc = Xsqlite3_bind_blob(tls, pStmt, i, (*Tsqlite3_value)(unsafe.Pointer(pValue)).Fz, (*Tsqlite3_value)(unsafe.Pointer(pValue)).Fn, uintptr(-libc.Int32FromInt32(1))) + } + case int32(SQLITE_TEXT): + rc = _bindText(tls, pStmt, i, (*Tsqlite3_value)(unsafe.Pointer(pValue)).Fz, int64((*Tsqlite3_value)(unsafe.Pointer(pValue)).Fn), uintptr(-libc.Int32FromInt32(1)), (*Tsqlite3_value)(unsafe.Pointer(pValue)).Fenc) + default: + rc = Xsqlite3_bind_null(tls, pStmt, i) + break + } + return rc +} + +func Xsqlite3_bind_zeroblob(tls *libc.TLS, pStmt uintptr, i int32, n int32) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + rc = _vdbeUnbind(tls, p, uint32(i-libc.Int32FromInt32(1))) + if rc == SQLITE_OK { + _sqlite3VdbeMemSetZeroBlob(tls, (*TVdbe)(unsafe.Pointer(p)).FaVar+uintptr(i-int32(1))*56, n) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_zeroblob64(tls *libc.TLS, pStmt uintptr, i int32, n Tsqlite3_uint64) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pStmt + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + if n > uint64(*(*int32)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb + 136))) { + rc = int32(SQLITE_TOOBIG) + } else { + rc = Xsqlite3_bind_zeroblob(tls, pStmt, i, int32(n)) + } + rc = _sqlite3ApiExit(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Return the number of wildcards that can be potentially bound to. +// ** This routine is added to support DBD::SQLite. +// */ +func Xsqlite3_bind_parameter_count(tls *libc.TLS, pStmt uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = pStmt + if p != 0 { + v1 = int32((*TVdbe)(unsafe.Pointer(p)).FnVar) + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Return the name of a wildcard parameter. Return NULL if the index +// ** is out of range or if the wildcard is unnamed. +// ** +// ** The result is always UTF-8. +// */ +func Xsqlite3_bind_parameter_name(tls *libc.TLS, pStmt uintptr, i int32) (r uintptr) { + var p uintptr + _ = p + p = pStmt + if p == uintptr(0) { + return uintptr(0) + } + return _sqlite3VListNumToName(tls, (*TVdbe)(unsafe.Pointer(p)).FpVList, i) +} + +// C documentation +// +// /* +// ** Given a wildcard parameter name, return the index of the variable +// ** with that name. If there is no variable with the given name, +// ** return 0. +// */ +func _sqlite3VdbeParameterIndex(tls *libc.TLS, p uintptr, zName uintptr, nName int32) (r int32) { + if p == uintptr(0) || zName == uintptr(0) { + return 0 + } + return _sqlite3VListNameToNum(tls, (*TVdbe)(unsafe.Pointer(p)).FpVList, zName, nName) +} + +func Xsqlite3_bind_parameter_index(tls *libc.TLS, pStmt uintptr, zName uintptr) (r int32) { + return _sqlite3VdbeParameterIndex(tls, pStmt, zName, _sqlite3Strlen30(tls, zName)) +} + +// C documentation +// +// /* +// ** Transfer all bindings from the first statement over to the second. +// */ +func _sqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) (r int32) { + var i int32 + var pFrom, pTo uintptr + _, _, _ = i, pFrom, pTo + pFrom = pFromStmt + pTo = pToStmt + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) + i = 0 + for { + if !(i < int32((*TVdbe)(unsafe.Pointer(pFrom)).FnVar)) { + break + } + _sqlite3VdbeMemMove(tls, (*TVdbe)(unsafe.Pointer(pTo)).FaVar+uintptr(i)*56, (*TVdbe)(unsafe.Pointer(pFrom)).FaVar+uintptr(i)*56) + goto _1 + _1: + ; + i++ + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Deprecated external interface. Internal/core SQLite code +// ** should call sqlite3TransferBindings. +// ** +// ** It is misuse to call this routine with statements from different +// ** database connections. But as this is a deprecated interface, we +// ** will not bother to check for that condition. +// ** +// ** If the two statements contain a different number of bindings, then +// ** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise +// ** SQLITE_OK is returned. +// */ +func Xsqlite3_transfer_bindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) (r int32) { + var pFrom, pTo uintptr + _, _ = pFrom, pTo + pFrom = pFromStmt + pTo = pToStmt + if int32((*TVdbe)(unsafe.Pointer(pFrom)).FnVar) != int32((*TVdbe)(unsafe.Pointer(pTo)).FnVar) { + return int32(SQLITE_ERROR) + } + if (*TVdbe)(unsafe.Pointer(pTo)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(pTo+200, libc.Uint32FromInt32(1), 0, 0x3) + } + if (*TVdbe)(unsafe.Pointer(pFrom)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(pFrom+200, libc.Uint32FromInt32(1), 0, 0x3) + } + return _sqlite3TransferBindings(tls, pFromStmt, pToStmt) +} + +// C documentation +// +// /* +// ** Return the sqlite3* database handle to which the prepared statement given +// ** in the argument belongs. This is the same database handle that was +// ** the first argument to the sqlite3_prepare() that was used to create +// ** the statement in the first place. +// */ +func Xsqlite3_db_handle(tls *libc.TLS, pStmt uintptr) (r uintptr) { + var v1 uintptr + _ = v1 + if pStmt != 0 { + v1 = (*TVdbe)(unsafe.Pointer(pStmt)).Fdb + } else { + v1 = uintptr(0) + } + return v1 +} + +// C documentation +// +// /* +// ** Return true if the prepared statement is guaranteed to not modify the +// ** database. +// */ +func Xsqlite3_stmt_readonly(tls *libc.TLS, pStmt uintptr) (r int32) { + var v1 int32 + _ = v1 + if pStmt != 0 { + v1 = int32(Tbft(*(*uint16)(unsafe.Pointer(pStmt + 200)) & 0x40 >> 6)) + } else { + v1 = int32(1) + } + return v1 +} + +// C documentation +// +// /* +// ** Return 1 if the statement is an EXPLAIN and return 2 if the +// ** statement is an EXPLAIN QUERY PLAN +// */ +func Xsqlite3_stmt_isexplain(tls *libc.TLS, pStmt uintptr) (r int32) { + var v1 int32 + _ = v1 + if pStmt != 0 { + v1 = int32(Tbft(*(*uint16)(unsafe.Pointer(pStmt + 200)) & 0xc >> 2)) + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Set the explain mode for a statement. +// */ +func Xsqlite3_stmt_explain(tls *libc.TLS, pStmt uintptr, eMode int32) (r int32) { + var rc int32 + var v uintptr + _, _ = rc, v + v = pStmt + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).Fdb)).Fmutex) + if int32(Tbft(*(*uint16)(unsafe.Pointer(v + 200))&0xc>>2)) == eMode { + rc = SQLITE_OK + } else { + if eMode < 0 || eMode > int32(2) { + rc = int32(SQLITE_ERROR) + } else { + if int32((*TVdbe)(unsafe.Pointer(v)).FprepFlags)&int32(SQLITE_PREPARE_SAVESQL) == 0 { + rc = int32(SQLITE_ERROR) + } else { + if int32((*TVdbe)(unsafe.Pointer(v)).FeVdbeState) != int32(VDBE_READY_STATE) { + rc = int32(SQLITE_BUSY) + } else { + if (*TVdbe)(unsafe.Pointer(v)).FnMem >= int32(10) && (eMode != int32(2) || int32(Tbft(*(*uint16)(unsafe.Pointer(v + 200))&0x100>>8)) != 0) { + /* No reprepare necessary */ + libc.SetBitFieldPtr16Uint32(v+200, uint32(eMode), 2, 0xc) + rc = SQLITE_OK + } else { + libc.SetBitFieldPtr16Uint32(v+200, uint32(eMode), 2, 0xc) + rc = _sqlite3Reprepare(tls, v) + libc.SetBitFieldPtr16Uint32(v+200, libc.BoolUint32(eMode == libc.Int32FromInt32(2)), 8, 0x100) + } + } + } + } + } + if int32(Tbft(*(*uint16)(unsafe.Pointer(v + 200))&0xc>>2)) != 0 { + (*TVdbe)(unsafe.Pointer(v)).FnResColumn = uint16(int32(12) - int32(4)*int32(Tbft(*(*uint16)(unsafe.Pointer(v + 200))&0xc>>2))) + } else { + (*TVdbe)(unsafe.Pointer(v)).FnResColumn = (*TVdbe)(unsafe.Pointer(v)).FnResAlloc + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).Fdb)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Return true if the prepared statement is in need of being reset. +// */ +func Xsqlite3_stmt_busy(tls *libc.TLS, pStmt uintptr) (r int32) { + var v uintptr + _ = v + v = pStmt + return libc.BoolInt32(v != uintptr(0) && int32((*TVdbe)(unsafe.Pointer(v)).FeVdbeState) == int32(VDBE_RUN_STATE)) +} + +// C documentation +// +// /* +// ** Return a pointer to the next prepared statement after pStmt associated +// ** with database connection pDb. If pStmt is NULL, return the first +// ** prepared statement for the database connection. Return NULL if there +// ** are no more. +// */ +func Xsqlite3_next_stmt(tls *libc.TLS, pDb uintptr, pStmt uintptr) (r uintptr) { + var pNext uintptr + _ = pNext + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pDb)).Fmutex) + if pStmt == uintptr(0) { + pNext = (*Tsqlite3)(unsafe.Pointer(pDb)).FpVdbe + } else { + pNext = (*TVdbe)(unsafe.Pointer(pStmt)).FpVNext + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(pDb)).Fmutex) + return pNext +} + +// C documentation +// +// /* +// ** Return the value of a status counter for a prepared statement +// */ +func Xsqlite3_stmt_status(tls *libc.TLS, pStmt uintptr, op int32, resetFlag int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pVdbe uintptr + var _ /* v at bp+0 */ Tu32 + _, _ = db, pVdbe + pVdbe = pStmt + if op == int32(SQLITE_STMTSTATUS_MEMUSED) { + db = (*TVdbe)(unsafe.Pointer(pVdbe)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart + _sqlite3VdbeDelete(tls, pVdbe) + (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + } else { + *(*Tu32)(unsafe.Pointer(bp)) = *(*Tu32)(unsafe.Pointer(pVdbe + 212 + uintptr(op)*4)) + if resetFlag != 0 { + *(*Tu32)(unsafe.Pointer(pVdbe + 212 + uintptr(op)*4)) = uint32(0) + } + } + return int32(*(*Tu32)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Return the SQL associated with a prepared statement +// */ +func Xsqlite3_sql(tls *libc.TLS, pStmt uintptr) (r uintptr) { + var p, v1 uintptr + _, _ = p, v1 + p = pStmt + if p != 0 { + v1 = (*TVdbe)(unsafe.Pointer(p)).FzSql + } else { + v1 = uintptr(0) + } + return v1 +} + +// C documentation +// +// /* +// ** Return the SQL associated with a prepared statement with +// ** bound parameters expanded. Space to hold the returned string is +// ** obtained from sqlite3_malloc(). The caller is responsible for +// ** freeing the returned string by passing it to sqlite3_free(). +// ** +// ** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of +// ** expanded bound parameters. +// */ +func Xsqlite3_expanded_sql(tls *libc.TLS, pStmt uintptr) (r uintptr) { + var p, z, zSql uintptr + _, _, _ = p, z, zSql + z = uintptr(0) + zSql = Xsqlite3_sql(tls, pStmt) + if zSql != 0 { + p = pStmt + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + z = _sqlite3VdbeExpandSql(tls, p, zSql) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return z +} + +// C documentation +// +// /* +// ** Allocate and populate an UnpackedRecord structure based on the serialized +// ** record in nKey/pKey. Return a pointer to the new UnpackedRecord structure +// ** if successful, or a NULL pointer if an OOM error is encountered. +// */ +func _vdbeUnpackRecord(tls *libc.TLS, pKeyInfo uintptr, nKey int32, pKey uintptr) (r uintptr) { + var pRet uintptr + _ = pRet /* Return value */ + pRet = _sqlite3VdbeAllocUnpackedRecord(tls, pKeyInfo) + if pRet != 0 { + libc.Xmemset(tls, (*TUnpackedRecord)(unsafe.Pointer(pRet)).FaMem, 0, uint64(56)*uint64(int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField)+libc.Int32FromInt32(1))) + _sqlite3VdbeRecordUnpack(tls, pKeyInfo, nKey, pKey, pRet) + } + return pRet +} + +// C documentation +// +// /* +// ** This function is called from within a pre-update callback to retrieve +// ** a field of the row currently being updated or deleted. +// */ +func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintptr) (r int32) { + var aRec, p, pMem, v1 uintptr + var nRec Tu32 + var rc int32 + _, _, _, _, _, _ = aRec, nRec, p, pMem, rc, v1 + rc = SQLITE_OK + p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate + /* Test that this call is being made from within an SQLITE_DELETE or + ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ + if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { + rc = _sqlite3MisuseError(tls, int32(92098)) + goto preupdate_old_out + } + if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 { + iIdx = int32(_sqlite3TableColumnToIndex(tls, (*TPreUpdate)(unsafe.Pointer(p)).FpPk, int16(iIdx))) + } + if iIdx >= int32((*TVdbeCursor)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField) || iIdx < 0 { + rc = int32(SQLITE_RANGE) + goto preupdate_old_out + } + /* If the old.* record has not yet been loaded into memory, do so now. */ + if (*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked == uintptr(0) { + nRec = _sqlite3BtreePayloadSize(tls, *(*uintptr)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr + 48))) + aRec = _sqlite3DbMallocRaw(tls, db, uint64(nRec)) + if !(aRec != 0) { + goto preupdate_old_out + } + rc = _sqlite3BtreePayload(tls, *(*uintptr)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr + 48)), uint32(0), nRec, aRec) + if rc == SQLITE_OK { + (*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked = _vdbeUnpackRecord(tls, p+32, int32(nRec), aRec) + if !((*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked != 0) { + rc = int32(SQLITE_NOMEM) + } + } + if rc != SQLITE_OK { + _sqlite3DbFree(tls, db, aRec) + goto preupdate_old_out + } + (*TPreUpdate)(unsafe.Pointer(p)).FaRecord = aRec + } + v1 = (*TUnpackedRecord)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked)).FaMem + uintptr(iIdx)*56 + *(*uintptr)(unsafe.Pointer(ppValue)) = v1 + pMem = v1 + if iIdx == int32((*TTable)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey) { + _sqlite3VdbeMemSetInt64(tls, pMem, (*TPreUpdate)(unsafe.Pointer(p)).FiKey1) + } else { + if iIdx >= int32((*TUnpackedRecord)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpUnpacked)).FnField) { + *(*uintptr)(unsafe.Pointer(ppValue)) = _columnNullValue(tls) + } else { + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpTab)).FaCol + uintptr(iIdx)*16))).Faffinity) == int32(SQLITE_AFF_REAL) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemRealify(tls, pMem) + } + } + } + } +preupdate_old_out: + ; + _sqlite3Error(tls, db, rc) + return _sqlite3ApiExit(tls, db, rc) +} + +// C documentation +// +// /* +// ** This function is called from within a pre-update callback to retrieve +// ** the number of columns in the row being updated, deleted or inserted. +// */ +func Xsqlite3_preupdate_count(tls *libc.TLS, db uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate + if p != 0 { + v1 = int32((*TPreUpdate)(unsafe.Pointer(p)).Fkeyinfo.FnKeyField) + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** This function is designed to be called from within a pre-update callback +// ** only. It returns zero if the change that caused the callback was made +// ** immediately by a user SQL statement. Or, if the change was made by a +// ** trigger program, it returns the number of trigger programs currently +// ** on the stack (1 for a top-level trigger, 2 for a trigger fired by a +// ** top-level trigger etc.). +// ** +// ** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL +// ** or SET DEFAULT action is considered a trigger. +// */ +func Xsqlite3_preupdate_depth(tls *libc.TLS, db uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate + if p != 0 { + v1 = (*TVdbe)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).Fv)).FnFrame + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** This function is designed to be called from within a pre-update callback +// ** only. +// */ +func Xsqlite3_preupdate_blobwrite(tls *libc.TLS, db uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate + if p != 0 { + v1 = (*TPreUpdate)(unsafe.Pointer(p)).FiBlobWrite + } else { + v1 = -int32(1) + } + return v1 +} + +// C documentation +// +// /* +// ** This function is called from within a pre-update callback to retrieve +// ** a field of the row currently being updated or inserted. +// */ +func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintptr) (r int32) { + var p, pData, pMem, pUnpack uintptr + var rc, v1 int32 + _, _, _, _, _, _ = p, pData, pMem, pUnpack, rc, v1 + rc = SQLITE_OK + p = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdate + if !(p != 0) || (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { + rc = _sqlite3MisuseError(tls, int32(92221)) + goto preupdate_new_out + } + if (*TPreUpdate)(unsafe.Pointer(p)).FpPk != 0 && (*TPreUpdate)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) { + iIdx = int32(_sqlite3TableColumnToIndex(tls, (*TPreUpdate)(unsafe.Pointer(p)).FpPk, int16(iIdx))) + } + if iIdx >= int32((*TVdbeCursor)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField) || iIdx < 0 { + rc = int32(SQLITE_RANGE) + goto preupdate_new_out + } + if (*TPreUpdate)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { + /* For an INSERT, memory cell p->iNewReg contains the serialized record + ** that is being inserted. Deserialize it. */ + pUnpack = (*TPreUpdate)(unsafe.Pointer(p)).FpNewUnpacked + if !(pUnpack != 0) { + pData = (*TVdbe)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).Fv)).FaMem + uintptr((*TPreUpdate)(unsafe.Pointer(p)).FiNewReg)*56 + if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { + v1 = _sqlite3VdbeMemExpandBlob(tls, pData) + } else { + v1 = 0 + } + rc = v1 + if rc != SQLITE_OK { + goto preupdate_new_out + } + pUnpack = _vdbeUnpackRecord(tls, p+32, (*TMem)(unsafe.Pointer(pData)).Fn, (*TMem)(unsafe.Pointer(pData)).Fz) + if !(pUnpack != 0) { + rc = int32(SQLITE_NOMEM) + goto preupdate_new_out + } + (*TPreUpdate)(unsafe.Pointer(p)).FpNewUnpacked = pUnpack + } + pMem = (*TUnpackedRecord)(unsafe.Pointer(pUnpack)).FaMem + uintptr(iIdx)*56 + if iIdx == int32((*TTable)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey) { + _sqlite3VdbeMemSetInt64(tls, pMem, (*TPreUpdate)(unsafe.Pointer(p)).FiKey2) + } else { + if iIdx >= int32((*TUnpackedRecord)(unsafe.Pointer(pUnpack)).FnField) { + pMem = _columnNullValue(tls) + } + } + } else { + /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required + ** value. Make a copy of the cell contents and return a pointer to it. + ** It is not safe to return a pointer to the memory cell itself as the + ** caller may modify the value text encoding. + */ + if !((*TPreUpdate)(unsafe.Pointer(p)).FaNew != 0) { + (*TPreUpdate)(unsafe.Pointer(p)).FaNew = _sqlite3DbMallocZero(tls, db, uint64(56)*uint64((*TVdbeCursor)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField)) + if !((*TPreUpdate)(unsafe.Pointer(p)).FaNew != 0) { + rc = int32(SQLITE_NOMEM) + goto preupdate_new_out + } + } + pMem = (*TPreUpdate)(unsafe.Pointer(p)).FaNew + uintptr(iIdx)*56 + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags) == 0 { + if iIdx == int32((*TTable)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey) { + _sqlite3VdbeMemSetInt64(tls, pMem, (*TPreUpdate)(unsafe.Pointer(p)).FiKey2) + } else { + rc = _sqlite3VdbeMemCopy(tls, pMem, (*TVdbe)(unsafe.Pointer((*TPreUpdate)(unsafe.Pointer(p)).Fv)).FaMem+uintptr((*TPreUpdate)(unsafe.Pointer(p)).FiNewReg+int32(1)+iIdx)*56) + if rc != SQLITE_OK { + goto preupdate_new_out + } + } + } + } + *(*uintptr)(unsafe.Pointer(ppValue)) = pMem +preupdate_new_out: + ; + _sqlite3Error(tls, db, rc) + return _sqlite3ApiExit(tls, db, rc) +} + +/************** End of vdbeapi.c *********************************************/ +/************** Begin file vdbetrace.c ***************************************/ +/* +** 2009 November 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code used to insert the values of host parameters +** (aka "wildcards") into the SQL text output by sqlite3_trace(). +** +** The Vdbe parse-tree explainer is also found here. + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ + +// C documentation +// +// /* +// ** zSql is a zero-terminated string of UTF-8 SQL text. Return the number of +// ** bytes in this text up to but excluding the first character in +// ** a host parameter. If the text contains no host parameters, return +// ** the total number of bytes in the text. +// */ +func _findNextHostParameter(tls *libc.TLS, zSql uintptr, pnToken uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var n, nTotal int32 + var _ /* tokenType at bp+0 */ int32 + _, _ = n, nTotal + nTotal = 0 + *(*int32)(unsafe.Pointer(pnToken)) = 0 + for *(*int8)(unsafe.Pointer(zSql)) != 0 { + n = _sqlite3GetToken(tls, zSql, bp) + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_VARIABLE) { + *(*int32)(unsafe.Pointer(pnToken)) = n + break + } + nTotal += n + zSql += uintptr(n) + } + return nTotal +} + +// C documentation +// +// /* +// ** This function returns a pointer to a nul-terminated string in memory +// ** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the +// ** string contains a copy of zRawSql but with host parameters expanded to +// ** their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, +// ** then the returned string holds a copy of zRawSql with "-- " prepended +// ** to each line of text. +// ** +// ** If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then +// ** then long strings and blobs are truncated to that many bytes. This +// ** can be used to prevent unreasonably large trace strings when dealing +// ** with large (multi-megabyte) strings and blobs. +// ** +// ** The calling function is responsible for making sure the memory returned +// ** is eventually freed. +// ** +// ** ALGORITHM: Scan the input string looking for host parameters in any of +// ** these forms: ?, ?N, $A, @A, :A. Take care to avoid text within +// ** string literals, quoted identifier names, and comments. For text forms, +// ** the host parameter index is found by scanning the prepared +// ** statement for the corresponding OP_Variable opcode. Once the host +// ** parameter index is known, locate the value in p->aVar[]. Then render +// ** the value as a literal in place of the host parameter name. +// */ +func _sqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) (r uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var db, pVar, zStart, v1 uintptr + var enc Tu8 + var i, n, nOut, nOut1, nextIndex, v2 int32 + var _ /* idx at bp+0 */ int32 + var _ /* nToken at bp+4 */ int32 + var _ /* out at bp+8 */ TStrAccum + var _ /* utf8 at bp+40 */ TMem + _, _, _, _, _, _, _, _, _, _, _ = db, enc, i, n, nOut, nOut1, nextIndex, pVar, zStart, v1, v2 /* The database connection */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* Index of a host parameter */ + nextIndex = int32(1) /* Used to convert UTF16 into UTF8 for display */ + db = (*TVdbe)(unsafe.Pointer(p)).Fdb + _sqlite3StrAccumInit(tls, bp+8, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(db + 136))) + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec > int32(1) { + for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { + zStart = zRawSql + for { + v1 = zRawSql + zRawSql++ + if !(int32(*(*int8)(unsafe.Pointer(v1))) != int32('\n') && *(*int8)(unsafe.Pointer(zRawSql)) != 0) { + break + } + } + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5578, int32(3)) + Xsqlite3_str_append(tls, bp+8, zStart, int32(int64(zRawSql)-int64(zStart))) + } + } else { + if int32((*TVdbe)(unsafe.Pointer(p)).FnVar) == 0 { + Xsqlite3_str_append(tls, bp+8, zRawSql, _sqlite3Strlen30(tls, zRawSql)) + } else { + for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { + n = _findNextHostParameter(tls, zRawSql, bp+4) + Xsqlite3_str_append(tls, bp+8, zRawSql, n) + zRawSql += uintptr(n) + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + break + } + if int32(*(*int8)(unsafe.Pointer(zRawSql))) == int32('?') { + if *(*int32)(unsafe.Pointer(bp + 4)) > int32(1) { + _sqlite3GetInt32(tls, zRawSql+1, bp) + } else { + *(*int32)(unsafe.Pointer(bp)) = nextIndex + } + } else { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3VdbeParameterIndex(tls, p, zRawSql, *(*int32)(unsafe.Pointer(bp + 4))) + } + zRawSql += uintptr(*(*int32)(unsafe.Pointer(bp + 4))) + if *(*int32)(unsafe.Pointer(bp))+int32(1) > nextIndex { + v2 = *(*int32)(unsafe.Pointer(bp)) + int32(1) + } else { + v2 = nextIndex + } + nextIndex = v2 + pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr(*(*int32)(unsafe.Pointer(bp))-int32(1))*56 + if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Null) != 0 { + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+1681, int32(4)) + } else { + if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+1436, libc.VaList(bp+104, *(*Ti64)(unsafe.Pointer(pVar)))) + } else { + if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Real) != 0 { + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5099, libc.VaList(bp+104, *(*float64)(unsafe.Pointer(pVar)))) + } else { + if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Str) != 0 { /* Number of bytes of the string text to include in output */ + enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + if int32(enc) != int32(SQLITE_UTF8) { + libc.Xmemset(tls, bp+40, 0, uint64(56)) + (*(*TMem)(unsafe.Pointer(bp + 40))).Fdb = db + _sqlite3VdbeMemSetStr(tls, bp+40, (*TMem)(unsafe.Pointer(pVar)).Fz, int64((*TMem)(unsafe.Pointer(pVar)).Fn), enc, libc.UintptrFromInt32(0)) + if int32(SQLITE_NOMEM) == _sqlite3VdbeChangeEncoding(tls, bp+40, int32(SQLITE_UTF8)) { + (*(*TStrAccum)(unsafe.Pointer(bp + 8))).FaccError = uint8(SQLITE_NOMEM) + (*(*TStrAccum)(unsafe.Pointer(bp + 8))).FnAlloc = uint32(0) + } + pVar = bp + 40 + } + nOut = (*TMem)(unsafe.Pointer(pVar)).Fn + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5582, libc.VaList(bp+104, nOut, (*TMem)(unsafe.Pointer(pVar)).Fz)) + if int32(enc) != int32(SQLITE_UTF8) { + _sqlite3VdbeMemRelease(tls, bp+40) + } + } else { + if int32((*TMem)(unsafe.Pointer(pVar)).Fflags)&int32(MEM_Zero) != 0 { + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5589, libc.VaList(bp+104, *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pVar)).Fu)))) + } else { /* Number of bytes of the blob to include in output */ + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5602, int32(2)) + nOut1 = (*TMem)(unsafe.Pointer(pVar)).Fn + i = 0 + for { + if !(i < nOut1) { + break + } + Xsqlite3_str_appendf(tls, bp+8, __ccgo_ts+5605, libc.VaList(bp+104, int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&int32(0xff))) + goto _3 + _3: + ; + i++ + } + Xsqlite3_str_append(tls, bp+8, __ccgo_ts+5610, int32(1)) + } + } + } + } + } + } + } + } + if (*(*TStrAccum)(unsafe.Pointer(bp + 8))).FaccError != 0 { + Xsqlite3_str_reset(tls, bp+8) + } + return _sqlite3StrAccumFinish(tls, bp+8) +} + +/************** End of vdbetrace.c *******************************************/ +/************** Begin file vdbe.c ********************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** The code in this file implements the function that runs the +** bytecode of a prepared statement. +** +** Various scripts scan this source file in order to generate HTML +** documentation, headers files, or other derived files. The formatting +** of the code in this file is, therefore, important. See other comments +** in this file for details. If in doubt, do not deviate from existing +** commenting and indentation practices when changing or adding code. + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ + +/* +** Invoke this macro on memory cells just prior to changing the +** value of the cell. This macro verifies that shallow copies are +** not misused. A shallow copy of a string or blob just copies a +** pointer to the string or blob, not the content. If the original +** is changed while the copy is still in use, the string or blob might +** be changed out from under the copy. This macro verifies that nothing +** like that ever happens. + */ + +/* +** The following global variable is incremented every time a cursor +** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test +** procedures use this information to make sure that indices are +** working correctly. This variable has no function other than to +** help verify the correct operation of the library. + */ + +/* +** When this global variable is positive, it gets decremented once before +** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted +** field of the sqlite3 structure is set in order to simulate an interrupt. +** +** This facility is used for testing purposes only. It does not function +** in an ordinary build. + */ + +/* +** The next global variable is incremented each type the OP_Sort opcode +** is executed. The test procedures use this information to make sure that +** sorting is occurring or not occurring at appropriate times. This variable +** has no function other than to help verify the correct operation of the +** library. + */ + +/* +** The next global variable records the size of the largest MEM_Blob +** or MEM_Str that has been used by a VDBE opcode. The test procedures +** use this information to make sure that the zero-blob functionality +** is working correctly. This variable has no function other than to +** help verify the correct operation of the library. + */ + +/* +** This macro evaluates to true if either the update hook or the preupdate +** hook are enabled for database connect DB. + */ + +/* +** The next global variable is incremented each time the OP_Found opcode +** is executed. This is used to test whether or not the foreign key +** operation implemented using OP_FkIsZero is working. This variable +** has no function other than to help verify the correct operation of the +** library. + */ + +/* +** Test a register to see if it exceeds the current maximum blob size. +** If it does, record the new maximum blob size. + */ + +/* +** Invoke the VDBE coverage callback, if that callback is defined. This +** feature is used for test suite validation only and does not appear an +** production builds. +** +** M is the type of branch. I is the direction taken for this instance of +** the branch. +** +** M: 2 - two-way branch (I=0: fall-thru 1: jump ) +** 3 - two-way + NULL (I=0: fall-thru 1: jump 2: NULL ) +** 4 - OP_Jump (I=0: jump p1 1: jump p2 2: jump p3) +** +** In other words, if M is 2, then I is either 0 (for fall-through) or +** 1 (for when the branch is taken). If M is 3, the I is 0 for an +** ordinary fall-through, I is 1 if the branch was taken, and I is 2 +** if the result of comparison is NULL. For M=3, I=2 the jump may or +** may not be taken, depending on the SQLITE_JUMPIFNULL flags in p5. +** When M is 4, that means that an OP_Jump is being run. I is 0, 1, or 2 +** depending on if the operands are less than, equal, or greater than. +** +** iSrcLine is the source code line (from the __LINE__ macro) that +** generated the VDBE instruction combined with flag bits. The source +** code line number is in the lower 24 bits of iSrcLine and the upper +** 8 bytes are flags. The lower three bits of the flags indicate +** values for I that should never occur. For example, if the branch is +** always taken, the flags should be 0x05 since the fall-through and +** alternate branch are never taken. If a branch is never taken then +** flags should be 0x06 since only the fall-through approach is allowed. +** +** Bit 0x08 of the flags indicates an OP_Jump opcode that is only +** interested in equal or not-equal. In other words, I==0 and I==2 +** should be treated as equivalent +** +** Since only a line number is retained, not the filename, this macro +** only works for amalgamation builds. But that is ok, since these macros +** should be no-ops except for special builds used to measure test coverage. + */ + +/* +** An ephemeral string value (signified by the MEM_Ephem flag) contains +** a pointer to a dynamically allocated string where some other entity +** is responsible for deallocating that string. Because the register +** does not control the string, it might be deleted without the register +** knowing it. +** +** This routine converts an ephemeral string into a dynamically allocated +** string that the register itself controls. In other words, it +** converts an MEM_Ephem string into a string with P.z==P.zMalloc. + */ + +/* Return true if the cursor was opened using the OP_OpenSorter opcode. */ + +// C documentation +// +// /* +// ** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL +// ** if we run out of memory. +// */ +func _allocateCursor(tls *libc.TLS, p uintptr, iCur int32, nField int32, eCurType Tu8) (r uintptr) { + var nByte, v2 int32 + var pCx, pMem, v1, v3, v4 uintptr + _, _, _, _, _, _, _ = nByte, pCx, pMem, v1, v2, v3, v4 + if iCur > 0 { + v1 = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem-iCur)*56 + } else { + v1 = (*TVdbe)(unsafe.Pointer(p)).FaMem + } + /* Find the memory cell that will be used to store the blob of memory + ** required for this VdbeCursor structure. It is convenient to use a + ** vdbe memory cell to manage the memory allocation required for a + ** VdbeCursor structure for the following reasons: + ** + ** * Sometimes cursor numbers are used for a couple of different + ** purposes in a vdbe program. The different uses might require + ** different sized allocations. Memory cells provide growable + ** allocations. + ** + ** * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can + ** be freed lazily via the sqlite3_release_memory() API. This + ** minimizes the number of malloc calls made by the system. + ** + ** The memory cell for cursor 0 is aMem[0]. The rest are allocated from + ** the top of the register space. Cursor 1 is at Mem[p->nMem-1]. + ** Cursor 2 is at Mem[p->nMem-2]. And so forth. + */ + pMem = v1 + pCx = uintptr(0) + if int32(eCurType) == CURTYPE_BTREE { + v2 = _sqlite3BtreeCursorSize(tls) + } else { + v2 = 0 + } + nByte = int32(libc.Uint64FromInt64(128) + libc.Uint64FromInt32(2)*libc.Uint64FromInt64(4)*uint64(nField) + uint64(v2)) + if *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) != 0 { /*OPTIMIZATION-IF-FALSE*/ + _sqlite3VdbeFreeCursorNN(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8))) + *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) = uintptr(0) + } + /* There used to be a call to sqlite3VdbeMemClearAndResize() to make sure + ** the pMem used to hold space for the cursor has enough storage available + ** in pMem->zMalloc. But for the special case of the aMem[] entries used + ** to hold cursors, it is faster to in-line the logic. */ + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc < nByte { + if (*TMem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + _sqlite3DbFreeNN(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).FzMalloc) + } + v3 = _sqlite3DbMallocRaw(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, uint64(nByte)) + (*TMem)(unsafe.Pointer(pMem)).FzMalloc = v3 + (*TMem)(unsafe.Pointer(pMem)).Fz = v3 + if (*TMem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = 0 + return uintptr(0) + } + (*TMem)(unsafe.Pointer(pMem)).FszMalloc = nByte + } + v4 = (*TMem)(unsafe.Pointer(pMem)).FzMalloc + pCx = v4 + *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) = v4 + libc.Xmemset(tls, pCx, 0, uint64(libc.UintptrFromInt32(0)+40)) + (*TVdbeCursor)(unsafe.Pointer(pCx)).FeCurType = eCurType + (*TVdbeCursor)(unsafe.Pointer(pCx)).FnField = int16(nField) + (*TVdbeCursor)(unsafe.Pointer(pCx)).FaOffset = pCx + 120 + uintptr(nField)*4 + if int32(eCurType) == CURTYPE_BTREE { + *(*uintptr)(unsafe.Pointer(pCx + 48)) = (*TMem)(unsafe.Pointer(pMem)).Fz + uintptr(libc.Uint64FromInt64(128)+libc.Uint64FromInt32(2)*libc.Uint64FromInt64(4)*uint64(nField)) + _sqlite3BtreeCursorZero(tls, *(*uintptr)(unsafe.Pointer(pCx + 48))) + } + return pCx +} + +// C documentation +// +// /* +// ** The string in pRec is known to look like an integer and to have a +// ** floating point value of rValue. Return true and set *piValue to the +// ** integer value if the string is in range to be an integer. Otherwise, +// ** return false. +// */ +func _alsoAnInt(tls *libc.TLS, pRec uintptr, rValue float64, piValue uintptr) (r int32) { + var iValue Ti64 + _ = iValue + iValue = _sqlite3RealToI64(tls, rValue) + if _sqlite3RealSameAsInt(tls, rValue, iValue) != 0 { + *(*Ti64)(unsafe.Pointer(piValue)) = iValue + return int32(1) + } + return libc.BoolInt32(0 == _sqlite3Atoi64(tls, (*TMem)(unsafe.Pointer(pRec)).Fz, piValue, (*TMem)(unsafe.Pointer(pRec)).Fn, (*TMem)(unsafe.Pointer(pRec)).Fenc)) +} + +// C documentation +// +// /* +// ** Try to convert a value into a numeric representation if we can +// ** do so without loss of information. In other words, if the string +// ** looks like a number, convert it into a number. If it does not +// ** look like a number, leave it alone. +// ** +// ** If the bTryForInt flag is true, then extra effort is made to give +// ** an integer representation. Strings that look like floating point +// ** values but which have no fractional component (example: '48.00') +// ** will have a MEM_Int representation when bTryForInt is true. +// ** +// ** If bTryForInt is false, then if the input string contains a decimal +// ** point or exponential notation, the result is only MEM_Real, even +// ** if there is an exact integer representation of the quantity. +// */ +func _applyNumericAffinity(tls *libc.TLS, pRec uintptr, bTryForInt int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var enc Tu8 + var rc int32 + var p1, p2, p3 uintptr + var _ /* rValue at bp+0 */ float64 + _, _, _, _, _ = enc, rc, p1, p2, p3 + enc = (*TMem)(unsafe.Pointer(pRec)).Fenc + rc = _sqlite3AtoF(tls, (*TMem)(unsafe.Pointer(pRec)).Fz, bp, (*TMem)(unsafe.Pointer(pRec)).Fn, enc) + if rc <= 0 { + return + } + if rc == int32(1) && _alsoAnInt(tls, pRec, *(*float64)(unsafe.Pointer(bp)), pRec) != 0 { + p1 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pRec)) = *(*float64)(unsafe.Pointer(bp)) + p2 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Real)) + if bTryForInt != 0 { + _sqlite3VdbeIntegerAffinity(tls, pRec) + } + } + /* TEXT->NUMERIC is many->one. Hence, it is important to invalidate the + ** string representation after computing a numeric equivalent, because the + ** string representation might not be the canonical representation for the + ** numeric value. Ticket [343634942dd54ab57b7024] 2018-01-31. */ + p3 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(MEM_Str)) +} + +// C documentation +// +// /* +// ** Processing is determine by the affinity parameter: +// ** +// ** SQLITE_AFF_INTEGER: +// ** SQLITE_AFF_REAL: +// ** SQLITE_AFF_NUMERIC: +// ** Try to convert pRec to an integer representation or a +// ** floating-point representation if an integer representation +// ** is not possible. Note that the integer representation is +// ** always preferred, even if the affinity is REAL, because +// ** an integer representation is more space efficient on disk. +// ** +// ** SQLITE_AFF_FLEXNUM: +// ** If the value is text, then try to convert it into a number of +// ** some kind (integer or real) but do not make any other changes. +// ** +// ** SQLITE_AFF_TEXT: +// ** Convert pRec to a text representation. +// ** +// ** SQLITE_AFF_BLOB: +// ** SQLITE_AFF_NONE: +// ** No-op. pRec is unchanged. +// */ +func _applyAffinity(tls *libc.TLS, pRec uintptr, affinity int8, enc Tu8) { + var p1 uintptr + _ = p1 + if int32(affinity) >= int32(SQLITE_AFF_NUMERIC) { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) == 0 { /*OPTIMIZATION-IF-FALSE*/ + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Str) != 0 { + _applyNumericAffinity(tls, pRec, int32(1)) + } + } else { + if int32(affinity) <= int32(SQLITE_AFF_REAL) { + _sqlite3VdbeIntegerAffinity(tls, pRec) + } + } + } + } else { + if int32(affinity) == int32(SQLITE_AFF_TEXT) { + /* Only attempt the conversion to TEXT if there is an integer or real + ** representation (blob and NULL do not get converted) but no string + ** representation. It would be harmless to repeat the conversion if + ** there is already a string rep, but it is pointless to waste those + ** CPU cycles. */ + if 0 == int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Str) { /*OPTIMIZATION-IF-FALSE*/ + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pRec, enc, uint8(1)) + } + } + p1 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^(libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_IntReal))) + } + } +} + +// C documentation +// +// /* +// ** Try to convert the type of a function argument or a result column +// ** into a numeric representation. Use either INTEGER or REAL whichever +// ** is appropriate. But only do the conversion if it is possible without +// ** loss of information and return the revised type of the argument. +// */ +func Xsqlite3_value_numeric_type(tls *libc.TLS, pVal uintptr) (r int32) { + var eType int32 + var pMem uintptr + _, _ = eType, pMem + eType = Xsqlite3_value_type(tls, pVal) + if eType == int32(SQLITE_TEXT) { + pMem = pVal + _applyNumericAffinity(tls, pMem, 0) + eType = Xsqlite3_value_type(tls, pVal) + } + return eType +} + +// C documentation +// +// /* +// ** Exported version of applyAffinity(). This one works on sqlite3_value*, +// ** not the internal Mem* type. +// */ +func _sqlite3ValueApplyAffinity(tls *libc.TLS, pVal uintptr, affinity Tu8, enc Tu8) { + _applyAffinity(tls, pVal, int8(affinity), enc) +} + +// C documentation +// +// /* +// ** pMem currently only holds a string type (or maybe a BLOB that we can +// ** interpret as a string if we want to). Compute its corresponding +// ** numeric type, if has one. Set the pMem->u.r and pMem->u.i fields +// ** accordingly. +// */ +func _computeNumericType(tls *libc.TLS, pMem uintptr) (r Tu16) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc, v1 int32 + var _ /* ix at bp+0 */ Tsqlite3_int64 + _, _ = rc, v1 + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&int32(MEM_Zero) != 0 { + v1 = _sqlite3VdbeMemExpandBlob(tls, pMem) + } else { + v1 = 0 + } + if v1 != 0 { + *(*Ti64)(unsafe.Pointer(pMem)) = 0 + return uint16(MEM_Int) + } + rc = _sqlite3AtoF(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, pMem, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) + if rc <= 0 { + if rc == 0 && _sqlite3Atoi64(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, bp, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) <= int32(1) { + *(*Ti64)(unsafe.Pointer(pMem)) = *(*Tsqlite3_int64)(unsafe.Pointer(bp)) + return uint16(MEM_Int) + } else { + return uint16(MEM_Real) + } + } else { + if rc == int32(1) && _sqlite3Atoi64(tls, (*TMem)(unsafe.Pointer(pMem)).Fz, bp, (*TMem)(unsafe.Pointer(pMem)).Fn, (*TMem)(unsafe.Pointer(pMem)).Fenc) == 0 { + *(*Ti64)(unsafe.Pointer(pMem)) = *(*Tsqlite3_int64)(unsafe.Pointer(bp)) + return uint16(MEM_Int) + } + } + return uint16(MEM_Real) +} + +// C documentation +// +// /* +// ** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or +// ** none. +// ** +// ** Unlike applyNumericAffinity(), this routine does not modify pMem->flags. +// ** But it does set pMem->u.r and pMem->u.i appropriately. +// */ +func _numericType(tls *libc.TLS, pMem uintptr) (r Tu16) { + if int32((*TMem)(unsafe.Pointer(pMem)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Null)) != 0 { + return uint16(int32((*TMem)(unsafe.Pointer(pMem)).Fflags) & (libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal) | libc.Int32FromInt32(MEM_Null))) + } + return _computeNumericType(tls, pMem) + return uint16(0) +} + +// C documentation +// +// /* +// ** Return the register of pOp->p2 after first preparing it to be +// ** overwritten with an integer value. +// */ +func _out2PrereleaseWithClear(tls *libc.TLS, pOut uintptr) (r uintptr) { + _sqlite3VdbeMemSetNull(tls, pOut) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) + return pOut +} + +func _out2Prerelease(tls *libc.TLS, p uintptr, pOp uintptr) (r uintptr) { + var pOut uintptr + _ = pOut + pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TVdbeOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { /*OPTIMIZATION-IF-FALSE*/ + return _out2PrereleaseWithClear(tls, pOut) + } else { + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) + return pOut + } + return r +} + +// C documentation +// +// /* +// ** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning +// ** with pOp->p3. Return the hash. +// */ +func _filterHash(tls *libc.TLS, aMem uintptr, pOp uintptr) (r Tu64) { + var h Tu64 + var i, mx int32 + var p uintptr + _, _, _, _ = h, i, mx, p + h = uint64(0) + i = (*TOp)(unsafe.Pointer(pOp)).Fp3 + mx = i + (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi + for { + if !(i < mx) { + break + } + p = aMem + uintptr(i)*56 + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + h += uint64(*(*Ti64)(unsafe.Pointer(p))) + } else { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&int32(MEM_Real) != 0 { + h += uint64(_sqlite3VdbeIntValue(tls, p)) + } else { + if int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) != 0 { + /* All strings have the same hash and all blobs have the same hash, + ** though, at least, those hashes are different from each other and + ** from NULL. */ + h += uint64(int32(4093) + int32((*TMem)(unsafe.Pointer(p)).Fflags)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob))) + } + } + } + goto _1 + _1: + ; + i++ + } + return h +} + +// C documentation +// +// /* +// ** For OP_Column, factor out the case where content is loaded from +// ** overflow pages, so that the code to implement this case is separate +// ** the common case where all content fits on the page. Factoring out +// ** the code reduces register pressure and helps the common case +// ** to run faster. +// */ +func _vdbeColumnFromOverflow(tls *libc.TLS, pC uintptr, iCol int32, t int32, iOffset Ti64, cacheStatus Tu32, colCacheCtr Tu32, pDest uintptr) (r int32) { + var db, pBuf, pCache, v1, p2, p3, p4 uintptr + var encoding, len1, rc int32 + _, _, _, _, _, _, _, _, _, _ = db, encoding, len1, pBuf, pCache, rc, v1, p2, p3, p4 + db = (*TMem)(unsafe.Pointer(pDest)).Fdb + encoding = int32((*TMem)(unsafe.Pointer(pDest)).Fenc) + len1 = int32(_sqlite3VdbeSerialTypeLen(tls, uint32(t))) + if len1 > *(*int32)(unsafe.Pointer(db + 136)) { + return int32(SQLITE_TOOBIG) + } + if len1 > int32(4000) && (*TVdbeCursor)(unsafe.Pointer(pC)).FpKeyInfo == uintptr(0) { + if int32(TBool(*(*uint8)(unsafe.Pointer(pC + 8))&0x10>>4)) == 0 { + (*TVdbeCursor)(unsafe.Pointer(pC)).FpCache = _sqlite3DbMallocZero(tls, db, uint64(32)) + if (*TVdbeCursor)(unsafe.Pointer(pC)).FpCache == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.SetBitFieldPtr8Uint32(pC+8, libc.Uint32FromInt32(1), 4, 0x10) + } + pCache = (*TVdbeCursor)(unsafe.Pointer(pC)).FpCache + if (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue == uintptr(0) || (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FiCol != iCol || (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FcacheStatus != cacheStatus || (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FcolCacheCtr != colCacheCtr || (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FiOffset != _sqlite3BtreeOffset(tls, *(*uintptr)(unsafe.Pointer(pC + 48))) { + if (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue != 0 { + _sqlite3RCStrUnref(tls, (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue) + } + v1 = _sqlite3RCStrNew(tls, uint64(len1+int32(3))) + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue = v1 + pBuf = v1 + if pBuf == uintptr(0) { + return int32(SQLITE_NOMEM) + } + rc = _sqlite3BtreePayload(tls, *(*uintptr)(unsafe.Pointer(pC + 48)), uint32(iOffset), uint32(len1), pBuf) + if rc != 0 { + return rc + } + *(*int8)(unsafe.Pointer(pBuf + uintptr(len1))) = 0 + *(*int8)(unsafe.Pointer(pBuf + uintptr(len1+int32(1)))) = 0 + *(*int8)(unsafe.Pointer(pBuf + uintptr(len1+int32(2)))) = 0 + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FiCol = iCol + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FcacheStatus = cacheStatus + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FcolCacheCtr = colCacheCtr + (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FiOffset = _sqlite3BtreeOffset(tls, *(*uintptr)(unsafe.Pointer(pC + 48))) + } else { + pBuf = (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue + } + _sqlite3RCStrRef(tls, pBuf) + if t&int32(1) != 0 { + rc = _sqlite3VdbeMemSetStr(tls, pDest, pBuf, int64(len1), uint8(encoding), __ccgo_fp(_sqlite3RCStrUnref)) + p2 = pDest + 20 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(MEM_Term)) + } else { + rc = _sqlite3VdbeMemSetStr(tls, pDest, pBuf, int64(len1), uint8(0), __ccgo_fp(_sqlite3RCStrUnref)) + } + } else { + rc = _sqlite3VdbeMemFromBtree(tls, *(*uintptr)(unsafe.Pointer(pC + 48)), uint32(iOffset), uint32(len1), pDest) + if rc != 0 { + return rc + } + _sqlite3VdbeSerialGet(tls, (*TMem)(unsafe.Pointer(pDest)).Fz, uint32(t), pDest) + if t&int32(1) != 0 && encoding == int32(SQLITE_UTF8) { + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pDest)).Fz + uintptr(len1))) = 0 + p3 = pDest + 20 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(MEM_Term)) + } + } + p4 = pDest + 20 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) & ^libc.Int32FromInt32(MEM_Ephem)) + return rc +} + +// C documentation +// +// /* +// ** Return the symbolic name for the data type of a pMem +// */ +func _vdbeMemTypeName(tls *libc.TLS, pMem uintptr) (r uintptr) { + return _azTypes[Xsqlite3_value_type(tls, pMem)-int32(1)] +} + +var _azTypes = [5]uintptr{ + 0: __ccgo_ts + 1164, + 1: __ccgo_ts + 1176, + 2: __ccgo_ts + 1181, + 3: __ccgo_ts + 1159, + 4: __ccgo_ts + 1681, +} + +// C documentation +// +// /* +// ** Execute as much of a VDBE program as we can. +// ** This is the core of sqlite3_step(). +// */ +func _sqlite3VdbeExec(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(976) + defer tls.Free(976) + var aCol, aMem, aOffset, aOp, aPermute, aRoot, apArg, apArg1, db, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pnErr, t1, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v240, v241, v242, v250, v251, v252, v253, v255, v263, v278, v279, v286, v288, v297, v298, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 uintptr + var affinity int8 + var alreadyExists, bRev, c, c1, c2, cnt, cnt1, desiredAutoCommit, eNew, eOld, eqOnly, exists, i, i1, i2, i4, i5, i6, i7, i8, i9, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iQuery, iRollback, iSavepoint, iSet, ii, ii1, isLegacy, isSchemaChange, isTransaction, len1, n, n1, n2, n4, nArg, nArg1, nByte2, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nRoot, nStep, nVarint, oc, opflags, p1, p11, p12, p13, p2, p21, pcDest, pcx, rc, res, res10, res11, res12, res21, seekResult, v11, v21, wrFlag, v188, v191, v194, v197, v198, v205, v206, v207, v223, v224, v244, v245, v248, v249, v256, v260, v265, v266, v269, v270, v272, v273, v274, v275, v284, v287, v291 int32 + var colCacheCtr, iAddr, iMap, iPrior, idx, len11, n3, p22, p23, serialType, serial_type, v213, v214, v216, v221, v222 Tu32 + var encoding, isWriteLock, mTrace, op, p5, resetSchemaOnFault, vtabOnConflict, v225 Tu8 + var flags1, flags11, flags2, flags3, flags31, newType, nullFlag, type1, type2, typeMask, v190 Tu16 + var h, h1, iKey1, nData, nProgressLimit, nVmStep, offset64, uu Tu64 + var i3, iA, iB1, iKey, iKey2, nByte, nByte1, nCellKey, nZero, sz, v254, v262 Ti64 + var newMax, v211 uint32 + var rA, rB float64 + var xAuth Tsqlite3_xauth + var v204, v271, v281 int64 + var v215, v267, v282, v299 bool + var _ /* aRes at bp+712 */ [3]int32 + var _ /* iA at bp+8 */ Ti64 + var _ /* iB at bp+0 */ Ti64 + var _ /* iMeta at bp+104 */ int32 + var _ /* iMeta at bp+108 */ int32 + var _ /* iMoved at bp+608 */ int32 + var _ /* initData at bp+640 */ TInitData + var _ /* m at bp+552 */ TMem + var _ /* nChange at bp+616 */ Ti64 + var _ /* nEntry at bp+96 */ Ti64 + var _ /* nErr at bp+680 */ int32 + var _ /* nullFunc at bp+856 */ TFuncDef + var _ /* pVCur at bp+784 */ uintptr + var _ /* pgno at bp+624 */ TPgno + var _ /* r at bp+120 */ TUnpackedRecord + var _ /* r at bp+168 */ TUnpackedRecord + var _ /* r at bp+208 */ TUnpackedRecord + var _ /* r at bp+464 */ TUnpackedRecord + var _ /* r at bp+512 */ TUnpackedRecord + var _ /* res at bp+112 */ int32 + var _ /* res at bp+160 */ int32 + var _ /* res at bp+248 */ int32 + var _ /* res at bp+320 */ int32 + var _ /* res at bp+376 */ int32 + var _ /* res at bp+392 */ int32 + var _ /* res at bp+396 */ int32 + var _ /* res at bp+400 */ int32 + var _ /* res at bp+456 */ int32 + var _ /* rowid at bp+504 */ Ti64 + var _ /* rowid at bp+928 */ Tsqlite_int64 + var _ /* sContext at bp+800 */ Tsqlite3_context + var _ /* sMem at bp+24 */ TMem + var _ /* sMem at bp+728 */ TMem + var _ /* t at bp+80 */ Tu32 + var _ /* uA at bp+16 */ Tu64 + var _ /* v at bp+312 */ Ti64 + var _ /* v at bp+384 */ Ti64 + var _ /* v at bp+88 */ Tu64 + var _ /* val at bp+696 */ Ti64 + var _ /* x at bp+256 */ TMem + var _ /* x at bp+328 */ TBtreePayload + var _ /* x at bp+408 */ TBtreePayload + var _ /* x at bp+704 */ Ti64 + var _ /* z at bp+688 */ uintptr + var _ /* zErr at bp+632 */ uintptr + var _ /* zErr at bp+792 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, aMem, aOffset, aOp, aPermute, aRoot, affinity, alreadyExists, apArg, apArg1, bRev, c, c1, c2, cnt, cnt1, colCacheCtr, db, desiredAutoCommit, eNew, eOld, encoding, eqOnly, exists, flags1, flags11, flags2, flags3, flags31, h, h1, i, i1, i2, i3, i4, i5, i6, i7, i8, i9, iA, iAddr, iB1, iCompare, iCookie, iDb, iDb1, iDb2, iDb3, iKey, iKey1, iKey2, iMap, iPrior, iQuery, iRollback, iSavepoint, iSet, idx, ii, ii1, isLegacy, isSchemaChange, isTransaction, isWriteLock, len1, len11, mTrace, n, n1, n2, n3, n4, nArg, nArg1, nByte, nByte1, nByte2, nCellKey, nData, nField, nField1, nField2, nHdr, nKeyCol, nMem, nName, nProgressLimit, nRoot, nStep, nVarint, nVmStep, nZero, newMax, newType, nullFlag, oc, offset64, op, opflags, p1, p11, p12, p13, p2, p21, p22, p23, p5, pArgc, pBt, pBt1, pBt2, pBt3, pC, pC1, pC10, pC11, pC12, pC13, pC14, pC15, pC16, pC17, pC18, pC19, pC2, pC20, pC21, pC22, pC23, pC24, pC25, pC26, pC27, pC28, pC29, pC3, pC30, pC31, pC32, pC4, pC5, pC6, pC7, pC8, pC9, pCaller, pColl, pCrsr, pCrsr1, pCrsr2, pCrsr3, pCrsr4, pCrsr5, pCrsr6, pCrsr7, pCtx, pCtx1, pCtx2, pCur, pCur1, pCur2, pCur3, pCur4, pCur5, pCur6, pCx, pCx1, pCx2, pCx3, pData, pData0, pDb, pDb1, pDb2, pDb3, pDest, pDest1, pDest2, pEnd, pFrame, pFrame1, pFrame2, pFrame3, pFrame4, pIdxKey, pIn, pIn1, pIn2, pIn3, pKey, pKeyInfo, pKeyInfo1, pKeyInfo2, pLast, pMem, pMem1, pMem2, pMem3, pMem4, pModule, pModule1, pModule2, pModule3, pModule4, pModule5, pModule6, pName, pNew, pOp, pOrig, pOut, pPager, pProgram, pQuery, pRec, pReg, pRhs, pRt, pSavepoint, pSrc, pTab, pTab1, pTab2, pTab3, pTabCur, pTmp, pVCur1, pVTab, pVar, pVtab, pVtab1, pVtab2, pVtab3, pVtab4, pVtab5, pVtab6, pVtab7, pX, pX1, pcDest, pcx, pnErr, rA, rB, rc, res, res10, res11, res12, res21, resetSchemaOnFault, seekResult, serialType, serial_type, sz, t1, type1, type2, typeMask, uu, v11, v21, vtabOnConflict, wrFlag, xAuth, z1, z2, z3, zAffinity, zAffinity1, zData, zDb, zDb1, zEndHdr, zFilename, zHdr, zHdr1, zName, zPayload, zSchema, zSql, zTab, zTrace, v188, v190, v191, v194, v197, v198, v204, v205, v206, v207, v211, v213, v214, v215, v216, v221, v222, v223, v224, v225, v240, v241, v242, v244, v245, v248, v249, v250, v251, v252, v253, v254, v255, v256, v260, v262, v263, v265, v266, v267, v269, v270, v271, v272, v273, v274, v275, v278, v279, v281, v282, v284, v286, v287, v288, v291, v297, v298, v299, p189, p192, p193, p196, p199, p208, p209, p212, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p293, p294, p295, p296 + aOp = (*TVdbe)(unsafe.Pointer(p)).FaOp /* Copy of p->aOp */ + pOp = aOp /* Current operation */ + rc = SQLITE_OK /* Value to return */ + db = (*TVdbe)(unsafe.Pointer(p)).Fdb /* The database */ + resetSchemaOnFault = uint8(0) /* Reset schema after an error if positive */ + encoding = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The database encoding */ + iCompare = 0 /* Result of last comparison */ + nVmStep = uint64(0) /* Invoke xProgress() when nVmStep reaches this */ + aMem = (*TVdbe)(unsafe.Pointer(p)).FaMem /* Copy of p->aMem */ + pIn1 = uintptr(0) /* 1st input operand */ + pIn2 = uintptr(0) /* 2nd input operand */ + pIn3 = uintptr(0) /* 3rd input operand */ + pOut = uintptr(0) /* Output operand */ + colCacheCtr = uint32(0) /* Column cache counter */ + /*** INSERT STACK UNION HERE ***/ + /* sqlite3_step() verifies this */ + if (*TVdbe)(unsafe.Pointer(p)).FlockMask != uint32(0) { + _sqlite3VdbeEnter(tls, p) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != 0 { + iPrior = *(*Tu32)(unsafe.Pointer(p + 212 + 4*4)) + nProgressLimit = uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps - iPrior%(*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) + } else { + nProgressLimit = libc.Uint64FromUint32(0xffffffff) | libc.Uint64FromUint32(0xffffffff)<= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { + nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) + if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { + nProgressLimit = libc.Uint64FromUint32(0xffffffff) | libc.Uint64FromUint32(0xffffffff)< *(*int32)(unsafe.Pointer(db + 136)) { + goto too_big + } + (*TOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_String) + /* Opcode: String P1 P2 P3 P4 P5 + ** Synopsis: r[P2]='P4' (len=P1) + ** + ** The string value P4 of length P1 (bytes) is stored in register P2. + ** + ** If P3 is not zero and the content of register P3 is equal to P5, then + ** the datatype of the register P2 is converted to BLOB. The content is + ** the same sequence of bytes, it is merely interpreted as a BLOB instead + ** of a string, as if it had been CAST. In other words: + ** + ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) + */ + _14: + ; /* out2 */ + pOut = _out2Prerelease(tls, p, pOp) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) + (*TMem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16)) + (*TMem)(unsafe.Pointer(pOut)).Fn = (*TOp)(unsafe.Pointer(pOp)).Fp1 + (*TMem)(unsafe.Pointer(pOut)).Fenc = encoding + goto _187 + /* Opcode: BeginSubrtn * P2 * * * + ** Synopsis: r[P2]=NULL + ** + ** Mark the beginning of a subroutine that can be entered in-line + ** or that can be called using OP_Gosub. The subroutine should + ** be terminated by an OP_Return instruction that has a P1 operand that + ** is the same as the P2 operand to this opcode and that has P3 set to 1. + ** If the subroutine is entered in-line, then the OP_Return will simply + ** fall through. But if the subroutine is entered using OP_Gosub, then + ** the OP_Return will jump back to the first instruction after the OP_Gosub. + ** + ** This routine works by loading a NULL into the P2 register. When the + ** return address register contains a NULL, the OP_Return instruction is + ** a no-op that simply falls through to the next instruction (assuming that + ** the OP_Return opcode has a P3 value of 1). Thus if the subroutine is + ** entered in-line, then the OP_Return will cause in-line execution to + ** continue. But if the subroutine is entered via OP_Gosub, then the + ** OP_Return will cause a return to the address following the OP_Gosub. + ** + ** This opcode is identical to OP_Null. It has a different name + ** only to make the byte code easier to read and verify. + */ + /* Opcode: Null P1 P2 P3 * * + ** Synopsis: r[P2..P3]=NULL + ** + ** Write a NULL into registers P2. If P3 greater than P2, then also write + ** NULL into register P3 and every register in between P2 and P3. If P3 + ** is less than P2 (typically P3 is zero) then only register P2 is + ** set to NULL. + ** + ** If the P1 value is non-zero, then also set the MEM_Cleared flag so that + ** NULL values will not compare equal even if SQLITE_NULLEQ is set on + ** OP_Ne or OP_Eq. + */ + _16: + ; + _15: + ; + pOut = _out2Prerelease(tls, p, pOp) + cnt = (*TOp)(unsafe.Pointer(pOp)).Fp3 - (*TOp)(unsafe.Pointer(pOp)).Fp2 + if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + v191 = libc.Int32FromInt32(MEM_Null) | libc.Int32FromInt32(MEM_Cleared) + } else { + v191 = int32(MEM_Null) + } + v190 = uint16(v191) + nullFlag = v190 + (*TMem)(unsafe.Pointer(pOut)).Fflags = v190 + (*TMem)(unsafe.Pointer(pOut)).Fn = 0 + for cnt > 0 { + pOut += 56 + _sqlite3VdbeMemSetNull(tls, pOut) + (*TMem)(unsafe.Pointer(pOut)).Fflags = nullFlag + (*TMem)(unsafe.Pointer(pOut)).Fn = 0 + cnt-- + } + goto _187 + /* Opcode: SoftNull P1 * * * * + ** Synopsis: r[P1]=NULL + ** + ** Set register P1 to have the value NULL as seen by the OP_MakeRecord + ** instruction, but do not free any string or blob memory associated with + ** the register, so that if the value was a string or blob that was + ** previously copied using OP_SCopy, the copies will continue to be valid. + */ + _17: + ; + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_Undefined)|libc.Int32FromInt32(MEM_AffMask)) | int32(MEM_Null)) + goto _187 + /* Opcode: Blob P1 P2 * P4 * + ** Synopsis: r[P2]=P4 (len=P1) + ** + ** P4 points to a blob of data P1 bytes long. Store this + ** blob in register P2. If P4 is a NULL pointer, then construct + ** a zero-filled blob that is P1 bytes long in P2. + */ + _18: + ; /* out2 */ + pOut = _out2Prerelease(tls, p, pOp) + if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { + _sqlite3VdbeMemSetZeroBlob(tls, pOut, (*TOp)(unsafe.Pointer(pOp)).Fp1) + if _sqlite3VdbeMemExpandBlob(tls, pOut) != 0 { + goto no_mem + } + } else { + _sqlite3VdbeMemSetStr(tls, pOut, *(*uintptr)(unsafe.Pointer(pOp + 16)), int64((*TOp)(unsafe.Pointer(pOp)).Fp1), uint8(0), uintptr(0)) + } + (*TMem)(unsafe.Pointer(pOut)).Fenc = encoding + goto _187 + /* Opcode: Variable P1 P2 * P4 * + ** Synopsis: r[P2]=parameter(P1,P4) + ** + ** Transfer the values of bound parameter P1 into register P2 + ** + ** If the parameter is named, then its name appears in P4. + ** The P4 value is used by sqlite3_bind_parameter_name(). + */ + _19: + ; /* Value being transferred */ + pVar = (*TVdbe)(unsafe.Pointer(p)).FaVar + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*56 + if _sqlite3VdbeMemTooBig(tls, pVar) != 0 { + goto too_big + } + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _sqlite3VdbeMemSetNull(tls, pOut) + } + libc.Xmemcpy(tls, pOut, pVar, uint64(libc.UintptrFromInt32(0)+24)) + p192 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p192)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p192))) & ^(libc.Int32FromInt32(MEM_Dyn) | libc.Int32FromInt32(MEM_Ephem))) + p193 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p193)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p193))) | (libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_FromBind))) + goto _187 + /* Opcode: Move P1 P2 P3 * * + ** Synopsis: r[P2@P3]=r[P1@P3] + ** + ** Move the P3 values in register P1..P1+P3-1 over into + ** registers P2..P2+P3-1. Registers P1..P1+P3-1 are + ** left holding a NULL. It is an error for register ranges + ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error + ** for P3 to be less than 1. + */ + _20: + ; /* Register to copy to */ + n = (*TOp)(unsafe.Pointer(pOp)).Fp3 + p1 = (*TOp)(unsafe.Pointer(pOp)).Fp1 + p2 = (*TOp)(unsafe.Pointer(pOp)).Fp2 + pIn1 = aMem + uintptr(p1)*56 + pOut = aMem + uintptr(p2)*56 + for { + _sqlite3VdbeMemMove(tls, pOut, pIn1) + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Ephem) != 0 && _sqlite3VdbeMemMakeWriteable(tls, pOut) != 0 { + goto no_mem + } + pIn1 += 56 + pOut += 56 + goto _195 + _195: + ; + n-- + v194 = n + if !(v194 != 0) { + break + } + } + goto _187 + /* Opcode: Copy P1 P2 P3 * P5 + ** Synopsis: r[P2@P3+1]=r[P1@P3+1] + ** + ** Make a copy of registers P1..P1+P3 into registers P2..P2+P3. + ** + ** If the 0x0002 bit of P5 is set then also clear the MEM_Subtype flag in the + ** destination. The 0x0001 bit of P5 indicates that this Copy opcode cannot + ** be merged. The 0x0001 bit is used by the query planner and does not + ** come into play during query execution. + ** + ** This instruction makes a deep copy of the value. A duplicate + ** is made of any string or blob constant. See also OP_SCopy. + */ + _21: + ; + n1 = (*TOp)(unsafe.Pointer(pOp)).Fp3 + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + for int32(1) != 0 { + _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Ephem) != 0 && _sqlite3VdbeMemMakeWriteable(tls, pOut) != 0 { + goto no_mem + } + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Subtype) != 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(0x0002) != 0 { + p196 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p196)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p196))) & ^libc.Int32FromInt32(MEM_Subtype)) + } + v197 = n1 + n1-- + if v197 == 0 { + break + } + pOut += 56 + pIn1 += 56 + } + goto _187 + /* Opcode: SCopy P1 P2 * * * + ** Synopsis: r[P2]=r[P1] + ** + ** Make a shallow copy of register P1 into register P2. + ** + ** This instruction makes a shallow copy of the value. If the value + ** is a string or blob, then the copy is only a pointer to the + ** original and hence if the original changes so will the copy. + ** Worse, if the original is deallocated, the copy becomes invalid. + ** Thus the program must guarantee that the original will not change + ** during the lifetime of the copy. Use OP_Copy to make a complete + ** copy. + */ + _22: + ; /* out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + _sqlite3VdbeMemShallowCopy(tls, pOut, pIn1, int32(MEM_Ephem)) + goto _187 + /* Opcode: IntCopy P1 P2 * * * + ** Synopsis: r[P2]=r[P1] + ** + ** Transfer the integer value held in register P1 into register P2. + ** + ** This is an optimized version of SCopy that works only for integer + ** values. + */ + _23: + ; /* out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + _sqlite3VdbeMemSetInt64(tls, pOut, *(*Ti64)(unsafe.Pointer(pIn1))) + goto _187 + /* Opcode: FkCheck * * * * * + ** + ** Halt with an SQLITE_CONSTRAINT error if there are any unresolved + ** foreign key constraint violations. If there are no foreign key + ** constraint violations, this is a no-op. + ** + ** FK constraint violations are also checked when the prepared statement + ** exits. This opcode is used to raise foreign key constraint errors prior + ** to returning results such as a row change count or the result of a + ** RETURNING clause. + */ + _24: + ; + v198 = _sqlite3VdbeCheckFk(tls, p, 0) + rc = v198 + if v198 != SQLITE_OK { + goto abort_due_to_error + } + goto _187 + /* Opcode: ResultRow P1 P2 * * * + ** Synopsis: output=r[P1@P2] + ** + ** The registers P1 through P1+P2-1 contain a single row of + ** results. This opcode causes the sqlite3_step() call to terminate + ** with an SQLITE_ROW return code and it sets up the sqlite3_stmt + ** structure to provide access to the r(P1)..r(P1+P2-1) values as + ** the result row. + */ + _25: + ; + (*TVdbe)(unsafe.Pointer(p)).FcacheCtr = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + uint32(2) | uint32(1) + (*TVdbe)(unsafe.Pointer(p)).FpResultRow = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto no_mem + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_ROW) != 0 { + (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_ROW), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, uintptr(0)) + } + (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp)-int64(aOp))/24) + int32(1) + rc = int32(SQLITE_ROW) + goto vdbe_return + /* Opcode: Concat P1 P2 P3 * * + ** Synopsis: r[P3]=r[P2]+r[P1] + ** + ** Add the text in register P1 onto the end of the text in + ** register P2 and store the result in register P3. + ** If either the P1 or P2 text are NULL then store NULL in P3. + ** + ** P3 = P2 || P1 + ** + ** It is illegal for P1 and P3 to be the same register. Sometimes, + ** if P3 is the same register as P2, the implementation is able + ** to avoid a memcpy(). + */ + _26: + ; /* Initial flags for P2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + flags1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags + if (int32(flags1)|int32((*TMem)(unsafe.Pointer(pIn2)).Fflags))&int32(MEM_Null) != 0 { + _sqlite3VdbeMemSetNull(tls, pOut) + goto _187 + } + if int32(flags1)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) == 0 { + if _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(0)) != 0 { + goto no_mem + } + flags1 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_Str)) + } else { + if int32(flags1)&int32(MEM_Zero) != 0 { + if _sqlite3VdbeMemExpandBlob(tls, pIn1) != 0 { + goto no_mem + } + flags1 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_Str)) + } + } + flags2 = (*TMem)(unsafe.Pointer(pIn2)).Fflags + if int32(flags2)&(libc.Int32FromInt32(MEM_Str)|libc.Int32FromInt32(MEM_Blob)) == 0 { + if _sqlite3VdbeMemStringify(tls, pIn2, encoding, uint8(0)) != 0 { + goto no_mem + } + flags2 = uint16(int32((*TMem)(unsafe.Pointer(pIn2)).Fflags) & ^libc.Int32FromInt32(MEM_Str)) + } else { + if int32(flags2)&int32(MEM_Zero) != 0 { + if _sqlite3VdbeMemExpandBlob(tls, pIn2) != 0 { + goto no_mem + } + flags2 = uint16(int32((*TMem)(unsafe.Pointer(pIn2)).Fflags) & ^libc.Int32FromInt32(MEM_Str)) + } + } + nByte = int64((*TMem)(unsafe.Pointer(pIn1)).Fn + (*TMem)(unsafe.Pointer(pIn2)).Fn) + if nByte > int64(*(*int32)(unsafe.Pointer(db + 136))) { + goto too_big + } + if _sqlite3VdbeMemGrow(tls, pOut, int32(nByte)+int32(2), libc.BoolInt32(pOut == pIn2)) != 0 { + goto no_mem + } + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Str)) + if pOut != pIn2 { + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pOut)).Fz, (*TMem)(unsafe.Pointer(pIn2)).Fz, uint64((*TMem)(unsafe.Pointer(pIn2)).Fn)) + (*TMem)(unsafe.Pointer(pIn2)).Fflags = flags2 + } + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pOut)).Fz+uintptr((*TMem)(unsafe.Pointer(pIn2)).Fn), (*TMem)(unsafe.Pointer(pIn1)).Fz, uint64((*TMem)(unsafe.Pointer(pIn1)).Fn)) + (*TMem)(unsafe.Pointer(pIn1)).Fflags = flags1 + if int32(encoding) > int32(SQLITE_UTF8) { + nByte &= int64(^libc.Int32FromInt32(1)) + } + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pOut)).Fz + uintptr(nByte))) = 0 + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pOut)).Fz + uintptr(nByte+int64(1)))) = 0 + p199 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p199)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p199))) | libc.Int32FromInt32(MEM_Term)) + (*TMem)(unsafe.Pointer(pOut)).Fn = int32(nByte) + (*TMem)(unsafe.Pointer(pOut)).Fenc = encoding + goto _187 + /* Opcode: Add P1 P2 P3 * * + ** Synopsis: r[P3]=r[P1]+r[P2] + ** + ** Add the value in register P1 to the value in register P2 + ** and store the result in register P3. + ** If either input is NULL, the result is NULL. + */ + /* Opcode: Multiply P1 P2 P3 * * + ** Synopsis: r[P3]=r[P1]*r[P2] + ** + ** + ** Multiply the value in register P1 by the value in register P2 + ** and store the result in register P3. + ** If either input is NULL, the result is NULL. + */ + /* Opcode: Subtract P1 P2 P3 * * + ** Synopsis: r[P3]=r[P2]-r[P1] + ** + ** Subtract the value in register P1 from the value in register P2 + ** and store the result in register P3. + ** If either input is NULL, the result is NULL. + */ + /* Opcode: Divide P1 P2 P3 * * + ** Synopsis: r[P3]=r[P2]/r[P1] + ** + ** Divide the value in register P1 by the value in register P2 + ** and store the result in register P3 (P3=P2/P1). If the value in + ** register P1 is zero, then the result is NULL. If either input is + ** NULL, the result is NULL. + */ + /* Opcode: Remainder P1 P2 P3 * * + ** Synopsis: r[P3]=r[P2]%r[P1] + ** + ** Compute the remainder after integer register P2 is divided by + ** register P1 and store the result in register P3. + ** If the value in register P1 is zero the result is NULL. + ** If either operand is NULL, the result is NULL. + */ + _31: + ; /* same as TK_PLUS, in1, in2, out3 */ + _30: + ; /* same as TK_MINUS, in1, in2, out3 */ + _29: + ; /* same as TK_STAR, in1, in2, out3 */ + _28: + ; /* same as TK_SLASH, in1, in2, out3 */ + _27: + ; /* Real value of right operand */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + type1 = (*TMem)(unsafe.Pointer(pIn1)).Fflags + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + type2 = (*TMem)(unsafe.Pointer(pIn2)).Fflags + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if !(int32(type1)&int32(type2)&int32(MEM_Int) != 0) { + goto _200 + } + int_math: + ; + iA = *(*Ti64)(unsafe.Pointer(pIn1)) + *(*Ti64)(unsafe.Pointer(bp)) = *(*Ti64)(unsafe.Pointer(pIn2)) + switch int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) { + case int32(OP_Add): + if _sqlite3AddInt64(tls, bp, iA) != 0 { + goto fp_math + } + case int32(OP_Subtract): + if _sqlite3SubInt64(tls, bp, iA) != 0 { + goto fp_math + } + case int32(OP_Multiply): + if _sqlite3MulInt64(tls, bp, iA) != 0 { + goto fp_math + } + case int32(OP_Divide): + if iA == 0 { + goto arithmetic_result_is_null + } + if iA == int64(-int32(1)) && *(*Ti64)(unsafe.Pointer(bp)) == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<>r[P1] + ** + ** Shift the integer value in register P2 to the right by the + ** number of bits specified by the integer in register P1. + ** Store the result in register P3. + ** If either input is NULL, the result is NULL. + */ + _36: + ; /* same as TK_BITAND, in1, in2, out3 */ + _35: + ; /* same as TK_BITOR, in1, in2, out3 */ + _34: + ; /* same as TK_LSHIFT, in1, in2, out3 */ + _33: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if (int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)|int32((*TMem)(unsafe.Pointer(pIn2)).Fflags))&int32(MEM_Null) != 0 { + _sqlite3VdbeMemSetNull(tls, pOut) + goto _187 + } + *(*Ti64)(unsafe.Pointer(bp + 8)) = _sqlite3VdbeIntValue(tls, pIn2) + iB1 = _sqlite3VdbeIntValue(tls, pIn1) + op = (*TOp)(unsafe.Pointer(pOp)).Fopcode + if int32(op) == int32(OP_BitAnd) { + *(*Ti64)(unsafe.Pointer(bp + 8)) &= iB1 + } else { + if int32(op) == int32(OP_BitOr) { + *(*Ti64)(unsafe.Pointer(bp + 8)) |= iB1 + } else { + if iB1 != 0 { + /* If shifting by a negative amount, shift in the other direction */ + if iB1 < 0 { + op = uint8(libc.Int32FromInt32(2)*libc.Int32FromInt32(OP_ShiftLeft) + libc.Int32FromInt32(1) - int32(op)) + if iB1 > int64(-libc.Int32FromInt32(64)) { + v204 = -iB1 + } else { + v204 = int64(64) + } + iB1 = v204 + } + if iB1 >= int64(64) { + if *(*Ti64)(unsafe.Pointer(bp + 8)) >= 0 || int32(op) == int32(OP_ShiftLeft) { + v205 = 0 + } else { + v205 = -int32(1) + } + *(*Ti64)(unsafe.Pointer(bp + 8)) = int64(v205) + } else { + libc.Xmemcpy(tls, bp+16, bp+8, uint64(8)) + if int32(op) == int32(OP_ShiftLeft) { + *(*Tu64)(unsafe.Pointer(bp + 16)) <<= uint64(iB1) + } else { + *(*Tu64)(unsafe.Pointer(bp + 16)) >>= uint64(iB1) + /* Sign-extend on a right shift of a negative number */ + if *(*Ti64)(unsafe.Pointer(bp + 8)) < 0 { + *(*Tu64)(unsafe.Pointer(bp + 16)) |= (libc.Uint64FromUint32(0xffffffff)< + **
  • P2=='A' → BLOB + **
  • P2=='B' → TEXT + **
  • P2=='C' → NUMERIC + **
  • P2=='D' → INTEGER + **
  • P2=='E' → REAL + ** + ** + ** A NULL value is not changed by this routine. It remains NULL. + */ + _40: + ; /* in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Zero) != 0 { + v206 = _sqlite3VdbeMemExpandBlob(tls, pIn1) + } else { + v206 = 0 + } + rc = v206 + if rc != 0 { + goto abort_due_to_error + } + rc = _sqlite3VdbeMemCast(tls, pIn1, uint8((*TOp)(unsafe.Pointer(pOp)).Fp2), encoding) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: Eq P1 P2 P3 P4 P5 + ** Synopsis: IF r[P3]==r[P1] + ** + ** Compare the values in register P1 and P3. If reg(P3)==reg(P1) then + ** jump to address P2. + ** + ** The SQLITE_AFF_MASK portion of P5 must be an affinity character - + ** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made + ** to coerce both inputs according to this affinity before the + ** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric + ** affinity is used. Note that the affinity conversions are stored + ** back into the input registers P1 and P3. So this opcode can cause + ** persistent changes to registers P1 and P3. + ** + ** Once any conversions have taken place, and neither value is NULL, + ** the values are compared. If both values are blobs then memcmp() is + ** used to determine the results of the comparison. If both values + ** are text, then the appropriate collating function specified in + ** P4 is used to do the comparison. If P4 is not specified then + ** memcmp() is used to compare text string. If both values are + ** numeric, then a numeric comparison is used. If the two values + ** are of different types, then numbers are considered less than + ** strings and strings are considered less than blobs. + ** + ** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either + ** true or false and is never NULL. If both operands are NULL then the result + ** of comparison is true. If either operand is NULL then the result is false. + ** If neither operand is NULL the result is the same as it would be if + ** the SQLITE_NULLEQ flag were omitted from P5. + ** + ** This opcode saves the result of comparison for use by the new + ** OP_Jump opcode. + */ + /* Opcode: Ne P1 P2 P3 P4 P5 + ** Synopsis: IF r[P3]!=r[P1] + ** + ** This works just like the Eq opcode except that the jump is taken if + ** the operands in registers P1 and P3 are not equal. See the Eq opcode for + ** additional information. + */ + /* Opcode: Lt P1 P2 P3 P4 P5 + ** Synopsis: IF r[P3]r[P1] + ** + ** This works just like the Lt opcode except that the jump is taken if + ** the content of register P3 is greater than the content of + ** register P1. See the Lt opcode for additional information. + */ + /* Opcode: Ge P1 P2 P3 P4 P5 + ** Synopsis: IF r[P3]>=r[P1] + ** + ** This works just like the Lt opcode except that the jump is taken if + ** the content of register P3 is greater than or equal to the content of + ** register P1. See the Lt opcode for additional information. + */ + _46: + ; /* same as TK_EQ, jump, in1, in3 */ + _45: + ; /* same as TK_NE, jump, in1, in3 */ + _44: + ; /* same as TK_LT, jump, in1, in3 */ + _43: + ; /* same as TK_LE, jump, in1, in3 */ + _42: + ; /* same as TK_GT, jump, in1, in3 */ + _41: + ; /* Copy of initial value of pIn3->flags */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + flags11 = (*TMem)(unsafe.Pointer(pIn1)).Fflags + flags3 = (*TMem)(unsafe.Pointer(pIn3)).Fflags + if int32(flags11)&int32(flags3)&int32(MEM_Int) != 0 { + /* Common case of comparison of two integers */ + if *(*Ti64)(unsafe.Pointer(pIn3)) > *(*Ti64)(unsafe.Pointer(pIn1)) { + if *(*uint8)(unsafe.Pointer(_sqlite3aGTb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode))) != 0 { + goto jump_to_p2 + } + iCompare = +libc.Int32FromInt32(1) + } else { + if *(*Ti64)(unsafe.Pointer(pIn3)) < *(*Ti64)(unsafe.Pointer(pIn1)) { + if *(*uint8)(unsafe.Pointer(_sqlite3aLTb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode))) != 0 { + goto jump_to_p2 + } + iCompare = -int32(1) + } else { + if *(*uint8)(unsafe.Pointer(_sqlite3aEQb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode))) != 0 { + goto jump_to_p2 + } + iCompare = 0 + } + } + goto _187 + } + if (int32(flags11)|int32(flags3))&int32(MEM_Null) != 0 { + /* One or both operands are NULL */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(SQLITE_NULLEQ) != 0 { + /* If SQLITE_NULLEQ is set (which will only happen if the operator is + ** OP_Eq or OP_Ne) then take the jump or not depending on whether + ** or not both operands are null. + */ + if int32(flags11)&int32(flags3)&int32(MEM_Null) != 0 && int32(flags3)&int32(MEM_Cleared) == 0 { + res = 0 /* Operands are equal */ + } else { + if int32(flags3)&int32(MEM_Null) != 0 { + v207 = -int32(1) + } else { + v207 = +libc.Int32FromInt32(1) + } + res = v207 /* Operands are not equal */ + } + } else { + /* SQLITE_NULLEQ is clear and at least one operand is NULL, + ** then the result is always NULL. + ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. + */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(SQLITE_JUMPIFNULL) != 0 { + goto jump_to_p2 + } + iCompare = int32(1) /* Operands are not equal */ + goto _187 + } + } else { + /* Neither operand is NULL and we couldn't do the special high-speed + ** integer comparison case. So do a general-case comparison. */ + affinity = int8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & int32(SQLITE_AFF_MASK)) + if int32(affinity) >= int32(SQLITE_AFF_NUMERIC) { + if (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_Str)) == int32(MEM_Str) { + _applyNumericAffinity(tls, pIn1, 0) + flags3 = (*TMem)(unsafe.Pointer(pIn3)).Fflags + } + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_Str)) == int32(MEM_Str) { + _applyNumericAffinity(tls, pIn3, 0) + } + } + } else { + if int32(affinity) == int32(SQLITE_AFF_TEXT) && (int32(flags11)|int32(flags3))&int32(MEM_Str) != 0 { + if int32(flags11)&int32(MEM_Str) != 0 { + p208 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p208)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p208))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags11)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + flags11 = uint16(int32((*TMem)(unsafe.Pointer(pIn1)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags11)&int32(MEM_TypeMask)) + if pIn1 == pIn3 { + flags3 = uint16(int32(flags11) | int32(MEM_Str)) + } + } + } + if int32(flags3)&int32(MEM_Str) != 0 { + p209 = pIn3 + 20 + *(*Tu16)(unsafe.Pointer(p209)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p209))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Real) | libc.Int32FromInt32(MEM_IntReal))) + } else { + if int32(flags3)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + _sqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + flags3 = uint16(int32((*TMem)(unsafe.Pointer(pIn3)).Fflags) & ^libc.Int32FromInt32(MEM_TypeMask) | int32(flags3)&int32(MEM_TypeMask)) + } + } + } + } + res = _sqlite3MemCompare(tls, pIn3, pIn1, *(*uintptr)(unsafe.Pointer(pOp + 16))) + } + /* At this point, res is negative, zero, or positive if reg[P1] is + ** less than, equal to, or greater than reg[P3], respectively. Compute + ** the answer to this operator in res2, depending on what the comparison + ** operator actually is. The next block of code depends on the fact + ** that the 6 comparison operators are consecutive integers in this + ** order: NE, EQ, GT, LE, LT, GE */ + if res < 0 { + res21 = int32(*(*uint8)(unsafe.Pointer(_sqlite3aLTb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode)))) + } else { + if res == 0 { + res21 = int32(*(*uint8)(unsafe.Pointer(_sqlite3aEQb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode)))) + } else { + res21 = int32(*(*uint8)(unsafe.Pointer(_sqlite3aGTb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fopcode)))) + } + } + iCompare = res + /* Undo any changes made by applyAffinity() to the input registers. */ + (*TMem)(unsafe.Pointer(pIn3)).Fflags = flags3 + (*TMem)(unsafe.Pointer(pIn1)).Fflags = flags11 + if res21 != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: ElseEq * P2 * * * + ** + ** This opcode must follow an OP_Lt or OP_Gt comparison operator. There + ** can be zero or more OP_ReleaseReg opcodes intervening, but no other + ** opcodes are allowed to occur between this instruction and the previous + ** OP_Lt or OP_Gt. + ** + ** If the result of an OP_Eq comparison on the same two operands as + ** the prior OP_Lt or OP_Gt would have been true, then jump to P2. If + ** the result of an OP_Eq comparison on the two previous operands + ** would have been false or NULL, then fall through. + */ + _47: + ; /* same as TK_ESCAPE, jump */ + if iCompare == 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: Permutation * * * P4 * + ** + ** Set the permutation used by the OP_Compare operator in the next + ** instruction. The permutation is stored in the P4 operand. + ** + ** The permutation is only valid for the next opcode which must be + ** an OP_Compare that has the OPFLAG_PERMUTE bit set in P5. + ** + ** The first integer in the P4 integer array is the length of the array + ** and does not become part of the permutation. + */ + _48: + ; + goto _187 + /* Opcode: Compare P1 P2 P3 P4 P5 + ** Synopsis: r[P1@P3] <-> r[P2@P3] + ** + ** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this + ** vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of + ** the comparison for use by the next OP_Jump instruct. + ** + ** If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is + ** determined by the most recent OP_Permutation operator. If the + ** OPFLAG_PERMUTE bit is clear, then register are compared in sequential + ** order. + ** + ** P4 is a KeyInfo structure that defines collating sequences and sort + ** orders for the comparison. The permutation applies to registers + ** only. The KeyInfo elements are used sequentially. + ** + ** The comparison is a sort comparison, so NULLs compare equal, + ** NULLs are less than numbers, numbers are less than strings, + ** and strings are less than blobs. + ** + ** This opcode must be immediately followed by an OP_Jump opcode. + */ + _49: + ; /* The permutation */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_PERMUTE) == 0 { + aPermute = uintptr(0) + } else { + aPermute = *(*uintptr)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24 + 16)) + uintptr(1)*4 + } + n2 = (*TOp)(unsafe.Pointer(pOp)).Fp3 + pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) + p11 = (*TOp)(unsafe.Pointer(pOp)).Fp1 + p21 = (*TOp)(unsafe.Pointer(pOp)).Fp2 + i = 0 + for { + if !(i < n2) { + break + } + if aPermute != 0 { + v211 = *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) + } else { + v211 = uint32(i) + } + idx = v211 + pColl = *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) + bRev = int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i)))) & int32(KEYINFO_ORDER_DESC) + iCompare = _sqlite3MemCompare(tls, aMem+uintptr(uint32(p11)+idx)*56, aMem+uintptr(uint32(p21)+idx)*56, pColl) + if iCompare != 0 { + if int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i))))&int32(KEYINFO_ORDER_BIGNULL) != 0 && (int32((*(*TMem)(unsafe.Pointer(aMem + uintptr(uint32(p11)+idx)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr(uint32(p21)+idx)*56))).Fflags)&int32(MEM_Null) != 0) { + iCompare = -iCompare + } + if bRev != 0 { + iCompare = -iCompare + } + break + } + goto _210 + _210: + ; + i++ + } + goto _187 + /* Opcode: Jump P1 P2 P3 * * + ** + ** Jump to the instruction at address P1, P2, or P3 depending on whether + ** in the most recent OP_Compare instruction the P1 vector was less than, + ** equal to, or greater than the P2 vector, respectively. + ** + ** This opcode must immediately follow an OP_Compare opcode. + */ + _50: + ; /* jump */ + if iCompare < 0 { + pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1-int32(1))*24 + } else { + if iCompare == 0 { + pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2-int32(1))*24 + } else { + pOp = aOp + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3-int32(1))*24 + } + } + goto _187 + /* Opcode: And P1 P2 P3 * * + ** Synopsis: r[P3]=(r[P1] && r[P2]) + ** + ** Take the logical AND of the values in registers P1 and P2 and + ** write the result into register P3. + ** + ** If either P1 or P2 is 0 (false) then the result is 0 even if + ** the other input is NULL. A NULL and true or two NULLs give + ** a NULL output. + */ + /* Opcode: Or P1 P2 P3 * * + ** Synopsis: r[P3]=(r[P1] || r[P2]) + ** + ** Take the logical OR of the values in register P1 and P2 and + ** store the answer in register P3. + ** + ** If either P1 or P2 is nonzero (true) then the result is 1 (true) + ** even if the other input is NULL. A NULL and false or two NULLs + ** give a NULL output. + */ + _52: + ; /* same as TK_AND, in1, in2, out3 */ + _51: + ; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ + v11 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, int32(2)) + v21 = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int32(2)) + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_And) { + v11 = int32(_and_logic[v11*int32(3)+v21]) + } else { + v11 = int32(_or_logic[v11*int32(3)+v21]) + } + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if v11 == int32(2) { + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Null)) + } else { + *(*Ti64)(unsafe.Pointer(pOut)) = int64(v11) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Int)) + } + goto _187 + /* Opcode: IsTrue P1 P2 P3 P4 * + ** Synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 + ** + ** This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and + ** IS NOT FALSE operators. + ** + ** Interpret the value in register P1 as a boolean value. Store that + ** boolean (a 0 or 1) in register P2. Or if the value in register P1 is + ** NULL, then the P3 is stored in register P2. Invert the answer if P4 + ** is 1. + ** + ** The logic is summarized like this: + ** + **
      + **
    • If P3==0 and P4==0 then r[P2] := r[P1] IS TRUE + **
    • If P3==1 and P4==1 then r[P2] := r[P1] IS FALSE + **
    • If P3==0 and P4==1 then r[P2] := r[P1] IS NOT TRUE + **
    • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE + **
    + */ + _53: + ; /* in1, out2 */ + _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, int64(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3)^(*TOp)(unsafe.Pointer(pOp)).Fp4.Fi)) + goto _187 + /* Opcode: Not P1 P2 * * * + ** Synopsis: r[P2]= !r[P1] + ** + ** Interpret the value in register P1 as a boolean value. Store the + ** boolean complement in register P2. If the value in register P1 is + ** NULL, then a NULL is stored in P2. + */ + _54: + ; /* same as TK_NOT, in1, out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { + _sqlite3VdbeMemSetInt64(tls, pOut, libc.BoolInt64(!(_sqlite3VdbeBooleanValue(tls, pIn1, 0) != 0))) + } else { + _sqlite3VdbeMemSetNull(tls, pOut) + } + goto _187 + /* Opcode: BitNot P1 P2 * * * + ** Synopsis: r[P2]= ~r[P1] + ** + ** Interpret the content of register P1 as an integer. Store the + ** ones-complement of the P1 value into register P2. If P1 holds + ** a NULL then store a NULL in P2. + */ + _55: + ; /* same as TK_BITNOT, in1, out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + _sqlite3VdbeMemSetNull(tls, pOut) + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) + *(*Ti64)(unsafe.Pointer(pOut)) = ^_sqlite3VdbeIntValue(tls, pIn1) + } + goto _187 + /* Opcode: Once P1 P2 * * * + ** + ** Fall through to the next instruction the first time this opcode is + ** encountered on each invocation of the byte-code program. Jump to P2 + ** on the second and all subsequent encounters during the same invocation. + ** + ** Top-level programs determine first invocation by comparing the P1 + ** operand against the P1 operand on the OP_Init opcode at the beginning + ** of the program. If the P1 values differ, then fall through and make + ** the P1 of this opcode equal to the P1 of OP_Init. If P1 values are + ** the same then take the jump. + ** + ** For subprograms, there is a bitmask in the VdbeFrame that determines + ** whether or not the jump should be taken. The bitmask is necessary + ** because the self-altering code trick does not work for recursive + ** triggers. + */ + _56: + ; /* Address of this instruction */ + if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { + iAddr = uint32(int32((int64(pOp) - int64((*TVdbe)(unsafe.Pointer(p)).FaOp)) / 24)) + if int32(*(*Tu8)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)))))&(int32(1)<<(iAddr&uint32(7))) != 0 { + goto jump_to_p2 + } + p212 = (*TVdbeFrame)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr(iAddr/uint32(8)) + *(*Tu8)(unsafe.Pointer(p212)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p212))) | libc.Int32FromInt32(1)<<(iAddr&libc.Uint32FromInt32(7))) + } else { + if (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 == (*TOp)(unsafe.Pointer(pOp)).Fp1 { + goto jump_to_p2 + } + } + (*TOp)(unsafe.Pointer(pOp)).Fp1 = (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp))).Fp1 + goto _187 + /* Opcode: If P1 P2 P3 * * + ** + ** Jump to P2 if the value in register P1 is true. The value + ** is considered true if it is numeric and non-zero. If the value + ** in P1 is NULL then take the jump if and only if P3 is non-zero. + */ + _57: + ; + c = _sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, (*TOp)(unsafe.Pointer(pOp)).Fp3) + if c != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: IfNot P1 P2 P3 * * + ** + ** Jump to P2 if the value in register P1 is False. The value + ** is considered false if it has a numeric value of zero. If the value + ** in P1 is NULL then take the jump if and only if P3 is non-zero. + */ + _58: + ; + c1 = libc.BoolInt32(!(_sqlite3VdbeBooleanValue(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56, libc.BoolInt32(!((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) + if c1 != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: IsNull P1 P2 * * * + ** Synopsis: if r[P1]==NULL goto P2 + ** + ** Jump to P2 if the value in register P1 is NULL. + */ + _59: + ; /* same as TK_ISNULL, jump, in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: IsType P1 P2 P3 P4 P5 + ** Synopsis: if typeof(P1.P3) in P5 goto P2 + ** + ** Jump to P2 if the type of a column in a btree is one of the types specified + ** by the P5 bitmask. + ** + ** P1 is normally a cursor on a btree for which the row decode cache is + ** valid through at least column P3. In other words, there should have been + ** a prior OP_Column for column P3 or greater. If the cursor is not valid, + ** then this opcode might give spurious results. + ** The the btree row has fewer than P3 columns, then use P4 as the + ** datatype. + ** + ** If P1 is -1, then P3 is a register number and the datatype is taken + ** from the value in that register. + ** + ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant + ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04. + ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10. + ** + ** WARNING: This opcode does not reliably distinguish between NULL and REAL + ** when P1>=0. If the database contains a NaN value, this opcode will think + ** that the datatype is REAL when it should be NULL. When P1<0 and the value + ** is already stored in register P3, then this opcode does reliably + ** distinguish between NULL and REAL. The problem only arises then P1>=0. + ** + ** Take the jump to address P2 if and only if the datatype of the + ** value determined by P1 and P3 corresponds to one of the bits in the + ** P5 bitmask. + ** + */ + _60: + ; + if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= 0 { + pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 < int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) { + serialType = *(*Tu32)(unsafe.Pointer(pC + 120 + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*4)) + if serialType >= uint32(12) { + if serialType&uint32(1) != 0 { + typeMask = uint16(0x04) /* SQLITE_TEXT */ + } else { + typeMask = uint16(0x08) /* SQLITE_BLOB */ + } + } else { + typeMask = uint16(_aMask[serialType]) + } + } else { + typeMask = uint16(int32(1) << ((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi - int32(1))) + } + } else { + typeMask = uint16(int32(1) << (Xsqlite3_value_type(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) - int32(1))) + } + if int32(typeMask)&int32((*TOp)(unsafe.Pointer(pOp)).Fp5) != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: ZeroOrNull P1 P2 P3 * * + ** Synopsis: r[P2] = 0 OR NULL + ** + ** If both registers P1 and P3 are NOT NULL, then store a zero in + ** register P2. If either registers P1 or P3 are NULL then put + ** a NULL in register P2. + */ + _61: + ; /* in1, in2, out2, in3 */ + if int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56))).Fflags)&int32(MEM_Null) != 0 || int32((*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fflags)&int32(MEM_Null) != 0 { + _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56) + } else { + _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56, 0) + } + goto _187 + /* Opcode: NotNull P1 P2 * * * + ** Synopsis: if r[P1]!=NULL goto P2 + ** + ** Jump to P2 if the value in register P1 is not NULL. + */ + _62: + ; /* same as TK_NOTNULL, jump, in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: IfNullRow P1 P2 P3 * * + ** Synopsis: if P1.nullRow then r[P3]=NULL, goto P2 + ** + ** Check the cursor P1 to see if it is currently pointing at a NULL row. + ** If it is, then set register P3 to NULL and jump immediately to P2. + ** If P1 is not on a NULL row, then fall through without making any + ** changes. + ** + ** If P1 is not an open cursor, then this opcode is a no-op. + */ + _63: + ; + pC1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if pC1 != 0 && (*TVdbeCursor)(unsafe.Pointer(pC1)).FnullRow != 0 { + _sqlite3VdbeMemSetNull(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56) + goto jump_to_p2 + } + goto _187 + /* Opcode: Offset P1 P2 P3 * * + ** Synopsis: r[P3] = sqlite_offset(P1) + ** + ** Store in register r[P3] the byte offset into the database file that is the + ** start of the payload for the record at which that cursor P1 is currently + ** pointing. + ** + ** P2 is the column number for the argument to the sqlite_offset() function. + ** This opcode does not use P2 itself, but the P2 value is used by the + ** code generator. The P1, P2, and P3 operands to this opcode are the + ** same as for OP_Column. + ** + ** This opcode is only available if SQLite is compiled with the + ** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. + */ + _64: + ; /* The VDBE cursor */ + pC2 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pOut = (*TVdbe)(unsafe.Pointer(p)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if pC2 == uintptr(0) || int32((*TVdbeCursor)(unsafe.Pointer(pC2)).FeCurType) != CURTYPE_BTREE { + _sqlite3VdbeMemSetNull(tls, pOut) + } else { + if (*TVdbeCursor)(unsafe.Pointer(pC2)).FdeferredMoveto != 0 { + rc = _sqlite3VdbeFinishMoveto(tls, pC2) + if rc != 0 { + goto abort_due_to_error + } + } + if _sqlite3BtreeEof(tls, *(*uintptr)(unsafe.Pointer(pC2 + 48))) != 0 { + _sqlite3VdbeMemSetNull(tls, pOut) + } else { + _sqlite3VdbeMemSetInt64(tls, pOut, _sqlite3BtreeOffset(tls, *(*uintptr)(unsafe.Pointer(pC2 + 48)))) + } + } + goto _187 + /* Opcode: Column P1 P2 P3 P4 P5 + ** Synopsis: r[P3]=PX cursor P1 column P2 + ** + ** Interpret the data that cursor P1 points to as a structure built using + ** the MakeRecord instruction. (See the MakeRecord opcode for additional + ** information about the format of the data.) Extract the P2-th column + ** from this record. If there are less than (P2+1) + ** values in the record, extract a NULL. + ** + ** The value extracted is stored in register P3. + ** + ** If the record contains fewer than P2 fields, then extract a NULL. Or, + ** if the P4 argument is a P4_MEM use the value of the P4 argument as + ** the result. + ** + ** If the OPFLAG_LENGTHARG bit is set in P5 then the result is guaranteed + ** to only be used by the length() function or the equivalent. The content + ** of large blobs is not loaded, thus saving CPU cycles. If the + ** OPFLAG_TYPEOFARG bit is set then the result will only be used by the + ** typeof() function or the IS NULL or IS NOT NULL operators or the + ** equivalent. In this case, all content loading can be omitted. + */ + _65: + ; /* PseudoTable input register */ + pC3 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + p22 = uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) + op_column_restart: + ; + aOffset = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaOffset + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus != (*TVdbe)(unsafe.Pointer(p)).FcacheCtr { /*OPTIMIZATION-IF-FALSE*/ + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FnullRow != 0 { + if int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FeCurType) == int32(CURTYPE_PSEUDO) && (*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult > 0 { + /* For the special case of as pseudo-cursor, the seekResult field + ** identifies the register that holds the record */ + pReg = aMem + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FseekResult)*56 + v213 = uint32((*TMem)(unsafe.Pointer(pReg)).Fn) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = v213 + (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = (*TMem)(unsafe.Pointer(pReg)).Fz + } else { + pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + _sqlite3VdbeMemSetNull(tls, pDest) + goto op_column_out + } + } else { + pCrsr = *(*uintptr)(unsafe.Pointer(pC3 + 48)) + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto != 0 { + if v215 = *(*uintptr)(unsafe.Pointer(pC3 + 16)) != 0; v215 { + v214 = *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC3 + 16)) + uintptr(uint32(1)+p22)*4)) + iMap = v214 + } + if v215 && v214 > uint32(0) { + pC3 = (*TVdbeCursor)(unsafe.Pointer(pC3)).FpAltCursor + p22 = iMap - uint32(1) + goto op_column_restart + } + rc = _sqlite3VdbeFinishMoveto(tls, pC3) + if rc != 0 { + goto abort_due_to_error + } + } else { + if _sqlite3BtreeCursorHasMoved(tls, pCrsr) != 0 { + rc = _sqlite3VdbeHandleMovedCursor(tls, pC3) + if rc != 0 { + goto abort_due_to_error + } + goto op_column_restart + } + } + (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize = _sqlite3BtreePayloadSize(tls, pCrsr) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = _sqlite3BtreePayloadFetch(tls, pCrsr, pC3+108) + /* Maximum page size is 64KiB */ + } + (*TVdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = (*TVdbe)(unsafe.Pointer(p)).FcacheCtr + v216 = uint32(*(*Tu8)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow))) + *(*Tu32)(unsafe.Pointer(aOffset)) = v216 + if v216 < uint32(0x80) { + (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(1) + } else { + (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(_sqlite3GetVarint32(tls, (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow, aOffset)) + } + (*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed = uint16(0) + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow < *(*Tu32)(unsafe.Pointer(aOffset)) { /*OPTIMIZATION-IF-FALSE*/ + /* pC->aRow does not have to hold the entire row, but it does at least + ** need to cover the header of the record. If pC->aRow does not contain + ** the complete header, then set it to zero, forcing the header to be + ** dynamically allocated. */ + (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow = uintptr(0) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow = uint32(0) + /* Make sure a corrupt database has not given us an oversize header. + ** Do this now to avoid an oversize memory allocation. + ** + ** Type entries can be between 1 and 5 bytes each. But 4 and 5 byte + ** types use so much data space that there can only be 4096 and 32 of + ** them, respectively. So the maximum header length results from a + ** 3-byte type for each of the maximum of 32768 columns plus three + ** extra bytes for the header length itself. 32768*3 + 3 = 98307. + */ + if *(*Tu32)(unsafe.Pointer(aOffset)) > uint32(98307) || *(*Tu32)(unsafe.Pointer(aOffset)) > (*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize { + goto op_column_corrupt + } + } else { + /* This is an optimization. By skipping over the first few tests + ** (ex: pC->nHdrParsed<=p2) in the next section, we achieve a + ** measurable performance gain. + ** + ** This branch is taken even if aOffset[0]==0. Such a record is never + ** generated by SQLite, and could be considered corruption, but we + ** accept it for historical reasons. When aOffset[0]==0, the code this + ** branch jumps to reads past the end of the record, but never more + ** than a few bytes. Even if the record occurs at the end of the page + ** content area, the "page header" comes after the page content and so + ** this overread is harmless. Similar overreads can occur for a corrupt + ** database file. + */ + zData = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow + /* Conditional skipped */ + goto op_column_read_header + } + } else { + if _sqlite3BtreeCursorHasMoved(tls, *(*uintptr)(unsafe.Pointer(pC3 + 48))) != 0 { + rc = _sqlite3VdbeHandleMovedCursor(tls, pC3) + if rc != 0 { + goto abort_due_to_error + } + goto op_column_restart + } + } + /* Make sure at least the first p2+1 entries of the header have been + ** parsed and valid information is in aOffset[] and pC->aType[]. + */ + if !(uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22) { + goto _217 + } + /* If there is more header available for parsing in the record, try + ** to extract additional fields up through the p2+1-th field + */ + if !((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset < *(*Tu32)(unsafe.Pointer(aOffset))) { + goto _219 + } + /* Make sure zData points to enough of the record to cover the header. */ + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { + libc.Xmemset(tls, bp+24, 0, uint64(56)) + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, *(*uintptr)(unsafe.Pointer(pC3 + 48)), *(*Tu32)(unsafe.Pointer(aOffset)), bp+24) + if rc != SQLITE_OK { + goto abort_due_to_error + } + zData = (*(*TMem)(unsafe.Pointer(bp + 24))).Fz + } else { + zData = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow + } + /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ + op_column_read_header: + ; + i1 = int32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) + offset64 = uint64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(i1)*4))) + zHdr = zData + uintptr((*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset) + zEndHdr = zData + uintptr(*(*Tu32)(unsafe.Pointer(aOffset))) + for cond := true; cond; cond = uint32(i1) <= p22 && zHdr < zEndHdr { + v222 = uint32(*(*Tu8)(unsafe.Pointer(zHdr))) + *(*Tu32)(unsafe.Pointer(bp + 80)) = v222 + v221 = v222 + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = v221 + if v221 < uint32(0x80) { + zHdr++ + offset64 += uint64(_sqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*Tu32)(unsafe.Pointer(bp + 80))))) + } else { + zHdr += uintptr(_sqlite3GetVarint32(tls, zHdr, bp+80)) + *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(i1)*4)) = *(*Tu32)(unsafe.Pointer(bp + 80)) + offset64 += uint64(_sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80)))) + } + i1++ + v223 = i1 + *(*Tu32)(unsafe.Pointer(aOffset + uintptr(v223)*4)) = uint32(offset64 & libc.Uint64FromUint32(0xffffffff)) + } + /* The record is corrupt if any of the following are true: + ** (1) the bytes of the header extend past the declared header size + ** (2) the entire header was used but not all data was used + ** (3) the end of the data extends beyond the end of the record. + */ + if zHdr >= zEndHdr && (zHdr > zEndHdr || offset64 != uint64((*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize)) || offset64 > uint64((*TVdbeCursor)(unsafe.Pointer(pC3)).FpayloadSize) { + if *(*Tu32)(unsafe.Pointer(aOffset)) == uint32(0) { + i1 = 0 + zHdr = zEndHdr + } else { + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { + _sqlite3VdbeMemRelease(tls, bp+24) + } + goto op_column_corrupt + } + } + (*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed = uint16(i1) + (*TVdbeCursor)(unsafe.Pointer(pC3)).FiHdrOffset = uint32(int64(zHdr) - int64(zData)) + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow == uintptr(0) { + _sqlite3VdbeMemRelease(tls, bp+24) + } + goto _220 + _219: + ; + *(*Tu32)(unsafe.Pointer(bp + 80)) = uint32(0) + _220: + ; + /* If after trying to extract new entries from the header, nHdrParsed is + ** still not up to p2, that means that the record has fewer than p2 + ** columns. So the result will be either the default value or a NULL. + */ + if uint32((*TVdbeCursor)(unsafe.Pointer(pC3)).FnHdrParsed) <= p22 { + pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) == -int32(10) { + _sqlite3VdbeMemShallowCopy(tls, pDest, *(*uintptr)(unsafe.Pointer(pOp + 16)), int32(MEM_Static)) + } else { + _sqlite3VdbeMemSetNull(tls, pDest) + } + goto op_column_out + } + goto _218 + _217: + ; + *(*Tu32)(unsafe.Pointer(bp + 80)) = *(*Tu32)(unsafe.Pointer(pC3 + 120 + uintptr(p22)*4)) + _218: + ; + /* Extract the content for the p2+1-th column. Control can only + ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are + ** all valid. + */ + pDest = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if int32((*TMem)(unsafe.Pointer(pDest)).Fflags)&(libc.Int32FromInt32(MEM_Agg)|libc.Int32FromInt32(MEM_Dyn)) != 0 { + _sqlite3VdbeMemSetNull(tls, pDest) + } + if (*TVdbeCursor)(unsafe.Pointer(pC3)).FszRow >= *(*Tu32)(unsafe.Pointer(aOffset + uintptr(p22+uint32(1))*4)) { + /* This is the common case where the desired content fits on the original + ** page - where the content is not on an overflow page */ + zData = (*TVdbeCursor)(unsafe.Pointer(pC3)).FaRow + uintptr(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(p22)*4))) + if *(*Tu32)(unsafe.Pointer(bp + 80)) < uint32(12) { + _sqlite3VdbeSerialGet(tls, zData, *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) + } else { + v224 = int32((*(*Tu32)(unsafe.Pointer(bp + 80)) - libc.Uint32FromInt32(12)) / libc.Uint32FromInt32(2)) + len1 = v224 + (*TMem)(unsafe.Pointer(pDest)).Fn = v224 + (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding + if (*TMem)(unsafe.Pointer(pDest)).FszMalloc < len1+int32(2) { + if len1 > *(*int32)(unsafe.Pointer(db + 136)) { + goto too_big + } + (*TMem)(unsafe.Pointer(pDest)).Fflags = uint16(MEM_Null) + if _sqlite3VdbeMemGrow(tls, pDest, len1+int32(2), 0) != 0 { + goto no_mem + } + } else { + (*TMem)(unsafe.Pointer(pDest)).Fz = (*TMem)(unsafe.Pointer(pDest)).FzMalloc + } + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pDest)).Fz, zData, uint64(len1)) + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pDest)).Fz + uintptr(len1))) = 0 + *(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pDest)).Fz + uintptr(len1+int32(1)))) = 0 + (*TMem)(unsafe.Pointer(pDest)).Fflags = _aFlag1[*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1)] + } + } else { + (*TMem)(unsafe.Pointer(pDest)).Fenc = encoding + /* This branch happens only when content is on overflow pages */ + v225 = uint8(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) & libc.Int32FromInt32(OPFLAG_BYTELENARG)) + p5 = v225 + if int32(v225) != 0 && (int32(p5) == int32(OPFLAG_TYPEOFARG) || *(*Tu32)(unsafe.Pointer(bp + 80)) >= uint32(12) && (*(*Tu32)(unsafe.Pointer(bp + 80))&uint32(1) == uint32(0) || int32(p5) == int32(OPFLAG_BYTELENARG))) || _sqlite3VdbeSerialTypeLen(tls, *(*Tu32)(unsafe.Pointer(bp + 80))) == uint32(0) { + /* Content is irrelevant for + ** 1. the typeof() function, + ** 2. the length(X) function if X is a blob, and + ** 3. if the content length is zero. + ** So we might as well use bogus content rather than reading + ** content from disk. + ** + ** Although sqlite3VdbeSerialGet() may read at most 8 bytes from the + ** buffer passed to it, debugging function VdbeMemPrettyPrint() may + ** read more. Use the global constant sqlite3CtypeMap[] as the array, + ** as that array is 256 bytes long (plenty for VdbeMemPrettyPrint()) + ** and it begins with a bunch of zeros. + */ + _sqlite3VdbeSerialGet(tls, uintptr(unsafe.Pointer(&_sqlite3CtypeMap)), *(*Tu32)(unsafe.Pointer(bp + 80)), pDest) + } else { + rc = _vdbeColumnFromOverflow(tls, pC3, int32(p22), int32(*(*Tu32)(unsafe.Pointer(bp + 80))), int64(*(*Tu32)(unsafe.Pointer(aOffset + uintptr(p22)*4))), (*TVdbe)(unsafe.Pointer(p)).FcacheCtr, colCacheCtr, pDest) + if rc != 0 { + if rc == int32(SQLITE_NOMEM) { + goto no_mem + } + if rc == int32(SQLITE_TOOBIG) { + goto too_big + } + goto abort_due_to_error + } + } + } + op_column_out: + ; + goto _187 + op_column_corrupt: + ; + if (*(*TOp)(unsafe.Pointer(aOp))).Fp3 > 0 { + pOp = aOp + uintptr((*(*TOp)(unsafe.Pointer(aOp))).Fp3-int32(1))*24 + goto _187 + } else { + rc = _sqlite3CorruptError(tls, int32(95863)) + goto abort_due_to_error + } + /* Opcode: TypeCheck P1 P2 P3 P4 * + ** Synopsis: typecheck(r[P1@P2]) + ** + ** Apply affinities to the range of P2 registers beginning with P1. + ** Take the affinities from the Table object in P4. If any value + ** cannot be coerced into the correct type, then raise an error. + ** + ** This opcode is similar to OP_Affinity except that this opcode + ** forces the register type to the Table column type. This is used + ** to implement "strict affinity". + ** + ** GENERATED ALWAYS AS ... STATIC columns are only checked if P3 + ** is zero. When P3 is non-zero, no type checking occurs for + ** static generated columns. Virtual columns are computed at query time + ** and so they are never checked. + ** + ** Preconditions: + ** + **
      + **
    • P2 should be the number of non-virtual columns in the + ** table of P4. + **
    • Table P4 should be a STRICT table. + **
    + ** + ** If any precondition is false, an assertion fault occurs. + */ + _66: + ; + pTab = *(*uintptr)(unsafe.Pointer(pOp + 16)) + aCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + i2 = 0 + for { + if !(i2 < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + if int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + goto _226 + } + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + pIn1 += 56 + goto _226 + } + } + _applyAffinity(tls, pIn1, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).Faffinity, encoding) + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) == 0 { + switch int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8)) & 0xf0 >> 4)) { + case int32(COLTYPE_BLOB): + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { + goto vdbe_type_error + } + case int32(COLTYPE_INTEGER): + fallthrough + case int32(COLTYPE_INT): + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) == 0 { + goto vdbe_type_error + } + case int32(COLTYPE_TEXT): + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Str) == 0 { + goto vdbe_type_error + } + case int32(COLTYPE_REAL): + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Int) != 0 { + /* When applying REAL affinity, if the result is still an MEM_Int + ** that will fit in 6 bytes, then change the type to MEM_IntReal + ** so that we keep the high-resolution integer value but know that + ** the type really wants to be REAL. */ + if *(*Ti64)(unsafe.Pointer(pIn1)) <= int64(140737488355327) && *(*Ti64)(unsafe.Pointer(pIn1)) >= -int64(140737488355328) { + p227 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p227)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p227))) | libc.Int32FromInt32(MEM_IntReal)) + p228 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p228)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p228))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p229 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p229)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p229))) | libc.Int32FromInt32(MEM_Real)) + p230 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p230)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p230))) & ^libc.Int32FromInt32(MEM_Int)) + } + } else { + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&(libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)) == 0 { + goto vdbe_type_error + } + } + default: + /* COLTYPE_ANY. Accept anything. */ + break + } + } + pIn1 += 56 + goto _226 + _226: + ; + i2++ + } + goto _187 + vdbe_type_error: + ; + _sqlite3VdbeError(tls, p, __ccgo_ts+5698, libc.VaList(bp+944, _vdbeMemTypeName(tls, pIn1), _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(aCol + uintptr(i2)*16 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(i2)*16))).FzCnName)) + rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(12)<= -int64(140737488355328) { + p231 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p231)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p231))) | libc.Int32FromInt32(MEM_IntReal)) + p232 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p232)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p232))) & ^libc.Int32FromInt32(MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pIn1)) = float64(*(*Ti64)(unsafe.Pointer(pIn1))) + p233 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p233)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p233))) | libc.Int32FromInt32(MEM_Real)) + p234 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p234)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p234))) & ^(libc.Int32FromInt32(MEM_Int) | libc.Int32FromInt32(MEM_Str))) + } + } + zAffinity++ + if int32(*(*int8)(unsafe.Pointer(zAffinity))) == 0 { + break + } + pIn1 += 56 + } + goto _187 + /* Opcode: MakeRecord P1 P2 P3 P4 * + ** Synopsis: r[P3]=mkrec(r[P1@P2]) + ** + ** Convert P2 registers beginning with P1 into the [record format] + ** use as a data record in a database table or as a key + ** in an index. The OP_Column opcode can decode the record later. + ** + ** P4 may be a string that is P2 characters long. The N-th character of the + ** string indicates the column affinity that should be used for the N-th + ** field of the index key. + ** + ** The mapping from character to affinity is given by the SQLITE_AFF_ + ** macros defined in sqliteInt.h. + ** + ** If P4 is NULL then all index fields have the affinity BLOB. + ** + ** The meaning of P5 depends on whether or not the SQLITE_ENABLE_NULL_TRIM + ** compile-time option is enabled: + ** + ** * If SQLITE_ENABLE_NULL_TRIM is enabled, then the P5 is the index + ** of the right-most table that can be null-trimmed. + ** + ** * If SQLITE_ENABLE_NULL_TRIM is omitted, then P5 has the value + ** OPFLAG_NOCHNG_MAGIC if the OP_MakeRecord opcode is allowed to + ** accept no-change records with serial_type 10. This value is + ** only used inside an assert() and does not affect the end result. + */ + _68: + ; /* Where to write next byte of the payload */ + /* Assuming the record contains N fields, the record format looks + ** like this: + ** + ** ------------------------------------------------------------------------ + ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | + ** ------------------------------------------------------------------------ + ** + ** Data(0) is taken from register P1. Data(1) comes from register P1+1 + ** and so forth. + ** + ** Each type field is a varint representing the serial type of the + ** corresponding data element (see sqlite3VdbeSerialType()). The + ** hdr-size field is also a varint which is the offset from the beginning + ** of the record to data0. + */ + nData = uint64(0) /* Number of bytes of data space */ + nHdr = 0 /* Number of bytes of header space */ + nZero = 0 /* Number of zero bytes at the end of the record */ + nField = (*TOp)(unsafe.Pointer(pOp)).Fp1 + zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pData0 = aMem + uintptr(nField)*56 + nField = (*TOp)(unsafe.Pointer(pOp)).Fp2 + pLast = pData0 + uintptr(nField-int32(1))*56 + /* Identify the output register */ + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + /* Apply the requested affinity to all inputs + */ + if zAffinity1 != 0 { + pRec = pData0 + for cond := true; cond; cond = *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { + _applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) + if int32(*(*int8)(unsafe.Pointer(zAffinity1))) == int32(SQLITE_AFF_REAL) && int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Int) != 0 { + p235 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p235)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p235))) | libc.Int32FromInt32(MEM_IntReal)) + p236 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p236)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p236))) & ^libc.Int32FromInt32(MEM_Int)) + } + zAffinity1++ + pRec += 56 + } + } + /* Loop through the elements that will make up the record to figure + ** out how much space is required for the new record. After this loop, + ** the Mem.uTemp field of each term should hold the serial-type that will + ** be used for that term in the generated record: + ** + ** Mem.uTemp value type + ** --------------- --------------- + ** 0 NULL + ** 1 1-byte signed integer + ** 2 2-byte signed integer + ** 3 3-byte signed integer + ** 4 4-byte signed integer + ** 5 6-byte signed integer + ** 6 8-byte signed integer + ** 7 IEEE float + ** 8 Integer constant 0 + ** 9 Integer constant 1 + ** 10,11 reserved for expansion + ** N>=12 and even BLOB + ** N>=13 and odd text + ** + ** The following additional values are computed: + ** nHdr Number of bytes needed for the record header + ** nData Number of bytes of data space needed for the record + ** nZero Zero bytes at the end of the record + */ + pRec = pLast + for cond := true; cond; cond = int32(1) != 0 { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Null) != 0 { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Zero) != 0 { + /* Values with MEM_Null and MEM_Zero are created by xColumn virtual + ** table methods that never invoke sqlite3_result_xxxxx() while + ** computing an unchanging column value in an UPDATE statement. + ** Give such values a special internal-use-only serial-type of 10 + ** so that they can be passed through to xUpdate and have + ** a true sqlite3_value_nochange(). */ + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(10) + } else { + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(0) + } + nHdr++ + } else { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) != 0 { + /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */ + i3 = *(*Ti64)(unsafe.Pointer(pRec)) + if i3 < 0 { + uu = uint64(^i3) + } else { + uu = uint64(i3) + } + nHdr++ + if uu <= uint64(127) { + if i3&int64(1) == i3 && int32((*TVdbe)(unsafe.Pointer(p)).FminWriteFileFormat) >= int32(4) { + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(8) + uint32(uu) + } else { + nData++ + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(1) + } + } else { + if uu <= uint64(32767) { + nData += uint64(2) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(2) + } else { + if uu <= uint64(8388607) { + nData += uint64(3) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(3) + } else { + if uu <= uint64(2147483647) { + nData += uint64(4) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(4) + } else { + if uu <= uint64(140737488355327) { + nData += uint64(6) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(5) + } else { + nData += uint64(8) + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_IntReal) != 0 { + /* If the value is IntReal and is going to take up 8 bytes to store + ** as an integer, then we might as well make it an 8-byte floating + ** point value */ + *(*float64)(unsafe.Pointer(pRec)) = float64(*(*Ti64)(unsafe.Pointer(pRec))) + p237 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p237)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p237))) & ^libc.Int32FromInt32(MEM_IntReal)) + p238 = pRec + 20 + *(*Tu16)(unsafe.Pointer(p238)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p238))) | libc.Int32FromInt32(MEM_Real)) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) + } else { + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(6) + } + } + } + } + } + } + } else { + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Real) != 0 { + nHdr++ + nData += uint64(8) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = uint32(7) + } else { + len11 = uint32((*TMem)(unsafe.Pointer(pRec)).Fn) + serial_type = len11*uint32(2) + uint32(12) + libc.BoolUint32(int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&libc.Int32FromInt32(MEM_Str) != libc.Int32FromInt32(0)) + if int32((*TMem)(unsafe.Pointer(pRec)).Fflags)&int32(MEM_Zero) != 0 { + serial_type += uint32(*(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pRec)).Fu)) * int32(2)) + if nData != 0 { + if _sqlite3VdbeMemExpandBlob(tls, pRec) != 0 { + goto no_mem + } + len11 += uint32(*(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pRec)).Fu))) + } else { + nZero += int64(*(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pRec)).Fu))) + } + } + nData += uint64(len11) + nHdr += _sqlite3VarintLen(tls, uint64(serial_type)) + (*TMem)(unsafe.Pointer(pRec)).FuTemp = serial_type + } + } + } + if pRec == pData0 { + break + } + pRec -= 56 + } + /* EVIDENCE-OF: R-22564-11647 The header begins with a single varint + ** which determines the total number of bytes in the header. The varint + ** value is the size of the header in bytes including the size varint + ** itself. */ + if nHdr <= int32(126) { + /* The common case */ + nHdr += int32(1) + } else { + /* Rare case of a really large header */ + nVarint = _sqlite3VarintLen(tls, uint64(nHdr)) + nHdr += nVarint + if nVarint < _sqlite3VarintLen(tls, uint64(nHdr)) { + nHdr++ + } + } + nByte1 = int64(uint64(nHdr) + nData) + /* Make sure the output register has a buffer large enough to store + ** the new record. The output register (pOp->p3) is not allowed to + ** be one of the input registers (because the following call to + ** sqlite3VdbeMemClearAndResize() could clobber the value before it is used). + */ + if nByte1+nZero <= int64((*TMem)(unsafe.Pointer(pOut)).FszMalloc) { + /* The output register is already large enough to hold the record. + ** No error checks or buffer enlargement is required */ + (*TMem)(unsafe.Pointer(pOut)).Fz = (*TMem)(unsafe.Pointer(pOut)).FzMalloc + } else { + /* Need to make sure that the output is not too big and then enlarge + ** the output register to hold the full result */ + if nByte1+nZero > int64(*(*int32)(unsafe.Pointer(db + 136))) { + goto too_big + } + if _sqlite3VdbeMemClearAndResize(tls, pOut, int32(nByte1)) != 0 { + goto no_mem + } + } + (*TMem)(unsafe.Pointer(pOut)).Fn = int32(nByte1) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Blob) + if nZero != 0 { + *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pOut)).Fu)) = int32(nZero) + p239 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p239)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p239))) | libc.Int32FromInt32(MEM_Zero)) + } + zHdr1 = (*TMem)(unsafe.Pointer(pOut)).Fz + zPayload = zHdr1 + uintptr(nHdr) + /* Write the record */ + if nHdr < int32(0x80) { + v240 = zHdr1 + zHdr1++ + *(*Tu8)(unsafe.Pointer(v240)) = uint8(nHdr) + } else { + zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(nHdr))) + } + pRec = pData0 + for int32(1) != 0 { + serial_type = (*TMem)(unsafe.Pointer(pRec)).FuTemp + /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more + ** additional varints, one per column. + ** EVIDENCE-OF: R-64536-51728 The values for each column in the record + ** immediately follow the header. */ + if serial_type <= uint32(7) { + v241 = zHdr1 + zHdr1++ + *(*Tu8)(unsafe.Pointer(v241)) = uint8(serial_type) + if serial_type == uint32(0) { + /* NULL value. No change in zPayload */ + } else { + if serial_type == uint32(7) { + libc.Xmemcpy(tls, bp+88, pRec, uint64(8)) + } else { + *(*Tu64)(unsafe.Pointer(bp + 88)) = uint64(*(*Ti64)(unsafe.Pointer(pRec))) + } + len11 = uint32(_sqlite3SmallTypeSizes[serial_type]) + switch len11 { + default: + *(*Tu8)(unsafe.Pointer(zPayload + 7)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + *(*Tu8)(unsafe.Pointer(zPayload + 6)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + fallthrough + case uint32(6): + *(*Tu8)(unsafe.Pointer(zPayload + 5)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + *(*Tu8)(unsafe.Pointer(zPayload + 4)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + fallthrough + case uint32(4): + *(*Tu8)(unsafe.Pointer(zPayload + 3)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + fallthrough + case uint32(3): + *(*Tu8)(unsafe.Pointer(zPayload + 2)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + fallthrough + case uint32(2): + *(*Tu8)(unsafe.Pointer(zPayload + 1)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + *(*Tu64)(unsafe.Pointer(bp + 88)) >>= uint64(8) + fallthrough + case uint32(1): + *(*Tu8)(unsafe.Pointer(zPayload)) = uint8(*(*Tu64)(unsafe.Pointer(bp + 88)) & libc.Uint64FromInt32(0xff)) + } + zPayload += uintptr(len11) + } + } else { + if serial_type < uint32(0x80) { + v242 = zHdr1 + zHdr1++ + *(*Tu8)(unsafe.Pointer(v242)) = uint8(serial_type) + if serial_type >= uint32(14) && (*TMem)(unsafe.Pointer(pRec)).Fn > 0 { + libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) + zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) + } + } else { + zHdr1 += uintptr(_sqlite3PutVarint(tls, zHdr1, uint64(serial_type))) + if (*TMem)(unsafe.Pointer(pRec)).Fn != 0 { + libc.Xmemcpy(tls, zPayload, (*TMem)(unsafe.Pointer(pRec)).Fz, uint64((*TMem)(unsafe.Pointer(pRec)).Fn)) + zPayload += uintptr((*TMem)(unsafe.Pointer(pRec)).Fn) + } + } + } + if pRec == pLast { + break + } + pRec += 56 + } + goto _187 + /* Opcode: Count P1 P2 P3 * * + ** Synopsis: r[P2]=count() + ** + ** Store the number of entries (an integer value) in the table or index + ** opened by cursor P1 in register P2. + ** + ** If P3==0, then an exact count is obtained, which involves visiting + ** every btree page of the table. But if P3 is non-zero, an estimate + ** is returned based on the current cursor position. + */ + _69: + ; + pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 48)) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + *(*Ti64)(unsafe.Pointer(bp + 96)) = _sqlite3BtreeRowCountEst(tls, pCrsr1) + } else { + *(*Ti64)(unsafe.Pointer(bp + 96)) = 0 /* Not needed. Only used to silence a warning. */ + rc = _sqlite3BtreeCount(tls, db, pCrsr1, bp+96) + if rc != 0 { + goto abort_due_to_error + } + } + pOut = _out2Prerelease(tls, p, pOp) + *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(bp + 96)) + goto check_for_interrupt + /* Opcode: Savepoint P1 * * P4 * + ** + ** Open, release or rollback the savepoint named by parameter P4, depending + ** on the value of P1. To open a new savepoint set P1==0 (SAVEPOINT_BEGIN). + ** To release (commit) an existing savepoint set P1==1 (SAVEPOINT_RELEASE). + ** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). + */ + _70: + ; + p12 = (*TOp)(unsafe.Pointer(pOp)).Fp1 + zName = *(*uintptr)(unsafe.Pointer(pOp + 16)) + /* Assert that the p1 parameter is valid. Also that if there is no open + ** transaction, then there cannot be any savepoints. + */ + if p12 == SAVEPOINT_BEGIN { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 { + /* A new savepoint cannot be created if there are active write + ** statements (i.e. open read/write incremental blob handles). + */ + _sqlite3VdbeError(tls, p, __ccgo_ts+5739, 0) + rc = int32(SQLITE_BUSY) + } else { + nName = _sqlite3Strlen30(tls, zName) + /* This call is Ok even if this savepoint is actually a transaction + ** savepoint (and therefore should not prompt xSavepoint()) callbacks. + ** If this is a transaction savepoint being opened, it is guaranteed + ** that the db->aVTrans[] array is empty. */ + rc = _sqlite3VtabSavepoint(tls, db, SAVEPOINT_BEGIN, (*Tsqlite3)(unsafe.Pointer(db)).FnStatement+(*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint) + if rc != SQLITE_OK { + goto abort_due_to_error + } + /* Create a new savepoint structure. */ + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(32)+uint64(nName)+uint64(1)) + if pNew != 0 { + (*TSavepoint)(unsafe.Pointer(pNew)).FzName = pNew + 1*32 + libc.Xmemcpy(tls, (*TSavepoint)(unsafe.Pointer(pNew)).FzName, zName, uint64(nName+int32(1))) + /* If there is no open transaction, then mark this as a special + ** "transaction savepoint". */ + if (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) + (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = uint8(1) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint++ + } + /* Link the new savepoint into the database handle's list. */ + (*TSavepoint)(unsafe.Pointer(pNew)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint + (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint = pNew + (*TSavepoint)(unsafe.Pointer(pNew)).FnDeferredCons = (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons + (*TSavepoint)(unsafe.Pointer(pNew)).FnDeferredImmCons = (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons + } + } + } else { + iSavepoint = 0 + /* Find the named savepoint. If there is no such savepoint, then an + ** an error is returned to the user. */ + pSavepoint = (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint + for { + if !(pSavepoint != 0 && _sqlite3StrICmp(tls, (*TSavepoint)(unsafe.Pointer(pSavepoint)).FzName, zName) != 0) { + break + } + iSavepoint++ + goto _243 + _243: + ; + pSavepoint = (*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext + } + if !(pSavepoint != 0) { + _sqlite3VdbeError(tls, p, __ccgo_ts+5790, libc.VaList(bp+944, zName)) + rc = int32(SQLITE_ERROR) + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0 && p12 == int32(SAVEPOINT_RELEASE) { + /* It is not possible to release (commit) a savepoint if there are + ** active write statements. + */ + _sqlite3VdbeError(tls, p, __ccgo_ts+5812, 0) + rc = int32(SQLITE_BUSY) + } else { + /* Determine whether or not this is a transaction savepoint. If so, + ** and this is a RELEASE command, then the current transaction + ** is committed. + */ + isTransaction = libc.BoolInt32((*TSavepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0) + if isTransaction != 0 && p12 == int32(SAVEPOINT_RELEASE) { + v244 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v244 + if v244 != SQLITE_OK { + goto vdbe_return + } + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) + if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { + (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) + v245 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v245 + (*TVdbe)(unsafe.Pointer(p)).Frc = v245 + goto vdbe_return + } + rc = (*TVdbe)(unsafe.Pointer(p)).Frc + if rc != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(0) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = uint8(0) + } + } else { + iSavepoint = (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint - iSavepoint - int32(1) + if p12 == int32(SAVEPOINT_ROLLBACK) { + isSchemaChange = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_SchemaChange) != uint32(0)) + ii = 0 + for { + if !(ii < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + rc = _sqlite3BtreeTripAllCursors(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, libc.Int32FromInt32(SQLITE_ABORT)|libc.Int32FromInt32(2)< 0 { + /* If this instruction implements a COMMIT and other VMs are writing + ** return an error indicating that the other VMs must complete first. + */ + _sqlite3VdbeError(tls, p, __ccgo_ts+5866, 0) + rc = int32(SQLITE_BUSY) + goto abort_due_to_error + } else { + v248 = _sqlite3VdbeCheckFk(tls, p, int32(1)) + rc = v248 + if v248 != SQLITE_OK { + goto vdbe_return + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(desiredAutoCommit) + } + } + } + if _sqlite3VdbeHalt(tls, p) == int32(SQLITE_BUSY) { + (*TVdbe)(unsafe.Pointer(p)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(libc.Int32FromInt32(1) - desiredAutoCommit) + v249 = libc.Int32FromInt32(SQLITE_BUSY) + rc = v249 + (*TVdbe)(unsafe.Pointer(p)).Frc = v249 + goto vdbe_return + } + _sqlite3CloseSavepoints(tls, db) + if (*TVdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rc = int32(SQLITE_DONE) + } else { + rc = int32(SQLITE_ERROR) + } + goto vdbe_return + } else { + if !(desiredAutoCommit != 0) { + v250 = __ccgo_ts + 5921 + } else { + if iRollback != 0 { + v251 = __ccgo_ts + 5969 + } else { + v251 = __ccgo_ts + 6012 + } + v250 = v251 + } + _sqlite3VdbeError(tls, p, v250, 0) + rc = int32(SQLITE_ERROR) + goto abort_due_to_error + } + /* Opcode: Transaction P1 P2 P3 P4 P5 + ** + ** Begin a transaction on database P1 if a transaction is not already + ** active. + ** If P2 is non-zero, then a write-transaction is started, or if a + ** read-transaction is already active, it is upgraded to a write-transaction. + ** If P2 is zero, then a read-transaction is started. If P2 is 2 or more + ** then an exclusive transaction is started. + ** + ** P1 is the index of the database file on which the transaction is + ** started. Index 0 is the main database file and index 1 is the + ** file used for temporary tables. Indices of 2 or more are used for + ** attached databases. + ** + ** If a write-transaction is started and the Vdbe.usesStmtJournal flag is + ** true (this flag is set if the Vdbe may modify more than one row and may + ** throw an ABORT exception), a statement transaction may also be opened. + ** More specifically, a statement transaction is opened iff the database + ** connection is currently not in autocommit mode, or if there are other + ** active statements. A statement transaction allows the changes made by this + ** VDBE to be rolled back after an error without having to roll back the + ** entire transaction. If no error is encountered, the statement transaction + ** will automatically commit when the VDBE halts. + ** + ** If P5!=0 then this opcode also checks the schema cookie against P3 + ** and the schema generation counter against P4. + ** The cookie changes its value whenever the database schema changes. + ** This operation is used to detect when that the cookie has changed + ** and that the current process needs to reread the schema. If the schema + ** cookie in P3 differs from the schema cookie in the database header or + ** if the schema generation counter in P4 differs from the current + ** generation counter, then an SQLITE_SCHEMA error is raised and execution + ** halts. The sqlite3_step() wrapper function might then reprepare the + ** statement and rerun it from the beginning. + */ + _72: + ; + *(*int32)(unsafe.Pointer(bp + 104)) = 0 + if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(libc.Uint64FromInt32(SQLITE_QueryOnly)|uint64(libc.Int32FromInt32(0x00002))<>5)) != 0 && (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 && (int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1)) { + if (*TVdbe)(unsafe.Pointer(p)).FiStatement == 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement++ + (*TVdbe)(unsafe.Pointer(p)).FiStatement = (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement + } + rc = _sqlite3VtabSavepoint(tls, db, SAVEPOINT_BEGIN, (*TVdbe)(unsafe.Pointer(p)).FiStatement-int32(1)) + if rc == SQLITE_OK { + rc = _sqlite3BtreeBeginStmt(tls, pBt, (*TVdbe)(unsafe.Pointer(p)).FiStatement) + } + /* Store the current value of the database handles deferred constraint + ** counter. If the statement transaction needs to be rolled back, + ** the value of this counter needs to be restored too. */ + (*TVdbe)(unsafe.Pointer(p)).FnStmtDefCons = (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons + (*TVdbe)(unsafe.Pointer(p)).FnStmtDefImmCons = (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons + } + } + if rc == SQLITE_OK && (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && (*(*int32)(unsafe.Pointer(bp + 104)) != (*TOp)(unsafe.Pointer(pOp)).Fp3 || (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FiGeneration != (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) { + /* + ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema + ** version is checked to ensure that the schema has not changed since the + ** SQL statement was prepared. + */ + _sqlite3DbFree(tls, db, (*TVdbe)(unsafe.Pointer(p)).FzErrMsg) + (*TVdbe)(unsafe.Pointer(p)).FzErrMsg = _sqlite3DbStrDup(tls, db, __ccgo_ts+6053) + /* If the schema-cookie from the database file matches the cookie + ** stored with the in-memory representation of the schema, do + ** not reload the schema from the database file. + ** + ** If virtual-tables are in use, this is not just an optimization. + ** Often, v-tables store their data in other SQLite tables, which + ** are queried from within xNext() and other v-table methods using + ** prepared queries. If such a query is out-of-date, we do not want to + ** discard the database schema, as the user code implementing the + ** v-table would have to be ready for the sqlite3_vtab structure itself + ** to be invalidated whenever sqlite3_step() is called from within + ** a v-table method. + */ + if (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpSchema)).Fschema_cookie != *(*int32)(unsafe.Pointer(bp + 104)) { + _sqlite3ResetOneSchema(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) + } + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(1), 0, 0x3) + rc = int32(SQLITE_SCHEMA) + /* Set changeCntOn to 0 to prevent the value returned by sqlite3_changes() + ** from being modified in sqlite3VdbeHalt(). If this statement is + ** reprepared, changeCntOn will be set again. */ + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 4, 0x10) + } + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: ReadCookie P1 P2 P3 * * + ** + ** Read cookie number P3 from database P1 and write it into register P2. + ** P3==1 is the schema version. P3==2 is the database format. + ** P3==3 is the recommended pager cache size, and so forth. P1==0 is + ** the main database file and P1==1 is the database file used to store + ** temporary tables. + ** + ** There must be a read-lock on the database (either a transaction + ** must be started or there must be an open cursor) before + ** executing this instruction. + */ + _73: + ; + iDb = (*TOp)(unsafe.Pointer(pOp)).Fp1 + iCookie = (*TOp)(unsafe.Pointer(pOp)).Fp3 + _sqlite3BtreeGetMeta(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt, iCookie, bp+108) + pOut = _out2Prerelease(tls, p, pOp) + *(*Ti64)(unsafe.Pointer(pOut)) = int64(*(*int32)(unsafe.Pointer(bp + 108))) + goto _187 + /* Opcode: SetCookie P1 P2 P3 * P5 + ** + ** Write the integer value P3 into cookie number P2 of database P1. + ** P2==1 is the schema version. P2==2 is the database format. + ** P2==3 is the recommended pager cache + ** size, and so forth. P1==0 is the main database file and P1==1 is the + ** database file used to store temporary tables. + ** + ** A transaction must be started before executing this opcode. + ** + ** If P2 is the SCHEMA_VERSION cookie (cookie number 1) then the internal + ** schema version is set to P3-P5. The "PRAGMA schema_version=N" statement + ** has P5 set to 1, so that the internal schema version will be different + ** from the database schema version, resulting in a schema reset. + */ + _74: + ; + pDb1 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 + /* See note about index shifting on OP_ReadCookie */ + rc = _sqlite3BtreeUpdateMeta(tls, (*TDb)(unsafe.Pointer(pDb1)).FpBt, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint32((*TOp)(unsafe.Pointer(pOp)).Fp3)) + if (*TOp)(unsafe.Pointer(pOp)).Fp2 == int32(BTREE_SCHEMA_VERSION) { + /* When the schema cookie changes, record the new cookie internally */ + *(*Tu32)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb1)).FpSchema)) = *(*Tu32)(unsafe.Pointer(pOp + 12)) - uint32((*TOp)(unsafe.Pointer(pOp)).Fp5) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) + _sqlite3FkClearTriggerCache(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) + } else { + if (*TOp)(unsafe.Pointer(pOp)).Fp2 == int32(BTREE_FILE_FORMAT) { + /* Record changes in the file format */ + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb1)).FpSchema)).Ffile_format = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) + } + } + if (*TOp)(unsafe.Pointer(pOp)).Fp1 == int32(1) { + /* Invalidate all prepared statements whenever the TEMP database + ** schema is changed. Ticket #1644 */ + _sqlite3ExpirePreparedStatements(tls, db, 0) + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) + } + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: OpenRead P1 P2 P3 P4 P5 + ** Synopsis: root=P2 iDb=P3 + ** + ** Open a read-only cursor for the database table whose root page is + ** P2 in a database file. The database file is determined by P3. + ** P3==0 means the main database, P3==1 means the database used for + ** temporary tables, and P3>1 means used the corresponding attached + ** database. Give the new cursor an identifier of P1. The P1 + ** values need not be contiguous but all P1 values should be small integers. + ** It is an error for P1 to be negative. + ** + ** Allowed P5 bits: + **
      + **
    • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + ** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + ** of OP_SeekLE/OP_IdxLT) + **
    + ** + ** The P4 value may be either an integer (P4_INT32) or a pointer to + ** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + ** object, then table being opened must be an [index b-tree] where the + ** KeyInfo object defines the content and collating + ** sequence of that index b-tree. Otherwise, if P4 is an integer + ** value, then the table being opened must be a [table b-tree] with a + ** number of columns no less than the value of P4. + ** + ** See also: OpenWrite, ReopenIdx + */ + /* Opcode: ReopenIdx P1 P2 P3 P4 P5 + ** Synopsis: root=P2 iDb=P3 + ** + ** The ReopenIdx opcode works like OP_OpenRead except that it first + ** checks to see if the cursor on P1 is already open on the same + ** b-tree and if it is this opcode becomes a no-op. In other words, + ** if the cursor is already open, do not reopen it. + ** + ** The ReopenIdx opcode may only be used with P5==0 or P5==OPFLAG_SEEKEQ + ** and with P4 being a P4_KEYINFO object. Furthermore, the P3 value must + ** be the same as every other ReopenIdx or OpenRead for the same cursor + ** number. + ** + ** Allowed P5 bits: + **
      + **
    • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + ** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + ** of OP_SeekLE/OP_IdxLT) + **
    + ** + ** See also: OP_OpenRead, OP_OpenWrite + */ + /* Opcode: OpenWrite P1 P2 P3 P4 P5 + ** Synopsis: root=P2 iDb=P3 + ** + ** Open a read/write cursor named P1 on the table or index whose root + ** page is P2 (or whose root page is held in register P2 if the + ** OPFLAG_P2ISREG bit is set in P5 - see below). + ** + ** The P4 value may be either an integer (P4_INT32) or a pointer to + ** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + ** object, then table being opened must be an [index b-tree] where the + ** KeyInfo object defines the content and collating + ** sequence of that index b-tree. Otherwise, if P4 is an integer + ** value, then the table being opened must be a [table b-tree] with a + ** number of columns no less than the value of P4. + ** + ** Allowed P5 bits: + **
      + **
    • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + ** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + ** of OP_SeekLE/OP_IdxLT) + **
    • 0x08 OPFLAG_FORDELETE: This cursor is used only to seek + ** and subsequently delete entries in an index btree. This is a + ** hint to the storage engine that the storage engine is allowed to + ** ignore. The hint is not used by the official SQLite b*tree storage + ** engine, but is used by COMDB2. + **
    • 0x10 OPFLAG_P2ISREG: Use the content of register P2 + ** as the root page, not the value of P2 itself. + **
    + ** + ** This instruction works like OpenRead except that it opens the cursor + ** in read/write mode. + ** + ** See also: OP_OpenRead, OP_ReopenIdx + */ + _77: + ; + pCur = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if pCur != 0 && (*TVdbeCursor)(unsafe.Pointer(pCur)).FpgnoRoot == uint32((*TOp)(unsafe.Pointer(pOp)).Fp2) { + /* Guaranteed by the code generator */ + _sqlite3BtreeClearCursor(tls, *(*uintptr)(unsafe.Pointer(pCur + 48))) + goto open_cursor_set_hints + } + /* If the cursor is not currently open or is open on a different + ** index, then fall through into OP_OpenRead to force a reopen */ + _76: + ; /* ncycle */ + _75: + ; + if int32(Tbft(*(*uint16)(unsafe.Pointer(p + 200))&0x3>>0)) == int32(1) { + rc = libc.Int32FromInt32(SQLITE_ABORT) | libc.Int32FromInt32(2)<>2))), 2, 0x4) + *(*uintptr)(unsafe.Pointer(pCx + 16)) = *(*uintptr)(unsafe.Pointer(pOrig + 16)) + libc.SetBitFieldPtr8Uint32(pCx+8, libc.Uint32FromInt32(1), 3, 0x8) + libc.SetBitFieldPtr8Uint32(pOrig+8, libc.Uint32FromInt32(1), 3, 0x8) + rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx)).FpgnoRoot, int32(BTREE_WRCSR), (*TVdbeCursor)(unsafe.Pointer(pCx)).FpKeyInfo, *(*uintptr)(unsafe.Pointer(pCx + 48))) + /* The sqlite3BtreeCursor() routine can only fail for the first cursor + ** opened for a database. Since there is already an open cursor when this + ** opcode is run, the sqlite3BtreeCursor() cannot fail */ + goto _187 + /* Opcode: OpenEphemeral P1 P2 P3 P4 P5 + ** Synopsis: nColumn=P2 + ** + ** Open a new cursor P1 to a transient table. + ** The cursor is always opened read/write even if + ** the main database is read-only. The ephemeral + ** table is deleted automatically when the cursor is closed. + ** + ** If the cursor P1 is already opened on an ephemeral table, the table + ** is cleared (all content is erased). + ** + ** P2 is the number of columns in the ephemeral table. + ** The cursor points to a BTree table if P4==0 and to a BTree index + ** if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure + ** that defines the format of keys in the index. + ** + ** The P5 parameter can be a mask of the BTREE_* flags defined + ** in btree.h. These flags control aspects of the operation of + ** the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are + ** added automatically. + ** + ** If P3 is positive, then reg[P3] is modified slightly so that it + ** can be used as zero-length data for OP_Insert. This is an optimization + ** that avoids an extra OP_Blob opcode to initialize that register. + */ + /* Opcode: OpenAutoindex P1 P2 * P4 * + ** Synopsis: nColumn=P2 + ** + ** This opcode works the same as OP_OpenEphemeral. It has a + ** different name to distinguish its use. Tables created using + ** by this opcode will be used for automatically created transient + ** indices in joins. + */ + _80: + ; /* ncycle */ + _79: + ; + if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { + /* Make register reg[P3] into a value that can be used as the data + ** form sqlite3BtreeInsert() where the length of the data is zero. */ + /* Only used when number of columns is zero */ + (*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fn = 0 + (*(*TMem)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56))).Fz = __ccgo_ts + 1680 + } + pCx1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if pCx1 != 0 && !(int32(TBool(*(*uint8)(unsafe.Pointer(pCx1 + 8))&0x8>>3)) != 0) && (*TOp)(unsafe.Pointer(pOp)).Fp2 <= int32((*TVdbeCursor)(unsafe.Pointer(pCx1)).FnField) { + /* If the ephemeral table is already open and has no duplicates from + ** OP_OpenDup, then erase all existing content so that the table is + ** empty again, rather than creating a new table. */ + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FseqCount = 0 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FcacheStatus = uint32(CACHE_STALE) + rc = _sqlite3BtreeClearTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), int32((*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot), uintptr(0)) + } else { + pCx1 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_BTREE)) + if pCx1 == uintptr(0) { + goto no_mem + } + libc.SetBitFieldPtr8Uint32(pCx1+8, libc.Uint32FromInt32(1), 0, 0x1) + rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, pCx1+16, libc.Int32FromInt32(BTREE_OMIT_JOURNAL)|libc.Int32FromInt32(BTREE_SINGLE)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5), _vfsFlags) + if rc == SQLITE_OK { + rc = _sqlite3BtreeBeginTrans(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), int32(1), uintptr(0)) + if rc == SQLITE_OK { + /* If a transient index is required, create it by calling + ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before + ** opening it. If a transient table is required, just use the + ** automatically created table with root-page 1 (an BLOB_INTKEY table). + */ + v253 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pKeyInfo2 = v253 + v252 = v253 + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpKeyInfo = v252 + if v252 != uintptr(0) { + rc = _sqlite3BtreeCreateTable(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), pCx1+68, int32(BTREE_BLOBKEY)|int32((*TOp)(unsafe.Pointer(pOp)).Fp5)) + if rc == SQLITE_OK { + rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, int32(BTREE_WRCSR), pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 48))) + } + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FisTable = uint8(0) + } else { + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot = uint32(SCHEMA_ROOT) + rc = _sqlite3BtreeCursor(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16)), uint32(SCHEMA_ROOT), int32(BTREE_WRCSR), uintptr(0), *(*uintptr)(unsafe.Pointer(pCx1 + 48))) + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FisTable = uint8(1) + } + } + libc.SetBitFieldPtr8Uint32(pCx1+8, libc.BoolUint32(int32((*TOp)(unsafe.Pointer(pOp)).Fp5) != libc.Int32FromInt32(BTREE_UNORDERED)), 2, 0x4) + if rc != 0 { + _sqlite3BtreeClose(tls, *(*uintptr)(unsafe.Pointer(pCx1 + 16))) + } + } + } + if rc != 0 { + goto abort_due_to_error + } + (*TVdbeCursor)(unsafe.Pointer(pCx1)).FnullRow = uint8(1) + goto _187 + /* Opcode: SorterOpen P1 P2 P3 P4 * + ** + ** This opcode works like OP_OpenEphemeral except that it opens + ** a transient index that is specifically designed to sort large + ** tables using an external merge-sort algorithm. + ** + ** If argument P3 is non-zero, then it indicates that the sorter may + ** assume that a stable sort considering the first P3 fields of each + ** key is sufficient to produce the required results. + */ + _81: + ; + pCx2 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, uint8(CURTYPE_SORTER)) + if pCx2 == uintptr(0) { + goto no_mem + } + (*TVdbeCursor)(unsafe.Pointer(pCx2)).FpKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16)) + rc = _sqlite3VdbeSorterInit(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp3, pCx2) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: SequenceTest P1 P2 * * * + ** Synopsis: if( cursor[P1].ctr++ ) pc = P2 + ** + ** P1 is a sorter cursor. If the sequence counter is currently zero, jump + ** to P2. Regardless of whether or not the jump is taken, increment the + ** the sequence value. + */ + _82: + ; + pC4 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + v255 = pC4 + 24 + v254 = *(*Ti64)(unsafe.Pointer(v255)) + *(*Ti64)(unsafe.Pointer(v255))++ + if v254 == 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: OpenPseudo P1 P2 P3 * * + ** Synopsis: P3 columns in r[P2] + ** + ** Open a new cursor that points to a fake table that contains a single + ** row of data. The content of that one row is the content of memory + ** register P2. In other words, cursor P1 becomes an alias for the + ** MEM_Blob content contained in register P2. + ** + ** A pseudo-table created by this opcode is used to hold a single + ** row output from the sorter so that the row can be decomposed into + ** individual columns using the OP_Column opcode. The OP_Column opcode + ** is the only cursor opcode that works with a pseudo-table. + ** + ** P3 is the number of fields in the records that will be stored by + ** the pseudo-table. + */ + _83: + ; + pCx3 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp3, uint8(CURTYPE_PSEUDO)) + if pCx3 == uintptr(0) { + goto no_mem + } + (*TVdbeCursor)(unsafe.Pointer(pCx3)).FnullRow = uint8(1) + (*TVdbeCursor)(unsafe.Pointer(pCx3)).FseekResult = (*TOp)(unsafe.Pointer(pOp)).Fp2 + (*TVdbeCursor)(unsafe.Pointer(pCx3)).FisTable = uint8(1) + /* Give this pseudo-cursor a fake BtCursor pointer so that pCx + ** can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test + ** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto() + ** which is a performance optimization */ + *(*uintptr)(unsafe.Pointer(pCx3 + 48)) = _sqlite3BtreeFakeValidCursor(tls) + goto _187 + /* Opcode: Close P1 * * * * + ** + ** Close a cursor previously opened as P1. If P1 is not + ** currently open, this instruction is a no-op. + */ + _84: + ; /* ncycle */ + _sqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8))) + *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) + goto _187 + /* Opcode: SeekGE P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + ** use the value in register P3 as the key. If cursor P1 refers + ** to an SQL index, then P3 is the first in an array of P4 registers + ** that are used as an unpacked index key. + ** + ** Reposition cursor P1 so that it points to the smallest entry that + ** is greater than or equal to the key value. If there are no records + ** greater than or equal to the key and P2 is not zero, then jump to P2. + ** + ** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + ** opcode will either land on a record that exactly matches the key, or + ** else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + ** this opcode must be followed by an IdxLE opcode with the same arguments. + ** The IdxGT opcode will be skipped if this opcode succeeds, but the + ** IdxGT opcode will be used on subsequent loop iterations. The + ** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + ** is an equality search. + ** + ** This opcode leaves the cursor configured to move in forward order, + ** from the beginning toward the end. In other words, the cursor is + ** configured to use Next, not Prev. + ** + ** See also: Found, NotFound, SeekLt, SeekGt, SeekLe + */ + /* Opcode: SeekGT P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + ** use the value in register P3 as a key. If cursor P1 refers + ** to an SQL index, then P3 is the first in an array of P4 registers + ** that are used as an unpacked index key. + ** + ** Reposition cursor P1 so that it points to the smallest entry that + ** is greater than the key value. If there are no records greater than + ** the key and P2 is not zero, then jump to P2. + ** + ** This opcode leaves the cursor configured to move in forward order, + ** from the beginning toward the end. In other words, the cursor is + ** configured to use Next, not Prev. + ** + ** See also: Found, NotFound, SeekLt, SeekGe, SeekLe + */ + /* Opcode: SeekLT P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + ** use the value in register P3 as a key. If cursor P1 refers + ** to an SQL index, then P3 is the first in an array of P4 registers + ** that are used as an unpacked index key. + ** + ** Reposition cursor P1 so that it points to the largest entry that + ** is less than the key value. If there are no records less than + ** the key and P2 is not zero, then jump to P2. + ** + ** This opcode leaves the cursor configured to move in reverse order, + ** from the end toward the beginning. In other words, the cursor is + ** configured to use Prev, not Next. + ** + ** See also: Found, NotFound, SeekGt, SeekGe, SeekLe + */ + /* Opcode: SeekLE P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + ** use the value in register P3 as a key. If cursor P1 refers + ** to an SQL index, then P3 is the first in an array of P4 registers + ** that are used as an unpacked index key. + ** + ** Reposition cursor P1 so that it points to the largest entry that + ** is less than or equal to the key value. If there are no records + ** less than or equal to the key and P2 is not zero, then jump to P2. + ** + ** This opcode leaves the cursor configured to move in reverse order, + ** from the end toward the beginning. In other words, the cursor is + ** configured to use Prev, not Next. + ** + ** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + ** opcode will either land on a record that exactly matches the key, or + ** else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + ** this opcode must be followed by an IdxLE opcode with the same arguments. + ** The IdxGE opcode will be skipped if this opcode succeeds, but the + ** IdxGE opcode will be used on subsequent loop iterations. The + ** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + ** is an equality search. + ** + ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt + */ + _88: + ; /* jump, in3, group, ncycle */ + _87: + ; /* jump, in3, group, ncycle */ + _86: + ; /* jump, in3, group, ncycle */ + _85: + ; /* Only interested in == results */ + pC5 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + oc = int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) + eqOnly = 0 + (*TVdbeCursor)(unsafe.Pointer(pC5)).FnullRow = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC5)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC5)).FcacheStatus = uint32(CACHE_STALE) + if (*TVdbeCursor)(unsafe.Pointer(pC5)).FisTable != 0 { + /* The OPFLAG_SEEKEQ/BTREE_SEEK_EQ flag is only set on index cursors */ + /* The input value in P3 might be of any type: integer, real, string, + ** blob, or NULL. But it needs to be an integer before we can do + ** the seek, so convert it. */ + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + flags31 = (*TMem)(unsafe.Pointer(pIn3)).Fflags + if int32(flags31)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_Real)|libc.Int32FromInt32(MEM_IntReal)|libc.Int32FromInt32(MEM_Str)) == int32(MEM_Str) { + _applyNumericAffinity(tls, pIn3, 0) + } + iKey = _sqlite3VdbeIntValue(tls, pIn3) /* Get the integer key value */ + newType = (*TMem)(unsafe.Pointer(pIn3)).Fflags /* Record the type after applying numeric affinity */ + (*TMem)(unsafe.Pointer(pIn3)).Fflags = flags31 /* But convert the type back to its original */ + /* If the P3 value could not be converted into an integer without + ** loss of information, then special processing is required... */ + if int32(newType)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { + if int32(newType)&int32(MEM_Real) == 0 { + if int32(newType)&int32(MEM_Null) != 0 || oc >= int32(OP_SeekGE) { + goto jump_to_p2 + } else { + rc = _sqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+112) + if rc != SQLITE_OK { + goto abort_due_to_error + } + goto seek_not_found + } + } + c2 = _sqlite3IntFloatCompare(tls, iKey, *(*float64)(unsafe.Pointer(pIn3))) + /* If the approximation iKey is larger than the actual real search + ** term, substitute >= for > and < for <=. e.g. if the search term + ** is 4.9 and the integer approximation 5: + ** + ** (x > 4.9) -> (x >= 5) + ** (x <= 4.9) -> (x < 5) + */ + if c2 > 0 { + if oc&int32(0x0001) == libc.Int32FromInt32(OP_SeekGT)&libc.Int32FromInt32(0x0001) { + oc-- + } + } else { + if c2 < 0 { + if oc&int32(0x0001) == libc.Int32FromInt32(OP_SeekLT)&libc.Int32FromInt32(0x0001) { + oc++ + } + } + } + } + rc = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), int64(uint64(iKey)), 0, bp+112) + (*TVdbeCursor)(unsafe.Pointer(pC5)).FmovetoTarget = iKey /* Used by OP_Delete */ + if rc != SQLITE_OK { + goto abort_due_to_error + } + } else { + /* For a cursor with the OPFLAG_SEEKEQ/BTREE_SEEK_EQ hint, only the + ** OP_SeekGE and OP_SeekLE opcodes are allowed, and these must be + ** immediately followed by an OP_IdxGT or OP_IdxLT opcode, respectively, + ** with the same key. + */ + if _sqlite3BtreeCursorHasHint(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), uint32(BTREE_SEEK_EQ)) != 0 { + eqOnly = int32(1) + } + nField2 = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC5)).FpKeyInfo + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FnField = uint16(nField2) + /* The next line of code computes as follows, only faster: + ** if( oc==OP_SeekGT || oc==OP_SeekLE ){ + ** r.default_rc = -1; + ** }else{ + ** r.default_rc = +1; + ** } + */ + if int32(1)&(oc-int32(OP_SeekLT)) != 0 { + v256 = -int32(1) + } else { + v256 = +libc.Int32FromInt32(1) + } + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).Fdefault_rc = int8(v256) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen = uint8(0) + rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), bp+120, bp+112) + if rc != SQLITE_OK { + goto abort_due_to_error + } + if eqOnly != 0 && int32((*(*TUnpackedRecord)(unsafe.Pointer(bp + 120))).FeqSeen) == 0 { + goto seek_not_found + } + } + if oc >= int32(OP_SeekGE) { + if *(*int32)(unsafe.Pointer(bp + 112)) < 0 || *(*int32)(unsafe.Pointer(bp + 112)) == 0 && oc == int32(OP_SeekGT) { + *(*int32)(unsafe.Pointer(bp + 112)) = 0 + rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), 0) + if rc != SQLITE_OK { + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 112)) = int32(1) + } else { + goto abort_due_to_error + } + } + } else { + *(*int32)(unsafe.Pointer(bp + 112)) = 0 + } + } else { + if *(*int32)(unsafe.Pointer(bp + 112)) > 0 || *(*int32)(unsafe.Pointer(bp + 112)) == 0 && oc == int32(OP_SeekLT) { + *(*int32)(unsafe.Pointer(bp + 112)) = 0 + rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48)), 0) + if rc != SQLITE_OK { + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 112)) = int32(1) + } else { + goto abort_due_to_error + } + } + } else { + /* res might be negative because the table is empty. Check to + ** see if this is the case. + */ + *(*int32)(unsafe.Pointer(bp + 112)) = _sqlite3BtreeEof(tls, *(*uintptr)(unsafe.Pointer(pC5 + 48))) + } + } + seek_not_found: + ; + if *(*int32)(unsafe.Pointer(bp + 112)) != 0 { + goto jump_to_p2 + } else { + if eqOnly != 0 { + pOp += 24 /* Skip the OP_IdxLt or OP_IdxGT that follows */ + } + } + goto _187 + /* Opcode: SeekScan P1 P2 * * P5 + ** Synopsis: Scan-ahead up to P1 rows + ** + ** This opcode is a prefix opcode to OP_SeekGE. In other words, this + ** opcode must be immediately followed by OP_SeekGE. This constraint is + ** checked by assert() statements. + ** + ** This opcode uses the P1 through P4 operands of the subsequent + ** OP_SeekGE. In the text that follows, the operands of the subsequent + ** OP_SeekGE opcode are denoted as SeekOP.P1 through SeekOP.P4. Only + ** the P1, P2 and P5 operands of this opcode are also used, and are called + ** This.P1, This.P2 and This.P5. + ** + ** This opcode helps to optimize IN operators on a multi-column index + ** where the IN operator is on the later terms of the index by avoiding + ** unnecessary seeks on the btree, substituting steps to the next row + ** of the b-tree instead. A correct answer is obtained if this opcode + ** is omitted or is a no-op. + ** + ** The SeekGE.P3 and SeekGE.P4 operands identify an unpacked key which + ** is the desired entry that we want the cursor SeekGE.P1 to be pointing + ** to. Call this SeekGE.P3/P4 row the "target". + ** + ** If the SeekGE.P1 cursor is not currently pointing to a valid row, + ** then this opcode is a no-op and control passes through into the OP_SeekGE. + ** + ** If the SeekGE.P1 cursor is pointing to a valid row, then that row + ** might be the target row, or it might be near and slightly before the + ** target row, or it might be after the target row. If the cursor is + ** currently before the target row, then this opcode attempts to position + ** the cursor on or after the target row by invoking sqlite3BtreeStep() + ** on the cursor between 1 and This.P1 times. + ** + ** The This.P5 parameter is a flag that indicates what to do if the + ** cursor ends up pointing at a valid row that is past the target + ** row. If This.P5 is false (0) then a jump is made to SeekGE.P2. If + ** This.P5 is true (non-zero) then a jump is made to This.P2. The P5==0 + ** case occurs when there are no inequality constraints to the right of + ** the IN constraint. The jump to SeekGE.P2 ends the loop. The P5!=0 case + ** occurs when there are inequality constraints to the right of the IN + ** operator. In that case, the This.P2 will point either directly to or + ** to setup code prior to the OP_IdxGT or OP_IdxGE opcode that checks for + ** loop terminate. + ** + ** Possible outcomes from this opcode:
      + ** + **
    1. If the cursor is initially not pointed to any valid row, then + ** fall through into the subsequent OP_SeekGE opcode. + ** + **
    2. If the cursor is left pointing to a row that is before the target + ** row, even after making as many as This.P1 calls to + ** sqlite3BtreeNext(), then also fall through into OP_SeekGE. + ** + **
    3. If the cursor is left pointing at the target row, either because it + ** was at the target row to begin with or because one or more + ** sqlite3BtreeNext() calls moved the cursor to the target row, + ** then jump to This.P2.., + ** + **
    4. If the cursor started out before the target row and a call to + ** to sqlite3BtreeNext() moved the cursor off the end of the index + ** (indicating that the target row definitely does not exist in the + ** btree) then jump to SeekGE.P2, ending the loop. + ** + **
    5. If the cursor ends up on a valid row that is past the target row + ** (indicating that the target row does not exist in the btree) then + ** jump to SeekOP.P2 if This.P5==0 or to This.P2 if This.P5>0. + **
    + */ + _89: + ; + /* If pOp->p5 is clear, then pOp->p2 points to the first instruction past the + ** OP_IdxGT that follows the OP_SeekGE. Otherwise, it points to the first + ** opcode past the OP_SeekGE itself. */ + pC6 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp1)*8)) + if !(_sqlite3BtreeCursorIsValidNN(tls, *(*uintptr)(unsafe.Pointer(pC6 + 48))) != 0) { + goto _187 + } + nStep = (*TOp)(unsafe.Pointer(pOp)).Fp1 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC6)).FpKeyInfo + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FnField = uint16(*(*int32)(unsafe.Pointer(pOp + 1*24 + 16))) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).Fdefault_rc = 0 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 168))).FaMem = aMem + uintptr((*(*TOp)(unsafe.Pointer(pOp + 1*24))).Fp3)*56 + *(*int32)(unsafe.Pointer(bp + 160)) = 0 /* Not needed. Only used to silence a warning. */ + _258: + ; + if !(int32(1) != 0) { + goto _257 + } + rc = _sqlite3VdbeIdxKeyCompare(tls, db, pC6, bp+168, bp+160) + if rc != 0 { + goto abort_due_to_error + } + if !(*(*int32)(unsafe.Pointer(bp + 160)) > 0 && int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == 0) { + goto _259 + } + seekscan_search_fail: + ; + /* Jump to SeekGE.P2, ending the loop */ + pOp += 24 + goto jump_to_p2 + _259: + ; + if *(*int32)(unsafe.Pointer(bp + 160)) >= 0 { + /* Jump to This.P2, bypassing the OP_SeekGE opcode */ + goto jump_to_p2 + goto _257 + } + if nStep <= 0 { + goto _257 + } + nStep-- + (*TVdbeCursor)(unsafe.Pointer(pC6)).FcacheStatus = uint32(CACHE_STALE) + rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC6 + 48)), 0) + if rc != 0 { + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + goto seekscan_search_fail + } else { + goto abort_due_to_error + } + } + goto _258 + _257: + ; + goto _187 + /* Opcode: SeekHit P1 P2 P3 * * + ** Synopsis: set P2<=seekHit<=P3 + ** + ** Increase or decrease the seekHit value for cursor P1, if necessary, + ** so that it is no less than P2 and no greater than P3. + ** + ** The seekHit integer represents the maximum of terms in an index for which + ** there is known to be at least one match. If the seekHit value is smaller + ** than the total number of equality terms in an index lookup, then the + ** OP_IfNoHope opcode might run to see if the IN loop can be abandoned + ** early, thus saving work. This is part of the IN-early-out optimization. + ** + ** P1 must be a valid b-tree cursor. + */ + _90: + ; + pC7 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) < (*TOp)(unsafe.Pointer(pOp)).Fp2 { + (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp2) + } else { + if int32((*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit) > (*TOp)(unsafe.Pointer(pOp)).Fp3 { + (*TVdbeCursor)(unsafe.Pointer(pC7)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp3) + } + } + goto _187 + /* Opcode: IfNotOpen P1 P2 * * * + ** Synopsis: if( !csr[P1] ) goto P2 + ** + ** If cursor P1 is not open or if P1 is set to a NULL row using the + ** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through. + */ + _91: + ; + pCur1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if pCur1 == uintptr(0) || (*TVdbeCursor)(unsafe.Pointer(pCur1)).FnullRow != 0 { + goto jump_to_p2_and_check_for_interrupt + } + goto _187 + /* Opcode: Found P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If + ** P4>0 then register P3 is the first of P4 registers that form an unpacked + ** record. + ** + ** Cursor P1 is on an index btree. If the record identified by P3 and P4 + ** is a prefix of any entry in P1 then a jump is made to P2 and + ** P1 is left pointing at the matching entry. + ** + ** This operation leaves the cursor in a state where it can be + ** advanced in the forward direction. The Next instruction will work, + ** but not the Prev instruction. + ** + ** See also: NotFound, NoConflict, NotExists. SeekGe + */ + /* Opcode: NotFound P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If + ** P4>0 then register P3 is the first of P4 registers that form an unpacked + ** record. + ** + ** Cursor P1 is on an index btree. If the record identified by P3 and P4 + ** is not the prefix of any entry in P1 then a jump is made to P2. If P1 + ** does contain an entry whose prefix matches the P3/P4 record then control + ** falls through to the next instruction and P1 is left pointing at the + ** matching entry. + ** + ** This operation leaves the cursor in a state where it cannot be + ** advanced in either direction. In other words, the Next and Prev + ** opcodes do not work after this operation. + ** + ** See also: Found, NotExists, NoConflict, IfNoHope + */ + /* Opcode: IfNoHope P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** Register P3 is the first of P4 registers that form an unpacked + ** record. Cursor P1 is an index btree. P2 is a jump destination. + ** In other words, the operands to this opcode are the same as the + ** operands to OP_NotFound and OP_IdxGT. + ** + ** This opcode is an optimization attempt only. If this opcode always + ** falls through, the correct answer is still obtained, but extra work + ** is performed. + ** + ** A value of N in the seekHit flag of cursor P1 means that there exists + ** a key P3:N that will match some record in the index. We want to know + ** if it is possible for a record P3:P4 to match some record in the + ** index. If it is not possible, we can skip some work. So if seekHit + ** is less than P4, attempt to find out if a match is possible by running + ** OP_NotFound. + ** + ** This opcode is used in IN clause processing for a multi-column key. + ** If an IN clause is attached to an element of the key other than the + ** left-most element, and if there are no matches on the most recent + ** seek over the whole key, then it might be that one of the key element + ** to the left is prohibiting a match, and hence there is "no hope" of + ** any match regardless of how many IN clause elements are checked. + ** In such a case, we abandon the IN clause search early, using this + ** opcode. The opcode name comes from the fact that the + ** jump is taken if there is "no hope" of achieving a match. + ** + ** See also: NotFound, SeekHit + */ + /* Opcode: NoConflict P1 P2 P3 P4 * + ** Synopsis: key=r[P3@P4] + ** + ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If + ** P4>0 then register P3 is the first of P4 registers that form an unpacked + ** record. + ** + ** Cursor P1 is on an index btree. If the record identified by P3 and P4 + ** contains any NULL value, jump immediately to P2. If all terms of the + ** record are not-NULL then a check is done to determine if any row in the + ** P1 index btree has a matching key prefix. If there are no matches, jump + ** immediately to P2. If there is a match, fall through and leave the P1 + ** cursor pointing to the matching row. + ** + ** This opcode is similar to OP_NotFound with the exceptions that the + ** branch is always taken if any part of the search key input is NULL. + ** + ** This operation leaves the cursor in a state where it cannot be + ** advanced in either direction. In other words, the Next and Prev + ** opcodes do not work after this operation. + ** + ** See also: NotFound, Found, NotExists + */ + _92: + ; + pC8 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if int32((*TVdbeCursor)(unsafe.Pointer(pC8)).FseekHit) >= (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi { + goto _187 + } + _95: + ; /* jump, in3, ncycle */ + _94: + ; /* jump, in3, ncycle */ + _93: + ; + pC9 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) + if int32((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField) > 0 { + /* Key values in an array of registers */ + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC9)).FpKeyInfo + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).Fdefault_rc = 0 + rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC9 + 48)), bp+208, pC9+36) + } else { + /* Composite key generated by OP_MakeRecord */ + if int32((*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fflags)&int32(MEM_Zero) != 0 { + v260 = _sqlite3VdbeMemExpandBlob(tls, (*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem) + } else { + v260 = 0 + } + rc = v260 + if rc != 0 { + goto no_mem + } + pIdxKey = _sqlite3VdbeAllocUnpackedRecord(tls, (*TVdbeCursor)(unsafe.Pointer(pC9)).FpKeyInfo) + if pIdxKey == uintptr(0) { + goto no_mem + } + _sqlite3VdbeRecordUnpack(tls, (*TVdbeCursor)(unsafe.Pointer(pC9)).FpKeyInfo, (*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fn, (*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem)).Fz, pIdxKey) + (*TUnpackedRecord)(unsafe.Pointer(pIdxKey)).Fdefault_rc = 0 + rc = _sqlite3BtreeIndexMoveto(tls, *(*uintptr)(unsafe.Pointer(pC9 + 48)), pIdxKey, pC9+36) + _sqlite3DbFreeNN(tls, db, pIdxKey) + } + if rc != SQLITE_OK { + goto abort_due_to_error + } + alreadyExists = libc.BoolInt32((*TVdbeCursor)(unsafe.Pointer(pC9)).FseekResult == 0) + (*TVdbeCursor)(unsafe.Pointer(pC9)).FnullRow = uint8(int32(1) - alreadyExists) + (*TVdbeCursor)(unsafe.Pointer(pC9)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC9)).FcacheStatus = uint32(CACHE_STALE) + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Found) { + if alreadyExists != 0 { + goto jump_to_p2 + } + } else { + if !(alreadyExists != 0) { + goto jump_to_p2 + } + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_NoConflict) { + /* For the OP_NoConflict opcode, take the jump if any of the + ** input fields are NULL, since any key with a NULL will not + ** conflict */ + ii1 = 0 + for { + if !(ii1 < int32((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FnField)) { + break + } + if int32((*(*TMem)(unsafe.Pointer((*(*TUnpackedRecord)(unsafe.Pointer(bp + 208))).FaMem + uintptr(ii1)*56))).Fflags)&int32(MEM_Null) != 0 { + goto jump_to_p2 + } + goto _261 + _261: + ; + ii1++ + } + } + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_IfNoHope) { + (*TVdbeCursor)(unsafe.Pointer(pC9)).FseekHit = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) + } + } + goto _187 + /* Opcode: SeekRowid P1 P2 P3 * * + ** Synopsis: intkey=r[P3] + ** + ** P1 is the index of a cursor open on an SQL table btree (with integer + ** keys). If register P3 does not contain an integer or if P1 does not + ** contain a record with rowid P3 then jump immediately to P2. + ** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain + ** a record with rowid P3 then + ** leave the cursor pointing at that record and fall through to the next + ** instruction. + ** + ** The OP_NotExists opcode performs the same operation, but with OP_NotExists + ** the P3 register must be guaranteed to contain an integer value. With this + ** opcode, register P3 might not contain an integer. + ** + ** The OP_NotFound opcode performs the same operation on index btrees + ** (with arbitrary multi-value keys). + ** + ** This opcode leaves the cursor in a state where it cannot be advanced + ** in either direction. In other words, the Next and Prev opcodes will + ** not work following this opcode. + ** + ** See also: Found, NotFound, NoConflict, SeekRowid + */ + /* Opcode: NotExists P1 P2 P3 * * + ** Synopsis: intkey=r[P3] + ** + ** P1 is the index of a cursor open on an SQL table btree (with integer + ** keys). P3 is an integer rowid. If P1 does not contain a record with + ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an + ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then + ** leave the cursor pointing at that record and fall through to the next + ** instruction. + ** + ** The OP_SeekRowid opcode performs the same operation but also allows the + ** P3 register to contain a non-integer value, in which case the jump is + ** always taken. This opcode requires that P3 always contain an integer. + ** + ** The OP_NotFound opcode performs the same operation on index btrees + ** (with arbitrary multi-value keys). + ** + ** This opcode leaves the cursor in a state where it cannot be advanced + ** in either direction. In other words, the Next and Prev opcodes will + ** not work following this opcode. + ** + ** See also: Found, NotFound, NoConflict, SeekRowid + */ + _97: + ; + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if int32((*TMem)(unsafe.Pointer(pIn3)).Fflags)&(libc.Int32FromInt32(MEM_Int)|libc.Int32FromInt32(MEM_IntReal)) == 0 { + /* If pIn3->u.i does not contain an integer, compute iKey as the + ** integer value of pIn3. Jump to P2 if pIn3 cannot be converted + ** into an integer without loss of information. Take care to avoid + ** changing the datatype of pIn3, however, as it is used by other + ** parts of the prepared statement. */ + *(*TMem)(unsafe.Pointer(bp + 256)) = TMem{} + /* If pIn3->u.i does not contain an integer, compute iKey as the + ** integer value of pIn3. Jump to P2 if pIn3 cannot be converted + ** into an integer without loss of information. Take care to avoid + ** changing the datatype of pIn3, however, as it is used by other + ** parts of the prepared statement. */ + *(*Tsqlite3_value1)(unsafe.Pointer(bp + 256)) = *(*TMem)(unsafe.Pointer(pIn3)) + _applyAffinity(tls, bp+256, int8(SQLITE_AFF_NUMERIC), encoding) + if int32((*(*TMem)(unsafe.Pointer(bp + 256))).Fflags)&int32(MEM_Int) == 0 { + goto jump_to_p2 + } + iKey1 = uint64(*(*Ti64)(unsafe.Pointer(bp + 256))) + goto notExistsWithKey + } + _96: + ; /* jump, in3, ncycle */ + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + iKey1 = uint64(*(*Ti64)(unsafe.Pointer(pIn3))) + notExistsWithKey: + ; + pC10 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pCrsr2 = *(*uintptr)(unsafe.Pointer(pC10 + 48)) + *(*int32)(unsafe.Pointer(bp + 248)) = 0 + rc = _sqlite3BtreeTableMoveto(tls, pCrsr2, int64(iKey1), 0, bp+248) + (*TVdbeCursor)(unsafe.Pointer(pC10)).FmovetoTarget = int64(iKey1) /* Used by OP_Delete */ + (*TVdbeCursor)(unsafe.Pointer(pC10)).FnullRow = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC10)).FcacheStatus = uint32(CACHE_STALE) + (*TVdbeCursor)(unsafe.Pointer(pC10)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC10)).FseekResult = *(*int32)(unsafe.Pointer(bp + 248)) + if *(*int32)(unsafe.Pointer(bp + 248)) != 0 { + if (*TOp)(unsafe.Pointer(pOp)).Fp2 == 0 { + rc = _sqlite3CorruptError(tls, int32(98111)) + } else { + goto jump_to_p2 + } + } + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: Sequence P1 P2 * * * + ** Synopsis: r[P2]=cursor[P1].ctr++ + ** + ** Find the next available sequence number for cursor P1. + ** Write the sequence number into register P2. + ** The sequence number on the cursor is incremented after this + ** instruction. + */ + _98: + ; /* out2 */ + pOut = _out2Prerelease(tls, p, pOp) + v263 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + 24 + v262 = *(*Ti64)(unsafe.Pointer(v263)) + *(*Ti64)(unsafe.Pointer(v263))++ + *(*Ti64)(unsafe.Pointer(pOut)) = v262 + goto _187 + /* Opcode: NewRowid P1 P2 P3 * * + ** Synopsis: r[P2]=rowid + ** + ** Get a new integer record number (a.k.a "rowid") used as the key to a table. + ** The record number is not previously used as a key in the database + ** table that cursor P1 points to. The new record number is written + ** written to register P2. + ** + ** If P3>0 then P3 is a register in the root frame of this VDBE that holds + ** the largest previously generated record number. No new record numbers are + ** allowed to be less than this value. When this value reaches its maximum, + ** an SQLITE_FULL error is generated. The P3 register is updated with the ' + ** generated record number. This P3 mechanism is used to help implement the + ** AUTOINCREMENT feature. + */ + _99: + ; /* Root frame of VDBE */ + *(*Ti64)(unsafe.Pointer(bp + 312)) = 0 + *(*int32)(unsafe.Pointer(bp + 320)) = 0 + pOut = _out2Prerelease(tls, p, pOp) + pC11 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + /* The next rowid or record number (different terms for the same + ** thing) is obtained in a two-step algorithm. + ** + ** First we attempt to find the largest existing rowid and add one + ** to that. But if the largest existing rowid is already the maximum + ** positive integer, we have to fall through to the second + ** probabilistic algorithm + ** + ** The second algorithm is to select a rowid at random and see if + ** it already exists in the table. If it does not exist, we have + ** succeeded. If the random rowid does exist, we select a new one + ** and try again, up to 100 times. + */ + /* Some compilers complain about constants of the form 0x7fffffffffffffff. + ** Others complain about 0x7ffffffffffffffffLL. The following macro seems + ** to provide the constant while making all compilers happy. + */ + if !(int32(TBool(*(*uint8)(unsafe.Pointer(pC11 + 8))&0x2>>1)) != 0) { + rc = _sqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), bp+320) + if rc != SQLITE_OK { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 320)) != 0 { + *(*Ti64)(unsafe.Pointer(bp + 312)) = int64(1) /* IMP: R-61914-48074 */ + } else { + *(*Ti64)(unsafe.Pointer(bp + 312)) = _sqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48))) + if *(*Ti64)(unsafe.Pointer(bp + 312)) >= int64(libc.Uint64FromInt32(0x7fffffff)<>1)) != 0 { + rc = int32(SQLITE_FULL) /* IMP: R-17817-00630 */ + goto abort_due_to_error + } + if *(*Ti64)(unsafe.Pointer(bp + 312)) < *(*Ti64)(unsafe.Pointer(pMem))+int64(1) { + *(*Ti64)(unsafe.Pointer(bp + 312)) = *(*Ti64)(unsafe.Pointer(pMem)) + int64(1) + } + *(*Ti64)(unsafe.Pointer(pMem)) = *(*Ti64)(unsafe.Pointer(bp + 312)) + } + if int32(TBool(*(*uint8)(unsafe.Pointer(pC11 + 8))&0x2>>1)) != 0 { + /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the + ** largest possible integer (9223372036854775807) then the database + ** engine starts picking positive candidate ROWIDs at random until + ** it finds one that is not previously used. */ + /* We cannot be in random rowid mode if this is + ** an AUTOINCREMENT table. */ + cnt1 = 0 + for { + Xsqlite3_randomness(tls, int32(8), bp+312) + *(*Ti64)(unsafe.Pointer(bp + 312)) &= int64(libc.Uint64FromInt32(0x7fffffff)<> libc.Int32FromInt32(1) + *(*Ti64)(unsafe.Pointer(bp + 312))++ /* Ensure that v is greater than zero */ + goto _268 + _268: + ; + v265 = _sqlite3BtreeTableMoveto(tls, *(*uintptr)(unsafe.Pointer(pC11 + 48)), int64(uint64(*(*Ti64)(unsafe.Pointer(bp + 312)))), 0, bp+320) + rc = v265 + if v267 = v265 == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 320)) == 0; v267 { + cnt1++ + v266 = cnt1 + } + if !(v267 && v266 < int32(100)) { + break + } + } + if rc != 0 { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 320)) == 0 { + rc = int32(SQLITE_FULL) /* IMP: R-38219-53002 */ + goto abort_due_to_error + } + /* EV: R-40812-03570 */ + } + (*TVdbeCursor)(unsafe.Pointer(pC11)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC11)).FcacheStatus = uint32(CACHE_STALE) + *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(bp + 312)) + goto _187 + /* Opcode: Insert P1 P2 P3 P4 P5 + ** Synopsis: intkey=r[P3] data=r[P2] + ** + ** Write an entry into the table of cursor P1. A new entry is + ** created if it doesn't already exist or the data for an existing + ** entry is overwritten. The data is the value MEM_Blob stored in register + ** number P2. The key is stored in register P3. The key must + ** be a MEM_Int. + ** + ** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is + ** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, + ** then rowid is stored for subsequent return by the + ** sqlite3_last_insert_rowid() function (otherwise it is unmodified). + ** + ** If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + ** run faster by avoiding an unnecessary seek on cursor P1. However, + ** the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + ** seeks on the cursor or if the most recent seek used a key equal to P3. + ** + ** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an + ** UPDATE operation. Otherwise (if the flag is clear) then this opcode + ** is part of an INSERT operation. The difference is only important to + ** the update hook. + ** + ** Parameter P4 may point to a Table structure, or may be NULL. If it is + ** not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked + ** following a successful insert. + ** + ** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically + ** allocated, then ownership of P2 is transferred to the pseudo-cursor + ** and register P2 becomes ephemeral. If the cursor is changed, the + ** value of register P2 will then change. Make sure this does not + ** cause any problems.) + ** + ** This instruction only works on tables. The equivalent instruction + ** for indices is OP_IdxInsert. + */ + _100: + ; /* Payload to be inserted */ + pData = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + pC12 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pKey = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey = *(*Ti64)(unsafe.Pointer(pKey)) + if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) == -int32(5) && ((*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0) { + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TVdbeCursor)(unsafe.Pointer(pC12)).FiDb)*32))).FzDbSName + pTab1 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + } else { + pTab1 = uintptr(0) + zDb = uintptr(0) + } + /* Invoke the pre-update hook, if any */ + if pTab1 != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && !(int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&libc.Int32FromInt32(OPFLAG_ISUPDATE) != 0) { + _sqlite3VdbePreUpdateHook(tls, p, pC12, int32(SQLITE_INSERT), zDb, pTab1, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey, (*TOp)(unsafe.Pointer(pOp)).Fp2, -int32(1)) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback == uintptr(0) || (*TTable)(unsafe.Pointer(pTab1)).FaCol == uintptr(0) { + /* Prevent post-update hook from running in cases when it should not */ + pTab1 = uintptr(0) + } + } + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISNOOP) != 0 { + goto _187 + } + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { + (*TVdbe)(unsafe.Pointer(p)).FnChange++ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_LASTROWID) != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid = (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey + } + } + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpData = (*TMem)(unsafe.Pointer(pData)).Fz + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnData = (*TMem)(unsafe.Pointer(pData)).Fn + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { + v269 = (*TVdbeCursor)(unsafe.Pointer(pC12)).FseekResult + } else { + v269 = 0 + } + seekResult = v269 + if int32((*TMem)(unsafe.Pointer(pData)).Fflags)&int32(MEM_Zero) != 0 { + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = *(*int32)(unsafe.Pointer(&(*TMem)(unsafe.Pointer(pData)).Fu)) + } else { + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnZero = 0 + } + (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FpKey = uintptr(0) + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC12 + 48)), bp+328, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), seekResult) + (*TVdbeCursor)(unsafe.Pointer(pC12)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC12)).FcacheStatus = uint32(CACHE_STALE) + colCacheCtr++ + /* Invoke the update-hook if required. */ + if rc != 0 { + goto abort_due_to_error + } + if pTab1 != 0 { + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_ISUPDATE) != 0 { + v270 = int32(SQLITE_UPDATE) + } else { + v270 = int32(SQLITE_INSERT) + } + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, v270, zDb, (*TTable)(unsafe.Pointer(pTab1)).FzName, (*(*TBtreePayload)(unsafe.Pointer(bp + 328))).FnKey) + } + goto _187 + /* Opcode: RowCell P1 P2 P3 * * + ** + ** P1 and P2 are both open cursors. Both must be opened on the same type + ** of table - intkey or index. This opcode is used as part of copying + ** the current row from P2 into P1. If the cursors are opened on intkey + ** tables, register P3 contains the rowid to use with the new record in + ** P1. If they are opened on index tables, P3 is not used. + ** + ** This opcode must be followed by either an Insert or InsertIdx opcode + ** with the OPFLAG_PREFORMAT flag set to complete the insert operation. + */ + _101: + ; /* Rowid value to insert with */ + pDest1 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pSrc = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*8)) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + v271 = *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) + } else { + v271 = 0 + } + iKey2 = v271 + rc = _sqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 48)), *(*uintptr)(unsafe.Pointer(pSrc + 48)), iKey2) + if rc != SQLITE_OK { + goto abort_due_to_error + } + goto _187 + /* Opcode: Delete P1 P2 P3 P4 P5 + ** + ** Delete the record at which the P1 cursor is currently pointing. + ** + ** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then + ** the cursor will be left pointing at either the next or the previous + ** record in the table. If it is left pointing at the next record, then + ** the next Next instruction will be a no-op. As a result, in this case + ** it is ok to delete a record from within a Next loop. If + ** OPFLAG_SAVEPOSITION bit of P5 is clear, then the cursor will be + ** left in an undefined state. + ** + ** If the OPFLAG_AUXDELETE bit is set on P5, that indicates that this + ** delete is one of several associated with deleting a table row and + ** all its associated index entries. Exactly one of those deletes is + ** the "primary" delete. The others are all on OPFLAG_FORDELETE + ** cursors or else are marked with the AUXDELETE flag. + ** + ** If the OPFLAG_NCHANGE (0x01) flag of P2 (NB: P2 not P5) is set, then + ** the row change count is incremented (otherwise not). + ** + ** If the OPFLAG_ISNOOP (0x40) flag of P2 (not P5!) is set, then the + ** pre-update-hook for deletes is run, but the btree is otherwise unchanged. + ** This happens when the OP_Delete is to be shortly followed by an OP_Insert + ** with the same key, causing the btree entry to be overwritten. + ** + ** P1 must not be pseudo-table. It has to be a real table with + ** multiple rows. + ** + ** If P4 is not NULL then it points to a Table object. In this case either + ** the update or pre-update hook, or both, may be invoked. The P1 cursor must + ** have been positioned using OP_NotFound prior to invoking this opcode in + ** this case. Specifically, if one is configured, the pre-update hook is + ** invoked if P4 is not NULL. The update-hook is invoked if one is configured, + ** P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2. + ** + ** If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address + ** of the memory cell that contains the value that the rowid of the row will + ** be set to by the update. + */ + _102: + ; + opflags = (*TOp)(unsafe.Pointer(pOp)).Fp2 + pC13 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + /* If the update-hook or pre-update-hook will be invoked, set zDb to + ** the name of the db to pass as to it. Also set local pTab to a copy + ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was + ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set + ** VdbeCursor.movetoTarget to the current rowid. */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fp4type) == -int32(5) && ((*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0) { + zDb1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TVdbeCursor)(unsafe.Pointer(pC13)).FiDb)*32))).FzDbSName + pTab2 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_SAVEPOSITION) != 0 && (*TVdbeCursor)(unsafe.Pointer(pC13)).FisTable != 0 { + (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget = _sqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC13 + 48))) + } + } else { + zDb1 = uintptr(0) + pTab2 = uintptr(0) + } + /* Invoke the pre-update-hook if required. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 && pTab2 != 0 { + if opflags&int32(OPFLAG_ISUPDATE) != 0 { + v272 = int32(SQLITE_UPDATE) + } else { + v272 = int32(SQLITE_DELETE) + } + _sqlite3VdbePreUpdateHook(tls, p, pC13, v272, zDb1, pTab2, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget, (*TOp)(unsafe.Pointer(pOp)).Fp3, -int32(1)) + } + if opflags&int32(OPFLAG_ISNOOP) != 0 { + goto _187 + } + /* Only flags that can be set are SAVEPOISTION and AUXDELETE */ + rc = _sqlite3BtreeDelete(tls, *(*uintptr)(unsafe.Pointer(pC13 + 48)), uint8((*TOp)(unsafe.Pointer(pOp)).Fp5)) + (*TVdbeCursor)(unsafe.Pointer(pC13)).FcacheStatus = uint32(CACHE_STALE) + colCacheCtr++ + (*TVdbeCursor)(unsafe.Pointer(pC13)).FseekResult = 0 + if rc != 0 { + goto abort_due_to_error + } + /* Invoke the update-hook if required. */ + if opflags&int32(OPFLAG_NCHANGE) != 0 { + (*TVdbe)(unsafe.Pointer(p)).FnChange++ + if (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0 && pTab2 != uintptr(0) && (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Tsqlite_int64))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg, int32(SQLITE_DELETE), zDb1, (*TTable)(unsafe.Pointer(pTab2)).FzName, (*TVdbeCursor)(unsafe.Pointer(pC13)).FmovetoTarget) + } + } + goto _187 + /* Opcode: ResetCount * * * * * + ** + ** The value of the change counter is copied to the database handle + ** change counter (returned by subsequent calls to sqlite3_changes()). + ** Then the VMs internal change counter resets to 0. + ** This is used by trigger programs. + */ + _103: + ; + _sqlite3VdbeSetChanges(tls, db, (*TVdbe)(unsafe.Pointer(p)).FnChange) + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + goto _187 + /* Opcode: SorterCompare P1 P2 P3 P4 + ** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 + ** + ** P1 is a sorter cursor. This instruction compares a prefix of the + ** record blob in register P3 against a prefix of the entry that + ** the sorter cursor currently points to. Only the first P4 fields + ** of r[P3] and the sorter record are compared. + ** + ** If either P3 or the sorter contains a NULL in one of their significant + ** fields (not counting the P4 fields at the end which are ignored) then + ** the comparison is assumed to be equal. + ** + ** Fall through to next instruction if the two records compare equal to + ** each other. Jump to P2 if they are different. + */ + _104: + ; + pC14 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + nKeyCol = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi + *(*int32)(unsafe.Pointer(bp + 376)) = 0 + rc = _sqlite3VdbeSorterCompare(tls, pC14, pIn3, nKeyCol, bp+376) + if rc != 0 { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 376)) != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: SorterData P1 P2 P3 * * + ** Synopsis: r[P2]=data + ** + ** Write into register P2 the current sorter data for sorter cursor P1. + ** Then clear the column header cache on cursor P3. + ** + ** This opcode is normally used to move a record out of the sorter and into + ** a register that is the source for a pseudo-table cursor created using + ** OpenPseudo. That pseudo-table cursor is the one that is identified by + ** parameter P3. Clearing the P3 column cache as part of this opcode saves + ** us from having to issue a separate NullRow instruction to clear that cache. + */ + _105: + ; + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + pC15 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + rc = _sqlite3VdbeSorterRowkey(tls, pC15, pOut) + if rc != 0 { + goto abort_due_to_error + } + (*TVdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*8)))).FcacheStatus = uint32(CACHE_STALE) + goto _187 + /* Opcode: RowData P1 P2 P3 * * + ** Synopsis: r[P2]=data + ** + ** Write into register P2 the complete row content for the row at + ** which cursor P1 is currently pointing. + ** There is no interpretation of the data. + ** It is just copied onto the P2 register exactly as + ** it is found in the database file. + ** + ** If cursor P1 is an index, then the content is the key of the row. + ** If cursor P2 is a table, then the content extracted is the data. + ** + ** If the P1 cursor must be pointing to a valid row (not a NULL row) + ** of a real table, not a pseudo-table. + ** + ** If P3!=0 then this opcode is allowed to make an ephemeral pointer + ** into the database page. That means that the content of the output + ** register will be invalidated as soon as the cursor moves - including + ** moves caused by other cursors that "save" the current cursors + ** position in order that they can write to the same table. If P3==0 + ** then a copy of the data is made into memory. P3!=0 is faster, but + ** P3==0 is safer. + ** + ** If P3!=0 then the content of the P2 register is unsuitable for use + ** in OP_Result and any OP_Result will invalidate the P2 register content. + ** The P2 register content is invalidated by opcodes like OP_Function or + ** by any use of another cursor pointing to the same table. + */ + _106: + ; + pOut = _out2Prerelease(tls, p, pOp) + pC16 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pCrsr3 = *(*uintptr)(unsafe.Pointer(pC16 + 48)) + /* The OP_RowData opcodes always follow OP_NotExists or + ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions + ** that might invalidate the cursor. + ** If this where not the case, on of the following assert()s + ** would fail. Should this ever change (because of changes in the code + ** generator) then the fix would be to insert a call to + ** sqlite3VdbeCursorMoveto(). + */ + n3 = _sqlite3BtreePayloadSize(tls, pCrsr3) + if n3 > uint32(*(*int32)(unsafe.Pointer(db + 136))) { + goto too_big + } + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCrsr3, n3, pOut) + if rc != 0 { + goto abort_due_to_error + } + if !((*TOp)(unsafe.Pointer(pOp)).Fp3 != 0) { + if int32((*TMem)(unsafe.Pointer(pOut)).Fflags)&int32(MEM_Ephem) != 0 && _sqlite3VdbeMemMakeWriteable(tls, pOut) != 0 { + goto no_mem + } + } + goto _187 + /* Opcode: Rowid P1 P2 * * * + ** Synopsis: r[P2]=PX rowid of P1 + ** + ** Store in register P2 an integer which is the key of the table entry that + ** P1 is currently point to. + ** + ** P1 can be either an ordinary table or a virtual table. There used to + ** be a separate OP_VRowid opcode for use with virtual tables, but this + ** one opcode now works for both table types. + */ + _107: + ; + pOut = _out2Prerelease(tls, p, pOp) + pC17 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) + goto _187 + } else { + if (*TVdbeCursor)(unsafe.Pointer(pC17)).FdeferredMoveto != 0 { + *(*Ti64)(unsafe.Pointer(bp + 384)) = (*TVdbeCursor)(unsafe.Pointer(pC17)).FmovetoTarget + } else { + if int32((*TVdbeCursor)(unsafe.Pointer(pC17)).FeCurType) == int32(CURTYPE_VTAB) { + pVtab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC17 + 48)))).FpVtab + pModule = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxRowid})))(tls, *(*uintptr)(unsafe.Pointer(pC17 + 48)), bp+384) + _sqlite3VtabImportErrmsg(tls, p, pVtab) + if rc != 0 { + goto abort_due_to_error + } + } else { + rc = _sqlite3VdbeCursorRestore(tls, pC17) + if rc != 0 { + goto abort_due_to_error + } + if (*TVdbeCursor)(unsafe.Pointer(pC17)).FnullRow != 0 { + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) + goto _187 + } + *(*Ti64)(unsafe.Pointer(bp + 384)) = _sqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC17 + 48))) + } + } + } + *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(bp + 384)) + goto _187 + /* Opcode: NullRow P1 * * * * + ** + ** Move the cursor P1 to a null row. Any OP_Column operations + ** that occur while the cursor is on the null row will always + ** write a NULL. + ** + ** If cursor P1 is not previously opened, open it now to a special + ** pseudo-cursor that always returns NULL for every column. + */ + _108: + ; + pC18 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if pC18 == uintptr(0) { + /* If the cursor is not already open, create a special kind of + ** pseudo-cursor that always gives null rows. */ + pC18 = _allocateCursor(tls, p, (*TOp)(unsafe.Pointer(pOp)).Fp1, int32(1), uint8(CURTYPE_PSEUDO)) + if pC18 == uintptr(0) { + goto no_mem + } + (*TVdbeCursor)(unsafe.Pointer(pC18)).FseekResult = 0 + (*TVdbeCursor)(unsafe.Pointer(pC18)).FisTable = uint8(1) + libc.SetBitFieldPtr8Uint32(pC18+8, libc.Uint32FromInt32(1), 3, 0x8) + *(*uintptr)(unsafe.Pointer(pC18 + 48)) = _sqlite3BtreeFakeValidCursor(tls) + } + (*TVdbeCursor)(unsafe.Pointer(pC18)).FnullRow = uint8(1) + (*TVdbeCursor)(unsafe.Pointer(pC18)).FcacheStatus = uint32(CACHE_STALE) + if int32((*TVdbeCursor)(unsafe.Pointer(pC18)).FeCurType) == CURTYPE_BTREE { + _sqlite3BtreeClearCursor(tls, *(*uintptr)(unsafe.Pointer(pC18 + 48))) + } + goto _187 + /* Opcode: SeekEnd P1 * * * * + ** + ** Position cursor P1 at the end of the btree for the purpose of + ** appending a new entry onto the btree. + ** + ** It is assumed that the cursor is used only for appending and so + ** if the cursor is valid, then the cursor must already be pointing + ** at the end of the btree and so no changes are made to + ** the cursor. + */ + /* Opcode: Last P1 P2 * * * + ** + ** The next use of the Rowid or Column or Prev instruction for P1 + ** will refer to the last entry in the database table or index. + ** If the table or index is empty and P2>0, then jump immediately to P2. + ** If P2 is 0 or if the table or index is not empty, fall through + ** to the following instruction. + ** + ** This opcode leaves the cursor configured to move in reverse order, + ** from the end toward the beginning. In other words, the cursor is + ** configured to use Prev, not Next. + */ + _110: + ; /* ncycle */ + _109: + ; + pC19 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pCrsr4 = *(*uintptr)(unsafe.Pointer(pC19 + 48)) + *(*int32)(unsafe.Pointer(bp + 392)) = 0 + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_SeekEnd) { + (*TVdbeCursor)(unsafe.Pointer(pC19)).FseekResult = -int32(1) + if _sqlite3BtreeCursorIsValidNN(tls, pCrsr4) != 0 { + goto _187 + } + } + rc = _sqlite3BtreeLast(tls, pCrsr4, bp+392) + (*TVdbeCursor)(unsafe.Pointer(pC19)).FnullRow = uint8(*(*int32)(unsafe.Pointer(bp + 392))) + (*TVdbeCursor)(unsafe.Pointer(pC19)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC19)).FcacheStatus = uint32(CACHE_STALE) + if rc != 0 { + goto abort_due_to_error + } + if (*TOp)(unsafe.Pointer(pOp)).Fp2 > 0 { + if *(*int32)(unsafe.Pointer(bp + 392)) != 0 { + goto jump_to_p2 + } + } + goto _187 + /* Opcode: IfSmaller P1 P2 P3 * * + ** + ** Estimate the number of rows in the table P1. Jump to P2 if that + ** estimate is less than approximately 2**(0.1*P3). + */ + _111: + ; + pC20 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pCrsr5 = *(*uintptr)(unsafe.Pointer(pC20 + 48)) + rc = _sqlite3BtreeFirst(tls, pCrsr5, bp+396) + if rc != 0 { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 396)) == 0 { + sz = _sqlite3BtreeRowCountEst(tls, pCrsr5) + if sz >= 0 && int32(_sqlite3LogEst(tls, uint64(sz))) < (*TOp)(unsafe.Pointer(pOp)).Fp3 { + *(*int32)(unsafe.Pointer(bp + 396)) = int32(1) + } + } + if *(*int32)(unsafe.Pointer(bp + 396)) != 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: SorterSort P1 P2 * * * + ** + ** After all records have been inserted into the Sorter object + ** identified by P1, invoke this opcode to actually do the sorting. + ** Jump to P2 if there are no records to be sorted. + ** + ** This opcode is an alias for OP_Sort and OP_Rewind that is used + ** for Sorter objects. + */ + /* Opcode: Sort P1 P2 * * * + ** + ** This opcode does exactly the same thing as OP_Rewind except that + ** it increments an undocumented global variable used for testing. + ** + ** Sorting is accomplished by writing records into a sorting index, + ** then rewinding that index and playing it back from beginning to + ** end. We use the OP_Sort opcode instead of OP_Rewind to do the + ** rewinding so that the global variable will be incremented and + ** regression tests can determine whether or not the optimizer is + ** correctly optimizing out sorts. + */ + _113: + ; /* jump ncycle */ + _112: + ; /* jump ncycle */ + *(*Tu32)(unsafe.Pointer(p + 212 + 2*4))++ + /* Opcode: Rewind P1 P2 * * * + ** + ** The next use of the Rowid or Column or Next instruction for P1 + ** will refer to the first entry in the database table or index. + ** If the table or index is empty, jump immediately to P2. + ** If the table or index is not empty, fall through to the following + ** instruction. + ** + ** If P2 is zero, that is an assertion that the P1 table is never + ** empty and hence the jump will never be taken. + ** + ** This opcode leaves the cursor configured to move in forward order, + ** from the beginning toward the end. In other words, the cursor is + ** configured to use Next, not Prev. + */ + _114: + ; + pC21 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + *(*int32)(unsafe.Pointer(bp + 400)) = int32(1) + if int32((*TVdbeCursor)(unsafe.Pointer(pC21)).FeCurType) == int32(CURTYPE_SORTER) { + rc = _sqlite3VdbeSorterRewind(tls, pC21, bp+400) + } else { + pCrsr6 = *(*uintptr)(unsafe.Pointer(pC21 + 48)) + rc = _sqlite3BtreeFirst(tls, pCrsr6, bp+400) + (*TVdbeCursor)(unsafe.Pointer(pC21)).FdeferredMoveto = uint8(0) + (*TVdbeCursor)(unsafe.Pointer(pC21)).FcacheStatus = uint32(CACHE_STALE) + } + if rc != 0 { + goto abort_due_to_error + } + (*TVdbeCursor)(unsafe.Pointer(pC21)).FnullRow = uint8(*(*int32)(unsafe.Pointer(bp + 400))) + if (*TOp)(unsafe.Pointer(pOp)).Fp2 > 0 { + if *(*int32)(unsafe.Pointer(bp + 400)) != 0 { + goto jump_to_p2 + } + } + goto _187 + /* Opcode: Next P1 P2 P3 * P5 + ** + ** Advance cursor P1 so that it points to the next key/data pair in its + ** table or index. If there are no more key/value pairs then fall through + ** to the following instruction. But if the cursor advance was successful, + ** jump immediately to P2. + ** + ** The Next opcode is only valid following an SeekGT, SeekGE, or + ** OP_Rewind opcode used to position the cursor. Next is not allowed + ** to follow SeekLT, SeekLE, or OP_Last. + ** + ** The P1 cursor must be for a real table, not a pseudo-table. P1 must have + ** been opened prior to this opcode or the program will segfault. + ** + ** The P3 value is a hint to the btree implementation. If P3==1, that + ** means P1 is an SQL index and that this instruction could have been + ** omitted if that index had been unique. P3 is usually 0. P3 is + ** always either 0 or 1. + ** + ** If P5 is positive and the jump is taken, then event counter + ** number P5-1 in the prepared statement is incremented. + ** + ** See also: Prev + */ + /* Opcode: Prev P1 P2 P3 * P5 + ** + ** Back up cursor P1 so that it points to the previous key/data pair in its + ** table or index. If there is no previous key/value pairs then fall through + ** to the following instruction. But if the cursor backup was successful, + ** jump immediately to P2. + ** + ** + ** The Prev opcode is only valid following an SeekLT, SeekLE, or + ** OP_Last opcode used to position the cursor. Prev is not allowed + ** to follow SeekGT, SeekGE, or OP_Rewind. + ** + ** The P1 cursor must be for a real table, not a pseudo-table. If P1 is + ** not open then the behavior is undefined. + ** + ** The P3 value is a hint to the btree implementation. If P3==1, that + ** means P1 is an SQL index and that this instruction could have been + ** omitted if that index had been unique. P3 is usually 0. P3 is + ** always either 0 or 1. + ** + ** If P5 is positive and the jump is taken, then event counter + ** number P5-1 in the prepared statement is incremented. + */ + /* Opcode: SorterNext P1 P2 * * P5 + ** + ** This opcode works just like OP_Next except that P1 must be a + ** sorter object for which the OP_SorterSort opcode has been + ** invoked. This opcode advances the cursor to the next sorted + ** record, or jumps to P2 if there are no more sorted records. + */ + _117: + ; + pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + rc = _sqlite3VdbeSorterNext(tls, db, pC22) + goto next_tail + _115: + ; /* jump, ncycle */ + pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + rc = _sqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) + goto next_tail + _116: + ; /* jump, ncycle */ + pC22 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + rc = _sqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC22 + 48)), (*TOp)(unsafe.Pointer(pOp)).Fp3) + next_tail: + ; + (*TVdbeCursor)(unsafe.Pointer(pC22)).FcacheStatus = uint32(CACHE_STALE) + if rc == SQLITE_OK { + (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(0) + *(*Tu32)(unsafe.Pointer(p + 212 + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp5)*4))++ + goto jump_to_p2_and_check_for_interrupt + } + if rc != int32(SQLITE_DONE) { + goto abort_due_to_error + } + rc = SQLITE_OK + (*TVdbeCursor)(unsafe.Pointer(pC22)).FnullRow = uint8(1) + goto check_for_interrupt + /* Opcode: IdxInsert P1 P2 P3 P4 P5 + ** Synopsis: key=r[P2] + ** + ** Register P2 holds an SQL index key made using the + ** MakeRecord instructions. This opcode writes that key + ** into the index P1. Data for the entry is nil. + ** + ** If P4 is not zero, then it is the number of values in the unpacked + ** key of reg(P2). In that case, P3 is the index of the first register + ** for the unpacked key. The availability of the unpacked key can sometimes + ** be an optimization. + ** + ** If P5 has the OPFLAG_APPEND bit set, that is a hint to the b-tree layer + ** that this insert is likely to be an append. + ** + ** If P5 has the OPFLAG_NCHANGE bit set, then the change counter is + ** incremented by this instruction. If the OPFLAG_NCHANGE bit is clear, + ** then the change counter is unchanged. + ** + ** If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + ** run faster by avoiding an unnecessary seek on cursor P1. However, + ** the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + ** seeks on the cursor or if the most recent seek used a key equivalent + ** to P2. + ** + ** This instruction only works for indices. The equivalent instruction + ** for tables is OP_Insert. + */ + _118: + ; + pC23 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_NCHANGE) != 0 { + (*TVdbe)(unsafe.Pointer(p)).FnChange++ + } + if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { + v273 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + } else { + v273 = 0 + } + rc = v273 + if rc != 0 { + goto abort_due_to_error + } + (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnKey = int64((*TMem)(unsafe.Pointer(pIn2)).Fn) + (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FpKey = (*TMem)(unsafe.Pointer(pIn2)).Fz + (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + (*(*TBtreePayload)(unsafe.Pointer(bp + 408))).FnMem = uint16((*TOp)(unsafe.Pointer(pOp)).Fp4.Fi) + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&int32(OPFLAG_USESEEKRESULT) != 0 { + v274 = (*TVdbeCursor)(unsafe.Pointer(pC23)).FseekResult + } else { + v274 = 0 + } + rc = _sqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC23 + 48)), bp+408, int32((*TOp)(unsafe.Pointer(pOp)).Fp5)&(libc.Int32FromInt32(OPFLAG_APPEND)|libc.Int32FromInt32(OPFLAG_SAVEPOSITION)|libc.Int32FromInt32(OPFLAG_PREFORMAT)), v274) + (*TVdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = uint32(CACHE_STALE) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: SorterInsert P1 P2 * * * + ** Synopsis: key=r[P2] + ** + ** Register P2 holds an SQL index key made using the + ** MakeRecord instructions. This opcode writes that key + ** into the sorter P1. Data for the entry is nil. + */ + _119: + ; + pC24 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pIn2)).Fflags)&int32(MEM_Zero) != 0 { + v275 = _sqlite3VdbeMemExpandBlob(tls, pIn2) + } else { + v275 = 0 + } + rc = v275 + if rc != 0 { + goto abort_due_to_error + } + rc = _sqlite3VdbeSorterWrite(tls, pC24, pIn2) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: IdxDelete P1 P2 P3 * P5 + ** Synopsis: key=r[P2@P3] + ** + ** The content of P3 registers starting at register P2 form + ** an unpacked index key. This opcode removes that entry from the + ** index opened by cursor P1. + ** + ** If P5 is not zero, then raise an SQLITE_CORRUPT_INDEX error + ** if no matching index entry is found. This happens when running + ** an UPDATE or DELETE statement and the index entry to be updated + ** or deleted is not found. For some uses of IdxDelete + ** (example: the EXCEPT operator) it does not matter that no matching + ** entry is found. For those cases, P5 is zero. Also, do not raise + ** this (self-correcting and non-critical) error if in writable_schema mode. + */ + _120: + ; + pC25 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + pCrsr7 = *(*uintptr)(unsafe.Pointer(pC25 + 48)) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FpKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pC25)).FpKeyInfo + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FnField = uint16((*TOp)(unsafe.Pointer(pOp)).Fp3) + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).Fdefault_rc = 0 + (*(*TUnpackedRecord)(unsafe.Pointer(bp + 464))).FaMem = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + rc = _sqlite3BtreeIndexMoveto(tls, pCrsr7, bp+464, bp+456) + if rc != 0 { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 456)) == 0 { + rc = _sqlite3BtreeDelete(tls, pCrsr7, uint8(BTREE_AUXDELETE)) + if rc != 0 { + goto abort_due_to_error + } + } else { + if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { + rc = _sqlite3ReportError(tls, libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(3)< int64(0x7fffffff) { + rc = _sqlite3CorruptError(tls, int32(99398)) + goto abort_due_to_error + } + _sqlite3VdbeMemInit(tls, bp+552, db, uint16(0)) + rc = _sqlite3VdbeMemFromBtreeZeroOffset(tls, pCur2, uint32(nCellKey), bp+552) + if rc != 0 { + goto abort_due_to_error + } + res10 = _sqlite3VdbeRecordCompareWithSkip(tls, (*(*TMem)(unsafe.Pointer(bp + 552))).Fn, (*(*TMem)(unsafe.Pointer(bp + 552))).Fz, bp+512, 0) + _sqlite3VdbeMemReleaseMalloc(tls, bp+552) + /* End of inlined sqlite3VdbeIdxKeyCompare() */ + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode)&int32(1) == libc.Int32FromInt32(OP_IdxLT)&libc.Int32FromInt32(1) { + res10 = -res10 + } else { + res10++ + } + if res10 > 0 { + goto jump_to_p2 + } + goto _187 + /* Opcode: Destroy P1 P2 P3 * * + ** + ** Delete an entire database table or index whose root page in the database + ** file is given by P1. + ** + ** The table being destroyed is in the main database file if P3==0. If + ** P3==1 then the table to be destroyed is in the auxiliary database file + ** that is used to store tables create using CREATE TEMPORARY TABLE. + ** + ** If AUTOVACUUM is enabled then it is possible that another root page + ** might be moved into the newly deleted root page in order to keep all + ** root pages contiguous at the beginning of the database. The former + ** value of the root page that moved - its value before the move occurred - + ** is stored in register P2. If no page movement was required (because the + ** table being dropped was already the last one in the database) then a + ** zero is stored in register P2. If AUTOVACUUM is disabled then a zero + ** is stored in register P2. + ** + ** This opcode throws an error if there are any active reader VMs when + ** it is invoked. This is done to avoid the difficulty associated with + ** updating existing cursors when a root page is moved in an AUTOVACUUM + ** database. This error is thrown even if the database is not an AUTOVACUUM + ** db in order to avoid introducing an incompatibility between autovacuum + ** and non-autovacuum modes. + ** + ** See also: Clear + */ + _128: + ; + pOut = _out2Prerelease(tls, p, pOp) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Null) + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > (*Tsqlite3)(unsafe.Pointer(db)).FnVDestroy+int32(1) { + rc = int32(SQLITE_LOCKED) + (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(OE_Abort) + goto abort_due_to_error + } else { + iDb2 = (*TOp)(unsafe.Pointer(pOp)).Fp3 + *(*int32)(unsafe.Pointer(bp + 608)) = 0 /* Not needed. Only to silence a warning. */ + rc = _sqlite3BtreeDropTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb2)*32))).FpBt, (*TOp)(unsafe.Pointer(pOp)).Fp1, bp+608) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(MEM_Int) + *(*Ti64)(unsafe.Pointer(pOut)) = int64(*(*int32)(unsafe.Pointer(bp + 608))) + if rc != 0 { + goto abort_due_to_error + } + if *(*int32)(unsafe.Pointer(bp + 608)) != 0 { + _sqlite3RootPageMoved(tls, db, iDb2, uint32(*(*int32)(unsafe.Pointer(bp + 608))), uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)) + /* All OP_Destroy operations occur on the same btree */ + resetSchemaOnFault = uint8(iDb2 + int32(1)) + } + } + goto _187 + /* Opcode: Clear P1 P2 P3 + ** + ** Delete all contents of the database table or index whose root page + ** in the database file is given by P1. But, unlike Destroy, do not + ** remove the table or index from the database file. + ** + ** The table being cleared is in the main database file if P2==0. If + ** P2==1 then the table to be cleared is in the auxiliary database file + ** that is used to store tables create using CREATE TEMPORARY TABLE. + ** + ** If the P3 value is non-zero, then the row change count is incremented + ** by the number of rows in the table being cleared. If P3 is greater + ** than zero, then the value stored in register P3 is also incremented + ** by the number of rows in the table being cleared. + ** + ** See also: Destroy + */ + _129: + ; + *(*Ti64)(unsafe.Pointer(bp + 616)) = 0 + rc = _sqlite3BtreeClearTable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*32))).FpBt, int32(uint32((*TOp)(unsafe.Pointer(pOp)).Fp1)), bp+616) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + *(*Ti64)(unsafe.Pointer(p + 56)) += *(*Ti64)(unsafe.Pointer(bp + 616)) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 > 0 { + *(*Ti64)(unsafe.Pointer(aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56)) += *(*Ti64)(unsafe.Pointer(bp + 616)) + } + } + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: ResetSorter P1 * * * * + ** + ** Delete all contents from the ephemeral table or sorter + ** that is open on cursor P1. + ** + ** This opcode only works for cursors used for sorting and + ** opened with OP_OpenEphemeral or OP_SorterOpen. + */ + _130: + ; + pC29 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if int32((*TVdbeCursor)(unsafe.Pointer(pC29)).FeCurType) == int32(CURTYPE_SORTER) { + _sqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC29 + 48))) + } else { + rc = _sqlite3BtreeClearTableOfCursor(tls, *(*uintptr)(unsafe.Pointer(pC29 + 48))) + if rc != 0 { + goto abort_due_to_error + } + } + goto _187 + /* Opcode: CreateBtree P1 P2 P3 * * + ** Synopsis: r[P2]=root iDb=P1 flags=P3 + ** + ** Allocate a new b-tree in the main database file if P1==0 or in the + ** TEMP database file if P1==1 or in an attached database if + ** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table + ** it must be 2 (BTREE_BLOBKEY) for an index or WITHOUT ROWID table. + ** The root page number of the new b-tree is stored in register P2. + */ + _131: + ; + pOut = _out2Prerelease(tls, p, pOp) + *(*TPgno)(unsafe.Pointer(bp + 624)) = uint32(0) + pDb3 = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32 + rc = _sqlite3BtreeCreateTable(tls, (*TDb)(unsafe.Pointer(pDb3)).FpBt, bp+624, (*TOp)(unsafe.Pointer(pOp)).Fp3) + if rc != 0 { + goto abort_due_to_error + } + *(*Ti64)(unsafe.Pointer(pOut)) = int64(*(*TPgno)(unsafe.Pointer(bp + 624))) + goto _187 + /* Opcode: SqlExec * * * P4 * + ** + ** Run the SQL statement or statements specified in the P4 string. + ** Disable Auth and Trace callbacks while those statements are running if + ** P1 is true. + */ + _132: + ; + (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec++ + *(*uintptr)(unsafe.Pointer(bp + 632)) = uintptr(0) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + mTrace = (*Tsqlite3)(unsafe.Pointer(db)).FmTrace + if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = uint8(0) + } + rc = Xsqlite3_exec(tls, db, *(*uintptr)(unsafe.Pointer(pOp + 16)), uintptr(0), uintptr(0), bp+632) + (*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec-- + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = mTrace + if *(*uintptr)(unsafe.Pointer(bp + 632)) != 0 || rc != 0 { + _sqlite3VdbeError(tls, p, __ccgo_ts+3827, libc.VaList(bp+944, *(*uintptr)(unsafe.Pointer(bp + 632)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 632))) + if rc == int32(SQLITE_NOMEM) { + goto no_mem + } + goto abort_due_to_error + } + goto _187 + /* Opcode: ParseSchema P1 * * P4 * + ** + ** Read and parse all entries from the schema table of database P1 + ** that match the WHERE clause P4. If P4 is a NULL pointer, then the + ** entire schema for P1 is reparsed. + ** + ** This opcode invokes the parser to create a new virtual machine, + ** then runs the new virtual machine. It is thus a re-entrant opcode. + */ + _133: + ; + /* Any prepared statement that invokes this opcode will hold mutexes + ** on every btree. This is a prerequisite for invoking + ** sqlite3InitCallback(). + */ + iDb3 = (*TOp)(unsafe.Pointer(pOp)).Fp1 + if *(*uintptr)(unsafe.Pointer(pOp + 16)) == uintptr(0) { + _sqlite3SchemaClear(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpSchema) + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_SchemaKnownOk)) + rc = _sqlite3InitOne(tls, db, iDb3, p+168, uint32((*TOp)(unsafe.Pointer(pOp)).Fp5)) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) + } else { + zSchema = __ccgo_ts + 6098 + (*(*TInitData)(unsafe.Pointer(bp + 640))).Fdb = db + (*(*TInitData)(unsafe.Pointer(bp + 640))).FiDb = iDb3 + (*(*TInitData)(unsafe.Pointer(bp + 640))).FpzErrMsg = p + 168 + (*(*TInitData)(unsafe.Pointer(bp + 640))).FmInitFlags = uint32(0) + (*(*TInitData)(unsafe.Pointer(bp + 640))).FmxPage = _sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FpBt) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+6112, libc.VaList(bp+944, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb3)*32))).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16)))) + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(1) + (*(*TInitData)(unsafe.Pointer(bp + 640))).Frc = SQLITE_OK + (*(*TInitData)(unsafe.Pointer(bp + 640))).FnInitRow = uint32(0) + rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+640, uintptr(0)) + if rc == SQLITE_OK { + rc = (*(*TInitData)(unsafe.Pointer(bp + 640))).Frc + } + if rc == SQLITE_OK && (*(*TInitData)(unsafe.Pointer(bp + 640))).FnInitRow == uint32(0) { + /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse + ** at least one SQL statement. Any less than that indicates that + ** the sqlite_schema table is corrupt. */ + rc = _sqlite3CorruptError(tls, int32(99678)) + } + _sqlite3DbFreeNN(tls, db, zSql) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) + } + } + if rc != 0 { + _sqlite3ResetAllSchemasOfConnection(tls, db) + if rc == int32(SQLITE_NOMEM) { + goto no_mem + } + goto abort_due_to_error + } + goto _187 + /* Opcode: LoadAnalysis P1 * * * * + ** + ** Read the sqlite_stat1 table for database P1 and load the content + ** of that table into the internal index hash table. This will cause + ** the analysis to be used when preparing all subsequent queries. + */ + _134: + ; + rc = _sqlite3AnalysisLoad(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: DropTable P1 * * P4 * + ** + ** Remove the internal (in-memory) data structures that describe + ** the table named P4 in database P1. This is called after a table + ** is dropped from disk (using the Destroy opcode) in order to keep + ** the internal representation of the + ** schema consistent with what is on disk. + */ + _135: + ; + _sqlite3UnlinkAndDeleteTable(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) + goto _187 + /* Opcode: DropIndex P1 * * P4 * + ** + ** Remove the internal (in-memory) data structures that describe + ** the index named P4 in database P1. This is called after an index + ** is dropped from disk (using the Destroy opcode) + ** in order to keep the internal representation of the + ** schema consistent with what is on disk. + */ + _136: + ; + _sqlite3UnlinkAndDeleteIndex(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) + goto _187 + /* Opcode: DropTrigger P1 * * P4 * + ** + ** Remove the internal (in-memory) data structures that describe + ** the trigger named P4 in database P1. This is called after a trigger + ** is dropped from disk (using the Destroy opcode) in order to keep + ** the internal representation of the + ** schema consistent with what is on disk. + */ + _137: + ; + _sqlite3UnlinkAndDeleteTrigger(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16))) + goto _187 + /* Opcode: IntegrityCk P1 P2 P3 P4 P5 + ** + ** Do an analysis of the currently open database. Store in + ** register P1 the text of an error message describing any problems. + ** If no problems are found, store a NULL in register P1. + ** + ** The register P3 contains one less than the maximum number of allowed errors. + ** At most reg(P3) errors will be reported. + ** In other words, the analysis stops as soon as reg(P1) errors are + ** seen. Reg(P1) is updated with the number of errors remaining. + ** + ** The root page numbers of all tables in the database are integers + ** stored in P4_INTARRAY argument. + ** + ** If P5 is not zero, the check is done on the auxiliary database + ** file, not the main database file. + ** + ** This opcode is used to implement the integrity_check pragma. + */ + _138: + ; /* Register keeping track of errors remaining */ + nRoot = (*TOp)(unsafe.Pointer(pOp)).Fp2 + aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pnErr = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + rc = _sqlite3BtreeIntegrityCheck(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp5)*32))).FpBt, aRoot+1*4, nRoot, int32(*(*Ti64)(unsafe.Pointer(pnErr)))+int32(1), bp+680, bp+688) + _sqlite3VdbeMemSetNull(tls, pIn1) + if *(*int32)(unsafe.Pointer(bp + 680)) == 0 { + } else { + if rc != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 688))) + goto abort_due_to_error + } else { + *(*Ti64)(unsafe.Pointer(pnErr)) -= int64(*(*int32)(unsafe.Pointer(bp + 680)) - int32(1)) + _sqlite3VdbeMemSetStr(tls, pIn1, *(*uintptr)(unsafe.Pointer(bp + 688)), int64(-int32(1)), uint8(SQLITE_UTF8), __ccgo_fp(Xsqlite3_free)) + } + } + _sqlite3VdbeChangeEncoding(tls, pIn1, int32(encoding)) + goto check_for_interrupt + /* Opcode: RowSetAdd P1 P2 * * * + ** Synopsis: rowset(P1)=r[P2] + ** + ** Insert the integer value held by register P2 into a RowSet object + ** held in register P1. + ** + ** An assertion fails if P2 is not an integer. + */ + _139: + ; /* in1, in2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { + if _sqlite3VdbeMemSetRowSet(tls, pIn1) != 0 { + goto no_mem + } + } + _sqlite3RowSetInsert(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, *(*Ti64)(unsafe.Pointer(pIn2))) + goto _187 + /* Opcode: RowSetRead P1 P2 P3 * * + ** Synopsis: r[P3]=rowset(P1) + ** + ** Extract the smallest value from the RowSet object in P1 + ** and put that value into register P3. + ** Or, if RowSet object P1 is initially empty, leave P3 + ** unchanged and jump to instruction P2. + */ + _140: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 || _sqlite3RowSetNext(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, bp+696) == 0 { + /* The boolean index is empty */ + _sqlite3VdbeMemSetNull(tls, pIn1) + goto jump_to_p2_and_check_for_interrupt + } else { + /* A value was pulled from the index */ + _sqlite3VdbeMemSetInt64(tls, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56, *(*Ti64)(unsafe.Pointer(bp + 696))) + } + goto check_for_interrupt + /* Opcode: RowSetTest P1 P2 P3 P4 + ** Synopsis: if r[P3] in rowset(P1) goto P2 + ** + ** Register P3 is assumed to hold a 64-bit integer value. If register P1 + ** contains a RowSet object and that RowSet object contains + ** the value held in P3, jump to register P2. Otherwise, insert the + ** integer in P3 into the RowSet and continue on to the + ** next opcode. + ** + ** The RowSet object is optimized for the case where sets of integers + ** are inserted in distinct phases, which each set contains no duplicates. + ** Each set is identified by a unique P4 value. The first set + ** must have P4==0, the final set must have P4==-1, and for all other sets + ** must have P4>0. + ** + ** This allows optimizations: (a) when P4==0 there is no need to test + ** the RowSet object for P3, as it is guaranteed not to contain it, + ** (b) when P4==-1 there is no need to insert the value, as it will + ** never be tested for, and (c) when a value that is part of set X is + ** inserted, there is no need to search to see if the same value was + ** previously inserted as part of set X (only if it was previously + ** inserted as part of some other set). + */ + _141: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + iSet = (*TOp)(unsafe.Pointer(pOp)).Fp4.Fi + /* If there is anything other than a rowset object in memory cell P1, + ** delete it now and initialize P1 with an empty rowset + */ + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Blob) == 0 { + if _sqlite3VdbeMemSetRowSet(tls, pIn1) != 0 { + goto no_mem + } + } + if iSet != 0 { + exists = _sqlite3RowSetTest(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, iSet, *(*Ti64)(unsafe.Pointer(pIn3))) + if exists != 0 { + goto jump_to_p2 + } + } + if iSet >= 0 { + _sqlite3RowSetInsert(tls, (*TMem)(unsafe.Pointer(pIn1)).Fz, *(*Ti64)(unsafe.Pointer(pIn3))) + } + goto _187 + /* Opcode: Program P1 P2 P3 P4 P5 + ** + ** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). + ** + ** P1 contains the address of the memory cell that contains the first memory + ** cell in an array of values used as arguments to the sub-program. P2 + ** contains the address to jump to if the sub-program throws an IGNORE + ** exception using the RAISE() function. Register P3 contains the address + ** of a memory cell in this (the parent) VM that is used to allocate the + ** memory required by the sub-vdbe at runtime. + ** + ** P4 is a pointer to the VM containing the trigger program. + ** + ** If P5 is non-zero, then recursive program invocation is enabled. + */ + _142: + ; /* Token identifying trigger */ + pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16)) + pRt = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + /* If the p5 flag is clear, then recursive invocation of triggers is + ** disabled for backwards compatibility (p5 is set if this sub-program + ** is really a trigger, not a foreign key action, and the flag set + ** and cleared by the "PRAGMA recursive_triggers" command is clear). + ** + ** It is recursive invocation of triggers, at the SQL level, that is + ** disabled. In some cases a single trigger may generate more than one + ** SubProgram (if the trigger may be executed with more than one different + ** ON CONFLICT algorithm). SubProgram structures associated with a + ** single trigger all have the same value for the SubProgram.token + ** variable. */ + if (*TOp)(unsafe.Pointer(pOp)).Fp5 != 0 { + t1 = (*TSubProgram)(unsafe.Pointer(pProgram)).Ftoken + pFrame2 = (*TVdbe)(unsafe.Pointer(p)).FpFrame + for { + if !(pFrame2 != 0 && (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1) { + break + } + goto _276 + _276: + ; + pFrame2 = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent + } + if pFrame2 != 0 { + goto _187 + } + } + if (*TVdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer(db + 136 + 10*4)) { + rc = int32(SQLITE_ERROR) + _sqlite3VdbeError(tls, p, __ccgo_ts+6155, 0) + goto abort_due_to_error + } + /* Register pRt is used to store the memory required to save the state + ** of the current program, and the memory required at runtime to execute + ** the trigger program. If this trigger has been fired before, then pRt + ** is already allocated. Otherwise, it must be initialized. */ + if int32((*TMem)(unsafe.Pointer(pRt)).Fflags)&int32(MEM_Blob) == 0 { + /* SubProgram.nMem is set to the number of memory cells used by the + ** program stored in SubProgram.aOp. As well as these, one memory + ** cell is required for each cursor used by the program. Set local + ** variable nMem (and later, VdbeFrame.nChildMem) to this value. + */ + nMem = (*TSubProgram)(unsafe.Pointer(pProgram)).FnMem + (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr + if (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr == 0 { + nMem++ + } + nByte2 = int32((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7)) + uint64(nMem)*uint64(56) + uint64((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*uint64(8) + uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) + pFrame2 = _sqlite3DbMallocZero(tls, db, uint64(nByte2)) + if !(pFrame2 != 0) { + goto no_mem + } + _sqlite3VdbeMemRelease(tls, pRt) + (*TMem)(unsafe.Pointer(pRt)).Fflags = uint16(libc.Int32FromInt32(MEM_Blob) | libc.Int32FromInt32(MEM_Dyn)) + (*TMem)(unsafe.Pointer(pRt)).Fz = pFrame2 + (*TMem)(unsafe.Pointer(pRt)).Fn = nByte2 + (*TMem)(unsafe.Pointer(pRt)).FxDel = __ccgo_fp(_sqlite3VdbeFrameMemDel) + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Fv = p + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem = nMem + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr = (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Fpc = int32((int64(pOp) - int64(aOp)) / 24) + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaMem = (*TVdbe)(unsafe.Pointer(p)).FaMem + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnMem = (*TVdbe)(unsafe.Pointer(p)).FnMem + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FapCsr = (*TVdbe)(unsafe.Pointer(p)).FapCsr + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnCursor = (*TVdbe)(unsafe.Pointer(p)).FnCursor + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOp = (*TVdbe)(unsafe.Pointer(p)).FaOp + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnOp = (*TVdbe)(unsafe.Pointer(p)).FnOp + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken = (*TSubProgram)(unsafe.Pointer(pProgram)).Ftoken + pEnd = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem)*56 + pMem1 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + for { + if !(pMem1 != pEnd) { + break + } + (*TMem)(unsafe.Pointer(pMem1)).Fflags = uint16(MEM_Undefined) + (*TMem)(unsafe.Pointer(pMem1)).Fdb = db + goto _277 + _277: + ; + pMem1 += 56 + } + } else { + pFrame2 = (*TMem)(unsafe.Pointer(pRt)).Fz + } + (*TVdbe)(unsafe.Pointer(p)).FnFrame++ + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpParent = (*TVdbe)(unsafe.Pointer(p)).FpFrame + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FlastRowid = (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChange = (*TVdbe)(unsafe.Pointer(p)).FnChange + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnDbChange = (*Tsqlite3)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).Fdb)).FnChange + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FpAuxData = (*TVdbe)(unsafe.Pointer(p)).FpAuxData + (*TVdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) + (*TVdbe)(unsafe.Pointer(p)).FnChange = 0 + (*TVdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 + v278 = pFrame2 + uintptr((libc.Uint64FromInt64(112)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + aMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FaMem = v278 + (*TVdbe)(unsafe.Pointer(p)).FnMem = (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem + (*TVdbe)(unsafe.Pointer(p)).FnCursor = int32(uint16((*TVdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) + (*TVdbe)(unsafe.Pointer(p)).FapCsr = aMem + uintptr((*TVdbe)(unsafe.Pointer(p)).FnMem)*56 + (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = (*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8 + libc.Xmemset(tls, (*TVdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, uint64(((*TSubProgram)(unsafe.Pointer(pProgram)).FnOp+int32(7))/int32(8))) + v279 = (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp + aOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FaOp = v279 + (*TVdbe)(unsafe.Pointer(p)).FnOp = (*TSubProgram)(unsafe.Pointer(pProgram)).FnOp + pOp = aOp + uintptr(-libc.Int32FromInt32(1))*24 + goto check_for_interrupt + /* Opcode: Param P1 P2 * * * + ** + ** This opcode is only ever present in sub-programs called via the + ** OP_Program instruction. Copy a value currently stored in a memory + ** cell of the calling (parent) frame to cell P2 in the current frames + ** address space. This is used by trigger programs to access the new.* + ** and old.* values. + ** + ** The address of the cell in the parent frame is determined by adding + ** the value of the P1 argument to the value of the P1 argument to the + ** calling OP_Program instruction. + */ + _143: + ; + pOut = _out2Prerelease(tls, p, pOp) + pFrame3 = (*TVdbe)(unsafe.Pointer(p)).FpFrame + pIn = (*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1+(*(*TOp)(unsafe.Pointer((*TVdbeFrame)(unsafe.Pointer(pFrame3)).FaOp + uintptr((*TVdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24))).Fp1)*56 + _sqlite3VdbeMemShallowCopy(tls, pOut, pIn, int32(MEM_Ephem)) + goto _187 + /* Opcode: FkCounter P1 P2 * * * + ** Synopsis: fkctr[P1]+=P2 + ** + ** Increment a "constraint counter" by P2 (P2 may be negative or positive). + ** If P1 is non-zero, the database constraint counter is incremented + ** (deferred foreign key constraints). Otherwise, if P1 is zero, the + ** statement counter is incremented (immediate foreign key constraints). + */ + _144: + ; + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { + *(*Ti64)(unsafe.Pointer(db + 792)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) + } else { + if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + *(*Ti64)(unsafe.Pointer(db + 784)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) + } else { + *(*Ti64)(unsafe.Pointer(p + 80)) += int64((*TOp)(unsafe.Pointer(pOp)).Fp2) + } + } + goto _187 + /* Opcode: FkIfZero P1 P2 * * * + ** Synopsis: if fkctr[P1]==0 goto P2 + ** + ** This opcode tests if a foreign key constraint-counter is currently zero. + ** If so, jump to instruction P2. Otherwise, fall through to the next + ** instruction. + ** + ** If P1 is non-zero, then the jump is taken if the database constraint-counter + ** is zero (the one that counts deferred constraint violations). If P1 is + ** zero, the jump is taken if the statement constraint-counter is zero + ** (immediate foreign key constraint violations). + */ + _145: + ; /* jump */ + if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { + goto jump_to_p2 + } + } else { + if (*TVdbe)(unsafe.Pointer(p)).FnFkConstraint == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == 0 { + goto jump_to_p2 + } + } + goto _187 + /* Opcode: MemMax P1 P2 * * * + ** Synopsis: r[P1]=max(r[P1],r[P2]) + ** + ** P1 is a register in the root frame of this VM (the root frame is + ** different from the current frame if this instruction is being executed + ** within a sub-program). Set the value of register P1 to the maximum of + ** its current value and the value in register P2. + ** + ** This instruction throws an error if the memory cell is not initially + ** an integer. + */ + _146: + ; + if (*TVdbe)(unsafe.Pointer(p)).FpFrame != 0 { + pFrame4 = (*TVdbe)(unsafe.Pointer(p)).FpFrame + for { + if !((*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { + break + } + goto _280 + _280: + ; + pFrame4 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FpParent + } + pIn1 = (*TVdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + } else { + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + } + _sqlite3VdbeMemIntegerify(tls, pIn1) + pIn2 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + _sqlite3VdbeMemIntegerify(tls, pIn2) + if *(*Ti64)(unsafe.Pointer(pIn1)) < *(*Ti64)(unsafe.Pointer(pIn2)) { + *(*Ti64)(unsafe.Pointer(pIn1)) = *(*Ti64)(unsafe.Pointer(pIn2)) + } + goto _187 + /* Opcode: IfPos P1 P2 P3 * * + ** Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 + ** + ** Register P1 must contain an integer. + ** If the value of register P1 is 1 or greater, subtract P3 from the + ** value in P1 and jump to P2. + ** + ** If the initial value of register P1 is less than 1, then the + ** value is unchanged and control passes through to the next instruction. + */ + _147: + ; /* jump, in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { + *(*Ti64)(unsafe.Pointer(pIn1)) -= int64((*TOp)(unsafe.Pointer(pOp)).Fp3) + goto jump_to_p2 + } + goto _187 + /* Opcode: OffsetLimit P1 P2 P3 * * + ** Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) + ** + ** This opcode performs a commonly used computation associated with + ** LIMIT and OFFSET processing. r[P1] holds the limit counter. r[P3] + ** holds the offset counter. The opcode computes the combined value + ** of the LIMIT and OFFSET and stores that value in r[P2]. The r[P2] + ** value computed is the total number of rows that will need to be + ** visited in order to complete the query. + ** + ** If r[P3] is zero or negative, that means there is no OFFSET + ** and r[P2] is set to be the value of the LIMIT, r[P1]. + ** + ** if r[P1] is zero or negative, that means there is no LIMIT + ** and r[P2] is set to -1. + ** + ** Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. + */ + _148: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pIn3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + pOut = _out2Prerelease(tls, p, pOp) + *(*Ti64)(unsafe.Pointer(bp + 704)) = *(*Ti64)(unsafe.Pointer(pIn1)) + if v282 = *(*Ti64)(unsafe.Pointer(bp + 704)) <= 0; !v282 { + if *(*Ti64)(unsafe.Pointer(pIn3)) > 0 { + v281 = *(*Ti64)(unsafe.Pointer(pIn3)) + } else { + v281 = 0 + } + } + if v282 || _sqlite3AddInt64(tls, bp+704, v281) != 0 { + /* If the LIMIT is less than or equal to zero, loop forever. This + ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then + ** also loop forever. This is undocumented. In fact, one could argue + ** that the loop should terminate. But assuming 1 billion iterations + ** per second (far exceeding the capabilities of any current hardware) + ** it would take nearly 300 years to actually reach the limit. So + ** looping forever is a reasonable approximation. */ + *(*Ti64)(unsafe.Pointer(pOut)) = int64(-int32(1)) + } else { + *(*Ti64)(unsafe.Pointer(pOut)) = *(*Ti64)(unsafe.Pointer(bp + 704)) + } + goto _187 + /* Opcode: IfNotZero P1 P2 * * * + ** Synopsis: if r[P1]!=0 then r[P1]--, goto P2 + ** + ** Register P1 must contain an integer. If the content of register P1 is + ** initially greater than zero, then decrement the value in register P1. + ** If it is non-zero (negative or positive) and then also jump to P2. + ** If register P1 is initially zero, leave it unchanged and fall through. + */ + _149: + ; /* jump, in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if *(*Ti64)(unsafe.Pointer(pIn1)) != 0 { + if *(*Ti64)(unsafe.Pointer(pIn1)) > 0 { + *(*Ti64)(unsafe.Pointer(pIn1))-- + } + goto jump_to_p2 + } + goto _187 + /* Opcode: DecrJumpZero P1 P2 * * * + ** Synopsis: if (--r[P1])==0 goto P2 + ** + ** Register P1 must hold an integer. Decrement the value in P1 + ** and jump to P2 if the new value is exactly zero. + */ + _150: + ; /* jump, in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if *(*Ti64)(unsafe.Pointer(pIn1)) > int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<= 0) { + break + } + *(*uintptr)(unsafe.Pointer(pCtx1 + 48 + uintptr(i4)*8)) = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2+i4)*56 + goto _283 + _283: + ; + i4-- + } + } + (*TMem)(unsafe.Pointer(pMem2)).Fn++ + if (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpFunc)).FxInverse})))(tls, pCtx1, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx1)).Fargc), pCtx1+48) + } else { + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpFunc)).FxSFunc})))(tls, pCtx1, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx1)).Fargc), pCtx1+48) + } /* IMP: R-24505-23230 */ + if (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FisError != 0 { + if (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0 { + _sqlite3VdbeError(tls, p, __ccgo_ts+3827, libc.VaList(bp+944, Xsqlite3_value_text(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + rc = (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FisError + } + if (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FskipFlag != 0 { + i4 = (*(*TOp)(unsafe.Pointer(pOp + uintptr(-libc.Int32FromInt32(1))*24))).Fp1 + if i4 != 0 { + _sqlite3VdbeMemSetInt64(tls, aMem+uintptr(i4)*56, int64(1)) + } + (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FskipFlag = uint8(0) + } + _sqlite3VdbeMemRelease(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpOut) + (*TMem)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FpOut)).Fflags = uint16(MEM_Null) + (*Tsqlite3_context)(unsafe.Pointer(pCtx1)).FisError = 0 + if rc != 0 { + goto abort_due_to_error + } + } + goto _187 + /* Opcode: AggFinal P1 P2 * P4 * + ** Synopsis: accum=r[P1] N=P2 + ** + ** P1 is the memory location that is the accumulator for an aggregate + ** or window function. Execute the finalizer function + ** for an aggregate and store the result in P1. + ** + ** P2 is the number of arguments that the step function takes and + ** P4 is a pointer to the FuncDef for this function. The P2 + ** argument is not used by this opcode. It is only there to disambiguate + ** functions that can take varying numbers of arguments. The + ** P4 argument is only needed for the case where + ** the step function was not previously called. + */ + /* Opcode: AggValue * P2 P3 P4 * + ** Synopsis: r[P3]=value N=P2 + ** + ** Invoke the xValue() function and store the result in register P3. + ** + ** P2 is the number of arguments that the step function takes and + ** P4 is a pointer to the FuncDef for this function. The P2 + ** argument is not used by this opcode. It is only there to disambiguate + ** functions that can take varying numbers of arguments. The + ** P4 argument is only needed for the case where + ** the step function was not previously called. + */ + _155: + ; + _154: + ; + pMem3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + rc = _sqlite3VdbeMemAggValue(tls, pMem3, aMem+uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56, *(*uintptr)(unsafe.Pointer(pOp + 16))) + pMem3 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + } else { + rc = _sqlite3VdbeMemFinalize(tls, pMem3, *(*uintptr)(unsafe.Pointer(pOp + 16))) + } + if rc != 0 { + _sqlite3VdbeError(tls, p, __ccgo_ts+3827, libc.VaList(bp+944, Xsqlite3_value_text(tls, pMem3))) + goto abort_due_to_error + } + _sqlite3VdbeChangeEncoding(tls, pMem3, int32(encoding)) + goto _187 + /* Opcode: Checkpoint P1 P2 P3 * * + ** + ** Checkpoint database P1. This is a no-op if P1 is not currently in + ** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL, + ** RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns + ** SQLITE_BUSY or not, respectively. Write the number of pages in the + ** WAL after the checkpoint into mem[P3+1] and the number of pages + ** in the WAL that have been checkpointed after the checkpoint + ** completes into mem[P3+2]. However on an error, mem[P3+1] and + ** mem[P3+2] are initialized to -1. + */ + _156: + ; /* Write results here */ + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[0] = 0 + v284 = -libc.Int32FromInt32(1) + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(2)] = v284 + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[int32(1)] = v284 + rc = _sqlite3Checkpoint(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, (*TOp)(unsafe.Pointer(pOp)).Fp2, bp+712+1*4, bp+712+2*4) + if rc != 0 { + if rc != int32(SQLITE_BUSY) { + goto abort_due_to_error + } + rc = SQLITE_OK + (*(*[3]int32)(unsafe.Pointer(bp + 712)))[0] = int32(1) + } + i5 = 0 + pMem4 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + for { + if !(i5 < int32(3)) { + break + } + _sqlite3VdbeMemSetInt64(tls, pMem4, int64((*(*[3]int32)(unsafe.Pointer(bp + 712)))[i5])) + goto _285 + _285: + ; + i5++ + pMem4 += 56 + } + goto _187 + /* Opcode: JournalMode P1 P2 P3 * * + ** + ** Change the journal mode of database P1 to P3. P3 must be one of the + ** PAGER_JOURNALMODE_XXX values. If changing between the various rollback + ** modes (delete, truncate, persist, off and memory), this is a simple + ** operation. No IO is required. + ** + ** If changing into or out of WAL mode the procedure is more complicated. + ** + ** Write a string containing the final journal-mode to register P2. + */ + _157: + ; /* Name of database file for pPager */ + pOut = _out2Prerelease(tls, p, pOp) + eNew = (*TOp)(unsafe.Pointer(pOp)).Fp3 + pBt1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt + pPager = _sqlite3BtreePager(tls, pBt1) + eOld = _sqlite3PagerGetJournalMode(tls, pPager) + if eNew == -int32(1) { + eNew = eOld + } + if !(_sqlite3PagerOkToChangeJournalMode(tls, pPager) != 0) { + eNew = eOld + } + zFilename = _sqlite3PagerFilename(tls, pPager, int32(1)) + /* Do not allow a transition to journal_mode=WAL for a database + ** in temporary storage or if the VFS does not support shared memory + */ + if eNew == int32(PAGER_JOURNALMODE_WAL) && (_sqlite3Strlen30(tls, zFilename) == 0 || !(_sqlite3PagerWalSupported(tls, pPager) != 0)) { + eNew = eOld + } + if eNew != eOld && (eOld == int32(PAGER_JOURNALMODE_WAL) || eNew == int32(PAGER_JOURNALMODE_WAL)) { + if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeRead > int32(1) { + rc = int32(SQLITE_ERROR) + if eNew == int32(PAGER_JOURNALMODE_WAL) { + v286 = __ccgo_ts + 6192 + } else { + v286 = __ccgo_ts + 6197 + } + _sqlite3VdbeError(tls, p, __ccgo_ts+6204, libc.VaList(bp+944, v286)) + goto abort_due_to_error + } else { + if eOld == int32(PAGER_JOURNALMODE_WAL) { + /* If leaving WAL mode, close the log file. If successful, the call + ** to PagerCloseWal() checkpoints and deletes the write-ahead-log + ** file. An EXCLUSIVE lock may still be held on the database file + ** after a successful return. + */ + rc = _sqlite3PagerCloseWal(tls, pPager, db) + if rc == SQLITE_OK { + _sqlite3PagerSetJournalMode(tls, pPager, eNew) + } + } else { + if eOld == int32(PAGER_JOURNALMODE_MEMORY) { + /* Cannot transition directly from MEMORY to WAL. Use mode OFF + ** as an intermediate */ + _sqlite3PagerSetJournalMode(tls, pPager, int32(PAGER_JOURNALMODE_OFF)) + } + } + /* Open a transaction on the database file. Regardless of the journal + ** mode, this transaction always uses a rollback journal. + */ + if rc == SQLITE_OK { + if eNew == int32(PAGER_JOURNALMODE_WAL) { + v287 = int32(2) + } else { + v287 = int32(1) + } + rc = _sqlite3BtreeSetVersion(tls, pBt1, v287) + } + } + } + if rc != 0 { + eNew = eOld + } + eNew = _sqlite3PagerSetJournalMode(tls, pPager, eNew) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(libc.Int32FromInt32(MEM_Str) | libc.Int32FromInt32(MEM_Static) | libc.Int32FromInt32(MEM_Term)) + (*TMem)(unsafe.Pointer(pOut)).Fz = _sqlite3JournalModename(tls, eNew) + (*TMem)(unsafe.Pointer(pOut)).Fn = _sqlite3Strlen30(tls, (*TMem)(unsafe.Pointer(pOut)).Fz) + (*TMem)(unsafe.Pointer(pOut)).Fenc = uint8(SQLITE_UTF8) + _sqlite3VdbeChangeEncoding(tls, pOut, int32(encoding)) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: Vacuum P1 P2 * * * + ** + ** Vacuum the entire database P1. P1 is 0 for "main", and 2 or more + ** for an attached database. The "temp" database may not be vacuumed. + ** + ** If P2 is not zero, then it is a register holding a string which is + ** the file into which the result of vacuum should be written. When + ** P2 is zero, the vacuum overwrites the original database. + */ + _158: + ; + if (*TOp)(unsafe.Pointer(pOp)).Fp2 != 0 { + v288 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + } else { + v288 = uintptr(0) + } + rc = _sqlite3RunVacuum(tls, p+168, db, (*TOp)(unsafe.Pointer(pOp)).Fp1, v288) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: IncrVacuum P1 P2 * * * + ** + ** Perform a single step of the incremental vacuum procedure on + ** the P1 database. If the vacuum has finished, jump to instruction + ** P2. Otherwise, fall through to the next instruction. + */ + _159: + ; + pBt2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt + rc = _sqlite3BtreeIncrVacuum(tls, pBt2) + if rc != 0 { + if rc != int32(SQLITE_DONE) { + goto abort_due_to_error + } + rc = SQLITE_OK + goto jump_to_p2 + } + goto _187 + /* Opcode: Expire P1 P2 * * * + ** + ** Cause precompiled statements to expire. When an expired statement + ** is executed using sqlite3_step() it will either automatically + ** reprepare itself (if it was originally created using sqlite3_prepare_v2()) + ** or it will fail with SQLITE_SCHEMA. + ** + ** If P1 is 0, then all SQL statements become expired. If P1 is non-zero, + ** then only the currently executing statement is expired. + ** + ** If P2 is 0, then SQL statements are expired immediately. If P2 is 1, + ** then running SQL statements are allowed to continue to run to completion. + ** The P2==1 case occurs when a CREATE INDEX or similar schema change happens + ** that might help the statement run faster but which does not affect the + ** correctness of operation. + */ + _160: + ; + if !((*TOp)(unsafe.Pointer(pOp)).Fp1 != 0) { + _sqlite3ExpirePreparedStatements(tls, db, (*TOp)(unsafe.Pointer(pOp)).Fp2) + } else { + libc.SetBitFieldPtr16Uint32(p+200, uint32((*TOp)(unsafe.Pointer(pOp)).Fp2+libc.Int32FromInt32(1)), 0, 0x3) + } + goto _187 + /* Opcode: CursorLock P1 * * * * + ** + ** Lock the btree to which cursor P1 is pointing so that the btree cannot be + ** written by an other cursor. + */ + _161: + ; + pC30 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + _sqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC30 + 48))) + goto _187 + /* Opcode: CursorUnlock P1 * * * * + ** + ** Unlock the btree to which cursor P1 is pointing so that it can be + ** written by other cursors. + */ + _162: + ; + pC31 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + _sqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC31 + 48))) + goto _187 + /* Opcode: TableLock P1 P2 P3 P4 * + ** Synopsis: iDb=P1 root=P2 write=P3 + ** + ** Obtain a lock on a particular table. This instruction is only used when + ** the shared-cache feature is enabled. + ** + ** P1 is the index of the database in sqlite3.aDb[] of the database + ** on which the lock is acquired. A readlock is obtained if P3==0 or + ** a write lock if P3==1. + ** + ** P2 contains the root-page of the table to lock. + ** + ** P4 contains a pointer to the name of the table being locked. This is only + ** used to generate an error message if the lock cannot be obtained. + */ + _163: + ; + isWriteLock = uint8((*TOp)(unsafe.Pointer(pOp)).Fp3) + if isWriteLock != 0 || uint64(0) == (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00004))< 0 { + _sqlite3VdbeError(tls, p, __ccgo_ts+3827, libc.VaList(bp+944, Xsqlite3_value_text(tls, pDest2))) + rc = (*(*Tsqlite3_context)(unsafe.Pointer(bp + 800))).FisError + } + _sqlite3VdbeChangeEncoding(tls, pDest2, int32(encoding)) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: VNext P1 P2 * * * + ** + ** Advance virtual table P1 to the next row in its result set and + ** jump to instruction P2. Or, if the virtual table has reached + ** the end of its result set, then fall through to the next instruction. + */ + _172: + ; + pCur6 = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*8)) + if (*TVdbeCursor)(unsafe.Pointer(pCur6)).FnullRow != 0 { + goto _187 + } + pVtab5 = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur6 + 48)))).FpVtab + pModule5 = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab5)).FpModule + /* Invoke the xNext() method of the module. There is no way for the + ** underlying implementation to return an error if one occurs during + ** xNext(). Instead, if an error occurs, true is returned (indicating that + ** data is available) and the error code returned when xColumn or + ** some other method is next invoked on the save virtual table cursor. + */ + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule5)).FxNext})))(tls, *(*uintptr)(unsafe.Pointer(pCur6 + 48))) + _sqlite3VtabImportErrmsg(tls, p, pVtab5) + if rc != 0 { + goto abort_due_to_error + } + res12 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule5)).FxEof})))(tls, *(*uintptr)(unsafe.Pointer(pCur6 + 48))) + if !(res12 != 0) { + /* If there is data, jump to P2 */ + goto jump_to_p2_and_check_for_interrupt + } + goto check_for_interrupt + /* Opcode: VRename P1 * * P4 * + ** + ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + ** This opcode invokes the corresponding xRename method. The value + ** in register P1 is passed as the zName argument to the xRename method. + */ + _173: + ; + isLegacy = int32((*Tsqlite3)(unsafe.Pointer(db)).Fflags & libc.Uint64FromInt32(SQLITE_LegacyAlter)) + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(SQLITE_LegacyAlter) + pVtab6 = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab + pName = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + rc = _sqlite3VdbeChangeEncoding(tls, pName, int32(SQLITE_UTF8)) + if rc != 0 { + goto abort_due_to_error + } + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVtab6)).FpModule)).FxRename})))(tls, pVtab6, (*TMem)(unsafe.Pointer(pName)).Fz) + if isLegacy == 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_LegacyAlter) + } + _sqlite3VtabImportErrmsg(tls, p, pVtab6) + libc.SetBitFieldPtr16Uint32(p+200, libc.Uint32FromInt32(0), 0, 0x3) + if rc != 0 { + goto abort_due_to_error + } + goto _187 + /* Opcode: VUpdate P1 P2 P3 P4 P5 + ** Synopsis: data=r[P3@P2] + ** + ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + ** This opcode invokes the corresponding xUpdate method. P2 values + ** are contiguous memory cells starting at P3 to pass to the xUpdate + ** invocation. The value in register (P3+P2-1) corresponds to the + ** p2th element of the argv array passed to xUpdate. + ** + ** The xUpdate method will do a DELETE or an INSERT or both. + ** The argv[0] element (which corresponds to memory cell P3) + ** is the rowid of a row to delete. If argv[0] is NULL then no + ** deletion occurs. The argv[1] element is the rowid of the new + ** row. This can be NULL to have the virtual table select the new + ** rowid for itself. The subsequent elements in the array are + ** the values of columns in the new row. + ** + ** If P2==1 then no insert is performed. argv[0] is the rowid of + ** a row to delete. + ** + ** P1 is a boolean flag. If it is set to true and the xUpdate call + ** is successful, then the value returned by sqlite3_last_insert_rowid() + ** is set to the value of the rowid for the row just inserted. + ** + ** P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to + ** apply in the case of a constraint failure on an insert or update. + */ + _174: + ; + *(*Tsqlite_int64)(unsafe.Pointer(bp + 928)) = 0 + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto no_mem + } + pVtab7 = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FpVtab + if pVtab7 == uintptr(0) || (*Tsqlite3_vtab)(unsafe.Pointer(pVtab7)).FpModule == uintptr(0) { + rc = int32(SQLITE_LOCKED) + goto abort_due_to_error + } + pModule6 = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab7)).FpModule + nArg1 = (*TOp)(unsafe.Pointer(pOp)).Fp2 + if (*Tsqlite3_module)(unsafe.Pointer(pModule6)).FxUpdate != 0 { + vtabOnConflict = (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict + apArg1 = (*TVdbe)(unsafe.Pointer(p)).FapArg + pX1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + i7 = 0 + for { + if !(i7 < nArg1) { + break + } + *(*uintptr)(unsafe.Pointer(apArg1 + uintptr(i7)*8)) = pX1 + pX1 += 56 + goto _290 + _290: + ; + i7++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict = uint8((*TOp)(unsafe.Pointer(pOp)).Fp5) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule6)).FxUpdate})))(tls, pVtab7, nArg1, apArg1, bp+928) + (*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict = vtabOnConflict + _sqlite3VtabImportErrmsg(tls, p, pVtab7) + if rc == SQLITE_OK && (*TOp)(unsafe.Pointer(pOp)).Fp1 != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid = *(*Tsqlite_int64)(unsafe.Pointer(bp + 928)) + } + if rc&int32(0xff) == int32(SQLITE_CONSTRAINT) && (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16)))).FbConstraint != 0 { + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == int32(OE_Ignore) { + rc = SQLITE_OK + } else { + if int32((*TOp)(unsafe.Pointer(pOp)).Fp5) == int32(OE_Replace) { + v291 = int32(OE_Abort) + } else { + v291 = int32((*TOp)(unsafe.Pointer(pOp)).Fp5) + } + (*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(v291) + } + } else { + (*TVdbe)(unsafe.Pointer(p)).FnChange++ + } + if rc != 0 { + goto abort_due_to_error + } + } + goto _187 + /* Opcode: Pagecount P1 P2 * * * + ** + ** Write the current number of pages in database P1 to memory cell P2. + */ + _175: + ; /* out2 */ + pOut = _out2Prerelease(tls, p, pOp) + *(*Ti64)(unsafe.Pointer(pOut)) = int64(_sqlite3BtreeLastPage(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt)) + goto _187 + /* Opcode: MaxPgcnt P1 P2 P3 * * + ** + ** Try to set the maximum page count for database P1 to the value in P3. + ** Do not let the maximum page count fall below the current page count and + ** do not change the maximum page count value if P3==0. + ** + ** Store the maximum page count after the change in register P2. + */ + _176: + ; + pOut = _out2Prerelease(tls, p, pOp) + pBt3 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*32))).FpBt + newMax = uint32(0) + if (*TOp)(unsafe.Pointer(pOp)).Fp3 != 0 { + newMax = _sqlite3BtreeLastPage(tls, pBt3) + if newMax < uint32((*TOp)(unsafe.Pointer(pOp)).Fp3) { + newMax = uint32((*TOp)(unsafe.Pointer(pOp)).Fp3) + } + } + *(*Ti64)(unsafe.Pointer(pOut)) = int64(_sqlite3BtreeMaxPageCount(tls, pBt3, newMax)) + goto _187 + /* Opcode: Function P1 P2 P3 P4 * + ** Synopsis: r[P3]=func(r[P2@NP]) + ** + ** Invoke a user function (P4 is a pointer to an sqlite3_context object that + ** contains a pointer to the function to be run) with arguments taken + ** from register P2 and successors. The number of arguments is in + ** the sqlite3_context object that P4 points to. + ** The result of the function is stored + ** in register P3. Register P3 must not be one of the function inputs. + ** + ** P1 is a 32-bit bitmask indicating whether or not each argument to the + ** function was determined to be constant at compile time. If the first + ** argument was constant then bit 0 of P1 is set. This is used to determine + ** whether meta data associated with a user function argument using the + ** sqlite3_set_auxdata() API may be safely retained until the next + ** invocation of this opcode. + ** + ** See also: AggStep, AggFinal, PureFunc + */ + /* Opcode: PureFunc P1 P2 P3 P4 * + ** Synopsis: r[P3]=func(r[P2@NP]) + ** + ** Invoke a user function (P4 is a pointer to an sqlite3_context object that + ** contains a pointer to the function to be run) with arguments taken + ** from register P2 and successors. The number of arguments is in + ** the sqlite3_context object that P4 points to. + ** The result of the function is stored + ** in register P3. Register P3 must not be one of the function inputs. + ** + ** P1 is a 32-bit bitmask indicating whether or not each argument to the + ** function was determined to be constant at compile time. If the first + ** argument was constant then bit 0 of P1 is set. This is used to determine + ** whether meta data associated with a user function argument using the + ** sqlite3_set_auxdata() API may be safely retained until the next + ** invocation of this opcode. + ** + ** This opcode works exactly like OP_Function. The only difference is in + ** its name. This opcode is used in places where the function must be + ** purely non-deterministic. Some built-in date/time functions can be + ** either deterministic of non-deterministic, depending on their arguments. + ** When those function are used in a non-deterministic way, they will check + ** to see if they were called using OP_PureFunc instead of OP_Function, and + ** if they were, they throw an error. + ** + ** See also: AggStep, AggFinal, Function + */ + _178: + ; /* group */ + _177: + ; + pCtx2 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + /* If this function is inside of a trigger, the register array in aMem[] + ** might change from one evaluation to the next. The next block of code + ** checks to see if the register array has changed, and if so it + ** reinitializes the relevant parts of the sqlite3_context object */ + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp3)*56 + if (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FpOut != pOut { + (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FpVdbe = p + (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FpOut = pOut + (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).Fenc = encoding + i8 = int32((*Tsqlite3_context)(unsafe.Pointer(pCtx2)).Fargc) - int32(1) + for { + if !(i8 >= 0) { + break + } + *(*uintptr)(unsafe.Pointer(pCtx2 + 48 + uintptr(i8)*8)) = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2+i8)*56 + goto _292 + _292: + ; + i8-- + } + } + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Null)) + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDef)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FpFunc)).FxSFunc})))(tls, pCtx2, int32((*Tsqlite3_context)(unsafe.Pointer(pCtx2)).Fargc), pCtx2+48) /* IMP: R-24505-23230 */ + /* If the function returned an error, throw an exception */ + if (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError != 0 { + if (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0 { + _sqlite3VdbeError(tls, p, __ccgo_ts+3827, libc.VaList(bp+944, Xsqlite3_value_text(tls, pOut))) + rc = (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError + } + _sqlite3VdbeDeleteAuxData(tls, db, p+296, (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FiOp, (*TOp)(unsafe.Pointer(pOp)).Fp1) + (*Tsqlite3_context)(unsafe.Pointer(pCtx2)).FisError = 0 + if rc != 0 { + goto abort_due_to_error + } + } + goto _187 + /* Opcode: ClrSubtype P1 * * * * + ** Synopsis: r[P1].subtype = 0 + ** + ** Clear the subtype from register P1. + */ + _179: + ; /* in1 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + p293 = pIn1 + 20 + *(*Tu16)(unsafe.Pointer(p293)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p293))) & ^libc.Int32FromInt32(MEM_Subtype)) + goto _187 + /* Opcode: GetSubtype P1 P2 * * * + ** Synopsis: r[P2] = r[P1].subtype + ** + ** Extract the subtype value from register P1 and write that subtype + ** into register P2. If P1 has no subtype, then P1 gets a NULL. + */ + _180: + ; /* in1 out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Subtype) != 0 { + _sqlite3VdbeMemSetInt64(tls, pOut, int64((*TMem)(unsafe.Pointer(pIn1)).FeSubtype)) + } else { + _sqlite3VdbeMemSetNull(tls, pOut) + } + goto _187 + /* Opcode: SetSubtype P1 P2 * * * + ** Synopsis: r[P2].subtype = r[P1] + ** + ** Set the subtype value of register P2 to the integer from register P1. + ** If P1 is NULL, clear the subtype from p2. + */ + _181: + ; /* in1 out2 */ + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + pOut = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp2)*56 + if int32((*TMem)(unsafe.Pointer(pIn1)).Fflags)&int32(MEM_Null) != 0 { + p294 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p294)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p294))) & ^libc.Int32FromInt32(MEM_Subtype)) + } else { + p295 = pOut + 20 + *(*Tu16)(unsafe.Pointer(p295)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p295))) | libc.Int32FromInt32(MEM_Subtype)) + (*TMem)(unsafe.Pointer(pOut)).FeSubtype = uint8(*(*Ti64)(unsafe.Pointer(pIn1)) & libc.Int64FromInt32(0xff)) + } + goto _187 + /* Opcode: FilterAdd P1 * P3 P4 * + ** Synopsis: filter(P1) += key(P3@P4) + ** + ** Compute a hash on the P4 registers starting with r[P3] and + ** add that hash to the bloom filter contained in r[P1]. + */ + _182: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + h = _filterHash(tls, aMem, pOp) + h %= uint64((*TMem)(unsafe.Pointer(pIn1)).Fn * libc.Int32FromInt32(8)) + p296 = (*TMem)(unsafe.Pointer(pIn1)).Fz + uintptr(h/uint64(8)) + *(*int8)(unsafe.Pointer(p296)) = int8(int32(*(*int8)(unsafe.Pointer(p296))) | libc.Int32FromInt32(1)<<(h&libc.Uint64FromInt32(7))) + goto _187 + /* Opcode: Filter P1 P2 P3 P4 * + ** Synopsis: if key(P3@P4) not in filter(P1) goto P2 + ** + ** Compute a hash on the key contained in the P4 registers starting + ** with r[P3]. Check to see if that hash is found in the + ** bloom filter hosted by register P1. If it is not present then + ** maybe jump to P2. Otherwise fall through. + ** + ** False negatives are harmless. It is always safe to fall through, + ** even if the value is in the bloom filter. A false negative causes + ** more CPU cycles to be used, but it should still yield the correct + ** answer. However, an incorrect answer may well arise from a + ** false positive - if the jump is taken when it should fall through. + */ + _183: + ; + pIn1 = aMem + uintptr((*TOp)(unsafe.Pointer(pOp)).Fp1)*56 + h1 = _filterHash(tls, aMem, pOp) + h1 %= uint64((*TMem)(unsafe.Pointer(pIn1)).Fn * libc.Int32FromInt32(8)) + if int32(*(*int8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pIn1)).Fz + uintptr(h1/uint64(8)))))&(int32(1)<<(h1&uint64(7))) == 0 { + *(*Tu32)(unsafe.Pointer(p + 212 + 8*4))++ + goto jump_to_p2 + } else { + *(*Tu32)(unsafe.Pointer(p + 212 + 7*4))++ + } + goto _187 + /* Opcode: Trace P1 P2 * P4 * + ** + ** Write P4 on the statement trace output if statement tracing is + ** enabled. + ** + ** Operand P1 must be 0x7fffffff and P2 must positive. + */ + /* Opcode: Init P1 P2 P3 P4 * + ** Synopsis: Start at P2 + ** + ** Programs contain a single instance of this opcode as the very first + ** opcode. + ** + ** If tracing is enabled (by the sqlite3_trace()) interface, then + ** the UTF-8 string contained in P4 is emitted on the trace callback. + ** Or if P4 is blank, use the string returned by sqlite3_sql(). + ** + ** If P2 is not zero, jump to instruction P2. + ** + ** Increment the value of P1 so that OP_Once opcodes will jump the + ** first time they are evaluated for this run. + ** + ** If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT + ** error is encountered. + */ + _185: + ; + _184: + ; + /* If the P4 argument is not NULL, then it must be an SQL comment string. + ** The "--" string is broken up to prevent false-positives with srcck1.c. + ** + ** This assert() provides evidence for: + ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that + ** would have been returned by the legacy sqlite3_trace() interface by + ** using the X argument when X begins with "--" and invoking + ** sqlite3_expanded_sql(P) otherwise. + */ + /* OP_Init is always instruction 0 */ + if v299 = int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&(libc.Int32FromInt32(SQLITE_TRACE_STMT)|libc.Int32FromInt32(SQLITE_TRACE_LEGACY)) != 0 && int32((*TVdbe)(unsafe.Pointer(p)).FminWriteFileFormat) != int32(254); v299 { + if *(*uintptr)(unsafe.Pointer(pOp + 16)) != 0 { + v298 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + } else { + v298 = (*TVdbe)(unsafe.Pointer(p)).FzSql + } + v297 = v298 + zTrace = v297 + } + if v299 && v297 != uintptr(0) { + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_LEGACY) != 0 { + z2 = _sqlite3VdbeExpandSql(tls, p, zTrace) + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).Ftrace.FxLegacy})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, z2) + Xsqlite3_free(tls, z2) + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec > int32(1) { + z3 = _sqlite3MPrintf(tls, db, __ccgo_ts+6295, libc.VaList(bp+944, zTrace)) + (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) + _sqlite3DbFree(tls, db, z3) + } else { + (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_STMT), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, p, zTrace) + } + } + } + if (*TOp)(unsafe.Pointer(pOp)).Fp1 >= _sqlite3Config.FiOnceResetThreshold { + if int32((*TOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Trace) { + goto _187 + } + i9 = int32(1) + for { + if !(i9 < (*TVdbe)(unsafe.Pointer(p)).FnOp) { + break + } + if int32((*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fopcode) == int32(OP_Once) { + (*(*TOp)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24))).Fp1 = 0 + } + goto _300 + _300: + ; + i9++ + } + (*TOp)(unsafe.Pointer(pOp)).Fp1 = 0 + } + (*TOp)(unsafe.Pointer(pOp)).Fp1++ + *(*Tu32)(unsafe.Pointer(p + 212 + 6*4))++ + goto jump_to_p2 + /* Opcode: Noop * * * * * + ** + ** Do nothing. This instruction is often useful as a jump + ** destination. + */ + /* + ** The magic Explain opcode are only inserted when explain==2 (which + ** is to say when the EXPLAIN QUERY PLAN syntax is used.) + ** This opcode records information from the optimizer. It is the + ** the same as a no-op. This opcodesnever appears in a real VM program. + */ + _186: + ; /* This is really OP_Noop, OP_Explain */ + goto _187 + /***************************************************************************** + ** The cases of the switch statement above this line should all be indented + ** by 6 spaces. But the left-most 6 spaces have been removed to improve the + ** readability. From this point on down, the normal indentation rules are + ** restored. + *****************************************************************************/ + _187: + ; + /* The following code adds nothing to the actual functionality + ** of the program. It is only here for testing and debugging. + ** On the other hand, it does burn CPU cycles every time through + ** the evaluator loop. So we can leave it out when NDEBUG is defined. + */ + goto _1 + _1: + ; + pOp += 24 + } /* The end of the for(;;) loop the loops through opcodes */ + /* If we reach this point, it means that execution is finished with + ** an error of some kind. + */ +abort_due_to_error: + ; + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + } else { + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(33)< 0 { + _sqlite3ResetOneSchema(tls, db, int32(resetSchemaOnFault)-int32(1)) + } + /* This is the only way out of this procedure. We have to + ** release the mutexes on btrees that were acquired at the + ** top. */ +vdbe_return: + ; + for nVmStep >= nProgressLimit && (*Tsqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0) { + nProgressLimit += uint64((*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps) + if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxProgress})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0 { + nProgressLimit = libc.Uint64FromUint32(0xffffffff) | libc.Uint64FromUint32(0xffffffff)< int32(4) { + (*TVdbe)(unsafe.Pointer(v)).Fpc = int32(4) + rc = _sqlite3VdbeExec(tls, v) + } else { + rc = Xsqlite3_step(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) + } + if rc == int32(SQLITE_ROW) { + pC = *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FapCsr)) + if int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) > int32((*TIncrblob)(unsafe.Pointer(p)).FiCol) { + v1 = *(*Tu32)(unsafe.Pointer(pC + 120 + uintptr((*TIncrblob)(unsafe.Pointer(p)).FiCol)*4)) + } else { + v1 = uint32(0) + } + type1 = v1 + if type1 < uint32(12) { + if type1 == uint32(0) { + v2 = __ccgo_ts + 1666 + } else { + if type1 == uint32(7) { + v3 = __ccgo_ts + 6333 + } else { + v3 = __ccgo_ts + 6338 + } + v2 = v3 + } + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6346, libc.VaList(bp+8, v2)) + rc = int32(SQLITE_ERROR) + Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) + (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + } else { + (*TIncrblob)(unsafe.Pointer(p)).FiOffset = int32(*(*Tu32)(unsafe.Pointer(pC + 120 + uintptr(int32((*TIncrblob)(unsafe.Pointer(p)).FiCol)+int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnField))*4))) + (*TIncrblob)(unsafe.Pointer(p)).FnByte = int32(_sqlite3VdbeSerialTypeLen(tls, type1)) + (*TIncrblob)(unsafe.Pointer(p)).FpCsr = *(*uintptr)(unsafe.Pointer(pC + 48)) + _sqlite3BtreeIncrblobCursor(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) + } + } + if rc == int32(SQLITE_ROW) { + rc = SQLITE_OK + } else { + if (*TIncrblob)(unsafe.Pointer(p)).FpStmt != 0 { + rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) + (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + if rc == SQLITE_OK { + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6375, libc.VaList(bp+8, iRow)) + rc = int32(SQLITE_ERROR) + } else { + zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) + } + } + } + *(*uintptr)(unsafe.Pointer(pzErr)) = zErr + return rc +} + +// C documentation +// +// /* +// ** Open a blob handle. +// */ +func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, zColumn uintptr, iRow Tsqlite_int64, wrFlag int32, ppBlob uintptr) (r int32) { + bp := tls.Alloc(448) + defer tls.Free(448) + var aOp, pBlob, pFKey, pIdx, pTab, v, zFault, v7 uintptr + var iCol, iDb, j, j1, nAttempt, rc, v6 int32 + var _ /* sParse at bp+8 */ TParse + var _ /* zErr at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aOp, iCol, iDb, j, j1, nAttempt, pBlob, pFKey, pIdx, pTab, rc, v, zFault, v6, v7 + nAttempt = 0 /* Index of zColumn in row-record */ + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pBlob = uintptr(0) + *(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0) + wrFlag = libc.BoolInt32(!!(wrFlag != 0)) /* wrFlag = (wrFlag ? 1 : 0); */ + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pBlob = _sqlite3DbMallocZero(tls, db, uint64(56)) + for int32(1) != 0 { + _sqlite3ParseObjectInit(tls, bp+8, db) + if !(pBlob != 0) { + goto blob_open_out + } + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3BtreeEnterAll(tls, db) + pTab = _sqlite3LocateTable(tls, bp+8, uint32(0), zTable, zDb) + if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + pTab = uintptr(0) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6395, libc.VaList(bp+440, zTable)) + } + if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pTab = uintptr(0) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6425, libc.VaList(bp+440, zTable)) + } + if pTab != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + pTab = uintptr(0) + _sqlite3ErrorMsg(tls, bp+8, __ccgo_ts+6461, libc.VaList(bp+440, zTable)) + } + if !(pTab != 0) { + if (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg + (*(*TParse)(unsafe.Pointer(bp + 8))).FzErrMsg = uintptr(0) + } + rc = int32(SQLITE_ERROR) + _sqlite3BtreeLeaveAll(tls, db) + goto blob_open_out + } + (*TIncrblob)(unsafe.Pointer(pBlob)).FpTab = pTab + (*TIncrblob)(unsafe.Pointer(pBlob)).FzDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(_sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema))*32))).FzDbSName + /* Now search pTab for the exact column. */ + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if _sqlite3StrICmp(tls, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName, zColumn) == 0 { + break + } + goto _1 + _1: + ; + iCol++ + } + if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6482, libc.VaList(bp+440, zColumn)) + rc = int32(SQLITE_ERROR) + _sqlite3BtreeLeaveAll(tls, db) + goto blob_open_out + } + /* If the value is being opened for writing, check that the + ** column is not indexed, and that it is not part of a foreign key. + */ + if wrFlag != 0 { + zFault = uintptr(0) + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 { + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } + j = 0 + for { + if !(j < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + if (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom == iCol { + zFault = __ccgo_ts + 6503 + } + goto _3 + _3: + ; + j++ + } + goto _2 + _2: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + } + } + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + j1 = 0 + for { + if !(j1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + /* FIXME: Be smarter about indexes that use expressions */ + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { + zFault = __ccgo_ts + 6515 + } + goto _5 + _5: + ; + j1++ + } + goto _4 + _4: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + if zFault != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6523, libc.VaList(bp+440, zFault)) + rc = int32(SQLITE_ERROR) + _sqlite3BtreeLeaveAll(tls, db) + goto blob_open_out + } + } + (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt = _sqlite3VdbeCreate(tls, bp+8) + if (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt != 0 { + v = (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Transaction), iDb, wrFlag, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).Fschema_cookie, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).FiGeneration) + _sqlite3VdbeChangeP5(tls, v, uint16(1)) + aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_openBlob)), _iLn) + /* Make sure a mutex is held on the table to be accessed */ + _sqlite3VdbeUsesBtree(tls, v, iDb) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + /* Configure the OP_TableLock instruction */ + (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp2 = int32((*TTable)(unsafe.Pointer(pTab)).Ftnum) + (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp3 = wrFlag + _sqlite3VdbeChangeP4(tls, v, int32(2), (*TTable)(unsafe.Pointer(pTab)).FzName, P4_TRANSIENT) + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + /* Remove either the OP_OpenWrite or OpenRead. Set the P2 + ** parameter of the other to pTab->tnum. */ + if wrFlag != 0 { + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fopcode = uint8(OP_OpenWrite) + } + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fp2 = int32((*TTable)(unsafe.Pointer(pTab)).Ftnum) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fp3 = iDb + /* Configure the number of columns. Configure the cursor to + ** think that the table has one more column than it really + ** does. An OP_Column to retrieve this imaginary column will + ** always return an SQL NULL. This is useful because it means + ** we can invoke OP_Column to fill in the vdbe cursors type + ** and offset cache without causing any IO. + */ + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fp4type = int8(-libc.Int32FromInt32(3)) + *(*int32)(unsafe.Pointer(aOp + 1*24 + 16)) = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + int32(1) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 3*24))).Fp2 = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + (*(*TParse)(unsafe.Pointer(bp + 8))).FnVar = 0 + (*(*TParse)(unsafe.Pointer(bp + 8))).FnMem = int32(1) + (*(*TParse)(unsafe.Pointer(bp + 8))).FnTab = int32(1) + _sqlite3VdbeMakeReady(tls, v, bp+8) + } + } + (*TIncrblob)(unsafe.Pointer(pBlob)).FiCol = uint16(iCol) + (*TIncrblob)(unsafe.Pointer(pBlob)).Fdb = db + _sqlite3BtreeLeaveAll(tls, db) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto blob_open_out + } + rc = _blobSeekToRow(tls, pBlob, iRow, bp) + nAttempt++ + v6 = nAttempt + if v6 >= int32(SQLITE_MAX_SCHEMA_RETRY) || rc != int32(SQLITE_SCHEMA) { + break + } + _sqlite3ParseObjectReset(tls, bp+8) + } +blob_open_out: + ; + if rc == SQLITE_OK && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob + } else { + if pBlob != 0 && (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt != 0 { + _sqlite3VdbeFinalize(tls, (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt) + } + _sqlite3DbFree(tls, db, pBlob) + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v7 = __ccgo_ts + 3827 + } else { + v7 = libc.UintptrFromInt32(0) + } + _sqlite3ErrorWithMsg(tls, db, rc, v7, libc.VaList(bp+440, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3ParseObjectReset(tls, bp+8) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +/* This VDBE program seeks a btree cursor to the identified + ** db/table/row entry. The reason for using a vdbe program instead + ** of writing code to use the b-tree layer directly is that the + ** vdbe program will take advantage of the various transaction, + ** locking and error handling infrastructure built into the vdbe. + ** + ** After seeking the cursor, the vdbe executes an OP_ResultRow. + ** Code external to the Vdbe then "borrows" the b-tree cursor and + ** uses it to implement the blob_read(), blob_write() and + ** blob_bytes() functions. + ** + ** The sqlite3_blob_close() function finalizes the vdbe program, + ** which closes the b-tree cursor and (possibly) commits the + ** transaction. + */ +var _iLn int32 + +var _openBlob = [6]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_TableLock), + }, + 1: { + Fopcode: uint8(OP_OpenRead), + }, + 2: { + Fopcode: uint8(OP_NotExists), + Fp2: int8(5), + Fp3: int8(1), + }, + 3: { + Fopcode: uint8(OP_Column), + Fp3: int8(1), + }, + 4: { + Fopcode: uint8(OP_ResultRow), + Fp1: int8(1), + }, + 5: { + Fopcode: uint8(OP_Halt), + }, +} + +// C documentation +// +// /* +// ** Close a blob handle that was previously created using +// ** sqlite3_blob_open(). +// */ +func Xsqlite3_blob_close(tls *libc.TLS, pBlob uintptr) (r int32) { + var db, p, pStmt uintptr + var rc int32 + _, _, _, _ = db, p, pStmt, rc + p = pBlob + if p != 0 { + pStmt = (*TIncrblob)(unsafe.Pointer(p)).FpStmt + db = (*TIncrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3DbFree(tls, db, p) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + rc = Xsqlite3_finalize(tls, pStmt) + } else { + rc = SQLITE_OK + } + return rc +} + +// C documentation +// +// /* +// ** Perform a read or write operation on a blob +// */ +func _blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32, xCall uintptr) (r int32) { + var db, p, v uintptr + var iKey Tsqlite3_int64 + var rc int32 + _, _, _, _, _ = db, iKey, p, rc, v + p = pBlob + if p == uintptr(0) { + return _sqlite3MisuseError(tls, int32(102190)) + } + db = (*TIncrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + v = (*TIncrblob)(unsafe.Pointer(p)).FpStmt + if n < 0 || iOffset < 0 || int64(iOffset)+int64(n) > int64((*TIncrblob)(unsafe.Pointer(p)).FnByte) { + /* Request is out of range. Return a transient error. */ + rc = int32(SQLITE_ERROR) + } else { + if v == uintptr(0) { + /* If there is no statement handle, then the blob-handle has + ** already been invalidated. Return SQLITE_ABORT in this case. + */ + rc = int32(SQLITE_ABORT) + } else { + /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is + ** returned, clean-up the statement handle. + */ + _sqlite3BtreeEnterCursor(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) + if xCall == __ccgo_fp(_sqlite3BtreePutData) && (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { + iKey = _sqlite3BtreeIntegerKey(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) + _sqlite3VdbePreUpdateHook(tls, v, *(*uintptr)(unsafe.Pointer((*TVdbe)(unsafe.Pointer(v)).FapCsr)), int32(SQLITE_DELETE), (*TIncrblob)(unsafe.Pointer(p)).FzDb, (*TIncrblob)(unsafe.Pointer(p)).FpTab, iKey, -int32(1), int32((*TIncrblob)(unsafe.Pointer(p)).FiCol)) + } + rc = (*(*func(*libc.TLS, uintptr, Tu32, Tu32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xCall})))(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr, uint32(iOffset+(*TIncrblob)(unsafe.Pointer(p)).FiOffset), uint32(n), z) + _sqlite3BtreeLeaveCursor(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) + if rc == int32(SQLITE_ABORT) { + _sqlite3VdbeFinalize(tls, v) + (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + } else { + (*TVdbe)(unsafe.Pointer(v)).Frc = rc + } + } + } + _sqlite3Error(tls, db, rc) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Read data from a blob handle. +// */ +func Xsqlite3_blob_read(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32) (r int32) { + return _blobReadWrite(tls, pBlob, z, n, iOffset, __ccgo_fp(_sqlite3BtreePayloadChecked)) +} + +// C documentation +// +// /* +// ** Write data to a blob handle. +// */ +func Xsqlite3_blob_write(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32) (r int32) { + return _blobReadWrite(tls, pBlob, z, n, iOffset, __ccgo_fp(_sqlite3BtreePutData)) +} + +// C documentation +// +// /* +// ** Query a blob handle for the size of the data. +// ** +// ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob +// ** so no mutex is required for access. +// */ +func Xsqlite3_blob_bytes(tls *libc.TLS, pBlob uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = pBlob + if p != 0 && (*TIncrblob)(unsafe.Pointer(p)).FpStmt != 0 { + v1 = (*TIncrblob)(unsafe.Pointer(p)).FnByte + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Move an existing blob handle to point to a different row of the same +// ** database table. +// ** +// ** If an error occurs, or if the specified row does not exist or does not +// ** contain a blob or text value, then an error code is returned and the +// ** database handle error code and message set. If this happens, then all +// ** subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) +// ** immediately return SQLITE_ABORT. +// */ +func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, v1 uintptr + var rc int32 + var _ /* zErr at bp+0 */ uintptr + _, _, _, _ = db, p, rc, v1 + p = pBlob + if p == uintptr(0) { + return _sqlite3MisuseError(tls, int32(102290)) + } + db = (*TIncrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*TIncrblob)(unsafe.Pointer(p)).FpStmt == uintptr(0) { + /* If there is no statement handle, then the blob-handle has + ** already been invalidated. Return SQLITE_ABORT in this case. + */ + rc = int32(SQLITE_ABORT) + } else { + (*TVdbe)(unsafe.Pointer((*TIncrblob)(unsafe.Pointer(p)).FpStmt)).Frc = SQLITE_OK + rc = _blobSeekToRow(tls, p, iRow, bp) + if rc != SQLITE_OK { + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v1 = __ccgo_ts + 3827 + } else { + v1 = libc.UintptrFromInt32(0) + } + _sqlite3ErrorWithMsg(tls, db, rc, v1, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + } + } + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +/************** End of vdbeblob.c ********************************************/ +/************** Begin file vdbesort.c ****************************************/ +/* +** 2011-07-09 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code for the VdbeSorter object, used in concert with +** a VdbeCursor to sort large numbers of keys for CREATE INDEX statements +** or by SELECT statements with ORDER BY clauses that cannot be satisfied +** using indexes and without LIMIT clauses. +** +** The VdbeSorter object implements a multi-threaded external merge sort +** algorithm that is efficient even if the number of elements being sorted +** exceeds the available memory. +** +** Here is the (internal, non-API) interface between this module and the +** rest of the SQLite system: +** +** sqlite3VdbeSorterInit() Create a new VdbeSorter object. +** +** sqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter +** object. The row is a binary blob in the +** OP_MakeRecord format that contains both +** the ORDER BY key columns and result columns +** in the case of a SELECT w/ ORDER BY, or +** the complete record for an index entry +** in the case of a CREATE INDEX. +** +** sqlite3VdbeSorterRewind() Sort all content previously added. +** Position the read cursor on the +** first sorted element. +** +** sqlite3VdbeSorterNext() Advance the read cursor to the next sorted +** element. +** +** sqlite3VdbeSorterRowkey() Return the complete binary blob for the +** row currently under the read cursor. +** +** sqlite3VdbeSorterCompare() Compare the binary blob for the row +** currently under the read cursor against +** another binary blob X and report if +** X is strictly less than the read cursor. +** Used to enforce uniqueness in a +** CREATE UNIQUE INDEX statement. +** +** sqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim +** all resources. +** +** sqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This +** is like Close() followed by Init() only +** much faster. +** +** The interfaces above must be called in a particular order. Write() can +** only occur in between Init()/Reset() and Rewind(). Next(), Rowkey(), and +** Compare() can only occur in between Rewind() and Close()/Reset(). i.e. +** +** Init() +** for each record: Write() +** Rewind() +** Rowkey()/Compare() +** Next() +** Close() +** +** Algorithm: +** +** Records passed to the sorter via calls to Write() are initially held +** unsorted in main memory. Assuming the amount of memory used never exceeds +** a threshold, when Rewind() is called the set of records is sorted using +** an in-memory merge sort. In this case, no temporary files are required +** and subsequent calls to Rowkey(), Next() and Compare() read records +** directly from main memory. +** +** If the amount of space used to store records in main memory exceeds the +** threshold, then the set of records currently in memory are sorted and +** written to a temporary file in "Packed Memory Array" (PMA) format. +** A PMA created at this point is known as a "level-0 PMA". Higher levels +** of PMAs may be created by merging existing PMAs together - for example +** merging two or more level-0 PMAs together creates a level-1 PMA. +** +** The threshold for the amount of main memory to use before flushing +** records to a PMA is roughly the same as the limit configured for the +** page-cache of the main database. Specifically, the threshold is set to +** the value returned by "PRAGMA main.page_size" multiplied by +** that returned by "PRAGMA main.cache_size", in bytes. +** +** If the sorter is running in single-threaded mode, then all PMAs generated +** are appended to a single temporary file. Or, if the sorter is running in +** multi-threaded mode then up to (N+1) temporary files may be opened, where +** N is the configured number of worker threads. In this case, instead of +** sorting the records and writing the PMA to a temporary file itself, the +** calling thread usually launches a worker thread to do so. Except, if +** there are already N worker threads running, the main thread does the work +** itself. +** +** The sorter is running in multi-threaded mode if (a) the library was built +** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater +** than zero, and (b) worker threads have been enabled at runtime by calling +** "PRAGMA threads=N" with some value of N greater than 0. +** +** When Rewind() is called, any data remaining in memory is flushed to a +** final PMA. So at this point the data is stored in some number of sorted +** PMAs within temporary files on disk. +** +** If there are fewer than SORTER_MAX_MERGE_COUNT PMAs in total and the +** sorter is running in single-threaded mode, then these PMAs are merged +** incrementally as keys are retrieved from the sorter by the VDBE. The +** MergeEngine object, described in further detail below, performs this +** merge. +** +** Or, if running in multi-threaded mode, then a background thread is +** launched to merge the existing PMAs. Once the background thread has +** merged T bytes of data into a single sorted PMA, the main thread +** begins reading keys from that PMA while the background thread proceeds +** with merging the next T bytes of data. And so on. +** +** Parameter T is set to half the value of the memory threshold used +** by Write() above to determine when to create a new PMA. +** +** If there are more than SORTER_MAX_MERGE_COUNT PMAs in total when +** Rewind() is called, then a hierarchy of incremental-merges is used. +** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on +** disk are merged together. Then T bytes of data from the second set, and +** so on, such that no operation ever merges more than SORTER_MAX_MERGE_COUNT +** PMAs at a time. This done is to improve locality. +** +** If running in multi-threaded mode and there are more than +** SORTER_MAX_MERGE_COUNT PMAs on disk when Rewind() is called, then more +** than one background thread may be created. Specifically, there may be +** one background thread for each temporary file on disk, and one background +** thread to merge the output of each of the others to a single PMA for +** the main thread to read from. + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ + +/* +** If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various +** messages to stderr that may be helpful in understanding the performance +** characteristics of the sorter in multi-threaded mode. + */ + +/* +** Hard-coded maximum amount of data to accumulate in memory before flushing +** to a level 0 PMA. The purpose of this limit is to prevent various integer +** overflows. 512MiB. + */ + +// C documentation +// +// /* +// ** Private objects used by the sorter +// */ +type TMergeEngine = struct { + FnTree int32 + FpTask uintptr + FaTree uintptr + FaReadr uintptr +} + +type MergeEngine = TMergeEngine + +/* Merge PMAs together */ +type TPmaReader = struct { + FiReadOff Ti64 + FiEof Ti64 + FnAlloc int32 + FnKey int32 + FpFd uintptr + FaAlloc uintptr + FaKey uintptr + FaBuffer uintptr + FnBuffer int32 + FaMap uintptr + FpIncr uintptr +} + +type PmaReader = TPmaReader + +/* Incrementally read one PMA */ +type TPmaWriter = struct { + FeFWErr int32 + FaBuffer uintptr + FnBuffer int32 + FiBufStart int32 + FiBufEnd int32 + FiWriteOff Ti64 + FpFd uintptr +} + +type PmaWriter = TPmaWriter + +/* Incrementally write one PMA */ +type TSorterRecord = struct { + FnVal int32 + Fu struct { + FiNext [0]int32 + FpNext uintptr + } +} + +type SorterRecord = TSorterRecord + +/* A record being sorted */ +type TSortSubtask = struct { + FpThread uintptr + FbDone int32 + FnPMA int32 + FpSorter uintptr + FpUnpacked uintptr + Flist TSorterList + FxCompare TSorterCompare + Ffile TSorterFile + Ffile2 TSorterFile +} + +type SortSubtask = TSortSubtask + +/* A sub-task in the sort process */ +type TSorterFile = struct { + FpFd uintptr + FiEof Ti64 +} + +type SorterFile = TSorterFile + +/* Temporary file object wrapper */ +type TSorterList = struct { + FpList uintptr + FaMemory uintptr + FszPMA Ti64 +} + +type SorterList = TSorterList + +/* In-memory list of records */ +type TIncrMerger = struct { + FpTask uintptr + FpMerger uintptr + FiStartOff Ti64 + FmxSz int32 + FbEof int32 + FbUseThread int32 + FaFile [2]TSorterFile +} + +type IncrMerger = TIncrMerger + +/* Read & merge multiple PMAs */ + +/* +** A container for a temp file handle and the current amount of data +** stored in the file. + */ +type TSorterFile1 = struct { + FpFd uintptr + FiEof Ti64 +} + +type SorterFile1 = TSorterFile1 + +/* +** An in-memory list of objects to be sorted. +** +** If aMemory==0 then each object is allocated separately and the objects +** are connected using SorterRecord.u.pNext. If aMemory!=0 then all objects +** are stored in the aMemory[] bulk memory, one right after the other, and +** are connected using SorterRecord.u.iNext. + */ +type TSorterList1 = struct { + FpList uintptr + FaMemory uintptr + FszPMA Ti64 +} + +type SorterList1 = TSorterList1 + +/* +** The MergeEngine object is used to combine two or more smaller PMAs into +** one big PMA using a merge operation. Separate PMAs all need to be +** combined into one big PMA in order to be able to step through the sorted +** records in order. +** +** The aReadr[] array contains a PmaReader object for each of the PMAs being +** merged. An aReadr[] object either points to a valid key or else is at EOF. +** ("EOF" means "End Of File". When aReadr[] is at EOF there is no more data.) +** For the purposes of the paragraphs below, we assume that the array is +** actually N elements in size, where N is the smallest power of 2 greater +** to or equal to the number of PMAs being merged. The extra aReadr[] elements +** are treated as if they are empty (always at EOF). +** +** The aTree[] array is also N elements in size. The value of N is stored in +** the MergeEngine.nTree variable. +** +** The final (N/2) elements of aTree[] contain the results of comparing +** pairs of PMA keys together. Element i contains the result of +** comparing aReadr[2*i-N] and aReadr[2*i-N+1]. Whichever key is smaller, the +** aTree element is set to the index of it. +** +** For the purposes of this comparison, EOF is considered greater than any +** other key value. If the keys are equal (only possible with two EOF +** values), it doesn't matter which index is stored. +** +** The (N/4) elements of aTree[] that precede the final (N/2) described +** above contains the index of the smallest of each block of 4 PmaReaders +** And so on. So that aTree[1] contains the index of the PmaReader that +** currently points to the smallest key value. aTree[0] is unused. +** +** Example: +** +** aReadr[0] -> Banana +** aReadr[1] -> Feijoa +** aReadr[2] -> Elderberry +** aReadr[3] -> Currant +** aReadr[4] -> Grapefruit +** aReadr[5] -> Apple +** aReadr[6] -> Durian +** aReadr[7] -> EOF +** +** aTree[] = { X, 5 0, 5 0, 3, 5, 6 } +** +** The current element is "Apple" (the value of the key indicated by +** PmaReader 5). When the Next() operation is invoked, PmaReader 5 will +** be advanced to the next key in its segment. Say the next key is +** "Eggplant": +** +** aReadr[5] -> Eggplant +** +** The contents of aTree[] are updated first by comparing the new PmaReader +** 5 key to the current key of PmaReader 4 (still "Grapefruit"). The PmaReader +** 5 value is still smaller, so aTree[6] is set to 5. And so on up the tree. +** The value of PmaReader 6 - "Durian" - is now smaller than that of PmaReader +** 5, so aTree[3] is set to 6. Key 0 is smaller than key 6 (Bananafile2. And instead of using a +** background thread to prepare data for the PmaReader, with a single +** threaded IncrMerger the allocate part of pTask->file2 is "refilled" with +** keys from pMerger by the calling thread whenever the PmaReader runs out +** of data. + */ +type TIncrMerger1 = struct { + FpTask uintptr + FpMerger uintptr + FiStartOff Ti64 + FmxSz int32 + FbEof int32 + FbUseThread int32 + FaFile [2]TSorterFile +} + +type IncrMerger1 = TIncrMerger1 + +/* +** An instance of this object is used for writing a PMA. +** +** The PMA is written one record at a time. Each record is of an arbitrary +** size. But I/O is more efficient if it occurs in page-sized blocks where +** each block is aligned on a page boundary. This object caches writes to +** the PMA so that aligned, page-size blocks are written. + */ +type TPmaWriter1 = struct { + FeFWErr int32 + FaBuffer uintptr + FnBuffer int32 + FiBufStart int32 + FiBufEnd int32 + FiWriteOff Ti64 + FpFd uintptr +} + +type PmaWriter1 = TPmaWriter1 + +/* +** This object is the header on a single record while that record is being +** held in memory and prior to being written out as part of a PMA. +** +** How the linked list is connected depends on how memory is being managed +** by this module. If using a separate allocation for each in-memory record +** (VdbeSorter.list.aMemory==0), then the list is always connected using the +** SorterRecord.u.pNext pointers. +** +** Or, if using the single large allocation method (VdbeSorter.list.aMemory!=0), +** then while records are being accumulated the list is linked using the +** SorterRecord.u.iNext offset. This is because the aMemory[] array may +** be sqlite3Realloc()ed while records are being accumulated. Once the VM +** has finished passing records to the sorter, or when the in-memory buffer +** is full, the list is sorted. As part of the sorting process, it is +** converted to use the SorterRecord.u.pNext pointers. See function +** vdbeSorterSort() for details. + */ +type TSorterRecord1 = struct { + FnVal int32 + Fu struct { + FiNext [0]int32 + FpNext uintptr + } +} + +type SorterRecord1 = TSorterRecord1 + +// C documentation +// +// /* +// ** Free all memory belonging to the PmaReader object passed as the +// ** argument. All structure fields are set to zero before returning. +// */ +func _vdbePmaReaderClear(tls *libc.TLS, pReadr uintptr) { + Xsqlite3_free(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FaAlloc) + Xsqlite3_free(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FaBuffer) + if (*TPmaReader)(unsafe.Pointer(pReadr)).FaMap != 0 { + _sqlite3OsUnfetch(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FpFd, 0, (*TPmaReader)(unsafe.Pointer(pReadr)).FaMap) + } + _vdbeIncrFree(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr) + libc.Xmemset(tls, pReadr, 0, uint64(80)) +} + +// C documentation +// +// /* +// ** Read the next nByte bytes of data from the PMA p. +// ** If successful, set *ppOut to point to a buffer containing the data +// ** and return SQLITE_OK. Otherwise, if an error occurs, return an SQLite +// ** error code. +// ** +// ** The buffer returned in *ppOut is only valid until the +// ** next call to this function. +// */ +func _vdbePmaReadBlob(tls *libc.TLS, p uintptr, nByte int32, ppOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aNew uintptr + var iBuf, nAvail, nCopy, nRead, nRem, rc, rc1 int32 + var nNew Tsqlite3_int64 + var v1 int64 + var _ /* aNext at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _ = aNew, iBuf, nAvail, nCopy, nNew, nRead, nRem, rc, rc1, v1 /* Bytes of data available in buffer */ + if (*TPmaReader)(unsafe.Pointer(p)).FaMap != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TPmaReader)(unsafe.Pointer(p)).FaMap + uintptr((*TPmaReader)(unsafe.Pointer(p)).FiReadOff) + *(*Ti64)(unsafe.Pointer(p)) += int64(nByte) + return SQLITE_OK + } + /* If there is no more data to be read from the buffer, read the next + ** p->nBuffer bytes of data from the file into it. Or, if there are less + ** than p->nBuffer bytes remaining in the PMA, read all remaining data. */ + iBuf = int32((*TPmaReader)(unsafe.Pointer(p)).FiReadOff % int64((*TPmaReader)(unsafe.Pointer(p)).FnBuffer)) + if iBuf == 0 { /* sqlite3OsRead() return code */ + /* Determine how many bytes of data to read. */ + if (*TPmaReader)(unsafe.Pointer(p)).FiEof-(*TPmaReader)(unsafe.Pointer(p)).FiReadOff > int64((*TPmaReader)(unsafe.Pointer(p)).FnBuffer) { + nRead = (*TPmaReader)(unsafe.Pointer(p)).FnBuffer + } else { + nRead = int32((*TPmaReader)(unsafe.Pointer(p)).FiEof - (*TPmaReader)(unsafe.Pointer(p)).FiReadOff) + } + /* Readr data from the file. Return early if an error occurs. */ + rc = _sqlite3OsRead(tls, (*TPmaReader)(unsafe.Pointer(p)).FpFd, (*TPmaReader)(unsafe.Pointer(p)).FaBuffer, nRead, (*TPmaReader)(unsafe.Pointer(p)).FiReadOff) + if rc != SQLITE_OK { + return rc + } + } + nAvail = (*TPmaReader)(unsafe.Pointer(p)).FnBuffer - iBuf + if nByte <= nAvail { + /* The requested data is available in the in-memory buffer. In this + ** case there is no need to make a copy of the data, just return a + ** pointer into the buffer to the caller. */ + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TPmaReader)(unsafe.Pointer(p)).FaBuffer + uintptr(iBuf) + *(*Ti64)(unsafe.Pointer(p)) += int64(nByte) + } else { /* Bytes remaining to copy */ + /* Extend the p->aAlloc[] allocation if required. */ + if (*TPmaReader)(unsafe.Pointer(p)).FnAlloc < nByte { + if int64(libc.Int32FromInt32(128)) > int64(2)*int64((*TPmaReader)(unsafe.Pointer(p)).FnAlloc) { + v1 = int64(libc.Int32FromInt32(128)) + } else { + v1 = int64(2) * int64((*TPmaReader)(unsafe.Pointer(p)).FnAlloc) + } + nNew = v1 + for int64(nByte) > nNew { + nNew = nNew * int64(2) + } + aNew = _sqlite3Realloc(tls, (*TPmaReader)(unsafe.Pointer(p)).FaAlloc, uint64(nNew)) + if !(aNew != 0) { + return int32(SQLITE_NOMEM) + } + (*TPmaReader)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + (*TPmaReader)(unsafe.Pointer(p)).FaAlloc = aNew + } + /* Copy as much data as is available in the buffer into the start of + ** p->aAlloc[]. */ + libc.Xmemcpy(tls, (*TPmaReader)(unsafe.Pointer(p)).FaAlloc, (*TPmaReader)(unsafe.Pointer(p)).FaBuffer+uintptr(iBuf), uint64(nAvail)) + *(*Ti64)(unsafe.Pointer(p)) += int64(nAvail) + nRem = nByte - nAvail + /* The following loop copies up to p->nBuffer bytes per iteration into + ** the p->aAlloc[] buffer. */ + for nRem > 0 { /* Pointer to buffer to copy data from */ + nCopy = nRem + if nRem > (*TPmaReader)(unsafe.Pointer(p)).FnBuffer { + nCopy = (*TPmaReader)(unsafe.Pointer(p)).FnBuffer + } + rc1 = _vdbePmaReadBlob(tls, p, nCopy, bp) + if rc1 != SQLITE_OK { + return rc1 + } + libc.Xmemcpy(tls, (*TPmaReader)(unsafe.Pointer(p)).FaAlloc+uintptr(nByte-nRem), *(*uintptr)(unsafe.Pointer(bp)), uint64(nCopy)) + nRem -= nCopy + } + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TPmaReader)(unsafe.Pointer(p)).FaAlloc + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Read a varint from the stream of data accessed by p. Set *pnOut to +// ** the value read. +// */ +func _vdbePmaReadVarint(tls *libc.TLS, p uintptr, pnOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, iBuf, rc, v1 int32 + var _ /* a at bp+16 */ uintptr + var _ /* aVarint at bp+0 */ [16]Tu8 + _, _, _, _ = i, iBuf, rc, v1 + if (*TPmaReader)(unsafe.Pointer(p)).FaMap != 0 { + *(*Ti64)(unsafe.Pointer(p)) += int64(_sqlite3GetVarint(tls, (*TPmaReader)(unsafe.Pointer(p)).FaMap+uintptr((*TPmaReader)(unsafe.Pointer(p)).FiReadOff), pnOut)) + } else { + iBuf = int32((*TPmaReader)(unsafe.Pointer(p)).FiReadOff % int64((*TPmaReader)(unsafe.Pointer(p)).FnBuffer)) + if iBuf != 0 && (*TPmaReader)(unsafe.Pointer(p)).FnBuffer-iBuf >= int32(9) { + *(*Ti64)(unsafe.Pointer(p)) += int64(_sqlite3GetVarint(tls, (*TPmaReader)(unsafe.Pointer(p)).FaBuffer+uintptr(iBuf), pnOut)) + } else { + i = 0 + for cond := true; cond; cond = int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))))&int32(0x80) != 0 { + rc = _vdbePmaReadBlob(tls, p, int32(1), bp+16) + if rc != 0 { + return rc + } + v1 = i + i++ + (*(*[16]Tu8)(unsafe.Pointer(bp)))[v1&int32(0xf)] = *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) + } + _sqlite3GetVarint(tls, bp, pnOut) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Attempt to memory map file pFile. If successful, set *pp to point to the +// ** new mapping and return SQLITE_OK. If the mapping is not attempted +// ** (because the file is too large or the VFS layer is configured not to use +// ** mmap), return SQLITE_OK and set *pp to NULL. +// ** +// ** Or, if an error occurs, return an SQLite error code. The final value of +// ** *pp is undefined in this case. +// */ +func _vdbeSorterMapFile(tls *libc.TLS, pTask uintptr, pFile uintptr, pp uintptr) (r int32) { + var pFd uintptr + var rc int32 + _, _ = pFd, rc + rc = SQLITE_OK + if (*TSorterFile)(unsafe.Pointer(pFile)).FiEof <= int64((*Tsqlite3)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb)).FnMaxSorterMmap) { + pFd = (*TSorterFile)(unsafe.Pointer(pFile)).FpFd + if (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pFd)).FpMethods)).FiVersion >= int32(3) { + rc = _sqlite3OsFetch(tls, pFd, 0, int32((*TSorterFile)(unsafe.Pointer(pFile)).FiEof), pp) + } + } + return rc +} + +// C documentation +// +// /* +// ** Attach PmaReader pReadr to file pFile (if it is not already attached to +// ** that file) and seek it to offset iOff within the file. Return SQLITE_OK +// ** if successful, or an SQLite error code if an error occurs. +// */ +func _vdbePmaReaderSeek(tls *libc.TLS, pTask uintptr, pReadr uintptr, pFile uintptr, iOff Ti64) (r int32) { + var iBuf, nRead, pgsz, rc int32 + _, _, _, _ = iBuf, nRead, pgsz, rc + rc = SQLITE_OK + if _sqlite3FaultSim(tls, int32(201)) != 0 { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(1)< (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof { + nRead = int32((*TPmaReader)(unsafe.Pointer(pReadr)).FiEof - (*TPmaReader)(unsafe.Pointer(pReadr)).FiReadOff) + } + rc = _sqlite3OsRead(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FpFd, (*TPmaReader)(unsafe.Pointer(pReadr)).FaBuffer+uintptr(iBuf), nRead, (*TPmaReader)(unsafe.Pointer(pReadr)).FiReadOff) + } + } + return rc +} + +// C documentation +// +// /* +// ** Advance PmaReader pReadr to the next key in its PMA. Return SQLITE_OK if +// ** no error occurs, or an SQLite error code if one does. +// */ +func _vdbePmaReaderNext(tls *libc.TLS, pReadr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bEof, rc int32 + var pIncr uintptr + var _ /* nRec at bp+0 */ Tu64 + _, _, _ = bEof, pIncr, rc + rc = SQLITE_OK /* Return Code */ + *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) /* Size of record in bytes */ + if (*TPmaReader)(unsafe.Pointer(pReadr)).FiReadOff >= (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof { + pIncr = (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr + bEof = int32(1) + if pIncr != 0 { + rc = _vdbeIncrSwap(tls, pIncr) + if rc == SQLITE_OK && (*TIncrMerger)(unsafe.Pointer(pIncr)).FbEof == 0 { + rc = _vdbePmaReaderSeek(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask, pReadr, pIncr+40, (*TIncrMerger)(unsafe.Pointer(pIncr)).FiStartOff) + bEof = 0 + } + } + if bEof != 0 { + /* This is an EOF condition */ + _vdbePmaReaderClear(tls, pReadr) + return rc + } + } + if rc == SQLITE_OK { + rc = _vdbePmaReadVarint(tls, pReadr, bp) + } + if rc == SQLITE_OK { + (*TPmaReader)(unsafe.Pointer(pReadr)).FnKey = int32(*(*Tu64)(unsafe.Pointer(bp))) + rc = _vdbePmaReadBlob(tls, pReadr, int32(*(*Tu64)(unsafe.Pointer(bp))), pReadr+40) + } + return rc +} + +// C documentation +// +// /* +// ** Initialize PmaReader pReadr to scan through the PMA stored in file pFile +// ** starting at offset iStart and ending at offset iEof-1. This function +// ** leaves the PmaReader pointing to the first key in the PMA (or EOF if the +// ** PMA is empty). +// ** +// ** If the pnByte parameter is NULL, then it is assumed that the file +// ** contains a single PMA, and that that PMA omits the initial length varint. +// */ +func _vdbePmaReaderInit(tls *libc.TLS, pTask uintptr, pFile uintptr, iStart Ti64, pReadr uintptr, pnByte uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var p1 uintptr + var _ /* nByte at bp+0 */ Tu64 + _, _ = rc, p1 + rc = _vdbePmaReaderSeek(tls, pTask, pReadr, pFile, iStart) + if rc == SQLITE_OK { + *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) /* Size of PMA in bytes */ + rc = _vdbePmaReadVarint(tls, pReadr, bp) + (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof = int64(uint64((*TPmaReader)(unsafe.Pointer(pReadr)).FiReadOff) + *(*Tu64)(unsafe.Pointer(bp))) + p1 = pnByte + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp))) + } + if rc == SQLITE_OK { + rc = _vdbePmaReaderNext(tls, pReadr) + } + return rc +} + +// C documentation +// +// /* +// ** A version of vdbeSorterCompare() that assumes that it has already been +// ** determined that the first field of key1 is equal to the first field of +// ** key2. +// */ +func _vdbeSorterCompareTail(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) (r int32) { + var r2 uintptr + _ = r2 + r2 = (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked + if *(*int32)(unsafe.Pointer(pbKey2Cached)) == 0 { + _sqlite3VdbeRecordUnpack(tls, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo, nKey2, pKey2, r2) + *(*int32)(unsafe.Pointer(pbKey2Cached)) = int32(1) + } + return _sqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, r2, int32(1)) +} + +// C documentation +// +// /* +// ** Compare key1 (buffer pKey1, size nKey1 bytes) with key2 (buffer pKey2, +// ** size nKey2 bytes). Use (pTask->pKeyInfo) for the collation sequences +// ** used by the comparison. Return the result of the comparison. +// ** +// ** If IN/OUT parameter *pbKey2Cached is true when this function is called, +// ** it is assumed that (pTask->pUnpacked) contains the unpacked version +// ** of key2. If it is false, (pTask->pUnpacked) is populated with the unpacked +// ** version of key2 and *pbKey2Cached set to true before returning. +// ** +// ** If an OOM error is encountered, (pTask->pUnpacked->error_rc) is set +// ** to SQLITE_NOMEM. +// */ +func _vdbeSorterCompare(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) (r int32) { + var r2 uintptr + _ = r2 + r2 = (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked + if !(*(*int32)(unsafe.Pointer(pbKey2Cached)) != 0) { + _sqlite3VdbeRecordUnpack(tls, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo, nKey2, pKey2, r2) + *(*int32)(unsafe.Pointer(pbKey2Cached)) = int32(1) + } + return _sqlite3VdbeRecordCompare(tls, nKey1, pKey1, r2) +} + +// C documentation +// +// /* +// ** A specially optimized version of vdbeSorterCompare() that assumes that +// ** the first field of each key is a TEXT value and that the collation +// ** sequence to compare them with is BINARY. +// */ +func _vdbeSorterCompareText(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p1, p2, v1, v2 uintptr + var res, v11 int32 + var _ /* n1 at bp+0 */ int32 + var _ /* n2 at bp+4 */ int32 + _, _, _, _, _, _ = p1, p2, res, v1, v2, v11 + p1 = pKey1 + p2 = pKey2 + v1 = p1 + uintptr(*(*Tu8)(unsafe.Pointer(p1))) /* Pointer to value 1 */ + v2 = p2 + uintptr(*(*Tu8)(unsafe.Pointer(p2))) + *(*int32)(unsafe.Pointer(bp)) = int32(uint32(*(*Tu8)(unsafe.Pointer(p1 + 1)))) + if *(*int32)(unsafe.Pointer(bp)) >= int32(0x80) { + _sqlite3GetVarint32(tls, p1+1, bp) + } + *(*int32)(unsafe.Pointer(bp + 4)) = int32(uint32(*(*Tu8)(unsafe.Pointer(p2 + 1)))) + if *(*int32)(unsafe.Pointer(bp + 4)) >= int32(0x80) { + _sqlite3GetVarint32(tls, p2+1, bp+4) + } + if *(*int32)(unsafe.Pointer(bp)) < *(*int32)(unsafe.Pointer(bp + 4)) { + v11 = *(*int32)(unsafe.Pointer(bp)) + } else { + v11 = *(*int32)(unsafe.Pointer(bp + 4)) + } + res = libc.Xmemcmp(tls, v1, v2, uint64((v11-int32(13))/int32(2))) + if res == 0 { + res = *(*int32)(unsafe.Pointer(bp)) - *(*int32)(unsafe.Pointer(bp + 4)) + } + if res == 0 { + if int32((*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField) > int32(1) { + res = _vdbeSorterCompareTail(tls, pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2) + } + } else { + if *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FaSortFlags)) != 0 { + res = res * -int32(1) + } + } + return res +} + +// C documentation +// +// /* +// ** A specially optimized version of vdbeSorterCompare() that assumes that +// ** the first field of each key is an INTEGER value. +// */ +func _vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) (r int32) { + var i, res, s1, s2, v21, v3 int32 + var n Tu8 + var p1, p2, v1, v2 uintptr + _, _, _, _, _, _, _, _, _, _, _ = i, n, p1, p2, res, s1, s2, v1, v2, v21, v3 + p1 = pKey1 + p2 = pKey2 + s1 = int32(*(*Tu8)(unsafe.Pointer(p1 + 1))) /* Left hand serial type */ + s2 = int32(*(*Tu8)(unsafe.Pointer(p2 + 1))) /* Right hand serial type */ + v1 = p1 + uintptr(*(*Tu8)(unsafe.Pointer(p1))) /* Pointer to value 1 */ + v2 = p2 + uintptr(*(*Tu8)(unsafe.Pointer(p2))) /* Return value */ + if s1 == s2 { + n = _aLen[s1] + res = 0 + i = 0 + for { + if !(i < int32(n)) { + break + } + v21 = int32(*(*Tu8)(unsafe.Pointer(v1 + uintptr(i)))) - int32(*(*Tu8)(unsafe.Pointer(v2 + uintptr(i)))) + res = v21 + if v21 != 0 { + if (int32(*(*Tu8)(unsafe.Pointer(v1)))^int32(*(*Tu8)(unsafe.Pointer(v2))))&int32(0x80) != 0 { + if int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0 { + v3 = -int32(1) + } else { + v3 = +libc.Int32FromInt32(1) + } + res = v3 + } + break + } + goto _1 + _1: + ; + i++ + } + } else { + if s1 > int32(7) && s2 > int32(7) { + res = s1 - s2 + } else { + if s2 > int32(7) { + res = +libc.Int32FromInt32(1) + } else { + if s1 > int32(7) { + res = -int32(1) + } else { + res = s1 - s2 + } + } + if res > 0 { + if int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0 { + res = -int32(1) + } + } else { + if int32(*(*Tu8)(unsafe.Pointer(v2)))&int32(0x80) != 0 { + res = +libc.Int32FromInt32(1) + } + } + } + } + if res == 0 { + if int32((*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField) > int32(1) { + res = _vdbeSorterCompareTail(tls, pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2) + } + } else { + if *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FaSortFlags)) != 0 { + res = res * -int32(1) + } + } + return res +} + +/* The two values have the same sign. Compare using memcmp(). */ +var _aLen = [10]Tu8{ + 1: uint8(1), + 2: uint8(2), + 3: uint8(3), + 4: uint8(4), + 5: uint8(6), + 6: uint8(8), +} + +// C documentation +// +// /* +// ** Initialize the temporary index cursor just opened as a sorter cursor. +// ** +// ** Usually, the sorter module uses the value of (pCsr->pKeyInfo->nKeyField) +// ** to determine the number of fields that should be compared from the +// ** records being sorted. However, if the value passed as argument nField +// ** is non-zero and the sorter is able to guarantee a stable sort, nField +// ** is used instead. This is used when sorting records for a CREATE INDEX +// ** statement. In this case, keys are always delivered to the sorter in +// ** order of the primary key, which happens to be make up the final part +// ** of the records being sorted. So if the sort is stable, there is never +// ** any reason to compare PK fields and they can be ignored for a small +// ** performance boost. +// ** +// ** The sorter can guarantee a stable sort when running in single-threaded +// ** mode, but not in multi-threaded mode. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _sqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintptr) (r int32) { + var i, nWorker, pgsz, rc, sz, szKeyInfo, v2, v5 int32 + var mxCache Ti64 + var pBt, pKeyInfo, pSorter, pTask, v1 uintptr + var szPma Tu32 + var v4 int64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, mxCache, nWorker, pBt, pKeyInfo, pSorter, pTask, pgsz, rc, sz, szKeyInfo, szPma, v1, v2, v4, v5 /* Size of pSorter in bytes */ + rc = SQLITE_OK + /* Initialize the upper limit on the number of worker threads */ + if _sqlite3TempInMemory(tls, db) != 0 || int32(_sqlite3Config.FbCoreMutex) == 0 { + nWorker = 0 + } else { + nWorker = *(*int32)(unsafe.Pointer(db + 136 + 11*4)) + } + /* Do not allow the total number of threads (main thread + all workers) + ** to exceed the maximum merge count */ + szKeyInfo = int32(uint64(40) + uint64(int32((*TKeyInfo)(unsafe.Pointer((*TVdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo)).FnKeyField)-libc.Int32FromInt32(1))*uint64(8)) + sz = int32(uint64(192) + uint64(nWorker)*uint64(96)) + pSorter = _sqlite3DbMallocZero(tls, db, uint64(sz+szKeyInfo)) + *(*uintptr)(unsafe.Pointer(pCsr + 48)) = pSorter + if pSorter == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpBt + v1 = pSorter + uintptr(sz) + pKeyInfo = v1 + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpKeyInfo = v1 + libc.Xmemcpy(tls, pKeyInfo, (*TVdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo, uint64(szKeyInfo)) + (*TKeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb = uintptr(0) + if nField != 0 && nWorker == 0 { + (*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField = uint16(nField) + } + _sqlite3BtreeEnter(tls, pBt) + v2 = _sqlite3BtreeGetPageSize(tls, pBt) + pgsz = v2 + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Fpgsz = v2 + _sqlite3BtreeLeave(tls, pBt) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask = uint8(nWorker + int32(1)) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiPrev = uint8(nWorker - libc.Int32FromInt32(1)) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads = libc.BoolUint8(int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask) > libc.Int32FromInt32(1)) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Fdb = db + i = 0 + for { + if !(i < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) { + break + } + pTask = pSorter + 96 + uintptr(i)*96 + (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter + goto _3 + _3: + ; + i++ + } + if !(_sqlite3TempInMemory(tls, db) != 0) { /* Cache size in bytes*/ + szPma = _sqlite3Config.FszPma + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize = int32(szPma * uint32(pgsz)) + mxCache = int64((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fcache_size) + if mxCache < 0 { + /* A negative cache-size value C indicates that the cache is abs(C) + ** KiB in size. */ + mxCache = mxCache * int64(-int32(1024)) + } else { + mxCache = mxCache * int64(pgsz) + } + if mxCache < int64(libc.Int32FromInt32(1)< int32(mxCache) { + v5 = (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize + } else { + v5 = int32(mxCache) + } + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize = v5 + /* Avoid large memory allocations if the application has requested + ** SQLITE_CONFIG_SMALL_MALLOC. */ + if int32(_sqlite3Config.FbSmallMalloc) == 0 { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = pgsz + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = _sqlite3Malloc(tls, uint64(pgsz)) + if !((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0) { + rc = int32(SQLITE_NOMEM) + } + } + } + if int32((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) < int32(13) && (*(*uintptr)(unsafe.Pointer(pKeyInfo + 32)) == uintptr(0) || *(*uintptr)(unsafe.Pointer(pKeyInfo + 32)) == (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl) && int32(*(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags)))&int32(KEYINFO_ORDER_BIGNULL) == 0 { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FtypeMask = uint8(libc.Int32FromInt32(SORTER_TYPE_INTEGER) | libc.Int32FromInt32(SORTER_TYPE_TEXT)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Free the list of sorted records starting at pRecord. +// */ +func _vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { + var p, pNext uintptr + _, _ = p, pNext + p = pRecord + for { + if !(p != 0) { + break + } + pNext = *(*uintptr)(unsafe.Pointer(p + 8)) + _sqlite3DbFree(tls, db, p) + goto _1 + _1: + ; + p = pNext + } +} + +// C documentation +// +// /* +// ** Free all resources owned by the object indicated by argument pTask. All +// ** fields of *pTask are zeroed before returning. +// */ +func _vdbeSortSubtaskCleanup(tls *libc.TLS, db uintptr, pTask uintptr) { + _sqlite3DbFree(tls, db, (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked) + /* pTask->list.aMemory can only be non-zero if it was handed memory + ** from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 */ + if (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory != 0 { + Xsqlite3_free(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory) + } else { + _vdbeSorterRecordFree(tls, uintptr(0), (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FpList) + } + if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd != 0 { + _sqlite3OsCloseFree(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd) + } + if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd != 0 { + _sqlite3OsCloseFree(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd) + } + libc.Xmemset(tls, pTask, 0, uint64(96)) +} + +// C documentation +// +// /* +// ** Join thread pTask->thread. +// */ +func _vdbeSorterJoinThread(tls *libc.TLS, pTask uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pRet at bp+0 */ uintptr + _ = rc + rc = SQLITE_OK + if (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(int64(libc.Int32FromInt32(SQLITE_ERROR))) + _sqlite3ThreadJoin(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread, bp) + rc = int32(int64(*(*uintptr)(unsafe.Pointer(bp)))) + (*TSortSubtask)(unsafe.Pointer(pTask)).FbDone = 0 + (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread = uintptr(0) + } + return rc +} + +// C documentation +// +// /* +// ** Launch a background thread to run xTask(pIn). +// */ +func _vdbeSorterCreateThread(tls *libc.TLS, pTask uintptr, xTask uintptr, pIn uintptr) (r int32) { + return _sqlite3ThreadCreate(tls, pTask, xTask, pIn) +} + +// C documentation +// +// /* +// ** Join all outstanding threads launched by SorterWrite() to create +// ** level-0 PMAs. +// */ +func _vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) (r int32) { + var i, rc, rc2 int32 + var pTask uintptr + _, _, _, _ = i, pTask, rc, rc2 + rc = rcin + /* This function is always called by the main user thread. + ** + ** If this function is being called after SorterRewind() has been called, + ** it is possible that thread pSorter->aTask[pSorter->nTask-1].pThread + ** is currently attempt to join one of the other threads. To avoid a race + ** condition where this thread also attempts to join the same object, join + ** thread pSorter->aTask[pSorter->nTask-1].pThread first. */ + i = int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask) - int32(1) + for { + if !(i >= 0) { + break + } + pTask = pSorter + 96 + uintptr(i)*96 + rc2 = _vdbeSorterJoinThread(tls, pTask) + if rc == SQLITE_OK { + rc = rc2 + } + goto _1 + _1: + ; + i-- + } + return rc +} + +// C documentation +// +// /* +// ** Allocate a new MergeEngine object capable of handling up to +// ** nReader PmaReader inputs. +// ** +// ** nReader is automatically rounded up to the next power of two. +// ** nReader may not exceed SORTER_MAX_MERGE_COUNT even after rounding up. +// */ +func _vdbeMergeEngineNew(tls *libc.TLS, nReader int32) (r uintptr) { + var N, nByte int32 + var pNew, v1 uintptr + _, _, _, _ = N, nByte, pNew, v1 + N = int32(2) /* Pointer to allocated object to return */ + for N < nReader { + N += N + } + nByte = int32(uint64(32) + uint64(N)*(libc.Uint64FromInt64(4)+libc.Uint64FromInt64(80))) + if _sqlite3FaultSim(tls, int32(100)) != 0 { + v1 = uintptr(0) + } else { + v1 = _sqlite3MallocZero(tls, uint64(nByte)) + } + pNew = v1 + if pNew != 0 { + (*TMergeEngine)(unsafe.Pointer(pNew)).FnTree = N + (*TMergeEngine)(unsafe.Pointer(pNew)).FpTask = uintptr(0) + (*TMergeEngine)(unsafe.Pointer(pNew)).FaReadr = pNew + 1*32 + (*TMergeEngine)(unsafe.Pointer(pNew)).FaTree = (*TMergeEngine)(unsafe.Pointer(pNew)).FaReadr + uintptr(N)*80 + } + return pNew +} + +// C documentation +// +// /* +// ** Free the MergeEngine object passed as the only argument. +// */ +func _vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { + var i int32 + _ = i + if pMerger != 0 { + i = 0 + for { + if !(i < (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree) { + break + } + _vdbePmaReaderClear(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80) + goto _1 + _1: + ; + i++ + } + } + Xsqlite3_free(tls, pMerger) +} + +// C documentation +// +// /* +// ** Free all resources associated with the IncrMerger object indicated by +// ** the first argument. +// */ +func _vdbeIncrFree(tls *libc.TLS, pIncr uintptr) { + if pIncr != 0 { + if (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + _vdbeSorterJoinThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask) + if (*(*TSorterFile)(unsafe.Pointer(pIncr + 40))).FpFd != 0 { + _sqlite3OsCloseFree(tls, (*(*TSorterFile)(unsafe.Pointer(pIncr + 40))).FpFd) + } + if (*(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16))).FpFd != 0 { + _sqlite3OsCloseFree(tls, (*(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16))).FpFd) + } + } + _vdbeMergeEngineFree(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger) + Xsqlite3_free(tls, pIncr) + } +} + +// C documentation +// +// /* +// ** Reset a sorting cursor back to its original empty state. +// */ +func _sqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { + var i int32 + var pTask uintptr + _, _ = i, pTask + _vdbeSorterJoinAll(tls, pSorter, SQLITE_OK) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader != 0 { + _vdbePmaReaderClear(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + _sqlite3DbFree(tls, db, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader = uintptr(0) + } + _vdbeMergeEngineFree(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger = uintptr(0) + i = 0 + for { + if !(i < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) { + break + } + pTask = pSorter + 96 + uintptr(i)*96 + _vdbeSortSubtaskCleanup(tls, db, pTask) + (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter + goto _1 + _1: + ; + i++ + } + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { + _vdbeSorterRecordFree(tls, uintptr(0), (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) + } + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = uintptr(0) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA = uint8(0) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory = 0 + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize = 0 + _sqlite3DbFree(tls, db, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked = uintptr(0) +} + +// C documentation +// +// /* +// ** Free any cursor components allocated by sqlite3VdbeSorterXXX routines. +// */ +func _sqlite3VdbeSorterClose(tls *libc.TLS, db uintptr, pCsr uintptr) { + var pSorter uintptr + _ = pSorter + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + if pSorter != 0 { + _sqlite3VdbeSorterReset(tls, db, pSorter) + Xsqlite3_free(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory) + _sqlite3DbFree(tls, db, pSorter) + *(*uintptr)(unsafe.Pointer(pCsr + 48)) = uintptr(0) + } +} + +// C documentation +// +// /* +// ** The first argument is a file-handle open on a temporary file. The file +// ** is guaranteed to be nByte bytes or smaller in size. This function +// ** attempts to extend the file to nByte bytes in size and to ensure that +// ** the VFS has memory mapped it. +// ** +// ** Whether or not the file does end up memory mapped of course depends on +// ** the specific VFS implementation. +// */ +func _vdbeSorterExtendFile(tls *libc.TLS, db uintptr, pFd uintptr, _nByte Ti64) { + bp := tls.Alloc(32) + defer tls.Free(32) + *(*Ti64)(unsafe.Pointer(bp)) = _nByte + var _ /* chunksize at bp+16 */ int32 + var _ /* p at bp+8 */ uintptr + if *(*Ti64)(unsafe.Pointer(bp)) <= int64((*Tsqlite3)(unsafe.Pointer(db)).FnMaxSorterMmap) && (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pFd)).FpMethods)).FiVersion >= int32(3) { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16)) = libc.Int32FromInt32(4) * libc.Int32FromInt32(1024) + _sqlite3OsFileControlHint(tls, pFd, int32(SQLITE_FCNTL_CHUNK_SIZE), bp+16) + _sqlite3OsFileControlHint(tls, pFd, int32(SQLITE_FCNTL_SIZE_HINT), bp) + _sqlite3OsFetch(tls, pFd, 0, int32(*(*Ti64)(unsafe.Pointer(bp))), bp+8) + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + _sqlite3OsUnfetch(tls, pFd, 0, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + } +} + +// C documentation +// +// /* +// ** Allocate space for a file-handle and open a temporary file. If successful, +// ** set *ppFd to point to the malloc'd file-handle and return SQLITE_OK. +// ** Otherwise, set *ppFd to 0 and return an SQLite error code. +// */ +func _vdbeSorterOpenTempFile(tls *libc.TLS, db uintptr, nExtend Ti64, ppFd uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* max at bp+8 */ Ti64 + var _ /* rc at bp+0 */ int32 + if _sqlite3FaultSim(tls, int32(202)) != 0 { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(13)< 0 { + _vdbeSorterExtendFile(tls, db, *(*uintptr)(unsafe.Pointer(ppFd)), nExtend) + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** If it has not already been allocated, allocate the UnpackedRecord +// ** structure at pTask->pUnpacked. Return SQLITE_OK if successful (or +// ** if no allocation was required), or SQLITE_NOMEM otherwise. +// */ +func _vdbeSortAllocUnpacked(tls *libc.TLS, pTask uintptr) (r int32) { + if (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked == uintptr(0) { + (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked = _sqlite3VdbeAllocUnpackedRecord(tls, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo) + if (*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FnField = (*TKeyInfo)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField + (*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode = uint8(0) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Merge the two sorted lists p1 and p2 into a single list. +// */ +func _vdbeSorterMerge(tls *libc.TLS, pTask uintptr, p1 uintptr, p2 uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pp uintptr + var res int32 + var _ /* bCached at bp+8 */ int32 + var _ /* pFinal at bp+0 */ uintptr + _, _ = pp, res + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pp = bp + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + for { + res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare})))(tls, pTask, bp+8, p1+libc.UintptrFromInt32(1)*16, (*TSorterRecord)(unsafe.Pointer(p1)).FnVal, p2+libc.UintptrFromInt32(1)*16, (*TSorterRecord)(unsafe.Pointer(p2)).FnVal) + if res <= 0 { + *(*uintptr)(unsafe.Pointer(pp)) = p1 + pp = p1 + 8 + p1 = *(*uintptr)(unsafe.Pointer(p1 + 8)) + if p1 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pp)) = p2 + break + } + } else { + *(*uintptr)(unsafe.Pointer(pp)) = p2 + pp = p2 + 8 + p2 = *(*uintptr)(unsafe.Pointer(p2 + 8)) + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + if p2 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pp)) = p1 + break + } + } + goto _1 + _1: + } + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Return the SorterCompare function to compare values collected by the +// ** sorter object passed as the only argument. +// */ +func _vdbeSorterGetCompare(tls *libc.TLS, p uintptr) (r TSorterCompare) { + if int32((*TVdbeSorter)(unsafe.Pointer(p)).FtypeMask) == int32(SORTER_TYPE_INTEGER) { + return __ccgo_fp(_vdbeSorterCompareInt) + } else { + if int32((*TVdbeSorter)(unsafe.Pointer(p)).FtypeMask) == int32(SORTER_TYPE_TEXT) { + return __ccgo_fp(_vdbeSorterCompareText) + } + } + return __ccgo_fp(_vdbeSorterCompare) +} + +// C documentation +// +// /* +// ** Sort the linked list of records headed at pTask->pList. Return +// ** SQLITE_OK if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if +// ** an error occurs. +// */ +func _vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(512) + defer tls.Free(512) + var i, rc int32 + var p, pNext, v3 uintptr + var _ /* aSlot at bp+0 */ [64]uintptr + _, _, _, _, _ = i, p, pNext, rc, v3 + rc = _vdbeSortAllocUnpacked(tls, pTask) + if rc != SQLITE_OK { + return rc + } + p = (*TSorterList)(unsafe.Pointer(pList)).FpList + (*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare = _vdbeSorterGetCompare(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter) + libc.Xmemset(tls, bp, 0, uint64(512)) + for p != 0 { + if (*TSorterList)(unsafe.Pointer(pList)).FaMemory != 0 { + if p == (*TSorterList)(unsafe.Pointer(pList)).FaMemory { + pNext = uintptr(0) + } else { + pNext = (*TSorterList)(unsafe.Pointer(pList)).FaMemory + uintptr(*(*int32)(unsafe.Pointer(&(*TSorterRecord)(unsafe.Pointer(p)).Fu))) + } + } else { + pNext = *(*uintptr)(unsafe.Pointer(p + 8)) + } + *(*uintptr)(unsafe.Pointer(p + 8)) = uintptr(0) + i = 0 + for { + if !((*(*[64]uintptr)(unsafe.Pointer(bp)))[i] != 0) { + break + } + p = _vdbeSorterMerge(tls, pTask, p, (*(*[64]uintptr)(unsafe.Pointer(bp)))[i]) + (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = uintptr(0) + goto _1 + _1: + ; + i++ + } + (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] = p + p = pNext + } + p = uintptr(0) + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(512)/libc.Uint64FromInt64(8))) { + break + } + if (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] == uintptr(0) { + goto _2 + } + if p != 0 { + v3 = _vdbeSorterMerge(tls, pTask, p, (*(*[64]uintptr)(unsafe.Pointer(bp)))[i]) + } else { + v3 = (*(*[64]uintptr)(unsafe.Pointer(bp)))[i] + } + p = v3 + goto _2 + _2: + ; + i++ + } + (*TSorterList)(unsafe.Pointer(pList)).FpList = p + return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) +} + +// C documentation +// +// /* +// ** Initialize a PMA-writer object. +// */ +func _vdbePmaWriterInit(tls *libc.TLS, pFd uintptr, p uintptr, nBuf int32, iStart Ti64) { + var v1 int32 + _ = v1 + libc.Xmemset(tls, p, 0, uint64(48)) + (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer = _sqlite3Malloc(tls, uint64(nBuf)) + if !((*TPmaWriter)(unsafe.Pointer(p)).FaBuffer != 0) { + (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr = int32(SQLITE_NOMEM) + } else { + v1 = int32(iStart % int64(nBuf)) + (*TPmaWriter)(unsafe.Pointer(p)).FiBufStart = v1 + (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd = v1 + (*TPmaWriter)(unsafe.Pointer(p)).FiWriteOff = iStart - int64((*TPmaWriter)(unsafe.Pointer(p)).FiBufStart) + (*TPmaWriter)(unsafe.Pointer(p)).FnBuffer = nBuf + (*TPmaWriter)(unsafe.Pointer(p)).FpFd = pFd + } +} + +// C documentation +// +// /* +// ** Write nData bytes of data to the PMA. Return SQLITE_OK +// ** if successful, or an SQLite error code if an error occurs. +// */ +func _vdbePmaWriteBlob(tls *libc.TLS, p uintptr, pData uintptr, nData int32) { + var nCopy, nRem, v1 int32 + _, _, _ = nCopy, nRem, v1 + nRem = nData + for nRem > 0 && (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr == 0 { + nCopy = nRem + if nCopy > (*TPmaWriter)(unsafe.Pointer(p)).FnBuffer-(*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd { + nCopy = (*TPmaWriter)(unsafe.Pointer(p)).FnBuffer - (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd + } + libc.Xmemcpy(tls, (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer+uintptr((*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd), pData+uintptr(nData-nRem), uint64(nCopy)) + *(*int32)(unsafe.Pointer(p + 24)) += nCopy + if (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd == (*TPmaWriter)(unsafe.Pointer(p)).FnBuffer { + (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr = _sqlite3OsWrite(tls, (*TPmaWriter)(unsafe.Pointer(p)).FpFd, (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer+uintptr((*TPmaWriter)(unsafe.Pointer(p)).FiBufStart), (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd-(*TPmaWriter)(unsafe.Pointer(p)).FiBufStart, (*TPmaWriter)(unsafe.Pointer(p)).FiWriteOff+int64((*TPmaWriter)(unsafe.Pointer(p)).FiBufStart)) + v1 = libc.Int32FromInt32(0) + (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd = v1 + (*TPmaWriter)(unsafe.Pointer(p)).FiBufStart = v1 + *(*Ti64)(unsafe.Pointer(p + 32)) += int64((*TPmaWriter)(unsafe.Pointer(p)).FnBuffer) + } + nRem -= nCopy + } +} + +// C documentation +// +// /* +// ** Flush any buffered data to disk and clean up the PMA-writer object. +// ** The results of using the PMA-writer after this call are undefined. +// ** Return SQLITE_OK if flushing the buffered data succeeds or is not +// ** required. Otherwise, return an SQLite error code. +// ** +// ** Before returning, set *piEof to the offset immediately following the +// ** last byte written to the file. +// */ +func _vdbePmaWriterFinish(tls *libc.TLS, p uintptr, piEof uintptr) (r int32) { + var rc int32 + _ = rc + if (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr == 0 && (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer != 0 && (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd > (*TPmaWriter)(unsafe.Pointer(p)).FiBufStart { + (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr = _sqlite3OsWrite(tls, (*TPmaWriter)(unsafe.Pointer(p)).FpFd, (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer+uintptr((*TPmaWriter)(unsafe.Pointer(p)).FiBufStart), (*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd-(*TPmaWriter)(unsafe.Pointer(p)).FiBufStart, (*TPmaWriter)(unsafe.Pointer(p)).FiWriteOff+int64((*TPmaWriter)(unsafe.Pointer(p)).FiBufStart)) + } + *(*Ti64)(unsafe.Pointer(piEof)) = (*TPmaWriter)(unsafe.Pointer(p)).FiWriteOff + int64((*TPmaWriter)(unsafe.Pointer(p)).FiBufEnd) + Xsqlite3_free(tls, (*TPmaWriter)(unsafe.Pointer(p)).FaBuffer) + rc = (*TPmaWriter)(unsafe.Pointer(p)).FeFWErr + libc.Xmemset(tls, p, 0, uint64(48)) + return rc +} + +// C documentation +// +// /* +// ** Write value iVal encoded as a varint to the PMA. Return +// ** SQLITE_OK if successful, or an SQLite error code if an error occurs. +// */ +func _vdbePmaWriteVarint(tls *libc.TLS, p uintptr, iVal Tu64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nByte int32 + var _ /* aByte at bp+0 */ [10]Tu8 + _ = nByte + nByte = _sqlite3PutVarint(tls, bp, iVal) + _vdbePmaWriteBlob(tls, p, bp, nByte) +} + +// C documentation +// +// /* +// ** Write the current contents of in-memory linked-list pList to a level-0 +// ** PMA in the temp file belonging to sub-task pTask. Return SQLITE_OK if +// ** successful, or an SQLite error code otherwise. +// ** +// ** The format of a PMA is: +// ** +// ** * A varint. This varint contains the total number of bytes of content +// ** in the PMA (not including the varint itself). +// ** +// ** * One or more records packed end-to-end in order of ascending keys. +// ** Each record consists of a varint followed by a blob of data (the +// ** key). The varint is the number of bytes in the blob of data. +// */ +func _vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var db, p, pNext uintptr + var rc int32 + var _ /* writer at bp+0 */ TPmaWriter + _, _, _, _ = db, p, pNext, rc + db = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb + rc = SQLITE_OK /* Object used to write to the file */ + libc.Xmemset(tls, bp, 0, uint64(48)) + /* If the first temporary PMA file has not been opened, open it now. */ + if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd == uintptr(0) { + rc = _vdbeSorterOpenTempFile(tls, db, 0, pTask+64) + } + /* Try to get the file to memory map */ + if rc == SQLITE_OK { + _vdbeSorterExtendFile(tls, db, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FiEof+(*TSorterList)(unsafe.Pointer(pList)).FszPMA+int64(9)) + } + /* Sort the list */ + if rc == SQLITE_OK { + rc = _vdbeSorterSort(tls, pTask, pList) + } + if rc == SQLITE_OK { + pNext = uintptr(0) + _vdbePmaWriterInit(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd, bp, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile.FiEof) + (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA++ + _vdbePmaWriteVarint(tls, bp, uint64((*TSorterList)(unsafe.Pointer(pList)).FszPMA)) + p = (*TSorterList)(unsafe.Pointer(pList)).FpList + for { + if !(p != 0) { + break + } + pNext = *(*uintptr)(unsafe.Pointer(p + 8)) + _vdbePmaWriteVarint(tls, bp, uint64((*TSorterRecord)(unsafe.Pointer(p)).FnVal)) + _vdbePmaWriteBlob(tls, bp, p+libc.UintptrFromInt32(1)*16, (*TSorterRecord)(unsafe.Pointer(p)).FnVal) + if (*TSorterList)(unsafe.Pointer(pList)).FaMemory == uintptr(0) { + Xsqlite3_free(tls, p) + } + goto _1 + _1: + ; + p = pNext + } + (*TSorterList)(unsafe.Pointer(pList)).FpList = p + rc = _vdbePmaWriterFinish(tls, bp, pTask+64+8) + } + return rc +} + +// C documentation +// +// /* +// ** Advance the MergeEngine to its next entry. +// ** Set *pbEof to true there is no next entry because +// ** the MergeEngine has reached the end of all its inputs. +// ** +// ** Return SQLITE_OK if successful or an error code if an error occurs. +// */ +func _vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iPrev, iRes, rc, v2 int32 + var pReadr1, pReadr2, pTask uintptr + var _ /* bCached at bp+0 */ int32 + _, _, _, _, _, _, _, _ = i, iPrev, iRes, pReadr1, pReadr2, pTask, rc, v2 + iPrev = *(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)) /* Index of PmaReader to advance */ + pTask = (*TMergeEngine)(unsafe.Pointer(pMerger)).FpTask + /* Advance the current PmaReader */ + rc = _vdbePmaReaderNext(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(iPrev)*80) + /* Update contents of aTree[] */ + if rc == SQLITE_OK { /* Second PmaReader to compare */ + *(*int32)(unsafe.Pointer(bp)) = 0 + /* Find the first two PmaReaders to compare. The one that was just + ** advanced (iPrev) and the one next to it in the array. */ + pReadr1 = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(iPrev&libc.Int32FromInt32(0xFFFE))*80 + pReadr2 = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(iPrev|libc.Int32FromInt32(0x0001))*80 + i = ((*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree + iPrev) / int32(2) + for { + if !(i > 0) { + break + } + if (*TPmaReader)(unsafe.Pointer(pReadr1)).FpFd == uintptr(0) { + iRes = +libc.Int32FromInt32(1) + } else { + if (*TPmaReader)(unsafe.Pointer(pReadr2)).FpFd == uintptr(0) { + iRes = -int32(1) + } else { + iRes = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare})))(tls, pTask, bp, (*TPmaReader)(unsafe.Pointer(pReadr1)).FaKey, (*TPmaReader)(unsafe.Pointer(pReadr1)).FnKey, (*TPmaReader)(unsafe.Pointer(pReadr2)).FaKey, (*TPmaReader)(unsafe.Pointer(pReadr2)).FnKey) + } + } + /* If pReadr1 contained the smaller value, set aTree[i] to its index. + ** Then set pReadr2 to the next PmaReader to compare to pReadr1. In this + ** case there is no cache of pReadr2 in pTask->pUnpacked, so set + ** pKey2 to point to the record belonging to pReadr2. + ** + ** Alternatively, if pReadr2 contains the smaller of the two values, + ** set aTree[i] to its index and update pReadr1. If vdbeSorterCompare() + ** was actually called above, then pTask->pUnpacked now contains + ** a value equivalent to pReadr2. So set pKey2 to NULL to prevent + ** vdbeSorterCompare() from decoding pReadr2 again. + ** + ** If the two values were equal, then the value from the oldest + ** PMA should be considered smaller. The VdbeSorter.aReadr[] array + ** is sorted from oldest to newest, so pReadr1 contains older values + ** than pReadr2 iff (pReadr1nTask-1) tasks. Except, if + ** the background thread from a sub-tasks previous turn is still running, + ** skip it. If the first (pSorter->nTask-1) sub-tasks are all still busy, + ** fall back to using the final sub-task. The first (pSorter->nTask-1) + ** sub-tasks are preferred as they use background threads - the final + ** sub-task uses the main thread. */ + i = 0 + for { + if !(i < nWorker) { + break + } + iTest = (int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FiPrev) + i + int32(1)) % nWorker + pTask = pSorter + 96 + uintptr(iTest)*96 + if (*TSortSubtask)(unsafe.Pointer(pTask)).FbDone != 0 { + rc = _vdbeSorterJoinThread(tls, pTask) + } + if rc != SQLITE_OK || (*TSortSubtask)(unsafe.Pointer(pTask)).FpThread == uintptr(0) { + break + } + goto _1 + _1: + ; + i++ + } + if rc == SQLITE_OK { + if i == nWorker { + /* Use the foreground thread for this operation */ + rc = _vdbeSorterListToPMA(tls, pSorter+96+uintptr(nWorker)*96, pSorter+56) + } else { + aMem = (*TSortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory + pCtx = pTask + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiPrev = uint8((int64(pTask) - t__predefined_ptrdiff_t(pSorter+96)) / 96) + (*TSortSubtask)(unsafe.Pointer(pTask)).Flist = (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = uintptr(0) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + if aMem != 0 { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = aMem + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = _sqlite3MallocSize(tls, aMem) + } else { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = _sqlite3Malloc(tls, uint64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory)) + if !((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0) { + return int32(SQLITE_NOMEM) + } + } + } + rc = _vdbeSorterCreateThread(tls, pTask, __ccgo_fp(_vdbeSorterFlushThread), pCtx) + } + } + return rc +} + +// C documentation +// +// /* +// ** Add a record to the sorter. +// */ +func _sqlite3VdbeSorterWrite(tls *libc.TLS, pCsr uintptr, pVal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aNew, pNew, pSorter, p1, p2, p3 uintptr + var bFlush, iListOff, nMin, rc int32 + var nNew Tsqlite3_int64 + var nPMA, nReq Ti64 + var _ /* t at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = aNew, bFlush, iListOff, nMin, nNew, nPMA, nReq, pNew, pSorter, rc, p1, p2, p3 + rc = SQLITE_OK /* serial type of first record field */ + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + *(*int32)(unsafe.Pointer(bp)) = int32(uint32(*(*Tu8)(unsafe.Pointer((*TMem)(unsafe.Pointer(pVal)).Fz + 1)))) + if *(*int32)(unsafe.Pointer(bp)) >= int32(0x80) { + _sqlite3GetVarint32(tls, (*TMem)(unsafe.Pointer(pVal)).Fz+1, bp) + } + if *(*int32)(unsafe.Pointer(bp)) > 0 && *(*int32)(unsafe.Pointer(bp)) < int32(10) && *(*int32)(unsafe.Pointer(bp)) != int32(7) { + p1 = pSorter + 92 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & libc.Int32FromInt32(SORTER_TYPE_INTEGER)) + } else { + if *(*int32)(unsafe.Pointer(bp)) > int32(10) && *(*int32)(unsafe.Pointer(bp))&int32(0x01) != 0 { + p2 = pSorter + 92 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) & libc.Int32FromInt32(SORTER_TYPE_TEXT)) + } else { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FtypeMask = uint8(0) + } + } + /* Figure out whether or not the current contents of memory should be + ** flushed to a PMA before continuing. If so, do so. + ** + ** If using the single large allocation mode (pSorter->aMemory!=0), then + ** flush the contents of memory to a new PMA if (a) at least one value is + ** already in memory and (b) the new value will not fit in memory. + ** + ** Or, if using separate allocations for each record, flush the contents + ** of memory to a PMA if either of the following are true: + ** + ** * The total memory allocated for the in-memory list is greater + ** than (page-size * cache-size), or + ** + ** * The total memory allocated for the in-memory list is greater + ** than (page-size * 10) and sqlite3HeapNearlyFull() returns true. + */ + nReq = int64(uint64((*TMem)(unsafe.Pointer(pVal)).Fn) + uint64(16)) + nPMA = int64((*TMem)(unsafe.Pointer(pVal)).Fn + _sqlite3VarintLen(tls, uint64((*TMem)(unsafe.Pointer(pVal)).Fn))) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize != 0 { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + bFlush = libc.BoolInt32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory != 0 && int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory)+nReq > int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize)) + } else { + bFlush = libc.BoolInt32((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA > int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) || (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA > int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize) && _sqlite3HeapNearlyFull(tls) != 0) + } + if bFlush != 0 { + rc = _vdbeSorterFlushPMA(tls, pSorter) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory = 0 + } + } + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA += nPMA + if nPMA > int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize) { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize = int32(nPMA) + } + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + nMin = int32(int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory) + nReq) + if nMin > (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory { + nNew = int64(2) * int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory) + iListOff = -int32(1) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + iListOff = int32(int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) - int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory)) + } + for nNew < int64(nMin) { + nNew = nNew * int64(2) + } + if nNew > int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) { + nNew = int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) + } + if nNew < int64(nMin) { + nNew = int64(nMin) + } + aNew = _sqlite3Realloc(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory, uint64(nNew)) + if !(aNew != 0) { + return int32(SQLITE_NOMEM) + } + if iListOff >= 0 { + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = aNew + uintptr(iListOff) + } + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = aNew + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = int32(nNew) + } + pNew = (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory + uintptr((*TVdbeSorter)(unsafe.Pointer(pSorter)).FiMemory) + p3 = pSorter + 80 + *(*int32)(unsafe.Pointer(p3)) = int32(int64(*(*int32)(unsafe.Pointer(p3))) + (nReq+libc.Int64FromInt32(7))&int64(^libc.Int32FromInt32(7))) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + *(*int32)(unsafe.Pointer(&(*TSorterRecord)(unsafe.Pointer(pNew)).Fu)) = int32(int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) - int64((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory)) + } + } else { + pNew = _sqlite3Malloc(tls, uint64(nReq)) + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + *(*uintptr)(unsafe.Pointer(pNew + 8)) = (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList + } + libc.Xmemcpy(tls, pNew+libc.UintptrFromInt32(1)*16, (*TMem)(unsafe.Pointer(pVal)).Fz, uint64((*TMem)(unsafe.Pointer(pVal)).Fn)) + (*TSorterRecord)(unsafe.Pointer(pNew)).FnVal = (*TMem)(unsafe.Pointer(pVal)).Fn + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = pNew + return rc +} + +// C documentation +// +// /* +// ** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format +// ** of the data stored in aFile[1] is the same as that used by regular PMAs, +// ** except that the number-of-bytes varint is omitted from the start. +// */ +func _vdbeIncrPopulate(tls *libc.TLS, pIncr uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var iEof, iStart Ti64 + var nKey, rc, rc2 int32 + var pMerger, pOut, pReader, pTask uintptr + var _ /* dummy at bp+48 */ int32 + var _ /* writer at bp+0 */ TPmaWriter + _, _, _, _, _, _, _, _, _ = iEof, iStart, nKey, pMerger, pOut, pReader, pTask, rc, rc2 + rc = SQLITE_OK + iStart = (*TIncrMerger)(unsafe.Pointer(pIncr)).FiStartOff + pOut = pIncr + 40 + 1*16 + pTask = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask + pMerger = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger + _vdbePmaWriterInit(tls, (*TSorterFile)(unsafe.Pointer(pOut)).FpFd, bp, (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz, iStart) + for rc == SQLITE_OK { + pReader = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80 + nKey = (*TPmaReader)(unsafe.Pointer(pReader)).FnKey + iEof = (*(*TPmaWriter)(unsafe.Pointer(bp))).FiWriteOff + int64((*(*TPmaWriter)(unsafe.Pointer(bp))).FiBufEnd) + /* Check if the output file is full or if the input has been exhausted. + ** In either case exit the loop. */ + if (*TPmaReader)(unsafe.Pointer(pReader)).FpFd == uintptr(0) { + break + } + if iEof+int64(nKey)+int64(_sqlite3VarintLen(tls, uint64(nKey))) > iStart+int64((*TIncrMerger)(unsafe.Pointer(pIncr)).FmxSz) { + break + } + /* Write the next key to the output. */ + _vdbePmaWriteVarint(tls, bp, uint64(nKey)) + _vdbePmaWriteBlob(tls, bp, (*TPmaReader)(unsafe.Pointer(pReader)).FaKey, nKey) + rc = _vdbeMergeEngineStep(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger, bp+48) + } + rc2 = _vdbePmaWriterFinish(tls, bp, pOut+8) + if rc == SQLITE_OK { + rc = rc2 + } + return rc +} + +// C documentation +// +// /* +// ** The main routine for background threads that populate aFile[1] of +// ** multi-threaded IncrMerger objects. +// */ +func _vdbeIncrPopulateThread(tls *libc.TLS, pCtx uintptr) (r uintptr) { + var pIncr, pRet uintptr + _, _ = pIncr, pRet + pIncr = pCtx + pRet = uintptr(int64(_vdbeIncrPopulate(tls, pIncr))) + (*TSortSubtask)(unsafe.Pointer((*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask)).FbDone = int32(1) + return pRet +} + +// C documentation +// +// /* +// ** Launch a background thread to populate aFile[1] of pIncr. +// */ +func _vdbeIncrBgPopulate(tls *libc.TLS, pIncr uintptr) (r int32) { + var p uintptr + _ = p + p = pIncr + return _vdbeSorterCreateThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask, __ccgo_fp(_vdbeIncrPopulateThread), p) +} + +// C documentation +// +// /* +// ** This function is called when the PmaReader corresponding to pIncr has +// ** finished reading the contents of aFile[0]. Its purpose is to "refill" +// ** aFile[0] such that the PmaReader should start rereading it from the +// ** beginning. +// ** +// ** For single-threaded objects, this is accomplished by literally reading +// ** keys from pIncr->pMerger and repopulating aFile[0]. +// ** +// ** For multi-threaded objects, all that is required is to wait until the +// ** background thread is finished (if it is not already) and then swap +// ** aFile[0] and aFile[1] in place. If the contents of pMerger have not +// ** been exhausted, this function also launches a new background thread +// ** to populate the new aFile[1]. +// ** +// ** SQLITE_OK is returned on success, or an SQLite error code otherwise. +// */ +func _vdbeIncrSwap(tls *libc.TLS, pIncr uintptr) (r int32) { + var f0 TSorterFile + var rc int32 + _, _ = f0, rc + rc = SQLITE_OK + if (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + rc = _vdbeSorterJoinThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask) + if rc == SQLITE_OK { + f0 = *(*TSorterFile)(unsafe.Pointer(pIncr + 40)) + *(*TSorterFile)(unsafe.Pointer(pIncr + 40)) = *(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16)) + *(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16)) = f0 + } + if rc == SQLITE_OK { + if (*(*TSorterFile)(unsafe.Pointer(pIncr + 40))).FiEof == (*TIncrMerger)(unsafe.Pointer(pIncr)).FiStartOff { + (*TIncrMerger)(unsafe.Pointer(pIncr)).FbEof = int32(1) + } else { + rc = _vdbeIncrBgPopulate(tls, pIncr) + } + } + } else { + rc = _vdbeIncrPopulate(tls, pIncr) + *(*TSorterFile)(unsafe.Pointer(pIncr + 40)) = *(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16)) + if (*(*TSorterFile)(unsafe.Pointer(pIncr + 40))).FiEof == (*TIncrMerger)(unsafe.Pointer(pIncr)).FiStartOff { + (*TIncrMerger)(unsafe.Pointer(pIncr)).FbEof = int32(1) + } + } + return rc +} + +// C documentation +// +// /* +// ** Allocate and return a new IncrMerger object to read data from pMerger. +// ** +// ** If an OOM condition is encountered, return NULL. In this case free the +// ** pMerger argument before returning. +// */ +func _vdbeIncrMergerNew(tls *libc.TLS, pTask uintptr, pMerger uintptr, ppOut uintptr) (r int32) { + var pIncr, v1, v2 uintptr + var rc, v3 int32 + _, _, _, _, _ = pIncr, rc, v1, v2, v3 + rc = SQLITE_OK + if _sqlite3FaultSim(tls, int32(100)) != 0 { + v2 = uintptr(0) + } else { + v2 = _sqlite3MallocZero(tls, uint64(72)) + } + v1 = v2 + *(*uintptr)(unsafe.Pointer(ppOut)) = v1 + pIncr = v1 + if pIncr != 0 { + (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger = pMerger + (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask = pTask + if (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxKeysize+int32(9) > (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxPmaSize/int32(2) { + v3 = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxKeysize + int32(9) + } else { + v3 = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxPmaSize / int32(2) + } + (*TIncrMerger)(unsafe.Pointer(pIncr)).FmxSz = v3 + (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof += int64((*TIncrMerger)(unsafe.Pointer(pIncr)).FmxSz) + } else { + _vdbeMergeEngineFree(tls, pMerger) + rc = int32(SQLITE_NOMEM) + } + return rc +} + +// C documentation +// +// /* +// ** Set the "use-threads" flag on object pIncr. +// */ +func _vdbeIncrMergerSetThreads(tls *libc.TLS, pIncr uintptr) { + (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread = int32(1) + (*TSortSubtask)(unsafe.Pointer((*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask)).Ffile2.FiEof -= int64((*TIncrMerger)(unsafe.Pointer(pIncr)).FmxSz) +} + +// C documentation +// +// /* +// ** Recompute pMerger->aTree[iOut] by comparing the next keys on the +// ** two PmaReaders that feed that entry. Neither of the PmaReaders +// ** are advanced. This routine merely does the comparison. +// */ +func _vdbeMergeEngineCompare(tls *libc.TLS, pMerger uintptr, iOut int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i1, i2, iRes, res int32 + var p1, p2, pTask uintptr + var _ /* bCached at bp+0 */ int32 + _, _, _, _, _, _, _ = i1, i2, iRes, p1, p2, pTask, res + if iOut >= (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree/int32(2) { + i1 = (iOut - (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree/int32(2)) * int32(2) + i2 = i1 + int32(1) + } else { + i1 = *(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr(iOut*int32(2))*4)) + i2 = *(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr(iOut*int32(2)+int32(1))*4)) + } + p1 = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i1)*80 + p2 = (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i2)*80 + if (*TPmaReader)(unsafe.Pointer(p1)).FpFd == uintptr(0) { + iRes = i2 + } else { + if (*TPmaReader)(unsafe.Pointer(p2)).FpFd == uintptr(0) { + iRes = i1 + } else { + pTask = (*TMergeEngine)(unsafe.Pointer(pMerger)).FpTask + *(*int32)(unsafe.Pointer(bp)) = 0 + /* from vdbeSortSubtaskMain() */ + res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSortSubtask)(unsafe.Pointer(pTask)).FxCompare})))(tls, pTask, bp, (*TPmaReader)(unsafe.Pointer(p1)).FaKey, (*TPmaReader)(unsafe.Pointer(p1)).FnKey, (*TPmaReader)(unsafe.Pointer(p2)).FaKey, (*TPmaReader)(unsafe.Pointer(p2)).FnKey) + if res <= 0 { + iRes = i1 + } else { + iRes = i2 + } + } + } + *(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr(iOut)*4)) = iRes +} + +// C documentation +// +// /* +// ** Initialize the MergeEngine object passed as the second argument. Once this +// ** function returns, the first key of merged data may be read from the +// ** MergeEngine object in the usual fashion. +// ** +// ** If argument eMode is INCRINIT_ROOT, then it is assumed that any IncrMerge +// ** objects attached to the PmaReader objects that the merger reads from have +// ** already been populated, but that they have not yet populated aFile[0] and +// ** set the PmaReader objects up to read from it. In this case all that is +// ** required is to call vdbePmaReaderNext() on each PmaReader to point it at +// ** its first key. +// ** +// ** Otherwise, if eMode is any value other than INCRINIT_ROOT, then use +// ** vdbePmaReaderIncrMergeInit() to initialize each PmaReader that feeds data +// ** to pMerger. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode int32) (r int32) { + var i, nTree, rc int32 + _, _, _ = i, nTree, rc + rc = SQLITE_OK /* Number of subtrees to merge */ + /* Failure to allocate the merge would have been detected prior to + ** invoking this routine */ + /* eMode is always INCRINIT_NORMAL in single-threaded mode */ + /* Verify that the MergeEngine is assigned to a single thread */ + (*TMergeEngine)(unsafe.Pointer(pMerger)).FpTask = pTask + nTree = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree + i = 0 + for { + if !(i < nTree) { + break + } + if libc.Bool(int32(SQLITE_MAX_WORKER_THREADS) > 0) && eMode == int32(INCRINIT_ROOT) { + /* PmaReaders should be normally initialized in order, as if they are + ** reading from the same temp file this makes for more linear file IO. + ** However, in the INCRINIT_ROOT case, if PmaReader aReadr[nTask-1] is + ** in use it will block the vdbePmaReaderNext() call while it uses + ** the main thread to fill its buffer. So calling PmaReaderNext() + ** on this PmaReader before any of the multi-threaded PmaReaders takes + ** better advantage of multi-processor hardware. */ + rc = _vdbePmaReaderNext(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(nTree-i-int32(1))*80) + } else { + rc = _vdbePmaReaderIncrInit(tls, (*TMergeEngine)(unsafe.Pointer(pMerger)).FaReadr+uintptr(i)*80, INCRINIT_NORMAL) + } + if rc != SQLITE_OK { + return rc + } + goto _1 + _1: + ; + i++ + } + i = (*TMergeEngine)(unsafe.Pointer(pMerger)).FnTree - int32(1) + for { + if !(i > 0) { + break + } + _vdbeMergeEngineCompare(tls, pMerger, i) + goto _2 + _2: + ; + i-- + } + return int32((*TUnpackedRecord)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) +} + +// C documentation +// +// /* +// ** The PmaReader passed as the first argument is guaranteed to be an +// ** incremental-reader (pReadr->pIncr!=0). This function serves to open +// ** and/or initialize the temp file related fields of the IncrMerge +// ** object at (pReadr->pIncr). +// ** +// ** If argument eMode is set to INCRINIT_NORMAL, then all PmaReaders +// ** in the sub-tree headed by pReadr are also initialized. Data is then +// ** loaded into the buffers belonging to pReadr and it is set to point to +// ** the first key in its range. +// ** +// ** If argument eMode is set to INCRINIT_TASK, then pReadr is guaranteed +// ** to be a multi-threaded PmaReader and this function is being called in a +// ** background thread. In this case all PmaReaders in the sub-tree are +// ** initialized as for INCRINIT_NORMAL and the aFile[1] buffer belonging to +// ** pReadr is populated. However, pReadr itself is not set up to point +// ** to its first key. A call to vdbePmaReaderNext() is still required to do +// ** that. +// ** +// ** The reason this function does not call vdbePmaReaderNext() immediately +// ** in the INCRINIT_TASK case is that vdbePmaReaderNext() assumes that it has +// ** to block on thread (pTask->thread) before accessing aFile[1]. But, since +// ** this entire function is being run by thread (pTask->thread), that will +// ** lead to the current background thread attempting to join itself. +// ** +// ** Finally, if argument eMode is set to INCRINIT_ROOT, it may be assumed +// ** that pReadr->pIncr is a multi-threaded IncrMerge objects, and that all +// ** child-trees have already been initialized using IncrInit(INCRINIT_TASK). +// ** In this case vdbePmaReaderNext() is called on all child PmaReaders and +// ** the current PmaReader set to point to the first key in its range. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _vdbePmaReaderIncrMergeInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r int32) { + var db, pIncr, pTask uintptr + var mxSz, rc int32 + _, _, _, _, _ = db, mxSz, pIncr, pTask, rc + rc = SQLITE_OK + pIncr = (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr + pTask = (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask + db = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb + /* eMode is always INCRINIT_NORMAL in single-threaded mode */ + rc = _vdbeMergeEngineInit(tls, pTask, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpMerger, eMode) + /* Set up the required files for pIncr. A multi-threaded IncrMerge object + ** requires two temp files to itself, whereas a single-threaded object + ** only requires a region of pTask->file2. */ + if rc == SQLITE_OK { + mxSz = (*TIncrMerger)(unsafe.Pointer(pIncr)).FmxSz + if (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + rc = _vdbeSorterOpenTempFile(tls, db, int64(mxSz), pIncr+40) + if rc == SQLITE_OK { + rc = _vdbeSorterOpenTempFile(tls, db, int64(mxSz), pIncr+40+1*16) + } + } else { + /*if( !pIncr->bUseThread )*/ + if (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd == uintptr(0) { + rc = _vdbeSorterOpenTempFile(tls, db, (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof, pTask+80) + (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof = 0 + } + if rc == SQLITE_OK { + (*(*TSorterFile)(unsafe.Pointer(pIncr + 40 + 1*16))).FpFd = (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd + (*TIncrMerger)(unsafe.Pointer(pIncr)).FiStartOff = (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof + (*TSortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof += int64(mxSz) + } + } + } + if rc == SQLITE_OK && (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + /* Use the current thread to populate aFile[1], even though this + ** PmaReader is multi-threaded. If this is an INCRINIT_TASK object, + ** then this function is already running in background thread + ** pIncr->pTask->thread. + ** + ** If this is the INCRINIT_ROOT object, then it is running in the + ** main VDBE thread. But that is Ok, as that thread cannot return + ** control to the VDBE or proceed with anything useful until the + ** first results are ready from this merger object anyway. + */ + rc = _vdbeIncrPopulate(tls, pIncr) + } + if rc == SQLITE_OK && (libc.Bool(false) || eMode != int32(INCRINIT_TASK)) { + rc = _vdbePmaReaderNext(tls, pReadr) + } + return rc +} + +// C documentation +// +// /* +// ** The main routine for vdbePmaReaderIncrMergeInit() operations run in +// ** background threads. +// */ +func _vdbePmaReaderBgIncrInit(tls *libc.TLS, pCtx uintptr) (r uintptr) { + var pReader, pRet uintptr + _, _ = pReader, pRet + pReader = pCtx + pRet = uintptr(int64(_vdbePmaReaderIncrMergeInit(tls, pReader, int32(INCRINIT_TASK)))) + (*TSortSubtask)(unsafe.Pointer((*TIncrMerger)(unsafe.Pointer((*TPmaReader)(unsafe.Pointer(pReader)).FpIncr)).FpTask)).FbDone = int32(1) + return pRet +} + +// C documentation +// +// /* +// ** If the PmaReader passed as the first argument is not an incremental-reader +// ** (if pReadr->pIncr==0), then this function is a no-op. Otherwise, it invokes +// ** the vdbePmaReaderIncrMergeInit() function with the parameters passed to +// ** this routine to initialize the incremental merge. +// ** +// ** If the IncrMerger object is multi-threaded (IncrMerger.bUseThread==1), +// ** then a background thread is launched to call vdbePmaReaderIncrMergeInit(). +// ** Or, if the IncrMerger is single threaded, the same function is called +// ** using the current thread. +// */ +func _vdbePmaReaderIncrInit(tls *libc.TLS, pReadr uintptr, eMode int32) (r int32) { + var pCtx, pIncr uintptr + var rc int32 + _, _, _ = pCtx, pIncr, rc + pIncr = (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr /* Incremental merger */ + rc = SQLITE_OK /* Return code */ + if pIncr != 0 { + if (*TIncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + pCtx = pReadr + rc = _vdbeSorterCreateThread(tls, (*TIncrMerger)(unsafe.Pointer(pIncr)).FpTask, __ccgo_fp(_vdbePmaReaderBgIncrInit), pCtx) + } else { + rc = _vdbePmaReaderIncrMergeInit(tls, pReadr, eMode) + } + } + return rc +} + +// C documentation +// +// /* +// ** Allocate a new MergeEngine object to merge the contents of nPMA level-0 +// ** PMAs from pTask->file. If no error occurs, set *ppOut to point to +// ** the new object and return SQLITE_OK. Or, if an error does occur, set *ppOut +// ** to NULL and return an SQLite error code. +// ** +// ** When this function is called, *piOffset is set to the offset of the +// ** first PMA to read from pTask->file. Assuming no error occurs, it is +// ** set to the offset immediately following the last byte of the last +// ** PMA before returning. If an error does occur, then the final value of +// ** *piOffset is undefined. +// */ +func _vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, rc int32 + var iOff Ti64 + var pNew, pReadr, v1 uintptr + var _ /* nDummy at bp+0 */ Ti64 + _, _, _, _, _, _ = i, iOff, pNew, pReadr, rc, v1 /* Merge engine to return */ + iOff = *(*Ti64)(unsafe.Pointer(piOffset)) + rc = SQLITE_OK + v1 = _vdbeMergeEngineNew(tls, nPMA) + pNew = v1 + *(*uintptr)(unsafe.Pointer(ppOut)) = v1 + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + i = 0 + for { + if !(i < nPMA && rc == SQLITE_OK) { + break + } + *(*Ti64)(unsafe.Pointer(bp)) = 0 + pReadr = (*TMergeEngine)(unsafe.Pointer(pNew)).FaReadr + uintptr(i)*80 + rc = _vdbePmaReaderInit(tls, pTask, pTask+64, iOff, pReadr, bp) + iOff = (*TPmaReader)(unsafe.Pointer(pReadr)).FiEof + goto _2 + _2: + ; + i++ + } + if rc != SQLITE_OK { + _vdbeMergeEngineFree(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + *(*Ti64)(unsafe.Pointer(piOffset)) = iOff + return rc +} + +// C documentation +// +// /* +// ** Return the depth of a tree comprising nPMA PMAs, assuming a fanout of +// ** SORTER_MAX_MERGE_COUNT. The returned value does not include leaf nodes. +// ** +// ** i.e. +// ** +// ** nPMA<=16 -> TreeDepth() == 0 +// ** nPMA<=256 -> TreeDepth() == 1 +// ** nPMA<=65536 -> TreeDepth() == 2 +// */ +func _vdbeSorterTreeDepth(tls *libc.TLS, nPMA int32) (r int32) { + var nDepth int32 + var nDiv Ti64 + _, _ = nDepth, nDiv + nDepth = 0 + nDiv = int64(SORTER_MAX_MERGE_COUNT) + for nDiv < int64(nPMA) { + nDiv = nDiv * int64(SORTER_MAX_MERGE_COUNT) + nDepth++ + } + return nDepth +} + +// C documentation +// +// /* +// ** pRoot is the root of an incremental merge-tree with depth nDepth (according +// ** to vdbeSorterTreeDepth()). pLeaf is the iSeq'th leaf to be added to the +// ** tree, counting from zero. This function adds pLeaf to the tree. +// ** +// ** If successful, SQLITE_OK is returned. If an error occurs, an SQLite error +// ** code is returned and pLeaf is freed. +// */ +func _vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32, pRoot uintptr, pLeaf uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iIter, nDiv, rc int32 + var p, pNew, pReadr uintptr + var _ /* pIncr at bp+0 */ uintptr + _, _, _, _, _, _, _ = i, iIter, nDiv, p, pNew, pReadr, rc + rc = SQLITE_OK + nDiv = int32(1) + p = pRoot + rc = _vdbeIncrMergerNew(tls, pTask, pLeaf, bp) + i = int32(1) + for { + if !(i < nDepth) { + break + } + nDiv = nDiv * int32(SORTER_MAX_MERGE_COUNT) + goto _1 + _1: + ; + i++ + } + i = int32(1) + for { + if !(i < nDepth && rc == SQLITE_OK) { + break + } + iIter = iSeq / nDiv % int32(SORTER_MAX_MERGE_COUNT) + pReadr = (*TMergeEngine)(unsafe.Pointer(p)).FaReadr + uintptr(iIter)*80 + if (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr == uintptr(0) { + pNew = _vdbeMergeEngineNew(tls, int32(SORTER_MAX_MERGE_COUNT)) + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = _vdbeIncrMergerNew(tls, pTask, pNew, pReadr+72) + } + } + if rc == SQLITE_OK { + p = (*TIncrMerger)(unsafe.Pointer((*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr)).FpMerger + nDiv = nDiv / int32(SORTER_MAX_MERGE_COUNT) + } + goto _2 + _2: + ; + i++ + } + if rc == SQLITE_OK { + (*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(p)).FaReadr + uintptr(iSeq%int32(SORTER_MAX_MERGE_COUNT))*80))).FpIncr = *(*uintptr)(unsafe.Pointer(bp)) + } else { + _vdbeIncrFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** This function is called as part of a SorterRewind() operation on a sorter +// ** that has already written two or more level-0 PMAs to one or more temp +// ** files. It builds a tree of MergeEngine/IncrMerger/PmaReader objects that +// ** can be used to incrementally merge all PMAs on disk. +// ** +// ** If successful, SQLITE_OK is returned and *ppOut set to point to the +// ** MergeEngine object at the root of the tree before returning. Or, if an +// ** error occurs, an SQLite error code is returned and the final value +// ** of *ppOut is undefined. +// */ +func _vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, iSeq, iTask, nDepth, nReader, rc, v3, v4 int32 + var pMain, pTask uintptr + var _ /* iReadOff at bp+8 */ Ti64 + var _ /* pMerger at bp+16 */ uintptr + var _ /* pRoot at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _ = i, iSeq, iTask, nDepth, nReader, pMain, pTask, rc, v3, v4 + pMain = uintptr(0) + rc = SQLITE_OK + /* If the sorter uses more than one task, then create the top-level + ** MergeEngine here. This MergeEngine will read data from exactly + ** one PmaReader per sub-task. */ + if int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask) > int32(1) { + pMain = _vdbeMergeEngineNew(tls, int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) + if pMain == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + iTask = 0 + for { + if !(rc == SQLITE_OK && iTask < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) { + break + } + pTask = pSorter + 96 + uintptr(iTask)*96 + if libc.Bool(false) || (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Root node of tree for this task */ + nDepth = _vdbeSorterTreeDepth(tls, (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA) + *(*Ti64)(unsafe.Pointer(bp + 8)) = 0 + if (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA <= int32(SORTER_MAX_MERGE_COUNT) { + rc = _vdbeMergeEngineLevel0(tls, pTask, (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA, bp+8, bp) + } else { + iSeq = 0 + *(*uintptr)(unsafe.Pointer(bp)) = _vdbeMergeEngineNew(tls, int32(SORTER_MAX_MERGE_COUNT)) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + i = 0 + for { + if !(i < (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA && rc == SQLITE_OK) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) /* Number of level-0 PMAs to merge */ + if (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA-i < int32(SORTER_MAX_MERGE_COUNT) { + v3 = (*TSortSubtask)(unsafe.Pointer(pTask)).FnPMA - i + } else { + v3 = int32(SORTER_MAX_MERGE_COUNT) + } + nReader = v3 + rc = _vdbeMergeEngineLevel0(tls, pTask, nReader, bp+8, bp+16) + if rc == SQLITE_OK { + v4 = iSeq + iSeq++ + rc = _vdbeSorterAddToTree(tls, pTask, nDepth, v4, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 16))) + } + goto _2 + _2: + ; + i += int32(SORTER_MAX_MERGE_COUNT) + } + } + if rc == SQLITE_OK { + if pMain != uintptr(0) { + rc = _vdbeIncrMergerNew(tls, pTask, *(*uintptr)(unsafe.Pointer(bp)), (*TMergeEngine)(unsafe.Pointer(pMain)).FaReadr+uintptr(iTask)*80+72) + } else { + pMain = *(*uintptr)(unsafe.Pointer(bp)) + } + } else { + _vdbeMergeEngineFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + goto _1 + _1: + ; + iTask++ + } + if rc != SQLITE_OK { + _vdbeMergeEngineFree(tls, pMain) + pMain = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ppOut)) = pMain + return rc +} + +// C documentation +// +// /* +// ** This function is called as part of an sqlite3VdbeSorterRewind() operation +// ** on a sorter that has written two or more PMAs to temporary files. It sets +// ** up either VdbeSorter.pMerger (for single threaded sorters) or pReader +// ** (for multi-threaded sorters) so that it can be used to iterate through +// ** all records stored in the sorter. +// ** +// ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +// */ +func _vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, p, pIncr, pLast, pReadr, pTask0, v3 uintptr + var i, iTask, rc int32 + var xCompare TSorterCompare + var _ /* pMain at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _ = db, i, iTask, p, pIncr, pLast, pReadr, pTask0, rc, xCompare, v3 /* Return code */ + pTask0 = pSorter + 96 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + db = (*TVdbeSorter)(unsafe.Pointer((*TSortSubtask)(unsafe.Pointer(pTask0)).FpSorter)).Fdb + xCompare = _vdbeSorterGetCompare(tls, pSorter) + i = 0 + for { + if !(i < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) { + break + } + (*(*TSortSubtask)(unsafe.Pointer(pSorter + 96 + uintptr(i)*96))).FxCompare = xCompare + goto _1 + _1: + ; + i++ + } + rc = _vdbeSorterMergeTreeBuild(tls, pSorter, bp) + if rc == SQLITE_OK { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + pReadr = uintptr(0) + pLast = pSorter + 96 + uintptr(int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)-int32(1))*96 + rc = _vdbeSortAllocUnpacked(tls, pLast) + if rc == SQLITE_OK { + pReadr = _sqlite3DbMallocZero(tls, db, uint64(80)) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader = pReadr + if pReadr == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + if rc == SQLITE_OK { + rc = _vdbeIncrMergerNew(tls, pLast, *(*uintptr)(unsafe.Pointer(bp)), pReadr+72) + if rc == SQLITE_OK { + _vdbeIncrMergerSetThreads(tls, (*TPmaReader)(unsafe.Pointer(pReadr)).FpIncr) + iTask = 0 + for { + if !(iTask < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)-int32(1)) { + break + } + v3 = (*(*TPmaReader)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaReadr + uintptr(iTask)*80))).FpIncr + pIncr = v3 + if v3 != 0 { + _vdbeIncrMergerSetThreads(tls, pIncr) + } + goto _2 + _2: + ; + iTask++ + } + iTask = 0 + for { + if !(rc == SQLITE_OK && iTask < int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) { + break + } + /* Check that: + ** + ** a) The incremental merge object is configured to use the + ** right task, and + ** b) If it is using task (nTask-1), it is configured to run + ** in single-threaded mode. This is important, as the + ** root merge (INCRINIT_ROOT) will be using the same task + ** object. + */ + p = (*TMergeEngine)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaReadr + uintptr(iTask)*80 + rc = _vdbePmaReaderIncrInit(tls, p, int32(INCRINIT_TASK)) + goto _4 + _4: + ; + iTask++ + } + } + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + if rc == SQLITE_OK { + rc = _vdbePmaReaderIncrMergeInit(tls, pReadr, int32(INCRINIT_ROOT)) + } + } else { + rc = _vdbeMergeEngineInit(tls, pTask0, *(*uintptr)(unsafe.Pointer(bp)), INCRINIT_NORMAL) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + } + if rc != SQLITE_OK { + _vdbeMergeEngineFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Once the sorter has been populated by calls to sqlite3VdbeSorterWrite, +// ** this function is called to prepare for iterating through the records +// ** in sorted order. +// */ +func _sqlite3VdbeSorterRewind(tls *libc.TLS, pCsr uintptr, pbEof uintptr) (r int32) { + var pSorter uintptr + var rc int32 + _, _ = pSorter, rc + rc = SQLITE_OK /* Return code */ + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + /* If no data has been written to disk, then do not do so now. Instead, + ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly + ** from the in-memory list. */ + if int32((*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA) == 0 { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + *(*int32)(unsafe.Pointer(pbEof)) = 0 + rc = _vdbeSorterSort(tls, pSorter+96, pSorter+56) + } else { + *(*int32)(unsafe.Pointer(pbEof)) = int32(1) + } + return rc + } + /* Write the current in-memory list to a PMA. When the VdbeSorterWrite() + ** function flushes the contents of memory to disk, it immediately always + ** creates a new list consisting of a single key immediately afterwards. + ** So the list is never empty at this point. */ + rc = _vdbeSorterFlushPMA(tls, pSorter) + /* Join all threads */ + rc = _vdbeSorterJoinAll(tls, pSorter, rc) + /* Assuming no errors have occurred, set up a merger structure to + ** incrementally read and merge all remaining PMAs. */ + if rc == SQLITE_OK { + rc = _vdbeSorterSetupMerge(tls, pSorter) + *(*int32)(unsafe.Pointer(pbEof)) = 0 + } + return rc +} + +// C documentation +// +// /* +// ** Advance to the next element in the sorter. Return value: +// ** +// ** SQLITE_OK success +// ** SQLITE_DONE end of data +// ** otherwise some kind of error. +// */ +func _sqlite3VdbeSorterNext(tls *libc.TLS, db uintptr, pCsr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pFree, pSorter uintptr + var rc, v1 int32 + var _ /* res at bp+0 */ int32 + _, _, _, _ = pFree, pSorter, rc, v1 /* Return code */ + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA != 0 { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + rc = _vdbePmaReaderNext(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + if rc == SQLITE_OK && (*TPmaReader)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader)).FpFd == uintptr(0) { + rc = int32(SQLITE_DONE) + } + } else { + /*if( !pSorter->bUseThreads )*/ + *(*int32)(unsafe.Pointer(bp)) = 0 + rc = _vdbeMergeEngineStep(tls, (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger, bp) + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp)) != 0 { + rc = int32(SQLITE_DONE) + } + } + } else { + pFree = (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList + (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = *(*uintptr)(unsafe.Pointer(pFree + 8)) + *(*uintptr)(unsafe.Pointer(pFree + 8)) = uintptr(0) + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { + _vdbeSorterRecordFree(tls, db, pFree) + } + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + v1 = SQLITE_OK + } else { + v1 = int32(SQLITE_DONE) + } + rc = v1 + } + return rc +} + +// C documentation +// +// /* +// ** Return a pointer to a buffer owned by the sorter that contains the +// ** current key. +// */ +func _vdbeSorterRowkey(tls *libc.TLS, pSorter uintptr, pnKey uintptr) (r uintptr) { + var pKey, pReader uintptr + _, _ = pKey, pReader + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA != 0 { + if (*TVdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + pReader = (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpReader + } else { + /*if( !pSorter->bUseThreads )*/ + pReader = (*TMergeEngine)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*TMergeEngine)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer(pSorter)).FpMerger)).FaTree + 1*4)))*80 + } + *(*int32)(unsafe.Pointer(pnKey)) = (*TPmaReader)(unsafe.Pointer(pReader)).FnKey + pKey = (*TPmaReader)(unsafe.Pointer(pReader)).FaKey + } else { + *(*int32)(unsafe.Pointer(pnKey)) = (*TSorterRecord)(unsafe.Pointer((*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList)).FnVal + pKey = (*TVdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList + libc.UintptrFromInt32(1)*16 + } + return pKey +} + +// C documentation +// +// /* +// ** Copy the current sorter key into the memory cell pOut. +// */ +func _sqlite3VdbeSorterRowkey(tls *libc.TLS, pCsr uintptr, pOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pKey, pSorter uintptr + var _ /* nKey at bp+0 */ int32 + _, _ = pKey, pSorter /* Sorter key to copy into pOut */ + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + pKey = _vdbeSorterRowkey(tls, pSorter, bp) + if _sqlite3VdbeMemClearAndResize(tls, pOut, *(*int32)(unsafe.Pointer(bp))) != 0 { + return int32(SQLITE_NOMEM) + } + (*TMem)(unsafe.Pointer(pOut)).Fn = *(*int32)(unsafe.Pointer(bp)) + (*TMem)(unsafe.Pointer(pOut)).Fflags = uint16(int32((*TMem)(unsafe.Pointer(pOut)).Fflags) & ^(libc.Int32FromInt32(MEM_TypeMask)|libc.Int32FromInt32(MEM_Zero)) | int32(MEM_Blob)) + libc.Xmemcpy(tls, (*TMem)(unsafe.Pointer(pOut)).Fz, pKey, uint64(*(*int32)(unsafe.Pointer(bp)))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Compare the key in memory cell pVal with the key that the sorter cursor +// ** passed as the first argument currently points to. For the purposes of +// ** the comparison, ignore the rowid field at the end of each record. +// ** +// ** If the sorter cursor key contains any NULL values, consider it to be +// ** less than pVal. Even if pVal also contains NULL values. +// ** +// ** If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM). +// ** Otherwise, set *pRes to a negative, zero or positive value if the +// ** key in pVal is smaller than, equal to or larger than the current sorter +// ** key. +// ** +// ** This routine forms the core of the OP_SorterCompare opcode, which in +// ** turn is used to verify uniqueness when constructing a UNIQUE INDEX. +// */ +func _sqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCol int32, pRes uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var pKey, pKeyInfo, pSorter, r2, v1 uintptr + var _ /* nKey at bp+0 */ int32 + _, _, _, _, _, _ = i, pKey, pKeyInfo, pSorter, r2, v1 /* Sorter key to compare pVal with */ + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 48)) + r2 = (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked + pKeyInfo = (*TVdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo + if r2 == uintptr(0) { + v1 = _sqlite3VdbeAllocUnpackedRecord(tls, pKeyInfo) + (*TVdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked = v1 + r2 = v1 + if r2 == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TUnpackedRecord)(unsafe.Pointer(r2)).FnField = uint16(nKeyCol) + } + pKey = _vdbeSorterRowkey(tls, pSorter, bp) + _sqlite3VdbeRecordUnpack(tls, pKeyInfo, *(*int32)(unsafe.Pointer(bp)), pKey, r2) + i = 0 + for { + if !(i < nKeyCol) { + break + } + if int32((*(*TMem)(unsafe.Pointer((*TUnpackedRecord)(unsafe.Pointer(r2)).FaMem + uintptr(i)*56))).Fflags)&int32(MEM_Null) != 0 { + *(*int32)(unsafe.Pointer(pRes)) = -int32(1) + return SQLITE_OK + } + goto _2 + _2: + ; + i++ + } + *(*int32)(unsafe.Pointer(pRes)) = _sqlite3VdbeRecordCompare(tls, (*TMem)(unsafe.Pointer(pVal)).Fn, (*TMem)(unsafe.Pointer(pVal)).Fz, r2) + return SQLITE_OK +} + +/************** End of vdbesort.c ********************************************/ +/************** Begin file vdbevtab.c ****************************************/ +/* +** 2020-03-23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file implements virtual-tables for examining the bytecode content +** of a prepared statement. + */ +/* #include "sqliteInt.h" */ + +/************** End of vdbevtab.c ********************************************/ +/************** Begin file memjournal.c **************************************/ +/* +** 2008 October 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code use to implement an in-memory rollback journal. +** The in-memory rollback journal is used to journal transactions for +** ":memory:" databases and when the journal_mode=MEMORY pragma is used. +** +** Update: The in-memory journal is also used to temporarily cache +** smaller journals that are not critical for power-loss recovery. +** For example, statement journals that are not too big will be held +** entirely in memory, thus reducing the number of file I/O calls, and +** more importantly, reducing temporary file creation events. If these +** journals become too large for memory, they are spilled to disk. But +** in the common case, they are usually small and no file I/O needs to +** occur. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* Forward references to internal structures */ +type TMemJournal = struct { + FpMethod uintptr + FnChunkSize int32 + FnSpill int32 + FpFirst uintptr + Fendpoint TFilePoint + Freadpoint TFilePoint + Fflags int32 + FpVfs uintptr + FzJournal uintptr +} + +type MemJournal = TMemJournal + +type TFilePoint = struct { + FiOffset Tsqlite3_int64 + FpChunk uintptr +} + +type FilePoint = TFilePoint + +type TFileChunk = struct { + FpNext uintptr + FzChunk [8]Tu8 +} + +type FileChunk = TFileChunk + +/* +** The rollback journal is composed of a linked list of these structures. +** +** The zChunk array is always at least 8 bytes in size - usually much more. +** Its actual size is stored in the MemJournal.nChunkSize variable. + */ +type TFileChunk1 = struct { + FpNext uintptr + FzChunk [8]Tu8 +} + +type FileChunk1 = TFileChunk1 + +/* +** By default, allocate this many bytes of memory for each FileChunk object. + */ + +/* +** For chunk size nChunkSize, return the number of bytes that should +** be allocated for each FileChunk structure. + */ + +/* +** An instance of this object serves as a cursor into the rollback journal. +** The cursor can be either for reading or writing. + */ +type TFilePoint1 = struct { + FiOffset Tsqlite3_int64 + FpChunk uintptr +} + +type FilePoint1 = TFilePoint1 + +/* +** This structure is a subclass of sqlite3_file. Each open memory-journal +** is an instance of this class. + */ +type TMemJournal1 = struct { + FpMethod uintptr + FnChunkSize int32 + FnSpill int32 + FpFirst uintptr + Fendpoint TFilePoint + Freadpoint TFilePoint + Fflags int32 + FpVfs uintptr + FzJournal uintptr +} + +type MemJournal1 = TMemJournal1 + +// C documentation +// +// /* +// ** Read data from the in-memory journal file. This is the implementation +// ** of the sqlite3_vfs.xRead method. +// */ +func _memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst Tsqlite_int64) (r int32) { + var iChunkOffset, iSpace, nCopy, nRead, v5 int32 + var iOff Tsqlite3_int64 + var p, pChunk, zOut, v2 uintptr + var v3 bool + var v6 int64 + _, _, _, _, _, _, _, _, _, _, _, _ = iChunkOffset, iOff, iSpace, nCopy, nRead, p, pChunk, zOut, v2, v3, v5, v6 + p = pJfd + zOut = zBuf + nRead = iAmt + if int64(iAmt)+iOfst > (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(2)<= 0; v3 { + v2 = (*TFileChunk)(unsafe.Pointer(pChunk)).FpNext + pChunk = v2 + } + if !(v3 && v2 != uintptr(0) && nRead > 0) { + break + } + } + if pChunk != 0 { + v6 = iOfst + int64(iAmt) + } else { + v6 = 0 + } + (*TMemJournal)(unsafe.Pointer(p)).Freadpoint.FiOffset = v6 + (*TMemJournal)(unsafe.Pointer(p)).Freadpoint.FpChunk = pChunk + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Free the list of FileChunk structures headed at MemJournal.pFirst. +// */ +func _memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { + var pIter, pNext uintptr + _, _ = pIter, pNext + pIter = pFirst + for { + if !(pIter != 0) { + break + } + pNext = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext + Xsqlite3_free(tls, pIter) + goto _1 + _1: + ; + pIter = pNext + } +} + +// C documentation +// +// /* +// ** Flush the contents of memory to a real file on disk. +// */ +func _memjrnlCreateFile(tls *libc.TLS, p uintptr) (r int32) { + var copy1 TMemJournal + var iOff Ti64 + var nChunk, rc int32 + var pIter, pReal uintptr + _, _, _, _, _, _ = copy1, iOff, nChunk, pIter, pReal, rc + pReal = p + copy1 = *(*TMemJournal)(unsafe.Pointer(p)) + libc.Xmemset(tls, p, 0, uint64(80)) + rc = _sqlite3OsOpen(tls, copy1.FpVfs, copy1.FzJournal, pReal, copy1.Fflags, uintptr(0)) + if rc == SQLITE_OK { + nChunk = copy1.FnChunkSize + iOff = 0 + pIter = copy1.FpFirst + for { + if !(pIter != 0) { + break + } + if iOff+int64(nChunk) > copy1.Fendpoint.FiOffset { + nChunk = int32(copy1.Fendpoint.FiOffset - iOff) + } + rc = _sqlite3OsWrite(tls, pReal, pIter+8, nChunk, iOff) + if rc != 0 { + break + } + iOff += int64(nChunk) + goto _1 + _1: + ; + pIter = (*TFileChunk)(unsafe.Pointer(pIter)).FpNext + } + if rc == SQLITE_OK { + /* No error has occurred. Free the in-memory buffers. */ + _memjrnlFreeChunks(tls, copy1.FpFirst) + } + } + if rc != SQLITE_OK { + /* If an error occurred while creating or writing to the file, restore + ** the original before returning. This way, SQLite uses the in-memory + ** journal data to roll back changes made to the internal page-cache + ** before this function was called. */ + _sqlite3OsClose(tls, pReal) + *(*TMemJournal)(unsafe.Pointer(p)) = copy1 + } + return rc +} + +// C documentation +// +// /* +// ** Write data to the file. +// */ +func _memjrnlWrite(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst Tsqlite_int64) (r int32) { + var iChunkOffset, iSpace, nWrite, rc, v1 int32 + var p, pChunk, pNew, zWrite, v2 uintptr + _, _, _, _, _, _, _, _, _, _ = iChunkOffset, iSpace, nWrite, p, pChunk, pNew, rc, zWrite, v1, v2 + p = pJfd + nWrite = iAmt + zWrite = zBuf + /* If the file should be created now, create it and write the new data + ** into the file on disk. */ + if (*TMemJournal)(unsafe.Pointer(p)).FnSpill > 0 && int64(iAmt)+iOfst > int64((*TMemJournal)(unsafe.Pointer(p)).FnSpill) { + rc = _memjrnlCreateFile(tls, p) + if rc == SQLITE_OK { + rc = _sqlite3OsWrite(tls, pJfd, zBuf, iAmt, iOfst) + } + return rc + } else { + /* An in-memory journal file should only ever be appended to. Random + ** access writes are not required. The only exception to this is when + ** the in-memory journal is being used by a connection using the + ** atomic-write optimization. In this case the first 28 bytes of the + ** journal file may be written as part of committing the transaction. */ + if iOfst > 0 && iOfst != (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { + _memjrnlTruncate(tls, pJfd, iOfst) + } + if iOfst == 0 && (*TMemJournal)(unsafe.Pointer(p)).FpFirst != 0 { + libc.Xmemcpy(tls, (*TMemJournal)(unsafe.Pointer(p)).FpFirst+8, zBuf, uint64(iAmt)) + } else { + for nWrite > 0 { + pChunk = (*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk + iChunkOffset = int32((*TMemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset % int64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize)) + if nWrite < (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize-iChunkOffset { + v1 = nWrite + } else { + v1 = (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset + } + iSpace = v1 + if iChunkOffset == 0 { + /* New chunk is required to extend the file. */ + pNew = Xsqlite3_malloc(tls, int32(libc.Uint64FromInt64(16)+uint64((*TMemJournal)(unsafe.Pointer(p)).FnChunkSize-libc.Int32FromInt32(8)))) + if !(pNew != 0) { + return libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(12)< 0 { + (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize = nSpill + } else { + (*TMemJournal)(unsafe.Pointer(p)).FnChunkSize = int32(uint64(libc.Int32FromInt32(8)+libc.Int32FromInt32(MEMJOURNAL_DFLT_FILECHUNKSIZE)) - libc.Uint64FromInt64(16)) + } + (*Tsqlite3_file)(unsafe.Pointer(pJfd)).FpMethods = uintptr(unsafe.Pointer(&_MemJournalMethods)) + (*TMemJournal)(unsafe.Pointer(p)).FnSpill = nSpill + (*TMemJournal)(unsafe.Pointer(p)).Fflags = flags + (*TMemJournal)(unsafe.Pointer(p)).FzJournal = zName + (*TMemJournal)(unsafe.Pointer(p)).FpVfs = pVfs + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Open an in-memory journal file. +// */ +func _sqlite3MemJournalOpen(tls *libc.TLS, pJfd uintptr) { + _sqlite3JournalOpen(tls, uintptr(0), uintptr(0), pJfd, 0, -int32(1)) +} + +// C documentation +// +// /* +// ** The file-handle passed as the only argument is open on a journal file. +// ** Return true if this "journal file" is currently stored in heap memory, +// ** or false otherwise. +// */ +func _sqlite3JournalIsInMemory(tls *libc.TLS, p uintptr) (r int32) { + return libc.BoolInt32((*Tsqlite3_file)(unsafe.Pointer(p)).FpMethods == uintptr(unsafe.Pointer(&_MemJournalMethods))) +} + +// C documentation +// +// /* +// ** Return the number of bytes required to store a JournalFile that uses vfs +// ** pVfs to create the underlying on-disk files. +// */ +func _sqlite3JournalSize(tls *libc.TLS, pVfs uintptr) (r int32) { + var v1 int32 + _ = v1 + if (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile > libc.Int32FromInt64(80) { + v1 = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile + } else { + v1 = libc.Int32FromInt64(80) + } + return v1 +} + +/************** End of memjournal.c ******************************************/ +/************** Begin file walker.c ******************************************/ +/* +** 2008 August 16 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains routines used for walking the parser tree for +** an SQL statement. + */ +/* #include "sqliteInt.h" */ +/* #include */ +/* #include */ + +// C documentation +// +// /* +// ** Walk all expressions linked into the list of Window objects passed +// ** as the second argument. +// */ +func _walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int32) (r int32) { + var pWin uintptr + var rc int32 + _, _ = pWin, rc + pWin = pList + for { + if !(pWin != 0) { + break + } + rc = _sqlite3WalkExprList(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy) + if rc != 0 { + return int32(WRC_Abort) + } + rc = _sqlite3WalkExprList(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpPartition) + if rc != 0 { + return int32(WRC_Abort) + } + rc = _sqlite3WalkExpr(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpFilter) + if rc != 0 { + return int32(WRC_Abort) + } + rc = _sqlite3WalkExpr(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpStart) + if rc != 0 { + return int32(WRC_Abort) + } + rc = _sqlite3WalkExpr(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpEnd) + if rc != 0 { + return int32(WRC_Abort) + } + if bOneOnly != 0 { + break + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Walk an expression tree. Invoke the callback once for each node +// ** of the expression, while descending. (In other words, the callback +// ** is invoked before visiting children.) +// ** +// ** The return value from the callback should be one of the WRC_* +// ** constants to specify how to proceed with the walk. +// ** +// ** WRC_Continue Continue descending down the tree. +// ** +// ** WRC_Prune Do not descend into child nodes, but allow +// ** the walk to continue with sibling nodes. +// ** +// ** WRC_Abort Do no more callbacks. Unwind the stack and +// ** return from the top-level walk call. +// ** +// ** The return value from this routine is WRC_Abort to abandon the tree walk +// ** and WRC_Continue to continue. +// */ +func _sqlite3WalkExprNN(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var rc int32 + _ = rc + for int32(1) != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TWalker)(unsafe.Pointer(pWalker)).FxExprCallback})))(tls, pWalker, pExpr) + if rc != 0 { + return rc & int32(WRC_Abort) + } + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 && _sqlite3WalkExprNN(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + return int32(WRC_Abort) + } + if (*TExpr)(unsafe.Pointer(pExpr)).FpRight != 0 { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + continue + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + if _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) != 0 { + return int32(WRC_Abort) + } + } else { + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 { + if _sqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) != 0 { + return int32(WRC_Abort) + } + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + if _walkWindowList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32(1)) != 0 { + return int32(WRC_Abort) + } + } + } + } + } + break + } + return WRC_Continue +} + +func _sqlite3WalkExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var v1 int32 + _ = v1 + if pExpr != 0 { + v1 = _sqlite3WalkExprNN(tls, pWalker, pExpr) + } else { + v1 = WRC_Continue + } + return v1 +} + +// C documentation +// +// /* +// ** Call sqlite3WalkExpr() for every expression in list p or until +// ** an abort request is seen. +// */ +func _sqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var i int32 + var pItem uintptr + _, _ = i, pItem + if p != 0 { + i = (*TExprList)(unsafe.Pointer(p)).FnExpr + pItem = p + 8 + for { + if !(i > 0) { + break + } + if _sqlite3WalkExpr(tls, pWalker, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) != 0 { + return int32(WRC_Abort) + } + goto _1 + _1: + ; + i-- + pItem += 32 + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** This is a no-op callback for Walker->xSelectCallback2. If this +// ** callback is set, then the Select->pWinDefn list is traversed. +// */ +func _sqlite3WalkWinDefnDummyCallback(tls *libc.TLS, pWalker uintptr, p uintptr) { + _ = pWalker + _ = p + /* No-op */ +} + +// C documentation +// +// /* +// ** Walk all expressions associated with SELECT statement p. Do +// ** not invoke the SELECT callback on p, but do (of course) invoke +// ** any expr callbacks and SELECT callbacks that come from subqueries. +// ** Return WRC_Abort or WRC_Continue. +// */ +func _sqlite3WalkSelectExpr(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var pParse, v1 uintptr + var rc int32 + var v2 bool + _, _, _, _ = pParse, rc, v1, v2 + if _sqlite3WalkExprList(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpEList) != 0 { + return int32(WRC_Abort) + } + if _sqlite3WalkExpr(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { + return int32(WRC_Abort) + } + if _sqlite3WalkExprList(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpGroupBy) != 0 { + return int32(WRC_Abort) + } + if _sqlite3WalkExpr(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { + return int32(WRC_Abort) + } + if _sqlite3WalkExprList(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) != 0 { + return int32(WRC_Abort) + } + if _sqlite3WalkExpr(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpLimit) != 0 { + return int32(WRC_Abort) + } + if (*TSelect)(unsafe.Pointer(p)).FpWinDefn != 0 { + if v2 = (*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback2 == __ccgo_fp(_sqlite3WalkWinDefnDummyCallback); !v2 { + v1 = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + pParse = v1 + } + if v2 || v1 != uintptr(0) && int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) || (*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback2 == __ccgo_fp(_sqlite3SelectPopWith) { + /* The following may return WRC_Abort if there are unresolvable + ** symbols (e.g. a table that does not exist) in a window definition. */ + rc = _walkWindowList(tls, pWalker, (*TSelect)(unsafe.Pointer(p)).FpWinDefn, 0) + return rc + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Walk the parse trees associated with all subqueries in the +// ** FROM clause of SELECT statement p. Do not invoke the select +// ** callback on p, but do invoke it on each FROM clause subquery +// ** and on any subqueries further down in the tree. Return +// ** WRC_Abort or WRC_Continue; +// */ +func _sqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var i int32 + var pItem, pSrc uintptr + _, _, _ = i, pItem, pSrc + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + if pSrc != 0 { + i = (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc + pItem = pSrc + 8 + for { + if !(i > 0) { + break + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 && _sqlite3WalkSelect(tls, pWalker, (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect) != 0 { + return int32(WRC_Abort) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x4>>2)) != 0 && _sqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pItem + 88))) != 0 { + return int32(WRC_Abort) + } + goto _1 + _1: + ; + i-- + pItem += 104 + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Call sqlite3WalkExpr() for every expression in Select statement p. +// ** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and +// ** on the compound select chain, p->pPrior. +// ** +// ** If it is not NULL, the xSelectCallback() callback is invoked before +// ** the walk of the expressions and FROM clause. The xSelectCallback2() +// ** method is invoked following the walk of the expressions and FROM clause, +// ** but only if both xSelectCallback and xSelectCallback2 are both non-NULL +// ** and if the expressions and FROM clause both return WRC_Continue; +// ** +// ** Return WRC_Continue under normal conditions. Return WRC_Abort if +// ** there is an abort request. +// ** +// ** If the Walker does not have an xSelectCallback() then this routine +// ** is a no-op returning WRC_Continue. +// */ +func _sqlite3WalkSelect(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var rc int32 + _ = rc + if p == uintptr(0) { + return WRC_Continue + } + if (*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback == uintptr(0) { + return WRC_Continue + } + for cond := true; cond; cond = p != uintptr(0) { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback})))(tls, pWalker, p) + if rc != 0 { + return rc & int32(WRC_Abort) + } + if _sqlite3WalkSelectExpr(tls, pWalker, p) != 0 || _sqlite3WalkSelectFrom(tls, pWalker, p) != 0 { + return int32(WRC_Abort) + } + if (*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback2 != 0 { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback2})))(tls, pWalker, p) + } + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + } + return WRC_Continue +} + +// C documentation +// +// /* Increase the walkerDepth when entering a subquery, and +// ** decrease when leaving the subquery. +// */ +func _sqlite3WalkerDepthIncrease(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) { + _ = pSelect + (*TWalker)(unsafe.Pointer(pWalker)).FwalkerDepth++ + return WRC_Continue +} + +func _sqlite3WalkerDepthDecrease(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { + _ = pSelect + (*TWalker)(unsafe.Pointer(pWalker)).FwalkerDepth-- +} + +// C documentation +// +// /* +// ** No-op routine for the parse-tree walker. +// ** +// ** When this routine is the Walker.xExprCallback then expression trees +// ** are walked without any actions being taken at each node. Presumably, +// ** when this routine is used for Walker.xExprCallback then +// ** Walker.xSelectCallback is set to do something useful for every +// ** subquery in the parser tree. +// */ +func _sqlite3ExprWalkNoop(tls *libc.TLS, NotUsed uintptr, NotUsed2 uintptr) (r int32) { + _ = NotUsed + _ = NotUsed2 + return WRC_Continue +} + +// C documentation +// +// /* +// ** No-op routine for the parse-tree walker for SELECT statements. +// ** subquery in the parser tree. +// */ +func _sqlite3SelectWalkNoop(tls *libc.TLS, NotUsed uintptr, NotUsed2 uintptr) (r int32) { + _ = NotUsed + _ = NotUsed2 + return WRC_Continue +} + +/************** End of walker.c **********************************************/ +/************** Begin file resolve.c *****************************************/ +/* +** 2008 August 18 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains routines used for walking the parser tree and +** resolve all identifiers by associating them with a particular +** table and column. + */ +/* #include "sqliteInt.h" */ + +/* +** Magic table number to mean the EXCLUDED table in an UPSERT statement. + */ + +// C documentation +// +// /* +// ** Walk the expression tree pExpr and increase the aggregate function +// ** depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node. +// ** This needs to occur when copying a TK_AGG_FUNCTION node from an +// ** outer query into an inner subquery. +// ** +// ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..) +// ** is a helper function - a callback for the tree walker. +// ** +// ** See also the sqlite3WindowExtraAggFuncDepth() routine in window.c +// */ +func _incrAggDepth(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var p1 uintptr + _ = p1 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) { + p1 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) + *(*int32)(unsafe.Pointer(&(*TWalker)(unsafe.Pointer(pWalker)).Fu))) + } + return WRC_Continue +} + +func _incrAggFunctionDepth(tls *libc.TLS, pExpr uintptr, N int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + if N > 0 { + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_incrAggDepth) + *(*int32)(unsafe.Pointer(bp + 40)) = N + _sqlite3WalkExpr(tls, bp, pExpr) + } +} + +// C documentation +// +// /* +// ** Turn the pExpr expression into an alias for the iCol-th column of the +// ** result set in pEList. +// ** +// ** If the reference is followed by a COLLATE operator, then make sure +// ** the COLLATE operator is preserved. For example: +// ** +// ** SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase; +// ** +// ** Should be transformed into: +// ** +// ** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase; +// ** +// ** The nSubquery parameter specifies how many levels of subquery the +// ** alias is removed from the original expression. The usual value is +// ** zero but it might be more if the alias is contained within a subquery +// ** of the original expression. The Expr.op2 field of TK_AGG_FUNCTION +// ** structures must be increased by the nSubquery amount. +// */ +func _resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pExpr uintptr, nSubquery int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var db, pDup, pOrig uintptr + var _ /* temp at bp+0 */ TExpr + _, _, _ = db, pDup, pOrig /* The database connection */ + pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(iCol)*32))).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != 0 { + return + } + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pDup = _sqlite3ExprDup(tls, db, pOrig, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db, pDup) + pDup = uintptr(0) + } else { + _incrAggFunctionDepth(tls, pDup, nSubquery) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pDup = _sqlite3ExprAddCollateString(tls, pParse, pDup, *(*uintptr)(unsafe.Pointer(pExpr + 8))) + } + libc.Xmemcpy(tls, bp, pDup, uint64(72)) + libc.Xmemcpy(tls, pDup, pExpr, uint64(72)) + libc.Xmemcpy(tls, pExpr, bp, uint64(72)) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + if *(*uintptr)(unsafe.Pointer(pExpr + 64)) != uintptr(0) { + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpOwner = pExpr + } + } + _sqlite3ExprDeferredDelete(tls, pParse, pDup) + } +} + +// C documentation +// +// /* +// ** Subqueries store the original database, table and column names for their +// ** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN", +// ** and mark the expression-list item by setting ExprList.a[].fg.eEName +// ** to ENAME_TAB. +// ** +// ** Check to see if the zSpan/eEName of the expression-list item passed to this +// ** routine matches the zDb, zTab, and zCol. If any of zDb, zTab, and zCol are +// ** NULL then those fields will match anything. Return true if there is a match, +// ** or false otherwise. +// ** +// ** SF_NestedFrom subqueries also store an entry for the implicit rowid (or +// ** _rowid_, or oid) column by setting ExprList.a[].fg.eEName to ENAME_ROWID, +// ** and setting zSpan to "DATABASE.TABLE.". This type of pItem +// ** argument matches if zCol is a rowid alias. If it is not NULL, (*pbRowid) +// ** is set to 1 if there is this kind of match. +// */ +func _sqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr, zDb uintptr, pbRowid uintptr) (r int32) { + var eEName, n int32 + var zSpan uintptr + _, _, _ = eEName, n, zSpan + eEName = int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 16 + 4)) & 0x3 >> 0)) + if eEName != int32(ENAME_TAB) && (eEName != int32(ENAME_ROWID) || pbRowid == uintptr(0)) { + return 0 + } + zSpan = (*TExprList_item)(unsafe.Pointer(pItem)).FzEName + n = 0 + for { + if !(*(*int8)(unsafe.Pointer(zSpan + uintptr(n))) != 0 && int32(*(*int8)(unsafe.Pointer(zSpan + uintptr(n)))) != int32('.')) { + break + } + goto _1 + _1: + ; + n++ + } + if zDb != 0 && (Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0 || int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0) { + return 0 + } + zSpan += uintptr(n + int32(1)) + n = 0 + for { + if !(*(*int8)(unsafe.Pointer(zSpan + uintptr(n))) != 0 && int32(*(*int8)(unsafe.Pointer(zSpan + uintptr(n)))) != int32('.')) { + break + } + goto _2 + _2: + ; + n++ + } + if zTab != 0 && (Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0 || int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0) { + return 0 + } + zSpan += uintptr(n + int32(1)) + if zCol != 0 { + if eEName == int32(ENAME_TAB) && _sqlite3StrICmp(tls, zSpan, zCol) != 0 { + return 0 + } + if eEName == int32(ENAME_ROWID) && _sqlite3IsRowid(tls, zCol) == 0 { + return 0 + } + } + if eEName == int32(ENAME_ROWID) { + *(*int32)(unsafe.Pointer(pbRowid)) = int32(1) + } + return int32(1) +} + +// C documentation +// +// /* +// ** Return TRUE if the double-quoted string mis-feature should be supported. +// */ +func _areDoubleQuotedStringsEnabled(tls *libc.TLS, db uintptr, pTopNC uintptr) (r int32) { + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + return int32(1) + } /* Always support for legacy schemas */ + if (*TNameContext)(unsafe.Pointer(pTopNC)).FncFlags&int32(NC_IsDDL) != 0 { + /* Currently parsing a DDL statement */ + if _sqlite3WritableSchema(tls, db) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DqsDML) != uint64(0) { + return int32(1) + } + return libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DqsDDL) != uint64(0)) + } else { + /* Currently parsing a DML statement */ + return libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DqsDML) != uint64(0)) + } + return r +} + +// C documentation +// +// /* +// ** The argument is guaranteed to be a non-NULL Expr node of type TK_COLUMN. +// ** return the appropriate colUsed mask. +// */ +func _sqlite3ExprColUsed(tls *libc.TLS, pExpr uintptr) (r TBitmask) { + var n int32 + var pExTab uintptr + var v1 uint64 + _, _, _ = n, pExTab, v1 + n = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + pExTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + if (*TTable)(unsafe.Pointer(pExTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pExTab)).FaCol + uintptr(n)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + if int32((*TTable)(unsafe.Pointer(pExTab)).FnCol) >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v1 = uint64(-libc.Int32FromInt32(1)) + } else { + v1 = libc.Uint64FromInt32(1)<<(*TTable)(unsafe.Pointer(pExTab)).FnCol - uint64(1) + } + return v1 + } else { + if n >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + n = int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1) + } + return libc.Uint64FromInt32(1) << n + } + return r +} + +// C documentation +// +// /* +// ** Create a new expression term for the column specified by pMatch and +// ** iColumn. Append this new expression term to the FULL JOIN Match set +// ** in *ppList. Create a new *ppList if this is the first term in the +// ** set. +// */ +func _extendFJMatch(tls *libc.TLS, pParse uintptr, ppList uintptr, pMatch uintptr, iColumn Ti16) { + var pNew uintptr + _ = pNew + pNew = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) + if pNew != 0 { + (*TExpr)(unsafe.Pointer(pNew)).FiTable = (*TSrcItem)(unsafe.Pointer(pMatch)).FiCursor + (*TExpr)(unsafe.Pointer(pNew)).FiColumn = iColumn + *(*uintptr)(unsafe.Pointer(pNew + 64)) = (*TSrcItem)(unsafe.Pointer(pMatch)).FpTab + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_CanBeNull)) + *(*uintptr)(unsafe.Pointer(ppList)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(ppList)), pNew) + } +} + +// C documentation +// +// /* +// ** Return TRUE (non-zero) if zTab is a valid name for the schema table pTab. +// */ +func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, pSchema uintptr) (r int32) { + var zLegacy uintptr + _ = zLegacy + if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6557, int32(7)) != 0 { + return 0 + } + zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName + if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6565+7) == 0 { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6584+7) == 0 { + return int32(1) + } + if pSchema == uintptr(0) { + return 0 + } + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6098+7) == 0 { + return int32(1) + } + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6603+7) == 0 { + return int32(1) + } + } else { + if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6603+7) == 0 { + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up +// ** that name in the set of source tables in pSrcList and make the pExpr +// ** expression node refer back to that source column. The following changes +// ** are made to pExpr: +// ** +// ** pExpr->iDb Set the index in db->aDb[] of the database X +// ** (even if X is implied). +// ** pExpr->iTable Set to the cursor number for the table obtained +// ** from pSrcList. +// ** pExpr->y.pTab Points to the Table structure of X.Y (even if +// ** X and/or Y are implied.) +// ** pExpr->iColumn Set to the column number within the table. +// ** pExpr->op Set to TK_COLUMN. +// ** pExpr->pLeft Any expression this points to is deleted +// ** pExpr->pRight Any expression this points to is deleted. +// ** +// ** The zDb variable is the name of the database (the "X"). This value may be +// ** NULL meaning that name is of the form Y.Z or Z. Any available database +// ** can be used. The zTable variable is the name of the table (the "Y"). This +// ** value can be NULL if zDb is also NULL. If zTable is NULL it +// ** means that the form of the name is Z and that columns from any table +// ** can be used. +// ** +// ** If the name cannot be resolved unambiguously, leave an error message +// ** in pParse and return WRC_Abort. Return WRC_Prune on success. +// */ +func _lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol uintptr, pNC uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var cnt, cntTab, eNewExprOp, hit, i, iCol, j, nSubquery, op, v5 int32 + var db, pCol, pEList, pItem, pMatch, pOrig, pSchema, pSrcList, pTab, pTopNC, pUpsert, zAs, zErr, v10 uintptr + var hCol, hCol1 Tu8 + var v7, v8 uint32 + var _ /* bRowid at bp+8 */ int32 + var _ /* pFJMatch at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cnt, cntTab, db, eNewExprOp, hCol, hCol1, hit, i, iCol, j, nSubquery, op, pCol, pEList, pItem, pMatch, pOrig, pSchema, pSrcList, pTab, pTopNC, pUpsert, zAs, zErr, v10, v5, v7, v8 /* Loop counters */ + cnt = 0 /* Number of matching column names */ + cntTab = 0 /* Number of potential "rowid" matches */ + nSubquery = 0 /* How many levels of subquery */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Use for looping over pSrcList items */ + pMatch = uintptr(0) /* The matching pSrcList item */ + pTopNC = pNC /* First namecontext in the list */ + pSchema = uintptr(0) /* Schema of the expression */ + eNewExprOp = int32(TK_COLUMN) /* New value for pExpr->op on success */ + pTab = uintptr(0) /* A column of pTab */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Matches for FULL JOIN .. USING */ + /* the name context cannot be NULL. */ + /* The Z in X.Y.Z cannot be NULL */ + /* Initialize the node to no-match */ + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = -int32(1) + /* Translate the schema name in zDb into a pointer to the corresponding + ** schema. If not found, pSchema will remain NULL and nothing will match + ** resulting in an appropriate error message toward the end of this routine + */ + if zDb != 0 { + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IsCheck)) != 0 { + /* Silently ignore database qualifiers inside CHECK constraints and + ** partial indices. Do not raise errors because that might break + ** legacy and because it does not hurt anything to just ignore the + ** database name. */ + zDb = uintptr(0) + } else { + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if _sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FzDbSName, zDb) == 0 { + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema + break + } + goto _1 + _1: + ; + i++ + } + if i == (*Tsqlite3)(unsafe.Pointer(db)).FnDb && _sqlite3StrICmp(tls, __ccgo_ts+6617, zDb) == 0 { + /* This branch is taken when the main database has been renamed + ** using SQLITE_DBCONFIG_MAINDBNAME. */ + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName + } + } + } + /* Start at the inner-most context and move outward until a match is found */ + for cond := true; cond; cond = pNC != 0 { + pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList + if pSrcList != 0 { + i = 0 + pItem = pSrcList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc) { + break + } + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2000>>13)) != 0 { + /* In this case, pItem is a subquery that has been formed from a + ** parenthesized subset of the FROM clause terms. Example: + ** .... FROM t1 LEFT JOIN (t2 RIGHT JOIN t3 USING(x)) USING(y) ... + ** \_________________________/ + ** This pItem -------------^ + */ + hit = 0 + pEList = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpEList + j = 0 + for { + if !(j < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* True if possible rowid match */ + if !(_sqlite3MatchEName(tls, pEList+8+uintptr(j)*32, zCol, zTab, zDb, bp+8) != 0) { + goto _3 + } + if *(*int32)(unsafe.Pointer(bp + 8)) == 0 { + if cnt > 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pItem + 72)), zCol) < 0 { + /* Two or more tables have the same column name which is + ** not joined by USING. This is an error. Signal as much + ** by clearing pFJMatch and letting cnt go above 1. */ + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_RIGHT) == 0 { + /* An INNER or LEFT JOIN. Use the left-most table */ + goto _3 + } else { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) == 0 { + /* A RIGHT JOIN. Use the right-most table */ + cnt = 0 + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + /* For a FULL JOIN, we must construct a coalesce() func */ + _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + } + } + } + } + cnt++ + hit = int32(1) + } else { + if cnt > 0 { + /* This is a potential rowid match, but there has already been + ** a real match found. So this can be ignored. */ + goto _3 + } + } + cntTab++ + pMatch = pItem + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(j) + libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(j)*32+16+4, libc.Uint32FromInt32(1), 6, 0x40) + /* rowid cannot be part of a USING clause - assert() this. */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x80>>7)) != 0 { + break + } + goto _3 + _3: + ; + j++ + } + if hit != 0 || zTab == uintptr(0) { + goto _2 + } + } + if zTab != 0 { + if zDb != 0 { + if (*TTable)(unsafe.Pointer(pTab)).FpSchema != pSchema { + goto _2 + } + if pSchema == uintptr(0) && libc.Xstrcmp(tls, zDb, __ccgo_ts+6622) != 0 { + goto _2 + } + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != uintptr(0) { + if _sqlite3StrICmp(tls, zTab, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) != 0 { + goto _2 + } + } else { + if _sqlite3StrICmp(tls, zTab, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + if (*TTable)(unsafe.Pointer(pTab)).Ftnum != uint32(1) { + goto _2 + } + if !(_isValidSchemaTableName(tls, zTab, pTab, pSchema) != 0) { + goto _2 + } + } + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr+64) + } + } + hCol = _sqlite3StrIHash(tls, zCol) + j = 0 + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + for { + if !(j < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FhName) == int32(hCol) && _sqlite3StrICmp(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, zCol) == 0 { + if cnt > 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pItem + 72)), zCol) < 0 { + /* Two or more tables have the same column name which is + ** not joined by USING. This is an error. Signal as much + ** by clearing pFJMatch and letting cnt go above 1. */ + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_RIGHT) == 0 { + /* An INNER or LEFT JOIN. Use the left-most table */ + goto _4 + } else { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) == 0 { + /* A RIGHT JOIN. Use the right-most table */ + cnt = 0 + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } else { + /* For a FULL JOIN, we must construct a coalesce() func */ + _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + } + } + } + } + cnt++ + pMatch = pItem + /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ + if j == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + v5 = -int32(1) + } else { + v5 = int32(int16(j)) + } + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(v5) + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2000>>13)) != 0 { + _sqlite3SrcItemColumnUsed(tls, pItem, j) + } + break + } + goto _4 + _4: + ; + j++ + pCol += 16 + } + if 0 == cnt && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ + cntTab++ + pMatch = pItem + } + goto _2 + _2: + ; + i++ + pItem += 104 + } + if pMatch != 0 { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TSrcItem)(unsafe.Pointer(pMatch)).FiCursor + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = (*TSrcItem)(unsafe.Pointer(pMatch)).FpTab + if int32((*TSrcItem)(unsafe.Pointer(pMatch)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) != 0 { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_CanBeNull)) + } + pSchema = (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpSchema + } + } /* if( pSrcList ) */ + /* If we have not already resolved the name, then maybe + ** it is a new.* or old.* trigger argument reference. Or + ** maybe it is an excluded.* from an upsert. Or maybe it is + ** a reference in the RETURNING clause to a table being modified. + */ + if cnt == 0 && zDb == uintptr(0) { + pTab = uintptr(0) + if (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != uintptr(0) { + op = int32((*TParse)(unsafe.Pointer(pParse)).FeTriggerOp) + if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UBaseReg) != 0 && (zTab == uintptr(0) || _sqlite3StrICmp(tls, zTab, (*TTable)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab)).FzName) == 0) { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = libc.BoolInt32(op != int32(TK_DELETE)) + pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab + } + } else { + if op != int32(TK_DELETE) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6624, zTab) == 0 { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(1) + pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab + } else { + if op != int32(TK_INSERT) && zTab != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6628, zTab) == 0 { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = 0 + pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab + } + } + } + } + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UUpsert) != 0 && zTab != uintptr(0) { + pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16)) + if pUpsert != 0 && _sqlite3StrICmp(tls, __ccgo_ts+6632, zTab) == 0 { + pTab = (*(*TSrcItem)(unsafe.Pointer((*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8))).FpTab + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = int32(EXCLUDED_TABLE_NUMBER) + } + } + if pTab != 0 { + hCol1 = _sqlite3StrIHash(tls, zCol) + pSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + cntTab++ + iCol = 0 + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FhName) == int32(hCol1) && _sqlite3StrICmp(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, zCol) == 0 { + if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + iCol = -int32(1) + } + break + } + goto _6 + _6: + ; + iCol++ + pCol += 16 + } + if iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) && _sqlite3IsRowid(tls, zCol) != 0 && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) { + /* IMP: R-51414-32910 */ + iCol = -int32(1) + } + if iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + cnt++ + pMatch = uintptr(0) + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == int32(EXCLUDED_TABLE_NUMBER) { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(iCol) + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab + eNewExprOp = int32(TK_COLUMN) + } else { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TUpsert)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNC + 16)))).FregData + int32(_sqlite3TableColumnToStorage(tls, pTab, int16(iCol))) + eNewExprOp = int32(TK_REGISTER) + } + } else { + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab + if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { + eNewExprOp = int32(TK_REGISTER) + (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = uint8(TK_COLUMN) + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(iCol) + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = *(*int32)(unsafe.Pointer(&(*TNameContext)(unsafe.Pointer(pNC)).FuNC)) + (int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+int32(1))*(*TExpr)(unsafe.Pointer(pExpr)).FiTable + int32(_sqlite3TableColumnToStorage(tls, pTab, int16(iCol))) + int32(1) + } else { + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(iCol) + eNewExprOp = int32(TK_TRIGGER) + if iCol < 0 { + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == 0 { + if iCol >= int32(32) { + v7 = uint32(0xffffffff) + } else { + v7 = libc.Uint32FromInt32(1) << iCol + } + *(*Tu32)(unsafe.Pointer(pParse + 216)) |= v7 + } else { + if iCol >= int32(32) { + v8 = uint32(0xffffffff) + } else { + v8 = libc.Uint32FromInt32(1) << iCol + } + *(*Tu32)(unsafe.Pointer(pParse + 220)) |= v8 + } + } + } + } + } + } + } + /* + ** Perhaps the name is a reference to the ROWID + */ + if cnt == 0 && cntTab >= int32(1) && pMatch != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) == 0 && _sqlite3IsRowid(tls, zCol) != 0 && ((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pMatch)).FpTab)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) != 0) { + cnt = cntTab + if int32(uint32(*(*uint16)(unsafe.Pointer(pMatch + 60 + 4))&0x2000>>13)) == 0 { + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(-int32(1)) + } + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + } + /* + ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z + ** might refer to an result-set alias. This happens, for example, when + ** we are resolving names in the WHERE clause of the following command: + ** + ** SELECT a+b AS x FROM table WHERE x<10; + ** + ** In cases like this, replace pExpr with a copy of the expression that + ** forms the result set entry ("a+b" in the example) and return immediately. + ** Note that the expression in the result set should have already been + ** resolved by the time the WHERE clause is resolved. + ** + ** The ability to use an output result-set column in the WHERE, GROUP BY, + ** or HAVING clauses, or as part of a larger expression in the ORDER BY + ** clause is not standard SQL. This is a (goofy) SQLite extension, that + ** is supported for backwards compatibility only. Hence, we issue a warning + ** on sqlite3_log() whenever the capability is used. + */ + if cnt == 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_UEList) != 0 && zTab == uintptr(0) { + pEList = *(*uintptr)(unsafe.Pointer(pNC + 16)) + j = 0 + for { + if !(j < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + zAs = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FzEName + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, zAs, zCol) == 0 { + pOrig = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(j)*32))).FpExpr + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 && (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6641, libc.VaList(bp+24, zAs)) + return int32(WRC_Abort) + } + if (*TExpr)(unsafe.Pointer(pOrig)).Fflags&uint32(libc.Int32FromInt32(EP_Win)) != uint32(0) && ((*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 || pNC != pTopNC) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6672, libc.VaList(bp+24, zAs)) + return int32(WRC_Abort) + } + if _sqlite3ExprVectorSize(tls, pOrig) != int32(1) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6709, 0) + return int32(WRC_Abort) + } + _resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) + cnt = int32(1) + pMatch = uintptr(0) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr) + } + goto lookupname_end + } + goto _9 + _9: + ; + j++ + } + } + /* Advance to the next name context. The loop will exit when either + ** we have a match (cnt>0) or when we run out of name contexts. + */ + if cnt != 0 { + break + } + pNC = (*TNameContext)(unsafe.Pointer(pNC)).FpNext + nSubquery++ + } + /* + ** If X and Y are NULL (in other words if only the column name Z is + ** supplied) and the value of Z is enclosed in double-quotes, then + ** Z is a string literal if it doesn't match any column names. In that + ** case, we need to return right away and not make any changes to + ** pExpr. + ** + ** Because no reference was made to outer contexts, the pNC->nRef + ** fields are not changed in any context. + */ + if cnt == 0 && zTab == uintptr(0) { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_DblQuoted)) != uint32(0) && _areDoubleQuotedStringsEnabled(tls, db, pTopNC) != 0 { + /* If a double-quoted identifier does not match any known column name, + ** then treat it as a string. + ** + ** This hack was added in the early days of SQLite in a misguided attempt + ** to be compatible with MySQL 3.x, which used double-quotes for strings. + ** I now sorely regret putting in this hack. The effect of this hack is + ** that misspelled identifier names are silently converted into strings + ** rather than causing an error, to the frustration of countless + ** programmers. To all those frustrated programmers, my apologies. + ** + ** Someday, I hope to get rid of this hack. Unfortunately there is + ** a huge amount of legacy SQL that uses it. So for now, we just + ** issue a warning. + */ + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+6727, libc.VaList(bp+24, zCol)) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) + libc.Xmemset(tls, pExpr+64, 0, uint64(8)) + return int32(WRC_Prune) + } + if _sqlite3ExprIdToTrueFalse(tls, pExpr) != 0 { + return int32(WRC_Prune) + } + } + /* + ** cnt==0 means there was not match. + ** cnt>1 means there were two or more matches. + ** + ** cnt==0 is always an error. cnt>1 is often an error, but might + ** be multiple matches for a NATURAL LEFT JOIN or a LEFT JOIN USING. + */ + if cnt != int32(1) { + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + if (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExpr == cnt-int32(1) { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Leaf)) != uint32(0) { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Leaf)) + } else { + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + (*TExpr)(unsafe.Pointer(pExpr)).FpRight = uintptr(0) + } + _extendFJMatch(tls, pParse, bp, pMatch, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_FUNCTION) + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 6762 + *(*uintptr)(unsafe.Pointer(pExpr + 32)) = *(*uintptr)(unsafe.Pointer(bp)) + cnt = int32(1) + goto lookupname_end + } else { + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + } + if cnt == 0 { + v10 = __ccgo_ts + 6771 + } else { + v10 = __ccgo_ts + 6786 + } + zErr = v10 + if zDb != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6808, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + } else { + if zTab != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6821, libc.VaList(bp+24, zErr, zTab, zCol)) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6831, libc.VaList(bp+24, zErr, zCol)) + } + } + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + (*TNameContext)(unsafe.Pointer(pTopNC)).FnNcErr++ + eNewExprOp = int32(TK_NULL) + } + /* Remove all substructure from pExpr */ + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + (*TExpr)(unsafe.Pointer(pExpr)).FpRight = uintptr(0) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Leaf)) + } + /* If a column from a table in pSrcList is referenced, then record + ** this fact in the pSrcList.a[].colUsed bitmask. Column 0 causes + ** bit 0 to be set. Column 1 sets bit 1. And so forth. Bit 63 is + ** set if the 63rd or any subsequent column is used. + ** + ** The colUsed mask is an optimization used to help determine if an + ** index is a covering index. The correct answer is still obtained + ** if the mask contains extra set bits. However, it is important to + ** avoid setting bits beyond the maximum column number of the table. + ** (See ticket [b92e5e8ec2cdbaa1]). + ** + ** If a generated column is referenced, set bits for every column + ** of the table. + */ + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 && cnt == int32(1) && pMatch != uintptr(0) { + *(*TBitmask)(unsafe.Pointer(pMatch + 80)) |= _sqlite3ExprColUsed(tls, pExpr) + } + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(eNewExprOp) +lookupname_end: + ; + if cnt == int32(1) { + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0 && (int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER)) { + _sqlite3AuthRead(tls, pParse, pExpr, pSchema, (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList) + } + /* Increment the nRef value on all name contexts from TopNC up to + ** the point where the name matched. */ + for { + (*TNameContext)(unsafe.Pointer(pTopNC)).FnRef++ + if pTopNC == pNC { + break + } + pTopNC = (*TNameContext)(unsafe.Pointer(pTopNC)).FpNext + goto _11 + _11: + } + return int32(WRC_Prune) + } else { + return int32(WRC_Abort) + } + return r +} + +// C documentation +// +// /* +// ** Allocate and return a pointer to an expression to load the column iCol +// ** from datasource iSrc in SrcList pSrc. +// */ +func _sqlite3CreateColumnExpr(tls *libc.TLS, db uintptr, pSrc uintptr, iSrc int32, iCol int32) (r uintptr) { + var p, pItem, pTab, v1 uintptr + var v2 uint64 + var v3 int32 + _, _, _, _, _, _ = p, pItem, pTab, v1, v2, v3 + p = _sqlite3ExprAlloc(tls, db, int32(TK_COLUMN), uintptr(0), 0) + if p != 0 { + pItem = pSrc + 8 + uintptr(iSrc)*104 + v1 = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + *(*uintptr)(unsafe.Pointer(p + 64)) = v1 + pTab = v1 + (*TExpr)(unsafe.Pointer(p)).FiTable = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + if int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FiPKey) == iCol { + (*TExpr)(unsafe.Pointer(p)).FiColumn = int16(-int32(1)) + } else { + (*TExpr)(unsafe.Pointer(p)).FiColumn = int16(iCol) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) >= int32(64) { + v2 = uint64(-libc.Int32FromInt32(1)) + } else { + v2 = libc.Uint64FromInt32(1)<<(*TTable)(unsafe.Pointer(pTab)).FnCol - uint64(1) + } + (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed = v2 + } else { + if iCol >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v3 = int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1) + } else { + v3 = iCol + } + *(*TBitmask)(unsafe.Pointer(pItem + 80)) |= libc.Uint64FromInt32(1) << v3 + } + } + } + return p +} + +// C documentation +// +// /* +// ** Report an error that an expression is not valid for some set of +// ** pNC->ncFlags values determined by validMask. +// ** +// ** static void notValid( +// ** Parse *pParse, // Leave error message here +// ** NameContext *pNC, // The name context +// ** const char *zMsg, // Type of error +// ** int validMask, // Set of contexts for which prohibited +// ** Expr *pExpr // Invalidate this expression on error +// ** ){...} +// ** +// ** As an optimization, since the conditional is almost always false +// ** (because errors are rare), the conditional is moved outside of the +// ** function call using a macro. +// */ +func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExpr uintptr, pError uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var zIn uintptr + _ = zIn + zIn = __ccgo_ts + 6838 + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { + zIn = __ccgo_ts + 6866 + } else { + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { + zIn = __ccgo_ts + 6884 + } else { + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { + zIn = __ccgo_ts + 6902 + } + } + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6920, libc.VaList(bp+8, zMsg, zIn)) + if pExpr != 0 { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) + } + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) +} + +// C documentation +// +// /* +// ** Expression p should encode a floating point value between 1.0 and 0.0. +// ** Return 1024 times this value. Or return -1 if p is not a floating point +// ** value between 1.0 and 0.0. +// */ +func _exprProbability(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* r at bp+0 */ float64 + *(*float64)(unsafe.Pointer(bp)) = -libc.Float64FromFloat64(1) + if int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_FLOAT) { + return -int32(1) + } + _sqlite3AtoF(tls, *(*uintptr)(unsafe.Pointer(p + 8)), bp, _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(p + 8))), uint8(SQLITE_UTF8)) + if *(*float64)(unsafe.Pointer(bp)) > float64(1) { + return -int32(1) + } + return int32(*(*float64)(unsafe.Pointer(bp)) * libc.Float64FromFloat64(1.34217728e+08)) +} + +// C documentation +// +// /* +// ** This routine is callback for sqlite3WalkExpr(). +// ** +// ** Resolve symbolic names into TK_COLUMN operators for the current +// ** node in the expression tree. Return 0 to continue the search down +// ** the tree or 2 to abort the tree walk. +// ** +// ** This routine also does error checking and name resolution for +// ** function names. The operator for aggregate functions is changed +// ** to TK_AGG_FUNCTION. +// */ +func _resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var anRef [8]int32 + var auth, i, is_agg, n, nLeft, nRef, nRight, no_such_func, rc, savedAllowFlags, wrong_num_args, v12, v4, v6, v7 int32 + var enc Tu8 + var p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, zColumn, zDb, zId, zTable, zType, v5, v8, p10, p11, p9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = anRef, auth, enc, i, is_agg, n, nLeft, nRef, nRight, no_such_func, p, pDef, pItem, pLeft, pList, pNC, pNC2, pParse, pRight, pRight1, pSel, pSrcList, pWin, rc, savedAllowFlags, wrong_num_args, zColumn, zDb, zId, zTable, zType, v12, v4, v5, v6, v7, v8, p10, p11, p9 + pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + /* The special operator TK_ROW means use the rowid for the first + ** column in the FROM clause. This is used by the LIMIT and ORDER BY + ** clause processing on UPDATE and DELETE statements, and by + ** UPDATE ... FROM statement processing. + */ + case int32(TK_ROW): + pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList + pItem = pSrcList + 8 + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_COLUMN) + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn-- + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + break + /* An optimization: Attempt to convert + ** + ** "expr IS NOT NULL" --> "TRUE" + ** "expr IS NULL" --> "FALSE" + ** + ** if we can prove that "expr" is never NULL. Call this the + ** "NOT NULL strength reduction optimization". + ** + ** If this optimization occurs, also restore the NameContext ref-counts + ** to the state they where in before the "column" LHS expression was + ** resolved. This prevents "column" from being counted as having been + ** referenced, which might prevent a SELECT from being erroneously + ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. + */ + fallthrough + case int32(TK_NOTNULL): + fallthrough + case int32(TK_ISNULL): + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break + } + anRef[i] = (*TNameContext)(unsafe.Pointer(p)).FnRef + goto _1 + _1: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return int32(WRC_Prune) + } + if _sqlite3ExprCanBeNull(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + /* The expression can be NULL. So the optimization does not apply */ + return int32(WRC_Prune) + } + i = 0 + p = pNC + for { + if !(p != 0) { + break + } + if (*TNameContext)(unsafe.Pointer(p)).FncFlags&int32(NC_Where) == 0 { + return int32(WRC_Prune) /* Not in a WHERE clause. Unsafe to optimize. */ + } + goto _2 + _2: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(EP_IntValue) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + i = 0 + p = pNC + for { + if !(p != 0 && i < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4))) { + break + } + (*TNameContext)(unsafe.Pointer(p)).FnRef = anRef[i] + goto _3 + _3: + ; + p = (*TNameContext)(unsafe.Pointer(p)).FpNext + i++ + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + return int32(WRC_Prune) + /* A column name: ID + ** Or table name and column name: ID.ID + ** Or a database, table and column: ID.ID.ID + ** + ** The TK_ID and TK_OUT cases are combined so that there will only + ** be one call to lookupName(). Then the compiler will in-line + ** lookupName() for a size reduction and performance increase. + */ + fallthrough + case int32(TK_ID): + fallthrough + case int32(TK_DOT): + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_ID) { + zDb = uintptr(0) + zTable = uintptr(0) + zColumn = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + } else { + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { + _notValidImpl(tls, pParse, pNC, __ccgo_ts+6940, uintptr(0), pExpr) + } + pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_ID) { + zDb = uintptr(0) + } else { + zDb = *(*uintptr)(unsafe.Pointer(pLeft + 8)) + pLeft = (*TExpr)(unsafe.Pointer(pRight)).FpLeft + pRight = (*TExpr)(unsafe.Pointer(pRight)).FpRight + } + zTable = *(*uintptr)(unsafe.Pointer(pLeft + 8)) + zColumn = *(*uintptr)(unsafe.Pointer(pRight + 8)) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, pExpr, pRight) + _sqlite3RenameTokenRemap(tls, pParse, pExpr+64, pLeft) + } + } + return _lookupName(tls, pParse, zDb, zTable, zColumn, pNC, pExpr) + /* Resolve function names + */ + fallthrough + case int32(TK_FUNCTION): + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + if pList != 0 { + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } else { + v4 = 0 + } /* The argument list */ + n = v4 /* Number of arguments */ + no_such_func = 0 /* True if no such function exists */ + wrong_num_args = 0 /* True if wrong number of arguments */ + is_agg = 0 /* Information about the function */ + enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc /* The database encoding */ + savedAllowFlags = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin)) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { + v5 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + } else { + v5 = uintptr(0) + } + pWin = v5 + zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) + if pDef == uintptr(0) { + pDef = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zId, -int32(2), enc, uint8(0)) + if pDef == uintptr(0) { + no_such_func = int32(1) + } else { + wrong_num_args = int32(1) + } + } else { + is_agg = libc.BoolInt32((*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0)) + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_UNLIKELY) != 0 { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Unlikely)) + if n == int32(2) { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = _exprProbability(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr) + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable < 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6957, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + } else { + /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is + ** equivalent to likelihood(X, 0.0625). + ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is + ** short-hand for likelihood(X,0.0625). + ** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand + ** for likelihood(X,0.9375). + ** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent + ** to likelihood(X,0.9375). */ + /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ + if int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer(pDef)).FzName))) == int32('u') { + v6 = int32(8388608) + } else { + v6 = int32(125829120) + } + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v6 + } + } + auth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_FUNCTION), uintptr(0), (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) + if auth != SQLITE_OK { + if auth == int32(SQLITE_DENY) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7021, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) + return int32(WRC_Prune) + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)|libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG)) != 0 { + /* For the purposes of the EP_ConstFunc flag, date and time + ** functions and other functions that change slowly are considered + ** constant because they are constant for the duration of one query. + ** This allows them to be factored out of inner loops. */ + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_ConstFunc)) + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_CONSTANT) == uint32(0) { + /* Clearly non-deterministic functions like random(), but also + ** date/time functions that use 'now', and other functions like + ** sqlite_version() that might change over time cannot be used + ** in an index or generated column. Curiously, they can be used + ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all + ** all this. */ + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_GenCol)) != 0 { + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7057, uintptr(0), pExpr) + } + } else { + /* Must fit in 8 bits */ + (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = uint8((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & int32(NC_SelfRef)) + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_FromDDL) != 0 { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FromDDL)) + } + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INTERNAL) != uint32(0) && int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmDbFlags&uint32(DBFLAG_InternalFunc) == uint32(0) { + /* Internal-use-only functions are disallowed unless the + ** SQL is being compiled using sqlite3NestedParse() or + ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be + ** used to activate internal functions for testing purposes */ + no_such_func = int32(1) + pDef = uintptr(0) + } else { + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_DIRECT)|libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + _sqlite3ExprFunctionUsable(tls, pParse, pExpr, pDef) + } + } + } + if 0 == libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) { + if pDef != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0) && pWin != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7085, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else { + if is_agg != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowAgg) == 0 || is_agg != 0 && (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 && !(pWin != 0) || is_agg != 0 && pWin != 0 && (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_AllowWin) == 0 { + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 || pWin != 0 { + zType = __ccgo_ts + 7128 + } else { + zType = __ccgo_ts + 7135 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7145, libc.VaList(bp+8, zType, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + is_agg = 0 + } else { + if no_such_func != 0 && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7173, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else { + if wrong_num_args != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7195, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else { + if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7239, libc.VaList(bp+8, pExpr)) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else { + if is_agg == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { + _sqlite3ExprOrderByAggregateError(tls, pParse, pExpr) + (*TNameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + } + } + } + } + } + if is_agg != 0 { + /* Window functions may not be arguments of aggregate functions. + ** Or arguments of other window functions. But aggregate functions + ** may be arguments for window functions. */ + if !(pWin != 0) { + v7 = int32(NC_AllowAgg) + } else { + v7 = 0 + } + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_AllowWin) | v7) + } + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + is_agg = int32(1) + } + } + _sqlite3WalkExprList(tls, pWalker, pList) + if is_agg != 0 { + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { + _sqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) + } + if pWin != 0 { + pSel = (*TNameContext)(unsafe.Pointer(pNC)).FpWinSelect + if libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME)) == 0 { + if pSel != 0 { + v8 = (*TSelect)(unsafe.Pointer(pSel)).FpWinDefn + } else { + v8 = uintptr(0) + } + _sqlite3WindowUpdate(tls, pParse, v8, pWin, pDef) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + break + } + } + _sqlite3WalkExprList(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpPartition) + _sqlite3WalkExprList(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy) + _sqlite3WalkExpr(tls, pWalker, (*TWindow)(unsafe.Pointer(pWin)).FpFilter) + _sqlite3WindowLink(tls, pSel, pWin) + *(*int32)(unsafe.Pointer(pNC + 40)) |= int32(NC_HasWin) + } else { + /* For looping up thru outer contexts */ + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_FUNCTION) + (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = uint8(0) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + _sqlite3WalkExpr(tls, pWalker, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpFilter) + } + pNC2 = pNC + for pNC2 != 0 && _sqlite3ReferencesSrcList(tls, pParse, pExpr, (*TNameContext)(unsafe.Pointer(pNC2)).FpSrcList) == 0 { + p9 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p9))) + (libc.Uint32FromInt32(1) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect)) + pNC2 = (*TNameContext)(unsafe.Pointer(pNC2)).FpNext + } + if pNC2 != 0 && pDef != 0 { + p10 = pExpr + 2 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(uint32(*(*Tu8)(unsafe.Pointer(p10))) + (*TNameContext)(unsafe.Pointer(pNC2)).FnNestedSelect) + p11 = pNC2 + 40 + *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) | (libc.Uint32FromInt32(NC_HasAgg) | ((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags^libc.Uint32FromInt32(SQLITE_FUNC_ANYORDER))&uint32(libc.Int32FromInt32(SQLITE_FUNC_MINMAX)|libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)))) + } + } + *(*int32)(unsafe.Pointer(pNC + 40)) |= savedAllowFlags + } + /* FIX ME: Compute pExpr->affinity based on the expected return + ** type of the function + */ + return int32(WRC_Prune) + case int32(TK_SELECT): + fallthrough + case int32(TK_EXISTS): + fallthrough + case int32(TK_IN): + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + nRef = (*TNameContext)(unsafe.Pointer(pNC)).FnRef + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_SelfRef) != 0 { + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7287, pExpr, pExpr) + } else { + _sqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + } + if nRef != (*TNameContext)(unsafe.Pointer(pNC)).FnRef { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_VarSelect)) + } + *(*int32)(unsafe.Pointer(pNC + 40)) |= int32(NC_Subquery) + } + case int32(TK_VARIABLE): + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_IsCheck)|libc.Int32FromInt32(NC_PartIdx)|libc.Int32FromInt32(NC_IdxExpr)|libc.Int32FromInt32(NC_GenCol)) != 0 { + _notValidImpl(tls, pParse, pNC, __ccgo_ts+7298, pExpr, pExpr) + } + case int32(TK_IS): + fallthrough + case int32(TK_ISNOT): + pRight1 = _sqlite3ExprSkipCollateAndLikely(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE", + ** and "x IS NOT FALSE". */ + if pRight1 != 0 && (int32((*TExpr)(unsafe.Pointer(pRight1)).Fop) == int32(TK_ID) || int32((*TExpr)(unsafe.Pointer(pRight1)).Fop) == int32(TK_TRUEFALSE)) { + rc = _resolveExprStep(tls, pWalker, pRight1) + if rc == int32(WRC_Abort) { + return int32(WRC_Abort) + } + if int32((*TExpr)(unsafe.Pointer(pRight1)).Fop) == int32(TK_TRUEFALSE) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = (*TExpr)(unsafe.Pointer(pExpr)).Fop + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUTH) + return WRC_Continue + } + } + fallthrough + case int32(TK_BETWEEN): + fallthrough + case int32(TK_EQ): + fallthrough + case int32(TK_NE): + fallthrough + case int32(TK_LT): + fallthrough + case int32(TK_LE): + fallthrough + case int32(TK_GT): + fallthrough + case int32(TK_GE): + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + break + } + nLeft = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_BETWEEN) { + nRight = _sqlite3ExprVectorSize(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr) + if nRight == nLeft { + nRight = _sqlite3ExprVectorSize(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr) + } + } else { + nRight = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + } + if nLeft != nRight { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6709, 0) + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + } + break + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + v12 = int32(WRC_Abort) + } else { + v12 = WRC_Continue + } + return v12 +} + +// C documentation +// +// /* +// ** pEList is a list of expressions which are really the result set of the +// ** a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause. +// ** This routine checks to see if pE is a simple identifier which corresponds +// ** to the AS-name of one of the terms of the expression list. If it is, +// ** this routine return an integer between 1 and N where N is the number of +// ** elements in pEList, corresponding to the matching entry. If there is +// ** no match, or if pE is not a simple identifier, then this routine +// ** return 0. +// ** +// ** pEList has been resolved. pE has not. +// */ +func _resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) (r int32) { + var i int32 + var zCol uintptr + _, _ = i, zCol /* Loop counter */ + _ = pParse + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_ID) { + zCol = *(*uintptr)(unsafe.Pointer(pE + 8)) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && Xsqlite3_stricmp(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName, zCol) == 0 { + return i + int32(1) + } + goto _1 + _1: + ; + i++ + } + } + return 0 +} + +// C documentation +// +// /* +// ** pE is a pointer to an expression which is a single term in the +// ** ORDER BY of a compound SELECT. The expression has not been +// ** name resolved. +// ** +// ** At the point this routine is called, we already know that the +// ** ORDER BY term is not an integer index into the result set. That +// ** case is handled by the calling routine. +// ** +// ** Attempt to match pE against result set columns in the left-most +// ** SELECT statement. Return the index i of the matching column, +// ** as an indication to the caller that it should sort by the i-th column. +// ** The left-most column is 1. In other words, the value returned is the +// ** same integer value that would be used in the SQL statement to indicate +// ** the column. +// ** +// ** If there is no match, return 0. Return -1 if an error occurs. +// */ +func _resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintptr, pE uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pEList uintptr + var i, rc int32 + var savedSuppErr Tu8 + var _ /* nc at bp+0 */ TNameContext + _, _, _, _, _ = db, i, pEList, rc, savedSuppErr /* Saved value of db->suppressErr */ + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + /* Resolve all names in the ORDER BY term expression + */ + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + *(*uintptr)(unsafe.Pointer(bp + 16)) = pEList + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags = libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_UEList) | libc.Int32FromInt32(NC_NoSelect) + (*(*TNameContext)(unsafe.Pointer(bp))).FnNcErr = 0 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + savedSuppErr = (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr + (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr = uint8(1) + rc = _sqlite3ResolveExprNames(tls, bp, pE) + (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr = savedSuppErr + if rc != 0 { + return 0 + } + /* Try to match the ORDER BY expression against an expression + ** in the result set. Return an 1-based index of the matching + ** result-set entry. + */ + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr, pE, -int32(1)) < int32(2) { + return i + int32(1) + } + goto _1 + _1: + ; + i++ + } + /* If no match, return 0. */ + return 0 +} + +// C documentation +// +// /* +// ** Generate an ORDER BY or GROUP BY term out-of-range error. +// */ +func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7309, libc.VaList(bp+8, i, zType, mx)) + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) +} + +// C documentation +// +// /* +// ** Analyze the ORDER BY clause in a compound SELECT statement. Modify +// ** each term of the ORDER BY clause is a constant integer between 1 +// ** and N where N is the number of columns in the compound SELECT. +// ** +// ** ORDER BY terms that are already an integer between 1 and N are +// ** unmodified. ORDER BY terms that are integers outside the range of +// ** 1 through N generate an error. ORDER BY terms that are expressions +// ** are matched against result set expressions of compound SELECT +// ** beginning with the left-most SELECT and working toward the right. +// ** At the first match, the ORDER BY expression is transformed into +// ** the integer column number. +// ** +// ** Return the number of errors seen. +// */ +func _resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pDup, pE, pEList, pItem, pNew, pOrderBy, pParent uintptr + var i, moreToDo int32 + var _ /* iCol at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = db, i, moreToDo, pDup, pE, pEList, pItem, pNew, pOrderBy, pParent + moreToDo = int32(1) + pOrderBy = (*TSelect)(unsafe.Pointer(pSelect)).FpOrderBy + if pOrderBy == uintptr(0) { + return 0 + } + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7365, 0) + return int32(1) + } + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + libc.SetBitFieldPtr16Uint32(pOrderBy+8+uintptr(i)*32+16+4, libc.Uint32FromInt32(0), 2, 0x4) + goto _1 + _1: + ; + i++ + } + (*TSelect)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) + for (*TSelect)(unsafe.Pointer(pSelect)).FpPrior != 0 { + (*TSelect)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpPrior)).FpNext = pSelect + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior + } + for pSelect != 0 && moreToDo != 0 { + moreToDo = 0 + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + i = 0 + pItem = pOrderBy + 8 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + *(*int32)(unsafe.Pointer(bp)) = -int32(1) + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 16 + 4))&0x4>>2)) != 0 { + goto _2 + } + pE = _sqlite3ExprSkipCollateAndLikely(tls, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) + if pE == uintptr(0) { + goto _2 + } + if _sqlite3ExprIsInteger(tls, pE, bp) != 0 { + if *(*int32)(unsafe.Pointer(bp)) <= 0 || *(*int32)(unsafe.Pointer(bp)) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { + _resolveOutOfRangeError(tls, pParse, __ccgo_ts+7399, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pE) + return int32(1) + } + } else { + *(*int32)(unsafe.Pointer(bp)) = _resolveAsName(tls, pParse, pEList, pE) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + /* Now test if expression pE matches one of the values returned + ** by pSelect. In the usual case this is done by duplicating the + ** expression, resolving any symbols in it, and then comparing + ** it against each expression returned by the SELECT statement. + ** Once the comparisons are finished, the duplicate expression + ** is deleted. + ** + ** If this is running as part of an ALTER TABLE operation and + ** the symbols resolve successfully, also resolve the symbols in the + ** actual expression. This allows the code in alter.c to modify + ** column references within the ORDER BY expression as required. */ + pDup = _sqlite3ExprDup(tls, db, pE, 0) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + *(*int32)(unsafe.Pointer(bp)) = _resolveOrderByTermToExprList(tls, pParse, pSelect, pDup) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*int32)(unsafe.Pointer(bp)) > 0 { + _resolveOrderByTermToExprList(tls, pParse, pSelect, pE) + } + } + _sqlite3ExprDelete(tls, db, pDup) + } + } + if *(*int32)(unsafe.Pointer(bp)) > 0 { + /* Convert the ORDER BY term into an integer column number iCol, + ** taking care to preserve the COLLATE clause if it exists. */ + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), uintptr(0)) + if pNew == uintptr(0) { + return int32(1) + } + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(EP_IntValue) + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pNew)).Fu)) = *(*int32)(unsafe.Pointer(bp)) + if (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr == pE { + (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = pNew + } else { + pParent = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + for int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pParent)).FpLeft)).Fop) == int32(TK_COLLATE) { + pParent = (*TExpr)(unsafe.Pointer(pParent)).FpLeft + } + (*TExpr)(unsafe.Pointer(pParent)).FpLeft = pNew + } + _sqlite3ExprDelete(tls, db, pE) + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol = uint16(*(*int32)(unsafe.Pointer(bp))) + } + libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(1), 2, 0x4) + } else { + moreToDo = int32(1) + } + goto _2 + _2: + ; + i++ + pItem += 32 + } + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpNext + } + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 16 + 4))&0x4>>2)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7405, libc.VaList(bp+16, i+int32(1))) + return int32(1) + } + goto _3 + _3: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Check every term in the ORDER BY or GROUP BY clause pOrderBy of +// ** the SELECT statement pSelect. If any term is reference to a +// ** result set expression (as determined by the ExprList.a.u.x.iOrderByCol +// ** field) then convert that term into a copy of the corresponding result set +// ** column. +// ** +// ** If any errors are detected, add an error message to pParse and +// ** return non-zero. Return zero if no errors are seen. +// */ +func _sqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, pOrderBy uintptr, zType uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pEList, pItem uintptr + var i int32 + _, _, _, _ = db, i, pEList, pItem + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pOrderBy == uintptr(0) || (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return 0 + } + if (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7466, libc.VaList(bp+8, zType)) + return int32(1) + } + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + /* sqlite3SelectNew() guarantees this */ + i = 0 + pItem = pOrderBy + 8 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + if (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol != 0 { + if int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol) > (*TExprList)(unsafe.Pointer(pEList)).FnExpr { + _resolveOutOfRangeError(tls, pParse, zType, i+int32(1), (*TExprList)(unsafe.Pointer(pEList)).FnExpr, uintptr(0)) + return int32(1) + } + _resolveAlias(tls, pParse, pEList, int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol)-int32(1), (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr, 0) + } + goto _1 + _1: + ; + i++ + pItem += 32 + } + return 0 +} + +// C documentation +// +// /* +// ** Walker callback for windowRemoveExprFromSelect(). +// */ +func _resolveRemoveWindowsCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pWin uintptr + _ = pWin + _ = pWalker + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + pWin = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + _sqlite3WindowUnlinkFromSelect(tls, pWin) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Remove any Window objects owned by the expression pExpr from the +// ** Select.pWin list of Select object pSelect. +// */ +func _windowRemoveExprFromSelect(tls *libc.TLS, pSelect uintptr, pExpr uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* sWalker at bp+0 */ TWalker + if (*TSelect)(unsafe.Pointer(pSelect)).FpWin != 0 { + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_resolveRemoveWindowsCb) + *(*uintptr)(unsafe.Pointer(bp + 40)) = pSelect + _sqlite3WalkExpr(tls, bp, pExpr) + } +} + +// C documentation +// +// /* +// ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. +// ** The Name context of the SELECT statement is pNC. zType is either +// ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is. +// ** +// ** This routine resolves each term of the clause into an expression. +// ** If the order-by term is an integer I between 1 and N (where N is the +// ** number of columns in the result set of the SELECT) then the expression +// ** in the resolution is a copy of the I-th result-set expression. If +// ** the order-by term is an identifier that corresponds to the AS-name of +// ** a result-set expression, then the term resolves to a copy of the +// ** result-set expression. Otherwise, the expression is resolved in +// ** the usual way - using sqlite3ResolveExprNames(). +// ** +// ** This routine returns the number of errors. If errors occur, then +// ** an appropriate error message might be left in pParse. (OOM errors +// ** excepted.) +// */ +func _resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy uintptr, zType uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, j, nResult int32 + var pE, pE2, pItem, pParse uintptr + var _ /* iCol at bp+0 */ int32 + _, _, _, _, _, _, _ = i, j, nResult, pE, pE2, pItem, pParse /* Number of terms in the result set */ + nResult = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList)).FnExpr + pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + i = 0 + pItem = pOrderBy + 8 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + pE = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + pE2 = _sqlite3ExprSkipCollateAndLikely(tls, pE) + if pE2 == uintptr(0) { + goto _1 + } + if int32(*(*int8)(unsafe.Pointer(zType))) != int32('G') { + *(*int32)(unsafe.Pointer(bp)) = _resolveAsName(tls, pParse, (*TSelect)(unsafe.Pointer(pSelect)).FpEList, pE2) + if *(*int32)(unsafe.Pointer(bp)) > 0 { + /* If an AS-name match is found, mark this ORDER BY column as being + ** a copy of the iCol-th result-set column. The subsequent call to + ** sqlite3ResolveOrderGroupBy() will convert the expression to a + ** copy of the iCol-th result-set expression. */ + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol = uint16(*(*int32)(unsafe.Pointer(bp))) + goto _1 + } + } + if _sqlite3ExprIsInteger(tls, pE2, bp) != 0 { + /* The ORDER BY term is an integer constant. Again, set the column + ** number so that sqlite3ResolveOrderGroupBy() will convert the + ** order-by term to a copy of the result-set expression */ + if *(*int32)(unsafe.Pointer(bp)) < int32(1) || *(*int32)(unsafe.Pointer(bp)) > int32(0xffff) { + _resolveOutOfRangeError(tls, pParse, zType, i+int32(1), nResult, pE2) + return int32(1) + } + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol = uint16(*(*int32)(unsafe.Pointer(bp))) + goto _1 + } + /* Otherwise, treat the ORDER BY term as an ordinary expression */ + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol = uint16(0) + if _sqlite3ResolveExprNames(tls, pNC, pE) != 0 { + return int32(1) + } + j = 0 + for { + if !(j < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList)).FnExpr) { + break + } + if _sqlite3ExprCompare(tls, uintptr(0), pE, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList + 8 + uintptr(j)*32))).FpExpr, -int32(1)) == 0 { + /* Since this expression is being changed into a reference + ** to an identical expression in the result set, remove all Window + ** objects belonging to the expression from the Select.pWin list. */ + _windowRemoveExprFromSelect(tls, pSelect, pE) + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol = uint16(j + int32(1)) + } + goto _2 + _2: + ; + j++ + } + goto _1 + _1: + ; + i++ + pItem += 32 + } + return _sqlite3ResolveOrderGroupBy(tls, pParse, pSelect, pOrderBy, zType) +} + +// C documentation +// +// /* +// ** Resolve names in the SELECT statement p and all of its descendants. +// */ +func _resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pGroupBy, pItem, pItem1, pItem2, pLeftmost, pOuterNC, pParse, pSub, pSub1, pWin, zSavedContext uintptr + var i, isCompound, nCompound, nRef, v1, v3 int32 + var _ /* sNC at bp+0 */ TNameContext + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, isCompound, nCompound, nRef, pGroupBy, pItem, pItem1, pItem2, pLeftmost, pOuterNC, pParse, pSub, pSub1, pWin, zSavedContext, v1, v3 /* Database connection */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Resolved) != 0 { + return int32(WRC_Prune) + } + pOuterNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + /* Normally sqlite3SelectExpand() will be called first and will have + ** already expanded this SELECT. However, if this is a subquery within + ** an expression, sqlite3ResolveExprNames() will be called without a + ** prior call to sqlite3SelectExpand(). When that happens, let + ** sqlite3SelectPrep() do all of the processing for this SELECT. + ** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and + ** this routine in the correct order. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Expanded) == uint32(0) { + _sqlite3SelectPrep(tls, pParse, p, pOuterNC) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + v1 = int32(WRC_Abort) + } else { + v1 = int32(WRC_Prune) + } + return v1 + } + isCompound = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FpPrior != uintptr(0)) + nCompound = 0 + pLeftmost = p + for p != 0 { + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Resolved) + /* Resolve the expressions in the LIMIT and OFFSET clauses. These + ** are not allowed to refer to any names, so pass an empty NameContext. + */ + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp))).FpWinSelect = p + if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpLimit) != 0 { + return int32(WRC_Abort) + } + /* If the SF_Converted flags is set, then this Select object was + ** was created by the convertCompoundSelectToSubquery() function. + ** In this case the ORDER BY clause (p->pOrderBy) should be resolved + ** as if it were part of the sub-query, not the parent. This block + ** moves the pOrderBy down to the sub-query. It will be moved back + ** after the names have been resolved. */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Converted) != 0 { + pSub = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect + (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + } + /* Recursively resolve names in all subqueries in the FROM clause + */ + if pOuterNC != 0 { + (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect++ + } + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc) { + break + } + pItem = (*TSelect)(unsafe.Pointer(p)).FpSrc + 8 + uintptr(i)*104 + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 && (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselFlags&uint32(SF_Resolved) == uint32(0) { + if pOuterNC != 0 { + v3 = (*TNameContext)(unsafe.Pointer(pOuterNC)).FnRef + } else { + v3 = 0 + } + nRef = v3 + zSavedContext = (*TParse)(unsafe.Pointer(pParse)).FzAuthContext + if (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = (*TSrcItem)(unsafe.Pointer(pItem)).FzName + } + _sqlite3ResolveSelectNames(tls, pParse, (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect, pOuterNC) + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedContext + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(WRC_Abort) + } + /* If the number of references to the outer context changed when + ** expressions in the sub-select were resolved, the sub-select + ** is correlated. It is not required to check the refcount on any + ** but the innermost outer context object, as lookupName() increments + ** the refcount on all contexts between the current one and the + ** context containing the column when it resolves a name. */ + if pOuterNC != 0 { + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.BoolUint32((*TNameContext)(unsafe.Pointer(pOuterNC)).FnRef > nRef), 3, 0x8) + } + } + goto _2 + _2: + ; + i++ + } + if pOuterNC != 0 && (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect > uint32(0) { + (*TNameContext)(unsafe.Pointer(pOuterNC)).FnNestedSelect-- + } + /* Set up the local name-context to pass to sqlite3ResolveExprNames() to + ** resolve the result-set expression list. + */ + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags = libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin) + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = (*TSelect)(unsafe.Pointer(p)).FpSrc + (*(*TNameContext)(unsafe.Pointer(bp))).FpNext = pOuterNC + /* Resolve names in the result set. */ + if _sqlite3ResolveExprListNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpEList) != 0 { + return int32(WRC_Abort) + } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_AllowWin) + /* If there are no aggregate functions in the result-set, and no GROUP BY + ** expression, do not allow aggregates in any of the other expressions. + */ + pGroupBy = (*TSelect)(unsafe.Pointer(p)).FpGroupBy + if pGroupBy != 0 || (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags&int32(NC_HasAgg) != 0 { + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(int32(SF_Aggregate) | (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags&(libc.Int32FromInt32(NC_MinMaxAgg)|libc.Int32FromInt32(NC_OrderAgg))) + } else { + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_AllowAgg) + } + /* Add the output column list to the name-context before parsing the + ** other expressions in the SELECT statement. This is so that + ** expressions in the WHERE clause (etc.) can refer to expressions by + ** aliases in the result set. + ** + ** Minor point: If this is the case, then the expression will be + ** re-evaluated for each reference to it. + */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = (*TSelect)(unsafe.Pointer(p)).FpEList + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_UEList) + if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7497, 0) + return int32(WRC_Abort) + } + if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) != 0 { + return int32(WRC_Abort) + } + } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= int32(NC_Where) + if _sqlite3ResolveExprNames(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) != 0 { + return int32(WRC_Abort) + } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_Where) + /* Resolve names in table-valued-function arguments */ + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc) { + break + } + pItem1 = (*TSelect)(unsafe.Pointer(p)).FpSrc + 8 + uintptr(i)*104 + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x4>>2)) != 0 && _sqlite3ResolveExprListNames(tls, bp, *(*uintptr)(unsafe.Pointer(pItem1 + 88))) != 0 { + return int32(WRC_Abort) + } + goto _4 + _4: + ; + i++ + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + pWin = (*TSelect)(unsafe.Pointer(p)).FpWinDefn + for { + if !(pWin != 0) { + break + } + if _sqlite3ResolveExprListNames(tls, bp, (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy) != 0 || _sqlite3ResolveExprListNames(tls, bp, (*TWindow)(unsafe.Pointer(pWin)).FpPartition) != 0 { + return int32(WRC_Abort) + } + goto _5 + _5: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + } + /* The ORDER BY and GROUP BY clauses may not refer to terms in + ** outer queries + */ + (*(*TNameContext)(unsafe.Pointer(bp))).FpNext = uintptr(0) + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags |= libc.Int32FromInt32(NC_AllowAgg) | libc.Int32FromInt32(NC_AllowWin) + /* If this is a converted compound query, move the ORDER BY clause from + ** the sub-query back to the parent query. At this point each term + ** within the ORDER BY clause has been transformed to an integer value. + ** These integers will be replaced by copies of the corresponding result + ** set expressions by the call to resolveOrderGroupBy() below. */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Converted) != 0 { + pSub1 = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = (*TSelect)(unsafe.Pointer(pSub1)).FpOrderBy + (*TSelect)(unsafe.Pointer(pSub1)).FpOrderBy = uintptr(0) + } + /* Process the ORDER BY clause for singleton SELECT statements. + ** The ORDER BY clause for compounds SELECT statements is handled + ** below, after all of the result-sets for all of the elements of + ** the compound have been resolved. + ** + ** If there is an ORDER BY clause on a term of a compound-select other + ** than the right-most term, then that is a syntax error. But the error + ** is not detected until much later, and so we need to go ahead and + ** resolve those symbols on the incorrect ORDER BY for consistency. + */ + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) && isCompound <= nCompound && _resolveOrderGroupBy(tls, bp, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7399) != 0 { + return int32(WRC_Abort) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(WRC_Abort) + } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags &= ^libc.Int32FromInt32(NC_AllowWin) + /* Resolve the GROUP BY clause. At the same time, make sure + ** the GROUP BY clause does not contain aggregate functions. + */ + if pGroupBy != 0 { + if _resolveOrderGroupBy(tls, bp, p, pGroupBy, __ccgo_ts+7536) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(WRC_Abort) + } + i = 0 + pItem2 = pGroupBy + 8 + for { + if !(i < (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + break + } + if (*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pItem2)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Agg)) != uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7542, 0) + return int32(WRC_Abort) + } + goto _6 + _6: + ; + i++ + pItem2 += 32 + } + } + /* If this is part of a compound SELECT, check that it has the right + ** number of expressions in the select list. */ + if (*TSelect)(unsafe.Pointer(p)).FpNext != 0 && (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpNext)).FpEList)).FnExpr { + _sqlite3SelectWrongNumTermsError(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpNext) + return int32(WRC_Abort) + } + /* Advance to the next term of the compound + */ + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + nCompound++ + } + /* Resolve the ORDER BY on a compound SELECT after all terms of + ** the compound have been resolved. + */ + if isCompound != 0 && _resolveCompoundOrderBy(tls, pParse, pLeftmost) != 0 { + return int32(WRC_Abort) + } + return int32(WRC_Prune) +} + +// C documentation +// +// /* +// ** This routine walks an expression tree and resolves references to +// ** table columns and result-set columns. At the same time, do error +// ** checking on function usage and set a flag if any aggregate functions +// ** are seen. +// ** +// ** To resolve table columns references we look for nodes (or subtrees) of the +// ** form X.Y.Z or Y.Z or just Z where +// ** +// ** X: The name of a database. Ex: "main" or "temp" or +// ** the symbolic name assigned to an ATTACH-ed database. +// ** +// ** Y: The name of a table in a FROM clause. Or in a trigger +// ** one of the special names "old" or "new". +// ** +// ** Z: The name of a column in table Y. +// ** +// ** The node at the root of the subtree is modified as follows: +// ** +// ** Expr.op Changed to TK_COLUMN +// ** Expr.pTab Points to the Table object for X.Y +// ** Expr.iColumn The column index in X.Y. -1 for the rowid. +// ** Expr.iTable The VDBE cursor number for X.Y +// ** +// ** +// ** To resolve result-set references, look for expression nodes of the +// ** form Z (with no X and Y prefix) where the Z matches the right-hand +// ** size of an AS clause in the result-set of a SELECT. The Z expression +// ** is replaced by a copy of the left-hand side of the result-set expression. +// ** Table-name and function resolution occurs on the substituted expression +// ** tree. For example, in: +// ** +// ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x; +// ** +// ** The "x" term of the order by is replaced by "a+b" to render: +// ** +// ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b; +// ** +// ** Function calls are checked to make sure that the function is +// ** defined and that the correct number of arguments are specified. +// ** If the function is an aggregate function, then the NC_HasAgg flag is +// ** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION. +// ** If an expression contains aggregate functions then the EP_Agg +// ** property on the expression is set. +// ** +// ** An error message is left in pParse if anything is amiss. The number +// ** if errors is returned. +// */ +func _sqlite3ResolveExprNames(tls *libc.TLS, pNC uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var savedHasAgg int32 + var v1 uintptr + var _ /* w at bp+0 */ TWalker + _, _ = savedHasAgg, v1 + if pExpr == uintptr(0) { + return SQLITE_OK + } + savedHasAgg = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_resolveExprStep) + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_NoSelect) != 0 { + v1 = uintptr(0) + } else { + v1 = __ccgo_fp(_resolveSelectStep) + } + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = v1 + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40)) = pNC + *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) += (*TExpr)(unsafe.Pointer(pExpr)).FnHeight + if _sqlite3ExprCheckHeight(tls, (*(*TWalker)(unsafe.Pointer(bp))).FpParse, (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnHeight) != 0 { + return int32(SQLITE_ERROR) + } + _sqlite3WalkExprNN(tls, bp, pExpr) + *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) -= (*TExpr)(unsafe.Pointer(pExpr)).FnHeight + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_HasWin))) + *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg + return libc.BoolInt32((*TNameContext)(unsafe.Pointer(pNC)).FnNcErr > 0 || (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnErr > 0) +} + +// C documentation +// +// /* +// ** Resolve all names for all expression in an expression list. This is +// ** just like sqlite3ResolveExprNames() except that it works for an expression +// ** list rather than a single expression. +// */ +func _sqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, savedHasAgg int32 + var pExpr uintptr + var _ /* w at bp+0 */ TWalker + _, _, _ = i, pExpr, savedHasAgg + savedHasAgg = 0 + if pList == uintptr(0) { + return WRC_Continue + } + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_resolveExprStep) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_resolveSelectStep) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40)) = pNC + savedHasAgg = (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr + if pExpr == uintptr(0) { + goto _1 + } + *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) += (*TExpr)(unsafe.Pointer(pExpr)).FnHeight + if _sqlite3ExprCheckHeight(tls, (*(*TWalker)(unsafe.Pointer(bp))).FpParse, (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnHeight) != 0 { + return int32(WRC_Abort) + } + _sqlite3WalkExprNN(tls, bp, pExpr) + *(*int32)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse + 316)) -= (*TExpr)(unsafe.Pointer(pExpr)).FnHeight + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&(libc.Int32FromInt32(NC_HasAgg)|libc.Int32FromInt32(NC_MinMaxAgg)|libc.Int32FromInt32(NC_HasWin)|libc.Int32FromInt32(NC_OrderAgg)) != 0 { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32((*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_HasWin))) + savedHasAgg |= (*TNameContext)(unsafe.Pointer(pNC)).FncFlags & (libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^(libc.Int32FromInt32(NC_HasAgg) | libc.Int32FromInt32(NC_MinMaxAgg) | libc.Int32FromInt32(NC_HasWin) | libc.Int32FromInt32(NC_OrderAgg)) + } + if (*TParse)(unsafe.Pointer((*(*TWalker)(unsafe.Pointer(bp))).FpParse)).FnErr > 0 { + return int32(WRC_Abort) + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(pNC + 40)) |= savedHasAgg + return WRC_Continue +} + +// C documentation +// +// /* +// ** Resolve all names in all expressions of a SELECT and in all +// ** descendants of the SELECT, including compounds off of p->pPrior, +// ** subqueries in expressions, and subqueries used as FROM clause +// ** terms. +// ** +// ** See sqlite3ResolveExprNames() for a description of the kinds of +// ** transformations that occur. +// ** +// ** All SELECT statements should have been expanded using +// ** sqlite3SelectExpand() prior to invoking this routine. +// */ +func _sqlite3ResolveSelectNames(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_resolveExprStep) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_resolveSelectStep) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + *(*uintptr)(unsafe.Pointer(bp + 40)) = pOuterNC + _sqlite3WalkSelect(tls, bp, p) +} + +// C documentation +// +// /* +// ** Resolve names in expressions that can only reference a single table +// ** or which cannot reference any tables at all. Examples: +// ** +// ** "type" flag +// ** ------------ +// ** (1) CHECK constraints NC_IsCheck +// ** (2) WHERE clauses on partial indices NC_PartIdx +// ** (3) Expressions in indexes on expressions NC_IdxExpr +// ** (4) Expression arguments to VACUUM INTO. 0 +// ** (5) GENERATED ALWAYS as expressions NC_GenCol +// ** +// ** In all cases except (4), the Expr.iTable value for Expr.op==TK_COLUMN +// ** nodes of the expression is set to -1 and the Expr.iColumn value is +// ** set to the column number. In case (4), TK_COLUMN nodes cause an error. +// ** +// ** Any errors cause an error message to be set in pParse. +// */ +func _sqlite3ResolveSelfReference(tls *libc.TLS, pParse uintptr, pTab uintptr, type1 int32, pExpr uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(176) + defer tls.Free(176) + var rc, v1 int32 + var _ /* sNC at bp+112 */ TNameContext + var _ /* sSrc at bp+0 */ TSrcList + _, _ = rc, v1 + libc.Xmemset(tls, bp+112, 0, uint64(56)) + libc.Xmemset(tls, bp, 0, uint64(112)) + if pTab != 0 { + (*(*TSrcList)(unsafe.Pointer(bp))).FnSrc = int32(1) + (*(*TSrcItem)(unsafe.Pointer(bp + 8))).FzName = (*TTable)(unsafe.Pointer(pTab)).FzName + (*(*TSrcItem)(unsafe.Pointer(bp + 8))).FpTab = pTab + (*(*TSrcItem)(unsafe.Pointer(bp + 8))).FiCursor = -int32(1) + if (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + 1*32))).FpSchema { + /* Cause EP_FromDDL to be set on TK_FUNCTION nodes of non-TEMP + ** schema elements */ + type1 |= int32(NC_FromDDL) + } + } + (*(*TNameContext)(unsafe.Pointer(bp + 112))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp + 112))).FpSrcList = bp + (*(*TNameContext)(unsafe.Pointer(bp + 112))).FncFlags = type1 | int32(NC_IsDDL) + v1 = _sqlite3ResolveExprNames(tls, bp+112, pExpr) + rc = v1 + if v1 != SQLITE_OK { + return rc + } + if pList != 0 { + rc = _sqlite3ResolveExprListNames(tls, bp+112, pList) + } + return rc +} + +// C documentation +// +// /* +// ** Return the affinity character for a single column of a table. +// */ +func _sqlite3TableColumnAffinity(tls *libc.TLS, pTab uintptr, iCol int32) (r int8) { + if iCol < 0 || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + return int8(SQLITE_AFF_INTEGER) + } + return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).Faffinity +} + +// C documentation +// +// /* +// ** Return the 'affinity' of the expression pExpr if any. +// ** +// ** If pExpr is a column, a reference to a column via an 'AS' alias, +// ** or a sub-select with a column as the return value, then the +// ** affinity of that column is returned. Otherwise, 0x00 is returned, +// ** indicating no affinity for the expression. +// ** +// ** i.e. the WHERE clause expressions in the following statements all +// ** have an affinity: +// ** +// ** CREATE TABLE t1(a); +// ** SELECT * FROM t1 WHERE a; +// ** SELECT a AS b FROM t1 WHERE b; +// ** SELECT * FROM t1 WHERE (select a from t1); +// */ +func _sqlite3ExprAffinity(tls *libc.TLS, pExpr uintptr) (r int8) { + var op, v1 int32 + var v2 bool + _, _, _ = op, v1, v2 + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + for int32(1) != 0 { + if op == int32(TK_COLUMN) || op == int32(TK_AGG_COLUMN) && *(*uintptr)(unsafe.Pointer(pExpr + 64)) != uintptr(0) { + return _sqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)) + } + if op == int32(TK_SELECT) { + return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList + 8))).FpExpr) + } + if op == int32(TK_CAST) { + return _sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0)) + } + if op == int32(TK_SELECT_COLUMN) { + return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32)))).FpEList + 8 + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*32))).FpExpr) + } + if op == int32(TK_VECTOR) { + return _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)|libc.Int32FromInt32(EP_IfNullRow)) != uint32(0) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + continue + } + if v2 = op != int32(TK_REGISTER); !v2 { + v1 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) + op = v1 + } + if v2 || v1 == int32(TK_REGISTER) { + break + } + } + return (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr +} + +// C documentation +// +// /* +// ** Make a guess at all the possible datatypes of the result that could +// ** be returned by an expression. Return a bitmask indicating the answer: +// ** +// ** 0x01 Numeric +// ** 0x02 Text +// ** 0x04 Blob +// ** +// ** If the expression must return NULL, then 0x00 is returned. +// */ +func _sqlite3ExprDataType(tls *libc.TLS, pExpr uintptr) (r int32) { + var aff, ii, res int32 + var pList uintptr + _, _, _, _ = aff, ii, pList, res + for pExpr != 0 { + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + case int32(TK_COLLATE): + fallthrough + case int32(TK_IF_NULL_ROW): + fallthrough + case int32(TK_UPLUS): + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + case int32(TK_NULL): + pExpr = uintptr(0) + case int32(TK_STRING): + return int32(0x02) + case int32(TK_BLOB): + return int32(0x04) + case int32(TK_CONCAT): + return int32(0x06) + case int32(TK_VARIABLE): + fallthrough + case int32(TK_AGG_FUNCTION): + fallthrough + case int32(TK_FUNCTION): + return int32(0x07) + case int32(TK_COLUMN): + fallthrough + case int32(TK_AGG_COLUMN): + fallthrough + case int32(TK_SELECT): + fallthrough + case int32(TK_CAST): + fallthrough + case int32(TK_SELECT_COLUMN): + fallthrough + case int32(TK_VECTOR): + aff = int32(_sqlite3ExprAffinity(tls, pExpr)) + if aff >= int32(SQLITE_AFF_NUMERIC) { + return int32(0x05) + } + if aff == int32(SQLITE_AFF_TEXT) { + return int32(0x06) + } + return int32(0x07) + case int32(TK_CASE): + res = 0 + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + ii = int32(1) + for { + if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) + goto _1 + _1: + ; + ii += int32(2) + } + if (*TExprList)(unsafe.Pointer(pList)).FnExpr%int32(2) != 0 { + res |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32))).FpExpr) + } + return res + default: + return int32(0x01) + } /* End of switch(op) */ + } /* End of while(pExpr) */ + return 0x00 +} + +// C documentation +// +// /* +// ** Set the collating sequence for expression pExpr to be the collating +// ** sequence named by pToken. Return a pointer to a new Expr node that +// ** implements the COLLATE operator. +// ** +// ** If a memory allocation error occurs, that fact is recorded in pParse->db +// ** and the pExpr parameter is returned unchanged. +// */ +func _sqlite3ExprAddCollateToken(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCollName uintptr, dequote int32) (r uintptr) { + var pNew uintptr + _ = pNew + if (*TToken)(unsafe.Pointer(pCollName)).Fn > uint32(0) { + pNew = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLLATE), pCollName, dequote) + if pNew != 0 { + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = pExpr + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_Collate) | libc.Int32FromInt32(EP_Skip)) + pExpr = pNew + } + } + return pExpr +} + +func _sqlite3ExprAddCollateString(tls *libc.TLS, pParse uintptr, pExpr uintptr, zC uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* s at bp+0 */ TToken + _sqlite3TokenInit(tls, bp, zC) + return _sqlite3ExprAddCollateToken(tls, pParse, pExpr, bp, 0) +} + +// C documentation +// +// /* +// ** Skip over any TK_COLLATE operators. +// */ +func _sqlite3ExprSkipCollate(tls *libc.TLS, pExpr uintptr) (r uintptr) { + for pExpr != 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)) != uint32(0) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } + return pExpr +} + +// C documentation +// +// /* +// ** Skip over any TK_COLLATE operators and/or any unlikely() +// ** or likelihood() or likely() functions at the root of an +// ** expression. +// */ +func _sqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) (r uintptr) { + for pExpr != 0 && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Skip)|libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { + pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + } else { + break + } + } + } + return pExpr +} + +// C documentation +// +// /* +// ** Return the collation sequence for the expression pExpr. If +// ** there is no defined collating sequence, return NULL. +// ** +// ** See also: sqlite3ExprNNCollSeq() +// ** +// ** The sqlite3ExprNNCollSeq() works the same exact that it returns the +// ** default collation if pExpr has no defined collation. +// ** +// ** The collating sequence might be determined by a COLLATE operator +// ** or by the presence of a column with a defined collating sequence. +// ** COLLATE operators take first precedence. Left operands take +// ** precedence over right operands. +// */ +func _sqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintptr) { + var db, p, pColl, pNext, zColl uintptr + var i, j, op, v1 int32 + _, _, _, _, _, _, _, _, _ = db, i, j, op, p, pColl, pNext, zColl, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pColl = uintptr(0) + p = pExpr + for p != 0 { + op = int32((*TExpr)(unsafe.Pointer(p)).Fop) + if op == int32(TK_REGISTER) { + op = int32((*TExpr)(unsafe.Pointer(p)).Fop2) + } + if op == int32(TK_AGG_COLUMN) && *(*uintptr)(unsafe.Pointer(p + 64)) != uintptr(0) || op == int32(TK_COLUMN) || op == int32(TK_TRIGGER) { + v1 = int32((*TExpr)(unsafe.Pointer(p)).FiColumn) + j = v1 + if v1 >= 0 { + zColl = _sqlite3ColumnColl(tls, (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FaCol+uintptr(j)*16) + pColl = _sqlite3FindCollSeq(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, zColl, 0) + } + break + } + if op == int32(TK_CAST) || op == int32(TK_UPLUS) { + p = (*TExpr)(unsafe.Pointer(p)).FpLeft + continue + } + if op == int32(TK_VECTOR) { + p = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8))).FpExpr + continue + } + if op == int32(TK_COLLATE) { + pColl = _sqlite3GetCollSeq(tls, pParse, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, uintptr(0), *(*uintptr)(unsafe.Pointer(p + 8))) + break + } + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Collate) != 0 { + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 && (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpLeft)).Fflags&uint32(EP_Collate) != uint32(0) { + p = (*TExpr)(unsafe.Pointer(p)).FpLeft + } else { + pNext = (*TExpr)(unsafe.Pointer(p)).FpRight + /* The Expr.x union is never used at the same time as Expr.pRight */ + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) == uint32(0) && *(*uintptr)(unsafe.Pointer(p + 32)) != uintptr(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)))).FnExpr) { + break + } + if (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Collate)) != uint32(0) { + pNext = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr + break + } + goto _2 + _2: + ; + i++ + } + } + p = pNext + } + } else { + break + } + } + if _sqlite3CheckCollSeq(tls, pParse, pColl) != 0 { + pColl = uintptr(0) + } + return pColl +} + +// C documentation +// +// /* +// ** Return the collation sequence for the expression pExpr. If +// ** there is no defined collating sequence, return a pointer to the +// ** default collation sequence. +// ** +// ** See also: sqlite3ExprCollSeq() +// ** +// ** The sqlite3ExprCollSeq() routine works the same except that it +// ** returns NULL if there is no defined collation. +// */ +func _sqlite3ExprNNCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3ExprCollSeq(tls, pParse, pExpr) + if p == uintptr(0) { + p = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + return p +} + +// C documentation +// +// /* +// ** Return TRUE if the two expressions have equivalent collating sequences. +// */ +func _sqlite3ExprCollSeqMatch(tls *libc.TLS, pParse uintptr, pE1 uintptr, pE2 uintptr) (r int32) { + var pColl1, pColl2 uintptr + _, _ = pColl1, pColl2 + pColl1 = _sqlite3ExprNNCollSeq(tls, pParse, pE1) + pColl2 = _sqlite3ExprNNCollSeq(tls, pParse, pE2) + return libc.BoolInt32(_sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, (*TCollSeq)(unsafe.Pointer(pColl2)).FzName) == 0) +} + +// C documentation +// +// /* +// ** pExpr is an operand of a comparison operator. aff2 is the +// ** type affinity of the other operand. This routine returns the +// ** type affinity that should be used for the comparison operator. +// */ +func _sqlite3CompareAffinity(tls *libc.TLS, pExpr uintptr, aff2 int8) (r int8) { + var aff1 int8 + var v1 int32 + _, _ = aff1, v1 + aff1 = _sqlite3ExprAffinity(tls, pExpr) + if int32(aff1) > int32(SQLITE_AFF_NONE) && int32(aff2) > int32(SQLITE_AFF_NONE) { + /* Both sides of the comparison are columns. If one has numeric + ** affinity, use that. Otherwise use no affinity. + */ + if int32(aff1) >= int32(SQLITE_AFF_NUMERIC) || int32(aff2) >= int32(SQLITE_AFF_NUMERIC) { + return int8(SQLITE_AFF_NUMERIC) + } else { + return int8(SQLITE_AFF_BLOB) + } + } else { + /* One side is a column, the other is not. Use the columns affinity. */ + if int32(aff1) <= int32(SQLITE_AFF_NONE) { + v1 = int32(aff2) + } else { + v1 = int32(aff1) + } + return int8(v1 | int32(SQLITE_AFF_NONE)) + } + return r +} + +// C documentation +// +// /* +// ** pExpr is a comparison operator. Return the type affinity that should +// ** be applied to both operands prior to doing the comparison. +// */ +func _comparisonAffinity(tls *libc.TLS, pExpr uintptr) (r int8) { + var aff int8 + _ = aff + aff = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + if (*TExpr)(unsafe.Pointer(pExpr)).FpRight != 0 { + aff = _sqlite3CompareAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, aff) + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + aff = _sqlite3CompareAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList + 8))).FpExpr, aff) + } else { + if int32(aff) == 0 { + aff = int8(SQLITE_AFF_BLOB) + } + } + } + return aff +} + +// C documentation +// +// /* +// ** pExpr is a comparison expression, eg. '=', '<', IN(...) etc. +// ** idx_affinity is the affinity of an indexed column. Return true +// ** if the index with affinity idx_affinity may be used to implement +// ** the comparison in pExpr. +// */ +func _sqlite3IndexAffinityOk(tls *libc.TLS, pExpr uintptr, idx_affinity int8) (r int32) { + var aff int8 + _ = aff + aff = _comparisonAffinity(tls, pExpr) + if int32(aff) < int32(SQLITE_AFF_TEXT) { + return int32(1) + } + if int32(aff) == int32(SQLITE_AFF_TEXT) { + return libc.BoolInt32(int32(idx_affinity) == int32(SQLITE_AFF_TEXT)) + } + return libc.BoolInt32(int32(idx_affinity) >= int32(SQLITE_AFF_NUMERIC)) +} + +// C documentation +// +// /* +// ** Return the P5 value that should be used for a binary comparison +// ** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2. +// */ +func _binaryCompareP5(tls *libc.TLS, pExpr1 uintptr, pExpr2 uintptr, jumpIfNull int32) (r Tu8) { + var aff Tu8 + _ = aff + aff = uint8(_sqlite3ExprAffinity(tls, pExpr2)) + aff = uint8(int32(uint8(_sqlite3CompareAffinity(tls, pExpr1, int8(aff)))) | int32(uint8(jumpIfNull))) + return aff +} + +// C documentation +// +// /* +// ** Return a pointer to the collation sequence that should be used by +// ** a binary comparison operator comparing pLeft and pRight. +// ** +// ** If the left hand expression has a collating sequence type, then it is +// ** used. Otherwise the collation sequence for the right hand expression +// ** is used, or the default (BINARY) if neither expression has a collating +// ** type. +// ** +// ** Argument pRight (but not pLeft) may be a null pointer. In this case, +// ** it is not considered. +// */ +func _sqlite3BinaryCompareCollSeq(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) (r uintptr) { + var pColl uintptr + _ = pColl + if (*TExpr)(unsafe.Pointer(pLeft)).Fflags&uint32(EP_Collate) != 0 { + pColl = _sqlite3ExprCollSeq(tls, pParse, pLeft) + } else { + if pRight != 0 && (*TExpr)(unsafe.Pointer(pRight)).Fflags&uint32(EP_Collate) != uint32(0) { + pColl = _sqlite3ExprCollSeq(tls, pParse, pRight) + } else { + pColl = _sqlite3ExprCollSeq(tls, pParse, pLeft) + if !(pColl != 0) { + pColl = _sqlite3ExprCollSeq(tls, pParse, pRight) + } + } + } + return pColl +} + +// C documentation +// +// /* Expression p is a comparison operator. Return a collation sequence +// ** appropriate for the comparison operator. +// ** +// ** This is normally just a wrapper around sqlite3BinaryCompareCollSeq(). +// ** However, if the OP_Commuted flag is set, then the order of the operands +// ** is reversed in the sqlite3BinaryCompareCollSeq() call so that the +// ** correct collating sequence is found. +// */ +func _sqlite3ExprCompareCollSeq(tls *libc.TLS, pParse uintptr, p uintptr) (r uintptr) { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0) { + return _sqlite3BinaryCompareCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpRight, (*TExpr)(unsafe.Pointer(p)).FpLeft) + } else { + return _sqlite3BinaryCompareCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, (*TExpr)(unsafe.Pointer(p)).FpRight) + } + return r +} + +// C documentation +// +// /* +// ** Generate code for a comparison operator. +// */ +func _codeCompare(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr, opcode int32, in1 int32, in2 int32, dest int32, jumpIfNull int32, isCommuted int32) (r int32) { + var addr, p5 int32 + var p4 uintptr + _, _, _ = addr, p4, p5 + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return 0 + } + if isCommuted != 0 { + p4 = _sqlite3BinaryCompareCollSeq(tls, pParse, pRight, pLeft) + } else { + p4 = _sqlite3BinaryCompareCollSeq(tls, pParse, pLeft, pRight) + } + p5 = int32(_binaryCompareP5(tls, pLeft, pRight, jumpIfNull)) + addr = _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, opcode, in2, dest, in1, p4, -int32(2)) + _sqlite3VdbeChangeP5(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, uint16(uint8(p5))) + return addr +} + +// C documentation +// +// /* +// ** Return true if expression pExpr is a vector, or false otherwise. +// ** +// ** A vector is defined as any expression that results in two or more +// ** columns of result. Every TK_VECTOR node is an vector because the +// ** parser will not generate a TK_VECTOR with fewer than two entries. +// ** But a TK_SELECT might be either a vector or a scalar. It is only +// ** considered a vector if it has two or more result columns. +// */ +func _sqlite3ExprIsVector(tls *libc.TLS, pExpr uintptr) (r int32) { + return libc.BoolInt32(_sqlite3ExprVectorSize(tls, pExpr) > int32(1)) +} + +// C documentation +// +// /* +// ** If the expression passed as the only argument is of type TK_VECTOR +// ** return the number of expressions in the vector. Or, if the expression +// ** is a sub-select, return the number of columns in the sub-select. For +// ** any other type of expression, return 1. +// */ +func _sqlite3ExprVectorSize(tls *libc.TLS, pExpr uintptr) (r int32) { + var op Tu8 + _ = op + op = (*TExpr)(unsafe.Pointer(pExpr)).Fop + if int32(op) == int32(TK_REGISTER) { + op = (*TExpr)(unsafe.Pointer(pExpr)).Fop2 + } + if int32(op) == int32(TK_VECTOR) { + return (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr + } else { + if int32(op) == int32(TK_SELECT) { + return (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList)).FnExpr + } else { + return int32(1) + } + } + return r +} + +// C documentation +// +// /* +// ** Return a pointer to a subexpression of pVector that is the i-th +// ** column of the vector (numbered starting with 0). The caller must +// ** ensure that i is within range. +// ** +// ** If pVector is really a scalar (and "scalar" here includes subqueries +// ** that return a single column!) then return pVector unmodified. +// ** +// ** pVector retains ownership of the returned subexpression. +// ** +// ** If the vector is a (SELECT ...) then the expression returned is +// ** just the expression for the i-th term of the result set, and may +// ** not be ready for evaluation because the table cursor has not yet +// ** been positioned. +// */ +func _sqlite3VectorFieldSubexpr(tls *libc.TLS, pVector uintptr, i int32) (r uintptr) { + if _sqlite3ExprIsVector(tls, pVector) != 0 { + if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_SELECT) || int32((*TExpr)(unsafe.Pointer(pVector)).Fop2) == int32(TK_SELECT) { + return (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)))).FpEList + 8 + uintptr(i)*32))).FpExpr + } else { + return (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(i)*32))).FpExpr + } + } + return pVector +} + +// C documentation +// +// /* +// ** Compute and return a new Expr object which when passed to +// ** sqlite3ExprCode() will generate all necessary code to compute +// ** the iField-th column of the vector expression pVector. +// ** +// ** It is ok for pVector to be a scalar (as long as iField==0). +// ** In that case, this routine works like sqlite3ExprDup(). +// ** +// ** The caller owns the returned Expr object and is responsible for +// ** ensuring that the returned value eventually gets freed. +// ** +// ** The caller retains ownership of pVector. If pVector is a TK_SELECT, +// ** then the returned object will reference pVector and so pVector must remain +// ** valid for the life of the returned object. If pVector is a TK_VECTOR +// ** or a scalar expression, then it can be deleted as soon as this routine +// ** returns. +// ** +// ** A trick to cause a TK_SELECT pVector to be deleted together with +// ** the returned Expr object is to attach the pVector to the pRight field +// ** of the returned TK_SELECT_COLUMN Expr object. +// */ +func _sqlite3ExprForVectorField(tls *libc.TLS, pParse uintptr, pVector uintptr, iField int32, nField int32) (r uintptr) { + var pRet, ppVector uintptr + _, _ = pRet, ppVector + if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_SELECT) { + /* The TK_SELECT_COLUMN Expr node: + ** + ** pLeft: pVector containing TK_SELECT. Not deleted. + ** pRight: not used. But recursively deleted. + ** iColumn: Index of a column in pVector + ** iTable: 0 or the number of columns on the LHS of an assignment + ** pLeft->iTable: First in an array of register holding result, or 0 + ** if the result is not yet computed. + ** + ** sqlite3ExprDelete() specifically skips the recursive delete of + ** pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector + ** can be attached to pRight to cause this node to take ownership of + ** pVector. Typically there will be multiple TK_SELECT_COLUMN nodes + ** with the same pLeft pointer to the pVector, but only one of them + ** will own the pVector. + */ + pRet = _sqlite3PExpr(tls, pParse, int32(TK_SELECT_COLUMN), uintptr(0), uintptr(0)) + if pRet != 0 { + *(*Tu32)(unsafe.Pointer(pRet + 4)) |= uint32(libc.Int32FromInt32(EP_FullSize)) + (*TExpr)(unsafe.Pointer(pRet)).FiTable = nField + (*TExpr)(unsafe.Pointer(pRet)).FiColumn = int16(iField) + (*TExpr)(unsafe.Pointer(pRet)).FpLeft = pVector + } + } else { + if int32((*TExpr)(unsafe.Pointer(pVector)).Fop) == int32(TK_VECTOR) { + ppVector = *(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(iField)*32 + pVector = *(*uintptr)(unsafe.Pointer(ppVector)) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + /* This must be a vector UPDATE inside a trigger */ + *(*uintptr)(unsafe.Pointer(ppVector)) = uintptr(0) + return pVector + } + } + pRet = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pVector, 0) + } + return pRet +} + +// C documentation +// +// /* +// ** If expression pExpr is of type TK_SELECT, generate code to evaluate +// ** it. Return the register in which the result is stored (or, if the +// ** sub-select returns more than one column, the first in an array +// ** of registers in which the result is stored). +// ** +// ** If pExpr is not a TK_SELECT expression, return 0. +// */ +func _exprCodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int32) { + var reg int32 + _ = reg + reg = 0 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) { + reg = _sqlite3CodeSubselect(tls, pParse, pExpr) + } + return reg +} + +// C documentation +// +// /* +// ** Argument pVector points to a vector expression - either a TK_VECTOR +// ** or TK_SELECT that returns more than one column. This function returns +// ** the register number of a register that contains the value of +// ** element iField of the vector. +// ** +// ** If pVector is a TK_SELECT expression, then code for it must have +// ** already been generated using the exprCodeSubselect() routine. In this +// ** case parameter regSelect should be the first in an array of registers +// ** containing the results of the sub-select. +// ** +// ** If pVector is of type TK_VECTOR, then code for the requested field +// ** is generated. In this case (*pRegFree) may be set to the number of +// ** a temporary register to be freed by the caller before returning. +// ** +// ** Before returning, output parameter (*ppExpr) is set to point to the +// ** Expr object corresponding to element iElem of the vector. +// */ +func _exprVectorRegister(tls *libc.TLS, pParse uintptr, pVector uintptr, iField int32, regSelect int32, ppExpr uintptr, pRegFree uintptr) (r int32) { + var op Tu8 + _ = op + op = (*TExpr)(unsafe.Pointer(pVector)).Fop + if int32(op) == int32(TK_REGISTER) { + *(*uintptr)(unsafe.Pointer(ppExpr)) = _sqlite3VectorFieldSubexpr(tls, pVector, iField) + return (*TExpr)(unsafe.Pointer(pVector)).FiTable + iField + } + if int32(op) == int32(TK_SELECT) { + *(*uintptr)(unsafe.Pointer(ppExpr)) = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)))).FpEList + 8 + uintptr(iField)*32))).FpExpr + return regSelect + iField + } + if int32(op) == int32(TK_VECTOR) { + *(*uintptr)(unsafe.Pointer(ppExpr)) = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32)) + 8 + uintptr(iField)*32))).FpExpr + return _sqlite3ExprCodeTemp(tls, pParse, *(*uintptr)(unsafe.Pointer(ppExpr)), pRegFree) + } + return 0 +} + +// C documentation +// +// /* +// ** Expression pExpr is a comparison between two vector values. Compute +// ** the result of the comparison (1, 0, or NULL) and write that +// ** result into register dest. +// ** +// ** The caller must satisfy the following preconditions: +// ** +// ** if pExpr->op==TK_IS: op==TK_EQ and p5==SQLITE_NULLEQ +// ** if pExpr->op==TK_ISNOT: op==TK_NE and p5==SQLITE_NULLEQ +// ** otherwise: op==pExpr->op and p5==0 +// */ +func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, op Tu8, p5 Tu8) { + bp := tls.Alloc(32) + defer tls.Free(32) + var addrCmp, addrDone, i, isCommuted, nLeft, r1, r2, regLeft, regRight int32 + var opx Tu8 + var pLeft, pRight, v uintptr + var _ /* pL at bp+8 */ uintptr + var _ /* pR at bp+16 */ uintptr + var _ /* regFree1 at bp+0 */ int32 + var _ /* regFree2 at bp+4 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = addrCmp, addrDone, i, isCommuted, nLeft, opx, pLeft, pRight, r1, r2, regLeft, regRight, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + nLeft = _sqlite3ExprVectorSize(tls, pLeft) + regLeft = 0 + regRight = 0 + opx = op + addrCmp = 0 + addrDone = _sqlite3VdbeMakeLabel(tls, pParse) + isCommuted = libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + if nLeft != _sqlite3ExprVectorSize(tls, pRight) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6709, 0) + return + } + if int32(op) == int32(TK_LE) { + opx = uint8(TK_LT) + } + if int32(op) == int32(TK_GE) { + opx = uint8(TK_GT) + } + if int32(op) == int32(TK_NE) { + opx = uint8(TK_EQ) + } + regLeft = _exprCodeSubselect(tls, pParse, pLeft) + regRight = _exprCodeSubselect(tls, pParse, pRight) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), dest) + i = 0 + for { + if !(int32(1) != 0) { + break + } + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + if addrCmp != 0 { + _sqlite3VdbeJumpHere(tls, v, addrCmp) + } + r1 = _exprVectorRegister(tls, pParse, pLeft, i, regLeft, bp+8, bp) + r2 = _exprVectorRegister(tls, pParse, pRight, i, regRight, bp+16, bp+4) + addrCmp = _sqlite3VdbeCurrentAddr(tls, v) + _codeCompare(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp + 16)), int32(opx), r1, r2, addrDone, int32(p5), isCommuted) + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) + if (int32(opx) == int32(TK_LT) || int32(opx) == int32(TK_GT)) && i < nLeft-int32(1) { + addrCmp = _sqlite3VdbeAddOp0(tls, v, int32(OP_ElseEq)) + } + if int32(p5) == int32(SQLITE_NULLEQ) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, dest) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_ZeroOrNull), r1, dest, r2) + } + if i == nLeft-int32(1) { + break + } + if int32(opx) == int32(TK_EQ) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), dest, addrDone) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrDone) + if i == nLeft-int32(2) { + opx = op + } + } + goto _1 + _1: + ; + i++ + } + _sqlite3VdbeJumpHere(tls, v, addrCmp) + _sqlite3VdbeResolveLabel(tls, v, addrDone) + if int32(op) == int32(TK_NE) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Not), dest, dest) + } +} + +// C documentation +// +// /* +// ** Check that argument nHeight is less than or equal to the maximum +// ** expression depth allowed. If it is not, leave an error message in +// ** pParse. +// */ +func _sqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var mxHeight, rc int32 + _, _ = mxHeight, rc + rc = SQLITE_OK + mxHeight = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 3*4)) + if nHeight > mxHeight { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7601, libc.VaList(bp+8, mxHeight)) + rc = int32(SQLITE_ERROR) + } + return rc +} + +// C documentation +// +// /* The following three functions, heightOfExpr(), heightOfExprList() +// ** and heightOfSelect(), are used to determine the maximum height +// ** of any expression tree referenced by the structure passed as the +// ** first argument. +// ** +// ** If this maximum height is greater than the current value pointed +// ** to by pnHeight, the second parameter, then set *pnHeight to that +// ** value. +// */ +func _heightOfExpr(tls *libc.TLS, p uintptr, pnHeight uintptr) { + if p != 0 { + if (*TExpr)(unsafe.Pointer(p)).FnHeight > *(*int32)(unsafe.Pointer(pnHeight)) { + *(*int32)(unsafe.Pointer(pnHeight)) = (*TExpr)(unsafe.Pointer(p)).FnHeight + } + } +} + +func _heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { + var i int32 + _ = i + if p != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(p)).FnExpr) { + break + } + _heightOfExpr(tls, (*(*TExprList_item)(unsafe.Pointer(p + 8 + uintptr(i)*32))).FpExpr, pnHeight) + goto _1 + _1: + ; + i++ + } + } +} + +func _heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { + var p uintptr + _ = p + p = pSelect + for { + if !(p != 0) { + break + } + _heightOfExpr(tls, (*TSelect)(unsafe.Pointer(p)).FpWhere, pnHeight) + _heightOfExpr(tls, (*TSelect)(unsafe.Pointer(p)).FpHaving, pnHeight) + _heightOfExpr(tls, (*TSelect)(unsafe.Pointer(p)).FpLimit, pnHeight) + _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpEList, pnHeight) + _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpGroupBy, pnHeight) + _heightOfExprList(tls, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pnHeight) + goto _1 + _1: + ; + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + } +} + +// C documentation +// +// /* +// ** Set the Expr.nHeight variable in the structure passed as an +// ** argument. An expression with no children, Expr.pList or +// ** Expr.pSelect member has a height of 1. Any other expression +// ** has a height equal to the maximum height of any other +// ** referenced Expr plus one. +// ** +// ** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags, +// ** if appropriate. +// */ +func _exprSetHeight(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var v1 int32 + var _ /* nHeight at bp+0 */ int32 + _ = v1 + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { + v1 = (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpLeft)).FnHeight + } else { + v1 = 0 + } + *(*int32)(unsafe.Pointer(bp)) = v1 + if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 && (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpRight)).FnHeight > *(*int32)(unsafe.Pointer(bp)) { + *(*int32)(unsafe.Pointer(bp)) = (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpRight)).FnHeight + } + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + _heightOfSelect(tls, *(*uintptr)(unsafe.Pointer(p + 32)), bp) + } else { + if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { + _heightOfExprList(tls, *(*uintptr)(unsafe.Pointer(p + 32)), bp) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_Collate)|libc.Int32FromInt32(EP_Subquery)|libc.Int32FromInt32(EP_HasFunc)) & _sqlite3ExprListFlags(tls, *(*uintptr)(unsafe.Pointer(p + 32))) + } + } + (*TExpr)(unsafe.Pointer(p)).FnHeight = *(*int32)(unsafe.Pointer(bp)) + int32(1) +} + +// C documentation +// +// /* +// ** Set the Expr.nHeight variable using the exprSetHeight() function. If +// ** the height is greater than the maximum allowed expression depth, +// ** leave an error in pParse. +// ** +// ** Also propagate all EP_Propagate flags from the Expr.x.pList into +// ** Expr.flags. +// */ +func _sqlite3ExprSetHeightAndFlags(tls *libc.TLS, pParse uintptr, p uintptr) { + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + _exprSetHeight(tls, p) + _sqlite3ExprCheckHeight(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FnHeight) +} + +// C documentation +// +// /* +// ** Return the maximum height of any expression tree referenced +// ** by the select statement passed as an argument. +// */ +func _sqlite3SelectExprHeight(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* nHeight at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = 0 + _heightOfSelect(tls, p, bp) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Set the error offset for an Expr node, if possible. +// */ +func _sqlite3ExprSetErrorOffset(tls *libc.TLS, pExpr uintptr, iOfst int32) { + if pExpr == uintptr(0) { + return + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)|libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + return + } + *(*int32)(unsafe.Pointer(pExpr + 52)) = iOfst +} + +// C documentation +// +// /* +// ** This routine is the core allocator for Expr nodes. +// ** +// ** Construct a new expression node and return a pointer to it. Memory +// ** for this node and for the pToken argument is a single allocation +// ** obtained from sqlite3DbMalloc(). The calling function +// ** is responsible for making sure the node eventually gets freed. +// ** +// ** If dequote is true, then the token (if it exists) is dequoted. +// ** If dequote is false, no dequoting is performed. The deQuote +// ** parameter is ignored if pToken is NULL or if the token does not +// ** appear to be quoted. If the quotes were of the form "..." (double-quotes) +// ** then the EP_DblQuoted flag is set on the expression node. +// ** +// ** Special case: If op==TK_INTEGER and pToken points to a string that +// ** can be translated into a 32-bit integer, then the token is not +// ** stored in u.zToken. Instead, the integer values is written +// ** into u.iValue and the EP_IntValue flag is set. No extra storage +// ** is allocated to hold the integer text and the dequote flag is ignored. +// */ +func _sqlite3ExprAlloc(tls *libc.TLS, db uintptr, op int32, pToken uintptr, dequote int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nExtra, v1 int32 + var pNew uintptr + var _ /* iValue at bp+0 */ int32 + _, _, _ = nExtra, pNew, v1 + nExtra = 0 + *(*int32)(unsafe.Pointer(bp)) = 0 + if pToken != 0 { + if op != int32(TK_INTEGER) || (*TToken)(unsafe.Pointer(pToken)).Fz == uintptr(0) || _sqlite3GetInt32(tls, (*TToken)(unsafe.Pointer(pToken)).Fz, bp) == 0 { + nExtra = int32((*TToken)(unsafe.Pointer(pToken)).Fn + uint32(1)) + } + } + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(72)+uint64(nExtra)) + if pNew != 0 { + libc.Xmemset(tls, pNew, 0, uint64(72)) + (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) + (*TExpr)(unsafe.Pointer(pNew)).FiAgg = int16(-int32(1)) + if pToken != 0 { + if nExtra == 0 { + if *(*int32)(unsafe.Pointer(bp)) != 0 { + v1 = int32(EP_IsTrue) + } else { + v1 = int32(EP_IsFalse) + } + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_IntValue) | libc.Int32FromInt32(EP_Leaf) | v1) + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pNew)).Fu)) = *(*int32)(unsafe.Pointer(bp)) + } else { + *(*uintptr)(unsafe.Pointer(pNew + 8)) = pNew + 1*72 + if (*TToken)(unsafe.Pointer(pToken)).Fn != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(pNew + 8)), (*TToken)(unsafe.Pointer(pToken)).Fz, uint64((*TToken)(unsafe.Pointer(pToken)).Fn)) + } + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 8)) + uintptr((*TToken)(unsafe.Pointer(pToken)).Fn))) = 0 + if dequote != 0 && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 8)))))])&int32(0x80) != 0 { + _sqlite3DequoteExpr(tls, pNew) + } + } + } + (*TExpr)(unsafe.Pointer(pNew)).FnHeight = int32(1) + } + return pNew +} + +// C documentation +// +// /* +// ** Allocate a new expression node from a zero-terminated token that has +// ** already been dequoted. +// */ +func _sqlite3Expr(tls *libc.TLS, db uintptr, op int32, zToken uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* x at bp+0 */ TToken + (*(*TToken)(unsafe.Pointer(bp))).Fz = zToken + (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(_sqlite3Strlen30(tls, zToken)) + return _sqlite3ExprAlloc(tls, db, op, bp, 0) +} + +// C documentation +// +// /* +// ** Attach subtrees pLeft and pRight to the Expr node pRoot. +// ** +// ** If pRoot==NULL that means that a memory allocation error has occurred. +// ** In that case, delete the subtrees pLeft and pRight. +// */ +func _sqlite3ExprAttachSubtrees(tls *libc.TLS, db uintptr, pRoot uintptr, pLeft uintptr, pRight uintptr) { + if pRoot == uintptr(0) { + _sqlite3ExprDelete(tls, db, pLeft) + _sqlite3ExprDelete(tls, db, pRight) + } else { + if pRight != 0 { + (*TExpr)(unsafe.Pointer(pRoot)).FpRight = pRight + *(*Tu32)(unsafe.Pointer(pRoot + 4)) |= uint32(libc.Int32FromInt32(EP_Collate)|libc.Int32FromInt32(EP_Subquery)|libc.Int32FromInt32(EP_HasFunc)) & (*TExpr)(unsafe.Pointer(pRight)).Fflags + (*TExpr)(unsafe.Pointer(pRoot)).FnHeight = (*TExpr)(unsafe.Pointer(pRight)).FnHeight + int32(1) + } else { + (*TExpr)(unsafe.Pointer(pRoot)).FnHeight = int32(1) + } + if pLeft != 0 { + (*TExpr)(unsafe.Pointer(pRoot)).FpLeft = pLeft + *(*Tu32)(unsafe.Pointer(pRoot + 4)) |= uint32(libc.Int32FromInt32(EP_Collate)|libc.Int32FromInt32(EP_Subquery)|libc.Int32FromInt32(EP_HasFunc)) & (*TExpr)(unsafe.Pointer(pLeft)).Fflags + if (*TExpr)(unsafe.Pointer(pLeft)).FnHeight >= (*TExpr)(unsafe.Pointer(pRoot)).FnHeight { + (*TExpr)(unsafe.Pointer(pRoot)).FnHeight = (*TExpr)(unsafe.Pointer(pLeft)).FnHeight + int32(1) + } + } + } +} + +// C documentation +// +// /* +// ** Allocate an Expr node which joins as many as two subtrees. +// ** +// ** One or both of the subtrees can be NULL. Return a pointer to the new +// ** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed, +// ** free the subtrees and return NULL. +// */ +func _sqlite3PExpr(tls *libc.TLS, pParse uintptr, op int32, pLeft uintptr, pRight uintptr) (r uintptr) { + var p uintptr + _ = p + p = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(72)) + if p != 0 { + libc.Xmemset(tls, p, 0, uint64(72)) + (*TExpr)(unsafe.Pointer(p)).Fop = uint8(op & int32(0xff)) + (*TExpr)(unsafe.Pointer(p)).FiAgg = int16(-int32(1)) + _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p, pLeft, pRight) + _sqlite3ExprCheckHeight(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FnHeight) + } else { + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pLeft) + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pRight) + } + return p +} + +// C documentation +// +// /* +// ** Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due +// ** do a memory allocation failure) then delete the pSelect object. +// */ +func _sqlite3PExprAddSelect(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSelect uintptr) { + if pExpr != 0 { + *(*uintptr)(unsafe.Pointer(pExpr + 32)) = pSelect + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_xIsSelect) | libc.Int32FromInt32(EP_Subquery)) + _sqlite3ExprSetHeightAndFlags(tls, pParse, pExpr) + } else { + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSelect) + } +} + +// C documentation +// +// /* +// ** Expression list pEList is a list of vector values. This function +// ** converts the contents of pEList to a VALUES(...) Select statement +// ** returning 1 row for each element of the list. For example, the +// ** expression list: +// ** +// ** ( (1,2), (3,4) (5,6) ) +// ** +// ** is translated to the equivalent of: +// ** +// ** VALUES(1,2), (3,4), (5,6) +// ** +// ** Each of the vector values in pEList must contain exactly nElem terms. +// ** If a list element that is not a vector or does not contain nElem terms, +// ** an error message is left in pParse. +// ** +// ** This is used as part of processing IN(...) expressions with a list +// ** of vectors on the RHS. e.g. "... IN ((1,2), (3,4), (5,6))". +// */ +func _sqlite3ExprListToValues(tls *libc.TLS, pParse uintptr, nElem int32, pEList uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ii, nExprElem int32 + var pExpr, pRet, pSel, v2 uintptr + _, _, _, _, _, _ = ii, nExprElem, pExpr, pRet, pSel, v2 + pRet = uintptr(0) + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VECTOR) { + nExprElem = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr + } else { + nExprElem = int32(1) + } + if nExprElem != nElem { + if nExprElem > int32(1) { + v2 = __ccgo_ts + 7649 + } else { + v2 = __ccgo_ts + 1680 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7651, libc.VaList(bp+8, nExprElem, v2, nElem)) + break + } + pSel = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 32)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) + *(*uintptr)(unsafe.Pointer(pExpr + 32)) = uintptr(0) + if pSel != 0 { + if pRet != 0 { + (*TSelect)(unsafe.Pointer(pSel)).Fop = uint8(TK_ALL) + (*TSelect)(unsafe.Pointer(pSel)).FpPrior = pRet + } + pRet = pSel + } + goto _1 + _1: + ; + ii++ + } + if pRet != 0 && (*TSelect)(unsafe.Pointer(pRet)).FpPrior != 0 { + *(*Tu32)(unsafe.Pointer(pRet + 4)) |= uint32(SF_MultiValue) + } + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEList) + return pRet +} + +// C documentation +// +// /* +// ** Join two expressions using an AND operator. If either expression is +// ** NULL, then just return the other expression. +// ** +// ** If one side or the other of the AND is known to be false, and neither side +// ** is part of an ON clause, then instead of returning an AND expression, +// ** just return a constant expression with a value of false. +// */ +func _sqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) (r uintptr) { + var db uintptr + var f Tu32 + _, _ = db, f + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pLeft == uintptr(0) { + return pRight + } else { + if pRight == uintptr(0) { + return pLeft + } else { + f = (*TExpr)(unsafe.Pointer(pLeft)).Fflags | (*TExpr)(unsafe.Pointer(pRight)).Fflags + if f&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + _sqlite3ExprDeferredDelete(tls, pParse, pLeft) + _sqlite3ExprDeferredDelete(tls, pParse, pRight) + return _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1754) + } else { + return _sqlite3PExpr(tls, pParse, int32(TK_AND), pLeft, pRight) + } + } + } + return r +} + +// C documentation +// +// /* +// ** Construct a new expression node for a function with multiple +// ** arguments. +// */ +func _sqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken uintptr, eDistinct int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pNew uintptr + _, _ = db, pNew + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pNew = _sqlite3ExprAlloc(tls, db, int32(TK_FUNCTION), pToken, int32(1)) + if pNew == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pList) /* Avoid memory leak when malloc fails */ + return uintptr(0) + } + *(*int32)(unsafe.Pointer(pNew + 52)) = int32(int64((*TToken)(unsafe.Pointer(pToken)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) + if pList != 0 && (*TExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 6*4)) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7695, libc.VaList(bp+8, pToken)) + } + *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_HasFunc)) + _sqlite3ExprSetHeightAndFlags(tls, pParse, pNew) + if eDistinct == int32(SF_Distinct) { + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_Distinct)) + } + return pNew +} + +// C documentation +// +// /* +// ** Report an error when attempting to use an ORDER BY clause within +// ** the arguments of a non-aggregate function. +// */ +func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7729, libc.VaList(bp+8, p)) +} + +// C documentation +// +// /* +// ** Attach an ORDER BY clause to a function call. +// ** +// ** functionname( arguments ORDER BY sortlist ) +// ** \_____________________/ \______/ +// ** pExpr pOrderBy +// ** +// ** The ORDER BY clause is inserted into a new Expr node of type TK_ORDER +// ** and added to the Expr.pLeft field of the parent TK_FUNCTION node. +// */ +func _sqlite3ExprAddFunctionOrderBy(tls *libc.TLS, pParse uintptr, pExpr uintptr, pOrderBy uintptr) { + var db, pOB uintptr + _, _ = db, pOB + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pOrderBy == uintptr(0) { + return + } + if pExpr == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pOrderBy) + return + } + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr == 0 { + /* Ignore ORDER BY on zero-argument aggregates */ + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), pOrderBy) + return + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) && int32((*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FeFrmType) != int32(TK_FILTER) { + _sqlite3ExprOrderByAggregateError(tls, pParse, pExpr) + _sqlite3ExprListDelete(tls, db, pOrderBy) + return + } + pOB = _sqlite3ExprAlloc(tls, db, int32(TK_ORDER), uintptr(0), 0) + if pOB == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pOrderBy) + return + } + *(*uintptr)(unsafe.Pointer(pOB + 32)) = pOrderBy + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = pOB + *(*Tu32)(unsafe.Pointer(pOB + 4)) |= uint32(libc.Int32FromInt32(EP_FullSize)) +} + +// C documentation +// +// /* +// ** Check to see if a function is usable according to current access +// ** rules: +// ** +// ** SQLITE_FUNC_DIRECT - Only usable from top-level SQL +// ** +// ** SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from +// ** top-level SQL +// ** +// ** If the function is not usable, create an error. +// */ +func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FromDDL)) != uint32(0) { + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_DIRECT) != uint32(0) || (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) == uint64(0) { + /* Functions prohibited in triggers and views if: + ** (1) tagged with SQLITE_DIRECTONLY + ** (2) not tagged with SQLITE_INNOCUOUS (which means it + ** is tagged with SQLITE_FUNC_UNSAFE) and + ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning + ** that the schema is possibly tainted). + */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7779, libc.VaList(bp+8, pExpr)) + } + } +} + +// C documentation +// +// /* +// ** Assign a variable number to an expression that encodes a wildcard +// ** in the original SQL statement. +// ** +// ** Wildcards consisting of a single "?" are assigned the next sequential +// ** variable number. +// ** +// ** Wildcards of the form "?nnn" are assigned the number "nnn". We make +// ** sure "nnn" is not too big to avoid a denial of service attack when +// ** the SQL statement comes from an external source. +// ** +// ** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number +// ** as the previous instance of the same wildcard. Or if this is the first +// ** instance of the wildcard, the next sequential variable number is +// ** assigned. +// */ +func _sqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n Tu32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bOk, doAdd int32 + var db, z, v2, v4 uintptr + var x, v1, v3 TynVar + var _ /* i at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _ = bOk, db, doAdd, x, z, v1, v2, v3, v4 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pExpr == uintptr(0) { + return + } + z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + if int32(*(*int8)(unsafe.Pointer(z + 1))) == 0 { + /* Wildcard of the form "?". Assign the next variable number */ + v2 = pParse + 304 + *(*TynVar)(unsafe.Pointer(v2))++ + v1 = *(*TynVar)(unsafe.Pointer(v2)) + x = v1 + } else { + doAdd = 0 + if int32(*(*int8)(unsafe.Pointer(z))) == int32('?') { + if n == uint32(2) { /*OPTIMIZATION-IF-TRUE*/ + *(*Ti64)(unsafe.Pointer(bp)) = int64(int32(*(*int8)(unsafe.Pointer(z + 1))) - int32('0')) /* The common case of ?N for a single digit N */ + bOk = int32(1) + } else { + bOk = libc.BoolInt32(0 == _sqlite3Atoi64(tls, z+1, bp, int32(n-uint32(1)), uint8(SQLITE_UTF8))) + } + if bOk == 0 || *(*Ti64)(unsafe.Pointer(bp)) < int64(1) || *(*Ti64)(unsafe.Pointer(bp)) > int64(*(*int32)(unsafe.Pointer(db + 136 + 9*4))) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7799, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(db + 136 + 9*4)))) + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + return + } + x = int16(*(*Ti64)(unsafe.Pointer(bp))) + if int32(x) > int32((*TParse)(unsafe.Pointer(pParse)).FnVar) { + (*TParse)(unsafe.Pointer(pParse)).FnVar = int16(int32(x)) + doAdd = int32(1) + } else { + if _sqlite3VListNumToName(tls, (*TParse)(unsafe.Pointer(pParse)).FpVList, int32(x)) == uintptr(0) { + doAdd = int32(1) + } + } + } else { + /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable + ** number as the prior appearance of the same name, or if the name + ** has never appeared before, reuse the same variable number + */ + x = int16(_sqlite3VListNameToNum(tls, (*TParse)(unsafe.Pointer(pParse)).FpVList, z, int32(n))) + if int32(x) == 0 { + v4 = pParse + 304 + *(*TynVar)(unsafe.Pointer(v4))++ + v3 = *(*TynVar)(unsafe.Pointer(v4)) + x = v3 + doAdd = int32(1) + } + } + if doAdd != 0 { + (*TParse)(unsafe.Pointer(pParse)).FpVList = _sqlite3VListAdd(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpVList, z, int32(n), int32(x)) + } + } + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = x + if int32(x) > *(*int32)(unsafe.Pointer(db + 136 + 9*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7842, 0) + _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + } +} + +// C documentation +// +// /* +// ** Recursively delete an expression tree. +// */ +func _sqlite3ExprDeleteNN(tls *libc.TLS, db uintptr, p uintptr) { + if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)) { + /* The Expr.x union is never used at the same time as Expr.pRight */ + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 && int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_SELECT_COLUMN) { + _sqlite3ExprDeleteNN(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft) + } + if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { + _sqlite3ExprDeleteNN(tls, db, (*TExpr)(unsafe.Pointer(p)).FpRight) + } else { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + _sqlite3SelectDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32))) + } else { + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32))) + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + _sqlite3WindowDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 64))) + } + } + } + } + if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_Static)) != libc.Uint32FromInt32(0)) { + _sqlite3DbNNFreeNN(tls, db, p) + } +} + +func _sqlite3ExprDelete(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _sqlite3ExprDeleteNN(tls, db, p) + } +} + +func _sqlite3ExprDeleteGeneric(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _sqlite3ExprDeleteNN(tls, db, p) + } +} + +// C documentation +// +// /* +// ** Clear both elements of an OnOrUsing object +// */ +func _sqlite3ClearOnOrUsing(tls *libc.TLS, db uintptr, p uintptr) { + if p == uintptr(0) { + /* Nothing to clear */ + } else { + if (*TOnOrUsing)(unsafe.Pointer(p)).FpOn != 0 { + _sqlite3ExprDeleteNN(tls, db, (*TOnOrUsing)(unsafe.Pointer(p)).FpOn) + } else { + if (*TOnOrUsing)(unsafe.Pointer(p)).FpUsing != 0 { + _sqlite3IdListDelete(tls, db, (*TOnOrUsing)(unsafe.Pointer(p)).FpUsing) + } + } + } +} + +// C documentation +// +// /* +// ** Arrange to cause pExpr to be deleted when the pParse is deleted. +// ** This is similar to sqlite3ExprDelete() except that the delete is +// ** deferred until the pParse is deleted. +// ** +// ** The pExpr might be deleted immediately on an OOM error. +// ** +// ** The deferred delete is (currently) implemented by adding the +// ** pExpr to the pParse->pConstExpr list with a register number of 0. +// */ +func _sqlite3ExprDeferredDelete(tls *libc.TLS, pParse uintptr, pExpr uintptr) { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprDeleteGeneric), pExpr) +} + +// C documentation +// +// /* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the +// ** expression. +// */ +func _sqlite3ExprUnmapAndDelete(tls *libc.TLS, pParse uintptr, p uintptr) { + if p != 0 { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameExprUnmap(tls, pParse, p) + } + _sqlite3ExprDeleteNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p) + } +} + +// C documentation +// +// /* +// ** Return the number of bytes allocated for the expression structure +// ** passed as the first argument. This is always one of EXPR_FULLSIZE, +// ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. +// */ +func _exprStructSize(tls *libc.TLS, p uintptr) (r int32) { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)) != uint32(0) { + return int32(uint64(libc.UintptrFromInt32(0) + 16)) + } + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_Reduced)) != uint32(0) { + return int32(uint64(libc.UintptrFromInt32(0) + 44)) + } + return int32(72) +} + +// C documentation +// +// /* +// ** The dupedExpr*Size() routines each return the number of bytes required +// ** to store a copy of an expression or expression tree. They differ in +// ** how much of the tree is measured. +// ** +// ** dupedExprStructSize() Size of only the Expr structure +// ** dupedExprNodeSize() Size of Expr + space for token +// ** dupedExprSize() Expr + token + subtree components +// ** +// *************************************************************************** +// ** +// ** The dupedExprStructSize() function returns two values OR-ed together: +// ** (1) the space required for a copy of the Expr structure only and +// ** (2) the EP_xxx flags that indicate what the structure size should be. +// ** The return values is always one of: +// ** +// ** EXPR_FULLSIZE +// ** EXPR_REDUCEDSIZE | EP_Reduced +// ** EXPR_TOKENONLYSIZE | EP_TokenOnly +// ** +// ** The size of the structure can be found by masking the return value +// ** of this routine with 0xfff. The flags can be found by masking the +// ** return value with EP_Reduced|EP_TokenOnly. +// ** +// ** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size +// ** (unreduced) Expr objects as they or originally constructed by the parser. +// ** During expression analysis, extra information is computed and moved into +// ** later parts of the Expr object and that extra information might get chopped +// ** off if the expression is reduced. Note also that it does not work to +// ** make an EXPRDUP_REDUCE copy of a reduced expression. It is only legal +// ** to reduce a pristine expression tree from the parser. The implementation +// ** of dupedExprStructSize() contain multiple assert() statements that attempt +// ** to enforce this constraint. +// */ +func _dupedExprStructSize(tls *libc.TLS, p uintptr, flags int32) (r int32) { + var nSize int32 + _ = nSize + /* Only one flag value allowed */ + if 0 == flags || (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_FullSize)) != uint32(0) { + nSize = int32(72) + } else { + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 || *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { + nSize = int32(uint64(libc.UintptrFromInt32(0)+44) | libc.Uint64FromInt32(EP_Reduced)) + } else { + nSize = int32(uint64(libc.UintptrFromInt32(0)+16) | libc.Uint64FromInt32(EP_TokenOnly)) + } + } + return nSize +} + +// C documentation +// +// /* +// ** This function returns the space in bytes required to store the copy +// ** of the Expr structure and a copy of the Expr.u.zToken string (if that +// ** string is defined.) +// */ +func _dupedExprNodeSize(tls *libc.TLS, p uintptr, flags int32) (r int32) { + var nByte int32 + _ = nByte + nByte = _dupedExprStructSize(tls, p, flags) & int32(0xfff) + if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)) && *(*uintptr)(unsafe.Pointer(p + 8)) != 0 { + nByte = int32(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(p + 8)))&libc.Uint64FromInt32(0x3fffffff) + libc.Uint64FromInt32(1))) + } + return (nByte + int32(7)) & ^libc.Int32FromInt32(7) +} + +// C documentation +// +// /* +// ** Return the number of bytes required to create a duplicate of the +// ** expression passed as the first argument. +// ** +// ** The value returned includes space to create a copy of the Expr struct +// ** itself and the buffer referred to by Expr.u.zToken, if any. +// ** +// ** The return value includes space to duplicate all Expr nodes in the +// ** tree formed by Expr.pLeft and Expr.pRight, but not any other +// ** substructure such as Expr.x.pList, Expr.x.pSelect, and Expr.y.pWin. +// */ +func _dupedExprSize(tls *libc.TLS, p uintptr) (r int32) { + var nByte int32 + _ = nByte + nByte = _dupedExprNodeSize(tls, p, int32(EXPRDUP_REDUCE)) + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { + nByte += _dupedExprSize(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft) + } + if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { + nByte += _dupedExprSize(tls, (*TExpr)(unsafe.Pointer(p)).FpRight) + } + return nByte +} + +// C documentation +// +// /* +// ** An EdupBuf is a memory allocation used to stored multiple Expr objects +// ** together with their Expr.zToken content. This is used to help implement +// ** compression while doing sqlite3ExprDup(). The top-level Expr does the +// ** allocation for itself and many of its decendents, then passes an instance +// ** of the structure down into exprDup() so that they decendents can have +// ** access to that memory. +// */ +type TEdupBuf = struct { + FzAlloc uintptr +} + +type EdupBuf = TEdupBuf + +type TEdupBuf1 = struct { + FzAlloc uintptr +} + +type EdupBuf1 = TEdupBuf1 + +// C documentation +// +// /* +// ** This function is similar to sqlite3ExprDup(), except that if pEdupBuf +// ** is not NULL then it points to memory that can be used to store a copy +// ** of the input Expr p together with its p->u.zToken (if any). pEdupBuf +// ** is updated with the new buffer tail prior to returning. +// */ +func _exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pEdupBuf uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nAlloc, nNewSize, nToken, v2 int32 + var nSize, staticFlag Tu32 + var nStructSize uint32 + var pNew, zToken, v1, v3, v4 uintptr + var _ /* sEdupBuf at bp+0 */ TEdupBuf + _, _, _, _, _, _, _, _, _, _, _, _ = nAlloc, nNewSize, nSize, nStructSize, nToken, pNew, staticFlag, zToken, v1, v2, v3, v4 /* EP_Static if space not obtained from malloc */ + nToken = -int32(1) /* Space needed for p->u.zToken. -1 means unknown */ + /* Figure out where to write the new Expr structure. */ + if pEdupBuf != 0 { + (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc = (*TEdupBuf)(unsafe.Pointer(pEdupBuf)).FzAlloc + staticFlag = uint32(EP_Static) + } else { + if dupFlags != 0 { + nAlloc = _dupedExprSize(tls, p) + } else { + if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)) && *(*uintptr)(unsafe.Pointer(p + 8)) != 0 { + nToken = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(p + 8)))&uint64(0x3fffffff) + uint64(1)) + nAlloc = int32((libc.Uint64FromInt64(72) + uint64(nToken) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) + } else { + nToken = 0 + nAlloc = int32((libc.Uint64FromInt64(72) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) + } + } + (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc = _sqlite3DbMallocRawNN(tls, db, uint64(nAlloc)) + staticFlag = uint32(0) + } + pNew = (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc + if pNew != 0 { + /* Set nNewSize to the size allocated for the structure pointed to + ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or + ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed + ** by the copy of the p->u.zToken string (if any). + */ + nStructSize = uint32(_dupedExprStructSize(tls, p, dupFlags)) + nNewSize = int32(nStructSize & uint32(0xfff)) + if nToken < 0 { + if !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)) && *(*uintptr)(unsafe.Pointer(p + 8)) != 0 { + nToken = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(p + 8))) + int32(1) + } else { + nToken = 0 + } + } + if dupFlags != 0 { + libc.Xmemcpy(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc, p, uint64(nNewSize)) + } else { + nSize = uint32(_exprStructSize(tls, p)) + libc.Xmemcpy(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc, p, uint64(nSize)) + if uint64(nSize) < uint64(72) { + libc.Xmemset(tls, (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc+uintptr(nSize), 0, uint64(72)-uint64(nSize)) + } + nNewSize = int32(72) + } + /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */ + *(*Tu32)(unsafe.Pointer(pNew + 4)) &= uint32(^(libc.Int32FromInt32(EP_Reduced) | libc.Int32FromInt32(EP_TokenOnly) | libc.Int32FromInt32(EP_Static))) + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= nStructSize & uint32(libc.Int32FromInt32(EP_Reduced)|libc.Int32FromInt32(EP_TokenOnly)) + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= staticFlag + if dupFlags != 0 { + } + /* Copy the p->u.zToken string, if any. */ + if nToken > 0 { + v1 = (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc + uintptr(nNewSize) + *(*uintptr)(unsafe.Pointer(pNew + 8)) = v1 + zToken = v1 + libc.Xmemcpy(tls, zToken, *(*uintptr)(unsafe.Pointer(p + 8)), uint64(nToken)) + nNewSize += nToken + } + (*(*TEdupBuf)(unsafe.Pointer(bp))).FzAlloc += uintptr((nNewSize + libc.Int32FromInt32(7)) & ^libc.Int32FromInt32(7)) + if ((*TExpr)(unsafe.Pointer(p)).Fflags|(*TExpr)(unsafe.Pointer(pNew)).Fflags)&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) == uint32(0) { + /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + *(*uintptr)(unsafe.Pointer(pNew + 32)) = _sqlite3SelectDup(tls, db, *(*uintptr)(unsafe.Pointer(p + 32)), dupFlags) + } else { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_ORDER) { + v2 = dupFlags + } else { + v2 = 0 + } + *(*uintptr)(unsafe.Pointer(pNew + 32)) = _sqlite3ExprListDup(tls, db, *(*uintptr)(unsafe.Pointer(p + 32)), v2) + } + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + *(*uintptr)(unsafe.Pointer(pNew + 64)) = _sqlite3WindowDup(tls, db, pNew, *(*uintptr)(unsafe.Pointer(p + 64))) + } + /* Fill in pNew->pLeft and pNew->pRight. */ + if dupFlags != 0 { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_SELECT_COLUMN) { + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = (*TExpr)(unsafe.Pointer(p)).FpLeft + } else { + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { + v3 = _exprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft, int32(EXPRDUP_REDUCE), bp) + } else { + v3 = uintptr(0) + } + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = v3 + } + if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { + v4 = _exprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpRight, int32(EXPRDUP_REDUCE), bp) + } else { + v4 = uintptr(0) + } + (*TExpr)(unsafe.Pointer(pNew)).FpRight = v4 + } else { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_SELECT_COLUMN) { + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = (*TExpr)(unsafe.Pointer(p)).FpLeft + } else { + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpLeft, 0) + } + (*TExpr)(unsafe.Pointer(pNew)).FpRight = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(p)).FpRight, 0) + } + } + } + if pEdupBuf != 0 { + libc.Xmemcpy(tls, pEdupBuf, bp, uint64(8)) + } + return pNew +} + +// C documentation +// +// /* +// ** Create and return a deep copy of the object passed as the second +// ** argument. If an OOM condition is encountered, NULL is returned +// ** and the db->mallocFailed flag set. +// */ +func _sqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + var i int32 + var nByte Tsqlite3_int64 + var pRet uintptr + _, _, _ = i, nByte, pRet + pRet = uintptr(0) + if p != 0 { + nByte = int64(uint64(64) + uint64(48)*uint64((*TWith)(unsafe.Pointer(p)).FnCte-libc.Int32FromInt32(1))) + pRet = _sqlite3DbMallocZero(tls, db, uint64(nByte)) + if pRet != 0 { + (*TWith)(unsafe.Pointer(pRet)).FnCte = (*TWith)(unsafe.Pointer(p)).FnCte + i = 0 + for { + if !(i < (*TWith)(unsafe.Pointer(p)).FnCte) { + break + } + (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FpSelect = _sqlite3SelectDup(tls, db, (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FpSelect, 0) + (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FpCols = _sqlite3ExprListDup(tls, db, (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FpCols, 0) + (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FzName = _sqlite3DbStrDup(tls, db, (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FzName) + (*(*TCte)(unsafe.Pointer(pRet + 16 + uintptr(i)*48))).FeM10d = (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FeM10d + goto _1 + _1: + ; + i++ + } + } + } + return pRet +} + +// C documentation +// +// /* +// ** The gatherSelectWindows() procedure and its helper routine +// ** gatherSelectWindowsCallback() are used to scan all the expressions +// ** an a newly duplicated SELECT statement and gather all of the Window +// ** objects found there, assembling them onto the linked list at Select->pWin. +// */ +func _gatherSelectWindowsCallback(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pSelect, pWin uintptr + _, _ = pSelect, pWin + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + pSelect = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pWin = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + _sqlite3WindowLink(tls, pSelect, pWin) + } + return WRC_Continue +} + +func _gatherSelectWindowsSelectCallback(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var v1 int32 + _ = v1 + if p == *(*uintptr)(unsafe.Pointer(pWalker + 40)) { + v1 = WRC_Continue + } else { + v1 = int32(WRC_Prune) + } + return v1 +} + +func _gatherSelectWindows(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_gatherSelectWindowsCallback) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_gatherSelectWindowsSelectCallback) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40)) = p + _sqlite3WalkSelect(tls, bp, p) +} + +// C documentation +// +// /* +// ** The following group of routines make deep copies of expressions, +// ** expression lists, ID lists, and select statements. The copies can +// ** be deleted (by being passed to their respective ...Delete() routines) +// ** without effecting the originals. +// ** +// ** The expression list, ID, and source lists return by sqlite3ExprListDup(), +// ** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded +// ** by subsequent calls to sqlite*ListAppend() routines. +// ** +// ** Any tables that the SrcList might point to are not duplicated. +// ** +// ** The flags parameter contains a combination of the EXPRDUP_XXX flags. +// ** If the EXPRDUP_REDUCE flag is set, then the structure returned is a +// ** truncated version of the usual Expr structure that will be stored as +// ** part of the in-memory representation of the database schema. +// */ +func _sqlite3ExprDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r uintptr) { + var v1 uintptr + _ = v1 + if p != 0 { + v1 = _exprDup(tls, db, p, flags, uintptr(0)) + } else { + v1 = uintptr(0) + } + return v1 +} + +func _sqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r uintptr) { + var i int32 + var pItem, pNew, pNewExpr, pOldExpr, pOldItem, pPriorSelectColNew, pPriorSelectColOld, v2 uintptr + var v3 bool + _, _, _, _, _, _, _, _, _, _ = i, pItem, pNew, pNewExpr, pOldExpr, pOldItem, pPriorSelectColNew, pPriorSelectColOld, v2, v3 + pPriorSelectColOld = uintptr(0) + pPriorSelectColNew = uintptr(0) + if p == uintptr(0) { + return uintptr(0) + } + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(_sqlite3DbMallocSize(tls, db, p))) + if pNew == uintptr(0) { + return uintptr(0) + } + (*TExprList)(unsafe.Pointer(pNew)).FnExpr = (*TExprList)(unsafe.Pointer(p)).FnExpr + (*TExprList)(unsafe.Pointer(pNew)).FnAlloc = (*TExprList)(unsafe.Pointer(p)).FnAlloc + pItem = pNew + 8 + pOldItem = p + 8 + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(p)).FnExpr) { + break + } + pOldExpr = (*TExprList_item)(unsafe.Pointer(pOldItem)).FpExpr + (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = _sqlite3ExprDup(tls, db, pOldExpr, flags) + if v3 = pOldExpr != 0 && int32((*TExpr)(unsafe.Pointer(pOldExpr)).Fop) == int32(TK_SELECT_COLUMN); v3 { + v2 = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + pNewExpr = v2 + } + if v3 && v2 != uintptr(0) { + if (*TExpr)(unsafe.Pointer(pNewExpr)).FpRight != 0 { + pPriorSelectColOld = (*TExpr)(unsafe.Pointer(pOldExpr)).FpRight + pPriorSelectColNew = (*TExpr)(unsafe.Pointer(pNewExpr)).FpRight + (*TExpr)(unsafe.Pointer(pNewExpr)).FpLeft = (*TExpr)(unsafe.Pointer(pNewExpr)).FpRight + } else { + if (*TExpr)(unsafe.Pointer(pOldExpr)).FpLeft != pPriorSelectColOld { + pPriorSelectColOld = (*TExpr)(unsafe.Pointer(pOldExpr)).FpLeft + pPriorSelectColNew = _sqlite3ExprDup(tls, db, pPriorSelectColOld, flags) + (*TExpr)(unsafe.Pointer(pNewExpr)).FpRight = pPriorSelectColNew + } + (*TExpr)(unsafe.Pointer(pNewExpr)).FpLeft = pPriorSelectColNew + } + } + (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbStrDup(tls, db, (*TExprList_item)(unsafe.Pointer(pOldItem)).FzEName) + (*TExprList_item)(unsafe.Pointer(pItem)).Ffg = (*TExprList_item)(unsafe.Pointer(pOldItem)).Ffg + libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(0), 2, 0x4) + (*TExprList_item)(unsafe.Pointer(pItem)).Fu = (*TExprList_item)(unsafe.Pointer(pOldItem)).Fu + goto _1 + _1: + ; + i++ + pItem += 32 + pOldItem += 32 + } + return pNew +} + +// C documentation +// +// /* +// ** If cursors, triggers, views and subqueries are all omitted from +// ** the build, then none of the following routines, except for +// ** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes +// ** called with a NULL argument. +// */ +func _sqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) (r uintptr) { + var i, nByte int32 + var pNew, pNewItem, pOldItem, pTab, v4 uintptr + var v1 uint64 + var v2 Tu32 + _, _, _, _, _, _, _, _, _ = i, nByte, pNew, pNewItem, pOldItem, pTab, v1, v2, v4 + if p == uintptr(0) { + return uintptr(0) + } + if (*TSrcList)(unsafe.Pointer(p)).FnSrc > 0 { + v1 = uint64(104) * uint64((*TSrcList)(unsafe.Pointer(p)).FnSrc-libc.Int32FromInt32(1)) + } else { + v1 = uint64(0) + } + nByte = int32(uint64(112) + v1) + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(nByte)) + if pNew == uintptr(0) { + return uintptr(0) + } + v2 = uint32((*TSrcList)(unsafe.Pointer(p)).FnSrc) + (*TSrcList)(unsafe.Pointer(pNew)).FnAlloc = v2 + (*TSrcList)(unsafe.Pointer(pNew)).FnSrc = int32(v2) + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(p)).FnSrc) { + break + } + pNewItem = pNew + 8 + uintptr(i)*104 + pOldItem = p + 8 + uintptr(i)*104 + (*TSrcItem)(unsafe.Pointer(pNewItem)).FpSchema = (*TSrcItem)(unsafe.Pointer(pOldItem)).FpSchema + (*TSrcItem)(unsafe.Pointer(pNewItem)).FzDatabase = _sqlite3DbStrDup(tls, db, (*TSrcItem)(unsafe.Pointer(pOldItem)).FzDatabase) + (*TSrcItem)(unsafe.Pointer(pNewItem)).FzName = _sqlite3DbStrDup(tls, db, (*TSrcItem)(unsafe.Pointer(pOldItem)).FzName) + (*TSrcItem)(unsafe.Pointer(pNewItem)).FzAlias = _sqlite3DbStrDup(tls, db, (*TSrcItem)(unsafe.Pointer(pOldItem)).FzAlias) + (*TSrcItem)(unsafe.Pointer(pNewItem)).Ffg = (*TSrcItem)(unsafe.Pointer(pOldItem)).Ffg + (*TSrcItem)(unsafe.Pointer(pNewItem)).FiCursor = (*TSrcItem)(unsafe.Pointer(pOldItem)).FiCursor + (*TSrcItem)(unsafe.Pointer(pNewItem)).FaddrFillSub = (*TSrcItem)(unsafe.Pointer(pOldItem)).FaddrFillSub + (*TSrcItem)(unsafe.Pointer(pNewItem)).FregReturn = (*TSrcItem)(unsafe.Pointer(pOldItem)).FregReturn + if int32(uint32(*(*uint16)(unsafe.Pointer(pNewItem + 60 + 4))&0x2>>1)) != 0 { + *(*uintptr)(unsafe.Pointer(pNewItem + 88)) = _sqlite3DbStrDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 88))) + } + (*TSrcItem)(unsafe.Pointer(pNewItem)).Fu2 = (*TSrcItem)(unsafe.Pointer(pOldItem)).Fu2 + if int32(uint32(*(*uint16)(unsafe.Pointer(pNewItem + 60 + 4))&0x100>>8)) != 0 { + (*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNewItem + 96)))).FnUse++ + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pNewItem + 60 + 4))&0x4>>2)) != 0 { + *(*uintptr)(unsafe.Pointer(pNewItem + 88)) = _sqlite3ExprListDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 88)), flags) + } + v4 = (*TSrcItem)(unsafe.Pointer(pOldItem)).FpTab + (*TSrcItem)(unsafe.Pointer(pNewItem)).FpTab = v4 + pTab = v4 + if pTab != 0 { + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + } + (*TSrcItem)(unsafe.Pointer(pNewItem)).FpSelect = _sqlite3SelectDup(tls, db, (*TSrcItem)(unsafe.Pointer(pOldItem)).FpSelect, flags) + if int32(uint32(*(*uint16)(unsafe.Pointer(pOldItem + 60 + 4))&0x400>>10)) != 0 { + *(*uintptr)(unsafe.Pointer(pNewItem + 72)) = _sqlite3IdListDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 72))) + } else { + *(*uintptr)(unsafe.Pointer(pNewItem + 72)) = _sqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 72)), flags) + } + (*TSrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*TSrcItem)(unsafe.Pointer(pOldItem)).FcolUsed + goto _3 + _3: + ; + i++ + } + return pNew +} + +func _sqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + var i int32 + var pNew, pNewItem, pOldItem uintptr + _, _, _, _ = i, pNew, pNewItem, pOldItem + if p == uintptr(0) { + return uintptr(0) + } + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(24)+uint64((*TIdList)(unsafe.Pointer(p)).FnId-libc.Int32FromInt32(1))*uint64(16)) + if pNew == uintptr(0) { + return uintptr(0) + } + (*TIdList)(unsafe.Pointer(pNew)).FnId = (*TIdList)(unsafe.Pointer(p)).FnId + (*TIdList)(unsafe.Pointer(pNew)).FeU4 = (*TIdList)(unsafe.Pointer(p)).FeU4 + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(p)).FnId) { + break + } + pNewItem = pNew + 8 + uintptr(i)*16 + pOldItem = p + 8 + uintptr(i)*16 + (*TIdList_item)(unsafe.Pointer(pNewItem)).FzName = _sqlite3DbStrDup(tls, db, (*TIdList_item)(unsafe.Pointer(pOldItem)).FzName) + (*TIdList_item)(unsafe.Pointer(pNewItem)).Fu4 = (*TIdList_item)(unsafe.Pointer(pOldItem)).Fu4 + goto _1 + _1: + ; + i++ + } + return pNew +} + +func _sqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pNew, pNext, pp uintptr + var _ /* pRet at bp+0 */ uintptr + _, _, _, _ = p, pNew, pNext, pp + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pNext = uintptr(0) + pp = bp + p = pDup + for { + if !(p != 0) { + break + } + pNew = _sqlite3DbMallocRawNN(tls, db, uint64(128)) + if pNew == uintptr(0) { + break + } + (*TSelect)(unsafe.Pointer(pNew)).FpEList = _sqlite3ExprListDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpEList, flags) + (*TSelect)(unsafe.Pointer(pNew)).FpSrc = _sqlite3SrcListDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpSrc, flags) + (*TSelect)(unsafe.Pointer(pNew)).FpWhere = _sqlite3ExprDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWhere, flags) + (*TSelect)(unsafe.Pointer(pNew)).FpGroupBy = _sqlite3ExprListDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpGroupBy, flags) + (*TSelect)(unsafe.Pointer(pNew)).FpHaving = _sqlite3ExprDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpHaving, flags) + (*TSelect)(unsafe.Pointer(pNew)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, flags) + (*TSelect)(unsafe.Pointer(pNew)).Fop = (*TSelect)(unsafe.Pointer(p)).Fop + (*TSelect)(unsafe.Pointer(pNew)).FpNext = pNext + (*TSelect)(unsafe.Pointer(pNew)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpLimit = _sqlite3ExprDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpLimit, flags) + (*TSelect)(unsafe.Pointer(pNew)).FiLimit = 0 + (*TSelect)(unsafe.Pointer(pNew)).FiOffset = 0 + (*TSelect)(unsafe.Pointer(pNew)).FselFlags = (*TSelect)(unsafe.Pointer(p)).FselFlags & uint32(^libc.Int32FromInt32(SF_UsesEphemeral)) + *(*int32)(unsafe.Pointer(pNew + 20)) = -int32(1) + *(*int32)(unsafe.Pointer(pNew + 20 + 1*4)) = -int32(1) + (*TSelect)(unsafe.Pointer(pNew)).FnSelectRow = (*TSelect)(unsafe.Pointer(p)).FnSelectRow + (*TSelect)(unsafe.Pointer(pNew)).FpWith = _sqlite3WithDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWith) + (*TSelect)(unsafe.Pointer(pNew)).FpWin = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpWinDefn = _sqlite3WindowListDup(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWinDefn) + if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + _gatherSelectWindows(tls, pNew) + } + (*TSelect)(unsafe.Pointer(pNew)).FselId = (*TSelect)(unsafe.Pointer(p)).FselId + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + /* Any prior OOM might have left the Select object incomplete. + ** Delete the whole thing rather than allow an incomplete Select + ** to be used by the code generator. */ + (*TSelect)(unsafe.Pointer(pNew)).FpNext = uintptr(0) + _sqlite3SelectDelete(tls, db, pNew) + break + } + *(*uintptr)(unsafe.Pointer(pp)) = pNew + pp = pNew + 80 + pNext = pNew + goto _1 + _1: + ; + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + } + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Add a new element to the end of an expression list. If pList is +// ** initially NULL, then create a new expression list. +// ** +// ** The pList argument must be either NULL or a pointer to an ExprList +// ** obtained from a prior call to sqlite3ExprListAppend(). +// ** +// ** If a memory allocation error occurs, the entire list is freed and +// ** NULL is returned. If non-NULL is returned, then it is guaranteed +// ** that the new entry was successfully appended. +// */ +type TExprList_item = struct { + FpExpr uintptr + FzEName uintptr + Ffg struct { + F__ccgo_align [0]uint32 + FsortFlags Tu8 + F__ccgo_align1 [2]byte + F__ccgo4 uint16 + } + Fu struct { + FiConstExprReg [0]int32 + Fx struct { + FiOrderByCol Tu16 + FiAlias Tu16 + } + } +} + +type ExprList_item = TExprList_item + +// C documentation +// +// /* +// ** Add a new element to the end of an expression list. If pList is +// ** initially NULL, then create a new expression list. +// ** +// ** The pList argument must be either NULL or a pointer to an ExprList +// ** obtained from a prior call to sqlite3ExprListAppend(). +// ** +// ** If a memory allocation error occurs, the entire list is freed and +// ** NULL is returned. If non-NULL is returned, then it is guaranteed +// ** that the new entry was successfully appended. +// */ +var _zeroItem = TExprList_item{} + +func _sqlite3ExprListAppendNew(tls *libc.TLS, db uintptr, pExpr uintptr) (r uintptr) { + var pItem, pList uintptr + _, _ = pItem, pList + pList = _sqlite3DbMallocRawNN(tls, db, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(32)*libc.Uint64FromInt32(4)) + if pList == uintptr(0) { + _sqlite3ExprDelete(tls, db, pExpr) + return uintptr(0) + } + (*TExprList)(unsafe.Pointer(pList)).FnAlloc = int32(4) + (*TExprList)(unsafe.Pointer(pList)).FnExpr = int32(1) + pItem = pList + 8 + *(*TExprList_item)(unsafe.Pointer(pItem)) = _zeroItem + (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +func _sqlite3ExprListAppendGrow(tls *libc.TLS, db uintptr, pList uintptr, pExpr uintptr) (r uintptr) { + var pItem, pNew, v2 uintptr + var v1 int32 + _, _, _, _ = pItem, pNew, v1, v2 + *(*int32)(unsafe.Pointer(pList + 4)) *= int32(2) + pNew = _sqlite3DbRealloc(tls, db, pList, uint64(40)+uint64((*TExprList)(unsafe.Pointer(pList)).FnAlloc-libc.Int32FromInt32(1))*uint64(32)) + if pNew == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pList) + _sqlite3ExprDelete(tls, db, pExpr) + return uintptr(0) + } else { + pList = pNew + } + v2 = pList + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + pItem = pList + 8 + uintptr(v1)*32 + *(*TExprList_item)(unsafe.Pointer(pItem)) = _zeroItem + (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +func _sqlite3ExprListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pExpr uintptr) (r uintptr) { + var pItem, v2 uintptr + var v1 int32 + _, _, _ = pItem, v1, v2 + if pList == uintptr(0) { + return _sqlite3ExprListAppendNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + } + if (*TExprList)(unsafe.Pointer(pList)).FnAlloc < (*TExprList)(unsafe.Pointer(pList)).FnExpr+int32(1) { + return _sqlite3ExprListAppendGrow(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList, pExpr) + } + v2 = pList + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + pItem = pList + 8 + uintptr(v1)*32 + *(*TExprList_item)(unsafe.Pointer(pItem)) = _zeroItem + (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +// C documentation +// +// /* +// ** pColumns and pExpr form a vector assignment which is part of the SET +// ** clause of an UPDATE statement. Like this: +// ** +// ** (a,b,c) = (expr1,expr2,expr3) +// ** Or: (a,b,c) = (SELECT x,y,z FROM ....) +// ** +// ** For each term of the vector assignment, append new entries to the +// ** expression list pList. In the case of a subquery on the RHS, append +// ** TK_SELECT_COLUMN expressions. +// */ +func _sqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, pColumns uintptr, pExpr uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pFirst, pSubExpr uintptr + var i, iFirst, n, v1, v2 int32 + var v3 bool + _, _, _, _, _, _, _, _, _ = db, i, iFirst, n, pFirst, pSubExpr, v1, v2, v3 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pList != 0 { + v1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } else { + v1 = 0 + } + iFirst = v1 + /* pColumns can only be NULL due to an OOM but an OOM will cause an + ** exit prior to this routine being invoked */ + if pColumns == uintptr(0) { + goto vector_append_error + } + if pExpr == uintptr(0) { + goto vector_append_error + } + /* If the RHS is a vector, then we can immediately check to see that + ** the size of the RHS and LHS match. But if the RHS is a SELECT, + ** wildcards ("*") in the result set of the SELECT must be expanded before + ** we can do the size check, so defer the size check until code generation. + */ + if v3 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_SELECT); v3 { + v2 = _sqlite3ExprVectorSize(tls, pExpr) + n = v2 + } + if v3 && (*TIdList)(unsafe.Pointer(pColumns)).FnId != v2 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7865, libc.VaList(bp+8, (*TIdList)(unsafe.Pointer(pColumns)).FnId, n)) + goto vector_append_error + } + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pColumns)).FnId) { + break + } + pSubExpr = _sqlite3ExprForVectorField(tls, pParse, pExpr, i, (*TIdList)(unsafe.Pointer(pColumns)).FnId) + if pSubExpr == uintptr(0) { + goto _4 + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, pSubExpr) + if pList != 0 { + (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32))).FzEName = (*(*TIdList_item)(unsafe.Pointer(pColumns + 8 + uintptr(i)*16))).FzName + (*(*TIdList_item)(unsafe.Pointer(pColumns + 8 + uintptr(i)*16))).FzName = uintptr(0) + } + goto _4 + _4: + ; + i++ + } + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) && pList != uintptr(0) { + pFirst = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(iFirst)*32))).FpExpr + /* Store the SELECT statement in pRight so it will be deleted when + ** sqlite3ExprListDelete() is called */ + (*TExpr)(unsafe.Pointer(pFirst)).FpRight = pExpr + pExpr = uintptr(0) + /* Remember the size of the LHS in iTable so that we can check that + ** the RHS and LHS sizes match during code generation. */ + (*TExpr)(unsafe.Pointer(pFirst)).FiTable = (*TIdList)(unsafe.Pointer(pColumns)).FnId + } +vector_append_error: + ; + _sqlite3ExprUnmapAndDelete(tls, pParse, pExpr) + _sqlite3IdListDelete(tls, db, pColumns) + return pList +} + +// C documentation +// +// /* +// ** Set the sort order for the last element on the given ExprList. +// */ +func _sqlite3ExprListSetSortOrder(tls *libc.TLS, p uintptr, iSortOrder int32, eNulls int32) { + var pItem, p1 uintptr + _, _ = pItem, p1 + if p == uintptr(0) { + return + } + pItem = p + 8 + uintptr((*TExprList)(unsafe.Pointer(p)).FnExpr-int32(1))*32 + if iSortOrder == -int32(1) { + iSortOrder = SQLITE_SO_ASC + } + (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags = uint8(iSortOrder) + if eNulls != -int32(1) { + libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(1), 5, 0x20) + if iSortOrder != eNulls { + p1 = pItem + 16 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(KEYINFO_ORDER_BIGNULL)) + } + } +} + +// C documentation +// +// /* +// ** Set the ExprList.a[].zEName element of the most recently added item +// ** on the expression list. +// ** +// ** pList might be NULL following an OOM error. But pName should never be +// ** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag +// ** is set. +// */ +func _sqlite3ExprListSetName(tls *libc.TLS, pParse uintptr, pList uintptr, pName uintptr, dequote int32) { + var pItem uintptr + _ = pItem + if pList != 0 { + pItem = pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32 + (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TToken)(unsafe.Pointer(pName)).Fz, uint64((*TToken)(unsafe.Pointer(pName)).Fn)) + if dequote != 0 { + /* If dequote==0, then pName->z does not point to part of a DDL + ** statement handled by the parser. And so no token need be added + ** to the token-map. */ + _sqlite3Dequote(tls, (*TExprList_item)(unsafe.Pointer(pItem)).FzEName) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenMap(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FzEName, pName) + } + } + } +} + +// C documentation +// +// /* +// ** Set the ExprList.a[].zSpan element of the most recently added item +// ** on the expression list. +// ** +// ** pList might be NULL following an OOM error. But pSpan should never be +// ** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag +// ** is set. +// */ +func _sqlite3ExprListSetSpan(tls *libc.TLS, pParse uintptr, pList uintptr, zStart uintptr, zEnd uintptr) { + var db, pItem uintptr + _, _ = db, pItem + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pList != 0 { + pItem = pList + 8 + uintptr((*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1))*32 + if (*TExprList_item)(unsafe.Pointer(pItem)).FzEName == uintptr(0) { + (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbSpanDup(tls, db, zStart, zEnd) + libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(ENAME_SPAN), 0, 0x3) + } + } +} + +// C documentation +// +// /* +// ** If the expression list pEList contains more than iLimit elements, +// ** leave an error message in pParse. +// */ +func _sqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, zObject uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var mx int32 + _ = mx + mx = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 2*4)) + if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr > mx { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7895, libc.VaList(bp+8, zObject)) + } +} + +// C documentation +// +// /* +// ** Delete an entire expression list. +// */ +func _exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { + var i, v1 int32 + var pItem uintptr + _, _, _ = i, pItem, v1 + i = (*TExprList)(unsafe.Pointer(pList)).FnExpr + pItem = pList + 8 + for { + _sqlite3ExprDelete(tls, db, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) + if (*TExprList_item)(unsafe.Pointer(pItem)).FzEName != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TExprList_item)(unsafe.Pointer(pItem)).FzEName) + } + pItem += 32 + goto _2 + _2: + ; + i-- + v1 = i + if !(v1 > 0) { + break + } + } + _sqlite3DbNNFreeNN(tls, db, pList) +} + +func _sqlite3ExprListDelete(tls *libc.TLS, db uintptr, pList uintptr) { + if pList != 0 { + _exprListDeleteNN(tls, db, pList) + } +} + +func _sqlite3ExprListDeleteGeneric(tls *libc.TLS, db uintptr, pList uintptr) { + if pList != 0 { + _exprListDeleteNN(tls, db, pList) + } +} + +// C documentation +// +// /* +// ** Return the bitwise-OR of all Expr.flags fields in the given +// ** ExprList. +// */ +func _sqlite3ExprListFlags(tls *libc.TLS, pList uintptr) (r Tu32) { + var i int32 + var m Tu32 + var pExpr uintptr + _, _, _ = i, m, pExpr + m = uint32(0) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr + m |= (*TExpr)(unsafe.Pointer(pExpr)).Fflags + goto _1 + _1: + ; + i++ + } + return m +} + +// C documentation +// +// /* +// ** This is a SELECT-node callback for the expression walker that +// ** always "fails". By "fail" in this case, we mean set +// ** pWalker->eCode to zero and abort. +// ** +// ** This callback is used by multiple expression walkers. +// */ +func _sqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) (r int32) { + _ = NotUsed + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) +} + +// C documentation +// +// /* +// ** Check the input string to see if it is "true" or "false" (in any case). +// ** +// ** If the string is.... Return +// ** "true" EP_IsTrue +// ** "false" EP_IsFalse +// ** anything else 0 +// */ +func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7918) == 0 { + return uint32(EP_IsTrue) + } + if _sqlite3StrICmp(tls, zIn, __ccgo_ts+7923) == 0 { + return uint32(EP_IsFalse) + } + return uint32(0) +} + +// C documentation +// +// /* +// ** If the input expression is an ID with the name "true" or "false" +// ** then convert it into an TK_TRUEFALSE term. Return non-zero if +// ** the conversion happened, and zero if the expression is unaltered. +// */ +func _sqlite3ExprIdToTrueFalse(tls *libc.TLS, pExpr uintptr) (r int32) { + var v, v1 Tu32 + var v2 bool + _, _, _ = v, v1, v2 + if v2 = !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Quoted)|libc.Int32FromInt32(EP_IntValue)) != libc.Uint32FromInt32(0)); v2 { + v1 = _sqlite3IsTrueOrFalse(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8))) + v = v1 + } + if v2 && v1 != uint32(0) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= v + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE +// ** and 0 if it is FALSE. +// */ +func _sqlite3ExprTruthValue(tls *libc.TLS, pExpr uintptr) (r int32) { + pExpr = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) + return libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8)) + 4))) == 0) +} + +// C documentation +// +// /* +// ** If pExpr is an AND or OR expression, try to simplify it by eliminating +// ** terms that are always true or false. Return the simplified expression. +// ** Or return the original expression if no simplification is possible. +// ** +// ** Examples: +// ** +// ** (x<10) AND true => (x<10) +// ** (x<10) AND false => false +// ** (x<10) AND (y=22 OR false) => (x<10) AND (y=22) +// ** (x<10) AND (y=22 OR true) => (x<10) +// ** (y=22) OR true => true +// */ +func _sqlite3ExprSimplifiedAndOr(tls *libc.TLS, pExpr uintptr) (r uintptr) { + var pLeft, pRight, v1, v2 uintptr + _, _, _, _ = pLeft, pRight, v1, v2 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_OR) { + pRight = _sqlite3ExprSimplifiedAndOr(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + pLeft = _sqlite3ExprSimplifiedAndOr(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + if (*TExpr)(unsafe.Pointer(pLeft)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) || (*TExpr)(unsafe.Pointer(pRight)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) { + v1 = pRight + } else { + v1 = pLeft + } + pExpr = v1 + } else { + if (*TExpr)(unsafe.Pointer(pRight)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) || (*TExpr)(unsafe.Pointer(pLeft)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) { + v2 = pLeft + } else { + v2 = pRight + } + pExpr = v2 + } + } + } + return pExpr +} + +// C documentation +// +// /* +// ** These routines are Walker callbacks used to check expressions to +// ** see if they are "constant" for some definition of constant. The +// ** Walker.eCode value determines the type of "constant" we are looking +// ** for. +// ** +// ** These callback routines are used to implement the following: +// ** +// ** sqlite3ExprIsConstant() pWalker->eCode==1 +// ** sqlite3ExprIsConstantNotJoin() pWalker->eCode==2 +// ** sqlite3ExprIsTableConstant() pWalker->eCode==3 +// ** sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5 +// ** +// ** In all cases, the callbacks set Walker.eCode=0 and abort if the expression +// ** is found to not be a constant. +// ** +// ** The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT +// ** expressions in a CREATE TABLE statement. The Walker.eCode value is 5 +// ** when parsing an existing schema out of the sqlite_schema table and 4 +// ** when processing a new CREATE TABLE statement. A bound parameter raises +// ** an error for new statements, but is silently converted +// ** to NULL for existing schemas. This allows sqlite_schema tables that +// ** contain a bound parameter because they were generated by older versions +// ** of SQLite to be parsed by newer versions of SQLite without raising a +// ** malformed schema error. +// */ +func _exprNodeIsConstant(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + /* If pWalker->eCode is 2 then any term of the expression that comes from + ** the ON or USING clauses of an outer join disqualifies the expression + ** from being considered constant. */ + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == int32(2) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + } + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + /* Consider functions to be constant if all their arguments are constant + ** and either pWalker->eCode==4 or 5 or the function has the + ** SQLITE_FUNC_CONST flag. */ + case int32(TK_FUNCTION): + if (int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) >= int32(4) || (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_ConstFunc)) != uint32(0)) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != libc.Uint32FromInt32(0)) { + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == int32(5) { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FromDDL)) + } + return WRC_Continue + } else { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + } + fallthrough + case int32(TK_ID): + /* Convert "true" or "false" in a DEFAULT clause into the + ** appropriate TK_TRUEFALSE operator */ + if _sqlite3ExprIdToTrueFalse(tls, pExpr) != 0 { + return int32(WRC_Prune) + } + fallthrough + case int32(TK_COLUMN): + fallthrough + case int32(TK_AGG_FUNCTION): + fallthrough + case int32(TK_AGG_COLUMN): + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != uint32(0) && int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) != int32(2) { + return WRC_Continue + } + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == int32(3) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == *(*int32)(unsafe.Pointer(&(*TWalker)(unsafe.Pointer(pWalker)).Fu)) { + return WRC_Continue + } + fallthrough + case int32(TK_IF_NULL_ROW): + fallthrough + case int32(TK_REGISTER): + fallthrough + case int32(TK_DOT): + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + case int32(TK_VARIABLE): + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == int32(5) { + /* Silently convert bound parameters that appear inside of CREATE + ** statements into a NULL when parsing the CREATE statement text out + ** of the sqlite_schema table */ + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) + } else { + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == int32(4) { + /* A bound parameter in a CREATE statement that originates from + ** sqlite3_prepare() causes an error */ + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + } + } + fallthrough + default: + /* sqlite3SelectWalkFail() disallows */ + /* sqlite3SelectWalkFail() disallows */ + return WRC_Continue + } + return r +} + +func _exprIsConst(tls *libc.TLS, p uintptr, initFlag int32, iCur int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(initFlag) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprNodeIsConstant) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkFail) + *(*int32)(unsafe.Pointer(bp + 40)) = iCur + _sqlite3WalkExpr(tls, bp, p) + return int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode) +} + +// C documentation +// +// /* +// ** Walk an expression tree. Return non-zero if the expression is constant +// ** and 0 if it involves variables or function calls. +// ** +// ** For the purposes of this function, a double-quoted string (ex: "abc") +// ** is considered a variable but a single-quoted string (ex: 'abc') is +// ** a constant. +// */ +func _sqlite3ExprIsConstant(tls *libc.TLS, p uintptr) (r int32) { + return _exprIsConst(tls, p, int32(1), 0) +} + +// C documentation +// +// /* +// ** Walk an expression tree. Return non-zero if +// ** +// ** (1) the expression is constant, and +// ** (2) the expression does originate in the ON or USING clause +// ** of a LEFT JOIN, and +// ** (3) the expression does not contain any EP_FixedCol TK_COLUMN +// ** operands created by the constant propagation optimization. +// ** +// ** When this routine returns true, it indicates that the expression +// ** can be added to the pParse->pConstExpr list and evaluated once when +// ** the prepared statement starts up. See sqlite3ExprCodeRunJustOnce(). +// */ +func _sqlite3ExprIsConstantNotJoin(tls *libc.TLS, p uintptr) (r int32) { + return _exprIsConst(tls, p, int32(2), 0) +} + +// C documentation +// +// /* +// ** Walk an expression tree. Return non-zero if the expression is constant +// ** for any single row of the table with cursor iCur. In other words, the +// ** expression must not refer to any non-deterministic function nor any +// ** table other than iCur. +// */ +func _sqlite3ExprIsTableConstant(tls *libc.TLS, p uintptr, iCur int32) (r int32) { + return _exprIsConst(tls, p, int32(3), iCur) +} + +// C documentation +// +// /* +// ** Check pExpr to see if it is an constraint on the single data source +// ** pSrc = &pSrcList->a[iSrc]. In other words, check to see if pExpr +// ** constrains pSrc but does not depend on any other tables or data +// ** sources anywhere else in the query. Return true (non-zero) if pExpr +// ** is a constraint on pSrc only. +// ** +// ** This is an optimization. False negatives will perhaps cause slower +// ** queries, but false positives will yield incorrect answers. So when in +// ** doubt, return 0. +// ** +// ** To be an single-source constraint, the following must be true: +// ** +// ** (1) pExpr cannot refer to any table other than pSrc->iCursor. +// ** +// ** (2) pExpr cannot use subqueries or non-deterministic functions. +// ** +// ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN. +// ** (Is there some way to relax this constraint?) +// ** +// ** (4) If pSrc is the right operand of a LEFT JOIN, then... +// ** (4a) pExpr must come from an ON clause.. +// ** (4b) and specifically the ON clause associated with the LEFT JOIN. +// ** +// ** (5) If pSrc is not the right operand of a LEFT JOIN or the left +// ** operand of a RIGHT JOIN, then pExpr must be from the WHERE +// ** clause, not an ON clause. +// ** +// ** (6) Either: +// ** +// ** (6a) pExpr does not originate in an ON or USING clause, or +// ** +// ** (6b) The ON or USING clause from which pExpr is derived is +// ** not to the left of a RIGHT JOIN (or FULL JOIN). +// ** +// ** Without this restriction, accepting pExpr as a single-table +// ** constraint might move the the ON/USING filter expression +// ** from the left side of a RIGHT JOIN over to the right side, +// ** which leads to incorrect answers. See also restriction (9) +// ** on push-down. +// */ +func _sqlite3ExprIsSingleTableConstraint(tls *libc.TLS, pExpr uintptr, pSrcList uintptr, iSrc int32) (r int32) { + var jj int32 + var pSrc uintptr + _, _ = jj, pSrc + pSrc = pSrcList + 8 + uintptr(iSrc)*104 + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + return 0 /* rule (3) */ + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) { + return 0 + } /* rule (4a) */ + if *(*int32)(unsafe.Pointer(pExpr + 52)) != (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { + return 0 + } /* rule (4b) */ + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + return 0 + } /* rule (5) */ + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) && int32((*(*TSrcItem)(unsafe.Pointer(pSrcList + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + jj = 0 + for { + if !(jj < iSrc) { + break + } + if *(*int32)(unsafe.Pointer(pExpr + 52)) == (*(*TSrcItem)(unsafe.Pointer(pSrcList + 8 + uintptr(jj)*104))).FiCursor { + if int32((*(*TSrcItem)(unsafe.Pointer(pSrcList + 8 + uintptr(jj)*104))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + return 0 /* restriction (6) */ + } + break + } + goto _1 + _1: + ; + jj++ + } + } + return _sqlite3ExprIsTableConstant(tls, pExpr, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor) /* rules (1), (2) */ +} + +// C documentation +// +// /* +// ** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy(). +// */ +func _exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var i int32 + var p, pColl, pGroupBy uintptr + _, _, _, _ = i, p, pColl, pGroupBy + pGroupBy = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + /* Check if pExpr is identical to any GROUP BY term. If so, consider + ** it constant. */ + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + break + } + p = (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(i)*32))).FpExpr + if _sqlite3ExprCompare(tls, uintptr(0), pExpr, p, -int32(1)) < int32(2) { + pColl = _sqlite3ExprNNCollSeq(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, p) + if _sqlite3IsBinary(tls, pColl) != 0 { + return int32(WRC_Prune) + } + } + goto _1 + _1: + ; + i++ + } + /* Check if pExpr is a sub-select. If so, consider it variable. */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + } + return _exprNodeIsConstant(tls, pWalker, pExpr) +} + +// C documentation +// +// /* +// ** Walk the expression tree passed as the first argument. Return non-zero +// ** if the expression consists entirely of constants or copies of terms +// ** in pGroupBy that sort with the BINARY collation sequence. +// ** +// ** This routine is used to determine if a term of the HAVING clause can +// ** be promoted into the WHERE clause. In order for such a promotion to work, +// ** the value of the HAVING clause term must be the same for all members of +// ** a "group". The requirement that the GROUP BY term must be BINARY +// ** assumes that no other collating sequence will have a finer-grained +// ** grouping than binary. In other words (A=B COLLATE binary) implies +// ** A=B in every other collating sequence. The requirement that the +// ** GROUP BY be BINARY is stricter than necessary. It would also work +// ** to promote HAVING clauses that use the same alternative collating +// ** sequence as the GROUP BY term, but that is much harder to check, +// ** alternative collating sequences are uncommon, and this is only an +// ** optimization, so we take the easy way out and simply require the +// ** GROUP BY to use the BINARY collating sequence. +// */ +func _sqlite3ExprIsConstantOrGroupBy(tls *libc.TLS, pParse uintptr, p uintptr, pGroupBy uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(1) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprNodeIsConstantOrGroupBy) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40)) = pGroupBy + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + _sqlite3WalkExpr(tls, bp, p) + return int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode) +} + +// C documentation +// +// /* +// ** Walk an expression tree for the DEFAULT field of a column definition +// ** in a CREATE TABLE statement. Return non-zero if the expression is +// ** acceptable for use as a DEFAULT. That is to say, return non-zero if +// ** the expression is constant or a function call with constant arguments. +// ** Return and 0 if there are any variables. +// ** +// ** isInit is true when parsing from sqlite_schema. isInit is false when +// ** processing a new CREATE TABLE statement. When isInit is true, parameters +// ** (such as ? or $abc) in the expression are converted into NULL. When +// ** isInit is false, parameters raise an error. Parameters should not be +// ** allowed in a CREATE TABLE statement, but some legacy versions of SQLite +// ** allowed it, so we need to support it when reading sqlite_schema for +// ** backwards compatibility. +// ** +// ** If isInit is true, set EP_FromDDL on every TK_FUNCTION node. +// ** +// ** For the purposes of this function, a double-quoted string (ex: "abc") +// ** is considered a variable but a single-quoted string (ex: 'abc') is +// ** a constant. +// */ +func _sqlite3ExprIsConstantOrFunction(tls *libc.TLS, p uintptr, isInit Tu8) (r int32) { + return _exprIsConst(tls, p, int32(4)+int32(isInit), 0) +} + +// C documentation +// +// /* +// ** If the expression p codes a constant integer that is small enough +// ** to fit in a 32-bit integer, return 1 and put the value of the integer +// ** in *pValue. If the expression is not an integer or if it is too big +// ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. +// */ +func _sqlite3ExprIsInteger(tls *libc.TLS, p uintptr, pValue uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* v at bp+0 */ int32 + _ = rc + rc = 0 + if p == uintptr(0) { + return 0 + } /* Used to only happen following on OOM */ + /* If an expression is an integer literal that fits in a signed 32-bit + ** integer, then the EP_IntValue flag will have already been set */ + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_IntValue) != 0 { + *(*int32)(unsafe.Pointer(pValue)) = *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(p)).Fu)) + return int32(1) + } + switch int32((*TExpr)(unsafe.Pointer(p)).Fop) { + case int32(TK_UPLUS): + rc = _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, pValue) + case int32(TK_UMINUS): + *(*int32)(unsafe.Pointer(bp)) = 0 + if _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, bp) != 0 { + *(*int32)(unsafe.Pointer(pValue)) = -*(*int32)(unsafe.Pointer(bp)) + rc = int32(1) + } + default: + break + } + return rc +} + +// C documentation +// +// /* +// ** Return FALSE if there is no chance that the expression can be NULL. +// ** +// ** If the expression might be NULL or if the expression is too complex +// ** to tell return TRUE. +// ** +// ** This routine is used as an optimization, to skip OP_IsNull opcodes +// ** when we know that a value cannot be NULL. Hence, a false positive +// ** (returning TRUE when in fact the expression can never be NULL) might +// ** be a small performance hit but is otherwise harmless. On the other +// ** hand, a false negative (returning FALSE when the result could be NULL) +// ** will likely result in an incorrect answer. So when in doubt, return +// ** TRUE. +// */ +func _sqlite3ExprCanBeNull(tls *libc.TLS, p uintptr) (r int32) { + var op Tu8 + _ = op + for int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UPLUS) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { + p = (*TExpr)(unsafe.Pointer(p)).FpLeft + } + op = (*TExpr)(unsafe.Pointer(p)).Fop + if int32(op) == int32(TK_REGISTER) { + op = (*TExpr)(unsafe.Pointer(p)).Fop2 + } + switch int32(op) { + case int32(TK_INTEGER): + fallthrough + case int32(TK_STRING): + fallthrough + case int32(TK_FLOAT): + fallthrough + case int32(TK_BLOB): + return 0 + case int32(TK_COLUMN): + return libc.BoolInt32((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_CanBeNull)) != uint32(0) || *(*uintptr)(unsafe.Pointer(p + 64)) == uintptr(0) || int32((*TExpr)(unsafe.Pointer(p)).FiColumn) >= 0 && (*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FaCol != uintptr(0) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FnCol) && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FaCol + uintptr((*TExpr)(unsafe.Pointer(p)).FiColumn)*16 + 8))&0xf>>0)) == 0) + default: + return int32(1) + } + return r +} + +// C documentation +// +// /* +// ** Return TRUE if the given expression is a constant which would be +// ** unchanged by OP_Affinity with the affinity given in the second +// ** argument. +// ** +// ** This routine is used to determine if the OP_Affinity operation +// ** can be omitted. When in doubt return FALSE. A false negative +// ** is harmless. A false positive, however, can result in the wrong +// ** answer. +// */ +func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) (r int32) { + var op Tu8 + var unaryMinus int32 + _, _ = op, unaryMinus + unaryMinus = 0 + if int32(aff) == int32(SQLITE_AFF_BLOB) { + return int32(1) + } + for int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UPLUS) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { + unaryMinus = int32(1) + } + p = (*TExpr)(unsafe.Pointer(p)).FpLeft + } + op = (*TExpr)(unsafe.Pointer(p)).Fop + if int32(op) == int32(TK_REGISTER) { + op = (*TExpr)(unsafe.Pointer(p)).Fop2 + } + switch int32(op) { + case int32(TK_INTEGER): + return libc.BoolInt32(int32(aff) >= int32(SQLITE_AFF_NUMERIC)) + case int32(TK_FLOAT): + return libc.BoolInt32(int32(aff) >= int32(SQLITE_AFF_NUMERIC)) + case int32(TK_STRING): + return libc.BoolInt32(!(unaryMinus != 0) && int32(aff) == int32(SQLITE_AFF_TEXT)) + case int32(TK_BLOB): + return libc.BoolInt32(!(unaryMinus != 0)) + case int32(TK_COLUMN): + /* p cannot be part of a CHECK constraint */ + return libc.BoolInt32(int32(aff) >= int32(SQLITE_AFF_NUMERIC) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < 0) + default: + return 0 + } + return r +} + +// C documentation +// +// /* +// ** Return TRUE if the given string is a row-id column name. +// */ +func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { + if _sqlite3StrICmp(tls, z, __ccgo_ts+7929) == 0 { + return int32(1) + } + if _sqlite3StrICmp(tls, z, __ccgo_ts+7937) == 0 { + return int32(1) + } + if _sqlite3StrICmp(tls, z, __ccgo_ts+7943) == 0 { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Return a pointer to a buffer containing a usable rowid alias for table +// ** pTab. An alias is usable if there is not an explicit user-defined column +// ** of the same name. +// */ +func _sqlite3RowidAlias(tls *libc.TLS, pTab uintptr) (r uintptr) { + var azOpt [3]uintptr + var iCol, ii int32 + _, _, _ = azOpt, iCol, ii + azOpt = [3]uintptr{ + 0: __ccgo_ts + 7929, + 1: __ccgo_ts + 7937, + 2: __ccgo_ts + 7943, + } + ii = 0 + for { + if !(ii < int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(8))) { + break + } + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if Xsqlite3_stricmp(tls, azOpt[ii], (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) == 0 { + break + } + goto _2 + _2: + ; + iCol++ + } + if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + return azOpt[ii] + } + goto _1 + _1: + ; + ii++ + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** pX is the RHS of an IN operator. If pX is a SELECT statement +// ** that can be simplified to a direct table access, then return +// ** a pointer to the SELECT statement. If pX is not a SELECT statement, +// ** or if the SELECT statement needs to be materialized into a transient +// ** table, then return NULL. +// */ +func _isCandidateForInOpt(tls *libc.TLS, pX uintptr) (r uintptr) { + var i int32 + var p, pEList, pRes, pSrc, pTab uintptr + _, _, _, _, _, _ = i, p, pEList, pRes, pSrc, pTab + if !((*TExpr)(unsafe.Pointer(pX)).Fflags&libc.Uint32FromInt32(EP_xIsSelect) != libc.Uint32FromInt32(0)) { + return uintptr(0) + } /* Not a subquery */ + if (*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(libc.Int32FromInt32(EP_VarSelect)) != uint32(0) { + return uintptr(0) + } /* Correlated subq */ + p = *(*uintptr)(unsafe.Pointer(pX + 32)) + if (*TSelect)(unsafe.Pointer(p)).FpPrior != 0 { + return uintptr(0) + } /* Not a compound SELECT */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) != 0 { + return uintptr(0) /* No DISTINCT keyword and no aggregate functions */ + } + /* Has no GROUP BY clause */ + if (*TSelect)(unsafe.Pointer(p)).FpLimit != 0 { + return uintptr(0) + } /* Has no LIMIT clause */ + if (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 { + return uintptr(0) + } /* Has no WHERE clause */ + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc != int32(1) { + return uintptr(0) + } /* Single term in FROM clause */ + if (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpSelect != 0 { + return uintptr(0) + } /* FROM is not a subquery or view */ + pTab = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab + /* FROM clause is not a view */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + return uintptr(0) + } /* FROM clause not a virtual table */ + pEList = (*TSelect)(unsafe.Pointer(p)).FpEList + /* All SELECT results must be columns. */ + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + pRes = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pRes)).Fop) != int32(TK_COLUMN) { + return uintptr(0) + } + /* Not a correlated subquery */ + goto _1 + _1: + ; + i++ + } + return p +} + +// C documentation +// +// /* +// ** Generate code that checks the left-most column of index table iCur to see if +// ** it contains any NULL entries. Cause the register at regHasNull to be set +// ** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull +// ** to be set to NULL if iCur contains one or more NULL values. +// */ +func _sqlite3SetHasNullFlag(tls *libc.TLS, v uintptr, iCur int32, regHasNull int32) { + var addr1 int32 + _ = addr1 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regHasNull) + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iCur) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, 0, regHasNull) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_TYPEOFARG)) + _sqlite3VdbeJumpHere(tls, v, addr1) +} + +// C documentation +// +// /* +// ** The argument is an IN operator with a list (not a subquery) on the +// ** right-hand side. Return TRUE if that list is constant. +// */ +func _sqlite3InRhsIsConstant(tls *libc.TLS, pIn uintptr) (r int32) { + var pLHS uintptr + var res int32 + _, _ = pLHS, res + pLHS = (*TExpr)(unsafe.Pointer(pIn)).FpLeft + (*TExpr)(unsafe.Pointer(pIn)).FpLeft = uintptr(0) + res = _sqlite3ExprIsConstant(tls, pIn) + (*TExpr)(unsafe.Pointer(pIn)).FpLeft = pLHS + return res +} + +// C documentation +// +// /* +// ** This function is used by the implementation of the IN (...) operator. +// ** The pX parameter is the expression on the RHS of the IN operator, which +// ** might be either a list of expressions or a subquery. +// ** +// ** The job of this routine is to find or create a b-tree object that can +// ** be used either to test for membership in the RHS set or to iterate through +// ** all members of the RHS set, skipping duplicates. +// ** +// ** A cursor is opened on the b-tree object that is the RHS of the IN operator +// ** and the *piTab parameter is set to the index of that cursor. +// ** +// ** The returned value of this function indicates the b-tree type, as follows: +// ** +// ** IN_INDEX_ROWID - The cursor was opened on a database table. +// ** IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index. +// ** IN_INDEX_INDEX_DESC - The cursor was opened on a descending index. +// ** IN_INDEX_EPH - The cursor was opened on a specially created and +// ** populated ephemeral table. +// ** IN_INDEX_NOOP - No cursor was allocated. The IN operator must be +// ** implemented as a sequence of comparisons. +// ** +// ** An existing b-tree might be used if the RHS expression pX is a simple +// ** subquery such as: +// ** +// ** SELECT , ... FROM +// ** +// ** If the RHS of the IN operator is a list or a more complex subquery, then +// ** an ephemeral table might need to be generated from the RHS and then +// ** pX->iTable made to point to the ephemeral table instead of an +// ** existing table. In this case, the creation and initialization of the +// ** ephemeral table might be put inside of a subroutine, the EP_Subrtn flag +// ** will be set on pX and the pX->y.sub fields will be set to show where +// ** the subroutine is coded. +// ** +// ** The inFlags parameter must contain, at a minimum, one of the bits +// ** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both. If inFlags contains +// ** IN_INDEX_MEMBERSHIP, then the generated table will be used for a fast +// ** membership test. When the IN_INDEX_LOOP bit is set, the IN index will +// ** be used to loop over all values of the RHS of the IN operator. +// ** +// ** When IN_INDEX_LOOP is used (and the b-tree will be used to iterate +// ** through the set members) then the b-tree must not contain duplicates. +// ** An ephemeral table will be created unless the selected columns are guaranteed +// ** to be unique - either because it is an INTEGER PRIMARY KEY or due to +// ** a UNIQUE constraint or index. +// ** +// ** When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used +// ** for fast set membership tests) then an ephemeral table must +// ** be used unless is a single INTEGER PRIMARY KEY column or an +// ** index can be found with the specified as its left-most. +// ** +// ** If the IN_INDEX_NOOP_OK and IN_INDEX_MEMBERSHIP are both set and +// ** if the RHS of the IN operator is a list (not a subquery) then this +// ** routine might decide that creating an ephemeral b-tree for membership +// ** testing is too expensive and return IN_INDEX_NOOP. In that case, the +// ** calling routine should implement the IN operator using a sequence +// ** of Eq or Ne comparison operations. +// ** +// ** When the b-tree is being used for membership tests, the calling function +// ** might need to know whether or not the RHS side of the IN operator +// ** contains a NULL. If prRhsHasNull is not a NULL pointer and +// ** if there is any chance that the (...) might contain a NULL value at +// ** runtime, then a register is allocated and the register number written +// ** to *prRhsHasNull. If there is no chance that the (...) contains a +// ** NULL value, then *prRhsHasNull is left unchanged. +// ** +// ** If a register is allocated and its location stored in *prRhsHasNull, then +// ** the value in that register will be NULL if the b-tree contains one or more +// ** NULL values, and it will be some non-NULL value if the b-tree contains no +// ** NULL values. +// ** +// ** If the aiMap parameter is not NULL, it must point to an array containing +// ** one element for each column returned by the SELECT statement on the RHS +// ** of the IN(...) operator. The i'th entry of the array is populated with the +// ** offset of the index column that matches the i'th column returned by the +// ** SELECT. For example, if the expression and selected index are: +// ** +// ** (?,?,?) IN (SELECT a, b, c FROM t1) +// ** CREATE INDEX i1 ON t1(b, c, a); +// ** +// ** then aiMap[] is populated with {2, 0, 1}. +// */ +func _sqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags Tu32, prRhsHasNull uintptr, aiMap uintptr, piTab uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var affinity_ok, eType, i, i1, i2, iAddr, iAddr1, iCol, iDb, iTab, j, mustBeUnique, n, nExpr, rMayHaveNull, v1, v10, v12, v13 int32 + var cmpaff, idxaff int8 + var colUsed, mCol TBitmask + var db, p, pEList, pEList1, pIdx, pLhs, pLhs1, pReq, pRhs, pTab, v, v11, v14, v2, v4 uintptr + var savedNQueryLoop Tu32 + var v5 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = affinity_ok, cmpaff, colUsed, db, eType, i, i1, i2, iAddr, iAddr1, iCol, iDb, iTab, idxaff, j, mCol, mustBeUnique, n, nExpr, p, pEList, pEList1, pIdx, pLhs, pLhs1, pReq, pRhs, pTab, rMayHaveNull, savedNQueryLoop, v, v1, v10, v11, v12, v13, v14, v2, v4, v5 /* SELECT to the right of IN operator */ + eType = 0 /* True if RHS must be unique */ + v = _sqlite3GetVdbe(tls, pParse) /* Virtual machine being coded */ + mustBeUnique = libc.BoolInt32(inFlags&uint32(IN_INDEX_LOOP) != uint32(0)) + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + iTab = v1 + /* If the RHS of this IN(...) operator is a SELECT, and if it matters + ** whether or not the SELECT result contains NULL values, check whether + ** or not NULL is actually possible (it may not be, for example, due + ** to NOT NULL constraints in the schema). If no NULL values are possible, + ** set prRhsHasNull to 0 before continuing. */ + if prRhsHasNull != 0 && (*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + pEList = (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pX + 32)))).FpEList + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr) != 0 { + break + } + goto _3 + _3: + ; + i++ + } + if i == (*TExprList)(unsafe.Pointer(pEList)).FnExpr { + prRhsHasNull = uintptr(0) + } + } + /* Check to see if an existing table or index can be used to + ** satisfy the query. This is preferable to generating a new + ** ephemeral table. */ + if v5 = (*TParse)(unsafe.Pointer(pParse)).FnErr == 0; v5 { + v4 = _isCandidateForInOpt(tls, pX) + p = v4 + } + if v5 && v4 != uintptr(0) { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database idx for pTab */ + pEList1 = (*TSelect)(unsafe.Pointer(p)).FpEList + nExpr = (*TExprList)(unsafe.Pointer(pEList1)).FnExpr + /* Because of isCandidateForInOpt(p) */ + /* Because of isCandidateForInOpt(p) */ + /* Because of isCandidateForInOpt(p) */ + pTab = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab + /* Code an OP_Transaction and OP_TableLock for
    . */ + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _sqlite3CodeVerifySchema(tls, pParse, iDb) + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab)).FzName) + /* sqlite3GetVdbe() has always been previously called */ + if nExpr == int32(1) && int32((*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList1 + 8))).FpExpr)).FiColumn) < 0 { + /* The "x IN (SELECT rowid FROM table)" case */ + iAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) + eType = int32(IN_INDEX_ROWID) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+7947, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VdbeJumpHere(tls, v, iAddr) + } else { /* Iterator variable */ + affinity_ok = int32(1) + /* Check that the affinity that will be used to perform each + ** comparison is the same as the affinity of each column in table + ** on the RHS of the IN operator. If it not, it is not possible to + ** use any index of the RHS table. */ + i1 = 0 + for { + if !(i1 < nExpr && affinity_ok != 0) { + break + } + pLhs = _sqlite3VectorFieldSubexpr(tls, (*TExpr)(unsafe.Pointer(pX)).FpLeft, i1) + iCol = int32((*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList1 + 8 + uintptr(i1)*32))).FpExpr)).FiColumn) + idxaff = _sqlite3TableColumnAffinity(tls, pTab, iCol) /* RHS table */ + cmpaff = _sqlite3CompareAffinity(tls, pLhs, idxaff) + switch int32(cmpaff) { + case int32(SQLITE_AFF_BLOB): + case int32(SQLITE_AFF_TEXT): + /* sqlite3CompareAffinity() only returns TEXT if one side or the + ** other has no affinity and the other side is TEXT. Hence, + ** the only way for cmpaff to be TEXT is for idxaff to be TEXT + ** and for the term on the LHS of the IN to have no affinity. */ + default: + affinity_ok = libc.BoolInt32(int32(idxaff) >= int32(SQLITE_AFF_NUMERIC)) + } + goto _6 + _6: + ; + i1++ + } + if affinity_ok != 0 { + /* Search for an existing index that will work for this IN operator */ + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0 && eType == 0) { + break + } /* Mask for the current column */ + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) < nExpr { + goto _7 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) { + goto _7 + } + /* Maximum nColumn is BMS-2, not BMS-1, so that we can compute + ** BITMASK(nExpr) without overflowing */ + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + goto _7 + } + if mustBeUnique != 0 { + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) > nExpr || int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) > nExpr && !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != libc.Int32FromInt32(OE_None)) { + goto _7 /* This index is not unique over the IN RHS columns */ + } + } + colUsed = uint64(0) /* Columns of index used so far */ + i1 = 0 + for { + if !(i1 < nExpr) { + break + } + pLhs1 = _sqlite3VectorFieldSubexpr(tls, (*TExpr)(unsafe.Pointer(pX)).FpLeft, i1) + pRhs = (*(*TExprList_item)(unsafe.Pointer(pEList1 + 8 + uintptr(i1)*32))).FpExpr + pReq = _sqlite3BinaryCompareCollSeq(tls, pParse, pLhs1, pRhs) + j = 0 + for { + if !(j < nExpr) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) != int32((*TExpr)(unsafe.Pointer(pRhs)).FiColumn) { + goto _9 + } + if pReq != uintptr(0) && _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pReq)).FzName, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8))) != 0 { + goto _9 + } + break + goto _9 + _9: + ; + j++ + } + if j == nExpr { + break + } + mCol = libc.Uint64FromInt32(1) << j + if mCol&colUsed != 0 { + break + } /* Each column used only once */ + colUsed |= mCol + if aiMap != 0 { + *(*int32)(unsafe.Pointer(aiMap + uintptr(i1)*4)) = j + } + goto _8 + _8: + ; + i1++ + } + if colUsed == libc.Uint64FromInt32(1)<iTable, +// ** however the cursor number returned might not be the same, as it might +// ** have been duplicated using OP_OpenDup. +// ** +// ** If the LHS expression ("x" in the examples) is a column value, or +// ** the SELECT statement returns a column value, then the affinity of that +// ** column is used to build the index keys. If both 'x' and the +// ** SELECT... statement are columns, then numeric affinity is used +// ** if either column has NUMERIC or INTEGER affinity. If neither +// ** 'x' nor the SELECT... statement are columns, then numeric affinity +// ** is used. +// */ +func _sqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var addr, addrOnce, i, i1, nVal, r1, r2, rc, v1, v4 int32 + var p, pCopy, pE2, pEList, pItem, pKeyInfo, pLeft, pList, pSelect, v, v2, v3 uintptr + var _ /* affinity at bp+40 */ int8 + var _ /* dest at bp+0 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addrOnce, i, i1, nVal, p, pCopy, pE2, pEList, pItem, pKeyInfo, pLeft, pList, pSelect, r1, r2, rc, v, v1, v2, v3, v4 + addrOnce = 0 /* the LHS of the IN operator */ + pKeyInfo = uintptr(0) /* The prepared statement under construction */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* The evaluation of the IN must be repeated every time it + ** is encountered if any of the following is true: + ** + ** * The right-hand side is a correlated subquery + ** * The right-hand side is an expression list containing variables + ** * We are inside a trigger + ** + ** If all of the above are false, then we can compute the RHS just once + ** and reuse it many names. + */ + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_VarSelect)) != libc.Uint32FromInt32(0)) && (*TParse)(unsafe.Pointer(pParse)).FiSelfTab == 0 { + /* Reuse of the RHS is allowed */ + /* If this routine has already been coded, but the previous code + ** might not have been invoked yet, so invoke it now as a subroutine. + */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Subrtn)) != uint32(0) { + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8069, libc.VaList(bp+56, (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FselId)) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), iTab, (*TExpr)(unsafe.Pointer(pExpr)).FiTable) + _sqlite3VdbeJumpHere(tls, v, addrOnce) + return + } + /* Begin coding the subroutine */ + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Subrtn)) + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn = v1 + (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr = _sqlite3VdbeAddOp2(tls, v, int32(OP_BeginSubrtn), 0, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn) + int32(1) + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } + /* Check to see if this is a vector IN operator */ + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + nVal = _sqlite3ExprVectorSize(tls, pLeft) + /* Construct the ephemeral table that will contain the content of + ** RHS of the IN operator. + */ + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = iTab + addr = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TExpr)(unsafe.Pointer(pExpr)).FiTable, nVal) + pKeyInfo = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, nVal, int32(1)) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + /* Case 1: expr IN (SELECT ...) + ** + ** Generate code to write the results of the select into the temporary + ** table allocated and opened above. + */ + pSelect = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + if addrOnce != 0 { + v3 = __ccgo_ts + 1680 + } else { + v3 = __ccgo_ts + 8092 + } + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+8104, libc.VaList(bp+56, v3, (*TSelect)(unsafe.Pointer(pSelect)).FselId)) + /* If the LHS and RHS of the IN operator do not match, that + ** error will have been caught long before we reach this point. */ + if (*TExprList)(unsafe.Pointer(pEList)).FnExpr == nVal { + _sqlite3SelectDestInit(tls, bp, int32(SRT_Set), iTab) + (*(*TSelectDest)(unsafe.Pointer(bp))).FzAffSdst = _exprINAffinity(tls, pParse, pExpr) + (*TSelect)(unsafe.Pointer(pSelect)).FiLimit = 0 + /* Caused by OOM in sqlite3KeyInfoAlloc() */ + pCopy = _sqlite3SelectDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSelect, 0) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + v4 = int32(1) + } else { + v4 = _sqlite3Select(tls, pParse, pCopy, bp) + } + rc = v4 + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pCopy) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TSelectDest)(unsafe.Pointer(bp))).FzAffSdst) + if rc != 0 { + _sqlite3KeyInfoUnref(tls, pKeyInfo) + return + } + /* OOM will cause exit after sqlite3Select() */ + i = 0 + for { + if !(i < nVal) { + break + } + p = _sqlite3VectorFieldSubexpr(tls, pLeft, i) + *(*uintptr)(unsafe.Pointer(pKeyInfo + 32 + uintptr(i)*8)) = _sqlite3BinaryCompareCollSeq(tls, pParse, p, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr) + goto _5 + _5: + ; + i++ + } + } + } else { + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + *(*int8)(unsafe.Pointer(bp + 40)) = _sqlite3ExprAffinity(tls, pLeft) + if int32(*(*int8)(unsafe.Pointer(bp + 40))) <= int32(SQLITE_AFF_NONE) { + *(*int8)(unsafe.Pointer(bp + 40)) = int8(SQLITE_AFF_BLOB) + } else { + if int32(*(*int8)(unsafe.Pointer(bp + 40))) == int32(SQLITE_AFF_REAL) { + *(*int8)(unsafe.Pointer(bp + 40)) = int8(SQLITE_AFF_NUMERIC) + } + } + if pKeyInfo != 0 { + *(*uintptr)(unsafe.Pointer(pKeyInfo + 32)) = _sqlite3ExprCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + } + /* Loop through each expression in . */ + r1 = _sqlite3GetTempReg(tls, pParse) + r2 = _sqlite3GetTempReg(tls, pParse) + i1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + pItem = pList + 8 + for { + if !(i1 > 0) { + break + } + pE2 = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + /* If the expression is not constant then we will need to + ** disable the test that was generated above that makes sure + ** this code only executes once. Because for a non-constant + ** expression we need to rerun this code each time. + */ + if addrOnce != 0 && !(_sqlite3ExprIsConstant(tls, pE2) != 0) { + _sqlite3VdbeChangeToNoop(tls, v, addrOnce-int32(1)) + _sqlite3VdbeChangeToNoop(tls, v, addrOnce) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Subrtn)) + addrOnce = 0 + } + /* Evaluate the expression and insert it into the temp table */ + _sqlite3ExprCode(tls, pParse, pE2, r1) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), r1, int32(1), r2, bp+40, int32(1)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iTab, r2, r1, int32(1)) + goto _6 + _6: + ; + i1-- + pItem += 32 + } + _sqlite3ReleaseTempReg(tls, pParse, r1) + _sqlite3ReleaseTempReg(tls, pParse, r2) + } + } + if pKeyInfo != 0 { + _sqlite3VdbeChangeP4(tls, v, addr, pKeyInfo, -int32(8)) + } + if addrOnce != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), iTab) + _sqlite3VdbeJumpHere(tls, v, addrOnce) + /* Subroutine return */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr, int32(1)) + _sqlite3ClearTempRegCache(tls, pParse) + } +} + +// C documentation +// +// /* +// ** Generate code for scalar subqueries used as a subquery expression +// ** or EXISTS operator: +// ** +// ** (SELECT a FROM b) -- subquery +// ** EXISTS (SELECT a FROM b) -- EXISTS subquery +// ** +// ** The pExpr parameter is the SELECT or EXISTS operator to be coded. +// ** +// ** Return the register that holds the result. For a multi-column SELECT, +// ** the result is stored in a contiguous array of registers and the +// ** return value is the register of the left-most result column. +// ** Return 0 if an error occurs. +// */ +func _sqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var addrOnce, nReg, rReg, v1, v4, v5 int32 + var db, pLimit, pSel, v, v2, v3 uintptr + var _ /* dest at bp+0 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _ = addrOnce, db, nReg, pLimit, pSel, rReg, v, v1, v2, v3, v4, v5 + addrOnce = 0 /* Address of OP_Once at top of subroutine */ + rReg = 0 /* New limit expression */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return 0 + } + pSel = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + /* If this routine has already been coded, then invoke it as a + ** subroutine. */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Subrtn)) != uint32(0) { + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+8123, libc.VaList(bp+48, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr) + return (*TExpr)(unsafe.Pointer(pExpr)).FiTable + } + /* Begin coding the subroutine */ + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Subrtn)) + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn = v1 + (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr = _sqlite3VdbeAddOp2(tls, v, int32(OP_BeginSubrtn), 0, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn) + int32(1) + /* The evaluation of the EXISTS/SELECT must be repeated every time it + ** is encountered if any of the following is true: + ** + ** * The right-hand side is a correlated subquery + ** * The right-hand side is an expression list containing variables + ** * We are inside a trigger + ** + ** If all of the above are false, then we can run this code just once + ** save the results, and reuse the same result on subsequent invocations. + */ + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_VarSelect)) != libc.Uint32FromInt32(0)) { + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } + /* For a SELECT, generate code to put the values for all columns of + ** the first row into an array of registers and return the index of + ** the first register. + ** + ** If this is an EXISTS, write an integer 0 (not exists) or 1 (exists) + ** into a register and return that register number. + ** + ** In both cases, the query is augmented with "LIMIT 1". Any + ** preexisting limit is discarded in place of the new LIMIT 1. + */ + if addrOnce != 0 { + v3 = __ccgo_ts + 1680 + } else { + v3 = __ccgo_ts + 8092 + } + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+8141, libc.VaList(bp+48, v3, (*TSelect)(unsafe.Pointer(pSel)).FselId)) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) { + v4 = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpEList)).FnExpr + } else { + v4 = int32(1) + } + nReg = v4 + _sqlite3SelectDestInit(tls, bp, 0, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1)) + *(*int32)(unsafe.Pointer(pParse + 56)) += nReg + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_SELECT) { + (*(*TSelectDest)(unsafe.Pointer(bp))).FeDest = uint8(SRT_Mem) + (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm + (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst = nReg + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm, (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm+nReg-int32(1)) + } else { + (*(*TSelectDest)(unsafe.Pointer(bp))).FeDest = uint8(SRT_Exists) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm) + } + if (*TSelect)(unsafe.Pointer(pSel)).FpLimit != 0 { + /* The subquery already has a limit. If the pre-existing limit is X + ** then make the new limit X<>0 so that the new limit is either 1 or 0 */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pLimit = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1754) + if pLimit != 0 { + (*TExpr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) + pLimit = _sqlite3PExpr(tls, pParse, int32(TK_NE), _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpLimit)).FpLeft, 0), pLimit) + } + _sqlite3ExprDeferredDelete(tls, pParse, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpLimit)).FpLeft) + (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit + } else { + /* If there is no pre-existing limit add a limit of 1 */ + pLimit = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), __ccgo_ts+8162) + (*TSelect)(unsafe.Pointer(pSel)).FpLimit = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), pLimit, uintptr(0)) + } + (*TSelect)(unsafe.Pointer(pSel)).FiLimit = 0 + if _sqlite3Select(tls, pParse, pSel, bp) != 0 { + (*TExpr)(unsafe.Pointer(pExpr)).Fop2 = (*TExpr)(unsafe.Pointer(pExpr)).Fop + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_ERROR) + return 0 + } + v5 = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm + rReg = v5 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = v5 + if addrOnce != 0 { + _sqlite3VdbeJumpHere(tls, v, addrOnce) + } + /* Subroutine return */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FregReturn, (*(*struct { + FiAddr int32 + FregReturn int32 + })(unsafe.Pointer(pExpr + 64))).FiAddr, int32(1)) + _sqlite3ClearTempRegCache(tls, pParse) + return rReg +} + +// C documentation +// +// /* +// ** Expr pIn is an IN(...) expression. This function checks that the +// ** sub-select on the RHS of the IN() operator has the same number of +// ** columns as the vector on the LHS. Or, if the RHS of the IN() is not +// ** a sub-query, that the LHS is a vector of size 1. +// */ +func _sqlite3ExprCheckIN(tls *libc.TLS, pParse uintptr, pIn uintptr) (r int32) { + var nVector int32 + _ = nVector + nVector = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pIn)).FpLeft) + if (*TExpr)(unsafe.Pointer(pIn)).Fflags&uint32(EP_xIsSelect) != uint32(0) && !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + if nVector != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pIn + 32)))).FpEList)).FnExpr { + _sqlite3SubselectError(tls, pParse, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pIn + 32)))).FpEList)).FnExpr, nVector) + return int32(1) + } + } else { + if nVector != int32(1) { + _sqlite3VectorErrorMsg(tls, pParse, (*TExpr)(unsafe.Pointer(pIn)).FpLeft) + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** Generate code for an IN expression. +// ** +// ** x IN (SELECT ...) +// ** x IN (value, value, ...) +// ** +// ** The left-hand side (LHS) is a scalar or vector expression. The +// ** right-hand side (RHS) is an array of zero or more scalar values, or a +// ** subquery. If the RHS is a subquery, the number of result columns must +// ** match the number of columns in the vector on the LHS. If the RHS is +// ** a list of values, the LHS must be a scalar. +// ** +// ** The IN operator is true if the LHS value is contained within the RHS. +// ** The result is false if the LHS is definitely not in the RHS. The +// ** result is NULL if the presence of the LHS in the RHS cannot be +// ** determined due to NULLs. +// ** +// ** This routine generates code that jumps to destIfFalse if the LHS is not +// ** contained within the RHS. If due to NULLs we cannot determine if the LHS +// ** is contained in the RHS then jump to destIfNull. If the LHS is contained +// ** within the RHS then fall through. +// ** +// ** See the separate in-operator.md documentation file in the canonical +// ** SQLite source tree for additional information. +// */ +func _sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFalse int32, destIfNull int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var addrTop, addrTruthOp, destNotNull, destStep2, destStep6, eType, i, ii, labelOk, nVector, op, op1, r2, r3, rLhs, rLhsOrig, regCkNull, v5, v6, v7 int32 + var aiMap, p, p1, pColl, pColl1, pLeft, pList, v, zAff, v1 uintptr + var okConstFactor Tu8 + var _ /* iDummy at bp+4 */ int32 + var _ /* iTab at bp+8 */ int32 + var _ /* rRhsHasNull at bp+0 */ int32 + var _ /* regToFree at bp+12 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrTop, addrTruthOp, aiMap, destNotNull, destStep2, destStep6, eType, i, ii, labelOk, nVector, okConstFactor, op, op1, p, p1, pColl, pColl1, pLeft, pList, r2, r3, rLhs, rLhsOrig, regCkNull, v, zAff, v1, v5, v6, v7 + *(*int32)(unsafe.Pointer(bp)) = 0 /* Statement under construction */ + aiMap = uintptr(0) /* Map from vector field to index column */ + zAff = uintptr(0) /* Where to jump when NULLs seen in step 2 */ + destStep6 = 0 /* Top of the step-6 loop */ + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* Index to use */ + okConstFactor = (*TParse)(unsafe.Pointer(pParse)).FokConstFactor + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if _sqlite3ExprCheckIN(tls, pParse, pExpr) != 0 { + return + } + zAff = _exprINAffinity(tls, pParse, pExpr) + nVector = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nVector)*(libc.Uint64FromInt64(4)+libc.Uint64FromInt64(1))+uint64(1)) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + goto sqlite3ExprCodeIN_oom_error + } + /* Attempt to compute the RHS. After this step, if anything other than + ** IN_INDEX_NOOP is returned, the table opened with cursor iTab + ** contains the values that make up the RHS. If IN_INDEX_NOOP is returned, + ** the RHS has not yet been coded. */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* OOM detected prior to this routine */ + if destIfFalse == destIfNull { + v1 = uintptr(0) + } else { + v1 = bp + } + eType = _sqlite3FindInIndex(tls, pParse, pExpr, uint32(libc.Int32FromInt32(IN_INDEX_MEMBERSHIP)|libc.Int32FromInt32(IN_INDEX_NOOP_OK)), v1, aiMap, bp+8) + /* Code the LHS, the from " IN (...)". If the LHS is a + ** vector, then it is stored in an array of nVector registers starting + ** at r1. + ** + ** sqlite3FindInIndex() might have reordered the fields of the LHS vector + ** so that the fields are in the same order as an existing index. The + ** aiMap[] array contains a mapping from the original LHS field order to + ** the field order that matches the RHS index. + ** + ** Avoid factoring the LHS of the IN(...) expression out of the loop, + ** even if it is constant, as OP_Affinity may be used on the register + ** by code generated below. */ + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) + rLhsOrig = _exprCodeVector(tls, pParse, pLeft, bp+4) + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor + i = 0 + for { + if !(i < nVector && *(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)) == i) { + break + } + goto _2 + _2: + ; + i++ + } /* Are LHS fields reordered? */ + if i == nVector { + /* LHS fields are not reordered */ + rLhs = rLhsOrig + } else { + /* Need to reorder the LHS fields according to aiMap */ + rLhs = _sqlite3GetTempRange(tls, pParse, nVector) + i = 0 + for { + if !(i < nVector) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), rLhsOrig+i, rLhs+*(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)), 0) + goto _3 + _3: + ; + i++ + } + } + /* If sqlite3FindInIndex() did not find or create an index that is + ** suitable for evaluating the IN operator, then evaluate using a + ** sequence of comparisons. + ** + ** This is step (1) in the in-operator.md optimized algorithm. + */ + if eType == int32(IN_INDEX_NOOP) { + labelOk = _sqlite3VdbeMakeLabel(tls, pParse) + regCkNull = 0 + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + if destIfNull != destIfFalse { + regCkNull = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_BitAnd), rLhs, rLhs, regCkNull) + } + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr, bp+12) + if regCkNull != 0 && _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_BitAnd), regCkNull, r2, regCkNull) + } + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 12))) + if ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr-int32(1) || destIfNull != destIfFalse { + if rLhs != r2 { + v5 = int32(OP_Eq) + } else { + v5 = int32(OP_NotNull) + } + op = v5 + _sqlite3VdbeAddOp4(tls, v, op, rLhs, labelOk, r2, pColl, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(*(*int8)(unsafe.Pointer(zAff)))) + } else { + if rLhs != r2 { + v6 = int32(OP_Ne) + } else { + v6 = int32(OP_IsNull) + } + op1 = v6 + _sqlite3VdbeAddOp4(tls, v, op1, rLhs, destIfFalse, r2, pColl, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(int32(*(*int8)(unsafe.Pointer(zAff)))|int32(SQLITE_JUMPIFNULL))) + } + goto _4 + _4: + ; + ii++ + } + if regCkNull != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regCkNull, destIfNull) + _sqlite3VdbeGoto(tls, v, destIfFalse) + } + _sqlite3VdbeResolveLabel(tls, v, labelOk) + _sqlite3ReleaseTempReg(tls, pParse, regCkNull) + goto sqlite3ExprCodeIN_finished + } + /* Step 2: Check to see if the LHS contains any NULL columns. If the + ** LHS does contain NULLs then the result must be either FALSE or NULL. + ** We will then skip the binary search of the RHS. + */ + if destIfNull == destIfFalse { + destStep2 = destIfFalse + } else { + v7 = _sqlite3VdbeMakeLabel(tls, pParse) + destStep6 = v7 + destStep2 = v7 + } + i = 0 + for { + if !(i < nVector) { + break + } + p = _sqlite3VectorFieldSubexpr(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, i) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto sqlite3ExprCodeIN_oom_error + } + if _sqlite3ExprCanBeNull(tls, p) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), rLhs+i, destStep2) + } + goto _8 + _8: + ; + i++ + } + /* Step 3. The LHS is now known to be non-NULL. Do the binary search + ** of the RHS using the LHS as a probe. If found, the result is + ** true. + */ + if eType == int32(IN_INDEX_ROWID) { + /* In this case, the RHS is the ROWID of table b-tree and so we also + ** know that the RHS is non-NULL. Hence, we combine steps 3 and 4 + ** into a single opcode. */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), *(*int32)(unsafe.Pointer(bp + 8)), destIfFalse, rLhs) + addrTruthOp = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) /* Return True */ + } else { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), rLhs, nVector, 0, zAff, nVector) + if destIfFalse == destIfNull { + /* Combine Step 3 and Step 5 into a single opcode */ + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), *(*int32)(unsafe.Pointer(bp + 8)), destIfFalse, rLhs, nVector) + goto sqlite3ExprCodeIN_finished + } + /* Ordinary Step 3, for the case where FALSE and NULL are distinct */ + addrTruthOp = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 8)), 0, rLhs, nVector) + } + /* Step 4. If the RHS is known to be non-NULL and we did not find + ** an match on the search above, then the result must be FALSE. + */ + if *(*int32)(unsafe.Pointer(bp)) != 0 && nVector == int32(1) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), *(*int32)(unsafe.Pointer(bp)), destIfFalse) + } + /* Step 5. If we do not care about the difference between NULL and + ** FALSE, then just return false. + */ + if destIfFalse == destIfNull { + _sqlite3VdbeGoto(tls, v, destIfFalse) + } + /* Step 6: Loop through rows of the RHS. Compare each row to the LHS. + ** If any comparison is NULL, then the result is NULL. If all + ** comparisons are FALSE then the final result is FALSE. + ** + ** For a scalar LHS, it is sufficient to check just the first row + ** of the RHS. + */ + if destStep6 != 0 { + _sqlite3VdbeResolveLabel(tls, v, destStep6) + } + addrTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), *(*int32)(unsafe.Pointer(bp + 8)), destIfFalse) + if nVector > int32(1) { + destNotNull = _sqlite3VdbeMakeLabel(tls, pParse) + } else { + /* For nVector==1, combine steps 6 and 7 by immediately returning + ** FALSE if the first comparison is not NULL */ + destNotNull = destIfFalse + } + i = 0 + for { + if !(i < nVector) { + break + } + r3 = _sqlite3GetTempReg(tls, pParse) + p1 = _sqlite3VectorFieldSubexpr(tls, pLeft, i) + pColl1 = _sqlite3ExprCollSeq(tls, pParse, p1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), *(*int32)(unsafe.Pointer(bp + 8)), i, r3) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Ne), rLhs+i, destNotNull, r3, pColl1, -int32(2)) + _sqlite3ReleaseTempReg(tls, pParse, r3) + goto _9 + _9: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, destIfNull) + if nVector > int32(1) { + _sqlite3VdbeResolveLabel(tls, v, destNotNull) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 8)), addrTop+int32(1)) + /* Step 7: If we reach this point, we know that the result must + ** be false. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, destIfFalse) + } + /* Jumps here in order to return true. */ + _sqlite3VdbeJumpHere(tls, v, addrTruthOp) +sqlite3ExprCodeIN_finished: + ; + if rLhs != rLhsOrig { + _sqlite3ReleaseTempReg(tls, pParse, rLhs) + } +sqlite3ExprCodeIN_oom_error: + ; + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiMap) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zAff) +} + +// C documentation +// +// /* +// ** Generate an instruction that will put the floating point +// ** value described by z[0..n-1] into register iMem. +// ** +// ** The z[] string will probably not be zero-terminated. But the +// ** z[n] character is guaranteed to be something that does not look +// ** like the continuation of the number. +// */ +func _codeReal(tls *libc.TLS, v uintptr, z uintptr, negateFlag int32, iMem int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* value at bp+0 */ float64 + if z != uintptr(0) { + _sqlite3AtoF(tls, z, bp, _sqlite3Strlen30(tls, z), uint8(SQLITE_UTF8)) + /* The new AtoF never returns NaN */ + if negateFlag != 0 { + *(*float64)(unsafe.Pointer(bp)) = -*(*float64)(unsafe.Pointer(bp)) + } + _sqlite3VdbeAddOp4Dup8(tls, v, int32(OP_Real), 0, iMem, 0, bp, -int32(12)) + } +} + +// C documentation +// +// /* +// ** Generate an instruction that will put the integer describe by +// ** text z[0..n-1] into register iMem. +// ** +// ** Expr.u.zToken is always UTF8 and zero-terminated. +// */ +func _codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iMem int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var c, i int32 + var v, z, v1 uintptr + var v2 int64 + var _ /* value at bp+0 */ Ti64 + _, _, _, _, _, _ = c, i, v, z, v1, v2 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_IntValue) != 0 { + i = *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) + if negFlag != 0 { + i = -i + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), i, iMem) + } else { + z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + c = _sqlite3DecOrHexToI64(tls, z, bp) + if c == int32(3) && !(negFlag != 0) || c == int32(2) || negFlag != 0 && *(*Ti64)(unsafe.Pointer(bp)) == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0 { + iAddr = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNullRow), (*TParse)(unsafe.Pointer(pParse)).FiSelfTab-int32(1), 0, regOut) + } else { + iAddr = 0 + } + _sqlite3ExprCodeCopy(tls, pParse, _sqlite3ColumnExpr(tls, pTab, pCol), regOut) + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) >= int32(SQLITE_AFF_TEXT) { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), regOut, int32(1), 0, pCol+9, int32(1)) + } + if iAddr != 0 { + _sqlite3VdbeJumpHere(tls, v, iAddr) + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr > nErr { + (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FerrByteOffset = -int32(1) + } +} + +// C documentation +// +// /* +// ** Generate code to extract the value of the iCol-th column of a table. +// */ +func _sqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iTabCur int32, iCol int32, regOut int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var op, savedSelfTab, x int32 + var pCol, pParse, v1, p2, p3 uintptr + _, _, _, _, _, _, _, _ = op, pCol, pParse, savedSelfTab, x, v1, p2, p3 + if iCol < 0 || iCol == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iTabCur, regOut) + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + op = int32(OP_VColumn) + x = iCol + } else { + v1 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + pCol = v1 + if int32((*TColumn)(unsafe.Pointer(v1)).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + pParse = _sqlite3VdbeParser(tls, v) + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_BUSY) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8194, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + } else { + savedSelfTab = (*TParse)(unsafe.Pointer(pParse)).FiSelfTab + p2 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(COLFLAG_BUSY)) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = iTabCur + int32(1) + _sqlite3ExprCodeGeneratedColumn(tls, pParse, pTab, pCol, regOut) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = savedSelfTab + p3 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(COLFLAG_BUSY)) + } + return + } else { + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + x = int32(_sqlite3TableColumnToIndex(tls, _sqlite3PrimaryKeyIndex(tls, pTab), int16(iCol))) + op = int32(OP_Column) + } else { + x = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(iCol))) + op = int32(OP_Column) + } + } + } + _sqlite3VdbeAddOp3(tls, v, op, iTabCur, x, regOut) + _sqlite3ColumnDefault(tls, v, pTab, iCol, regOut) + } +} + +// C documentation +// +// /* +// ** Generate code that will extract the iColumn-th column from +// ** table pTab and store the column value in register iReg. +// ** +// ** There must be an open cursor to pTab in iTable when this routine +// ** is called. If iColumn<0 then code is generated that extracts the rowid. +// */ +func _sqlite3ExprCodeGetColumn(tls *libc.TLS, pParse uintptr, pTab uintptr, iColumn int32, iTable int32, iReg int32, p5 Tu8) (r int32) { + var pOp uintptr + _ = pOp + _sqlite3ExprCodeGetColumnOfTable(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, pTab, iTable, iColumn, iReg) + if p5 != 0 { + pOp = _sqlite3VdbeGetLastOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe) + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(p5) + } + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_VColumn) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(int32(p5) & libc.Int32FromInt32(OPFLAG_NOCHNG)) + } + } + return iReg +} + +// C documentation +// +// /* +// ** Generate code to move content from registers iFrom...iFrom+nReg-1 +// ** over to iTo..iTo+nReg-1. +// */ +func _sqlite3ExprCodeMove(tls *libc.TLS, pParse uintptr, iFrom int32, iTo int32, nReg int32) { + _sqlite3VdbeAddOp3(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Move), iFrom, iTo, nReg) +} + +// C documentation +// +// /* +// ** Convert a scalar expression node to a TK_REGISTER referencing +// ** register iReg. The caller must ensure that iReg already contains +// ** the correct value for the expression. +// */ +func _exprToRegister(tls *libc.TLS, pExpr uintptr, iReg int32) { + var p uintptr + _ = p + p = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) + if p == uintptr(0) { + return + } + (*TExpr)(unsafe.Pointer(p)).Fop2 = (*TExpr)(unsafe.Pointer(p)).Fop + (*TExpr)(unsafe.Pointer(p)).Fop = uint8(TK_REGISTER) + (*TExpr)(unsafe.Pointer(p)).FiTable = iReg + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(EP_Skip)) +} + +// C documentation +// +// /* +// ** Evaluate an expression (either a vector or a scalar expression) and store +// ** the result in contiguous temporary registers. Return the index of +// ** the first register used to store the result. +// ** +// ** If the returned result register is a temporary scalar, then also write +// ** that register number into *piFreeable. If the returned result register +// ** is not a temporary or if the expression is a vector set *piFreeable +// ** to 0. +// */ +func _exprCodeVector(tls *libc.TLS, pParse uintptr, p uintptr, piFreeable uintptr) (r int32) { + var i, iResult, nResult int32 + _, _, _ = i, iResult, nResult + nResult = _sqlite3ExprVectorSize(tls, p) + if nResult == int32(1) { + iResult = _sqlite3ExprCodeTemp(tls, pParse, p, piFreeable) + } else { + *(*int32)(unsafe.Pointer(piFreeable)) = 0 + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_SELECT) { + iResult = _sqlite3CodeSubselect(tls, pParse, p) + } else { + iResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nResult + i = 0 + for { + if !(i < nResult) { + break + } + _sqlite3ExprCodeFactorable(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, i+iResult) + goto _1 + _1: + ; + i++ + } + } + } + return iResult +} + +// C documentation +// +// /* +// ** If the last opcode is a OP_Copy, then set the do-not-merge flag (p5) +// ** so that a subsequent copy will not be merged into this one. +// */ +func _setDoNotMergeFlagOnCopy(tls *libc.TLS, v uintptr) { + if int32((*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetLastOp(tls, v))).Fopcode) == int32(OP_Copy) { + _sqlite3VdbeChangeP5(tls, v, uint16(1)) /* Tag trailing OP_Copy as not mergeable */ + } +} + +// C documentation +// +// /* +// ** Generate code to implement special SQL functions that are implemented +// ** in-line rather than by using the usual callbacks. +// */ +func _exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFuncId int32, target int32) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var aff int8 + var azAff [6]uintptr + var endCoalesce, i, nFarg int32 + var pA1, pArg, v, v2 uintptr + var _ /* caseExpr at bp+0 */ TExpr + _, _, _, _, _, _, _, _, _ = aff, azAff, endCoalesce, i, nFarg, pA1, pArg, v, v2 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + nFarg = (*TExprList)(unsafe.Pointer(pFarg)).FnExpr + /* All in-line functions have at least one argument */ + switch iFuncId { + case INLINEFUNC_coalesce: + /* Attempt a direct implementation of the built-in COALESCE() and + ** IFNULL() functions. This avoids unnecessary evaluation of + ** arguments past the first non-NULL argument. + */ + endCoalesce = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, target) + i = int32(1) + for { + if !(i < nFarg) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), target, endCoalesce) + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + uintptr(i)*32))).FpExpr, target) + goto _1 + _1: + ; + i++ + } + _setDoNotMergeFlagOnCopy(tls, v) + _sqlite3VdbeResolveLabel(tls, v, endCoalesce) + case int32(INLINEFUNC_iif): + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_CASE) + *(*uintptr)(unsafe.Pointer(bp + 32)) = pFarg + return _sqlite3ExprCodeTarget(tls, pParse, bp, target) + case int32(INLINEFUNC_sqlite_offset): + pArg = (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pArg)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pArg)).FiTable >= 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Offset), (*TExpr)(unsafe.Pointer(pArg)).FiTable, int32((*TExpr)(unsafe.Pointer(pArg)).FiColumn), target) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + } + default: + /* The UNLIKELY() function is a no-op. The result is the value + ** of the first argument. + */ + target = _sqlite3ExprCodeTarget(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, target) + break + /*********************************************************************** + ** Test-only SQL functions that are only usable if enabled + ** via SQLITE_TESTCTRL_INTERNAL_FUNCTIONS + */ + fallthrough + case int32(INLINEFUNC_expr_compare): + /* Compare two expressions using sqlite3ExprCompare() */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr, -int32(1)), target) + case int32(INLINEFUNC_expr_implies_expr): + /* Compare two expressions using sqlite3ExprImpliesExpr() */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprImpliesExpr(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr, -int32(1)), target) + case int32(INLINEFUNC_implies_nonnull_row): + pA1 = (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pA1)).Fop) == int32(TK_COLUMN) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprImpliesNonNullRow(tls, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr, (*TExpr)(unsafe.Pointer(pA1)).FiTable, int32(1)), target) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + } + case int32(INLINEFUNC_affinity): + /* The AFFINITY() function evaluates to a string that describes + ** the type affinity of the argument. This is used for testing of + ** the SQLite type logic. + */ + azAff = [6]uintptr{ + 0: __ccgo_ts + 8224, + 1: __ccgo_ts + 8229, + 2: __ccgo_ts + 8234, + 3: __ccgo_ts + 6338, + 4: __ccgo_ts + 6333, + 5: __ccgo_ts + 8242, + } + aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr) + if int32(aff) <= int32(SQLITE_AFF_NONE) { + v2 = __ccgo_ts + 8250 + } else { + v2 = azAff[int32(aff)-int32(SQLITE_AFF_BLOB)] + } + _sqlite3VdbeLoadString(tls, v, target, v2) + break + } + return target +} + +// C documentation +// +// /* +// ** Check to see if pExpr is one of the indexed expressions on pParse->pIdxEpr. +// ** If it is, then resolve the expression by reading from the index and +// ** return the register into which the value has been read. If pExpr is +// ** not an indexed expression, then return negative. +// */ +func _sqlite3IndexedExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) (r int32) { + var addr, iDataCur int32 + var exprAff Tu8 + var p, v uintptr + _, _, _, _, _ = addr, exprAff, iDataCur, p, v + p = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + for { + if !(p != 0) { + break + } + iDataCur = (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur + if iDataCur < 0 { + goto _1 + } + if (*TParse)(unsafe.Pointer(pParse)).FiSelfTab != 0 { + if (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur != (*TParse)(unsafe.Pointer(pParse)).FiSelfTab-int32(1) { + goto _1 + } + iDataCur = -int32(1) + } + if _sqlite3ExprCompare(tls, uintptr(0), pExpr, (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr, iDataCur) != 0 { + goto _1 + } + exprAff = uint8(_sqlite3ExprAffinity(tls, pExpr)) + if int32(exprAff) <= int32(SQLITE_AFF_BLOB) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_BLOB) || int32(exprAff) == int32(SQLITE_AFF_TEXT) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_TEXT) || int32(exprAff) >= int32(SQLITE_AFF_NUMERIC) && int32((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_NUMERIC) { + /* Affinity mismatch on a generated column */ + goto _1 + } + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow != 0 { + /* If the index is on a NULL row due to an outer join, then we + ** cannot extract the value from the index. The value must be + ** computed using the original expression. */ + addr = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNullRow), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, addr+int32(3), target) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol, target) + _sqlite3VdbeGoto(tls, v, 0) + p = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = uintptr(0) + _sqlite3ExprCode(tls, pParse, pExpr, target) + (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = p + _sqlite3VdbeJumpHere(tls, v, addr+int32(2)) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol, target) + } + return target + goto _1 + _1: + ; + p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext + } + return -int32(1) /* Not found */ +} + +// C documentation +// +// /* +// ** Expresion pExpr is guaranteed to be a TK_COLUMN or equivalent. This +// ** function checks the Parse.pIdxPartExpr list to see if this column +// ** can be replaced with a constant value. If so, it generates code to +// ** put the constant value in a register (ideally, but not necessarily, +// ** register iTarget) and returns the register number. +// ** +// ** Or, if the TK_COLUMN cannot be replaced by a constant, zero is +// ** returned. +// */ +func _exprPartidxExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTarget int32) (r int32) { + var addr, ret int32 + var p, v uintptr + _, _, _, _ = addr, p, ret, v + p = (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr + for { + if !(p != 0) { + break + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) == (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur { + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + addr = 0 + if (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow != 0 { + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNullRow), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur) + } + ret = _sqlite3ExprCodeTarget(tls, pParse, (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr, iTarget) + _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Affinity), ret, int32(1), 0, p+21, int32(1)) + if addr != 0 { + _sqlite3VdbeJumpHere(tls, v, addr) + _sqlite3VdbeChangeP3(tls, v, addr, ret) + } + return ret + } + goto _1 + _1: + ; + p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext + } + return 0 +} + +// C documentation +// +// /* +// ** Generate code into the current Vdbe to evaluate the given +// ** expression. Attempt to store the results in register "target". +// ** Return the register where results are stored. +// ** +// ** With this routine, there is no guarantee that results will +// ** be stored in target. The result might be stored in some other +// ** register if it is convenient to do so. The calling function +// ** must check the return code and move the results to the desired +// ** register. +// */ +func _sqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) (r int32) { + bp := tls.Alloc(176) + defer tls.Free(176) + var aListelem, db, db1, pAggInfo, pAggInfo1, pCol, pCol1, pColl, pDef, pDel, pEList, pFarg, pInfo, pLeft, pLeft1, pLeft2, pTab, pTab1, pTab2, pTest, pX, v, z, z1, zBlob, zId, v12, p3, p4 uintptr + var addr, addrINR, aff, bNormal, destIfFalse, destIfNull, endLabel, i, i1, iCol, iCol1, iReg, iSrc, iTab, inReg, isTrue, n, n1, nCol, nExpr, nFarg, nextCase, op, p1, p5, r1, r2, v1, v10, v14, v5, v7, v8 int32 + var constMask Tu32 + var enc, exprOp, okConstFactor Tu8 + var v11, v2, v6 bool + var _ /* opCompare at bp+80 */ TExpr + var _ /* regFree1 at bp+0 */ int32 + var _ /* regFree2 at bp+4 */ int32 + var _ /* tempX at bp+8 */ TExpr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aListelem, addr, addrINR, aff, bNormal, constMask, db, db1, destIfFalse, destIfNull, enc, endLabel, exprOp, i, i1, iCol, iCol1, iReg, iSrc, iTab, inReg, isTrue, n, n1, nCol, nExpr, nFarg, nextCase, okConstFactor, op, p1, p5, pAggInfo, pAggInfo1, pCol, pCol1, pColl, pDef, pDel, pEList, pFarg, pInfo, pLeft, pLeft1, pLeft2, pTab, pTab1, pTab2, pTest, pX, r1, r2, v, z, z1, zBlob, zId, v1, v10, v11, v12, v14, v2, v5, v6, v7, v8, p3, p4 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* The opcode being coded */ + inReg = target /* Results stored in register inReg */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* If non-zero free this temporary register */ + *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Temporary expression node */ + p5 = 0 +expr_code_doover: + ; + if pExpr == uintptr(0) { + op = int32(TK_NULL) + } else { + if v2 = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr != uintptr(0) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Leaf)) != libc.Uint32FromInt32(0)); v2 { + v1 = _sqlite3IndexedExprLookup(tls, pParse, pExpr, target) + r1 = v1 + } + if v2 && v1 >= 0 { + return r1 + } else { + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + } + } + switch op { + case int32(TK_AGG_COLUMN): + pAggInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn { + /* Happens when the left table of a RIGHT JOIN is null and + ** is using an expression index */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + break + } + pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiAgg)*24 + if !((*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode != 0) { + return (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) + } else { + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FuseSortingIdx != 0 { + pTab = (*TAggInfo_col)(unsafe.Pointer(pCol)).FpTab + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdxPTab, int32((*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn), target) + if pTab == uintptr(0) { + /* No comment added */ + } else { + if int32((*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn) < 0 { + } else { + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn)*16))).Faffinity) == int32(SQLITE_AFF_REAL) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) + } + } + } + return target + } else { + if *(*uintptr)(unsafe.Pointer(pExpr + 64)) == uintptr(0) { + /* This case happens when the argument to an aggregate function + ** is rewritten by aggregateConvertIndexedExprRefToColumn() */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TExpr)(unsafe.Pointer(pExpr)).FiTable, int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn), target) + return target + } + } + } + fallthrough + case int32(TK_COLUMN): + iTab = (*TExpr)(unsafe.Pointer(pExpr)).FiTable + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != uint32(0) { + iReg = _sqlite3ExprCodeTarget(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) + aff = int32(_sqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn))) + if aff > int32(SQLITE_AFF_BLOB) { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), iReg, int32(1), 0, uintptr(unsafe.Pointer(&_zAff))+uintptr((aff-int32('B'))*int32(2)), -int32(1)) + } + return iReg + } + if iTab < 0 { + if (*TParse)(unsafe.Pointer(pParse)).FiSelfTab < 0 { + iCol = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + pTab1 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + if iCol < 0 { + return -int32(1) - (*TParse)(unsafe.Pointer(pParse)).FiSelfTab + } + pCol1 = (*TTable)(unsafe.Pointer(pTab1)).FaCol + uintptr(iCol)*16 + iSrc = int32(_sqlite3TableColumnToStorage(tls, pTab1, int16(iCol))) - (*TParse)(unsafe.Pointer(pParse)).FiSelfTab + if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_BUSY) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8194, libc.VaList(bp+160, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + return 0 + } + p3 = pCol1 + 14 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(COLFLAG_BUSY)) + if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_NOTAVAIL) != 0 { + _sqlite3ExprCodeGeneratedColumn(tls, pParse, pTab1, pCol1, iSrc) + } + p4 = pCol1 + 14 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(COLFLAG_BUSY) | libc.Int32FromInt32(COLFLAG_NOTAVAIL))) + return iSrc + } else { + if int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_REAL) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), iSrc, target) + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) + return target + } else { + return iSrc + } + } + } else { + /* Coding an expression that is part of an index where column names + ** in the index refer to the table to which the index belongs */ + iTab = (*TParse)(unsafe.Pointer(pParse)).FiSelfTab - int32(1) + } + } else { + if v6 = (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr != 0; v6 { + v5 = _exprPartidxExprLookup(tls, pParse, pExpr, target) + r1 = v5 + } + if v6 && 0 != v5 { + return r1 + } + } + iReg = _sqlite3ExprCodeGetColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 64)), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn), iTab, target, (*TExpr)(unsafe.Pointer(pExpr)).Fop2) + return iReg + case int32(TK_INTEGER): + _codeInteger(tls, pParse, pExpr, 0, target) + return target + case int32(TK_TRUEFALSE): + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), _sqlite3ExprTruthValue(tls, pExpr), target) + return target + case int32(TK_FLOAT): + _codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pExpr + 8)), 0, target) + return target + case int32(TK_STRING): + _sqlite3VdbeLoadString(tls, v, target, *(*uintptr)(unsafe.Pointer(pExpr + 8))) + return target + default: + /* Make NULL the default case so that if a bug causes an illegal + ** Expr node to be passed into this function, it will be handled + ** sanely and not crash. But keep the assert() to bring the problem + ** to the attention of the developers. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + return target + case int32(TK_BLOB): + z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + 2 + n = _sqlite3Strlen30(tls, z) - int32(1) + zBlob = _sqlite3HexToBlob(tls, _sqlite3VdbeDb(tls, v), z, n) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Blob), n/int32(2), target, 0, zBlob, -int32(6)) + return target + case int32(TK_VARIABLE): + _sqlite3VdbeAddOp2(tls, v, int32(OP_Variable), int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn), target) + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8)) + 1))) != 0 { + z1 = _sqlite3VListNumToName(tls, (*TParse)(unsafe.Pointer(pParse)).FpVList, int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)) + *(*TVList)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpVList)) = 0 /* Indicate VList may no longer be enlarged */ + _sqlite3VdbeAppendP4(tls, v, z1, -int32(1)) + } + return target + case int32(TK_REGISTER): + return (*TExpr)(unsafe.Pointer(pExpr)).FiTable + case int32(TK_CAST): + /* Expressions of the form: CAST(pLeft AS token) */ + _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Cast), target, int32(_sqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), uintptr(0)))) + return inReg + case int32(TK_IS): + fallthrough + case int32(TK_ISNOT): + if op == int32(TK_IS) { + v7 = int32(TK_EQ) + } else { + v7 = int32(TK_NE) + } + op = v7 + p5 = int32(SQLITE_NULLEQ) + /* fall-through */ + fallthrough + case int32(TK_LT): + fallthrough + case int32(TK_LE): + fallthrough + case int32(TK_GT): + fallthrough + case int32(TK_GE): + fallthrough + case int32(TK_NE): + fallthrough + case int32(TK_EQ): + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if _sqlite3ExprIsVector(tls, pLeft) != 0 { + _codeVectorCompare(tls, pParse, pExpr, target, uint8(op), uint8(p5)) + } else { + r1 = _sqlite3ExprCodeTemp(tls, pParse, pLeft, bp) + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), inReg) + _codeCompare(tls, pParse, pLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), p5, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) + if p5 == int32(SQLITE_NULLEQ) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, inReg) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_ZeroOrNull), r1, inReg, r2) + } + } + case int32(TK_AND): + fallthrough + case int32(TK_OR): + fallthrough + case int32(TK_PLUS): + fallthrough + case int32(TK_STAR): + fallthrough + case int32(TK_MINUS): + fallthrough + case int32(TK_REM): + fallthrough + case int32(TK_BITAND): + fallthrough + case int32(TK_BITOR): + fallthrough + case int32(TK_SLASH): + fallthrough + case int32(TK_LSHIFT): + fallthrough + case int32(TK_RSHIFT): + fallthrough + case int32(TK_CONCAT): + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) + _sqlite3VdbeAddOp3(tls, v, op, r2, r1, target) + case int32(TK_UMINUS): + pLeft1 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pLeft1)).Fop) == int32(TK_INTEGER) { + _codeInteger(tls, pParse, pLeft1, int32(1), target) + return target + } else { + if int32((*TExpr)(unsafe.Pointer(pLeft1)).Fop) == int32(TK_FLOAT) { + _codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pLeft1 + 8)), int32(1), target) + return target + } else { + (*(*TExpr)(unsafe.Pointer(bp + 8))).Fop = uint8(TK_INTEGER) + (*(*TExpr)(unsafe.Pointer(bp + 8))).Fflags = uint32(libc.Int32FromInt32(EP_IntValue) | libc.Int32FromInt32(EP_TokenOnly)) + *(*int32)(unsafe.Pointer(bp + 8 + 8)) = 0 + r1 = _sqlite3ExprCodeTemp(tls, pParse, bp+8, bp) + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp+4) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Subtract), r2, r1, target) + } + } + case int32(TK_BITNOT): + fallthrough + case int32(TK_NOT): + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + _sqlite3VdbeAddOp2(tls, v, op, r1, inReg) + case int32(TK_TRUTH): /* IS TRUE or IS FALSE */ + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + bNormal = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_IS)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsTrue), r1, inReg, libc.BoolInt32(!(isTrue != 0)), isTrue^bNormal) + case int32(TK_ISNULL): + fallthrough + case int32(TK_NOTNULL): + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), target) + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + addr = _sqlite3VdbeAddOp1(tls, v, op, r1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, target) + _sqlite3VdbeJumpHere(tls, v, addr) + case int32(TK_AGG_FUNCTION): + pInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo + if pInfo == uintptr(0) || int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) < 0 || int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pInfo)).FnFunc { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8255, libc.VaList(bp+160, pExpr)) + } else { + return (*TAggInfo)(unsafe.Pointer(pInfo)).FiFirstReg + (*TAggInfo)(unsafe.Pointer(pInfo)).FnColumn + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) + } + case int32(TK_FUNCTION): /* The function name */ + constMask = uint32(0) /* Loop counter */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ + enc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc /* The text encoding used by this database */ + pColl = uintptr(0) /* A collating sequence */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + return (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FregResult + } + if (*TParse)(unsafe.Pointer(pParse)).FokConstFactor != 0 && _sqlite3ExprIsConstantNotJoin(tls, pExpr) != 0 { + /* SQL functions can be expensive. So try to avoid running them + ** multiple times if we know they always give the same result */ + return _sqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, -int32(1)) + } + pFarg = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + if pFarg != 0 { + v8 = (*TExprList)(unsafe.Pointer(pFarg)).FnExpr + } else { + v8 = 0 + } + nFarg = v8 + zId = *(*uintptr)(unsafe.Pointer(pExpr + 8)) + pDef = _sqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) + if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8282, libc.VaList(bp+160, pExpr)) + break + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_INLINE) != uint32(0) && pFarg != uintptr(0) { + return _exprCodeInlineFunction(tls, pParse, pFarg, int32(int64((*TFuncDef)(unsafe.Pointer(pDef)).FpUserData)), target) + } else { + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_DIRECT)|libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) != 0 { + _sqlite3ExprFunctionUsable(tls, pParse, pExpr, pDef) + } + } + i = 0 + for { + if !(i < nFarg) { + break + } + if i < int32(32) && _sqlite3ExprIsConstant(tls, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + uintptr(i)*32))).FpExpr) != 0 { + constMask |= libc.Uint32FromInt32(1) << i + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != uint32(0) && !(pColl != 0) { + pColl = _sqlite3ExprCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + uintptr(i)*32))).FpExpr) + } + goto _9 + _9: + ; + i++ + } + if pFarg != 0 { + if constMask != 0 { + r1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nFarg + } else { + r1 = _sqlite3GetTempRange(tls, pParse, nFarg) + } + /* For length() and typeof() and octet_length() functions, + ** set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG + ** or OPFLAG_TYPEOFARG or OPFLAG_BYTELENARG respectively, to avoid + ** unnecessary data loading. + */ + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(libc.Int32FromInt32(SQLITE_FUNC_LENGTH)|libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)) != uint32(0) { + exprOp = (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr)).Fop + if int32(exprOp) == int32(TK_COLUMN) || int32(exprOp) == int32(TK_AGG_COLUMN) { + (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr)).Fop2 = uint8((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags & uint32(OPFLAG_BYTELENARG)) + } + } + _sqlite3ExprCodeExprList(tls, pParse, pFarg, r1, 0, uint8(SQLITE_ECEL_FACTOR)) + } else { + r1 = 0 + } + /* Possibly overload the function if the first argument is + ** a virtual table column. + ** + ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the + ** second argument, not the first, as the argument to test to + ** see if it is a column in a virtual table. This is done because + ** the left operand of infix functions (the operand we want to + ** control overloading) ends up as the second argument to the + ** function. The expression "A glob B" is equivalent to + ** "glob(B,A). We want to use the A in "A glob B" to test + ** for function overloading. But we use the B term in "glob(B,A)". + */ + if nFarg >= int32(2) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_InfixFunc)) != uint32(0) { + pDef = _sqlite3VtabOverloadFunction(tls, db, pDef, nFarg, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8 + 1*32))).FpExpr) + } else { + if nFarg > 0 { + pDef = _sqlite3VtabOverloadFunction(tls, db, pDef, nFarg, (*(*TExprList_item)(unsafe.Pointer(pFarg + 8))).FpExpr) + } + } + if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { + if !(pColl != 0) { + pColl = (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_CollSeq), 0, 0, 0, pColl, -int32(2)) + } + _sqlite3VdbeAddFunctionCall(tls, pParse, int32(constMask), r1, target, nFarg, pDef, int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2)) + if nFarg != 0 { + if constMask == uint32(0) { + _sqlite3ReleaseTempRange(tls, pParse, r1, nFarg) + } else { + } + } + return target + case int32(TK_EXISTS): + fallthrough + case int32(TK_SELECT): + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return 0 + } else { + if v11 = op == int32(TK_SELECT) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0); v11 { + v10 = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpEList)).FnExpr + nCol = v10 + } + if v11 && v10 != int32(1) { + _sqlite3SubselectError(tls, pParse, nCol, int32(1)) + } else { + return _sqlite3CodeSubselect(tls, pParse, pExpr) + } + } + case int32(TK_SELECT_COLUMN): + pLeft2 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if (*TExpr)(unsafe.Pointer(pLeft2)).FiTable == 0 || int32((*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn) > int32((*TExpr)(unsafe.Pointer(pLeft2)).Fop2) { + (*TExpr)(unsafe.Pointer(pLeft2)).FiTable = _sqlite3CodeSubselect(tls, pParse, pLeft2) + (*TExpr)(unsafe.Pointer(pLeft2)).Fop2 = (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn + } + n1 = _sqlite3ExprVectorSize(tls, pLeft2) + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != n1 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7865, libc.VaList(bp+160, (*TExpr)(unsafe.Pointer(pExpr)).FiTable, n1)) + } + return (*TExpr)(unsafe.Pointer(pLeft2)).FiTable + int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + case int32(TK_IN): + destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) + destIfNull = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + _sqlite3ExprCodeIN(tls, pParse, pExpr, destIfFalse, destIfNull) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), target) + _sqlite3VdbeResolveLabel(tls, v, destIfFalse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), target, 0) + _sqlite3VdbeResolveLabel(tls, v, destIfNull) + return target + /* + ** x BETWEEN y AND z + ** + ** This is equivalent to + ** + ** x>=y AND x<=z + ** + ** X is stored in pExpr->pLeft. + ** Y is stored in pExpr->pList->a[0].pExpr. + ** Z is stored in pExpr->pList->a[1].pExpr. + */ + fallthrough + case int32(TK_BETWEEN): + _exprCodeBetween(tls, pParse, pExpr, target, uintptr(0), 0) + return target + case int32(TK_COLLATE): + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Collate)) != libc.Uint32FromInt32(0)) { + /* A TK_COLLATE Expr node without the EP_Collate tag is a so-called + ** "SOFT-COLLATE" that is added to constraints that are pushed down + ** from outer queries into sub-queries by the push-down optimization. + ** Clear subtypes as subtypes may not cross a subquery boundary. + */ + _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) + _sqlite3VdbeAddOp1(tls, v, int32(OP_ClrSubtype), target) + return target + } else { + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + goto expr_code_doover /* 2018-04-28: Prevent deep recursion. */ + } + fallthrough + case int32(TK_SPAN): + fallthrough + case int32(TK_UPLUS): + pExpr = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + goto expr_code_doover /* 2018-04-28: Prevent deep recursion. OSSFuzz. */ + case int32(TK_TRIGGER): + pTab2 = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + iCol1 = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + p1 = (*TExpr)(unsafe.Pointer(pExpr)).FiTable*(int32((*TTable)(unsafe.Pointer(pTab2)).FnCol)+int32(1)) + int32(1) + int32(_sqlite3TableColumnToStorage(tls, pTab2, int16(iCol1))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Param), p1, target) + /* If the column has REAL affinity, it may currently be stored as an + ** integer. Use OP_RealAffinity to make sure it is really real. + ** + ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to + ** floating point when extracting it from the record. */ + if iCol1 >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab2)).FaCol + uintptr(iCol1)*16))).Faffinity) == int32(SQLITE_AFF_REAL) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), target) + } + case int32(TK_VECTOR): + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6709, 0) + break + /* TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions + ** that derive from the right-hand table of a LEFT JOIN. The + ** Expr.iTable value is the table number for the right-hand table. + ** The expression is only evaluated if that table is not currently + ** on a LEFT JOIN NULL row. + */ + fallthrough + case int32(TK_IF_NULL_ROW): + okConstFactor = (*TParse)(unsafe.Pointer(pParse)).FokConstFactor + pAggInfo1 = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo + if pAggInfo1 != 0 { + if !((*TAggInfo)(unsafe.Pointer(pAggInfo1)).FdirectMode != 0) { + inReg = (*TAggInfo)(unsafe.Pointer(pAggInfo1)).FiFirstReg + int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) + break + } + if (*TAggInfo)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo)).FuseSortingIdx != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo)(unsafe.Pointer(pAggInfo1)).FsortingIdxPTab, int32((*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo1)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiAgg)*24))).FiSorterColumn), target) + inReg = target + break + } + } + addrINR = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNullRow), (*TExpr)(unsafe.Pointer(pExpr)).FiTable, 0, target) + /* The OP_IfNullRow opcode above can overwrite the result register with + ** NULL. So we have to ensure that the result register is not a value + ** that is suppose to be a constant. Two defenses are needed: + ** (1) Temporarily disable factoring of constant expressions + ** (2) Make sure the computed value really is stored in register + ** "target" and not someplace else. + */ + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) /* note (1) above */ + _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, target) + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor + _sqlite3VdbeJumpHere(tls, v, addrINR) + break + /* + ** Form A: + ** CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + ** + ** Form B: + ** CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + ** + ** Form A is can be transformed into the equivalent form B as follows: + ** CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ... + ** WHEN x=eN THEN rN ELSE y END + ** + ** X (if it exists) is in pExpr->pLeft. + ** Y is in the last element of pExpr->x.pList if pExpr->x.pList->nExpr is + ** odd. The Y is also optional. If the number of elements in x.pList + ** is even, then Y is omitted and the "otherwise" result is NULL. + ** Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1]. + ** + ** The result of the expression is the Ri for the first matching Ei, + ** or if there is no matching Ei, the ELSE term Y, or if there is + ** no ELSE term, NULL. + */ + fallthrough + case int32(TK_CASE): /* The X expression */ + pTest = uintptr(0) /* X==Ei (form A) or just Ei (form B) */ + pDel = uintptr(0) + db1 = (*TParse)(unsafe.Pointer(pParse)).Fdb + pEList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + aListelem = pEList + 8 + nExpr = (*TExprList)(unsafe.Pointer(pEList)).FnExpr + endLabel = _sqlite3VdbeMakeLabel(tls, pParse) + v12 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pX = v12 + if v12 != uintptr(0) { + pDel = _sqlite3ExprDup(tls, db1, pX, 0) + if (*Tsqlite3)(unsafe.Pointer(db1)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db1, pDel) + break + } + _exprToRegister(tls, pDel, _exprCodeVector(tls, pParse, pDel, bp)) + libc.Xmemset(tls, bp+80, 0, uint64(72)) + (*(*TExpr)(unsafe.Pointer(bp + 80))).Fop = uint8(TK_EQ) + (*(*TExpr)(unsafe.Pointer(bp + 80))).FpLeft = pDel + pTest = bp + 80 + /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: + ** The value in regFree1 might get SCopy-ed into the file result. + ** So make sure that the regFree1 register is not reused for other + ** purposes and possibly overwritten. */ + *(*int32)(unsafe.Pointer(bp)) = 0 + } + i1 = 0 + for { + if !(i1 < nExpr-int32(1)) { + break + } + if pX != 0 { + (*(*TExpr)(unsafe.Pointer(bp + 80))).FpRight = (*(*TExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32))).FpExpr + } else { + pTest = (*(*TExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32))).FpExpr + } + nextCase = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprIfFalse(tls, pParse, pTest, nextCase, int32(SQLITE_JUMPIFNULL)) + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(aListelem + uintptr(i1+int32(1))*32))).FpExpr, target) + _sqlite3VdbeGoto(tls, v, endLabel) + _sqlite3VdbeResolveLabel(tls, v, nextCase) + goto _13 + _13: + ; + i1 = i1 + int32(2) + } + if nExpr&int32(1) != 0 { + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(nExpr-int32(1))*32))).FpExpr, target) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, target) + } + _sqlite3ExprDelete(tls, db1, pDel) + _setDoNotMergeFlagOnCopy(tls, v) + _sqlite3VdbeResolveLabel(tls, v, endLabel) + case int32(TK_RAISE): + if !((*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0) && !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8306, 0) + return 0 + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Abort) { + _sqlite3MayAbort(tls, pParse) + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).FaffExpr) == int32(OE_Ignore) { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), SQLITE_OK, int32(OE_Ignore), 0, *(*uintptr)(unsafe.Pointer(pExpr + 8)), 0) + } else { + if (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0 { + v14 = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(7)<0 then the result is always stored in that register and the +// ** result is not reusable. If regDest<0 then this routine is free to +// ** store the value wherever it wants. The register where the expression +// ** is stored is returned. When regDest<0, two identical expressions might +// ** code to the same register, if they do not contain function calls and hence +// ** are factored out into the initialization section at the end of the +// ** prepared statement. +// */ +func _sqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, regDest int32) (r int32) { + var addr, i, v2, v4 int32 + var p, pItem, pItem1, v, v3, v5 uintptr + _, _, _, _, _, _, _, _, _, _ = addr, i, p, pItem, pItem1, v, v2, v3, v4, v5 + p = (*TParse)(unsafe.Pointer(pParse)).FpConstExpr + if regDest < 0 && p != 0 { + pItem = p + 8 + i = (*TExprList)(unsafe.Pointer(p)).FnExpr + for { + if !(i > 0) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 16 + 4))&0x8>>3)) != 0 && _sqlite3ExprCompare(tls, uintptr(0), (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr, pExpr, -int32(1)) == 0 { + return *(*int32)(unsafe.Pointer(pItem + 24)) + } + goto _1 + _1: + ; + pItem += 32 + i-- + } + } + pExpr = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) + if pExpr != uintptr(0) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_HasFunc)) != uint32(0) { + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + addr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) + if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + if regDest < 0 { + v3 = pParse + 56 + *(*int32)(unsafe.Pointer(v3))++ + v2 = *(*int32)(unsafe.Pointer(v3)) + regDest = v2 + } + _sqlite3ExprCode(tls, pParse, pExpr, regDest) + } + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(1) + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + _sqlite3VdbeJumpHere(tls, v, addr) + } else { + p = _sqlite3ExprListAppend(tls, pParse, p, pExpr) + if p != 0 { + pItem1 = p + 8 + uintptr((*TExprList)(unsafe.Pointer(p)).FnExpr-int32(1))*32 + libc.SetBitFieldPtr16Uint32(pItem1+16+4, libc.BoolUint32(regDest < libc.Int32FromInt32(0)), 3, 0x8) + if regDest < 0 { + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + regDest = v4 + } + *(*int32)(unsafe.Pointer(pItem1 + 24)) = regDest + } + (*TParse)(unsafe.Pointer(pParse)).FpConstExpr = p + } + return regDest +} + +// C documentation +// +// /* +// ** Generate code to evaluate an expression and store the results +// ** into a register. Return the register number where the results +// ** are stored. +// ** +// ** If the register is a temporary register that can be deallocated, +// ** then write its number into *pReg. If the result register is not +// ** a temporary, then set *pReg to zero. +// ** +// ** If pExpr is a constant, then this routine might generate this +// ** code to fill the register in the initialization section of the +// ** VDBE program, in order to factor it out of the evaluation loop. +// */ +func _sqlite3ExprCodeTemp(tls *libc.TLS, pParse uintptr, pExpr uintptr, pReg uintptr) (r int32) { + var r1, r2 int32 + _, _ = r1, r2 + pExpr = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) + if (*TParse)(unsafe.Pointer(pParse)).FokConstFactor != 0 && pExpr != uintptr(0) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_REGISTER) && _sqlite3ExprIsConstantNotJoin(tls, pExpr) != 0 { + *(*int32)(unsafe.Pointer(pReg)) = 0 + r2 = _sqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, -int32(1)) + } else { + r1 = _sqlite3GetTempReg(tls, pParse) + r2 = _sqlite3ExprCodeTarget(tls, pParse, pExpr, r1) + if r2 == r1 { + *(*int32)(unsafe.Pointer(pReg)) = r1 + } else { + _sqlite3ReleaseTempReg(tls, pParse, r1) + *(*int32)(unsafe.Pointer(pReg)) = 0 + } + } + return r2 +} + +// C documentation +// +// /* +// ** Generate code that will evaluate expression pExpr and store the +// ** results in register target. The results are guaranteed to appear +// ** in register target. +// */ +func _sqlite3ExprCode(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { + var inReg int32 + var op Tu8 + var pX uintptr + _, _, _ = inReg, op, pX + if (*TParse)(unsafe.Pointer(pParse)).FpVdbe == uintptr(0) { + return + } + inReg = _sqlite3ExprCodeTarget(tls, pParse, pExpr, target) + if inReg != target { + pX = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) + if pX != 0 && ((*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(libc.Int32FromInt32(EP_Subquery)) != uint32(0) || int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_REGISTER)) { + op = uint8(OP_Copy) + } else { + op = uint8(OP_SCopy) + } + _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(op), inReg, target) + } +} + +// C documentation +// +// /* +// ** Make a transient copy of expression pExpr and then code it using +// ** sqlite3ExprCode(). This routine works just like sqlite3ExprCode() +// ** except that the input expression is guaranteed to be unchanged. +// */ +func _sqlite3ExprCodeCopy(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + _sqlite3ExprCode(tls, pParse, pExpr, target) + } + _sqlite3ExprDelete(tls, db, pExpr) +} + +// C documentation +// +// /* +// ** Generate code that will evaluate expression pExpr and store the +// ** results in register target. The results are guaranteed to appear +// ** in register target. If the expression is constant, then this routine +// ** might choose to code the expression at initialization time. +// */ +func _sqlite3ExprCodeFactorable(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { + if (*TParse)(unsafe.Pointer(pParse)).FokConstFactor != 0 && _sqlite3ExprIsConstantNotJoin(tls, pExpr) != 0 { + _sqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, target) + } else { + _sqlite3ExprCodeCopy(tls, pParse, pExpr, target) + } +} + +// C documentation +// +// /* +// ** Generate code that pushes the value of every element of the given +// ** expression list into a sequence of registers beginning at target. +// ** +// ** Return the number of elements evaluated. The number returned will +// ** usually be pList->nExpr but might be reduced if SQLITE_ECEL_OMITREF +// ** is defined. +// ** +// ** The SQLITE_ECEL_DUP flag prevents the arguments from being +// ** filled using OP_SCopy. OP_Copy must be used instead. +// ** +// ** The SQLITE_ECEL_FACTOR argument allows constant arguments to be +// ** factored out into initialization code. +// ** +// ** The SQLITE_ECEL_REF flag means that expressions in the list with +// ** ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored +// ** in registers at srcReg, and so the value can be copied from there. +// ** If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0 +// ** are simply omitted rather than being copied from srcReg. +// */ +func _sqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, target int32, srcReg int32, flags Tu8) (r int32) { + var copyOp Tu8 + var i, inReg, j, n, v1, v3 int32 + var pExpr, pItem, pOp, v, v5 uintptr + var v4, v6 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = copyOp, i, inReg, j, n, pExpr, pItem, pOp, v, v1, v3, v4, v5, v6 + if int32(flags)&int32(SQLITE_ECEL_DUP) != 0 { + v1 = int32(OP_Copy) + } else { + v1 = int32(OP_SCopy) + } + copyOp = uint8(v1) + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* Never gets this far otherwise */ + n = (*TExprList)(unsafe.Pointer(pList)).FnExpr + if !((*TParse)(unsafe.Pointer(pParse)).FokConstFactor != 0) { + flags = Tu8(int32(flags) & ^libc.Int32FromInt32(SQLITE_ECEL_FACTOR)) + } + pItem = pList + 8 + i = libc.Int32FromInt32(0) + for { + if !(i < n) { + break + } + pExpr = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + if v4 = int32(flags)&int32(SQLITE_ECEL_REF) != 0; v4 { + v3 = int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol) + j = v3 + } + if v4 && v3 > 0 { + if int32(flags)&int32(SQLITE_ECEL_OMITREF) != 0 { + i-- + n-- + } else { + _sqlite3VdbeAddOp2(tls, v, int32(copyOp), j+srcReg-int32(1), target+i) + } + } else { + if int32(flags)&int32(SQLITE_ECEL_FACTOR) != 0 && _sqlite3ExprIsConstantNotJoin(tls, pExpr) != 0 { + _sqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, target+i) + } else { + inReg = _sqlite3ExprCodeTarget(tls, pParse, pExpr, target+i) + if inReg != target+i { + if v6 = int32(copyOp) == int32(OP_Copy); v6 { + v5 = _sqlite3VdbeGetLastOp(tls, v) + pOp = v5 + } + if v6 && int32((*TVdbeOp)(unsafe.Pointer(v5)).Fopcode) == int32(OP_Copy) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1+(*TVdbeOp)(unsafe.Pointer(pOp)).Fp3+int32(1) == inReg && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2+(*TVdbeOp)(unsafe.Pointer(pOp)).Fp3+int32(1) == target+i && int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp5) == 0 { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3++ + } else { + _sqlite3VdbeAddOp2(tls, v, int32(copyOp), inReg, target+i) + } + } + } + } + goto _2 + _2: + ; + i++ + pItem += 32 + } + return n +} + +// C documentation +// +// /* +// ** Generate code for a BETWEEN operator. +// ** +// ** x BETWEEN y AND z +// ** +// ** The above is equivalent to +// ** +// ** x>=y AND x<=z +// ** +// ** Code it as such, taking care to do the common subexpression +// ** elimination of x. +// ** +// ** The xJumpIf parameter determines details: +// ** +// ** NULL: Store the boolean result in reg[dest] +// ** sqlite3ExprIfTrue: Jump to dest if true +// ** sqlite3ExprIfFalse: Jump to dest if false +// ** +// ** The jumpIfNull parameter is ignored if xJumpIf is NULL. +// */ +func _exprCodeBetween(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, xJump uintptr, jumpIfNull int32) { + bp := tls.Alloc(224) + defer tls.Free(224) + var db, pDel uintptr + var _ /* compLeft at bp+72 */ TExpr + var _ /* compRight at bp+144 */ TExpr + var _ /* exprAnd at bp+0 */ TExpr + var _ /* regFree1 at bp+216 */ int32 + _, _ = db, pDel /* The x<=z term */ + *(*int32)(unsafe.Pointer(bp + 216)) = 0 /* Temporary use register */ + pDel = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + libc.Xmemset(tls, bp+72, 0, uint64(72)) + libc.Xmemset(tls, bp+144, 0, uint64(72)) + libc.Xmemset(tls, bp, 0, uint64(72)) + pDel = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, 0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_AND) + (*(*TExpr)(unsafe.Pointer(bp))).FpLeft = bp + 72 + (*(*TExpr)(unsafe.Pointer(bp))).FpRight = bp + 144 + (*(*TExpr)(unsafe.Pointer(bp + 72))).Fop = uint8(TK_GE) + (*(*TExpr)(unsafe.Pointer(bp + 72))).FpLeft = pDel + (*(*TExpr)(unsafe.Pointer(bp + 72))).FpRight = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr + (*(*TExpr)(unsafe.Pointer(bp + 144))).Fop = uint8(TK_LE) + (*(*TExpr)(unsafe.Pointer(bp + 144))).FpLeft = pDel + (*(*TExpr)(unsafe.Pointer(bp + 144))).FpRight = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr + _exprToRegister(tls, pDel, _exprCodeVector(tls, pParse, pDel, bp+216)) + if xJump != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, int32, int32))(unsafe.Pointer(&struct{ uintptr }{xJump})))(tls, pParse, bp, dest, jumpIfNull) + } else { + /* Mark the expression is being from the ON or USING clause of a join + ** so that the sqlite3ExprCodeTarget() routine will not attempt to move + ** it into the Parse.pConstExpr list. We should use a new bit for this, + ** for clarity, but we are out of bits in the Expr.flags field so we + ** have to reuse the EP_OuterON bit. Bummer. */ + *(*Tu32)(unsafe.Pointer(pDel + 4)) |= uint32(EP_OuterON) + _sqlite3ExprCodeTarget(tls, pParse, bp, dest) + } + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 216))) + } + _sqlite3ExprDelete(tls, db, pDel) + /* Ensure adequate test coverage */ +} + +// C documentation +// +// /* +// ** Generate code for a boolean expression such that a jump is made +// ** to the label "dest" if the expression is true but execution +// ** continues straight thru if the expression is false. +// ** +// ** If the expression evaluates to NULL (neither true nor false), then +// ** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL. +// ** +// ** This code depends on the fact that certain token values (ex: TK_EQ) +// ** are the same as opcode values (ex: OP_Eq) that implement the corresponding +// ** operation. Special comments in vdbe.c and the mkopcodeh.awk script in +// ** the make process cause these values to align. Assert()s in the code +// ** below verify that the numbers are aligned correctly. +// */ +func _sqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var d2, destIfFalse, destIfNull, isNot, isTrue, op, r1, r2, v19, v20, v21, v22 int32 + var pAlt, v uintptr + var _ /* regFree1 at bp+0 */ int32 + var _ /* regFree2 at bp+4 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d2, destIfFalse, destIfNull, isNot, isTrue, op, pAlt, r1, r2, v, v19, v20, v21, v22 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + op = 0 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + if v == uintptr(0) { + return + } /* Existence of VDBE checked by caller */ + if pExpr == uintptr(0) { + return + } /* No way this can happen */ + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + switch op { + case int32(TK_OR): + goto _1 + case int32(TK_AND): + goto _2 + case int32(TK_NOT): + goto _3 + case int32(TK_TRUTH): + goto _4 + case int32(TK_ISNOT): + goto _5 + case int32(TK_IS): + goto _6 + case int32(TK_EQ): + goto _7 + case int32(TK_NE): + goto _8 + case int32(TK_GE): + goto _9 + case int32(TK_GT): + goto _10 + case int32(TK_LE): + goto _11 + case int32(TK_LT): + goto _12 + case int32(TK_NOTNULL): + goto _13 + case int32(TK_ISNULL): + goto _14 + case int32(TK_BETWEEN): + goto _15 + case int32(TK_IN): + goto _16 + default: + goto _17 + } + goto _18 +_2: + ; +_1: + ; + pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) + if pAlt != pExpr { + _sqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) + } else { + if op == int32(TK_AND) { + d2 = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, d2, jumpIfNull^int32(SQLITE_JUMPIFNULL)) + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + _sqlite3VdbeResolveLabel(tls, v, d2) + } else { + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + } + } + goto _18 +_3: + ; + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + goto _18 +_4: + ; /* IS TRUE or IS NOT TRUE */ + isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) + isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if isTrue^isNot != 0 { + if isNot != 0 { + v19 = int32(SQLITE_JUMPIFNULL) + } else { + v19 = 0 + } + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, v19) + } else { + if isNot != 0 { + v20 = int32(SQLITE_JUMPIFNULL) + } else { + v20 = 0 + } + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, v20) + } + goto _18 +_6: + ; +_5: + ; + if op == int32(TK_IS) { + v21 = int32(TK_EQ) + } else { + v21 = int32(TK_NE) + } + op = v21 + jumpIfNull = int32(SQLITE_NULLEQ) +_12: + ; +_11: + ; +_10: + ; +_9: + ; +_8: + ; +_7: + ; + if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + goto default_expr + } + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) + _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) + goto _18 +_14: + ; +_13: + ; + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + _sqlite3VdbeTypeofColumn(tls, v, r1) + _sqlite3VdbeAddOp2(tls, v, op, r1, dest) + goto _18 +_15: + ; + _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfTrue), jumpIfNull) + goto _18 +_16: + ; + destIfFalse = _sqlite3VdbeMakeLabel(tls, pParse) + if jumpIfNull != 0 { + v22 = dest + } else { + v22 = destIfFalse + } + destIfNull = v22 + _sqlite3ExprCodeIN(tls, pParse, pExpr, destIfFalse, destIfNull) + _sqlite3VdbeGoto(tls, v, dest) + _sqlite3VdbeResolveLabel(tls, v, destIfFalse) + goto _18 +_17: + ; +default_expr: + ; + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { + _sqlite3VdbeGoto(tls, v, dest) + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { + /* No-op */ + } else { + r1 = _sqlite3ExprCodeTemp(tls, pParse, pExpr, bp) + _sqlite3VdbeAddOp3(tls, v, int32(OP_If), r1, dest, libc.BoolInt32(jumpIfNull != 0)) + } + } + goto _18 +_18: + ; + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) +} + +// C documentation +// +// /* +// ** Generate code for a boolean expression such that a jump is made +// ** to the label "dest" if the expression is false but execution +// ** continues straight thru if the expression is true. +// ** +// ** If the expression evaluates to NULL (neither true nor false) then +// ** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull +// ** is 0. +// */ +func _sqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var d2, destIfNull, isNot, isTrue, op, r1, r2, v19, v20, v21 int32 + var pAlt, v uintptr + var _ /* regFree1 at bp+0 */ int32 + var _ /* regFree2 at bp+4 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _ = d2, destIfNull, isNot, isTrue, op, pAlt, r1, r2, v, v19, v20, v21 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + op = 0 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + if v == uintptr(0) { + return + } /* Existence of VDBE checked by caller */ + if pExpr == uintptr(0) { + return + } + /* The value of pExpr->op and op are related as follows: + ** + ** pExpr->op op + ** --------- ---------- + ** TK_ISNULL OP_NotNull + ** TK_NOTNULL OP_IsNull + ** TK_NE OP_Eq + ** TK_EQ OP_Ne + ** TK_GT OP_Le + ** TK_LE OP_Gt + ** TK_GE OP_Lt + ** TK_LT OP_Ge + ** + ** For other values of pExpr->op, op is undefined and unused. + ** The value of TK_ and OP_ constants are arranged such that we + ** can compute the mapping above using the following expression. + ** Assert()s verify that the computation is correct. + */ + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + libc.Int32FromInt32(TK_ISNULL)&libc.Int32FromInt32(1) ^ int32(1) - libc.Int32FromInt32(TK_ISNULL)&libc.Int32FromInt32(1) + /* Verify correct alignment of TK_ and OP_ constants + */ + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + case int32(TK_OR): + goto _1 + case int32(TK_AND): + goto _2 + case int32(TK_NOT): + goto _3 + case int32(TK_TRUTH): + goto _4 + case int32(TK_ISNOT): + goto _5 + case int32(TK_IS): + goto _6 + case int32(TK_EQ): + goto _7 + case int32(TK_NE): + goto _8 + case int32(TK_GE): + goto _9 + case int32(TK_GT): + goto _10 + case int32(TK_LE): + goto _11 + case int32(TK_LT): + goto _12 + case int32(TK_NOTNULL): + goto _13 + case int32(TK_ISNULL): + goto _14 + case int32(TK_BETWEEN): + goto _15 + case int32(TK_IN): + goto _16 + default: + goto _17 + } + goto _18 +_2: + ; +_1: + ; + pAlt = _sqlite3ExprSimplifiedAndOr(tls, pExpr) + if pAlt != pExpr { + _sqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) { + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + } else { + d2 = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, d2, jumpIfNull^int32(SQLITE_JUMPIFNULL)) + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + _sqlite3VdbeResolveLabel(tls, v, d2) + } + } + goto _18 +_3: + ; + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + goto _18 +_4: + ; /* IS TRUE or IS NOT TRUE */ + isNot = libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) == int32(TK_ISNOT)) + isTrue = _sqlite3ExprTruthValue(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if isTrue^isNot != 0 { + /* IS TRUE and IS NOT FALSE */ + if isNot != 0 { + v19 = 0 + } else { + v19 = int32(SQLITE_JUMPIFNULL) + } + _sqlite3ExprIfFalse(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, v19) + } else { + /* IS FALSE and IS NOT TRUE */ + if isNot != 0 { + v20 = 0 + } else { + v20 = int32(SQLITE_JUMPIFNULL) + } + _sqlite3ExprIfTrue(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, dest, v20) + } + goto _18 +_6: + ; +_5: + ; + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { + v21 = int32(TK_NE) + } else { + v21 = int32(TK_EQ) + } + op = v21 + jumpIfNull = int32(SQLITE_NULLEQ) +_12: + ; +_11: + ; +_10: + ; +_9: + ; +_8: + ; +_7: + ; + if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) != 0 { + goto default_expr + } + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + r2 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, bp+4) + _codeCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, dest, jumpIfNull, libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Commuted)) != uint32(0))) + goto _18 +_14: + ; +_13: + ; + r1 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, bp) + _sqlite3VdbeTypeofColumn(tls, v, r1) + _sqlite3VdbeAddOp2(tls, v, op, r1, dest) + goto _18 +_15: + ; + _exprCodeBetween(tls, pParse, pExpr, dest, __ccgo_fp(_sqlite3ExprIfFalse), jumpIfNull) + goto _18 +_16: + ; + if jumpIfNull != 0 { + _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) + } else { + destIfNull = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprCodeIN(tls, pParse, pExpr, dest, destIfNull) + _sqlite3VdbeResolveLabel(tls, v, destIfNull) + } + goto _18 +_17: + ; +default_expr: + ; + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse) { + _sqlite3VdbeGoto(tls, v, dest) + } else { + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsTrue)) == uint32(EP_IsTrue) { + /* no-op */ + } else { + r1 = _sqlite3ExprCodeTemp(tls, pParse, pExpr, bp) + _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNot), r1, dest, libc.BoolInt32(jumpIfNull != 0)) + } + } + goto _18 +_18: + ; + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4))) +} + +// C documentation +// +// /* +// ** Like sqlite3ExprIfFalse() except that a copy is made of pExpr before +// ** code generation, and that copy is deleted after code generation. This +// ** ensures that the original pExpr is unchanged. +// */ +func _sqlite3ExprIfFalseDup(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { + var db, pCopy uintptr + _, _ = db, pCopy + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pCopy = _sqlite3ExprDup(tls, db, pExpr, 0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + _sqlite3ExprIfFalse(tls, pParse, pCopy, dest, jumpIfNull) + } + _sqlite3ExprDelete(tls, db, pCopy) +} + +// C documentation +// +// /* +// ** Expression pVar is guaranteed to be an SQL variable. pExpr may be any +// ** type of expression. +// ** +// ** If pExpr is a simple SQL value - an integer, real, string, blob +// ** or NULL value - then the VDBE currently being prepared is configured +// ** to re-prepare each time a new value is bound to variable pVar. +// ** +// ** Additionally, if pExpr is a simple SQL value and the value is the +// ** same as that currently bound to variable pVar, non-zero is returned. +// ** Otherwise, if the values are not the same or if pExpr is not a simple +// ** SQL value, zero is returned. +// */ +func _exprCompareVariable(tls *libc.TLS, pParse uintptr, pVar uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iVar, res int32 + var pL uintptr + var _ /* pR at bp+0 */ uintptr + _, _, _ = iVar, pL, res + res = 0 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3ValueFromExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + iVar = int32((*TExpr)(unsafe.Pointer(pVar)).FiColumn) + _sqlite3VdbeSetVarmask(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, iVar) + pL = _sqlite3VdbeGetBoundValue(tls, (*TParse)(unsafe.Pointer(pParse)).FpReprepare, iVar, uint8(SQLITE_AFF_BLOB)) + if pL != 0 { + if Xsqlite3_value_type(tls, pL) == int32(SQLITE_TEXT) { + Xsqlite3_value_text(tls, pL) /* Make sure the encoding is UTF-8 */ + } + res = libc.BoolInt32(0 == _sqlite3MemCompare(tls, pL, *(*uintptr)(unsafe.Pointer(bp)), uintptr(0))) + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3ValueFree(tls, pL) + } + return res +} + +// C documentation +// +// /* +// ** Do a deep comparison of two expression trees. Return 0 if the two +// ** expressions are completely identical. Return 1 if they differ only +// ** by a COLLATE operator at the top level. Return 2 if there are differences +// ** other than the top-level COLLATE operator. +// ** +// ** If any subelement of pB has Expr.iTable==(-1) then it is allowed +// ** to compare equal to an equivalent element in pA with Expr.iTable==iTab. +// ** +// ** The pA side might be using TK_REGISTER. If that is the case and pB is +// ** not using TK_REGISTER but is otherwise equivalent, then still return 0. +// ** +// ** Sometimes this routine will return 2 even if the two expressions +// ** really are equivalent. If we cannot prove that the expressions are +// ** identical, we return 2 just to be safe. So if this routine +// ** returns 2, then you do not really know for certain if the two +// ** expressions are the same. But if you get a 0 or 1 return, then you +// ** can be sure the expressions are the same. In the places where +// ** this routine is used, it does not hurt to get an extra 2 - that +// ** just might result in some slightly slower code. But returning +// ** an incorrect 0 or 1 could lead to a malfunction. +// ** +// ** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in +// ** pParse->pReprepare can be matched against literals in pB. The +// ** pParse->pVdbe->expmask bitmask is updated for each variable referenced. +// ** If pParse is NULL (the normal case) then any TK_VARIABLE term in +// ** Argument pParse should normally be NULL. If it is not NULL and pA or +// ** pB causes a return value of 2. +// */ +func _sqlite3ExprCompare(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, iTab int32) (r int32) { + var combinedFlags Tu32 + var v1 int32 + _, _ = combinedFlags, v1 + if pA == uintptr(0) || pB == uintptr(0) { + if pB == pA { + v1 = 0 + } else { + v1 = int32(2) + } + return v1 + } + if pParse != 0 && int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_VARIABLE) && _exprCompareVariable(tls, pParse, pA, pB) != 0 { + return 0 + } + combinedFlags = (*TExpr)(unsafe.Pointer(pA)).Fflags | (*TExpr)(unsafe.Pointer(pB)).Fflags + if combinedFlags&uint32(EP_IntValue) != 0 { + if (*TExpr)(unsafe.Pointer(pA)).Fflags&(*TExpr)(unsafe.Pointer(pB)).Fflags&uint32(EP_IntValue) != uint32(0) && *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pA)).Fu)) == *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pB)).Fu)) { + return 0 + } + return int32(2) + } + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32((*TExpr)(unsafe.Pointer(pB)).Fop) || int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_RAISE) { + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_COLLATE) && _sqlite3ExprCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pA)).FpLeft, pB, iTab) < int32(2) { + return int32(1) + } + if int32((*TExpr)(unsafe.Pointer(pB)).Fop) == int32(TK_COLLATE) && _sqlite3ExprCompare(tls, pParse, pA, (*TExpr)(unsafe.Pointer(pB)).FpLeft, iTab) < int32(2) { + return int32(1) + } + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_AGG_COLUMN) && int32((*TExpr)(unsafe.Pointer(pB)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pB)).FiTable < 0 && (*TExpr)(unsafe.Pointer(pA)).FiTable == iTab { + /* fall through */ + } else { + return int32(2) + } + } + if *(*uintptr)(unsafe.Pointer(pA + 8)) != 0 { + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_FUNCTION) || int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_AGG_FUNCTION) { + if _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8)), *(*uintptr)(unsafe.Pointer(pB + 8))) != 0 { + return int32(2) + } + if libc.BoolInt32((*TExpr)(unsafe.Pointer(pA)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0)) != libc.BoolInt32((*TExpr)(unsafe.Pointer(pB)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0)) { + return int32(2) + } + if (*TExpr)(unsafe.Pointer(pA)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + if _sqlite3WindowCompare(tls, pParse, *(*uintptr)(unsafe.Pointer(pA + 64)), *(*uintptr)(unsafe.Pointer(pB + 64)), int32(1)) != 0 { + return int32(2) + } + } + } else { + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_NULL) { + return 0 + } else { + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_COLLATE) { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8)), *(*uintptr)(unsafe.Pointer(pB + 8))) != 0 { + return int32(2) + } + } else { + if *(*uintptr)(unsafe.Pointer(pB + 8)) != uintptr(0) && int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32(TK_AGG_COLUMN) && libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8)), *(*uintptr)(unsafe.Pointer(pB + 8))) != 0 { + return int32(2) + } + } + } + } + } + if (*TExpr)(unsafe.Pointer(pA)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)|libc.Int32FromInt32(EP_Commuted)) != (*TExpr)(unsafe.Pointer(pB)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)|libc.Int32FromInt32(EP_Commuted)) { + return int32(2) + } + if combinedFlags&uint32(EP_TokenOnly) == uint32(0) { + if combinedFlags&uint32(EP_xIsSelect) != 0 { + return int32(2) + } + if combinedFlags&uint32(EP_FixedCol) == uint32(0) && _sqlite3ExprCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pA)).FpLeft, (*TExpr)(unsafe.Pointer(pB)).FpLeft, iTab) != 0 { + return int32(2) + } + if _sqlite3ExprCompare(tls, pParse, (*TExpr)(unsafe.Pointer(pA)).FpRight, (*TExpr)(unsafe.Pointer(pB)).FpRight, iTab) != 0 { + return int32(2) + } + if _sqlite3ExprListCompare(tls, *(*uintptr)(unsafe.Pointer(pA + 32)), *(*uintptr)(unsafe.Pointer(pB + 32)), iTab) != 0 { + return int32(2) + } + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32(TK_STRING) && int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32(TK_TRUEFALSE) && combinedFlags&uint32(EP_Reduced) == uint32(0) { + if int32((*TExpr)(unsafe.Pointer(pA)).FiColumn) != int32((*TExpr)(unsafe.Pointer(pB)).FiColumn) { + return int32(2) + } + if int32((*TExpr)(unsafe.Pointer(pA)).Fop2) != int32((*TExpr)(unsafe.Pointer(pB)).Fop2) && int32((*TExpr)(unsafe.Pointer(pA)).Fop) == int32(TK_TRUTH) { + return int32(2) + } + if int32((*TExpr)(unsafe.Pointer(pA)).Fop) != int32(TK_IN) && (*TExpr)(unsafe.Pointer(pA)).FiTable != (*TExpr)(unsafe.Pointer(pB)).FiTable && (*TExpr)(unsafe.Pointer(pA)).FiTable != iTab { + return int32(2) + } + } + } + return 0 +} + +// C documentation +// +// /* +// ** Compare two ExprList objects. Return 0 if they are identical, 1 +// ** if they are certainly different, or 2 if it is not possible to +// ** determine if they are identical or not. +// ** +// ** If any subelement of pB has Expr.iTable==(-1) then it is allowed +// ** to compare equal to an equivalent element in pA with Expr.iTable==iTab. +// ** +// ** This routine might return non-zero for equivalent ExprLists. The +// ** only consequence will be disabled optimizations. But this routine +// ** must never return 0 if the two ExprList objects are different, or +// ** a malfunction will result. +// ** +// ** Two NULL pointers are considered to be the same. But a NULL pointer +// ** always differs from a non-NULL pointer. +// */ +func _sqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) (r int32) { + var i, res, v2 int32 + var pExprA, pExprB uintptr + _, _, _, _, _ = i, pExprA, pExprB, res, v2 + if pA == uintptr(0) && pB == uintptr(0) { + return 0 + } + if pA == uintptr(0) || pB == uintptr(0) { + return int32(1) + } + if (*TExprList)(unsafe.Pointer(pA)).FnExpr != (*TExprList)(unsafe.Pointer(pB)).FnExpr { + return int32(1) + } + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pA)).FnExpr) { + break + } + pExprA = (*(*TExprList_item)(unsafe.Pointer(pA + 8 + uintptr(i)*32))).FpExpr + pExprB = (*(*TExprList_item)(unsafe.Pointer(pB + 8 + uintptr(i)*32))).FpExpr + if int32((*(*TExprList_item)(unsafe.Pointer(pA + 8 + uintptr(i)*32))).Ffg.FsortFlags) != int32((*(*TExprList_item)(unsafe.Pointer(pB + 8 + uintptr(i)*32))).Ffg.FsortFlags) { + return int32(1) + } + v2 = _sqlite3ExprCompare(tls, uintptr(0), pExprA, pExprB, iTab) + res = v2 + if v2 != 0 { + return res + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Like sqlite3ExprCompare() except COLLATE operators at the top-level +// ** are ignored. +// */ +func _sqlite3ExprCompareSkip(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) (r int32) { + return _sqlite3ExprCompare(tls, uintptr(0), _sqlite3ExprSkipCollate(tls, pA), _sqlite3ExprSkipCollate(tls, pB), iTab) +} + +// C documentation +// +// /* +// ** Return non-zero if Expr p can only be true if pNN is not NULL. +// ** +// ** Or if seenNot is true, return non-zero if Expr p can only be +// ** non-NULL if pNN is not NULL +// */ +func _exprImpliesNotNull(tls *libc.TLS, pParse uintptr, p uintptr, pNN uintptr, iTab int32, seenNot int32) (r int32) { + var pList uintptr + _ = pList + if _sqlite3ExprCompare(tls, pParse, p, pNN, iTab) == 0 { + return libc.BoolInt32(int32((*TExpr)(unsafe.Pointer(pNN)).Fop) != int32(TK_NULL)) + } + switch int32((*TExpr)(unsafe.Pointer(p)).Fop) { + case int32(TK_IN): + if seenNot != 0 && (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_xIsSelect)) != uint32(0) { + return 0 + } + return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, int32(1)) + case int32(TK_BETWEEN): + pList = *(*uintptr)(unsafe.Pointer(p + 32)) + if seenNot != 0 { + return 0 + } + if _exprImpliesNotNull(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr, pNN, iTab, int32(1)) != 0 || _exprImpliesNotNull(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr, pNN, iTab, int32(1)) != 0 { + return int32(1) + } + return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, int32(1)) + case int32(TK_EQ): + fallthrough + case int32(TK_NE): + fallthrough + case int32(TK_LT): + fallthrough + case int32(TK_LE): + fallthrough + case int32(TK_GT): + fallthrough + case int32(TK_GE): + fallthrough + case int32(TK_PLUS): + fallthrough + case int32(TK_MINUS): + fallthrough + case int32(TK_BITOR): + fallthrough + case int32(TK_LSHIFT): + fallthrough + case int32(TK_RSHIFT): + fallthrough + case int32(TK_CONCAT): + seenNot = int32(1) + fallthrough + case int32(TK_STAR): + fallthrough + case int32(TK_REM): + fallthrough + case int32(TK_BITAND): + fallthrough + case int32(TK_SLASH): + if _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpRight, pNN, iTab, seenNot) != 0 { + return int32(1) + } + fallthrough + case int32(TK_SPAN): + fallthrough + case int32(TK_COLLATE): + fallthrough + case int32(TK_UPLUS): + fallthrough + case int32(TK_UMINUS): + return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, seenNot) + case int32(TK_TRUTH): + if seenNot != 0 { + return 0 + } + if int32((*TExpr)(unsafe.Pointer(p)).Fop2) != int32(TK_IS) { + return 0 + } + return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, int32(1)) + case int32(TK_BITNOT): + fallthrough + case int32(TK_NOT): + return _exprImpliesNotNull(tls, pParse, (*TExpr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, int32(1)) + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if we can prove the pE2 will always be true if pE1 is +// ** true. Return false if we cannot complete the proof or if pE2 might +// ** be false. Examples: +// ** +// ** pE1: x==5 pE2: x==5 Result: true +// ** pE1: x>0 pE2: x==5 Result: false +// ** pE1: x=21 pE2: x=21 OR y=43 Result: true +// ** pE1: x!=123 pE2: x IS NOT NULL Result: true +// ** pE1: x!=?1 pE2: x IS NOT NULL Result: true +// ** pE1: x IS NULL pE2: x IS NOT NULL Result: false +// ** pE1: x IS ?2 pE2: x IS NOT NULL Result: false +// ** +// ** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has +// ** Expr.iTable<0 then assume a table number given by iTab. +// ** +// ** If pParse is not NULL, then the values of bound variables in pE1 are +// ** compared against literal values in pE2 and pParse->pVdbe->expmask is +// ** modified to record which bound variables are referenced. If pParse +// ** is NULL, then false will be returned if pE1 contains any bound variables. +// ** +// ** When in doubt, return false. Returning true might give a performance +// ** improvement. Returning false might cause a performance reduction, but +// ** it will always give the correct answer and is hence always safe. +// */ +func _sqlite3ExprImpliesExpr(tls *libc.TLS, pParse uintptr, pE1 uintptr, pE2 uintptr, iTab int32) (r int32) { + if _sqlite3ExprCompare(tls, pParse, pE1, pE2, iTab) == 0 { + return int32(1) + } + if int32((*TExpr)(unsafe.Pointer(pE2)).Fop) == int32(TK_OR) && (_sqlite3ExprImpliesExpr(tls, pParse, pE1, (*TExpr)(unsafe.Pointer(pE2)).FpLeft, iTab) != 0 || _sqlite3ExprImpliesExpr(tls, pParse, pE1, (*TExpr)(unsafe.Pointer(pE2)).FpRight, iTab) != 0) { + return int32(1) + } + if int32((*TExpr)(unsafe.Pointer(pE2)).Fop) == int32(TK_NOTNULL) && _exprImpliesNotNull(tls, pParse, pE1, (*TExpr)(unsafe.Pointer(pE2)).FpLeft, iTab, 0) != 0 { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* This is a helper function to impliesNotNullRow(). In this routine, +// ** set pWalker->eCode to one only if *both* of the input expressions +// ** separately have the implies-not-null-row property. +// */ +func _bothImplyNotNullRow(tls *libc.TLS, pWalker uintptr, pE1 uintptr, pE2 uintptr) { + if int32((*TWalker)(unsafe.Pointer(pWalker)).FeCode) == 0 { + _sqlite3WalkExpr(tls, pWalker, pE1) + if (*TWalker)(unsafe.Pointer(pWalker)).FeCode != 0 { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + _sqlite3WalkExpr(tls, pWalker, pE2) + } + } +} + +// C documentation +// +// /* +// ** This is the Expr node callback for sqlite3ExprImpliesNonNullRow(). +// ** If the expression node requires that the table at pWalker->iCur +// ** have one or more non-NULL column, then set pWalker->eCode to 1 and abort. +// ** +// ** pWalker->mWFlags is non-zero if this inquiry is being undertaking on +// ** behalf of a RIGHT JOIN (or FULL JOIN). That makes a difference when +// ** evaluating terms in the ON clause of an inner join. +// ** +// ** This routine controls an optimization. False positives (setting +// ** pWalker->eCode to 1 when it should not be) are deadly, but false-negatives +// ** (never setting pWalker->eCode) is a harmless missed optimization. +// */ +func _impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pLeft, pRight uintptr + _, _ = pLeft, pRight + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + return int32(WRC_Prune) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)) != uint32(0) && (*TWalker)(unsafe.Pointer(pWalker)).FmWFlags != 0 { + /* If iCur is used in an inner-join ON clause to the left of a + ** RIGHT JOIN, that does *not* mean that the table must be non-null. + ** But it is difficult to check for that condition precisely. + ** To keep things simple, any use of iCur from any inner-join is + ** ignored while attempting to simplify a RIGHT JOIN. */ + return int32(WRC_Prune) + } + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + case int32(TK_ISNOT): + fallthrough + case int32(TK_ISNULL): + fallthrough + case int32(TK_NOTNULL): + fallthrough + case int32(TK_IS): + fallthrough + case int32(TK_VECTOR): + fallthrough + case int32(TK_FUNCTION): + fallthrough + case int32(TK_TRUTH): + fallthrough + case int32(TK_CASE): + return int32(WRC_Prune) + case int32(TK_COLUMN): + if *(*int32)(unsafe.Pointer(&(*TWalker)(unsafe.Pointer(pWalker)).Fu)) == (*TExpr)(unsafe.Pointer(pExpr)).FiTable { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(1) + return int32(WRC_Abort) + } + return int32(WRC_Prune) + case int32(TK_OR): + fallthrough + case int32(TK_AND): + /* Both sides of an AND or OR must separately imply non-null-row. + ** Consider these cases: + ** 1. NOT (x AND y) + ** 2. x OR y + ** If only one of x or y is non-null-row, then the overall expression + ** can be true if the other arm is false (case 1) or true (case 2). + */ + _bothImplyNotNullRow(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + return int32(WRC_Prune) + case int32(TK_IN): + /* Beware of "x NOT IN ()" and "x NOT IN (SELECT 1 WHERE false)", + ** both of which can be true. But apart from these cases, if + ** the left-hand side of the IN is NULL then the IN itself will be + ** NULL. */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) == uint32(0) && (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr > 0 { + _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + } + return int32(WRC_Prune) + case int32(TK_BETWEEN): + /* In "x NOT BETWEEN y AND z" either x must be non-null-row or else + ** both y and z must be non-null row */ + _sqlite3WalkExpr(tls, pWalker, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + _bothImplyNotNullRow(tls, pWalker, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr) + return int32(WRC_Prune) + /* Virtual tables are allowed to use constraints like x=NULL. So + ** a term of the form x=y does not prove that y is not null if x + ** is the column of a virtual table */ + fallthrough + case int32(TK_EQ): + fallthrough + case int32(TK_NE): + fallthrough + case int32(TK_LT): + fallthrough + case int32(TK_LE): + fallthrough + case int32(TK_GT): + fallthrough + case int32(TK_GE): + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + /* The y.pTab=0 assignment in wherecode.c always happens after the + ** impliesNotNullRow() test */ + if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) == int32(TK_COLUMN) && *(*uintptr)(unsafe.Pointer(pLeft + 64)) != uintptr(0) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64)))).FeTabType) == int32(TABTYP_VTAB) || int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && *(*uintptr)(unsafe.Pointer(pRight + 64)) != uintptr(0) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64)))).FeTabType) == int32(TABTYP_VTAB) { + return int32(WRC_Prune) + } + fallthrough + default: + return WRC_Continue + } + return r +} + +// C documentation +// +// /* +// ** Return true (non-zero) if expression p can only be true if at least +// ** one column of table iTab is non-null. In other words, return true +// ** if expression p will always be NULL or false if every column of iTab +// ** is NULL. +// ** +// ** False negatives are acceptable. In other words, it is ok to return +// ** zero even if expression p will never be true of every column of iTab +// ** is NULL. A false negative is merely a missed optimization opportunity. +// ** +// ** False positives are not allowed, however. A false positive may result +// ** in an incorrect answer. +// ** +// ** Terms of p that are marked with EP_OuterON (and hence that come from +// ** the ON or USING clauses of OUTER JOINS) are excluded from the analysis. +// ** +// ** This routine is used to check if a LEFT JOIN can be converted into +// ** an ordinary JOIN. The p argument is the WHERE clause. If the WHERE +// ** clause requires that some column of the right table of the LEFT JOIN +// ** be non-NULL, then the LEFT JOIN can be safely converted into an +// ** ordinary join. +// */ +func _sqlite3ExprImpliesNonNullRow(tls *libc.TLS, p uintptr, iTab int32, isRJ int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + p = _sqlite3ExprSkipCollateAndLikely(tls, p) + if p == uintptr(0) { + return 0 + } + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_NOTNULL) { + p = (*TExpr)(unsafe.Pointer(p)).FpLeft + } else { + for int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_AND) { + if _sqlite3ExprImpliesNonNullRow(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, iTab, isRJ) != 0 { + return int32(1) + } + p = (*TExpr)(unsafe.Pointer(p)).FpRight + } + } + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_impliesNotNullRow) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(0) + (*(*TWalker)(unsafe.Pointer(bp))).FmWFlags = libc.BoolUint16(isRJ != 0) + *(*int32)(unsafe.Pointer(bp + 40)) = iTab + _sqlite3WalkExpr(tls, bp, p) + return int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode) +} + +/* +** An instance of the following structure is used by the tree walker +** to determine if an expression can be evaluated by reference to the +** index only, without having to do a search for the corresponding +** table entry. The IdxCover.pIdx field is the index. IdxCover.iCur +** is the cursor for the table. + */ +type TIdxCover = struct { + FpIdx uintptr + FiCur int32 +} + +type IdxCover = TIdxCover + +// C documentation +// +// /* +// ** Check to see if there are references to columns in table +// ** pWalker->u.pIdxCover->iCur can be satisfied using the index +// ** pWalker->u.pIdxCover->pIdx. +// */ +func _exprIdxCover(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TIdxCover)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)))).FiCur && int32(_sqlite3TableColumnToIndex(tls, (*TIdxCover)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)))).FpIdx, (*TExpr)(unsafe.Pointer(pExpr)).FiColumn)) < 0 { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(1) + return int32(WRC_Abort) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Determine if an index pIdx on table with cursor iCur contains will +// ** the expression pExpr. Return true if the index does cover the +// ** expression and false if the pExpr expression references table columns +// ** that are not found in the index pIdx. +// ** +// ** An index covering an expression means that the expression can be +// ** evaluated using only the index and without having to lookup the +// ** corresponding table entry. +// */ +func _sqlite3ExprCoveredByIndex(tls *libc.TLS, pExpr uintptr, iCur int32, pIdx uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var _ /* w at bp+0 */ TWalker + var _ /* xcov at bp+48 */ TIdxCover + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TIdxCover)(unsafe.Pointer(bp + 48))).FiCur = iCur + (*(*TIdxCover)(unsafe.Pointer(bp + 48))).FpIdx = pIdx + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprIdxCover) + *(*uintptr)(unsafe.Pointer(bp + 40)) = bp + 48 + _sqlite3WalkExpr(tls, bp, pExpr) + return libc.BoolInt32(!((*(*TWalker)(unsafe.Pointer(bp))).FeCode != 0)) +} + +/* Structure used to pass information throughout the Walker in order to +** implement sqlite3ReferencesSrcList(). + */ +type TRefSrcList = struct { + Fdb uintptr + FpRef uintptr + FnExclude Ti64 + FaiExclude uintptr +} + +type RefSrcList = TRefSrcList + +// C documentation +// +// /* +// ** Walker SELECT callbacks for sqlite3ReferencesSrcList(). +// ** +// ** When entering a new subquery on the pExpr argument, add all FROM clause +// ** entries for that subquery to the exclude list. +// ** +// ** When leaving the subquery, remove those entries from the exclude list. +// */ +func _selectRefEnter(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) { + var i, j Ti64 + var p, pSrc, piNew uintptr + _, _, _, _, _ = i, j, p, pSrc, piNew + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pSrc = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc == 0 { + return WRC_Continue + } + j = (*TRefSrcList)(unsafe.Pointer(p)).FnExclude + *(*Ti64)(unsafe.Pointer(p + 16)) += int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + piNew = _sqlite3DbRealloc(tls, (*TRefSrcList)(unsafe.Pointer(p)).Fdb, (*TRefSrcList)(unsafe.Pointer(p)).FaiExclude, uint64((*TRefSrcList)(unsafe.Pointer(p)).FnExclude)*uint64(4)) + if piNew == uintptr(0) { + (*TRefSrcList)(unsafe.Pointer(p)).FnExclude = 0 + return int32(WRC_Abort) + } else { + (*TRefSrcList)(unsafe.Pointer(p)).FaiExclude = piNew + } + i = 0 + for { + if !(i < int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc)) { + break + } + *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(j)*4)) = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor + goto _1 + _1: + ; + i++ + j++ + } + return WRC_Continue +} + +func _selectRefLeave(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { + var p, pSrc uintptr + _, _ = p, pSrc + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pSrc = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + if (*TRefSrcList)(unsafe.Pointer(p)).FnExclude != 0 { + *(*Ti64)(unsafe.Pointer(p + 16)) -= int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + } +} + +// C documentation +// +// /* This is the Walker EXPR callback for sqlite3ReferencesSrcList(). +// ** +// ** Set the 0x01 bit of pWalker->eCode if there is a reference to any +// ** of the tables shown in RefSrcList.pRef. +// ** +// ** Set the 0x02 bit of pWalker->eCode if there is a reference to a +// ** table is in neither RefSrcList.pRef nor RefSrcList.aiExclude. +// */ +func _exprRefToSrcList(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var i, nSrc, v1 int32 + var p, pSrc, p3, p5 uintptr + _, _, _, _, _, _, _ = i, nSrc, p, pSrc, v1, p3, p5 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_COLUMN) { + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pSrc = (*TRefSrcList)(unsafe.Pointer(p)).FpRef + if pSrc != 0 { + v1 = (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc + } else { + v1 = 0 + } + nSrc = v1 + i = 0 + for { + if !(i < nSrc) { + break + } + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor { + p3 = pWalker + 36 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(1)) + return WRC_Continue + } + goto _2 + _2: + ; + i++ + } + i = 0 + for { + if !(int64(i) < (*TRefSrcList)(unsafe.Pointer(p)).FnExclude && *(*int32)(unsafe.Pointer((*TRefSrcList)(unsafe.Pointer(p)).FaiExclude + uintptr(i)*4)) != (*TExpr)(unsafe.Pointer(pExpr)).FiTable) { + break + } + goto _4 + _4: + ; + i++ + } + if int64(i) >= (*TRefSrcList)(unsafe.Pointer(p)).FnExclude { + p5 = pWalker + 36 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(2)) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Check to see if pExpr references any tables in pSrcList. +// ** Possible return values: +// ** +// ** 1 pExpr does references a table in pSrcList. +// ** +// ** 0 pExpr references some table that is not defined in either +// ** pSrcList or in subqueries of pExpr itself. +// ** +// ** -1 pExpr only references no tables at all, or it only +// ** references tables defined in subqueries of pExpr itself. +// ** +// ** As currently used, pExpr is always an aggregate function call. That +// ** fact is exploited for efficiency. +// */ +func _sqlite3ReferencesSrcList(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSrcList uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var _ /* w at bp+0 */ TWalker + var _ /* x at bp+48 */ TRefSrcList + libc.Xmemset(tls, bp, 0, uint64(48)) + libc.Xmemset(tls, bp+48, 0, uint64(32)) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprRefToSrcList) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_selectRefEnter) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = __ccgo_fp(_selectRefLeave) + *(*uintptr)(unsafe.Pointer(bp + 40)) = bp + 48 + (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).Fdb = (*TParse)(unsafe.Pointer(pParse)).Fdb + (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).FpRef = pSrcList + _sqlite3WalkExprList(tls, bp, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { + _sqlite3WalkExprList(tls, bp, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + _sqlite3WalkExpr(tls, bp, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpFilter) + } + if (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).FaiExclude != 0 { + _sqlite3DbNNFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TRefSrcList)(unsafe.Pointer(bp + 48))).FaiExclude) + } + if int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode)&int32(0x01) != 0 { + return int32(1) + } else { + if (*(*TWalker)(unsafe.Pointer(bp))).FeCode != 0 { + return 0 + } else { + return -int32(1) + } + } + return r +} + +// C documentation +// +// /* +// ** This is a Walker expression node callback. +// ** +// ** For Expr nodes that contain pAggInfo pointers, make sure the AggInfo +// ** object that is referenced does not refer directly to the Expr. If +// ** it does, make a copy. This is done because the pExpr argument is +// ** subject to change. +// ** +// ** The copy is scheduled for deletion using the sqlite3ExprDeferredDelete() +// ** which builds on the sqlite3ParserAddCleanup() mechanism. +// */ +func _agginfoPersistExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var db, pAggInfo, pParse uintptr + var iAgg int32 + _, _, _, _ = db, iAgg, pAggInfo, pParse + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Reduced)) != libc.Uint32FromInt32(0)) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != uintptr(0) { + pAggInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo + iAgg = int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { + if iAgg < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn && (*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(iAgg)*24))).FpCExpr == pExpr { + pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) + if pExpr != 0 { + (*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(iAgg)*24))).FpCExpr = pExpr + _sqlite3ExprDeferredDelete(tls, pParse, pExpr) + } + } + } else { + if iAgg < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(iAgg)*32))).FpFExpr == pExpr { + pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) + if pExpr != 0 { + (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(iAgg)*32))).FpFExpr = pExpr + _sqlite3ExprDeferredDelete(tls, pParse, pExpr) + } + } + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Initialize a Walker object so that will persist AggInfo entries referenced +// ** by the tree that is walked. +// */ +func _sqlite3AggInfoPersistWalkerInit(tls *libc.TLS, pWalker uintptr, pParse uintptr) { + libc.Xmemset(tls, pWalker, 0, uint64(48)) + (*TWalker)(unsafe.Pointer(pWalker)).FpParse = pParse + (*TWalker)(unsafe.Pointer(pWalker)).FxExprCallback = __ccgo_fp(_agginfoPersistExprCb) + (*TWalker)(unsafe.Pointer(pWalker)).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) +} + +// C documentation +// +// /* +// ** Add a new element to the pAggInfo->aCol[] array. Return the index of +// ** the new element. Return a negative number if malloc fails. +// */ +func _addAggInfoColumn(tls *libc.TLS, db uintptr, pInfo uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* i at bp+0 */ int32 + (*TAggInfo)(unsafe.Pointer(pInfo)).FaCol = _sqlite3ArrayAllocate(tls, db, (*TAggInfo)(unsafe.Pointer(pInfo)).FaCol, int32(24), pInfo+32, bp) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Add a new element to the pAggInfo->aFunc[] array. Return the index of +// ** the new element. Return a negative number if malloc fails. +// */ +func _addAggInfoFunc(tls *libc.TLS, db uintptr, pInfo uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* i at bp+0 */ int32 + (*TAggInfo)(unsafe.Pointer(pInfo)).FaFunc = _sqlite3ArrayAllocate(tls, db, (*TAggInfo)(unsafe.Pointer(pInfo)).FaFunc, int32(32), pInfo+48, bp) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Search the AggInfo object for an aCol[] entry that has iTable and iColumn. +// ** Return the index in aCol[] of the entry that describes that column. +// ** +// ** If no prior entry is found, create a new one and return -1. The +// ** new column will have an index of pAggInfo->nColumn-1. +// */ +func _findOrCreateAggInfoColumn(tls *libc.TLS, pParse uintptr, pAggInfo uintptr, pExpr uintptr) { + var j, k, n int32 + var pCol, pE, pGB, pTerm, v4 uintptr + var v3 Tu16 + _, _, _, _, _, _, _, _, _ = j, k, n, pCol, pE, pGB, pTerm, v3, v4 + pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + k = 0 + for { + if !(k < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + break + } + if (*TAggInfo_col)(unsafe.Pointer(pCol)).FpCExpr == pExpr { + return + } + if (*TAggInfo_col)(unsafe.Pointer(pCol)).FiTable == (*TExpr)(unsafe.Pointer(pExpr)).FiTable && int32((*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn) == int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_IF_NULL_ROW) { + goto fix_up_expr + } + goto _1 + _1: + ; + k++ + pCol += 24 + } + k = _addAggInfoColumn(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pAggInfo) + if k < 0 { + /* OOM on resize */ + return + } + pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(k)*24 + (*TAggInfo_col)(unsafe.Pointer(pCol)).FpTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + (*TAggInfo_col)(unsafe.Pointer(pCol)).FiTable = (*TExpr)(unsafe.Pointer(pExpr)).FiTable + (*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn = (*TExpr)(unsafe.Pointer(pExpr)).FiColumn + (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(-int32(1)) + (*TAggInfo_col)(unsafe.Pointer(pCol)).FpCExpr = pExpr + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy != 0 && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_IF_NULL_ROW) { + pGB = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy + pTerm = pGB + 8 + n = (*TExprList)(unsafe.Pointer(pGB)).FnExpr + j = 0 + for { + if !(j < n) { + break + } + pE = (*TExprList_item)(unsafe.Pointer(pTerm)).FpExpr + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pE)).FiTable == (*TExpr)(unsafe.Pointer(pExpr)).FiTable && int32((*TExpr)(unsafe.Pointer(pE)).FiColumn) == int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) { + (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(j) + break + } + goto _2 + _2: + ; + j++ + pTerm += 32 + } + } + if int32((*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn) < 0 { + v4 = pAggInfo + 2 + v3 = *(*Tu16)(unsafe.Pointer(v4)) + *(*Tu16)(unsafe.Pointer(v4))++ + (*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(v3) + } +fix_up_expr: + ; + (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) + } + (*TExpr)(unsafe.Pointer(pExpr)).FiAgg = int16(k) +} + +// C documentation +// +// /* +// ** This is the xExprCallback for a tree walker. It is used to +// ** implement sqlite3ExprAnalyzeAggregates(). See sqlite3ExprAnalyzeAggregates +// ** for additional information. +// */ +func _analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var enc Tu8 + var i, iDataCur, nArg, v5, v6, v8 int32 + var pAggInfo, pIEpr, pItem, pItem1, pNC, pOBList, pParse, pSrcList, v7, v9 uintptr + var _ /* tmp at bp+0 */ TExpr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = enc, i, iDataCur, nArg, pAggInfo, pIEpr, pItem, pItem1, pNC, pOBList, pParse, pSrcList, v5, v6, v7, v8, v9 + pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + pSrcList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList + pAggInfo = *(*uintptr)(unsafe.Pointer(pNC + 16)) + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + default: + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_InAggFunc) == 0 { + break + } + if (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr == uintptr(0) { + break + } + pIEpr = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + for { + if !(pIEpr != 0) { + break + } + iDataCur = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FiDataCur + if iDataCur < 0 { + goto _1 + } + if _sqlite3ExprCompare(tls, uintptr(0), pExpr, (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpExpr, iDataCur) == 0 { + break + } + goto _1 + _1: + ; + pIEpr = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FpIENext + } + if pIEpr == uintptr(0) { + break + } + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == libc.Uint32FromInt32(0)) { + break + } + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc) { + break + } + if (*(*TSrcItem)(unsafe.Pointer(pSrcList + 8))).FiCursor == (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FiDataCur { + break + } + goto _2 + _2: + ; + i++ + } + if i >= (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc { + break + } + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != uintptr(0) { + break + } /* Resolved by outer context */ + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(WRC_Abort) + } + /* If we reach this point, it means that expression pExpr can be + ** translated into a reference to an index column as described by + ** pIEpr. + */ + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_AGG_COLUMN) + (*(*TExpr)(unsafe.Pointer(bp))).FiTable = (*TIndexedExpr)(unsafe.Pointer(pIEpr)).FiIdxCur + (*(*TExpr)(unsafe.Pointer(bp))).FiColumn = int16((*TIndexedExpr)(unsafe.Pointer(pIEpr)).FiIdxCol) + _findOrCreateAggInfoColumn(tls, pParse, pAggInfo, bp) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(WRC_Abort) + } + (*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*(*TExpr)(unsafe.Pointer(bp))).FiAgg)*24))).FpCExpr = pExpr + (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo + (*TExpr)(unsafe.Pointer(pExpr)).FiAgg = (*(*TExpr)(unsafe.Pointer(bp))).FiAgg + return int32(WRC_Prune) + case int32(TK_IF_NULL_ROW): + fallthrough + case int32(TK_AGG_COLUMN): + fallthrough + case int32(TK_COLUMN): + /* Check to see if the column is in one of the tables in the FROM + ** clause of the aggregate query */ + if pSrcList != uintptr(0) { + pItem = pSrcList + 8 + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrcList)).FnSrc) { + break + } + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor { + _findOrCreateAggInfoColumn(tls, pParse, pAggInfo, pExpr) + break + } /* endif pExpr->iTable==pItem->iCursor */ + goto _3 + _3: + ; + i++ + pItem += 104 + } /* end loop over pSrcList */ + } + return WRC_Continue + case int32(TK_AGG_FUNCTION): + if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_InAggFunc) == 0 && (*TWalker)(unsafe.Pointer(pWalker)).FwalkerDepth == int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { + /* Check to see if pExpr is a duplicate of another aggregate + ** function that is already in the pAggInfo structure + */ + pItem1 = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + if (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFExpr == pExpr { + break + } + if _sqlite3ExprCompare(tls, uintptr(0), (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFExpr, pExpr, -int32(1)) == 0 { + break + } + goto _4 + _4: + ; + i++ + pItem1 += 32 + } + if i >= (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { + /* pExpr is original. Make a new entry in pAggInfo->aFunc[] + */ + enc = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc + i = _addAggInfoFunc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pAggInfo) + if i >= 0 { + pItem1 = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32 + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFExpr = pExpr + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 { + v5 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr + } else { + v5 = 0 + } + nArg = v5 + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFunc = _sqlite3FindFunction(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(pExpr + 8)), nArg, enc, uint8(0)) + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 && (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) == uint32(0) { + v7 = pParse + 52 + v6 = *(*int32)(unsafe.Pointer(v7)) + *(*int32)(unsafe.Pointer(v7))++ + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FiOBTab = v6 + pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32)) + if (*TExprList)(unsafe.Pointer(pOBList)).FnExpr == int32(1) && nArg == int32(1) && _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pOBList + 8))).FpExpr, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr, 0) == 0 { + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBPayload = uint8(0) + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBUnique = libc.BoolUint8((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)) != libc.Uint32FromInt32(0)) + } else { + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBPayload = uint8(1) + } + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FbUseSubtype = libc.BoolUint8((*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pItem1)).FpFunc)).FfuncFlags&uint32(SQLITE_SUBTYPE) != uint32(0)) + } else { + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FiOBTab = -int32(1) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)) != uint32(0) && !((*TAggInfo_func)(unsafe.Pointer(pItem1)).FbOBUnique != 0) { + v9 = pParse + 52 + v8 = *(*int32)(unsafe.Pointer(v9)) + *(*int32)(unsafe.Pointer(v9))++ + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FiDistinct = v8 + } else { + (*TAggInfo_func)(unsafe.Pointer(pItem1)).FiDistinct = -int32(1) + } + } + } + /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry + */ + (*TExpr)(unsafe.Pointer(pExpr)).FiAgg = int16(i) + (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo + return int32(WRC_Prune) + } else { + return WRC_Continue + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Analyze the pExpr expression looking for aggregate functions and +// ** for variables that need to be added to AggInfo object that pNC->pAggInfo +// ** points to. Additional entries are made on the AggInfo object as +// ** necessary. +// ** +// ** This routine should only be called after the expression has been +// ** analyzed by sqlite3ResolveExprNames(). +// */ +func _sqlite3ExprAnalyzeAggregates(tls *libc.TLS, pNC uintptr, pExpr uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_analyzeAggregate) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3WalkerDepthIncrease) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = __ccgo_fp(_sqlite3WalkerDepthDecrease) + (*(*TWalker)(unsafe.Pointer(bp))).FwalkerDepth = 0 + *(*uintptr)(unsafe.Pointer(bp + 40)) = pNC + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = uintptr(0) + _sqlite3WalkExpr(tls, bp, pExpr) +} + +// C documentation +// +// /* +// ** Call sqlite3ExprAnalyzeAggregates() for every expression in an +// ** expression list. Return the number of errors. +// ** +// ** If an error is found, the analysis is cut short. +// */ +func _sqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { + var i int32 + var pItem uintptr + _, _ = i, pItem + if pList != 0 { + pItem = pList + 8 + i = libc.Int32FromInt32(0) + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) + goto _1 + _1: + ; + i++ + pItem += 32 + } + } +} + +// C documentation +// +// /* +// ** Allocate a single new register for use to hold some intermediate result. +// */ +func _sqlite3GetTempReg(tls *libc.TLS, pParse uintptr) (r int32) { + var v1 int32 + var v2, v4 uintptr + var v3 Tu8 + _, _, _, _ = v1, v2, v3, v4 + if int32((*TParse)(unsafe.Pointer(pParse)).FnTempReg) == 0 { + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + return v1 + } + v4 = pParse + 31 + *(*Tu8)(unsafe.Pointer(v4))-- + v3 = *(*Tu8)(unsafe.Pointer(v4)) + return *(*int32)(unsafe.Pointer(pParse + 232 + uintptr(v3)*4)) +} + +// C documentation +// +// /* +// ** Deallocate a register, making available for reuse for some other +// ** purpose. +// */ +func _sqlite3ReleaseTempReg(tls *libc.TLS, pParse uintptr, iReg int32) { + var v1 Tu8 + var v2 uintptr + _, _ = v1, v2 + if iReg != 0 { + if int32((*TParse)(unsafe.Pointer(pParse)).FnTempReg) < int32(libc.Uint64FromInt64(32)/libc.Uint64FromInt64(4)) { + v2 = pParse + 31 + v1 = *(*Tu8)(unsafe.Pointer(v2)) + *(*Tu8)(unsafe.Pointer(v2))++ + *(*int32)(unsafe.Pointer(pParse + 232 + uintptr(v1)*4)) = iReg + } + } +} + +// C documentation +// +// /* +// ** Allocate or deallocate a block of nReg consecutive registers. +// */ +func _sqlite3GetTempRange(tls *libc.TLS, pParse uintptr, nReg int32) (r int32) { + var i, n int32 + _, _ = i, n + if nReg == int32(1) { + return _sqlite3GetTempReg(tls, pParse) + } + i = (*TParse)(unsafe.Pointer(pParse)).FiRangeReg + n = (*TParse)(unsafe.Pointer(pParse)).FnRangeReg + if nReg <= n { + *(*int32)(unsafe.Pointer(pParse + 44)) += nReg + *(*int32)(unsafe.Pointer(pParse + 40)) -= nReg + } else { + i = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nReg + } + return i +} + +func _sqlite3ReleaseTempRange(tls *libc.TLS, pParse uintptr, iReg int32, nReg int32) { + if nReg == int32(1) { + _sqlite3ReleaseTempReg(tls, pParse, iReg) + return + } + if nReg > (*TParse)(unsafe.Pointer(pParse)).FnRangeReg { + (*TParse)(unsafe.Pointer(pParse)).FnRangeReg = nReg + (*TParse)(unsafe.Pointer(pParse)).FiRangeReg = iReg + } +} + +// C documentation +// +// /* +// ** Mark all temporary registers as being unavailable for reuse. +// ** +// ** Always invoke this procedure after coding a subroutine or co-routine +// ** that might be invoked from other parts of the code, to ensure that +// ** the sub/co-routine does not use registers in common with the code that +// ** invokes the sub/co-routine. +// */ +func _sqlite3ClearTempRegCache(tls *libc.TLS, pParse uintptr) { + (*TParse)(unsafe.Pointer(pParse)).FnTempReg = uint8(0) + (*TParse)(unsafe.Pointer(pParse)).FnRangeReg = 0 +} + +// C documentation +// +// /* +// ** Make sure sufficient registers have been allocated so that +// ** iReg is a valid register number. +// */ +func _sqlite3TouchRegister(tls *libc.TLS, pParse uintptr, iReg int32) { + if (*TParse)(unsafe.Pointer(pParse)).FnMem < iReg { + (*TParse)(unsafe.Pointer(pParse)).FnMem = iReg + } +} + +// C documentation +// +// /* +// ** Return the latest reusable register in the set of all registers. +// ** The value returned is no less than iMin. If any register iMin or +// ** greater is in permanent use, then return one more than that last +// ** permanent register. +// */ +func _sqlite3FirstAvailableRegister(tls *libc.TLS, pParse uintptr, iMin int32) (r int32) { + var i int32 + var pList uintptr + _, _ = i, pList + pList = (*TParse)(unsafe.Pointer(pParse)).FpConstExpr + if pList != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + if *(*int32)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 24)) >= iMin { + iMin = *(*int32)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 24)) + int32(1) + } + goto _1 + _1: + ; + i++ + } + } + (*TParse)(unsafe.Pointer(pParse)).FnTempReg = uint8(0) + (*TParse)(unsafe.Pointer(pParse)).FnRangeReg = 0 + return iMin +} + +/* +** Validate that no temporary register falls within the range of +** iFirst..iLast, inclusive. This routine is only call from within assert() +** statements. + */ + +/************** End of expr.c ************************************************/ +/************** Begin file alter.c *******************************************/ +/* +** 2005 February 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C code routines that used to generate VDBE code +** that implements the ALTER TABLE command. + */ +/* #include "sqliteInt.h" */ + +/* +** The code in this file only exists if we are not omitting the +** ALTER TABLE logic from the build. + */ + +// C documentation +// +// /* +// ** Parameter zName is the name of a table that is about to be altered +// ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). +// ** If the table is a system table, this function leaves an error message +// ** in pParse->zErr (system tables may not be altered) and returns non-zero. +// ** +// ** Or, if zName is not a system table, zero is returned. +// */ +func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6557, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8356, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Generate code to verify that the schemas of database zDb and, if +// ** bTemp is not true, database "temp", can still be parsed. This is +// ** called at the end of the generation of an ALTER TABLE ... RENAME ... +// ** statement to ensure that the operation has not rendered any schema +// ** objects unusable. +// */ +func _renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, zWhen uintptr, bNoDQS int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8384, libc.VaList(bp+8, zDb, zDb, bTemp, zWhen, bNoDQS)) + if bTemp == 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8559, libc.VaList(bp+8, zDb, zWhen, bNoDQS)) + } +} + +// C documentation +// +// /* +// ** Generate VM code to replace any double-quoted strings (but not double-quoted +// ** identifiers) within the "sql" column of the sqlite_schema table in +// ** database zDb with their single-quoted equivalents. If argument bTemp is +// ** not true, similarly update all SQL statements in the sqlite_schema table +// ** of the temp db. +// */ +func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8733, libc.VaList(bp+8, zDb, zDb)) + if bTemp == 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+8880, 0) + } +} + +// C documentation +// +// /* +// ** Generate code to reload the schema for database iDb. And, if iDb!=1, for +// ** the temp database as well. +// */ +func _renameReloadSchema(tls *libc.TLS, pParse uintptr, iDb int32, p5 Tu16) { + var v uintptr + _ = v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if v != 0 { + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqlite3VdbeAddParseSchemaOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, iDb, uintptr(0), p5) + if iDb != int32(1) { + _sqlite3VdbeAddParseSchemaOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(1), uintptr(0), p5) + } + } +} + +// C documentation +// +// /* +// ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" +// ** command. +// */ +func _sqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pTab, pVTab, v, zDb, zName, zTabName, v2 uintptr + var i, iDb, nTabName, v1 int32 + _, _, _, _, _, _, _, _, _, _, _, _ = db, i, iDb, nTabName, pTab, pVTab, v, zDb, zName, zTabName, v1, v2 /* Table being renamed */ + zName = uintptr(0) /* NULL-terminated version of pName */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pVTab = uintptr(0) /* Non-zero if this is a v-tab with an xRename() */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_rename_table + } + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pSrc+8) + if !(pTab != 0) { + goto exit_rename_table + } + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + /* Get a NULL terminated version of the new table name. */ + zName = _sqlite3NameFromToken(tls, db, pName) + if !(zName != 0) { + goto exit_rename_table + } + /* Check that a table or index named 'zName' does not already exist + ** in database iDb. If so, this is an error. + */ + if _sqlite3FindTable(tls, db, zName, zDb) != 0 || _sqlite3FindIndex(tls, db, zName, zDb) != 0 || _sqlite3IsShadowTableOf(tls, db, pTab, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9031, libc.VaList(bp+8, zName)) + goto exit_rename_table + } + /* Make sure it is not a system table being altered, or a reserved name + ** that the table is being renamed to. + */ + if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { + goto exit_rename_table + } + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+9090, zName) { + goto exit_rename_table + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+9096, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_rename_table + } + /* Invoke the authorization callback. */ + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { + goto exit_rename_table + } + if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + goto exit_rename_table + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + pVTab = _sqlite3GetVTable(tls, db, pTab) + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer((*TVTable)(unsafe.Pointer(pVTab)).FpVtab)).FpModule)).FxRename == uintptr(0) { + pVTab = uintptr(0) + } + } + /* Begin a transaction for database iDb. Then modify the schema cookie + ** (since the ALTER TABLE modifies the schema). Call sqlite3MayAbort(), + ** as the scalar functions (e.g. sqlite_rename_table()) invoked by the + ** nested SQL may raise an exception. */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto exit_rename_table + } + _sqlite3MayAbort(tls, pParse) + /* figure out how many UTF-8 characters are in zName */ + zTabName = (*TTable)(unsafe.Pointer(pTab)).FzName + nTabName = _sqlite3Utf8CharLen(tls, zTabName, -int32(1)) + /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in + ** the schema to use the new table name. */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9123, libc.VaList(bp+8, zDb, zDb, zTabName, zName, libc.BoolInt32(iDb == int32(1)), zTabName)) + /* Update the tbl_name and name columns of the sqlite_schema table + ** as required. */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9307, libc.VaList(bp+8, zDb, zName, zName, zName, nTabName, zTabName)) + /* If the sqlite_sequence table exists in this database, then update + ** it with the new table name. + */ + if _sqlite3FindTable(tls, db, __ccgo_ts+9612, zDb) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9628, libc.VaList(bp+8, zDb, zName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + } + /* If the table being renamed is not itself part of the temp database, + ** edit view and trigger definitions within the temp database + ** as required. */ + if iDb != int32(1) { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9686, libc.VaList(bp+8, zDb, zTabName, zName, zTabName, zDb, zName)) + } + /* If this is a virtual table, invoke the xRename() function if + ** one is defined. The xRename() callback will modify the names + ** of any resources used by the v-table implementation (including other + ** SQLite tables) that are identified by the name of the virtual table. + */ + if pVTab != 0 { + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + i = v1 + _sqlite3VdbeLoadString(tls, v, i, zName) + _sqlite3VdbeAddOp4(tls, v, int32(OP_VRename), i, 0, 0, pVTab, -int32(11)) + } + _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+9951, 0) +exit_rename_table: + ; + _sqlite3SrcListDelete(tls, db, pSrc) + _sqlite3DbFree(tls, db, zName) +} + +// C documentation +// +// /* +// ** Write code that will raise an error if the table described by +// ** zDb and zTab is not empty. +// */ +func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+9964, libc.VaList(bp+8, zErr, zDb, zTab)) +} + +// C documentation +// +// /* +// ** This function is called after an "ALTER TABLE ... ADD" statement +// ** has been parsed. Argument pColDef contains the text of the new +// ** column definition. +// ** +// ** The Table structure pParse->pNewTable was extended to include +// ** the new column during parsing. +// */ +func _sqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pCol, pDflt, pNew, pTab, v, zCol, zDb, zEnd, zTab, v1 uintptr + var iDb, r1, rc int32 + var _ /* pVal at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, iDb, pCol, pDflt, pNew, pTab, r1, rc, v, zCol, zDb, zEnd, zTab, v1 /* Temporary registers */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + pNew = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pNew)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + zTab = (*TTable)(unsafe.Pointer(pNew)).FzName + 16 /* Skip the "sqlite_altertab_" prefix on the name */ + pCol = (*TTable)(unsafe.Pointer(pNew)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))*16 + pDflt = _sqlite3ColumnExpr(tls, pNew, pCol) + pTab = _sqlite3FindTable(tls, db, zTab, zDb) + /* Invoke the authorization callback. */ + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { + return + } + /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. + ** If there is a NOT NULL constraint, then the default value for the + ** column must not be NULL. + */ + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10002, 0) + return + } + if (*TTable)(unsafe.Pointer(pNew)).FpIndex != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10034, 0) + return + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { + /* If the default value for the new column was specified with a + ** literal NULL, then set pDflt to 0. This simplifies checking + ** for an SQL NULL default below. + */ + if pDflt != 0 && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pDflt)).FpLeft)).Fop) == int32(TK_NULL) { + pDflt = uintptr(0) + } + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 && (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FpFKey != 0 && pDflt != 0 { + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10061) + } + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && !(pDflt != 0) { + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10120) + } + /* Ensure the default expression is something that sqlite3ValueFromExpr() + ** can handle (i.e. not CURRENT_TIME etc.) + */ + if pDflt != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = _sqlite3ValueFromExpr(tls, db, pDflt, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp) + if rc != SQLITE_OK { + return + } + if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10173) + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } else { + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { + _sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, __ccgo_ts+10219) + } + } + /* Modify the CREATE TABLE statement. */ + zCol = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pColDef)).Fz, uint64((*TToken)(unsafe.Pointer(pColDef)).Fn)) + if zCol != 0 { + zEnd = zCol + uintptr((*TToken)(unsafe.Pointer(pColDef)).Fn-uint32(1)) + for zEnd > zCol && (int32(*(*int8)(unsafe.Pointer(zEnd))) == int32(';') || int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd)))])&int32(0x01) != 0) { + v1 = zEnd + zEnd-- + *(*int8)(unsafe.Pointer(v1)) = int8('\000') + } + /* substr() operations on characters, but addColOffset is in bytes. So we + ** have to use printf() to translate between these units: */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10246, libc.VaList(bp+16, zDb, (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FaddColOffset, zCol, (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FaddColOffset, zTab)) + _sqlite3DbFree(tls, db, zCol) + } + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + /* Make sure the schema version is at least 3. But do not upgrade + ** from less than 3 to 4, as that will corrupt any preexisting DESC + ** index. + */ + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_ReadCookie), iDb, r1, int32(BTREE_FILE_FORMAT)) + _sqlite3VdbeUsesBtree(tls, v, iDb) + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), r1, -int32(2)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfPos), r1, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_FILE_FORMAT), int32(3)) + _sqlite3ReleaseTempReg(tls, pParse, r1) + /* Reload the table definition */ + _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterAdd)) + /* Verify that constraints are still satisfied */ + if (*TTable)(unsafe.Pointer(pNew)).FpCheck != uintptr(0) || int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 && int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != uint32(0) { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10392, libc.VaList(bp+16, zTab, zDb)) + } + } +} + +// C documentation +// +// /* +// ** This function is called by the parser after the table-name in +// ** an "ALTER TABLE ADD" statement is parsed. Argument +// ** pSrc is the full-name of the table being altered. +// ** +// ** This routine makes a (partial) copy of the Table structure +// ** for the table being altered and sets Parse.pNewTable to point +// ** to it. Routines called by the parser as the column definition +// ** is parsed (i.e. sqlite3AddColumn()) add the new Column data to +// ** the copy. The copy of the Table structure is deleted by tokenize.c +// ** after parsing is finished. +// ** +// ** Routine sqlite3AlterFinishAddColumn() will be called to complete +// ** coding the "ALTER TABLE ... ADD" statement. +// */ +func _sqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pCol, pNew, pTab uintptr + var i, iDb, nAlloc int32 + _, _, _, _, _, _, _ = db, i, iDb, nAlloc, pCol, pNew, pTab + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + /* Look up the table being altered. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_begin_add_column + } + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pSrc+8) + if !(pTab != 0) { + goto exit_begin_add_column + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10745, 0) + goto exit_begin_add_column + } + /* Make sure this is not an attempt to ALTER a view. */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10779, 0) + goto exit_begin_add_column + } + if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { + goto exit_begin_add_column + } + _sqlite3MayAbort(tls, pParse) + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + /* Put a copy of the Table struct in Parse.pNewTable for the + ** sqlite3AddColumn() function and friends to modify. But modify + ** the name by adding an "sqlite_altertab_" prefix. By adding this + ** prefix, we insure that the name will not collide with an existing + ** table because user table are not allowed to have the "sqlite_" + ** prefix on their name. + */ + pNew = _sqlite3DbMallocZero(tls, db, uint64(104)) + if !(pNew != 0) { + goto exit_begin_add_column + } + (*TParse)(unsafe.Pointer(pParse)).FpNewTable = pNew + (*TTable)(unsafe.Pointer(pNew)).FnTabRef = uint32(1) + (*TTable)(unsafe.Pointer(pNew)).FnCol = (*TTable)(unsafe.Pointer(pTab)).FnCol + nAlloc = (int32((*TTable)(unsafe.Pointer(pNew)).FnCol)-int32(1))/int32(8)*int32(8) + int32(8) + (*TTable)(unsafe.Pointer(pNew)).FaCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nAlloc)) + (*TTable)(unsafe.Pointer(pNew)).FzName = _sqlite3MPrintf(tls, db, __ccgo_ts+10809, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if !((*TTable)(unsafe.Pointer(pNew)).FaCol != 0) || !((*TTable)(unsafe.Pointer(pNew)).FzName != 0) { + goto exit_begin_add_column + } + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pNew)).FaCol, (*TTable)(unsafe.Pointer(pTab)).FaCol, uint64(16)*uint64((*TTable)(unsafe.Pointer(pNew)).FnCol)) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pNew)).FnCol)) { + break + } + pCol = (*TTable)(unsafe.Pointer(pNew)).FaCol + uintptr(i)*16 + (*TColumn)(unsafe.Pointer(pCol)).FzCnName = _sqlite3DbStrDup(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + goto _1 + _1: + ; + i++ + } + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FpDfltList = _sqlite3ExprListDup(tls, db, (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList, 0) + (*TTable)(unsafe.Pointer(pNew)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FaddColOffset = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FaddColOffset +exit_begin_add_column: + ; + _sqlite3SrcListDelete(tls, db, pSrc) + return +} + +// C documentation +// +// /* +// ** Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN +// ** command. This function checks if the table is a view or virtual +// ** table (columns of views or virtual tables may not be renamed). If so, +// ** it loads an error message into pParse and returns non-zero. +// ** +// ** Or, if pTab is not a view or virtual table, zero is returned. +// */ +func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var zType, v1 uintptr + _, _ = zType, v1 + zType = uintptr(0) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + zType = __ccgo_ts + 10828 + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + zType = __ccgo_ts + 10833 + } + if zType != 0 { + if bDrop != 0 { + v1 = __ccgo_ts + 10847 + } else { + v1 = __ccgo_ts + 10864 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10882, libc.VaList(bp+8, v1, zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Handles the following parser reduction: +// ** +// ** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew +// */ +func _sqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld uintptr, pNew uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var bQuote, iCol, iSchema int32 + var db, pTab, zDb, zNew, zOld uintptr + _, _, _, _, _, _, _, _ = bQuote, db, iCol, iSchema, pTab, zDb, zNew, zOld + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Index of column being renamed */ + zOld = uintptr(0) /* Old column name */ + zNew = uintptr(0) /* True to quote the new name */ + /* Locate the table to be altered */ + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pSrc+8) + if !(pTab != 0) { + goto exit_rename_column + } + /* Cannot alter a system table */ + if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { + goto exit_rename_column + } + if SQLITE_OK != _isRealTable(tls, pParse, pTab, 0) { + goto exit_rename_column + } + /* Which schema holds the table to be altered */ + iSchema = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*32))).FzDbSName + /* Invoke the authorization callback. */ + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { + goto exit_rename_column + } + /* Make sure the old name really is a column name in the table to be + ** altered. Set iCol to be the index of the column being renamed */ + zOld = _sqlite3NameFromToken(tls, db, pOld) + if !(zOld != 0) { + goto exit_rename_column + } + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if 0 == _sqlite3StrICmp(tls, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName, zOld) { + break + } + goto _1 + _1: + ; + iCol++ + } + if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10900, libc.VaList(bp+8, pOld)) + goto exit_rename_column + } + /* Ensure the schema contains no double-quoted strings */ + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+1680, 0) + _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1))) + /* Do the rename operation using a recursive UPDATE statement that + ** uses the sqlite_rename_column() SQL function to compute the new + ** CREATE statement text for the sqlite_schema table. + */ + _sqlite3MayAbort(tls, pParse) + zNew = _sqlite3NameFromToken(tls, db, pNew) + if !(zNew != 0) { + goto exit_rename_column + } + bQuote = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pNew)).Fz)))]) & int32(0x80) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+10921, libc.VaList(bp+8, zDb, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, libc.BoolInt32(iSchema == int32(1)), (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11103, libc.VaList(bp+8, zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + /* Drop and reload the database schema. */ + _renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iSchema == int32(1)), __ccgo_ts+9951, int32(1)) +exit_rename_column: + ; + _sqlite3SrcListDelete(tls, db, pSrc) + _sqlite3DbFree(tls, db, zOld) + _sqlite3DbFree(tls, db, zNew) + return +} + +/* +** Each RenameToken object maps an element of the parse tree into +** the token that generated that element. The parse tree element +** might be one of: +** +** * A pointer to an Expr that represents an ID +** * The name of a table column in Column.zName +** +** A list of RenameToken objects can be constructed during parsing. +** Each new object is created by sqlite3RenameTokenMap(). +** As the parse tree is transformed, the sqlite3RenameTokenRemap() +** routine is used to keep the mapping current. +** +** After the parse finishes, renameTokenFind() routine can be used +** to look up the actual token value that created some element in +** the parse tree. + */ +type TRenameToken1 = struct { + Fp uintptr + Ft TToken + FpNext uintptr +} + +type RenameToken1 = TRenameToken1 + +// C documentation +// +// /* +// ** The context of an ALTER TABLE RENAME COLUMN operation that gets passed +// ** down into the Walker. +// */ +type TRenameCtx = struct { + FpList uintptr + FnList int32 + FiCol int32 + FpTab uintptr + FzOld uintptr +} + +type RenameCtx = TRenameCtx + +type TRenameCtx1 = struct { + FpList uintptr + FnList int32 + FiCol int32 + FpTab uintptr + FzOld uintptr +} + +type RenameCtx1 = TRenameCtx1 + +// C documentation +// +// /* +// ** Remember that the parser tree element pPtr was created using +// ** the token pToken. +// ** +// ** In other words, construct a new RenameToken object and add it +// ** to the list of RenameToken objects currently being built up +// ** in pParse->pRename. +// ** +// ** The pPtr argument is returned so that this routine can be used +// ** with tail recursion in tokenExpr() routine, for a small performance +// ** improvement. +// */ +func _sqlite3RenameTokenMap(tls *libc.TLS, pParse uintptr, pPtr uintptr, pToken uintptr) (r uintptr) { + var pNew uintptr + _ = pNew + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != int32(PARSE_MODE_UNMAP) { + pNew = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(32)) + if pNew != 0 { + (*TRenameToken)(unsafe.Pointer(pNew)).Fp = pPtr + (*TRenameToken)(unsafe.Pointer(pNew)).Ft = *(*TToken)(unsafe.Pointer(pToken)) + (*TRenameToken)(unsafe.Pointer(pNew)).FpNext = (*TParse)(unsafe.Pointer(pParse)).FpRename + (*TParse)(unsafe.Pointer(pParse)).FpRename = pNew + } + } + return pPtr +} + +// C documentation +// +// /* +// ** It is assumed that there is already a RenameToken object associated +// ** with parse tree element pFrom. This function remaps the associated token +// ** to parse tree element pTo. +// */ +func _sqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom uintptr) { + var p uintptr + _ = p + p = (*TParse)(unsafe.Pointer(pParse)).FpRename + for { + if !(p != 0) { + break + } + if (*TRenameToken)(unsafe.Pointer(p)).Fp == pFrom { + (*TRenameToken)(unsafe.Pointer(p)).Fp = pTo + break + } + goto _1 + _1: + ; + p = (*TRenameToken)(unsafe.Pointer(p)).FpNext + } +} + +// C documentation +// +// /* +// ** Walker callback used by sqlite3RenameExprUnmap(). +// */ +func _renameUnmapExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pParse uintptr + _ = pParse + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr+64) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Iterate through the Select objects that are part of WITH clauses attached +// ** to select statement pSelect. +// */ +func _renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var i int32 + var p, pCopy, pParse, pWith uintptr + var _ /* sNC at bp+0 */ TNameContext + _, _, _, _, _ = i, p, pCopy, pParse, pWith + pWith = (*TSelect)(unsafe.Pointer(pSelect)).FpWith + if pWith != 0 { + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + pCopy = uintptr(0) + if (*TSelect)(unsafe.Pointer((*(*TCte)(unsafe.Pointer(pWith + 16))).FpSelect)).FselFlags&uint32(SF_Expanded) == uint32(0) { + /* Push a copy of the With object onto the with-stack. We use a copy + ** here as the original will be expanded and resolved (flags SF_Expanded + ** and SF_Resolved) below. And the parser code that uses the with-stack + ** fails if the Select objects on it have already been expanded and + ** resolved. */ + pCopy = _sqlite3WithDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWith) + pCopy = _sqlite3WithPush(tls, pParse, pCopy, uint8(1)) + } + i = 0 + for { + if !(i < (*TWith)(unsafe.Pointer(pWith)).FnCte) { + break + } + p = (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpSelect + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + if pCopy != 0 { + _sqlite3SelectPrep(tls, (*(*TNameContext)(unsafe.Pointer(bp))).FpParse, p, bp) + } + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*(*TNameContext)(unsafe.Pointer(bp))).FpParse)).Fdb)).FmallocFailed != 0 { + return + } + _sqlite3WalkSelect(tls, pWalker, p) + _sqlite3RenameExprlistUnmap(tls, pParse, (*(*TCte)(unsafe.Pointer(pWith + 16 + uintptr(i)*48))).FpCols) + goto _1 + _1: + ; + i++ + } + if pCopy != 0 && (*TParse)(unsafe.Pointer(pParse)).FpWith == pCopy { + (*TParse)(unsafe.Pointer(pParse)).FpWith = (*TWith)(unsafe.Pointer(pCopy)).FpOuter + } + } +} + +// C documentation +// +// /* +// ** Unmap all tokens in the IdList object passed as the second argument. +// */ +func _unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { + var ii int32 + _ = ii + ii = 0 + for { + if !(ii < (*TIdList)(unsafe.Pointer(pIdList)).FnId) { + break + } + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(ii)*16))).FzName) + goto _1 + _1: + ; + ii++ + } +} + +// C documentation +// +// /* +// ** Walker callback used by sqlite3RenameExprUnmap(). +// */ +func _renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + var i int32 + var pList, pParse, pSrc uintptr + _, _, _, _ = i, pList, pParse, pSrc + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(WRC_Abort) + } + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_View)|libc.Int32FromInt32(SF_CopyCte)) != 0 { + return int32(WRC_Prune) + } + if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { + pList = (*TSelect)(unsafe.Pointer(p)).FpEList + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + if (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FzEName != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FzEName) + } + goto _1 + _1: + ; + i++ + } + } + if (*TSelect)(unsafe.Pointer(p)).FpSrc != 0 { /* Every Select as a SrcList, even if it is empty */ + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FzName) + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 60 + 4))&0x400>>10)) == 0 { + _sqlite3WalkExpr(tls, pWalker, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 72))) + } else { + _unmapColumnIdlistNames(tls, pParse, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 72))) + } + goto _2 + _2: + ; + i++ + } + } + _renameWalkWith(tls, pWalker, p) + return WRC_Continue +} + +// C documentation +// +// /* +// ** Remove all nodes that are part of expression pExpr from the rename list. +// */ +func _sqlite3RenameExprUnmap(tls *libc.TLS, pParse uintptr, pExpr uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var eMode Tu8 + var _ /* sWalker at bp+0 */ TWalker + _ = eMode + eMode = (*TParse)(unsafe.Pointer(pParse)).FeParseMode + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_renameUnmapExprCb) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_renameUnmapSelectCb) + (*TParse)(unsafe.Pointer(pParse)).FeParseMode = uint8(PARSE_MODE_UNMAP) + _sqlite3WalkExpr(tls, bp, pExpr) + (*TParse)(unsafe.Pointer(pParse)).FeParseMode = eMode +} + +// C documentation +// +// /* +// ** Remove all nodes that are part of expression-list pEList from the +// ** rename list. +// */ +func _sqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i int32 + var _ /* sWalker at bp+0 */ TWalker + _ = i + if pEList != 0 { + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_renameUnmapExprCb) + _sqlite3WalkExprList(tls, bp, pEList) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName) + } + goto _1 + _1: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Free the list of RenameToken objects given in the second argument +// */ +func _renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { + var p, pNext uintptr + _, _ = p, pNext + p = pToken + for { + if !(p != 0) { + break + } + pNext = (*TRenameToken)(unsafe.Pointer(p)).FpNext + _sqlite3DbFree(tls, db, p) + goto _1 + _1: + ; + p = pNext + } +} + +// C documentation +// +// /* +// ** Search the Parse object passed as the first argument for a RenameToken +// ** object associated with parse tree element pPtr. If found, return a pointer +// ** to it. Otherwise, return NULL. +// ** +// ** If the second argument passed to this function is not NULL and a matching +// ** RenameToken object is found, remove it from the Parse object and add it to +// ** the list maintained by the RenameCtx object. +// */ +func _renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) (r uintptr) { + var pToken, pp uintptr + _, _ = pToken, pp + if pPtr == uintptr(0) { + return uintptr(0) + } + pp = pParse + 416 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + if (*TRenameToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).Fp == pPtr { + pToken = *(*uintptr)(unsafe.Pointer(pp)) + if pCtx != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext + (*TRenameToken)(unsafe.Pointer(pToken)).FpNext = (*TRenameCtx1)(unsafe.Pointer(pCtx)).FpList + (*TRenameCtx1)(unsafe.Pointer(pCtx)).FpList = pToken + (*TRenameCtx1)(unsafe.Pointer(pCtx)).FnList++ + } + return pToken + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** This is a Walker select callback. It does nothing. It is only required +// ** because without a dummy callback, sqlite3WalkExpr() and similar do not +// ** descend into sub-select statements. +// */ +func _renameColumnSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_View)|libc.Int32FromInt32(SF_CopyCte)) != 0 { + return int32(WRC_Prune) + } + _renameWalkWith(tls, pWalker, p) + return WRC_Continue +} + +// C documentation +// +// /* +// ** This is a Walker expression callback. +// ** +// ** For every TK_COLUMN node in the expression tree, search to see +// ** if the column being references is the column being renamed by an +// ** ALTER TABLE statement. If it is, then attach its associated +// ** RenameToken object to the list of RenameToken objects being +// ** constructed in RenameCtx object at pWalker->u.pRename. +// */ +func _renameColumnExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var p uintptr + _ = p + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER) && int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) == (*TRenameCtx)(unsafe.Pointer(p)).FiCol && (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).FpTriggerTab == (*TRenameCtx)(unsafe.Pointer(p)).FpTab { + _renameTokenFind(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, p, pExpr) + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) == (*TRenameCtx)(unsafe.Pointer(p)).FiCol && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) && (*TRenameCtx)(unsafe.Pointer(p)).FpTab == *(*uintptr)(unsafe.Pointer(pExpr + 64)) { + _renameTokenFind(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, p, pExpr) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** The RenameCtx contains a list of tokens that reference a column that +// ** is being renamed by an ALTER TABLE statement. Return the "last" +// ** RenameToken in the RenameCtx and remove that RenameToken from the +// ** RenameContext. "Last" means the last RenameToken encountered when +// ** the input SQL is parsed from left to right. Repeated calls to this routine +// ** return all column name tokens in the order that they are encountered +// ** in the SQL statement. +// */ +func _renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) (r uintptr) { + var pBest, pToken, pp uintptr + _, _, _ = pBest, pToken, pp + pBest = (*TRenameCtx)(unsafe.Pointer(pCtx)).FpList + pToken = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext + for { + if !(pToken != 0) { + break + } + if (*TRenameToken)(unsafe.Pointer(pToken)).Ft.Fz > (*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz { + pBest = pToken + } + goto _1 + _1: + ; + pToken = (*TRenameToken)(unsafe.Pointer(pToken)).FpNext + } + pp = pCtx + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != pBest) { + break + } + goto _2 + _2: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TRenameToken)(unsafe.Pointer(pBest)).FpNext + return pBest +} + +// C documentation +// +// /* +// ** An error occurred while parsing or otherwise processing a database +// ** object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an +// ** ALTER TABLE RENAME COLUMN program. The error message emitted by the +// ** sub-routine is currently stored in pParse->zErrMsg. This function +// ** adds context to the error message and then stores it in pCtx. +// */ +func _renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType uintptr, pObject uintptr, pParse uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var zErr, zN, zT, v1 uintptr + _, _, _, _ = zErr, zN, zT, v1 + zT = Xsqlite3_value_text(tls, pType) + zN = Xsqlite3_value_text(tls, pObject) + if *(*int8)(unsafe.Pointer(zWhen)) != 0 { + v1 = __ccgo_ts + 11234 + } else { + v1 = __ccgo_ts + 1680 + } + zErr = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+11236, libc.VaList(bp+8, zT, zN, v1, zWhen, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg)) + Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zErr) +} + +// C documentation +// +// /* +// ** For each name in the the expression-list pEList (i.e. each +// ** pEList->a[i].zName) that matches the string in zOld, extract the +// ** corresponding rename-token from Parse object pParse and add it +// ** to the RenameCtx pCtx. +// */ +func _renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList uintptr, zOld uintptr) { + var i int32 + var zName uintptr + _, _ = i, zName + if pEList != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + zName = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME && zName != uintptr(0) && 0 == Xsqlite3_stricmp(tls, zName, zOld) { + _renameTokenFind(tls, pParse, pCtx, zName) + } + goto _1 + _1: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** For each name in the the id-list pIdList (i.e. each pIdList->a[i].zName) +// ** that matches the string in zOld, extract the corresponding rename-token +// ** from Parse object pParse and add it to the RenameCtx pCtx. +// */ +func _renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdList uintptr, zOld uintptr) { + var i int32 + var zName uintptr + _, _ = i, zName + if pIdList != 0 { + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pIdList)).FnId) { + break + } + zName = (*(*TIdList_item)(unsafe.Pointer(pIdList + 8 + uintptr(i)*16))).FzName + if 0 == Xsqlite3_stricmp(tls, zName, zOld) { + _renameTokenFind(tls, pParse, pCtx, zName) + } + goto _1 + _1: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Parse the SQL statement zSql using Parse object (*p). The Parse object +// ** is initialized by this function before it is used. +// */ +func _renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uintptr, bTemp int32) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + _sqlite3ParseObjectInit(tls, p, db) + if zSql == uintptr(0) { + return int32(SQLITE_NOMEM) + } + if Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+11259, int32(7)) != 0 { + return _sqlite3CorruptError(tls, int32(116682)) + } + if bTemp != 0 { + v1 = int32(1) + } else { + v1 = _sqlite3FindDbName(tls, db, zDb) + } + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(v1) + (*TParse)(unsafe.Pointer(p)).FeParseMode = uint8(PARSE_MODE_RENAME) + (*TParse)(unsafe.Pointer(p)).Fdb = db + (*TParse)(unsafe.Pointer(p)).FnQueryLoop = int16(1) + rc = _sqlite3RunParser(tls, p, zSql) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + } + if rc == SQLITE_OK && ((*TParse)(unsafe.Pointer(p)).FpNewTable == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0) && (*TParse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { + rc = _sqlite3CorruptError(tls, int32(116693)) + } + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) + return rc +} + +// C documentation +// +// /* +// ** This function edits SQL statement zSql, replacing each token identified +// ** by the linked list pRename with the text of zNew. If argument bQuote is +// ** true, then zNew is always quoted first. If no error occurs, the result +// ** is loaded into context object pCtx as the result. +// ** +// ** Or, if an error occurs (i.e. an OOM condition), an error is left in +// ** pCtx and an SQLite error code returned. +// */ +func _renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, zNew uintptr, bQuote int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pBest, zBuf1, zBuf2, zOut, zQuot, zReplace, v1 uintptr + var iOff, nOut, rc int32 + var nNew, nQuot, nSql Ti64 + var nReplace Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, iOff, nNew, nOut, nQuot, nReplace, nSql, pBest, rc, zBuf1, zBuf2, zOut, zQuot, zReplace, v1 + nNew = int64(_sqlite3Strlen30(tls, zNew)) + nSql = int64(_sqlite3Strlen30(tls, zSql)) + db = Xsqlite3_context_db_handle(tls, pCtx) + rc = SQLITE_OK + zQuot = uintptr(0) + nQuot = 0 + zBuf1 = uintptr(0) + zBuf2 = uintptr(0) + if zNew != 0 { + /* Set zQuot to point to a buffer containing a quoted copy of the + ** identifier zNew. If the corresponding identifier in the original + ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to + ** point to zQuot so that all substitutions are made using the + ** quoted version of the new column name. */ + zQuot = _sqlite3MPrintf(tls, db, __ccgo_ts+11267, libc.VaList(bp+8, zNew)) + if zQuot == uintptr(0) { + return int32(SQLITE_NOMEM) + } else { + nQuot = int64(_sqlite3Strlen30(tls, zQuot) - int32(1)) + } + zOut = _sqlite3DbMallocZero(tls, db, uint64(nSql+int64((*TRenameCtx)(unsafe.Pointer(pRename)).FnList)*nQuot+int64(1))) + } else { + zOut = _sqlite3DbMallocZero(tls, db, uint64((nSql*int64(2)+int64(1))*int64(3))) + if zOut != 0 { + zBuf1 = zOut + uintptr(nSql*int64(2)+int64(1)) + zBuf2 = zOut + uintptr(nSql*int64(4)+int64(2)) + } + } + /* At this point pRename->pList contains a list of RenameToken objects + ** corresponding to all tokens in the input SQL that must be replaced + ** with the new column name, or with single-quoted versions of themselves. + ** All that remains is to construct and return the edited SQL string. */ + if zOut != 0 { + nOut = int32(nSql) + libc.Xmemcpy(tls, zOut, zSql, uint64(nSql)) + for (*TRenameCtx)(unsafe.Pointer(pRename)).FpList != 0 { + pBest = _renameColumnTokenNext(tls, pRename) + if zNew != 0 { + if bQuote == 0 && _sqlite3IsIdChar(tls, uint8(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz)))) != 0 { + nReplace = uint32(nNew) + zReplace = zNew + } else { + nReplace = uint32(nQuot) + zReplace = zQuot + if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('"') { + nReplace++ + } + } + } else { + /* Dequote the double-quoted token. Then requote it again, this time + ** using single quotes. If the character immediately following the + ** original token within the input SQL was a single quote ('), then + ** add another space after the new, single-quoted version of the + ** token. This is so that (SELECT "string"'alias') maps to + ** (SELECT 'string' 'alias'), and not (SELECT 'string''alias'). */ + libc.Xmemcpy(tls, zBuf1, (*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) + *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = 0 + _sqlite3Dequote(tls, zBuf1) + if int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == int32('\'') { + v1 = __ccgo_ts + 11234 + } else { + v1 = __ccgo_ts + 1680 + } + Xsqlite3_snprintf(tls, int32(nSql*int64(2)), zBuf2, __ccgo_ts+11273, libc.VaList(bp+8, zBuf1, v1)) + zReplace = zBuf2 + nReplace = uint32(_sqlite3Strlen30(tls, zReplace)) + } + iOff = int32(int64((*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fz) - int64(zSql)) + if (*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn != nReplace { + libc.Xmemmove(tls, zOut+uintptr(uint32(iOff)+nReplace), zOut+uintptr(uint32(iOff)+(*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn), uint64(uint32(nOut)-(uint32(iOff)+(*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) + nOut = int32(uint32(nOut) + (nReplace - (*TRenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) + *(*int8)(unsafe.Pointer(zOut + uintptr(nOut))) = int8('\000') + } + libc.Xmemcpy(tls, zOut+uintptr(iOff), zReplace, uint64(nReplace)) + _sqlite3DbFree(tls, db, pBest) + } + Xsqlite3_result_text(tls, pCtx, zOut, -int32(1), uintptr(-libc.Int32FromInt32(1))) + _sqlite3DbFree(tls, db, zOut) + } else { + rc = int32(SQLITE_NOMEM) + } + Xsqlite3_free(tls, zQuot) + return rc +} + +// C documentation +// +// /* +// ** Set all pEList->a[].fg.eEName fields in the expression-list to val. +// */ +func _renameSetENames(tls *libc.TLS, pEList uintptr, val int32) { + var i int32 + _ = i + if pEList != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + libc.SetBitFieldPtr16Uint32(pEList+8+uintptr(i)*32+16+4, uint32(val), 0, 0x3) + goto _1 + _1: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Resolve all symbols in the trigger at pParse->pNewTrigger, assuming +// ** it was read from the schema of database zDb. Return SQLITE_OK if +// ** successful. Otherwise, return an SQLite error code and leave an error +// ** message in the Parse object. +// */ +func _renameResolveTrigger(tls *libc.TLS, pParse uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, p, pNew, pSel, pSrc, pStep, pUpsert, pUpsertSet uintptr + var i, rc, v2 int32 + var _ /* sNC at bp+0 */ TNameContext + _, _, _, _, _, _, _, _, _, _, _ = db, i, p, pNew, pSel, pSrc, pStep, pUpsert, pUpsertSet, rc, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pNew = (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger + rc = SQLITE_OK + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab = _sqlite3FindTable(tls, db, (*TTrigger)(unsafe.Pointer(pNew)).Ftable, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(_sqlite3SchemaToIndex(tls, db, (*TTrigger)(unsafe.Pointer(pNew)).FpTabSchema))*32))).FzDbSName) + (*TParse)(unsafe.Pointer(pParse)).FeTriggerOp = (*TTrigger)(unsafe.Pointer(pNew)).Fop + /* ALWAYS() because if the table of the trigger does not exist, the + ** error would have been hit before this point */ + if (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab != 0 { + rc = _sqlite3ViewGetColumnNames(tls, pParse, (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab) + } + /* Resolve symbols in WHEN clause */ + if rc == SQLITE_OK && (*TTrigger)(unsafe.Pointer(pNew)).FpWhen != 0 { + rc = _sqlite3ResolveExprNames(tls, bp, (*TTrigger)(unsafe.Pointer(pNew)).FpWhen) + } + pStep = (*TTrigger)(unsafe.Pointer(pNew)).Fstep_list + for { + if !(rc == SQLITE_OK && pStep != 0) { + break + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect != 0 { + _sqlite3SelectPrep(tls, pParse, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect, bp) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + rc = (*TParse)(unsafe.Pointer(pParse)).Frc + } + } + if rc == SQLITE_OK && (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0 { + pSrc = _sqlite3TriggerStepSrc(tls, pParse, pStep) + if pSrc != 0 { + pSel = _sqlite3SelectNew(tls, pParse, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList, pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + if pSel == uintptr(0) { + (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList = uintptr(0) + pSrc = uintptr(0) + rc = int32(SQLITE_NOMEM) + } else { + /* pStep->pExprList contains an expression-list used for an UPDATE + ** statement. So the a[].zEName values are the RHS of the + ** "= " clauses of the UPDATE statement. So, before + ** running SelectPrep(), change all the eEName values in + ** pStep->pExprList to ENAME_SPAN (from their current value of + ** ENAME_NAME). This is to prevent any ids in ON() clauses that are + ** part of pSrc from being incorrectly resolved against the + ** a[].zEName values as if they were column aliases. */ + _renameSetENames(tls, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList, int32(ENAME_SPAN)) + _sqlite3SelectPrep(tls, pParse, pSel, uintptr(0)) + _renameSetENames(tls, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList, ENAME_NAME) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + v2 = int32(SQLITE_ERROR) + } else { + v2 = SQLITE_OK + } + rc = v2 + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList != 0 { + (*TSelect)(unsafe.Pointer(pSel)).FpEList = uintptr(0) + } + (*TSelect)(unsafe.Pointer(pSel)).FpSrc = uintptr(0) + _sqlite3SelectDelete(tls, db, pSel) + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom)).FnSrc && rc == SQLITE_OK) { + break + } + p = (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104 + if (*TSrcItem)(unsafe.Pointer(p)).FpSelect != 0 { + _sqlite3SelectPrep(tls, pParse, (*TSrcItem)(unsafe.Pointer(p)).FpSelect, uintptr(0)) + } + goto _3 + _3: + ; + i++ + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + } + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = pSrc + if rc == SQLITE_OK && (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere != 0 { + rc = _sqlite3ResolveExprNames(tls, bp, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere) + } + if rc == SQLITE_OK { + rc = _sqlite3ResolveExprListNames(tls, bp, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList) + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0 && rc == SQLITE_OK { + pUpsert = (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert + (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc = pSrc + *(*uintptr)(unsafe.Pointer(bp + 16)) = pUpsert + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags = int32(NC_UUpsert) + rc = _sqlite3ResolveExprListNames(tls, bp, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + if rc == SQLITE_OK { + pUpsertSet = (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet + rc = _sqlite3ResolveExprListNames(tls, bp, pUpsertSet) + } + if rc == SQLITE_OK { + rc = _sqlite3ResolveExprNames(tls, bp, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere) + } + if rc == SQLITE_OK { + rc = _sqlite3ResolveExprNames(tls, bp, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + } + (*(*TNameContext)(unsafe.Pointer(bp))).FncFlags = 0 + } + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = uintptr(0) + _sqlite3SrcListDelete(tls, db, pSrc) + } else { + rc = int32(SQLITE_NOMEM) + } + } + goto _1 + _1: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + return rc +} + +// C documentation +// +// /* +// ** Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr +// ** objects that are part of the trigger passed as the second argument. +// */ +func _renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { + var i int32 + var pStep, pUpsert uintptr + _, _, _ = i, pStep, pUpsert + /* Find tokens to edit in WHEN clause */ + _sqlite3WalkExpr(tls, pWalker, (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen) + /* Find tokens to edit in trigger steps */ + pStep = (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list + for { + if !(pStep != 0) { + break + } + _sqlite3WalkSelect(tls, pWalker, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect) + _sqlite3WalkExpr(tls, pWalker, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere) + _sqlite3WalkExprList(tls, pWalker, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList) + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0 { + pUpsert = (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert + _sqlite3WalkExprList(tls, pWalker, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + _sqlite3WalkExprList(tls, pWalker, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet) + _sqlite3WalkExpr(tls, pWalker, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere) + _sqlite3WalkExpr(tls, pWalker, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom)).FnSrc) { + break + } + _sqlite3WalkSelect(tls, pWalker, (*(*TSrcItem)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104))).FpSelect) + goto _2 + _2: + ; + i++ + } + } + goto _1 + _1: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } +} + +// C documentation +// +// /* +// ** Free the contents of Parse object (*pParse). Do not free the memory +// ** occupied by the Parse object itself. +// */ +func _renameParseCleanup(tls *libc.TLS, pParse uintptr) { + var db, pIdx, v1 uintptr + _, _, _ = db, pIdx, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FpVdbe != 0 { + _sqlite3VdbeFinalize(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe) + } + _sqlite3DeleteTable(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpNewTable) + for { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpNewIndex + pIdx = v1 + if !(v1 != uintptr(0)) { + break + } + (*TParse)(unsafe.Pointer(pParse)).FpNewIndex = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + _sqlite3FreeIndex(tls, db, pIdx) + } + _sqlite3DeleteTrigger(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger) + _sqlite3DbFree(tls, db, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg) + _renameTokenFree(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpRename) + _sqlite3ParseObjectReset(tls, pParse) +} + +// C documentation +// +// /* +// ** SQL function: +// ** +// ** sqlite_rename_column(SQL,TYPE,OBJ,DB,TABLE,COL,NEWNAME,QUOTE,TEMP) +// ** +// ** 0. zSql: SQL statement to rewrite +// ** 1. type: Type of object ("table", "view" etc.) +// ** 2. object: Name of object +// ** 3. Database: Database name (e.g. "main") +// ** 4. Table: Table name +// ** 5. iCol: Index of column to rename +// ** 6. zNew: New column name +// ** 7. bQuote: Non-zero if the new column name should be quoted. +// ** 8. bTemp: True if zSql comes from temp schema +// ** +// ** Do a column rename operation on the CREATE statement given in zSql. +// ** The iCol-th column (left-most is 0) of table zTable is renamed from zCol +// ** into zNew. The name should be quoted if bQuote is true. +// ** +// ** This function is used internally by the ALTER TABLE RENAME COLUMN command. +// ** It is only accessible to SQL created using sqlite3NestedParse(). It is +// ** not reachable from ordinary SQL passed into sqlite3_prepare() unless the +// ** SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test setting is enabled. +// */ +func _renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(512) + defer tls.Free(512) + var bFKOnly, bQuote, bTemp, i, iCol, rc, v1, v2 int32 + var db, pExpr, pFKey, pIdx, pSelect, pStep, pTab, pTarget, pUpsertSet, zDb, zNew, zOld, zSql, zTable uintptr + var xAuth Tsqlite3_xauth + var _ /* sCtx at bp+0 */ TRenameCtx + var _ /* sParse at bp+32 */ TParse + var _ /* sWalker at bp+456 */ TWalker + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bFKOnly, bQuote, bTemp, db, i, iCol, pExpr, pFKey, pIdx, pSelect, pStep, pTab, pTarget, pUpsertSet, rc, xAuth, zDb, zNew, zOld, zSql, zTable, v1, v2 + db = Xsqlite3_context_db_handle(tls, context) + zSql = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + zTable = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + zNew = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + bQuote = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 7*8))) + bTemp = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 8*8))) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + _ = NotUsed + if zSql == uintptr(0) { + return + } + if zTable == uintptr(0) { + return + } + if zNew == uintptr(0) { + return + } + if iCol < 0 { + return + } + _sqlite3BtreeEnterAll(tls, db) + pTab = _sqlite3FindTable(tls, db, zTable, zDb) + if pTab == uintptr(0) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + _sqlite3BtreeLeaveAll(tls, db) + return + } + zOld = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName + libc.Xmemset(tls, bp, 0, uint64(32)) + if iCol == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + v1 = -int32(1) + } else { + v1 = iCol + } + (*(*TRenameCtx)(unsafe.Pointer(bp))).FiCol = v1 + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + rc = _renameParseSql(tls, bp+32, zDb, db, zSql, bTemp) + /* Find tokens that need to be replaced. */ + libc.Xmemset(tls, bp+456, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FpParse = bp + 32 + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxExprCallback = __ccgo_fp(_renameColumnExprCb) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxSelectCallback = __ccgo_fp(_renameColumnSelectCb) + *(*uintptr)(unsafe.Pointer(bp + 456 + 40)) = bp + (*(*TRenameCtx)(unsafe.Pointer(bp))).FpTab = pTab + if rc != SQLITE_OK { + goto renameColumnFunc_done + } + if (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable != 0 { + if int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FeTabType) == int32(TABTYP_VIEW) { + pSelect = (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).Fu))).FpSelect + *(*Tu32)(unsafe.Pointer(pSelect + 4)) &= uint32(^libc.Int32FromInt32(SF_View)) + (*(*TParse)(unsafe.Pointer(bp + 32))).Frc = SQLITE_OK + _sqlite3SelectPrep(tls, bp+32, pSelect, uintptr(0)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + v2 = int32(SQLITE_NOMEM) + } else { + v2 = (*(*TParse)(unsafe.Pointer(bp + 32))).Frc + } + rc = v2 + if rc == SQLITE_OK { + _sqlite3WalkSelect(tls, bp+456, pSelect) + } + if rc != SQLITE_OK { + goto renameColumnFunc_done + } + } else { + if int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FeTabType) == TABTYP_NORM { + /* A regular table */ + bFKOnly = Xsqlite3_stricmp(tls, zTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FzName) + (*(*TRenameCtx)(unsafe.Pointer(bp))).FpTab = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable + if bFKOnly == 0 { + if iCol < int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FnCol) { + _renameTokenFind(tls, bp+32, bp, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FaCol + uintptr(iCol)*16))).FzCnName) + } + if (*(*TRenameCtx)(unsafe.Pointer(bp))).FiCol < 0 { + _renameTokenFind(tls, bp+32, bp, (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable+52) + } + _sqlite3WalkExprList(tls, bp+456, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FpCheck) + pIdx = (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FpIndex + for { + if !(pIdx != 0) { + break + } + _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) + goto _3 + _3: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + pIdx = (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex + for { + if !(pIdx != 0) { + break + } + _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr) + goto _4 + _4: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FnCol)) { + break + } + pExpr = _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable)).FaCol+uintptr(i)*16) + _sqlite3WalkExpr(tls, bp+456, pExpr) + goto _5 + _5: + ; + i++ + } + } + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTable + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + if bFKOnly == 0 && (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom == iCol { + _renameTokenFind(tls, bp+32, bp, pFKey+64+uintptr(i)*16) + } + if 0 == Xsqlite3_stricmp(tls, (*TFKey)(unsafe.Pointer(pFKey)).FzTo, zTable) && 0 == Xsqlite3_stricmp(tls, (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FzCol, zOld) { + _renameTokenFind(tls, bp+32, bp, (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FzCol) + } + goto _7 + _7: + ; + i++ + } + goto _6 + _6: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + } + } + } + } else { + if (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex != 0 { + _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex)).FaColExpr) + _sqlite3WalkExpr(tls, bp+456, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewIndex)).FpPartIdxWhere) + } else { + rc = _renameResolveTrigger(tls, bp+32) + if rc != SQLITE_OK { + goto renameColumnFunc_done + } + pStep = (*TTrigger)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTrigger)).Fstep_list + for { + if !(pStep != 0) { + break + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0 { + pTarget = _sqlite3LocateTable(tls, bp+32, uint32(0), (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget, zDb) + if pTarget == pTab { + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0 { + pUpsertSet = (*TUpsert)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert)).FpUpsertSet + _renameColumnElistNames(tls, bp+32, bp, pUpsertSet, zOld) + } + _renameColumnIdlistNames(tls, bp+32, bp, (*TTriggerStep)(unsafe.Pointer(pStep)).FpIdList, zOld) + _renameColumnElistNames(tls, bp+32, bp, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList, zOld) + } + } + goto _8 + _8: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + /* Find tokens to edit in UPDATE OF clause */ + if (*(*TParse)(unsafe.Pointer(bp + 32))).FpTriggerTab == pTab { + _renameColumnIdlistNames(tls, bp+32, bp, (*TTrigger)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTrigger)).FpColumns, zOld) + } + /* Find tokens to edit in various expressions and selects */ + _renameWalkTrigger(tls, bp+456, (*(*TParse)(unsafe.Pointer(bp + 32))).FpNewTrigger) + } + } + rc = _renameEditSql(tls, context, bp, zSql, zNew, bQuote) +renameColumnFunc_done: + ; + if rc != SQLITE_OK { + if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + } else { + if (*(*TParse)(unsafe.Pointer(bp + 32))).FzErrMsg != 0 { + _renameColumnParseError(tls, context, __ccgo_ts+1680, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32) + } else { + Xsqlite3_result_error_code(tls, context, rc) + } + } + } + _renameParseCleanup(tls, bp+32) + _renameTokenFree(tls, db, (*(*TRenameCtx)(unsafe.Pointer(bp))).FpList) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + _sqlite3BtreeLeaveAll(tls, db) +} + +// C documentation +// +// /* +// ** Walker expression callback used by "RENAME TABLE". +// */ +func _renameTableExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var p uintptr + _ = p + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) && (*TRenameCtx)(unsafe.Pointer(p)).FpTab == *(*uintptr)(unsafe.Pointer(pExpr + 64)) { + _renameTokenFind(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, p, pExpr+64) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Walker select callback used by "RENAME TABLE". +// */ +func _renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) { + var i int32 + var p, pItem, pSrc uintptr + _, _, _, _ = i, p, pItem, pSrc + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pSrc = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + if (*TSelect)(unsafe.Pointer(pSelect)).FselFlags&uint32(libc.Int32FromInt32(SF_View)|libc.Int32FromInt32(SF_CopyCte)) != 0 { + return int32(WRC_Prune) + } + if pSrc == uintptr(0) { + return int32(WRC_Abort) + } + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + pItem = pSrc + 8 + uintptr(i)*104 + if (*TSrcItem)(unsafe.Pointer(pItem)).FpTab == (*TRenameCtx)(unsafe.Pointer(p)).FpTab { + _renameTokenFind(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, p, (*TSrcItem)(unsafe.Pointer(pItem)).FzName) + } + goto _1 + _1: + ; + i++ + } + _renameWalkWith(tls, pWalker, pSelect) + return WRC_Continue +} + +// C documentation +// +// /* +// ** This C function implements an SQL user function that is used by SQL code +// ** generated by the ALTER TABLE ... RENAME command to modify the definition +// ** of any foreign key constraints that use the table being renamed as the +// ** parent table. It is passed three arguments: +// ** +// ** 0: The database containing the table being renamed. +// ** 1. type: Type of object ("table", "view" etc.) +// ** 2. object: Name of object +// ** 3: The complete text of the schema statement being modified, +// ** 4: The old name of the table being renamed, and +// ** 5: The new name of the table being renamed. +// ** 6: True if the schema statement comes from the temp db. +// ** +// ** It returns the new schema statement. For example: +// ** +// ** sqlite_rename_table('main', 'CREATE TABLE t1(a REFERENCES t2)','t2','t3',0) +// ** -> 'CREATE TABLE t1(a REFERENCES t3)' +// */ +func _renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(560) + defer tls.Free(560) + var bQuote, bTemp, i, isLegacy, rc int32 + var db, pFKey, pItem, pSelect, pStep, pTab, pTrigger, zDb, zInput, zNew, zOld uintptr + var xAuth Tsqlite3_xauth + var _ /* sCtx at bp+424 */ TRenameCtx + var _ /* sNC at bp+504 */ TNameContext + var _ /* sParse at bp+0 */ TParse + var _ /* sWalker at bp+456 */ TWalker + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bQuote, bTemp, db, i, isLegacy, pFKey, pItem, pSelect, pStep, pTab, pTrigger, rc, xAuth, zDb, zInput, zNew, zOld + db = Xsqlite3_context_db_handle(tls, context) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zInput = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + zOld = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + zNew = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + bTemp = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + _ = NotUsed + if zInput != 0 && zOld != 0 && zNew != 0 { + bQuote = int32(1) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + _sqlite3BtreeEnterAll(tls, db) + libc.Xmemset(tls, bp+424, 0, uint64(32)) + (*(*TRenameCtx)(unsafe.Pointer(bp + 424))).FpTab = _sqlite3FindTable(tls, db, zOld, zDb) + libc.Xmemset(tls, bp+456, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FpParse = bp + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxExprCallback = __ccgo_fp(_renameTableExprCb) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxSelectCallback = __ccgo_fp(_renameTableSelectCb) + *(*uintptr)(unsafe.Pointer(bp + 456 + 40)) = bp + 424 + rc = _renameParseSql(tls, bp, zDb, db, zInput, bTemp) + if rc == SQLITE_OK { + isLegacy = int32((*Tsqlite3)(unsafe.Pointer(db)).Fflags & libc.Uint64FromInt32(SQLITE_LegacyAlter)) + if (*(*TParse)(unsafe.Pointer(bp))).FpNewTable != 0 { + pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + if isLegacy == 0 { + pSelect = (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTab)).Fu))).FpSelect + libc.Xmemset(tls, bp+504, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 504))).FpParse = bp + *(*Tu32)(unsafe.Pointer(pSelect + 4)) &= uint32(^libc.Int32FromInt32(SF_View)) + _sqlite3SelectPrep(tls, bp, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTab)).Fu))).FpSelect, bp+504) + if (*(*TParse)(unsafe.Pointer(bp))).FnErr != 0 { + rc = (*(*TParse)(unsafe.Pointer(bp))).Frc + } else { + _sqlite3WalkSelect(tls, bp+456, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTab)).Fu))).FpSelect) + } + } + } else { + /* Modify any FK definitions to point to the new table. */ + if (isLegacy == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } + if Xsqlite3_stricmp(tls, (*TFKey)(unsafe.Pointer(pFKey)).FzTo, zOld) == 0 { + _renameTokenFind(tls, bp, bp+424, (*TFKey)(unsafe.Pointer(pFKey)).FzTo) + } + goto _1 + _1: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + } + } + /* If this is the table being altered, fix any table refs in CHECK + ** expressions. Also update the name that appears right after the + ** "CREATE [VIRTUAL] TABLE" bit. */ + if Xsqlite3_stricmp(tls, zOld, (*TTable)(unsafe.Pointer(pTab)).FzName) == 0 { + (*(*TRenameCtx)(unsafe.Pointer(bp + 424))).FpTab = pTab + if isLegacy == 0 { + _sqlite3WalkExprList(tls, bp+456, (*TTable)(unsafe.Pointer(pTab)).FpCheck) + } + _renameTokenFind(tls, bp, bp+424, (*TTable)(unsafe.Pointer(pTab)).FzName) + } + } + } else { + if (*(*TParse)(unsafe.Pointer(bp))).FpNewIndex != 0 { + _renameTokenFind(tls, bp, bp+424, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewIndex)).FzName) + if isLegacy == 0 { + _sqlite3WalkExpr(tls, bp+456, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewIndex)).FpPartIdxWhere) + } + } else { + pTrigger = (*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger + if 0 == Xsqlite3_stricmp(tls, (*TTrigger)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger)).Ftable, zOld) && (*TTable)(unsafe.Pointer((*(*TRenameCtx)(unsafe.Pointer(bp + 424))).FpTab)).FpSchema == (*TTrigger)(unsafe.Pointer(pTrigger)).FpTabSchema { + _renameTokenFind(tls, bp, bp+424, (*TTrigger)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger)).Ftable) + } + if isLegacy == 0 { + rc = _renameResolveTrigger(tls, bp) + if rc == SQLITE_OK { + _renameWalkTrigger(tls, bp+456, pTrigger) + pStep = (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list + for { + if !(pStep != 0) { + break + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0 && 0 == Xsqlite3_stricmp(tls, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget, zOld) { + _renameTokenFind(tls, bp, bp+424, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom)).FnSrc) { + break + } + pItem = (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom + 8 + uintptr(i)*104 + if 0 == Xsqlite3_stricmp(tls, (*TSrcItem)(unsafe.Pointer(pItem)).FzName, zOld) { + _renameTokenFind(tls, bp, bp+424, (*TSrcItem)(unsafe.Pointer(pItem)).FzName) + } + goto _3 + _3: + ; + i++ + } + } + goto _2 + _2: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + } + } + } + } + } + if rc == SQLITE_OK { + rc = _renameEditSql(tls, context, bp+424, zInput, zNew, bQuote) + } + if rc != SQLITE_OK { + if rc == int32(SQLITE_ERROR) && _sqlite3WritableSchema(tls, db) != 0 { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + } else { + if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { + _renameColumnParseError(tls, context, __ccgo_ts+1680, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp) + } else { + Xsqlite3_result_error_code(tls, context, rc) + } + } + } + _renameParseCleanup(tls, bp) + _renameTokenFree(tls, db, (*(*TRenameCtx)(unsafe.Pointer(bp + 424))).FpList) + _sqlite3BtreeLeaveAll(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + } + return +} + +func _renameQuotefixExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_STRING) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_DblQuoted) != 0 { + _renameTokenFind(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, *(*uintptr)(unsafe.Pointer(pWalker + 40)), pExpr) + } + return WRC_Continue +} + +// C documentation +// +// /* SQL function: sqlite_rename_quotefix(DB,SQL) +// ** +// ** Rewrite the DDL statement "SQL" so that any string literals that use +// ** double-quotes use single quotes instead. +// ** +// ** Two arguments must be passed: +// ** +// ** 0: Database name ("main", "temp" etc.). +// ** 1: SQL statement to edit. +// ** +// ** The returned value is the modified SQL statement. For example, given +// ** the database schema: +// ** +// ** CREATE TABLE t1(a, b, c); +// ** +// ** SELECT sqlite_rename_quotefix('main', +// ** 'CREATE VIEW v1 AS SELECT "a", "string" FROM t1' +// ** ); +// ** +// ** returns the string: +// ** +// ** CREATE VIEW v1 AS SELECT "a", 'string' FROM t1 +// ** +// ** If there is a error in the input SQL, then raise an error, except +// ** if PRAGMA writable_schema=ON, then just return the input string +// ** unmodified following an error. +// */ +func _renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(512) + defer tls.Free(512) + var db, pSelect, zDb, zInput uintptr + var i, rc, v1 int32 + var xAuth Tsqlite3_xauth + var _ /* sCtx at bp+424 */ TRenameCtx + var _ /* sParse at bp+0 */ TParse + var _ /* sWalker at bp+456 */ TWalker + _, _, _, _, _, _, _, _ = db, i, pSelect, rc, xAuth, zDb, zInput, v1 + db = Xsqlite3_context_db_handle(tls, context) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zInput = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + _sqlite3BtreeEnterAll(tls, db) + _ = NotUsed + if zDb != 0 && zInput != 0 { + rc = _renameParseSql(tls, bp, zDb, db, zInput, 0) + if rc == SQLITE_OK { + /* Walker to find tokens that need to be replaced. */ + libc.Xmemset(tls, bp+424, 0, uint64(32)) + libc.Xmemset(tls, bp+456, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FpParse = bp + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxExprCallback = __ccgo_fp(_renameQuotefixExprCb) + (*(*TWalker)(unsafe.Pointer(bp + 456))).FxSelectCallback = __ccgo_fp(_renameColumnSelectCb) + *(*uintptr)(unsafe.Pointer(bp + 456 + 40)) = bp + 424 + if (*(*TParse)(unsafe.Pointer(bp))).FpNewTable != 0 { + if int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FeTabType) == int32(TABTYP_VIEW) { + pSelect = (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).Fu))).FpSelect + *(*Tu32)(unsafe.Pointer(pSelect + 4)) &= uint32(^libc.Int32FromInt32(SF_View)) + (*(*TParse)(unsafe.Pointer(bp))).Frc = SQLITE_OK + _sqlite3SelectPrep(tls, bp, pSelect, uintptr(0)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + v1 = int32(SQLITE_NOMEM) + } else { + v1 = (*(*TParse)(unsafe.Pointer(bp))).Frc + } + rc = v1 + if rc == SQLITE_OK { + _sqlite3WalkSelect(tls, bp+456, pSelect) + } + } else { + _sqlite3WalkExprList(tls, bp+456, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FpCheck) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FnCol)) { + break + } + _sqlite3WalkExpr(tls, bp+456, _sqlite3ColumnExpr(tls, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable, (*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FaCol+uintptr(i)*16)) + goto _2 + _2: + ; + i++ + } + } + } else { + if (*(*TParse)(unsafe.Pointer(bp))).FpNewIndex != 0 { + _sqlite3WalkExprList(tls, bp+456, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewIndex)).FaColExpr) + _sqlite3WalkExpr(tls, bp+456, (*TIndex)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewIndex)).FpPartIdxWhere) + } else { + rc = _renameResolveTrigger(tls, bp) + if rc == SQLITE_OK { + _renameWalkTrigger(tls, bp+456, (*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger) + } + } + } + if rc == SQLITE_OK { + rc = _renameEditSql(tls, context, bp+424, zInput, uintptr(0), 0) + } + _renameTokenFree(tls, db, (*(*TRenameCtx)(unsafe.Pointer(bp + 424))).FpList) + } + if rc != SQLITE_OK { + if _sqlite3WritableSchema(tls, db) != 0 && rc == int32(SQLITE_ERROR) { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } else { + Xsqlite3_result_error_code(tls, context, rc) + } + } + _renameParseCleanup(tls, bp) + } + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + _sqlite3BtreeLeaveAll(tls, db) +} + +// C documentation +// +// /* Function: sqlite_rename_test(DB,SQL,TYPE,NAME,ISTEMP,WHEN,DQS) +// ** +// ** An SQL user function that checks that there are no parse or symbol +// ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. +// ** After an ALTER TABLE .. RENAME operation is performed and the schema +// ** reloaded, this function is called on each SQL statement in the schema +// ** to ensure that it is still usable. +// ** +// ** 0: Database name ("main", "temp" etc.). +// ** 1: SQL statement. +// ** 2: Object type ("view", "table", "trigger" or "index"). +// ** 3: Object name. +// ** 4: True if object is from temp schema. +// ** 5: "when" part of error message. +// ** 6: True to disable the DQS quirk when parsing SQL. +// ** +// ** The return value is computed as follows: +// ** +// ** A. If an error is seen and not in PRAGMA writable_schema=ON mode, +// ** then raise the error. +// ** B. Else if a trigger is created and the the table that the trigger is +// ** attached to is in database zDb, then return 1. +// ** C. Otherwise return NULL. +// */ +func _renameTableTest(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(480) + defer tls.Free(480) + var bNoDQS, bTemp, flags, i1, i2, isLegacy, rc int32 + var db, zDb, zInput, zWhen uintptr + var xAuth Tsqlite3_xauth + var _ /* sNC at bp+424 */ TNameContext + var _ /* sParse at bp+0 */ TParse + _, _, _, _, _, _, _, _, _, _, _, _ = bNoDQS, bTemp, db, flags, i1, i2, isLegacy, rc, xAuth, zDb, zInput, zWhen + db = Xsqlite3_context_db_handle(tls, context) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zInput = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + bTemp = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + isLegacy = int32((*Tsqlite3)(unsafe.Pointer(db)).Fflags & libc.Uint64FromInt32(SQLITE_LegacyAlter)) + zWhen = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + bNoDQS = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + _ = NotUsed + if zDb != 0 && zInput != 0 { + flags = int32((*Tsqlite3)(unsafe.Pointer(db)).Fflags) + if bNoDQS != 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) &= uint64(^(libc.Int32FromInt32(SQLITE_DqsDML) | libc.Int32FromInt32(SQLITE_DqsDDL))) + } + rc = _renameParseSql(tls, bp, zDb, db, zInput, bTemp) + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(flags & (libc.Int32FromInt32(SQLITE_DqsDML) | libc.Int32FromInt32(SQLITE_DqsDDL))) + if rc == SQLITE_OK { + if isLegacy == 0 && (*(*TParse)(unsafe.Pointer(bp))).FpNewTable != 0 && int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FeTabType) == int32(TABTYP_VIEW) { + libc.Xmemset(tls, bp+424, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 424))).FpParse = bp + _sqlite3SelectPrep(tls, bp, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).Fu))).FpSelect, bp+424) + if (*(*TParse)(unsafe.Pointer(bp))).FnErr != 0 { + rc = (*(*TParse)(unsafe.Pointer(bp))).Frc + } + } else { + if (*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger != 0 { + if isLegacy == 0 { + rc = _renameResolveTrigger(tls, bp) + } + if rc == SQLITE_OK { + i1 = _sqlite3SchemaToIndex(tls, db, (*TTrigger)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTrigger)).FpTabSchema) + i2 = _sqlite3FindDbName(tls, db, zDb) + if i1 == i2 { + /* Handle output case B */ + Xsqlite3_result_int(tls, context, int32(1)) + } + } + } + } + } + if rc != SQLITE_OK && zWhen != 0 && !(_sqlite3WritableSchema(tls, db) != 0) { + /* Output case A */ + _renameColumnParseError(tls, context, zWhen, *(*uintptr)(unsafe.Pointer(argv + 2*8)), *(*uintptr)(unsafe.Pointer(argv + 3*8)), bp) + } + _renameParseCleanup(tls, bp) + } + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth +} + +// C documentation +// +// /* +// ** The implementation of internal UDF sqlite_drop_column(). +// ** +// ** Arguments: +// ** +// ** argv[0]: An integer - the index of the schema containing the table +// ** argv[1]: CREATE TABLE statement to modify. +// ** argv[2]: An integer - the index of the column to remove. +// ** +// ** The value returned is a string containing the CREATE TABLE statement +// ** with column argv[2] removed. +// */ +func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(464) + defer tls.Free(464) + var db, pCol, pEnd, pTab, zDb, zEnd, zNew, zSql uintptr + var iCol, iSchema, rc int32 + var xAuth Tsqlite3_xauth + var _ /* sParse at bp+0 */ TParse + _, _, _, _, _, _, _, _, _, _, _, _ = db, iCol, iSchema, pCol, pEnd, pTab, rc, xAuth, zDb, zEnd, zNew, zSql + db = Xsqlite3_context_db_handle(tls, context) + iSchema = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + zSql = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*32))).FzDbSName + zNew = uintptr(0) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + _ = NotUsed + rc = _renameParseSql(tls, bp, zDb, db, zSql, libc.BoolInt32(iSchema == int32(1))) + if rc != SQLITE_OK { + goto drop_column_done + } + pTab = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable + if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + /* This can happen if the sqlite_schema table is corrupt */ + rc = _sqlite3CorruptError(tls, int32(117652)) + goto drop_column_done + } + pCol = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) + if iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1) { + pEnd = _renameTokenFind(tls, bp, uintptr(0), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol+int32(1))*16))).FzCnName) + zEnd = (*TRenameToken)(unsafe.Pointer(pEnd)).Ft.Fz + } else { + zEnd = zSql + uintptr((*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FaddColOffset) + for int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz))) != 0 && int32(*(*int8)(unsafe.Pointer((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz))) != int32(',') { + (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- + } + } + zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11278, libc.VaList(bp+432, int64((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql), zSql, zEnd)) + Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, zNew) +drop_column_done: + ; + _renameParseCleanup(tls, bp) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + if rc != SQLITE_OK { + Xsqlite3_result_error_code(tls, context, rc) + } +} + +// C documentation +// +// /* +// ** This function is called by the parser upon parsing an +// ** +// ** ALTER TABLE pSrc DROP COLUMN pName +// ** +// ** statement. Argument pSrc contains the possibly qualified name of the +// ** table being edited, and token pName the name of the column to drop. +// */ +func _sqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var addr, i, iCol, iColPos, iCur, iDb, iPos, nField, reg, regOut, regRec, v2, v4, v7 int32 + var db, pPk, pTab, v, zCol, zDb, v1, v3, v5, v8 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, db, i, iCol, iColPos, iCur, iDb, iPos, nField, pPk, pTab, reg, regOut, regRec, v, zCol, zDb, v1, v2, v3, v4, v5, v7, v8 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database containing pTab ("main" etc.) */ + zCol = uintptr(0) /* Index of column zCol in pTab->aCol[] */ + /* Look up the table being altered. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_drop_column + } + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pSrc+8) + if !(pTab != 0) { + goto exit_drop_column + } + /* Make sure this is not an attempt to ALTER a view, virtual table or + ** system table. */ + if SQLITE_OK != _isAlterableTable(tls, pParse, pTab) { + goto exit_drop_column + } + if SQLITE_OK != _isRealTable(tls, pParse, pTab, int32(1)) { + goto exit_drop_column + } + /* Find the index of the column being dropped. */ + zCol = _sqlite3NameFromToken(tls, db, pName) + if zCol == uintptr(0) { + goto exit_drop_column + } + iCol = _sqlite3ColumnIndex(tls, pTab, zCol) + if iCol < 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+10900, libc.VaList(bp+8, pName)) + goto exit_drop_column + } + /* Do not allow the user to drop a PRIMARY KEY column or a column + ** constrained by a UNIQUE constraint. */ + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_PRIMKEY)|libc.Int32FromInt32(COLFLAG_UNIQUE)) != 0 { + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { + v1 = __ccgo_ts + 11285 + } else { + v1 = __ccgo_ts + 5621 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11297, libc.VaList(bp+8, v1, zCol)) + goto exit_drop_column + } + /* Do not allow the number of columns to go to zero */ + if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) <= int32(1) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11325, libc.VaList(bp+8, zCol)) + goto exit_drop_column + } + /* Edit the sqlite_schema table */ + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + /* Invoke the authorization callback. */ + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol) != 0 { + goto exit_drop_column + } + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+1680, 0) + _renameFixQuotes(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1))) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11373, libc.VaList(bp+8, zDb, iDb, iCol, (*TTable)(unsafe.Pointer(pTab)).FzName)) + /* Drop and reload the database schema. */ + _renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) + _renameTestSchema(tls, pParse, zDb, libc.BoolInt32(iDb == int32(1)), __ccgo_ts+11494, int32(1)) + /* Edit rows of table on disk */ + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + pPk = uintptr(0) + nField = 0 + v = _sqlite3GetVdbe(tls, pParse) + v3 = pParse + 52 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + iCur = v2 + _sqlite3OpenTable(tls, pParse, iCur, iDb, pTab, int32(OP_OpenWrite)) + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iCur) + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + reg = v4 + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iCur, reg) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pPk)).FnColumn) + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, i, reg+i+int32(1)) + goto _6 + _6: + ; + i++ + } + nField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + } + v8 = pParse + 56 + *(*int32)(unsafe.Pointer(v8))++ + v7 = *(*int32)(unsafe.Pointer(v8)) + regRec = v7 + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if i != iCol && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + if pPk != 0 { + iPos = int32(_sqlite3TableColumnToIndex(tls, pPk, int16(i))) + iColPos = int32(_sqlite3TableColumnToIndex(tls, pPk, int16(iCol))) + if iPos < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) { + goto _9 + } + regOut = reg + int32(1) + iPos - libc.BoolInt32(iPos > iColPos) + } else { + regOut = reg + int32(1) + nField + } + if i == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regOut) + } else { + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, i, regOut) + } + nField++ + } + goto _9 + _9: + ; + i++ + } + if nField == 0 { + /* dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef */ + (*TParse)(unsafe.Pointer(pParse)).FnMem++ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, reg+int32(1)) + nField = int32(1) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg+int32(1), nField, regRec) + if pPk != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iCur, regRec, reg+int32(1), int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iCur, regRec, reg) + } + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iCur, addr+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addr) + } +exit_drop_column: + ; + _sqlite3DbFree(tls, db, zCol) + _sqlite3SrcListDelete(tls, db, pSrc) +} + +// C documentation +// +// /* +// ** Register built-in functions used to help implement ALTER TABLE +// */ +func _sqlite3AlterFunctions(tls *libc.TLS) { + _sqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&_aAlterTableFuncs)), int32(libc.Uint64FromInt64(360)/libc.Uint64FromInt64(72))) +} + +var _aAlterTableFuncs = [5]TFuncDef{ + 0: { + FnArg: int8(9), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FzName: __ccgo_ts + 11512, + }, + 1: { + FnArg: int8(7), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FzName: __ccgo_ts + 11533, + }, + 2: { + FnArg: int8(7), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FzName: __ccgo_ts + 11553, + }, + 3: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FzName: __ccgo_ts + 11572, + }, + 4: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), + FzName: __ccgo_ts + 11591, + }, +} + +func init() { + p := unsafe.Pointer(&_aAlterTableFuncs) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_renameColumnFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_renameTableFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_renameTableTest) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_dropColumnFunc) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_renameQuotefixFunc) +} + +/************** End of alter.c ***********************************************/ +/************** Begin file analyze.c *****************************************/ +/* +** 2005-07-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code associated with the ANALYZE command. +** +** The ANALYZE command gather statistics about the content of tables +** and indices. These statistics are made available to the query planner +** to help it make better decisions about how to perform queries. +** +** The following system tables are or have been supported: +** +** CREATE TABLE sqlite_stat1(tbl, idx, stat); +** CREATE TABLE sqlite_stat2(tbl, idx, sampleno, sample); +** CREATE TABLE sqlite_stat3(tbl, idx, nEq, nLt, nDLt, sample); +** CREATE TABLE sqlite_stat4(tbl, idx, nEq, nLt, nDLt, sample); +** +** Additional tables might be added in future releases of SQLite. +** The sqlite_stat2 table is not created or used unless the SQLite version +** is between 3.6.18 and 3.7.8, inclusive, and unless SQLite is compiled +** with SQLITE_ENABLE_STAT2. The sqlite_stat2 table is deprecated. +** The sqlite_stat2 table is superseded by sqlite_stat3, which is only +** created and used by SQLite versions 3.7.9 through 3.29.0 when +** SQLITE_ENABLE_STAT3 defined. The functionality of sqlite_stat3 +** is a superset of sqlite_stat2 and is also now deprecated. The +** sqlite_stat4 is an enhanced version of sqlite_stat3 and is only +** available when compiled with SQLITE_ENABLE_STAT4 and in SQLite +** versions 3.8.1 and later. STAT4 is the only variant that is still +** supported. +** +** For most applications, sqlite_stat1 provides all the statistics required +** for the query planner to make good choices. +** +** Format of sqlite_stat1: +** +** There is normally one row per index, with the index identified by the +** name in the idx column. The tbl column is the name of the table to +** which the index belongs. In each such row, the stat column will be +** a string consisting of a list of integers. The first integer in this +** list is the number of rows in the index. (This is the same as the +** number of rows in the table, except for partial indices.) The second +** integer is the average number of rows in the index that have the same +** value in the first column of the index. The third integer is the average +** number of rows in the index that have the same value for the first two +** columns. The N-th integer (for N>1) is the average number of rows in +** the index which have the same value for the first N-1 columns. For +** a K-column index, there will be K+1 integers in the stat column. If +** the index is unique, then the last integer will be 1. +** +** The list of integers in the stat column can optionally be followed +** by the keyword "unordered". The "unordered" keyword, if it is present, +** must be separated from the last integer by a single space. If the +** "unordered" keyword is present, then the query planner assumes that +** the index is unordered and will not use the index for a range query. +** +** If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat +** column contains a single integer which is the (estimated) number of +** rows in the table identified by sqlite_stat1.tbl. +** +** Format of sqlite_stat2: +** +** The sqlite_stat2 is only created and is only used if SQLite is compiled +** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between +** 3.6.18 and 3.7.8. The "stat2" table contains additional information +** about the distribution of keys within an index. The index is identified by +** the "idx" column and the "tbl" column is the name of the table to which +** the index belongs. There are usually 10 rows in the sqlite_stat2 +** table for each index. +** +** The sqlite_stat2 entries for an index that have sampleno between 0 and 9 +** inclusive are samples of the left-most key value in the index taken at +** evenly spaced points along the index. Let the number of samples be S +** (10 in the standard build) and let C be the number of rows in the index. +** Then the sampled rows are given by: +** +** rownumber = (i*C*2 + C)/(S*2) +** +** For i between 0 and S-1. Conceptually, the index space is divided into +** S uniform buckets and the samples are the middle row from each bucket. +** +** The format for sqlite_stat2 is recorded here for legacy reference. This +** version of SQLite does not support sqlite_stat2. It neither reads nor +** writes the sqlite_stat2 table. This version of SQLite only supports +** sqlite_stat3. +** +** Format for sqlite_stat3: +** +** The sqlite_stat3 format is a subset of sqlite_stat4. Hence, the +** sqlite_stat4 format will be described first. Further information +** about sqlite_stat3 follows the sqlite_stat4 description. +** +** Format for sqlite_stat4: +** +** As with sqlite_stat2, the sqlite_stat4 table contains histogram data +** to aid the query planner in choosing good indices based on the values +** that indexed columns are compared against in the WHERE clauses of +** queries. +** +** The sqlite_stat4 table contains multiple entries for each index. +** The idx column names the index and the tbl column is the table of the +** index. If the idx and tbl columns are the same, then the sample is +** of the INTEGER PRIMARY KEY. The sample column is a blob which is the +** binary encoding of a key from the index. The nEq column is a +** list of integers. The first integer is the approximate number +** of entries in the index whose left-most column exactly matches +** the left-most column of the sample. The second integer in nEq +** is the approximate number of entries in the index where the +** first two columns match the first two columns of the sample. +** And so forth. nLt is another list of integers that show the approximate +** number of entries that are strictly less than the sample. The first +** integer in nLt contains the number of entries in the index where the +** left-most column is less than the left-most column of the sample. +** The K-th integer in the nLt entry is the number of index entries +** where the first K columns are less than the first K columns of the +** sample. The nDLt column is like nLt except that it contains the +** number of distinct entries in the index that are less than the +** sample. +** +** There can be an arbitrary number of sqlite_stat4 entries per index. +** The ANALYZE command will typically generate sqlite_stat4 tables +** that contain between 10 and 40 samples which are distributed across +** the key space, though not uniformly, and which include samples with +** large nEq values. +** +** Format for sqlite_stat3 redux: +** +** The sqlite_stat3 table is like sqlite_stat4 except that it only +** looks at the left-most column of the index. The sqlite_stat3.sample +** column contains the actual value of the left-most column instead +** of a blob encoding of the complete index key as is found in +** sqlite_stat4.sample. The nEq, nLt, and nDLt entries of sqlite_stat3 +** all contain just a single integer which is the same as the first +** integer in the equivalent columns in sqlite_stat4. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** This routine generates code that opens the sqlite_statN tables. +// ** The sqlite_stat1 table is always relevant. sqlite_stat2 is now +// ** obsolete. sqlite_stat3 and sqlite_stat4 are only opened when +// ** appropriate compile-time options are provided. +// ** +// ** If the sqlite_statN tables do not previously exist, it is created. +// ** +// ** Argument zWhere may be a pointer to a buffer containing a table name, +// ** or it may be a NULL pointer. If it is not NULL, then all entries in +// ** the sqlite_statN tables associated with the named table are deleted. +// ** If zWhere==0, then code is generated to delete all stat table entries. +// */ +func _openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWhere uintptr, zWhereType uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var aCreateTbl [3]Tu8 + var aRoot [3]Tu32 + var db, pDb, pStat, v, zTab, v3 uintptr + var i, nToOpen, v1 int32 + _, _, _, _, _, _, _, _, _, _, _ = aCreateTbl, aRoot, db, i, nToOpen, pDb, pStat, v, zTab, v1, v3 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = _sqlite3GetVdbe(tls, pParse) + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + v1 = int32(2) + } else { + v1 = int32(1) + } + nToOpen = v1 + if v == uintptr(0) { + return + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + /* Create new statistic tables if they do not exist, or clear them + ** if they do already exist. + */ + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(16))) { + break + } + zTab = _aTable[i].FzName + aCreateTbl[i] = uint8(0) + v3 = _sqlite3FindTable(tls, db, zTab, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) + pStat = v3 + if v3 == uintptr(0) { + if i < nToOpen { + /* The sqlite_statN table does not exist. Create it. Note that a + ** side-effect of the CREATE TABLE statement is to leave the rootpage + ** of the new table in register pParse->regRoot. This is important + ** because the OpenWrite opcode below will be needing it. */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11694, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, _aTable[i].FzCols)) + aRoot[i] = uint32((*TParse)(unsafe.Pointer(pParse)).FregRoot) + aCreateTbl[i] = uint8(OPFLAG_P2ISREG) + } + } else { + /* The table already exists. If zWhere is not NULL, delete all entries + ** associated with the table zWhere. If zWhere is NULL, delete the + ** entire contents of the table. */ + aRoot[i] = (*TTable)(unsafe.Pointer(pStat)).Ftnum + _sqlite3TableLock(tls, pParse, iDb, aRoot[i], uint8(1), zTab) + if zWhere != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11717, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11747, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + } else { + /* The sqlite_stat[134] table already exists. Delete all rows. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(aRoot[i]), iDb) + } + } + } + goto _2 + _2: + ; + i++ + } + /* Open the sqlite_stat[134] tables for writing. */ + i = 0 + for { + if !(i < nToOpen) { + break + } + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), iStatCur+i, int32(aRoot[i]), iDb, int32(3)) + _sqlite3VdbeChangeP5(tls, v, uint16(aCreateTbl[i])) + goto _4 + _4: + ; + i++ + } +} + +var _aTable = [3]struct { + FzName uintptr + FzCols uintptr +}{ + 0: { + FzName: __ccgo_ts + 11614, + FzCols: __ccgo_ts + 11627, + }, + 1: { + FzName: __ccgo_ts + 11640, + FzCols: __ccgo_ts + 11653, + }, + 2: { + FzName: __ccgo_ts + 11681, + }, +} + +/* +** Recommended number of samples for sqlite_stat4 + */ + +// C documentation +// +// /* +// ** Three SQL functions - stat_init(), stat_push(), and stat_get() - +// ** share an instance of the following structure to hold their state +// ** information. +// */ +type TStatAccum = struct { + Fdb uintptr + FnEst TtRowcnt + FnRow TtRowcnt + FnLimit int32 + FnCol int32 + FnKeyCol int32 + FnSkipAhead Tu8 + Fcurrent TStatSample + FnPSample TtRowcnt + FmxSample int32 + FiPrn Tu32 + FaBest uintptr + FiMin int32 + FnSample int32 + FnMaxEqZero int32 + FiGet int32 + Fa uintptr +} + +type StatAccum = TStatAccum + +type TStatSample = struct { + FanDLt uintptr + FanEq uintptr + FanLt uintptr + Fu struct { + FaRowid [0]uintptr + FiRowid Ti64 + } + FnRowid Tu32 + FisPSample Tu8 + FiCol int32 + FiHash Tu32 +} + +type StatSample = TStatSample + +type TStatSample1 = struct { + FanDLt uintptr + FanEq uintptr + FanLt uintptr + Fu struct { + FaRowid [0]uintptr + FiRowid Ti64 + } + FnRowid Tu32 + FisPSample Tu8 + FiCol int32 + FiHash Tu32 +} + +type StatSample1 = TStatSample1 + +type TStatAccum1 = struct { + Fdb uintptr + FnEst TtRowcnt + FnRow TtRowcnt + FnLimit int32 + FnCol int32 + FnKeyCol int32 + FnSkipAhead Tu8 + Fcurrent TStatSample + FnPSample TtRowcnt + FmxSample int32 + FiPrn Tu32 + FaBest uintptr + FiMin int32 + FnSample int32 + FnMaxEqZero int32 + FiGet int32 + Fa uintptr +} + +type StatAccum1 = TStatAccum1 + +// C documentation +// +// /* Reclaim memory used by a StatSample +// */ +func _sampleClear(tls *libc.TLS, db uintptr, p uintptr) { + if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) + (*TStatSample)(unsafe.Pointer(p)).FnRowid = uint32(0) + } +} + +// C documentation +// +// /* Initialize the BLOB value of a ROWID +// */ +func _sampleSetRowid(tls *libc.TLS, db uintptr, p uintptr, n int32, pData uintptr) { + if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) + } + *(*uintptr)(unsafe.Pointer(p + 24)) = _sqlite3DbMallocRawNN(tls, db, uint64(n)) + if *(*uintptr)(unsafe.Pointer(p + 24)) != 0 { + (*TStatSample)(unsafe.Pointer(p)).FnRowid = uint32(n) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p + 24)), pData, uint64(n)) + } else { + (*TStatSample)(unsafe.Pointer(p)).FnRowid = uint32(0) + } +} + +// C documentation +// +// /* Initialize the INTEGER value of a ROWID. +// */ +func _sampleSetRowidInt64(tls *libc.TLS, db uintptr, p uintptr, iRowid Ti64) { + if (*TStatSample)(unsafe.Pointer(p)).FnRowid != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24))) + } + (*TStatSample)(unsafe.Pointer(p)).FnRowid = uint32(0) + *(*Ti64)(unsafe.Pointer(p + 24)) = iRowid +} + +// C documentation +// +// /* +// ** Copy the contents of object (*pFrom) into (*pTo). +// */ +func _sampleCopy(tls *libc.TLS, p uintptr, pTo uintptr, pFrom uintptr) { + (*TStatSample)(unsafe.Pointer(pTo)).FisPSample = (*TStatSample)(unsafe.Pointer(pFrom)).FisPSample + (*TStatSample)(unsafe.Pointer(pTo)).FiCol = (*TStatSample)(unsafe.Pointer(pFrom)).FiCol + (*TStatSample)(unsafe.Pointer(pTo)).FiHash = (*TStatSample)(unsafe.Pointer(pFrom)).FiHash + libc.Xmemcpy(tls, (*TStatSample)(unsafe.Pointer(pTo)).FanEq, (*TStatSample)(unsafe.Pointer(pFrom)).FanEq, uint64(8)*uint64((*TStatAccum)(unsafe.Pointer(p)).FnCol)) + libc.Xmemcpy(tls, (*TStatSample)(unsafe.Pointer(pTo)).FanLt, (*TStatSample)(unsafe.Pointer(pFrom)).FanLt, uint64(8)*uint64((*TStatAccum)(unsafe.Pointer(p)).FnCol)) + libc.Xmemcpy(tls, (*TStatSample)(unsafe.Pointer(pTo)).FanDLt, (*TStatSample)(unsafe.Pointer(pFrom)).FanDLt, uint64(8)*uint64((*TStatAccum)(unsafe.Pointer(p)).FnCol)) + if (*TStatSample)(unsafe.Pointer(pFrom)).FnRowid != 0 { + _sampleSetRowid(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, pTo, int32((*TStatSample)(unsafe.Pointer(pFrom)).FnRowid), *(*uintptr)(unsafe.Pointer(pFrom + 24))) + } else { + _sampleSetRowidInt64(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, pTo, *(*Ti64)(unsafe.Pointer(pFrom + 24))) + } +} + +// C documentation +// +// /* +// ** Reclaim all memory of a StatAccum structure. +// */ +func _statAccumDestructor(tls *libc.TLS, pOld uintptr) { + var i int32 + var p uintptr + _, _ = i, p + p = pOld + if (*TStatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) + goto _1 + _1: + ; + i++ + } + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FmxSample) { + break + } + _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) + goto _2 + _2: + ; + i++ + } + _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40) + } + _sqlite3DbFree(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p) +} + +// C documentation +// +// /* +// ** Implementation of the stat_init(N,K,C,L) SQL function. The four parameters +// ** are: +// ** N: The number of columns in the index including the rowid/pk (note 1) +// ** K: The number of columns in the index excluding the rowid/pk. +// ** C: Estimated number of rows in the index +// ** L: A limit on the number of rows to scan, or 0 for no-limit +// ** +// ** Note 1: In the special case of the covering index that implements a +// ** WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the +// ** total number of columns in the table. +// ** +// ** For indexes on ordinary rowid tables, N==K+1. But for indexes on +// ** WITHOUT ROWID tables, N=K+P where P is the number of columns in the +// ** PRIMARY KEY of the table. The covering index that implements the +// ** original WITHOUT ROWID table as N==K as a special case. +// ** +// ** This routine allocates the StatAccum object in heap memory. The return +// ** value is a pointer to the StatAccum object. The datatype of the +// ** return value is BLOB, but it is really just a pointer to the StatAccum +// ** object. +// */ +func _statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var db, p, pSpace uintptr + var i, mxSample, n, nCol, nColUp, nKeyCol, v1, v2 int32 + _, _, _, _, _, _, _, _, _, _, _ = db, i, mxSample, n, nCol, nColUp, nKeyCol, p, pSpace, v1, v2 /* Bytes of space to allocate */ + db = Xsqlite3_context_db_handle(tls, context) + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + v1 = int32(SQLITE_STAT4_SAMPLES) + } else { + v1 = 0 + } /* Database connection */ + /* Maximum number of samples. 0 if STAT4 data is not collected */ + mxSample = v1 + /* Decode the three function arguments */ + _ = argc + nCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + nColUp = nCol + nKeyCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + /* Allocate the space required for the StatAccum object */ + n = int32(uint64(136) + uint64(8)*uint64(nColUp)) /* StatAccum.anDLt */ + n = int32(uint64(n) + libc.Uint64FromInt64(8)*uint64(nColUp)) /* StatAccum.anEq */ + if mxSample != 0 { + n = int32(uint64(n) + (libc.Uint64FromInt64(8)*uint64(nColUp) + libc.Uint64FromInt64(48)*uint64(nCol+mxSample) + libc.Uint64FromInt64(8)*libc.Uint64FromInt32(3)*uint64(nColUp)*uint64(nCol+mxSample))) + } + p = _sqlite3DbMallocZero(tls, db, uint64(n)) + if p == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + (*TStatAccum)(unsafe.Pointer(p)).Fdb = db + (*TStatAccum)(unsafe.Pointer(p)).FnEst = uint64(Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + (*TStatAccum)(unsafe.Pointer(p)).FnRow = uint64(0) + (*TStatAccum)(unsafe.Pointer(p)).FnLimit = int32(Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + (*TStatAccum)(unsafe.Pointer(p)).FnCol = nCol + (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol = nKeyCol + (*TStatAccum)(unsafe.Pointer(p)).FnSkipAhead = uint8(0) + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt = p + 1*136 + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq = (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(nColUp)*8 + if (*TStatAccum)(unsafe.Pointer(p)).FnLimit == 0 { + v2 = mxSample + } else { + v2 = 0 + } + (*TStatAccum)(unsafe.Pointer(p)).FmxSample = v2 + if mxSample != 0 { /* Used to iterate through p->aSample[] */ + (*TStatAccum)(unsafe.Pointer(p)).FiGet = -int32(1) + (*TStatAccum)(unsafe.Pointer(p)).FnPSample = (*TStatAccum)(unsafe.Pointer(p)).FnEst/uint64(mxSample/libc.Int32FromInt32(3)+libc.Int32FromInt32(1)) + libc.Uint64FromInt32(1) + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt = (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(nColUp)*8 + (*TStatAccum)(unsafe.Pointer(p)).FiPrn = uint32(0x689e962d)*uint32(nCol) ^ uint32(0xd0944565)*uint32(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + /* Set up the StatAccum.a[] and aBest[] arrays */ + (*TStatAccum)(unsafe.Pointer(p)).Fa = (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr(nColUp)*8 + (*TStatAccum)(unsafe.Pointer(p)).FaBest = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(mxSample)*48 + pSpace = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(mxSample+nCol)*48 + i = 0 + for { + if !(i < mxSample+nCol) { + break + } + (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FanEq = pSpace + pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) + (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FanLt = pSpace + pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) + (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FanDLt = pSpace + pSpace += uintptr(libc.Uint64FromInt64(8) * uint64(nColUp)) + goto _3 + _3: + ; + i++ + } + i = 0 + for { + if !(i < nCol) { + break + } + (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48))).FiCol = i + goto _4 + _4: + ; + i++ + } + } + /* Return a pointer to the allocated object to the caller. Note that + ** only the pointer (the 2nd parameter) matters. The size of the object + ** (given by the 3rd parameter) is never used and can be any positive + ** value. */ + Xsqlite3_result_blob(tls, context, p, int32(136), __ccgo_fp(_statAccumDestructor)) +} + +var _statInitFuncdef = TFuncDef{ + FnArg: int8(4), + FfuncFlags: uint32(SQLITE_UTF8), + FzName: __ccgo_ts + 11765, +} + +func init() { + p := unsafe.Pointer(&_statInitFuncdef) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_statInit) +} + +// C documentation +// +// /* +// ** pNew and pOld are both candidate non-periodic samples selected for +// ** the same column (pNew->iCol==pOld->iCol). Ignoring this column and +// ** considering only any trailing columns and the sample hash value, this +// ** function returns true if sample pNew is to be preferred over pOld. +// ** In other words, if we assume that the cardinalities of the selected +// ** column for pNew and pOld are equal, is pNew to be preferred over pOld. +// ** +// ** This function assumes that for each argument sample, the contents of +// ** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid. +// */ +func _sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintptr) (r int32) { + var i, nCol int32 + _, _ = i, nCol + nCol = (*TStatAccum)(unsafe.Pointer(pAccum)).FnCol + i = (*TStatSample)(unsafe.Pointer(pNew)).FiCol + int32(1) + for { + if !(i < nCol) { + break + } + if *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pNew)).FanEq + uintptr(i)*8)) > *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pOld)).FanEq + uintptr(i)*8)) { + return int32(1) + } + if *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pNew)).FanEq + uintptr(i)*8)) < *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pOld)).FanEq + uintptr(i)*8)) { + return 0 + } + goto _1 + _1: + ; + i++ + } + if (*TStatSample)(unsafe.Pointer(pNew)).FiHash > (*TStatSample)(unsafe.Pointer(pOld)).FiHash { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if pNew is to be preferred over pOld. +// ** +// ** This function assumes that for each argument sample, the contents of +// ** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid. +// */ +func _sampleIsBetter(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintptr) (r int32) { + var nEqNew, nEqOld TtRowcnt + _, _ = nEqNew, nEqOld + nEqNew = *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pNew)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pNew)).FiCol)*8)) + nEqOld = *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pOld)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pOld)).FiCol)*8)) + if nEqNew > nEqOld { + return int32(1) + } + if nEqNew == nEqOld { + if (*TStatSample)(unsafe.Pointer(pNew)).FiCol < (*TStatSample)(unsafe.Pointer(pOld)).FiCol { + return int32(1) + } + return libc.BoolInt32((*TStatSample)(unsafe.Pointer(pNew)).FiCol == (*TStatSample)(unsafe.Pointer(pOld)).FiCol && _sampleIsBetterPost(tls, pAccum, pNew, pOld) != 0) + } + return 0 +} + +// C documentation +// +// /* +// ** Copy the contents of sample *pNew into the p->a[] array. If necessary, +// ** remove the least desirable sample from p->a[] to make room. +// */ +func _sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { + var anDLt, anEq, anLt, pMin, pOld, pSample, pUpgrade uintptr + var i, iMin int32 + _, _, _, _, _, _, _, _, _ = anDLt, anEq, anLt, i, iMin, pMin, pOld, pSample, pUpgrade + pSample = uintptr(0) + /* StatAccum.nMaxEqZero is set to the maximum number of leading 0 + ** values in the anEq[] array of any sample in StatAccum.a[]. In + ** other words, if nMaxEqZero is n, then it is guaranteed that there + ** are no samples with StatSample.anEq[m]==0 for (m>=n). */ + if nEqZero > (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero { + (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = nEqZero + } + if int32((*TStatSample)(unsafe.Pointer(pNew)).FisPSample) == 0 { + pUpgrade = uintptr(0) + /* This sample is being added because the prefix that ends in column + ** iCol occurs many times in the table. However, if we have already + ** added a sample that shares this prefix, there is no need to add + ** this one. Instead, upgrade the priority of the highest priority + ** existing sample that shares this prefix. */ + i = (*TStatAccum)(unsafe.Pointer(p)).FnSample - int32(1) + for { + if !(i >= 0) { + break + } + pOld = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48 + if *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pOld)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pNew)).FiCol)*8)) == uint64(0) { + if (*TStatSample)(unsafe.Pointer(pOld)).FisPSample != 0 { + return + } + if pUpgrade == uintptr(0) || _sampleIsBetter(tls, p, pOld, pUpgrade) != 0 { + pUpgrade = pOld + } + } + goto _1 + _1: + ; + i-- + } + if pUpgrade != 0 { + (*TStatSample)(unsafe.Pointer(pUpgrade)).FiCol = (*TStatSample)(unsafe.Pointer(pNew)).FiCol + *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pUpgrade)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pUpgrade)).FiCol)*8)) = *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pNew)).FanEq + uintptr((*TStatSample)(unsafe.Pointer(pUpgrade)).FiCol)*8)) + goto find_new_min + } + } + /* If necessary, remove sample iMin to make room for the new sample. */ + if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { + pMin = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiMin)*48 + anEq = (*TStatSample)(unsafe.Pointer(pMin)).FanEq + anLt = (*TStatSample)(unsafe.Pointer(pMin)).FanLt + anDLt = (*TStatSample)(unsafe.Pointer(pMin)).FanDLt + _sampleClear(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, pMin) + libc.Xmemmove(tls, pMin, pMin+1*48, uint64(48)*uint64((*TStatAccum)(unsafe.Pointer(p)).FnSample-(*TStatAccum)(unsafe.Pointer(p)).FiMin-libc.Int32FromInt32(1))) + pSample = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FnSample-int32(1))*48 + (*TStatSample)(unsafe.Pointer(pSample)).FnRowid = uint32(0) + (*TStatSample)(unsafe.Pointer(pSample)).FanEq = anEq + (*TStatSample)(unsafe.Pointer(pSample)).FanDLt = anDLt + (*TStatSample)(unsafe.Pointer(pSample)).FanLt = anLt + (*TStatAccum)(unsafe.Pointer(p)).FnSample = (*TStatAccum)(unsafe.Pointer(p)).FmxSample - int32(1) + } + /* The "rows less-than" for the rowid column must be greater than that + ** for the last sample in the p->a[] array. Otherwise, the samples would + ** be out of order. */ + /* Insert the new sample */ + pSample = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FnSample)*48 + _sampleCopy(tls, p, pSample, pNew) + (*TStatAccum)(unsafe.Pointer(p)).FnSample++ + /* Zero the first nEqZero entries in the anEq[] array. */ + libc.Xmemset(tls, (*TStatSample)(unsafe.Pointer(pSample)).FanEq, 0, uint64(8)*uint64(nEqZero)) +find_new_min: + ; + if (*TStatAccum)(unsafe.Pointer(p)).FnSample >= (*TStatAccum)(unsafe.Pointer(p)).FmxSample { + iMin = -int32(1) + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FmxSample) { + break + } + if (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FisPSample != 0 { + goto _2 + } + if iMin < 0 || _sampleIsBetter(tls, p, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(iMin)*48, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48) != 0 { + iMin = i + } + goto _2 + _2: + ; + i++ + } + (*TStatAccum)(unsafe.Pointer(p)).FiMin = iMin + } +} + +// C documentation +// +// /* +// ** Field iChng of the index being scanned has changed. So at this point +// ** p->current contains a sample that reflects the previous row of the +// ** index. The value of anEq[iChng] and subsequent anEq[] elements are +// ** correct at this point. +// */ +func _samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { + var i, j, j1 int32 + var pBest uintptr + _, _, _, _ = i, j, j1, pBest + /* Check if any samples from the aBest[] array should be pushed + ** into IndexSample.a[] at this point. */ + i = (*TStatAccum)(unsafe.Pointer(p)).FnCol - int32(2) + for { + if !(i >= iChng) { + break + } + pBest = (*TStatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48 + *(*TtRowcnt)(unsafe.Pointer((*TStatSample)(unsafe.Pointer(pBest)).FanEq + uintptr(i)*8)) = *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) + if (*TStatAccum)(unsafe.Pointer(p)).FnSample < (*TStatAccum)(unsafe.Pointer(p)).FmxSample || _sampleIsBetter(tls, p, pBest, (*TStatAccum)(unsafe.Pointer(p)).Fa+uintptr((*TStatAccum)(unsafe.Pointer(p)).FiMin)*48) != 0 { + _sampleInsert(tls, p, pBest, i) + } + goto _1 + _1: + ; + i-- + } + /* Check that no sample contains an anEq[] entry with an index of + ** p->nMaxEqZero or greater set to zero. */ + i = (*TStatAccum)(unsafe.Pointer(p)).FnSample - int32(1) + for { + if !(i >= 0) { + break + } + j = (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero + for { + if !(j < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + goto _3 + _3: + ; + j++ + } + goto _2 + _2: + ; + i-- + } + /* Update the anEq[] fields of any samples already collected. */ + if iChng < (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero { + i = (*TStatAccum)(unsafe.Pointer(p)).FnSample - int32(1) + for { + if !(i >= 0) { + break + } + j1 = iChng + for { + if !(j1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + if *(*TtRowcnt)(unsafe.Pointer((*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FanEq + uintptr(j1)*8)) == uint64(0) { + *(*TtRowcnt)(unsafe.Pointer((*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48))).FanEq + uintptr(j1)*8)) = *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(j1)*8)) + } + goto _5 + _5: + ; + j1++ + } + goto _4 + _4: + ; + i-- + } + (*TStatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng + } +} + +// C documentation +// +// /* +// ** Implementation of the stat_push SQL function: stat_push(P,C,R) +// ** Arguments: +// ** +// ** P Pointer to the StatAccum object created by stat_init() +// ** C Index of left-most column to differ from previous row +// ** R Rowid for the current row. Might be a key record for +// ** WITHOUT ROWID tables. +// ** +// ** The purpose of this routine is to collect statistical data and/or +// ** samples from the index being analyzed into the StatAccum object. +// ** The stat_get() SQL function will be used afterwards to +// ** retrieve the information gathered. +// ** +// ** This SQL function usually returns NULL, but might return an integer +// ** if it wants the byte-code to do special processing. +// ** +// ** The R parameter is only used for STAT4 +// */ +func _statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var i, iChng int32 + var nLt TtRowcnt + var p uintptr + var v4 Tu32 + _, _, _, _, _ = i, iChng, nLt, p, v4 + /* The three function arguments */ + p = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + iChng = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + _ = argc + _ = context + if (*TStatAccum)(unsafe.Pointer(p)).FnRow == uint64(0) { + /* This is the first call to this function. Do initialization. */ + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) + goto _1 + _1: + ; + i++ + } + } else { + /* Second and subsequent calls get processed here */ + if (*TStatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + _samplePushPrevious(tls, p, iChng) + } + /* Update anDLt[], anLt[] and anEq[] to reflect the values that apply + ** to the current row of the index. */ + i = 0 + for { + if !(i < iChng) { + break + } + *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8))++ + goto _2 + _2: + ; + i++ + } + i = iChng + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*8))++ + if (*TStatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr(i)*8)) += *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) + } + *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*8)) = uint64(1) + goto _3 + _3: + ; + i++ + } + } + (*TStatAccum)(unsafe.Pointer(p)).FnRow++ + if (*TStatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) == int32(SQLITE_INTEGER) { + _sampleSetRowidInt64(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + } else { + _sampleSetRowid(tls, (*TStatAccum)(unsafe.Pointer(p)).Fdb, p+40, Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))), Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + } + v4 = (*TStatAccum)(unsafe.Pointer(p)).FiPrn*libc.Uint32FromInt32(1103515245) + libc.Uint32FromInt32(12345) + (*TStatAccum)(unsafe.Pointer(p)).FiPrn = v4 + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FiHash = v4 + nLt = *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr((*TStatAccum)(unsafe.Pointer(p)).FnCol-int32(1))*8)) + /* Check if this is to be a periodic sample. If so, add it. */ + if nLt/(*TStatAccum)(unsafe.Pointer(p)).FnPSample != (nLt+uint64(1))/(*TStatAccum)(unsafe.Pointer(p)).FnPSample { + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FisPSample = uint8(1) + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FiCol = 0 + _sampleInsert(tls, p, p+40, (*TStatAccum)(unsafe.Pointer(p)).FnCol-int32(1)) + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FisPSample = uint8(0) + } + /* Update the aBest[] array. */ + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnCol-int32(1)) { + break + } + (*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FiCol = i + if i >= iChng || _sampleIsBetterPost(tls, p, p+40, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48) != 0 { + _sampleCopy(tls, p, (*TStatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48, p+40) + } + goto _5 + _5: + ; + i++ + } + } else { + if (*TStatAccum)(unsafe.Pointer(p)).FnLimit != 0 && (*TStatAccum)(unsafe.Pointer(p)).FnRow > uint64((*TStatAccum)(unsafe.Pointer(p)).FnLimit)*uint64(int32((*TStatAccum)(unsafe.Pointer(p)).FnSkipAhead)+libc.Int32FromInt32(1)) { + (*TStatAccum)(unsafe.Pointer(p)).FnSkipAhead++ + Xsqlite3_result_int(tls, context, libc.BoolInt32(*(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt)) > uint64(0))) + } + } +} + +var _statPushFuncdef = TFuncDef{ + FnArg: int8(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), + FfuncFlags: uint32(SQLITE_UTF8), + FzName: __ccgo_ts + 11775, +} + +func init() { + p := unsafe.Pointer(&_statPushFuncdef) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_statPush) +} + +// C documentation +// +// /* +// ** Implementation of the stat_get(P,J) SQL function. This routine is +// ** used to query statistical information that has been gathered into +// ** the StatAccum object by prior calls to stat_push(). The P parameter +// ** has type BLOB but it is really just a pointer to the StatAccum object. +// ** The content to returned is determined by the parameter J +// ** which is one of the STAT_GET_xxxx values defined above. +// ** +// ** The stat_get(P,J) function is not available to generic SQL. It is +// ** inserted as part of a manually constructed bytecode program. (See +// ** the callStatGet() routine below.) It is guaranteed that the P +// ** parameter will always be a pointer to a StatAccum object, never a +// ** NULL. +// ** +// ** If STAT4 is not enabled, then J is always +// ** STAT_GET_STAT1 and is hence omitted and this routine becomes +// ** a one-parameter function, stat_get(P), that always returns the +// ** stat1 table entry information. +// */ +func _statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var aCnt, p, pS uintptr + var eCall, i, i1 int32 + var iVal, nDistinct Tu64 + var v1 uint64 + var _ /* sStat at bp+0 */ Tsqlite3_str + var _ /* sStat at bp+32 */ Tsqlite3_str + _, _, _, _, _, _, _, _, _ = aCnt, eCall, i, i1, iVal, nDistinct, p, pS, v1 + p = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* STAT4 has a parameter on this routine. */ + eCall = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if eCall == STAT_GET_STAT1 { + /* Loop counter */ + _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, ((*TStatAccum)(unsafe.Pointer(p)).FnKeyCol+int32(1))*int32(100)) + if (*TStatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { + v1 = (*TStatAccum)(unsafe.Pointer(p)).FnEst + } else { + v1 = (*TStatAccum)(unsafe.Pointer(p)).FnRow + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11785, libc.VaList(bp+72, v1)) + i = 0 + for { + if !(i < (*TStatAccum)(unsafe.Pointer(p)).FnKeyCol) { + break + } + nDistinct = *(*TtRowcnt)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*8)) + uint64(1) + iVal = ((*TStatAccum)(unsafe.Pointer(p)).FnRow + nDistinct - uint64(1)) / nDistinct + if iVal == uint64(2) && (*TStatAccum)(unsafe.Pointer(p)).FnRow*uint64(10) <= nDistinct*uint64(11) { + iVal = uint64(1) + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+11790, libc.VaList(bp+72, iVal)) + goto _2 + _2: + ; + i++ + } + _sqlite3ResultStrAccum(tls, context, bp) + } else { + if eCall == int32(STAT_GET_ROWID) { + if (*TStatAccum)(unsafe.Pointer(p)).FiGet < 0 { + _samplePushPrevious(tls, p, 0) + (*TStatAccum)(unsafe.Pointer(p)).FiGet = 0 + } + if (*TStatAccum)(unsafe.Pointer(p)).FiGet < (*TStatAccum)(unsafe.Pointer(p)).FnSample { + pS = (*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiGet)*48 + if (*TStatSample)(unsafe.Pointer(pS)).FnRowid == uint32(0) { + Xsqlite3_result_int64(tls, context, *(*Ti64)(unsafe.Pointer(pS + 24))) + } else { + Xsqlite3_result_blob(tls, context, *(*uintptr)(unsafe.Pointer(pS + 24)), int32((*TStatSample)(unsafe.Pointer(pS)).FnRowid), uintptr(-libc.Int32FromInt32(1))) + } + } + } else { + aCnt = uintptr(0) + switch eCall { + case int32(STAT_GET_NEQ): + aCnt = (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiGet)*48))).FanEq + case int32(STAT_GET_NLT): + aCnt = (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiGet)*48))).FanLt + default: + aCnt = (*(*TStatSample)(unsafe.Pointer((*TStatAccum)(unsafe.Pointer(p)).Fa + uintptr((*TStatAccum)(unsafe.Pointer(p)).FiGet)*48))).FanDLt + (*TStatAccum)(unsafe.Pointer(p)).FiGet++ + break + } + _sqlite3StrAccumInit(tls, bp+32, uintptr(0), uintptr(0), 0, (*TStatAccum)(unsafe.Pointer(p)).FnCol*int32(100)) + i1 = 0 + for { + if !(i1 < (*TStatAccum)(unsafe.Pointer(p)).FnCol) { + break + } + Xsqlite3_str_appendf(tls, bp+32, __ccgo_ts+11796, libc.VaList(bp+72, *(*TtRowcnt)(unsafe.Pointer(aCnt + uintptr(i1)*8)))) + goto _3 + _3: + ; + i1++ + } + if (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar != 0 { + (*(*Tsqlite3_str)(unsafe.Pointer(bp + 32))).FnChar-- + } + _sqlite3ResultStrAccum(tls, context, bp+32) + } + } + _ = argc +} + +var _statGetFuncdef = TFuncDef{ + FnArg: int8(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), + FfuncFlags: uint32(SQLITE_UTF8), + FzName: __ccgo_ts + 11802, +} + +func init() { + p := unsafe.Pointer(&_statGetFuncdef) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_statGet) +} + +func _callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { + _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Integer), iParam, regStat+int32(1)) + _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat, regOut, libc.Int32FromInt32(1)+libc.Int32FromInt32(IsStat4), uintptr(unsafe.Pointer(&_statGetFuncdef)), 0) +} + +// C documentation +// +// /* +// ** Generate code to do an analysis of all indices associated with +// ** a single table. +// */ +func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr, iStatCur int32, iMem int32, iTab int32) { + var aGotoChng, db, pColl, pIdx, pPk, pStat1, pX, v, zIdxName uintptr + var addrIsNull, addrNext, addrNextRow, addrRewind, doOnce, endDistinctTest, i, iDb, iIdxCur, iTabCur, j, j1, j2, j3, jZeroRows, k, mxCol, nCol, nColTest, nColX, regChng, regCol, regDLt, regEq, regIdxname, regKey, regLt, regNewRowid, regPrev, regRowid, regSample, regSampleRowid, regStat, regStat1, regTabname, regTemp, regTemp2, v1, v10, v11, v12, v14, v18, v2, v3, v4, v5, v6, v7, v8, v9 int32 + var needTableCnt, seekOp Tu8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aGotoChng, addrIsNull, addrNext, addrNextRow, addrRewind, db, doOnce, endDistinctTest, i, iDb, iIdxCur, iTabCur, j, j1, j2, j3, jZeroRows, k, mxCol, nCol, nColTest, nColX, needTableCnt, pColl, pIdx, pPk, pStat1, pX, regChng, regCol, regDLt, regEq, regIdxname, regKey, regLt, regNewRowid, regPrev, regRowid, regSample, regSampleRowid, regStat, regStat1, regTabname, regTemp, regTemp2, seekOp, v, zIdxName, v1, v10, v11, v12, v14, v18, v2, v3, v4, v5, v6, v7, v8, v9 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Loop counter */ + jZeroRows = -int32(1) /* Index of database containing pTab */ + needTableCnt = uint8(1) + v1 = iMem + iMem++ /* True to count the table */ + regNewRowid = v1 + v2 = iMem + iMem++ /* Rowid for the inserted record */ + regStat = v2 + v3 = iMem + iMem++ /* Register to hold StatAccum object */ + regChng = v3 + v4 = iMem + iMem++ /* Index of changed index field */ + regRowid = v4 + v5 = iMem + iMem++ /* Rowid argument passed to stat_push() */ + regTemp = v5 + v6 = iMem + iMem++ /* Temporary use register */ + regTemp2 = v6 + v7 = iMem + iMem++ /* Second temporary use register */ + regTabname = v7 + v8 = iMem + iMem++ /* Register containing table name */ + regIdxname = v8 + v9 = iMem + iMem++ /* Register containing index name */ + regStat1 = v9 /* Value for the stat column of sqlite_stat1 */ + regPrev = iMem /* MUST BE LAST (see below) */ + doOnce = int32(1) /* Flag for a one-time computation */ + pStat1 = uintptr(0) + _sqlite3TouchRegister(tls, pParse, iMem) + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) || pTab == uintptr(0) { + return + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + /* Do not gather statistics on views or virtual tables */ + return + } + if Xsqlite3_strlike(tls, __ccgo_ts+11811, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + /* Do not gather statistics on system tables */ + return + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ANALYZE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) != 0 { + return + } + if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { + pStat1 = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt64(104)+libc.Uint64FromInt32(13)) + if pStat1 == uintptr(0) { + return + } + (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*104 + libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+11614, uint64(13)) + (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) + (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) + _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(6)) + } + /* Establish a read-lock on the table at the shared-cache level. + ** Open a read-only cursor on the table. Also allocate a cursor number + ** to use for scanning indexes (iIdxCur). No index cursor is opened at + ** this time though. */ + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab)).FzName) + v10 = iTab + iTab++ + iTabCur = v10 + v11 = iTab + iTab++ + iIdxCur = v11 + if (*TParse)(unsafe.Pointer(pParse)).FnTab > iTab { + v12 = (*TParse)(unsafe.Pointer(pParse)).FnTab + } else { + v12 = iTab + } + (*TParse)(unsafe.Pointer(pParse)).FnTab = v12 + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab, int32(OP_OpenRead)) + _sqlite3VdbeLoadString(tls, v, regTabname, (*TTable)(unsafe.Pointer(pTab)).FzName) + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } /* Number of columns to test for changes */ + if pOnlyIdx != 0 && pOnlyIdx != pIdx { + goto _13 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { + needTableCnt = uint8(0) + } + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + nCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + zIdxName = (*TTable)(unsafe.Pointer(pTab)).FzName + nColTest = nCol - int32(1) + } else { + nCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + zIdxName = (*TIndex)(unsafe.Pointer(pIdx)).FzName + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + v14 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) - int32(1) + } else { + v14 = nCol - int32(1) + } + nColTest = v14 + } + /* Populate the register containing the index name. */ + _sqlite3VdbeLoadString(tls, v, regIdxname, zIdxName) + /* + ** Pseudo-code for loop that calls stat_push(): + ** + ** Rewind csr + ** if eof(csr) goto end_of_scan; + ** regChng = 0 + ** goto chng_addr_0; + ** + ** next_row: + ** regChng = 0 + ** if( idx(0) != regPrev(0) ) goto chng_addr_0 + ** regChng = 1 + ** if( idx(1) != regPrev(1) ) goto chng_addr_1 + ** ... + ** regChng = N + ** goto chng_addr_N + ** + ** chng_addr_0: + ** regPrev(0) = idx(0) + ** chng_addr_1: + ** regPrev(1) = idx(1) + ** ... + ** + ** endDistinctTest: + ** regRowid = idx(rowid) + ** stat_push(P, regChng, regRowid) + ** Next csr + ** if !eof(csr) goto next_row; + ** + ** end_of_scan: + */ + /* Make sure there are enough memory cells allocated to accommodate + ** the regPrev array and a trailing rowid (the rowid slot is required + ** when building a record to insert into the sample column of + ** the sqlite_stat4 table. */ + _sqlite3TouchRegister(tls, pParse, regPrev+nColTest) + /* Open a read-only cursor on the index being analyzed. */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iIdxCur, int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + /* Invoke the stat_init() function. The arguments are: + ** + ** (1) the number of columns in the index including the rowid + ** (or for a WITHOUT ROWID table, the number of PK columns), + ** (2) the number of columns in the key without the rowid/pk + ** (3) estimated number of rows in the index, + */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nCol, regStat+int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol), regRowid) + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iIdxCur, regTemp) + addrRewind = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iIdxCur) + } else { + addrRewind = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iIdxCur) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Count), iIdxCur, regTemp, int32(1)) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit, regTemp2) + _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat+int32(1), regStat, int32(4), uintptr(unsafe.Pointer(&_statInitFuncdef)), 0) + /* Implementation of the following: + ** + ** Rewind csr + ** if eof(csr) goto end_of_scan; + ** regChng = 0 + ** goto next_push_0; + ** + */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regChng) + addrNextRow = _sqlite3VdbeCurrentAddr(tls, v) + if nColTest > 0 { + endDistinctTest = _sqlite3VdbeMakeLabel(tls, pParse) /* Array of jump instruction addresses */ + aGotoChng = _sqlite3DbMallocRawNN(tls, db, uint64(4)*uint64(nColTest)) + if aGotoChng == uintptr(0) { + goto _13 + } + /* + ** next_row: + ** regChng = 0 + ** if( idx(0) != regPrev(0) ) goto chng_addr_0 + ** regChng = 1 + ** if( idx(1) != regPrev(1) ) goto chng_addr_1 + ** ... + ** regChng = N + ** goto endDistinctTest + */ + _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) + addrNextRow = _sqlite3VdbeCurrentAddr(tls, v) + if nColTest == int32(1) && int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) == int32(1) && int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { + /* For a single-column UNIQUE index, once we have found a non-NULL + ** row, we know that all the rest will be distinct, so skip + ** subsequent distinctness tests. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), regPrev, endDistinctTest) + } + i = 0 + for { + if !(i < nColTest) { + break + } + pColl = _sqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), i, regChng) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regTemp) + *(*int32)(unsafe.Pointer(aGotoChng + uintptr(i)*4)) = _sqlite3VdbeAddOp4(tls, v, int32(OP_Ne), regTemp, 0, regPrev+i, pColl, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + goto _15 + _15: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) + _sqlite3VdbeGoto(tls, v, endDistinctTest) + /* + ** chng_addr_0: + ** regPrev(0) = idx(0) + ** chng_addr_1: + ** regPrev(1) = idx(1) + ** ... + */ + _sqlite3VdbeJumpHere(tls, v, addrNextRow-int32(1)) + i = 0 + for { + if !(i < nColTest) { + break + } + _sqlite3VdbeJumpHere(tls, v, *(*int32)(unsafe.Pointer(aGotoChng + uintptr(i)*4))) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) + goto _16 + _16: + ; + i++ + } + _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) + _sqlite3DbFree(tls, db, aGotoChng) + } + /* + ** chng_addr_N: + ** regRowid = idx(rowid) // STAT4 only + ** stat_push(P, regChng, regRowid) // 3rd parameter STAT4 only + ** Next csr + ** if !eof(csr) goto next_row; + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), iIdxCur, regRowid) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable) + regKey = _sqlite3GetTempRange(tls, pParse, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + j = 0 + for { + if !(j < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + k = int32(_sqlite3TableColumnToIndex(tls, pIdx, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) + goto _17 + _17: + ; + j++ + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) + _sqlite3ReleaseTempRange(tls, pParse, regKey, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + } + } + _sqlite3VdbeAddFunctionCall(tls, pParse, int32(1), regStat, regTemp, libc.Int32FromInt32(2)+libc.Int32FromInt32(IsStat4), uintptr(unsafe.Pointer(&_statPushFuncdef)), 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit != 0 { + j1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regTemp) + j2 = _sqlite3VdbeAddOp1(tls, v, int32(OP_If), regTemp) + j3 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_SeekGT), iIdxCur, 0, regPrev, int32(1)) + _sqlite3VdbeJumpHere(tls, v, j1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iIdxCur, addrNextRow) + _sqlite3VdbeJumpHere(tls, v, j2) + _sqlite3VdbeJumpHere(tls, v, j3) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iIdxCur, addrNextRow) + } + /* Add the entry to the stat1 table. */ + _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11821, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) + _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + /* Add the entries to the stat4 table. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) && (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit == 0 { + regEq = regStat1 + regLt = regStat1 + int32(1) + regDLt = regStat1 + int32(2) + regSample = regStat1 + int32(3) + regCol = regStat1 + int32(4) + regSampleRowid = regCol + nCol + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + v18 = int32(OP_NotExists) + } else { + v18 = int32(OP_NotFound) + } + seekOp = uint8(v18) + if doOnce != 0 { + mxCol = nCol + /* Compute the maximum number of columns in any index */ + pX = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pX != 0) { + break + } /* Number of columns in pX */ + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pX + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + nColX = int32((*TIndex)(unsafe.Pointer(pX)).FnKeyCol) + } else { + nColX = int32((*TIndex)(unsafe.Pointer(pX)).FnColumn) + } + if nColX > mxCol { + mxCol = nColX + } + goto _19 + _19: + ; + pX = (*TIndex)(unsafe.Pointer(pX)).FpNext + } + /* Allocate space to compute results for the largest index */ + _sqlite3TouchRegister(tls, pParse, regCol+mxCol) + doOnce = 0 + _sqlite3ClearTempRegCache(tls, pParse) /* tag-20230325-1 */ + } + addrNext = _sqlite3VdbeCurrentAddr(tls, v) + _callStatGet(tls, pParse, regStat, int32(STAT_GET_ROWID), regSampleRowid) + addrIsNull = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regSampleRowid) + _callStatGet(tls, pParse, regStat, int32(STAT_GET_NEQ), regEq) + _callStatGet(tls, pParse, regStat, int32(STAT_GET_NLT), regLt) + _callStatGet(tls, pParse, regStat, int32(STAT_GET_NDLT), regDLt) + _sqlite3VdbeAddOp4Int(tls, v, int32(seekOp), iTabCur, addrNext, regSampleRowid, 0) + i = 0 + for { + if !(i < nCol) { + break + } + _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) + goto _20 + _20: + ; + i++ + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regTabname, int32(6), regTemp) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur+int32(1), regNewRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur+int32(1), regTemp, regNewRowid) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), int32(1), addrNext) /* P1==1 for end-of-loop */ + _sqlite3VdbeJumpHere(tls, v, addrIsNull) + } + /* End of analysis */ + _sqlite3VdbeJumpHere(tls, v, addrRewind) + goto _13 + _13: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + /* Create a single sqlite_stat1 entry containing NULL as the index + ** name and the row count as the content. + */ + if pOnlyIdx == uintptr(0) && needTableCnt != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) + jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+11821, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) + _sqlite3VdbeJumpHere(tls, v, jZeroRows) + } +} + +// C documentation +// +// /* +// ** Generate code that will cause the most recent index analysis to +// ** be loaded into internal hash tables where is can be used. +// */ +func _loadAnalysis(tls *libc.TLS, pParse uintptr, iDb int32) { + var v uintptr + _ = v + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_LoadAnalysis), iDb) + } +} + +// C documentation +// +// /* +// ** Generate code that will do an analysis of an entire database +// */ +func _analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { + var db, k, pSchema, pTab uintptr + var iMem, iStatCur, iTab int32 + _, _, _, _, _, _, _ = db, iMem, iStatCur, iTab, k, pSchema, pTab + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) + _openStatTable(tls, pParse, iDb, iStatCur, uintptr(0), uintptr(0)) + iMem = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + iTab = (*TParse)(unsafe.Pointer(pParse)).FnTab + k = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst + for { + if !(k != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(k)).Fdata + _analyzeOneTable(tls, pParse, pTab, uintptr(0), iStatCur, iMem, iTab) + iMem = _sqlite3FirstAvailableRegister(tls, pParse, iMem) + goto _1 + _1: + ; + k = (*THashElem)(unsafe.Pointer(k)).Fnext + } + _loadAnalysis(tls, pParse, iDb) +} + +// C documentation +// +// /* +// ** Generate code that will do an analysis of a single table in +// ** a database. If pOnlyIdx is not NULL then it is a single index +// ** in pTab that should be analyzed. +// */ +func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) { + var iDb, iStatCur int32 + _, _ = iDb, iStatCur + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) + if pOnlyIdx != 0 { + _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+11825) + } else { + _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+11829) + } + _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) + _loadAnalysis(tls, pParse, iDb) +} + +// C documentation +// +// /* +// ** Generate code for the ANALYZE command. The parser calls this routine +// ** when it recognizes an ANALYZE command. +// ** +// ** ANALYZE -- 1 +// ** ANALYZE -- 2 +// ** ANALYZE ?.? -- 3 +// ** +// ** Form 1 causes all indices in all attached databases to be analyzed. +// ** Form 2 analyzes all indices the single database named. +// ** Form 3 analyzes all indices associated with the named table. +// */ +func _sqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pIdx, pTab, v, z, zDb, v4, v5, v6, v7 uintptr + var i, iDb, v2 int32 + var v3, v8 bool + var _ /* pTableName at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, iDb, pIdx, pTab, v, z, zDb, v2, v3, v4, v5, v6, v7, v8 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + /* Read the database schema. If an error occurs, leave an error message + ** and code in pParse and return NULL. */ + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + return + } + if pName1 == uintptr(0) { + /* Form 1: Analyze everything */ + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if i == int32(1) { + goto _1 + } /* Do not analyze the TEMP database */ + _analyzeDatabase(tls, pParse, i) + goto _1 + _1: + ; + i++ + } + } else { + if v3 = (*TToken)(unsafe.Pointer(pName2)).Fn == uint32(0); v3 { + v2 = _sqlite3FindDb(tls, db, pName1) + iDb = v2 + } + if v3 && v2 >= 0 { + /* Analyze the schema named as the argument */ + _analyzeDatabase(tls, pParse, iDb) + } else { + /* Form 3: Analyze the table or index named as an argument */ + iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp) + if iDb >= 0 { + if (*TToken)(unsafe.Pointer(pName2)).Fn != 0 { + v4 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + } else { + v4 = uintptr(0) + } + zDb = v4 + z = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + if z != 0 { + v5 = _sqlite3FindIndex(tls, db, z, zDb) + pIdx = v5 + if v5 != uintptr(0) { + _analyzeTable(tls, pParse, (*TIndex)(unsafe.Pointer(pIdx)).FpTable, pIdx) + } else { + v6 = _sqlite3LocateTable(tls, pParse, uint32(0), z, zDb) + pTab = v6 + if v6 != uintptr(0) { + _analyzeTable(tls, pParse, pTab, uintptr(0)) + } + } + _sqlite3DbFree(tls, db, z) + } + } + } + } + if v8 = int32((*Tsqlite3)(unsafe.Pointer(db)).FnSqlExec) == 0; v8 { + v7 = _sqlite3GetVdbe(tls, pParse) + v = v7 + } + if v8 && v7 != uintptr(0) { + _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) + } +} + +// C documentation +// +// /* +// ** Used to pass information from the analyzer reader through to the +// ** callback routine. +// */ +type TanalysisInfo = struct { + Fdb uintptr + FzDatabase uintptr +} + +type analysisInfo = TanalysisInfo + +type TanalysisInfo1 = struct { + Fdb uintptr + FzDatabase uintptr +} + +type analysisInfo1 = TanalysisInfo1 + +// C documentation +// +// /* +// ** The first argument points to a nul-terminated string containing a +// ** list of space separated integers. Read the first nOut of these into +// ** the array aOut[]. +// */ +func _decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, aLog uintptr, pIndex uintptr) { + var c, i, sz, v2 int32 + var v TtRowcnt + var z uintptr + _, _, _, _, _, _ = c, i, sz, v, z, v2 + z = zIntArray + if z == uintptr(0) { + z = __ccgo_ts + 1680 + } + i = 0 + for { + if !(*(*int8)(unsafe.Pointer(z)) != 0 && i < nOut) { + break + } + v = uint64(0) + for { + v2 = int32(*(*int8)(unsafe.Pointer(z))) + c = v2 + if !(v2 >= int32('0') && c <= int32('9')) { + break + } + v = v*uint64(10) + uint64(c) - uint64('0') + z++ + } + if aOut != 0 { + *(*TtRowcnt)(unsafe.Pointer(aOut + uintptr(i)*8)) = v + } + if aLog != 0 { + *(*TLogEst)(unsafe.Pointer(aLog + uintptr(i)*2)) = _sqlite3LogEst(tls, v) + } + if int32(*(*int8)(unsafe.Pointer(z))) == int32(' ') { + z++ + } + goto _1 + _1: + ; + i++ + } + if pIndex != 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 6, 0x40) + for *(*int8)(unsafe.Pointer(z)) != 0 { + if Xsqlite3_strglob(tls, __ccgo_ts+11833, z) == 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 2, 0x4) + } else { + if Xsqlite3_strglob(tls, __ccgo_ts+11844, z) == 0 { + sz = _sqlite3Atoi(tls, z+uintptr(3)) + if sz < int32(2) { + sz = int32(2) + } + (*TIndex)(unsafe.Pointer(pIndex)).FszIdxRow = _sqlite3LogEst(tls, uint64(sz)) + } else { + if Xsqlite3_strglob(tls, __ccgo_ts+11854, z) == 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 6, 0x40) + } + } + } + for int32(*(*int8)(unsafe.Pointer(z))) != 0 && int32(*(*int8)(unsafe.Pointer(z))) != int32(' ') { + z++ + } + for int32(*(*int8)(unsafe.Pointer(z))) == int32(' ') { + z++ + } + } + /* Set the bLowQual flag if the peak number of rows obtained + ** from a full equality match is so large that a full table scan + ** seems likely to be faster than using the index. + */ + if int32(*(*TLogEst)(unsafe.Pointer(aLog))) > int32(66) && int32(*(*TLogEst)(unsafe.Pointer(aLog))) <= int32(*(*TLogEst)(unsafe.Pointer(aLog + uintptr(nOut-int32(1))*2))) { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 8, 0x100) + } + } +} + +// C documentation +// +// /* +// ** This callback is invoked once for each index when reading the +// ** sqlite_stat1 table. +// ** +// ** argv[0] = name of the table +// ** argv[1] = name of the index (might be NULL) +// ** argv[2] = results of analysis - on integer for each column +// ** +// ** Entries for which argv[1]==NULL simply record the number of rows in +// ** the table. +// */ +func _analysisLoader(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, NotUsed uintptr) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var aiRowEst, pIndex, pInfo, pTable, z uintptr + var nCol int32 + var _ /* fakeIdx at bp+0 */ TIndex + _, _, _, _, _, _ = aiRowEst, nCol, pIndex, pInfo, pTable, z + pInfo = pData + _ = NotUsed + _ = argc + if argv == uintptr(0) || *(*uintptr)(unsafe.Pointer(argv)) == uintptr(0) || *(*uintptr)(unsafe.Pointer(argv + 2*8)) == uintptr(0) { + return 0 + } + pTable = _sqlite3FindTable(tls, (*TanalysisInfo)(unsafe.Pointer(pInfo)).Fdb, *(*uintptr)(unsafe.Pointer(argv)), (*TanalysisInfo)(unsafe.Pointer(pInfo)).FzDatabase) + if pTable == uintptr(0) { + return 0 + } + if *(*uintptr)(unsafe.Pointer(argv + 1*8)) == uintptr(0) { + pIndex = uintptr(0) + } else { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*uintptr)(unsafe.Pointer(argv + 1*8))) == 0 { + pIndex = _sqlite3PrimaryKeyIndex(tls, pTable) + } else { + pIndex = _sqlite3FindIndex(tls, (*TanalysisInfo)(unsafe.Pointer(pInfo)).Fdb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*TanalysisInfo)(unsafe.Pointer(pInfo)).FzDatabase) + } + } + z = *(*uintptr)(unsafe.Pointer(argv + 2*8)) + if pIndex != 0 { + aiRowEst = uintptr(0) + nCol = int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol) + int32(1) + /* Index.aiRowEst may already be set here if there are duplicate + ** sqlite_stat1 entries for this index. In that case just clobber + ** the old data with the new instead of allocating a new array. */ + if (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { + (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst = _sqlite3MallocZero(tls, uint64(8)*uint64(nCol)) + if (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { + _sqlite3OomFault(tls, (*TanalysisInfo)(unsafe.Pointer(pInfo)).Fdb) + } + } + aiRowEst = (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 2, 0x4) + _decodeIntArray(tls, z, nCol, aiRowEst, (*TIndex)(unsafe.Pointer(pIndex)).FaiRowLogEst, pIndex) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 7, 0x80) + if (*TIndex)(unsafe.Pointer(pIndex)).FpPartIdxWhere == uintptr(0) { + (*TTable)(unsafe.Pointer(pTable)).FnRowLogEst = *(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiRowLogEst)) + *(*Tu32)(unsafe.Pointer(pTable + 48)) |= uint32(TF_HasStat1) + } + } else { + (*(*TIndex)(unsafe.Pointer(bp))).FszIdxRow = (*TTable)(unsafe.Pointer(pTable)).FszTabRow + _decodeIntArray(tls, z, int32(1), uintptr(0), pTable+58, bp) + (*TTable)(unsafe.Pointer(pTable)).FszTabRow = (*(*TIndex)(unsafe.Pointer(bp))).FszIdxRow + *(*Tu32)(unsafe.Pointer(pTable + 48)) |= uint32(TF_HasStat1) + } + return 0 +} + +// C documentation +// +// /* +// ** If the Index.aSample variable is not NULL, delete the aSample[] array +// ** and its contents. +// */ +func _sqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { + var j int32 + var p uintptr + _, _ = j, p + if (*TIndex)(unsafe.Pointer(pIdx)).FaSample != 0 { + j = 0 + for { + if !(j < (*TIndex)(unsafe.Pointer(pIdx)).FnSample) { + break + } + p = (*TIndex)(unsafe.Pointer(pIdx)).FaSample + uintptr(j)*40 + _sqlite3DbFree(tls, db, (*TIndexSample)(unsafe.Pointer(p)).Fp) + goto _1 + _1: + ; + j++ + } + _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FaSample) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + (*TIndex)(unsafe.Pointer(pIdx)).FnSample = 0 + (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Populate the pIdx->aAvgEq[] array based on the samples currently +// ** stored in pIdx->aSample[]. +// */ +func _initAvgEq(tls *libc.TLS, pIdx uintptr) { + var aSample, pFinal uintptr + var avgEq, nRow, sumEq TtRowcnt + var i, iCol, nCol, nSample int32 + var nDist100, nSum100 Ti64 + _, _, _, _, _, _, _, _, _, _, _ = aSample, avgEq, i, iCol, nCol, nDist100, nRow, nSample, nSum100, pFinal, sumEq + if pIdx != 0 { + aSample = (*TIndex)(unsafe.Pointer(pIdx)).FaSample + pFinal = aSample + uintptr((*TIndex)(unsafe.Pointer(pIdx)).FnSample-int32(1))*40 + nCol = int32(1) + if (*TIndex)(unsafe.Pointer(pIdx)).FnSampleCol > int32(1) { + /* If this is stat4 data, then calculate aAvgEq[] values for all + ** sample columns except the last. The last is always set to 1, as + ** once the trailing PK fields are considered all index keys are + ** unique. */ + nCol = (*TIndex)(unsafe.Pointer(pIdx)).FnSampleCol - int32(1) + *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(nCol)*8)) = uint64(1) + } + iCol = 0 + for { + if !(iCol < nCol) { + break + } + nSample = (*TIndex)(unsafe.Pointer(pIdx)).FnSample /* Used to iterate through samples */ + sumEq = uint64(0) /* Sum of the nEq values */ + avgEq = uint64(0) /* Number of rows in index */ + nSum100 = 0 /* Number of distinct values in index */ + if !((*TIndex)(unsafe.Pointer(pIdx)).FaiRowEst != 0) || iCol >= int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) || *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiRowEst + uintptr(iCol+int32(1))*8)) == uint64(0) { + nRow = *(*TtRowcnt)(unsafe.Pointer((*TIndexSample)(unsafe.Pointer(pFinal)).FanLt + uintptr(iCol)*8)) + nDist100 = int64(uint64(libc.Int64FromInt32(100)) * *(*TtRowcnt)(unsafe.Pointer((*TIndexSample)(unsafe.Pointer(pFinal)).FanDLt + uintptr(iCol)*8))) + nSample-- + } else { + nRow = *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiRowEst)) + nDist100 = int64(uint64(libc.Int64FromInt32(100)) * *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiRowEst)) / *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiRowEst + uintptr(iCol+int32(1))*8))) + } + (*TIndex)(unsafe.Pointer(pIdx)).FnRowEst0 = nRow + /* Set nSum to the number of distinct (iCol+1) field prefixes that + ** occur in the stat4 table for this index. Set sumEq to the sum of + ** the nEq values for column iCol for the same set (adding the value + ** only once where there exist duplicate prefixes). */ + i = 0 + for { + if !(i < nSample) { + break + } + if i == (*TIndex)(unsafe.Pointer(pIdx)).FnSample-int32(1) || *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanDLt + uintptr(iCol)*8)) != *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i+int32(1))*40))).FanDLt + uintptr(iCol)*8)) { + sumEq += *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanEq + uintptr(iCol)*8)) + nSum100 += int64(100) + } + goto _2 + _2: + ; + i++ + } + if nDist100 > nSum100 && sumEq < nRow { + avgEq = uint64(libc.Int64FromInt32(100)) * (nRow - sumEq) / uint64(nDist100-nSum100) + } + if avgEq == uint64(0) { + avgEq = uint64(1) + } + *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*8)) = avgEq + goto _1 + _1: + ; + iCol++ + } + } +} + +// C documentation +// +// /* +// ** Look up an index by name. Or, if the name of a WITHOUT ROWID table +// ** is supplied instead, find the PRIMARY KEY index for that table. +// */ +func _findIndexOrPrimaryKey(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r uintptr) { + var pIdx, pTab uintptr + _, _ = pIdx, pTab + pIdx = _sqlite3FindIndex(tls, db, zName, zDb) + if pIdx == uintptr(0) { + pTab = _sqlite3FindTable(tls, db, zName, zDb) + if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pIdx = _sqlite3PrimaryKeyIndex(tls, pTab) + } + } + return pIdx +} + +// C documentation +// +// /* +// ** Load the content from either the sqlite_stat4 +// ** into the relevant Index.aSample[] arrays. +// ** +// ** Arguments zSql1 and zSql2 must point to SQL statements that return +// ** data equivalent to the following: +// ** +// ** zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx +// ** zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4 +// ** +// ** where %Q is replaced with the database name before the SQL is executed. +// */ +func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, nByte, nCol, nIdxCol, nSample, rc int32 + var pIdx, pIdx1, pPrevIdx, pSample, pSpace, zIndex, zIndex1, zSql uintptr + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, nByte, nCol, nIdxCol, nSample, pIdx, pIdx1, pPrevIdx, pSample, pSpace, rc, zIndex, zIndex1, zSql /* Result codes from subroutines */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Text of the SQL statement */ + pPrevIdx = uintptr(0) /* A slot in pIdx->aSample[] */ + zSql = _sqlite3MPrintf(tls, db, zSql1, libc.VaList(bp+16, zDb)) + if !(zSql != 0) { + return int32(SQLITE_NOMEM) + } + rc = Xsqlite3_prepare(tls, db, zSql, -int32(1), bp, uintptr(0)) + _sqlite3DbFree(tls, db, zSql) + if rc != 0 { + return rc + } + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { + nIdxCol = int32(1) + zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + if zIndex == uintptr(0) { + continue + } + nSample = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + pIdx = _findIndexOrPrimaryKey(tls, db, zIndex, zDb) + if pIdx == uintptr(0) { + continue + } + if (*TIndex)(unsafe.Pointer(pIdx)).FaSample != uintptr(0) { + /* The same index appears in sqlite_stat4 under multiple names */ + continue + } + if !((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + nIdxCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + nIdxCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } + (*TIndex)(unsafe.Pointer(pIdx)).FnSampleCol = nIdxCol + (*TIndex)(unsafe.Pointer(pIdx)).FmxSample = nSample + nByte = int32(uint64(40) * uint64(nSample)) + nByte = int32(uint64(nByte) + libc.Uint64FromInt64(8)*uint64(nIdxCol)*libc.Uint64FromInt32(3)*uint64(nSample)) + nByte = int32(uint64(nByte) + uint64(nIdxCol)*libc.Uint64FromInt64(8)) /* Space for Index.aAvgEq[] */ + (*TIndex)(unsafe.Pointer(pIdx)).FaSample = _sqlite3DbMallocZero(tls, db, uint64(nByte)) + if (*TIndex)(unsafe.Pointer(pIdx)).FaSample == uintptr(0) { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return int32(SQLITE_NOMEM) + } + pSpace = (*TIndex)(unsafe.Pointer(pIdx)).FaSample + uintptr(nSample)*40 + (*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq = pSpace + pSpace += uintptr(nIdxCol) * 8 + *(*Tu32)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable + 48)) |= uint32(TF_HasStat4) + i = 0 + for { + if !(i < nSample) { + break + } + (*(*TIndexSample)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40))).FanEq = pSpace + pSpace += uintptr(nIdxCol) * 8 + (*(*TIndexSample)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40))).FanLt = pSpace + pSpace += uintptr(nIdxCol) * 8 + (*(*TIndexSample)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40))).FanDLt = pSpace + pSpace += uintptr(nIdxCol) * 8 + goto _1 + _1: + ; + i++ + } + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc != 0 { + return rc + } + zSql = _sqlite3MPrintf(tls, db, zSql2, libc.VaList(bp+16, zDb)) + if !(zSql != 0) { + return int32(SQLITE_NOMEM) + } + rc = Xsqlite3_prepare(tls, db, zSql, -int32(1), bp, uintptr(0)) + _sqlite3DbFree(tls, db, zSql) + if rc != 0 { + return rc + } + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { /* Pointer to the index object */ + nCol = int32(1) /* Number of columns in index */ + zIndex1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + if zIndex1 == uintptr(0) { + continue + } + pIdx1 = _findIndexOrPrimaryKey(tls, db, zIndex1, zDb) + if pIdx1 == uintptr(0) { + continue + } + if (*TIndex)(unsafe.Pointer(pIdx1)).FnSample >= (*TIndex)(unsafe.Pointer(pIdx1)).FmxSample { + /* Too many slots used because the same index appears in + ** sqlite_stat4 using multiple names */ + continue + } + /* This next condition is true if data has already been loaded from + ** the sqlite_stat4 table. */ + nCol = (*TIndex)(unsafe.Pointer(pIdx1)).FnSampleCol + if pIdx1 != pPrevIdx { + _initAvgEq(tls, pPrevIdx) + pPrevIdx = pIdx1 + } + pSample = (*TIndex)(unsafe.Pointer(pIdx1)).FaSample + uintptr((*TIndex)(unsafe.Pointer(pIdx1)).FnSample)*40 + _decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)), nCol, (*TIndexSample)(unsafe.Pointer(pSample)).FanEq, uintptr(0), uintptr(0)) + _decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(2)), nCol, (*TIndexSample)(unsafe.Pointer(pSample)).FanLt, uintptr(0), uintptr(0)) + _decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)), nCol, (*TIndexSample)(unsafe.Pointer(pSample)).FanDLt, uintptr(0), uintptr(0)) + /* Take a copy of the sample. Add 8 extra 0x00 bytes the end of the buffer. + ** This is in case the sample record is corrupted. In that case, the + ** sqlite3VdbeRecordCompare() may read up to two varints past the + ** end of the allocated buffer before it realizes it is dealing with + ** a corrupt record. Or it might try to read a large integer from the + ** buffer. In any case, eight 0x00 bytes prevents this from causing + ** a buffer overread. */ + (*TIndexSample)(unsafe.Pointer(pSample)).Fn = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + (*TIndexSample)(unsafe.Pointer(pSample)).Fp = _sqlite3DbMallocZero(tls, db, uint64((*TIndexSample)(unsafe.Pointer(pSample)).Fn+int32(8))) + if (*TIndexSample)(unsafe.Pointer(pSample)).Fp == uintptr(0) { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return int32(SQLITE_NOMEM) + } + if (*TIndexSample)(unsafe.Pointer(pSample)).Fn != 0 { + libc.Xmemcpy(tls, (*TIndexSample)(unsafe.Pointer(pSample)).Fp, Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)), uint64((*TIndexSample)(unsafe.Pointer(pSample)).Fn)) + } + (*TIndex)(unsafe.Pointer(pIdx1)).FnSample++ + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + _initAvgEq(tls, pPrevIdx) + } + return rc +} + +// C documentation +// +// /* +// ** Load content from the sqlite_stat4 table into +// ** the Index.aSample[] arrays of all indices. +// */ +func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { + var pStat4, v1 uintptr + var rc int32 + var v2 bool + _, _, _, _ = pStat4, rc, v1, v2 + rc = SQLITE_OK + if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { + v1 = _sqlite3FindTable(tls, db, __ccgo_ts+11640, zDb) + pStat4 = v1 + } + if v2 && v1 != uintptr(0) && int32((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { + rc = _loadStatTbl(tls, db, __ccgo_ts+11866, __ccgo_ts+11935, zDb) + } + return rc +} + +// C documentation +// +// /* +// ** Load the content of the sqlite_stat1 and sqlite_stat4 tables. The +// ** contents of sqlite_stat1 are used to populate the Index.aiRowEst[] +// ** arrays. The contents of sqlite_stat4 are used to populate the +// ** Index.aSample[] arrays. +// ** +// ** If the sqlite_stat1 table is not present in the database, SQLITE_ERROR +// ** is returned. In this case, even if SQLITE_ENABLE_STAT4 was defined +// ** during compilation and the sqlite_stat4 table is present, no data is +// ** read from it. +// ** +// ** If SQLITE_ENABLE_STAT4 was defined during compilation and the +// ** sqlite_stat4 table is not present in the database, SQLITE_ERROR is +// ** returned. However, in this case, data is read from the sqlite_stat1 +// ** table (if it is present) before returning. +// ** +// ** If an OOM error occurs, this function always sets db->mallocFailed. +// ** This means if the caller does not care about other errors, the return +// ** code may be ignored. +// */ +func _sqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, pIdx, pIdx1, pIdx2, pSchema, pStat1, pTab, zSql, v3 uintptr + var rc, v5 int32 + var _ /* sInfo at bp+0 */ TanalysisInfo + _, _, _, _, _, _, _, _, _, _, _ = i, pIdx, pIdx1, pIdx2, pSchema, pStat1, pTab, rc, zSql, v3, v5 + rc = SQLITE_OK + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + /* Clear any prior statistics */ + i = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst + for { + if !(i != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(i)).Fdata + *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_HasStat1)) + goto _1 + _1: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst + for { + if !(i != 0) { + break + } + pIdx = (*THashElem)(unsafe.Pointer(i)).Fdata + libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(0), 7, 0x80) + _sqlite3DeleteIndexSamples(tls, db, pIdx) + (*TIndex)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) + goto _2 + _2: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + /* Load new statistics out of the sqlite_stat1 table */ + (*(*TanalysisInfo)(unsafe.Pointer(bp))).Fdb = db + (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + v3 = _sqlite3FindTable(tls, db, __ccgo_ts+11614, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + pStat1 = v3 + if v3 != 0 && int32((*TTable)(unsafe.Pointer(pStat1)).FeTabType) == TABTYP_NORM { + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+11987, libc.VaList(bp+24, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase)) + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_analysisLoader), bp, uintptr(0)) + _sqlite3DbFree(tls, db, zSql) + } + } + /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */ + i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst + for { + if !(i != 0) { + break + } + pIdx1 = (*THashElem)(unsafe.Pointer(i)).Fdata + if !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x80>>7)) != 0) { + _sqlite3DefaultRowEst(tls, pIdx1) + } + goto _4 + _4: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + /* Load the statistics from the sqlite_stat4 table. */ + if rc == SQLITE_OK { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + rc = _loadStat4(tls, db, (*(*TanalysisInfo)(unsafe.Pointer(bp))).FzDatabase) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + v5 = 0 + } else { + v5 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v5) + } + i = (*THash)(unsafe.Pointer(pSchema + 32)).Ffirst + for { + if !(i != 0) { + break + } + pIdx2 = (*THashElem)(unsafe.Pointer(i)).Fdata + Xsqlite3_free(tls, (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst) + (*TIndex)(unsafe.Pointer(pIdx2)).FaiRowEst = uintptr(0) + goto _6 + _6: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } + return rc +} + +/************** End of analyze.c *********************************************/ +/************** Begin file attach.c ******************************************/ +/* +** 2003 April 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to implement the ATTACH and DETACH commands. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Resolve an expression that was part of an ATTACH or DETACH statement. This +// ** is slightly different from resolving a normal SQL expression, because simple +// ** identifiers are treated as strings, not possible column names or aliases. +// ** +// ** i.e. if the parser sees: +// ** +// ** ATTACH DATABASE abc AS def +// ** +// ** it treats the two expressions as literal strings 'abc' and 'def' instead of +// ** looking for columns of the same name. +// ** +// ** This only applies to the root node of pExpr, so the statement: +// ** +// ** ATTACH DATABASE abc||def AS 'db2' +// ** +// ** will fail because neither abc or def can be resolved. +// */ +func _resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if pExpr != 0 { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_ID) { + rc = _sqlite3ResolveExprNames(tls, pName, pExpr) + } else { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_STRING) + } + } + return rc +} + +// C documentation +// +// /* +// ** Return true if zName points to a name that may be used to refer to +// ** database iDb attached to handle db. +// */ +func _sqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) (r int32) { + return libc.BoolInt32(_sqlite3StrICmp(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName) == 0 || iDb == 0 && _sqlite3StrICmp(tls, __ccgo_ts+6617, zName) == 0) +} + +// C documentation +// +// /* +// ** An SQL user-function registered to do the work of an ATTACH statement. The +// ** three arguments to the function come directly from an attach statement: +// ** +// ** ATTACH DATABASE x AS y KEY z +// ** +// ** SELECT sqlite_attach(x, y, z) +// ** +// ** If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the +// ** third argument. +// ** +// ** If the db->init.reopenMemdb flags is set, then instead of attaching a +// ** new database, close the database on db->init.iDb and reopen it as an +// ** empty MemDB. +// */ +func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var aNew, db, pNew, pNewSchema, pPager, zFile, zName uintptr + var i, iDb, rc int32 + var _ /* flags at bp+16 */ uint32 + var _ /* pNewBt at bp+40 */ uintptr + var _ /* pVfs at bp+32 */ uintptr + var _ /* zErr at bp+8 */ uintptr + var _ /* zErrDyn at bp+24 */ uintptr + var _ /* zPath at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _ = aNew, db, i, iDb, pNew, pNewSchema, pPager, rc, zFile, zName + rc = 0 + db = Xsqlite3_context_db_handle(tls, context) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* New array of Db pointers */ + pNew = uintptr(0) /* Db object for the newly attached database */ + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + _ = NotUsed + zFile = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zFile == uintptr(0) { + zFile = __ccgo_ts + 1680 + } + if zName == uintptr(0) { + zName = __ccgo_ts + 1680 + } + if int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x4>>2)) != 0 { + /* This is not a real ATTACH. Instead, this routine is being called + ** from sqlite3_deserialize() to close database db->init.iDb and + ** reopen it as a MemDB */ + *(*uintptr)(unsafe.Pointer(bp + 40)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 32)) = Xsqlite3_vfs_find(tls, __ccgo_ts+3999) + if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { + return + } + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), __ccgo_ts+12028, db, bp+40, 0, int32(SQLITE_OPEN_MAIN_DB)) + if rc == SQLITE_OK { + pNewSchema = _sqlite3SchemaGet(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40))) + if pNewSchema != 0 { + /* Both the Btree and the new Schema were allocated successfully. + ** Close the old db and update the aDb[] slot with the new memdb + ** values. */ + pNew = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb)*32 + if (*TDb)(unsafe.Pointer(pNew)).FpBt != 0 { + _sqlite3BtreeClose(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt) + } + (*TDb)(unsafe.Pointer(pNew)).FpBt = *(*uintptr)(unsafe.Pointer(bp + 40)) + (*TDb)(unsafe.Pointer(pNew)).FpSchema = pNewSchema + } else { + _sqlite3BtreeClose(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) + rc = int32(SQLITE_NOMEM) + } + } + if rc != 0 { + goto attach_error + } + } else { + /* This is a real ATTACH + ** + ** Check for the following errors: + ** + ** * Too many attached databases, + ** * Transaction currently open + ** * Specified database name already being used. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FnDb >= *(*int32)(unsafe.Pointer(db + 136 + 7*4))+int32(2) { + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12031, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(db + 136 + 7*4)))) + goto attach_error + } + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if _sqlite3DbIsNamed(tls, db, i, zName) != 0 { + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12068, libc.VaList(bp+56, zName)) + goto attach_error + } + goto _1 + _1: + ; + i++ + } + /* Allocate the new entry in the db->aDb[] array and initialize the schema + ** hash tables. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FaDb == db+696 { + aNew = _sqlite3DbMallocRawNN(tls, db, libc.Uint64FromInt64(32)*libc.Uint64FromInt32(3)) + if aNew == uintptr(0) { + return + } + libc.Xmemcpy(tls, aNew, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, libc.Uint64FromInt64(32)*libc.Uint64FromInt32(2)) + } else { + aNew = _sqlite3DbRealloc(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, uint64(32)*uint64((*Tsqlite3)(unsafe.Pointer(db)).FnDb+libc.Int32FromInt32(1))) + if aNew == uintptr(0) { + return + } + } + (*Tsqlite3)(unsafe.Pointer(db)).FaDb = aNew + pNew = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Tsqlite3)(unsafe.Pointer(db)).FnDb)*32 + libc.Xmemset(tls, pNew, 0, uint64(32)) + /* Open the database file. If the btree is successfully opened, use + ** it to obtain the database schema. At this point the schema may + ** or may not be initialized. + */ + *(*uint32)(unsafe.Pointer(bp + 16)) = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags + rc = _sqlite3ParseUri(tls, (*Tsqlite3_vfs)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpVfs)).FzName, zFile, bp+16, bp+32, bp, bp+8) + if rc != SQLITE_OK { + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + return + } + *(*uint32)(unsafe.Pointer(bp + 16)) |= uint32(SQLITE_OPEN_MAIN_DB) + rc = _sqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp)), db, pNew+8, 0, int32(*(*uint32)(unsafe.Pointer(bp + 16)))) + (*Tsqlite3)(unsafe.Pointer(db)).FnDb++ + (*TDb)(unsafe.Pointer(pNew)).FzDbSName = _sqlite3DbStrDup(tls, db, zName) + } + (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache = uint8(0) + if rc == int32(SQLITE_CONSTRAINT) { + rc = int32(SQLITE_ERROR) + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12098, 0) + } else { + if rc == SQLITE_OK { + (*TDb)(unsafe.Pointer(pNew)).FpSchema = _sqlite3SchemaGet(tls, db, (*TDb)(unsafe.Pointer(pNew)).FpBt) + if !((*TDb)(unsafe.Pointer(pNew)).FpSchema != 0) { + rc = int32(SQLITE_NOMEM) + } else { + if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0 && int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { + *(*uintptr)(unsafe.Pointer(bp + 24)) = _sqlite3MPrintf(tls, db, __ccgo_ts+12127, 0) + rc = int32(SQLITE_ERROR) + } + } + _sqlite3BtreeEnter(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt) + pPager = _sqlite3BtreePager(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt) + _sqlite3PagerLockingMode(tls, pPager, int32((*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode)) + _sqlite3BtreeSecureDelete(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt, _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpBt, -int32(1))) + _sqlite3BtreeSetPagerFlags(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt, uint32(uint64(PAGER_SYNCHRONOUS_FULL)|(*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(PAGER_FLAGS_MASK))) + _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pNew)).FpBt) + } + } + (*TDb)(unsafe.Pointer(pNew)).Fsafety_level = uint8(libc.Int32FromInt32(SQLITE_DEFAULT_SYNCHRONOUS) + libc.Int32FromInt32(1)) + if rc == SQLITE_OK && (*TDb)(unsafe.Pointer(pNew)).FzDbSName == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp))) + /* If the file was opened successfully, read the schema for the new database. + ** If this fails, or if opening the file failed, then close the file and + ** remove the entry from the db->aDb[] array. i.e. put everything back the + ** way we found it. + */ + if rc == SQLITE_OK { + _sqlite3BtreeEnterAll(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_SchemaKnownOk)) + if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x4>>2)) != 0) { + rc = _sqlite3Init(tls, db, bp+24) + } + _sqlite3BtreeLeaveAll(tls, db) + } + if rc != 0 { + if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x4>>2)) != 0) { + iDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt != 0 { + _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt) + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt = uintptr(0) + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema = uintptr(0) + } + _sqlite3ResetAllSchemasOfConnection(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).FnDb = iDb + if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12223, libc.VaList(bp+136, zName)) + goto detach_error + } + if i < int32(2) { + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12244, libc.VaList(bp+136, zName)) + goto detach_error + } + if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE || _sqlite3BtreeIsInBackup(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) != 0 { + Xsqlite3_snprintf(tls, int32(128), bp, __ccgo_ts+12270, libc.VaList(bp+136, zName)) + goto detach_error + } + /* If any TEMP triggers reference the schema being detached, move those + ** triggers to reference the TEMP schema itself. */ + pEntry = (*THash)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 56)).Ffirst + for pEntry != 0 { + pTrig = (*THashElem)(unsafe.Pointer(pEntry)).Fdata + if (*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema == (*TDb)(unsafe.Pointer(pDb)).FpSchema { + (*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema = (*TTrigger)(unsafe.Pointer(pTrig)).FpSchema + } + pEntry = (*THashElem)(unsafe.Pointer(pEntry)).Fnext + } + _sqlite3BtreeClose(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + (*TDb)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + (*TDb)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) + _sqlite3CollapseDatabaseArray(tls, db) + return +detach_error: + ; + Xsqlite3_result_error(tls, context, bp, -int32(1)) +} + +// C documentation +// +// /* +// ** This procedure generates VDBE code for a single invocation of either the +// ** sqlite_detach() or sqlite_attach() SQL user functions. +// */ +func _codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAuthArg uintptr, pFilename uintptr, pDbname uintptr, pKey uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, v, zAuthArg uintptr + var rc, regArgs int32 + var _ /* sName at bp+0 */ TNameContext + _, _, _, _, _ = db, rc, regArgs, v, zAuthArg + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + goto attach_end + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto attach_end + } + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + if SQLITE_OK != _resolveAttachExpr(tls, bp, pFilename) || SQLITE_OK != _resolveAttachExpr(tls, bp, pDbname) || SQLITE_OK != _resolveAttachExpr(tls, bp, pKey) { + goto attach_end + } + if pAuthArg != 0 { + if int32((*TExpr)(unsafe.Pointer(pAuthArg)).Fop) == int32(TK_STRING) { + zAuthArg = *(*uintptr)(unsafe.Pointer(pAuthArg + 8)) + } else { + zAuthArg = uintptr(0) + } + rc = _sqlite3AuthCheck(tls, pParse, type1, zAuthArg, uintptr(0), uintptr(0)) + if rc != SQLITE_OK { + goto attach_end + } + } + v = _sqlite3GetVdbe(tls, pParse) + regArgs = _sqlite3GetTempRange(tls, pParse, int32(4)) + _sqlite3ExprCode(tls, pParse, pFilename, regArgs) + _sqlite3ExprCode(tls, pParse, pDbname, regArgs+int32(1)) + _sqlite3ExprCode(tls, pParse, pKey, regArgs+int32(2)) + if v != 0 { + _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regArgs+int32(3)-int32((*TFuncDef)(unsafe.Pointer(pFunc)).FnArg), regArgs+int32(3), int32((*TFuncDef)(unsafe.Pointer(pFunc)).FnArg), pFunc, 0) + /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this + ** statement only). For DETACH, set it to false (expire all existing + ** statements). + */ + _sqlite3VdbeAddOp1(tls, v, int32(OP_Expire), libc.BoolInt32(type1 == int32(SQLITE_ATTACH))) + } +attach_end: + ; + _sqlite3ExprDelete(tls, db, pFilename) + _sqlite3ExprDelete(tls, db, pDbname) + _sqlite3ExprDelete(tls, db, pKey) +} + +// C documentation +// +// /* +// ** Called by the parser to compile a DETACH statement. +// ** +// ** DETACH pDbname +// */ +func _sqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { + _codeAttach(tls, pParse, int32(SQLITE_DETACH), uintptr(unsafe.Pointer(&_detach_func)), pDbname, uintptr(0), uintptr(0), pDbname) +} + +var _detach_func = TFuncDef{ + FnArg: int8(1), + FfuncFlags: uint32(SQLITE_UTF8), + FzName: __ccgo_ts + 12292, +} + +func init() { + p := unsafe.Pointer(&_detach_func) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_detachFunc) +} + +// C documentation +// +// /* +// ** Called by the parser to compile an ATTACH statement. +// ** +// ** ATTACH p AS pDbname KEY pKey +// */ +func _sqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, pKey uintptr) { + _codeAttach(tls, pParse, int32(SQLITE_ATTACH), uintptr(unsafe.Pointer(&_attach_func)), p, p, pDbname, pKey) +} + +var _attach_func = TFuncDef{ + FnArg: int8(3), + FfuncFlags: uint32(SQLITE_UTF8), + FzName: __ccgo_ts + 12306, +} + +func init() { + p := unsafe.Pointer(&_attach_func) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_attachFunc) +} + +// C documentation +// +// /* +// ** Expression callback used by sqlite3FixAAAA() routines. +// */ +func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pFix uintptr + _ = pFix + pFix = *(*uintptr)(unsafe.Pointer(p + 40)) + if !((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp != 0) { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FromDDL)) + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VARIABLE) { + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) + } else { + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12320, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) + return int32(WRC_Abort) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Select callback used by sqlite3FixAAAA() routines. +// */ +func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pFix, pItem, pList uintptr + var i, iDb int32 + _, _, _, _, _, _ = db, i, iDb, pFix, pItem, pList + pFix = *(*uintptr)(unsafe.Pointer(p + 40)) + db = (*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb + iDb = _sqlite3FindDbName(tls, db, (*TDbFixer)(unsafe.Pointer(pFix)).FzDb) + pList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + if pList == uintptr(0) { + return WRC_Continue + } + i = 0 + pItem = pList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pList)).FnSrc) { + break + } + if int32((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { + if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { + if iDb != _sqlite3FindDbName(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) { + _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+12344, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + return int32(WRC_Abort) + } + _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) + (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase = uintptr(0) + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 9, 0x200) + } + (*TSrcItem)(unsafe.Pointer(pItem)).FpSchema = (*TDbFixer)(unsafe.Pointer(pFix)).FpSchema + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 7, 0x80) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*104 + 60 + 4))&0x400>>10)) == 0 && _sqlite3WalkExpr(tls, pFix+8, *(*uintptr)(unsafe.Pointer(pList + 8 + uintptr(i)*104 + 72))) != 0 { + return int32(WRC_Abort) + } + goto _1 + _1: + ; + i++ + pItem += 104 + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpWith != 0 { + i = 0 + for { + if !(i < (*TWith)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpWith)).FnCte) { + break + } + if _sqlite3WalkSelect(tls, p, (*(*TCte)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpWith + 16 + uintptr(i)*48))).FpSelect) != 0 { + return int32(WRC_Abort) + } + goto _2 + _2: + ; + i++ + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Initialize a DbFixer structure. This routine must be called prior +// ** to passing the structure to one of the sqliteFixAAAA() routines below. +// */ +func _sqlite3FixInit(tls *libc.TLS, pFix uintptr, pParse uintptr, iDb int32, zType uintptr, pName uintptr) { + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + (*TDbFixer)(unsafe.Pointer(pFix)).FpParse = pParse + (*TDbFixer)(unsafe.Pointer(pFix)).FzDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + (*TDbFixer)(unsafe.Pointer(pFix)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + (*TDbFixer)(unsafe.Pointer(pFix)).FzType = zType + (*TDbFixer)(unsafe.Pointer(pFix)).FpName = pName + (*TDbFixer)(unsafe.Pointer(pFix)).FbTemp = libc.BoolUint8(iDb == libc.Int32FromInt32(1)) + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FpParse = pParse + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FxExprCallback = __ccgo_fp(_fixExprCb) + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FxSelectCallback = __ccgo_fp(_fixSelectCb) + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FxSelectCallback2 = __ccgo_fp(_sqlite3WalkWinDefnDummyCallback) + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FwalkerDepth = 0 + (*TDbFixer)(unsafe.Pointer(pFix)).Fw.FeCode = uint16(0) + *(*uintptr)(unsafe.Pointer(pFix + 8 + 40)) = pFix +} + +// C documentation +// +// /* +// ** The following set of routines walk through the parse tree and assign +// ** a specific database to all table references where the database name +// ** was left unspecified in the original SQL statement. The pFix structure +// ** must have been initialized by a prior call to sqlite3FixInit(). +// ** +// ** These routines are used to make sure that an index, trigger, or +// ** view in one database does not refer to objects in a different database. +// ** (Exception: indices, triggers, and views in the TEMP database are +// ** allowed to refer to anything.) If a reference is explicitly made +// ** to an object in a different database, an error message is added to +// ** pParse->zErrMsg and these routines return non-zero. If everything +// ** checks out, these routines return 0. +// */ +func _sqlite3FixSrcList(tls *libc.TLS, pFix uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var res int32 + var _ /* s at bp+0 */ TSelect + _ = res + res = 0 + if pList != 0 { + libc.Xmemset(tls, bp, 0, uint64(128)) + (*(*TSelect)(unsafe.Pointer(bp))).FpSrc = pList + res = _sqlite3WalkSelect(tls, pFix+8, bp) + } + return res +} + +func _sqlite3FixSelect(tls *libc.TLS, pFix uintptr, pSelect uintptr) (r int32) { + return _sqlite3WalkSelect(tls, pFix+8, pSelect) +} + +func _sqlite3FixExpr(tls *libc.TLS, pFix uintptr, pExpr uintptr) (r int32) { + return _sqlite3WalkExpr(tls, pFix+8, pExpr) +} + +func _sqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) (r int32) { + var pUp uintptr + _ = pUp + for pStep != 0 { + if _sqlite3WalkSelect(tls, pFix+8, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect) != 0 || _sqlite3WalkExpr(tls, pFix+8, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere) != 0 || _sqlite3WalkExprList(tls, pFix+8, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList) != 0 || _sqlite3FixSrcList(tls, pFix, (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom) != 0 { + return int32(1) + } + pUp = (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert + for { + if !(pUp != 0) { + break + } + if _sqlite3WalkExprList(tls, pFix+8, (*TUpsert)(unsafe.Pointer(pUp)).FpUpsertTarget) != 0 || _sqlite3WalkExpr(tls, pFix+8, (*TUpsert)(unsafe.Pointer(pUp)).FpUpsertTargetWhere) != 0 || _sqlite3WalkExprList(tls, pFix+8, (*TUpsert)(unsafe.Pointer(pUp)).FpUpsertSet) != 0 || _sqlite3WalkExpr(tls, pFix+8, (*TUpsert)(unsafe.Pointer(pUp)).FpUpsertWhere) != 0 { + return int32(1) + } + goto _1 + _1: + ; + pUp = (*TUpsert)(unsafe.Pointer(pUp)).FpNextUpsert + } + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + return 0 +} + +/************** End of attach.c **********************************************/ +/************** Begin file auth.c ********************************************/ +/* +** 2003 January 11 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to implement the sqlite3_set_authorizer() +** API. This facility is an optional feature of the library. Embedded +** systems that do not need this facility may omit it by recompiling +** the library with -DSQLITE_OMIT_AUTHORIZATION=1 + */ +/* #include "sqliteInt.h" */ + +/* +** All of the code in this file may be omitted by defining a single +** macro. + */ + +// C documentation +// +// /* +// ** Set or clear the access authorization function. +// ** +// ** The access authorization function is be called during the compilation +// ** phase to verify that the user has read and/or write access permission on +// ** various fields of the database. The first argument to the auth function +// ** is a copy of the 3rd argument to this routine. The second argument +// ** to the auth function is one of these constants: +// ** +// ** SQLITE_CREATE_INDEX +// ** SQLITE_CREATE_TABLE +// ** SQLITE_CREATE_TEMP_INDEX +// ** SQLITE_CREATE_TEMP_TABLE +// ** SQLITE_CREATE_TEMP_TRIGGER +// ** SQLITE_CREATE_TEMP_VIEW +// ** SQLITE_CREATE_TRIGGER +// ** SQLITE_CREATE_VIEW +// ** SQLITE_DELETE +// ** SQLITE_DROP_INDEX +// ** SQLITE_DROP_TABLE +// ** SQLITE_DROP_TEMP_INDEX +// ** SQLITE_DROP_TEMP_TABLE +// ** SQLITE_DROP_TEMP_TRIGGER +// ** SQLITE_DROP_TEMP_VIEW +// ** SQLITE_DROP_TRIGGER +// ** SQLITE_DROP_VIEW +// ** SQLITE_INSERT +// ** SQLITE_PRAGMA +// ** SQLITE_READ +// ** SQLITE_SELECT +// ** SQLITE_TRANSACTION +// ** SQLITE_UPDATE +// ** +// ** The third and fourth arguments to the auth function are the name of +// ** the table and the column that are being accessed. The auth function +// ** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If +// ** SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY +// ** means that the SQL statement will never-run - the sqlite3_exec() call +// ** will return with an error. SQLITE_IGNORE means that the SQL statement +// ** should run but attempts to read the specified column will return NULL +// ** and attempts to write the column will be ignored. +// ** +// ** Setting the auth function to NULL disables this hook. The default +// ** setting of the auth function is NULL. +// */ +func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uintptr) (r int32) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg = pArg + if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth != 0 { + _sqlite3ExpirePreparedStatements(tls, db, int32(1)) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Write an error message into pParse->zErrMsg that explains that the +// ** user-supplied authorization function returned an illegal value. +// */ +func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12390, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) +} + +// C documentation +// +// /* +// ** Invoke the authorization callback for permission to read column zCol from +// ** table zTab in database zDb. This function assumes that an authorization +// ** callback has been registered (i.e. that sqlite3.xAuth is not NULL). +// ** +// ** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed +// ** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE +// ** is treated as SQLITE_DENY. In this case an error is left in pParse. +// */ +func _sqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintptr, iDb int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, z, zDb uintptr + var rc int32 + _, _, _, _ = db, rc, z, zDb + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database handle */ + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName /* Auth callback return code */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + return SQLITE_OK + } + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, int32(SQLITE_READ), zTab, zCol, zDb, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) + if rc == int32(SQLITE_DENY) { + z = Xsqlite3_mprintf(tls, __ccgo_ts+12413, libc.VaList(bp+8, zTab, zCol)) + if (*Tsqlite3)(unsafe.Pointer(db)).FnDb > int32(2) || iDb != 0 { + z = Xsqlite3_mprintf(tls, __ccgo_ts+12419, libc.VaList(bp+8, zDb, z)) + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12425, libc.VaList(bp+8, z)) + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) + } else { + if rc != int32(SQLITE_IGNORE) && rc != SQLITE_OK { + _sqliteAuthBadReturnCode(tls, pParse) + } + } + return rc +} + +// C documentation +// +// /* +// ** The pExpr should be a TK_COLUMN expression. The table referred to +// ** is in pTabList or else it is the NEW or OLD table of a trigger. +// ** Check to see if it is OK to read this particular column. +// ** +// ** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN +// ** instruction into a TK_NULL. If the auth function returns SQLITE_DENY, +// ** then generate an error. +// */ +func _sqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uintptr, pTabList uintptr) { + var iCol, iDb, iSrc int32 + var pTab, zCol uintptr + _, _, _, _, _ = iCol, iDb, iSrc, pTab, zCol + pTab = uintptr(0) /* Index of column in table */ + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSchema) + if iDb < 0 { + /* An attempt to read a column out of a subquery or other + ** temporary table. */ + return + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRIGGER) { + pTab = (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab + } else { + iSrc = 0 + for { + if !(iSrc < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(iSrc)*104))).FiCursor { + pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(iSrc)*104))).FpTab + break + } + goto _1 + _1: + ; + iSrc++ + } + } + iCol = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + if pTab == uintptr(0) { + return + } + if iCol >= 0 { + zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName + } else { + zCol = __ccgo_ts + 7937 + } + } + if int32(SQLITE_IGNORE) == _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) + } +} + +// C documentation +// +// /* +// ** Do an authorization check using the code and arguments given. Return +// ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY. If SQLITE_DENY +// ** is returned, then the error count and error message in pParse are +// ** modified appropriately. +// */ +func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr) (r int32) { + var db uintptr + var rc int32 + _, _ = db, rc + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + /* Don't do any authorization checks if the database is initializing + ** or if the parser is being invoked from within sqlite3_declare_vtab. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth == uintptr(0) || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL { + return SQLITE_OK + } + /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the + ** callback are either NULL pointers or zero-terminated strings that + ** contain additional details about the action to be authorized. + ** + ** The following testcase() macros show that any of the 3rd through 6th + ** parameters can be either NULL or a string. */ + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) + if rc == int32(SQLITE_DENY) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12452, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) + } else { + if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { + rc = int32(SQLITE_DENY) + _sqliteAuthBadReturnCode(tls, pParse) + } + } + return rc +} + +// C documentation +// +// /* +// ** Push an authorization context. After this routine is called, the +// ** zArg3 argument to authorization callbacks will be zContext until +// ** popped. Or if pParse==0, this routine is a no-op. +// */ +func _sqlite3AuthContextPush(tls *libc.TLS, pParse uintptr, pContext uintptr, zContext uintptr) { + (*TAuthContext)(unsafe.Pointer(pContext)).FpParse = pParse + (*TAuthContext)(unsafe.Pointer(pContext)).FzAuthContext = (*TParse)(unsafe.Pointer(pParse)).FzAuthContext + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zContext +} + +// C documentation +// +// /* +// ** Pop an authorization context that was previously pushed +// ** by sqlite3AuthContextPush +// */ +func _sqlite3AuthContextPop(tls *libc.TLS, pContext uintptr) { + if (*TAuthContext)(unsafe.Pointer(pContext)).FpParse != 0 { + (*TParse)(unsafe.Pointer((*TAuthContext)(unsafe.Pointer(pContext)).FpParse)).FzAuthContext = (*TAuthContext)(unsafe.Pointer(pContext)).FzAuthContext + (*TAuthContext)(unsafe.Pointer(pContext)).FpParse = uintptr(0) + } +} + +/************** End of auth.c ************************************************/ +/************** Begin file build.c *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C code routines that are called by the SQLite parser +** when syntax rules are reduced. The routines in this file handle the +** following kinds of SQL syntax: +** +** CREATE TABLE +** DROP TABLE +** CREATE INDEX +** DROP INDEX +** creating ID lists +** BEGIN TRANSACTION +** COMMIT +** ROLLBACK + */ +/* #include "sqliteInt.h" */ + +/* +** The TableLock structure is only used by the sqlite3TableLock() and +** codeTableLocks() functions. + */ +type TTableLock1 = struct { + FiDb int32 + FiTab TPgno + FisWriteLock Tu8 + FzLockName uintptr +} + +type TableLock1 = TTableLock1 + +// C documentation +// +// /* +// ** Record the fact that we want to lock a table at run-time. +// ** +// ** The table to be locked has root page iTab and is found in database iDb. +// ** A read or a write lock can be taken depending on isWritelock. +// ** +// ** This routine just records the fact that the lock is desired. The +// ** code to make the lock occur is generated by a later call to +// ** codeTableLocks() which occurs during sqlite3FinishCoding(). +// */ +func _lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLock Tu8, zName uintptr) { + var i, nBytes, v3 int32 + var p, pToplevel, v1, v4 uintptr + _, _, _, _, _, _, _ = i, nBytes, p, pToplevel, v1, v3, v4 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pToplevel = v1 + i = 0 + for { + if !(i < (*TParse)(unsafe.Pointer(pToplevel)).FnTableLock) { + break + } + p = (*TParse)(unsafe.Pointer(pToplevel)).FaTableLock + uintptr(i)*24 + if (*TTableLock)(unsafe.Pointer(p)).FiDb == iDb && (*TTableLock)(unsafe.Pointer(p)).FiTab == iTab { + (*TTableLock)(unsafe.Pointer(p)).FisWriteLock = libc.BoolUint8((*TTableLock)(unsafe.Pointer(p)).FisWriteLock != 0 || isWriteLock != 0) + return + } + goto _2 + _2: + ; + i++ + } + nBytes = int32(uint64(24) * uint64((*TParse)(unsafe.Pointer(pToplevel)).FnTableLock+libc.Int32FromInt32(1))) + (*TParse)(unsafe.Pointer(pToplevel)).FaTableLock = _sqlite3DbReallocOrFree(tls, (*TParse)(unsafe.Pointer(pToplevel)).Fdb, (*TParse)(unsafe.Pointer(pToplevel)).FaTableLock, uint64(nBytes)) + if (*TParse)(unsafe.Pointer(pToplevel)).FaTableLock != 0 { + v4 = pToplevel + 156 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + p = (*TParse)(unsafe.Pointer(pToplevel)).FaTableLock + uintptr(v3)*24 + (*TTableLock)(unsafe.Pointer(p)).FiDb = iDb + (*TTableLock)(unsafe.Pointer(p)).FiTab = iTab + (*TTableLock)(unsafe.Pointer(p)).FisWriteLock = isWriteLock + (*TTableLock)(unsafe.Pointer(p)).FzLockName = zName + } else { + (*TParse)(unsafe.Pointer(pToplevel)).FnTableLock = 0 + _sqlite3OomFault(tls, (*TParse)(unsafe.Pointer(pToplevel)).Fdb) + } +} + +func _sqlite3TableLock(tls *libc.TLS, pParse uintptr, iDb int32, iTab TPgno, isWriteLock Tu8, zName uintptr) { + if iDb == int32(1) { + return + } + if !(_sqlite3BtreeSharable(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FpBt) != 0) { + return + } + _lockTable(tls, pParse, iDb, iTab, isWriteLock, zName) +} + +// C documentation +// +// /* +// ** Code an OP_TableLock instruction for each table locked by the +// ** statement (configured by calls to sqlite3TableLock()). +// */ +func _codeTableLocks(tls *libc.TLS, pParse uintptr) { + var i, p1 int32 + var p, pVdbe uintptr + _, _, _, _ = i, p, p1, pVdbe + pVdbe = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + i = 0 + for { + if !(i < (*TParse)(unsafe.Pointer(pParse)).FnTableLock) { + break + } + p = (*TParse)(unsafe.Pointer(pParse)).FaTableLock + uintptr(i)*24 + p1 = (*TTableLock)(unsafe.Pointer(p)).FiDb + _sqlite3VdbeAddOp4(tls, pVdbe, int32(OP_TableLock), p1, int32((*TTableLock)(unsafe.Pointer(p)).FiTab), int32((*TTableLock)(unsafe.Pointer(p)).FisWriteLock), (*TTableLock)(unsafe.Pointer(p)).FzLockName, -int32(1)) + goto _1 + _1: + ; + i++ + } +} + +/* +** Return TRUE if the given yDbMask object is empty - if it contains no +** 1 bits. This routine is used by the DbMaskAllZero() and DbMaskNotZero() +** macros when SQLITE_MAX_ATTACHED is greater than 30. + */ + +// C documentation +// +// /* +// ** This routine is called after a single SQL statement has been +// ** parsed and a VDBE program to execute that statement has been +// ** prepared. This routine puts the finishing touches on the +// ** VDBE program and resets the pParse structure for the next +// ** parse. +// ** +// ** Note that if an error occurred, it might be the case that +// ** no VDBE code was generated. +// */ +func _sqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { + var addrRewind, i, iDb, reg, v2 int32 + var db, pEL, pRet, pReturning, pSchema, v, vtab uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = addrRewind, db, i, iDb, pEL, pRet, pReturning, pSchema, reg, v, vtab, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).Fnested != 0 { + return + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } + return + } + /* Begin by generating some termination code at the end of the + ** vdbe program + */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if v == uintptr(0) { + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_DONE) + return + } + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) + } + } + if v != 0 { + if (*TParse)(unsafe.Pointer(pParse)).FbReturning != 0 { + pReturning = *(*uintptr)(unsafe.Pointer(pParse + 208)) + if (*TReturning)(unsafe.Pointer(pReturning)).FnRetCol != 0 { + _sqlite3VdbeAddOp0(tls, v, int32(OP_FkCheck)) + addrRewind = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur) + reg = (*TReturning)(unsafe.Pointer(pReturning)).FiRetReg + i = 0 + for { + if !(i < (*TReturning)(unsafe.Pointer(pReturning)).FnRetCol) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, i, reg+i) + goto _1 + _1: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), reg, i) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, addrRewind+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addrRewind) + } + } + _sqlite3VdbeAddOp0(tls, v, int32(OP_Halt)) + /* The cookie mask contains one bit for each database file open. + ** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are + ** set for each database that is used. Generate code to start a + ** transaction on each used database and to verify the schema cookie + ** on each used database. + */ + _sqlite3VdbeJumpHere(tls, v, 0) + iDb = 0 + for { + if libc.BoolInt32((*TParse)(unsafe.Pointer(pParse)).FcookieMask&(libc.Uint32FromInt32(1)<= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { + /* No match against the official names. But always match "main" + ** to schema 0 as a legacy fallback. */ + if _sqlite3StrICmp(tls, zDatabase, __ccgo_ts+6617) == 0 { + i = 0 + } else { + return uintptr(0) + } + } + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6557, int32(7)) == 0 { + if i == int32(1) { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6584+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6603+7) == 0 || _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6098+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6565) + } + } else { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6603+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, __ccgo_ts+6098) + } + } + } + } else { + /* Match against TEMP first */ + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, zName) + if p != 0 { + return p + } + /* The main database is second */ + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, zName) + if p != 0 { + return p + } + /* Attached databases are in order of attachment */ + i = int32(2) + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema+8, zName) + if p != 0 { + break + } + goto _2 + _2: + ; + i++ + } + if p == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6557, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6603+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema+8, __ccgo_ts+6098) + } else { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6584+7) == 0 { + p = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+8, __ccgo_ts+6565) + } + } + } + } + return p +} + +// C documentation +// +// /* +// ** Locate the in-memory structure that describes a particular database +// ** table given the name of that table and (optionally) the name of the +// ** database containing the table. Return NULL if not found. Also leave an +// ** error message in pParse->zErrMsg. +// ** +// ** The difference between this routine and sqlite3FindTable() is that this +// ** routine leaves an error message in pParse->zErrMsg where +// ** sqlite3FindTable() does not. +// */ +func _sqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags Tu32, zName uintptr, zDbase uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, pMod, zMsg, v1 uintptr + _, _, _, _, _ = db, p, pMod, zMsg, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + /* Read the database schema. If an error occurs, leave an error message + ** and code in pParse and return NULL. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_SchemaKnownOk) == uint32(0) && SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + return uintptr(0) + } + p = _sqlite3FindTable(tls, db, zName, zDbase) + if p == uintptr(0) { + /* If zName is the not the name of a table in the schema created using + ** CREATE, then check to see if it is the name of an virtual table that + ** can be an eponymous virtual table. */ + if int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { + pMod = _sqlite3HashFind(tls, db+576, zName) + if pMod == uintptr(0) && Xsqlite3_strnicmp(tls, zName, __ccgo_ts+12467, int32(7)) == 0 { + pMod = _sqlite3PragmaVtabRegister(tls, db, zName) + } + if pMod != 0 && _sqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0 { + return (*TModule)(unsafe.Pointer(pMod)).FpEpoTab + } + } + if flags&uint32(LOCATE_NOERR) != 0 { + return uintptr(0) + } + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + } else { + if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == int32(TABTYP_VTAB) && int32((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_NO_VTAB) != 0 { + p = uintptr(0) + } + } + if p == uintptr(0) { + if flags&uint32(LOCATE_VIEW) != 0 { + v1 = __ccgo_ts + 12475 + } else { + v1 = __ccgo_ts + 12488 + } + zMsg = v1 + if zDbase != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6821, libc.VaList(bp+8, zMsg, zDbase, zName)) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6831, libc.VaList(bp+8, zMsg, zName)) + } + } else { + } + return p +} + +// C documentation +// +// /* +// ** Locate the table identified by *p. +// ** +// ** This is a wrapper around sqlite3LocateTable(). The difference between +// ** sqlite3LocateTable() and this function is that this function restricts +// ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be +// ** non-NULL if it is part of a view or trigger program definition. See +// ** sqlite3FixSrcList() for details. +// */ +func _sqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags Tu32, p uintptr) (r uintptr) { + var iDb int32 + var zDb uintptr + _, _ = iDb, zDb + if (*TSrcItem)(unsafe.Pointer(p)).FpSchema != 0 { + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(p)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName + } else { + zDb = (*TSrcItem)(unsafe.Pointer(p)).FzDatabase + } + return _sqlite3LocateTable(tls, pParse, flags, (*TSrcItem)(unsafe.Pointer(p)).FzName, zDb) +} + +// C documentation +// +// /* +// ** Return the preferred table name for system tables. Translate legacy +// ** names into the new preferred names, as appropriate. +// */ +func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { + if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6557, int32(7)) == 0 { + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6098+7) == 0 { + return __ccgo_ts + 6603 + } + if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6565+7) == 0 { + return __ccgo_ts + 6584 + } + } + return zName +} + +// C documentation +// +// /* +// ** Locate the in-memory structure that describes +// ** a particular index given the name of that index +// ** and the name of the database that contains the index. +// ** Return NULL if not found. +// ** +// ** If zDatabase is 0, all databases are searched for the +// ** table and the first matching index is returned. (No checking +// ** for duplicate index names is done.) The search order is +// ** TEMP first, then MAIN, then any auxiliary databases added +// ** using the ATTACH command. +// */ +func _sqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) (r uintptr) { + var i, j, v2 int32 + var p, pSchema uintptr + _, _, _, _, _ = i, j, p, pSchema, v2 + p = uintptr(0) + /* All mutexes are required for schema access. Make sure we hold them. */ + i = OMIT_TEMPDB + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if i < int32(2) { + v2 = i ^ int32(1) + } else { + v2 = i + } + j = v2 /* Search TEMP before MAIN */ + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32))).FpSchema + if zDb != 0 && _sqlite3DbIsNamed(tls, db, j, zDb) == 0 { + goto _1 + } + p = _sqlite3HashFind(tls, pSchema+32, zName) + if p != 0 { + break + } + goto _1 + _1: + ; + i++ + } + return p +} + +// C documentation +// +// /* +// ** Reclaim the memory used by an index +// */ +func _sqlite3FreeIndex(tls *libc.TLS, db uintptr, p uintptr) { + _sqlite3DeleteIndexSamples(tls, db, p) + _sqlite3ExprDelete(tls, db, (*TIndex)(unsafe.Pointer(p)).FpPartIdxWhere) + _sqlite3ExprListDelete(tls, db, (*TIndex)(unsafe.Pointer(p)).FaColExpr) + _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(p)).FzColAff) + if int32(uint32(*(*uint16)(unsafe.Pointer(p + 100))&0x10>>4)) != 0 { + _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer(p)).FazColl) + } + Xsqlite3_free(tls, (*TIndex)(unsafe.Pointer(p)).FaiRowEst) + _sqlite3DbFree(tls, db, p) +} + +// C documentation +// +// /* +// ** For the index called zIdxName which is found in the database iDb, +// ** unlike that index from its Table then remove the index from +// ** the index hash table and free all memory structures associated +// ** with the index. +// */ +func _sqlite3UnlinkAndDeleteIndex(tls *libc.TLS, db uintptr, iDb int32, zIdxName uintptr) { + var p, pHash, pIndex uintptr + _, _, _ = p, pHash, pIndex + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 32 + pIndex = _sqlite3HashInsert(tls, pHash, zIdxName, uintptr(0)) + if pIndex != 0 { + if (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FpIndex == pIndex { + (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FpIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext + } else { + /* Justification of ALWAYS(); The index must be on the list of + ** indices. */ + p = (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FpIndex + for p != 0 && (*TIndex)(unsafe.Pointer(p)).FpNext != pIndex { + p = (*TIndex)(unsafe.Pointer(p)).FpNext + } + if p != 0 && (*TIndex)(unsafe.Pointer(p)).FpNext == pIndex { + (*TIndex)(unsafe.Pointer(p)).FpNext = (*TIndex)(unsafe.Pointer(pIndex)).FpNext + } + } + _sqlite3FreeIndex(tls, db, pIndex) + } + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) +} + +// C documentation +// +// /* +// ** Look through the list of open database files in db->aDb[] and if +// ** any have been closed, remove them from the list. Reallocate the +// ** db->aDb[] structure to a smaller size, if possible. +// ** +// ** Entry 0 (the "main" database) and entry 1 (the "temp" database) +// ** are never candidates for being collapsed. +// */ +func _sqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { + var i, j, v2 int32 + var pDb uintptr + _, _, _, _ = i, j, pDb, v2 + v2 = libc.Int32FromInt32(2) + j = v2 + i = v2 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32 + if (*TDb1)(unsafe.Pointer(pDb)).FpBt == uintptr(0) { + _sqlite3DbFree(tls, db, (*TDb1)(unsafe.Pointer(pDb)).FzDbSName) + (*TDb1)(unsafe.Pointer(pDb)).FzDbSName = uintptr(0) + goto _1 + } + if j < i { + *(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32)) = *(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)) + } + j++ + goto _1 + _1: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FnDb = j + if (*Tsqlite3)(unsafe.Pointer(db)).FnDb <= int32(2) && (*Tsqlite3)(unsafe.Pointer(db)).FaDb != db+696 { + libc.Xmemcpy(tls, db+696, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, libc.Uint64FromInt32(2)*libc.Uint64FromInt64(32)) + _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb) + (*Tsqlite3)(unsafe.Pointer(db)).FaDb = db + 696 + } +} + +// C documentation +// +// /* +// ** Reset the schema for the database at index iDb. Also reset the +// ** TEMP schema. The reset is deferred if db->nSchemaLock is not zero. +// ** Deferred resets may be run by calling with iDb<0. +// */ +func _sqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { + var i int32 + var p1, p2 uintptr + _, _, _ = i, p1, p2 + if iDb >= 0 { + p1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(DB_ResetWanted)) + p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(DB_ResetWanted)) + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_SchemaKnownOk)) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock == uint32(0) { + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema)).FschemaFlags)&int32(DB_ResetWanted) == int32(DB_ResetWanted) { + _sqlite3SchemaClear(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema) + } + goto _3 + _3: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Erase all schema information from all attached databases (including +// ** "main" and "temp") for a single database connection. +// */ +func _sqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { + var i int32 + var pDb, p2 uintptr + _, _, _ = i, pDb, p2 + _sqlite3BtreeEnterAll(tls, db) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32 + if (*TDb)(unsafe.Pointer(pDb)).FpSchema != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock == uint32(0) { + _sqlite3SchemaClear(tls, (*TDb)(unsafe.Pointer(pDb)).FpSchema) + } else { + p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(DB_ResetWanted)) + } + } + goto _1 + _1: + ; + i++ + } + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^(libc.Int32FromInt32(DBFLAG_SchemaChange) | libc.Int32FromInt32(DBFLAG_SchemaKnownOk))) + _sqlite3VtabUnlockList(tls, db) + _sqlite3BtreeLeaveAll(tls, db) + if (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock == uint32(0) { + _sqlite3CollapseDatabaseArray(tls, db) + } +} + +// C documentation +// +// /* +// ** This routine is called when a commit occurs. +// */ +func _sqlite3CommitInternalChanges(tls *libc.TLS, db uintptr) { + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_SchemaChange)) +} + +// C documentation +// +// /* +// ** Set the expression associated with a column. This is usually +// ** the DEFAULT value, but might also be the expression that computes +// ** the value for a generated column. +// */ +func _sqlite3ColumnSetExpr(tls *libc.TLS, pParse uintptr, pTab uintptr, pCol uintptr, pExpr uintptr) { + var pList uintptr + var v1 int32 + _, _ = pList, v1 + pList = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList + if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) == 0 || pList == uintptr(0) || (*TExprList)(unsafe.Pointer(pList)).FnExpr < int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) { + if pList == uintptr(0) { + v1 = int32(1) + } else { + v1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + int32(1) + } + (*TColumn)(unsafe.Pointer(pCol)).FiDflt = uint16(v1) + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList = _sqlite3ExprListAppend(tls, pParse, pList, pExpr) + } else { + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt)-int32(1))*32))).FpExpr) + (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt)-int32(1))*32))).FpExpr = pExpr + } +} + +// C documentation +// +// /* +// ** Return the expression associated with a column. The expression might be +// ** the DEFAULT clause or the AS clause of a generated column. +// ** Return NULL if the column has no associated expression. +// */ +func _sqlite3ColumnExpr(tls *libc.TLS, pTab uintptr, pCol uintptr) (r uintptr) { + if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) == 0 { + return uintptr(0) + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + return uintptr(0) + } + if (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList == uintptr(0) { + return uintptr(0) + } + if (*TExprList)(unsafe.Pointer((*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList)).FnExpr < int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) { + return uintptr(0) + } + return (*(*TExprList_item)(unsafe.Pointer((*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpDfltList + 8 + uintptr(int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt)-int32(1))*32))).FpExpr +} + +// C documentation +// +// /* +// ** Set the collating sequence name for a column. +// */ +func _sqlite3ColumnSetColl(tls *libc.TLS, db uintptr, pCol uintptr, zColl uintptr) { + var n, nColl Ti64 + var zNew, p1 uintptr + _, _, _, _ = n, nColl, zNew, p1 + n = int64(_sqlite3Strlen30(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(1)) + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { + n += int64(_sqlite3Strlen30(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName+uintptr(n)) + int32(1)) + } + nColl = int64(_sqlite3Strlen30(tls, zColl) + int32(1)) + zNew = _sqlite3DbRealloc(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, uint64(nColl+n)) + if zNew != 0 { + (*TColumn)(unsafe.Pointer(pCol)).FzCnName = zNew + libc.Xmemcpy(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName+uintptr(n), zColl, uint64(nColl)) + p1 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_HASCOLL)) + } +} + +// C documentation +// +// /* +// ** Return the collating sequence name for a column +// */ +func _sqlite3ColumnColl(tls *libc.TLS, pCol uintptr) (r uintptr) { + var z uintptr + _ = z + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASCOLL) == 0 { + return uintptr(0) + } + z = (*TColumn)(unsafe.Pointer(pCol)).FzCnName + for *(*int8)(unsafe.Pointer(z)) != 0 { + z++ + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { + for cond := true; cond; cond = *(*int8)(unsafe.Pointer(z)) != 0 { + z++ + } + } + return z + uintptr(1) +} + +// C documentation +// +// /* +// ** Delete memory allocated for the column names of a table or view (the +// ** Table.aCol[] array). +// */ +func _sqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { + var i int32 + var pCol, v1 uintptr + _, _, _ = i, pCol, v1 + v1 = (*TTable)(unsafe.Pointer(pTable)).FaCol + pCol = v1 + if v1 != uintptr(0) { + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTable)).FnCol)) { + break + } + _sqlite3DbFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + goto _2 + _2: + ; + i++ + pCol += 16 + } + _sqlite3DbNNFreeNN(tls, db, (*TTable)(unsafe.Pointer(pTable)).FaCol) + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { + _sqlite3ExprListDelete(tls, db, (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTable + 64))).FpDfltList) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + (*TTable)(unsafe.Pointer(pTable)).FaCol = uintptr(0) + (*TTable)(unsafe.Pointer(pTable)).FnCol = 0 + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTable + 64))).FpDfltList = uintptr(0) + } + } + } +} + +// C documentation +// +// /* +// ** Remove the memory data structures associated with the given +// ** Table. No changes are made to disk by this routine. +// ** +// ** This routine just deletes the data structure. It does not unlink +// ** the table data structure from the hash table. But it does destroy +// ** memory structures of the indices and foreign keys associated with +// ** the table. +// ** +// ** The db parameter is optional. It is needed if the Table object +// ** contains lookaside memory. (Table objects in the schema do not use +// ** lookaside memory, but some ephemeral Table objects do.) Or the +// ** db parameter can be used with db->pnBytesFreed to measure the memory +// ** used by the Table object. +// */ +func _deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { + var pIndex, pNext, zName uintptr + _, _, _ = pIndex, pNext, zName + /* Delete all indices associated with this table. */ + pIndex = (*TTable)(unsafe.Pointer(pTable)).FpIndex + for { + if !(pIndex != 0) { + break + } + pNext = (*TIndex)(unsafe.Pointer(pIndex)).FpNext + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) && !(int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + zName = (*TIndex)(unsafe.Pointer(pIndex)).FzName + _sqlite3HashInsert(tls, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema+32, zName, uintptr(0)) + } + _sqlite3FreeIndex(tls, db, pIndex) + goto _1 + _1: + ; + pIndex = pNext + } + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == TABTYP_NORM { + _sqlite3FkDelete(tls, db, pTable) + } else { + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3VtabClear(tls, db, pTable) + } else { + _sqlite3SelectDelete(tls, db, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTable)).Fu))).FpSelect) + } + } + /* Delete the Table structure itself. + */ + _sqlite3DeleteColumnNames(tls, db, pTable) + _sqlite3DbFree(tls, db, (*TTable)(unsafe.Pointer(pTable)).FzName) + _sqlite3DbFree(tls, db, (*TTable)(unsafe.Pointer(pTable)).FzColAff) + _sqlite3ExprListDelete(tls, db, (*TTable)(unsafe.Pointer(pTable)).FpCheck) + _sqlite3DbFree(tls, db, pTable) + /* Verify that no lookaside memory was used by schema tables */ +} + +func _sqlite3DeleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { + var v1 Tu32 + var v2 uintptr + var v3 bool + _, _, _ = v1, v2, v3 + /* Do not delete the table until the reference count reaches zero. */ + if !(pTable != 0) { + return + } + if v3 = (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0); v3 { + v2 = pTable + 44 + *(*Tu32)(unsafe.Pointer(v2))-- + v1 = *(*Tu32)(unsafe.Pointer(v2)) + } + if v3 && v1 > uint32(0) { + return + } + _deleteTable(tls, db, pTable) +} + +func _sqlite3DeleteTableGeneric(tls *libc.TLS, db uintptr, pTable uintptr) { + _sqlite3DeleteTable(tls, db, pTable) +} + +// C documentation +// +// /* +// ** Unlink the given table from the hash tables and the delete the +// ** table structure with all its indices and foreign keys. +// */ +func _sqlite3UnlinkAndDeleteTable(tls *libc.TLS, db uintptr, iDb int32, zTabName uintptr) { + var p, pDb uintptr + _, _ = p, pDb + /* Zero-length table names are allowed */ + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + p = _sqlite3HashInsert(tls, (*TDb)(unsafe.Pointer(pDb)).FpSchema+8, zTabName, uintptr(0)) + _sqlite3DeleteTable(tls, db, p) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) +} + +// C documentation +// +// /* +// ** Given a token, return a string that consists of the text of that +// ** token. Space to hold the returned string +// ** is obtained from sqliteMalloc() and must be freed by the calling +// ** function. +// ** +// ** Any quotation marks (ex: "name", 'name', [name], or `name`) that +// ** surround the body of the token are removed. +// ** +// ** Tokens are often just pointers into the original SQL text and so +// ** are not \000 terminated and are not persistent. The returned string +// ** is \000 terminated and is persistent. +// */ +func _sqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) (r uintptr) { + var zName uintptr + _ = zName + if pName != 0 { + zName = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pName)).Fz, uint64((*TToken)(unsafe.Pointer(pName)).Fn)) + _sqlite3Dequote(tls, zName) + } else { + zName = uintptr(0) + } + return zName +} + +// C documentation +// +// /* +// ** Open the sqlite_schema table stored in database number iDb for +// ** writing. The table is opened using cursor 0. +// */ +func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { + var v uintptr + _ = v + v = _sqlite3GetVdbe(tls, p) + _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6098) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) + if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { + (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) + } +} + +// C documentation +// +// /* +// ** Parameter zName points to a nul-terminated buffer containing the name +// ** of a database ("main", "temp" or the name of an attached db). This +// ** function returns the index of the named database in db->aDb[], or +// ** -1 if the named db cannot be found. +// */ +func _sqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { + var i int32 + var pDb uintptr + _, _ = i, pDb + i = -int32(1) /* Database number */ + if zName != 0 { + i = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32 + for { + if !(i >= 0) { + break + } + if 0 == Xsqlite3_stricmp(tls, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, zName) { + break + } + /* "main" is always an acceptable alias for the primary database + ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ + if i == 0 && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+6617, zName) { + break + } + goto _1 + _1: + ; + i-- + pDb -= 32 + } + } + return i +} + +// C documentation +// +// /* +// ** The token *pName contains the name of a database (either "main" or +// ** "temp" or the name of an attached db). This routine returns the +// ** index of the named database in db->aDb[], or -1 if the named db +// ** does not exist. +// */ +func _sqlite3FindDb(tls *libc.TLS, db uintptr, pName uintptr) (r int32) { + var i int32 + var zName uintptr + _, _ = i, zName /* Name we are searching for */ + zName = _sqlite3NameFromToken(tls, db, pName) + i = _sqlite3FindDbName(tls, db, zName) + _sqlite3DbFree(tls, db, zName) + return i +} + +// C documentation +// +// /* The table or view or trigger name is passed to this routine via tokens +// ** pName1 and pName2. If the table name was fully qualified, for example: +// ** +// ** CREATE TABLE xxx.yyy (...); +// ** +// ** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if +// ** the table name is not fully qualified, i.e.: +// ** +// ** CREATE TABLE yyy(...); +// ** +// ** Then pName1 is set to "yyy" and pName2 is "". +// ** +// ** This routine sets the *ppUnqual pointer to point at the token (pName1 or +// ** pName2) that stores the unqualified table name. The index of the +// ** database "xxx" is returned. +// */ +func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pUnqual uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db uintptr + var iDb int32 + _, _ = db, iDb /* Database holding the object */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12502, 0) + return -int32(1) + } + *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 + iDb = _sqlite3FindDb(tls, db, pName1) + if iDb < 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12519, libc.VaList(bp+8, pName1)) + return -int32(1) + } + } else { + iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) + *(*uintptr)(unsafe.Pointer(pUnqual)) = pName1 + } + return iDb +} + +// C documentation +// +// /* +// ** True if PRAGMA writable_schema is ON +// */ +func _sqlite3WritableSchema(tls *libc.TLS, db uintptr) (r int32) { + return libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(libc.Int32FromInt32(SQLITE_WriteSchema)|libc.Int32FromInt32(SQLITE_Defensive)) == uint64(SQLITE_WriteSchema)) +} + +// C documentation +// +// /* +// ** This routine is used to check if the UTF-8 string zName is a legal +// ** unqualified name for a new schema object (table, index, view or +// ** trigger). All names are legal except those that begin with the string +// ** "sqlite_" (in upper, lower or mixed case). This portion of the namespace +// ** is reserved for internal use. +// ** +// ** When parsing the sqlite_schema table, this routine also checks to +// ** make sure the "type", "name", and "tbl_name" columns are consistent +// ** with the SQL. +// */ +func _sqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType uintptr, zTblName uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if _sqlite3WritableSchema(tls, db) != 0 || int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x2>>1)) != 0 || !(_sqlite3Config.FbExtraSchemaChecks != 0) { + /* Skip these error checks for writable_schema=ON */ + return SQLITE_OK + } + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + if Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit))) != 0 || Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit + 1*8))) != 0 || Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit + 2*8))) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1680, 0) /* corruptSchema() will supply the error */ + return int32(SQLITE_ERROR) + } + } else { + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && 0 == Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6557, int32(7)) || _sqlite3ReadOnlyShadowTables(tls, db) != 0 && _sqlite3ShadowTableName(tls, db, zName) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12539, libc.VaList(bp+8, zName)) + return int32(SQLITE_ERROR) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the PRIMARY KEY index of a table +// */ +func _sqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) (r uintptr) { + var p uintptr + _ = p + p = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(p != 0 && !(int32(uint32(*(*uint16)(unsafe.Pointer(p + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY))) { + break + } + goto _1 + _1: + ; + p = (*TIndex)(unsafe.Pointer(p)).FpNext + } + return p +} + +// C documentation +// +// /* +// ** Convert an table column number into a index column number. That is, +// ** for the column iCol in the table (as defined by the CREATE TABLE statement) +// ** find the (first) offset of that column in index pIdx. Or return -1 +// ** if column iCol is not used in index pIdx. +// */ +func _sqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol Ti16) (r Ti16) { + var i int32 + _ = i + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + if int32(iCol) == int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) { + return int16(i) + } + goto _1 + _1: + ; + i++ + } + return int16(-int32(1)) +} + +// C documentation +// +// /* Convert a storage column number into a table column number. +// ** +// ** The storage column number (0,1,2,....) is the index of the value +// ** as it appears in the record on disk. The true column number +// ** is the index (0,1,2,...) of the column in the CREATE TABLE statement. +// ** +// ** The storage column number is less than the table column number if +// ** and only there are VIRTUAL columns to the left. +// ** +// ** If SQLITE_OMIT_GENERATED_COLUMNS, this routine is a no-op macro. +// */ +func _sqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti16) { + var i int32 + _ = i + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasVirtual) != 0 { + i = 0 + for { + if !(i <= int32(iCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + iCol++ + } + goto _1 + _1: + ; + i++ + } + } + return iCol +} + +// C documentation +// +// /* Convert a table column number into a storage column number. +// ** +// ** The storage column number (0,1,2,....) is the index of the value +// ** as it appears in the record on disk. Or, if the input column is +// ** the N-th virtual column (zero-based) then the storage number is +// ** the number of non-virtual columns in the table plus N. +// ** +// ** The true column number is the index (0,1,2,...) of the column in +// ** the CREATE TABLE statement. +// ** +// ** If the input column is a VIRTUAL column, then it should not appear +// ** in storage. But the value sometimes is cached in registers that +// ** follow the range of registers used to construct storage. This +// ** avoids computing the same VIRTUAL column multiple times, and provides +// ** values for use by OP_Param opcodes in triggers. Hence, if the +// ** input column is a VIRTUAL table, put it after all the other columns. +// ** +// ** In the following, N means "normal column", S means STORED, and +// ** V means VIRTUAL. Suppose the CREATE TABLE has columns like this: +// ** +// ** CREATE TABLE ex(N,S,V,N,S,V,N,S,V); +// ** -- 0 1 2 3 4 5 6 7 8 +// ** +// ** Then the mapping from this function is as follows: +// ** +// ** INPUTS: 0 1 2 3 4 5 6 7 8 +// ** OUTPUTS: 0 1 6 2 3 7 4 5 8 +// ** +// ** So, in other words, this routine shifts all the virtual columns to +// ** the end. +// ** +// ** If SQLITE_OMIT_GENERATED_COLUMNS then there are no virtual columns and +// ** this routine is a no-op macro. If the pTab does not have any virtual +// ** columns, then this routine is no-op that always return iCol. If iCol +// ** is negative (indicating the ROWID column) then this routine return iCol. +// */ +func _sqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol Ti16) (r Ti16) { + var i int32 + var n Ti16 + _, _ = i, n + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasVirtual) == uint32(0) || int32(iCol) < 0 { + return iCol + } + i = 0 + n = libc.Int16FromInt32(0) + for { + if !(i < int32(iCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + n++ + } + goto _1 + _1: + ; + i++ + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + /* iCol is a virtual column itself */ + return int16(int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol) + i - int32(n)) + } else { + /* iCol is a normal or stored column */ + return n + } + return r +} + +// C documentation +// +// /* +// ** Insert a single OP_JournalMode query opcode in order to force the +// ** prepared statement to return false for sqlite3_stmt_readonly(). This +// ** is used by CREATE TABLE IF NOT EXISTS and similar if the table already +// ** exists, so that the prepared statement for CREATE TABLE IF NOT EXISTS +// ** will return false for sqlite3_stmt_readonly() even if that statement +// ** is a read-only no-op. +// */ +func _sqlite3ForceNotReadOnly(tls *libc.TLS, pParse uintptr) { + var iReg, v1 int32 + var v, v2 uintptr + _, _, _, _ = iReg, v, v1, v2 + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + iReg = v1 + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_JournalMode), 0, iReg, -int32(1)) + _sqlite3VdbeUsesBtree(tls, v, 0) + } +} + +// C documentation +// +// /* +// ** Begin constructing a new table representation in memory. This is +// ** the first of several action routines that get called in response +// ** to a CREATE TABLE statement. In particular, this routine is called +// ** after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp +// ** flag is true if the table should be stored in the auxiliary database +// ** file instead of in the main database file. This is normally the case +// ** when the "TEMP" or "TEMPORARY" keyword occurs in between +// ** CREATE and TABLE. +// ** +// ** The new table record is initialized and put in pParse->pNewTable. +// ** As more of the CREATE TABLE statement is parsed, additional action +// ** routines will be called to add more information to this record. +// ** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine +// ** is called to complete the construction of the new table record. +// */ +func _sqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, isTemp int32, isView int32, isVirtual int32, noErr int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var addr1, fileFormat, iDb, reg1, reg2, reg3, v10, v11, v13, v15, v7, v8 int32 + var db, pTable, v, zDb, zDb1, zName, v1, v12, v14, v2, v3, v4, v5, v9 uintptr + var v6 bool + var _ /* pName at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr1, db, fileFormat, iDb, pTable, reg1, reg2, reg3, v, zDb, zDb1, zName, v1, v10, v11, v12, v13, v14, v15, v2, v3, v4, v5, v6, v7, v8, v9 + zName = uintptr(0) /* The name of the new table */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Unqualified name of the table to create */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum == uint32(1) { + /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */ + iDb = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v1 = __ccgo_ts + 6565 + } else { + v1 = __ccgo_ts + 6098 + } + zName = _sqlite3DbStrDup(tls, db, v1) + *(*uintptr)(unsafe.Pointer(bp)) = pName1 + } else { + /* The common case */ + iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp) + if iDb < 0 { + return + } + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 && (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) && iDb != int32(1) { + /* If creating a temp table, the name may not be qualified. Unless + ** the database name is "temp" anyway. */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12581, 0) + return + } + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp != 0 { + iDb = int32(1) + } + zName = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenMap(tls, pParse, zName, *(*uintptr)(unsafe.Pointer(bp))) + } + } + (*TParse)(unsafe.Pointer(pParse)).FsNameToken = *(*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) + if zName == uintptr(0) { + return + } + if isView != 0 { + v2 = __ccgo_ts + 10828 + } else { + v2 = __ccgo_ts + 9090 + } + if _sqlite3CheckObjectName(tls, pParse, zName, v2, zName) != 0 { + goto begin_table_error + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { + isTemp = int32(1) + } + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && isTemp == int32(1) { + v3 = __ccgo_ts + 6565 + } else { + v3 = __ccgo_ts + 6098 + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { + goto begin_table_error + } + if !(isVirtual != 0) && _sqlite3AuthCheck(tls, pParse, int32(_aCode[isTemp+int32(2)*isView]), zName, uintptr(0), zDb) != 0 { + goto begin_table_error + } + /* Make sure the new table name does not collide with an existing + ** index or table name in the same database. Issue an error message if + ** it does. The exception is if the statement being parsed was passed + ** to an sqlite3_declare_vtab() call. In that case only the column names + ** and types will be used, so there is no need to test for namespace + ** collisions. + */ + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { + zDb1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + goto begin_table_error + } + pTable = _sqlite3FindTable(tls, db, zName, zDb1) + if pTable != 0 { + if !(noErr != 0) { + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VIEW) { + v4 = __ccgo_ts + 10828 + } else { + v4 = __ccgo_ts + 9090 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12622, libc.VaList(bp+16, v4, *(*uintptr)(unsafe.Pointer(bp)))) + } else { + _sqlite3CodeVerifySchema(tls, pParse, iDb) + _sqlite3ForceNotReadOnly(tls, pParse) + } + goto begin_table_error + } + if _sqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12643, libc.VaList(bp+16, zName)) + goto begin_table_error + } + } + pTable = _sqlite3DbMallocZero(tls, db, uint64(104)) + if pTable == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + goto begin_table_error + } + (*TTable)(unsafe.Pointer(pTable)).FzName = zName + (*TTable)(unsafe.Pointer(pTable)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTable)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + (*TTable)(unsafe.Pointer(pTable)).FnTabRef = uint32(1) + (*TTable)(unsafe.Pointer(pTable)).FnRowLogEst = int16(200) + (*TParse)(unsafe.Pointer(pParse)).FpNewTable = pTable + /* Begin generating the code that will insert the table record into + ** the schema table. Note in particular that we must go ahead + ** and allocate the record number for the table entry now. Before any + ** PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause + ** indices to be created and the table record must come before the + ** indices. Hence, the record number for the table must be allocated + ** now. + */ + if v6 = !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0); v6 { + v5 = _sqlite3GetVdbe(tls, pParse) + v = v5 + } + if v6 && v5 != uintptr(0) { + _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) + if isVirtual != 0 { + _sqlite3VdbeAddOp0(tls, v, int32(OP_VBegin)) + } + /* If the file format and encoding in the database have not been set, + ** set them now. + */ + v9 = pParse + 56 + *(*int32)(unsafe.Pointer(v9))++ + v8 = *(*int32)(unsafe.Pointer(v9)) + v7 = v8 + (*TParse)(unsafe.Pointer(pParse)).FregRowid = v7 + reg1 = v7 + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + v10 = v11 + (*TParse)(unsafe.Pointer(pParse)).FregRoot = v10 + reg2 = v10 + v14 = pParse + 56 + *(*int32)(unsafe.Pointer(v14))++ + v13 = *(*int32)(unsafe.Pointer(v14)) + reg3 = v13 + _sqlite3VdbeAddOp3(tls, v, int32(OP_ReadCookie), iDb, reg3, int32(BTREE_FILE_FORMAT)) + _sqlite3VdbeUsesBtree(tls, v, iDb) + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_If), reg3) + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LegacyFileFmt) != uint64(0) { + v15 = int32(1) + } else { + v15 = int32(SQLITE_MAX_FILE_FORMAT) + } + fileFormat = v15 + _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_FILE_FORMAT), fileFormat) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_TEXT_ENCODING), int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc)) + _sqlite3VdbeJumpHere(tls, v, addr1) + /* This just creates a place-holder record in the sqlite_schema table. + ** The record created does not contain anything yet. It will be replaced + ** by the real entry in code generated at sqlite3EndTable(). + ** + ** The rowid for the new entry is left in register pParse->regRowid. + ** The root page number of the new table is left in reg pParse->regRoot. + ** The rowid and root page number values are needed by the code that + ** sqlite3EndTable will generate. + */ + if isView != 0 || isVirtual != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, reg2) + } else { + (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab = _sqlite3VdbeAddOp3(tls, v, int32(OP_CreateBtree), iDb, reg2, int32(BTREE_INTKEY)) + } + _sqlite3OpenSchemaTable(tls, pParse, iDb) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), 0, reg1) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Blob), int32(6), reg3, 0, uintptr(unsafe.Pointer(&_nullRow)), -int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), 0, reg3, reg1) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + _sqlite3VdbeAddOp0(tls, v, int32(OP_Close)) + } + /* Normal (non-error) return. */ + return + /* If an error occurs, we jump here */ +begin_table_error: + ; + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + _sqlite3DbFree(tls, db, zName) + return +} + +var _aCode = [4]Tu8{ + 0: uint8(SQLITE_CREATE_TABLE), + 1: uint8(SQLITE_CREATE_TEMP_TABLE), + 2: uint8(SQLITE_CREATE_VIEW), + 3: uint8(SQLITE_CREATE_TEMP_VIEW), +} + +/* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */ +var _nullRow = [6]int8{ + 0: int8(6), +} + +/* Set properties of a table column based on the (magical) +** name of the column. + */ + +// C documentation +// +// /* +// ** Clean up the data structures associated with the RETURNING clause. +// */ +func _sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pArg uintptr) { + var pHash, pRet uintptr + _, _ = pHash, pRet + pRet = pArg + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 56 + _sqlite3HashInsert(tls, pHash, pRet+196, uintptr(0)) + _sqlite3ExprListDelete(tls, db, (*TReturning)(unsafe.Pointer(pRet)).FpReturnEL) + _sqlite3DbFree(tls, db, pRet) +} + +// C documentation +// +// /* +// ** Add the RETURNING clause to the parse currently underway. +// ** +// ** This routine creates a special TEMP trigger that will fire for each row +// ** of the DML statement. That TEMP trigger contains a single SELECT +// ** statement with a result set that is the argument of the RETURNING clause. +// ** The trigger has the Trigger.bReturning flag and an opcode of +// ** TK_RETURNING instead of TK_SELECT, so that the trigger code generator +// ** knows to handle it specially. The TEMP trigger is automatically +// ** removed at the end of the parse. +// ** +// ** When this routine is called, we do not yet know if the RETURNING clause +// ** is attached to a DELETE, INSERT, or UPDATE, so construct it as a +// ** RETURNING trigger instead. It will then be converted into the appropriate +// ** type on the first call to sqlite3TriggersExist(). +// */ +func _sqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pHash, pRet uintptr + _, _, _ = db, pHash, pRet + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12678, 0) + } else { + } + (*TParse)(unsafe.Pointer(pParse)).FbReturning = uint8(1) + pRet = _sqlite3DbMallocZero(tls, db, uint64(240)) + if pRet == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pList) + return + } + *(*uintptr)(unsafe.Pointer(pParse + 208)) = pRet + (*TReturning)(unsafe.Pointer(pRet)).FpParse = pParse + (*TReturning)(unsafe.Pointer(pRet)).FpReturnEL = pList + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3DeleteReturning), pRet) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + Xsqlite3_snprintf(tls, int32(40), pRet+196, __ccgo_ts+12712, libc.VaList(bp+8, pParse)) + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FzName = pRet + 196 + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fop = uint8(TK_RETURNING) + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = uint8(TRIGGER_AFTER) + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = uint8(1) + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.FpTabSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + (*TReturning)(unsafe.Pointer(pRet)).FretTrig.Fstep_list = pRet + 88 + (*TReturning)(unsafe.Pointer(pRet)).FretTStep.Fop = uint8(TK_RETURNING) + (*TReturning)(unsafe.Pointer(pRet)).FretTStep.FpTrig = pRet + 16 + (*TReturning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 56 + if _sqlite3HashInsert(tls, pHash, pRet+196, pRet+16) == pRet+16 { + _sqlite3OomFault(tls, db) + } +} + +// C documentation +// +// /* +// ** Add a new column to the table currently being constructed. +// ** +// ** The parser calls this routine once for each column declaration +// ** in a CREATE TABLE statement. sqlite3StartTable() gets called +// ** first to get things going. Then this routine is called for each +// ** column. +// */ +func _sqlite3AddColumn(tls *libc.TLS, pParse uintptr, _sName TToken, _sType TToken) { + bp := tls.Alloc(48) + defer tls.Free(48) + *(*TToken)(unsafe.Pointer(bp)) = _sName + *(*TToken)(unsafe.Pointer(bp + 16)) = _sType + var aNew, db, p, pCol, z, zType, v1, p4 uintptr + var affinity int8 + var eType, hName, szEst Tu8 + var i int32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = aNew, affinity, db, eType, hName, i, p, pCol, szEst, z, zType, v1, p4 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + eType = uint8(COLTYPE_CUSTOM) + szEst = uint8(1) + affinity = int8(SQLITE_AFF_BLOB) + v1 = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + p = v1 + if v1 == uintptr(0) { + return + } + if int32((*TTable)(unsafe.Pointer(p)).FnCol)+int32(1) > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12732, libc.VaList(bp+40, (*TTable)(unsafe.Pointer(p)).FzName)) + return + } + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + _sqlite3DequoteToken(tls, bp) + } + /* Because keywords GENERATE ALWAYS can be converted into identifiers + ** by the parser, we can sometimes end up with a typename that ends + ** with "generated always". Check for this case and omit the surplus + ** text. */ + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(16) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(6)), __ccgo_ts+12755, int32(6)) == 0 { + (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(6) + for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { + (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- + } + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(9) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz+uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-libc.Uint32FromInt32(9)), __ccgo_ts+12762, int32(9)) == 0 { + (*(*TToken)(unsafe.Pointer(bp + 16))).Fn -= uint32(9) + for (*(*TToken)(unsafe.Pointer(bp + 16))).Fn > uint32(0) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp + 16))).Fz + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn-uint32(1)))))])&int32(0x01) != 0 { + (*(*TToken)(unsafe.Pointer(bp + 16))).Fn-- + } + } + } + /* Check for standard typenames. For standard typenames we will + ** set the Column.eType field rather than storing the typename after + ** the column name, in order to save space. */ + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn >= uint32(3) { + _sqlite3DequoteToken(tls, bp+16) + i = 0 + for { + if !(i < int32(SQLITE_N_STDTYPE)) { + break + } + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn == uint32(_sqlite3StdTypeLen[i]) && Xsqlite3_strnicmp(tls, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz, _sqlite3StdType[i], int32((*(*TToken)(unsafe.Pointer(bp + 16))).Fn)) == 0 { + (*(*TToken)(unsafe.Pointer(bp + 16))).Fn = uint32(0) + eType = uint8(i + int32(1)) + affinity = _sqlite3StdTypeAffinity[i] + if int32(affinity) <= int32(SQLITE_AFF_TEXT) { + szEst = uint8(5) + } + break + } + goto _2 + _2: + ; + i++ + } + } + z = _sqlite3DbMallocRaw(tls, db, uint64(int64((*(*TToken)(unsafe.Pointer(bp))).Fn)+int64(1)+int64((*(*TToken)(unsafe.Pointer(bp + 16))).Fn)+libc.BoolInt64((*(*TToken)(unsafe.Pointer(bp + 16))).Fn > libc.Uint32FromInt32(0)))) + if z == uintptr(0) { + return + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenMap(tls, pParse, z, bp) + } + libc.Xmemcpy(tls, z, (*(*TToken)(unsafe.Pointer(bp))).Fz, uint64((*(*TToken)(unsafe.Pointer(bp))).Fn)) + *(*int8)(unsafe.Pointer(z + uintptr((*(*TToken)(unsafe.Pointer(bp))).Fn))) = 0 + _sqlite3Dequote(tls, z) + hName = _sqlite3StrIHash(tls, z) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FhName) == int32(hName) && _sqlite3StrICmp(tls, z, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(i)*16))).FzCnName) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12772, libc.VaList(bp+40, z)) + _sqlite3DbFree(tls, db, z) + return + } + goto _3 + _3: + ; + i++ + } + aNew = _sqlite3DbRealloc(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol, uint64(int64((*TTable)(unsafe.Pointer(p)).FnCol)+libc.Int64FromInt32(1))*uint64(16)) + if aNew == uintptr(0) { + _sqlite3DbFree(tls, db, z) + return + } + (*TTable)(unsafe.Pointer(p)).FaCol = aNew + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr((*TTable)(unsafe.Pointer(p)).FnCol)*16 + libc.Xmemset(tls, pCol, 0, uint64(16)) + (*TColumn)(unsafe.Pointer(pCol)).FzCnName = z + (*TColumn)(unsafe.Pointer(pCol)).FhName = hName + if (*(*TToken)(unsafe.Pointer(bp + 16))).Fn == uint32(0) { + /* If there is no type specified, columns have the default affinity + ** 'BLOB' with a default size of 4 bytes. */ + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = affinity + libc.SetBitFieldPtr8Uint32(pCol+8, uint32(eType), 4, 0xf0) + (*TColumn)(unsafe.Pointer(pCol)).FszEst = szEst + } else { + zType = z + uintptr(_sqlite3Strlen30(tls, z)) + uintptr(1) + libc.Xmemcpy(tls, zType, (*(*TToken)(unsafe.Pointer(bp + 16))).Fz, uint64((*(*TToken)(unsafe.Pointer(bp + 16))).Fn)) + *(*int8)(unsafe.Pointer(zType + uintptr((*(*TToken)(unsafe.Pointer(bp + 16))).Fn))) = 0 + _sqlite3Dequote(tls, zType) + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = _sqlite3AffinityType(tls, zType, pCol) + p4 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(COLFLAG_HASTYPE)) + } + (*TTable)(unsafe.Pointer(p)).FnCol++ + (*TTable)(unsafe.Pointer(p)).FnNVCol++ + (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) +} + +// C documentation +// +// /* +// ** This routine is called by the parser while in the middle of +// ** parsing a CREATE TABLE statement. A "NOT NULL" constraint has +// ** been seen on a column. This routine sets the notNull flag on +// ** the column currently under construction. +// */ +func _sqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { + var p, pCol, pIdx uintptr + _, _, _ = p, pCol, pIdx + p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if p == uintptr(0) || int32((*TTable)(unsafe.Pointer(p)).FnCol) < int32(1) { + return + } + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 + libc.SetBitFieldPtr8Uint32(pCol+8, uint32(uint8(onError)), 0, 0xf) + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_HasNotNull) + /* Set the uniqNotNull flag on any UNIQUE or PK indexes already created + ** on this column. */ + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_UNIQUE) != 0 { + pIdx = (*TTable)(unsafe.Pointer(p)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn))) == int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1) { + libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(1), 3, 0x8) + } + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } +} + +// C documentation +// +// /* +// ** Scan the column type name zType (length nType) and return the +// ** associated affinity type. +// ** +// ** This routine does a case-independent search of zType for the +// ** substrings in the following table. If one of the substrings is +// ** found, the corresponding affinity is returned. If zType contains +// ** more than one of the substrings, entries toward the top of +// ** the table take priority. For example, if zType is 'BLOBINT', +// ** SQLITE_AFF_INTEGER is returned. +// ** +// ** Substring | Affinity +// ** -------------------------------- +// ** 'INT' | SQLITE_AFF_INTEGER +// ** 'CHAR' | SQLITE_AFF_TEXT +// ** 'CLOB' | SQLITE_AFF_TEXT +// ** 'TEXT' | SQLITE_AFF_TEXT +// ** 'BLOB' | SQLITE_AFF_BLOB +// ** 'REAL' | SQLITE_AFF_REAL +// ** 'FLOA' | SQLITE_AFF_REAL +// ** 'DOUB' | SQLITE_AFF_REAL +// ** +// ** If none of the substrings in the above table are found, +// ** SQLITE_AFF_NUMERIC is returned. +// */ +func _sqlite3AffinityType(tls *libc.TLS, zIn uintptr, pCol uintptr) (r int8) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aff int8 + var h Tu32 + var x Tu8 + var zChar uintptr + var _ /* v at bp+0 */ int32 + _, _, _, _ = aff, h, x, zChar + h = uint32(0) + aff = int8(SQLITE_AFF_NUMERIC) + zChar = uintptr(0) + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + x = *(*Tu8)(unsafe.Pointer(zIn)) + h = h< r=(k/4+1) */ + _sqlite3GetInt32(tls, zChar, bp) + break + } + zChar++ + } + } else { + *(*int32)(unsafe.Pointer(bp)) = int32(16) /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/ + } + } + *(*int32)(unsafe.Pointer(bp)) = *(*int32)(unsafe.Pointer(bp))/int32(4) + int32(1) + if *(*int32)(unsafe.Pointer(bp)) > int32(255) { + *(*int32)(unsafe.Pointer(bp)) = int32(255) + } + (*TColumn)(unsafe.Pointer(pCol)).FszEst = uint8(*(*int32)(unsafe.Pointer(bp))) + } + return aff +} + +// C documentation +// +// /* +// ** The expression is the default value for the most recently added column +// ** of the table currently under construction. +// ** +// ** Default value expressions must be constant. Raise an exception if this +// ** is not the case. +// ** +// ** This routine is called by the parser while in the middle of +// ** parsing a CREATE TABLE statement. +// */ +func _sqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStart uintptr, zEnd uintptr) { + bp := tls.Alloc(96) + defer tls.Free(96) + var db, p, pCol, pDfltExpr uintptr + var isInit int32 + var _ /* x at bp+0 */ TExpr + _, _, _, _, _ = db, isInit, p, pCol, pDfltExpr + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if p != uintptr(0) { + isInit = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) != int32(1)) + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(p)).FnCol)-int32(1))*16 + if !(_sqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12798, libc.VaList(bp+80, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + } else { + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12843, 0) + } else { + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_SPAN) + *(*uintptr)(unsafe.Pointer(bp + 8)) = _sqlite3DbSpanDup(tls, db, zStart, zEnd) + (*(*TExpr)(unsafe.Pointer(bp))).FpLeft = pExpr + (*(*TExpr)(unsafe.Pointer(bp))).Fflags = uint32(EP_Skip) + pDfltExpr = _sqlite3ExprDup(tls, db, bp, int32(EXPRDUP_REDUCE)) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) + _sqlite3ColumnSetExpr(tls, pParse, p, pCol, pDfltExpr) + } + } + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameExprUnmap(tls, pParse, pExpr) + } + _sqlite3ExprDelete(tls, db, pExpr) +} + +// C documentation +// +// /* +// ** Backwards Compatibility Hack: +// ** +// ** Historical versions of SQLite accepted strings as column names in +// ** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: +// ** +// ** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) +// ** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); +// ** +// ** This is goofy. But to preserve backwards compatibility we continue to +// ** accept it. This routine does the necessary conversion. It converts +// ** the expression given in its argument from a TK_STRING into a TK_ID +// ** if the expression is just a TK_STRING with an optional COLLATE clause. +// ** If the expression is anything other than TK_STRING, the expression is +// ** unchanged. +// */ +func _sqlite3StringToId(tls *libc.TLS, p uintptr) { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_STRING) { + (*TExpr)(unsafe.Pointer(p)).Fop = uint8(TK_ID) + } else { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLLATE) && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpLeft)).Fop) == int32(TK_STRING) { + (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(p)).FpLeft)).Fop = uint8(TK_ID) + } + } +} + +// C documentation +// +// /* +// ** Tag the given column as being part of the PRIMARY KEY +// */ +func _makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { + var p1 uintptr + _ = p1 + p1 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(COLFLAG_PRIMKEY)) + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12884, 0) + } +} + +// C documentation +// +// /* +// ** Designate the PRIMARY KEY for the table. pList is a list of names +// ** of columns that form the primary key. If pList is NULL, then the +// ** most recently added column of the table is the primary key. +// ** +// ** A table can have at most one primary key. If the table already has +// ** a primary key (and this is the second primary key) then create an +// ** error. +// ** +// ** If the PRIMARY KEY is on a single column whose datatype is INTEGER, +// ** then we will try to use that column as the rowid. Set the Table.iPKey +// ** field of the table under construction to be the index of the +// ** INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is +// ** no INTEGER PRIMARY KEY. +// ** +// ** If the key is not an INTEGER PRIMARY KEY, then create a unique +// ** index for the key. No index is created for INTEGER PRIMARY KEYs. +// */ +func _sqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError int32, autoInc int32, sortOrder int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iCol, nTerm int32 + var pCExpr, pCExpr1, pCol, pTab, zCName uintptr + _, _, _, _, _, _, _, _ = i, iCol, nTerm, pCExpr, pCExpr1, pCol, pTab, zCName + pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + pCol = uintptr(0) + iCol = -int32(1) + if pTab == uintptr(0) { + goto primary_key_exit + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasPrimaryKey) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12936, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto primary_key_exit + } + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasPrimaryKey) + if pList == uintptr(0) { + iCol = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) - int32(1) + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + _makeColumnPartOfPrimaryKey(tls, pParse, pCol) + nTerm = int32(1) + } else { + nTerm = (*TExprList)(unsafe.Pointer(pList)).FnExpr + i = 0 + for { + if !(i < nTerm) { + break + } + pCExpr = _sqlite3ExprSkipCollate(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) + _sqlite3StringToId(tls, pCExpr) + if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) == int32(TK_ID) { + zCName = *(*uintptr)(unsafe.Pointer(pCExpr + 8)) + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if _sqlite3StrICmp(tls, zCName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName) == 0 { + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + _makeColumnPartOfPrimaryKey(tls, pParse, pCol) + break + } + goto _2 + _2: + ; + iCol++ + } + } + goto _1 + _1: + ; + i++ + } + } + if nTerm == int32(1) && pCol != 0 && int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == int32(COLTYPE_INTEGER) && sortOrder != int32(SQLITE_SO_DESC) { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && pList != 0 { + pCExpr1 = _sqlite3ExprSkipCollate(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr) + _sqlite3RenameTokenRemap(tls, pParse, pTab+52, pCExpr1) + } + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(iCol) + (*TTable)(unsafe.Pointer(pTab)).FkeyConf = uint8(onError) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(autoInc * int32(TF_Autoincrement)) + if pList != 0 { + (*TParse)(unsafe.Pointer(pParse)).FiPkSortOrder = (*(*TExprList_item)(unsafe.Pointer(pList + 8))).Ffg.FsortFlags + } + _sqlite3HasExplicitNulls(tls, pParse, pList) + } else { + if autoInc != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12977, 0) + } else { + _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) + pList = uintptr(0) + } + } +primary_key_exit: + ; + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) + return +} + +// C documentation +// +// /* +// ** Add a new CHECK constraint to the table currently under construction. +// */ +func _sqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintptr, zStart uintptr, zEnd uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pTab uintptr + var _ /* t at bp+0 */ TToken + _, _ = db, pTab + pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pTab != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == libc.Int32FromInt32(PARSE_MODE_DECLARE_VTAB)) && !(_sqlite3BtreeIsReadonly(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb)*32))).FpBt) != 0) { + (*TTable)(unsafe.Pointer(pTab)).FpCheck = _sqlite3ExprListAppend(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FpCheck, pCheckExpr) + if (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn != 0 { + _sqlite3ExprListSetName(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FpCheck, pParse+112, int32(1)) + } else { + zStart++ + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart)))])&int32(0x01) != 0) { + break + } + goto _1 + _1: + ; + zStart++ + } + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + uintptr(-libc.Int32FromInt32(1)))))])&int32(0x01) != 0 { + zEnd-- + } + (*(*TToken)(unsafe.Pointer(bp))).Fz = zStart + (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(int32(int64(zEnd) - int64((*(*TToken)(unsafe.Pointer(bp))).Fz))) + _sqlite3ExprListSetName(tls, pParse, (*TTable)(unsafe.Pointer(pTab)).FpCheck, bp, int32(1)) + } + } else { + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pCheckExpr) + } +} + +// C documentation +// +// /* +// ** Set the collation function of the most recently parsed table column +// ** to the CollSeq given. +// */ +func _sqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { + var db, p, pIdx, zColl, v1 uintptr + var i int32 + _, _, _, _, _, _ = db, i, p, pIdx, zColl, v1 + v1 = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + p = v1 + if v1 == uintptr(0) || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return + } + i = int32((*TTable)(unsafe.Pointer(p)).FnCol) - int32(1) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + zColl = _sqlite3NameFromToken(tls, db, pToken) + if !(zColl != 0) { + return + } + if _sqlite3LocateCollSeq(tls, pParse, zColl) != 0 { + _sqlite3ColumnSetColl(tls, db, (*TTable)(unsafe.Pointer(p)).FaCol+uintptr(i)*16, zColl) + /* If the column is declared as " PRIMARY KEY COLLATE ", + ** then an index may have been created on this column before the + ** collation type was added. Correct this if it is the case. + */ + pIdx = (*TTable)(unsafe.Pointer(p)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn))) == i { + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl)) = _sqlite3ColumnColl(tls, (*TTable)(unsafe.Pointer(p)).FaCol+uintptr(i)*16) + } + goto _2 + _2: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } + _sqlite3DbFree(tls, db, zColl) +} + +// C documentation +// +// /* Change the most recently parsed column to be a GENERATED ALWAYS AS +// ** column. +// */ +func _sqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType Tu8 + var pCol, pTab, p1 uintptr + _, _, _, _ = eType, pCol, pTab, p1 + eType = uint8(COLFLAG_VIRTUAL) + pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if pTab == uintptr(0) { + /* generated column in an CREATE TABLE IF NOT EXISTS that already exists */ + goto generated_done + } + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13033, 0) + goto generated_done + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) > 0 { + goto generated_error + } + if pType != 0 { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(7) && Xsqlite3_strnicmp(tls, __ccgo_ts+13076, (*TToken)(unsafe.Pointer(pType)).Fz, int32(7)) == 0 { + /* no-op */ + } else { + if (*TToken)(unsafe.Pointer(pType)).Fn == uint32(6) && Xsqlite3_strnicmp(tls, __ccgo_ts+13084, (*TToken)(unsafe.Pointer(pType)).Fz, int32(6)) == 0 { + eType = uint8(COLFLAG_STORED) + } else { + goto generated_error + } + } + } + if int32(eType) == int32(COLFLAG_VIRTUAL) { + (*TTable)(unsafe.Pointer(pTab)).FnNVCol-- + } + p1 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | int32(eType)) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(eType) + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { + _makeColumnPartOfPrimaryKey(tls, pParse, pCol) /* For the error message */ + } + if pExpr != 0 && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_ID) { + /* The value of a generated column needs to be a real expression, not + ** just a reference to another column, in order for covering index + ** optimizations to work correctly. So if the value is not an expression, + ** turn it into one by adding a unary "+" operator. */ + pExpr = _sqlite3PExpr(tls, pParse, int32(TK_UPLUS), pExpr, uintptr(0)) + } + if pExpr != 0 && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_RAISE) { + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = (*TColumn)(unsafe.Pointer(pCol)).Faffinity + } + _sqlite3ColumnSetExpr(tls, pParse, pTab, pCol, pExpr) + pExpr = uintptr(0) + goto generated_done +generated_error: + ; + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13091, libc.VaList(bp+8, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) +generated_done: + ; + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) +} + +// C documentation +// +// /* +// ** Generate code that will increment the schema cookie. +// ** +// ** The schema cookie is used to determine when the schema for the +// ** database changes. After each schema change, the cookie value +// ** changes. When a process first reads the schema it records the +// ** cookie. Thereafter, whenever it goes to access the database, +// ** it checks the cookie to make sure the schema has not changed +// ** since it was last read. +// ** +// ** This plan is not completely bullet-proof. It is possible for +// ** the schema to change multiple times and for the cookie to be +// ** set back to prior value. But schema changes are infrequent +// ** and the probability of hitting the same cookie value is only +// ** 1 chance in 2^32. So we're safe enough. +// ** +// ** IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments +// ** the schema-version whenever the schema changes. +// */ +func _sqlite3ChangeCookie(tls *libc.TLS, pParse uintptr, iDb int32) { + var db, v uintptr + _, _ = db, v + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_SCHEMA_VERSION), int32(libc.Uint32FromInt32(1)+uint32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema)).Fschema_cookie))) +} + +// C documentation +// +// /* +// ** Measure the number of characters needed to output the given +// ** identifier. The number returned includes any quotes used +// ** but does not include the null terminator. +// ** +// ** The estimate is conservative. It might be larger that what is +// ** really needed. +// */ +func _identLength(tls *libc.TLS, z uintptr) (r int32) { + var n int32 + _ = n + n = 0 + for { + if !(*(*int8)(unsafe.Pointer(z)) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(z))) == int32('"') { + n++ + } + goto _1 + _1: + ; + n++ + z++ + } + return n + int32(2) +} + +// C documentation +// +// /* +// ** The first parameter is a pointer to an output buffer. The second +// ** parameter is a pointer to an integer that contains the offset at +// ** which to write into the output buffer. This function copies the +// ** nul-terminated string pointed to by the third parameter, zSignedIdent, +// ** to the specified offset in the buffer and updates *pIdx to refer +// ** to the first byte after the last byte written before returning. +// ** +// ** If the string zSignedIdent consists entirely of alphanumeric +// ** characters, does not begin with a digit and is not an SQL keyword, +// ** then it is copied to the output buffer exactly as it is. Otherwise, +// ** it is quoted using double-quotes. +// */ +func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { + var i, j, needQuote, v2, v4, v5, v6 int32 + var zIdent uintptr + _, _, _, _, _, _, _, _ = i, j, needQuote, zIdent, v2, v4, v5, v6 + zIdent = zSignedIdent + i = *(*int32)(unsafe.Pointer(pIdx)) + j = 0 + for { + if !(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j))) != 0) { + break + } + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))])&libc.Int32FromInt32(0x06) != 0) && int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != int32('_') { + break + } + goto _1 + _1: + ; + j++ + } + needQuote = libc.BoolInt32(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0 || j == 0) + if needQuote != 0 { + v2 = i + i++ + *(*int8)(unsafe.Pointer(z + uintptr(v2))) = int8('"') + } + j = 0 + for { + if !(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j))) != 0) { + break + } + v4 = i + i++ + *(*int8)(unsafe.Pointer(z + uintptr(v4))) = int8(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) + if int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) == int32('"') { + v5 = i + i++ + *(*int8)(unsafe.Pointer(z + uintptr(v5))) = int8('"') + } + goto _3 + _3: + ; + j++ + } + if needQuote != 0 { + v6 = i + i++ + *(*int8)(unsafe.Pointer(z + uintptr(v6))) = int8('"') + } + *(*int8)(unsafe.Pointer(z + uintptr(i))) = 0 + *(*int32)(unsafe.Pointer(pIdx)) = i +} + +// C documentation +// +// /* +// ** Generate a CREATE TABLE statement appropriate for the given +// ** table. Memory to hold the text of the statement is obtained +// ** from sqliteMalloc() and must be freed by the calling function. +// */ +func _createTableStmt(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, len1, n, v2 int32 + var pCol, zEnd, zSep, zSep2, zStmt, zType uintptr + var _ /* k at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = i, len1, n, pCol, zEnd, zSep, zSep2, zStmt, zType, v2 + n = 0 + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + i = libc.Int32FromInt32(0) + for { + if !(i < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + n += _identLength(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + int32(5) + goto _1 + _1: + ; + i++ + pCol += 16 + } + n += _identLength(tls, (*TTable)(unsafe.Pointer(p)).FzName) + if n < int32(50) { + zSep = __ccgo_ts + 1680 + zSep2 = __ccgo_ts + 13122 + zEnd = __ccgo_ts + 5138 + } else { + zSep = __ccgo_ts + 13124 + zSep2 = __ccgo_ts + 13128 + zEnd = __ccgo_ts + 13133 + } + n += int32(35) + int32(6)*int32((*TTable)(unsafe.Pointer(p)).FnCol) + zStmt = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) + if zStmt == uintptr(0) { + _sqlite3OomFault(tls, db) + return uintptr(0) + } + Xsqlite3_snprintf(tls, n, zStmt, __ccgo_ts+13136, 0) + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Strlen30(tls, zStmt) + _identPut(tls, zStmt, bp, (*TTable)(unsafe.Pointer(p)).FzName) + v2 = *(*int32)(unsafe.Pointer(bp)) + *(*int32)(unsafe.Pointer(bp))++ + *(*int8)(unsafe.Pointer(zStmt + uintptr(v2))) = int8('(') + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + i = libc.Int32FromInt32(0) + for { + if !(i < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + Xsqlite3_snprintf(tls, n-*(*int32)(unsafe.Pointer(bp)), zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), zSep, 0) + *(*int32)(unsafe.Pointer(bp)) += _sqlite3Strlen30(tls, zStmt+uintptr(*(*int32)(unsafe.Pointer(bp)))) + zSep = zSep2 + _identPut(tls, zStmt, bp, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + zType = _azType1[int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity)-int32(SQLITE_AFF_BLOB)] + len1 = _sqlite3Strlen30(tls, zType) + libc.Xmemcpy(tls, zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), zType, uint64(len1)) + *(*int32)(unsafe.Pointer(bp)) += len1 + goto _3 + _3: + ; + i++ + pCol += 16 + } + Xsqlite3_snprintf(tls, n-*(*int32)(unsafe.Pointer(bp)), zStmt+uintptr(*(*int32)(unsafe.Pointer(bp))), __ccgo_ts+3827, libc.VaList(bp+16, zEnd)) + return zStmt +} + +var _azType1 = [6]uintptr{ + 0: __ccgo_ts + 1680, + 1: __ccgo_ts + 13150, + 2: __ccgo_ts + 13156, + 3: __ccgo_ts + 13161, + 4: __ccgo_ts + 13166, + 5: __ccgo_ts + 13156, +} + +// C documentation +// +// /* +// ** Resize an Index object to hold N columns total. Return SQLITE_OK +// ** on success and SQLITE_NOMEM on an OOM error. +// */ +func _resizeIndexObject(tls *libc.TLS, db uintptr, pIdx uintptr, N int32) (r int32) { + var nByte int32 + var zExtra uintptr + _, _ = nByte, zExtra + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) >= N { + return SQLITE_OK + } + nByte = int32((libc.Uint64FromInt64(8) + libc.Uint64FromInt64(2) + libc.Uint64FromInt64(2) + libc.Uint64FromInt32(1)) * uint64(N)) + zExtra = _sqlite3DbMallocZero(tls, db, uint64(nByte)) + if zExtra == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, zExtra, (*TIndex)(unsafe.Pointer(pIdx)).FazColl, uint64(8)*uint64((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) + (*TIndex)(unsafe.Pointer(pIdx)).FazColl = zExtra + zExtra += uintptr(uint64(8) * uint64(N)) + libc.Xmemcpy(tls, zExtra, (*TIndex)(unsafe.Pointer(pIdx)).FaiRowLogEst, uint64(2)*uint64(int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)+libc.Int32FromInt32(1))) + (*TIndex)(unsafe.Pointer(pIdx)).FaiRowLogEst = zExtra + zExtra += uintptr(uint64(2) * uint64(N)) + libc.Xmemcpy(tls, zExtra, (*TIndex)(unsafe.Pointer(pIdx)).FaiColumn, uint64(2)*uint64((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) + (*TIndex)(unsafe.Pointer(pIdx)).FaiColumn = zExtra + zExtra += uintptr(uint64(2) * uint64(N)) + libc.Xmemcpy(tls, zExtra, (*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder, uint64((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) + (*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder = zExtra + (*TIndex)(unsafe.Pointer(pIdx)).FnColumn = uint16(N) + libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(1), 4, 0x10) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Estimate the total row width for a table. +// */ +func _estimateTableWidth(tls *libc.TLS, pTab uintptr) { + var i int32 + var pTabCol uintptr + var wTable uint32 + _, _, _ = i, pTabCol, wTable + wTable = uint32(0) + i = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + pTabCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + for { + if !(i > 0) { + break + } + wTable += uint32((*TColumn)(unsafe.Pointer(pTabCol)).FszEst) + goto _1 + _1: + ; + i-- + pTabCol += 16 + } + if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) < 0 { + wTable++ + } + (*TTable)(unsafe.Pointer(pTab)).FszTabRow = _sqlite3LogEst(tls, uint64(wTable*uint32(4))) +} + +// C documentation +// +// /* +// ** Estimate the average size of a row for an index. +// */ +func _estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { + var aCol uintptr + var i, v2 int32 + var wIndex uint32 + var x Ti16 + _, _, _, _, _ = aCol, i, wIndex, x, v2 + wIndex = uint32(0) + aCol = (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + x = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) + if int32(x) < 0 { + v2 = int32(1) + } else { + v2 = int32((*(*TColumn)(unsafe.Pointer(aCol + uintptr(x)*16))).FszEst) + } + wIndex += uint32(v2) + goto _1 + _1: + ; + i++ + } + (*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow = _sqlite3LogEst(tls, uint64(wIndex*uint32(4))) +} + +// C documentation +// +// /* Return true if column number x is any of the first nCol entries of aiCol[]. +// ** This is used to determine if the column number x appears in any of the +// ** first nCol entries of an index. +// */ +func _hasColumn(tls *libc.TLS, aiCol uintptr, nCol int32, x int32) (r int32) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + for { + v1 = nCol + nCol-- + if !(v1 > 0) { + break + } + v2 = aiCol + aiCol += 2 + if x == int32(*(*Ti16)(unsafe.Pointer(v2))) { + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if any of the first nKey entries of index pIdx exactly +// ** match the iCol-th entry of pPk. pPk is always a WITHOUT ROWID +// ** PRIMARY KEY index. pIdx is an index on the same table. pIdx may +// ** or may not be the same index as pPk. +// ** +// ** The first nKey entries of pIdx are guaranteed to be ordinary columns, +// ** not a rowid or expression. +// ** +// ** This routine differs from hasColumn() in that both the column and the +// ** collating sequence must match for this routine, but for hasColumn() only +// ** the column name must match. +// */ +func _isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int32) (r int32) { + var i, j int32 + _, _ = i, j + j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(iCol)*2))) + i = 0 + for { + if !(i < nKey) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == j && _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(iCol)*8))) == 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* Recompute the colNotIdxed field of the Index. +// ** +// ** colNotIdxed is a bitmask that has a 0 bit representing each indexed +// ** columns that are within the first 63 columns of the table and a 1 for +// ** all other bits (all columns that are not in the index). The +// ** high-order bit of colNotIdxed is always 1. All unindexed columns +// ** of the table have a 1. +// ** +// ** 2019-10-24: For the purpose of this computation, virtual columns are +// ** not considered to be covered by the index, even if they are in the +// ** index, because we do not trust the logic in whereIndexExprTrans() to be +// ** able to find all instances of a reference to the indexed table column +// ** and convert them into references to the index. Hence we always want +// ** the actual table at hand in order to recompute the virtual column, if +// ** necessary. +// ** +// ** The colNotIdxed mask is AND-ed with the SrcList.a[].colUsed mask +// ** to determine if the index is covering index. +// */ +func _recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { + var j, x int32 + var m TBitmask + var pTab uintptr + _, _, _, _ = j, m, pTab, x + m = uint64(0) + pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable + j = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) - int32(1) + for { + if !(j >= 0) { + break + } + x = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) + if x >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(x)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + if x < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + m |= libc.Uint64FromInt32(1) << x + } + } + goto _1 + _1: + ; + j-- + } + (*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m + /* See note-20221022-a */ +} + +// C documentation +// +// /* +// ** This routine runs at the end of parsing a CREATE TABLE statement that +// ** has a WITHOUT ROWID clause. The job of this routine is to convert both +// ** internal schema data structures and the generated VDBE code so that they +// ** are appropriate for a WITHOUT ROWID table instead of a rowid table. +// ** Changes include: +// ** +// ** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. +// ** (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY +// ** into BTREE_BLOBKEY. +// ** (3) Bypass the creation of the sqlite_schema table entry +// ** for the PRIMARY KEY as the primary key index is now +// ** identified by the sqlite_schema table entry of the table itself. +// ** (4) Set the Index.tnum of the PRIMARY KEY Index object in the +// ** schema to the rootpage from the main table. +// ** (5) Add all table columns to the PRIMARY KEY Index object +// ** so that the PRIMARY KEY is a covering index. The surplus +// ** columns are part of KeyInfo.nAllField and are not used for +// ** sorting or lookup or uniqueness checks. +// ** (6) Replace the rowid tail on all automatically generated UNIQUE +// ** indices with the PRIMARY KEY columns. +// ** +// ** For virtual tables, only (1) is performed. +// */ +func _convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pIdx, pList, pPk, v uintptr + var i, j, n, nExtra, nPk, v3, v4, v8 int32 + var v5 Tu16 + var _ /* ipkToken at bp+0 */ TToken + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, j, n, nExtra, nPk, pIdx, pList, pPk, v, v3, v4, v5, v8 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) + */ + if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x2>>1)) != 0) { + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 + 8))&0xf>>0)) == OE_None { + libc.SetBitFieldPtr8Uint32((*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*16+8, libc.Uint32FromInt32(OE_Abort), 0, 0xf) + } + goto _1 + _1: + ; + i++ + } + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasNotNull) + } + /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY + ** into BTREE_BLOBKEY. + */ + if (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab != 0 { + _sqlite3VdbeChangeP3(tls, v, (*TParse)(unsafe.Pointer(pParse)).Fu1.FaddrCrTab, int32(BTREE_BLOBKEY)) + } + /* Locate the PRIMARY KEY index. Or, if this table was originally + ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + _sqlite3TokenInit(tls, bp, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName) + pList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp, 0)) + if pList == uintptr(0) { + *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_WithoutRowid)) + return + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr, pTab+52) + } + (*(*TExprList_item)(unsafe.Pointer(pList + 8))).Ffg.FsortFlags = (*TParse)(unsafe.Pointer(pParse)).FiPkSortOrder + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, int32((*TTable)(unsafe.Pointer(pTab)).FkeyConf), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + *(*Tu32)(unsafe.Pointer(pTab + 48)) &= uint32(^libc.Int32FromInt32(TF_WithoutRowid)) + return + } + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + /* + ** Remove all redundant columns from the PRIMARY KEY. For example, change + ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later + ** code assumes the PRIMARY KEY contains no repeated columns. + */ + v3 = libc.Int32FromInt32(1) + j = v3 + i = v3 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + if _isDupColumn(tls, pPk, j, pPk, i) != 0 { + (*TIndex)(unsafe.Pointer(pPk)).FnColumn-- + } else { + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8)) + *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(j))) = *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(i))) + v4 = j + j++ + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(v4)*2)) = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)) + } + goto _2 + _2: + ; + i++ + } + (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol = uint16(j) + } + libc.SetBitFieldPtr16Uint32(pPk+100, libc.Uint32FromInt32(1), 5, 0x20) + if !(int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x2>>1)) != 0) { + libc.SetBitFieldPtr16Uint32(pPk+100, libc.Uint32FromInt32(1), 3, 0x8) + } + v5 = (*TIndex)(unsafe.Pointer(pPk)).FnKeyCol + (*TIndex)(unsafe.Pointer(pPk)).FnColumn = v5 + nPk = int32(v5) + /* Bypass the creation of the PRIMARY KEY btree and the sqlite_schema + ** table entry. This is only required if currently generating VDBE + ** code for a CREATE TABLE (not when parsing one as part of reading + ** a database schema). */ + if v != 0 && (*TIndex)(unsafe.Pointer(pPk)).Ftnum > uint32(0) { + _sqlite3VdbeChangeOpcode(tls, v, int32((*TIndex)(unsafe.Pointer(pPk)).Ftnum), uint8(OP_Goto)) + } + /* The root page of the PRIMARY KEY is the table root page */ + (*TIndex)(unsafe.Pointer(pPk)).Ftnum = (*TTable)(unsafe.Pointer(pTab)).Ftnum + /* Update the in-memory representation of all UNIQUE indices by converting + ** the final rowid column into one or more columns of the PRIMARY KEY. + */ + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + goto _6 + } + v8 = libc.Int32FromInt32(0) + n = v8 + i = v8 + for { + if !(i < nPk) { + break + } + if !(_isDupColumn(tls, pIdx, int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol), pPk, i) != 0) { + n++ + } + goto _7 + _7: + ; + i++ + } + if n == 0 { + /* This index is a superset of the primary key */ + (*TIndex)(unsafe.Pointer(pIdx)).FnColumn = (*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol + goto _6 + } + if _resizeIndexObject(tls, db, pIdx, int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)+n) != 0 { + return + } + i = 0 + j = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + for { + if !(i < nPk) { + break + } + if !(_isDupColumn(tls, pIdx, int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol), pPk, i) != 0) { + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)) = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)) + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8)) + if *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(i))) != 0 { + /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */ + libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(1), 10, 0x400) + } + j++ + } + goto _9 + _9: + ; + i++ + } + goto _6 + _6: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + /* Add all table columns to the PRIMARY KEY index + */ + nExtra = 0 + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if !(_hasColumn(tls, (*TIndex)(unsafe.Pointer(pPk)).FaiColumn, nPk, i) != 0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + nExtra++ + } + goto _10 + _10: + ; + i++ + } + if _resizeIndexObject(tls, db, pPk, nPk+nExtra) != 0 { + return + } + i = 0 + j = nPk + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if !(_hasColumn(tls, (*TIndex)(unsafe.Pointer(pPk)).FaiColumn, j, i) != 0) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)) = int16(i) + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + j++ + } + goto _11 + _11: + ; + i++ + } + _recomputeColumnsNotIndexed(tls, pPk) +} + +// C documentation +// +// /* +// ** Return true if pTab is a virtual table and zName is a shadow table name +// ** for that virtual table. +// */ +func _sqlite3IsShadowTableOf(tls *libc.TLS, db uintptr, pTab uintptr, zName uintptr) (r int32) { + var nName int32 + var pMod uintptr + _, _ = nName, pMod /* Module for the virtual table */ + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + return 0 + } + nName = _sqlite3Strlen30(tls, (*TTable)(unsafe.Pointer(pTab)).FzName) + if Xsqlite3_strnicmp(tls, zName, (*TTable)(unsafe.Pointer(pTab)).FzName, nName) != 0 { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zName + uintptr(nName)))) != int32('_') { + return 0 + } + pMod = _sqlite3HashFind(tls, db+576, *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg))) + if pMod == uintptr(0) { + return 0 + } + if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FiVersion < int32(3) { + return 0 + } + if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxShadowName == uintptr(0) { + return 0 + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxShadowName})))(tls, zName+uintptr(nName)+uintptr(1)) +} + +// C documentation +// +// /* +// ** Table pTab is a virtual table. If it the virtual table implementation +// ** exists and has an xShadowName method, then loop over all other ordinary +// ** tables within the same schema looking for shadow tables of pTab, and mark +// ** any shadow tables seen using the TF_Shadow flag. +// */ +func _sqlite3MarkAllShadowTablesOf(tls *libc.TLS, db uintptr, pTab uintptr) { + var k, pMod, pOther uintptr + var nName int32 + _, _, _, _ = k, nName, pMod, pOther /* For looping through the symbol table */ + pMod = _sqlite3HashFind(tls, db+576, *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg))) + if pMod == uintptr(0) { + return + } + if (*TModule)(unsafe.Pointer(pMod)).FpModule == uintptr(0) { + return + } + if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FiVersion < int32(3) { + return + } + if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxShadowName == uintptr(0) { + return + } + nName = _sqlite3Strlen30(tls, (*TTable)(unsafe.Pointer(pTab)).FzName) + k = (*THash)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema + 8)).Ffirst + for { + if !(k != 0) { + break + } + pOther = (*THashElem)(unsafe.Pointer(k)).Fdata + if !(int32((*TTable)(unsafe.Pointer(pOther)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + goto _1 + } + if (*TTable)(unsafe.Pointer(pOther)).FtabFlags&uint32(TF_Shadow) != 0 { + goto _1 + } + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pOther)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, nName) == 0 && int32(*(*int8)(unsafe.Pointer((*TTable)(unsafe.Pointer(pOther)).FzName + uintptr(nName)))) == int32('_') && (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxShadowName})))(tls, (*TTable)(unsafe.Pointer(pOther)).FzName+uintptr(nName)+uintptr(1)) != 0 { + *(*Tu32)(unsafe.Pointer(pOther + 48)) |= uint32(TF_Shadow) + } + goto _1 + _1: + ; + k = (*THashElem)(unsafe.Pointer(k)).Fnext + } +} + +// C documentation +// +// /* +// ** Return true if zName is a shadow table name in the current database +// ** connection. +// ** +// ** zName is temporarily modified while this routine is running, but is +// ** restored to its original value prior to this routine returning. +// */ +func _sqlite3ShadowTableName(tls *libc.TLS, db uintptr, zName uintptr) (r int32) { + var pTab, zTail uintptr + _, _ = pTab, zTail /* Table that zName is a shadow of */ + zTail = libc.Xstrrchr(tls, zName, int32('_')) + if zTail == uintptr(0) { + return 0 + } + *(*int8)(unsafe.Pointer(zTail)) = 0 + pTab = _sqlite3FindTable(tls, db, zName, uintptr(0)) + *(*int8)(unsafe.Pointer(zTail)) = int8('_') + if pTab == uintptr(0) { + return 0 + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + return 0 + } + return _sqlite3IsShadowTableOf(tls, db, pTab, zName) +} + +// C documentation +// +// /* +// ** This routine is called to report the final ")" that terminates +// ** a CREATE TABLE statement. +// ** +// ** The table structure that other action routines have been building +// ** is added to the internal hash tables, assuming no errors have +// ** occurred. +// ** +// ** An entry for the table is made in the schema table on disk, unless +// ** this is a temporary table or db->init.busy==1. When db->init.busy==1 +// ** it means we are reading the sqlite_schema table because we just +// ** connected to the database or because the sqlite_schema table has +// ** recently changed, so the entry for this table already exists in +// ** the sqlite_schema table. We do not want to create it again. +// ** +// ** If the pSelect argument is not NULL, it means that this routine +// ** was called to create a table generated from a +// ** "CREATE TABLE ... AS SELECT ..." statement. The column names of +// ** the new table will match the result set of the SELECT. +// */ +func _sqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr, tabOpts Tu32, pSelect uintptr) { + bp := tls.Alloc(112) + defer tls.Free(112) + var addrInsLoop, addrTop, iDb, ii, ii1, n, nNG, regRec, regRowid, regYield, v4, v6, v8 int32 + var colFlags Tu32 + var db, p, pCol, pDb, pEnd2, pIdx, pOld, pSchema, pSelTab, pX, v, zStmt, zType, zType2, v11, v5, v7, v9 uintptr + var v10 Ti16 + var _ /* dest at bp+0 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrInsLoop, addrTop, colFlags, db, iDb, ii, ii1, n, nNG, p, pCol, pDb, pEnd2, pIdx, pOld, pSchema, pSelTab, pX, regRec, regRowid, regYield, v, zStmt, zType, zType2, v10, v11, v4, v5, v6, v7, v8, v9 /* The new table */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* An implied index of the table */ + if pEnd == uintptr(0) && pSelect == uintptr(0) { + return + } + p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if p == uintptr(0) { + return + } + if pSelect == uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTable)(unsafe.Pointer(p)).FzName) != 0 { + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_Shadow) + } + /* If the db->init.busy is 1 it means we are reading the SQL off the + ** "sqlite_schema" or "sqlite_temp_schema" table on the disk. + ** So do not write to the disk again. Extract the root page number + ** for the table from the db->init.newTnum field. (The page number + ** should have been put there by the sqliteOpenCb routine.) + ** + ** If the root page number is 1, that means this is the sqlite_schema + ** table itself. So mark it read-only. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + if pSelect != 0 || !(int32((*TTable)(unsafe.Pointer(p)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) && (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1680, 0) + return + } + (*TTable)(unsafe.Pointer(p)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum + if (*TTable)(unsafe.Pointer(p)).Ftnum == uint32(1) { + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_Readonly) + } + } + /* Special processing for tables that include the STRICT keyword: + ** + ** * Do not allow custom column datatypes. Every column must have + ** a datatype that is one of INT, INTEGER, REAL, TEXT, or BLOB. + ** + ** * If a PRIMARY KEY is defined, other than the INTEGER PRIMARY KEY, + ** then all columns of the PRIMARY KEY must have a NOT NULL + ** constraint. + */ + if tabOpts&uint32(TF_Strict) != 0 { + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_Strict) + ii = 0 + for { + if !(ii < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + pCol = (*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii)*16 + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == COLTYPE_CUSTOM { + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13172, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1680))) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13205, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + } + return + } else { + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf0>>4)) == int32(COLTYPE_ANY) { + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = int8(SQLITE_AFF_BLOB) + } + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 && int32((*TTable)(unsafe.Pointer(p)).FiPKey) != ii && int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) == OE_None { + libc.SetBitFieldPtr8Uint32(pCol+8, libc.Uint32FromInt32(OE_Abort), 0, 0xf) + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_HasNotNull) + } + goto _1 + _1: + ; + ii++ + } + } + /* Special processing for WITHOUT ROWID Tables */ + if tabOpts&uint32(TF_WithoutRowid) != 0 { + if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13232, 0) + return + } + if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasPrimaryKey) == uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13282, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)) + return + } + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) + _convertToWithoutRowidTable(tls, pParse, p) + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) + /* Resolve names in all CHECK constraint expressions. + */ + if (*TTable)(unsafe.Pointer(p)).FpCheck != 0 { + _sqlite3ResolveSelfReference(tls, pParse, p, int32(NC_IsCheck), uintptr(0), (*TTable)(unsafe.Pointer(p)).FpCheck) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + /* If errors are seen, delete the CHECK constraints now, else they might + ** actually be used if PRAGMA writable_schema=ON is set. */ + _sqlite3ExprListDelete(tls, db, (*TTable)(unsafe.Pointer(p)).FpCheck) + (*TTable)(unsafe.Pointer(p)).FpCheck = uintptr(0) + } else { + } + } + if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { + nNG = 0 + ii1 = 0 + for { + if !(ii1 < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + colFlags = uint32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(ii1)*16))).FcolFlags) + if colFlags&uint32(COLFLAG_GENERATED) != uint32(0) { + pX = _sqlite3ColumnExpr(tls, p, (*TTable)(unsafe.Pointer(p)).FaCol+uintptr(ii1)*16) + if _sqlite3ResolveSelfReference(tls, pParse, p, int32(NC_GenCol), pX, uintptr(0)) != 0 { + /* If there are errors in resolving the expression, change the + ** expression to a NULL. This prevents code generators that operate + ** on the expression from inserting extra parts into the expression + ** tree that have been allocated from lookaside memory, which is + ** illegal in a schema and will lead to errors or heap corruption + ** when the database connection closes. */ + _sqlite3ColumnSetExpr(tls, pParse, p, (*TTable)(unsafe.Pointer(p)).FaCol+uintptr(ii1)*16, _sqlite3ExprAlloc(tls, db, int32(TK_NULL), uintptr(0), 0)) + } + } else { + nNG++ + } + goto _2 + _2: + ; + ii1++ + } + if nNG == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13314, 0) + return + } + } + /* Estimate the average row size for the table and for all implied indices */ + _estimateTableWidth(tls, p) + pIdx = (*TTable)(unsafe.Pointer(p)).FpIndex + for { + if !(pIdx != 0) { + break + } + _estimateIndexWidth(tls, pIdx) + goto _3 + _3: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + /* If not initializing, then create a record for the new table + ** in the schema table of the database. + ** + ** If this is a TEMPORARY table, write the entry into the auxiliary + ** file instead of into the main database file. + */ + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { /* Text of the CREATE TABLE or CREATE VIEW statement */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + return + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), 0) + /* + ** Initialize zType for the new view or table. + */ + if int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { + /* A regular table */ + zType = __ccgo_ts + 9090 + zType2 = __ccgo_ts + 13358 + } else { + /* A view */ + zType = __ccgo_ts + 10828 + zType2 = __ccgo_ts + 13364 + } + /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT + ** statement to populate the new table. The root-page number for the + ** new table is in register pParse->regRoot. + ** + ** Once the SELECT has been coded by sqlite3Select(), it is in a + ** suitable state to query for the column names and types to be used + ** by the new table. + ** + ** A shared-cache write-lock is not required to write to the new table, + ** as a schema-lock must have already been obtained to create it. Since + ** a schema-lock excludes all other database users, the write-lock would + ** be redundant. + */ + if pSelect != 0 { /* A table that describes the SELECT results */ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + return + } + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + regYield = v4 + v7 = pParse + 56 + *(*int32)(unsafe.Pointer(v7))++ + v6 = *(*int32)(unsafe.Pointer(v7)) + regRec = v6 + v9 = pParse + 56 + *(*int32)(unsafe.Pointer(v9))++ + v8 = *(*int32)(unsafe.Pointer(v9)) + regRowid = v8 + _sqlite3MayAbort(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenWrite), int32(1), (*TParse)(unsafe.Pointer(pParse)).FregRoot, iDb) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_P2ISREG)) + (*TParse)(unsafe.Pointer(pParse)).FnTab = int32(2) + addrTop = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regYield, 0, addrTop) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + pSelTab = _sqlite3ResultSetOfSelect(tls, pParse, pSelect, int8(SQLITE_AFF_BLOB)) + if pSelTab == uintptr(0) { + return + } + v10 = (*TTable)(unsafe.Pointer(pSelTab)).FnCol + (*TTable)(unsafe.Pointer(p)).FnNVCol = v10 + (*TTable)(unsafe.Pointer(p)).FnCol = v10 + (*TTable)(unsafe.Pointer(p)).FaCol = (*TTable)(unsafe.Pointer(pSelTab)).FaCol + (*TTable)(unsafe.Pointer(pSelTab)).FnCol = 0 + (*TTable)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) + _sqlite3DeleteTable(tls, db, pSelTab) + _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regYield) + _sqlite3Select(tls, pParse, pSelect, bp) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + _sqlite3VdbeEndCoroutine(tls, v, regYield) + _sqlite3VdbeJumpHere(tls, v, addrTop-int32(1)) + addrInsLoop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst, (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst, regRec) + _sqlite3TableAffinity(tls, v, p, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), int32(1), regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), int32(1), regRec, regRowid) + _sqlite3VdbeGoto(tls, v, addrInsLoop) + _sqlite3VdbeJumpHere(tls, v, addrInsLoop) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), int32(1)) + } + /* Compute the complete text of the CREATE statement */ + if pSelect != 0 { + zStmt = _createTableStmt(tls, db, p) + } else { + if tabOpts != 0 { + v11 = pParse + 288 + } else { + v11 = pEnd + } + pEnd2 = v11 + n = int32(int64((*TToken)(unsafe.Pointer(pEnd2)).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(pEnd2)).Fz))) != int32(';') { + n = int32(uint32(n) + (*TToken)(unsafe.Pointer(pEnd2)).Fn) + } + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+13369, libc.VaList(bp+48, zType2, n, (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + } + /* A slot for the record has already been allocated in the + ** schema table. We just need to update that slot with all + ** the information we've collected. + */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13384, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zType, (*TTable)(unsafe.Pointer(p)).FzName, (*TTable)(unsafe.Pointer(p)).FzName, (*TParse)(unsafe.Pointer(pParse)).FregRoot, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + _sqlite3DbFree(tls, db, zStmt) + _sqlite3ChangeCookie(tls, pParse, iDb) + /* Check to see if we need to create an sqlite_sequence table for + ** keeping track of autoincrement keys. + */ + if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13482, libc.VaList(bp+48, (*TDb)(unsafe.Pointer(pDb)).FzDbSName)) + } + } + /* Reparse everything to update our internal data structures */ + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+13524, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(p)).FzName)), uint16(0)) + /* Test for cycles in generated columns and illegal expressions + ** in CHECK constraints and in DEFAULT clauses. */ + if (*TTable)(unsafe.Pointer(p)).FtabFlags&uint32(TF_HasGenerated) != 0 { + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13558, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), int32(1), 0, 0, _sqlite3MPrintf(tls, db, __ccgo_ts+13579, libc.VaList(bp+48, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(p)).FzName)), -int32(6)) + } + /* Add the table to the in-memory representation of the database. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + pSchema = (*TTable)(unsafe.Pointer(p)).FpSchema + pOld = _sqlite3HashInsert(tls, pSchema+8, (*TTable)(unsafe.Pointer(p)).FzName, p) + if pOld != 0 { + /* Malloc must have failed inside HashInsert() */ + _sqlite3OomFault(tls, db) + return + } + (*TParse)(unsafe.Pointer(pParse)).FpNewTable = uintptr(0) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) + /* If this is the magic sqlite_sequence table used by autoincrement, + ** then record a pointer to this table in the main database structure + ** so that INSERT can find the table easily. */ + if libc.Xstrcmp(tls, (*TTable)(unsafe.Pointer(p)).FzName, __ccgo_ts+9612) == 0 { + (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p + } + } + if !(pSelect != 0) && int32((*TTable)(unsafe.Pointer(p)).FeTabType) == TABTYP_NORM { + if (*TToken)(unsafe.Pointer(pCons)).Fz == uintptr(0) { + pCons = pEnd + } + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(p + 64))).FaddColOffset = int32(13) + int32(int64((*TToken)(unsafe.Pointer(pCons)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + } +} + +// C documentation +// +// /* +// ** The parser calls this routine in order to create a new VIEW +// */ +func _sqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 uintptr, pName2 uintptr, pCNames uintptr, pSelect uintptr, isTemp int32, noErr int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var db, p, z uintptr + var iDb, n int32 + var _ /* pName at bp+112 */ uintptr + var _ /* sEnd at bp+0 */ TToken + var _ /* sFix at bp+16 */ TDbFixer + _, _, _, _, _ = db, iDb, n, p, z + *(*uintptr)(unsafe.Pointer(bp + 112)) = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if int32((*TParse)(unsafe.Pointer(pParse)).FnVar) > 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13611, 0) + goto create_view_fail + } + _sqlite3StartTable(tls, pParse, pName1, pName2, isTemp, int32(1), 0, noErr) + p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if p == uintptr(0) || (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto create_view_fail + } + /* Legacy versions of SQLite allowed the use of the magic "rowid" column + ** on a view, even though views do not have rowids. The following flag + ** setting fixes this problem. But the fix can be disabled by compiling + ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ + *(*Tu32)(unsafe.Pointer(p + 48)) |= uint32(TF_NoVisibleRowid) /* Never allow rowid in view */ + _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+112) + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(p)).FpSchema) + _sqlite3FixInit(tls, bp+16, pParse, iDb, __ccgo_ts+10828, *(*uintptr)(unsafe.Pointer(bp + 112))) + if _sqlite3FixSelect(tls, bp+16, pSelect) != 0 { + goto create_view_fail + } + /* Make a copy of the entire SELECT statement that defines the view. + ** This will force all the Expr.token.z values to be dynamically + ** allocated rather than point to the input string - which means that + ** they will persist after the current sqlite3_exec() call returns. + */ + *(*Tu32)(unsafe.Pointer(pSelect + 4)) |= uint32(SF_View) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(p)).Fu))).FpSelect = pSelect + pSelect = uintptr(0) + } else { + (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(p)).Fu))).FpSelect = _sqlite3SelectDup(tls, db, pSelect, int32(EXPRDUP_REDUCE)) + } + (*TTable)(unsafe.Pointer(p)).FpCheck = _sqlite3ExprListDup(tls, db, pCNames, int32(EXPRDUP_REDUCE)) + (*TTable)(unsafe.Pointer(p)).FeTabType = uint8(TABTYP_VIEW) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto create_view_fail + } + /* Locate the end of the CREATE VIEW statement. Make sEnd point to + ** the end. + */ + *(*TToken)(unsafe.Pointer(bp)) = (*TParse)(unsafe.Pointer(pParse)).FsLastToken + if int32(*(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz))) != int32(';') { + (*(*TToken)(unsafe.Pointer(bp))).Fz += uintptr((*(*TToken)(unsafe.Pointer(bp))).Fn) + } + (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(0) + n = int32(int64((*(*TToken)(unsafe.Pointer(bp))).Fz) - int64((*TToken)(unsafe.Pointer(pBegin)).Fz)) + z = (*TToken)(unsafe.Pointer(pBegin)).Fz + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n-int32(1)))))])&int32(0x01) != 0 { + n-- + } + (*(*TToken)(unsafe.Pointer(bp))).Fz = z + uintptr(n-int32(1)) + (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(1) + /* Use sqlite3EndTable() to add the view to the schema table */ + _sqlite3EndTable(tls, pParse, uintptr(0), bp, uint32(0), uintptr(0)) +create_view_fail: + ; + _sqlite3SelectDelete(tls, db, pSelect) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameExprlistUnmap(tls, pParse, pCNames) + } + _sqlite3ExprListDelete(tls, db, pCNames) + return +} + +// C documentation +// +// /* +// ** The Table structure pTable is really a VIEW. Fill in the names of +// ** the columns of the view in the pTable structure. Return the number +// ** of errors. If an error is seen leave an error message in pParse->zErrMsg. +// */ +func _viewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pSel, pSelTab, p2 uintptr + var eParseMode Tu8 + var nErr, nSelect, nTab, rc, v1 int32 + var xAuth Tsqlite3_xauth + _, _, _, _, _, _, _, _, _, _, _ = db, eParseMode, nErr, nSelect, nTab, pSel, pSelTab, rc, xAuth, v1, p2 /* Copy of the SELECT that implements the view */ + nErr = 0 /* Number of errors encountered */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Saved xAuth pointer */ + if int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == int32(TABTYP_VTAB) { + (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock++ + rc = _sqlite3VtabCallConnect(tls, pParse, pTable) + (*Tsqlite3)(unsafe.Pointer(db)).FnSchemaLock-- + return rc + } + /* A positive nCol means the columns names for this view are + ** already known. This routine is not called unless either the + ** table is virtual or nCol is zero. + */ + /* A negative nCol is a special marker meaning that we are currently + ** trying to compute the column names. If we enter this routine with + ** a negative nCol, it means two or more views form a loop, like this: + ** + ** CREATE VIEW one AS SELECT * FROM two; + ** CREATE VIEW two AS SELECT * FROM one; + ** + ** Actually, the error above is now caught prior to reaching this point. + ** But the following test is still important as it does come up + ** in the following: + ** + ** CREATE TABLE main.ex1(a); + ** CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; + ** SELECT * FROM temp.ex1; + */ + if int32((*TTable)(unsafe.Pointer(pTable)).FnCol) < 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13647, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + return int32(1) + } + /* If we get this far, it means we need to compute the table names. + ** Note that the call to sqlite3ResultSetOfSelect() will expand any + ** "*" elements in the results set of the view and will assign cursors + ** to the elements of the FROM clause. But we do not want these changes + ** to be permanent. So the computation is done on a copy of the SELECT + ** statement that defines the view. + */ + pSel = _sqlite3SelectDup(tls, db, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTable)).Fu))).FpSelect, 0) + if pSel != 0 { + eParseMode = (*TParse)(unsafe.Pointer(pParse)).FeParseMode + nTab = (*TParse)(unsafe.Pointer(pParse)).FnTab + nSelect = (*TParse)(unsafe.Pointer(pParse)).FnSelect + (*TParse)(unsafe.Pointer(pParse)).FeParseMode = uint8(PARSE_MODE_NORMAL) + _sqlite3SrcListAssignCursors(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpSrc) + (*TTable)(unsafe.Pointer(pTable)).FnCol = int16(-int32(1)) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + pSelTab = _sqlite3ResultSetOfSelect(tls, pParse, pSel, int8(SQLITE_AFF_NONE)) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + (*TParse)(unsafe.Pointer(pParse)).FnTab = nTab + (*TParse)(unsafe.Pointer(pParse)).FnSelect = nSelect + if pSelTab == uintptr(0) { + (*TTable)(unsafe.Pointer(pTable)).FnCol = 0 + nErr++ + } else { + if (*TTable)(unsafe.Pointer(pTable)).FpCheck != 0 { + /* CREATE VIEW name(arglist) AS ... + ** The names of the columns in the table are taken from + ** arglist which is stored in pTable->pCheck. The pCheck field + ** normally holds CHECK constraints on an ordinary table, but for + ** a VIEW it holds the list of column names. + */ + _sqlite3ColumnsFromExprList(tls, pParse, (*TTable)(unsafe.Pointer(pTable)).FpCheck, pTable+54, pTable+8) + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && int32((*TTable)(unsafe.Pointer(pTable)).FnCol) == (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpEList)).FnExpr { + _sqlite3SubqueryColumnTypes(tls, pParse, pTable, pSel, int8(SQLITE_AFF_NONE)) + } + } else { + /* CREATE VIEW name AS... without an argument list. Construct + ** the column names from the SELECT statement that defines the view. + */ + (*TTable)(unsafe.Pointer(pTable)).FnCol = (*TTable)(unsafe.Pointer(pSelTab)).FnCol + (*TTable)(unsafe.Pointer(pTable)).FaCol = (*TTable)(unsafe.Pointer(pSelTab)).FaCol + *(*Tu32)(unsafe.Pointer(pTable + 48)) |= (*TTable)(unsafe.Pointer(pSelTab)).FtabFlags & uint32(COLFLAG_NOINSERT) + (*TTable)(unsafe.Pointer(pSelTab)).FnCol = 0 + (*TTable)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) + } + } + (*TTable)(unsafe.Pointer(pTable)).FnNVCol = (*TTable)(unsafe.Pointer(pTable)).FnCol + _sqlite3DeleteTable(tls, db, pSelTab) + _sqlite3SelectDelete(tls, db, pSel) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + v1 = 0 + } else { + v1 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v1) + (*TParse)(unsafe.Pointer(pParse)).FeParseMode = eParseMode + } else { + nErr++ + } + p2 = (*TTable)(unsafe.Pointer(pTable)).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(DB_UnresetViews)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3DeleteColumnNames(tls, db, pTable) + } + return nErr +} + +func _sqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) (r int32) { + if !(int32((*TTable)(unsafe.Pointer(pTable)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && int32((*TTable)(unsafe.Pointer(pTable)).FnCol) > 0 { + return 0 + } + return _viewGetColumnNames(tls, pParse, pTable) +} + +// C documentation +// +// /* +// ** Clear the column names from every VIEW in database idx. +// */ +func _sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { + var i, pTab, p2 uintptr + _, _, _ = i, pTab, p2 + if !(int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_UnresetViews) == libc.Int32FromInt32(DB_UnresetViews)) { + return + } + i = (*THash)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 8)).Ffirst + for { + if !(i != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(i)).Fdata + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + _sqlite3DeleteColumnNames(tls, db, pTab) + } + goto _1 + _1: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + p2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(idx)*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) & ^libc.Int32FromInt32(DB_UnresetViews)) +} + +// C documentation +// +// /* +// ** This function is called by the VDBE to adjust the internal schema +// ** used by SQLite when the btree layer moves a table root page. The +// ** root-page of a table or index in database iDb has changed from iFrom +// ** to iTo. +// ** +// ** Ticket #1728: The symbol table might still contain information +// ** on tables and/or indices that are the process of being deleted. +// ** If you are unlucky, one of those deleted indices or tables might +// ** have the same rootpage number as the real table or index that is +// ** being moved. So we cannot stop searching after the first match +// ** because the first match might be for one of the deleted indices +// ** or tables and not the table/index that is actually being moved. +// ** We must continue looping until all tables and indices with +// ** rootpage==iFrom have been converted to have a rootpage of iTo +// ** in order to be certain that we got the right one. +// */ +func _sqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom TPgno, iTo TPgno) { + var pDb, pElem, pHash, pIdx, pTab uintptr + _, _, _, _, _ = pDb, pElem, pHash, pIdx, pTab + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 8 + pElem = (*THash)(unsafe.Pointer(pHash)).Ffirst + for { + if !(pElem != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(pElem)).Fdata + if (*TTable)(unsafe.Pointer(pTab)).Ftnum == iFrom { + (*TTable)(unsafe.Pointer(pTab)).Ftnum = iTo + } + goto _1 + _1: + ; + pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext + } + pHash = (*TDb)(unsafe.Pointer(pDb)).FpSchema + 32 + pElem = (*THash)(unsafe.Pointer(pHash)).Ffirst + for { + if !(pElem != 0) { + break + } + pIdx = (*THashElem)(unsafe.Pointer(pElem)).Fdata + if (*TIndex)(unsafe.Pointer(pIdx)).Ftnum == iFrom { + (*TIndex)(unsafe.Pointer(pIdx)).Ftnum = iTo + } + goto _2 + _2: + ; + pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext + } +} + +// C documentation +// +// /* +// ** Write code to erase the table with root-page iTable from database iDb. +// ** Also write code to modify the sqlite_schema table and internal schema +// ** if a root-page of another table is moved by the btree-layer whilst +// ** erasing iTable (this can happen with an auto-vacuum database). +// */ +func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var r1 int32 + var v uintptr + _, _ = r1, v + v = _sqlite3GetVdbe(tls, pParse) + r1 = _sqlite3GetTempReg(tls, pParse) + if iTable < int32(2) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13677, 0) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) + _sqlite3MayAbort(tls, pParse) + /* OP_Destroy stores an in integer r1. If this integer + ** is non-zero, then it is the root page number of a table moved to + ** location iTable. The following code modifies the sqlite_schema table to + ** reflect this. + ** + ** The "#NNN" in the SQL is a special constant that means whatever value + ** is in register NNN. See grammar rules associated with the TK_REGISTER + ** token for additional information. + */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13692, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName, iTable, r1, r1)) + _sqlite3ReleaseTempReg(tls, pParse, r1) +} + +// C documentation +// +// /* +// ** Write VDBE code to erase table pTab and all associated indices on disk. +// ** Code to update the sqlite_schema tables and internal schema definitions +// ** in case a root-page belonging to another table is moved by the btree layer +// ** is also added (this can happen with an auto-vacuum database). +// */ +func _destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { + var iDb int32 + var iDestroyed, iIdx, iLargest, iTab TPgno + var pIdx uintptr + _, _, _, _, _, _ = iDb, iDestroyed, iIdx, iLargest, iTab, pIdx + /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM + ** is not defined), then it is important to call OP_Destroy on the + ** table and index root-pages in order, starting with the numerically + ** largest root-page number. This guarantees that none of the root-pages + ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the + ** following were coded: + ** + ** OP_Destroy 4 0 + ** ... + ** OP_Destroy 5 0 + ** + ** and root page 5 happened to be the largest root-page number in the + ** database, then root page 5 would be moved to page 4 by the + ** "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit + ** a free-list page. + */ + iTab = (*TTable)(unsafe.Pointer(pTab)).Ftnum + iDestroyed = uint32(0) + for int32(1) != 0 { + iLargest = uint32(0) + if iDestroyed == uint32(0) || iTab < iDestroyed { + iLargest = iTab + } + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + iIdx = (*TIndex)(unsafe.Pointer(pIdx)).Ftnum + if (iDestroyed == uint32(0) || iIdx < iDestroyed) && iIdx > iLargest { + iLargest = iIdx + } + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + if iLargest == uint32(0) { + return + } else { + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _destroyRootPage(tls, pParse, int32(iLargest), iDb) + iDestroyed = iLargest + } + } +} + +// C documentation +// +// /* +// ** Remove entries from the sqlite_statN tables (for N in (1,2,3)) +// ** after a DROP INDEX or DROP TABLE command. +// */ +func _sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uintptr, zName uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var i int32 + var zDbName uintptr + var _ /* zTab at bp+0 */ [24]int8 + _, _ = i, zDbName + zDbName = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName + i = int32(1) + for { + if !(i <= int32(4)) { + break + } + Xsqlite3_snprintf(tls, int32(24), bp, __ccgo_ts+13759, libc.VaList(bp+32, i)) + if _sqlite3FindTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, bp, zDbName) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+11717, libc.VaList(bp+32, zDbName, bp, zType, zName)) + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Generate code to drop a table. +// */ +func _sqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int32, isView int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pDb, pTrigger, v uintptr + _, _, _, _ = db, pDb, pTrigger, v + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + v = _sqlite3GetVdbe(tls, pParse) + _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3VdbeAddOp0(tls, v, int32(OP_VBegin)) + } + /* Drop all triggers associated with the table being dropped. Code + ** is generated to remove entries from sqlite_schema and/or + ** sqlite_temp_schema if required. + */ + pTrigger = _sqlite3TriggerList(tls, pParse, pTab) + for pTrigger != 0 { + _sqlite3DropTriggerPtr(tls, pParse, pTrigger) + pTrigger = (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext + } + /* Remove any entries of the sqlite_sequence table associated with + ** the table being dropped. This is done before the table is dropped + ** at the btree level, in case the sqlite_sequence table needs to + ** move as a result of the drop (can happen in auto-vacuum mode). + */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != 0 { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13773, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + } + /* Drop all entries in the schema table that refer to the + ** table. The program name loops through the schema table and deletes + ** every row that refers to a table of the same name as the one being + ** dropped. Triggers are handled separately because a trigger can be + ** created in the temp database that refers to a table in another + ** database. + */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+13818, libc.VaList(bp+8, (*TDb)(unsafe.Pointer(pDb)).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName)) + if !(isView != 0) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + _destroyTable(tls, pParse, pTab) + } + /* Remove the table entry from SQLite's internal schema and modify + ** the schema cookie. + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3VdbeAddOp4(tls, v, int32(OP_VDestroy), iDb, 0, 0, (*TTable)(unsafe.Pointer(pTab)).FzName, 0) + _sqlite3MayAbort(tls, pParse) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTable), iDb, 0, 0, (*TTable)(unsafe.Pointer(pTab)).FzName, 0) + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqliteViewResetAll(tls, db, iDb) +} + +// C documentation +// +// /* +// ** Return TRUE if shadow tables should be read-only in the current +// ** context. +// */ +func _sqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) (r int32) { + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_Defensive) != uint64(0) && (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeExec == 0 && !((*Tsqlite3)(unsafe.Pointer(db)).FnVTrans > 0 && (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans == uintptr(0)) { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if it is not allowed to drop the given table +// */ +func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6557, int32(7)) == 0 { + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3450, int32(4)) == 0 { + return 0 + } + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7298, int32(10)) == 0 { + return 0 + } + return int32(1) + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { + return int32(1) + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != 0 { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** This routine is called to do the work of a DROP TABLE statement. +// ** pName is the name of the table to be dropped. +// */ +func _sqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int32, noErr int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var code, iDb int32 + var db, pTab, v, zArg2, zDb, zTab, v1 uintptr + _, _, _, _, _, _, _, _, _ = code, db, iDb, pTab, v, zArg2, zDb, zTab, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_drop_table + } + if _sqlite3ReadSchema(tls, pParse) != 0 { + goto exit_drop_table + } + if noErr != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr++ + } + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(isView), pName+8) + if noErr != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FsuppressErr-- + } + if pTab == uintptr(0) { + if noErr != 0 { + _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) + _sqlite3ForceNotReadOnly(tls, pParse) + } + goto exit_drop_table + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + /* If pTab is a virtual table, call ViewGetColumnNames() to ensure + ** it is initialized. + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) && _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + goto exit_drop_table + } + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v1 = __ccgo_ts + 6565 + } else { + v1 = __ccgo_ts + 6098 + } + zTab = v1 + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + zArg2 = uintptr(0) + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { + goto exit_drop_table + } + if isView != 0 { + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + code = int32(SQLITE_DROP_TEMP_VIEW) + } else { + code = int32(SQLITE_DROP_VIEW) + } + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + code = int32(SQLITE_DROP_VTABLE) + zArg2 = (*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, db, pTab))).FpMod)).FzName + } else { + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + code = int32(SQLITE_DROP_TEMP_TABLE) + } else { + code = int32(SQLITE_DROP_TABLE) + } + } + } + if _sqlite3AuthCheck(tls, pParse, code, (*TTable)(unsafe.Pointer(pTab)).FzName, zArg2, zDb) != 0 { + goto exit_drop_table + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), zDb) != 0 { + goto exit_drop_table + } + if _tableMayNotBeDropped(tls, db, pTab) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13885, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table + } + /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used + ** on a table. + */ + if isView != 0 && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13913, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table + } + if !(isView != 0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13947, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table + } + /* Generate code to remove the table from the schema table + ** on disk. + */ + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) + if !(isView != 0) { + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11829, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3FkDropTable(tls, pParse, pName, pTab) + } + _sqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) + } +exit_drop_table: + ; + _sqlite3SrcListDelete(tls, db, pName) +} + +// C documentation +// +// /* +// ** This routine is called to create a new foreign key on the table +// ** currently under construction. pFromCol determines which columns +// ** in the current table point to the foreign key. If pFromCol==0 then +// ** connect the key to the last column inserted. pTo is the name of +// ** the table referred to (a.k.a the "parent" table). pToCol is a list +// ** of tables in the parent pTo table. flags contains all +// ** information about the conflict resolution algorithms specified +// ** in the ON DELETE, ON UPDATE and ON INSERT clauses. +// ** +// ** An FKey structure is created and added to the table currently +// ** under construction in the pParse->pNewTable field. +// ** +// ** The foreign key is set for IMMEDIATE processing. A subsequent call +// ** to sqlite3DeferForeignKey() might change this to DEFERRED. +// */ +func _sqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, pTo uintptr, pToCol uintptr, flags int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, pFKey, pNextTo, z uintptr + var i, iCol, j, n, nCol int32 + var nByte Ti64 + _, _, _, _, _, _, _, _, _, _, _ = db, i, iCol, j, n, nByte, nCol, p, pFKey, pNextTo, z + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pFKey = uintptr(0) + p = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if p == uintptr(0) || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) { + goto fk_end + } + if pFromCol == uintptr(0) { + iCol = int32((*TTable)(unsafe.Pointer(p)).FnCol) - int32(1) + if iCol < 0 { + goto fk_end + } + if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != int32(1) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13979, libc.VaList(bp+8, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(iCol)*16))).FzCnName, pTo)) + goto fk_end + } + nCol = int32(1) + } else { + if pToCol != 0 && (*TExprList)(unsafe.Pointer(pToCol)).FnExpr != (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14042, 0) + goto fk_end + } else { + nCol = (*TExprList)(unsafe.Pointer(pFromCol)).FnExpr + } + } + nByte = int64(uint64(80) + uint64(nCol-libc.Int32FromInt32(1))*uint64(16) + uint64((*TToken)(unsafe.Pointer(pTo)).Fn) + uint64(1)) + if pToCol != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pToCol)).FnExpr) { + break + } + nByte += int64(_sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + int32(1)) + goto _1 + _1: + ; + i++ + } + } + pFKey = _sqlite3DbMallocZero(tls, db, uint64(nByte)) + if pFKey == uintptr(0) { + goto fk_end + } + (*TFKey)(unsafe.Pointer(pFKey)).FpFrom = p + (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(p + 64))).FpFKey + z = pFKey + 64 + uintptr(nCol)*16 + (*TFKey)(unsafe.Pointer(pFKey)).FzTo = z + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenMap(tls, pParse, z, pTo) + } + libc.Xmemcpy(tls, z, (*TToken)(unsafe.Pointer(pTo)).Fz, uint64((*TToken)(unsafe.Pointer(pTo)).Fn)) + *(*int8)(unsafe.Pointer(z + uintptr((*TToken)(unsafe.Pointer(pTo)).Fn))) = 0 + _sqlite3Dequote(tls, z) + z += uintptr((*TToken)(unsafe.Pointer(pTo)).Fn + uint32(1)) + (*TFKey)(unsafe.Pointer(pFKey)).FnCol = nCol + if pFromCol == uintptr(0) { + (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom = int32((*TTable)(unsafe.Pointer(p)).FnCol) - int32(1) + } else { + i = 0 + for { + if !(i < nCol) { + break + } + j = 0 + for { + if !(j < int32((*TTable)(unsafe.Pointer(p)).FnCol)) { + break + } + if _sqlite3StrICmp(tls, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(p)).FaCol + uintptr(j)*16))).FzCnName, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName) == 0 { + (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom = j + break + } + goto _3 + _3: + ; + j++ + } + if j >= int32((*TTable)(unsafe.Pointer(p)).FnCol) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14136, libc.VaList(bp+8, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName)) + goto fk_end + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, pFKey+64+uintptr(i)*16, (*(*TExprList_item)(unsafe.Pointer(pFromCol + 8 + uintptr(i)*32))).FzEName) + } + goto _2 + _2: + ; + i++ + } + } + if pToCol != 0 { + i = 0 + for { + if !(i < nCol) { + break + } + n = _sqlite3Strlen30(tls, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FzCol = z + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, z, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName) + } + libc.Xmemcpy(tls, z, (*(*TExprList_item)(unsafe.Pointer(pToCol + 8 + uintptr(i)*32))).FzEName, uint64(n)) + *(*int8)(unsafe.Pointer(z + uintptr(n))) = 0 + z += uintptr(n + int32(1)) + goto _4 + _4: + ; + i++ + } + } + (*TFKey)(unsafe.Pointer(pFKey)).FisDeferred = uint8(0) + *(*Tu8)(unsafe.Pointer(pFKey + 45)) = uint8(flags & libc.Int32FromInt32(0xff)) /* ON DELETE action */ + *(*Tu8)(unsafe.Pointer(pFKey + 45 + 1)) = uint8(flags >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) /* ON UPDATE action */ + pNextTo = _sqlite3HashInsert(tls, (*TTable)(unsafe.Pointer(p)).FpSchema+80, (*TFKey)(unsafe.Pointer(pFKey)).FzTo, pFKey) + if pNextTo == pFKey { + _sqlite3OomFault(tls, db) + goto fk_end + } + if pNextTo != 0 { + (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo = pNextTo + (*TFKey)(unsafe.Pointer(pNextTo)).FpPrevTo = pFKey + } + /* Link the foreign key to the table as the last step. + */ + (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(p + 64))).FpFKey = pFKey + pFKey = uintptr(0) +fk_end: + ; + _sqlite3DbFree(tls, db, pFKey) + _sqlite3ExprListDelete(tls, db, pFromCol) + _sqlite3ExprListDelete(tls, db, pToCol) +} + +// C documentation +// +// /* +// ** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED +// ** clause is seen as part of a foreign key definition. The isDeferred +// ** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE. +// ** The behavior of the most recently created foreign key is adjusted +// ** accordingly. +// */ +func _sqlite3DeferForeignKey(tls *libc.TLS, pParse uintptr, isDeferred int32) { + var pFKey, pTab, v1, v2 uintptr + _, _, _, _ = pFKey, pTab, v1, v2 + v1 = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + pTab = v1 + if v1 == uintptr(0) { + return + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + return + } + v2 = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + pFKey = v2 + if v2 == uintptr(0) { + return + } + /* EV: R-30323-21917 */ + (*TFKey)(unsafe.Pointer(pFKey)).FisDeferred = uint8(isDeferred) +} + +// C documentation +// +// /* +// ** Generate code that will erase and refill index *pIdx. This is +// ** used to initialize a newly created index or to recompute the +// ** content of an index in response to a REINDEX command. +// ** +// ** if memRootPage is not negative, it means that the index is newly +// ** created. The register specified by memRootPage contains the +// ** root page number of the index. If memRootPage is negative, then +// ** the index already exists and must be cleared before being refilled and +// ** the root page number of the index is taken from pIndex->tnum. +// */ +func _sqlite3RefillIndex(tls *libc.TLS, pParse uintptr, pIndex uintptr, memRootPage int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var addr1, addr2, iDb, iIdx, iSorter, iTab, j2, regRecord, v1, v3, v5, v7 int32 + var db, pKey, pTab, v, v2, v4, v6 uintptr + var tnum TPgno + var _ /* iPartIdxLabel at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr1, addr2, db, iDb, iIdx, iSorter, iTab, j2, pKey, pTab, regRecord, tnum, v, v1, v2, v3, v4, v5, v6, v7 + pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ /* The table that is indexed */ + iTab = v1 + v4 = pParse + 52 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ /* Btree cursor used for pTab */ + iIdx = v3 /* Register holding assembled index record */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ + iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_REINDEX), (*TIndex)(unsafe.Pointer(pIndex)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) != 0 { + return + } + /* Require a write-lock on the table to perform this operation */ + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(1), (*TTable)(unsafe.Pointer(pTab)).FzName) + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + return + } + if memRootPage >= 0 { + tnum = uint32(memRootPage) + } else { + tnum = (*TIndex)(unsafe.Pointer(pIndex)).Ftnum + } + pKey = _sqlite3KeyInfoOfIndex(tls, pParse, pIndex) + /* Open the sorter cursor if we are to use one. */ + v6 = pParse + 52 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + iSorter = v5 + _sqlite3VdbeAddOp4(tls, v, int32(OP_SorterOpen), iSorter, 0, int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol), _sqlite3KeyInfoRef(tls, pKey), -int32(8)) + /* Open the table. Loop through all rows of the table, inserting index + ** records into the sorter. */ + _sqlite3OpenTable(tls, pParse, iTab, iDb, pTab, int32(OP_OpenRead)) + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), iTab, 0) + regRecord = _sqlite3GetTempReg(tls, pParse) + _sqlite3MultiWrite(tls, pParse) + _sqlite3GenerateIndexKey(tls, pParse, pIndex, iTab, regRecord, 0, bp, uintptr(0), 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterInsert), iSorter, regRecord) + _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iTab, addr1+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addr1) + if memRootPage < 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32(tnum), iDb) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenWrite), iIdx, int32(tnum), iDb, pKey, -int32(8)) + if memRootPage >= 0 { + v7 = int32(OPFLAG_P2ISREG) + } else { + v7 = 0 + } + _sqlite3VdbeChangeP5(tls, v, uint16(int32(OPFLAG_BULKCSR)|v7)) + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterSort), iSorter, 0) + if int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) != OE_None { + j2 = _sqlite3VdbeGoto(tls, v, int32(1)) + addr2 = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_SorterCompare), iSorter, j2, regRecord, int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol)) + _sqlite3UniqueConstraint(tls, pParse, int32(OE_Abort), pIndex) + _sqlite3VdbeJumpHere(tls, v, j2) + } else { + /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not + ** abort. The exception is if one of the indexed expressions contains a + ** user function that throws an exception when it is evaluated. But the + ** overhead of adding a statement journal to a CREATE INDEX statement is + ** very small (since most of the pages written do not contain content that + ** needs to be restored if the statement aborts), so we call + ** sqlite3MayAbort() for all CREATE INDEX statements. */ + _sqlite3MayAbort(tls, pParse) + addr2 = _sqlite3VdbeCurrentAddr(tls, v) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_SorterData), iSorter, regRecord, iIdx) + if !(int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x400>>10)) != 0) { + /* This OP_SeekEnd opcode makes index insert for a REINDEX go much + ** faster by avoiding unnecessary seeks. But the optimization does + ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables + ** with DESC primary keys, since those indexes have there keys in + ** a different order from the main table. + ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf + */ + _sqlite3VdbeAddOp1(tls, v, int32(OP_SeekEnd), iIdx) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxInsert), iIdx, regRecord) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + _sqlite3ReleaseTempReg(tls, pParse, regRecord) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterNext), iSorter, addr2) + _sqlite3VdbeJumpHere(tls, v, addr1) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iTab) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iIdx) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iSorter) +} + +// C documentation +// +// /* +// ** Allocate heap space to hold an Index object with nCol columns. +// ** +// ** Increase the allocation size to provide an extra nExtra bytes +// ** of 8-byte aligned space after the Index object and return a +// ** pointer to this extra space in *ppExtra. +// */ +func _sqlite3AllocateIndexObject(tls *libc.TLS, db uintptr, nCol Ti16, nExtra int32, ppExtra uintptr) (r uintptr) { + var nByte int32 + var p, pExtra uintptr + _, _, _ = nByte, p, pExtra /* Bytes of space for Index object + arrays */ + nByte = int32((libc.Uint64FromInt64(160)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7)) + (uint64(8)*uint64(nCol)+uint64(7))&uint64(^libc.Int32FromInt32(7)) + (uint64(2)*uint64(int32(nCol)+libc.Int32FromInt32(1))+uint64(2)*uint64(nCol)+uint64(1)*uint64(nCol)+uint64(7))&uint64(^libc.Int32FromInt32(7))) /* Index.aSortOrder */ + p = _sqlite3DbMallocZero(tls, db, uint64(nByte+nExtra)) + if p != 0 { + pExtra = p + uintptr((libc.Uint64FromInt64(160)+libc.Uint64FromInt32(7))&uint64(^libc.Int32FromInt32(7))) + (*TIndex)(unsafe.Pointer(p)).FazColl = pExtra + pExtra += uintptr((libc.Uint64FromInt64(8)*uint64(nCol) + libc.Uint64FromInt32(7)) & uint64(^libc.Int32FromInt32(7))) + (*TIndex)(unsafe.Pointer(p)).FaiRowLogEst = pExtra + pExtra += uintptr(uint64(2) * uint64(int32(nCol)+libc.Int32FromInt32(1))) + (*TIndex)(unsafe.Pointer(p)).FaiColumn = pExtra + pExtra += uintptr(uint64(2) * uint64(nCol)) + (*TIndex)(unsafe.Pointer(p)).FaSortOrder = pExtra + (*TIndex)(unsafe.Pointer(p)).FnColumn = uint16(nCol) + (*TIndex)(unsafe.Pointer(p)).FnKeyCol = uint16(int32(nCol) - int32(1)) + *(*uintptr)(unsafe.Pointer(ppExtra)) = p + uintptr(nByte) + } + return p +} + +// C documentation +// +// /* +// ** If expression list pList contains an expression that was parsed with +// ** an explicit "NULLS FIRST" or "NULLS LAST" clause, leave an error in +// ** pParse and return non-zero. Otherwise, return zero. +// */ +func _sqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var sf Tu8 + var v2 uintptr + _, _, _ = i, sf, v2 + if pList != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x20>>5)) != 0 { + sf = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).Ffg.FsortFlags + if int32(sf) == 0 || int32(sf) == int32(3) { + v2 = __ccgo_ts + 14182 + } else { + v2 = __ccgo_ts + 14188 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14193, libc.VaList(bp+8, v2)) + return int32(1) + } + goto _1 + _1: + ; + i++ + } + } + return 0 +} + +// C documentation +// +// /* +// ** Create a new index for an SQL table. pName1.pName2 is the name of the index +// ** and pTblList is the name of the table that is to be indexed. Both will +// ** be NULL for a primary key or an index that is created to satisfy a +// ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable +// ** as the table to be indexed. pParse->pNewTable is a table that is +// ** currently being constructed by a CREATE TABLE statement. +// ** +// ** pList is a list of columns to be indexed. pList will be NULL if this +// ** is a primary key or unique-constraint on the most recent column added +// ** to the table currently under construction. +// */ +func _sqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pTblName uintptr, pList uintptr, onError int32, pStart uintptr, pPIWhere uintptr, sortOrder int32, ifNotExist int32, idxType Tu8) { + bp := tls.Alloc(176) + defer tls.Free(176) + var db, p, pCExpr, pCol, pDb, pExpr, pIdx, pIndex, pListItem, pLoop, pNext, pPk, pTab, pThis, ppFrom, v, z1, z2, zColl, zDb, zName, zStmt, v12, v13, v15, v16, v2, p3 uintptr + var i, iDb, iMem, j, k, n, n1, nColl, nExtra, nExtraCol, nName, requestedSortOrder, sortOrderMask, x, v11, v5 int32 + var _ /* pName at bp+96 */ uintptr + var _ /* prevCol at bp+112 */ TToken + var _ /* sFix at bp+0 */ TDbFixer + var _ /* zExtra at bp+104 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, iDb, iMem, j, k, n, n1, nColl, nExtra, nExtraCol, nName, p, pCExpr, pCol, pDb, pExpr, pIdx, pIndex, pListItem, pLoop, pNext, pPk, pTab, pThis, ppFrom, requestedSortOrder, sortOrderMask, v, x, z1, z2, zColl, zDb, zName, zStmt, v11, v12, v13, v15, v16, v2, v5, p3 + pTab = uintptr(0) /* Table to be indexed */ + pIndex = uintptr(0) /* The index to be created */ + zName = uintptr(0) /* 1 to honor DESC in index. 0 to ignore. */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Index of the database that is being written */ + *(*uintptr)(unsafe.Pointer(bp + 96)) = uintptr(0) /* For looping over pList */ + nExtra = 0 /* Number of extra columns needed */ + *(*uintptr)(unsafe.Pointer(bp + 104)) = uintptr(0) /* Extra space after the Index object */ + pPk = uintptr(0) /* PRIMARY KEY index for WITHOUT ROWID tables */ + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto exit_create_index + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) == int32(PARSE_MODE_DECLARE_VTAB) && int32(idxType) != int32(SQLITE_IDXTYPE_PRIMARYKEY) { + goto exit_create_index + } + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + goto exit_create_index + } + if _sqlite3HasExplicitNulls(tls, pParse, pList) != 0 { + goto exit_create_index + } + /* + ** Find the table that is to be indexed. Return early if not found. + */ + if pTblName != uintptr(0) { + /* Use the two-part index name to determine the database + ** to search for the table. 'Fix' the table name to this db + ** before looking up the table. + */ + iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp+96) + if iDb < 0 { + goto exit_create_index + } + /* If the index name was unqualified, check if the table + ** is a temp table. If so, set the database to 1. Do not do this + ** if initializing a database schema. + */ + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { + pTab = _sqlite3SrcListLookup(tls, pParse, pTblName) + if (*TToken)(unsafe.Pointer(pName2)).Fn == uint32(0) && pTab != 0 && (*TTable)(unsafe.Pointer(pTab)).FpSchema == (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { + iDb = int32(1) + } + } + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+14221, *(*uintptr)(unsafe.Pointer(bp + 96))) + if _sqlite3FixSrcList(tls, bp, pTblName) != 0 { + /* Because the parser constructs pTblName from a single identifier, + ** sqlite3FixSrcList can never fail. */ + } + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pTblName+8) + if pTab == uintptr(0) { + goto exit_create_index + } + if iDb == int32(1) && (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema != (*TTable)(unsafe.Pointer(pTab)).FpSchema { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14227, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_create_index + } + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + } + } else { + pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if !(pTab != 0) { + goto exit_create_index + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6557, int32(7)) == 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && pTblName != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14277, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName)) + goto exit_create_index + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14305, 0) + goto exit_create_index + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14330, 0) + goto exit_create_index + } + /* + ** Find the name of the index. Make sure there is not already another + ** index or table with the same name. + ** + ** Exception: If we are reading the names of permanent indices from the + ** sqlite_schema table (because some other process changed the schema) and + ** one of the index names collides with the name of a temporary table or + ** index, then we will continue to process this index. + ** + ** If pName==0 it means that we are + ** dealing with a primary key or UNIQUE constraint. We have to invent our + ** own name. + */ + if *(*uintptr)(unsafe.Pointer(bp + 96)) != 0 { + zName = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) + if zName == uintptr(0) { + goto exit_create_index + } + if SQLITE_OK != _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+14221, (*TTable)(unsafe.Pointer(pTab)).FzName) { + goto exit_create_index + } + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { + if _sqlite3FindTable(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14364, libc.VaList(bp+136, zName)) + goto exit_create_index + } + } + if _sqlite3FindIndex(tls, db, zName, (*TDb)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0) { + if !(ifNotExist != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14398, libc.VaList(bp+136, zName)) + } else { + _sqlite3CodeVerifySchema(tls, pParse, iDb) + _sqlite3ForceNotReadOnly(tls, pParse) + } + goto exit_create_index + } + } + } else { + pLoop = (*TTable)(unsafe.Pointer(pTab)).FpIndex + n = libc.Int32FromInt32(1) + for { + if !(pLoop != 0) { + break + } + goto _1 + _1: + ; + pLoop = (*TIndex)(unsafe.Pointer(pLoop)).FpNext + n++ + } + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+14422, libc.VaList(bp+136, (*TTable)(unsafe.Pointer(pTab)).FzName, n)) + if zName == uintptr(0) { + goto exit_create_index + } + /* Automatic index names generated from within sqlite3_declare_vtab() + ** must have names that are distinct from normal automatic index names. + ** The following statement converts "sqlite3_autoindex..." into + ** "sqlite3_butoindex..." in order to make the names distinct. + ** The "vtab_err.test" test demonstrates the need of this statement. */ + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL { + *(*int8)(unsafe.Pointer(zName + 7))++ + } + } + /* Check for authorization to create an index. + */ + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + zDb = (*TDb)(unsafe.Pointer(pDb)).FzDbSName + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v2 = __ccgo_ts + 6565 + } else { + v2 = __ccgo_ts + 6098 + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v2, uintptr(0), zDb) != 0 { + goto exit_create_index + } + i = int32(SQLITE_CREATE_INDEX) + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + i = int32(SQLITE_CREATE_TEMP_INDEX) + } + if _sqlite3AuthCheck(tls, pParse, i, zName, (*TTable)(unsafe.Pointer(pTab)).FzName, zDb) != 0 { + goto exit_create_index + } + } + /* If pList==0, it means this routine was called to make a primary + ** key out of the last column added to the table under construction. + ** So create a fake list to simulate this. + */ + if pList == uintptr(0) { + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1))*16 + p3 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(COLFLAG_UNIQUE)) + _sqlite3TokenInit(tls, bp+112, (*TColumn)(unsafe.Pointer(pCol)).FzCnName) + pList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+112, 0)) + if pList == uintptr(0) { + goto exit_create_index + } + _sqlite3ExprListSetSortOrder(tls, pList, sortOrder, -int32(1)) + } else { + _sqlite3ExprListCheckLength(tls, pParse, pList, __ccgo_ts+14221) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto exit_create_index + } + } + /* Figure out how many bytes of space are required to store explicitly + ** specified collation sequence names. + */ + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE) { + nExtra += int32(1) + _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8))) + } + goto _4 + _4: + ; + i++ + } + /* + ** Allocate the index structure. + */ + nName = _sqlite3Strlen30(tls, zName) + if pPk != 0 { + v5 = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + } else { + v5 = int32(1) + } + nExtraCol = v5 + pIndex = _sqlite3AllocateIndexObject(tls, db, int16((*TExprList)(unsafe.Pointer(pList)).FnExpr+nExtraCol), nName+nExtra+int32(1), bp+104) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_create_index + } + (*TIndex)(unsafe.Pointer(pIndex)).FzName = *(*uintptr)(unsafe.Pointer(bp + 104)) + *(*uintptr)(unsafe.Pointer(bp + 104)) += uintptr(nName + int32(1)) + libc.Xmemcpy(tls, (*TIndex)(unsafe.Pointer(pIndex)).FzName, zName, uint64(nName+int32(1))) + (*TIndex)(unsafe.Pointer(pIndex)).FpTable = pTab + (*TIndex)(unsafe.Pointer(pIndex)).FonError = uint8(onError) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.BoolUint32(onError != libc.Int32FromInt32(OE_None)), 3, 0x8) + libc.SetBitFieldPtr16Uint32(pIndex+100, uint32(idxType), 0, 0x3) + (*TIndex)(unsafe.Pointer(pIndex)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + (*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol = uint16((*TExprList)(unsafe.Pointer(pList)).FnExpr) + if pPIWhere != 0 { + _sqlite3ResolveSelfReference(tls, pParse, pTab, int32(NC_PartIdx), pPIWhere, uintptr(0)) + (*TIndex)(unsafe.Pointer(pIndex)).FpPartIdxWhere = pPIWhere + pPIWhere = uintptr(0) + } + /* Check to see if we should honor DESC requests on index columns + */ + if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) >= int32(4) { + sortOrderMask = -int32(1) /* Honor DESC */ + } else { + sortOrderMask = 0 /* Ignore DESC */ + } + /* Analyze the list of expressions that form the terms of the index and + ** report any errors. In the common case where the expression is exactly + ** a table column, store that column in aiColumn[]. For general expressions, + ** populate pIndex->aColExpr and store XN_EXPR (-2) in aiColumn[]. + ** + ** TODO: Issue a warning if two or more columns of the index are identical. + ** TODO: Issue a warning if the table primary key is used as part of the + ** index key. + */ + pListItem = pList + 8 + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr = pList + pList = uintptr(0) + } + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol)) { + break + } /* Collation sequence name */ + _sqlite3StringToId(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) + _sqlite3ResolveSelfReference(tls, pParse, pTab, int32(NC_IdxExpr), (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr, uintptr(0)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto exit_create_index + } + pCExpr = _sqlite3ExprSkipCollate(tls, (*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr) + if int32((*TExpr)(unsafe.Pointer(pCExpr)).Fop) != int32(TK_COLUMN) { + if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14445, 0) + goto exit_create_index + } + if (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0) { + (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr = pList + pList = uintptr(0) + } + j = -int32(2) + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(-libc.Int32FromInt32(2)) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 3, 0x8) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 12, 0x1000) + } else { + j = int32((*TExpr)(unsafe.Pointer(pCExpr)).FiColumn) + if j < 0 { + j = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + } else { + if int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16 + 8))&0xf>>0)) == 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 3, 0x8) + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 11, 0x800) + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 12, 0x1000) + } + } + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(j) + } + zColl = uintptr(0) + if int32((*TExpr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr)).Fop) == int32(TK_COLLATE) { + zColl = *(*uintptr)(unsafe.Pointer((*TExprList_item)(unsafe.Pointer(pListItem)).FpExpr + 8)) + nColl = _sqlite3Strlen30(tls, zColl) + int32(1) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 104)), zColl, uint64(nColl)) + zColl = *(*uintptr)(unsafe.Pointer(bp + 104)) + *(*uintptr)(unsafe.Pointer(bp + 104)) += uintptr(nColl) + nExtra -= nColl + } else { + if j >= 0 { + zColl = _sqlite3ColumnColl(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) + } + } + if !(zColl != 0) { + zColl = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) && !(_sqlite3LocateCollSeq(tls, pParse, zColl) != 0) { + goto exit_create_index + } + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = zColl + requestedSortOrder = int32((*TExprList_item)(unsafe.Pointer(pListItem)).Ffg.FsortFlags) & sortOrderMask + *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = uint8(requestedSortOrder) + goto _6 + _6: + ; + i++ + pListItem += 32 + } + /* Append the table key to the end of the index. For WITHOUT ROWID + ** tables (when pPk!=0) this will be the declared PRIMARY KEY. For + ** normal tables (when pPk==0) this will be the rowid. + */ + if pPk != 0 { + j = 0 + for { + if !(j < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + x = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2))) + if _isDupColumn(tls, pIndex, int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol), pPk, j) != 0 { + (*TIndex)(unsafe.Pointer(pIndex)).FnColumn-- + } else { + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(x) + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) + *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(j))) + i++ + } + goto _7 + _7: + ; + j++ + } + } else { + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(-libc.Int32FromInt32(1)) + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + _sqlite3DefaultRowEst(tls, pIndex) + if (*TParse)(unsafe.Pointer(pParse)).FpNewTable == uintptr(0) { + _estimateIndexWidth(tls, pIndex) + } + /* If this index contains every column of its table, then mark + ** it as a covering index */ + _recomputeColumnsNotIndexed(tls, pIndex) + if pTblName != uintptr(0) && int32((*TIndex)(unsafe.Pointer(pIndex)).FnColumn) >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(1), 5, 0x20) + j = 0 + for { + if !(j < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if j == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + goto _8 + } + if int32(_sqlite3TableColumnToIndex(tls, pIndex, int16(j))) >= 0 { + goto _8 + } + libc.SetBitFieldPtr16Uint32(pIndex+100, libc.Uint32FromInt32(0), 5, 0x20) + break + goto _8 + _8: + ; + j++ + } + } + if pTab == (*TParse)(unsafe.Pointer(pParse)).FpNewTable { + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) != int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol) { + goto _9 + } + k = 0 + for { + if !(k < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(k)*2))) != int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(k)*2))) { + break + } + z1 = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(k)*8)) + z2 = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(k)*8)) + if _sqlite3StrICmp(tls, z1, z2) != 0 { + break + } + goto _10 + _10: + ; + k++ + } + if k == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { + if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) { + /* This constraint creates the same index as a previous + ** constraint specified somewhere in the CREATE TABLE statement. + ** However the ON CONFLICT clauses are different. If both this + ** constraint and the previous equivalent constraint have explicit + ** ON CONFLICT clauses this is an error. Otherwise, use the + ** explicitly specified behavior for the index. + */ + if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) || int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) == int32(OE_Default)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14506, libc.VaList(bp+136, 0)) + } + if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Default) { + (*TIndex)(unsafe.Pointer(pIdx)).FonError = (*TIndex)(unsafe.Pointer(pIndex)).FonError + } + } + if int32(idxType) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + libc.SetBitFieldPtr16Uint32(pIdx+100, uint32(idxType), 0, 0x3) + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TIndex)(unsafe.Pointer(pIndex)).FpNext = (*TParse)(unsafe.Pointer(pParse)).FpNewIndex + (*TParse)(unsafe.Pointer(pParse)).FpNewIndex = pIndex + pIndex = uintptr(0) + } + goto exit_create_index + } + goto _9 + _9: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + /* Link the new Index structure to its table and to the other + ** in-memory database structures. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + if pTblName != uintptr(0) { + (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum + if _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14548, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = _sqlite3CorruptError(tls, int32(125123)) + goto exit_create_index + } + } + p = _sqlite3HashInsert(tls, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema+32, (*TIndex)(unsafe.Pointer(pIndex)).FzName, pIndex) + if p != 0 { + /* Malloc must have failed */ + _sqlite3OomFault(tls, db) + goto exit_create_index + } + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) + } else { + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || pTblName != uintptr(0) { + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + iMem = v11 + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto exit_create_index + } + _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) + /* Create the rootpage for the index using CreateIndex. But before + ** doing so, code a Noop instruction and store its address in + ** Index.tnum. This is required in case this index is actually a + ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In + ** that case the convertToWithoutRowidTable() routine will replace + ** the Noop with a Goto to jump over the VDBE code generated below. */ + (*TIndex)(unsafe.Pointer(pIndex)).Ftnum = uint32(_sqlite3VdbeAddOp0(tls, v, int32(OP_Noop))) + _sqlite3VdbeAddOp3(tls, v, int32(OP_CreateBtree), iDb, iMem, int32(BTREE_BLOBKEY)) + /* Gather the complete text of the CREATE INDEX statement into + ** the zStmt variable + */ + if pStart != 0 { + n1 = int32(uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64((*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn) + if int32(*(*int8)(unsafe.Pointer((*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz + uintptr(n1-int32(1))))) == int32(';') { + n1-- + } + /* A named index with an explicit CREATE INDEX statement */ + if onError == OE_None { + v13 = __ccgo_ts + 1680 + } else { + v13 = __ccgo_ts + 14565 + } + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+14573, libc.VaList(bp+136, v13, n1, (*TToken)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)))).Fz)) + } else { + /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ + /* zStmt = sqlite3MPrintf(""); */ + zStmt = uintptr(0) + } + /* Add an entry in sqlite_schema for this index + */ + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14593, libc.VaList(bp+136, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, iMem, zStmt)) + _sqlite3DbFree(tls, db, zStmt) + /* Fill the index with data and reparse the schema. Code an OP_Expire + ** to invalidate all pre-compiled statements. + */ + if pTblName != 0 { + _sqlite3RefillIndex(tls, pParse, pIndex, iMem) + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+14652, libc.VaList(bp+136, (*TIndex)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Expire), 0, int32(1)) + } + _sqlite3VdbeJumpHere(tls, v, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum)) + } + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 || pTblName == uintptr(0) { + (*TIndex)(unsafe.Pointer(pIndex)).FpNext = (*TTable)(unsafe.Pointer(pTab)).FpIndex + (*TTable)(unsafe.Pointer(pTab)).FpIndex = pIndex + pIndex = uintptr(0) + } else { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TParse)(unsafe.Pointer(pParse)).FpNewIndex = pIndex + pIndex = uintptr(0) + } + } + /* Clean up before exiting */ +exit_create_index: + ; + if pIndex != 0 { + _sqlite3FreeIndex(tls, db, pIndex) + } + if pTab != 0 { + ppFrom = pTab + 16 + for { + v15 = *(*uintptr)(unsafe.Pointer(ppFrom)) + pThis = v15 + if !(v15 != uintptr(0)) { + break + } + if int32((*TIndex)(unsafe.Pointer(pThis)).FonError) != int32(OE_Replace) { + goto _14 + } + for { + v16 = (*TIndex)(unsafe.Pointer(pThis)).FpNext + pNext = v16 + if !(v16 != uintptr(0) && int32((*TIndex)(unsafe.Pointer(pNext)).FonError) != int32(OE_Replace)) { + break + } + *(*uintptr)(unsafe.Pointer(ppFrom)) = pNext + (*TIndex)(unsafe.Pointer(pThis)).FpNext = (*TIndex)(unsafe.Pointer(pNext)).FpNext + (*TIndex)(unsafe.Pointer(pNext)).FpNext = pThis + ppFrom = pNext + 40 + } + break + goto _14 + _14: + ; + ppFrom = pThis + 40 + } + } + _sqlite3ExprDelete(tls, db, pPIWhere) + _sqlite3ExprListDelete(tls, db, pList) + _sqlite3SrcListDelete(tls, db, pTblName) + _sqlite3DbFree(tls, db, zName) +} + +// C documentation +// +// /* +// ** Fill the Index.aiRowEst[] array with default information - information +// ** to be used when we have not run the ANALYZE command. +// ** +// ** aiRowEst[0] is supposed to contain the number of elements in the index. +// ** Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the +// ** number of rows in the table that match any particular value of the +// ** first column of the index. aiRowEst[2] is an estimate of the number +// ** of rows that match any particular combination of the first 2 columns +// ** of the index. And so forth. It must always be the case that +// * +// ** aiRowEst[N]<=aiRowEst[N-1] +// ** aiRowEst[N]>=1 +// ** +// ** Apart from that, we have little to go on besides intuition as to +// ** how aiRowEst[] should be initialized. The numbers generated here +// ** are based on typical values found in actual indices. +// */ +func _sqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { + var a uintptr + var i, nCopy, v1 int32 + var x, v2 TLogEst + _, _, _, _, _, _ = a, i, nCopy, x, v1, v2 + a = (*TIndex)(unsafe.Pointer(pIdx)).FaiRowLogEst + if int32(libc.Uint64FromInt64(10)/libc.Uint64FromInt64(2)) < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { + v1 = int32(libc.Uint64FromInt64(10) / libc.Uint64FromInt64(2)) + } else { + v1 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } + nCopy = v1 + /* Indexes with default row estimates should not have stat1 data */ + /* Set the first entry (number of rows in the index) to the estimated + ** number of rows in the table, or half the number of rows in the table + ** for a partial index. + ** + ** 2020-05-27: If some of the stat data is coming from the sqlite_stat1 + ** table but other parts we are having to guess at, then do not let the + ** estimated number of rows in the table be less than 1000 (LogEst 99). + ** Failure to do this can cause the indexes for which we do not have + ** stat1 data to be ignored by the query planner. + */ + x = (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FnRowLogEst + if int32(x) < int32(99) { + v2 = libc.Int16FromInt32(99) + x = v2 + (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FnRowLogEst = v2 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) { + x = TLogEst(int32(x) - libc.Int32FromInt32(10)) + } + *(*TLogEst)(unsafe.Pointer(a)) = x + /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is + ** 6 and each subsequent value (if any) is 5. */ + libc.Xmemcpy(tls, a+1*2, uintptr(unsafe.Pointer(&_aVal)), uint64(nCopy)*uint64(2)) + i = nCopy + int32(1) + for { + if !(i <= int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + *(*TLogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) + goto _3 + _3: + ; + i++ + } + if int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { + *(*TLogEst)(unsafe.Pointer(a + uintptr((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)*2)) = 0 + } +} + +/* 10, 9, 8, 7, 6 */ +var _aVal = [5]TLogEst{ + 0: int16(33), + 1: int16(32), + 2: int16(30), + 3: int16(28), + 4: int16(26), +} + +// C documentation +// +// /* +// ** This routine will drop an existing named index. This routine +// ** implements the DROP INDEX statement. +// */ +func _sqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var code, iDb int32 + var db, pIndex, pTab, v, zDb, zTab, v1 uintptr + _, _, _, _, _, _, _, _, _ = code, db, iDb, pIndex, pTab, v, zDb, zTab, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto exit_drop_index + } + /* Never called with prior non-OOM errors */ + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + goto exit_drop_index + } + pIndex = _sqlite3FindIndex(tls, db, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) + if pIndex == uintptr(0) { + if !(ifExists != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14679, libc.VaList(bp+8, pName+8)) + } else { + _sqlite3CodeVerifyNamedSchema(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase) + _sqlite3ForceNotReadOnly(tls, pParse) + } + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + goto exit_drop_index + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) != SQLITE_IDXTYPE_APPDEF { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14697, libc.VaList(bp+8, 0)) + goto exit_drop_index + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIndex)).FpSchema) + code = int32(SQLITE_DROP_INDEX) + pTab = (*TIndex)(unsafe.Pointer(pIndex)).FpTable + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v1 = __ccgo_ts + 6565 + } else { + v1 = __ccgo_ts + 6098 + } + zTab = v1 + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { + goto exit_drop_index + } + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + code = int32(SQLITE_DROP_TEMP_INDEX) + } + if _sqlite3AuthCheck(tls, pParse, code, (*TIndex)(unsafe.Pointer(pIndex)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zDb) != 0 { + goto exit_drop_index + } + /* Generate code to remove the index and from the schema table */ + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + _sqlite3BeginWriteOperation(tls, pParse, int32(1), iDb) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+14770, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TIndex)(unsafe.Pointer(pIndex)).FzName)) + _sqlite3ClearStatTables(tls, pParse, iDb, __ccgo_ts+11825, (*TIndex)(unsafe.Pointer(pIndex)).FzName) + _sqlite3ChangeCookie(tls, pParse, iDb) + _destroyRootPage(tls, pParse, int32((*TIndex)(unsafe.Pointer(pIndex)).Ftnum), iDb) + _sqlite3VdbeAddOp4(tls, v, int32(OP_DropIndex), iDb, 0, 0, (*TIndex)(unsafe.Pointer(pIndex)).FzName, 0) + } +exit_drop_index: + ; + _sqlite3SrcListDelete(tls, db, pName) +} + +// C documentation +// +// /* +// ** pArray is a pointer to an array of objects. Each object in the +// ** array is szEntry bytes in size. This routine uses sqlite3DbRealloc() +// ** to extend the array so that there is space for a new object at the end. +// ** +// ** When this function is called, *pnEntry contains the current size of +// ** the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes +// ** in total). +// ** +// ** If the realloc() is successful (i.e. if no OOM condition occurs), the +// ** space allocated for the new object is zeroed, *pnEntry updated to +// ** reflect the new size of the array and a pointer to the new allocation +// ** returned. *pIdx is set to the index of the new array entry in this case. +// ** +// ** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains +// ** unchanged and a copy of pArray returned. +// */ +func _sqlite3ArrayAllocate(tls *libc.TLS, db uintptr, pArray uintptr, szEntry int32, pnEntry uintptr, pIdx uintptr) (r uintptr) { + var n, sz Tsqlite3_int64 + var pNew, z uintptr + var v1 int32 + var v2 int64 + _, _, _, _, _, _ = n, pNew, sz, z, v1, v2 + v1 = *(*int32)(unsafe.Pointer(pnEntry)) + *(*int32)(unsafe.Pointer(pIdx)) = v1 + n = int64(v1) + if n&(n-int64(1)) == 0 { + if n == 0 { + v2 = int64(1) + } else { + v2 = int64(2) * n + } + sz = v2 + pNew = _sqlite3DbRealloc(tls, db, pArray, uint64(sz*int64(szEntry))) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(pIdx)) = -int32(1) + return pArray + } + pArray = pNew + } + z = pArray + libc.Xmemset(tls, z+uintptr(n*int64(szEntry)), 0, uint64(szEntry)) + *(*int32)(unsafe.Pointer(pnEntry))++ + return pArray +} + +// C documentation +// +// /* +// ** Append a new element to the given IdList. Create a new IdList if +// ** need be. +// ** +// ** A new IdList is returned, or NULL if malloc() fails. +// */ +func _sqlite3IdListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pToken uintptr) (r uintptr) { + var db, pNew, v2 uintptr + var i, v1 int32 + _, _, _, _, _ = db, i, pNew, v1, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pList == uintptr(0) { + pList = _sqlite3DbMallocZero(tls, db, uint64(24)) + if pList == uintptr(0) { + return uintptr(0) + } + } else { + pNew = _sqlite3DbRealloc(tls, db, pList, uint64(24)+uint64((*TIdList)(unsafe.Pointer(pList)).FnId)*uint64(16)) + if pNew == uintptr(0) { + _sqlite3IdListDelete(tls, db, pList) + return uintptr(0) + } + pList = pNew + } + v2 = pList + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + i = v1 + (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName = _sqlite3NameFromToken(tls, db, pToken) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName != 0 { + _sqlite3RenameTokenMap(tls, pParse, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName, pToken) + } + return pList +} + +// C documentation +// +// /* +// ** Delete an IdList. +// */ +func _sqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { + var i int32 + _ = i + if pList == uintptr(0) { + return + } + /* EU4_EXPR mode is not currently used */ + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pList)).FnId) { + break + } + _sqlite3DbFree(tls, db, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName) + goto _1 + _1: + ; + i++ + } + _sqlite3DbNNFreeNN(tls, db, pList) +} + +// C documentation +// +// /* +// ** Return the index in pList of the identifier named zId. Return -1 +// ** if not found. +// */ +func _sqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pList)).FnId) { + break + } + if _sqlite3StrICmp(tls, (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*16))).FzName, zName) == 0 { + return i + } + goto _1 + _1: + ; + i++ + } + return -int32(1) +} + +/* +** Maximum size of a SrcList object. +** The SrcList object is used to represent the FROM clause of a +** SELECT statement, and the query planner cannot deal with more +** than 64 tables in a join. So any value larger than 64 here +** is sufficient for most uses. Smaller values, like say 10, are +** appropriate for small and memory-limited applications. + */ + +// C documentation +// +// /* +// ** Expand the space allocated for the given SrcList object by +// ** creating nExtra new slots beginning at iStart. iStart is zero based. +// ** New slots are zeroed. +// ** +// ** For example, suppose a SrcList initially contains two entries: A,B. +// ** To append 3 new entries onto the end, do this: +// ** +// ** sqlite3SrcListEnlarge(db, pSrclist, 3, 2); +// ** +// ** After the call above it would contain: A, B, nil, nil, nil. +// ** If the iStart argument had been 1 instead of 2, then the result +// ** would have been: A, nil, nil, nil, B. To prepend the new slots, +// ** the iStart value would be 0. The result then would +// ** be: nil, nil, nil, A, B. +// ** +// ** If a memory allocation fails or the SrcList becomes too large, leave +// ** the original SrcList unchanged, return NULL, and leave an error message +// ** in pParse. +// */ +func _sqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra int32, iStart int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pNew uintptr + var i int32 + var nAlloc Tsqlite3_int64 + _, _, _, _ = db, i, nAlloc, pNew + /* Sanity checking on calling parameters */ + /* Allocate additional space if needed */ + if uint32((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc)+uint32(nExtra) > (*TSrcList)(unsafe.Pointer(pSrc)).FnAlloc { + nAlloc = int64(2)*int64((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) + int64(nExtra) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc+nExtra >= int32(SQLITE_MAX_SRCLIST) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14830, libc.VaList(bp+8, int32(SQLITE_MAX_SRCLIST))) + return uintptr(0) + } + if nAlloc > int64(SQLITE_MAX_SRCLIST) { + nAlloc = int64(SQLITE_MAX_SRCLIST) + } + pNew = _sqlite3DbRealloc(tls, db, pSrc, uint64(112)+uint64(nAlloc-libc.Int64FromInt32(1))*uint64(104)) + if pNew == uintptr(0) { + return uintptr(0) + } + pSrc = pNew + (*TSrcList)(unsafe.Pointer(pSrc)).FnAlloc = uint32(nAlloc) + } + /* Move existing slots that come after the newly inserted slots + ** out of the way */ + i = (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc - int32(1) + for { + if !(i >= iStart) { + break + } + *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i+nExtra)*104)) = *(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104)) + goto _1 + _1: + ; + i-- + } + *(*int32)(unsafe.Pointer(pSrc)) += nExtra + /* Zero the newly allocated slots */ + libc.Xmemset(tls, pSrc+8+uintptr(iStart)*104, 0, uint64(104)*uint64(nExtra)) + i = iStart + for { + if !(i < iStart+nExtra) { + break + } + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor = -int32(1) + goto _2 + _2: + ; + i++ + } + /* Return a pointer to the enlarged SrcList */ + return pSrc +} + +// C documentation +// +// /* +// ** Append a new table name to the given SrcList. Create a new SrcList if +// ** need be. A new entry is created in the SrcList even if pTable is NULL. +// ** +// ** A SrcList is returned, or NULL if there is an OOM error or if the +// ** SrcList grows to large. The returned +// ** SrcList might be the same as the SrcList that was input or it might be +// ** a new one. If an OOM error does occurs, then the prior value of pList +// ** that is input to this routine is automatically freed. +// ** +// ** If pDatabase is not null, it means that the table has an optional +// ** database name prefix. Like this: "database.table". The pDatabase +// ** points to the table name and the pTable points to the database name. +// ** The SrcList.a[].zName field is filled with the table name which might +// ** come from pTable (if pDatabase is NULL) or from pDatabase. +// ** SrcList.a[].zDatabase is filled with the database name from pTable, +// ** or with NULL if no database is specified. +// ** +// ** In other words, if call like this: +// ** +// ** sqlite3SrcListAppend(D,A,B,0); +// ** +// ** Then B is a table name and the database name is unspecified. If called +// ** like this: +// ** +// ** sqlite3SrcListAppend(D,A,B,C); +// ** +// ** Then C is the table name and B is the database name. If C is defined +// ** then so is B. In other words, we never have a case where: +// ** +// ** sqlite3SrcListAppend(D,A,0,C); +// ** +// ** Both pTable and pDatabase are assumed to be quoted. They are dequoted +// ** before being added to the SrcList. +// */ +func _sqlite3SrcListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pTable uintptr, pDatabase uintptr) (r uintptr) { + var db, pItem, pNew uintptr + _, _, _ = db, pItem, pNew + /* Cannot have C without B */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pList == uintptr(0) { + pList = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(112)) + if pList == uintptr(0) { + return uintptr(0) + } + (*TSrcList)(unsafe.Pointer(pList)).FnAlloc = uint32(1) + (*TSrcList)(unsafe.Pointer(pList)).FnSrc = int32(1) + libc.Xmemset(tls, pList+8, 0, uint64(104)) + (*(*TSrcItem)(unsafe.Pointer(pList + 8))).FiCursor = -int32(1) + } else { + pNew = _sqlite3SrcListEnlarge(tls, pParse, pList, int32(1), (*TSrcList)(unsafe.Pointer(pList)).FnSrc) + if pNew == uintptr(0) { + _sqlite3SrcListDelete(tls, db, pList) + return uintptr(0) + } else { + pList = pNew + } + } + pItem = pList + 8 + uintptr((*TSrcList)(unsafe.Pointer(pList)).FnSrc-int32(1))*104 + if pDatabase != 0 && (*TToken)(unsafe.Pointer(pDatabase)).Fz == uintptr(0) { + pDatabase = uintptr(0) + } + if pDatabase != 0 { + (*TSrcItem)(unsafe.Pointer(pItem)).FzName = _sqlite3NameFromToken(tls, db, pDatabase) + (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase = _sqlite3NameFromToken(tls, db, pTable) + } else { + (*TSrcItem)(unsafe.Pointer(pItem)).FzName = _sqlite3NameFromToken(tls, db, pTable) + (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase = uintptr(0) + } + return pList +} + +// C documentation +// +// /* +// ** Assign VdbeCursor index numbers to all tables in a SrcList +// */ +func _sqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) { + var i, v2 int32 + var pItem, v3 uintptr + _, _, _, _ = i, pItem, v2, v3 + if pList != 0 { + i = 0 + pItem = pList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pList)).FnSrc) { + break + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor >= 0 { + goto _1 + } + v3 = pParse + 52 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor = v2 + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 { + _sqlite3SrcListAssignCursors(tls, pParse, (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpSrc) + } + goto _1 + _1: + ; + i++ + pItem += 104 + } + } +} + +// C documentation +// +// /* +// ** Delete an entire SrcList including all its substructure. +// */ +func _sqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { + var i int32 + var pItem uintptr + _, _ = i, pItem + if pList == uintptr(0) { + return + } + pItem = pList + 8 + i = libc.Int32FromInt32(0) + for { + if !(i < (*TSrcList)(unsafe.Pointer(pList)).FnSrc) { + break + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase) + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzName) + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2>>1)) != 0 { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 88))) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x4>>2)) != 0 { + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 88))) + } + _sqlite3DeleteTable(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FpTab) + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 { + _sqlite3SelectDelete(tls, db, (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x400>>10)) != 0 { + _sqlite3IdListDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 72))) + } else { + if *(*uintptr)(unsafe.Pointer(pItem + 72)) != 0 { + _sqlite3ExprDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 72))) + } + } + goto _1 + _1: + ; + i++ + pItem += 104 + } + _sqlite3DbNNFreeNN(tls, db, pList) +} + +// C documentation +// +// /* +// ** This routine is called by the parser to add a new term to the +// ** end of a growing FROM clause. The "p" parameter is the part of +// ** the FROM clause that has already been constructed. "p" is NULL +// ** if this is the first term of the FROM clause. pTable and pDatabase +// ** are the name of the table and database named in the FROM clause term. +// ** pDatabase is NULL if the database name qualifier is missing - the +// ** usual case. If the term has an alias, then pAlias points to the +// ** alias token. If the term is a subquery, then pSubquery is the +// ** SELECT statement that the subquery encodes. The pTable and +// ** pDatabase parameters are NULL for subqueries. The pOn and pUsing +// ** parameters are the content of the ON and USING clauses. +// ** +// ** Return a new SrcList which encodes is the FROM with the new +// ** term added. +// */ +func _sqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTable uintptr, pDatabase uintptr, pAlias uintptr, pSubquery uintptr, pOnUsing uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pItem, pToken, v1, v2 uintptr + _, _, _, _, _ = db, pItem, pToken, v1, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if !(p != 0) && pOnUsing != uintptr(0) && ((*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 || (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0) { + if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn != 0 { + v1 = __ccgo_ts + 14866 + } else { + v1 = __ccgo_ts + 14869 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14875, libc.VaList(bp+8, v1)) + goto append_from_error + } + p = _sqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) + if p == uintptr(0) { + goto append_from_error + } + pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TSrcItem)(unsafe.Pointer(pItem)).FzName != 0 { + if pDatabase != 0 && (*TToken)(unsafe.Pointer(pDatabase)).Fz != 0 { + v2 = pDatabase + } else { + v2 = pTable + } + pToken = v2 + _sqlite3RenameTokenMap(tls, pParse, (*TSrcItem)(unsafe.Pointer(pItem)).FzName, pToken) + } + if (*TToken)(unsafe.Pointer(pAlias)).Fn != 0 { + (*TSrcItem)(unsafe.Pointer(pItem)).FzAlias = _sqlite3NameFromToken(tls, db, pAlias) + } + if pSubquery != 0 { + (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect = pSubquery + if (*TSelect)(unsafe.Pointer(pSubquery)).FselFlags&uint32(SF_NestedFrom) != 0 { + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 13, 0x2000) + } + } + if pOnUsing == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pItem + 72)) = uintptr(0) + } else { + if (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing != 0 { + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 10, 0x400) + *(*uintptr)(unsafe.Pointer(pItem + 72)) = (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpUsing + } else { + *(*uintptr)(unsafe.Pointer(pItem + 72)) = (*TOnOrUsing)(unsafe.Pointer(pOnUsing)).FpOn + } + } + return p +append_from_error: + ; + _sqlite3ClearOnOrUsing(tls, db, pOnUsing) + _sqlite3SelectDelete(tls, db, pSubquery) + return uintptr(0) +} + +// C documentation +// +// /* +// ** Add an INDEXED BY or NOT INDEXED clause to the most recently added +// ** element of the source-list passed as the second argument. +// */ +func _sqlite3SrcListIndexedBy(tls *libc.TLS, pParse uintptr, p uintptr, pIndexedBy uintptr) { + var pItem uintptr + _ = pItem + if p != 0 && (*TToken)(unsafe.Pointer(pIndexedBy)).Fn > uint32(0) { + pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 + if (*TToken)(unsafe.Pointer(pIndexedBy)).Fn == uint32(1) && !((*TToken)(unsafe.Pointer(pIndexedBy)).Fz != 0) { + /* A "NOT INDEXED" clause was supplied. See parse.y + ** construct "indexed_opt" for details. */ + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 0, 0x1) + } else { + *(*uintptr)(unsafe.Pointer(pItem + 88)) = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIndexedBy) + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 1, 0x2) + /* No collision on union u2 */ + } + } +} + +// C documentation +// +// /* +// ** Append the contents of SrcList p2 to SrcList p1 and return the resulting +// ** SrcList. Or, if an error occurs, return NULL. In all cases, p1 and p2 +// ** are deleted by this function. +// */ +func _sqlite3SrcListAppendList(tls *libc.TLS, pParse uintptr, p1 uintptr, p2 uintptr) (r uintptr) { + var pNew, p11 uintptr + _, _ = pNew, p11 + if p2 != 0 { + pNew = _sqlite3SrcListEnlarge(tls, pParse, p1, (*TSrcList)(unsafe.Pointer(p2)).FnSrc, int32(1)) + if pNew == uintptr(0) { + _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p2) + } else { + p1 = pNew + libc.Xmemcpy(tls, p1+8+1*104, p2+8, uint64((*TSrcList)(unsafe.Pointer(p2)).FnSrc)*uint64(104)) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p2) + p11 = p1 + 8 + 60 + *(*Tu8)(unsafe.Pointer(p11)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p11))) | libc.Int32FromInt32(JT_LTORJ)&int32((*(*TSrcItem)(unsafe.Pointer(p1 + 8 + 1*104))).Ffg.Fjointype)) + } + } + return p1 +} + +// C documentation +// +// /* +// ** Add the list of function arguments to the SrcList entry for a +// ** table-valued-function. +// */ +func _sqlite3SrcListFuncArgs(tls *libc.TLS, pParse uintptr, p uintptr, pList uintptr) { + var pItem uintptr + _ = pItem + if p != 0 { + pItem = p + 8 + uintptr((*TSrcList)(unsafe.Pointer(p)).FnSrc-int32(1))*104 + *(*uintptr)(unsafe.Pointer(pItem + 88)) = pList + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 2, 0x4) + } else { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) + } +} + +// C documentation +// +// /* +// ** When building up a FROM clause in the parser, the join operator +// ** is initially attached to the left operand. But the code generator +// ** expects the join operator to be on the right operand. This routine +// ** Shifts all join operators from left to right for an entire FROM +// ** clause. +// ** +// ** Example: Suppose the join is like this: +// ** +// ** A natural cross join B +// ** +// ** The operator is "natural cross join". The A and B operands are stored +// ** in p->a[0] and p->a[1], respectively. The parser initially stores the +// ** operator with A. This routine shifts that operator over to B. +// ** +// ** Additional changes: +// ** +// ** * All tables to the left of the right-most RIGHT JOIN are tagged with +// ** JT_LTORJ (mnemonic: Left Table Of Right Join) so that the +// ** code generator can easily tell that the table is part of +// ** the left operand of at least one RIGHT JOIN. +// */ +func _sqlite3SrcListShiftJoinType(tls *libc.TLS, pParse uintptr, p uintptr) { + var allFlags, v3 Tu8 + var i, v1, v5 int32 + var p7 uintptr + _, _, _, _, _, _ = allFlags, i, v1, v3, v5, p7 + _ = pParse + if p != 0 && (*TSrcList)(unsafe.Pointer(p)).FnSrc > int32(1) { + i = (*TSrcList)(unsafe.Pointer(p)).FnSrc - int32(1) + allFlags = uint8(0) + for { + v3 = (*(*TSrcItem)(unsafe.Pointer(p + 8 + uintptr(i-int32(1))*104))).Ffg.Fjointype + (*(*TSrcItem)(unsafe.Pointer(p + 8 + uintptr(i)*104))).Ffg.Fjointype = v3 + allFlags = Tu8(int32(allFlags) | int32(v3)) + goto _2 + _2: + ; + i-- + v1 = i + if !(v1 > 0) { + break + } + } + (*(*TSrcItem)(unsafe.Pointer(p + 8))).Ffg.Fjointype = uint8(0) + /* All terms to the left of a RIGHT JOIN should be tagged with the + ** JT_LTORJ flags */ + if int32(allFlags)&int32(JT_RIGHT) != 0 { + i = (*TSrcList)(unsafe.Pointer(p)).FnSrc - int32(1) + for { + if !(i > 0 && int32((*(*TSrcItem)(unsafe.Pointer(p + 8 + uintptr(i)*104))).Ffg.Fjointype)&int32(JT_RIGHT) == 0) { + break + } + goto _4 + _4: + ; + i-- + } + i-- + for { + p7 = p + 8 + uintptr(i)*104 + 60 + *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) | libc.Int32FromInt32(JT_LTORJ)) + goto _6 + _6: + ; + i-- + v5 = i + if !(v5 >= 0) { + break + } + } + } + } +} + +// C documentation +// +// /* +// ** Generate VDBE code for a BEGIN statement. +// */ +func _sqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { + var db, pBt, v uintptr + var eTxnType, i int32 + _, _, _, _, _ = db, eTxnType, i, pBt, v + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), __ccgo_ts+14911, uintptr(0), uintptr(0)) != 0 { + return + } + v = _sqlite3GetVdbe(tls, pParse) + if !(v != 0) { + return + } + if type1 != int32(TK_DEFERRED) { + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 && _sqlite3BtreeIsReadonly(tls, pBt) != 0 { + eTxnType = 0 /* Read txn */ + } else { + if type1 == int32(TK_EXCLUSIVE) { + eTxnType = int32(2) /* Exclusive txn */ + } else { + eTxnType = int32(1) /* Write txn */ + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Transaction), i, eTxnType) + _sqlite3VdbeUsesBtree(tls, v, i) + goto _1 + _1: + ; + i++ + } + } + _sqlite3VdbeAddOp0(tls, v, int32(OP_AutoCommit)) +} + +// C documentation +// +// /* +// ** Generate VDBE code for a COMMIT or ROLLBACK statement. +// ** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise +// ** code is generated for a COMMIT. +// */ +func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { + var isRollback int32 + var v, v1 uintptr + _, _, _ = isRollback, v, v1 + isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) + if isRollback != 0 { + v1 = __ccgo_ts + 14917 + } else { + v1 = __ccgo_ts + 14926 + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { + return + } + v = _sqlite3GetVdbe(tls, pParse) + if v != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AutoCommit), int32(1), isRollback) + } +} + +// C documentation +// +// /* +// ** This function is called by the parser when it parses a command to create, +// ** release or rollback an SQL savepoint. +// */ +func _sqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { + var v, zName uintptr + _, _ = v, zName + zName = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pName) + if zName != 0 { + v = _sqlite3GetVdbe(tls, pParse) + if !(v != 0) || _sqlite3AuthCheck(tls, pParse, int32(SQLITE_SAVEPOINT), _az[op], zName, uintptr(0)) != 0 { + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zName) + return + } + _sqlite3VdbeAddOp4(tls, v, OP_Savepoint, op, 0, 0, zName, -int32(6)) + } +} + +var _az = [3]uintptr{ + 0: __ccgo_ts + 14911, + 1: __ccgo_ts + 14933, + 2: __ccgo_ts + 14917, +} + +// C documentation +// +// /* +// ** Make sure the TEMP database is open and available for use. Return +// ** the number of errors. Leave any error messages in the pParse structure. +// */ +func _sqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db uintptr + var rc int32 + var _ /* pBt at bp+0 */ uintptr + _, _ = db, rc + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt == uintptr(0) && !((*TParse)(unsafe.Pointer(pParse)).Fexplain != 0) { + rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp, 0, _flags) + if rc != SQLITE_OK { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14941, 0) + (*TParse)(unsafe.Pointer(pParse)).Frc = rc + return int32(1) + } + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt = *(*uintptr)(unsafe.Pointer(bp)) + if int32(SQLITE_NOMEM) == _sqlite3BtreeSetPageSize(tls, *(*uintptr)(unsafe.Pointer(bp)), (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize, 0, 0) { + _sqlite3OomFault(tls, db) + return int32(1) + } + } + return 0 +} + +var _flags = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) | libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) + +// C documentation +// +// /* +// ** Record the fact that the schema cookie will need to be verified +// ** for database iDb. The code to actually verify the schema cookie +// ** will occur at the end of the top-level VDBE and will be generated +// ** later, by sqlite3FinishCoding(). +// */ +func _sqlite3CodeVerifySchemaAtToplevel(tls *libc.TLS, pToplevel uintptr, iDb int32) { + if libc.BoolInt32((*TParse)(unsafe.Pointer(pToplevel)).FcookieMask&(libc.Uint32FromInt32(1)<>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + v2 = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)<= 0 { + zMsg = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+12413, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + rc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(6)<= 0 && 0 == _sqlite3StrICmp(tls, z, zColl) { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Recompute all indices of pTab that use the collating sequence pColl. +// ** If pColl==0 then recompute all indices of pTab. +// */ +func _reindexTable(tls *libc.TLS, pParse uintptr, pTab uintptr, zColl uintptr) { + var iDb int32 + var pIndex uintptr + _, _ = iDb, pIndex + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { /* An index associated with pTab */ + pIndex = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIndex != 0) { + break + } + if zColl == uintptr(0) || _collationMatch(tls, zColl, pIndex) != 0 { + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + _sqlite3RefillIndex(tls, pParse, pIndex, -int32(1)) + } + goto _1 + _1: + ; + pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext + } + } +} + +// C documentation +// +// /* +// ** Recompute all indices of all tables in all databases where the +// ** indices use the collating sequence pColl. If pColl==0 then recompute +// ** all indices everywhere. +// */ +func _reindexDatabases(tls *libc.TLS, pParse uintptr, zColl uintptr) { + var db, k, pDb, pTab uintptr + var iDb int32 + _, _, _, _, _ = db, iDb, k, pDb, pTab /* The database index number */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* A table in the database */ + /* Needed for schema access */ + iDb = 0 + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + for { + if !(iDb < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + k = (*THash)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema + 8)).Ffirst + for { + if !(k != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(k)).Fdata + _reindexTable(tls, pParse, pTab, zColl) + goto _2 + _2: + ; + k = (*THashElem)(unsafe.Pointer(k)).Fnext + } + goto _1 + _1: + ; + iDb++ + pDb += 32 + } +} + +// C documentation +// +// /* +// ** Generate code for the REINDEX command. +// ** +// ** REINDEX -- 1 +// ** REINDEX -- 2 +// ** REINDEX ?.? -- 3 +// ** REINDEX ?.? -- 4 +// ** +// ** Form 1 causes all indices in all attached databases to be rebuilt. +// ** Form 2 rebuilds all indices in all databases that use the named +// ** collating function. Forms 3 and 4 rebuild the named index or all +// ** indices associated with the named table. +// */ +func _sqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pColl, pIndex, pTab, z, zColl, zDb, v1 uintptr + var iDb int32 + var _ /* pObjName at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = db, iDb, pColl, pIndex, pTab, z, zColl, zDb, v1 /* The database index number */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Name of the table or index to be reindexed */ + /* Read the database schema. If an error occurs, leave an error message + ** and code in pParse and return NULL. */ + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + return + } + if pName1 == uintptr(0) { + _reindexDatabases(tls, pParse, uintptr(0)) + return + } else { + if pName2 == uintptr(0) || (*TToken)(unsafe.Pointer(pName2)).Fz == uintptr(0) { + zColl = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pName1) + if !(zColl != 0) { + return + } + pColl = _sqlite3FindCollSeq(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, zColl, 0) + if pColl != 0 { + _reindexDatabases(tls, pParse, zColl) + _sqlite3DbFree(tls, db, zColl) + return + } + _sqlite3DbFree(tls, db, zColl) + } + } + iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp) + if iDb < 0 { + return + } + z = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + if z == uintptr(0) { + return + } + if (*TToken)(unsafe.Pointer(pName2)).Fn != 0 { + v1 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + } else { + v1 = uintptr(0) + } + zDb = v1 + pTab = _sqlite3FindTable(tls, db, z, zDb) + if pTab != 0 { + _reindexTable(tls, pParse, pTab, uintptr(0)) + _sqlite3DbFree(tls, db, z) + return + } + pIndex = _sqlite3FindIndex(tls, db, z, zDb) + _sqlite3DbFree(tls, db, z) + if pIndex != 0 { + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FpSchema) + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + _sqlite3RefillIndex(tls, pParse, pIndex, -int32(1)) + return + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15034, 0) +} + +// C documentation +// +// /* +// ** Return a KeyInfo structure that is appropriate for the given Index. +// ** +// ** The caller should invoke sqlite3KeyInfoUnref() on the returned object +// ** when it has finished using it. +// */ +func _sqlite3KeyInfoOfIndex(tls *libc.TLS, pParse uintptr, pIdx uintptr) (r uintptr) { + var i, nCol, nKey int32 + var pKey, zColl, v2 uintptr + _, _, _, _, _, _ = i, nCol, nKey, pKey, zColl, v2 + nCol = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + nKey = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return uintptr(0) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + pKey = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, nKey, nCol-nKey) + } else { + pKey = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, nCol, 0) + } + if pKey != 0 { + i = 0 + for { + if !(i < nCol) { + break + } + zColl = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)) + if zColl == uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) { + v2 = uintptr(0) + } else { + v2 = _sqlite3LocateCollSeq(tls, pParse, zColl) + } + *(*uintptr)(unsafe.Pointer(pKey + 32 + uintptr(i)*8)) = v2 + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKey)).FaSortFlags + uintptr(i))) = *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i))) + goto _1 + _1: + ; + i++ + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x200>>9)) == 0 { + /* Deactivate the index because it contains an unknown collating + ** sequence. The only way to reactive the index is to reload the + ** schema. Adding the missing collating sequence later does not + ** reactive the index. The application had the chance to register + ** the missing index using the collation-needed callback. For + ** simplicity, SQLite will not give the application a second chance. + */ + libc.SetBitFieldPtr16Uint32(pIdx+100, libc.Uint32FromInt32(1), 9, 0x200) + (*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(2)< UTF-16 conversion if +// ** possible. +// */ +func _synthCollSeq(tls *libc.TLS, db uintptr, pColl uintptr) (r int32) { + var i int32 + var pColl2, z uintptr + _, _, _ = i, pColl2, z + z = (*TCollSeq)(unsafe.Pointer(pColl)).FzName + i = 0 + for { + if !(i < int32(3)) { + break + } + pColl2 = _sqlite3FindCollSeq(tls, db, _aEnc[i], z, 0) + if (*TCollSeq)(unsafe.Pointer(pColl2)).FxCmp != uintptr(0) { + libc.Xmemcpy(tls, pColl, pColl2, uint64(40)) + (*TCollSeq)(unsafe.Pointer(pColl)).FxDel = uintptr(0) /* Do not copy the destructor */ + return SQLITE_OK + } + goto _1 + _1: + ; + i++ + } + return int32(SQLITE_ERROR) +} + +var _aEnc = [3]Tu8{ + 0: uint8(SQLITE_UTF16BE), + 1: uint8(SQLITE_UTF16LE), + 2: uint8(SQLITE_UTF8), +} + +// C documentation +// +// /* +// ** This routine is called on a collation sequence before it is used to +// ** check that it is defined. An undefined collation sequence exists when +// ** a database is loaded that contains references to collation sequences +// ** that have not been defined by sqlite3_create_collation() etc. +// ** +// ** If required, this routine calls the 'collation needed' callback to +// ** request a definition of the collating sequence. If this doesn't work, +// ** an equivalent collating sequence that uses a text encoding different +// ** from the main database is substituted, if one is available. +// */ +func _sqlite3CheckCollSeq(tls *libc.TLS, pParse uintptr, pColl uintptr) (r int32) { + var db, p, zName uintptr + _, _, _ = db, p, zName + if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp == uintptr(0) { + zName = (*TCollSeq)(unsafe.Pointer(pColl)).FzName + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = _sqlite3GetCollSeq(tls, pParse, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, pColl, zName) + if !(p != 0) { + return int32(SQLITE_ERROR) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Locate and return an entry from the db.aCollSeq hash table. If the entry +// ** specified by zName and nName is not found and parameter 'create' is +// ** true, then create a new entry. Otherwise return NULL. +// ** +// ** Each pointer stored in the sqlite3.aCollSeq hash table contains an +// ** array of three CollSeq structures. The first is the collation sequence +// ** preferred for UTF-8, the second UTF-16le, and the third UTF-16be. +// ** +// ** Stored immediately after the three collation sequences is a copy of +// ** the collation sequence name. A pointer to this string is stored in +// ** each collation sequence structure. +// */ +func _findCollSeqEntry(tls *libc.TLS, db uintptr, zName uintptr, create int32) (r uintptr) { + var nName int32 + var pColl, pDel uintptr + _, _, _ = nName, pColl, pDel + pColl = _sqlite3HashFind(tls, db+648, zName) + if uintptr(0) == pColl && create != 0 { + nName = _sqlite3Strlen30(tls, zName) + int32(1) + pColl = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt32(3)*libc.Uint64FromInt64(40)+uint64(nName)) + if pColl != 0 { + pDel = uintptr(0) + (*(*TCollSeq)(unsafe.Pointer(pColl))).FzName = pColl + 3*40 + (*(*TCollSeq)(unsafe.Pointer(pColl))).Fenc = uint8(SQLITE_UTF8) + (*(*TCollSeq)(unsafe.Pointer(pColl + 1*40))).FzName = pColl + 3*40 + (*(*TCollSeq)(unsafe.Pointer(pColl + 1*40))).Fenc = uint8(SQLITE_UTF16LE) + (*(*TCollSeq)(unsafe.Pointer(pColl + 2*40))).FzName = pColl + 3*40 + (*(*TCollSeq)(unsafe.Pointer(pColl + 2*40))).Fenc = uint8(SQLITE_UTF16BE) + libc.Xmemcpy(tls, (*(*TCollSeq)(unsafe.Pointer(pColl))).FzName, zName, uint64(nName)) + pDel = _sqlite3HashInsert(tls, db+648, (*(*TCollSeq)(unsafe.Pointer(pColl))).FzName, pColl) + /* If a malloc() failure occurred in sqlite3HashInsert(), it will + ** return the pColl pointer to be deleted (because it wasn't added + ** to the hash table). + */ + if pDel != uintptr(0) { + _sqlite3OomFault(tls, db) + _sqlite3DbFree(tls, db, pDel) + pColl = uintptr(0) + } + } + } + return pColl +} + +// C documentation +// +// /* +// ** Parameter zName points to a UTF-8 encoded string nName bytes long. +// ** Return the CollSeq* pointer for the collation sequence named zName +// ** for the encoding 'enc' from the database 'db'. +// ** +// ** If the entry specified is not found and 'create' is true, then create a +// ** new entry. Otherwise return NULL. +// ** +// ** A separate function sqlite3LocateCollSeq() is a wrapper around +// ** this routine. sqlite3LocateCollSeq() invokes the collation factory +// ** if necessary and generates an error message if the collating sequence +// ** cannot be found. +// ** +// ** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq() +// */ +func _sqlite3FindCollSeq(tls *libc.TLS, db uintptr, enc Tu8, zName uintptr, create int32) (r uintptr) { + var pColl uintptr + _ = pColl + if zName != 0 { + pColl = _findCollSeqEntry(tls, db, zName, create) + if pColl != 0 { + pColl += uintptr(int32(enc)-int32(1)) * 40 + } + } else { + pColl = (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl + } + return pColl +} + +// C documentation +// +// /* +// ** Change the text encoding for a database connection. This means that +// ** the pDfltColl must change as well. +// */ +func _sqlite3SetTextEncoding(tls *libc.TLS, db uintptr, enc Tu8) { + (*Tsqlite3)(unsafe.Pointer(db)).Fenc = enc + /* EVIDENCE-OF: R-08308-17224 The default collating function for all + ** strings is BINARY. + */ + (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl = _sqlite3FindCollSeq(tls, db, enc, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), 0) + _sqlite3ExpirePreparedStatements(tls, db, int32(1)) +} + +// C documentation +// +// /* +// ** This function is responsible for invoking the collation factory callback +// ** or substituting a collation sequence of a different encoding when the +// ** requested collation sequence is not available in the desired encoding. +// ** +// ** If it is not NULL, then pColl must point to the database native encoding +// ** collation sequence with name zName, length nName. +// ** +// ** The return value is either the collation sequence to be used in database +// ** db for collation type name zName, length nName, or NULL, if no collation +// ** sequence can be found. If no collation is found, leave an error message. +// ** +// ** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() +// */ +func _sqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc Tu8, pColl uintptr, zName uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, p uintptr + _, _ = db, p + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = pColl + if !(p != 0) { + p = _sqlite3FindCollSeq(tls, db, enc, zName, 0) + } + if !(p != 0) || !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) { + /* No collation sequence of this type for this encoding is registered. + ** Call the collation factory to see if it can supply us with one. + */ + _callCollNeeded(tls, db, int32(enc), zName) + p = _sqlite3FindCollSeq(tls, db, enc, zName, 0) + } + if p != 0 && !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) && _synthCollSeq(tls, db, p) != 0 { + p = uintptr(0) + } + if p == uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15110, libc.VaList(bp+8, zName)) + (*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(1)<nArg +// ** is also -1. In other words, we are searching for a function that +// ** takes a variable number of arguments. +// ** +// ** If nArg is -2 that means that we are searching for any function +// ** regardless of the number of arguments it uses, so return a positive +// ** match score for any +// ** +// ** The returned value is always between 0 and 6, as follows: +// ** +// ** 0: Not a match. +// ** 1: UTF8/16 conversion required and function takes any number of arguments. +// ** 2: UTF16 byte order change required and function takes any number of args. +// ** 3: encoding matches and function takes any number of arguments +// ** 4: UTF8/16 conversion required - argument count matches exactly +// ** 5: UTF16 byte order conversion required - argument count matches exactly +// ** 6: Perfect match: encoding and argument count match exactly. +// ** +// ** If nArg==(-2) then any function with a non-null xSFunc is +// ** a perfect match and any function with xSFunc NULL is +// ** a non-match. +// */ +func _matchQuality(tls *libc.TLS, p uintptr, nArg int32, enc Tu8) (r int32) { + var match, v1 int32 + _, _ = match, v1 + /* Wrong number of arguments means "no match" */ + if int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) != nArg { + if nArg == -int32(2) { + if (*TFuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { + v1 = 0 + } else { + v1 = int32(FUNC_PERFECT_MATCH) + } + return v1 + } + if int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) >= 0 { + return 0 + } + } + /* Give a better score to a function with a specific number of arguments + ** than to function that accepts any number of arguments. */ + if int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { + match = int32(4) + } else { + match = int32(1) + } + /* Bonus points if the text encoding matches */ + if uint32(enc) == (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) { + match += int32(2) /* Exact encoding match */ + } else { + if uint32(enc)&(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(2) != uint32(0) { + match += int32(1) /* Both are UTF16, but with different byte orders */ + } + } + return match +} + +// C documentation +// +// /* +// ** Search a FuncDefHash for a function with the given name. Return +// ** a pointer to the matching FuncDef if found, or 0 if there is no match. +// */ +func _sqlite3FunctionSearch(tls *libc.TLS, h int32, zFunc uintptr) (r uintptr) { + var p uintptr + _ = p + p = *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3BuiltinFunctions)) + uintptr(h)*8)) + for { + if !(p != 0) { + break + } + if _sqlite3StrICmp(tls, (*TFuncDef)(unsafe.Pointer(p)).FzName, zFunc) == 0 { + return p + } + goto _1 + _1: + ; + p = *(*uintptr)(unsafe.Pointer(p + 64)) + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Insert a new FuncDef into a FuncDefHash hash table. +// */ +func _sqlite3InsertBuiltinFuncs(tls *libc.TLS, aDef uintptr, nDef int32) { + var h, i, nName int32 + var pOther, zName uintptr + _, _, _, _, _ = h, i, nName, pOther, zName + i = 0 + for { + if !(i < nDef) { + break + } + zName = (*(*TFuncDef)(unsafe.Pointer(aDef + uintptr(i)*72))).FzName + nName = _sqlite3Strlen30(tls, zName) + h = (int32(*(*int8)(unsafe.Pointer(zName))) + nName) % int32(SQLITE_FUNC_HASH_SZ) + pOther = _sqlite3FunctionSearch(tls, h, zName) + if pOther != 0 { + (*(*TFuncDef)(unsafe.Pointer(aDef + uintptr(i)*72))).FpNext = (*TFuncDef)(unsafe.Pointer(pOther)).FpNext + (*TFuncDef)(unsafe.Pointer(pOther)).FpNext = aDef + uintptr(i)*72 + } else { + (*(*TFuncDef)(unsafe.Pointer(aDef + uintptr(i)*72))).FpNext = uintptr(0) + *(*uintptr)(unsafe.Pointer(aDef + uintptr(i)*72 + 64)) = *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3BuiltinFunctions)) + uintptr(h)*8)) + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3BuiltinFunctions)) + uintptr(h)*8)) = aDef + uintptr(i)*72 + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Locate a user function given a name, a number of arguments and a flag +// ** indicating whether the function prefers UTF-16 over UTF-8. Return a +// ** pointer to the FuncDef structure that defines that function, or return +// ** NULL if the function does not exist. +// ** +// ** If the createFlag argument is true, then a new (blank) FuncDef +// ** structure is created and liked into the "db" structure if a +// ** no matching function previously existed. +// ** +// ** If nArg is -2, then the first valid function found is returned. A +// ** function is valid if xSFunc is non-zero. The nArg==(-2) +// ** case is used to see if zName is a valid function name for some number +// ** of arguments. If nArg is -2, then createFlag must be 0. +// ** +// ** If createFlag is false, then a function with the required name and +// ** number of arguments may be returned even if the eTextRep flag does not +// ** match that requested. +// */ +func _sqlite3FindFunction(tls *libc.TLS, db uintptr, zName uintptr, nArg int32, enc Tu8, createFlag Tu8) (r uintptr) { + var bestScore, h, nName, score, score1 int32 + var p, pBest, pOther, z, v1 uintptr + var v2 bool + _, _, _, _, _, _, _, _, _, _, _ = bestScore, h, nName, p, pBest, pOther, score, score1, z, v1, v2 /* Iterator variable */ + pBest = uintptr(0) /* Best match found so far */ + bestScore = 0 /* Length of the name */ + nName = _sqlite3Strlen30(tls, zName) + /* First search for a match amongst the application-defined functions. + */ + p = _sqlite3HashFind(tls, db+624, zName) + for p != 0 { + score = _matchQuality(tls, p, nArg, enc) + if score > bestScore { + pBest = p + bestScore = score + } + p = (*TFuncDef)(unsafe.Pointer(p)).FpNext + } + /* If no match is found, search the built-in functions. + ** + ** If the DBFLAG_PreferBuiltin flag is set, then search the built-in + ** functions even if a prior app-defined function was found. And give + ** priority to built-in functions. + ** + ** Except, if createFlag is true, that means that we are trying to + ** install a new function. Whatever FuncDef structure is returned it will + ** have fields overwritten with new information appropriate for the + ** new function. But the FuncDefs for built-in functions are read-only. + ** So we must not search for built-ins when creating a new function. + */ + if !(createFlag != 0) && (pBest == uintptr(0) || (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_PreferBuiltin) != uint32(0)) { + bestScore = 0 + h = (int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zName)))]) + nName) % int32(SQLITE_FUNC_HASH_SZ) + p = _sqlite3FunctionSearch(tls, h, zName) + for p != 0 { + score1 = _matchQuality(tls, p, nArg, enc) + if score1 > bestScore { + pBest = p + bestScore = score1 + } + p = (*TFuncDef)(unsafe.Pointer(p)).FpNext + } + } + /* If the createFlag parameter is true and the search did not reveal an + ** exact match for the name, number of arguments and encoding, then add a + ** new entry to the hash table and return it. + */ + if v2 = createFlag != 0 && bestScore < int32(FUNC_PERFECT_MATCH); v2 { + v1 = _sqlite3DbMallocZero(tls, db, uint64(72)+uint64(nName)+uint64(1)) + pBest = v1 + } + if v2 && v1 != uintptr(0) { + (*TFuncDef)(unsafe.Pointer(pBest)).FzName = pBest + 1*72 + (*TFuncDef)(unsafe.Pointer(pBest)).FnArg = int8(uint16(nArg)) + (*TFuncDef)(unsafe.Pointer(pBest)).FfuncFlags = uint32(enc) + libc.Xmemcpy(tls, pBest+1*72, zName, uint64(nName+int32(1))) + z = (*TFuncDef)(unsafe.Pointer(pBest)).FzName + for { + if !(*(*Tu8)(unsafe.Pointer(z)) != 0) { + break + } + *(*Tu8)(unsafe.Pointer(z)) = _sqlite3UpperToLower[*(*Tu8)(unsafe.Pointer(z))] + goto _3 + _3: + ; + z++ + } + pOther = _sqlite3HashInsert(tls, db+624, (*TFuncDef)(unsafe.Pointer(pBest)).FzName, pBest) + if pOther == pBest { + _sqlite3DbFree(tls, db, pBest) + _sqlite3OomFault(tls, db) + return uintptr(0) + } else { + (*TFuncDef)(unsafe.Pointer(pBest)).FpNext = pOther + } + } + if pBest != 0 && ((*TFuncDef)(unsafe.Pointer(pBest)).FxSFunc != 0 || createFlag != 0) { + return pBest + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Free all resources held by the schema structure. The void* argument points +// ** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the +// ** pointer itself, it just cleans up subsidiary resources (i.e. the contents +// ** of the schema hash tables). +// ** +// ** The Schema.cache_size variable is not cleared. +// */ +func _sqlite3SchemaClear(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(912) + defer tls.Free(912) + var pElem, pSchema, pTab, p3 uintptr + var _ /* temp1 at bp+0 */ THash + var _ /* temp2 at bp+24 */ THash + var _ /* xdb at bp+48 */ Tsqlite3 + _, _, _, _ = pElem, pSchema, pTab, p3 + pSchema = p + libc.Xmemset(tls, bp+48, 0, uint64(856)) + *(*THash)(unsafe.Pointer(bp)) = (*TSchema)(unsafe.Pointer(pSchema)).FtblHash + *(*THash)(unsafe.Pointer(bp + 24)) = (*TSchema)(unsafe.Pointer(pSchema)).FtrigHash + _sqlite3HashInit(tls, pSchema+56) + _sqlite3HashClear(tls, pSchema+32) + pElem = (*THash)(unsafe.Pointer(bp + 24)).Ffirst + for { + if !(pElem != 0) { + break + } + _sqlite3DeleteTrigger(tls, bp+48, (*THashElem)(unsafe.Pointer(pElem)).Fdata) + goto _1 + _1: + ; + pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext + } + _sqlite3HashClear(tls, bp+24) + _sqlite3HashInit(tls, pSchema+8) + pElem = (*THash)(unsafe.Pointer(bp)).Ffirst + for { + if !(pElem != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(pElem)).Fdata + _sqlite3DeleteTable(tls, bp+48, pTab) + goto _2 + _2: + ; + pElem = (*THashElem)(unsafe.Pointer(pElem)).Fnext + } + _sqlite3HashClear(tls, bp) + _sqlite3HashClear(tls, pSchema+80) + (*TSchema)(unsafe.Pointer(pSchema)).FpSeqTab = uintptr(0) + if int32((*TSchema)(unsafe.Pointer(pSchema)).FschemaFlags)&int32(DB_SchemaLoaded) != 0 { + (*TSchema)(unsafe.Pointer(pSchema)).FiGeneration++ + } + p3 = pSchema + 114 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^(libc.Int32FromInt32(DB_SchemaLoaded) | libc.Int32FromInt32(DB_ResetWanted))) +} + +// C documentation +// +// /* +// ** Find and return the schema associated with a BTree. Create +// ** a new one if necessary. +// */ +func _sqlite3SchemaGet(tls *libc.TLS, db uintptr, pBt uintptr) (r uintptr) { + var p uintptr + _ = p + if pBt != 0 { + p = _sqlite3BtreeSchema(tls, pBt, int32(120), __ccgo_fp(_sqlite3SchemaClear)) + } else { + p = _sqlite3DbMallocZero(tls, uintptr(0), uint64(120)) + } + if !(p != 0) { + _sqlite3OomFault(tls, db) + } else { + if 0 == int32((*TSchema)(unsafe.Pointer(p)).Ffile_format) { + _sqlite3HashInit(tls, p+8) + _sqlite3HashInit(tls, p+32) + _sqlite3HashInit(tls, p+56) + _sqlite3HashInit(tls, p+80) + (*TSchema)(unsafe.Pointer(p)).Fenc = uint8(SQLITE_UTF8) + } + } + return p +} + +/************** End of callback.c ********************************************/ +/************** Begin file delete.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C code routines that are called by the parser +** in order to generate code for DELETE FROM statements. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** While a SrcList can in general represent multiple tables and subqueries +// ** (as in the FROM clause of a SELECT statement) in this case it contains +// ** the name of a single table, as one might find in an INSERT, DELETE, +// ** or UPDATE statement. Look up that table in the symbol table and +// ** return a pointer. Set an error message and return NULL if the table +// ** name is not found or if any other error occurs. +// ** +// ** The following fields are initialized appropriate in pSrc: +// ** +// ** pSrc->a[0].pTab Pointer to the Table object +// ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one +// ** +// */ +func _sqlite3SrcListLookup(tls *libc.TLS, pParse uintptr, pSrc uintptr) (r uintptr) { + var pItem, pTab uintptr + _, _ = pItem, pTab + pItem = pSrc + 8 + pTab = _sqlite3LocateTableItem(tls, pParse, uint32(0), pItem) + if (*TSrcItem)(unsafe.Pointer(pItem)).FpTab != 0 { + _sqlite3DeleteTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pItem)).FpTab) + } + (*TSrcItem)(unsafe.Pointer(pItem)).FpTab = pTab + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 9, 0x200) + if pTab != 0 { + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2>>1)) != 0 && _sqlite3IndexedByLookup(tls, pParse, pItem) != 0 { + pTab = uintptr(0) + } + } + return pTab +} + +// C documentation +// +// /* Generate byte-code that will report the number of rows modified +// ** by a DELETE, INSERT, or UPDATE statement. +// */ +func _sqlite3CodeChangeCount(tls *libc.TLS, v uintptr, regCounter int32, zColName uintptr) { + _sqlite3VdbeAddOp0(tls, v, int32(OP_FkCheck)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regCounter, int32(1)) + _sqlite3VdbeSetNumCols(tls, v, int32(1)) + _sqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, zColName, libc.UintptrFromInt32(0)) +} + +// C documentation +// +// /* Return true if table pTab is read-only. +// ** +// ** A table is read-only if any of the following are true: +// ** +// ** 1) It is a virtual table and no implementation of the xUpdate method +// ** has been provided +// ** +// ** 2) A trigger is currently being coded and the table is a virtual table +// ** that is SQLITE_VTAB_DIRECTONLY or if PRAGMA trusted_schema=OFF and +// ** the table is not SQLITE_VTAB_INNOCUOUS. +// ** +// ** 3) It is a system table (i.e. sqlite_schema), this call is not +// ** part of a nested parse and writable_schema pragma has not +// ** been specified +// ** +// ** 4) The table is a shadow table, the database connection is in +// ** defensive mode, and the current sqlite3_prepare() +// ** is for a top-level SQL statement. +// */ +func _vtabIsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pTab))).FpMod)).FpModule)).FxUpdate == uintptr(0) { + return int32(1) + } + /* Within triggers: + ** * Do not allow DELETE, INSERT, or UPDATE of SQLITE_VTAB_DIRECTONLY + ** virtual tables + ** * Only allow DELETE, INSERT, or UPDATE of non-SQLITE_VTAB_INNOCUOUS + ** virtual tables if PRAGMA trusted_schema=ON. + */ + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != uintptr(0) && int32((*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15141, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + } + return 0 +} + +func _tabIsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { + var db uintptr + _ = db + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + return _vtabIsReadOnly(tls, pParse, pTab) + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_Readonly)|libc.Int32FromInt32(TF_Shadow)) == uint32(0) { + return 0 + } + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Readonly) != uint32(0) { + return libc.BoolInt32(_sqlite3WritableSchema(tls, db) == 0 && int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0) + } + return _sqlite3ReadOnlyShadowTables(tls, db) +} + +// C documentation +// +// /* +// ** Check to make sure the given table is writable. +// ** +// ** If pTab is not writable -> generate an error message and return 1. +// ** If pTab is writable but other errors have occurred -> return 1. +// ** If pTab is writable and no prior errors -> return 0; +// */ +func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if _tabIsReadOnly(tls, pParse, pTab) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15174, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + return int32(1) + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15203, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Evaluate a view and store its result in an ephemeral table. The +// ** pWhere argument is an optional WHERE clause that restricts the +// ** set of rows in the view that are to be added to the ephemeral table. +// */ +func _sqlite3MaterializeView(tls *libc.TLS, pParse uintptr, pView uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr, iCur int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var db, pFrom, pSel uintptr + var iDb int32 + var _ /* dest at bp+0 */ TSelectDest + _, _, _, _ = db, iDb, pFrom, pSel + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pView)).FpSchema) + pWhere = _sqlite3ExprDup(tls, db, pWhere, 0) + pFrom = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pFrom != 0 { + (*(*TSrcItem)(unsafe.Pointer(pFrom + 8))).FzName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pView)).FzName) + (*(*TSrcItem)(unsafe.Pointer(pFrom + 8))).FzDatabase = _sqlite3DbStrDup(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + } + pSel = _sqlite3SelectNew(tls, pParse, uintptr(0), pFrom, pWhere, uintptr(0), uintptr(0), pOrderBy, uint32(SF_IncludeHidden), pLimit) + _sqlite3SelectDestInit(tls, bp, int32(SRT_EphemTab), iCur) + _sqlite3Select(tls, pParse, pSel, bp) + _sqlite3SelectDelete(tls, db, pSel) +} + +/* && !defined(SQLITE_OMIT_SUBQUERY) */ + +// C documentation +// +// /* +// ** Generate code for a DELETE FROM statement. +// ** +// ** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL; +// ** \________/ \________________/ +// ** pTabList pWhere +// */ +func _sqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr) { + bp := tls.Alloc(96) + defer tls.Free(96) + var aToOpen, db, pIdx, pPk, pTab, pTrigger, pVTab, pWInfo, v, v13, v15, v18, v20, v3, v7 uintptr + var addrBypass, addrEphOpen, addrLoop, bComplex, count, eOnePass, i, iAddrOnce, iDb, iEphCur, iKey, iPk, iRowSet, iTabCur, isView, memCnt, nIdx, rcauth, v1, v10, v11, v12, v14, v17, v19, v2, v5, v6, v8 int32 + var nKey, nPk Ti16 + var wcf Tu16 + var _ /* aiCurOnePass at bp+80 */ [2]int32 + var _ /* iDataCur at bp+0 */ int32 + var _ /* iIdxCur at bp+4 */ int32 + var _ /* sContext at bp+8 */ TAuthContext + var _ /* sNC at bp+24 */ TNameContext + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aToOpen, addrBypass, addrEphOpen, addrLoop, bComplex, count, db, eOnePass, i, iAddrOnce, iDb, iEphCur, iKey, iPk, iRowSet, iTabCur, isView, memCnt, nIdx, nKey, nPk, pIdx, pPk, pTab, pTrigger, pVTab, pWInfo, rcauth, v, wcf, v1, v10, v11, v12, v13, v14, v15, v17, v18, v19, v2, v20, v3, v5, v6, v7, v8 /* Cursor number for the table */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* VDBE cursor for the canonical data source */ + *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* Database number */ + memCnt = 0 /* The write cursors opened by WHERE_ONEPASS */ + aToOpen = uintptr(0) /* The PRIMARY KEY index on the table */ + iPk = 0 /* First of nPk registers holding PRIMARY KEY value */ + nPk = int16(1) /* Number of memory cells in the row key */ + iEphCur = 0 /* Ephemeral table holding all primary key values */ + iRowSet = 0 /* Register for rowset of rows to delete */ + addrBypass = 0 /* Address of jump over the delete logic */ + addrLoop = 0 /* Top of the delete loop */ + addrEphOpen = 0 /* List of table triggers, if required */ + libc.Xmemset(tls, bp+8, 0, uint64(16)) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto delete_from_cleanup + } + /* Locate the table which we want to delete. This table has to be + ** put in an SrcList structure because some of the subroutines we + ** will be calling are designed to work with multiple tables and expect + ** an SrcList* parameter instead of just a Table* parameter. + */ + pTab = _sqlite3SrcListLookup(tls, pParse, pTabList) + if pTab == uintptr(0) { + goto delete_from_cleanup + } + /* Figure out if we have any triggers and if the table being + ** deleted from is a view + */ + pTrigger = _sqlite3TriggersExist(tls, pParse, pTab, int32(TK_DELETE), uintptr(0), uintptr(0)) + isView = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW)) + bComplex = libc.BoolInt32(pTrigger != 0 || _sqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) != 0) + /* If pTab is really a view, make sure it has been initialized. + */ + if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + goto delete_from_cleanup + } + if _sqlite3IsReadOnly(tls, pParse, pTab, pTrigger) != 0 { + goto delete_from_cleanup + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + rcauth = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + if rcauth == int32(SQLITE_DENY) { + goto delete_from_cleanup + } + /* Assign cursor numbers to the table and all its indices. + */ + v3 = pParse + 52 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + v1 = v2 + (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FiCursor = v1 + iTabCur = v1 + nIdx = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + (*TParse)(unsafe.Pointer(pParse)).FnTab++ + goto _4 + _4: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + nIdx++ + } + /* Start the view context + */ + if isView != 0 { + _sqlite3AuthContextPush(tls, pParse, bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName) + } + /* Begin generating code. + */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto delete_from_cleanup + } + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { + _sqlite3VdbeCountChanges(tls, v) + } + _sqlite3BeginWriteOperation(tls, pParse, bComplex, iDb) + /* If we are trying to delete from a view, realize that view into + ** an ephemeral table. + */ + if isView != 0 { + _sqlite3MaterializeView(tls, pParse, pTab, pWhere, pOrderBy, pLimit, iTabCur) + v5 = iTabCur + *(*int32)(unsafe.Pointer(bp + 4)) = v5 + *(*int32)(unsafe.Pointer(bp)) = v5 + pOrderBy = uintptr(0) + pLimit = uintptr(0) + } + /* Resolve the column names in the WHERE clause. + */ + libc.Xmemset(tls, bp+24, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = pTabList + if _sqlite3ResolveExprNames(tls, bp+24, pWhere) != 0 { + goto delete_from_cleanup + } + /* Initialize the counter of the number of rows deleted, if + ** we are counting rows. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00001))<>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + if memCnt != 0 { + v10 = memCnt + } else { + v10 = -int32(1) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Clear), int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb, v10) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Clear), int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) + } + goto _9 + _9: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } else { + wcf = uint16(libc.Int32FromInt32(WHERE_ONEPASS_DESIRED) | libc.Int32FromInt32(WHERE_DUPLICATES_OK)) + if (*(*TNameContext)(unsafe.Pointer(bp + 24))).FncFlags&int32(NC_Subquery) != 0 { + bComplex = int32(1) + } + if bComplex != 0 { + v11 = 0 + } else { + v11 = int32(WHERE_ONEPASS_MULTIROW) + } + wcf = Tu16(int32(wcf) | v11) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + /* For a rowid table, initialize the RowSet to an empty set */ + pPk = uintptr(0) + v13 = pParse + 56 + *(*int32)(unsafe.Pointer(v13))++ + v12 = *(*int32)(unsafe.Pointer(v13)) + iRowSet = v12 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, iRowSet) + } else { + /* For a WITHOUT ROWID table, create an ephemeral table used to + ** hold all primary keys for rows to be deleted. */ + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + nPk = int16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + iPk = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(nPk) + v15 = pParse + 52 + v14 = *(*int32)(unsafe.Pointer(v15)) + *(*int32)(unsafe.Pointer(v15))++ + iEphCur = v14 + addrEphOpen = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), iEphCur, int32(nPk)) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) + } + /* Construct a query to find the rowid or primary key for every row + ** to be deleted, based on the WHERE clause. Set variable eOnePass + ** to indicate the strategy used to implement this delete: + ** + ** ONEPASS_OFF: Two-pass approach - use a FIFO for rowids/PK values. + ** ONEPASS_SINGLE: One-pass approach - at most one row deleted. + ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. + */ + pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, uintptr(0), uintptr(0), uintptr(0), wcf, iTabCur+int32(1)) + if pWInfo == uintptr(0) { + goto delete_from_cleanup + } + eOnePass = _sqlite3WhereOkOnePass(tls, pWInfo, bp+80) + if eOnePass != int32(ONEPASS_SINGLE) { + _sqlite3MultiWrite(tls, pParse) + } + if _sqlite3WhereUsesDeferredSeek(tls, pWInfo) != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_FinishSeek), iTabCur) + } + /* Keep track of the number of rows to be deleted */ + if memCnt != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), memCnt, int32(1)) + } + /* Extract the rowid or primary key for the current row */ + if pPk != 0 { + i = 0 + for { + if !(i < int32(nPk)) { + break + } + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) + goto _16 + _16: + ; + i++ + } + iKey = iPk + } else { + v18 = pParse + 56 + *(*int32)(unsafe.Pointer(v18))++ + v17 = *(*int32)(unsafe.Pointer(v18)) + iKey = v17 + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, -int32(1), iKey) + } + if eOnePass != ONEPASS_OFF { + /* For ONEPASS, no need to store the rowid/primary-key. There is only + ** one, so just keep it in its register(s) and fall through to the + ** delete code. */ + nKey = nPk /* OP_Found will use an unpacked key */ + aToOpen = _sqlite3DbMallocRawNN(tls, db, uint64(nIdx+int32(2))) + if aToOpen == uintptr(0) { + _sqlite3WhereEnd(tls, pWInfo) + goto delete_from_cleanup + } + libc.Xmemset(tls, aToOpen, int32(1), uint64(nIdx+int32(1))) + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(nIdx+int32(1)))) = uint8(0) + if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[0] >= 0 { + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr((*(*[2]int32)(unsafe.Pointer(bp + 80)))[0]-iTabCur))) = uint8(0) + } + if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] >= 0 { + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr((*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)]-iTabCur))) = uint8(0) + } + if addrEphOpen != 0 { + _sqlite3VdbeChangeToNoop(tls, v, addrEphOpen) + } + addrBypass = _sqlite3VdbeMakeLabel(tls, pParse) + } else { + if pPk != 0 { + /* Add the PK key for this row to the temporary table */ + v20 = pParse + 56 + *(*int32)(unsafe.Pointer(v20))++ + v19 = *(*int32)(unsafe.Pointer(v20)) + iKey = v19 + nKey = 0 /* Zero tells OP_Found to use a composite key */ + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), iPk, int32(nPk), iKey, _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pPk), int32(nPk)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iEphCur, iKey, iPk, int32(nPk)) + } else { + /* Add the rowid of the row to be deleted to the RowSet */ + nKey = int16(1) /* OP_DeferredSeek always uses a single rowid */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_RowSetAdd), iRowSet, iKey) + } + _sqlite3WhereEnd(tls, pWInfo) + } + /* Unless this is a view, open cursors for the table we are + ** deleting from and all its indices. If this is a view, then the + ** only effect this statement has is to fire the INSTEAD OF + ** triggers. + */ + if !(isView != 0) { + iAddrOnce = 0 + if eOnePass == int32(ONEPASS_MULTI) { + iAddrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } + _sqlite3OpenTableAndIndices(tls, pParse, pTab, int32(OP_OpenWrite), uint8(OPFLAG_FORDELETE), iTabCur, aToOpen, bp, bp+4) + if eOnePass == int32(ONEPASS_MULTI) { + _sqlite3VdbeJumpHereOrPopInst(tls, v, iAddrOnce) + } + } + /* Set up a loop over the rowids/primary-keys that were found in the + ** where-clause loop above. + */ + if eOnePass != ONEPASS_OFF { + /* OP_Found will use an unpacked key */ + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(*(*int32)(unsafe.Pointer(bp))-iTabCur))) != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), *(*int32)(unsafe.Pointer(bp)), addrBypass, iKey, int32(nKey)) + } + } else { + if pPk != 0 { + addrLoop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iEphCur) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEphCur, 0, iKey) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_RowData), iEphCur, iKey) + } + /* OP_Found will use a composite key */ + } else { + addrLoop = _sqlite3VdbeAddOp3(tls, v, int32(OP_RowSetRead), iRowSet, 0, iKey) + } + } + /* Delete the row */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + pVTab = _sqlite3GetVTable(tls, db, pTab) + _sqlite3VtabMakeWritable(tls, pParse, pTab) + _sqlite3MayAbort(tls, pParse) + if eOnePass == int32(ONEPASS_SINGLE) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iTabCur) + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).FisMultiWrite = uint8(0) + } + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_VUpdate), 0, int32(1), iKey, pVTab, -int32(11)) + _sqlite3VdbeChangeP5(tls, v, uint16(OE_Abort)) + } else { + count = libc.BoolInt32(int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0) /* True to count changes */ + _sqlite3GenerateRowDelete(tls, pParse, pTab, pTrigger, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), iKey, nKey, uint8(count), uint8(OE_Default), uint8(eOnePass), (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)]) + } + /* End of the loop over all rowids/primary-keys. */ + if eOnePass != ONEPASS_OFF { + _sqlite3VdbeResolveLabel(tls, v, addrBypass) + _sqlite3WhereEnd(tls, pWInfo) + } else { + if pPk != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iEphCur, addrLoop+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addrLoop) + } else { + _sqlite3VdbeGoto(tls, v, addrLoop) + _sqlite3VdbeJumpHere(tls, v, addrLoop) + } + } + } /* End non-truncate path */ + /* Update the sqlite_sequence table by storing the content of the + ** maximum rowid counter values recorded while inserting into + ** autoincrement tables. + */ + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0) { + _sqlite3AutoincrementEnd(tls, pParse) + } + /* Return the number of rows that were deleted. If this routine is + ** generating code because of a call to sqlite3NestedParse(), do not + ** invoke the callback function. + */ + if memCnt != 0 { + _sqlite3CodeChangeCount(tls, v, memCnt, __ccgo_ts+15241) + } +delete_from_cleanup: + ; + _sqlite3AuthContextPop(tls, bp+8) + _sqlite3SrcListDelete(tls, db, pTabList) + _sqlite3ExprDelete(tls, db, pWhere) + if aToOpen != 0 { + _sqlite3DbNNFreeNN(tls, db, aToOpen) + } + return +} + +/* Make sure "isView" and other macros defined above are undefined. Otherwise +** they may interfere with compilation of other functions in this file +** (or in another file, if this file becomes part of the amalgamation). */ + +// C documentation +// +// /* +// ** This routine generates VDBE code that causes a single row of a +// ** single table to be deleted. Both the original table entry and +// ** all indices are removed. +// ** +// ** Preconditions: +// ** +// ** 1. iDataCur is an open cursor on the btree that is the canonical data +// ** store for the table. (This will be either the table itself, +// ** in the case of a rowid table, or the PRIMARY KEY index in the case +// ** of a WITHOUT ROWID table.) +// ** +// ** 2. Read/write cursors for all indices of pTab must be open as +// ** cursor number iIdxCur+i for the i-th index. +// ** +// ** 3. The primary key for the row to be deleted must be stored in a +// ** sequence of nPk memory cells starting at iPk. If nPk==0 that means +// ** that a search record formed from OP_MakeRecord is contained in the +// ** single memory location iPk. +// ** +// ** eMode: +// ** Parameter eMode may be passed either ONEPASS_OFF (0), ONEPASS_SINGLE, or +// ** ONEPASS_MULTI. If eMode is not ONEPASS_OFF, then the cursor +// ** iDataCur already points to the row to delete. If eMode is ONEPASS_OFF +// ** then this function must seek iDataCur to the entry identified by iPk +// ** and nPk before reading from it. +// ** +// ** If eMode is ONEPASS_MULTI, then this call is being made as part +// ** of a ONEPASS delete that affects multiple rows. In this case, if +// ** iIdxNoSeek is a valid cursor number (>=0) and is not the same as +// ** iDataCur, then its position should be preserved following the delete +// ** operation. Or, if iIdxNoSeek is not a valid cursor number, the +// ** position of iDataCur should be preserved instead. +// ** +// ** iIdxNoSeek: +// ** If iIdxNoSeek is a valid cursor number (>=0) not equal to iDataCur, +// ** then it identifies an index cursor (from within array of cursors +// ** starting at iIdxCur) that already points to the index entry to be deleted. +// ** Except, this optimization is disabled if there are BEFORE triggers since +// ** the trigger body might have moved the cursor. +// */ +func _sqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger uintptr, iDataCur int32, iIdxCur int32, iPk int32, nPk Ti16, count Tu8, onconf Tu8, eMode Tu8, iIdxNoSeek int32) { + var addrStart, iCol, iLabel, iOld, kk, v1, v3 int32 + var mask Tu32 + var opSeek, p5 Tu8 + var v uintptr + _, _, _, _, _, _, _, _, _, _, _ = addrStart, iCol, iLabel, iOld, kk, mask, opSeek, p5, v, v1, v3 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Vdbe */ + iOld = 0 /* Seek opcode */ + /* Vdbe is guaranteed to have been allocated by this stage. */ + /* Seek cursor iCur to the row to delete. If this row no longer exists + ** (this can happen if a trigger program has already deleted it), do + ** not attempt to delete it or fire any DELETE triggers. */ + iLabel = _sqlite3VdbeMakeLabel(tls, pParse) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + v1 = int32(OP_NotExists) + } else { + v1 = int32(OP_NotFound) + } + opSeek = uint8(v1) + if int32(eMode) == ONEPASS_OFF { + _sqlite3VdbeAddOp4Int(tls, v, int32(opSeek), iDataCur, iLabel, iPk, int32(nPk)) + } + /* If there are any triggers to fire, allocate a range of registers to + ** use for the old.* references in the triggers. */ + if _sqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) != 0 || pTrigger != 0 { /* Start of BEFORE trigger programs */ + /* TODO: Could use temporary registers here. Also could attempt to + ** avoid copying the contents of the rowid register. */ + mask = _sqlite3TriggerColmask(tls, pParse, pTrigger, uintptr(0), 0, libc.Int32FromInt32(TRIGGER_BEFORE)|libc.Int32FromInt32(TRIGGER_AFTER), pTab, int32(onconf)) + mask |= _sqlite3FkOldmask(tls, pParse, pTab) + iOld = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(1) + int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + /* Populate the OLD.* pseudo-table register array. These values will be + ** used by any BEFORE and AFTER triggers that exist. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), iPk, iOld) + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if mask == uint32(0xffffffff) || iCol <= int32(31) && mask&(libc.Uint32FromInt32(1)<= 0 && iIdxNoSeek != iDataCur { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Delete), iIdxNoSeek) + } + if int32(eMode) == int32(ONEPASS_MULTI) { + p5 = Tu8(int32(p5) | libc.Int32FromInt32(OPFLAG_SAVEPOSITION)) + } + _sqlite3VdbeChangeP5(tls, v, uint16(p5)) + } + /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to + ** handle rows (possibly in other tables) that refer via a foreign key + ** to the row just deleted. */ + _sqlite3FkActions(tls, pParse, pTab, uintptr(0), iOld, uintptr(0), 0) + /* Invoke AFTER DELETE trigger programs. */ + if pTrigger != 0 { + _sqlite3CodeRowTrigger(tls, pParse, pTrigger, int32(TK_DELETE), uintptr(0), int32(TRIGGER_AFTER), pTab, iOld, int32(onconf), iLabel) + } + /* Jump here if the row had already been deleted before any BEFORE + ** trigger programs were invoked. Or if a trigger program throws a + ** RAISE(IGNORE) exception. */ + _sqlite3VdbeResolveLabel(tls, v, iLabel) +} + +// C documentation +// +// /* +// ** This routine generates VDBE code that causes the deletion of all +// ** index entries associated with a single row of a single table, pTab +// ** +// ** Preconditions: +// ** +// ** 1. A read/write cursor "iDataCur" must be open on the canonical storage +// ** btree for the table pTab. (This will be either the table itself +// ** for rowid tables or to the primary key index for WITHOUT ROWID +// ** tables.) +// ** +// ** 2. Read/write cursors for all indices of pTab must be open as +// ** cursor number iIdxCur+i for the i-th index. (The pTab->pIndex +// ** index is the 0-th index.) +// ** +// ** 3. The "iDataCur" cursor must be already be positioned on the row +// ** that is to be deleted. +// */ +func _sqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, iDataCur int32, iIdxCur int32, aRegIdx uintptr, iIdxNoSeek int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, r1, v3 int32 + var pIdx, pPk, pPrior, v, v1 uintptr + var _ /* iPartIdxLabel at bp+0 */ int32 + _, _, _, _, _, _, _, _ = i, pIdx, pPk, pPrior, r1, v, v1, v3 /* Index loop counter */ + r1 = -int32(1) /* Current index */ + pPrior = uintptr(0) /* PRIMARY KEY index, or NULL for rowid tables */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + v1 = uintptr(0) + } else { + v1 = _sqlite3PrimaryKeyIndex(tls, pTab) + } + pPk = v1 + i = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if aRegIdx != uintptr(0) && *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) == 0 { + goto _2 + } + if pIdx == pPk { + goto _2 + } + if iIdxCur+i == iIdxNoSeek { + goto _2 + } + r1 = _sqlite3GenerateIndexKey(tls, pParse, pIdx, iDataCur, 0, int32(1), bp, pPrior, r1) + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + v3 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + v3 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_IdxDelete), iIdxCur+i, r1, v3) + _sqlite3VdbeChangeP5(tls, v, uint16(1)) /* Cause IdxDelete to error if no entry found */ + _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + pPrior = pIdx + goto _2 + _2: + ; + i++ + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } +} + +// C documentation +// +// /* +// ** Generate code that will assemble an index key and stores it in register +// ** regOut. The key with be for index pIdx which is an index on pTab. +// ** iCur is the index of a cursor open on the pTab table and pointing to +// ** the entry that needs indexing. If pTab is a WITHOUT ROWID table, then +// ** iCur must be the cursor of the PRIMARY KEY index. +// ** +// ** Return a register number which is the first in a block of +// ** registers that holds the elements of the index key. The +// ** block of registers has already been deallocated by the time +// ** this routine returns. +// ** +// ** If *piPartIdxLabel is not NULL, fill it in with a label and jump +// ** to that label if pIdx is a partial index that should be skipped. +// ** The label should be resolved using sqlite3ResolvePartIdxLabel(). +// ** A partial index should be skipped if its WHERE clause evaluates +// ** to false or null. If pIdx is not a partial index, *piPartIdxLabel +// ** will be set to zero which is an empty label that is ignored by +// ** sqlite3ResolvePartIdxLabel(). +// ** +// ** The pPrior and regPrior parameters are used to implement a cache to +// ** avoid unnecessary register loads. If pPrior is not NULL, then it is +// ** a pointer to a different index for which an index key has just been +// ** computed into register regPrior. If the current pIdx index is generating +// ** its key into the same sequence of registers and if pPrior and pIdx share +// ** a column in common, then the register corresponding to that column already +// ** holds the correct value and the loading of that register is skipped. +// ** This optimization is helpful when doing a DELETE or an INTEGRITY_CHECK +// ** on a table with multiple indices, and especially with the ROWID or +// ** PRIMARY KEY columns of the index. +// */ +func _sqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iDataCur int32, regOut int32, prefixOnly int32, piPartIdxLabel uintptr, pPrior uintptr, regPrior int32) (r int32) { + var j, nCol, regBase, v1 int32 + var v uintptr + _, _, _, _, _ = j, nCol, regBase, v, v1 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if piPartIdxLabel != 0 { + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + *(*int32)(unsafe.Pointer(piPartIdxLabel)) = _sqlite3VdbeMakeLabel(tls, pParse) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = iDataCur + int32(1) + _sqlite3ExprIfFalseDup(tls, pParse, (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere, *(*int32)(unsafe.Pointer(piPartIdxLabel)), int32(SQLITE_JUMPIFNULL)) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + pPrior = uintptr(0) /* Ticket a9efb42811fa41ee 2019-11-02; + ** pPartIdxWhere may have corrupted regPrior registers */ + } else { + *(*int32)(unsafe.Pointer(piPartIdxLabel)) = 0 + } + } + if prefixOnly != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + v1 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + v1 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } + nCol = v1 + regBase = _sqlite3GetTempRange(tls, pParse, nCol) + if pPrior != 0 && (regBase != regPrior || (*TIndex)(unsafe.Pointer(pPrior)).FpPartIdxWhere != 0) { + pPrior = uintptr(0) + } + j = 0 + for { + if !(j < nCol) { + break + } + if pPrior != 0 && int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPrior)).FaiColumn + uintptr(j)*2))) == int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) && int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPrior)).FaiColumn + uintptr(j)*2))) != -int32(2) { + /* This column was already computed by the previous index */ + goto _2 + } + _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iDataCur, j, regBase+j) + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) >= 0 { + /* If the column affinity is REAL but the number is an integer, then it + ** might be stored in the table as an integer (using a compact + ** representation) then converted to REAL by an OP_RealAffinity opcode. + ** But we are getting ready to store this value back into an index, where + ** it should be converted by to INTEGER again. So omit the + ** OP_RealAffinity opcode if it is present */ + _sqlite3VdbeDeletePriorOpcode(tls, v, uint8(OP_RealAffinity)) + } + goto _2 + _2: + ; + j++ + } + if regOut != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regBase, nCol, regOut) + } + _sqlite3ReleaseTempRange(tls, pParse, regBase, nCol) + return regBase +} + +// C documentation +// +// /* +// ** If a prior call to sqlite3GenerateIndexKey() generated a jump-over label +// ** because it was a partial index, then this routine should be called to +// ** resolve that label. +// */ +func _sqlite3ResolvePartIdxLabel(tls *libc.TLS, pParse uintptr, iLabel int32) { + if iLabel != 0 { + _sqlite3VdbeResolveLabel(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, iLabel) + } +} + +/************** End of delete.c **********************************************/ +/************** Begin file func.c ********************************************/ +/* +** 2002 February 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the C-language implementations for many of the SQL +** functions of SQLite. (Some function, and in particular the date and +** time functions, are implemented separately.) + */ +/* #include "sqliteInt.h" */ +/* #include */ +/* #include */ +/* #include */ +/* #include "vdbeInt.h" */ + +// C documentation +// +// /* +// ** Return the collating function associated with a function. +// */ +func _sqlite3GetFuncCollSeq(tls *libc.TLS, context uintptr) (r uintptr) { + var pOp uintptr + _ = pOp + pOp = (*TVdbe)(unsafe.Pointer((*Tsqlite3_context)(unsafe.Pointer(context)).FpVdbe)).FaOp + uintptr((*Tsqlite3_context)(unsafe.Pointer(context)).FiOp-int32(1))*24 + return *(*uintptr)(unsafe.Pointer(pOp + 16)) +} + +// C documentation +// +// /* +// ** Indicate that the accumulator load should be skipped on this +// ** iteration of the aggregate loop. +// */ +func _sqlite3SkipAccumulatorLoad(tls *libc.TLS, context uintptr) { + (*Tsqlite3_context)(unsafe.Pointer(context)).FisError = -int32(1) + (*Tsqlite3_context)(unsafe.Pointer(context)).FskipFlag = uint8(1) +} + +// C documentation +// +// /* +// ** Implementation of the non-aggregate min() and max() functions +// */ +func _minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var i, iBest, mask, v1 int32 + var pColl uintptr + _, _, _, _, _ = i, iBest, mask, pColl, v1 + if Xsqlite3_user_data(tls, context) == uintptr(0) { + v1 = 0 + } else { + v1 = -int32(1) + } + mask = v1 + pColl = _sqlite3GetFuncCollSeq(tls, context) + iBest = 0 + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { + return + } + i = int32(1) + for { + if !(i < argc) { + break + } + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) == int32(SQLITE_NULL) { + return + } + if _sqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8)), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), pColl)^mask >= 0 { + iBest = i + } + goto _2 + _2: + ; + i++ + } + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) +} + +// C documentation +// +// /* +// ** Return the type of the argument. +// */ +func _typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + var i int32 + _ = i + i = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) - int32(1) + _ = NotUsed + /* EVIDENCE-OF: R-01470-60482 The sqlite3_value_type(V) interface returns + ** the datatype code for the initial datatype of the sqlite3_value object + ** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT, + ** SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. */ + Xsqlite3_result_text(tls, context, _azType2[i], -int32(1), libc.UintptrFromInt32(0)) +} + +var _azType2 = [5]uintptr{ + 0: __ccgo_ts + 6338, + 1: __ccgo_ts + 6333, + 2: __ccgo_ts + 8229, + 3: __ccgo_ts + 8224, + 4: __ccgo_ts + 1666, +} + +// C documentation +// +// /* subtype(X) +// ** +// ** Return the subtype of X +// */ +func _subtypeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + _ = argc + Xsqlite3_result_int(tls, context, int32(Xsqlite3_value_subtype(tls, *(*uintptr)(unsafe.Pointer(argv))))) +} + +// C documentation +// +// /* +// ** Implementation of the length() function +// */ +func _lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var c, v1 uint8 + var z, z0 uintptr + _, _, _, _ = c, z, z0, v1 + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_BLOB): + fallthrough + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + Xsqlite3_result_int(tls, context, Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + case int32(SQLITE_TEXT): + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return + } + z0 = z + for { + v1 = *(*uint8)(unsafe.Pointer(z)) + c = v1 + if !(int32(v1) != 0) { + break + } + z++ + if int32(c) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + z0++ + } + } + } + Xsqlite3_result_int(tls, context, int32(int64(z)-int64(z0))) + default: + Xsqlite3_result_null(tls, context) + break + } +} + +// C documentation +// +// /* +// ** Implementation of the octet_length() function +// */ +func _bytelengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var m Ti64 + var v1 int32 + _, _ = m, v1 + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_BLOB): + Xsqlite3_result_int(tls, context, Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + if int32((*Tsqlite3)(unsafe.Pointer(Xsqlite3_context_db_handle(tls, context))).Fenc) <= int32(SQLITE_UTF8) { + v1 = int32(1) + } else { + v1 = int32(2) + } + m = int64(v1) + Xsqlite3_result_int64(tls, context, int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))))*m) + case int32(SQLITE_TEXT): + if Xsqlite3_value_encoding(tls, *(*uintptr)(unsafe.Pointer(argv))) <= int32(SQLITE_UTF8) { + Xsqlite3_result_int(tls, context, Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } else { + Xsqlite3_result_int(tls, context, Xsqlite3_value_bytes16(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } + default: + Xsqlite3_result_null(tls, context) + break + } +} + +// C documentation +// +// /* +// ** Implementation of the abs() function. +// ** +// ** IMP: R-23979-26855 The abs(X) function returns the absolute value of +// ** the numeric argument X. +// */ +func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var iVal Ti64 + var rVal float64 + _, _ = iVal, rVal + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_INTEGER): + iVal = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + if iVal < 0 { + if iVal == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0 { + if typeHaystack == int32(SQLITE_BLOB) && typeNeedle == int32(SQLITE_BLOB) { + zHaystack = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + zNeedle = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + isText = 0 + } else { + if typeHaystack != int32(SQLITE_BLOB) && typeNeedle != int32(SQLITE_BLOB) { + zHaystack = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zNeedle = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + isText = int32(1) + } else { + pC1 = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(argv))) + zHaystack = Xsqlite3_value_text(tls, pC1) + if zHaystack == uintptr(0) { + goto endInstrOOM + } + nHaystack = Xsqlite3_value_bytes(tls, pC1) + pC2 = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + zNeedle = Xsqlite3_value_text(tls, pC2) + if zNeedle == uintptr(0) { + goto endInstrOOM + } + nNeedle = Xsqlite3_value_bytes(tls, pC2) + isText = int32(1) + } + } + if zNeedle == uintptr(0) || nHaystack != 0 && zHaystack == uintptr(0) { + goto endInstrOOM + } + firstChar = *(*uint8)(unsafe.Pointer(zNeedle)) + for nNeedle <= nHaystack && (int32(*(*uint8)(unsafe.Pointer(zHaystack))) != int32(firstChar) || libc.Xmemcmp(tls, zHaystack, zNeedle, uint64(nNeedle)) != 0) { + N++ + for cond := true; cond; cond = isText != 0 && int32(*(*uint8)(unsafe.Pointer(zHaystack)))&int32(0xc0) == int32(0x80) { + nHaystack-- + zHaystack++ + } + } + if nNeedle > nHaystack { + N = 0 + } + } + Xsqlite3_result_int(tls, context, N) +endInstr: + ; + Xsqlite3_value_free(tls, pC1) + Xsqlite3_value_free(tls, pC2) + return +endInstrOOM: + ; + Xsqlite3_result_error_nomem(tls, context) + goto endInstr +} + +// C documentation +// +// /* +// ** Implementation of the printf() (a.k.a. format()) SQL function. +// */ +func _printfFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, zFormat, v1 uintptr + var n int32 + var v2 bool + var _ /* str at bp+16 */ TStrAccum + var _ /* x at bp+0 */ TPrintfArguments + _, _, _, _, _ = db, n, zFormat, v1, v2 + db = Xsqlite3_context_db_handle(tls, context) + if v2 = argc >= int32(1); v2 { + v1 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zFormat = v1 + } + if v2 && v1 != uintptr(0) { + (*(*TPrintfArguments)(unsafe.Pointer(bp))).FnArg = argc - int32(1) + (*(*TPrintfArguments)(unsafe.Pointer(bp))).FnUsed = 0 + (*(*TPrintfArguments)(unsafe.Pointer(bp))).FapArg = argv + uintptr(1)*8 + _sqlite3StrAccumInit(tls, bp+16, db, uintptr(0), 0, *(*int32)(unsafe.Pointer(db + 136))) + (*(*TStrAccum)(unsafe.Pointer(bp + 16))).FprintfFlags = uint8(SQLITE_PRINTF_SQLFUNC) + Xsqlite3_str_appendf(tls, bp+16, zFormat, libc.VaList(bp+56, bp)) + n = int32((*(*TStrAccum)(unsafe.Pointer(bp + 16))).FnChar) + Xsqlite3_result_text(tls, context, _sqlite3StrAccumFinish(tls, bp+16), n, __ccgo_fp(_sqlite3OomClear)) + } +} + +// C documentation +// +// /* +// ** Implementation of the substr() function. +// ** +// ** substr(x,p1,p2) returns p2 characters of x[] beginning with p1. +// ** p1 is 1-indexed. So substr(x,1,1) returns the first character +// ** of x. If x is text, then we actually count UTF-8 characters. +// ** If x is a blob, then we count bytes. +// ** +// ** If p1 is negative, then we begin abs(p1) from the end of x[]. +// ** +// ** If p2 is negative, return the p2 characters preceding p1. +// */ +func _substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var len1, negP2, p0type int32 + var p1, p2 Ti64 + var z, z2, v2, v3, v5 uintptr + _, _, _, _, _, _, _, _, _, _ = len1, negP2, p0type, p1, p2, z, z2, v2, v3, v5 + negP2 = 0 + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == int32(SQLITE_NULL) || argc == int32(3) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) == int32(SQLITE_NULL) { + return + } + p0type = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + p1 = int64(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + if p0type == int32(SQLITE_BLOB) { + len1 = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return + } + } else { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return + } + len1 = 0 + if p1 < 0 { + z2 = z + for { + if !(*(*uint8)(unsafe.Pointer(z2)) != 0) { + break + } + v2 = z2 + z2++ + if int32(*(*uint8)(unsafe.Pointer(v2))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z2)))&int32(0xc0) == int32(0x80) { + z2++ + } + } + goto _1 + _1: + ; + len1++ + } + } + } + if argc == int32(3) { + p2 = int64(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + if p2 < 0 { + p2 = -p2 + negP2 = int32(1) + } + } else { + p2 = int64(*(*int32)(unsafe.Pointer(Xsqlite3_context_db_handle(tls, context) + 136))) + } + if p1 < 0 { + p1 += int64(len1) + if p1 < 0 { + p2 += p1 + if p2 < 0 { + p2 = 0 + } + p1 = 0 + } + } else { + if p1 > 0 { + p1-- + } else { + if p2 > 0 { + p2-- + } + } + } + if negP2 != 0 { + p1 -= p2 + if p1 < 0 { + p2 += p1 + p1 = 0 + } + } + if p0type != int32(SQLITE_BLOB) { + for *(*uint8)(unsafe.Pointer(z)) != 0 && p1 != 0 { + v3 = z + z++ + if int32(*(*uint8)(unsafe.Pointer(v3))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + } + } + p1-- + } + z2 = z + for { + if !(*(*uint8)(unsafe.Pointer(z2)) != 0 && p2 != 0) { + break + } + v5 = z2 + z2++ + if int32(*(*uint8)(unsafe.Pointer(v5))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z2)))&int32(0xc0) == int32(0x80) { + z2++ + } + } + goto _4 + _4: + ; + p2-- + } + Xsqlite3_result_text64(tls, context, z, uint64(int64(z2)-int64(z)), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) + } else { + if p1+p2 > int64(len1) { + p2 = int64(len1) - p1 + if p2 < 0 { + p2 = 0 + } + } + Xsqlite3_result_blob64(tls, context, z+uintptr(p1), uint64(p2), uintptr(-libc.Int32FromInt32(1))) + } +} + +// C documentation +// +// /* +// ** Implementation of the round() function +// */ +func _roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var n int32 + var zBuf uintptr + var v1 float64 + var _ /* r at bp+0 */ float64 + _, _, _ = n, zBuf, v1 + n = 0 + if argc == int32(2) { + if int32(SQLITE_NULL) == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) { + return + } + n = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if n > int32(30) { + n = int32(30) + } + if n < 0 { + n = 0 + } + } + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { + return + } + *(*float64)(unsafe.Pointer(bp)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* If Y==0 and X will fit in a 64-bit int, + ** handle the rounding directly, + ** otherwise use printf. + */ + if *(*float64)(unsafe.Pointer(bp)) < -libc.Float64FromFloat64(4.503599627370496e+15) || *(*float64)(unsafe.Pointer(bp)) > +libc.Float64FromFloat64(4.503599627370496e+15) { + /* The value has no fractional part so there is nothing to round */ + } else { + if n == 0 { + if *(*float64)(unsafe.Pointer(bp)) < libc.Float64FromInt32(0) { + v1 = -libc.Float64FromFloat64(0.5) + } else { + v1 = +libc.Float64FromFloat64(0.5) + } + *(*float64)(unsafe.Pointer(bp)) = float64(int64(*(*float64)(unsafe.Pointer(bp)) + v1)) + } else { + zBuf = Xsqlite3_mprintf(tls, __ccgo_ts+15271, libc.VaList(bp+16, n, *(*float64)(unsafe.Pointer(bp)))) + if zBuf == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + _sqlite3AtoF(tls, zBuf, bp, _sqlite3Strlen30(tls, zBuf), uint8(SQLITE_UTF8)) + Xsqlite3_free(tls, zBuf) + } + } + Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Allocate nByte bytes of space using sqlite3Malloc(). If the +// ** allocation fails, call sqlite3_result_error_nomem() to notify +// ** the database handle that malloc() has failed and return NULL. +// ** If nByte is larger than the maximum string or blob length, then +// ** raise an SQLITE_TOOBIG exception and return NULL. +// */ +func _contextMalloc(tls *libc.TLS, context uintptr, nByte Ti64) (r uintptr) { + var db, z uintptr + _, _ = db, z + db = Xsqlite3_context_db_handle(tls, context) + if nByte > int64(*(*int32)(unsafe.Pointer(db + 136))) { + Xsqlite3_result_error_toobig(tls, context) + z = uintptr(0) + } else { + z = _sqlite3Malloc(tls, uint64(nByte)) + if !(z != 0) { + Xsqlite3_result_error_nomem(tls, context) + } + } + return z +} + +// C documentation +// +// /* +// ** Implementation of the upper() and lower() SQL functions. +// */ +func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var i, n int32 + var z1, z2 uintptr + _, _, _, _ = i, n, z1, z2 + _ = argc + z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* Verify that the call to _bytes() does not invalidate the _text() pointer */ + if z2 != 0 { + z1 = _contextMalloc(tls, context, int64(n)+int64(1)) + if z1 != 0 { + i = 0 + for { + if !(i < n) { + break + } + *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) + } + } +} + +func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var i, n int32 + var z1, z2 uintptr + _, _, _, _ = i, n, z1, z2 + _ = argc + z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* Verify that the call to _bytes() does not invalidate the _text() pointer */ + if z2 != 0 { + z1 = _contextMalloc(tls, context, int64(n)+int64(1)) + if z1 != 0 { + i = 0 + for { + if !(i < n) { + break + } + *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) + goto _1 + _1: + ; + i++ + } + Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) + } + } +} + +/* +** Some functions like COALESCE() and IFNULL() and UNLIKELY() are implemented +** as VDBE code so that unused argument values do not have to be computed. +** However, we still need some kind of function implementation for this +** routines in the function table. The noopFunc macro provides this. +** noopFunc will never be called so it doesn't matter what the implementation +** is. We might as well use the "version()" function as a substitute. + */ + +// C documentation +// +// /* +// ** Implementation of random(). Return a random integer. +// */ +func _randomFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* r at bp+0 */ Tsqlite_int64 + _ = NotUsed + _ = NotUsed2 + Xsqlite3_randomness(tls, int32(8), bp) + if *(*Tsqlite_int64)(unsafe.Pointer(bp)) < 0 { + /* We need to prevent a random number of 0x8000000000000000 + ** (or -9223372036854775808) since when you do abs() of that + ** number of you get the same value back again. To do this + ** in a way that is testable, mask the sign bit off of negative + ** values, resulting in a positive value. Then take the + ** 2s complement of that positive value. The end result can + ** therefore be no less than -9223372036854775807. + */ + *(*Tsqlite_int64)(unsafe.Pointer(bp)) = -(*(*Tsqlite_int64)(unsafe.Pointer(bp)) & (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)<= int32(0xc0) { + for int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))))&int32(0xc0) == int32(0x80) { + *(*uintptr)(unsafe.Pointer(bp + 8))++ + } + } + } + return int32(SQLITE_NOWILDCARDMATCH) + } + } + } + /* At this point variable c contains the first character of the + ** pattern string past the "*". Search in the input string for the + ** first matching character and recursively continue the match from + ** that point. + ** + ** For a case-insensitive search, set variable cx to be the same as + ** c but in the other case and search the input string for either + ** c or cx. + */ + if c < uint32(0x80) { + if noCase != 0 { + (*(*[3]int8)(unsafe.Pointer(bp + 18)))[0] = int8(c & uint32(^(int32(_sqlite3CtypeMap[uint8(c)]) & libc.Int32FromInt32(0x20)))) + (*(*[3]int8)(unsafe.Pointer(bp + 18)))[int32(1)] = int8(_sqlite3UpperToLower[uint8(c)]) + (*(*[3]int8)(unsafe.Pointer(bp + 18)))[int32(2)] = 0 + } else { + (*(*[3]int8)(unsafe.Pointer(bp + 18)))[0] = int8(c) + (*(*[3]int8)(unsafe.Pointer(bp + 18)))[int32(1)] = 0 + } + for int32(1) != 0 { + *(*uintptr)(unsafe.Pointer(bp + 8)) += uintptr(libc.Xstrcspn(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+18)) + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8))))) == 0 { + break + } + *(*uintptr)(unsafe.Pointer(bp + 8))++ + bMatch1 = _patternCompare(tls, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), pInfo, matchOther) + if bMatch1 != int32(SQLITE_NOMATCH) { + return bMatch1 + } + } + } else { + for { + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8))))) < int32(0x80) { + v10 = *(*uintptr)(unsafe.Pointer(bp + 8)) + *(*uintptr)(unsafe.Pointer(bp + 8))++ + v9 = uint32(*(*Tu8)(unsafe.Pointer(v10))) + } else { + v9 = _sqlite3Utf8Read(tls, bp+8) + } + v8 = v9 + c2 = v8 + if !(v8 != uint32(0)) { + break + } + if c2 != c { + continue + } + bMatch2 = _patternCompare(tls, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), pInfo, matchOther) + if bMatch2 != int32(SQLITE_NOMATCH) { + return bMatch2 + } + } + } + return int32(SQLITE_NOWILDCARDMATCH) + } + if c == matchOther { + if int32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchSet) == 0 { + c = _sqlite3Utf8Read(tls, bp) + if c == uint32(0) { + return int32(SQLITE_NOMATCH) + } + zEscaped = *(*uintptr)(unsafe.Pointer(bp)) + } else { + prior_c = uint32(0) + seen = 0 + invert = 0 + c = _sqlite3Utf8Read(tls, bp+8) + if c == uint32(0) { + return int32(SQLITE_NOMATCH) + } + c2 = _sqlite3Utf8Read(tls, bp) + if c2 == uint32('^') { + invert = int32(1) + c2 = _sqlite3Utf8Read(tls, bp) + } + if c2 == uint32(']') { + if c == uint32(']') { + seen = int32(1) + } + c2 = _sqlite3Utf8Read(tls, bp) + } + for c2 != 0 && c2 != uint32(']') { + if c2 == uint32('-') && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32(']') && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0 && prior_c > uint32(0) { + c2 = _sqlite3Utf8Read(tls, bp) + if c >= prior_c && c <= c2 { + seen = int32(1) + } + prior_c = uint32(0) + } else { + if c == c2 { + seen = int32(1) + } + prior_c = c2 + } + c2 = _sqlite3Utf8Read(tls, bp) + } + if c2 == uint32(0) || seen^invert == 0 { + return int32(SQLITE_NOMATCH) + } + continue + } + } + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8))))) < int32(0x80) { + v12 = *(*uintptr)(unsafe.Pointer(bp + 8)) + *(*uintptr)(unsafe.Pointer(bp + 8))++ + v11 = uint32(*(*Tu8)(unsafe.Pointer(v12))) + } else { + v11 = _sqlite3Utf8Read(tls, bp+8) + } + c2 = v11 + if c == c2 { + continue + } + if noCase != 0 && int32(_sqlite3UpperToLower[uint8(c)]) == int32(_sqlite3UpperToLower[uint8(c2)]) && c < uint32(0x80) && c2 < uint32(0x80) { + continue + } + if c == matchOne && *(*uintptr)(unsafe.Pointer(bp)) != zEscaped && c2 != uint32(0) { + continue + } + return int32(SQLITE_NOMATCH) + } + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8))))) == 0 { + v13 = SQLITE_MATCH + } else { + v13 = int32(SQLITE_NOMATCH) + } + return v13 +} + +// C documentation +// +// /* +// ** The sqlite3_strglob() interface. Return 0 on a match (like strcmp()) and +// ** non-zero if there is no match. +// */ +func Xsqlite3_strglob(tls *libc.TLS, zGlobPattern uintptr, zString uintptr) (r int32) { + if zString == uintptr(0) { + return libc.BoolInt32(zGlobPattern != uintptr(0)) + } else { + if zGlobPattern == uintptr(0) { + return int32(1) + } else { + return _patternCompare(tls, zGlobPattern, zString, uintptr(unsafe.Pointer(&_globInfo)), uint32('[')) + } + } + return r +} + +// C documentation +// +// /* +// ** The sqlite3_strlike() interface. Return 0 on a match and non-zero for +// ** a miss - like strcmp(). +// */ +func Xsqlite3_strlike(tls *libc.TLS, zPattern uintptr, zStr uintptr, esc uint32) (r int32) { + if zStr == uintptr(0) { + return libc.BoolInt32(zPattern != uintptr(0)) + } else { + if zPattern == uintptr(0) { + return int32(1) + } else { + return _patternCompare(tls, zPattern, zStr, uintptr(unsafe.Pointer(&_likeInfoNorm)), esc) + } + } + return r +} + +/* +** Count the number of times that the LIKE operator (or GLOB which is +** just a variation of LIKE) gets called. This is used for testing +** only. + */ + +// C documentation +// +// /* +// ** Implementation of the like() SQL function. This function implements +// ** the built-in LIKE operator. The first argument to the function is the +// ** pattern and the second argument is the string. So, the SQL statements: +// ** +// ** A LIKE B +// ** +// ** is implemented as like(B,A). +// ** +// ** This same function (with a different compareInfo structure) computes +// ** the GLOB operator. +// */ +func _likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pInfo, zA, zB uintptr + var escape Tu32 + var nPat int32 + var _ /* backupInfo at bp+0 */ TcompareInfo + var _ /* zEsc at bp+8 */ uintptr + _, _, _, _, _, _ = db, escape, nPat, pInfo, zA, zB + db = Xsqlite3_context_db_handle(tls, context) + pInfo = Xsqlite3_user_data(tls, context) + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_BLOB) || Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == int32(SQLITE_BLOB) { + Xsqlite3_result_int(tls, context, 0) + return + } + /* Limit the length of the LIKE or GLOB pattern to avoid problems + ** of deep recursion and N*N behavior in patternCompare(). + */ + nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if nPat > *(*int32)(unsafe.Pointer(db + 136 + 8*4)) { + Xsqlite3_result_error(tls, context, __ccgo_ts+15277, -int32(1)) + return + } + if argc == int32(3) { + /* The escape character string must consist of a single UTF-8 character. + ** Otherwise, return an error. + */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + if *(*uintptr)(unsafe.Pointer(bp + 8)) == uintptr(0) { + return + } + if _sqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) != int32(1) { + Xsqlite3_result_error(tls, context, __ccgo_ts+15310, -int32(1)) + return + } + escape = _sqlite3Utf8Read(tls, bp+8) + if escape == uint32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchAll) || escape == uint32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchOne) { + libc.Xmemcpy(tls, bp, pInfo, uint64(4)) + pInfo = bp + if escape == uint32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchAll) { + (*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchAll = uint8(0) + } + if escape == uint32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchOne) { + (*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchOne = uint8(0) + } + } + } else { + escape = uint32((*TcompareInfo)(unsafe.Pointer(pInfo)).FmatchSet) + } + zB = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zA = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zA != 0 && zB != 0 { + Xsqlite3_result_int(tls, context, libc.BoolInt32(_patternCompare(tls, zB, zA, pInfo, escape) == SQLITE_MATCH)) + } +} + +// C documentation +// +// /* +// ** Implementation of the NULLIF(x,y) function. The result is the first +// ** argument if the arguments are different. The result is NULL if the +// ** arguments are equal to each other. +// */ +func _nullifFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + var pColl uintptr + _ = pColl + pColl = _sqlite3GetFuncCollSeq(tls, context) + _ = NotUsed + if _sqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*uintptr)(unsafe.Pointer(argv + 1*8)), pColl) != 0 { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + } +} + +// C documentation +// +// /* +// ** Implementation of the sqlite_version() function. The result is the version +// ** of the SQLite library that is running. +// */ +func _versionFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + _ = NotUsed + _ = NotUsed2 + /* IMP: R-48699-48617 This function is an SQL wrapper around the + ** sqlite3_libversion() C-interface. */ + Xsqlite3_result_text(tls, context, Xsqlite3_libversion(tls), -int32(1), libc.UintptrFromInt32(0)) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite_source_id() function. The result is a string +// ** that identifies the particular version of the source code used to build +// ** SQLite. +// */ +func _sourceidFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + _ = NotUsed + _ = NotUsed2 + /* IMP: R-24470-31136 This function is an SQL wrapper around the + ** sqlite3_sourceid() C interface. */ + Xsqlite3_result_text(tls, context, Xsqlite3_sourceid(tls), -int32(1), libc.UintptrFromInt32(0)) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite_log() function. This is a wrapper around +// ** sqlite3_log(). The return value is NULL. The function exists purely for +// ** its side-effects. +// */ +func _errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + _ = argc + _ = context + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) +} + +// C documentation +// +// /* +// ** Implementation of the sqlite_compileoption_used() function. +// ** The result is an integer that identifies if the compiler option +// ** was used to build SQLite. +// */ +func _compileoptionusedFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var zOptName, v1 uintptr + _, _ = zOptName, v1 + _ = argc + /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL + ** function is a wrapper around the sqlite3_compileoption_used() C/C++ + ** function. + */ + v1 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zOptName = v1 + if v1 != uintptr(0) { + Xsqlite3_result_int(tls, context, Xsqlite3_compileoption_used(tls, zOptName)) + } +} + +// C documentation +// +// /* +// ** Implementation of the sqlite_compileoption_get() function. +// ** The result is a string that identifies the compiler options +// ** used to build SQLite. +// */ +func _compileoptiongetFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var n int32 + _ = n + _ = argc + /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function + ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. + */ + n = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, Xsqlite3_compileoption_get(tls, n), -int32(1), libc.UintptrFromInt32(0)) +} + +// C documentation +// +// /* Array for converting from half-bytes (nybbles) into ASCII hex +// ** digits. */ +var _hexdigits = [16]int8{ + 0: int8('0'), + 1: int8('1'), + 2: int8('2'), + 3: int8('3'), + 4: int8('4'), + 5: int8('5'), + 6: int8('6'), + 7: int8('7'), + 8: int8('8'), + 9: int8('9'), + 10: int8('A'), + 11: int8('B'), + 12: int8('C'), + 13: int8('D'), + 14: int8('E'), + 15: int8('F'), +} + +// C documentation +// +// /* +// ** Append to pStr text that is the SQL literal representation of the +// ** value contained in pValue. +// */ +func _sqlite3QuoteValue(tls *libc.TLS, pStr uintptr, pValue uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var nBlob Ti64 + var r1 float64 + var zArg, zBlob, zText, zVal uintptr + var _ /* r2 at bp+0 */ float64 + _, _, _, _, _, _, _ = i, nBlob, r1, zArg, zBlob, zText, zVal + /* As currently implemented, the string must be initially empty. + ** we might relax this requirement in the future, but that will + ** require enhancements to the implementation. */ + switch Xsqlite3_value_type(tls, pValue) { + case int32(SQLITE_FLOAT): + r1 = Xsqlite3_value_double(tls, pValue) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15355, libc.VaList(bp+16, r1)) + zVal = Xsqlite3_str_value(tls, pStr) + if zVal != 0 { + _sqlite3AtoF(tls, zVal, bp, int32((*TStrAccum)(unsafe.Pointer(pStr)).FnChar), uint8(SQLITE_UTF8)) + if r1 != *(*float64)(unsafe.Pointer(bp)) { + Xsqlite3_str_reset(tls, pStr) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15363, libc.VaList(bp+16, r1)) + } + } + case int32(SQLITE_INTEGER): + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+1436, libc.VaList(bp+16, Xsqlite3_value_int64(tls, pValue))) + case int32(SQLITE_BLOB): + zBlob = Xsqlite3_value_blob(tls, pValue) + nBlob = int64(Xsqlite3_value_bytes(tls, pValue)) + /* No encoding change */ + _sqlite3StrAccumEnlarge(tls, pStr, nBlob*int64(2)+int64(4)) + if int32((*TStrAccum)(unsafe.Pointer(pStr)).FaccError) == 0 { + zText = (*TStrAccum)(unsafe.Pointer(pStr)).FzText + i = 0 + for { + if !(int64(i) < nBlob) { + break + } + *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(2)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))>>int32(4)&int32(0x0F)] + *(*int8)(unsafe.Pointer(zText + uintptr(i*int32(2)+int32(3)))) = _hexdigits[int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))&int32(0x0F)] + goto _1 + _1: + ; + i++ + } + *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(2)))) = int8('\'') + *(*int8)(unsafe.Pointer(zText + uintptr(nBlob*int64(2)+int64(3)))) = int8('\000') + *(*int8)(unsafe.Pointer(zText)) = int8('X') + *(*int8)(unsafe.Pointer(zText + 1)) = int8('\'') + (*TStrAccum)(unsafe.Pointer(pStr)).FnChar = uint32(nBlob*int64(2) + int64(3)) + } + case int32(SQLITE_TEXT): + zArg = Xsqlite3_value_text(tls, pValue) + Xsqlite3_str_appendf(tls, pStr, __ccgo_ts+15371, libc.VaList(bp+16, zArg)) + default: + Xsqlite3_str_append(tls, pStr, __ccgo_ts+1681, int32(4)) + break + } +} + +// C documentation +// +// /* +// ** Implementation of the QUOTE() function. +// ** +// ** The quote(X) function returns the text of an SQL literal which is the +// ** value of its argument suitable for inclusion into an SQL statement. +// ** Strings are surrounded by single-quotes with escapes on interior quotes +// ** as needed. BLOBs are encoded as hexadecimal literals. Strings with +// ** embedded NUL characters cannot be represented as string literals in SQL +// ** and hence the returned string literal is truncated prior to the first NUL. +// */ +func _quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db uintptr + var _ /* str at bp+0 */ Tsqlite3_str + _ = db + db = Xsqlite3_context_db_handle(tls, context) + _ = argc + _sqlite3StrAccumInit(tls, bp, db, uintptr(0), 0, *(*int32)(unsafe.Pointer(db + 136))) + _sqlite3QuoteValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, _sqlite3StrAccumFinish(tls, bp), int32((*(*Tsqlite3_str)(unsafe.Pointer(bp))).FnChar), __ccgo_fp(_sqlite3OomClear)) + if int32((*(*Tsqlite3_str)(unsafe.Pointer(bp))).FaccError) != SQLITE_OK { + Xsqlite3_result_null(tls, context) + Xsqlite3_result_error_code(tls, context, int32((*(*Tsqlite3_str)(unsafe.Pointer(bp))).FaccError)) + } +} + +// C documentation +// +// /* +// ** The unicode() function. Return the integer unicode code-point value +// ** for the first character of the input string. +// */ +func _unicodeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* z at bp+0 */ uintptr + *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + _ = argc + if *(*uintptr)(unsafe.Pointer(bp)) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != 0 { + Xsqlite3_result_int(tls, context, int32(_sqlite3Utf8Read(tls, bp))) + } +} + +// C documentation +// +// /* +// ** The char() function takes zero or more arguments, each of which is +// ** an integer. It constructs a string where each character of the string +// ** is the unicode character for the corresponding integer argument. +// */ +func _charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var c uint32 + var i int32 + var x Tsqlite3_int64 + var z, zOut, v1, v10, v11, v12, v3, v4, v5, v6, v7, v8, v9 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, i, x, z, zOut, v1, v10, v11, v12, v3, v4, v5, v6, v7, v8, v9 + v1 = Xsqlite3_malloc64(tls, uint64(argc*int32(4)+int32(1))) + z = v1 + zOut = v1 + if z == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + i = 0 + for { + if !(i < argc) { + break + } + x = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if x < 0 || x > int64(0x10ffff) { + x = int64(0xfffd) + } + c = uint32(x & libc.Int64FromInt32(0x1fffff)) + if c < uint32(0x00080) { + v3 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v3)) = uint8(c & libc.Uint32FromInt32(0xFF)) + } else { + if c < uint32(0x00800) { + v4 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v4)) = uint8(int32(0xC0) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x1F)))) + v5 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v5)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + if c < uint32(0x10000) { + v6 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v6)) = uint8(int32(0xE0) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x0F)))) + v7 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v7)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v8 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v8)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } else { + v9 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v9)) = uint8(int32(0xF0) + int32(uint8(c>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x07)))) + v10 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v10)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x3F)))) + v11 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v11)) = uint8(int32(0x80) + int32(uint8(c>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3F)))) + v12 = zOut + zOut++ + *(*uint8)(unsafe.Pointer(v12)) = uint8(int32(0x80) + int32(uint8(c&libc.Uint32FromInt32(0x3F)))) + } + } + } + goto _2 + _2: + ; + i++ + } + *(*uint8)(unsafe.Pointer(zOut)) = uint8(0) + Xsqlite3_result_text64(tls, context, z, uint64(int64(zOut)-int64(z)), __ccgo_fp(Xsqlite3_free), uint8(SQLITE_UTF8)) +} + +// C documentation +// +// /* +// ** The hex() function. Interpret the argument as a blob. Return +// ** a hexadecimal rendering as text. +// */ +func _hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var c uint8 + var i, n int32 + var pBlob, z, zHex, v1, v3, v4 uintptr + _, _, _, _, _, _, _, _, _ = c, i, n, pBlob, z, zHex, v1, v3, v4 + _ = argc + pBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* No encoding change */ + v1 = _contextMalloc(tls, context, int64(n)*int64(2)+int64(1)) + zHex = v1 + z = v1 + if zHex != 0 { + i = 0 + for { + if !(i < n) { + break + } + c = *(*uint8)(unsafe.Pointer(pBlob)) + v3 = z + z++ + *(*int8)(unsafe.Pointer(v3)) = _hexdigits[int32(c)>>int32(4)&int32(0xf)] + v4 = z + z++ + *(*int8)(unsafe.Pointer(v4)) = _hexdigits[int32(c)&int32(0xf)] + goto _2 + _2: + ; + i++ + pBlob++ + } + *(*int8)(unsafe.Pointer(z)) = 0 + Xsqlite3_result_text64(tls, context, zHex, uint64(int64(z)-int64(zHex)), __ccgo_fp(Xsqlite3_free), uint8(SQLITE_UTF8)) + } +} + +// C documentation +// +// /* +// ** Buffer zStr contains nStr bytes of utf-8 encoded text. Return 1 if zStr +// ** contains character ch, or 0 if it does not. +// */ +func _strContainsChar(tls *libc.TLS, zStr uintptr, nStr int32, ch Tu32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var tst Tu32 + var zEnd, v2 uintptr + var v1 uint32 + var _ /* z at bp+0 */ uintptr + _, _, _, _ = tst, zEnd, v1, v2 + zEnd = zStr + uintptr(nStr) + *(*uintptr)(unsafe.Pointer(bp)) = zStr + for *(*uintptr)(unsafe.Pointer(bp)) < zEnd { + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) < int32(0x80) { + v2 = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp))++ + v1 = uint32(*(*Tu8)(unsafe.Pointer(v2))) + } else { + v1 = _sqlite3Utf8Read(tls, bp) + } + tst = v1 + if tst == ch { + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** The unhex() function. This function may be invoked with either one or +// ** two arguments. In both cases the first argument is interpreted as text +// ** a text value containing a set of pairs of hexadecimal digits which are +// ** decoded and returned as a blob. +// ** +// ** If there is only a single argument, then it must consist only of an +// ** even number of hexadecimal digits. Otherwise, return NULL. +// ** +// ** Or, if there is a second argument, then any character that appears in +// ** the second argument is also allowed to appear between pairs of hexadecimal +// ** digits in the first argument. If any other character appears in the +// ** first argument, or if one of the allowed characters appears between +// ** two hexadecimal digits that make up a single byte, NULL is returned. +// ** +// ** The following expressions are all true: +// ** +// ** unhex('ABCD') IS x'ABCD' +// ** unhex('AB CD') IS NULL +// ** unhex('AB CD', ' ') IS x'ABCD' +// ** unhex('A BCD', ' ') IS NULL +// */ +func _unhexFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, d, v2 Tu8 + var ch Tu32 + var nHex, nPass int32 + var p, pBlob, zPass, v1, v4, v5, v6 uintptr + var v3 uint32 + var _ /* zHex at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, ch, d, nHex, nPass, p, pBlob, zPass, v1, v2, v3, v4, v5, v6 + zPass = __ccgo_ts + 1680 + nPass = 0 + *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + nHex = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + pBlob = uintptr(0) + p = uintptr(0) + if argc == int32(2) { + zPass = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + nPass = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } + if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) || !(zPass != 0) { + return + } + v1 = _contextMalloc(tls, pCtx, int64(nHex/int32(2)+int32(1))) + pBlob = v1 + p = v1 + if pBlob != 0 { /* Least significant digit of next byte */ + for { + v2 = *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) + c = v2 + if !(int32(v2) != 0x00) { + break + } + for !(int32(_sqlite3CtypeMap[c])&libc.Int32FromInt32(0x08) != 0) { + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) < int32(0x80) { + v4 = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp))++ + v3 = uint32(*(*Tu8)(unsafe.Pointer(v4))) + } else { + v3 = _sqlite3Utf8Read(tls, bp) + } + ch = v3 + if !(_strContainsChar(tls, zPass, nPass, ch) != 0) { + goto unhex_null + } + c = *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) + if int32(c) == 0x00 { + goto unhex_done + } + } + *(*uintptr)(unsafe.Pointer(bp))++ + v5 = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp))++ + d = *(*Tu8)(unsafe.Pointer(v5)) + if !(int32(_sqlite3CtypeMap[d])&libc.Int32FromInt32(0x08) != 0) { + goto unhex_null + } + v6 = p + p++ + *(*Tu8)(unsafe.Pointer(v6)) = uint8(int32(_sqlite3HexToInt(tls, int32(c)))< nPattern { + nOut += int64(nRep - nPattern) + if nOut-int64(1) > int64(*(*int32)(unsafe.Pointer(db + 136))) { + Xsqlite3_result_error_toobig(tls, context) + Xsqlite3_free(tls, zOut) + return + } + cntExpand++ + if cntExpand&(cntExpand-uint32(1)) == uint32(0) { + zOld = zOut + zOut = _sqlite3Realloc(tls, zOut, uint64(int64(int32(nOut))+(nOut-int64(nStr)-int64(1)))) + if zOut == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + Xsqlite3_free(tls, zOld) + return + } + } + } + libc.Xmemcpy(tls, zOut+uintptr(j), zRep, uint64(nRep)) + j += nRep + i += nPattern - int32(1) + } + goto _1 + _1: + ; + i++ + } + libc.Xmemcpy(tls, zOut+uintptr(j), zStr+uintptr(i), uint64(nStr-i)) + j += nStr - i + *(*uint8)(unsafe.Pointer(zOut + uintptr(j))) = uint8(0) + Xsqlite3_result_text(tls, context, zOut, j, __ccgo_fp(Xsqlite3_free)) +} + +// C documentation +// +// /* +// ** Implementation of the TRIM(), LTRIM(), and RTRIM() functions. +// ** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both. +// */ +func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var aLen, azChar, z, zCharSet, zIn, v1, v3, v5 uintptr + var flags, i, nChar int32 + var len1, len11, nIn uint32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aLen, azChar, flags, i, len1, len11, nChar, nIn, z, zCharSet, zIn, v1, v3, v5 /* Loop counter */ + aLen = uintptr(0) /* Length of each character in zCharSet */ + azChar = uintptr(0) /* Number of characters in zCharSet */ + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { + return + } + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn == uintptr(0) { + return + } + nIn = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + if argc == int32(1) { + nChar = int32(1) + aLen = uintptr(unsafe.Pointer(&_lenOne)) + azChar = uintptr(unsafe.Pointer(&_azOne)) + zCharSet = uintptr(0) + } else { + v1 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + zCharSet = v1 + if v1 == uintptr(0) { + return + } else { + z = zCharSet + nChar = libc.Int32FromInt32(0) + for { + if !(*(*uint8)(unsafe.Pointer(z)) != 0) { + break + } + v3 = z + z++ + if int32(*(*uint8)(unsafe.Pointer(v3))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + } + } + goto _2 + _2: + ; + nChar++ + } + if nChar > 0 { + azChar = _contextMalloc(tls, context, int64(uint64(int64(nChar))*(libc.Uint64FromInt64(8)+libc.Uint64FromInt64(4)))) + if azChar == uintptr(0) { + return + } + aLen = azChar + uintptr(nChar)*8 + z = zCharSet + nChar = libc.Int32FromInt32(0) + for { + if !(*(*uint8)(unsafe.Pointer(z)) != 0) { + break + } + *(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)) = z + v5 = z + z++ + if int32(*(*uint8)(unsafe.Pointer(v5))) >= int32(0xc0) { + for int32(*(*uint8)(unsafe.Pointer(z)))&int32(0xc0) == int32(0x80) { + z++ + } + } + *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = uint32(int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) + goto _4 + _4: + ; + nChar++ + } + } + } + } + if nChar > 0 { + flags = int32(int64(Xsqlite3_user_data(tls, context))) + if flags&int32(1) != 0 { + for nIn > uint32(0) { + len1 = uint32(0) + i = 0 + for { + if !(i < nChar) { + break + } + len1 = *(*uint32)(unsafe.Pointer(aLen + uintptr(i)*4)) + if len1 <= nIn && libc.Xmemcmp(tls, zIn, *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len1)) == 0 { + break + } + goto _6 + _6: + ; + i++ + } + if i >= nChar { + break + } + zIn += uintptr(len1) + nIn -= len1 + } + } + if flags&int32(2) != 0 { + for nIn > uint32(0) { + len11 = uint32(0) + i = 0 + for { + if !(i < nChar) { + break + } + len11 = *(*uint32)(unsafe.Pointer(aLen + uintptr(i)*4)) + if len11 <= nIn && libc.Xmemcmp(tls, zIn+uintptr(nIn-len11), *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len11)) == 0 { + break + } + goto _7 + _7: + ; + i++ + } + if i >= nChar { + break + } + nIn -= len11 + } + } + if zCharSet != 0 { + Xsqlite3_free(tls, azChar) + } + } + Xsqlite3_result_text(tls, context, zIn, int32(nIn), uintptr(-libc.Int32FromInt32(1))) +} + +var _lenOne = [1]uint32{ + 0: uint32(1), +} + +var _azOne = [1]uintptr{ + 0: __ccgo_ts + 11234, +} + +// C documentation +// +// /* The core implementation of the CONCAT(...) and CONCAT_WS(SEP,...) +// ** functions. +// ** +// ** Return a string value that is the concatenation of all non-null +// ** entries in argv[]. Use zSep as the separator. +// */ +func _concatFuncCore(tls *libc.TLS, context uintptr, argc int32, argv uintptr, nSep int32, zSep uintptr) { + var i int32 + var j, k, n Ti64 + var v, z uintptr + _, _, _, _, _, _ = i, j, k, n, v, z + n = 0 + i = 0 + for { + if !(i < argc) { + break + } + n += int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + goto _1 + _1: + ; + i++ + } + n += int64((argc - int32(1)) * nSep) + z = Xsqlite3_malloc64(tls, uint64(n+int64(1))) + if z == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + j = 0 + i = 0 + for { + if !(i < argc) { + break + } + k = int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + if k > 0 { + v = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if v != uintptr(0) { + if j > 0 && nSep > 0 { + libc.Xmemcpy(tls, z+uintptr(j), zSep, uint64(nSep)) + j += int64(nSep) + } + libc.Xmemcpy(tls, z+uintptr(j), v, uint64(k)) + j += k + } + } + goto _2 + _2: + ; + i++ + } + *(*int8)(unsafe.Pointer(z + uintptr(j))) = 0 + Xsqlite3_result_text64(tls, context, z, uint64(j), __ccgo_fp(Xsqlite3_free), uint8(SQLITE_UTF8)) +} + +// C documentation +// +// /* +// ** The CONCAT(...) function. Generate a string result that is the +// ** concatentation of all non-null arguments. +// */ +func _concatFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + _concatFuncCore(tls, context, argc, argv, 0, __ccgo_ts+1680) +} + +// C documentation +// +// /* +// ** The CONCAT_WS(separator, ...) function. +// ** +// ** Generate a string that is the concatenation of 2nd through the Nth +// ** argument. Use the first argument (which must be non-NULL) as the +// ** separator. +// */ +func _concatwsFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var nSep int32 + var zSep uintptr + _, _ = nSep, zSep + nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zSep == uintptr(0) { + return + } + _concatFuncCore(tls, context, argc-int32(1), argv+uintptr(1)*8, nSep, zSep) +} + +// C documentation +// +// /* IMP: R-25361-16150 This function is omitted from SQLite by default. It +// ** is only available if the SQLITE_SOUNDEX compile-time option is used +// ** when SQLite is built. +// */ +// /* +// ** Compute the soundex encoding of a word. +// ** +// ** IMP: R-59782-00072 The soundex(X) function returns a string that is the +// ** soundex encoding of the string X. +// */ +func _soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var code, i, j, v3, v4 int32 + var prevcode Tu8 + var zIn uintptr + var _ /* zResult at bp+0 */ [8]int8 + _, _, _, _, _, _, _ = code, i, j, prevcode, zIn, v3, v4 + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn == uintptr(0) { + zIn = __ccgo_ts + 1680 + } + i = 0 + for { + if !(*(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 && !(int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(zIn + uintptr(i)))])&libc.Int32FromInt32(0x02) != 0)) { + break + } + goto _1 + _1: + ; + i++ + } + if *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { + prevcode = _iCode[int32(*(*Tu8)(unsafe.Pointer(zIn + uintptr(i))))&int32(0x7f)] + (*(*[8]int8)(unsafe.Pointer(bp)))[0] = int8(int32(*(*Tu8)(unsafe.Pointer(zIn + uintptr(i)))) & ^(int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(zIn + uintptr(i)))]) & libc.Int32FromInt32(0x20))) + j = int32(1) + for { + if !(j < int32(4) && *(*Tu8)(unsafe.Pointer(zIn + uintptr(i))) != 0) { + break + } + code = int32(_iCode[int32(*(*Tu8)(unsafe.Pointer(zIn + uintptr(i))))&int32(0x7f)]) + if code > 0 { + if code != int32(prevcode) { + prevcode = uint8(code) + v3 = j + j++ + (*(*[8]int8)(unsafe.Pointer(bp)))[v3] = int8(code + int32('0')) + } + } else { + prevcode = uint8(0) + } + goto _2 + _2: + ; + i++ + } + for j < int32(4) { + v4 = j + j++ + (*(*[8]int8)(unsafe.Pointer(bp)))[v4] = int8('0') + } + (*(*[8]int8)(unsafe.Pointer(bp)))[j] = 0 + Xsqlite3_result_text(tls, context, bp, int32(4), uintptr(-libc.Int32FromInt32(1))) + } else { + /* IMP: R-64894-50321 The string "?000" is returned if the argument + ** is NULL or contains no ASCII alphabetic characters. */ + Xsqlite3_result_text(tls, context, __ccgo_ts+15374, int32(4), libc.UintptrFromInt32(0)) + } +} + +var _iCode = [128]uint8{ + 66: uint8(1), + 67: uint8(2), + 68: uint8(3), + 70: uint8(1), + 71: uint8(2), + 74: uint8(2), + 75: uint8(2), + 76: uint8(4), + 77: uint8(5), + 78: uint8(5), + 80: uint8(1), + 81: uint8(2), + 82: uint8(6), + 83: uint8(2), + 84: uint8(3), + 86: uint8(1), + 88: uint8(2), + 90: uint8(2), + 98: uint8(1), + 99: uint8(2), + 100: uint8(3), + 102: uint8(1), + 103: uint8(2), + 106: uint8(2), + 107: uint8(2), + 108: uint8(4), + 109: uint8(5), + 110: uint8(5), + 112: uint8(1), + 113: uint8(2), + 114: uint8(6), + 115: uint8(2), + 116: uint8(3), + 118: uint8(1), + 120: uint8(2), + 122: uint8(2), +} + +// C documentation +// +// /* +// ** A function that loads a shared-library extension then returns NULL. +// */ +func _loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, zFile, zProc uintptr + var _ /* zErrMsg at bp+0 */ uintptr + _, _, _ = db, zFile, zProc + zFile = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + db = Xsqlite3_context_db_handle(tls, context) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + /* Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc + ** flag is set. See the sqlite3_enable_load_extension() API. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtFunc) == uint64(0) { + Xsqlite3_result_error(tls, context, __ccgo_ts+12452, -int32(1)) + return + } + if argc == int32(2) { + zProc = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } else { + zProc = uintptr(0) + } + if zFile != 0 && Xsqlite3_load_extension(tls, db, zFile, zProc, bp) != 0 { + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp)), -int32(1)) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + } +} + +// C documentation +// +// /* +// ** An instance of the following structure holds the context of a +// ** sum() or avg() aggregate computation. +// */ +type TSumCtx = struct { + FrSum float64 + FrErr float64 + FiSum Ti64 + Fcnt Ti64 + Fapprox Tu8 + Fovrfl Tu8 +} + +type SumCtx = TSumCtx + +type TSumCtx1 = struct { + FrSum float64 + FrErr float64 + FiSum Ti64 + Fcnt Ti64 + Fapprox Tu8 + Fovrfl Tu8 +} + +type SumCtx1 = TSumCtx1 + +// C documentation +// +// /* +// ** Do one step of the Kahan-Babushka-Neumaier summation. +// ** +// ** https://en.wikipedia.org/wiki/Kahan_summation_algorithm +// ** +// ** Variables are marked "volatile" to defeat c89 x86 floating point +// ** optimizations can mess up this algorithm. +// */ +func _kahanBabuskaNeumaierStep(tls *libc.TLS, pSum uintptr, r float64) { + var s, t float64 + _, _ = s, t + s = (*TSumCtx)(unsafe.Pointer(pSum)).FrSum + t = s + r + if libc.Xfabs(tls, s) > libc.Xfabs(tls, r) { + *(*float64)(unsafe.Pointer(pSum + 8)) += s - t + r + } else { + *(*float64)(unsafe.Pointer(pSum + 8)) += r - t + s + } + (*TSumCtx)(unsafe.Pointer(pSum)).FrSum = t +} + +// C documentation +// +// /* +// ** Add a (possibly large) integer to the running sum. +// */ +func _kahanBabuskaNeumaierStepInt64(tls *libc.TLS, pSum uintptr, iVal Ti64) { + var iBig, iSm Ti64 + _, _ = iBig, iSm + if iVal <= -int64(4503599627370496) || iVal >= +libc.Int64FromInt64(4503599627370496) { + iSm = iVal % int64(16384) + iBig = iVal - iSm + _kahanBabuskaNeumaierStep(tls, pSum, float64(iBig)) + _kahanBabuskaNeumaierStep(tls, pSum, float64(iSm)) + } else { + _kahanBabuskaNeumaierStep(tls, pSum, float64(iVal)) + } +} + +// C documentation +// +// /* +// ** Initialize the Kahan-Babaska-Neumaier sum from a 64-bit integer +// */ +func _kahanBabuskaNeumaierInit(tls *libc.TLS, p uintptr, iVal Ti64) { + var iSm Ti64 + _ = iSm + if iVal <= -int64(4503599627370496) || iVal >= +libc.Int64FromInt64(4503599627370496) { + iSm = iVal % int64(16384) + (*TSumCtx)(unsafe.Pointer(p)).FrSum = float64(iVal - iSm) + (*TSumCtx)(unsafe.Pointer(p)).FrErr = float64(iSm) + } else { + (*TSumCtx)(unsafe.Pointer(p)).FrSum = float64(iVal) + (*TSumCtx)(unsafe.Pointer(p)).FrErr = float64(0) + } +} + +// C documentation +// +// /* +// ** Routines used to compute the sum, average, and total. +// ** +// ** The SUM() function follows the (broken) SQL standard which means +// ** that it returns NULL if it sums over no inputs. TOTAL returns +// ** 0.0 in that case. In addition, TOTAL always returns a float where +// ** SUM might return an integer if it never encounters a floating point +// ** value. TOTAL never fails, but SUM might through an exception if +// ** it overflows an integer. +// */ +func _sumStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var type1 int32 + var _ /* x at bp+0 */ Ti64 + _, _ = p, type1 + _ = argc + p = Xsqlite3_aggregate_context(tls, context, int32(40)) + type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if p != 0 && type1 != int32(SQLITE_NULL) { + (*TSumCtx)(unsafe.Pointer(p)).Fcnt++ + if int32((*TSumCtx)(unsafe.Pointer(p)).Fapprox) == 0 { + if type1 != int32(SQLITE_INTEGER) { + _kahanBabuskaNeumaierInit(tls, p, (*TSumCtx)(unsafe.Pointer(p)).FiSum) + (*TSumCtx)(unsafe.Pointer(p)).Fapprox = uint8(1) + _kahanBabuskaNeumaierStep(tls, p, Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } else { + *(*Ti64)(unsafe.Pointer(bp)) = (*TSumCtx)(unsafe.Pointer(p)).FiSum + if _sqlite3AddInt64(tls, bp, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))) == 0 { + (*TSumCtx)(unsafe.Pointer(p)).FiSum = *(*Ti64)(unsafe.Pointer(bp)) + } else { + (*TSumCtx)(unsafe.Pointer(p)).Fovrfl = uint8(1) + _kahanBabuskaNeumaierInit(tls, p, (*TSumCtx)(unsafe.Pointer(p)).FiSum) + (*TSumCtx)(unsafe.Pointer(p)).Fapprox = uint8(1) + _kahanBabuskaNeumaierStepInt64(tls, p, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } + } + } else { + if type1 == int32(SQLITE_INTEGER) { + _kahanBabuskaNeumaierStepInt64(tls, p, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } else { + (*TSumCtx)(unsafe.Pointer(p)).Fovrfl = uint8(0) + _kahanBabuskaNeumaierStep(tls, p, Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } + } + } +} + +func _sumInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var iVal Ti64 + var p uintptr + var type1 int32 + _, _, _ = iVal, p, type1 + _ = argc + p = Xsqlite3_aggregate_context(tls, context, int32(40)) + type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + /* p is always non-NULL because sumStep() will have been called first + ** to initialize it */ + if p != 0 && type1 != int32(SQLITE_NULL) { + (*TSumCtx)(unsafe.Pointer(p)).Fcnt-- + if !((*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0) { + *(*Ti64)(unsafe.Pointer(p + 16)) -= Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + } else { + if type1 == int32(SQLITE_INTEGER) { + iVal = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + if iVal != int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< 0 { + if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { + if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { + Xsqlite3_result_error(tls, context, __ccgo_ts+15254, -int32(1)) + } else { + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) + } else { + Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) + } + } + } else { + Xsqlite3_result_int64(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FiSum) + } + } +} + +func _avgFinalize(tls *libc.TLS, context uintptr) { + var p uintptr + var r float64 + _, _ = p, r + p = Xsqlite3_aggregate_context(tls, context, 0) + if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { + if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { + r = (*TSumCtx)(unsafe.Pointer(p)).FrSum + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + r += (*TSumCtx)(unsafe.Pointer(p)).FrErr + } + } else { + r = float64((*TSumCtx)(unsafe.Pointer(p)).FiSum) + } + Xsqlite3_result_double(tls, context, r/float64((*TSumCtx)(unsafe.Pointer(p)).Fcnt)) + } +} + +func _totalFinalize(tls *libc.TLS, context uintptr) { + var p uintptr + var r float64 + _, _ = p, r + r = float64(0) + p = Xsqlite3_aggregate_context(tls, context, 0) + if p != 0 { + if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { + r = (*TSumCtx)(unsafe.Pointer(p)).FrSum + if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { + r += (*TSumCtx)(unsafe.Pointer(p)).FrErr + } + } else { + r = float64((*TSumCtx)(unsafe.Pointer(p)).FiSum) + } + } + Xsqlite3_result_double(tls, context, r) +} + +// C documentation +// +// /* +// ** The following structure keeps track of state information for the +// ** count() aggregate function. +// */ +type TCountCtx = struct { + Fn Ti64 +} + +type CountCtx = TCountCtx + +type TCountCtx1 = struct { + Fn Ti64 +} + +type CountCtx1 = TCountCtx1 + +// C documentation +// +// /* +// ** Routines to implement the count() aggregate function. +// */ +func _countStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, context, int32(8)) + if (argc == 0 || int32(SQLITE_NULL) != Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv)))) && p != 0 { + (*TCountCtx)(unsafe.Pointer(p)).Fn++ + } + /* The sqlite3_aggregate_count() function is deprecated. But just to make + ** sure it still operates correctly, verify that its count agrees with our + ** internal count when using count(*) and when the total count can be + ** expressed as a 32-bit integer. */ +} + +func _countFinalize(tls *libc.TLS, context uintptr) { + var p uintptr + var v1 int64 + _, _ = p, v1 + p = Xsqlite3_aggregate_context(tls, context, 0) + if p != 0 { + v1 = (*TCountCtx)(unsafe.Pointer(p)).Fn + } else { + v1 = 0 + } + Xsqlite3_result_int64(tls, context, v1) +} + +func _countInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, ctx, int32(8)) + /* p is always non-NULL since countStep() will have been called first */ + if (argc == 0 || int32(SQLITE_NULL) != Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv)))) && p != 0 { + (*TCountCtx)(unsafe.Pointer(p)).Fn-- + } +} + +// C documentation +// +// /* +// ** Routines to implement min() and max() aggregate functions. +// */ +func _minmaxStep(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { + var cmp, max int32 + var pArg, pBest, pColl uintptr + _, _, _, _, _ = cmp, max, pArg, pBest, pColl + pArg = *(*uintptr)(unsafe.Pointer(argv)) + _ = NotUsed + pBest = Xsqlite3_aggregate_context(tls, context, int32(56)) + if !(pBest != 0) { + return + } + if Xsqlite3_value_type(tls, pArg) == int32(SQLITE_NULL) { + if (*TMem)(unsafe.Pointer(pBest)).Fflags != 0 { + _sqlite3SkipAccumulatorLoad(tls, context) + } + } else { + if (*TMem)(unsafe.Pointer(pBest)).Fflags != 0 { + pColl = _sqlite3GetFuncCollSeq(tls, context) + /* This step function is used for both the min() and max() aggregates, + ** the only difference between the two being that the sense of the + ** comparison is inverted. For the max() aggregate, the + ** sqlite3_user_data() function returns (void *)-1. For min() it + ** returns (void *)db, where db is the sqlite3* database pointer. + ** Therefore the next statement sets variable 'max' to 1 for the max() + ** aggregate, or 0 for min(). + */ + max = libc.BoolInt32(Xsqlite3_user_data(tls, context) != uintptr(0)) + cmp = _sqlite3MemCompare(tls, pBest, pArg, pColl) + if max != 0 && cmp < 0 || !(max != 0) && cmp > 0 { + _sqlite3VdbeMemCopy(tls, pBest, pArg) + } else { + _sqlite3SkipAccumulatorLoad(tls, context) + } + } else { + (*TMem)(unsafe.Pointer(pBest)).Fdb = Xsqlite3_context_db_handle(tls, context) + _sqlite3VdbeMemCopy(tls, pBest, pArg) + } + } +} + +func _minMaxValueFinalize(tls *libc.TLS, context uintptr, bValue int32) { + var pRes uintptr + _ = pRes + pRes = Xsqlite3_aggregate_context(tls, context, 0) + if pRes != 0 { + if (*Tsqlite3_value)(unsafe.Pointer(pRes)).Fflags != 0 { + Xsqlite3_result_value(tls, context, pRes) + } + if bValue == 0 { + _sqlite3VdbeMemRelease(tls, pRes) + } + } +} + +func _minMaxValue(tls *libc.TLS, context uintptr) { + _minMaxValueFinalize(tls, context, int32(1)) +} + +func _minMaxFinalize(tls *libc.TLS, context uintptr) { + _minMaxValueFinalize(tls, context, 0) +} + +// C documentation +// +// /* +// ** group_concat(EXPR, ?SEPARATOR?) +// ** string_agg(EXPR, SEPARATOR) +// ** +// ** The SEPARATOR goes before the EXPR string. This is tragic. The +// ** groupConcatInverse() implementation would have been easier if the +// ** SEPARATOR were appended after EXPR. And the order is undocumented, +// ** so we could change it, in theory. But the old behavior has been +// ** around for so long that we dare not, for fear of breaking something. +// */ +type TGroupConcatCtx = struct { + Fstr TStrAccum + FnAccum int32 + FnFirstSepLength int32 + FpnSepLengths uintptr +} + +type GroupConcatCtx = TGroupConcatCtx + +func _groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var db, pGCC, pnsl, zSep, zVal uintptr + var firstTerm, i, nA, nSep, nVal, v1 int32 + _, _, _, _, _, _, _, _, _, _, _ = db, firstTerm, i, nA, nSep, nVal, pGCC, pnsl, zSep, zVal, v1 + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { + return + } + pGCC = Xsqlite3_aggregate_context(tls, context, int32(48)) + if pGCC != 0 { + db = Xsqlite3_context_db_handle(tls, context) + firstTerm = libc.BoolInt32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FmxAlloc == uint32(0)) + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FmxAlloc = uint32(*(*int32)(unsafe.Pointer(db + 136))) + if argc == int32(1) { + if !(firstTerm != 0) { + Xsqlite3_str_appendchar(tls, pGCC, int32(1), int8(',')) + } else { + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnFirstSepLength = int32(1) + } + } else { + if !(firstTerm != 0) { + zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zSep != 0 { + Xsqlite3_str_append(tls, pGCC, zSep, nSep) + } else { + nSep = 0 + } + if nSep != (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnFirstSepLength || (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths != uintptr(0) { + pnsl = (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths + if pnsl == uintptr(0) { + /* First separator length variation seen, start tracking them. */ + pnsl = Xsqlite3_malloc64(tls, uint64((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum+libc.Int32FromInt32(1))*uint64(4)) + if pnsl != uintptr(0) { + i = 0 + nA = (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum - int32(1) + for i < nA { + v1 = i + i++ + *(*int32)(unsafe.Pointer(pnsl + uintptr(v1)*4)) = (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnFirstSepLength + } + } + } else { + pnsl = Xsqlite3_realloc64(tls, pnsl, uint64((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum)*uint64(4)) + } + if pnsl != uintptr(0) { + if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum > 0 { + *(*int32)(unsafe.Pointer(pnsl + uintptr((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum-int32(1))*4)) = nSep + } + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths = pnsl + } else { + _sqlite3StrAccumSetError(tls, pGCC, uint8(SQLITE_NOMEM)) + } + } + } else { + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnFirstSepLength = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } + } + *(*int32)(unsafe.Pointer(pGCC + 32)) += int32(1) + zVal = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + nVal = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zVal != 0 { + Xsqlite3_str_append(tls, pGCC, zVal, nVal) + } + } +} + +func _groupConcatInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var nVS int32 + var pGCC uintptr + _, _ = nVS, pGCC + _ = argc /* Suppress unused parameter warning */ + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == int32(SQLITE_NULL) { + return + } + pGCC = Xsqlite3_aggregate_context(tls, context, int32(48)) + /* pGCC is always non-NULL since groupConcatStep() will have always + ** run first to initialize it */ + if pGCC != 0 { + /* Must call sqlite3_value_text() to convert the argument into text prior + ** to invoking sqlite3_value_bytes(), in case the text encoding is UTF16 */ + Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + nVS = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*int32)(unsafe.Pointer(pGCC + 32)) -= int32(1) + if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths != uintptr(0) { + if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum > 0 { + nVS += *(*int32)(unsafe.Pointer((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths)) + libc.Xmemmove(tls, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths+uintptr(1)*4, uint64((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum-libc.Int32FromInt32(1))*uint64(4)) + } + } else { + /* If removing single accumulated string, harmlessly over-do. */ + nVS += (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnFirstSepLength + } + if nVS >= int32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FnChar) { + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FnChar = uint32(0) + } else { + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FnChar -= uint32(nVS) + libc.Xmemmove(tls, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FzText, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FzText+uintptr(nVS), uint64((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FnChar)) + } + if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FnChar == uint32(0) { + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).Fstr.FmxAlloc = uint32(0) + Xsqlite3_free(tls, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths) + (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths = uintptr(0) + } + } +} + +func _groupConcatFinalize(tls *libc.TLS, context uintptr) { + var pGCC uintptr + _ = pGCC + pGCC = Xsqlite3_aggregate_context(tls, context, 0) + if pGCC != 0 { + _sqlite3ResultStrAccum(tls, context, pGCC) + Xsqlite3_free(tls, (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths) + } +} + +func _groupConcatValue(tls *libc.TLS, context uintptr) { + var pAccum, pGCC, zText uintptr + _, _, _ = pAccum, pGCC, zText + pGCC = Xsqlite3_aggregate_context(tls, context, 0) + if pGCC != 0 { + pAccum = pGCC + if int32((*TStrAccum)(unsafe.Pointer(pAccum)).FaccError) == int32(SQLITE_TOOBIG) { + Xsqlite3_result_error_toobig(tls, context) + } else { + if int32((*TStrAccum)(unsafe.Pointer(pAccum)).FaccError) == int32(SQLITE_NOMEM) { + Xsqlite3_result_error_nomem(tls, context) + } else { + zText = Xsqlite3_str_value(tls, pAccum) + Xsqlite3_result_text(tls, context, zText, int32((*TStrAccum)(unsafe.Pointer(pAccum)).FnChar), uintptr(-libc.Int32FromInt32(1))) + } + } + } +} + +// C documentation +// +// /* +// ** This routine does per-connection function registration. Most +// ** of the built-in functions above are part of the global function set. +// ** This routine only deals with those that are not global. +// */ +func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { + var rc int32 + _ = rc + rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+15379, int32(2)) + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } +} + +// C documentation +// +// /* +// ** Re-register the built-in LIKE functions. The caseSensitive +// ** parameter determines whether or not the LIKE operator is case +// ** sensitive. +// */ +func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int32) { + var flags, nArg int32 + var pDef, pInfo uintptr + _, _, _, _ = flags, nArg, pDef, pInfo + if caseSensitive != 0 { + pInfo = uintptr(unsafe.Pointer(&_likeInfoAlt)) + flags = libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE) + } else { + pInfo = uintptr(unsafe.Pointer(&_likeInfoNorm)) + flags = int32(SQLITE_FUNC_LIKE) + } + nArg = int32(2) + for { + if !(nArg <= int32(3)) { + break + } + _sqlite3CreateFunc(tls, db, __ccgo_ts+15385, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+15385, nArg, uint8(SQLITE_UTF8), uint8(0)) + *(*Tu32)(unsafe.Pointer(pDef + 4)) |= uint32(flags) + *(*Tu32)(unsafe.Pointer(pDef + 4)) &= uint32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) + goto _1 + _1: + ; + nArg++ + } +} + +// C documentation +// +// /* +// ** pExpr points to an expression which implements a function. If +// ** it is appropriate to apply the LIKE optimization to that function +// ** then set aWc[0] through aWc[2] to the wildcard characters and the +// ** escape character and then return TRUE. If the function is not a +// ** LIKE-style function then return FALSE. +// ** +// ** The expression "a LIKE b ESCAPE c" is only considered a valid LIKE +// ** operator if c is a string literal that is exactly one byte in length. +// ** That one byte is stored in aWc[3]. aWc[3] is set to zero if there is +// ** no ESCAPE clause. +// ** +// ** *pIsNocase is set to true if uppercase and lowercase are equivalent for +// ** the function (default for LIKE). If the function makes the distinction +// ** between uppercase and lowercase (as does GLOB) then *pIsNocase is set to +// ** false. +// */ +func _sqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase uintptr, aWc uintptr) (r int32) { + var nExpr int32 + var pDef, pEscape, zEscape uintptr + _, _, _, _ = nExpr, pDef, pEscape, zEscape + if !(*(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0) { + return 0 + } + nExpr = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr + pDef = _sqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(pExpr + 8)), nExpr, uint8(SQLITE_UTF8), uint8(0)) + if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_LIKE) == uint32(0) { + return 0 + } + /* The memcpy() statement assumes that the wildcard characters are + ** the first three statements in the compareInfo structure. The + ** asserts() that follow verify that assumption + */ + libc.Xmemcpy(tls, aWc, (*TFuncDef)(unsafe.Pointer(pDef)).FpUserData, uint64(3)) + if nExpr < int32(3) { + *(*int8)(unsafe.Pointer(aWc + 3)) = 0 + } else { + pEscape = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 2*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pEscape)).Fop) != int32(TK_STRING) { + return 0 + } + zEscape = *(*uintptr)(unsafe.Pointer(pEscape + 8)) + if int32(*(*int8)(unsafe.Pointer(zEscape))) == 0 || int32(*(*int8)(unsafe.Pointer(zEscape + 1))) != 0 { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zEscape))) == int32(*(*int8)(unsafe.Pointer(aWc))) { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zEscape))) == int32(*(*int8)(unsafe.Pointer(aWc + 1))) { + return 0 + } + *(*int8)(unsafe.Pointer(aWc + 3)) = *(*int8)(unsafe.Pointer(zEscape)) + } + *(*int32)(unsafe.Pointer(pIsNocase)) = libc.BoolInt32((*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_CASE) == uint32(0)) + return int32(1) +} + +/* Mathematical Constants */ + +// C documentation +// +// /* Extra math functions that require linking with -lm +// */ +// /* +// ** Implementation SQL functions: +// ** +// ** ceil(X) +// ** ceiling(X) +// ** floor(X) +// ** +// ** The sqlite3_user_data() pointer is a pointer to the libm implementation +// ** of the underlying C function. +// */ +func _ceilingFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var x uintptr + _ = x + switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_INTEGER): + Xsqlite3_result_int64(tls, context, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))) + case int32(SQLITE_FLOAT): + x = Xsqlite3_user_data(tls, context) + Xsqlite3_result_double(tls, context, (*(*func(*libc.TLS, float64) float64)(unsafe.Pointer(&struct{ uintptr }{x})))(tls, Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))))) + default: + break + } +} + +// C documentation +// +// /* +// ** On some systems, ceil() and floor() are intrinsic function. You are +// ** unable to take a pointer to these functions. Hence, we here wrap them +// ** in our own actual functions. +// */ +func _xCeil(tls *libc.TLS, x float64) (r float64) { + return libc.Xceil(tls, x) +} + +func _xFloor(tls *libc.TLS, x float64) (r float64) { + return libc.Xfloor(tls, x) +} + +/* +** Some systems do not have log2() and log10() in their standard math +** libraries. + */ + +// C documentation +// +// /* +// ** Implementation of SQL functions: +// ** +// ** ln(X) - natural logarithm +// ** log(X) - log X base 10 +// ** log10(X) - log X base 10 +// ** log(B,X) - log X base B +// */ +func _logFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var ans, b, x float64 + _, _, _ = ans, b, x + switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + x = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + if x <= float64(0) { + return + } + default: + return + } + if argc == int32(2) { + switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + b = libc.Xlog(tls, x) + if b <= float64(0) { + return + } + x = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if x <= float64(0) { + return + } + default: + return + } + ans = libc.Xlog(tls, x) / b + } else { + switch int32(int64(Xsqlite3_user_data(tls, context))) { + case int32(1): + ans = libc.Xlog10(tls, x) + case int32(2): + ans = libc.X__builtin_log2(tls, x) + default: + ans = libc.Xlog(tls, x) + break + } + } + Xsqlite3_result_double(tls, context, ans) +} + +// C documentation +// +// /* +// ** Functions to converts degrees to radians and radians to degrees. +// */ +func _degToRad(tls *libc.TLS, x float64) (r float64) { + return x * (libc.Float64FromFloat64(3.141592653589793) / libc.Float64FromFloat64(180)) +} + +func _radToDeg(tls *libc.TLS, x float64) (r float64) { + return x * (libc.Float64FromFloat64(180) / libc.Float64FromFloat64(3.141592653589793)) +} + +// C documentation +// +// /* +// ** Implementation of 1-argument SQL math functions: +// ** +// ** exp(X) - Compute e to the X-th power +// */ +func _math1Func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var ans, v0 float64 + var type0 int32 + var x uintptr + _, _, _, _ = ans, type0, v0, x + type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { + return + } + v0 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + x = Xsqlite3_user_data(tls, context) + ans = (*(*func(*libc.TLS, float64) float64)(unsafe.Pointer(&struct{ uintptr }{x})))(tls, v0) + Xsqlite3_result_double(tls, context, ans) +} + +// C documentation +// +// /* +// ** Implementation of 2-argument SQL math functions: +// ** +// ** power(X,Y) - Compute X to the Y-th power +// */ +func _math2Func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var ans, v0, v1 float64 + var type0, type1 int32 + var x uintptr + _, _, _, _, _, _ = ans, type0, type1, v0, v1, x + type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { + return + } + type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if type1 != int32(SQLITE_INTEGER) && type1 != int32(SQLITE_FLOAT) { + return + } + v0 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + v1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + x = Xsqlite3_user_data(tls, context) + ans = (*(*func(*libc.TLS, float64, float64) float64)(unsafe.Pointer(&struct{ uintptr }{x})))(tls, v0, v1) + Xsqlite3_result_double(tls, context, ans) +} + +// C documentation +// +// /* +// ** Implementation of 0-argument pi() function. +// */ +func _piFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + _ = argv + Xsqlite3_result_double(tls, context, float64(3.141592653589793)) +} + +// C documentation +// +// /* +// ** Implementation of sign(X) function. +// */ +func _signFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var type0, v1, v2 int32 + var x float64 + _, _, _, _ = type0, x, v1, v2 + _ = argc + type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if type0 != int32(SQLITE_INTEGER) && type0 != int32(SQLITE_FLOAT) { + return + } + x = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + if x < float64(0) { + v1 = -int32(1) + } else { + if x > float64(0) { + v2 = +libc.Int32FromInt32(1) + } else { + v2 = 0 + } + v1 = v2 + } + Xsqlite3_result_int(tls, context, v1) +} + +// C documentation +// +// /* +// ** All of the FuncDef structures in the aBuiltinFunc[] array above +// ** to the global function hash table. This occurs at start-time (as +// ** a consequence of calling sqlite3_initialize()). +// ** +// ** After this routine runs +// */ +func _sqlite3RegisterBuiltinFunctions(tls *libc.TLS) { + _sqlite3AlterFunctions(tls) + _sqlite3WindowFunctions(tls) + _sqlite3RegisterDateTimeFunctions(tls) + _sqlite3RegisterJsonFunctions(tls) + _sqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&_aBuiltinFunc)), int32(libc.Uint64FromInt64(7920)/libc.Uint64FromInt64(72))) +} + +/* + ** The following array holds FuncDef structures for all of the functions + ** defined in this file. + ** + ** The array cannot be constant since changes are made to the + ** FuncDef.pHash elements at start-time. The elements of this array + ** are read-only after initialization is complete. + ** + ** For peak efficiency, put the most frequently used function last. + */ +var _aBuiltinFunc = [110]TFuncDef{ + 0: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row))), + FzName: __ccgo_ts + 15390, + }, + 1: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_compare))), + FzName: __ccgo_ts + 15410, + }, + 2: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr))), + FzName: __ccgo_ts + 15423, + }, + 3: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_affinity))), + FzName: __ccgo_ts + 15441, + }, + 4: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15450, + }, + 5: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), + FzName: __ccgo_ts + 15458, + }, + 6: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), + FzName: __ccgo_ts + 15458, + }, + 7: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15473, + }, + 8: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15499, + }, + 9: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), + FzName: __ccgo_ts + 15524, + }, + 10: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), + FzName: __ccgo_ts + 15533, + }, + 11: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_unlikely))), + FzName: __ccgo_ts + 15544, + }, + 12: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_sqlite_offset))), + FzName: __ccgo_ts + 15551, + }, + 13: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15565, + }, + 14: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15565, + }, + 15: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(2))), + FzName: __ccgo_ts + 15571, + }, + 16: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(2))), + FzName: __ccgo_ts + 15571, + }, + 17: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(3))), + FzName: __ccgo_ts + 15577, + }, + 18: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(3))), + FzName: __ccgo_ts + 15577, + }, + 19: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15582, + }, + 20: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15582, + }, + 21: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), + FzName: __ccgo_ts + 15582, + }, + 22: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15586, + }, + 23: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15586, + }, + 24: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15586, + }, + 25: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), + FzName: __ccgo_ts + 15590, + }, + 26: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), + FzName: __ccgo_ts + 15597, + }, + 27: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), + FzName: __ccgo_ts + 15605, + }, + 28: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), + FzName: __ccgo_ts + 15612, + }, + 29: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15625, + }, + 30: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15631, + }, + 31: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15638, + }, + 32: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15645, + }, + 33: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15653, + }, + 34: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15658, + }, + 35: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15662, + }, + 36: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15662, + }, + 37: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15668, + }, + 38: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15674, + }, + 39: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15680, + }, + 40: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15684, + }, + 41: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15684, + }, + 42: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15690, + }, + 43: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15690, + }, + 44: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15697, + }, + 45: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15697, + }, + 46: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15697, + }, + 47: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15707, + }, + 48: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15714, + }, + 49: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15721, + }, + 50: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15732, + }, + 51: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15739, + }, + 52: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15754, + }, + 53: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15771, + }, + 54: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15782, + }, + 55: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15788, + }, + 56: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15806, + }, + 57: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15814, + }, + 58: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15828, + }, + 59: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15836, + }, + 60: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15845, + }, + 61: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15845, + }, + 62: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15852, + }, + 63: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15852, + }, + 64: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15862, + }, + 65: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15866, + }, + 66: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15872, + }, + 67: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), + FzName: __ccgo_ts + 15876, + }, + 68: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), + FzName: __ccgo_ts + 15876, + }, + 69: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15882, + }, + 70: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15882, + }, + 71: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 15895, + }, + 72: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), + FpUserData: uintptr(unsafe.Pointer(&_globInfo)), + FzName: __ccgo_ts + 15906, + }, + 73: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), + FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), + FzName: __ccgo_ts + 15385, + }, + 74: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), + FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), + FzName: __ccgo_ts + 15385, + }, + 75: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 6762, + }, + 76: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 6762, + }, + 77: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15911, + }, + 78: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15916, + }, + 79: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15924, + }, + 80: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15930, + }, + 81: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15936, + }, + 82: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15939, + }, + 83: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(1))), + FzName: __ccgo_ts + 15943, + }, + 84: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FpUserData: uintptr(int64(libc.Int32FromInt32(2))), + FzName: __ccgo_ts + 15949, + }, + 85: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 15939, + }, + 86: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15954, + }, + 87: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15958, + }, + 88: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15962, + }, + 89: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15968, + }, + 90: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15972, + }, + 91: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15977, + }, + 92: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15982, + }, + 93: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15987, + }, + 94: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15993, + }, + 95: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 15997, + }, + 96: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16001, + }, + 97: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16005, + }, + 98: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16010, + }, + 99: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16015, + }, + 100: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16020, + }, + 101: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16026, + }, + 102: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16032, + }, + 103: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16038, + }, + 104: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16043, + }, + 105: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), + FzName: __ccgo_ts + 16051, + }, + 106: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 16059, + }, + 107: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), + FzName: __ccgo_ts + 16062, + }, + 108: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FzName: __ccgo_ts + 6762, + }, + 109: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), + FpUserData: uintptr(int64(libc.Int32FromInt32(INLINEFUNC_iif))), + FzName: __ccgo_ts + 16067, + }, +} + +func init() { + p := unsafe.Pointer(&_aBuiltinFunc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_soundexFunc) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(_loadExt) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_loadExt) + *(*uintptr)(unsafe.Add(p, 528)) = __ccgo_fp(_compileoptionusedFunc) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(_compileoptiongetFunc) + *(*uintptr)(unsafe.Add(p, 672)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 744)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 816)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 888)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 960)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1032)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1104)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1176)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1248)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1320)) = __ccgo_fp(_trimFunc) + *(*uintptr)(unsafe.Add(p, 1392)) = __ccgo_fp(_minmaxFunc) + *(*uintptr)(unsafe.Add(p, 1536)) = __ccgo_fp(_minmaxStep) + *(*uintptr)(unsafe.Add(p, 1544)) = __ccgo_fp(_minMaxFinalize) + *(*uintptr)(unsafe.Add(p, 1552)) = __ccgo_fp(_minMaxValue) + *(*uintptr)(unsafe.Add(p, 1608)) = __ccgo_fp(_minmaxFunc) + *(*uintptr)(unsafe.Add(p, 1752)) = __ccgo_fp(_minmaxStep) + *(*uintptr)(unsafe.Add(p, 1760)) = __ccgo_fp(_minMaxFinalize) + *(*uintptr)(unsafe.Add(p, 1768)) = __ccgo_fp(_minMaxValue) + *(*uintptr)(unsafe.Add(p, 1824)) = __ccgo_fp(_typeofFunc) + *(*uintptr)(unsafe.Add(p, 1896)) = __ccgo_fp(_subtypeFunc) + *(*uintptr)(unsafe.Add(p, 1968)) = __ccgo_fp(_lengthFunc) + *(*uintptr)(unsafe.Add(p, 2040)) = __ccgo_fp(_bytelengthFunc) + *(*uintptr)(unsafe.Add(p, 2112)) = __ccgo_fp(_instrFunc) + *(*uintptr)(unsafe.Add(p, 2184)) = __ccgo_fp(_printfFunc) + *(*uintptr)(unsafe.Add(p, 2256)) = __ccgo_fp(_printfFunc) + *(*uintptr)(unsafe.Add(p, 2328)) = __ccgo_fp(_unicodeFunc) + *(*uintptr)(unsafe.Add(p, 2400)) = __ccgo_fp(_charFunc) + *(*uintptr)(unsafe.Add(p, 2472)) = __ccgo_fp(_absFunc) + *(*uintptr)(unsafe.Add(p, 2544)) = __ccgo_fp(_roundFunc) + *(*uintptr)(unsafe.Add(p, 2616)) = __ccgo_fp(_roundFunc) + *(*uintptr)(unsafe.Add(p, 2688)) = __ccgo_fp(_upperFunc) + *(*uintptr)(unsafe.Add(p, 2760)) = __ccgo_fp(_lowerFunc) + *(*uintptr)(unsafe.Add(p, 2832)) = __ccgo_fp(_hexFunc) + *(*uintptr)(unsafe.Add(p, 2904)) = __ccgo_fp(_unhexFunc) + *(*uintptr)(unsafe.Add(p, 2976)) = __ccgo_fp(_unhexFunc) + *(*uintptr)(unsafe.Add(p, 3048)) = __ccgo_fp(_concatFunc) + *(*uintptr)(unsafe.Add(p, 3192)) = __ccgo_fp(_concatwsFunc) + *(*uintptr)(unsafe.Add(p, 3408)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 3480)) = __ccgo_fp(_randomFunc) + *(*uintptr)(unsafe.Add(p, 3552)) = __ccgo_fp(_randomBlob) + *(*uintptr)(unsafe.Add(p, 3624)) = __ccgo_fp(_nullifFunc) + *(*uintptr)(unsafe.Add(p, 3696)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 3768)) = __ccgo_fp(_sourceidFunc) + *(*uintptr)(unsafe.Add(p, 3840)) = __ccgo_fp(_errlogFunc) + *(*uintptr)(unsafe.Add(p, 3912)) = __ccgo_fp(_quoteFunc) + *(*uintptr)(unsafe.Add(p, 3984)) = __ccgo_fp(_last_insert_rowid) + *(*uintptr)(unsafe.Add(p, 4056)) = __ccgo_fp(_changes) + *(*uintptr)(unsafe.Add(p, 4128)) = __ccgo_fp(_total_changes) + *(*uintptr)(unsafe.Add(p, 4200)) = __ccgo_fp(_replaceFunc) + *(*uintptr)(unsafe.Add(p, 4272)) = __ccgo_fp(_zeroblobFunc) + *(*uintptr)(unsafe.Add(p, 4344)) = __ccgo_fp(_substrFunc) + *(*uintptr)(unsafe.Add(p, 4416)) = __ccgo_fp(_substrFunc) + *(*uintptr)(unsafe.Add(p, 4488)) = __ccgo_fp(_substrFunc) + *(*uintptr)(unsafe.Add(p, 4560)) = __ccgo_fp(_substrFunc) + *(*uintptr)(unsafe.Add(p, 4632)) = __ccgo_fp(_sumStep) + *(*uintptr)(unsafe.Add(p, 4640)) = __ccgo_fp(_sumFinalize) + *(*uintptr)(unsafe.Add(p, 4648)) = __ccgo_fp(_sumFinalize) + *(*uintptr)(unsafe.Add(p, 4656)) = __ccgo_fp(_sumInverse) + *(*uintptr)(unsafe.Add(p, 4704)) = __ccgo_fp(_sumStep) + *(*uintptr)(unsafe.Add(p, 4712)) = __ccgo_fp(_totalFinalize) + *(*uintptr)(unsafe.Add(p, 4720)) = __ccgo_fp(_totalFinalize) + *(*uintptr)(unsafe.Add(p, 4728)) = __ccgo_fp(_sumInverse) + *(*uintptr)(unsafe.Add(p, 4776)) = __ccgo_fp(_sumStep) + *(*uintptr)(unsafe.Add(p, 4784)) = __ccgo_fp(_avgFinalize) + *(*uintptr)(unsafe.Add(p, 4792)) = __ccgo_fp(_avgFinalize) + *(*uintptr)(unsafe.Add(p, 4800)) = __ccgo_fp(_sumInverse) + *(*uintptr)(unsafe.Add(p, 4848)) = __ccgo_fp(_countStep) + *(*uintptr)(unsafe.Add(p, 4856)) = __ccgo_fp(_countFinalize) + *(*uintptr)(unsafe.Add(p, 4864)) = __ccgo_fp(_countFinalize) + *(*uintptr)(unsafe.Add(p, 4872)) = __ccgo_fp(_countInverse) + *(*uintptr)(unsafe.Add(p, 4920)) = __ccgo_fp(_countStep) + *(*uintptr)(unsafe.Add(p, 4928)) = __ccgo_fp(_countFinalize) + *(*uintptr)(unsafe.Add(p, 4936)) = __ccgo_fp(_countFinalize) + *(*uintptr)(unsafe.Add(p, 4944)) = __ccgo_fp(_countInverse) + *(*uintptr)(unsafe.Add(p, 4992)) = __ccgo_fp(_groupConcatStep) + *(*uintptr)(unsafe.Add(p, 5000)) = __ccgo_fp(_groupConcatFinalize) + *(*uintptr)(unsafe.Add(p, 5008)) = __ccgo_fp(_groupConcatValue) + *(*uintptr)(unsafe.Add(p, 5016)) = __ccgo_fp(_groupConcatInverse) + *(*uintptr)(unsafe.Add(p, 5064)) = __ccgo_fp(_groupConcatStep) + *(*uintptr)(unsafe.Add(p, 5072)) = __ccgo_fp(_groupConcatFinalize) + *(*uintptr)(unsafe.Add(p, 5080)) = __ccgo_fp(_groupConcatValue) + *(*uintptr)(unsafe.Add(p, 5088)) = __ccgo_fp(_groupConcatInverse) + *(*uintptr)(unsafe.Add(p, 5136)) = __ccgo_fp(_groupConcatStep) + *(*uintptr)(unsafe.Add(p, 5144)) = __ccgo_fp(_groupConcatFinalize) + *(*uintptr)(unsafe.Add(p, 5152)) = __ccgo_fp(_groupConcatValue) + *(*uintptr)(unsafe.Add(p, 5160)) = __ccgo_fp(_groupConcatInverse) + *(*uintptr)(unsafe.Add(p, 5208)) = __ccgo_fp(_likeFunc) + *(*uintptr)(unsafe.Add(p, 5280)) = __ccgo_fp(_likeFunc) + *(*uintptr)(unsafe.Add(p, 5352)) = __ccgo_fp(_likeFunc) + *(*uintptr)(unsafe.Add(p, 5552)) = __ccgo_fp(_xCeil) + *(*uintptr)(unsafe.Add(p, 5568)) = __ccgo_fp(_ceilingFunc) + *(*uintptr)(unsafe.Add(p, 5624)) = __ccgo_fp(_xCeil) + *(*uintptr)(unsafe.Add(p, 5640)) = __ccgo_fp(_ceilingFunc) + *(*uintptr)(unsafe.Add(p, 5696)) = __ccgo_fp(_xFloor) + *(*uintptr)(unsafe.Add(p, 5712)) = __ccgo_fp(_ceilingFunc) + *(*uintptr)(unsafe.Add(p, 5768)) = __ccgo_fp(libc.Xtrunc) + *(*uintptr)(unsafe.Add(p, 5784)) = __ccgo_fp(_ceilingFunc) + *(*uintptr)(unsafe.Add(p, 5856)) = __ccgo_fp(_logFunc) + *(*uintptr)(unsafe.Add(p, 5928)) = __ccgo_fp(_logFunc) + *(*uintptr)(unsafe.Add(p, 6000)) = __ccgo_fp(_logFunc) + *(*uintptr)(unsafe.Add(p, 6072)) = __ccgo_fp(_logFunc) + *(*uintptr)(unsafe.Add(p, 6144)) = __ccgo_fp(_logFunc) + *(*uintptr)(unsafe.Add(p, 6200)) = __ccgo_fp(libc.Xexp) + *(*uintptr)(unsafe.Add(p, 6216)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6272)) = __ccgo_fp(libc.Xpow) + *(*uintptr)(unsafe.Add(p, 6288)) = __ccgo_fp(_math2Func) + *(*uintptr)(unsafe.Add(p, 6344)) = __ccgo_fp(libc.Xpow) + *(*uintptr)(unsafe.Add(p, 6360)) = __ccgo_fp(_math2Func) + *(*uintptr)(unsafe.Add(p, 6416)) = __ccgo_fp(libc.Xfmod) + *(*uintptr)(unsafe.Add(p, 6432)) = __ccgo_fp(_math2Func) + *(*uintptr)(unsafe.Add(p, 6488)) = __ccgo_fp(libc.Xacos) + *(*uintptr)(unsafe.Add(p, 6504)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6560)) = __ccgo_fp(libc.Xasin) + *(*uintptr)(unsafe.Add(p, 6576)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6632)) = __ccgo_fp(libc.Xatan) + *(*uintptr)(unsafe.Add(p, 6648)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6704)) = __ccgo_fp(libc.Xatan2) + *(*uintptr)(unsafe.Add(p, 6720)) = __ccgo_fp(_math2Func) + *(*uintptr)(unsafe.Add(p, 6776)) = __ccgo_fp(libc.Xcos) + *(*uintptr)(unsafe.Add(p, 6792)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6848)) = __ccgo_fp(libc.Xsin) + *(*uintptr)(unsafe.Add(p, 6864)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6920)) = __ccgo_fp(libc.Xtan) + *(*uintptr)(unsafe.Add(p, 6936)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 6992)) = __ccgo_fp(libc.Xcosh) + *(*uintptr)(unsafe.Add(p, 7008)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7064)) = __ccgo_fp(libc.Xsinh) + *(*uintptr)(unsafe.Add(p, 7080)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7136)) = __ccgo_fp(libc.Xtanh) + *(*uintptr)(unsafe.Add(p, 7152)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7208)) = __ccgo_fp(libc.Xacosh) + *(*uintptr)(unsafe.Add(p, 7224)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7280)) = __ccgo_fp(libc.Xasinh) + *(*uintptr)(unsafe.Add(p, 7296)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7352)) = __ccgo_fp(libc.Xatanh) + *(*uintptr)(unsafe.Add(p, 7368)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7424)) = __ccgo_fp(libc.Xsqrt) + *(*uintptr)(unsafe.Add(p, 7440)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7496)) = __ccgo_fp(_degToRad) + *(*uintptr)(unsafe.Add(p, 7512)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7568)) = __ccgo_fp(_radToDeg) + *(*uintptr)(unsafe.Add(p, 7584)) = __ccgo_fp(_math1Func) + *(*uintptr)(unsafe.Add(p, 7656)) = __ccgo_fp(_piFunc) + *(*uintptr)(unsafe.Add(p, 7728)) = __ccgo_fp(_signFunc) + *(*uintptr)(unsafe.Add(p, 7800)) = __ccgo_fp(_versionFunc) + *(*uintptr)(unsafe.Add(p, 7872)) = __ccgo_fp(_versionFunc) +} + +/************** End of func.c ************************************************/ +/************** Begin file fkey.c ********************************************/ +/* +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used by the compiler to add foreign key +** support to compiled SQL statements. + */ +/* #include "sqliteInt.h" */ + +/* +** Deferred and Immediate FKs +** -------------------------- +** +** Foreign keys in SQLite come in two flavours: deferred and immediate. +** If an immediate foreign key constraint is violated, +** SQLITE_CONSTRAINT_FOREIGNKEY is returned and the current +** statement transaction rolled back. If a +** deferred foreign key constraint is violated, no action is taken +** immediately. However if the application attempts to commit the +** transaction before fixing the constraint violation, the attempt fails. +** +** Deferred constraints are implemented using a simple counter associated +** with the database handle. The counter is set to zero each time a +** database transaction is opened. Each time a statement is executed +** that causes a foreign key violation, the counter is incremented. Each +** time a statement is executed that removes an existing violation from +** the database, the counter is decremented. When the transaction is +** committed, the commit fails if the current value of the counter is +** greater than zero. This scheme has two big drawbacks: +** +** * When a commit fails due to a deferred foreign key constraint, +** there is no way to tell which foreign constraint is not satisfied, +** or which row it is not satisfied for. +** +** * If the database contains foreign key violations when the +** transaction is opened, this may cause the mechanism to malfunction. +** +** Despite these problems, this approach is adopted as it seems simpler +** than the alternatives. +** +** INSERT operations: +** +** I.1) For each FK for which the table is the child table, search +** the parent table for a match. If none is found increment the +** constraint counter. +** +** I.2) For each FK for which the table is the parent table, +** search the child table for rows that correspond to the new +** row in the parent table. Decrement the counter for each row +** found (as the constraint is now satisfied). +** +** DELETE operations: +** +** D.1) For each FK for which the table is the child table, +** search the parent table for a row that corresponds to the +** deleted row in the child table. If such a row is not found, +** decrement the counter. +** +** D.2) For each FK for which the table is the parent table, search +** the child table for rows that correspond to the deleted row +** in the parent table. For each found increment the counter. +** +** UPDATE operations: +** +** An UPDATE command requires that all 4 steps above are taken, but only +** for FK constraints for which the affected columns are actually +** modified (values must be compared at runtime). +** +** Note that I.1 and D.1 are very similar operations, as are I.2 and D.2. +** This simplifies the implementation a bit. +** +** For the purposes of immediate FK constraints, the OR REPLACE conflict +** resolution is considered to delete rows before the new row is inserted. +** If a delete caused by OR REPLACE violates an FK constraint, an exception +** is thrown, even if the FK constraint would be satisfied after the new +** row is inserted. +** +** Immediate constraints are usually handled similarly. The only difference +** is that the counter used is stored as part of each individual statement +** object (struct Vdbe). If, after the statement has run, its immediate +** constraint counter is greater than zero, +** it returns SQLITE_CONSTRAINT_FOREIGNKEY +** and the statement transaction is rolled back. An exception is an INSERT +** statement that inserts a single row only (no triggers). In this case, +** instead of using a counter, an exception is thrown immediately if the +** INSERT violates a foreign key constraint. This is necessary as such +** an INSERT does not open a statement transaction. +** +** TODO: How should dropping a table be handled? How should renaming a +** table be handled? +** +** +** Query API Notes +** --------------- +** +** Before coding an UPDATE or DELETE row operation, the code-generator +** for those two operations needs to know whether or not the operation +** requires any FK processing and, if so, which columns of the original +** row are required by the FK processing VDBE code (i.e. if FKs were +** implemented using triggers, which of the old.* columns would be +** accessed). No information is required by the code-generator before +** coding an INSERT operation. The functions used by the UPDATE/DELETE +** generation code to query for this information are: +** +** sqlite3FkRequired() - Test to see if FK processing is required. +** sqlite3FkOldmask() - Query for the set of required old.* columns. +** +** +** Externally accessible module functions +** -------------------------------------- +** +** sqlite3FkCheck() - Check for foreign key violations. +** sqlite3FkActions() - Code triggers for ON UPDATE/ON DELETE actions. +** sqlite3FkDelete() - Delete an FKey structure. + */ + +/* +** VDBE Calling Convention +** ----------------------- +** +** Example: +** +** For the following INSERT statement: +** +** CREATE TABLE t1(a, b INTEGER PRIMARY KEY, c); +** INSERT INTO t1 VALUES(1, 2, 3.1); +** +** Register (x): 2 (type integer) +** Register (x+1): 1 (type integer) +** Register (x+2): NULL (type NULL) +** Register (x+3): 3.1 (type real) + */ + +// C documentation +// +// /* +// ** A foreign key constraint requires that the key columns in the parent +// ** table are collectively subject to a UNIQUE or PRIMARY KEY constraint. +// ** Given that pParent is the parent table for foreign key constraint pFKey, +// ** search the schema for a unique index on the parent key columns. +// ** +// ** If successful, zero is returned. If the parent key is an INTEGER PRIMARY +// ** KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx +// ** is set to point to the unique index. +// ** +// ** If the parent key consists of a single column (the foreign key constraint +// ** is not a composite foreign key), output variable *paiCol is set to NULL. +// ** Otherwise, it is set to point to an allocated array of size N, where +// ** N is the number of columns in the parent key. The first element of the +// ** array is the index of the child table column that is mapped by the FK +// ** constraint to the parent table column stored in the left-most column +// ** of index *ppIdx. The second element of the array is the index of the +// ** child table column that corresponds to the second left-most column of +// ** *ppIdx, and so on. +// ** +// ** If the required index cannot be found, either because: +// ** +// ** 1) The named parent key columns do not exist, or +// ** +// ** 2) The named parent key columns do exist, but are not subject to a +// ** UNIQUE or PRIMARY KEY constraint, or +// ** +// ** 3) No parent key columns were provided explicitly as part of the +// ** foreign key definition, and the parent table does not have a +// ** PRIMARY KEY, or +// ** +// ** 4) No parent key columns were provided explicitly as part of the +// ** foreign key definition, and the PRIMARY KEY of the parent table +// ** consists of a different number of columns to the child key in +// ** the child table. +// ** +// ** then non-zero is returned, and a "foreign key mismatch" error loaded +// ** into pParse. If an OOM error occurs, non-zero is returned and the +// ** pParse->db->mallocFailed flag is set. +// */ +func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey uintptr, ppIdx uintptr, paiCol uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aiCol, pIdx, zDfltColl, zIdxCol, zKey uintptr + var i, i1, j, nCol int32 + var iCol Ti16 + _, _, _, _, _, _, _, _, _, _ = aiCol, i, i1, iCol, j, nCol, pIdx, zDfltColl, zIdxCol, zKey + pIdx = uintptr(0) /* Value to return via *ppIdx */ + aiCol = uintptr(0) /* Value to return via *paiCol */ + nCol = (*TFKey)(unsafe.Pointer(pFKey)).FnCol /* Number of columns in parent key */ + zKey = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FzCol /* Name of left-most parent key column */ + /* The caller is responsible for zeroing output parameters. */ + /* If this is a non-composite (single column) foreign key, check if it + ** maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx + ** and *paiCol set to zero and return early. + ** + ** Otherwise, for a composite foreign key (more than one column), allocate + ** space for the aiCol array (returned via output parameter *paiCol). + ** Non-composite foreign keys do not require the aiCol array. + */ + if nCol == int32(1) { + /* The FK maps to the IPK if any of the following are true: + ** + ** 1) There is an INTEGER PRIMARY KEY column and the FK is implicitly + ** mapped to the primary key of table pParent, or + ** 2) The FK is explicitly mapped to a column declared as INTEGER + ** PRIMARY KEY. + */ + if int32((*TTable)(unsafe.Pointer(pParent)).FiPKey) >= 0 { + if !(zKey != 0) { + return 0 + } + if !(_sqlite3StrICmp(tls, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pParent)).FaCol + uintptr((*TTable)(unsafe.Pointer(pParent)).FiPKey)*16))).FzCnName, zKey) != 0) { + return 0 + } + } + } else { + if paiCol != 0 { + aiCol = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nCol)*uint64(4)) + if !(aiCol != 0) { + return int32(1) + } + *(*uintptr)(unsafe.Pointer(paiCol)) = aiCol + } + } + pIdx = (*TTable)(unsafe.Pointer(pParent)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) == nCol && int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None && (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { + /* pIdx is a UNIQUE index (or a PRIMARY KEY) and has the right number + ** of columns. If each indexed column corresponds to a foreign key + ** column of pFKey, then this index is a winner. */ + if zKey == uintptr(0) { + /* If zKey is NULL, then this foreign key is implicitly mapped to + ** the PRIMARY KEY of table pParent. The PRIMARY KEY index may be + ** identified by the test. */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + if aiCol != 0 { + i = 0 + for { + if !(i < nCol) { + break + } + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom + goto _2 + _2: + ; + i++ + } + } + break + } + } else { + i1 = 0 + for { + if !(i1 < nCol) { + break + } + iCol = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) /* Name of indexed column */ + if int32(iCol) < 0 { + break + } /* No foreign keys against expression indexes */ + /* If the index uses a collation sequence that is different from + ** the default collation sequence for the column, this index is + ** unusable. Bail out early in this case. */ + zDfltColl = _sqlite3ColumnColl(tls, (*TTable)(unsafe.Pointer(pParent)).FaCol+uintptr(iCol)*16) + if !(zDfltColl != 0) { + zDfltColl = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + if _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), zDfltColl) != 0 { + break + } + zIdxCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pParent)).FaCol + uintptr(iCol)*16))).FzCnName + j = 0 + for { + if !(j < nCol) { + break + } + if _sqlite3StrICmp(tls, (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FzCol, zIdxCol) == 0 { + if aiCol != 0 { + *(*int32)(unsafe.Pointer(aiCol + uintptr(i1)*4)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(j)*16))).FiFrom + } + break + } + goto _4 + _4: + ; + j++ + } + if j == nCol { + break + } + goto _3 + _3: + ; + i1++ + } + if i1 == nCol { + break + } /* pIdx is usable */ + } + } + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + if !(pIdx != 0) { + if !((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16071, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo)) + } + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiCol) + return int32(1) + } + *(*uintptr)(unsafe.Pointer(ppIdx)) = pIdx + return 0 +} + +// C documentation +// +// /* +// ** This function is called when a row is inserted into or deleted from the +// ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed +// ** on the child table of pFKey, this function is invoked twice for each row +// ** affected - once to "delete" the old row, and then again to "insert" the +// ** new row. +// ** +// ** Each time it is called, this function generates VDBE code to locate the +// ** row in the parent table that corresponds to the row being inserted into +// ** or deleted from the child table. If the parent row can be found, no +// ** special action is taken. Otherwise, if the parent row can *not* be +// ** found in the parent table: +// ** +// ** Operation | FK type | Action taken +// ** -------------------------------------------------------------------------- +// ** INSERT immediate Increment the "immediate constraint counter". +// ** +// ** DELETE immediate Decrement the "immediate constraint counter". +// ** +// ** INSERT deferred Increment the "deferred constraint counter". +// ** +// ** DELETE deferred Decrement the "deferred constraint counter". +// ** +// ** These operations are identified in the comment at the top of this file +// ** (fkey.c) as "I.1" and "D.1". +// */ +func _fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pIdx uintptr, pFKey uintptr, aiCol uintptr, regData int32, nIncr int32, isIgnore int32) { + var i, iChild, iCur, iJump, iMustBeInt, iOk, iParent, iReg, nCol, regTemp, regTemp1 int32 + var v uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = i, iChild, iCur, iJump, iMustBeInt, iOk, iParent, iReg, nCol, regTemp, regTemp1, v /* Iterator variable */ + v = _sqlite3GetVdbe(tls, pParse) /* Vdbe to add code to */ + iCur = (*TParse)(unsafe.Pointer(pParse)).FnTab - int32(1) /* Cursor number to use */ + iOk = _sqlite3VdbeMakeLabel(tls, pParse) /* jump here if parent key found */ + /* If nIncr is less than zero, then check at runtime if there are any + ** outstanding constraints to resolve. If there are not, there is no need + ** to check if deleting this row resolves any outstanding violations. + ** + ** Check if any of the key columns in the child table row are NULL. If + ** any are, then the constraint is considered satisfied. No need to + ** search for a matching row in the parent table. */ + if nIncr < 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkIfZero), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), iOk) + } + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + iReg = int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + regData + int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iOk) + goto _1 + _1: + ; + i++ + } + if isIgnore == 0 { + if pIdx == uintptr(0) { /* Address of MustBeInt instruction */ + regTemp = _sqlite3GetTempReg(tls, pParse) + /* Invoke MustBeInt to coerce the child key value to an integer (i.e. + ** apply the affinity of the parent key). If this fails, then there + ** is no matching parent key. Before using MustBeInt, make a copy of + ** the value. Otherwise, the value inserted into the child key column + ** will have INTEGER affinity applied to it, which may not be correct. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol)))))+int32(1)+regData, regTemp) + iMustBeInt = _sqlite3VdbeAddOp2(tls, v, int32(OP_MustBeInt), regTemp, 0) + /* If the parent table is the same as the child table, and we are about + ** to increment the constraint-counter (i.e. this is an INSERT operation), + ** then check if the row being inserted matches itself. If so, do not + ** increment the constraint-counter. */ + if pTab == (*TFKey)(unsafe.Pointer(pFKey)).FpFrom && nIncr == int32(1) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), regData, iOk, regTemp) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + } + _sqlite3OpenTable(tls, pParse, iCur, iDb, pTab, int32(OP_OpenRead)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_NotExists), iCur, 0, regTemp) + _sqlite3VdbeGoto(tls, v, iOk) + _sqlite3VdbeJumpHere(tls, v, _sqlite3VdbeCurrentAddr(tls, v)-int32(2)) + _sqlite3VdbeJumpHere(tls, v, iMustBeInt) + _sqlite3ReleaseTempReg(tls, pParse, regTemp) + } else { + nCol = (*TFKey)(unsafe.Pointer(pFKey)).FnCol + regTemp1 = _sqlite3GetTempRange(tls, pParse, nCol) + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iCur, int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + i = 0 + for { + if !(i < nCol) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)))))+int32(1)+regData, regTemp1+i) + goto _2 + _2: + ; + i++ + } + /* If the parent table is the same as the child table, and we are about + ** to increment the constraint-counter (i.e. this is an INSERT operation), + ** then check if the row being inserted matches itself. If so, do not + ** increment the constraint-counter. + ** + ** If any of the parent-key values are NULL, then the row cannot match + ** itself. So set JUMPIFNULL to make sure we do the OP_Found if any + ** of the parent-key values are NULL (at this point it is known that + ** none of the child key values are). + */ + if pTab == (*TFKey)(unsafe.Pointer(pFKey)).FpFrom && nIncr == int32(1) { + iJump = _sqlite3VdbeCurrentAddr(tls, v) + nCol + int32(1) + i = 0 + for { + if !(i < nCol) { + break + } + iChild = int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + int32(1) + regData + iParent = int32(1) + regData + iParent += int32(_sqlite3TableColumnToStorage(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)))) + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + /* The parent key is a composite key that includes the IPK column */ + iParent = regData + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), iChild, iJump, iParent) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) + goto _3 + _3: + ; + i++ + } + _sqlite3VdbeGoto(tls, v, iOk) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), regTemp1, nCol, 0, _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx), nCol) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iCur, iOk, regTemp1, nCol) + _sqlite3ReleaseTempRange(tls, pParse, regTemp1, nCol) + } + } + if !((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred != 0) && !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&libc.Uint64FromInt32(SQLITE_DeferFKs) != 0) && !((*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0) && !((*TParse)(unsafe.Pointer(pParse)).FisMultiWrite != 0) { + /* Special case: If this is an INSERT statement that will insert exactly + ** one row into the table, raise a constraint immediately instead of + ** incrementing a counter. This is necessary as the VM code is being + ** generated for will not open a statement transaction. */ + _sqlite3HaltConstraint(tls, pParse, libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(3)< 0 && int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred) == 0 { + _sqlite3MayAbort(tls, pParse) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), nIncr) + } + _sqlite3VdbeResolveLabel(tls, v, iOk) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iCur) +} + +// C documentation +// +// /* +// ** Return an Expr object that refers to a memory register corresponding +// ** to column iCol of table pTab. +// ** +// ** regBase is the first of an array of register that contains the data +// ** for pTab. regBase itself holds the rowid. regBase+1 holds the first +// ** column. regBase+2 holds the second column, and so forth. +// */ +func _exprTableRegister(tls *libc.TLS, pParse uintptr, pTab uintptr, regBase int32, iCol Ti16) (r uintptr) { + var db, pCol, pExpr, zColl uintptr + _, _, _, _ = db, pCol, pExpr, zColl + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pExpr = _sqlite3Expr(tls, db, int32(TK_REGISTER), uintptr(0)) + if pExpr != 0 { + if int32(iCol) >= 0 && int32(iCol) != int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = regBase + int32(_sqlite3TableColumnToStorage(tls, pTab, iCol)) + int32(1) + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = (*TColumn)(unsafe.Pointer(pCol)).Faffinity + zColl = _sqlite3ColumnColl(tls, pCol) + if zColl == uintptr(0) { + zColl = (*TCollSeq)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl)).FzName + } + pExpr = _sqlite3ExprAddCollateString(tls, pParse, pExpr, zColl) + } else { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = regBase + (*TExpr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + } + } + return pExpr +} + +// C documentation +// +// /* +// ** Return an Expr object that refers to column iCol of table pTab which +// ** has cursor iCur. +// */ +func _exprTableColumn(tls *libc.TLS, db uintptr, pTab uintptr, iCursor int32, iCol Ti16) (r uintptr) { + var pExpr uintptr + _ = pExpr + pExpr = _sqlite3Expr(tls, db, int32(TK_COLUMN), uintptr(0)) + if pExpr != 0 { + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = pTab + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = iCursor + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = iCol + } + return pExpr +} + +// C documentation +// +// /* +// ** This function is called to generate code executed when a row is deleted +// ** from the parent table of foreign key constraint pFKey and, if pFKey is +// ** deferred, when a row is inserted into the same table. When generating +// ** code for an SQL UPDATE operation, this function may be called twice - +// ** once to "delete" the old row and once to "insert" the new row. +// ** +// ** Parameter nIncr is passed -1 when inserting a row (as this may decrease +// ** the number of FK violations in the db) or +1 when deleting one (as this +// ** may increase the number of FK constraint problems). +// ** +// ** The code generated by this function scans through the rows in the child +// ** table that correspond to the parent table row being deleted or inserted. +// ** For each child row found, one of the following actions is taken: +// ** +// ** Operation | FK type | Action taken +// ** -------------------------------------------------------------------------- +// ** DELETE immediate Increment the "immediate constraint counter". +// ** +// ** INSERT immediate Decrement the "immediate constraint counter". +// ** +// ** DELETE deferred Increment the "deferred constraint counter". +// ** +// ** INSERT deferred Decrement the "deferred constraint counter". +// ** +// ** These operations are identified in the comment at the top of this file +// ** (fkey.c) as "I.2" and "D.2". +// */ +func _fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pIdx uintptr, pFKey uintptr, aiCol uintptr, regData int32, nIncr int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pAll, pEq, pEq1, pLeft, pLeft1, pNe, pRight, pRight1, pWInfo, pWhere, v, zCol uintptr + var i, iFkIfZero, v2, v3 int32 + var iCol, iCol1 Ti16 + var _ /* sNameContext at bp+0 */ TNameContext + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, iCol, iCol1, iFkIfZero, pAll, pEq, pEq1, pLeft, pLeft1, pNe, pRight, pRight1, pWInfo, pWhere, v, zCol, v2, v3 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Iterator variable */ + pWhere = uintptr(0) /* Context used by sqlite3WhereXXX() */ + iFkIfZero = 0 /* Address of OP_FkIfZero */ + v = _sqlite3GetVdbe(tls, pParse) + if nIncr < 0 { + iFkIfZero = _sqlite3VdbeAddOp2(tls, v, int32(OP_FkIfZero), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), 0) + } + /* Create an Expr object representing an SQL expression like: + ** + ** = AND = ... + ** + ** The collation sequence used for the comparison should be that of + ** the parent key columns. The affinity of the parent key column should + ** be applied to each child key value before the comparison takes place. + */ + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } /* Name of column in child table */ + if pIdx != 0 { + v2 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + } else { + v2 = -int32(1) + } + iCol = int16(v2) + pLeft = _exprTableRegister(tls, pParse, pTab, regData, iCol) + if aiCol != 0 { + v3 = *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) + } else { + v3 = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom + } + iCol = int16(v3) + zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iCol)*16))).FzCnName + pRight = _sqlite3Expr(tls, db, int32(TK_ID), zCol) + pEq = _sqlite3PExpr(tls, pParse, int32(TK_EQ), pLeft, pRight) + pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) + goto _1 + _1: + ; + i++ + } + /* If the child table is the same as the parent table, then add terms + ** to the WHERE clause that prevent this entry from being scanned. + ** The added WHERE clause terms are like this: + ** + ** $current_rowid!=rowid + ** NOT( $current_a==a AND $current_b==b AND ... ) + ** + ** The first form is used for rowid tables. The second form is used + ** for WITHOUT ROWID tables. In the second form, the *parent* key is + ** (a,b,...). Either the parent or primary key could be used to + ** uniquely identify the current row, but the parent key is more convenient + ** as the required values have already been loaded into registers + ** by the caller. + */ + if pTab == (*TFKey)(unsafe.Pointer(pFKey)).FpFrom && nIncr > 0 { /* Column ref to child table */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + pLeft1 = _exprTableRegister(tls, pParse, pTab, regData, int16(-int32(1))) + pRight1 = _exprTableColumn(tls, db, pTab, (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FiCursor, int16(-int32(1))) + pNe = _sqlite3PExpr(tls, pParse, int32(TK_NE), pLeft1, pRight1) + } else { + pAll = uintptr(0) + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + iCol1 = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) + pLeft1 = _exprTableRegister(tls, pParse, pTab, regData, iCol1) + pRight1 = _sqlite3Expr(tls, db, int32(TK_ID), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol1)*16))).FzCnName) + pEq1 = _sqlite3PExpr(tls, pParse, int32(TK_IS), pLeft1, pRight1) + pAll = _sqlite3ExprAnd(tls, pParse, pAll, pEq1) + goto _4 + _4: + ; + i++ + } + pNe = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pAll, uintptr(0)) + } + pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pNe) + } + /* Resolve the references in the WHERE clause. */ + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = pSrc + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + _sqlite3ResolveExprNames(tls, bp, pWhere) + /* Create VDBE to loop through the entries in pSrc that match the WHERE + ** clause. For each row found, increment either the deferred or immediate + ** foreign key constraint counter. */ + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + pWInfo = _sqlite3WhereBegin(tls, pParse, pSrc, pWhere, uintptr(0), uintptr(0), uintptr(0), uint16(0), 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), nIncr) + if pWInfo != 0 { + _sqlite3WhereEnd(tls, pWInfo) + } + } + /* Clean up the WHERE clause constructed above. */ + _sqlite3ExprDelete(tls, db, pWhere) + if iFkIfZero != 0 { + _sqlite3VdbeJumpHereOrPopInst(tls, v, iFkIfZero) + } +} + +// C documentation +// +// /* +// ** This function returns a linked list of FKey objects (connected by +// ** FKey.pNextTo) holding all children of table pTab. For example, +// ** given the following schema: +// ** +// ** CREATE TABLE t1(a PRIMARY KEY); +// ** CREATE TABLE t2(b REFERENCES t1(a); +// ** +// ** Calling this function with table "t1" as an argument returns a pointer +// ** to the FKey structure representing the foreign key constraint on table +// ** "t2". Calling this function with "t2" as the argument would return a +// ** NULL pointer (as there are no FK constraints for which t2 is the parent +// ** table). +// */ +func _sqlite3FkReferences(tls *libc.TLS, pTab uintptr) (r uintptr) { + return _sqlite3HashFind(tls, (*TTable)(unsafe.Pointer(pTab)).FpSchema+80, (*TTable)(unsafe.Pointer(pTab)).FzName) +} + +// C documentation +// +// /* +// ** The second argument is a Trigger structure allocated by the +// ** fkActionTrigger() routine. This function deletes the Trigger structure +// ** and all of its sub-components. +// ** +// ** The Trigger structure or any of its sub-components may be allocated from +// ** the lookaside buffer belonging to database handle dbMem. +// */ +func _fkTriggerDelete(tls *libc.TLS, dbMem uintptr, p uintptr) { + var pStep uintptr + _ = pStep + if p != 0 { + pStep = (*TTrigger)(unsafe.Pointer(p)).Fstep_list + _sqlite3ExprDelete(tls, dbMem, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere) + _sqlite3ExprListDelete(tls, dbMem, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList) + _sqlite3SelectDelete(tls, dbMem, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect) + _sqlite3ExprDelete(tls, dbMem, (*TTrigger)(unsafe.Pointer(p)).FpWhen) + _sqlite3DbFree(tls, dbMem, p) + } +} + +// C documentation +// +// /* +// ** Clear the apTrigger[] cache of CASCADE triggers for all foreign keys +// ** in a particular database. This needs to happen when the schema +// ** changes. +// */ +func _sqlite3FkClearTriggerCache(tls *libc.TLS, db uintptr, iDb int32) { + var k, pFKey, pHash, pTab uintptr + _, _, _, _ = k, pFKey, pHash, pTab + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 8 + k = (*THash)(unsafe.Pointer(pHash)).Ffirst + for { + if !(k != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(k)).Fdata + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + goto _1 + } + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } + _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48))) + *(*uintptr)(unsafe.Pointer(pFKey + 48)) = uintptr(0) + _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8))) + *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) = uintptr(0) + goto _2 + _2: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + } + goto _1 + _1: + ; + k = (*THashElem)(unsafe.Pointer(k)).Fnext + } +} + +// C documentation +// +// /* +// ** This function is called to generate code that runs when table pTab is +// ** being dropped from the database. The SrcList passed as the second argument +// ** to this function contains a single entry guaranteed to resolve to +// ** table pTab. +// ** +// ** Normally, no code is required. However, if either +// ** +// ** (a) The table is the parent table of a FK constraint, or +// ** (b) The table is the child table of a deferred FK constraint and it is +// ** determined at runtime that there are outstanding deferred FK +// ** constraint violations in the database, +// ** +// ** then the equivalent of "DELETE FROM " is executed before dropping +// ** the table from the database. Triggers are disabled while running this +// ** DELETE, but foreign key actions are not. +// */ +func _sqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uintptr) { + var db, p, v uintptr + var iSkip int32 + _, _, _, _ = db, iSkip, p, v + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == TABTYP_NORM { + iSkip = 0 + v = _sqlite3GetVdbe(tls, pParse) + /* VDBE has already been allocated */ + if _sqlite3FkReferences(tls, pTab) == uintptr(0) { + p = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(p != 0) { + break + } + if (*TFKey)(unsafe.Pointer(p)).FisDeferred != 0 || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) != 0 { + break + } + goto _1 + _1: + ; + p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom + } + if !(p != 0) { + return + } + iSkip = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkIfZero), int32(1), iSkip) + } + (*TParse)(unsafe.Pointer(pParse)).FdisableTriggers = uint8(1) + _sqlite3DeleteFrom(tls, pParse, _sqlite3SrcListDup(tls, db, pName, 0), uintptr(0), uintptr(0), uintptr(0)) + (*TParse)(unsafe.Pointer(pParse)).FdisableTriggers = uint8(0) + /* If the DELETE has generated immediate foreign key constraint + ** violations, halt the VDBE and return an error at this point, before + ** any modifications to the schema are made. This is because statement + ** transactions are not able to rollback schema changes. + ** + ** If the SQLITE_DeferFKs flag is set, then this is not required, as + ** the statement transaction will not be rolled back even if FK + ** constraints are violated. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_DeferFKs) == uint64(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkIfZero), 0, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + _sqlite3HaltConstraint(tls, pParse, libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(3)<= 0 { + return int32(1) + } + if iChildKey == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) && bChngRowid != 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** The second argument points to an FKey object representing a foreign key +// ** for which pTab is the parent table. An UPDATE statement against pTab +// ** is currently being processed. For each column of the table that is +// ** actually updated, the corresponding element in the aChange[] array +// ** is zero or greater (if a column is unmodified the corresponding element +// ** is set to -1). If the rowid column is modified by the UPDATE statement +// ** the bChngRowid argument is non-zero. +// ** +// ** This function returns true if any of the columns that are part of the +// ** parent key for FK constraint *p are modified. +// */ +func _fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, bChngRowid int32) (r int32) { + var i, iKey int32 + var pCol, zKey uintptr + _, _, _, _ = i, iKey, pCol, zKey + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(p)).FnCol) { + break + } + zKey = (*(*TsColMap)(unsafe.Pointer(p + 64 + uintptr(i)*16))).FzCol + iKey = 0 + for { + if !(iKey < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if *(*int32)(unsafe.Pointer(aChange + uintptr(iKey)*4)) >= 0 || iKey == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) && bChngRowid != 0 { + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iKey)*16 + if zKey != 0 { + if 0 == _sqlite3StrICmp(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, zKey) { + return int32(1) + } + } else { + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { + return int32(1) + } + } + } + goto _2 + _2: + ; + iKey++ + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if the parser passed as the first argument is being +// ** used to code a trigger that is really a "SET NULL" action belonging +// ** to trigger pFKey. +// */ +func _isSetNullAction(tls *libc.TLS, pParse uintptr, pFKey uintptr) (r int32) { + var p, pTop, v1 uintptr + _, _, _ = p, pTop, v1 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pTop = v1 + if (*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg != 0 { + p = (*TTriggerPrg)(unsafe.Pointer((*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg)).FpTrigger + if p == *(*uintptr)(unsafe.Pointer(pFKey + 48)) && int32(*(*Tu8)(unsafe.Pointer(pFKey + 45))) == int32(OE_SetNull) || p == *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8)) && int32(*(*Tu8)(unsafe.Pointer(pFKey + 45 + 1))) == int32(OE_SetNull) { + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** This function is called when inserting, deleting or updating a row of +// ** table pTab to generate VDBE code to perform foreign key constraint +// ** processing for the operation. +// ** +// ** For a DELETE operation, parameter regOld is passed the index of the +// ** first register in an array of (pTab->nCol+1) registers containing the +// ** rowid of the row being deleted, followed by each of the column values +// ** of the row being deleted, from left to right. Parameter regNew is passed +// ** zero in this case. +// ** +// ** For an INSERT operation, regOld is passed zero and regNew is passed the +// ** first register of an array of (pTab->nCol+1) registers containing the new +// ** row data. +// ** +// ** For an UPDATE operation, this function is called twice. Once before +// ** the original record is deleted from the table using the calling convention +// ** described for DELETE. Then again after the original record is deleted +// ** but before the new record is inserted using the INSERT convention. +// */ +func _sqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, regNew int32, aChange uintptr, bChngRowid int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var aiCol, db, pFKey, pItem, pSrc, pTo, v, zCol, zDb, v7 uintptr + var bIgnore, eAction, i, iDb, iFromCol, iJump, iReg, isIgnoreErrors, rcauth, v4, v6 int32 + var _ /* aiCol at bp+32 */ uintptr + var _ /* aiFree at bp+8 */ uintptr + var _ /* iCol at bp+16 */ int32 + var _ /* pIdx at bp+0 */ uintptr + var _ /* pIdx at bp+24 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aiCol, bIgnore, db, eAction, i, iDb, iFromCol, iJump, iReg, isIgnoreErrors, pFKey, pItem, pSrc, pTo, rcauth, v, zCol, zDb, v4, v6, v7 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Name of database containing pTab */ + isIgnoreErrors = int32((*TParse)(unsafe.Pointer(pParse)).FdisableTriggers) + /* Exactly one of regOld and regNew should be non-zero. */ + /* If foreign-keys are disabled, this function is a no-op. */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) == uint64(0) { + return + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + return + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + /* Loop through all the foreign key constraints for which pTab is the + ** child table (the table that the foreign key definition is part of). */ + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } /* Parent table of foreign key pFKey */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Index on key columns in pTo */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + bIgnore = 0 + if aChange != 0 && Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TFKey)(unsafe.Pointer(pFKey)).FzTo) != 0 && _fkChildIsModified(tls, pTab, pFKey, aChange, bChngRowid) == 0 { + goto _1 + } + /* Find the parent table of this foreign key. Also find a unique index + ** on the parent key columns in the parent table. If either of these + ** schema items cannot be located, set an error in pParse and return + ** early. */ + if (*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0 { + pTo = _sqlite3FindTable(tls, db, (*TFKey)(unsafe.Pointer(pFKey)).FzTo, zDb) + } else { + pTo = _sqlite3LocateTable(tls, pParse, uint32(0), (*TFKey)(unsafe.Pointer(pFKey)).FzTo, zDb) + } + if !(pTo != 0) || _sqlite3FkLocateIndex(tls, pParse, pTo, pFKey, bp, bp+8) != 0 { + if !(isIgnoreErrors != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + if pTo == uintptr(0) { + /* If isIgnoreErrors is true, then a table is being dropped. In this + ** case SQLite runs a "DELETE FROM xxx" on the table being dropped + ** before actually dropping it in order to check FK constraints. + ** If the parent table of an FK constraint on the current table is + ** missing, behave as if it is empty. i.e. decrement the relevant + ** FK counter for each row of the current table with non-NULL keys. + */ + v = _sqlite3GetVdbe(tls, pParse) + iJump = _sqlite3VdbeCurrentAddr(tls, v) + (*TFKey)(unsafe.Pointer(pFKey)).FnCol + int32(1) + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + iFromCol = (*(*TsColMap)(unsafe.Pointer(pFKey + 64 + uintptr(i)*16))).FiFrom + iReg = int32(_sqlite3TableColumnToStorage(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, int16(iFromCol))) + regOld + int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), iReg, iJump) + goto _2 + _2: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_FkCounter), int32((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred), -int32(1)) + } + goto _1 + } + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + aiCol = *(*uintptr)(unsafe.Pointer(bp + 8)) + } else { + *(*int32)(unsafe.Pointer(bp + 16)) = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom + aiCol = bp + 16 + } + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = -int32(1) + } + /* Request permission to read the parent key columns. If the + ** authorization callback returns SQLITE_IGNORE, behave as if any + ** values read from the parent table are NULL. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth != 0 { + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v4 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2))) + } else { + v4 = int32((*TTable)(unsafe.Pointer(pTo)).FiPKey) + } + zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTo)).FaCol + uintptr(v4)*16))).FzCnName + rcauth = _sqlite3AuthReadCol(tls, pParse, (*TTable)(unsafe.Pointer(pTo)).FzName, zCol, iDb) + bIgnore = libc.BoolInt32(rcauth == int32(SQLITE_IGNORE)) + } + goto _3 + _3: + ; + i++ + } + /* Take a shared-cache advisory read-lock on the parent table. Allocate + ** a cursor to use to search the unique index on the parent key columns + ** in the parent table. */ + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTo)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTo)).FzName) + (*TParse)(unsafe.Pointer(pParse)).FnTab++ + if regOld != 0 { + /* A row is being removed from the child table. Search for the parent. + ** If the parent does not exist, removing the child row resolves an + ** outstanding foreign key constraint violation. */ + _fkLookupParent(tls, pParse, iDb, pTo, *(*uintptr)(unsafe.Pointer(bp)), pFKey, aiCol, regOld, -int32(1), bIgnore) + } + if regNew != 0 && !(_isSetNullAction(tls, pParse, pFKey) != 0) { + /* A row is being added to the child table. If a parent row cannot + ** be found, adding the child row has violated the FK constraint. + ** + ** If this operation is being performed as part of a trigger program + ** that is actually a "SET NULL" action belonging to this very + ** foreign key, then omit this scan altogether. As all child key + ** values are guaranteed to be NULL, it is not possible for adding + ** this row to cause an FK violation. */ + _fkLookupParent(tls, pParse, iDb, pTo, *(*uintptr)(unsafe.Pointer(bp)), pFKey, aiCol, regNew, +libc.Int32FromInt32(1), bIgnore) + } + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) + goto _1 + _1: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + } + /* Loop through all the foreign key constraints that refer to this table. + ** (the "child" constraints) */ + pFKey = _sqlite3FkReferences(tls, pTab) + for { + if !(pFKey != 0) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 32)) = uintptr(0) + if aChange != 0 && _fkParentIsModified(tls, pTab, pFKey, aChange, bChngRowid) == 0 { + goto _5 + } + if !((*TFKey)(unsafe.Pointer(pFKey)).FisDeferred != 0) && !((*Tsqlite3)(unsafe.Pointer(db)).Fflags&libc.Uint64FromInt32(SQLITE_DeferFKs) != 0) && !((*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0) && !((*TParse)(unsafe.Pointer(pParse)).FisMultiWrite != 0) { + /* Inserting a single row into a parent table cannot cause (or fix) + ** an immediate foreign key violation. So do nothing in this case. */ + goto _5 + } + if _sqlite3FkLocateIndex(tls, pParse, pTab, pFKey, bp+24, bp+32) != 0 { + if !(isIgnoreErrors != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + goto _5 + } + /* Create a SrcList structure containing the child table. We need the + ** child table as a SrcList for sqlite3WhereBegin() */ + pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pSrc != 0 { + pItem = pSrc + 8 + (*TSrcItem)(unsafe.Pointer(pItem)).FpTab = (*TFKey)(unsafe.Pointer(pFKey)).FpFrom + (*TSrcItem)(unsafe.Pointer(pItem)).FzName = (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName + (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FnTabRef++ + v7 = pParse + 52 + v6 = *(*int32)(unsafe.Pointer(v7)) + *(*int32)(unsafe.Pointer(v7))++ + (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor = v6 + if regNew != 0 { + _fkScanChildren(tls, pParse, pSrc, pTab, *(*uintptr)(unsafe.Pointer(bp + 24)), pFKey, *(*uintptr)(unsafe.Pointer(bp + 32)), regNew, -int32(1)) + } + if regOld != 0 { + eAction = int32(*(*Tu8)(unsafe.Pointer(pFKey + 45 + libc.BoolUintptr(aChange != uintptr(0))))) + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00008))< int32(31) { + v3 = uint32(0xffffffff) + } else { + v3 = libc.Uint32FromInt32(1) << (*(*TsColMap)(unsafe.Pointer(p + 64 + uintptr(i)*16))).FiFrom + } + mask |= v3 + goto _2 + _2: + ; + i++ + } + goto _1 + _1: + ; + p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom + } + p = _sqlite3FkReferences(tls, pTab) + for { + if !(p != 0) { + break + } + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3FkLocateIndex(tls, pParse, pTab, p, bp, uintptr(0)) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnKeyCol)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2))) > int32(31) { + v6 = uint32(0xffffffff) + } else { + v6 = libc.Uint32FromInt32(1) << *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2)) + } + mask |= v6 + goto _5 + _5: + ; + i++ + } + } + goto _4 + _4: + ; + p = (*TFKey)(unsafe.Pointer(p)).FpNextTo + } + } + return mask +} + +// C documentation +// +// /* +// ** This function is called before generating code to update or delete a +// ** row contained in table pTab. If the operation is a DELETE, then +// ** parameter aChange is passed a NULL value. For an UPDATE, aChange points +// ** to an array of size N, where N is the number of columns in table pTab. +// ** If the i'th column is not modified by the UPDATE, then the corresponding +// ** entry in the aChange[] array is set to -1. If the column is modified, +// ** the value is 0 or greater. Parameter chngRowid is set to true if the +// ** UPDATE statement modifies the rowid fields of the table. +// ** +// ** If any foreign key processing will be required, this function returns +// ** non-zero. If there is no foreign key related processing, this function +// ** returns zero. +// ** +// ** For an UPDATE, this function returns 2 if: +// ** +// ** * There are any FKs for which pTab is the child and the parent table +// ** and any FK processing at all is required (even of a different FK), or +// ** +// ** * the UPDATE modifies one or more parent keys for which the action is +// ** not "NO ACTION" (i.e. is CASCADE, SET DEFAULT or SET NULL). +// ** +// ** Or, assuming some other foreign key processing is required, 1. +// */ +func _sqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uintptr, chngRowid int32) (r int32) { + var bHaveFK, eRet, v3 int32 + var p uintptr + _, _, _, _ = bHaveFK, eRet, p, v3 + eRet = int32(1) /* Value to return if bHaveFK is true */ + bHaveFK = 0 /* If FK processing is required */ + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_ForeignKeys) != 0 && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == TABTYP_NORM { + if !(aChange != 0) { + /* A DELETE operation. Foreign key processing is required if the + ** table in question is either the child or parent table for any + ** foreign key constraint. */ + bHaveFK = libc.BoolInt32(_sqlite3FkReferences(tls, pTab) != 0 || (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey != 0) + } else { + /* Check if any child key columns are being modified. */ + p = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(p != 0) { + break + } + if _fkChildIsModified(tls, pTab, p, aChange, chngRowid) != 0 { + if 0 == Xsqlite3_stricmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TFKey)(unsafe.Pointer(p)).FzTo) { + eRet = int32(2) + } + bHaveFK = int32(1) + } + goto _1 + _1: + ; + p = (*TFKey)(unsafe.Pointer(p)).FpNextFrom + } + /* Check if any parent key columns are being modified. */ + p = _sqlite3FkReferences(tls, pTab) + for { + if !(p != 0) { + break + } + if _fkParentIsModified(tls, pTab, p, aChange, chngRowid) != 0 { + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&(uint64(libc.Int32FromInt32(0x00008))< parent key cols */ + pStep = uintptr(0) /* First (only) step of trigger program */ + pWhere = uintptr(0) /* WHERE clause of trigger step */ + pList = uintptr(0) /* Changes list if ON UPDATE CASCADE */ + pSelect = uintptr(0) /* Iterator variable */ + pWhen = uintptr(0) /* WHEN clause for the trigger */ + if _sqlite3FkLocateIndex(tls, pParse, pTab, pFKey, bp, bp+8) != 0 { + return uintptr(0) + } + i = 0 + for { + if !(i < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { + break + } + *(*TToken)(unsafe.Pointer(bp + 16)) = TToken{ + Fz: __ccgo_ts + 6628, + Fn: uint32(3), + } /* Literal "old" token */ + *(*TToken)(unsafe.Pointer(bp + 32)) = TToken{ + Fz: __ccgo_ts + 6624, + Fn: uint32(3), + } /* tFromCol = OLD.tToCol */ + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + v2 = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)) + } else { + v2 = (*(*TsColMap)(unsafe.Pointer(pFKey + 64))).FiFrom + } + iFromCol = v2 + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v3 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaiColumn + uintptr(i)*2))) + } else { + v3 = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + } + _sqlite3TokenInit(tls, bp+64, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(v3)*16))).FzCnName) + _sqlite3TokenInit(tls, bp+48, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iFromCol)*16))).FzCnName) + /* Create the expression "OLD.zToCol = zFromCol". It is important + ** that the "OLD.zToCol" term is on the LHS of the = operator, so + ** that the affinity and collation sequence associated with the + ** parent table are used for the comparison. */ + pEq = _sqlite3PExpr(tls, pParse, int32(TK_EQ), _sqlite3PExpr(tls, pParse, int32(TK_DOT), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+16, 0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+64, 0)), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+48, 0)) + pWhere = _sqlite3ExprAnd(tls, pParse, pWhere, pEq) + /* For ON UPDATE, construct the next term of the WHEN clause. + ** The final WHEN clause will be like this: + ** + ** WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN) + */ + if pChanges != 0 { + pEq = _sqlite3PExpr(tls, pParse, int32(TK_IS), _sqlite3PExpr(tls, pParse, int32(TK_DOT), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+16, 0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+64, 0)), _sqlite3PExpr(tls, pParse, int32(TK_DOT), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+32, 0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+64, 0))) + pWhen = _sqlite3ExprAnd(tls, pParse, pWhen, pEq) + } + if action != int32(OE_Restrict) && (action != int32(OE_Cascade) || pChanges != 0) { + if action == int32(OE_Cascade) { + pNew = _sqlite3PExpr(tls, pParse, int32(TK_DOT), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+32, 0), _sqlite3ExprAlloc(tls, db, int32(TK_ID), bp+64, 0)) + } else { + if action == int32(OE_SetDflt) { + pCol = (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iFromCol)*16 + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + pDflt = uintptr(0) + } else { + pDflt = _sqlite3ColumnExpr(tls, (*TFKey)(unsafe.Pointer(pFKey)).FpFrom, pCol) + } + if pDflt != 0 { + pNew = _sqlite3ExprDup(tls, db, pDflt, 0) + } else { + pNew = _sqlite3ExprAlloc(tls, db, int32(TK_NULL), uintptr(0), 0) + } + } else { + pNew = _sqlite3ExprAlloc(tls, db, int32(TK_NULL), uintptr(0), 0) + } + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) + _sqlite3ExprListSetName(tls, pParse, pList, bp+48, 0) + } + goto _1 + _1: + ; + i++ + } + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) + zFrom = (*TTable)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName + nFrom = _sqlite3Strlen30(tls, zFrom) + if action == int32(OE_Restrict) { + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + pRaise = _sqlite3Expr(tls, db, int32(TK_RAISE), __ccgo_ts+5257) + if pRaise != 0 { + (*TExpr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) + } + pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pSrc != 0 { + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzName = _sqlite3DbStrDup(tls, db, zFrom) + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzDatabase = _sqlite3DbStrDup(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + } + pSelect = _sqlite3SelectNew(tls, pParse, _sqlite3ExprListAppend(tls, pParse, uintptr(0), pRaise), pSrc, pWhere, uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + pWhere = uintptr(0) + } + /* Disable lookaside memory allocation */ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + pTrigger = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt64(72)+libc.Uint64FromInt64(96)+uint64(nFrom)+uint64(1)) + if pTrigger != 0 { + v4 = pTrigger + 1*72 + (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list = v4 + pStep = v4 + (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget = pStep + 1*96 + libc.Xmemcpy(tls, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget, zFrom, uint64(nFrom)) + (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere = _sqlite3ExprDup(tls, db, pWhere, int32(EXPRDUP_REDUCE)) + (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList = _sqlite3ExprListDup(tls, db, pList, int32(EXPRDUP_REDUCE)) + (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect = _sqlite3SelectDup(tls, db, pSelect, int32(EXPRDUP_REDUCE)) + if pWhen != 0 { + pWhen = _sqlite3PExpr(tls, pParse, int32(TK_NOT), pWhen, uintptr(0)) + (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen = _sqlite3ExprDup(tls, db, pWhen, int32(EXPRDUP_REDUCE)) + } + } + /* Re-enable the lookaside buffer, if it was disabled earlier. */ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + v5 = 0 + } else { + v5 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v5) + _sqlite3ExprDelete(tls, db, pWhere) + _sqlite3ExprDelete(tls, db, pWhen) + _sqlite3ExprListDelete(tls, db, pList) + _sqlite3SelectDelete(tls, db, pSelect) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == int32(1) { + _fkTriggerDelete(tls, db, pTrigger) + return uintptr(0) + } + switch action { + case int32(OE_Restrict): + (*TTriggerStep)(unsafe.Pointer(pStep)).Fop = uint8(TK_SELECT) + case int32(OE_Cascade): + if !(pChanges != 0) { + (*TTriggerStep)(unsafe.Pointer(pStep)).Fop = uint8(TK_DELETE) + break + } + fallthrough + default: + (*TTriggerStep)(unsafe.Pointer(pStep)).Fop = uint8(TK_UPDATE) + } + (*TTriggerStep)(unsafe.Pointer(pStep)).FpTrig = pTrigger + (*TTrigger)(unsafe.Pointer(pTrigger)).FpSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + (*TTrigger)(unsafe.Pointer(pTrigger)).FpTabSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + *(*uintptr)(unsafe.Pointer(pFKey + 48 + uintptr(iAction)*8)) = pTrigger + if pChanges != 0 { + v6 = int32(TK_UPDATE) + } else { + v6 = int32(TK_DELETE) + } + (*TTrigger)(unsafe.Pointer(pTrigger)).Fop = uint8(v6) + } + return pTrigger +} + +// C documentation +// +// /* +// ** This function is called when deleting or updating a row to implement +// ** any required CASCADE, SET NULL or SET DEFAULT actions. +// */ +func _sqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uintptr, regOld int32, aChange uintptr, bChngRowid int32) { + var pAct, pFKey uintptr + _, _ = pAct, pFKey + /* If foreign-key support is enabled, iterate through all FKs that + ** refer to table pTab. If there is an action associated with the FK + ** for this operation (either update or delete), invoke the associated + ** trigger sub-program. */ + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_ForeignKeys) != 0 { /* Iterator variable */ + pFKey = _sqlite3FkReferences(tls, pTab) + for { + if !(pFKey != 0) { + break + } + if aChange == uintptr(0) || _fkParentIsModified(tls, pTab, pFKey, aChange, bChngRowid) != 0 { + pAct = _fkActionTrigger(tls, pParse, pTab, pFKey, pChanges) + if pAct != 0 { + _sqlite3CodeRowTriggerDirect(tls, pParse, pAct, pTab, regOld, int32(OE_Abort), 0) + } + } + goto _1 + _1: + ; + pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo + } + } +} + +// C documentation +// +// /* +// ** Free all memory associated with foreign key definitions attached to +// ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash +// ** hash table. +// */ +func _sqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { + var pFKey, pNext, z, v2 uintptr + _, _, _, _ = pFKey, pNext, z, v2 /* Copy of pFKey->pNextFrom */ + pFKey = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab + 64))).FpFKey + for { + if !(pFKey != 0) { + break + } + /* Remove the FK from the fkeyHash hash table. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + if (*TFKey)(unsafe.Pointer(pFKey)).FpPrevTo != 0 { + (*TFKey)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpPrevTo)).FpNextTo = (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo + } else { + if (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo != 0 { + v2 = (*TFKey)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpNextTo)).FzTo + } else { + v2 = (*TFKey)(unsafe.Pointer(pFKey)).FzTo + } + z = v2 + _sqlite3HashInsert(tls, (*TTable)(unsafe.Pointer(pTab)).FpSchema+80, z, (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo) + } + if (*TFKey)(unsafe.Pointer(pFKey)).FpNextTo != 0 { + (*TFKey)(unsafe.Pointer((*TFKey)(unsafe.Pointer(pFKey)).FpNextTo)).FpPrevTo = (*TFKey)(unsafe.Pointer(pFKey)).FpPrevTo + } + } + /* EV: R-30323-21917 Each foreign key constraint in SQLite is + ** classified as either immediate or deferred. + */ + /* Delete any triggers created to implement actions for this FK. */ + _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48))) + _fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer(pFKey + 48 + 1*8))) + pNext = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom + _sqlite3DbFree(tls, db, pFKey) + goto _1 + _1: + ; + pFKey = pNext + } +} + +/************** End of fkey.c ************************************************/ +/************** Begin file insert.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C code routines that are called by the parser +** to handle INSERT statements in SQLite. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Generate code that will +// ** +// ** (1) acquire a lock for table pTab then +// ** (2) open pTab as cursor iCur. +// ** +// ** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index +// ** for that table that is actually opened. +// */ +func _sqlite3OpenTable(tls *libc.TLS, pParse uintptr, iCur int32, iDb int32, pTab uintptr, opcode int32) { + var pPk, v uintptr + var v1 int32 + _, _, _ = pPk, v, v1 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnoSharedCache != 0) { + if opcode == int32(OP_OpenWrite) { + v1 = int32(1) + } else { + v1 = 0 + } + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(v1), (*TTable)(unsafe.Pointer(pTab)).FzName) + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp4Int(tls, v, opcode, iCur, int32((*TTable)(unsafe.Pointer(pTab)).Ftnum), iDb, int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol)) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + _sqlite3VdbeAddOp3(tls, v, opcode, iCur, int32((*TIndex)(unsafe.Pointer(pPk)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) + } +} + +// C documentation +// +// /* +// ** Return a pointer to the column affinity string associated with index +// ** pIdx. A column affinity string has one character for each column in +// ** the table, according to the affinity of the column: +// ** +// ** Character Column affinity +// ** ------------------------------ +// ** 'A' BLOB +// ** 'B' TEXT +// ** 'C' NUMERIC +// ** 'D' INTEGER +// ** 'F' REAL +// ** +// ** An extra 'D' is appended to the end of the string to cover the +// ** rowid that appears as the last column in every index. +// ** +// ** Memory for the buffer containing the column index affinity string +// ** is managed along with the rest of the Index structure. It will be +// ** released when sqlite3DeleteIndex() is called. +// */ +func _computeIndexAffStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { + var aff int8 + var n int32 + var pTab uintptr + var x Ti16 + _, _, _, _ = aff, n, pTab, x + pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable + (*TIndex)(unsafe.Pointer(pIdx)).FzColAff = _sqlite3DbMallocRaw(tls, uintptr(0), uint64(int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)+int32(1))) + if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { + _sqlite3OomFault(tls, db) + return uintptr(0) + } + n = 0 + for { + if !(n < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + x = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) + if int32(x) >= 0 { + aff = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(x)*16))).Faffinity + } else { + if int32(x) == -int32(1) { + aff = int8(SQLITE_AFF_INTEGER) + } else { + aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(n)*32))).FpExpr) + } + } + if int32(aff) < int32(SQLITE_AFF_BLOB) { + aff = int8(SQLITE_AFF_BLOB) + } + if int32(aff) > int32(SQLITE_AFF_NUMERIC) { + aff = int8(SQLITE_AFF_NUMERIC) + } + *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff + goto _1 + _1: + ; + n++ + } + *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = 0 + return (*TIndex)(unsafe.Pointer(pIdx)).FzColAff +} + +func _sqlite3IndexAffinityStr(tls *libc.TLS, db uintptr, pIdx uintptr) (r uintptr) { + if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { + return _computeIndexAffStr(tls, db, pIdx) + } + return (*TIndex)(unsafe.Pointer(pIdx)).FzColAff +} + +// C documentation +// +// /* +// ** Compute an affinity string for a table. Space is obtained +// ** from sqlite3DbMalloc(). The caller is responsible for freeing +// ** the space when done. +// */ +func _sqlite3TableAffinityStr(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { + var i, j, v2, v3, v4 int32 + var zColAff uintptr + _, _, _, _, _, _ = i, j, zColAff, v2, v3, v4 + zColAff = _sqlite3DbMallocRaw(tls, db, uint64(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+int32(1))) + if zColAff != 0 { + v2 = libc.Int32FromInt32(0) + j = v2 + i = v2 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + v3 = j + j++ + *(*int8)(unsafe.Pointer(zColAff + uintptr(v3))) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).Faffinity + } + goto _1 + _1: + ; + i++ + } + for cond := true; cond; cond = j >= 0 && int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= int32(SQLITE_AFF_BLOB) { + v4 = j + j-- + *(*int8)(unsafe.Pointer(zColAff + uintptr(v4))) = 0 + } + } + return zColAff +} + +// C documentation +// +// /* +// ** Make changes to the evolving bytecode to do affinity transformations +// ** of values that are about to be gathered into a row for table pTab. +// ** +// ** For ordinary (legacy, non-strict) tables: +// ** ----------------------------------------- +// ** +// ** Compute the affinity string for table pTab, if it has not already been +// ** computed. As an optimization, omit trailing SQLITE_AFF_BLOB affinities. +// ** +// ** If the affinity string is empty (because it was all SQLITE_AFF_BLOB entries +// ** which were then optimized out) then this routine becomes a no-op. +// ** +// ** Otherwise if iReg>0 then code an OP_Affinity opcode that will set the +// ** affinities for register iReg and following. Or if iReg==0, +// ** then just set the P4 operand of the previous opcode (which should be +// ** an OP_MakeRecord) to the affinity string. +// ** +// ** A column affinity string has one character per column: +// ** +// ** Character Column affinity +// ** --------- --------------- +// ** 'A' BLOB +// ** 'B' TEXT +// ** 'C' NUMERIC +// ** 'D' INTEGER +// ** 'E' REAL +// ** +// ** For STRICT tables: +// ** ------------------ +// ** +// ** Generate an appropriate OP_TypeCheck opcode that will verify the +// ** datatypes against the column definitions in pTab. If iReg==0, that +// ** means an OP_MakeRecord opcode has already been generated and should be +// ** the last opcode generated. The new OP_TypeCheck needs to be inserted +// ** before the OP_MakeRecord. The new OP_TypeCheck should use the same +// ** register set as the OP_MakeRecord. If iReg>0 then register iReg is +// ** the first of a series of registers that will form the new record. +// ** Apply the type checking to that array of registers. +// */ +func _sqlite3TableAffinity(tls *libc.TLS, v uintptr, pTab uintptr, iReg int32) { + var i int32 + var pPrev, zColAff uintptr + _, _, _ = i, pPrev, zColAff + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Strict) != 0 { + if iReg == 0 { + _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) + pPrev = _sqlite3VdbeGetLastOp(tls, v) + (*TVdbeOp)(unsafe.Pointer(pPrev)).Fopcode = uint8(OP_TypeCheck) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp1, (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp2, (*TVdbeOp)(unsafe.Pointer(pPrev)).Fp3) + } else { + /* Insert an isolated OP_Typecheck */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_TypeCheck), iReg, int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol)) + _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) + } + return + } + zColAff = (*TTable)(unsafe.Pointer(pTab)).FzColAff + if zColAff == uintptr(0) { + zColAff = _sqlite3TableAffinityStr(tls, uintptr(0), pTab) + if !(zColAff != 0) { + _sqlite3OomFault(tls, _sqlite3VdbeDb(tls, v)) + return + } + (*TTable)(unsafe.Pointer(pTab)).FzColAff = zColAff + } + i = int32(libc.Xstrlen(tls, zColAff) & libc.Uint64FromInt32(0x3fffffff)) + if i != 0 { + if iReg != 0 { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), iReg, i, 0, zColAff, i) + } else { + _sqlite3VdbeChangeP4(tls, v, -int32(1), zColAff, i) + } + } +} + +// C documentation +// +// /* +// ** Return non-zero if the table pTab in database iDb or any of its indices +// ** have been opened at any point in the VDBE program. This is used to see if +// ** a statement of the form "INSERT INTO SELECT ..." can +// ** run without using a temporary table for the results of the SELECT. +// */ +func _readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) (r int32) { + var i, iEnd int32 + var pIndex, pOp, pVTab, v, v1 uintptr + var tnum TPgno + _, _, _, _, _, _, _, _ = i, iEnd, pIndex, pOp, pVTab, tnum, v, v1 + v = _sqlite3GetVdbe(tls, p) + iEnd = _sqlite3VdbeCurrentAddr(tls, v) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + v1 = _sqlite3GetVTable(tls, (*TParse)(unsafe.Pointer(p)).Fdb, pTab) + } else { + v1 = uintptr(0) + } + pVTab = v1 + i = int32(1) + for { + if !(i < iEnd) { + break + } + pOp = _sqlite3VdbeGetOp(tls, v, i) + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_OpenRead) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 == iDb { + tnum = uint32((*TVdbeOp)(unsafe.Pointer(pOp)).Fp2) + if tnum == (*TTable)(unsafe.Pointer(pTab)).Ftnum { + return int32(1) + } + pIndex = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIndex != 0) { + break + } + if tnum == (*TIndex)(unsafe.Pointer(pIndex)).Ftnum { + return int32(1) + } + goto _3 + _3: + ; + pIndex = (*TIndex)(unsafe.Pointer(pIndex)).FpNext + } + } + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_VOpen) && *(*uintptr)(unsafe.Pointer(pOp + 16)) == pVTab { + return int32(1) + } + goto _2 + _2: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* This walker callback will compute the union of colFlags flags for all +// ** referenced columns in a CHECK constraint or generated column expression. +// */ +func _exprColumnFlagUnion(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var p1 uintptr + _ = p1 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 { + p1 = pWalker + 36 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | int32((*(*TColumn)(unsafe.Pointer((*TTable1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)))).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*16))).FcolFlags)) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** All regular columns for table pTab have been puts into registers +// ** starting with iRegStore. The registers that correspond to STORED +// ** or VIRTUAL columns have not yet been initialized. This routine goes +// ** back and computes the values for those columns based on the previously +// ** computed normal columns. +// */ +func _sqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore int32, pTab uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var eProgress, i, ii, jj, x, v2 int32 + var pCol, pOp, pRedo, zP4, p4, p6, p7, p8 uintptr + var _ /* w at bp+0 */ TWalker + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eProgress, i, ii, jj, pCol, pOp, pRedo, x, zP4, v2, p4, p6, p7, p8 + /* Before computing generated columns, first go through and make sure + ** that appropriate affinity has been applied to the regular columns + */ + _sqlite3TableAffinity(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, pTab, iRegStore) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasStored) != uint32(0) { + pOp = _sqlite3VdbeGetLastOp(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe) + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Affinity) { + zP4 = *(*uintptr)(unsafe.Pointer(pOp + 16)) + v2 = libc.Int32FromInt32(0) + jj = v2 + ii = v2 + for { + if !(*(*int8)(unsafe.Pointer(zP4 + uintptr(jj))) != 0) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(ii)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + goto _1 + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(ii)*16))).FcolFlags)&int32(COLFLAG_STORED) != 0 { + *(*int8)(unsafe.Pointer(zP4 + uintptr(jj))) = int8(SQLITE_AFF_NONE) + } + jj++ + goto _1 + _1: + ; + ii++ + } + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_TypeCheck) { + /* If an OP_TypeCheck was generated because the table is STRICT, + ** then set the P3 operand to indicate that generated columns should + ** not be checked */ + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 = int32(1) + } + } + } + /* Because there can be multiple generated columns that refer to one another, + ** this is a two-pass algorithm. On the first pass, mark all generated + ** columns as "not available". + */ + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + p4 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 + 14 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(COLFLAG_NOTAVAIL)) + } + goto _3 + _3: + ; + i++ + } + *(*uintptr)(unsafe.Pointer(bp + 40)) = pTab + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprColumnFlagUnion) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + /* On the second pass, compute the value of each NOT-AVAILABLE column. + ** Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will + ** compute dependencies and mark remove the COLSPAN_NOTAVAIL mark, as + ** they are needed. + */ + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = -iRegStore + for cond := true; cond; cond = pRedo != 0 && eProgress != 0 { + eProgress = 0 + pRedo = uintptr(0) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_NOTAVAIL) != 0 { + p6 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p6)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p6))) | libc.Int32FromInt32(COLFLAG_BUSY)) + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(0) + _sqlite3WalkExpr(tls, bp, _sqlite3ColumnExpr(tls, pTab, pCol)) + p7 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p7)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p7))) & ^libc.Int32FromInt32(COLFLAG_BUSY)) + if int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode)&int32(COLFLAG_NOTAVAIL) != 0 { + pRedo = pCol + goto _5 + } + eProgress = int32(1) + x = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(i))) + iRegStore + _sqlite3ExprCodeGeneratedColumn(tls, pParse, pTab, pCol, x) + p8 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p8)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p8))) & ^libc.Int32FromInt32(COLFLAG_NOTAVAIL)) + } + goto _5 + _5: + ; + i++ + } + } + if pRedo != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8194, libc.VaList(bp+56, (*TColumn)(unsafe.Pointer(pRedo)).FzCnName)) + } + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 +} + +// C documentation +// +// /* +// ** Locate or create an AutoincInfo structure associated with table pTab +// ** which is in database iDb. Return the register number for the register +// ** that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT +// ** table. (Also return zero when doing a VACUUM since we do not want to +// ** update the AUTOINCREMENT counters during a VACUUM.) +// ** +// ** There is at most one AutoincInfo structure per table even if the +// ** same table is autoincremented multiple times due to inserts within +// ** triggers. A new AutoincInfo structure is created if this is the +// ** first use of table pTab. On 2nd and subsequent uses, the original +// ** AutoincInfo structure is used. +// ** +// ** Four consecutive registers are allocated: +// ** +// ** (1) The name of the pTab table. +// ** (2) The maximum ROWID of pTab. +// ** (3) The rowid in sqlite_sequence of pTab +// ** (4) The original value of the max ROWID in pTab, or NULL if none +// ** +// ** The 2nd register is the one that is returned. That is all the +// ** insert routine needs to know about. +// */ +func _autoIncBegin(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr) (r int32) { + var memId, v2 int32 + var pInfo, pSeqTab, pToplevel, v1, v3 uintptr + _, _, _, _, _, _, _ = memId, pInfo, pSeqTab, pToplevel, v1, v2, v3 + memId = 0 /* Register holding maximum rowid */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != uint32(0) && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pToplevel = v1 + pSeqTab = (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FpSchema)).FpSeqTab + /* Verify that the sqlite_sequence table exists and is an ordinary + ** rowid table with exactly two columns. + ** Ticket d8dc2b3a58cd5dc2918a1d4acb 2018-05-23 */ + if pSeqTab == uintptr(0) || !((*TTable)(unsafe.Pointer(pSeqTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) || int32((*TTable)(unsafe.Pointer(pSeqTab)).FeTabType) == int32(TABTYP_VTAB) || int32((*TTable)(unsafe.Pointer(pSeqTab)).FnCol) != int32(2) { + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + (*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(2)< 0 { + _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_MemMax), memId, regRowid) + } +} + +// C documentation +// +// /* +// ** This routine generates the code needed to write autoincrement +// ** maximum rowid values back into the sqlite_sequence register. +// ** Every statement that might do an INSERT into an autoincrement +// ** table (either directly or through triggers) needs to call this +// ** routine just before the "exit" code. +// */ +func _autoIncrementEnd(tls *libc.TLS, pParse uintptr) { + var aOp, db, p, pDb, v uintptr + var iRec, memId int32 + _, _, _, _, _, _, _ = aOp, db, iRec, memId, p, pDb, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = (*TParse)(unsafe.Pointer(pParse)).FpAinc + for { + if !(p != 0) { + break + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*TAutoincInfo)(unsafe.Pointer(p)).FiDb)*32 + memId = (*TAutoincInfo)(unsafe.Pointer(p)).FregCtr + iRec = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Le), memId+int32(2), _sqlite3VdbeCurrentAddr(tls, v)+int32(7), memId) + _sqlite3OpenTable(tls, pParse, 0, (*TAutoincInfo)(unsafe.Pointer(p)).FiDb, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab, int32(OP_OpenWrite)) + aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(20)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_autoIncEnd)), _iLn2) + if aOp == uintptr(0) { + break + } + (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp1 = memId + int32(1) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fp2 = memId + int32(1) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 2*24))).Fp1 = memId - int32(1) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 2*24))).Fp3 = iRec + (*(*TVdbeOp)(unsafe.Pointer(aOp + 3*24))).Fp2 = iRec + (*(*TVdbeOp)(unsafe.Pointer(aOp + 3*24))).Fp3 = memId + int32(1) + (*(*TVdbeOp)(unsafe.Pointer(aOp + 3*24))).Fp5 = uint16(OPFLAG_APPEND) + _sqlite3ReleaseTempReg(tls, pParse, iRec) + goto _1 + _1: + ; + p = (*TAutoincInfo)(unsafe.Pointer(p)).FpNext + } +} + +var _iLn2 int32 + +var _autoIncEnd = [5]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_NotNull), + Fp2: int8(2), + }, + 1: { + Fopcode: uint8(OP_NewRowid), + }, + 2: { + Fopcode: uint8(OP_MakeRecord), + Fp2: int8(2), + }, + 3: { + Fopcode: uint8(OP_Insert), + }, + 4: { + Fopcode: uint8(OP_Close), + }, +} + +func _sqlite3AutoincrementEnd(tls *libc.TLS, pParse uintptr) { + if (*TParse)(unsafe.Pointer(pParse)).FpAinc != 0 { + _autoIncrementEnd(tls, pParse) + } +} + +// C documentation +// +// /* +// ** This routine is called to handle SQL of the following forms: +// ** +// ** insert into TABLE (IDLIST) values(EXPRLIST),(EXPRLIST),... +// ** insert into TABLE (IDLIST) select +// ** insert into TABLE (IDLIST) default values +// ** +// ** The IDLIST following the table name is always optional. If omitted, +// ** then a list of all (non-hidden) columns for the table is substituted. +// ** The IDLIST appears in the pColumn parameter. pColumn is NULL if IDLIST +// ** is omitted. +// ** +// ** For the pSelect parameter holds the values to be inserted for the +// ** first two forms shown above. A VALUES clause is really just short-hand +// ** for a SELECT statement that omits the FROM clause and everything else +// ** that follows. If the pSelect parameter is NULL, that means that the +// ** DEFAULT VALUES form of the INSERT statement is intended. +// ** +// ** The code generated follows one of four templates. For a simple +// ** insert with data coming from a single-row VALUES clause, the code executes +// ** once straight down through. Pseudo-code follows (we call this +// ** the "1st template"): +// ** +// ** open write cursor to
    and its indices +// ** put VALUES clause expressions into registers +// ** write the resulting record into
    +// ** cleanup +// ** +// ** The three remaining templates assume the statement is of the form +// ** +// ** INSERT INTO
    SELECT ... +// ** +// ** If the SELECT clause is of the restricted form "SELECT * FROM " - +// ** in other words if the SELECT pulls all columns from a single table +// ** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and +// ** if and are distinct tables but have identical +// ** schemas, including all the same indices, then a special optimization +// ** is invoked that copies raw records from over to . +// ** See the xferOptimization() function for the implementation of this +// ** template. This is the 2nd template. +// ** +// ** open a write cursor to
    +// ** open read cursor on +// ** transfer all records in over to
    +// ** close cursors +// ** foreach index on
    +// ** open a write cursor on the
    index +// ** open a read cursor on the corresponding index +// ** transfer all records from the read to the write cursors +// ** close cursors +// ** end foreach +// ** +// ** The 3rd template is for when the second template does not apply +// ** and the SELECT clause does not read from
    at any time. +// ** The generated code follows this template: +// ** +// ** X <- A +// ** goto B +// ** A: setup for the SELECT +// ** loop over the rows in the SELECT +// ** load values into registers R..R+n +// ** yield X +// ** end loop +// ** cleanup after the SELECT +// ** end-coroutine X +// ** B: open write cursor to
    and its indices +// ** C: yield X, at EOF goto D +// ** insert the select result into
    from R..R+n +// ** goto C +// ** D: cleanup +// ** +// ** The 4th template is used if the insert statement takes its +// ** values from a SELECT but the data is being inserted into a table +// ** that is also read as part of the SELECT. In the third form, +// ** we have to use an intermediate table to store the results of +// ** the select. The template is like this: +// ** +// ** X <- A +// ** goto B +// ** A: setup for the SELECT +// ** loop over the tables in the SELECT +// ** load value into register R..R+n +// ** yield X +// ** end loop +// ** cleanup after the SELECT +// ** end co-routine R +// ** B: open temp table +// ** L: yield X, at EOF goto M +// ** insert row from R..R+n into temp table +// ** goto L +// ** M: open write cursor to
    and its indices +// ** rewind temp table +// ** C: loop over rows of intermediate table +// ** transfer values form intermediate table into
    +// ** end loop +// ** D: cleanup +// */ +func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uintptr, pColumn uintptr, onError int32, pUpsert uintptr) { + bp := tls.Alloc(160) + defer tls.Free(160) + var aRegIdx, db, pIdx, pIpk, pList, pNx, pTab, pTrigger, pVTab, pX, v, v13, v16, v18, v6, v9 uintptr + var addr1, addr11, addrCont, addrInsTop, addrL, addrTop, bUseSeek, endOfLoop, i, iDb, iRegStore, ipkColumn, isView, j, k, nColumn, nHidden, nIdx, rc, regAutoinc, regCols, regData, regFromSelect, regIns, regRec, regRowCount, regRowid, regTempRowid, regYield, srcTab, y, v1, v12, v15, v17, v19, v23, v24, v5, v7, v8 int32 + var appendFlag, bIdListInOrder, useTempTable, withoutRowid Tu8 + var colFlags, v21 Tu32 + var _ /* dest at bp+8 */ TSelectDest + var _ /* iDataCur at bp+0 */ int32 + var _ /* iIdxCur at bp+4 */ int32 + var _ /* isReplace at bp+112 */ int32 + var _ /* sNC at bp+56 */ TNameContext + var _ /* tmask at bp+48 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aRegIdx, addr1, addr11, addrCont, addrInsTop, addrL, addrTop, appendFlag, bIdListInOrder, bUseSeek, colFlags, db, endOfLoop, i, iDb, iRegStore, ipkColumn, isView, j, k, nColumn, nHidden, nIdx, pIdx, pIpk, pList, pNx, pTab, pTrigger, pVTab, pX, rc, regAutoinc, regCols, regData, regFromSelect, regIns, regRec, regRowCount, regRowid, regTempRowid, regYield, srcTab, useTempTable, v, withoutRowid, y, v1, v12, v13, v15, v16, v17, v18, v19, v21, v23, v24, v5, v6, v7, v8, v9 /* Number of columns in the data */ + nHidden = 0 /* Number of hidden columns if TABLE is virtual */ + *(*int32)(unsafe.Pointer(bp)) = 0 /* VDBE cursor that is the main data repository */ + *(*int32)(unsafe.Pointer(bp + 4)) = 0 /* First index cursor */ + ipkColumn = -int32(1) /* Label for the end of the insertion loop */ + srcTab = 0 /* Data comes from this temporary cursor if >=0 */ + addrInsTop = 0 /* Jump to label "D" */ + addrCont = 0 /* Index of database holding TABLE */ + useTempTable = uint8(0) /* Store SELECT results in intermediate table */ + appendFlag = uint8(0) /* True if IDLIST is in table order */ + pList = uintptr(0) /* Register in which to store next column */ + /* Register allocations */ + regFromSelect = 0 /* Base register for data coming from SELECT */ + regAutoinc = 0 /* Register holding the AUTOINCREMENT counter */ + regRowCount = 0 /* register holding first column to insert */ + aRegIdx = uintptr(0) /* Mask of trigger times */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto insert_cleanup + } + (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSDParm = 0 /* Suppress a harmless compiler warning */ + /* If the Select object is really just a simple VALUES() list with a + ** single row (the common case) then keep that one row of values + ** and discard the other (unused) parts of the pSelect object + */ + if pSelect != 0 && (*TSelect)(unsafe.Pointer(pSelect)).FselFlags&uint32(SF_Values) != uint32(0) && (*TSelect)(unsafe.Pointer(pSelect)).FpPrior == uintptr(0) { + pList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + (*TSelect)(unsafe.Pointer(pSelect)).FpEList = uintptr(0) + _sqlite3SelectDelete(tls, db, pSelect) + pSelect = uintptr(0) + } + /* Locate the table into which we will be inserting new information. + */ + pTab = _sqlite3SrcListLookup(tls, pParse, pTabList) + if pTab == uintptr(0) { + goto insert_cleanup + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) != 0 { + goto insert_cleanup + } + withoutRowid = libc.BoolUint8(!((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0))) + /* Figure out if we have any triggers and if the table being + ** inserted into is a view + */ + pTrigger = _sqlite3TriggersExist(tls, pParse, pTab, int32(TK_INSERT), uintptr(0), bp+48) + isView = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW)) + /* If pTab is really a view, make sure it has been initialized. + ** ViewGetColumnNames() is a no-op if pTab is not a view. + */ + if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + goto insert_cleanup + } + /* Cannot insert into a read-only table. + */ + if _sqlite3IsReadOnly(tls, pParse, pTab, pTrigger) != 0 { + goto insert_cleanup + } + /* Allocate a VDBE + */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto insert_cleanup + } + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { + _sqlite3VdbeCountChanges(tls, v) + } + _sqlite3BeginWriteOperation(tls, pParse, libc.BoolInt32(pSelect != 0 || pTrigger != 0), iDb) + /* If the statement is of the form + ** + ** INSERT INTO SELECT * FROM ; + ** + ** Then special optimizations can be applied that make the transfer + ** very fast and which reduce fragmentation of indices. + ** + ** This is the 2nd template. + */ + if pColumn == uintptr(0) && pSelect != uintptr(0) && pTrigger == uintptr(0) && _xferOptimization(tls, pParse, pTab, pSelect, onError, iDb) != 0 { + goto insert_end + } + /* If this is an AUTOINCREMENT table, look up the sequence number in the + ** sqlite_sequence table and store it in memory cell regAutoinc. + */ + regAutoinc = _autoIncBegin(tls, pParse, iDb, pTab) + /* Allocate a block registers to hold the rowid and the values + ** for all columns of the new row. + */ + v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) + regIns = v1 + regRowid = v1 + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + int32(1) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + regRowid++ + (*TParse)(unsafe.Pointer(pParse)).FnMem++ + } + regData = regRowid + int32(1) + /* If the INSERT statement included an IDLIST term, then make sure + ** all elements of the IDLIST really are columns of the table and + ** remember the column indices. + ** + ** If the table has an INTEGER PRIMARY KEY column and that column + ** is named in the IDLIST, then record in the ipkColumn variable + ** the index into IDLIST of the primary key column. ipkColumn is + ** the index of the primary key as it appears in IDLIST, not as + ** is appears in the original table. (The index of the INTEGER + ** PRIMARY KEY in the original table is pTab->iPKey.) After this + ** loop, if ipkColumn==(-1), that means that integer primary key + ** is unspecified, and hence the table is either WITHOUT ROWID or + ** it will automatically generated an integer primary key. + ** + ** bIdListInOrder is true if the columns in IDLIST are in storage + ** order. This enables an optimization that avoids shuffling the + ** columns into storage order. False negatives are harmless, + ** but false positives will cause database corruption. + */ + bIdListInOrder = libc.BoolUint8((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_OOOHidden)|libc.Int32FromInt32(TF_HasStored)) == uint32(0)) + if pColumn != 0 { + (*TIdList)(unsafe.Pointer(pColumn)).FeU4 = uint8(EU4_IDX) + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pColumn)).FnId) { + break + } + *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = -int32(1) + goto _2 + _2: + ; + i++ + } + i = 0 + for { + if !(i < (*TIdList)(unsafe.Pointer(pColumn)).FnId) { + break + } + j = 0 + for { + if !(j < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if _sqlite3StrICmp(tls, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName) == 0 { + *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16 + 8)) = j + if i != j { + bIdListInOrder = uint8(0) + } + if j == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + ipkColumn = i + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&(libc.Int32FromInt32(COLFLAG_STORED)|libc.Int32FromInt32(COLFLAG_VIRTUAL)) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16116, libc.VaList(bp+128, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + goto insert_cleanup + } + break + } + goto _4 + _4: + ; + j++ + } + if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + if _sqlite3IsRowid(tls, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName) != 0 && !(withoutRowid != 0) { + ipkColumn = i + bIdListInOrder = uint8(0) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16157, libc.VaList(bp+128, pTabList+8, (*(*TIdList_item)(unsafe.Pointer(pColumn + 8 + uintptr(i)*16))).FzName)) + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + goto insert_cleanup + } + } + goto _3 + _3: + ; + i++ + } + } + /* Figure out how many columns of data are supplied. If the data + ** is coming from a SELECT statement, then generate a co-routine that + ** produces a single row of the SELECT on each invocation. The + ** co-routine is the common header to the 3rd and 4th templates. + */ + if pSelect != 0 { /* Result code */ + v6 = pParse + 56 + *(*int32)(unsafe.Pointer(v6))++ + v5 = *(*int32)(unsafe.Pointer(v6)) + regYield = v5 + addrTop = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regYield, 0, addrTop) + _sqlite3SelectDestInit(tls, bp+8, int32(SRT_Coroutine), regYield) + if bIdListInOrder != 0 { + v7 = regData + } else { + v7 = 0 + } + (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSdst = v7 + (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FnSdst = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + rc = _sqlite3Select(tls, pParse, pSelect, bp+8) + regFromSelect = (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSdst + if rc != 0 || (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto insert_cleanup + } + _sqlite3VdbeEndCoroutine(tls, v, regYield) + _sqlite3VdbeJumpHere(tls, v, addrTop-int32(1)) /* label B: */ + nColumn = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpEList)).FnExpr + /* Set useTempTable to TRUE if the result of the SELECT statement + ** should be written into a temporary table (template 4). Set to + ** FALSE if each output row of the SELECT can be written directly into + ** the destination table (template 3). + ** + ** A temp table must be used if the table being updated is also one + ** of the tables being read by the SELECT statement. Also use a + ** temp table in the case of row triggers. + */ + if pTrigger != 0 || _readsTable(tls, pParse, iDb, pTab) != 0 { + useTempTable = uint8(1) + } + if useTempTable != 0 { /* Label "L" */ + v9 = pParse + 52 + v8 = *(*int32)(unsafe.Pointer(v9)) + *(*int32)(unsafe.Pointer(v9))++ + srcTab = v8 + regRec = _sqlite3GetTempReg(tls, pParse) + regTempRowid = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), srcTab, nColumn) + addrL = _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSDParm) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regFromSelect, nColumn, regRec) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), srcTab, regTempRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), srcTab, regRec, regTempRowid) + _sqlite3VdbeGoto(tls, v, addrL) + _sqlite3VdbeJumpHere(tls, v, addrL) + _sqlite3ReleaseTempReg(tls, pParse, regRec) + _sqlite3ReleaseTempReg(tls, pParse, regTempRowid) + } + } else { + libc.Xmemset(tls, bp+56, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 56))).FpParse = pParse + srcTab = -int32(1) + if pList != 0 { + nColumn = (*TExprList)(unsafe.Pointer(pList)).FnExpr + if _sqlite3ResolveExprListNames(tls, bp+56, pList) != 0 { + goto insert_cleanup + } + } else { + nColumn = 0 + } + } + /* If there is no IDLIST term but the table has an integer primary + ** key, the set the ipkColumn variable to the integer primary key + ** column index in the original table definition. + */ + if pColumn == uintptr(0) && nColumn > 0 { + ipkColumn = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + if ipkColumn >= 0 && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) { + i = ipkColumn - int32(1) + for { + if !(i >= 0) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + ipkColumn-- + } + goto _10 + _10: + ; + i-- + } + } + /* Make sure the number of columns in the source data matches the number + ** of columns to be inserted into the table. + */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_HasGenerated)|libc.Int32FromInt32(TF_HasHidden)) != uint32(0) { + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_NOINSERT) != 0 { + nHidden++ + } + goto _11 + _11: + ; + i++ + } + } + if nColumn != int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16189, libc.VaList(bp+128, pTabList+8, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-nHidden, nColumn)) + goto insert_cleanup + } + } + if pColumn != uintptr(0) && nColumn != (*TIdList)(unsafe.Pointer(pColumn)).FnId { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16241, libc.VaList(bp+128, nColumn, (*TIdList)(unsafe.Pointer(pColumn)).FnId)) + goto insert_cleanup + } + /* Initialize the count of rows to be inserted + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00001))< + ** end loop + ** D: ... + */ + addrInsTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), srcTab) + addrCont = _sqlite3VdbeCurrentAddr(tls, v) + } else { + if pSelect != 0 { + /* This block codes the top of loop only. The complete loop is the + ** following pseudocode (template 3): + ** + ** C: yield X, at EOF goto D + ** insert the select result into
    from R..R+n + ** goto C + ** D: ... + */ + v19 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*(*TSelectDest)(unsafe.Pointer(bp + 8))).FiSDParm) + addrCont = v19 + addrInsTop = v19 + if ipkColumn >= 0 { + /* tag-20191021-001: If the INTEGER PRIMARY KEY is being generated by the + ** SELECT, go ahead and copy the value into the rowid slot now, so that + ** the value does not get overwritten by a NULL at tag-20191021-002. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), regFromSelect+ipkColumn, regRowid) + } + } + } + /* Compute data for ordinary columns of the new entry. Values + ** are written in storage order into registers starting with regData. + ** Only ordinary columns are computed in this loop. The rowid + ** (if there is one) is computed later and generated columns are + ** computed after the rowid since they might depend on the value + ** of the rowid. + */ + nHidden = 0 + iRegStore = regData + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if i == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + /* tag-20191021-002: References to the INTEGER PRIMARY KEY are filled + ** using the rowid. So put a NULL in the IPK slot of the record to avoid + ** using excess space. The file format definition requires this extra + ** NULL - we cannot optimize further by skipping the column completely */ + _sqlite3VdbeAddOp1(tls, v, int32(OP_SoftNull), iRegStore) + goto _20 + } + v21 = uint32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags) + colFlags = v21 + if v21&uint32(COLFLAG_NOINSERT) != uint32(0) { + nHidden++ + if colFlags&uint32(COLFLAG_VIRTUAL) != uint32(0) { + /* Virtual columns do not participate in OP_MakeRecord. So back up + ** iRegStore by one slot to compensate for the iRegStore++ in the + ** outer for() loop */ + iRegStore-- + goto _20 + } else { + if colFlags&uint32(COLFLAG_STORED) != uint32(0) { + /* Stored columns are computed later. But if there are BEFORE + ** triggers, the slots used for stored columns will be OP_Copy-ed + ** to a second block of registers, so the register needs to be + ** initialized to NULL to avoid an uninitialized register read */ + if *(*int32)(unsafe.Pointer(bp + 48))&int32(TRIGGER_BEFORE) != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_SoftNull), iRegStore) + } + goto _20 + } else { + if pColumn == uintptr(0) { + /* Hidden columns that are not explicitly named in the INSERT + ** get there default value */ + _sqlite3ExprCodeFactorable(tls, pParse, _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*16), iRegStore) + goto _20 + } + } + } + } + if pColumn != 0 { + j = 0 + for { + if !(j < (*TIdList)(unsafe.Pointer(pColumn)).FnId && *(*int32)(unsafe.Pointer(pColumn + 8 + uintptr(j)*16 + 8)) != i) { + break + } + goto _22 + _22: + ; + j++ + } + if j >= (*TIdList)(unsafe.Pointer(pColumn)).FnId { + /* A column not named in the insert column list gets its + ** default value */ + _sqlite3ExprCodeFactorable(tls, pParse, _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*16), iRegStore) + goto _20 + } + k = j + } else { + if nColumn == 0 { + /* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */ + _sqlite3ExprCodeFactorable(tls, pParse, _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*16), iRegStore) + goto _20 + } else { + k = i - nHidden + } + } + if useTempTable != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, k, iRegStore) + } else { + if pSelect != 0 { + if regFromSelect != regData { + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regFromSelect+k, iRegStore) + } + } else { + pX = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(k)*32))).FpExpr + y = _sqlite3ExprCodeTarget(tls, pParse, pX, iRegStore) + if y != iRegStore { + if (*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(libc.Int32FromInt32(EP_Subquery)) != uint32(0) { + v23 = int32(OP_Copy) + } else { + v23 = int32(OP_SCopy) + } + _sqlite3VdbeAddOp2(tls, v, v23, y, iRegStore) + } + } + } + goto _20 + _20: + ; + i++ + iRegStore++ + } + /* Run the BEFORE and INSTEAD OF triggers, if there are any + */ + endOfLoop = _sqlite3VdbeMakeLabel(tls, pParse) + if *(*int32)(unsafe.Pointer(bp + 48))&int32(TRIGGER_BEFORE) != 0 { + regCols = _sqlite3GetTempRange(tls, pParse, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+int32(1)) + /* build the NEW.* reference row. Note that if there is an INTEGER + ** PRIMARY KEY into which a NULL is being inserted, that NULL will be + ** translated into a unique ID for the row. But on a BEFORE trigger, + ** we do not know what the unique ID will be (because the insert has + ** not happened yet) so we substitute a rowid of -1 + */ + if ipkColumn < 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), -int32(1), regCols) + } else { + if useTempTable != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, ipkColumn, regCols) + } else { + /* Otherwise useTempTable is true */ + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ipkColumn)*32))).FpExpr, regCols) + } + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), regCols) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), -int32(1), regCols) + _sqlite3VdbeJumpHere(tls, v, addr1) + _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), regCols) + } + /* Copy the new data already generated. */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regRowid+int32(1), regCols+int32(1), int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol)-int32(1)) + /* Compute the new value for generated columns after all other + ** columns have already been computed. This must be done after + ** computing the ROWID in case one of the generated columns + ** refers to the ROWID. */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != 0 { + _sqlite3ComputeGeneratedColumns(tls, pParse, regCols+int32(1), pTab) + } + /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger, + ** do not attempt any conversions before assembling the record. + ** If this is a real table, attempt conversions as required by the + ** table column affinities. + */ + if !(isView != 0) { + _sqlite3TableAffinity(tls, v, pTab, regCols+int32(1)) + } + /* Fire BEFORE or INSTEAD OF triggers */ + _sqlite3CodeRowTrigger(tls, pParse, pTrigger, int32(TK_INSERT), uintptr(0), int32(TRIGGER_BEFORE), pTab, regCols-int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1), onError, endOfLoop) + _sqlite3ReleaseTempRange(tls, pParse, regCols, int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+int32(1)) + } + if !(isView != 0) { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + /* The row that the VUpdate opcode will delete: none */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIns) + } + if ipkColumn >= 0 { + /* Compute the new rowid */ + if useTempTable != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, ipkColumn, regRowid) + } else { + if pSelect != 0 { + /* Rowid already initialized at tag-20191021-001 */ + } else { + pIpk = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ipkColumn)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pIpk)).Fop) == int32(TK_NULL) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_NewRowid), *(*int32)(unsafe.Pointer(bp)), regRowid, regAutoinc) + appendFlag = uint8(1) + } else { + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ipkColumn)*32))).FpExpr, regRowid) + } + } + } + /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid + ** to generate a unique primary key value. + */ + if !(appendFlag != 0) { + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + addr11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_NewRowid), *(*int32)(unsafe.Pointer(bp)), regRowid, regAutoinc) + _sqlite3VdbeJumpHere(tls, v, addr11) + } else { + addr11 = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRowid, addr11+int32(2)) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), regRowid) + } + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) || withoutRowid != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regRowid) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_NewRowid), *(*int32)(unsafe.Pointer(bp)), regRowid, regAutoinc) + appendFlag = uint8(1) + } + } + _autoIncStep(tls, pParse, regAutoinc, regRowid) + /* Compute the new value for generated columns after all other + ** columns have already been computed. This must be done after + ** computing the ROWID in case one of the generated columns + ** is derived from the INTEGER PRIMARY KEY. */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != 0 { + _sqlite3ComputeGeneratedColumns(tls, pParse, regRowid+int32(1), pTab) + } + /* Generate code to check constraints and generate index keys and + ** do the insertion. + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + pVTab = _sqlite3GetVTable(tls, db, pTab) + _sqlite3VtabMakeWritable(tls, pParse, pTab) + _sqlite3VdbeAddOp4(tls, v, int32(OP_VUpdate), int32(1), int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+int32(2), regIns, pVTab, -int32(11)) + if onError == int32(OE_Default) { + v24 = int32(OE_Abort) + } else { + v24 = onError + } + _sqlite3VdbeChangeP5(tls, v, uint16(v24)) + _sqlite3MayAbort(tls, pParse) + } else { + *(*int32)(unsafe.Pointer(bp + 112)) = 0 /* True to use OPFLAG_SEEKRESULT */ + _sqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), regIns, 0, libc.BoolUint8(ipkColumn >= 0), uint8(onError), endOfLoop, bp+112, uintptr(0), pUpsert) + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 { + _sqlite3FkCheck(tls, pParse, pTab, 0, regIns, uintptr(0), 0) + } + /* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE + ** constraints or (b) there are no triggers and this table is not a + ** parent table in a foreign key constraint. It is safe to set the + ** flag in the second case as if any REPLACE constraint is hit, an + ** OP_Delete or OP_IdxDelete instruction will be executed on each + ** cursor that is disturbed. And these instructions both clear the + ** VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT + ** functionality. */ + bUseSeek = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 112)) == 0 || !(_sqlite3VdbeHasSubProgram(tls, v) != 0)) + _sqlite3CompleteInsertion(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), regIns, aRegIdx, 0, int32(appendFlag), bUseSeek) + } + } + /* Update the count of rows that are inserted + */ + if regRowCount != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), regRowCount, int32(1)) + } + if pTrigger != 0 { + /* Code AFTER triggers */ + _sqlite3CodeRowTrigger(tls, pParse, pTrigger, int32(TK_INSERT), uintptr(0), int32(TRIGGER_AFTER), pTab, regData-int32(2)-int32((*TTable)(unsafe.Pointer(pTab)).FnCol), onError, endOfLoop) + } + /* The bottom of the main insertion loop, if the data source + ** is a SELECT statement. + */ + _sqlite3VdbeResolveLabel(tls, v, endOfLoop) + if useTempTable != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), srcTab, addrCont) + _sqlite3VdbeJumpHere(tls, v, addrInsTop) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), srcTab) + } else { + if pSelect != 0 { + _sqlite3VdbeGoto(tls, v, addrCont) + _sqlite3VdbeJumpHere(tls, v, addrInsTop) + } + } +insert_end: + ; + /* Update the sqlite_sequence table by storing the content of the + ** maximum rowid counter values recorded while inserting into + ** autoincrement tables. + */ + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0) { + _sqlite3AutoincrementEnd(tls, pParse) + } + /* + ** Return the number of rows inserted. If this routine is + ** generating code because of a call to sqlite3NestedParse(), do not + ** invoke the callback function. + */ + if regRowCount != 0 { + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+16333) + } +insert_cleanup: + ; + _sqlite3SrcListDelete(tls, db, pTabList) + _sqlite3ExprListDelete(tls, db, pList) + _sqlite3UpsertDelete(tls, db, pUpsert) + _sqlite3SelectDelete(tls, db, pSelect) + _sqlite3IdListDelete(tls, db, pColumn) + if aRegIdx != 0 { + _sqlite3DbNNFreeNN(tls, db, aRegIdx) + } +} + +/* Make sure "isView" and other macros defined above are undefined. Otherwise +** they may interfere with compilation of other functions in this file +** (or in another file, if this file becomes part of the amalgamation). */ + +/* +** Meanings of bits in of pWalker->eCode for +** sqlite3ExprReferencesUpdatedColumn() + */ + +// C documentation +// +// /* This is the Walker callback from sqlite3ExprReferencesUpdatedColumn(). +// * Set bit 0x01 of pWalker->eCode if pWalker->eCode to 0 and if this +// ** expression node references any of the +// ** columns that are being modified by an UPDATE statement. +// */ +func _checkConstraintExprNode(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var p1, p2 uintptr + _, _ = p1, p2 + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 { + if *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40)) + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiColumn)*4)) >= 0 { + p1 = pWalker + 36 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(CKCNSTRNT_COLUMN)) + } + } else { + p2 = pWalker + 36 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(CKCNSTRNT_ROWID)) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** pExpr is a CHECK constraint on a row that is being UPDATE-ed. The +// ** only columns that are modified by the UPDATE are those for which +// ** aiChng[i]>=0, and also the ROWID is modified if chngRowid is true. +// ** +// ** Return true if CHECK constraint pExpr uses any of the +// ** changing columns (or the rowid if it is changing). In other words, +// ** return true if this CHECK constraint must be validated for +// ** the new row in the UPDATE statement. +// ** +// ** 2018-09-15: pExpr might also be an expression for an index-on-expressions. +// ** The operation of this routine is the same - return true if an only if +// ** the expression uses one or more of columns identified by the second and +// ** third arguments. +// */ +func _sqlite3ExprReferencesUpdatedColumn(tls *libc.TLS, pExpr uintptr, aiChng uintptr, chngRowid int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var p1 uintptr + var _ /* w at bp+0 */ TWalker + _ = p1 + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(0) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_checkConstraintExprNode) + *(*uintptr)(unsafe.Pointer(bp + 40)) = aiChng + _sqlite3WalkExpr(tls, bp, pExpr) + if !(chngRowid != 0) { + p1 = bp + 36 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) & ^libc.Int32FromInt32(CKCNSTRNT_ROWID)) + } + return libc.BoolInt32(int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode) != 0) +} + +// C documentation +// +// /* +// ** The sqlite3GenerateConstraintChecks() routine usually wants to visit +// ** the indexes of a table in the order provided in the Table->pIndex list. +// ** However, sometimes (rarely - when there is an upsert) it wants to visit +// ** the indexes in a different order. The following data structures accomplish +// ** this. +// ** +// ** The IndexIterator object is used to walk through all of the indexes +// ** of a table in either Index.pNext order, or in some other order established +// ** by an array of IndexListTerm objects. +// */ +type TIndexListTerm = struct { + Fp uintptr + Fix int32 +} + +type IndexListTerm = TIndexListTerm + +type TIndexIterator = struct { + FeType int32 + Fi int32 + Fu struct { + Fax [0]struct { + FnIdx int32 + FaIdx uintptr + } + Flx struct { + FpIdx uintptr + } + F__ccgo_pad2 [8]byte + } +} + +type IndexIterator = TIndexIterator + +type TIndexIterator1 = struct { + FeType int32 + Fi int32 + Fu struct { + Fax [0]struct { + FnIdx int32 + FaIdx uintptr + } + Flx struct { + FpIdx uintptr + } + F__ccgo_pad2 [8]byte + } +} + +type IndexIterator1 = TIndexIterator1 + +/* When IndexIterator.eType==1, then each index is an array of instances +** of the following object + */ +type TIndexListTerm1 = struct { + Fp uintptr + Fix int32 +} + +type IndexListTerm1 = TIndexListTerm1 + +// C documentation +// +// /* Return the first index on the list */ +func _indexIteratorFirst(tls *libc.TLS, pIter uintptr, pIx uintptr) (r uintptr) { + if (*TIndexIterator)(unsafe.Pointer(pIter)).FeType != 0 { + *(*int32)(unsafe.Pointer(pIx)) = (*(*TIndexListTerm)(unsafe.Pointer((*(*struct { + FnIdx int32 + FaIdx uintptr + })(unsafe.Pointer(pIter + 8))).FaIdx))).Fix + return (*(*TIndexListTerm)(unsafe.Pointer((*(*struct { + FnIdx int32 + FaIdx uintptr + })(unsafe.Pointer(pIter + 8))).FaIdx))).Fp + } else { + *(*int32)(unsafe.Pointer(pIx)) = 0 + return (*TIndexIterator)(unsafe.Pointer(pIter)).Fu.Flx.FpIdx + } + return r +} + +// C documentation +// +// /* Return the next index from the list. Return NULL when out of indexes */ +func _indexIteratorNext(tls *libc.TLS, pIter uintptr, pIx uintptr) (r uintptr) { + var i, v1 int32 + var v2 uintptr + _, _, _ = i, v1, v2 + if (*TIndexIterator)(unsafe.Pointer(pIter)).FeType != 0 { + v2 = pIter + 4 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + i = v1 + if i >= (*(*struct { + FnIdx int32 + FaIdx uintptr + })(unsafe.Pointer(pIter + 8))).FnIdx { + *(*int32)(unsafe.Pointer(pIx)) = i + return uintptr(0) + } + *(*int32)(unsafe.Pointer(pIx)) = (*(*TIndexListTerm)(unsafe.Pointer((*(*struct { + FnIdx int32 + FaIdx uintptr + })(unsafe.Pointer(pIter + 8))).FaIdx + uintptr(i)*16))).Fix + return (*(*TIndexListTerm)(unsafe.Pointer((*(*struct { + FnIdx int32 + FaIdx uintptr + })(unsafe.Pointer(pIter + 8))).FaIdx + uintptr(i)*16))).Fp + } else { + *(*int32)(unsafe.Pointer(pIx))++ + (*TIndexIterator)(unsafe.Pointer(pIter)).Fu.Flx.FpIdx = (*TIndex)(unsafe.Pointer((*TIndexIterator)(unsafe.Pointer(pIter)).Fu.Flx.FpIdx)).FpNext + return (*TIndexIterator)(unsafe.Pointer(pIter)).Fu.Flx.FpIdx + } + return r +} + +// C documentation +// +// /* +// ** Generate code to do constraint checks prior to an INSERT or an UPDATE +// ** on table pTab. +// ** +// ** The regNewData parameter is the first register in a range that contains +// ** the data to be inserted or the data after the update. There will be +// ** pTab->nCol+1 registers in this range. The first register (the one +// ** that regNewData points to) will contain the new rowid, or NULL in the +// ** case of a WITHOUT ROWID table. The second register in the range will +// ** contain the content of the first table column. The third register will +// ** contain the content of the second table column. And so forth. +// ** +// ** The regOldData parameter is similar to regNewData except that it contains +// ** the data prior to an UPDATE rather than afterwards. regOldData is zero +// ** for an INSERT. This routine can distinguish between UPDATE and INSERT by +// ** checking regOldData for zero. +// ** +// ** For an UPDATE, the pkChng boolean is true if the true primary key (the +// ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table) +// ** might be modified by the UPDATE. If pkChng is false, then the key of +// ** the iDataCur content table is guaranteed to be unchanged by the UPDATE. +// ** +// ** For an INSERT, the pkChng boolean indicates whether or not the rowid +// ** was explicitly specified as part of the INSERT statement. If pkChng +// ** is zero, it means that the either rowid is computed automatically or +// ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT, +// ** pkChng will only be true if the INSERT statement provides an integer +// ** value for either the rowid column or its INTEGER PRIMARY KEY alias. +// ** +// ** The code generated by this routine will store new index entries into +// ** registers identified by aRegIdx[]. No index entry is created for +// ** indices where aRegIdx[i]==0. The order of indices in aRegIdx[] is +// ** the same as the order of indices on the linked list of indices +// ** at pTab->pIndex. +// ** +// ** (2019-05-07) The generated code also creates a new record for the +// ** main table, if pTab is a rowid table, and stores that record in the +// ** register identified by aRegIdx[nIdx] - in other words in the first +// ** entry of aRegIdx[] past the last index. It is important that the +// ** record be generated during constraint checks to avoid affinity changes +// ** to the register content that occur after constraint checks but before +// ** the new record is inserted. +// ** +// ** The caller must have already opened writeable cursors on the main +// ** table and all applicable indices (that is to say, all indices for which +// ** aRegIdx[] is not zero). iDataCur is the cursor for the main table when +// ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY +// ** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor +// ** for the first index in the pTab->pIndex list. Cursors for other indices +// ** are at iIdxCur+N for the N-th element of the pTab->pIndex list. +// ** +// ** This routine also generates code to check constraints. NOT NULL, +// ** CHECK, and UNIQUE constraints are all checked. If a constraint fails, +// ** then the appropriate action is performed. There are five possible +// ** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE. +// ** +// ** Constraint type Action What Happens +// ** --------------- ---------- ---------------------------------------- +// ** any ROLLBACK The current transaction is rolled back and +// ** sqlite3_step() returns immediately with a +// ** return code of SQLITE_CONSTRAINT. +// ** +// ** any ABORT Back out changes from the current command +// ** only (do not do a complete rollback) then +// ** cause sqlite3_step() to return immediately +// ** with SQLITE_CONSTRAINT. +// ** +// ** any FAIL Sqlite3_step() returns immediately with a +// ** return code of SQLITE_CONSTRAINT. The +// ** transaction is not rolled back and any +// ** changes to prior rows are retained. +// ** +// ** any IGNORE The attempt in insert or update the current +// ** row is skipped, without throwing an error. +// ** Processing continues with the next row. +// ** (There is an immediate jump to ignoreDest.) +// ** +// ** NOT NULL REPLACE The NULL value is replace by the default +// ** value for that column. If the default value +// ** is NULL, the action is the same as ABORT. +// ** +// ** UNIQUE REPLACE The other row that conflicts with the row +// ** being inserted is removed. +// ** +// ** CHECK REPLACE Illegal. The results in an exception. +// ** +// ** Which action to take is determined by the overrideError parameter. +// ** Or if overrideError==OE_Default, then the pParse->onError parameter +// ** is used. Or if pParse->onError==OE_Default then the onError value +// ** for the constraint is used. +// */ +func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintptr, aRegIdx uintptr, iDataCur int32, iIdxCur int32, regNewData int32, regOldData int32, pkChng Tu8, overrideError Tu8, ignoreDest int32, pbMayReplace uintptr, aiChng uintptr, pUpsert uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var addr1, addrBypass, addrConflictCk, addrJump, addrRecheck, addrRowidOk, addrUniqueOk, allOk, b2ndPass, i, iField, iReg, iThisCur, ipkBottom, ipkTop, isGenerated, jj, lblRecheckOk, nCol, nConflictCk, nGenerated, nIdx, nPkField, nReplaceTrig, nSeenReplace, onError, op, p2, regCmp, regIdx, regR, regRec, regTrigCnt, seenReplace, upsertIpkDelay, upsertIpkReturn, x, x1, v11, v13, v15, v2, v7 int32 + var bAffinityDone, isUpdate Tu8 + var bUsed, db, p4, pCheck, pCol, pCopy, pExpr, pIdx, pPk, pTerm, pTrigger, pUpsertClause, v, zMsg, zName, zP4, v16, v8 uintptr + var nByte Tu64 + var _ /* ix at bp+0 */ int32 + var _ /* sIdxIter at bp+8 */ TIndexIterator + var _ /* x at bp+32 */ TVdbeOp + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr1, addrBypass, addrConflictCk, addrJump, addrRecheck, addrRowidOk, addrUniqueOk, allOk, b2ndPass, bAffinityDone, bUsed, db, i, iField, iReg, iThisCur, ipkBottom, ipkTop, isGenerated, isUpdate, jj, lblRecheckOk, nByte, nCol, nConflictCk, nGenerated, nIdx, nPkField, nReplaceTrig, nSeenReplace, onError, op, p2, p4, pCheck, pCol, pCopy, pExpr, pIdx, pPk, pTerm, pTrigger, pUpsertClause, regCmp, regIdx, regR, regRec, regTrigCnt, seenReplace, upsertIpkDelay, upsertIpkReturn, v, x, x1, zMsg, zName, zP4, v11, v13, v15, v16, v2, v7, v8 /* Pointer to one of the indices */ + pPk = uintptr(0) /* Conflict resolution strategy */ + seenReplace = 0 /* Number of fields in PRIMARY KEY. 1 for ROWID tables */ + pUpsertClause = uintptr(0) /* True if this is an UPDATE operation */ + bAffinityDone = uint8(0) /* True if the OP_Affinity operation has been run */ + upsertIpkReturn = 0 /* Address of Goto at end of IPK uniqueness check */ + upsertIpkDelay = 0 /* Address of Goto to bypass initial IPK check */ + ipkTop = 0 /* Top of the IPK uniqueness check */ + ipkBottom = 0 /* Register used to count replace trigger invocations */ + addrRecheck = 0 /* Jump here to recheck all uniqueness constraints */ + lblRecheckOk = 0 /* List of DELETE triggers on the table pTab */ + nReplaceTrig = 0 /* Index iterator */ + isUpdate = libc.BoolUint8(regOldData != 0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* This table is not a VIEW */ + nCol = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for + ** normal rowid tables. nPkField is the number of key fields in the + ** pPk index or 1 for a rowid table. In other words, nPkField is the + ** number of fields in the true primary key of the table. */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + pPk = uintptr(0) + nPkField = int32(1) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + nPkField = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + } + /* Record that this module has started */ + /* Test all NOT NULL constraints. + */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasNotNull) != 0 { + b2ndPass = 0 /* True if currently running 2nd pass */ + nSeenReplace = 0 /* Number of ON CONFLICT REPLACE operations */ + nGenerated = 0 /* Number of generated columns with NOT NULL */ + for int32(1) != 0 { /* Make 2 passes over columns. Exit loop via "break" */ + i = 0 + for { + if !(i < nCol) { + break + } /* Register holding column value */ + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 /* non-zero if column is generated */ + onError = int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8)) & 0xf >> 0)) + if onError == OE_None { + goto _1 + } /* No NOT NULL on this column */ + if i == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + goto _1 /* ROWID is never NULL */ + } + isGenerated = int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags) & int32(COLFLAG_GENERATED) + if isGenerated != 0 && !(b2ndPass != 0) { + nGenerated++ + goto _1 /* Generated columns processed on 2nd pass */ + } + if aiChng != 0 && *(*int32)(unsafe.Pointer(aiChng + uintptr(i)*4)) < 0 && !(isGenerated != 0) { + /* Do not check NOT NULL on columns that do not change */ + goto _1 + } + if int32(overrideError) != int32(OE_Default) { + onError = int32(overrideError) + } else { + if onError == int32(OE_Default) { + onError = int32(OE_Abort) + } + } + if onError == int32(OE_Replace) { + if b2ndPass != 0 || int32((*TColumn)(unsafe.Pointer(pCol)).FiDflt) == 0 { + onError = int32(OE_Abort) + } else { + } + } else { + if b2ndPass != 0 && !(isGenerated != 0) { + goto _1 + } + } + iReg = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(i))) + regNewData + int32(1) + switch onError { + case int32(OE_Replace): + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), iReg) + nSeenReplace++ + _sqlite3ExprCodeCopy(tls, pParse, _sqlite3ColumnExpr(tls, pTab, pCol), iReg) + _sqlite3VdbeJumpHere(tls, v, addr1) + case int32(OE_Abort): + _sqlite3MayAbort(tls, pParse) + fallthrough + case int32(OE_Rollback): + fallthrough + case int32(OE_Fail): + zMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+12413, libc.VaList(bp+64, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_HaltIfNull), libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(5)< 0 && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) { + /* If any NOT NULL ON CONFLICT REPLACE constraints fired on the + ** first pass, recomputed values for all generated columns, as + ** those values might depend on columns affected by the REPLACE. + */ + _sqlite3ComputeGeneratedColumns(tls, pParse, regNewData+int32(1), pTab) + } + } /* end of 2-pass loop */ + } /* end if( has-not-null-constraints ) */ + /* Test all CHECK constraints + */ + if (*TTable)(unsafe.Pointer(pTab)).FpCheck != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_IgnoreChecks) == uint64(0) { + pCheck = (*TTable)(unsafe.Pointer(pTab)).FpCheck + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = -(regNewData + int32(1)) + if int32(overrideError) != int32(OE_Default) { + v2 = int32(overrideError) + } else { + v2 = int32(OE_Abort) + } + onError = v2 + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pCheck)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(i)*32))).FpExpr + if aiChng != 0 && !(_sqlite3ExprReferencesUpdatedColumn(tls, pExpr, aiChng, int32(pkChng)) != 0) { + /* The check constraints do not reference any of the columns being + ** updated so there is no point it verifying the check constraint */ + goto _3 + } + if int32(bAffinityDone) == 0 { + _sqlite3TableAffinity(tls, v, pTab, regNewData+int32(1)) + bAffinityDone = uint8(1) + } + allOk = _sqlite3VdbeMakeLabel(tls, pParse) + pCopy = _sqlite3ExprDup(tls, db, pExpr, 0) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + _sqlite3ExprIfTrue(tls, pParse, pCopy, allOk, int32(SQLITE_JUMPIFNULL)) + } + _sqlite3ExprDelete(tls, db, pCopy) + if onError == int32(OE_Ignore) { + _sqlite3VdbeGoto(tls, v, ignoreDest) + } else { + zName = (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(i)*32))).FzEName + if onError == int32(OE_Replace) { + onError = int32(OE_Abort) + } /* IMP: R-26383-51744 */ + _sqlite3HaltConstraint(tls, pParse, libc.Int32FromInt32(SQLITE_CONSTRAINT)|libc.Int32FromInt32(1)<>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + v13 = regIdx + } else { + v13 = regR + } + regCmp = v13 + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + p4 = _sqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8))) + x1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))) + if i == int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)-int32(1) { + addrJump = addrUniqueOk + op = int32(OP_Eq) + } + x1 = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(x1))) + _sqlite3VdbeAddOp4(tls, v, op, regOldData+int32(1)+x1, addrJump, regCmp+i, p4, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + goto _14 + _14: + ; + i++ + } + } + } + } + /* Generate code that executes if the new index entry is not unique */ + switch onError { + case int32(OE_Rollback): + fallthrough + case int32(OE_Abort): + fallthrough + case int32(OE_Fail): + _sqlite3UniqueConstraint(tls, pParse, onError, pIdx) + case int32(OE_Update): + _sqlite3UpsertDoUpdate(tls, pParse, pUpsert, pTab, pIdx, iIdxCur+*(*int32)(unsafe.Pointer(bp))) + fallthrough + case int32(OE_Ignore): + _sqlite3VdbeGoto(tls, v, ignoreDest) + default: /* Number of opcodes in conflict check logic */ + nConflictCk = _sqlite3VdbeCurrentAddr(tls, v) - addrConflictCk + if regTrigCnt != 0 { + _sqlite3MultiWrite(tls, pParse) + nReplaceTrig++ + } + if pTrigger != 0 && isUpdate != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_CursorLock), iDataCur) + } + if pIdx == pPk { + v15 = int32(ONEPASS_SINGLE) + } else { + v15 = ONEPASS_OFF + } + _sqlite3GenerateRowDelete(tls, pParse, pTab, pTrigger, iDataCur, iIdxCur, regR, int16(nPkField), uint8(0), uint8(OE_Replace), uint8(v15), iThisCur) + if pTrigger != 0 && isUpdate != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_CursorUnlock), iDataCur) + } + if regTrigCnt != 0 { /* Jump destination to bypass recheck logic */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), regTrigCnt, int32(1)) /* incr trigger cnt */ + addrBypass = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) /* Bypass recheck */ + /* Here we insert code that will be invoked after all constraint + ** checks have run, if and only if one or more replace triggers + ** fired. */ + _sqlite3VdbeResolveLabel(tls, v, lblRecheckOk) + lblRecheckOk = _sqlite3VdbeMakeLabel(tls, pParse) + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + /* Bypass the recheck if this partial index is not defined + ** for the current row */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regIdx-int32(1), lblRecheckOk) + } + /* Copy the constraint check code from above, except change + ** the constraint-ok jump destination to be the address of + ** the next retest block */ + for nConflictCk > 0 { /* Conflict check opcode to copy */ + /* The sqlite3VdbeAddOp4() call might reallocate the opcode array. + ** Hence, make a complete copy of the opcode, rather than using + ** a pointer to the opcode. */ + *(*TVdbeOp)(unsafe.Pointer(bp + 32)) = *(*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, v, addrConflictCk))) + if int32((*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fopcode) != int32(OP_IdxRowid) { + if int32(_sqlite3OpcodeProperty[(*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fopcode])&int32(OPFLG_JUMP) != 0 { + p2 = lblRecheckOk + } else { + p2 = (*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp2 + } + if int32((*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp4type) == -int32(3) { + v16 = uintptr(int64(*(*int32)(unsafe.Pointer(bp + 32 + 16)))) + } else { + v16 = *(*uintptr)(unsafe.Pointer(bp + 32 + 16)) + } + zP4 = v16 + _sqlite3VdbeAddOp4(tls, v, int32((*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fopcode), (*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp1, p2, (*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp3, zP4, int32((*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp4type)) + _sqlite3VdbeChangeP5(tls, v, (*(*TVdbeOp)(unsafe.Pointer(bp + 32))).Fp5) + } + nConflictCk-- + addrConflictCk++ + } + /* If the retest fails, issue an abort */ + _sqlite3UniqueConstraint(tls, pParse, int32(OE_Abort), pIdx) + _sqlite3VdbeJumpHere(tls, v, addrBypass) /* Terminate the recheck bypass */ + } + seenReplace = int32(1) + break + } + _sqlite3VdbeResolveLabel(tls, v, addrUniqueOk) + if regR != regIdx { + _sqlite3ReleaseTempRange(tls, pParse, regR, nPkField) + } + if pUpsertClause != 0 && upsertIpkReturn != 0 && _sqlite3UpsertNextIsIPK(tls, pUpsertClause) != 0 { + _sqlite3VdbeGoto(tls, v, upsertIpkDelay+int32(1)) + _sqlite3VdbeJumpHere(tls, v, upsertIpkReturn) + upsertIpkReturn = 0 + } + goto _9 + _9: + ; + pIdx = _indexIteratorNext(tls, bp+8, bp) + } + /* If the IPK constraint is a REPLACE, run it last */ + if ipkTop != 0 { + _sqlite3VdbeGoto(tls, v, ipkTop) + _sqlite3VdbeJumpHere(tls, v, ipkBottom) + } + /* Recheck all uniqueness constraints after replace triggers have run */ + if nReplaceTrig != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNot), regTrigCnt, lblRecheckOk) + if !(pPk != 0) { + if isUpdate != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), regNewData, addrRecheck, regOldData) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_NotExists), iDataCur, addrRecheck, regNewData) + _sqlite3RowidConstraint(tls, pParse, int32(OE_Abort), pTab) + } else { + _sqlite3VdbeGoto(tls, v, addrRecheck) + } + _sqlite3VdbeResolveLabel(tls, v, lblRecheckOk) + } + /* Generate the table record */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + regRec = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp)))*4)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNewData+int32(1), int32((*TTable)(unsafe.Pointer(pTab)).FnNVCol), regRec) + if !(bAffinityDone != 0) { + _sqlite3TableAffinity(tls, v, pTab, 0) + } + } + *(*int32)(unsafe.Pointer(pbMayReplace)) = seenReplace +} + +// C documentation +// +// /* +// ** Table pTab is a WITHOUT ROWID table that is being written to. The cursor +// ** number is iCur, and register regData contains the new record for the +// ** PK index. This function adds code to invoke the pre-update hook, +// ** if one is registered. +// */ +func _codeWithoutRowidPreupdate(tls *libc.TLS, pParse uintptr, pTab uintptr, iCur int32, regData int32) { + var r int32 + var v uintptr + _, _ = r, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + r = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, r) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Insert), iCur, regData, r, pTab, -int32(5)) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_ISNOOP)) + _sqlite3ReleaseTempReg(tls, pParse, r) +} + +// C documentation +// +// /* +// ** This routine generates code to finish the INSERT or UPDATE operation +// ** that was started by a prior call to sqlite3GenerateConstraintChecks. +// ** A consecutive range of registers starting at regNewData contains the +// ** rowid and the content to be inserted. +// ** +// ** The arguments to this routine should be the same as the first six +// ** arguments to sqlite3GenerateConstraintChecks. +// */ +func _sqlite3CompleteInsertion(tls *libc.TLS, pParse uintptr, pTab uintptr, iDataCur int32, iIdxCur int32, regNewData int32, aRegIdx uintptr, update_flags int32, appendBias int32, useSeekResult int32) { + var i, v2, v3, v4 int32 + var pIdx, v uintptr + var pik_flags Tu8 + _, _, _, _, _, _, _ = i, pIdx, pik_flags, v, v2, v3, v4 /* Loop counter */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* This table is not a VIEW */ + i = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + /* All REPLACE indexes are at the end of the list */ + if *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) == 0 { + goto _1 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + } + if useSeekResult != 0 { + v2 = int32(OPFLAG_USESEEKRESULT) + } else { + v2 = 0 + } + pik_flags = uint8(v2) + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pik_flags = Tu8(int32(pik_flags) | libc.Int32FromInt32(OPFLAG_NCHANGE)) + pik_flags = Tu8(int32(pik_flags) | update_flags&libc.Int32FromInt32(OPFLAG_SAVEPOSITION)) + if update_flags == 0 { + _codeWithoutRowidPreupdate(tls, pParse, pTab, iIdxCur+i, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4))) + } + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + v3 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + v3 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iIdxCur+i, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4))+int32(1), v3) + _sqlite3VdbeChangeP5(tls, v, uint16(pik_flags)) + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + i++ + } + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + return + } + if (*TParse)(unsafe.Pointer(pParse)).Fnested != 0 { + pik_flags = uint8(0) + } else { + pik_flags = uint8(OPFLAG_NCHANGE) + if update_flags != 0 { + v4 = update_flags + } else { + v4 = int32(OPFLAG_LASTROWID) + } + pik_flags = Tu8(int32(pik_flags) | v4) + } + if appendBias != 0 { + pik_flags = Tu8(int32(pik_flags) | libc.Int32FromInt32(OPFLAG_APPEND)) + } + if useSeekResult != 0 { + pik_flags = Tu8(int32(pik_flags) | libc.Int32FromInt32(OPFLAG_USESEEKRESULT)) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iDataCur, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), regNewData) + if !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { + _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) + } + _sqlite3VdbeChangeP5(tls, v, uint16(pik_flags)) +} + +// C documentation +// +// /* +// ** Allocate cursors for the pTab table and all its indices and generate +// ** code to open and initialized those cursors. +// ** +// ** The cursor for the object that contains the complete data (normally +// ** the table itself, but the PRIMARY KEY index in the case of a WITHOUT +// ** ROWID table) is returned in *piDataCur. The first index cursor is +// ** returned in *piIdxCur. The number of indices is returned. +// ** +// ** Use iBase as the first cursor (either the *piDataCur for rowid tables +// ** or the first index for WITHOUT ROWID tables) if it is non-negative. +// ** If iBase is negative, then allocate the next available cursor. +// ** +// ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur. +// ** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range +// ** of *piIdxCurs, depending on where the PRIMARY KEY index appears on the +// ** pTab->pIndex list. +// ** +// ** If pTab is a virtual table, then this routine is a no-op and the +// ** *piDataCur and *piIdxCur values are left uninitialized. +// */ +func _sqlite3OpenTableAndIndices(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, p5 Tu8, iBase int32, aToOpen uintptr, piDataCur uintptr, piIdxCur uintptr) (r int32) { + var i, iDataCur, iDb, iIdxCur, v1, v2, v4 int32 + var pIdx, v uintptr + _, _, _, _, _, _, _, _, _ = i, iDataCur, iDb, iIdxCur, pIdx, v, v1, v2, v4 + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + /* This routine is a no-op for virtual tables. Leave the output + ** variables *piDataCur and *piIdxCur set to illegal cursor numbers + ** for improved error detection. */ + v1 = -libc.Int32FromInt32(999) + *(*int32)(unsafe.Pointer(piIdxCur)) = v1 + *(*int32)(unsafe.Pointer(piDataCur)) = v1 + return 0 + } + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if iBase < 0 { + iBase = (*TParse)(unsafe.Pointer(pParse)).FnTab + } + v2 = iBase + iBase++ + iDataCur = v2 + *(*int32)(unsafe.Pointer(piDataCur)) = iDataCur + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) && (aToOpen == uintptr(0) || *(*Tu8)(unsafe.Pointer(aToOpen)) != 0) { + _sqlite3OpenTable(tls, pParse, iDataCur, iDb, pTab, op) + } else { + if int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnoSharedCache) == 0 { + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, libc.BoolUint8(op == int32(OP_OpenWrite)), (*TTable)(unsafe.Pointer(pTab)).FzName) + } + } + *(*int32)(unsafe.Pointer(piIdxCur)) = iBase + i = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + v4 = iBase + iBase++ + iIdxCur = v4 + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + *(*int32)(unsafe.Pointer(piDataCur)) = iIdxCur + p5 = uint8(0) + } + if aToOpen == uintptr(0) || *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(i+int32(1)))) != 0 { + _sqlite3VdbeAddOp3(tls, v, op, iIdxCur, int32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + _sqlite3VdbeChangeP5(tls, v, uint16(p5)) + } + goto _3 + _3: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + i++ + } + if iBase > (*TParse)(unsafe.Pointer(pParse)).FnTab { + (*TParse)(unsafe.Pointer(pParse)).FnTab = iBase + } + return i +} + +// C documentation +// +// /* +// ** Check to see if index pSrc is compatible as a source of data +// ** for index pDest in an insert transfer optimization. The rules +// ** for a compatible index: +// ** +// ** * The index is over the same set of columns +// ** * The same DESC and ASC markings occurs on all columns +// ** * The same onError processing (OE_Abort, OE_Ignore, etc) +// ** * The same collating sequence on each column +// ** * The index has the exact same WHERE clause +// */ +func _xferCompatibleIndex(tls *libc.TLS, pDest uintptr, pSrc uintptr) (r int32) { + var i int32 + _ = i + if int32((*TIndex)(unsafe.Pointer(pDest)).FnKeyCol) != int32((*TIndex)(unsafe.Pointer(pSrc)).FnKeyCol) || int32((*TIndex)(unsafe.Pointer(pDest)).FnColumn) != int32((*TIndex)(unsafe.Pointer(pSrc)).FnColumn) { + return 0 /* Different number of columns */ + } + if int32((*TIndex)(unsafe.Pointer(pDest)).FonError) != int32((*TIndex)(unsafe.Pointer(pSrc)).FonError) { + return 0 /* Different conflict resolution strategies */ + } + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pSrc)).FnKeyCol)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaiColumn + uintptr(i)*2))) != int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pDest)).FaiColumn + uintptr(i)*2))) { + return 0 /* Different columns indexed */ + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaiColumn + uintptr(i)*2))) == -int32(2) { + if _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pDest)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, -int32(1)) != 0 { + return 0 /* Different expressions in the index */ + } + } + if int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FaSortOrder + uintptr(i)))) != int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pDest)).FaSortOrder + uintptr(i)))) { + return 0 /* Different sort orders */ + } + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrc)).FazColl + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pDest)).FazColl + uintptr(i)*8))) != 0 { + return 0 /* Different collating sequences */ + } + goto _1 + _1: + ; + i++ + } + if _sqlite3ExprCompare(tls, uintptr(0), (*TIndex)(unsafe.Pointer(pSrc)).FpPartIdxWhere, (*TIndex)(unsafe.Pointer(pDest)).FpPartIdxWhere, -int32(1)) != 0 { + return 0 /* Different WHERE clauses */ + } + /* If no test above fails then the indices must be compatible */ + return int32(1) +} + +// C documentation +// +// /* +// ** Attempt the transfer optimization on INSERTs of the form +// ** +// ** INSERT INTO tab1 SELECT * FROM tab2; +// ** +// ** The xfer optimization transfers raw records from tab2 over to tab1. +// ** Columns are not decoded and reassembled, which greatly improves +// ** performance. Raw index records are transferred in the same way. +// ** +// ** The xfer optimization is only attempted if tab1 and tab2 are compatible. +// ** There are lots of rules for determining compatibility - see comments +// ** embedded in the code for details. +// ** +// ** This routine returns TRUE if the optimization is guaranteed to be used. +// ** Sometimes the xfer optimization will only work if the destination table +// ** is empty - a factor that can only be determined at run-time. In that +// ** case, this routine generates code for the xfer optimization but also +// ** does a test to see if the destination table is empty and jumps over the +// ** xfer optimization code if the test fails. In that case, this routine +// ** returns FALSE so that the caller will know to go ahead and generate +// ** an unoptimized transfer. This routine also returns FALSE if there +// ** is no chance that the xfer optimization can be applied. +// ** +// ** This optimization is particularly useful at making VACUUM run faster. +// */ +func _xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uintptr, onError int32, iDbDest int32) (r int32) { + var addr1, addr2, destHasUniqueIdx, emptyDestTest, emptySrcTest, i, iDbSrc, iDest, iSrc, regAutoinc, regData, regRowid, v4, v6 int32 + var db, pDestCol, pDestExpr, pDestIdx, pEList, pItem, pSrc, pSrcCol, pSrcExpr, pSrcIdx, v, zColl, v5, v7 uintptr + var idxInsFlags, insFlags Tu8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr1, addr2, db, destHasUniqueIdx, emptyDestTest, emptySrcTest, i, iDbSrc, iDest, iSrc, idxInsFlags, insFlags, pDestCol, pDestExpr, pDestIdx, pEList, pItem, pSrc, pSrcCol, pSrcExpr, pSrcIdx, regAutoinc, regData, regRowid, v, zColl, v4, v5, v6, v7 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Loop addresses */ + emptyDestTest = 0 /* Address of test for empty pDest */ + emptySrcTest = 0 /* Memory register used by AUTOINC */ + destHasUniqueIdx = 0 /* Registers holding data and rowid */ + if (*TParse)(unsafe.Pointer(pParse)).FpWith != 0 || (*TSelect)(unsafe.Pointer(pSelect)).FpWith != 0 { + /* Do not attempt to process this query if there are an WITH clauses + ** attached to it. Proceeding may generate a false "no such table: xxx" + ** error if pSelect reads from a CTE named "xxx". */ + return 0 + } + if int32((*TTable)(unsafe.Pointer(pDest)).FeTabType) == int32(TABTYP_VTAB) { + return 0 /* tab1 must not be a virtual table */ + } + if onError == int32(OE_Default) { + if int32((*TTable)(unsafe.Pointer(pDest)).FiPKey) >= 0 { + onError = int32((*TTable)(unsafe.Pointer(pDest)).FkeyConf) + } + if onError == int32(OE_Default) { + onError = int32(OE_Abort) + } + } + /* allocated even if there is no FROM clause */ + if (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpSrc)).FnSrc != int32(1) { + return 0 /* FROM clause must have exactly one term */ + } + if (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpSrc + 8))).FpSelect != 0 { + return 0 /* FROM clause cannot contain a subquery */ + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpWhere != 0 { + return 0 /* SELECT may not have a WHERE clause */ + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpOrderBy != 0 { + return 0 /* SELECT may not have an ORDER BY clause */ + } + /* Do not need to test for a HAVING clause. If HAVING is present but + ** there is no ORDER BY, we will get an error. */ + if (*TSelect)(unsafe.Pointer(pSelect)).FpGroupBy != 0 { + return 0 /* SELECT may not have a GROUP BY clause */ + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpLimit != 0 { + return 0 /* SELECT may not have a LIMIT clause */ + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpPrior != 0 { + return 0 /* SELECT may not be a compound query */ + } + if (*TSelect)(unsafe.Pointer(pSelect)).FselFlags&uint32(SF_Distinct) != 0 { + return 0 /* SELECT may not be DISTINCT */ + } + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + if (*TExprList)(unsafe.Pointer(pEList)).FnExpr != int32(1) { + return 0 /* The result set must have exactly one column */ + } + if int32((*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr)).Fop) != int32(TK_ASTERISK) { + return 0 /* The result set must be the special operator "*" */ + } + /* At this point we have established that the statement is of the + ** correct syntactic form to participate in this optimization. Now + ** we have to check the semantics. + */ + pItem = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + 8 + pSrc = _sqlite3LocateTableItem(tls, pParse, uint32(0), pItem) + if pSrc == uintptr(0) { + return 0 /* FROM clause does not contain a real table */ + } + if (*TTable)(unsafe.Pointer(pSrc)).Ftnum == (*TTable)(unsafe.Pointer(pDest)).Ftnum && (*TTable)(unsafe.Pointer(pSrc)).FpSchema == (*TTable)(unsafe.Pointer(pDest)).FpSchema { + /* Possible due to bad sqlite_schema.rootpage */ + return 0 /* tab1 and tab2 may not be the same table */ + } + if libc.BoolInt32((*TTable)(unsafe.Pointer(pDest)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0)) != libc.BoolInt32((*TTable)(unsafe.Pointer(pSrc)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0)) { + return 0 /* source and destination must both be WITHOUT ROWID or not */ + } + if !(int32((*TTable)(unsafe.Pointer(pSrc)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + return 0 /* tab2 may not be a view or virtual table */ + } + if int32((*TTable)(unsafe.Pointer(pDest)).FnCol) != int32((*TTable)(unsafe.Pointer(pSrc)).FnCol) { + return 0 /* Number of columns must be the same in tab1 and tab2 */ + } + if int32((*TTable)(unsafe.Pointer(pDest)).FiPKey) != int32((*TTable)(unsafe.Pointer(pSrc)).FiPKey) { + return 0 /* Both tables must have the same INTEGER PRIMARY KEY */ + } + if (*TTable)(unsafe.Pointer(pDest)).FtabFlags&uint32(TF_Strict) != uint32(0) && (*TTable)(unsafe.Pointer(pSrc)).FtabFlags&uint32(TF_Strict) == uint32(0) { + return 0 /* Cannot feed from a non-strict into a strict table */ + } + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pDest)).FnCol)) { + break + } + pDestCol = (*TTable)(unsafe.Pointer(pDest)).FaCol + uintptr(i)*16 + pSrcCol = (*TTable)(unsafe.Pointer(pSrc)).FaCol + uintptr(i)*16 + /* Even if tables t1 and t2 have identical schemas, if they contain + ** generated columns, then this statement is semantically incorrect: + ** + ** INSERT INTO t2 SELECT * FROM t1; + ** + ** The reason is that generated column values are returned by the + ** the SELECT statement on the right but the INSERT statement on the + ** left wants them to be omitted. + ** + ** Nevertheless, this is a useful notational shorthand to tell SQLite + ** to do a bulk transfer all of the content from t1 over to t2. + ** + ** We could, in theory, disable this (except for internal use by the + ** VACUUM command where it is actually needed). But why do that? It + ** seems harmless enough, and provides a useful service. + */ + if int32((*TColumn)(unsafe.Pointer(pDestCol)).FcolFlags)&int32(COLFLAG_GENERATED) != int32((*TColumn)(unsafe.Pointer(pSrcCol)).FcolFlags)&int32(COLFLAG_GENERATED) { + return 0 /* Both columns have the same generated-column type */ + } + /* But the transfer is only allowed if both the source and destination + ** tables have the exact same expressions for generated columns. + ** This requirement could be relaxed for VIRTUAL columns, I suppose. + */ + if int32((*TColumn)(unsafe.Pointer(pDestCol)).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + if _sqlite3ExprCompare(tls, uintptr(0), _sqlite3ColumnExpr(tls, pSrc, pSrcCol), _sqlite3ColumnExpr(tls, pDest, pDestCol), -int32(1)) != 0 { + return 0 /* Different generator expressions */ + } + } + if int32((*TColumn)(unsafe.Pointer(pDestCol)).Faffinity) != int32((*TColumn)(unsafe.Pointer(pSrcCol)).Faffinity) { + return 0 /* Affinity must be the same on all columns */ + } + if Xsqlite3_stricmp(tls, _sqlite3ColumnColl(tls, pDestCol), _sqlite3ColumnColl(tls, pSrcCol)) != 0 { + return 0 /* Collating sequence must be the same on all columns */ + } + if int32(uint32(*(*uint8)(unsafe.Pointer(pDestCol + 8))&0xf>>0)) != 0 && !(int32(uint32(*(*uint8)(unsafe.Pointer(pSrcCol + 8))&0xf>>0)) != 0) { + return 0 /* tab2 must be NOT NULL if tab1 is */ + } + /* Default values for second and subsequent columns need to match. */ + if int32((*TColumn)(unsafe.Pointer(pDestCol)).FcolFlags)&int32(COLFLAG_GENERATED) == 0 && i > 0 { + pDestExpr = _sqlite3ColumnExpr(tls, pDest, pDestCol) + pSrcExpr = _sqlite3ColumnExpr(tls, pSrc, pSrcCol) + if libc.BoolInt32(pDestExpr == uintptr(0)) != libc.BoolInt32(pSrcExpr == uintptr(0)) || pDestExpr != uintptr(0) && libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(pDestExpr + 8)), *(*uintptr)(unsafe.Pointer(pSrcExpr + 8))) != 0 { + return 0 /* Default values must be the same for all columns */ + } + } + goto _1 + _1: + ; + i++ + } + pDestIdx = (*TTable)(unsafe.Pointer(pDest)).FpIndex + for { + if !(pDestIdx != 0) { + break + } + if int32((*TIndex)(unsafe.Pointer(pDestIdx)).FonError) != OE_None { + destHasUniqueIdx = int32(1) + } + pSrcIdx = (*TTable)(unsafe.Pointer(pSrc)).FpIndex + for { + if !(pSrcIdx != 0) { + break + } + if _xferCompatibleIndex(tls, pDestIdx, pSrcIdx) != 0 { + break + } + goto _3 + _3: + ; + pSrcIdx = (*TIndex)(unsafe.Pointer(pSrcIdx)).FpNext + } + if pSrcIdx == uintptr(0) { + return 0 /* pDestIdx has no corresponding index in pSrc */ + } + if (*TIndex)(unsafe.Pointer(pSrcIdx)).Ftnum == (*TIndex)(unsafe.Pointer(pDestIdx)).Ftnum && (*TTable)(unsafe.Pointer(pSrc)).FpSchema == (*TTable)(unsafe.Pointer(pDest)).FpSchema && _sqlite3FaultSim(tls, int32(411)) == SQLITE_OK { + /* The sqlite3FaultSim() call allows this corruption test to be + ** bypassed during testing, in order to exercise other corruption tests + ** further downstream. */ + return 0 /* Corrupt schema - two indexes on the same btree */ + } + goto _2 + _2: + ; + pDestIdx = (*TIndex)(unsafe.Pointer(pDestIdx)).FpNext + } + if (*TTable)(unsafe.Pointer(pDest)).FpCheck != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) && _sqlite3ExprListCompare(tls, (*TTable)(unsafe.Pointer(pSrc)).FpCheck, (*TTable)(unsafe.Pointer(pDest)).FpCheck, -int32(1)) != 0 { + return 0 /* Tables have different CHECK constraints. Ticket #2252 */ + } + /* Disallow the transfer optimization if the destination table contains + ** any foreign key constraints. This is more restrictive than necessary. + ** But the main beneficiary of the transfer optimization is the VACUUM + ** command, and the VACUUM command disables foreign key constraints. So + ** the extra complication to make this rule less restrictive is probably + ** not worth the effort. Ticket [6284df89debdfa61db8073e062908af0c9b6118e] + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != uint64(0) && (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pDest + 64))).FpFKey != uintptr(0) { + return 0 + } + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00001))<= 0 { + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iSrc, regRowid) + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { + addr2 = _sqlite3VdbeAddOp3(tls, v, int32(OP_NotExists), iDest, 0, regRowid) + _sqlite3RowidConstraint(tls, pParse, onError, pDest) + _sqlite3VdbeJumpHere(tls, v, addr2) + } + _autoIncStep(tls, pParse, regAutoinc, regRowid) + } else { + if (*TTable)(unsafe.Pointer(pDest)).FpIndex == uintptr(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&libc.Uint32FromInt32(DBFLAG_VacuumInto) != 0) { + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iDest, regRowid) + } else { + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iSrc, regRowid) + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_SeekEnd), iDest) + insFlags = uint8(libc.Int32FromInt32(OPFLAG_APPEND) | libc.Int32FromInt32(OPFLAG_USESEEKRESULT) | libc.Int32FromInt32(OPFLAG_PREFORMAT)) + } else { + insFlags = uint8(libc.Int32FromInt32(OPFLAG_NCHANGE) | libc.Int32FromInt32(OPFLAG_LASTROWID) | libc.Int32FromInt32(OPFLAG_APPEND) | libc.Int32FromInt32(OPFLAG_PREFORMAT)) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_RowData), iSrc, regData, int32(1)) + insFlags = Tu8(int32(insFlags) & ^libc.Int32FromInt32(OPFLAG_PREFORMAT)) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_RowCell), iDest, iSrc, regRowid) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iDest, regData, regRowid) + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { + _sqlite3VdbeChangeP4(tls, v, -int32(1), pDest, -int32(5)) + } + _sqlite3VdbeChangeP5(tls, v, uint16(insFlags)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iSrc, addr1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iSrc, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iDest, 0) + } else { + _sqlite3TableLock(tls, pParse, iDbDest, (*TTable)(unsafe.Pointer(pDest)).Ftnum, uint8(1), (*TTable)(unsafe.Pointer(pDest)).FzName) + _sqlite3TableLock(tls, pParse, iDbSrc, (*TTable)(unsafe.Pointer(pSrc)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pSrc)).FzName) + } + pDestIdx = (*TTable)(unsafe.Pointer(pDest)).FpIndex + for { + if !(pDestIdx != 0) { + break + } + idxInsFlags = uint8(0) + pSrcIdx = (*TTable)(unsafe.Pointer(pSrc)).FpIndex + for { + if !(pSrcIdx != 0) { + break + } + if _xferCompatibleIndex(tls, pDestIdx, pSrcIdx) != 0 { + break + } + goto _9 + _9: + ; + pSrcIdx = (*TIndex)(unsafe.Pointer(pSrcIdx)).FpNext + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iSrc, int32((*TIndex)(unsafe.Pointer(pSrcIdx)).Ftnum), iDbSrc) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pSrcIdx) + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenWrite), iDest, int32((*TIndex)(unsafe.Pointer(pDestIdx)).Ftnum), iDbDest) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pDestIdx) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_BULKCSR)) + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), iSrc, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) != 0 { + /* This INSERT command is part of a VACUUM operation, which guarantees + ** that the destination table is empty. If all indexed columns use + ** collation sequence BINARY, then it can also be assumed that the + ** index will be populated by inserting keys in strictly sorted + ** order. In this case, instead of seeking within the b-tree as part + ** of every OP_IdxInsert opcode, an OP_SeekEnd is added before the + ** OP_IdxInsert to seek to the point within the b-tree where each key + ** should be inserted. This is faster. + ** + ** If any of the indexed columns use a collation sequence other than + ** BINARY, this optimization is disabled. This is because the user + ** might change the definition of a collation sequence and then run + ** a VACUUM command. In that case keys may not be written in strictly + ** sorted order. */ + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pSrcIdx)).FnColumn)) { + break + } + zColl = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pSrcIdx)).FazColl + uintptr(i)*8)) + if Xsqlite3_stricmp(tls, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), zColl) != 0 { + break + } + goto _10 + _10: + ; + i++ + } + if i == int32((*TIndex)(unsafe.Pointer(pSrcIdx)).FnColumn) { + idxInsFlags = uint8(libc.Int32FromInt32(OPFLAG_USESEEKRESULT) | libc.Int32FromInt32(OPFLAG_PREFORMAT)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_SeekEnd), iDest) + _sqlite3VdbeAddOp2(tls, v, int32(OP_RowCell), iDest, iSrc) + } + } else { + if !((*TTable)(unsafe.Pointer(pSrc)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pDestIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + idxInsFlags = Tu8(int32(idxInsFlags) | libc.Int32FromInt32(OPFLAG_NCHANGE)) + } + } + if int32(idxInsFlags) != libc.Int32FromInt32(OPFLAG_USESEEKRESULT)|libc.Int32FromInt32(OPFLAG_PREFORMAT) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_RowData), iSrc, regData, int32(1)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) && !((*TTable)(unsafe.Pointer(pDest)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pDestIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + _codeWithoutRowidPreupdate(tls, pParse, pDest, iDest, regData) + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxInsert), iDest, regData) + _sqlite3VdbeChangeP5(tls, v, uint16(int32(idxInsFlags)|int32(OPFLAG_APPEND))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iSrc, addr1+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addr1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iSrc, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iDest, 0) + goto _8 + _8: + ; + pDestIdx = (*TIndex)(unsafe.Pointer(pDestIdx)).FpNext + } + if emptySrcTest != 0 { + _sqlite3VdbeJumpHere(tls, v, emptySrcTest) + } + _sqlite3ReleaseTempReg(tls, pParse, regRowid) + _sqlite3ReleaseTempReg(tls, pParse, regData) + if emptyDestTest != 0 { + _sqlite3AutoincrementEnd(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Halt), SQLITE_OK, 0) + _sqlite3VdbeJumpHere(tls, v, emptyDestTest) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), iDest, 0) + return 0 + } else { + return int32(1) + } + return r +} + +/************** End of insert.c **********************************************/ +/************** Begin file legacy.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Main file for the SQLite library. The routines in this file +** implement the programmer interface to the library. Routines in +** other files are for internal use by SQLite and should not be +** accessed by users of the library. + */ + +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Execute SQL code. Return one of the SQLITE_ success/failure +// ** codes. Also write an error message into memory obtained from +// ** malloc() and make *pzErrMsg point to that message. +// ** +// ** If the SQL is a query, then for each row in the query result +// ** the xCallback() function is called. pArg becomes the first +// ** argument to xCallback(). If xCallback=NULL then no callback +// ** is invoked, even for queries. +// */ +func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_callback, pArg uintptr, pzErrMsg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var azCols, azVals uintptr + var callbackIsInit, i, nCol, rc int32 + var _ /* pStmt at bp+8 */ uintptr + var _ /* zLeftover at bp+0 */ uintptr + _, _, _, _, _, _ = azCols, azVals, callbackIsInit, i, nCol, rc + rc = SQLITE_OK /* Tail of unprocessed SQL */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* The current SQL statement */ + azCols = uintptr(0) /* True if callback data is initialized */ + if !(_sqlite3SafetyCheckOk(tls, db) != 0) { + return _sqlite3MisuseError(tls, int32(135482)) + } + if zSql == uintptr(0) { + zSql = __ccgo_ts + 1680 + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3Error(tls, db, SQLITE_OK) + for rc == SQLITE_OK && *(*int8)(unsafe.Pointer(zSql)) != 0 { + nCol = 0 + azVals = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp+8, bp) + if rc != SQLITE_OK { + continue + } + if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) { + /* this happens for a comment or white-space */ + zSql = *(*uintptr)(unsafe.Pointer(bp)) + continue + } + callbackIsInit = 0 + for int32(1) != 0 { + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + /* Invoke the callback function if required */ + if xCallback != 0 && (int32(SQLITE_ROW) == rc || int32(SQLITE_DONE) == rc && !(callbackIsInit != 0) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_NullCallback) != 0) { + if !(callbackIsInit != 0) { + nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + azCols = _sqlite3DbMallocRaw(tls, db, uint64(libc.Int32FromInt32(2)*nCol+libc.Int32FromInt32(1))*uint64(8)) + if azCols == uintptr(0) { + goto exec_out + } + i = 0 + for { + if !(i < nCol) { + break + } + *(*uintptr)(unsafe.Pointer(azCols + uintptr(i)*8)) = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) + /* sqlite3VdbeSetColName() installs column names as UTF8 + ** strings so there is no way for sqlite3_column_name() to fail. */ + goto _1 + _1: + ; + i++ + } + callbackIsInit = int32(1) + } + if rc == int32(SQLITE_ROW) { + azVals = azCols + uintptr(nCol)*8 + i = 0 + for { + if !(i < nCol) { + break + } + *(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) + if !(*(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) != 0) && Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) != int32(SQLITE_NULL) { + _sqlite3OomFault(tls, db) + goto exec_out + } + goto _2 + _2: + ; + i++ + } + *(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) = uintptr(0) + } + if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xCallback})))(tls, pArg, nCol, azVals, azCols) != 0 { + /* EVIDENCE-OF: R-38229-40159 If the callback function to + ** sqlite3_exec() returns non-zero, then sqlite3_exec() will + ** return SQLITE_ABORT. */ + rc = int32(SQLITE_ABORT) + _sqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + _sqlite3Error(tls, db, int32(SQLITE_ABORT)) + goto exec_out + } + } + if rc != int32(SQLITE_ROW) { + rc = _sqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + zSql = *(*uintptr)(unsafe.Pointer(bp)) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql)))])&int32(0x01) != 0 { + zSql++ + } + break + } + } + _sqlite3DbFree(tls, db, azCols) + azCols = uintptr(0) + } +exec_out: + ; + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + _sqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + _sqlite3DbFree(tls, db, azCols) + rc = _sqlite3ApiExit(tls, db, rc) + if rc != SQLITE_OK && pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = _sqlite3DbStrDup(tls, uintptr(0), Xsqlite3_errmsg(tls, db)) + if *(*uintptr)(unsafe.Pointer(pzErrMsg)) == uintptr(0) { + rc = int32(SQLITE_NOMEM) + _sqlite3Error(tls, db, int32(SQLITE_NOMEM)) + } + } else { + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +/************** End of legacy.c **********************************************/ +/************** Begin file loadext.c *****************************************/ +/* +** 2006 June 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to dynamically load extensions into +** the SQLite library. + */ + +/************** Include sqlite3ext.h in the middle of loadext.c **************/ +/************** Begin file sqlite3ext.h **************************************/ +/* +** 2006 June 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the SQLite interface for use by +** shared libraries that want to be imported as extensions into +** an SQLite instance. Shared libraries that intend to be loaded +** as extensions by SQLite should #include this file instead of +** sqlite3.h. + */ +/* #include "sqlite3.h" */ + +/* +** The following structure holds pointers to all of the SQLite API +** routines. +** +** WARNING: In order to maintain backwards compatibility, add new +** interfaces to the end of this structure only. If you insert new +** interfaces in the middle of this structure, then older different +** versions of SQLite will not be able to load each other's shared +** libraries! + */ +type Tsqlite3_api_routines1 = struct { + Faggregate_context uintptr + Faggregate_count uintptr + Fbind_blob uintptr + Fbind_double uintptr + Fbind_int uintptr + Fbind_int64 uintptr + Fbind_null uintptr + Fbind_parameter_count uintptr + Fbind_parameter_index uintptr + Fbind_parameter_name uintptr + Fbind_text uintptr + Fbind_text16 uintptr + Fbind_value uintptr + Fbusy_handler uintptr + Fbusy_timeout uintptr + Fchanges uintptr + Fclose1 uintptr + Fcollation_needed uintptr + Fcollation_needed16 uintptr + Fcolumn_blob uintptr + Fcolumn_bytes uintptr + Fcolumn_bytes16 uintptr + Fcolumn_count uintptr + Fcolumn_database_name uintptr + Fcolumn_database_name16 uintptr + Fcolumn_decltype uintptr + Fcolumn_decltype16 uintptr + Fcolumn_double uintptr + Fcolumn_int uintptr + Fcolumn_int64 uintptr + Fcolumn_name uintptr + Fcolumn_name16 uintptr + Fcolumn_origin_name uintptr + Fcolumn_origin_name16 uintptr + Fcolumn_table_name uintptr + Fcolumn_table_name16 uintptr + Fcolumn_text uintptr + Fcolumn_text16 uintptr + Fcolumn_type uintptr + Fcolumn_value uintptr + Fcommit_hook uintptr + Fcomplete uintptr + Fcomplete16 uintptr + Fcreate_collation uintptr + Fcreate_collation16 uintptr + Fcreate_function uintptr + Fcreate_function16 uintptr + Fcreate_module uintptr + Fdata_count uintptr + Fdb_handle uintptr + Fdeclare_vtab uintptr + Fenable_shared_cache uintptr + Ferrcode uintptr + Ferrmsg uintptr + Ferrmsg16 uintptr + Fexec uintptr + Fexpired uintptr + Ffinalize uintptr + Ffree uintptr + Ffree_table uintptr + Fget_autocommit uintptr + Fget_auxdata uintptr + Fget_table uintptr + Fglobal_recover uintptr + Finterruptx uintptr + Flast_insert_rowid uintptr + Flibversion uintptr + Flibversion_number uintptr + Fmalloc uintptr + Fmprintf uintptr + Fopen uintptr + Fopen16 uintptr + Fprepare uintptr + Fprepare16 uintptr + Fprofile uintptr + Fprogress_handler uintptr + Frealloc uintptr + Freset uintptr + Fresult_blob uintptr + Fresult_double uintptr + Fresult_error uintptr + Fresult_error16 uintptr + Fresult_int uintptr + Fresult_int64 uintptr + Fresult_null uintptr + Fresult_text uintptr + Fresult_text16 uintptr + Fresult_text16be uintptr + Fresult_text16le uintptr + Fresult_value uintptr + Frollback_hook uintptr + Fset_authorizer uintptr + Fset_auxdata uintptr + Fxsnprintf uintptr + Fstep uintptr + Ftable_column_metadata uintptr + Fthread_cleanup uintptr + Ftotal_changes uintptr + Ftrace uintptr + Ftransfer_bindings uintptr + Fupdate_hook uintptr + Fuser_data uintptr + Fvalue_blob uintptr + Fvalue_bytes uintptr + Fvalue_bytes16 uintptr + Fvalue_double uintptr + Fvalue_int uintptr + Fvalue_int64 uintptr + Fvalue_numeric_type uintptr + Fvalue_text uintptr + Fvalue_text16 uintptr + Fvalue_text16be uintptr + Fvalue_text16le uintptr + Fvalue_type uintptr + Fvmprintf uintptr + Foverload_function uintptr + Fprepare_v2 uintptr + Fprepare16_v2 uintptr + Fclear_bindings uintptr + Fcreate_module_v2 uintptr + Fbind_zeroblob uintptr + Fblob_bytes uintptr + Fblob_close uintptr + Fblob_open uintptr + Fblob_read uintptr + Fblob_write uintptr + Fcreate_collation_v2 uintptr + Ffile_control uintptr + Fmemory_highwater uintptr + Fmemory_used uintptr + Fmutex_alloc uintptr + Fmutex_enter uintptr + Fmutex_free uintptr + Fmutex_leave uintptr + Fmutex_try uintptr + Fopen_v2 uintptr + Frelease_memory uintptr + Fresult_error_nomem uintptr + Fresult_error_toobig uintptr + Fsleep uintptr + Fsoft_heap_limit uintptr + Fvfs_find uintptr + Fvfs_register uintptr + Fvfs_unregister uintptr + Fxthreadsafe uintptr + Fresult_zeroblob uintptr + Fresult_error_code uintptr + Ftest_control uintptr + Frandomness uintptr + Fcontext_db_handle uintptr + Fextended_result_codes uintptr + Flimit uintptr + Fnext_stmt uintptr + Fsql uintptr + Fstatus uintptr + Fbackup_finish uintptr + Fbackup_init uintptr + Fbackup_pagecount uintptr + Fbackup_remaining uintptr + Fbackup_step uintptr + Fcompileoption_get uintptr + Fcompileoption_used uintptr + Fcreate_function_v2 uintptr + Fdb_config uintptr + Fdb_mutex uintptr + Fdb_status uintptr + Fextended_errcode uintptr + Flog uintptr + Fsoft_heap_limit64 uintptr + Fsourceid uintptr + Fstmt_status uintptr + Fstrnicmp uintptr + Funlock_notify uintptr + Fwal_autocheckpoint uintptr + Fwal_checkpoint uintptr + Fwal_hook uintptr + Fblob_reopen uintptr + Fvtab_config uintptr + Fvtab_on_conflict uintptr + Fclose_v2 uintptr + Fdb_filename uintptr + Fdb_readonly uintptr + Fdb_release_memory uintptr + Ferrstr uintptr + Fstmt_busy uintptr + Fstmt_readonly uintptr + Fstricmp uintptr + Furi_boolean uintptr + Furi_int64 uintptr + Furi_parameter uintptr + Fxvsnprintf uintptr + Fwal_checkpoint_v2 uintptr + Fauto_extension uintptr + Fbind_blob64 uintptr + Fbind_text64 uintptr + Fcancel_auto_extension uintptr + Fload_extension uintptr + Fmalloc64 uintptr + Fmsize uintptr + Frealloc64 uintptr + Freset_auto_extension uintptr + Fresult_blob64 uintptr + Fresult_text64 uintptr + Fstrglob uintptr + Fvalue_dup uintptr + Fvalue_free uintptr + Fresult_zeroblob64 uintptr + Fbind_zeroblob64 uintptr + Fvalue_subtype uintptr + Fresult_subtype uintptr + Fstatus64 uintptr + Fstrlike uintptr + Fdb_cacheflush uintptr + Fsystem_errno uintptr + Ftrace_v2 uintptr + Fexpanded_sql uintptr + Fset_last_insert_rowid uintptr + Fprepare_v3 uintptr + Fprepare16_v3 uintptr + Fbind_pointer uintptr + Fresult_pointer uintptr + Fvalue_pointer uintptr + Fvtab_nochange uintptr + Fvalue_nochange uintptr + Fvtab_collation uintptr + Fkeyword_count uintptr + Fkeyword_name uintptr + Fkeyword_check uintptr + Fstr_new uintptr + Fstr_finish uintptr + Fstr_appendf uintptr + Fstr_vappendf uintptr + Fstr_append uintptr + Fstr_appendall uintptr + Fstr_appendchar uintptr + Fstr_reset uintptr + Fstr_errcode uintptr + Fstr_length uintptr + Fstr_value uintptr + Fcreate_window_function uintptr + Fnormalized_sql uintptr + Fstmt_isexplain uintptr + Fvalue_frombind uintptr + Fdrop_modules uintptr + Fhard_heap_limit64 uintptr + Furi_key uintptr + Ffilename_database uintptr + Ffilename_journal uintptr + Ffilename_wal uintptr + Fcreate_filename uintptr + Ffree_filename uintptr + Fdatabase_file_object uintptr + Ftxn_state uintptr + Fchanges64 uintptr + Ftotal_changes64 uintptr + Fautovacuum_pages uintptr + Ferror_offset uintptr + Fvtab_rhs_value uintptr + Fvtab_distinct uintptr + Fvtab_in uintptr + Fvtab_in_first uintptr + Fvtab_in_next uintptr + Fdeserialize uintptr + Fserialize uintptr + Fdb_name uintptr + Fvalue_encoding uintptr + Fis_interrupted uintptr + Fstmt_explain uintptr + Fget_clientdata uintptr + Fset_clientdata uintptr +} + +type sqlite3_api_routines1 = Tsqlite3_api_routines1 + +// C documentation +// +// /* +// ** This is the function signature used for all extension entry points. It +// ** is also defined in the file "loadext.c". +// */ +type Tsqlite3_loadext_entry = uintptr + +type sqlite3_loadext_entry = Tsqlite3_loadext_entry + +/* +** The following macros redefine the API routines so that they are +** redirected through the global sqlite3_api structure. +** +** This header file is also used by the loadext.c source file +** (part of the main SQLite library - not an extension) so that +** it can get access to the sqlite3_api_routines structure +** definition. But the main library does not want to redefine +** the API. So the redefinition macros are only valid if the +** SQLITE_CORE macros is undefined. + */ + +/* This case when the file is being statically linked into the + ** application */ + +/************** End of sqlite3ext.h ******************************************/ +/************** Continuing where we left off in loadext.c ********************/ +/* #include "sqliteInt.h" */ + +/* +** Some API routines are omitted when various features are +** excluded from a build of SQLite. Substitute a NULL pointer +** for any missing APIs. + */ + +// C documentation +// +// /* +// ** The following structure contains pointers to all SQLite API routines. +// ** A pointer to this structure is passed into extensions when they are +// ** loaded so that the extension can make calls back into the SQLite +// ** library. +// ** +// ** When adding new APIs, add them to the bottom of this structure +// ** in order to preserve backwards compatibility. +// ** +// ** Extensions that use newer APIs should first call the +// ** sqlite3_libversion_number() to make sure that the API they +// ** intend to use is supported by the library. Extensions should +// ** also check to make sure that the pointer to the function is +// ** not NULL before calling it. +// */ +var _sqlite3Apis = Tsqlite3_api_routines{} + +func init() { + p := unsafe.Pointer(&_sqlite3Apis) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(Xsqlite3_aggregate_context) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(Xsqlite3_aggregate_count) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(Xsqlite3_bind_blob) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(Xsqlite3_bind_double) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(Xsqlite3_bind_int) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(Xsqlite3_bind_int64) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(Xsqlite3_bind_null) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(Xsqlite3_bind_parameter_count) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(Xsqlite3_bind_parameter_index) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(Xsqlite3_bind_parameter_name) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(Xsqlite3_bind_text) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(Xsqlite3_bind_text16) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(Xsqlite3_bind_value) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(Xsqlite3_busy_handler) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(Xsqlite3_busy_timeout) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(Xsqlite3_changes) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(Xsqlite3_close) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(Xsqlite3_collation_needed) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(Xsqlite3_collation_needed16) + *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(Xsqlite3_column_blob) + *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(Xsqlite3_column_bytes) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(Xsqlite3_column_bytes16) + *(*uintptr)(unsafe.Add(p, 176)) = __ccgo_fp(Xsqlite3_column_count) + *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(Xsqlite3_column_database_name) + *(*uintptr)(unsafe.Add(p, 192)) = __ccgo_fp(Xsqlite3_column_database_name16) + *(*uintptr)(unsafe.Add(p, 200)) = __ccgo_fp(Xsqlite3_column_decltype) + *(*uintptr)(unsafe.Add(p, 208)) = __ccgo_fp(Xsqlite3_column_decltype16) + *(*uintptr)(unsafe.Add(p, 216)) = __ccgo_fp(Xsqlite3_column_double) + *(*uintptr)(unsafe.Add(p, 224)) = __ccgo_fp(Xsqlite3_column_int) + *(*uintptr)(unsafe.Add(p, 232)) = __ccgo_fp(Xsqlite3_column_int64) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(Xsqlite3_column_name) + *(*uintptr)(unsafe.Add(p, 248)) = __ccgo_fp(Xsqlite3_column_name16) + *(*uintptr)(unsafe.Add(p, 256)) = __ccgo_fp(Xsqlite3_column_origin_name) + *(*uintptr)(unsafe.Add(p, 264)) = __ccgo_fp(Xsqlite3_column_origin_name16) + *(*uintptr)(unsafe.Add(p, 272)) = __ccgo_fp(Xsqlite3_column_table_name) + *(*uintptr)(unsafe.Add(p, 280)) = __ccgo_fp(Xsqlite3_column_table_name16) + *(*uintptr)(unsafe.Add(p, 288)) = __ccgo_fp(Xsqlite3_column_text) + *(*uintptr)(unsafe.Add(p, 296)) = __ccgo_fp(Xsqlite3_column_text16) + *(*uintptr)(unsafe.Add(p, 304)) = __ccgo_fp(Xsqlite3_column_type) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(Xsqlite3_column_value) + *(*uintptr)(unsafe.Add(p, 320)) = __ccgo_fp(Xsqlite3_commit_hook) + *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(Xsqlite3_complete) + *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(Xsqlite3_complete16) + *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(Xsqlite3_create_collation) + *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(Xsqlite3_create_collation16) + *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(Xsqlite3_create_function) + *(*uintptr)(unsafe.Add(p, 368)) = __ccgo_fp(Xsqlite3_create_function16) + *(*uintptr)(unsafe.Add(p, 376)) = __ccgo_fp(Xsqlite3_create_module) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(Xsqlite3_data_count) + *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(Xsqlite3_db_handle) + *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(Xsqlite3_declare_vtab) + *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(Xsqlite3_enable_shared_cache) + *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(Xsqlite3_errcode) + *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(Xsqlite3_errmsg) + *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(Xsqlite3_errmsg16) + *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(Xsqlite3_exec) + *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(Xsqlite3_expired) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(Xsqlite3_finalize) + *(*uintptr)(unsafe.Add(p, 464)) = __ccgo_fp(Xsqlite3_free) + *(*uintptr)(unsafe.Add(p, 472)) = __ccgo_fp(Xsqlite3_free_table) + *(*uintptr)(unsafe.Add(p, 480)) = __ccgo_fp(Xsqlite3_get_autocommit) + *(*uintptr)(unsafe.Add(p, 488)) = __ccgo_fp(Xsqlite3_get_auxdata) + *(*uintptr)(unsafe.Add(p, 496)) = __ccgo_fp(Xsqlite3_get_table) + *(*uintptr)(unsafe.Add(p, 512)) = __ccgo_fp(Xsqlite3_interrupt) + *(*uintptr)(unsafe.Add(p, 520)) = __ccgo_fp(Xsqlite3_last_insert_rowid) + *(*uintptr)(unsafe.Add(p, 528)) = __ccgo_fp(Xsqlite3_libversion) + *(*uintptr)(unsafe.Add(p, 536)) = __ccgo_fp(Xsqlite3_libversion_number) + *(*uintptr)(unsafe.Add(p, 544)) = __ccgo_fp(Xsqlite3_malloc) + *(*uintptr)(unsafe.Add(p, 552)) = __ccgo_fp(Xsqlite3_mprintf) + *(*uintptr)(unsafe.Add(p, 560)) = __ccgo_fp(Xsqlite3_open) + *(*uintptr)(unsafe.Add(p, 568)) = __ccgo_fp(Xsqlite3_open16) + *(*uintptr)(unsafe.Add(p, 576)) = __ccgo_fp(Xsqlite3_prepare) + *(*uintptr)(unsafe.Add(p, 584)) = __ccgo_fp(Xsqlite3_prepare16) + *(*uintptr)(unsafe.Add(p, 592)) = __ccgo_fp(Xsqlite3_profile) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(Xsqlite3_progress_handler) + *(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(Xsqlite3_realloc) + *(*uintptr)(unsafe.Add(p, 616)) = __ccgo_fp(Xsqlite3_reset) + *(*uintptr)(unsafe.Add(p, 624)) = __ccgo_fp(Xsqlite3_result_blob) + *(*uintptr)(unsafe.Add(p, 632)) = __ccgo_fp(Xsqlite3_result_double) + *(*uintptr)(unsafe.Add(p, 640)) = __ccgo_fp(Xsqlite3_result_error) + *(*uintptr)(unsafe.Add(p, 648)) = __ccgo_fp(Xsqlite3_result_error16) + *(*uintptr)(unsafe.Add(p, 656)) = __ccgo_fp(Xsqlite3_result_int) + *(*uintptr)(unsafe.Add(p, 664)) = __ccgo_fp(Xsqlite3_result_int64) + *(*uintptr)(unsafe.Add(p, 672)) = __ccgo_fp(Xsqlite3_result_null) + *(*uintptr)(unsafe.Add(p, 680)) = __ccgo_fp(Xsqlite3_result_text) + *(*uintptr)(unsafe.Add(p, 688)) = __ccgo_fp(Xsqlite3_result_text16) + *(*uintptr)(unsafe.Add(p, 696)) = __ccgo_fp(Xsqlite3_result_text16be) + *(*uintptr)(unsafe.Add(p, 704)) = __ccgo_fp(Xsqlite3_result_text16le) + *(*uintptr)(unsafe.Add(p, 712)) = __ccgo_fp(Xsqlite3_result_value) + *(*uintptr)(unsafe.Add(p, 720)) = __ccgo_fp(Xsqlite3_rollback_hook) + *(*uintptr)(unsafe.Add(p, 728)) = __ccgo_fp(Xsqlite3_set_authorizer) + *(*uintptr)(unsafe.Add(p, 736)) = __ccgo_fp(Xsqlite3_set_auxdata) + *(*uintptr)(unsafe.Add(p, 744)) = __ccgo_fp(Xsqlite3_snprintf) + *(*uintptr)(unsafe.Add(p, 752)) = __ccgo_fp(Xsqlite3_step) + *(*uintptr)(unsafe.Add(p, 760)) = __ccgo_fp(Xsqlite3_table_column_metadata) + *(*uintptr)(unsafe.Add(p, 768)) = __ccgo_fp(Xsqlite3_thread_cleanup) + *(*uintptr)(unsafe.Add(p, 776)) = __ccgo_fp(Xsqlite3_total_changes) + *(*uintptr)(unsafe.Add(p, 784)) = __ccgo_fp(Xsqlite3_trace) + *(*uintptr)(unsafe.Add(p, 792)) = __ccgo_fp(Xsqlite3_transfer_bindings) + *(*uintptr)(unsafe.Add(p, 800)) = __ccgo_fp(Xsqlite3_update_hook) + *(*uintptr)(unsafe.Add(p, 808)) = __ccgo_fp(Xsqlite3_user_data) + *(*uintptr)(unsafe.Add(p, 816)) = __ccgo_fp(Xsqlite3_value_blob) + *(*uintptr)(unsafe.Add(p, 824)) = __ccgo_fp(Xsqlite3_value_bytes) + *(*uintptr)(unsafe.Add(p, 832)) = __ccgo_fp(Xsqlite3_value_bytes16) + *(*uintptr)(unsafe.Add(p, 840)) = __ccgo_fp(Xsqlite3_value_double) + *(*uintptr)(unsafe.Add(p, 848)) = __ccgo_fp(Xsqlite3_value_int) + *(*uintptr)(unsafe.Add(p, 856)) = __ccgo_fp(Xsqlite3_value_int64) + *(*uintptr)(unsafe.Add(p, 864)) = __ccgo_fp(Xsqlite3_value_numeric_type) + *(*uintptr)(unsafe.Add(p, 872)) = __ccgo_fp(Xsqlite3_value_text) + *(*uintptr)(unsafe.Add(p, 880)) = __ccgo_fp(Xsqlite3_value_text16) + *(*uintptr)(unsafe.Add(p, 888)) = __ccgo_fp(Xsqlite3_value_text16be) + *(*uintptr)(unsafe.Add(p, 896)) = __ccgo_fp(Xsqlite3_value_text16le) + *(*uintptr)(unsafe.Add(p, 904)) = __ccgo_fp(Xsqlite3_value_type) + *(*uintptr)(unsafe.Add(p, 912)) = __ccgo_fp(Xsqlite3_vmprintf) + *(*uintptr)(unsafe.Add(p, 920)) = __ccgo_fp(Xsqlite3_overload_function) + *(*uintptr)(unsafe.Add(p, 928)) = __ccgo_fp(Xsqlite3_prepare_v2) + *(*uintptr)(unsafe.Add(p, 936)) = __ccgo_fp(Xsqlite3_prepare16_v2) + *(*uintptr)(unsafe.Add(p, 944)) = __ccgo_fp(Xsqlite3_clear_bindings) + *(*uintptr)(unsafe.Add(p, 952)) = __ccgo_fp(Xsqlite3_create_module_v2) + *(*uintptr)(unsafe.Add(p, 960)) = __ccgo_fp(Xsqlite3_bind_zeroblob) + *(*uintptr)(unsafe.Add(p, 968)) = __ccgo_fp(Xsqlite3_blob_bytes) + *(*uintptr)(unsafe.Add(p, 976)) = __ccgo_fp(Xsqlite3_blob_close) + *(*uintptr)(unsafe.Add(p, 984)) = __ccgo_fp(Xsqlite3_blob_open) + *(*uintptr)(unsafe.Add(p, 992)) = __ccgo_fp(Xsqlite3_blob_read) + *(*uintptr)(unsafe.Add(p, 1000)) = __ccgo_fp(Xsqlite3_blob_write) + *(*uintptr)(unsafe.Add(p, 1008)) = __ccgo_fp(Xsqlite3_create_collation_v2) + *(*uintptr)(unsafe.Add(p, 1016)) = __ccgo_fp(Xsqlite3_file_control) + *(*uintptr)(unsafe.Add(p, 1024)) = __ccgo_fp(Xsqlite3_memory_highwater) + *(*uintptr)(unsafe.Add(p, 1032)) = __ccgo_fp(Xsqlite3_memory_used) + *(*uintptr)(unsafe.Add(p, 1040)) = __ccgo_fp(Xsqlite3_mutex_alloc) + *(*uintptr)(unsafe.Add(p, 1048)) = __ccgo_fp(Xsqlite3_mutex_enter) + *(*uintptr)(unsafe.Add(p, 1056)) = __ccgo_fp(Xsqlite3_mutex_free) + *(*uintptr)(unsafe.Add(p, 1064)) = __ccgo_fp(Xsqlite3_mutex_leave) + *(*uintptr)(unsafe.Add(p, 1072)) = __ccgo_fp(Xsqlite3_mutex_try) + *(*uintptr)(unsafe.Add(p, 1080)) = __ccgo_fp(Xsqlite3_open_v2) + *(*uintptr)(unsafe.Add(p, 1088)) = __ccgo_fp(Xsqlite3_release_memory) + *(*uintptr)(unsafe.Add(p, 1096)) = __ccgo_fp(Xsqlite3_result_error_nomem) + *(*uintptr)(unsafe.Add(p, 1104)) = __ccgo_fp(Xsqlite3_result_error_toobig) + *(*uintptr)(unsafe.Add(p, 1112)) = __ccgo_fp(Xsqlite3_sleep) + *(*uintptr)(unsafe.Add(p, 1120)) = __ccgo_fp(Xsqlite3_soft_heap_limit) + *(*uintptr)(unsafe.Add(p, 1128)) = __ccgo_fp(Xsqlite3_vfs_find) + *(*uintptr)(unsafe.Add(p, 1136)) = __ccgo_fp(Xsqlite3_vfs_register) + *(*uintptr)(unsafe.Add(p, 1144)) = __ccgo_fp(Xsqlite3_vfs_unregister) + *(*uintptr)(unsafe.Add(p, 1152)) = __ccgo_fp(Xsqlite3_threadsafe) + *(*uintptr)(unsafe.Add(p, 1160)) = __ccgo_fp(Xsqlite3_result_zeroblob) + *(*uintptr)(unsafe.Add(p, 1168)) = __ccgo_fp(Xsqlite3_result_error_code) + *(*uintptr)(unsafe.Add(p, 1176)) = __ccgo_fp(Xsqlite3_test_control) + *(*uintptr)(unsafe.Add(p, 1184)) = __ccgo_fp(Xsqlite3_randomness) + *(*uintptr)(unsafe.Add(p, 1192)) = __ccgo_fp(Xsqlite3_context_db_handle) + *(*uintptr)(unsafe.Add(p, 1200)) = __ccgo_fp(Xsqlite3_extended_result_codes) + *(*uintptr)(unsafe.Add(p, 1208)) = __ccgo_fp(Xsqlite3_limit) + *(*uintptr)(unsafe.Add(p, 1216)) = __ccgo_fp(Xsqlite3_next_stmt) + *(*uintptr)(unsafe.Add(p, 1224)) = __ccgo_fp(Xsqlite3_sql) + *(*uintptr)(unsafe.Add(p, 1232)) = __ccgo_fp(Xsqlite3_status) + *(*uintptr)(unsafe.Add(p, 1240)) = __ccgo_fp(Xsqlite3_backup_finish) + *(*uintptr)(unsafe.Add(p, 1248)) = __ccgo_fp(Xsqlite3_backup_init) + *(*uintptr)(unsafe.Add(p, 1256)) = __ccgo_fp(Xsqlite3_backup_pagecount) + *(*uintptr)(unsafe.Add(p, 1264)) = __ccgo_fp(Xsqlite3_backup_remaining) + *(*uintptr)(unsafe.Add(p, 1272)) = __ccgo_fp(Xsqlite3_backup_step) + *(*uintptr)(unsafe.Add(p, 1280)) = __ccgo_fp(Xsqlite3_compileoption_get) + *(*uintptr)(unsafe.Add(p, 1288)) = __ccgo_fp(Xsqlite3_compileoption_used) + *(*uintptr)(unsafe.Add(p, 1296)) = __ccgo_fp(Xsqlite3_create_function_v2) + *(*uintptr)(unsafe.Add(p, 1304)) = __ccgo_fp(Xsqlite3_db_config) + *(*uintptr)(unsafe.Add(p, 1312)) = __ccgo_fp(Xsqlite3_db_mutex) + *(*uintptr)(unsafe.Add(p, 1320)) = __ccgo_fp(Xsqlite3_db_status) + *(*uintptr)(unsafe.Add(p, 1328)) = __ccgo_fp(Xsqlite3_extended_errcode) + *(*uintptr)(unsafe.Add(p, 1336)) = __ccgo_fp(Xsqlite3_log) + *(*uintptr)(unsafe.Add(p, 1344)) = __ccgo_fp(Xsqlite3_soft_heap_limit64) + *(*uintptr)(unsafe.Add(p, 1352)) = __ccgo_fp(Xsqlite3_sourceid) + *(*uintptr)(unsafe.Add(p, 1360)) = __ccgo_fp(Xsqlite3_stmt_status) + *(*uintptr)(unsafe.Add(p, 1368)) = __ccgo_fp(Xsqlite3_strnicmp) + *(*uintptr)(unsafe.Add(p, 1376)) = __ccgo_fp(Xsqlite3_unlock_notify) + *(*uintptr)(unsafe.Add(p, 1384)) = __ccgo_fp(Xsqlite3_wal_autocheckpoint) + *(*uintptr)(unsafe.Add(p, 1392)) = __ccgo_fp(Xsqlite3_wal_checkpoint) + *(*uintptr)(unsafe.Add(p, 1400)) = __ccgo_fp(Xsqlite3_wal_hook) + *(*uintptr)(unsafe.Add(p, 1408)) = __ccgo_fp(Xsqlite3_blob_reopen) + *(*uintptr)(unsafe.Add(p, 1416)) = __ccgo_fp(Xsqlite3_vtab_config) + *(*uintptr)(unsafe.Add(p, 1424)) = __ccgo_fp(Xsqlite3_vtab_on_conflict) + *(*uintptr)(unsafe.Add(p, 1432)) = __ccgo_fp(Xsqlite3_close_v2) + *(*uintptr)(unsafe.Add(p, 1440)) = __ccgo_fp(Xsqlite3_db_filename) + *(*uintptr)(unsafe.Add(p, 1448)) = __ccgo_fp(Xsqlite3_db_readonly) + *(*uintptr)(unsafe.Add(p, 1456)) = __ccgo_fp(Xsqlite3_db_release_memory) + *(*uintptr)(unsafe.Add(p, 1464)) = __ccgo_fp(Xsqlite3_errstr) + *(*uintptr)(unsafe.Add(p, 1472)) = __ccgo_fp(Xsqlite3_stmt_busy) + *(*uintptr)(unsafe.Add(p, 1480)) = __ccgo_fp(Xsqlite3_stmt_readonly) + *(*uintptr)(unsafe.Add(p, 1488)) = __ccgo_fp(Xsqlite3_stricmp) + *(*uintptr)(unsafe.Add(p, 1496)) = __ccgo_fp(Xsqlite3_uri_boolean) + *(*uintptr)(unsafe.Add(p, 1504)) = __ccgo_fp(Xsqlite3_uri_int64) + *(*uintptr)(unsafe.Add(p, 1512)) = __ccgo_fp(Xsqlite3_uri_parameter) + *(*uintptr)(unsafe.Add(p, 1520)) = __ccgo_fp(Xsqlite3_vsnprintf) + *(*uintptr)(unsafe.Add(p, 1528)) = __ccgo_fp(Xsqlite3_wal_checkpoint_v2) + *(*uintptr)(unsafe.Add(p, 1536)) = __ccgo_fp(Xsqlite3_auto_extension) + *(*uintptr)(unsafe.Add(p, 1544)) = __ccgo_fp(Xsqlite3_bind_blob64) + *(*uintptr)(unsafe.Add(p, 1552)) = __ccgo_fp(Xsqlite3_bind_text64) + *(*uintptr)(unsafe.Add(p, 1560)) = __ccgo_fp(Xsqlite3_cancel_auto_extension) + *(*uintptr)(unsafe.Add(p, 1568)) = __ccgo_fp(Xsqlite3_load_extension) + *(*uintptr)(unsafe.Add(p, 1576)) = __ccgo_fp(Xsqlite3_malloc64) + *(*uintptr)(unsafe.Add(p, 1584)) = __ccgo_fp(Xsqlite3_msize) + *(*uintptr)(unsafe.Add(p, 1592)) = __ccgo_fp(Xsqlite3_realloc64) + *(*uintptr)(unsafe.Add(p, 1600)) = __ccgo_fp(Xsqlite3_reset_auto_extension) + *(*uintptr)(unsafe.Add(p, 1608)) = __ccgo_fp(Xsqlite3_result_blob64) + *(*uintptr)(unsafe.Add(p, 1616)) = __ccgo_fp(Xsqlite3_result_text64) + *(*uintptr)(unsafe.Add(p, 1624)) = __ccgo_fp(Xsqlite3_strglob) + *(*uintptr)(unsafe.Add(p, 1632)) = __ccgo_fp(Xsqlite3_value_dup) + *(*uintptr)(unsafe.Add(p, 1640)) = __ccgo_fp(Xsqlite3_value_free) + *(*uintptr)(unsafe.Add(p, 1648)) = __ccgo_fp(Xsqlite3_result_zeroblob64) + *(*uintptr)(unsafe.Add(p, 1656)) = __ccgo_fp(Xsqlite3_bind_zeroblob64) + *(*uintptr)(unsafe.Add(p, 1664)) = __ccgo_fp(Xsqlite3_value_subtype) + *(*uintptr)(unsafe.Add(p, 1672)) = __ccgo_fp(Xsqlite3_result_subtype) + *(*uintptr)(unsafe.Add(p, 1680)) = __ccgo_fp(Xsqlite3_status64) + *(*uintptr)(unsafe.Add(p, 1688)) = __ccgo_fp(Xsqlite3_strlike) + *(*uintptr)(unsafe.Add(p, 1696)) = __ccgo_fp(Xsqlite3_db_cacheflush) + *(*uintptr)(unsafe.Add(p, 1704)) = __ccgo_fp(Xsqlite3_system_errno) + *(*uintptr)(unsafe.Add(p, 1712)) = __ccgo_fp(Xsqlite3_trace_v2) + *(*uintptr)(unsafe.Add(p, 1720)) = __ccgo_fp(Xsqlite3_expanded_sql) + *(*uintptr)(unsafe.Add(p, 1728)) = __ccgo_fp(Xsqlite3_set_last_insert_rowid) + *(*uintptr)(unsafe.Add(p, 1736)) = __ccgo_fp(Xsqlite3_prepare_v3) + *(*uintptr)(unsafe.Add(p, 1744)) = __ccgo_fp(Xsqlite3_prepare16_v3) + *(*uintptr)(unsafe.Add(p, 1752)) = __ccgo_fp(Xsqlite3_bind_pointer) + *(*uintptr)(unsafe.Add(p, 1760)) = __ccgo_fp(Xsqlite3_result_pointer) + *(*uintptr)(unsafe.Add(p, 1768)) = __ccgo_fp(Xsqlite3_value_pointer) + *(*uintptr)(unsafe.Add(p, 1776)) = __ccgo_fp(Xsqlite3_vtab_nochange) + *(*uintptr)(unsafe.Add(p, 1784)) = __ccgo_fp(Xsqlite3_value_nochange) + *(*uintptr)(unsafe.Add(p, 1792)) = __ccgo_fp(Xsqlite3_vtab_collation) + *(*uintptr)(unsafe.Add(p, 1800)) = __ccgo_fp(Xsqlite3_keyword_count) + *(*uintptr)(unsafe.Add(p, 1808)) = __ccgo_fp(Xsqlite3_keyword_name) + *(*uintptr)(unsafe.Add(p, 1816)) = __ccgo_fp(Xsqlite3_keyword_check) + *(*uintptr)(unsafe.Add(p, 1824)) = __ccgo_fp(Xsqlite3_str_new) + *(*uintptr)(unsafe.Add(p, 1832)) = __ccgo_fp(Xsqlite3_str_finish) + *(*uintptr)(unsafe.Add(p, 1840)) = __ccgo_fp(Xsqlite3_str_appendf) + *(*uintptr)(unsafe.Add(p, 1848)) = __ccgo_fp(Xsqlite3_str_vappendf) + *(*uintptr)(unsafe.Add(p, 1856)) = __ccgo_fp(Xsqlite3_str_append) + *(*uintptr)(unsafe.Add(p, 1864)) = __ccgo_fp(Xsqlite3_str_appendall) + *(*uintptr)(unsafe.Add(p, 1872)) = __ccgo_fp(Xsqlite3_str_appendchar) + *(*uintptr)(unsafe.Add(p, 1880)) = __ccgo_fp(Xsqlite3_str_reset) + *(*uintptr)(unsafe.Add(p, 1888)) = __ccgo_fp(Xsqlite3_str_errcode) + *(*uintptr)(unsafe.Add(p, 1896)) = __ccgo_fp(Xsqlite3_str_length) + *(*uintptr)(unsafe.Add(p, 1904)) = __ccgo_fp(Xsqlite3_str_value) + *(*uintptr)(unsafe.Add(p, 1912)) = __ccgo_fp(Xsqlite3_create_window_function) + *(*uintptr)(unsafe.Add(p, 1928)) = __ccgo_fp(Xsqlite3_stmt_isexplain) + *(*uintptr)(unsafe.Add(p, 1936)) = __ccgo_fp(Xsqlite3_value_frombind) + *(*uintptr)(unsafe.Add(p, 1944)) = __ccgo_fp(Xsqlite3_drop_modules) + *(*uintptr)(unsafe.Add(p, 1952)) = __ccgo_fp(Xsqlite3_hard_heap_limit64) + *(*uintptr)(unsafe.Add(p, 1960)) = __ccgo_fp(Xsqlite3_uri_key) + *(*uintptr)(unsafe.Add(p, 1968)) = __ccgo_fp(Xsqlite3_filename_database) + *(*uintptr)(unsafe.Add(p, 1976)) = __ccgo_fp(Xsqlite3_filename_journal) + *(*uintptr)(unsafe.Add(p, 1984)) = __ccgo_fp(Xsqlite3_filename_wal) + *(*uintptr)(unsafe.Add(p, 1992)) = __ccgo_fp(Xsqlite3_create_filename) + *(*uintptr)(unsafe.Add(p, 2000)) = __ccgo_fp(Xsqlite3_free_filename) + *(*uintptr)(unsafe.Add(p, 2008)) = __ccgo_fp(Xsqlite3_database_file_object) + *(*uintptr)(unsafe.Add(p, 2016)) = __ccgo_fp(Xsqlite3_txn_state) + *(*uintptr)(unsafe.Add(p, 2024)) = __ccgo_fp(Xsqlite3_changes64) + *(*uintptr)(unsafe.Add(p, 2032)) = __ccgo_fp(Xsqlite3_total_changes64) + *(*uintptr)(unsafe.Add(p, 2040)) = __ccgo_fp(Xsqlite3_autovacuum_pages) + *(*uintptr)(unsafe.Add(p, 2048)) = __ccgo_fp(Xsqlite3_error_offset) + *(*uintptr)(unsafe.Add(p, 2056)) = __ccgo_fp(Xsqlite3_vtab_rhs_value) + *(*uintptr)(unsafe.Add(p, 2064)) = __ccgo_fp(Xsqlite3_vtab_distinct) + *(*uintptr)(unsafe.Add(p, 2072)) = __ccgo_fp(Xsqlite3_vtab_in) + *(*uintptr)(unsafe.Add(p, 2080)) = __ccgo_fp(Xsqlite3_vtab_in_first) + *(*uintptr)(unsafe.Add(p, 2088)) = __ccgo_fp(Xsqlite3_vtab_in_next) + *(*uintptr)(unsafe.Add(p, 2096)) = __ccgo_fp(Xsqlite3_deserialize) + *(*uintptr)(unsafe.Add(p, 2104)) = __ccgo_fp(Xsqlite3_serialize) + *(*uintptr)(unsafe.Add(p, 2112)) = __ccgo_fp(Xsqlite3_db_name) + *(*uintptr)(unsafe.Add(p, 2120)) = __ccgo_fp(Xsqlite3_value_encoding) + *(*uintptr)(unsafe.Add(p, 2128)) = __ccgo_fp(Xsqlite3_is_interrupted) + *(*uintptr)(unsafe.Add(p, 2136)) = __ccgo_fp(Xsqlite3_stmt_explain) + *(*uintptr)(unsafe.Add(p, 2144)) = __ccgo_fp(Xsqlite3_get_clientdata) + *(*uintptr)(unsafe.Add(p, 2152)) = __ccgo_fp(Xsqlite3_set_clientdata) +} + +/* True if x is the directory separator character + */ + +// C documentation +// +// /* +// ** Attempt to load an SQLite extension library contained in the file +// ** zFile. The entry point is zProc. zProc may be 0 in which case a +// ** default entry point name (sqlite3_extension_init) is used. Use +// ** of the default name is recommended. +// ** +// ** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong. +// ** +// ** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with +// ** error message text. The calling function should free this memory +// ** by calling sqlite3DbFree(db, ). +// */ +func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aHandle, handle, pVfs, zAltEntry, zAltFile, zEntry, v1, v10, v7, v9 uintptr + var c, iEntry, iFile, ii, ncFile, rc, v5, v6, v8 int32 + var nMsg Tu64 + var xInit Tsqlite3_loadext_entry + var _ /* zErrmsg at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aHandle, c, handle, iEntry, iFile, ii, nMsg, ncFile, pVfs, rc, xInit, zAltEntry, zAltFile, zEntry, v1, v10, v5, v6, v7, v8, v9 + pVfs = (*Tsqlite3)(unsafe.Pointer(db)).FpVfs + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + zAltEntry = uintptr(0) + nMsg = libc.Xstrlen(tls, zFile) + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) + } + /* Ticket #1863. To avoid a creating security problems for older + ** applications that relink against newer versions of SQLite, the + ** ability to run load_extension is turned off by default. One + ** must call either sqlite3_enable_load_extension(db) or + ** sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0) + ** to turn on extension loading. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_LoadExtension) == uint64(0) { + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+12452, 0) + } + return int32(SQLITE_ERROR) + } + if zProc != 0 { + v1 = zProc + } else { + v1 = __ccgo_ts + 16350 + } + zEntry = v1 + /* tag-20210611-1. Some dlopen() implementations will segfault if given + ** an oversize filename. Most filesystems have a pathname limit of 4K, + ** so limit the extension filename length to about twice that. + ** https://sqlite.org/forum/forumpost/08a0d6d9bf + ** + ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix. + ** See https://sqlite.org/forum/forumpost/24083b579d. + */ + if nMsg > uint64(FILENAME_MAX) { + goto extension_not_found + } + /* Do not allow sqlite3_load_extension() to link to a copy of the + ** running application, by passing in an empty filename. */ + if nMsg == uint64(0) { + goto extension_not_found + } + handle = _sqlite3OsDlOpen(tls, pVfs, zFile) + ii = 0 + for { + if !(ii < int32(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(8)) && handle == uintptr(0)) { + break + } + zAltFile = Xsqlite3_mprintf(tls, __ccgo_ts+12413, libc.VaList(bp+16, zFile, _azEndings[ii])) + if zAltFile == uintptr(0) { + return int32(SQLITE_NOMEM) + } + if nMsg+libc.Xstrlen(tls, _azEndings[ii])+uint64(1) <= uint64(FILENAME_MAX) { + handle = _sqlite3OsDlOpen(tls, pVfs, zAltFile) + } + Xsqlite3_free(tls, zAltFile) + goto _2 + _2: + ; + ii++ + } + if handle == uintptr(0) { + goto extension_not_found + } + xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) + /* If no entry point was specified and the default legacy + ** entry point name "sqlite3_extension_init" was not found, then + ** construct an entry point name "sqlite3_X_init" where the X is + ** replaced by the lowercase value of every ASCII alphabetic + ** character in the filename after the last "/" upto the first ".", + ** and eliding the first three characters if they are "lib". + ** Examples: + ** + ** /usr/local/lib/libExample5.4.3.so ==> sqlite3_example_init + ** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init + */ + if xInit == uintptr(0) && zProc == uintptr(0) { + ncFile = _sqlite3Strlen30(tls, zFile) + zAltEntry = Xsqlite3_malloc64(tls, uint64(ncFile+int32(30))) + if zAltEntry == uintptr(0) { + _sqlite3OsDlClose(tls, pVfs, handle) + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, zAltEntry, __ccgo_ts+16373, uint64(8)) + iFile = ncFile - int32(1) + for { + if !(iFile >= 0 && !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) == libc.Int32FromUint8('/'))) { + break + } + goto _3 + _3: + ; + iFile-- + } + iFile++ + if Xsqlite3_strnicmp(tls, zFile+uintptr(iFile), __ccgo_ts+16382, int32(3)) == 0 { + iFile += int32(3) + } + iEntry = int32(8) + for { + v5 = int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))) + c = v5 + if !(v5 != 0 && c != int32('.')) { + break + } + if int32(_sqlite3CtypeMap[uint8(c)])&int32(0x02) != 0 { + v6 = iEntry + iEntry++ + *(*int8)(unsafe.Pointer(zAltEntry + uintptr(v6))) = int8(_sqlite3UpperToLower[uint32(c)]) + } + goto _4 + _4: + ; + iFile++ + } + libc.Xmemcpy(tls, zAltEntry+uintptr(iEntry), __ccgo_ts+16386, uint64(6)) + zEntry = zAltEntry + xInit = _sqlite3OsDlSym(tls, pVfs, handle, zEntry) + } + if xInit == uintptr(0) { + if pzErrMsg != 0 { + nMsg += libc.Xstrlen(tls, zEntry) + uint64(300) + v7 = Xsqlite3_malloc64(tls, nMsg) + *(*uintptr)(unsafe.Pointer(bp)) = v7 + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + /* zErrmsg would be NULL if not so */ + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16392, libc.VaList(bp+16, zEntry, zFile)) + _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) + } + } + _sqlite3OsDlClose(tls, pVfs, handle) + Xsqlite3_free(tls, zAltEntry) + return int32(SQLITE_ERROR) + } + Xsqlite3_free(tls, zAltEntry) + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xInit})))(tls, db, bp, uintptr(unsafe.Pointer(&_sqlite3Apis))) + if rc != 0 { + if rc == libc.Int32FromInt32(SQLITE_OK)|libc.Int32FromInt32(1)<aExtension array. */ + aHandle = _sqlite3DbMallocZero(tls, db, uint64(8)*uint64((*Tsqlite3)(unsafe.Pointer(db)).FnExtension+libc.Int32FromInt32(1))) + if aHandle == uintptr(0) { + return int32(SQLITE_NOMEM) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FnExtension > 0 { + libc.Xmemcpy(tls, aHandle, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension, uint64(8)*uint64((*Tsqlite3)(unsafe.Pointer(db)).FnExtension)) + } + _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) + (*Tsqlite3)(unsafe.Pointer(db)).FaExtension = aHandle + v9 = db + 236 + v8 = *(*int32)(unsafe.Pointer(v9)) + *(*int32)(unsafe.Pointer(v9))++ + *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(v8)*8)) = handle + return SQLITE_OK +extension_not_found: + ; + if pzErrMsg != 0 { + nMsg += uint64(300) + v10 = Xsqlite3_malloc64(tls, nMsg) + *(*uintptr)(unsafe.Pointer(bp)) = v10 + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v10 + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + /* zErrmsg would be NULL if not so */ + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+16467, libc.VaList(bp+16, int32(FILENAME_MAX), zFile)) + _sqlite3OsDlError(tls, pVfs, int32(nMsg-uint64(1)), *(*uintptr)(unsafe.Pointer(bp))) + } + } + return int32(SQLITE_ERROR) +} + +/* Shared library endings to try if zFile cannot be loaded as written */ +var _azEndings = [1]uintptr{ + 0: __ccgo_ts + 16347, +} + +func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) (r int32) { + var rc int32 + _ = rc + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + rc = _sqlite3LoadExtension(tls, db, zFile, zProc, pzErrMsg) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Call this routine when the database connection is closing in order +// ** to clean up loaded extensions +// */ +func _sqlite3CloseExtensions(tls *libc.TLS, db uintptr) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnExtension) { + break + } + _sqlite3OsDlClose(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + _sqlite3DbFree(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaExtension) +} + +// C documentation +// +// /* +// ** Enable or disable extension loading. Extension loading is disabled by +// ** default so as not to open security holes in older applications. +// */ +func Xsqlite3_enable_load_extension(tls *libc.TLS, db uintptr, onoff int32) (r int32) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if onoff != 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(libc.Int32FromInt32(SQLITE_LoadExtension) | libc.Int32FromInt32(SQLITE_LoadExtFunc)) + } else { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^uint64(libc.Int32FromInt32(SQLITE_LoadExtension) | libc.Int32FromInt32(SQLITE_LoadExtFunc)) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The following object holds the list of automatically loaded +// ** extensions. +// ** +// ** This list is shared across threads. The SQLITE_MUTEX_STATIC_MAIN +// ** mutex must be held while accessing this list. +// */ +type Tsqlite3AutoExtList = struct { + FnExt Tu32 + FaExt uintptr +} + +type sqlite3AutoExtList = Tsqlite3AutoExtList + +type Tsqlite3AutoExtList1 = struct { + FnExt Tu32 + FaExt uintptr +} + +type sqlite3AutoExtList1 = Tsqlite3AutoExtList1 + +var _sqlite3Autoext = Tsqlite3AutoExtList1{} + +/* The "wsdAutoext" macro will resolve to the autoextension +** state vector. If writable static data is unsupported on the target, +** we have to locate the state vector at run-time. In the more common +** case where writable static data is supported, wsdStat can refer directly +** to the "sqlite3Autoext" state vector declared above. + */ + +// C documentation +// +// /* +// ** Register a statically linked extension that is automatically +// ** loaded by every new database connection. +// */ +func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { + var aNew, mutex uintptr + var i Tu32 + var nByte Tu64 + var rc int32 + _, _, _, _, _ = aNew, i, mutex, nByte, rc + rc = SQLITE_OK + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } else { + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + i = uint32(0) + for { + if !(i < _sqlite3Autoext.FnExt) { + break + } + if *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(i)*8)) == xInit { + break + } + goto _1 + _1: + ; + i++ + } + if i == _sqlite3Autoext.FnExt { + nByte = uint64(_sqlite3Autoext.FnExt+libc.Uint32FromInt32(1)) * uint64(8) + aNew = Xsqlite3_realloc64(tls, _sqlite3Autoext.FaExt, nByte) + if aNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + _sqlite3Autoext.FaExt = aNew + *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(_sqlite3Autoext.FnExt)*8)) = xInit + _sqlite3Autoext.FnExt++ + } + } + Xsqlite3_mutex_leave(tls, mutex) + return rc + } + return r +} + +// C documentation +// +// /* +// ** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the +// ** set of routines that is invoked for each new database connection, if it +// ** is currently on the list. If xInit is not on the list, then this +// ** routine is a no-op. +// ** +// ** Return 1 if xInit was found on the list and removed. Return 0 if xInit +// ** was not on the list. +// */ +func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) (r int32) { + var i, n int32 + var mutex uintptr + _, _, _ = i, mutex, n + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + n = 0 + Xsqlite3_mutex_enter(tls, mutex) + i = int32(_sqlite3Autoext.FnExt) - int32(1) + for { + if !(i >= 0) { + break + } + if *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(i)*8)) == xInit { + _sqlite3Autoext.FnExt-- + *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(_sqlite3Autoext.FnExt)*8)) + n++ + break + } + goto _1 + _1: + ; + i-- + } + Xsqlite3_mutex_leave(tls, mutex) + return n +} + +// C documentation +// +// /* +// ** Reset the automatic extension loading mechanism. +// */ +func Xsqlite3_reset_auto_extension(tls *libc.TLS) { + var mutex uintptr + _ = mutex + if Xsqlite3_initialize(tls) == SQLITE_OK { + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, mutex) + Xsqlite3_free(tls, _sqlite3Autoext.FaExt) + _sqlite3Autoext.FaExt = uintptr(0) + _sqlite3Autoext.FnExt = uint32(0) + Xsqlite3_mutex_leave(tls, mutex) + } +} + +// C documentation +// +// /* +// ** Load all automatic extensions. +// ** +// ** If anything goes wrong, set an error in the database connection. +// */ +func _sqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var go1, rc, v2 int32 + var i Tu32 + var mutex, pThunk uintptr + var xInit Tsqlite3_loadext_entry + var v3 bool + var _ /* zErrmsg at bp+0 */ uintptr + _, _, _, _, _, _, _, _ = go1, i, mutex, pThunk, rc, xInit, v2, v3 + go1 = int32(1) + if _sqlite3Autoext.FnExt == uint32(0) { + /* Common case: early out without every having to acquire a mutex */ + return + } + i = uint32(0) + for { + if !(go1 != 0) { + break + } + mutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + pThunk = uintptr(unsafe.Pointer(&_sqlite3Apis)) + Xsqlite3_mutex_enter(tls, mutex) + if i >= _sqlite3Autoext.FnExt { + xInit = uintptr(0) + go1 = 0 + } else { + xInit = *(*uintptr)(unsafe.Pointer(_sqlite3Autoext.FaExt + uintptr(i)*8)) + } + Xsqlite3_mutex_leave(tls, mutex) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if v3 = xInit != 0; v3 { + v2 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xInit})))(tls, db, bp, pThunk) + rc = v2 + } + if v3 && v2 != 0 { + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+16504, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + go1 = 0 + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + goto _1 + _1: + ; + i++ + } +} + +/************** End of loadext.c *********************************************/ +/************** Begin file pragma.c ******************************************/ +/* +** 2003 April 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to implement the PRAGMA command. + */ +/* #include "sqliteInt.h" */ + +/*************************************************************************** +** The "pragma.h" include file is an automatically generated file that +** that includes the PragType_XXXX macro definitions and the aPragmaName[] +** object. This ensures that the aPragmaName[] table is arranged in +** lexicographical order to facility a binary search of the pragma name. +** Do not edit pragma.h directly. Edit and rerun the script in at +** ../tool/mkpragmatab.tcl. */ +/************** Include pragma.h in the middle of pragma.c *******************/ +/************** Begin file pragma.h ******************************************/ +/* DO NOT EDIT! +** This file is automatically generated by the script at +** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit +** that script and rerun it. + */ + +/* The various pragma types */ + +/* Property flags associated with various pragma. */ + +// C documentation +// +// /* Names of columns for pragmas that return multi-column result +// ** or that return single-column results where the name of the +// ** result column is different from the name of the pragma +// */ +var _pragCName = [57]uintptr{ + 0: __ccgo_ts + 5513, + 1: __ccgo_ts + 16543, + 2: __ccgo_ts + 9090, + 3: __ccgo_ts + 16547, + 4: __ccgo_ts + 16552, + 5: __ccgo_ts + 16555, + 6: __ccgo_ts + 16565, + 7: __ccgo_ts + 16575, + 8: __ccgo_ts + 16581, + 9: __ccgo_ts + 16585, + 10: __ccgo_ts + 16590, + 11: __ccgo_ts + 16595, + 12: __ccgo_ts + 16603, + 13: __ccgo_ts + 16614, + 14: __ccgo_ts + 16617, + 15: __ccgo_ts + 16624, + 16: __ccgo_ts + 16585, + 17: __ccgo_ts + 16590, + 18: __ccgo_ts + 16631, + 19: __ccgo_ts + 16636, + 20: __ccgo_ts + 16639, + 21: __ccgo_ts + 16646, + 22: __ccgo_ts + 16581, + 23: __ccgo_ts + 16585, + 24: __ccgo_ts + 16652, + 25: __ccgo_ts + 16657, + 26: __ccgo_ts + 16662, + 27: __ccgo_ts + 16585, + 28: __ccgo_ts + 16666, + 29: __ccgo_ts + 16590, + 30: __ccgo_ts + 16674, + 31: __ccgo_ts + 16678, + 32: __ccgo_ts + 16683, + 33: __ccgo_ts + 11829, + 34: __ccgo_ts + 11825, + 35: __ccgo_ts + 16689, + 36: __ccgo_ts + 16694, + 37: __ccgo_ts + 16699, + 38: __ccgo_ts + 16543, + 39: __ccgo_ts + 16585, + 40: __ccgo_ts + 16704, + 41: __ccgo_ts + 16711, + 42: __ccgo_ts + 16718, + 43: __ccgo_ts + 9090, + 44: __ccgo_ts + 16726, + 45: __ccgo_ts + 5516, + 46: __ccgo_ts + 16732, + 47: __ccgo_ts + 16543, + 48: __ccgo_ts + 16585, + 49: __ccgo_ts + 16737, + 50: __ccgo_ts + 16742, + 51: __ccgo_ts + 15939, + 52: __ccgo_ts + 16747, + 53: __ccgo_ts + 16760, + 54: __ccgo_ts + 16769, + 55: __ccgo_ts + 16776, + 56: __ccgo_ts + 16787, +} + +// C documentation +// +// /* Definitions of all built-in pragmas */ +type TPragmaName = struct { + FzName uintptr + FePragTyp Tu8 + FmPragFlg Tu8 + FiPragCName Tu8 + FnPragCName Tu8 + FiArg Tu64 +} + +type PragmaName = TPragmaName + +var _aPragmaName = [66]TPragmaName{ + 0: { + FzName: __ccgo_ts + 16795, + FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), + FmPragFlg: uint8(PragFlg_Result0), + }, + 1: { + FzName: __ccgo_ts + 16810, + FePragTyp: uint8(PragTyp_HEADER_VALUE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), + FiArg: uint64(BTREE_APPLICATION_ID), + }, + 2: { + FzName: __ccgo_ts + 16825, + FePragTyp: uint8(PragTyp_AUTO_VACUUM), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 3: { + FzName: __ccgo_ts + 16837, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_AutoIndex), + }, + 4: { + FzName: __ccgo_ts + 16853, + FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(56), + FnPragCName: uint8(1), + }, + 5: { + FzName: __ccgo_ts + 16776, + FePragTyp: uint8(PragTyp_CACHE_SIZE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 6: { + FzName: __ccgo_ts + 16866, + FePragTyp: uint8(PragTyp_CACHE_SPILL), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 7: { + FzName: __ccgo_ts + 16878, + FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), + FmPragFlg: uint8(PragFlg_NoColumns), + }, + 8: { + FzName: __ccgo_ts + 16898, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_CellSizeCk), + }, + 9: { + FzName: __ccgo_ts + 16914, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_CkptFullFSync), + }, + 10: { + FzName: __ccgo_ts + 16935, + FePragTyp: uint8(PragTyp_COLLATION_LIST), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(38), + FnPragCName: uint8(2), + }, + 11: { + FzName: __ccgo_ts + 16950, + FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), + FmPragFlg: uint8(PragFlg_Result0), + }, + 12: { + FzName: __ccgo_ts + 16966, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), + }, + 13: { + FzName: __ccgo_ts + 16980, + FePragTyp: uint8(PragTyp_HEADER_VALUE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), + FiArg: uint64(BTREE_DATA_VERSION), + }, + 14: { + FzName: __ccgo_ts + 16993, + FePragTyp: uint8(PragTyp_DATABASE_LIST), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(47), + FnPragCName: uint8(3), + }, + 15: { + FzName: __ccgo_ts + 17007, + FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiPragCName: uint8(55), + FnPragCName: uint8(1), + }, + 16: { + FzName: __ccgo_ts + 17026, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_DeferFKs), + }, + 17: { + FzName: __ccgo_ts + 17045, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_NullCallback), + }, + 18: { + FzName: __ccgo_ts + 17068, + FePragTyp: uint8(PragTyp_ENCODING), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 19: { + FzName: __ccgo_ts + 17077, + FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(43), + FnPragCName: uint8(4), + }, + 20: { + FzName: __ccgo_ts + 17095, + FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FnPragCName: uint8(8), + }, + 21: { + FzName: __ccgo_ts + 17112, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_ForeignKeys), + }, + 22: { + FzName: __ccgo_ts + 17125, + FePragTyp: uint8(PragTyp_HEADER_VALUE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), + }, + 23: { + FzName: __ccgo_ts + 17140, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_FullColNames), + }, + 24: { + FzName: __ccgo_ts + 17158, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_FullFSync), + }, + 25: { + FzName: __ccgo_ts + 17168, + FePragTyp: uint8(PragTyp_FUNCTION_LIST), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(27), + FnPragCName: uint8(6), + }, + 26: { + FzName: __ccgo_ts + 17182, + FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), + FmPragFlg: uint8(PragFlg_Result0), + }, + 27: { + FzName: __ccgo_ts + 17198, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_IgnoreChecks), + }, + 28: { + FzName: __ccgo_ts + 17223, + FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), + }, + 29: { + FzName: __ccgo_ts + 17242, + FePragTyp: uint8(PragTyp_INDEX_INFO), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(21), + FnPragCName: uint8(3), + }, + 30: { + FzName: __ccgo_ts + 17253, + FePragTyp: uint8(PragTyp_INDEX_LIST), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(38), + FnPragCName: uint8(5), + }, + 31: { + FzName: __ccgo_ts + 17264, + FePragTyp: uint8(PragTyp_INDEX_INFO), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(21), + FnPragCName: uint8(6), + FiArg: uint64(1), + }, + 32: { + FzName: __ccgo_ts + 17276, + FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + }, + 33: { + FzName: __ccgo_ts + 17292, + FePragTyp: uint8(PragTyp_JOURNAL_MODE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), + }, + 34: { + FzName: __ccgo_ts + 17305, + FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), + }, + 35: { + FzName: __ccgo_ts + 17324, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_LegacyAlter), + }, + 36: { + FzName: __ccgo_ts + 17343, + FePragTyp: uint8(PragTyp_LOCKING_MODE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), + }, + 37: { + FzName: __ccgo_ts + 17356, + FePragTyp: uint8(PragTyp_PAGE_COUNT), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), + }, + 38: { + FzName: __ccgo_ts + 17371, + FePragTyp: uint8(PragTyp_MMAP_SIZE), + }, + 39: { + FzName: __ccgo_ts + 17381, + FePragTyp: uint8(PragTyp_MODULE_LIST), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(9), + FnPragCName: uint8(1), + }, + 40: { + FzName: __ccgo_ts + 17393, + FePragTyp: uint8(PragTyp_OPTIMIZE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), + }, + 41: { + FzName: __ccgo_ts + 17402, + FePragTyp: uint8(PragTyp_PAGE_COUNT), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), + }, + 42: { + FzName: __ccgo_ts + 17413, + FePragTyp: uint8(PragTyp_PAGE_SIZE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 43: { + FzName: __ccgo_ts + 17423, + FePragTyp: uint8(PragTyp_PRAGMA_LIST), + FmPragFlg: uint8(PragFlg_Result0), + FiPragCName: uint8(9), + FnPragCName: uint8(1), + }, + 44: { + FzName: __ccgo_ts + 17435, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_QueryOnly), + }, + 45: { + FzName: __ccgo_ts + 17446, + FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + }, + 46: { + FzName: __ccgo_ts + 17458, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), + }, + 47: { + FzName: __ccgo_ts + 17475, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_RecTriggers), + }, + 48: { + FzName: __ccgo_ts + 17494, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_ReverseOrder), + }, + 49: { + FzName: __ccgo_ts + 17520, + FePragTyp: uint8(PragTyp_HEADER_VALUE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), + FiArg: uint64(BTREE_SCHEMA_VERSION), + }, + 50: { + FzName: __ccgo_ts + 17535, + FePragTyp: uint8(PragTyp_SECURE_DELETE), + FmPragFlg: uint8(PragFlg_Result0), + }, + 51: { + FzName: __ccgo_ts + 17549, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_ShortColNames), + }, + 52: { + FzName: __ccgo_ts + 17568, + FePragTyp: uint8(PragTyp_SHRINK_MEMORY), + FmPragFlg: uint8(PragFlg_NoColumns), + }, + 53: { + FzName: __ccgo_ts + 17582, + FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), + FmPragFlg: uint8(PragFlg_Result0), + }, + 54: { + FzName: __ccgo_ts + 17598, + FePragTyp: uint8(PragTyp_SYNCHRONOUS), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 55: { + FzName: __ccgo_ts + 17610, + FePragTyp: uint8(PragTyp_TABLE_INFO), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(8), + FnPragCName: uint8(6), + }, + 56: { + FzName: __ccgo_ts + 17621, + FePragTyp: uint8(PragTyp_TABLE_LIST), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), + FiPragCName: uint8(15), + FnPragCName: uint8(6), + }, + 57: { + FzName: __ccgo_ts + 17632, + FePragTyp: uint8(PragTyp_TABLE_INFO), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), + FiPragCName: uint8(8), + FnPragCName: uint8(7), + FiArg: uint64(1), + }, + 58: { + FzName: __ccgo_ts + 17644, + FePragTyp: uint8(PragTyp_TEMP_STORE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + }, + 59: { + FzName: __ccgo_ts + 17655, + FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), + FmPragFlg: uint8(PragFlg_NoColumns1), + }, + 60: { + FzName: __ccgo_ts + 17676, + FePragTyp: uint8(PragTyp_THREADS), + FmPragFlg: uint8(PragFlg_Result0), + }, + 61: { + FzName: __ccgo_ts + 17684, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(SQLITE_TrustedSchema), + }, + 62: { + FzName: __ccgo_ts + 17699, + FePragTyp: uint8(PragTyp_HEADER_VALUE), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), + FiArg: uint64(BTREE_USER_VERSION), + }, + 63: { + FzName: __ccgo_ts + 17712, + FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), + }, + 64: { + FzName: __ccgo_ts + 17731, + FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), + FmPragFlg: uint8(PragFlg_NeedSchema), + FiPragCName: uint8(50), + FnPragCName: uint8(3), + }, + 65: { + FzName: __ccgo_ts + 17746, + FePragTyp: uint8(PragTyp_FLAG), + FmPragFlg: uint8(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), + FiArg: uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), + }, +} + +/* Number of pragmas: 68 on by default, 78 total. */ + +/************** End of pragma.h **********************************************/ +/************** Continuing where we left off in pragma.c *********************/ + +// C documentation +// +// /* +// ** Interpret the given string as a safety level. Return 0 for OFF, +// ** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or +// ** unrecognized string argument. The FULL and EXTRA option is disallowed +// ** if the omitFull parameter it 1. +// ** +// ** Note that the values returned are one less that the values that +// ** should be passed into sqlite3BtreeSetSafetyLevel(). The is done +// ** to support legacy SQL code. The safety level used to be boolean +// ** and older scripts may have used numbers 0 for OFF and 1 for ON. +// */ +func _getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt Tu8) (r Tu8) { + var i, n int32 + _, _ = i, n + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&int32(0x04) != 0 { + return uint8(_sqlite3Atoi(tls, z)) + } + n = _sqlite3Strlen30(tls, z) + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1))) { + break + } + if int32(_iLength[i]) == n && Xsqlite3_strnicmp(tls, uintptr(unsafe.Pointer(&_zText))+uintptr(_iOffset[i]), z, n) == 0 && (!(omitFull != 0) || int32(_iValue[i]) <= int32(1)) { + return _iValue[i] + } + goto _1 + _1: + ; + i++ + } + return dflt +} + +/* 123456789 123456789 123 */ +var _zText = [25]int8{'o', 'n', 'o', 'f', 'f', 'a', 'l', 's', 'e', 'y', 'e', 's', 't', 'r', 'u', 'e', 'x', 't', 'r', 'a', 'f', 'u', 'l', 'l'} + +var _iOffset = [8]Tu8{ + 1: uint8(1), + 2: uint8(2), + 3: uint8(4), + 4: uint8(9), + 5: uint8(12), + 6: uint8(15), + 7: uint8(20), +} + +var _iLength = [8]Tu8{ + 0: uint8(2), + 1: uint8(2), + 2: uint8(3), + 3: uint8(5), + 4: uint8(3), + 5: uint8(4), + 6: uint8(5), + 7: uint8(4), +} + +var _iValue = [8]Tu8{ + 0: uint8(1), + 4: uint8(1), + 5: uint8(1), + 6: uint8(3), + 7: uint8(2), +} + +// C documentation +// +// /* +// ** Interpret the given string as a boolean value. +// */ +func _sqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt Tu8) (r Tu8) { + return libc.BoolUint8(int32(_getSafetyLevel(tls, z, int32(1), dflt)) != 0) +} + +/* The sqlite3GetBoolean() function is used by other modules but the +** remainder of this file is specific to PRAGMA processing. So omit +** the rest of the file if PRAGMAs are omitted from the build. + */ + +// C documentation +// +// /* +// ** Interpret the given string as a locking mode value. +// */ +func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { + if z != 0 { + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17762) { + return int32(PAGER_LOCKINGMODE_EXCLUSIVE) + } + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17772) { + return PAGER_LOCKINGMODE_NORMAL + } + } + return -int32(1) +} + +// C documentation +// +// /* +// ** Interpret the given string as an auto-vacuum mode value. +// ** +// ** The following strings, "none", "full" and "incremental" are +// ** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. +// */ +func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { + var i, v1 int32 + _, _ = i, v1 + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8250) { + return BTREE_AUTOVACUUM_NONE + } + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17779) { + return int32(BTREE_AUTOVACUUM_FULL) + } + if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+17784) { + return int32(BTREE_AUTOVACUUM_INCR) + } + i = _sqlite3Atoi(tls, z) + if i >= 0 && i <= int32(2) { + v1 = i + } else { + v1 = 0 + } + return int32(uint8(v1)) +} + +// C documentation +// +// /* +// ** Interpret the given string as a temp db location. Return 1 for file +// ** backed temporary databases, 2 for the Red-Black tree in memory database +// ** and 0 to use the compile-time default. +// */ +func _getTempStore(tls *libc.TLS, z uintptr) (r int32) { + if int32(*(*int8)(unsafe.Pointer(z))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(z))) <= int32('2') { + return int32(*(*int8)(unsafe.Pointer(z))) - int32('0') + } else { + if _sqlite3StrICmp(tls, z, __ccgo_ts+16737) == 0 { + return int32(1) + } else { + if _sqlite3StrICmp(tls, z, __ccgo_ts+17796) == 0 { + return int32(2) + } else { + return 0 + } + } + } + return r +} + +// C documentation +// +// /* +// ** Invalidate temp storage, either when the temp storage is changed +// ** from default, or when 'file' and the temp_store_directory has changed +// */ +func _invalidateTempStorage(tls *libc.TLS, pParse uintptr) (r int32) { + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt != uintptr(0) { + if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) || _sqlite3BtreeTxnState(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) != SQLITE_TXN_NONE { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17803, 0) + return int32(SQLITE_ERROR) + } + _sqlite3BtreeClose(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt) + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpBt = uintptr(0) + _sqlite3ResetAllSchemasOfConnection(tls, db) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If the TEMP database is open, close it and mark the database schema +// ** as needing reloading. This must be done when using the SQLITE_TEMP_STORE +// ** or DEFAULT_TEMP_STORE pragmas. +// */ +func _changeTempStorage(tls *libc.TLS, pParse uintptr, zStorageType uintptr) (r int32) { + var db uintptr + var ts int32 + _, _ = db, ts + ts = _getTempStore(tls, zStorageType) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if int32((*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store) == ts { + return SQLITE_OK + } + if _invalidateTempStorage(tls, pParse) != SQLITE_OK { + return int32(SQLITE_ERROR) + } + (*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store = uint8(ts) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Set result column names for a pragma. +// */ +func _setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { + var i, j, v1 int32 + var n Tu8 + _, _, _, _ = i, j, n, v1 + n = (*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName + if int32(n) == 0 { + v1 = int32(1) + } else { + v1 = int32(n) + } + _sqlite3VdbeSetNumCols(tls, v, v1) + if int32(n) == 0 { + _sqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName, libc.UintptrFromInt32(0)) + } else { + i = 0 + j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) + for { + if !(i < int32(n)) { + break + } + _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, _pragCName[j], libc.UintptrFromInt32(0)) + goto _2 + _2: + ; + i++ + j++ + } + } +} + +// C documentation +// +// /* +// ** Generate code to return a single integer value. +// */ +func _returnSingleInt(tls *libc.TLS, v uintptr, _value Ti64) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*Ti64)(unsafe.Pointer(bp)) = _value + _sqlite3VdbeAddOp4Dup8(tls, v, int32(OP_Int64), 0, int32(1), 0, bp, -int32(13)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) +} + +// C documentation +// +// /* +// ** Generate code to return a single text value. +// */ +func _returnSingleText(tls *libc.TLS, v uintptr, zValue uintptr) { + if zValue != 0 { + _sqlite3VdbeLoadString(tls, v, int32(1), zValue) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) + } +} + +// C documentation +// +// /* +// ** Set the safety_level and pager flags for pager iDb. Or if iDb<0 +// ** set these values for all pagers. +// */ +func _setAllPagerFlags(tls *libc.TLS, db uintptr) { + var n, v1 int32 + var pDb uintptr + _, _, _ = n, pDb, v1 + if (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + n = (*Tsqlite3)(unsafe.Pointer(db)).FnDb + for { + v1 = n + n-- + if !(v1 > 0) { + break + } + if (*TDb)(unsafe.Pointer(pDb)).FpBt != 0 { + _sqlite3BtreeSetPagerFlags(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, uint32(uint64((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)|(*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(PAGER_FLAGS_MASK))) + } + pDb += 32 + } + } +} + +// C documentation +// +// /* +// ** Return a human-readable name for a constraint resolution action. +// */ +func _actionName(tls *libc.TLS, action Tu8) (r uintptr) { + var zName uintptr + _ = zName + switch int32(action) { + case int32(OE_SetNull): + zName = __ccgo_ts + 17865 + case int32(OE_SetDflt): + zName = __ccgo_ts + 17874 + case int32(OE_Cascade): + zName = __ccgo_ts + 17886 + case int32(OE_Restrict): + zName = __ccgo_ts + 17894 + default: + zName = __ccgo_ts + 17903 + break + } + return zName +} + +// C documentation +// +// /* +// ** Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants +// ** defined in pager.h. This function returns the associated lowercase +// ** journal-mode name. +// */ +func _sqlite3JournalModename(tls *libc.TLS, eMode int32) (r uintptr) { + if eMode == int32(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8)) { + return uintptr(0) + } + return _azModeName[eMode] +} + +var _azModeName = [6]uintptr{ + 0: __ccgo_ts + 17913, + 1: __ccgo_ts + 17920, + 2: __ccgo_ts + 17928, + 3: __ccgo_ts + 17932, + 4: __ccgo_ts + 17796, + 5: __ccgo_ts + 17941, +} + +// C documentation +// +// /* +// ** Locate a pragma in the aPragmaName[] array. +// */ +func _pragmaLocate(tls *libc.TLS, zName uintptr) (r uintptr) { + var lwr, mid, rc, upr int32 + var v1 uintptr + _, _, _, _, _ = lwr, mid, rc, upr, v1 + mid = 0 + lwr = 0 + upr = int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24)) - libc.Int32FromInt32(1) + for lwr <= upr { + mid = (lwr + upr) / int32(2) + rc = Xsqlite3_stricmp(tls, zName, _aPragmaName[mid].FzName) + if rc == 0 { + break + } + if rc < 0 { + upr = mid - int32(1) + } else { + lwr = mid + int32(1) + } + } + if lwr > upr { + v1 = uintptr(0) + } else { + v1 = uintptr(unsafe.Pointer(&_aPragmaName)) + uintptr(mid)*24 + } + return v1 +} + +// C documentation +// +// /* +// ** Create zero or more entries in the output for the SQL functions +// ** defined by FuncDef p. +// */ +func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, showInternFuncs int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var mask Tu32 + var zType uintptr + _, _ = mask, zType + mask = uint32(libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL)) + if showInternFuncs != 0 { + mask = uint32(0xffffffff) + } + for { + if !(p != 0) { + break + } + if (*TFuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { + goto _1 + } + if (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_INTERNAL) != uint32(0) && showInternFuncs == 0 { + goto _1 + } + if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { + zType = __ccgo_ts + 17966 + } else { + if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { + zType = __ccgo_ts + 17968 + } else { + zType = __ccgo_ts + 7649 + } + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+17970, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) + goto _1 + _1: + ; + p = (*TFuncDef)(unsafe.Pointer(p)).FpNext + } +} + +var _azEnc = [4]uintptr{ + 1: __ccgo_ts + 17945, + 2: __ccgo_ts + 17950, + 3: __ccgo_ts + 17958, +} + +// C documentation +// +// /* +// ** Helper subroutine for PRAGMA integrity_check: +// ** +// ** Generate code to output a single-column result row with a value of the +// ** string held in register 3. Decrement the result count in register 1 +// ** and halt if the maximum number of result rows have been issued. +// */ +func _integrityCheckResultRow(tls *libc.TLS, v uintptr) (r int32) { + var addr int32 + _ = addr + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(3), int32(1)) + addr = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfPos), int32(1), _sqlite3VdbeCurrentAddr(tls, v)+int32(2), int32(1)) + _sqlite3VdbeAddOp0(tls, v, int32(OP_Halt)) + return addr +} + +// C documentation +// +// /* +// ** Process a pragma statement. +// ** +// ** Pragmas are of this form: +// ** +// ** PRAGMA [schema.]id [= value] +// ** +// ** The identifier might also be a string. The value is a string, and +// ** identifier, or a number. If minusFlag is true, then the value is +// ** a number that was preceded by a minus sign. +// ** +// ** If the left side is "database.id" then pId1 is the database name +// ** and pId2 is the id. If the left side is just "id" then pId1 is the +// ** id and pId2 is any empty string. +// */ +func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { + bp := tls.Alloc(240) + defer tls.Free(240) + var a1, a11, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, b, bStrict, ckUniq, cnt, doTypeCheck, eAuto, eMode, eMode1, eMode2, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k3, kk, label6, labelError, labelOk, loopTop, mx, mxCol, mxIdx, n, nHidden, nIdx, p11, p3, p4, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, uniqOk, x1, v10, v15, v18, v2, v26, v33, v38, v4, v43, v45, v47, v60, v62, v63, v64, v65, v68 int32 + var aOp, aOp1, aOp2, aOp3, aOp4, aRoot, db, j, j1, k1, k2, k4, p, p1, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, v, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v14, v16, v22, v34, v39, v5, v61, v66, v8 uintptr + var azOrigin [3]uintptr + var cnum Ti16 + var enc Tu8 + var iPrior Tsqlite3_int64 + var mask Tu64 + var opMask Tu32 + var szThreshold TLogEst + var _ /* N at bp+136 */ Tsqlite3_int64 + var _ /* N at bp+144 */ Tsqlite3_int64 + var _ /* N at bp+152 */ Tsqlite3_int64 + var _ /* N at bp+160 */ Tsqlite3_int64 + var _ /* aFcntl at bp+8 */ [4]uintptr + var _ /* aiCols at bp+96 */ uintptr + var _ /* iDataCur at bp+108 */ int32 + var _ /* iIdxCur at bp+112 */ int32 + var _ /* iLimit at bp+48 */ Ti64 + var _ /* iLimit at bp+56 */ int32 + var _ /* jmp3 at bp+128 */ int32 + var _ /* mxErr at bp+104 */ int32 + var _ /* pDfltValue at bp+120 */ uintptr + var _ /* pDummy at bp+80 */ uintptr + var _ /* pId at bp+0 */ uintptr + var _ /* pIdx at bp+88 */ uintptr + var _ /* res at bp+72 */ int32 + var _ /* size at bp+60 */ int32 + var _ /* sz at bp+64 */ Tsqlite3_int64 + var _ /* x at bp+40 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a11, aOp, aOp1, aOp2, aOp3, aOp4, aRoot, addr, addr1, addrCkFault, addrCkOk, addrOk, addrTop, azOrigin, b, bStrict, ckUniq, cnt, cnum, db, doTypeCheck, eAuto, eMode, eMode1, eMode2, enc, i, i1, i10, i2, i3, i4, i5, i6, i7, i8, i9, iAddr, iBt, iCol, iCol1, iCookie, iDb, iDbLast, iIdxDb, iLevel, iPrior, iReg, iTabCur, iTabDb, iTabDb1, ii, ii1, ii2, ii3, ii4, initNCol, isHidden, isQuick, j, j1, j2, j3, j4, jmp, jmp2, jmp21, jmp3, jmp4, jmp5, jmp6, jmp61, jmp7, k, k1, k2, k3, k4, kk, label6, labelError, labelOk, loopTop, mask, mx, mxCol, mxIdx, n, nHidden, nIdx, opMask, p, p1, p11, p3, p4, pBt, pBt1, pBt2, pCheck, pCol, pCol1, pColExpr, pColl, pDb, pEnc, pFK, pFK1, pHash, pIdx, pIdx1, pIdx3, pIdx4, pIdx5, pIdx6, pMod, pObjTab, pPager, pPager1, pParent, pPk, pPk1, pPragma, pPrior, pSchema, pTab, pTab1, pTab10, pTab11, pTab2, pTab3, pTab4, pTab5, pTab6, pTab7, pTab8, pTab9, pTbls, pVTab, r1, r11, r2, rc, regResult, regRow, showInternFunc, size, size1, size2, szThreshold, uniqOk, v, x1, x2, zDb, zErr, zErr1, zErr2, zLeft, zMod, zMode, zOpt, zRet, zRight, zSql, zSubSql, zType, v1, v10, v14, v15, v16, v18, v2, v22, v26, v33, v34, v38, v39, v4, v43, v45, v47, v5, v60, v61, v62, v63, v64, v65, v66, v68, v8 + zLeft = uintptr(0) /* Nul-terminated UTF-8 string */ + zRight = uintptr(0) /* Nul-terminated UTF-8 string , or NULL */ + zDb = uintptr(0) /* return value form SQLITE_FCNTL_PRAGMA */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The specific database being pragmaed */ + v = _sqlite3GetVdbe(tls, pParse) /* The pragma */ + if v == uintptr(0) { + return + } + _sqlite3VdbeRunOnlyOnce(tls, v) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(2) + /* Interpret the [schema.] part of the pragma statement. iDb is the + ** index of the database this pragma is being applied to in db.aDb[]. */ + iDb = _sqlite3TwoPartName(tls, pParse, pId1, pId2, bp) + if iDb < 0 { + return + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + /* If the temp database has been explicitly named as part of the + ** pragma, make sure it is open. + */ + if iDb == int32(1) && _sqlite3OpenTempDatabase(tls, pParse) != 0 { + return + } + zLeft = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + if !(zLeft != 0) { + return + } + if minusFlag != 0 { + zRight = _sqlite3MPrintf(tls, db, __ccgo_ts+17977, libc.VaList(bp+176, pValue)) + } else { + zRight = _sqlite3NameFromToken(tls, db, pValue) + } + if (*TToken)(unsafe.Pointer(pId2)).Fn > uint32(0) { + v1 = (*TDb)(unsafe.Pointer(pDb)).FzDbSName + } else { + v1 = uintptr(0) + } + zDb = v1 + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_PRAGMA), zLeft, zRight, zDb) != 0 { + goto pragma_out + } + /* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS + ** connection. If it returns SQLITE_OK, then assume that the VFS + ** handled the pragma and generate a no-op prepared statement. + ** + ** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed, + ** an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file + ** object corresponding to the database file to which the pragma + ** statement refers. + ** + ** IMPLEMENTATION-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA + ** file control is an array of pointers to strings (char**) in which the + ** second element of the array is the name of the pragma and the third + ** element is the argument to the pragma or NULL if the pragma has no + ** argument. + */ + (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0] = uintptr(0) + (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[int32(1)] = zLeft + (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[int32(2)] = zRight + (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[int32(3)] = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + rc = Xsqlite3_file_control(tls, db, zDb, int32(SQLITE_FCNTL_PRAGMA), bp+8) + if rc == SQLITE_OK { + _sqlite3VdbeSetNumCols(tls, v, int32(1)) + _sqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0], uintptr(-libc.Int32FromInt32(1))) + _returnSingleText(tls, v, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0]) + Xsqlite3_free(tls, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0]) + goto pragma_out + } + if rc != int32(SQLITE_NOTFOUND) { + if (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0] != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3827, libc.VaList(bp+176, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0])) + Xsqlite3_free(tls, (*(*[4]uintptr)(unsafe.Pointer(bp + 8)))[0]) + } + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + (*TParse)(unsafe.Pointer(pParse)).Frc = rc + goto pragma_out + } + /* Locate the pragma in the lookup table */ + pPragma = _pragmaLocate(tls, zLeft) + if pPragma == uintptr(0) { + /* IMP: R-43042-22504 No error messages are generated if an + ** unknown pragma is issued. */ + goto pragma_out + } + /* Make sure the database schema is loaded if the pragma requires that */ + if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NeedSchema) != 0 { + if _sqlite3ReadSchema(tls, pParse) != 0 { + goto pragma_out + } + } + /* Register the result column names for pragmas that return results */ + if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns) == 0 && (int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) == 0 || zRight == uintptr(0)) { + _setPragmaResultColumnNames(tls, v, pPragma) + } + /* Jump to the appropriate pragma handler */ + switch int32((*TPragmaName)(unsafe.Pointer(pPragma)).FePragTyp) { + /* + ** PRAGMA [schema.]default_cache_size + ** PRAGMA [schema.]default_cache_size=N + ** + ** The first form reports the current persistent setting for the + ** page cache size. The value returned is the maximum number of + ** pages in the page cache. The second form sets both the current + ** page cache size value and the persistent page cache size value + ** stored in the database file. + ** + ** Older versions of SQLite would set the default cache size to a + ** negative number to indicate synchronous=OFF. These days, synchronous + ** is always on by default regardless of the sign of the default cache + ** size. But continue to take the absolute value of the default cache + ** size of historical compatibility. + */ + case int32(PragTyp_DEFAULT_CACHE_SIZE): + _sqlite3VdbeUsesBtree(tls, v, iDb) + if !(zRight != 0) { + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(2) + aOp = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(36)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_getCacheSize)), _iLn3) + if 0 != 0 { + break + } + (*(*TVdbeOp)(unsafe.Pointer(aOp))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp + 1*24))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp + 6*24))).Fp1 = -int32(2000) + } else { + size = _sqlite3AbsInt32(tls, _sqlite3Atoi(tls, zRight)) + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SetCookie), iDb, int32(BTREE_DEFAULT_CACHE_SIZE), size) + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size + _sqlite3BtreeSetCacheSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) + } + break + /* + ** PRAGMA [schema.]page_size + ** PRAGMA [schema.]page_size=N + ** + ** The first form reports the current setting for the + ** database page size in bytes. The second form sets the + ** database page size value. The value can only be set if + ** the database has not yet been created. + */ + fallthrough + case int32(PragTyp_PAGE_SIZE): + pBt = (*TDb)(unsafe.Pointer(pDb)).FpBt + if !(zRight != 0) { + if pBt != 0 { + v2 = _sqlite3BtreeGetPageSize(tls, pBt) + } else { + v2 = 0 + } + size1 = v2 + _returnSingleInt(tls, v, int64(size1)) + } else { + /* Malloc may fail when setting the page-size, as there is an internal + ** buffer that the pager module resizes using sqlite3_realloc(). + */ + (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize = _sqlite3Atoi(tls, zRight) + if int32(SQLITE_NOMEM) == _sqlite3BtreeSetPageSize(tls, pBt, (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize, 0, 0) { + _sqlite3OomFault(tls, db) + } + } + break + /* + ** PRAGMA [schema.]secure_delete + ** PRAGMA [schema.]secure_delete=ON/OFF/FAST + ** + ** The first form reports the current setting for the + ** secure_delete flag. The second form changes the secure_delete + ** flag setting and reports the new value. + */ + fallthrough + case int32(PragTyp_SECURE_DELETE): + pBt1 = (*TDb)(unsafe.Pointer(pDb)).FpBt + b = -int32(1) + if zRight != 0 { + if Xsqlite3_stricmp(tls, zRight, __ccgo_ts+17981) == 0 { + b = int32(2) + } else { + b = int32(_sqlite3GetBoolean(tls, zRight, uint8(0))) + } + } + if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && b >= 0 { + ii = 0 + for { + if !(ii < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + _sqlite3BtreeSecureDelete(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii)*32))).FpBt, b) + goto _3 + _3: + ; + ii++ + } + } + b = _sqlite3BtreeSecureDelete(tls, pBt1, b) + _returnSingleInt(tls, v, int64(b)) + break + /* + ** PRAGMA [schema.]max_page_count + ** PRAGMA [schema.]max_page_count=N + ** + ** The first form reports the current setting for the + ** maximum number of pages in the database file. The + ** second form attempts to change this setting. Both + ** forms return the current setting. + ** + ** The absolute value of N is used. This is undocumented and might + ** change. The only purpose is to provide an easy way to test + ** the sqlite3AbsInt32() function. + ** + ** PRAGMA [schema.]page_count + ** + ** Return the number of pages in the specified database. + */ + fallthrough + case int32(PragTyp_PAGE_COUNT): + *(*Ti64)(unsafe.Pointer(bp + 40)) = 0 + _sqlite3CodeVerifySchema(tls, pParse, iDb) + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + iReg = v4 + if int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zLeft)))]) == int32('p') { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Pagecount), iDb, iReg) + } else { + if zRight != 0 && _sqlite3DecOrHexToI64(tls, zRight, bp+40) == 0 { + if *(*Ti64)(unsafe.Pointer(bp + 40)) < 0 { + *(*Ti64)(unsafe.Pointer(bp + 40)) = 0 + } else { + if *(*Ti64)(unsafe.Pointer(bp + 40)) > libc.Int64FromUint32(0xfffffffe) { + *(*Ti64)(unsafe.Pointer(bp + 40)) = libc.Int64FromUint32(0xfffffffe) + } + } + } else { + *(*Ti64)(unsafe.Pointer(bp + 40)) = 0 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MaxPgcnt), iDb, iReg, int32(*(*Ti64)(unsafe.Pointer(bp + 40)))) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), iReg, int32(1)) + break + /* + ** PRAGMA [schema.]locking_mode + ** PRAGMA [schema.]locking_mode = (normal|exclusive) + */ + fallthrough + case int32(PragTyp_LOCKING_MODE): + zRet = __ccgo_ts + 17772 + eMode = _getLockingMode(tls, zRight) + if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) && eMode == -int32(1) { + /* Simple "PRAGMA locking_mode;" statement. This is a query for + ** the current default locking mode (which may be different to + ** the locking-mode of the main database). + */ + eMode = int32((*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode) + } else { + if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) { + ii1 = int32(2) + for { + if !(ii1 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pPager = _sqlite3BtreePager(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii1)*32))).FpBt) + _sqlite3PagerLockingMode(tls, pPager, eMode) + goto _6 + _6: + ; + ii1++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FdfltLockMode = uint8(eMode) + } + pPager = _sqlite3BtreePager(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + eMode = _sqlite3PagerLockingMode(tls, pPager, eMode) + } + if eMode == int32(PAGER_LOCKINGMODE_EXCLUSIVE) { + zRet = __ccgo_ts + 17762 + } + _returnSingleText(tls, v, zRet) + break + /* + ** PRAGMA [schema.]journal_mode + ** PRAGMA [schema.]journal_mode = + ** (delete|persist|off|truncate|memory|wal|off) + */ + fallthrough + case int32(PragTyp_JOURNAL_MODE): /* Loop counter */ + if zRight == uintptr(0) { + /* If there is no "=MODE" part of the pragma, do a query for the + ** current mode */ + eMode1 = -int32(1) + } else { + n = _sqlite3Strlen30(tls, zRight) + eMode1 = 0 + for { + v8 = _sqlite3JournalModename(tls, eMode1) + zMode = v8 + if !(v8 != uintptr(0)) { + break + } + if Xsqlite3_strnicmp(tls, zRight, zMode, n) == 0 { + break + } + goto _7 + _7: + ; + eMode1++ + } + if !(zMode != 0) { + /* If the "=MODE" part does not match any known journal mode, + ** then do a query */ + eMode1 = -int32(1) + } + if eMode1 == int32(PAGER_JOURNALMODE_OFF) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_Defensive) != uint64(0) { + /* Do not allow journal-mode "OFF" in defensive since the database + ** can become corrupted using ordinary SQL when the journal is off */ + eMode1 = -int32(1) + } + } + if eMode1 == -int32(1) && (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) { + /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ + iDb = 0 + (*TToken)(unsafe.Pointer(pId2)).Fn = uint32(1) + } + ii2 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + for { + if !(ii2 >= 0) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii2)*32))).FpBt != 0 && (ii2 == iDb || (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0)) { + _sqlite3VdbeUsesBtree(tls, v, ii2) + _sqlite3VdbeAddOp3(tls, v, int32(OP_JournalMode), ii2, int32(1), eMode1) + } + goto _9 + _9: + ; + ii2-- + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) + break + /* + ** PRAGMA [schema.]journal_size_limit + ** PRAGMA [schema.]journal_size_limit=N + ** + ** Get or set the size limit on rollback journal files. + */ + fallthrough + case int32(PragTyp_JOURNAL_SIZE_LIMIT): + pPager1 = _sqlite3BtreePager(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + *(*Ti64)(unsafe.Pointer(bp + 48)) = int64(-int32(2)) + if zRight != 0 { + _sqlite3DecOrHexToI64(tls, zRight, bp+48) + if *(*Ti64)(unsafe.Pointer(bp + 48)) < int64(-int32(1)) { + *(*Ti64)(unsafe.Pointer(bp + 48)) = int64(-int32(1)) + } + } + *(*Ti64)(unsafe.Pointer(bp + 48)) = _sqlite3PagerJournalSizeLimit(tls, pPager1, *(*Ti64)(unsafe.Pointer(bp + 48))) + _returnSingleInt(tls, v, *(*Ti64)(unsafe.Pointer(bp + 48))) + break + /* + ** PRAGMA [schema.]auto_vacuum + ** PRAGMA [schema.]auto_vacuum=N + ** + ** Get or set the value of the database 'auto-vacuum' parameter. + ** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL + */ + fallthrough + case int32(PragTyp_AUTO_VACUUM): + pBt2 = (*TDb)(unsafe.Pointer(pDb)).FpBt + if !(zRight != 0) { + _returnSingleInt(tls, v, int64(_sqlite3BtreeGetAutoVacuum(tls, pBt2))) + } else { + eAuto = _getAutoVacuum(tls, zRight) + (*Tsqlite3)(unsafe.Pointer(db)).FnextAutovac = int8(uint8(eAuto)) + /* Call SetAutoVacuum() to set initialize the internal auto and + ** incr-vacuum flags. This is required in case this connection + ** creates the database file. It is important that it is created + ** as an auto-vacuum capable db. + */ + rc = _sqlite3BtreeSetAutoVacuum(tls, pBt2, eAuto) + if rc == SQLITE_OK && (eAuto == int32(1) || eAuto == int32(2)) { + iAddr = _sqlite3VdbeCurrentAddr(tls, v) + aOp1 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(20)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_setMeta6)), _iLn11) + if 0 != 0 { + break + } + (*(*TVdbeOp)(unsafe.Pointer(aOp1))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp1 + 1*24))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp1 + 2*24))).Fp2 = iAddr + int32(4) + (*(*TVdbeOp)(unsafe.Pointer(aOp1 + 4*24))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp1 + 4*24))).Fp3 = eAuto - int32(1) + _sqlite3VdbeUsesBtree(tls, v, iDb) + } + } + break + /* + ** PRAGMA [schema.]incremental_vacuum(N) + ** + ** Do N steps of incremental vacuuming on a database. + */ + fallthrough + case int32(PragTyp_INCREMENTAL_VACUUM): + *(*int32)(unsafe.Pointer(bp + 56)) = 0 + if zRight == uintptr(0) || !(_sqlite3GetInt32(tls, zRight, bp+56) != 0) || *(*int32)(unsafe.Pointer(bp + 56)) <= 0 { + *(*int32)(unsafe.Pointer(bp + 56)) = int32(0x7fffffff) + } + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), *(*int32)(unsafe.Pointer(bp + 56)), int32(1)) + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_IncrVacuum), iDb) + _sqlite3VdbeAddOp1(tls, v, int32(OP_ResultRow), int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(1), -int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfPos), int32(1), addr) + _sqlite3VdbeJumpHere(tls, v, addr) + break + /* + ** PRAGMA [schema.]cache_size + ** PRAGMA [schema.]cache_size=N + ** + ** The first form reports the current local setting for the + ** page cache size. The second form sets the local + ** page cache size value. If N is positive then that is the + ** number of pages in the cache. If N is negative, then the + ** number of pages is adjusted so that the cache uses -N kibibytes + ** of memory. + */ + fallthrough + case int32(PragTyp_CACHE_SIZE): + if !(zRight != 0) { + _returnSingleInt(tls, v, int64((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size)) + } else { + size2 = _sqlite3Atoi(tls, zRight) + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size2 + _sqlite3BtreeSetCacheSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) + } + break + /* + ** PRAGMA [schema.]cache_spill + ** PRAGMA cache_spill=BOOLEAN + ** PRAGMA [schema.]cache_spill=N + ** + ** The first form reports the current local setting for the + ** page cache spill size. The second form turns cache spill on + ** or off. When turning cache spill on, the size is set to the + ** current cache_size. The third form sets a spill size that + ** may be different form the cache size. + ** If N is positive then that is the + ** number of pages in the cache. If N is negative, then the + ** number of pages is adjusted so that the cache uses -N kibibytes + ** of memory. + ** + ** If the number of cache_spill pages is less then the number of + ** cache_size pages, no spilling occurs until the page count exceeds + ** the number of cache_size pages. + ** + ** The cache_spill=BOOLEAN setting applies to all attached schemas, + ** not just the schema specified. + */ + fallthrough + case int32(PragTyp_CACHE_SPILL): + if !(zRight != 0) { + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_CacheSpill) == uint64(0) { + v10 = 0 + } else { + v10 = _sqlite3BtreeSetSpillSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, 0) + } + _returnSingleInt(tls, v, int64(v10)) + } else { + *(*int32)(unsafe.Pointer(bp + 60)) = int32(1) + if _sqlite3GetInt32(tls, zRight, bp+60) != 0 { + _sqlite3BtreeSetSpillSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, *(*int32)(unsafe.Pointer(bp + 60))) + } + if _sqlite3GetBoolean(tls, zRight, libc.BoolUint8(*(*int32)(unsafe.Pointer(bp + 60)) != 0)) != 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(SQLITE_CacheSpill) + } else { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_CacheSpill) + } + _setAllPagerFlags(tls, db) + } + break + /* + ** PRAGMA [schema.]mmap_size(N) + ** + ** Used to set mapping size limit. The mapping size limit is + ** used to limit the aggregate size of all memory mapped regions of the + ** database file. If this parameter is set to zero, then memory mapping + ** is not used at all. If N is negative, then the default memory map + ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. + ** The parameter N is measured in bytes. + ** + ** This value is advisory. The underlying VFS is free to memory map + ** as little or as much as it wants. Except, if N is set to 0 then the + ** upper layers will never invoke the xFetch interfaces to the VFS. + */ + fallthrough + case int32(PragTyp_MMAP_SIZE): + if zRight != 0 { + _sqlite3DecOrHexToI64(tls, zRight, bp+64) + if *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64)) < 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64)) = _sqlite3Config.FszMmap + } + if (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0) { + (*Tsqlite3)(unsafe.Pointer(db)).FszMmap = *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64)) + } + ii3 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + for { + if !(ii3 >= 0) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii3)*32))).FpBt != 0 && (ii3 == iDb || (*TToken)(unsafe.Pointer(pId2)).Fn == uint32(0)) { + _sqlite3BtreeSetMmapLimit(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii3)*32))).FpBt, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64))) + } + goto _11 + _11: + ; + ii3-- + } + } + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64)) = int64(-int32(1)) + rc = Xsqlite3_file_control(tls, db, zDb, int32(SQLITE_FCNTL_MMAP_SIZE), bp+64) + if rc == SQLITE_OK { + _returnSingleInt(tls, v, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 64))) + } else { + if rc != int32(SQLITE_NOTFOUND) { + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + (*TParse)(unsafe.Pointer(pParse)).Frc = rc + } + } + break + /* + ** PRAGMA temp_store + ** PRAGMA temp_store = "default"|"memory"|"file" + ** + ** Return or set the local value of the temp_store flag. Changing + ** the local value does not make changes to the disk file and the default + ** value will be restored the next time the database is opened. + ** + ** Note that it is possible for the library compile-time options to + ** override this setting + */ + fallthrough + case int32(PragTyp_TEMP_STORE): + if !(zRight != 0) { + _returnSingleInt(tls, v, int64((*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store)) + } else { + _changeTempStorage(tls, pParse, zRight) + } + break + /* + ** PRAGMA temp_store_directory + ** PRAGMA temp_store_directory = ""|"directory_name" + ** + ** Return or set the local value of the temp_store_directory flag. Changing + ** the value sets a specific directory to be used for temporary files. + ** Setting to a null string reverts to the default temporary directory search. + ** If temporary directory is changed, then invalidateTempStorage. + ** + */ + fallthrough + case int32(PragTyp_TEMP_STORE_DIRECTORY): + Xsqlite3_mutex_enter(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) + if !(zRight != 0) { + _returnSingleText(tls, v, Xsqlite3_temp_directory) + } else { + if *(*int8)(unsafe.Pointer(zRight)) != 0 { + rc = _sqlite3OsAccess(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, zRight, int32(SQLITE_ACCESS_READWRITE), bp+72) + if rc != SQLITE_OK || *(*int32)(unsafe.Pointer(bp + 72)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+17986, 0) + Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) + goto pragma_out + } + } + if libc.Bool(false) || libc.Bool(true) && int32((*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store) <= int32(1) || libc.Bool(libc.Bool(false) && int32((*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store) == int32(1)) { + _invalidateTempStorage(tls, pParse) + } + Xsqlite3_free(tls, Xsqlite3_temp_directory) + if *(*int8)(unsafe.Pointer(zRight)) != 0 { + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+176, zRight)) + } else { + Xsqlite3_temp_directory = uintptr(0) + } + } + Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_VFS1))) + break + /* + ** PRAGMA [schema.]synchronous + ** PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA + ** + ** Return or set the local value of the synchronous flag. Changing + ** the local value does not make changes to the disk file and the + ** default value will be restored the next time the database is + ** opened. + */ + fallthrough + case int32(PragTyp_SYNCHRONOUS): + if !(zRight != 0) { + _returnSingleInt(tls, v, int64(int32((*TDb)(unsafe.Pointer(pDb)).Fsafety_level)-int32(1))) + } else { + if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18011, 0) + } else { + if iDb != int32(1) { + iLevel = (int32(_getSafetyLevel(tls, zRight, 0, uint8(1))) + int32(1)) & int32(PAGER_SYNCHRONOUS_MASK) + if iLevel == 0 { + iLevel = int32(1) + } + (*TDb)(unsafe.Pointer(pDb)).Fsafety_level = uint8(iLevel) + (*TDb)(unsafe.Pointer(pDb)).FbSyncSet = uint8(1) + _setAllPagerFlags(tls, db) + } + } + } + case int32(PragTyp_FLAG): + if zRight == uintptr(0) { + _setPragmaResultColumnNames(tls, v, pPragma) + _returnSingleInt(tls, v, libc.BoolInt64((*Tsqlite3)(unsafe.Pointer(db)).Fflags&(*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != uint64(0))) + } else { + mask = (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg /* Mask of bits to set or clear. */ + if int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 { + /* Foreign key support may not be enabled or disabled while not + ** in auto-commit mode. */ + mask &= uint64(^libc.Int32FromInt32(SQLITE_ForeignKeys)) + } + if _sqlite3GetBoolean(tls, zRight, uint8(0)) != 0 { + if mask&uint64(SQLITE_WriteSchema) == uint64(0) || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_Defensive) == uint64(0) { + *(*Tu64)(unsafe.Pointer(db + 48)) |= mask + } + } else { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^mask + if mask == uint64(SQLITE_DeferFKs) { + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 + } + if mask&uint64(SQLITE_WriteSchema) != uint64(0) && Xsqlite3_stricmp(tls, zRight, __ccgo_ts+18064) == 0 { + /* IMP: R-60817-01178 If the argument is "RESET" then schema + ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, + ** in addition, the schema is reloaded. */ + _sqlite3ResetAllSchemasOfConnection(tls, db) + } + } + /* Many of the flag-pragmas modify the code generated by the SQL + ** compiler (eg. count_changes). So add an opcode to expire all + ** compiled SQL statements after modifying a pragma value. + */ + _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) + _setAllPagerFlags(tls, db) + } + break + /* + ** PRAGMA table_info(
    ) + ** + ** Return a single row for each column of the named table. The columns of + ** the returned data set are: + ** + ** cid: Column id (numbered from left to right, starting at 0) + ** name: Column name + ** type: Column declaration type. + ** notnull: True if 'NOT NULL' is part of column declaration + ** dflt_value: The default value for the column, if any. + ** pk: Non-zero for PK fields. + */ + fallthrough + case int32(PragTyp_TABLE_INFO): + if zRight != 0 { + _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) + pTab = _sqlite3LocateTable(tls, pParse, uint32(LOCATE_NOERR), zRight, zDb) + if pTab != 0 { + nHidden = 0 + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(7) + _sqlite3ViewGetColumnNames(tls, pParse, pTab) + i = 0 + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + isHidden = 0 + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_NOINSERT) != 0 { + if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg == uint64(0) { + nHidden++ + goto _12 + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + isHidden = int32(2) /* GENERATED ALWAYS AS ... VIRTUAL */ + } else { + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_STORED) != 0 { + isHidden = int32(3) /* GENERATED ALWAYS AS ... STORED */ + } else { + isHidden = int32(1) /* HIDDEN */ + } + } + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) == 0 { + k = 0 + } else { + if pPk == uintptr(0) { + k = int32(1) + } else { + k = int32(1) + for { + if !(k <= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) && int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(k-int32(1))*2))) != i) { + break + } + goto _13 + _13: + ; + k++ + } + } + } + pColExpr = _sqlite3ColumnExpr(tls, pTab, pCol) + if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { + v14 = __ccgo_ts + 18070 + } else { + v14 = __ccgo_ts + 18078 + } + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0 { + v15 = int32(1) + } else { + v15 = 0 + } + if isHidden >= int32(2) || pColExpr == uintptr(0) { + v16 = uintptr(0) + } else { + v16 = *(*uintptr)(unsafe.Pointer(pColExpr + 8)) + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), v14, libc.VaList(bp+176, i-nHidden, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, _sqlite3ColumnType(tls, pCol, __ccgo_ts+1680), v15, v16, k, isHidden)) + goto _12 + _12: + ; + i++ + pCol += 16 + } + } + } + break + /* + ** PRAGMA table_list + ** + ** Return a single row for each table, virtual table, or view in the + ** entire schema. + ** + ** schema: Name of attached database hold this table + ** name: Name of the table itself + ** type: "table", "view", "virtual", "shadow" + ** ncol: Number of columns + ** wr: True for a WITHOUT ROWID table + ** strict: True for a STRICT table + */ + fallthrough + case int32(PragTyp_TABLE_LIST): + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(6) + _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) + ii4 = 0 + for { + if !(ii4 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if zDb != 0 && Xsqlite3_stricmp(tls, zDb, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName) != 0 { + goto _17 + } + /* Ensure that the Table.nCol field is initialized for all views + ** and virtual tables. Each time we initialize a Table.nCol value + ** for a table, that can potentially disrupt the hash table, so restart + ** the initialization scan. + */ + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FpSchema + 8 + initNCol = int32((*THash)(unsafe.Pointer(pHash)).Fcount) + for { + v18 = initNCol + initNCol-- + if !(v18 != 0) { + break + } + k1 = (*THash)(unsafe.Pointer(pHash)).Ffirst + for { + if !(int32(1) != 0) { + break + } + if k1 == uintptr(0) { + initNCol = 0 + break + } + pTab1 = (*THashElem)(unsafe.Pointer(k1)).Fdata + if int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) == 0 { + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18085, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab1)).FzName)) + if zSql != 0 { + *(*uintptr)(unsafe.Pointer(bp + 80)) = uintptr(0) + Xsqlite3_prepare(tls, db, zSql, -int32(1), bp+80, uintptr(0)) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 80))) + _sqlite3DbFree(tls, db, zSql) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ErrorMsg(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpParse, __ccgo_ts+1650, 0) + (*TParse)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FpParse)).Frc = int32(SQLITE_NOMEM) + } + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FpSchema + 8 + break + } + goto _19 + _19: + ; + k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext + } + } + k1 = (*THash)(unsafe.Pointer(pHash)).Ffirst + for { + if !(k1 != 0) { + break + } + pTab2 = (*THashElem)(unsafe.Pointer(k1)).Fdata + if zRight != 0 && Xsqlite3_stricmp(tls, zRight, (*TTable)(unsafe.Pointer(pTab2)).FzName) != 0 { + goto _20 + } + if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VIEW) { + zType = __ccgo_ts + 10828 + } else { + if int32((*TTable)(unsafe.Pointer(pTab2)).FeTabType) == int32(TABTYP_VTAB) { + zType = __ccgo_ts + 13076 + } else { + if (*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Shadow) != 0 { + zType = __ccgo_ts + 18101 + } else { + zType = __ccgo_ts + 9090 + } + } + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18108, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(ii4)*32))).FzDbSName, _sqlite3PreferredTableName(tls, (*TTable)(unsafe.Pointer(pTab2)).FzName), zType, int32((*TTable)(unsafe.Pointer(pTab2)).FnCol), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_WithoutRowid) != uint32(0)), libc.BoolInt32((*TTable)(unsafe.Pointer(pTab2)).FtabFlags&uint32(TF_Strict) != uint32(0)))) + goto _20 + _20: + ; + k1 = (*THashElem)(unsafe.Pointer(k1)).Fnext + } + goto _17 + _17: + ; + ii4++ + } + case int32(PragTyp_INDEX_INFO): + if zRight != 0 { + pIdx = _sqlite3FindIndex(tls, db, zRight, zDb) + if pIdx == uintptr(0) { + /* If there is no index named zRight, check to see if there is a + ** WITHOUT ROWID table named zRight, and if there is, show the + ** structure of the PRIMARY KEY index for that table. */ + pTab3 = _sqlite3LocateTable(tls, pParse, uint32(LOCATE_NOERR), zRight, zDb) + if pTab3 != 0 && !((*TTable)(unsafe.Pointer(pTab3)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pIdx = _sqlite3PrimaryKeyIndex(tls, pTab3) + } + } + if pIdx != 0 { + iIdxDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIdx)).FpSchema) + if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { + /* PRAGMA index_xinfo (newer version with more rows and columns) */ + mx = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(6) + } else { + /* PRAGMA index_info (legacy version) */ + mx = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(3) + } + pTab3 = (*TIndex)(unsafe.Pointer(pIdx)).FpTable + _sqlite3CodeVerifySchema(tls, pParse, iIdxDb) + i1 = 0 + for { + if !(i1 < mx) { + break + } + cnum = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) + if int32(cnum) < 0 { + v22 = uintptr(0) + } else { + v22 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab3)).FaCol + uintptr(cnum)*16))).FzCnName + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18115, libc.VaList(bp+176, i1, int32(cnum), v22)) + if (*TPragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { + _sqlite3VdbeMultiLoad(tls, v, int32(4), __ccgo_ts+18120, libc.VaList(bp+176, int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), libc.BoolInt32(i1 < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)))) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), (*TParse)(unsafe.Pointer(pParse)).FnMem) + goto _21 + _21: + ; + i1++ + } + } + } + case int32(PragTyp_INDEX_LIST): + if zRight != 0 { + pTab4 = _sqlite3FindTable(tls, db, zRight, zDb) + if pTab4 != 0 { + iTabDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab4)).FpSchema) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(5) + _sqlite3CodeVerifySchema(tls, pParse, iTabDb) + pIdx1 = (*TTable)(unsafe.Pointer(pTab4)).FpIndex + i2 = libc.Int32FromInt32(0) + for { + if !(pIdx1 != 0) { + break + } + azOrigin = [3]uintptr{ + 0: __ccgo_ts + 18125, + 1: __ccgo_ts + 18127, + 2: __ccgo_ts + 16614, + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18129, libc.VaList(bp+176, i2, (*TIndex)(unsafe.Pointer(pIdx1)).FzName, libc.BoolInt32(int32((*TIndex)(unsafe.Pointer(pIdx1)).FonError) != OE_None), azOrigin[int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x3>>0))], libc.BoolInt32((*TIndex)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0)))) + goto _23 + _23: + ; + pIdx1 = (*TIndex)(unsafe.Pointer(pIdx1)).FpNext + i2++ + } + } + } + case int32(PragTyp_DATABASE_LIST): + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(3) + i3 = 0 + for { + if !(i3 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt == uintptr(0) { + goto _24 + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18135, libc.VaList(bp+176, i3, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FzDbSName, _sqlite3BtreeGetFilename(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i3)*32))).FpBt))) + goto _24 + _24: + ; + i3++ + } + case int32(PragTyp_COLLATION_LIST): + i4 = 0 + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(2) + p = (*THash)(unsafe.Pointer(db + 648)).Ffirst + for { + if !(p != 0) { + break + } + pColl = (*THashElem)(unsafe.Pointer(p)).Fdata + v26 = i4 + i4++ + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18139, libc.VaList(bp+176, v26, (*TCollSeq)(unsafe.Pointer(pColl)).FzName)) + goto _25 + _25: + ; + p = (*THashElem)(unsafe.Pointer(p)).Fnext + } + case int32(PragTyp_FUNCTION_LIST): + showInternFunc = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_InternalFunc) != uint32(0)) + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(6) + i5 = 0 + for { + if !(i5 < int32(SQLITE_FUNC_HASH_SZ)) { + break + } + p1 = *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&_sqlite3BuiltinFunctions)) + uintptr(i5)*8)) + for { + if !(p1 != 0) { + break + } + _pragmaFunclistLine(tls, v, p1, int32(1), showInternFunc) + goto _28 + _28: + ; + p1 = *(*uintptr)(unsafe.Pointer(p1 + 64)) + } + goto _27 + _27: + ; + i5++ + } + j = (*THash)(unsafe.Pointer(db + 624)).Ffirst + for { + if !(j != 0) { + break + } + p1 = (*THashElem)(unsafe.Pointer(j)).Fdata + _pragmaFunclistLine(tls, v, p1, 0, showInternFunc) + goto _29 + _29: + ; + j = (*THashElem)(unsafe.Pointer(j)).Fnext + } + case int32(PragTyp_MODULE_LIST): + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) + j1 = (*THash)(unsafe.Pointer(db + 576)).Ffirst + for { + if !(j1 != 0) { + break + } + pMod = (*THashElem)(unsafe.Pointer(j1)).Fdata + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7649, libc.VaList(bp+176, (*TModule)(unsafe.Pointer(pMod)).FzName)) + goto _30 + _30: + ; + j1 = (*THashElem)(unsafe.Pointer(j1)).Fnext + } + case int32(PragTyp_PRAGMA_LIST): + i6 = 0 + for { + if !(i6 < int32(libc.Uint64FromInt64(1584)/libc.Uint64FromInt64(24))) { + break + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+7649, libc.VaList(bp+176, _aPragmaName[i6].FzName)) + goto _31 + _31: + ; + i6++ + } + case int32(PragTyp_FOREIGN_KEY_LIST): + if zRight != 0 { + pTab5 = _sqlite3FindTable(tls, db, zRight, zDb) + if pTab5 != 0 && int32((*TTable)(unsafe.Pointer(pTab5)).FeTabType) == TABTYP_NORM { + pFK = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab5 + 64))).FpFKey + if pFK != 0 { + iTabDb1 = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab5)).FpSchema) + i7 = 0 + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(8) + _sqlite3CodeVerifySchema(tls, pParse, iTabDb1) + for pFK != 0 { + j2 = 0 + for { + if !(j2 < (*TFKey)(unsafe.Pointer(pFK)).FnCol) { + break + } + _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+18142, libc.VaList(bp+176, i7, j2, (*TFKey)(unsafe.Pointer(pFK)).FzTo, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab5)).FaCol + uintptr((*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FiFrom)*16))).FzCnName, (*(*TsColMap)(unsafe.Pointer(pFK + 64 + uintptr(j2)*16))).FzCol, _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45 + 1))), _actionName(tls, *(*Tu8)(unsafe.Pointer(pFK + 45))), __ccgo_ts+18151)) + goto _32 + _32: + ; + j2++ + } + i7++ + pFK = (*TFKey)(unsafe.Pointer(pFK)).FpNextFrom + } + } + } + } + case int32(PragTyp_FOREIGN_KEY_CHECK): /* child to parent column mapping */ + regResult = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(4) + v34 = pParse + 56 + *(*int32)(unsafe.Pointer(v34))++ + v33 = *(*int32)(unsafe.Pointer(v34)) + regRow = v33 + k2 = (*THash)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 8)).Ffirst + for k2 != 0 { + if zRight != 0 { + pTab6 = _sqlite3LocateTable(tls, pParse, uint32(0), zRight, zDb) + k2 = uintptr(0) + } else { + pTab6 = (*THashElem)(unsafe.Pointer(k2)).Fdata + k2 = (*THashElem)(unsafe.Pointer(k2)).Fnext + } + if pTab6 == uintptr(0) || !(int32((*TTable)(unsafe.Pointer(pTab6)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) || (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab6 + 64))).FpFKey == uintptr(0) { + continue + } + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab6)).FpSchema) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + _sqlite3CodeVerifySchema(tls, pParse, iDb) + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab6)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab6)).FzName) + _sqlite3TouchRegister(tls, pParse, int32((*TTable)(unsafe.Pointer(pTab6)).FnCol)+regRow) + _sqlite3OpenTable(tls, pParse, 0, iDb, pTab6, int32(OP_OpenRead)) + _sqlite3VdbeLoadString(tls, v, regResult, (*TTable)(unsafe.Pointer(pTab6)).FzName) + i8 = int32(1) + pFK1 = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab6 + 64))).FpFKey + for { + if !(pFK1 != 0) { + break + } + pParent = _sqlite3FindTable(tls, db, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, zDb) + if pParent == uintptr(0) { + goto _35 + } + *(*uintptr)(unsafe.Pointer(bp + 88)) = uintptr(0) + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pParent)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pParent)).FzName) + x1 = _sqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+88, uintptr(0)) + if x1 == 0 { + if *(*uintptr)(unsafe.Pointer(bp + 88)) == uintptr(0) { + _sqlite3OpenTable(tls, pParse, i8, iDb, pParent, int32(OP_OpenRead)) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), i8, int32((*TIndex)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 88))) + } + } else { + k2 = uintptr(0) + break + } + goto _35 + _35: + ; + i8++ + pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom + } + if pFK1 != 0 { + break + } + if (*TParse)(unsafe.Pointer(pParse)).FnTab < i8 { + (*TParse)(unsafe.Pointer(pParse)).FnTab = i8 + } + addrTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), 0) + i8 = int32(1) + pFK1 = (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pTab6 + 64))).FpFKey + for { + if !(pFK1 != 0) { + break + } + pParent = _sqlite3FindTable(tls, db, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, zDb) + *(*uintptr)(unsafe.Pointer(bp + 88)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 96)) = uintptr(0) + if pParent != 0 { + x1 = _sqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+88, bp+96) + } + addrOk = _sqlite3VdbeMakeLabel(tls, pParse) + /* Generate code to read the child key values into registers + ** regRow..regRow+n. If any of the child key values are NULL, this + ** row cannot cause an FK violation. Jump directly to addrOk in + ** this case. */ + _sqlite3TouchRegister(tls, pParse, regRow+(*TFKey)(unsafe.Pointer(pFK1)).FnCol) + j3 = 0 + for { + if !(j3 < (*TFKey)(unsafe.Pointer(pFK1)).FnCol) { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 96)) != 0 { + v38 = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96)) + uintptr(j3)*4)) + } else { + v38 = (*(*TsColMap)(unsafe.Pointer(pFK1 + 64 + uintptr(j3)*16))).FiFrom + } + iCol = v38 + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab6, 0, iCol, regRow+j3) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regRow+j3, addrOk) + goto _37 + _37: + ; + j3++ + } + /* Generate code to query the parent index for a matching parent + ** key. If a match is found, jump to addrOk. */ + if *(*uintptr)(unsafe.Pointer(bp + 88)) != 0 { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), regRow, (*TFKey)(unsafe.Pointer(pFK1)).FnCol, 0, _sqlite3IndexAffinityStr(tls, db, *(*uintptr)(unsafe.Pointer(bp + 88))), (*TFKey)(unsafe.Pointer(pFK1)).FnCol) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), i8, addrOk, regRow, (*TFKey)(unsafe.Pointer(pFK1)).FnCol) + } else { + if pParent != 0 { + jmp = _sqlite3VdbeCurrentAddr(tls, v) + int32(2) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), i8, jmp, regRow) + _sqlite3VdbeGoto(tls, v, addrOk) + } + } + /* Generate code to report an FK violation to the caller. */ + if (*TTable)(unsafe.Pointer(pTab6)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), 0, regResult+int32(1)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regResult+int32(1)) + } + _sqlite3VdbeMultiLoad(tls, v, regResult+int32(2), __ccgo_ts+18156, libc.VaList(bp+176, (*TFKey)(unsafe.Pointer(pFK1)).FzTo, i8-int32(1))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, int32(4)) + _sqlite3VdbeResolveLabel(tls, v, addrOk) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96))) + goto _36 + _36: + ; + i8++ + pFK1 = (*TFKey)(unsafe.Pointer(pFK1)).FpNextFrom + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), 0, addrTop+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addrTop) + } + break + /* Reinstall the LIKE and GLOB functions. The variant of LIKE + ** used will be case sensitive or not depending on the RHS. + */ + fallthrough + case int32(PragTyp_CASE_SENSITIVE_LIKE): + if zRight != 0 { + _sqlite3RegisterLikeFunctions(tls, db, int32(_sqlite3GetBoolean(tls, zRight, uint8(0)))) + } + break + /* PRAGMA integrity_check + ** PRAGMA integrity_check(N) + ** PRAGMA quick_check + ** PRAGMA quick_check(N) + ** + ** Verify the integrity of the database. + ** + ** The "quick_check" is reduced version of + ** integrity_check designed to detect most database corruption + ** without the overhead of cross-checking indexes. Quick_check + ** is linear time whereas integrity_check is O(NlogN). + ** + ** The maximum number of errors is 100 by default. A different default + ** can be specified using a numeric parameter N. + ** + ** Or, the parameter N can be the name of a table. In that case, only + ** the one table named is verified. The freelist is only verified if + ** the named table is "sqlite_schema" (or one of its aliases). + ** + ** All schemas are checked by default. To check just a single + ** schema, use the form: + ** + ** PRAGMA schema.integrity_check; + */ + fallthrough + case int32(PragTyp_INTEGRITY_CHECK): + pObjTab = uintptr(0) /* Check only this one table, if not NULL */ + isQuick = libc.BoolInt32(int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zLeft)))]) == int32('q')) + /* If the PRAGMA command was of the form "PRAGMA .integrity_check", + ** then iDb is set to the index of the database identified by . + ** In this case, the integrity of database iDb only is verified by + ** the VDBE created below. + ** + ** Otherwise, if the command was simply "PRAGMA integrity_check" (or + ** "PRAGMA quick_check"), then iDb is set to 0. In this case, set iDb + ** to -1 here, to indicate that the VDBE should verify the integrity + ** of all attached databases. */ + if (*TToken)(unsafe.Pointer(pId2)).Fz == uintptr(0) { + iDb = -int32(1) + } + /* Initialize the VDBE program */ + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(6) + /* Set the maximum error count */ + *(*int32)(unsafe.Pointer(bp + 104)) = int32(SQLITE_INTEGRITY_CHECK_ERROR_MAX) + if zRight != 0 { + if _sqlite3GetInt32(tls, zRight, bp+104) != 0 { + if *(*int32)(unsafe.Pointer(bp + 104)) <= 0 { + *(*int32)(unsafe.Pointer(bp + 104)) = int32(SQLITE_INTEGRITY_CHECK_ERROR_MAX) + } + } else { + if iDb >= 0 { + v39 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + } else { + v39 = uintptr(0) + } + pObjTab = _sqlite3LocateTable(tls, pParse, uint32(0), zRight, v39) + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), *(*int32)(unsafe.Pointer(bp + 104))-int32(1), int32(1)) /* reg[1] holds errors left */ + /* Do an integrity check on each database file */ + i9 = 0 + for { + if !(i9 < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } /* Array of root page numbers of all btrees */ + cnt = 0 /* Number of entries in aRoot[] */ + mxIdx = 0 /* Maximum number of indexes for any table */ + if libc.Bool(OMIT_TEMPDB != 0) && i9 == int32(1) { + goto _40 + } + if iDb >= 0 && i9 != iDb { + goto _40 + } + _sqlite3CodeVerifySchema(tls, pParse, i9) + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(0) /* tag-20230327-1 */ + /* Do an integrity check of the B-Tree + ** + ** Begin by finding the root pages numbers + ** for all tables and indices in the database. + */ + pTbls = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FpSchema + 8 + cnt = 0 + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab7 = (*THashElem)(unsafe.Pointer(x2)).Fdata /* Number of indexes on pTab */ + if pObjTab != 0 && pObjTab != pTab7 { + goto _41 + } + if (*TTable)(unsafe.Pointer(pTab7)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + cnt++ + } + nIdx = 0 + pIdx3 = (*TTable)(unsafe.Pointer(pTab7)).FpIndex + for { + if !(pIdx3 != 0) { + break + } + cnt++ + goto _42 + _42: + ; + pIdx3 = (*TIndex)(unsafe.Pointer(pIdx3)).FpNext + nIdx++ + } + if nIdx > mxIdx { + mxIdx = nIdx + } + goto _41 + _41: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + if cnt == 0 { + goto _40 + } + if pObjTab != 0 { + cnt++ + } + aRoot = _sqlite3DbMallocRawNN(tls, db, uint64(4)*uint64(cnt+libc.Int32FromInt32(1))) + if aRoot == uintptr(0) { + break + } + cnt = 0 + if pObjTab != 0 { + cnt++ + v43 = cnt + *(*int32)(unsafe.Pointer(aRoot + uintptr(v43)*4)) = 0 + } + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab8 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab8 { + goto _44 + } + if (*TTable)(unsafe.Pointer(pTab8)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + cnt++ + v45 = cnt + *(*int32)(unsafe.Pointer(aRoot + uintptr(v45)*4)) = int32((*TTable)(unsafe.Pointer(pTab8)).Ftnum) + } + pIdx4 = (*TTable)(unsafe.Pointer(pTab8)).FpIndex + for { + if !(pIdx4 != 0) { + break + } + cnt++ + v47 = cnt + *(*int32)(unsafe.Pointer(aRoot + uintptr(v47)*4)) = int32((*TIndex)(unsafe.Pointer(pIdx4)).Ftnum) + goto _46 + _46: + ; + pIdx4 = (*TIndex)(unsafe.Pointer(pIdx4)).FpNext + } + goto _44 + _44: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + *(*int32)(unsafe.Pointer(aRoot)) = cnt + /* Make sure sufficient number of registers have been allocated */ + _sqlite3TouchRegister(tls, pParse, int32(8)+mxIdx) + _sqlite3ClearTempRegCache(tls, pParse) + /* Do the b-tree integrity checks */ + _sqlite3VdbeAddOp4(tls, v, int32(OP_IntegrityCk), int32(2), cnt, int32(1), aRoot, -int32(14)) + _sqlite3VdbeChangeP5(tls, v, uint16(uint8(i9))) + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(2)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+18160, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i9)*32))).FzDbSName)), -int32(6)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(2), int32(3), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, addr1) + /* Make sure all the indices are constructed correctly. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab9 = (*THashElem)(unsafe.Pointer(x2)).Fdata + pPrior = uintptr(0) + r1 = -int32(1) /* Maximum non-virtual column number */ + if pObjTab != 0 && pObjTab != pTab9 { + goto _48 + } + if !(int32((*TTable)(unsafe.Pointer(pTab9)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + goto _48 + } + if isQuick != 0 || (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + pPk1 = uintptr(0) + r2 = 0 + } else { + pPk1 = _sqlite3PrimaryKeyIndex(tls, pTab9) + r2 = _sqlite3GetTempRange(tls, pParse, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), int32(1), r2, r2+int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)-int32(1)) + } + _sqlite3OpenTableAndIndices(tls, pParse, pTab9, int32(OP_OpenRead), uint8(0), int32(1), uintptr(0), bp+108, bp+112) + /* reg[7] counts the number of entries in the table. + ** reg[8+i] counts the number of entries in the i-th index + */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(7)) + j4 = 0 + pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex + for { + if !(pIdx5 != 0) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, int32(8)+j4) /* index entries counter */ + goto _49 + _49: + ; + pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext + j4++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), *(*int32)(unsafe.Pointer(bp + 108)), 0) + loopTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(7), int32(1)) + /* Fetch the right-most column from the table. This will cause + ** the entire record header to be parsed and sanity checked. It + ** will also prepopulate the cursor column cache that is used + ** by the OP_IsType code, so it is a required step. + */ + if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + mxCol = -int32(1) + j4 = 0 + for { + if !(j4 < int32((*TTable)(unsafe.Pointer(pTab9)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) == 0 { + mxCol++ + } + goto _50 + _50: + ; + j4++ + } + if mxCol == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { + mxCol-- + } + } else { + /* COLFLAG_VIRTUAL columns are not included in the WITHOUT ROWID + ** PK index column-count, so there is no need to account for them + ** in this case. */ + mxCol = int32((*TIndex)(unsafe.Pointer(_sqlite3PrimaryKeyIndex(tls, pTab9))).FnColumn) - int32(1) + } + if mxCol >= 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), *(*int32)(unsafe.Pointer(bp + 108)), mxCol, int32(3)) + _sqlite3VdbeTypeofColumn(tls, v, int32(3)) + } + if !(isQuick != 0) { + if pPk1 != 0 { + a1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 108)), 0, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), r2) + zErr = _sqlite3MPrintf(tls, db, __ccgo_ts+18184, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr, -int32(6)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a1) + _sqlite3VdbeJumpHere(tls, v, a1+int32(1)) + j4 = 0 + for { + if !(j4 < int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) { + break + } + _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pPk1, *(*int32)(unsafe.Pointer(bp + 108)), j4, r2+j4) + goto _51 + _51: + ; + j4++ + } + } + } + /* Verify datatypes for all columns: + ** + ** (1) NOT NULL columns may not contain a NULL + ** (2) Datatype must be exact for non-ANY columns in STRICT tables + ** (3) Datatype for TEXT columns in non-STRICT tables must be + ** NULL, TEXT, or BLOB. + ** (4) Datatype for numeric columns in non-STRICT tables must not + ** be a TEXT value that can be losslessly converted to numeric. + */ + bStrict = libc.BoolInt32((*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_Strict) != uint32(0)) + j4 = 0 + for { + if !(j4 < int32((*TTable)(unsafe.Pointer(pTab9)).FnCol)) { + break + } + pCol1 = (*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16 /* Check datatypes (besides NOT NULL) */ + if j4 == int32((*TTable)(unsafe.Pointer(pTab9)).FiPKey) { + goto _52 + } + if bStrict != 0 { + doTypeCheck = libc.BoolInt32(int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4)) > int32(COLTYPE_ANY)) + } else { + doTypeCheck = libc.BoolInt32(int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) > int32(SQLITE_AFF_BLOB)) + } + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf>>0)) == 0 && !(doTypeCheck != 0) { + goto _52 + } + /* Compute the operands that will be needed for OP_IsType */ + p4 = int32(SQLITE_NULL) + if int32((*TColumn)(unsafe.Pointer(pCol1)).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) + p11 = -int32(1) + p3 = int32(3) + } else { + if (*TColumn)(unsafe.Pointer(pCol1)).FiDflt != 0 { + *(*uintptr)(unsafe.Pointer(bp + 120)) = uintptr(0) + _sqlite3ValueFromExpr(tls, db, _sqlite3ColumnExpr(tls, pTab9, pCol1), (*Tsqlite3)(unsafe.Pointer(db)).Fenc, uint8((*TColumn)(unsafe.Pointer(pCol1)).Faffinity), bp+120) + if *(*uintptr)(unsafe.Pointer(bp + 120)) != 0 { + p4 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 120))) + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 120))) + } + } + p11 = *(*int32)(unsafe.Pointer(bp + 108)) + if !((*TTable)(unsafe.Pointer(pTab9)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + p3 = int32(_sqlite3TableColumnToIndex(tls, _sqlite3PrimaryKeyIndex(tls, pTab9), int16(j4))) + } else { + p3 = int32(_sqlite3TableColumnToStorage(tls, pTab9, int16(j4))) + } + } + labelError = _sqlite3VdbeMakeLabel(tls, pParse) + labelOk = _sqlite3VdbeMakeLabel(tls, pParse) + if int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf>>0)) != 0 { + jmp2 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) + if p11 < 0 { + _sqlite3VdbeChangeP5(tls, v, uint16(0x0f)) /* INT, REAL, TEXT, or BLOB */ + jmp3 = jmp2 + } else { + _sqlite3VdbeChangeP5(tls, v, uint16(0x0d)) /* INT, TEXT, or BLOB */ + /* OP_IsType does not detect NaN values in the database file + ** which should be treated as a NULL. So if the header type + ** is REAL, we have to load the actual data using OP_Column + ** to reliably determine if the value is a NULL. */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), p11, p3, int32(3)) + _sqlite3ColumnDefault(tls, v, pTab9, j4, int32(3)) + jmp3 = _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), int32(3), labelOk) + } + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18220, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*TColumn)(unsafe.Pointer(pCol1)).FzCnName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) + if doTypeCheck != 0 { + _sqlite3VdbeGoto(tls, v, labelError) + _sqlite3VdbeJumpHere(tls, v, jmp2) + _sqlite3VdbeJumpHere(tls, v, jmp3) + } else { + /* VDBE byte code will fall thru */ + } + } + if bStrict != 0 && doTypeCheck != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) + _sqlite3VdbeChangeP5(tls, v, uint16(_aStdTypeMask[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)])) + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18240, libc.VaList(bp+176, _sqlite3StdType[int32(uint32(*(*uint8)(unsafe.Pointer(pCol1 + 8))&0xf0>>4))-int32(1)], (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) + } else { + if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) == int32(SQLITE_AFF_TEXT) { + /* (3) Datatype for TEXT columns in non-STRICT tables must be + ** NULL, TEXT, or BLOB. */ + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) + _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18262, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) + } else { + if !(bStrict != 0) && int32((*TColumn)(unsafe.Pointer(pCol1)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) { + /* (4) Datatype for numeric columns in non-STRICT tables must not + ** be a TEXT value that can be converted to numeric. */ + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), p11, labelOk, p3, p4) + _sqlite3VdbeChangeP5(tls, v, uint16(0x1b)) /* NULL, INT, FLOAT, or BLOB */ + if p11 >= 0 { + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab9, *(*int32)(unsafe.Pointer(bp + 108)), j4, int32(3)) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), int32(3), int32(1), 0, __ccgo_ts+18285, -int32(1)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IsType), -int32(1), labelOk, int32(3), p4) + _sqlite3VdbeChangeP5(tls, v, uint16(0x1c)) /* NULL, TEXT, or BLOB */ + zErr1 = _sqlite3MPrintf(tls, db, __ccgo_ts+18287, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(j4)*16))).FzCnName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr1, -int32(6)) + } + } + } + _sqlite3VdbeResolveLabel(tls, v, labelError) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeResolveLabel(tls, v, labelOk) + goto _52 + _52: + ; + j4++ + } + /* Verify CHECK constraints */ + if (*TTable)(unsafe.Pointer(pTab9)).FpCheck != 0 && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_IgnoreChecks) == uint64(0) { + pCheck = _sqlite3ExprListDup(tls, db, (*TTable)(unsafe.Pointer(pTab9)).FpCheck, 0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + addrCkFault = _sqlite3VdbeMakeLabel(tls, pParse) + addrCkOk = _sqlite3VdbeMakeLabel(tls, pParse) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = *(*int32)(unsafe.Pointer(bp + 108)) + int32(1) + k3 = (*TExprList)(unsafe.Pointer(pCheck)).FnExpr - int32(1) + for { + if !(k3 > 0) { + break + } + _sqlite3ExprIfFalse(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8 + uintptr(k3)*32))).FpExpr, addrCkFault, 0) + goto _53 + _53: + ; + k3-- + } + _sqlite3ExprIfTrue(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pCheck + 8))).FpExpr, addrCkOk, int32(SQLITE_JUMPIFNULL)) + _sqlite3VdbeResolveLabel(tls, v, addrCkFault) + (*TParse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + zErr2 = _sqlite3MPrintf(tls, db, __ccgo_ts+18307, libc.VaList(bp+176, (*TTable)(unsafe.Pointer(pTab9)).FzName)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, int32(3), 0, zErr2, -int32(6)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeResolveLabel(tls, v, addrCkOk) + } + _sqlite3ExprListDelete(tls, db, pCheck) + } + if !(isQuick != 0) { /* Omit the remaining tests for quick_check */ + /* Validate index entries for the current row */ + j4 = 0 + pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex + for { + if !(pIdx5 != 0) { + break + } + ckUniq = _sqlite3VdbeMakeLabel(tls, pParse) + if pPk1 == pIdx5 { + goto _54 + } + r1 = _sqlite3GenerateIndexKey(tls, pParse, pIdx5, *(*int32)(unsafe.Pointer(bp + 108)), 0, 0, bp+128, pPrior, r1) + pPrior = pIdx5 + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), int32(8)+j4, int32(1)) /* increment entry count */ + /* Verify that an index entry exists for the current table row */ + jmp21 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), *(*int32)(unsafe.Pointer(bp + 112))+j4, ckUniq, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18337) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18342) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) + jmp5 = _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(3), int32(3)) + jmp4 = _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, jmp21) + /* The OP_IdxRowid opcode is an optimized version of OP_Column + ** that extracts the rowid off the end of the index record. + ** But it only works correctly if index record does not have + ** any extra bytes at the end. Verify that this is the case. */ + if (*TTable)(unsafe.Pointer(pTab9)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) + jmp7 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(3), 0, r1+int32((*TIndex)(unsafe.Pointer(pIdx5)).FnColumn)-int32(1)) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18363) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18399) + _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) + _sqlite3VdbeJumpHere(tls, v, jmp7) + } + /* Any indexed columns with non-BINARY collations must still hold + ** the exact same text value as the table. */ + label6 = 0 + kk = 0 + for { + if !(kk < int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) { + break + } + if *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx5)).FazColl + uintptr(kk)*8)) == uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) { + goto _55 + } + if label6 == 0 { + label6 = _sqlite3VdbeMakeLabel(tls, pParse) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), *(*int32)(unsafe.Pointer(bp + 112))+j4, kk, int32(3)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), int32(3), label6, r1+kk) + goto _55 + _55: + ; + kk++ + } + if label6 != 0 { + jmp6 = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) + _sqlite3VdbeResolveLabel(tls, v, label6) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18337) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(7), int32(3), int32(3)) + _sqlite3VdbeLoadString(tls, v, int32(4), __ccgo_ts+18410) + _sqlite3VdbeGoto(tls, v, jmp5-int32(1)) + _sqlite3VdbeJumpHere(tls, v, jmp6) + } + /* For UNIQUE indexes, verify that only one entry exists with the + ** current key. The entry is unique if (1) any column is NULL + ** or (2) the next entry has a different key */ + if int32((*TIndex)(unsafe.Pointer(pIdx5)).FonError) != OE_None { + uniqOk = _sqlite3VdbeMakeLabel(tls, pParse) + kk = 0 + for { + if !(kk < int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) { + break + } + iCol1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx5)).FaiColumn + uintptr(kk)*2))) + if iCol1 >= 0 && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab9)).FaCol + uintptr(iCol1)*16 + 8))&0xf>>0)) != 0 { + goto _56 + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), r1+kk, uniqOk) + goto _56 + _56: + ; + kk++ + } + jmp61 = _sqlite3VdbeAddOp1(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 112))+j4) + _sqlite3VdbeGoto(tls, v, uniqOk) + _sqlite3VdbeJumpHere(tls, v, jmp61) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxGT), *(*int32)(unsafe.Pointer(bp + 112))+j4, uniqOk, r1, int32((*TIndex)(unsafe.Pointer(pIdx5)).FnKeyCol)) + _sqlite3VdbeLoadString(tls, v, int32(3), __ccgo_ts+18437) + _sqlite3VdbeGoto(tls, v, jmp5) + _sqlite3VdbeResolveLabel(tls, v, uniqOk) + } + _sqlite3VdbeJumpHere(tls, v, jmp4) + _sqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 128))) + goto _54 + _54: + ; + pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext + j4++ + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), *(*int32)(unsafe.Pointer(bp + 108)), loopTop) + _sqlite3VdbeJumpHere(tls, v, loopTop-int32(1)) + if !(isQuick != 0) { + _sqlite3VdbeLoadString(tls, v, int32(2), __ccgo_ts+18464) + j4 = 0 + pIdx5 = (*TTable)(unsafe.Pointer(pTab9)).FpIndex + for { + if !(pIdx5 != 0) { + break + } + if pPk1 == pIdx5 { + goto _57 + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), *(*int32)(unsafe.Pointer(bp + 112))+j4, int32(3)) + addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), int32(8)+j4, 0, int32(3)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + _sqlite3VdbeLoadString(tls, v, int32(4), (*TIndex)(unsafe.Pointer(pIdx5)).FzName) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Concat), int32(4), int32(2), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, addr1) + goto _57 + _57: + ; + pIdx5 = (*TIndex)(unsafe.Pointer(pIdx5)).FpNext + j4++ + } + if pPk1 != 0 { + _sqlite3ReleaseTempRange(tls, pParse, r2, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + } + } + goto _48 + _48: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + x2 = (*THash)(unsafe.Pointer(pTbls)).Ffirst + for { + if !(x2 != 0) { + break + } + pTab10 = (*THashElem)(unsafe.Pointer(x2)).Fdata + if pObjTab != 0 && pObjTab != pTab10 { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == TABTYP_NORM { + goto _58 + } + if !(int32((*TTable)(unsafe.Pointer(pTab10)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + goto _58 + } + if int32((*TTable)(unsafe.Pointer(pTab10)).FnCol) <= 0 { + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).FazArg)) + if _sqlite3HashFind(tls, db+576, zMod) == uintptr(0) { + goto _58 + } + } + _sqlite3ViewGetColumnNames(tls, pParse, pTab10) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp == uintptr(0) { + goto _58 + } + pVTab = (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab10 + 64))).Fp)).FpVtab + if pVTab == uintptr(0) { + goto _58 + } + if (*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule == uintptr(0) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FiVersion < int32(4) { + goto _58 + } + if (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVTab)).FpModule)).FxIntegrity == uintptr(0) { + goto _58 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_VCheck), i9, int32(3), isQuick) + (*TTable)(unsafe.Pointer(pTab10)).FnTabRef++ + _sqlite3VdbeAppendP4(tls, v, pTab10, -int32(16)) + a11 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), int32(3)) + _integrityCheckResultRow(tls, v) + _sqlite3VdbeJumpHere(tls, v, a11) + goto _58 + goto _58 + _58: + ; + x2 = (*THashElem)(unsafe.Pointer(x2)).Fnext + } + goto _40 + _40: + ; + i9++ + } + aOp2 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(28)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_endCode)), _iLn21) + if aOp2 != 0 { + (*(*TVdbeOp)(unsafe.Pointer(aOp2))).Fp2 = int32(1) - *(*int32)(unsafe.Pointer(bp + 104)) + (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 2*24))).Fp4type = int8(-libc.Int32FromInt32(1)) + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16)) = __ccgo_ts + 18493 + (*(*TVdbeOp)(unsafe.Pointer(aOp2 + 5*24))).Fp4type = int8(-libc.Int32FromInt32(1)) + *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16)) = _sqlite3ErrStr(tls, int32(SQLITE_CORRUPT)) + } + _sqlite3VdbeChangeP3(tls, v, 0, _sqlite3VdbeCurrentAddr(tls, v)-int32(2)) + break + /* + ** PRAGMA encoding + ** PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be" + ** + ** In its first form, this pragma returns the encoding of the main + ** database. If the database is not initialized, it is initialized now. + ** + ** The second form of this pragma is a no-op if the main database file + ** has not already been initialized. In this case it sets the default + ** encoding that will be used for the main database file if a new file + ** is created. If an existing main database file is opened, then the + ** default text encoding for the existing database is used. + ** + ** In all cases new databases created using the ATTACH command are + ** created to use the same default text encoding as the main database. If + ** the main database has not been initialized and/or created when ATTACH + ** is executed, this is done before the ATTACH operation. + ** + ** In the second form this pragma sets the text encoding to be used in + ** new database files created using this database handle. It is only + ** useful if invoked immediately after the main database i + */ + fallthrough + case int32(PragTyp_ENCODING): + if !(zRight != 0) { /* "PRAGMA encoding" */ + if _sqlite3ReadSchema(tls, pParse) != 0 { + goto pragma_out + } + _returnSingleText(tls, v, _encnames1[(*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fenc].FzName) + } else { /* "PRAGMA encoding = XXX" */ + /* Only change the value of sqlite.enc if the database handle is not + ** initialized. If the main database exists, the new sqlite.enc value + ** will be overwritten when the schema is next loaded. If it does not + ** already exists, it will be created to use the new encoding value. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_EncodingFixed) == uint32(0) { + pEnc = uintptr(unsafe.Pointer(&_encnames1)) + for { + if !((*struct { + FzName uintptr + Fenc Tu8 + })(unsafe.Pointer(pEnc)).FzName != 0) { + break + } + if 0 == _sqlite3StrICmp(tls, zRight, (*struct { + FzName uintptr + Fenc Tu8 + })(unsafe.Pointer(pEnc)).FzName) { + if (*struct { + FzName uintptr + Fenc Tu8 + })(unsafe.Pointer(pEnc)).Fenc != 0 { + v60 = int32((*struct { + FzName uintptr + Fenc Tu8 + })(unsafe.Pointer(pEnc)).Fenc) + } else { + v60 = int32(SQLITE_UTF16LE) + } + enc = uint8(v60) + (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fenc = enc + _sqlite3SetTextEncoding(tls, db, enc) + break + } + goto _59 + _59: + ; + pEnc += 16 + } + if !((*struct { + FzName uintptr + Fenc Tu8 + })(unsafe.Pointer(pEnc)).FzName != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18554, libc.VaList(bp+176, zRight)) + } + } + } + break + /* + ** PRAGMA [schema.]schema_version + ** PRAGMA [schema.]schema_version = + ** + ** PRAGMA [schema.]user_version + ** PRAGMA [schema.]user_version = + ** + ** PRAGMA [schema.]freelist_count + ** + ** PRAGMA [schema.]data_version + ** + ** PRAGMA [schema.]application_id + ** PRAGMA [schema.]application_id = + ** + ** The pragma's schema_version and user_version are used to set or get + ** the value of the schema-version and user-version, respectively. Both + ** the schema-version and the user-version are 32-bit signed integers + ** stored in the database header. + ** + ** The schema-cookie is usually only manipulated internally by SQLite. It + ** is incremented by SQLite whenever the database schema is modified (by + ** creating or dropping a table or index). The schema version is used by + ** SQLite each time a query is executed to ensure that the internal cache + ** of the schema used when compiling the SQL query matches the schema of + ** the database against which the compiled query is actually executed. + ** Subverting this mechanism by using "PRAGMA schema_version" to modify + ** the schema-version is potentially dangerous and may lead to program + ** crashes or database corruption. Use with caution! + ** + ** The user-version is not used internally by SQLite. It may be used by + ** applications for any purpose. + */ + fallthrough + case int32(PragTyp_HEADER_VALUE): + iCookie = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiArg) /* Which cookie to read or write */ + _sqlite3VdbeUsesBtree(tls, v, iDb) + if zRight != 0 && int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_ReadOnly) == 0 { + aOp3 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_setCookie)), 0) + if 0 != 0 { + break + } + (*(*TVdbeOp)(unsafe.Pointer(aOp3))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp3 + 1*24))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp3 + 1*24))).Fp2 = iCookie + (*(*TVdbeOp)(unsafe.Pointer(aOp3 + 1*24))).Fp3 = _sqlite3Atoi(tls, zRight) + (*(*TVdbeOp)(unsafe.Pointer(aOp3 + 1*24))).Fp5 = uint16(1) + if iCookie == int32(BTREE_SCHEMA_VERSION) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_Defensive) != uint64(0) { + /* Do not allow the use of PRAGMA schema_version=VALUE in defensive + ** mode. Change the OP_SetCookie opcode into a no-op. */ + (*(*TVdbeOp)(unsafe.Pointer(aOp3 + 1*24))).Fopcode = uint8(OP_Noop) + } + } else { + aOp4 = _sqlite3VdbeAddOpList(tls, v, int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(4)), uintptr(unsafe.Pointer(&_readCookie)), 0) + if 0 != 0 { + break + } + (*(*TVdbeOp)(unsafe.Pointer(aOp4))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp4 + 1*24))).Fp1 = iDb + (*(*TVdbeOp)(unsafe.Pointer(aOp4 + 1*24))).Fp3 = iCookie + _sqlite3VdbeReusable(tls, v) + } + break + /* + ** PRAGMA compile_options + ** + ** Return the names of all compile-time options used in this build, + ** one option per row. + */ + fallthrough + case int32(PragTyp_COMPILE_OPTIONS): + i10 = 0 + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(1) + for { + v62 = i10 + i10++ + v61 = Xsqlite3_compileoption_get(tls, v62) + zOpt = v61 + if !(v61 != uintptr(0)) { + break + } + _sqlite3VdbeLoadString(tls, v, int32(1), zOpt) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(1)) + } + _sqlite3VdbeReusable(tls, v) + break + /* + ** PRAGMA [schema.]wal_checkpoint = passive|full|restart|truncate + ** + ** Checkpoint the database. + */ + fallthrough + case int32(PragTyp_WAL_CHECKPOINT): + if (*TToken)(unsafe.Pointer(pId2)).Fz != 0 { + v63 = iDb + } else { + v63 = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) + } + iBt = v63 + eMode2 = SQLITE_CHECKPOINT_PASSIVE + if zRight != 0 { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17779) == 0 { + eMode2 = int32(SQLITE_CHECKPOINT_FULL) + } else { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+18579) == 0 { + eMode2 = int32(SQLITE_CHECKPOINT_RESTART) + } else { + if _sqlite3StrICmp(tls, zRight, __ccgo_ts+17932) == 0 { + eMode2 = int32(SQLITE_CHECKPOINT_TRUNCATE) + } + } + } + } + (*TParse)(unsafe.Pointer(pParse)).FnMem = int32(3) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Checkpoint), iBt, eMode2, int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), int32(1), int32(3)) + break + /* + ** PRAGMA wal_autocheckpoint + ** PRAGMA wal_autocheckpoint = N + ** + ** Configure a database connection to automatically checkpoint a database + ** after accumulating N frames in the log. Or query for the current value + ** of N. + */ + fallthrough + case int32(PragTyp_WAL_AUTOCHECKPOINT): + if zRight != 0 { + Xsqlite3_wal_autocheckpoint(tls, db, _sqlite3Atoi(tls, zRight)) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback == __ccgo_fp(_sqlite3WalDefaultHook) { + v64 = int32(int64((*Tsqlite3)(unsafe.Pointer(db)).FpWalArg)) + } else { + v64 = 0 + } + _returnSingleInt(tls, v, int64(v64)) + break + /* + ** PRAGMA shrink_memory + ** + ** IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database + ** connection on which it is invoked to free up as much memory as it + ** can, by calling sqlite3_db_release_memory(). + */ + fallthrough + case int32(PragTyp_SHRINK_MEMORY): + Xsqlite3_db_release_memory(tls, db) + break + /* + ** PRAGMA optimize + ** PRAGMA optimize(MASK) + ** PRAGMA schema.optimize + ** PRAGMA schema.optimize(MASK) + ** + ** Attempt to optimize the database. All schemas are optimized in the first + ** two forms, and only the specified schema is optimized in the latter two. + ** + ** The details of optimizations performed by this pragma are expected + ** to change and improve over time. Applications should anticipate that + ** this pragma will perform new optimizations in future releases. + ** + ** The optional argument is a bitmask of optimizations to perform: + ** + ** 0x0001 Debugging mode. Do not actually perform any optimizations + ** but instead return one line of text for each optimization + ** that would have been done. Off by default. + ** + ** 0x0002 Run ANALYZE on tables that might benefit. On by default. + ** See below for additional information. + ** + ** 0x0004 (Not yet implemented) Record usage and performance + ** information from the current session in the + ** database file so that it will be available to "optimize" + ** pragmas run by future database connections. + ** + ** 0x0008 (Not yet implemented) Create indexes that might have + ** been helpful to recent queries + ** + ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all + ** of the optimizations listed above except Debug Mode, including new + ** optimizations that have not yet been invented. If new optimizations are + ** ever added that should be off by default, those off-by-default + ** optimizations will have bitmasks of 0x10000 or larger. + ** + ** DETERMINATION OF WHEN TO RUN ANALYZE + ** + ** In the current implementation, a table is analyzed if only if all of + ** the following are true: + ** + ** (1) MASK bit 0x02 is set. + ** + ** (2) The query planner used sqlite_stat1-style statistics for one or + ** more indexes of the table at some point during the lifetime of + ** the current connection. + ** + ** (3) One or more indexes of the table are currently unanalyzed OR + ** the number of rows in the table has increased by 25 times or more + ** since the last time ANALYZE was run. + ** + ** The rules for when tables are analyzed are likely to change in + ** future releases. + */ + fallthrough + case int32(PragTyp_OPTIMIZE): /* Mask of operations to perform */ + if zRight != 0 { + opMask = uint32(_sqlite3Atoi(tls, zRight)) + if opMask&uint32(0x02) == uint32(0) { + break + } + } else { + opMask = uint32(0xfffe) + } + v66 = pParse + 52 + v65 = *(*int32)(unsafe.Pointer(v66)) + *(*int32)(unsafe.Pointer(v66))++ + iTabCur = v65 + if zDb != 0 { + v68 = iDb + } else { + v68 = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + } + iDbLast = v68 + for { + if !(iDb <= iDbLast) { + break + } + if iDb == int32(1) { + goto _67 + } + _sqlite3CodeVerifySchema(tls, pParse, iDb) + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + k4 = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst + for { + if !(k4 != 0) { + break + } + pTab11 = (*THashElem)(unsafe.Pointer(k4)).Fdata + /* If table pTab has not been used in a way that would benefit from + ** having analysis statistics during the current session, then skip it. + ** This also has the effect of skipping virtual tables and views */ + if (*TTable)(unsafe.Pointer(pTab11)).FtabFlags&uint32(TF_StatsUsed) == uint32(0) { + goto _69 + } + /* Reanalyze if the table is 25 times larger than the last analysis */ + szThreshold = int16(int32((*TTable)(unsafe.Pointer(pTab11)).FnRowLogEst) + int32(46)) + pIdx6 = (*TTable)(unsafe.Pointer(pTab11)).FpIndex + for { + if !(pIdx6 != 0) { + break + } + if !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx6 + 100))&0x80>>7)) != 0) { + szThreshold = 0 /* Always analyze if any index lacks statistics */ + break + } + goto _70 + _70: + ; + pIdx6 = (*TIndex)(unsafe.Pointer(pIdx6)).FpNext + } + if szThreshold != 0 { + _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab11, int32(OP_OpenRead)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_IfSmaller), iTabCur, int32(uint32(_sqlite3VdbeCurrentAddr(tls, v)+int32(2))+opMask&uint32(1)), int32(szThreshold)) + } + zSubSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18587, libc.VaList(bp+176, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab11)).FzName)) + if opMask&uint32(0x01) != 0 { + r11 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, r11, 0, zSubSql, -int32(6)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), r11, int32(1)) + } else { + _sqlite3VdbeAddOp4(tls, v, int32(OP_SqlExec), 0, 0, 0, zSubSql, -int32(6)) + } + goto _69 + _69: + ; + k4 = (*THashElem)(unsafe.Pointer(k4)).Fnext + } + goto _67 + _67: + ; + iDb++ + } + _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) + break + /* + ** PRAGMA busy_timeout + ** PRAGMA busy_timeout = N + ** + ** Call sqlite3_busy_timeout(db, N). Return the current timeout value + ** if one is set. If no busy handler or a different busy handler is set + ** then 0 is returned. Setting the busy_timeout to 0 or negative + ** disables the timeout. + */ + /*case PragTyp_BUSY_TIMEOUT*/ + fallthrough + default: + if zRight != 0 { + Xsqlite3_busy_timeout(tls, db, _sqlite3Atoi(tls, zRight)) + } + _returnSingleInt(tls, v, int64((*Tsqlite3)(unsafe.Pointer(db)).FbusyTimeout)) + break + /* + ** PRAGMA soft_heap_limit + ** PRAGMA soft_heap_limit = N + ** + ** IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the + ** sqlite3_soft_heap_limit64() interface with the argument N, if N is + ** specified and is a non-negative integer. + ** IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always + ** returns the same integer that would be returned by the + ** sqlite3_soft_heap_limit64(-1) C-language function. + */ + fallthrough + case int32(PragTyp_SOFT_HEAP_LIMIT): + if zRight != 0 && _sqlite3DecOrHexToI64(tls, zRight, bp+136) == SQLITE_OK { + Xsqlite3_soft_heap_limit64(tls, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 136))) + } + _returnSingleInt(tls, v, Xsqlite3_soft_heap_limit64(tls, int64(-int32(1)))) + break + /* + ** PRAGMA hard_heap_limit + ** PRAGMA hard_heap_limit = N + ** + ** Invoke sqlite3_hard_heap_limit64() to query or set the hard heap + ** limit. The hard heap limit can be activated or lowered by this + ** pragma, but not raised or deactivated. Only the + ** sqlite3_hard_heap_limit64() C-language API can raise or deactivate + ** the hard heap limit. This allows an application to set a heap limit + ** constraint that cannot be relaxed by an untrusted SQL script. + */ + fallthrough + case int32(PragTyp_HARD_HEAP_LIMIT): + if zRight != 0 && _sqlite3DecOrHexToI64(tls, zRight, bp+144) == SQLITE_OK { + iPrior = Xsqlite3_hard_heap_limit64(tls, int64(-int32(1))) + if *(*Tsqlite3_int64)(unsafe.Pointer(bp + 144)) > 0 && (iPrior == 0 || iPrior > *(*Tsqlite3_int64)(unsafe.Pointer(bp + 144))) { + Xsqlite3_hard_heap_limit64(tls, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 144))) + } + } + _returnSingleInt(tls, v, Xsqlite3_hard_heap_limit64(tls, int64(-int32(1)))) + break + /* + ** PRAGMA threads + ** PRAGMA threads = N + ** + ** Configure the maximum number of worker threads. Return the new + ** maximum, which might be less than requested. + */ + fallthrough + case int32(PragTyp_THREADS): + if zRight != 0 && _sqlite3DecOrHexToI64(tls, zRight, bp+152) == SQLITE_OK && *(*Tsqlite3_int64)(unsafe.Pointer(bp + 152)) >= 0 { + Xsqlite3_limit(tls, db, int32(SQLITE_LIMIT_WORKER_THREADS), int32(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 152))&libc.Int64FromInt32(0x7fffffff))) + } + _returnSingleInt(tls, v, int64(Xsqlite3_limit(tls, db, int32(SQLITE_LIMIT_WORKER_THREADS), -int32(1)))) + break + /* + ** PRAGMA analysis_limit + ** PRAGMA analysis_limit = N + ** + ** Configure the maximum number of rows that ANALYZE will examine + ** in each index that it looks at. Return the new limit. + */ + fallthrough + case int32(PragTyp_ANALYSIS_LIMIT): + if zRight != 0 && _sqlite3DecOrHexToI64(tls, zRight, bp+160) == SQLITE_OK && *(*Tsqlite3_int64)(unsafe.Pointer(bp + 160)) >= 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit = int32(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 160)) & libc.Int64FromInt32(0x7fffffff)) + } + _returnSingleInt(tls, v, int64((*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit)) /* IMP: R-57594-65522 */ + break + } /* End of the PRAGMA switch */ + /* The following block is a no-op unless SQLITE_DEBUG is defined. Its only + ** purpose is to execute assert() statements to verify that if the + ** PragFlg_NoColumns1 flag is set and the caller specified an argument + ** to the PRAGMA, the implementation has not added any OP_ResultRow + ** instructions to the VM. */ + if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_NoColumns1) != 0 && zRight != 0 { + } +pragma_out: + ; + _sqlite3DbFree(tls, db, zLeft) + _sqlite3DbFree(tls, db, zRight) +} + +var _iLn3 int32 + +var _getCacheSize = [9]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_Transaction), + }, + 1: { + Fopcode: uint8(OP_ReadCookie), + Fp2: int8(1), + Fp3: int8(BTREE_DEFAULT_CACHE_SIZE), + }, + 2: { + Fopcode: uint8(OP_IfPos), + Fp1: int8(1), + Fp2: int8(8), + }, + 3: { + Fopcode: uint8(OP_Integer), + Fp2: int8(2), + }, + 4: { + Fopcode: uint8(OP_Subtract), + Fp1: int8(1), + Fp2: int8(2), + Fp3: int8(1), + }, + 5: { + Fopcode: uint8(OP_IfPos), + Fp1: int8(1), + Fp2: int8(8), + }, + 6: { + Fopcode: uint8(OP_Integer), + Fp2: int8(1), + }, + 7: { + Fopcode: uint8(OP_Noop), + }, + 8: { + Fopcode: uint8(OP_ResultRow), + Fp1: int8(1), + Fp2: int8(1), + }, +} + +/* When setting the auto_vacuum mode to either "full" or + ** "incremental", write the value of meta[6] in the database + ** file. Before writing to meta[6], check that meta[3] indicates + ** that this really is an auto-vacuum capable database. + */ +var _iLn11 int32 + +var _setMeta6 = [5]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_Transaction), + Fp2: int8(1), + }, + 1: { + Fopcode: uint8(OP_ReadCookie), + Fp2: int8(1), + Fp3: int8(BTREE_LARGEST_ROOT_PAGE), + }, + 2: { + Fopcode: uint8(OP_If), + Fp1: int8(1), + }, + 3: { + Fopcode: uint8(OP_Halt), + Fp2: int8(OE_Abort), + }, + 4: { + Fopcode: uint8(OP_SetCookie), + Fp2: int8(BTREE_INCR_VACUUM), + }, +} + +/* (2) Datatype must be exact for non-ANY columns in STRICT tables*/ +var _aStdTypeMask = [6]uint8{ + 0: uint8(0x1f), + 1: uint8(0x18), + 2: uint8(0x11), + 3: uint8(0x11), + 4: uint8(0x13), + 5: uint8(0x14), +} + +var _iLn21 int32 + +var _endCode = [7]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_AddImm), + Fp1: int8(1), + }, + 1: { + Fopcode: uint8(OP_IfNotZero), + Fp1: int8(1), + Fp2: int8(4), + }, + 2: { + Fopcode: uint8(OP_String8), + Fp2: int8(3), + }, + 3: { + Fopcode: uint8(OP_ResultRow), + Fp1: int8(3), + Fp2: int8(1), + }, + 4: { + Fopcode: uint8(OP_Halt), + }, + 5: { + Fopcode: uint8(OP_String8), + Fp2: int8(3), + }, + 6: { + Fopcode: uint8(OP_Goto), + Fp2: int8(3), + }, +} + +var _encnames1 = [9]struct { + FzName uintptr + Fenc Tu8 +}{ + 0: { + FzName: __ccgo_ts + 18496, + Fenc: uint8(SQLITE_UTF8), + }, + 1: { + FzName: __ccgo_ts + 18501, + Fenc: uint8(SQLITE_UTF8), + }, + 2: { + FzName: __ccgo_ts + 18507, + Fenc: uint8(SQLITE_UTF16LE), + }, + 3: { + FzName: __ccgo_ts + 18516, + Fenc: uint8(SQLITE_UTF16BE), + }, + 4: { + FzName: __ccgo_ts + 18525, + Fenc: uint8(SQLITE_UTF16LE), + }, + 5: { + FzName: __ccgo_ts + 18533, + Fenc: uint8(SQLITE_UTF16BE), + }, + 6: { + FzName: __ccgo_ts + 18541, + }, + 7: { + FzName: __ccgo_ts + 18548, + }, + 8: {}, +} + +/* Write the specified cookie value */ +var _setCookie = [2]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_Transaction), + Fp2: int8(1), + }, + 1: { + Fopcode: uint8(OP_SetCookie), + }, +} + +/* Read the specified cookie value */ +var _readCookie = [3]TVdbeOpList{ + 0: { + Fopcode: uint8(OP_Transaction), + }, + 1: { + Fopcode: uint8(OP_ReadCookie), + Fp2: int8(1), + }, + 2: { + Fopcode: uint8(OP_ResultRow), + Fp1: int8(1), + Fp2: int8(1), + }, +} + +// C documentation +// +// /***************************************************************************** +// ** Implementation of an eponymous virtual table that runs a pragma. +// ** +// */ +type TPragmaVtab = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FpName uintptr + FnHidden Tu8 + FiHidden Tu8 +} + +type PragmaVtab = TPragmaVtab + +type TPragmaVtabCursor = struct { + Fbase Tsqlite3_vtab_cursor + FpPragma uintptr + FiRowid Tsqlite_int64 + FazArg [2]uintptr +} + +type PragmaVtabCursor = TPragmaVtabCursor + +type TPragmaVtab1 = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FpName uintptr + FnHidden Tu8 + FiHidden Tu8 +} + +type PragmaVtab1 = TPragmaVtab1 + +type TPragmaVtabCursor1 = struct { + Fbase Tsqlite3_vtab_cursor + FpPragma uintptr + FiRowid Tsqlite_int64 + FazArg [2]uintptr +} + +type PragmaVtabCursor1 = TPragmaVtabCursor1 + +// C documentation +// +// /* +// ** Pragma virtual table module xConnect method. +// */ +func _pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(256) + defer tls.Free(256) + var cSep int8 + var i, j, rc int32 + var pPragma, pTab uintptr + var _ /* acc at bp+0 */ TStrAccum + var _ /* zBuf at bp+32 */ [200]int8 + _, _, _, _, _, _ = cSep, i, j, pPragma, pTab, rc + pPragma = pAux + pTab = uintptr(0) + cSep = int8('(') + _ = argc + _ = argv + _sqlite3StrAccumInit(tls, bp, uintptr(0), bp+32, int32(200), 0) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18605) + i = 0 + j = int32((*TPragmaName)(unsafe.Pointer(pPragma)).FiPragCName) + for { + if !(i < int32((*TPragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { + break + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18620, libc.VaList(bp+240, int32(cSep), _pragCName[j])) + cSep = int8(',') + goto _1 + _1: + ; + i++ + j++ + } + if i == 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18627, libc.VaList(bp+240, (*TPragmaName)(unsafe.Pointer(pPragma)).FzName)) + i++ + } + j = 0 + if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&int32(PragFlg_Result1) != 0 { + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18633) + j++ + } + if int32((*TPragmaName)(unsafe.Pointer(pPragma)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_SchemaOpt)|libc.Int32FromInt32(PragFlg_SchemaReq)) != 0 { + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18645) + j++ + } + Xsqlite3_str_append(tls, bp, __ccgo_ts+5138, int32(1)) + _sqlite3StrAccumFinish(tls, bp) + rc = Xsqlite3_declare_vtab(tls, db, bp+32) + if rc == SQLITE_OK { + pTab = Xsqlite3_malloc(tls, int32(48)) + if pTab == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pTab, 0, uint64(48)) + (*TPragmaVtab)(unsafe.Pointer(pTab)).FpName = pPragma + (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb = db + (*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden = uint8(i) + (*TPragmaVtab)(unsafe.Pointer(pTab)).FnHidden = uint8(j) + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+240, Xsqlite3_errmsg(tls, db))) + } + *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab + return rc +} + +// C documentation +// +// /* +// ** Pragma virtual table module xDisconnect method. +// */ +func _pragmaVtabDisconnect(tls *libc.TLS, pVtab uintptr) (r int32) { + var pTab uintptr + _ = pTab + pTab = pVtab + Xsqlite3_free(tls, pTab) + return SQLITE_OK +} + +// C documentation +// +// /* Figure out the best index to use to search a pragma virtual table. +// ** +// ** There are not really any index choices. But we want to encourage the +// ** query planner to give == constraints on as many hidden parameters as +// ** possible, and especially on the first hidden parameter. So return a +// ** high cost if hidden parameters are unconstrained. +// */ +func _pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { + var i, j int32 + var pConstraint, pTab uintptr + var seen [2]int32 + _, _, _, _, _ = i, j, pConstraint, pTab, seen + pTab = tab + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1) + if int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FnHidden) == 0 { + return SQLITE_OK + } + pConstraint = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + seen[0] = 0 + seen[int32(1)] = 0 + i = 0 + for { + if !(i < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + break + } + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 { + goto _1 + } + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != int32(SQLITE_INDEX_CONSTRAINT_EQ) { + goto _1 + } + if (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden) { + goto _1 + } + j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden) + seen[j] = i + int32(1) + goto _1 + _1: + ; + i++ + pConstraint += 12 + } + if seen[0] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(2147483647) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647) + return SQLITE_OK + } + j = seen[0] - int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) + if seen[int32(1)] == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(1000) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000) + return SQLITE_OK + } + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromInt32(20) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(20) + j = seen[int32(1)] - int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).FargvIndex = int32(2) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8))).Fomit = uint8(1) + return SQLITE_OK +} + +// C documentation +// +// /* Create a new cursor for the pragma virtual table */ +func _pragmaVtabOpen(tls *libc.TLS, pVtab uintptr, ppCursor uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = Xsqlite3_malloc(tls, int32(40)) + if pCsr == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pCsr, 0, uint64(40)) + (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab = pVtab + *(*uintptr)(unsafe.Pointer(ppCursor)) = pCsr + return SQLITE_OK +} + +// C documentation +// +// /* Clear all content from pragma virtual table cursor. */ +func _pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { + var i int32 + _ = i + Xsqlite3_finalize(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) + (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma = uintptr(0) + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(16)/libc.Uint64FromInt64(8))) { + break + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i)*8)) = uintptr(0) + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* Close a pragma virtual table cursor */ +func _pragmaVtabClose(tls *libc.TLS, cur uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = cur + _pragmaVtabCursorClear(tls, pCsr) + Xsqlite3_free(tls, pCsr) + return SQLITE_OK +} + +// C documentation +// +// /* Advance the pragma virtual table cursor to the next row */ +func _pragmaVtabNext(tls *libc.TLS, pVtabCursor uintptr) (r int32) { + var pCsr uintptr + var rc int32 + _, _ = pCsr, rc + pCsr = pVtabCursor + rc = SQLITE_OK + /* Increment the xRowid value */ + (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FiRowid++ + if int32(SQLITE_ROW) != Xsqlite3_step(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) { + rc = Xsqlite3_finalize(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) + (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma = uintptr(0) + _pragmaVtabCursorClear(tls, pCsr) + } + return rc +} + +// C documentation +// +// /* +// ** Pragma virtual table module xFilter method. +// */ +func _pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, j, rc, v1 int32 + var pCsr, pTab, zSql, zText uintptr + var _ /* acc at bp+0 */ TStrAccum + _, _, _, _, _, _, _, _ = i, j, pCsr, pTab, rc, zSql, zText, v1 + pCsr = pVtabCursor + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + _ = idxNum + _ = idxStr + _pragmaVtabCursorClear(tls, pCsr) + if int32((*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FmPragFlg)&int32(PragFlg_Result1) != 0 { + v1 = 0 + } else { + v1 = int32(1) + } + j = v1 + i = 0 + for { + if !(i < argc) { + break + } + zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if zText != 0 { + *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(j)*8)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+40, zText)) + if *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(j)*8)) == uintptr(0) { + return int32(SQLITE_NOMEM) + } + } + goto _2 + _2: + ; + i++ + j++ + } + _sqlite3StrAccumInit(tls, bp, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb + 136 + 1*4))) + Xsqlite3_str_appendall(tls, bp, __ccgo_ts+18660) + if *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)) != 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18668, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24 + 1*8)))) + } + Xsqlite3_str_appendall(tls, bp, (*TPragmaName)(unsafe.Pointer((*TPragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) + if *(*uintptr)(unsafe.Pointer(pCsr + 24)) != 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+18672, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pCsr + 24)))) + } + zSql = _sqlite3StrAccumFinish(tls, bp) + if zSql == uintptr(0) { + return int32(SQLITE_NOMEM) + } + rc = Xsqlite3_prepare_v2(tls, (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), pCsr+8, uintptr(0)) + Xsqlite3_free(tls, zSql) + if rc != SQLITE_OK { + (*TPragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+40, Xsqlite3_errmsg(tls, (*TPragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + return rc + } + return _pragmaVtabNext(tls, pVtabCursor) +} + +// C documentation +// +// /* +// ** Pragma virtual table module xEof method. +// */ +func _pragmaVtabEof(tls *libc.TLS, pVtabCursor uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = pVtabCursor + return libc.BoolInt32((*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma == uintptr(0)) +} + +// C documentation +// +// /* The xColumn method simply returns the corresponding column from +// ** the PRAGMA. +// */ +func _pragmaVtabColumn(tls *libc.TLS, pVtabCursor uintptr, ctx uintptr, i int32) (r int32) { + var pCsr, pTab uintptr + _, _ = pCsr, pTab + pCsr = pVtabCursor + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + if i < int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden) { + Xsqlite3_result_value(tls, ctx, Xsqlite3_column_value(tls, (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma, i)) + } else { + Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer(pCsr + 24 + uintptr(i-int32((*TPragmaVtab)(unsafe.Pointer(pTab)).FiHidden))*8)), -int32(1), uintptr(-libc.Int32FromInt32(1))) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Pragma virtual table module xRowid method. +// */ +func _pragmaVtabRowid(tls *libc.TLS, pVtabCursor uintptr, p uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = pVtabCursor + *(*Tsqlite_int64)(unsafe.Pointer(p)) = (*TPragmaVtabCursor)(unsafe.Pointer(pCsr)).FiRowid + return SQLITE_OK +} + +// C documentation +// +// /* The pragma virtual table object */ +var _pragmaVtabModule = Tsqlite3_module{} + +func init() { + p := unsafe.Pointer(&_pragmaVtabModule) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_pragmaVtabConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_pragmaVtabBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_pragmaVtabDisconnect) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_pragmaVtabOpen) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_pragmaVtabClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_pragmaVtabFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_pragmaVtabNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_pragmaVtabEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_pragmaVtabColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_pragmaVtabRowid) +} + +// C documentation +// +// /* +// ** Check to see if zTabName is really the name of a pragma. If it is, +// ** then register an eponymous virtual table for that pragma and return +// ** a pointer to the Module object for the new virtual table. +// */ +func _sqlite3PragmaVtabRegister(tls *libc.TLS, db uintptr, zName uintptr) (r uintptr) { + var pName uintptr + _ = pName + pName = _pragmaLocate(tls, zName+uintptr(7)) + if pName == uintptr(0) { + return uintptr(0) + } + if int32((*TPragmaName)(unsafe.Pointer(pName)).FmPragFlg)&(libc.Int32FromInt32(PragFlg_Result0)|libc.Int32FromInt32(PragFlg_Result1)) == 0 { + return uintptr(0) + } + return _sqlite3VtabCreateModule(tls, db, zName, uintptr(unsafe.Pointer(&_pragmaVtabModule)), pName, uintptr(0)) +} + +/************** End of pragma.c **********************************************/ +/************** Begin file prepare.c *****************************************/ +/* +** 2005 May 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the implementation of the sqlite3_prepare() +** interface, and routines that contribute to loading the database schema +** from disk. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Fill the InitData structure with an error message that indicates +// ** that the database is corrupt. +// */ +func _corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var db, z, zObj, v1 uintptr + _, _, _, _ = db, z, zObj, v1 + db = (*TInitData)(unsafe.Pointer(pData)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_NOMEM) + } else { + if *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) != uintptr(0) { + /* A error message has already been generated. Do not overwrite it */ + } else { + if (*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(libc.Int32FromInt32(INITFLAG_AlterMask)) != 0 { + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = _sqlite3MPrintf(tls, db, __ccgo_ts+18706, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), _azAlterType[(*TInitData)(unsafe.Pointer(pData)).FmInitFlags&uint32(INITFLAG_AlterMask)-uint32(1)], zExtra)) + (*TInitData)(unsafe.Pointer(pData)).Frc = int32(SQLITE_ERROR) + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_WriteSchema) != 0 { + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140891)) + } else { + if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { + v1 = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) + } else { + v1 = __ccgo_ts + 5140 + } + zObj = v1 + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18734, libc.VaList(bp+8, zObj)) + if zExtra != 0 && *(*int8)(unsafe.Pointer(zExtra)) != 0 { + z = _sqlite3MPrintf(tls, db, __ccgo_ts+18765, libc.VaList(bp+8, z, zExtra)) + } + *(*uintptr)(unsafe.Pointer((*TInitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z + (*TInitData)(unsafe.Pointer(pData)).Frc = _sqlite3CorruptError(tls, int32(140898)) + } + } + } + } +} + +var _azAlterType = [3]uintptr{ + 0: __ccgo_ts + 18676, + 1: __ccgo_ts + 18683, + 2: __ccgo_ts + 18695, +} + +// C documentation +// +// /* +// ** Check to see if any sibling index (another index on the same table) +// ** of pIndex has the same root page number, and if it does, return true. +// ** This would indicate a corrupt schema. +// */ +func _sqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) (r int32) { + var p uintptr + _ = p + p = (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FpIndex + for { + if !(p != 0) { + break + } + if (*TIndex)(unsafe.Pointer(p)).Ftnum == (*TIndex)(unsafe.Pointer(pIndex)).Ftnum && p != pIndex { + return int32(1) + } + goto _1 + _1: + ; + p = (*TIndex)(unsafe.Pointer(p)).FpNext + } + return 0 +} + +// C documentation +// +// /* +// ** This is the callback routine for the code that initializes the +// ** database. See sqlite3Init() below for additional information. +// ** This routine is also called from the OP_ParseSchema opcode of the VDBE. +// ** +// ** Each callback contains the following information: +// ** +// ** argv[0] = type of object: "table", "index", "trigger", or "view". +// ** argv[1] = name of thing being created +// ** argv[2] = associated table if an index or trigger +// ** argv[3] = root page number for table or index. 0 for trigger or view. +// ** argv[4] = SQL text for the CREATE statement. +// ** +// */ +func _sqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr, NotUsed uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pData, pIndex uintptr + var iDb, rc int32 + var saved_iDb Tu8 + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _ = db, iDb, pData, pIndex, rc, saved_iDb + pData = pInit + db = (*TInitData)(unsafe.Pointer(pData)).Fdb + iDb = (*TInitData)(unsafe.Pointer(pData)).FiDb + _ = NotUsed + _ = argc + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_EncodingFixed) + if argv == uintptr(0) { + return 0 + } /* Might happen if EMPTY_RESULT_CALLBACKS are on */ + (*TInitData)(unsafe.Pointer(pData)).FnInitRow++ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _corruptSchema(tls, pData, argv, uintptr(0)) + return int32(1) + } + if *(*uintptr)(unsafe.Pointer(argv + 3*8)) == uintptr(0) { + _corruptSchema(tls, pData, argv, uintptr(0)) + } else { + if *(*uintptr)(unsafe.Pointer(argv + 4*8)) != 0 && int32('c') == int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)))))]) && int32('r') == int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)) + 1)))]) { + saved_iDb = (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb + /* Return code from sqlite3_prepare() */ + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(iDb) + if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), db+192) == 0 || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FnewTnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage && (*TInitData)(unsafe.Pointer(pData)).FmxPage > uint32(0) { + if _sqlite3Config.FbExtraSchemaChecks != 0 { + _corruptSchema(tls, pData, argv, __ccgo_ts+14548) + } + } + libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(0), 0, 0x1) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit = argv + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3Prepare(tls, db, *(*uintptr)(unsafe.Pointer(argv + 4*8)), -int32(1), uint32(0), uintptr(0), bp, uintptr(0)) + rc = (*Tsqlite3)(unsafe.Pointer(db)).FerrCode + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = saved_iDb + /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */ + if SQLITE_OK != rc { + if int32(uint32(*(*uint8)(unsafe.Pointer(db + 192 + 8))&0x1>>0)) != 0 { + } else { + if rc > (*TInitData)(unsafe.Pointer(pData)).Frc { + (*TInitData)(unsafe.Pointer(pData)).Frc = rc + } + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } else { + if rc != int32(SQLITE_INTERRUPT) && rc&int32(0xFF) != int32(SQLITE_LOCKED) { + _corruptSchema(tls, pData, argv, Xsqlite3_errmsg(tls, db)) + } + } + } + } + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit = uintptr(unsafe.Pointer(&_sqlite3StdType)) /* Any array of string ptrs will do */ + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } else { + if *(*uintptr)(unsafe.Pointer(argv + 1*8)) == uintptr(0) || *(*uintptr)(unsafe.Pointer(argv + 4*8)) != uintptr(0) && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8))))) != 0 { + _corruptSchema(tls, pData, argv, uintptr(0)) + } else { + pIndex = _sqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + if pIndex == uintptr(0) { + _corruptSchema(tls, pData, argv, __ccgo_ts+18773) + } else { + if _sqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), pIndex+88) == 0 || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum < uint32(2) || (*TIndex)(unsafe.Pointer(pIndex)).Ftnum > (*TInitData)(unsafe.Pointer(pData)).FmxPage || _sqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0 { + if _sqlite3Config.FbExtraSchemaChecks != 0 { + _corruptSchema(tls, pData, argv, __ccgo_ts+14548) + } + } + } + } + } + } + return 0 +} + +// C documentation +// +// /* +// ** Attempt to read the database schema and initialize internal +// ** data structures for a single database file. The index of the +// ** database file is given by iDb. iDb==0 is used for the main +// ** database. iDb==1 should never be used. iDb>=2 is used for +// ** auxiliary databases. Return one of the SQLITE_ error codes to +// ** indicate success or failure. +// */ +func _sqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFlags Tu32) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var encoding Tu8 + var i, mask, openedTransaction, rc, size int32 + var pDb, zSchemaTabName, zSql, v1, v2, p3, p5 uintptr + var xAuth Tsqlite3_xauth + var _ /* azArg at bp+0 */ [6]uintptr + var _ /* initData at bp+72 */ TInitData + var _ /* meta at bp+48 */ [5]int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = encoding, i, mask, openedTransaction, pDb, rc, size, xAuth, zSchemaTabName, zSql, v1, v2, p3, p5 + openedTransaction = 0 + mask = int32((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&libc.Uint32FromInt32(DBFLAG_EncodingFixed) | uint32(^libc.Int32FromInt32(DBFLAG_EncodingFixed))) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(1) + /* Construct the in-memory representation schema tables (sqlite_schema or + ** sqlite_temp_schema) by invoking the parser directly. The appropriate + ** table name will be inserted automatically by the parser so we can just + ** use the abbreviation "x" here. The parser will also automatically tag + ** the schema table as read-only. */ + (*(*[6]uintptr)(unsafe.Pointer(bp)))[0] = __ccgo_ts + 9090 + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v2 = __ccgo_ts + 6565 + } else { + v2 = __ccgo_ts + 6098 + } + v1 = v2 + zSchemaTabName = v1 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] = v1 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(2)] = (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(1)] + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(3)] = __ccgo_ts + 8162 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(4)] = __ccgo_ts + 18786 + (*(*[6]uintptr)(unsafe.Pointer(bp)))[int32(5)] = uintptr(0) + (*(*TInitData)(unsafe.Pointer(bp + 72))).Fdb = db + (*(*TInitData)(unsafe.Pointer(bp + 72))).FiDb = iDb + (*(*TInitData)(unsafe.Pointer(bp + 72))).Frc = SQLITE_OK + (*(*TInitData)(unsafe.Pointer(bp + 72))).FpzErrMsg = pzErrMsg + (*(*TInitData)(unsafe.Pointer(bp + 72))).FmInitFlags = mFlags + (*(*TInitData)(unsafe.Pointer(bp + 72))).FnInitRow = uint32(0) + (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = uint32(0) + _sqlite3InitCallback(tls, bp+72, int32(5), bp, uintptr(0)) + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(mask) + if (*(*TInitData)(unsafe.Pointer(bp + 72))).Frc != 0 { + rc = (*(*TInitData)(unsafe.Pointer(bp + 72))).Frc + goto error_out + } + /* Create a cursor to hold the database open + */ + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + if (*TDb)(unsafe.Pointer(pDb)).FpBt == uintptr(0) { + p3 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(DB_SchemaLoaded)) + rc = SQLITE_OK + goto error_out + } + /* If there is not already a read-only (or read-write) transaction opened + ** on the b-tree database, open one now. If a transaction is opened, it + ** will be closed before this function returns. */ + _sqlite3BtreeEnter(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + if _sqlite3BtreeTxnState(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) == SQLITE_TXN_NONE { + rc = _sqlite3BtreeBeginTrans(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, 0, uintptr(0)) + if rc != SQLITE_OK { + _sqlite3SetString(tls, pzErrMsg, db, _sqlite3ErrStr(tls, rc)) + goto initone_error_out + } + openedTransaction = int32(1) + } + /* Get the database meta information. + ** + ** Meta values are as follows: + ** meta[0] Schema cookie. Changes with each schema change. + ** meta[1] File format of schema layer. + ** meta[2] Size of the page cache. + ** meta[3] Largest rootpage (auto/incr_vacuum mode) + ** meta[4] Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE + ** meta[5] User version + ** meta[6] Incremental vacuum mode + ** meta[7] unused + ** meta[8] unused + ** meta[9] unused + ** + ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to + ** the possible values of meta[4]. + */ + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(20)/libc.Uint64FromInt64(4))) { + break + } + _sqlite3BtreeGetMeta(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, i+int32(1), bp+48+uintptr(i)*4) + goto _4 + _4: + ; + i++ + } + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ResetDatabase) != uint64(0) { + libc.Xmemset(tls, bp+48, 0, uint64(20)) + } + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fschema_cookie = (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_SCHEMA_VERSION)-libc.Int32FromInt32(1)] + /* If opening a non-empty database, check the text encoding. For the + ** main database, set sqlite3.enc to the encoding of the main database. + ** For an attached db, it is an error if the encoding is not the same + ** as sqlite3.enc. + */ + if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)] != 0 { /* text encoding */ + if iDb == 0 && (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_EncodingFixed) == uint32(0) { + /* If opening the main database, set ENC(db). */ + encoding = uint8(int32(uint8((*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)])) & int32(3)) + if int32(encoding) == 0 { + encoding = uint8(SQLITE_UTF8) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > 0 && int32(encoding) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) && (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_Vacuum) == uint32(0) { + rc = int32(SQLITE_LOCKED) + goto initone_error_out + } else { + _sqlite3SetTextEncoding(tls, db, encoding) + } + } else { + /* If opening an attached database, the encoding much match ENC(db) */ + if (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_TEXT_ENCODING)-libc.Int32FromInt32(1)]&int32(3) != int32((*Tsqlite3)(unsafe.Pointer(db)).Fenc) { + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+12127) + rc = int32(SQLITE_ERROR) + goto initone_error_out + } + } + } + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fenc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + if (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size == 0 { + size = _sqlite3AbsInt32(tls, (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_DEFAULT_CACHE_SIZE)-libc.Int32FromInt32(1)]) + if size == 0 { + size = -int32(2000) + } + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size + _sqlite3BtreeSetCacheSize(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt, (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) + } + /* + ** file_format==1 Version 3.0.0. + ** file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN + ** file_format==3 Version 3.1.4. // ditto but with non-NULL defaults + ** file_format==4 Version 3.3.0. // DESC indices. Boolean constants + */ + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8((*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_FILE_FORMAT)-libc.Int32FromInt32(1)]) + if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) == 0 { + (*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = uint8(1) + } + if int32((*TSchema)(unsafe.Pointer((*TDb)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > int32(SQLITE_MAX_FILE_FORMAT) { + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+18858) + rc = int32(SQLITE_ERROR) + goto initone_error_out + } + /* Ticket #2804: When we open a database in the newer file format, + ** clear the legacy_file_format pragma flag so that a VACUUM will + ** not downgrade the database and thus invalidate any descending + ** indices that the user might have created. + */ + if iDb == 0 && (*(*[5]int32)(unsafe.Pointer(bp + 48)))[libc.Int32FromInt32(BTREE_FILE_FORMAT)-libc.Int32FromInt32(1)] >= int32(4) { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_LegacyFileFmt) + } + /* Read the schema information out of the schema tables + */ + (*(*TInitData)(unsafe.Pointer(bp + 72))).FmxPage = _sqlite3BtreeLastPage(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + zSql = _sqlite3MPrintf(tls, db, __ccgo_ts+18882, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zSchemaTabName)) + xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3InitCallback), bp+72, uintptr(0)) + (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + if rc == SQLITE_OK { + rc = (*(*TInitData)(unsafe.Pointer(bp + 72))).Frc + } + _sqlite3DbFree(tls, db, zSql) + if rc == SQLITE_OK { + _sqlite3AnalysisLoad(tls, db, iDb) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + _sqlite3ResetAllSchemasOfConnection(tls, db) + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32 + } else { + if rc == SQLITE_OK || (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_NoSchemaError) != 0 && rc != int32(SQLITE_NOMEM) { + /* Hack: If the SQLITE_NoSchemaError flag is set, then consider + ** the schema loaded, even if errors (other than OOM) occurred. In + ** this situation the current sqlite3_prepare() operation will fail, + ** but the following one will attempt to compile the supplied statement + ** against whatever subset of the schema was loaded before the error + ** occurred. + ** + ** The primary purpose of this is to allow access to the sqlite_schema + ** table even when its contents have been corrupted. + */ + p5 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 114 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(DB_SchemaLoaded)) + rc = SQLITE_OK + } + } + /* Jump here for an error that occurs after successfully allocating + ** curMain and calling sqlite3BtreeEnter(). For an error that occurs + ** before that point, jump to error_out. + */ +initone_error_out: + ; + if openedTransaction != 0 { + _sqlite3BtreeCommit(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + } + _sqlite3BtreeLeave(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) +error_out: + ; + if rc != 0 { + if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)< 0) { + break + } + if !(int32((*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_SchemaLoaded) == libc.Int32FromInt32(DB_SchemaLoaded)) { + rc = _sqlite3InitOne(tls, db, i, pzErrMsg, uint32(0)) + if rc != 0 { + return rc + } + } + goto _1 + _1: + ; + i-- + } + if commit_internal != 0 { + _sqlite3CommitInternalChanges(tls, db) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This routine is a no-op if the database schema is already initialized. +// ** Otherwise, the schema is loaded. An error code is returned. +// */ +func _sqlite3ReadSchema(tls *libc.TLS, pParse uintptr) (r int32) { + var db uintptr + var rc int32 + _, _ = db, rc + rc = SQLITE_OK + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { + rc = _sqlite3Init(tls, db, pParse+8) + if rc != SQLITE_OK { + (*TParse)(unsafe.Pointer(pParse)).Frc = rc + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache != 0 { + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaKnownOk) + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Check schema cookies in all databases. If any cookie is out +// ** of date set pParse->rc to SQLITE_SCHEMA. If all schema cookies +// ** make no changes to pParse->rc. +// */ +func _schemaIsValid(tls *libc.TLS, pParse uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pBt uintptr + var iDb, openedTransaction, rc int32 + var _ /* cookie at bp+0 */ int32 + _, _, _, _, _ = db, iDb, openedTransaction, pBt, rc + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + iDb = 0 + for { + if !(iDb < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + openedTransaction = 0 /* True if a transaction is opened */ + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt /* Btree database to read cookie from */ + if pBt == uintptr(0) { + goto _1 + } + /* If there is not already a read-only (or read-write) transaction opened + ** on the b-tree database, open one now. If a transaction is opened, it + ** will be closed immediately after reading the meta-value. */ + if _sqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_NONE { + rc = _sqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<aDb[] the schema refers to. +// ** +// ** If the same database is attached more than once, the first +// ** attached database is returned. +// */ +func _sqlite3SchemaToIndex(tls *libc.TLS, db uintptr, pSchema uintptr) (r int32) { + var i int32 + _ = i + i = -int32(32768) + /* If pSchema is NULL, then return -32768. This happens when code in + ** expr.c is trying to resolve a reference to a transient table (i.e. one + ** created by a sub-select). In this case the return value of this + ** function should never be used. + ** + ** We return -32768 instead of the more usual -1 simply because using + ** -32768 as the incorrect index into db->aDb[] is much + ** more likely to cause a segfault than -1 (of course there are assert() + ** statements too, but it never hurts to play the odds) and + ** -32768 will still fit into a 16-bit signed integer. + */ + if pSchema != 0 { + i = 0 + for { + if !(int32(1) != 0) { + break + } + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema == pSchema { + break + } + goto _1 + _1: + ; + i++ + } + } + return i +} + +// C documentation +// +// /* +// ** Free all memory allocations in the pParse object +// */ +func _sqlite3ParseObjectReset(tls *libc.TLS, pParse uintptr) { + var db, pCleanup uintptr + var v1 int32 + _, _, _ = db, pCleanup, v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FaTableLock != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TParse)(unsafe.Pointer(pParse)).FaTableLock) + } + for (*TParse)(unsafe.Pointer(pParse)).FpCleanup != 0 { + pCleanup = (*TParse)(unsafe.Pointer(pParse)).FpCleanup + (*TParse)(unsafe.Pointer(pParse)).FpCleanup = (*TParseCleanup)(unsafe.Pointer(pCleanup)).FpNext + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TParseCleanup)(unsafe.Pointer(pCleanup)).FxCleanup})))(tls, db, (*TParseCleanup)(unsafe.Pointer(pCleanup)).FpPtr) + _sqlite3DbNNFreeNN(tls, db, pCleanup) + } + if (*TParse)(unsafe.Pointer(pParse)).FaLabel != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TParse)(unsafe.Pointer(pParse)).FaLabel) + } + if (*TParse)(unsafe.Pointer(pParse)).FpConstExpr != 0 { + _sqlite3ExprListDelete(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpConstExpr) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable -= uint32((*TParse)(unsafe.Pointer(pParse)).FdisableLookaside) + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + v1 = 0 + } else { + v1 = int32((*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(v1) + (*Tsqlite3)(unsafe.Pointer(db)).FpParse = (*TParse)(unsafe.Pointer(pParse)).FpOuterParse +} + +// C documentation +// +// /* +// ** Add a new cleanup operation to a Parser. The cleanup should happen when +// ** the parser object is destroyed. But, beware: the cleanup might happen +// ** immediately. +// ** +// ** Use this mechanism for uncommon cleanups. There is a higher setup +// ** cost for this mechanism (an extra malloc), so it should not be used +// ** for common cleanups that happen on most calls. But for less +// ** common cleanups, we save a single NULL-pointer comparison in +// ** sqlite3ParseObjectReset(), which reduces the total CPU cycle count. +// ** +// ** If a memory allocation error occurs, then the cleanup happens immediately. +// ** When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the +// ** pParse->earlyCleanup flag is set in that case. Calling code show verify +// ** that test cases exist for which this happens, to guard against possible +// ** use-after-free errors following an OOM. The preferred way to do this is +// ** to immediately follow the call to this routine with: +// ** +// ** testcase( pParse->earlyCleanup ); +// ** +// ** This routine returns a copy of its pPtr input (the third parameter) +// ** except if an early cleanup occurs, in which case it returns NULL. So +// ** another way to check for early cleanup is to check the return value. +// ** Or, stop using the pPtr parameter with this call and use only its +// ** return value thereafter. Something like this: +// ** +// ** pObj = sqlite3ParserAddCleanup(pParse, destructor, pObj); +// */ +func _sqlite3ParserAddCleanup(tls *libc.TLS, pParse uintptr, xCleanup uintptr, pPtr uintptr) (r uintptr) { + var pCleanup uintptr + _ = pCleanup + pCleanup = _sqlite3DbMallocRaw(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(24)) + if pCleanup != 0 { + (*TParseCleanup)(unsafe.Pointer(pCleanup)).FpNext = (*TParse)(unsafe.Pointer(pParse)).FpCleanup + (*TParse)(unsafe.Pointer(pParse)).FpCleanup = pCleanup + (*TParseCleanup)(unsafe.Pointer(pCleanup)).FpPtr = pPtr + (*TParseCleanup)(unsafe.Pointer(pCleanup)).FxCleanup = xCleanup + } else { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{xCleanup})))(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pPtr) + pPtr = uintptr(0) + } + return pPtr +} + +// C documentation +// +// /* +// ** Turn bulk memory into a valid Parse object and link that Parse object +// ** into database connection db. +// ** +// ** Call sqlite3ParseObjectReset() to undo this operation. +// ** +// ** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which +// ** is generated by Lemon. +// */ +func _sqlite3ParseObjectInit(tls *libc.TLS, pParse uintptr, db uintptr) { + libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+8)), 0, uint64(libc.UintptrFromInt32(0)+232)-uint64(libc.UintptrFromInt32(0)+8)) + libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+288)), 0, libc.Uint64FromInt64(424)-uint64(libc.UintptrFromInt32(0)+288)) + (*TParse)(unsafe.Pointer(pParse)).FpOuterParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse + (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParse + (*TParse)(unsafe.Pointer(pParse)).Fdb = db + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1650, 0) + } +} + +/* +** Maximum number of times that we will try again to prepare a statement +** that returns SQLITE_ERROR_RETRY. + */ + +// C documentation +// +// /* +// ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. +// */ +func _sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags Tu32, pReprepare uintptr, ppStmt uintptr, pzTail uintptr) (r int32) { + bp := tls.Alloc(448) + defer tls.Free(448) + var i, mxLen, rc, v1 int32 + var pBt, pT, zDb, zSqlCopy uintptr + var _ /* sParse at bp+0 */ TParse + _, _, _, _, _, _, _, _ = i, mxLen, pBt, pT, rc, zDb, zSqlCopy, v1 + rc = SQLITE_OK /* Parsing context */ + /* sqlite3ParseObjectInit(&sParse, db); // inlined for performance */ + libc.Xmemset(tls, bp+uintptr(uint64(libc.UintptrFromInt32(0)+8)), 0, uint64(libc.UintptrFromInt32(0)+232)-uint64(libc.UintptrFromInt32(0)+8)) + libc.Xmemset(tls, bp+uintptr(uint64(libc.UintptrFromInt32(0)+288)), 0, libc.Uint64FromInt64(424)-uint64(libc.UintptrFromInt32(0)+288)) + (*(*TParse)(unsafe.Pointer(bp))).FpOuterParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse + (*Tsqlite3)(unsafe.Pointer(db)).FpParse = bp + (*(*TParse)(unsafe.Pointer(bp))).Fdb = db + if pReprepare != 0 { + (*(*TParse)(unsafe.Pointer(bp))).FpReprepare = pReprepare + (*(*TParse)(unsafe.Pointer(bp))).Fexplain = uint8(Xsqlite3_stmt_isexplain(tls, pReprepare)) + } else { + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ErrorMsg(tls, bp, __ccgo_ts+1650, 0) + v1 = libc.Int32FromInt32(SQLITE_NOMEM) + rc = v1 + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = v1 + goto end_prepare + } + /* For a long-term use prepared statement avoid the use of + ** lookaside memory. + */ + if prepFlags&uint32(SQLITE_PREPARE_PERSISTENT) != 0 { + (*(*TParse)(unsafe.Pointer(bp))).FdisableLookaside++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + } + (*(*TParse)(unsafe.Pointer(bp))).FprepFlags = uint8(prepFlags & uint32(0xff)) + /* Check to verify that it is possible to get a read lock on all + ** database schemas. The inability to get a read lock indicates that + ** some other database connection is holding a write-lock, which in + ** turn means that the other connection has made uncommitted changes + ** to the schema. + ** + ** Were we to proceed and prepare the statement against the uncommitted + ** schema changes and if those schema changes are subsequently rolled + ** back and different changes are made in their place, then when this + ** prepared statement goes to run the schema cookie would fail to detect + ** the schema change. Disaster would follow. + ** + ** This thread is currently holding mutexes on all Btrees (because + ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it + ** is not possible for another thread to start a new schema change + ** while this routine is running. Hence, we do not need to hold + ** locks on the schema, we just need to make sure nobody else is + ** holding them. + ** + ** Note that setting READ_UNCOMMITTED overrides most lock detection, + ** but it does *not* override schema lock detection, so this all still + ** works even if READ_UNCOMMITTED is set. + */ + if !((*Tsqlite3)(unsafe.Pointer(db)).FnoSharedCache != 0) { + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 { + rc = _sqlite3BtreeSchemaLocked(tls, pBt) + if rc != 0 { + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FzDbSName + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+18916, libc.VaList(bp+432, zDb)) + goto end_prepare + } + } + goto _2 + _2: + ; + i++ + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FpDisconnect != 0 { + _sqlite3VtabUnlockList(tls, db) + } + if nBytes >= 0 && (nBytes == 0 || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(nBytes-int32(1))))) != 0) { + mxLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) + if nBytes > mxLen { + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_TOOBIG), __ccgo_ts+18946, 0) + rc = _sqlite3ApiExit(tls, db, int32(SQLITE_TOOBIG)) + goto end_prepare + } + zSqlCopy = _sqlite3DbStrNDup(tls, db, zSql, uint64(nBytes)) + if zSqlCopy != 0 { + _sqlite3RunParser(tls, bp, zSqlCopy) + (*(*TParse)(unsafe.Pointer(bp))).FzTail = zSql + uintptr(int64((*(*TParse)(unsafe.Pointer(bp))).FzTail)-int64(zSqlCopy)) + _sqlite3DbFree(tls, db, zSqlCopy) + } else { + (*(*TParse)(unsafe.Pointer(bp))).FzTail = zSql + uintptr(nBytes) + } + } else { + _sqlite3RunParser(tls, bp, zSql) + } + if pzTail != 0 { + *(*uintptr)(unsafe.Pointer(pzTail)) = (*(*TParse)(unsafe.Pointer(bp))).FzTail + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { + _sqlite3VdbeSetSql(tls, (*(*TParse)(unsafe.Pointer(bp))).FpVdbe, zSql, int32(int64((*(*TParse)(unsafe.Pointer(bp))).FzTail)-int64(zSql)), uint8(prepFlags)) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*(*TParse)(unsafe.Pointer(bp))).Frc = int32(SQLITE_NOMEM) + (*(*TParse)(unsafe.Pointer(bp))).FcheckSchema = uint8(0) + } + if (*(*TParse)(unsafe.Pointer(bp))).Frc != SQLITE_OK && (*(*TParse)(unsafe.Pointer(bp))).Frc != int32(SQLITE_DONE) { + if (*(*TParse)(unsafe.Pointer(bp))).FcheckSchema != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 { + _schemaIsValid(tls, bp) + } + if (*(*TParse)(unsafe.Pointer(bp))).FpVdbe != 0 { + _sqlite3VdbeFinalize(tls, (*(*TParse)(unsafe.Pointer(bp))).FpVdbe) + } + rc = (*(*TParse)(unsafe.Pointer(bp))).Frc + if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { + _sqlite3ErrorWithMsg(tls, db, rc, __ccgo_ts+3827, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) + _sqlite3DbFree(tls, db, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg) + } else { + _sqlite3Error(tls, db, rc) + } + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*(*TParse)(unsafe.Pointer(bp))).FpVdbe + rc = SQLITE_OK + _sqlite3ErrorClear(tls, db) + } + /* Delete any TriggerPrg structures allocated while parsing this statement. */ + for (*(*TParse)(unsafe.Pointer(bp))).FpTriggerPrg != 0 { + pT = (*(*TParse)(unsafe.Pointer(bp))).FpTriggerPrg + (*(*TParse)(unsafe.Pointer(bp))).FpTriggerPrg = (*TTriggerPrg)(unsafe.Pointer(pT)).FpNext + _sqlite3DbFree(tls, db, pT) + } +end_prepare: + ; + _sqlite3ParseObjectReset(tls, bp) + return rc +} + +func _sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags Tu32, pOld uintptr, ppStmt uintptr, pzTail uintptr) (r int32) { + var cnt, rc, v1, v3 int32 + var v2, v4, v5 bool + _, _, _, _, _, _, _ = cnt, rc, v1, v2, v3, v4, v5 + cnt = 0 + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + if !(_sqlite3SafetyCheckOk(tls, db) != 0) || zSql == uintptr(0) { + return _sqlite3MisuseError(tls, int32(141699)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3BtreeEnterAll(tls, db) + for { + /* Make multiple attempts to compile the SQL, until it either succeeds + ** or encounters a permanent error. A schema problem after one schema + ** reset is considered a permanent error. */ + rc = _sqlite3Prepare(tls, db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail) + if rc == SQLITE_OK || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + break + } + goto _6 + _6: + ; + if v2 = rc == libc.Int32FromInt32(SQLITE_ERROR)|libc.Int32FromInt32(2)<= 0 { + z = zSql + sz = 0 + for { + if !(sz < nBytes && (int32(*(*int8)(unsafe.Pointer(z + uintptr(sz)))) != 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(sz+int32(1))))) != 0)) { + break + } + goto _1 + _1: + ; + sz += int32(2) + } + nBytes = sz + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + zSql8 = _sqlite3Utf16to8(tls, db, zSql, nBytes, uint8(SQLITE_UTF16LE)) + if zSql8 != 0 { + rc = _sqlite3LockAndPrepare(tls, db, zSql8, -int32(1), prepFlags, uintptr(0), ppStmt, bp) + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 && pzTail != 0 { + /* If sqlite3_prepare returns a tail pointer, we calculate the + ** equivalent pointer into the UTF-16 string by counting the unicode + ** characters between zSql8 and zTail8, and then returning a pointer + ** the same number of characters into the UTF-16 string. + */ + chars_parsed = _sqlite3Utf8CharLen(tls, zSql8, int32(int64(*(*uintptr)(unsafe.Pointer(bp)))-int64(zSql8))) + *(*uintptr)(unsafe.Pointer(pzTail)) = zSql + uintptr(_sqlite3Utf16ByteLen(tls, zSql, chars_parsed)) + } + _sqlite3DbFree(tls, db, zSql8) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Two versions of the official API. Legacy and new use. In the legacy +// ** version, the original SQL text is not saved in the prepared statement +// ** and so if a schema change occurs, SQLITE_SCHEMA is returned by +// ** sqlite3_step(). In the new version, the original SQL text is retained +// ** and the statement is automatically recompiled if an schema change +// ** occurs. +// */ +func Xsqlite3_prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) (r int32) { + var rc int32 + _ = rc + rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(0), ppStmt, pzTail) + /* VERIFY: F13021 */ + return rc +} + +func Xsqlite3_prepare16_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) (r int32) { + var rc int32 + _ = rc + rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL), ppStmt, pzTail) + /* VERIFY: F13021 */ + return rc +} + +func Xsqlite3_prepare16_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags uint32, ppStmt uintptr, pzTail uintptr) (r int32) { + var rc int32 + _ = rc + rc = _sqlite3Prepare16(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL)|prepFlags&uint32(SQLITE_PREPARE_MASK), ppStmt, pzTail) + /* VERIFY: F13021 */ + return rc +} + +/************** End of prepare.c *********************************************/ +/************** Begin file select.c ******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C code routines that are called by the parser +** to handle SELECT statements in SQLite. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** An instance of the following object is used to record information about +// ** how to process the DISTINCT keyword, to simplify passing that information +// ** into the selectInnerLoop() routine. +// */ +type TDistinctCtx = struct { + FisTnct Tu8 + FeTnctType Tu8 + FtabTnct int32 + FaddrTnct int32 +} + +type DistinctCtx = TDistinctCtx + +type TDistinctCtx1 = struct { + FisTnct Tu8 + FeTnctType Tu8 + FtabTnct int32 + FaddrTnct int32 +} + +type DistinctCtx1 = TDistinctCtx1 + +// C documentation +// +// /* +// ** An instance of the following object is used to record information about +// ** the ORDER BY (or GROUP BY) clause of query is being coded. +// ** +// ** The aDefer[] array is used by the sorter-references optimization. For +// ** example, assuming there is no index that can be used for the ORDER BY, +// ** for the query: +// ** +// ** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; +// ** +// ** it may be more efficient to add just the "a" values to the sorter, and +// ** retrieve the associated "bigblob" values directly from table t1 as the +// ** 10 smallest "a" values are extracted from the sorter. +// ** +// ** When the sorter-reference optimization is used, there is one entry in the +// ** aDefer[] array for each database table that may be read as values are +// ** extracted from the sorter. +// */ +type TSortCtx = struct { + FpOrderBy uintptr + FnOBSat int32 + FiECursor int32 + FregReturn int32 + FlabelBkOut int32 + FaddrSortIndex int32 + FlabelDone int32 + FlabelOBLopt int32 + FsortFlags Tu8 + FpDeferredRowLoad uintptr +} + +type SortCtx = TSortCtx + +type TSortCtx1 = struct { + FpOrderBy uintptr + FnOBSat int32 + FiECursor int32 + FregReturn int32 + FlabelBkOut int32 + FaddrSortIndex int32 + FlabelDone int32 + FlabelOBLopt int32 + FsortFlags Tu8 + FpDeferredRowLoad uintptr +} + +type SortCtx1 = TSortCtx1 + +// C documentation +// +// /* +// ** Delete all the content of a Select structure. Deallocate the structure +// ** itself depending on the value of bFree +// ** +// ** If bFree==1, call sqlite3DbFree() on the p object. +// ** If bFree==0, Leave the first Select object unfreed +// */ +func _clearSelect(tls *libc.TLS, db uintptr, p uintptr, bFree int32) { + var pPrior uintptr + _ = pPrior + for p != 0 { + pPrior = (*TSelect)(unsafe.Pointer(p)).FpPrior + _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpEList) + _sqlite3SrcListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpSrc) + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWhere) + _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpGroupBy) + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpHaving) + _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpLimit) + if (*TSelect)(unsafe.Pointer(p)).FpWith != 0 { + _sqlite3WithDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWith) + } + if (*TSelect)(unsafe.Pointer(p)).FpWinDefn != 0 { + _sqlite3WindowListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpWinDefn) + } + for (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { + _sqlite3WindowUnlinkFromSelect(tls, (*TSelect)(unsafe.Pointer(p)).FpWin) + } + if bFree != 0 { + _sqlite3DbNNFreeNN(tls, db, p) + } + p = pPrior + bFree = int32(1) + } +} + +// C documentation +// +// /* +// ** Initialize a SelectDest structure. +// */ +func _sqlite3SelectDestInit(tls *libc.TLS, pDest uintptr, eDest int32, iParm int32) { + (*TSelectDest)(unsafe.Pointer(pDest)).FeDest = uint8(eDest) + (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm = iParm + (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm2 = 0 + (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst = uintptr(0) + (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = 0 + (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = 0 +} + +// C documentation +// +// /* +// ** Allocate a new Select structure and return a pointer to that +// ** structure. +// */ +func _sqlite3SelectNew(tls *libc.TLS, pParse uintptr, pEList uintptr, pSrc uintptr, pWhere uintptr, pGroupBy uintptr, pHaving uintptr, pOrderBy uintptr, selFlags Tu32, pLimit uintptr) (r uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var pAllocated, pNew, v1, v3 uintptr + var v2 int32 + var _ /* standin at bp+0 */ TSelect + _, _, _, _, _ = pAllocated, pNew, v1, v2, v3 + v1 = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(128)) + pNew = v1 + pAllocated = v1 + if pNew == uintptr(0) { + pNew = bp + } + if pEList == uintptr(0) { + pEList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0))) + } + (*TSelect)(unsafe.Pointer(pNew)).FpEList = pEList + (*TSelect)(unsafe.Pointer(pNew)).Fop = uint8(TK_SELECT) + (*TSelect)(unsafe.Pointer(pNew)).FselFlags = selFlags + (*TSelect)(unsafe.Pointer(pNew)).FiLimit = 0 + (*TSelect)(unsafe.Pointer(pNew)).FiOffset = 0 + v3 = pParse + 148 + *(*int32)(unsafe.Pointer(v3))++ + v2 = *(*int32)(unsafe.Pointer(v3)) + (*TSelect)(unsafe.Pointer(pNew)).FselId = uint32(v2) + *(*int32)(unsafe.Pointer(pNew + 20)) = -int32(1) + *(*int32)(unsafe.Pointer(pNew + 20 + 1*4)) = -int32(1) + (*TSelect)(unsafe.Pointer(pNew)).FnSelectRow = 0 + if pSrc == uintptr(0) { + pSrc = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(112)) + } + (*TSelect)(unsafe.Pointer(pNew)).FpSrc = pSrc + (*TSelect)(unsafe.Pointer(pNew)).FpWhere = pWhere + (*TSelect)(unsafe.Pointer(pNew)).FpGroupBy = pGroupBy + (*TSelect)(unsafe.Pointer(pNew)).FpHaving = pHaving + (*TSelect)(unsafe.Pointer(pNew)).FpOrderBy = pOrderBy + (*TSelect)(unsafe.Pointer(pNew)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpNext = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpLimit = pLimit + (*TSelect)(unsafe.Pointer(pNew)).FpWith = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpWin = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpWinDefn = uintptr(0) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + _clearSelect(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pNew, libc.BoolInt32(pNew != bp)) + pAllocated = uintptr(0) + } else { + } + return pAllocated +} + +// C documentation +// +// /* +// ** Delete the given Select structure and all of its substructures. +// */ +func _sqlite3SelectDelete(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _clearSelect(tls, db, p, int32(1)) + } +} + +func _sqlite3SelectDeleteGeneric(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _clearSelect(tls, db, p, int32(1)) + } +} + +// C documentation +// +// /* +// ** Return a pointer to the right-most SELECT statement in a compound. +// */ +func _findRightmost(tls *libc.TLS, p uintptr) (r uintptr) { + for (*TSelect)(unsafe.Pointer(p)).FpNext != 0 { + p = (*TSelect)(unsafe.Pointer(p)).FpNext + } + return p +} + +// C documentation +// +// /* +// ** Given 1 to 3 identifiers preceding the JOIN keyword, determine the +// ** type of join. Return an integer constant that expresses that type +// ** in terms of the following bit values: +// ** +// ** JT_INNER +// ** JT_CROSS +// ** JT_OUTER +// ** JT_NATURAL +// ** JT_LEFT +// ** JT_RIGHT +// ** +// ** A full outer join is the combination of JT_LEFT and JT_RIGHT. +// ** +// ** If an illegal or unsupported join type is seen, then still return +// ** a join type, but put an error in the pParse structure. +// ** +// ** These are the valid join types: +// ** +// ** +// ** pA pB pC Return Value +// ** ------- ----- ----- ------------ +// ** CROSS - - JT_CROSS +// ** INNER - - JT_INNER +// ** LEFT - - JT_LEFT|JT_OUTER +// ** LEFT OUTER - JT_LEFT|JT_OUTER +// ** RIGHT - - JT_RIGHT|JT_OUTER +// ** RIGHT OUTER - JT_RIGHT|JT_OUTER +// ** FULL - - JT_LEFT|JT_RIGHT|JT_OUTER +// ** FULL OUTER - JT_LEFT|JT_RIGHT|JT_OUTER +// ** NATURAL INNER - JT_NATURAL|JT_INNER +// ** NATURAL LEFT - JT_NATURAL|JT_LEFT|JT_OUTER +// ** NATURAL LEFT OUTER JT_NATURAL|JT_LEFT|JT_OUTER +// ** NATURAL RIGHT - JT_NATURAL|JT_RIGHT|JT_OUTER +// ** NATURAL RIGHT OUTER JT_NATURAL|JT_RIGHT|JT_OUTER +// ** NATURAL FULL - JT_NATURAL|JT_LEFT|JT_RIGHT +// ** NATURAL FULL OUTER JT_NATRUAL|JT_LEFT|JT_RIGHT +// ** +// ** To preserve historical compatibly, SQLite also accepts a variety +// ** of other non-standard and in many cases nonsensical join types. +// ** This routine makes as much sense at it can from the nonsense join +// ** type and returns a result. Examples of accepted nonsense join types +// ** include but are not limited to: +// ** +// ** INNER CROSS JOIN -> same as JOIN +// ** NATURAL CROSS JOIN -> same as NATURAL JOIN +// ** OUTER LEFT JOIN -> same as LEFT JOIN +// ** LEFT NATURAL JOIN -> same as NATURAL LEFT JOIN +// ** LEFT RIGHT JOIN -> same as FULL JOIN +// ** RIGHT OUTER FULL JOIN -> same as FULL JOIN +// ** CROSS CROSS CROSS JOIN -> same as JOIN +// ** +// ** The only restrictions on the join type name are: +// ** +// ** * "INNER" cannot appear together with "OUTER", "LEFT", "RIGHT", +// ** or "FULL". +// ** +// ** * "CROSS" cannot appear together with "OUTER", "LEFT", "RIGHT, +// ** or "FULL". +// ** +// ** * If "OUTER" is present then there must also be one of +// ** "LEFT", "RIGHT", or "FULL" +// */ +func _sqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var apAll [3]uintptr + var i, j, jointype int32 + var p, zSp1, zSp2 uintptr + _, _, _, _, _, _, _ = apAll, i, j, jointype, p, zSp1, zSp2 + jointype = 0 + apAll[0] = pA + apAll[int32(1)] = pB + apAll[int32(2)] = pC + i = 0 + for { + if !(i < int32(3) && apAll[i] != 0) { + break + } + p = apAll[i] + j = 0 + for { + if !(j < int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3))) { + break + } + if (*TToken)(unsafe.Pointer(p)).Fn == uint32(_aKeyword[j].FnChar) && Xsqlite3_strnicmp(tls, (*TToken)(unsafe.Pointer(p)).Fz, uintptr(unsafe.Pointer(&_zKeyText))+uintptr(_aKeyword[j].Fi), int32((*TToken)(unsafe.Pointer(p)).Fn)) == 0 { + jointype |= int32(_aKeyword[j].Fcode) + break + } + goto _2 + _2: + ; + j++ + } + if j >= int32(libc.Uint64FromInt64(21)/libc.Uint64FromInt64(3)) { + jointype |= int32(JT_ERROR) + break + } + goto _1 + _1: + ; + i++ + } + if jointype&(libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER)) == libc.Int32FromInt32(JT_INNER)|libc.Int32FromInt32(JT_OUTER) || jointype&int32(JT_ERROR) != 0 || jointype&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) == int32(JT_OUTER) { + zSp1 = __ccgo_ts + 11234 + zSp2 = __ccgo_ts + 11234 + if pB == uintptr(0) { + zSp1++ + } + if pC == uintptr(0) { + zSp2++ + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18965, libc.VaList(bp+8, pA, zSp1, pB, zSp2, pC)) + jointype = int32(JT_INNER) + } + return jointype +} + +/* 0123456789 123456789 123456789 123 */ +var _zKeyText = [34]int8{'n', 'a', 't', 'u', 'r', 'a', 'l', 'e', 'f', 't', 'o', 'u', 't', 'e', 'r', 'i', 'g', 'h', 't', 'f', 'u', 'l', 'l', 'i', 'n', 'n', 'e', 'r', 'c', 'r', 'o', 's', 's'} + +var _aKeyword = [7]struct { + Fi Tu8 + FnChar Tu8 + Fcode Tu8 +}{ + 0: { + FnChar: uint8(7), + Fcode: uint8(JT_NATURAL), + }, + 1: { + Fi: uint8(6), + FnChar: uint8(4), + Fcode: uint8(libc.Int32FromInt32(JT_LEFT) | libc.Int32FromInt32(JT_OUTER)), + }, + 2: { + Fi: uint8(10), + FnChar: uint8(5), + Fcode: uint8(JT_OUTER), + }, + 3: { + Fi: uint8(14), + FnChar: uint8(5), + Fcode: uint8(libc.Int32FromInt32(JT_RIGHT) | libc.Int32FromInt32(JT_OUTER)), + }, + 4: { + Fi: uint8(19), + FnChar: uint8(4), + Fcode: uint8(libc.Int32FromInt32(JT_LEFT) | libc.Int32FromInt32(JT_RIGHT) | libc.Int32FromInt32(JT_OUTER)), + }, + 5: { + Fi: uint8(23), + FnChar: uint8(5), + Fcode: uint8(JT_INNER), + }, + 6: { + Fi: uint8(28), + FnChar: uint8(5), + Fcode: uint8(libc.Int32FromInt32(JT_INNER) | libc.Int32FromInt32(JT_CROSS)), + }, +} + +// C documentation +// +// /* +// ** Return the index of a column in a table. Return -1 if the column +// ** is not contained in the table. +// */ +func _sqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) (r int32) { + var h Tu8 + var i int32 + var pCol uintptr + _, _, _ = h, i, pCol + h = _sqlite3StrIHash(tls, zCol) + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + i = libc.Int32FromInt32(0) + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*TColumn)(unsafe.Pointer(pCol)).FhName) == int32(h) && _sqlite3StrICmp(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, zCol) == 0 { + return i + } + goto _1 + _1: + ; + pCol += 16 + i++ + } + return -int32(1) +} + +// C documentation +// +// /* +// ** Mark a subquery result column as having been used. +// */ +func _sqlite3SrcItemColumnUsed(tls *libc.TLS, pItem uintptr, iCol int32) { + var pResults uintptr + _ = pResults + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2000>>13)) != 0 { + pResults = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpEList + libc.SetBitFieldPtr16Uint32(pResults+8+uintptr(iCol)*32+16+4, libc.Uint32FromInt32(1), 6, 0x40) + } +} + +// C documentation +// +// /* +// ** Search the tables iStart..iEnd (inclusive) in pSrc, looking for a +// ** table that has a column named zCol. The search is left-to-right. +// ** The first match found is returned. +// ** +// ** When found, set *piTab and *piCol to the table index and column index +// ** of the matching column and return TRUE. +// ** +// ** If not found, return FALSE. +// */ +func _tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, iStart int32, iEnd int32, zCol uintptr, piTab uintptr, piCol uintptr, bIgnoreHidden int32) (r int32) { + var i, iCol int32 + _, _ = i, iCol /* Index of column matching zCol */ + /* Both or neither are NULL */ + i = iStart + for { + if !(i <= iEnd) { + break + } + iCol = _sqlite3ColumnIndex(tls, (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FpTab, zCol) + if iCol >= 0 && (bIgnoreHidden == 0 || libc.BoolInt32(int32((*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FpTab)).FaCol+uintptr(iCol)*16)).FcolFlags)&int32(COLFLAG_HIDDEN) != 0) == 0) { + if piTab != 0 { + _sqlite3SrcItemColumnUsed(tls, pSrc+8+uintptr(i)*104, iCol) + *(*int32)(unsafe.Pointer(piTab)) = i + *(*int32)(unsafe.Pointer(piCol)) = iCol + } + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Set the EP_OuterON property on all terms of the given expression. +// ** And set the Expr.w.iJoin to iTable for every term in the +// ** expression. +// ** +// ** The EP_OuterON property is used on terms of an expression to tell +// ** the OUTER JOIN processing logic that this term is part of the +// ** join restriction specified in the ON or USING clause and not a part +// ** of the more general WHERE clause. These terms are moved over to the +// ** WHERE clause during join processing but we need to remember that they +// ** originated in the ON or USING clause. +// ** +// ** The Expr.w.iJoin tells the WHERE clause processing that the +// ** expression depends on table w.iJoin even if that table is not +// ** explicitly mentioned in the expression. That information is needed +// ** for cases like this: +// ** +// ** SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5 +// ** +// ** The where clause needs to defer the handling of the t1.x=5 +// ** term until after the t2 loop of the join. In that way, a +// ** NULL t2 row will be inserted whenever t1.x!=5. If we do not +// ** defer the handling of t1.x=5, it will be processed immediately +// ** after the t1 loop and rows with t1.x!=5 will never appear in +// ** the output, which is incorrect. +// */ +func _sqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, joinFlag Tu32) { + var i int32 + _ = i + for p != 0 { + *(*Tu32)(unsafe.Pointer(p + 4)) |= joinFlag + *(*int32)(unsafe.Pointer(p + 52)) = iTable + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) { + if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)))).FnExpr) { + break + } + _sqlite3SetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, joinFlag) + goto _1 + _1: + ; + i++ + } + } + } + _sqlite3SetJoinExpr(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, iTable, joinFlag) + p = (*TExpr)(unsafe.Pointer(p)).FpRight + } +} + +// C documentation +// +// /* Undo the work of sqlite3SetJoinExpr(). This is used when a LEFT JOIN +// ** is simplified into an ordinary JOIN, and when an ON expression is +// ** "pushed down" into the WHERE clause of a subquery. +// ** +// ** Convert every term that is marked with EP_OuterON and w.iJoin==iTable into +// ** an ordinary term that omits the EP_OuterON mark. Or if iTable<0, then +// ** just clear every EP_OuterON and EP_InnerON mark from the expression tree. +// ** +// ** If nullable is true, that means that Expr p might evaluate to NULL even +// ** if it is a reference to a NOT NULL column. This can happen, for example, +// ** if the table that p references is on the left side of a RIGHT JOIN. +// ** If nullable is true, then take care to not remove the EP_CanBeNull bit. +// ** See forum thread https://sqlite.org/forum/forumpost/b40696f50145d21c +// */ +func _unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32, nullable int32) { + var i int32 + _ = i + for p != 0 { + if iTable < 0 || (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) && *(*int32)(unsafe.Pointer(p + 52)) == iTable { + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^(libc.Int32FromInt32(EP_OuterON) | libc.Int32FromInt32(EP_InnerON))) + if iTable >= 0 { + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_InnerON)) + } + } + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(p)).FiTable == iTable && !(nullable != 0) { + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(EP_CanBeNull)) + } + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) { + if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)))).FnExpr) { + break + } + _unsetJoinExpr(tls, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32)) + 8 + uintptr(i)*32))).FpExpr, iTable, nullable) + goto _1 + _1: + ; + i++ + } + } + } + _unsetJoinExpr(tls, (*TExpr)(unsafe.Pointer(p)).FpLeft, iTable, nullable) + p = (*TExpr)(unsafe.Pointer(p)).FpRight + } +} + +// C documentation +// +// /* +// ** This routine processes the join information for a SELECT statement. +// ** +// ** * A NATURAL join is converted into a USING join. After that, we +// ** do not need to be concerned with NATURAL joins and we only have +// ** think about USING joins. +// ** +// ** * ON and USING clauses result in extra terms being added to the +// ** WHERE clause to enforce the specified constraints. The extra +// ** WHERE clause terms will be tagged with EP_OuterON or +// ** EP_InnerON so that we know that they originated in ON/USING. +// ** +// ** The terms of a FROM clause are contained in the Select.pSrc structure. +// ** The left most table is the first entry in Select.pSrc. The right-most +// ** table is the last entry. The join operator is held in the entry to +// ** the right. Thus entry 1 contains the join operator for the join between +// ** entries 0 and 1. Any ON or USING clauses associated with the join are +// ** also attached to the right entry. +// ** +// ** This routine returns the number of errors encountered. +// */ +func _sqlite3ProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pE1, pE2, pEq, pFuncArgs, pLeft, pList, pRight, pRightTab, pSrc, pUsing, zName, zName1 uintptr + var i, iRightCol, j, v2 int32 + var joinType Tu32 + var _ /* iLeft at bp+0 */ int32 + var _ /* iLeftCol at bp+4 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, i, iRightCol, j, joinType, pE1, pE2, pEq, pFuncArgs, pLeft, pList, pRight, pRightTab, pSrc, pUsing, zName, zName1, v2 /* Right table being joined */ + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + pLeft = pSrc + 8 + pRight = pLeft + 1*104 + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc-int32(1)) { + break + } + pRightTab = (*TSrcItem)(unsafe.Pointer(pRight)).FpTab + if (*TSrcItem)(unsafe.Pointer(pLeft)).FpTab == uintptr(0) || pRightTab == uintptr(0) { + goto _1 + } + if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_OUTER) != 0 { + v2 = int32(EP_OuterON) + } else { + v2 = int32(EP_InnerON) + } + joinType = uint32(v2) + /* If this is a NATURAL join, synthesize an appropriate USING clause + ** to specify which columns should be joined. + */ + if int32((*TSrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype)&int32(JT_NATURAL) != 0 { + pUsing = uintptr(0) + if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 || *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+18995, libc.VaList(bp+16, 0)) + return int32(1) + } + j = 0 + for { + if !(j < int32((*TTable)(unsafe.Pointer(pRightTab)).FnCol)) { + break + } /* Name of column in the right table */ + if int32((*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pRightTab)).FaCol+uintptr(j)*16)).FcolFlags)&int32(COLFLAG_HIDDEN) != 0 { + goto _3 + } + zName = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pRightTab)).FaCol + uintptr(j)*16))).FzCnName + if _tableAndColumnIndex(tls, pSrc, 0, i, zName, uintptr(0), uintptr(0), int32(1)) != 0 { + pUsing = _sqlite3IdListAppend(tls, pParse, pUsing, uintptr(0)) + if pUsing != 0 { + (*(*TIdList_item)(unsafe.Pointer(pUsing + 8 + uintptr((*TIdList)(unsafe.Pointer(pUsing)).FnId-int32(1))*16))).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, zName) + } + } + goto _3 + _3: + ; + j++ + } + if pUsing != 0 { + libc.SetBitFieldPtr16Uint32(pRight+60+4, libc.Uint32FromInt32(1), 10, 0x400) + libc.SetBitFieldPtr16Uint32(pRight+60+4, libc.Uint32FromInt32(1), 12, 0x1000) + *(*uintptr)(unsafe.Pointer(pRight + 72)) = pUsing + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(1) + } + } + /* Create extra terms on the WHERE clause for each column named + ** in the USING clause. Example: If the two tables to be joined are + ** A and B and the USING clause names X, Y, and Z, then add this + ** to the WHERE clause: A.X=B.X AND A.Y=B.Y AND A.Z=B.Z + ** Report an error if any column mentioned in the USING clause is + ** not contained in both tables to be joined. + */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x400>>10)) != 0 { + pList = *(*uintptr)(unsafe.Pointer(pRight + 72)) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + j = 0 + for { + if !(j < (*TIdList)(unsafe.Pointer(pList)).FnId) { + break + } /* Equality constraint. pE1 == pE2 */ + zName1 = (*(*TIdList_item)(unsafe.Pointer(pList + 8 + uintptr(j)*16))).FzName + iRightCol = _sqlite3ColumnIndex(tls, pRightTab, zName1) + if iRightCol < 0 || _tableAndColumnIndex(tls, pSrc, 0, i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19045, libc.VaList(bp+16, zName1)) + return int32(1) + } + pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) + _sqlite3SrcItemColumnUsed(tls, pSrc+8+uintptr(*(*int32)(unsafe.Pointer(bp)))*104, *(*int32)(unsafe.Pointer(bp + 4))) + if int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + /* This branch runs if the query contains one or more RIGHT or FULL + ** JOINs. If only a single table on the left side of this join + ** contains the zName column, then this branch is a no-op. + ** But if there are two or more tables on the left side + ** of the join, construct a coalesce() function that gathers all + ** such tables. Raise an error if more than one of those references + ** to zName is not also within a prior USING clause. + ** + ** We really ought to raise an error if there are two or more + ** non-USING references to zName on the left of an INNER or LEFT + ** JOIN. But older versions of SQLite do not do that, so we avoid + ** adding a new error so as to not break legacy applications. + */ + pFuncArgs = uintptr(0) /* Arguments to the coalesce() */ + for _tableAndColumnIndex(tls, pSrc, *(*int32)(unsafe.Pointer(bp))+int32(1), i, zName1, bp, bp+4, int32(uint32(*(*uint16)(unsafe.Pointer(pRight + 60 + 4))&0x1000>>12))) != 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 60 + 4))&0x400>>10)) == 0 || _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(*(*int32)(unsafe.Pointer(bp)))*104 + 72)), zName1) < 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19109, libc.VaList(bp+16, zName1)) + break + } + pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) + pE1 = _sqlite3CreateColumnExpr(tls, db, pSrc, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4))) + _sqlite3SrcItemColumnUsed(tls, pSrc+8+uintptr(*(*int32)(unsafe.Pointer(bp)))*104, *(*int32)(unsafe.Pointer(bp + 4))) + } + if pFuncArgs != 0 { + pFuncArgs = _sqlite3ExprListAppend(tls, pParse, pFuncArgs, pE1) + pE1 = _sqlite3ExprFunction(tls, pParse, pFuncArgs, uintptr(unsafe.Pointer(&_tkCoalesce)), 0) + } + } + pE2 = _sqlite3CreateColumnExpr(tls, db, pSrc, i+int32(1), iRightCol) + _sqlite3SrcItemColumnUsed(tls, pRight, iRightCol) + pEq = _sqlite3PExpr(tls, pParse, int32(TK_EQ), pE1, pE2) + if pEq != 0 { + *(*Tu32)(unsafe.Pointer(pEq + 4)) |= joinType + *(*int32)(unsafe.Pointer(pEq + 52)) = (*TExpr)(unsafe.Pointer(pE2)).FiTable + } + (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, pEq) + goto _4 + _4: + ; + j++ + } + } else { + if *(*uintptr)(unsafe.Pointer(pRight + 72)) != 0 { + _sqlite3SetJoinExpr(tls, *(*uintptr)(unsafe.Pointer(pRight + 72)), (*TSrcItem)(unsafe.Pointer(pRight)).FiCursor, joinType) + (*TSelect)(unsafe.Pointer(p)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWhere, *(*uintptr)(unsafe.Pointer(pRight + 72))) + *(*uintptr)(unsafe.Pointer(pRight + 72)) = uintptr(0) + libc.SetBitFieldPtr16Uint32(pRight+60+4, libc.Uint32FromInt32(1), 11, 0x800) + } + } + goto _1 + _1: + ; + i++ + pRight += 104 + pLeft += 104 + } + return 0 +} + +var _tkCoalesce = TToken{ + Fz: __ccgo_ts + 6762, + Fn: uint32(8), +} + +// C documentation +// +// /* +// ** An instance of this object holds information (beyond pParse and pSelect) +// ** needed to load the next result row that is to be added to the sorter. +// */ +type TRowLoadInfo = struct { + FregResult int32 + FecelFlags Tu8 +} + +type RowLoadInfo = TRowLoadInfo + +type TRowLoadInfo1 = struct { + FregResult int32 + FecelFlags Tu8 +} + +type RowLoadInfo1 = TRowLoadInfo1 + +// C documentation +// +// /* +// ** This routine does the work of loading query data into an array of +// ** registers so that it can be added to the sorter. +// */ +func _innerLoopLoadRow(tls *libc.TLS, pParse uintptr, pSelect uintptr, pInfo uintptr) { + _sqlite3ExprCodeExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSelect)).FpEList, (*TRowLoadInfo)(unsafe.Pointer(pInfo)).FregResult, 0, (*TRowLoadInfo)(unsafe.Pointer(pInfo)).FecelFlags) +} + +// C documentation +// +// /* +// ** Code the OP_MakeRecord instruction that generates the entry to be +// ** added into the sorter. +// ** +// ** Return the register in which the result is stored. +// */ +func _makeSorterRecord(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintptr, regBase int32, nBase int32) (r int32) { + var nOBSat, regOut, v1 int32 + var v, v2 uintptr + _, _, _, _, _ = nOBSat, regOut, v, v1, v2 + nOBSat = (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + regOut = v1 + if (*TSortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad != 0 { + _innerLoopLoadRow(tls, pParse, pSelect, (*TSortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regBase+nOBSat, nBase-nOBSat, regOut) + return regOut +} + +// C documentation +// +// /* +// ** Generate code that will push the record in registers regData +// ** through regData+nData-1 onto the sorter. +// */ +func _pushOntoSorter(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintptr, regData int32, regOrigData int32, nData int32, nPrefixReg int32) { + var addrFirst, addrJmp, bSeq, iCsr, iLimit, iSkip, nBase, nExpr, nKey, nOBSat, op, regBase, regPrevKey, regRecord, v1, v2, v3, v5 int32 + var pKI, pOp, v, v4 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrFirst, addrJmp, bSeq, iCsr, iLimit, iSkip, nBase, nExpr, nKey, nOBSat, op, pKI, pOp, regBase, regPrevKey, regRecord, v, v1, v2, v3, v4, v5 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Stmt under construction */ + bSeq = libc.BoolInt32(int32((*TSortCtx)(unsafe.Pointer(pSort)).FsortFlags)&int32(SORTFLAG_UseSorter) == 0) + nExpr = (*TExprList)(unsafe.Pointer((*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr /* No. of ORDER BY terms */ + nBase = nExpr + bSeq + nData /* Regs for sorter record */ + regRecord = 0 /* Assembled sorter record */ + nOBSat = (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat /* LIMIT counter */ + iSkip = 0 /* End of the sorter insert loop */ + /* Three cases: + ** (1) The data to be sorted has already been packed into a Record + ** by a prior OP_MakeRecord. In this case nData==1 and regData + ** will be completely unrelated to regOrigData. + ** (2) All output columns are included in the sort record. In that + ** case regData==regOrigData. + ** (3) Some output columns are omitted from the sort record due to + ** the SQLITE_ENABLE_SORTER_REFERENCES optimization, or due to the + ** SQLITE_ECEL_OMITREF optimization, or due to the + ** SortCtx.pDeferredRowLoad optimization. In any of these cases + ** regOrigData is 0 to prevent this routine from trying to copy + ** values that might not yet exist. + */ + if nPrefixReg != 0 { + regBase = regData - nPrefixReg + } else { + regBase = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nBase + } + if (*TSelect)(unsafe.Pointer(pSelect)).FiOffset != 0 { + v1 = (*TSelect)(unsafe.Pointer(pSelect)).FiOffset + int32(1) + } else { + v1 = (*TSelect)(unsafe.Pointer(pSelect)).FiLimit + } + iLimit = v1 + (*TSortCtx)(unsafe.Pointer(pSort)).FlabelDone = _sqlite3VdbeMakeLabel(tls, pParse) + if regOrigData != 0 { + v2 = int32(SQLITE_ECEL_REF) + } else { + v2 = 0 + } + _sqlite3ExprCodeExprList(tls, pParse, (*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy, regBase, regOrigData, uint8(int32(SQLITE_ECEL_DUP)|v2)) + if bSeq != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor, regBase+nExpr) + } + if nPrefixReg == 0 && nData > 0 { + _sqlite3ExprCodeMove(tls, pParse, regData, regBase+nExpr+bSeq, nData) + } + if nOBSat > 0 { /* Original KeyInfo on the sorter table */ + regRecord = _makeSorterRecord(tls, pParse, pSort, pSelect, regBase, nBase) + regPrevKey = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat + nKey = nExpr - (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat + bSeq + if bSeq != 0 { + addrFirst = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regBase+nExpr) + } else { + addrFirst = _sqlite3VdbeAddOp1(tls, v, int32(OP_SequenceTest), (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Compare), regPrevKey, regBase, (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat) + pOp = _sqlite3VdbeGetOp(tls, v, (*TSortCtx)(unsafe.Pointer(pSort)).FaddrSortIndex) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = nKey + nData + pKI = *(*uintptr)(unsafe.Pointer(pOp + 16)) + libc.Xmemset(tls, (*TKeyInfo)(unsafe.Pointer(pKI)).FaSortFlags, 0, uint64((*TKeyInfo)(unsafe.Pointer(pKI)).FnKeyField)) /* Makes OP_Jump testable */ + _sqlite3VdbeChangeP4(tls, v, -int32(1), pKI, -int32(8)) + *(*uintptr)(unsafe.Pointer(pOp + 16)) = _sqlite3KeyInfoFromExprList(tls, pParse, (*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy, nOBSat, int32((*TKeyInfo)(unsafe.Pointer(pKI)).FnAllField)-int32((*TKeyInfo)(unsafe.Pointer(pKI)).FnKeyField)-int32(1)) + pOp = uintptr(0) /* Ensure pOp not used after sqlite3VdbeAddOp3() */ + addrJmp = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addrJmp+int32(1), 0, addrJmp+int32(1)) + (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut = _sqlite3VdbeMakeLabel(tls, pParse) + v4 = pParse + 56 + *(*int32)(unsafe.Pointer(v4))++ + v3 = *(*int32)(unsafe.Pointer(v4)) + (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn = v3 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + _sqlite3VdbeAddOp1(tls, v, int32(OP_ResetSorter), (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor) + if iLimit != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNot), iLimit, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelDone) + } + _sqlite3VdbeJumpHere(tls, v, addrFirst) + _sqlite3ExprCodeMove(tls, pParse, regBase, regPrevKey, (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat) + _sqlite3VdbeJumpHere(tls, v, addrJmp) + } + if iLimit != 0 { + /* At this point the values for the new sorter entry are stored + ** in an array of registers. They need to be composed into a record + ** and inserted into the sorter if either (a) there are currently + ** less than LIMIT+OFFSET items or (b) the new record is smaller than + ** the largest record currently in the sorter. If (b) is true and there + ** are already LIMIT+OFFSET items in the sorter, delete the largest + ** entry before inserting the new one. This way there are never more + ** than LIMIT+OFFSET items in the sorter. + ** + ** If the new record does not need to be inserted into the sorter, + ** jump to the next iteration of the loop. If the pSort->labelOBLopt + ** value is not zero, then it is a label of where to jump. Otherwise, + ** just bypass the row insert logic. See the header comment on the + ** sqlite3WhereOrderByLimitOptLabel() function for additional info. + */ + iCsr = (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNotZero), iLimit, _sqlite3VdbeCurrentAddr(tls, v)+int32(4)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Last), iCsr, 0) + iSkip = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxLE), iCsr, 0, regBase+nOBSat, nExpr-nOBSat) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Delete), iCsr) + } + if regRecord == 0 { + regRecord = _makeSorterRecord(tls, pParse, pSort, pSelect, regBase, nBase) + } + if int32((*TSortCtx)(unsafe.Pointer(pSort)).FsortFlags)&int32(SORTFLAG_UseSorter) != 0 { + op = int32(OP_SorterInsert) + } else { + op = int32(OP_IdxInsert) + } + _sqlite3VdbeAddOp4Int(tls, v, op, (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor, regRecord, regBase+nOBSat, nBase-nOBSat) + if iSkip != 0 { + if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelOBLopt != 0 { + v5 = (*TSortCtx)(unsafe.Pointer(pSort)).FlabelOBLopt + } else { + v5 = _sqlite3VdbeCurrentAddr(tls, v) + } + _sqlite3VdbeChangeP2(tls, v, iSkip, v5) + } +} + +// C documentation +// +// /* +// ** Add code to implement the OFFSET +// */ +func _codeOffset(tls *libc.TLS, v uintptr, iOffset int32, iContinue int32) { + if iOffset > 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_IfPos), iOffset, iContinue, int32(1)) + } +} + +// C documentation +// +// /* +// ** Add code that will check to make sure the array of registers starting at +// ** iMem form a distinct entry. This is used by both "SELECT DISTINCT ..." and +// ** distinct aggregates ("SELECT count(DISTINCT ) ..."). Three strategies +// ** are available. Which is used depends on the value of parameter eTnctType, +// ** as follows: +// ** +// ** WHERE_DISTINCT_UNORDERED/WHERE_DISTINCT_NOOP: +// ** Build an ephemeral table that contains all entries seen before and +// ** skip entries which have been seen before. +// ** +// ** Parameter iTab is the cursor number of an ephemeral table that must +// ** be opened before the VM code generated by this routine is executed. +// ** The ephemeral cursor table is queried for a record identical to the +// ** record formed by the current array of registers. If one is found, +// ** jump to VM address addrRepeat. Otherwise, insert a new record into +// ** the ephemeral cursor and proceed. +// ** +// ** The returned value in this case is a copy of parameter iTab. +// ** +// ** WHERE_DISTINCT_ORDERED: +// ** In this case rows are being delivered sorted order. The ephemeral +// ** table is not required. Instead, the current set of values +// ** is compared against previous row. If they match, the new row +// ** is not distinct and control jumps to VM address addrRepeat. Otherwise, +// ** the VM program proceeds with processing the new row. +// ** +// ** The returned value in this case is the register number of the first +// ** in an array of registers used to store the previous result row so that +// ** it can be compared to the next. The caller must ensure that this +// ** register is initialized to NULL. (The fixDistinctOpenEph() routine +// ** will take care of this initialization.) +// ** +// ** WHERE_DISTINCT_UNIQUE: +// ** In this case it has already been determined that the rows are distinct. +// ** No special action is required. The return value is zero. +// ** +// ** Parameter pEList is the list of expressions used to generated the +// ** contents of each row. It is used by this routine to determine (a) +// ** how many elements there are in the array of registers and (b) the +// ** collation sequences that should be used for the comparisons if +// ** eTnctType is WHERE_DISTINCT_ORDERED. +// */ +func _codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, addrRepeat int32, pEList uintptr, regElem int32) (r int32) { + var i, iJump, iRet, nResultCol, r1, regPrev, v1 int32 + var pColl, v uintptr + _, _, _, _, _, _, _, _, _ = i, iJump, iRet, nResultCol, pColl, r1, regPrev, v, v1 + iRet = 0 + nResultCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + switch eTnctType { + case int32(WHERE_DISTINCT_ORDERED): /* Previous row content */ + /* Allocate space for the previous row */ + v1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + libc.Int32FromInt32(1) + regPrev = v1 + iRet = v1 + *(*int32)(unsafe.Pointer(pParse + 56)) += nResultCol + iJump = _sqlite3VdbeCurrentAddr(tls, v) + nResultCol + i = 0 + for { + if !(i < nResultCol) { + break + } + pColl = _sqlite3ExprCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr) + if i < nResultCol-int32(1) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), regElem+i, iJump, regPrev+i) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), regElem+i, addrRepeat, regPrev+i) + } + _sqlite3VdbeChangeP4(tls, v, -int32(1), pColl, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + goto _2 + _2: + ; + i++ + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regElem, regPrev, nResultCol-int32(1)) + case int32(WHERE_DISTINCT_UNIQUE): + /* nothing to do */ + default: + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iTab, addrRepeat, regElem, nResultCol) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regElem, nResultCol, r1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iTab, r1, regElem, nResultCol) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + _sqlite3ReleaseTempReg(tls, pParse, r1) + iRet = iTab + break + } + return iRet +} + +// C documentation +// +// /* +// ** This routine runs after codeDistinct(). It makes necessary +// ** adjustments to the OP_OpenEphemeral opcode that the codeDistinct() +// ** routine made use of. This processing must be done separately since +// ** sometimes codeDistinct is called before the OP_OpenEphemeral is actually +// ** laid down. +// ** +// ** WHERE_DISTINCT_NOOP: +// ** WHERE_DISTINCT_UNORDERED: +// ** +// ** No adjustments necessary. This function is a no-op. +// ** +// ** WHERE_DISTINCT_UNIQUE: +// ** +// ** The ephemeral table is not needed. So change the +// ** OP_OpenEphemeral opcode into an OP_Noop. +// ** +// ** WHERE_DISTINCT_ORDERED: +// ** +// ** The ephemeral table is not needed. But we do need register +// ** iVal to be initialized to NULL. So change the OP_OpenEphemeral +// ** into an OP_Null on the iVal register. +// */ +func _fixDistinctOpenEph(tls *libc.TLS, pParse uintptr, eTnctType int32, iVal int32, iOpenEphAddr int32) { + var pOp, v uintptr + _, _ = pOp, v + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 && (eTnctType == int32(WHERE_DISTINCT_UNIQUE) || eTnctType == int32(WHERE_DISTINCT_ORDERED)) { + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + _sqlite3VdbeChangeToNoop(tls, v, iOpenEphAddr) + if int32((*TVdbeOp)(unsafe.Pointer(_sqlite3VdbeGetOp(tls, v, iOpenEphAddr+int32(1)))).Fopcode) == int32(OP_Explain) { + _sqlite3VdbeChangeToNoop(tls, v, iOpenEphAddr+int32(1)) + } + if eTnctType == int32(WHERE_DISTINCT_ORDERED) { + /* Change the OP_OpenEphemeral to an OP_Null that sets the MEM_Cleared + ** bit on the first register of the previous value. This will cause the + ** OP_Ne added in codeDistinct() to always fail on the first iteration of + ** the loop even if the first row is all NULLs. */ + pOp = _sqlite3VdbeGetOp(tls, v, iOpenEphAddr) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_Null) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = int32(1) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = iVal + } + } +} + +// C documentation +// +// /* +// ** This routine generates the code for the inside of the inner loop +// ** of a SELECT. +// ** +// ** If srcTab is negative, then the p->pEList expressions +// ** are evaluated in order to get the data for this row. If srcTab is +// ** zero or more, then data is pulled from srcTab and p->pEList is used only +// ** to get the number of columns and the collation sequence for each column. +// */ +func _selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pSort uintptr, pDistinct uintptr, pDest uintptr, iContinue int32, iBreak int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var addr, addrTest, eDest, eType, hasDistinct, i, i2, iParm, iTab, j, nKey, nPrefixReg, nResultCol, r1, r11, r12, r13, r14, r2, r21, r3, regOrig, regResult, v1, v2, v5 int32 + var ecelFlags Tu8 + var pEList, pSO, v uintptr + var _ /* sRowLoadInfo at bp+0 */ TRowLoadInfo + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addrTest, eDest, eType, ecelFlags, hasDistinct, i, i2, iParm, iTab, j, nKey, nPrefixReg, nResultCol, pEList, pSO, r1, r11, r12, r13, r14, r2, r21, r3, regOrig, regResult, v, v1, v2, v5 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* True if the DISTINCT keyword is present */ + eDest = int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) /* How to dispose of results */ + iParm = (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm /* Number of result columns */ + nPrefixReg = 0 /* Start of memory holding full result (or 0) */ + if pDistinct != 0 { + v1 = int32((*TDistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) + } else { + v1 = WHERE_DISTINCT_NOOP + } + hasDistinct = v1 + if pSort != 0 && (*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy == uintptr(0) { + pSort = uintptr(0) + } + if pSort == uintptr(0) && !(hasDistinct != 0) { + _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, iContinue) + } + /* Pull the requested columns. + */ + nResultCol = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr + if (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst == 0 { + if pSort != 0 { + nPrefixReg = (*TExprList)(unsafe.Pointer((*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr + if !(int32((*TSortCtx)(unsafe.Pointer(pSort)).FsortFlags)&libc.Int32FromInt32(SORTFLAG_UseSorter) != 0) { + nPrefixReg++ + } + *(*int32)(unsafe.Pointer(pParse + 56)) += nPrefixReg + } + (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nResultCol + } else { + if (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst+nResultCol > (*TParse)(unsafe.Pointer(pParse)).FnMem { + /* This is an error condition that can result, for example, when a SELECT + ** on the right-hand side of an INSERT contains more result columns than + ** there are columns in the table on the left. The error will be caught + ** and reported later. But we need to make sure enough memory is allocated + ** to avoid other spurious errors in the meantime. */ + *(*int32)(unsafe.Pointer(pParse + 56)) += nResultCol + } + } + (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = nResultCol + v2 = (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst + regResult = v2 + regOrig = v2 + if srcTab >= 0 { + i = 0 + for { + if !(i < nResultCol) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), srcTab, i, regResult+i) + goto _3 + _3: + ; + i++ + } + } else { + if eDest != int32(SRT_Exists) { + if eDest == int32(SRT_Mem) || eDest == int32(SRT_Output) || eDest == int32(SRT_Coroutine) { + ecelFlags = uint8(SQLITE_ECEL_DUP) + } else { + ecelFlags = uint8(0) + } + if pSort != 0 && hasDistinct == 0 && eDest != int32(SRT_EphemTab) && eDest != int32(SRT_Table) { + /* For each expression in p->pEList that is a copy of an expression in + ** the ORDER BY clause (pSort->pOrderBy), set the associated + ** iOrderByCol value to one more than the index of the ORDER BY + ** expression within the sort-key that pushOntoSorter() will generate. + ** This allows the p->pEList field to be omitted from the sorted record, + ** saving space and CPU cycles. */ + ecelFlags = Tu8(int32(ecelFlags) | (libc.Int32FromInt32(SQLITE_ECEL_OMITREF) | libc.Int32FromInt32(SQLITE_ECEL_REF))) + i = (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat + for { + if !(i < (*TExprList)(unsafe.Pointer((*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr) { + break + } + v5 = int32(*(*Tu16)(unsafe.Pointer((*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy + 8 + uintptr(i)*32 + 24))) + j = v5 + if v5 > 0 { + *(*Tu16)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8 + uintptr(j-int32(1))*32 + 24)) = uint16(i + int32(1) - (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat) + } + goto _4 + _4: + ; + i++ + } + /* Adjust nResultCol to account for columns that are omitted + ** from the sorter by the optimizations in this branch */ + pEList = (*TSelect)(unsafe.Pointer(p)).FpEList + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if int32(*(*Tu16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 24))) > 0 { + nResultCol-- + regOrig = 0 + } + goto _6 + _6: + ; + i++ + } + } + (*(*TRowLoadInfo)(unsafe.Pointer(bp))).FregResult = regResult + (*(*TRowLoadInfo)(unsafe.Pointer(bp))).FecelFlags = ecelFlags + if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && int32(ecelFlags)&int32(SQLITE_ECEL_OMITREF) != 0 && nPrefixReg > 0 { + (*TSortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad = bp + regOrig = 0 + } else { + _innerLoopLoadRow(tls, pParse, p, bp) + } + } + } + /* If the DISTINCT keyword was present on the SELECT statement + ** and this row has been seen before, then do not make this row + ** part of the result. + */ + if hasDistinct != 0 { + eType = int32((*TDistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) + iTab = (*TDistinctCtx)(unsafe.Pointer(pDistinct)).FtabTnct + iTab = _codeDistinct(tls, pParse, eType, iTab, iContinue, (*TSelect)(unsafe.Pointer(p)).FpEList, regResult) + _fixDistinctOpenEph(tls, pParse, eType, iTab, (*TDistinctCtx)(unsafe.Pointer(pDistinct)).FaddrTnct) + if pSort == uintptr(0) { + _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, iContinue) + } + } + switch eDest { + /* In this mode, write each query result to the key of the temporary + ** table iParm. + */ + case int32(SRT_Union): + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regResult, nResultCol, r1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r1, regResult, nResultCol) + _sqlite3ReleaseTempReg(tls, pParse, r1) + break + /* Construct a record from the query result, but instead of + ** saving that record, use it as a key to delete elements from + ** the temporary table iParm. + */ + fallthrough + case int32(SRT_Except): + _sqlite3VdbeAddOp3(tls, v, int32(OP_IdxDelete), iParm, regResult, nResultCol) + break + /* Store the result as data using a unique key. + */ + fallthrough + case int32(SRT_Fifo): + fallthrough + case int32(SRT_DistFifo): + fallthrough + case int32(SRT_Table): + fallthrough + case int32(SRT_EphemTab): + r11 = _sqlite3GetTempRange(tls, pParse, nPrefixReg+int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regResult, nResultCol, r11+nPrefixReg) + if eDest == int32(SRT_DistFifo) { + /* If the destination is DistFifo, then cursor (iParm+1) is open + ** on an ephemeral index. If the current row is already present + ** in the index, do not write it to the output. If not, add the + ** current row to the index and proceed with writing it to the + ** output table as well. */ + addr = _sqlite3VdbeCurrentAddr(tls, v) + int32(4) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iParm+int32(1), addr, r11, 0) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm+int32(1), r11, regResult, nResultCol) + } + if pSort != 0 { + _pushOntoSorter(tls, pParse, pSort, p, r11+nPrefixReg, regOrig, int32(1), nPrefixReg) + } else { + r2 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iParm, r2) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iParm, r11, r2) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + _sqlite3ReleaseTempReg(tls, pParse, r2) + } + _sqlite3ReleaseTempRange(tls, pParse, r11, nPrefixReg+int32(1)) + case int32(SRT_Upfrom): + if pSort != 0 { + _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + i2 = (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm2 + r12 = _sqlite3GetTempReg(tls, pParse) + /* If the UPDATE FROM join is an aggregate that matches no rows, it + ** might still be trying to return one row, because that is what + ** aggregates do. Don't record that empty row in the output table. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regResult, iBreak) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regResult+libc.BoolInt32(i2 < 0), nResultCol-libc.BoolInt32(i2 < 0), r12) + if i2 < 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iParm, r12, regResult) + } else { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r12, regResult, i2) + } + } + break + /* If we are creating a set for an "expr IN (SELECT ...)" construct, + ** then there should be a single item on the stack. Write this + ** item into the set table with bogus data. + */ + fallthrough + case int32(SRT_Set): + if pSort != 0 { + /* At first glance you would think we could optimize out the + ** ORDER BY in this case since the order of entries in the set + ** does not matter. But there might be a LIMIT clause, in which + ** case the order does matter */ + _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + r13 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regResult, nResultCol, r13, (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nResultCol) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r13, regResult, nResultCol) + _sqlite3ReleaseTempReg(tls, pParse, r13) + } + break + /* If any row exist in the result set, record that fact and abort. + */ + fallthrough + case int32(SRT_Exists): + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), iParm) + /* The LIMIT clause will terminate the loop for us */ + break + /* If this is a scalar select that is part of an expression, then + ** store the results in the appropriate memory cell or array of + ** memory cells and break out of the scan loop. + */ + fallthrough + case int32(SRT_Mem): + if pSort != 0 { + _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + /* The LIMIT clause will jump out of the loop for us */ + } + case int32(SRT_Coroutine): /* Send data to a co-routine */ + fallthrough + case int32(SRT_Output): /* Return the results */ + if pSort != 0 { + _pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + if eDest == int32(SRT_Coroutine) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), regResult, nResultCol) + } + } + break + /* Write the results into a priority queue that is order according to + ** pDest->pOrderBy (in pSO). pDest->iSDParm (in iParm) is the cursor for an + ** index with pSO->nExpr+2 columns. Build a key using pSO for the first + ** pSO->nExpr columns, then make sure all keys are unique by adding a + ** final OP_Sequence column. The last column is the record as a blob. + */ + fallthrough + case int32(SRT_DistQueue): + fallthrough + case int32(SRT_Queue): + addrTest = 0 + pSO = (*TSelectDest)(unsafe.Pointer(pDest)).FpOrderBy + nKey = (*TExprList)(unsafe.Pointer(pSO)).FnExpr + r14 = _sqlite3GetTempReg(tls, pParse) + r21 = _sqlite3GetTempRange(tls, pParse, nKey+int32(2)) + r3 = r21 + nKey + int32(1) + if eDest == int32(SRT_DistQueue) { + /* If the destination is DistQueue, then cursor (iParm+1) is open + ** on a second ephemeral index that holds all values every previously + ** added to the queue. */ + addrTest = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iParm+int32(1), 0, regResult, nResultCol) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regResult, nResultCol, r3) + if eDest == int32(SRT_DistQueue) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxInsert), iParm+int32(1), r3) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + } + i = 0 + for { + if !(i < nKey) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regResult+int32(*(*Tu16)(unsafe.Pointer(pSO + 8 + uintptr(i)*32 + 24)))-int32(1), r21+i) + goto _7 + _7: + ; + i++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), iParm, r21+nKey) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), r21, nKey+int32(2), r14) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r14, r21, nKey+int32(2)) + if addrTest != 0 { + _sqlite3VdbeJumpHere(tls, v, addrTest) + } + _sqlite3ReleaseTempReg(tls, pParse, r14) + _sqlite3ReleaseTempRange(tls, pParse, r21, nKey+int32(2)) + break + /* Discard the results. This is used for SELECT statements inside + ** the body of a TRIGGER. The purpose of such selects is to call + ** user-defined functions that have side effects. We do not care + ** about the actual results of the select. + */ + fallthrough + default: + break + } + /* Jump to the end of the loop if the LIMIT is reached. Except, if + ** there is a sorter, in which case the sorter has already limited + ** the output for us. + */ + if pSort == uintptr(0) && (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_DecrJumpZero), (*TSelect)(unsafe.Pointer(p)).FiLimit, iBreak) + } +} + +// C documentation +// +// /* +// ** Allocate a KeyInfo object sufficient for an index of N key columns and +// ** X extra columns. +// */ +func _sqlite3KeyInfoAlloc(tls *libc.TLS, db uintptr, N int32, X int32) (r uintptr) { + var nExtra int32 + var p uintptr + _, _ = nExtra, p + nExtra = int32(uint64(N+X)*(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(1)) - uint64(8)) + p = _sqlite3DbMallocRawNN(tls, db, uint64(40)+uint64(nExtra)) + if p != 0 { + (*TKeyInfo)(unsafe.Pointer(p)).FaSortFlags = p + 32 + uintptr(N+X)*8 + (*TKeyInfo)(unsafe.Pointer(p)).FnKeyField = uint16(N) + (*TKeyInfo)(unsafe.Pointer(p)).FnAllField = uint16(N + X) + (*TKeyInfo)(unsafe.Pointer(p)).Fenc = (*Tsqlite3)(unsafe.Pointer(db)).Fenc + (*TKeyInfo)(unsafe.Pointer(p)).Fdb = db + (*TKeyInfo)(unsafe.Pointer(p)).FnRef = uint32(1) + libc.Xmemset(tls, p+1*40, 0, uint64(nExtra)) + } else { + return _sqlite3OomFault(tls, db) + } + return p +} + +// C documentation +// +// /* +// ** Deallocate a KeyInfo object +// */ +func _sqlite3KeyInfoUnref(tls *libc.TLS, p uintptr) { + if p != 0 { + (*TKeyInfo)(unsafe.Pointer(p)).FnRef-- + if (*TKeyInfo)(unsafe.Pointer(p)).FnRef == uint32(0) { + _sqlite3DbNNFreeNN(tls, (*TKeyInfo)(unsafe.Pointer(p)).Fdb, p) + } + } +} + +// C documentation +// +// /* +// ** Make a new pointer to a KeyInfo object +// */ +func _sqlite3KeyInfoRef(tls *libc.TLS, p uintptr) (r uintptr) { + if p != 0 { + (*TKeyInfo)(unsafe.Pointer(p)).FnRef++ + } + return p +} + +// C documentation +// +// /* +// ** Given an expression list, generate a KeyInfo structure that records +// ** the collating sequence for each expression in that expression list. +// ** +// ** If the ExprList is an ORDER BY or GROUP BY clause then the resulting +// ** KeyInfo structure is appropriate for initializing a virtual index to +// ** implement that clause. If the ExprList is the result set of a SELECT +// ** then the KeyInfo structure is appropriate for initializing a virtual +// ** index to implement a DISTINCT test. +// ** +// ** Space to hold the KeyInfo structure is obtained from malloc. The calling +// ** function is responsible for seeing that this structure is eventually +// ** freed. +// */ +func _sqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, iStart int32, nExtra int32) (r uintptr) { + var db, pInfo, pItem uintptr + var i, nExpr int32 + _, _, _, _, _ = db, i, nExpr, pInfo, pItem + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + nExpr = (*TExprList)(unsafe.Pointer(pList)).FnExpr + pInfo = _sqlite3KeyInfoAlloc(tls, db, nExpr-iStart, nExtra+int32(1)) + if pInfo != 0 { + i = iStart + pItem = pList + 8 + uintptr(iStart)*32 + for { + if !(i < nExpr) { + break + } + *(*uintptr)(unsafe.Pointer(pInfo + 32 + uintptr(i-iStart)*8)) = _sqlite3ExprNNCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr(i-iStart))) = (*TExprList_item)(unsafe.Pointer(pItem)).Ffg.FsortFlags + goto _1 + _1: + ; + i++ + pItem += 32 + } + } + return pInfo +} + +// C documentation +// +// /* +// ** Name of the connection operator, used for error messages. +// */ +func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { + var z uintptr + _ = z + switch id { + case int32(TK_ALL): + z = __ccgo_ts + 19146 + case int32(TK_INTERSECT): + z = __ccgo_ts + 19156 + case int32(TK_EXCEPT): + z = __ccgo_ts + 19166 + default: + z = __ccgo_ts + 19173 + break + } + return z +} + +// C documentation +// +// /* +// ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function +// ** is a no-op. Otherwise, it adds a single row of output to the EQP result, +// ** where the caption is of the form: +// ** +// ** "USE TEMP B-TREE FOR xxx" +// ** +// ** where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which +// ** is determined by the zUsage argument. +// */ +func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19179, libc.VaList(bp+8, zUsage)) +} + +/* +** Assign expression b to lvalue a. A second, no-op, version of this macro +** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code +** in sqlite3Select() to assign values to structure member variables that +** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the +** code with #ifndef directives. + */ + +// C documentation +// +// /* +// ** If the inner loop was generated using a non-null pOrderBy argument, +// ** then the results were placed in a sorter. After the loop is terminated +// ** we need to run the sorter and output the results. The following +// ** routine generates the code needed to do that. +// */ +func _generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nColumn int32, pDest uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aOutEx, pOrderBy, v, v1, v3, v5 uintptr + var addr, addrBreak, addrContinue, addrOnce, bSeq, eDest, i, i2, iCol, iParm, iRead, iSortTab, iTab, nKey, nRefKey, r1, regRow, regRowid, regSortOut, v2, v4, v8 int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aOutEx, addr, addrBreak, addrContinue, addrOnce, bSeq, eDest, i, i2, iCol, iParm, iRead, iSortTab, iTab, nKey, nRefKey, pOrderBy, r1, regRow, regRowid, regSortOut, v, v1, v2, v3, v4, v5, v8 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* The prepared statement */ + addrBreak = (*TSortCtx)(unsafe.Pointer(pSort)).FlabelDone /* Jump here to exit loop */ + addrContinue = _sqlite3VdbeMakeLabel(tls, pParse) /* Top of output loop. Jump for Next. */ + addrOnce = 0 + pOrderBy = (*TSortCtx)(unsafe.Pointer(pSort)).FpOrderBy + eDest = int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) + iParm = (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm /* True if sorter record includes seq. no. */ + nRefKey = 0 + aOutEx = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 + if (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat > 0 { + v1 = __ccgo_ts + 19202 + } else { + v1 = __ccgo_ts + 1680 + } + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19217, libc.VaList(bp+8, v1)) + if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + _sqlite3VdbeGoto(tls, v, addrBreak) + _sqlite3VdbeResolveLabel(tls, v, (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + } + iTab = (*TSortCtx)(unsafe.Pointer(pSort)).FiECursor + if eDest == int32(SRT_Output) || eDest == int32(SRT_Coroutine) || eDest == int32(SRT_Mem) { + if eDest == int32(SRT_Mem) && (*TSelect)(unsafe.Pointer(p)).FiOffset != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst) + } + regRowid = 0 + regRow = (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst + } else { + regRowid = _sqlite3GetTempReg(tls, pParse) + if eDest == int32(SRT_EphemTab) || eDest == int32(SRT_Table) { + regRow = _sqlite3GetTempReg(tls, pParse) + nColumn = 0 + } else { + regRow = _sqlite3GetTempRange(tls, pParse, nColumn) + } + } + nKey = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr - (*TSortCtx)(unsafe.Pointer(pSort)).FnOBSat + if int32((*TSortCtx)(unsafe.Pointer(pSort)).FsortFlags)&int32(SORTFLAG_UseSorter) != 0 { + v3 = pParse + 56 + *(*int32)(unsafe.Pointer(v3))++ + v2 = *(*int32)(unsafe.Pointer(v3)) + regSortOut = v2 + v5 = pParse + 52 + v4 = *(*int32)(unsafe.Pointer(v5)) + *(*int32)(unsafe.Pointer(v5))++ + iSortTab = v4 + if (*TSortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenPseudo), iSortTab, regSortOut, nKey+int32(1)+nColumn+nRefKey) + if addrOnce != 0 { + _sqlite3VdbeJumpHere(tls, v, addrOnce) + } + addr = int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterSort), iTab, addrBreak) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SorterData), iTab, regSortOut, iSortTab) + bSeq = 0 + } else { + addr = int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Sort), iTab, addrBreak) + _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, addrContinue) + iSortTab = iTab + bSeq = int32(1) + if (*TSelect)(unsafe.Pointer(p)).FiOffset > 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TSelect)(unsafe.Pointer(p)).FiLimit, -int32(1)) + } + } + i = 0 + iCol = nKey + bSeq - libc.Int32FromInt32(1) + for { + if !(i < nColumn) { + break + } + if int32(*(*Tu16)(unsafe.Pointer(aOutEx + uintptr(i)*32 + 24))) == 0 { + iCol++ + } + goto _6 + _6: + ; + i++ + } + i = nColumn - int32(1) + for { + if !(i >= 0) { + break + } + if *(*Tu16)(unsafe.Pointer(aOutEx + uintptr(i)*32 + 24)) != 0 { + iRead = int32(*(*Tu16)(unsafe.Pointer(aOutEx + uintptr(i)*32 + 24))) - int32(1) + } else { + v8 = iCol + iCol-- + iRead = v8 + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, iRead, regRow+i) + goto _7 + _7: + ; + i-- + } + switch eDest { + case int32(SRT_Table): + fallthrough + case int32(SRT_EphemTab): + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iSortTab, nKey+bSeq, regRow) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iParm, regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iParm, regRow, regRowid) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + case int32(SRT_Set): + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regRow, nColumn, regRowid, (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nColumn) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, regRowid, regRow, nColumn) + case int32(SRT_Mem): + /* The LIMIT clause will terminate the loop for us */ + case int32(SRT_Upfrom): + i2 = (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm2 + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regRow+libc.BoolInt32(i2 < 0), nColumn-libc.BoolInt32(i2 < 0), r1) + if i2 < 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iParm, r1, regRow) + } else { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iParm, r1, regRow, i2) + } + default: + if eDest == int32(SRT_Output) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst, nColumn) + } else { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm) + } + break + } + if regRowid != 0 { + if eDest == int32(SRT_Set) { + _sqlite3ReleaseTempRange(tls, pParse, regRow, nColumn) + } else { + _sqlite3ReleaseTempReg(tls, pParse, regRow) + } + _sqlite3ReleaseTempReg(tls, pParse, regRowid) + } + /* The bottom of the loop + */ + _sqlite3VdbeResolveLabel(tls, v, addrContinue) + if int32((*TSortCtx)(unsafe.Pointer(pSort)).FsortFlags)&int32(SORTFLAG_UseSorter) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterNext), iTab, addr) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iTab, addr) + } + if (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), (*TSortCtx)(unsafe.Pointer(pSort)).FregReturn) + } + _sqlite3VdbeResolveLabel(tls, v, addrBreak) +} + +// C documentation +// +// /* +// ** Return a pointer to a string containing the 'declaration type' of the +// ** expression pExpr. The string may be treated as static by the caller. +// ** +// ** The declaration type is the exact datatype definition extracted from the +// ** original CREATE TABLE statement if the expression is a column. The +// ** declaration type for a ROWID field is INTEGER. Exactly when an expression +// ** is considered a column can be complex in the presence of subqueries. The +// ** result-set expression in all of the following SELECT statements is +// ** considered a column by this function. +// ** +// ** SELECT col FROM tbl; +// ** SELECT (SELECT col FROM tbl; +// ** SELECT (SELECT col FROM tbl); +// ** SELECT abc FROM (SELECT col AS abc FROM tbl); +// ** +// ** The declaration type for any expression other than a column is NULL. +// ** +// ** This routine has either 3 or 6 parameters depending on whether or not +// ** the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used. +// */ +func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, pzOrigTab uintptr, pzOrigCol uintptr) (r uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var iCol, iDb, j int32 + var p, p1, pS, pS1, pTab, pTabList, zType uintptr + var _ /* sNC at bp+24 */ TNameContext + var _ /* sNC at bp+80 */ TNameContext + var _ /* zOrigCol at bp+16 */ uintptr + var _ /* zOrigDb at bp+0 */ uintptr + var _ /* zOrigTab at bp+8 */ uintptr + _, _, _, _, _, _, _, _, _, _ = iCol, iDb, j, p, p1, pS, pS1, pTab, pTabList, zType + zType = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + case int32(TK_COLUMN): + /* The expression is a column. Locate the table the column is being + ** extracted from in NameContext.pSrcList. This table may be real + ** database table or a subquery. + */ + pTab = uintptr(0) /* Table structure column is extracted from */ + pS = uintptr(0) /* Select the column is extracted from */ + iCol = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) /* Index of column in pTab */ + for pNC != 0 && !(pTab != 0) { + pTabList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList + j = 0 + for { + if !(j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc && (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*104))).FiCursor != (*TExpr)(unsafe.Pointer(pExpr)).FiTable) { + break + } + goto _1 + _1: + ; + j++ + } + if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { + pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*104))).FpTab + pS = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*104))).FpSelect + } else { + pNC = (*TNameContext)(unsafe.Pointer(pNC)).FpNext + } + } + if pTab == uintptr(0) { + /* At one time, code such as "SELECT new.x" within a trigger would + ** cause this condition to run. Since then, we have restructured how + ** trigger code is generated and so this condition is no longer + ** possible. However, it can still be true for statements like + ** the following: + ** + ** CREATE TABLE t1(col INTEGER); + ** SELECT (SELECT t1.col) FROM FROM t1; + ** + ** when columnType() is called on the expression "t1.col" in the + ** sub-select. In this case, set the column type to NULL, even + ** though it should really be "INTEGER". + ** + ** This is not a problem, as the column type of "t1.col" is never + ** used. When columnType() is called on the expression + ** "(SELECT t1.col)", the correct type is returned (see the TK_SELECT + ** branch below. */ + break + } + if pS != 0 { + /* The "table" is actually a sub-select or a view in the FROM clause + ** of the SELECT statement. Return the declaration type and origin + ** data for the result-set column of the sub-select. + */ + if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { + p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*32))).FpExpr + (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc + (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpNext = pNC + (*(*TNameContext)(unsafe.Pointer(bp + 24))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + zType = _columnTypeImpl(tls, bp+24, p, bp, bp+8, bp+16) + } + } else { + /* A real table or a CTE table */ + if iCol < 0 { + iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + } + if iCol < 0 { + zType = __ccgo_ts + 1168 + *(*uintptr)(unsafe.Pointer(bp + 16)) = __ccgo_ts + 16726 + } else { + *(*uintptr)(unsafe.Pointer(bp + 16)) = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName + zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TTable)(unsafe.Pointer(pTab)).FzName + if (*TNameContext)(unsafe.Pointer(pNC)).FpParse != 0 && (*TTable)(unsafe.Pointer(pTab)).FpSchema != 0 { + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer((*TNameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + *(*uintptr)(unsafe.Pointer(bp)) = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TNameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName + } + } + case int32(TK_SELECT): + pS1 = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + p1 = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS1)).FpEList + 8))).FpExpr + (*(*TNameContext)(unsafe.Pointer(bp + 80))).FpSrcList = (*TSelect)(unsafe.Pointer(pS1)).FpSrc + (*(*TNameContext)(unsafe.Pointer(bp + 80))).FpNext = pNC + (*(*TNameContext)(unsafe.Pointer(bp + 80))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse + zType = _columnTypeImpl(tls, bp+80, p1, bp, bp+8, bp+16) + break + } + if pzOrigDb != 0 { + *(*uintptr)(unsafe.Pointer(pzOrigDb)) = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(pzOrigTab)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + *(*uintptr)(unsafe.Pointer(pzOrigCol)) = *(*uintptr)(unsafe.Pointer(bp + 16)) + } + return zType +} + +// C documentation +// +// /* +// ** Generate code that will tell the VDBE the declaration types of columns +// ** in the result set. +// */ +func _generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pEList uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var i int32 + var p, v, zType uintptr + var _ /* sNC at bp+0 */ TNameContext + var _ /* zOrigCol at bp+72 */ uintptr + var _ /* zOrigDb at bp+56 */ uintptr + var _ /* zOrigTab at bp+64 */ uintptr + _, _, _, _ = i, p, v, zType + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = pTabList + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp))).FpNext = uintptr(0) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + p = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr + *(*uintptr)(unsafe.Pointer(bp + 56)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 72)) = uintptr(0) + zType = _columnTypeImpl(tls, bp, p, bp+56, bp+64, bp+72) + /* The vdbe must make its own copy of the column-type and other + ** column specific strings, in case the schema is reset before this + ** virtual machine is deleted. + */ + _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DATABASE), *(*uintptr)(unsafe.Pointer(bp + 56)), uintptr(-libc.Int32FromInt32(1))) + _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_TABLE), *(*uintptr)(unsafe.Pointer(bp + 64)), uintptr(-libc.Int32FromInt32(1))) + _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_COLUMN), *(*uintptr)(unsafe.Pointer(bp + 72)), uintptr(-libc.Int32FromInt32(1))) + _sqlite3VdbeSetColName(tls, v, i, int32(COLNAME_DECLTYPE), zType, uintptr(-libc.Int32FromInt32(1))) + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Compute the column names for a SELECT statement. +// ** +// ** The only guarantee that SQLite makes about column names is that if the +// ** column has an AS clause assigning it a name, that will be the name used. +// ** That is the only documented guarantee. However, countless applications +// ** developed over the years have made baseless assumptions about column names +// ** and will break if those assumptions changes. Hence, use extreme caution +// ** when modifying this routine to avoid breaking legacy. +// ** +// ** See Also: sqlite3ColumnsFromExprList() +// ** +// ** The PRAGMA short_column_names and PRAGMA full_column_names settings are +// ** deprecated. The default setting is short=ON, full=OFF. 99.9% of all +// ** applications should operate this way. Nevertheless, we need to support the +// ** other modes for legacy: +// ** +// ** short=OFF, full=OFF: Column name is the text of the expression has it +// ** originally appears in the SELECT statement. In +// ** other words, the zSpan of the result expression. +// ** +// ** short=ON, full=OFF: (This is the default setting). If the result +// ** refers directly to a table column, then the +// ** result column name is just the table column +// ** name: COLUMN. Otherwise use zSpan. +// ** +// ** full=ON, short=ANY: If the result refers directly to a table column, +// ** then the result column name with the table name +// ** prefix, ex: TABLE.COLUMN. Otherwise use zSpan. +// */ +func _sqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, pEList, pTab, pTabList, v, z, zCol, zName, zName1, v2 uintptr + var fullName, i, iCol, srcName int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, fullName, i, iCol, p, pEList, pTab, pTabList, srcName, v, z, zCol, zName, zName1, v2 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* COLUMN or TABLE.COLUMN if no AS clause and is direct */ + if (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet != 0 { + return + } + /* Column names are determined by the left-most term of a compound select */ + for (*TSelect)(unsafe.Pointer(pSelect)).FpPrior != 0 { + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior + } + pTabList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + pEList = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + (*TParse)(unsafe.Pointer(pParse)).FcolNamesSet = uint8(1) + fullName = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_FullColNames) != uint64(0)) + srcName = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ShortColNames) != uint64(0) || fullName != 0) + _sqlite3VdbeSetNumCols(tls, v, (*TExprList)(unsafe.Pointer(pEList)).FnExpr) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + p = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FpExpr + /* Agg processing has not run yet */ + /* Covering idx not yet coded */ + if (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0)) == ENAME_NAME { + /* An AS clause always takes first priority */ + zName = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName + _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, uintptr(-libc.Int32FromInt32(1))) + } else { + if srcName != 0 && int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) { + iCol = int32((*TExpr)(unsafe.Pointer(p)).FiColumn) + pTab = *(*uintptr)(unsafe.Pointer(p + 64)) + if iCol < 0 { + iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + } + if iCol < 0 { + zCol = __ccgo_ts + 16726 + } else { + zCol = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName + } + if fullName != 0 { + zName1 = uintptr(0) + zName1 = _sqlite3MPrintf(tls, db, __ccgo_ts+12413, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol)) + _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName1, __ccgo_fp(_sqlite3OomClear)) + } else { + _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, uintptr(-libc.Int32FromInt32(1))) + } + } else { + z = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(i)*32))).FzEName + if z == uintptr(0) { + v2 = _sqlite3MPrintf(tls, db, __ccgo_ts+19248, libc.VaList(bp+8, i+int32(1))) + } else { + v2 = _sqlite3DbStrDup(tls, db, z) + } + z = v2 + _sqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, z, __ccgo_fp(_sqlite3OomClear)) + } + } + goto _1 + _1: + ; + i++ + } + _generateColumnTypes(tls, pParse, pTabList, pEList) +} + +// C documentation +// +// /* +// ** Given an expression list (which is really the list of expressions +// ** that form the result set of a SELECT statement) compute appropriate +// ** column names for a table that would hold the expression list. +// ** +// ** All column names will be unique. +// ** +// ** Only the column names are computed. Column.zType, Column.zColl, +// ** and other fields of Column are zeroed. +// ** +// ** Return SQLITE_OK on success. If a memory allocation error occurs, +// ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. +// ** +// ** The only guarantee that SQLite makes about column names is that if the +// ** column has an AS clause assigning it a name, that will be the name used. +// ** That is the only documented guarantee. However, countless applications +// ** developed over the years have made baseless assumptions about column names +// ** and will break if those assumptions changes. Hence, use extreme caution +// ** when modifying this routine to avoid breaking legacy. +// ** +// ** See Also: sqlite3GenerateColumnNames() +// */ +func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, pnCol uintptr, paCol uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var aCol, db, pCol, pColExpr, pCollide, pTab, pX, zName, v2, v3, v4, p6, p9 uintptr + var i, iCol, j, nCol, nName int32 + var v5 bool + var v8 Tu32 + var _ /* cnt at bp+0 */ Tu32 + var _ /* ht at bp+8 */ THash + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCol, db, i, iCol, j, nCol, nName, pCol, pColExpr, pCollide, pTab, pX, zName, v2, v3, v4, v5, v8, p6, p9 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + _sqlite3HashInit(tls, bp+8) + if pEList != 0 { + nCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr + aCol = _sqlite3DbMallocZero(tls, db, uint64(16)*uint64(nCol)) + if nCol > int32(32767) { + nCol = int32(32767) + } + } else { + nCol = 0 + aCol = uintptr(0) + } + *(*Ti16)(unsafe.Pointer(pnCol)) = int16(nCol) + *(*uintptr)(unsafe.Pointer(paCol)) = aCol + i = 0 + pCol = aCol + for { + if !(i < nCol && !((*TParse)(unsafe.Pointer(pParse)).FnErr != 0)) { + break + } + pX = pEList + 8 + uintptr(i)*32 + /* Get an appropriate name for the column + */ + v2 = (*TExprList_item)(unsafe.Pointer(pX)).FzEName + zName = v2 + if v2 != uintptr(0) && int32(uint32(*(*uint16)(unsafe.Pointer(pX + 16 + 4))&0x3>>0)) == ENAME_NAME { + /* If the column contains an "AS " phrase, use as the name */ + } else { + pColExpr = _sqlite3ExprSkipCollateAndLikely(tls, (*TExprList_item)(unsafe.Pointer(pX)).FpExpr) + for pColExpr != uintptr(0) && int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_DOT) { + pColExpr = (*TExpr)(unsafe.Pointer(pColExpr)).FpRight + } + if int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pColExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) && *(*uintptr)(unsafe.Pointer(pColExpr + 64)) != uintptr(0) { + /* For columns use the column name name */ + iCol = int32((*TExpr)(unsafe.Pointer(pColExpr)).FiColumn) + pTab = *(*uintptr)(unsafe.Pointer(pColExpr + 64)) + if iCol < 0 { + iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) + } + if iCol >= 0 { + v3 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16))).FzCnName + } else { + v3 = __ccgo_ts + 16726 + } + zName = v3 + } else { + if int32((*TExpr)(unsafe.Pointer(pColExpr)).Fop) == int32(TK_ID) { + zName = *(*uintptr)(unsafe.Pointer(pColExpr + 8)) + } else { + /* Use the original text of the column expression as its name */ + /* pointer comparison intended */ + } + } + } + if zName != 0 && !(_sqlite3IsTrueOrFalse(tls, zName) != 0) { + zName = _sqlite3DbStrDup(tls, db, zName) + } else { + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19248, libc.VaList(bp+40, i+int32(1))) + } + /* Make sure the column name is unique. If the name is not unique, + ** append an integer to the name so that it becomes unique. + */ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + for { + if v5 = zName != 0; v5 { + v4 = _sqlite3HashFind(tls, bp+8, zName) + pCollide = v4 + } + if !(v5 && v4 != uintptr(0)) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pCollide + 16 + 4))&0x80>>7)) != 0 { + p6 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p6)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p6))) | libc.Int32FromInt32(COLFLAG_NOEXPAND)) + } + nName = _sqlite3Strlen30(tls, zName) + if nName > 0 { + j = nName - int32(1) + for { + if !(j > 0 && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zName + uintptr(j))))])&int32(0x04) != 0) { + break + } + goto _7 + _7: + ; + j-- + } + if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == int32(':') { + nName = j + } + } + *(*Tu32)(unsafe.Pointer(bp))++ + v8 = *(*Tu32)(unsafe.Pointer(bp)) + zName = _sqlite3MPrintf(tls, db, __ccgo_ts+19257, libc.VaList(bp+40, nName, zName, v8)) + _sqlite3ProgressCheck(tls, pParse) + if *(*Tu32)(unsafe.Pointer(bp)) > uint32(3) { + Xsqlite3_randomness(tls, int32(4), bp) + } + } + (*TColumn)(unsafe.Pointer(pCol)).FzCnName = zName + (*TColumn)(unsafe.Pointer(pCol)).FhName = _sqlite3StrIHash(tls, zName) + if int32(uint32(*(*uint16)(unsafe.Pointer(pX + 16 + 4))&0x100>>8)) != 0 { + p9 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p9)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p9))) | libc.Int32FromInt32(COLFLAG_NOEXPAND)) + } + if zName != 0 && _sqlite3HashInsert(tls, bp+8, zName, pX) == pX { + _sqlite3OomFault(tls, db) + } + goto _1 + _1: + ; + i++ + pCol += 16 + } + _sqlite3HashClear(tls, bp+8) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + j = 0 + for { + if !(j < i) { + break + } + _sqlite3DbFree(tls, db, (*(*TColumn)(unsafe.Pointer(aCol + uintptr(j)*16))).FzCnName) + goto _10 + _10: + ; + j++ + } + _sqlite3DbFree(tls, db, aCol) + *(*uintptr)(unsafe.Pointer(paCol)) = uintptr(0) + *(*Ti16)(unsafe.Pointer(pnCol)) = 0 + return (*TParse)(unsafe.Pointer(pParse)).Frc + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** pTab is a transient Table object that represents a subquery of some +// ** kind (maybe a parenthesized subquery in the FROM clause of a larger +// ** query, or a VIEW, or a CTE). This routine computes type information +// ** for that Table object based on the Select object that implements the +// ** subquery. For the purposes of this routine, "type information" means: +// ** +// ** * The datatype name, as it might appear in a CREATE TABLE statement +// ** * Which collating sequence to use for the column +// ** * The affinity of the column +// */ +func _sqlite3SubqueryColumnTypes(tls *libc.TLS, pParse uintptr, pTab uintptr, pSelect uintptr, aff int8) { + bp := tls.Alloc(64) + defer tls.Free(64) + var a, db, p, pCol, pColl, pS2, zType, p4, p5 uintptr + var i, j, m int32 + var m1, n Ti64 + var _ /* sNC at bp+0 */ TNameContext + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, db, i, j, m, m1, n, p, pCol, pColl, pS2, zType, p4, p5 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return + } + for (*TSelect)(unsafe.Pointer(pSelect)).FpPrior != 0 { + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior + } + a = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + 8 + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc + i = 0 + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags) & libc.Int32FromInt32(COLFLAG_NOINSERT)) + p = (*(*TExprList_item)(unsafe.Pointer(a + uintptr(i)*32))).FpExpr + /* pCol->szEst = ... // Column size est for SELECT tables never used */ + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = _sqlite3ExprAffinity(tls, p) + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) <= int32(SQLITE_AFF_NONE) { + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = aff + } + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) >= int32(SQLITE_AFF_TEXT) && (*TSelect)(unsafe.Pointer(pSelect)).FpNext != 0 { + m = 0 + m = 0 + pS2 = (*TSelect)(unsafe.Pointer(pSelect)).FpNext + for { + if !(pS2 != 0) { + break + } + m |= _sqlite3ExprDataType(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS2)).FpEList + 8 + uintptr(i)*32))).FpExpr) + goto _2 + _2: + ; + pS2 = (*TSelect)(unsafe.Pointer(pS2)).FpNext + } + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_TEXT) && m&int32(0x01) != 0 { + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = int8(SQLITE_AFF_BLOB) + } else { + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) && m&int32(0x02) != 0 { + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = int8(SQLITE_AFF_BLOB) + } + } + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) >= int32(SQLITE_AFF_NUMERIC) && int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_CAST) { + (*TColumn)(unsafe.Pointer(pCol)).Faffinity = int8(SQLITE_AFF_FLEXNUM) + } + } + zType = _columnTypeImpl(tls, bp, p, uintptr(0), uintptr(0), uintptr(0)) + if zType == uintptr(0) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) != int32(_sqlite3AffinityType(tls, zType, uintptr(0))) { + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_NUMERIC) || int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_FLEXNUM) { + zType = __ccgo_ts + 19265 + } else { + zType = uintptr(0) + j = int32(1) + for { + if !(j < int32(SQLITE_N_STDTYPE)) { + break + } + if int32(_sqlite3StdTypeAffinity[j]) == int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) { + zType = _sqlite3StdType[j] + break + } + goto _3 + _3: + ; + j++ + } + } + } + if zType != 0 { + m1 = int64(_sqlite3Strlen30(tls, zType)) + n = int64(_sqlite3Strlen30(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName)) + (*TColumn)(unsafe.Pointer(pCol)).FzCnName = _sqlite3DbReallocOrFree(tls, db, (*TColumn)(unsafe.Pointer(pCol)).FzCnName, uint64(n+m1+int64(2))) + p4 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(COLFLAG_HASTYPE) | libc.Int32FromInt32(COLFLAG_HASCOLL))) + if (*TColumn)(unsafe.Pointer(pCol)).FzCnName != 0 { + libc.Xmemcpy(tls, (*TColumn)(unsafe.Pointer(pCol)).FzCnName+uintptr(n+int64(1)), zType, uint64(m1+int64(1))) + p5 = pCol + 14 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(COLFLAG_HASTYPE)) + } + } + pColl = _sqlite3ExprCollSeq(tls, pParse, p) + if pColl != 0 { + _sqlite3ColumnSetColl(tls, db, pCol, (*TCollSeq)(unsafe.Pointer(pColl)).FzName) + } + goto _1 + _1: + ; + i++ + pCol += 16 + } + (*TTable)(unsafe.Pointer(pTab)).FszTabRow = int16(1) /* Any non-zero value works */ +} + +// C documentation +// +// /* +// ** Given a SELECT statement, generate a Table structure that describes +// ** the result set of that SELECT. +// */ +func _sqlite3ResultSetOfSelect(tls *libc.TLS, pParse uintptr, pSelect uintptr, aff int8) (r uintptr) { + var db, pTab uintptr + var savedFlags Tu64 + _, _, _ = db, pTab, savedFlags + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + savedFlags = (*Tsqlite3)(unsafe.Pointer(db)).Fflags + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_FullColNames) + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(SQLITE_ShortColNames) + _sqlite3SelectPrep(tls, pParse, pSelect, uintptr(0)) + (*Tsqlite3)(unsafe.Pointer(db)).Fflags = savedFlags + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return uintptr(0) + } + for (*TSelect)(unsafe.Pointer(pSelect)).FpPrior != 0 { + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior + } + pTab = _sqlite3DbMallocZero(tls, db, uint64(104)) + if pTab == uintptr(0) { + return uintptr(0) + } + (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) + (*TTable)(unsafe.Pointer(pTab)).FzName = uintptr(0) + (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSelect)).FpEList, pTab+54, pTab+8) + _sqlite3SubqueryColumnTypes(tls, pParse, pTab, pSelect, aff) + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3DeleteTable(tls, db, pTab) + return uintptr(0) + } + return pTab +} + +// C documentation +// +// /* +// ** Get a VDBE for the given parser context. Create a new one if necessary. +// ** If an error occurs, return NULL and leave a message in pParse. +// */ +func _sqlite3GetVdbe(tls *libc.TLS, pParse uintptr) (r uintptr) { + if (*TParse)(unsafe.Pointer(pParse)).FpVdbe != 0 { + return (*TParse)(unsafe.Pointer(pParse)).FpVdbe + } + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_FactorOutConst)) == uint32(0) { + (*TParse)(unsafe.Pointer(pParse)).FokConstFactor = uint8(1) + } + return _sqlite3VdbeCreate(tls, pParse) +} + +// C documentation +// +// /* +// ** Compute the iLimit and iOffset fields of the SELECT based on the +// ** pLimit expressions. pLimit->pLeft and pLimit->pRight hold the expressions +// ** that appear in the original SQL statement after the LIMIT and OFFSET +// ** keywords. Or NULL if those keywords are omitted. iLimit and iOffset +// ** are the integer memory register numbers for counters used to compute +// ** the limit and offset. If there is no limit and/or offset, then +// ** iLimit and iOffset are negative. +// ** +// ** This routine changes the values of iLimit and iOffset only if +// ** a limit or offset is defined by pLimit->pLeft and pLimit->pRight. iLimit +// ** and iOffset should have been preset to appropriate default values (zero) +// ** prior to calling this routine. +// ** +// ** The iOffset register (if it exists) is initialized to the value +// ** of the OFFSET. The iLimit register is initialized to LIMIT. Register +// ** iOffset+1 is initialized to LIMIT+OFFSET. +// ** +// ** Only if pLimit->pLeft!=0 do the limit registers get +// ** redefined. The UNION ALL operator uses this property to force +// ** the reuse of the same limit and offset registers across multiple +// ** SELECT statements. +// */ +func _computeLimitRegisters(tls *libc.TLS, pParse uintptr, p uintptr, iBreak int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iLimit, iOffset, v1, v2, v4, v5 int32 + var pLimit, v, v3, v6 uintptr + var _ /* n at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = iLimit, iOffset, pLimit, v, v1, v2, v3, v4, v5, v6 + v = uintptr(0) + iLimit = 0 + pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit + if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 { + return + } + /* + ** "LIMIT -1" always shows all rows. There is some + ** controversy about what the correct behavior should be. + ** The current implementation interprets "LIMIT 0" to mean + ** no rows. + */ + if pLimit != 0 { + v3 = pParse + 56 + *(*int32)(unsafe.Pointer(v3))++ + v2 = *(*int32)(unsafe.Pointer(v3)) + v1 = v2 + iLimit = v1 + (*TSelect)(unsafe.Pointer(p)).FiLimit = v1 + v = _sqlite3GetVdbe(tls, pParse) + if _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer(pLimit)).FpLeft, bp) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), *(*int32)(unsafe.Pointer(bp)), iLimit) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + _sqlite3VdbeGoto(tls, v, iBreak) + } else { + if *(*int32)(unsafe.Pointer(bp)) >= 0 && int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32(_sqlite3LogEst(tls, uint64(*(*int32)(unsafe.Pointer(bp))))) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3LogEst(tls, uint64(*(*int32)(unsafe.Pointer(bp)))) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_FixedLimit) + } + } + } else { + _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pLimit)).FpLeft, iLimit) + _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), iLimit) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNot), iLimit, iBreak) + } + if (*TExpr)(unsafe.Pointer(pLimit)).FpRight != 0 { + v6 = pParse + 56 + *(*int32)(unsafe.Pointer(v6))++ + v5 = *(*int32)(unsafe.Pointer(v6)) + v4 = v5 + iOffset = v4 + (*TSelect)(unsafe.Pointer(p)).FiOffset = v4 + (*TParse)(unsafe.Pointer(pParse)).FnMem++ /* Allocate an extra register for limit+offset */ + _sqlite3ExprCode(tls, pParse, (*TExpr)(unsafe.Pointer(pLimit)).FpRight, iOffset) + _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), iOffset) + _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), iLimit, iOffset+int32(1), iOffset) + } + } +} + +// C documentation +// +// /* +// ** Return the appropriate collating sequence for the iCol-th column of +// ** the result set for the compound-select statement "p". Return NULL if +// ** the column has no default collating sequence. +// ** +// ** The collating sequence for the compound select is taken from the +// ** left-most term of the select that has a collating sequence. +// */ +func _multiSelectCollSeq(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r uintptr) { + var pRet uintptr + _ = pRet + if (*TSelect)(unsafe.Pointer(p)).FpPrior != 0 { + pRet = _multiSelectCollSeq(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpPrior, iCol) + } else { + pRet = uintptr(0) + } + /* iCol must be less than p->pEList->nExpr. Otherwise an error would + ** have been thrown during name resolution and we would not have gotten + ** this far */ + if pRet == uintptr(0) && iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr { + pRet = _sqlite3ExprCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8 + uintptr(iCol)*32))).FpExpr) + } + return pRet +} + +// C documentation +// +// /* +// ** The select statement passed as the second parameter is a compound SELECT +// ** with an ORDER BY clause. This function allocates and returns a KeyInfo +// ** structure suitable for implementing the ORDER BY. +// ** +// ** Space to hold the KeyInfo structure is obtained from malloc. The calling +// ** function is responsible for ensuring that this structure is eventually +// ** freed. +// */ +func _multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra int32) (r uintptr) { + var db, pColl, pItem, pOrderBy, pRet, pTerm uintptr + var i, nOrderBy, v1 int32 + _, _, _, _, _, _, _, _, _ = db, i, nOrderBy, pColl, pItem, pOrderBy, pRet, pTerm, v1 + pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + if pOrderBy != uintptr(0) { + v1 = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr + } else { + v1 = 0 + } + nOrderBy = v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pRet = _sqlite3KeyInfoAlloc(tls, db, nOrderBy+nExtra, int32(1)) + if pRet != 0 { + i = 0 + for { + if !(i < nOrderBy) { + break + } + pItem = pOrderBy + 8 + uintptr(i)*32 + pTerm = (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr + if (*TExpr)(unsafe.Pointer(pTerm)).Fflags&uint32(EP_Collate) != 0 { + pColl = _sqlite3ExprCollSeq(tls, pParse, pTerm) + } else { + pColl = _multiSelectCollSeq(tls, pParse, p, int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol)-int32(1)) + if pColl == uintptr(0) { + pColl = (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl + } + (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr = _sqlite3ExprAddCollateString(tls, pParse, pTerm, (*TCollSeq)(unsafe.Pointer(pColl)).FzName) + } + *(*uintptr)(unsafe.Pointer(pRet + 32 + uintptr(i)*8)) = pColl + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags + goto _2 + _2: + ; + i++ + } + } + return pRet +} + +// C documentation +// +// /* +// ** This routine generates VDBE code to compute the content of a WITH RECURSIVE +// ** query of the form: +// ** +// ** AS ( UNION [ALL] ) +// ** \___________/ \_______________/ +// ** p->pPrior p +// ** +// ** +// ** There is exactly one reference to the recursive-table in the FROM clause +// ** of recursive-query, marked with the SrcList->a[].fg.isRecursive flag. +// ** +// ** The setup-query runs once to generate an initial set of rows that go +// ** into a Queue table. Rows are extracted from the Queue table one by +// ** one. Each row extracted from Queue is output to pDest. Then the single +// ** extracted row (now in the iCurrent table) becomes the content of the +// ** recursive-table for a recursive-query run. The output of the recursive-query +// ** is added back into the Queue table. Then another row is extracted from Queue +// ** and the iteration continues until the Queue table is empty. +// ** +// ** If the compound query operator is UNION then no duplicate rows are ever +// ** inserted into the Queue table. The iDistinct table keeps a copy of all rows +// ** that have ever been inserted into Queue and causes duplicates to be +// ** discarded. If the operator is UNION ALL, then duplicates are allowed. +// ** +// ** If the query has an ORDER BY, then entries in the Queue table are kept in +// ** ORDER BY order and the first entry is extracted for each cycle. Without +// ** an ORDER BY, the Queue table is just a FIFO. +// ** +// ** If a LIMIT clause is provided, then the iteration stops after LIMIT rows +// ** have been output to pDest. A LIMIT of zero means to output no rows and a +// ** negative LIMIT means to output all rows. If there is also an OFFSET clause +// ** with a positive value, then the first OFFSET outputs are discarded rather +// ** than being sent to pDest. The LIMIT count does not begin until after OFFSET +// ** rows have been skipped. +// */ +func _generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var addrBreak, addrCont, addrTop, eDest, i, iCurrent, iDistinct, iQueue, nCol, rc, regCurrent, regLimit, regOffset, v1, v3, v5, v6, v8, v9 int32 + var pFirstRec, pKeyInfo, pLimit, pOrderBy, pSetup, pSrc, v, v10, v4, v7 uintptr + var _ /* destQueue at bp+0 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrBreak, addrCont, addrTop, eDest, i, iCurrent, iDistinct, iQueue, nCol, pFirstRec, pKeyInfo, pLimit, pOrderBy, pSetup, pSrc, rc, regCurrent, regLimit, regOffset, v, v1, v10, v3, v4, v5, v6, v7, v8, v9 + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc /* The FROM clause of the recursive query */ + nCol = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr /* Number of columns in the recursive table */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* CONTINUE and BREAK addresses */ + iCurrent = 0 /* The Queue table */ + iDistinct = 0 /* To ensure unique results if UNION */ + eDest = int32(SRT_Fifo) /* Registers used by LIMIT and OFFSET */ + if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19269, 0) + return + } + /* Obtain authorization to do a recursive query */ + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_RECURSIVE), uintptr(0), uintptr(0), uintptr(0)) != 0 { + return + } + /* Process the LIMIT and OFFSET clauses, if they exist */ + addrBreak = _sqlite3VdbeMakeLabel(tls, pParse) + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(320) /* 4 billion rows */ + _computeLimitRegisters(tls, pParse, p, addrBreak) + pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit + regLimit = (*TSelect)(unsafe.Pointer(p)).FiLimit + regOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset + (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) + v1 = libc.Int32FromInt32(0) + (*TSelect)(unsafe.Pointer(p)).FiOffset = v1 + (*TSelect)(unsafe.Pointer(p)).FiLimit = v1 + pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + /* Locate the cursor number of the Current table */ + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 60 + 4))&0x40>>6)) != 0 { + iCurrent = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FiCursor + break + } + goto _2 + _2: + ; + i++ + } + /* Allocate cursors numbers for Queue and Distinct. The cursor number for + ** the Distinct table must be exactly one greater than Queue in order + ** for the SRT_DistFifo and SRT_DistQueue destinations to work. */ + v4 = pParse + 52 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + iQueue = v3 + if int32((*TSelect)(unsafe.Pointer(p)).Fop) == int32(TK_UNION) { + if pOrderBy != 0 { + v5 = int32(SRT_DistQueue) + } else { + v5 = int32(SRT_DistFifo) + } + eDest = v5 + v7 = pParse + 52 + v6 = *(*int32)(unsafe.Pointer(v7)) + *(*int32)(unsafe.Pointer(v7))++ + iDistinct = v6 + } else { + if pOrderBy != 0 { + v8 = int32(SRT_Queue) + } else { + v8 = int32(SRT_Fifo) + } + eDest = v8 + } + _sqlite3SelectDestInit(tls, bp, eDest, iQueue) + /* Allocate cursors for Current, Queue, and Distinct. */ + v10 = pParse + 56 + *(*int32)(unsafe.Pointer(v10))++ + v9 = *(*int32)(unsafe.Pointer(v10)) + regCurrent = v9 + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenPseudo), iCurrent, regCurrent, nCol) + if pOrderBy != 0 { + pKeyInfo = _multiSelectOrderByKeyInfo(tls, pParse, p, int32(1)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), iQueue, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr+int32(2), 0, pKeyInfo, -int32(8)) + (*(*TSelectDest)(unsafe.Pointer(bp))).FpOrderBy = pOrderBy + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), iQueue, nCol) + } + if iDistinct != 0 { + *(*int32)(unsafe.Pointer(p + 20)) = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), iDistinct, 0) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_UsesEphemeral) + } + /* Detach the ORDER BY clause from the compound SELECT */ + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + /* Figure out how many elements of the compound SELECT are part of the + ** recursive query. Make sure no recursive elements use aggregate + ** functions. Mark the recursive elements as UNION ALL even if they + ** are really UNION because the distinctness will be enforced by the + ** iDistinct table. pFirstRec is left pointing to the left-most + ** recursive term of the CTE. + */ + pFirstRec = p + for { + if !(pFirstRec != uintptr(0)) { + break + } + if (*TSelect)(unsafe.Pointer(pFirstRec)).FselFlags&uint32(SF_Aggregate) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19318, 0) + goto end_of_recursive_query + } + (*TSelect)(unsafe.Pointer(pFirstRec)).Fop = uint8(TK_ALL) + if (*TSelect)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior)).FselFlags&uint32(SF_Recursive) == uint32(0) { + break + } + goto _11 + _11: + ; + pFirstRec = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior + } + /* Store the results of the setup-query in Queue. */ + pSetup = (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior + (*TSelect)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19360, 0) + rc = _sqlite3Select(tls, pParse, pSetup, bp) + (*TSelect)(unsafe.Pointer(pSetup)).FpNext = p + if rc != 0 { + goto end_of_recursive_query + } + /* Find the next row in the Queue and output that row */ + addrTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), iQueue, addrBreak) + /* Transfer the next row in Queue over to Current */ + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), iCurrent) /* To reset column cache */ + if pOrderBy != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iQueue, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr+int32(1), regCurrent) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_RowData), iQueue, regCurrent) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_Delete), iQueue) + /* Output the single row in Current */ + addrCont = _sqlite3VdbeMakeLabel(tls, pParse) + _codeOffset(tls, v, regOffset, addrCont) + _selectInnerLoop(tls, pParse, p, iCurrent, uintptr(0), uintptr(0), pDest, addrCont, addrBreak) + if regLimit != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_DecrJumpZero), regLimit, addrBreak) + } + _sqlite3VdbeResolveLabel(tls, v, addrCont) + /* Execute the recursive SELECT taking the single row in Current as + ** the value for the recursive-table. Store the results in the Queue. + */ + (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19366, 0) + _sqlite3Select(tls, pParse, p, bp) + (*TSelect)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup + /* Keep running the loop until the Queue is empty */ + _sqlite3VdbeGoto(tls, v, addrTop) + _sqlite3VdbeResolveLabel(tls, v, addrBreak) +end_of_recursive_query: + ; + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy + (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit + return +} + +// C documentation +// +// /* +// ** Handle the special case of a compound-select that originates from a +// ** VALUES clause. By handling this as a special case, we avoid deep +// ** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT +// ** on a VALUES clause. +// ** +// ** Because the Select object originates from a VALUES clause: +// ** (1) There is no LIMIT or OFFSET or else there is a LIMIT of exactly 1 +// ** (2) All terms are UNION ALL +// ** (3) There is no ORDER BY clause +// ** +// ** The "LIMIT of exactly 1" case of condition (1) comes about when a VALUES +// ** clause occurs within scalar expression (ex: "SELECT (VALUES(1),(2),(3))"). +// ** The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. +// ** Since the limit is exactly 1, we only need to evaluate the left-most VALUES. +// */ +func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bShowAll, nRow, rc int32 + var v1 uintptr + _, _, _, _ = bShowAll, nRow, rc, v1 + nRow = int32(1) + rc = 0 + bShowAll = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FpLimit == uintptr(0)) + for cond := true; cond; cond = int32(1) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { + return -int32(1) + } + if (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { + break + } + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + nRow += bShowAll + } + if nRow == int32(1) { + v1 = __ccgo_ts + 1680 + } else { + v1 = __ccgo_ts + 19381 + } + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19383, libc.VaList(bp+8, nRow, v1)) + for p != 0 { + _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) + if !(bShowAll != 0) { + break + } + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(nRow) + p = (*TSelect)(unsafe.Pointer(p)).FpNext + } + return rc +} + +// C documentation +// +// /* +// ** Return true if the SELECT statement which is known to be the recursive +// ** part of a recursive CTE still has its anchor terms attached. If the +// ** anchor terms have already been removed, then return false. +// */ +func _hasAnchor(tls *libc.TLS, p uintptr) (r int32) { + for p != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Recursive) != uint32(0) { + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + } + return libc.BoolInt32(p != uintptr(0)) +} + +// C documentation +// +// /* +// ** This routine is called to process a compound query form from +// ** two or more separate queries using UNION, UNION ALL, EXCEPT, or +// ** INTERSECT +// ** +// ** "p" points to the right-most of the two queries. the query on the +// ** left is p->pPrior. The left query could also be a compound query +// ** in which case this routine will be called recursively. +// ** +// ** The results of the total query are to be written into a destination +// ** of type eDest with parameter iParm. +// ** +// ** Example 1: Consider a three-way compound SQL statement. +// ** +// ** SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3 +// ** +// ** This statement is parsed up as follows: +// ** +// ** SELECT c FROM t3 +// ** | +// ** `-----> SELECT b FROM t2 +// ** | +// ** `------> SELECT a FROM t1 +// ** +// ** The arrows in the diagram above represent the Select.pPrior pointer. +// ** So if this routine is called with p equal to the t3 query, then +// ** pPrior will be the t2 query. p->op will be TK_UNION in this case. +// ** +// ** Notice that because of the way SQLite parses compound SELECTs, the +// ** individual selects always group from left to right. +// */ +func _multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var addr, addr1, addr2, addr3, i, iBreak, iBreak1, iCont, iCont1, iStart, iStart1, nCol, priorOp, r1, rc, tab1, tab2, unionTab, v1, v3, v5 int32 + var apColl, db, pDelete, pKeyInfo, pLimit, pLimit1, pLoop, pPrior, v, v2, v4, v6 uintptr + var op Tu8 + var _ /* dest at bp+0 */ TSelectDest + var _ /* intersectdest at bp+88 */ TSelectDest + var _ /* nLimit at bp+40 */ int32 + var _ /* uniondest at bp+48 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addr1, addr2, addr3, apColl, db, i, iBreak, iBreak1, iCont, iCont1, iStart, iStart1, nCol, op, pDelete, pKeyInfo, pLimit, pLimit1, pLoop, pPrior, priorOp, r1, rc, tab1, tab2, unionTab, v, v1, v2, v3, v4, v5, v6 + rc = SQLITE_OK /* Alternative data destination */ + pDelete = uintptr(0) /* Database connection */ + /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only + ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. + */ + /* Calling function guarantees this much */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pPrior = (*TSelect)(unsafe.Pointer(p)).FpPrior + *(*TSelectDest)(unsafe.Pointer(bp)) = *(*TSelectDest)(unsafe.Pointer(pDest)) + v = _sqlite3GetVdbe(tls, pParse) + /* The VDBE already created by calling function */ + /* Create the destination temporary table if necessary + */ + if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == int32(SRT_EphemTab) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr) + (*(*TSelectDest)(unsafe.Pointer(bp))).FeDest = uint8(SRT_Table) + } + /* Special handling for a compound-select that originates as a VALUES clause. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_MultiValue) != 0 { + rc = _multiSelectValues(tls, pParse, p, bp) + if rc >= 0 { + goto multi_select_end + } + rc = SQLITE_OK + } + /* Make sure all SELECTs in the statement have the same number of elements + ** in their result sets. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Recursive) != uint32(0) && _hasAnchor(tls, p) != 0 { + _generateWithRecursiveQuery(tls, pParse, p, bp) + } else { + /* Compound SELECTs that have an ORDER BY clause are handled separately. + */ + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { + return _multiSelectOrderBy(tls, pParse, p, pDest) + } else { + if (*TSelect)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19406, 0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19421, 0) + } + /* Generate code for the left and right SELECT statements. + */ + switch int32((*TSelect)(unsafe.Pointer(p)).Fop) { + case int32(TK_ALL): + addr = 0 + *(*int32)(unsafe.Pointer(bp + 40)) = 0 /* Initialize to suppress harmless compiler warning */ + (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = (*TSelect)(unsafe.Pointer(p)).FiLimit + (*TSelect)(unsafe.Pointer(pPrior)).FiOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset + (*TSelect)(unsafe.Pointer(pPrior)).FpLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit + rc = _sqlite3Select(tls, pParse, pPrior, bp) + (*TSelect)(unsafe.Pointer(pPrior)).FpLimit = uintptr(0) + if rc != 0 { + goto multi_select_end + } + (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FiLimit = (*TSelect)(unsafe.Pointer(pPrior)).FiLimit + (*TSelect)(unsafe.Pointer(p)).FiOffset = (*TSelect)(unsafe.Pointer(pPrior)).FiOffset + if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 { + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), (*TSelect)(unsafe.Pointer(p)).FiLimit) + if (*TSelect)(unsafe.Pointer(p)).FiOffset != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_OffsetLimit), (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TSelect)(unsafe.Pointer(p)).FiOffset+int32(1), (*TSelect)(unsafe.Pointer(p)).FiOffset) + } + } + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19146, 0) + rc = _sqlite3Select(tls, pParse, p, bp) + pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior + (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3LogEstAdd(tls, (*TSelect)(unsafe.Pointer(p)).FnSelectRow, (*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow) + if (*TSelect)(unsafe.Pointer(p)).FpLimit != 0 && _sqlite3ExprIsInteger(tls, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpLimit)).FpLeft, bp+40) != 0 && *(*int32)(unsafe.Pointer(bp + 40)) > 0 && int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32(_sqlite3LogEst(tls, uint64(*(*int32)(unsafe.Pointer(bp + 40))))) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3LogEst(tls, uint64(*(*int32)(unsafe.Pointer(bp + 40)))) + } + if addr != 0 { + _sqlite3VdbeJumpHere(tls, v, addr) + } + case int32(TK_EXCEPT): + fallthrough + case int32(TK_UNION): /* Cursor number of the temp table holding result */ + op = uint8(0) + priorOp = int32(SRT_Union) + if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) == priorOp { + /* We can reuse a temporary table generated by a SELECT to our + ** right. + */ + /* Not allowed on leftward elements */ + unionTab = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm + } else { + /* We will need to create our own temporary table to hold the + ** intermediate results. + */ + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + unionTab = v1 + addr1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), unionTab, 0) + *(*int32)(unsafe.Pointer(p + 20)) = addr1 + *(*Tu32)(unsafe.Pointer(_findRightmost(tls, p) + 4)) |= uint32(SF_UsesEphemeral) + } + /* Code the SELECT statements to our left + */ + _sqlite3SelectDestInit(tls, bp+48, priorOp, unionTab) + rc = _sqlite3Select(tls, pParse, pPrior, bp+48) + if rc != 0 { + goto multi_select_end + } + /* Code the current SELECT statement + */ + if int32((*TSelect)(unsafe.Pointer(p)).Fop) == int32(TK_EXCEPT) { + op = uint8(SRT_Except) + } else { + op = uint8(SRT_Union) + } + (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) + pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit + (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) + (*(*TSelectDest)(unsafe.Pointer(bp + 48))).FeDest = op + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19440, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + rc = _sqlite3Select(tls, pParse, p, bp+48) + pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior + (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + if int32((*TSelect)(unsafe.Pointer(p)).Fop) == int32(TK_UNION) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3LogEstAdd(tls, (*TSelect)(unsafe.Pointer(p)).FnSelectRow, (*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow) + } + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpLimit) + (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit + (*TSelect)(unsafe.Pointer(p)).FiLimit = 0 + (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 + /* Convert the data in the temporary table into whatever form + ** it is that we currently need. + */ + if int32((*(*TSelectDest)(unsafe.Pointer(bp))).FeDest) != priorOp && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + iBreak = _sqlite3VdbeMakeLabel(tls, pParse) + iCont = _sqlite3VdbeMakeLabel(tls, pParse) + _computeLimitRegisters(tls, pParse, p, iBreak) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), unionTab, iBreak) + iStart = _sqlite3VdbeCurrentAddr(tls, v) + _selectInnerLoop(tls, pParse, p, unionTab, uintptr(0), uintptr(0), bp, iCont, iBreak) + _sqlite3VdbeResolveLabel(tls, v, iCont) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), unionTab, iStart) + _sqlite3VdbeResolveLabel(tls, v, iBreak) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), unionTab, 0) + } + default: + /* INTERSECT is different from the others since it requires + ** two temporary tables. Hence it has its own case. Begin + ** by allocating the tables we will need. + */ + v4 = pParse + 52 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + tab1 = v3 + v6 = pParse + 52 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + tab2 = v5 + addr2 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), tab1, 0) + *(*int32)(unsafe.Pointer(p + 20)) = addr2 + *(*Tu32)(unsafe.Pointer(_findRightmost(tls, p) + 4)) |= uint32(SF_UsesEphemeral) + /* Code the SELECTs to our left into temporary table "tab1". + */ + _sqlite3SelectDestInit(tls, bp+88, int32(SRT_Union), tab1) + rc = _sqlite3Select(tls, pParse, pPrior, bp+88) + if rc != 0 { + goto multi_select_end + } + /* Code the current SELECT into temporary table "tab2" + */ + addr2 = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), tab2, 0) + *(*int32)(unsafe.Pointer(p + 20 + 1*4)) = addr2 + (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) + pLimit1 = (*TSelect)(unsafe.Pointer(p)).FpLimit + (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) + (*(*TSelectDest)(unsafe.Pointer(bp + 88))).FiSDParm = tab2 + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19440, libc.VaList(bp+136, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + rc = _sqlite3Select(tls, pParse, p, bp+88) + pDelete = (*TSelect)(unsafe.Pointer(p)).FpPrior + (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior + if int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32((*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = (*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow + } + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpLimit) + (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit1 + /* Generate code to take the intersection of the two temporary + ** tables. + */ + if rc != 0 { + break + } + iBreak1 = _sqlite3VdbeMakeLabel(tls, pParse) + iCont1 = _sqlite3VdbeMakeLabel(tls, pParse) + _computeLimitRegisters(tls, pParse, p, iBreak1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), tab1, iBreak1) + r1 = _sqlite3GetTempReg(tls, pParse) + iStart1 = _sqlite3VdbeAddOp2(tls, v, int32(OP_RowData), tab1, r1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), tab2, iCont1, r1, 0) + _sqlite3ReleaseTempReg(tls, pParse, r1) + _selectInnerLoop(tls, pParse, p, tab1, uintptr(0), uintptr(0), bp, iCont1, iBreak1) + _sqlite3VdbeResolveLabel(tls, v, iCont1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), tab1, iStart1) + _sqlite3VdbeResolveLabel(tls, v, iBreak1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), tab2, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), tab1, 0) + break + } + if (*TSelect)(unsafe.Pointer(p)).FpNext == uintptr(0) { + _sqlite3VdbeExplainPop(tls, pParse) + } + } + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto multi_select_end + } + /* Compute collating sequences used by + ** temporary tables needed to implement the compound select. + ** Attach the KeyInfo structure to all temporary tables. + ** + ** This section is run by the right-most SELECT statement only. + ** SELECT statements to the left always skip this part. The right-most + ** SELECT might also skip this part if it has no ORDER BY clause and + ** no temp tables are required. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_UsesEphemeral) != 0 { /* Number of columns in result set */ + nCol = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr + pKeyInfo = _sqlite3KeyInfoAlloc(tls, db, nCol, int32(1)) + if !(pKeyInfo != 0) { + rc = int32(SQLITE_NOMEM) + goto multi_select_end + } + i = 0 + apColl = pKeyInfo + 32 + for { + if !(i < nCol) { + break + } + *(*uintptr)(unsafe.Pointer(apColl)) = _multiSelectCollSeq(tls, pParse, p, i) + if uintptr(0) == *(*uintptr)(unsafe.Pointer(apColl)) { + *(*uintptr)(unsafe.Pointer(apColl)) = (*Tsqlite3)(unsafe.Pointer(db)).FpDfltColl + } + goto _7 + _7: + ; + i++ + apColl += 8 + } + pLoop = p + for { + if !(pLoop != 0) { + break + } + i = 0 + for { + if !(i < int32(2)) { + break + } + addr3 = *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) + if addr3 < 0 { + /* If [0] is unused then [1] is also unused. So we can + ** always safely abort as soon as the first unused slot is found */ + break + } + _sqlite3VdbeChangeP2(tls, v, addr3, nCol) + _sqlite3VdbeChangeP4(tls, v, addr3, _sqlite3KeyInfoRef(tls, pKeyInfo), -int32(8)) + *(*int32)(unsafe.Pointer(pLoop + 20 + uintptr(i)*4)) = -int32(1) + goto _9 + _9: + ; + i++ + } + goto _8 + _8: + ; + pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior + } + _sqlite3KeyInfoUnref(tls, pKeyInfo) + } +multi_select_end: + ; + (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst + (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*(*TSelectDest)(unsafe.Pointer(bp))).FnSdst + if pDelete != 0 { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3SelectDeleteGeneric), pDelete) + } + return rc +} + +// C documentation +// +// /* +// ** Error message for when two or more terms of a compound select have different +// ** size result sets. +// */ +func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19461, 0) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19507, libc.VaList(bp+8, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + } +} + +// C documentation +// +// /* +// ** Code an output subroutine for a coroutine implementation of a +// ** SELECT statement. +// ** +// ** The data to be output is contained in pIn->iSdst. There are +// ** pIn->nSdst columns to be output. pDest is where the output should +// ** be sent. +// ** +// ** regReturn is the number of the register holding the subroutine +// ** return address. +// ** +// ** If regPrev>0 then it is the first register in a vector that +// ** records the previous output. mem[regPrev] is a flag that is false +// ** if there has been no previous output. If regPrev>0 then code is +// ** generated to suppress duplicates. pKeyInfo is used for comparing +// ** keys. +// ** +// ** If the LIMIT found in p->iLimit is reached, jump immediately to +// ** iBreak. +// */ +func _generateOutputSubroutine(tls *libc.TLS, pParse uintptr, p uintptr, pIn uintptr, pDest uintptr, regReturn int32, regPrev int32, pKeyInfo uintptr, iBreak int32) (r int32) { + var addr, addr1, addr2, iContinue, r1, r11, r2 int32 + var v uintptr + _, _, _, _, _, _, _, _ = addr, addr1, addr2, iContinue, r1, r11, r2, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + addr = _sqlite3VdbeCurrentAddr(tls, v) + iContinue = _sqlite3VdbeMakeLabel(tls, pParse) + /* Suppress duplicates for UNION, EXCEPT, and INTERSECT + */ + if regPrev != 0 { + addr1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regPrev) + addr2 = _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, regPrev+int32(1), (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst, _sqlite3KeyInfoRef(tls, pKeyInfo), -int32(8)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addr2+int32(2), iContinue, addr2+int32(2)) + _sqlite3VdbeJumpHere(tls, v, addr1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, regPrev+int32(1), (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst-int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), regPrev) + } + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return 0 + } + /* Suppress the first OFFSET entries if there is an OFFSET clause + */ + _codeOffset(tls, v, (*TSelect)(unsafe.Pointer(p)).FiOffset, iContinue) + switch int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) { + /* Store the result as data using a unique key. + */ + case int32(SRT_EphemTab): + r1 = _sqlite3GetTempReg(tls, pParse) + r2 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst, r1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm, r2) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm, r1, r2) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + _sqlite3ReleaseTempReg(tls, pParse, r2) + _sqlite3ReleaseTempReg(tls, pParse, r1) + break + /* If we are creating a set for an "expr IN (SELECT ...)". + */ + fallthrough + case int32(SRT_Set): + r11 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst, r11, (*TSelectDest)(unsafe.Pointer(pDest)).FzAffSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm, r11, (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + _sqlite3ReleaseTempReg(tls, pParse, r11) + break + /* If this is a scalar select that is part of an expression, then + ** store the results in the appropriate memory cell and break out + ** of the scan loop. Note that the select might return multiple columns + ** if it is the RHS of a row-value IN operator. + */ + fallthrough + case int32(SRT_Mem): + _sqlite3ExprCodeMove(tls, pParse, (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + /* The LIMIT clause will jump out of the loop for us */ + break + /* The results are stored in a sequence of registers + ** starting at pDest->iSdst. Then the co-routine yields. + */ + fallthrough + case int32(SRT_Coroutine): + if (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst == 0 { + (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst = _sqlite3GetTempRange(tls, pParse, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + (*TSelectDest)(unsafe.Pointer(pDest)).FnSdst = (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst + } + _sqlite3ExprCodeMove(tls, pParse, (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pDest)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm) + break + /* If none of the above, then the result destination must be + ** SRT_Output. This routine is never called with any other + ** destination other than the ones handled above or SRT_Output. + ** + ** For SRT_Output, results are stored in a sequence of registers. + ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to + ** return the next row of result. + */ + fallthrough + default: + _sqlite3VdbeAddOp2(tls, v, int32(OP_ResultRow), (*TSelectDest)(unsafe.Pointer(pIn)).FiSdst, (*TSelectDest)(unsafe.Pointer(pIn)).FnSdst) + break + } + /* Jump to the end of the loop if the LIMIT is reached. + */ + if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_DecrJumpZero), (*TSelect)(unsafe.Pointer(p)).FiLimit, iBreak) + } + /* Generate the subroutine return + */ + _sqlite3VdbeResolveLabel(tls, v, iContinue) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regReturn) + return addr +} + +// C documentation +// +// /* +// ** Alternative compound select code generator for cases when there +// ** is an ORDER BY clause. +// ** +// ** We assume a query of the following form: +// ** +// ** ORDER BY +// ** +// ** is one of UNION ALL, UNION, EXCEPT, or INTERSECT. The idea +// ** is to code both and with the ORDER BY clause as +// ** co-routines. Then run the co-routines in parallel and merge the results +// ** into the output. In addition to the two coroutines (called selectA and +// ** selectB) there are 7 subroutines: +// ** +// ** outA: Move the output of the selectA coroutine into the output +// ** of the compound query. +// ** +// ** outB: Move the output of the selectB coroutine into the output +// ** of the compound query. (Only generated for UNION and +// ** UNION ALL. EXCEPT and INSERTSECT never output a row that +// ** appears only in B.) +// ** +// ** AltB: Called when there is data from both coroutines and AB. +// ** +// ** EofA: Called when data is exhausted from selectA. +// ** +// ** EofB: Called when data is exhausted from selectB. +// ** +// ** The implementation of the latter five subroutines depend on which +// ** is used: +// ** +// ** +// ** UNION ALL UNION EXCEPT INTERSECT +// ** ------------- ----------------- -------------- ----------------- +// ** AltB: outA, nextA outA, nextA outA, nextA nextA +// ** +// ** AeqB: outA, nextA nextA nextA outA, nextA +// ** +// ** AgtB: outB, nextB outB, nextB nextB nextB +// ** +// ** EofA: outB, nextB outB, nextB halt halt +// ** +// ** EofB: outA, nextA outA, nextA outA, nextA halt +// ** +// ** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA +// ** causes an immediate jump to EofA and an EOF on B following nextB causes +// ** an immediate jump to EofB. Within EofA and EofB, and EOF on entry or +// ** following nextX causes a jump to the end of the select processing. +// ** +// ** Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled +// ** within the output subroutine. The regPrev register set holds the previously +// ** output value. A comparison is made against this value and the output +// ** is skipped if the next results would be the same as the previous. +// ** +// ** The implementation plan is to implement the two coroutines and seven +// ** subroutines first, then put the control logic at the bottom. Like this: +// ** +// ** goto Init +// ** coA: coroutine for left query (A) +// ** coB: coroutine for right query (B) +// ** outA: output one row of A +// ** outB: output one row of B (UNION and UNION ALL only) +// ** EofA: ... +// ** EofB: ... +// ** AltB: ... +// ** AeqB: ... +// ** AgtB: ... +// ** Init: initialize coroutine registers +// ** yield coA +// ** if eof(A) goto EofA +// ** yield coB +// ** if eof(B) goto EofB +// ** Cmpr: Compare A, B +// ** Jump AltB, AeqB, AgtB +// ** End: ... +// ** +// ** We call AltB, AeqB, AgtB, EofA, and EofB "subroutines" but they are not +// ** actually called using Gosub and they do not Return. EofA and EofB loop +// ** until all data is exhausted then jump to the "end" label. AltB, AeqB, +// ** and AgtB jump to either L2 or to one of EofA or EofB. +// */ +func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) { + bp := tls.Alloc(96) + defer tls.Free(96) + var aPermute, db, pItem, pItem1, pKeyDup, pKeyMerge, pNew, pOrderBy, pPrior, pSplit, v, v10, v12, v16, v18, v20, v22, v3 uintptr + var addr1, addrAeqB, addrAgtB, addrAltB, addrEofA, addrEofA_noB, addrEofB, addrOutA, addrOutB, addrSelectA, addrSelectB, i, j, labelCmpr, labelEnd, nExpr, nOrderBy, nSelect, op, regAddrA, regAddrB, regLimitA, regLimitB, regOutA, regOutB, regPrev, savedLimit, savedOffset, v11, v13, v14, v15, v17, v19, v21, v23, v4, v9 int32 + var _ /* destA at bp+0 */ TSelectDest + var _ /* destB at bp+40 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aPermute, addr1, addrAeqB, addrAgtB, addrAltB, addrEofA, addrEofA_noB, addrEofB, addrOutA, addrOutB, addrSelectA, addrSelectB, db, i, j, labelCmpr, labelEnd, nExpr, nOrderBy, nSelect, op, pItem, pItem1, pKeyDup, pKeyMerge, pNew, pOrderBy, pPrior, pSplit, regAddrA, regAddrB, regLimitA, regLimitB, regOutA, regOutB, regPrev, savedLimit, savedOffset, v, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v3, v4, v9 /* Address of the output-A subroutine */ + addrOutB = 0 /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */ + pKeyDup = uintptr(0) /* Mapping from ORDER BY terms to result set columns */ + /* "Managed" code needs this. Ticket #3382. */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + /* Already thrown the error if VDBE alloc failed */ + labelEnd = _sqlite3VdbeMakeLabel(tls, pParse) + labelCmpr = _sqlite3VdbeMakeLabel(tls, pParse) + /* Patch up the ORDER BY clause + */ + op = int32((*TSelect)(unsafe.Pointer(p)).Fop) + pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + nOrderBy = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr + /* For operators other than UNION ALL we have to make sure that + ** the ORDER BY clause covers every term of the result set. Add + ** terms to the ORDER BY clause as necessary. + */ + if op != int32(TK_ALL) { + i = int32(1) + for { + if !(int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 && i <= (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr) { + break + } + j = 0 + pItem = pOrderBy + 8 + for { + if !(j < nOrderBy) { + break + } + if int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem + 24))).FiOrderByCol) == i { + break + } + goto _2 + _2: + ; + j++ + pItem += 32 + } + if j == nOrderBy { + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), uintptr(0)) + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(EP_IntValue) + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pNew)).Fu)) = i + v3 = _sqlite3ExprListAppend(tls, pParse, pOrderBy, pNew) + pOrderBy = v3 + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = v3 + if pOrderBy != 0 { + v4 = nOrderBy + nOrderBy++ + *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(v4)*32 + 24)) = uint16(i) + } + } + goto _1 + _1: + ; + i++ + } + } + /* Compute the comparison permutation and keyinfo that is used with + ** the permutation used to determine if the next + ** row of results comes from selectA or selectB. Also add explicit + ** collations to the ORDER BY clause terms so that when the subqueries + ** to the right and the left are evaluated, they use the correct + ** collation. + */ + aPermute = _sqlite3DbMallocRawNN(tls, db, uint64(4)*uint64(nOrderBy+libc.Int32FromInt32(1))) + if aPermute != 0 { + *(*Tu32)(unsafe.Pointer(aPermute)) = uint32(nOrderBy) + i = int32(1) + pItem1 = pOrderBy + 8 + for { + if !(i <= nOrderBy) { + break + } + *(*Tu32)(unsafe.Pointer(aPermute + uintptr(i)*4)) = uint32(int32((*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem1 + 24))).FiOrderByCol) - int32(1)) + goto _5 + _5: + ; + i++ + pItem1 += 32 + } + pKeyMerge = _multiSelectOrderByKeyInfo(tls, pParse, p, int32(1)) + } else { + pKeyMerge = uintptr(0) + } + /* Allocate a range of temporary registers and the KeyInfo needed + ** for the logic that removes duplicate result rows when the + ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). + */ + if op == int32(TK_ALL) { + regPrev = 0 + } else { + nExpr = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr + regPrev = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nExpr + int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regPrev) + pKeyDup = _sqlite3KeyInfoAlloc(tls, db, nExpr, int32(1)) + if pKeyDup != 0 { + i = 0 + for { + if !(i < nExpr) { + break + } + *(*uintptr)(unsafe.Pointer(pKeyDup + 32 + uintptr(i)*8)) = _multiSelectCollSeq(tls, pParse, p, i) + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = uint8(0) + goto _6 + _6: + ; + i++ + } + } + } + /* Separate the left and the right query from one another + */ + nSelect = int32(1) + if (op == int32(TK_ALL) || op == int32(TK_UNION)) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_BalancedMerge)) == uint32(0) { + pSplit = p + for { + if !((*TSelect)(unsafe.Pointer(pSplit)).FpPrior != uintptr(0) && int32((*TSelect)(unsafe.Pointer(pSplit)).Fop) == op) { + break + } + nSelect++ + goto _7 + _7: + ; + pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior + } + } + if nSelect <= int32(3) { + pSplit = p + } else { + pSplit = p + i = int32(2) + for { + if !(i < nSelect) { + break + } + pSplit = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior + goto _8 + _8: + ; + i += int32(2) + } + } + pPrior = (*TSelect)(unsafe.Pointer(pSplit)).FpPrior + (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) + (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) + _sqlite3ResolveOrderGroupBy(tls, pParse, p, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, __ccgo_ts+7399) + _sqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy, __ccgo_ts+7399) + /* Compute the limit registers */ + _computeLimitRegisters(tls, pParse, p, labelEnd) + if (*TSelect)(unsafe.Pointer(p)).FiLimit != 0 && op == int32(TK_ALL) { + v10 = pParse + 56 + *(*int32)(unsafe.Pointer(v10))++ + v9 = *(*int32)(unsafe.Pointer(v10)) + regLimitA = v9 + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + regLimitB = v11 + if (*TSelect)(unsafe.Pointer(p)).FiOffset != 0 { + v13 = (*TSelect)(unsafe.Pointer(p)).FiOffset + int32(1) + } else { + v13 = (*TSelect)(unsafe.Pointer(p)).FiLimit + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), v13, regLimitA) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), regLimitA, regLimitB) + } else { + v14 = libc.Int32FromInt32(0) + regLimitB = v14 + regLimitA = v14 + } + _sqlite3ExprDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpLimit) + (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) + v16 = pParse + 56 + *(*int32)(unsafe.Pointer(v16))++ + v15 = *(*int32)(unsafe.Pointer(v16)) + regAddrA = v15 + v18 = pParse + 56 + *(*int32)(unsafe.Pointer(v18))++ + v17 = *(*int32)(unsafe.Pointer(v18)) + regAddrB = v17 + v20 = pParse + 56 + *(*int32)(unsafe.Pointer(v20))++ + v19 = *(*int32)(unsafe.Pointer(v20)) + regOutA = v19 + v22 = pParse + 56 + *(*int32)(unsafe.Pointer(v22))++ + v21 = *(*int32)(unsafe.Pointer(v22)) + regOutB = v21 + _sqlite3SelectDestInit(tls, bp, int32(SRT_Coroutine), regAddrA) + _sqlite3SelectDestInit(tls, bp+40, int32(SRT_Coroutine), regAddrB) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19589, libc.VaList(bp+88, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(p)).Fop)))) + /* Generate a coroutine to evaluate the SELECT statement to the + ** left of the compound operator - the "A" select. + */ + addrSelectA = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrA, 0, addrSelectA) + (*TSelect)(unsafe.Pointer(pPrior)).FiLimit = regLimitA + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19600, 0) + _sqlite3Select(tls, pParse, pPrior, bp) + _sqlite3VdbeEndCoroutine(tls, v, regAddrA) + _sqlite3VdbeJumpHere(tls, v, addr1) + /* Generate a coroutine to evaluate the SELECT statement on + ** the right - the "B" select + */ + addrSelectB = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regAddrB, 0, addrSelectB) + savedLimit = (*TSelect)(unsafe.Pointer(p)).FiLimit + savedOffset = (*TSelect)(unsafe.Pointer(p)).FiOffset + (*TSelect)(unsafe.Pointer(p)).FiLimit = regLimitB + (*TSelect)(unsafe.Pointer(p)).FiOffset = 0 + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+19605, 0) + _sqlite3Select(tls, pParse, p, bp+40) + (*TSelect)(unsafe.Pointer(p)).FiLimit = savedLimit + (*TSelect)(unsafe.Pointer(p)).FiOffset = savedOffset + _sqlite3VdbeEndCoroutine(tls, v, regAddrB) + /* Generate a subroutine that outputs the current row of the A + ** select as the next output row of the compound select. + */ + addrOutA = _generateOutputSubroutine(tls, pParse, p, bp, pDest, regOutA, regPrev, pKeyDup, labelEnd) + /* Generate a subroutine that outputs the current row of the B + ** select as the next output row of the compound select. + */ + if op == int32(TK_ALL) || op == int32(TK_UNION) { + addrOutB = _generateOutputSubroutine(tls, pParse, p, bp+40, pDest, regOutB, regPrev, pKeyDup, labelEnd) + } + _sqlite3KeyInfoUnref(tls, pKeyDup) + /* Generate a subroutine to run when the results from select A + ** are exhausted and only data in select B remains. + */ + if op == int32(TK_EXCEPT) || op == int32(TK_INTERSECT) { + v23 = labelEnd + addrEofA = v23 + addrEofA_noB = v23 + } else { + addrEofA = _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regOutB, addrOutB) + addrEofA_noB = _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regAddrB, labelEnd) + _sqlite3VdbeGoto(tls, v, addrEofA) + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3LogEstAdd(tls, (*TSelect)(unsafe.Pointer(p)).FnSelectRow, (*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow) + } + /* Generate a subroutine to run when the results from select B + ** are exhausted and only data in select A remains. + */ + if op == int32(TK_INTERSECT) { + addrEofB = addrEofA + if int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32((*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = (*TSelect)(unsafe.Pointer(pPrior)).FnSelectRow + } + } else { + addrEofB = _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regOutA, addrOutA) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regAddrA, labelEnd) + _sqlite3VdbeGoto(tls, v, addrEofB) + } + /* Generate code to handle the case of AB + */ + addrAgtB = _sqlite3VdbeCurrentAddr(tls, v) + if op == int32(TK_ALL) || op == int32(TK_UNION) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regOutB, addrOutB) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regAddrB, addrEofB) + _sqlite3VdbeGoto(tls, v, labelCmpr) + /* This code runs once to initialize everything. + */ + _sqlite3VdbeJumpHere(tls, v, addr1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regAddrA, addrEofA_noB) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regAddrB, addrEofB) + /* Implement the main merge loop + */ + _sqlite3VdbeResolveLabel(tls, v, labelCmpr) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Permutation), 0, 0, 0, aPermute, -int32(14)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), (*(*TSelectDest)(unsafe.Pointer(bp))).FiSdst, (*(*TSelectDest)(unsafe.Pointer(bp + 40))).FiSdst, nOrderBy, pKeyMerge, -int32(8)) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_PERMUTE)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addrAltB, addrAeqB, addrAgtB) + /* Jump to the this point in order to terminate the query. + */ + _sqlite3VdbeResolveLabel(tls, v, labelEnd) + /* Make arrangements to free the 2nd and subsequent arms of the compound + ** after the parse has finished */ + if (*TSelect)(unsafe.Pointer(pSplit)).FpPrior != 0 { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3SelectDeleteGeneric), (*TSelect)(unsafe.Pointer(pSplit)).FpPrior) + } + (*TSelect)(unsafe.Pointer(pSplit)).FpPrior = pPrior + (*TSelect)(unsafe.Pointer(pPrior)).FpNext = pSplit + _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy) + (*TSelect)(unsafe.Pointer(pPrior)).FpOrderBy = uintptr(0) + /*** TBD: Insert subroutine calls to close cursors on incomplete + **** subqueries ****/ + _sqlite3VdbeExplainPop(tls, pParse) + return libc.BoolInt32((*TParse)(unsafe.Pointer(pParse)).FnErr != 0) +} + +// C documentation +// +// /* An instance of the SubstContext object describes an substitution edit +// ** to be performed on a parse tree. +// ** +// ** All references to columns in table iTable are to be replaced by corresponding +// ** expressions in pEList. +// ** +// ** ## About "isOuterJoin": +// ** +// ** The isOuterJoin column indicates that the replacement will occur into a +// ** position in the parent that NULL-able due to an OUTER JOIN. Either the +// ** target slot in the parent is the right operand of a LEFT JOIN, or one of +// ** the left operands of a RIGHT JOIN. In either case, we need to potentially +// ** bypass the substituted expression with OP_IfNullRow. +// ** +// ** Suppose the original expression is an integer constant. Even though the table +// ** has the nullRow flag set, because the expression is an integer constant, +// ** it will not be NULLed out. So instead, we insert an OP_IfNullRow opcode +// ** that checks to see if the nullRow flag is set on the table. If the nullRow +// ** flag is set, then the value in the register is set to NULL and the original +// ** expression is bypassed. If the nullRow flag is not set, then the original +// ** expression runs to populate the register. +// ** +// ** Example where this is needed: +// ** +// ** CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT); +// ** CREATE TABLE t2(x INT UNIQUE); +// ** +// ** SELECT a,b,m,x FROM t1 LEFT JOIN (SELECT 59 AS m,x FROM t2) ON b=x; +// ** +// ** When the subquery on the right side of the LEFT JOIN is flattened, we +// ** have to add OP_IfNullRow in front of the OP_Integer that implements the +// ** "m" value of the subquery so that a NULL will be loaded instead of 59 +// ** when processing a non-matched row of the left. +// */ +type TSubstContext = struct { + FpParse uintptr + FiTable int32 + FiNewTable int32 + FisOuterJoin int32 + FpEList uintptr + FpCList uintptr +} + +type SubstContext = TSubstContext + +// C documentation +// +// /* +// ** Scan through the expression pExpr. Replace every reference to +// ** a column in table number iTable with a copy of the iColumn-th +// ** entry in pEList. (But leave references to the ROWID column +// ** unchanged.) +// ** +// ** This routine is part of the flattening procedure. A subquery +// ** whose result set is defined by pEList appears as entry in the +// ** FROM clause of a SELECT such that the VDBE cursor assigned to that +// ** FORM clause entry is iTable. This routine makes the necessary +// ** changes to pExpr so that it refers directly to the source table +// ** of the subquery rather the result set of the subquery. +// */ +func _substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) (r uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var db, pColl, pCopy, pNat, pNew, pWin, v1 uintptr + var iColumn int32 + var _ /* ifNullRow at bp+0 */ TExpr + _, _, _, _, _, _, _, _ = db, iColumn, pColl, pCopy, pNat, pNew, pWin, v1 + if pExpr == uintptr(0) { + return uintptr(0) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) && *(*int32)(unsafe.Pointer(pExpr + 52)) == (*TSubstContext)(unsafe.Pointer(pSubst)).FiTable { + *(*int32)(unsafe.Pointer(pExpr + 52)) = (*TSubstContext)(unsafe.Pointer(pSubst)).FiNewTable + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSubstContext)(unsafe.Pointer(pSubst)).FiTable && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { + iColumn = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + pCopy = (*(*TExprList_item)(unsafe.Pointer((*TSubstContext)(unsafe.Pointer(pSubst)).FpEList + 8 + uintptr(iColumn)*32))).FpExpr + if _sqlite3ExprIsVector(tls, pCopy) != 0 { + _sqlite3VectorErrorMsg(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pCopy) + } else { + db = (*TParse)(unsafe.Pointer((*TSubstContext)(unsafe.Pointer(pSubst)).FpParse)).Fdb + if (*TSubstContext)(unsafe.Pointer(pSubst)).FisOuterJoin != 0 && (int32((*TExpr)(unsafe.Pointer(pCopy)).Fop) != int32(TK_COLUMN) || (*TExpr)(unsafe.Pointer(pCopy)).FiTable != (*TSubstContext)(unsafe.Pointer(pSubst)).FiNewTable) { + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TExpr)(unsafe.Pointer(bp))).Fop = uint8(TK_IF_NULL_ROW) + (*(*TExpr)(unsafe.Pointer(bp))).FpLeft = pCopy + (*(*TExpr)(unsafe.Pointer(bp))).FiTable = (*TSubstContext)(unsafe.Pointer(pSubst)).FiNewTable + (*(*TExpr)(unsafe.Pointer(bp))).FiColumn = int16(-int32(99)) + (*(*TExpr)(unsafe.Pointer(bp))).Fflags = uint32(EP_IfNullRow) + pCopy = bp + } + pNew = _sqlite3ExprDup(tls, db, pCopy, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db, pNew) + return pExpr + } + if (*TSubstContext)(unsafe.Pointer(pSubst)).FisOuterJoin != 0 { + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(libc.Int32FromInt32(EP_CanBeNull)) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) { + _sqlite3SetJoinExpr(tls, pNew, *(*int32)(unsafe.Pointer(pExpr + 52)), (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON))) + } + _sqlite3ExprDelete(tls, db, pExpr) + pExpr = pNew + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_TRUEFALSE) { + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pExpr)).Fu)) = _sqlite3ExprTruthValue(tls, pExpr) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_INTEGER) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IntValue)) + } + /* Ensure that the expression now has an implicit collation sequence, + ** just as it did when it was a column of a view or sub-query. */ + pNat = _sqlite3ExprCollSeq(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr) + pColl = _sqlite3ExprCollSeq(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, (*(*TExprList_item)(unsafe.Pointer((*TSubstContext)(unsafe.Pointer(pSubst)).FpCList + 8 + uintptr(iColumn)*32))).FpExpr) + if pNat != pColl || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLLATE) { + if pColl != 0 { + v1 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName + } else { + v1 = __ccgo_ts + 5118 + } + pExpr = _sqlite3ExprAddCollateString(tls, (*TSubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, v1) + } + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Collate)) + } + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IF_NULL_ROW) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSubstContext)(unsafe.Pointer(pSubst)).FiTable { + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TSubstContext)(unsafe.Pointer(pSubst)).FiNewTable + } + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = _substExpr(tls, pSubst, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + (*TExpr)(unsafe.Pointer(pExpr)).FpRight = _substExpr(tls, pSubst, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + _substSelect(tls, pSubst, *(*uintptr)(unsafe.Pointer(pExpr + 32)), int32(1)) + } else { + _substExprList(tls, pSubst, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + pWin = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + (*TWindow)(unsafe.Pointer(pWin)).FpFilter = _substExpr(tls, pSubst, (*TWindow)(unsafe.Pointer(pWin)).FpFilter) + _substExprList(tls, pSubst, (*TWindow)(unsafe.Pointer(pWin)).FpPartition) + _substExprList(tls, pSubst, (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy) + } + } + return pExpr +} + +func _substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { + var i int32 + _ = i + if pList == uintptr(0) { + return + } + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr = _substExpr(tls, pSubst, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) + goto _1 + _1: + ; + i++ + } +} + +func _substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { + var i int32 + var pItem, pSrc, v1 uintptr + var v2 bool + _, _, _, _, _ = i, pItem, pSrc, v1, v2 + if !(p != 0) { + return + } + for { + _substExprList(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpEList) + _substExprList(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpGroupBy) + _substExprList(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + (*TSelect)(unsafe.Pointer(p)).FpHaving = _substExpr(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpHaving) + (*TSelect)(unsafe.Pointer(p)).FpWhere = _substExpr(tls, pSubst, (*TSelect)(unsafe.Pointer(p)).FpWhere) + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + i = (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc + pItem = pSrc + 8 + for { + if !(i > 0) { + break + } + _substSelect(tls, pSubst, (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect, int32(1)) + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x4>>2)) != 0 { + _substExprList(tls, pSubst, *(*uintptr)(unsafe.Pointer(pItem + 88))) + } + goto _4 + _4: + ; + i-- + pItem += 104 + } + goto _3 + _3: + ; + if v2 = doPrior != 0; v2 { + v1 = (*TSelect)(unsafe.Pointer(p)).FpPrior + p = v1 + } + if !(v2 && v1 != uintptr(0)) { + break + } + } +} + +// C documentation +// +// /* +// ** pSelect is a SELECT statement and pSrcItem is one item in the FROM +// ** clause of that SELECT. +// ** +// ** This routine scans the entire SELECT statement and recomputes the +// ** pSrcItem->colUsed mask. +// */ +func _recomputeColumnsUsedExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pItem uintptr + _ = pItem + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { + return WRC_Continue + } + pItem = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + if (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor != (*TExpr)(unsafe.Pointer(pExpr)).FiTable { + return WRC_Continue + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) < 0 { + return WRC_Continue + } + *(*TBitmask)(unsafe.Pointer(pItem + 80)) |= _sqlite3ExprColUsed(tls, pExpr) + return WRC_Continue +} + +func _recomputeColumnsUsed(tls *libc.TLS, pSelect uintptr, pSrcItem uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + if (*TSrcItem)(unsafe.Pointer(pSrcItem)).FpTab == uintptr(0) { + return + } + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_recomputeColumnsUsedExpr) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) + *(*uintptr)(unsafe.Pointer(bp + 40)) = pSrcItem + (*TSrcItem)(unsafe.Pointer(pSrcItem)).FcolUsed = uint64(0) + _sqlite3WalkSelect(tls, bp, pSelect) +} + +// C documentation +// +// /* +// ** Assign new cursor numbers to each of the items in pSrc. For each +// ** new cursor number assigned, set an entry in the aCsrMap[] array +// ** to map the old cursor number to the new: +// ** +// ** aCsrMap[iOld+1] = iNew; +// ** +// ** The array is guaranteed by the caller to be large enough for all +// ** existing cursor numbers in pSrc. aCsrMap[0] is the array size. +// ** +// ** If pSrc contains any sub-selects, call this routine recursively +// ** on the FROM clause of each such sub-select, with iExcept set to -1. +// */ +func _srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSrc uintptr, iExcept int32) { + var i, v2 int32 + var p, pItem, v3 uintptr + _, _, _, _, _ = i, p, pItem, v2, v3 + i = 0 + pItem = pSrc + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + if i != iExcept { + if !(int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x40>>6)) != 0) || *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*TSrcItem)(unsafe.Pointer(pItem)).FiCursor+int32(1))*4)) == 0 { + v3 = pParse + 52 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*TSrcItem)(unsafe.Pointer(pItem)).FiCursor+int32(1))*4)) = v2 + } + (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor = *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*TSrcItem)(unsafe.Pointer(pItem)).FiCursor+int32(1))*4)) + p = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect + for { + if !(p != 0) { + break + } + _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, -int32(1)) + goto _4 + _4: + ; + p = (*TSelect)(unsafe.Pointer(p)).FpPrior + } + } + goto _1 + _1: + ; + i++ + pItem += 104 + } +} + +// C documentation +// +// /* +// ** *piCursor is a cursor number. Change it if it needs to be mapped. +// */ +func _renumberCursorDoMapping(tls *libc.TLS, pWalker uintptr, piCursor uintptr) { + var aCsrMap uintptr + var iCsr int32 + _, _ = aCsrMap, iCsr + aCsrMap = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + iCsr = *(*int32)(unsafe.Pointer(piCursor)) + if iCsr < *(*int32)(unsafe.Pointer(aCsrMap)) && *(*int32)(unsafe.Pointer(aCsrMap + uintptr(iCsr+int32(1))*4)) > 0 { + *(*int32)(unsafe.Pointer(piCursor)) = *(*int32)(unsafe.Pointer(aCsrMap + uintptr(iCsr+int32(1))*4)) + } +} + +// C documentation +// +// /* +// ** Expression walker callback used by renumberCursors() to update +// ** Expr objects to match newly assigned cursor numbers. +// */ +func _renumberCursorsCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var op int32 + _ = op + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + if op == int32(TK_COLUMN) || op == int32(TK_IF_NULL_ROW) { + _renumberCursorDoMapping(tls, pWalker, pExpr+44) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + _renumberCursorDoMapping(tls, pWalker, pExpr+52) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Assign a new cursor number to each cursor in the FROM clause (Select.pSrc) +// ** of the SELECT statement passed as the second argument, and to each +// ** cursor in the FROM clause of any FROM clause sub-selects, recursively. +// ** Except, do not assign a new cursor number to the iExcept'th element in +// ** the FROM clause of (*p). Update all expressions and other references +// ** to refer to the new cursor numbers. +// ** +// ** Argument aCsrMap is an array that may be used for temporary working +// ** space. Two guarantees are made by the caller: +// ** +// ** * the array is larger than the largest cursor number used within the +// ** select statement passed as an argument, and +// ** +// ** * the array entries for all cursor numbers that do *not* appear in +// ** FROM clauses of the select statement as described above are +// ** initialized to zero. +// */ +func _renumberCursors(tls *libc.TLS, pParse uintptr, p uintptr, iExcept int32, aCsrMap uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + _srclistRenumberCursors(tls, pParse, aCsrMap, (*TSelect)(unsafe.Pointer(p)).FpSrc, iExcept) + libc.Xmemset(tls, bp, 0, uint64(48)) + *(*uintptr)(unsafe.Pointer(bp + 40)) = aCsrMap + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_renumberCursorsCb) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) + _sqlite3WalkSelect(tls, bp, p) +} + +// C documentation +// +// /* +// ** If pSel is not part of a compound SELECT, return a pointer to its +// ** expression list. Otherwise, return a pointer to the expression list +// ** of the leftmost SELECT in the compound. +// */ +func _findLeftmostExprlist(tls *libc.TLS, pSel uintptr) (r uintptr) { + for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { + pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior + } + return (*TSelect)(unsafe.Pointer(pSel)).FpEList +} + +// C documentation +// +// /* +// ** Return true if any of the result-set columns in the compound query +// ** have incompatible affinities on one or more arms of the compound. +// */ +func _compoundHasDifferentAffinities(tls *libc.TLS, p uintptr) (r int32) { + var aff int8 + var ii int32 + var pList, pSub1 uintptr + _, _, _, _ = aff, ii, pList, pSub1 + pList = (*TSelect)(unsafe.Pointer(p)).FpEList + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + aff = _sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) + pSub1 = (*TSelect)(unsafe.Pointer(p)).FpPrior + for { + if !(pSub1 != 0) { + break + } + if int32(_sqlite3ExprAffinity(tls, (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub1)).FpEList + 8 + uintptr(ii)*32))).FpExpr)) != int32(aff) { + return int32(1) + } + goto _2 + _2: + ; + pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior + } + goto _1 + _1: + ; + ii++ + } + return 0 +} + +// C documentation +// +// /* +// ** This routine attempts to flatten subqueries as a performance optimization. +// ** This routine returns 1 if it makes changes and 0 if no flattening occurs. +// ** +// ** To understand the concept of flattening, consider the following +// ** query: +// ** +// ** SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5 +// ** +// ** The default way of implementing this query is to execute the +// ** subquery first and store the results in a temporary table, then +// ** run the outer query on that temporary table. This requires two +// ** passes over the data. Furthermore, because the temporary table +// ** has no indices, the WHERE clause on the outer query cannot be +// ** optimized. +// ** +// ** This routine attempts to rewrite queries such as the above into +// ** a single flat select, like this: +// ** +// ** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5 +// ** +// ** The code generated for this simplification gives the same result +// ** but only has to scan the data once. And because indices might +// ** exist on the table t1, a complete scan of the data might be +// ** avoided. +// ** +// ** Flattening is subject to the following constraints: +// ** +// ** (**) We no longer attempt to flatten aggregate subqueries. Was: +// ** The subquery and the outer query cannot both be aggregates. +// ** +// ** (**) We no longer attempt to flatten aggregate subqueries. Was: +// ** (2) If the subquery is an aggregate then +// ** (2a) the outer query must not be a join and +// ** (2b) the outer query must not use subqueries +// ** other than the one FROM-clause subquery that is a candidate +// ** for flattening. (This is due to ticket [2f7170d73bf9abf80] +// ** from 2015-02-09.) +// ** +// ** (3) If the subquery is the right operand of a LEFT JOIN then +// ** (3a) the subquery may not be a join and +// ** (3b) the FROM clause of the subquery may not contain a virtual +// ** table and +// ** (**) Was: "The outer query may not have a GROUP BY." This case +// ** is now managed correctly +// ** (3d) the outer query may not be DISTINCT. +// ** See also (26) for restrictions on RIGHT JOIN. +// ** +// ** (4) The subquery can not be DISTINCT. +// ** +// ** (**) At one point restrictions (4) and (5) defined a subset of DISTINCT +// ** sub-queries that were excluded from this optimization. Restriction +// ** (4) has since been expanded to exclude all DISTINCT subqueries. +// ** +// ** (**) We no longer attempt to flatten aggregate subqueries. Was: +// ** If the subquery is aggregate, the outer query may not be DISTINCT. +// ** +// ** (7) The subquery must have a FROM clause. TODO: For subqueries without +// ** A FROM clause, consider adding a FROM clause with the special +// ** table sqlite_once that consists of a single row containing a +// ** single NULL. +// ** +// ** (8) If the subquery uses LIMIT then the outer query may not be a join. +// ** +// ** (9) If the subquery uses LIMIT then the outer query may not be aggregate. +// ** +// ** (**) Restriction (10) was removed from the code on 2005-02-05 but we +// ** accidentally carried the comment forward until 2014-09-15. Original +// ** constraint: "If the subquery is aggregate then the outer query +// ** may not use LIMIT." +// ** +// ** (11) The subquery and the outer query may not both have ORDER BY clauses. +// ** +// ** (**) Not implemented. Subsumed into restriction (3). Was previously +// ** a separate restriction deriving from ticket #350. +// ** +// ** (13) The subquery and outer query may not both use LIMIT. +// ** +// ** (14) The subquery may not use OFFSET. +// ** +// ** (15) If the outer query is part of a compound select, then the +// ** subquery may not use LIMIT. +// ** (See ticket #2339 and ticket [02a8e81d44]). +// ** +// ** (16) If the outer query is aggregate, then the subquery may not +// ** use ORDER BY. (Ticket #2942) This used to not matter +// ** until we introduced the group_concat() function. +// ** +// ** (17) If the subquery is a compound select, then +// ** (17a) all compound operators must be a UNION ALL, and +// ** (17b) no terms within the subquery compound may be aggregate +// ** or DISTINCT, and +// ** (17c) every term within the subquery compound must have a FROM clause +// ** (17d) the outer query may not be +// ** (17d1) aggregate, or +// ** (17d2) DISTINCT +// ** (17e) the subquery may not contain window functions, and +// ** (17f) the subquery must not be the RHS of a LEFT JOIN. +// ** (17g) either the subquery is the first element of the outer +// ** query or there are no RIGHT or FULL JOINs in any arm +// ** of the subquery. (This is a duplicate of condition (27b).) +// ** (17h) The corresponding result set expressions in all arms of the +// ** compound must have the same affinity. +// ** +// ** The parent and sub-query may contain WHERE clauses. Subject to +// ** rules (11), (13) and (14), they may also contain ORDER BY, +// ** LIMIT and OFFSET clauses. The subquery cannot use any compound +// ** operator other than UNION ALL because all the other compound +// ** operators have an implied DISTINCT which is disallowed by +// ** restriction (4). +// ** +// ** Also, each component of the sub-query must return the same number +// ** of result columns. This is actually a requirement for any compound +// ** SELECT statement, but all the code here does is make sure that no +// ** such (illegal) sub-query is flattened. The caller will detect the +// ** syntax error and return a detailed message. +// ** +// ** (18) If the sub-query is a compound select, then all terms of the +// ** ORDER BY clause of the parent must be copies of a term returned +// ** by the parent query. +// ** +// ** (19) If the subquery uses LIMIT then the outer query may not +// ** have a WHERE clause. +// ** +// ** (20) If the sub-query is a compound select, then it must not use +// ** an ORDER BY clause. Ticket #3773. We could relax this constraint +// ** somewhat by saying that the terms of the ORDER BY clause must +// ** appear as unmodified result columns in the outer query. But we +// ** have other optimizations in mind to deal with that case. +// ** +// ** (21) If the subquery uses LIMIT then the outer query may not be +// ** DISTINCT. (See ticket [752e1646fc]). +// ** +// ** (22) The subquery may not be a recursive CTE. +// ** +// ** (23) If the outer query is a recursive CTE, then the sub-query may not be +// ** a compound query. This restriction is because transforming the +// ** parent to a compound query confuses the code that handles +// ** recursive queries in multiSelect(). +// ** +// ** (**) We no longer attempt to flatten aggregate subqueries. Was: +// ** The subquery may not be an aggregate that uses the built-in min() or +// ** or max() functions. (Without this restriction, a query like: +// ** "SELECT x FROM (SELECT max(y), x FROM t1)" would not necessarily +// ** return the value X for which Y was maximal.) +// ** +// ** (25) If either the subquery or the parent query contains a window +// ** function in the select list or ORDER BY clause, flattening +// ** is not attempted. +// ** +// ** (26) The subquery may not be the right operand of a RIGHT JOIN. +// ** See also (3) for restrictions on LEFT JOIN. +// ** +// ** (27) The subquery may not contain a FULL or RIGHT JOIN unless it +// ** is the first element of the parent query. Two subcases: +// ** (27a) the subquery is not a compound query. +// ** (27b) the subquery is a compound query and the RIGHT JOIN occurs +// ** in any arm of the compound query. (See also (17g).) +// ** +// ** (28) The subquery is not a MATERIALIZED CTE. (This is handled +// ** in the caller before ever reaching this routine.) +// ** +// ** +// ** In this routine, the "p" parameter is a pointer to the outer query. +// ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query +// ** uses aggregates. +// ** +// ** If flattening is not attempted, this routine is a no-op and returns 0. +// ** If flattening is attempted this routine returns 1. +// ** +// ** All of the expression analysis must occur on both the outer query and +// ** the subquery before this routine runs. +// */ +func _flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isAgg int32) (r int32) { + bp := tls.Alloc(96) + defer tls.Free(96) + var aCsrMap, db, pItem, pItemTab, pLimit, pNew, pOrderBy, pOrderBy1, pParent, pPrior, pSrc, pSub, pSub1, pSubSrc, pSubitem, pTabToDel, pToplevel, pWhere, zSavedAuthContext, v5, v6, p10, p11, p9 uintptr + var i, iNewParent, iParent, ii, isOuterJoin, nSubSrc, v4 int32 + var jointype, ltorj Tu8 + var _ /* w at bp+0 */ TWalker + var _ /* x at bp+48 */ TSubstContext + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aCsrMap, db, i, iNewParent, iParent, ii, isOuterJoin, jointype, ltorj, nSubSrc, pItem, pItemTab, pLimit, pNew, pOrderBy, pOrderBy1, pParent, pPrior, pSrc, pSub, pSub1, pSubSrc, pSubitem, pTabToDel, pToplevel, pWhere, zSavedAuthContext, v4, v5, v6, p10, p11, p9 + zSavedAuthContext = (*TParse)(unsafe.Pointer(pParse)).FzAuthContext /* VDBE cursor number of the pSub result set temp table */ + iNewParent = -int32(1) /* Replacement table for iParent */ + isOuterJoin = 0 /* The subquery */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Walker to persist agginfo data */ + aCsrMap = uintptr(0) + /* Check to see if flattening is permitted. Return 0 if not. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_QueryFlattener)) != uint32(0) { + return 0 + } + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + pSubitem = pSrc + 8 + uintptr(iFrom)*104 + iParent = (*TSrcItem)(unsafe.Pointer(pSubitem)).FiCursor + pSub = (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect + if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 || (*TSelect)(unsafe.Pointer(pSub)).FpWin != 0 { + return 0 + } /* Restriction (25) */ + pSubSrc = (*TSelect)(unsafe.Pointer(pSub)).FpSrc + /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, + ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET + ** because they could be computed at compile-time. But when LIMIT and OFFSET + ** became arbitrary expressions, we were forced to add restrictions (13) + ** and (14). */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 && (*TSelect)(unsafe.Pointer(p)).FpLimit != 0 { + return 0 + } /* Restriction (13) */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 && (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpLimit)).FpRight != 0 { + return 0 + } /* Restriction (14) */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Compound) != uint32(0) && (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 { + return 0 /* Restriction (15) */ + } + if (*TSrcList)(unsafe.Pointer(pSubSrc)).FnSrc == 0 { + return 0 + } /* Restriction (7) */ + if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_Distinct) != 0 { + return 0 + } /* Restriction (4) */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 && ((*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > int32(1) || isAgg != 0) { + return 0 /* Restrictions (8)(9) */ + } + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 && (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != 0 { + return 0 /* Restriction (11) */ + } + if isAgg != 0 && (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != 0 { + return 0 + } /* Restriction (16) */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 && (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 { + return 0 + } /* Restriction (19) */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) != uint32(0) { + return 0 /* Restriction (21) */ + } + if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(libc.Int32FromInt32(SF_Recursive)) != 0 { + return 0 /* Restrictions (22) */ + } + /* + ** If the subquery is the right operand of a LEFT JOIN, then the + ** subquery may not be a join itself (3a). Example of why this is not + ** allowed: + ** + ** t1 LEFT OUTER JOIN (t2 JOIN t3) + ** + ** If we flatten the above, we would get + ** + ** (t1 LEFT OUTER JOIN t2) JOIN t3 + ** + ** which is not at all the same thing. + ** + ** See also tickets #306, #350, and #3300. + */ + if int32((*TSrcItem)(unsafe.Pointer(pSubitem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_LTORJ)) != 0 { + if (*TSrcList)(unsafe.Pointer(pSubSrc)).FnSrc > int32(1) || int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pSubSrc + 8))).FpTab)).FeTabType) == int32(TABTYP_VTAB) || (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) != uint32(0) || int32((*TSrcItem)(unsafe.Pointer(pSubitem)).Ffg.Fjointype)&int32(JT_RIGHT) != 0 { + return 0 + } + isOuterJoin = int32(1) + } + /* True by restriction (7) */ + if iFrom > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSubSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + return 0 /* Restriction (27a) */ + } + /* Condition (28) is blocked by the caller */ + /* Restriction (17): If the sub-query is a compound SELECT, then it must + ** use only the UNION ALL operator. And none of the simple select queries + ** that make up the compound SELECT are allowed to be aggregate or distinct + ** queries. + */ + if (*TSelect)(unsafe.Pointer(pSub)).FpPrior != 0 { + if (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != 0 { + return 0 /* Restriction (20) */ + } + if isAgg != 0 || (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) != uint32(0) || isOuterJoin > 0 { + return 0 /* (17d1), (17d2), or (17f) */ + } + pSub1 = pSub + for { + if !(pSub1 != 0) { + break + } + if (*TSelect)(unsafe.Pointer(pSub1)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) != uint32(0) || (*TSelect)(unsafe.Pointer(pSub1)).FpPrior != 0 && int32((*TSelect)(unsafe.Pointer(pSub1)).Fop) != int32(TK_ALL) || (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub1)).FpSrc)).FnSrc < int32(1) || (*TSelect)(unsafe.Pointer(pSub1)).FpWin != 0 { + return 0 + } + if iFrom > 0 && int32((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub1)).FpSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + /* Without this restriction, the JT_LTORJ flag would end up being + ** omitted on left-hand tables of the right join that is being + ** flattened. */ + return 0 /* Restrictions (17g), (27b) */ + } + goto _1 + _1: + ; + pSub1 = (*TSelect)(unsafe.Pointer(pSub1)).FpPrior + } + /* Restriction (18). */ + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpOrderBy)).FnExpr) { + break + } + if int32(*(*Tu16)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpOrderBy + 8 + uintptr(ii)*32 + 24))) == 0 { + return 0 + } + goto _2 + _2: + ; + ii++ + } + } + /* Restriction (23) */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Recursive) != 0 { + return 0 + } + /* Restriction (17h) */ + if _compoundHasDifferentAffinities(tls, pSub) != 0 { + return 0 + } + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > int32(1) { + if (*TParse)(unsafe.Pointer(pParse)).FnSelect > int32(500) { + return 0 + } + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_FlttnUnionAll)) != uint32(0) { + return 0 + } + aCsrMap = _sqlite3DbMallocZero(tls, db, uint64(int64((*TParse)(unsafe.Pointer(pParse)).FnTab)+libc.Int64FromInt32(1))*uint64(4)) + if aCsrMap != 0 { + *(*int32)(unsafe.Pointer(aCsrMap)) = (*TParse)(unsafe.Pointer(pParse)).FnTab + } + } + } + /***** If we reach this point, flattening is permitted. *****/ + /* Authorize the subquery */ + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = (*TSrcItem)(unsafe.Pointer(pSubitem)).FzName + _sqlite3AuthCheck(tls, pParse, int32(SQLITE_SELECT), uintptr(0), uintptr(0), uintptr(0)) + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext + /* Delete the transient structures associated with the subquery */ + pSub1 = (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect + _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pSubitem)).FzDatabase) + _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pSubitem)).FzName) + _sqlite3DbFree(tls, db, (*TSrcItem)(unsafe.Pointer(pSubitem)).FzAlias) + (*TSrcItem)(unsafe.Pointer(pSubitem)).FzDatabase = uintptr(0) + (*TSrcItem)(unsafe.Pointer(pSubitem)).FzName = uintptr(0) + (*TSrcItem)(unsafe.Pointer(pSubitem)).FzAlias = uintptr(0) + (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect = uintptr(0) + /* If the sub-query is a compound SELECT statement, then (by restrictions + ** 17 and 18 above) it must be a UNION ALL and the parent query must + ** be of the form: + ** + ** SELECT FROM () + ** + ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block + ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or + ** OFFSET clauses and joins them to the left-hand-side of the original + ** using UNION ALL operators. In this case N is the number of simple + ** select statements in the compound sub-query. + ** + ** Example: + ** + ** SELECT a+1 FROM ( + ** SELECT x FROM tab + ** UNION ALL + ** SELECT y FROM tab + ** UNION ALL + ** SELECT abs(z*2) FROM tab2 + ** ) WHERE a!=5 ORDER BY 1 + ** + ** Transformed into: + ** + ** SELECT x+1 FROM tab WHERE x+1!=5 + ** UNION ALL + ** SELECT y+1 FROM tab WHERE y+1!=5 + ** UNION ALL + ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5 + ** ORDER BY 1 + ** + ** We call this the "compound-subquery flattening". + */ + pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior + for { + if !(pSub != 0) { + break + } + pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + pLimit = (*TSelect)(unsafe.Pointer(p)).FpLimit + pPrior = (*TSelect)(unsafe.Pointer(p)).FpPrior + pItemTab = (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab + (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpLimit = uintptr(0) + pNew = _sqlite3SelectDup(tls, db, p, 0) + (*TSelect)(unsafe.Pointer(p)).FpLimit = pLimit + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = pOrderBy + (*TSelect)(unsafe.Pointer(p)).Fop = uint8(TK_ALL) + (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab = pItemTab + if pNew == uintptr(0) { + (*TSelect)(unsafe.Pointer(p)).FpPrior = pPrior + } else { + v5 = pParse + 148 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + (*TSelect)(unsafe.Pointer(pNew)).FselId = uint32(v4) + if aCsrMap != 0 && int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + _renumberCursors(tls, pParse, pNew, iFrom, aCsrMap) + } + (*TSelect)(unsafe.Pointer(pNew)).FpPrior = pPrior + if pPrior != 0 { + (*TSelect)(unsafe.Pointer(pPrior)).FpNext = pNew + } + (*TSelect)(unsafe.Pointer(pNew)).FpNext = p + (*TSelect)(unsafe.Pointer(p)).FpPrior = pNew + } + goto _3 + _3: + ; + pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior + } + _sqlite3DbFree(tls, db, aCsrMap) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TSrcItem)(unsafe.Pointer(pSubitem)).FpSelect = pSub1 + return int32(1) + } + /* Defer deleting the Table object associated with the + ** subquery until code generation is + ** complete, since there may still exist Expr.pTab entries that + ** refer to the subquery even after flattening. Ticket #3346. + ** + ** pSubitem->pTab is always non-NULL by test restrictions and tests above. + */ + if (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab != uintptr(0) { + pTabToDel = (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab + if (*TTable)(unsafe.Pointer(pTabToDel)).FnTabRef == uint32(1) { + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v6 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v6 = pParse + } + pToplevel = v6 + _sqlite3ParserAddCleanup(tls, pToplevel, __ccgo_fp(_sqlite3DeleteTableGeneric), pTabToDel) + } else { + (*TTable)(unsafe.Pointer(pTabToDel)).FnTabRef-- + } + (*TSrcItem)(unsafe.Pointer(pSubitem)).FpTab = uintptr(0) + } + /* The following loop runs once for each term in a compound-subquery + ** flattening (as described above). If we are doing a different kind + ** of flattening - a flattening other than a compound-subquery flattening - + ** then this loop only runs once. + ** + ** This loop moves all of the FROM elements of the subquery into the + ** the FROM clause of the outer query. Before doing this, remember + ** the cursor number for the original outer query FROM element in + ** iParent. The iParent cursor will never be used. Subsequent code + ** will scan expressions looking for iParent references and replace + ** those references with expressions that resolve to the subquery FROM + ** elements we are now copying in. + */ + pSub = pSub1 + pParent = p + for { + if !(pParent != 0) { + break + } + jointype = uint8(0) + ltorj = uint8(int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(iFrom)*104))).Ffg.Fjointype) & int32(JT_LTORJ)) + pSubSrc = (*TSelect)(unsafe.Pointer(pSub)).FpSrc /* FROM clause of subquery */ + nSubSrc = (*TSrcList)(unsafe.Pointer(pSubSrc)).FnSrc /* Number of terms in subquery FROM clause */ + pSrc = (*TSelect)(unsafe.Pointer(pParent)).FpSrc /* FROM clause of the outer query */ + if pParent == p { + jointype = (*TSrcItem)(unsafe.Pointer(pSubitem)).Ffg.Fjointype /* First time through the loop */ + } + /* The subquery uses a single slot of the FROM clause of the outer + ** query. If the subquery has more than one element in its FROM clause, + ** then expand the outer query to make space for it to hold all elements + ** of the subquery. + ** + ** Example: + ** + ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB; + ** + ** The outer query has 3 slots in its FROM clause. One slot of the + ** outer query (the middle slot) is used by the subquery. The next + ** block of code will expand the outer query FROM clause to 4 slots. + ** The middle slot is expanded to two slots in order to make space + ** for the two elements in the FROM clause of the subquery. + */ + if nSubSrc > int32(1) { + pSrc = _sqlite3SrcListEnlarge(tls, pParse, pSrc, nSubSrc-int32(1), iFrom+int32(1)) + if pSrc == uintptr(0) { + break + } + (*TSelect)(unsafe.Pointer(pParent)).FpSrc = pSrc + } + /* Transfer the FROM clause terms from the subquery into the + ** outer query. + */ + i = 0 + for { + if !(i < nSubSrc) { + break + } + pItem = pSrc + 8 + uintptr(i+iFrom)*104 + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x400>>10)) != 0 { + _sqlite3IdListDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 72))) + } + *(*TSrcItem)(unsafe.Pointer(pItem)) = *(*TSrcItem)(unsafe.Pointer(pSubSrc + 8 + uintptr(i)*104)) + p9 = pItem + 60 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) | int32(ltorj)) + iNewParent = (*(*TSrcItem)(unsafe.Pointer(pSubSrc + 8 + uintptr(i)*104))).FiCursor + libc.Xmemset(tls, pSubSrc+8+uintptr(i)*104, 0, uint64(104)) + goto _8 + _8: + ; + i++ + } + p10 = pSrc + 8 + uintptr(iFrom)*104 + 60 + *(*Tu8)(unsafe.Pointer(p10)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p10))) & libc.Int32FromInt32(JT_LTORJ)) + p11 = pSrc + 8 + uintptr(iFrom)*104 + 60 + *(*Tu8)(unsafe.Pointer(p11)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p11))) | (int32(jointype) | int32(ltorj))) + /* Now begin substituting subquery result set expressions for + ** references to the iParent in the outer query. + ** + ** Example: + ** + ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; + ** \ \_____________ subquery __________/ / + ** \_____________________ outer query ______________________________/ + ** + ** We look at every expression in the outer query and every place we see + ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10". + */ + if (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != 0 && (*TSelect)(unsafe.Pointer(pParent)).FselFlags&uint32(SF_NoopOrderBy) == uint32(0) { + /* At this point, any non-zero iOrderByCol values indicate that the + ** ORDER BY column expression is identical to the iOrderByCol'th + ** expression returned by SELECT statement pSub. Since these values + ** do not necessarily correspond to columns in SELECT statement pParent, + ** zero them before transferring the ORDER BY clause. + ** + ** Not doing this may cause an error if a subsequent call to this + ** function attempts to flatten a compound sub-query into pParent + ** (the only way this can happen is if the compound sub-query is + ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */ + pOrderBy1 = (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy1)).FnExpr) { + break + } + *(*Tu16)(unsafe.Pointer(pOrderBy1 + 8 + uintptr(i)*32 + 24)) = uint16(0) + goto _12 + _12: + ; + i++ + } + (*TSelect)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy1 + (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy = uintptr(0) + } + pWhere = (*TSelect)(unsafe.Pointer(pSub)).FpWhere + (*TSelect)(unsafe.Pointer(pSub)).FpWhere = uintptr(0) + if isOuterJoin > 0 { + _sqlite3SetJoinExpr(tls, pWhere, iNewParent, uint32(EP_OuterON)) + } + if pWhere != 0 { + if (*TSelect)(unsafe.Pointer(pParent)).FpWhere != 0 { + (*TSelect)(unsafe.Pointer(pParent)).FpWhere = _sqlite3PExpr(tls, pParse, int32(TK_AND), pWhere, (*TSelect)(unsafe.Pointer(pParent)).FpWhere) + } else { + (*TSelect)(unsafe.Pointer(pParent)).FpWhere = pWhere + } + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FpParse = pParse + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FiTable = iParent + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FiNewTable = iNewParent + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FisOuterJoin = isOuterJoin + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FpEList = (*TSelect)(unsafe.Pointer(pSub)).FpEList + (*(*TSubstContext)(unsafe.Pointer(bp + 48))).FpCList = _findLeftmostExprlist(tls, pSub) + _substSelect(tls, bp+48, pParent, 0) + } + /* The flattened query is a compound if either the inner or the + ** outer query is a compound. */ + *(*Tu32)(unsafe.Pointer(pParent + 4)) |= (*TSelect)(unsafe.Pointer(pSub)).FselFlags & uint32(SF_Compound) + /* restriction (17b) */ + /* + ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; + ** + ** One is tempted to try to add a and b to combine the limits. But this + ** does not work if either limit is negative. + */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 { + (*TSelect)(unsafe.Pointer(pParent)).FpLimit = (*TSelect)(unsafe.Pointer(pSub)).FpLimit + (*TSelect)(unsafe.Pointer(pSub)).FpLimit = uintptr(0) + } + /* Recompute the SrcItem.colUsed masks for the flattened + ** tables. */ + i = 0 + for { + if !(i < nSubSrc) { + break + } + _recomputeColumnsUsed(tls, pParent, pSrc+8+uintptr(i+iFrom)*104) + goto _13 + _13: + ; + i++ + } + goto _7 + _7: + ; + pParent = (*TSelect)(unsafe.Pointer(pParent)).FpPrior + pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior + } + /* Finally, delete what is left of the subquery and return success. + */ + _sqlite3AggInfoPersistWalkerInit(tls, bp, pParse) + _sqlite3WalkSelect(tls, bp, pSub1) + _sqlite3SelectDelete(tls, db, pSub1) + return int32(1) +} + +// C documentation +// +// /* +// ** A structure to keep track of all of the column values that are fixed to +// ** a known value due to WHERE clause constraints of the form COLUMN=VALUE. +// */ +type TWhereConst = struct { + FpParse uintptr + FpOomFault uintptr + FnConst int32 + FnChng int32 + FbHasAffBlob int32 + FmExcludeOn Tu32 + FapExpr uintptr +} + +type WhereConst = TWhereConst + +type TWhereConst1 = struct { + FpParse uintptr + FpOomFault uintptr + FnConst int32 + FnChng int32 + FbHasAffBlob int32 + FmExcludeOn Tu32 + FapExpr uintptr +} + +type WhereConst1 = TWhereConst1 + +// C documentation +// +// /* +// ** Add a new entry to the pConst object. Except, do not add duplicate +// ** pColumn entries. Also, do not add if doing so would not be appropriate. +// ** +// ** The caller guarantees the pColumn is a column and pValue is a constant. +// ** This routine has to do some additional checks before completing the +// ** insert. +// */ +func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr, pExpr uintptr) { + var i int32 + var pE2 uintptr + _, _ = i, pE2 + if (*TExpr)(unsafe.Pointer(pColumn)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != uint32(0) { + return + } + if int32(_sqlite3ExprAffinity(tls, pValue)) != 0 { + return + } + if !(_sqlite3IsBinary(tls, _sqlite3ExprCompareCollSeq(tls, (*TWhereConst)(unsafe.Pointer(pConst)).FpParse, pExpr)) != 0) { + return + } + /* 2018-10-25 ticket [cf5ed20f] + ** Make sure the same pColumn is not inserted more than once */ + i = 0 + for { + if !(i < (*TWhereConst)(unsafe.Pointer(pConst)).FnConst) { + break + } + pE2 = *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(i*int32(2))*8)) + if (*TExpr)(unsafe.Pointer(pE2)).FiTable == (*TExpr)(unsafe.Pointer(pColumn)).FiTable && int32((*TExpr)(unsafe.Pointer(pE2)).FiColumn) == int32((*TExpr)(unsafe.Pointer(pColumn)).FiColumn) { + return /* Already present. Return without doing anything. */ + } + goto _1 + _1: + ; + i++ + } + if int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { + (*TWhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob = int32(1) + } + (*TWhereConst)(unsafe.Pointer(pConst)).FnConst++ + (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr = _sqlite3DbReallocOrFree(tls, (*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr, uint64((*TWhereConst)(unsafe.Pointer(pConst)).FnConst*int32(2))*uint64(8)) + if (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr == uintptr(0) { + (*TWhereConst)(unsafe.Pointer(pConst)).FnConst = 0 + } else { + *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((*TWhereConst)(unsafe.Pointer(pConst)).FnConst*int32(2)-int32(2))*8)) = pColumn + *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((*TWhereConst)(unsafe.Pointer(pConst)).FnConst*int32(2)-int32(1))*8)) = pValue + } +} + +// C documentation +// +// /* +// ** Find all terms of COLUMN=VALUE or VALUE=COLUMN in pExpr where VALUE +// ** is a constant expression and where the term must be true because it +// ** is part of the AND-connected terms of the expression. For each term +// ** found, add it to the pConst structure. +// */ +func _findConstInWhere(tls *libc.TLS, pConst uintptr, pExpr uintptr) { + var pLeft, pRight uintptr + _, _ = pLeft, pRight + if pExpr == uintptr(0) { + return + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&(*TWhereConst)(unsafe.Pointer(pConst)).FmExcludeOn != uint32(0) { + return + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AND) { + _findConstInWhere(tls, pConst, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + _findConstInWhere(tls, pConst, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + return + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_EQ) { + return + } + pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + if int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && _sqlite3ExprIsConstant(tls, pLeft) != 0 { + _constInsert(tls, pConst, pRight, pLeft, pExpr) + } + if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) == int32(TK_COLUMN) && _sqlite3ExprIsConstant(tls, pRight) != 0 { + _constInsert(tls, pConst, pLeft, pRight, pExpr) + } +} + +// C documentation +// +// /* +// ** This is a helper function for Walker callback propagateConstantExprRewrite(). +// ** +// ** Argument pExpr is a candidate expression to be replaced by a value. If +// ** pExpr is equivalent to one of the columns named in pWalker->u.pConst, +// ** then overwrite it with the corresponding value. Except, do not do so +// ** if argument bIgnoreAffBlob is non-zero and the affinity of pExpr +// ** is SQLITE_AFF_BLOB. +// */ +func _propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintptr, bIgnoreAffBlob int32) (r int32) { + var i int32 + var pColumn uintptr + _, _ = i, pColumn + if *(*Tu8)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpOomFault)) != 0 { + return int32(WRC_Prune) + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { + return WRC_Continue + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&(uint32(EP_FixedCol)|(*TWhereConst)(unsafe.Pointer(pConst)).FmExcludeOn) != uint32(0) { + return WRC_Continue + } + i = 0 + for { + if !(i < (*TWhereConst)(unsafe.Pointer(pConst)).FnConst) { + break + } + pColumn = *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(i*int32(2))*8)) + if pColumn == pExpr { + goto _1 + } + if (*TExpr)(unsafe.Pointer(pColumn)).FiTable != (*TExpr)(unsafe.Pointer(pExpr)).FiTable { + goto _1 + } + if int32((*TExpr)(unsafe.Pointer(pColumn)).FiColumn) != int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) { + goto _1 + } + if bIgnoreAffBlob != 0 && int32(_sqlite3ExprAffinity(tls, pColumn)) == int32(SQLITE_AFF_BLOB) { + break + } + /* A match is found. Add the EP_FixedCol property */ + (*TWhereConst)(unsafe.Pointer(pConst)).FnChng++ + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Leaf)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_FixedCol)) + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, *(*uintptr)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(i*int32(2)+int32(1))*8)), 0) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb)).FmallocFailed != 0 { + return int32(WRC_Prune) + } + break + goto _1 + _1: + ; + i++ + } + return int32(WRC_Prune) +} + +// C documentation +// +// /* +// ** This is a Walker expression callback. pExpr is a node from the WHERE +// ** clause of a SELECT statement. This function examines pExpr to see if +// ** any substitutions based on the contents of pWalker->u.pConst should +// ** be made to pExpr or its immediate children. +// ** +// ** A substitution is made if: +// ** +// ** + pExpr is a column with an affinity other than BLOB that matches +// ** one of the columns in pWalker->u.pConst, or +// ** +// ** + pExpr is a binary comparison operator (=, <=, >=, <, >) that +// ** uses an affinity other than TEXT and one of its immediate +// ** children is a column that matches one of the columns in +// ** pWalker->u.pConst. +// */ +func _propagateConstantExprRewrite(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pConst uintptr + _ = pConst + pConst = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + if (*TWhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob != 0 { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) >= int32(TK_EQ) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) <= int32(TK_GE) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) { + _propagateConstantExprRewriteOne(tls, pConst, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, 0) + if *(*Tu8)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpOomFault)) != 0 { + return int32(WRC_Prune) + } + if int32(_sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft)) != int32(SQLITE_AFF_TEXT) { + _propagateConstantExprRewriteOne(tls, pConst, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, 0) + } + } + } + return _propagateConstantExprRewriteOne(tls, pConst, pExpr, (*TWhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob) +} + +// C documentation +// +// /* +// ** The WHERE-clause constant propagation optimization. +// ** +// ** If the WHERE clause contains terms of the form COLUMN=CONSTANT or +// ** CONSTANT=COLUMN that are top-level AND-connected terms that are not +// ** part of a ON clause from a LEFT JOIN, then throughout the query +// ** replace all other occurrences of COLUMN with CONSTANT. +// ** +// ** For example, the query: +// ** +// ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b +// ** +// ** Is transformed into +// ** +// ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39 +// ** +// ** Return true if any transformations where made and false if not. +// ** +// ** Implementation note: Constant propagation is tricky due to affinity +// ** and collating sequence interactions. Consider this example: +// ** +// ** CREATE TABLE t1(a INT,b TEXT); +// ** INSERT INTO t1 VALUES(123,'0123'); +// ** SELECT * FROM t1 WHERE a=123 AND b=a; +// ** SELECT * FROM t1 WHERE a=123 AND b=123; +// ** +// ** The two SELECT statements above should return different answers. b=a +// ** is always true because the comparison uses numeric affinity, but b=123 +// ** is false because it uses text affinity and '0123' is not the same as '123'. +// ** To work around this, the expression tree is not actually changed from +// ** "b=a" to "b=123" but rather the "a" in "b=a" is tagged with EP_FixedCol +// ** and the "123" value is hung off of the pLeft pointer. Code generator +// ** routines know to generate the constant "123" instead of looking up the +// ** column value. Also, to avoid collation problems, this optimization is +// ** only attempted if the "a=123" term uses the default BINARY collation. +// ** +// ** 2021-05-25 forum post 6a06202608: Another troublesome case is... +// ** +// ** CREATE TABLE t1(x); +// ** INSERT INTO t1 VALUES(10.0); +// ** SELECT 1 FROM t1 WHERE x=10 AND x LIKE 10; +// ** +// ** The query should return no rows, because the t1.x value is '10.0' not '10' +// ** and '10.0' is not LIKE '10'. But if we are not careful, the first WHERE +// ** term "x=10" will cause the second WHERE term to become "10 LIKE 10", +// ** resulting in a false positive. To avoid this, constant propagation for +// ** columns with BLOB affinity is only allowed if the constant is used with +// ** operators ==, <=, <, >=, >, or IS in a way that will cause the correct +// ** type conversions to occur. See logic associated with the bHasAffBlob flag +// ** for details. +// */ +func _propagateConstants(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { + bp := tls.Alloc(96) + defer tls.Free(96) + var nChng int32 + var _ /* w at bp+40 */ TWalker + var _ /* x at bp+0 */ TWhereConst + _ = nChng + nChng = 0 + (*(*TWhereConst)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWhereConst)(unsafe.Pointer(bp))).FpOomFault = (*TParse)(unsafe.Pointer(pParse)).Fdb + 103 + for cond := true; cond; cond = (*(*TWhereConst)(unsafe.Pointer(bp))).FnChng != 0 { + (*(*TWhereConst)(unsafe.Pointer(bp))).FnConst = 0 + (*(*TWhereConst)(unsafe.Pointer(bp))).FnChng = 0 + (*(*TWhereConst)(unsafe.Pointer(bp))).FapExpr = uintptr(0) + (*(*TWhereConst)(unsafe.Pointer(bp))).FbHasAffBlob = 0 + if (*TSelect)(unsafe.Pointer(p)).FpSrc != uintptr(0) && (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + /* Do not propagate constants on any ON clause if there is a + ** RIGHT JOIN anywhere in the query */ + (*(*TWhereConst)(unsafe.Pointer(bp))).FmExcludeOn = uint32(libc.Int32FromInt32(EP_InnerON) | libc.Int32FromInt32(EP_OuterON)) + } else { + /* Do not propagate constants through the ON clause of a LEFT JOIN */ + (*(*TWhereConst)(unsafe.Pointer(bp))).FmExcludeOn = uint32(EP_OuterON) + } + _findConstInWhere(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpWhere) + if (*(*TWhereConst)(unsafe.Pointer(bp))).FnConst != 0 { + libc.Xmemset(tls, bp+40, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 40))).FpParse = pParse + (*(*TWalker)(unsafe.Pointer(bp + 40))).FxExprCallback = __ccgo_fp(_propagateConstantExprRewrite) + (*(*TWalker)(unsafe.Pointer(bp + 40))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) + (*(*TWalker)(unsafe.Pointer(bp + 40))).FxSelectCallback2 = uintptr(0) + (*(*TWalker)(unsafe.Pointer(bp + 40))).FwalkerDepth = 0 + *(*uintptr)(unsafe.Pointer(bp + 40 + 40)) = bp + _sqlite3WalkExpr(tls, bp+40, (*TSelect)(unsafe.Pointer(p)).FpWhere) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer((*(*TWhereConst)(unsafe.Pointer(bp))).FpParse)).Fdb, (*(*TWhereConst)(unsafe.Pointer(bp))).FapExpr) + nChng += (*(*TWhereConst)(unsafe.Pointer(bp))).FnChng + } + } + return nChng +} + +// C documentation +// +// /* +// ** This function is called to determine whether or not it is safe to +// ** push WHERE clause expression pExpr down to FROM clause sub-query +// ** pSubq, which contains at least one window function. Return 1 +// ** if it is safe and the expression should be pushed down, or 0 +// ** otherwise. +// ** +// ** It is only safe to push the expression down if it consists only +// ** of constants and copies of expressions that appear in the PARTITION +// ** BY clause of all window function used by the sub-query. It is safe +// ** to filter out entire partitions, but not rows within partitions, as +// ** this may change the results of the window functions. +// ** +// ** At the time this function is called it is guaranteed that +// ** +// ** * the sub-query uses only one distinct window frame, and +// ** * that the window frame has a PARTITION BY clause. +// */ +func _pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr uintptr) (r int32) { + return _sqlite3ExprIsConstantOrGroupBy(tls, pParse, pExpr, (*TWindow)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSubq)).FpWin)).FpPartition) +} + +// C documentation +// +// /* +// ** Make copies of relevant WHERE clause terms of the outer query into +// ** the WHERE clause of subquery. Example: +// ** +// ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10; +// ** +// ** Transformed into: +// ** +// ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10) +// ** WHERE x=5 AND y=10; +// ** +// ** The hope is that the terms added to the inner query will make it more +// ** efficient. +// ** +// ** Do not attempt this optimization if: +// ** +// ** (1) (** This restriction was removed on 2017-09-29. We used to +// ** disallow this optimization for aggregate subqueries, but now +// ** it is allowed by putting the extra terms on the HAVING clause. +// ** The added HAVING clause is pointless if the subquery lacks +// ** a GROUP BY clause. But such a HAVING clause is also harmless +// ** so there does not appear to be any reason to add extra logic +// ** to suppress it. **) +// ** +// ** (2) The inner query is the recursive part of a common table expression. +// ** +// ** (3) The inner query has a LIMIT clause (since the changes to the WHERE +// ** clause would change the meaning of the LIMIT). +// ** +// ** (4) The inner query is the right operand of a LEFT JOIN and the +// ** expression to be pushed down does not come from the ON clause +// ** on that LEFT JOIN. +// ** +// ** (5) The WHERE clause expression originates in the ON or USING clause +// ** of a LEFT JOIN where iCursor is not the right-hand table of that +// ** left join. An example: +// ** +// ** SELECT * +// ** FROM (SELECT 1 AS a1 UNION ALL SELECT 2) AS aa +// ** JOIN (SELECT 1 AS b2 UNION ALL SELECT 2) AS bb ON (a1=b2) +// ** LEFT JOIN (SELECT 8 AS c3 UNION ALL SELECT 9) AS cc ON (b2=2); +// ** +// ** The correct answer is three rows: (1,1,NULL),(2,2,8),(2,2,9). +// ** But if the (b2=2) term were to be pushed down into the bb subquery, +// ** then the (1,1,NULL) row would be suppressed. +// ** +// ** (6) Window functions make things tricky as changes to the WHERE clause +// ** of the inner query could change the window over which window +// ** functions are calculated. Therefore, do not attempt the optimization +// ** if: +// ** +// ** (6a) The inner query uses multiple incompatible window partitions. +// ** +// ** (6b) The inner query is a compound and uses window-functions. +// ** +// ** (6c) The WHERE clause does not consist entirely of constants and +// ** copies of expressions found in the PARTITION BY clause of +// ** all window-functions used by the sub-query. It is safe to +// ** filter out entire partitions, as this does not change the +// ** window over which any window-function is calculated. +// ** +// ** (7) The inner query is a Common Table Expression (CTE) that should +// ** be materialized. (This restriction is implemented in the calling +// ** routine.) +// ** +// ** (8) If the subquery is a compound that uses UNION, INTERSECT, +// ** or EXCEPT, then all of the result set columns for all arms of +// ** the compound must use the BINARY collating sequence. +// ** +// ** (9) All three of the following are true: +// ** +// ** (9a) The WHERE clause expression originates in the ON or USING clause +// ** of a join (either an INNER or an OUTER join), and +// ** +// ** (9b) The subquery is to the right of the ON/USING clause +// ** +// ** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING +// ** clause and the subquery. +// ** +// ** Without this restriction, the push-down optimization might move +// ** the ON/USING filter expression from the left side of a RIGHT JOIN +// ** over to the right side, which leads to incorrect answers. See +// ** also restriction (6) in sqlite3ExprIsSingleTableConstraint(). +// ** +// ** (10) The inner query is not the right-hand table of a RIGHT JOIN. +// ** +// ** (11) The subquery is not a VALUES clause +// ** +// ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +// ** case only comes up if SQLite is compiled using +// ** SQLITE_ALLOW_ROWID_IN_VIEW. +// ** +// ** Return 0 if no changes are made and non-zero if one or more WHERE clause +// ** terms are duplicated into the subquery. +// */ +func _pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere uintptr, pSrcList uintptr, iSrc int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var ii, nChng, notUnionAll int32 + var op Tu8 + var pColl, pList, pNew, pSel, pSrc uintptr + var _ /* x at bp+0 */ TSubstContext + _, _, _, _, _, _, _, _, _ = ii, nChng, notUnionAll, op, pColl, pList, pNew, pSel, pSrc /* The subquery FROM term into which WHERE is pushed */ + nChng = 0 + pSrc = pSrcList + 8 + uintptr(iSrc)*104 + if pWhere == uintptr(0) { + return 0 + } + if (*TSelect)(unsafe.Pointer(pSubq)).FselFlags&uint32(libc.Int32FromInt32(SF_Recursive)|libc.Int32FromInt32(SF_MultiPart)) != 0 { + return 0 /* restrictions (2) and (11) */ + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 { + return 0 /* restrictions (10) */ + } + if (*TSelect)(unsafe.Pointer(pSubq)).FpPrior != 0 { + notUnionAll = 0 + pSel = pSubq + for { + if !(pSel != 0) { + break + } + op = (*TSelect)(unsafe.Pointer(pSel)).Fop + if int32(op) != int32(TK_ALL) && int32(op) != int32(TK_SELECT) { + notUnionAll = int32(1) + } + if (*TSelect)(unsafe.Pointer(pSel)).FpWin != 0 { + return 0 + } /* restriction (6b) */ + goto _1 + _1: + ; + pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior + } + if notUnionAll != 0 { + /* If any of the compound arms are connected using UNION, INTERSECT, + ** or EXCEPT, then we must ensure that none of the columns use a + ** non-BINARY collating sequence. */ + pSel = pSubq + for { + if !(pSel != 0) { + break + } + pList = (*TSelect)(unsafe.Pointer(pSel)).FpEList + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + pColl = _sqlite3ExprCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(ii)*32))).FpExpr) + if !(_sqlite3IsBinary(tls, pColl) != 0) { + return 0 /* Restriction (8) */ + } + goto _3 + _3: + ; + ii++ + } + goto _2 + _2: + ; + pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior + } + } + } else { + if (*TSelect)(unsafe.Pointer(pSubq)).FpWin != 0 && (*TWindow)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSubq)).FpWin)).FpPartition == uintptr(0) { + return 0 + } + } + if (*TSelect)(unsafe.Pointer(pSubq)).FpLimit != uintptr(0) { + return 0 /* restriction (3) */ + } + for int32((*TExpr)(unsafe.Pointer(pWhere)).Fop) == int32(TK_AND) { + nChng += _pushDownWhereTerms(tls, pParse, pSubq, (*TExpr)(unsafe.Pointer(pWhere)).FpRight, pSrcList, iSrc) + pWhere = (*TExpr)(unsafe.Pointer(pWhere)).FpLeft + } + if _sqlite3ExprIsSingleTableConstraint(tls, pWhere, pSrcList, iSrc) != 0 { + nChng++ + *(*Tu32)(unsafe.Pointer(pSubq + 4)) |= uint32(SF_PushDown) + for pSubq != 0 { + pNew = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWhere, 0) + _unsetJoinExpr(tls, pNew, -int32(1), int32(1)) + (*(*TSubstContext)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TSubstContext)(unsafe.Pointer(bp))).FiTable = (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor + (*(*TSubstContext)(unsafe.Pointer(bp))).FiNewTable = (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor + (*(*TSubstContext)(unsafe.Pointer(bp))).FisOuterJoin = 0 + (*(*TSubstContext)(unsafe.Pointer(bp))).FpEList = (*TSelect)(unsafe.Pointer(pSubq)).FpEList + (*(*TSubstContext)(unsafe.Pointer(bp))).FpCList = _findLeftmostExprlist(tls, pSubq) + pNew = _substExpr(tls, bp, pNew) + if (*TSelect)(unsafe.Pointer(pSubq)).FpWin != 0 && 0 == _pushDownWindowCheck(tls, pParse, pSubq, pNew) { + /* Restriction 6c has prevented push-down in this case */ + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pNew) + nChng-- + break + } + if (*TSelect)(unsafe.Pointer(pSubq)).FselFlags&uint32(SF_Aggregate) != 0 { + (*TSelect)(unsafe.Pointer(pSubq)).FpHaving = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(pSubq)).FpHaving, pNew) + } else { + (*TSelect)(unsafe.Pointer(pSubq)).FpWhere = _sqlite3ExprAnd(tls, pParse, (*TSelect)(unsafe.Pointer(pSubq)).FpWhere, pNew) + } + pSubq = (*TSelect)(unsafe.Pointer(pSubq)).FpPrior + } + } + return nChng +} + +// C documentation +// +// /* +// ** Check to see if a subquery contains result-set columns that are +// ** never used. If it does, change the value of those result-set columns +// ** to NULL so that they do not cause unnecessary work to compute. +// ** +// ** Return the number of column that were changed to NULL. +// */ +func _disableUnusedSubqueryResultColumns(tls *libc.TLS, pItem uintptr) (r int32) { + var colUsed, m TBitmask + var iCol Tu16 + var j, nChng, nCol, v3 int32 + var pList, pSub, pTab, pX, pY uintptr + var v5 uint64 + _, _, _, _, _, _, _, _, _, _, _, _, _ = colUsed, iCol, j, m, nChng, nCol, pList, pSub, pTab, pX, pY, v3, v5 /* Column number */ + nChng = 0 /* Columns that may not be NULLed out */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x8>>3)) != 0 || int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x100>>8)) != 0 { + return 0 + } + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + pSub = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect + pX = pSub + for { + if !(pX != 0) { + break + } + if (*TSelect)(unsafe.Pointer(pX)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) != uint32(0) { + return 0 + } + if (*TSelect)(unsafe.Pointer(pX)).FpPrior != 0 && int32((*TSelect)(unsafe.Pointer(pX)).Fop) != int32(TK_ALL) { + /* This optimization does not work for compound subqueries that + ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */ + return 0 + } + if (*TSelect)(unsafe.Pointer(pX)).FpWin != 0 { + /* This optimization does not work for subqueries that use window + ** functions. */ + return 0 + } + goto _1 + _1: + ; + pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior + } + colUsed = (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed + if (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != 0 { + pList = (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy + j = 0 + for { + if !(j < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + iCol = *(*Tu16)(unsafe.Pointer(pList + 8 + uintptr(j)*32 + 24)) + if int32(iCol) > 0 { + iCol-- + if int32(iCol) >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v3 = int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1) + } else { + v3 = int32(iCol) + } + colUsed |= libc.Uint64FromInt32(1) << v3 + } + goto _2 + _2: + ; + j++ + } + } + nCol = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + j = 0 + for { + if !(j < nCol) { + break + } + if j < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + v5 = libc.Uint64FromInt32(1) << j + } else { + v5 = libc.Uint64FromInt32(1) << (int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1)) + } + m = v5 + if m&colUsed != uint64(0) { + goto _4 + } + pX = pSub + for { + if !(pX != 0) { + break + } + pY = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pX)).FpEList + 8 + uintptr(j)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pY)).Fop) == int32(TK_NULL) { + goto _6 + } + (*TExpr)(unsafe.Pointer(pY)).Fop = uint8(TK_NULL) + *(*Tu32)(unsafe.Pointer(pY + 4)) &= uint32(^(libc.Int32FromInt32(EP_Skip) | libc.Int32FromInt32(EP_Unlikely))) + *(*Tu32)(unsafe.Pointer(pX + 4)) |= uint32(SF_PushDown) + nChng++ + goto _6 + _6: + ; + pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior + } + goto _4 + _4: + ; + j++ + } + return nChng +} + +// C documentation +// +// /* +// ** The pFunc is the only aggregate function in the query. Check to see +// ** if the query is a candidate for the min/max optimization. +// ** +// ** If the query is a candidate for the min/max optimization, then set +// ** *ppMinMax to be an ORDER BY clause to be used for the optimization +// ** and return either WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX depending on +// ** whether pFunc is a min() or max() function. +// ** +// ** If the query is not a candidate for the min/max optimization, return +// ** WHERE_ORDERBY_NORMAL (which must be zero). +// ** +// ** This routine must be called after aggregate functions have been +// ** located but before their arguments have been subjected to aggregate +// ** analysis. +// */ +func _minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) (r Tu8) { + var eRet int32 + var pEList, pOrderBy, zFunc, v1 uintptr + var sortFlags Tu8 + _, _, _, _, _, _ = eRet, pEList, pOrderBy, sortFlags, zFunc, v1 + eRet = WHERE_ORDERBY_NORMAL + sortFlags = uint8(0) + pEList = *(*uintptr)(unsafe.Pointer(pFunc + 32)) + if pEList == uintptr(0) || (*TExprList)(unsafe.Pointer(pEList)).FnExpr != int32(1) || (*TExpr)(unsafe.Pointer(pFunc)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) || (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_MinMaxOpt)) != uint32(0) { + return uint8(eRet) + } + zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8)) + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15582) == 0 { + eRet = int32(WHERE_ORDERBY_MIN) + if _sqlite3ExprCanBeNull(tls, (*(*TExprList_item)(unsafe.Pointer(pEList + 8))).FpExpr) != 0 { + sortFlags = uint8(KEYINFO_ORDER_BIGNULL) + } + } else { + if _sqlite3StrICmp(tls, zFunc, __ccgo_ts+15586) == 0 { + eRet = int32(WHERE_ORDERBY_MAX) + sortFlags = uint8(KEYINFO_ORDER_DESC) + } else { + return uint8(eRet) + } + } + v1 = _sqlite3ExprListDup(tls, db, pEList, 0) + pOrderBy = v1 + *(*uintptr)(unsafe.Pointer(ppMinMax)) = v1 + if pOrderBy != 0 { + (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).Ffg.FsortFlags = sortFlags + } + return uint8(eRet) +} + +// C documentation +// +// /* +// ** The select statement passed as the first argument is an aggregate query. +// ** The second argument is the associated aggregate-info object. This +// ** function tests if the SELECT is of the form: +// ** +// ** SELECT count(*) FROM +// ** +// ** where table is a database table, not a sub-select or view. If the query +// ** does match this pattern, then a pointer to the Table object representing +// ** is returned. Otherwise, NULL is returned. +// ** +// ** This routine checks to see if it is safe to use the count optimization. +// ** A correct answer is still obtained (though perhaps more slowly) if +// ** this routine returns NULL when it could have returned a table pointer. +// ** But returning the pointer when NULL should have been returned can +// ** result in incorrect answers and/or crashes. So, when in doubt, return NULL. +// */ +func _isSimpleCount(tls *libc.TLS, p uintptr, pAggInfo uintptr) (r uintptr) { + var pExpr, pTab uintptr + _, _ = pExpr, pTab + if (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 || (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr != int32(1) || (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc != int32(1) || (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect != 0 || (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc != int32(1) || (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { + return uintptr(0) + } + pTab = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + return uintptr(0) + } + pExpr = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { + return uintptr(0) + } + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo != pAggInfo { + return uintptr(0) + } + if (*TFuncDef)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_COUNT) == uint32(0) { + return uintptr(0) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Distinct)|libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + return uintptr(0) + } + return pTab +} + +// C documentation +// +// /* +// ** If the source-list item passed as an argument was augmented with an +// ** INDEXED BY clause, then try to locate the specified index. If there +// ** was such a clause and the named index cannot be found, return +// ** SQLITE_ERROR and leave an error in pParse. Otherwise, populate +// ** pFrom->pIndex and return SQLITE_OK. +// */ +func _sqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pIdx, pTab, zIndexedBy uintptr + _, _, _ = pIdx, pTab, zIndexedBy + pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab + zIndexedBy = *(*uintptr)(unsafe.Pointer(pFrom + 88)) + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0 && _sqlite3StrICmp(tls, (*TIndex)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0) { + break + } + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + if !(pIdx != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19611, libc.VaList(bp+8, zIndexedBy, 0)) + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + return int32(SQLITE_ERROR) + } + *(*uintptr)(unsafe.Pointer(pFrom + 96)) = pIdx + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Detect compound SELECT statements that use an ORDER BY clause with +// ** an alternative collating sequence. +// ** +// ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ... +// ** +// ** These are rewritten as a subquery: +// ** +// ** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2) +// ** ORDER BY ... COLLATE ... +// ** +// ** This transformation is necessary because the multiSelectOrderBy() routine +// ** above that generates the code for a compound SELECT with an ORDER BY clause +// ** uses a merge algorithm that requires the same collating sequence on the +// ** result columns as on the ORDER BY clause. See ticket +// ** http://www.sqlite.org/src/info/6709574d2a +// ** +// ** This transformation is only needed for EXCEPT, INTERSECT, and UNION. +// ** The UNION ALL operator works fine with multiSelectOrderBy() even when +// ** there are COLLATE terms in the ORDER BY. +// */ +func _convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, db, pNew, pNewSrc, pParse, pX uintptr + var i int32 + var _ /* dummy at bp+0 */ TToken + _, _, _, _, _, _, _ = a, db, i, pNew, pNewSrc, pParse, pX + if (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { + return WRC_Continue + } + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy == uintptr(0) { + return WRC_Continue + } + pX = p + for { + if !(pX != 0 && (int32((*TSelect)(unsafe.Pointer(pX)).Fop) == int32(TK_ALL) || int32((*TSelect)(unsafe.Pointer(pX)).Fop) == int32(TK_SELECT))) { + break + } + goto _1 + _1: + ; + pX = (*TSelect)(unsafe.Pointer(pX)).FpPrior + } + if pX == uintptr(0) { + return WRC_Continue + } + a = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + 8 + /* If iOrderByCol is already non-zero, then it has already been matched + ** to a result column of the SELECT statement. This occurs when the + ** SELECT is rewritten for window-functions processing and then passed + ** to sqlite3SelectPrep() and similar a second time. The rewriting done + ** by this function is not required in this case. */ + if *(*Tu16)(unsafe.Pointer(a + 24)) != 0 { + return WRC_Continue + } + i = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpOrderBy)).FnExpr - int32(1) + for { + if !(i >= 0) { + break + } + if (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(a + uintptr(i)*32))).FpExpr)).Fflags&uint32(EP_Collate) != 0 { + break + } + goto _2 + _2: + ; + i-- + } + if i < 0 { + return WRC_Continue + } + /* If we reach this point, that means the transformation is required. */ + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pNew = _sqlite3DbMallocZero(tls, db, uint64(128)) + if pNew == uintptr(0) { + return int32(WRC_Abort) + } + libc.Xmemset(tls, bp, 0, uint64(16)) + pNewSrc = _sqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp, pNew, uintptr(0)) + if pNewSrc == uintptr(0) { + return int32(WRC_Abort) + } + *(*TSelect)(unsafe.Pointer(pNew)) = *(*TSelect)(unsafe.Pointer(p)) + (*TSelect)(unsafe.Pointer(p)).FpSrc = pNewSrc + (*TSelect)(unsafe.Pointer(p)).FpEList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3Expr(tls, db, int32(TK_ASTERISK), uintptr(0))) + (*TSelect)(unsafe.Pointer(p)).Fop = uint8(TK_SELECT) + (*TSelect)(unsafe.Pointer(p)).FpWhere = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpGroupBy = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpHaving = uintptr(0) + (*TSelect)(unsafe.Pointer(pNew)).FpOrderBy = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpNext = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpWith = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpWinDefn = uintptr(0) + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Compound)) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Converted) + (*TSelect)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pNew)).FpPrior)).FpNext = pNew + (*TSelect)(unsafe.Pointer(pNew)).FpLimit = uintptr(0) + return WRC_Continue +} + +// C documentation +// +// /* +// ** Check to see if the FROM clause term pFrom has table-valued function +// ** arguments. If it does, leave an error message in pParse and return +// ** non-zero, since pFrom is not allowed to be a table-valued function. +// */ +func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x4>>2)) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19629, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Argument pWith (which may be NULL) points to a linked list of nested +// ** WITH contexts, from inner to outermost. If the table identified by +// ** FROM clause element pItem is really a common-table-expression (CTE) +// ** then return a pointer to the CTE definition for that table. Otherwise +// ** return NULL. +// ** +// ** If a non-NULL value is returned, set *ppContext to point to the With +// ** object that the returned CTE belongs to. +// */ +func _searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) (r uintptr) { + var i int32 + var p, zName uintptr + _, _, _ = i, p, zName + zName = (*TSrcItem)(unsafe.Pointer(pItem)).FzName + p = pWith + for { + if !(p != 0) { + break + } + i = 0 + for { + if !(i < (*TWith)(unsafe.Pointer(p)).FnCte) { + break + } + if _sqlite3StrICmp(tls, zName, (*(*TCte)(unsafe.Pointer(p + 16 + uintptr(i)*48))).FzName) == 0 { + *(*uintptr)(unsafe.Pointer(ppContext)) = p + return p + 16 + uintptr(i)*48 + } + goto _2 + _2: + ; + i++ + } + if (*TWith)(unsafe.Pointer(p)).FbView != 0 { + break + } + goto _1 + _1: + ; + p = (*TWith)(unsafe.Pointer(p)).FpOuter + } + return uintptr(0) +} + +// C documentation +// +// /* The code generator maintains a stack of active WITH clauses +// ** with the inner-most WITH clause being at the top of the stack. +// ** +// ** This routine pushes the WITH clause passed as the second argument +// ** onto the top of the stack. If argument bFree is true, then this +// ** WITH clause will never be popped from the stack but should instead +// ** be freed along with the Parse object. In other cases, when +// ** bFree==0, the With object will be freed along with the SELECT +// ** statement with which it is associated. +// ** +// ** This routine returns a copy of pWith. Or, if bFree is true and +// ** the pWith object is destroyed immediately due to an OOM condition, +// ** then this routine return NULL. +// ** +// ** If bFree is true, do not continue to use the pWith pointer after +// ** calling this routine, Instead, use only the return value. +// */ +func _sqlite3WithPush(tls *libc.TLS, pParse uintptr, pWith uintptr, bFree Tu8) (r uintptr) { + if pWith != 0 { + if bFree != 0 { + pWith = _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3WithDeleteGeneric), pWith) + if pWith == uintptr(0) { + return uintptr(0) + } + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + (*TWith)(unsafe.Pointer(pWith)).FpOuter = (*TParse)(unsafe.Pointer(pParse)).FpWith + (*TParse)(unsafe.Pointer(pParse)).FpWith = pWith + } + } + return pWith +} + +// C documentation +// +// /* +// ** This function checks if argument pFrom refers to a CTE declared by +// ** a WITH clause on the stack currently maintained by the parser (on the +// ** pParse->pWith linked list). And if currently processing a CTE +// ** CTE expression, through routine checks to see if the reference is +// ** a recursive reference to the CTE. +// ** +// ** If pFrom matches a CTE according to either of these two above, pFrom->pTab +// ** and other fields are populated accordingly. +// ** +// ** Return 0 if no match is found. +// ** Return 1 if a match is found. +// ** Return 2 if an error condition is detected. +// */ +func _resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bMayRecursive, i, iRecTab, rc, v4 int32 + var db, pCte, pCteUse, pEList, pItem, pLeft, pRecTerm, pSavedWith, pSel, pSrc, pTab, v1, v2, v5 uintptr + var _ /* pWith at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bMayRecursive, db, i, iRecTab, pCte, pCteUse, pEList, pItem, pLeft, pRecTerm, pSavedWith, pSel, pSrc, pTab, rc, v1, v2, v4, v5 /* The matching WITH */ + if (*TParse)(unsafe.Pointer(pParse)).FpWith == uintptr(0) { + /* There are no WITH clauses in the stack. No match is possible */ + return 0 + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + /* Prior errors might have left pParse->pWith in a goofy state, so + ** go no further. */ + return 0 + } + if (*TSrcItem)(unsafe.Pointer(pFrom)).FzDatabase != uintptr(0) { + /* The FROM term contains a schema qualifier (ex: main.t1) and so + ** it cannot possibly be a CTE reference. */ + return 0 + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x200>>9)) != 0 { + /* The FROM term is specifically excluded from matching a CTE. + ** (1) It is part of a trigger that used to have zDatabase but had + ** zDatabase removed by sqlite3FixTriggerStep(). + ** (2) This is the first term in the FROM clause of an UPDATE. + */ + return 0 + } + pCte = _searchWith(tls, (*TParse)(unsafe.Pointer(pParse)).FpWith, pFrom, bp) + if pCte != 0 { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial value of pParse->pWith */ + iRecTab = -int32(1) + /* If pCte->zCteErr is non-NULL at this point, then this is an illegal + ** recursive reference to CTE pCte. Leave an error in pParse and return + ** early. If pCte->zCteErr is NULL, then this is not a recursive reference. + ** In this case, proceed. */ + if (*TCte)(unsafe.Pointer(pCte)).FzCteErr != 0 { + _sqlite3ErrorMsg(tls, pParse, (*TCte)(unsafe.Pointer(pCte)).FzCteErr, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + return int32(2) + } + if _cannotBeFunction(tls, pParse, pFrom) != 0 { + return int32(2) + } + pTab = _sqlite3DbMallocZero(tls, db, uint64(104)) + if pTab == uintptr(0) { + return int32(2) + } + pCteUse = (*TCte)(unsafe.Pointer(pCte)).FpUse + if pCteUse == uintptr(0) { + v1 = _sqlite3DbMallocZero(tls, db, uint64(20)) + pCteUse = v1 + (*TCte)(unsafe.Pointer(pCte)).FpUse = v1 + if pCteUse == uintptr(0) || _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3DbFree), pCteUse) == uintptr(0) { + _sqlite3DbFree(tls, db, pTab) + return int32(2) + } + (*TCteUse)(unsafe.Pointer(pCteUse)).FeM10d = (*TCte)(unsafe.Pointer(pCte)).FeM10d + } + (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = pTab + (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, db, (*TCte)(unsafe.Pointer(pCte)).FzName) + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) + (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*TCte)(unsafe.Pointer(pCte)).FpSelect, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(2) + } + *(*Tu32)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4)) |= uint32(SF_CopyCte) + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19652, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pFrom + 88)))) + return int32(2) + } + libc.SetBitFieldPtr16Uint32(pFrom+60+4, libc.Uint32FromInt32(1), 8, 0x100) + *(*uintptr)(unsafe.Pointer(pFrom + 96)) = pCteUse + (*TCteUse)(unsafe.Pointer(pCteUse)).FnUse++ + /* Check if this is a recursive CTE. */ + v2 = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + pSel = v2 + pRecTerm = v2 + bMayRecursive = libc.BoolInt32(int32((*TSelect)(unsafe.Pointer(pSel)).Fop) == int32(TK_ALL) || int32((*TSelect)(unsafe.Pointer(pSel)).Fop) == int32(TK_UNION)) + for bMayRecursive != 0 && int32((*TSelect)(unsafe.Pointer(pRecTerm)).Fop) == int32((*TSelect)(unsafe.Pointer(pSel)).Fop) { + pSrc = (*TSelect)(unsafe.Pointer(pRecTerm)).FpSrc + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + pItem = pSrc + 8 + uintptr(i)*104 + if (*TSrcItem)(unsafe.Pointer(pItem)).FzDatabase == uintptr(0) && (*TSrcItem)(unsafe.Pointer(pItem)).FzName != uintptr(0) && 0 == _sqlite3StrICmp(tls, (*TSrcItem)(unsafe.Pointer(pItem)).FzName, (*TCte)(unsafe.Pointer(pCte)).FzName) { + (*TSrcItem)(unsafe.Pointer(pItem)).FpTab = pTab + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + libc.SetBitFieldPtr16Uint32(pItem+60+4, libc.Uint32FromInt32(1), 6, 0x40) + if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19672, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName)) + return int32(2) + } + *(*Tu32)(unsafe.Pointer(pRecTerm + 4)) |= uint32(SF_Recursive) + if iRecTab < 0 { + v5 = pParse + 52 + v4 = *(*int32)(unsafe.Pointer(v5)) + *(*int32)(unsafe.Pointer(v5))++ + iRecTab = v4 + } + (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor = iRecTab + } + goto _3 + _3: + ; + i++ + } + if (*TSelect)(unsafe.Pointer(pRecTerm)).FselFlags&uint32(SF_Recursive) == uint32(0) { + break + } + pRecTerm = (*TSelect)(unsafe.Pointer(pRecTerm)).FpPrior + } + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19715 + pSavedWith = (*TParse)(unsafe.Pointer(pParse)).FpWith + (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) + if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { + (*TSelect)(unsafe.Pointer(pRecTerm)).FpWith = (*TSelect)(unsafe.Pointer(pSel)).FpWith + rc = _sqlite3WalkSelect(tls, pWalker, pRecTerm) + (*TSelect)(unsafe.Pointer(pRecTerm)).FpWith = uintptr(0) + if rc != 0 { + (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return int32(2) + } + } else { + if _sqlite3WalkSelect(tls, pWalker, pSel) != 0 { + (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return int32(2) + } + } + (*TParse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp)) + pLeft = pSel + for { + if !((*TSelect)(unsafe.Pointer(pLeft)).FpPrior != 0) { + break + } + goto _6 + _6: + ; + pLeft = (*TSelect)(unsafe.Pointer(pLeft)).FpPrior + } + pEList = (*TSelect)(unsafe.Pointer(pLeft)).FpEList + if (*TCte)(unsafe.Pointer(pCte)).FpCols != 0 { + if pEList != 0 && (*TExprList)(unsafe.Pointer(pEList)).FnExpr != (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19738, libc.VaList(bp+16, (*TCte)(unsafe.Pointer(pCte)).FzName, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, (*TExprList)(unsafe.Pointer((*TCte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return int32(2) + } + pEList = (*TCte)(unsafe.Pointer(pCte)).FpCols + } + _sqlite3ColumnsFromExprList(tls, pParse, pEList, pTab+54, pTab+8) + if bMayRecursive != 0 { + if (*TSelect)(unsafe.Pointer(pSel)).FselFlags&uint32(SF_Recursive) != 0 { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19776 + } else { + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = __ccgo_ts + 19810 + } + _sqlite3WalkSelect(tls, pWalker, pSel) + } + (*TCte)(unsafe.Pointer(pCte)).FzCteErr = uintptr(0) + (*TParse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return int32(1) /* Success */ + } + return 0 /* No match */ +} + +// C documentation +// +// /* +// ** If the SELECT passed as the second argument has an associated WITH +// ** clause, pop it from the stack stored as part of the Parse object. +// ** +// ** This function is used as the xSelectCallback2() callback by +// ** sqlite3SelectExpand() when walking a SELECT tree to resolve table +// ** names and other FROM clause elements. +// */ +func _sqlite3SelectPopWith(tls *libc.TLS, pWalker uintptr, p uintptr) { + var pParse, pWith uintptr + _, _ = pParse, pWith + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + if (*TParse)(unsafe.Pointer(pParse)).FpWith != 0 && (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { + pWith = (*TSelect)(unsafe.Pointer(_findRightmost(tls, p))).FpWith + if pWith != uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).FpWith = (*TWith)(unsafe.Pointer(pWith)).FpOuter + } + } +} + +// C documentation +// +// /* +// ** The SrcItem structure passed as the second argument represents a +// ** sub-query in the FROM clause of a SELECT statement. This function +// ** allocates and populates the SrcItem.pTab object. If successful, +// ** SQLITE_OK is returned. Otherwise, if an OOM error is encountered, +// ** SQLITE_NOMEM. +// */ +func _sqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pSel, pTab, v1 uintptr + var v2 int32 + _, _, _, _ = pSel, pTab, v1, v2 + pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + v1 = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(104)) + pTab = v1 + (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = v1 + if pTab == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) + if (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias) + } else { + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3MPrintf(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, __ccgo_ts+19848, libc.VaList(bp+8, pFrom)) + } + for (*TSelect)(unsafe.Pointer(pSel)).FpPrior != 0 { + pSel = (*TSelect)(unsafe.Pointer(pSel)).FpPrior + } + _sqlite3ColumnsFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(pSel)).FpEList, pTab+54, pTab+8) + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VIEW) + (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + /* The usual case - do not allow ROWID on a subquery */ + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(libc.Int32FromInt32(TF_Ephemeral) | libc.Int32FromInt32(TF_NoVisibleRowid)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + v2 = int32(SQLITE_ERROR) + } else { + v2 = SQLITE_OK + } + return v2 +} + +// C documentation +// +// /* +// ** Check the N SrcItem objects to the right of pBase. (N might be zero!) +// ** If any of those SrcItem objects have a USING clause containing zName +// ** then return true. +// ** +// ** If N is zero, or none of the N SrcItem objects to the right of pBase +// ** contains a USING clause, or if none of the USING clauses contain zName, +// ** then return false. +// */ +func _inAnyUsingClause(tls *libc.TLS, zName uintptr, pBase uintptr, N int32) (r int32) { + for N > 0 { + N-- + pBase += 104 + if int32(uint32(*(*uint16)(unsafe.Pointer(pBase + 60 + 4))&0x400>>10)) == 0 { + continue + } + if *(*uintptr)(unsafe.Pointer(pBase + 72)) == uintptr(0) { + continue + } + if _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pBase + 72)), zName) >= 0 { + return int32(1) + } + } + return 0 +} + +// C documentation +// +// /* +// ** This routine is a Walker callback for "expanding" a SELECT statement. +// ** "Expanding" means to do the following: +// ** +// ** (1) Make sure VDBE cursor numbers have been assigned to every +// ** element of the FROM clause. +// ** +// ** (2) Fill in the pTabList->a[].pTab fields in the SrcList that +// ** defines FROM clause. When views appear in the FROM clause, +// ** fill pTabList->a[].pSelect with a copy of the SELECT statement +// ** that implements the view. A copy is made of the view's SELECT +// ** statement so that we can freely modify or delete that statement +// ** without worrying about messing up the persistent representation +// ** of the view. +// ** +// ** (3) Add terms to the WHERE clause to accommodate the NATURAL keyword +// ** on joins and the ON and USING clause of joins. +// ** +// ** (4) Scan the list of columns in the result set (pEList) looking +// ** for instances of the "*" operator or the TABLE.* operator. +// ** If found, expand each "*" to be every column in every table +// ** and TABLE.* to be every column in TABLE. +// ** +// */ +func _selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var a, db, pE, pEList, pExpr, pFrom, pLeft, pNestedFrom, pNew, pParse, pRight, pSel, pTab, pTab1, pTabList, pUsing, pX, pX1, zName, zSchemaName, zTName, zTabName, zUName, v10, v2, v5, v9 uintptr + var eCodeOrig Tu8 + var elistFlags Tu32 + var flags, i, iDb, iErrOfst, ii, j, k, longNames, nAdd, rc, tableSeen, v1, v13, v4 int32 + var nCol Ti16 + var selFlags Tu16 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, db, eCodeOrig, elistFlags, flags, i, iDb, iErrOfst, ii, j, k, longNames, nAdd, nCol, pE, pEList, pExpr, pFrom, pLeft, pNestedFrom, pNew, pParse, pRight, pSel, pTab, pTab1, pTabList, pUsing, pX, pX1, rc, selFlags, tableSeen, zName, zSchemaName, zTName, zTabName, zUName, v1, v10, v13, v2, v4, v5, v9 + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + selFlags = uint16((*TSelect)(unsafe.Pointer(p)).FselFlags) + elistFlags = uint32(0) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Expanded) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(WRC_Abort) + } + if int32(selFlags)&int32(SF_Expanded) != 0 { + return int32(WRC_Prune) + } + if (*TWalker)(unsafe.Pointer(pWalker)).FeCode != 0 { + /* Renumber selId because it has been copied from a view */ + v2 = pParse + 148 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + (*TSelect)(unsafe.Pointer(p)).FselId = uint32(v1) + } + pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc + pEList = (*TSelect)(unsafe.Pointer(p)).FpEList + if (*TParse)(unsafe.Pointer(pParse)).FpWith != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_View) != 0 { + if (*TSelect)(unsafe.Pointer(p)).FpWith == uintptr(0) { + (*TSelect)(unsafe.Pointer(p)).FpWith = _sqlite3DbMallocZero(tls, db, uint64(64)) + if (*TSelect)(unsafe.Pointer(p)).FpWith == uintptr(0) { + return int32(WRC_Abort) + } + } + (*TWith)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpWith)).FbView = int32(1) + } + _sqlite3WithPush(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpWith, uint8(0)) + /* Make sure cursor numbers have been assigned to all entries in + ** the FROM clause of the SELECT statement. + */ + _sqlite3SrcListAssignCursors(tls, pParse, pTabList) + /* Look up every table named in the FROM clause of the select. If + ** an entry of the FROM clause is a subquery instead of a table or view, + ** then create a transient table structure to describe the subquery. + */ + i = 0 + pFrom = pTabList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + if (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab != 0 { + goto _3 + } + if (*TSrcItem)(unsafe.Pointer(pFrom)).FzName == uintptr(0) { + pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + /* A sub-query in the FROM clause of a SELECT */ + if _sqlite3WalkSelect(tls, pWalker, pSel) != 0 { + return int32(WRC_Abort) + } + if _sqlite3ExpandSubquery(tls, pParse, pFrom) != 0 { + return int32(WRC_Abort) + } + } else { + v4 = _resolveFromTermToCte(tls, pParse, pWalker, pFrom) + rc = v4 + if v4 != 0 { + if rc > int32(1) { + return int32(WRC_Abort) + } + pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab + } else { + /* An ordinary table or view name in the FROM clause */ + v5 = _sqlite3LocateTableItem(tls, pParse, uint32(0), pFrom) + pTab = v5 + (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = v5 + if pTab == uintptr(0) { + return int32(WRC_Abort) + } + if (*TTable)(unsafe.Pointer(pTab)).FnTabRef >= uint32(0xffff) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19852, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) + return int32(WRC_Abort) + } + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && _cannotBeFunction(tls, pParse, pFrom) != 0 { + return int32(WRC_Abort) + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { + eCodeOrig = uint8((*TWalker)(unsafe.Pointer(pWalker)).FeCode) + if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + return int32(WRC_Abort) + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableView) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19891, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + } + (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect = _sqlite3SelectDup(tls, db, (*(*struct { + FpSelect uintptr + })(unsafe.Pointer(&(*TTable)(unsafe.Pointer(pTab)).Fu))).FpSelect, 0) + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) && int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x80>>7)) != 0 && (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp != uintptr(0) && int32((*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp)).FeVtabRisk) > libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_TrustedSchema) != uint64(0)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+15141, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) + } + } + nCol = (*TTable)(unsafe.Pointer(pTab)).FnCol + (*TTable)(unsafe.Pointer(pTab)).FnCol = int16(-int32(1)) + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(1) /* Turn on Select.selId renumbering */ + _sqlite3WalkSelect(tls, pWalker, (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect) + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(eCodeOrig) + (*TTable)(unsafe.Pointer(pTab)).FnCol = nCol + } + } + } + /* Locate the index named by the INDEXED BY clause, if any. */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2>>1)) != 0 && _sqlite3IndexedByLookup(tls, pParse, pFrom) != 0 { + return int32(WRC_Abort) + } + goto _3 + _3: + ; + i++ + pFrom += 104 + } + /* Process NATURAL keywords, and ON and USING clauses of joins. + */ + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 || _sqlite3ProcessJoin(tls, pParse, p) != 0 { + return int32(WRC_Abort) + } + /* For every "*" that occurs in the column list, insert the names of + ** all columns in all tables. And for every TABLE.* insert the names + ** of all columns in TABLE. The parser inserted a special expression + ** with the TK_ASTERISK operator for each "*" that it found in the column + ** list. The following code just has to locate the TK_ASTERISK + ** expressions and expand each one to the list of all columns in + ** all tables. + ** + ** The first loop just checks to see if there are any "*" operators + ** that need expanding. + */ + k = 0 + for { + if !(k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + pE = (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(k)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_ASTERISK) { + break + } + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_DOT) && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpRight)).Fop) == int32(TK_ASTERISK) { + break + } + elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags + goto _6 + _6: + ; + k++ + } + if k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr { + /* + ** If we get here it means the result set contains one or more "*" + ** operators that need to be expanded. Loop through each expression + ** in the result set and expand them one by one. + */ + a = pEList + 8 + pNew = uintptr(0) + flags = int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags) + longNames = libc.BoolInt32(flags&int32(SQLITE_FullColNames) != 0 && flags&int32(SQLITE_ShortColNames) == 0) + k = 0 + for { + if !(k < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + pE = (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FpExpr + elistFlags |= (*TExpr)(unsafe.Pointer(pE)).Fflags + pRight = (*TExpr)(unsafe.Pointer(pE)).FpRight + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) != int32(TK_ASTERISK) && (int32((*TExpr)(unsafe.Pointer(pE)).Fop) != int32(TK_DOT) || int32((*TExpr)(unsafe.Pointer(pRight)).Fop) != int32(TK_ASTERISK)) { + /* This particular expression does not need to be expanded. + */ + pNew = _sqlite3ExprListAppend(tls, pParse, pNew, (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FpExpr) + if pNew != 0 { + (*(*TExprList_item)(unsafe.Pointer(pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32))).FzEName = (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FzEName + libc.SetBitFieldPtr16Uint32(pNew+8+uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32+16+4, uint32(int32(uint32(*(*uint16)(unsafe.Pointer(a + uintptr(k)*32 + 16 + 4))&0x3>>0))), 0, 0x3) + (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FzEName = uintptr(0) + } + (*(*TExprList_item)(unsafe.Pointer(a + uintptr(k)*32))).FpExpr = uintptr(0) + } else { + /* This expression is a "*" or a "TABLE.*" and needs to be + ** expanded. */ + tableSeen = 0 /* Set to 1 when TABLE matches */ + zTName = uintptr(0) + if int32((*TExpr)(unsafe.Pointer(pE)).Fop) == int32(TK_DOT) { + zTName = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpLeft + 8)) + iErrOfst = *(*int32)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pE)).FpRight + 52)) + } else { + iErrOfst = *(*int32)(unsafe.Pointer(pE + 52)) + } + i = 0 + pFrom = pTabList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } /* Number of cols including rowid */ + pTab1 = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab /* AS name for this data source */ + zSchemaName = uintptr(0) /* USING clause for pFrom[1] */ + v9 = (*TSrcItem)(unsafe.Pointer(pFrom)).FzAlias + zTabName = v9 + if v9 == uintptr(0) { + zTabName = (*TTable)(unsafe.Pointer(pTab1)).FzName + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x2000>>13)) != 0 { + pNestedFrom = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect)).FpEList + } else { + if zTName != 0 && _sqlite3StrICmp(tls, zTName, zTabName) != 0 { + goto _8 + } + pNestedFrom = uintptr(0) + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab1)).FpSchema) + if iDb >= 0 { + v10 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + } else { + v10 = __ccgo_ts + 6622 + } + zSchemaName = v10 + } + if i+int32(1) < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc && int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 1*104 + 60 + 4))&0x400>>10)) != 0 && int32(selFlags)&int32(SF_NestedFrom) != 0 { + pUsing = *(*uintptr)(unsafe.Pointer(pFrom + 1*104 + 72)) + ii = 0 + for { + if !(ii < (*TIdList)(unsafe.Pointer(pUsing)).FnId) { + break + } + zUName = (*(*TIdList_item)(unsafe.Pointer(pUsing + 8 + uintptr(ii)*16))).FzName + pRight = _sqlite3Expr(tls, db, int32(TK_ID), zUName) + _sqlite3ExprSetErrorOffset(tls, pRight, iErrOfst) + pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pRight) + if pNew != 0 { + pX = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 + (*TExprList_item)(unsafe.Pointer(pX)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19922, libc.VaList(bp+8, zUName)) + libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(ENAME_TAB), 0, 0x3) + libc.SetBitFieldPtr16Uint32(pX+16+4, libc.Uint32FromInt32(1), 7, 0x80) + } + goto _11 + _11: + ; + ii++ + } + } else { + pUsing = uintptr(0) + } + nAdd = int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_NoVisibleRowid) == uint32(0) && int32(selFlags)&int32(SF_NestedFrom) != 0 { + nAdd++ + } + j = 0 + for { + if !(j < nAdd) { + break + } /* Newly added ExprList term */ + if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { + zName = _sqlite3RowidAlias(tls, pTab1) + if zName == uintptr(0) { + goto _12 + } + } else { + zName = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab1)).FaCol + uintptr(j)*16))).FzCnName + /* If pTab is actually an SF_NestedFrom sub-select, do not + ** expand any ENAME_ROWID columns. */ + if pNestedFrom != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32 + 16 + 4))&0x3>>0)) == int32(ENAME_ROWID) { + goto _12 + } + if zTName != 0 && pNestedFrom != 0 && _sqlite3MatchEName(tls, pNestedFrom+8+uintptr(j)*32, uintptr(0), zTName, uintptr(0), uintptr(0)) == 0 { + goto _12 + } + /* If a column is marked as 'hidden', omit it from the expanded + ** result-set list unless the SELECT has the SF_IncludeHidden + ** bit set. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_IncludeHidden) == uint32(0) && int32((*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab1)).FaCol+uintptr(j)*16)).FcolFlags)&int32(COLFLAG_HIDDEN) != 0 { + goto _12 + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab1)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_NOEXPAND) != 0 && zTName == uintptr(0) && int32(selFlags)&int32(SF_NestedFrom) == 0 { + goto _12 + } + } + tableSeen = int32(1) + if i > 0 && zTName == uintptr(0) && int32(selFlags)&int32(SF_NestedFrom) == 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x400>>10)) != 0 && _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pFrom + 72)), zName) >= 0 { + /* In a join with a USING clause, omit columns in the + ** using clause from the table on the right. */ + goto _12 + } + } + pRight = _sqlite3Expr(tls, db, int32(TK_ID), zName) + if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(1) && (int32((*TSrcItem)(unsafe.Pointer(pFrom)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 || int32(selFlags)&int32(SF_NestedFrom) != 0 || !(_inAnyUsingClause(tls, zName, pFrom, (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc-i-int32(1)) != 0)) || int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + pLeft = _sqlite3Expr(tls, db, int32(TK_ID), zTabName) + pExpr = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft, pRight) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TExpr)(unsafe.Pointer(pE)).FpLeft != 0 { + _sqlite3RenameTokenRemap(tls, pParse, pLeft, (*TExpr)(unsafe.Pointer(pE)).FpLeft) + } + if zSchemaName != 0 { + pLeft = _sqlite3Expr(tls, db, int32(TK_ID), zSchemaName) + pExpr = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft, pExpr) + } + } else { + pExpr = pRight + } + _sqlite3ExprSetErrorOffset(tls, pExpr, iErrOfst) + pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pExpr) + if pNew == uintptr(0) { + break /* OOM */ + } + pX1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 + if int32(selFlags)&int32(SF_NestedFrom) != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + if pNestedFrom != 0 && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || j < (*TExprList)(unsafe.Pointer(pNestedFrom)).FnExpr) { + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pNestedFrom + 8 + uintptr(j)*32))).FzEName) + } else { + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+19927, libc.VaList(bp+8, zSchemaName, zTabName, zName)) + } + if j == int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) { + v13 = int32(ENAME_ROWID) + } else { + v13 = int32(ENAME_TAB) + } + libc.SetBitFieldPtr16Uint32(pX1+16+4, uint32(v13), 0, 0x3) + if int32(uint32(*(*uint16)(unsafe.Pointer(pFrom + 60 + 4))&0x400>>10)) != 0 && _sqlite3IdListIndex(tls, *(*uintptr)(unsafe.Pointer(pFrom + 72)), zName) >= 0 || pUsing != 0 && _sqlite3IdListIndex(tls, pUsing, zName) >= 0 || j < int32((*TTable)(unsafe.Pointer(pTab1)).FnCol) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab1)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_NOEXPAND) != 0 { + libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(1), 8, 0x100) + } + } else { + if longNames != 0 { + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3MPrintf(tls, db, __ccgo_ts+12413, libc.VaList(bp+8, zTabName, zName)) + libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) + } else { + (*TExprList_item)(unsafe.Pointer(pX1)).FzEName = _sqlite3DbStrDup(tls, db, zName) + libc.SetBitFieldPtr16Uint32(pX1+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) + } + } + goto _12 + _12: + ; + j++ + } + goto _8 + _8: + ; + i++ + pFrom += 104 + } + if !(tableSeen != 0) { + if zTName != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19936, libc.VaList(bp+8, zTName)) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19954, 0) + } + } + } + goto _7 + _7: + ; + k++ + } + _sqlite3ExprListDelete(tls, db, pEList) + (*TSelect)(unsafe.Pointer(p)).FpEList = pNew + } + if (*TSelect)(unsafe.Pointer(p)).FpEList != 0 { + if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+19974, 0) + return int32(WRC_Abort) + } + if elistFlags&uint32(libc.Int32FromInt32(EP_HasFunc)|libc.Int32FromInt32(EP_Subquery)) != uint32(0) { + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_ComplexResult) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** This routine "expands" a SELECT statement and all of its subqueries. +// ** For additional information on what it means to "expand" a SELECT +// ** statement, see the comment on the selectExpand worker callback above. +// ** +// ** Expanding a SELECT statement is the first step in processing a +// ** SELECT statement. The SELECT statement must be expanded before +// ** name resolution is performed. +// ** +// ** If anything goes wrong, an error message is written into pParse. +// ** The calling function can detect the problem by looking at pParse->nErr +// ** and/or pParse->db->mallocFailed. +// */ +func _sqlite3SelectExpand(tls *libc.TLS, pParse uintptr, pSelect uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_sqlite3ExprWalkNoop) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + if (*TParse)(unsafe.Pointer(pParse)).FhasCompound != 0 { + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_convertCompoundSelectToSubquery) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = uintptr(0) + _sqlite3WalkSelect(tls, bp, pSelect) + } + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_selectExpander) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = __ccgo_fp(_sqlite3SelectPopWith) + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(0) + _sqlite3WalkSelect(tls, bp, pSelect) +} + +// C documentation +// +// /* +// ** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() +// ** interface. +// ** +// ** For each FROM-clause subquery, add Column.zType, Column.zColl, and +// ** Column.affinity information to the Table structure that represents +// ** the result set of that subquery. +// ** +// ** The Table structure that represents the result set was constructed +// ** by selectExpander() but the type and collation and affinity information +// ** was omitted at that point because identifiers had not yet been resolved. +// ** This routine is called after identifier resolution. +// */ +func _selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { + var i int32 + var pFrom, pParse, pSel, pTab, pTabList uintptr + _, _, _, _, _, _ = i, pFrom, pParse, pSel, pTab, pTabList + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_HasTypeInfo) != 0 { + return + } + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_HasTypeInfo) + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc + i = 0 + pFrom = pTabList + 8 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + pTab = (*TSrcItem)(unsafe.Pointer(pFrom)).FpTab + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Ephemeral) != uint32(0) { + /* A sub-query in the FROM clause of a SELECT */ + pSel = (*TSrcItem)(unsafe.Pointer(pFrom)).FpSelect + if pSel != 0 { + _sqlite3SubqueryColumnTypes(tls, pParse, pTab, pSel, int8(SQLITE_AFF_NONE)) + } + } + goto _1 + _1: + ; + i++ + pFrom += 104 + } +} + +// C documentation +// +// /* +// ** This routine adds datatype and collating sequence information to +// ** the Table structures of all FROM-clause subqueries in a +// ** SELECT statement. +// ** +// ** Use this routine after name resolution. +// */ +func _sqlite3SelectAddTypeInfo(tls *libc.TLS, pParse uintptr, pSelect uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback2 = __ccgo_fp(_selectAddSubqueryTypeInfo) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_sqlite3ExprWalkNoop) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + _sqlite3WalkSelect(tls, bp, pSelect) +} + +// C documentation +// +// /* +// ** This routine sets up a SELECT statement for processing. The +// ** following is accomplished: +// ** +// ** * VDBE Cursor numbers are assigned to all FROM-clause terms. +// ** * Ephemeral Table objects are created for all FROM-clause subqueries. +// ** * ON and USING clauses are shifted into WHERE statements +// ** * Wildcards "*" and "TABLE.*" in result sets are expanded. +// ** * Identifiers in expression are matched to tables. +// ** +// ** This routine acts recursively on all subqueries within the SELECT. +// */ +func _sqlite3SelectPrep(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintptr) { + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_HasTypeInfo) != 0 { + return + } + _sqlite3SelectExpand(tls, pParse, p) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + _sqlite3ResolveSelectNames(tls, pParse, p, pOuterNC) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + _sqlite3SelectAddTypeInfo(tls, pParse, p) +} + +// C documentation +// +// /* +// ** Analyze the arguments to aggregate functions. Create new pAggInfo->aCol[] +// ** entries for columns that are arguments to aggregate functions but which +// ** are not otherwise used. +// ** +// ** The aCol[] entries in AggInfo prior to nAccumulator are columns that +// ** are referenced outside of aggregate functions. These might be columns +// ** that are part of the GROUP by clause, for example. Other database engines +// ** would throw an error if there is a column reference that is not in the +// ** GROUP BY clause and that is not part of an aggregate function argument. +// ** But SQLite allows this. +// ** +// ** The aCol[] entries beginning with the aCol[nAccumulator] and following +// ** are column references that are used exclusively as arguments to +// ** aggregate functions. This routine is responsible for computing +// ** (or recomputing) those aCol[] entries. +// */ +func _analyzeAggFuncArgs(tls *libc.TLS, pAggInfo uintptr, pNC uintptr) { + var i int32 + var pExpr uintptr + _, _ = i, pExpr + *(*int32)(unsafe.Pointer(pNC + 40)) |= int32(NC_InAggFunc) + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + pExpr = (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr + _sqlite3ExprAnalyzeAggList(tls, pNC, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft != 0 { + _sqlite3ExprAnalyzeAggList(tls, pNC, *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft + 32))) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + _sqlite3ExprAnalyzeAggregates(tls, pNC, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64)))).FpFilter) + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(pNC + 40)) &= ^libc.Int32FromInt32(NC_InAggFunc) +} + +// C documentation +// +// /* +// ** An index on expressions is being used in the inner loop of an +// ** aggregate query with a GROUP BY clause. This routine attempts +// ** to adjust the AggInfo object to take advantage of index and to +// ** perhaps use the index as a covering index. +// ** +// */ +func _optimizeAggregateUseOfIndexedExpr(tls *libc.TLS, pParse uintptr, pSelect uintptr, pAggInfo uintptr, pNC uintptr) { + var j, k, mx int32 + _, _, _ = j, k, mx + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator + if int32((*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn) > 0 { + mx = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpGroupBy)).FnExpr - int32(1) + j = 0 + for { + if !(j < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + break + } + k = int32((*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(j)*24))).FiSorterColumn) + if k > mx { + mx = k + } + goto _1 + _1: + ; + j++ + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(mx + int32(1)) + } + _analyzeAggFuncArgs(tls, pAggInfo, pNC) + _ = pSelect + _ = pParse +} + +// C documentation +// +// /* +// ** Walker callback for aggregateConvertIndexedExprRefToColumn(). +// */ +func _aggregateIdxEprRefToColCallback(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var pAggInfo, pCol uintptr + _, _ = pAggInfo, pCol + _ = pWalker + if (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { + return WRC_Continue + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_COLUMN) { + return WRC_Continue + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) { + return WRC_Continue + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IF_NULL_ROW) { + return WRC_Continue + } + pAggInfo = (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiAgg) >= (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn { + return WRC_Continue + } + pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pExpr)).FiAgg)*24 + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_AGG_COLUMN) + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TAggInfo_col)(unsafe.Pointer(pCol)).FiTable + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = (*TAggInfo_col)(unsafe.Pointer(pCol)).FiColumn + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^(libc.Int32FromInt32(EP_Skip) | libc.Int32FromInt32(EP_Collate) | libc.Int32FromInt32(EP_Unlikely))) + return int32(WRC_Prune) +} + +// C documentation +// +// /* +// ** Convert every pAggInfo->aFunc[].pExpr such that any node within +// ** those expressions that has pAppInfo set is changed into a TK_AGG_COLUMN +// ** opcode. +// */ +func _aggregateConvertIndexedExprRefToColumn(tls *libc.TLS, pAggInfo uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i int32 + var _ /* w at bp+0 */ TWalker + _ = i + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_aggregateIdxEprRefToColCallback) + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + _sqlite3WalkExpr(tls, bp, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr) + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Allocate a block of registers so that there is one register for each +// ** pAggInfo->aCol[] and pAggInfo->aFunc[] entry in pAggInfo. The first +// ** register in this block is stored in pAggInfo->iFirstReg. +// ** +// ** This routine may only be called once for each AggInfo object. Prior +// ** to calling this routine: +// ** +// ** * The aCol[] and aFunc[] arrays may be modified +// ** * The AggInfoColumnReg() and AggInfoFuncReg() macros may not be used +// ** +// ** After calling this routine: +// ** +// ** * The aCol[] and aFunc[] arrays are fixed +// ** * The AggInfoColumnReg() and AggInfoFuncReg() macros may be used +// ** +// */ +func _assignAggregateRegisters(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc +} + +// C documentation +// +// /* +// ** Reset the aggregate accumulator. +// ** +// ** The aggregate accumulator is a set of memory cells that hold +// ** intermediate results while calculating an aggregate. This +// ** routine generates code that stores NULLs in all of those memory +// ** cells. +// */ +func _resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, nExtra, nReg int32 + var pE, pFunc, pKeyInfo, pKeyInfo1, pOBList, v uintptr + _, _, _, _, _, _, _, _, _ = i, nExtra, nReg, pE, pFunc, pKeyInfo, pKeyInfo1, pOBList, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + nReg = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn + if nReg == 0 { + return + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+nReg-int32(1)) + pFunc = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + i = libc.Int32FromInt32(0) + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { + pE = (*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr + if *(*uintptr)(unsafe.Pointer(pE + 32)) == uintptr(0) || (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32)))).FnExpr != int32(1) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20005, 0) + (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -int32(1) + } else { + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32)), 0, 0) + (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -int32(8)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20056, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + } + } + if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab >= 0 { + nExtra = 0 + pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr)).FpLeft + 32)) + if !((*TAggInfo_func)(unsafe.Pointer(pFunc)).FbOBUnique != 0) { + nExtra++ /* One extra column for the OP_Sequence */ + } + if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FbOBPayload != 0 { + /* extra columns for the function arguments */ + nExtra += (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr + 32)))).FnExpr + } + if (*TAggInfo_func)(unsafe.Pointer(pFunc)).FbUseSubtype != 0 { + nExtra += (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr + 32)))).FnExpr + } + pKeyInfo1 = _sqlite3KeyInfoFromExprList(tls, pParse, pOBList, 0, nExtra) + if !((*TAggInfo_func)(unsafe.Pointer(pFunc)).FbOBUnique != 0) && (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + (*TKeyInfo)(unsafe.Pointer(pKeyInfo1)).FnKeyField++ + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*TAggInfo_func)(unsafe.Pointer(pFunc)).FiOBTab, (*TExprList)(unsafe.Pointer(pOBList)).FnExpr+nExtra, 0, pKeyInfo1, -int32(8)) + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20089, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + } + goto _1 + _1: + ; + i++ + pFunc += 32 + } +} + +// C documentation +// +// /* +// ** Invoke the OP_AggFinalize opcode for every aggregate function +// ** in the AggInfo structure. +// */ +func _finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { + var i, iBaseCol, iTop, j, nArg, nKey, regAgg, regSubtype, v4 int32 + var pF, pList, v uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = i, iBaseCol, iTop, j, nArg, nKey, pF, pList, regAgg, regSubtype, v, v4 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + i = 0 + pF = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + pList = *(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32)) + if (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab >= 0 { /* Loop counter */ + nArg = (*TExprList)(unsafe.Pointer(pList)).FnExpr + regAgg = _sqlite3GetTempRange(tls, pParse, nArg) + if int32((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload) == 0 { + nKey = 0 + } else { + nKey = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).FpLeft + 32)))).FnExpr + if !((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique != 0) { + nKey++ + } + } + iTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab) + j = nArg - int32(1) + for { + if !(j >= 0) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, nKey+j, regAgg+j) + goto _2 + _2: + ; + j-- + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { + regSubtype = _sqlite3GetTempReg(tls, pParse) + iBaseCol = nKey + nArg + libc.BoolInt32(int32((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload) == 0 && int32((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique) == 0) + j = nArg - int32(1) + for { + if !(j >= 0) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, iBaseCol+j, regSubtype) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SetSubtype), regSubtype, regAgg+j) + goto _3 + _3: + ; + j-- + } + _sqlite3ReleaseTempReg(tls, pParse, regSubtype) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_AggStep), 0, regAgg, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+i) + _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) + _sqlite3VdbeChangeP5(tls, v, uint16(uint8(nArg))) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, iTop+int32(1)) + _sqlite3VdbeJumpHere(tls, v, iTop) + _sqlite3ReleaseTempRange(tls, pParse, regAgg, nArg) + } + if pList != 0 { + v4 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } else { + v4 = 0 + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_AggFinal), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+i, v4) + _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) + goto _1 + _1: + ; + i++ + pF += 32 + } +} + +// C documentation +// +// /* +// ** Generate code that will update the accumulator memory cells for an +// ** aggregate based on the current cursor position. +// ** +// ** If regAcc is non-zero and there are no min() or max() aggregates +// ** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator +// ** registers if register regAcc contains 0. The caller will take care +// ** of setting and clearing regAcc. +// ** +// ** For an ORDER BY aggregate, the actual accumulator memory cell update +// ** is deferred until after all input rows have been received, so that they +// ** can be run in the requested order. In that case, instead of invoking +// ** OP_AggStep to update the accumulator, just add the arguments that would +// ** have been passed into OP_AggStep into the sorting ephemeral table +// ** (along with the appropriate sort key). +// */ +func _updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo uintptr, eDistinctType int32) { + var addrHitTest, addrNext, i, j, jj, kk, nArg, regAgg, regAggSz, regBase, regDistinct, regHit, v2, v4, v7 int32 + var pC, pColl, pF, pFilter, pItem, pList, pOBList, v, v3, v8 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrHitTest, addrNext, i, j, jj, kk, nArg, pC, pColl, pF, pFilter, pItem, pList, pOBList, regAgg, regAggSz, regBase, regDistinct, regHit, v, v2, v3, v4, v7, v8 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + regHit = 0 + addrHitTest = 0 + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(1) + i = 0 + pF = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + addrNext = 0 + regAggSz = 0 + regDistinct = 0 + pList = *(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32)) + if (*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + pFilter = (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 64)))).FpFilter + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0 && (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 && regAcc != 0 { + /* If regAcc==0, there there exists some min() or max() function + ** without a FILTER clause that will ensure the magnet registers + ** are populated. */ + if regHit == 0 { + v3 = pParse + 56 + *(*int32)(unsafe.Pointer(v3))++ + v2 = *(*int32)(unsafe.Pointer(v3)) + regHit = v2 + } + /* If this is the first row of the group (regAcc contains 0), clear the + ** "magnet" register regHit so that the accumulator registers + ** are populated if the FILTER clause jumps over the the + ** invocation of min() or max() altogether. Or, if this is not + ** the first row (regAcc contains 1), set the magnet register so that + ** the accumulators are not populated unless the min()/max() is invoked + ** and indicates that they should be. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), regAcc, regHit) + } + addrNext = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprIfFalse(tls, pParse, pFilter, addrNext, int32(SQLITE_JUMPIFNULL)) + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab >= 0 { /* The ORDER BY clause */ + nArg = (*TExprList)(unsafe.Pointer(pList)).FnExpr + pOBList = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFExpr)).FpLeft + 32)) + regAggSz = (*TExprList)(unsafe.Pointer(pOBList)).FnExpr + if !((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique != 0) { + regAggSz++ /* One register for OP_Sequence */ + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload != 0 { + regAggSz += nArg + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { + regAggSz += nArg + } + regAggSz++ /* One extra register to hold result of MakeRecord */ + regAgg = _sqlite3GetTempRange(tls, pParse, regAggSz) + regDistinct = regAgg + _sqlite3ExprCodeExprList(tls, pParse, pOBList, regAgg, 0, uint8(SQLITE_ECEL_DUP)) + jj = (*TExprList)(unsafe.Pointer(pOBList)).FnExpr + if !((*TAggInfo_func)(unsafe.Pointer(pF)).FbOBUnique != 0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Sequence), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, regAgg+jj) + jj++ + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload != 0 { + regDistinct = regAgg + jj + _sqlite3ExprCodeExprList(tls, pParse, pList, regDistinct, 0, uint8(SQLITE_ECEL_DUP)) + jj += nArg + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbUseSubtype != 0 { + if (*TAggInfo_func)(unsafe.Pointer(pF)).FbOBPayload != 0 { + v4 = regDistinct + } else { + v4 = regAgg + } + regBase = v4 + kk = 0 + for { + if !(kk < nArg) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_GetSubtype), regBase+kk, regAgg+jj) + goto _5 + _5: + ; + kk++ + jj++ + } + } + } else { + if pList != 0 { + nArg = (*TExprList)(unsafe.Pointer(pList)).FnExpr + regAgg = _sqlite3GetTempRange(tls, pParse, nArg) + regDistinct = regAgg + _sqlite3ExprCodeExprList(tls, pParse, pList, regAgg, 0, uint8(SQLITE_ECEL_DUP)) + } else { + nArg = 0 + regAgg = 0 + } + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FiDistinct >= 0 && pList != 0 { + if addrNext == 0 { + addrNext = _sqlite3VdbeMakeLabel(tls, pParse) + } + (*TAggInfo_func)(unsafe.Pointer(pF)).FiDistinct = _codeDistinct(tls, pParse, eDistinctType, (*TAggInfo_func)(unsafe.Pointer(pF)).FiDistinct, addrNext, pList, regDistinct) + } + if (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab >= 0 { + /* Insert a new record into the ORDER BY table */ + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regAgg, regAggSz-int32(1), regAgg+regAggSz-int32(1)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), (*TAggInfo_func)(unsafe.Pointer(pF)).FiOBTab, regAgg+regAggSz-int32(1), regAgg, regAggSz-int32(1)) + _sqlite3ReleaseTempRange(tls, pParse, regAgg, regAggSz) + } else { + /* Invoke the AggStep function */ + if (*TFuncDef)(unsafe.Pointer((*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { + pColl = uintptr(0) + /* pList!=0 if pF->pFunc has NEEDCOLL */ + j = 0 + pItem = pList + 8 + for { + if !(!(pColl != 0) && j < nArg) { + break + } + pColl = _sqlite3ExprCollSeq(tls, pParse, (*TExprList_item)(unsafe.Pointer(pItem)).FpExpr) + goto _6 + _6: + ; + j++ + pItem += 32 + } + if !(pColl != 0) { + pColl = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + if regHit == 0 && (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0 { + v8 = pParse + 56 + *(*int32)(unsafe.Pointer(v8))++ + v7 = *(*int32)(unsafe.Pointer(v8)) + regHit = v7 + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_CollSeq), regHit, 0, 0, pColl, -int32(2)) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_AggStep), 0, regAgg, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+i) + _sqlite3VdbeAppendP4(tls, v, (*TAggInfo_func)(unsafe.Pointer(pF)).FpFunc, -int32(7)) + _sqlite3VdbeChangeP5(tls, v, uint16(uint8(nArg))) + _sqlite3ReleaseTempRange(tls, pParse, regAgg, nArg) + } + if addrNext != 0 { + _sqlite3VdbeResolveLabel(tls, v, addrNext) + } + goto _1 + _1: + ; + i++ + pF += 32 + } + if regHit == 0 && (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0 { + regHit = regAcc + } + if regHit != 0 { + addrHitTest = _sqlite3VdbeAddOp1(tls, v, int32(OP_If), regHit) + } + i = 0 + pC = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator) { + break + } + _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+i) + goto _9 + _9: + ; + i++ + pC += 24 + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) + if addrHitTest != 0 { + _sqlite3VdbeJumpHereOrPopInst(tls, v, addrHitTest) + } +} + +// C documentation +// +// /* +// ** Add a single OP_Explain instruction to the VDBE to explain a simple +// ** count(*) query ("SELECT count(*) FROM pTab"). +// */ +func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bCover int32 + var v1, v2 uintptr + _, _, _ = bCover, v1, v2 + if int32((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { + bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) + if bCover != 0 { + v1 = __ccgo_ts + 20122 + } else { + v1 = __ccgo_ts + 1680 + } + if bCover != 0 { + v2 = (*TIndex)(unsafe.Pointer(pIdx)).FzName + } else { + v2 = __ccgo_ts + 1680 + } + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20145, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) + } +} + +// C documentation +// +// /* +// ** sqlite3WalkExpr() callback used by havingToWhere(). +// ** +// ** If the node passed to the callback is a TK_AND node, return +// ** WRC_Continue to tell sqlite3WalkExpr() to iterate through child nodes. +// ** +// ** Otherwise, return WRC_Prune. In this case, also check if the +// ** sub-expression matches the criteria for being moved to the WHERE +// ** clause. If so, add it to the WHERE clause and replace the sub-expression +// ** within the HAVING expression with a constant "1". +// */ +func _havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var db, pNew, pS, pWhere uintptr + var t TExpr + _, _, _, _, _ = db, pNew, pS, pWhere, t + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AND) { + pS = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + /* This routine is called before the HAVING clause of the current + ** SELECT is analyzed for aggregates. So if pExpr->pAggInfo is set + ** here, it indicates that the expression is a correlated reference to a + ** column from an outer aggregate query, or an aggregate function that + ** belongs to an outer query. Do not move the expression to the WHERE + ** clause in this obscure case, as doing so may corrupt the outer Select + ** statements AggInfo structure. */ + if _sqlite3ExprIsConstantOrGroupBy(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) != 0 && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_IsFalse)) == uint32(EP_IsFalse)) == 0 && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { + db = (*TParse)(unsafe.Pointer((*TWalker)(unsafe.Pointer(pWalker)).FpParse)).Fdb + pNew = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8162) + if pNew != 0 { + pWhere = (*TSelect)(unsafe.Pointer(pS)).FpWhere + t = *(*TExpr)(unsafe.Pointer(pNew)) + *(*TExpr)(unsafe.Pointer(pNew)) = *(*TExpr)(unsafe.Pointer(pExpr)) + *(*TExpr)(unsafe.Pointer(pExpr)) = t + pNew = _sqlite3ExprAnd(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, pWhere, pNew) + (*TSelect)(unsafe.Pointer(pS)).FpWhere = pNew + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(1) + } + } + return int32(WRC_Prune) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Transfer eligible terms from the HAVING clause of a query, which is +// ** processed after grouping, to the WHERE clause, which is processed before +// ** grouping. For example, the query: +// ** +// ** SELECT * FROM WHERE a=? GROUP BY b HAVING b=? AND c=? +// ** +// ** can be rewritten as: +// ** +// ** SELECT * FROM WHERE a=? AND b=? GROUP BY b HAVING c=? +// ** +// ** A term of the HAVING expression is eligible for transfer if it consists +// ** entirely of constants and expressions that are also GROUP BY terms that +// ** use the "BINARY" collation sequence. +// */ +func _havingToWhere(tls *libc.TLS, pParse uintptr, p uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* sWalker at bp+0 */ TWalker + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_havingToWhereExprCb) + *(*uintptr)(unsafe.Pointer(bp + 40)) = p + _sqlite3WalkExpr(tls, bp, (*TSelect)(unsafe.Pointer(p)).FpHaving) +} + +// C documentation +// +// /* +// ** Check to see if the pThis entry of pTabList is a self-join of another view. +// ** Search FROM-clause entries in the range of iFirst..iEnd, including iFirst +// ** but stopping before iEnd. +// ** +// ** If pThis is a self-join, then return the SrcItem for the first other +// ** instance of that view found. If pThis is not a self-join then return 0. +// */ +func _isSelfJoinView(tls *libc.TLS, pTabList uintptr, pThis uintptr, iFirst int32, iEnd int32) (r uintptr) { + var pItem, pS1 uintptr + var v1 int32 + _, _, _ = pItem, pS1, v1 + if (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pThis)).FpSelect)).FselFlags&uint32(SF_PushDown) != 0 { + return uintptr(0) + } + for iFirst < iEnd { + v1 = iFirst + iFirst++ + pItem = pTabList + 8 + uintptr(v1)*104 + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect == uintptr(0) { + continue + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x20>>5)) != 0 { + continue + } + if (*TSrcItem)(unsafe.Pointer(pItem)).FzName == uintptr(0) { + continue + } + if (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FpSchema != (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pThis)).FpTab)).FpSchema { + continue + } + if Xsqlite3_stricmp(tls, (*TSrcItem)(unsafe.Pointer(pItem)).FzName, (*TSrcItem)(unsafe.Pointer(pThis)).FzName) != 0 { + continue + } + pS1 = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect + if (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FpSchema == uintptr(0) && (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pThis)).FpSelect)).FselId != (*TSelect)(unsafe.Pointer(pS1)).FselId { + /* The query flattener left two different CTE tables with identical + ** names in the same FROM clause. */ + continue + } + if (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselFlags&uint32(SF_PushDown) != 0 { + /* The view was modified by some other optimization such as + ** pushDownWhereTerms() */ + continue + } + return pItem + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Deallocate a single AggInfo object +// */ +func _agginfoFree(tls *libc.TLS, db uintptr, pArg uintptr) { + var p uintptr + _ = p + p = pArg + _sqlite3DbFree(tls, db, (*TAggInfo)(unsafe.Pointer(p)).FaCol) + _sqlite3DbFree(tls, db, (*TAggInfo)(unsafe.Pointer(p)).FaFunc) + _sqlite3DbFreeNN(tls, db, p) +} + +// C documentation +// +// /* +// ** Attempt to transform a query of the form +// ** +// ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2) +// ** +// ** Into this: +// ** +// ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) +// ** +// ** The transformation only works if all of the following are true: +// ** +// ** * The subquery is a UNION ALL of two or more terms +// ** * The subquery does not have a LIMIT clause +// ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries +// ** * The outer query is a simple count(*) with no WHERE clause or other +// ** extraneous syntax. +// ** +// ** Return TRUE if the optimization is undertaken. +// */ +func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { + var db, pCount, pExpr, pPrior, pSub, pTerm, v1 uintptr + _, _, _, _, _, _, _ = db, pCount, pExpr, pPrior, pSub, pTerm, v1 + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { + return 0 + } /* This is an aggregate */ + if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr != int32(1) { + return 0 + } /* Single result column */ + if (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 { + return 0 + } + if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { + return 0 + } + if (*TSelect)(unsafe.Pointer(p)).FpGroupBy != 0 { + return 0 + } + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { + return 0 + } + pExpr = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { + return 0 + } /* Result is an aggregate */ + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+15876) != 0 { + return 0 + } /* Is count() */ + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { + return 0 + } /* Must be count(*) */ + if (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc != int32(1) { + return 0 + } /* One table in FROM */ + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + return 0 + } /* Not a window function */ + pSub = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect + if pSub == uintptr(0) { + return 0 + } /* The FROM is a subquery */ + if (*TSelect)(unsafe.Pointer(pSub)).FpPrior == uintptr(0) { + return 0 + } /* Must be a compound */ + if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_CopyCte) != 0 { + return 0 + } /* Not a CTE */ + for cond := true; cond; cond = pSub != 0 { + if int32((*TSelect)(unsafe.Pointer(pSub)).Fop) != int32(TK_ALL) && (*TSelect)(unsafe.Pointer(pSub)).FpPrior != 0 { + return 0 + } /* Must be UNION ALL */ + if (*TSelect)(unsafe.Pointer(pSub)).FpWhere != 0 { + return 0 + } /* No WHERE clause */ + if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 { + return 0 + } /* No LIMIT clause */ + if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_Aggregate) != 0 { + return 0 + } /* Not an aggregate */ + /* Due to the previous */ + pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior /* Repeat over compound */ + } + /* If we reach this point then it is OK to perform the transformation */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pCount = pExpr + pExpr = uintptr(0) + pSub = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect + (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect = uintptr(0) + _sqlite3SrcListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpSrc) + (*TSelect)(unsafe.Pointer(p)).FpSrc = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(112)) + for pSub != 0 { + pPrior = (*TSelect)(unsafe.Pointer(pSub)).FpPrior + (*TSelect)(unsafe.Pointer(pSub)).FpPrior = uintptr(0) + (*TSelect)(unsafe.Pointer(pSub)).FpNext = uintptr(0) + *(*Tu32)(unsafe.Pointer(pSub + 4)) |= uint32(SF_Aggregate) + *(*Tu32)(unsafe.Pointer(pSub + 4)) &= uint32(^libc.Int32FromInt32(SF_Compound)) + (*TSelect)(unsafe.Pointer(pSub)).FnSelectRow = 0 + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), (*TSelect)(unsafe.Pointer(pSub)).FpEList) + if pPrior != 0 { + v1 = _sqlite3ExprDup(tls, db, pCount, 0) + } else { + v1 = pCount + } + pTerm = v1 + (*TSelect)(unsafe.Pointer(pSub)).FpEList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), pTerm) + pTerm = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) + _sqlite3PExprAddSelect(tls, pParse, pTerm, pSub) + if pExpr == uintptr(0) { + pExpr = pTerm + } else { + pExpr = _sqlite3PExpr(tls, pParse, int32(TK_PLUS), pTerm, pExpr) + } + pSub = pPrior + } + (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr = pExpr + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Aggregate)) + return int32(1) +} + +// C documentation +// +// /* +// ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same +// ** as pSrcItem but has the same alias as p0, then return true. +// ** Otherwise return false. +// */ +func _sameSrcAlias(tls *libc.TLS, p0 uintptr, pSrc uintptr) (r int32) { + var i int32 + var p1 uintptr + _, _ = i, p1 + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + p1 = pSrc + 8 + uintptr(i)*104 + if p1 == p0 { + goto _1 + } + if (*TSrcItem)(unsafe.Pointer(p0)).FpTab == (*TSrcItem)(unsafe.Pointer(p1)).FpTab && 0 == Xsqlite3_stricmp(tls, (*TSrcItem)(unsafe.Pointer(p0)).FzAlias, (*TSrcItem)(unsafe.Pointer(p1)).FzAlias) { + return int32(1) + } + if (*TSrcItem)(unsafe.Pointer(p1)).FpSelect != 0 && (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p1)).FpSelect)).FselFlags&uint32(SF_NestedFrom) != uint32(0) && _sameSrcAlias(tls, p0, (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p1)).FpSelect)).FpSrc) != 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Return TRUE (non-zero) if the i-th entry in the pTabList SrcList can +// ** be implemented as a co-routine. The i-th entry is guaranteed to be +// ** a subquery. +// ** +// ** The subquery is implemented as a co-routine if all of the following are +// ** true: +// ** +// ** (1) The subquery will likely be implemented in the outer loop of +// ** the query. This will be the case if any one of the following +// ** conditions hold: +// ** (a) The subquery is the only term in the FROM clause +// ** (b) The subquery is the left-most term and a CROSS JOIN or similar +// ** requires it to be the outer loop +// ** (c) All of the following are true: +// ** (i) The subquery is the left-most subquery in the FROM clause +// ** (ii) There is nothing that would prevent the subquery from +// ** being used as the outer loop if the sqlite3WhereBegin() +// ** routine nominates it to that position. +// ** (iii) The query is not a UPDATE ... FROM +// ** (2) The subquery is not a CTE that should be materialized because +// ** (a) the AS MATERIALIZED keyword is used, or +// ** (b) the CTE is used multiple times and does not have the +// ** NOT MATERIALIZED keyword +// ** (3) The subquery is not part of a left operand for a RIGHT JOIN +// ** (4) The SQLITE_Coroutine optimization disable flag is not set +// ** (5) The subquery is not self-joined +// */ +func _fromClauseTermCanBeCoroutine(tls *libc.TLS, pParse uintptr, pTabList uintptr, i int32, selFlags int32) (r int32) { + var pCteUse, pItem uintptr + _, _ = pCteUse, pItem + pItem = pTabList + 8 + uintptr(i)*104 + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x100>>8)) != 0 { + pCteUse = *(*uintptr)(unsafe.Pointer(pItem + 96)) + if int32((*TCteUse)(unsafe.Pointer(pCteUse)).FeM10d) == M10d_Yes { + return 0 + } /* (2a) */ + if (*TCteUse)(unsafe.Pointer(pCteUse)).FnUse >= int32(2) && int32((*TCteUse)(unsafe.Pointer(pCteUse)).FeM10d) != int32(M10d_No) { + return 0 + } /* (2b) */ + } + if int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + return 0 + } /* (3) */ + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Coroutines)) != uint32(0) { + return 0 + } /* (4) */ + if _isSelfJoinView(tls, pTabList, pItem, i+int32(1), (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) != uintptr(0) { + return 0 /* (5) */ + } + if i == 0 { + if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc == int32(1) { + return int32(1) + } /* (1a) */ + if int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + 1*104))).Ffg.Fjointype)&int32(JT_CROSS) != 0 { + return int32(1) + } /* (1b) */ + if selFlags&int32(SF_UpdateFrom) != 0 { + return 0 + } /* (1c-iii) */ + return int32(1) + } + if selFlags&int32(SF_UpdateFrom) != 0 { + return 0 + } /* (1c-iii) */ + for int32(1) != 0 { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_CROSS)) != 0 { + return 0 + } /* (1c-ii) */ + if i == 0 { + break + } + i-- + pItem -= 104 + if (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect != uintptr(0) { + return 0 + } /* (1c-i) */ + } + return int32(1) +} + +// C documentation +// +// /* +// ** Generate code for the SELECT statement given in the p argument. +// ** +// ** The results are returned according to the SelectDest structure. +// ** See comments in sqliteInt.h for further information. +// ** +// ** This routine returns the number of errors. If any errors are +// ** encountered, then an appropriate error message is left in +// ** pParse->zErrMsg. +// ** +// ** This routine does NOT free the Select structure passed in. The +// ** calling function needs to do that. +// */ +func _sqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) { + bp := tls.Alloc(208) + defer tls.Free(208) + var addr1, addrEnd, addrGosub, addrOutputRow, addrReset, addrSetAbort, addrSortingIdx, addrTop, addrTopOfLoop, eDist, eDist1, groupBySort, i, iAMem, iAbortFlag, iBMem, iBreak, iCont, iCsr, iDb, iEnd, iUseFlag, ii, ii1, isAgg, j, k, nCol, nGroupBy, onceAddr, orderByGrp, rc, regAcc, regBase, regGosub, regOutputRow, regRecord, regReset, sortOut, sortPTab, topAddr, v11, v14, v17, v22, v24, v25, v30, v31, v32, v34, v36, v38, v40, v42, v43, v47, v48, v52, v56, v58 int32 + var db, p0, pAggInfo, pBest, pCol, pCteUse, pCteUse1, pDistinct, pDistinct1, pEList, pExpr, pF, pF1, pGroupBy, pHaving, pI2, pIdx, pItem, pItem1, pItem2, pKeyInfo, pKeyInfo1, pKeyInfo2, pPrior, pSub, pSub1, pTab, pTab1, pTabList, pWInfo, pWhere, pWin, v, zSavedAuthContext, v1, v12, v13, v15, v16, v18, v23, v26, v33, v35, v37, v39, v41, v44, v49, v51, v53, v57, p21, p3, p4, p6, p7, p9 uintptr + var distFlag, distFlag1, wctrlFlags Tu16 + var iRoot TPgno + var minMaxFlag, sortFlags Tu8 + var _ /* dest at bp+72 */ TSelectDest + var _ /* pMinMaxOrderBy at bp+64 */ uintptr + var _ /* sDistinct at bp+0 */ TDistinctCtx + var _ /* sNC at bp+112 */ TNameContext + var _ /* sSort at bp+16 */ TSortCtx + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr1, addrEnd, addrGosub, addrOutputRow, addrReset, addrSetAbort, addrSortingIdx, addrTop, addrTopOfLoop, db, distFlag, distFlag1, eDist, eDist1, groupBySort, i, iAMem, iAbortFlag, iBMem, iBreak, iCont, iCsr, iDb, iEnd, iRoot, iUseFlag, ii, ii1, isAgg, j, k, minMaxFlag, nCol, nGroupBy, onceAddr, orderByGrp, p0, pAggInfo, pBest, pCol, pCteUse, pCteUse1, pDistinct, pDistinct1, pEList, pExpr, pF, pF1, pGroupBy, pHaving, pI2, pIdx, pItem, pItem1, pItem2, pKeyInfo, pKeyInfo1, pKeyInfo2, pPrior, pSub, pSub1, pTab, pTab1, pTabList, pWInfo, pWhere, pWin, rc, regAcc, regBase, regGosub, regOutputRow, regRecord, regReset, sortFlags, sortOut, sortPTab, topAddr, v, wctrlFlags, zSavedAuthContext, v1, v11, v12, v13, v14, v15, v16, v17, v18, v22, v23, v24, v25, v26, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v47, v48, v49, v51, v52, v53, v56, v57, v58, p21, p3, p4, p6, p7, p9 /* True for select lists like "count(*)" */ + pEList = uintptr(0) /* The HAVING clause. May be NULL */ + pAggInfo = uintptr(0) /* Aggregate information */ + rc = int32(1) /* The database connection */ + *(*uintptr)(unsafe.Pointer(bp + 64)) = uintptr(0) /* Flag for min/max queries */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + v = _sqlite3GetVdbe(tls, pParse) + if p == uintptr(0) || (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return int32(1) + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_SELECT), uintptr(0), uintptr(0), uintptr(0)) != 0 { + return int32(1) + } + if int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) <= int32(SRT_DistQueue) { + /* All of these destinations are also able to ignore the ORDER BY clause */ + if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + } + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Distinct)) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_NoopOrderBy) + } + _sqlite3SelectPrep(tls, pParse, p, uintptr(0)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto select_end + } + /* If the SF_UFSrcCheck flag is set, then this function is being called + ** as part of populating the temp table for an UPDATE...FROM statement. + ** In this case, it is an error if the target object (pSrc->a[0]) name + ** or alias is duplicated within FROM clause (pSrc->a[1..n]). + ** + ** Postgres disallows this case too. The reason is that some other + ** systems handle this case differently, and not all the same way, + ** which is just confusing. To avoid this, we follow PG's lead and + ** disallow it altogether. */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_UFSrcCheck) != 0 { + p0 = (*TSelect)(unsafe.Pointer(p)).FpSrc + 8 + if _sameSrcAlias(tls, p0, (*TSelect)(unsafe.Pointer(p)).FpSrc) != 0 { + if (*TSrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { + v1 = (*TSrcItem)(unsafe.Pointer(p0)).FzAlias + } else { + v1 = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(p0)).FpTab)).FzName + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20157, libc.VaList(bp+176, v1)) + goto select_end + } + /* Clear the SF_UFSrcCheck flag. The check has already been performed, + ** and leaving this flag set can cause errors if a compound sub-query + ** in p->pSrc is flattened into this query and this function called + ** again as part of compound SELECT processing. */ + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_UFSrcCheck)) + } + if int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) == int32(SRT_Output) { + _sqlite3GenerateColumnNames(tls, pParse, p) + } + if _sqlite3WindowRewrite(tls, pParse, p) != 0 { + goto select_end + } + pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc + isAgg = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) != uint32(0)) + libc.Xmemset(tls, bp+16, 0, uint64(48)) + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + /* Try to do various optimizations (flattening subqueries, and strength + ** reduction of join operators) in the FROM clause up into the main query + */ + i = 0 + for { + if !(!((*TSelect)(unsafe.Pointer(p)).FpPrior != 0) && i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + pItem = pTabList + 8 + uintptr(i)*104 + pSub = (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + /* The expander should have already created transient Table objects + ** even for FROM clause elements such as subqueries that do not correspond + ** to a real table */ + /* Try to simplify joins: + ** + ** LEFT JOIN -> JOIN + ** RIGHT JOIN -> JOIN + ** FULL JOIN -> RIGHT JOIN + ** + ** If terms of the i-th table are used in the WHERE clause in such a + ** way that the i-th table cannot be the NULL row of a join, then + ** perform the appropriate simplification. This is called + ** "OUTER JOIN strength reduction" in the SQLite documentation. + */ + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) != 0 && _sqlite3ExprImpliesNonNullRow(tls, (*TSelect)(unsafe.Pointer(p)).FpWhere, (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor, int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LTORJ)) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_SimplifyJoin)) == uint32(0) { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_RIGHT) != 0 { + p3 = pItem + 60 + *(*Tu8)(unsafe.Pointer(p3)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(JT_LEFT)) + } else { + p4 = pItem + 60 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) & ^(libc.Int32FromInt32(JT_LEFT) | libc.Int32FromInt32(JT_OUTER))) + _unsetJoinExpr(tls, (*TSelect)(unsafe.Pointer(p)).FpWhere, (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor, 0) + } + } + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + j = i + int32(1) + for { + if !(j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + pI2 = pTabList + 8 + uintptr(j)*104 + if int32((*TSrcItem)(unsafe.Pointer(pI2)).Ffg.Fjointype)&int32(JT_RIGHT) != 0 { + if int32((*TSrcItem)(unsafe.Pointer(pI2)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { + p6 = pI2 + 60 + *(*Tu8)(unsafe.Pointer(p6)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p6))) & ^libc.Int32FromInt32(JT_RIGHT)) + } else { + p7 = pI2 + 60 + *(*Tu8)(unsafe.Pointer(p7)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p7))) & ^(libc.Int32FromInt32(JT_RIGHT) | libc.Int32FromInt32(JT_OUTER))) + _unsetJoinExpr(tls, (*TSelect)(unsafe.Pointer(p)).FpWhere, (*TSrcItem)(unsafe.Pointer(pI2)).FiCursor, int32(1)) + } + } + goto _5 + _5: + ; + j++ + } + j = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc - int32(1) + for { + if !(j >= 0) { + break + } + p9 = pTabList + 8 + uintptr(j)*104 + 60 + *(*Tu8)(unsafe.Pointer(p9)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p9))) & ^libc.Int32FromInt32(JT_LTORJ)) + if int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*104))).Ffg.Fjointype)&int32(JT_RIGHT) != 0 { + break + } + goto _8 + _8: + ; + j-- + } + } + } + /* No further action if this term of the FROM clause is not a subquery */ + if pSub == uintptr(0) { + goto _2 + } + /* Catch mismatch in the declared columns of a view and the number of + ** columns in the SELECT on the RHS */ + if int32((*TTable)(unsafe.Pointer(pTab)).FnCol) != (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20211, libc.VaList(bp+176, int32((*TTable)(unsafe.Pointer(pTab)).FnCol), (*TTable)(unsafe.Pointer(pTab)).FzName, (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + goto select_end + } + /* Do not attempt the usual optimizations (flattening and ORDER BY + ** elimination) on a MATERIALIZED common table expression because + ** a MATERIALIZED common table expression is an optimization fence. + */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x100>>8)) != 0 && int32((*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem + 96)))).FeM10d) == M10d_Yes { + goto _2 + } + /* Do not try to flatten an aggregate subquery. + ** + ** Flattening an aggregate subquery is only possible if the outer query + ** is not a join. But if the outer query is not a join, then the subquery + ** will be implemented as a co-routine and there is no advantage to + ** flattening in that case. + */ + if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_Aggregate) != uint32(0) { + goto _2 + } + /* If a FROM-clause subquery has an ORDER BY clause that is not + ** really doing anything, then delete it now so that it does not + ** interfere with query flattening. See the discussion at + ** https://sqlite.org/forum/forumpost/2d76f2bcf65d256a + ** + ** Beware of these cases where the ORDER BY clause may not be safely + ** omitted: + ** + ** (1) There is also a LIMIT clause + ** (2) The subquery was added to help with window-function + ** processing + ** (3) The subquery is in the FROM clause of an UPDATE + ** (4) The outer query uses an aggregate function other than + ** the built-in count(), min(), or max(). + ** (5) The ORDER BY isn't going to accomplish anything because + ** one of: + ** (a) The outer query has a different ORDER BY clause + ** (b) The subquery is part of a join + ** See forum post 062d576715d277c8 + ** + ** Also retain the ORDER BY if the OmitOrderBy optimization is disabled. + */ + if (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != uintptr(0) && ((*TSelect)(unsafe.Pointer(p)).FpOrderBy != uintptr(0) || (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(1)) && (*TSelect)(unsafe.Pointer(pSub)).FpLimit == uintptr(0) && (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_OrderByReqd) == uint32(0) && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_OrderByReqd) == uint32(0) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OmitOrderBy)) == uint32(0) { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy) + (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy = uintptr(0) + } + /* If the outer query contains a "complex" result set (that is, + ** if the result set of the outer query uses functions or subqueries) + ** and if the subquery contains an ORDER BY clause and if + ** it will be implemented as a co-routine, then do not flatten. This + ** restriction allows SQL constructs like this: + ** + ** SELECT expensive_function(x) + ** FROM (SELECT x FROM tab ORDER BY y LIMIT 10); + ** + ** The expensive_function() is only computed on the 10 rows that + ** are output, rather than every row of the table. + ** + ** The requirement that the outer query have a complex result set + ** means that flattening does occur on simpler SQL constraints without + ** the expensive_function() like: + ** + ** SELECT x FROM (SELECT x FROM tab ORDER BY y LIMIT 10); + */ + if (*TSelect)(unsafe.Pointer(pSub)).FpOrderBy != uintptr(0) && i == 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_ComplexResult) != uint32(0) && ((*TSrcList)(unsafe.Pointer(pTabList)).FnSrc == int32(1) || int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + 1*104))).Ffg.Fjointype)&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_CROSS)) != 0) { + goto _2 + } + if _flattenSubquery(tls, pParse, p, i, isAgg) != 0 { + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto select_end + } + /* This subquery can be absorbed into its parent. */ + i = -int32(1) + } + pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto select_end + } + if !(int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) <= libc.Int32FromInt32(SRT_Fifo)) { + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + } + goto _2 + _2: + ; + i++ + } + /* Handle compound SELECT statements using the separate multiSelect() + ** procedure. + */ + if (*TSelect)(unsafe.Pointer(p)).FpPrior != 0 { + rc = _multiSelect(tls, pParse, p, pDest) + if (*TSelect)(unsafe.Pointer(p)).FpNext == uintptr(0) { + _sqlite3VdbeExplainPop(tls, pParse) + } + return rc + } + /* Do the WHERE-clause constant propagation optimization if this is + ** a join. No need to speed time on this operation for non-join queries + ** as the equivalent optimization will be handled by query planner in + ** sqlite3WhereBegin(). + */ + if (*TSelect)(unsafe.Pointer(p)).FpWhere != uintptr(0) && int32((*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpWhere)).Fop) == int32(TK_AND) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_PropagateConst)) == uint32(0) && _propagateConstants(tls, pParse, p) != 0 { + } else { + } + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_QueryFlattener)|libc.Int32FromInt32(SQLITE_CountOfView)) == uint32(0) && _countOfViewOptimization(tls, pParse, p) != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto select_end + } + pTabList = (*TSelect)(unsafe.Pointer(p)).FpSrc + } + /* For each term in the FROM clause, do two things: + ** (1) Authorized unreferenced tables + ** (2) Generate code for all sub-queries + */ + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + pItem1 = pTabList + 8 + uintptr(i)*104 + /* Issue SQLITE_READ authorizations with a fake column name for any + ** tables that are referenced but from which no values are extracted. + ** Examples of where these kinds of null SQLITE_READ authorizations + ** would occur: + ** + ** SELECT count(*) FROM t1; -- SQLITE_READ t1."" + ** SELECT t1.* FROM t1, t2; -- SQLITE_READ t2."" + ** + ** The fake column name is an empty string. It is possible for a table to + ** have a column named by the empty string, in which case there is no way to + ** distinguish between an unreferenced table and an actual reference to the + ** "" column. The original design was for the fake column name to be a NULL, + ** which would be unambiguous. But legacy authorization callbacks might + ** assume the column name is non-NULL and segfault. The use of an empty + ** string for the fake column name seems safer. + */ + if (*TSrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0) && (*TSrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0) { + _sqlite3AuthCheck(tls, pParse, int32(SQLITE_READ), (*TSrcItem)(unsafe.Pointer(pItem1)).FzName, __ccgo_ts+1680, (*TSrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + } + /* Generate code for all sub-queries in the FROM clause + */ + pSub1 = (*TSrcItem)(unsafe.Pointer(pItem1)).FpSelect + if pSub1 == uintptr(0) { + goto _10 + } + /* The code for a subquery should only be generated once. */ + /* Increment Parse.nHeight by the height of the largest expression + ** tree referred to by this, the parent select. The child select + ** may contain expression trees of at most + ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit + ** more conservative than necessary, but much easier than enforcing + ** an exact limit. + */ + *(*int32)(unsafe.Pointer(pParse + 316)) += _sqlite3SelectExprHeight(tls, p) + /* Make copies of constant WHERE-clause terms in the outer query down + ** inside the subquery. This can help the subquery to run more efficiently. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_PushDown)) == uint32(0) && (int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x100>>8)) == 0 || int32((*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 96)))).FeM10d) != M10d_Yes && (*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 96)))).FnUse < int32(2)) && _pushDownWhereTerms(tls, pParse, pSub1, (*TSelect)(unsafe.Pointer(p)).FpWhere, pTabList, i) != 0 { + } else { + } + /* Convert unused result columns of the subquery into simple NULL + ** expressions, to avoid unneeded searching and computation. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_NullUnusedCols)) == uint32(0) && _disableUnusedSubqueryResultColumns(tls, pItem1) != 0 { + } + zSavedAuthContext = (*TParse)(unsafe.Pointer(pParse)).FzAuthContext + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = (*TSrcItem)(unsafe.Pointer(pItem1)).FzName + /* Generate code to implement the subquery + */ + if _fromClauseTermCanBeCoroutine(tls, pParse, pTabList, i, int32((*TSelect)(unsafe.Pointer(p)).FselFlags)) != 0 { + /* Implement a co-routine that will return a single row of the result + ** set on each invocation. + */ + addrTop = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn = v11 + _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) + (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop + _sqlite3SelectDestInit(tls, bp+72, int32(SRT_Coroutine), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20251, libc.VaList(bp+176, pItem1)) + _sqlite3Select(tls, pParse, pSub1, bp+72) + (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow + libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 5, 0x20) + (*TSrcItem)(unsafe.Pointer(pItem1)).FregResult = (*(*TSelectDest)(unsafe.Pointer(bp + 72))).FiSdst + _sqlite3VdbeEndCoroutine(tls, v, (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn) + _sqlite3VdbeJumpHere(tls, v, addrTop-int32(1)) + _sqlite3ClearTempRegCache(tls, pParse) + } else { + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x100>>8)) != 0 && (*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 96)))).FaddrM9e > 0 { + /* This is a CTE for which materialization code has already been + ** generated. Invoke the subroutine to compute the materialization, + ** the make the pItem->iCursor be a copy of the ephemeral table that + ** holds the result of the materialization. */ + pCteUse = *(*uintptr)(unsafe.Pointer(pItem1 + 96)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TCteUse)(unsafe.Pointer(pCteUse)).FregRtn, (*TCteUse)(unsafe.Pointer(pCteUse)).FaddrM9e) + if (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor != (*TCteUse)(unsafe.Pointer(pCteUse)).FiCur { + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor, (*TCteUse)(unsafe.Pointer(pCteUse)).FiCur) + } + (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow = (*TCteUse)(unsafe.Pointer(pCteUse)).FnRowEst + } else { + v13 = _isSelfJoinView(tls, pTabList, pItem1, 0, i) + pPrior = v13 + if v13 != uintptr(0) { + /* This view has already been materialized by a prior entry in + ** this same FROM clause. Reuse it. */ + if (*TSrcItem)(unsafe.Pointer(pPrior)).FaddrFillSub != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSrcItem)(unsafe.Pointer(pPrior)).FregReturn, (*TSrcItem)(unsafe.Pointer(pPrior)).FaddrFillSub) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor, (*TSrcItem)(unsafe.Pointer(pPrior)).FiCursor) + (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow = (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pPrior)).FpSelect)).FnSelectRow + } else { + onceAddr = 0 + v15 = pParse + 56 + *(*int32)(unsafe.Pointer(v15))++ + v14 = *(*int32)(unsafe.Pointer(v15)) + (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn = v14 + topAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) + (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = topAddr + int32(1) + libc.SetBitFieldPtr16Uint32(pItem1+60+4, libc.Uint32FromInt32(1), 4, 0x10) + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x8>>3)) == 0 { + /* If the subquery is not correlated and if we are not inside of + ** a trigger, then we only need to compute the value of the subquery + ** once. */ + onceAddr = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } else { + } + _sqlite3SelectDestInit(tls, bp+72, int32(SRT_EphemTab), (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+20266, libc.VaList(bp+176, pItem1)) + _sqlite3Select(tls, pParse, pSub1, bp+72) + (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow + if onceAddr != 0 { + _sqlite3VdbeJumpHere(tls, v, onceAddr) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Return), (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn, topAddr+int32(1)) + _sqlite3VdbeJumpHere(tls, v, topAddr) + _sqlite3ClearTempRegCache(tls, pParse) + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x100>>8)) != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pItem1 + 60 + 4))&0x8>>3)) == 0 { + pCteUse1 = *(*uintptr)(unsafe.Pointer(pItem1 + 96)) + (*TCteUse)(unsafe.Pointer(pCteUse1)).FaddrM9e = (*TSrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub + (*TCteUse)(unsafe.Pointer(pCteUse1)).FregRtn = (*TSrcItem)(unsafe.Pointer(pItem1)).FregReturn + (*TCteUse)(unsafe.Pointer(pCteUse1)).FiCur = (*TSrcItem)(unsafe.Pointer(pItem1)).FiCursor + (*TCteUse)(unsafe.Pointer(pCteUse1)).FnRowEst = (*TSelect)(unsafe.Pointer(pSub1)).FnSelectRow + } + } + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto select_end + } + *(*int32)(unsafe.Pointer(pParse + 316)) -= _sqlite3SelectExprHeight(tls, p) + (*TParse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext + goto _10 + _10: + ; + i++ + } + /* Various elements of the SELECT copied into local variables for + ** convenience */ + pEList = (*TSelect)(unsafe.Pointer(p)).FpEList + pWhere = (*TSelect)(unsafe.Pointer(p)).FpWhere + pGroupBy = (*TSelect)(unsafe.Pointer(p)).FpGroupBy + pHaving = (*TSelect)(unsafe.Pointer(p)).FpHaving + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct = libc.BoolUint8((*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) != uint32(0)) + /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and + ** if the select-list is the same as the ORDER BY list, then this query + ** can be rewritten as a GROUP BY. In other words, this: + ** + ** SELECT DISTINCT xyz FROM ... ORDER BY xyz + ** + ** is transformed to: + ** + ** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz + ** + ** The second form is preferred as a single index (or temp-table) may be + ** used for both the ORDER BY and DISTINCT processing. As originally + ** written the query must use a temp-table for at least one of the ORDER + ** BY and DISTINCT, and an index or separate temp-table for the other. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) == uint32(SF_Distinct) && _sqlite3ExprListCompare(tls, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, pEList, -int32(1)) == 0 && (*TSelect)(unsafe.Pointer(p)).FpWin == uintptr(0) { + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Distinct)) + v16 = _sqlite3ExprListDup(tls, db, pEList, 0) + (*TSelect)(unsafe.Pointer(p)).FpGroupBy = v16 + pGroupBy = v16 + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_Aggregate) + /* Notice that even thought SF_Distinct has been cleared from p->selFlags, + ** the sDistinct.isTnct is still set. Hence, isTnct represents the + ** original setting of the SF_Distinct flag, not the current setting */ + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct = uint8(2) + } + /* If there is an ORDER BY clause, then create an ephemeral index to + ** do the sorting. But this sorting ephemeral index might end up + ** being unused if the data can be extracted in pre-sorted order. + ** If that is the case, then the OP_OpenEphemeral instruction will be + ** changed to an OP_Noop once we figure out that the sorting index is + ** not needed. The sSort.addrSortIndex variable is used to facilitate + ** that change. + */ + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy != 0 { + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, 0, (*TExprList)(unsafe.Pointer(pEList)).FnExpr) + v18 = pParse + 52 + v17 = *(*int32)(unsafe.Pointer(v18)) + *(*int32)(unsafe.Pointer(v18))++ + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FiECursor = v17 + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FiECursor, (*TExprList)(unsafe.Pointer((*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy)).FnExpr+int32(1)+(*TExprList)(unsafe.Pointer(pEList)).FnExpr, 0, pKeyInfo, -int32(8)) + } else { + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex = -int32(1) + } + /* If the output is destined for a temporary table, open that table. + */ + if int32((*TSelectDest)(unsafe.Pointer(pDest)).FeDest) == int32(SRT_EphemTab) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TSelectDest)(unsafe.Pointer(pDest)).FiSDParm, (*TExprList)(unsafe.Pointer(pEList)).FnExpr) + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_NestedFrom) != 0 { + ii = (*TExprList)(unsafe.Pointer(pEList)).FnExpr - int32(1) + for { + if !(ii > 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32 + 16 + 4))&0x40>>6)) == 0) { + break + } + _sqlite3ExprDelete(tls, db, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32))).FpExpr) + _sqlite3DbFree(tls, db, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32))).FzEName) + (*TExprList)(unsafe.Pointer(pEList)).FnExpr-- + goto _19 + _19: + ; + ii-- + } + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32 + 16 + 4))&0x40>>6)) == 0 { + (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(ii)*32))).FpExpr)).Fop = uint8(TK_NULL) + } + goto _20 + _20: + ; + ii++ + } + } + } + /* Set the limiter. + */ + iEnd = _sqlite3VdbeMakeLabel(tls, pParse) + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_FixedLimit) == uint32(0) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(320) /* 4 billion rows */ + } + if (*TSelect)(unsafe.Pointer(p)).FpLimit != 0 { + _computeLimitRegisters(tls, pParse, p, iEnd) + } + if (*TSelect)(unsafe.Pointer(p)).FiLimit == 0 && (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex >= 0 { + _sqlite3VdbeChangeOpcode(tls, v, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex, uint8(OP_SorterOpen)) + p21 = bp + 16 + 36 + *(*Tu8)(unsafe.Pointer(p21)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p21))) | libc.Int32FromInt32(SORTFLAG_UseSorter)) + } + /* Open an ephemeral index to use for the distinct set. + */ + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) != 0 { + v23 = pParse + 52 + v22 = *(*int32)(unsafe.Pointer(v23)) + *(*int32)(unsafe.Pointer(v23))++ + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FtabTnct = v22 + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FaddrTnct = _sqlite3VdbeAddOp4(tls, v, int32(OP_OpenEphemeral), (*(*TDistinctCtx)(unsafe.Pointer(bp))).FtabTnct, 0, 0, _sqlite3KeyInfoFromExprList(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpEList, 0, 0), -int32(8)) + _sqlite3VdbeChangeP5(tls, v, uint16(BTREE_UNORDERED)) + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType = uint8(WHERE_DISTINCT_UNORDERED) + } else { + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType = uint8(WHERE_DISTINCT_NOOP) + } + if !(isAgg != 0) && pGroupBy == uintptr(0) { + if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 { + v24 = int32(WHERE_WANT_DISTINCT) + } else { + v24 = 0 + } + /* No aggregate functions and no GROUP BY clause */ + wctrlFlags = uint16(uint32(v24) | (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_FixedLimit)) + pWin = (*TSelect)(unsafe.Pointer(p)).FpWin /* Main window object (or NULL) */ + if pWin != 0 { + _sqlite3WindowCodeInit(tls, pParse, p) + } + /* Begin the database scan. */ + pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, (*TSelect)(unsafe.Pointer(p)).FpEList, p, wctrlFlags, int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow)) + if pWInfo == uintptr(0) { + goto select_end + } + if int32(_sqlite3WhereOutputRowCount(tls, pWInfo)) < int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = _sqlite3WhereOutputRowCount(tls, pWInfo) + } + if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && _sqlite3WhereIsDistinct(tls, pWInfo) != 0 { + (*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType = uint8(_sqlite3WhereIsDistinct(tls, pWInfo)) + } + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy != 0 { + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FnOBSat = _sqlite3WhereIsOrdered(tls, pWInfo) + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FlabelOBLopt = _sqlite3WhereOrderByLimitOptLabel(tls, pWInfo) + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FnOBSat == (*TExprList)(unsafe.Pointer((*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy)).FnExpr { + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy = uintptr(0) + } + } + /* If sorting index that was created by a prior OP_OpenEphemeral + ** instruction ended up not being needed, then change the OP_OpenEphemeral + ** into an OP_Noop. + */ + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex >= 0 && (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy == uintptr(0) { + _sqlite3VdbeChangeToNoop(tls, v, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex) + } + if pWin != 0 { + addrGosub = _sqlite3VdbeMakeLabel(tls, pParse) + iCont = _sqlite3VdbeMakeLabel(tls, pParse) + iBreak = _sqlite3VdbeMakeLabel(tls, pParse) + v26 = pParse + 56 + *(*int32)(unsafe.Pointer(v26))++ + v25 = *(*int32)(unsafe.Pointer(v26)) + regGosub = v25 + _sqlite3WindowCodeStep(tls, pParse, p, pWInfo, regGosub, addrGosub) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, iBreak) + _sqlite3VdbeResolveLabel(tls, v, addrGosub) + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FlabelOBLopt = 0 + _selectInnerLoop(tls, pParse, p, -int32(1), bp+16, bp, pDest, iCont, iBreak) + _sqlite3VdbeResolveLabel(tls, v, iCont) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regGosub) + _sqlite3VdbeResolveLabel(tls, v, iBreak) + } else { + /* Use the standard inner loop. */ + _selectInnerLoop(tls, pParse, p, -int32(1), bp+16, bp, pDest, _sqlite3WhereContinueLabel(tls, pWInfo), _sqlite3WhereBreakLabel(tls, pWInfo)) + /* End the database scan loop. + */ + _sqlite3WhereEnd(tls, pWInfo) + } + } else { /* End of processing for this SELECT */ + sortPTab = 0 /* Pseudotable used to decode sorting results */ + sortOut = 0 /* Output register from the sorter */ + orderByGrp = 0 /* True if the GROUP BY and ORDER BY are the same */ + /* Remove any and all aliases between the result set and the + ** GROUP BY clause. + */ + if pGroupBy != 0 { /* For looping over expression in a list */ + k = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr + pItem2 = (*TSelect)(unsafe.Pointer(p)).FpEList + 8 + for { + if !(k > 0) { + break + } + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) + goto _27 + _27: + ; + k-- + pItem2 += 32 + } + k = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr + pItem2 = pGroupBy + 8 + for { + if !(k > 0) { + break + } + (*(*struct { + FiOrderByCol Tu16 + FiAlias Tu16 + })(unsafe.Pointer(pItem2 + 24))).FiAlias = uint16(0) + goto _28 + _28: + ; + k-- + pItem2 += 32 + } + if int32((*TSelect)(unsafe.Pointer(p)).FnSelectRow) > int32(66) { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(66) + } + /* If there is both a GROUP BY and an ORDER BY clause and they are + ** identical, then it may be possible to disable the ORDER BY clause + ** on the grounds that the GROUP BY will cause elements to come out + ** in the correct order. It also may not - the GROUP BY might use a + ** database index that causes rows to be grouped together as required + ** but not actually sorted. Either way, record the fact that the + ** ORDER BY and GROUP BY clauses are the same by setting the orderByGrp + ** variable. */ + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy != 0 && (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr == (*TExprList)(unsafe.Pointer((*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy)).FnExpr { + /* The GROUP BY processing doesn't care whether rows are delivered in + ** ASC or DESC order - only that each group is returned contiguously. + ** So set the ASC/DESC flags in the GROUP BY to match those in the + ** ORDER BY to maximize the chances of rows being delivered in an + ** order that makes the ORDER BY redundant. */ + ii1 = 0 + for { + if !(ii1 < (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + break + } + sortFlags = uint8(int32((*(*TExprList_item)(unsafe.Pointer((*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags) & int32(KEYINFO_ORDER_DESC)) + (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(ii1)*32))).Ffg.FsortFlags = sortFlags + goto _29 + _29: + ; + ii1++ + } + if _sqlite3ExprListCompare(tls, pGroupBy, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy, -int32(1)) == 0 { + orderByGrp = int32(1) + } + } + } else { + (*TSelect)(unsafe.Pointer(p)).FnSelectRow = 0 + } + /* Create a label to jump to when we want to abort the query */ + addrEnd = _sqlite3VdbeMakeLabel(tls, pParse) + /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in + ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the + ** SELECT statement. + */ + pAggInfo = _sqlite3DbMallocZero(tls, db, uint64(56)) + if pAggInfo != 0 { + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_agginfoFree), pAggInfo) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto select_end + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FselId = (*TSelect)(unsafe.Pointer(p)).FselId + libc.Xmemset(tls, bp+112, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 112))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp + 112))).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 112 + 16)) = pAggInfo + if pGroupBy != 0 { + v30 = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr + } else { + v30 = 0 + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = uint16(v30) + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy = pGroupBy + _sqlite3ExprAnalyzeAggList(tls, bp+112, pEList) + _sqlite3ExprAnalyzeAggList(tls, bp+112, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy) + if pHaving != 0 { + if pGroupBy != 0 { + _havingToWhere(tls, pParse, p) + pWhere = (*TSelect)(unsafe.Pointer(p)).FpWhere + } + _sqlite3ExprAnalyzeAggregates(tls, bp+112, pHaving) + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn + if (*TSelect)(unsafe.Pointer(p)).FpGroupBy == uintptr(0) && (*TSelect)(unsafe.Pointer(p)).FpHaving == uintptr(0) && (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == int32(1) { + minMaxFlag = _minMaxQuery(tls, db, (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr, bp+64) + } else { + minMaxFlag = uint8(WHERE_ORDERBY_NORMAL) + } + _analyzeAggFuncArgs(tls, pAggInfo, bp+112) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto select_end + } + /* Processing for aggregates with GROUP BY is very different and + ** much more complex than aggregates without a GROUP BY. + */ + if pGroupBy != 0 { /* Return address register for reset subroutine */ + pDistinct = uintptr(0) + distFlag = uint16(0) + eDist = WHERE_DISTINCT_NOOP + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == int32(1) && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FiDistinct >= 0 && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr != uintptr(0) && (*TExpr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr)).Fflags&uint32(EP_xIsSelect) == uint32(0) && *(*uintptr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr + 32)) != uintptr(0) { + pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr + 32)) + 8))).FpExpr + pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) + pDistinct = _sqlite3ExprListDup(tls, db, pGroupBy, 0) + pDistinct = _sqlite3ExprListAppend(tls, pParse, pDistinct, pExpr) + if pDistinct != 0 { + v31 = libc.Int32FromInt32(WHERE_WANT_DISTINCT) | libc.Int32FromInt32(WHERE_AGG_DISTINCT) + } else { + v31 = 0 + } + distFlag = uint16(v31) + } + /* If there is a GROUP BY clause we might need a sorting index to + ** implement it. Allocate that sorting index now. If it turns out + ** that we do not need it after all, the OP_SorterOpen instruction + ** will be converted into a Noop. + */ + v33 = pParse + 52 + v32 = *(*int32)(unsafe.Pointer(v33)) + *(*int32)(unsafe.Pointer(v33))++ + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx = v32 + pKeyInfo1 = _sqlite3KeyInfoFromExprList(tls, pParse, pGroupBy, 0, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) + addrSortingIdx = _sqlite3VdbeAddOp4(tls, v, int32(OP_SorterOpen), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, int32((*TAggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn), 0, pKeyInfo1, -int32(8)) + /* Initialize memory locations used by GROUP BY aggregate processing + */ + v35 = pParse + 56 + *(*int32)(unsafe.Pointer(v35))++ + v34 = *(*int32)(unsafe.Pointer(v35)) + iUseFlag = v34 + v37 = pParse + 56 + *(*int32)(unsafe.Pointer(v37))++ + v36 = *(*int32)(unsafe.Pointer(v37)) + iAbortFlag = v36 + v39 = pParse + 56 + *(*int32)(unsafe.Pointer(v39))++ + v38 = *(*int32)(unsafe.Pointer(v39)) + regOutputRow = v38 + addrOutputRow = _sqlite3VdbeMakeLabel(tls, pParse) + v41 = pParse + 56 + *(*int32)(unsafe.Pointer(v41))++ + v40 = *(*int32)(unsafe.Pointer(v41)) + regReset = v40 + addrReset = _sqlite3VdbeMakeLabel(tls, pParse) + iAMem = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr + iBMem = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, iAbortFlag) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, iAMem, iAMem+(*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr-int32(1)) + /* Begin a loop that will extract all source rows in GROUP BY order. + ** This might involve two separate loops with an OP_Sort in between, or + ** it might be a single loop that uses an index to extract information + ** in the right order to begin with. + */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regReset, addrReset) + if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct) == int32(2) { + v42 = int32(WHERE_DISTINCTBY) + } else { + v42 = int32(WHERE_GROUPBY) + } + if orderByGrp != 0 { + v43 = int32(WHERE_SORTBYGROUP) + } else { + v43 = 0 + } + pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, pGroupBy, pDistinct, p, uint16(v42|v43|int32(distFlag)), 0) + if pWInfo == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pDistinct) + goto select_end + } + if (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr != 0 { + _optimizeAggregateUseOfIndexedExpr(tls, pParse, p, pAggInfo, bp+112) + } + _assignAggregateRegisters(tls, pParse, pAggInfo) + eDist = _sqlite3WhereIsDistinct(tls, pWInfo) + if _sqlite3WhereIsOrdered(tls, pWInfo) == (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr { + /* The optimizer is able to deliver rows in group by order so + ** we do not have to sort. The OP_OpenEphemeral table will be + ** cancelled later because we still need to use the pKeyInfo + */ + groupBySort = 0 + } else { + if (*(*TDistinctCtx)(unsafe.Pointer(bp))).FisTnct != 0 && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Distinct) == uint32(0) { + v44 = __ccgo_ts + 20282 + } else { + v44 = __ccgo_ts + 20291 + } + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+19179, libc.VaList(bp+176, v44)) + groupBySort = int32(1) + nGroupBy = (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr + nCol = nGroupBy + j = nGroupBy + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + break + } + if int32((*(*TAggInfo_col)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(i)*24))).FiSorterColumn) >= j { + nCol++ + j++ + } + goto _45 + _45: + ; + i++ + } + regBase = _sqlite3GetTempRange(tls, pParse, nCol) + _sqlite3ExprCodeExprList(tls, pParse, pGroupBy, regBase, 0, uint8(0)) + j = nGroupBy + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(1) + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + break + } + pCol = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(i)*24 + if int32((*TAggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn) >= j { + _sqlite3ExprCode(tls, pParse, (*TAggInfo_col)(unsafe.Pointer(pCol)).FpCExpr, j+regBase) + j++ + } + goto _46 + _46: + ; + i++ + } + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(0) + regRecord = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regBase, nCol, regRecord) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterInsert), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, regRecord) + _sqlite3ReleaseTempReg(tls, pParse, regRecord) + _sqlite3ReleaseTempRange(tls, pParse, regBase, nCol) + _sqlite3WhereEnd(tls, pWInfo) + v49 = pParse + 52 + v48 = *(*int32)(unsafe.Pointer(v49)) + *(*int32)(unsafe.Pointer(v49))++ + v47 = v48 + sortPTab = v47 + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdxPTab = v47 + sortOut = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenPseudo), sortPTab, sortOut, nCol) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterSort), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, addrEnd) + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FuseSortingIdx = uint8(1) + } + /* If there are entries in pAgggInfo->aFunc[] that contain subexpressions + ** that are indexed (and that were previously identified and tagged + ** in optimizeAggregateUseOfIndexedExpr()) then those subexpressions + ** must now be converted into a TK_AGG_COLUMN node so that the value + ** is correctly pulled from the index rather than being recomputed. */ + if (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr != 0 { + _aggregateConvertIndexedExprRefToColumn(tls, pAggInfo) + } + /* If the index or temporary table used by the GROUP BY sort + ** will naturally deliver rows in the order required by the ORDER BY + ** clause, cancel the ephemeral table open coded earlier. + ** + ** This is an optimization - the correct answer should result regardless. + ** Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER to + ** disable this optimization for testing purposes. */ + if orderByGrp != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_GroupByOrder)) == uint32(0) && (groupBySort != 0 || _sqlite3WhereIsSorted(tls, pWInfo) != 0) { + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy = uintptr(0) + _sqlite3VdbeChangeToNoop(tls, v, (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FaddrSortIndex) + } + /* Evaluate the current GROUP BY terms and store in b0, b1, b2... + ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) + ** Then compare the current GROUP BY terms against the GROUP BY terms + ** from the previous row currently stored in a0, a1, a2... + */ + addrTopOfLoop = _sqlite3VdbeCurrentAddr(tls, v) + if groupBySort != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_SorterData), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, sortOut, sortPTab) + } + j = 0 + for { + if !(j < (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + break + } + if groupBySort != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), sortPTab, j, iBMem+j) + } else { + (*TAggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = uint8(1) + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pGroupBy + 8 + uintptr(j)*32))).FpExpr, iBMem+j) + } + goto _50 + _50: + ; + j++ + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_Compare), iAMem, iBMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr, _sqlite3KeyInfoRef(tls, pKeyInfo1), -int32(8)) + addr1 = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addr1+int32(1), 0, addr1+int32(1)) + /* Generate code that runs whenever the GROUP BY changes. + ** Changes in the GROUP BY are detected by the previous code + ** block. If there were no changes, this block is skipped. + ** + ** This code copies current group by terms in b0,b1,b2,... + ** over to a0,a1,a2. It then calls the output subroutine + ** and resets the aggregate accumulator registers in preparation + ** for the next GROUP BY batch. + */ + _sqlite3ExprCodeMove(tls, pParse, iBMem, iAMem, (*TExprList)(unsafe.Pointer(pGroupBy)).FnExpr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regOutputRow, addrOutputRow) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfPos), iAbortFlag, addrEnd) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regReset, addrReset) + /* Update the aggregate accumulators based on the content of + ** the current row + */ + _sqlite3VdbeJumpHere(tls, v, addr1) + _updateAccumulator(tls, pParse, iUseFlag, pAggInfo, eDist) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), iUseFlag) + /* End of the loop + */ + if groupBySort != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_SorterNext), (*TAggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, addrTopOfLoop) + } else { + _sqlite3WhereEnd(tls, pWInfo) + _sqlite3VdbeChangeToNoop(tls, v, addrSortingIdx) + } + _sqlite3ExprListDelete(tls, db, pDistinct) + /* Output the final row of result + */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regOutputRow, addrOutputRow) + /* Jump over the subroutines + */ + _sqlite3VdbeGoto(tls, v, addrEnd) + /* Generate a subroutine that outputs a single row of the result + ** set. This subroutine first looks at the iUseFlag. If iUseFlag + ** is less than or equal to zero, the subroutine is a no-op. If + ** the processing calls for the query to abort, this subroutine + ** increments the iAbortFlag memory location before returning in + ** order to signal the caller to abort. + */ + addrSetAbort = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), iAbortFlag) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regOutputRow) + _sqlite3VdbeResolveLabel(tls, v, addrOutputRow) + addrOutputRow = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfPos), iUseFlag, addrOutputRow+int32(2)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regOutputRow) + _finalizeAggFunctions(tls, pParse, pAggInfo) + _sqlite3ExprIfFalse(tls, pParse, pHaving, addrOutputRow+int32(1), int32(SQLITE_JUMPIFNULL)) + _selectInnerLoop(tls, pParse, p, -int32(1), bp+16, bp, pDest, addrOutputRow+int32(1), addrSetAbort) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regOutputRow) + /* Generate a subroutine that will reset the group-by accumulator + */ + _sqlite3VdbeResolveLabel(tls, v, addrReset) + _resetAccumulator(tls, pParse, pAggInfo) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, iUseFlag) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regReset) + if int32(distFlag) != 0 && eDist != WHERE_DISTINCT_NOOP { + pF = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + _fixDistinctOpenEph(tls, pParse, eDist, (*TAggInfo_func)(unsafe.Pointer(pF)).FiDistinct, (*TAggInfo_func)(unsafe.Pointer(pF)).FiDistAddr) + } + } else { + v51 = _isSimpleCount(tls, p, pAggInfo) + pTab1 = v51 + if v51 != uintptr(0) { + /* If isSimpleCount() returns a pointer to a Table structure, then + ** the SQL statement is of the form: + ** + ** SELECT count(*) FROM + ** + ** where the Table structure returned represents table . + ** + ** This statement is so common that it is optimized specially. The + ** OP_Count instruction is executed either on the intkey table that + ** contains the data for table or on one of its indexes. It + ** is better to execute the op on an index, as indexes are almost + ** always spread across less pages than their corresponding tables. + */ + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab1)).FpSchema) + v53 = pParse + 52 + v52 = *(*int32)(unsafe.Pointer(v53)) + *(*int32)(unsafe.Pointer(v53))++ + iCsr = v52 /* Iterator variable */ + pKeyInfo2 = uintptr(0) /* Keyinfo for scanned index */ + pBest = uintptr(0) /* Best index found so far */ + iRoot = (*TTable)(unsafe.Pointer(pTab1)).Ftnum /* Root page of scanned b-tree */ + _sqlite3CodeVerifySchema(tls, pParse, iDb) + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab1)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab1)).FzName) + /* Search for the index that has the lowest scan cost. + ** + ** (2011-04-15) Do not do a full scan of an unordered index. + ** + ** (2013-10-03) Do not count the entries in a partial index. + ** + ** In practice the KeyInfo structure will not be used. It is only + ** passed to keep OP_OpenRead happy. + */ + if !((*TTable)(unsafe.Pointer(pTab1)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pBest = _sqlite3PrimaryKeyIndex(tls, pTab1) + } + if !(int32(uint32(*(*uint16)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8 + 60 + 4))&0x1>>0)) != 0) { + pIdx = (*TTable)(unsafe.Pointer(pTab1)).FpIndex + for { + if !(pIdx != 0) { + break + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x4>>2)) == 0 && int32((*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow) < int32((*TTable)(unsafe.Pointer(pTab1)).FszTabRow) && (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) && (!(pBest != 0) || int32((*TIndex)(unsafe.Pointer(pIdx)).FszIdxRow) < int32((*TIndex)(unsafe.Pointer(pBest)).FszIdxRow)) { + pBest = pIdx + } + goto _54 + _54: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } + if pBest != 0 { + iRoot = (*TIndex)(unsafe.Pointer(pBest)).Ftnum + pKeyInfo2 = _sqlite3KeyInfoOfIndex(tls, pParse, pBest) + } + /* Open a read-only cursor, execute the OP_Count, close the cursor. */ + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenRead), iCsr, int32(iRoot), iDb, int32(1)) + if pKeyInfo2 != 0 { + _sqlite3VdbeChangeP4(tls, v, -int32(1), pKeyInfo2, -int32(8)) + } + _assignAggregateRegisters(tls, pParse, pAggInfo) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iCsr, (*TAggInfo)(unsafe.Pointer(pAggInfo)).FiFirstReg+(*TAggInfo)(unsafe.Pointer(pAggInfo)).FnColumn+libc.Int32FromInt32(0)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iCsr) + _explainSimpleCount(tls, pParse, pTab1, pBest) + } else { + regAcc = 0 /* "populate accumulators" flag */ + pDistinct1 = uintptr(0) + distFlag1 = uint16(0) + /* If there are accumulator registers but no min() or max() functions + ** without FILTER clauses, allocate register regAcc. Register regAcc + ** will contain 0 the first time the inner loop runs, and 1 thereafter. + ** The code generated by updateAccumulator() uses this to ensure + ** that the accumulator registers are (a) updated only once if + ** there are no min() or max functions or (b) always updated for the + ** first row visited by the aggregate, so that they are updated at + ** least once even if the FILTER clause means the min() or max() + ** function visits zero rows. */ + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0 { + i = 0 + for { + if !(i < (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + break + } + if (*TExpr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { + goto _55 + } + if (*TFuncDef)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32))).FpFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { + break + } + goto _55 + _55: + ; + i++ + } + if i == (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { + v57 = pParse + 56 + *(*int32)(unsafe.Pointer(v57))++ + v56 = *(*int32)(unsafe.Pointer(v57)) + regAcc = v56 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regAcc) + } + } else { + if (*TAggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == int32(1) && (*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FiDistinct >= 0 { + pDistinct1 = *(*uintptr)(unsafe.Pointer((*(*TAggInfo_func)(unsafe.Pointer((*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc))).FpFExpr + 32)) + if pDistinct1 != 0 { + v58 = libc.Int32FromInt32(WHERE_WANT_DISTINCT) | libc.Int32FromInt32(WHERE_AGG_DISTINCT) + } else { + v58 = 0 + } + distFlag1 = uint16(v58) + } + } + _assignAggregateRegisters(tls, pParse, pAggInfo) + /* This case runs if the aggregate has no GROUP BY clause. The + ** processing is much simpler since there is only a single row + ** of output. + */ + _resetAccumulator(tls, pParse, pAggInfo) + /* If this query is a candidate for the min/max optimization, then + ** minMaxFlag will have been previously set to either + ** WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX and pMinMaxOrderBy will + ** be an appropriate ORDER BY expression for the optimization. + */ + pWInfo = _sqlite3WhereBegin(tls, pParse, pTabList, pWhere, *(*uintptr)(unsafe.Pointer(bp + 64)), pDistinct1, p, uint16(int32(minMaxFlag)|int32(distFlag1)), 0) + if pWInfo == uintptr(0) { + goto select_end + } + eDist1 = _sqlite3WhereIsDistinct(tls, pWInfo) + _updateAccumulator(tls, pParse, regAcc, pAggInfo, eDist1) + if eDist1 != WHERE_DISTINCT_NOOP { + pF1 = (*TAggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + if pF1 != 0 { + _fixDistinctOpenEph(tls, pParse, eDist1, (*TAggInfo_func)(unsafe.Pointer(pF1)).FiDistinct, (*TAggInfo_func)(unsafe.Pointer(pF1)).FiDistAddr) + } + } + if regAcc != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), regAcc) + } + if minMaxFlag != 0 { + _sqlite3WhereMinMaxOptEarlyOut(tls, v, pWInfo) + } + _sqlite3WhereEnd(tls, pWInfo) + _finalizeAggFunctions(tls, pParse, pAggInfo) + } + (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy = uintptr(0) + _sqlite3ExprIfFalse(tls, pParse, pHaving, addrEnd, int32(SQLITE_JUMPIFNULL)) + _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, addrEnd, addrEnd) + } + _sqlite3VdbeResolveLabel(tls, v, addrEnd) + } /* endif aggregate query */ + if int32((*(*TDistinctCtx)(unsafe.Pointer(bp))).FeTnctType) == int32(WHERE_DISTINCT_UNORDERED) { + _explainTempTable(tls, pParse, __ccgo_ts+20282) + } + /* If there is an ORDER BY clause, then we need to sort the results + ** and send them to the callback one by one. + */ + if (*(*TSortCtx)(unsafe.Pointer(bp + 16))).FpOrderBy != 0 { + _generateSortTail(tls, pParse, p, bp+16, (*TExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) + } + /* Jump here to skip this query + */ + _sqlite3VdbeResolveLabel(tls, v, iEnd) + /* The SELECT has been coded. If there is an error in the Parse structure, + ** set the return code to 1. Otherwise 0. */ + rc = libc.BoolInt32((*TParse)(unsafe.Pointer(pParse)).FnErr > 0) + /* Control jumps to here if an error is encountered above, or upon + ** successful coding of the SELECT. + */ +select_end: + ; + _sqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 64))) + _sqlite3VdbeExplainPop(tls, pParse) + return rc +} + +/************** End of select.c **********************************************/ +/************** Begin file table.c *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the sqlite3_get_table() and sqlite3_free_table() +** interface routines. These are just wrappers around the main +** interface routine of sqlite3_exec(). +** +** These routines are in a separate files so that they will not be linked +** if they are not used. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** This structure is used to pass data from sqlite3_get_table() through +// ** to the callback function is uses to build the result. +// */ +type TTabResult = struct { + FazResult uintptr + FzErrMsg uintptr + FnAlloc Tu32 + FnRow Tu32 + FnColumn Tu32 + FnData Tu32 + Frc int32 +} + +type TabResult = TTabResult + +// C documentation +// +// /* +// ** This routine is called once for each row in the result table. Its job +// ** is to fill in the TabResult structure appropriately, allocating new +// ** memory as necessary. +// */ +func _sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr, colv uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var azNew, p, z, v3, v6 uintptr + var i, n, need int32 + var v2, v5 Tu32 + _, _, _, _, _, _, _, _, _, _ = azNew, i, n, need, p, z, v2, v3, v5, v6 + p = pArg /* A single column of result */ + /* Make sure there is enough space in p->azResult to hold everything + ** we need to remember from this invocation of the callback. + */ + if (*TTabResult)(unsafe.Pointer(p)).FnRow == uint32(0) && argv != uintptr(0) { + need = nCol * int32(2) + } else { + need = nCol + } + if (*TTabResult)(unsafe.Pointer(p)).FnData+uint32(need) > (*TTabResult)(unsafe.Pointer(p)).FnAlloc { + (*TTabResult)(unsafe.Pointer(p)).FnAlloc = (*TTabResult)(unsafe.Pointer(p)).FnAlloc*uint32(2) + uint32(need) + azNew = _sqlite3Realloc(tls, (*TTabResult)(unsafe.Pointer(p)).FazResult, uint64(8)*uint64((*TTabResult)(unsafe.Pointer(p)).FnAlloc)) + if azNew == uintptr(0) { + goto malloc_failed + } + (*TTabResult)(unsafe.Pointer(p)).FazResult = azNew + } + /* If this is the first row, then generate an extra row containing + ** the names of all columns. + */ + if (*TTabResult)(unsafe.Pointer(p)).FnRow == uint32(0) { + (*TTabResult)(unsafe.Pointer(p)).FnColumn = uint32(nCol) + i = 0 + for { + if !(i < nCol) { + break + } + z = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + if z == uintptr(0) { + goto malloc_failed + } + v3 = p + 28 + v2 = *(*Tu32)(unsafe.Pointer(v3)) + *(*Tu32)(unsafe.Pointer(v3))++ + *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v2)*8)) = z + goto _1 + _1: + ; + i++ + } + } else { + if int32((*TTabResult)(unsafe.Pointer(p)).FnColumn) != nCol { + Xsqlite3_free(tls, (*TTabResult)(unsafe.Pointer(p)).FzErrMsg) + (*TTabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+20300, 0) + (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + return int32(1) + } + } + /* Copy over the row data + */ + if argv != uintptr(0) { + i = 0 + for { + if !(i < nCol) { + break + } + if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == uintptr(0) { + z = uintptr(0) + } else { + n = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + int32(1) + z = Xsqlite3_malloc64(tls, uint64(n)) + if z == uintptr(0) { + goto malloc_failed + } + libc.Xmemcpy(tls, z, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), uint64(n)) + } + v6 = p + 28 + v5 = *(*Tu32)(unsafe.Pointer(v6)) + *(*Tu32)(unsafe.Pointer(v6))++ + *(*uintptr)(unsafe.Pointer((*TTabResult)(unsafe.Pointer(p)).FazResult + uintptr(v5)*8)) = z + goto _4 + _4: + ; + i++ + } + (*TTabResult)(unsafe.Pointer(p)).FnRow++ + } + return 0 +malloc_failed: + ; + (*TTabResult)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + return int32(1) +} + +// C documentation +// +// /* +// ** Query the database. But instead of invoking a callback for each row, +// ** malloc() for space to hold the result and return the entire results +// ** at the conclusion of the call. +// ** +// ** The result that is written to ***pazResult is held in memory obtained +// ** from malloc(). But the caller cannot free this memory directly. +// ** Instead, the entire table should be passed to sqlite3_free_table() when +// ** the calling procedure is finished using it. +// */ +func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintptr, pnRow uintptr, pnColumn uintptr, pzErrMsg uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var azNew uintptr + var rc int32 + var _ /* res at bp+0 */ TTabResult + _, _ = azNew, rc + *(*uintptr)(unsafe.Pointer(pazResult)) = uintptr(0) + if pnColumn != 0 { + *(*int32)(unsafe.Pointer(pnColumn)) = 0 + } + if pnRow != 0 { + *(*int32)(unsafe.Pointer(pnRow)) = 0 + } + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) + } + (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg = uintptr(0) + (*(*TTabResult)(unsafe.Pointer(bp))).FnRow = uint32(0) + (*(*TTabResult)(unsafe.Pointer(bp))).FnColumn = uint32(0) + (*(*TTabResult)(unsafe.Pointer(bp))).FnData = uint32(1) + (*(*TTabResult)(unsafe.Pointer(bp))).FnAlloc = uint32(20) + (*(*TTabResult)(unsafe.Pointer(bp))).Frc = SQLITE_OK + (*(*TTabResult)(unsafe.Pointer(bp))).FazResult = Xsqlite3_malloc64(tls, uint64(8)*uint64((*(*TTabResult)(unsafe.Pointer(bp))).FnAlloc)) + if (*(*TTabResult)(unsafe.Pointer(bp))).FazResult == uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_NOMEM) + return int32(SQLITE_NOMEM) + } + *(*uintptr)(unsafe.Pointer((*(*TTabResult)(unsafe.Pointer(bp))).FazResult)) = uintptr(0) + rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3_get_table_cb), bp, pzErrMsg) + *(*uintptr)(unsafe.Pointer((*(*TTabResult)(unsafe.Pointer(bp))).FazResult)) = uintptr(int64((*(*TTabResult)(unsafe.Pointer(bp))).FnData)) + if rc&int32(0xff) == int32(SQLITE_ABORT) { + Xsqlite3_free_table(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FazResult+1*8) + if (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg != 0 { + if pzErrMsg != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+48, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg)) + } + Xsqlite3_free(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg) + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = (*(*TTabResult)(unsafe.Pointer(bp))).Frc /* Assume 32-bit assignment is atomic */ + return (*(*TTabResult)(unsafe.Pointer(bp))).Frc + } + Xsqlite3_free(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FzErrMsg) + if rc != SQLITE_OK { + Xsqlite3_free_table(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FazResult+1*8) + return rc + } + if (*(*TTabResult)(unsafe.Pointer(bp))).FnAlloc > (*(*TTabResult)(unsafe.Pointer(bp))).FnData { + azNew = _sqlite3Realloc(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FazResult, uint64(8)*uint64((*(*TTabResult)(unsafe.Pointer(bp))).FnData)) + if azNew == uintptr(0) { + Xsqlite3_free_table(tls, (*(*TTabResult)(unsafe.Pointer(bp))).FazResult+1*8) + (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_NOMEM) + return int32(SQLITE_NOMEM) + } + (*(*TTabResult)(unsafe.Pointer(bp))).FazResult = azNew + } + *(*uintptr)(unsafe.Pointer(pazResult)) = (*(*TTabResult)(unsafe.Pointer(bp))).FazResult + 1*8 + if pnColumn != 0 { + *(*int32)(unsafe.Pointer(pnColumn)) = int32((*(*TTabResult)(unsafe.Pointer(bp))).FnColumn) + } + if pnRow != 0 { + *(*int32)(unsafe.Pointer(pnRow)) = int32((*(*TTabResult)(unsafe.Pointer(bp))).FnRow) + } + return rc +} + +// C documentation +// +// /* +// ** This routine frees the space the sqlite3_get_table() malloced. +// */ +func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { + var i, n int32 + _, _ = i, n + if azResult != 0 { + azResult -= 8 + n = int32(int64(*(*uintptr)(unsafe.Pointer(azResult)))) + i = int32(1) + for { + if !(i < n) { + break + } + if *(*uintptr)(unsafe.Pointer(azResult + uintptr(i)*8)) != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(azResult + uintptr(i)*8))) + } + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, azResult) + } +} + +/************** End of table.c ***********************************************/ +/************** Begin file trigger.c *****************************************/ +/* +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains the implementation for TRIGGERs + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Delete a linked list of TriggerStep structures. +// */ +func _sqlite3DeleteTriggerStep(tls *libc.TLS, db uintptr, pTriggerStep uintptr) { + var pTmp uintptr + _ = pTmp + for pTriggerStep != 0 { + pTmp = pTriggerStep + pTriggerStep = (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpNext + _sqlite3ExprDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpWhere) + _sqlite3ExprListDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpExprList) + _sqlite3SelectDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpSelect) + _sqlite3IdListDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpIdList) + _sqlite3UpsertDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpUpsert) + _sqlite3SrcListDelete(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FpFrom) + _sqlite3DbFree(tls, db, (*TTriggerStep)(unsafe.Pointer(pTmp)).FzSpan) + _sqlite3DbFree(tls, db, pTmp) + } +} + +// C documentation +// +// /* +// ** Given table pTab, return a list of all the triggers attached to +// ** the table. The list is connected by Trigger.pNext pointers. +// ** +// ** All of the triggers on pTab that are in the same database as pTab +// ** are already attached to pTab->pTrigger. But there might be additional +// ** triggers on pTab in the TEMP schema. This routine prepends all +// ** TEMP triggers on pTab to the beginning of the pTab->pTrigger list +// ** and returns the combined list. +// ** +// ** To state it another way: This routine returns a list of all triggers +// ** that fire off of pTab. The list will include any TEMP triggers on +// ** pTab as well as the triggers lised in pTab->pTrigger. +// */ +func _sqlite3TriggerList(tls *libc.TLS, pParse uintptr, pTab uintptr) (r uintptr) { + var p, pList, pTmpSchema, pTrig uintptr + _, _, _, _ = p, pList, pTmpSchema, pTrig /* Loop variable for TEMP triggers */ + pTmpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + 1*32))).FpSchema + p = (*THash)(unsafe.Pointer(pTmpSchema + 56)).Ffirst + pList = (*TTable)(unsafe.Pointer(pTab)).FpTrigger + for p != 0 { + pTrig = (*THashElem)(unsafe.Pointer(p)).Fdata + if (*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema == (*TTable)(unsafe.Pointer(pTab)).FpSchema && (*TTrigger)(unsafe.Pointer(pTrig)).Ftable != 0 && 0 == _sqlite3StrICmp(tls, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, (*TTable)(unsafe.Pointer(pTab)).FzName) && ((*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema != pTmpSchema || (*TTrigger)(unsafe.Pointer(pTrig)).FbReturning != 0) { + (*TTrigger)(unsafe.Pointer(pTrig)).FpNext = pList + pList = pTrig + } else { + if int32((*TTrigger)(unsafe.Pointer(pTrig)).Fop) == int32(TK_RETURNING) { + (*TTrigger)(unsafe.Pointer(pTrig)).Ftable = (*TTable)(unsafe.Pointer(pTab)).FzName + (*TTrigger)(unsafe.Pointer(pTrig)).FpTabSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + (*TTrigger)(unsafe.Pointer(pTrig)).FpNext = pList + pList = pTrig + } + } + p = (*THashElem)(unsafe.Pointer(p)).Fnext + } + return pList +} + +// C documentation +// +// /* +// ** This is called by the parser when it sees a CREATE TRIGGER statement +// ** up to the point of the BEGIN before the trigger actions. A Trigger +// ** structure is generated based on the information available and stored +// ** in pParse->pNewTrigger. After the trigger actions have been parsed, the +// ** sqlite3FinishTrigger() function is called to complete the trigger +// ** construction process. +// */ +func _sqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, tr_tm int32, op int32, pColumns uintptr, pTableName uintptr, pWhen uintptr, isTemp int32, noErr int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var code, iDb, iTabDb, v4 int32 + var db, pTab, pTrigger, zDb, zDbTrig, zName, v1, v2, v3 uintptr + var _ /* pName at bp+0 */ uintptr + var _ /* sFix at bp+8 */ TDbFixer + _, _, _, _, _, _, _, _, _, _, _, _, _ = code, db, iDb, iTabDb, pTab, pTrigger, zDb, zDbTrig, zName, v1, v2, v3, v4 + pTrigger = uintptr(0) /* Table that the trigger fires off of */ + zName = uintptr(0) /* Name of the trigger */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* State vector for the DB fixer */ + /* pName1->z might be NULL, but not pName1 itself */ + if isTemp != 0 { + /* If TEMP was specified, then the trigger name may not be qualified. */ + if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20365, 0) + goto trigger_cleanup + } + iDb = int32(1) + *(*uintptr)(unsafe.Pointer(bp)) = pName1 + } else { + /* Figure out the db that the trigger will be created in */ + iDb = _sqlite3TwoPartName(tls, pParse, pName1, pName2, bp) + if iDb < 0 { + goto trigger_cleanup + } + } + if !(pTableName != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto trigger_cleanup + } + /* A long-standing parser bug is that this syntax was allowed: + ** + ** CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab .... + ** ^^^^^^^^ + ** + ** To maintain backwards compatibility, ignore the database + ** name on pTableName if we are reparsing out of the schema table + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 && iDb != int32(1) { + _sqlite3DbFree(tls, db, (*(*TSrcItem)(unsafe.Pointer(pTableName + 8))).FzDatabase) + (*(*TSrcItem)(unsafe.Pointer(pTableName + 8))).FzDatabase = uintptr(0) + } + /* If the trigger name was unqualified, and the table is a temp table, + ** then set iDb to 1 to create the trigger in the temporary database. + ** If sqlite3SrcListLookup() returns 0, indicating the table does not + ** exist, the error is caught by the block below. + */ + pTab = _sqlite3SrcListLookup(tls, pParse, pTableName) + if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0 && (*TToken)(unsafe.Pointer(pName2)).Fn == uint32(0) && pTab != 0 && (*TTable)(unsafe.Pointer(pTab)).FpSchema == (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { + iDb = int32(1) + } + /* Ensure the table name matches database name and that the table exists */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto trigger_cleanup + } + _sqlite3FixInit(tls, bp+8, pParse, iDb, __ccgo_ts+20411, *(*uintptr)(unsafe.Pointer(bp))) + if _sqlite3FixSrcList(tls, bp+8, pTableName) != 0 { + goto trigger_cleanup + } + pTab = _sqlite3SrcListLookup(tls, pParse, pTableName) + if !(pTab != 0) { + /* The table does not exist. */ + goto trigger_orphan_error + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20419, 0) + goto trigger_orphan_error + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20460, 0) + goto trigger_orphan_error + } + /* Check that the trigger name is not reserved and that no trigger of the + ** specified name exists */ + zName = _sqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + if zName == uintptr(0) { + goto trigger_cleanup + } + if _sqlite3CheckObjectName(tls, pParse, zName, __ccgo_ts+20411, (*TTable)(unsafe.Pointer(pTab)).FzName) != 0 { + goto trigger_cleanup + } + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + if _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema+56, zName) != 0 { + if !(noErr != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20500, libc.VaList(bp+112, *(*uintptr)(unsafe.Pointer(bp)))) + } else { + _sqlite3CodeVerifySchema(tls, pParse, iDb) + } + goto trigger_cleanup + } + } + /* Do not create a trigger on a system table */ + if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6557, int32(7)) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20526, 0) + goto trigger_cleanup + } + /* INSTEAD of triggers are only for views and views only support INSTEAD + ** of triggers. + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && tr_tm != int32(TK_INSTEAD) { + if tr_tm == int32(TK_BEFORE) { + v1 = __ccgo_ts + 20564 + } else { + v1 = __ccgo_ts + 20571 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20577, libc.VaList(bp+112, v1, pTableName+8)) + goto trigger_orphan_error + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && tr_tm == int32(TK_INSTEAD) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20614, libc.VaList(bp+112, pTableName+8)) + goto trigger_orphan_error + } + if !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + iTabDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + code = int32(SQLITE_CREATE_TRIGGER) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iTabDb)*32))).FzDbSName + if isTemp != 0 { + v2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FzDbSName + } else { + v2 = zDb + } + zDbTrig = v2 + if iTabDb == int32(1) || isTemp != 0 { + code = int32(SQLITE_CREATE_TEMP_TRIGGER) + } + if _sqlite3AuthCheck(tls, pParse, code, zName, (*TTable)(unsafe.Pointer(pTab)).FzName, zDbTrig) != 0 { + goto trigger_cleanup + } + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iTabDb == int32(1) { + v3 = __ccgo_ts + 6565 + } else { + v3 = __ccgo_ts + 6098 + } + if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_INSERT), v3, uintptr(0), zDb) != 0 { + goto trigger_cleanup + } + } + /* INSTEAD OF triggers can only appear on views and BEFORE triggers + ** cannot appear on views. So we might as well translate every + ** INSTEAD OF trigger into a BEFORE trigger. It simplifies code + ** elsewhere. + */ + if tr_tm == int32(TK_INSTEAD) { + tr_tm = int32(TK_BEFORE) + } + /* Build the Trigger object */ + pTrigger = _sqlite3DbMallocZero(tls, db, uint64(72)) + if pTrigger == uintptr(0) { + goto trigger_cleanup + } + (*TTrigger)(unsafe.Pointer(pTrigger)).FzName = zName + zName = uintptr(0) + (*TTrigger)(unsafe.Pointer(pTrigger)).Ftable = _sqlite3DbStrDup(tls, db, (*(*TSrcItem)(unsafe.Pointer(pTableName + 8))).FzName) + (*TTrigger)(unsafe.Pointer(pTrigger)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + (*TTrigger)(unsafe.Pointer(pTrigger)).FpTabSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + (*TTrigger)(unsafe.Pointer(pTrigger)).Fop = uint8(op) + if tr_tm == int32(TK_BEFORE) { + v4 = int32(TRIGGER_BEFORE) + } else { + v4 = int32(TRIGGER_AFTER) + } + (*TTrigger)(unsafe.Pointer(pTrigger)).Ftr_tm = uint8(v4) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, (*TTrigger)(unsafe.Pointer(pTrigger)).Ftable, (*(*TSrcItem)(unsafe.Pointer(pTableName + 8))).FzName) + (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen = pWhen + pWhen = uintptr(0) + } else { + (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen = _sqlite3ExprDup(tls, db, pWhen, int32(EXPRDUP_REDUCE)) + } + (*TTrigger)(unsafe.Pointer(pTrigger)).FpColumns = pColumns + pColumns = uintptr(0) + (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger +trigger_cleanup: + ; + _sqlite3DbFree(tls, db, zName) + _sqlite3SrcListDelete(tls, db, pTableName) + _sqlite3IdListDelete(tls, db, pColumns) + _sqlite3ExprDelete(tls, db, pWhen) + if !((*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0) { + _sqlite3DeleteTrigger(tls, db, pTrigger) + } else { + } + return +trigger_orphan_error: + ; + if int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) == int32(1) { + /* Ticket #3810. + ** Normally, whenever a table is dropped, all associated triggers are + ** dropped too. But if a TEMP trigger is created on a non-TEMP table + ** and the table is dropped by a different database connection, the + ** trigger is not visible to the database connection that does the + ** drop so the trigger cannot be dropped. This results in an + ** "orphaned trigger" - a trigger whose associated table is missing. + ** + ** 2020-11-05 see also https://sqlite.org/forum/forumpost/157dc791df + */ + libc.SetBitFieldPtr8Uint32(db+192+8, libc.Uint32FromInt32(1), 0, 0x1) + } + goto trigger_cleanup +} + +// C documentation +// +// /* +// ** This routine is called after all of the trigger actions have been parsed +// ** in order to complete the process of building the trigger. +// */ +func _sqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAll uintptr) { + bp := tls.Alloc(160) + defer tls.Free(160) + var db, pHash, pLink, pStep, pTab, pTrig, v, z, zName uintptr + var iDb int32 + var _ /* nameToken at bp+96 */ TToken + var _ /* sFix at bp+0 */ TDbFixer + _, _, _, _, _, _, _, _, _, _ = db, iDb, pHash, pLink, pStep, pTab, pTrig, v, z, zName + pTrig = (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger /* Name of trigger */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Trigger name for error reporting */ + (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = uintptr(0) + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 || !(pTrig != 0) { + goto triggerfinish_cleanup + } + zName = (*TTrigger)(unsafe.Pointer(pTrig)).FzName + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTrigger)(unsafe.Pointer(pTrig)).FpSchema) + (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list = pStepList + for pStepList != 0 { + (*TTriggerStep)(unsafe.Pointer(pStepList)).FpTrig = pTrig + pStepList = (*TTriggerStep)(unsafe.Pointer(pStepList)).FpNext + } + _sqlite3TokenInit(tls, bp+96, (*TTrigger)(unsafe.Pointer(pTrig)).FzName) + _sqlite3FixInit(tls, bp, pParse, iDb, __ccgo_ts+20411, bp+96) + if _sqlite3FixTriggerStep(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0 || _sqlite3FixExpr(tls, bp, (*TTrigger)(unsafe.Pointer(pTrig)).FpWhen) != 0 { + goto triggerfinish_cleanup + } + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrig + pTrig = uintptr(0) + } else { + /* if we are not initializing, + ** build the sqlite_schema entry + */ + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { + /* If this is a new CREATE TABLE statement, and if shadow tables + ** are read-only, and the trigger makes a change to a shadow table, + ** then raise an error - do not allow the trigger to be created. */ + if _sqlite3ReadOnlyShadowTables(tls, db) != 0 { + pStep = (*TTrigger)(unsafe.Pointer(pTrig)).Fstep_list + for { + if !(pStep != 0) { + break + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget != uintptr(0) && _sqlite3ShadowTableName(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20660, libc.VaList(bp+120, (*TTrigger)(unsafe.Pointer(pTrig)).FzName, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget)) + goto triggerfinish_cleanup + } + goto _1 + _1: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + } + /* Make an entry in the sqlite_schema table */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto triggerfinish_cleanup + } + _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) + z = _sqlite3DbStrNDup(tls, db, (*TToken)(unsafe.Pointer(pAll)).Fz, uint64((*TToken)(unsafe.Pointer(pAll)).Fn)) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20708, libc.VaList(bp+120, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, zName, (*TTrigger)(unsafe.Pointer(pTrig)).Ftable, z)) + _sqlite3DbFree(tls, db, z) + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, _sqlite3MPrintf(tls, db, __ccgo_ts+20783, libc.VaList(bp+120, zName)), uint16(0)) + } + } + if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { + pLink = pTrig + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 56 + pTrig = _sqlite3HashInsert(tls, pHash, zName, pTrig) + if pTrig != 0 { + _sqlite3OomFault(tls, db) + } else { + if (*TTrigger)(unsafe.Pointer(pLink)).FpSchema == (*TTrigger)(unsafe.Pointer(pLink)).FpTabSchema { + pTab = _sqlite3HashFind(tls, (*TTrigger)(unsafe.Pointer(pLink)).FpTabSchema+8, (*TTrigger)(unsafe.Pointer(pLink)).Ftable) + (*TTrigger)(unsafe.Pointer(pLink)).FpNext = (*TTable)(unsafe.Pointer(pTab)).FpTrigger + (*TTable)(unsafe.Pointer(pTab)).FpTrigger = pLink + } + } + } +triggerfinish_cleanup: + ; + _sqlite3DeleteTrigger(tls, db, pTrig) + _sqlite3DeleteTriggerStep(tls, db, pStepList) +} + +// C documentation +// +// /* +// ** Duplicate a range of text from an SQL statement, then convert all +// ** whitespace characters into ordinary space characters. +// */ +func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var i int32 + var z uintptr + _, _ = i, z + z = _sqlite3DbSpanDup(tls, db, zStart, zEnd) + if z != 0 { + i = 0 + for { + if !(*(*int8)(unsafe.Pointer(z + uintptr(i))) != 0) { + break + } + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))])&int32(0x01) != 0 { + *(*int8)(unsafe.Pointer(z + uintptr(i))) = int8(' ') + } + goto _1 + _1: + ; + i++ + } + } + return z +} + +// C documentation +// +// /* +// ** Turn a SELECT statement (that the pSelect parameter points to) into +// ** a trigger step. Return a pointer to a TriggerStep structure. +// ** +// ** The parser calls this routine when it finds a SELECT statement in +// ** body of a TRIGGER. +// */ +func _sqlite3TriggerSelectStep(tls *libc.TLS, db uintptr, pSelect uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var pTriggerStep uintptr + _ = pTriggerStep + pTriggerStep = _sqlite3DbMallocZero(tls, db, uint64(96)) + if pTriggerStep == uintptr(0) { + _sqlite3SelectDelete(tls, db, pSelect) + return uintptr(0) + } + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Fop = uint8(TK_SELECT) + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = pSelect + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = uint8(OE_Default) + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FzSpan = _triggerSpanDup(tls, db, zStart, zEnd) + return pTriggerStep +} + +// C documentation +// +// /* +// ** Allocate space to hold a new trigger step. The allocated space +// ** holds both the TriggerStep object and the TriggerStep.target.z string. +// ** +// ** If an OOM error occurs, NULL is returned and db->mallocFailed is set. +// */ +func _triggerStepAllocate(tls *libc.TLS, pParse uintptr, op Tu8, pName uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var db, pTriggerStep, z uintptr + _, _, _ = db, pTriggerStep, z + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return uintptr(0) + } + pTriggerStep = _sqlite3DbMallocZero(tls, db, uint64(96)+uint64((*TToken)(unsafe.Pointer(pName)).Fn)+uint64(1)) + if pTriggerStep != 0 { + z = pTriggerStep + 1*96 + libc.Xmemcpy(tls, z, (*TToken)(unsafe.Pointer(pName)).Fz, uint64((*TToken)(unsafe.Pointer(pName)).Fn)) + _sqlite3Dequote(tls, z) + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FzTarget = z + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Fop = op + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FzSpan = _triggerSpanDup(tls, db, zStart, zEnd) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenMap(tls, pParse, (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FzTarget, pName) + } + } + return pTriggerStep +} + +// C documentation +// +// /* +// ** Build a trigger step out of an INSERT statement. Return a pointer +// ** to the new trigger step. +// ** +// ** The parser calls this routine when it sees an INSERT inside the +// ** body of a trigger. +// */ +func _sqlite3TriggerInsertStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pColumn uintptr, pSelect uintptr, orconf Tu8, pUpsert uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var db, pTriggerStep uintptr + _, _ = db, pTriggerStep + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pTriggerStep = _triggerStepAllocate(tls, pParse, uint8(TK_INSERT), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = pSelect + pSelect = uintptr(0) + } else { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = _sqlite3SelectDup(tls, db, pSelect, int32(EXPRDUP_REDUCE)) + } + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpIdList = pColumn + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpUpsert = pUpsert + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = orconf + if pUpsert != 0 { + _sqlite3HasExplicitNulls(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + } + } else { + _sqlite3IdListDelete(tls, db, pColumn) + _sqlite3UpsertDelete(tls, db, pUpsert) + } + _sqlite3SelectDelete(tls, db, pSelect) + return pTriggerStep +} + +// C documentation +// +// /* +// ** Construct a trigger step that implements an UPDATE statement and return +// ** a pointer to that trigger step. The parser calls this routine when it +// ** sees an UPDATE statement inside the body of a CREATE TRIGGER. +// */ +func _sqlite3TriggerUpdateStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pFrom uintptr, pEList uintptr, pWhere uintptr, orconf Tu8, zStart uintptr, zEnd uintptr) (r uintptr) { + var db, pTriggerStep uintptr + _, _ = db, pTriggerStep + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pTriggerStep = _triggerStepAllocate(tls, pParse, uint8(TK_UPDATE), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpExprList = pEList + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = pWhere + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpFrom = pFrom + pEList = uintptr(0) + pWhere = uintptr(0) + pFrom = uintptr(0) + } else { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpExprList = _sqlite3ExprListDup(tls, db, pEList, int32(EXPRDUP_REDUCE)) + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = _sqlite3ExprDup(tls, db, pWhere, int32(EXPRDUP_REDUCE)) + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpFrom = _sqlite3SrcListDup(tls, db, pFrom, int32(EXPRDUP_REDUCE)) + } + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = orconf + } + _sqlite3ExprListDelete(tls, db, pEList) + _sqlite3ExprDelete(tls, db, pWhere) + _sqlite3SrcListDelete(tls, db, pFrom) + return pTriggerStep +} + +// C documentation +// +// /* +// ** Construct a trigger step that implements a DELETE statement and return +// ** a pointer to that trigger step. The parser calls this routine when it +// ** sees a DELETE statement inside the body of a CREATE TRIGGER. +// */ +func _sqlite3TriggerDeleteStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pWhere uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { + var db, pTriggerStep uintptr + _, _ = db, pTriggerStep + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pTriggerStep = _triggerStepAllocate(tls, pParse, uint8(TK_DELETE), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = pWhere + pWhere = uintptr(0) + } else { + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = _sqlite3ExprDup(tls, db, pWhere, int32(EXPRDUP_REDUCE)) + } + (*TTriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = uint8(OE_Default) + } + _sqlite3ExprDelete(tls, db, pWhere) + return pTriggerStep +} + +// C documentation +// +// /* +// ** Recursively delete a Trigger structure +// */ +func _sqlite3DeleteTrigger(tls *libc.TLS, db uintptr, pTrigger uintptr) { + if pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 { + return + } + _sqlite3DeleteTriggerStep(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list) + _sqlite3DbFree(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName) + _sqlite3DbFree(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).Ftable) + _sqlite3ExprDelete(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen) + _sqlite3IdListDelete(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).FpColumns) + _sqlite3DbFree(tls, db, pTrigger) +} + +// C documentation +// +// /* +// ** This function is called to drop a trigger from the database schema. +// ** +// ** This may be called directly from the parser and therefore identifies +// ** the trigger by name. The sqlite3DropTriggerPtr() routine does the +// ** same job as this routine except it takes a pointer to the trigger +// ** instead of the trigger name. +// **/ +func _sqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pTrigger, zDb, zName uintptr + var i, j, v2 int32 + _, _, _, _, _, _, _ = db, i, j, pTrigger, zDb, zName, v2 + pTrigger = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto drop_trigger_cleanup + } + if SQLITE_OK != _sqlite3ReadSchema(tls, pParse) { + goto drop_trigger_cleanup + } + zDb = (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzDatabase + zName = (*(*TSrcItem)(unsafe.Pointer(pName + 8))).FzName + i = OMIT_TEMPDB + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + if i < int32(2) { + v2 = i ^ int32(1) + } else { + v2 = i + } + j = v2 /* Search TEMP before MAIN */ + if zDb != 0 && _sqlite3DbIsNamed(tls, db, j, zDb) == 0 { + goto _1 + } + pTrigger = _sqlite3HashFind(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32))).FpSchema+56, zName) + if pTrigger != 0 { + break + } + goto _1 + _1: + ; + i++ + } + if !(pTrigger != 0) { + if !(noErr != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20812, libc.VaList(bp+8, pName+8)) + } else { + _sqlite3CodeVerifyNamedSchema(tls, pParse, zDb) + } + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + goto drop_trigger_cleanup + } + _sqlite3DropTriggerPtr(tls, pParse, pTrigger) +drop_trigger_cleanup: + ; + _sqlite3SrcListDelete(tls, db, pName) +} + +// C documentation +// +// /* +// ** Return a pointer to the Table structure for the table that a trigger +// ** is set on. +// */ +func _tableOfTrigger(tls *libc.TLS, pTrigger uintptr) (r uintptr) { + return _sqlite3HashFind(tls, (*TTrigger)(unsafe.Pointer(pTrigger)).FpTabSchema+8, (*TTrigger)(unsafe.Pointer(pTrigger)).Ftable) +} + +// C documentation +// +// /* +// ** Drop a trigger given a pointer to that trigger. +// */ +func _sqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var code, iDb int32 + var db, pTable, v, zDb, zTab, v1, v2 uintptr + _, _, _, _, _, _, _, _, _ = code, db, iDb, pTable, v, zDb, zTab, v1, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTrigger)(unsafe.Pointer(pTrigger)).FpSchema) + pTable = _tableOfTrigger(tls, pTrigger) + if pTable != 0 { + code = int32(SQLITE_DROP_TRIGGER) + zDb = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + if libc.Bool(!(libc.Int32FromInt32(OMIT_TEMPDB) != 0)) && iDb == int32(1) { + v1 = __ccgo_ts + 6565 + } else { + v1 = __ccgo_ts + 6098 + } + zTab = v1 + if iDb == int32(1) { + code = int32(SQLITE_DROP_TEMP_TRIGGER) + } + if _sqlite3AuthCheck(tls, pParse, code, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, (*TTable)(unsafe.Pointer(pTable)).FzName, zDb) != 0 || _sqlite3AuthCheck(tls, pParse, int32(SQLITE_DELETE), zTab, uintptr(0), zDb) != 0 { + return + } + } + /* Generate code to destroy the database record of the trigger. + */ + v2 = _sqlite3GetVdbe(tls, pParse) + v = v2 + if v2 != uintptr(0) { + _sqlite3NestedParse(tls, pParse, __ccgo_ts+20832, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)) + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqlite3VdbeAddOp4(tls, v, int32(OP_DropTrigger), iDb, 0, 0, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName, 0) + } +} + +// C documentation +// +// /* +// ** Remove a trigger from the hash tables of the sqlite* pointer. +// */ +func _sqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) { + var pHash, pTab, pTrigger, pp uintptr + _, _, _, _ = pHash, pTab, pTrigger, pp + pHash = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema + 56 + pTrigger = _sqlite3HashInsert(tls, pHash, zName, uintptr(0)) + if pTrigger != 0 { + if (*TTrigger)(unsafe.Pointer(pTrigger)).FpSchema == (*TTrigger)(unsafe.Pointer(pTrigger)).FpTabSchema { + pTab = _tableOfTrigger(tls, pTrigger) + if pTab != 0 { + pp = pTab + 88 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + if *(*uintptr)(unsafe.Pointer(pp)) == pTrigger { + *(*uintptr)(unsafe.Pointer(pp)) = (*TTrigger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 + } + } + } + _sqlite3DeleteTrigger(tls, db, pTrigger) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_SchemaChange) + } +} + +// C documentation +// +// /* +// ** pEList is the SET clause of an UPDATE statement. Each entry +// ** in pEList is of the format =. If any of the entries +// ** in pEList have an which matches an identifier in pIdList, +// ** then return TRUE. If pIdList==NULL, then it is considered a +// ** wildcard that matches anything. Likewise if pEList==NULL then +// ** it matches anything so always return true. Return false only +// ** if there is no match. +// */ +func _checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) (r int32) { + var e int32 + _ = e + if pIdList == uintptr(0) || pEList == uintptr(0) { + return int32(1) + } + e = 0 + for { + if !(e < (*TExprList)(unsafe.Pointer(pEList)).FnExpr) { + break + } + if _sqlite3IdListIndex(tls, pIdList, (*(*TExprList_item)(unsafe.Pointer(pEList + 8 + uintptr(e)*32))).FzEName) >= 0 { + return int32(1) + } + goto _1 + _1: + ; + e++ + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if any TEMP triggers exist +// */ +func _tempTriggersExist(tls *libc.TLS, db uintptr) (r int32) { + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema == uintptr(0) { + return 0 + } + if (*THash)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema+56)).Ffirst == uintptr(0) { + return 0 + } + return int32(1) +} + +// C documentation +// +// /* +// ** Return a list of all triggers on table pTab if there exists at least +// ** one trigger that must be fired when an operation of type 'op' is +// ** performed on the table, and, if that operation is an UPDATE, if at +// ** least one of the columns in pChanges is being modified. +// */ +func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var mask int32 + var p, pList, v1, v2 uintptr + _, _, _, _, _ = mask, p, pList, v1, v2 + mask = 0 + pList = uintptr(0) + pList = _sqlite3TriggerList(tls, pParse, pTab) + if pList != uintptr(0) { + p = pList + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_EnableTrigger) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpTrigger != uintptr(0) { + /* The SQLITE_DBCONFIG_ENABLE_TRIGGER setting is off. That means that + ** only TEMP triggers are allowed. Truncate the pList so that it + ** includes only TEMP triggers */ + if pList == (*TTable)(unsafe.Pointer(pTab)).FpTrigger { + pList = uintptr(0) + goto exit_triggers_exist + } + for (*TTrigger)(unsafe.Pointer(p)).FpNext != 0 && (*TTrigger)(unsafe.Pointer(p)).FpNext != (*TTable)(unsafe.Pointer(pTab)).FpTrigger { + p = (*TTrigger)(unsafe.Pointer(p)).FpNext + } + (*TTrigger)(unsafe.Pointer(p)).FpNext = uintptr(0) + p = pList + } + for cond := true; cond; cond = p != 0 { + if int32((*TTrigger)(unsafe.Pointer(p)).Fop) == op && _checkColumnOverlap(tls, (*TTrigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0 { + mask |= int32((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) + } else { + if int32((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_RETURNING) { + /* The first time a RETURNING trigger is seen, the "op" value tells + ** us what time of trigger it should be. */ + (*TTrigger)(unsafe.Pointer(p)).Fop = uint8(op) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + if op != int32(TK_INSERT) { + if op == int32(TK_DELETE) { + v1 = __ccgo_ts + 20894 + } else { + v1 = __ccgo_ts + 20901 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20908, libc.VaList(bp+8, v1)) + } + (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) + } else { + (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_AFTER) + } + mask |= int32((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) + } else { + if (*TTrigger)(unsafe.Pointer(p)).FbReturning != 0 && int32((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_INSERT) && op == int32(TK_UPDATE) && (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) { + /* Also fire a RETURNING trigger for an UPSERT */ + mask |= int32((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) + } + } + } + p = (*TTrigger)(unsafe.Pointer(p)).FpNext + } + } +exit_triggers_exist: + ; + if pMask != 0 { + *(*int32)(unsafe.Pointer(pMask)) = mask + } + if mask != 0 { + v2 = pList + } else { + v2 = uintptr(0) + } + return v2 +} + +func _sqlite3TriggersExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) (r uintptr) { + if (*TTable)(unsafe.Pointer(pTab)).FpTrigger == uintptr(0) && !(_tempTriggersExist(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0) || (*TParse)(unsafe.Pointer(pParse)).FdisableTriggers != 0 { + if pMask != 0 { + *(*int32)(unsafe.Pointer(pMask)) = 0 + } + return uintptr(0) + } + return _triggersReallyExist(tls, pParse, pTab, op, pChanges, pMask) +} + +// C documentation +// +// /* +// ** Convert the pStep->zTarget string into a SrcList and return a pointer +// ** to that SrcList. +// ** +// ** This routine adds a specific database name, if needed, to the target when +// ** forming the SrcList. This prevents a trigger in one database from +// ** referring to a target in another database. An exception is when the +// ** trigger is in TEMP in which case it can refer to any other database it +// ** wants. +// */ +func _sqlite3TriggerStepSrc(tls *libc.TLS, pParse uintptr, pStep uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pDup, pSchema, pSrc, pSubquery, zName uintptr + var _ /* as at bp+0 */ TToken + _, _, _, _, _, _ = db, pDup, pSchema, pSrc, pSubquery, zName + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* SrcList to be returned */ + zName = _sqlite3DbStrDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FzTarget) + pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pSrc != 0 { + pSchema = (*TTrigger)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(pStep)).FpTrig)).FpSchema + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FzName = zName + if pSchema != (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema { + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpSchema = pSchema + } + if (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + pDup = _sqlite3SrcListDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpFrom, 0) + if pDup != 0 && (*TSrcList)(unsafe.Pointer(pDup)).FnSrc > int32(1) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + pSubquery = _sqlite3SelectNew(tls, pParse, uintptr(0), pDup, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_NestedFrom), uintptr(0)) + (*(*TToken)(unsafe.Pointer(bp))).Fn = uint32(0) + (*(*TToken)(unsafe.Pointer(bp))).Fz = uintptr(0) + pDup = _sqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp, pSubquery, uintptr(0)) + } + pSrc = _sqlite3SrcListAppendList(tls, pParse, pSrc, pDup) + } + } else { + _sqlite3DbFree(tls, db, zName) + } + return pSrc +} + +// C documentation +// +// /* +// ** Return true if the pExpr term from the RETURNING clause argument +// ** list is of the form "*". Raise an error if the terms if of the +// ** form "table.*". +// */ +func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { + if int32((*TExpr)(unsafe.Pointer(pTerm)).Fop) == int32(TK_ASTERISK) { + return int32(1) + } + if int32((*TExpr)(unsafe.Pointer(pTerm)).Fop) != int32(TK_DOT) { + return 0 + } + if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { + return 0 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20956, 0) + return int32(1) +} + +// C documentation +// +// /* The input list pList is the list of result set terms from a RETURNING +// ** clause. The table that we are returning from is pTab. +// ** +// ** This routine makes a copy of the pList, and at the same time expands +// ** any "*" wildcards to be the complete set of columns from pTab. +// */ +func _sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab uintptr) (r uintptr) { + var db, pItem, pItem1, pNew, pNewExpr, pNewExpr1, pOldExpr uintptr + var i, jj int32 + _, _, _, _, _, _, _, _, _ = db, i, jj, pItem, pItem1, pNew, pNewExpr, pNewExpr1, pOldExpr + pNew = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + pOldExpr = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr + if pOldExpr == uintptr(0) { + goto _1 + } + if _isAsteriskTerm(tls, pParse, pOldExpr) != 0 { + jj = 0 + for { + if !(jj < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(jj)*16)).FcolFlags)&int32(COLFLAG_HIDDEN) != 0 { + goto _2 + } + pNewExpr = _sqlite3Expr(tls, db, int32(TK_ID), (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(jj)*16))).FzCnName) + pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pNewExpr) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + pItem = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 + (*TExprList_item)(unsafe.Pointer(pItem)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(jj)*16))).FzCnName) + libc.SetBitFieldPtr16Uint32(pItem+16+4, libc.Uint32FromInt32(ENAME_NAME), 0, 0x3) + } + goto _2 + _2: + ; + jj++ + } + } else { + pNewExpr1 = _sqlite3ExprDup(tls, db, pOldExpr, 0) + pNew = _sqlite3ExprListAppend(tls, pParse, pNew, pNewExpr1) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FzEName != uintptr(0) { + pItem1 = pNew + 8 + uintptr((*TExprList)(unsafe.Pointer(pNew)).FnExpr-int32(1))*32 + (*TExprList_item)(unsafe.Pointer(pItem1)).FzEName = _sqlite3DbStrDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FzEName) + libc.SetBitFieldPtr16Uint32(pItem1+16+4, uint32(int32(uint32(*(*uint16)(unsafe.Pointer(pList + 8 + uintptr(i)*32 + 16 + 4))&0x3>>0))), 0, 0x3) + } + } + goto _1 + _1: + ; + i++ + } + return pNew +} + +// C documentation +// +// /* +// ** Generate code for the RETURNING trigger. Unlike other triggers +// ** that invoke a subprogram in the bytecode, the code for RETURNING +// ** is generated in-line. +// */ +func _codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, regIn int32) { + bp := tls.Alloc(304) + defer tls.Free(304) + var db, pCol, pNew, pReturning, v, v2 uintptr + var i, nCol, reg, v1 int32 + var _ /* sFrom at bp+128 */ TSrcList + var _ /* sNC at bp+240 */ TNameContext + var _ /* sSelect at bp+0 */ TSelect + _, _, _, _, _, _, _, _, _, _ = db, i, nCol, pCol, pNew, pReturning, reg, v, v1, v2 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if !((*TParse)(unsafe.Pointer(pParse)).FbReturning != 0) { + /* This RETURNING trigger must be for a different statement as + ** this statement lacks a RETURNING clause. */ + return + } + pReturning = *(*uintptr)(unsafe.Pointer(pParse + 208)) + if pTrigger != pReturning+16 { + /* This RETURNING trigger is for a different statement */ + return + } + libc.Xmemset(tls, bp, 0, uint64(128)) + libc.Xmemset(tls, bp+128, 0, uint64(112)) + (*(*TSelect)(unsafe.Pointer(bp))).FpEList = _sqlite3ExprListDup(tls, db, (*TReturning)(unsafe.Pointer(pReturning)).FpReturnEL, 0) + (*(*TSelect)(unsafe.Pointer(bp))).FpSrc = bp + 128 + (*(*TSrcList)(unsafe.Pointer(bp + 128))).FnSrc = int32(1) + (*(*TSrcItem)(unsafe.Pointer(bp + 128 + 8))).FpTab = pTab + (*(*TSrcItem)(unsafe.Pointer(bp + 128 + 8))).FiCursor = -int32(1) + _sqlite3SelectPrep(tls, pParse, bp, uintptr(0)) + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + _sqlite3GenerateColumnNames(tls, pParse, bp) + } + _sqlite3ExprListDelete(tls, db, (*(*TSelect)(unsafe.Pointer(bp))).FpEList) + pNew = _sqlite3ExpandReturning(tls, pParse, (*TReturning)(unsafe.Pointer(pReturning)).FpReturnEL, pTab) + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + libc.Xmemset(tls, bp+240, 0, uint64(56)) + if (*TReturning)(unsafe.Pointer(pReturning)).FnRetCol == 0 { + (*TReturning)(unsafe.Pointer(pReturning)).FnRetCol = (*TExprList)(unsafe.Pointer(pNew)).FnExpr + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur = v1 + } + (*(*TNameContext)(unsafe.Pointer(bp + 240))).FpParse = pParse + *(*int32)(unsafe.Pointer(bp + 240 + 16)) = regIn + (*(*TNameContext)(unsafe.Pointer(bp + 240))).FncFlags = int32(NC_UBaseReg) + (*TParse)(unsafe.Pointer(pParse)).FeTriggerOp = (*TTrigger)(unsafe.Pointer(pTrigger)).Fop + (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab = pTab + if _sqlite3ResolveExprListNames(tls, bp+240, pNew) == SQLITE_OK && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + nCol = (*TExprList)(unsafe.Pointer(pNew)).FnExpr + reg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nCol + int32(2) + (*TReturning)(unsafe.Pointer(pReturning)).FiRetReg = reg + i = 0 + for { + if !(i < nCol) { + break + } + pCol = (*(*TExprList_item)(unsafe.Pointer(pNew + 8 + uintptr(i)*32))).FpExpr + /* Due to !db->mallocFailed ~9 lines above */ + _sqlite3ExprCodeFactorable(tls, pParse, pCol, reg+i) + if int32(_sqlite3ExprAffinity(tls, pCol)) == int32(SQLITE_AFF_REAL) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), reg+i) + } + goto _3 + _3: + ; + i++ + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), reg, i, reg+i) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, reg+i+int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), (*TReturning)(unsafe.Pointer(pReturning)).FiRetCur, reg+i, reg+i+int32(1)) + } + } + _sqlite3ExprListDelete(tls, db, pNew) + (*TParse)(unsafe.Pointer(pParse)).FeTriggerOp = uint8(0) + (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab = uintptr(0) +} + +// C documentation +// +// /* +// ** Generate VDBE code for the statements inside the body of a single +// ** trigger. +// */ +func _codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf int32) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pSelect, pStep, v uintptr + var v2 int32 + var _ /* sDest at bp+0 */ TSelectDest + _, _, _, _, _ = db, pSelect, pStep, v, v2 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pStep = pStepList + for { + if !(pStep != 0) { + break + } + /* Figure out the ON CONFLICT policy that will be used for this step + ** of the trigger program. If the statement that caused this trigger + ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use + ** the ON CONFLICT policy that was specified as part of the trigger + ** step statement. Example: + ** + ** CREATE TRIGGER AFTER INSERT ON t1 BEGIN; + ** INSERT OR REPLACE INTO t2 VALUES(new.a, new.b); + ** END; + ** + ** INSERT INTO t1 ... ; -- insert into t2 uses REPLACE policy + ** INSERT OR IGNORE INTO t1 ... ; -- insert into t2 uses IGNORE policy + */ + if orconf == int32(OE_Default) { + v2 = int32((*TTriggerStep)(unsafe.Pointer(pStep)).Forconf) + } else { + v2 = int32(uint8(orconf)) + } + (*TParse)(unsafe.Pointer(pParse)).FeOrconf = uint8(v2) + if (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Trace), int32(0x7fffffff), int32(1), 0, _sqlite3MPrintf(tls, db, __ccgo_ts+6295, libc.VaList(bp+48, (*TTriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -int32(6)) + } + switch int32((*TTriggerStep)(unsafe.Pointer(pStep)).Fop) { + case int32(TK_UPDATE): + _sqlite3Update(tls, pParse, _sqlite3TriggerStepSrc(tls, pParse, pStep), _sqlite3ExprListDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpExprList, 0), _sqlite3ExprDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere, 0), int32((*TParse)(unsafe.Pointer(pParse)).FeOrconf), uintptr(0), uintptr(0), uintptr(0)) + _sqlite3VdbeAddOp0(tls, v, int32(OP_ResetCount)) + case int32(TK_INSERT): + _sqlite3Insert(tls, pParse, _sqlite3TriggerStepSrc(tls, pParse, pStep), _sqlite3SelectDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0), _sqlite3IdListDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpIdList), int32((*TParse)(unsafe.Pointer(pParse)).FeOrconf), _sqlite3UpsertDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpUpsert)) + _sqlite3VdbeAddOp0(tls, v, int32(OP_ResetCount)) + case int32(TK_DELETE): + _sqlite3DeleteFrom(tls, pParse, _sqlite3TriggerStepSrc(tls, pParse, pStep), _sqlite3ExprDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpWhere, 0), uintptr(0), uintptr(0)) + _sqlite3VdbeAddOp0(tls, v, int32(OP_ResetCount)) + default: + pSelect = _sqlite3SelectDup(tls, db, (*TTriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0) + _sqlite3SelectDestInit(tls, bp, int32(SRT_Discard), 0) + _sqlite3Select(tls, pParse, pSelect, bp) + _sqlite3SelectDelete(tls, db, pSelect) + break + } + goto _1 + _1: + ; + pStep = (*TTriggerStep)(unsafe.Pointer(pStep)).FpNext + } + return 0 +} + +// C documentation +// +// /* +// ** Parse context structure pFrom has just been used to create a sub-vdbe +// ** (trigger program). If an error has occurred, transfer error information +// ** from pFrom to pTo. +// */ +func _transferParseError(tls *libc.TLS, pTo uintptr, pFrom uintptr) { + if (*TParse)(unsafe.Pointer(pTo)).FnErr == 0 { + (*TParse)(unsafe.Pointer(pTo)).FzErrMsg = (*TParse)(unsafe.Pointer(pFrom)).FzErrMsg + (*TParse)(unsafe.Pointer(pTo)).FnErr = (*TParse)(unsafe.Pointer(pFrom)).FnErr + (*TParse)(unsafe.Pointer(pTo)).Frc = (*TParse)(unsafe.Pointer(pFrom)).Frc + } else { + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pFrom)).Fdb, (*TParse)(unsafe.Pointer(pFrom)).FzErrMsg) + } +} + +// C documentation +// +// /* +// ** Create and populate a new TriggerPrg object with a sub-program +// ** implementing trigger pTrigger with ON CONFLICT policy orconf. +// */ +func _codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, orconf int32) (r uintptr) { + bp := tls.Alloc(496) + defer tls.Free(496) + var db, pPrg, pProgram, pTop, pWhen, v, v1, v2 uintptr + var iEndTrigger int32 + var _ /* sNC at bp+0 */ TNameContext + var _ /* sSubParse at bp+56 */ TParse + _, _, _, _, _, _, _, _, _ = db, iEndTrigger, pPrg, pProgram, pTop, pWhen, v, v1, v2 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pTop = v1 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Value to return */ + pWhen = uintptr(0) /* Name context for sub-vdbe */ + pProgram = uintptr(0) /* Sub-vdbe for trigger program */ + iEndTrigger = 0 /* Parse context for sub-vdbe */ + /* Allocate the TriggerPrg and SubProgram objects. To ensure that they + ** are freed if an error occurs, link them into the Parse.pTriggerPrg + ** list of the top-level Parse object sooner rather than later. */ + pPrg = _sqlite3DbMallocZero(tls, db, uint64(40)) + if !(pPrg != 0) { + return uintptr(0) + } + (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext = (*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg + (*TParse)(unsafe.Pointer(pTop)).FpTriggerPrg = pPrg + v2 = _sqlite3DbMallocZero(tls, db, uint64(48)) + pProgram = v2 + (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpProgram = v2 + if !(pProgram != 0) { + return uintptr(0) + } + _sqlite3VdbeLinkSubProgram(tls, (*TParse)(unsafe.Pointer(pTop)).FpVdbe, pProgram) + (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpTrigger = pTrigger + (*TTriggerPrg)(unsafe.Pointer(pPrg)).Forconf = orconf + *(*Tu32)(unsafe.Pointer(pPrg + 28)) = uint32(0xffffffff) + *(*Tu32)(unsafe.Pointer(pPrg + 28 + 1*4)) = uint32(0xffffffff) + /* Allocate and populate a new Parse context to use for coding the + ** trigger sub-program. */ + _sqlite3ParseObjectInit(tls, bp+56, db) + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = bp + 56 + (*(*TParse)(unsafe.Pointer(bp + 56))).FpTriggerTab = pTab + (*(*TParse)(unsafe.Pointer(bp + 56))).FpToplevel = pTop + (*(*TParse)(unsafe.Pointer(bp + 56))).FzAuthContext = (*TTrigger)(unsafe.Pointer(pTrigger)).FzName + (*(*TParse)(unsafe.Pointer(bp + 56))).FeTriggerOp = (*TTrigger)(unsafe.Pointer(pTrigger)).Fop + (*(*TParse)(unsafe.Pointer(bp + 56))).FnQueryLoop = (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop + (*(*TParse)(unsafe.Pointer(bp + 56))).FprepFlags = (*TParse)(unsafe.Pointer(pParse)).FprepFlags + v = _sqlite3GetVdbe(tls, bp+56) + if v != 0 { + if (*TTrigger)(unsafe.Pointer(pTrigger)).FzName != 0 { + _sqlite3VdbeChangeP4(tls, v, -int32(1), _sqlite3MPrintf(tls, db, __ccgo_ts+20998, libc.VaList(bp+488, (*TTrigger)(unsafe.Pointer(pTrigger)).FzName)), -int32(6)) + } + /* If one was specified, code the WHEN clause. If it evaluates to false + ** (or NULL) the sub-vdbe is immediately halted by jumping to the + ** OP_Halt inserted at the end of the program. */ + if (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen != 0 { + pWhen = _sqlite3ExprDup(tls, db, (*TTrigger)(unsafe.Pointer(pTrigger)).FpWhen, 0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 && SQLITE_OK == _sqlite3ResolveExprNames(tls, bp, pWhen) { + iEndTrigger = _sqlite3VdbeMakeLabel(tls, bp+56) + _sqlite3ExprIfFalse(tls, bp+56, pWhen, iEndTrigger, int32(SQLITE_JUMPIFNULL)) + } + _sqlite3ExprDelete(tls, db, pWhen) + } + /* Code the trigger program into the sub-vdbe. */ + _codeTriggerProgram(tls, bp+56, (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list, orconf) + /* Insert an OP_Halt at the end of the sub-program. */ + if iEndTrigger != 0 { + _sqlite3VdbeResolveLabel(tls, v, iEndTrigger) + } + _sqlite3VdbeAddOp0(tls, v, int32(OP_Halt)) + _transferParseError(tls, pParse, bp+56) + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + (*TSubProgram)(unsafe.Pointer(pProgram)).FaOp = _sqlite3VdbeTakeOpArray(tls, v, pProgram+8, pTop+144) + } + (*TSubProgram)(unsafe.Pointer(pProgram)).FnMem = (*(*TParse)(unsafe.Pointer(bp + 56))).FnMem + (*TSubProgram)(unsafe.Pointer(pProgram)).FnCsr = (*(*TParse)(unsafe.Pointer(bp + 56))).FnTab + (*TSubProgram)(unsafe.Pointer(pProgram)).Ftoken = pTrigger + *(*Tu32)(unsafe.Pointer(pPrg + 28)) = (*(*TParse)(unsafe.Pointer(bp + 56))).Foldmask + *(*Tu32)(unsafe.Pointer(pPrg + 28 + 1*4)) = (*(*TParse)(unsafe.Pointer(bp + 56))).Fnewmask + _sqlite3VdbeDelete(tls, v) + } else { + _transferParseError(tls, pParse, bp+56) + } + _sqlite3ParseObjectReset(tls, bp+56) + return pPrg +} + +// C documentation +// +// /* +// ** Return a pointer to a TriggerPrg object containing the sub-program for +// ** trigger pTrigger with default ON CONFLICT algorithm orconf. If no such +// ** TriggerPrg object exists, a new object is allocated and populated before +// ** being returned. +// */ +func _getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, orconf int32) (r uintptr) { + var pPrg, pRoot, v1 uintptr + _, _, _ = pPrg, pRoot, v1 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pRoot = v1 + /* It may be that this trigger has already been coded (or is in the + ** process of being coded). If this is the case, then an entry with + ** a matching TriggerPrg.pTrigger field will be present somewhere + ** in the Parse.pTriggerPrg list. Search for such an entry. */ + pPrg = (*TParse)(unsafe.Pointer(pRoot)).FpTriggerPrg + for { + if !(pPrg != 0 && ((*TTriggerPrg)(unsafe.Pointer(pPrg)).FpTrigger != pTrigger || (*TTriggerPrg)(unsafe.Pointer(pPrg)).Forconf != orconf)) { + break + } + goto _2 + _2: + ; + pPrg = (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpNext + } + /* If an existing TriggerPrg could not be located, create a new one. */ + if !(pPrg != 0) { + pPrg = _codeRowTrigger(tls, pParse, pTrigger, pTab, orconf) + (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FerrByteOffset = -int32(1) + } + return pPrg +} + +// C documentation +// +// /* +// ** Generate code for the trigger program associated with trigger p on +// ** table pTab. The reg, orconf and ignoreJump parameters passed to this +// ** function are the same as those described in the header function for +// ** sqlite3CodeRowTrigger() +// */ +func _sqlite3CodeRowTriggerDirect(tls *libc.TLS, pParse uintptr, p uintptr, pTab uintptr, reg int32, orconf int32, ignoreJump int32) { + var bRecursive, v1 int32 + var pPrg, v, v2 uintptr + _, _, _, _, _ = bRecursive, pPrg, v, v1, v2 + v = _sqlite3GetVdbe(tls, pParse) + pPrg = _getRowTrigger(tls, pParse, p, pTab, orconf) + /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program + ** is a pointer to the sub-vdbe containing the trigger program. */ + if pPrg != 0 { + bRecursive = libc.BoolInt32((*TTrigger)(unsafe.Pointer(p)).FzName != 0 && uint64(0) == (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_RecTriggers)) + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Program), reg, ignoreJump, v1, (*TTriggerPrg)(unsafe.Pointer(pPrg)).FpProgram, -int32(4)) + /* Set the P5 operand of the OP_Program instruction to non-zero if + ** recursive invocation of this trigger program is disallowed. Recursive + ** invocation is disallowed if (a) the sub-program is really a trigger, + ** not a foreign key action, and (b) the flag to enable recursive triggers + ** is clear. */ + _sqlite3VdbeChangeP5(tls, v, uint16(uint8(bRecursive))) + } +} + +// C documentation +// +// /* +// ** This is called to code the required FOR EACH ROW triggers for an operation +// ** on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE) +// ** is given by the op parameter. The tr_tm parameter determines whether the +// ** BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then +// ** parameter pChanges is passed the list of columns being modified. +// ** +// ** If there are no triggers that fire at the specified time for the specified +// ** operation on pTab, this function is a no-op. +// ** +// ** The reg argument is the address of the first in an array of registers +// ** that contain the values substituted for the new.* and old.* references +// ** in the trigger program. If N is the number of columns in table pTab +// ** (a copy of pTab->nCol), then registers are populated as follows: +// ** +// ** Register Contains +// ** ------------------------------------------------------ +// ** reg+0 OLD.rowid +// ** reg+1 OLD.* value of left-most column of pTab +// ** ... ... +// ** reg+N OLD.* value of right-most column of pTab +// ** reg+N+1 NEW.rowid +// ** reg+N+2 NEW.* value of left-most column of pTab +// ** ... ... +// ** reg+N+N+1 NEW.* value of right-most column of pTab +// ** +// ** For ON DELETE triggers, the registers containing the NEW.* values will +// ** never be accessed by the trigger program, so they are not allocated or +// ** populated by the caller (there is no data to populate them with anyway). +// ** Similarly, for ON INSERT triggers the values stored in the OLD.* registers +// ** are never accessed, and so are not allocated by the caller. So, for an +// ** ON INSERT trigger, the value passed to this function as parameter reg +// ** is not a readable register, although registers (reg+N) through +// ** (reg+N+N+1) are. +// ** +// ** Parameter orconf is the default conflict resolution algorithm for the +// ** trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump +// ** is the instruction that control should jump to if a trigger program +// ** raises an IGNORE exception. +// */ +func _sqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op int32, pChanges uintptr, tr_tm int32, pTab uintptr, reg int32, orconf int32, ignoreJump int32) { + var p uintptr + _ = p /* Used to iterate through pTrigger list */ + p = pTrigger + for { + if !(p != 0) { + break + } + /* Sanity checking: The schema for the trigger and for the table are + ** always defined. The trigger must be in the same schema as the table + ** or else it must be a TEMP trigger. */ + /* Determine whether we should code this trigger. One of two choices: + ** 1. The trigger is an exact match to the current DML statement + ** 2. This is a RETURNING trigger for INSERT but we are currently + ** doing the UPDATE part of an UPSERT. + */ + if (int32((*TTrigger)(unsafe.Pointer(p)).Fop) == op || (*TTrigger)(unsafe.Pointer(p)).FbReturning != 0 && int32((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_INSERT) && op == int32(TK_UPDATE)) && int32((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) == tr_tm && _checkColumnOverlap(tls, (*TTrigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0 { + if !((*TTrigger)(unsafe.Pointer(p)).FbReturning != 0) { + _sqlite3CodeRowTriggerDirect(tls, pParse, p, pTab, reg, orconf, ignoreJump) + } else { + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) { + _codeReturningTrigger(tls, pParse, p, pTab, reg) + } + } + } + goto _1 + _1: + ; + p = (*TTrigger)(unsafe.Pointer(p)).FpNext + } +} + +// C documentation +// +// /* +// ** Triggers may access values stored in the old.* or new.* pseudo-table. +// ** This function returns a 32-bit bitmask indicating which columns of the +// ** old.* or new.* tables actually are used by triggers. This information +// ** may be used by the caller, for example, to avoid having to load the entire +// ** old.* record into memory when executing an UPDATE or DELETE command. +// ** +// ** Bit 0 of the returned mask is set if the left-most column of the +// ** table may be accessed using an [old|new].reference. Bit 1 is set if +// ** the second leftmost column value is required, and so on. If there +// ** are more than 32 columns in the table, and at least one of the columns +// ** with an index greater than 32 may be accessed, 0xffffffff is returned. +// ** +// ** It is not possible to determine if the old.rowid or new.rowid column is +// ** accessed by triggers. The caller must always assume that it is. +// ** +// ** Parameter isNew must be either 1 or 0. If it is 0, then the mask returned +// ** applies to the old.* table. If 1, the new.* table. +// ** +// ** Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE +// ** and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only +// ** included in the returned mask if the TRIGGER_BEFORE bit is set in the +// ** tr_tm parameter. Similarly, values accessed by AFTER triggers are only +// ** included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm. +// */ +func _sqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pChanges uintptr, isNew int32, tr_tm int32, pTab uintptr, orconf int32) (r Tu32) { + var mask Tu32 + var op, v1 int32 + var p, pPrg uintptr + _, _, _, _, _ = mask, op, p, pPrg, v1 + if pChanges != 0 { + v1 = int32(TK_UPDATE) + } else { + v1 = int32(TK_DELETE) + } + op = v1 + mask = uint32(0) + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + return uint32(0xffffffff) + } + p = pTrigger + for { + if !(p != 0) { + break + } + if int32((*TTrigger)(unsafe.Pointer(p)).Fop) == op && tr_tm&int32((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) != 0 && _checkColumnOverlap(tls, (*TTrigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0 { + if (*TTrigger)(unsafe.Pointer(p)).FbReturning != 0 { + mask = uint32(0xffffffff) + } else { + pPrg = _getRowTrigger(tls, pParse, p, pTab, orconf) + if pPrg != 0 { + mask |= *(*Tu32)(unsafe.Pointer(pPrg + 28 + uintptr(isNew)*4)) + } + } + } + goto _2 + _2: + ; + p = (*TTrigger)(unsafe.Pointer(p)).FpNext + } + return mask +} + +// C documentation +// +// /* +// ** The most recently coded instruction was an OP_Column to retrieve the +// ** i-th column of table pTab. This routine sets the P4 parameter of the +// ** OP_Column to the default value, if any. +// ** +// ** The default value of a column is specified by a DEFAULT clause in the +// ** column definition. This was either supplied by the user when the table +// ** was created, or added later to the table definition by an ALTER TABLE +// ** command. If the latter, then the row-records in the table btree on disk +// ** may not contain a value for the column and the default value, taken +// ** from the P4 parameter of the OP_Column instruction, is returned instead. +// ** If the former, then all row-records are guaranteed to include a value +// ** for the column and the P4 value is not required. +// ** +// ** Column definitions created by an ALTER TABLE command may only have +// ** literal default values specified: a number, null or a string. (If a more +// ** complicated default expression value was provided, it is evaluated +// ** when the ALTER TABLE is executed and one of the literal values written +// ** into the sqlite_schema table.) +// ** +// ** Therefore, the P4 parameter is only required if the default value for +// ** the column is a literal number, string or null. The sqlite3ValueFromExpr() +// ** function is capable of transforming these types of expressions into +// ** sqlite3_value objects. +// ** +// ** If column as REAL affinity and the table is an ordinary b-tree table +// ** (not a virtual table) then the value might have been stored as an +// ** integer. In that case, add an OP_RealAffinity opcode to make sure +// ** it has been converted into REAL. +// */ +func _sqlite3ColumnDefault(tls *libc.TLS, v uintptr, pTab uintptr, i int32, iReg int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var enc Tu8 + var pCol uintptr + var _ /* pValue at bp+0 */ uintptr + _, _ = enc, pCol + pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16 + if (*TColumn)(unsafe.Pointer(pCol)).FiDflt != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + enc = (*Tsqlite3)(unsafe.Pointer(_sqlite3VdbeDb(tls, v))).Fenc + _sqlite3ValueFromExpr(tls, _sqlite3VdbeDb(tls, v), _sqlite3ColumnExpr(tls, pTab, pCol), enc, uint8((*TColumn)(unsafe.Pointer(pCol)).Faffinity), bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + _sqlite3VdbeAppendP4(tls, v, *(*uintptr)(unsafe.Pointer(bp)), -int32(10)) + } + } + if int32((*TColumn)(unsafe.Pointer(pCol)).Faffinity) == int32(SQLITE_AFF_REAL) && !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), iReg) + } +} + +// C documentation +// +// /* +// ** Check to see if column iCol of index pIdx references any of the +// ** columns defined by aXRef and chngRowid. Return true if it does +// ** and false if not. This is an optimization. False-positives are a +// ** performance degradation, but false-negatives can result in a corrupt +// ** index and incorrect answers. +// ** +// ** aXRef[j] will be non-negative if column j of the original table is +// ** being updated. chngRowid will be true if the rowid of the table is +// ** being updated. +// */ +func _indexColumnIsBeingUpdated(tls *libc.TLS, pIdx uintptr, iCol int32, aXRef uintptr, chngRowid int32) (r int32) { + var iIdxCol Ti16 + _ = iIdxCol + iIdxCol = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2)) + /* Cannot index rowid */ + if int32(iIdxCol) >= 0 { + return libc.BoolInt32(*(*int32)(unsafe.Pointer(aXRef + uintptr(iIdxCol)*4)) >= 0) + } + return _sqlite3ExprReferencesUpdatedColumn(tls, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(iCol)*32))).FpExpr, aXRef, chngRowid) +} + +// C documentation +// +// /* +// ** Check to see if index pIdx is a partial index whose conditional +// ** expression might change values due to an UPDATE. Return true if +// ** the index is subject to change and false if the index is guaranteed +// ** to be unchanged. This is an optimization. False-positives are a +// ** performance degradation, but false-negatives can result in a corrupt +// ** index and incorrect answers. +// ** +// ** aXRef[j] will be non-negative if column j of the original table is +// ** being updated. chngRowid will be true if the rowid of the table is +// ** being updated. +// */ +func _indexWhereClauseMightChange(tls *libc.TLS, pIdx uintptr, aXRef uintptr, chngRowid int32) (r int32) { + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { + return 0 + } + return _sqlite3ExprReferencesUpdatedColumn(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere, aXRef, chngRowid) +} + +// C documentation +// +// /* +// ** Allocate and return a pointer to an expression of type TK_ROW with +// ** Expr.iColumn set to value (iCol+1). The resolver will modify the +// ** expression to be a TK_COLUMN reading column iCol of the first +// ** table in the source-list (pSrc->a[0]). +// */ +func _exprRowColumn(tls *libc.TLS, pParse uintptr, iCol int32) (r uintptr) { + var pRet uintptr + _ = pRet + pRet = _sqlite3PExpr(tls, pParse, int32(TK_ROW), uintptr(0), uintptr(0)) + if pRet != 0 { + (*TExpr)(unsafe.Pointer(pRet)).FiColumn = int16(iCol + int32(1)) + } + return pRet +} + +// C documentation +// +// /* +// ** Assuming both the pLimit and pOrderBy parameters are NULL, this function +// ** generates VM code to run the query: +// ** +// ** SELECT , pChanges FROM pTabList WHERE pWhere +// ** +// ** and write the results to the ephemeral table already opened as cursor +// ** iEph. None of pChanges, pTabList or pWhere are modified or consumed by +// ** this function, they must be deleted by the caller. +// ** +// ** Or, if pLimit and pOrderBy are not NULL, and pTab is not a view: +// ** +// ** SELECT , pChanges FROM pTabList +// ** WHERE pWhere +// ** GROUP BY +// ** ORDER BY pOrderBy LIMIT pLimit +// ** +// ** If pTab is a view, the GROUP BY clause is omitted. +// ** +// ** Exactly how results are written to table iEph, and exactly what +// ** the in the query above are is determined by the type +// ** of table pTabList->a[0].pTab. +// ** +// ** If the table is a WITHOUT ROWID table, then argument pPk must be its +// ** PRIMARY KEY. In this case are the primary key columns +// ** of the table, in order. The results of the query are written to ephemeral +// ** table iEph as index keys, using OP_IdxInsert. +// ** +// ** If the table is actually a view, then are all columns of +// ** the view. The results are written to the ephemeral table iEph as records +// ** with automatically assigned integer keys. +// ** +// ** If the table is a virtual or ordinary intkey table, then +// ** is its rowid. For a virtual table, the results are written to iEph as +// ** records with automatically assigned integer keys For intkey tables, the +// ** rowid value in is used as the integer key, and the +// ** remaining fields make up the table record. +// */ +func _updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, pChanges uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var db, pGrp, pLimit2, pList, pNew, pOrderBy2, pSelect, pSrc, pTab, pWhere2 uintptr + var eDest, i, v2, v4, v6 int32 + var _ /* dest at bp+0 */ TSelectDest + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, eDest, i, pGrp, pLimit2, pList, pNew, pOrderBy2, pSelect, pSrc, pTab, pWhere2, v2, v4, v6 + pSelect = uintptr(0) + pList = uintptr(0) + pGrp = uintptr(0) + pLimit2 = uintptr(0) + pOrderBy2 = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab + _ = pOrderBy + _ = pLimit + pSrc = _sqlite3SrcListDup(tls, db, pTabList, 0) + pWhere2 = _sqlite3ExprDup(tls, db, pWhere, 0) + if pSrc != 0 { + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FiCursor = -int32(1) + (*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab)).FnTabRef-- + (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FpTab = uintptr(0) + } + if pPk != 0 { + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + pNew = _exprRowColumn(tls, pParse, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) + pList = _sqlite3ExprListAppend(tls, pParse, pList, pNew) + goto _1 + _1: + ; + i++ + } + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + v2 = int32(SRT_Table) + } else { + v2 = int32(SRT_Upfrom) + } + eDest = v2 + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, _exprRowColumn(tls, pParse, i)) + goto _3 + _3: + ; + i++ + } + eDest = int32(SRT_Table) + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + v4 = int32(SRT_Table) + } else { + v4 = int32(SRT_Upfrom) + } + eDest = v4 + pList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3PExpr(tls, pParse, int32(TK_ROW), uintptr(0), uintptr(0))) + } + } + if pChanges != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pChanges)).FnExpr) { + break + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr, 0)) + goto _5 + _5: + ; + i++ + } + } + pSelect = _sqlite3SelectNew(tls, pParse, pList, pSrc, pWhere2, pGrp, uintptr(0), pOrderBy2, uint32(libc.Int32FromInt32(SF_UFSrcCheck)|libc.Int32FromInt32(SF_IncludeHidden)|libc.Int32FromInt32(SF_UpdateFrom)), pLimit2) + if pSelect != 0 { + *(*Tu32)(unsafe.Pointer(pSelect + 4)) |= uint32(SF_OrderByReqd) + } + _sqlite3SelectDestInit(tls, bp, eDest, iEph) + if pPk != 0 { + v6 = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + } else { + v6 = -int32(1) + } + (*(*TSelectDest)(unsafe.Pointer(bp))).FiSDParm2 = v6 + _sqlite3Select(tls, pParse, pSelect, bp) + _sqlite3SelectDelete(tls, db, pSelect) +} + +// C documentation +// +// /* +// ** Process an UPDATE statement. +// ** +// ** UPDATE OR IGNORE tbl SET a=b, c=d FROM tbl2... WHERE e<5 AND f NOT NULL; +// ** \_______/ \_/ \______/ \_____/ \________________/ +// ** onError | pChanges | pWhere +// ** \_______________________/ +// ** pTabList +// */ +func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges uintptr, pWhere uintptr, onError int32, pOrderBy uintptr, pLimit uintptr, pUpsert uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var aRegIdx, aToOpen, aXRef, db, pIdx, pKeyInfo, pPk, pRowidExpr, pTab, pTrigger, pWInfo, v, v11, v16, v19, v21, v24, v26, v29, v31, v34, v37, v39, v4, v5 uintptr + var addrOnce, addrOpen, addrTop, bFinishSeek, bProgress, eOnePass, flags, hasFK, i, iBaseCur, iCur, iDataCur, iDb, iEph, iIdxCur, iPk, iRowidExpr, isView, j, k, labelBreak, labelContinue, nAllIdx, nChangeFrom, nEphCol, nIdx, nKey, nOff, newmask, rc, reg, regKey, regNew, regNewRowid, regOld, regOldRowid, regRowCount, regRowSet, v1, v15, v18, v2, v20, v22, v23, v25, v27, v28, v3, v30, v32, v33, v35, v36, v38, v41, v46, v48, v49 int32 + var chngKey, chngPk, chngRowid, hCol, v8 Tu8 + var colFlags, oldmask Tu32 + var nPk Ti16 + var v13 uint64 + var v43 uint32 + var _ /* aiCurOnePass at bp+80 */ [2]int32 + var _ /* bReplace at bp+88 */ int32 + var _ /* iNotUsed1 at bp+92 */ int32 + var _ /* iNotUsed2 at bp+96 */ int32 + var _ /* sContext at bp+0 */ TAuthContext + var _ /* sNC at bp+16 */ TNameContext + var _ /* tmask at bp+72 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aRegIdx, aToOpen, aXRef, addrOnce, addrOpen, addrTop, bFinishSeek, bProgress, chngKey, chngPk, chngRowid, colFlags, db, eOnePass, flags, hCol, hasFK, i, iBaseCur, iCur, iDataCur, iDb, iEph, iIdxCur, iPk, iRowidExpr, isView, j, k, labelBreak, labelContinue, nAllIdx, nChangeFrom, nEphCol, nIdx, nKey, nOff, nPk, newmask, oldmask, pIdx, pKeyInfo, pPk, pRowidExpr, pTab, pTrigger, pWInfo, rc, reg, regKey, regNew, regNewRowid, regOld, regOldRowid, regRowCount, regRowSet, v, v1, v11, v13, v15, v16, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v41, v43, v46, v48, v49, v5, v8 /* The table to be updated */ + addrTop = 0 /* VDBE instruction address of the start of the loop */ + pWInfo = uintptr(0) /* The database structure */ + aRegIdx = uintptr(0) /* Registers for to each index and the main table */ + aXRef = uintptr(0) /* Either chngPk or chngRowid */ + pRowidExpr = uintptr(0) /* Expression defining the new record number */ + iRowidExpr = -int32(1) /* Mask of NEW.* columns accessed by BEFORE triggers */ + iEph = 0 /* Ephemeral table holding all primary key values */ + nKey = 0 /* The write cursors opened by WHERE_ONEPASS */ + addrOpen = 0 /* Address of OP_OpenEphemeral */ + iPk = 0 /* First of nPk cells holding PRIMARY KEY value */ + nPk = 0 /* Number of components of the PRIMARY KEY */ + *(*int32)(unsafe.Pointer(bp + 88)) = 0 /* True if REPLACE conflict resolution might happen */ + bFinishSeek = int32(1) /* The OP_FinishSeek opcode is needed */ + nChangeFrom = 0 /* If there is a FROM, pChanges->nExpr, else 0 */ + /* Register Allocations */ + regRowCount = 0 /* A count of rows changed */ + regOldRowid = 0 /* The old rowid */ + regNewRowid = 0 /* The new rowid */ + regNew = 0 /* Content of the NEW.* table in triggers */ + regOld = 0 /* Content of OLD.* table in triggers */ + regRowSet = 0 /* Rowset of rows to be updated */ + regKey = 0 /* composite PRIMARY KEY value */ + libc.Xmemset(tls, bp, 0, uint64(16)) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto update_cleanup + } + /* Locate the table which we want to update. + */ + pTab = _sqlite3SrcListLookup(tls, pParse, pTabList) + if pTab == uintptr(0) { + goto update_cleanup + } + iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + /* Figure out if we have any triggers and if the table being + ** updated is a view. + */ + pTrigger = _sqlite3TriggersExist(tls, pParse, pTab, int32(TK_UPDATE), pChanges, bp+72) + isView = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW)) + /* If there was a FROM clause, set nChangeFrom to the number of expressions + ** in the change-list. Otherwise, set it to 0. There cannot be a FROM + ** clause if this function is being called to generate code for part of + ** an UPSERT statement. */ + if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(1) { + v1 = (*TExprList)(unsafe.Pointer(pChanges)).FnExpr + } else { + v1 = 0 + } + nChangeFrom = v1 + if _sqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + goto update_cleanup + } + if _sqlite3IsReadOnly(tls, pParse, pTab, pTrigger) != 0 { + goto update_cleanup + } + /* Allocate a cursors for the main database table and for all indices. + ** The index cursors might not be used, but if they are used they + ** need to occur right after the database cursor. So go ahead and + ** allocate enough space, just in case. + */ + v4 = pParse + 52 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + v2 = v3 + iDataCur = v2 + iBaseCur = v2 + iIdxCur = iDataCur + int32(1) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + v5 = uintptr(0) + } else { + v5 = _sqlite3PrimaryKeyIndex(tls, pTab) + } + pPk = v5 + nIdx = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if pPk == pIdx { + iDataCur = (*TParse)(unsafe.Pointer(pParse)).FnTab + } + (*TParse)(unsafe.Pointer(pParse)).FnTab++ + goto _6 + _6: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + nIdx++ + } + if pUpsert != 0 { + /* On an UPSERT, reuse the same cursors already opened by INSERT */ + iDataCur = (*TUpsert)(unsafe.Pointer(pUpsert)).FiDataCur + iIdxCur = (*TUpsert)(unsafe.Pointer(pUpsert)).FiIdxCur + (*TParse)(unsafe.Pointer(pParse)).FnTab = iBaseCur + } + (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FiCursor = iDataCur + /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. + ** Initialize aXRef[] and aToOpen[] to their default values. + */ + aXRef = _sqlite3DbMallocRawNN(tls, db, uint64(4)*uint64(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+nIdx+libc.Int32FromInt32(1))+uint64(nIdx)+uint64(2)) + if aXRef == uintptr(0) { + goto update_cleanup + } + aRegIdx = aXRef + uintptr((*TTable)(unsafe.Pointer(pTab)).FnCol)*4 + aToOpen = aRegIdx + uintptr(nIdx)*4 + libc.UintptrFromInt32(1)*4 + libc.Xmemset(tls, aToOpen, int32(1), uint64(nIdx+int32(1))) + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(nIdx+int32(1)))) = uint8(0) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -int32(1) + goto _7 + _7: + ; + i++ + } + /* Initialize the name-context */ + libc.Xmemset(tls, bp+16, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp + 16))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp + 16))).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 16 + 16)) = pUpsert + (*(*TNameContext)(unsafe.Pointer(bp + 16))).FncFlags = int32(NC_UUpsert) + /* Begin generating code. */ + v = _sqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + goto update_cleanup + } + /* Resolve the column names in all the expressions of the + ** of the UPDATE statement. Also find the column index + ** for each column to be updated in the pChanges array. For each + ** column to be updated, make sure we have authorization to change + ** that column. + */ + v8 = libc.Uint8FromInt32(0) + chngPk = v8 + chngRowid = v8 + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pChanges)).FnExpr) { + break + } + hCol = _sqlite3StrIHash(tls, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName) + /* If this is an UPDATE with a FROM clause, do not resolve expressions + ** here. The call to sqlite3Select() below will do that. */ + if nChangeFrom == 0 && _sqlite3ResolveExprNames(tls, bp+16, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr) != 0 { + goto update_cleanup + } + j = 0 + for { + if !(j < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FhName) == int32(hCol) && _sqlite3StrICmp(tls, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName) == 0 { + if j == int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) { + chngRowid = uint8(1) + pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr + iRowidExpr = i + } else { + if pPk != 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0 { + chngPk = uint8(1) + } else { + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_GENERATED) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21012, libc.VaList(bp+112, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName)) + goto update_cleanup + } + } + } + *(*int32)(unsafe.Pointer(aXRef + uintptr(j)*4)) = i + break + } + goto _10 + _10: + ; + j++ + } + if j >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + if pPk == uintptr(0) && _sqlite3IsRowid(tls, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName) != 0 { + j = -int32(1) + chngRowid = uint8(1) + pRowidExpr = (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FpExpr + iRowidExpr = i + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21048, libc.VaList(bp+112, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(i)*32))).FzEName)) + (*TParse)(unsafe.Pointer(pParse)).FcheckSchema = uint8(1) + goto update_cleanup + } + } + if j < 0 { + v11 = __ccgo_ts + 7937 + } else { + v11 = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FzCnName + } + rc = _sqlite3AuthCheck(tls, pParse, int32(SQLITE_UPDATE), (*TTable)(unsafe.Pointer(pTab)).FzName, v11, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + if rc == int32(SQLITE_DENY) { + goto update_cleanup + } else { + if rc == int32(SQLITE_IGNORE) { + *(*int32)(unsafe.Pointer(aXRef + uintptr(j)*4)) = -int32(1) + } + } + goto _9 + _9: + ; + i++ + } + chngKey = uint8(int32(chngRowid) + int32(chngPk)) + /* Mark generated columns as changing if their generator expressions + ** reference any changing column. The actual aXRef[] value for + ** generated expressions is not used, other than to check to see that it + ** is non-negative, so the value of aXRef[] for generated columns can be + ** set to any non-negative number. We use 99999 so that the value is + ** obvious when looking at aXRef[] in a symbolic debugger. + */ + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != 0 { + for cond := true; cond; cond = bProgress != 0 { + bProgress = 0 + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { + goto _12 + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags)&int32(COLFLAG_GENERATED) == 0 { + goto _12 + } + if _sqlite3ExprReferencesUpdatedColumn(tls, _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*16), aXRef, int32(chngRowid)) != 0 { + *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = int32(99999) + bProgress = int32(1) + } + goto _12 + _12: + ; + i++ + } + } + } + /* The SET expressions are not actually used inside the WHERE loop. + ** So reset the colUsed mask. Unless this is a virtual table. In that + ** case, set all bits of the colUsed mask (to ensure that the virtual + ** table implementation makes all columns available). + */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + v13 = uint64(-libc.Int32FromInt32(1)) + } else { + v13 = uint64(0) + } + (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FcolUsed = v13 + hasFK = _sqlite3FkRequired(tls, pParse, pTab, aXRef, int32(chngKey)) + /* There is one entry in the aRegIdx[] array for each index on the table + ** being updated. Fill in aRegIdx[] with a register number that will hold + ** the key for accessing each index. + */ + if onError == int32(OE_Replace) { + *(*int32)(unsafe.Pointer(bp + 88)) = int32(1) + } + nAllIdx = 0 + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if chngKey != 0 || hasFK > int32(1) || pIdx == pPk || _indexWhereClauseMightChange(tls, pIdx, aXRef, int32(chngRowid)) != 0 { + v16 = pParse + 56 + *(*int32)(unsafe.Pointer(v16))++ + v15 = *(*int32)(unsafe.Pointer(v16)) + reg = v15 + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } else { + reg = 0 + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + if _indexColumnIsBeingUpdated(tls, pIdx, i, aXRef, int32(chngRowid)) != 0 { + v19 = pParse + 56 + *(*int32)(unsafe.Pointer(v19))++ + v18 = *(*int32)(unsafe.Pointer(v19)) + reg = v18 + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + if onError == int32(OE_Default) && int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) == int32(OE_Replace) { + *(*int32)(unsafe.Pointer(bp + 88)) = int32(1) + } + break + } + goto _17 + _17: + ; + i++ + } + } + if reg == 0 { + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(nAllIdx+int32(1)))) = uint8(0) + } + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg + goto _14 + _14: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + nAllIdx++ + } + v21 = pParse + 56 + *(*int32)(unsafe.Pointer(v21))++ + v20 = *(*int32)(unsafe.Pointer(v21)) + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = v20 /* Register storing the table record */ + if *(*int32)(unsafe.Pointer(bp + 88)) != 0 { + /* If REPLACE conflict resolution might be invoked, open cursors on all + ** indexes in case they are needed to delete records. */ + libc.Xmemset(tls, aToOpen, int32(1), uint64(nIdx+int32(1))) + } + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { + _sqlite3VdbeCountChanges(tls, v) + } + _sqlite3BeginWriteOperation(tls, pParse, libc.BoolInt32(pTrigger != 0 || hasFK != 0), iDb) + /* Allocate required registers. */ + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + /* For now, regRowSet and aRegIdx[nAllIdx] share the same register. + ** If regRowSet turns out to be needed, then aRegIdx[nAllIdx] will be + ** reallocated. aRegIdx[nAllIdx] is the register in which the main + ** table record is written. regRowSet holds the RowSet for the + ** two-pass update algorithm. */ + regRowSet = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) + v24 = pParse + 56 + *(*int32)(unsafe.Pointer(v24))++ + v23 = *(*int32)(unsafe.Pointer(v24)) + v22 = v23 + regNewRowid = v22 + regOldRowid = v22 + if chngPk != 0 || pTrigger != 0 || hasFK != 0 { + regOld = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + } + if chngKey != 0 || pTrigger != 0 || hasFK != 0 { + v26 = pParse + 56 + *(*int32)(unsafe.Pointer(v26))++ + v25 = *(*int32)(unsafe.Pointer(v26)) + regNewRowid = v25 + } + regNew = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + } + /* Start the view context. */ + if isView != 0 { + _sqlite3AuthContextPush(tls, pParse, bp, (*TTable)(unsafe.Pointer(pTab)).FzName) + } + /* If we are trying to update a view, realize that view into + ** an ephemeral table. + */ + if nChangeFrom == 0 && isView != 0 { + _sqlite3MaterializeView(tls, pParse, pTab, pWhere, pOrderBy, pLimit, iDataCur) + pOrderBy = uintptr(0) + pLimit = uintptr(0) + } + /* Resolve the column names in all the expressions in the + ** WHERE clause. + */ + if nChangeFrom == 0 && _sqlite3ResolveExprNames(tls, bp+16, pWhere) != 0 { + goto update_cleanup + } + /* Virtual tables must be handled separately */ + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _updateVirtualTable(tls, pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef, pWhere, onError) + goto update_cleanup + } + /* Jump to labelBreak to abandon further processing of this UPDATE */ + v27 = _sqlite3VdbeMakeLabel(tls, pParse) + labelBreak = v27 + labelContinue = v27 + /* Not an UPSERT. Normal processing. Begin by + ** initialize the count of updated rows */ + if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&(uint64(libc.Int32FromInt32(0x00001))<? + ** + ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI + ** strategy that uses an index for which one or more columns are being + ** updated. */ + eOnePass = _sqlite3WhereOkOnePass(tls, pWInfo, bp+80) + bFinishSeek = _sqlite3WhereUsesDeferredSeek(tls, pWInfo) + if eOnePass != int32(ONEPASS_SINGLE) { + _sqlite3MultiWrite(tls, pParse) + if eOnePass == int32(ONEPASS_MULTI) { + iCur = (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] + if iCur >= 0 && iCur != iDataCur && *(*Tu8)(unsafe.Pointer(aToOpen + uintptr(iCur-iBaseCur))) != 0 { + eOnePass = ONEPASS_OFF + } + } + } + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF + ** mode, write the rowid into the FIFO. In either of the one-pass modes, + ** leave it in register regOldRowid. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iDataCur, regOldRowid) + if eOnePass == ONEPASS_OFF { + v39 = pParse + 56 + *(*int32)(unsafe.Pointer(v39))++ + v38 = *(*int32)(unsafe.Pointer(v39)) + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = v38 + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iEph, regRowSet, regOldRowid) + } else { + if addrOpen != 0 { + _sqlite3VdbeChangeToNoop(tls, v, addrOpen) + } + } + } else { + /* Read the PK of the current row into an array of registers. In + ** ONEPASS_OFF mode, serialize the array into a record and store it in + ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change + ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table + ** is not required) and leave the PK fields in the array of registers. */ + i = 0 + for { + if !(i < int32(nPk)) { + break + } + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), iPk+i) + goto _40 + _40: + ; + i++ + } + if eOnePass != 0 { + if addrOpen != 0 { + _sqlite3VdbeChangeToNoop(tls, v, addrOpen) + } + nKey = int32(nPk) + regKey = iPk + } else { + _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), iPk, int32(nPk), regKey, _sqlite3IndexAffinityStr(tls, db, pPk), int32(nPk)) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), iEph, regKey, iPk, int32(nPk)) + } + } + } + if pUpsert == uintptr(0) { + if nChangeFrom == 0 && eOnePass != int32(ONEPASS_MULTI) { + _sqlite3WhereEnd(tls, pWInfo) + } + if !(isView != 0) { + addrOnce = 0 + *(*int32)(unsafe.Pointer(bp + 92)) = 0 + *(*int32)(unsafe.Pointer(bp + 96)) = 0 + /* Open every index that needs updating. */ + if eOnePass != ONEPASS_OFF { + if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[0] >= 0 { + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr((*(*[2]int32)(unsafe.Pointer(bp + 80)))[0]-iBaseCur))) = uint8(0) + } + if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] >= 0 { + *(*Tu8)(unsafe.Pointer(aToOpen + uintptr((*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)]-iBaseCur))) = uint8(0) + } + } + if eOnePass == int32(ONEPASS_MULTI) && nIdx-libc.BoolInt32((*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] >= 0) > 0 { + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + } + _sqlite3OpenTableAndIndices(tls, pParse, pTab, int32(OP_OpenWrite), uint8(0), iBaseCur, aToOpen, bp+92, bp+96) + if addrOnce != 0 { + _sqlite3VdbeJumpHereOrPopInst(tls, v, addrOnce) + } + } + /* Top of the update loop */ + if eOnePass != ONEPASS_OFF { + if (*(*[2]int32)(unsafe.Pointer(bp + 80)))[0] != iDataCur && (*(*[2]int32)(unsafe.Pointer(bp + 80)))[int32(1)] != iDataCur { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelBreak, regKey, nKey) + } + if eOnePass != int32(ONEPASS_SINGLE) { + labelContinue = _sqlite3VdbeMakeLabel(tls, pParse) + } + if pPk != 0 { + v41 = regKey + } else { + v41 = regOldRowid + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), v41, labelBreak) + } else { + if pPk != 0 || nChangeFrom != 0 { + labelContinue = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), iEph, labelBreak) + addrTop = _sqlite3VdbeCurrentAddr(tls, v) + if nChangeFrom != 0 { + if !(isView != 0) { + if pPk != 0 { + i = 0 + for { + if !(i < int32(nPk)) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, i, iPk+i) + goto _42 + _42: + ; + i++ + } + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, iPk, int32(nPk)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iEph, regOldRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_NotExists), iDataCur, labelContinue, regOldRowid) + } + } + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_RowData), iEph, regKey) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iDataCur, labelContinue, regKey, 0) + } + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rewind), iEph, labelBreak) + labelContinue = _sqlite3VdbeMakeLabel(tls, pParse) + addrTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iEph, regOldRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_NotExists), iDataCur, labelContinue, regOldRowid) + } + } + } + /* If the rowid value will change, set register regNewRowid to + ** contain the new value. If the rowid is not being modified, + ** then regNewRowid is the same register as regOldRowid, which is + ** already populated. */ + if chngRowid != 0 { + if nChangeFrom == 0 { + _sqlite3ExprCode(tls, pParse, pRowidExpr, regNewRowid) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, iRowidExpr, regNewRowid) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_MustBeInt), regNewRowid) + } + /* Compute the old pre-UPDATE content of the row being changed, if that + ** information is needed */ + if chngPk != 0 || hasFK != 0 || pTrigger != 0 { + if hasFK != 0 { + v43 = _sqlite3FkOldmask(tls, pParse, pTab) + } else { + v43 = uint32(0) + } + oldmask = v43 + oldmask |= _sqlite3TriggerColmask(tls, pParse, pTrigger, pChanges, 0, libc.Int32FromInt32(TRIGGER_BEFORE)|libc.Int32FromInt32(TRIGGER_AFTER), pTab, onError) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + colFlags = uint32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).FcolFlags) + k = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(i))) + regOld + if oldmask == uint32(0xffffffff) || i < int32(32) && oldmask&(libc.Uint32FromInt32(1)<= 0 { + if nChangeFrom != 0 { + if isView != 0 { + v46 = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + } else { + v46 = int32(nPk) + } + nOff = v46 + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, nOff+j, k) + } else { + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(j)*32))).FpExpr, k) + } + } else { + if 0 == *(*int32)(unsafe.Pointer(bp + 72))&int32(TRIGGER_BEFORE) || i > int32(31) || uint32(newmask)&(libc.Uint32FromInt32(1)< int32(1) || chngKey != 0 { + v48 = 0 + } else { + v48 = int32(OPFLAG_ISNOOP) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Delete), iDataCur, int32(OPFLAG_ISUPDATE)|v48, regNewRowid) + if eOnePass == int32(ONEPASS_MULTI) { + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) + } + if !((*TParse)(unsafe.Pointer(pParse)).Fnested != 0) { + _sqlite3VdbeAppendP4(tls, v, pTab, -int32(5)) + } + if hasFK != 0 { + _sqlite3FkCheck(tls, pParse, pTab, 0, regNewRowid, aXRef, int32(chngKey)) + } + /* Insert the new index entries and the new record. */ + if eOnePass == int32(ONEPASS_MULTI) { + v49 = int32(OPFLAG_SAVEPOSITION) + } else { + v49 = 0 + } + _sqlite3CompleteInsertion(tls, pParse, pTab, iDataCur, iIdxCur, regNewRowid, aRegIdx, int32(OPFLAG_ISUPDATE)|v49, 0, 0) + /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to + ** handle rows (possibly in other tables) that refer via a foreign key + ** to the row just updated. */ + if hasFK != 0 { + _sqlite3FkActions(tls, pParse, pTab, pChanges, regOldRowid, aXRef, int32(chngKey)) + } + } + /* Increment the row counter + */ + if regRowCount != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), regRowCount, int32(1)) + } + if pTrigger != 0 { + _sqlite3CodeRowTrigger(tls, pParse, pTrigger, int32(TK_UPDATE), pChanges, int32(TRIGGER_AFTER), pTab, regOldRowid, onError, labelContinue) + } + /* Repeat the above with the next record to be updated, until + ** all record selected by the WHERE clause have been updated. + */ + if eOnePass == int32(ONEPASS_SINGLE) { + /* Nothing to do at end-of-loop for a single-pass */ + } else { + if eOnePass == int32(ONEPASS_MULTI) { + _sqlite3VdbeResolveLabel(tls, v, labelContinue) + _sqlite3WhereEnd(tls, pWInfo) + } else { + _sqlite3VdbeResolveLabel(tls, v, labelContinue) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iEph, addrTop) + } + } + _sqlite3VdbeResolveLabel(tls, v, labelBreak) + /* Update the sqlite_sequence table by storing the content of the + ** maximum rowid counter values recorded while inserting into + ** autoincrement tables. + */ + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 && (*TParse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0) && pUpsert == uintptr(0) { + _sqlite3AutoincrementEnd(tls, pParse) + } + /* + ** Return the number of rows that were changed, if we are tracking + ** that information. + */ + if regRowCount != 0 { + _sqlite3CodeChangeCount(tls, v, regRowCount, __ccgo_ts+21067) + } +update_cleanup: + ; + _sqlite3AuthContextPop(tls, bp) + _sqlite3DbFree(tls, db, aXRef) /* Also frees aRegIdx[] and aToOpen[] */ + _sqlite3SrcListDelete(tls, db, pTabList) + _sqlite3ExprListDelete(tls, db, pChanges) + _sqlite3ExprDelete(tls, db, pWhere) + return +} + +/* Make sure "isView" and other macros defined above are undefined. Otherwise +** they may interfere with compilation of other functions in this file +** (or in another file, if this file becomes part of the amalgamation). */ + +// C documentation +// +// /* +// ** Generate code for an UPDATE of a virtual table. +// ** +// ** There are two possible strategies - the default and the special +// ** "onepass" strategy. Onepass is only used if the virtual table +// ** implementation indicates that pWhere may match at most one row. +// ** +// ** The default strategy is to create an ephemeral table that contains +// ** for each row to be changed: +// ** +// ** (A) The original rowid of that row. +// ** (B) The revised rowid for the row. +// ** (C) The content of every column in the row. +// ** +// ** Then loop through the contents of this ephemeral table executing a +// ** VUpdate for each row. When finished, drop the ephemeral table. +// ** +// ** The "onepass" strategy does not use an ephemeral table. Instead, it +// ** stores the same values (A, B and C above) in a register array and +// ** makes a single invocation of VUpdate. +// */ +func _updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pChanges uintptr, pRowid uintptr, aXRef uintptr, pWhere uintptr, onError int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var addr, eOnePass, ephemTab, i, iCsr, nArg, regArg, regRec, regRowid, v1, v10, v4, v6 int32 + var db, pList, pPk, pPk1, pRow, pRowExpr, pVTab, pWInfo, v, v2, v5, v7 uintptr + var iPk, iPk1 Ti16 + var _ /* aDummy at bp+0 */ [2]int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, db, eOnePass, ephemTab, i, iCsr, iPk, iPk1, nArg, pList, pPk, pPk1, pRow, pRowExpr, pVTab, pWInfo, regArg, regRec, regRowid, v, v1, v10, v2, v4, v5, v6, v7 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Loop counter */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database connection */ + pVTab = _sqlite3GetVTable(tls, db, pTab) + pWInfo = uintptr(0) + nArg = int32(2) + int32((*TTable)(unsafe.Pointer(pTab)).FnCol) /* Register for ephemeral table rowid */ + iCsr = (*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).FiCursor /* Address of OP_OpenEphemeral */ + /* Allocate nArg registers in which to gather the arguments for VUpdate. Then + ** create and open the ephemeral table in which the records created from + ** these arguments will be temporarily stored. */ + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + ephemTab = v1 + addr = _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), ephemTab, nArg) + regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nArg + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > int32(1) { + pPk = uintptr(0) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + if pRowid != 0 { + pRow = _sqlite3ExprDup(tls, db, pRowid, 0) + } else { + pRow = _sqlite3PExpr(tls, pParse, int32(TK_ROW), uintptr(0), uintptr(0)) + } + } else { /* PRIMARY KEY column */ + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + iPk = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn)) + if *(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)) >= 0 { + pRow = _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)))*32))).FpExpr, 0) + } else { + pRow = _exprRowColumn(tls, pParse, int32(iPk)) + } + } + pList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), pRow) + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { + pList = _sqlite3ExprListAppend(tls, pParse, pList, _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)))*32))).FpExpr, 0)) + } else { + pRowExpr = _exprRowColumn(tls, pParse, i) + if pRowExpr != 0 { + (*TExpr)(unsafe.Pointer(pRowExpr)).Fop2 = uint8(OPFLAG_NOCHNG) + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, pRowExpr) + } + goto _3 + _3: + ; + i++ + } + _updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) + _sqlite3ExprListDelete(tls, db, pList) + eOnePass = ONEPASS_OFF + } else { + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + regRec = v4 + v7 = pParse + 56 + *(*int32)(unsafe.Pointer(v7))++ + v6 = *(*int32)(unsafe.Pointer(v7)) + regRowid = v6 + /* Start scanning the virtual table */ + pWInfo = _sqlite3WhereBegin(tls, pParse, pSrc, pWhere, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_ONEPASS_DESIRED), 0) + if pWInfo == uintptr(0) { + return + } + /* Populate the argument registers. */ + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pChanges + 8 + uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)))*32))).FpExpr, regArg+int32(2)+i) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_VColumn), iCsr, i, regArg+int32(2)+i) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_NOCHNG)) /* For sqlite3_vtab_nochange() */ + } + goto _8 + _8: + ; + i++ + } + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iCsr, regArg) + if pRowid != 0 { + _sqlite3ExprCode(tls, pParse, pRowid, regArg+int32(1)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iCsr, regArg+int32(1)) + } + } else { /* PRIMARY KEY column */ + pPk1 = _sqlite3PrimaryKeyIndex(tls, pTab) + iPk1 = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk1)).FaiColumn)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_VColumn), iCsr, int32(iPk1), regArg) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regArg+int32(2)+int32(iPk1), regArg+int32(1)) + } + eOnePass = _sqlite3WhereOkOnePass(tls, pWInfo, bp) + /* There is no ONEPASS_MULTI on virtual tables */ + if eOnePass != 0 { + /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded + ** above. */ + _sqlite3VdbeChangeToNoop(tls, v, addr) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Close), iCsr) + } else { + /* Create a record from the argument register contents and insert it into + ** the ephemeral table. */ + _sqlite3MultiWrite(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regArg, nArg, regRec) + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), ephemTab, regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), ephemTab, regRec, regRowid) + } + } + if eOnePass == ONEPASS_OFF { + /* End the virtual table scan */ + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc == int32(1) { + _sqlite3WhereEnd(tls, pWInfo) + } + /* Begin scanning through the ephemeral table. */ + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), ephemTab) + /* Extract arguments from the current row of the ephemeral table and + ** invoke the VUpdate method. */ + i = 0 + for { + if !(i < nArg) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), ephemTab, i, regArg+i) + goto _9 + _9: + ; + i++ + } + } + _sqlite3VtabMakeWritable(tls, pParse, pTab) + _sqlite3VdbeAddOp4(tls, v, int32(OP_VUpdate), 0, nArg, regArg, pVTab, -int32(11)) + if onError == int32(OE_Default) { + v10 = int32(OE_Abort) + } else { + v10 = onError + } + _sqlite3VdbeChangeP5(tls, v, uint16(v10)) + _sqlite3MayAbort(tls, pParse) + /* End of the ephemeral table scan. Or, if using the onepass strategy, + ** jump to here if the scan visited zero rows. */ + if eOnePass == ONEPASS_OFF { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), ephemTab, addr+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Close), ephemTab, 0) + } else { + _sqlite3WhereEnd(tls, pWInfo) + } +} + +/************** End of update.c **********************************************/ +/************** Begin file upsert.c ******************************************/ +/* +** 2018-04-12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code to implement various aspects of UPSERT +** processing and handling of the Upsert object. + */ +/* #include "sqliteInt.h" */ + +// C documentation +// +// /* +// ** Free a list of Upsert objects +// */ +func _upsertDelete(tls *libc.TLS, db uintptr, p uintptr) { + var pNext uintptr + _ = pNext + for cond := true; cond; cond = p != 0 { + pNext = (*TUpsert)(unsafe.Pointer(p)).FpNextUpsert + _sqlite3ExprListDelete(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertTarget) + _sqlite3ExprDelete(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertTargetWhere) + _sqlite3ExprListDelete(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertSet) + _sqlite3ExprDelete(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertWhere) + _sqlite3DbFree(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpToFree) + _sqlite3DbFree(tls, db, p) + p = pNext + } +} + +func _sqlite3UpsertDelete(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _upsertDelete(tls, db, p) + } +} + +// C documentation +// +// /* +// ** Duplicate an Upsert object. +// */ +func _sqlite3UpsertDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + if p == uintptr(0) { + return uintptr(0) + } + return _sqlite3UpsertNew(tls, db, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertTarget, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertTargetWhere, 0), _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpUpsertWhere, 0), _sqlite3UpsertDup(tls, db, (*TUpsert)(unsafe.Pointer(p)).FpNextUpsert)) +} + +// C documentation +// +// /* +// ** Create a new Upsert object. +// */ +func _sqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere uintptr, pSet uintptr, pWhere uintptr, pNext uintptr) (r uintptr) { + var pNew uintptr + _ = pNew + pNew = _sqlite3DbMallocZero(tls, db, uint64(88)) + if pNew == uintptr(0) { + _sqlite3ExprListDelete(tls, db, pTarget) + _sqlite3ExprDelete(tls, db, pTargetWhere) + _sqlite3ExprListDelete(tls, db, pSet) + _sqlite3ExprDelete(tls, db, pWhere) + _sqlite3UpsertDelete(tls, db, pNext) + return uintptr(0) + } else { + (*TUpsert)(unsafe.Pointer(pNew)).FpUpsertTarget = pTarget + (*TUpsert)(unsafe.Pointer(pNew)).FpUpsertTargetWhere = pTargetWhere + (*TUpsert)(unsafe.Pointer(pNew)).FpUpsertSet = pSet + (*TUpsert)(unsafe.Pointer(pNew)).FpUpsertWhere = pWhere + (*TUpsert)(unsafe.Pointer(pNew)).FisDoUpdate = libc.BoolUint8(pSet != uintptr(0)) + (*TUpsert)(unsafe.Pointer(pNew)).FpNextUpsert = pNext + } + return pNew +} + +// C documentation +// +// /* +// ** Analyze the ON CONFLICT clause described by pUpsert. Resolve all +// ** symbols in the conflict-target. +// ** +// ** Return SQLITE_OK if everything works, or an error code is something +// ** is wrong. +// */ +func _sqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr, pAll uintptr) (r int32) { + bp := tls.Alloc(240) + defer tls.Free(240) + var iCursor, ii, jj, nClause, nn, rc int32 + var pExpr, pIdx, pTab, pTarget, pTerm, v2 uintptr + var v3 bool + var _ /* sCol at bp+56 */ [2]TExpr + var _ /* sNC at bp+0 */ TNameContext + var _ /* zWhich at bp+200 */ [16]int8 + _, _, _, _, _, _, _, _, _, _, _, _, _ = iCursor, ii, jj, nClause, nn, pExpr, pIdx, pTab, pTarget, pTerm, rc, v2, v3 /* Index column converted into an Expr */ + nClause = 0 /* Counter of ON CONFLICT clauses */ + /* Resolve all symbolic names in the conflict-target clause, which + ** includes both the list of columns and the optional partial-index + ** WHERE clause. + */ + libc.Xmemset(tls, bp, 0, uint64(56)) + (*(*TNameContext)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TNameContext)(unsafe.Pointer(bp))).FpSrcList = pTabList + for { + if !(pUpsert != 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget != 0) { + break + } + rc = _sqlite3ResolveExprListNames(tls, bp, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + if rc != 0 { + return rc + } + rc = _sqlite3ResolveExprNames(tls, bp, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + if rc != 0 { + return rc + } + /* Check to see if the conflict target matches the rowid. */ + pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab + pTarget = (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget + iCursor = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FiCursor + if v3 = (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) && (*TExprList)(unsafe.Pointer(pTarget)).FnExpr == int32(1); v3 { + v2 = (*(*TExprList_item)(unsafe.Pointer(pTarget + 8))).FpExpr + pTerm = v2 + } + if v3 && int32((*TExpr)(unsafe.Pointer(v2)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pTerm)).FiColumn) == -int32(1) { + /* The conflict-target is the rowid of the primary table */ + goto _1 + } + /* Initialize sCol[0..1] to be an expression parse tree for a + ** single column of an index. The sCol[0] node will be the TK_COLLATE + ** operator and sCol[1] will be the TK_COLUMN operator. Code below + ** will populate the specific collation and column number values + ** prior to comparing against the conflict-target expression. + */ + libc.Xmemset(tls, bp+56, 0, uint64(144)) + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[0].Fop = uint8(TK_COLLATE) + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[0].FpLeft = bp + 56 + 1*72 + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[int32(1)].Fop = uint8(TK_COLUMN) + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[int32(1)].FiTable = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FiCursor + /* Check for matches against other indexes */ + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != libc.Int32FromInt32(OE_None)) { + goto _4 + } + if (*TExprList)(unsafe.Pointer(pTarget)).FnExpr != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { + goto _4 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere == uintptr(0) { + goto _4 + } + if _sqlite3ExprCompare(tls, pParse, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere, (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere, iCursor) != 0 { + goto _4 + } + } + nn = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + ii = 0 + for { + if !(ii < nn) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 56 + 8)) = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(ii)*8)) + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2))) == -int32(2) { + pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(ii)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLLATE) { + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[0].FpLeft = pExpr + pExpr = bp + 56 + } + } else { + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[0].FpLeft = bp + 56 + 1*72 + (*(*[2]TExpr)(unsafe.Pointer(bp + 56)))[int32(1)].FiColumn = *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2)) + pExpr = bp + 56 + } + jj = 0 + for { + if !(jj < nn) { + break + } + if _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer(pTarget + 8 + uintptr(jj)*32))).FpExpr, pExpr, iCursor) < int32(2) { + break /* Column ii of the index matches column jj of target */ + } + goto _6 + _6: + ; + jj++ + } + if jj >= nn { + /* The target contains no match for column jj of the index */ + break + } + goto _5 + _5: + ; + ii++ + } + if ii < nn { + /* Column ii of the index did not match any term of the conflict target. + ** Continue the search with the next index. */ + goto _4 + } + (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + if _sqlite3UpsertOfIndex(tls, pAll, pIdx) != pUpsert { + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + (*TUpsert)(unsafe.Pointer(pUpsert)).FisDup = uint8(1) + } + break + goto _4 + _4: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + if (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { + if nClause == 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0) { + (*(*[16]int8)(unsafe.Pointer(bp + 200)))[0] = 0 + } else { + Xsqlite3_snprintf(tls, int32(16), bp+200, __ccgo_ts+21080, libc.VaList(bp+224, nClause+int32(1))) + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21084, libc.VaList(bp+224, bp+200)) + return int32(SQLITE_ERROR) + } + goto _1 + _1: + ; + pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + nClause++ + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return true if pUpsert is the last ON CONFLICT clause with a +// ** conflict target, or if pUpsert is followed by another ON CONFLICT +// ** clause that targets the INTEGER PRIMARY KEY. +// */ +func _sqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) (r int32) { + var pNext uintptr + _ = pNext + if pUpsert == uintptr(0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + for int32(1) != 0 { + if pNext == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return int32(1) + } + if (*TUpsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return int32(1) + } + if !((*TUpsert)(unsafe.Pointer(pNext)).FisDup != 0) { + return 0 + } + pNext = (*TUpsert)(unsafe.Pointer(pNext)).FpNextUpsert + } + return 0 +} + +// C documentation +// +// /* +// ** Given the list of ON CONFLICT clauses described by pUpsert, and +// ** a particular index pIdx, return a pointer to the particular ON CONFLICT +// ** clause that applies to the index. Or, if the index is not subject to +// ** any ON CONFLICT clause, return NULL. +// */ +func _sqlite3UpsertOfIndex(tls *libc.TLS, pUpsert uintptr, pIdx uintptr) (r uintptr) { + for pUpsert != 0 && (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget != uintptr(0) && (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx != pIdx { + pUpsert = (*TUpsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + } + return pUpsert +} + +// C documentation +// +// /* +// ** Generate bytecode that does an UPDATE as part of an upsert. +// ** +// ** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK. +// ** In this case parameter iCur is a cursor open on the table b-tree that +// ** currently points to the conflicting table row. Otherwise, if pIdx +// ** is not NULL, then pIdx is the constraint that failed and iCur is a +// ** cursor points to the conflicting row. +// */ +func _sqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab uintptr, pIdx uintptr, iCur int32) { + var db, pPk, pSrc, pTop, v uintptr + var i, iDataCur, iPk, k, nPk, regRowid int32 + _, _, _, _, _, _, _, _, _, _, _ = db, i, iDataCur, iPk, k, nPk, pPk, pSrc, pTop, regRowid, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pTop = pUpsert + iDataCur = (*TUpsert)(unsafe.Pointer(pUpsert)).FiDataCur + pUpsert = _sqlite3UpsertOfIndex(tls, pTop, pIdx) + if pIdx != 0 && iCur != iDataCur { + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + regRowid = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), iCur, regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), iDataCur, 0, regRowid) + _sqlite3ReleaseTempReg(tls, pParse, regRowid) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + nPk = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + iPk = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPk + i = 0 + for { + if !(i < nPk) { + break + } + k = int32(_sqlite3TableColumnToIndex(tls, pIdx, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iCur, k, iPk+i) + goto _1 + _1: + ; + i++ + } + i = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), iDataCur, 0, iPk, nPk) + _sqlite3VdbeAddOp4(tls, v, int32(OP_Halt), int32(SQLITE_CORRUPT), int32(OE_Abort), 0, __ccgo_ts+12502, -int32(1)) + _sqlite3MayAbort(tls, pParse) + _sqlite3VdbeJumpHere(tls, v, i) + } + } + /* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does. + ** So we have to make a copy before passing it down into sqlite3Update() */ + pSrc = _sqlite3SrcListDup(tls, db, (*TUpsert)(unsafe.Pointer(pTop)).FpUpsertSrc, 0) + /* excluded.* columns of type REAL need to be converted to a hard real */ + i = 0 + for { + if !(i < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + if int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*16))).Faffinity) == int32(SQLITE_AFF_REAL) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_RealAffinity), (*TUpsert)(unsafe.Pointer(pTop)).FregData+i) + } + goto _2 + _2: + ; + i++ + } + _sqlite3Update(tls, pParse, pSrc, _sqlite3ExprListDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), _sqlite3ExprDup(tls, db, (*TUpsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), int32(OE_Abort), uintptr(0), uintptr(0), pUpsert) +} + +/************** End of upsert.c **********************************************/ +/************** Begin file vacuum.c ******************************************/ +/* +** 2003 April 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to implement the VACUUM command. +** +** Most of the code in this file may be omitted by defining the +** SQLITE_OMIT_VACUUM macro. + */ +/* #include "sqliteInt.h" */ +/* #include "vdbeInt.h" */ + +// C documentation +// +// /* +// ** Execute zSql on database db. +// ** +// ** If zSql returns rows, then each row will have exactly one +// ** column. (This will only happen if zSql begins with "SELECT".) +// ** Take each row of result and call execSql() again recursively. +// ** +// ** The execSqlF() routine does the same thing, except it accepts +// ** a format string as its third argument +// */ +func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc, v1 int32 + var zSubSql uintptr + var _ /* pStmt at bp+0 */ uintptr + _, _, _ = rc, zSubSql, v1 + /* printf("SQL: [%s]\n", zSql); fflush(stdout); */ + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) + if rc != SQLITE_OK { + return rc + } + for { + v1 = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + rc = v1 + if !(int32(SQLITE_ROW) == v1) { + break + } + zSubSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + /* The secondary SQL must be one of CREATE TABLE, CREATE INDEX, + ** or INSERT. Historically there have been attacks that first + ** corrupt the sqlite_schema.sql field with other kinds of statements + ** then run VACUUM to get those statements to execute at inappropriate + ** times. */ + if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21157, uint64(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+21161, uint64(3)) == 0) { + rc = _execSql(tls, db, pzErrMsg, zSubSql) + if rc != SQLITE_OK { + break + } + } + } + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + } + if rc != 0 { + _sqlite3SetString(tls, pzErrMsg, db, Xsqlite3_errmsg(tls, db)) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +func _execSqlF(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr, va uintptr) (r int32) { + var ap Tva_list + var rc int32 + var z uintptr + _, _, _ = ap, rc, z + ap = va + z = _sqlite3VMPrintf(tls, db, zSql, ap) + _ = ap + if z == uintptr(0) { + return int32(SQLITE_NOMEM) + } + rc = _execSql(tls, db, pzErrMsg, z) + _sqlite3DbFree(tls, db, z) + return rc +} + +// C documentation +// +// /* +// ** The VACUUM command is used to clean up the database, +// ** collapse free space, etc. It is modelled after the VACUUM command +// ** in PostgreSQL. The VACUUM command works as follows: +// ** +// ** (1) Create a new transient database file +// ** (2) Copy all content from the database being vacuumed into +// ** the new transient database file +// ** (3) Copy content from the transient database back into the +// ** original database. +// ** +// ** The transient database requires temporary disk space approximately +// ** equal to the size of the original database. The copy operation of +// ** step (3) requires additional temporary disk space approximately equal +// ** to the size of the original database for the rollback journal. +// ** Hence, temporary disk space that is approximately 2x the size of the +// ** original database is required. Every page of the database is written +// ** approximately 3 times: Once for step (2) and twice for step (3). +// ** Two writes per page are required in step (3) because the original +// ** database content must be written into the rollback journal prior to +// ** overwriting the database with the vacuumed content. +// ** +// ** Only 1x temporary space and only 1x writes would be required if +// ** the copy of step (3) were replaced by deleting the original database +// ** and renaming the transient database as the original. But that will +// ** not work if other processes are attached to the original database. +// ** And a power loss in between deleting the original and renaming the +// ** transient would cause the database file to appear to be deleted +// ** following reboot. +// */ +func _sqlite3Vacuum(tls *libc.TLS, pParse uintptr, _pNm uintptr, pInto uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _pNm + var iDb, iIntoReg, v1 int32 + var v, v2 uintptr + _, _, _, _, _ = iDb, iIntoReg, v, v1, v2 + v = _sqlite3GetVdbe(tls, pParse) + iDb = 0 + if v == uintptr(0) { + goto build_vacuum_end + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto build_vacuum_end + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + /* Default behavior: Report an error if the argument to VACUUM is + ** not recognized */ + iDb = _sqlite3TwoPartName(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp)), bp) + if iDb < 0 { + goto build_vacuum_end + } + } + if iDb != int32(1) { + iIntoReg = 0 + if pInto != 0 && _sqlite3ResolveSelfReference(tls, pParse, uintptr(0), 0, pInto, uintptr(0)) == 0 { + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + iIntoReg = v1 + _sqlite3ExprCode(tls, pParse, pInto, iIntoReg) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Vacuum), iDb, iIntoReg) + _sqlite3VdbeUsesBtree(tls, v, iDb) + } +build_vacuum_end: + ; + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pInto) + return +} + +// C documentation +// +// /* +// ** This routine implements the OP_Vacuum opcode of the VDBE. +// */ +func _sqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, pOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, isMemDb, nDb, nRes, rc, v1, v2 int32 + var id, pDb, pMain, pTemp, zDbMain, zOut uintptr + var pgflags, saved_mDbFlags, saved_openFlags Tu32 + var saved_flags Tu64 + var saved_mTrace Tu8 + var saved_nChange, saved_nTotalChange Ti64 + var _ /* meta at bp+8 */ Tu32 + var _ /* sz at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, id, isMemDb, nDb, nRes, pDb, pMain, pTemp, pgflags, rc, saved_flags, saved_mDbFlags, saved_mTrace, saved_nChange, saved_nTotalChange, saved_openFlags, zDbMain, zOut, v1, v2 + rc = SQLITE_OK /* Saved trace settings */ + pDb = uintptr(0) /* Name of output file */ + pgflags = uint32(PAGER_SYNCHRONOUS_OFF) /* sync flags for output db */ + if !((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21165) + return int32(SQLITE_ERROR) /* IMP: R-12218-18073 */ + } + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive > int32(1) { + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21205) + return int32(SQLITE_ERROR) /* IMP: R-15610-35227 */ + } + saved_openFlags = (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags + if pOut != 0 { + if Xsqlite3_value_type(tls, pOut) != int32(SQLITE_TEXT) { + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21248) + return int32(SQLITE_ERROR) + } + zOut = Xsqlite3_value_text(tls, pOut) + *(*uint32)(unsafe.Pointer(db + 76)) &= uint32(^libc.Int32FromInt32(SQLITE_OPEN_READONLY)) + *(*uint32)(unsafe.Pointer(db + 76)) |= uint32(libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE)) + } else { + zOut = __ccgo_ts + 1680 + } + /* Save the current value of the database flags so that it can be + ** restored before returning. Then set the writable-schema flag, and + ** disable CHECK and foreign key constraints. */ + saved_flags = (*Tsqlite3)(unsafe.Pointer(db)).Fflags + saved_mDbFlags = (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags + saved_nChange = (*Tsqlite3)(unsafe.Pointer(db)).FnChange + saved_nTotalChange = (*Tsqlite3)(unsafe.Pointer(db)).FnTotalChange + saved_mTrace = (*Tsqlite3)(unsafe.Pointer(db)).FmTrace + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_IgnoreChecks)) + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(libc.Int32FromInt32(DBFLAG_PreferBuiltin) | libc.Int32FromInt32(DBFLAG_Vacuum)) + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^(uint64(libc.Int32FromInt32(SQLITE_ForeignKeys)|libc.Int32FromInt32(SQLITE_ReverseOrder)|libc.Int32FromInt32(SQLITE_Defensive)) | uint64(libc.Int32FromInt32(0x00001))< 0) { + rc = int32(SQLITE_ERROR) + _sqlite3SetString(tls, pzErrMsg, db, __ccgo_ts+21289) + goto end_of_vacuum + } + *(*Tu32)(unsafe.Pointer(db + 44)) |= uint32(DBFLAG_VacuumInto) + /* For a VACUUM INTO, the pager-flags are set to the same values as + ** they are for the database being vacuumed, except that PAGER_CACHESPILL + ** is always set. */ + pgflags = uint32(uint64((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).Fsafety_level) | (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(PAGER_FLAGS_MASK)) + } + nRes = _sqlite3BtreeGetRequestedReserve(tls, pMain) + _sqlite3BtreeSetCacheSize(tls, pTemp, (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpSchema)).Fcache_size) + _sqlite3BtreeSetSpillSize(tls, pTemp, _sqlite3BtreeSetSpillSize(tls, pMain, 0)) + _sqlite3BtreeSetPagerFlags(tls, pTemp, pgflags|uint32(PAGER_CACHESPILL)) + /* Begin a transaction and take an exclusive lock on the main database + ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, + ** to ensure that we do not try to change the page-size on a WAL database. + */ + rc = _execSql(tls, db, pzErrMsg, __ccgo_ts+14911) + if rc != SQLITE_OK { + goto end_of_vacuum + } + if pOut == uintptr(0) { + v1 = int32(2) + } else { + v1 = 0 + } + rc = _sqlite3BtreeBeginTrans(tls, pMain, v1, uintptr(0)) + if rc != SQLITE_OK { + goto end_of_vacuum + } + /* Do not attempt to change the page size for a WAL database */ + if _sqlite3PagerGetJournalMode(tls, _sqlite3BtreePager(tls, pMain)) == int32(PAGER_JOURNALMODE_WAL) && pOut == uintptr(0) { + (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize = 0 + } + if _sqlite3BtreeSetPageSize(tls, pTemp, _sqlite3BtreeGetPageSize(tls, pMain), nRes, 0) != 0 || !(isMemDb != 0) && _sqlite3BtreeSetPageSize(tls, pTemp, (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize, nRes, 0) != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + goto end_of_vacuum + } + if int32((*Tsqlite3)(unsafe.Pointer(db)).FnextAutovac) >= 0 { + v2 = int32((*Tsqlite3)(unsafe.Pointer(db)).FnextAutovac) + } else { + v2 = _sqlite3BtreeGetAutoVacuum(tls, pMain) + } + _sqlite3BtreeSetAutoVacuum(tls, pTemp, v2) + /* Query the schema of the main database. Create a mirror schema + ** in the temporary database. + */ + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(nDb) /* force new CREATE statements into vacuum_db */ + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21316, libc.VaList(bp+24, zDbMain)) + if rc != SQLITE_OK { + goto end_of_vacuum + } + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21424, libc.VaList(bp+24, zDbMain)) + if rc != SQLITE_OK { + goto end_of_vacuum + } + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) + /* Loop through the tables in the main database. For each, do + ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy + ** the contents to the temporary database. + */ + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21478, libc.VaList(bp+24, zDbMain)) + *(*Tu32)(unsafe.Pointer(db + 44)) &= uint32(^libc.Int32FromInt32(DBFLAG_Vacuum)) + if rc != SQLITE_OK { + goto end_of_vacuum + } + /* Copy the triggers, views, and virtual tables from the main database + ** over to the temporary database. None of these objects has any + ** associated storage, so all we have to do is copy their entries + ** from the schema table. + */ + rc = _execSqlF(tls, db, pzErrMsg, __ccgo_ts+21629, libc.VaList(bp+24, zDbMain)) + if rc != 0 { + goto end_of_vacuum + } + /* Copy Btree meta values */ + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(10)/libc.Uint64FromInt64(1))) { + break + } + /* GetMeta() and UpdateMeta() cannot fail in this context because + ** we already have page 1 loaded into cache and marked dirty. */ + _sqlite3BtreeGetMeta(tls, pMain, int32(_aCopy[i]), bp+8) + rc = _sqlite3BtreeUpdateMeta(tls, pTemp, int32(_aCopy[i]), *(*Tu32)(unsafe.Pointer(bp + 8))+uint32(_aCopy[i+int32(1)])) + if rc != SQLITE_OK { + goto end_of_vacuum + } + goto _3 + _3: + ; + i += int32(2) + } + if pOut == uintptr(0) { + rc = _sqlite3BtreeCopyFile(tls, pMain, pTemp) + } + if rc != SQLITE_OK { + goto end_of_vacuum + } + rc = _sqlite3BtreeCommit(tls, pTemp) + if rc != SQLITE_OK { + goto end_of_vacuum + } + if pOut == uintptr(0) { + _sqlite3BtreeSetAutoVacuum(tls, pMain, _sqlite3BtreeGetAutoVacuum(tls, pTemp)) + } + if pOut == uintptr(0) { + nRes = _sqlite3BtreeGetRequestedReserve(tls, pTemp) + rc = _sqlite3BtreeSetPageSize(tls, pMain, _sqlite3BtreeGetPageSize(tls, pTemp), nRes, int32(1)) + } +end_of_vacuum: + ; + /* Restore the original value of db->flags */ + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb = uint8(0) + (*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags + (*Tsqlite3)(unsafe.Pointer(db)).Fflags = saved_flags + (*Tsqlite3)(unsafe.Pointer(db)).FnChange = saved_nChange + (*Tsqlite3)(unsafe.Pointer(db)).FnTotalChange = saved_nTotalChange + (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = saved_mTrace + _sqlite3BtreeSetPageSize(tls, pMain, -int32(1), 0, int32(1)) + /* Currently there is an SQL level transaction open on the vacuum + ** database. No locks are held on any other files (since the main file + ** was committed at the btree level). So it safe to end the transaction + ** by manually setting the autoCommit flag to true and detaching the + ** vacuum database. The vacuum_db journal file is deleted when the pager + ** is closed by the DETACH. + */ + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) + if pDb != 0 { + _sqlite3BtreeClose(tls, (*TDb)(unsafe.Pointer(pDb)).FpBt) + (*TDb)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + (*TDb)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) + } + /* This both clears the schemas and reduces the size of the db->aDb[] + ** array. */ + _sqlite3ResetAllSchemasOfConnection(tls, db) + return rc +} + +/* At this point, there is a write transaction open on both the + ** vacuum database and the main database. Assuming no error occurs, + ** both transactions are closed by this block - the main database + ** transaction by sqlite3BtreeCopyFile() and the other by an explicit + ** call to sqlite3BtreeCommit(). + */ + +/* This array determines which meta meta values are preserved in the + ** vacuum. Even entries are the meta value number and odd entries + ** are an increment to apply to the meta value after the vacuum. + ** The increment is used to increase the schema cookie so that other + ** connections to the same database will know to reread the schema. + */ +var _aCopy = [10]uint8{ + 0: uint8(BTREE_SCHEMA_VERSION), + 1: uint8(1), + 2: uint8(BTREE_DEFAULT_CACHE_SIZE), + 4: uint8(BTREE_TEXT_ENCODING), + 6: uint8(BTREE_USER_VERSION), + 8: uint8(BTREE_APPLICATION_ID), +} + +/************** End of vacuum.c **********************************************/ +/************** Begin file vtab.c ********************************************/ +/* +** 2006 June 10 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code used to help implement virtual tables. + */ +/* #include "sqliteInt.h" */ + +/* +** Before a virtual table xCreate() or xConnect() method is invoked, the +** sqlite3.pVtabCtx member variable is set to point to an instance of +** this struct allocated on the stack. It is used by the implementation of +** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which +** are invoked only from within xCreate and xConnect methods. + */ +type TVtabCtx1 = struct { + FpVTable uintptr + FpTab uintptr + FpPrior uintptr + FbDeclared int32 +} + +type VtabCtx1 = TVtabCtx1 + +// C documentation +// +// /* +// ** Construct and install a Module object for a virtual table. When this +// ** routine is called, it is guaranteed that all appropriate locks are held +// ** and the module is not already part of the connection. +// ** +// ** If there already exists a module with zName, replace it with the new one. +// ** If pModule==0, then delete the module zName if it exists. +// */ +func _sqlite3VtabCreateModule(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) (r uintptr) { + var nName int32 + var pDel, pMod, zCopy uintptr + _, _, _, _ = nName, pDel, pMod, zCopy + if pModule == uintptr(0) { + zCopy = zName + pMod = uintptr(0) + } else { + nName = _sqlite3Strlen30(tls, zName) + pMod = _sqlite3Malloc(tls, uint64(48)+uint64(nName)+uint64(1)) + if pMod == uintptr(0) { + _sqlite3OomFault(tls, db) + return uintptr(0) + } + zCopy = pMod + 1*48 + libc.Xmemcpy(tls, zCopy, zName, uint64(nName+int32(1))) + (*TModule)(unsafe.Pointer(pMod)).FzName = zCopy + (*TModule)(unsafe.Pointer(pMod)).FpModule = pModule + (*TModule)(unsafe.Pointer(pMod)).FpAux = pAux + (*TModule)(unsafe.Pointer(pMod)).FxDestroy = xDestroy + (*TModule)(unsafe.Pointer(pMod)).FpEpoTab = uintptr(0) + (*TModule)(unsafe.Pointer(pMod)).FnRefModule = int32(1) + } + pDel = _sqlite3HashInsert(tls, db+576, zCopy, pMod) + if pDel != 0 { + if pDel == pMod { + _sqlite3OomFault(tls, db) + _sqlite3DbFree(tls, db, pDel) + pMod = uintptr(0) + } else { + _sqlite3VtabEponymousTableClear(tls, db, pDel) + _sqlite3VtabModuleUnref(tls, db, pDel) + } + } + return pMod +} + +// C documentation +// +// /* +// ** The actual function that does the work of creating a new module. +// ** This function implements the sqlite3_create_module() and +// ** sqlite3_create_module_v2() interfaces. +// */ +func _createModule(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3VtabCreateModule(tls, db, zName, pModule, pAux, xDestroy) + rc = _sqlite3ApiExit(tls, db, rc) + if rc != SQLITE_OK && xDestroy != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, pAux) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** External API function used to create a new virtual-table module. +// */ +func Xsqlite3_create_module(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr) (r int32) { + return _createModule(tls, db, zName, pModule, pAux, uintptr(0)) +} + +// C documentation +// +// /* +// ** External API function used to create a new virtual-table module. +// */ +func Xsqlite3_create_module_v2(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) (r int32) { + return _createModule(tls, db, zName, pModule, pAux, xDestroy) +} + +// C documentation +// +// /* +// ** External API to drop all virtual-table modules, except those named +// ** on the azNames list. +// */ +func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) (r int32) { + var ii int32 + var pMod, pNext, pThis uintptr + _, _, _, _ = ii, pMod, pNext, pThis + pThis = (*THash)(unsafe.Pointer(db + 576)).Ffirst + for { + if !(pThis != 0) { + break + } + pMod = (*THashElem)(unsafe.Pointer(pThis)).Fdata + pNext = (*THashElem)(unsafe.Pointer(pThis)).Fnext + if azNames != 0 { + ii = 0 + for { + if !(*(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) && libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)), (*TModule)(unsafe.Pointer(pMod)).FzName) != 0) { + break + } + goto _2 + _2: + ; + ii++ + } + if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { + goto _1 + } + } + _createModule(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) + goto _1 + _1: + ; + pThis = pNext + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Decrement the reference count on a Module object. Destroy the +// ** module when the reference count reaches zero. +// */ +func _sqlite3VtabModuleUnref(tls *libc.TLS, db uintptr, pMod uintptr) { + (*TModule)(unsafe.Pointer(pMod)).FnRefModule-- + if (*TModule)(unsafe.Pointer(pMod)).FnRefModule == 0 { + if (*TModule)(unsafe.Pointer(pMod)).FxDestroy != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TModule)(unsafe.Pointer(pMod)).FxDestroy})))(tls, (*TModule)(unsafe.Pointer(pMod)).FpAux) + } + _sqlite3DbFree(tls, db, pMod) + } +} + +// C documentation +// +// /* +// ** Lock the virtual table so that it cannot be disconnected. +// ** Locks nest. Every lock should have a corresponding unlock. +// ** If an unlock is omitted, resources leaks will occur. +// ** +// ** If a disconnect is attempted while a virtual table is locked, +// ** the disconnect is deferred until all locks have been removed. +// */ +func _sqlite3VtabLock(tls *libc.TLS, pVTab uintptr) { + (*TVTable)(unsafe.Pointer(pVTab)).FnRef++ +} + +// C documentation +// +// /* +// ** pTab is a pointer to a Table structure representing a virtual-table. +// ** Return a pointer to the VTable object used by connection db to access +// ** this virtual-table, if one has been created, or NULL otherwise. +// */ +func _sqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) (r uintptr) { + var pVtab uintptr + _ = pVtab + pVtab = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp + for { + if !(pVtab != 0 && (*TVTable)(unsafe.Pointer(pVtab)).Fdb != db) { + break + } + goto _1 + _1: + ; + pVtab = (*TVTable)(unsafe.Pointer(pVtab)).FpNext + } + return pVtab +} + +// C documentation +// +// /* +// ** Decrement the ref-count on a virtual table object. When the ref-count +// ** reaches zero, call the xDisconnect() method to delete the object. +// */ +func _sqlite3VtabUnlock(tls *libc.TLS, pVTab uintptr) { + var db, p uintptr + _, _ = db, p + db = (*TVTable)(unsafe.Pointer(pVTab)).Fdb + (*TVTable)(unsafe.Pointer(pVTab)).FnRef-- + if (*TVTable)(unsafe.Pointer(pVTab)).FnRef == 0 { + p = (*TVTable)(unsafe.Pointer(pVTab)).FpVtab + if p != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(p)).FpModule)).FxDisconnect})))(tls, p) + } + _sqlite3VtabModuleUnref(tls, (*TVTable)(unsafe.Pointer(pVTab)).Fdb, (*TVTable)(unsafe.Pointer(pVTab)).FpMod) + _sqlite3DbFree(tls, db, pVTab) + } +} + +// C documentation +// +// /* +// ** Table p is a virtual table. This function moves all elements in the +// ** p->u.vtab.p list to the sqlite3.pDisconnect lists of their associated +// ** database connections to be disconnected at the next opportunity. +// ** Except, if argument db is not NULL, then the entry associated with +// ** connection db is left in the p->u.vtab.p list. +// */ +func _vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + var db2, pNext, pRet, pVTable uintptr + _, _, _, _ = db2, pNext, pRet, pVTable + pRet = uintptr(0) + pVTable = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).Fp + (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).Fp = uintptr(0) + /* Assert that the mutex (if any) associated with the BtShared database + ** that contains table p is held by the caller. See header comments + ** above function sqlite3VtabUnlockList() for an explanation of why + ** this makes it safe to access the sqlite3.pDisconnect list of any + ** database connection that may have an entry in the p->u.vtab.p list. + */ + for pVTable != 0 { + db2 = (*TVTable)(unsafe.Pointer(pVTable)).Fdb + pNext = (*TVTable)(unsafe.Pointer(pVTable)).FpNext + if db2 == db { + pRet = pVTable + (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).Fp = pRet + (*TVTable)(unsafe.Pointer(pRet)).FpNext = uintptr(0) + } else { + (*TVTable)(unsafe.Pointer(pVTable)).FpNext = (*Tsqlite3)(unsafe.Pointer(db2)).FpDisconnect + (*Tsqlite3)(unsafe.Pointer(db2)).FpDisconnect = pVTable + } + pVTable = pNext + } + return pRet +} + +// C documentation +// +// /* +// ** Table *p is a virtual table. This function removes the VTable object +// ** for table *p associated with database connection db from the linked +// ** list in p->pVTab. It also decrements the VTable ref count. This is +// ** used when closing database connection db to free all of its VTable +// ** objects without disturbing the rest of the Schema object (which may +// ** be being used by other shared-cache connections). +// */ +func _sqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { + var pVTab, ppVTab uintptr + _, _ = pVTab, ppVTab + ppVTab = p + 64 + 16 + for { + if !(*(*uintptr)(unsafe.Pointer(ppVTab)) != 0) { + break + } + if (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppVTab)))).Fdb == db { + pVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + *(*uintptr)(unsafe.Pointer(ppVTab)) = (*TVTable)(unsafe.Pointer(pVTab)).FpNext + _sqlite3VtabUnlock(tls, pVTab) + break + } + goto _1 + _1: + ; + ppVTab = *(*uintptr)(unsafe.Pointer(ppVTab)) + 40 + } +} + +// C documentation +// +// /* +// ** Disconnect all the virtual table objects in the sqlite3.pDisconnect list. +// ** +// ** This function may only be called when the mutexes associated with all +// ** shared b-tree databases opened using connection db are held by the +// ** caller. This is done to protect the sqlite3.pDisconnect list. The +// ** sqlite3.pDisconnect list is accessed only as follows: +// ** +// ** 1) By this function. In this case, all BtShared mutexes and the mutex +// ** associated with the database handle itself must be held. +// ** +// ** 2) By function vtabDisconnectAll(), when it adds a VTable entry to +// ** the sqlite3.pDisconnect list. In this case either the BtShared mutex +// ** associated with the database the virtual table is stored in is held +// ** or, if the virtual table is stored in a non-sharable database, then +// ** the database handle mutex is held. +// ** +// ** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously +// ** by multiple threads. It is thread-safe. +// */ +func _sqlite3VtabUnlockList(tls *libc.TLS, db uintptr) { + var p, pNext uintptr + _, _ = p, pNext + p = (*Tsqlite3)(unsafe.Pointer(db)).FpDisconnect + if p != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FpDisconnect = uintptr(0) + for cond := true; cond; cond = p != 0 { + pNext = (*TVTable)(unsafe.Pointer(p)).FpNext + _sqlite3VtabUnlock(tls, p) + p = pNext + } + } +} + +// C documentation +// +// /* +// ** Clear any and all virtual-table information from the Table record. +// ** This routine is called, for example, just before deleting the Table +// ** record. +// ** +// ** Since it is a virtual-table, the Table structure contains a pointer +// ** to the head of a linked list of VTable structures. Each VTable +// ** structure is associated with a single sqlite3* user of the schema. +// ** The reference count of the VTable structure associated with database +// ** connection db is decremented immediately (which may lead to the +// ** structure being xDisconnected and free). Any other VTable structures +// ** in the list are moved to the sqlite3.pDisconnect list of the associated +// ** database connection. +// */ +func _sqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { + var i int32 + _ = i + if (*Tsqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + _vtabDisconnectAll(tls, uintptr(0), p) + } + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).FazArg != 0 { + i = 0 + for { + if !(i < (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).FnArg) { + break + } + if i != int32(1) { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).FazArg + uintptr(i)*8))) + } + goto _1 + _1: + ; + i++ + } + _sqlite3DbFree(tls, db, (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(p + 64))).FazArg) + } +} + +// C documentation +// +// /* +// ** Add a new module argument to pTable->u.vtab.azArg[]. +// ** The string is not copied - the pointer is stored. The +// ** string will be freed automatically when the table is +// ** deleted. +// */ +func _addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var azModuleArg, db, v2 uintptr + var i, v1 int32 + var nBytes Tsqlite3_int64 + _, _, _, _, _, _ = azModuleArg, db, i, nBytes, v1, v2 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + nBytes = int64(uint64(8) * uint64(libc.Int32FromInt32(2)+(*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FnArg)) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FnArg+int32(3) >= *(*int32)(unsafe.Pointer(db + 136 + 2*4)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+12732, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTable)).FzName)) + } + azModuleArg = _sqlite3DbRealloc(tls, db, (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FazArg, uint64(nBytes)) + if azModuleArg == uintptr(0) { + _sqlite3DbFree(tls, db, zArg) + } else { + v2 = pTable + 64 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + i = v1 + *(*uintptr)(unsafe.Pointer(azModuleArg + uintptr(i)*8)) = zArg + *(*uintptr)(unsafe.Pointer(azModuleArg + uintptr(i+int32(1))*8)) = uintptr(0) + (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FazArg = azModuleArg + } +} + +// C documentation +// +// /* +// ** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE +// ** statement. The module name has been parsed, but the optional list +// ** of parameters that follow the module name are still pending. +// */ +func _sqlite3VtabBeginParse(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pModuleName uintptr, ifNotExists int32) { + var db, pTable uintptr + var iDb int32 + _, _, _ = db, iDb, pTable /* Database connection */ + _sqlite3StartTable(tls, pParse, pName1, pName2, 0, 0, int32(1), ifNotExists) + pTable = (*TParse)(unsafe.Pointer(pParse)).FpNewTable + if pTable == uintptr(0) { + return + } + (*TTable)(unsafe.Pointer(pTable)).FeTabType = uint8(TABTYP_VTAB) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + _addModuleArgument(tls, pParse, pTable, _sqlite3NameFromToken(tls, db, pModuleName)) + _addModuleArgument(tls, pParse, pTable, uintptr(0)) + _addModuleArgument(tls, pParse, pTable, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTable)).FzName)) + (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(t__predefined_ptrdiff_t((*TToken)(unsafe.Pointer(pModuleName)).Fz+uintptr((*TToken)(unsafe.Pointer(pModuleName)).Fn)) - int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + /* Creating a virtual table invokes the authorization callback twice. + ** The first invocation, to obtain permission to INSERT a row into the + ** sqlite_schema table, has already been made by sqlite3StartTable(). + ** The second call, to obtain permission to create the table, is made now. + */ + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FazArg != 0 { + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTable)).FpSchema) + /* The database the table is being created in */ + _sqlite3AuthCheck(tls, pParse, int32(SQLITE_CREATE_VTABLE), (*TTable)(unsafe.Pointer(pTable)).FzName, *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTable + 64))).FazArg)), (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32))).FzDbSName) + } +} + +// C documentation +// +// /* +// ** This routine takes the module argument that has been accumulating +// ** in pParse->zArg[] and appends it to the list of arguments on the +// ** virtual table currently under construction in pParse->pTable. +// */ +func _addArgumentToVtab(tls *libc.TLS, pParse uintptr) { + var db, z uintptr + var n int32 + _, _, _ = db, n, z + if (*TParse)(unsafe.Pointer(pParse)).FsArg.Fz != 0 && (*TParse)(unsafe.Pointer(pParse)).FpNewTable != 0 { + z = (*TParse)(unsafe.Pointer(pParse)).FsArg.Fz + n = int32((*TParse)(unsafe.Pointer(pParse)).FsArg.Fn) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + _addModuleArgument(tls, pParse, (*TParse)(unsafe.Pointer(pParse)).FpNewTable, _sqlite3DbStrNDup(tls, db, z, uint64(n))) + } +} + +// C documentation +// +// /* +// ** The parser calls this routine after the CREATE VIRTUAL TABLE statement +// ** has been completely parsed. +// */ +func _sqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var db, pOld, pSchema, pTab, v, zName, zStmt, zWhere, v2 uintptr + var iDb, iReg, v1 int32 + _, _, _, _, _, _, _, _, _, _, _, _ = db, iDb, iReg, pOld, pSchema, pTab, v, zName, zStmt, zWhere, v1, v2 + pTab = (*TParse)(unsafe.Pointer(pParse)).FpNewTable /* The table being constructed */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* The database connection */ + if pTab == uintptr(0) { + return + } + _addArgumentToVtab(tls, pParse) + (*TParse)(unsafe.Pointer(pParse)).FsArg.Fz = uintptr(0) + if (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FnArg < int32(1) { + return + } + /* If the CREATE VIRTUAL TABLE statement is being entered for the + ** first time (in other words if the virtual table is actually being + ** created now instead of just being read out of sqlite_schema) then + ** do additional initialization work and store the statement text + ** in the sqlite_schema table. + */ + if !((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0) { + _sqlite3MayAbort(tls, pParse) + /* Compute the complete text of the CREATE VIRTUAL TABLE statement */ + if pEnd != 0 { + (*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32(int32(int64((*TToken)(unsafe.Pointer(pEnd)).Fz)-int64((*TParse)(unsafe.Pointer(pParse)).FsNameToken.Fz))) + (*TToken)(unsafe.Pointer(pEnd)).Fn + } + zStmt = _sqlite3MPrintf(tls, db, __ccgo_ts+21759, libc.VaList(bp+8, pParse+272)) + /* A slot for the record has already been allocated in the + ** schema table. We just need to update that slot with all + ** the information we've collected. + ** + ** The VM register number pParse->regRowid holds the rowid of an + ** entry in the sqlite_schema table that was created for this vtab + ** by sqlite3StartTable(). + */ + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + _sqlite3NestedParse(tls, pParse, __ccgo_ts+21783, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, (*TTable)(unsafe.Pointer(pTab)).FzName, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt, (*TParse)(unsafe.Pointer(pParse)).FregRowid)) + v = _sqlite3GetVdbe(tls, pParse) + _sqlite3ChangeCookie(tls, pParse, iDb) + _sqlite3VdbeAddOp0(tls, v, int32(OP_Expire)) + zWhere = _sqlite3MPrintf(tls, db, __ccgo_ts+21882, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, zStmt)) + _sqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) + _sqlite3DbFree(tls, db, zStmt) + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + iReg = v1 + _sqlite3VdbeLoadString(tls, v, iReg, (*TTable)(unsafe.Pointer(pTab)).FzName) + _sqlite3VdbeAddOp2(tls, v, int32(OP_VCreate), iDb, iReg) + } else { + pSchema = (*TTable)(unsafe.Pointer(pTab)).FpSchema + zName = (*TTable)(unsafe.Pointer(pTab)).FzName + _sqlite3MarkAllShadowTablesOf(tls, db, pTab) + pOld = _sqlite3HashInsert(tls, pSchema+8, zName, pTab) + if pOld != 0 { + _sqlite3OomFault(tls, db) + /* Malloc must have failed inside HashInsert() */ + return + } + (*TParse)(unsafe.Pointer(pParse)).FpNewTable = uintptr(0) + } +} + +// C documentation +// +// /* +// ** The parser calls this routine when it sees the first token +// ** of an argument to the module name in a CREATE VIRTUAL TABLE statement. +// */ +func _sqlite3VtabArgInit(tls *libc.TLS, pParse uintptr) { + _addArgumentToVtab(tls, pParse) + (*TParse)(unsafe.Pointer(pParse)).FsArg.Fz = uintptr(0) + (*TParse)(unsafe.Pointer(pParse)).FsArg.Fn = uint32(0) +} + +// C documentation +// +// /* +// ** The parser calls this routine for each token after the first token +// ** in an argument to the module name in a CREATE VIRTUAL TABLE statement. +// */ +func _sqlite3VtabArgExtend(tls *libc.TLS, pParse uintptr, p uintptr) { + var pArg uintptr + _ = pArg + pArg = pParse + 384 + if (*TToken)(unsafe.Pointer(pArg)).Fz == uintptr(0) { + (*TToken)(unsafe.Pointer(pArg)).Fz = (*TToken)(unsafe.Pointer(p)).Fz + (*TToken)(unsafe.Pointer(pArg)).Fn = (*TToken)(unsafe.Pointer(p)).Fn + } else { + (*TToken)(unsafe.Pointer(pArg)).Fn = uint32(int32(t__predefined_ptrdiff_t((*TToken)(unsafe.Pointer(p)).Fz+uintptr((*TToken)(unsafe.Pointer(p)).Fn)) - int64((*TToken)(unsafe.Pointer(pArg)).Fz))) + } +} + +// C documentation +// +// /* +// ** Invoke a virtual table constructor (either xCreate or xConnect). The +// ** pointer to the function to invoke is passed as the fourth parameter +// ** to this procedure. +// */ +func _vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, xConstruct uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var azArg, pCtx, pVTable, zFormat, zModuleName, zType, p6 uintptr + var i, iCol, iDb, j, nArg, nDel, nType, rc, v4 int32 + var oooHidden Tu16 + var _ /* sCtx at bp+0 */ TVtabCtx + var _ /* zErr at bp+32 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = azArg, i, iCol, iDb, j, nArg, nDel, nType, oooHidden, pCtx, pVTable, rc, zFormat, zModuleName, zType, v4, p6 + nArg = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FnArg + *(*uintptr)(unsafe.Pointer(bp + 32)) = uintptr(0) + azArg = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg + /* Check that the virtual-table is not already being initialized */ + pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx + for { + if !(pCtx != 0) { + break + } + if (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21901, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + return int32(SQLITE_LOCKED) + } + goto _1 + _1: + ; + pCtx = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpPrior + } + zModuleName = _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName) + if !(zModuleName != 0) { + return int32(SQLITE_NOMEM) + } + pVTable = _sqlite3MallocZero(tls, uint64(48)) + if !(pVTable != 0) { + _sqlite3OomFault(tls, db) + _sqlite3DbFree(tls, db, zModuleName) + return int32(SQLITE_NOMEM) + } + (*TVTable)(unsafe.Pointer(pVTable)).Fdb = db + (*TVTable)(unsafe.Pointer(pVTable)).FpMod = pMod + (*TVTable)(unsafe.Pointer(pVTable)).FeVtabRisk = uint8(SQLITE_VTABRISK_Normal) + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg + 1*8)) = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName + /* Invoke the virtual table constructor */ + (*(*TVtabCtx)(unsafe.Pointer(bp))).FpTab = pTab + (*(*TVtabCtx)(unsafe.Pointer(bp))).FpVTable = pVTable + (*(*TVtabCtx)(unsafe.Pointer(bp))).FpPrior = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx + (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx = bp + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xConstruct})))(tls, db, (*TModule)(unsafe.Pointer(pMod)).FpAux, nArg, azArg, pVTable+16, bp+32) + _sqlite3DeleteTable(tls, db, pTab) + (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx = (*(*TVtabCtx)(unsafe.Pointer(bp))).FpPrior + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } + if SQLITE_OK != rc { + if *(*uintptr)(unsafe.Pointer(bp + 32)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+21943, libc.VaList(bp+48, zModuleName)) + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+3827, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 32)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32))) + } + _sqlite3DbFree(tls, db, pVTable) + } else { + if (*TVTable)(unsafe.Pointer(pVTable)).FpVtab != 0 { + /* Justification of ALWAYS(): A correct vtab constructor must allocate + ** the sqlite3_vtab object if successful. */ + libc.Xmemset(tls, (*TVTable)(unsafe.Pointer(pVTable)).FpVtab, 0, uint64(24)) + (*Tsqlite3_vtab)(unsafe.Pointer((*TVTable)(unsafe.Pointer(pVTable)).FpVtab)).FpModule = (*TModule)(unsafe.Pointer(pMod)).FpModule + (*TModule)(unsafe.Pointer(pMod)).FnRefModule++ + (*TVTable)(unsafe.Pointer(pVTable)).FnRef = int32(1) + if (*(*TVtabCtx)(unsafe.Pointer(bp))).FbDeclared == 0 { + zFormat = __ccgo_ts + 21973 + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _sqlite3VtabUnlock(tls, pVTable) + rc = int32(SQLITE_ERROR) + } else { + oooHidden = uint16(0) + /* If everything went according to plan, link the new VTable structure + ** into the linked list headed by pTab->u.vtab.p. Then loop through the + ** columns of the table to see if any of them contain the token "hidden". + ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from + ** the type string. */ + (*TVTable)(unsafe.Pointer(pVTable)).FpNext = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp + (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp = pVTable + iCol = 0 + for { + if !(iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)) { + break + } + zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*16, __ccgo_ts+1680) + i = 0 + nType = _sqlite3Strlen30(tls, zType) + i = 0 + for { + if !(i < nType) { + break + } + if 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+16617, zType+uintptr(i), int32(6)) && (i == 0 || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1))))) == int32(' ')) && (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32('\000') || int32(*(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6))))) == int32(' ')) { + break + } + goto _3 + _3: + ; + i++ + } + if i < nType { + if *(*int8)(unsafe.Pointer(zType + uintptr(i+int32(6)))) != 0 { + v4 = int32(1) + } else { + v4 = 0 + } + nDel = int32(6) + v4 + j = i + for { + if !(j+nDel <= nType) { + break + } + *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr(j+nDel))) + goto _5 + _5: + ; + j++ + } + if int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == int32('\000') && i > 0 { + *(*int8)(unsafe.Pointer(zType + uintptr(i-int32(1)))) = int8('\000') + } + p6 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + 14 + *(*Tu16)(unsafe.Pointer(p6)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p6))) | libc.Int32FromInt32(COLFLAG_HIDDEN)) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_HasHidden) + oooHidden = uint16(TF_OOOHidden) + } else { + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(oooHidden) + } + goto _2 + _2: + ; + iCol++ + } + } + } + } + _sqlite3DbFree(tls, db, zModuleName) + return rc +} + +// C documentation +// +// /* +// ** This function is invoked by the parser to call the xConnect() method +// ** of the virtual table pTab. If an error occurs, an error code is returned +// ** and an error left in pParse. +// ** +// ** This call is a no-op if table pTab is not a virtual table. +// */ +func _sqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pMod, zMod, zModule uintptr + var rc int32 + var _ /* zErr at bp+0 */ uintptr + _, _, _, _, _ = db, pMod, rc, zMod, zModule + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if _sqlite3GetVTable(tls, db, pTab) != 0 { + return SQLITE_OK + } + /* Locate the required virtual table module */ + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg)) + pMod = _sqlite3HashFind(tls, db+576, zMod) + if !(pMod != 0) { + zModule = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22019, libc.VaList(bp+16, zModule)) + rc = int32(SQLITE_ERROR) + } else { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp) + if rc != SQLITE_OK { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3827, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + (*TParse)(unsafe.Pointer(pParse)).Frc = rc + } + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Grow the db->aVTrans[] array so that there is room for at least one +// ** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise. +// */ +func _growVTrans(tls *libc.TLS, db uintptr) (r int32) { + var ARRAY_INCR int32 + var aVTrans uintptr + var nBytes Tsqlite3_int64 + _, _, _ = ARRAY_INCR, aVTrans, nBytes + ARRAY_INCR = int32(5) + /* Grow the sqlite3.aVTrans array if required */ + if (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans%ARRAY_INCR == 0 { + nBytes = int64(uint64(8) * uint64(int64((*Tsqlite3)(unsafe.Pointer(db)).FnVTrans)+int64(ARRAY_INCR))) + aVTrans = _sqlite3DbRealloc(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans, uint64(nBytes)) + if !(aVTrans != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, aVTrans+uintptr((*Tsqlite3)(unsafe.Pointer(db)).FnVTrans)*8, 0, uint64(8)*uint64(ARRAY_INCR)) + (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should +// ** have already been reserved using growVTrans(). +// */ +func _addToVTrans(tls *libc.TLS, db uintptr, pVTab uintptr) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + /* Add pVtab to the end of sqlite3.aVTrans */ + v2 = db + 572 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(v1)*8)) = pVTab + _sqlite3VtabLock(tls, pVTab) +} + +// C documentation +// +// /* +// ** This function is invoked by the vdbe to call the xCreate method +// ** of the virtual table named zTab in database iDb. +// ** +// ** If an error occurs, *pzErr is set to point to an English language +// ** description of the error and an SQLITE_XXX error code is returned. +// ** In this case the caller must call sqlite3DbFree(db, ) on *pzErr. +// */ +func _sqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pMod, pTab, zMod uintptr + var rc int32 + _, _, _, _ = pMod, pTab, rc, zMod + rc = SQLITE_OK + pTab = _sqlite3FindTable(tls, db, zTab, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + /* Locate the required virtual table module */ + zMod = *(*uintptr)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).FazArg)) + pMod = _sqlite3HashFind(tls, db+576, zMod) + /* If the module has been registered and includes a Create method, + ** invoke it now. If the module has not been registered, return an + ** error. Otherwise, do nothing. + */ + if pMod == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0) || (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = _sqlite3MPrintf(tls, db, __ccgo_ts+22019, libc.VaList(bp+8, zMod)) + rc = int32(SQLITE_ERROR) + } else { + rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) + } + /* Justification of ALWAYS(): The xConstructor method is required to + ** create a valid sqlite3_vtab if it returns SQLITE_OK. */ + if rc == SQLITE_OK && _sqlite3GetVTable(tls, db, pTab) != 0 { + rc = _growVTrans(tls, db) + if rc == SQLITE_OK { + _addToVTrans(tls, db, _sqlite3GetVTable(tls, db, pTab)) + } + } + return rc +} + +// C documentation +// +// /* +// ** This function is used to set the schema of a virtual table. It is only +// ** valid to call this function from within the xCreate() or xConnect() of a +// ** virtual table module. +// */ +func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r int32) { + bp := tls.Alloc(448) + defer tls.Free(448) + var initBusy, rc int32 + var pCtx, pIdx, pNew, pTab, v2 uintptr + var v1 Ti16 + var _ /* sParse at bp+0 */ TParse + _, _, _, _, _, _, _, _ = initBusy, pCtx, pIdx, pNew, pTab, rc, v1, v2 + rc = SQLITE_OK + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx + if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { + _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(155155))) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return _sqlite3MisuseError(tls, int32(155157)) + } + pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab + _sqlite3ParseObjectInit(tls, bp, db) + (*(*TParse)(unsafe.Pointer(bp))).FeParseMode = uint8(PARSE_MODE_DECLARE_VTAB) + (*(*TParse)(unsafe.Pointer(bp))).FdisableTriggers = uint8(1) + /* We should never be able to reach this point while loading the + ** schema. Nevertheless, defend against that (turn off db->init.busy) + ** in case a bug arises. */ + initBusy = int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) + (*(*TParse)(unsafe.Pointer(bp))).FnQueryLoop = int16(1) + if SQLITE_OK == _sqlite3RunParser(tls, bp, zCreateTable) && (*(*TParse)(unsafe.Pointer(bp))).FpNewTable != uintptr(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && int32((*TTable)(unsafe.Pointer((*(*TParse)(unsafe.Pointer(bp))).FpNewTable)).FeTabType) == TABTYP_NORM { + if !((*TTable)(unsafe.Pointer(pTab)).FaCol != 0) { + pNew = (*(*TParse)(unsafe.Pointer(bp))).FpNewTable + (*TTable)(unsafe.Pointer(pTab)).FaCol = (*TTable)(unsafe.Pointer(pNew)).FaCol + _sqlite3ExprListDelete(tls, db, (*(*struct { + FaddColOffset int32 + FpFKey uintptr + FpDfltList uintptr + })(unsafe.Pointer(pNew + 64))).FpDfltList) + v1 = (*TTable)(unsafe.Pointer(pNew)).FnCol + (*TTable)(unsafe.Pointer(pTab)).FnCol = v1 + (*TTable)(unsafe.Pointer(pTab)).FnNVCol = v1 + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= (*TTable)(unsafe.Pointer(pNew)).FtabFlags & uint32(libc.Int32FromInt32(TF_WithoutRowid)|libc.Int32FromInt32(TF_NoVisibleRowid)) + (*TTable)(unsafe.Pointer(pNew)).FnCol = 0 + (*TTable)(unsafe.Pointer(pNew)).FaCol = uintptr(0) + if !((*TTable)(unsafe.Pointer(pNew)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(pCtx)).FpVTable)).FpMod)).FpModule)).FxUpdate != uintptr(0) && int32((*TIndex)(unsafe.Pointer(_sqlite3PrimaryKeyIndex(tls, pNew))).FnKeyCol) != int32(1) { + /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) + ** or else must have a single-column PRIMARY KEY */ + rc = int32(SQLITE_ERROR) + } + pIdx = (*TTable)(unsafe.Pointer(pNew)).FpIndex + if pIdx != 0 { + (*TTable)(unsafe.Pointer(pTab)).FpIndex = pIdx + (*TTable)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) + (*TIndex)(unsafe.Pointer(pIdx)).FpTable = pTab + } + } + (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared = int32(1) + } else { + if (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg != 0 { + v2 = __ccgo_ts + 3827 + } else { + v2 = uintptr(0) + } + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), v2, libc.VaList(bp+432, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg)) + _sqlite3DbFree(tls, db, (*(*TParse)(unsafe.Pointer(bp))).FzErrMsg) + rc = int32(SQLITE_ERROR) + } + (*(*TParse)(unsafe.Pointer(bp))).FeParseMode = uint8(PARSE_MODE_NORMAL) + if (*(*TParse)(unsafe.Pointer(bp))).FpVdbe != 0 { + _sqlite3VdbeFinalize(tls, (*(*TParse)(unsafe.Pointer(bp))).FpVdbe) + } + _sqlite3DeleteTable(tls, db, (*(*TParse)(unsafe.Pointer(bp))).FpNewTable) + _sqlite3ParseObjectReset(tls, bp) + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(initBusy) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** This function is invoked by the vdbe to call the xDestroy method +// ** of the virtual table named zTab in database iDb. This occurs +// ** when a DROP TABLE is mentioned. +// ** +// ** This call is a no-op if zTab is not a virtual table. +// */ +func _sqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) (r int32) { + var p, pTab, xDestroy uintptr + var rc int32 + _, _, _, _ = p, pTab, rc, xDestroy + rc = SQLITE_OK + pTab = _sqlite3FindTable(tls, db, zTab, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName) + if pTab != uintptr(0) && int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) && (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp != uintptr(0) { + p = (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp + for { + if !(p != 0) { + break + } + if (*Tsqlite3_vtab)(unsafe.Pointer((*TVTable)(unsafe.Pointer(p)).FpVtab)).FnRef > 0 { + return int32(SQLITE_LOCKED) + } + goto _1 + _1: + ; + p = (*TVTable)(unsafe.Pointer(p)).FpNext + } + p = _vtabDisconnectAll(tls, db, pTab) + xDestroy = (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(p)).FpMod)).FpModule)).FxDestroy + if xDestroy == uintptr(0) { + xDestroy = (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(p)).FpMod)).FpModule)).FxDisconnect + } + (*TTable)(unsafe.Pointer(pTab)).FnTabRef++ + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, (*TVTable)(unsafe.Pointer(p)).FpVtab) + /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ + if rc == SQLITE_OK { + (*TVTable)(unsafe.Pointer(p)).FpVtab = uintptr(0) + (*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp = uintptr(0) + _sqlite3VtabUnlock(tls, p) + } + _sqlite3DeleteTable(tls, db, pTab) + } + return rc +} + +// C documentation +// +// /* +// ** This function invokes either the xRollback or xCommit method +// ** of each of the virtual tables in the sqlite3.aVTrans array. The method +// ** called is identified by the second argument, "offset", which is +// ** the offset of the method to call in the sqlite3_module structure. +// ** +// ** The array is cleared after invoking the callbacks. +// */ +func _callFinaliser(tls *libc.TLS, db uintptr, offset int32) { + var aVTrans, p, pVTab, x uintptr + var i int32 + _, _, _, _, _ = aVTrans, i, p, pVTab, x + if (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans != 0 { + aVTrans = (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans + (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = uintptr(0) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans) { + break + } + pVTab = *(*uintptr)(unsafe.Pointer(aVTrans + uintptr(i)*8)) + p = (*TVTable)(unsafe.Pointer(pVTab)).FpVtab + if p != 0 { + x = *(*uintptr)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(p)).FpModule + uintptr(offset))) + if x != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{x})))(tls, p) + } + } + (*TVTable)(unsafe.Pointer(pVTab)).FiSavepoint = 0 + _sqlite3VtabUnlock(tls, pVTab) + goto _1 + _1: + ; + i++ + } + _sqlite3DbFree(tls, db, aVTrans) + (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans = 0 + } +} + +// C documentation +// +// /* +// ** Invoke the xSync method of all virtual tables in the sqlite3.aVTrans +// ** array. Return the error code for the first error that occurs, or +// ** SQLITE_OK if all xSync operations are successful. +// ** +// ** If an error message is available, leave it in p->zErrMsg. +// */ +func _sqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + var aVTrans, pVtab, x, v2 uintptr + var i, rc int32 + var v3 bool + _, _, _, _, _, _, _ = aVTrans, i, pVtab, rc, x, v2, v3 + rc = SQLITE_OK + aVTrans = (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans + (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = uintptr(0) + i = 0 + for { + if !(rc == SQLITE_OK && i < (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans) { + break + } + pVtab = (*TVTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aVTrans + uintptr(i)*8)))).FpVtab + if v3 = pVtab != 0; v3 { + v2 = (*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule)).FxSync + x = v2 + } + if v3 && v2 != uintptr(0) { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{x})))(tls, pVtab) + _sqlite3VtabImportErrmsg(tls, p, pVtab) + } + goto _1 + _1: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans + return rc +} + +// C documentation +// +// /* +// ** Invoke the xRollback method of all virtual tables in the +// ** sqlite3.aVTrans array. Then clear the array itself. +// */ +func _sqlite3VtabRollback(tls *libc.TLS, db uintptr) (r int32) { + _callFinaliser(tls, db, int32(uint64(libc.UintptrFromInt32(0)+136))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Invoke the xCommit method of all virtual tables in the +// ** sqlite3.aVTrans array. Then clear the array itself. +// */ +func _sqlite3VtabCommit(tls *libc.TLS, db uintptr) (r int32) { + _callFinaliser(tls, db, int32(uint64(libc.UintptrFromInt32(0)+128))) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If the virtual table pVtab supports the transaction interface +// ** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is +// ** not currently open, invoke the xBegin method now. +// ** +// ** If the xBegin call is successful, place the sqlite3_vtab pointer +// ** in the sqlite3.aVTrans array. +// */ +func _sqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) (r int32) { + var i, iSvpt, rc int32 + var pModule uintptr + _, _, _, _ = i, iSvpt, pModule, rc + rc = SQLITE_OK + /* Special case: If db->aVTrans is NULL and db->nVTrans is greater + ** than zero, then this function is being called from within a + ** virtual module xSync() callback. It is illegal to write to + ** virtual module tables in this case, so return SQLITE_LOCKED. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans > 0 && (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans == uintptr(0) { + return int32(SQLITE_LOCKED) + } + if !(pVTab != 0) { + return SQLITE_OK + } + pModule = (*Tsqlite3_vtab)(unsafe.Pointer((*TVTable)(unsafe.Pointer(pVTab)).FpVtab)).FpModule + if (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxBegin != 0 { + /* If pVtab is already in the aVTrans array, return early */ + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans) { + break + } + if *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(i)*8)) == pVTab { + return SQLITE_OK + } + goto _1 + _1: + ; + i++ + } + /* Invoke the xBegin method. If successful, add the vtab to the + ** sqlite3.aVTrans[] array. */ + rc = _growVTrans(tls, db) + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxBegin})))(tls, (*TVTable)(unsafe.Pointer(pVTab)).FpVtab) + if rc == SQLITE_OK { + iSvpt = (*Tsqlite3)(unsafe.Pointer(db)).FnStatement + (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint + _addToVTrans(tls, db, pVTab) + if iSvpt != 0 && (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxSavepoint != 0 { + (*TVTable)(unsafe.Pointer(pVTab)).FiSavepoint = iSvpt + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pModule)).FxSavepoint})))(tls, (*TVTable)(unsafe.Pointer(pVTab)).FpVtab, iSvpt-int32(1)) + } + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Invoke either the xSavepoint, xRollbackTo or xRelease method of all +// ** virtual tables that currently have an open transaction. Pass iSavepoint +// ** as the second argument to the virtual table method invoked. +// ** +// ** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is +// ** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is +// ** SAVEPOINT_RELEASE, then the xRelease method of each virtual table with +// ** an open transaction is invoked. +// ** +// ** If any virtual table method returns an error code other than SQLITE_OK, +// ** processing is abandoned and the error returned to the caller of this +// ** function immediately. If all calls to virtual table methods are successful, +// ** SQLITE_OK is returned. +// */ +func _sqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32) (r int32) { + var i, rc int32 + var pMod, pVTab, xMethod uintptr + var savedFlags Tu64 + _, _, _, _, _, _ = i, pMod, pVTab, rc, savedFlags, xMethod + rc = SQLITE_OK + if (*Tsqlite3)(unsafe.Pointer(db)).FaVTrans != 0 { + i = 0 + for { + if !(rc == SQLITE_OK && i < (*Tsqlite3)(unsafe.Pointer(db)).FnVTrans) { + break + } + pVTab = *(*uintptr)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(i)*8)) + pMod = (*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer(pVTab)).FpMod)).FpModule + if (*TVTable)(unsafe.Pointer(pVTab)).FpVtab != 0 && (*Tsqlite3_module)(unsafe.Pointer(pMod)).FiVersion >= int32(2) { + _sqlite3VtabLock(tls, pVTab) + switch op { + case SAVEPOINT_BEGIN: + xMethod = (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxSavepoint + (*TVTable)(unsafe.Pointer(pVTab)).FiSavepoint = iSavepoint + int32(1) + case int32(SAVEPOINT_ROLLBACK): + xMethod = (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxRollbackTo + default: + xMethod = (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxRelease + break + } + if xMethod != 0 && (*TVTable)(unsafe.Pointer(pVTab)).FiSavepoint > iSavepoint { + savedFlags = (*Tsqlite3)(unsafe.Pointer(db)).Fflags & libc.Uint64FromInt32(SQLITE_Defensive) + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^libc.Uint64FromInt32(SQLITE_Defensive) + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xMethod})))(tls, (*TVTable)(unsafe.Pointer(pVTab)).FpVtab, iSavepoint) + *(*Tu64)(unsafe.Pointer(db + 48)) |= savedFlags + } + _sqlite3VtabUnlock(tls, pVTab) + } + goto _1 + _1: + ; + i++ + } + } + return rc +} + +// C documentation +// +// /* +// ** The first parameter (pDef) is a function implementation. The +// ** second parameter (pExpr) is the first argument to this function. +// ** If pExpr is a column in a virtual table, then let the virtual +// ** table implementation have an opportunity to overload the function. +// ** +// ** This routine is used to allow virtual table implementations to +// ** overload MATCH, LIKE, GLOB, and REGEXP operators. +// ** +// ** Return either the pDef argument (indicating no change) or a +// ** new FuncDef structure that is marked as ephemeral using the +// ** SQLITE_FUNC_EPHEM flag. +// */ +func _sqlite3VtabOverloadFunction(tls *libc.TLS, db uintptr, pDef uintptr, nArg int32, pExpr uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pMod, pNew, pTab, pVtab uintptr + var rc int32 + var _ /* pArg at bp+8 */ uintptr + var _ /* xSFunc at bp+0 */ uintptr + _, _, _, _, _ = pMod, pNew, pTab, pVtab, rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + rc = 0 + /* Check to see the left operand is a column in a virtual table */ + if pExpr == uintptr(0) { + return pDef + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { + return pDef + } + pTab = *(*uintptr)(unsafe.Pointer(pExpr + 64)) + if pTab == uintptr(0) { + return pDef + } + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) { + return pDef + } + pVtab = (*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, db, pTab))).FpVtab + pMod = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + if (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction == uintptr(0) { + return pDef + } + /* Call the xFindFunction method on the virtual table implementation + ** to see if the implementation wants to overload this function. + ** + ** Though undocumented, we have historically always invoked xFindFunction + ** with an all lower-case function name. Continue in this tradition to + ** avoid any chance of an incompatibility. + */ + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction})))(tls, pVtab, nArg, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, bp, bp+8) + if rc == 0 { + return pDef + } + /* Create a new ephemeral function definition for the overloaded + ** function */ + pNew = _sqlite3DbMallocZero(tls, db, uint64(72)+uint64(_sqlite3Strlen30(tls, (*TFuncDef)(unsafe.Pointer(pDef)).FzName))+uint64(1)) + if pNew == uintptr(0) { + return pDef + } + *(*TFuncDef)(unsafe.Pointer(pNew)) = *(*TFuncDef)(unsafe.Pointer(pDef)) + (*TFuncDef)(unsafe.Pointer(pNew)).FzName = pNew + 1*72 + libc.Xmemcpy(tls, pNew+1*72, (*TFuncDef)(unsafe.Pointer(pDef)).FzName, uint64(_sqlite3Strlen30(tls, (*TFuncDef)(unsafe.Pointer(pDef)).FzName)+int32(1))) + (*TFuncDef)(unsafe.Pointer(pNew)).FxSFunc = *(*uintptr)(unsafe.Pointer(bp)) + (*TFuncDef)(unsafe.Pointer(pNew)).FpUserData = *(*uintptr)(unsafe.Pointer(bp + 8)) + *(*Tu32)(unsafe.Pointer(pNew + 4)) |= uint32(SQLITE_FUNC_EPHEM) + return pNew +} + +// C documentation +// +// /* +// ** Make sure virtual table pTab is contained in the pParse->apVirtualLock[] +// ** array so that an OP_VBegin will get generated for it. Add pTab to the +// ** array if it is missing. If pTab is already in the array, this routine +// ** is a no-op. +// */ +func _sqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { + var apVtabLock, pToplevel, v1, v4 uintptr + var i, n, v3 int32 + _, _, _, _, _, _, _ = apVtabLock, i, n, pToplevel, v1, v3, v4 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + pToplevel = v1 + i = 0 + for { + if !(i < (*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock) { + break + } + if pTab == *(*uintptr)(unsafe.Pointer((*TParse)(unsafe.Pointer(pToplevel)).FapVtabLock + uintptr(i)*8)) { + return + } + goto _2 + _2: + ; + i++ + } + n = int32(uint64((*TParse)(unsafe.Pointer(pToplevel)).FnVtabLock+libc.Int32FromInt32(1)) * uint64(8)) + apVtabLock = _sqlite3Realloc(tls, (*TParse)(unsafe.Pointer(pToplevel)).FapVtabLock, uint64(n)) + if apVtabLock != 0 { + (*TParse)(unsafe.Pointer(pToplevel)).FapVtabLock = apVtabLock + v4 = pToplevel + 312 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + *(*uintptr)(unsafe.Pointer((*TParse)(unsafe.Pointer(pToplevel)).FapVtabLock + uintptr(v3)*8)) = pTab + } else { + _sqlite3OomFault(tls, (*TParse)(unsafe.Pointer(pToplevel)).Fdb) + } +} + +// C documentation +// +// /* +// ** Check to see if virtual table module pMod can be have an eponymous +// ** virtual table instance. If it can, create one if one does not already +// ** exist. Return non-zero if either the eponymous virtual table instance +// ** exists when this routine returns or if an attempt to create it failed +// ** and an error message was left in pParse. +// ** +// ** An eponymous virtual table instance is one that is named after its +// ** module, and more importantly, does not require a CREATE VIRTUAL TABLE +// ** statement in order to come into existence. Eponymous virtual table +// ** instances always exist. They cannot be DROP-ed. +// ** +// ** Any virtual table module for which xConnect and xCreate are the same +// ** method can have an eponymous virtual table instance. +// */ +func _sqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pModule, pTab uintptr + var rc int32 + var _ /* zErr at bp+0 */ uintptr + _, _, _, _ = db, pModule, pTab, rc + pModule = (*TModule)(unsafe.Pointer(pMod)).FpModule + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TModule)(unsafe.Pointer(pMod)).FpEpoTab != 0 { + return int32(1) + } + if (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxCreate != uintptr(0) && (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxCreate != (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxConnect { + return 0 + } + pTab = _sqlite3DbMallocZero(tls, db, uint64(104)) + if pTab == uintptr(0) { + return 0 + } + (*TTable)(unsafe.Pointer(pTab)).FzName = _sqlite3DbStrDup(tls, db, (*TModule)(unsafe.Pointer(pMod)).FzName) + if (*TTable)(unsafe.Pointer(pTab)).FzName == uintptr(0) { + _sqlite3DbFree(tls, db, pTab) + return 0 + } + (*TModule)(unsafe.Pointer(pMod)).FpEpoTab = pTab + (*TTable)(unsafe.Pointer(pTab)).FnTabRef = uint32(1) + (*TTable)(unsafe.Pointer(pTab)).FeTabType = uint8(TABTYP_VTAB) + (*TTable)(unsafe.Pointer(pTab)).FpSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema + (*TTable)(unsafe.Pointer(pTab)).FiPKey = int16(-int32(1)) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_Eponymous) + _addModuleArgument(tls, pParse, pTab, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName)) + _addModuleArgument(tls, pParse, pTab, uintptr(0)) + _addModuleArgument(tls, pParse, pTab, _sqlite3DbStrDup(tls, db, (*TTable)(unsafe.Pointer(pTab)).FzName)) + rc = _vtabCallConstructor(tls, db, pTab, pMod, (*Tsqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp) + if rc != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3827, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3VtabEponymousTableClear(tls, db, pMod) + } + return int32(1) +} + +// C documentation +// +// /* +// ** Erase the eponymous virtual table instance associated with +// ** virtual table module pMod, if it exists. +// */ +func _sqlite3VtabEponymousTableClear(tls *libc.TLS, db uintptr, pMod uintptr) { + var pTab uintptr + _ = pTab + pTab = (*TModule)(unsafe.Pointer(pMod)).FpEpoTab + if pTab != uintptr(0) { + /* Mark the table as Ephemeral prior to deleting it, so that the + ** sqlite3DeleteTable() routine will know that it is not stored in + ** the schema. */ + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_Ephemeral) + _sqlite3DeleteTable(tls, db, pTab) + (*TModule)(unsafe.Pointer(pMod)).FpEpoTab = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Return the ON CONFLICT resolution mode in effect for the virtual +// ** table update operation currently in progress. +// ** +// ** The results of this routine are undefined unless it is called from +// ** within an xUpdate method. +// */ +func Xsqlite3_vtab_on_conflict(tls *libc.TLS, db uintptr) (r int32) { + return int32(_aMap[int32((*Tsqlite3)(unsafe.Pointer(db)).FvtabOnConflict)-int32(1)]) +} + +var _aMap = [5]uint8{ + 0: uint8(SQLITE_ROLLBACK), + 1: uint8(SQLITE_ABORT), + 2: uint8(SQLITE_FAIL), + 3: uint8(SQLITE_IGNORE), + 4: uint8(SQLITE_REPLACE), +} + +// C documentation +// +// /* +// ** Call from within the xCreate() or xConnect() methods to provide +// ** the SQLite core with additional information about the behavior +// ** of the virtual table being implemented. +// */ +func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r int32) { + var ap Tva_list + var p uintptr + var rc int32 + _, _, _ = ap, p, rc + rc = SQLITE_OK + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + p = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx + if !(p != 0) { + rc = _sqlite3MisuseError(tls, int32(155651)) + } else { + ap = va + switch op { + case int32(SQLITE_VTAB_CONSTRAINT_SUPPORT): + (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbConstraint = uint8(libc.VaInt32(&ap)) + case int32(SQLITE_VTAB_INNOCUOUS): + (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FeVtabRisk = uint8(SQLITE_VTABRISK_Low) + case int32(SQLITE_VTAB_DIRECTONLY): + (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FeVtabRisk = uint8(SQLITE_VTABRISK_High) + case int32(SQLITE_VTAB_USES_ALL_SCHEMAS): + (*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(p)).FpVTable)).FbAllSchemas = uint8(1) + default: + rc = _sqlite3MisuseError(tls, int32(155673)) + break + } + _ = ap + } + if rc != SQLITE_OK { + _sqlite3Error(tls, db, rc) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +/************** End of vtab.c ************************************************/ +/************** Begin file wherecode.c ***************************************/ +/* +** 2015-06-06 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This module contains C code that generates VDBE code used to process +** the WHERE clause of SQL statements. +** +** This file was split off from where.c on 2015-06-06 in order to reduce the +** size of where.c and make it easier to edit. This file contains the routines +** that actually generate the bulk of the WHERE loop code. The original where.c +** file retains the code that does query planning and analysis. + */ +/* #include "sqliteInt.h" */ +/************** Include whereInt.h in the middle of wherecode.c **************/ +/************** Begin file whereInt.h ****************************************/ +/* +** 2013-11-12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains structure and macro definitions for the query +** planner logic in "where.c". These definitions are broken out into +** a separate source file for easier editing. + */ + +// C documentation +// +// /* Forward references +// */ +type TWhereClause = struct { + FpWInfo uintptr + FpOuter uintptr + Fop Tu8 + FhasOr Tu8 + FnTerm int32 + FnSlot int32 + FnBase int32 + Fa uintptr + FaStatic [8]TWhereTerm +} + +type WhereClause = TWhereClause + +type TWhereMaskSet = struct { + FbVarSelect int32 + Fn int32 + Fix [64]int32 +} + +type WhereMaskSet = TWhereMaskSet + +type TWhereOrInfo = struct { + Fwc TWhereClause + Findexable TBitmask +} + +type WhereOrInfo = TWhereOrInfo + +type TWhereAndInfo = struct { + Fwc TWhereClause +} + +type WhereAndInfo = TWhereAndInfo + +type TWhereLevel = struct { + FiLeftJoin int32 + FiTabCur int32 + FiIdxCur int32 + FaddrBrk int32 + FaddrNxt int32 + FaddrSkip int32 + FaddrCont int32 + FaddrFirst int32 + FaddrBody int32 + FregBignull int32 + FaddrBignull int32 + FregFilter int32 + FpRJ uintptr + FiFrom Tu8 + Fop Tu8 + Fp3 Tu8 + Fp5 Tu8 + Fp1 int32 + Fp2 int32 + Fu struct { + FpCoveringIdx [0]uintptr + Fin struct { + FnIn int32 + FaInLoop uintptr + } + } + FpWLoop uintptr + FnotReady TBitmask +} + +type WhereLevel = TWhereLevel + +type TWhereLoop = struct { + Fprereq TBitmask + FmaskSelf TBitmask + FiTab Tu8 + FiSortIdx Tu8 + FrSetup TLogEst + FrRun TLogEst + FnOut TLogEst + Fu struct { + Fvtab [0]struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + } + Fbtree struct { + FnEq Tu16 + FnBtm Tu16 + FnTop Tu16 + FnDistinctCol Tu16 + FpIndex uintptr + } + F__ccgo_pad2 [8]byte + } + FwsFlags Tu32 + FnLTerm Tu16 + FnSkip Tu16 + FnLSlot Tu16 + FaLTerm uintptr + FpNextLoop uintptr + FaLTermSpace [3]uintptr +} + +type WhereLoop = TWhereLoop + +type TWherePath = struct { + FmaskLoop TBitmask + FrevLoop TBitmask + FnRow TLogEst + FrCost TLogEst + FrUnsorted TLogEst + FisOrdered Ti8 + FaLoop uintptr +} + +type WherePath = TWherePath + +type TWhereTerm = struct { + FpExpr uintptr + FpWC uintptr + FtruthProb TLogEst + FwtFlags Tu16 + FeOperator Tu16 + FnChild Tu8 + FeMatchOp Tu8 + FiParent int32 + FleftCursor int32 + Fu struct { + FpOrInfo [0]uintptr + FpAndInfo [0]uintptr + Fx struct { + FleftColumn int32 + FiField int32 + } + } + FprereqRight TBitmask + FprereqAll TBitmask +} + +type WhereTerm = TWhereTerm + +type TWhereLoopBuilder = struct { + FpWInfo uintptr + FpWC uintptr + FpNew uintptr + FpOrSet uintptr + FpRec uintptr + FnRecValid int32 + FbldFlags1 uint8 + FbldFlags2 uint8 + FiPlanLimit uint32 +} + +type WhereLoopBuilder = TWhereLoopBuilder + +type TWhereScan = struct { + FpOrigWC uintptr + FpWC uintptr + FzCollName uintptr + FpIdxExpr uintptr + Fk int32 + FopMask Tu32 + Fidxaff int8 + FiEquiv uint8 + FnEquiv uint8 + FaiCur [11]int32 + FaiColumn [11]Ti16 +} + +type WhereScan = TWhereScan + +type TWhereOrCost = struct { + Fprereq TBitmask + FrRun TLogEst + FnOut TLogEst +} + +type WhereOrCost = TWhereOrCost + +type TWhereOrSet = struct { + Fn Tu16 + Fa [3]TWhereOrCost +} + +type WhereOrSet = TWhereOrSet + +type TWhereMemBlock = struct { + FpNext uintptr + Fsz Tu64 +} + +type WhereMemBlock = TWhereMemBlock + +type TWhereRightJoin = struct { + FiMatch int32 + FregBloom int32 + FregReturn int32 + FaddrSubrtn int32 + FendSubrtn int32 +} + +type WhereRightJoin = TWhereRightJoin + +/* +** This object is a header on a block of allocated memory that will be +** automatically freed when its WInfo object is destructed. + */ +type TWhereMemBlock1 = struct { + FpNext uintptr + Fsz Tu64 +} + +type WhereMemBlock1 = TWhereMemBlock1 + +/* +** Extra information attached to a WhereLevel that is a RIGHT JOIN. + */ +type TWhereRightJoin1 = struct { + FiMatch int32 + FregBloom int32 + FregReturn int32 + FaddrSubrtn int32 + FendSubrtn int32 +} + +type WhereRightJoin1 = TWhereRightJoin1 + +/* +** This object contains information needed to implement a single nested +** loop in WHERE clause. +** +** Contrast this object with WhereLoop. This object describes the +** implementation of the loop. WhereLoop describes the algorithm. +** This object contains a pointer to the WhereLoop algorithm as one of +** its elements. +** +** The WhereInfo object contains a single instance of this object for +** each term in the FROM clause (which is to say, for each of the +** nested loops as implemented). The order of WhereLevel objects determines +** the loop nested order, with WhereInfo.a[0] being the outer loop and +** WhereInfo.a[WhereInfo.nLevel-1] being the inner loop. + */ +type TWhereLevel1 = struct { + FiLeftJoin int32 + FiTabCur int32 + FiIdxCur int32 + FaddrBrk int32 + FaddrNxt int32 + FaddrSkip int32 + FaddrCont int32 + FaddrFirst int32 + FaddrBody int32 + FregBignull int32 + FaddrBignull int32 + FregFilter int32 + FpRJ uintptr + FiFrom Tu8 + Fop Tu8 + Fp3 Tu8 + Fp5 Tu8 + Fp1 int32 + Fp2 int32 + Fu struct { + FpCoveringIdx [0]uintptr + Fin struct { + FnIn int32 + FaInLoop uintptr + } + } + FpWLoop uintptr + FnotReady TBitmask +} + +type WhereLevel1 = TWhereLevel1 + +/* +** Each instance of this object represents an algorithm for evaluating one +** term of a join. Every term of the FROM clause will have at least +** one corresponding WhereLoop object (unless INDEXED BY constraints +** prevent a query solution - which is an error) and many terms of the +** FROM clause will have multiple WhereLoop objects, each describing a +** potential way of implementing that FROM-clause term, together with +** dependencies and cost estimates for using the chosen algorithm. +** +** Query planning consists of building up a collection of these WhereLoop +** objects, then computing a particular sequence of WhereLoop objects, with +** one WhereLoop object per FROM clause term, that satisfy all dependencies +** and that minimize the overall cost. + */ +type TWhereLoop1 = struct { + Fprereq TBitmask + FmaskSelf TBitmask + FiTab Tu8 + FiSortIdx Tu8 + FrSetup TLogEst + FrRun TLogEst + FnOut TLogEst + Fu struct { + Fvtab [0]struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + } + Fbtree struct { + FnEq Tu16 + FnBtm Tu16 + FnTop Tu16 + FnDistinctCol Tu16 + FpIndex uintptr + } + F__ccgo_pad2 [8]byte + } + FwsFlags Tu32 + FnLTerm Tu16 + FnSkip Tu16 + FnLSlot Tu16 + FaLTerm uintptr + FpNextLoop uintptr + FaLTermSpace [3]uintptr +} + +type WhereLoop1 = TWhereLoop1 + +/* This object holds the prerequisites and the cost of running a +** subquery on one operand of an OR operator in the WHERE clause. +** See WhereOrSet for additional information + */ +type TWhereOrCost1 = struct { + Fprereq TBitmask + FrRun TLogEst + FnOut TLogEst +} + +type WhereOrCost1 = TWhereOrCost1 + +/* The WhereOrSet object holds a set of possible WhereOrCosts that +** correspond to the subquery(s) of OR-clause processing. Only the +** best N_OR_COST elements are retained. + */ +type TWhereOrSet1 = struct { + Fn Tu16 + Fa [3]TWhereOrCost +} + +type WhereOrSet1 = TWhereOrSet1 + +/* +** Each instance of this object holds a sequence of WhereLoop objects +** that implement some or all of a query plan. +** +** Think of each WhereLoop object as a node in a graph with arcs +** showing dependencies and costs for travelling between nodes. (That is +** not a completely accurate description because WhereLoop costs are a +** vector, not a scalar, and because dependencies are many-to-one, not +** one-to-one as are graph nodes. But it is a useful visualization aid.) +** Then a WherePath object is a path through the graph that visits some +** or all of the WhereLoop objects once. +** +** The "solver" works by creating the N best WherePath objects of length +** 1. Then using those as a basis to compute the N best WherePath objects +** of length 2. And so forth until the length of WherePaths equals the +** number of nodes in the FROM clause. The best (lowest cost) WherePath +** at the end is the chosen query plan. + */ +type TWherePath1 = struct { + FmaskLoop TBitmask + FrevLoop TBitmask + FnRow TLogEst + FrCost TLogEst + FrUnsorted TLogEst + FisOrdered Ti8 + FaLoop uintptr +} + +type WherePath1 = TWherePath1 + +/* +** The query generator uses an array of instances of this structure to +** help it analyze the subexpressions of the WHERE clause. Each WHERE +** clause subexpression is separated from the others by AND operators, +** usually, or sometimes subexpressions separated by OR. +** +** All WhereTerms are collected into a single WhereClause structure. +** The following identity holds: +** +** WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm +** +** When a term is of the form: +** +** X +** +** where X is a column name and is one of certain operators, +** then WhereTerm.leftCursor and WhereTerm.u.leftColumn record the +** cursor number and column number for X. WhereTerm.eOperator records +** the using a bitmask encoding defined by WO_xxx below. The +** use of a bitmask encoding for the operator allows us to search +** quickly for terms that match any of several different operators. +** +** A WhereTerm might also be two or more subterms connected by OR: +** +** (t1.X ) OR (t1.Y ) OR .... +** +** In this second case, wtFlag has the TERM_ORINFO bit set and eOperator==WO_OR +** and the WhereTerm.u.pOrInfo field points to auxiliary information that +** is collected about the OR clause. +** +** If a term in the WHERE clause does not match either of the two previous +** categories, then eOperator==0. The WhereTerm.pExpr field is still set +** to the original subexpression content and wtFlags is set up appropriately +** but no other fields in the WhereTerm object are meaningful. +** +** When eOperator!=0, prereqRight and prereqAll record sets of cursor numbers, +** but they do so indirectly. A single WhereMaskSet structure translates +** cursor number into bits and the translated bit is stored in the prereq +** fields. The translation is used in order to maximize the number of +** bits that will fit in a Bitmask. The VDBE cursor numbers might be +** spread out over the non-negative integers. For example, the cursor +** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45. The WhereMaskSet +** translates these sparse cursor numbers into consecutive integers +** beginning with 0 in order to make the best possible use of the available +** bits in the Bitmask. So, in the example above, the cursor numbers +** would be mapped into integers 0 through 7. +** +** The number of terms in a join is limited by the number of bits +** in prereqRight and prereqAll. The default is 64 bits, hence SQLite +** is only able to process joins with 64 or fewer tables. + */ +type TWhereTerm1 = struct { + FpExpr uintptr + FpWC uintptr + FtruthProb TLogEst + FwtFlags Tu16 + FeOperator Tu16 + FnChild Tu8 + FeMatchOp Tu8 + FiParent int32 + FleftCursor int32 + Fu struct { + FpOrInfo [0]uintptr + FpAndInfo [0]uintptr + Fx struct { + FleftColumn int32 + FiField int32 + } + } + FprereqRight TBitmask + FprereqAll TBitmask +} + +type WhereTerm1 = TWhereTerm1 + +/* +** Allowed values of WhereTerm.wtFlags + */ + +/* +** An instance of the WhereScan object is used as an iterator for locating +** terms in the WHERE clause that are useful to the query planner. + */ +type TWhereScan1 = struct { + FpOrigWC uintptr + FpWC uintptr + FzCollName uintptr + FpIdxExpr uintptr + Fk int32 + FopMask Tu32 + Fidxaff int8 + FiEquiv uint8 + FnEquiv uint8 + FaiCur [11]int32 + FaiColumn [11]Ti16 +} + +type WhereScan1 = TWhereScan1 + +/* +** An instance of the following structure holds all information about a +** WHERE clause. Mostly this is a container for one or more WhereTerms. +** +** Explanation of pOuter: For a WHERE clause of the form +** +** a AND ((b AND c) OR (d AND e)) AND f +** +** There are separate WhereClause objects for the whole clause and for +** the subclauses "(b AND c)" and "(d AND e)". The pOuter field of the +** subclauses points to the WhereClause object for the whole clause. + */ +type TWhereClause1 = struct { + FpWInfo uintptr + FpOuter uintptr + Fop Tu8 + FhasOr Tu8 + FnTerm int32 + FnSlot int32 + FnBase int32 + Fa uintptr + FaStatic [8]TWhereTerm +} + +type WhereClause1 = TWhereClause1 + +/* +** A WhereTerm with eOperator==WO_OR has its u.pOrInfo pointer set to +** a dynamically allocated instance of the following structure. + */ +type TWhereOrInfo1 = struct { + Fwc TWhereClause + Findexable TBitmask +} + +type WhereOrInfo1 = TWhereOrInfo1 + +/* +** A WhereTerm with eOperator==WO_AND has its u.pAndInfo pointer set to +** a dynamically allocated instance of the following structure. + */ +type TWhereAndInfo1 = struct { + Fwc TWhereClause +} + +type WhereAndInfo1 = TWhereAndInfo1 + +/* +** An instance of the following structure keeps track of a mapping +** between VDBE cursor numbers and bits of the bitmasks in WhereTerm. +** +** The VDBE cursor numbers are small integers contained in +** SrcItem.iCursor and Expr.iTable fields. For any given WHERE +** clause, the cursor numbers might not begin with 0 and they might +** contain gaps in the numbering sequence. But we want to make maximum +** use of the bits in our bitmasks. This structure provides a mapping +** from the sparse cursor numbers into consecutive integers beginning +** with 0. +** +** If WhereMaskSet.ix[A]==B it means that The A-th bit of a Bitmask +** corresponds VDBE cursor number B. The A-th bit of a bitmask is 1<3, 5->1, 8->2, 29->0, +** 57->5, 73->4. Or one of 719 other combinations might be used. It +** does not really matter. What is important is that sparse cursor +** numbers all get mapped into bit numbers that begin with 0 and contain +** no gaps. + */ +type TWhereMaskSet1 = struct { + FbVarSelect int32 + Fn int32 + Fix [64]int32 +} + +type WhereMaskSet1 = TWhereMaskSet1 + +/* +** This object is a convenience wrapper holding all information needed +** to construct WhereLoop objects for a particular query. + */ +type TWhereLoopBuilder1 = struct { + FpWInfo uintptr + FpWC uintptr + FpNew uintptr + FpOrSet uintptr + FpRec uintptr + FnRecValid int32 + FbldFlags1 uint8 + FbldFlags2 uint8 + FiPlanLimit uint32 +} + +type WhereLoopBuilder1 = TWhereLoopBuilder1 + +/* Allowed values for WhereLoopBuider.bldFlags */ + +/* The WhereLoopBuilder.iPlanLimit is used to limit the number of +** index+constraint combinations the query planner will consider for a +** particular query. If this parameter is unlimited, then certain +** pathological queries can spend excess time in the sqlite3WhereBegin() +** routine. The limit is high enough that is should not impact real-world +** queries. +** +** SQLITE_QUERY_PLANNER_LIMIT is the baseline limit. The limit is +** increased by SQLITE_QUERY_PLANNER_LIMIT_INCR before each term of the FROM +** clause is processed, so that every table in a join is guaranteed to be +** able to propose a some index+constraint combinations even if the initial +** baseline limit was exhausted by prior tables of the join. + */ + +/* +** The WHERE clause processing routine has two halves. The +** first part does the start of the WHERE loop and the second +** half does the tail of the WHERE loop. An instance of +** this structure is returned by the first half and passed +** into the second half to give some continuity. +** +** An instance of this object holds the complete state of the query +** planner. + */ +type TWhereInfo1 = struct { + FpParse uintptr + FpTabList uintptr + FpOrderBy uintptr + FpResultSet uintptr + FpSelect uintptr + FaiCurOnePass [2]int32 + FiContinue int32 + FiBreak int32 + FsavedNQueryLoop int32 + FwctrlFlags Tu16 + FiLimit TLogEst + FnLevel Tu8 + FnOBSat Ti8 + FeOnePass Tu8 + FeDistinct Tu8 + F__ccgo68 uint8 + FnRowOut TLogEst + FiTop int32 + FiEndWhere int32 + FpLoops uintptr + FpMemToFree uintptr + FrevMask TBitmask + FsWC TWhereClause + FsMaskSet TWhereMaskSet + Fa [1]TWhereLevel +} + +type WhereInfo1 = TWhereInfo1 + +/* +** Bitmasks for the operators on WhereTerm objects. These are all +** operators that are of interest to the query planner. An +** OR-ed combination of these values can be used when searching for +** particular WhereTerms within a WhereClause. +** +** Value constraints: +** WO_EQ == SQLITE_INDEX_CONSTRAINT_EQ +** WO_LT == SQLITE_INDEX_CONSTRAINT_LT +** WO_LE == SQLITE_INDEX_CONSTRAINT_LE +** WO_GT == SQLITE_INDEX_CONSTRAINT_GT +** WO_GE == SQLITE_INDEX_CONSTRAINT_GE + */ + +/* +** These are definitions of bits in the WhereLoop.wsFlags field. +** The particular combination of bits in each WhereLoop help to +** determine the algorithm that WhereLoop represents. + */ +/* 0x02000000 -- available for reuse */ + +/************** End of whereInt.h ********************************************/ +/************** Continuing where we left off in wherecode.c ******************/ + +// C documentation +// +// /* +// ** Return the name of the i-th column of the pIdx index. +// */ +func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { + i = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + if i == -int32(2) { + return __ccgo_ts + 22038 + } + if i == -int32(1) { + return __ccgo_ts + 16726 + } + return (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*16))).FzCnName +} + +// C documentation +// +// /* +// ** This routine is a helper for explainIndexRange() below +// ** +// ** pStr holds the text of an expression that we are building up one term +// ** at a time. This routine adds a new term to the end of the expression. +// ** Terms are separated by AND so add the "AND" text for second and subsequent +// ** terms only. +// */ +func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, iTerm int32, bAnd int32, zOp uintptr) { + var i int32 + _ = i + if bAnd != 0 { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22045, int32(5)) + } + if nTerm > int32(1) { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22051, int32(1)) + } + i = 0 + for { + if !(i < nTerm) { + break + } + if i != 0 { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13122, int32(1)) + } + Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) + goto _1 + _1: + ; + i++ + } + if nTerm > int32(1) { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5138, int32(1)) + } + Xsqlite3_str_append(tls, pStr, zOp, int32(1)) + if nTerm > int32(1) { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22051, int32(1)) + } + i = 0 + for { + if !(i < nTerm) { + break + } + if i != 0 { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+13122, int32(1)) + } + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5140, int32(1)) + goto _2 + _2: + ; + i++ + } + if nTerm > int32(1) { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5138, int32(1)) + } +} + +// C documentation +// +// /* +// ** Argument pLevel describes a strategy for scanning table pTab. This +// ** function appends text to pStr that describes the subset of table +// ** rows scanned by the strategy in the form of an SQL expression. +// ** +// ** For example, if the query: +// ** +// ** SELECT * FROM t1 WHERE a=1 AND b>2; +// ** +// ** is run and there is an index on (a, b), then this function returns a +// ** string similar to: +// ** +// ** "a=? AND b>?" +// */ +func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, j int32 + var nEq, nSkip Tu16 + var pIndex, z, v2 uintptr + _, _, _, _, _, _, _ = i, j, nEq, nSkip, pIndex, z, v2 + pIndex = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq + nSkip = (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip + if int32(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { + return + } + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22053, int32(2)) + i = 0 + for { + if !(i < int32(nEq)) { + break + } + z = _explainIndexColumnName(tls, pIndex, i) + if i != 0 { + Xsqlite3_str_append(tls, pStr, __ccgo_ts+22045, int32(5)) + } + if i >= int32(nSkip) { + v2 = __ccgo_ts + 22056 + } else { + v2 = __ccgo_ts + 22061 + } + Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) + goto _1 + _1: + ; + i++ + } + j = i + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm), j, i, __ccgo_ts+22069) + i = int32(1) + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { + _explainAppendTerm(tls, pStr, pIndex, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop), j, i, __ccgo_ts+22071) + } + Xsqlite3_str_append(tls, pStr, __ccgo_ts+5138, int32(1)) +} + +// C documentation +// +// /* +// ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN +// ** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG +// ** was defined at compile-time. If it is not a no-op, a single OP_Explain +// ** opcode is added to the output to describe the table scan strategy in pLevel. +// ** +// ** If an OP_Explain opcode is added to the VM, its address is returned. +// ** Otherwise, if no OP_Explain is coded, zero is returned. +// */ +func _sqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr, pLevel uintptr, wctrlFlags Tu16) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var cRangeOp int8 + var db, pIdx, pItem, pLoop, v, zFmt, zMsg, zRowid, v1, v2 uintptr + var flags Tu32 + var isSearch, ret int32 + var _ /* str at bp+0 */ TStrAccum + var _ /* zBuf at bp+32 */ [100]int8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cRangeOp, db, flags, isSearch, pIdx, pItem, pLoop, ret, v, zFmt, zMsg, zRowid, v1, v2 + ret = 0 + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + if int32((*TParse)(unsafe.Pointer(v1)).Fexplain) == int32(2) || libc.Bool(0 != 0) { + pItem = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* VM being constructed */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + flags = (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags + if flags&uint32(WHERE_MULTI_OR) != 0 || int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { + return 0 + } + isSearch = libc.BoolInt32(flags&uint32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) != uint32(0) || flags&uint32(WHERE_VIRTUALTABLE) == uint32(0) && int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) > 0 || int32(wctrlFlags)&(libc.Int32FromInt32(WHERE_ORDERBY_MIN)|libc.Int32FromInt32(WHERE_ORDERBY_MAX)) != 0) + _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) + (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) + if isSearch != 0 { + v2 = __ccgo_ts + 22073 + } else { + v2 = __ccgo_ts + 22080 + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22085, libc.VaList(bp+144, v2, pItem)) + if flags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { + zFmt = uintptr(0) + pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + if !((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + if isSearch != 0 { + zFmt = __ccgo_ts + 11285 + } + } else { + if flags&uint32(WHERE_PARTIALIDX) != 0 { + zFmt = __ccgo_ts + 22091 + } else { + if flags&uint32(WHERE_AUTO_INDEX) != 0 { + zFmt = __ccgo_ts + 22124 + } else { + if flags&uint32(WHERE_IDX_ONLY) != 0 { + zFmt = __ccgo_ts + 22149 + } else { + zFmt = __ccgo_ts + 22167 + } + } + } + } + if zFmt != 0 { + Xsqlite3_str_append(tls, bp, __ccgo_ts+22176, int32(7)) + Xsqlite3_str_appendf(tls, bp, zFmt, libc.VaList(bp+144, (*TIndex)(unsafe.Pointer(pIdx)).FzName)) + _explainIndexRange(tls, bp, pLoop) + } + } else { + if flags&uint32(WHERE_IPK) != uint32(0) && flags&uint32(WHERE_CONSTRAINT) != uint32(0) { + zRowid = __ccgo_ts + 16726 + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22184, libc.VaList(bp+144, zRowid)) + if flags&uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != 0 { + cRangeOp = int8('=') + } else { + if flags&uint32(WHERE_BOTH_LIMIT) == uint32(WHERE_BOTH_LIMIT) { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22215, libc.VaList(bp+144, zRowid)) + cRangeOp = int8('<') + } else { + if flags&uint32(WHERE_BTM_LIMIT) != 0 { + cRangeOp = int8('>') + } else { + cRangeOp = int8('<') + } + } + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22225, libc.VaList(bp+144, int32(cRangeOp))) + } else { + if flags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22230, libc.VaList(bp+144, (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FidxNum, (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FidxStr)) + } + } + } + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LEFT) != 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22257, 0) + } + zMsg = _sqlite3StrAccumFinish(tls, bp) + ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) + } + return ret +} + +// C documentation +// +// /* +// ** Add a single OP_Explain opcode that describes a Bloom filter. +// ** +// ** Or if not processing EXPLAIN QUERY PLAN and not in a SQLITE_DEBUG and/or +// ** SQLITE_ENABLE_STMT_SCANSTATUS build, then OP_Explain opcodes are not +// ** required and this routine is a no-op. +// ** +// ** If an OP_Explain opcode is added to the VM, its address is returned. +// ** Otherwise, if no OP_Explain is coded, zero is returned. +// */ +func _sqlite3WhereExplainBloomFilter(tls *libc.TLS, pParse uintptr, pWInfo uintptr, pLevel uintptr) (r int32) { + bp := tls.Alloc(160) + defer tls.Free(160) + var db, pItem, pLoop, pTab, v, z, zMsg uintptr + var i, ret int32 + var _ /* str at bp+0 */ TStrAccum + var _ /* zBuf at bp+32 */ [100]int8 + _, _, _, _, _, _, _, _, _ = db, i, pItem, pLoop, pTab, ret, v, z, zMsg + ret = 0 + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* VM being constructed */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Initial space for EQP output string */ + _sqlite3StrAccumInit(tls, bp, db, bp+32, int32(100), int32(SQLITE_MAX_LENGTH)) + (*(*TStrAccum)(unsafe.Pointer(bp))).FprintfFlags = uint8(SQLITE_PRINTF_INTERNAL) + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22268, libc.VaList(bp+144, pItem)) + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + if int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22056, libc.VaList(bp+144, (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*TTable)(unsafe.Pointer(pTab)).FiPKey)*16))).FzCnName)) + } else { + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22289, 0) + } + } else { + i = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq)) { + break + } + z = _explainIndexColumnName(tls, (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex, i) + if i > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { + Xsqlite3_str_append(tls, bp, __ccgo_ts+22045, int32(5)) + } + Xsqlite3_str_appendf(tls, bp, __ccgo_ts+22056, libc.VaList(bp+144, z)) + goto _1 + _1: + ; + i++ + } + } + Xsqlite3_str_append(tls, bp, __ccgo_ts+5138, int32(1)) + zMsg = _sqlite3StrAccumFinish(tls, bp) + ret = _sqlite3VdbeAddOp4(tls, v, int32(OP_Explain), _sqlite3VdbeCurrentAddr(tls, v), (*TParse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -int32(6)) + return ret +} + +// C documentation +// +// /* +// ** Disable a term in the WHERE clause. Except, do not disable the term +// ** if it controls a LEFT OUTER JOIN and it did not originate in the ON +// ** or USING clause of that join. +// ** +// ** Consider the term t2.z='ok' in the following queries: +// ** +// ** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok' +// ** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok' +// ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok' +// ** +// ** The t2.z='ok' is disabled in the in (2) because it originates +// ** in the ON clause. The term is disabled in (3) because it is not part +// ** of a LEFT OUTER JOIN. In (1), the term is not disabled. +// ** +// ** Disabling a term causes that term to not be tested in the inner loop +// ** of the join. Disabling is an optimization. When terms are satisfied +// ** by indices, we disable them to prevent redundant tests in the inner +// ** loop. We would get the correct results if nothing were ever disabled, +// ** but joins might run a little slower. The trick is to disable as much +// ** as we can without disabling too much. If we disabled in (1), we'd get +// ** the wrong answer. See ticket #813. +// ** +// ** If all the children of a term are disabled, then that term is also +// ** automatically disabled. In this way, terms get disabled if derived +// ** virtual terms are tested first. For example: +// ** +// ** x GLOB 'abc*' AND x>='abc' AND x<'acd' +// ** \___________/ \______/ \_____/ +// ** parent child1 child2 +// ** +// ** Only the parent term was in the original WHERE clause. The child1 +// ** and child2 terms were added by the LIKE optimization. If both of +// ** the virtual child terms are valid, then testing of the parent can be +// ** skipped. +// ** +// ** Usually the parent term is marked as TERM_CODED. But if the parent +// ** term was originally TERM_LIKE, then the parent gets TERM_LIKECOND instead. +// ** The TERM_LIKECOND marking indicates that the term should be coded inside +// ** a conditional such that is only evaluated on the second pass of a +// ** LIKE-optimization loop, when scanning BLOBs instead of strings. +// */ +func _disableTerm(tls *libc.TLS, pLevel uintptr, pTerm uintptr) { + var nLoop int32 + var p1, p2 uintptr + _, _, _ = nLoop, p1, p2 + nLoop = 0 + for int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_CODED) == 0 && ((*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin == 0 || (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0)) && (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady&(*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll == uint64(0) { + if nLoop != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_LIKE) != 0 { + p1 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(TERM_LIKECOND)) + } else { + p2 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(TERM_CODED)) + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FiParent < 0 { + break + } + pTerm = (*TWhereClause)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpWC)).Fa + uintptr((*TWhereTerm)(unsafe.Pointer(pTerm)).FiParent)*56 + (*TWhereTerm)(unsafe.Pointer(pTerm)).FnChild-- + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FnChild) != 0 { + break + } + nLoop++ + } +} + +// C documentation +// +// /* +// ** Code an OP_Affinity opcode to apply the column affinity string zAff +// ** to the n registers starting at base. +// ** +// ** As an optimization, SQLITE_AFF_BLOB and SQLITE_AFF_NONE entries (which +// ** are no-ops) at the beginning and end of zAff are ignored. If all entries +// ** in zAff are SQLITE_AFF_BLOB or SQLITE_AFF_NONE, then no code gets generated. +// ** +// ** This routine makes its own copy of zAff so that the caller is free +// ** to modify zAff after this routine returns. +// */ +func _codeApplyAffinity(tls *libc.TLS, pParse uintptr, base int32, n int32, zAff uintptr) { + var v uintptr + _ = v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + if zAff == uintptr(0) { + return + } + /* Adjust base and n to skip over SQLITE_AFF_BLOB and SQLITE_AFF_NONE + ** entries at the beginning and end of the affinity string. + */ + for n > 0 && int32(*(*int8)(unsafe.Pointer(zAff))) <= int32(SQLITE_AFF_BLOB) { + n-- + base++ + zAff++ + } + for n > int32(1) && int32(*(*int8)(unsafe.Pointer(zAff + uintptr(n-int32(1))))) <= int32(SQLITE_AFF_BLOB) { + n-- + } + /* Code the OP_Affinity opcode if there is anything left to do. */ + if n > 0 { + _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), base, n, 0, zAff, n) + } +} + +// C documentation +// +// /* +// ** Expression pRight, which is the RHS of a comparison operation, is +// ** either a vector of n elements or, if n==1, a scalar expression. +// ** Before the comparison operation, affinity zAff is to be applied +// ** to the pRight values. This function modifies characters within the +// ** affinity string to SQLITE_AFF_BLOB if either: +// ** +// ** * the comparison will be performed with no affinity, or +// ** * the affinity change in zAff is guaranteed not to change the value. +// */ +func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintptr) { + var i int32 + var p uintptr + _, _ = i, p + i = 0 + for { + if !(i < n) { + break + } + p = _sqlite3VectorFieldSubexpr(tls, pRight, i) + if int32(_sqlite3CompareAffinity(tls, p, *(*int8)(unsafe.Pointer(zAff + uintptr(i))))) == int32(SQLITE_AFF_BLOB) || _sqlite3ExprNeedsNoAffinityChange(tls, p, *(*int8)(unsafe.Pointer(zAff + uintptr(i)))) != 0 { + *(*int8)(unsafe.Pointer(zAff + uintptr(i))) = int8(SQLITE_AFF_BLOB) + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** pX is an expression of the form: (vector) IN (SELECT ...) +// ** In other words, it is a vector IN operator with a SELECT clause on the +// ** LHS. But not all terms in the vector are indexable and the terms might +// ** not be in the correct order for indexing. +// ** +// ** This routine makes a copy of the input pX expression and then adjusts +// ** the vector on the LHS with corresponding changes to the SELECT so that +// ** the vector contains only index terms and those terms are in the correct +// ** order. The modified IN expression is returned. The caller is responsible +// ** for deleting the returned expression. +// ** +// ** Example: +// ** +// ** CREATE TABLE t1(a,b,c,d,e,f); +// ** CREATE INDEX t1x1 ON t1(e,c); +// ** SELECT * FROM t1 WHERE (a,b,c,d,e) IN (SELECT v,w,x,y,z FROM t2) +// ** \_______________________________________/ +// ** The pX expression +// ** +// ** Since only columns e and c can be used with the index, in that order, +// ** the modified IN expression that is returned will be: +// ** +// ** (e,c) IN (SELECT z,x FROM t2) +// ** +// ** The reduced pX is different from the original (obviously) and thus is +// ** only used for indexing, to improve performance. The original unaltered +// ** IN expression must also be run on each output row for correctness. +// */ +func _removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, pLoop uintptr, pX uintptr) (r uintptr) { + var db, p, pLhs, pNew, pOrderBy, pOrigLhs, pOrigRhs, pRhs, pSelect uintptr + var i, iField int32 + _, _, _, _, _, _, _, _, _, _, _ = db, i, iField, p, pLhs, pNew, pOrderBy, pOrigLhs, pOrigRhs, pRhs, pSelect + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pNew = _sqlite3ExprDup(tls, db, pX, 0) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + pSelect = *(*uintptr)(unsafe.Pointer(pNew + 32)) + for { + if !(pSelect != 0) { + break + } /* Original unmodified RHS */ + pOrigLhs = uintptr(0) /* Original unmodified LHS */ + pRhs = uintptr(0) /* New RHS after modifications */ + pLhs = uintptr(0) /* Loop counter */ + pOrigRhs = (*TSelect)(unsafe.Pointer(pSelect)).FpEList + if pSelect == *(*uintptr)(unsafe.Pointer(pNew + 32)) { + pOrigLhs = *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pNew)).FpLeft + 32)) + } + i = iEq + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm)) { + break + } + if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + iField = (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)) + 32))).FiField - int32(1) + if (*(*TExprList_item)(unsafe.Pointer(pOrigRhs + 8 + uintptr(iField)*32))).FpExpr == uintptr(0) { + goto _2 + } /* Duplicate PK column */ + pRhs = _sqlite3ExprListAppend(tls, pParse, pRhs, (*(*TExprList_item)(unsafe.Pointer(pOrigRhs + 8 + uintptr(iField)*32))).FpExpr) + (*(*TExprList_item)(unsafe.Pointer(pOrigRhs + 8 + uintptr(iField)*32))).FpExpr = uintptr(0) + if pOrigLhs != 0 { + pLhs = _sqlite3ExprListAppend(tls, pParse, pLhs, (*(*TExprList_item)(unsafe.Pointer(pOrigLhs + 8 + uintptr(iField)*32))).FpExpr) + (*(*TExprList_item)(unsafe.Pointer(pOrigLhs + 8 + uintptr(iField)*32))).FpExpr = uintptr(0) + } + } + goto _2 + _2: + ; + i++ + } + _sqlite3ExprListDelete(tls, db, pOrigRhs) + if pOrigLhs != 0 { + _sqlite3ExprListDelete(tls, db, pOrigLhs) + *(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pNew)).FpLeft + 32)) = pLhs + } + (*TSelect)(unsafe.Pointer(pSelect)).FpEList = pRhs + if pLhs != 0 && (*TExprList)(unsafe.Pointer(pLhs)).FnExpr == int32(1) { + /* Take care here not to generate a TK_VECTOR containing only a + ** single value. Since the parser never creates such a vector, some + ** of the subroutines do not handle this case. */ + p = (*(*TExprList_item)(unsafe.Pointer(pLhs + 8))).FpExpr + (*(*TExprList_item)(unsafe.Pointer(pLhs + 8))).FpExpr = uintptr(0) + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pNew)).FpLeft) + (*TExpr)(unsafe.Pointer(pNew)).FpLeft = p + } + if (*TSelect)(unsafe.Pointer(pSelect)).FpOrderBy != 0 { + /* If the SELECT statement has an ORDER BY clause, zero the + ** iOrderByCol variables. These are set to non-zero when an + ** ORDER BY term exactly matches one of the terms of the + ** result-set. Since the result-set of the SELECT statement may + ** have been modified or reordered, these variables are no longer + ** set correctly. Since setting them is just an optimization, + ** it's easiest just to zero them here. */ + pOrderBy = (*TSelect)(unsafe.Pointer(pSelect)).FpOrderBy + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + *(*Tu16)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32 + 24)) = uint16(0) + goto _3 + _3: + ; + i++ + } + } + goto _1 + _1: + ; + pSelect = (*TSelect)(unsafe.Pointer(pSelect)).FpPrior + } + } + return pNew +} + +// C documentation +// +// /* +// ** Generate code for a single equality term of the WHERE clause. An equality +// ** term can be either X=expr or X IN (...). pTerm is the term to be +// ** coded. +// ** +// ** The current value for the constraint is left in a register, the index +// ** of which is returned. An attempt is made store the result in iTarget but +// ** this is only guaranteed for TK_ISNULL and TK_IN constraints. If the +// ** constraint is a TK_EQ or TK_IS, then the current value might be left in +// ** some other register and it is the caller's responsibility to compensate. +// ** +// ** For a constraint of the form X=expr, the expression is evaluated in +// ** straight-line code. For constraints of the form X IN (...) +// ** this routine sets up a loop that will iterate over all values of X. +// */ +func _codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uintptr, iEq int32, bRev int32, iTarget int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aiMap, db, pExpr, pIn, pLoop, pX, v uintptr + var eType, i, iCol, iMap, iOut, iReg, n, nEq, v3, v4, v6, v7, v8 int32 + var _ /* iTab at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aiMap, db, eType, i, iCol, iMap, iOut, iReg, n, nEq, pExpr, pIn, pLoop, pX, v, v3, v4, v6, v7, v8 + pX = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Register holding results */ + if int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_EQ) || int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_IS) { + iReg = _sqlite3ExprCodeTarget(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, iTarget) + } else { + if int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_ISNULL) { + iReg = iTarget + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, iReg) + } else { + eType = int32(IN_INDEX_NOOP) + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + nEq = 0 + aiMap = uintptr(0) + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex != uintptr(0) && *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex)).FaSortOrder + uintptr(iEq))) != 0 { + bRev = libc.BoolInt32(!(bRev != 0)) + } + iReg = iTarget + i = 0 + for { + if !(i < iEq) { + break + } + if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)) != 0 && (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + _disableTerm(tls, pLevel, pTerm) + return iTarget + } + goto _1 + _1: + ; + i++ + } + i = iEq + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm)) { + break + } + if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + nEq++ + } + goto _2 + _2: + ; + i++ + } + *(*int32)(unsafe.Pointer(bp)) = 0 + if !((*TExpr)(unsafe.Pointer(pX)).Fflags&libc.Uint32FromInt32(EP_xIsSelect) != libc.Uint32FromInt32(0)) || (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pX + 32)))).FpEList)).FnExpr == int32(1) { + eType = _sqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), uintptr(0), bp) + } else { + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == 0 || !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Subrtn)) != libc.Uint32FromInt32(0)) { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pX = _removeUnindexableInClauseTerms(tls, pParse, iEq, pLoop, pX) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*uint64(nEq)) + eType = _sqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), aiMap, bp) + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = *(*int32)(unsafe.Pointer(bp)) + } + _sqlite3ExprDelete(tls, db, pX) + } else { + n = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pX)).FpLeft) + if nEq > n { + v3 = nEq + } else { + v3 = n + } + aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*uint64(v3)) + eType = _sqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), aiMap, bp) + } + pX = pExpr + } + if eType == int32(IN_INDEX_INDEX_DESC) { + bRev = libc.BoolInt32(!(bRev != 0)) + } + if bRev != 0 { + v4 = int32(OP_Last) + } else { + v4 = int32(OP_Rewind) + } + _sqlite3VdbeAddOp2(tls, v, v4, *(*int32)(unsafe.Pointer(bp)), 0) + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_IN_ABLE) + if (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn == 0 { + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt = _sqlite3VdbeMakeLabel(tls, pParse) + } + if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_SEEKSCAN) == uint32(0) { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_IN_EARLYOUT) + } + i = (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn + (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn += nEq + (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FaInLoop = _sqlite3WhereRealloc(tls, (*TWhereClause)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpWC)).FpWInfo, (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FaInLoop, uint64(20)*uint64((*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn)) + pIn = (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FaInLoop + if pIn != 0 { + iMap = 0 /* Index in aiMap[] */ + pIn += uintptr(i) * 20 + i = iEq + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm)) { + break + } + if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + iOut = iReg + i - iEq + if eType == int32(IN_INDEX_ROWID) { + (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop = _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), *(*int32)(unsafe.Pointer(bp)), iOut) + } else { + if aiMap != 0 { + v7 = iMap + iMap++ + v6 = *(*int32)(unsafe.Pointer(aiMap + uintptr(v7)*4)) + } else { + v6 = 0 + } + iCol = v6 + (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop = _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), *(*int32)(unsafe.Pointer(bp)), iCol, iOut) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), iOut) + if i == iEq { + (*TInLoop)(unsafe.Pointer(pIn)).FiCur = *(*int32)(unsafe.Pointer(bp)) + if bRev != 0 { + v8 = int32(OP_Prev) + } else { + v8 = int32(OP_Next) + } + (*TInLoop)(unsafe.Pointer(pIn)).FeEndLoopOp = uint8(v8) + if iEq > 0 { + (*TInLoop)(unsafe.Pointer(pIn)).FiBase = iReg - i + (*TInLoop)(unsafe.Pointer(pIn)).FnPrefix = i + } else { + (*TInLoop)(unsafe.Pointer(pIn)).FnPrefix = 0 + } + } else { + (*TInLoop)(unsafe.Pointer(pIn)).FeEndLoopOp = uint8(OP_Noop) + } + pIn += 20 + } + goto _5 + _5: + ; + i++ + } + if iEq > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IN_SEEKSCAN)|libc.Int32FromInt32(WHERE_VIRTUALTABLE)) == uint32(0) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekHit), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, 0, iEq) + } + } else { + (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn = 0 + } + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, aiMap) + } + } + /* As an optimization, try to disable the WHERE clause term that is + ** driving the index as it will always be true. The correct answer is + ** obtained regardless, but we might get the answer with fewer CPU cycles + ** by omitting the term. + ** + ** But do not disable the term unless we are certain that the term is + ** not a transitive constraint. For an example of where that does not + ** work, see https://sqlite.org/forum/forumpost/eb8613976a (2021-05-04) + */ + if (*TWhereLoop1)(unsafe.Pointer((*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags&uint32(WHERE_TRANSCONS) == uint32(0) || int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_EQUIV) == 0 { + _disableTerm(tls, pLevel, pTerm) + } + return iReg +} + +// C documentation +// +// /* +// ** Generate code that will evaluate all == and IN constraints for an +// ** index scan. +// ** +// ** For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c). +// ** Suppose the WHERE clause is this: a==5 AND b IN (1,2,3) AND c>5 AND c<10 +// ** The index has as many as three equality constraints, but in this +// ** example, the third "c" value is an inequality. So only two +// ** constraints are coded. This routine will generate code to evaluate +// ** a==5 and b IN (1,2,3). The current values for a and b will be stored +// ** in consecutive registers and the index of the first register is returned. +// ** +// ** In the example above nEq==2. But this subroutine works for any value +// ** of nEq including 0. If nEq==0, this routine is nearly a no-op. +// ** The only thing it does is allocate the pLevel->iMem memory cell and +// ** compute the affinity string. +// ** +// ** The nExtraReg parameter is 0 or 1. It is 0 if all WHERE clause constraints +// ** are == or IN and are covered by the nEq. nExtraReg is 1 if there is +// ** an inequality constraint (such as the "c>=5 AND c<10" in the example) that +// ** occurs after the nEq quality constraints. +// ** +// ** This routine allocates a range of nEq+nExtraReg memory cells and returns +// ** the index of the first memory cell in that range. The code that +// ** calls this routine will use that memory range to store keys for +// ** start and termination conditions of the loop. +// ** key value of the loop. If one or more IN operators appear, then +// ** this routine allocates an additional nEq memory cells for internal +// ** use. +// ** +// ** Before returning, *pzAff is set to point to a buffer containing a +// ** copy of the column affinity string of the index allocated using +// ** sqlite3DbMalloc(). Except, entries in the copy of the string associated +// ** with equality constraints that use BLOB or NONE affinity are set to +// ** SQLITE_AFF_BLOB. This is to deal with SQL such as the following: +// ** +// ** CREATE TABLE t1(a TEXT PRIMARY KEY, b); +// ** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b; +// ** +// ** In the example above, the index on t1(a) has TEXT affinity. But since +// ** the right hand side of the equality constraint (t2.b) has BLOB/NONE affinity, +// ** no conversion should be attempted before using a t2.b value as part of +// ** a key to search the index. Hence the first byte in the returned affinity +// ** string in this example would be set to SQLITE_AFF_BLOB. +// */ +func _codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev int32, nExtraReg int32, pzAff uintptr) (r int32) { + var iIdxCur, j, nReg, r1, regBase, v1, v2 int32 + var nEq, nSkip Tu16 + var pIdx, pLoop, pRight, pTerm, v, zAff uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iIdxCur, j, nEq, nReg, nSkip, pIdx, pLoop, pRight, pTerm, r1, regBase, v, zAff, v1, v2 /* Number of left-most columns to skip */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Affinity string to return */ + /* This module is only called on query plans that use an index. */ + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq + nSkip = (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip + pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + /* Figure out how many memory cells we will need then allocate them. + */ + regBase = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + nReg = int32(nEq) + nExtraReg + *(*int32)(unsafe.Pointer(pParse + 56)) += nReg + zAff = _sqlite3DbStrDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx)) + if nSkip != 0 { + iIdxCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, regBase, regBase+int32(nSkip)-int32(1)) + if bRev != 0 { + v1 = int32(OP_Last) + } else { + v1 = int32(OP_Rewind) + } + _sqlite3VdbeAddOp1(tls, v, v1, iIdxCur) + j = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) + if bRev != 0 { + v2 = int32(OP_SeekLT) + } else { + v2 = int32(OP_SeekGT) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip = _sqlite3VdbeAddOp4Int(tls, v, v2, iIdxCur, 0, regBase, int32(nSkip)) + _sqlite3VdbeJumpHere(tls, v, j) + j = 0 + for { + if !(j < int32(nSkip)) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, j, regBase+j) + goto _3 + _3: + ; + j++ + } + } + /* Evaluate the equality constraints + */ + j = int32(nSkip) + for { + if !(j < int32(nEq)) { + break + } + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + /* The following testcase is true for indices with redundant columns. + ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */ + r1 = _codeEqualityTerm(tls, pParse, pTerm, pLevel, j, bRev, regBase+j) + if r1 != regBase+j { + if nReg == int32(1) { + _sqlite3ReleaseTempReg(tls, pParse, regBase) + regBase = r1 + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), r1, regBase+j) + } + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_IN) != 0 { + if (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(EP_xIsSelect) != 0 { + /* No affinity ever needs to be (or should be) applied to a value + ** from the RHS of an "? IN (SELECT ...)" expression. The + ** sqlite3FindInIndex() routine has already ensured that the + ** affinity of the comparison has been applied to the value. */ + if zAff != 0 { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + } + } else { + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_ISNULL) == 0 { + pRight = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_IS) == 0 && _sqlite3ExprCanBeNull(tls, pRight) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regBase+j, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { + if int32(_sqlite3CompareAffinity(tls, pRight, *(*int8)(unsafe.Pointer(zAff + uintptr(j))))) == int32(SQLITE_AFF_BLOB) { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + if _sqlite3ExprNeedsNoAffinityChange(tls, pRight, *(*int8)(unsafe.Pointer(zAff + uintptr(j)))) != 0 { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + } + } + } + goto _4 + _4: + ; + j++ + } + *(*uintptr)(unsafe.Pointer(pzAff)) = zAff + return regBase +} + +// C documentation +// +// /* +// ** Cursor iCur is open on an intkey b-tree (a table). Register iRowid contains +// ** a rowid value just read from cursor iIdxCur, open on index pIdx. This +// ** function generates code to do a deferred seek of cursor iCur to the +// ** rowid stored in register iRowid. +// ** +// ** Normally, this is just: +// ** +// ** OP_DeferredSeek $iCur $iRowid +// ** +// ** Which causes a seek on $iCur to the row with rowid $iRowid. +// ** +// ** However, if the scan currently being coded is a branch of an OR-loop and +// ** the statement currently being coded is a SELECT, then additional information +// ** is added that might allow OP_Column to omit the seek and instead do its +// ** lookup on the index, thus avoiding an expensive seek operation. To +// ** enable this optimization, the P3 of OP_DeferredSeek is set to iIdxCur +// ** and P4 is set to an array of integers containing one entry for each column +// ** in the table. For each table column, if the column is the i'th +// ** column of the index, then the corresponding array entry is set to (i+1). +// ** If the column does not appear in the index at all, the array entry is set +// ** to 0. The OP_Column opcode can check this array to see if the column it +// ** wants is in the index and if it is, it will substitute the index cursor +// ** and column number and continue with those new values, rather than seeking +// ** the table cursor. +// */ +func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, iIdxCur int32) { + var ai, pParse, pTab, v, v1 uintptr + var i, x1, x2 int32 + var v2 bool + _, _, _, _, _, _, _, _, _ = ai, i, pParse, pTab, v, x1, x2, v1, v2 + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parse context */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Vdbe to generate code within */ + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 0, 0x1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_DeferredSeek), iIdxCur, 0, iCur) + if v2 = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&(libc.Int32FromInt32(WHERE_OR_SUBCLAUSE)|libc.Int32FromInt32(WHERE_RIGHT_JOIN)) != 0; v2 { + if (*TParse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + v1 = (*TParse)(unsafe.Pointer(pParse)).FpToplevel + } else { + v1 = pParse + } + } + if v2 && (*TParse)(unsafe.Pointer(v1)).FwriteMask == uint32(0) { + pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable + ai = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*uint64(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+libc.Int32FromInt32(1))) + if ai != 0 { + *(*Tu32)(unsafe.Pointer(ai)) = uint32((*TTable)(unsafe.Pointer(pTab)).FnCol) + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)-int32(1)) { + break + } + x1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + x2 = int32(_sqlite3TableColumnToStorage(tls, pTab, int16(x1))) + if x1 >= 0 { + *(*Tu32)(unsafe.Pointer(ai + uintptr(x2+int32(1))*4)) = uint32(i + int32(1)) + } + goto _3 + _3: + ; + i++ + } + _sqlite3VdbeChangeP4(tls, v, -int32(1), ai, -int32(14)) + } + } +} + +// C documentation +// +// /* +// ** If the expression passed as the second argument is a vector, generate +// ** code to write the first nReg elements of the vector into an array +// ** of registers starting with iReg. +// ** +// ** If the expression is not a vector, then nReg must be passed 1. In +// ** this case, generate code to evaluate the expression and leave the +// ** result in register iReg. +// */ +func _codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nReg int32) { + var i, iSelect int32 + var pList, v uintptr + _, _, _, _ = i, iSelect, pList, v + if p != 0 && _sqlite3ExprIsVector(tls, p) != 0 { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + iSelect = _sqlite3CodeSubselect(tls, pParse, p) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), iSelect, iReg, nReg-int32(1)) + } else { + pList = *(*uintptr)(unsafe.Pointer(p + 32)) + i = 0 + for { + if !(i < nReg) { + break + } + _sqlite3ExprCode(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, iReg+i) + goto _1 + _1: + ; + i++ + } + } + } else { + _sqlite3ExprCode(tls, pParse, p, iReg) + } +} + +// C documentation +// +// /* +// ** The pTruth expression is always true because it is the WHERE clause +// ** a partial index that is driving a query loop. Look through all of the +// ** WHERE clause terms on the query, and if any of those terms must be +// ** true because pTruth is true, then mark those WHERE clause terms as +// ** coded. +// */ +func _whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur int32, pWC uintptr) { + var i int32 + var pExpr, pTerm, p2 uintptr + _, _, _, _ = i, pExpr, pTerm, p2 + for int32((*TExpr)(unsafe.Pointer(pTruth)).Fop) == int32(TK_AND) { + _whereApplyPartialIndexConstraints(tls, (*TExpr)(unsafe.Pointer(pTruth)).FpLeft, iTabCur, pWC) + pTruth = (*TExpr)(unsafe.Pointer(pTruth)).FpRight + } + i = 0 + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(i < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_CODED) != 0 { + goto _1 + } + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if _sqlite3ExprCompare(tls, uintptr(0), pExpr, pTruth, iTabCur) == 0 { + p2 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(TERM_CODED)) + } + goto _1 + _1: + ; + i++ + pTerm += 56 + } +} + +// C documentation +// +// /* +// ** This routine is called right after An OP_Filter has been generated and +// ** before the corresponding index search has been performed. This routine +// ** checks to see if there are additional Bloom filters in inner loops that +// ** can be checked prior to doing the index lookup. If there are available +// ** inner-loop Bloom filters, then evaluate those filters now, before the +// ** index lookup. The idea is that a Bloom filter check is way faster than +// ** an index lookup, and the Bloom filter might return false, meaning that +// ** the index lookup can be skipped. +// ** +// ** We know that an inner loop uses a Bloom filter because it has the +// ** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked, +// ** then clear the WhereLevel.regFilter value to prevent the Bloom filter +// ** from being checked a second time when the inner loop is evaluated. +// */ +func _filterPullDown(tls *libc.TLS, pParse uintptr, pWInfo uintptr, iLevel int32, addrNxt int32, notReady TBitmask) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nEq Tu16 + var pLevel, pLoop, pTerm uintptr + var r1, regRowid, v1 int32 + var _ /* zStartAff at bp+0 */ uintptr + _, _, _, _, _, _, _ = nEq, pLevel, pLoop, pTerm, r1, regRowid, v1 + for { + iLevel++ + v1 = iLevel + if !(v1 < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { + break + } + pLevel = pWInfo + 856 + uintptr(iLevel)*104 + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter == 0 { + continue + } + if (*TWhereLoop1)(unsafe.Pointer((*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FnSkip != 0 { + continue + } + /* ,--- Because sqlite3ConstructBloomFilter() has will not have set + ** vvvvv--' pLevel->regFilter if this were true. */ + if (*TWhereLoop)(unsafe.Pointer(pLoop)).Fprereq¬Ready != 0 { + continue + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk = addrNxt + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) + regRowid = _sqlite3GetTempReg(tls, pParse) + regRowid = _codeEqualityTerm(tls, pParse, pTerm, pLevel, 0, 0, regRowid) + _sqlite3VdbeAddOp2(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_MustBeInt), regRowid, addrNxt) + _sqlite3VdbeAddOp4Int(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Filter), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, addrNxt, regRowid, int32(1)) + } else { + nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq + r1 = _codeAllEqualityTerms(tls, pParse, pLevel, 0, 0, bp) + _codeApplyAffinity(tls, pParse, r1, int32(nEq), *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3DbFree(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3VdbeAddOp4Int(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Filter), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, addrNxt, r1, int32(nEq)) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter = 0 + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk = 0 + } +} + +// C documentation +// +// /* +// ** Generate code for the start of the iLevel-th loop in the WHERE clause +// ** implementation described by pWInfo. +// */ +func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWInfo uintptr, iLevel int32, pLevel uintptr, notReady TBitmask) (r2 TBitmask) { + bp := tls.Alloc(112) + defer tls.Free(112) + var aMoveOp [4]Tu8 + var addrBrk, addrCont, addrExplain, addrHalt, addrNotFound, addrNxt, addrSeekScan, bRev, endEq, iCache, iCol, iCol1, iCovCur, iCur, iFld, iIdxCur, iIn, iLoop, iLoopBody, iNext, iPk, iPk1, iReg, iReleaseReg, iRetInit, iRowidReg, iSet, iTab, iTarget, iTerm, ii, j, jmp1, jmp11, k, memEndValue, nConstraint, nConstraint1, nExtraReg, nNotReady, nPk, nPk1, omitTable, op, op1, r, r1, r11, regBase, regBignull, regReturn, regRowid, regRowset, regYield, skipLikeAddr, start, startEq, start_constraints, testOp, untestedTerms, v1, v11, v13, v14, v2, v20, v23, v24, v25, v26, v27, v29, v3, v30, v31, v32, v34, v35, v36, v37, v38, v39, v4, v41, v43, v44, v46, v49, v51, v53, v58, v60, v9 int32 + var bSeekPastNull, bStopAtNull, t1, t2 Tu8 + var db, origSrc, pAlt, pAndExpr, pCompare, pCov, pDelete, pE, pE1, pEnd, pExpr, pIdx, pLeft, pLoop, pOp, pOrExpr, pOrTab, pOrTerm, pOrWc, pPk, pPk1, pPk2, pPk3, pRJ, pRJ1, pRangeEnd, pRangeStart, pRight, pRight1, pRight2, pRight3, pStart, pSubLoop, pSubWInfo, pTab, pTab1, pTabItem, pTerm, pWC, pX, pX1, t, zEndAff, v10, v12, v19, v21, v22, v28, v33, v40, v45, v47, v5, v50, v52, v54, v57, p62, p64, p68 uintptr + var m TBitmask + var nBtm, nEq, nTop Tu16 + var v16, v8 uint32 + var v17 bool + var _ /* rTemp at bp+0 */ int32 + var _ /* sEAlt at bp+16 */ TExpr + var _ /* zStartAff at bp+8 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aMoveOp, addrBrk, addrCont, addrExplain, addrHalt, addrNotFound, addrNxt, addrSeekScan, bRev, bSeekPastNull, bStopAtNull, db, endEq, iCache, iCol, iCol1, iCovCur, iCur, iFld, iIdxCur, iIn, iLoop, iLoopBody, iNext, iPk, iPk1, iReg, iReleaseReg, iRetInit, iRowidReg, iSet, iTab, iTarget, iTerm, ii, j, jmp1, jmp11, k, m, memEndValue, nBtm, nConstraint, nConstraint1, nEq, nExtraReg, nNotReady, nPk, nPk1, nTop, omitTable, op, op1, origSrc, pAlt, pAndExpr, pCompare, pCov, pDelete, pE, pE1, pEnd, pExpr, pIdx, pLeft, pLoop, pOp, pOrExpr, pOrTab, pOrTerm, pOrWc, pPk, pPk1, pPk2, pPk3, pRJ, pRJ1, pRangeEnd, pRangeStart, pRight, pRight1, pRight2, pRight3, pStart, pSubLoop, pSubWInfo, pTab, pTab1, pTabItem, pTerm, pWC, pX, pX1, r, r1, r11, regBase, regBignull, regReturn, regRowid, regRowset, regYield, skipLikeAddr, start, startEq, start_constraints, t, t1, t2, testOp, untestedTerms, zEndAff, v1, v10, v11, v12, v13, v14, v16, v17, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v43, v44, v45, v46, v47, v49, v5, v50, v51, v52, v53, v54, v57, v58, v60, v8, v9, p62, p64, p68 /* Jump here to continue with next cycle */ + iRowidReg = 0 /* Rowid is stored in this register, if not zero */ + iReleaseReg = 0 /* Temp register to free before returning */ + pIdx = uintptr(0) /* Iteration of constraint generator loop */ + pWC = pWInfo + 104 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + iCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor + (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady = notReady & ^_sqlite3WhereGetMask(tls, pWInfo+592, iCur) + bRev = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FrevMask >> iLevel & uint64(1)) + /* Create labels for the "break" and "continue" instructions + ** for the current loop. Jump to addrBrk to break out of a loop. + ** Jump to cont to go immediately to the next iteration of the + ** loop. + ** + ** When there is an IN operator, we also have a "addrNxt" label that + ** means to continue with the next IN value combination. When + ** there are no IN operators in the constraints, the "addrNxt" label + ** is the same as "addrBrk". + */ + v2 = _sqlite3VdbeMakeLabel(tls, pParse) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt = v2 + v1 = v2 + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk = v1 + addrBrk = v1 + v3 = _sqlite3VdbeMakeLabel(tls, pParse) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont = v3 + addrCont = v3 + /* If this is the right table of a LEFT OUTER JOIN, allocate and + ** initialize a memory cell that records if this table matches any + ** row of the left table of the join. + */ + if int32((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom) > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pTabItem))).Ffg.Fjointype)&int32(JT_LEFT) != 0 { + v5 = pParse + 56 + *(*int32)(unsafe.Pointer(v5))++ + v4 = *(*int32)(unsafe.Pointer(v5)) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin = v4 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + } + /* Compute a safe address to jump to if we discover that the table for + ** this loop is empty and can never contribute content. */ + j = iLevel + for { + if !(j > 0) { + break + } + if (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FiLeftJoin != 0 { + break + } + if (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FpRJ != 0 { + break + } + goto _6 + _6: + ; + j-- + } + addrHalt = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(j)*104))).FaddrBrk + /* Special case of a FROM clause subquery implemented as a co-routine */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pTabItem + 60 + 4))&0x20>>5)) != 0 { + regYield = (*TSrcItem)(unsafe.Pointer(pTabItem)).FregReturn + _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regYield, 0, (*TSrcItem)(unsafe.Pointer(pTabItem)).FaddrFillSub) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeAddOp2(tls, v, int32(OP_Yield), regYield, addrBrk) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Goto) + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { + nConstraint = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) + iReg = _sqlite3GetTempRange(tls, pParse, nConstraint+int32(2)) + addrNotFound = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk + j = 0 + for { + if !(j < nConstraint) { + break + } + iTarget = iReg + j + int32(2) + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if pTerm == uintptr(0) { + goto _7 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_IN) != 0 { + if j <= int32(31) { + v8 = libc.Uint32FromInt32(1) << j + } else { + v8 = uint32(0) + } + if v8&(*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FmHandleIn != 0 { + v10 = pParse + 52 + v9 = *(*int32)(unsafe.Pointer(v10)) + *(*int32)(unsafe.Pointer(v10))++ + iTab = v9 + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + iCache = v11 + _sqlite3CodeRhsOfIN(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, iTab) + _sqlite3VdbeAddOp3(tls, v, int32(OP_VInitIn), iTab, iTarget, iCache) + } else { + _codeEqualityTerm(tls, pParse, pTerm, pLevel, j, bRev, iTarget) + addrNotFound = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + } + } else { + pRight = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + _codeExprOrVector(tls, pParse, pRight, iTarget, int32(1)) + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) == int32(SQLITE_INDEX_CONSTRAINT_OFFSET) && int32(Tu32(*(*uint8)(unsafe.Pointer(pLoop + 24 + 4))&0x2>>1)) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FiOffset) + } + } + goto _7 + _7: + ; + j++ + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FidxNum, iReg) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nConstraint, iReg+int32(1)) + if int32(Tu32(*(*uint8)(unsafe.Pointer(pLoop + 24 + 4))&0x1>>0)) != 0 { + v13 = -int32(6) + } else { + v13 = -int32(1) + } + _sqlite3VdbeAddOp4(tls, v, int32(OP_VFilter), iCur, addrNotFound, iReg, (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FidxStr, v13) + libc.SetBitFieldPtr8Uint32(pLoop+24+4, libc.Uint32FromInt32(0), 0, 0x1) + /* An OOM inside of AddOp4(OP_VFilter) instruction above might have freed + ** the u.vtab.idxStr. NULL it out to prevent a use-after-free */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FidxStr = uintptr(0) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass != 0 { + v14 = int32(OP_Noop) + } else { + v14 = int32(OP_VNext) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(v14) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeCurrentAddr(tls, v) + j = 0 + for { + if !(j < nConstraint) { + break + } + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if j < int32(16) && int32((*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FomitMask)>>j&int32(1) != 0 { + _disableTerm(tls, pLevel, pTerm) + goto _15 + } + if v17 = int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_IN) != 0; v17 { + if j <= int32(31) { + v16 = libc.Uint32FromInt32(1) << j + } else { + v16 = uint32(0) + } + } + if v17 && v16&(*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FmHandleIn == uint32(0) && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { /* IN loop corresponding to the j-th constraint */ + /* Reload the constraint value into reg[iReg+j+2]. The same value + ** was loaded into the same register prior to the OP_VFilter, but + ** the xFilter implementation might have changed the datatype or + ** encoding of the value in the register, so it *must* be reloaded. + */ + iIn = 0 + for { + if !(iIn < (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn) { + break + } + pOp = _sqlite3VdbeGetOp(tls, v, (*(*TInLoop)(unsafe.Pointer((*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FaInLoop + uintptr(iIn)*20))).FaddrInTop) + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 == iReg+j+int32(2) || int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Rowid) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 == iReg+j+int32(2) { + _sqlite3VdbeAddOp3(tls, v, int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode), (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1, (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2, (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3) + break + } + goto _18 + _18: + ; + iIn++ + } + /* Generate code that will continue to the next row if + ** the IN constraint is not satisfied + */ + pCompare = _sqlite3PExpr(tls, pParse, int32(TK_EQ), uintptr(0), uintptr(0)) + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + iFld = (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FiField + pLeft = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft + if iFld > 0 { + (*TExpr)(unsafe.Pointer(pCompare)).FpLeft = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 32)) + 8 + uintptr(iFld-int32(1))*32))).FpExpr + } else { + (*TExpr)(unsafe.Pointer(pCompare)).FpLeft = pLeft + } + v19 = _sqlite3Expr(tls, db, int32(TK_REGISTER), uintptr(0)) + pRight1 = v19 + (*TExpr)(unsafe.Pointer(pCompare)).FpRight = v19 + if pRight1 != 0 { + (*TExpr)(unsafe.Pointer(pRight1)).FiTable = iReg + j + int32(2) + _sqlite3ExprIfFalse(tls, pParse, pCompare, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont, int32(SQLITE_JUMPIFNULL)) + } + (*TExpr)(unsafe.Pointer(pCompare)).FpLeft = uintptr(0) + } + _sqlite3ExprDelete(tls, db, pCompare) + } + goto _15 + _15: + ; + j++ + } + /* These registers need to be preserved in case there is an IN operator + ** loop. So we could deallocate the registers here (and potentially + ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems + ** simpler and safer to simply not reuse the registers. + ** + ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); + */ + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_COLUMN_IN)|libc.Int32FromInt32(WHERE_COLUMN_EQ)) != uint32(0) { + /* Case 2: We can directly reference a single row using an + ** equality comparison against the ROWID field. Or + ** we reference multiple rows using a "rowid IN (...)" + ** construct. + */ + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) + v21 = pParse + 56 + *(*int32)(unsafe.Pointer(v21))++ + v20 = *(*int32)(unsafe.Pointer(v21)) + iReleaseReg = v20 + iRowidReg = _codeEqualityTerm(tls, pParse, pTerm, pLevel, 0, bRev, iReleaseReg) + if iRowidReg != iReleaseReg { + _sqlite3ReleaseTempReg(tls, pParse, iReleaseReg) + } + addrNxt = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_MustBeInt), iRowidReg, addrNxt) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Filter), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, addrNxt, iRowidReg, int32(1)) + _filterPullDown(tls, pParse, pWInfo, iLevel, addrNxt, notReady) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), iCur, addrNxt, iRowidReg) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Noop) + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_COLUMN_RANGE) != uint32(0) { + /* Case 3: We have an inequality comparison against the ROWID field. + */ + testOp = int32(OP_Noop) + memEndValue = 0 + j = 0 + v22 = libc.UintptrFromInt32(0) + pEnd = v22 + pStart = v22 + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { + v23 = j + j++ + pStart = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(v23)*8)) + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { + v24 = j + j++ + pEnd = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(v24)*8)) + } + if bRev != 0 { + pTerm = pStart + pStart = pEnd + pEnd = pTerm + } + if pStart != 0 { /* Cursor seek operation */ + /* The following constant maps TK_xx codes into corresponding + ** seek opcodes. It depends on a particular ordering of TK_xx + */ + aMoveOp = [4]Tu8{ + 0: uint8(OP_SeekGT), + 1: uint8(OP_SeekLE), + 2: uint8(OP_SeekLT), + 3: uint8(OP_SeekGE), + } + /* Make sure the ordering.. */ + /* ... of the TK_xx values... */ + /* ... is correct. */ + pX = (*TWhereTerm)(unsafe.Pointer(pStart)).FpExpr + /* transitive constraints */ + if _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pX)).FpRight) != 0 { + v25 = _sqlite3GetTempReg(tls, pParse) + *(*int32)(unsafe.Pointer(bp)) = v25 + r11 = v25 + _codeExprOrVector(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, r11, int32(1)) + op = int32(aMoveOp[(int32((*TExpr)(unsafe.Pointer(pX)).Fop)-int32(TK_GT)-int32(1))&int32(0x3)|int32(0x1)]) + } else { + r11 = _sqlite3ExprCodeTemp(tls, pParse, (*TExpr)(unsafe.Pointer(pX)).FpRight, bp) + _disableTerm(tls, pLevel, pStart) + op = int32(aMoveOp[int32((*TExpr)(unsafe.Pointer(pX)).Fop)-int32(TK_GT)]) + } + _sqlite3VdbeAddOp3(tls, v, op, iCur, addrBrk, r11) + _sqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp))) + } else { + if bRev != 0 { + v26 = int32(OP_Last) + } else { + v26 = int32(OP_Rewind) + } + _sqlite3VdbeAddOp2(tls, v, v26, iCur, addrHalt) + } + if pEnd != 0 { + pX1 = (*TWhereTerm)(unsafe.Pointer(pEnd)).FpExpr + /* Transitive constraints */ + v28 = pParse + 56 + *(*int32)(unsafe.Pointer(v28))++ + v27 = *(*int32)(unsafe.Pointer(v28)) + memEndValue = v27 + _codeExprOrVector(tls, pParse, (*TExpr)(unsafe.Pointer(pX1)).FpRight, memEndValue, int32(1)) + if 0 == _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pX1)).FpRight) && (int32((*TExpr)(unsafe.Pointer(pX1)).Fop) == int32(TK_LT) || int32((*TExpr)(unsafe.Pointer(pX1)).Fop) == int32(TK_GT)) { + if bRev != 0 { + v29 = int32(OP_Le) + } else { + v29 = int32(OP_Ge) + } + testOp = v29 + } else { + if bRev != 0 { + v30 = int32(OP_Lt) + } else { + v30 = int32(OP_Gt) + } + testOp = v30 + } + if 0 == _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer(pX1)).FpRight) { + _disableTerm(tls, pLevel, pEnd) + } + } + start = _sqlite3VdbeCurrentAddr(tls, v) + if bRev != 0 { + v31 = int32(OP_Prev) + } else { + v31 = int32(OP_Next) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(v31) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = start + if testOp != int32(OP_Noop) { + v33 = pParse + 56 + *(*int32)(unsafe.Pointer(v33))++ + v32 = *(*int32)(unsafe.Pointer(v33)) + iRowidReg = v32 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iCur, iRowidReg) + _sqlite3VdbeAddOp3(tls, v, testOp, memEndValue, addrBrk, iRowidReg) + _sqlite3VdbeChangeP5(tls, v, uint16(libc.Int32FromInt32(SQLITE_AFF_NUMERIC)|libc.Int32FromInt32(SQLITE_JUMPIFNULL))) + } + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_INDEXED) != 0 { + nEq = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq /* Number of == or IN terms */ + nBtm = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm /* Length of BTM vector */ + nTop = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop /* Base register holding constraint values */ + pRangeStart = uintptr(0) /* Inequality constraint at range start */ + pRangeEnd = uintptr(0) /* The VDBE cursor for the index */ + nExtraReg = 0 /* Affinity for start of range constraint */ + zEndAff = uintptr(0) /* Affinity for end of range constraint */ + bSeekPastNull = uint8(0) /* True to seek past initial nulls */ + bStopAtNull = uint8(0) /* True if we use the index only */ + regBignull = 0 /* big-null flag register */ + addrSeekScan = 0 /* Opcode of the OP_SeekScan, if any */ + pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + iIdxCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + /* Find any inequality constraint terms for the start and end + ** of the range. + */ + j = int32(nEq) + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { + v34 = j + j++ + pRangeStart = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(v34)*8)) + if nExtraReg > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm) { + v35 = nExtraReg + } else { + v35 = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm) + } + nExtraReg = v35 + /* Like optimization range constraints always occur in pairs */ + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { + v36 = j + j++ + pRangeEnd = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(v36)*8)) + if nExtraReg > int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop) { + v37 = nExtraReg + } else { + v37 = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop) + } + nExtraReg = v37 + if pRangeStart == uintptr(0) { + j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(nEq)*2))) + if j >= 0 && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(j)*16 + 8))&0xf>>0)) == 0 || j == -int32(2) { + bSeekPastNull = uint8(1) + } + } + } + /* If the WHERE_BIGNULL_SORT flag is set, then index column nEq uses + ** a non-default "big-null" sort (either ASC NULLS LAST or DESC NULLS + ** FIRST). In both cases separate ordered scans are made of those + ** index entries for which the column is null and for those for which + ** it is not. For an ASC sort, the non-NULL entries are scanned first. + ** For DESC, NULL entries are scanned first. + */ + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_TOP_LIMIT)|libc.Int32FromInt32(WHERE_BTM_LIMIT)) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BIGNULL_SORT) != uint32(0) { + nExtraReg = int32(1) + bSeekPastNull = uint8(1) + v40 = pParse + 56 + *(*int32)(unsafe.Pointer(v40))++ + v39 = *(*int32)(unsafe.Pointer(v40)) + v38 = v39 + regBignull = v38 + (*TWhereLevel)(unsafe.Pointer(pLevel)).FregBignull = v38 + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regBignull) + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull = _sqlite3VdbeMakeLabel(tls, pParse) + } + /* If we are doing a reverse order scan on an ascending index, or + ** a forward order scan on a descending index, interchange the + ** start and end terms (pRangeStart and pRangeEnd). + */ + if int32(nEq) < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) && bRev == libc.BoolInt32(int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(nEq)))) == SQLITE_SO_ASC) { + t = pRangeEnd + pRangeEnd = pRangeStart + pRangeStart = t + t1 = bSeekPastNull + bSeekPastNull = bStopAtNull + bStopAtNull = t1 + t2 = uint8(nBtm) + nBtm = nTop + nTop = uint16(t2) + } + if iLevel > 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_SEEKSCAN) != uint32(0) { + /* In case OP_SeekScan is used, ensure that the index cursor does not + ** point to a valid row for the first iteration of this loop. */ + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), iIdxCur) + } + /* Generate code to evaluate all constraint terms using == or IN + ** and store the values of those terms in an array of registers + ** starting at regBase. + */ + regBase = _codeAllEqualityTerms(tls, pParse, pLevel, bRev, nExtraReg, bp+8) + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 && nTop != 0 { + zEndAff = _sqlite3DbStrDup(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(nEq)) + } + if regBignull != 0 { + v41 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull + } else { + v41 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + } + addrNxt = v41 + startEq = libc.BoolInt32(!(pRangeStart != 0) || int32((*TWhereTerm)(unsafe.Pointer(pRangeStart)).FeOperator)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != 0) + endEq = libc.BoolInt32(!(pRangeEnd != 0) || int32((*TWhereTerm)(unsafe.Pointer(pRangeEnd)).FeOperator)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != 0) + start_constraints = libc.BoolInt32(pRangeStart != 0 || int32(nEq) > 0) + /* Seek the index cursor to the start of the range. */ + nConstraint1 = int32(nEq) + if pRangeStart != 0 { + pRight2 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pRangeStart)).FpExpr)).FpRight + _codeExprOrVector(tls, pParse, pRight2, regBase+int32(nEq), int32(nBtm)) + if int32((*TWhereTerm)(unsafe.Pointer(pRangeStart)).FwtFlags)&int32(TERM_VNULL) == 0 && _sqlite3ExprCanBeNull(tls, pRight2) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regBase+int32(nEq), addrNxt) + } + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + _updateRangeAffinityStr(tls, pRight2, int32(nBtm), *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(nEq)) + } + nConstraint1 += int32(nBtm) + if _sqlite3ExprIsVector(tls, pRight2) == 0 { + _disableTerm(tls, pLevel, pRangeStart) + } else { + startEq = int32(1) + } + bSeekPastNull = uint8(0) + } else { + if bSeekPastNull != 0 { + startEq = 0 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regBase+int32(nEq)) + start_constraints = int32(1) + nConstraint1++ + } else { + if regBignull != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regBase+int32(nEq)) + start_constraints = int32(1) + nConstraint1++ + } + } + } + _codeApplyAffinity(tls, pParse, regBase, nConstraint1-int32(bSeekPastNull), *(*uintptr)(unsafe.Pointer(bp + 8))) + if int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) > 0 && nConstraint1 == int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { + /* The skip-scan logic inside the call to codeAllEqualityConstraints() + ** above has already left the cursor sitting on the correct row, + ** so no further seeking is needed */ + } else { + if regBignull != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), regBignull) + } + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Filter), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, addrNxt, regBase, int32(nEq)) + _filterPullDown(tls, pParse, pWInfo, iLevel, addrNxt, notReady) + } + op1 = int32(_aStartOp[start_constraints< int32(1))*int32(4)+int32(2)+bRev]) + _sqlite3VdbeAddOp4Int(tls, v, op1, iIdxCur, addrNxt, regBase, nConstraint1-startEq) + } + } + /* Load the value for the inequality constraint at the end of the + ** range (if any). + */ + nConstraint1 = int32(nEq) + if pRangeEnd != 0 { + pRight3 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pRangeEnd)).FpExpr)).FpRight + _codeExprOrVector(tls, pParse, pRight3, regBase+int32(nEq), int32(nTop)) + if int32((*TWhereTerm)(unsafe.Pointer(pRangeEnd)).FwtFlags)&int32(TERM_VNULL) == 0 && _sqlite3ExprCanBeNull(tls, pRight3) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), regBase+int32(nEq), addrNxt) + } + if zEndAff != 0 { + _updateRangeAffinityStr(tls, pRight3, int32(nTop), zEndAff) + _codeApplyAffinity(tls, pParse, regBase+int32(nEq), int32(nTop), zEndAff) + } else { + } + nConstraint1 += int32(nTop) + if _sqlite3ExprIsVector(tls, pRight3) == 0 { + _disableTerm(tls, pLevel, pRangeEnd) + } else { + endEq = int32(1) + } + } else { + if bStopAtNull != 0 { + if regBignull == 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regBase+int32(nEq)) + endEq = 0 + } + nConstraint1++ + } + } + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + _sqlite3DbNNFreeNN(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + if zEndAff != 0 { + _sqlite3DbNNFreeNN(tls, db, zEndAff) + } + /* Top of the loop body */ + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeCurrentAddr(tls, v) + /* Check if the index cursor is past the end of the range. */ + if nConstraint1 != 0 { + if regBignull != 0 { + /* Except, skip the end-of-range check while doing the NULL-scan */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNot), regBignull, _sqlite3VdbeCurrentAddr(tls, v)+int32(3)) + } + op1 = int32(_aEndOp[bRev*int32(2)+endEq]) + _sqlite3VdbeAddOp4Int(tls, v, op1, iIdxCur, addrNxt, regBase, nConstraint1) + if addrSeekScan != 0 { + _sqlite3VdbeJumpHere(tls, v, addrSeekScan) + } + } + if regBignull != 0 { + /* During a NULL-scan, check to see if we have reached the end of + ** the NULLs */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_If), regBignull, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + op1 = int32(_aEndOp[bRev*int32(2)+int32(bSeekPastNull)]) + _sqlite3VdbeAddOp4Int(tls, v, op1, iIdxCur, addrNxt, regBase, nConstraint1+int32(bSeekPastNull)) + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_EARLYOUT) != uint32(0) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekHit), iIdxCur, int32(nEq), int32(nEq)) + } + /* Seek the table cursor, if required */ + omitTable = libc.BoolInt32((*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IDX_ONLY) != uint32(0) && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&(libc.Int32FromInt32(WHERE_OR_SUBCLAUSE)|libc.Int32FromInt32(WHERE_RIGHT_JOIN)) == 0) + if omitTable != 0 { + /* pIdx is a covering index. No need to access the main table. */ + } else { + if (*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _codeDeferredSeek(tls, pWInfo, pIdx, iCur, iIdxCur) + } else { + if iCur != iIdxCur { + pPk = _sqlite3PrimaryKeyIndex(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable) + iRowidReg = _sqlite3GetTempRange(tls, pParse, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + j = 0 + for { + if !(j < int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { + break + } + k = int32(_sqlite3TableColumnToIndex(tls, pIdx, *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, iRowidReg+j) + goto _42 + _42: + ; + j++ + } + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_NotFound), iCur, addrCont, iRowidReg, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + } + } + } + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin == 0 { + /* If a partial index is driving the loop, try to eliminate WHERE clause + ** terms from the query that must be true due to the WHERE clause of + ** the partial index. + ** + ** 2019-11-02 ticket 623eff57e76d45f6: This optimization does not work + ** for a LEFT JOIN. + */ + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + _whereApplyPartialIndexConstraints(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere, iCur, pWC) + } + } else { + /* The following assert() is not a requirement, merely an observation: + ** The OR-optimization doesn't work for the right hand table of + ** a LEFT JOIN: */ + } + /* Record the instruction used to terminate the loop. */ + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) != 0 { + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Noop) + } else { + if bRev != 0 { + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Prev) + } else { + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Next) + } + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iIdxCur + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_UNQ_WANTED) != uint32(0) { + v43 = int32(1) + } else { + v43 = 0 + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp3 = uint8(v43) + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_CONSTRAINT) == uint32(0) { + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp5 = uint8(SQLITE_STMTSTATUS_FULLSCAN_STEP) + } else { + } + if omitTable != 0 { + pIdx = uintptr(0) + } + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_MULTI_OR) != 0 { /* Shortened table list or OR-clause generation */ + pCov = uintptr(0) + v45 = pParse + 52 + v44 = *(*int32)(unsafe.Pointer(v45)) + *(*int32)(unsafe.Pointer(v45))++ /* Potential covering index (or NULL) */ + iCovCur = v44 + v47 = pParse + 56 + *(*int32)(unsafe.Pointer(v47))++ + v46 = *(*int32)(unsafe.Pointer(v47)) /* Cursor used for index scans (if any) */ + regReturn = v46 /* Register used with OP_Gosub */ + regRowset = 0 /* Register for RowSet object */ + regRowid = 0 /* Register holding rowid */ + iLoopBody = _sqlite3VdbeMakeLabel(tls, pParse) /* Address of regReturn init */ + untestedTerms = 0 /* Loop counter */ + pAndExpr = uintptr(0) /* An ".. AND (...)" expression */ + pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab + pTerm = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) + pOrWc = *(*uintptr)(unsafe.Pointer(pTerm + 32)) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Return) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = regReturn + /* Set up a new SrcList in pOrTab containing the table being scanned + ** by this loop in the a[0] slot and all notReady tables in a[1..] slots. + ** This becomes the SrcList in the recursive call to sqlite3WhereBegin(). + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > int32(1) { /* Original list of tables */ + nNotReady = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - iLevel - int32(1) + pOrTab = _sqlite3DbMallocRawNN(tls, db, uint64(112)+uint64(nNotReady)*uint64(104)) + if pOrTab == uintptr(0) { + return notReady + } + (*TSrcList)(unsafe.Pointer(pOrTab)).FnAlloc = uint32(uint8(nNotReady + libc.Int32FromInt32(1))) + (*TSrcList)(unsafe.Pointer(pOrTab)).FnSrc = int32((*TSrcList)(unsafe.Pointer(pOrTab)).FnAlloc) + libc.Xmemcpy(tls, pOrTab+8, pTabItem, uint64(104)) + origSrc = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + k = int32(1) + for { + if !(k <= nNotReady) { + break + } + libc.Xmemcpy(tls, pOrTab+8+uintptr(k)*104, origSrc+uintptr((*(*TWhereLevel)(unsafe.Pointer(pLevel + uintptr(k)*104))).FiFrom)*104, uint64(104)) + goto _48 + _48: + ; + k++ + } + } else { + pOrTab = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + } + /* Initialize the rowset register to contain NULL. An SQL NULL is + ** equivalent to an empty rowset. Or, create an ephemeral index + ** capable of holding primary keys in the case of a WITHOUT ROWID. + ** + ** Also initialize regReturn to contain the address of the instruction + ** immediately following the OP_Return at the bottom of the loop. This + ** is required in a few obscure LEFT JOIN cases where control jumps + ** over the top of the loop into the body of it. In this case the + ** correct response for the end-of-loop code (the OP_Return) is to + ** fall through to the next instruction, just as an OP_Next does if + ** called on an uninitialized cursor. + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DUPLICATES_OK) == 0 { + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + v50 = pParse + 56 + *(*int32)(unsafe.Pointer(v50))++ + v49 = *(*int32)(unsafe.Pointer(v50)) + regRowset = v49 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regRowset) + } else { + pPk1 = _sqlite3PrimaryKeyIndex(tls, pTab) + v52 = pParse + 52 + v51 = *(*int32)(unsafe.Pointer(v52)) + *(*int32)(unsafe.Pointer(v52))++ + regRowset = v51 + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), regRowset, int32((*TIndex)(unsafe.Pointer(pPk1)).FnKeyCol)) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pPk1) + } + v54 = pParse + 56 + *(*int32)(unsafe.Pointer(v54))++ + v53 = *(*int32)(unsafe.Pointer(v54)) + regRowid = v53 + } + iRetInit = _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regReturn) + /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y + ** Then for every term xN, evaluate as the subexpression: xN AND y + ** That way, terms in y that are factored into the disjunction will + ** be picked up by the recursive calls to sqlite3WhereBegin() below. + ** + ** Actually, each subexpression is converted to "xN AND w" where w is + ** the "interesting" terms of z - terms that did not originate in the + ** ON or USING clause of a LEFT JOIN, and terms that are usable as + ** indices. + ** + ** This optimization also only applies if the (x1 OR x2 OR ...) term + ** is not contained in the ON clause of a LEFT JOIN. + ** See ticket http://www.sqlite.org/src/info/f2369304e4 + ** + ** 2022-02-04: Do not push down slices of a row-value comparison. + ** In other words, "w" or "y" may not be a slice of a vector. Otherwise, + ** the initialization of the right-hand operand of the vector comparison + ** might not occur, or might occur only in an OR branch that is not + ** taken. dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1. + ** + ** 2022-03-03: Do not push down expressions that involve subqueries. + ** The subquery might get coded as a subroutine. Any table-references + ** in the subquery might be resolved to index-references for the index on + ** the OR branch in which the subroutine is coded. But if the subroutine + ** is invoked from a different OR branch that uses a different index, such + ** index-references will not work. tag-20220303a + ** https://sqlite.org/forum/forumpost/36937b197273d403 + */ + if (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm > int32(1) { + iTerm = 0 + for { + if !(iTerm < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + pExpr = (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iTerm)*56))).FpExpr + if (*TWhereClause)(unsafe.Pointer(pWC)).Fa+uintptr(iTerm)*56 == pTerm { + goto _55 + } + if int32((*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iTerm)*56))).FwtFlags)&(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_CODED)|libc.Int32FromInt32(TERM_SLICE)) != 0 { + goto _55 + } + if int32((*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iTerm)*56))).FeOperator)&int32(WO_ALL) == 0 { + goto _55 + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_Subquery)) != uint32(0) { + goto _55 + } /* tag-20220303a */ + pExpr = _sqlite3ExprDup(tls, db, pExpr, 0) + pAndExpr = _sqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) + goto _55 + _55: + ; + iTerm++ + } + if pAndExpr != 0 { + /* The extra 0x10000 bit on the opcode is masked off and does not + ** become part of the new Expr.op. However, it does make the + ** op==TK_AND comparison inside of sqlite3PExpr() false, and this + ** prevents sqlite3PExpr() from applying the AND short-circuit + ** optimization, which we do not want here. */ + pAndExpr = _sqlite3PExpr(tls, pParse, libc.Int32FromInt32(TK_AND)|libc.Int32FromInt32(0x10000), uintptr(0), pAndExpr) + } + } + /* Run a separate WHERE clause for each term of the OR clause. After + ** eliminating duplicates from other WHERE clauses, the action for each + ** sub-WHERE clause is to to invoke the main loop body as a subroutine. + */ + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22297, 0) + ii = 0 + for { + if !(ii < (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm) { + break + } + pOrTerm = (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56 + if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur || int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator)&int32(WO_AND) != 0 { /* Info for single OR-term scan */ + pOrExpr = (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr /* Local copy of OR clause term */ + jmp1 = 0 /* Address of jump operation */ + /* See TH3 vtab25.400 and ticket 614b25314c766238 */ + v57 = _sqlite3ExprDup(tls, db, pOrExpr, 0) + pOrExpr = v57 + pDelete = v57 + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db, pDelete) + goto _56 + } + if pAndExpr != 0 { + (*TExpr)(unsafe.Pointer(pAndExpr)).FpLeft = pOrExpr + pOrExpr = pAndExpr + } + /* Loop through table entries that match term pOrTerm. */ + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22312, libc.VaList(bp+96, ii+int32(1))) + pSubWInfo = _sqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) + if pSubWInfo != 0 { + addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pOrTab, pSubWInfo+856, uint16(0)) + _ = addrExplain + /* This is the sub-WHERE clause body. First skip over + ** duplicate rows from prior sub-WHERE clauses, and record the + ** rowid (or PRIMARY KEY) for the current row so that the same + ** row will be skipped in subsequent sub-WHERE clauses. + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DUPLICATES_OK) == 0 { + if ii == (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm-int32(1) { + v58 = -int32(1) + } else { + v58 = ii + } + iSet = v58 + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, -int32(1), regRowid) + jmp1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_RowSetTest), regRowset, 0, regRowid, iSet) + } else { + pPk2 = _sqlite3PrimaryKeyIndex(tls, pTab) + nPk = int32((*TIndex)(unsafe.Pointer(pPk2)).FnKeyCol) + /* Read the PK into an array of temp registers. */ + r = _sqlite3GetTempRange(tls, pParse, nPk) + iPk = 0 + for { + if !(iPk < nPk) { + break + } + iCol = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk2)).FaiColumn + uintptr(iPk)*2))) + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) + goto _59 + _59: + ; + iPk++ + } + /* Check if the temp table already contains this key. If so, + ** the row has already been included in the result set and + ** can be ignored (by jumping past the Gosub below). Otherwise, + ** insert the key into the temp table and proceed with processing + ** the row. + ** + ** Use some of the same optimizations as OP_RowSetTest: If iSet + ** is zero, assume that the key cannot already be present in + ** the temp table. And if iSet is -1, assume that there is no + ** need to insert the key into the temp table, as it will never + ** be tested for. */ + if iSet != 0 { + jmp1 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), regRowset, 0, r, nPk) + } + if iSet >= 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), r, nPk, regRowid) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), regRowset, regRowid, r, nPk) + if iSet != 0 { + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + } + } + /* Release the array of temp registers */ + _sqlite3ReleaseTempRange(tls, pParse, r, nPk) + } + } + /* Invoke the main loop body as a subroutine */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), regReturn, iLoopBody) + /* Jump here (skipping the main loop body subroutine) if the + ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */ + if jmp1 != 0 { + _sqlite3VdbeJumpHere(tls, v, jmp1) + } + /* The pSubWInfo->untestedTerms flag means that this OR term + ** contained one or more AND term from a notReady table. The + ** terms from the notReady table could not be tested and will + ** need to be tested later. + */ + if int32(uint32(*(*uint8)(unsafe.Pointer(pSubWInfo + 68))&0x2>>1)) != 0 { + untestedTerms = int32(1) + } + /* If all of the OR-connected terms are optimized using the same + ** index, and the index is opened using the same cursor number + ** by each call to sqlite3WhereBegin() made by this loop, it may + ** be possible to use that index as a covering index. + ** + ** If the call to sqlite3WhereBegin() above resulted in a scan that + ** uses an index, and this is either the first OR-connected term + ** processed or the index is the same as that used by all previous + ** terms, set pCov to the candidate covering index. Otherwise, set + ** pCov to NULL to indicate that no candidate covering index will + ** be available. + */ + pSubLoop = (*(*TWhereLevel)(unsafe.Pointer(pSubWInfo + 856))).FpWLoop + if (*TWhereLoop)(unsafe.Pointer(pSubLoop)).FwsFlags&uint32(WHERE_INDEXED) != uint32(0) && (ii == 0 || (*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex == pCov) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex + 100))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY))) { + pCov = (*TWhereLoop)(unsafe.Pointer(pSubLoop)).Fu.Fbtree.FpIndex + } else { + pCov = uintptr(0) + } + if _sqlite3WhereUsesDeferredSeek(tls, pSubWInfo) != 0 { + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 0, 0x1) + } + /* Finish the loop through table entries that match term pOrTerm. */ + _sqlite3WhereEnd(tls, pSubWInfo) + _sqlite3VdbeExplainPop(tls, pParse) + } + _sqlite3ExprDelete(tls, db, pDelete) + } + goto _56 + _56: + ; + ii++ + } + _sqlite3VdbeExplainPop(tls, pParse) + *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) = pCov + if pCov != 0 { + (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iCovCur + } + if pAndExpr != 0 { + (*TExpr)(unsafe.Pointer(pAndExpr)).FpLeft = uintptr(0) + _sqlite3ExprDelete(tls, db, pAndExpr) + } + _sqlite3VdbeChangeP1(tls, v, iRetInit, _sqlite3VdbeCurrentAddr(tls, v)) + _sqlite3VdbeGoto(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + _sqlite3VdbeResolveLabel(tls, v, iLoopBody) + /* Set the P2 operand of the OP_Return opcode that will end the current + ** loop to point to this spot, which is the top of the next containing + ** loop. The byte-code formatter will use that P2 value as a hint to + ** indent everything in between the this point and the final OP_Return. + ** See tag-20220407a in vdbe.c and shell.c */ + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = _sqlite3VdbeCurrentAddr(tls, v) + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > int32(1) { + _sqlite3DbFreeNN(tls, db, pOrTab) + } + if !(untestedTerms != 0) { + _disableTerm(tls, pLevel, pTerm) + } + } else { + if int32(uint32(*(*uint16)(unsafe.Pointer(pTabItem + 60 + 4))&0x40>>6)) != 0 { + /* Tables marked isRecursive have only a single row that is stored in + ** a pseudo-cursor. No need to Rewind or Next such cursors. */ + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = uint8(OP_Noop) + } else { + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fop = _aStep[bRev] + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2 = int32(1) + _sqlite3VdbeAddOp2(tls, v, int32(_aStart[bRev]), iCur, addrHalt) + (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp5 = uint8(SQLITE_STMTSTATUS_FULLSCAN_STEP) + } + } + } + } + } + } + } + /* Insert code to test every subexpression that can be completely + ** computed using the current set of tables. + ** + ** This loop may run between one and three times, depending on the + ** constraints to be generated. The value of stack variable iLoop + ** determines the constraints coded by each iteration, as follows: + ** + ** iLoop==1: Code only expressions that are entirely covered by pIdx. + ** iLoop==2: Code remaining expressions that do not contain correlated + ** sub-queries. + ** iLoop==3: Code all remaining expressions. + ** + ** An effort is made to skip unnecessary iterations of the loop. + */ + if pIdx != 0 { + v60 = int32(1) + } else { + v60 = int32(2) + } + iLoop = v60 + for cond := true; cond; cond = iLoop > 0 { + iNext = 0 /* Next value for iLoop */ + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + j = (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm + for { + if !(j > 0) { + break + } + skipLikeAddr = 0 + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_CODED)) != 0 { + goto _61 + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady != uint64(0) { + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 1, 0x2) + goto _61 + } + pE = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 { + if !((*TExpr)(unsafe.Pointer(pE)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != libc.Uint32FromInt32(0)) { + /* Defer processing WHERE clause constraints until after outer + ** join processing. tag-20220513a */ + goto _61 + } else { + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LEFT) == int32(JT_LEFT) && !((*TExpr)(unsafe.Pointer(pE)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) { + goto _61 + } else { + m = _sqlite3WhereGetMask(tls, pWInfo+592, *(*int32)(unsafe.Pointer(pE + 52))) + if m&(*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady != 0 { + /* An ON clause that is not ripe */ + goto _61 + } + } + } + } + if iLoop == int32(1) && !(_sqlite3ExprCoveredByIndex(tls, pE, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, pIdx) != 0) { + iNext = int32(2) + goto _61 + } + if iLoop < int32(3) && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VARSELECT) != 0 { + if iNext == 0 { + iNext = int32(3) + } + goto _61 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_LIKECOND) != 0 { + /* If the TERM_LIKECOND flag is set, that means that the range search + ** is sufficient to guarantee that the LIKE operator is true, so we + ** can skip the call to the like(A,B) function. But this only works + ** for strings. So do not skip the call to the function on the pass + ** that compares BLOBs. */ + goto _61 + } + _sqlite3ExprIfFalse(tls, pParse, pE, addrCont, int32(SQLITE_JUMPIFNULL)) + if skipLikeAddr != 0 { + _sqlite3VdbeJumpHere(tls, v, skipLikeAddr) + } + p62 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p62)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p62))) | libc.Int32FromInt32(TERM_CODED)) + goto _61 + _61: + ; + j-- + pTerm += 56 + } + iLoop = iNext + } + /* Insert code to test for implied constraints based on transitivity + ** of the "==" operator. + ** + ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123" + ** and we are coding the t1 loop and the t2 loop has not yet coded, + ** then we cannot use the "t1.a=t2.b" constraint, but we can code + ** the implied "t1.a=123" constraint. + */ + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + j = (*TWhereClause)(unsafe.Pointer(pWC)).FnBase + for { + if !(j > 0) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_CODED)) != 0 { + goto _63 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) == 0 { + goto _63 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_EQUIV) == 0 { + goto _63 + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != iCur { + goto _63 + } + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 { + goto _63 + } + pE1 = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + pAlt = _sqlite3WhereFindTerm(tls, pWC, iCur, (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn, notReady, uint32(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IN)|libc.Int32FromInt32(WO_IS)), uintptr(0)) + if pAlt == uintptr(0) { + goto _63 + } + if int32((*TWhereTerm)(unsafe.Pointer(pAlt)).FwtFlags)&int32(TERM_CODED) != 0 { + goto _63 + } + if int32((*TWhereTerm)(unsafe.Pointer(pAlt)).FeOperator)&int32(WO_IN) != 0 && (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pAlt)).FpExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) && (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pAlt)).FpExpr + 32)))).FpEList)).FnExpr > int32(1) { + goto _63 + } + *(*TExpr)(unsafe.Pointer(bp + 16)) = *(*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pAlt)).FpExpr)) + (*(*TExpr)(unsafe.Pointer(bp + 16))).FpLeft = (*TExpr)(unsafe.Pointer(pE1)).FpLeft + _sqlite3ExprIfFalse(tls, pParse, bp+16, addrCont, int32(SQLITE_JUMPIFNULL)) + p64 = pAlt + 18 + *(*Tu16)(unsafe.Pointer(p64)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p64))) | libc.Int32FromInt32(TERM_CODED)) + goto _63 + _63: + ; + j-- + pTerm += 56 + } + /* For a RIGHT OUTER JOIN, record the fact that the current row has + ** been matched at least once. + */ + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ != 0 { + jmp11 = 0 + pRJ = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ + /* pTab is the right-hand table of the RIGHT JOIN. Generate code that + ** will record that the current row of that table has been matched at + ** least once. This is accomplished by storing the PK for the row in + ** both the iMatch index and the regBloom Bloom filter. + */ + pTab1 = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FpTab + if (*TTable)(unsafe.Pointer(pTab1)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + r1 = _sqlite3GetTempRange(tls, pParse, int32(2)) + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, -int32(1), r1+int32(1)) + nPk1 = int32(1) + } else { + pPk3 = _sqlite3PrimaryKeyIndex(tls, pTab1) + nPk1 = int32((*TIndex)(unsafe.Pointer(pPk3)).FnKeyCol) + r1 = _sqlite3GetTempRange(tls, pParse, nPk1+int32(1)) + iPk1 = 0 + for { + if !(iPk1 < nPk1) { + break + } + iCol1 = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk3)).FaiColumn + uintptr(iPk1)*2))) + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab1, iCur, iCol1, r1+int32(1)+iPk1) + goto _65 + _65: + ; + iPk1++ + } + } + jmp11 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, 0, r1+int32(1), nPk1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), r1+int32(1), nPk1, r1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IdxInsert), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, r1, r1+int32(1), nPk1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_FilterAdd), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregBloom, 0, r1+int32(1), nPk1) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + _sqlite3VdbeJumpHere(tls, v, jmp11) + _sqlite3ReleaseTempRange(tls, pParse, r1, nPk1+int32(1)) + } + /* For a LEFT OUTER JOIN, generate code that will record the fact that + ** at least one row of the right table has matched the left table. + */ + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ == uintptr(0) { + goto code_outer_join_constraints /* WHERE clause constraints */ + } + } + if !((*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ != 0) { + goto _66 + } + /* Create a subroutine used to process all interior loops and code + ** of the RIGHT JOIN. During normal operation, the subroutine will + ** be in-line with the rest of the code. But at the end, a separate + ** loop will run that invokes this subroutine for unmatched rows + ** of pTab, with all tables to left begin set to NULL. + */ + pRJ1 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ + _sqlite3VdbeAddOp2(tls, v, int32(OP_BeginSubrtn), 0, (*TWhereRightJoin)(unsafe.Pointer(pRJ1)).FregReturn) + (*TWhereRightJoin)(unsafe.Pointer(pRJ1)).FaddrSubrtn = _sqlite3VdbeCurrentAddr(tls, v) + (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn++ + /* WHERE clause constraints must be deferred until after outer join + ** row elimination has completed, since WHERE clause constraints apply + ** to the results of the OUTER JOIN. The following loop generates the + ** appropriate WHERE clause constraint checks. tag-20220513a. + */ +code_outer_join_constraints: + ; + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + j = libc.Int32FromInt32(0) + for { + if !(j < (*TWhereClause)(unsafe.Pointer(pWC)).FnBase) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_CODED)) != 0 { + goto _67 + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady != uint64(0) { + goto _67 + } + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + goto _67 + } + _sqlite3ExprIfFalse(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, addrCont, int32(SQLITE_JUMPIFNULL)) + p68 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p68)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p68))) | libc.Int32FromInt32(TERM_CODED)) + goto _67 + _67: + ; + j++ + pTerm += 56 + } +_66: + ; + return (*TWhereLevel)(unsafe.Pointer(pLevel)).FnotReady +} + +/* Case 4: A scan using an index. + ** + ** The WHERE clause may contain zero or more equality + ** terms ("==" or "IN" operators) that refer to the N + ** left-most columns of the index. It may also contain + ** inequality constraints (>, <, >= or <=) on the indexed + ** column that immediately follows the N equalities. Only + ** the right-most column can be an inequality - the rest must + ** use the "==" and "IN" operators. For example, if the + ** index is on (x,y,z), then the following clauses are all + ** optimized: + ** + ** x=5 + ** x=5 AND y=10 + ** x=5 AND y<10 + ** x=5 AND y>5 AND y<10 + ** x=5 AND y=5 AND z<=10 + ** + ** The z<10 term of the following cannot be used, only + ** the x=5 term: + ** + ** x=5 AND z<10 + ** + ** N may be zero if there are inequality constraints. + ** If there are no inequality constraints, then N is at + ** least one. + ** + ** This case is also used when there are no WHERE clause + ** constraints but an index is selected anyway, in order + ** to force the output order to conform to an ORDER BY. + */ +var _aStartOp = [8]Tu8{ + 2: uint8(OP_Rewind), + 3: uint8(OP_Last), + 4: uint8(OP_SeekGT), + 5: uint8(OP_SeekLT), + 6: uint8(OP_SeekGE), + 7: uint8(OP_SeekLE), +} + +var _aEndOp = [4]Tu8{ + 0: uint8(OP_IdxGE), + 1: uint8(OP_IdxGT), + 2: uint8(OP_IdxLE), + 3: uint8(OP_IdxLT), +} + +/* Case 6: There is no usable index. We must do a complete + ** scan of the entire table. + */ +var _aStep = [2]Tu8{ + 0: uint8(OP_Next), + 1: uint8(OP_Prev), +} + +var _aStart = [2]Tu8{ + 0: uint8(OP_Rewind), + 1: uint8(OP_Last), +} + +// C documentation +// +// /* +// ** Generate the code for the loop that finds all non-matched terms +// ** for a RIGHT JOIN. +// */ +func _sqlite3WhereRightJoinLoop(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLevel uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var addrCont, iCol, iCur, iIdxCur, iPk, jmp, k, nPk, r, v3 int32 + var mAll TBitmask + var pLoop, pParse, pPk, pRJ, pSubWInfo, pSubWhere, pTab, pTabItem, pTerm, pWC, v, v4 uintptr + var _ /* sFrom at bp+0 */ TSrcList + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrCont, iCol, iCur, iIdxCur, iPk, jmp, k, mAll, nPk, pLoop, pParse, pPk, pRJ, pSubWInfo, pSubWhere, pTab, pTabItem, pTerm, pWC, r, v, v3, v4 + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + pRJ = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ + pSubWhere = uintptr(0) + pWC = pWInfo + 104 + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + mAll = uint64(0) + _sqlite3VdbeExplain(tls, pParse, uint8(1), __ccgo_ts+22321, libc.VaList(bp+120, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FzName)) + k = 0 + for { + if !(k < iLevel) { + break + } + mAll |= (*TWhereLoop1)(unsafe.Pointer((*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(k)*104))).FpWLoop)).FmaskSelf + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(k)*104))).FiTabCur) + iIdxCur = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(k)*104))).FiIdxCur + if iIdxCur != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), iIdxCur) + } + goto _1 + _1: + ; + k++ + } + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_LTORJ) == 0 { + mAll |= (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf + k = 0 + for { + if !(k < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(k)*56 + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_SLICE)) != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) != int32(WO_ROWVAL) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & ^mAll != 0 { + goto _2 + } + if (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) { + goto _2 + } + pSubWhere = _sqlite3ExprAnd(tls, pParse, pSubWhere, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, 0)) + goto _2 + _2: + ; + k++ + } + } + (*(*TSrcList)(unsafe.Pointer(bp))).FnSrc = int32(1) + (*(*TSrcList)(unsafe.Pointer(bp))).FnAlloc = uint32(1) + libc.Xmemcpy(tls, bp+8, pTabItem, uint64(104)) + (*(*TSrcItem)(unsafe.Pointer(bp + 8))).Ffg.Fjointype = uint8(0) + (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn++ + pSubWInfo = _sqlite3WhereBegin(tls, pParse, bp, pSubWhere, uintptr(0), uintptr(0), uintptr(0), uint16(WHERE_RIGHT_JOIN), 0) + if pSubWInfo != 0 { + iCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur + v4 = pParse + 56 + *(*int32)(unsafe.Pointer(v4))++ + v3 = *(*int32)(unsafe.Pointer(v4)) + r = v3 + addrCont = _sqlite3WhereContinueLabel(tls, pSubWInfo) + pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, -int32(1), r) + nPk = int32(1) + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + nPk = int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPk - int32(1) + iPk = 0 + for { + if !(iPk < nPk) { + break + } + iCol = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(iPk)*2))) + _sqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, r+iPk) + goto _5 + _5: + ; + iPk++ + } + } + jmp = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Filter), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregBloom, 0, r, nPk) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Found), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, addrCont, r, nPk) + _sqlite3VdbeJumpHere(tls, v, jmp) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn, (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FaddrSubrtn) + _sqlite3WhereEnd(tls, pSubWInfo) + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSubWhere) + _sqlite3VdbeExplainPop(tls, pParse) + (*TParse)(unsafe.Pointer(pParse)).FwithinRJSubrtn-- +} + +// C documentation +// +// /* +// ** Deallocate all memory associated with a WhereOrInfo object. +// */ +func _whereOrInfoDelete(tls *libc.TLS, db uintptr, p uintptr) { + _sqlite3WhereClauseClear(tls, p) + _sqlite3DbFree(tls, db, p) +} + +// C documentation +// +// /* +// ** Deallocate all memory associated with a WhereAndInfo object. +// */ +func _whereAndInfoDelete(tls *libc.TLS, db uintptr, p uintptr) { + _sqlite3WhereClauseClear(tls, p) + _sqlite3DbFree(tls, db, p) +} + +// C documentation +// +// /* +// ** Add a single new WhereTerm entry to the WhereClause object pWC. +// ** The new WhereTerm object is constructed from Expr p and with wtFlags. +// ** The index in pWC->a[] of the new WhereTerm is returned on success. +// ** 0 is returned if the new WhereTerm could not be added due to a memory +// ** allocation error. The memory allocation failure will be recorded in +// ** the db->mallocFailed flag so that higher-level functions can detect it. +// ** +// ** This routine will increase the size of the pWC->a[] array as necessary. +// ** +// ** If the wtFlags argument includes TERM_DYNAMIC, then responsibility +// ** for freeing the expression p is assumed by the WhereClause object pWC. +// ** This is true even if this routine fails to allocate a new WhereTerm. +// ** +// ** WARNING: This routine might reallocate the space used to store +// ** WhereTerms. All pointers to WhereTerms should be invalidated after +// ** calling this routine. Such pointers may be reinitialized by referencing +// ** the pWC->a[] array. +// */ +func _whereClauseInsert(tls *libc.TLS, pWC uintptr, p uintptr, wtFlags Tu16) (r int32) { + var db, pOld, pTerm, v3 uintptr + var idx, v1, v2 int32 + _, _, _, _, _, _, _ = db, idx, pOld, pTerm, v1, v2, v3 + if (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm >= (*TWhereClause)(unsafe.Pointer(pWC)).FnSlot { + pOld = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + (*TWhereClause)(unsafe.Pointer(pWC)).Fa = _sqlite3WhereMalloc(tls, (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo, uint64(56)*uint64((*TWhereClause)(unsafe.Pointer(pWC)).FnSlot)*uint64(2)) + if (*TWhereClause)(unsafe.Pointer(pWC)).Fa == uintptr(0) { + if int32(wtFlags)&int32(TERM_DYNAMIC) != 0 { + _sqlite3ExprDelete(tls, db, p) + } + (*TWhereClause)(unsafe.Pointer(pWC)).Fa = pOld + return 0 + } + libc.Xmemcpy(tls, (*TWhereClause)(unsafe.Pointer(pWC)).Fa, pOld, uint64(56)*uint64((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm)) + (*TWhereClause)(unsafe.Pointer(pWC)).FnSlot = (*TWhereClause)(unsafe.Pointer(pWC)).FnSlot * int32(2) + } + v3 = pWC + 20 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + v1 = v2 + idx = v1 + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(v1)*56 + if int32(wtFlags)&int32(TERM_VIRTUAL) == 0 { + (*TWhereClause)(unsafe.Pointer(pWC)).FnBase = (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm + } + if p != 0 && (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_Unlikely)) != uint32(0) { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb = int16(int32(_sqlite3LogEst(tls, uint64((*TExpr)(unsafe.Pointer(p)).FiTable))) - int32(270)) + } else { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb = int16(1) + } + (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr = _sqlite3ExprSkipCollateAndLikely(tls, p) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags = wtFlags + (*TWhereTerm)(unsafe.Pointer(pTerm)).FpWC = pWC + (*TWhereTerm)(unsafe.Pointer(pTerm)).FiParent = -int32(1) + libc.Xmemset(tls, pTerm+20, 0, libc.Uint64FromInt64(56)-uint64(libc.UintptrFromInt32(0)+20)) + return idx +} + +// C documentation +// +// /* +// ** Return TRUE if the given operator is one of the operators that is +// ** allowed for an indexable WHERE clause term. The allowed operators are +// ** "=", "<", ">", "<=", ">=", "IN", "IS", and "IS NULL" +// */ +func _allowedOp(tls *libc.TLS, op int32) (r int32) { + return libc.BoolInt32(op == int32(TK_IN) || op >= int32(TK_EQ) && op <= int32(TK_GE) || op == int32(TK_ISNULL) || op == int32(TK_IS)) +} + +// C documentation +// +// /* +// ** Commute a comparison operator. Expressions of the form "X op Y" +// ** are converted into "Y op X". +// */ +func _exprCommute(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r Tu16) { + var t uintptr + _ = t + if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == int32(TK_VECTOR) || int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpRight)).Fop) == int32(TK_VECTOR) || _sqlite3BinaryCompareCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) != _sqlite3BinaryCompareCollSeq(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) { + *(*Tu32)(unsafe.Pointer(pExpr + 4)) ^= uint32(EP_Commuted) + } + t = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + (*TExpr)(unsafe.Pointer(pExpr)).FpRight = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + (*TExpr)(unsafe.Pointer(pExpr)).FpLeft = t + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) >= int32(TK_GT) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) - int32(TK_GT) ^ int32(2) + int32(TK_GT)) + } + return uint16(0) +} + +// C documentation +// +// /* +// ** Translate from TK_xx operator to WO_xx bitmask. +// */ +func _operatorMask(tls *libc.TLS, op int32) (r Tu16) { + var c Tu16 + _ = c + if op == int32(TK_IN) { + c = uint16(WO_IN) + } else { + if op == int32(TK_ISNULL) { + c = uint16(WO_ISNULL) + } else { + if op == int32(TK_IS) { + c = uint16(WO_IS) + } else { + c = uint16(libc.Int32FromInt32(WO_EQ) << (op - libc.Int32FromInt32(TK_EQ))) + } + } + } + return c +} + +// C documentation +// +// /* +// ** Check to see if the given expression is a LIKE or GLOB operator that +// ** can be optimized using inequality constraints. Return TRUE if it is +// ** so and false if not. +// ** +// ** In order for the operator to be optimizible, the RHS must be a string +// ** literal that does not begin with a wildcard. The LHS must be a column +// ** that may only be NULL, a string, or a BLOB, never a number. (This means +// ** that virtual tables cannot participate in the LIKE optimization.) The +// ** collating sequence for the column on the LHS must be appropriate for +// ** the operator. +// */ +func _isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintptr, pisComplete uintptr, pnoCase uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, v1 Tu8 + var cnt, iCol, iFrom, iTo, isNum, op, r1, rc, v3, v4 int32 + var db, pLeft, pList, pPrefix, pReprepare, pRight, pVal, v, z, zNew uintptr + var _ /* rDummy at bp+8 */ float64 + var _ /* wc at bp+0 */ [4]Tu8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cnt, db, iCol, iFrom, iTo, isNum, op, pLeft, pList, pPrefix, pReprepare, pRight, pVal, r1, rc, v, z, zNew, v1, v3, v4 + z = uintptr(0) /* Wildcard characters */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database connection */ + pVal = uintptr(0) /* Result code to return */ + if !(_sqlite3IsLikeFunction(tls, db, pExpr, pnoCase, bp) != 0) { + return 0 + } + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + pLeft = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr + pRight = _sqlite3ExprSkipCollate(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr) + op = int32((*TExpr)(unsafe.Pointer(pRight)).Fop) + if op == int32(TK_VARIABLE) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_EnableQPSG) == uint64(0) { + pReprepare = (*TParse)(unsafe.Pointer(pParse)).FpReprepare + iCol = int32((*TExpr)(unsafe.Pointer(pRight)).FiColumn) + pVal = _sqlite3VdbeGetBoundValue(tls, pReprepare, iCol, uint8(SQLITE_AFF_BLOB)) + if pVal != 0 && Xsqlite3_value_type(tls, pVal) == int32(SQLITE_TEXT) { + z = Xsqlite3_value_text(tls, pVal) + } + _sqlite3VdbeSetVarmask(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, iCol) + } else { + if op == int32(TK_STRING) { + z = *(*uintptr)(unsafe.Pointer(pRight + 8)) + } + } + if z != 0 { + /* Count the number of prefix characters prior to the first wildcard */ + cnt = 0 + for { + v1 = *(*Tu8)(unsafe.Pointer(z + uintptr(cnt))) + c = v1 + if !(int32(v1) != 0 && int32(c) != int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[0]) && int32(c) != int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[int32(1)]) && int32(c) != int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[int32(2)])) { + break + } + cnt++ + if int32(c) == int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[int32(3)]) && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(cnt)))) != 0 { + cnt++ + } + } + /* The optimization is possible only if (1) the pattern does not begin + ** with a wildcard and if (2) the non-wildcard prefix does not end with + ** an (illegal 0xff) character, or (3) the pattern does not consist of + ** a single escape character. The second condition is necessary so + ** that we can increment the prefix key to find an upper bound for the + ** range search. The third is because the caller assumes that the pattern + ** consists of at least one character after all escapes have been + ** removed. */ + if (cnt > int32(1) || cnt > 0 && int32(*(*Tu8)(unsafe.Pointer(z))) != int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[int32(3)])) && int32(255) != int32(*(*Tu8)(unsafe.Pointer(z + uintptr(cnt-int32(1))))) { + /* A "complete" match if the pattern ends with "*" or "%" */ + *(*int32)(unsafe.Pointer(pisComplete)) = libc.BoolInt32(int32(c) == int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[0]) && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(cnt+int32(1))))) == 0) + /* Get the pattern prefix. Remove all escapes from the prefix. */ + pPrefix = _sqlite3Expr(tls, db, int32(TK_STRING), z) + if pPrefix != 0 { + zNew = *(*uintptr)(unsafe.Pointer(pPrefix + 8)) + *(*int8)(unsafe.Pointer(zNew + uintptr(cnt))) = 0 + v3 = libc.Int32FromInt32(0) + iTo = v3 + iFrom = v3 + for { + if !(iFrom < cnt) { + break + } + if int32(*(*int8)(unsafe.Pointer(zNew + uintptr(iFrom)))) == int32((*(*[4]Tu8)(unsafe.Pointer(bp)))[int32(3)]) { + iFrom++ + } + v4 = iTo + iTo++ + *(*int8)(unsafe.Pointer(zNew + uintptr(v4))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) + goto _2 + _2: + ; + iFrom++ + } + *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = 0 + /* If the LHS is not an ordinary column with TEXT affinity, then the + ** pattern prefix boundaries (both the start and end boundaries) must + ** not look like a number. Otherwise the pattern might be treated as + ** a number, which will invalidate the LIKE optimization. + ** + ** Getting this right has been a persistent source of bugs in the + ** LIKE optimization. See, for example: + ** 2018-09-10 https://sqlite.org/src/info/c94369cae9b561b1 + ** 2019-05-02 https://sqlite.org/src/info/b043a54c3de54b28 + ** 2019-06-10 https://sqlite.org/src/info/fd76310a5e843e07 + ** 2019-06-14 https://sqlite.org/src/info/ce8717f0885af975 + ** 2019-09-03 https://sqlite.org/src/info/0f0428096f17252a + */ + if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) != int32(TK_COLUMN) || int32(_sqlite3ExprAffinity(tls, pLeft)) != int32(SQLITE_AFF_TEXT) || (*TExpr)(unsafe.Pointer(pLeft)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)|libc.Int32FromInt32(EP_Subrtn)) == uint32(0) && *(*uintptr)(unsafe.Pointer(pLeft + 64)) != 0 && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64)))).FeTabType) == int32(TABTYP_VTAB) { + isNum = _sqlite3AtoF(tls, zNew, bp+8, iTo, uint8(SQLITE_UTF8)) + if isNum <= 0 { + if iTo == int32(1) && int32(*(*int8)(unsafe.Pointer(zNew))) == int32('-') { + isNum = +libc.Int32FromInt32(1) + } else { + *(*int8)(unsafe.Pointer(zNew + uintptr(iTo-int32(1))))++ + isNum = _sqlite3AtoF(tls, zNew, bp+8, iTo, uint8(SQLITE_UTF8)) + *(*int8)(unsafe.Pointer(zNew + uintptr(iTo-int32(1))))-- + } + } + if isNum > 0 { + _sqlite3ExprDelete(tls, db, pPrefix) + _sqlite3ValueFree(tls, pVal) + return 0 + } + } + } + *(*uintptr)(unsafe.Pointer(ppPrefix)) = pPrefix + /* If the RHS pattern is a bound parameter, make arrangements to + ** reprepare the statement when that parameter is rebound */ + if op == int32(TK_VARIABLE) { + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + _sqlite3VdbeSetVarmask(tls, v, int32((*TExpr)(unsafe.Pointer(pRight)).FiColumn)) + if *(*int32)(unsafe.Pointer(pisComplete)) != 0 && *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 8)) + 1)) != 0 { + /* If the rhs of the LIKE expression is a variable, and the current + ** value of the variable means there is no need to invoke the LIKE + ** function, then no OP_Variable will be added to the program. + ** This causes problems for the sqlite3_bind_parameter_name() + ** API. To work around them, add a dummy OP_Variable here. + */ + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3ExprCodeTarget(tls, pParse, pRight, r1) + _sqlite3VdbeChangeP3(tls, v, _sqlite3VdbeCurrentAddr(tls, v)-int32(1), 0) + _sqlite3ReleaseTempReg(tls, pParse, r1) + } + } + } else { + z = uintptr(0) + } + } + rc = libc.BoolInt32(z != uintptr(0)) + _sqlite3ValueFree(tls, pVal) + return rc +} + +// C documentation +// +// /* +// ** Check to see if the pExpr expression is a form that needs to be passed +// ** to the xBestIndex method of virtual tables. Forms of interest include: +// ** +// ** Expression Virtual Table Operator +// ** ----------------------- --------------------------------- +// ** 1. column MATCH expr SQLITE_INDEX_CONSTRAINT_MATCH +// ** 2. column GLOB expr SQLITE_INDEX_CONSTRAINT_GLOB +// ** 3. column LIKE expr SQLITE_INDEX_CONSTRAINT_LIKE +// ** 4. column REGEXP expr SQLITE_INDEX_CONSTRAINT_REGEXP +// ** 5. column != expr SQLITE_INDEX_CONSTRAINT_NE +// ** 6. expr != column SQLITE_INDEX_CONSTRAINT_NE +// ** 7. column IS NOT expr SQLITE_INDEX_CONSTRAINT_ISNOT +// ** 8. expr IS NOT column SQLITE_INDEX_CONSTRAINT_ISNOT +// ** 9. column IS NOT NULL SQLITE_INDEX_CONSTRAINT_ISNOTNULL +// ** +// ** In every case, "column" must be a column of a virtual table. If there +// ** is a match, set *ppLeft to the "column" expression, set *ppRight to the +// ** "expr" expression (even though in forms (6) and (8) the column is on the +// ** right and the expression is on the left). Also set *peOp2 to the +// ** appropriate virtual table operator. The return value is 1 or 2 if there +// ** is a match. The usual return is 1, but if the RHS is also a column +// ** of virtual table in forms (5) or (7) then return 2. +// ** +// ** If the expression matches none of the patterns above, return 0. +// */ +func _isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 uintptr, ppLeft uintptr, ppRight uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, res int32 + var pCol, pLeft, pList, pMod, pRight, pVtab, t uintptr + var _ /* pNotUsed at bp+8 */ uintptr + var _ /* xNotUsed at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = i, pCol, pLeft, pList, pMod, pRight, pVtab, res, t + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) { + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + if pList == uintptr(0) || (*TExprList)(unsafe.Pointer(pList)).FnExpr != int32(2) { + return 0 + } + /* Built-in operators MATCH, GLOB, LIKE, and REGEXP attach to a + ** virtual table on their second argument, which is the same as + ** the left-hand side operand in their in-fix form. + ** + ** vtab_column MATCH expression + ** MATCH(expression,vtab_column) + */ + pCol = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pCol)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64)))).FeTabType) == int32(TABTYP_VTAB) { + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(16))) { + break + } + if _sqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), _aOp[i].FzOp) == 0 { + *(*uint8)(unsafe.Pointer(peOp2)) = _aOp[i].FeOp2 + *(*uintptr)(unsafe.Pointer(ppRight)) = (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr + *(*uintptr)(unsafe.Pointer(ppLeft)) = pCol + return int32(1) + } + goto _1 + _1: + ; + i++ + } + } + /* We can also match against the first column of overloaded + ** functions where xFindFunction returns a value of at least + ** SQLITE_INDEX_CONSTRAINT_FUNCTION. + ** + ** OVERLOADED(vtab_column,expression) + ** + ** Historically, xFindFunction expected to see lower-case function + ** names. But for this use case, xFindFunction is expected to deal + ** with function names in an arbitrary case. + */ + pCol = (*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pCol)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64)))).FeTabType) == int32(TABTYP_VTAB) { + pVtab = (*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, db, *(*uintptr)(unsafe.Pointer(pCol + 64))))).FpVtab + pMod = (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + if (*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction != uintptr(0) { + i = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction})))(tls, pVtab, int32(2), *(*uintptr)(unsafe.Pointer(pExpr + 8)), bp, bp+8) + if i >= int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(i) + *(*uintptr)(unsafe.Pointer(ppRight)) = (*(*TExprList_item)(unsafe.Pointer(pList + 8 + 1*32))).FpExpr + *(*uintptr)(unsafe.Pointer(ppLeft)) = pCol + return int32(1) + } + } + } + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NE) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_ISNOT) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL) { + res = 0 + pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight + if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64)))).FeTabType) == int32(TABTYP_VTAB) { + res++ + } + if pRight != 0 && (int32((*TExpr)(unsafe.Pointer(pRight)).Fop) == int32(TK_COLUMN) && int32((*TTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64)))).FeTabType) == int32(TABTYP_VTAB)) { + res++ + t = pLeft + pLeft = pRight + pRight = t + } + *(*uintptr)(unsafe.Pointer(ppLeft)) = pLeft + *(*uintptr)(unsafe.Pointer(ppRight)) = pRight + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NE) { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_NE) + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_ISNOT) { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_ISNOT) + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL) { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_ISNOTNULL) + } + return res + } + } + return 0 +} + +var _aOp = [4]struct { + FzOp uintptr + FeOp2 uint8 +}{ + 0: { + FzOp: __ccgo_ts + 16575, + FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), + }, + 1: { + FzOp: __ccgo_ts + 15906, + FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), + }, + 2: { + FzOp: __ccgo_ts + 15385, + FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), + }, + 3: { + FzOp: __ccgo_ts + 22335, + FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), + }, +} + +// C documentation +// +// /* +// ** If the pBase expression originated in the ON or USING clause of +// ** a join, then transfer the appropriate markings over to derived. +// */ +func _transferJoinMarkings(tls *libc.TLS, pDerived uintptr, pBase uintptr) { + if pDerived != 0 && (*TExpr)(unsafe.Pointer(pBase)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) { + *(*Tu32)(unsafe.Pointer(pDerived + 4)) |= (*TExpr)(unsafe.Pointer(pBase)).Fflags & uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) + *(*int32)(unsafe.Pointer(pDerived + 52)) = *(*int32)(unsafe.Pointer(pBase + 52)) + } +} + +// C documentation +// +// /* +// ** Mark term iChild as being a child of term iParent +// */ +func _markTermAsChild(tls *libc.TLS, pWC uintptr, iChild int32, iParent int32) { + (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iChild)*56))).FiParent = iParent + (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iChild)*56))).FtruthProb = (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iParent)*56))).FtruthProb + (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iParent)*56))).FnChild++ +} + +// C documentation +// +// /* +// ** Return the N-th AND-connected subterm of pTerm. Or if pTerm is not +// ** a conjunction, then return just pTerm when N==0. If N is exceeds +// ** the number of available subterms, return NULL. +// */ +func _whereNthSubterm(tls *libc.TLS, pTerm uintptr, N int32) (r uintptr) { + var v1 uintptr + _ = v1 + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) != int32(WO_AND) { + if N == 0 { + v1 = pTerm + } else { + v1 = uintptr(0) + } + return v1 + } + if N < (*TWhereAndInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32)))).Fwc.FnTerm { + return (*TWhereAndInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32)))).Fwc.Fa + uintptr(N)*56 + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Subterms pOne and pTwo are contained within WHERE clause pWC. The +// ** two subterms are in disjunction - they are OR-ed together. +// ** +// ** If these two terms are both of the form: "A op B" with the same +// ** A and B values but different operators and if the operators are +// ** compatible (if one is = and the other is <, for example) then +// ** add a new virtual AND term to pWC that is the combination of the +// ** two. +// ** +// ** Some examples: +// ** +// ** x x<=y +// ** x=y OR x=y --> x=y +// ** x<=y OR x x<=y +// ** +// ** The following is NOT generated: +// ** +// ** xy --> x!=y +// */ +func _whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintptr, pTwo uintptr) { + var db, pNew uintptr + var eOp Tu16 + var idxNew, op int32 + _, _, _, _, _ = db, eOp, idxNew, op, pNew + eOp = uint16(int32((*TWhereTerm)(unsafe.Pointer(pOne)).FeOperator) | int32((*TWhereTerm)(unsafe.Pointer(pTwo)).FeOperator)) /* Index in pWC of the next virtual term */ + if (int32((*TWhereTerm)(unsafe.Pointer(pOne)).FwtFlags)|int32((*TWhereTerm)(unsafe.Pointer(pTwo)).FwtFlags))&int32(TERM_VNULL) != 0 { + return + } + if int32((*TWhereTerm)(unsafe.Pointer(pOne)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) == 0 { + return + } + if int32((*TWhereTerm)(unsafe.Pointer(pTwo)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) == 0 { + return + } + if int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) != int32(eOp) && int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != int32(eOp) { + return + } + if _sqlite3ExprCompare(tls, uintptr(0), (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOne)).FpExpr)).FpLeft, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTwo)).FpExpr)).FpLeft, -int32(1)) != 0 { + return + } + if _sqlite3ExprCompare(tls, uintptr(0), (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOne)).FpExpr)).FpRight, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTwo)).FpExpr)).FpRight, -int32(1)) != 0 { + return + } + /* If we reach this point, it means the two subterms can be combined */ + if int32(eOp)&(int32(eOp)-int32(1)) != 0 { + if int32(eOp)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) != 0 { + eOp = uint16(libc.Int32FromInt32(WO_EQ) << (libc.Int32FromInt32(TK_LE) - libc.Int32FromInt32(TK_EQ))) + } else { + eOp = uint16(libc.Int32FromInt32(WO_EQ) << (libc.Int32FromInt32(TK_GE) - libc.Int32FromInt32(TK_EQ))) + } + } + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + pNew = _sqlite3ExprDup(tls, db, (*TWhereTerm)(unsafe.Pointer(pOne)).FpExpr, 0) + if pNew == uintptr(0) { + return + } + op = int32(TK_EQ) + for { + if !(int32(eOp) != int32(WO_EQ)<<(op-int32(TK_EQ))) { + break + } + goto _1 + _1: + ; + op++ + } + (*TExpr)(unsafe.Pointer(pNew)).Fop = uint8(op) + idxNew = _whereClauseInsert(tls, pWC, pNew, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) + _exprAnalyze(tls, pSrc, pWC, idxNew) +} + +// C documentation +// +// /* +// ** Analyze a term that consists of two or more OR-connected +// ** subterms. So in: +// ** +// ** ... WHERE (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13) +// ** ^^^^^^^^^^^^^^^^^^^^ +// ** +// ** This routine analyzes terms such as the middle term in the above example. +// ** A WhereOrTerm object is computed and attached to the term under +// ** analysis, regardless of the outcome of the analysis. Hence: +// ** +// ** WhereTerm.wtFlags |= TERM_ORINFO +// ** WhereTerm.u.pOrInfo = a dynamically allocated WhereOrTerm object +// ** +// ** The term being analyzed must have two or more of OR-connected subterms. +// ** A single subterm might be a set of AND-connected sub-subterms. +// ** Examples of terms under analysis: +// ** +// ** (A) t1.x=t2.y OR t1.x=t2.z OR t1.y=15 OR t1.z=t3.a+5 +// ** (B) x=expr1 OR expr2=x OR x=expr3 +// ** (C) t1.x=t2.y OR (t1.x=t2.z AND t1.y=15) +// ** (D) x=expr1 OR (y>11 AND y<22 AND z LIKE '*hello*') +// ** (E) (p.a=1 AND q.b=2 AND r.c=3) OR (p.x=4 AND q.y=5 AND r.z=6) +// ** (F) x>A OR (x=A AND y>=B) +// ** +// ** CASE 1: +// ** +// ** If all subterms are of the form T.C=expr for some single column of C and +// ** a single table T (as shown in example B above) then create a new virtual +// ** term that is an equivalent IN expression. In other words, if the term +// ** being analyzed is: +// ** +// ** x = expr1 OR expr2 = x OR x = expr3 +// ** +// ** then create a new virtual term like this: +// ** +// ** x IN (expr1,expr2,expr3) +// ** +// ** CASE 2: +// ** +// ** If there are exactly two disjuncts and one side has x>A and the other side +// ** has x=A (for the same x and A) then add a new virtual conjunct term to the +// ** WHERE clause of the form "x>=A". Example: +// ** +// ** x>A OR (x=A AND y>B) adds: x>=A +// ** +// ** The added conjunct can sometimes be helpful in query planning. +// ** +// ** CASE 3: +// ** +// ** If all subterms are indexable by a single table T, then set +// ** +// ** WhereTerm.eOperator = WO_OR +// ** WhereTerm.u.pOrInfo->indexable |= the cursor number for table T +// ** +// ** A subterm is "indexable" if it is of the form +// ** "T.C " where C is any column of table T and +// ** is one of "=", "<", "<=", ">", ">=", "IS NULL", or "IN". +// ** A subterm is also indexable if it is an AND of two or more +// ** subsubterms at least one of which is indexable. Indexable AND +// ** subterms have their eOperator set to WO_AND and they have +// ** u.pAndInfo set to a dynamically allocated WhereAndTerm object. +// ** +// ** From another point of view, "indexable" means that the subterm could +// ** potentially be used with an index if an appropriate index exists. +// ** This analysis does not consider whether or not the index exists; that +// ** is decided elsewhere. This analysis only looks at whether subterms +// ** appropriate for indexing exist. +// ** +// ** All examples A through E above satisfy case 3. But if a term +// ** also satisfies case 1 (such as B) we know that the optimizer will +// ** always prefer case 1, so in that case we pretend that case 3 is not +// ** satisfied. +// ** +// ** It might be the case that multiple tables are indexable. For example, +// ** (E) above is indexable on tables P, Q, and R. +// ** +// ** Terms that satisfy case 3 are candidates for lookup by using +// ** separate indices to find rowids for each subterm and composing +// ** the union of all rowids using a RowSet object. This is similar +// ** to "bitmap indices" in other database engines. +// ** +// ** OTHERWISE: +// ** +// ** If none of cases 1, 2, or 3 apply, then leave the eOperator set to +// ** zero. This term is not useful for search. +// */ +func _exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { + var affLeft, affRight, i, iColumn, iCursor, iOne, iTwo, idxNew, j, j1, okToChngToIN, v7, v9 int32 + var b, b1, chngToIN, indexable TBitmask + var db, pAndInfo, pAndTerm, pAndWC, pDup, pExpr, pLeft, pLeft1, pList, pNew, pOne, pOrInfo, pOrTerm, pOrWc, pOther, pParse, pTerm, pTwo, pWInfo, v1, v6, v8, p12, p14, p15, p2, p4 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = affLeft, affRight, b, b1, chngToIN, db, i, iColumn, iCursor, iOne, iTwo, idxNew, indexable, j, j1, okToChngToIN, pAndInfo, pAndTerm, pAndWC, pDup, pExpr, pLeft, pLeft1, pList, pNew, pOne, pOrInfo, pOrTerm, pOrWc, pOther, pParse, pTerm, pTwo, pWInfo, v1, v6, v7, v8, v9, p12, p14, p15, p2, p4 + pWInfo = (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo /* WHERE clause processing context */ + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parser context */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database connection */ + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 /* The term to be analyzed */ + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr /* Tables that are indexable, satisfying case 2 */ + /* + ** Break the OR clause into its separate subterms. The subterms are + ** stored in a WhereClause structure containing within the WhereOrInfo + ** object that is attached to the original OR clause term. + */ + v1 = _sqlite3DbMallocZero(tls, db, uint64(496)) + pOrInfo = v1 + *(*uintptr)(unsafe.Pointer(pTerm + 32)) = v1 + if pOrInfo == uintptr(0) { + return + } + p2 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p2)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(TERM_ORINFO)) + pOrWc = pOrInfo + libc.Xmemset(tls, pOrWc+40, 0, uint64(448)) + _sqlite3WhereClauseInit(tls, pOrWc, pWInfo) + _sqlite3WhereSplit(tls, pOrWc, pExpr, uint8(TK_OR)) + _sqlite3WhereExprAnalyze(tls, pSrc, pOrWc) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + /* + ** Compute the set of tables that might satisfy cases 1 or 3. + */ + indexable = ^libc.Uint64FromInt32(0) + chngToIN = ^libc.Uint64FromInt32(0) + i = (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm - int32(1) + pOrTerm = (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa + for { + if !(i >= 0 && indexable != 0) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator)&int32(WO_SINGLE) == 0 { + chngToIN = uint64(0) + pAndInfo = _sqlite3DbMallocRawNN(tls, db, uint64(488)) + if pAndInfo != 0 { + b = uint64(0) + *(*uintptr)(unsafe.Pointer(pOrTerm + 32)) = pAndInfo + p4 = pOrTerm + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_ANDINFO)) + (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator = uint16(WO_AND) + (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor = -int32(1) + pAndWC = pAndInfo + libc.Xmemset(tls, pAndWC+40, 0, uint64(448)) + _sqlite3WhereClauseInit(tls, pAndWC, (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo) + _sqlite3WhereSplit(tls, pAndWC, (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr, uint8(TK_AND)) + _sqlite3WhereExprAnalyze(tls, pSrc, pAndWC) + (*TWhereClause)(unsafe.Pointer(pAndWC)).FpOuter = pWC + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + j = 0 + pAndTerm = (*TWhereClause)(unsafe.Pointer(pAndWC)).Fa + for { + if !(j < (*TWhereClause)(unsafe.Pointer(pAndWC)).FnTerm) { + break + } + if _allowedOp(tls, int32((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pAndTerm)).FpExpr)).Fop)) != 0 || int32((*TWhereTerm)(unsafe.Pointer(pAndTerm)).FeOperator) == int32(WO_AUX) { + b |= _sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pAndTerm)).FleftCursor) + } + goto _5 + _5: + ; + j++ + pAndTerm += 56 + } + } + indexable &= b + } + } else { + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags)&int32(TERM_COPIED) != 0 { + /* Skip this term for now. We revisit it when we process the + ** corresponding TERM_VIRTUAL term */ + } else { + b1 = _sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor) + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags)&int32(TERM_VIRTUAL) != 0 { + pOther = (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FiParent)*56 + b1 |= _sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pOther)).FleftCursor) + } + indexable &= b1 + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator)&int32(WO_EQ) == 0 { + chngToIN = uint64(0) + } else { + chngToIN &= b1 + } + } + } + goto _3 + _3: + ; + i-- + pOrTerm += 56 + } + /* + ** Record the set of tables that satisfy case 3. The set might be + ** empty. + */ + (*TWhereOrInfo)(unsafe.Pointer(pOrInfo)).Findexable = indexable + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(WO_OR) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = -int32(1) + if indexable != 0 { + (*TWhereClause)(unsafe.Pointer(pWC)).FhasOr = uint8(1) + } + /* For a two-way OR, attempt to implementation case 2. + */ + if indexable != 0 && (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm == int32(2) { + iOne = 0 + for { + v7 = iOne + iOne++ + v6 = _whereNthSubterm(tls, (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa, v7) + pOne = v6 + if !(v6 != uintptr(0)) { + break + } + iTwo = 0 + for { + v9 = iTwo + iTwo++ + v8 = _whereNthSubterm(tls, (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa+1*56, v9) + pTwo = v8 + if !(v8 != uintptr(0)) { + break + } + _whereCombineDisjuncts(tls, pSrc, pWC, pOne, pTwo) + } + } + } + /* + ** chngToIN holds a set of tables that *might* satisfy case 1. But + ** we have to do some additional checking to see if case 1 really + ** is satisfied. + ** + ** chngToIN will hold either 0, 1, or 2 bits. The 0-bit case means + ** that there is no possibility of transforming the OR clause into an + ** IN operator because one or more terms in the OR clause contain + ** something other than == on a column in the single table. The 1-bit + ** case means that every term of the OR clause is of the form + ** "table.column=expr" for some single table. The one bit that is set + ** will correspond to the common table. We still need to check to make + ** sure the same column is used on all terms. The 2-bit case is when + ** the all terms are of the form "table1.column=table2.column". It + ** might be possible to form an IN operator with either table1.column + ** or table2.column as the LHS if either is common to every term of + ** the OR clause. + ** + ** Note that terms of the form "table.column1=table.column2" (the + ** same table on both sizes of the ==) cannot be optimized. + */ + if chngToIN != 0 { + okToChngToIN = 0 /* True if the conversion to IN is valid */ + iColumn = -int32(1) /* Column index on lhs of IN operator */ + iCursor = -int32(1) /* Table cursor common to all terms */ + j1 = 0 /* Loop counter */ + /* Search for a table and column that appears on one side or the + ** other of the == operator in every subterm. That table and column + ** will be recorded in iCursor and iColumn. There might not be any + ** such table and column. Set okToChngToIN if an appropriate table + ** and column is found but leave okToChngToIN false if not found. + */ + j1 = 0 + for { + if !(j1 < int32(2) && !(okToChngToIN != 0)) { + break + } + pLeft = uintptr(0) + pOrTerm = (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa + i = (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm - int32(1) + for { + if !(i >= 0) { + break + } + p12 = pOrTerm + 18 + *(*Tu16)(unsafe.Pointer(p12)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p12))) & ^libc.Int32FromInt32(TERM_OK)) + if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCursor { + /* This is the 2-bit case and we are on the second iteration and + ** current term is from the first iteration. So skip this term. */ + goto _11 + } + if chngToIN&_sqlite3WhereGetMask(tls, pWInfo+592, (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor) == uint64(0) { + /* This term must be of the form t1.a==t2.b where t2 is in the + ** chngToIN set but t1 is not. This term will be either preceded + ** or followed by an inverted copy (t2.b==t1.a). Skip this term + ** and use its inversion. */ + goto _11 + } + iColumn = (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pOrTerm + 32))).FleftColumn + iCursor = (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor + pLeft = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft + break + goto _11 + _11: + ; + i-- + pOrTerm += 56 + } + if i < 0 { + /* No candidate table+column was found. This can only occur + ** on the second iteration */ + break + } + /* We have found a candidate table and column. Check to see if that + ** table and column is common to every term in the OR clause */ + okToChngToIN = int32(1) + for { + if !(i >= 0 && okToChngToIN != 0) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor != iCursor { + p14 = pOrTerm + 18 + *(*Tu16)(unsafe.Pointer(p14)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p14))) & ^libc.Int32FromInt32(TERM_OK)) + } else { + if (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pOrTerm + 32))).FleftColumn != iColumn || iColumn == -int32(2) && _sqlite3ExprCompare(tls, pParse, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft, pLeft, -int32(1)) != 0 { + okToChngToIN = 0 + } else { + /* If the right-hand side is also a column, then the affinities + ** of both right and left sides must be such that no type + ** conversions are required on the right. (Ticket #2249) + */ + affRight = int32(_sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpRight)) + affLeft = int32(_sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft)) + if affRight != 0 && affRight != affLeft { + okToChngToIN = 0 + } else { + p15 = pOrTerm + 18 + *(*Tu16)(unsafe.Pointer(p15)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p15))) | libc.Int32FromInt32(TERM_OK)) + } + } + } + goto _13 + _13: + ; + i-- + pOrTerm += 56 + } + goto _10 + _10: + ; + j1++ + } + /* At this point, okToChngToIN is true if original pTerm satisfies + ** case 1. In that case, construct a new virtual term that is + ** pTerm converted into an IN operator. + */ + if okToChngToIN != 0 { /* A transient duplicate expression */ + pList = uintptr(0) /* The RHS of the IN operator */ + pLeft1 = uintptr(0) /* The complete IN operator */ + i = (*TWhereClause)(unsafe.Pointer(pOrWc)).FnTerm - int32(1) + pOrTerm = (*TWhereClause)(unsafe.Pointer(pOrWc)).Fa + for { + if !(i >= 0) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags)&int32(TERM_OK) == 0 { + goto _16 + } + pDup = _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpRight, 0) + pList = _sqlite3ExprListAppend(tls, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse, pList, pDup) + pLeft1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft + goto _16 + _16: + ; + i-- + pOrTerm += 56 + } + pDup = _sqlite3ExprDup(tls, db, pLeft1, 0) + pNew = _sqlite3PExpr(tls, pParse, int32(TK_IN), pDup, uintptr(0)) + if pNew != 0 { + _transferJoinMarkings(tls, pNew, pExpr) + *(*uintptr)(unsafe.Pointer(pNew + 32)) = pList + idxNew = _whereClauseInsert(tls, pWC, pNew, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) + _exprAnalyze(tls, pSrc, pWC, idxNew) + /* pTerm = &pWC->a[idxTerm]; // would be needed if pTerm where reused */ + _markTermAsChild(tls, pWC, idxNew, idxTerm) + } else { + _sqlite3ExprListDelete(tls, db, pList) + } + } + } +} + +// C documentation +// +// /* +// ** We already know that pExpr is a binary operator where both operands are +// ** column references. This routine checks to see if pExpr is an equivalence +// ** relation: +// ** 1. The SQLITE_Transitive optimization must be enabled +// ** 2. Must be either an == or an IS operator +// ** 3. Not originating in the ON clause of an OUTER JOIN +// ** 4. The affinities of A and B must be compatible +// ** 5a. Both operands use the same collating sequence OR +// ** 5b. The overall collating sequence is BINARY +// ** If this routine returns TRUE, that means that the RHS can be substituted +// ** for the LHS anyplace else in the WHERE clause where the LHS column occurs. +// ** This is an optimization. No harm comes from returning 0. But if 1 is +// ** returned when it should not be, then incorrect answers might result. +// */ +func _termIsEquivalence(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int32) { + var aff1, aff2 int8 + var pColl uintptr + _, _, _ = aff1, aff2, pColl + if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Transitive)) == libc.Uint32FromInt32(0)) { + return 0 + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_EQ) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_IS) { + return 0 + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + return 0 + } + aff1 = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + aff2 = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if int32(aff1) != int32(aff2) && (!(int32(aff1) >= libc.Int32FromInt32(SQLITE_AFF_NUMERIC)) || !(int32(aff2) >= libc.Int32FromInt32(SQLITE_AFF_NUMERIC))) { + return 0 + } + pColl = _sqlite3ExprCompareCollSeq(tls, pParse, pExpr) + if _sqlite3IsBinary(tls, pColl) != 0 { + return int32(1) + } + return _sqlite3ExprCollSeqMatch(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) +} + +// C documentation +// +// /* +// ** Recursively walk the expressions of a SELECT statement and generate +// ** a bitmask indicating which tables are used in that expression +// ** tree. +// */ +func _exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) (r TBitmask) { + var i int32 + var mask TBitmask + var pSrc uintptr + _, _, _ = i, mask, pSrc + mask = uint64(0) + for pS != 0 { + pSrc = (*TSelect)(unsafe.Pointer(pS)).FpSrc + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TSelect)(unsafe.Pointer(pS)).FpEList) + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TSelect)(unsafe.Pointer(pS)).FpGroupBy) + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TSelect)(unsafe.Pointer(pS)).FpOrderBy) + mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*TSelect)(unsafe.Pointer(pS)).FpWhere) + mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*TSelect)(unsafe.Pointer(pS)).FpHaving) + if pSrc != uintptr(0) { + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc) { + break + } + mask |= _exprSelectUsage(tls, pMaskSet, (*(*TSrcItem)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104))).FpSelect) + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 60 + 4))&0x400>>10)) == 0 { + mask |= _sqlite3WhereExprUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 72))) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 60 + 4))&0x4>>2)) != 0 { + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pSrc + 8 + uintptr(i)*104 + 88))) + } + goto _1 + _1: + ; + i++ + } + } + pS = (*TSelect)(unsafe.Pointer(pS)).FpPrior + } + return mask +} + +// C documentation +// +// /* +// ** Expression pExpr is one operand of a comparison operator that might +// ** be useful for indexing. This routine checks to see if pExpr appears +// ** in any index. Return TRUE (1) if pExpr is an indexed term and return +// ** FALSE (0) if not. If TRUE is returned, also set aiCurCol[0] to the cursor +// ** number of the table that is indexed and aiCurCol[1] to the column number +// ** of the column that is indexed, or XN_EXPR (-2) if an expression is being +// ** indexed. +// ** +// ** If pExpr is a TK_COLUMN column reference, then this routine always returns +// ** true even if that particular column is not indexed, because the column +// ** might be added to an automatic index later. +// */ +func _exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr uintptr, j int32) (r int32) { + var i, iCur, v1 int32 + var pIdx uintptr + _, _, _, _ = i, iCur, pIdx, v1 + for { + iCur = (*(*TSrcItem)(unsafe.Pointer(pFrom + 8 + uintptr(j)*104))).FiCursor + pIdx = (*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pFrom + 8 + uintptr(j)*104))).FpTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr == uintptr(0) { + goto _3 + } + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) != -int32(2) { + goto _4 + } + if _sqlite3ExprCompareSkip(tls, pExpr, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, iCur) == 0 && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_STRING) { + *(*int32)(unsafe.Pointer(aiCurCol)) = iCur + *(*int32)(unsafe.Pointer(aiCurCol + 1*4)) = -int32(2) + return int32(1) + } + goto _4 + _4: + ; + i++ + } + goto _3 + _3: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + goto _2 + _2: + ; + j++ + v1 = j + if !(v1 < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { + break + } + } + return 0 +} + +func _exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, aiCurCol uintptr, pExpr uintptr, op int32) (r int32) { + var i int32 + var pIdx uintptr + _, _ = i, pIdx + /* If this expression is a vector to the left or right of a + ** inequality constraint (>, <, >= or <=), perform the processing + ** on the first element of the vector. */ + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VECTOR) && (op >= int32(TK_GT) && op <= int32(TK_GE)) { + pExpr = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8))).FpExpr + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) { + *(*int32)(unsafe.Pointer(aiCurCol)) = (*TExpr)(unsafe.Pointer(pExpr)).FiTable + *(*int32)(unsafe.Pointer(aiCurCol + 1*4)) = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) + return int32(1) + } + i = 0 + for { + if !(i < (*TSrcList)(unsafe.Pointer(pFrom)).FnSrc) { + break + } + pIdx = (*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pFrom + 8 + uintptr(i)*104))).FpTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if (*TIndex)(unsafe.Pointer(pIdx)).FaColExpr != 0 { + return _exprMightBeIndexed2(tls, pFrom, aiCurCol, pExpr, i) + } + goto _2 + _2: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** The input to this routine is an WhereTerm structure with only the +// ** "pExpr" field filled in. The job of this routine is to analyze the +// ** subexpression and populate all the other fields of the WhereTerm +// ** structure. +// ** +// ** If the expression is of the form " X" it gets commuted +// ** to the standard form of "X ". +// ** +// ** If the expression is of the form "X Y" where both X and Y are +// ** columns, then the original expression is unchanged and a new virtual +// ** term of the form "Y X" is added to the WHERE clause and +// ** analyzed separately. The original term is marked with TERM_COPIED +// ** and the new term is marked with TERM_DYNAMIC (because it's pExpr +// ** needs to be freed with the WhereClause) and TERM_VIRTUAL (because it +// ** is a commuted copy of a prior term.) The original term has nChild=1 +// ** and the copy has idxParent set to the index of the original term. +// */ +func _exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var c, v12 int8 + var c1 Tu8 + var db, pC, pDup, pExpr, pLeft, pLeft1, pLeft2, pLeft3, pList, pMaskSet, pNew, pNew1, pNewExpr, pNewExpr1, pNewExpr11, pNewExpr2, pNewExpr21, pNewTerm, pNewTerm1, pParse, pRight, pRight1, pStr2, pTerm, pWInfo, t, zCollSeqName, v13, p1, p10, p17, p20, p3, p4, p5, p6, p7, p9 uintptr + var eExtraOp, opMask, wtFlags Tu16 + var extraRight, prereqAll, prereqColumn, prereqExpr, prereqLeft, x TBitmask + var i, i1, i2, i3, idxNew, idxNew1, idxNew11, idxNew2, idxNew21, idxNew3, idxNew4, idxNew5, nLeft, op, res, v14, v19, v2 int32 + var v15 bool + var _ /* aiCurCol at bp+24 */ [2]int32 + var _ /* eOp2 at bp+16 */ uint8 + var _ /* isComplete at bp+8 */ int32 + var _ /* noCase at bp+12 */ int32 + var _ /* pLeft at bp+40 */ uintptr + var _ /* pRight at bp+32 */ uintptr + var _ /* pStr1 at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, c1, db, eExtraOp, extraRight, i, i1, i2, i3, idxNew, idxNew1, idxNew11, idxNew2, idxNew21, idxNew3, idxNew4, idxNew5, nLeft, op, opMask, pC, pDup, pExpr, pLeft, pLeft1, pLeft2, pLeft3, pList, pMaskSet, pNew, pNew1, pNewExpr, pNewExpr1, pNewExpr11, pNewExpr2, pNewExpr21, pNewTerm, pNewTerm1, pParse, pRight, pRight1, pStr2, pTerm, pWInfo, prereqAll, prereqColumn, prereqExpr, prereqLeft, res, t, wtFlags, x, zCollSeqName, v12, v13, v14, v15, v19, v2, p1, p10, p17, p20, p3, p4, p5, p6, p7, p9 + pWInfo = (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo /* Prerequisites of pExpr */ + extraRight = uint64(0) /* Extra dependencies on LEFT JOIN */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* RHS of LIKE/GLOB operator */ + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* RHS of LIKE/GLOB ends with wildcard */ + *(*int32)(unsafe.Pointer(bp + 12)) = 0 /* Top-level operator. pExpr->op */ + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parsing context */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Database connection */ + *(*uint8)(unsafe.Pointer(bp + 16)) = uint8(0) /* Number of elements on left side vector */ + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + pMaskSet = pWInfo + 592 + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + /* Because malloc() has not failed */ + (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect = 0 + prereqLeft = _sqlite3WhereExprUsage(tls, pMaskSet, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + op = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) + if op == int32(TK_IN) { + if _sqlite3ExprCheckIN(tls, pParse, pExpr) != 0 { + return + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = _exprSelectUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + } else { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = _sqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pExpr + 32))) + } + prereqAll = prereqLeft | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight + } else { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = _sqlite3WhereExprUsage(tls, pMaskSet, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if (*TExpr)(unsafe.Pointer(pExpr)).FpLeft == uintptr(0) || (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_xIsSelect)|libc.Int32FromInt32(EP_IfNullRow)) != uint32(0) || *(*uintptr)(unsafe.Pointer(pExpr + 32)) != uintptr(0) { + prereqAll = _sqlite3WhereExprUsageNN(tls, pMaskSet, pExpr) + } else { + prereqAll = prereqLeft | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight + } + } + if (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect != 0 { + p1 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p1)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(TERM_VARSELECT)) + } + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != uint32(0) { + x = _sqlite3WhereGetMask(tls, pMaskSet, *(*int32)(unsafe.Pointer(pExpr + 52))) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) { + prereqAll |= x + extraRight = x - uint64(1) /* ON clause terms may not be used with an index + ** on left table of a LEFT JOIN. Ticket #3015 */ + if prereqAll>>libc.Int32FromInt32(1) >= x { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22342, 0) + return + } + } else { + if prereqAll>>libc.Int32FromInt32(1) >= x { + /* The ON clause of an INNER JOIN references a table to its right. + ** Most other SQL database engines raise an error. But SQLite versions + ** 3.0 through 3.38 just put the ON clause constraint into the WHERE + ** clause and carried on. Beginning with 3.39, raise an error only + ** if there is a RIGHT or FULL JOIN in the query. This makes SQLite + ** more like other systems, and also preserves legacy. */ + if (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc > 0 && int32((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22342, 0) + return + } + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_InnerON)) + } + } + } + (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = prereqAll + (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = -int32(1) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FiParent = -int32(1) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) + if _allowedOp(tls, op) != 0 { + pLeft = _sqlite3ExprSkipCollate(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + pRight = _sqlite3ExprSkipCollate(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&prereqLeft == uint64(0) { + v2 = int32(WO_ALL) + } else { + v2 = int32(WO_EQUIV) + } + opMask = uint16(v2) + if (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FiField > 0 { + pLeft = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 32)) + 8 + uintptr((*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FiField-int32(1))*32))).FpExpr + } + if _exprMightBeIndexed(tls, pSrc, bp+24, pLeft, op) != 0 { + (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[0] + (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[int32(1)] + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(int32(_operatorMask(tls, op)) & int32(opMask)) + } + if op == int32(TK_IS) { + p3 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(TERM_IS)) + } + if pRight != 0 && _exprMightBeIndexed(tls, pSrc, bp+24, pRight, op) != 0 && !((*TExpr)(unsafe.Pointer(pRight)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { + eExtraOp = uint16(0) /* Extra bits for pNew->eOperator */ + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor >= 0 { + pDup = _sqlite3ExprDup(tls, db, pExpr, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db, pDup) + return + } + idxNew = _whereClauseInsert(tls, pWC, pDup, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) + if idxNew == 0 { + return + } + pNew = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew)*56 + _markTermAsChild(tls, pWC, idxNew, idxTerm) + if op == int32(TK_IS) { + p4 = pNew + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_IS)) + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + p5 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p5)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p5))) | libc.Int32FromInt32(TERM_COPIED)) + if _termIsEquivalence(tls, pParse, pDup) != 0 { + p6 = pTerm + 20 + *(*Tu16)(unsafe.Pointer(p6)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p6))) | libc.Int32FromInt32(WO_EQUIV)) + eExtraOp = uint16(WO_EQUIV) + } + } else { + pDup = pExpr + pNew = pTerm + } + p7 = pNew + 18 + *(*Tu16)(unsafe.Pointer(p7)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p7))) | int32(_exprCommute(tls, pParse, pDup))) + (*TWhereTerm)(unsafe.Pointer(pNew)).FleftCursor = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[0] + (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pNew + 32))).FleftColumn = (*(*[2]int32)(unsafe.Pointer(bp + 24)))[int32(1)] + (*TWhereTerm)(unsafe.Pointer(pNew)).FprereqRight = prereqLeft | extraRight + (*TWhereTerm)(unsafe.Pointer(pNew)).FprereqAll = prereqAll + (*TWhereTerm)(unsafe.Pointer(pNew)).FeOperator = uint16((int32(_operatorMask(tls, int32((*TExpr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask)) + } else { + if op == int32(TK_ISNULL) && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) && 0 == _sqlite3ExprCanBeNull(tls, pLeft) { + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_TRUEFALSE) /* See tag-20230504-1 */ + *(*uintptr)(unsafe.Pointer(pExpr + 8)) = __ccgo_ts + 7923 + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_IsFalse)) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(0) + } + } + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_BETWEEN) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) { + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32)) + i = 0 + for { + if !(i < int32(2)) { + break + } + pNewExpr = _sqlite3PExpr(tls, pParse, int32(_ops[i]), _sqlite3ExprDup(tls, db, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, 0), _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, 0)) + _transferJoinMarkings(tls, pNewExpr, pExpr) + idxNew1 = _whereClauseInsert(tls, pWC, pNewExpr, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) + _exprAnalyze(tls, pSrc, pWC, idxNew1) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + _markTermAsChild(tls, pWC, idxNew1, idxTerm) + goto _8 + _8: + ; + i++ + } + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_OR) { + _exprAnalyzeOrTerm(tls, pSrc, pWC, idxTerm) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_NOTNULL) { + if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).FiColumn) >= 0 && !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) { + pLeft1 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pNewExpr1 = _sqlite3PExpr(tls, pParse, int32(TK_GT), _sqlite3ExprDup(tls, db, pLeft1, 0), _sqlite3ExprAlloc(tls, db, int32(TK_NULL), uintptr(0), 0)) + idxNew2 = _whereClauseInsert(tls, pWC, pNewExpr1, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC)|libc.Int32FromInt32(TERM_VNULL))) + if idxNew2 != 0 { + pNewTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew2)*56 + (*TWhereTerm)(unsafe.Pointer(pNewTerm)).FprereqRight = uint64(0) + (*TWhereTerm)(unsafe.Pointer(pNewTerm)).FleftCursor = (*TExpr)(unsafe.Pointer(pLeft1)).FiTable + (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pNewTerm + 32))).FleftColumn = int32((*TExpr)(unsafe.Pointer(pLeft1)).FiColumn) + (*TWhereTerm)(unsafe.Pointer(pNewTerm)).FeOperator = uint16(libc.Int32FromInt32(WO_EQ) << (libc.Int32FromInt32(TK_GT) - libc.Int32FromInt32(TK_EQ))) + _markTermAsChild(tls, pWC, idxNew2, idxTerm) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + p9 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p9)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p9))) | libc.Int32FromInt32(TERM_COPIED)) + (*TWhereTerm)(unsafe.Pointer(pNewTerm)).FprereqAll = (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll + } + } + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) && _isLikeOrGlob(tls, pParse, pExpr, bp, bp+8, bp+12) != 0 { /* Name of collating sequence */ + wtFlags = uint16(libc.Int32FromInt32(TERM_LIKEOPT) | libc.Int32FromInt32(TERM_VIRTUAL) | libc.Int32FromInt32(TERM_DYNAMIC)) + pLeft2 = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)) + 8 + 1*32))).FpExpr + pStr2 = _sqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(bp)), 0) + /* Convert the lower bound to upper-case and the upper bound to + ** lower-case (upper-case is less than lower-case in ASCII) so that + ** the range constraints also work for BLOBs + */ + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 && !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + p10 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p10)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p10))) | libc.Int32FromInt32(TERM_LIKE)) + i1 = 0 + for { + v12 = *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 8)) + uintptr(i1))) + c = v12 + if !(int32(v12) != 0) { + break + } + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 8)) + uintptr(i1))) = int8(int32(c) & ^(int32(_sqlite3CtypeMap[uint8(c)]) & libc.Int32FromInt32(0x20))) + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(i1))) = int8(_sqlite3UpperToLower[uint8(c)]) + goto _11 + _11: + ; + i1++ + } + } + if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { /* Last character before the first wildcard */ + pC = *(*uintptr)(unsafe.Pointer(pStr2 + 8)) + uintptr(_sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pStr2 + 8)))-int32(1)) + c1 = *(*Tu8)(unsafe.Pointer(pC)) + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { + /* The point is to increment the last character before the first + ** wildcard. But if we increment '@', that will push it into the + ** alphabetic range where case conversions will mess up the + ** inequality. To avoid this, make sure to also run the full + ** LIKE on all candidate expressions by clearing the isComplete flag + */ + if int32(c1) == libc.Int32FromUint8('A')-libc.Int32FromInt32(1) { + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + } + c1 = _sqlite3UpperToLower[c1] + } + *(*Tu8)(unsafe.Pointer(pC)) = uint8(int32(c1) + int32(1)) + } + if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { + v13 = __ccgo_ts + 22383 + } else { + v13 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + zCollSeqName = v13 + pNewExpr11 = _sqlite3ExprDup(tls, db, pLeft2, 0) + pNewExpr11 = _sqlite3PExpr(tls, pParse, int32(TK_GE), _sqlite3ExprAddCollateString(tls, pParse, pNewExpr11, zCollSeqName), *(*uintptr)(unsafe.Pointer(bp))) + _transferJoinMarkings(tls, pNewExpr11, pExpr) + idxNew11 = _whereClauseInsert(tls, pWC, pNewExpr11, wtFlags) + pNewExpr21 = _sqlite3ExprDup(tls, db, pLeft2, 0) + pNewExpr21 = _sqlite3PExpr(tls, pParse, int32(TK_LT), _sqlite3ExprAddCollateString(tls, pParse, pNewExpr21, zCollSeqName), pStr2) + _transferJoinMarkings(tls, pNewExpr21, pExpr) + idxNew21 = _whereClauseInsert(tls, pWC, pNewExpr21, wtFlags) + _exprAnalyze(tls, pSrc, pWC, idxNew11) + _exprAnalyze(tls, pSrc, pWC, idxNew21) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + _markTermAsChild(tls, pWC, idxNew11, idxTerm) + _markTermAsChild(tls, pWC, idxNew21, idxTerm) + } + } + } + } + } + } + /* If there is a vector == or IS term - e.g. "(a, b) == (?, ?)" - create + ** new terms for each component comparison - "a = ?" and "b = ?". The + ** new terms completely replace the original vector comparison, which is + ** no longer used. + ** + ** This is only required if at least one side of the comparison operation + ** is not a sub-select. + ** + ** tag-20220128a + */ + if v15 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_EQ) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS); v15 { + v14 = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) + nLeft = v14 + } + if v15 && v14 > int32(1) && _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) == nLeft && ((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fflags&uint32(EP_xIsSelect) == uint32(0) || (*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpRight)).Fflags&uint32(EP_xIsSelect) == uint32(0)) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) { + i2 = 0 + for { + if !(i2 < nLeft) { + break + } + pLeft3 = _sqlite3ExprForVectorField(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, i2, nLeft) + pRight1 = _sqlite3ExprForVectorField(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpRight, i2, nLeft) + pNew1 = _sqlite3PExpr(tls, pParse, int32((*TExpr)(unsafe.Pointer(pExpr)).Fop), pLeft3, pRight1) + _transferJoinMarkings(tls, pNew1, pExpr) + idxNew3 = _whereClauseInsert(tls, pWC, pNew1, uint16(libc.Int32FromInt32(TERM_DYNAMIC)|libc.Int32FromInt32(TERM_SLICE))) + _exprAnalyze(tls, pSrc, pWC, idxNew3) + goto _16 + _16: + ; + i2++ + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + p17 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p17)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p17))) | (libc.Int32FromInt32(TERM_CODED) | libc.Int32FromInt32(TERM_VIRTUAL))) /* Disable the original */ + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(WO_ROWVAL) + } else { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IN) && (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FiField == 0 && int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == int32(TK_VECTOR) && (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) && ((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpPrior == uintptr(0) || (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FselFlags&uint32(SF_Values) != 0) && (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FpWin == uintptr(0) && int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) { + i3 = 0 + for { + if !(i3 < _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft)) { + break + } + idxNew4 = _whereClauseInsert(tls, pWC, pExpr, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_SLICE))) + *(*int32)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew4)*56 + 32 + 4)) = i3 + int32(1) + _exprAnalyze(tls, pSrc, pWC, idxNew4) + _markTermAsChild(tls, pWC, idxNew4, idxTerm) + goto _18 + _18: + ; + i3++ + } + } else { + if int32((*TWhereClause)(unsafe.Pointer(pWC)).Fop) == int32(TK_AND) { + *(*uintptr)(unsafe.Pointer(bp + 32)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40)) = uintptr(0) + res = _isAuxiliaryVtabOperator(tls, db, pExpr, bp+16, bp+40, bp+32) + for { + v19 = res + res-- + if !(v19 > 0) { + break + } + prereqExpr = _sqlite3WhereExprUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(bp + 32))) + prereqColumn = _sqlite3WhereExprUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(bp + 40))) + if prereqExpr&prereqColumn == uint64(0) { + pNewExpr2 = _sqlite3PExpr(tls, pParse, int32(TK_MATCH), uintptr(0), _sqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32)), 0)) + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0) && pNewExpr2 != 0 { + *(*Tu32)(unsafe.Pointer(pNewExpr2 + 4)) |= uint32(libc.Int32FromInt32(EP_OuterON)) + *(*int32)(unsafe.Pointer(pNewExpr2 + 52)) = *(*int32)(unsafe.Pointer(pExpr + 52)) + } + idxNew5 = _whereClauseInsert(tls, pWC, pNewExpr2, uint16(libc.Int32FromInt32(TERM_VIRTUAL)|libc.Int32FromInt32(TERM_DYNAMIC))) + pNewTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew5)*56 + (*TWhereTerm)(unsafe.Pointer(pNewTerm1)).FprereqRight = prereqExpr + (*TWhereTerm)(unsafe.Pointer(pNewTerm1)).FleftCursor = (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40)))).FiTable + (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pNewTerm1 + 32))).FleftColumn = int32((*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40)))).FiColumn) + (*TWhereTerm)(unsafe.Pointer(pNewTerm1)).FeOperator = uint16(WO_AUX) + (*TWhereTerm)(unsafe.Pointer(pNewTerm1)).FeMatchOp = *(*uint8)(unsafe.Pointer(bp + 16)) + _markTermAsChild(tls, pWC, idxNew5, idxTerm) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + p20 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p20)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p20))) | libc.Int32FromInt32(TERM_COPIED)) + (*TWhereTerm)(unsafe.Pointer(pNewTerm1)).FprereqAll = (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll + } + t = *(*uintptr)(unsafe.Pointer(bp + 40)) + *(*uintptr)(unsafe.Pointer(bp + 40)) = *(*uintptr)(unsafe.Pointer(bp + 32)) + *(*uintptr)(unsafe.Pointer(bp + 32)) = t + } + } + } + } + /* Prevent ON clause terms of a LEFT JOIN from being used to drive + ** an index for tables to the left of the join. + */ + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56 + *(*TBitmask)(unsafe.Pointer(pTerm + 40)) |= extraRight +} + +var _ops = [2]Tu8{ + 0: uint8(TK_GE), + 1: uint8(TK_LE), +} + +/*************************************************************************** +** Routines with file scope above. Interface to the rest of the where.c +** subsystem follows. +***************************************************************************/ + +// C documentation +// +// /* +// ** This routine identifies subexpressions in the WHERE clause where +// ** each subexpression is separated by the AND operator or some other +// ** operator specified in the op parameter. The WhereClause structure +// ** is filled with pointers to subexpressions. For example: +// ** +// ** WHERE a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22) +// ** \________/ \_______________/ \________________/ +// ** slot[0] slot[1] slot[2] +// ** +// ** The original WHERE clause in pExpr is unaltered. All this routine +// ** does is make slot[] entries point to substructure within pExpr. +// ** +// ** In the previous sentence and in the diagram, "slot[]" refers to +// ** the WhereClause.a[] array. The slot[] array grows as needed to contain +// ** all terms of the WHERE clause. +// */ +func _sqlite3WhereSplit(tls *libc.TLS, pWC uintptr, pExpr uintptr, op Tu8) { + var pE2 uintptr + _ = pE2 + pE2 = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) + (*TWhereClause)(unsafe.Pointer(pWC)).Fop = op + if pE2 == uintptr(0) { + return + } + if int32((*TExpr)(unsafe.Pointer(pE2)).Fop) != int32(op) { + _whereClauseInsert(tls, pWC, pExpr, uint16(0)) + } else { + _sqlite3WhereSplit(tls, pWC, (*TExpr)(unsafe.Pointer(pE2)).FpLeft, op) + _sqlite3WhereSplit(tls, pWC, (*TExpr)(unsafe.Pointer(pE2)).FpRight, op) + } +} + +// C documentation +// +// /* +// ** Add either a LIMIT (if eMatchOp==SQLITE_INDEX_CONSTRAINT_LIMIT) or +// ** OFFSET (if eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET) term to the +// ** where-clause passed as the first argument. The value for the term +// ** is found in register iReg. +// ** +// ** In the common case where the value is a simple integer +// ** (example: "LIMIT 5 OFFSET 10") then the expression codes as a +// ** TK_INTEGER so that it will be available to sqlite3_vtab_rhs_value(). +// ** If not, then it codes as a TK_REGISTER expression. +// */ +func _whereAddLimitExpr(tls *libc.TLS, pWC uintptr, iReg int32, pExpr uintptr, iCsr int32, eMatchOp int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pNew, pParse, pTerm, pVal, pVal1 uintptr + var idx int32 + var _ /* iVal at bp+0 */ int32 + _, _, _, _, _, _, _ = db, idx, pNew, pParse, pTerm, pVal, pVal1 + pParse = (*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + *(*int32)(unsafe.Pointer(bp)) = 0 + if _sqlite3ExprIsInteger(tls, pExpr, bp) != 0 && *(*int32)(unsafe.Pointer(bp)) >= 0 { + pVal = _sqlite3Expr(tls, db, int32(TK_INTEGER), uintptr(0)) + if pVal == uintptr(0) { + return + } + *(*Tu32)(unsafe.Pointer(pVal + 4)) |= uint32(libc.Int32FromInt32(EP_IntValue)) + *(*int32)(unsafe.Pointer(&(*TExpr)(unsafe.Pointer(pVal)).Fu)) = *(*int32)(unsafe.Pointer(bp)) + pNew = _sqlite3PExpr(tls, pParse, int32(TK_MATCH), uintptr(0), pVal) + } else { + pVal1 = _sqlite3Expr(tls, db, int32(TK_REGISTER), uintptr(0)) + if pVal1 == uintptr(0) { + return + } + (*TExpr)(unsafe.Pointer(pVal1)).FiTable = iReg + pNew = _sqlite3PExpr(tls, pParse, int32(TK_MATCH), uintptr(0), pVal1) + } + if pNew != 0 { + idx = _whereClauseInsert(tls, pWC, pNew, uint16(libc.Int32FromInt32(TERM_DYNAMIC)|libc.Int32FromInt32(TERM_VIRTUAL))) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idx)*56 + (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = iCsr + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator = uint16(WO_AUX) + (*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp = uint8(eMatchOp) + } +} + +// C documentation +// +// /* +// ** Possibly add terms corresponding to the LIMIT and OFFSET clauses of the +// ** SELECT statement passed as the second argument. These terms are only +// ** added if: +// ** +// ** 1. The SELECT statement has a LIMIT clause, and +// ** 2. The SELECT statement is not an aggregate or DISTINCT query, and +// ** 3. The SELECT statement has exactly one object in its from clause, and +// ** that object is a virtual table, and +// ** 4. There are no terms in the WHERE clause that will not be passed +// ** to the virtual table xBestIndex method. +// ** 5. The ORDER BY clause, if any, will be made available to the xBestIndex +// ** method. +// ** +// ** LIMIT and OFFSET terms are ignored by most of the planner code. They +// ** exist only so that they may be passed to the xBestIndex method of the +// ** single virtual table in the FROM clause of the SELECT. +// */ +func _sqlite3WhereAddLimit(tls *libc.TLS, pWC uintptr, p uintptr) { + var iCsr, ii int32 + var pExpr, pOrderBy uintptr + _, _, _, _ = iCsr, ii, pExpr, pOrderBy + /* 1 -- checked by caller */ + if (*TSelect)(unsafe.Pointer(p)).FpGroupBy == uintptr(0) && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(libc.Int32FromInt32(SF_Distinct)|libc.Int32FromInt32(SF_Aggregate)) == uint32(0) && ((*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc == int32(1) && int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab)).FeTabType) == int32(TABTYP_VTAB)) { + pOrderBy = (*TSelect)(unsafe.Pointer(p)).FpOrderBy + iCsr = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FiCursor + /* Check condition (4). Return early if it is not met. */ + ii = 0 + for { + if !(ii < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + if int32((*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(ii)*56))).FwtFlags)&int32(TERM_CODED) != 0 { + /* This term is a vector operation that has been decomposed into + ** other, subsequent terms. It can be ignored. See tag-20220128a */ + goto _1 + } + if (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(ii)*56))).FnChild != 0 { + /* If this term has child terms, then they are also part of the + ** pWC->a[] array. So this term can be ignored, as a LIMIT clause + ** will only be added if each of the child terms passes the + ** (leftCursor==iCsr) test below. */ + goto _1 + } + if (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(ii)*56))).FleftCursor != iCsr { + return + } + goto _1 + _1: + ; + ii++ + } + /* Check condition (5). Return early if it is not met. */ + if pOrderBy != 0 { + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(ii)*32))).FpExpr + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { + return + } + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != iCsr { + return + } + if int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(ii)*32))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_BIGNULL) != 0 { + return + } + goto _2 + _2: + ; + ii++ + } + } + /* All conditions are met. Add the terms to the where-clause object. */ + _whereAddLimitExpr(tls, pWC, (*TSelect)(unsafe.Pointer(p)).FiLimit, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpLimit)).FpLeft, iCsr, int32(SQLITE_INDEX_CONSTRAINT_LIMIT)) + if (*TSelect)(unsafe.Pointer(p)).FiOffset > 0 { + _whereAddLimitExpr(tls, pWC, (*TSelect)(unsafe.Pointer(p)).FiOffset, (*TExpr)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpLimit)).FpRight, iCsr, int32(SQLITE_INDEX_CONSTRAINT_OFFSET)) + } + } +} + +// C documentation +// +// /* +// ** Initialize a preallocated WhereClause structure. +// */ +func _sqlite3WhereClauseInit(tls *libc.TLS, pWC uintptr, pWInfo uintptr) { + (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo = pWInfo + (*TWhereClause)(unsafe.Pointer(pWC)).FhasOr = uint8(0) + (*TWhereClause)(unsafe.Pointer(pWC)).FpOuter = uintptr(0) + (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm = 0 + (*TWhereClause)(unsafe.Pointer(pWC)).FnBase = 0 + (*TWhereClause)(unsafe.Pointer(pWC)).FnSlot = int32(libc.Uint64FromInt64(448) / libc.Uint64FromInt64(56)) + (*TWhereClause)(unsafe.Pointer(pWC)).Fa = pWC + 40 +} + +// C documentation +// +// /* +// ** Deallocate a WhereClause structure. The WhereClause structure +// ** itself is not freed. This routine is the inverse of +// ** sqlite3WhereClauseInit(). +// */ +func _sqlite3WhereClauseClear(tls *libc.TLS, pWC uintptr) { + var a, aLast, db uintptr + _, _, _ = a, aLast, db + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + if (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm > 0 { + a = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + aLast = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm-int32(1))*56 + for int32(1) != 0 { + if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&int32(TERM_DYNAMIC) != 0 { + _sqlite3ExprDelete(tls, db, (*TWhereTerm)(unsafe.Pointer(a)).FpExpr) + } + if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&(libc.Int32FromInt32(TERM_ORINFO)|libc.Int32FromInt32(TERM_ANDINFO)) != 0 { + if int32((*TWhereTerm)(unsafe.Pointer(a)).FwtFlags)&int32(TERM_ORINFO) != 0 { + _whereOrInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32))) + } else { + _whereAndInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32))) + } + } + if a == aLast { + break + } + a += 56 + } + } +} + +// C documentation +// +// /* +// ** These routines walk (recursively) an expression tree and generate +// ** a bitmask indicating which tables are used in that expression +// ** tree. +// ** +// ** sqlite3WhereExprUsage(MaskSet, Expr) -> +// ** +// ** Return a Bitmask of all tables referenced by Expr. Expr can be +// ** be NULL, in which case 0 is returned. +// ** +// ** sqlite3WhereExprUsageNN(MaskSet, Expr) -> +// ** +// ** Same as sqlite3WhereExprUsage() except that Expr must not be +// ** NULL. The "NN" suffix on the name stands for "Not Null". +// ** +// ** sqlite3WhereExprListUsage(MaskSet, ExprList) -> +// ** +// ** Return a Bitmask of all tables referenced by every expression +// ** in the expression list ExprList. ExprList can be NULL, in which +// ** case 0 is returned. +// ** +// ** sqlite3WhereExprUsageFull(MaskSet, ExprList) -> +// ** +// ** Internal use only. Called only by sqlite3WhereExprUsageNN() for +// ** complex expressions that require pushing register values onto +// ** the stack. Many calls to sqlite3WhereExprUsageNN() do not need +// ** the more complex analysis done by this routine. Hence, the +// ** computations done by this routine are broken out into a separate +// ** "no-inline" function to avoid the stack push overhead in the +// ** common case where it is not needed. +// */ +func _sqlite3WhereExprUsageFull(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r TBitmask) { + var mask TBitmask + var v1 uint64 + _, _ = mask, v1 + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_IF_NULL_ROW) { + v1 = _sqlite3WhereGetMask(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FiTable) + } else { + v1 = uint64(0) + } + mask = v1 + if (*TExpr)(unsafe.Pointer(p)).FpLeft != 0 { + mask |= _sqlite3WhereExprUsageNN(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FpLeft) + } + if (*TExpr)(unsafe.Pointer(p)).FpRight != 0 { + mask |= _sqlite3WhereExprUsageNN(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FpRight) + } else { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_VarSelect)) != uint32(0) { + (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect = int32(1) + } + mask |= _exprSelectUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(p + 32))) + } else { + if *(*uintptr)(unsafe.Pointer(p + 32)) != 0 { + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(p + 32))) + } + } + } + if (int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_FUNCTION) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_AGG_FUNCTION)) && (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_WinFunc) != uint32(0) { + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpPartition) + mask |= _sqlite3WhereExprListUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpOrderBy) + mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64)))).FpFilter) + } + return mask +} + +func _sqlite3WhereExprUsageNN(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r TBitmask) { + if int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) && !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { + return _sqlite3WhereGetMask(tls, pMaskSet, (*TExpr)(unsafe.Pointer(p)).FiTable) + } else { + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_TokenOnly)|libc.Int32FromInt32(EP_Leaf)) != uint32(0) { + return uint64(0) + } + } + return _sqlite3WhereExprUsageFull(tls, pMaskSet, p) +} + +func _sqlite3WhereExprUsage(tls *libc.TLS, pMaskSet uintptr, p uintptr) (r TBitmask) { + var v1 uint64 + _ = v1 + if p != 0 { + v1 = _sqlite3WhereExprUsageNN(tls, pMaskSet, p) + } else { + v1 = uint64(0) + } + return v1 +} + +func _sqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) (r TBitmask) { + var i int32 + var mask TBitmask + _, _ = i, mask + mask = uint64(0) + if pList != 0 { + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + mask |= _sqlite3WhereExprUsage(tls, pMaskSet, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) + goto _1 + _1: + ; + i++ + } + } + return mask +} + +// C documentation +// +// /* +// ** Call exprAnalyze on all terms in a WHERE clause. +// ** +// ** Note that exprAnalyze() might add new virtual terms onto the +// ** end of the WHERE clause. We do not want to analyze these new +// ** virtual terms, so start analyzing at the end and work forward +// ** so that the added virtual terms are never processed. +// */ +func _sqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { + var i int32 + _ = i + i = (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm - int32(1) + for { + if !(i >= 0) { + break + } + _exprAnalyze(tls, pTabList, pWC, i) + goto _1 + _1: + ; + i-- + } +} + +// C documentation +// +// /* +// ** For table-valued-functions, transform the function arguments into +// ** new WHERE clause terms. +// ** +// ** Each function argument translates into an equality constraint against +// ** a HIDDEN column in the table. +// */ +func _sqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var j, k, v2, v3 int32 + var joinType Tu32 + var pArgs, pColRef, pRhs, pTab, pTerm uintptr + _, _, _, _, _, _, _, _, _, _ = j, joinType, k, pArgs, pColRef, pRhs, pTab, pTerm, v2, v3 + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x4>>2)) == 0 { + return + } + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + pArgs = *(*uintptr)(unsafe.Pointer(pItem + 88)) + if pArgs == uintptr(0) { + return + } + v2 = libc.Int32FromInt32(0) + k = v2 + j = v2 + for { + if !(j < (*TExprList)(unsafe.Pointer(pArgs)).FnExpr) { + break + } + for k < int32((*TTable)(unsafe.Pointer(pTab)).FnCol) && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(k)*16))).FcolFlags)&int32(COLFLAG_HIDDEN) == 0 { + k++ + } + if k >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22390, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, j)) + return + } + pColRef = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_COLUMN), uintptr(0), 0) + if pColRef == uintptr(0) { + return + } + (*TExpr)(unsafe.Pointer(pColRef)).FiTable = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + v3 = k + k++ + (*TExpr)(unsafe.Pointer(pColRef)).FiColumn = int16(v3) + *(*uintptr)(unsafe.Pointer(pColRef + 64)) = pTab + *(*TBitmask)(unsafe.Pointer(pItem + 80)) |= _sqlite3ExprColUsed(tls, pColRef) + pRhs = _sqlite3PExpr(tls, pParse, int32(TK_UPLUS), _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TExprList_item)(unsafe.Pointer(pArgs + 8 + uintptr(j)*32))).FpExpr, 0), uintptr(0)) + pTerm = _sqlite3PExpr(tls, pParse, int32(TK_EQ), pColRef, pRhs) + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) != 0 { + /* testtag-20230227a */ + /* testtag-20230227b */ + joinType = uint32(EP_OuterON) + } else { + /* testtag-20230227c */ + joinType = uint32(EP_InnerON) + } + _sqlite3SetJoinExpr(tls, pTerm, (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor, joinType) + _whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) + goto _1 + _1: + ; + j++ + } +} + +/************** End of whereexpr.c *******************************************/ +/************** Begin file where.c *******************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This module contains C code that generates VDBE code used to process +** the WHERE clause of SQL statements. This module is responsible for +** generating the code that loops through a table looking for applicable +** rows. Indices are selected and used to speed the search when doing +** so is applicable. Because this module is responsible for selecting +** indices, you might also think of this module as the "query optimizer". + */ +/* #include "sqliteInt.h" */ +/* #include "whereInt.h" */ + +// C documentation +// +// /* +// ** Extra information appended to the end of sqlite3_index_info but not +// ** visible to the xBestIndex function, at least not directly. The +// ** sqlite3_vtab_collation() interface knows how to reach it, however. +// ** +// ** This object is not an API and can be changed from one release to the +// ** next. As long as allocateIndexInfo() and sqlite3_vtab_collation() +// ** agree on the structure, all will be well. +// */ +type THiddenIndexInfo = struct { + FpWC uintptr + FpParse uintptr + FeDistinct int32 + FmIn Tu32 + FmHandleIn Tu32 + FaRhs [1]uintptr +} + +type HiddenIndexInfo = THiddenIndexInfo + +type THiddenIndexInfo1 = struct { + FpWC uintptr + FpParse uintptr + FeDistinct int32 + FmIn Tu32 + FmHandleIn Tu32 + FaRhs [1]uintptr +} + +type HiddenIndexInfo1 = THiddenIndexInfo1 + +// C documentation +// +// /* +// ** Return the estimated number of output rows from a WHERE clause +// */ +func _sqlite3WhereOutputRowCount(tls *libc.TLS, pWInfo uintptr) (r TLogEst) { + return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut +} + +// C documentation +// +// /* +// ** Return one of the WHERE_DISTINCT_xxxxx values to indicate how this +// ** WHERE clause returns outputs for DISTINCT processing. +// */ +func _sqlite3WhereIsDistinct(tls *libc.TLS, pWInfo uintptr) (r int32) { + return int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) +} + +// C documentation +// +// /* +// ** Return the number of ORDER BY terms that are satisfied by the +// ** WHERE clause. A return of 0 means that the output must be +// ** completely sorted. A return equal to the number of ORDER BY +// ** terms means that no sorting is needed at all. A return that +// ** is positive but less than the number of ORDER BY terms means that +// ** block sorting is required. +// */ +func _sqlite3WhereIsOrdered(tls *libc.TLS, pWInfo uintptr) (r int32) { + var v1 int32 + _ = v1 + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) < 0 { + v1 = 0 + } else { + v1 = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) + } + return v1 +} + +// C documentation +// +// /* +// ** In the ORDER BY LIMIT optimization, if the inner-most loop is known +// ** to emit rows in increasing order, and if the last row emitted by the +// ** inner-most loop did not fit within the sorter, then we can skip all +// ** subsequent rows for the current iteration of the inner loop (because they +// ** will not fit in the sorter either) and continue with the second inner +// ** loop - the loop immediately outside the inner-most. +// ** +// ** When a row does not fit in the sorter (because the sorter already +// ** holds LIMIT+OFFSET rows that are smaller), then a jump is made to the +// ** label returned by this function. +// ** +// ** If the ORDER BY LIMIT optimization applies, the jump destination should +// ** be the continuation for the second-inner-most loop. If the ORDER BY +// ** LIMIT optimization does not apply, then the jump destination should +// ** be the continuation for the inner-most loop. +// ** +// ** It is always safe for this routine to return the continuation of the +// ** inner-most loop, in the sense that a correct answer will result. +// ** Returning the continuation the second inner loop is an optimization +// ** that might make the code run a little faster, but should not change +// ** the final answer. +// */ +func _sqlite3WhereOrderByLimitOptLabel(tls *libc.TLS, pWInfo uintptr) (r int32) { + var pInner uintptr + var v1 int32 + _, _ = pInner, v1 + if !(int32(uint32(*(*uint8)(unsafe.Pointer(pWInfo + 68))&0x4>>2)) != 0) { + /* The ORDER BY LIMIT optimization does not apply. Jump to the + ** continuation of the inner-most loop. */ + return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue + } + pInner = pWInfo + 856 + uintptr(int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1))*104 + if (*TWhereLevel)(unsafe.Pointer(pInner)).FpRJ != 0 { + v1 = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue + } else { + v1 = (*TWhereLevel)(unsafe.Pointer(pInner)).FaddrNxt + } + return v1 +} + +// C documentation +// +// /* +// ** While generating code for the min/max optimization, after handling +// ** the aggregate-step call to min() or max(), check to see if any +// ** additional looping is required. If the output order is such that +// ** we are certain that the correct answer has already been found, then +// ** code an OP_Goto to by pass subsequent processing. +// ** +// ** Any extra OP_Goto that is coded here is an optimization. The +// ** correct answer should be obtained regardless. This OP_Goto just +// ** makes the answer appear faster. +// */ +func _sqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { + var i int32 + var pInner uintptr + _, _ = i, pInner + if !(int32(uint32(*(*uint8)(unsafe.Pointer(pWInfo + 68))&0x4>>2)) != 0) { + return + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == 0 { + return + } + i = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - int32(1) + for { + if !(i >= 0) { + break + } + pInner = pWInfo + 856 + uintptr(i)*104 + if (*TWhereLoop1)(unsafe.Pointer((*TWhereLevel)(unsafe.Pointer(pInner)).FpWLoop)).FwsFlags&uint32(WHERE_COLUMN_IN) != uint32(0) { + _sqlite3VdbeGoto(tls, v, (*TWhereLevel)(unsafe.Pointer(pInner)).FaddrNxt) + return + } + goto _1 + _1: + ; + i-- + } + _sqlite3VdbeGoto(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) +} + +// C documentation +// +// /* +// ** Return the VDBE address or label to jump to in order to continue +// ** immediately with the next row of a WHERE clause. +// */ +func _sqlite3WhereContinueLabel(tls *libc.TLS, pWInfo uintptr) (r int32) { + return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue +} + +// C documentation +// +// /* +// ** Return the VDBE address or label to jump to in order to break +// ** out of a WHERE loop. +// */ +func _sqlite3WhereBreakLabel(tls *libc.TLS, pWInfo uintptr) (r int32) { + return (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak +} + +// C documentation +// +// /* +// ** Return ONEPASS_OFF (0) if an UPDATE or DELETE statement is unable to +// ** operate directly on the rowids returned by a WHERE clause. Return +// ** ONEPASS_SINGLE (1) if the statement can operation directly because only +// ** a single row is to be changed. Return ONEPASS_MULTI (2) if the one-pass +// ** optimization can be used on multiple +// ** +// ** If the ONEPASS optimization is used (if this routine returns true) +// ** then also write the indices of open cursors used by ONEPASS +// ** into aiCur[0] and aiCur[1]. iaCur[0] gets the cursor of the data +// ** table and iaCur[1] gets the cursor used by an auxiliary index. +// ** Either value may be -1, indicating that cursor is not used. +// ** Any cursors returned will have been opened for writing. +// ** +// ** aiCur[0] and aiCur[1] both get -1 if the where-clause logic is +// ** unable to use the ONEPASS optimization. +// */ +func _sqlite3WhereOkOnePass(tls *libc.TLS, pWInfo uintptr, aiCur uintptr) (r int32) { + libc.Xmemcpy(tls, aiCur, pWInfo+40, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)) + return int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) +} + +// C documentation +// +// /* +// ** Return TRUE if the WHERE loop uses the OP_DeferredSeek opcode to move +// ** the data cursor to the row selected by the index cursor. +// */ +func _sqlite3WhereUsesDeferredSeek(tls *libc.TLS, pWInfo uintptr) (r int32) { + return int32(uint32(*(*uint8)(unsafe.Pointer(pWInfo + 68)) & 0x1 >> 0)) +} + +// C documentation +// +// /* +// ** Move the content of pSrc into pDest +// */ +func _whereOrMove(tls *libc.TLS, pDest uintptr, pSrc uintptr) { + (*TWhereOrSet)(unsafe.Pointer(pDest)).Fn = (*TWhereOrSet)(unsafe.Pointer(pSrc)).Fn + libc.Xmemcpy(tls, pDest+8, pSrc+8, uint64((*TWhereOrSet)(unsafe.Pointer(pDest)).Fn)*uint64(16)) +} + +// C documentation +// +// /* +// ** Try to insert a new prerequisite/cost entry into the WhereOrSet pSet. +// ** +// ** The new entry might overwrite an existing entry, or it might be +// ** appended, or it might be discarded. Do whatever is the right thing +// ** so that pSet keeps the N_OR_COST best entries seen so far. +// */ +func _whereOrInsert(tls *libc.TLS, pSet uintptr, prereq TBitmask, rRun TLogEst, nOut TLogEst) (r int32) { + var i, v2 Tu16 + var p, v3 uintptr + _, _, _, _ = i, p, v2, v3 + i = (*TWhereOrSet)(unsafe.Pointer(pSet)).Fn + p = pSet + 8 + for { + if !(int32(i) > 0) { + break + } + if int32(rRun) <= int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) && prereq&(*TWhereOrCost)(unsafe.Pointer(p)).Fprereq == prereq { + goto whereOrInsert_done + } + if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) && (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq&prereq == (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq { + return 0 + } + goto _1 + _1: + ; + i-- + p += 16 + } + if int32((*TWhereOrSet)(unsafe.Pointer(pSet)).Fn) < int32(N_OR_COST) { + v3 = pSet + v2 = *(*Tu16)(unsafe.Pointer(v3)) + *(*Tu16)(unsafe.Pointer(v3))++ + p = pSet + 8 + uintptr(v2)*16 + (*TWhereOrCost)(unsafe.Pointer(p)).FnOut = nOut + } else { + p = pSet + 8 + i = uint16(1) + for { + if !(int32(i) < int32((*TWhereOrSet)(unsafe.Pointer(pSet)).Fn)) { + break + } + if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) > int32((*(*TWhereOrCost)(unsafe.Pointer(pSet + 8 + uintptr(i)*16))).FrRun) { + p = pSet + 8 + uintptr(i)*16 + } + goto _4 + _4: + ; + i++ + } + if int32((*TWhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun) { + return 0 + } + } +whereOrInsert_done: + ; + (*TWhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq + (*TWhereOrCost)(unsafe.Pointer(p)).FrRun = rRun + if int32((*TWhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut) { + (*TWhereOrCost)(unsafe.Pointer(p)).FnOut = nOut + } + return int32(1) +} + +// C documentation +// +// /* +// ** Return the bitmask for the given cursor number. Return 0 if +// ** iCursor is not in the set. +// */ +func _sqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) (r TBitmask) { + var i int32 + _ = i + if *(*int32)(unsafe.Pointer(pMaskSet + 8)) == iCursor { + return uint64(1) + } + i = int32(1) + for { + if !(i < (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn) { + break + } + if *(*int32)(unsafe.Pointer(pMaskSet + 8 + uintptr(i)*4)) == iCursor { + return libc.Uint64FromInt32(1) << i + } + goto _1 + _1: + ; + i++ + } + return uint64(0) +} + +// C documentation +// +// /* Allocate memory that is automatically freed when pWInfo is freed. +// */ +func _sqlite3WhereMalloc(tls *libc.TLS, pWInfo uintptr, nByte Tu64) (r uintptr) { + var pBlock uintptr + _ = pBlock + pBlock = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb, nByte+uint64(16)) + if pBlock != 0 { + (*TWhereMemBlock)(unsafe.Pointer(pBlock)).FpNext = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree + (*TWhereMemBlock)(unsafe.Pointer(pBlock)).Fsz = nByte + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree = pBlock + pBlock += 16 + } + return pBlock +} + +func _sqlite3WhereRealloc(tls *libc.TLS, pWInfo uintptr, pOld uintptr, nByte Tu64) (r uintptr) { + var pNew, pOldBlk uintptr + _, _ = pNew, pOldBlk + pNew = _sqlite3WhereMalloc(tls, pWInfo, nByte) + if pNew != 0 && pOld != 0 { + pOldBlk = pOld + pOldBlk -= 16 + libc.Xmemcpy(tls, pNew, pOld, (*TWhereMemBlock)(unsafe.Pointer(pOldBlk)).Fsz) + } + return pNew +} + +// C documentation +// +// /* +// ** Create a new mask for cursor iCursor. +// ** +// ** There is one cursor per table in the FROM clause. The number of +// ** tables in the FROM clause is limited by a test early in the +// ** sqlite3WhereBegin() routine. So we know that the pMaskSet->ix[] +// ** array will never overflow. +// */ +func _createMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + v2 = pMaskSet + 4 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*int32)(unsafe.Pointer(pMaskSet + 8 + uintptr(v1)*4)) = iCursor +} + +// C documentation +// +// /* +// ** If the right-hand branch of the expression is a TK_COLUMN, then return +// ** a pointer to the right-hand branch. Otherwise, return NULL. +// */ +func _whereRightSubexprIsColumn(tls *libc.TLS, p uintptr) (r uintptr) { + p = _sqlite3ExprSkipCollateAndLikely(tls, (*TExpr)(unsafe.Pointer(p)).FpRight) + if p != uintptr(0) && int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) && !((*TExpr)(unsafe.Pointer(p)).Fflags&uint32(libc.Int32FromInt32(EP_FixedCol)) != libc.Uint32FromInt32(0)) { + return p + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** Advance to the next WhereTerm that matches according to the criteria +// ** established when the pScan object was initialized by whereScanInit(). +// ** Return NULL if there are no more matching WhereTerms. +// */ +func _whereScanNext(tls *libc.TLS, pScan uintptr) (r uintptr) { + var iColumn Ti16 + var iCur, j, k int32 + var pColl, pParse, pTerm, pWC, pX, v2 uintptr + var v3, v5 bool + _, _, _, _, _, _, _, _, _, _, _, _ = iColumn, iCur, j, k, pColl, pParse, pTerm, pWC, pX, v2, v3, v5 /* The term being tested */ + k = (*TWhereScan)(unsafe.Pointer(pScan)).Fk /* Where to start scanning */ + pWC = (*TWhereScan)(unsafe.Pointer(pScan)).FpWC + for int32(1) != 0 { + iColumn = *(*Ti16)(unsafe.Pointer(pScan + 88 + uintptr(int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv)-int32(1))*2)) + iCur = *(*int32)(unsafe.Pointer(pScan + 44 + uintptr(int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv)-int32(1))*4)) + for cond := true; cond; cond = pWC != uintptr(0) { + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(k)*56 + for { + if !(k < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor == iCur && (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn == int32(iColumn) && (int32(iColumn) != -int32(2) || _sqlite3ExprCompareSkip(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft, (*TWhereScan)(unsafe.Pointer(pScan)).FpIdxExpr, iCur) == 0) && (int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv) <= int32(1) || !((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0))) { + if v3 = int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_EQUIV) != 0 && int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) < int32(libc.Uint64FromInt64(44)/libc.Uint64FromInt64(4)); v3 { + v2 = _whereRightSubexprIsColumn(tls, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr) + pX = v2 + } + if v3 && v2 != uintptr(0) { + j = 0 + for { + if !(j < int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv)) { + break + } + if *(*int32)(unsafe.Pointer(pScan + 44 + uintptr(j)*4)) == (*TExpr)(unsafe.Pointer(pX)).FiTable && int32(*(*Ti16)(unsafe.Pointer(pScan + 88 + uintptr(j)*2))) == int32((*TExpr)(unsafe.Pointer(pX)).FiColumn) { + break + } + goto _4 + _4: + ; + j++ + } + if j == int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { + *(*int32)(unsafe.Pointer(pScan + 44 + uintptr(j)*4)) = (*TExpr)(unsafe.Pointer(pX)).FiTable + *(*Ti16)(unsafe.Pointer(pScan + 88 + uintptr(j)*2)) = (*TExpr)(unsafe.Pointer(pX)).FiColumn + (*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv++ + } + } + if uint32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(*TWhereScan)(unsafe.Pointer(pScan)).FopMask != uint32(0) { + /* Verify the affinity and collating sequence match */ + if (*TWhereScan)(unsafe.Pointer(pScan)).FzCollName != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_ISNULL) == 0 { + pParse = (*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse + pX = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if !(_sqlite3IndexAffinityOk(tls, pX, (*TWhereScan)(unsafe.Pointer(pScan)).Fidxaff) != 0) { + goto _1 + } + pColl = _sqlite3ExprCompareCollSeq(tls, pParse, pX) + if pColl == uintptr(0) { + pColl = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + if _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FzName, (*TWhereScan)(unsafe.Pointer(pScan)).FzCollName) != 0 { + goto _1 + } + } + if v5 = int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0; v5 { + pX = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + } + if v5 && pX != libc.UintptrFromInt32(0) && int32((*TExpr)(unsafe.Pointer(pX)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pX)).FiTable == *(*int32)(unsafe.Pointer(pScan + 44)) && int32((*TExpr)(unsafe.Pointer(pX)).FiColumn) == int32(*(*Ti16)(unsafe.Pointer(pScan + 88))) { + goto _1 + } + (*TWhereScan)(unsafe.Pointer(pScan)).FpWC = pWC + (*TWhereScan)(unsafe.Pointer(pScan)).Fk = k + int32(1) + return pTerm + } + } + goto _1 + _1: + ; + k++ + pTerm += 56 + } + pWC = (*TWhereClause)(unsafe.Pointer(pWC)).FpOuter + k = 0 + } + if int32((*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv) >= int32((*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv) { + break + } + pWC = (*TWhereScan)(unsafe.Pointer(pScan)).FpOrigWC + k = 0 + (*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv++ + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** This is whereScanInit() for the case of an index on an expression. +// ** It is factored out into a separate tail-recursion subroutine so that +// ** the normal whereScanInit() routine, which is a high-runner, does not +// ** need to push registers onto the stack as part of its prologue. +// */ +func _whereScanInitIndexExpr(tls *libc.TLS, pScan uintptr) (r uintptr) { + (*TWhereScan)(unsafe.Pointer(pScan)).Fidxaff = _sqlite3ExprAffinity(tls, (*TWhereScan)(unsafe.Pointer(pScan)).FpIdxExpr) + return _whereScanNext(tls, pScan) +} + +// C documentation +// +// /* +// ** Initialize a WHERE clause scanner object. Return a pointer to the +// ** first match. Return NULL if there are no matches. +// ** +// ** The scanner will be searching the WHERE clause pWC. It will look +// ** for terms of the form "X " where X is column iColumn of table +// ** iCur. Or if pIdx!=0 then X is column iColumn of index pIdx. pIdx +// ** must be one of the indexes of table iCur. +// ** +// ** The must be one of the operators described by opMask. +// ** +// ** If the search is for X and the WHERE clause contains terms of the +// ** form X=Y then this routine might also return terms of the form +// ** "Y ". The number of levels of transitivity is limited, +// ** but is enough to handle most commonly occurring SQL statements. +// ** +// ** If X is not the INTEGER PRIMARY KEY then X must be compatible with +// ** index pIdx. +// */ +func _whereScanInit(tls *libc.TLS, pScan uintptr, pWC uintptr, iCur int32, iColumn int32, opMask Tu32, pIdx uintptr) (r uintptr) { + var j int32 + _ = j + (*TWhereScan)(unsafe.Pointer(pScan)).FpOrigWC = pWC + (*TWhereScan)(unsafe.Pointer(pScan)).FpWC = pWC + (*TWhereScan)(unsafe.Pointer(pScan)).FpIdxExpr = uintptr(0) + (*TWhereScan)(unsafe.Pointer(pScan)).Fidxaff = 0 + (*TWhereScan)(unsafe.Pointer(pScan)).FzCollName = uintptr(0) + (*TWhereScan)(unsafe.Pointer(pScan)).FopMask = opMask + (*TWhereScan)(unsafe.Pointer(pScan)).Fk = 0 + *(*int32)(unsafe.Pointer(pScan + 44)) = iCur + (*TWhereScan)(unsafe.Pointer(pScan)).FnEquiv = uint8(1) + (*TWhereScan)(unsafe.Pointer(pScan)).FiEquiv = uint8(1) + if pIdx != 0 { + j = iColumn + iColumn = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) + if iColumn == int32((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FiPKey) { + iColumn = -int32(1) + } else { + if iColumn >= 0 { + (*TWhereScan)(unsafe.Pointer(pScan)).Fidxaff = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(iColumn)*16))).Faffinity + (*TWhereScan)(unsafe.Pointer(pScan)).FzCollName = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) + } else { + if iColumn == -int32(2) { + (*TWhereScan)(unsafe.Pointer(pScan)).FpIdxExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(j)*32))).FpExpr + (*TWhereScan)(unsafe.Pointer(pScan)).FzCollName = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) + *(*Ti16)(unsafe.Pointer(pScan + 88)) = int16(-libc.Int32FromInt32(2)) + return _whereScanInitIndexExpr(tls, pScan) + } + } + } + } else { + if iColumn == -int32(2) { + return uintptr(0) + } + } + *(*Ti16)(unsafe.Pointer(pScan + 88)) = int16(iColumn) + return _whereScanNext(tls, pScan) +} + +// C documentation +// +// /* +// ** Search for a term in the WHERE clause that is of the form "X " +// ** where X is a reference to the iColumn of table iCur or of index pIdx +// ** if pIdx!=0 and is one of the WO_xx operator codes specified by +// ** the op parameter. Return a pointer to the term. Return 0 if not found. +// ** +// ** If pIdx!=0 then it must be one of the indexes of table iCur. +// ** Search for terms matching the iColumn-th column of pIdx +// ** rather than the iColumn-th column of table iCur. +// ** +// ** The term returned might by Y= if there is another constraint in +// ** the WHERE clause that specifies that X=Y. Any such constraints will be +// ** identified by the WO_EQUIV bit in the pTerm->eOperator field. The +// ** aiCur[]/iaColumn[] arrays hold X and all its equivalents. There are 11 +// ** slots in aiCur[]/aiColumn[] so that means we can look for X plus up to 10 +// ** other equivalent values. Hence a search for X will return if X=A1 +// ** and A1=A2 and A2=A3 and ... and A9=A10 and A10=. +// ** +// ** If there are multiple terms in the WHERE clause of the form "X " +// ** then try for the one with no dependencies on - in other words where +// ** is a constant expression of some kind. Only return entries of +// ** the form "X Y" where Y is a column in another table if no terms of +// ** the form "X " exist. If no terms with a constant RHS +// ** exist, try to return a term that does not use WO_EQUIV. +// */ +func _sqlite3WhereFindTerm(tls *libc.TLS, pWC uintptr, iCur int32, iColumn int32, notReady TBitmask, op Tu32, pIdx uintptr) (r uintptr) { + bp := tls.Alloc(112) + defer tls.Free(112) + var p, pResult uintptr + var _ /* scan at bp+0 */ TWhereScan + _, _ = p, pResult + pResult = uintptr(0) + p = _whereScanInit(tls, bp, pWC, iCur, iColumn, op, pIdx) + op &= uint32(libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IS)) + for p != 0 { + if (*TWhereTerm)(unsafe.Pointer(p)).FprereqRight¬Ready == uint64(0) { + if (*TWhereTerm)(unsafe.Pointer(p)).FprereqRight == uint64(0) && uint32((*TWhereTerm)(unsafe.Pointer(p)).FeOperator)&op != uint32(0) { + return p + } + if pResult == uintptr(0) { + pResult = p + } + } + p = _whereScanNext(tls, bp) + } + return pResult +} + +// C documentation +// +// /* +// ** This function searches pList for an entry that matches the iCol-th column +// ** of index pIdx. +// ** +// ** If such an expression is found, its index in pList->a[] is returned. If +// ** no expression is found, -1 is returned. +// */ +func _findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pIdx uintptr, iCol int32) (r int32) { + var i int32 + var p, pColl, zColl uintptr + _, _, _, _ = i, p, pColl, zColl + zColl = *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(iCol)*8)) + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + p = _sqlite3ExprSkipCollateAndLikely(tls, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) + if p != uintptr(0) && (int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_AGG_COLUMN)) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) == int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2))) && (*TExpr)(unsafe.Pointer(p)).FiTable == iBase { + pColl = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr) + if 0 == _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FzName, zColl) { + return i + } + } + goto _1 + _1: + ; + i++ + } + return -int32(1) +} + +// C documentation +// +// /* +// ** Return TRUE if the iCol-th column of index pIdx is NOT NULL +// */ +func _indexColumnNotNull(tls *libc.TLS, pIdx uintptr, iCol int32) (r int32) { + var j int32 + _ = j + j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2))) + if j >= 0 { + return int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(j)*16 + 8)) & 0xf >> 0)) + } else { + if j == -int32(1) { + return int32(1) + } else { + return 0 /* Assume an indexed expression can always yield a NULL */ + } + } + return r +} + +// C documentation +// +// /* +// ** Return true if the DISTINCT expression-list passed as the third argument +// ** is redundant. +// ** +// ** A DISTINCT list is redundant if any subset of the columns in the +// ** DISTINCT list are collectively unique and individually non-null. +// */ +func _isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC uintptr, pDistinct uintptr) (r int32) { + var i, iBase int32 + var p, pIdx, pTab uintptr + _, _, _, _, _ = i, iBase, p, pIdx, pTab + /* If there is more than one table or sub-select in the FROM clause of + ** this query, then it will not be possible to show that the DISTINCT + ** clause is redundant. */ + if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc != int32(1) { + return 0 + } + iBase = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FiCursor + pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab + /* If any of the expressions is an IPK column on table iBase, then return + ** true. Note: The (p->iTable==iBase) part of this test may be false if the + ** current SELECT is a correlated sub-query. + */ + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pDistinct)).FnExpr) { + break + } + p = _sqlite3ExprSkipCollateAndLikely(tls, (*(*TExprList_item)(unsafe.Pointer(pDistinct + 8 + uintptr(i)*32))).FpExpr) + if p == uintptr(0) { + goto _1 + } + if int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(p)).Fop) != int32(TK_AGG_COLUMN) { + goto _1 + } + if (*TExpr)(unsafe.Pointer(p)).FiTable == iBase && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + /* Loop through all indices on the table, checking each to see if it makes + ** the DISTINCT qualifier redundant. It does so if: + ** + ** 1. The index is itself UNIQUE, and + ** + ** 2. All of the columns in the index are either part of the pDistinct + ** list, or else the WHERE clause contains a term of the form "col=X", + ** where X is a constant value. The collation sequences of the + ** comparison and select-list expressions must match those of the index. + ** + ** 3. All of those index columns for which the WHERE clause does not + ** contain a "col=X" term are subject to a NOT NULL constraint. + */ + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != libc.Int32FromInt32(OE_None)) { + goto _2 + } + if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + goto _2 + } + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + if uintptr(0) == _sqlite3WhereFindTerm(tls, pWC, iBase, i, ^libc.Uint64FromInt32(0), uint32(WO_EQ), pIdx) { + if _findIndexCol(tls, pParse, pDistinct, iBase, pIdx, i) < 0 { + break + } + if _indexColumnNotNull(tls, pIdx, i) == 0 { + break + } + } + goto _3 + _3: + ; + i++ + } + if i == int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { + /* This index implies that the DISTINCT qualifier is redundant. */ + return int32(1) + } + goto _2 + _2: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + return 0 +} + +// C documentation +// +// /* +// ** Estimate the logarithm of the input value to base 2. +// */ +func _estLog(tls *libc.TLS, N TLogEst) (r TLogEst) { + var v1 int32 + _ = v1 + if int32(N) <= int32(10) { + v1 = 0 + } else { + v1 = int32(_sqlite3LogEst(tls, uint64(N))) - int32(33) + } + return int16(v1) +} + +// C documentation +// +// /* +// ** Convert OP_Column opcodes to OP_Copy in previously generated code. +// ** +// ** This routine runs over generated VDBE code and translates OP_Column +// ** opcodes into OP_Copy when the table is being accessed via co-routine +// ** instead of via table lookup. +// ** +// ** If the iAutoidxCur is not zero, then any OP_Rowid instructions on +// ** cursor iTabCur are transformed into OP_Sequence opcode for the +// ** iAutoidxCur cursor, in order to generate unique rowids for the +// ** automatic index being generated. +// */ +func _translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur int32, iRegister int32, iAutoidxCur int32) { + var iEnd int32 + var pOp, v uintptr + _, _, _ = iEnd, pOp, v + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + pOp = _sqlite3VdbeGetOp(tls, v, iStart) + iEnd = _sqlite3VdbeCurrentAddr(tls, v) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } + for { + if !(iStart < iEnd) { + break + } + if (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 != iTabCur { + goto _1 + } + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_Copy) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 + iRegister + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp3 = 0 + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp5 = uint16(2) /* Cause the MEM_Subtype flag to be cleared */ + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Rowid) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_Sequence) + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = iAutoidxCur + } + } + goto _1 + _1: + ; + iStart++ + pOp += 24 + } +} + +/* +** Two routines for printing the content of an sqlite3_index_info +** structure. Used for testing and debugging only. If neither +** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines +** are no-ops. + */ + +// C documentation +// +// /* +// ** We know that pSrc is an operand of an outer join. Return true if +// ** pTerm is a constraint that is compatible with that join. +// ** +// ** pTerm must be EP_OuterON if pSrc is the right operand of an +// ** outer join. pTerm can be either EP_OuterON or EP_InnerON if pSrc +// ** is the left operand of a RIGHT join. +// ** +// ** See https://sqlite.org/forum/forumpost/206d99a16dd9212f +// ** for an example of a WHERE clause constraints that may not be used on +// ** the right table of a RIGHT JOIN because the constraint implies a +// ** not-NULL condition on the left table of the RIGHT JOIN. +// */ +func _constraintCompatibleWithOuterJoin(tls *libc.TLS, pTerm uintptr, pSrc uintptr) (r int32) { + /* By caller */ + if !((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_InnerON)) != libc.Uint32FromInt32(0)) || *(*int32)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + 52)) != (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { + return 0 + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) != 0 && (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)) != uint32(0) { + return 0 + } + return int32(1) +} + +// C documentation +// +// /* +// ** Return TRUE if the WHERE clause term pTerm is of a form where it +// ** could be used with an index to access pSrc, assuming an appropriate +// ** index existed. +// */ +func _termCanDriveIndex(tls *libc.TLS, pTerm uintptr, pSrc uintptr, notReady TBitmask) (r int32) { + var aff int8 + _ = aff + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { + return 0 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) == 0 { + return 0 + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 && !(_constraintCompatibleWithOuterJoin(tls, pTerm, pSrc) != 0) { + return 0 /* See https://sqlite.org/forum/forumpost/51e6959f61 */ + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight¬Ready != uint64(0) { + return 0 + } + if (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn < 0 { + return 0 + } + aff = (*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FaCol + uintptr((*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn)*16))).Faffinity + if !(_sqlite3IndexAffinityOk(tls, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, aff) != 0) { + return 0 + } + return int32(1) +} + +// C documentation +// +// /* +// ** Generate code to construct the Index object for an automatic index +// ** and to set up the WhereLevel object pLevel so that the code generator +// ** makes use of the automatic index. +// */ +func _constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, notReady TBitmask, pLevel uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var addrCounter, addrInit, addrTop, i, iCol, iCol1, iContinue, mxBitCol, n, nKeyCol, regBase, regRecord, regYield, v12, v14, v3, v5 int32 + var cMask, cMask1, extraCols, idxCols TBitmask + var pColl, pExpr, pIdx, pLoop, pPartial, pSrc, pTabList, pTable, pTerm, pWCEnd, pX, v, v13, v15, v9 uintptr + var sentWarning, useBloomFilter Tu8 + var v2, v8 uint64 + var v4 Tu16 + var _ /* zNotUsed at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrCounter, addrInit, addrTop, cMask, cMask1, extraCols, i, iCol, iCol1, iContinue, idxCols, mxBitCol, n, nKeyCol, pColl, pExpr, pIdx, pLoop, pPartial, pSrc, pTabList, pTable, pTerm, pWCEnd, pX, regBase, regRecord, regYield, sentWarning, useBloomFilter, v, v12, v13, v14, v15, v2, v3, v4, v5, v8, v9 /* Bitmap of additional columns */ + sentWarning = uint8(0) /* True if a warning has been issued */ + useBloomFilter = uint8(0) /* True to also add a Bloom filter */ + pPartial = uintptr(0) /* Partial Index Expression */ + iContinue = 0 /* The FROM clause term to get the next index */ + addrCounter = 0 /* Array of registers where record is assembled */ + /* Generate code to skip over the creation and initialization of the + ** transient index on 2nd and subsequent iterations of the loop. */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + addrInit = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + /* Count the number of columns that will be added to the index + ** and used to match WHERE clause constraints */ + nKeyCol = 0 + pTabList = (*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpTabList + pSrc = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + pTable = (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab + pWCEnd = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm)*56 + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + idxCols = uint64(0) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(pTerm < pWCEnd) { + break + } + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + /* Make the automatic index a partial index if there are terms in the + ** WHERE clause (or the ON clause of a LEFT join) that constrain which + ** rows of the target table (pSrc) that can be used. */ + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VIRTUAL) == 0 && _sqlite3ExprIsSingleTableConstraint(tls, pExpr, pTabList, int32((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)) != 0 { + pPartial = _sqlite3ExprAnd(tls, pParse, pPartial, _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0)) + } + if _termCanDriveIndex(tls, pTerm, pSrc, notReady) != 0 { + iCol = (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn + if iCol >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v2 = libc.Uint64FromInt32(1) << (int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1)) + } else { + v2 = libc.Uint64FromInt32(1) << iCol + } + cMask = v2 + if !(sentWarning != 0) { + Xsqlite3_log(tls, libc.Int32FromInt32(SQLITE_WARNING)|libc.Int32FromInt32(1)<= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v8 = libc.Uint64FromInt32(1) << (int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) - libc.Int32FromInt32(1)) + } else { + v8 = libc.Uint64FromInt32(1) << iCol1 + } + cMask1 = v8 + if idxCols&cMask1 == uint64(0) { + pX = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + idxCols |= cMask1 + *(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) = int16((*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn) + pColl = _sqlite3ExprCompareCollSeq(tls, pParse, pX) + /* TH3 collate01.800 */ + if pColl != 0 { + v9 = (*TCollSeq)(unsafe.Pointer(pColl)).FzName + } else { + v9 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(n)*8)) = v9 + n++ + if (*TExpr)(unsafe.Pointer(pX)).FpLeft != uintptr(0) && int32(_sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pX)).FpLeft)) != int32(SQLITE_AFF_TEXT) { + /* TUNING: only use a Bloom filter on an automatic index + ** if one or more key columns has the ability to hold numeric + ** values, since strings all have the same hash in the Bloom + ** filter implementation and hence a Bloom filter on a text column + ** is not usually helpful. */ + useBloomFilter = uint8(1) + } + } + } + goto _7 + _7: + ; + pTerm += 56 + } + /* Add additional columns needed to make the automatic index into + ** a covering index */ + i = 0 + for { + if !(i < mxBitCol) { + break + } + if extraCols&(libc.Uint64FromInt32(1)<>5)) != 0 { + regYield = (*TSrcItem)(unsafe.Pointer(pSrc)).FregReturn + addrCounter = _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, 0) + _sqlite3VdbeAddOp3(tls, v, int32(OP_InitCoroutine), regYield, 0, (*TSrcItem)(unsafe.Pointer(pSrc)).FaddrFillSub) + addrTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Yield), regYield) + } else { + addrTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur) + } + if pPartial != 0 { + iContinue = _sqlite3VdbeMakeLabel(tls, pParse) + _sqlite3ExprIfFalse(tls, pParse, pPartial, iContinue, int32(SQLITE_JUMPIFNULL)) + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_PARTIALIDX) + } + regRecord = _sqlite3GetTempReg(tls, pParse) + regBase = _sqlite3GenerateIndexKey(tls, pParse, pIdx, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, regRecord, 0, uintptr(0), uintptr(0), 0) + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_FilterAdd), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, 0, regBase, int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq)) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxInsert), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, regRecord) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + if pPartial != 0 { + _sqlite3VdbeResolveLabel(tls, v, iContinue) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x20>>5)) != 0 { + _sqlite3VdbeChangeP2(tls, v, addrCounter, regBase+n) + _translateColumnToCopy(tls, pParse, addrTop, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, (*TSrcItem)(unsafe.Pointer(pSrc)).FregResult, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur) + _sqlite3VdbeGoto(tls, v, addrTop) + libc.SetBitFieldPtr16Uint32(pSrc+60+4, libc.Uint32FromInt32(0), 5, 0x20) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, addrTop+int32(1)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_STMTSTATUS_AUTOINDEX)) + } + _sqlite3VdbeJumpHere(tls, v, addrTop) + _sqlite3ReleaseTempReg(tls, pParse, regRecord) + /* Jump here when skipping the initialization */ + _sqlite3VdbeJumpHere(tls, v, addrInit) +end_auto_index_create: + ; + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pPartial) +} + +// C documentation +// +// /* +// ** Generate bytecode that will initialize a Bloom filter that is appropriate +// ** for pLevel. +// ** +// ** If there are inner loops within pLevel that have the WHERE_BLOOMFILTER +// ** flag set, initialize a Bloomfilter for them as well. Except don't do +// ** this recursive initialization if the SQLITE_BloomPulldown optimization has +// ** been turned off. +// ** +// ** When the Bloom filter is initialized, the WHERE_BLOOMFILTER flag is cleared +// ** from the loop, but the regFilter value is set to a register that implements +// ** the Bloom filter. When regFilter is positive, the +// ** sqlite3WhereCodeOneLoopStart() will generate code to test the Bloom filter +// ** and skip the subsequence B-Tree seek if the Bloom filter indicates that +// ** no matching rows exist. +// ** +// ** This routine may only be called if it has previously been determined that +// ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit +// ** is set. +// */ +func _sqlite3ConstructBloomFilter(tls *libc.TLS, pWInfo uintptr, iLevel int32, pLevel uintptr, notReady TBitmask) { + var addrCont, addrOnce, addrTop, iCur, iSrc, jj, n, r1, r11, v1, v5 int32 + var pExpr, pIdx, pItem, pLoop, pParse, pTab, pTabItem, pTabList, pTerm, pWCEnd, saved_pIdxEpr, saved_pIdxPartExpr, v, v2 uintptr + var sz Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrCont, addrOnce, addrTop, iCur, iSrc, jj, n, pExpr, pIdx, pItem, pLoop, pParse, pTab, pTabItem, pTabList, pTerm, pWCEnd, r1, r11, saved_pIdxEpr, saved_pIdxPartExpr, sz, v, v1, v2, v5 /* Last WHERE clause term */ + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parsing context */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* VDBE under construction */ + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop /* saved copy of Parse.pIdxPartExpr */ + saved_pIdxEpr = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + saved_pIdxPartExpr = (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr + (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = uintptr(0) + (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr = uintptr(0) + addrOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + for cond := true; cond; cond = iLevel < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) { + _sqlite3WhereExplainBloomFilter(tls, pParse, pWInfo, pLevel) + addrCont = _sqlite3VdbeMakeLabel(tls, pParse) + iCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter = v1 + /* The Bloom filter is a Blob held in a register. Initialize it + ** to zero-filled blob of at least 80K bits, but maybe more if the + ** estimated size of the table is larger. We could actually + ** measure the size of the table at run-time using OP_Count with + ** P3==1 and use that value to initialize the blob. But that makes + ** testing complicated. By basing the blob size on the value in the + ** sqlite_stat1 table, testing is much easier. + */ + pTabList = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + iSrc = int32((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom) + pItem = pTabList + 8 + uintptr(iSrc)*104 + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + sz = _sqlite3LogEstToInt(tls, (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst) + if sz < uint64(10000) { + sz = uint64(10000) + } else { + if sz > uint64(10000000) { + sz = uint64(10000000) + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Blob), int32(sz), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter) + addrTop = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iCur) + pWCEnd = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.Fa + uintptr((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.FnTerm)*56 + pTerm = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.Fa + for { + if !(pTerm < pWCEnd) { + break + } + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VIRTUAL) == 0 && _sqlite3ExprIsSingleTableConstraint(tls, pExpr, pTabList, iSrc) != 0 { + _sqlite3ExprIfFalse(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr, addrCont, int32(SQLITE_JUMPIFNULL)) + } + goto _3 + _3: + ; + pTerm += 56 + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { + r1 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iCur, r1) + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_FilterAdd), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, 0, r1, int32(1)) + _sqlite3ReleaseTempReg(tls, pParse, r1) + } else { + pIdx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + n = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) + r11 = _sqlite3GetTempRange(tls, pParse, n) + jj = 0 + for { + if !(jj < n) { + break + } + _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iCur, jj, r11+jj) + goto _4 + _4: + ; + jj++ + } + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_FilterAdd), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregFilter, 0, r11, n) + _sqlite3ReleaseTempRange(tls, pParse, r11, n) + } + _sqlite3VdbeResolveLabel(tls, v, addrCont) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, addrTop+int32(1)) + _sqlite3VdbeJumpHere(tls, v, addrTop) + *(*Tu32)(unsafe.Pointer(pLoop + 48)) &= uint32(^libc.Int32FromInt32(WHERE_BLOOMFILTER)) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_BloomPulldown)) != uint32(0) { + break + } + for { + iLevel++ + v5 = iLevel + if !(v5 < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { + break + } + pLevel = pWInfo + 856 + uintptr(iLevel)*104 + pTabItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + if int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) != 0 { + continue + } + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if pLoop == uintptr(0) { + continue + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).Fprereq¬Ready != 0 { + continue + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_BLOOMFILTER)|libc.Int32FromInt32(WHERE_COLUMN_IN)) == uint32(WHERE_BLOOMFILTER) { + /* This is a candidate for bloom-filter pull-down (early evaluation). + ** The test that WHERE_COLUMN_IN is omitted is important, as we are + ** not able to do early evaluation of bloom filters that make use of + ** the IN operator */ + break + } + } + } + _sqlite3VdbeJumpHere(tls, v, addrOnce) + (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = saved_pIdxEpr + (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr = saved_pIdxPartExpr +} + +// C documentation +// +// /* +// ** Allocate and populate an sqlite3_index_info structure. It is the +// ** responsibility of the caller to eventually release the structure +// ** by passing the pointer returned by this function to freeIndexInfo(). +// */ +func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TBitmask, pSrc uintptr, pmNoOmit uintptr) (r uintptr) { + var eDistinct, i, j, n, nOrderBy, nTerm, v12, v2, v9 int32 + var mNoOmit, op Tu16 + var pE2, pExpr, pExpr1, pHidden, pIdxCons, pIdxInfo, pIdxOrderBy, pOrderBy, pParse, pTab, pTerm, pUsage, zColl, v6, p3, p4 uintptr + var v10 uint32 + var v7 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eDistinct, i, j, mNoOmit, n, nOrderBy, nTerm, op, pE2, pExpr, pExpr1, pHidden, pIdxCons, pIdxInfo, pIdxOrderBy, pOrderBy, pParse, pTab, pTerm, pUsage, zColl, v10, v12, v2, v6, v7, v9, p3, p4 + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + mNoOmit = uint16(0) + eDistinct = 0 + pOrderBy = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy + pTab = (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab + /* Find all WHERE clause constraints referring to this virtual table. + ** Mark each term with the TERM_OK flag. Set nTerm to the number of + ** terms found. + */ + v2 = libc.Int32FromInt32(0) + nTerm = v2 + i = v2 + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(i < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + p3 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p3)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p3))) & ^libc.Int32FromInt32(TERM_OK)) + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { + goto _1 + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&mUnusable != 0 { + goto _1 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & ^libc.Int32FromInt32(WO_EQUIV) == 0 { + goto _1 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) != 0 { + goto _1 + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 && !(_constraintCompatibleWithOuterJoin(tls, pTerm, pSrc) != 0) { + goto _1 + } + nTerm++ + p4 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_OK)) + goto _1 + _1: + ; + i++ + pTerm += 56 + } + /* If the ORDER BY clause contains only columns in the current + ** virtual table then allocate space for the aOrderBy part of + ** the sqlite3_index_info structure. + */ + nOrderBy = 0 + if pOrderBy != 0 { + n = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr + i = 0 + for { + if !(i < n) { + break + } + pExpr = (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr + /* Skip over constant terms in the ORDER BY clause */ + if _sqlite3ExprIsConstant(tls, pExpr) != 0 { + goto _5 + } + /* Virtual tables are unable to deal with NULLS FIRST */ + if int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_BIGNULL) != 0 { + break + } + /* First case - a direct column references without a COLLATE operator */ + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { + goto _5 + } + /* 2nd case - a column reference with a COLLATE operator. Only match + ** of the COLLATE operator matches the collation of the column. */ + if v7 = int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLLATE); v7 { + v6 = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft + pE2 = v6 + } + if v7 && int32((*TExpr)(unsafe.Pointer(v6)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pE2)).FiTable == (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor { /* The collating sequence name */ + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = (*TExpr)(unsafe.Pointer(pE2)).FiColumn + if int32((*TExpr)(unsafe.Pointer(pE2)).FiColumn) < 0 { + goto _5 + } /* Collseq does not matter for rowid */ + zColl = _sqlite3ColumnColl(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr((*TExpr)(unsafe.Pointer(pE2)).FiColumn)*16) + if zColl == uintptr(0) { + zColl = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), zColl) == 0 { + goto _5 + } + } + /* No matches cause a break out of the loop */ + break + goto _5 + _5: + ; + i++ + } + if i == n { + nOrderBy = n + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) != 0 { + eDistinct = int32(2) + libc.BoolInt32(int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_SORTBYGROUP) != 0) + } else { + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_GROUPBY) != 0 { + eDistinct = int32(1) + } + } + } + } + /* Allocate the sqlite3_index_info structure + */ + pIdxInfo = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(96)+(libc.Uint64FromInt64(12)+libc.Uint64FromInt64(8))*uint64(nTerm)+uint64(8)*uint64(nOrderBy)+uint64(40)+uint64(8)*uint64(nTerm)) + if pIdxInfo == uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1650, 0) + return uintptr(0) + } + pHidden = pIdxInfo + 1*96 + pIdxCons = pHidden + 32 + uintptr(nTerm)*8 + pIdxOrderBy = pIdxCons + uintptr(nTerm)*12 + pUsage = pIdxOrderBy + uintptr(nOrderBy)*8 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint = pIdxCons + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy = pIdxOrderBy + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage = pUsage + (*THiddenIndexInfo1)(unsafe.Pointer(pHidden)).FpWC = pWC + (*THiddenIndexInfo1)(unsafe.Pointer(pHidden)).FpParse = pParse + (*THiddenIndexInfo1)(unsafe.Pointer(pHidden)).FeDistinct = eDistinct + (*THiddenIndexInfo1)(unsafe.Pointer(pHidden)).FmIn = uint32(0) + v9 = libc.Int32FromInt32(0) + j = v9 + i = v9 + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(i < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_OK) == 0 { + goto _8 + } + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).FiColumn = (*(*struct { + FleftColumn int32 + FiField int32 + })(unsafe.Pointer(pTerm + 32))).FleftColumn + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).FiTermOffset = i + op = uint16(int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & int32(WO_ALL)) + if int32(op) == int32(WO_IN) { + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_SLICE) == 0 { + if j <= int32(31) { + v10 = libc.Uint32FromInt32(1) << j + } else { + v10 = uint32(0) + } + *(*Tu32)(unsafe.Pointer(pHidden + 20)) |= v10 + } + op = uint16(WO_EQ) + } + if int32(op) == int32(WO_AUX) { + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).Fop = (*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp + } else { + if int32(op)&(libc.Int32FromInt32(WO_ISNULL)|libc.Int32FromInt32(WO_IS)) != 0 { + if int32(op) == int32(WO_ISNULL) { + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).Fop = uint8(SQLITE_INDEX_CONSTRAINT_ISNULL) + } else { + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).Fop = uint8(SQLITE_INDEX_CONSTRAINT_IS) + } + } else { + (*(*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12))).Fop = uint8(op) + /* The direct assignment in the previous line is possible only because + ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The + ** following asserts verify this fact. */ + if int32(op)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != 0 && _sqlite3ExprIsVector(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight) != 0 { + if j < int32(16) { + mNoOmit = Tu16(int32(mNoOmit) | libc.Int32FromInt32(1)<idxStr if p->needToFreeIdxStr indicates +// ** that this is required. +// */ +func _vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pVtab uintptr + var rc int32 + _, _ = pVtab, rc + pVtab = (*TVTable)(unsafe.Pointer(_sqlite3GetVTable(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pTab))).FpVtab + (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnSchemaLock++ + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_module)(unsafe.Pointer((*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule)).FxBestIndex})))(tls, pVtab, p) + (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnSchemaLock-- + if rc != SQLITE_OK && rc != int32(SQLITE_CONSTRAINT) { + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) + } else { + if !((*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg != 0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3827, libc.VaList(bp+8, _sqlite3ErrStr(tls, rc))) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+3827, libc.VaList(bp+8, (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + } + } + } + if (*TVTable)(unsafe.Pointer((*(*struct { + FnArg int32 + FazArg uintptr + Fp uintptr + })(unsafe.Pointer(pTab + 64))).Fp)).FbAllSchemas != 0 { + _sqlite3VtabUsesAllSchemas(tls, pParse) + } + Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = uintptr(0) + return rc +} + +// C documentation +// +// /* +// ** Estimate the location of a particular key among all keys in an +// ** index. Store the results in aStat as follows: +// ** +// ** aStat[0] Est. number of rows less than pRec +// ** aStat[1] Est. number of rows equal to pRec +// ** +// ** Return the index of the sample that is the smallest sample that +// ** is greater than or equal to pRec. Note that this index is not an index +// ** into the aSample[] array - it is an index into a virtual set of samples +// ** based on the contents of aSample[] and the number of fields in record +// ** pRec. +// */ +func _whereKeyStats(tls *libc.TLS, pParse uintptr, pIdx uintptr, pRec uintptr, roundUp int32, aStat uintptr) (r int32) { + var aSample uintptr + var i, iCol, iMin, iSamp, iSample, iTest, n, nField, res, v1 int32 + var iGap, iLower, iUpper TtRowcnt + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aSample, i, iCol, iGap, iLower, iMin, iSamp, iSample, iTest, iUpper, n, nField, res, v1 + aSample = (*TIndex)(unsafe.Pointer(pIdx)).FaSample /* Smallest sample larger than or equal to pRec */ + iMin = 0 /* Number of fields in pRec */ + iLower = uint64(0) /* anLt[] + anEq[] of largest sample pRec is > */ + _ = pParse + /* Do a binary search to find the first sample greater than or equal + ** to pRec. If pRec contains a single field, the set of samples to search + ** is simply the aSample[] array. If the samples in aSample[] contain more + ** than one fields, all fields following the first are ignored. + ** + ** If pRec contains N fields, where N is more than one, then as well as the + ** samples in aSample[] (truncated to N fields), the search also has to + ** consider prefixes of those samples. For example, if the set of samples + ** in aSample is: + ** + ** aSample[0] = (a, 5) + ** aSample[1] = (a, 10) + ** aSample[2] = (b, 5) + ** aSample[3] = (c, 100) + ** aSample[4] = (c, 105) + ** + ** Then the search space should ideally be the samples above and the + ** unique prefixes [a], [b] and [c]. But since that is hard to organize, + ** the code actually searches this set: + ** + ** 0: (a) + ** 1: (a, 5) + ** 2: (a, 10) + ** 3: (a, 10) + ** 4: (b) + ** 5: (b, 5) + ** 6: (c) + ** 7: (c, 100) + ** 8: (c, 105) + ** 9: (c, 105) + ** + ** For each sample in the aSample[] array, N samples are present in the + ** effective sample array. In the above, samples 0 and 1 are based on + ** sample aSample[0]. Samples 2 and 3 on aSample[1] etc. + ** + ** Often, sample i of each block of N effective samples has (i+1) fields. + ** Except, each sample may be extended to ensure that it is greater than or + ** equal to the previous sample in the array. For example, in the above, + ** sample 2 is the first sample of a block of N samples, so at first it + ** appears that it should be 1 field in size. However, that would make it + ** smaller than sample 1, so the binary search would not work. As a result, + ** it is extended to two fields. The duplicates that this creates do not + ** cause any problems. + */ + if !((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { + nField = int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + nField = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) + } + if int32((*TUnpackedRecord)(unsafe.Pointer(pRec)).FnField) < nField { + v1 = int32((*TUnpackedRecord)(unsafe.Pointer(pRec)).FnField) + } else { + v1 = nField + } + nField = v1 + iCol = 0 + iSample = (*TIndex)(unsafe.Pointer(pIdx)).FnSample * nField + for cond := true; cond; cond = res != 0 && iMin < iSample { /* Number of fields in test sample */ + iTest = (iMin + iSample) / int32(2) + iSamp = iTest / nField + if iSamp > 0 { + /* The proposed effective sample is a prefix of sample aSample[iSamp]. + ** Specifically, the shortest prefix of at least (1 + iTest%nField) + ** fields that is greater than the previous effective sample. */ + n = iTest%nField + int32(1) + for { + if !(n < nField) { + break + } + if *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp-int32(1))*40))).FanLt + uintptr(n-int32(1))*8)) != *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).FanLt + uintptr(n-int32(1))*8)) { + break + } + goto _2 + _2: + ; + n++ + } + } else { + n = iTest + int32(1) + } + (*TUnpackedRecord)(unsafe.Pointer(pRec)).FnField = uint16(n) + res = _sqlite3VdbeRecordCompare(tls, (*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).Fn, (*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).Fp, pRec) + if res < 0 { + iLower = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).FanLt + uintptr(n-int32(1))*8)) + *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).FanEq + uintptr(n-int32(1))*8)) + iMin = iTest + int32(1) + } else { + if res == 0 && n < nField { + iLower = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(iSamp)*40))).FanLt + uintptr(n-int32(1))*8)) + iMin = iTest + int32(1) + res = -int32(1) + } else { + iSample = iTest + iCol = n - int32(1) + } + } + } + i = iSample / nField + if res == 0 { + /* Record pRec is equal to sample i */ + *(*TtRowcnt)(unsafe.Pointer(aStat)) = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanLt + uintptr(iCol)*8)) + *(*TtRowcnt)(unsafe.Pointer(aStat + 1*8)) = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanEq + uintptr(iCol)*8)) + } else { + if i >= (*TIndex)(unsafe.Pointer(pIdx)).FnSample { + iUpper = (*TIndex)(unsafe.Pointer(pIdx)).FnRowEst0 + } else { + iUpper = *(*TtRowcnt)(unsafe.Pointer((*(*TIndexSample)(unsafe.Pointer(aSample + uintptr(i)*40))).FanLt + uintptr(iCol)*8)) + } + if iLower >= iUpper { + iGap = uint64(0) + } else { + iGap = iUpper - iLower + } + if roundUp != 0 { + iGap = iGap * uint64(2) / uint64(3) + } else { + iGap = iGap / uint64(3) + } + *(*TtRowcnt)(unsafe.Pointer(aStat)) = iLower + iGap + *(*TtRowcnt)(unsafe.Pointer(aStat + 1*8)) = *(*TtRowcnt)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(nField-int32(1))*8)) + } + /* Restore the pRec->nField value before returning. */ + (*TUnpackedRecord)(unsafe.Pointer(pRec)).FnField = uint16(nField) + return i +} + +// C documentation +// +// /* +// ** If it is not NULL, pTerm is a term that provides an upper or lower +// ** bound on a range scan. Without considering pTerm, it is estimated +// ** that the scan will visit nNew rows. This function returns the number +// ** estimated to be visited after taking pTerm into account. +// ** +// ** If the user explicitly specified a likelihood() value for this term, +// ** then the return value is the likelihood multiplied by the number of +// ** input rows. Otherwise, this function assumes that an "IS NOT NULL" term +// ** has a likelihood of 0.50, and any other term a likelihood of 0.25. +// */ +func _whereRangeAdjust(tls *libc.TLS, pTerm uintptr, nNew TLogEst) (r TLogEst) { + var nRet TLogEst + _ = nRet + nRet = nNew + if pTerm != 0 { + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 { + nRet = TLogEst(int32(nRet) + int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb)) + } else { + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) == 0 { + nRet = TLogEst(int32(nRet) - libc.Int32FromInt32(20)) + } + } + } + return nRet +} + +// C documentation +// +// /* +// ** Return the affinity for a single column of an index. +// */ +func _sqlite3IndexColumnAffinity(tls *libc.TLS, db uintptr, pIdx uintptr, iCol int32) (r int8) { + if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { + if _sqlite3IndexAffinityStr(tls, db, pIdx) == uintptr(0) { + return int8(SQLITE_AFF_BLOB) + } + } + return *(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(iCol))) +} + +// C documentation +// +// /* +// ** This function is called to estimate the number of rows visited by a +// ** range-scan on a skip-scan index. For example: +// ** +// ** CREATE INDEX i1 ON t1(a, b, c); +// ** SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?; +// ** +// ** Value pLoop->nOut is currently set to the estimated number of rows +// ** visited for scanning (a=? AND b=?). This function reduces that estimate +// ** by some factor to account for the (c BETWEEN ? AND ?) expression based +// ** on the stat4 data for the index. this scan will be performed multiple +// ** times (once for each (a,b) combination that matches a=?) is dealt with +// ** by the caller. +// ** +// ** It does this by scanning through all stat4 samples, comparing values +// ** extracted from pLower and pUpper with the corresponding column in each +// ** sample. If L and U are the number of samples found to be less than or +// ** equal to the values extracted from pLower and pUpper respectively, and +// ** N is the total number of samples, the pLoop->nOut value is adjusted +// ** as follows: +// ** +// ** nOut = nOut * ( min(U - L, 1) / N ) +// ** +// ** If pLower is NULL, or a value cannot be extracted from the term, L is +// ** set to zero. If pUpper is NULL, or a value cannot be extracted from it, +// ** U is set to N. +// ** +// ** Normally, this function sets *pbDone to 1 before returning. However, +// ** if no value can be extracted from either pLower or pUpper (and so the +// ** estimate of the number of rows delivered remains unchanged), *pbDone +// ** is left as is. +// ** +// ** If an error occurs, an SQLite error code is returned. Otherwise, +// ** SQLITE_OK. +// */ +func _whereRangeSkipScanEst(tls *libc.TLS, pParse uintptr, pLower uintptr, pUpper uintptr, pLoop uintptr, pbDone uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aff Tu8 + var db, p, pColl, p3 uintptr + var i, nAdjust, nDiff, nEq, nLower, nUpper, rc, res, res1, v1 int32 + var _ /* p1 at bp+0 */ uintptr + var _ /* p2 at bp+8 */ uintptr + var _ /* pVal at bp+16 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aff, db, i, nAdjust, nDiff, nEq, nLower, nUpper, p, pColl, rc, res, res1, v1, p3 + p = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + nEq = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + nLower = -int32(1) + nUpper = (*TIndex)(unsafe.Pointer(p)).FnSample + int32(1) + rc = SQLITE_OK + aff = uint8(_sqlite3IndexColumnAffinity(tls, db, p, nEq)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Value extracted from pLower */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Value extracted from pUpper */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) /* Value extracted from record */ + pColl = _sqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FazColl + uintptr(nEq)*8))) + if pLower != 0 { + rc = _sqlite3Stat4ValueFromExpr(tls, pParse, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pLower)).FpExpr)).FpRight, aff, bp) + nLower = 0 + } + if pUpper != 0 && rc == SQLITE_OK { + rc = _sqlite3Stat4ValueFromExpr(tls, pParse, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pUpper)).FpExpr)).FpRight, aff, bp+8) + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + v1 = 0 + } else { + v1 = (*TIndex)(unsafe.Pointer(p)).FnSample + } + nUpper = v1 + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 || *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + i = 0 + for { + if !(rc == SQLITE_OK && i < (*TIndex)(unsafe.Pointer(p)).FnSample) { + break + } + rc = _sqlite3Stat4Column(tls, db, (*(*TIndexSample)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FaSample + uintptr(i)*40))).Fp, (*(*TIndexSample)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FaSample + uintptr(i)*40))).Fn, nEq, bp+16) + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp)) != 0 { + res = _sqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 16)), pColl) + if res >= 0 { + nLower++ + } + } + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + res1 = _sqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp + 16)), pColl) + if res1 >= 0 { + nUpper++ + } + } + goto _2 + _2: + ; + i++ + } + nDiff = nUpper - nLower + if nDiff <= 0 { + nDiff = int32(1) + } + /* If there is both an upper and lower bound specified, and the + ** comparisons indicate that they are close together, use the fallback + ** method (assume that the scan visits 1/64 of the rows) for estimating + ** the number of rows visited. Otherwise, estimate the number of rows + ** using the method described in the header comment for this function. */ + if nDiff != int32(1) || pUpper == uintptr(0) || pLower == uintptr(0) { + nAdjust = int32(_sqlite3LogEst(tls, uint64((*TIndex)(unsafe.Pointer(p)).FnSample))) - int32(_sqlite3LogEst(tls, uint64(nDiff))) + p3 = pLoop + 22 + *(*TLogEst)(unsafe.Pointer(p3)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p3))) - nAdjust) + *(*int32)(unsafe.Pointer(pbDone)) = int32(1) + } + } else { + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + return rc +} + +// C documentation +// +// /* +// ** This function is used to estimate the number of rows that will be visited +// ** by scanning an index for a range of values. The range may have an upper +// ** bound, a lower bound, or both. The WHERE clause terms that set the upper +// ** and lower bounds are represented by pLower and pUpper respectively. For +// ** example, assuming that index p is on t1(a): +// ** +// ** ... FROM t1 WHERE a > ? AND a < ? ... +// ** |_____| |_____| +// ** | | +// ** pLower pUpper +// ** +// ** If either of the upper or lower bound is not present, then NULL is passed in +// ** place of the corresponding WhereTerm. +// ** +// ** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index +// ** column subject to the range constraint. Or, equivalently, the number of +// ** equality constraints optimized by the proposed index scan. For example, +// ** assuming index p is on t1(a, b), and the SQL query is: +// ** +// ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ... +// ** +// ** then nEq is set to 1 (as the range restricted column, b, is the second +// ** left-most column of the index). Or, if the query is: +// ** +// ** ... FROM t1 WHERE a > ? AND a < ? ... +// ** +// ** then nEq is set to 0. +// ** +// ** When this function is called, *pnOut is set to the sqlite3LogEst() of the +// ** number of rows that the index scan is expected to visit without +// ** considering the range constraints. If nEq is 0, then *pnOut is the number of +// ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced) +// ** to account for the range constraints pLower and pUpper. +// ** +// ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be +// ** used, a single range inequality reduces the search space by a factor of 4. +// ** and a pair of constraints (x>? AND x 0 && nEq < (*TIndex)(unsafe.Pointer(p)).FnSampleCol && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + if nEq == (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid { + *(*uintptr)(unsafe.Pointer(bp)) = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec + nBtm = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnBtm) + nTop = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnTop) /* Rows less than the upper bound */ + iLwrIdx = -int32(2) /* aSample[] for the lower bound */ + iUprIdx = -int32(1) /* aSample[] for the upper bound */ + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + (*TUnpackedRecord)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnField = uint16((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid) + } + /* Determine iLower and iUpper using ($P) only. */ + if nEq == 0 { + iLower = uint64(0) + iUpper = (*TIndex)(unsafe.Pointer(p)).FnRowEst0 + } else { + /* Note: this call could be optimized away - since the same values must + ** have been requested when testing key $P in whereEqualScanEst(). */ + _whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp)), 0, bp+8) + iLower = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] + iUpper = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] + (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[int32(1)] + } + if *(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FaSortOrder + uintptr(nEq))) != 0 { + /* The roles of pLower and pUpper are swapped for a DESC index */ + t = pLower + pLower = pUpper + pUpper = t + t1 = nBtm + nBtm = nTop + nTop = t1 + } + /* If possible, improve on the iLower estimate using ($P:$L). */ + if pLower != 0 { /* Values extracted from pExpr */ + pExpr = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pLower)).FpExpr)).FpRight + rc = _sqlite3Stat4ProbeSetValue(tls, pParse, p, bp, pExpr, nBtm, nEq, bp+24) + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 24)) != 0 { + mask = uint16(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) + if _sqlite3ExprVectorSize(tls, pExpr) > *(*int32)(unsafe.Pointer(bp + 24)) { + mask = uint16(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))) + } + iLwrIdx = _whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp)), 0, bp+8) + if int32((*TWhereTerm)(unsafe.Pointer(pLower)).FeOperator)&int32(mask) != 0 { + v1 = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[int32(1)] + } else { + v1 = uint64(0) + } + iNew = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] + v1 + if iNew > iLower { + iLower = iNew + } + nOut-- + pLower = uintptr(0) + } + } + /* If possible, improve on the iUpper estimate using ($P:$U). */ + if pUpper != 0 { /* Values extracted from pExpr */ + pExpr1 = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pUpper)).FpExpr)).FpRight + rc = _sqlite3Stat4ProbeSetValue(tls, pParse, p, bp, pExpr1, nTop, nEq, bp+28) + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 28)) != 0 { + mask1 = uint16(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) + if _sqlite3ExprVectorSize(tls, pExpr1) > *(*int32)(unsafe.Pointer(bp + 28)) { + mask1 = uint16(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ))) + } + iUprIdx = _whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp)), int32(1), bp+8) + if int32((*TWhereTerm)(unsafe.Pointer(pUpper)).FeOperator)&int32(mask1) != 0 { + v2 = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[int32(1)] + } else { + v2 = uint64(0) + } + iNew1 = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[0] + v2 + if iNew1 < iUpper { + iUpper = iNew1 + } + nOut-- + pUpper = uintptr(0) + } + } + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = *(*uintptr)(unsafe.Pointer(bp)) + if rc == SQLITE_OK { + if iUpper > iLower { + nNew = _sqlite3LogEst(tls, iUpper-iLower) + /* TUNING: If both iUpper and iLower are derived from the same + ** sample, then assume they are 4x more selective. This brings + ** the estimated selectivity more in line with what it would be + ** if estimated without the use of STAT4 tables. */ + if iLwrIdx == iUprIdx { + nNew = TLogEst(int32(nNew) - libc.Int32FromInt32(20)) + } + } else { + nNew = int16(10) + } + if int32(nNew) < nOut { + nOut = int32(nNew) + } + } + } else { + *(*int32)(unsafe.Pointer(bp + 32)) = 0 + rc = _whereRangeSkipScanEst(tls, pParse, pLower, pUpper, pLoop, bp+32) + if *(*int32)(unsafe.Pointer(bp + 32)) != 0 { + return rc + } + } + } + nNew = _whereRangeAdjust(tls, pLower, int16(nOut)) + nNew = _whereRangeAdjust(tls, pUpper, nNew) + /* TUNING: If there is both an upper and lower limit and neither limit + ** has an application-defined likelihood(), assume the range is + ** reduced by an additional 75%. This means that, by default, an open-ended + ** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the + ** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to + ** match 1/64 of the index. */ + if pLower != 0 && int32((*TWhereTerm)(unsafe.Pointer(pLower)).FtruthProb) > 0 && pUpper != 0 && int32((*TWhereTerm)(unsafe.Pointer(pUpper)).FtruthProb) > 0 { + nNew = TLogEst(int32(nNew) - libc.Int32FromInt32(20)) + } + nOut -= libc.BoolInt32(pLower != uintptr(0)) + libc.BoolInt32(pUpper != uintptr(0)) + if int32(nNew) < int32(10) { + nNew = int16(10) + } + if int32(nNew) < nOut { + nOut = int32(nNew) + } + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut = int16(nOut) + return rc +} + +// C documentation +// +// /* +// ** Estimate the number of rows that will be returned based on +// ** an equality constraint x=VALUE and where that VALUE occurs in +// ** the histogram data. This only works when x is the left-most +// ** column of an index and sqlite_stat4 histogram data is available +// ** for that index. When pExpr==NULL that means the constraint is +// ** "x IS NULL" instead of "x=VALUE". +// ** +// ** Write the estimated row count into *pnRow and return SQLITE_OK. +// ** If unable to make an estimate, leave *pnRow unchanged and return +// ** non-zero. +// ** +// ** This routine can fail if it is unable to load a collating sequence +// ** required for string comparison, or if unable to allocate memory +// ** for a UTF conversion required for comparison. The error is stored +// ** in the pParse structure. +// */ +func _whereEqualScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pExpr uintptr, pnRow uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var nEq, rc int32 + var p uintptr + var _ /* a at bp+8 */ [2]TtRowcnt + var _ /* bOk at bp+24 */ int32 + var _ /* pRec at bp+0 */ uintptr + _, _, _ = nEq, p, rc + p = (*TWhereLoop)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew)).Fu.Fbtree.FpIndex + nEq = int32((*TWhereLoop)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew)).Fu.Fbtree.FnEq) + *(*uintptr)(unsafe.Pointer(bp)) = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec + /* If values are not available for all fields of the index to the left + ** of this one, no estimate can be made. Return SQLITE_NOTFOUND. */ + if (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid < nEq-int32(1) { + return int32(SQLITE_NOTFOUND) + } + /* This is an optimization only. The call to sqlite3Stat4ProbeSetValue() + ** below would return the same value. */ + if nEq >= int32((*TIndex)(unsafe.Pointer(p)).FnColumn) { + *(*TtRowcnt)(unsafe.Pointer(pnRow)) = uint64(1) + return SQLITE_OK + } + rc = _sqlite3Stat4ProbeSetValue(tls, pParse, p, bp, pExpr, int32(1), nEq-int32(1), bp+24) + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = *(*uintptr)(unsafe.Pointer(bp)) + if rc != SQLITE_OK { + return rc + } + if *(*int32)(unsafe.Pointer(bp + 24)) == 0 { + return int32(SQLITE_NOTFOUND) + } + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nEq + _whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp)), 0, bp+8) + *(*TtRowcnt)(unsafe.Pointer(pnRow)) = (*(*[2]TtRowcnt)(unsafe.Pointer(bp + 8)))[int32(1)] + return rc +} + +// C documentation +// +// /* +// ** Estimate the number of rows that will be returned based on +// ** an IN constraint where the right-hand side of the IN operator +// ** is a list of values. Example: +// ** +// ** WHERE x IN (1,2,3,4) +// ** +// ** Write the estimated row count into *pnRow and return SQLITE_OK. +// ** If unable to make an estimate, leave *pnRow unchanged and return +// ** non-zero. +// ** +// ** This routine can fail if it is unable to load a collating sequence +// ** required for string comparison, or if unable to allocate memory +// ** for a UTF conversion required for comparison. The error is stored +// ** in the pParse structure. +// */ +func _whereInScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pList uintptr, pnRow uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, nRecValid, rc int32 + var nRow0 Ti64 + var nRowEst TtRowcnt + var p uintptr + var _ /* nEst at bp+0 */ TtRowcnt + _, _, _, _, _, _ = i, nRecValid, nRow0, nRowEst, p, rc + p = (*TWhereLoop)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew)).Fu.Fbtree.FpIndex + nRow0 = int64(_sqlite3LogEstToInt(tls, *(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(p)).FaiRowLogEst)))) + nRecValid = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid + rc = SQLITE_OK /* Number of rows for a single term */ + nRowEst = uint64(0) /* Loop counter */ + i = 0 + for { + if !(rc == SQLITE_OK && i < (*TExprList)(unsafe.Pointer(pList)).FnExpr) { + break + } + *(*TtRowcnt)(unsafe.Pointer(bp)) = uint64(nRow0) + rc = _whereEqualScanEst(tls, pParse, pBuilder, (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(i)*32))).FpExpr, bp) + nRowEst += *(*TtRowcnt)(unsafe.Pointer(bp)) + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid + goto _1 + _1: + ; + i++ + } + if rc == SQLITE_OK { + if nRowEst > uint64(nRow0) { + nRowEst = uint64(nRow0) + } + *(*TtRowcnt)(unsafe.Pointer(pnRow)) = nRowEst + } + return rc +} + +// C documentation +// +// /* +// ** Convert bulk memory into a valid WhereLoop that can be passed +// ** to whereLoopClear harmlessly. +// */ +func _whereLoopInit(tls *libc.TLS, p uintptr) { + (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm = p + 80 + (*TWhereLoop)(unsafe.Pointer(p)).FnLTerm = uint16(0) + (*TWhereLoop)(unsafe.Pointer(p)).FnLSlot = uint16(int32(libc.Uint64FromInt64(24) / libc.Uint64FromInt64(8))) + (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags = uint32(0) +} + +// C documentation +// +// /* +// ** Clear the WhereLoop.u union. Leave WhereLoop.pLTerm intact. +// */ +func _whereLoopClearUnion(tls *libc.TLS, db uintptr, p uintptr) { + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_VIRTUALTABLE)|libc.Int32FromInt32(WHERE_AUTO_INDEX)) != 0 { + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(WHERE_VIRTUALTABLE) != uint32(0) && int32(Tu32(*(*uint8)(unsafe.Pointer(p + 24 + 4))&0x1>>0)) != 0 { + Xsqlite3_free(tls, (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(p + 24))).FidxStr) + libc.SetBitFieldPtr8Uint32(p+24+4, libc.Uint32FromInt32(0), 0, 0x1) + (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(p + 24))).FidxStr = uintptr(0) + } else { + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(WHERE_AUTO_INDEX) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex != uintptr(0) { + _sqlite3DbFree(tls, db, (*TIndex)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex)).FzColAff) + _sqlite3DbFreeNN(tls, db, (*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex) + (*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex = uintptr(0) + } + } + } +} + +// C documentation +// +// /* +// ** Deallocate internal memory used by a WhereLoop object. Leave the +// ** object in an initialized state, as if it had been newly allocated. +// */ +func _whereLoopClear(tls *libc.TLS, db uintptr, p uintptr) { + if (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm != p+80 { + _sqlite3DbFreeNN(tls, db, (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm) + (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm = p + 80 + (*TWhereLoop)(unsafe.Pointer(p)).FnLSlot = uint16(int32(libc.Uint64FromInt64(24) / libc.Uint64FromInt64(8))) + } + _whereLoopClearUnion(tls, db, p) + (*TWhereLoop)(unsafe.Pointer(p)).FnLTerm = uint16(0) + (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags = uint32(0) +} + +// C documentation +// +// /* +// ** Increase the memory allocation for pLoop->aLTerm[] to be at least n. +// */ +func _whereLoopResize(tls *libc.TLS, db uintptr, p uintptr, n int32) (r int32) { + var paNew uintptr + _ = paNew + if int32((*TWhereLoop)(unsafe.Pointer(p)).FnLSlot) >= n { + return SQLITE_OK + } + n = (n + int32(7)) & ^libc.Int32FromInt32(7) + paNew = _sqlite3DbMallocRawNN(tls, db, uint64(8)*uint64(n)) + if paNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, paNew, (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm, uint64(8)*uint64((*TWhereLoop)(unsafe.Pointer(p)).FnLSlot)) + if (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm != p+80 { + _sqlite3DbFreeNN(tls, db, (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm) + } + (*TWhereLoop)(unsafe.Pointer(p)).FaLTerm = paNew + (*TWhereLoop)(unsafe.Pointer(p)).FnLSlot = uint16(n) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Transfer content from the second pLoop into the first. +// */ +func _whereLoopXfer(tls *libc.TLS, db uintptr, pTo uintptr, pFrom uintptr) (r int32) { + _whereLoopClearUnion(tls, db, pTo) + if int32((*TWhereLoop)(unsafe.Pointer(pFrom)).FnLTerm) > int32((*TWhereLoop)(unsafe.Pointer(pTo)).FnLSlot) && _whereLoopResize(tls, db, pTo, int32((*TWhereLoop)(unsafe.Pointer(pFrom)).FnLTerm)) != 0 { + libc.Xmemset(tls, pTo, 0, uint64(libc.UintptrFromInt32(0)+56)) + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, pTo, pFrom, uint64(libc.UintptrFromInt32(0)+56)) + libc.Xmemcpy(tls, (*TWhereLoop)(unsafe.Pointer(pTo)).FaLTerm, (*TWhereLoop)(unsafe.Pointer(pFrom)).FaLTerm, uint64((*TWhereLoop)(unsafe.Pointer(pTo)).FnLTerm)*uint64(8)) + if (*TWhereLoop)(unsafe.Pointer(pFrom)).FwsFlags&uint32(WHERE_VIRTUALTABLE) != 0 { + libc.SetBitFieldPtr8Uint32(pFrom+24+4, libc.Uint32FromInt32(0), 0, 0x1) + } else { + if (*TWhereLoop)(unsafe.Pointer(pFrom)).FwsFlags&uint32(WHERE_AUTO_INDEX) != uint32(0) { + (*TWhereLoop)(unsafe.Pointer(pFrom)).Fu.Fbtree.FpIndex = uintptr(0) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Delete a WhereLoop object +// */ +func _whereLoopDelete(tls *libc.TLS, db uintptr, p uintptr) { + _whereLoopClear(tls, db, p) + _sqlite3DbNNFreeNN(tls, db, p) +} + +// C documentation +// +// /* +// ** Free a WhereInfo structure +// */ +func _whereInfoFree(tls *libc.TLS, db uintptr, pWInfo uintptr) { + var p, pNext uintptr + _, _ = p, pNext + _sqlite3WhereClauseClear(tls, pWInfo+104) + for (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops != 0 { + p = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops = (*TWhereLoop)(unsafe.Pointer(p)).FpNextLoop + _whereLoopDelete(tls, db, p) + } + for (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree != 0 { + pNext = (*TWhereMemBlock)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree)).FpNext + _sqlite3DbNNFreeNN(tls, db, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpMemToFree = pNext + } + _sqlite3DbNNFreeNN(tls, db, pWInfo) +} + +// C documentation +// +// /* +// ** Return TRUE if X is a proper subset of Y but is of equal or less cost. +// ** In other words, return true if all constraints of X are also part of Y +// ** and Y has additional constraints that might speed the search that X lacks +// ** but the cost of running X is not more than the cost of running Y. +// ** +// ** In other words, return true if the cost relationwship between X and Y +// ** is inverted and needs to be adjusted. +// ** +// ** Case 1: +// ** +// ** (1a) X and Y use the same index. +// ** (1b) X has fewer == terms than Y +// ** (1c) Neither X nor Y use skip-scan +// ** (1d) X does not have a a greater cost than Y +// ** +// ** Case 2: +// ** +// ** (2a) X has the same or lower cost, or returns the same or fewer rows, +// ** than Y. +// ** (2b) X uses fewer WHERE clause terms than Y +// ** (2c) Every WHERE clause term used by X is also used by Y +// ** (2d) X skips at least as many columns as Y +// ** (2e) If X is a covering index, than Y is too +// */ +func _whereLoopCheaperProperSubset(tls *libc.TLS, pX uintptr, pY uintptr) (r int32) { + var i, j int32 + _, _ = i, j + if int32((*TWhereLoop)(unsafe.Pointer(pX)).FrRun) > int32((*TWhereLoop)(unsafe.Pointer(pY)).FrRun) && int32((*TWhereLoop)(unsafe.Pointer(pX)).FnOut) > int32((*TWhereLoop)(unsafe.Pointer(pY)).FnOut) { + return 0 + } /* (1d) and (2a) */ + if int32((*TWhereLoop)(unsafe.Pointer(pX)).Fu.Fbtree.FnEq) < int32((*TWhereLoop)(unsafe.Pointer(pY)).Fu.Fbtree.FnEq) && (*TWhereLoop)(unsafe.Pointer(pX)).Fu.Fbtree.FpIndex == (*TWhereLoop)(unsafe.Pointer(pY)).Fu.Fbtree.FpIndex && int32((*TWhereLoop)(unsafe.Pointer(pX)).FnSkip) == 0 && int32((*TWhereLoop)(unsafe.Pointer(pY)).FnSkip) == 0 { + return int32(1) /* Case 1 is true */ + } + if int32((*TWhereLoop)(unsafe.Pointer(pX)).FnLTerm)-int32((*TWhereLoop)(unsafe.Pointer(pX)).FnSkip) >= int32((*TWhereLoop)(unsafe.Pointer(pY)).FnLTerm)-int32((*TWhereLoop)(unsafe.Pointer(pY)).FnSkip) { + return 0 /* (2b) */ + } + if int32((*TWhereLoop)(unsafe.Pointer(pY)).FnSkip) > int32((*TWhereLoop)(unsafe.Pointer(pX)).FnSkip) { + return 0 + } /* (2d) */ + i = int32((*TWhereLoop)(unsafe.Pointer(pX)).FnLTerm) - int32(1) + for { + if !(i >= 0) { + break + } + if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pX)).FaLTerm + uintptr(i)*8)) == uintptr(0) { + goto _1 + } + j = int32((*TWhereLoop)(unsafe.Pointer(pY)).FnLTerm) - int32(1) + for { + if !(j >= 0) { + break + } + if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pY)).FaLTerm + uintptr(j)*8)) == *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pX)).FaLTerm + uintptr(i)*8)) { + break + } + goto _2 + _2: + ; + j-- + } + if j < 0 { + return 0 + } /* (2c) */ + goto _1 + _1: + ; + i-- + } + if (*TWhereLoop)(unsafe.Pointer(pX)).FwsFlags&uint32(WHERE_IDX_ONLY) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pY)).FwsFlags&uint32(WHERE_IDX_ONLY) == uint32(0) { + return 0 /* (2e) */ + } + return int32(1) /* Case 2 is true */ +} + +// C documentation +// +// /* +// ** Try to adjust the cost and number of output rows of WhereLoop pTemplate +// ** upwards or downwards so that: +// ** +// ** (1) pTemplate costs less than any other WhereLoops that are a proper +// ** subset of pTemplate +// ** +// ** (2) pTemplate costs more than any other WhereLoops for which pTemplate +// ** is a proper subset. +// ** +// ** To say "WhereLoop X is a proper subset of Y" means that X uses fewer +// ** WHERE clause terms than Y and that every WHERE clause term used by X is +// ** also used by Y. +// */ +func _whereLoopAdjustCost(tls *libc.TLS, p uintptr, pTemplate uintptr) { + var v2, v3, v4, v5 int32 + _, _, _, _ = v2, v3, v4, v5 + if (*TWhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags&uint32(WHERE_INDEXED) == uint32(0) { + return + } + for { + if !(p != 0) { + break + } + if int32((*TWhereLoop)(unsafe.Pointer(p)).FiTab) != int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FiTab) { + goto _1 + } + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(WHERE_INDEXED) == uint32(0) { + goto _1 + } + if _whereLoopCheaperProperSubset(tls, p, pTemplate) != 0 { + /* Adjust pTemplate cost downward so that it is cheaper than its + ** subset p. */ + if int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) < int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) { + v2 = int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) + } else { + v2 = int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) + } + (*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun = int16(v2) + if int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut)-int32(1) < int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) { + v3 = int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut) - int32(1) + } else { + v3 = int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) + } + (*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut = int16(v3) + } else { + if _whereLoopCheaperProperSubset(tls, pTemplate, p) != 0 { + /* Adjust pTemplate cost upward so that it is costlier than p since + ** pTemplate is a proper subset of p */ + if int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) > int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) { + v4 = int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) + } else { + v4 = int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) + } + (*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun = int16(v4) + if int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut)+int32(1) > int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) { + v5 = int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut) + int32(1) + } else { + v5 = int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) + } + (*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut = int16(v5) + } + } + goto _1 + _1: + ; + p = (*TWhereLoop)(unsafe.Pointer(p)).FpNextLoop + } +} + +// C documentation +// +// /* +// ** Search the list of WhereLoops in *ppPrev looking for one that can be +// ** replaced by pTemplate. +// ** +// ** Return NULL if pTemplate does not belong on the WhereLoop list. +// ** In other words if pTemplate ought to be dropped from further consideration. +// ** +// ** If pX is a WhereLoop that pTemplate can replace, then return the +// ** link that points to pX. +// ** +// ** If pTemplate cannot replace any existing element of the list but needs +// ** to be added to the list as a new entry, then return a pointer to the +// ** tail of the list. +// */ +func _whereLoopFindLesser(tls *libc.TLS, ppPrev uintptr, pTemplate uintptr) (r uintptr) { + var p uintptr + _ = p + p = *(*uintptr)(unsafe.Pointer(ppPrev)) + for { + if !(p != 0) { + break + } + if int32((*TWhereLoop)(unsafe.Pointer(p)).FiTab) != int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FiTab) || int32((*TWhereLoop)(unsafe.Pointer(p)).FiSortIdx) != int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FiSortIdx) { + /* If either the iTab or iSortIdx values for two WhereLoop are different + ** then those WhereLoops need to be considered separately. Neither is + ** a candidate to replace the other. */ + goto _1 + } + /* In the current implementation, the rSetup value is either zero + ** or the cost of building an automatic index (NlogN) and the NlogN + ** is the same for compatible WhereLoops. */ + /* whereLoopAddBtree() always generates and inserts the automatic index + ** case first. Hence compatible candidate WhereLoops never have a larger + ** rSetup. Call this SETUP-INVARIANT */ + /* Any loop using an application-defined index (or PRIMARY KEY or + ** UNIQUE constraint) with one or more == constraints is better + ** than an automatic index. Unless it is a skip-scan. */ + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(WHERE_AUTO_INDEX) != uint32(0) && int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnSkip) == 0 && (*TWhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags&uint32(WHERE_INDEXED) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags&uint32(WHERE_COLUMN_EQ) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(p)).Fprereq&(*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq == (*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq { + break + } + /* If existing WhereLoop p is better than pTemplate, pTemplate can be + ** discarded. WhereLoop p is better if: + ** (1) p has no more dependencies than pTemplate, and + ** (2) p has an equal or lower cost than pTemplate + */ + if (*TWhereLoop)(unsafe.Pointer(p)).Fprereq&(*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq == (*TWhereLoop)(unsafe.Pointer(p)).Fprereq && int32((*TWhereLoop)(unsafe.Pointer(p)).FrSetup) <= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrSetup) && int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) <= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) && int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut) <= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) { + return uintptr(0) /* Discard pTemplate */ + } + /* If pTemplate is always better than p, then cause p to be overwritten + ** with pTemplate. pTemplate is better than p if: + ** (1) pTemplate has no more dependencies than p, and + ** (2) pTemplate has an equal or lower cost than p. + */ + if (*TWhereLoop)(unsafe.Pointer(p)).Fprereq&(*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq == (*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq && int32((*TWhereLoop)(unsafe.Pointer(p)).FrRun) >= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun) && int32((*TWhereLoop)(unsafe.Pointer(p)).FnOut) >= int32((*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) { + /* SETUP-INVARIANT above */ + break /* Cause p to be overwritten by pTemplate */ + } + goto _1 + _1: + ; + ppPrev = p + 72 + p = *(*uintptr)(unsafe.Pointer(ppPrev)) + } + return ppPrev +} + +// C documentation +// +// /* +// ** Insert or replace a WhereLoop entry using the template supplied. +// ** +// ** An existing WhereLoop entry might be overwritten if the new template +// ** is better and has fewer dependencies. Or the template will be ignored +// ** and no insert will occur if an existing WhereLoop is faster and has +// ** fewer dependencies than the template. Otherwise a new WhereLoop is +// ** added based on the template. +// ** +// ** If pBuilder->pOrSet is not NULL then we care about only the +// ** prerequisites and rRun and nOut costs of the N best loops. That +// ** information is gathered in the pBuilder->pOrSet object. This special +// ** processing mode is used only for OR clause processing. +// ** +// ** When accumulating multiple loops (when pBuilder->pOrSet is NULL) we +// ** still might overwrite similar loops with the new template if the +// ** new template is better. Loops may be overwritten if the following +// ** conditions are met: +// ** +// ** (1) They have the same iTab. +// ** (2) They have the same iSortIdx. +// ** (3) The template has same or fewer dependencies than the current loop +// ** (4) The template has the same or lower cost than the current loop +// */ +func _whereLoopInsert(tls *libc.TLS, pBuilder uintptr, pTemplate uintptr) (r int32) { + var db, p, pIndex, pToDel, pWInfo, ppPrev, ppTail, v1 uintptr + var rc int32 + _, _, _, _, _, _, _, _, _ = db, p, pIndex, pToDel, pWInfo, ppPrev, ppTail, rc, v1 + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb + /* Stop the search once we hit the query planner search limit */ + if (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit == uint32(0) { + if (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet != 0 { + (*TWhereOrSet)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet)).Fn = uint16(0) + } + return int32(SQLITE_DONE) + } + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit-- + _whereLoopAdjustCost(tls, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops, pTemplate) + /* If pBuilder->pOrSet is defined, then only keep track of the costs + ** and prereqs. + */ + if (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet != uintptr(0) { + if (*TWhereLoop)(unsafe.Pointer(pTemplate)).FnLTerm != 0 { + _whereOrInsert(tls, (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet, (*TWhereLoop)(unsafe.Pointer(pTemplate)).Fprereq, (*TWhereLoop)(unsafe.Pointer(pTemplate)).FrRun, (*TWhereLoop)(unsafe.Pointer(pTemplate)).FnOut) + } + return SQLITE_OK + } + /* Look for an existing WhereLoop to replace with pTemplate + */ + ppPrev = _whereLoopFindLesser(tls, pWInfo+80, pTemplate) + if ppPrev == uintptr(0) { + /* There already exists a WhereLoop on the list that is better + ** than pTemplate, so just ignore pTemplate */ + return SQLITE_OK + } else { + p = *(*uintptr)(unsafe.Pointer(ppPrev)) + } + /* If we reach this point it means that either p[] should be overwritten + ** with pTemplate[] if p[] exists, or if p==NULL then allocate a new + ** WhereLoop and insert it. + */ + if p == uintptr(0) { + /* Allocate a new WhereLoop to add to the end of the list */ + v1 = _sqlite3DbMallocRawNN(tls, db, uint64(104)) + p = v1 + *(*uintptr)(unsafe.Pointer(ppPrev)) = v1 + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + _whereLoopInit(tls, p) + (*TWhereLoop)(unsafe.Pointer(p)).FpNextLoop = uintptr(0) + } else { + /* We will be overwriting WhereLoop p[]. But before we do, first + ** go through the rest of the list and delete any other entries besides + ** p[] that are also supplanted by pTemplate */ + ppTail = p + 72 + for *(*uintptr)(unsafe.Pointer(ppTail)) != 0 { + ppTail = _whereLoopFindLesser(tls, ppTail, pTemplate) + if ppTail == uintptr(0) { + break + } + pToDel = *(*uintptr)(unsafe.Pointer(ppTail)) + if pToDel == uintptr(0) { + break + } + *(*uintptr)(unsafe.Pointer(ppTail)) = (*TWhereLoop)(unsafe.Pointer(pToDel)).FpNextLoop + _whereLoopDelete(tls, db, pToDel) + } + } + rc = _whereLoopXfer(tls, db, p, pTemplate) + if (*TWhereLoop)(unsafe.Pointer(p)).FwsFlags&uint32(WHERE_VIRTUALTABLE) == uint32(0) { + pIndex = (*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex + if pIndex != 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_IPK) { + (*TWhereLoop)(unsafe.Pointer(p)).Fu.Fbtree.FpIndex = uintptr(0) + } + } + return rc +} + +// C documentation +// +// /* +// ** Adjust the WhereLoop.nOut value downward to account for terms of the +// ** WHERE clause that reference the loop but which are not used by an +// ** index. +// * +// ** For every WHERE clause term that is not used by the index +// ** and which has a truth probability assigned by one of the likelihood(), +// ** likely(), or unlikely() SQL functions, reduce the estimated number +// ** of output rows by the probability specified. +// ** +// ** TUNING: For every WHERE clause term that is not used by the index +// ** and which does not have an assigned truth probability, heuristics +// ** described below are used to try to estimate the truth probability. +// ** TODO --> Perhaps this is something that could be improved by better +// ** table statistics. +// ** +// ** Heuristic 1: Estimate the truth probability as 93.75%. The 93.75% +// ** value corresponds to -1 in LogEst notation, so this means decrement +// ** the WhereLoop.nOut field for every such WHERE clause term. +// ** +// ** Heuristic 2: If there exists one or more WHERE clause terms of the +// ** form "x==EXPR" and EXPR is not a constant 0 or 1, then make sure the +// ** final output row estimate is no greater than 1/4 of the total number +// ** of rows in the table. In other words, assume that x==EXPR will filter +// ** out at least 3 out of 4 rows. If EXPR is -1 or 0 or 1, then maybe the +// ** "x" column is boolean or else -1 or 0 or 1 is a common default value +// ** on the "x" column and so in that case only cap the output row estimate +// ** at 1/2 instead of 1/4. +// */ +func _whereLoopOutputAdjust(tls *libc.TLS, pWC uintptr, pLoop uintptr, nRow TLogEst) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, j int32 + var iReduce TLogEst + var notAllowed TBitmask + var pRight, pTerm, pX, p3, p4 uintptr + var _ /* k at bp+0 */ int32 + _, _, _, _, _, _, _, _, _ = i, iReduce, j, notAllowed, pRight, pTerm, pX, p3, p4 + notAllowed = ^((*TWhereLoop)(unsafe.Pointer(pLoop)).Fprereq | (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) + iReduce = 0 /* pLoop->nOut should not exceed nRow-iReduce */ + i = (*TWhereClause)(unsafe.Pointer(pWC)).FnBase + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(i > 0) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll¬Allowed != uint64(0) { + goto _1 + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf == uint64(0) { + goto _1 + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VIRTUAL) != 0 { + goto _1 + } + j = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) - int32(1) + for { + if !(j >= 0) { + break + } + pX = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if pX == uintptr(0) { + goto _2 + } + if pX == pTerm { + break + } + if (*TWhereTerm)(unsafe.Pointer(pX)).FiParent >= 0 && (*TWhereClause)(unsafe.Pointer(pWC)).Fa+uintptr((*TWhereTerm)(unsafe.Pointer(pX)).FiParent)*56 == pTerm { + break + } + goto _2 + _2: + ; + j-- + } + if j < 0 { + _sqlite3ProgressCheck(tls, (*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse) + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf == (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll { + /* If there are extra terms in the WHERE clause not used by an index + ** that depend only on the table being scanned, and that will tend to + ** cause many rows to be omitted, then mark that table as + ** "self-culling". + ** + ** 2022-03-24: Self-culling only applies if either the extra terms + ** are straight comparison operators that are non-true with NULL + ** operand, or if the loop is not an OUTER JOIN. + */ + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(0x3f) != 0 || int32((*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pLoop)).FiTab)*104))).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) == 0 { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_SELFCULL) + } + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 { + /* If a truth probability is specified using the likelihood() hints, + ** then use the probability provided by the application. */ + p3 = pLoop + 22 + *(*TLogEst)(unsafe.Pointer(p3)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p3))) + int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb)) + } else { + /* In the absence of explicit truth probabilities, use heuristics to + ** guess a reasonable truth probability. */ + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut-- + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_HIGHTRUTH) == 0 { + pRight = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + *(*int32)(unsafe.Pointer(bp)) = 0 + if _sqlite3ExprIsInteger(tls, pRight, bp) != 0 && *(*int32)(unsafe.Pointer(bp)) >= -int32(1) && *(*int32)(unsafe.Pointer(bp)) <= int32(1) { + *(*int32)(unsafe.Pointer(bp)) = int32(10) + } else { + *(*int32)(unsafe.Pointer(bp)) = int32(20) + } + if int32(iReduce) < *(*int32)(unsafe.Pointer(bp)) { + p4 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_HEURTRUTH)) + iReduce = int16(*(*int32)(unsafe.Pointer(bp))) + } + } + } + } + goto _1 + _1: + ; + i-- + pTerm += 56 + } + if int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut) > int32(nRow)-int32(iReduce) { + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut = int16(int32(nRow) - int32(iReduce)) + } +} + +// C documentation +// +// /* +// ** Term pTerm is a vector range comparison operation. The first comparison +// ** in the vector can be optimized using column nEq of the index. This +// ** function returns the total number of vector elements that can be used +// ** as part of the range comparison. +// ** +// ** For example, if the query is: +// ** +// ** WHERE a = ? AND (b, c, d) > (?, ?, ?) +// ** +// ** and the index: +// ** +// ** CREATE INDEX ... ON (a, b, c, d, e) +// ** +// ** then this function would be invoked with nEq=1. The value returned in +// ** this case is 3. +// */ +func _whereRangeVectorLen(tls *libc.TLS, pParse uintptr, iCur int32, pIdx uintptr, nEq int32, pTerm uintptr) (r int32) { + var aff, idxaff int8 + var i, nCmp, v1 int32 + var pColl, pLhs, pRhs uintptr + _, _, _, _, _, _, _, _ = aff, i, idxaff, nCmp, pColl, pLhs, pRhs, v1 + nCmp = _sqlite3ExprVectorSize(tls, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft) + if nCmp < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)-nEq { + v1 = nCmp + } else { + v1 = int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) - nEq + } + nCmp = v1 + i = int32(1) + for { + if !(i < nCmp) { + break + } /* Comparison affinity */ + idxaff = 0 + pLhs = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft + 32)) + 8 + uintptr(i)*32))).FpExpr + pRhs = (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + if (*TExpr)(unsafe.Pointer(pRhs)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + pRhs = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRhs + 32)))).FpEList + 8 + uintptr(i)*32))).FpExpr + } else { + pRhs = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRhs + 32)) + 8 + uintptr(i)*32))).FpExpr + } + /* Check that the LHS of the comparison is a column reference to + ** the right column of the right source table. And that the sort + ** order of the index column is the same as the sort order of the + ** leftmost index column. */ + if int32((*TExpr)(unsafe.Pointer(pLhs)).Fop) != int32(TK_COLUMN) || (*TExpr)(unsafe.Pointer(pLhs)).FiTable != iCur || int32((*TExpr)(unsafe.Pointer(pLhs)).FiColumn) != int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i+nEq)*2))) || int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i+nEq)))) != int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(nEq)))) { + break + } + aff = _sqlite3CompareAffinity(tls, pRhs, _sqlite3ExprAffinity(tls, pLhs)) + idxaff = _sqlite3TableColumnAffinity(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable, int32((*TExpr)(unsafe.Pointer(pLhs)).FiColumn)) + if int32(aff) != int32(idxaff) { + break + } + pColl = _sqlite3BinaryCompareCollSeq(tls, pParse, pLhs, pRhs) + if pColl == uintptr(0) { + break + } + if _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FzName, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i+nEq)*8))) != 0 { + break + } + goto _2 + _2: + ; + i++ + } + return i +} + +/* +** Adjust the cost C by the costMult factor T. This only occurs if +** compiled with -DSQLITE_ENABLE_COSTMULT + */ + +// C documentation +// +// /* +// ** We have so far matched pBuilder->pNew->u.btree.nEq terms of the +// ** index pIndex. Try to match one more. +// ** +// ** When this function is called, pBuilder->pNew->nOut contains the +// ** number of rows expected to be visited by filtering using the nEq +// ** terms only. If it is modified, this value is restored before this +// ** function returns. +// ** +// ** If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is +// ** a fake index used for the INTEGER PRIMARY KEY. +// */ +func _whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pProbe uintptr, nInMul TLogEst) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var M, logK, nIter, nOutUnadjusted, rCostIdx, rLogSize, rSize, saved_nOut, x TLogEst + var db, pBtm, pExpr, pExpr1, pNew, pParse, pTerm, pTop, pWInfo, v11, v24, v5, v8, v9, p12, p13, p14, p15, p16, p17, p18, p19, p2, p20, p25, p3 uintptr + var eOp, saved_nBtm, saved_nEq, saved_nLTerm, saved_nSkip, saved_nTop, v10, v23, v4, v7 Tu16 + var i, iCol, nEq, nIn, nRecValid, nVecLen, opMask, rc, v21 int32 + var saved_prereq TBitmask + var saved_wsFlags Tu32 + var v22 bool + var _ /* nOut at bp+112 */ TtRowcnt + var _ /* scan at bp+0 */ TWhereScan + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = M, db, eOp, i, iCol, logK, nEq, nIn, nIter, nOutUnadjusted, nRecValid, nVecLen, opMask, pBtm, pExpr, pExpr1, pNew, pParse, pTerm, pTop, pWInfo, rCostIdx, rLogSize, rSize, rc, saved_nBtm, saved_nEq, saved_nLTerm, saved_nOut, saved_nSkip, saved_nTop, saved_prereq, saved_wsFlags, x, v10, v11, v21, v22, v23, v24, v4, v5, v7, v8, v9, p12, p13, p14, p15, p16, p17, p18, p19, p2, p20, p25, p3 + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo /* WHERE analyze context */ + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse /* Parsing context */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Original value of pNew->nOut */ + rc = SQLITE_OK /* Logarithm of table size */ + pTop = uintptr(0) + pBtm = uintptr(0) /* Top and bottom range constraints */ + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + return (*TParse)(unsafe.Pointer(pParse)).Frc + } + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { + opMask = libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) + } else { + opMask = libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IN) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_ISNULL) | libc.Int32FromInt32(WO_IS) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x4>>2)) != 0 || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x100>>8)) != 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x4>>2)) != 0 { + opMask &= ^(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) | libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LE)-libc.Int32FromInt32(TK_EQ))) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x100>>8)) != 0 { + opMask &= ^(libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IN) | libc.Int32FromInt32(WO_IS)) + } + } + saved_nEq = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq + saved_nBtm = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm + saved_nTop = (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop + saved_nSkip = (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip + saved_nLTerm = (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm + saved_wsFlags = (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags + saved_prereq = (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq + saved_nOut = (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut + pTerm = _whereScanInit(tls, bp, (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor, int32(saved_nEq), uint32(opMask), pProbe) + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = 0 + rSize = *(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst)) + rLogSize = _estLog(tls, rSize) + for { + if !(rc == SQLITE_OK && pTerm != uintptr(0)) { + break + } + eOp = (*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator /* nOut before IN() and WHERE adjustments */ + nIn = 0 + nRecValid = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid + if (int32(eOp) == int32(WO_ISNULL) || int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) != 0) && _indexColumnNotNull(tls, pProbe, int32(saved_nEq)) != 0 { + goto _1 /* ignore IS [NOT] NULL constraints on NOT NULL columns */ + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&(*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf != 0 { + goto _1 + } + /* Do not allow the upper bound of a LIKE optimization range constraint + ** to mix with a lower range bound from some other source */ + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_LIKEOPT) != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator) == libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_LT)-libc.Int32FromInt32(TK_EQ)) { + goto _1 + } + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 && !(_constraintCompatibleWithOuterJoin(tls, pTerm, pSrc) != 0) { + goto _1 + } + if int32((*TIndex)(unsafe.Pointer(pProbe)).FonError) != OE_None && int32(saved_nEq) == int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol)-int32(1) { + p2 = pBuilder + 44 + *(*uint8)(unsafe.Pointer(p2)) = uint8(int32(*(*uint8)(unsafe.Pointer(p2))) | libc.Int32FromInt32(SQLITE_BLDF1_UNIQUE)) + } else { + p3 = pBuilder + 44 + *(*uint8)(unsafe.Pointer(p3)) = uint8(int32(*(*uint8)(unsafe.Pointer(p3))) | libc.Int32FromInt32(SQLITE_BLDF1_INDEXED)) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq = saved_nEq + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm = saved_nBtm + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = saved_nTop + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = saved_nLTerm + if int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm) >= int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLSlot) && _whereLoopResize(tls, db, pNew, int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+int32(1)) != 0 { + break /* OOM while trying to enlarge the pNew->aLTerm array */ + } + v5 = pNew + 52 + v4 = *(*Tu16)(unsafe.Pointer(v5)) + *(*Tu16)(unsafe.Pointer(v5))++ + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(v4)*8)) = pTerm + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = (saved_prereq | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) & ^(*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf + if int32(eOp)&int32(WO_IN) != 0 { + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_xIsSelect) != uint32(0) { + nIn = int32(46) + /* The expression may actually be of the form (x, y) IN (SELECT...). + ** In this case there is a separate term for each of (x) and (y). + ** However, the nIn multiplier should only be applied once, not once + ** for each such term. The following loop checks that pTerm is the + ** first such term in use, and sets nIn back to 0 if it is not. */ + i = 0 + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)-int32(1)) { + break + } + if *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) != 0 && (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)))).FpExpr == pExpr { + nIn = 0 + } + goto _6 + _6: + ; + i++ + } + } else { + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 && (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr != 0 { + /* "x IN (value, value, ...)" */ + nIn = int32(_sqlite3LogEst(tls, uint64((*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr))) + } + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x80>>7)) != 0 && int32(rLogSize) >= int32(10) { + /* Let: + ** N = the total number of rows in the table + ** K = the number of entries on the RHS of the IN operator + ** M = the number of rows in the table that match terms to the + ** to the left in the same index. If the IN operator is on + ** the left-most index column, M==N. + ** + ** Given the definitions above, it is better to omit the IN operator + ** from the index lookup and instead do a scan of the M elements, + ** testing each scanned row against the IN operator separately, if: + ** + ** M*log(K) < K*log(N) + ** + ** Our estimates for M, K, and N might be inaccurate, so we build in + ** a safety margin of 2 (LogEst: 10) that favors using the IN operator + ** with the index, as using an index has better worst-case behavior. + ** If we do not have real sqlite_stat1 data, always prefer to use + ** the index. Do not bother with this optimization on very small + ** tables (less than 2 rows) as it is pointless in that case. + */ + M = *(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(saved_nEq)*2)) + logK = _estLog(tls, int16(nIn)) + /* TUNING v----- 10 to bias toward indexed IN */ + x = int16(int32(M) + int32(logK) + int32(10) - (nIn + int32(rLogSize))) + if int32(x) >= 0 { + } else { + if int32(nInMul) < int32(2) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_SeekScan)) == uint32(0) { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_IN_SEEKSCAN) + } else { + goto _1 + } + } + } + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_COLUMN_IN) + } else { + if int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0 { + iCol = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_COLUMN_EQ) + if iCol == -int32(1) || iCol >= 0 && int32(nInMul) == 0 && int32(saved_nEq) == int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol)-int32(1) { + if iCol == -int32(1) || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x8>>3)) != 0 || int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol) == int32(1) && (*TIndex)(unsafe.Pointer(pProbe)).FonError != 0 && int32(eOp) == int32(WO_EQ) { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_ONEROW) + } else { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_UNQ_WANTED) + } + } + if int32((*(*TWhereScan)(unsafe.Pointer(bp))).FiEquiv) > int32(1) { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_TRANSCONS) + } + } else { + if int32(eOp)&int32(WO_ISNULL) != 0 { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_COLUMN_NULL) + } else { + nVecLen = _whereRangeVectorLen(tls, pParse, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor, pProbe, int32(saved_nEq), pTerm) + if int32(eOp)&(libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GT)-libc.Int32FromInt32(TK_EQ))|libc.Int32FromInt32(WO_EQ)<<(libc.Int32FromInt32(TK_GE)-libc.Int32FromInt32(TK_EQ))) != 0 { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(libc.Int32FromInt32(WHERE_COLUMN_RANGE) | libc.Int32FromInt32(WHERE_BTM_LIMIT)) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm = uint16(nVecLen) + pBtm = pTerm + pTop = uintptr(0) + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_LIKEOPT) != 0 { + /* Range constraints that come from the LIKE optimization are + ** always used in pairs. */ + pTop = pTerm + 1*56 + if _whereLoopResize(tls, db, pNew, int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+int32(1)) != 0 { + break + } /* OOM */ + v8 = pNew + 52 + v7 = *(*Tu16)(unsafe.Pointer(v8)) + *(*Tu16)(unsafe.Pointer(v8))++ + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(v7)*8)) = pTop + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_TOP_LIMIT) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = uint16(1) + } + } else { + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(libc.Int32FromInt32(WHERE_COLUMN_RANGE) | libc.Int32FromInt32(WHERE_TOP_LIMIT)) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = uint16(nVecLen) + pTop = pTerm + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_BTM_LIMIT) != uint32(0) { + v9 = *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)-int32(2))*8)) + } else { + v9 = uintptr(0) + } + pBtm = v9 + } + } + } + } + /* At this point pNew->nOut is set to the number of rows expected to + ** be visited by the index scan before considering term pTerm, or the + ** values of nIn and nInMul. In other words, assuming that all + ** "x IN(...)" terms are replaced with "x = ?". This block updates + ** the value of pNew->nOut to account for pTerm (but not nIn/nInMul). */ + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_COLUMN_RANGE) != 0 { + /* Adjust nOut using stat4 data. Or, if there is no stat4 + ** data, using some other estimate. */ + _whereRangeScanEst(tls, pParse, pBuilder, pBtm, pTop, pNew) + } else { + v11 = pNew + 24 + *(*Tu16)(unsafe.Pointer(v11))++ + v10 = *(*Tu16)(unsafe.Pointer(v11)) + nEq = int32(v10) + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 && int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) >= 0 { + p12 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p12)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p12))) + int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FtruthProb)) + p13 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p13)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p13))) - nIn) + } else { + *(*TtRowcnt)(unsafe.Pointer(bp + 112)) = uint64(0) + if int32(nInMul) == 0 && (*TIndex)(unsafe.Pointer(pProbe)).FnSample != 0 && int32((*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq) <= (*TIndex)(unsafe.Pointer(pProbe)).FnSampleCol && (int32(eOp)&int32(WO_IN) == 0 || (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(EP_xIsSelect) == uint32(0)) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { + pExpr1 = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if int32(eOp)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_ISNULL)|libc.Int32FromInt32(WO_IS)) != 0 { + rc = _whereEqualScanEst(tls, pParse, pBuilder, (*TExpr)(unsafe.Pointer(pExpr1)).FpRight, bp+112) + } else { + rc = _whereInScanEst(tls, pParse, pBuilder, *(*uintptr)(unsafe.Pointer(pExpr1 + 32)), bp+112) + } + if rc == int32(SQLITE_NOTFOUND) { + rc = SQLITE_OK + } + if rc != SQLITE_OK { + break + } /* Jump out of the pTerm loop */ + if *(*TtRowcnt)(unsafe.Pointer(bp + 112)) != 0 { + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = _sqlite3LogEst(tls, *(*TtRowcnt)(unsafe.Pointer(bp + 112))) + if nEq == int32(1) && int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnOut)+int32(10) > int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst))) { + p14 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p14)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p14))) | libc.Int32FromInt32(TERM_HIGHTRUTH)) + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_HEURTRUTH) != 0 { + /* If the term has previously been used with an assumption of + ** higher selectivity, then set the flag to rerun the + ** loop computations. */ + p15 = pBuilder + 45 + *(*uint8)(unsafe.Pointer(p15)) = uint8(int32(*(*uint8)(unsafe.Pointer(p15))) | libc.Int32FromInt32(SQLITE_BLDF2_2NDPASS)) + } + } + if int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnOut) > int32(saved_nOut) { + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + } + p16 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p16)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p16))) - nIn) + } + } + if *(*TtRowcnt)(unsafe.Pointer(bp + 112)) == uint64(0) { + p17 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p17)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p17))) + (int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(nEq)*2))) - int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(nEq-int32(1))*2))))) + if int32(eOp)&int32(WO_ISNULL) != 0 { + /* TUNING: If there is no likelihood() value, assume that a + ** "col IS NULL" expression matches twice as many rows + ** as (col=?). */ + p18 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p18)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p18))) + libc.Int32FromInt32(10)) + } + } + } + } + /* Set rCostIdx to the cost of visiting selected rows in index. Add + ** it to pNew->rRun, which is currently set to the cost of the index + ** seek only. Then, if this is a non-covering index, add the cost of + ** visiting the rows in the main table. */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_IPK) { + /* The pProbe->szIdxRow is low for an IPK table since the interior + ** pages are small. Thus szIdxRow gives a good estimate of seek cost. + ** But the leaf pages are full-size, so pProbe->szIdxRow would badly + ** under-estimate the scanning cost. */ + rCostIdx = int16(int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnOut) + int32(16)) + } else { + rCostIdx = int16(int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnOut) + int32(1) + int32(15)*int32((*TIndex)(unsafe.Pointer(pProbe)).FszIdxRow)/int32((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FszTabRow)) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, rLogSize, rCostIdx) + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IDX_ONLY)|libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_EXPRIDX)) == uint32(0) { + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, int16(int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnOut)+int32(16))) + } + nOutUnadjusted = (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut + p19 = pNew + 20 + *(*TLogEst)(unsafe.Pointer(p19)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p19))) + (int32(nInMul) + nIn)) + p20 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p20)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p20))) + (int32(nInMul) + nIn)) + _whereLoopOutputAdjust(tls, (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC, pNew, rSize) + rc = _whereLoopInsert(tls, pBuilder, pNew) + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_COLUMN_RANGE) != 0 { + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + } else { + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = nOutUnadjusted + } + if (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags&uint32(WHERE_TOP_LIMIT) == uint32(0) && int32((*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq) < int32((*TIndex)(unsafe.Pointer(pProbe)).FnColumn) && (int32((*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq) < int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol) || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x3>>0)) != int32(SQLITE_IDXTYPE_PRIMARYKEY)) { + if int32((*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq) > int32(3) { + _sqlite3ProgressCheck(tls, pParse) + } + _whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, int16(int32(nInMul)+nIn)) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid + goto _1 + _1: + ; + pTerm = _whereScanNext(tls, bp) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = saved_prereq + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq = saved_nEq + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm = saved_nBtm + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = saved_nTop + (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip = saved_nSkip + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = saved_nLTerm + /* Consider using a skip-scan if there are no WHERE clause constraints + ** available for the left-most terms of the index, and if the average + ** number of repeats in the left-most terms is at least 18. + ** + ** The magic number 18 is selected on the basis that scanning 17 rows + ** is almost always quicker than an index seek (even though if the index + ** contains fewer than 2^17 rows we assume otherwise in other parts of + ** the code). And, even if it is not, it should not be too much slower. + ** On the other hand, the extra seeks could end up being significantly + ** more expensive. */ + if v22 = int32(saved_nEq) == int32(saved_nSkip) && int32(saved_nEq)+int32(1) < int32((*TIndex)(unsafe.Pointer(pProbe)).FnKeyCol) && int32(saved_nEq) == int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm) && int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x40>>6)) == 0 && int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x80>>7)) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_SkipScan)) == uint32(0) && int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(int32(saved_nEq)+int32(1))*2))) >= int32(42); v22 { + v21 = _whereLoopResize(tls, db, pNew, int32((*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+int32(1)) + rc = v21 + } + if v22 && v21 == SQLITE_OK { + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq++ + (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip++ + v24 = pNew + 52 + v23 = *(*Tu16)(unsafe.Pointer(v24)) + *(*Tu16)(unsafe.Pointer(v24))++ + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(v23)*8)) = uintptr(0) + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= uint32(WHERE_SKIPSCAN) + nIter = int16(int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(saved_nEq)*2))) - int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(int32(saved_nEq)+int32(1))*2)))) + p25 = pNew + 22 + *(*TLogEst)(unsafe.Pointer(p25)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p25))) - int32(nIter)) + /* TUNING: Because uncertainties in the estimates for skip-scan queries, + ** add a 1.375 fudge factor to make skip-scan slightly less likely. */ + nIter = TLogEst(int32(nIter) + libc.Int32FromInt32(5)) + _whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, int16(int32(nIter)+int32(nInMul))) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq = saved_nEq + (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip = saved_nSkip + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + } + return rc +} + +// C documentation +// +// /* +// ** Return True if it is possible that pIndex might be useful in +// ** implementing the ORDER BY clause in pBuilder. +// ** +// ** Return False if pBuilder does not contain an ORDER BY clause or +// ** if there is no way for pIndex to be useful in implementing that +// ** ORDER BY clause. +// */ +func _indexMightHelpWithOrderBy(tls *libc.TLS, pBuilder uintptr, pIndex uintptr, iCursor int32) (r int32) { + var aColExpr, pExpr, pOB, v1, v4 uintptr + var ii, jj int32 + _, _, _, _, _, _, _ = aColExpr, ii, jj, pExpr, pOB, v1, v4 + if int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x4>>2)) != 0 { + return 0 + } + v1 = (*TWhereInfo)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpOrderBy + pOB = v1 + if v1 == uintptr(0) { + return 0 + } + ii = 0 + for { + if !(ii < (*TExprList)(unsafe.Pointer(pOB)).FnExpr) { + break + } + pExpr = _sqlite3ExprSkipCollateAndLikely(tls, (*(*TExprList_item)(unsafe.Pointer(pOB + 8 + uintptr(ii)*32))).FpExpr) + if pExpr == uintptr(0) { + goto _2 + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) && (*TExpr)(unsafe.Pointer(pExpr)).FiTable == iCursor { + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) < 0 { + return int32(1) + } + jj = 0 + for { + if !(jj < int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol)) { + break + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) == int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(jj)*2))) { + return int32(1) + } + goto _3 + _3: + ; + jj++ + } + } else { + v4 = (*TIndex)(unsafe.Pointer(pIndex)).FaColExpr + aColExpr = v4 + if v4 != uintptr(0) { + jj = 0 + for { + if !(jj < int32((*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(jj)*2))) != -int32(2) { + goto _5 + } + if _sqlite3ExprCompareSkip(tls, pExpr, (*(*TExprList_item)(unsafe.Pointer(aColExpr + 8 + uintptr(jj)*32))).FpExpr, iCursor) == 0 { + return int32(1) + } + goto _5 + _5: + ; + jj++ + } + } + } + goto _2 + _2: + ; + ii++ + } + return 0 +} + +// C documentation +// +// /* Check to see if a partial index with pPartIndexWhere can be used +// ** in the current query. Return true if it can be and false if not. +// */ +func _whereUsablePartialIndex(tls *libc.TLS, iTab int32, jointype Tu8, pWC uintptr, pWhere uintptr) (r int32) { + var i int32 + var pExpr, pParse, pTerm uintptr + _, _, _, _ = i, pExpr, pParse, pTerm + if int32(jointype)&int32(JT_LTORJ) != 0 { + return 0 + } + pParse = (*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse + for int32((*TExpr)(unsafe.Pointer(pWhere)).Fop) == int32(TK_AND) { + if !(_whereUsablePartialIndex(tls, iTab, jointype, pWC, (*TExpr)(unsafe.Pointer(pWhere)).FpLeft) != 0) { + return 0 + } + pWhere = (*TExpr)(unsafe.Pointer(pWhere)).FpRight + } + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_EnableQPSG) != 0 { + pParse = uintptr(0) + } + i = 0 + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(i < (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm) { + break + } + pExpr = (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if (!((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) || *(*int32)(unsafe.Pointer(pExpr + 52)) == iTab) && (int32(jointype)&int32(JT_OUTER) == 0 || (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != uint32(0)) && _sqlite3ExprImpliesExpr(tls, pParse, pExpr, pWhere, iTab) != 0 && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FwtFlags)&int32(TERM_VNULL) == 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + pTerm += 56 + } + return 0 +} + +// C documentation +// +// /* +// ** pIdx is an index containing expressions. Check it see if any of the +// ** expressions in the index match the pExpr expression. +// */ +func _exprIsCoveredByIndex(tls *libc.TLS, pExpr uintptr, pIdx uintptr, iTabCur int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == -int32(2) && _sqlite3ExprCompare(tls, uintptr(0), pExpr, (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr, iTabCur) == 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Structure passed to the whereIsCoveringIndex Walker callback. +// */ +type TCoveringIndexCheck = struct { + FpIdx uintptr + FiTabCur int32 + FbExpr Tu8 + FbUnidx Tu8 +} + +type CoveringIndexCheck = TCoveringIndexCheck + +type TCoveringIndexCheck1 = struct { + FpIdx uintptr + FiTabCur int32 + FbExpr Tu8 + FbUnidx Tu8 +} + +type CoveringIndexCheck1 = TCoveringIndexCheck1 + +// C documentation +// +// /* +// ** Information passed in is pWalk->u.pCovIdxCk. Call it pCk. +// ** +// ** If the Expr node references the table with cursor pCk->iTabCur, then +// ** make sure that column is covered by the index pCk->pIdx. We know that +// ** all columns less than 63 (really BMS-1) are covered, so we don't need +// ** to check them. But we do need to check any column at 63 or greater. +// ** +// ** If the index does not cover the column, then set pWalk->eCode to +// ** non-zero and return WRC_Abort to stop the search. +// ** +// ** If this node does not disprove that the index can be a covering index, +// ** then just return WRC_Continue, to continue the search. +// ** +// ** If pCk->pIdx contains indexed expressions and one of those expressions +// ** matches pExpr, then prune the search. +// */ +func _whereIsCoveringIndexWalkCallback(tls *libc.TLS, pWalk uintptr, pExpr uintptr) (r int32) { + var aiColumn, pCk, pIdx uintptr + var i int32 + var nColumn Tu16 + _, _, _, _, _ = aiColumn, i, nColumn, pCk, pIdx /* Info about this search */ + pCk = *(*uintptr)(unsafe.Pointer(pWalk + 40)) + pIdx = (*TCoveringIndexCheck)(unsafe.Pointer(pCk)).FpIdx + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_COLUMN) || int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_COLUMN) { + /* if( pExpr->iColumn<(BMS-1) && pIdx->bHasExpr==0 ) return WRC_Continue;*/ + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable != (*TCoveringIndexCheck)(unsafe.Pointer(pCk)).FiTabCur { + return WRC_Continue + } + pIdx = (*TCoveringIndexCheck1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalk + 40)))).FpIdx + aiColumn = (*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + nColumn = (*TIndex)(unsafe.Pointer(pIdx)).FnColumn + i = 0 + for { + if !(i < int32(nColumn)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer(aiColumn + uintptr(i)*2))) == int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) { + return WRC_Continue + } + goto _1 + _1: + ; + i++ + } + (*TCoveringIndexCheck)(unsafe.Pointer(pCk)).FbUnidx = uint8(1) + return int32(WRC_Abort) + } else { + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x1000>>12)) != 0 && _exprIsCoveredByIndex(tls, pExpr, pIdx, (*TCoveringIndexCheck1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalk + 40)))).FiTabCur) != 0 { + (*TCoveringIndexCheck)(unsafe.Pointer(pCk)).FbExpr = uint8(1) + return int32(WRC_Prune) + } + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** pIdx is an index that covers all of the low-number columns used by +// ** pWInfo->pSelect (columns from 0 through 62) or an index that has +// ** expressions terms. Hence, we cannot determine whether or not it is +// ** a covering index by using the colUsed bitmasks. We have to do a search +// ** to see if the index is covering. This routine does that search. +// ** +// ** The return value is one of these: +// ** +// ** 0 The index is definitely not a covering index +// ** +// ** WHERE_IDX_ONLY The index is definitely a covering index +// ** +// ** WHERE_EXPRIDX The index is likely a covering index, but it is +// ** difficult to determine precisely because of the +// ** expressions that are indexed. Score it as a +// ** covering index, but still keep the main table open +// ** just in case we need it. +// ** +// ** This routine is an optimization. It is always safe to return zero. +// ** But returning one of the other two values when zero should have been +// ** returned can lead to incorrect bytecode and assertion faults. +// */ +func _whereIsCoveringIndex(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iTabCur int32) (r Tu32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var i, rc int32 + var _ /* ck at bp+0 */ TCoveringIndexCheck1 + var _ /* w at bp+16 */ TWalker + _, _ = i, rc + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect == uintptr(0) { + /* We don't have access to the full query, so we cannot check to see + ** if pIdx is covering. Assume it is not. */ + return uint32(0) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x1000>>12)) == 0 { + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + if int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + break + } + goto _1 + _1: + ; + i++ + } + if i >= int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) { + /* pIdx does not index any columns greater than 62, but we know from + ** colMask that columns greater than 62 are used, so this is not a + ** covering index */ + return uint32(0) + } + } + (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FpIdx = pIdx + (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FiTabCur = iTabCur + (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FbExpr = uint8(0) + (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FbUnidx = uint8(0) + libc.Xmemset(tls, bp+16, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 16))).FxExprCallback = __ccgo_fp(_whereIsCoveringIndexWalkCallback) + (*(*TWalker)(unsafe.Pointer(bp + 16))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkNoop) + *(*uintptr)(unsafe.Pointer(bp + 16 + 40)) = bp + _sqlite3WalkSelect(tls, bp+16, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect) + if (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FbUnidx != 0 { + rc = 0 + } else { + if (*(*TCoveringIndexCheck1)(unsafe.Pointer(bp))).FbExpr != 0 { + rc = int32(WHERE_EXPRIDX) + } else { + rc = int32(WHERE_IDX_ONLY) + } + } + return uint32(rc) +} + +// C documentation +// +// /* +// ** This is an sqlite3ParserAddCleanup() callback that is invoked to +// ** free the Parse->pIdxEpr list when the Parse object is destroyed. +// */ +func _whereIndexedExprCleanup(tls *libc.TLS, db uintptr, pObject uintptr) { + var p, pp uintptr + _, _ = p, pp + pp = pObject + for *(*uintptr)(unsafe.Pointer(pp)) != uintptr(0) { + p = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext + _sqlite3ExprDelete(tls, db, (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr) + _sqlite3DbFreeNN(tls, db, p) + } +} + +// C documentation +// +// /* +// ** This function is called for a partial index - one with a WHERE clause - in +// ** two scenarios. In both cases, it determines whether or not the WHERE +// ** clause on the index implies that a column of the table may be safely +// ** replaced by a constant expression. For example, in the following +// ** SELECT: +// ** +// ** CREATE INDEX i1 ON t1(b, c) WHERE a=; +// ** SELECT a, b, c FROM t1 WHERE a= AND b=?; +// ** +// ** The "a" in the select-list may be replaced by , iff: +// ** +// ** (a) is a constant expression, and +// ** (b) The (a=) comparison uses the BINARY collation sequence, and +// ** (c) Column "a" has an affinity other than NONE or BLOB. +// ** +// ** If argument pItem is NULL, then pMask must not be NULL. In this case this +// ** function is being called as part of determining whether or not pIdx +// ** is a covering index. This function clears any bits in (*pMask) +// ** corresponding to columns that may be replaced by constants as described +// ** above. +// ** +// ** Otherwise, if pItem is not NULL, then this function is being called +// ** as part of coding a loop that uses index pIdx. In this case, add entries +// ** to the Parse.pIdxPartExpr list for each column that can be replaced +// ** by a constant. +// */ +func _wherePartIdxExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, pPart uintptr, pMask uintptr, iIdxCur int32, pItem uintptr) { + var aff Tu8 + var bNullRow int32 + var db, p, pArg, pLeft, pRight uintptr + _, _, _, _, _, _, _ = aff, bNullRow, db, p, pArg, pLeft, pRight + if int32((*TExpr)(unsafe.Pointer(pPart)).Fop) == int32(TK_AND) { + _wherePartIdxExpr(tls, pParse, pIdx, (*TExpr)(unsafe.Pointer(pPart)).FpRight, pMask, iIdxCur, pItem) + pPart = (*TExpr)(unsafe.Pointer(pPart)).FpLeft + } + if int32((*TExpr)(unsafe.Pointer(pPart)).Fop) == int32(TK_EQ) || int32((*TExpr)(unsafe.Pointer(pPart)).Fop) == int32(TK_IS) { + pLeft = (*TExpr)(unsafe.Pointer(pPart)).FpLeft + pRight = (*TExpr)(unsafe.Pointer(pPart)).FpRight + if int32((*TExpr)(unsafe.Pointer(pLeft)).Fop) != int32(TK_COLUMN) { + return + } + if !(_sqlite3ExprIsConstant(tls, pRight) != 0) { + return + } + if !(_sqlite3IsBinary(tls, _sqlite3ExprCompareCollSeq(tls, pParse, pPart)) != 0) { + return + } + if int32((*TExpr)(unsafe.Pointer(pLeft)).FiColumn) < 0 { + return + } + aff = uint8((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr((*TExpr)(unsafe.Pointer(pLeft)).FiColumn)*16))).Faffinity) + if int32(aff) >= int32(SQLITE_AFF_TEXT) { + if pItem != 0 { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + p = _sqlite3DbMallocRaw(tls, db, uint64(32)) + if p != 0 { + bNullRow = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)) != 0) + (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr = _sqlite3ExprDup(tls, db, pRight, 0) + (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur + (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = int32((*TExpr)(unsafe.Pointer(pLeft)).FiColumn) + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = uint8(bNullRow) + (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext = (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr + (*TIndexedExpr)(unsafe.Pointer(p)).Faff = aff + (*TParse)(unsafe.Pointer(pParse)).FpIdxPartExpr = p + if (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext == uintptr(0) { + pArg = pParse + 104 + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_whereIndexedExprCleanup), pArg) + } + } + } else { + if int32((*TExpr)(unsafe.Pointer(pLeft)).FiColumn) < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + *(*TBitmask)(unsafe.Pointer(pMask)) &= ^(libc.Uint64FromInt32(1) << (*TExpr)(unsafe.Pointer(pLeft)).FiColumn) + } + } + } + } +} + +// C documentation +// +// /* +// ** Add all WhereLoop objects for a single table of the join where the table +// ** is identified by pBuilder->pNew->iTab. That table is guaranteed to be +// ** a b-tree table, not a virtual table. +// ** +// ** The costs (WhereLoop.rRun) of the b-tree loops added by this function +// ** are calculated as follows: +// ** +// ** For a full scan, assuming the table (or index) contains nRow rows: +// ** +// ** cost = nRow * 3.0 // full-table scan +// ** cost = nRow * K // scan of covering index +// ** cost = nRow * (K+3.0) // scan of non-covering index +// ** +// ** where K is a value between 1.1 and 3.0 set based on the relative +// ** estimated average size of the index and table records. +// ** +// ** For an index scan, where nVisit is the number of index rows visited +// ** by the scan, and nSeek is the number of seek operations required on +// ** the index b-tree: +// ** +// ** cost = nSeek * (log(nRow) + K * nVisit) // covering index +// ** cost = nSeek * (log(nRow) + (K+3.0) * nVisit) // non-covering index +// ** +// ** Normally, nSeek is 1. nSeek values greater than 1 come about if the +// ** WHERE clause includes "x IN (....)" terms used in place of "x=?". Or when +// ** implicit "x IN (SELECT x FROM tbl)" terms are added for skip-scans. +// ** +// ** The estimated values (nRow, nVisit, nSeek) often contain a large amount +// ** of uncertainty. For this reason, scoring is designed to pick plans that +// ** "do the least harm" if the estimates are inaccurate. For example, a +// ** log(nRow) factor is omitted from a non-covering index scan in order to +// ** bias the scoring in favor of using an index, since the worst-case +// ** performance of using an index is far better than the worst-case performance +// ** of a full table scan. +// */ +func _whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask) (r int32) { + bp := tls.Alloc(176) + defer tls.Free(176) + var b, iCur, iSortIdx, ii, rc, v5, v6 int32 + var isCov Tu32 + var nLookup, rLogSize, rSize TLogEst + var pFirst, pNew, pProbe, pSrc, pTab, pTabList, pTerm, pTerm1, pWC, pWC2, pWCEnd, pWInfo, v8, p2, p3 uintptr + var _ /* aiColumnPk at bp+164 */ Ti16 + var _ /* aiRowEstPk at bp+160 */ [2]TLogEst + var _ /* m at bp+168 */ TBitmask + var _ /* sPk at bp+0 */ TIndex + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, iCur, iSortIdx, ii, isCov, nLookup, pFirst, pNew, pProbe, pSrc, pTab, pTabList, pTerm, pTerm1, pWC, pWC2, pWCEnd, pWInfo, rLogSize, rSize, rc, v5, v6, v8, p2, p3 /* The aiRowLogEst[] value for the sPk index */ + *(*Ti16)(unsafe.Pointer(bp + 164)) = int16(-int32(1)) /* Template WhereLoop object */ + rc = SQLITE_OK /* Return code */ + iSortIdx = int32(1) /* Table being queried */ + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + pTabList = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + pSrc = pTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 + pTab = (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab + pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { + /* An INDEXED BY clause specifies a particular index to use */ + pProbe = *(*uintptr)(unsafe.Pointer(pSrc + 96)) + } else { + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pProbe = (*TTable)(unsafe.Pointer(pTab)).FpIndex + } else { /* First of real indices on the table */ + libc.Xmemset(tls, bp, 0, uint64(160)) + (*(*TIndex)(unsafe.Pointer(bp))).FnKeyCol = uint16(1) + (*(*TIndex)(unsafe.Pointer(bp))).FnColumn = uint16(1) + (*(*TIndex)(unsafe.Pointer(bp))).FaiColumn = bp + 164 + (*(*TIndex)(unsafe.Pointer(bp))).FaiRowLogEst = bp + 160 + (*(*TIndex)(unsafe.Pointer(bp))).FonError = uint8(OE_Replace) + (*(*TIndex)(unsafe.Pointer(bp))).FpTable = pTab + (*(*TIndex)(unsafe.Pointer(bp))).FszIdxRow = int16(3) /* TUNING: Interior rows of IPK table are very small */ + libc.SetBitFieldPtr16Uint32(bp+100, libc.Uint32FromInt32(SQLITE_IDXTYPE_IPK), 0, 0x3) + (*(*[2]TLogEst)(unsafe.Pointer(bp + 160)))[0] = (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst + (*(*[2]TLogEst)(unsafe.Pointer(bp + 160)))[int32(1)] = 0 + pFirst = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FpIndex + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x1>>0)) == 0 { + /* The real indices of the table are only considered if the + ** NOT INDEXED qualifier is omitted from the FROM clause */ + (*(*TIndex)(unsafe.Pointer(bp))).FpNext = pFirst + } + pProbe = bp + } + } + rSize = (*TTable)(unsafe.Pointer(pTab)).FnRowLogEst + /* Automatic indexes */ + if !((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet != 0) && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&(libc.Int32FromInt32(WHERE_RIGHT_JOIN)|libc.Int32FromInt32(WHERE_OR_SUBCLAUSE)) == 0 && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb)).Fflags&uint64(SQLITE_AutoIndex) != uint64(0) && !(int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0) && !(int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x1>>0)) != 0) && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) && !(int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x8>>3)) != 0) && !(int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x40>>6)) != 0) && int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&int32(JT_RIGHT) == 0 { + pWCEnd = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm)*56 + rLogSize = _estLog(tls, rSize) + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(rc == SQLITE_OK && pTerm < pWCEnd) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&(*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf != 0 { + goto _1 + } + if _termCanDriveIndex(tls, pTerm, pSrc, uint64(0)) != 0 { + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq = uint16(1) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FpIndex = uintptr(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm)) = pTerm + /* TUNING: One-time cost for computing the automatic index is + ** estimated to be X*N*log2(N) where N is the number of rows in + ** the table being indexed and where X is 7 (LogEst=28) for normal + ** tables or 0.5 (LogEst=-10) for views and subqueries. The value + ** of X is smaller for views and subqueries so that the query planner + ** will be more aggressive about generating automatic indexes for + ** those objects, since there is no opportunity to add schema + ** indexes on subqueries and views. */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(int32(rLogSize) + int32(rSize)) + if !(int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VIEW)) && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Ephemeral) == uint32(0) { + p2 = pNew + 18 + *(*TLogEst)(unsafe.Pointer(p2)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p2))) + libc.Int32FromInt32(28)) + } else { + p3 = pNew + 18 + *(*TLogEst)(unsafe.Pointer(p3)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p3))) - libc.Int32FromInt32(25)) /* Greatly reduced setup cost for auto indexes + ** on ephemeral materializations of views */ + } + if int32((*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup) < 0 { + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = 0 + } + /* TUNING: Each index lookup yields 20 rows in the table. This + ** is more than the usual guess of 10 rows, since we have no way + ** of knowing how selective the index will ultimately be. It would + ** not be unreasonable to make this value much larger. */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = int16(43) + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, rLogSize, (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut) + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_AUTO_INDEX) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq | (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight + rc = _whereLoopInsert(tls, pBuilder, pNew) + } + goto _1 + _1: + ; + pTerm += 56 + } + } + /* Loop over all indices. If there was an INDEXED BY clause, then only + ** consider index pProbe. */ + for { + if !(rc == SQLITE_OK && pProbe != 0) { + break + } + if (*TIndex)(unsafe.Pointer(pProbe)).FpPartIdxWhere != uintptr(0) && !(_whereUsablePartialIndex(tls, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor, (*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype, pWC, (*TIndex)(unsafe.Pointer(pProbe)).FpPartIdxWhere) != 0) { + /* See ticket [98d973b8f5] */ + goto _4 /* Partial index inappropriate for this query */ + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x200>>9)) != 0 { + goto _4 + } + rSize = *(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pProbe)).FaiRowLogEst)) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnEq = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnBtm = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FnTop = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnSkip = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = uint8(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = 0 + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + (*TWhereLoop)(unsafe.Pointer(pNew)).Fu.Fbtree.FpIndex = pProbe + b = _indexMightHelpWithOrderBy(tls, pBuilder, pProbe, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor) + /* The ONEPASS_DESIRED flags never occurs together with ORDER BY */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_IPK) { + /* Integer primary key index */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_IPK) + /* Full table scan */ + if b != 0 { + v5 = iSortIdx + } else { + v5 = 0 + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = uint8(v5) + /* TUNING: Cost of full table scan is 3.0*N. The 3.0 factor is an + ** extra cost designed to discourage the use of full table scans, + ** since index lookups have better worst-case performance if our + ** stat guesses are wrong. Reduce the 3.0 penalty slightly + ** (to 2.75) if we have valid STAT4 information for the table. + ** At 2.75, a full table scan is preferred over using an index on + ** a column with just two distinct values where each value has about + ** an equal number of appearances. Without STAT4 data, we still want + ** to use an index in that case, since the constraint might be for + ** the scarcer of the two values, and in that case an index lookup is + ** better. + */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = int16(int32(rSize) + int32(16) - int32(2)*libc.BoolInt32((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasStat4) != uint32(0))) + _whereLoopOutputAdjust(tls, pWC, pNew, rSize) + rc = _whereLoopInsert(tls, pBuilder, pNew) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + if rc != 0 { + break + } + } else { + if int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x20>>5)) != 0 { + *(*TBitmask)(unsafe.Pointer(bp + 168)) = uint64(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(libc.Int32FromInt32(WHERE_IDX_ONLY) | libc.Int32FromInt32(WHERE_INDEXED)) + } else { + *(*TBitmask)(unsafe.Pointer(bp + 168)) = (*TSrcItem)(unsafe.Pointer(pSrc)).FcolUsed & (*TIndex)(unsafe.Pointer(pProbe)).FcolNotIdxed + if (*TIndex)(unsafe.Pointer(pProbe)).FpPartIdxWhere != 0 { + _wherePartIdxExpr(tls, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse, pProbe, (*TIndex)(unsafe.Pointer(pProbe)).FpPartIdxWhere, bp+168, 0, uintptr(0)) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_INDEXED) + if *(*TBitmask)(unsafe.Pointer(bp + 168)) == libc.Uint64FromInt32(1)<<(int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1)) || int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x1000>>12)) != 0 && !(int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x800>>11)) != 0) && *(*TBitmask)(unsafe.Pointer(bp + 168)) != uint64(0) { + isCov = _whereIsCoveringIndex(tls, pWInfo, pProbe, (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor) + if isCov == uint32(0) { + } else { + *(*TBitmask)(unsafe.Pointer(bp + 168)) = uint64(0) + *(*Tu32)(unsafe.Pointer(pNew + 48)) |= isCov + if isCov&uint32(WHERE_IDX_ONLY) != 0 { + } else { + } + } + } else { + if *(*TBitmask)(unsafe.Pointer(bp + 168)) == uint64(0) { + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(libc.Int32FromInt32(WHERE_IDX_ONLY) | libc.Int32FromInt32(WHERE_INDEXED)) + } + } + } + /* Full scan via index */ + if b != 0 || !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) || (*TIndex)(unsafe.Pointer(pProbe)).FpPartIdxWhere != uintptr(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 || *(*TBitmask)(unsafe.Pointer(bp + 168)) == uint64(0) && int32(uint32(*(*uint16)(unsafe.Pointer(pProbe + 100))&0x4>>2)) == 0 && int32((*TIndex)(unsafe.Pointer(pProbe)).FszIdxRow) < int32((*TTable)(unsafe.Pointer(pTab)).FszTabRow) && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_ONEPASS_DESIRED) == 0 && _sqlite3Config.FbUseCis != 0 && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_CoverIdxScan)) == uint32(0) { + if b != 0 { + v6 = iSortIdx + } else { + v6 = 0 + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = uint8(v6) + /* The cost of visiting the index rows is N*K, where K is + ** between 1.1 and 3.0, depending on the relative sizes of the + ** index and table rows. */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = int16(int32(rSize) + int32(1) + int32(15)*int32((*TIndex)(unsafe.Pointer(pProbe)).FszIdxRow)/int32((*TTable)(unsafe.Pointer(pTab)).FszTabRow)) + if *(*TBitmask)(unsafe.Pointer(bp + 168)) != uint64(0) { + /* If this is a non-covering index scan, add in the cost of + ** doing table lookups. The cost will be 3x the number of + ** lookups. Take into account WHERE clause terms that can be + ** satisfied using just the index, and that do not require a + ** table lookup. */ + nLookup = int16(int32(rSize) + int32(16)) + iCur = (*TSrcItem)(unsafe.Pointer(pSrc)).FiCursor + pWC2 = pWInfo + 104 + ii = 0 + for { + if !(ii < (*TWhereClause)(unsafe.Pointer(pWC2)).FnTerm) { + break + } + pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC2)).Fa + uintptr(ii)*56 + if !(_sqlite3ExprCoveredByIndex(tls, (*TWhereTerm)(unsafe.Pointer(pTerm1)).FpExpr, iCur, pProbe) != 0) { + break + } + /* pTerm can be evaluated using just the index. So reduce + ** the expected number of table lookups accordingly */ + if int32((*TWhereTerm)(unsafe.Pointer(pTerm1)).FtruthProb) <= 0 { + nLookup = TLogEst(int32(nLookup) + int32((*TWhereTerm)(unsafe.Pointer(pTerm1)).FtruthProb)) + } else { + nLookup-- + if int32((*TWhereTerm)(unsafe.Pointer(pTerm1)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0 { + nLookup = TLogEst(int32(nLookup) - libc.Int32FromInt32(19)) + } + } + goto _7 + _7: + ; + ii++ + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) + } + _whereLoopOutputAdjust(tls, pWC, pNew, rSize) + if int32((*TSrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype)&int32(JT_RIGHT) != 0 && (*TIndex)(unsafe.Pointer(pProbe)).FaColExpr != 0 { + /* Do not do an SCAN of a index-on-expression in a RIGHT JOIN + ** because the cursor used to access the index might not be + ** positioned to the correct row during the right-join no-match + ** loop. */ + } else { + rc = _whereLoopInsert(tls, pBuilder, pNew) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + if rc != 0 { + break + } + } + } + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FbldFlags1 = uint8(0) + rc = _whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, 0) + if int32((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FbldFlags1) == int32(SQLITE_BLDF1_INDEXED) { + /* If a non-unique index is used, or if a prefix of the key for + ** unique index is used (making the index functionally non-unique) + ** then the sqlite_stat1 data becomes important for scoring the + ** plan */ + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_StatsUsed) + } + _sqlite3Stat4ProbeFree(tls, (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec) + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = 0 + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) + goto _4 + _4: + ; + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x2>>1)) != 0 { + v8 = uintptr(0) + } else { + v8 = (*TIndex)(unsafe.Pointer(pProbe)).FpNext + } + pProbe = v8 + iSortIdx++ + } + return rc +} + +// C documentation +// +// /* +// ** Return true if pTerm is a virtual table LIMIT or OFFSET term. +// */ +func _isLimitTerm(tls *libc.TLS, pTerm uintptr) (r int32) { + return libc.BoolInt32(int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) >= int32(SQLITE_INDEX_CONSTRAINT_LIMIT) && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp) <= int32(SQLITE_INDEX_CONSTRAINT_OFFSET)) +} + +// C documentation +// +// /* +// ** Argument pIdxInfo is already populated with all constraints that may +// ** be used by the virtual table identified by pBuilder->pNew->iTab. This +// ** function marks a subset of those constraints usable, invokes the +// ** xBestIndex method and adds the returned plan to pBuilder. +// ** +// ** A constraint is marked usable if: +// ** +// ** * Argument mUsable indicates that its prerequisites are available, and +// ** +// ** * It is not one of the operators specified in the mExclude mask passed +// ** as the fourth argument (which in practice is either WO_IN or 0). +// ** +// ** Argument mPrereq is a mask of tables that must be scanned before the +// ** virtual table in question. These are added to the plans prerequisites +// ** before it is added to pBuilder. +// ** +// ** Output parameter *pbIn is set to true if the plan added to pBuilder +// ** uses one or more WO_IN terms, or false otherwise. +// */ +func _whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUsable TBitmask, mExclude Tu16, pIdxInfo uintptr, mNoOmit Tu16, pbIn uintptr, pbRetryLimit uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iTerm, j, mxTerm, nConstraint, rc, v3, v7 int32 + var pHidden, pIdxCons, pNew, pParse, pSrc, pTerm, pTerm1, pUsage, pWC, p4 uintptr + var v5 uint32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, iTerm, j, mxTerm, nConstraint, pHidden, pIdxCons, pNew, pParse, pSrc, pTerm, pTerm1, pUsage, pWC, rc, v3, v5, v7, p4 + pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + pHidden = pIdxInfo + 1*96 + pUsage = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + rc = SQLITE_OK + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + pParse = (*TWhereInfo)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpParse + pSrc = (*TWhereInfo)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 + nConstraint = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint + *(*int32)(unsafe.Pointer(pbIn)) = 0 + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq + /* Set the usable flag on the subset of constraints identified by + ** arguments mUsable and mExclude. */ + pIdxCons = *(*uintptr)(unsafe.Pointer(pIdxInfo + 8)) + i = 0 + for { + if !(i < nConstraint) { + break + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset)*56 + (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable = uint8(0) + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight&mUsable == (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight && int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(mExclude) == 0 && (pbRetryLimit != 0 || !(_isLimitTerm(tls, pTerm) != 0)) { + (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable = uint8(1) + } + goto _1 + _1: + ; + i++ + pIdxCons += 12 + } + /* Initialize the output fields of the sqlite3_index_info structure */ + libc.Xmemset(tls, pUsage, 0, uint64(8)*uint64(nConstraint)) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = uintptr(0) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 0 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1e+99) / libc.Float64FromInt32(2) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(25) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = 0 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed = uint64(int64((*TSrcItem)(unsafe.Pointer(pSrc)).FcolUsed)) + (*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FmHandleIn = uint32(0) + /* Invoke the virtual table xBestIndex() method */ + rc = _vtabBestIndex(tls, pParse, (*TSrcItem)(unsafe.Pointer(pSrc)).FpTab, pIdxInfo) + if rc != 0 { + if rc == int32(SQLITE_CONSTRAINT) { + /* If the xBestIndex method returns SQLITE_CONSTRAINT, that means + ** that the particular combination of parameters provided is unusable. + ** Make no entries in the loop table. + */ + return SQLITE_OK + } + return rc + } + mxTerm = -int32(1) + libc.Xmemset(tls, (*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm, 0, uint64(8)*uint64(nConstraint)) + libc.Xmemset(tls, pNew+24, 0, uint64(24)) + pIdxCons = *(*uintptr)(unsafe.Pointer(pIdxInfo + 8)) + i = 0 + for { + if !(i < nConstraint) { + break + } + v3 = (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer(pUsage + uintptr(i)*8))).FargvIndex - libc.Int32FromInt32(1) + iTerm = v3 + if v3 >= 0 { + j = (*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset + if iTerm >= nConstraint || j < 0 || j >= (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm || *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22463, libc.VaList(bp+8, (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + return int32(SQLITE_ERROR) + } + pTerm1 = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56 + *(*TBitmask)(unsafe.Pointer(pNew)) |= (*TWhereTerm)(unsafe.Pointer(pTerm1)).FprereqRight + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) = pTerm1 + if iTerm > mxTerm { + mxTerm = iTerm + } + if (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer(pUsage + uintptr(i)*8))).Fomit != 0 { + if i < int32(16) && int32(1)<>0)) != 0 { + Xsqlite3_free(tls, (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pNew + 24))).FidxStr) + libc.SetBitFieldPtr8Uint32(pNew+24+4, libc.Uint32FromInt32(0), 0, 0x1) + } + return rc +} + +// C documentation +// +// /* +// ** Return the collating sequence for a constraint passed into xBestIndex. +// ** +// ** pIdxInfo must be an sqlite3_index_info structure passed into xBestIndex. +// ** This routine depends on there being a HiddenIndexInfo structure immediately +// ** following the sqlite3_index_info structure. +// ** +// ** Return a pointer to the collation name: +// ** +// ** 1. If there is an explicit COLLATE operator on the constraint, return it. +// ** +// ** 2. Else, if the column has an alternative collation, return that. +// ** +// ** 3. Otherwise, return "BINARY". +// */ +func Xsqlite3_vtab_collation(tls *libc.TLS, pIdxInfo uintptr, iCons int32) (r uintptr) { + var iTerm int32 + var pC, pHidden, pX, zRet, v1 uintptr + _, _, _, _, _, _ = iTerm, pC, pHidden, pX, zRet, v1 + pHidden = pIdxInfo + 1*96 + zRet = uintptr(0) + if iCons >= 0 && iCons < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { + pC = uintptr(0) + iTerm = (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset + pX = (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FpWC)).Fa + uintptr(iTerm)*56))).FpExpr + if (*TExpr)(unsafe.Pointer(pX)).FpLeft != 0 { + pC = _sqlite3ExprCompareCollSeq(tls, (*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FpParse, pX) + } + if pC != 0 { + v1 = (*TCollSeq)(unsafe.Pointer(pC)).FzName + } else { + v1 = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } + zRet = v1 + } + return zRet +} + +// C documentation +// +// /* +// ** Return true if constraint iCons is really an IN(...) constraint, or +// ** false otherwise. If iCons is an IN(...) constraint, set (if bHandle!=0) +// ** or clear (if bHandle==0) the flag to handle it using an iterator. +// */ +func Xsqlite3_vtab_in(tls *libc.TLS, pIdxInfo uintptr, iCons int32, bHandle int32) (r int32) { + var m Tu32 + var pHidden uintptr + var v1 uint32 + _, _, _ = m, pHidden, v1 + pHidden = pIdxInfo + 1*96 + if iCons <= int32(31) { + v1 = libc.Uint32FromInt32(1) << iCons + } else { + v1 = uint32(0) + } + m = v1 + if m&(*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FmIn != 0 { + if bHandle == 0 { + *(*Tu32)(unsafe.Pointer(pHidden + 24)) &= ^m + } else { + if bHandle > 0 { + *(*Tu32)(unsafe.Pointer(pHidden + 24)) |= m + } + } + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** This interface is callable from within the xBestIndex callback only. +// ** +// ** If possible, set (*ppVal) to point to an object containing the value +// ** on the right-hand-side of constraint iCons. +// */ +func Xsqlite3_vtab_rhs_value(tls *libc.TLS, pIdxInfo uintptr, iCons int32, ppVal uintptr) (r int32) { + var pH, pTerm, pVal uintptr + var rc int32 + _, _, _, _ = pH, pTerm, pVal, rc + pH = pIdxInfo + 1*96 + pVal = uintptr(0) + rc = SQLITE_OK + if iCons < 0 || iCons >= (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint { + rc = _sqlite3MisuseError(tls, int32(165251)) /* EV: R-30545-25046 */ + } else { + if *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) == uintptr(0) { + pTerm = (*TWhereClause)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12))).FiTermOffset)*56 + rc = _sqlite3ValueFromExpr(tls, (*TParse)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpParse)).Fdb, (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight, (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*THiddenIndexInfo)(unsafe.Pointer(pH)).FpParse)).Fdb)).Fenc, uint8(SQLITE_AFF_BLOB), pH+32+uintptr(iCons)*8) + } + pVal = *(*uintptr)(unsafe.Pointer(pH + 32 + uintptr(iCons)*8)) + } + *(*uintptr)(unsafe.Pointer(ppVal)) = pVal + if rc == SQLITE_OK && pVal == uintptr(0) { /* IMP: R-19933-32160 */ + rc = int32(SQLITE_NOTFOUND) /* IMP: R-36424-56542 */ + } + return rc +} + +// C documentation +// +// /* +// ** Return true if ORDER BY clause may be handled as DISTINCT. +// */ +func Xsqlite3_vtab_distinct(tls *libc.TLS, pIdxInfo uintptr) (r int32) { + var pHidden uintptr + _ = pHidden + pHidden = pIdxInfo + 1*96 + return (*THiddenIndexInfo)(unsafe.Pointer(pHidden)).FeDistinct +} + +// C documentation +// +// /* +// ** Cause the prepared statement that is associated with a call to +// ** xBestIndex to potentially use all schemas. If the statement being +// ** prepared is read-only, then just start read transactions on all +// ** schemas. But if this is a write operation, start writes on all +// ** schemas. +// ** +// ** This is used by the (built-in) sqlite_dbpage virtual table. +// */ +func _sqlite3VtabUsesAllSchemas(tls *libc.TLS, pParse uintptr) { + var i, nDb int32 + _, _ = i, nDb + nDb = (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FnDb + i = 0 + for { + if !(i < nDb) { + break + } + _sqlite3CodeVerifySchema(tls, pParse, i) + goto _1 + _1: + ; + i++ + } + if (*TParse)(unsafe.Pointer(pParse)).FwriteMask != uint32(0) { + i = 0 + for { + if !(i < nDb) { + break + } + _sqlite3BeginWriteOperation(tls, pParse, 0, i) + goto _2 + _2: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Add all WhereLoop objects for a table of the join identified by +// ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. +// ** +// ** If there are no LEFT or CROSS JOIN joins in the query, both mPrereq and +// ** mUnusable are set to 0. Otherwise, mPrereq is a mask of all FROM clause +// ** entries that occur before the virtual table in the FROM clause and are +// ** separated from it by at least one LEFT or CROSS JOIN. Similarly, the +// ** mUnusable mask contains all FROM clause entries that occur after the +// ** virtual table and are separated from it by at least one LEFT or +// ** CROSS JOIN. +// ** +// ** For example, if the query were: +// ** +// ** ... FROM t1, t2 LEFT JOIN t3, t4, vt CROSS JOIN t5, t6; +// ** +// ** then mPrereq corresponds to (t1, t2) and mUnusable to (t5, t6). +// ** +// ** All the tables in mPrereq must be scanned before the current virtual +// ** table. So any terms for which all prerequisites are satisfied by +// ** mPrereq may be specified as "usable" in all calls to xBestIndex. +// ** Conversely, all tables in mUnusable must be scanned after the current +// ** virtual table, so any terms for which the prerequisites overlap with +// ** mUnusable should always be configured as "not-usable" for xBestIndex. +// */ +func _whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusable TBitmask) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, nConstraint, rc, seenZero, seenZeroNoIN int32 + var mBest, mBestNoIn, mNext, mPrev, mThis, v1 TBitmask + var p, pNew, pParse, pSrc, pWC, pWInfo uintptr + var v2 bool + var _ /* bIn at bp+0 */ int32 + var _ /* bRetry at bp+8 */ int32 + var _ /* mNoOmit at bp+4 */ Tu16 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, mBest, mBestNoIn, mNext, mPrev, mThis, nConstraint, p, pNew, pParse, pSrc, pWC, pWInfo, rc, seenZero, seenZeroNoIN, v1, v2 + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* True to retry with LIMIT/OFFSET disabled */ + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + pSrc = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 + p = _allocateIndexInfo(tls, pWInfo, pWC, mUnusable, pSrc, bp+4) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = 0 + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_VIRTUALTABLE) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(0) + libc.SetBitFieldPtr8Uint32(pNew+24+4, libc.Uint32FromInt32(0), 0, 0x1) + nConstraint = (*Tsqlite3_index_info)(unsafe.Pointer(p)).FnConstraint + if _whereLoopResize(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pNew, nConstraint) != 0 { + _freeIndexInfo(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p) + return int32(SQLITE_NOMEM) + } + /* First call xBestIndex() with all constraints usable. */ + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) + } + /* If the call to xBestIndex() with all terms enabled produced a plan + ** that does not require any source tables (IOW: a plan with mBest==0) + ** and does not use an IN(...) operator, then there is no point in making + ** any further calls to xBestIndex() since they will all return the same + ** result (if the xBestIndex() implementation is sane). */ + if v2 = rc == SQLITE_OK; v2 { + v1 = (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq & ^mPrereq + mBest = v1 + } + if v2 && (v1 != uint64(0) || *(*int32)(unsafe.Pointer(bp)) != 0) { + seenZero = 0 /* True if a plan with no prereqs seen */ + seenZeroNoIN = 0 /* Plan with no prereqs and no IN(...) seen */ + mPrev = uint64(0) + mBestNoIn = uint64(0) + /* If the plan produced by the earlier call uses an IN(...) term, call + ** xBestIndex again, this time with IN(...) terms disabled. */ + if *(*int32)(unsafe.Pointer(bp)) != 0 { + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, uint64(-libc.Int32FromInt32(1)), uint16(WO_IN), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) + mBestNoIn = (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq & ^mPrereq + if mBestNoIn == uint64(0) { + seenZero = int32(1) + seenZeroNoIN = int32(1) + } + } + /* Call xBestIndex once for each distinct value of (prereqRight & ~mPrereq) + ** in the set of terms that apply to the current virtual table. */ + for rc == SQLITE_OK { + mNext = uint64(-libc.Int32FromInt32(1)) + i = 0 + for { + if !(i < nConstraint) { + break + } + mThis = (*(*TWhereTerm)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(p)).FaConstraint + uintptr(i)*12))).FiTermOffset)*56))).FprereqRight & ^mPrereq + if mThis > mPrev && mThis < mNext { + mNext = mThis + } + goto _3 + _3: + ; + i++ + } + mPrev = mNext + if mNext == uint64(-libc.Int32FromInt32(1)) { + break + } + if mNext == mBest || mNext == mBestNoIn { + continue + } + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, mNext|mPrereq, uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) + if (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq == mPrereq { + seenZero = int32(1) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + seenZeroNoIN = int32(1) + } + } + } + /* If the calls to xBestIndex() in the above loop did not find a plan + ** that requires no source tables at all (i.e. one guaranteed to be + ** usable), make a call here with all source tables disabled */ + if rc == SQLITE_OK && seenZero == 0 { + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, mPrereq, uint16(0), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + seenZeroNoIN = int32(1) + } + } + /* If the calls to xBestIndex() have so far failed to find a plan + ** that requires no source tables at all and does not use an IN(...) + ** operator, make a final call to obtain one here. */ + if rc == SQLITE_OK && seenZeroNoIN == 0 { + rc = _whereLoopAddVirtualOne(tls, pBuilder, mPrereq, mPrereq, uint16(WO_IN), p, *(*Tu16)(unsafe.Pointer(bp + 4)), bp, uintptr(0)) + } + } + if (*Tsqlite3_index_info)(unsafe.Pointer(p)).FneedToFreeIdxStr != 0 { + Xsqlite3_free(tls, (*Tsqlite3_index_info)(unsafe.Pointer(p)).FidxStr) + } + _freeIndexInfo(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, p) + return rc +} + +// C documentation +// +// /* +// ** Add WhereLoop entries to handle OR terms. This works for either +// ** btrees or virtual tables. +// */ +func _whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq TBitmask, mUnusable TBitmask) (r int32) { + bp := tls.Alloc(720) + defer tls.Free(720) + var i, iCur, j, once, rc int32 + var pItem, pNew, pOrTerm, pOrWC, pOrWCEnd, pTerm, pWC, pWCEnd, pWInfo uintptr + var _ /* sCur at bp+600 */ TWhereOrSet + var _ /* sPrev at bp+656 */ TWhereOrSet + var _ /* sSubBuild at bp+488 */ TWhereLoopBuilder + var _ /* sSum at bp+544 */ TWhereOrSet + var _ /* tempWC at bp+0 */ TWhereClause + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, iCur, j, once, pItem, pNew, pOrTerm, pOrWC, pOrWCEnd, pTerm, pWC, pWCEnd, pWInfo, rc + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + rc = SQLITE_OK + pWC = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + pWCEnd = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pWC)).FnTerm)*56 + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + libc.Xmemset(tls, bp+544, 0, uint64(56)) + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pNew)).FiTab)*104 + iCur = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + /* The multi-index OR optimization does not work for RIGHT and FULL JOIN */ + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_RIGHT) != 0 { + return SQLITE_OK + } + pTerm = (*TWhereClause)(unsafe.Pointer(pWC)).Fa + for { + if !(pTerm < pWCEnd && rc == SQLITE_OK) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&int32(WO_OR) != 0 && (*TWhereOrInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32)))).Findexable&(*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf != uint64(0) { + pOrWC = *(*uintptr)(unsafe.Pointer(pTerm + 32)) + pOrWCEnd = (*TWhereClause)(unsafe.Pointer(pOrWC)).Fa + uintptr((*TWhereClause)(unsafe.Pointer(pOrWC)).FnTerm)*56 + once = int32(1) + *(*TWhereLoopBuilder)(unsafe.Pointer(bp + 488)) = *(*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)) + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp + 488))).FpOrSet = bp + 600 + pOrTerm = (*TWhereClause)(unsafe.Pointer(pOrWC)).Fa + for { + if !(pOrTerm < pOrWCEnd) { + break + } + if int32((*TWhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator)&int32(WO_AND) != 0 { + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp + 488))).FpWC = *(*uintptr)(unsafe.Pointer(pOrTerm + 32)) + } else { + if (*TWhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur { + (*(*TWhereClause)(unsafe.Pointer(bp))).FpWInfo = (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo + (*(*TWhereClause)(unsafe.Pointer(bp))).FpOuter = pWC + (*(*TWhereClause)(unsafe.Pointer(bp))).Fop = uint8(TK_AND) + (*(*TWhereClause)(unsafe.Pointer(bp))).FnTerm = int32(1) + (*(*TWhereClause)(unsafe.Pointer(bp))).FnBase = int32(1) + (*(*TWhereClause)(unsafe.Pointer(bp))).Fa = pOrTerm + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp + 488))).FpWC = bp + } else { + goto _2 + } + } + (*(*TWhereOrSet)(unsafe.Pointer(bp + 600))).Fn = uint16(0) + if int32((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FeTabType) == int32(TABTYP_VTAB) { + rc = _whereLoopAddVirtual(tls, bp+488, mPrereq, mUnusable) + } else { + rc = _whereLoopAddBtree(tls, bp+488, mPrereq) + } + if rc == SQLITE_OK { + rc = _whereLoopAddOr(tls, bp+488, mPrereq, mUnusable) + } + if int32((*(*TWhereOrSet)(unsafe.Pointer(bp + 600))).Fn) == 0 { + (*(*TWhereOrSet)(unsafe.Pointer(bp + 544))).Fn = uint16(0) + break + } else { + if once != 0 { + _whereOrMove(tls, bp+544, bp+600) + once = 0 + } else { + _whereOrMove(tls, bp+656, bp+544) + (*(*TWhereOrSet)(unsafe.Pointer(bp + 544))).Fn = uint16(0) + i = 0 + for { + if !(i < int32((*(*TWhereOrSet)(unsafe.Pointer(bp + 656))).Fn)) { + break + } + j = 0 + for { + if !(j < int32((*(*TWhereOrSet)(unsafe.Pointer(bp + 600))).Fn)) { + break + } + _whereOrInsert(tls, bp+544, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).Fprereq|(*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).Fprereq, _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FrRun, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FrRun), _sqlite3LogEstAdd(tls, (*(*TWhereOrCost)(unsafe.Pointer(bp + 656 + 8 + uintptr(i)*16))).FnOut, (*(*TWhereOrCost)(unsafe.Pointer(bp + 600 + 8 + uintptr(j)*16))).FnOut)) + goto _4 + _4: + ; + j++ + } + goto _3 + _3: + ; + i++ + } + } + } + goto _2 + _2: + ; + pOrTerm += 56 + } + (*TWhereLoop)(unsafe.Pointer(pNew)).FnLTerm = uint16(1) + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pNew)).FaLTerm)) = pTerm + (*TWhereLoop)(unsafe.Pointer(pNew)).FwsFlags = uint32(WHERE_MULTI_OR) + (*TWhereLoop)(unsafe.Pointer(pNew)).FrSetup = 0 + (*TWhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = uint8(0) + libc.Xmemset(tls, pNew+24, 0, uint64(24)) + i = 0 + for { + if !(rc == SQLITE_OK && i < int32((*(*TWhereOrSet)(unsafe.Pointer(bp + 544))).Fn)) { + break + } + /* TUNING: Currently sSum.a[i].rRun is set to the sum of the costs + ** of all sub-scans required by the OR-scan. However, due to rounding + ** errors, it may be that the cost of the OR-scan is equal to its + ** most expensive sub-scan. Add the smallest possible penalty + ** (equivalent to multiplying the cost by 1.07) to ensure that + ** this does not happen. Otherwise, for WHERE clauses such as the + ** following where there is an index on "y": + ** + ** WHERE likelihood(x=?, 0.99) OR y=? + ** + ** the planner may elect to "OR" together a full-table scan and an + ** index lookup. And other similarly odd results. */ + (*TWhereLoop)(unsafe.Pointer(pNew)).FrRun = int16(int32((*(*TWhereOrCost)(unsafe.Pointer(bp + 544 + 8 + uintptr(i)*16))).FrRun) + int32(1)) + (*TWhereLoop)(unsafe.Pointer(pNew)).FnOut = (*(*TWhereOrCost)(unsafe.Pointer(bp + 544 + 8 + uintptr(i)*16))).FnOut + (*TWhereLoop)(unsafe.Pointer(pNew)).Fprereq = (*(*TWhereOrCost)(unsafe.Pointer(bp + 544 + 8 + uintptr(i)*16))).Fprereq + rc = _whereLoopInsert(tls, pBuilder, pNew) + goto _5 + _5: + ; + i++ + } + } + goto _1 + _1: + ; + pTerm += 56 + } + return rc +} + +// C documentation +// +// /* +// ** Add all WhereLoop objects for all tables +// */ +func _whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) (r int32) { + var bFirstPastRJ, hasRightJoin, iTab, rc int32 + var db, p, pEnd, pItem, pNew, pTabList, pWInfo uintptr + var mPrereq, mPrior, mUnusable TBitmask + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bFirstPastRJ, db, hasRightJoin, iTab, mPrereq, mPrior, mUnusable, p, pEnd, pItem, pNew, pTabList, pWInfo, rc + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + mPrereq = uint64(0) + mPrior = uint64(0) + pTabList = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + pEnd = pTabList + 8 + uintptr((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)*104 + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb + rc = SQLITE_OK + bFirstPastRJ = 0 + hasRightJoin = 0 + /* Loop over the tables in the join, from left to right */ + pNew = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + /* Verify that pNew has already been initialized */ + (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit = uint32(SQLITE_QUERY_PLANNER_LIMIT) + iTab = 0 + pItem = pTabList + 8 + for { + if !(pItem < pEnd) { + break + } + mUnusable = uint64(0) + (*TWhereLoop)(unsafe.Pointer(pNew)).FiTab = uint8(iTab) + *(*uint32)(unsafe.Pointer(pBuilder + 48)) += uint32(SQLITE_QUERY_PLANNER_LIMIT_INCR) + (*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf = _sqlite3WhereGetMask(tls, pWInfo+592, (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor) + if bFirstPastRJ != 0 || int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_CROSS)|libc.Int32FromInt32(JT_LTORJ)) != 0 { + /* Add prerequisites to prevent reordering of FROM clause terms + ** across CROSS joins and outer joins. The bFirstPastRJ boolean + ** prevents the right operand of a RIGHT JOIN from being swapped with + ** other elements even further to the right. + ** + ** The JT_LTORJ case and the hasRightJoin flag work together to + ** prevent FROM-clause terms from moving from the right side of + ** a LEFT JOIN over to the left side of that join if the LEFT JOIN + ** is itself on the left side of a RIGHT JOIN. + */ + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { + hasRightJoin = int32(1) + } + mPrereq |= mPrior + bFirstPastRJ = libc.BoolInt32(int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&int32(JT_RIGHT) != 0) + } else { + if !(hasRightJoin != 0) { + mPrereq = uint64(0) + } + } + if int32((*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpTab)).FeTabType) == int32(TABTYP_VTAB) { + p = pItem + 1*104 + for { + if !(p < pEnd) { + break + } + if mUnusable != 0 || int32((*TSrcItem)(unsafe.Pointer(p)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_OUTER)|libc.Int32FromInt32(JT_CROSS)) != 0 { + mUnusable |= _sqlite3WhereGetMask(tls, pWInfo+592, (*TSrcItem)(unsafe.Pointer(p)).FiCursor) + } + goto _2 + _2: + ; + p += 104 + } + rc = _whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) + } else { + rc = _whereLoopAddBtree(tls, pBuilder, mPrereq) + } + if rc == SQLITE_OK && (*TWhereClause)(unsafe.Pointer((*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC)).FhasOr != 0 { + rc = _whereLoopAddOr(tls, pBuilder, mPrereq, mUnusable) + } + mPrior |= (*TWhereLoop)(unsafe.Pointer(pNew)).FmaskSelf + if rc != 0 || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if rc == int32(SQLITE_DONE) { + /* We hit the query planner search limit set by iPlanLimit */ + Xsqlite3_log(tls, int32(SQLITE_WARNING), __ccgo_ts+22489, 0) + rc = SQLITE_OK + } else { + break + } + } + goto _1 + _1: + ; + iTab++ + pItem += 104 + } + _whereLoopClear(tls, db, pNew) + return rc +} + +// C documentation +// +// /* +// ** Examine a WherePath (with the addition of the extra WhereLoop of the 6th +// ** parameters) to see if it outputs rows in the requested ORDER BY +// ** (or GROUP BY) without requiring a separate sort operation. Return N: +// ** +// ** N>0: N terms of the ORDER BY clause are satisfied +// ** N==0: No terms of the ORDER BY clause are satisfied +// ** N<0: Unknown yet how many terms of ORDER BY might be satisfied. +// ** +// ** Note that processing for WHERE_GROUPBY and WHERE_DISTINCTBY is not as +// ** strict. With GROUP BY and DISTINCT the only requirement is that +// ** equivalent rows appear immediately adjacent to one another. GROUP BY +// ** and DISTINCT do not require rows to appear in any particular order as long +// ** as equivalent rows are grouped together. Thus for GROUP BY and DISTINCT +// ** the pOrderBy terms can be matched in any order. With ORDER BY, the +// ** pOrderBy terms must be matched in strict left-to-right order. +// */ +func _wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, pPath uintptr, wctrlFlags Tu16, nLoop Tu16, pLast uintptr, pRevMask uintptr) (r Ti8) { + var bOnce, distinctColumns, isMatch, isOrderDistinct, rev, revIdx, revSet, v5 Tu8 + var db, p, pColl, pColl1, pColl2, pIndex, pIxExpr, pLoop, pOBExpr, pParse, pTerm, pX, v4 uintptr + var eOp, eqOpMask, nColumn, nKeyCol, nOrderBy Tu16 + var i, iColumn, iCur, iLoop, j int32 + var m, mTerm, obDone, obSat, orderDistinctMask, ready TBitmask + var v11 uint64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bOnce, db, distinctColumns, eOp, eqOpMask, i, iColumn, iCur, iLoop, isMatch, isOrderDistinct, j, m, mTerm, nColumn, nKeyCol, nOrderBy, obDone, obSat, orderDistinctMask, p, pColl, pColl1, pColl2, pIndex, pIxExpr, pLoop, pOBExpr, pParse, pTerm, pX, ready, rev, revIdx, revSet, v11, v4, v5 /* A column number within table iCur */ + pLoop = uintptr(0) /* The index associated with pLoop */ + db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb /* Database connection */ + obSat = uint64(0) /* Mask of inner loops */ + /* + ** We say the WhereLoop is "one-row" if it generates no more than one + ** row of output. A WhereLoop is one-row if all of the following are true: + ** (a) All index columns match with WHERE_COLUMN_EQ. + ** (b) The index is unique + ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row. + ** Every one-row WhereLoop will have the WHERE_ONEROW bit set in wsFlags. + ** + ** We say the WhereLoop is "order-distinct" if the set of columns from + ** that WhereLoop that are in the ORDER BY clause are different for every + ** row of the WhereLoop. Every one-row WhereLoop is automatically + ** order-distinct. A WhereLoop that has no columns in the ORDER BY clause + ** is not order-distinct. To be order-distinct is not quite the same as being + ** UNIQUE since a UNIQUE column or index can have multiple rows that + ** are NULL and NULL values are equivalent for the purpose of order-distinct. + ** To be order-distinct, the columns must be UNIQUE and NOT NULL. + ** + ** The rowid for a table is always UNIQUE and NOT NULL so whenever the + ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is + ** automatically order-distinct. + */ + if nLoop != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OrderByIdxJoin)) != uint32(0) { + return 0 + } + nOrderBy = uint16((*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) + if int32(nOrderBy) > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8))-libc.Int32FromInt32(1) { + return 0 + } /* Cannot optimize overly large ORDER BYs */ + isOrderDistinct = uint8(1) + obDone = libc.Uint64FromInt32(1)< 0 { + ready |= (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf + } + if iLoop < int32(nLoop) { + pLoop = *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pPath)).FaLoop + uintptr(iLoop)*8)) + if int32(wctrlFlags)&int32(WHERE_ORDERBY_LIMIT) != 0 { + goto _1 + } + } else { + pLoop = pLast + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) != 0 { + if (*(*struct { + FidxNum int32 + F__ccgo4 uint8 + FisOrdered Ti8 + FomitMask Tu16 + FidxStr uintptr + FmHandleIn Tu32 + })(unsafe.Pointer(pLoop + 24))).FisOrdered != 0 && int32(wctrlFlags)&(libc.Int32FromInt32(WHERE_DISTINCTBY)|libc.Int32FromInt32(WHERE_SORTBYGROUP)) != int32(WHERE_DISTINCTBY) { + obSat = obDone + } + break + } else { + if int32(wctrlFlags)&int32(WHERE_DISTINCTBY) != 0 { + (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnDistinctCol = uint16(0) + } + } + iCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pLoop)).FiTab)*104))).FiCursor + /* Mark off any ORDER BY term X that is a column in the table of + ** the current loop for which there is term in the WHERE + ** clause of the form X IS NULL or X=? that reference only outer + ** loops. + */ + i = 0 + for { + if !(i < int32(nOrderBy)) { + break + } + if libc.Uint64FromInt32(1)<= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { + goto _2 + } + } + if int32((*TWhereTerm)(unsafe.Pointer(pTerm)).FeOperator)&(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)) != 0 && int32((*TExpr)(unsafe.Pointer(pOBExpr)).FiColumn) >= 0 { + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + pColl1 = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr) + pColl2 = _sqlite3ExprCompareCollSeq(tls, pParse, (*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr) + if pColl2 == uintptr(0) || _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl1)).FzName, (*TCollSeq)(unsafe.Pointer(pColl2)).FzName) != 0 { + goto _2 + } + } + obSat |= libc.Uint64FromInt32(1) << i + goto _2 + _2: + ; + i++ + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IPK) != 0 { + pIndex = uintptr(0) + nKeyCol = uint16(0) + nColumn = uint16(1) + } else { + v4 = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + pIndex = v4 + if v4 == uintptr(0) || int32(uint32(*(*uint16)(unsafe.Pointer(pIndex + 100))&0x4>>2)) != 0 { + return 0 + } else { + nKeyCol = (*TIndex)(unsafe.Pointer(pIndex)).FnKeyCol + nColumn = (*TIndex)(unsafe.Pointer(pIndex)).FnColumn + /* All relevant terms of the index must also be non-NULL in order + ** for isOrderDistinct to be true. So the isOrderDistint value + ** computed here might be a false positive. Corrections will be + ** made at tag-20210426-1 below */ + isOrderDistinct = libc.BoolUint8(int32((*TIndex)(unsafe.Pointer(pIndex)).FonError) != OE_None && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_SKIPSCAN) == uint32(0)) + } + } + /* Loop through all columns of the index and deal with the ones + ** that are not constrained by == or IN. + */ + v5 = libc.Uint8FromInt32(0) + revSet = v5 + rev = v5 + distinctColumns = uint8(0) + j = 0 + for { + if !(j < int32(nColumn)) { + break + } + bOnce = uint8(1) /* True to run the ORDER BY search loop */ + if j < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) && j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip) { + eOp = (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)))).FeOperator + /* Skip over == and IS and ISNULL terms. (Also skip IN terms when + ** doing WHERE_ORDERBY_LIMIT processing). Except, IS and ISNULL + ** terms imply that the index is not UNIQUE NOT NULL in which case + ** the loop need to be marked as not order-distinct because it can + ** have repeated NULL rows. + ** + ** If the current term is a column of an ((?,?) IN (SELECT...)) + ** expression for which the SELECT returns more than one column, + ** check that it is the only column used by this loop. Otherwise, + ** if it is one of two or more, none of the columns can be + ** considered to match an ORDER BY term. + */ + if int32(eOp)&int32(eqOpMask) != 0 { + if int32(eOp)&(libc.Int32FromInt32(WO_ISNULL)|libc.Int32FromInt32(WO_IS)) != 0 { + isOrderDistinct = uint8(0) + } + goto _6 + } else { + if int32(eOp)&int32(WO_IN) != 0 { + /* ALWAYS() justification: eOp is an equality operator due to the + ** ju.btree.nEq constraint above. Any equality other + ** than WO_IN is captured by the previous "if". So this one + ** always has to be WO_IN. */ + pX = (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)))).FpExpr + i = j + int32(1) + for { + if !(i < int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq)) { + break + } + if (*TWhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + bOnce = uint8(0) + break + } + goto _7 + _7: + ; + i++ + } + } + } + } + /* Get the column number in the table (iColumn) and sort order + ** (revIdx) for the j-th column of the index. + */ + if pIndex != 0 { + iColumn = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(j)*2))) + revIdx = uint8(int32(*(*Tu8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(j)))) & int32(KEYINFO_ORDER_DESC)) + if iColumn == int32((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FiPKey) { + iColumn = -int32(1) + } + } else { + iColumn = -int32(1) + revIdx = uint8(0) + } + /* An unconstrained column that might be NULL means that this + ** WhereLoop is not well-ordered. tag-20210426-1 + */ + if isOrderDistinct != 0 { + if iColumn >= 0 && j >= int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) && int32(uint32(*(*uint8)(unsafe.Pointer((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FpTable)).FaCol + uintptr(iColumn)*16 + 8))&0xf>>0)) == 0 { + isOrderDistinct = uint8(0) + } + if iColumn == -int32(2) { + isOrderDistinct = uint8(0) + } + } + /* Find the ORDER BY term that corresponds to the j-th column + ** of the index and mark that ORDER BY term off + */ + isMatch = uint8(0) + i = 0 + for { + if !(bOnce != 0 && i < int32(nOrderBy)) { + break + } + if libc.Uint64FromInt32(1)<= -int32(1) { + if int32((*TExpr)(unsafe.Pointer(pOBExpr)).Fop) != int32(TK_COLUMN) && int32((*TExpr)(unsafe.Pointer(pOBExpr)).Fop) != int32(TK_AGG_COLUMN) { + goto _8 + } + if (*TExpr)(unsafe.Pointer(pOBExpr)).FiTable != iCur { + goto _8 + } + if int32((*TExpr)(unsafe.Pointer(pOBExpr)).FiColumn) != iColumn { + goto _8 + } + } else { + pIxExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FaColExpr + 8 + uintptr(j)*32))).FpExpr + if _sqlite3ExprCompareSkip(tls, pOBExpr, pIxExpr, iCur) != 0 { + goto _8 + } + } + if iColumn != -int32(1) { + pColl = _sqlite3ExprNNCollSeq(tls, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse, (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).FpExpr) + if _sqlite3StrICmp(tls, (*TCollSeq)(unsafe.Pointer(pColl)).FzName, *(*uintptr)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIndex)).FazColl + uintptr(j)*8))) != 0 { + goto _8 + } + } + if int32(wctrlFlags)&int32(WHERE_DISTINCTBY) != 0 { + (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnDistinctCol = uint16(j + int32(1)) + } + isMatch = uint8(1) + break + goto _8 + _8: + ; + i++ + } + if isMatch != 0 && int32(wctrlFlags)&int32(WHERE_GROUPBY) == 0 { + /* Make sure the sort order is compatible in an ORDER BY clause. + ** Sort order is irrelevant for a GROUP BY clause. */ + if revSet != 0 { + if int32(rev)^int32(revIdx) != int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_DESC) { + isMatch = uint8(0) + } + } else { + rev = uint8(int32(revIdx) ^ int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_DESC)) + if rev != 0 { + *(*TBitmask)(unsafe.Pointer(pRevMask)) |= libc.Uint64FromInt32(1) << iLoop + } + revSet = uint8(1) + } + } + if isMatch != 0 && int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8 + uintptr(i)*32))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_BIGNULL) != 0 { + if j == int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq) { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_BIGNULL_SORT) + } else { + isMatch = uint8(0) + } + } + if isMatch != 0 { + if iColumn == -int32(1) { + distinctColumns = uint8(1) + } + obSat |= libc.Uint64FromInt32(1) << i + } else { + /* No match found */ + if j == 0 || j < int32(nKeyCol) { + isOrderDistinct = uint8(0) + } + break + } + goto _6 + _6: + ; + j++ + } /* end Loop over all index columns */ + if distinctColumns != 0 { + isOrderDistinct = uint8(1) + } + } /* end-if not one-row */ + /* Mark off any other ORDER BY terms that reference pLoop */ + if isOrderDistinct != 0 { + orderDistinctMask |= (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf + i = 0 + for { + if !(i < int32(nOrderBy)) { + break + } + if libc.Uint64FromInt32(1)< 0) { + break + } + if i < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + v11 = libc.Uint64FromInt32(1)<> 3)) +} + +// C documentation +// +// /* +// ** Return the cost of sorting nRow rows, assuming that the keys have +// ** nOrderby columns and that the first nSorted columns are already in +// ** order. +// */ +func _whereSortingCost(tls *libc.TLS, pWInfo uintptr, nRow TLogEst, nOrderBy int32, nSorted int32) (r TLogEst) { + var nCol, rSortCost TLogEst + _, _ = nCol, rSortCost + /* TUNING: sorting cost proportional to the number of output columns: */ + nCol = _sqlite3LogEst(tls, uint64(((*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FpEList)).FnExpr+int32(59))/int32(30))) + rSortCost = int16(int32(nRow) + int32(nCol)) + if nSorted > 0 { + /* Scale the result by (Y/X) */ + rSortCost = TLogEst(int32(rSortCost) + (int32(_sqlite3LogEst(tls, uint64((nOrderBy-nSorted)*int32(100)/nOrderBy))) - libc.Int32FromInt32(66))) + } + /* Multiple by log(M) where M is the number of output rows. + ** Use the LIMIT for M if it is smaller. Or if this sort is for + ** a DISTINCT operator, M will be the number of distinct output + ** rows, so fudge it downwards a bit. + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_USE_LIMIT) != 0 { + rSortCost = TLogEst(int32(rSortCost) + libc.Int32FromInt32(10)) /* TUNING: Extra 2.0x if using LIMIT */ + if nSorted != 0 { + rSortCost = TLogEst(int32(rSortCost) + libc.Int32FromInt32(6)) /* TUNING: Extra 1.5x if also using partial sort */ + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FiLimit) < int32(nRow) { + nRow = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiLimit + } + } else { + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { + /* TUNING: In the sort for a DISTINCT operator, assume that the DISTINCT + ** reduces the number of output rows by a factor of 2 */ + if int32(nRow) > int32(10) { + nRow = TLogEst(int32(nRow) - libc.Int32FromInt32(10)) + } + } + } + rSortCost = TLogEst(int32(rSortCost) + int32(_estLog(tls, nRow))) + return rSortCost +} + +// C documentation +// +// /* +// ** Given the list of WhereLoop objects at pWInfo->pLoops, this routine +// ** attempts to find the lowest cost path that visits each WhereLoop +// ** once. This path is then loaded into the pWInfo->a[].pWLoop fields. +// ** +// ** Assume that the total number of output rows that will need to be sorted +// ** will be nRowEst (in the 10*log2 representation). Or, ignore sorting +// ** costs if nRowEst==0. +// ** +// ** Return SQLITE_OK on success or SQLITE_NOMEM of a memory allocation +// ** error occurs. +// */ +func _wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst TLogEst) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aFrom, aSortCost, aTo, pFrom, pLevel, pParse, pSpace, pTo, pWLoop, pX, v14 uintptr + var iLoop, ii, jj, mxChoice, mxI, nFrom, nLoop, nOrder, nOrderBy, nSpace, nTo, rc, rc1, v1, v10, v2, v4, v5 int32 + var isOrdered Ti8 + var maskNew TBitmask + var mxCost, mxUnsorted, nOut, rCost, rUnsorted TLogEst + var wsFlags Tu32 + var _ /* m at bp+16 */ TBitmask + var _ /* notUsed at bp+8 */ TBitmask + var _ /* revMask at bp+0 */ TBitmask + var _ /* revMask at bp+24 */ TBitmask + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aFrom, aSortCost, aTo, iLoop, ii, isOrdered, jj, maskNew, mxChoice, mxCost, mxI, mxUnsorted, nFrom, nLoop, nOrder, nOrderBy, nOut, nSpace, nTo, pFrom, pLevel, pParse, pSpace, pTo, pWLoop, pX, rCost, rUnsorted, rc, rc1, wsFlags, v1, v10, v14, v2, v4, v5 /* Loop counters */ + mxI = 0 /* Number of ORDER BY clause terms */ + mxCost = 0 /* Maximum cost of a set of paths */ + mxUnsorted = 0 /* Used to divy up the pSpace memory */ + aSortCost = uintptr(0) /* Bytes of space allocated at pSpace */ + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + nLoop = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) + /* TUNING: For simple queries, only the best path is tracked. + ** For 2-way joins, the 5 best paths are followed. + ** For joins of 3 or more tables, track the 10 best paths */ + if nLoop <= int32(1) { + v1 = int32(1) + } else { + if nLoop == int32(2) { + v2 = int32(5) + } else { + v2 = int32(10) + } + v1 = v2 + } + mxChoice = v1 + /* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this + ** case the purpose of this call is to estimate the number of rows returned + ** by the overall query. Once this estimate has been obtained, the caller + ** will invoke this function a second time, passing the estimate as the + ** nRowEst parameter. */ + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy == uintptr(0) || int32(nRowEst) == 0 { + nOrderBy = 0 + } else { + nOrderBy = (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr + } + /* Allocate and initialize space for aTo, aFrom and aSortCost[] */ + nSpace = int32((uint64(32) + uint64(8)*uint64(nLoop)) * uint64(mxChoice) * uint64(2)) + nSpace = int32(uint64(nSpace) + libc.Uint64FromInt64(2)*uint64(nOrderBy)) + pSpace = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(nSpace)) + if pSpace == uintptr(0) { + return int32(SQLITE_NOMEM) + } + aTo = pSpace + aFrom = aTo + uintptr(mxChoice)*32 + libc.Xmemset(tls, aFrom, 0, uint64(32)) + pX = aFrom + uintptr(mxChoice)*32 + ii = mxChoice * int32(2) + pFrom = aTo + for { + if !(ii > 0) { + break + } + (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop = pX + goto _3 + _3: + ; + ii-- + pFrom += 32 + pX += uintptr(nLoop) * 8 + } + if nOrderBy != 0 { + /* If there is an ORDER BY clause and it is not being ignored, set up + ** space for the aSortCost[] array. Each element of the aSortCost array + ** is either zero - meaning it has not yet been initialized - or the + ** cost of sorting nRowEst rows of data where the first X terms of + ** the ORDER BY clause are already in order, where X is the array + ** index. */ + aSortCost = pX + libc.Xmemset(tls, aSortCost, 0, uint64(2)*uint64(nOrderBy)) + } + /* Seed the search with a single WherePath containing zero WhereLoops. + ** + ** TUNING: Do not let the number of iterations go above 28. If the cost + ** of computing an automatic index is not paid back within the first 28 + ** rows, then do not use the automatic index. */ + if int32((*TParse)(unsafe.Pointer(pParse)).FnQueryLoop) < int32(48) { + v4 = int32((*TParse)(unsafe.Pointer(pParse)).FnQueryLoop) + } else { + v4 = int32(48) + } + (*(*TWherePath)(unsafe.Pointer(aFrom))).FnRow = int16(v4) + nFrom = int32(1) + if nOrderBy != 0 { + /* If nLoop is zero, then there are no FROM terms in the query. Since + ** in this case the query may return a maximum of one row, the results + ** are already in the requested order. Set isOrdered to nOrderBy to + ** indicate this. Or, if nLoop is greater than zero, set isOrdered to + ** -1, indicating that the result set may or may not be ordered, + ** depending on the loops added to the current plan. */ + if nLoop > 0 { + v5 = -int32(1) + } else { + v5 = nOrderBy + } + (*(*TWherePath)(unsafe.Pointer(aFrom))).FisOrdered = int8(v5) + } + /* Compute successively longer WherePaths using the previous generation + ** of WherePaths as the basis for the next. Keep track of the mxChoice + ** best paths at each generation */ + iLoop = 0 + for { + if !(iLoop < nLoop) { + break + } + nTo = 0 + ii = 0 + pFrom = aFrom + for { + if !(ii < nFrom) { + break + } + pWLoop = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops + for { + if !(pWLoop != 0) { + break + } /* Mask of rev-order loops for (..) */ + if (*TWhereLoop)(unsafe.Pointer(pWLoop)).Fprereq & ^(*TWherePath)(unsafe.Pointer(pFrom)).FmaskLoop != uint64(0) { + goto _8 + } + if (*TWhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf&(*TWherePath)(unsafe.Pointer(pFrom)).FmaskLoop != uint64(0) { + goto _8 + } + if (*TWhereLoop)(unsafe.Pointer(pWLoop)).FwsFlags&uint32(WHERE_AUTO_INDEX) != uint32(0) && int32((*TWherePath)(unsafe.Pointer(pFrom)).FnRow) < int32(3) { + /* Do not use an automatic index if the this loop is expected + ** to run less than 1.25 times. It is tempting to also exclude + ** automatic index usage on an outer loop, but sometimes an automatic + ** index is useful in the outer loop of a correlated subquery. */ + goto _8 + } + /* At this point, pWLoop is a candidate to be the next loop. + ** Compute its cost */ + rUnsorted = _sqlite3LogEstAdd(tls, (*TWhereLoop)(unsafe.Pointer(pWLoop)).FrSetup, int16(int32((*TWhereLoop)(unsafe.Pointer(pWLoop)).FrRun)+int32((*TWherePath)(unsafe.Pointer(pFrom)).FnRow))) + rUnsorted = _sqlite3LogEstAdd(tls, rUnsorted, (*TWherePath)(unsafe.Pointer(pFrom)).FrUnsorted) + nOut = int16(int32((*TWherePath)(unsafe.Pointer(pFrom)).FnRow) + int32((*TWhereLoop)(unsafe.Pointer(pWLoop)).FnOut)) + maskNew = (*TWherePath)(unsafe.Pointer(pFrom)).FmaskLoop | (*TWhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf + isOrdered = (*TWherePath)(unsafe.Pointer(pFrom)).FisOrdered + if int32(isOrdered) < 0 { + *(*TBitmask)(unsafe.Pointer(bp)) = uint64(0) + isOrdered = _wherePathSatisfiesOrderBy(tls, pWInfo, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags, uint16(iLoop), pWLoop, bp) + } else { + *(*TBitmask)(unsafe.Pointer(bp)) = (*TWherePath)(unsafe.Pointer(pFrom)).FrevLoop + } + if int32(isOrdered) >= 0 && int32(isOrdered) < nOrderBy { + if int32(*(*TLogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2))) == 0 { + *(*TLogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2)) = _whereSortingCost(tls, pWInfo, nRowEst, nOrderBy, int32(isOrdered)) + } + /* TUNING: Add a small extra penalty (3) to sorting as an + ** extra encouragement to the query planner to select a plan + ** where the rows emerge in the correct order without any sorting + ** required. */ + rCost = int16(int32(_sqlite3LogEstAdd(tls, rUnsorted, *(*TLogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2)))) + int32(3)) + } else { + rCost = rUnsorted + rUnsorted = TLogEst(int32(rUnsorted) - libc.Int32FromInt32(2)) /* TUNING: Slight bias in favor of no-sort plans */ + } + /* Check to see if pWLoop should be added to the set of + ** mxChoice best-so-far paths. + ** + ** First look for an existing path among best-so-far paths + ** that covers the same set of loops and has the same isOrdered + ** setting as the current path candidate. + ** + ** The term "((pTo->isOrdered^isOrdered)&0x80)==0" is equivalent + ** to (pTo->isOrdered==(-1))==(isOrdered==(-1))" for the range + ** of legal values for isOrdered, -1..64. + */ + jj = 0 + pTo = aTo + for { + if !(jj < nTo) { + break + } + if (*TWherePath)(unsafe.Pointer(pTo)).FmaskLoop == maskNew && (int32((*TWherePath)(unsafe.Pointer(pTo)).FisOrdered)^int32(isOrdered))&int32(0x80) == 0 { + break + } + goto _9 + _9: + ; + jj++ + pTo += 32 + } + if jj >= nTo { + /* None of the existing best-so-far paths match the candidate. */ + if nTo >= mxChoice && (int32(rCost) > int32(mxCost) || int32(rCost) == int32(mxCost) && int32(rUnsorted) >= int32(mxUnsorted)) { + /* The current candidate is no better than any of the mxChoice + ** paths currently in the best-so-far buffer. So discard + ** this candidate as not viable. */ + goto _8 + } + /* If we reach this points it means that the new candidate path + ** needs to be added to the set of best-so-far paths. */ + if nTo < mxChoice { + /* Increase the size of the aTo set by one */ + v10 = nTo + nTo++ + jj = v10 + } else { + /* New path replaces the prior worst to keep count below mxChoice */ + jj = mxI + } + pTo = aTo + uintptr(jj)*32 + } else { + /* Control reaches here if best-so-far path pTo=aTo[jj] covers the + ** same set of loops and has the same isOrdered setting as the + ** candidate path. Check to see if the candidate should replace + ** pTo or if the candidate should be skipped. + ** + ** The conditional is an expanded vector comparison equivalent to: + ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted) + */ + if int32((*TWherePath)(unsafe.Pointer(pTo)).FrCost) < int32(rCost) || int32((*TWherePath)(unsafe.Pointer(pTo)).FrCost) == int32(rCost) && (int32((*TWherePath)(unsafe.Pointer(pTo)).FnRow) < int32(nOut) || int32((*TWherePath)(unsafe.Pointer(pTo)).FnRow) == int32(nOut) && int32((*TWherePath)(unsafe.Pointer(pTo)).FrUnsorted) <= int32(rUnsorted)) { + /* Discard the candidate path from further consideration */ + goto _8 + } + /* Control reaches here if the candidate path is better than the + ** pTo path. Replace pTo with the candidate. */ + } + /* pWLoop is a winner. Add it to the set of best so far */ + (*TWherePath)(unsafe.Pointer(pTo)).FmaskLoop = (*TWherePath)(unsafe.Pointer(pFrom)).FmaskLoop | (*TWhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf + (*TWherePath)(unsafe.Pointer(pTo)).FrevLoop = *(*TBitmask)(unsafe.Pointer(bp)) + (*TWherePath)(unsafe.Pointer(pTo)).FnRow = nOut + (*TWherePath)(unsafe.Pointer(pTo)).FrCost = rCost + (*TWherePath)(unsafe.Pointer(pTo)).FrUnsorted = rUnsorted + (*TWherePath)(unsafe.Pointer(pTo)).FisOrdered = isOrdered + libc.Xmemcpy(tls, (*TWherePath)(unsafe.Pointer(pTo)).FaLoop, (*TWherePath)(unsafe.Pointer(pFrom)).FaLoop, uint64(8)*uint64(iLoop)) + *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pTo)).FaLoop + uintptr(iLoop)*8)) = pWLoop + if nTo >= mxChoice { + mxI = 0 + mxCost = (*(*TWherePath)(unsafe.Pointer(aTo))).FrCost + mxUnsorted = (*(*TWherePath)(unsafe.Pointer(aTo))).FnRow + jj = int32(1) + pTo = aTo + 1*32 + for { + if !(jj < mxChoice) { + break + } + if int32((*TWherePath)(unsafe.Pointer(pTo)).FrCost) > int32(mxCost) || int32((*TWherePath)(unsafe.Pointer(pTo)).FrCost) == int32(mxCost) && int32((*TWherePath)(unsafe.Pointer(pTo)).FrUnsorted) > int32(mxUnsorted) { + mxCost = (*TWherePath)(unsafe.Pointer(pTo)).FrCost + mxUnsorted = (*TWherePath)(unsafe.Pointer(pTo)).FrUnsorted + mxI = jj + } + goto _11 + _11: + ; + jj++ + pTo += 32 + } + } + goto _8 + _8: + ; + pWLoop = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop + } + goto _7 + _7: + ; + ii++ + pFrom += 32 + } + /* Swap the roles of aFrom and aTo for the next generation */ + pFrom = aTo + aTo = aFrom + aFrom = pFrom + nFrom = nTo + goto _6 + _6: + ; + iLoop++ + } + if nFrom == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22524, 0) + _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) + return int32(SQLITE_ERROR) + } + /* Find the lowest cost path. pFrom will be left pointing to that path */ + pFrom = aFrom + ii = int32(1) + for { + if !(ii < nFrom) { + break + } + if int32((*TWherePath)(unsafe.Pointer(pFrom)).FrCost) > int32((*(*TWherePath)(unsafe.Pointer(aFrom + uintptr(ii)*32))).FrCost) { + pFrom = aFrom + uintptr(ii)*32 + } + goto _12 + _12: + ; + ii++ + } + /* Load the lowest cost path into pWInfo */ + iLoop = 0 + for { + if !(iLoop < nLoop) { + break + } + pLevel = pWInfo + 856 + uintptr(iLoop)*104 + v14 = *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(iLoop)*8)) + pWLoop = v14 + (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop = v14 + (*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom = (*TWhereLoop)(unsafe.Pointer(pWLoop)).FiTab + (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104))).FiCursor + goto _13 + _13: + ; + iLoop++ + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP && nRowEst != 0 { + rc = int32(_wherePathSatisfiesOrderBy(tls, pWInfo, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet, pFrom, uint16(WHERE_DISTINCTBY), uint16(nLoop-int32(1)), *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(nLoop-int32(1))*8)), bp+8)) + if rc == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet)).FnExpr { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_ORDERED) + } + } + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(0), 2, 0x4) + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = (*TWherePath)(unsafe.Pointer(pFrom)).FisOrdered + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_DISTINCTBY) != 0 { + if int32((*TWherePath)(unsafe.Pointer(pFrom)).FisOrdered) == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_ORDERED) + } + if (*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FpOrderBy != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) > (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FpOrderBy)).FnExpr { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = int8((*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect)).FpOrderBy)).FnExpr) + } + } else { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = (*TWherePath)(unsafe.Pointer(pFrom)).FrevLoop + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) <= 0 { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = 0 + if nLoop > 0 { + wsFlags = (*TWhereLoop)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(nLoop-int32(1))*8)))).FwsFlags + if wsFlags&uint32(WHERE_ONEROW) == uint32(0) && wsFlags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_COLUMN_IN)) != uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_COLUMN_IN)) { + *(*TBitmask)(unsafe.Pointer(bp + 16)) = uint64(0) + rc1 = int32(_wherePathSatisfiesOrderBy(tls, pWInfo, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, uint16(WHERE_ORDERBY_LIMIT), uint16(nLoop-int32(1)), *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(nLoop-int32(1))*8)), bp+16)) + if rc1 == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 2, 0x4) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = *(*TBitmask)(unsafe.Pointer(bp + 16)) + } + } + } + } else { + if nLoop != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == int32(1) && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&(libc.Int32FromInt32(WHERE_ORDERBY_MIN)|libc.Int32FromInt32(WHERE_ORDERBY_MAX)) != 0 { + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 2, 0x4) + } + } + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_SORTBYGROUP) != 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr && nLoop > 0 { + *(*TBitmask)(unsafe.Pointer(bp + 24)) = uint64(0) + nOrder = int32(_wherePathSatisfiesOrderBy(tls, pWInfo, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, uint16(0), uint16(nLoop-int32(1)), *(*uintptr)(unsafe.Pointer((*TWherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(nLoop-int32(1))*8)), bp+24)) + if nOrder == (*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + libc.SetBitFieldPtr8Uint32(pWInfo+68, libc.Uint32FromInt32(1), 3, 0x8) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = *(*TBitmask)(unsafe.Pointer(bp + 24)) + } + } + } + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut = (*TWherePath)(unsafe.Pointer(pFrom)).FnRow + /* Free temporary memory and return success */ + _sqlite3DbFreeNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pSpace) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Most queries use only a single table (they are not joins) and have +// ** simple == constraints against indexed fields. This routine attempts +// ** to plan those simple cases using much less ceremony than the +// ** general-purpose query planner, and thereby yield faster sqlite3_prepare() +// ** times for the common case. +// ** +// ** Return non-zero on success, if this query can be handled by this +// ** no-frills query planner. Return zero if this query needs the +// ** general-purpose query planner. +// */ +func _whereShortCut(tls *libc.TLS, pBuilder uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var iCur, j, opMask, v2 int32 + var pIdx, pItem, pLoop, pTab, pTerm, pWC, pWInfo uintptr + var _ /* scan at bp+0 */ TWhereScan + _, _, _, _, _, _, _, _, _, _, _ = iCur, j, opMask, pIdx, pItem, pLoop, pTab, pTerm, pWC, pWInfo, v2 + pWInfo = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { + return 0 + } + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + return 0 + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x2>>1)) != 0 || int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x1>>0)) != 0 { + return 0 + } + iCur = (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor + pWC = pWInfo + 104 + pLoop = (*TWhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = uint32(0) + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip = uint16(0) + pTerm = _whereScanInit(tls, bp, pWC, iCur, -int32(1), uint32(libc.Int32FromInt32(WO_EQ)|libc.Int32FromInt32(WO_IS)), uintptr(0)) + for pTerm != 0 && (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight != 0 { + pTerm = _whereScanNext(tls, bp) + } + if pTerm != 0 { + (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ) | libc.Int32FromInt32(WHERE_IPK) | libc.Int32FromInt32(WHERE_ONEROW)) + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) = pTerm + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm = uint16(1) + (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq = uint16(1) + /* TUNING: Cost of a rowid lookup is 10 */ + (*TWhereLoop)(unsafe.Pointer(pLoop)).FrRun = int16(33) /* 33==sqlite3LogEst(10) */ + } else { + pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex + for { + if !(pIdx != 0) { + break + } + if !(int32((*TIndex)(unsafe.Pointer(pIdx)).FonError) != libc.Int32FromInt32(OE_None)) || (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) || int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) > int32(libc.Uint64FromInt64(24)/libc.Uint64FromInt64(8)) { + goto _1 + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x8>>3)) != 0 { + v2 = libc.Int32FromInt32(WO_EQ) | libc.Int32FromInt32(WO_IS) + } else { + v2 = int32(WO_EQ) + } + opMask = v2 + j = 0 + for { + if !(j < int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { + break + } + pTerm = _whereScanInit(tls, bp, pWC, iCur, j, uint32(opMask), pIdx) + for pTerm != 0 && (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqRight != 0 { + pTerm = _whereScanNext(tls, bp) + } + if pTerm == uintptr(0) { + break + } + *(*uintptr)(unsafe.Pointer((*TWhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm + goto _3 + _3: + ; + j++ + } + if j != int32((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) { + goto _1 + } + (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = uint32(libc.Int32FromInt32(WHERE_COLUMN_EQ) | libc.Int32FromInt32(WHERE_ONEROW) | libc.Int32FromInt32(WHERE_INDEXED)) + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 100))&0x20>>5)) != 0 || (*TSrcItem)(unsafe.Pointer(pItem)).FcolUsed&(*TIndex)(unsafe.Pointer(pIdx)).FcolNotIdxed == uint64(0) { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_IDX_ONLY) + } + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnLTerm = uint16(j) + (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnEq = uint16(j) + (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex = pIdx + /* TUNING: Cost of a unique index lookup is 15 */ + (*TWhereLoop)(unsafe.Pointer(pLoop)).FrRun = int16(39) /* 39==sqlite3LogEst(15) */ + break + goto _1 + _1: + ; + pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext + } + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags != 0 { + (*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut = libc.Int16FromInt32(1) + (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FpWLoop = pLoop + (*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf = uint64(1) /* sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); */ + (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FiTabCur = iCur + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut = int16(1) + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = int8((*TExprList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr) + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) + } + if int32((*(*TWhereScan)(unsafe.Pointer(bp))).FiEquiv) > int32(1) { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_TRANSCONS) + } + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Helper function for exprIsDeterministic(). +// */ +func _exprNodeIsDeterministic(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) && libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_ConstFunc)) != uint32(0)) == 0 { + (*TWalker)(unsafe.Pointer(pWalker)).FeCode = uint16(0) + return int32(WRC_Abort) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** Return true if the expression contains no non-deterministic SQL +// ** functions. Do not consider non-deterministic SQL functions that are +// ** part of sub-select statements. +// */ +func _exprIsDeterministic(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* w at bp+0 */ TWalker + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp))).FeCode = uint16(1) + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_exprNodeIsDeterministic) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_sqlite3SelectWalkFail) + _sqlite3WalkExpr(tls, bp, p) + return int32((*(*TWalker)(unsafe.Pointer(bp))).FeCode) +} + +// C documentation +// +// /* Attempt to omit tables from a join that do not affect the result. +// ** For a table to not affect the result, the following must be true: +// ** +// ** 1) The query must not be an aggregate. +// ** 2) The table must be the RHS of a LEFT JOIN. +// ** 3) Either the query must be DISTINCT, or else the ON or USING clause +// ** must contain a constraint that limits the scan of the table to +// ** at most a single row. +// ** 4) The table must not be referenced by any part of the query apart +// ** from its own USING or ON clause. +// ** 5) The table must not have an inner-join ON or USING clause if there is +// ** a RIGHT JOIN anywhere in the query. Otherwise the ON/USING clause +// ** might move from the right side to the left side of the RIGHT JOIN. +// ** Note: Due to (2), this condition can only arise if the table is +// ** the right-most table of a subquery that was flattened into the +// ** main query and that subquery was the right-hand operand of an +// ** inner join that held an ON or USING clause. +// ** +// ** For example, given: +// ** +// ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); +// ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); +// ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); +// ** +// ** then table t2 can be omitted from the following: +// ** +// ** SELECT v1, v3 FROM t1 +// ** LEFT JOIN t2 ON (t1.ipk=t2.ipk) +// ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) +// ** +// ** or from: +// ** +// ** SELECT DISTINCT v1, v3 FROM t1 +// ** LEFT JOIN t2 +// ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) +// */ +func _whereOmitNoopJoin(tls *libc.TLS, pWInfo uintptr, notReady TBitmask) (r TBitmask) { + var hasRightJoin, i, nByte int32 + var pEnd, pItem, pLoop, pTerm, p4 uintptr + var tabUsed TBitmask + _, _, _, _, _, _, _, _, _ = hasRightJoin, i, nByte, pEnd, pItem, pLoop, pTerm, tabUsed, p4 + /* Preconditions checked by the caller */ + /* These two preconditions checked by the caller combine to guarantee + ** condition (1) of the header comment */ + tabUsed = _sqlite3WhereExprListUsage(tls, pWInfo+592, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet) + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + tabUsed |= _sqlite3WhereExprListUsage(tls, pWInfo+592, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy) + } + hasRightJoin = libc.BoolInt32(int32((*(*TSrcItem)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0) + i = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - int32(1) + for { + if !(i >= int32(1)) { + break + } + pLoop = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(i)*104))).FpWLoop + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pLoop)).FiTab)*104 + if int32((*TSrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_RIGHT)) != int32(JT_LEFT) { + goto _1 + } + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_ONEROW) == uint32(0) { + goto _1 + } + if tabUsed&(*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf != uint64(0) { + goto _1 + } + pEnd = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.Fa + uintptr((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.FnTerm)*56 + pTerm = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.Fa + for { + if !(pTerm < pEnd) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf != uint64(0) { + if !((*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_OuterON)) != libc.Uint32FromInt32(0)) || *(*int32)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + 52)) != (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor { + break + } + } + if hasRightJoin != 0 && (*TExpr)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)) != uint32(0) && *(*int32)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpExpr + 52)) == (*TSrcItem)(unsafe.Pointer(pItem)).FiCursor { + break /* restriction (5) */ + } + goto _2 + _2: + ; + pTerm += 56 + } + if pTerm < pEnd { + goto _1 + } + notReady &= ^(*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf + pTerm = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsWC.Fa + for { + if !(pTerm < pEnd) { + break + } + if (*TWhereTerm)(unsafe.Pointer(pTerm)).FprereqAll&(*TWhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf != uint64(0) { + p4 = pTerm + 18 + *(*Tu16)(unsafe.Pointer(p4)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p4))) | libc.Int32FromInt32(TERM_CODED)) + } + goto _3 + _3: + ; + pTerm += 56 + } + if i != int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) { + nByte = int32(uint64(int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-libc.Int32FromInt32(1)-i) * uint64(104)) + libc.Xmemmove(tls, pWInfo+856+uintptr(i)*104, pWInfo+856+uintptr(i+int32(1))*104, uint64(nByte)) + } + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- + goto _1 + _1: + ; + i-- + } + return notReady +} + +// C documentation +// +// /* +// ** Check to see if there are any SEARCH loops that might benefit from +// ** using a Bloom filter. Consider a Bloom filter if: +// ** +// ** (1) The SEARCH happens more than N times where N is the number +// ** of rows in the table that is being considered for the Bloom +// ** filter. +// ** (2) Some searches are expected to find zero rows. (This is determined +// ** by the WHERE_SELFCULL flag on the term.) +// ** (3) Bloom-filter processing is not disabled. (Checked by the +// ** caller.) +// ** (4) The size of the table being searched is known by ANALYZE. +// ** +// ** This block of code merely checks to see if a Bloom filter would be +// ** appropriate, and if so sets the WHERE_BLOOMFILTER flag on the +// ** WhereLoop. The implementation of the Bloom filter comes further +// ** down where the code for each WhereLoop is generated. +// */ +func _whereCheckIfBloomFilterIsUseful(tls *libc.TLS, pWInfo uintptr) { + var i int32 + var nSearch TLogEst + var pItem, pLoop, pTab uintptr + var reqFlags uint32 + _, _, _, _, _, _ = i, nSearch, pItem, pLoop, pTab, reqFlags + nSearch = 0 + i = 0 + for { + if !(i < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { + break + } + pLoop = (*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856 + uintptr(i)*104))).FpWLoop + reqFlags = uint32(libc.Int32FromInt32(WHERE_SELFCULL) | libc.Int32FromInt32(WHERE_COLUMN_EQ)) + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr((*TWhereLoop)(unsafe.Pointer(pLoop)).FiTab)*104 + pTab = (*TSrcItem)(unsafe.Pointer(pItem)).FpTab + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasStat1) == uint32(0) { + break + } + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_StatsUsed) + if i >= int32(1) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&reqFlags == reqFlags && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_IPK)|libc.Int32FromInt32(WHERE_INDEXED)) != uint32(0) { + if int32(nSearch) > int32((*TTable)(unsafe.Pointer(pTab)).FnRowLogEst) { + *(*Tu32)(unsafe.Pointer(pLoop + 48)) |= uint32(WHERE_BLOOMFILTER) + *(*Tu32)(unsafe.Pointer(pLoop + 48)) &= uint32(^libc.Int32FromInt32(WHERE_IDX_ONLY)) + } + } + nSearch = TLogEst(int32(nSearch) + int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FnOut)) + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** The index pIdx is used by a query and contains one or more expressions. +// ** In other words pIdx is an index on an expression. iIdxCur is the cursor +// ** number for the index and iDataCur is the cursor number for the corresponding +// ** table. +// ** +// ** This routine adds IndexedExpr entries to the Parse->pIdxEpr field for +// ** each of the expressions in the index so that the expression code generator +// ** will know to replace occurrences of the indexed expression with +// ** references to the corresponding column of the index. +// */ +func _whereAddIndexedExpr(tls *libc.TLS, pParse uintptr, pIdx uintptr, iIdxCur int32, pTabItem uintptr) { + var db, p, pArg, pDef, pExpr, pTab uintptr + var i, j, n, v2 int32 + _, _, _, _, _, _, _, _, _, _ = db, i, j, n, p, pArg, pDef, pExpr, pTab, v2 + pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable + i = 0 + for { + if !(i < int32((*TIndex)(unsafe.Pointer(pIdx)).FnColumn)) { + break + } + j = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + if j == -int32(2) { + pExpr = (*(*TExprList_item)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaColExpr + 8 + uintptr(i)*32))).FpExpr + } else { + if j >= 0 && int32((*(*TColumn)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*16))).FcolFlags)&int32(COLFLAG_VIRTUAL) != 0 { + pExpr = _sqlite3ColumnExpr(tls, pTab, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*16) + } else { + goto _1 + } + } + if _sqlite3ExprIsConstant(tls, pExpr) != 0 { + goto _1 + } + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_FUNCTION) { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if *(*uintptr)(unsafe.Pointer(pExpr + 32)) != 0 { + v2 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32)))).FnExpr + } else { + v2 = 0 + } + n = v2 + pDef = _sqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(pExpr + 8)), n, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, uint8(0)) + if pDef == uintptr(0) || (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_RESULT_SUBTYPE) != uint32(0) { + goto _1 + } + } + p = _sqlite3DbMallocRaw(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(32)) + if p == uintptr(0) { + break + } + (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) + (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor + (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = iIdxCur + (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol = i + (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow = libc.BoolUint8(int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LEFT)|libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0) + if _sqlite3IndexAffinityStr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pIdx) != 0 { + (*TIndexedExpr)(unsafe.Pointer(p)).Faff = uint8(*(*int8)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(i)))) + } + (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = p + if (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext == uintptr(0) { + pArg = pParse + 96 + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_whereIndexedExprCleanup), pArg) + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Set the reverse-scan order mask to one for all tables in the query +// ** with the exception of MATERIALIZED common table expressions that have +// ** their own internal ORDER BY clauses. +// ** +// ** This implements the PRAGMA reverse_unordered_selects=ON setting. +// ** (Also SQLITE_DBCONFIG_REVERSE_SCANORDER). +// */ +func _whereReverseScanOrder(tls *libc.TLS, pWInfo uintptr) { + var ii int32 + var pItem uintptr + _, _ = ii, pItem + ii = 0 + for { + if !(ii < (*TSrcList)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList)).FnSrc) { + break + } + pItem = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 + uintptr(ii)*104 + if !(int32(uint32(*(*uint16)(unsafe.Pointer(pItem + 60 + 4))&0x100>>8)) != 0) || int32((*TCteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem + 96)))).FeM10d) != M10d_Yes || (*TSrcItem)(unsafe.Pointer(pItem)).FpSelect == uintptr(0) || (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpOrderBy == uintptr(0) { + *(*TBitmask)(unsafe.Pointer(pWInfo + 96)) |= libc.Uint64FromInt32(1) << ii + } + goto _1 + _1: + ; + ii++ + } +} + +// C documentation +// +// /* +// ** Generate the beginning of the loop used for WHERE clause processing. +// ** The return value is a pointer to an opaque structure that contains +// ** information needed to terminate the loop. Later, the calling routine +// ** should invoke sqlite3WhereEnd() with the return value of this function +// ** in order to complete the WHERE clause processing. +// ** +// ** If an error occurs, this routine returns NULL. +// ** +// ** The basic idea is to do a nested loop, one loop for each table in +// ** the FROM clause of a select. (INSERT and UPDATE statements are the +// ** same as a SELECT with only a single table in the FROM clause.) For +// ** example, if the SQL is this: +// ** +// ** SELECT * FROM t1, t2, t3 WHERE ...; +// ** +// ** Then the code generated is conceptually like the following: +// ** +// ** foreach row1 in t1 do \ Code generated +// ** foreach row2 in t2 do |-- by sqlite3WhereBegin() +// ** foreach row3 in t3 do / +// ** ... +// ** end \ Code generated +// ** end |-- by sqlite3WhereEnd() +// ** end / +// ** +// ** Note that the loops might not be nested in the order in which they +// ** appear in the FROM clause if a different order is better able to make +// ** use of indices. Note also that when the IN operator appears in +// ** the WHERE clause, it might result in additional nested loops for +// ** scanning through all values on the right-hand side of the IN. +// ** +// ** There are Btree cursors associated with each table. t1 uses cursor +// ** number pTabList->a[0].iCursor. t2 uses the cursor pTabList->a[1].iCursor. +// ** And so forth. This routine generates code to open those VDBE cursors +// ** and sqlite3WhereEnd() generates the code to close them. +// ** +// ** The code that sqlite3WhereBegin() generates leaves the cursors named +// ** in pTabList pointing at their appropriate entries. The [...] code +// ** can use OP_Column and OP_Rowid opcodes on these cursors to extract +// ** data from the various tables of the loop. +// ** +// ** If the WHERE clause is empty, the foreach loops must each scan their +// ** entire tables. Thus a three-way join is an O(N^3) operation. But if +// ** the tables have indices and there are terms in the WHERE clause that +// ** refer to those indices, a complete table scan can be avoided and the +// ** code will run much faster. Most of the work of this routine is checking +// ** to see if there are indices that can be used to speed up the loop. +// ** +// ** Terms of the WHERE clause are also used to limit which rows actually +// ** make it to the "..." in the middle of the loop. After each "foreach", +// ** terms of the WHERE clause that use only terms in that loop and outer +// ** loops are evaluated and if false a jump is made around all subsequent +// ** inner loops (or around the "..." if the test occurs within the inner- +// ** most loop) +// ** +// ** OUTER JOINS +// ** +// ** An outer join of tables t1 and t2 is conceptually coded as follows: +// ** +// ** foreach row1 in t1 do +// ** flag = 0 +// ** foreach row2 in t2 do +// ** start: +// ** ... +// ** flag = 1 +// ** end +// ** if flag==0 then +// ** move the row2 cursor to a null row +// ** goto start +// ** fi +// ** end +// ** +// ** ORDER BY CLAUSE PROCESSING +// ** +// ** pOrderBy is a pointer to the ORDER BY clause (or the GROUP BY clause +// ** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement +// ** if there is one. If there is no ORDER BY clause or if this routine +// ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL. +// ** +// ** The iIdxCur parameter is the cursor number of an index. If +// ** WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index +// ** to use for OR clause processing. The WHERE clause should use this +// ** specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is +// ** the first cursor in an array of cursors for all indices. iIdxCur should +// ** be used to compute the appropriate cursor depending on which index is +// ** used. +// */ +func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pResultSet uintptr, pSelect uintptr, wctrlFlags Tu16, iAuxArg int32) (r uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var addrExplain, bOnerow, iCur, iDb, iIndexCur, iOnce, ii, n, nByteWInfo, nTabList, op, op1, rc, wsFlags, wsFlags1, v1, v12, v15, v19, v2, v21, v23, v3, v4 int32 + var b, notReady TBitmask + var bFordelete Tu8 + var db, p, pInfo, pIx, pJ, pLevel, pLoop, pMaskSet, pPk, pRJ, pSrc, pT, pTab, pTabItem, pVTab, pWInfo, pX, v, v16, v17, v20, v22, v24, p10, p11, p7, p8, p9 uintptr + var v18 bool + var _ /* sWLB at bp+0 */ TWhereLoopBuilder + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrExplain, b, bFordelete, bOnerow, db, iCur, iDb, iIndexCur, iOnce, ii, n, nByteWInfo, nTabList, notReady, op, op1, p, pInfo, pIx, pJ, pLevel, pLoop, pMaskSet, pPk, pRJ, pSrc, pT, pTab, pTabItem, pVTab, pWInfo, pX, rc, v, wsFlags, wsFlags1, v1, v12, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v3, v4, p10, p11, p7, p8, p9 /* Will become the return value of this function */ + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe /* Return code */ + bFordelete = uint8(0) /* OPFLAG_FORDELETE or zero, as appropriate */ + /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */ + /* Variable initialization */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + libc.Xmemset(tls, bp, 0, uint64(56)) + /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ + if pOrderBy != 0 && (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr >= int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + pOrderBy = uintptr(0) + wctrlFlags = Tu16(int32(wctrlFlags) & ^libc.Int32FromInt32(WHERE_WANT_DISTINCT)) + } + /* The number of tables in the FROM clause is limited by the number of + ** bits in a Bitmask + */ + if (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc > int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22542, libc.VaList(bp+64, int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)))) + return uintptr(0) + } + /* This function normally generates a nested loop for all tables in + ** pTabList. But if the WHERE_OR_SUBCLAUSE flag is set, then we should + ** only generate code for the first table in pTabList and assume that + ** any cursors associated with subsequent tables are uninitialized. + */ + if int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { + v1 = int32(1) + } else { + v1 = (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc + } + nTabList = v1 + /* Allocate and initialize the WhereInfo structure that will become the + ** return value. A single allocation is used to store the WhereInfo + ** struct, the contents of WhereInfo.a[], the WhereClause structure + ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte + ** field (type Bitmask) it must be aligned on an 8-byte boundary on + ** some architectures. Hence the ROUND8() below. + */ + nByteWInfo = int32(libc.Uint64FromInt64(960)) + if nTabList > int32(1) { + nByteWInfo = int32(uint64(nByteWInfo) + uint64(nTabList-libc.Int32FromInt32(1))*libc.Uint64FromInt64(104)) + } + pWInfo = _sqlite3DbMallocRawNN(tls, db, uint64(nByteWInfo)+uint64(104)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3DbFree(tls, db, pWInfo) + pWInfo = uintptr(0) + goto whereBeginError + } + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse = pParse + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList = pTabList + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy = pOrderBy + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet = pResultSet + v2 = -libc.Int32FromInt32(1) + *(*int32)(unsafe.Pointer(pWInfo + 40 + 1*4)) = v2 + *(*int32)(unsafe.Pointer(pWInfo + 40)) = v2 + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel = uint8(nTabList) + v3 = _sqlite3VdbeMakeLabel(tls, pParse) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue = v3 + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak = v3 + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags = wctrlFlags + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiLimit = int16(iAuxArg) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop = int32((*TParse)(unsafe.Pointer(pParse)).FnQueryLoop) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpSelect = pSelect + libc.Xmemset(tls, pWInfo+65, 0, uint64(libc.UintptrFromInt32(0)+104)-uint64(libc.UintptrFromInt32(0)+65)) + libc.Xmemset(tls, pWInfo+856, 0, uint64(104)+uint64(nTabList)*uint64(104)) + /* ONEPASS defaults to OFF */ + pMaskSet = pWInfo + 592 + (*TWhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn = 0 + *(*int32)(unsafe.Pointer(pMaskSet + 8)) = -int32(99) /* Initialize ix[0] to a value that can never be + ** a valid cursor number, to avoid an initial + ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */ + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWInfo = pWInfo + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWC = pWInfo + 104 + (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpNew = pWInfo + uintptr(nByteWInfo) + _whereLoopInit(tls, (*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpNew) + /* Split the WHERE clause into separate subexpressions where each + ** subexpression is separated by an AND operator. + */ + _sqlite3WhereClauseInit(tls, pWInfo+104, pWInfo) + _sqlite3WhereSplit(tls, pWInfo+104, pWhere, uint8(TK_AND)) + /* Special case: No FROM clause + */ + if nTabList == 0 { + if pOrderBy != 0 { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = int8((*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) + } + if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) == uint32(0) { + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) + } + _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+22570, 0) + } else { + /* Assign a bit from the bitmask to every term in the FROM clause. + ** + ** The N-th term of the FROM clause is assigned a bitmask of 1<nSrc tables in + ** pTabList, not just the first nTabList tables. nTabList is normally + ** equal to pTabList->nSrc but might be shortened to 1 if the + ** WHERE_OR_SUBCLAUSE flag is set. + */ + ii = 0 + for { + _createMask(tls, pMaskSet, (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(ii)*104))).FiCursor) + _sqlite3WhereTabFuncArgs(tls, pParse, pTabList+8+uintptr(ii)*104, pWInfo+104) + goto _5 + _5: + ; + ii++ + v4 = ii + if !(v4 < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc) { + break + } + } + } + /* Analyze all of the subexpressions. */ + _sqlite3WhereExprAnalyze(tls, pTabList, pWInfo+104) + if pSelect != 0 && (*TSelect)(unsafe.Pointer(pSelect)).FpLimit != 0 { + _sqlite3WhereAddLimit(tls, pWInfo+104, pSelect) + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto whereBeginError + } + /* The False-WHERE-Term-Bypass optimization: + ** + ** If there are WHERE terms that are false, then no rows will be output, + ** so skip over all of the code generated here. + ** + ** Conditions: + ** + ** (1) The WHERE term must not refer to any tables in the join. + ** (2) The term must not come from an ON clause on the + ** right-hand side of a LEFT or FULL JOIN. + ** (3) The term must not come from an ON clause, or there must be + ** no RIGHT or FULL OUTER joins in pTabList. + ** (4) If the expression contains non-deterministic functions + ** that are not within a sub-select. This is not required + ** for correctness but rather to preserves SQLite's legacy + ** behaviour in the following two cases: + ** + ** WHERE random()>0; -- eval random() once per row + ** WHERE (SELECT random())>0; -- eval random() just once overall + ** + ** Note that the Where term need not be a constant in order for this + ** optimization to apply, though it does need to be constant relative to + ** the current subquery (condition 1). The term might include variables + ** from outer queries so that the value of the term changes from one + ** invocation of the current subquery to the next. + */ + ii = 0 + for { + if !(ii < (*TWhereClause)(unsafe.Pointer((*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWC)).FnBase) { + break + } + pT = (*TWhereClause)(unsafe.Pointer((*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FpWC)).Fa + uintptr(ii)*56 /* The expression of pT */ + if int32((*TWhereTerm)(unsafe.Pointer(pT)).FwtFlags)&int32(TERM_VIRTUAL) != 0 { + goto _6 + } + pX = (*TWhereTerm)(unsafe.Pointer(pT)).FpExpr + if (*TWhereTerm)(unsafe.Pointer(pT)).FprereqAll == uint64(0) && (nTabList == 0 || _exprIsDeterministic(tls, pX) != 0) && !((*TExpr)(unsafe.Pointer(pX)).Fflags&uint32(libc.Int32FromInt32(EP_InnerON)) != uint32(0) && int32((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0) { + _sqlite3ExprIfFalse(tls, pParse, pX, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak, int32(SQLITE_JUMPIFNULL)) + p7 = pT + 18 + *(*Tu16)(unsafe.Pointer(p7)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p7))) | libc.Int32FromInt32(TERM_CODED)) + } + goto _6 + _6: + ; + ii++ + } + if int32(wctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_DistinctOpt)) != uint32(0) { + /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via + ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ + wctrlFlags = Tu16(int32(wctrlFlags) & ^libc.Int32FromInt32(WHERE_WANT_DISTINCT)) + p8 = pWInfo + 60 + *(*Tu16)(unsafe.Pointer(p8)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p8))) & ^libc.Int32FromInt32(WHERE_WANT_DISTINCT)) + } else { + if _isDistinctRedundant(tls, pParse, pTabList, pWInfo+104, pResultSet) != 0 { + /* The DISTINCT marking is pointless. Ignore it. */ + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNIQUE) + } else { + if pOrderBy == uintptr(0) { + /* Try to ORDER BY the result set to make distinct processing easier */ + p9 = pWInfo + 60 + *(*Tu16)(unsafe.Pointer(p9)) = Tu16(int32(*(*Tu16)(unsafe.Pointer(p9))) | libc.Int32FromInt32(WHERE_DISTINCTBY)) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy = pResultSet + } + } + } + } + /* Construct the WhereLoop objects */ + if nTabList != int32(1) || _whereShortCut(tls, bp) == 0 { + rc = _whereLoopAddAll(tls, bp) + if rc != 0 { + goto whereBeginError + } + /* If one or more WhereTerm.truthProb values were used in estimating + ** loop parameters, but then those truthProb values were subsequently + ** changed based on STAT4 information while computing subsequent loops, + ** then we need to rerun the whole loop building process so that all + ** loops will be built using the revised truthProb values. */ + if int32((*(*TWhereLoopBuilder)(unsafe.Pointer(bp))).FbldFlags2)&int32(SQLITE_BLDF2_2NDPASS) != 0 { + for (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops != 0 { + p = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpLoops = (*TWhereLoop)(unsafe.Pointer(p)).FpNextLoop + _whereLoopDelete(tls, db, p) + } + rc = _whereLoopAddAll(tls, bp) + if rc != 0 { + goto whereBeginError + } + } + _wherePathSolver(tls, pWInfo, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto whereBeginError + } + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + _wherePathSolver(tls, pWInfo, int16(int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut)+int32(1))) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto whereBeginError + } + } + /* TUNING: Assume that a DISTINCT clause on a subquery reduces + ** the output size by a factor of 8 (LogEst -30). + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_WANT_DISTINCT) != 0 { + p10 = pWInfo + 70 + *(*TLogEst)(unsafe.Pointer(p10)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p10))) - libc.Int32FromInt32(30)) + } + } + if (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ReverseOrder) != uint64(0) { + _whereReverseScanOrder(tls, pWInfo) + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto whereBeginError + } + /* Attempt to omit tables from a join that do not affect the result. + ** See the comment on whereOmitNoopJoin() for further information. + ** + ** This query optimization is factored out into a separate "no-inline" + ** procedure to keep the sqlite3WhereBegin() procedure from becoming + ** too large. If sqlite3WhereBegin() becomes too large, that prevents + ** some C-compiler optimizers from in-lining the + ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to + ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons. + */ + notReady = ^libc.Uint64FromInt32(0) + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) >= int32(2) && pResultSet != uintptr(0) && 0 == int32(wctrlFlags)&int32(WHERE_AGG_DISTINCT) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OmitNoopJoin)) == uint32(0) { + notReady = _whereOmitNoopJoin(tls, pWInfo, notReady) + nTabList = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) + } + /* Check to see if there are any SEARCH loops that might benefit from + ** using a Bloom filter. + */ + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) >= int32(2) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_BloomFilter)) == uint32(0) { + _whereCheckIfBloomFilterIsUseful(tls, pWInfo) + } + p11 = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + 224 + *(*TLogEst)(unsafe.Pointer(p11)) = TLogEst(int32(*(*TLogEst)(unsafe.Pointer(p11))) + int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut)) + /* If the caller is an UPDATE or DELETE statement that is requesting + ** to use a one-pass algorithm, determine if this is appropriate. + ** + ** A one-pass approach can be used if the caller has requested one + ** and either (a) the scan visits at most one row or (b) each + ** of the following are true: + ** + ** * the caller has indicated that a one-pass approach can be used + ** with multiple rows (by setting WHERE_ONEPASS_MULTIROW), and + ** * the table is not a virtual table, and + ** * either the scan does not use the OR optimization or the caller + ** is a DELETE operation (WHERE_DUPLICATES_OK is only specified + ** for DELETE). + ** + ** The last qualification is because an UPDATE statement uses + ** WhereInfo.aiCurOnePass[1] to determine whether or not it really can + ** use a one-pass approach, and this is not set accurately for scans + ** that use the OR optimization. + */ + if int32(wctrlFlags)&int32(WHERE_ONEPASS_DESIRED) != 0 { + wsFlags = int32((*TWhereLoop1)(unsafe.Pointer((*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FpWLoop)).FwsFlags) + bOnerow = libc.BoolInt32(wsFlags&int32(WHERE_ONEROW) != 0) + if bOnerow != 0 || 0 != int32(wctrlFlags)&int32(WHERE_ONEPASS_MULTIROW) && !(int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab)).FeTabType) == libc.Int32FromInt32(TABTYP_VTAB)) && (0 == wsFlags&int32(WHERE_MULTI_OR) || int32(wctrlFlags)&int32(WHERE_DUPLICATES_OK) != 0) && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_OnePass)) == uint32(0) { + if bOnerow != 0 { + v12 = int32(ONEPASS_SINGLE) + } else { + v12 = int32(ONEPASS_MULTI) + } + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass = uint8(v12) + if (*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer(pTabList + 8))).FpTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) && wsFlags&int32(WHERE_IDX_ONLY) != 0 { + if int32(wctrlFlags)&int32(WHERE_ONEPASS_MULTIROW) != 0 { + bFordelete = uint8(OPFLAG_FORDELETE) + } + (*TWhereLoop1)(unsafe.Pointer((*(*TWhereLevel)(unsafe.Pointer(pWInfo + 856))).FpWLoop)).FwsFlags = uint32(wsFlags & ^libc.Int32FromInt32(WHERE_IDX_ONLY)) + } + } + } + /* Open all tables in the pTabList and any indices selected for + ** searching those tables. + */ + ii = 0 + pLevel = pWInfo + 856 + for { + if !(ii < nTabList) { + break + } + pTabItem = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab + iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Ephemeral) != uint32(0) || int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { + /* Do nothing */ + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) != uint32(0) { + pVTab = _sqlite3GetVTable(tls, db, pTab) + iCur = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor + _sqlite3VdbeAddOp4(tls, v, int32(OP_VOpen), iCur, 0, 0, pVTab, -int32(11)) + } else { + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + /* noop */ + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IDX_ONLY) == uint32(0) && int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) == 0 || int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&(libc.Int32FromInt32(JT_LTORJ)|libc.Int32FromInt32(JT_RIGHT)) != 0 { + op = int32(OP_OpenRead) + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) != ONEPASS_OFF { + op = int32(OP_OpenWrite) + *(*int32)(unsafe.Pointer(pWInfo + 40)) = (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor + } + _sqlite3OpenTable(tls, pParse, (*TSrcItem)(unsafe.Pointer(pTabItem)).FiCursor, iDb, pTab, op) + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) == ONEPASS_OFF && int32((*TTable)(unsafe.Pointer(pTab)).FnCol) < int32(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8)) && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(libc.Int32FromInt32(TF_HasGenerated)|libc.Int32FromInt32(TF_WithoutRowid)) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_AUTO_INDEX)|libc.Int32FromInt32(WHERE_BLOOMFILTER)) == uint32(0) { + /* If we know that only a prefix of the record will be used, + ** it is advantageous to reduce the "column count" field in + ** the P4 operand of the OP_OpenRead/Write opcode. */ + b = (*TSrcItem)(unsafe.Pointer(pTabItem)).FcolUsed + n = 0 + for { + if !(b != 0) { + break + } + goto _14 + _14: + ; + b = b >> int32(1) + n++ + } + _sqlite3VdbeChangeP4(tls, v, -int32(1), uintptr(int64(n)), -int32(3)) + } + _sqlite3VdbeChangeP5(tls, v, uint16(bFordelete)) + } else { + _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab)).FzName) + } + } + } + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_INDEXED) != 0 { + pIx = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + op1 = int32(OP_OpenRead) + /* iAuxArg is always set to a positive value if ONEPASS is possible */ + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIx + 100))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) && int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { + /* This is one term of an OR-optimization using the PRIMARY KEY of a + ** WITHOUT ROWID table. No need for a separate index */ + iIndexCur = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur + op1 = 0 + } else { + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) != ONEPASS_OFF { + pJ = (*TTable)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FpIndex + iIndexCur = iAuxArg + for pJ != 0 && pJ != pIx { + iIndexCur++ + pJ = (*TIndex)(unsafe.Pointer(pJ)).FpNext + } + op1 = int32(OP_OpenWrite) + *(*int32)(unsafe.Pointer(pWInfo + 40 + 1*4)) = iIndexCur + } else { + if iAuxArg != 0 && int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) != 0 { + iIndexCur = iAuxArg + op1 = int32(OP_ReopenIdx) + } else { + v16 = pParse + 52 + v15 = *(*int32)(unsafe.Pointer(v16)) + *(*int32)(unsafe.Pointer(v16))++ + iIndexCur = v15 + if int32(uint32(*(*uint16)(unsafe.Pointer(pIx + 100))&0x1000>>12)) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_IndexedExpr)) == uint32(0) { + _whereAddIndexedExpr(tls, pParse, pIx, iIndexCur, pTabItem) + } + if (*TIndex)(unsafe.Pointer(pIx)).FpPartIdxWhere != 0 && int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_RIGHT) == 0 { + _wherePartIdxExpr(tls, pParse, pIx, (*TIndex)(unsafe.Pointer(pIx)).FpPartIdxWhere, uintptr(0), iIndexCur, pTabItem) + } + } + } + } + (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iIndexCur + if op1 != 0 { + _sqlite3VdbeAddOp3(tls, v, op1, iIndexCur, int32((*TIndex)(unsafe.Pointer(pIx)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIx) + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_CONSTRAINT) != uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_COLUMN_RANGE)|libc.Int32FromInt32(WHERE_SKIPSCAN)) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BIGNULL_SORT) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_SEEKSCAN) == uint32(0) && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags)&int32(WHERE_ORDERBY_MIN) == 0 && int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) != int32(WHERE_DISTINCT_ORDERED) { + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SEEKEQ)) + } + } + } + if iDb >= 0 { + _sqlite3CodeVerifySchema(tls, pParse, iDb) + } + if v18 = int32((*TSrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype)&int32(JT_RIGHT) != 0; v18 { + v17 = _sqlite3WhereMalloc(tls, pWInfo, uint64(20)) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ = v17 + } + if v18 && v17 != uintptr(0) { + pRJ = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ + v20 = pParse + 52 + v19 = *(*int32)(unsafe.Pointer(v20)) + *(*int32)(unsafe.Pointer(v20))++ + (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch = v19 + v22 = pParse + 56 + *(*int32)(unsafe.Pointer(v22))++ + v21 = *(*int32)(unsafe.Pointer(v22)) + (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregBloom = v21 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Blob), int32(65536), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregBloom) + v24 = pParse + 56 + *(*int32)(unsafe.Pointer(v24))++ + v23 = *(*int32)(unsafe.Pointer(v24)) + (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn = v23 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn) + if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, int32(1)) + pInfo = _sqlite3KeyInfoAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(1), 0) + if pInfo != 0 { + *(*uintptr)(unsafe.Pointer(pInfo + 32)) = uintptr(0) + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags)) = uint8(0) + _sqlite3VdbeAppendP4(tls, v, pInfo, -int32(8)) + } + } else { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FiMatch, int32((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) + } + *(*Tu32)(unsafe.Pointer(pLoop + 48)) &= uint32(^libc.Int32FromInt32(WHERE_IDX_ONLY)) + /* The nature of RIGHT JOIN processing is such that it messes up + ** the output order. So omit any ORDER BY/GROUP BY elimination + ** optimizations. We need to do an actual sort for RIGHT JOIN. */ + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = 0 + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = uint8(WHERE_DISTINCT_UNORDERED) + } + goto _13 + _13: + ; + ii++ + pLevel += 104 + } + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiTop = _sqlite3VdbeCurrentAddr(tls, v) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto whereBeginError + } + /* Generate the code to do the search. Each iteration of the for + ** loop below generates code for a single nested loop of the VM + ** program. + */ + ii = 0 + for { + if !(ii < nTabList) { + break + } + if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { + goto whereBeginError + } + pLevel = pWInfo + 856 + uintptr(ii)*104 + wsFlags1 = int32((*TWhereLoop1)(unsafe.Pointer((*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags) + pSrc = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x10>>4)) != 0 { + if int32(uint32(*(*uint16)(unsafe.Pointer(pSrc + 60 + 4))&0x8>>3)) != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSrcItem)(unsafe.Pointer(pSrc)).FregReturn, (*TSrcItem)(unsafe.Pointer(pSrc)).FaddrFillSub) + } else { + iOnce = _sqlite3VdbeAddOp0(tls, v, int32(OP_Once)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TSrcItem)(unsafe.Pointer(pSrc)).FregReturn, (*TSrcItem)(unsafe.Pointer(pSrc)).FaddrFillSub) + _sqlite3VdbeJumpHere(tls, v, iOnce) + } + } + if wsFlags1&(libc.Int32FromInt32(WHERE_AUTO_INDEX)|libc.Int32FromInt32(WHERE_BLOOMFILTER)) != 0 { + if wsFlags1&int32(WHERE_AUTO_INDEX) != 0 { + _constructAutomaticIndex(tls, pParse, pWInfo+104, notReady, pLevel) + } else { + _sqlite3ConstructBloomFilter(tls, pWInfo, ii, pLevel, notReady) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto whereBeginError + } + } + addrExplain = _sqlite3WhereExplainOneScan(tls, pParse, pTabList, pLevel, wctrlFlags) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBody = _sqlite3VdbeCurrentAddr(tls, v) + notReady = _sqlite3WhereCodeOneLoopStart(tls, pParse, v, pWInfo, ii, pLevel, notReady) + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiContinue = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont + if wsFlags1&int32(WHERE_MULTI_OR) == 0 && int32(wctrlFlags)&int32(WHERE_OR_SUBCLAUSE) == 0 { + _ = addrExplain + } + goto _25 + _25: + ; + ii++ + } + /* Done. */ + (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiEndWhere = _sqlite3VdbeCurrentAddr(tls, v) + return pWInfo + /* Jump here if malloc fails */ +whereBeginError: + ; + if pWInfo != 0 { + (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) + _whereInfoFree(tls, db, pWInfo) + } + return uintptr(0) +} + +/* +** Part of sqlite3WhereEnd() will rewrite opcodes to reference the +** index rather than the main table. In SQLITE_DEBUG mode, we want +** to trace those changes if PRAGMA vdbe_addoptrace=on. This routine +** does that. + */ + +// C documentation +// +// /* +// ** Generate the end of the WHERE loop. See comments on +// ** sqlite3WhereBegin() for additional information. +// */ +func _sqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { + var addr, addrSeek, bEarlyOut, i, iDb, iEnd, j, j1, k, last, n, nRJ, op, r1, ws, x, v4, v7 int32 + var db, p, pIdx, pIdx1, pIn, pIx, pLastOp, pLevel, pLoop, pOp, pParse, pPk, pRJ, pTab, pTabItem, pTabList, v, v10, v2, p12 uintptr + var v3, v5 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addrSeek, bEarlyOut, db, i, iDb, iEnd, j, j1, k, last, n, nRJ, op, p, pIdx, pIdx1, pIn, pIx, pLastOp, pLevel, pLoop, pOp, pParse, pPk, pRJ, pTab, pTabItem, pTabList, r1, v, ws, x, v10, v2, v3, v4, v5, v7, p12 + pParse = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpParse + v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe + pTabList = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + iEnd = _sqlite3VdbeCurrentAddr(tls, v) + nRJ = 0 + /* Generate loop termination code. + */ + i = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - int32(1) + for { + if !(i >= 0) { + break + } + pLevel = pWInfo + 856 + uintptr(i)*104 + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ != 0 { + /* Terminate the subroutine that forms the interior of the loop of + ** the RIGHT JOIN table */ + pRJ = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont) + (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont = 0 + (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FendSubrtn = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FregReturn, (*TWhereRightJoin)(unsafe.Pointer(pRJ)).FaddrSubrtn, int32(1)) + nRJ++ + } + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if int32((*TWhereLevel)(unsafe.Pointer(pLevel)).Fop) != int32(OP_Noop) { + addrSeek = 0 + if v3 = int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == int32(WHERE_DISTINCT_ORDERED) && i == int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-int32(1) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_INDEXED) != uint32(0); v3 { + v2 = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + pIdx = v2 + } + if v5 = v3 && int32(uint32(*(*uint16)(unsafe.Pointer(v2 + 100))&0x80>>7)) != 0; v5 { + v4 = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FnDistinctCol) + n = v4 + } + if v5 && v4 > 0 && int32(*(*TLogEst)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FaiRowLogEst + uintptr(n)*2))) >= int32(36) { + r1 = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + j = 0 + for { + if !(j < n) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, r1+j) + goto _6 + _6: + ; + j++ + } + *(*int32)(unsafe.Pointer(pParse + 56)) += n + int32(1) + if int32((*TWhereLevel)(unsafe.Pointer(pLevel)).Fop) == int32(OP_Prev) { + v7 = int32(OP_SeekLT) + } else { + v7 = int32(OP_SeekGT) + } + op = v7 + addrSeek = _sqlite3VdbeAddOp4Int(tls, v, op, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, 0, r1, n) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), int32(1), (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2) + } + /* The common case: Advance to the next row */ + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont != 0 { + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont) + } + _sqlite3VdbeAddOp3(tls, v, int32((*TWhereLevel)(unsafe.Pointer(pLevel)).Fop), (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1, (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2, int32((*TWhereLevel)(unsafe.Pointer(pLevel)).Fp3)) + _sqlite3VdbeChangeP5(tls, v, uint16((*TWhereLevel)(unsafe.Pointer(pLevel)).Fp5)) + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FregBignull != 0 { + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull) + _sqlite3VdbeAddOp2(tls, v, int32(OP_DecrJumpZero), (*TWhereLevel)(unsafe.Pointer(pLevel)).FregBignull, (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp2-int32(1)) + } + if addrSeek != 0 { + _sqlite3VdbeJumpHere(tls, v, addrSeek) + } + } else { + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont != 0 { + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrCont) + } + } + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_ABLE) != uint32(0) && (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn > 0 { + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt) + j1 = (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FnIn + pIn = (*(*struct { + FnIn int32 + FaInLoop uintptr + })(unsafe.Pointer(pLevel + 72))).FaInLoop + uintptr(j1-int32(1))*20 + for { + if !(j1 > 0) { + break + } + _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop+int32(1)) + if int32((*TInLoop)(unsafe.Pointer(pIn)).FeEndLoopOp) != int32(OP_Noop) { + if (*TInLoop)(unsafe.Pointer(pIn)).FnPrefix != 0 { + bEarlyOut = libc.BoolInt32((*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_VIRTUALTABLE) == uint32(0) && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_IN_EARLYOUT) != uint32(0)) + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + /* For LEFT JOIN queries, cursor pIn->iCur may not have been + ** opened yet. This occurs for WHERE clauses such as + ** "a = ? AND b IN (...)", where the index is on (a, b). If + ** the RHS of the (a=?) is NULL, then the "b IN (...)" may + ** never have been coded, but the body of the loop run to + ** return the null-row. So, if the cursor is not open yet, + ** jump over the OP_Next or OP_Prev instruction about to + ** be coded. */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_IfNotOpen), (*TInLoop)(unsafe.Pointer(pIn)).FiCur, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)+bEarlyOut) + } + if bEarlyOut != 0 { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_IfNoHope), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), (*TInLoop)(unsafe.Pointer(pIn)).FiBase, (*TInLoop)(unsafe.Pointer(pIn)).FnPrefix) + /* Retarget the OP_IsNull against the left operand of IN so + ** it jumps past the OP_IfNoHope. This is because the + ** OP_IsNull also bypasses the OP_Affinity opcode that is + ** required by OP_IfNoHope. */ + _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop+int32(1)) + } + } + _sqlite3VdbeAddOp2(tls, v, int32((*TInLoop)(unsafe.Pointer(pIn)).FeEndLoopOp), (*TInLoop)(unsafe.Pointer(pIn)).FiCur, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop) + } + _sqlite3VdbeJumpHere(tls, v, (*TInLoop)(unsafe.Pointer(pIn)).FaddrInTop-int32(1)) + goto _8 + _8: + ; + j1-- + pIn -= 20 + } + } + _sqlite3VdbeResolveLabel(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Return), (*TWhereRightJoin)(unsafe.Pointer((*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ)).FregReturn, 0, int32(1)) + } + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip != 0 { + _sqlite3VdbeGoto(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip) + _sqlite3VdbeJumpHere(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip) + _sqlite3VdbeJumpHere(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip-int32(2)) + } + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + ws = int32((*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags) + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfPos), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + if ws&int32(WHERE_IDX_ONLY) == 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur) + } + if ws&int32(WHERE_INDEXED) != 0 || ws&int32(WHERE_MULTI_OR) != 0 && *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) != 0 { + if ws&int32(WHERE_MULTI_OR) != 0 { + pIx = *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) + iDb = _sqlite3SchemaToIndex(tls, db, (*TIndex)(unsafe.Pointer(pIx)).FpSchema) + _sqlite3VdbeAddOp3(tls, v, int32(OP_ReopenIdx), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, int32((*TIndex)(unsafe.Pointer(pIx)).Ftnum), iDb) + _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIx) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_NullRow), (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur) + } + if int32((*TWhereLevel)(unsafe.Pointer(pLevel)).Fop) == int32(OP_Return) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TWhereLevel)(unsafe.Pointer(pLevel)).Fp1, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst) + } else { + _sqlite3VdbeGoto(tls, v, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst) + } + _sqlite3VdbeJumpHere(tls, v, addr) + } + goto _1 + _1: + ; + i-- + } + i = 0 + pLevel = pWInfo + 856 + for { + if !(i < int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { + break + } + pIdx1 = uintptr(0) + pTabItem = pTabList + 8 + uintptr((*TWhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*104 + pTab = (*TSrcItem)(unsafe.Pointer(pTabItem)).FpTab + pLoop = (*TWhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + /* Do RIGHT JOIN processing. Generate code that will output the + ** unmatched rows of the right operand of the RIGHT JOIN with + ** all of the columns of the left operand set to NULL. + */ + if (*TWhereLevel)(unsafe.Pointer(pLevel)).FpRJ != 0 { + _sqlite3WhereRightJoinLoop(tls, pWInfo, i, pLevel) + goto _9 + } + /* For a co-routine, change all OP_Column references to the table of + ** the co-routine into OP_Copy of result contained in a register. + ** OP_Rowid becomes OP_Null. + */ + if int32(uint32(*(*uint16)(unsafe.Pointer(pTabItem + 60 + 4))&0x20>>5)) != 0 { + _translateColumnToCopy(tls, pParse, (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBody, (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, (*TSrcItem)(unsafe.Pointer(pTabItem)).FregResult, 0) + goto _9 + } + /* If this scan uses an index, make VDBE code substitutions to read data + ** from the index instead of from the table where possible. In some cases + ** this optimization prevents the table from ever being read, which can + ** yield a significant performance boost. + ** + ** Calls to the code generator in between sqlite3WhereBegin and + ** sqlite3WhereEnd will have created code that references the table + ** directly. This loop scans all that code looking for opcodes + ** that reference the table and converts them into opcodes that + ** reference the index. + */ + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(libc.Int32FromInt32(WHERE_INDEXED)|libc.Int32FromInt32(WHERE_IDX_ONLY)) != 0 { + pIdx1 = (*TWhereLoop)(unsafe.Pointer(pLoop)).Fu.Fbtree.FpIndex + } else { + if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_MULTI_OR) != 0 { + pIdx1 = *(*uintptr)(unsafe.Pointer(&(*TWhereLevel)(unsafe.Pointer(pLevel)).Fu)) + } + } + if pIdx1 != 0 && !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if int32((*TWhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) == ONEPASS_OFF || !((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx1)).FpTable)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + last = iEnd + } else { + last = (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiEndWhere + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx1 + 100))&0x1000>>12)) != 0 { + p = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr + for p != 0 { + if (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur == (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur { + (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur = -int32(1) + (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur = -int32(1) + } + p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext + } + } + k = (*TWhereLevel)(unsafe.Pointer(pLevel)).FaddrBody + int32(1) + pOp = _sqlite3VdbeGetOp(tls, v, k) + pLastOp = pOp + uintptr(last-k)*24 + for { + if (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 != (*TWhereLevel)(unsafe.Pointer(pLevel)).FiTabCur { + /* no-op */ + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) || int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Offset) { + x = (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Offset) { + /* Do not need to translate the column number */ + } else { + if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { + pPk = _sqlite3PrimaryKeyIndex(tls, pTab) + x = int32(*(*Ti16)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(x)*2))) + } else { + x = int32(_sqlite3StorageColumnToTable(tls, pTab, int16(x))) + } + } + x = int32(_sqlite3TableColumnToIndex(tls, pIdx1, int16(x))) + if x >= 0 { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp2 = x + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + } else { + /* Unable to translate the table reference into an index + ** reference. Verify that this is harmless - that the + ** table being referenced really is open. + */ + } + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Rowid) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + (*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode = uint8(OP_IdxRowid) + } else { + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_IfNullRow) { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*TWhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + } + } + } + } + goto _11 + _11: + ; + pOp += 24 + v10 = pOp + if !(v10 < pLastOp) { + break + } + } + } + goto _9 + _9: + ; + i++ + pLevel += 104 + } + /* The "break" point is here, just past the end of the outer loop. + ** Set it. + */ + _sqlite3VdbeResolveLabel(tls, v, (*TWhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) + /* Final cleanup + */ + (*TParse)(unsafe.Pointer(pParse)).FnQueryLoop = int16((*TWhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) + _whereInfoFree(tls, db, pWInfo) + p12 = pParse + 38 + *(*Tu8)(unsafe.Pointer(p12)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p12))) - nRJ) + return +} + +/************** End of where.c ***********************************************/ +/************** Begin file window.c ******************************************/ +/* +** 2018 May 08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* + */ +/* #include "sqliteInt.h" */ + +/* +** SELECT REWRITING +** +** Any SELECT statement that contains one or more window functions in +** either the select list or ORDER BY clause (the only two places window +** functions may be used) is transformed by function sqlite3WindowRewrite() +** in order to support window function processing. For example, with the +** schema: +** +** CREATE TABLE t1(a, b, c, d, e, f, g); +** +** the statement: +** +** SELECT a+1, max(b) OVER (PARTITION BY c ORDER BY d) FROM t1 ORDER BY e; +** +** is transformed to: +** +** SELECT a+1, max(b) OVER (PARTITION BY c ORDER BY d) FROM ( +** SELECT a, e, c, d, b FROM t1 ORDER BY c, d +** ) ORDER BY e; +** +** The flattening optimization is disabled when processing this transformed +** SELECT statement. This allows the implementation of the window function +** (in this case max()) to process rows sorted in order of (c, d), which +** makes things easier for obvious reasons. More generally: +** +** * FROM, WHERE, GROUP BY and HAVING clauses are all moved to +** the sub-query. +** +** * ORDER BY, LIMIT and OFFSET remain part of the parent query. +** +** * Terminals from each of the expression trees that make up the +** select-list and ORDER BY expressions in the parent query are +** selected by the sub-query. For the purposes of the transformation, +** terminals are column references and aggregate functions. +** +** If there is more than one window function in the SELECT that uses +** the same window declaration (the OVER bit), then a single scan may +** be used to process more than one window function. For example: +** +** SELECT max(b) OVER (PARTITION BY c ORDER BY d), +** min(e) OVER (PARTITION BY c ORDER BY d) +** FROM t1; +** +** is transformed in the same way as the example above. However: +** +** SELECT max(b) OVER (PARTITION BY c ORDER BY d), +** min(e) OVER (PARTITION BY a ORDER BY b) +** FROM t1; +** +** Must be transformed to: +** +** SELECT max(b) OVER (PARTITION BY c ORDER BY d) FROM ( +** SELECT e, min(e) OVER (PARTITION BY a ORDER BY b), c, d, b FROM +** SELECT a, e, c, d, b FROM t1 ORDER BY a, b +** ) ORDER BY c, d +** ) ORDER BY e; +** +** so that both min() and max() may process rows in the order defined by +** their respective window declarations. +** +** INTERFACE WITH SELECT.C +** +** When processing the rewritten SELECT statement, code in select.c calls +** sqlite3WhereBegin() to begin iterating through the results of the +** sub-query, which is always implemented as a co-routine. It then calls +** sqlite3WindowCodeStep() to process rows and finish the scan by calling +** sqlite3WhereEnd(). +** +** sqlite3WindowCodeStep() generates VM code so that, for each row returned +** by the sub-query a sub-routine (OP_Gosub) coded by select.c is invoked. +** When the sub-routine is invoked: +** +** * The results of all window-functions for the row are stored +** in the associated Window.regResult registers. +** +** * The required terminal values are stored in the current row of +** temp table Window.iEphCsr. +** +** In some cases, depending on the window frame and the specific window +** functions invoked, sqlite3WindowCodeStep() caches each entire partition +** in a temp table before returning any rows. In other cases it does not. +** This detail is encapsulated within this file, the code generated by +** select.c is the same in either case. +** +** BUILT-IN WINDOW FUNCTIONS +** +** This implementation features the following built-in window functions: +** +** row_number() +** rank() +** dense_rank() +** percent_rank() +** cume_dist() +** ntile(N) +** lead(expr [, offset [, default]]) +** lag(expr [, offset [, default]]) +** first_value(expr) +** last_value(expr) +** nth_value(expr, N) +** +** These are the same built-in window functions supported by Postgres. +** Although the behaviour of aggregate window functions (functions that +** can be used as either aggregates or window functions) allows them to +** be implemented using an API, built-in window functions are much more +** esoteric. Additionally, some window functions (e.g. nth_value()) +** may only be implemented by caching the entire partition in memory. +** As such, some built-in window functions use the same API as aggregate +** window functions and some are implemented directly using VDBE +** instructions. Additionally, for those functions that use the API, the +** window frame is sometimes modified before the SELECT statement is +** rewritten. For example, regardless of the specified window frame, the +** row_number() function always uses: +** +** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +** +** See sqlite3WindowUpdate() for details. +** +** As well as some of the built-in window functions, aggregate window +** functions min() and max() are implemented using VDBE instructions if +** the start of the window frame is declared as anything other than +** UNBOUNDED PRECEDING. + */ + +// C documentation +// +// /* +// ** Implementation of built-in window function row_number(). Assumes that the +// ** window frame has been coerced to: +// ** +// ** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +// */ +func _row_numberStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(8)) + if p != 0 { + *(*Ti64)(unsafe.Pointer(p))++ + } + _ = nArg + _ = apArg +} + +func _row_numberValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + var v1 int64 + _, _ = p, v1 + p = Xsqlite3_aggregate_context(tls, pCtx, int32(8)) + if p != 0 { + v1 = *(*Ti64)(unsafe.Pointer(p)) + } else { + v1 = 0 + } + Xsqlite3_result_int64(tls, pCtx, v1) +} + +/* +** Context object type used by rank(), dense_rank(), percent_rank() and +** cume_dist(). + */ +type TCallCount = struct { + FnValue Ti64 + FnStep Ti64 + FnTotal Ti64 +} + +type CallCount = TCallCount + +// C documentation +// +// /* +// ** Implementation of built-in window function dense_rank(). Assumes that +// ** the window frame has been set to: +// ** +// ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +// */ +func _dense_rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnStep = int64(1) + } + _ = nArg + _ = apArg +} + +func _dense_rankValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + if (*TCallCount)(unsafe.Pointer(p)).FnStep != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnValue++ + (*TCallCount)(unsafe.Pointer(p)).FnStep = 0 + } + Xsqlite3_result_int64(tls, pCtx, (*TCallCount)(unsafe.Pointer(p)).FnValue) + } +} + +/* +** Implementation of built-in window function nth_value(). This +** implementation is used in "slow mode" only - when the EXCLUDE clause +** is not set to the default value "NO OTHERS". + */ +type TNthValueCtx = struct { + FnStep Ti64 + FpValue uintptr +} + +type NthValueCtx = TNthValueCtx + +func _nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var fVal float64 + var iVal Ti64 + var p uintptr + _, _, _ = fVal, iVal, p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 { + switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) { + case int32(SQLITE_INTEGER): + iVal = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + case int32(SQLITE_FLOAT): + fVal = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + if float64(int64(fVal)) != fVal { + goto error_out + } + iVal = int64(fVal) + default: + goto error_out + } + if iVal <= 0 { + goto error_out + } + (*TNthValueCtx)(unsafe.Pointer(p)).FnStep++ + if iVal == (*TNthValueCtx)(unsafe.Pointer(p)).FnStep { + (*TNthValueCtx)(unsafe.Pointer(p)).FpValue = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if !((*TNthValueCtx)(unsafe.Pointer(p)).FpValue != 0) { + Xsqlite3_result_error_nomem(tls, pCtx) + } + } + } + _ = nArg + _ = apArg + return +error_out: + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22588, -int32(1)) +} + +func _nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if p != 0 && (*TNthValueCtx)(unsafe.Pointer(p)).FpValue != 0 { + Xsqlite3_result_value(tls, pCtx, (*TNthValueCtx)(unsafe.Pointer(p)).FpValue) + Xsqlite3_value_free(tls, (*TNthValueCtx)(unsafe.Pointer(p)).FpValue) + (*TNthValueCtx)(unsafe.Pointer(p)).FpValue = uintptr(0) + } +} + +func _first_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 && (*TNthValueCtx)(unsafe.Pointer(p)).FpValue == uintptr(0) { + (*TNthValueCtx)(unsafe.Pointer(p)).FpValue = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if !((*TNthValueCtx)(unsafe.Pointer(p)).FpValue != 0) { + Xsqlite3_result_error_nomem(tls, pCtx) + } + } + _ = nArg + _ = apArg +} + +func _first_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 && (*TNthValueCtx)(unsafe.Pointer(p)).FpValue != 0 { + Xsqlite3_result_value(tls, pCtx, (*TNthValueCtx)(unsafe.Pointer(p)).FpValue) + Xsqlite3_value_free(tls, (*TNthValueCtx)(unsafe.Pointer(p)).FpValue) + (*TNthValueCtx)(unsafe.Pointer(p)).FpValue = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Implementation of built-in window function rank(). Assumes that +// ** the window frame has been set to: +// ** +// ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +// */ +func _rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnStep++ + if (*TCallCount)(unsafe.Pointer(p)).FnValue == 0 { + (*TCallCount)(unsafe.Pointer(p)).FnValue = (*TCallCount)(unsafe.Pointer(p)).FnStep + } + } + _ = nArg + _ = apArg +} + +func _rankValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + Xsqlite3_result_int64(tls, pCtx, (*TCallCount)(unsafe.Pointer(p)).FnValue) + (*TCallCount)(unsafe.Pointer(p)).FnValue = 0 + } +} + +// C documentation +// +// /* +// ** Implementation of built-in window function percent_rank(). Assumes that +// ** the window frame has been set to: +// ** +// ** GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING +// */ +func _percent_rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnTotal++ + } +} + +func _percent_rankInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + (*TCallCount)(unsafe.Pointer(p)).FnStep++ +} + +func _percent_rankValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + var r float64 + _, _ = p, r + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnValue = (*TCallCount)(unsafe.Pointer(p)).FnStep + if (*TCallCount)(unsafe.Pointer(p)).FnTotal > int64(1) { + r = float64((*TCallCount)(unsafe.Pointer(p)).FnValue) / float64((*TCallCount)(unsafe.Pointer(p)).FnTotal-libc.Int64FromInt32(1)) + Xsqlite3_result_double(tls, pCtx, r) + } else { + Xsqlite3_result_double(tls, pCtx, float64(0)) + } + } +} + +// C documentation +// +// /* +// ** Implementation of built-in window function cume_dist(). Assumes that +// ** the window frame has been set to: +// ** +// ** GROUPS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING +// */ +func _cume_distStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + (*TCallCount)(unsafe.Pointer(p)).FnTotal++ + } +} + +func _cume_distInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + (*TCallCount)(unsafe.Pointer(p)).FnStep++ +} + +func _cume_distValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + var r float64 + _, _ = p, r + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if p != 0 { + r = float64((*TCallCount)(unsafe.Pointer(p)).FnStep) / float64((*TCallCount)(unsafe.Pointer(p)).FnTotal) + Xsqlite3_result_double(tls, pCtx, r) + } +} + +/* +** Context object for ntile() window function. + */ +type TNtileCtx = struct { + FnTotal Ti64 + FnParam Ti64 + FiRow Ti64 +} + +type NtileCtx = TNtileCtx + +// C documentation +// +// /* +// ** Implementation of ntile(). This assumes that the window frame has +// ** been coerced to: +// ** +// ** ROWS CURRENT ROW AND UNBOUNDED FOLLOWING +// */ +func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 { + if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { + (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+22644, -int32(1)) + } + } + (*TNtileCtx)(unsafe.Pointer(p)).FnTotal++ + } +} + +func _ntileInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + (*TNtileCtx)(unsafe.Pointer(p)).FiRow++ +} + +func _ntileValueFunc(tls *libc.TLS, pCtx uintptr) { + var iRow, iSmall, nLarge Ti64 + var nSize int32 + var p uintptr + _, _, _, _, _ = iRow, iSmall, nLarge, nSize, p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) + if p != 0 && (*TNtileCtx)(unsafe.Pointer(p)).FnParam > 0 { + nSize = int32((*TNtileCtx)(unsafe.Pointer(p)).FnTotal / (*TNtileCtx)(unsafe.Pointer(p)).FnParam) + if nSize == 0 { + Xsqlite3_result_int64(tls, pCtx, (*TNtileCtx)(unsafe.Pointer(p)).FiRow+int64(1)) + } else { + nLarge = (*TNtileCtx)(unsafe.Pointer(p)).FnTotal - (*TNtileCtx)(unsafe.Pointer(p)).FnParam*int64(nSize) + iSmall = nLarge * int64(nSize+libc.Int32FromInt32(1)) + iRow = (*TNtileCtx)(unsafe.Pointer(p)).FiRow + if iRow < iSmall { + Xsqlite3_result_int64(tls, pCtx, int64(1)+iRow/int64(nSize+libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_int64(tls, pCtx, int64(1)+nLarge+(iRow-iSmall)/int64(nSize)) + } + } + } +} + +/* +** Context object for last_value() window function. + */ +type TLastValueCtx = struct { + FpVal uintptr + FnVal int32 +} + +type LastValueCtx = TLastValueCtx + +// C documentation +// +// /* +// ** Implementation of last_value(). +// */ +func _last_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 { + Xsqlite3_value_free(tls, (*TLastValueCtx)(unsafe.Pointer(p)).FpVal) + (*TLastValueCtx)(unsafe.Pointer(p)).FpVal = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if (*TLastValueCtx)(unsafe.Pointer(p)).FpVal == uintptr(0) { + Xsqlite3_result_error_nomem(tls, pCtx) + } else { + (*TLastValueCtx)(unsafe.Pointer(p)).FnVal++ + } + } +} + +func _last_valueInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { + var p uintptr + _ = p + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 { + (*TLastValueCtx)(unsafe.Pointer(p)).FnVal-- + if (*TLastValueCtx)(unsafe.Pointer(p)).FnVal == 0 { + Xsqlite3_value_free(tls, (*TLastValueCtx)(unsafe.Pointer(p)).FpVal) + (*TLastValueCtx)(unsafe.Pointer(p)).FpVal = uintptr(0) + } + } +} + +func _last_valueValueFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if p != 0 && (*TLastValueCtx)(unsafe.Pointer(p)).FpVal != 0 { + Xsqlite3_result_value(tls, pCtx, (*TLastValueCtx)(unsafe.Pointer(p)).FpVal) + } +} + +func _last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { + var p uintptr + _ = p + p = Xsqlite3_aggregate_context(tls, pCtx, int32(16)) + if p != 0 && (*TLastValueCtx)(unsafe.Pointer(p)).FpVal != 0 { + Xsqlite3_result_value(tls, pCtx, (*TLastValueCtx)(unsafe.Pointer(p)).FpVal) + Xsqlite3_value_free(tls, (*TLastValueCtx)(unsafe.Pointer(p)).FpVal) + (*TLastValueCtx)(unsafe.Pointer(p)).FpVal = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Static names for the built-in window function names. These static +// ** names are used, rather than string literals, so that FuncDef objects +// ** can be associated with a particular window function by direct +// ** comparison of the zName pointer. Example: +// ** +// ** if( pFuncDef->zName==row_valueName ){ ... } +// */ +var _row_numberName = [11]int8{'r', 'o', 'w', '_', 'n', 'u', 'm', 'b', 'e', 'r'} +var _dense_rankName = [11]int8{'d', 'e', 'n', 's', 'e', '_', 'r', 'a', 'n', 'k'} +var _rankName = [5]int8{'r', 'a', 'n', 'k'} +var _percent_rankName = [13]int8{'p', 'e', 'r', 'c', 'e', 'n', 't', '_', 'r', 'a', 'n', 'k'} +var _cume_distName = [10]int8{'c', 'u', 'm', 'e', '_', 'd', 'i', 's', 't'} +var _ntileName = [6]int8{'n', 't', 'i', 'l', 'e'} +var _last_valueName = [11]int8{'l', 'a', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} +var _nth_valueName = [10]int8{'n', 't', 'h', '_', 'v', 'a', 'l', 'u', 'e'} +var _first_valueName = [12]int8{'f', 'i', 'r', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} +var _leadName = [5]int8{'l', 'e', 'a', 'd'} +var _lagName = [4]int8{'l', 'a', 'g'} + +// C documentation +// +// /* +// ** No-op implementations of xStep() and xFinalize(). Used as place-holders +// ** for built-in window functions that never call those interfaces. +// ** +// ** The noopValueFunc() is called but is expected to do nothing. The +// ** noopStepFunc() is never called, and so it is marked with NO_TEST to +// ** let the test coverage routine know not to expect this function to be +// ** invoked. +// */ +func _noopStepFunc(tls *libc.TLS, p uintptr, n int32, a uintptr) { + /*NO_TEST*/ + _ = p /*NO_TEST*/ + _ = n /*NO_TEST*/ + _ = a /*NO_TEST*/ + /*NO_TEST*/ +} + +/*NO_TEST*/ +func _noopValueFunc(tls *libc.TLS, p uintptr) { + _ = p /*no-op*/ +} + +/* Window functions that use all window interfaces: xStep, xFinal, +** xValue, and xInverse */ + +/* Window functions that are implemented using bytecode and thus have +** no-op routines for their methods */ + +/* Window functions that use all window interfaces: xStep, the +** same routine for xFinalize and xValue and which never call +** xInverse. */ + +// C documentation +// +// /* +// ** Register those built-in window functions that are not also aggregates. +// */ +func _sqlite3WindowFunctions(tls *libc.TLS) { + _sqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&_aWindowFuncs)), int32(libc.Uint64FromInt64(1080)/libc.Uint64FromInt64(72))) +} + +var _aWindowFuncs = [15]TFuncDef{ + 0: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_row_numberName)), + }, + 1: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_dense_rankName)), + }, + 2: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_rankName)), + }, + 3: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_percent_rankName)), + }, + 4: { + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_cume_distName)), + }, + 5: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_ntileName)), + }, + 6: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_last_valueName)), + }, + 7: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_nth_valueName)), + }, + 8: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_first_valueName)), + }, + 9: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_leadName)), + }, + 10: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_leadName)), + }, + 11: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_leadName)), + }, + 12: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_lagName)), + }, + 13: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_lagName)), + }, + 14: { + FnArg: int8(3), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_WINDOW) | libc.Int32FromInt32(0)), + FzName: uintptr(unsafe.Pointer(&_lagName)), + }, +} + +func init() { + p := unsafe.Pointer(&_aWindowFuncs) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_row_numberStepFunc) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_row_numberValueFunc) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_row_numberValueFunc) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_dense_rankStepFunc) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_dense_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_dense_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_rankStepFunc) + *(*uintptr)(unsafe.Add(p, 176)) = __ccgo_fp(_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 192)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_percent_rankStepFunc) + *(*uintptr)(unsafe.Add(p, 248)) = __ccgo_fp(_percent_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 256)) = __ccgo_fp(_percent_rankValueFunc) + *(*uintptr)(unsafe.Add(p, 264)) = __ccgo_fp(_percent_rankInvFunc) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_cume_distStepFunc) + *(*uintptr)(unsafe.Add(p, 320)) = __ccgo_fp(_cume_distValueFunc) + *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_cume_distValueFunc) + *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_cume_distInvFunc) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(_ntileStepFunc) + *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_ntileValueFunc) + *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_ntileValueFunc) + *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_ntileInvFunc) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_last_valueStepFunc) + *(*uintptr)(unsafe.Add(p, 464)) = __ccgo_fp(_last_valueFinalizeFunc) + *(*uintptr)(unsafe.Add(p, 472)) = __ccgo_fp(_last_valueValueFunc) + *(*uintptr)(unsafe.Add(p, 480)) = __ccgo_fp(_last_valueInvFunc) + *(*uintptr)(unsafe.Add(p, 528)) = __ccgo_fp(_nth_valueStepFunc) + *(*uintptr)(unsafe.Add(p, 536)) = __ccgo_fp(_nth_valueFinalizeFunc) + *(*uintptr)(unsafe.Add(p, 544)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 552)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(_first_valueStepFunc) + *(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(_first_valueFinalizeFunc) + *(*uintptr)(unsafe.Add(p, 616)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 624)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 672)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 680)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 688)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 696)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 744)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 752)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 760)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 768)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 816)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 824)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 832)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 840)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 888)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 896)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 904)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 912)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 960)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 968)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 976)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 984)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 1032)) = __ccgo_fp(_noopStepFunc) + *(*uintptr)(unsafe.Add(p, 1040)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 1048)) = __ccgo_fp(_noopValueFunc) + *(*uintptr)(unsafe.Add(p, 1056)) = __ccgo_fp(_noopStepFunc) +} + +func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + _ = p + p = pList + for { + if !(p != 0) { + break + } + if _sqlite3StrICmp(tls, (*TWindow)(unsafe.Pointer(p)).FzName, zName) == 0 { + break + } + goto _1 + _1: + ; + p = (*TWindow)(unsafe.Pointer(p)).FpNextWin + } + if p == uintptr(0) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22689, libc.VaList(bp+8, zName)) + } + return p +} + +// C documentation +// +// /* +// ** This function is called immediately after resolving the function name +// ** for a window function within a SELECT statement. Argument pList is a +// ** linked list of WINDOW definitions for the current SELECT statement. +// ** Argument pFunc is the function definition just resolved and pWin +// ** is the Window object representing the associated OVER clause. This +// ** function updates the contents of pWin as follows: +// ** +// ** * If the OVER clause referred to a named window (as in "max(x) OVER win"), +// ** search list pList for a matching WINDOW definition, and update pWin +// ** accordingly. If no such WINDOW clause can be found, leave an error +// ** in pParse. +// ** +// ** * If the function is a built-in window function that requires the +// ** window to be coerced (see "BUILT-IN WINDOW FUNCTIONS" at the top +// ** of this file), pWin is updated here. +// */ +func _sqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uintptr, pFunc uintptr) { + var aUp [8]struct { + FzFunc uintptr + FeFrmType int32 + FeStart int32 + FeEnd int32 + } + var db, p, v2 uintptr + var i int32 + _, _, _, _, _ = aUp, db, i, p, v2 + if (*TWindow)(unsafe.Pointer(pWin)).FzName != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == 0 { + p = _windowFind(tls, pParse, pList, (*TWindow)(unsafe.Pointer(pWin)).FzName) + if p == uintptr(0) { + return + } + (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWindow)(unsafe.Pointer(p)).FpPartition, 0) + (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = _sqlite3ExprListDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWindow)(unsafe.Pointer(p)).FpOrderBy, 0) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWindow)(unsafe.Pointer(p)).FpStart, 0) + (*TWindow)(unsafe.Pointer(pWin)).FpEnd = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TWindow)(unsafe.Pointer(p)).FpEnd, 0) + (*TWindow)(unsafe.Pointer(pWin)).FeStart = (*TWindow)(unsafe.Pointer(p)).FeStart + (*TWindow)(unsafe.Pointer(pWin)).FeEnd = (*TWindow)(unsafe.Pointer(p)).FeEnd + (*TWindow)(unsafe.Pointer(pWin)).FeFrmType = (*TWindow)(unsafe.Pointer(p)).FeFrmType + (*TWindow)(unsafe.Pointer(pWin)).FeExclude = (*TWindow)(unsafe.Pointer(p)).FeExclude + } else { + _sqlite3WindowChain(tls, pParse, pWin, pList) + } + if int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) == int32(TK_RANGE) && ((*TWindow)(unsafe.Pointer(pWin)).FpStart != 0 || (*TWindow)(unsafe.Pointer(pWin)).FpEnd != 0) && ((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0) || (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != int32(1)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22708, 0) + } else { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_WINDOW) != 0 { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22779, 0) + } else { + aUp = [8]struct { + FzFunc uintptr + FeFrmType int32 + FeStart int32 + FeEnd int32 + }{ + 0: { + FzFunc: uintptr(unsafe.Pointer(&_row_numberName)), + FeFrmType: int32(TK_ROWS), + FeStart: int32(TK_UNBOUNDED), + FeEnd: int32(TK_CURRENT), + }, + 1: { + FzFunc: uintptr(unsafe.Pointer(&_dense_rankName)), + FeFrmType: int32(TK_RANGE), + FeStart: int32(TK_UNBOUNDED), + FeEnd: int32(TK_CURRENT), + }, + 2: { + FzFunc: uintptr(unsafe.Pointer(&_rankName)), + FeFrmType: int32(TK_RANGE), + FeStart: int32(TK_UNBOUNDED), + FeEnd: int32(TK_CURRENT), + }, + 3: { + FzFunc: uintptr(unsafe.Pointer(&_percent_rankName)), + FeFrmType: int32(TK_GROUPS), + FeStart: int32(TK_CURRENT), + FeEnd: int32(TK_UNBOUNDED), + }, + 4: { + FzFunc: uintptr(unsafe.Pointer(&_cume_distName)), + FeFrmType: int32(TK_GROUPS), + FeStart: int32(TK_FOLLOWING), + FeEnd: int32(TK_UNBOUNDED), + }, + 5: { + FzFunc: uintptr(unsafe.Pointer(&_ntileName)), + FeFrmType: int32(TK_ROWS), + FeStart: int32(TK_CURRENT), + FeEnd: int32(TK_UNBOUNDED), + }, + 6: { + FzFunc: uintptr(unsafe.Pointer(&_leadName)), + FeFrmType: int32(TK_ROWS), + FeStart: int32(TK_UNBOUNDED), + FeEnd: int32(TK_UNBOUNDED), + }, + 7: { + FzFunc: uintptr(unsafe.Pointer(&_lagName)), + FeFrmType: int32(TK_ROWS), + FeStart: int32(TK_UNBOUNDED), + FeEnd: int32(TK_CURRENT), + }, + } + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(192)/libc.Uint64FromInt64(24))) { + break + } + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == aUp[i].FzFunc { + _sqlite3ExprDelete(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FpStart) + _sqlite3ExprDelete(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FpEnd) + v2 = libc.UintptrFromInt32(0) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = v2 + (*TWindow)(unsafe.Pointer(pWin)).FpEnd = v2 + (*TWindow)(unsafe.Pointer(pWin)).FeFrmType = uint8(aUp[i].FeFrmType) + (*TWindow)(unsafe.Pointer(pWin)).FeStart = uint8(aUp[i].FeStart) + (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(aUp[i].FeEnd) + (*TWindow)(unsafe.Pointer(pWin)).FeExclude = uint8(0) + if int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) == int32(TK_FOLLOWING) { + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+8162) + } + break + } + goto _1 + _1: + ; + i++ + } + } + } + } + (*TWindow)(unsafe.Pointer(pWin)).FpWFunc = pFunc +} + +// C documentation +// +// /* +// ** Context object passed through sqlite3WalkExprList() to +// ** selectWindowRewriteExprCb() by selectWindowRewriteEList(). +// */ +type TWindowRewrite = struct { + FpWin uintptr + FpSrc uintptr + FpSub uintptr + FpTab uintptr + FpSubSelect uintptr +} + +type WindowRewrite = TWindowRewrite + +type TWindowRewrite1 = struct { + FpWin uintptr + FpSrc uintptr + FpSub uintptr + FpTab uintptr + FpSubSelect uintptr +} + +type WindowRewrite1 = TWindowRewrite1 + +// C documentation +// +// /* +// ** Callback function used by selectWindowRewriteEList(). If necessary, +// ** this function appends to the output expression-list and updates +// ** expression (*ppExpr) in place. +// */ +func _selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + var f, i, i1, iCol, nSrc, v4 int32 + var p, pDup, pParse, pWin uintptr + _, _, _, _, _, _, _, _, _, _ = f, i, i1, iCol, nSrc, p, pDup, pParse, pWin, v4 + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pParse = (*TWalker)(unsafe.Pointer(pWalker)).FpParse + /* If this function is being called from within a scalar sub-select + ** that used by the SELECT statement being processed, only process + ** TK_COLUMN expressions that refer to it (the outer SELECT). Do + ** not process aggregates or window functions at all, as they belong + ** to the scalar sub-select. */ + if (*TWindowRewrite1)(unsafe.Pointer(p)).FpSubSelect != 0 { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_COLUMN) { + return WRC_Continue + } else { + nSrc = (*TSrcList)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpSrc)).FnSrc + i = 0 + for { + if !(i < nSrc) { + break + } + if (*TExpr)(unsafe.Pointer(pExpr)).FiTable == (*(*TSrcItem)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpSrc + 8 + uintptr(i)*104))).FiCursor { + break + } + goto _1 + _1: + ; + i++ + } + if i == nSrc { + return WRC_Continue + } + } + } + switch int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) { + case int32(TK_FUNCTION): + if !((*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(libc.Int32FromInt32(EP_WinFunc)) != libc.Uint32FromInt32(0)) { + break + } else { + pWin = (*TWindowRewrite1)(unsafe.Pointer(p)).FpWin + for { + if !(pWin != 0) { + break + } + if *(*uintptr)(unsafe.Pointer(pExpr + 64)) == pWin { + return int32(WRC_Prune) + } + goto _2 + _2: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + } + fallthrough + case int32(TK_IF_NULL_ROW): + fallthrough + case int32(TK_AGG_FUNCTION): + fallthrough + case int32(TK_COLUMN): + iCol = -int32(1) + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return int32(WRC_Abort) + } + if (*TWindowRewrite1)(unsafe.Pointer(p)).FpSub != 0 { + i1 = 0 + for { + if !(i1 < (*TExprList)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpSub)).FnExpr) { + break + } + if 0 == _sqlite3ExprCompare(tls, uintptr(0), (*(*TExprList_item)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpSub + 8 + uintptr(i1)*32))).FpExpr, pExpr, -int32(1)) { + iCol = i1 + break + } + goto _3 + _3: + ; + i1++ + } + } + if iCol < 0 { + pDup = _sqlite3ExprDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) + if pDup != 0 && int32((*TExpr)(unsafe.Pointer(pDup)).Fop) == int32(TK_AGG_FUNCTION) { + (*TExpr)(unsafe.Pointer(pDup)).Fop = uint8(TK_FUNCTION) + } + (*TWindowRewrite1)(unsafe.Pointer(p)).FpSub = _sqlite3ExprListAppend(tls, pParse, (*TWindowRewrite1)(unsafe.Pointer(p)).FpSub, pDup) + } + if (*TWindowRewrite1)(unsafe.Pointer(p)).FpSub != 0 { + f = int32((*TExpr)(unsafe.Pointer(pExpr)).Fflags & uint32(EP_Collate)) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) |= uint32(libc.Int32FromInt32(EP_Static)) + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + *(*Tu32)(unsafe.Pointer(pExpr + 4)) &= uint32(^libc.Int32FromInt32(EP_Static)) + libc.Xmemset(tls, pExpr, 0, uint64(72)) + (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_COLUMN) + if iCol < 0 { + v4 = (*TExprList)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpSub)).FnExpr - int32(1) + } else { + v4 = iCol + } + (*TExpr)(unsafe.Pointer(pExpr)).FiColumn = int16(v4) + (*TExpr)(unsafe.Pointer(pExpr)).FiTable = (*TWindow)(unsafe.Pointer((*TWindowRewrite1)(unsafe.Pointer(p)).FpWin)).FiEphCsr + *(*uintptr)(unsafe.Pointer(pExpr + 64)) = (*TWindowRewrite1)(unsafe.Pointer(p)).FpTab + (*TExpr)(unsafe.Pointer(pExpr)).Fflags = uint32(f) + } + if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return int32(WRC_Abort) + } + default: /* no-op */ + break + } + return WRC_Continue +} + +func _selectWindowRewriteSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) (r int32) { + var p, pSave uintptr + _, _ = p, pSave + p = *(*uintptr)(unsafe.Pointer(pWalker + 40)) + pSave = (*TWindowRewrite1)(unsafe.Pointer(p)).FpSubSelect + if pSave == pSelect { + return WRC_Continue + } else { + (*TWindowRewrite1)(unsafe.Pointer(p)).FpSubSelect = pSelect + _sqlite3WalkSelect(tls, pWalker, pSelect) + (*TWindowRewrite1)(unsafe.Pointer(p)).FpSubSelect = pSave + } + return int32(WRC_Prune) +} + +// C documentation +// +// /* +// ** Iterate through each expression in expression-list pEList. For each: +// ** +// ** * TK_COLUMN, +// ** * aggregate function, or +// ** * window function with a Window object that is not a member of the +// ** Window list passed as the second argument (pWin). +// ** +// ** Append the node to output expression-list (*ppSub). And replace it +// ** with a TK_COLUMN that reads the (N-1)th element of table +// ** pWin->iEphCsr, where N is the number of elements in (*ppSub) after +// ** appending the new one. +// */ +func _selectWindowRewriteEList(tls *libc.TLS, pParse uintptr, pWin uintptr, pSrc uintptr, pEList uintptr, pTab uintptr, ppSub uintptr) { + bp := tls.Alloc(96) + defer tls.Free(96) + var _ /* sRewrite at bp+48 */ TWindowRewrite + var _ /* sWalker at bp+0 */ TWalker + libc.Xmemset(tls, bp, 0, uint64(48)) + libc.Xmemset(tls, bp+48, 0, uint64(40)) + (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpSub = *(*uintptr)(unsafe.Pointer(ppSub)) + (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpWin = pWin + (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpSrc = pSrc + (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpTab = pTab + (*(*TWalker)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWalker)(unsafe.Pointer(bp))).FxExprCallback = __ccgo_fp(_selectWindowRewriteExprCb) + (*(*TWalker)(unsafe.Pointer(bp))).FxSelectCallback = __ccgo_fp(_selectWindowRewriteSelectCb) + *(*uintptr)(unsafe.Pointer(bp + 40)) = bp + 48 + _sqlite3WalkExprList(tls, bp, pEList) + *(*uintptr)(unsafe.Pointer(ppSub)) = (*(*TWindowRewrite)(unsafe.Pointer(bp + 48))).FpSub +} + +// C documentation +// +// /* +// ** Append a copy of each expression in expression-list pAppend to +// ** expression list pList. Return a pointer to the result list. +// */ +func _exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend uintptr, bIntToNull int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pDup, pSub uintptr + var i, nInit, v1 int32 + var _ /* iDummy at bp+0 */ int32 + _, _, _, _, _, _ = db, i, nInit, pDup, pSub, v1 + if pAppend != 0 { + if pList != 0 { + v1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } else { + v1 = 0 + } + nInit = v1 + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pAppend)).FnExpr) { + break + } + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pDup = _sqlite3ExprDup(tls, db, (*(*TExprList_item)(unsafe.Pointer(pAppend + 8 + uintptr(i)*32))).FpExpr, 0) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + _sqlite3ExprDelete(tls, db, pDup) + break + } + if bIntToNull != 0 { + pSub = _sqlite3ExprSkipCollateAndLikely(tls, pDup) + if _sqlite3ExprIsInteger(tls, pSub, bp) != 0 { + (*TExpr)(unsafe.Pointer(pSub)).Fop = uint8(TK_NULL) + *(*Tu32)(unsafe.Pointer(pSub + 4)) &= uint32(^(libc.Int32FromInt32(EP_IntValue) | libc.Int32FromInt32(EP_IsTrue) | libc.Int32FromInt32(EP_IsFalse))) + *(*uintptr)(unsafe.Pointer(pSub + 8)) = uintptr(0) + } + } + pList = _sqlite3ExprListAppend(tls, pParse, pList, pDup) + if pList != 0 { + (*(*TExprList_item)(unsafe.Pointer(pList + 8 + uintptr(nInit+i)*32))).Ffg.FsortFlags = (*(*TExprList_item)(unsafe.Pointer(pAppend + 8 + uintptr(i)*32))).Ffg.FsortFlags + } + goto _2 + _2: + ; + i++ + } + } + return pList +} + +// C documentation +// +// /* +// ** When rewriting a query, if the new subquery in the FROM clause +// ** contains TK_AGG_FUNCTION nodes that refer to an outer query, +// ** then we have to increase the Expr->op2 values of those nodes +// ** due to the extra subquery layer that was added. +// ** +// ** See also the incrAggDepth() routine in resolve.c +// */ +func _sqlite3WindowExtraAggFuncDepth(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && int32((*TExpr)(unsafe.Pointer(pExpr)).Fop2) >= (*TWalker)(unsafe.Pointer(pWalker)).FwalkerDepth { + (*TExpr)(unsafe.Pointer(pExpr)).Fop2++ + } + return WRC_Continue +} + +func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + if int32((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { + _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+22842, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) + } + return WRC_Continue +} + +// C documentation +// +// /* +// ** If the SELECT statement passed as the second argument does not invoke +// ** any SQL window functions, this function is a no-op. Otherwise, it +// ** rewrites the SELECT statement so that window function xStep functions +// ** are invoked in the correct order as described under "SELECT REWRITING" +// ** at the top of this file. +// */ +func _sqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var db, pArgs, pFilter, pGroupBy, pHaving, pMWin, pSort, pSrc, pSub, pTab, pTab2, pWhere, pWin, v, v10, v2, v8 uintptr + var nSave, rc, v1, v3, v5, v6, v7, v9 int32 + var selFlags Tu32 + var _ /* pSublist at bp+0 */ uintptr + var _ /* w at bp+8 */ TWalker + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = db, nSave, pArgs, pFilter, pGroupBy, pHaving, pMWin, pSort, pSrc, pSub, pTab, pTab2, pWhere, pWin, rc, selFlags, v, v1, v10, v2, v3, v5, v6, v7, v8, v9 + rc = SQLITE_OK + if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 && (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) && (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_WinRewrite) == uint32(0) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + v = _sqlite3GetVdbe(tls, pParse) + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pSub = uintptr(0) /* The subquery */ + pSrc = (*TSelect)(unsafe.Pointer(p)).FpSrc + pWhere = (*TSelect)(unsafe.Pointer(p)).FpWhere + pGroupBy = (*TSelect)(unsafe.Pointer(p)).FpGroupBy + pHaving = (*TSelect)(unsafe.Pointer(p)).FpHaving + pSort = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Expression list for sub-query */ + pMWin = (*TSelect)(unsafe.Pointer(p)).FpWin + selFlags = (*TSelect)(unsafe.Pointer(p)).FselFlags + pTab = _sqlite3DbMallocZero(tls, db, uint64(104)) + if pTab == uintptr(0) { + return _sqlite3ErrorToParser(tls, db, int32(SQLITE_NOMEM)) + } + _sqlite3AggInfoPersistWalkerInit(tls, bp+8, pParse) + _sqlite3WalkSelect(tls, bp+8, p) + if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { + (*(*TWalker)(unsafe.Pointer(bp + 8))).FxExprCallback = __ccgo_fp(_disallowAggregatesInOrderByCb) + (*(*TWalker)(unsafe.Pointer(bp + 8))).FxSelectCallback = uintptr(0) + _sqlite3WalkExprList(tls, bp+8, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + } + (*TSelect)(unsafe.Pointer(p)).FpSrc = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpWhere = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpGroupBy = uintptr(0) + (*TSelect)(unsafe.Pointer(p)).FpHaving = uintptr(0) + *(*Tu32)(unsafe.Pointer(p + 4)) &= uint32(^libc.Int32FromInt32(SF_Aggregate)) + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(SF_WinRewrite) + /* Create the ORDER BY clause for the sub-select. This is the concatenation + ** of the window PARTITION and ORDER BY clauses. Then, if this makes it + ** redundant, remove the ORDER BY from the parent SELECT. */ + pSort = _exprListAppendList(tls, pParse, uintptr(0), (*TWindow)(unsafe.Pointer(pMWin)).FpPartition, int32(1)) + pSort = _exprListAppendList(tls, pParse, pSort, (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy, int32(1)) + if pSort != 0 && (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 && (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpOrderBy)).FnExpr <= (*TExprList)(unsafe.Pointer(pSort)).FnExpr { + nSave = (*TExprList)(unsafe.Pointer(pSort)).FnExpr + (*TExprList)(unsafe.Pointer(pSort)).FnExpr = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpOrderBy)).FnExpr + if _sqlite3ExprListCompare(tls, pSort, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, -int32(1)) == 0 { + _sqlite3ExprListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpOrderBy) + (*TSelect)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + } + (*TExprList)(unsafe.Pointer(pSort)).FnExpr = nSave + } + /* Assign a cursor number for the ephemeral table used to buffer rows. + ** The OpenEphemeral instruction is coded later, after it is known how + ** many columns the table will have. */ + v2 = pParse + 52 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr = v1 + *(*int32)(unsafe.Pointer(pParse + 52)) += int32(3) + _selectWindowRewriteEList(tls, pParse, pMWin, pSrc, (*TSelect)(unsafe.Pointer(p)).FpEList, pTab, bp) + _selectWindowRewriteEList(tls, pParse, pMWin, pSrc, (*TSelect)(unsafe.Pointer(p)).FpOrderBy, pTab, bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v3 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExpr + } else { + v3 = 0 + } + (*TWindow)(unsafe.Pointer(pMWin)).FnBufferCol = v3 + /* Append the PARTITION BY and ORDER BY expressions to the to the + ** sub-select expression list. They are required to figure out where + ** boundaries for partitions and sets of peer rows lie. */ + *(*uintptr)(unsafe.Pointer(bp)) = _exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), (*TWindow)(unsafe.Pointer(pMWin)).FpPartition, 0) + *(*uintptr)(unsafe.Pointer(bp)) = _exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy, 0) + /* Append the arguments passed to each window function to the + ** sub-select expression list. Also allocate two registers for each + ** window function - one for the accumulator, another for interim + ** results. */ + pWin = pMWin + for { + if !(pWin != 0) { + break + } + pArgs = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) + if (*TFuncDef)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpWFunc)).FfuncFlags&uint32(SQLITE_SUBTYPE) != 0 { + _selectWindowRewriteEList(tls, pParse, pMWin, pSrc, pArgs, pTab, bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v5 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExpr + } else { + v5 = 0 + } + (*TWindow)(unsafe.Pointer(pWin)).FiArgCol = v5 + (*TWindow)(unsafe.Pointer(pWin)).FbExprArgs = uint8(1) + } else { + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v6 = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnExpr + } else { + v6 = 0 + } + (*TWindow)(unsafe.Pointer(pWin)).FiArgCol = v6 + *(*uintptr)(unsafe.Pointer(bp)) = _exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), pArgs, 0) + } + if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { + pFilter = _sqlite3ExprDup(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FpFilter, 0) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), pFilter) + } + v8 = pParse + 56 + *(*int32)(unsafe.Pointer(v8))++ + v7 = *(*int32)(unsafe.Pointer(v8)) + (*TWindow)(unsafe.Pointer(pWin)).FregAccum = v7 + v10 = pParse + 56 + *(*int32)(unsafe.Pointer(v10))++ + v9 = *(*int32)(unsafe.Pointer(v10)) + (*TWindow)(unsafe.Pointer(pWin)).FregResult = v9 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) + goto _4 + _4: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + /* If there is no ORDER BY or PARTITION BY clause, and the window + ** function accepts zero arguments, and there are no other columns + ** selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible + ** that pSublist is still NULL here. Add a constant expression here to + ** keep everything legal in this case. + */ + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), _sqlite3Expr(tls, db, int32(TK_INTEGER), __ccgo_ts+1754)) + } + pSub = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(bp)), pSrc, pWhere, pGroupBy, pHaving, pSort, uint32(0), uintptr(0)) + (*TSelect)(unsafe.Pointer(p)).FpSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + /* Due to db->mallocFailed test inside + ** of sqlite3DbMallocRawNN() called from + ** sqlite3SrcListAppend() */ + if (*TSelect)(unsafe.Pointer(p)).FpSrc != 0 { + (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpSelect = pSub + libc.SetBitFieldPtr16Uint32((*TSelect)(unsafe.Pointer(p)).FpSrc+8+60+4, libc.Uint32FromInt32(1), 3, 0x8) + _sqlite3SrcListAssignCursors(tls, pParse, (*TSelect)(unsafe.Pointer(p)).FpSrc) + *(*Tu32)(unsafe.Pointer(pSub + 4)) |= uint32(libc.Int32FromInt32(SF_Expanded) | libc.Int32FromInt32(SF_OrderByReqd)) + pTab2 = _sqlite3ResultSetOfSelect(tls, pParse, pSub, int8(SQLITE_AFF_NONE)) + *(*Tu32)(unsafe.Pointer(pSub + 4)) |= selFlags & uint32(SF_Aggregate) + if pTab2 == uintptr(0) { + /* Might actually be some other kind of error, but in that case + ** pParse->nErr will be set, so if SQLITE_NOMEM is set, we will get + ** the correct error message regardless. */ + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, pTab, pTab2, uint64(104)) + *(*Tu32)(unsafe.Pointer(pTab + 48)) |= uint32(TF_Ephemeral) + (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab = pTab + pTab = pTab2 + libc.Xmemset(tls, bp+8, 0, uint64(48)) + (*(*TWalker)(unsafe.Pointer(bp + 8))).FxExprCallback = __ccgo_fp(_sqlite3WindowExtraAggFuncDepth) + (*(*TWalker)(unsafe.Pointer(bp + 8))).FxSelectCallback = __ccgo_fp(_sqlite3WalkerDepthIncrease) + (*(*TWalker)(unsafe.Pointer(bp + 8))).FxSelectCallback2 = __ccgo_fp(_sqlite3WalkerDepthDecrease) + _sqlite3WalkSelect(tls, bp+8, pSub) + } + } else { + _sqlite3SelectDelete(tls, db, pSub) + } + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = int32(SQLITE_NOMEM) + } + /* Defer deleting the temporary table pTab because if an error occurred, + ** there could still be references to that table embedded in the + ** result-set or ORDER BY clause of the SELECT statement p. */ + _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3DbFree), pTab) + } + return rc +} + +// C documentation +// +// /* +// ** Unlink the Window object from the Select to which it is attached, +// ** if it is attached. +// */ +func _sqlite3WindowUnlinkFromSelect(tls *libc.TLS, p uintptr) { + if (*TWindow)(unsafe.Pointer(p)).FppThis != 0 { + *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(p)).FppThis)) = (*TWindow)(unsafe.Pointer(p)).FpNextWin + if (*TWindow)(unsafe.Pointer(p)).FpNextWin != 0 { + (*TWindow)(unsafe.Pointer((*TWindow)(unsafe.Pointer(p)).FpNextWin)).FppThis = (*TWindow)(unsafe.Pointer(p)).FppThis + } + (*TWindow)(unsafe.Pointer(p)).FppThis = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Free the Window object passed as the second argument. +// */ +func _sqlite3WindowDelete(tls *libc.TLS, db uintptr, p uintptr) { + if p != 0 { + _sqlite3WindowUnlinkFromSelect(tls, p) + _sqlite3ExprDelete(tls, db, (*TWindow)(unsafe.Pointer(p)).FpFilter) + _sqlite3ExprListDelete(tls, db, (*TWindow)(unsafe.Pointer(p)).FpPartition) + _sqlite3ExprListDelete(tls, db, (*TWindow)(unsafe.Pointer(p)).FpOrderBy) + _sqlite3ExprDelete(tls, db, (*TWindow)(unsafe.Pointer(p)).FpEnd) + _sqlite3ExprDelete(tls, db, (*TWindow)(unsafe.Pointer(p)).FpStart) + _sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(p)).FzName) + _sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(p)).FzBase) + _sqlite3DbFree(tls, db, p) + } +} + +// C documentation +// +// /* +// ** Free the linked list of Window objects starting at the second argument. +// */ +func _sqlite3WindowListDelete(tls *libc.TLS, db uintptr, p uintptr) { + var pNext uintptr + _ = pNext + for p != 0 { + pNext = (*TWindow)(unsafe.Pointer(p)).FpNextWin + _sqlite3WindowDelete(tls, db, p) + p = pNext + } +} + +// C documentation +// +// /* +// ** The argument expression is an PRECEDING or FOLLOWING offset. The +// ** value should be a non-negative integer. If the value is not a +// ** constant, change it to NULL. The fact that it is then a non-negative +// ** integer will be caught later. But it is important not to leave +// ** variable values in the expression tree. +// */ +func _sqlite3WindowOffsetExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r uintptr) { + if 0 == _sqlite3ExprIsConstant(tls, pExpr) { + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameExprUnmap(tls, pParse, pExpr) + } + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pExpr) + pExpr = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_NULL), uintptr(0), 0) + } + return pExpr +} + +// C documentation +// +// /* +// ** Allocate and return a new Window object describing a Window Definition. +// */ +func _sqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int32, pStart uintptr, eEnd int32, pEnd uintptr, eExclude Tu8) (r uintptr) { + var bImplicitFrame int32 + var pWin uintptr + _, _ = bImplicitFrame, pWin + pWin = uintptr(0) + bImplicitFrame = 0 + /* Parser assures the following: */ + if eType == 0 { + bImplicitFrame = int32(1) + eType = int32(TK_RANGE) + } + /* Additionally, the + ** starting boundary type may not occur earlier in the following list than + ** the ending boundary type: + ** + ** UNBOUNDED PRECEDING + ** PRECEDING + ** CURRENT ROW + ** FOLLOWING + ** UNBOUNDED FOLLOWING + ** + ** The parser ensures that "UNBOUNDED PRECEDING" cannot be used as an ending + ** boundary, and than "UNBOUNDED FOLLOWING" cannot be used as a starting + ** frame boundary. + */ + if eStart == int32(TK_CURRENT) && eEnd == int32(TK_PRECEDING) || eStart == int32(TK_FOLLOWING) && (eEnd == int32(TK_PRECEDING) || eEnd == int32(TK_CURRENT)) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22868, 0) + goto windowAllocErr + } + pWin = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) + if pWin == uintptr(0) { + goto windowAllocErr + } + (*TWindow)(unsafe.Pointer(pWin)).FeFrmType = uint8(eType) + (*TWindow)(unsafe.Pointer(pWin)).FeStart = uint8(eStart) + (*TWindow)(unsafe.Pointer(pWin)).FeEnd = uint8(eEnd) + if int32(eExclude) == 0 && (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&uint32(libc.Int32FromInt32(SQLITE_WindowFunc)) != uint32(0) { + eExclude = uint8(TK_NO) + } + (*TWindow)(unsafe.Pointer(pWin)).FeExclude = eExclude + (*TWindow)(unsafe.Pointer(pWin)).FbImplicitFrame = uint8(bImplicitFrame) + (*TWindow)(unsafe.Pointer(pWin)).FpEnd = _sqlite3WindowOffsetExpr(tls, pParse, pEnd) + (*TWindow)(unsafe.Pointer(pWin)).FpStart = _sqlite3WindowOffsetExpr(tls, pParse, pStart) + return pWin +windowAllocErr: + ; + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pEnd) + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pStart) + return uintptr(0) +} + +// C documentation +// +// /* +// ** Attach PARTITION and ORDER BY clauses pPartition and pOrderBy to window +// ** pWin. Also, if parameter pBase is not NULL, set pWin->zBase to the +// ** equivalent nul-terminated string. +// */ +func _sqlite3WindowAssemble(tls *libc.TLS, pParse uintptr, pWin uintptr, pPartition uintptr, pOrderBy uintptr, pBase uintptr) (r uintptr) { + if pWin != 0 { + (*TWindow)(unsafe.Pointer(pWin)).FpPartition = pPartition + (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = pOrderBy + if pBase != 0 { + (*TWindow)(unsafe.Pointer(pWin)).FzBase = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TToken)(unsafe.Pointer(pBase)).Fz, uint64((*TToken)(unsafe.Pointer(pBase)).Fn)) + } + } else { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pPartition) + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pOrderBy) + } + return pWin +} + +// C documentation +// +// /* +// ** Window *pWin has just been created from a WINDOW clause. Token pBase +// ** is the base window. Earlier windows from the same WINDOW clause are +// ** stored in the linked list starting at pWin->pNextWin. This function +// ** either updates *pWin according to the base specification, or else +// ** leaves an error in pParse. +// */ +func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, pExist, zErr uintptr + _, _, _ = db, pExist, zErr + if (*TWindow)(unsafe.Pointer(pWin)).FzBase != 0 { + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + pExist = _windowFind(tls, pParse, pList, (*TWindow)(unsafe.Pointer(pWin)).FzBase) + if pExist != 0 { + zErr = uintptr(0) + /* Check for errors */ + if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { + zErr = __ccgo_ts + 22900 + } else { + if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { + zErr = __ccgo_ts + 22917 + } else { + if int32((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { + zErr = __ccgo_ts + 22933 + } + } + } + if zErr != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22953, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) + } else { + (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) + if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { + (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy, 0) + } + _sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FzBase) + (*TWindow)(unsafe.Pointer(pWin)).FzBase = uintptr(0) + } + } + } +} + +// C documentation +// +// /* +// ** Attach window object pWin to expression p. +// */ +func _sqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr) { + if p != 0 { + *(*uintptr)(unsafe.Pointer(p + 64)) = pWin + *(*Tu32)(unsafe.Pointer(p + 4)) |= uint32(libc.Int32FromInt32(EP_WinFunc) | libc.Int32FromInt32(EP_FullSize)) + (*TWindow)(unsafe.Pointer(pWin)).FpOwner = p + if (*TExpr)(unsafe.Pointer(p)).Fflags&uint32(EP_Distinct) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeFrmType) != int32(TK_FILTER) { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22986, 0) + } + } else { + _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWin) + } +} + +// C documentation +// +// /* +// ** Possibly link window pWin into the list at pSel->pWin (window functions +// ** to be processed as part of SELECT statement pSel). The window is linked +// ** in if either (a) there are no other windows already linked to this +// ** SELECT, or (b) the windows already linked use a compatible window frame. +// */ +func _sqlite3WindowLink(tls *libc.TLS, pSel uintptr, pWin uintptr) { + if pSel != 0 { + if uintptr(0) == (*TSelect)(unsafe.Pointer(pSel)).FpWin || 0 == _sqlite3WindowCompare(tls, uintptr(0), (*TSelect)(unsafe.Pointer(pSel)).FpWin, pWin, 0) { + (*TWindow)(unsafe.Pointer(pWin)).FpNextWin = (*TSelect)(unsafe.Pointer(pSel)).FpWin + if (*TSelect)(unsafe.Pointer(pSel)).FpWin != 0 { + (*TWindow)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpWin)).FppThis = pWin + 64 + } + (*TSelect)(unsafe.Pointer(pSel)).FpWin = pWin + (*TWindow)(unsafe.Pointer(pWin)).FppThis = pSel + 112 + } else { + if _sqlite3ExprListCompare(tls, (*TWindow)(unsafe.Pointer(pWin)).FpPartition, (*TWindow)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSel)).FpWin)).FpPartition, -int32(1)) != 0 { + *(*Tu32)(unsafe.Pointer(pSel + 4)) |= uint32(SF_MultiPart) + } + } + } +} + +// C documentation +// +// /* +// ** Return 0 if the two window objects are identical, 1 if they are +// ** different, or 2 if it cannot be determined if the objects are identical +// ** or not. Identical window objects can be processed in a single scan. +// */ +func _sqlite3WindowCompare(tls *libc.TLS, pParse uintptr, p1 uintptr, p2 uintptr, bFilter int32) (r int32) { + var res, v1, v2, v3 int32 + _, _, _, _ = res, v1, v2, v3 + if p1 == uintptr(0) || p2 == uintptr(0) { + return int32(1) + } + if int32((*TWindow)(unsafe.Pointer(p1)).FeFrmType) != int32((*TWindow)(unsafe.Pointer(p2)).FeFrmType) { + return int32(1) + } + if int32((*TWindow)(unsafe.Pointer(p1)).FeStart) != int32((*TWindow)(unsafe.Pointer(p2)).FeStart) { + return int32(1) + } + if int32((*TWindow)(unsafe.Pointer(p1)).FeEnd) != int32((*TWindow)(unsafe.Pointer(p2)).FeEnd) { + return int32(1) + } + if int32((*TWindow)(unsafe.Pointer(p1)).FeExclude) != int32((*TWindow)(unsafe.Pointer(p2)).FeExclude) { + return int32(1) + } + if _sqlite3ExprCompare(tls, pParse, (*TWindow)(unsafe.Pointer(p1)).FpStart, (*TWindow)(unsafe.Pointer(p2)).FpStart, -int32(1)) != 0 { + return int32(1) + } + if _sqlite3ExprCompare(tls, pParse, (*TWindow)(unsafe.Pointer(p1)).FpEnd, (*TWindow)(unsafe.Pointer(p2)).FpEnd, -int32(1)) != 0 { + return int32(1) + } + v1 = _sqlite3ExprListCompare(tls, (*TWindow)(unsafe.Pointer(p1)).FpPartition, (*TWindow)(unsafe.Pointer(p2)).FpPartition, -int32(1)) + res = v1 + if v1 != 0 { + return res + } + v2 = _sqlite3ExprListCompare(tls, (*TWindow)(unsafe.Pointer(p1)).FpOrderBy, (*TWindow)(unsafe.Pointer(p2)).FpOrderBy, -int32(1)) + res = v2 + if v2 != 0 { + return res + } + if bFilter != 0 { + v3 = _sqlite3ExprCompare(tls, pParse, (*TWindow)(unsafe.Pointer(p1)).FpFilter, (*TWindow)(unsafe.Pointer(p2)).FpFilter, -int32(1)) + res = v3 + if v3 != 0 { + return res + } + } + return 0 +} + +// C documentation +// +// /* +// ** This is called by code in select.c before it calls sqlite3WhereBegin() +// ** to begin iterating through the sub-query results. It is used to allocate +// ** and initialize registers and cursors used by sqlite3WindowCodeStep(). +// */ +func _sqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { + var nEphExpr, nExpr, v1, v10, v12, v14, v3, v5, v7 int32 + var p, pKeyInfo, pList, pMWin, pWin, v, v11, v13, v15, v2, v4, v6, v8 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = nEphExpr, nExpr, p, pKeyInfo, pList, pMWin, pWin, v, v1, v10, v11, v12, v13, v14, v15, v2, v3, v4, v5, v6, v7, v8 + nEphExpr = (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpSrc + 8))).FpSelect)).FpEList)).FnExpr + pMWin = (*TSelect)(unsafe.Pointer(pSelect)).FpWin + v = _sqlite3GetVdbe(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr, nEphExpr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr+int32(1), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr+int32(2), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr+int32(3), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + /* Allocate registers to use for PARTITION BY values, if any. Initialize + ** said registers to NULL. */ + if (*TWindow)(unsafe.Pointer(pMWin)).FpPartition != 0 { + nExpr = (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pMWin)).FpPartition)).FnExpr + (*TWindow)(unsafe.Pointer(pMWin)).FregPart = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nExpr + _sqlite3VdbeAddOp3(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pMWin)).FregPart, (*TWindow)(unsafe.Pointer(pMWin)).FregPart+nExpr-int32(1)) + } + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + (*TWindow)(unsafe.Pointer(pMWin)).FregOne = v1 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), (*TWindow)(unsafe.Pointer(pMWin)).FregOne) + if (*TWindow)(unsafe.Pointer(pMWin)).FeExclude != 0 { + v4 = pParse + 56 + *(*int32)(unsafe.Pointer(v4))++ + v3 = *(*int32)(unsafe.Pointer(v4)) + (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid = v3 + v6 = pParse + 56 + *(*int32)(unsafe.Pointer(v6))++ + v5 = *(*int32)(unsafe.Pointer(v6)) + (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid = v5 + v8 = pParse + 52 + v7 = *(*int32)(unsafe.Pointer(v8)) + *(*int32)(unsafe.Pointer(v8))++ + (*TWindow)(unsafe.Pointer(pMWin)).FcsrApp = v7 + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pMWin)).FcsrApp, (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + return + } + pWin = pMWin + for { + if !(pWin != 0) { + break + } + p = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc + if (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) != int32(TK_UNBOUNDED) { + pList = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, pList, 0, 0) + v11 = pParse + 52 + v10 = *(*int32)(unsafe.Pointer(v11)) + *(*int32)(unsafe.Pointer(v11))++ + (*TWindow)(unsafe.Pointer(pWin)).FcsrApp = v10 + (*TWindow)(unsafe.Pointer(pWin)).FregApp = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(3) + if pKeyInfo != 0 && int32(*(*int8)(unsafe.Pointer((*TFuncDef)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpWFunc)).FzName + 1))) == int32('i') { + *(*Tu8)(unsafe.Pointer((*TKeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags)) = uint8(KEYINFO_ORDER_DESC) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenEphemeral), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, int32(2)) + _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)) + } else { + if (*TFuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) || (*TFuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&_first_valueName)) { + /* Allocate two registers at pWin->regApp. These will be used to + ** store the start and end index of the current frame. */ + (*TWindow)(unsafe.Pointer(pWin)).FregApp = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + v13 = pParse + 52 + v12 = *(*int32)(unsafe.Pointer(v13)) + *(*int32)(unsafe.Pointer(v13))++ + (*TWindow)(unsafe.Pointer(pWin)).FcsrApp = v12 + *(*int32)(unsafe.Pointer(pParse + 56)) += int32(2) + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + } else { + if (*TFuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&_leadName)) || (*TFuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&_lagName)) { + v15 = pParse + 52 + v14 = *(*int32)(unsafe.Pointer(v15)) + *(*int32)(unsafe.Pointer(v15))++ + (*TWindow)(unsafe.Pointer(pWin)).FcsrApp = v14 + _sqlite3VdbeAddOp2(tls, v, int32(OP_OpenDup), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr) + } + } + } + goto _9 + _9: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } +} + +// C documentation +// +// /* +// ** A "PRECEDING " (eCond==0) or "FOLLOWING " (eCond==1) or the +// ** value of the second argument to nth_value() (eCond==2) has just been +// ** evaluated and the result left in register reg. This function generates VM +// ** code to check that the value is a non-negative integer and throws an +// ** exception if it is not. +// */ +func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { + var regString, regZero int32 + var v uintptr + _, _, _ = regString, regZero, v + v = _sqlite3GetVdbe(tls, pParse) + regZero = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regZero) + if eCond >= int32(WINDOW_STARTING_NUM) { + regString = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1680, -int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regString, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) + _sqlite3VdbeChangeP5(tls, v, uint16(libc.Int32FromInt32(SQLITE_AFF_NUMERIC)|libc.Int32FromInt32(SQLITE_JUMPIFNULL))) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_MustBeInt), reg, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + } + _sqlite3VdbeAddOp3(tls, v, _aOp1[eCond], regZero, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_AFF_NUMERIC)) + /* NULL case captured by */ + /* the OP_MustBeInt */ + /* NULL case caught by */ + /* the OP_Ge */ + _sqlite3MayAbort(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Halt), int32(SQLITE_ERROR), int32(OE_Abort)) + _sqlite3VdbeAppendP4(tls, v, _azErr[eCond], -int32(1)) + _sqlite3ReleaseTempReg(tls, pParse, regZero) +} + +var _azErr = [5]uintptr{ + 0: __ccgo_ts + 23033, + 1: __ccgo_ts + 23086, + 2: __ccgo_ts + 22588, + 3: __ccgo_ts + 23137, + 4: __ccgo_ts + 23189, +} + +var _aOp1 = [5]int32{ + 0: int32(OP_Ge), + 1: int32(OP_Ge), + 2: int32(OP_Gt), + 3: int32(OP_Ge), + 4: int32(OP_Ge), +} + +// C documentation +// +// /* +// ** Return the number of arguments passed to the window-function associated +// ** with the object passed as the only argument to this function. +// */ +func _windowArgCount(tls *libc.TLS, pWin uintptr) (r int32) { + var pList uintptr + var v1 int32 + _, _ = pList, v1 + pList = *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) + if pList != 0 { + v1 = (*TExprList)(unsafe.Pointer(pList)).FnExpr + } else { + v1 = 0 + } + return v1 +} + +type TWindowCodeArg = struct { + FpParse uintptr + FpMWin uintptr + FpVdbe uintptr + FaddrGosub int32 + FregGosub int32 + FregArg int32 + FeDelete int32 + FregRowid int32 + Fstart TWindowCsrAndReg + Fcurrent TWindowCsrAndReg + Fend TWindowCsrAndReg +} + +type WindowCodeArg = TWindowCodeArg + +type TWindowCsrAndReg = struct { + Fcsr int32 + Freg int32 +} + +type WindowCsrAndReg = TWindowCsrAndReg + +/* +** See comments above struct WindowCodeArg. + */ +type TWindowCsrAndReg1 = struct { + Fcsr int32 + Freg int32 +} + +type WindowCsrAndReg1 = TWindowCsrAndReg1 + +/* +** A single instance of this structure is allocated on the stack by +** sqlite3WindowCodeStep() and a pointer to it passed to the various helper +** routines. This is to reduce the number of arguments required by each +** helper function. +** +** regArg: +** Each window function requires an accumulator register (just as an +** ordinary aggregate function does). This variable is set to the first +** in an array of accumulator registers - one for each window function +** in the WindowCodeArg.pMWin list. +** +** eDelete: +** The window functions implementation sometimes caches the input rows +** that it processes in a temporary table. If it is not zero, this +** variable indicates when rows may be removed from the temp table (in +** order to reduce memory requirements - it would always be safe just +** to leave them there). Possible values for eDelete are: +** +** WINDOW_RETURN_ROW: +** An input row can be discarded after it is returned to the caller. +** +** WINDOW_AGGINVERSE: +** An input row can be discarded after the window functions xInverse() +** callbacks have been invoked in it. +** +** WINDOW_AGGSTEP: +** An input row can be discarded after the window functions xStep() +** callbacks have been invoked in it. +** +** start,current,end +** Consider a window-frame similar to the following: +** +** (ORDER BY a, b GROUPS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +** +** The windows functions implementation caches the input rows in a temp +** table, sorted by "a, b" (it actually populates the cache lazily, and +** aggressively removes rows once they are no longer required, but that's +** a mere detail). It keeps three cursors open on the temp table. One +** (current) that points to the next row to return to the query engine +** once its window function values have been calculated. Another (end) +** points to the next row to call the xStep() method of each window function +** on (so that it is 2 groups ahead of current). And a third (start) that +** points to the next row to call the xInverse() method of each window +** function on. +** +** Each cursor (start, current and end) consists of a VDBE cursor +** (WindowCsrAndReg.csr) and an array of registers (starting at +** WindowCodeArg.reg) that always contains a copy of the peer values +** read from the corresponding cursor. +** +** Depending on the window-frame in question, all three cursors may not +** be required. In this case both WindowCodeArg.csr and reg are set to +** 0. + */ +type TWindowCodeArg1 = struct { + FpParse uintptr + FpMWin uintptr + FpVdbe uintptr + FaddrGosub int32 + FregGosub int32 + FregArg int32 + FeDelete int32 + FregRowid int32 + Fstart TWindowCsrAndReg + Fcurrent TWindowCsrAndReg + Fend TWindowCsrAndReg +} + +type WindowCodeArg1 = TWindowCodeArg1 + +// C documentation +// +// /* +// ** Generate VM code to read the window frames peer values from cursor csr into +// ** an array of registers starting at reg. +// */ +func _windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { + var i, iColOff, v1 int32 + var pMWin, pOrderBy, pPart, v uintptr + _, _, _, _, _, _, _ = i, iColOff, pMWin, pOrderBy, pPart, v, v1 + pMWin = (*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin + pOrderBy = (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy + if pOrderBy != 0 { + v = _sqlite3GetVdbe(tls, (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse) + pPart = (*TWindow)(unsafe.Pointer(pMWin)).FpPartition + if pPart != 0 { + v1 = (*TExprList)(unsafe.Pointer(pPart)).FnExpr + } else { + v1 = 0 + } + iColOff = (*TWindow)(unsafe.Pointer(pMWin)).FnBufferCol + v1 + i = 0 + for { + if !(i < (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, iColOff+i, reg+i) + goto _2 + _2: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Generate VM code to invoke either xStep() (if bInverse is 0) or +// ** xInverse (if bInverse is non-zero) for each window function in the +// ** linked list starting at pMWin. Or, for built-in window functions +// ** that do not use the standard function API, generate the required +// ** inline VM code. +// ** +// ** If argument csr is greater than or equal to 0, then argument reg is +// ** the first register in an array of registers guaranteed to be large +// ** enough to hold the array of arguments for each function. In this case +// ** the arguments are extracted from the current row of csr into the +// ** array of registers before invoking OP_AggStep or OP_AggInverse +// ** +// ** Or, if csr is less than zero, then the array of registers at reg is +// ** already populated with all columns from the current row of the sub-query. +// ** +// ** If argument regPartSize is non-zero, then it is a register containing the +// ** number of rows in the current partition. +// */ +func _windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse int32, reg int32) { + var addrIf, addrIsNull, i, iEnd, iOp, nArg, regArg, regTmp, v2, v5 int32 + var pColl, pFunc, pOp, pParse, pWin, v uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrIf, addrIsNull, i, iEnd, iOp, nArg, pColl, pFunc, pOp, pParse, pWin, regArg, regTmp, v, v2, v5 + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + v = _sqlite3GetVdbe(tls, pParse) + pWin = pMWin + for { + if !(pWin != 0) { + break + } + pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc + if (*TWindow)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + v2 = 0 + } else { + v2 = _windowArgCount(tls, pWin) + } + nArg = v2 + /* All OVER clauses in the same window function aggregate step must + ** be the same. */ + i = 0 + for { + if !(i < nArg) { + break + } + if i != int32(1) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName != uintptr(unsafe.Pointer(&_nth_valueName)) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+i, reg+i) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+i, reg+i) + } + goto _3 + _3: + ; + i++ + } + regArg = reg + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid == 0 && (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) != int32(TK_UNBOUNDED) { + addrIsNull = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regArg) + if bInverse == 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1), int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_SCopy), regArg, (*TWindow)(unsafe.Pointer(pWin)).FregApp) + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), (*TWindow)(unsafe.Pointer(pWin)).FregApp, int32(2), (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(2)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxInsert), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(2)) + } else { + _sqlite3VdbeAddOp4Int(tls, v, int32(OP_SeekGE), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, 0, regArg, int32(1)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Delete), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp) + _sqlite3VdbeJumpHere(tls, v, _sqlite3VdbeCurrentAddr(tls, v)-int32(2)) + } + _sqlite3VdbeJumpHere(tls, v, addrIsNull) + } else { + if (*TWindow)(unsafe.Pointer(pWin)).FregApp != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)-bInverse, int32(1)) + } else { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FxSFunc != __ccgo_fp(_noopStepFunc) { + addrIf = 0 + if (*TWindow)(unsafe.Pointer(pWin)).FpFilter != 0 { + regTmp = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+nArg, regTmp) + addrIf = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNot), regTmp, 0, int32(1)) + _sqlite3ReleaseTempReg(tls, pParse, regTmp) + } + if (*TWindow)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + iOp = _sqlite3VdbeCurrentAddr(tls, v) + nArg = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)))).FnExpr + regArg = _sqlite3GetTempRange(tls, pParse, nArg) + _sqlite3ExprCodeExprList(tls, pParse, *(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)), regArg, 0, uint8(0)) + iEnd = _sqlite3VdbeCurrentAddr(tls, v) + for { + if !(iOp < iEnd) { + break + } + pOp = _sqlite3VdbeGetOp(tls, v, iOp) + if int32((*TVdbeOp)(unsafe.Pointer(pOp)).Fopcode) == int32(OP_Column) && (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 == (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr { + (*TVdbeOp)(unsafe.Pointer(pOp)).Fp1 = csr + } + goto _4 + _4: + ; + iOp++ + } + } + if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_NEEDCOLL) != 0 { + pColl = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)) + 8))).FpExpr) + _sqlite3VdbeAddOp4(tls, v, int32(OP_CollSeq), 0, 0, 0, pColl, -int32(2)) + } + if bInverse != 0 { + v5 = int32(OP_AggInverse) + } else { + v5 = int32(OP_AggStep) + } + _sqlite3VdbeAddOp3(tls, v, v5, bInverse, regArg, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) + _sqlite3VdbeAppendP4(tls, v, pFunc, -int32(7)) + _sqlite3VdbeChangeP5(tls, v, uint16(uint8(nArg))) + if (*TWindow)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + _sqlite3ReleaseTempRange(tls, pParse, regArg, nArg) + } + if addrIf != 0 { + _sqlite3VdbeJumpHere(tls, v, addrIf) + } + } + } + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } +} + +/* +** Values that may be passed as the second argument to windowCodeOp(). + */ + +// C documentation +// +// /* +// ** Generate VM code to invoke either xValue() (bFin==0) or xFinalize() +// ** (bFin==1) for each window function in the linked list starting at +// ** pMWin. Or, for built-in window-functions that do not use the standard +// ** API, generate the equivalent VM code. +// */ +func _windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { + var nArg int32 + var pMWin, pParse, pWin, v uintptr + _, _, _, _, _ = nArg, pMWin, pParse, pWin, v + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + pMWin = (*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin + v = _sqlite3GetVdbe(tls, pParse) + pWin = pMWin + for { + if !(pWin != 0) { + break + } + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid == 0 && (*TFuncDef)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpWFunc)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && int32((*TWindow)(unsafe.Pointer(pWin)).FeStart) != int32(TK_UNBOUNDED) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Last), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp, 0, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeJumpHere(tls, v, _sqlite3VdbeCurrentAddr(tls, v)-int32(2)) + } else { + if (*TWindow)(unsafe.Pointer(pWin)).FregApp != 0 { + } else { + nArg = _windowArgCount(tls, pWin) + if bFin != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AggFinal), (*TWindow)(unsafe.Pointer(pWin)).FregAccum, nArg) + _sqlite3VdbeAppendP4(tls, v, (*TWindow)(unsafe.Pointer(pWin)).FpWFunc, -int32(7)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Copy), (*TWindow)(unsafe.Pointer(pWin)).FregAccum, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_AggValue), (*TWindow)(unsafe.Pointer(pWin)).FregAccum, nArg, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeAppendP4(tls, v, (*TWindow)(unsafe.Pointer(pWin)).FpWFunc, -int32(7)) + } + } + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } +} + +// C documentation +// +// /* +// ** Generate code to calculate the current values of all window functions in the +// ** p->pMWin list by doing a full scan of the current window frame. Store the +// ** results in the Window.regResult registers, ready to return the upper +// ** layer. +// */ +func _windowFullScan(tls *libc.TLS, p uintptr) { + var addr, addrEq, addrNext, csr, lblBrk, lblNext, nPeer, regCPeer, regCRowid, regPeer, regRowid, v1 int32 + var pKeyInfo, pMWin, pParse, pWin, v uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addrEq, addrNext, csr, lblBrk, lblNext, nPeer, pKeyInfo, pMWin, pParse, pWin, regCPeer, regCRowid, regPeer, regRowid, v, v1 + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + pMWin = (*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin + v = (*TWindowCodeArg)(unsafe.Pointer(p)).FpVdbe + regCRowid = 0 /* Current rowid value */ + regCPeer = 0 /* Current peer values */ + regRowid = 0 /* AggStep rowid value */ + regPeer = 0 + csr = (*TWindow)(unsafe.Pointer(pMWin)).FcsrApp + if (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + v1 = (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy)).FnExpr + } else { + v1 = 0 + } + nPeer = v1 + lblNext = _sqlite3VdbeMakeLabel(tls, pParse) + lblBrk = _sqlite3VdbeMakeLabel(tls, pParse) + regCRowid = _sqlite3GetTempReg(tls, pParse) + regRowid = _sqlite3GetTempReg(tls, pParse) + if nPeer != 0 { + regCPeer = _sqlite3GetTempRange(tls, pParse, nPeer) + regPeer = _sqlite3GetTempRange(tls, pParse, nPeer) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr, regCRowid) + _windowReadPeerValues(tls, p, (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr, regCPeer) + pWin = pMWin + for { + if !(pWin != 0) { + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) + goto _2 + _2: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekGE), csr, lblBrk, (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) + addrNext = _sqlite3VdbeCurrentAddr(tls, v) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), csr, regRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Gt), (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid, lblBrk, regRowid) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeExclude) == int32(TK_CURRENT) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), regCRowid, lblNext, regRowid) + } else { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeExclude) != int32(TK_NO) { + addrEq = 0 + pKeyInfo = uintptr(0) + if (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy, 0, 0) + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeExclude) == int32(TK_TIES) { + addrEq = _sqlite3VdbeAddOp3(tls, v, int32(OP_Eq), regCRowid, 0, regRowid) + } + if pKeyInfo != 0 { + _windowReadPeerValues(tls, p, csr, regPeer) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Compare), regPeer, regCPeer, nPeer) + _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) + addr = _sqlite3VdbeCurrentAddr(tls, v) + int32(1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addr, lblNext, addr) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, lblNext) + } + if addrEq != 0 { + _sqlite3VdbeJumpHere(tls, v, addrEq) + } + } + } + _windowAggStep(tls, p, pMWin, csr, 0, (*TWindowCodeArg)(unsafe.Pointer(p)).FregArg) + _sqlite3VdbeResolveLabel(tls, v, lblNext) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), csr, addrNext) + _sqlite3VdbeJumpHere(tls, v, addrNext-int32(1)) + _sqlite3VdbeJumpHere(tls, v, addrNext+int32(1)) + _sqlite3ReleaseTempReg(tls, pParse, regRowid) + _sqlite3ReleaseTempReg(tls, pParse, regCRowid) + if nPeer != 0 { + _sqlite3ReleaseTempRange(tls, pParse, regPeer, nPeer) + _sqlite3ReleaseTempRange(tls, pParse, regCPeer, nPeer) + } + _windowAggFinal(tls, p, int32(1)) +} + +// C documentation +// +// /* +// ** Invoke the sub-routine at regGosub (generated by code in select.c) to +// ** return the current row of Window.iEphCsr. If all window functions are +// ** aggregate window functions that use the standard API, a single +// ** OP_Gosub instruction is all that this routine generates. Extra VM code +// ** for per-row processing is only generated for the following built-in window +// ** functions: +// ** +// ** nth_value() +// ** first_value() +// ** lag() +// ** lead() +// */ +func _windowReturnOneRow(tls *libc.TLS, p uintptr) { + var csr, csr1, iEph, lbl, lbl1, nArg, op, tmpReg, tmpReg1, tmpReg2, val, v2, v3 int32 + var pFunc, pMWin, pParse, pWin, v uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = csr, csr1, iEph, lbl, lbl1, nArg, op, pFunc, pMWin, pParse, pWin, tmpReg, tmpReg1, tmpReg2, v, val, v2, v3 + pMWin = (*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin + v = (*TWindowCodeArg)(unsafe.Pointer(p)).FpVdbe + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + _windowFullScan(tls, p) + } else { + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + pWin = pMWin + for { + if !(pWin != 0) { + break + } + pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_first_valueName)) { + csr = (*TWindow)(unsafe.Pointer(pWin)).FcsrApp + lbl = _sqlite3VdbeMakeLabel(tls, pParse) + tmpReg = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+int32(1), tmpReg) + _windowCheckValue(tls, pParse, tmpReg, int32(2)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), tmpReg) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Add), tmpReg, (*TWindow)(unsafe.Pointer(pWin)).FregApp, tmpReg) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Gt), (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1), lbl, tmpReg) + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), csr, 0, tmpReg) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeResolveLabel(tls, v, lbl) + _sqlite3ReleaseTempReg(tls, pParse, tmpReg) + } else { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_leadName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_lagName)) { + nArg = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pWin)).FpOwner + 32)))).FnExpr + csr1 = (*TWindow)(unsafe.Pointer(pWin)).FcsrApp + lbl1 = _sqlite3VdbeMakeLabel(tls, pParse) + tmpReg1 = _sqlite3GetTempReg(tls, pParse) + iEph = (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr + if nArg < int32(3) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+int32(2), (*TWindow)(unsafe.Pointer(pWin)).FregResult) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), iEph, tmpReg1) + if nArg < int32(2) { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_leadName)) { + v2 = int32(1) + } else { + v2 = -int32(1) + } + val = v2 + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), tmpReg1, val) + } else { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_leadName)) { + v3 = int32(OP_Add) + } else { + v3 = int32(OP_Subtract) + } + op = v3 + tmpReg2 = _sqlite3GetTempReg(tls, pParse) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iEph, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol+int32(1), tmpReg2) + _sqlite3VdbeAddOp3(tls, v, op, tmpReg2, tmpReg1, tmpReg1) + _sqlite3ReleaseTempReg(tls, pParse, tmpReg2) + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_SeekRowid), csr1, lbl1, tmpReg1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csr1, (*TWindow)(unsafe.Pointer(pWin)).FiArgCol, (*TWindow)(unsafe.Pointer(pWin)).FregResult) + _sqlite3VdbeResolveLabel(tls, v, lbl1) + _sqlite3ReleaseTempReg(tls, pParse, tmpReg1) + } + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Gosub), (*TWindowCodeArg)(unsafe.Pointer(p)).FregGosub, (*TWindowCodeArg)(unsafe.Pointer(p)).FaddrGosub) +} + +// C documentation +// +// /* +// ** Generate code to set the accumulator register for each window function +// ** in the linked list passed as the second argument to NULL. And perform +// ** any equivalent initialization required by any built-in window functions +// ** in the list. +// */ +func _windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) (r int32) { + var nArg, regArg, v2 int32 + var pFunc, pWin, v uintptr + _, _, _, _, _, _ = nArg, pFunc, pWin, regArg, v, v2 + v = _sqlite3GetVdbe(tls, pParse) + nArg = 0 + pWin = pMWin + for { + if !(pWin != 0) { + break + } + pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc + _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, (*TWindow)(unsafe.Pointer(pWin)).FregAccum) + if nArg > _windowArgCount(tls, pWin) { + v2 = nArg + } else { + v2 = _windowArgCount(tls, pWin) + } + nArg = v2 + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid == 0 { + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_first_valueName)) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)) + } + if (*TFuncDef)(unsafe.Pointer(pFunc)).FfuncFlags&uint32(SQLITE_FUNC_MINMAX) != 0 && (*TWindow)(unsafe.Pointer(pWin)).FcsrApp != 0 { + _sqlite3VdbeAddOp1(tls, v, int32(OP_ResetSorter), (*TWindow)(unsafe.Pointer(pWin)).FcsrApp) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pWin)).FregApp+int32(1)) + } + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + regArg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nArg + return regArg +} + +// C documentation +// +// /* +// ** Return true if the current frame should be cached in the ephemeral table, +// ** even if there are no xInverse() calls required. +// */ +func _windowCacheFrame(tls *libc.TLS, pMWin uintptr) (r int32) { + var pFunc, pWin uintptr + _, _ = pFunc, pWin + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + return int32(1) + } + pWin = pMWin + for { + if !(pWin != 0) { + break + } + pFunc = (*TWindow)(unsafe.Pointer(pWin)).FpWFunc + if (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_nth_valueName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_first_valueName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_leadName)) || (*TFuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&_lagName)) { + return int32(1) + } + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + return 0 +} + +// C documentation +// +// /* +// ** regOld and regNew are each the first register in an array of size +// ** pOrderBy->nExpr. This function generates code to compare the two +// ** arrays of registers using the collation sequences and other comparison +// ** parameters specified by pOrderBy. +// ** +// ** If the two arrays are not equal, the contents of regNew is copied to +// ** regOld and control falls through. Otherwise, if the contents of the arrays +// ** are equal, an OP_Goto is executed. The address of the OP_Goto is returned. +// */ +func _windowIfNewPeer(tls *libc.TLS, pParse uintptr, pOrderBy uintptr, regNew int32, regOld int32, addr int32) { + var nVal int32 + var pKeyInfo, v uintptr + _, _, _ = nVal, pKeyInfo, v + v = _sqlite3GetVdbe(tls, pParse) + if pOrderBy != 0 { + nVal = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, pOrderBy, 0, 0) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Compare), regOld, regNew, nVal) + _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), _sqlite3VdbeCurrentAddr(tls, v)+int32(1), addr, _sqlite3VdbeCurrentAddr(tls, v)+int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regNew, regOld, nVal-int32(1)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addr) + } +} + +// C documentation +// +// /* +// ** This function is called as part of generating VM programs for RANGE +// ** offset PRECEDING/FOLLOWING frame boundaries. Assuming "ASC" order for +// ** the ORDER BY term in the window, and that argument op is OP_Ge, it generates +// ** code equivalent to: +// ** +// ** if( csr1.peerVal + regVal >= csr2.peerVal ) goto lbl; +// ** +// ** The value of parameter op may also be OP_Gt or OP_Le. In these cases the +// ** operator in the above pseudo-code is replaced with ">" or "<=", respectively. +// ** +// ** If the sort-order for the ORDER BY term in the window is DESC, then the +// ** comparison is reversed. Instead of adding regVal to csr1.peerVal, it is +// ** subtracted. And the comparison operator is inverted to - ">=" becomes "<=", +// ** ">" becomes "<", and so on. So, with DESC sort order, if the argument op +// ** is OP_Ge, the generated code is equivalent to: +// ** +// ** if( csr1.peerVal - regVal <= csr2.peerVal ) goto lbl; +// ** +// ** A special type of arithmetic is used such that if csr1.peerVal is not +// ** a numeric type (real or integer), then the result of the addition +// ** or subtraction is a a copy of csr1.peerVal. +// */ +func _windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal int32, csr2 int32, lbl int32) { + var addr, addrDone, addrGe, arith, reg1, reg2, regString, v1, v3 int32 + var pColl, pOrderBy, pParse, v, v2 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addrDone, addrGe, arith, pColl, pOrderBy, pParse, reg1, reg2, regString, v, v1, v2, v3 + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + v = _sqlite3GetVdbe(tls, pParse) + pOrderBy = (*TWindow)(unsafe.Pointer((*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin)).FpOrderBy /* ORDER BY clause for window */ + reg1 = _sqlite3GetTempReg(tls, pParse) /* Reg. for csr1.peerVal+regVal */ + reg2 = _sqlite3GetTempReg(tls, pParse) + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) /* Reg. for csr2.peerVal */ + regString = v1 /* Reg. for constant value '' */ + arith = int32(OP_Add) /* Jump destination */ + addrDone = _sqlite3VdbeMakeLabel(tls, pParse) + /* Read the peer-value from each cursor into a register */ + _windowReadPeerValues(tls, p, csr1, reg1) + _windowReadPeerValues(tls, p, csr2, reg2) + if int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_DESC) != 0 { + switch op { + case int32(OP_Ge): + op = int32(OP_Le) + case int32(OP_Gt): + op = int32(OP_Lt) + default: + op = int32(OP_Ge) + break + } + arith = int32(OP_Subtract) + } + /* If the BIGNULL flag is set for the ORDER BY, then it is required to + ** consider NULL values to be larger than all other values, instead of + ** the usual smaller. The VDBE opcodes OP_Ge and so on do not handle this + ** (and adding that capability causes a performance regression), so + ** instead if the BIGNULL flag is set then cases where either reg1 or + ** reg2 are NULL are handled separately in the following block. The code + ** generated is equivalent to: + ** + ** if( reg1 IS NULL ){ + ** if( op==OP_Ge ) goto lbl; + ** if( op==OP_Gt && reg2 IS NOT NULL ) goto lbl; + ** if( op==OP_Le && reg2 IS NULL ) goto lbl; + ** }else if( reg2 IS NULL ){ + ** if( op==OP_Le ) goto lbl; + ** } + ** + ** Additionally, if either reg1 or reg2 are NULL but the jump to lbl is + ** not taken, control jumps over the comparison operator coded below this + ** block. */ + if int32((*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).Ffg.FsortFlags)&int32(KEYINFO_ORDER_BIGNULL) != 0 { + /* This block runs if reg1 contains a NULL. */ + addr = _sqlite3VdbeAddOp1(tls, v, int32(OP_NotNull), reg1) + switch op { + case int32(OP_Ge): + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, lbl) + case int32(OP_Gt): + _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), reg2, lbl) + case int32(OP_Le): + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), reg2, lbl) + default: /* no-op */ + break + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrDone) + /* This block runs if reg1 is not NULL, but reg2 is. */ + _sqlite3VdbeJumpHere(tls, v, addr) + if op == int32(OP_Gt) || op == int32(OP_Ge) { + v3 = addrDone + } else { + v3 = lbl + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_IsNull), reg2, v3) + } + /* Register reg1 currently contains csr1.peerVal (the peer-value from csr1). + ** This block adds (or subtracts for DESC) the numeric value in regVal + ** from it. Or, if reg1 is not numeric (it is a NULL, a text value or a blob), + ** then leave reg1 as it is. In pseudo-code, this is implemented as: + ** + ** if( reg1>='' ) goto addrGe; + ** reg1 = reg1 +/- regVal + ** addrGe: + ** + ** Since all strings and blobs are greater-than-or-equal-to an empty string, + ** the add/subtract is skipped for these, as required. If reg1 is a NULL, + ** then the arithmetic is performed, but since adding or subtracting from + ** NULL is always NULL anyway, this case is handled as required too. */ + _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1680, -int32(1)) + addrGe = _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regString, 0, reg1) + if op == int32(OP_Ge) && arith == int32(OP_Add) || op == int32(OP_Le) && arith == int32(OP_Subtract) { + _sqlite3VdbeAddOp3(tls, v, op, reg2, lbl, reg1) + } + _sqlite3VdbeAddOp3(tls, v, arith, regVal, reg1, reg1) + _sqlite3VdbeJumpHere(tls, v, addrGe) + /* Compare registers reg2 and reg1, taking the jump if required. Note that + ** control skips over this test if the BIGNULL flag is set and either + ** reg1 or reg2 contain a NULL value. */ + _sqlite3VdbeAddOp3(tls, v, op, reg2, lbl, reg1) + pColl = _sqlite3ExprNNCollSeq(tls, pParse, (*(*TExprList_item)(unsafe.Pointer(pOrderBy + 8))).FpExpr) + _sqlite3VdbeAppendP4(tls, v, pColl, -int32(2)) + _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + _sqlite3VdbeResolveLabel(tls, v, addrDone) + _sqlite3ReleaseTempReg(tls, pParse, reg1) + _sqlite3ReleaseTempReg(tls, pParse, reg2) +} + +// C documentation +// +// /* +// ** Helper function for sqlite3WindowCodeStep(). Each call to this function +// ** generates VM code for a single RETURN_ROW, AGGSTEP or AGGINVERSE +// ** operation. Refer to the header comment for sqlite3WindowCodeStep() for +// ** details. +// */ +func _windowCodeOp(tls *libc.TLS, p uintptr, op int32, regCountdown int32, jumpOnEof int32) (r int32) { + var addrContinue, addrNextRange, bPeer, csr, lblDone, nReg, reg, regRowid1, regRowid2, regTmp, ret, v1, v2 int32 + var pMWin, pParse, v uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addrContinue, addrNextRange, bPeer, csr, lblDone, nReg, pMWin, pParse, reg, regRowid1, regRowid2, regTmp, ret, v, v1, v2 + pParse = (*TWindowCodeArg)(unsafe.Pointer(p)).FpParse + pMWin = (*TWindowCodeArg)(unsafe.Pointer(p)).FpMWin + ret = 0 + v = (*TWindowCodeArg)(unsafe.Pointer(p)).FpVdbe + addrContinue = 0 + bPeer = libc.BoolInt32(int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_ROWS)) + lblDone = _sqlite3VdbeMakeLabel(tls, pParse) + addrNextRange = 0 + /* Special case - WINDOW_AGGINVERSE is always a no-op if the frame + ** starts with UNBOUNDED PRECEDING. */ + if op == int32(WINDOW_AGGINVERSE) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_UNBOUNDED) { + return 0 + } + if regCountdown > 0 { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + addrNextRange = _sqlite3VdbeCurrentAddr(tls, v) + if op == int32(WINDOW_AGGINVERSE) { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { + _windowCodeRangeTest(tls, p, int32(OP_Le), (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, regCountdown, (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, lblDone) + } else { + _windowCodeRangeTest(tls, p, int32(OP_Ge), (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, regCountdown, (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, lblDone) + } + } else { + _windowCodeRangeTest(tls, p, int32(OP_Gt), (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regCountdown, (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, lblDone) + } + } else { + _sqlite3VdbeAddOp3(tls, v, int32(OP_IfPos), regCountdown, lblDone, int32(1)) + } + } + if op == int32(WINDOW_RETURN_ROW) && (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid == 0 { + _windowAggFinal(tls, p, 0) + } + addrContinue = _sqlite3VdbeCurrentAddr(tls, v) + /* If this is a (RANGE BETWEEN a FOLLOWING AND b FOLLOWING) or + ** (RANGE BETWEEN b PRECEDING AND a PRECEDING) frame, ensure the + ** start cursor does not advance past the end cursor within the + ** temporary table. It otherwise might, if (a>b). Also ensure that, + ** if the input cursor is still finding new rows, that the end + ** cursor does not go past it to EOF. */ + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) && regCountdown != 0 && int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + regRowid1 = _sqlite3GetTempReg(tls, pParse) + regRowid2 = _sqlite3GetTempReg(tls, pParse) + if op == int32(WINDOW_AGGINVERSE) { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, regRowid1) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regRowid2) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regRowid2, lblDone, regRowid1) + } else { + if (*TWindowCodeArg)(unsafe.Pointer(p)).FregRowid != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Rowid), (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regRowid1) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), (*TWindowCodeArg)(unsafe.Pointer(p)).FregRowid, lblDone, regRowid1) + } + } + _sqlite3ReleaseTempReg(tls, pParse, regRowid1) + _sqlite3ReleaseTempReg(tls, pParse, regRowid2) + } + switch op { + case int32(WINDOW_RETURN_ROW): + csr = (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr + reg = (*TWindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Freg + _windowReturnOneRow(tls, p) + case int32(WINDOW_AGGINVERSE): + csr = (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr + reg = (*TWindowCodeArg)(unsafe.Pointer(p)).Fstart.Freg + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid, int32(1)) + } else { + _windowAggStep(tls, p, pMWin, csr, int32(1), (*TWindowCodeArg)(unsafe.Pointer(p)).FregArg) + } + default: + csr = (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr + reg = (*TWindowCodeArg)(unsafe.Pointer(p)).Fend.Freg + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_AddImm), (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid, int32(1)) + } else { + _windowAggStep(tls, p, pMWin, csr, 0, (*TWindowCodeArg)(unsafe.Pointer(p)).FregArg) + } + break + } + if op == (*TWindowCodeArg)(unsafe.Pointer(p)).FeDelete { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Delete), csr) + _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) + } + if jumpOnEof != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), csr, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) + ret = _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) + } else { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), csr, _sqlite3VdbeCurrentAddr(tls, v)+int32(1)+bPeer) + if bPeer != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, lblDone) + } + } + if bPeer != 0 { + if (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + v1 = (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy)).FnExpr + } else { + v1 = 0 + } + nReg = v1 + if nReg != 0 { + v2 = _sqlite3GetTempRange(tls, pParse, nReg) + } else { + v2 = 0 + } + regTmp = v2 + _windowReadPeerValues(tls, p, csr, regTmp) + _windowIfNewPeer(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy, regTmp, reg, addrContinue) + _sqlite3ReleaseTempRange(tls, pParse, regTmp, nReg) + } + if addrNextRange != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrNextRange) + } + _sqlite3VdbeResolveLabel(tls, v, lblDone) + return ret +} + +// C documentation +// +// /* +// ** Allocate and return a duplicate of the Window object indicated by the +// ** third argument. Set the Window.pOwner field of the new object to +// ** pOwner. +// */ +func _sqlite3WindowDup(tls *libc.TLS, db uintptr, pOwner uintptr, p uintptr) (r uintptr) { + var pNew uintptr + _ = pNew + pNew = uintptr(0) + if p != 0 { + pNew = _sqlite3DbMallocZero(tls, db, uint64(144)) + if pNew != 0 { + (*TWindow)(unsafe.Pointer(pNew)).FzName = _sqlite3DbStrDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FzName) + (*TWindow)(unsafe.Pointer(pNew)).FzBase = _sqlite3DbStrDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FzBase) + (*TWindow)(unsafe.Pointer(pNew)).FpFilter = _sqlite3ExprDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FpFilter, 0) + (*TWindow)(unsafe.Pointer(pNew)).FpWFunc = (*TWindow)(unsafe.Pointer(p)).FpWFunc + (*TWindow)(unsafe.Pointer(pNew)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FpPartition, 0) + (*TWindow)(unsafe.Pointer(pNew)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FpOrderBy, 0) + (*TWindow)(unsafe.Pointer(pNew)).FeFrmType = (*TWindow)(unsafe.Pointer(p)).FeFrmType + (*TWindow)(unsafe.Pointer(pNew)).FeEnd = (*TWindow)(unsafe.Pointer(p)).FeEnd + (*TWindow)(unsafe.Pointer(pNew)).FeStart = (*TWindow)(unsafe.Pointer(p)).FeStart + (*TWindow)(unsafe.Pointer(pNew)).FeExclude = (*TWindow)(unsafe.Pointer(p)).FeExclude + (*TWindow)(unsafe.Pointer(pNew)).FregResult = (*TWindow)(unsafe.Pointer(p)).FregResult + (*TWindow)(unsafe.Pointer(pNew)).FregAccum = (*TWindow)(unsafe.Pointer(p)).FregAccum + (*TWindow)(unsafe.Pointer(pNew)).FiArgCol = (*TWindow)(unsafe.Pointer(p)).FiArgCol + (*TWindow)(unsafe.Pointer(pNew)).FiEphCsr = (*TWindow)(unsafe.Pointer(p)).FiEphCsr + (*TWindow)(unsafe.Pointer(pNew)).FbExprArgs = (*TWindow)(unsafe.Pointer(p)).FbExprArgs + (*TWindow)(unsafe.Pointer(pNew)).FpStart = _sqlite3ExprDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FpStart, 0) + (*TWindow)(unsafe.Pointer(pNew)).FpEnd = _sqlite3ExprDup(tls, db, (*TWindow)(unsafe.Pointer(p)).FpEnd, 0) + (*TWindow)(unsafe.Pointer(pNew)).FpOwner = pOwner + (*TWindow)(unsafe.Pointer(pNew)).FbImplicitFrame = (*TWindow)(unsafe.Pointer(p)).FbImplicitFrame + } + } + return pNew +} + +// C documentation +// +// /* +// ** Return a copy of the linked list of Window objects passed as the +// ** second argument. +// */ +func _sqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pWin, pp uintptr + var _ /* pRet at bp+0 */ uintptr + _, _ = pWin, pp + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pp = bp + pWin = p + for { + if !(pWin != 0) { + break + } + *(*uintptr)(unsafe.Pointer(pp)) = _sqlite3WindowDup(tls, db, uintptr(0), pWin) + if *(*uintptr)(unsafe.Pointer(pp)) == uintptr(0) { + break + } + pp = *(*uintptr)(unsafe.Pointer(pp)) + 64 + goto _1 + _1: + ; + pWin = (*TWindow)(unsafe.Pointer(pWin)).FpNextWin + } + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Return true if it can be determined at compile time that expression +// ** pExpr evaluates to a value that, when cast to an integer, is greater +// ** than zero. False otherwise. +// ** +// ** If an OOM error occurs, this function sets the Parse.db.mallocFailed +// ** flag and returns zero. +// */ +func _windowExprGtZero(tls *libc.TLS, pParse uintptr, pExpr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db uintptr + var ret int32 + var _ /* pVal at bp+0 */ uintptr + _, _ = db, ret + ret = 0 + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3ValueFromExpr(tls, db, pExpr, (*Tsqlite3)(unsafe.Pointer(db)).Fenc, uint8(SQLITE_AFF_NUMERIC), bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 && Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(bp))) > 0 { + ret = int32(1) + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + return ret +} + +// C documentation +// +// /* +// ** sqlite3WhereBegin() has already been called for the SELECT statement +// ** passed as the second argument when this function is invoked. It generates +// ** code to populate the Window.regResult register for each window function +// ** and invoke the sub-routine at instruction addrGosub once for each row. +// ** sqlite3WhereEnd() is always called before returning. +// ** +// ** This function handles several different types of window frames, which +// ** require slightly different processing. The following pseudo code is +// ** used to implement window frames of the form: +// ** +// ** ROWS BETWEEN PRECEDING AND FOLLOWING +// ** +// ** Other window frame types use variants of the following: +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** +// ** if( first row of partition ){ +// ** // Rewind three cursors, all open on the eph table. +// ** Rewind(csrEnd); +// ** Rewind(csrStart); +// ** Rewind(csrCurrent); +// ** +// ** regEnd = // FOLLOWING expression +// ** regStart = // PRECEDING expression +// ** }else{ +// ** // First time this branch is taken, the eph table contains two +// ** // rows. The first row in the partition, which all three cursors +// ** // currently point to, and the following row. +// ** AGGSTEP +// ** if( (regEnd--)<=0 ){ +// ** RETURN_ROW +// ** if( (regStart--)<=0 ){ +// ** AGGINVERSE +// ** } +// ** } +// ** } +// ** } +// ** flush: +// ** AGGSTEP +// ** while( 1 ){ +// ** RETURN ROW +// ** if( csrCurrent is EOF ) break; +// ** if( (regStart--)<=0 ){ +// ** AggInverse(csrStart) +// ** Next(csrStart) +// ** } +// ** } +// ** +// ** The pseudo-code above uses the following shorthand: +// ** +// ** AGGSTEP: invoke the aggregate xStep() function for each window function +// ** with arguments read from the current row of cursor csrEnd, then +// ** step cursor csrEnd forward one row (i.e. sqlite3BtreeNext()). +// ** +// ** RETURN_ROW: return a row to the caller based on the contents of the +// ** current row of csrCurrent and the current state of all +// ** aggregates. Then step cursor csrCurrent forward one row. +// ** +// ** AGGINVERSE: invoke the aggregate xInverse() function for each window +// ** functions with arguments read from the current row of cursor +// ** csrStart. Then step csrStart forward one row. +// ** +// ** There are two other ROWS window frames that are handled significantly +// ** differently from the above - "BETWEEN PRECEDING AND PRECEDING" +// ** and "BETWEEN FOLLOWING AND FOLLOWING". These are special +// ** cases because they change the order in which the three cursors (csrStart, +// ** csrCurrent and csrEnd) iterate through the ephemeral table. Cases that +// ** use UNBOUNDED or CURRENT ROW are much simpler variations on one of these +// ** three. +// ** +// ** ROWS BETWEEN PRECEDING AND PRECEDING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** }else{ +// ** if( (regEnd--)<=0 ){ +// ** AGGSTEP +// ** } +// ** RETURN_ROW +// ** if( (regStart--)<=0 ){ +// ** AGGINVERSE +// ** } +// ** } +// ** } +// ** flush: +// ** if( (regEnd--)<=0 ){ +// ** AGGSTEP +// ** } +// ** RETURN_ROW +// ** +// ** +// ** ROWS BETWEEN FOLLOWING AND FOLLOWING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = regEnd - +// ** }else{ +// ** AGGSTEP +// ** if( (regEnd--)<=0 ){ +// ** RETURN_ROW +// ** } +// ** if( (regStart--)<=0 ){ +// ** AGGINVERSE +// ** } +// ** } +// ** } +// ** flush: +// ** AGGSTEP +// ** while( 1 ){ +// ** if( (regEnd--)<=0 ){ +// ** RETURN_ROW +// ** if( eof ) break; +// ** } +// ** if( (regStart--)<=0 ){ +// ** AGGINVERSE +// ** if( eof ) break +// ** } +// ** } +// ** while( !eof csrCurrent ){ +// ** RETURN_ROW +// ** } +// ** +// ** For the most part, the patterns above are adapted to support UNBOUNDED by +// ** assuming that it is equivalent to "infinity PRECEDING/FOLLOWING" and +// ** CURRENT ROW by assuming that it is equivalent to "0 PRECEDING/FOLLOWING". +// ** This is optimized of course - branches that will never be taken and +// ** conditions that are always true are omitted from the VM code. The only +// ** exceptional case is: +// ** +// ** ROWS BETWEEN FOLLOWING AND UNBOUNDED FOLLOWING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regStart = +// ** }else{ +// ** AGGSTEP +// ** } +// ** } +// ** flush: +// ** AGGSTEP +// ** while( 1 ){ +// ** if( (regStart--)<=0 ){ +// ** AGGINVERSE +// ** if( eof ) break +// ** } +// ** RETURN_ROW +// ** } +// ** while( !eof csrCurrent ){ +// ** RETURN_ROW +// ** } +// ** +// ** Also requiring special handling are the cases: +// ** +// ** ROWS BETWEEN PRECEDING AND PRECEDING +// ** ROWS BETWEEN FOLLOWING AND FOLLOWING +// ** +// ** when (expr1 < expr2). This is detected at runtime, not by this function. +// ** To handle this case, the pseudo-code programs depicted above are modified +// ** slightly to be: +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** if( regEnd < regStart ){ +// ** RETURN_ROW +// ** delete eph table contents +// ** continue +// ** } +// ** ... +// ** +// ** The new "continue" statement in the above jumps to the next iteration +// ** of the outer loop - the one started by sqlite3WhereBegin(). +// ** +// ** The various GROUPS cases are implemented using the same patterns as +// ** ROWS. The VM code is modified slightly so that: +// ** +// ** 1. The else branch in the main loop is only taken if the row just +// ** added to the ephemeral table is the start of a new group. In +// ** other words, it becomes: +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** }else if( new group ){ +// ** ... +// ** } +// ** } +// ** +// ** 2. Instead of processing a single row, each RETURN_ROW, AGGSTEP or +// ** AGGINVERSE step processes the current row of the relevant cursor and +// ** all subsequent rows belonging to the same group. +// ** +// ** RANGE window frames are a little different again. As for GROUPS, the +// ** main loop runs once per group only. And RETURN_ROW, AGGSTEP and AGGINVERSE +// ** deal in groups instead of rows. As for ROWS and GROUPS, there are three +// ** basic cases: +// ** +// ** RANGE BETWEEN PRECEDING AND FOLLOWING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** }else{ +// ** AGGSTEP +// ** while( (csrCurrent.key + regEnd) < csrEnd.key ){ +// ** RETURN_ROW +// ** while( csrStart.key + regStart) < csrCurrent.key ){ +// ** AGGINVERSE +// ** } +// ** } +// ** } +// ** } +// ** flush: +// ** AGGSTEP +// ** while( 1 ){ +// ** RETURN ROW +// ** if( csrCurrent is EOF ) break; +// ** while( csrStart.key + regStart) < csrCurrent.key ){ +// ** AGGINVERSE +// ** } +// ** } +// ** } +// ** +// ** In the above notation, "csr.key" means the current value of the ORDER BY +// ** expression (there is only ever 1 for a RANGE that uses an FOLLOWING +// ** or PRECEDING AND PRECEDING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** }else{ +// ** while( (csrEnd.key + regEnd) <= csrCurrent.key ){ +// ** AGGSTEP +// ** } +// ** while( (csrStart.key + regStart) < csrCurrent.key ){ +// ** AGGINVERSE +// ** } +// ** RETURN_ROW +// ** } +// ** } +// ** flush: +// ** while( (csrEnd.key + regEnd) <= csrCurrent.key ){ +// ** AGGSTEP +// ** } +// ** while( (csrStart.key + regStart) < csrCurrent.key ){ +// ** AGGINVERSE +// ** } +// ** RETURN_ROW +// ** +// ** RANGE BETWEEN FOLLOWING AND FOLLOWING +// ** +// ** ... loop started by sqlite3WhereBegin() ... +// ** if( new partition ){ +// ** Gosub flush +// ** } +// ** Insert new row into eph table. +// ** if( first row of partition ){ +// ** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// ** regEnd = +// ** regStart = +// ** }else{ +// ** AGGSTEP +// ** while( (csrCurrent.key + regEnd) < csrEnd.key ){ +// ** while( (csrCurrent.key + regStart) > csrStart.key ){ +// ** AGGINVERSE +// ** } +// ** RETURN_ROW +// ** } +// ** } +// ** } +// ** flush: +// ** AGGSTEP +// ** while( 1 ){ +// ** while( (csrCurrent.key + regStart) > csrStart.key ){ +// ** AGGINVERSE +// ** if( eof ) break "while( 1 )" loop. +// ** } +// ** RETURN_ROW +// ** } +// ** while( !eof csrCurrent ){ +// ** RETURN_ROW +// ** } +// ** +// ** The text above leaves out many details. Refer to the code and comments +// ** below for a more complete picture. +// */ +func _sqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uintptr, regGosub int32, addrGosub int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var addr, addr1, addrBreak, addrBreak1, addrBreak2, addrBreak3, addrEmpty, addrGe, addrGosubFlush, addrInteger, addrNe, addrNext, addrStart, addrStart1, bRPS, bRPS1, csrInput, csrWrite, iInput, lbl, lbl1, lblWhereEnd, nInput, nPart, nPeer, op, regEnd, regFlushPart, regNew, regNewPart, regNewPeer, regPeer, regRecord, regStart, v1, v11, v13, v14, v15, v3, v5, v7, v9 int32 + var pKeyInfo, pMWin, pOrderBy, pPart, v, v12, v2, v4, v6, v8 uintptr + var _ /* s at bp+0 */ TWindowCodeArg + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = addr, addr1, addrBreak, addrBreak1, addrBreak2, addrBreak3, addrEmpty, addrGe, addrGosubFlush, addrInteger, addrNe, addrNext, addrStart, addrStart1, bRPS, bRPS1, csrInput, csrWrite, iInput, lbl, lbl1, lblWhereEnd, nInput, nPart, nPeer, op, pKeyInfo, pMWin, pOrderBy, pPart, regEnd, regFlushPart, regNew, regNewPart, regNewPeer, regPeer, regRecord, regStart, v, v1, v11, v12, v13, v14, v15, v2, v3, v4, v5, v6, v7, v8, v9 + pMWin = (*TSelect)(unsafe.Pointer(p)).FpWin + pOrderBy = (*TWindow)(unsafe.Pointer(pMWin)).FpOrderBy + v = _sqlite3GetVdbe(tls, pParse) /* Cursor used to write to eph. table */ + csrInput = (*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FiCursor /* Cursor of sub-select */ + nInput = int32((*TTable)(unsafe.Pointer((*(*TSrcItem)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc + 8))).FpTab)).FnCol) /* Address of OP_Ne */ + addrGosubFlush = 0 /* Address of OP_Gosub to flush: */ + addrInteger = 0 /* regNew array in record form */ + regNewPeer = 0 /* Peer values for new row (part of regNew) */ + regPeer = 0 /* Peer values for current row */ + regFlushPart = 0 /* Label just before sqlite3WhereEnd() code */ + regStart = 0 /* Value of PRECEDING */ + regEnd = 0 /* Value of FOLLOWING */ + lblWhereEnd = _sqlite3VdbeMakeLabel(tls, pParse) + /* Fill in the context object */ + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FpParse = pParse + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FpMWin = pMWin + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FpVdbe = v + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregGosub = regGosub + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FaddrGosub = addrGosub + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr = (*TWindow)(unsafe.Pointer(pMWin)).FiEphCsr + csrWrite = (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr + int32(1) + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fstart.Fcsr = (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr + int32(2) + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Fcsr = (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr + int32(3) + /* Figure out when rows may be deleted from the ephemeral table. There + ** are four options - they may never be deleted (eDelete==0), they may + ** be deleted as soon as they are no longer part of the window frame + ** (eDelete==WINDOW_AGGINVERSE), they may be deleted as after the row + ** has been returned to the caller (WINDOW_RETURN_ROW), or they may + ** be deleted after they enter the frame (WINDOW_AGGSTEP). */ + switch int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) { + case int32(TK_FOLLOWING): + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_RANGE) && _windowExprGtZero(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpStart) != 0 { + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FeDelete = int32(WINDOW_RETURN_ROW) + } + case int32(TK_UNBOUNDED): + if _windowCacheFrame(tls, pMWin) == 0 { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_PRECEDING) { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_RANGE) && _windowExprGtZero(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpEnd) != 0 { + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FeDelete = int32(WINDOW_AGGSTEP) + } + } else { + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FeDelete = int32(WINDOW_RETURN_ROW) + } + } + default: + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FeDelete = int32(WINDOW_AGGINVERSE) + break + } + /* Allocate registers for the array of values from the sub-query, the + ** same values in record form, and the rowid used to insert said record + ** into the ephemeral table. */ + regNew = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nInput + v2 = pParse + 56 + *(*int32)(unsafe.Pointer(v2))++ + v1 = *(*int32)(unsafe.Pointer(v2)) + regRecord = v1 + v4 = pParse + 56 + *(*int32)(unsafe.Pointer(v4))++ + v3 = *(*int32)(unsafe.Pointer(v4)) + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregRowid = v3 + /* If the window frame contains an " PRECEDING" or " FOLLOWING" + ** clause, allocate registers to store the results of evaluating each + ** . */ + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_PRECEDING) || int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { + v6 = pParse + 56 + *(*int32)(unsafe.Pointer(v6))++ + v5 = *(*int32)(unsafe.Pointer(v6)) + regStart = v5 + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_PRECEDING) || int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_FOLLOWING) { + v8 = pParse + 56 + *(*int32)(unsafe.Pointer(v8))++ + v7 = *(*int32)(unsafe.Pointer(v8)) + regEnd = v7 + } + /* If this is not a "ROWS BETWEEN ..." frame, then allocate arrays of + ** registers to store copies of the ORDER BY expressions (peer values) + ** for the main loop, and for each cursor (start, current and end). */ + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_ROWS) { + if pOrderBy != 0 { + v9 = (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr + } else { + v9 = 0 + } + nPeer = v9 + regNewPeer = regNew + (*TWindow)(unsafe.Pointer(pMWin)).FnBufferCol + if (*TWindow)(unsafe.Pointer(pMWin)).FpPartition != 0 { + regNewPeer += (*TExprList)(unsafe.Pointer((*TWindow)(unsafe.Pointer(pMWin)).FpPartition)).FnExpr + } + regPeer = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPeer + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fstart.Freg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPeer + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Freg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPeer + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Freg = (*TParse)(unsafe.Pointer(pParse)).FnMem + int32(1) + *(*int32)(unsafe.Pointer(pParse + 56)) += nPeer + } + /* Load the column values for the row returned by the sub-select + ** into an array of registers starting at regNew. Assemble them into + ** a record in register regRecord. */ + iInput = 0 + for { + if !(iInput < nInput) { + break + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), csrInput, iInput, regNew+iInput) + goto _10 + _10: + ; + iInput++ + } + _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regNew, nInput, regRecord) + /* An input row has just been read into an array of registers starting + ** at regNew. If the window has a PARTITION clause, this block generates + ** VM code to check if the input row is the start of a new partition. + ** If so, it does an OP_Gosub to an address to be filled in later. The + ** address of the OP_Gosub is stored in local variable addrGosubFlush. */ + if (*TWindow)(unsafe.Pointer(pMWin)).FpPartition != 0 { + pPart = (*TWindow)(unsafe.Pointer(pMWin)).FpPartition + nPart = (*TExprList)(unsafe.Pointer(pPart)).FnExpr + regNewPart = regNew + (*TWindow)(unsafe.Pointer(pMWin)).FnBufferCol + pKeyInfo = _sqlite3KeyInfoFromExprList(tls, pParse, pPart, 0, 0) + v12 = pParse + 56 + *(*int32)(unsafe.Pointer(v12))++ + v11 = *(*int32)(unsafe.Pointer(v12)) + regFlushPart = v11 + addr = _sqlite3VdbeAddOp3(tls, v, int32(OP_Compare), regNewPart, (*TWindow)(unsafe.Pointer(pMWin)).FregPart, nPart) + _sqlite3VdbeAppendP4(tls, v, pKeyInfo, -int32(8)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Jump), addr+int32(2), addr+int32(4), addr+int32(2)) + addrGosubFlush = _sqlite3VdbeAddOp1(tls, v, int32(OP_Gosub), regFlushPart) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regNewPart, (*TWindow)(unsafe.Pointer(pMWin)).FregPart, nPart-int32(1)) + } + /* Insert the new row into the ephemeral table */ + _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), csrWrite, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregRowid) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), csrWrite, regRecord, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregRowid) + addrNe = _sqlite3VdbeAddOp3(tls, v, int32(OP_Ne), (*TWindow)(unsafe.Pointer(pMWin)).FregOne, 0, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregRowid) + /* This block is run for the first row of each partition */ + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregArg = _windowInitAccum(tls, pParse, pMWin) + if regStart != 0 { + _sqlite3ExprCode(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpStart, regStart) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + v13 = int32(3) + } else { + v13 = 0 + } + _windowCheckValue(tls, pParse, regStart, 0+v13) + } + if regEnd != 0 { + _sqlite3ExprCode(tls, pParse, (*TWindow)(unsafe.Pointer(pMWin)).FpEnd, regEnd) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + v14 = int32(3) + } else { + v14 = 0 + } + _windowCheckValue(tls, pParse, regEnd, int32(1)+v14) + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_RANGE) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) && regStart != 0 { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { + v15 = int32(OP_Ge) + } else { + v15 = int32(OP_Le) + } + op = v15 + addrGe = _sqlite3VdbeAddOp3(tls, v, op, regStart, 0, regEnd) + /* NeverNull because bound */ + /* values previously checked */ + _windowAggFinal(tls, bp, 0) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr) + _windowReturnOneRow(tls, bp) + _sqlite3VdbeAddOp1(tls, v, int32(OP_ResetSorter), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, lblWhereEnd) + _sqlite3VdbeJumpHere(tls, v, addrGe) + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) != int32(TK_RANGE) && regEnd != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Subtract), regStart, regEnd, regStart) + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) != int32(TK_UNBOUNDED) { + _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fstart.Fcsr) + } + _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Fcsr) + if regPeer != 0 && pOrderBy != 0 { + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regNewPeer, regPeer, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr-int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regPeer, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fstart.Freg, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr-int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regPeer, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Freg, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr-int32(1)) + _sqlite3VdbeAddOp3(tls, v, int32(OP_Copy), regPeer, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Freg, (*TExprList)(unsafe.Pointer(pOrderBy)).FnExpr-int32(1)) + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, lblWhereEnd) + _sqlite3VdbeJumpHere(tls, v, addrNe) + /* Beginning of the block executed for the second and subsequent rows. */ + if regPeer != 0 { + _windowIfNewPeer(tls, pParse, pOrderBy, regNewPeer, regPeer, lblWhereEnd) + } + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), 0, 0) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) != int32(TK_UNBOUNDED) { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + lbl = _sqlite3VdbeMakeLabel(tls, pParse) + addrNext = _sqlite3VdbeCurrentAddr(tls, v) + _windowCodeRangeTest(tls, bp, int32(OP_Ge), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr, regEnd, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Fcsr, lbl) + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrNext) + _sqlite3VdbeResolveLabel(tls, v, lbl) + } else { + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), regEnd, 0) + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + } + } + } else { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_PRECEDING) { + bRPS = libc.BoolInt32(int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_PRECEDING) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE)) + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), regEnd, 0) + if bRPS != 0 { + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + } + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, 0) + if !(bRPS != 0) { + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + } + } else { + addr1 = 0 + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), 0, 0) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) != int32(TK_UNBOUNDED) { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + lbl1 = 0 + addr1 = _sqlite3VdbeCurrentAddr(tls, v) + if regEnd != 0 { + lbl1 = _sqlite3VdbeMakeLabel(tls, pParse) + _windowCodeRangeTest(tls, bp, int32(OP_Ge), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr, regEnd, (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fend.Fcsr, lbl1) + } + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, 0) + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + if regEnd != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addr1) + _sqlite3VdbeResolveLabel(tls, v, lbl1) + } + } else { + if regEnd != 0 { + addr1 = _sqlite3VdbeAddOp3(tls, v, int32(OP_IfPos), regEnd, 0, int32(1)) + } + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, 0) + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + if regEnd != 0 { + _sqlite3VdbeJumpHere(tls, v, addr1) + } + } + } + } + } + /* End of the main input loop */ + _sqlite3VdbeResolveLabel(tls, v, lblWhereEnd) + _sqlite3WhereEnd(tls, pWInfo) + /* Fall through */ + if (*TWindow)(unsafe.Pointer(pMWin)).FpPartition != 0 { + addrInteger = _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regFlushPart) + _sqlite3VdbeJumpHere(tls, v, addrGosubFlush) + } + (*(*TWindowCodeArg)(unsafe.Pointer(bp))).FregRowid = 0 + addrEmpty = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), csrWrite) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_PRECEDING) { + bRPS1 = libc.BoolInt32(int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_PRECEDING) && int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE)) + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), regEnd, 0) + if bRPS1 != 0 { + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + } + _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, 0) + } else { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeStart) == int32(TK_FOLLOWING) { + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), 0, 0) + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeFrmType) == int32(TK_RANGE) { + addrStart = _sqlite3VdbeCurrentAddr(tls, v) + addrBreak2 = _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, int32(1)) + addrBreak1 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, int32(1)) + } else { + if int32((*TWindow)(unsafe.Pointer(pMWin)).FeEnd) == int32(TK_UNBOUNDED) { + addrStart = _sqlite3VdbeCurrentAddr(tls, v) + addrBreak1 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), regStart, int32(1)) + addrBreak2 = _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), 0, int32(1)) + } else { + addrStart = _sqlite3VdbeCurrentAddr(tls, v) + addrBreak1 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), regEnd, int32(1)) + addrBreak2 = _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, int32(1)) + } + } + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrStart) + _sqlite3VdbeJumpHere(tls, v, addrBreak2) + addrStart = _sqlite3VdbeCurrentAddr(tls, v) + addrBreak3 = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, int32(1)) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrStart) + _sqlite3VdbeJumpHere(tls, v, addrBreak1) + _sqlite3VdbeJumpHere(tls, v, addrBreak3) + } else { + _windowCodeOp(tls, bp, int32(WINDOW_AGGSTEP), 0, 0) + addrStart1 = _sqlite3VdbeCurrentAddr(tls, v) + addrBreak = _windowCodeOp(tls, bp, int32(WINDOW_RETURN_ROW), 0, int32(1)) + _windowCodeOp(tls, bp, int32(WINDOW_AGGINVERSE), regStart, 0) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrStart1) + _sqlite3VdbeJumpHere(tls, v, addrBreak) + } + } + _sqlite3VdbeJumpHere(tls, v, addrEmpty) + _sqlite3VdbeAddOp1(tls, v, int32(OP_ResetSorter), (*(*TWindowCodeArg)(unsafe.Pointer(bp))).Fcurrent.Fcsr) + if (*TWindow)(unsafe.Pointer(pMWin)).FpPartition != 0 { + if (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), (*TWindow)(unsafe.Pointer(pMWin)).FregStartRowid) + _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, (*TWindow)(unsafe.Pointer(pMWin)).FregEndRowid) + } + _sqlite3VdbeChangeP1(tls, v, addrInteger, _sqlite3VdbeCurrentAddr(tls, v)) + _sqlite3VdbeAddOp1(tls, v, int32(OP_Return), regFlushPart) + } +} + +/************** End of window.c **********************************************/ +/************** Begin file parse.c *******************************************/ +/* This file is automatically generated by Lemon from input grammar +** source file "parse.y". + */ +/* +** 2001-09-15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains SQLite's SQL parser. +** +** The canonical source code to this file ("parse.y") is a Lemon grammar +** file that specifies the input grammar and actions to take while parsing. +** That input file is processed by Lemon to generate a C-language +** implementation of a parser for the given grammar. You might be reading +** this comment as part of the translated C-code. Edits should be made +** to the original parse.y sources. + */ + +/* #include "sqliteInt.h" */ + +/* +** Disable all error recovery processing in the parser push-down +** automaton. + */ + +/* +** Make yytestcase() the same as testcase() + */ + +/* +** Indicate that sqlite3ParserFree() will never be called with a null +** pointer. + */ + +/* +** In the amalgamation, the parse.c file generated by lemon and the +** tokenize.c file are concatenated. In that case, sqlite3RunParser() +** has access to the the size of the yyParser object and so the parser +** engine can be allocated from stack. In that case, only the +** sqlite3ParserInit() and sqlite3ParserFinalize() routines are invoked +** and the sqlite3ParserAlloc() and sqlite3ParserFree() routines can be +** omitted. + */ + +/* +** Alternative datatype for the argument to the malloc() routine passed +** into sqlite3ParserAlloc(). The default is size_t. + */ + +/* +** An instance of the following structure describes the event of a +** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, +** TK_DELETE, or TK_INSTEAD. If the event is of the form +** +** UPDATE ON (a,b,c) +** +** Then the "b" IdList records the list "a,b,c". + */ +type TTrigEvent = struct { + Fa int32 + Fb uintptr +} + +type TrigEvent = TTrigEvent + +type TFrameBound = struct { + FeType int32 + FpExpr uintptr +} + +type FrameBound = TFrameBound + +// C documentation +// +// /* +// ** Disable lookaside memory allocation for objects that might be +// ** shared across database connections. +// */ +func _disableLookaside(tls *libc.TLS, pParse uintptr) { + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + (*TParse)(unsafe.Pointer(pParse)).FdisableLookaside++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) +} + +// C documentation +// +// /* +// ** For a compound SELECT statement, make sure p->pPrior->pNext==p for +// ** all elements in the list. And make sure list length does not exceed +// ** SQLITE_LIMIT_COMPOUND_SELECT. +// */ +func _parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var cnt, mxSelect, v2 int32 + var pLoop, pNext, v1 uintptr + var v3 bool + _, _, _, _, _, _, _ = cnt, mxSelect, pLoop, pNext, v1, v2, v3 + if (*TSelect)(unsafe.Pointer(p)).FpPrior != 0 { + pNext = uintptr(0) + pLoop = p + cnt = int32(1) + for int32(1) != 0 { + (*TSelect)(unsafe.Pointer(pLoop)).FpNext = pNext + *(*Tu32)(unsafe.Pointer(pLoop + 4)) |= uint32(SF_Compound) + pNext = pLoop + pLoop = (*TSelect)(unsafe.Pointer(pLoop)).FpPrior + if pLoop == uintptr(0) { + break + } + cnt++ + if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != 0 || (*TSelect)(unsafe.Pointer(pLoop)).FpLimit != 0 { + if (*TSelect)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { + v1 = __ccgo_ts + 23239 + } else { + v1 = __ccgo_ts + 23248 + } + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23254, libc.VaList(bp+8, v1, _sqlite3SelectOpName(tls, int32((*TSelect)(unsafe.Pointer(pNext)).Fop)))) + break + } + } + if v3 = (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_MultiValue) == uint32(0); v3 { + v2 = *(*int32)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb + 136 + 4*4)) + mxSelect = v2 + } + if v3 && v2 > 0 && cnt > mxSelect { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23296, 0) + } + } +} + +// C documentation +// +// /* Attach a With object describing the WITH clause to a Select +// ** object describing the query for which the WITH clause is a prefix. +// */ +func _attachWithToSelect(tls *libc.TLS, pParse uintptr, pSelect uintptr, pWith uintptr) (r uintptr) { + if pSelect != 0 { + (*TSelect)(unsafe.Pointer(pSelect)).FpWith = pWith + _parserDoubleLinkSelect(tls, pParse, pSelect) + } else { + _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pWith) + } + return pSelect +} + +// C documentation +// +// /* Construct a new Expr object from a single token */ +func _tokenExpr(tls *libc.TLS, pParse uintptr, op int32, _t TToken) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*TToken)(unsafe.Pointer(bp)) = _t + var p, v1 uintptr + _, _ = p, v1 + p = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(72)+uint64((*(*TToken)(unsafe.Pointer(bp))).Fn)+uint64(1)) + if p != 0 { + /* memset(p, 0, sizeof(Expr)); */ + (*TExpr)(unsafe.Pointer(p)).Fop = uint8(op) + (*TExpr)(unsafe.Pointer(p)).FaffExpr = 0 + (*TExpr)(unsafe.Pointer(p)).Fflags = uint32(EP_Leaf) + /* p->iAgg = -1; // Not required */ + v1 = libc.UintptrFromInt32(0) + (*TExpr)(unsafe.Pointer(p)).FpRight = v1 + (*TExpr)(unsafe.Pointer(p)).FpLeft = v1 + (*TExpr)(unsafe.Pointer(p)).FpAggInfo = uintptr(0) + libc.Xmemset(tls, p+32, 0, uint64(8)) + libc.Xmemset(tls, p+64, 0, uint64(8)) + (*TExpr)(unsafe.Pointer(p)).Fop2 = uint8(0) + (*TExpr)(unsafe.Pointer(p)).FiTable = 0 + (*TExpr)(unsafe.Pointer(p)).FiColumn = 0 + *(*uintptr)(unsafe.Pointer(p + 8)) = p + 1*72 + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p + 8)), (*(*TToken)(unsafe.Pointer(bp))).Fz, uint64((*(*TToken)(unsafe.Pointer(bp))).Fn)) + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8)) + uintptr((*(*TToken)(unsafe.Pointer(bp))).Fn))) = 0 + *(*int32)(unsafe.Pointer(p + 52)) = int32(int64((*(*TToken)(unsafe.Pointer(bp))).Fz) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8)))))])&int32(0x80) != 0 { + _sqlite3DequoteExpr(tls, p) + } + (*TExpr)(unsafe.Pointer(p)).FnHeight = int32(1) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + return _sqlite3RenameTokenMap(tls, pParse, p, bp) + } + } + return p +} + +// C documentation +// +// /* A routine to convert a binary TK_IS or TK_ISNOT expression into a +// ** unary TK_ISNULL or TK_NOTNULL expression. */ +func _binaryToUnaryIfNull(tls *libc.TLS, pParse uintptr, pY uintptr, pA uintptr, op int32) { + var db uintptr + _ = db + db = (*TParse)(unsafe.Pointer(pParse)).Fdb + if pA != 0 && pY != 0 && int32((*TExpr)(unsafe.Pointer(pY)).Fop) == int32(TK_NULL) && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + (*TExpr)(unsafe.Pointer(pA)).Fop = uint8(op) + _sqlite3ExprDelete(tls, db, (*TExpr)(unsafe.Pointer(pA)).FpRight) + (*TExpr)(unsafe.Pointer(pA)).FpRight = uintptr(0) + } +} + +// C documentation +// +// /* Add a single new term to an ExprList that is used to store a +// ** list of identifiers. Report an error if the ID list contains +// ** a COLLATE clause or an ASC or DESC keyword, except ignore the +// ** error while parsing a legacy schema. +// */ +func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdToken uintptr, hasCollate int32, sortOrder int32) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var p uintptr + _ = p + p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) + if (hasCollate != 0 || sortOrder != -int32(1)) && int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23330, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) + } + _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) + return p +} + +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +/**************** End token definitions ***************************************/ + +// C documentation +// +// /* The next sections is a series of control #defines. +// ** various aspects of the generated parser. +// ** YYCODETYPE is the data type used to store the integer codes +// ** that represent terminal and non-terminal symbols. +// ** "unsigned char" is used if there are fewer than +// ** 256 symbols. Larger types otherwise. +// ** YYNOCODE is a number of type YYCODETYPE that is not used for +// ** any terminal or nonterminal symbol. +// ** YYFALLBACK If defined, this indicates that one or more tokens +// ** (also known as: "terminal symbols") have fall-back +// ** values which should be used if the original symbol +// ** would not parse. This permits keywords to sometimes +// ** be used as identifiers, for example. +// ** YYACTIONTYPE is the data type used for "action codes" - numbers +// ** that indicate what to do in response to the next +// ** token. +// ** sqlite3ParserTOKENTYPE is the data type used for minor type for terminal +// ** symbols. Background: A "minor type" is a semantic +// ** value associated with a terminal or non-terminal +// ** symbols. For example, for an "ID" terminal symbol, +// ** the minor type might be the name of the identifier. +// ** Each non-terminal can have a different minor type. +// ** Terminal symbols all have the same minor type, though. +// ** This macros defines the minor type for terminal +// ** symbols. +// ** YYMINORTYPE is the data type used for all minor types. +// ** This is typically a union of many types, one of +// ** which is sqlite3ParserTOKENTYPE. The entry in the union +// ** for terminal symbols is called "yy0". +// ** YYSTACKDEPTH is the maximum depth of the parser's stack. If +// ** zero the stack is dynamically sized using realloc() +// ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument +// ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument +// ** sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +// ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser +// ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser +// ** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context +// ** YYERRORSYMBOL is the code number of the error symbol. If not +// ** defined, then do no error processing. +// ** YYNSTATE the combined number of states. +// ** YYNRULE the number of rules in the grammar +// ** YYNTOKEN Number of terminal symbols +// ** YY_MAX_SHIFT Maximum value for shift actions +// ** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +// ** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +// ** YY_ERROR_ACTION The yy_action[] code for syntax error +// ** YY_ACCEPT_ACTION The yy_action[] code for accept +// ** YY_NO_ACTION The yy_action[] code for no-op +// ** YY_MIN_REDUCE Minimum value for reduce actions +// ** YY_MAX_REDUCE Maximum value for reduce actions +// */ +// /************* Begin control #defines *****************************************/ +type TYYMINORTYPE = struct { + Fyy0 [0]TToken + Fyy33 [0]uintptr + Fyy41 [0]uintptr + Fyy47 [0]uintptr + Fyy131 [0]uintptr + Fyy180 [0]TTrigEvent + Fyy231 [0]struct { + Fvalue int32 + Fmask int32 + } + Fyy254 [0]uintptr + Fyy285 [0]Tu32 + Fyy322 [0]uintptr + Fyy385 [0]uintptr + Fyy394 [0]int32 + Fyy444 [0]uintptr + Fyy516 [0]Tu8 + Fyy521 [0]uintptr + Fyy522 [0]uintptr + Fyy528 [0]uintptr + Fyy561 [0]TOnOrUsing + Fyy595 [0]TFrameBound + Fyyinit int32 + F__ccgo_pad20 [12]byte +} + +type YYMINORTYPE = TYYMINORTYPE + +/************* End control #defines *******************************************/ + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. + */ + +// C documentation +// +// /* Next are the tables used to determine what action to take based on the +// ** current state and lookahead token. These tables are used to implement +// ** functions that take a state number and lookahead value and return an +// ** action integer. +// ** +// ** Suppose the action integer is N. Then the action is determined as +// ** follows +// ** +// ** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +// ** token onto the stack and goto state N. +// ** +// ** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +// ** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +// ** +// ** N == YY_ERROR_ACTION A syntax error has occurred. +// ** +// ** N == YY_ACCEPT_ACTION The parser accepts its input. +// ** +// ** N == YY_NO_ACTION No such action. Denotes unused +// ** slots in the yy_action[] table. +// ** +// ** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +// ** and YY_MAX_REDUCE +// ** +// ** The action table is constructed as a single large table named yy_action[]. +// ** Given state S and lookahead X, the action is computed as either: +// ** +// ** (A) N = yy_action[ yy_shift_ofst[S] + X ] +// ** (B) N = yy_default[S] +// ** +// ** The (A) formula is preferred. The B formula is used instead if +// ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X. +// ** +// ** The formulas above are for computing the action when the lookahead is +// ** a terminal symbol. If the lookahead is a non-terminal (as occurs after +// ** a reduce action) then the yy_reduce_ofst[] array is used in place of +// ** the yy_shift_ofst[] array. +// ** +// ** The following are the tables generated in this section: +// ** +// ** yy_action[] A single table containing all actions. +// ** yy_lookahead[] A table containing the lookahead for each entry in +// ** yy_action. Used to detect hash collisions. +// ** yy_shift_ofst[] For each state, the offset into yy_action for +// ** shifting terminals. +// ** yy_reduce_ofst[] For each state, the offset into yy_action for +// ** shifting non-terminals after a reduce. +// ** yy_default[] Default action for each state. +// ** +// *********** Begin parsing tables **********************************************/ +var _yy_action = [2100]uint16{ + 0: uint16(572), + 1: uint16(210), + 2: uint16(572), + 3: uint16(119), + 4: uint16(116), + 5: uint16(231), + 6: uint16(572), + 7: uint16(119), + 8: uint16(116), + 9: uint16(231), + 10: uint16(572), + 11: uint16(1317), + 12: uint16(379), + 13: uint16(1296), + 14: uint16(410), + 15: uint16(566), + 16: uint16(566), + 17: uint16(566), + 18: uint16(572), + 19: uint16(411), + 20: uint16(380), + 21: uint16(1317), + 22: uint16(1279), + 23: uint16(42), + 24: uint16(42), + 25: uint16(42), + 26: uint16(42), + 27: uint16(210), + 28: uint16(1529), + 29: uint16(72), + 30: uint16(72), + 31: uint16(974), + 32: uint16(421), + 33: uint16(42), + 34: uint16(42), + 35: uint16(495), + 36: uint16(305), + 37: uint16(281), + 38: uint16(305), + 39: uint16(975), + 40: uint16(399), + 41: uint16(72), + 42: uint16(72), + 43: uint16(126), + 44: uint16(127), + 45: uint16(81), + 46: uint16(1217), + 47: uint16(1217), + 48: uint16(1054), + 49: uint16(1057), + 50: uint16(1044), + 51: uint16(1044), + 52: uint16(124), + 53: uint16(124), + 54: uint16(125), + 55: uint16(125), + 56: uint16(125), + 57: uint16(125), + 58: uint16(480), + 59: uint16(411), + 60: uint16(1244), + 61: uint16(1), + 62: uint16(1), + 63: uint16(578), + 64: uint16(2), + 65: uint16(1248), + 66: uint16(554), + 67: uint16(119), + 68: uint16(116), + 69: uint16(231), + 70: uint16(319), + 71: uint16(484), + 72: uint16(147), + 73: uint16(484), + 74: uint16(528), + 75: uint16(119), + 76: uint16(116), + 77: uint16(231), + 78: uint16(533), + 79: uint16(1330), + 80: uint16(419), + 81: uint16(527), + 82: uint16(143), + 83: uint16(126), + 84: uint16(127), + 85: uint16(81), + 86: uint16(1217), + 87: uint16(1217), + 88: uint16(1054), + 89: uint16(1057), + 90: uint16(1044), + 91: uint16(1044), + 92: uint16(124), + 93: uint16(124), + 94: uint16(125), + 95: uint16(125), + 96: uint16(125), + 97: uint16(125), + 98: uint16(119), + 99: uint16(116), + 100: uint16(231), + 101: uint16(329), + 102: uint16(123), + 103: uint16(123), + 104: uint16(123), + 105: uint16(123), + 106: uint16(122), + 107: uint16(122), + 108: uint16(121), + 109: uint16(121), + 110: uint16(121), + 111: uint16(120), + 112: uint16(117), + 113: uint16(448), + 114: uint16(286), + 115: uint16(286), + 116: uint16(286), + 117: uint16(286), + 118: uint16(446), + 119: uint16(446), + 120: uint16(446), + 121: uint16(1568), + 122: uint16(378), + 123: uint16(1570), + 124: uint16(1193), + 125: uint16(377), + 126: uint16(1164), + 127: uint16(569), + 128: uint16(1164), + 129: uint16(569), + 130: uint16(411), + 131: uint16(1568), + 132: uint16(541), + 133: uint16(261), + 134: uint16(228), + 135: uint16(448), + 136: uint16(102), + 137: uint16(146), + 138: uint16(453), + 139: uint16(318), + 140: uint16(563), + 141: uint16(242), + 142: uint16(123), + 143: uint16(123), + 144: uint16(123), + 145: uint16(123), + 146: uint16(122), + 147: uint16(122), + 148: uint16(121), + 149: uint16(121), + 150: uint16(121), + 151: uint16(120), + 152: uint16(117), + 153: uint16(448), + 154: uint16(126), + 155: uint16(127), + 156: uint16(81), + 157: uint16(1217), + 158: uint16(1217), + 159: uint16(1054), + 160: uint16(1057), + 161: uint16(1044), + 162: uint16(1044), + 163: uint16(124), + 164: uint16(124), + 165: uint16(125), + 166: uint16(125), + 167: uint16(125), + 168: uint16(125), + 169: uint16(143), + 170: uint16(296), + 171: uint16(1193), + 172: uint16(341), + 173: uint16(452), + 174: uint16(121), + 175: uint16(121), + 176: uint16(121), + 177: uint16(120), + 178: uint16(117), + 179: uint16(448), + 180: uint16(128), + 181: uint16(1193), + 182: uint16(1194), + 183: uint16(1193), + 184: uint16(149), + 185: uint16(445), + 186: uint16(444), + 187: uint16(572), + 188: uint16(120), + 189: uint16(117), + 190: uint16(448), + 191: uint16(125), + 192: uint16(125), + 193: uint16(125), + 194: uint16(125), + 195: uint16(118), + 196: uint16(123), + 197: uint16(123), + 198: uint16(123), + 199: uint16(123), + 200: uint16(122), + 201: uint16(122), + 202: uint16(121), + 203: uint16(121), + 204: uint16(121), + 205: uint16(120), + 206: uint16(117), + 207: uint16(448), + 208: uint16(458), + 209: uint16(114), + 210: uint16(13), + 211: uint16(13), + 212: uint16(550), + 213: uint16(123), + 214: uint16(123), + 215: uint16(123), + 216: uint16(123), + 217: uint16(122), + 218: uint16(122), + 219: uint16(121), + 220: uint16(121), + 221: uint16(121), + 222: uint16(120), + 223: uint16(117), + 224: uint16(448), + 225: uint16(424), + 226: uint16(318), + 227: uint16(563), + 228: uint16(1193), + 229: uint16(1194), + 230: uint16(1193), + 231: uint16(150), + 232: uint16(1225), + 233: uint16(411), + 234: uint16(1225), + 235: uint16(125), + 236: uint16(125), + 237: uint16(125), + 238: uint16(125), + 239: uint16(123), + 240: uint16(123), + 241: uint16(123), + 242: uint16(123), + 243: uint16(122), + 244: uint16(122), + 245: uint16(121), + 246: uint16(121), + 247: uint16(121), + 248: uint16(120), + 249: uint16(117), + 250: uint16(448), + 251: uint16(469), + 252: uint16(344), + 253: uint16(1041), + 254: uint16(1041), + 255: uint16(1055), + 256: uint16(1058), + 257: uint16(126), + 258: uint16(127), + 259: uint16(81), + 260: uint16(1217), + 261: uint16(1217), + 262: uint16(1054), + 263: uint16(1057), + 264: uint16(1044), + 265: uint16(1044), + 266: uint16(124), + 267: uint16(124), + 268: uint16(125), + 269: uint16(125), + 270: uint16(125), + 271: uint16(125), + 272: uint16(1282), + 273: uint16(526), + 274: uint16(224), + 275: uint16(1193), + 276: uint16(572), + 277: uint16(411), + 278: uint16(226), + 279: uint16(519), + 280: uint16(177), + 281: uint16(83), + 282: uint16(84), + 283: uint16(123), + 284: uint16(123), + 285: uint16(123), + 286: uint16(123), + 287: uint16(122), + 288: uint16(122), + 289: uint16(121), + 290: uint16(121), + 291: uint16(121), + 292: uint16(120), + 293: uint16(117), + 294: uint16(448), + 295: uint16(1010), + 296: uint16(16), + 297: uint16(16), + 298: uint16(1193), + 299: uint16(134), + 300: uint16(134), + 301: uint16(126), + 302: uint16(127), + 303: uint16(81), + 304: uint16(1217), + 305: uint16(1217), + 306: uint16(1054), + 307: uint16(1057), + 308: uint16(1044), + 309: uint16(1044), + 310: uint16(124), + 311: uint16(124), + 312: uint16(125), + 313: uint16(125), + 314: uint16(125), + 315: uint16(125), + 316: uint16(123), + 317: uint16(123), + 318: uint16(123), + 319: uint16(123), + 320: uint16(122), + 321: uint16(122), + 322: uint16(121), + 323: uint16(121), + 324: uint16(121), + 325: uint16(120), + 326: uint16(117), + 327: uint16(448), + 328: uint16(1045), + 329: uint16(550), + 330: uint16(1193), + 331: uint16(375), + 332: uint16(1193), + 333: uint16(1194), + 334: uint16(1193), + 335: uint16(254), + 336: uint16(1438), + 337: uint16(401), + 338: uint16(508), + 339: uint16(505), + 340: uint16(504), + 341: uint16(112), + 342: uint16(564), + 343: uint16(570), + 344: uint16(4), + 345: uint16(929), + 346: uint16(929), + 347: uint16(435), + 348: uint16(503), + 349: uint16(342), + 350: uint16(464), + 351: uint16(330), + 352: uint16(362), + 353: uint16(396), + 354: uint16(1238), + 355: uint16(1193), + 356: uint16(1194), + 357: uint16(1193), + 358: uint16(567), + 359: uint16(572), + 360: uint16(123), + 361: uint16(123), + 362: uint16(123), + 363: uint16(123), + 364: uint16(122), + 365: uint16(122), + 366: uint16(121), + 367: uint16(121), + 368: uint16(121), + 369: uint16(120), + 370: uint16(117), + 371: uint16(448), + 372: uint16(286), + 373: uint16(286), + 374: uint16(371), + 375: uint16(1581), + 376: uint16(1607), + 377: uint16(445), + 378: uint16(444), + 379: uint16(155), + 380: uint16(411), + 381: uint16(449), + 382: uint16(72), + 383: uint16(72), + 384: uint16(1289), + 385: uint16(569), + 386: uint16(1222), + 387: uint16(1193), + 388: uint16(1194), + 389: uint16(1193), + 390: uint16(86), + 391: uint16(1224), + 392: uint16(273), + 393: uint16(561), + 394: uint16(547), + 395: uint16(520), + 396: uint16(520), + 397: uint16(572), + 398: uint16(99), + 399: uint16(1223), + 400: uint16(6), + 401: uint16(1281), + 402: uint16(476), + 403: uint16(143), + 404: uint16(126), + 405: uint16(127), + 406: uint16(81), + 407: uint16(1217), + 408: uint16(1217), + 409: uint16(1054), + 410: uint16(1057), + 411: uint16(1044), + 412: uint16(1044), + 413: uint16(124), + 414: uint16(124), + 415: uint16(125), + 416: uint16(125), + 417: uint16(125), + 418: uint16(125), + 419: uint16(554), + 420: uint16(13), + 421: uint16(13), + 422: uint16(1031), + 423: uint16(511), + 424: uint16(1225), + 425: uint16(1193), + 426: uint16(1225), + 427: uint16(553), + 428: uint16(110), + 429: uint16(110), + 430: uint16(224), + 431: uint16(572), + 432: uint16(1239), + 433: uint16(177), + 434: uint16(572), + 435: uint16(429), + 436: uint16(111), + 437: uint16(199), + 438: uint16(449), + 439: uint16(573), + 440: uint16(449), + 441: uint16(432), + 442: uint16(1555), + 443: uint16(1019), + 444: uint16(327), + 445: uint16(555), + 446: uint16(1193), + 447: uint16(272), + 448: uint16(289), + 449: uint16(370), + 450: uint16(514), + 451: uint16(365), + 452: uint16(513), + 453: uint16(259), + 454: uint16(72), + 455: uint16(72), + 456: uint16(547), + 457: uint16(72), + 458: uint16(72), + 459: uint16(361), + 460: uint16(318), + 461: uint16(563), + 462: uint16(1613), + 463: uint16(123), + 464: uint16(123), + 465: uint16(123), + 466: uint16(123), + 467: uint16(122), + 468: uint16(122), + 469: uint16(121), + 470: uint16(121), + 471: uint16(121), + 472: uint16(120), + 473: uint16(117), + 474: uint16(448), + 475: uint16(1019), + 476: uint16(1019), + 477: uint16(1021), + 478: uint16(1022), + 479: uint16(28), + 480: uint16(286), + 481: uint16(286), + 482: uint16(1193), + 483: uint16(1194), + 484: uint16(1193), + 485: uint16(1159), + 486: uint16(572), + 487: uint16(1612), + 488: uint16(411), + 489: uint16(904), + 490: uint16(192), + 491: uint16(554), + 492: uint16(358), + 493: uint16(569), + 494: uint16(554), + 495: uint16(940), + 496: uint16(537), + 497: uint16(521), + 498: uint16(1159), + 499: uint16(437), + 500: uint16(415), + 501: uint16(1159), + 502: uint16(556), + 503: uint16(1193), + 504: uint16(1194), + 505: uint16(1193), + 506: uint16(572), + 507: uint16(548), + 508: uint16(548), + 509: uint16(52), + 510: uint16(52), + 511: uint16(216), + 512: uint16(126), + 513: uint16(127), + 514: uint16(81), + 515: uint16(1217), + 516: uint16(1217), + 517: uint16(1054), + 518: uint16(1057), + 519: uint16(1044), + 520: uint16(1044), + 521: uint16(124), + 522: uint16(124), + 523: uint16(125), + 524: uint16(125), + 525: uint16(125), + 526: uint16(125), + 527: uint16(1193), + 528: uint16(478), + 529: uint16(136), + 530: uint16(136), + 531: uint16(411), + 532: uint16(286), + 533: uint16(286), + 534: uint16(1493), + 535: uint16(509), + 536: uint16(122), + 537: uint16(122), + 538: uint16(121), + 539: uint16(121), + 540: uint16(121), + 541: uint16(120), + 542: uint16(117), + 543: uint16(448), + 544: uint16(1010), + 545: uint16(569), + 546: uint16(522), + 547: uint16(219), + 548: uint16(545), + 549: uint16(545), + 550: uint16(318), + 551: uint16(563), + 552: uint16(143), + 553: uint16(6), + 554: uint16(536), + 555: uint16(126), + 556: uint16(127), + 557: uint16(81), + 558: uint16(1217), + 559: uint16(1217), + 560: uint16(1054), + 561: uint16(1057), + 562: uint16(1044), + 563: uint16(1044), + 564: uint16(124), + 565: uint16(124), + 566: uint16(125), + 567: uint16(125), + 568: uint16(125), + 569: uint16(125), + 570: uint16(1557), + 571: uint16(123), + 572: uint16(123), + 573: uint16(123), + 574: uint16(123), + 575: uint16(122), + 576: uint16(122), + 577: uint16(121), + 578: uint16(121), + 579: uint16(121), + 580: uint16(120), + 581: uint16(117), + 582: uint16(448), + 583: uint16(489), + 584: uint16(1193), + 585: uint16(1194), + 586: uint16(1193), + 587: uint16(486), + 588: uint16(283), + 589: uint16(1270), + 590: uint16(960), + 591: uint16(254), + 592: uint16(1193), + 593: uint16(375), + 594: uint16(508), + 595: uint16(505), + 596: uint16(504), + 597: uint16(1193), + 598: uint16(342), + 599: uint16(574), + 600: uint16(1193), + 601: uint16(574), + 602: uint16(411), + 603: uint16(294), + 604: uint16(503), + 605: uint16(960), + 606: uint16(879), + 607: uint16(193), + 608: uint16(484), + 609: uint16(318), + 610: uint16(563), + 611: uint16(386), + 612: uint16(292), + 613: uint16(382), + 614: uint16(123), + 615: uint16(123), + 616: uint16(123), + 617: uint16(123), + 618: uint16(122), + 619: uint16(122), + 620: uint16(121), + 621: uint16(121), + 622: uint16(121), + 623: uint16(120), + 624: uint16(117), + 625: uint16(448), + 626: uint16(126), + 627: uint16(127), + 628: uint16(81), + 629: uint16(1217), + 630: uint16(1217), + 631: uint16(1054), + 632: uint16(1057), + 633: uint16(1044), + 634: uint16(1044), + 635: uint16(124), + 636: uint16(124), + 637: uint16(125), + 638: uint16(125), + 639: uint16(125), + 640: uint16(125), + 641: uint16(411), + 642: uint16(396), + 643: uint16(1139), + 644: uint16(1193), + 645: uint16(872), + 646: uint16(101), + 647: uint16(286), + 648: uint16(286), + 649: uint16(1193), + 650: uint16(1194), + 651: uint16(1193), + 652: uint16(375), + 653: uint16(1096), + 654: uint16(1193), + 655: uint16(1194), + 656: uint16(1193), + 657: uint16(1193), + 658: uint16(1194), + 659: uint16(1193), + 660: uint16(569), + 661: uint16(459), + 662: uint16(33), + 663: uint16(375), + 664: uint16(235), + 665: uint16(126), + 666: uint16(127), + 667: uint16(81), + 668: uint16(1217), + 669: uint16(1217), + 670: uint16(1054), + 671: uint16(1057), + 672: uint16(1044), + 673: uint16(1044), + 674: uint16(124), + 675: uint16(124), + 676: uint16(125), + 677: uint16(125), + 678: uint16(125), + 679: uint16(125), + 680: uint16(1437), + 681: uint16(962), + 682: uint16(572), + 683: uint16(230), + 684: uint16(961), + 685: uint16(123), + 686: uint16(123), + 687: uint16(123), + 688: uint16(123), + 689: uint16(122), + 690: uint16(122), + 691: uint16(121), + 692: uint16(121), + 693: uint16(121), + 694: uint16(120), + 695: uint16(117), + 696: uint16(448), + 697: uint16(1159), + 698: uint16(230), + 699: uint16(1193), + 700: uint16(158), + 701: uint16(1193), + 702: uint16(1194), + 703: uint16(1193), + 704: uint16(1556), + 705: uint16(13), + 706: uint16(13), + 707: uint16(303), + 708: uint16(960), + 709: uint16(1233), + 710: uint16(1159), + 711: uint16(154), + 712: uint16(411), + 713: uint16(1159), + 714: uint16(375), + 715: uint16(1584), + 716: uint16(1177), + 717: uint16(5), + 718: uint16(371), + 719: uint16(1581), + 720: uint16(431), + 721: uint16(1239), + 722: uint16(3), + 723: uint16(960), + 724: uint16(123), + 725: uint16(123), + 726: uint16(123), + 727: uint16(123), + 728: uint16(122), + 729: uint16(122), + 730: uint16(121), + 731: uint16(121), + 732: uint16(121), + 733: uint16(120), + 734: uint16(117), + 735: uint16(448), + 736: uint16(126), + 737: uint16(127), + 738: uint16(81), + 739: uint16(1217), + 740: uint16(1217), + 741: uint16(1054), + 742: uint16(1057), + 743: uint16(1044), + 744: uint16(1044), + 745: uint16(124), + 746: uint16(124), + 747: uint16(125), + 748: uint16(125), + 749: uint16(125), + 750: uint16(125), + 751: uint16(411), + 752: uint16(210), + 753: uint16(571), + 754: uint16(1193), + 755: uint16(1032), + 756: uint16(1193), + 757: uint16(1194), + 758: uint16(1193), + 759: uint16(1193), + 760: uint16(390), + 761: uint16(855), + 762: uint16(156), + 763: uint16(1555), + 764: uint16(376), + 765: uint16(404), + 766: uint16(1101), + 767: uint16(1101), + 768: uint16(492), + 769: uint16(572), + 770: uint16(469), + 771: uint16(344), + 772: uint16(1322), + 773: uint16(1322), + 774: uint16(1555), + 775: uint16(126), + 776: uint16(127), + 777: uint16(81), + 778: uint16(1217), + 779: uint16(1217), + 780: uint16(1054), + 781: uint16(1057), + 782: uint16(1044), + 783: uint16(1044), + 784: uint16(124), + 785: uint16(124), + 786: uint16(125), + 787: uint16(125), + 788: uint16(125), + 789: uint16(125), + 790: uint16(130), + 791: uint16(572), + 792: uint16(13), + 793: uint16(13), + 794: uint16(532), + 795: uint16(123), + 796: uint16(123), + 797: uint16(123), + 798: uint16(123), + 799: uint16(122), + 800: uint16(122), + 801: uint16(121), + 802: uint16(121), + 803: uint16(121), + 804: uint16(120), + 805: uint16(117), + 806: uint16(448), + 807: uint16(304), + 808: uint16(572), + 809: uint16(457), + 810: uint16(229), + 811: uint16(1193), + 812: uint16(1194), + 813: uint16(1193), + 814: uint16(13), + 815: uint16(13), + 816: uint16(1193), + 817: uint16(1194), + 818: uint16(1193), + 819: uint16(1300), + 820: uint16(467), + 821: uint16(1270), + 822: uint16(411), + 823: uint16(1320), + 824: uint16(1320), + 825: uint16(1555), + 826: uint16(1015), + 827: uint16(457), + 828: uint16(456), + 829: uint16(436), + 830: uint16(301), + 831: uint16(72), + 832: uint16(72), + 833: uint16(1268), + 834: uint16(123), + 835: uint16(123), + 836: uint16(123), + 837: uint16(123), + 838: uint16(122), + 839: uint16(122), + 840: uint16(121), + 841: uint16(121), + 842: uint16(121), + 843: uint16(120), + 844: uint16(117), + 845: uint16(448), + 846: uint16(126), + 847: uint16(127), + 848: uint16(81), + 849: uint16(1217), + 850: uint16(1217), + 851: uint16(1054), + 852: uint16(1057), + 853: uint16(1044), + 854: uint16(1044), + 855: uint16(124), + 856: uint16(124), + 857: uint16(125), + 858: uint16(125), + 859: uint16(125), + 860: uint16(125), + 861: uint16(411), + 862: uint16(384), + 863: uint16(1076), + 864: uint16(1159), + 865: uint16(286), + 866: uint16(286), + 867: uint16(421), + 868: uint16(314), + 869: uint16(280), + 870: uint16(280), + 871: uint16(287), + 872: uint16(287), + 873: uint16(461), + 874: uint16(408), + 875: uint16(407), + 876: uint16(1539), + 877: uint16(1159), + 878: uint16(569), + 879: uint16(572), + 880: uint16(1159), + 881: uint16(1196), + 882: uint16(569), + 883: uint16(409), + 884: uint16(569), + 885: uint16(126), + 886: uint16(127), + 887: uint16(81), + 888: uint16(1217), + 889: uint16(1217), + 890: uint16(1054), + 891: uint16(1057), + 892: uint16(1044), + 893: uint16(1044), + 894: uint16(124), + 895: uint16(124), + 896: uint16(125), + 897: uint16(125), + 898: uint16(125), + 899: uint16(125), + 900: uint16(457), + 901: uint16(1485), + 902: uint16(13), + 903: uint16(13), + 904: uint16(1541), + 905: uint16(123), + 906: uint16(123), + 907: uint16(123), + 908: uint16(123), + 909: uint16(122), + 910: uint16(122), + 911: uint16(121), + 912: uint16(121), + 913: uint16(121), + 914: uint16(120), + 915: uint16(117), + 916: uint16(448), + 917: uint16(202), + 918: uint16(572), + 919: uint16(462), + 920: uint16(1587), + 921: uint16(578), + 922: uint16(2), + 923: uint16(1248), + 924: uint16(843), + 925: uint16(844), + 926: uint16(845), + 927: uint16(1563), + 928: uint16(319), + 929: uint16(409), + 930: uint16(147), + 931: uint16(6), + 932: uint16(411), + 933: uint16(257), + 934: uint16(256), + 935: uint16(255), + 936: uint16(208), + 937: uint16(1330), + 938: uint16(9), + 939: uint16(1196), + 940: uint16(264), + 941: uint16(72), + 942: uint16(72), + 943: uint16(1436), + 944: uint16(123), + 945: uint16(123), + 946: uint16(123), + 947: uint16(123), + 948: uint16(122), + 949: uint16(122), + 950: uint16(121), + 951: uint16(121), + 952: uint16(121), + 953: uint16(120), + 954: uint16(117), + 955: uint16(448), + 956: uint16(126), + 957: uint16(127), + 958: uint16(81), + 959: uint16(1217), + 960: uint16(1217), + 961: uint16(1054), + 962: uint16(1057), + 963: uint16(1044), + 964: uint16(1044), + 965: uint16(124), + 966: uint16(124), + 967: uint16(125), + 968: uint16(125), + 969: uint16(125), + 970: uint16(125), + 971: uint16(572), + 972: uint16(286), + 973: uint16(286), + 974: uint16(572), + 975: uint16(1213), + 976: uint16(411), + 977: uint16(577), + 978: uint16(315), + 979: uint16(1248), + 980: uint16(421), + 981: uint16(371), + 982: uint16(1581), + 983: uint16(356), + 984: uint16(319), + 985: uint16(569), + 986: uint16(147), + 987: uint16(495), + 988: uint16(529), + 989: uint16(1644), + 990: uint16(397), + 991: uint16(935), + 992: uint16(495), + 993: uint16(1330), + 994: uint16(71), + 995: uint16(71), + 996: uint16(934), + 997: uint16(72), + 998: uint16(72), + 999: uint16(242), + 1000: uint16(1328), + 1001: uint16(105), + 1002: uint16(81), + 1003: uint16(1217), + 1004: uint16(1217), + 1005: uint16(1054), + 1006: uint16(1057), + 1007: uint16(1044), + 1008: uint16(1044), + 1009: uint16(124), + 1010: uint16(124), + 1011: uint16(125), + 1012: uint16(125), + 1013: uint16(125), + 1014: uint16(125), + 1015: uint16(123), + 1016: uint16(123), + 1017: uint16(123), + 1018: uint16(123), + 1019: uint16(122), + 1020: uint16(122), + 1021: uint16(121), + 1022: uint16(121), + 1023: uint16(121), + 1024: uint16(120), + 1025: uint16(117), + 1026: uint16(448), + 1027: uint16(1117), + 1028: uint16(286), + 1029: uint16(286), + 1030: uint16(1422), + 1031: uint16(452), + 1032: uint16(1528), + 1033: uint16(1213), + 1034: uint16(443), + 1035: uint16(286), + 1036: uint16(286), + 1037: uint16(1492), + 1038: uint16(1355), + 1039: uint16(313), + 1040: uint16(478), + 1041: uint16(569), + 1042: uint16(1118), + 1043: uint16(454), + 1044: uint16(351), + 1045: uint16(495), + 1046: uint16(354), + 1047: uint16(1266), + 1048: uint16(569), + 1049: uint16(209), + 1050: uint16(572), + 1051: uint16(418), + 1052: uint16(179), + 1053: uint16(572), + 1054: uint16(1031), + 1055: uint16(242), + 1056: uint16(385), + 1057: uint16(1119), + 1058: uint16(523), + 1059: uint16(123), + 1060: uint16(123), + 1061: uint16(123), + 1062: uint16(123), + 1063: uint16(122), + 1064: uint16(122), + 1065: uint16(121), + 1066: uint16(121), + 1067: uint16(121), + 1068: uint16(120), + 1069: uint16(117), + 1070: uint16(448), + 1071: uint16(1020), + 1072: uint16(108), + 1073: uint16(72), + 1074: uint16(72), + 1075: uint16(1019), + 1076: uint16(13), + 1077: uint16(13), + 1078: uint16(915), + 1079: uint16(572), + 1080: uint16(1498), + 1081: uint16(572), + 1082: uint16(286), + 1083: uint16(286), + 1084: uint16(98), + 1085: uint16(530), + 1086: uint16(1537), + 1087: uint16(452), + 1088: uint16(916), + 1089: uint16(1334), + 1090: uint16(1329), + 1091: uint16(203), + 1092: uint16(411), + 1093: uint16(286), + 1094: uint16(286), + 1095: uint16(569), + 1096: uint16(152), + 1097: uint16(211), + 1098: uint16(1498), + 1099: uint16(1500), + 1100: uint16(426), + 1101: uint16(569), + 1102: uint16(56), + 1103: uint16(56), + 1104: uint16(57), + 1105: uint16(57), + 1106: uint16(569), + 1107: uint16(1019), + 1108: uint16(1019), + 1109: uint16(1021), + 1110: uint16(447), + 1111: uint16(572), + 1112: uint16(411), + 1113: uint16(531), + 1114: uint16(12), + 1115: uint16(297), + 1116: uint16(126), + 1117: uint16(127), + 1118: uint16(81), + 1119: uint16(1217), + 1120: uint16(1217), + 1121: uint16(1054), + 1122: uint16(1057), + 1123: uint16(1044), + 1124: uint16(1044), + 1125: uint16(124), + 1126: uint16(124), + 1127: uint16(125), + 1128: uint16(125), + 1129: uint16(125), + 1130: uint16(125), + 1131: uint16(572), + 1132: uint16(411), + 1133: uint16(867), + 1134: uint16(15), + 1135: uint16(15), + 1136: uint16(126), + 1137: uint16(127), + 1138: uint16(81), + 1139: uint16(1217), + 1140: uint16(1217), + 1141: uint16(1054), + 1142: uint16(1057), + 1143: uint16(1044), + 1144: uint16(1044), + 1145: uint16(124), + 1146: uint16(124), + 1147: uint16(125), + 1148: uint16(125), + 1149: uint16(125), + 1150: uint16(125), + 1151: uint16(373), + 1152: uint16(529), + 1153: uint16(264), + 1154: uint16(44), + 1155: uint16(44), + 1156: uint16(126), + 1157: uint16(115), + 1158: uint16(81), + 1159: uint16(1217), + 1160: uint16(1217), + 1161: uint16(1054), + 1162: uint16(1057), + 1163: uint16(1044), + 1164: uint16(1044), + 1165: uint16(124), + 1166: uint16(124), + 1167: uint16(125), + 1168: uint16(125), + 1169: uint16(125), + 1170: uint16(125), + 1171: uint16(1498), + 1172: uint16(478), + 1173: uint16(1271), + 1174: uint16(417), + 1175: uint16(123), + 1176: uint16(123), + 1177: uint16(123), + 1178: uint16(123), + 1179: uint16(122), + 1180: uint16(122), + 1181: uint16(121), + 1182: uint16(121), + 1183: uint16(121), + 1184: uint16(120), + 1185: uint16(117), + 1186: uint16(448), + 1187: uint16(205), + 1188: uint16(1213), + 1189: uint16(495), + 1190: uint16(430), + 1191: uint16(867), + 1192: uint16(468), + 1193: uint16(322), + 1194: uint16(495), + 1195: uint16(123), + 1196: uint16(123), + 1197: uint16(123), + 1198: uint16(123), + 1199: uint16(122), + 1200: uint16(122), + 1201: uint16(121), + 1202: uint16(121), + 1203: uint16(121), + 1204: uint16(120), + 1205: uint16(117), + 1206: uint16(448), + 1207: uint16(572), + 1208: uint16(557), + 1209: uint16(1140), + 1210: uint16(1642), + 1211: uint16(1422), + 1212: uint16(1642), + 1213: uint16(543), + 1214: uint16(572), + 1215: uint16(123), + 1216: uint16(123), + 1217: uint16(123), + 1218: uint16(123), + 1219: uint16(122), + 1220: uint16(122), + 1221: uint16(121), + 1222: uint16(121), + 1223: uint16(121), + 1224: uint16(120), + 1225: uint16(117), + 1226: uint16(448), + 1227: uint16(572), + 1228: uint16(1422), + 1229: uint16(572), + 1230: uint16(13), + 1231: uint16(13), + 1232: uint16(542), + 1233: uint16(323), + 1234: uint16(1325), + 1235: uint16(411), + 1236: uint16(334), + 1237: uint16(58), + 1238: uint16(58), + 1239: uint16(349), + 1240: uint16(1422), + 1241: uint16(1170), + 1242: uint16(326), + 1243: uint16(286), + 1244: uint16(286), + 1245: uint16(549), + 1246: uint16(1213), + 1247: uint16(300), + 1248: uint16(895), + 1249: uint16(530), + 1250: uint16(45), + 1251: uint16(45), + 1252: uint16(59), + 1253: uint16(59), + 1254: uint16(1140), + 1255: uint16(1643), + 1256: uint16(569), + 1257: uint16(1643), + 1258: uint16(565), + 1259: uint16(417), + 1260: uint16(127), + 1261: uint16(81), + 1262: uint16(1217), + 1263: uint16(1217), + 1264: uint16(1054), + 1265: uint16(1057), + 1266: uint16(1044), + 1267: uint16(1044), + 1268: uint16(124), + 1269: uint16(124), + 1270: uint16(125), + 1271: uint16(125), + 1272: uint16(125), + 1273: uint16(125), + 1274: uint16(1367), + 1275: uint16(373), + 1276: uint16(500), + 1277: uint16(290), + 1278: uint16(1193), + 1279: uint16(512), + 1280: uint16(1366), + 1281: uint16(427), + 1282: uint16(394), + 1283: uint16(394), + 1284: uint16(393), + 1285: uint16(275), + 1286: uint16(391), + 1287: uint16(896), + 1288: uint16(1138), + 1289: uint16(852), + 1290: uint16(478), + 1291: uint16(258), + 1292: uint16(1422), + 1293: uint16(1170), + 1294: uint16(463), + 1295: uint16(1159), + 1296: uint16(12), + 1297: uint16(331), + 1298: uint16(428), + 1299: uint16(333), + 1300: uint16(1117), + 1301: uint16(460), + 1302: uint16(236), + 1303: uint16(258), + 1304: uint16(325), + 1305: uint16(460), + 1306: uint16(544), + 1307: uint16(1544), + 1308: uint16(1159), + 1309: uint16(1098), + 1310: uint16(491), + 1311: uint16(1159), + 1312: uint16(324), + 1313: uint16(1098), + 1314: uint16(440), + 1315: uint16(1118), + 1316: uint16(335), + 1317: uint16(516), + 1318: uint16(123), + 1319: uint16(123), + 1320: uint16(123), + 1321: uint16(123), + 1322: uint16(122), + 1323: uint16(122), + 1324: uint16(121), + 1325: uint16(121), + 1326: uint16(121), + 1327: uint16(120), + 1328: uint16(117), + 1329: uint16(448), + 1330: uint16(1119), + 1331: uint16(318), + 1332: uint16(563), + 1333: uint16(1138), + 1334: uint16(572), + 1335: uint16(1193), + 1336: uint16(1194), + 1337: uint16(1193), + 1338: uint16(112), + 1339: uint16(564), + 1340: uint16(201), + 1341: uint16(4), + 1342: uint16(238), + 1343: uint16(433), + 1344: uint16(935), + 1345: uint16(490), + 1346: uint16(285), + 1347: uint16(228), + 1348: uint16(1517), + 1349: uint16(934), + 1350: uint16(170), + 1351: uint16(560), + 1352: uint16(572), + 1353: uint16(142), + 1354: uint16(1516), + 1355: uint16(567), + 1356: uint16(572), + 1357: uint16(60), + 1358: uint16(60), + 1359: uint16(572), + 1360: uint16(416), + 1361: uint16(572), + 1362: uint16(441), + 1363: uint16(572), + 1364: uint16(535), + 1365: uint16(302), + 1366: uint16(875), + 1367: uint16(8), + 1368: uint16(487), + 1369: uint16(572), + 1370: uint16(237), + 1371: uint16(572), + 1372: uint16(416), + 1373: uint16(572), + 1374: uint16(485), + 1375: uint16(61), + 1376: uint16(61), + 1377: uint16(572), + 1378: uint16(449), + 1379: uint16(62), + 1380: uint16(62), + 1381: uint16(332), + 1382: uint16(63), + 1383: uint16(63), + 1384: uint16(46), + 1385: uint16(46), + 1386: uint16(47), + 1387: uint16(47), + 1388: uint16(361), + 1389: uint16(572), + 1390: uint16(561), + 1391: uint16(572), + 1392: uint16(48), + 1393: uint16(48), + 1394: uint16(50), + 1395: uint16(50), + 1396: uint16(51), + 1397: uint16(51), + 1398: uint16(572), + 1399: uint16(295), + 1400: uint16(64), + 1401: uint16(64), + 1402: uint16(482), + 1403: uint16(295), + 1404: uint16(539), + 1405: uint16(412), + 1406: uint16(471), + 1407: uint16(1031), + 1408: uint16(572), + 1409: uint16(538), + 1410: uint16(318), + 1411: uint16(563), + 1412: uint16(65), + 1413: uint16(65), + 1414: uint16(66), + 1415: uint16(66), + 1416: uint16(409), + 1417: uint16(475), + 1418: uint16(572), + 1419: uint16(1031), + 1420: uint16(572), + 1421: uint16(14), + 1422: uint16(14), + 1423: uint16(875), + 1424: uint16(1020), + 1425: uint16(110), + 1426: uint16(110), + 1427: uint16(409), + 1428: uint16(1019), + 1429: uint16(572), + 1430: uint16(474), + 1431: uint16(67), + 1432: uint16(67), + 1433: uint16(111), + 1434: uint16(455), + 1435: uint16(449), + 1436: uint16(573), + 1437: uint16(449), + 1438: uint16(98), + 1439: uint16(317), + 1440: uint16(1019), + 1441: uint16(132), + 1442: uint16(132), + 1443: uint16(133), + 1444: uint16(133), + 1445: uint16(572), + 1446: uint16(1561), + 1447: uint16(572), + 1448: uint16(974), + 1449: uint16(409), + 1450: uint16(6), + 1451: uint16(1562), + 1452: uint16(68), + 1453: uint16(68), + 1454: uint16(1560), + 1455: uint16(6), + 1456: uint16(975), + 1457: uint16(572), + 1458: uint16(6), + 1459: uint16(1559), + 1460: uint16(1019), + 1461: uint16(1019), + 1462: uint16(1021), + 1463: uint16(6), + 1464: uint16(346), + 1465: uint16(218), + 1466: uint16(101), + 1467: uint16(531), + 1468: uint16(53), + 1469: uint16(53), + 1470: uint16(69), + 1471: uint16(69), + 1472: uint16(1019), + 1473: uint16(1019), + 1474: uint16(1021), + 1475: uint16(1022), + 1476: uint16(28), + 1477: uint16(1586), + 1478: uint16(1181), + 1479: uint16(451), + 1480: uint16(70), + 1481: uint16(70), + 1482: uint16(290), + 1483: uint16(87), + 1484: uint16(215), + 1485: uint16(31), + 1486: uint16(1363), + 1487: uint16(394), + 1488: uint16(394), + 1489: uint16(393), + 1490: uint16(275), + 1491: uint16(391), + 1492: uint16(350), + 1493: uint16(109), + 1494: uint16(852), + 1495: uint16(107), + 1496: uint16(572), + 1497: uint16(112), + 1498: uint16(564), + 1499: uint16(483), + 1500: uint16(4), + 1501: uint16(1212), + 1502: uint16(572), + 1503: uint16(239), + 1504: uint16(153), + 1505: uint16(572), + 1506: uint16(39), + 1507: uint16(236), + 1508: uint16(1299), + 1509: uint16(325), + 1510: uint16(112), + 1511: uint16(564), + 1512: uint16(1298), + 1513: uint16(4), + 1514: uint16(567), + 1515: uint16(572), + 1516: uint16(32), + 1517: uint16(324), + 1518: uint16(572), + 1519: uint16(54), + 1520: uint16(54), + 1521: uint16(572), + 1522: uint16(1135), + 1523: uint16(353), + 1524: uint16(398), + 1525: uint16(165), + 1526: uint16(165), + 1527: uint16(567), + 1528: uint16(166), + 1529: uint16(166), + 1530: uint16(572), + 1531: uint16(291), + 1532: uint16(355), + 1533: uint16(572), + 1534: uint16(17), + 1535: uint16(357), + 1536: uint16(572), + 1537: uint16(449), + 1538: uint16(77), + 1539: uint16(77), + 1540: uint16(1313), + 1541: uint16(55), + 1542: uint16(55), + 1543: uint16(1297), + 1544: uint16(73), + 1545: uint16(73), + 1546: uint16(572), + 1547: uint16(238), + 1548: uint16(470), + 1549: uint16(561), + 1550: uint16(449), + 1551: uint16(472), + 1552: uint16(364), + 1553: uint16(135), + 1554: uint16(135), + 1555: uint16(170), + 1556: uint16(74), + 1557: uint16(74), + 1558: uint16(142), + 1559: uint16(163), + 1560: uint16(163), + 1561: uint16(374), + 1562: uint16(561), + 1563: uint16(539), + 1564: uint16(572), + 1565: uint16(321), + 1566: uint16(572), + 1567: uint16(886), + 1568: uint16(540), + 1569: uint16(137), + 1570: uint16(137), + 1571: uint16(339), + 1572: uint16(1353), + 1573: uint16(422), + 1574: uint16(298), + 1575: uint16(237), + 1576: uint16(539), + 1577: uint16(572), + 1578: uint16(1031), + 1579: uint16(572), + 1580: uint16(340), + 1581: uint16(538), + 1582: uint16(101), + 1583: uint16(369), + 1584: uint16(110), + 1585: uint16(110), + 1586: uint16(162), + 1587: uint16(131), + 1588: uint16(131), + 1589: uint16(164), + 1590: uint16(164), + 1591: uint16(1031), + 1592: uint16(111), + 1593: uint16(368), + 1594: uint16(449), + 1595: uint16(573), + 1596: uint16(449), + 1597: uint16(110), + 1598: uint16(110), + 1599: uint16(1019), + 1600: uint16(157), + 1601: uint16(157), + 1602: uint16(141), + 1603: uint16(141), + 1604: uint16(572), + 1605: uint16(111), + 1606: uint16(572), + 1607: uint16(449), + 1608: uint16(573), + 1609: uint16(449), + 1610: uint16(412), + 1611: uint16(288), + 1612: uint16(1019), + 1613: uint16(572), + 1614: uint16(882), + 1615: uint16(318), + 1616: uint16(563), + 1617: uint16(572), + 1618: uint16(219), + 1619: uint16(572), + 1620: uint16(241), + 1621: uint16(1012), + 1622: uint16(477), + 1623: uint16(263), + 1624: uint16(263), + 1625: uint16(894), + 1626: uint16(893), + 1627: uint16(140), + 1628: uint16(140), + 1629: uint16(138), + 1630: uint16(138), + 1631: uint16(1019), + 1632: uint16(1019), + 1633: uint16(1021), + 1634: uint16(1022), + 1635: uint16(28), + 1636: uint16(139), + 1637: uint16(139), + 1638: uint16(525), + 1639: uint16(455), + 1640: uint16(76), + 1641: uint16(76), + 1642: uint16(78), + 1643: uint16(78), + 1644: uint16(1019), + 1645: uint16(1019), + 1646: uint16(1021), + 1647: uint16(1022), + 1648: uint16(28), + 1649: uint16(1181), + 1650: uint16(451), + 1651: uint16(572), + 1652: uint16(1083), + 1653: uint16(290), + 1654: uint16(112), + 1655: uint16(564), + 1656: uint16(1575), + 1657: uint16(4), + 1658: uint16(394), + 1659: uint16(394), + 1660: uint16(393), + 1661: uint16(275), + 1662: uint16(391), + 1663: uint16(572), + 1664: uint16(1023), + 1665: uint16(852), + 1666: uint16(572), + 1667: uint16(479), + 1668: uint16(345), + 1669: uint16(263), + 1670: uint16(101), + 1671: uint16(567), + 1672: uint16(882), + 1673: uint16(1376), + 1674: uint16(75), + 1675: uint16(75), + 1676: uint16(1421), + 1677: uint16(501), + 1678: uint16(236), + 1679: uint16(260), + 1680: uint16(325), + 1681: uint16(112), + 1682: uint16(564), + 1683: uint16(359), + 1684: uint16(4), + 1685: uint16(101), + 1686: uint16(43), + 1687: uint16(43), + 1688: uint16(324), + 1689: uint16(49), + 1690: uint16(49), + 1691: uint16(901), + 1692: uint16(902), + 1693: uint16(161), + 1694: uint16(449), + 1695: uint16(101), + 1696: uint16(977), + 1697: uint16(978), + 1698: uint16(567), + 1699: uint16(1079), + 1700: uint16(1349), + 1701: uint16(260), + 1702: uint16(965), + 1703: uint16(932), + 1704: uint16(263), + 1705: uint16(114), + 1706: uint16(561), + 1707: uint16(1095), + 1708: uint16(517), + 1709: uint16(1095), + 1710: uint16(1083), + 1711: uint16(1094), + 1712: uint16(865), + 1713: uint16(1094), + 1714: uint16(151), + 1715: uint16(933), + 1716: uint16(1144), + 1717: uint16(114), + 1718: uint16(238), + 1719: uint16(1361), + 1720: uint16(558), + 1721: uint16(449), + 1722: uint16(1023), + 1723: uint16(559), + 1724: uint16(1426), + 1725: uint16(1278), + 1726: uint16(170), + 1727: uint16(1269), + 1728: uint16(1257), + 1729: uint16(142), + 1730: uint16(1601), + 1731: uint16(1256), + 1732: uint16(1258), + 1733: uint16(561), + 1734: uint16(1594), + 1735: uint16(1031), + 1736: uint16(496), + 1737: uint16(278), + 1738: uint16(213), + 1739: uint16(1346), + 1740: uint16(310), + 1741: uint16(110), + 1742: uint16(110), + 1743: uint16(939), + 1744: uint16(311), + 1745: uint16(312), + 1746: uint16(237), + 1747: uint16(11), + 1748: uint16(234), + 1749: uint16(111), + 1750: uint16(221), + 1751: uint16(449), + 1752: uint16(573), + 1753: uint16(449), + 1754: uint16(293), + 1755: uint16(395), + 1756: uint16(1019), + 1757: uint16(1408), + 1758: uint16(337), + 1759: uint16(1403), + 1760: uint16(1396), + 1761: uint16(338), + 1762: uint16(1031), + 1763: uint16(299), + 1764: uint16(343), + 1765: uint16(1413), + 1766: uint16(1412), + 1767: uint16(481), + 1768: uint16(110), + 1769: uint16(110), + 1770: uint16(506), + 1771: uint16(402), + 1772: uint16(225), + 1773: uint16(1296), + 1774: uint16(206), + 1775: uint16(367), + 1776: uint16(111), + 1777: uint16(1358), + 1778: uint16(449), + 1779: uint16(573), + 1780: uint16(449), + 1781: uint16(412), + 1782: uint16(1359), + 1783: uint16(1019), + 1784: uint16(1489), + 1785: uint16(1488), + 1786: uint16(318), + 1787: uint16(563), + 1788: uint16(1019), + 1789: uint16(1019), + 1790: uint16(1021), + 1791: uint16(1022), + 1792: uint16(28), + 1793: uint16(562), + 1794: uint16(207), + 1795: uint16(220), + 1796: uint16(80), + 1797: uint16(564), + 1798: uint16(389), + 1799: uint16(4), + 1800: uint16(1597), + 1801: uint16(1357), + 1802: uint16(552), + 1803: uint16(1356), + 1804: uint16(1233), + 1805: uint16(181), + 1806: uint16(267), + 1807: uint16(232), + 1808: uint16(1536), + 1809: uint16(1534), + 1810: uint16(455), + 1811: uint16(1230), + 1812: uint16(420), + 1813: uint16(567), + 1814: uint16(82), + 1815: uint16(1019), + 1816: uint16(1019), + 1817: uint16(1021), + 1818: uint16(1022), + 1819: uint16(28), + 1820: uint16(86), + 1821: uint16(217), + 1822: uint16(85), + 1823: uint16(1494), + 1824: uint16(190), + 1825: uint16(175), + 1826: uint16(183), + 1827: uint16(465), + 1828: uint16(185), + 1829: uint16(466), + 1830: uint16(36), + 1831: uint16(1409), + 1832: uint16(186), + 1833: uint16(187), + 1834: uint16(188), + 1835: uint16(499), + 1836: uint16(449), + 1837: uint16(244), + 1838: uint16(37), + 1839: uint16(99), + 1840: uint16(400), + 1841: uint16(1415), + 1842: uint16(1414), + 1843: uint16(488), + 1844: uint16(1417), + 1845: uint16(194), + 1846: uint16(473), + 1847: uint16(403), + 1848: uint16(561), + 1849: uint16(1483), + 1850: uint16(248), + 1851: uint16(92), + 1852: uint16(1505), + 1853: uint16(494), + 1854: uint16(198), + 1855: uint16(279), + 1856: uint16(112), + 1857: uint16(564), + 1858: uint16(250), + 1859: uint16(4), + 1860: uint16(348), + 1861: uint16(497), + 1862: uint16(405), + 1863: uint16(352), + 1864: uint16(1259), + 1865: uint16(251), + 1866: uint16(252), + 1867: uint16(515), + 1868: uint16(1316), + 1869: uint16(434), + 1870: uint16(1315), + 1871: uint16(1314), + 1872: uint16(94), + 1873: uint16(567), + 1874: uint16(1307), + 1875: uint16(886), + 1876: uint16(1306), + 1877: uint16(1031), + 1878: uint16(226), + 1879: uint16(406), + 1880: uint16(1611), + 1881: uint16(1610), + 1882: uint16(438), + 1883: uint16(110), + 1884: uint16(110), + 1885: uint16(1580), + 1886: uint16(1286), + 1887: uint16(524), + 1888: uint16(439), + 1889: uint16(308), + 1890: uint16(266), + 1891: uint16(111), + 1892: uint16(1285), + 1893: uint16(449), + 1894: uint16(573), + 1895: uint16(449), + 1896: uint16(449), + 1897: uint16(309), + 1898: uint16(1019), + 1899: uint16(366), + 1900: uint16(1284), + 1901: uint16(1609), + 1902: uint16(265), + 1903: uint16(1566), + 1904: uint16(1565), + 1905: uint16(442), + 1906: uint16(372), + 1907: uint16(1381), + 1908: uint16(561), + 1909: uint16(129), + 1910: uint16(550), + 1911: uint16(1380), + 1912: uint16(10), + 1913: uint16(1470), + 1914: uint16(383), + 1915: uint16(106), + 1916: uint16(316), + 1917: uint16(551), + 1918: uint16(100), + 1919: uint16(35), + 1920: uint16(534), + 1921: uint16(575), + 1922: uint16(212), + 1923: uint16(1339), + 1924: uint16(381), + 1925: uint16(387), + 1926: uint16(1187), + 1927: uint16(1338), + 1928: uint16(274), + 1929: uint16(276), + 1930: uint16(1019), + 1931: uint16(1019), + 1932: uint16(1021), + 1933: uint16(1022), + 1934: uint16(28), + 1935: uint16(277), + 1936: uint16(413), + 1937: uint16(1031), + 1938: uint16(576), + 1939: uint16(1254), + 1940: uint16(388), + 1941: uint16(1521), + 1942: uint16(1249), + 1943: uint16(110), + 1944: uint16(110), + 1945: uint16(167), + 1946: uint16(1522), + 1947: uint16(168), + 1948: uint16(148), + 1949: uint16(1520), + 1950: uint16(1519), + 1951: uint16(111), + 1952: uint16(306), + 1953: uint16(449), + 1954: uint16(573), + 1955: uint16(449), + 1956: uint16(222), + 1957: uint16(223), + 1958: uint16(1019), + 1959: uint16(839), + 1960: uint16(169), + 1961: uint16(79), + 1962: uint16(450), + 1963: uint16(214), + 1964: uint16(414), + 1965: uint16(233), + 1966: uint16(320), + 1967: uint16(145), + 1968: uint16(1093), + 1969: uint16(1091), + 1970: uint16(328), + 1971: uint16(182), + 1972: uint16(171), + 1973: uint16(1212), + 1974: uint16(918), + 1975: uint16(184), + 1976: uint16(240), + 1977: uint16(336), + 1978: uint16(243), + 1979: uint16(1107), + 1980: uint16(189), + 1981: uint16(172), + 1982: uint16(173), + 1983: uint16(423), + 1984: uint16(425), + 1985: uint16(88), + 1986: uint16(180), + 1987: uint16(191), + 1988: uint16(89), + 1989: uint16(90), + 1990: uint16(1019), + 1991: uint16(1019), + 1992: uint16(1021), + 1993: uint16(1022), + 1994: uint16(28), + 1995: uint16(91), + 1996: uint16(174), + 1997: uint16(1110), + 1998: uint16(245), + 1999: uint16(1106), + 2000: uint16(246), + 2001: uint16(159), + 2002: uint16(18), + 2003: uint16(247), + 2004: uint16(347), + 2005: uint16(1099), + 2006: uint16(263), + 2007: uint16(195), + 2008: uint16(1227), + 2009: uint16(493), + 2010: uint16(249), + 2011: uint16(196), + 2012: uint16(38), + 2013: uint16(854), + 2014: uint16(498), + 2015: uint16(368), + 2016: uint16(253), + 2017: uint16(360), + 2018: uint16(897), + 2019: uint16(197), + 2020: uint16(502), + 2021: uint16(93), + 2022: uint16(19), + 2023: uint16(20), + 2024: uint16(507), + 2025: uint16(884), + 2026: uint16(363), + 2027: uint16(510), + 2028: uint16(95), + 2029: uint16(307), + 2030: uint16(160), + 2031: uint16(96), + 2032: uint16(518), + 2033: uint16(97), + 2034: uint16(1175), + 2035: uint16(1060), + 2036: uint16(1146), + 2037: uint16(40), + 2038: uint16(21), + 2039: uint16(227), + 2040: uint16(176), + 2041: uint16(1145), + 2042: uint16(282), + 2043: uint16(284), + 2044: uint16(969), + 2045: uint16(200), + 2046: uint16(963), + 2047: uint16(114), + 2048: uint16(262), + 2049: uint16(1165), + 2050: uint16(22), + 2051: uint16(23), + 2052: uint16(24), + 2053: uint16(1161), + 2054: uint16(1169), + 2055: uint16(25), + 2056: uint16(1163), + 2057: uint16(1150), + 2058: uint16(34), + 2059: uint16(26), + 2060: uint16(1168), + 2061: uint16(546), + 2062: uint16(27), + 2063: uint16(204), + 2064: uint16(101), + 2065: uint16(103), + 2066: uint16(104), + 2067: uint16(1074), + 2068: uint16(7), + 2069: uint16(1061), + 2070: uint16(1059), + 2071: uint16(1063), + 2072: uint16(1116), + 2073: uint16(1064), + 2074: uint16(1115), + 2075: uint16(268), + 2076: uint16(269), + 2077: uint16(29), + 2078: uint16(41), + 2079: uint16(270), + 2080: uint16(1024), + 2081: uint16(866), + 2082: uint16(113), + 2083: uint16(30), + 2084: uint16(568), + 2085: uint16(392), + 2086: uint16(1183), + 2087: uint16(144), + 2088: uint16(178), + 2089: uint16(1182), + 2090: uint16(271), + 2091: uint16(928), + 2092: uint16(1245), + 2093: uint16(1245), + 2094: uint16(1245), + 2095: uint16(1245), + 2096: uint16(1245), + 2097: uint16(1245), + 2098: uint16(1245), + 2099: uint16(1602), +} +var _yy_lookahead = [2285]uint16{ + 0: uint16(193), + 1: uint16(193), + 2: uint16(193), + 3: uint16(274), + 4: uint16(275), + 5: uint16(276), + 6: uint16(193), + 7: uint16(274), + 8: uint16(275), + 9: uint16(276), + 10: uint16(193), + 11: uint16(223), + 12: uint16(219), + 13: uint16(225), + 14: uint16(206), + 15: uint16(210), + 16: uint16(211), + 17: uint16(212), + 18: uint16(193), + 19: uint16(19), + 20: uint16(219), + 21: uint16(233), + 22: uint16(216), + 23: uint16(216), + 24: uint16(217), + 25: uint16(216), + 26: uint16(217), + 27: uint16(193), + 28: uint16(295), + 29: uint16(216), + 30: uint16(217), + 31: uint16(31), + 32: uint16(193), + 33: uint16(216), + 34: uint16(217), + 35: uint16(193), + 36: uint16(228), + 37: uint16(213), + 38: uint16(230), + 39: uint16(39), + 40: uint16(206), + 41: uint16(216), + 42: uint16(217), + 43: uint16(43), + 44: uint16(44), + 45: uint16(45), + 46: uint16(46), + 47: uint16(47), + 48: uint16(48), + 49: uint16(49), + 50: uint16(50), + 51: uint16(51), + 52: uint16(52), + 53: uint16(53), + 54: uint16(54), + 55: uint16(55), + 56: uint16(56), + 57: uint16(57), + 58: uint16(193), + 59: uint16(19), + 60: uint16(185), + 61: uint16(186), + 62: uint16(187), + 63: uint16(188), + 64: uint16(189), + 65: uint16(190), + 66: uint16(253), + 67: uint16(274), + 68: uint16(275), + 69: uint16(276), + 70: uint16(195), + 71: uint16(193), + 72: uint16(197), + 73: uint16(193), + 74: uint16(261), + 75: uint16(274), + 76: uint16(275), + 77: uint16(276), + 78: uint16(253), + 79: uint16(204), + 80: uint16(238), + 81: uint16(204), + 82: uint16(81), + 83: uint16(43), + 84: uint16(44), + 85: uint16(45), + 86: uint16(46), + 87: uint16(47), + 88: uint16(48), + 89: uint16(49), + 90: uint16(50), + 91: uint16(51), + 92: uint16(52), + 93: uint16(53), + 94: uint16(54), + 95: uint16(55), + 96: uint16(56), + 97: uint16(57), + 98: uint16(274), + 99: uint16(275), + 100: uint16(276), + 101: uint16(262), + 102: uint16(102), + 103: uint16(103), + 104: uint16(104), + 105: uint16(105), + 106: uint16(106), + 107: uint16(107), + 108: uint16(108), + 109: uint16(109), + 110: uint16(110), + 111: uint16(111), + 112: uint16(112), + 113: uint16(113), + 114: uint16(239), + 115: uint16(240), + 116: uint16(239), + 117: uint16(240), + 118: uint16(210), + 119: uint16(211), + 120: uint16(212), + 121: uint16(314), + 122: uint16(315), + 123: uint16(314), + 124: uint16(59), + 125: uint16(316), + 126: uint16(86), + 127: uint16(252), + 128: uint16(88), + 129: uint16(252), + 130: uint16(19), + 131: uint16(314), + 132: uint16(315), + 133: uint16(256), + 134: uint16(257), + 135: uint16(113), + 136: uint16(25), + 137: uint16(72), + 138: uint16(296), + 139: uint16(138), + 140: uint16(139), + 141: uint16(266), + 142: uint16(102), + 143: uint16(103), + 144: uint16(104), + 145: uint16(105), + 146: uint16(106), + 147: uint16(107), + 148: uint16(108), + 149: uint16(109), + 150: uint16(110), + 151: uint16(111), + 152: uint16(112), + 153: uint16(113), + 154: uint16(43), + 155: uint16(44), + 156: uint16(45), + 157: uint16(46), + 158: uint16(47), + 159: uint16(48), + 160: uint16(49), + 161: uint16(50), + 162: uint16(51), + 163: uint16(52), + 164: uint16(53), + 165: uint16(54), + 166: uint16(55), + 167: uint16(56), + 168: uint16(57), + 169: uint16(81), + 170: uint16(292), + 171: uint16(59), + 172: uint16(292), + 173: uint16(298), + 174: uint16(108), + 175: uint16(109), + 176: uint16(110), + 177: uint16(111), + 178: uint16(112), + 179: uint16(113), + 180: uint16(69), + 181: uint16(116), + 182: uint16(117), + 183: uint16(118), + 184: uint16(72), + 185: uint16(106), + 186: uint16(107), + 187: uint16(193), + 188: uint16(111), + 189: uint16(112), + 190: uint16(113), + 191: uint16(54), + 192: uint16(55), + 193: uint16(56), + 194: uint16(57), + 195: uint16(58), + 196: uint16(102), + 197: uint16(103), + 198: uint16(104), + 199: uint16(105), + 200: uint16(106), + 201: uint16(107), + 202: uint16(108), + 203: uint16(109), + 204: uint16(110), + 205: uint16(111), + 206: uint16(112), + 207: uint16(113), + 208: uint16(120), + 209: uint16(25), + 210: uint16(216), + 211: uint16(217), + 212: uint16(145), + 213: uint16(102), + 214: uint16(103), + 215: uint16(104), + 216: uint16(105), + 217: uint16(106), + 218: uint16(107), + 219: uint16(108), + 220: uint16(109), + 221: uint16(110), + 222: uint16(111), + 223: uint16(112), + 224: uint16(113), + 225: uint16(231), + 226: uint16(138), + 227: uint16(139), + 228: uint16(116), + 229: uint16(117), + 230: uint16(118), + 231: uint16(164), + 232: uint16(153), + 233: uint16(19), + 234: uint16(155), + 235: uint16(54), + 236: uint16(55), + 237: uint16(56), + 238: uint16(57), + 239: uint16(102), + 240: uint16(103), + 241: uint16(104), + 242: uint16(105), + 243: uint16(106), + 244: uint16(107), + 245: uint16(108), + 246: uint16(109), + 247: uint16(110), + 248: uint16(111), + 249: uint16(112), + 250: uint16(113), + 251: uint16(128), + 252: uint16(129), + 253: uint16(46), + 254: uint16(47), + 255: uint16(48), + 256: uint16(49), + 257: uint16(43), + 258: uint16(44), + 259: uint16(45), + 260: uint16(46), + 261: uint16(47), + 262: uint16(48), + 263: uint16(49), + 264: uint16(50), + 265: uint16(51), + 266: uint16(52), + 267: uint16(53), + 268: uint16(54), + 269: uint16(55), + 270: uint16(56), + 271: uint16(57), + 272: uint16(216), + 273: uint16(193), + 274: uint16(25), + 275: uint16(59), + 276: uint16(193), + 277: uint16(19), + 278: uint16(165), + 279: uint16(166), + 280: uint16(193), + 281: uint16(67), + 282: uint16(24), + 283: uint16(102), + 284: uint16(103), + 285: uint16(104), + 286: uint16(105), + 287: uint16(106), + 288: uint16(107), + 289: uint16(108), + 290: uint16(109), + 291: uint16(110), + 292: uint16(111), + 293: uint16(112), + 294: uint16(113), + 295: uint16(73), + 296: uint16(216), + 297: uint16(217), + 298: uint16(59), + 299: uint16(216), + 300: uint16(217), + 301: uint16(43), + 302: uint16(44), + 303: uint16(45), + 304: uint16(46), + 305: uint16(47), + 306: uint16(48), + 307: uint16(49), + 308: uint16(50), + 309: uint16(51), + 310: uint16(52), + 311: uint16(53), + 312: uint16(54), + 313: uint16(55), + 314: uint16(56), + 315: uint16(57), + 316: uint16(102), + 317: uint16(103), + 318: uint16(104), + 319: uint16(105), + 320: uint16(106), + 321: uint16(107), + 322: uint16(108), + 323: uint16(109), + 324: uint16(110), + 325: uint16(111), + 326: uint16(112), + 327: uint16(113), + 328: uint16(121), + 329: uint16(145), + 330: uint16(59), + 331: uint16(193), + 332: uint16(116), + 333: uint16(117), + 334: uint16(118), + 335: uint16(119), + 336: uint16(273), + 337: uint16(204), + 338: uint16(122), + 339: uint16(123), + 340: uint16(124), + 341: uint16(19), + 342: uint16(20), + 343: uint16(134), + 344: uint16(22), + 345: uint16(136), + 346: uint16(137), + 347: uint16(19), + 348: uint16(132), + 349: uint16(127), + 350: uint16(128), + 351: uint16(129), + 352: uint16(24), + 353: uint16(22), + 354: uint16(23), + 355: uint16(116), + 356: uint16(117), + 357: uint16(118), + 358: uint16(36), + 359: uint16(193), + 360: uint16(102), + 361: uint16(103), + 362: uint16(104), + 363: uint16(105), + 364: uint16(106), + 365: uint16(107), + 366: uint16(108), + 367: uint16(109), + 368: uint16(110), + 369: uint16(111), + 370: uint16(112), + 371: uint16(113), + 372: uint16(239), + 373: uint16(240), + 374: uint16(311), + 375: uint16(312), + 376: uint16(215), + 377: uint16(106), + 378: uint16(107), + 379: uint16(241), + 380: uint16(19), + 381: uint16(59), + 382: uint16(216), + 383: uint16(217), + 384: uint16(223), + 385: uint16(252), + 386: uint16(115), + 387: uint16(116), + 388: uint16(117), + 389: uint16(118), + 390: uint16(151), + 391: uint16(120), + 392: uint16(26), + 393: uint16(71), + 394: uint16(193), + 395: uint16(308), + 396: uint16(309), + 397: uint16(193), + 398: uint16(149), + 399: uint16(128), + 400: uint16(313), + 401: uint16(216), + 402: uint16(269), + 403: uint16(81), + 404: uint16(43), + 405: uint16(44), + 406: uint16(45), + 407: uint16(46), + 408: uint16(47), + 409: uint16(48), + 410: uint16(49), + 411: uint16(50), + 412: uint16(51), + 413: uint16(52), + 414: uint16(53), + 415: uint16(54), + 416: uint16(55), + 417: uint16(56), + 418: uint16(57), + 419: uint16(253), + 420: uint16(216), + 421: uint16(217), + 422: uint16(100), + 423: uint16(95), + 424: uint16(153), + 425: uint16(59), + 426: uint16(155), + 427: uint16(261), + 428: uint16(106), + 429: uint16(107), + 430: uint16(25), + 431: uint16(193), + 432: uint16(101), + 433: uint16(193), + 434: uint16(193), + 435: uint16(231), + 436: uint16(114), + 437: uint16(25), + 438: uint16(116), + 439: uint16(117), + 440: uint16(118), + 441: uint16(113), + 442: uint16(304), + 443: uint16(121), + 444: uint16(193), + 445: uint16(204), + 446: uint16(59), + 447: uint16(119), + 448: uint16(120), + 449: uint16(121), + 450: uint16(122), + 451: uint16(123), + 452: uint16(124), + 453: uint16(125), + 454: uint16(216), + 455: uint16(217), + 456: uint16(193), + 457: uint16(216), + 458: uint16(217), + 459: uint16(131), + 460: uint16(138), + 461: uint16(139), + 462: uint16(230), + 463: uint16(102), + 464: uint16(103), + 465: uint16(104), + 466: uint16(105), + 467: uint16(106), + 468: uint16(107), + 469: uint16(108), + 470: uint16(109), + 471: uint16(110), + 472: uint16(111), + 473: uint16(112), + 474: uint16(113), + 475: uint16(153), + 476: uint16(154), + 477: uint16(155), + 478: uint16(156), + 479: uint16(157), + 480: uint16(239), + 481: uint16(240), + 482: uint16(116), + 483: uint16(117), + 484: uint16(118), + 485: uint16(76), + 486: uint16(193), + 487: uint16(23), + 488: uint16(19), + 489: uint16(25), + 490: uint16(22), + 491: uint16(253), + 492: uint16(23), + 493: uint16(252), + 494: uint16(253), + 495: uint16(108), + 496: uint16(87), + 497: uint16(204), + 498: uint16(89), + 499: uint16(261), + 500: uint16(198), + 501: uint16(92), + 502: uint16(261), + 503: uint16(116), + 504: uint16(117), + 505: uint16(118), + 506: uint16(193), + 507: uint16(306), + 508: uint16(307), + 509: uint16(216), + 510: uint16(217), + 511: uint16(150), + 512: uint16(43), + 513: uint16(44), + 514: uint16(45), + 515: uint16(46), + 516: uint16(47), + 517: uint16(48), + 518: uint16(49), + 519: uint16(50), + 520: uint16(51), + 521: uint16(52), + 522: uint16(53), + 523: uint16(54), + 524: uint16(55), + 525: uint16(56), + 526: uint16(57), + 527: uint16(59), + 528: uint16(193), + 529: uint16(216), + 530: uint16(217), + 531: uint16(19), + 532: uint16(239), + 533: uint16(240), + 534: uint16(283), + 535: uint16(23), + 536: uint16(106), + 537: uint16(107), + 538: uint16(108), + 539: uint16(109), + 540: uint16(110), + 541: uint16(111), + 542: uint16(112), + 543: uint16(113), + 544: uint16(73), + 545: uint16(252), + 546: uint16(253), + 547: uint16(142), + 548: uint16(308), + 549: uint16(309), + 550: uint16(138), + 551: uint16(139), + 552: uint16(81), + 553: uint16(313), + 554: uint16(145), + 555: uint16(43), + 556: uint16(44), + 557: uint16(45), + 558: uint16(46), + 559: uint16(47), + 560: uint16(48), + 561: uint16(49), + 562: uint16(50), + 563: uint16(51), + 564: uint16(52), + 565: uint16(53), + 566: uint16(54), + 567: uint16(55), + 568: uint16(56), + 569: uint16(57), + 570: uint16(307), + 571: uint16(102), + 572: uint16(103), + 573: uint16(104), + 574: uint16(105), + 575: uint16(106), + 576: uint16(107), + 577: uint16(108), + 578: uint16(109), + 579: uint16(110), + 580: uint16(111), + 581: uint16(112), + 582: uint16(113), + 583: uint16(281), + 584: uint16(116), + 585: uint16(117), + 586: uint16(118), + 587: uint16(285), + 588: uint16(23), + 589: uint16(193), + 590: uint16(25), + 591: uint16(119), + 592: uint16(59), + 593: uint16(193), + 594: uint16(122), + 595: uint16(123), + 596: uint16(124), + 597: uint16(59), + 598: uint16(127), + 599: uint16(203), + 600: uint16(59), + 601: uint16(205), + 602: uint16(19), + 603: uint16(268), + 604: uint16(132), + 605: uint16(25), + 606: uint16(23), + 607: uint16(22), + 608: uint16(193), + 609: uint16(138), + 610: uint16(139), + 611: uint16(249), + 612: uint16(204), + 613: uint16(251), + 614: uint16(102), + 615: uint16(103), + 616: uint16(104), + 617: uint16(105), + 618: uint16(106), + 619: uint16(107), + 620: uint16(108), + 621: uint16(109), + 622: uint16(110), + 623: uint16(111), + 624: uint16(112), + 625: uint16(113), + 626: uint16(43), + 627: uint16(44), + 628: uint16(45), + 629: uint16(46), + 630: uint16(47), + 631: uint16(48), + 632: uint16(49), + 633: uint16(50), + 634: uint16(51), + 635: uint16(52), + 636: uint16(53), + 637: uint16(54), + 638: uint16(55), + 639: uint16(56), + 640: uint16(57), + 641: uint16(19), + 642: uint16(22), + 643: uint16(23), + 644: uint16(59), + 645: uint16(23), + 646: uint16(25), + 647: uint16(239), + 648: uint16(240), + 649: uint16(116), + 650: uint16(117), + 651: uint16(118), + 652: uint16(193), + 653: uint16(11), + 654: uint16(116), + 655: uint16(117), + 656: uint16(118), + 657: uint16(116), + 658: uint16(117), + 659: uint16(118), + 660: uint16(252), + 661: uint16(269), + 662: uint16(22), + 663: uint16(193), + 664: uint16(15), + 665: uint16(43), + 666: uint16(44), + 667: uint16(45), + 668: uint16(46), + 669: uint16(47), + 670: uint16(48), + 671: uint16(49), + 672: uint16(50), + 673: uint16(51), + 674: uint16(52), + 675: uint16(53), + 676: uint16(54), + 677: uint16(55), + 678: uint16(56), + 679: uint16(57), + 680: uint16(273), + 681: uint16(143), + 682: uint16(193), + 683: uint16(118), + 684: uint16(143), + 685: uint16(102), + 686: uint16(103), + 687: uint16(104), + 688: uint16(105), + 689: uint16(106), + 690: uint16(107), + 691: uint16(108), + 692: uint16(109), + 693: uint16(110), + 694: uint16(111), + 695: uint16(112), + 696: uint16(113), + 697: uint16(76), + 698: uint16(118), + 699: uint16(59), + 700: uint16(241), + 701: uint16(116), + 702: uint16(117), + 703: uint16(118), + 704: uint16(304), + 705: uint16(216), + 706: uint16(217), + 707: uint16(292), + 708: uint16(143), + 709: uint16(60), + 710: uint16(89), + 711: uint16(241), + 712: uint16(19), + 713: uint16(92), + 714: uint16(193), + 715: uint16(193), + 716: uint16(23), + 717: uint16(22), + 718: uint16(311), + 719: uint16(312), + 720: uint16(231), + 721: uint16(101), + 722: uint16(22), + 723: uint16(143), + 724: uint16(102), + 725: uint16(103), + 726: uint16(104), + 727: uint16(105), + 728: uint16(106), + 729: uint16(107), + 730: uint16(108), + 731: uint16(109), + 732: uint16(110), + 733: uint16(111), + 734: uint16(112), + 735: uint16(113), + 736: uint16(43), + 737: uint16(44), + 738: uint16(45), + 739: uint16(46), + 740: uint16(47), + 741: uint16(48), + 742: uint16(49), + 743: uint16(50), + 744: uint16(51), + 745: uint16(52), + 746: uint16(53), + 747: uint16(54), + 748: uint16(55), + 749: uint16(56), + 750: uint16(57), + 751: uint16(19), + 752: uint16(193), + 753: uint16(193), + 754: uint16(59), + 755: uint16(23), + 756: uint16(116), + 757: uint16(117), + 758: uint16(118), + 759: uint16(59), + 760: uint16(201), + 761: uint16(21), + 762: uint16(241), + 763: uint16(304), + 764: uint16(193), + 765: uint16(206), + 766: uint16(127), + 767: uint16(128), + 768: uint16(129), + 769: uint16(193), + 770: uint16(128), + 771: uint16(129), + 772: uint16(235), + 773: uint16(236), + 774: uint16(304), + 775: uint16(43), + 776: uint16(44), + 777: uint16(45), + 778: uint16(46), + 779: uint16(47), + 780: uint16(48), + 781: uint16(49), + 782: uint16(50), + 783: uint16(51), + 784: uint16(52), + 785: uint16(53), + 786: uint16(54), + 787: uint16(55), + 788: uint16(56), + 789: uint16(57), + 790: uint16(22), + 791: uint16(193), + 792: uint16(216), + 793: uint16(217), + 794: uint16(193), + 795: uint16(102), + 796: uint16(103), + 797: uint16(104), + 798: uint16(105), + 799: uint16(106), + 800: uint16(107), + 801: uint16(108), + 802: uint16(109), + 803: uint16(110), + 804: uint16(111), + 805: uint16(112), + 806: uint16(113), + 807: uint16(231), + 808: uint16(193), + 809: uint16(193), + 810: uint16(193), + 811: uint16(116), + 812: uint16(117), + 813: uint16(118), + 814: uint16(216), + 815: uint16(217), + 816: uint16(116), + 817: uint16(117), + 818: uint16(118), + 819: uint16(226), + 820: uint16(80), + 821: uint16(193), + 822: uint16(19), + 823: uint16(235), + 824: uint16(236), + 825: uint16(304), + 826: uint16(23), + 827: uint16(211), + 828: uint16(212), + 829: uint16(231), + 830: uint16(204), + 831: uint16(216), + 832: uint16(217), + 833: uint16(205), + 834: uint16(102), + 835: uint16(103), + 836: uint16(104), + 837: uint16(105), + 838: uint16(106), + 839: uint16(107), + 840: uint16(108), + 841: uint16(109), + 842: uint16(110), + 843: uint16(111), + 844: uint16(112), + 845: uint16(113), + 846: uint16(43), + 847: uint16(44), + 848: uint16(45), + 849: uint16(46), + 850: uint16(47), + 851: uint16(48), + 852: uint16(49), + 853: uint16(50), + 854: uint16(51), + 855: uint16(52), + 856: uint16(53), + 857: uint16(54), + 858: uint16(55), + 859: uint16(56), + 860: uint16(57), + 861: uint16(19), + 862: uint16(193), + 863: uint16(123), + 864: uint16(76), + 865: uint16(239), + 866: uint16(240), + 867: uint16(193), + 868: uint16(253), + 869: uint16(239), + 870: uint16(240), + 871: uint16(239), + 872: uint16(240), + 873: uint16(244), + 874: uint16(106), + 875: uint16(107), + 876: uint16(193), + 877: uint16(89), + 878: uint16(252), + 879: uint16(193), + 880: uint16(92), + 881: uint16(59), + 882: uint16(252), + 883: uint16(254), + 884: uint16(252), + 885: uint16(43), + 886: uint16(44), + 887: uint16(45), + 888: uint16(46), + 889: uint16(47), + 890: uint16(48), + 891: uint16(49), + 892: uint16(50), + 893: uint16(51), + 894: uint16(52), + 895: uint16(53), + 896: uint16(54), + 897: uint16(55), + 898: uint16(56), + 899: uint16(57), + 900: uint16(284), + 901: uint16(161), + 902: uint16(216), + 903: uint16(217), + 904: uint16(193), + 905: uint16(102), + 906: uint16(103), + 907: uint16(104), + 908: uint16(105), + 909: uint16(106), + 910: uint16(107), + 911: uint16(108), + 912: uint16(109), + 913: uint16(110), + 914: uint16(111), + 915: uint16(112), + 916: uint16(113), + 917: uint16(231), + 918: uint16(193), + 919: uint16(244), + 920: uint16(187), + 921: uint16(188), + 922: uint16(189), + 923: uint16(190), + 924: uint16(7), + 925: uint16(8), + 926: uint16(9), + 927: uint16(309), + 928: uint16(195), + 929: uint16(254), + 930: uint16(197), + 931: uint16(313), + 932: uint16(19), + 933: uint16(127), + 934: uint16(128), + 935: uint16(129), + 936: uint16(262), + 937: uint16(204), + 938: uint16(22), + 939: uint16(117), + 940: uint16(24), + 941: uint16(216), + 942: uint16(217), + 943: uint16(273), + 944: uint16(102), + 945: uint16(103), + 946: uint16(104), + 947: uint16(105), + 948: uint16(106), + 949: uint16(107), + 950: uint16(108), + 951: uint16(109), + 952: uint16(110), + 953: uint16(111), + 954: uint16(112), + 955: uint16(113), + 956: uint16(43), + 957: uint16(44), + 958: uint16(45), + 959: uint16(46), + 960: uint16(47), + 961: uint16(48), + 962: uint16(49), + 963: uint16(50), + 964: uint16(51), + 965: uint16(52), + 966: uint16(53), + 967: uint16(54), + 968: uint16(55), + 969: uint16(56), + 970: uint16(57), + 971: uint16(193), + 972: uint16(239), + 973: uint16(240), + 974: uint16(193), + 975: uint16(59), + 976: uint16(19), + 977: uint16(188), + 978: uint16(253), + 979: uint16(190), + 980: uint16(193), + 981: uint16(311), + 982: uint16(312), + 983: uint16(16), + 984: uint16(195), + 985: uint16(252), + 986: uint16(197), + 987: uint16(193), + 988: uint16(19), + 989: uint16(301), + 990: uint16(302), + 991: uint16(135), + 992: uint16(193), + 993: uint16(204), + 994: uint16(216), + 995: uint16(217), + 996: uint16(140), + 997: uint16(216), + 998: uint16(217), + 999: uint16(266), + 1000: uint16(204), + 1001: uint16(159), + 1002: uint16(45), + 1003: uint16(46), + 1004: uint16(47), + 1005: uint16(48), + 1006: uint16(49), + 1007: uint16(50), + 1008: uint16(51), + 1009: uint16(52), + 1010: uint16(53), + 1011: uint16(54), + 1012: uint16(55), + 1013: uint16(56), + 1014: uint16(57), + 1015: uint16(102), + 1016: uint16(103), + 1017: uint16(104), + 1018: uint16(105), + 1019: uint16(106), + 1020: uint16(107), + 1021: uint16(108), + 1022: uint16(109), + 1023: uint16(110), + 1024: uint16(111), + 1025: uint16(112), + 1026: uint16(113), + 1027: uint16(12), + 1028: uint16(239), + 1029: uint16(240), + 1030: uint16(193), + 1031: uint16(298), + 1032: uint16(238), + 1033: uint16(117), + 1034: uint16(253), + 1035: uint16(239), + 1036: uint16(240), + 1037: uint16(238), + 1038: uint16(259), + 1039: uint16(260), + 1040: uint16(193), + 1041: uint16(252), + 1042: uint16(27), + 1043: uint16(193), + 1044: uint16(77), + 1045: uint16(193), + 1046: uint16(79), + 1047: uint16(204), + 1048: uint16(252), + 1049: uint16(262), + 1050: uint16(193), + 1051: uint16(299), + 1052: uint16(300), + 1053: uint16(193), + 1054: uint16(100), + 1055: uint16(266), + 1056: uint16(278), + 1057: uint16(42), + 1058: uint16(204), + 1059: uint16(102), + 1060: uint16(103), + 1061: uint16(104), + 1062: uint16(105), + 1063: uint16(106), + 1064: uint16(107), + 1065: uint16(108), + 1066: uint16(109), + 1067: uint16(110), + 1068: uint16(111), + 1069: uint16(112), + 1070: uint16(113), + 1071: uint16(117), + 1072: uint16(159), + 1073: uint16(216), + 1074: uint16(217), + 1075: uint16(121), + 1076: uint16(216), + 1077: uint16(217), + 1078: uint16(63), + 1079: uint16(193), + 1080: uint16(193), + 1081: uint16(193), + 1082: uint16(239), + 1083: uint16(240), + 1084: uint16(115), + 1085: uint16(116), + 1086: uint16(193), + 1087: uint16(298), + 1088: uint16(73), + 1089: uint16(240), + 1090: uint16(238), + 1091: uint16(231), + 1092: uint16(19), + 1093: uint16(239), + 1094: uint16(240), + 1095: uint16(252), + 1096: uint16(22), + 1097: uint16(24), + 1098: uint16(211), + 1099: uint16(212), + 1100: uint16(263), + 1101: uint16(252), + 1102: uint16(216), + 1103: uint16(217), + 1104: uint16(216), + 1105: uint16(217), + 1106: uint16(252), + 1107: uint16(153), + 1108: uint16(154), + 1109: uint16(155), + 1110: uint16(253), + 1111: uint16(193), + 1112: uint16(19), + 1113: uint16(144), + 1114: uint16(213), + 1115: uint16(268), + 1116: uint16(43), + 1117: uint16(44), + 1118: uint16(45), + 1119: uint16(46), + 1120: uint16(47), + 1121: uint16(48), + 1122: uint16(49), + 1123: uint16(50), + 1124: uint16(51), + 1125: uint16(52), + 1126: uint16(53), + 1127: uint16(54), + 1128: uint16(55), + 1129: uint16(56), + 1130: uint16(57), + 1131: uint16(193), + 1132: uint16(19), + 1133: uint16(59), + 1134: uint16(216), + 1135: uint16(217), + 1136: uint16(43), + 1137: uint16(44), + 1138: uint16(45), + 1139: uint16(46), + 1140: uint16(47), + 1141: uint16(48), + 1142: uint16(49), + 1143: uint16(50), + 1144: uint16(51), + 1145: uint16(52), + 1146: uint16(53), + 1147: uint16(54), + 1148: uint16(55), + 1149: uint16(56), + 1150: uint16(57), + 1151: uint16(193), + 1152: uint16(19), + 1153: uint16(24), + 1154: uint16(216), + 1155: uint16(217), + 1156: uint16(43), + 1157: uint16(44), + 1158: uint16(45), + 1159: uint16(46), + 1160: uint16(47), + 1161: uint16(48), + 1162: uint16(49), + 1163: uint16(50), + 1164: uint16(51), + 1165: uint16(52), + 1166: uint16(53), + 1167: uint16(54), + 1168: uint16(55), + 1169: uint16(56), + 1170: uint16(57), + 1171: uint16(284), + 1172: uint16(193), + 1173: uint16(208), + 1174: uint16(209), + 1175: uint16(102), + 1176: uint16(103), + 1177: uint16(104), + 1178: uint16(105), + 1179: uint16(106), + 1180: uint16(107), + 1181: uint16(108), + 1182: uint16(109), + 1183: uint16(110), + 1184: uint16(111), + 1185: uint16(112), + 1186: uint16(113), + 1187: uint16(286), + 1188: uint16(59), + 1189: uint16(193), + 1190: uint16(232), + 1191: uint16(117), + 1192: uint16(291), + 1193: uint16(193), + 1194: uint16(193), + 1195: uint16(102), + 1196: uint16(103), + 1197: uint16(104), + 1198: uint16(105), + 1199: uint16(106), + 1200: uint16(107), + 1201: uint16(108), + 1202: uint16(109), + 1203: uint16(110), + 1204: uint16(111), + 1205: uint16(112), + 1206: uint16(113), + 1207: uint16(193), + 1208: uint16(204), + 1209: uint16(22), + 1210: uint16(23), + 1211: uint16(193), + 1212: uint16(25), + 1213: uint16(66), + 1214: uint16(193), + 1215: uint16(102), + 1216: uint16(103), + 1217: uint16(104), + 1218: uint16(105), + 1219: uint16(106), + 1220: uint16(107), + 1221: uint16(108), + 1222: uint16(109), + 1223: uint16(110), + 1224: uint16(111), + 1225: uint16(112), + 1226: uint16(113), + 1227: uint16(193), + 1228: uint16(193), + 1229: uint16(193), + 1230: uint16(216), + 1231: uint16(217), + 1232: uint16(85), + 1233: uint16(193), + 1234: uint16(238), + 1235: uint16(19), + 1236: uint16(16), + 1237: uint16(216), + 1238: uint16(217), + 1239: uint16(238), + 1240: uint16(193), + 1241: uint16(94), + 1242: uint16(193), + 1243: uint16(239), + 1244: uint16(240), + 1245: uint16(231), + 1246: uint16(117), + 1247: uint16(268), + 1248: uint16(35), + 1249: uint16(116), + 1250: uint16(216), + 1251: uint16(217), + 1252: uint16(216), + 1253: uint16(217), + 1254: uint16(22), + 1255: uint16(23), + 1256: uint16(252), + 1257: uint16(25), + 1258: uint16(208), + 1259: uint16(209), + 1260: uint16(44), + 1261: uint16(45), + 1262: uint16(46), + 1263: uint16(47), + 1264: uint16(48), + 1265: uint16(49), + 1266: uint16(50), + 1267: uint16(51), + 1268: uint16(52), + 1269: uint16(53), + 1270: uint16(54), + 1271: uint16(55), + 1272: uint16(56), + 1273: uint16(57), + 1274: uint16(193), + 1275: uint16(193), + 1276: uint16(19), + 1277: uint16(5), + 1278: uint16(59), + 1279: uint16(66), + 1280: uint16(193), + 1281: uint16(263), + 1282: uint16(10), + 1283: uint16(11), + 1284: uint16(12), + 1285: uint16(13), + 1286: uint16(14), + 1287: uint16(74), + 1288: uint16(101), + 1289: uint16(17), + 1290: uint16(193), + 1291: uint16(46), + 1292: uint16(193), + 1293: uint16(146), + 1294: uint16(193), + 1295: uint16(76), + 1296: uint16(213), + 1297: uint16(77), + 1298: uint16(263), + 1299: uint16(79), + 1300: uint16(12), + 1301: uint16(260), + 1302: uint16(30), + 1303: uint16(46), + 1304: uint16(32), + 1305: uint16(264), + 1306: uint16(87), + 1307: uint16(193), + 1308: uint16(89), + 1309: uint16(29), + 1310: uint16(263), + 1311: uint16(92), + 1312: uint16(40), + 1313: uint16(33), + 1314: uint16(232), + 1315: uint16(27), + 1316: uint16(193), + 1317: uint16(108), + 1318: uint16(102), + 1319: uint16(103), + 1320: uint16(104), + 1321: uint16(105), + 1322: uint16(106), + 1323: uint16(107), + 1324: uint16(108), + 1325: uint16(109), + 1326: uint16(110), + 1327: uint16(111), + 1328: uint16(112), + 1329: uint16(113), + 1330: uint16(42), + 1331: uint16(138), + 1332: uint16(139), + 1333: uint16(101), + 1334: uint16(193), + 1335: uint16(116), + 1336: uint16(117), + 1337: uint16(118), + 1338: uint16(19), + 1339: uint16(20), + 1340: uint16(255), + 1341: uint16(22), + 1342: uint16(70), + 1343: uint16(130), + 1344: uint16(135), + 1345: uint16(65), + 1346: uint16(256), + 1347: uint16(257), + 1348: uint16(193), + 1349: uint16(140), + 1350: uint16(78), + 1351: uint16(63), + 1352: uint16(193), + 1353: uint16(81), + 1354: uint16(193), + 1355: uint16(36), + 1356: uint16(193), + 1357: uint16(216), + 1358: uint16(217), + 1359: uint16(193), + 1360: uint16(115), + 1361: uint16(193), + 1362: uint16(263), + 1363: uint16(193), + 1364: uint16(145), + 1365: uint16(268), + 1366: uint16(59), + 1367: uint16(48), + 1368: uint16(193), + 1369: uint16(193), + 1370: uint16(98), + 1371: uint16(193), + 1372: uint16(115), + 1373: uint16(193), + 1374: uint16(291), + 1375: uint16(216), + 1376: uint16(217), + 1377: uint16(193), + 1378: uint16(59), + 1379: uint16(216), + 1380: uint16(217), + 1381: uint16(161), + 1382: uint16(216), + 1383: uint16(217), + 1384: uint16(216), + 1385: uint16(217), + 1386: uint16(216), + 1387: uint16(217), + 1388: uint16(131), + 1389: uint16(193), + 1390: uint16(71), + 1391: uint16(193), + 1392: uint16(216), + 1393: uint16(217), + 1394: uint16(216), + 1395: uint16(217), + 1396: uint16(216), + 1397: uint16(217), + 1398: uint16(193), + 1399: uint16(260), + 1400: uint16(216), + 1401: uint16(217), + 1402: uint16(19), + 1403: uint16(264), + 1404: uint16(85), + 1405: uint16(133), + 1406: uint16(244), + 1407: uint16(100), + 1408: uint16(193), + 1409: uint16(90), + 1410: uint16(138), + 1411: uint16(139), + 1412: uint16(216), + 1413: uint16(217), + 1414: uint16(216), + 1415: uint16(217), + 1416: uint16(254), + 1417: uint16(244), + 1418: uint16(193), + 1419: uint16(100), + 1420: uint16(193), + 1421: uint16(216), + 1422: uint16(217), + 1423: uint16(116), + 1424: uint16(117), + 1425: uint16(106), + 1426: uint16(107), + 1427: uint16(254), + 1428: uint16(121), + 1429: uint16(193), + 1430: uint16(115), + 1431: uint16(216), + 1432: uint16(217), + 1433: uint16(114), + 1434: uint16(162), + 1435: uint16(116), + 1436: uint16(117), + 1437: uint16(118), + 1438: uint16(115), + 1439: uint16(244), + 1440: uint16(121), + 1441: uint16(216), + 1442: uint16(217), + 1443: uint16(216), + 1444: uint16(217), + 1445: uint16(193), + 1446: uint16(309), + 1447: uint16(193), + 1448: uint16(31), + 1449: uint16(254), + 1450: uint16(313), + 1451: uint16(309), + 1452: uint16(216), + 1453: uint16(217), + 1454: uint16(309), + 1455: uint16(313), + 1456: uint16(39), + 1457: uint16(193), + 1458: uint16(313), + 1459: uint16(309), + 1460: uint16(153), + 1461: uint16(154), + 1462: uint16(155), + 1463: uint16(313), + 1464: uint16(193), + 1465: uint16(150), + 1466: uint16(25), + 1467: uint16(144), + 1468: uint16(216), + 1469: uint16(217), + 1470: uint16(216), + 1471: uint16(217), + 1472: uint16(153), + 1473: uint16(154), + 1474: uint16(155), + 1475: uint16(156), + 1476: uint16(157), + 1478: uint16(1), + 1479: uint16(2), + 1480: uint16(216), + 1481: uint16(217), + 1482: uint16(5), + 1483: uint16(149), + 1484: uint16(150), + 1485: uint16(22), + 1486: uint16(193), + 1487: uint16(10), + 1488: uint16(11), + 1489: uint16(12), + 1490: uint16(13), + 1491: uint16(14), + 1492: uint16(193), + 1493: uint16(158), + 1494: uint16(17), + 1495: uint16(160), + 1496: uint16(193), + 1497: uint16(19), + 1498: uint16(20), + 1499: uint16(116), + 1500: uint16(22), + 1501: uint16(25), + 1502: uint16(193), + 1503: uint16(24), + 1504: uint16(22), + 1505: uint16(193), + 1506: uint16(24), + 1507: uint16(30), + 1508: uint16(226), + 1509: uint16(32), + 1510: uint16(19), + 1511: uint16(20), + 1512: uint16(226), + 1513: uint16(22), + 1514: uint16(36), + 1515: uint16(193), + 1516: uint16(53), + 1517: uint16(40), + 1518: uint16(193), + 1519: uint16(216), + 1520: uint16(217), + 1521: uint16(193), + 1522: uint16(23), + 1523: uint16(193), + 1524: uint16(25), + 1525: uint16(216), + 1526: uint16(217), + 1527: uint16(36), + 1528: uint16(216), + 1529: uint16(217), + 1530: uint16(193), + 1531: uint16(99), + 1532: uint16(193), + 1533: uint16(193), + 1534: uint16(22), + 1535: uint16(193), + 1536: uint16(193), + 1537: uint16(59), + 1538: uint16(216), + 1539: uint16(217), + 1540: uint16(193), + 1541: uint16(216), + 1542: uint16(217), + 1543: uint16(193), + 1544: uint16(216), + 1545: uint16(217), + 1546: uint16(193), + 1547: uint16(70), + 1548: uint16(129), + 1549: uint16(71), + 1550: uint16(59), + 1551: uint16(129), + 1552: uint16(193), + 1553: uint16(216), + 1554: uint16(217), + 1555: uint16(78), + 1556: uint16(216), + 1557: uint16(217), + 1558: uint16(81), + 1559: uint16(216), + 1560: uint16(217), + 1561: uint16(193), + 1562: uint16(71), + 1563: uint16(85), + 1564: uint16(193), + 1565: uint16(133), + 1566: uint16(193), + 1567: uint16(126), + 1568: uint16(90), + 1569: uint16(216), + 1570: uint16(217), + 1571: uint16(152), + 1572: uint16(258), + 1573: uint16(61), + 1574: uint16(152), + 1575: uint16(98), + 1576: uint16(85), + 1577: uint16(193), + 1578: uint16(100), + 1579: uint16(193), + 1580: uint16(23), + 1581: uint16(90), + 1582: uint16(25), + 1583: uint16(121), + 1584: uint16(106), + 1585: uint16(107), + 1586: uint16(23), + 1587: uint16(216), + 1588: uint16(217), + 1589: uint16(216), + 1590: uint16(217), + 1591: uint16(100), + 1592: uint16(114), + 1593: uint16(131), + 1594: uint16(116), + 1595: uint16(117), + 1596: uint16(118), + 1597: uint16(106), + 1598: uint16(107), + 1599: uint16(121), + 1600: uint16(216), + 1601: uint16(217), + 1602: uint16(216), + 1603: uint16(217), + 1604: uint16(193), + 1605: uint16(114), + 1606: uint16(193), + 1607: uint16(116), + 1608: uint16(117), + 1609: uint16(118), + 1610: uint16(133), + 1611: uint16(22), + 1612: uint16(121), + 1613: uint16(193), + 1614: uint16(59), + 1615: uint16(138), + 1616: uint16(139), + 1617: uint16(193), + 1618: uint16(142), + 1619: uint16(193), + 1620: uint16(141), + 1621: uint16(23), + 1622: uint16(23), + 1623: uint16(25), + 1624: uint16(25), + 1625: uint16(120), + 1626: uint16(121), + 1627: uint16(216), + 1628: uint16(217), + 1629: uint16(216), + 1630: uint16(217), + 1631: uint16(153), + 1632: uint16(154), + 1633: uint16(155), + 1634: uint16(156), + 1635: uint16(157), + 1636: uint16(216), + 1637: uint16(217), + 1638: uint16(19), + 1639: uint16(162), + 1640: uint16(216), + 1641: uint16(217), + 1642: uint16(216), + 1643: uint16(217), + 1644: uint16(153), + 1645: uint16(154), + 1646: uint16(155), + 1647: uint16(156), + 1648: uint16(157), + 1649: uint16(1), + 1650: uint16(2), + 1651: uint16(193), + 1652: uint16(59), + 1653: uint16(5), + 1654: uint16(19), + 1655: uint16(20), + 1656: uint16(318), + 1657: uint16(22), + 1658: uint16(10), + 1659: uint16(11), + 1660: uint16(12), + 1661: uint16(13), + 1662: uint16(14), + 1663: uint16(193), + 1664: uint16(59), + 1665: uint16(17), + 1666: uint16(193), + 1667: uint16(23), + 1668: uint16(23), + 1669: uint16(25), + 1670: uint16(25), + 1671: uint16(36), + 1672: uint16(117), + 1673: uint16(193), + 1674: uint16(216), + 1675: uint16(217), + 1676: uint16(193), + 1677: uint16(23), + 1678: uint16(30), + 1679: uint16(25), + 1680: uint16(32), + 1681: uint16(19), + 1682: uint16(20), + 1683: uint16(23), + 1684: uint16(22), + 1685: uint16(25), + 1686: uint16(216), + 1687: uint16(217), + 1688: uint16(40), + 1689: uint16(216), + 1690: uint16(217), + 1691: uint16(7), + 1692: uint16(8), + 1693: uint16(23), + 1694: uint16(59), + 1695: uint16(25), + 1696: uint16(83), + 1697: uint16(84), + 1698: uint16(36), + 1699: uint16(23), + 1700: uint16(193), + 1701: uint16(25), + 1702: uint16(23), + 1703: uint16(23), + 1704: uint16(25), + 1705: uint16(25), + 1706: uint16(71), + 1707: uint16(153), + 1708: uint16(145), + 1709: uint16(155), + 1710: uint16(117), + 1711: uint16(153), + 1712: uint16(23), + 1713: uint16(155), + 1714: uint16(25), + 1715: uint16(23), + 1716: uint16(97), + 1717: uint16(25), + 1718: uint16(70), + 1719: uint16(193), + 1720: uint16(193), + 1721: uint16(59), + 1722: uint16(117), + 1723: uint16(236), + 1724: uint16(193), + 1725: uint16(193), + 1726: uint16(78), + 1727: uint16(193), + 1728: uint16(193), + 1729: uint16(81), + 1730: uint16(141), + 1731: uint16(193), + 1732: uint16(193), + 1733: uint16(71), + 1734: uint16(193), + 1735: uint16(100), + 1736: uint16(288), + 1737: uint16(287), + 1738: uint16(242), + 1739: uint16(255), + 1740: uint16(255), + 1741: uint16(106), + 1742: uint16(107), + 1743: uint16(108), + 1744: uint16(255), + 1745: uint16(255), + 1746: uint16(98), + 1747: uint16(243), + 1748: uint16(297), + 1749: uint16(114), + 1750: uint16(214), + 1751: uint16(116), + 1752: uint16(117), + 1753: uint16(118), + 1754: uint16(245), + 1755: uint16(191), + 1756: uint16(121), + 1757: uint16(271), + 1758: uint16(293), + 1759: uint16(267), + 1760: uint16(267), + 1761: uint16(246), + 1762: uint16(100), + 1763: uint16(246), + 1764: uint16(245), + 1765: uint16(271), + 1766: uint16(271), + 1767: uint16(293), + 1768: uint16(106), + 1769: uint16(107), + 1770: uint16(220), + 1771: uint16(271), + 1772: uint16(229), + 1773: uint16(225), + 1774: uint16(249), + 1775: uint16(219), + 1776: uint16(114), + 1777: uint16(259), + 1778: uint16(116), + 1779: uint16(117), + 1780: uint16(118), + 1781: uint16(133), + 1782: uint16(259), + 1783: uint16(121), + 1784: uint16(219), + 1785: uint16(219), + 1786: uint16(138), + 1787: uint16(139), + 1788: uint16(153), + 1789: uint16(154), + 1790: uint16(155), + 1791: uint16(156), + 1792: uint16(157), + 1793: uint16(280), + 1794: uint16(249), + 1795: uint16(243), + 1796: uint16(19), + 1797: uint16(20), + 1798: uint16(245), + 1799: uint16(22), + 1800: uint16(196), + 1801: uint16(259), + 1802: uint16(140), + 1803: uint16(259), + 1804: uint16(60), + 1805: uint16(297), + 1806: uint16(141), + 1807: uint16(297), + 1808: uint16(200), + 1809: uint16(200), + 1810: uint16(162), + 1811: uint16(38), + 1812: uint16(200), + 1813: uint16(36), + 1814: uint16(294), + 1815: uint16(153), + 1816: uint16(154), + 1817: uint16(155), + 1818: uint16(156), + 1819: uint16(157), + 1820: uint16(151), + 1821: uint16(150), + 1822: uint16(294), + 1823: uint16(283), + 1824: uint16(22), + 1825: uint16(43), + 1826: uint16(234), + 1827: uint16(18), + 1828: uint16(237), + 1829: uint16(200), + 1830: uint16(270), + 1831: uint16(272), + 1832: uint16(237), + 1833: uint16(237), + 1834: uint16(237), + 1835: uint16(18), + 1836: uint16(59), + 1837: uint16(199), + 1838: uint16(270), + 1839: uint16(149), + 1840: uint16(246), + 1841: uint16(272), + 1842: uint16(272), + 1843: uint16(200), + 1844: uint16(234), + 1845: uint16(234), + 1846: uint16(246), + 1847: uint16(246), + 1848: uint16(71), + 1849: uint16(246), + 1850: uint16(199), + 1851: uint16(158), + 1852: uint16(290), + 1853: uint16(62), + 1854: uint16(22), + 1855: uint16(200), + 1856: uint16(19), + 1857: uint16(20), + 1858: uint16(199), + 1859: uint16(22), + 1860: uint16(289), + 1861: uint16(221), + 1862: uint16(221), + 1863: uint16(200), + 1864: uint16(200), + 1865: uint16(199), + 1866: uint16(199), + 1867: uint16(115), + 1868: uint16(218), + 1869: uint16(64), + 1870: uint16(218), + 1871: uint16(218), + 1872: uint16(22), + 1873: uint16(36), + 1874: uint16(227), + 1875: uint16(126), + 1876: uint16(227), + 1877: uint16(100), + 1878: uint16(165), + 1879: uint16(221), + 1880: uint16(224), + 1881: uint16(224), + 1882: uint16(24), + 1883: uint16(106), + 1884: uint16(107), + 1885: uint16(312), + 1886: uint16(218), + 1887: uint16(305), + 1888: uint16(113), + 1889: uint16(282), + 1890: uint16(91), + 1891: uint16(114), + 1892: uint16(220), + 1893: uint16(116), + 1894: uint16(117), + 1895: uint16(118), + 1896: uint16(59), + 1897: uint16(282), + 1898: uint16(121), + 1899: uint16(218), + 1900: uint16(218), + 1901: uint16(218), + 1902: uint16(200), + 1903: uint16(317), + 1904: uint16(317), + 1905: uint16(82), + 1906: uint16(221), + 1907: uint16(265), + 1908: uint16(71), + 1909: uint16(148), + 1910: uint16(145), + 1911: uint16(265), + 1912: uint16(22), + 1913: uint16(277), + 1914: uint16(200), + 1915: uint16(158), + 1916: uint16(279), + 1917: uint16(140), + 1918: uint16(147), + 1919: uint16(25), + 1920: uint16(146), + 1921: uint16(202), + 1922: uint16(248), + 1923: uint16(250), + 1924: uint16(249), + 1925: uint16(247), + 1926: uint16(13), + 1927: uint16(250), + 1928: uint16(194), + 1929: uint16(194), + 1930: uint16(153), + 1931: uint16(154), + 1932: uint16(155), + 1933: uint16(156), + 1934: uint16(157), + 1935: uint16(6), + 1936: uint16(303), + 1937: uint16(100), + 1938: uint16(192), + 1939: uint16(192), + 1940: uint16(246), + 1941: uint16(213), + 1942: uint16(192), + 1943: uint16(106), + 1944: uint16(107), + 1945: uint16(207), + 1946: uint16(213), + 1947: uint16(207), + 1948: uint16(222), + 1949: uint16(213), + 1950: uint16(213), + 1951: uint16(114), + 1952: uint16(222), + 1953: uint16(116), + 1954: uint16(117), + 1955: uint16(118), + 1956: uint16(214), + 1957: uint16(214), + 1958: uint16(121), + 1959: uint16(4), + 1960: uint16(207), + 1961: uint16(213), + 1962: uint16(3), + 1963: uint16(22), + 1964: uint16(303), + 1965: uint16(15), + 1966: uint16(163), + 1967: uint16(16), + 1968: uint16(23), + 1969: uint16(23), + 1970: uint16(139), + 1971: uint16(151), + 1972: uint16(130), + 1973: uint16(25), + 1974: uint16(20), + 1975: uint16(142), + 1976: uint16(24), + 1977: uint16(16), + 1978: uint16(144), + 1979: uint16(1), + 1980: uint16(142), + 1981: uint16(130), + 1982: uint16(130), + 1983: uint16(61), + 1984: uint16(37), + 1985: uint16(53), + 1986: uint16(300), + 1987: uint16(151), + 1988: uint16(53), + 1989: uint16(53), + 1990: uint16(153), + 1991: uint16(154), + 1992: uint16(155), + 1993: uint16(156), + 1994: uint16(157), + 1995: uint16(53), + 1996: uint16(130), + 1997: uint16(116), + 1998: uint16(34), + 1999: uint16(1), + 2000: uint16(141), + 2001: uint16(5), + 2002: uint16(22), + 2003: uint16(115), + 2004: uint16(161), + 2005: uint16(68), + 2006: uint16(25), + 2007: uint16(68), + 2008: uint16(75), + 2009: uint16(41), + 2010: uint16(141), + 2011: uint16(115), + 2012: uint16(24), + 2013: uint16(20), + 2014: uint16(19), + 2015: uint16(131), + 2016: uint16(125), + 2017: uint16(23), + 2018: uint16(28), + 2019: uint16(22), + 2020: uint16(67), + 2021: uint16(22), + 2022: uint16(22), + 2023: uint16(22), + 2024: uint16(67), + 2025: uint16(59), + 2026: uint16(24), + 2027: uint16(96), + 2028: uint16(22), + 2029: uint16(67), + 2030: uint16(23), + 2031: uint16(149), + 2032: uint16(22), + 2033: uint16(25), + 2034: uint16(23), + 2035: uint16(23), + 2036: uint16(23), + 2037: uint16(22), + 2038: uint16(34), + 2039: uint16(141), + 2040: uint16(37), + 2041: uint16(97), + 2042: uint16(23), + 2043: uint16(23), + 2044: uint16(116), + 2045: uint16(22), + 2046: uint16(143), + 2047: uint16(25), + 2048: uint16(34), + 2049: uint16(75), + 2050: uint16(34), + 2051: uint16(34), + 2052: uint16(34), + 2053: uint16(88), + 2054: uint16(75), + 2055: uint16(34), + 2056: uint16(86), + 2057: uint16(23), + 2058: uint16(22), + 2059: uint16(34), + 2060: uint16(93), + 2061: uint16(24), + 2062: uint16(34), + 2063: uint16(25), + 2064: uint16(25), + 2065: uint16(142), + 2066: uint16(142), + 2067: uint16(23), + 2068: uint16(44), + 2069: uint16(23), + 2070: uint16(23), + 2071: uint16(23), + 2072: uint16(23), + 2073: uint16(11), + 2074: uint16(23), + 2075: uint16(25), + 2076: uint16(22), + 2077: uint16(22), + 2078: uint16(22), + 2079: uint16(141), + 2080: uint16(23), + 2081: uint16(23), + 2082: uint16(22), + 2083: uint16(22), + 2084: uint16(25), + 2085: uint16(15), + 2086: uint16(1), + 2087: uint16(23), + 2088: uint16(25), + 2089: uint16(1), + 2090: uint16(141), + 2091: uint16(135), + 2092: uint16(319), + 2093: uint16(319), + 2094: uint16(319), + 2095: uint16(319), + 2096: uint16(319), + 2097: uint16(319), + 2098: uint16(319), + 2099: uint16(141), + 2100: uint16(319), + 2101: uint16(319), + 2102: uint16(319), + 2103: uint16(319), + 2104: uint16(319), + 2105: uint16(319), + 2106: uint16(319), + 2107: uint16(319), + 2108: uint16(319), + 2109: uint16(319), + 2110: uint16(319), + 2111: uint16(319), + 2112: uint16(319), + 2113: uint16(319), + 2114: uint16(319), + 2115: uint16(319), + 2116: uint16(319), + 2117: uint16(319), + 2118: uint16(319), + 2119: uint16(319), + 2120: uint16(319), + 2121: uint16(319), + 2122: uint16(319), + 2123: uint16(319), + 2124: uint16(319), + 2125: uint16(319), + 2126: uint16(319), + 2127: uint16(319), + 2128: uint16(319), + 2129: uint16(319), + 2130: uint16(319), + 2131: uint16(319), + 2132: uint16(319), + 2133: uint16(319), + 2134: uint16(319), + 2135: uint16(319), + 2136: uint16(319), + 2137: uint16(319), + 2138: uint16(319), + 2139: uint16(319), + 2140: uint16(319), + 2141: uint16(319), + 2142: uint16(319), + 2143: uint16(319), + 2144: uint16(319), + 2145: uint16(319), + 2146: uint16(319), + 2147: uint16(319), + 2148: uint16(319), + 2149: uint16(319), + 2150: uint16(319), + 2151: uint16(319), + 2152: uint16(319), + 2153: uint16(319), + 2154: uint16(319), + 2155: uint16(319), + 2156: uint16(319), + 2157: uint16(319), + 2158: uint16(319), + 2159: uint16(319), + 2160: uint16(319), + 2161: uint16(319), + 2162: uint16(319), + 2163: uint16(319), + 2164: uint16(319), + 2165: uint16(319), + 2166: uint16(319), + 2167: uint16(319), + 2168: uint16(319), + 2169: uint16(319), + 2170: uint16(319), + 2171: uint16(319), + 2172: uint16(319), + 2173: uint16(319), + 2174: uint16(319), + 2175: uint16(319), + 2176: uint16(319), + 2177: uint16(319), + 2178: uint16(319), + 2179: uint16(319), + 2180: uint16(319), + 2181: uint16(319), + 2182: uint16(319), + 2183: uint16(319), + 2184: uint16(319), + 2185: uint16(319), + 2186: uint16(319), + 2187: uint16(319), + 2188: uint16(319), + 2189: uint16(319), + 2190: uint16(319), + 2191: uint16(319), + 2192: uint16(319), + 2193: uint16(319), + 2194: uint16(319), + 2195: uint16(319), + 2196: uint16(319), + 2197: uint16(319), + 2198: uint16(319), + 2199: uint16(319), + 2200: uint16(319), + 2201: uint16(319), + 2202: uint16(319), + 2203: uint16(319), + 2204: uint16(319), + 2205: uint16(319), + 2206: uint16(319), + 2207: uint16(319), + 2208: uint16(319), + 2209: uint16(319), + 2210: uint16(319), + 2211: uint16(319), + 2212: uint16(319), + 2213: uint16(319), + 2214: uint16(319), + 2215: uint16(319), + 2216: uint16(319), + 2217: uint16(319), + 2218: uint16(319), + 2219: uint16(319), + 2220: uint16(319), + 2221: uint16(319), + 2222: uint16(319), + 2223: uint16(319), + 2224: uint16(319), + 2225: uint16(319), + 2226: uint16(319), + 2227: uint16(319), + 2228: uint16(319), + 2229: uint16(319), + 2230: uint16(319), + 2231: uint16(319), + 2232: uint16(319), + 2233: uint16(319), + 2234: uint16(319), + 2235: uint16(319), + 2236: uint16(319), + 2237: uint16(319), + 2238: uint16(319), + 2239: uint16(319), + 2240: uint16(319), + 2241: uint16(319), + 2242: uint16(319), + 2243: uint16(319), + 2244: uint16(319), + 2245: uint16(319), + 2246: uint16(319), + 2247: uint16(319), + 2248: uint16(319), + 2249: uint16(319), + 2250: uint16(319), + 2251: uint16(319), + 2252: uint16(319), + 2253: uint16(319), + 2254: uint16(319), + 2255: uint16(319), + 2256: uint16(319), + 2257: uint16(319), + 2258: uint16(319), + 2259: uint16(319), + 2260: uint16(319), + 2261: uint16(319), + 2262: uint16(319), + 2263: uint16(319), + 2264: uint16(319), + 2265: uint16(319), + 2266: uint16(319), + 2267: uint16(319), + 2268: uint16(319), + 2269: uint16(319), + 2270: uint16(319), + 2271: uint16(319), + 2272: uint16(319), + 2273: uint16(319), + 2274: uint16(319), + 2275: uint16(319), + 2276: uint16(319), + 2277: uint16(319), + 2278: uint16(319), + 2279: uint16(319), + 2280: uint16(319), + 2281: uint16(319), + 2282: uint16(319), + 2283: uint16(319), + 2284: uint16(319), +} +var _yy_shift_ofst = [579]uint16{ + 0: uint16(1648), + 1: uint16(1477), + 2: uint16(1272), + 3: uint16(322), + 4: uint16(322), + 5: uint16(1), + 6: uint16(1319), + 7: uint16(1478), + 8: uint16(1491), + 9: uint16(1837), + 10: uint16(1837), + 11: uint16(1837), + 12: uint16(471), + 15: uint16(214), + 16: uint16(1093), + 17: uint16(1837), + 18: uint16(1837), + 19: uint16(1837), + 20: uint16(1837), + 21: uint16(1837), + 22: uint16(1837), + 23: uint16(1837), + 24: uint16(1837), + 25: uint16(1837), + 26: uint16(1837), + 27: uint16(1837), + 28: uint16(1837), + 29: uint16(1837), + 30: uint16(1837), + 31: uint16(271), + 32: uint16(271), + 33: uint16(1219), + 34: uint16(1219), + 35: uint16(216), + 36: uint16(88), + 37: uint16(1), + 38: uint16(1), + 39: uint16(1), + 40: uint16(1), + 41: uint16(1), + 42: uint16(40), + 43: uint16(111), + 44: uint16(258), + 45: uint16(361), + 46: uint16(469), + 47: uint16(512), + 48: uint16(583), + 49: uint16(622), + 50: uint16(693), + 51: uint16(732), + 52: uint16(803), + 53: uint16(842), + 54: uint16(913), + 55: uint16(1073), + 56: uint16(1093), + 57: uint16(1093), + 58: uint16(1093), + 59: uint16(1093), + 60: uint16(1093), + 61: uint16(1093), + 62: uint16(1093), + 63: uint16(1093), + 64: uint16(1093), + 65: uint16(1093), + 66: uint16(1093), + 67: uint16(1093), + 68: uint16(1093), + 69: uint16(1093), + 70: uint16(1093), + 71: uint16(1093), + 72: uint16(1093), + 73: uint16(1093), + 74: uint16(1113), + 75: uint16(1093), + 76: uint16(1216), + 77: uint16(957), + 78: uint16(957), + 79: uint16(1635), + 80: uint16(1662), + 81: uint16(1777), + 82: uint16(1837), + 83: uint16(1837), + 84: uint16(1837), + 85: uint16(1837), + 86: uint16(1837), + 87: uint16(1837), + 88: uint16(1837), + 89: uint16(1837), + 90: uint16(1837), + 91: uint16(1837), + 92: uint16(1837), + 93: uint16(1837), + 94: uint16(1837), + 95: uint16(1837), + 96: uint16(1837), + 97: uint16(1837), + 98: uint16(1837), + 99: uint16(1837), + 100: uint16(1837), + 101: uint16(1837), + 102: uint16(1837), + 103: uint16(1837), + 104: uint16(1837), + 105: uint16(1837), + 106: uint16(1837), + 107: uint16(1837), + 108: uint16(1837), + 109: uint16(1837), + 110: uint16(1837), + 111: uint16(1837), + 112: uint16(1837), + 113: uint16(1837), + 114: uint16(1837), + 115: uint16(1837), + 116: uint16(1837), + 117: uint16(1837), + 118: uint16(1837), + 119: uint16(1837), + 120: uint16(1837), + 121: uint16(1837), + 122: uint16(1837), + 123: uint16(1837), + 124: uint16(1837), + 125: uint16(1837), + 126: uint16(1837), + 127: uint16(1837), + 128: uint16(1837), + 129: uint16(1837), + 130: uint16(1837), + 131: uint16(137), + 132: uint16(181), + 133: uint16(181), + 134: uint16(181), + 135: uint16(181), + 136: uint16(181), + 137: uint16(181), + 138: uint16(181), + 139: uint16(94), + 140: uint16(430), + 141: uint16(66), + 142: uint16(65), + 143: uint16(112), + 144: uint16(366), + 145: uint16(533), + 146: uint16(533), + 147: uint16(740), + 148: uint16(1257), + 149: uint16(533), + 150: uint16(533), + 151: uint16(79), + 152: uint16(79), + 153: uint16(533), + 154: uint16(412), + 155: uint16(412), + 156: uint16(412), + 157: uint16(77), + 158: uint16(412), + 159: uint16(123), + 160: uint16(113), + 161: uint16(113), + 162: uint16(113), + 163: uint16(22), + 164: uint16(22), + 165: uint16(2100), + 166: uint16(2100), + 167: uint16(328), + 168: uint16(328), + 169: uint16(328), + 170: uint16(239), + 171: uint16(468), + 172: uint16(468), + 173: uint16(468), + 174: uint16(468), + 175: uint16(1015), + 176: uint16(1015), + 177: uint16(409), + 178: uint16(366), + 179: uint16(1187), + 180: uint16(1232), + 181: uint16(533), + 182: uint16(533), + 183: uint16(533), + 184: uint16(533), + 185: uint16(533), + 186: uint16(533), + 187: uint16(533), + 188: uint16(533), + 189: uint16(533), + 190: uint16(533), + 191: uint16(533), + 192: uint16(533), + 193: uint16(533), + 194: uint16(533), + 195: uint16(533), + 196: uint16(533), + 197: uint16(533), + 198: uint16(533), + 199: uint16(533), + 200: uint16(533), + 201: uint16(969), + 202: uint16(621), + 203: uint16(621), + 204: uint16(533), + 205: uint16(642), + 206: uint16(788), + 207: uint16(788), + 208: uint16(1133), + 209: uint16(1133), + 210: uint16(822), + 211: uint16(822), + 212: uint16(67), + 213: uint16(1193), + 214: uint16(2100), + 215: uint16(2100), + 216: uint16(2100), + 217: uint16(2100), + 218: uint16(2100), + 219: uint16(2100), + 220: uint16(2100), + 221: uint16(1307), + 222: uint16(954), + 223: uint16(954), + 224: uint16(585), + 225: uint16(472), + 226: uint16(640), + 227: uint16(387), + 228: uint16(695), + 229: uint16(538), + 230: uint16(541), + 231: uint16(700), + 232: uint16(533), + 233: uint16(533), + 234: uint16(533), + 235: uint16(533), + 236: uint16(533), + 237: uint16(533), + 238: uint16(533), + 239: uint16(533), + 240: uint16(533), + 241: uint16(533), + 242: uint16(222), + 243: uint16(533), + 244: uint16(533), + 245: uint16(533), + 246: uint16(533), + 247: uint16(533), + 248: uint16(533), + 249: uint16(533), + 250: uint16(533), + 251: uint16(533), + 252: uint16(533), + 253: uint16(533), + 254: uint16(533), + 255: uint16(1213), + 256: uint16(1213), + 257: uint16(1213), + 258: uint16(533), + 259: uint16(533), + 260: uint16(533), + 261: uint16(565), + 262: uint16(533), + 263: uint16(533), + 264: uint16(533), + 265: uint16(916), + 266: uint16(1147), + 267: uint16(533), + 268: uint16(533), + 269: uint16(1288), + 270: uint16(533), + 271: uint16(533), + 272: uint16(533), + 273: uint16(533), + 274: uint16(533), + 275: uint16(533), + 276: uint16(533), + 277: uint16(533), + 278: uint16(639), + 279: uint16(1280), + 280: uint16(209), + 281: uint16(1129), + 282: uint16(1129), + 283: uint16(1129), + 284: uint16(1129), + 285: uint16(580), + 286: uint16(209), + 287: uint16(209), + 288: uint16(1209), + 289: uint16(768), + 290: uint16(917), + 291: uint16(649), + 292: uint16(1315), + 293: uint16(1334), + 294: uint16(405), + 295: uint16(1334), + 296: uint16(1383), + 297: uint16(249), + 298: uint16(1315), + 299: uint16(1315), + 300: uint16(249), + 301: uint16(1315), + 302: uint16(405), + 303: uint16(1383), + 304: uint16(1441), + 305: uint16(464), + 306: uint16(1245), + 307: uint16(1417), + 308: uint16(1417), + 309: uint16(1417), + 310: uint16(1323), + 311: uint16(1323), + 312: uint16(1323), + 313: uint16(1323), + 314: uint16(184), + 315: uint16(184), + 316: uint16(1335), + 317: uint16(1476), + 318: uint16(856), + 319: uint16(1482), + 320: uint16(1744), + 321: uint16(1744), + 322: uint16(1665), + 323: uint16(1665), + 324: uint16(1773), + 325: uint16(1773), + 326: uint16(1665), + 327: uint16(1669), + 328: uint16(1671), + 329: uint16(1802), + 330: uint16(1782), + 331: uint16(1809), + 332: uint16(1809), + 333: uint16(1809), + 334: uint16(1809), + 335: uint16(1665), + 336: uint16(1817), + 337: uint16(1690), + 338: uint16(1671), + 339: uint16(1671), + 340: uint16(1690), + 341: uint16(1802), + 342: uint16(1782), + 343: uint16(1690), + 344: uint16(1782), + 345: uint16(1690), + 346: uint16(1665), + 347: uint16(1817), + 348: uint16(1693), + 349: uint16(1791), + 350: uint16(1665), + 351: uint16(1817), + 352: uint16(1832), + 353: uint16(1665), + 354: uint16(1817), + 355: uint16(1665), + 356: uint16(1817), + 357: uint16(1832), + 358: uint16(1752), + 359: uint16(1752), + 360: uint16(1752), + 361: uint16(1805), + 362: uint16(1850), + 363: uint16(1850), + 364: uint16(1832), + 365: uint16(1752), + 366: uint16(1749), + 367: uint16(1752), + 368: uint16(1805), + 369: uint16(1752), + 370: uint16(1752), + 371: uint16(1713), + 372: uint16(1858), + 373: uint16(1775), + 374: uint16(1775), + 375: uint16(1832), + 376: uint16(1665), + 377: uint16(1799), + 378: uint16(1799), + 379: uint16(1823), + 380: uint16(1823), + 381: uint16(1761), + 382: uint16(1765), + 383: uint16(1890), + 384: uint16(1665), + 385: uint16(1757), + 386: uint16(1761), + 387: uint16(1771), + 388: uint16(1774), + 389: uint16(1690), + 390: uint16(1894), + 391: uint16(1913), + 392: uint16(1913), + 393: uint16(1929), + 394: uint16(1929), + 395: uint16(1929), + 396: uint16(2100), + 397: uint16(2100), + 398: uint16(2100), + 399: uint16(2100), + 400: uint16(2100), + 401: uint16(2100), + 402: uint16(2100), + 403: uint16(2100), + 404: uint16(2100), + 405: uint16(2100), + 406: uint16(2100), + 407: uint16(2100), + 408: uint16(2100), + 409: uint16(2100), + 410: uint16(2100), + 411: uint16(207), + 412: uint16(1220), + 413: uint16(331), + 414: uint16(620), + 415: uint16(967), + 416: uint16(806), + 417: uint16(1074), + 418: uint16(1499), + 419: uint16(1432), + 420: uint16(1463), + 421: uint16(1479), + 422: uint16(1419), + 423: uint16(1422), + 424: uint16(1557), + 425: uint16(1512), + 426: uint16(1598), + 427: uint16(1599), + 428: uint16(1644), + 429: uint16(1645), + 430: uint16(1654), + 431: uint16(1660), + 432: uint16(1555), + 433: uint16(1505), + 434: uint16(1684), + 435: uint16(1462), + 436: uint16(1670), + 437: uint16(1563), + 438: uint16(1619), + 439: uint16(1593), + 440: uint16(1676), + 441: uint16(1679), + 442: uint16(1613), + 443: uint16(1680), + 444: uint16(1554), + 445: uint16(1558), + 446: uint16(1689), + 447: uint16(1692), + 448: uint16(1605), + 449: uint16(1589), + 450: uint16(1955), + 451: uint16(1959), + 452: uint16(1941), + 453: uint16(1803), + 454: uint16(1950), + 455: uint16(1951), + 456: uint16(1945), + 457: uint16(1946), + 458: uint16(1831), + 459: uint16(1820), + 460: uint16(1842), + 461: uint16(1948), + 462: uint16(1948), + 463: uint16(1952), + 464: uint16(1833), + 465: uint16(1954), + 466: uint16(1834), + 467: uint16(1961), + 468: uint16(1978), + 469: uint16(1838), + 470: uint16(1851), + 471: uint16(1948), + 472: uint16(1852), + 473: uint16(1922), + 474: uint16(1947), + 475: uint16(1948), + 476: uint16(1836), + 477: uint16(1932), + 478: uint16(1935), + 479: uint16(1936), + 480: uint16(1942), + 481: uint16(1866), + 482: uint16(1881), + 483: uint16(1964), + 484: uint16(1859), + 485: uint16(1998), + 486: uint16(1996), + 487: uint16(1980), + 488: uint16(1888), + 489: uint16(1843), + 490: uint16(1937), + 491: uint16(1981), + 492: uint16(1939), + 493: uint16(1933), + 494: uint16(1968), + 495: uint16(1869), + 496: uint16(1896), + 497: uint16(1988), + 498: uint16(1993), + 499: uint16(1995), + 500: uint16(1884), + 501: uint16(1891), + 502: uint16(1997), + 503: uint16(1953), + 504: uint16(1999), + 505: uint16(2000), + 506: uint16(1994), + 507: uint16(2001), + 508: uint16(1957), + 509: uint16(1966), + 510: uint16(2002), + 511: uint16(1931), + 512: uint16(1990), + 513: uint16(2006), + 514: uint16(1962), + 515: uint16(2003), + 516: uint16(2007), + 517: uint16(2004), + 518: uint16(1882), + 519: uint16(2010), + 520: uint16(2011), + 521: uint16(2012), + 522: uint16(2008), + 523: uint16(2013), + 524: uint16(2015), + 525: uint16(1944), + 526: uint16(1898), + 527: uint16(2019), + 528: uint16(2020), + 529: uint16(1928), + 530: uint16(2014), + 531: uint16(2023), + 532: uint16(1903), + 533: uint16(2022), + 534: uint16(2016), + 535: uint16(2017), + 536: uint16(2018), + 537: uint16(2021), + 538: uint16(1965), + 539: uint16(1974), + 540: uint16(1970), + 541: uint16(2024), + 542: uint16(1979), + 543: uint16(1967), + 544: uint16(2025), + 545: uint16(2034), + 546: uint16(2036), + 547: uint16(2037), + 548: uint16(2038), + 549: uint16(2039), + 550: uint16(2028), + 551: uint16(1923), + 552: uint16(1924), + 553: uint16(2044), + 554: uint16(2022), + 555: uint16(2046), + 556: uint16(2047), + 557: uint16(2048), + 558: uint16(2049), + 559: uint16(2050), + 560: uint16(2051), + 561: uint16(2054), + 562: uint16(2062), + 563: uint16(2055), + 564: uint16(2056), + 565: uint16(2057), + 566: uint16(2058), + 567: uint16(2060), + 568: uint16(2061), + 569: uint16(2059), + 570: uint16(1956), + 571: uint16(1938), + 572: uint16(1949), + 573: uint16(1958), + 574: uint16(2063), + 575: uint16(2064), + 576: uint16(2070), + 577: uint16(2085), + 578: uint16(2088), +} +var _yy_reduce_ofst = [411]int16{ + 0: int16(-int32(125)), + 1: int16(733), + 2: int16(789), + 3: int16(241), + 4: int16(293), + 5: int16(-int32(123)), + 6: int16(-int32(193)), + 7: int16(-int32(191)), + 8: int16(-int32(183)), + 9: int16(-int32(187)), + 10: int16(166), + 11: int16(238), + 12: int16(133), + 13: int16(-int32(207)), + 14: int16(-int32(199)), + 15: int16(-int32(267)), + 16: int16(-int32(176)), + 17: int16(-int32(6)), + 18: int16(204), + 19: int16(489), + 20: int16(576), + 21: int16(598), + 22: int16(-int32(175)), + 23: int16(686), + 24: int16(860), + 25: int16(615), + 26: int16(725), + 27: int16(1014), + 28: int16(778), + 29: int16(781), + 30: int16(857), + 31: int16(616), + 32: int16(887), + 33: int16(87), + 34: int16(240), + 35: int16(-int32(192)), + 36: int16(408), + 37: int16(626), + 38: int16(796), + 39: int16(843), + 40: int16(854), + 41: int16(1004), + 42: int16(-int32(271)), + 43: int16(-int32(271)), + 44: int16(-int32(271)), + 45: int16(-int32(271)), + 46: int16(-int32(271)), + 47: int16(-int32(271)), + 48: int16(-int32(271)), + 49: int16(-int32(271)), + 50: int16(-int32(271)), + 51: int16(-int32(271)), + 52: int16(-int32(271)), + 53: int16(-int32(271)), + 54: int16(-int32(271)), + 55: int16(-int32(271)), + 56: int16(-int32(271)), + 57: int16(-int32(271)), + 58: int16(-int32(271)), + 59: int16(-int32(271)), + 60: int16(-int32(271)), + 61: int16(-int32(271)), + 62: int16(-int32(271)), + 63: int16(-int32(271)), + 64: int16(-int32(271)), + 65: int16(-int32(271)), + 66: int16(-int32(271)), + 67: int16(-int32(271)), + 68: int16(-int32(271)), + 69: int16(-int32(271)), + 70: int16(-int32(271)), + 71: int16(-int32(271)), + 72: int16(-int32(271)), + 73: int16(-int32(271)), + 74: int16(-int32(271)), + 75: int16(-int32(271)), + 76: int16(-int32(271)), + 77: int16(-int32(271)), + 78: int16(-int32(271)), + 79: int16(80), + 80: int16(83), + 81: int16(313), + 82: int16(886), + 83: int16(888), + 84: int16(918), + 85: int16(938), + 86: int16(1021), + 87: int16(1034), + 88: int16(1036), + 89: int16(1141), + 90: int16(1159), + 91: int16(1163), + 92: int16(1166), + 93: int16(1168), + 94: int16(1170), + 95: int16(1176), + 96: int16(1178), + 97: int16(1180), + 98: int16(1184), + 99: int16(1196), + 100: int16(1198), + 101: int16(1205), + 102: int16(1215), + 103: int16(1225), + 104: int16(1227), + 105: int16(1236), + 106: int16(1252), + 107: int16(1254), + 108: int16(1264), + 109: int16(1303), + 110: int16(1309), + 111: int16(1312), + 112: int16(1322), + 113: int16(1325), + 114: int16(1328), + 115: int16(1337), + 116: int16(1340), + 117: int16(1343), + 118: int16(1353), + 119: int16(1371), + 120: int16(1373), + 121: int16(1384), + 122: int16(1386), + 123: int16(1411), + 124: int16(1413), + 125: int16(1420), + 126: int16(1424), + 127: int16(1426), + 128: int16(1458), + 129: int16(1470), + 130: int16(1473), + 131: int16(-int32(271)), + 132: int16(-int32(271)), + 133: int16(-int32(271)), + 134: int16(-int32(271)), + 135: int16(-int32(271)), + 136: int16(-int32(271)), + 137: int16(-int32(271)), + 138: int16(-int32(271)), + 139: int16(-int32(271)), + 140: int16(-int32(271)), + 141: int16(-int32(271)), + 142: int16(138), + 143: int16(459), + 144: int16(396), + 145: int16(-int32(158)), + 146: int16(470), + 147: int16(302), + 148: int16(-int32(212)), + 149: int16(521), + 150: int16(201), + 151: int16(-int32(195)), + 152: int16(-int32(92)), + 153: int16(559), + 154: int16(630), + 155: int16(632), + 156: int16(630), + 157: int16(-int32(271)), + 158: int16(632), + 159: int16(901), + 160: int16(63), + 161: int16(407), + 162: int16(670), + 163: int16(-int32(271)), + 164: int16(-int32(271)), + 165: int16(-int32(271)), + 166: int16(-int32(271)), + 167: int16(161), + 168: int16(161), + 169: int16(161), + 170: int16(251), + 171: int16(335), + 172: int16(847), + 173: int16(979), + 174: int16(1097), + 175: int16(537), + 176: int16(588), + 177: int16(618), + 178: int16(628), + 179: int16(688), + 180: int16(688), + 181: int16(-int32(166)), + 182: int16(-int32(161)), + 183: int16(674), + 184: int16(787), + 185: int16(794), + 186: int16(799), + 187: int16(852), + 188: int16(996), + 189: int16(-int32(122)), + 190: int16(837), + 191: int16(-int32(120)), + 192: int16(1018), + 193: int16(1035), + 194: int16(415), + 195: int16(1047), + 196: int16(1001), + 197: int16(958), + 198: int16(1082), + 199: int16(400), + 200: int16(1099), + 201: int16(779), + 202: int16(1137), + 203: int16(1142), + 204: int16(263), + 205: int16(1083), + 206: int16(1145), + 207: int16(1150), + 208: int16(1041), + 209: int16(1139), + 210: int16(965), + 211: int16(1050), + 212: int16(362), + 213: int16(849), + 214: int16(752), + 215: int16(629), + 216: int16(675), + 217: int16(1162), + 218: int16(1173), + 219: int16(1090), + 220: int16(1195), + 221: int16(-int32(194)), + 222: int16(56), + 223: int16(185), + 224: int16(-int32(135)), + 225: int16(232), + 226: int16(522), + 227: int16(560), + 228: int16(571), + 229: int16(601), + 230: int16(617), + 231: int16(669), + 232: int16(683), + 233: int16(711), + 234: int16(850), + 235: int16(893), + 236: int16(1000), + 237: int16(1040), + 238: int16(1049), + 239: int16(1081), + 240: int16(1087), + 241: int16(1101), + 242: int16(392), + 243: int16(1114), + 244: int16(1123), + 245: int16(1155), + 246: int16(1161), + 247: int16(1175), + 248: int16(1271), + 249: int16(1293), + 250: int16(1299), + 251: int16(1330), + 252: int16(1339), + 253: int16(1342), + 254: int16(1347), + 255: int16(593), + 256: int16(1282), + 257: int16(1286), + 258: int16(1350), + 259: int16(1359), + 260: int16(1368), + 261: int16(1314), + 262: int16(1480), + 263: int16(1483), + 264: int16(1507), + 265: int16(1085), + 266: int16(1338), + 267: int16(1526), + 268: int16(1527), + 269: int16(1487), + 270: int16(1531), + 271: int16(560), + 272: int16(1532), + 273: int16(1534), + 274: int16(1535), + 275: int16(1538), + 276: int16(1539), + 277: int16(1541), + 278: int16(1448), + 279: int16(1450), + 280: int16(1496), + 281: int16(1484), + 282: int16(1485), + 283: int16(1489), + 284: int16(1490), + 285: int16(1314), + 286: int16(1496), + 287: int16(1496), + 288: int16(1504), + 289: int16(1536), + 290: int16(1564), + 291: int16(1451), + 292: int16(1486), + 293: int16(1492), + 294: int16(1509), + 295: int16(1493), + 296: int16(1465), + 297: int16(1515), + 298: int16(1494), + 299: int16(1495), + 300: int16(1517), + 301: int16(1500), + 302: int16(1519), + 303: int16(1474), + 304: int16(1550), + 305: int16(1543), + 306: int16(1548), + 307: int16(1556), + 308: int16(1565), + 309: int16(1566), + 310: int16(1518), + 311: int16(1523), + 312: int16(1542), + 313: int16(1544), + 314: int16(1525), + 315: int16(1545), + 316: int16(1513), + 317: int16(1553), + 318: int16(1552), + 319: int16(1604), + 320: int16(1508), + 321: int16(1510), + 322: int16(1608), + 323: int16(1609), + 324: int16(1520), + 325: int16(1528), + 326: int16(1612), + 327: int16(1540), + 328: int16(1559), + 329: int16(1560), + 330: int16(1592), + 331: int16(1591), + 332: int16(1595), + 333: int16(1596), + 334: int16(1597), + 335: int16(1629), + 336: int16(1638), + 337: int16(1594), + 338: int16(1569), + 339: int16(1570), + 340: int16(1600), + 341: int16(1568), + 342: int16(1610), + 343: int16(1601), + 344: int16(1611), + 345: int16(1603), + 346: int16(1643), + 347: int16(1651), + 348: int16(1562), + 349: int16(1571), + 350: int16(1655), + 351: int16(1659), + 352: int16(1640), + 353: int16(1663), + 354: int16(1666), + 355: int16(1664), + 356: int16(1667), + 357: int16(1641), + 358: int16(1650), + 359: int16(1652), + 360: int16(1653), + 361: int16(1647), + 362: int16(1656), + 363: int16(1657), + 364: int16(1658), + 365: int16(1668), + 366: int16(1672), + 367: int16(1681), + 368: int16(1649), + 369: int16(1682), + 370: int16(1683), + 371: int16(1573), + 372: int16(1582), + 373: int16(1607), + 374: int16(1615), + 375: int16(1685), + 376: int16(1702), + 377: int16(1586), + 378: int16(1587), + 379: int16(1642), + 380: int16(1646), + 381: int16(1673), + 382: int16(1675), + 383: int16(1636), + 384: int16(1714), + 385: int16(1637), + 386: int16(1677), + 387: int16(1674), + 388: int16(1678), + 389: int16(1694), + 390: int16(1719), + 391: int16(1734), + 392: int16(1735), + 393: int16(1746), + 394: int16(1747), + 395: int16(1750), + 396: int16(1633), + 397: int16(1661), + 398: int16(1686), + 399: int16(1738), + 400: int16(1728), + 401: int16(1733), + 402: int16(1736), + 403: int16(1737), + 404: int16(1740), + 405: int16(1726), + 406: int16(1730), + 407: int16(1742), + 408: int16(1743), + 409: int16(1748), + 410: int16(1753), +} +var _yy_default = [579]uint16{ + 0: uint16(1648), + 1: uint16(1648), + 2: uint16(1648), + 3: uint16(1478), + 4: uint16(1243), + 5: uint16(1354), + 6: uint16(1243), + 7: uint16(1243), + 8: uint16(1243), + 9: uint16(1478), + 10: uint16(1478), + 11: uint16(1478), + 12: uint16(1243), + 13: uint16(1384), + 14: uint16(1384), + 15: uint16(1531), + 16: uint16(1276), + 17: uint16(1243), + 18: uint16(1243), + 19: uint16(1243), + 20: uint16(1243), + 21: uint16(1243), + 22: uint16(1243), + 23: uint16(1243), + 24: uint16(1243), + 25: uint16(1243), + 26: uint16(1243), + 27: uint16(1243), + 28: uint16(1477), + 29: uint16(1243), + 30: uint16(1243), + 31: uint16(1243), + 32: uint16(1243), + 33: uint16(1564), + 34: uint16(1564), + 35: uint16(1243), + 36: uint16(1243), + 37: uint16(1243), + 38: uint16(1243), + 39: uint16(1243), + 40: uint16(1243), + 41: uint16(1243), + 42: uint16(1243), + 43: uint16(1393), + 44: uint16(1243), + 45: uint16(1400), + 46: uint16(1243), + 47: uint16(1243), + 48: uint16(1243), + 49: uint16(1243), + 50: uint16(1243), + 51: uint16(1479), + 52: uint16(1480), + 53: uint16(1243), + 54: uint16(1243), + 55: uint16(1243), + 56: uint16(1530), + 57: uint16(1532), + 58: uint16(1495), + 59: uint16(1407), + 60: uint16(1406), + 61: uint16(1405), + 62: uint16(1404), + 63: uint16(1513), + 64: uint16(1372), + 65: uint16(1398), + 66: uint16(1391), + 67: uint16(1395), + 68: uint16(1474), + 69: uint16(1475), + 70: uint16(1473), + 71: uint16(1626), + 72: uint16(1480), + 73: uint16(1479), + 74: uint16(1243), + 75: uint16(1394), + 76: uint16(1442), + 77: uint16(1458), + 78: uint16(1441), + 79: uint16(1243), + 80: uint16(1243), + 81: uint16(1243), + 82: uint16(1243), + 83: uint16(1243), + 84: uint16(1243), + 85: uint16(1243), + 86: uint16(1243), + 87: uint16(1243), + 88: uint16(1243), + 89: uint16(1243), + 90: uint16(1243), + 91: uint16(1243), + 92: uint16(1243), + 93: uint16(1243), + 94: uint16(1243), + 95: uint16(1243), + 96: uint16(1243), + 97: uint16(1243), + 98: uint16(1243), + 99: uint16(1243), + 100: uint16(1243), + 101: uint16(1243), + 102: uint16(1243), + 103: uint16(1243), + 104: uint16(1243), + 105: uint16(1243), + 106: uint16(1243), + 107: uint16(1243), + 108: uint16(1243), + 109: uint16(1243), + 110: uint16(1243), + 111: uint16(1243), + 112: uint16(1243), + 113: uint16(1243), + 114: uint16(1243), + 115: uint16(1243), + 116: uint16(1243), + 117: uint16(1243), + 118: uint16(1243), + 119: uint16(1243), + 120: uint16(1243), + 121: uint16(1243), + 122: uint16(1243), + 123: uint16(1243), + 124: uint16(1243), + 125: uint16(1243), + 126: uint16(1243), + 127: uint16(1243), + 128: uint16(1243), + 129: uint16(1243), + 130: uint16(1243), + 131: uint16(1450), + 132: uint16(1457), + 133: uint16(1456), + 134: uint16(1455), + 135: uint16(1464), + 136: uint16(1454), + 137: uint16(1451), + 138: uint16(1444), + 139: uint16(1443), + 140: uint16(1445), + 141: uint16(1446), + 142: uint16(1243), + 143: uint16(1243), + 144: uint16(1267), + 145: uint16(1243), + 146: uint16(1243), + 147: uint16(1264), + 148: uint16(1318), + 149: uint16(1243), + 150: uint16(1243), + 151: uint16(1243), + 152: uint16(1243), + 153: uint16(1243), + 154: uint16(1550), + 155: uint16(1549), + 156: uint16(1243), + 157: uint16(1447), + 158: uint16(1243), + 159: uint16(1276), + 160: uint16(1435), + 161: uint16(1434), + 162: uint16(1433), + 163: uint16(1461), + 164: uint16(1448), + 165: uint16(1460), + 166: uint16(1459), + 167: uint16(1538), + 168: uint16(1600), + 169: uint16(1599), + 170: uint16(1496), + 171: uint16(1243), + 172: uint16(1243), + 173: uint16(1243), + 174: uint16(1243), + 175: uint16(1243), + 176: uint16(1243), + 177: uint16(1564), + 178: uint16(1243), + 179: uint16(1243), + 180: uint16(1243), + 181: uint16(1243), + 182: uint16(1243), + 183: uint16(1243), + 184: uint16(1243), + 185: uint16(1243), + 186: uint16(1243), + 187: uint16(1243), + 188: uint16(1243), + 189: uint16(1243), + 190: uint16(1243), + 191: uint16(1243), + 192: uint16(1243), + 193: uint16(1243), + 194: uint16(1243), + 195: uint16(1243), + 196: uint16(1243), + 197: uint16(1243), + 198: uint16(1243), + 199: uint16(1243), + 200: uint16(1243), + 201: uint16(1374), + 202: uint16(1564), + 203: uint16(1564), + 204: uint16(1243), + 205: uint16(1276), + 206: uint16(1564), + 207: uint16(1564), + 208: uint16(1375), + 209: uint16(1375), + 210: uint16(1272), + 211: uint16(1272), + 212: uint16(1378), + 213: uint16(1243), + 214: uint16(1545), + 215: uint16(1345), + 216: uint16(1345), + 217: uint16(1345), + 218: uint16(1345), + 219: uint16(1354), + 220: uint16(1345), + 221: uint16(1243), + 222: uint16(1243), + 223: uint16(1243), + 224: uint16(1243), + 225: uint16(1243), + 226: uint16(1243), + 227: uint16(1243), + 228: uint16(1243), + 229: uint16(1243), + 230: uint16(1243), + 231: uint16(1243), + 232: uint16(1243), + 233: uint16(1243), + 234: uint16(1243), + 235: uint16(1243), + 236: uint16(1535), + 237: uint16(1533), + 238: uint16(1243), + 239: uint16(1243), + 240: uint16(1243), + 241: uint16(1243), + 242: uint16(1243), + 243: uint16(1243), + 244: uint16(1243), + 245: uint16(1243), + 246: uint16(1243), + 247: uint16(1243), + 248: uint16(1243), + 249: uint16(1243), + 250: uint16(1243), + 251: uint16(1243), + 252: uint16(1243), + 253: uint16(1243), + 254: uint16(1243), + 255: uint16(1243), + 256: uint16(1243), + 257: uint16(1243), + 258: uint16(1243), + 259: uint16(1243), + 260: uint16(1243), + 261: uint16(1243), + 262: uint16(1243), + 263: uint16(1243), + 264: uint16(1243), + 265: uint16(1350), + 266: uint16(1243), + 267: uint16(1243), + 268: uint16(1243), + 269: uint16(1243), + 270: uint16(1243), + 271: uint16(1243), + 272: uint16(1243), + 273: uint16(1243), + 274: uint16(1243), + 275: uint16(1243), + 276: uint16(1243), + 277: uint16(1593), + 278: uint16(1243), + 279: uint16(1508), + 280: uint16(1332), + 281: uint16(1350), + 282: uint16(1350), + 283: uint16(1350), + 284: uint16(1350), + 285: uint16(1352), + 286: uint16(1333), + 287: uint16(1331), + 288: uint16(1344), + 289: uint16(1277), + 290: uint16(1250), + 291: uint16(1640), + 292: uint16(1410), + 293: uint16(1399), + 294: uint16(1351), + 295: uint16(1399), + 296: uint16(1637), + 297: uint16(1397), + 298: uint16(1410), + 299: uint16(1410), + 300: uint16(1397), + 301: uint16(1410), + 302: uint16(1351), + 303: uint16(1637), + 304: uint16(1293), + 305: uint16(1615), + 306: uint16(1288), + 307: uint16(1384), + 308: uint16(1384), + 309: uint16(1384), + 310: uint16(1374), + 311: uint16(1374), + 312: uint16(1374), + 313: uint16(1374), + 314: uint16(1378), + 315: uint16(1378), + 316: uint16(1476), + 317: uint16(1351), + 318: uint16(1344), + 319: uint16(1243), + 320: uint16(1640), + 321: uint16(1640), + 322: uint16(1360), + 323: uint16(1360), + 324: uint16(1639), + 325: uint16(1639), + 326: uint16(1360), + 327: uint16(1496), + 328: uint16(1623), + 329: uint16(1419), + 330: uint16(1321), + 331: uint16(1327), + 332: uint16(1327), + 333: uint16(1327), + 334: uint16(1327), + 335: uint16(1360), + 336: uint16(1261), + 337: uint16(1397), + 338: uint16(1623), + 339: uint16(1623), + 340: uint16(1397), + 341: uint16(1419), + 342: uint16(1321), + 343: uint16(1397), + 344: uint16(1321), + 345: uint16(1397), + 346: uint16(1360), + 347: uint16(1261), + 348: uint16(1512), + 349: uint16(1634), + 350: uint16(1360), + 351: uint16(1261), + 352: uint16(1486), + 353: uint16(1360), + 354: uint16(1261), + 355: uint16(1360), + 356: uint16(1261), + 357: uint16(1486), + 358: uint16(1319), + 359: uint16(1319), + 360: uint16(1319), + 361: uint16(1308), + 362: uint16(1243), + 363: uint16(1243), + 364: uint16(1486), + 365: uint16(1319), + 366: uint16(1293), + 367: uint16(1319), + 368: uint16(1308), + 369: uint16(1319), + 370: uint16(1319), + 371: uint16(1582), + 372: uint16(1243), + 373: uint16(1490), + 374: uint16(1490), + 375: uint16(1486), + 376: uint16(1360), + 377: uint16(1574), + 378: uint16(1574), + 379: uint16(1387), + 380: uint16(1387), + 381: uint16(1392), + 382: uint16(1378), + 383: uint16(1481), + 384: uint16(1360), + 385: uint16(1243), + 386: uint16(1392), + 387: uint16(1390), + 388: uint16(1388), + 389: uint16(1397), + 390: uint16(1311), + 391: uint16(1596), + 392: uint16(1596), + 393: uint16(1592), + 394: uint16(1592), + 395: uint16(1592), + 396: uint16(1645), + 397: uint16(1645), + 398: uint16(1545), + 399: uint16(1608), + 400: uint16(1276), + 401: uint16(1276), + 402: uint16(1276), + 403: uint16(1276), + 404: uint16(1608), + 405: uint16(1295), + 406: uint16(1295), + 407: uint16(1277), + 408: uint16(1277), + 409: uint16(1276), + 410: uint16(1608), + 411: uint16(1243), + 412: uint16(1243), + 413: uint16(1243), + 414: uint16(1243), + 415: uint16(1243), + 416: uint16(1243), + 417: uint16(1603), + 418: uint16(1243), + 419: uint16(1540), + 420: uint16(1497), + 421: uint16(1364), + 422: uint16(1243), + 423: uint16(1243), + 424: uint16(1243), + 425: uint16(1243), + 426: uint16(1243), + 427: uint16(1243), + 428: uint16(1243), + 429: uint16(1243), + 430: uint16(1243), + 431: uint16(1243), + 432: uint16(1243), + 433: uint16(1243), + 434: uint16(1243), + 435: uint16(1243), + 436: uint16(1243), + 437: uint16(1243), + 438: uint16(1551), + 439: uint16(1243), + 440: uint16(1243), + 441: uint16(1243), + 442: uint16(1243), + 443: uint16(1243), + 444: uint16(1243), + 445: uint16(1243), + 446: uint16(1243), + 447: uint16(1243), + 448: uint16(1243), + 449: uint16(1424), + 450: uint16(1243), + 451: uint16(1246), + 452: uint16(1542), + 453: uint16(1243), + 454: uint16(1243), + 455: uint16(1243), + 456: uint16(1243), + 457: uint16(1243), + 458: uint16(1243), + 459: uint16(1243), + 460: uint16(1243), + 461: uint16(1401), + 462: uint16(1402), + 463: uint16(1365), + 464: uint16(1243), + 465: uint16(1243), + 466: uint16(1243), + 467: uint16(1243), + 468: uint16(1243), + 469: uint16(1243), + 470: uint16(1243), + 471: uint16(1416), + 472: uint16(1243), + 473: uint16(1243), + 474: uint16(1243), + 475: uint16(1411), + 476: uint16(1243), + 477: uint16(1243), + 478: uint16(1243), + 479: uint16(1243), + 480: uint16(1243), + 481: uint16(1243), + 482: uint16(1243), + 483: uint16(1243), + 484: uint16(1636), + 485: uint16(1243), + 486: uint16(1243), + 487: uint16(1243), + 488: uint16(1243), + 489: uint16(1243), + 490: uint16(1243), + 491: uint16(1511), + 492: uint16(1510), + 493: uint16(1243), + 494: uint16(1243), + 495: uint16(1362), + 496: uint16(1243), + 497: uint16(1243), + 498: uint16(1243), + 499: uint16(1243), + 500: uint16(1243), + 501: uint16(1243), + 502: uint16(1243), + 503: uint16(1243), + 504: uint16(1243), + 505: uint16(1243), + 506: uint16(1243), + 507: uint16(1243), + 508: uint16(1243), + 509: uint16(1291), + 510: uint16(1243), + 511: uint16(1243), + 512: uint16(1243), + 513: uint16(1243), + 514: uint16(1243), + 515: uint16(1243), + 516: uint16(1243), + 517: uint16(1243), + 518: uint16(1243), + 519: uint16(1243), + 520: uint16(1243), + 521: uint16(1243), + 522: uint16(1243), + 523: uint16(1243), + 524: uint16(1243), + 525: uint16(1243), + 526: uint16(1243), + 527: uint16(1243), + 528: uint16(1243), + 529: uint16(1243), + 530: uint16(1243), + 531: uint16(1243), + 532: uint16(1243), + 533: uint16(1389), + 534: uint16(1243), + 535: uint16(1243), + 536: uint16(1243), + 537: uint16(1243), + 538: uint16(1243), + 539: uint16(1243), + 540: uint16(1243), + 541: uint16(1243), + 542: uint16(1243), + 543: uint16(1243), + 544: uint16(1243), + 545: uint16(1243), + 546: uint16(1243), + 547: uint16(1243), + 548: uint16(1579), + 549: uint16(1379), + 550: uint16(1243), + 551: uint16(1243), + 552: uint16(1243), + 553: uint16(1243), + 554: uint16(1627), + 555: uint16(1243), + 556: uint16(1243), + 557: uint16(1243), + 558: uint16(1243), + 559: uint16(1243), + 560: uint16(1243), + 561: uint16(1243), + 562: uint16(1243), + 563: uint16(1243), + 564: uint16(1243), + 565: uint16(1243), + 566: uint16(1243), + 567: uint16(1243), + 568: uint16(1243), + 569: uint16(1619), + 570: uint16(1335), + 571: uint16(1425), + 572: uint16(1243), + 573: uint16(1428), + 574: uint16(1265), + 575: uint16(1243), + 576: uint16(1255), + 577: uint16(1243), + 578: uint16(1243), +} + +/********** End of lemon-generated parsing tables *****************************/ + +// C documentation +// +// /* The next table maps tokens (terminal symbols) into fallback tokens. +// ** If a construct like the following: +// ** +// ** %fallback ID X Y Z. +// ** +// ** appears in the grammar, then ID becomes a fallback token for X, Y, +// ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +// ** but it does not parse, the type of the token is changed to ID and +// ** the parse is retried before an error is thrown. +// ** +// ** This feature can be used, for example, to cause some keywords in a language +// ** to revert to identifiers if they keyword does not apply in the context where +// ** it appears. +// */ +var _yyFallback = [185]uint16{ + 2: uint16(59), + 3: uint16(59), + 4: uint16(59), + 5: uint16(59), + 7: uint16(59), + 8: uint16(59), + 9: uint16(59), + 11: uint16(59), + 12: uint16(59), + 13: uint16(59), + 14: uint16(59), + 18: uint16(59), + 21: uint16(59), + 26: uint16(59), + 27: uint16(59), + 28: uint16(59), + 29: uint16(59), + 30: uint16(59), + 31: uint16(59), + 32: uint16(59), + 33: uint16(59), + 34: uint16(59), + 35: uint16(59), + 36: uint16(59), + 37: uint16(59), + 38: uint16(59), + 39: uint16(59), + 40: uint16(59), + 41: uint16(59), + 42: uint16(59), + 46: uint16(59), + 47: uint16(59), + 60: uint16(59), + 61: uint16(59), + 62: uint16(59), + 63: uint16(59), + 64: uint16(59), + 65: uint16(59), + 66: uint16(59), + 67: uint16(59), + 68: uint16(59), + 69: uint16(59), + 70: uint16(59), + 71: uint16(59), + 72: uint16(59), + 73: uint16(59), + 74: uint16(59), + 75: uint16(59), + 76: uint16(59), + 77: uint16(59), + 78: uint16(59), + 79: uint16(59), + 80: uint16(59), + 81: uint16(59), + 82: uint16(59), + 83: uint16(59), + 84: uint16(59), + 85: uint16(59), + 86: uint16(59), + 87: uint16(59), + 88: uint16(59), + 89: uint16(59), + 90: uint16(59), + 91: uint16(59), + 92: uint16(59), + 93: uint16(59), + 94: uint16(59), + 95: uint16(59), + 96: uint16(59), + 97: uint16(59), + 98: uint16(59), + 99: uint16(59), + 100: uint16(59), +} + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. + */ +type TyyStackEntry1 = struct { + Fstateno uint16 + Fmajor uint16 + Fminor TYYMINORTYPE +} + +type yyStackEntry1 = TyyStackEntry1 + +type TyyStackEntry = struct { + Fstateno uint16 + Fmajor uint16 + Fminor TYYMINORTYPE +} + +type yyStackEntry = TyyStackEntry + +/* The state of the parser is completely contained in an instance of +** the following structure */ +type TyyParser1 = struct { + Fyytos uintptr + FpParse uintptr + Fyystack [100]TyyStackEntry + FyystackEnd uintptr +} + +type yyParser1 = TyyParser1 + +type TyyParser = struct { + Fyytos uintptr + FpParse uintptr + Fyystack [100]TyyStackEntry + FyystackEnd uintptr +} + +type yyParser = TyyParser + +/* #include */ + +/* Datatype of the argument to the memory allocated passed as the +** second argument to sqlite3ParserAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. + */ + +// C documentation +// +// /* Initialize a new parser that has already been allocated. +// */ +func _sqlite3ParserInit(tls *libc.TLS, yypRawParser uintptr, pParse uintptr) { + var yypParser uintptr + _ = yypParser + yypParser = yypRawParser + (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse + (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos = yypParser + 16 + (*(*TyyStackEntry)(unsafe.Pointer(yypParser + 16))).Fstateno = uint16(0) + (*(*TyyStackEntry)(unsafe.Pointer(yypParser + 16))).Fmajor = uint16(0) + (*TyyParser)(unsafe.Pointer(yypParser)).FyystackEnd = yypParser + 16 + uintptr(libc.Int32FromInt32(YYSTACKDEPTH)-libc.Int32FromInt32(1))*24 +} + +// C documentation +// +// /* The following function deletes the "minor type" or semantic value +// ** associated with a symbol. The symbol can be either a terminal +// ** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +// ** a pointer to the value to be deleted. The code used to do the +// ** deletions is derived from the %destructor and/or %token_destructor +// ** directives of the input grammar. +// */ +func _yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor uintptr) { + var pParse uintptr + _ = pParse + pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse + switch int32(yymajor) { + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ + /********* Begin destructor definitions ***************************************/ + case int32(204): /* select */ + fallthrough + case int32(239): /* selectnowith */ + fallthrough + case int32(240): /* oneselect */ + fallthrough + case int32(252): /* values */ + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(216): /* term */ + fallthrough + case int32(217): /* expr */ + fallthrough + case int32(246): /* where_opt */ + fallthrough + case int32(248): /* having_opt */ + fallthrough + case int32(267): /* where_opt_ret */ + fallthrough + case int32(278): /* case_operand */ + fallthrough + case int32(280): /* case_else */ + fallthrough + case int32(283): /* vinto */ + fallthrough + case int32(290): /* when_clause */ + fallthrough + case int32(295): /* key_opt */ + fallthrough + case int32(311): /* filter_clause */ + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(221): /* eidlist_opt */ + fallthrough + case int32(231): /* sortlist */ + fallthrough + case int32(232): /* eidlist */ + fallthrough + case int32(244): /* selcollist */ + fallthrough + case int32(247): /* groupby_opt */ + fallthrough + case int32(249): /* orderby_opt */ + fallthrough + case int32(253): /* nexprlist */ + fallthrough + case int32(254): /* sclp */ + fallthrough + case int32(261): /* exprlist */ + fallthrough + case int32(268): /* setlist */ + fallthrough + case int32(277): /* paren_exprlist */ + fallthrough + case int32(279): /* case_exprlist */ + fallthrough + case int32(310): /* part_opt */ + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(238): /* fullname */ + fallthrough + case int32(245): /* from */ + fallthrough + case int32(256): /* seltablist */ + fallthrough + case int32(257): /* stl_prefix */ + fallthrough + case int32(262): /* xfullname */ + _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(241): /* wqlist */ + _sqlite3WithDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(251): /* window_clause */ + fallthrough + case int32(306): /* windowdefn_list */ + _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(263): /* idlist */ + fallthrough + case int32(270): /* idlist_opt */ + _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(273): /* filter_over */ + fallthrough + case int32(307): /* windowdefn */ + fallthrough + case int32(308): /* window */ + fallthrough + case int32(309): /* frame_opt */ + fallthrough + case int32(312): /* over_clause */ + _sqlite3WindowDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(286): /* trigger_cmd_list */ + fallthrough + case int32(291): /* trigger_cmd */ + _sqlite3DeleteTriggerStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor))) + case int32(288): /* trigger_event */ + _sqlite3IdListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TTrigEvent)(unsafe.Pointer(yypminor))).Fb) + case int32(314): /* frame_bound */ + fallthrough + case int32(315): /* frame_bound_s */ + fallthrough + case int32(316): /* frame_bound_e */ + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*(*TFrameBound)(unsafe.Pointer(yypminor))).FpExpr) + break + /********* End destructor definitions *****************************************/ + fallthrough + default: + break /* If no destructor action specified: do nothing */ + } +} + +// C documentation +// +// /* +// ** Pop the parser's stack once. +// ** +// ** If there is a destructor routine associated with the token which +// ** is popped from the stack, then call it. +// */ +func _yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { + var yytos, v1, v2 uintptr + _, _, _ = yytos, v1, v2 + v2 = pParser + v1 = *(*uintptr)(unsafe.Pointer(v2)) + *(*uintptr)(unsafe.Pointer(v2)) -= 24 + yytos = v1 + _yy_destructor(tls, pParser, (*TyyStackEntry)(unsafe.Pointer(yytos)).Fmajor, yytos+8) +} + +// C documentation +// +// /* +// ** Clear all secondary memory allocations from the parser +// */ +func _sqlite3ParserFinalize(tls *libc.TLS, p uintptr) { + var pParser uintptr + _ = pParser + pParser = p + for (*TyyParser)(unsafe.Pointer(pParser)).Fyytos > pParser+16 { + _yy_pop_parser_stack(tls, pParser) + } +} + +/* +** Return the peak depth of the stack for a parser. + */ + +/* This array of booleans keeps track of the parser statement +** coverage. The element yycoverage[X][Y] is set when the parser +** is in state X and has a lookahead token Y. In a well-tested +** systems, every element of this matrix should end up being set. + */ + +/* +** Write into out a description of every state/lookahead combination that +** +** (1) has not been used by the parser, and +** (2) is not a syntax error. +** +** Return the number of missed state/lookahead combinations. + */ + +// C documentation +// +// /* +// ** Find the appropriate action for a parser given the terminal +// ** look-ahead token iLookAhead. +// */ +func _yy_find_shift_action(tls *libc.TLS, iLookAhead uint16, stateno uint16) (r uint16) { + var i, j int32 + var iFallback uint16 + _, _, _ = i, iFallback, j + if int32(stateno) > int32(YY_MAX_SHIFT) { + return stateno + } + for cond := true; cond; cond = int32(1) != 0 { + i = int32(_yy_shift_ofst[stateno]) + i += int32(iLookAhead) + if int32(_yy_lookahead[i]) != int32(iLookAhead) { /* Fallback token */ + iFallback = _yyFallback[iLookAhead] + if int32(iFallback) != 0 { + /* Fallback loop must terminate */ + iLookAhead = iFallback + continue + } + j = i - int32(iLookAhead) + int32(YYWILDCARD) + if int32(_yy_lookahead[j]) == int32(YYWILDCARD) && int32(iLookAhead) > 0 { + return _yy_action[j] + } + return _yy_default[stateno] + } else { + return _yy_action[i] + } + } + return r +} + +// C documentation +// +// /* +// ** Find the appropriate action for a parser given the non-terminal +// ** look-ahead token iLookAhead. +// */ +func _yy_find_reduce_action(tls *libc.TLS, stateno uint16, iLookAhead uint16) (r uint16) { + var i int32 + _ = i + i = int32(_yy_reduce_ofst[stateno]) + i += int32(iLookAhead) + return _yy_action[i] +} + +// C documentation +// +// /* +// ** The following routine is called if the stack overflows. +// */ +func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { + var pParse uintptr + _ = pParse + pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse + for (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos > yypParser+16 { + _yy_pop_parser_stack(tls, yypParser) + } + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + /******** Begin %stack_overflow code ******************************************/ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23368, 0) + /******** End %stack_overflow code ********************************************/ + /* Suppress warning about unused %extra_argument var */ + (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +/* +** Print tracing information for a SHIFT action + */ + +// C documentation +// +// /* +// ** Perform a shift action. +// */ +func _yy_shift(tls *libc.TLS, yypParser uintptr, yyNewState uint16, yyMajor uint16, yyMinor TToken) { + var yytos uintptr + _ = yytos + (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos += 24 + if (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos > (*TyyParser)(unsafe.Pointer(yypParser)).FyystackEnd { + (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos -= 24 + _yyStackOverflow(tls, yypParser) + return + } + if int32(yyNewState) > int32(YY_MAX_SHIFT) { + yyNewState = uint16(int32(yyNewState) + (libc.Int32FromInt32(YY_MIN_REDUCE) - libc.Int32FromInt32(YY_MIN_SHIFTREDUCE))) + } + yytos = (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos + (*TyyStackEntry)(unsafe.Pointer(yytos)).Fstateno = yyNewState + (*TyyStackEntry)(unsafe.Pointer(yytos)).Fmajor = yyMajor + *(*TToken)(unsafe.Pointer(yytos + 8)) = yyMinor +} + +// C documentation +// +// /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +// ** of that rule */ +var _yyRuleInfoLhs = [405]uint16{ + 0: uint16(189), + 1: uint16(189), + 2: uint16(188), + 3: uint16(190), + 4: uint16(191), + 5: uint16(191), + 6: uint16(191), + 7: uint16(191), + 8: uint16(190), + 9: uint16(190), + 10: uint16(190), + 11: uint16(190), + 12: uint16(190), + 13: uint16(195), + 14: uint16(197), + 15: uint16(199), + 16: uint16(199), + 17: uint16(198), + 18: uint16(198), + 19: uint16(196), + 20: uint16(196), + 21: uint16(203), + 22: uint16(203), + 23: uint16(205), + 24: uint16(205), + 25: uint16(206), + 26: uint16(208), + 27: uint16(208), + 28: uint16(208), + 29: uint16(209), + 30: uint16(213), + 31: uint16(214), + 32: uint16(215), + 33: uint16(215), + 34: uint16(215), + 35: uint16(215), + 36: uint16(215), + 37: uint16(215), + 38: uint16(215), + 39: uint16(215), + 40: uint16(215), + 41: uint16(215), + 42: uint16(215), + 43: uint16(215), + 44: uint16(215), + 45: uint16(224), + 46: uint16(224), + 47: uint16(220), + 48: uint16(220), + 49: uint16(222), + 50: uint16(222), + 51: uint16(225), + 52: uint16(225), + 53: uint16(225), + 54: uint16(225), + 55: uint16(226), + 56: uint16(226), + 57: uint16(226), + 58: uint16(226), + 59: uint16(226), + 60: uint16(223), + 61: uint16(223), + 62: uint16(227), + 63: uint16(227), + 64: uint16(227), + 65: uint16(202), + 66: uint16(229), + 67: uint16(230), + 68: uint16(230), + 69: uint16(230), + 70: uint16(230), + 71: uint16(230), + 72: uint16(233), + 73: uint16(218), + 74: uint16(218), + 75: uint16(234), + 76: uint16(234), + 77: uint16(235), + 78: uint16(235), + 79: uint16(190), + 80: uint16(237), + 81: uint16(237), + 82: uint16(190), + 83: uint16(190), + 84: uint16(190), + 85: uint16(204), + 86: uint16(204), + 87: uint16(204), + 88: uint16(239), + 89: uint16(242), + 90: uint16(242), + 91: uint16(242), + 92: uint16(240), + 93: uint16(240), + 94: uint16(252), + 95: uint16(252), + 96: uint16(243), + 97: uint16(243), + 98: uint16(243), + 99: uint16(254), + 100: uint16(244), + 101: uint16(244), + 102: uint16(244), + 103: uint16(255), + 104: uint16(255), + 105: uint16(245), + 106: uint16(245), + 107: uint16(257), + 108: uint16(257), + 109: uint16(256), + 110: uint16(256), + 111: uint16(256), + 112: uint16(256), + 113: uint16(256), + 114: uint16(200), + 115: uint16(200), + 116: uint16(238), + 117: uint16(238), + 118: uint16(262), + 119: uint16(262), + 120: uint16(262), + 121: uint16(262), + 122: uint16(258), + 123: uint16(258), + 124: uint16(258), + 125: uint16(258), + 126: uint16(259), + 127: uint16(259), + 128: uint16(259), + 129: uint16(264), + 130: uint16(260), + 131: uint16(260), + 132: uint16(249), + 133: uint16(249), + 134: uint16(231), + 135: uint16(231), + 136: uint16(219), + 137: uint16(219), + 138: uint16(219), + 139: uint16(265), + 140: uint16(265), + 141: uint16(265), + 142: uint16(247), + 143: uint16(247), + 144: uint16(248), + 145: uint16(248), + 146: uint16(250), + 147: uint16(250), + 148: uint16(250), + 149: uint16(250), + 150: uint16(190), + 151: uint16(246), + 152: uint16(246), + 153: uint16(267), + 154: uint16(267), + 155: uint16(267), + 156: uint16(267), + 157: uint16(190), + 158: uint16(268), + 159: uint16(268), + 160: uint16(268), + 161: uint16(268), + 162: uint16(190), + 163: uint16(190), + 164: uint16(271), + 165: uint16(271), + 166: uint16(271), + 167: uint16(271), + 168: uint16(271), + 169: uint16(271), + 170: uint16(272), + 171: uint16(269), + 172: uint16(269), + 173: uint16(270), + 174: uint16(270), + 175: uint16(263), + 176: uint16(263), + 177: uint16(217), + 178: uint16(217), + 179: uint16(217), + 180: uint16(217), + 181: uint16(216), + 182: uint16(216), + 183: uint16(216), + 184: uint16(217), + 185: uint16(217), + 186: uint16(217), + 187: uint16(217), + 188: uint16(217), + 189: uint16(217), + 190: uint16(217), + 191: uint16(217), + 192: uint16(217), + 193: uint16(216), + 194: uint16(217), + 195: uint16(217), + 196: uint16(217), + 197: uint16(217), + 198: uint16(217), + 199: uint16(217), + 200: uint16(217), + 201: uint16(217), + 202: uint16(217), + 203: uint16(274), + 204: uint16(217), + 205: uint16(217), + 206: uint16(217), + 207: uint16(217), + 208: uint16(217), + 209: uint16(217), + 210: uint16(217), + 211: uint16(217), + 212: uint16(217), + 213: uint16(217), + 214: uint16(217), + 215: uint16(217), + 216: uint16(275), + 217: uint16(275), + 218: uint16(217), + 219: uint16(276), + 220: uint16(276), + 221: uint16(217), + 222: uint16(217), + 223: uint16(217), + 224: uint16(217), + 225: uint16(217), + 226: uint16(217), + 227: uint16(279), + 228: uint16(279), + 229: uint16(280), + 230: uint16(280), + 231: uint16(278), + 232: uint16(261), + 233: uint16(253), + 234: uint16(253), + 235: uint16(277), + 236: uint16(277), + 237: uint16(190), + 238: uint16(281), + 239: uint16(281), + 240: uint16(221), + 241: uint16(221), + 242: uint16(232), + 243: uint16(232), + 244: uint16(282), + 245: uint16(282), + 246: uint16(190), + 247: uint16(190), + 248: uint16(190), + 249: uint16(283), + 250: uint16(283), + 251: uint16(190), + 252: uint16(190), + 253: uint16(190), + 254: uint16(190), + 255: uint16(190), + 256: uint16(211), + 257: uint16(212), + 258: uint16(190), + 259: uint16(285), + 260: uint16(287), + 261: uint16(287), + 262: uint16(287), + 263: uint16(288), + 264: uint16(288), + 265: uint16(288), + 266: uint16(290), + 267: uint16(290), + 268: uint16(286), + 269: uint16(286), + 270: uint16(292), + 271: uint16(293), + 272: uint16(293), + 273: uint16(291), + 274: uint16(291), + 275: uint16(291), + 276: uint16(291), + 277: uint16(217), + 278: uint16(217), + 279: uint16(236), + 280: uint16(236), + 281: uint16(236), + 282: uint16(190), + 283: uint16(190), + 284: uint16(190), + 285: uint16(295), + 286: uint16(295), + 287: uint16(190), + 288: uint16(190), + 289: uint16(190), + 290: uint16(190), + 291: uint16(190), + 292: uint16(190), + 293: uint16(190), + 294: uint16(296), + 295: uint16(190), + 296: uint16(190), + 297: uint16(190), + 298: uint16(298), + 299: uint16(300), + 300: uint16(301), + 301: uint16(301), + 302: uint16(302), + 303: uint16(266), + 304: uint16(266), + 305: uint16(305), + 306: uint16(305), + 307: uint16(305), + 308: uint16(304), + 309: uint16(241), + 310: uint16(241), + 311: uint16(306), + 312: uint16(307), + 313: uint16(308), + 314: uint16(308), + 315: uint16(308), + 316: uint16(308), + 317: uint16(308), + 318: uint16(309), + 319: uint16(309), + 320: uint16(309), + 321: uint16(313), + 322: uint16(315), + 323: uint16(315), + 324: uint16(316), + 325: uint16(316), + 326: uint16(314), + 327: uint16(314), + 328: uint16(317), + 329: uint16(317), + 330: uint16(318), + 331: uint16(318), + 332: uint16(318), + 333: uint16(251), + 334: uint16(273), + 335: uint16(273), + 336: uint16(273), + 337: uint16(312), + 338: uint16(312), + 339: uint16(311), + 340: uint16(185), + 341: uint16(186), + 342: uint16(186), + 343: uint16(187), + 344: uint16(187), + 345: uint16(187), + 346: uint16(192), + 347: uint16(192), + 348: uint16(192), + 349: uint16(194), + 350: uint16(194), + 351: uint16(190), + 352: uint16(203), + 353: uint16(201), + 354: uint16(201), + 355: uint16(193), + 356: uint16(193), + 357: uint16(208), + 358: uint16(209), + 359: uint16(210), + 360: uint16(210), + 361: uint16(207), + 362: uint16(207), + 363: uint16(215), + 364: uint16(215), + 365: uint16(215), + 366: uint16(202), + 367: uint16(228), + 368: uint16(228), + 369: uint16(229), + 370: uint16(233), + 371: uint16(235), + 372: uint16(239), + 373: uint16(240), + 374: uint16(254), + 375: uint16(255), + 376: uint16(264), + 377: uint16(272), + 378: uint16(217), + 379: uint16(274), + 380: uint16(278), + 381: uint16(261), + 382: uint16(284), + 383: uint16(284), + 384: uint16(284), + 385: uint16(284), + 386: uint16(284), + 387: uint16(211), + 388: uint16(289), + 389: uint16(289), + 390: uint16(292), + 391: uint16(293), + 392: uint16(294), + 393: uint16(294), + 394: uint16(297), + 395: uint16(297), + 396: uint16(299), + 397: uint16(299), + 398: uint16(300), + 399: uint16(303), + 400: uint16(303), + 401: uint16(303), + 402: uint16(266), + 403: uint16(306), + 404: uint16(308), +} + +// C documentation +// +// /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +// ** of symbols on the right-hand side of that rule. */ +var _yyRuleInfoNRhs = [405]int8{ + 0: int8(-int32(1)), + 1: int8(-int32(3)), + 2: int8(-int32(1)), + 3: int8(-int32(3)), + 5: int8(-int32(1)), + 6: int8(-int32(1)), + 7: int8(-int32(1)), + 8: int8(-int32(2)), + 9: int8(-int32(2)), + 10: int8(-int32(2)), + 11: int8(-int32(3)), + 12: int8(-int32(5)), + 13: int8(-int32(6)), + 14: int8(-int32(1)), + 16: int8(-int32(3)), + 17: int8(-int32(1)), + 19: int8(-int32(5)), + 20: int8(-int32(2)), + 22: int8(-int32(3)), + 23: int8(-int32(2)), + 24: int8(-int32(1)), + 25: int8(-int32(2)), + 27: int8(-int32(4)), + 28: int8(-int32(6)), + 29: int8(-int32(2)), + 32: int8(-int32(2)), + 33: int8(-int32(3)), + 34: int8(-int32(4)), + 35: int8(-int32(4)), + 36: int8(-int32(4)), + 37: int8(-int32(3)), + 38: int8(-int32(3)), + 39: int8(-int32(5)), + 40: int8(-int32(2)), + 41: int8(-int32(4)), + 42: int8(-int32(4)), + 43: int8(-int32(1)), + 44: int8(-int32(2)), + 45: int8(-int32(3)), + 46: int8(-int32(4)), + 48: int8(-int32(1)), + 50: int8(-int32(2)), + 51: int8(-int32(2)), + 52: int8(-int32(3)), + 53: int8(-int32(3)), + 54: int8(-int32(3)), + 55: int8(-int32(2)), + 56: int8(-int32(2)), + 57: int8(-int32(1)), + 58: int8(-int32(1)), + 59: int8(-int32(2)), + 60: int8(-int32(3)), + 61: int8(-int32(2)), + 63: int8(-int32(2)), + 64: int8(-int32(2)), + 66: int8(-int32(1)), + 67: int8(-int32(2)), + 68: int8(-int32(7)), + 69: int8(-int32(5)), + 70: int8(-int32(5)), + 71: int8(-int32(10)), + 74: int8(-int32(3)), + 76: int8(-int32(2)), + 77: int8(-int32(1)), + 78: int8(-int32(1)), + 79: int8(-int32(4)), + 80: int8(-int32(2)), + 82: int8(-int32(9)), + 83: int8(-int32(4)), + 84: int8(-int32(1)), + 85: int8(-int32(3)), + 86: int8(-int32(4)), + 87: int8(-int32(1)), + 88: int8(-int32(3)), + 89: int8(-int32(1)), + 90: int8(-int32(2)), + 91: int8(-int32(1)), + 92: int8(-int32(9)), + 93: int8(-int32(10)), + 94: int8(-int32(4)), + 95: int8(-int32(5)), + 96: int8(-int32(1)), + 97: int8(-int32(1)), + 100: int8(-int32(5)), + 101: int8(-int32(3)), + 102: int8(-int32(5)), + 103: int8(-int32(2)), + 106: int8(-int32(2)), + 107: int8(-int32(2)), + 109: int8(-int32(5)), + 110: int8(-int32(6)), + 111: int8(-int32(8)), + 112: int8(-int32(6)), + 113: int8(-int32(6)), + 115: int8(-int32(2)), + 116: int8(-int32(1)), + 117: int8(-int32(3)), + 118: int8(-int32(1)), + 119: int8(-int32(3)), + 120: int8(-int32(5)), + 121: int8(-int32(3)), + 122: int8(-int32(1)), + 123: int8(-int32(2)), + 124: int8(-int32(3)), + 125: int8(-int32(4)), + 126: int8(-int32(2)), + 127: int8(-int32(4)), + 130: int8(-int32(3)), + 131: int8(-int32(2)), + 133: int8(-int32(3)), + 134: int8(-int32(5)), + 135: int8(-int32(3)), + 136: int8(-int32(1)), + 137: int8(-int32(1)), + 139: int8(-int32(2)), + 140: int8(-int32(2)), + 143: int8(-int32(3)), + 145: int8(-int32(2)), + 147: int8(-int32(2)), + 148: int8(-int32(4)), + 149: int8(-int32(4)), + 150: int8(-int32(6)), + 152: int8(-int32(2)), + 154: int8(-int32(2)), + 155: int8(-int32(2)), + 156: int8(-int32(4)), + 157: int8(-int32(9)), + 158: int8(-int32(5)), + 159: int8(-int32(7)), + 160: int8(-int32(3)), + 161: int8(-int32(5)), + 162: int8(-int32(7)), + 163: int8(-int32(8)), + 165: int8(-int32(2)), + 166: int8(-int32(12)), + 167: int8(-int32(9)), + 168: int8(-int32(5)), + 169: int8(-int32(8)), + 170: int8(-int32(2)), + 171: int8(-int32(2)), + 172: int8(-int32(1)), + 174: int8(-int32(3)), + 175: int8(-int32(3)), + 176: int8(-int32(1)), + 177: int8(-int32(3)), + 178: int8(-int32(1)), + 179: int8(-int32(3)), + 180: int8(-int32(5)), + 181: int8(-int32(1)), + 182: int8(-int32(1)), + 183: int8(-int32(1)), + 184: int8(-int32(1)), + 185: int8(-int32(3)), + 186: int8(-int32(6)), + 187: int8(-int32(5)), + 188: int8(-int32(8)), + 189: int8(-int32(4)), + 190: int8(-int32(6)), + 191: int8(-int32(9)), + 192: int8(-int32(5)), + 193: int8(-int32(1)), + 194: int8(-int32(5)), + 195: int8(-int32(3)), + 196: int8(-int32(3)), + 197: int8(-int32(3)), + 198: int8(-int32(3)), + 199: int8(-int32(3)), + 200: int8(-int32(3)), + 201: int8(-int32(3)), + 202: int8(-int32(3)), + 203: int8(-int32(2)), + 204: int8(-int32(3)), + 205: int8(-int32(5)), + 206: int8(-int32(2)), + 207: int8(-int32(3)), + 208: int8(-int32(3)), + 209: int8(-int32(4)), + 210: int8(-int32(6)), + 211: int8(-int32(5)), + 212: int8(-int32(2)), + 213: int8(-int32(2)), + 214: int8(-int32(2)), + 215: int8(-int32(3)), + 216: int8(-int32(1)), + 217: int8(-int32(2)), + 218: int8(-int32(5)), + 219: int8(-int32(1)), + 220: int8(-int32(2)), + 221: int8(-int32(5)), + 222: int8(-int32(3)), + 223: int8(-int32(5)), + 224: int8(-int32(5)), + 225: int8(-int32(4)), + 226: int8(-int32(5)), + 227: int8(-int32(5)), + 228: int8(-int32(4)), + 229: int8(-int32(2)), + 233: int8(-int32(3)), + 234: int8(-int32(1)), + 236: int8(-int32(3)), + 237: int8(-int32(12)), + 238: int8(-int32(1)), + 241: int8(-int32(3)), + 242: int8(-int32(5)), + 243: int8(-int32(3)), + 245: int8(-int32(2)), + 246: int8(-int32(4)), + 247: int8(-int32(2)), + 248: int8(-int32(3)), + 249: int8(-int32(2)), + 251: int8(-int32(3)), + 252: int8(-int32(5)), + 253: int8(-int32(6)), + 254: int8(-int32(5)), + 255: int8(-int32(6)), + 256: int8(-int32(2)), + 257: int8(-int32(2)), + 258: int8(-int32(5)), + 259: int8(-int32(11)), + 260: int8(-int32(1)), + 261: int8(-int32(2)), + 263: int8(-int32(1)), + 264: int8(-int32(1)), + 265: int8(-int32(3)), + 267: int8(-int32(2)), + 268: int8(-int32(3)), + 269: int8(-int32(2)), + 270: int8(-int32(3)), + 271: int8(-int32(3)), + 272: int8(-int32(2)), + 273: int8(-int32(9)), + 274: int8(-int32(8)), + 275: int8(-int32(6)), + 276: int8(-int32(3)), + 277: int8(-int32(4)), + 278: int8(-int32(6)), + 279: int8(-int32(1)), + 280: int8(-int32(1)), + 281: int8(-int32(1)), + 282: int8(-int32(4)), + 283: int8(-int32(6)), + 284: int8(-int32(3)), + 286: int8(-int32(2)), + 287: int8(-int32(1)), + 288: int8(-int32(3)), + 289: int8(-int32(1)), + 290: int8(-int32(3)), + 291: int8(-int32(6)), + 292: int8(-int32(7)), + 293: int8(-int32(6)), + 294: int8(-int32(1)), + 295: int8(-int32(8)), + 296: int8(-int32(1)), + 297: int8(-int32(4)), + 298: int8(-int32(8)), + 300: int8(-int32(1)), + 301: int8(-int32(3)), + 302: int8(-int32(1)), + 303: int8(-int32(2)), + 304: int8(-int32(3)), + 305: int8(-int32(1)), + 306: int8(-int32(2)), + 307: int8(-int32(3)), + 308: int8(-int32(6)), + 309: int8(-int32(1)), + 310: int8(-int32(3)), + 311: int8(-int32(3)), + 312: int8(-int32(5)), + 313: int8(-int32(5)), + 314: int8(-int32(6)), + 315: int8(-int32(4)), + 316: int8(-int32(5)), + 317: int8(-int32(2)), + 319: int8(-int32(3)), + 320: int8(-int32(6)), + 321: int8(-int32(1)), + 322: int8(-int32(1)), + 323: int8(-int32(2)), + 324: int8(-int32(1)), + 325: int8(-int32(2)), + 326: int8(-int32(2)), + 327: int8(-int32(2)), + 329: int8(-int32(2)), + 330: int8(-int32(2)), + 331: int8(-int32(2)), + 332: int8(-int32(1)), + 333: int8(-int32(2)), + 334: int8(-int32(2)), + 335: int8(-int32(1)), + 336: int8(-int32(1)), + 337: int8(-int32(4)), + 338: int8(-int32(2)), + 339: int8(-int32(5)), + 340: int8(-int32(1)), + 341: int8(-int32(2)), + 342: int8(-int32(1)), + 343: int8(-int32(1)), + 344: int8(-int32(2)), + 345: int8(-int32(3)), + 347: int8(-int32(1)), + 348: int8(-int32(2)), + 349: int8(-int32(1)), + 351: int8(-int32(2)), + 352: int8(-int32(1)), + 353: int8(-int32(4)), + 354: int8(-int32(2)), + 355: int8(-int32(1)), + 356: int8(-int32(1)), + 357: int8(-int32(1)), + 358: int8(-int32(1)), + 359: int8(-int32(1)), + 360: int8(-int32(1)), + 361: int8(-int32(2)), + 363: int8(-int32(2)), + 364: int8(-int32(4)), + 365: int8(-int32(2)), + 366: int8(-int32(2)), + 367: int8(-int32(3)), + 368: int8(-int32(1)), + 370: int8(-int32(1)), + 371: int8(-int32(1)), + 372: int8(-int32(1)), + 373: int8(-int32(1)), + 374: int8(-int32(2)), + 375: int8(-int32(1)), + 376: int8(-int32(1)), + 378: int8(-int32(1)), + 379: int8(-int32(1)), + 380: int8(-int32(1)), + 381: int8(-int32(1)), + 382: int8(-int32(1)), + 383: int8(-int32(1)), + 384: int8(-int32(1)), + 385: int8(-int32(1)), + 386: int8(-int32(1)), + 387: int8(-int32(1)), + 389: int8(-int32(3)), + 390: int8(-int32(1)), + 392: int8(-int32(1)), + 395: int8(-int32(1)), + 396: int8(-int32(1)), + 397: int8(-int32(3)), + 398: int8(-int32(2)), + 400: int8(-int32(4)), + 401: int8(-int32(2)), + 403: int8(-int32(1)), + 404: int8(-int32(1)), +} + +// C documentation +// +// /* +// ** Perform a reduce action and the shift that must immediately +// ** follow the reduce. +// ** +// ** The yyLookahead and yyLookaheadToken parameters provide reduce actions +// ** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +// ** if the lookahead token has already been consumed. As this procedure is +// ** only called from one place, optimizing compilers will in-line it, which +// ** means that the extra parameters have no performance impact. +// */ +func _yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead int32, yyLookaheadToken TToken, pParse uintptr) (r uint16) { + bp := tls.Alloc(144) + defer tls.Free(144) + var bNot, bNot1, nExpr, yygoto, yysize, v344 int32 + var n Tu32 + var p, p1, p2, p3, p4, pDot, pFrom, pFromClause, pLeft, pLeft1, pLhs, pList, pList1, pList2, pList3, pList4, pNew, pOld, pRHS, pRhs, pRight, pRight1, pSelect, pSelectRHS, pSrc, pSubquery, pSubquery1, temp1, temp11, temp2, temp21, temp3, temp4, yymsp, v343, v345, v346, v347, v348 uintptr + var yyact uint16 + var v349 TToken + var _ /* all at bp+104 */ TToken + var _ /* as at bp+72 */ TToken + var _ /* dest at bp+16 */ TSelectDest + var _ /* t at bp+88 */ TToken + var _ /* x at bp+56 */ TToken + var _ /* yylhsminor at bp+0 */ TYYMINORTYPE + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bNot, bNot1, n, nExpr, p, p1, p2, p3, p4, pDot, pFrom, pFromClause, pLeft, pLeft1, pLhs, pList, pList1, pList2, pList3, pList4, pNew, pOld, pRHS, pRhs, pRight, pRight1, pSelect, pSelectRHS, pSrc, pSubquery, pSubquery1, temp1, temp11, temp2, temp21, temp3, temp4, yyact, yygoto, yymsp, yysize, v343, v344, v345, v346, v347, v348, v349 /* Amount to pop the stack */ + _ = yyLookahead + _ = yyLookaheadToken + yymsp = (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos + switch yyruleno { + case uint32(0): + goto _1 + case uint32(1): + goto _2 + case uint32(2): + goto _3 + case uint32(3): + goto _4 + case uint32(4): + goto _5 + case uint32(6): + goto _6 + case uint32(5): + goto _7 + case uint32(7): + goto _8 + case uint32(321): + goto _9 + case uint32(9): + goto _10 + case uint32(8): + goto _11 + case uint32(10): + goto _12 + case uint32(11): + goto _13 + case uint32(12): + goto _14 + case uint32(13): + goto _15 + case uint32(14): + goto _16 + case uint32(18): + goto _17 + case uint32(15): + goto _18 + case uint32(47): + goto _19 + case uint32(62): + goto _20 + case uint32(72): + goto _21 + case uint32(81): + goto _22 + case uint32(98): + goto _23 + case uint32(244): + goto _24 + case uint32(16): + goto _25 + case uint32(17): + goto _26 + case uint32(19): + goto _27 + case uint32(20): + goto _28 + case uint32(21): + goto _29 + case uint32(22): + goto _30 + case uint32(23): + goto _31 + case uint32(24): + goto _32 + case uint32(25): + goto _33 + case uint32(65): + goto _34 + case uint32(26): + goto _35 + case uint32(104): + goto _36 + case uint32(27): + goto _37 + case uint32(28): + goto _38 + case uint32(29): + goto _39 + case uint32(30): + goto _40 + case uint32(31): + goto _41 + case uint32(67): + goto _42 + case uint32(32): + goto _43 + case uint32(33): + goto _44 + case uint32(34): + goto _45 + case uint32(35): + goto _46 + case uint32(36): + goto _47 + case uint32(37): + goto _48 + case uint32(38): + goto _49 + case uint32(39): + goto _50 + case uint32(40): + goto _51 + case uint32(41): + goto _52 + case uint32(42): + goto _53 + case uint32(43): + goto _54 + case uint32(44): + goto _55 + case uint32(45): + goto _56 + case uint32(46): + goto _57 + case uint32(48): + goto _58 + case uint32(49): + goto _59 + case uint32(50): + goto _60 + case uint32(51): + goto _61 + case uint32(52): + goto _62 + case uint32(53): + goto _63 + case uint32(54): + goto _64 + case uint32(55): + goto _65 + case uint32(56): + goto _66 + case uint32(57): + goto _67 + case uint32(58): + goto _68 + case uint32(59): + goto _69 + case uint32(60): + goto _70 + case uint32(76): + goto _71 + case uint32(61): + goto _72 + case uint32(171): + goto _73 + case uint32(80): + goto _74 + case uint32(63): + goto _75 + case uint32(217): + goto _76 + case uint32(220): + goto _77 + case uint32(245): + goto _78 + case uint32(64): + goto _79 + case uint32(66): + goto _80 + case uint32(68): + goto _81 + case uint32(69): + goto _82 + case uint32(70): + goto _83 + case uint32(71): + goto _84 + case uint32(75): + goto _85 + case uint32(73): + goto _86 + case uint32(74): + goto _87 + case uint32(77): + goto _88 + case uint32(172): + goto _89 + case uint32(78): + goto _90 + case uint32(79): + goto _91 + case uint32(82): + goto _92 + case uint32(83): + goto _93 + case uint32(84): + goto _94 + case uint32(85): + goto _95 + case uint32(86): + goto _96 + case uint32(87): + goto _97 + case uint32(88): + goto _98 + case uint32(91): + goto _99 + case uint32(89): + goto _100 + case uint32(90): + goto _101 + case uint32(92): + goto _102 + case uint32(93): + goto _103 + case uint32(94): + goto _104 + case uint32(95): + goto _105 + case uint32(96): + goto _106 + case uint32(97): + goto _107 + case uint32(132): + goto _108 + case uint32(99): + goto _109 + case uint32(142): + goto _110 + case uint32(232): + goto _111 + case uint32(235): + goto _112 + case uint32(240): + goto _113 + case uint32(100): + goto _114 + case uint32(101): + goto _115 + case uint32(102): + goto _116 + case uint32(115): + goto _117 + case uint32(103): + goto _118 + case uint32(256): + goto _119 + case uint32(257): + goto _120 + case uint32(108): + goto _121 + case uint32(105): + goto _122 + case uint32(106): + goto _123 + case uint32(107): + goto _124 + case uint32(109): + goto _125 + case uint32(110): + goto _126 + case uint32(111): + goto _127 + case uint32(112): + goto _128 + case uint32(113): + goto _129 + case uint32(129): + goto _130 + case uint32(114): + goto _131 + case uint32(116): + goto _132 + case uint32(117): + goto _133 + case uint32(118): + goto _134 + case uint32(119): + goto _135 + case uint32(120): + goto _136 + case uint32(121): + goto _137 + case uint32(122): + goto _138 + case uint32(123): + goto _139 + case uint32(124): + goto _140 + case uint32(125): + goto _141 + case uint32(126): + goto _142 + case uint32(127): + goto _143 + case uint32(128): + goto _144 + case uint32(130): + goto _145 + case uint32(131): + goto _146 + case uint32(143): + goto _147 + case uint32(133): + goto _148 + case uint32(134): + goto _149 + case uint32(135): + goto _150 + case uint32(136): + goto _151 + case uint32(137): + goto _152 + case uint32(141): + goto _153 + case uint32(138): + goto _154 + case uint32(139): + goto _155 + case uint32(140): + goto _156 + case uint32(146): + goto _157 + case uint32(144): + goto _158 + case uint32(151): + goto _159 + case uint32(153): + goto _160 + case uint32(230): + goto _161 + case uint32(231): + goto _162 + case uint32(250): + goto _163 + case uint32(152): + goto _164 + case uint32(145): + goto _165 + case uint32(154): + goto _166 + case uint32(229): + goto _167 + case uint32(249): + goto _168 + case uint32(147): + goto _169 + case uint32(148): + goto _170 + case uint32(149): + goto _171 + case uint32(150): + goto _172 + case uint32(155): + goto _173 + case uint32(156): + goto _174 + case uint32(157): + goto _175 + case uint32(158): + goto _176 + case uint32(159): + goto _177 + case uint32(160): + goto _178 + case uint32(161): + goto _179 + case uint32(162): + goto _180 + case uint32(163): + goto _181 + case uint32(164): + goto _182 + case uint32(165): + goto _183 + case uint32(166): + goto _184 + case uint32(167): + goto _185 + case uint32(168): + goto _186 + case uint32(169): + goto _187 + case uint32(170): + goto _188 + case uint32(173): + goto _189 + case uint32(174): + goto _190 + case uint32(175): + goto _191 + case uint32(176): + goto _192 + case uint32(177): + goto _193 + case uint32(178): + goto _194 + case uint32(179): + goto _195 + case uint32(180): + goto _196 + case uint32(182): + goto _197 + case uint32(181): + goto _198 + case uint32(183): + goto _199 + case uint32(184): + goto _200 + case uint32(185): + goto _201 + case uint32(186): + goto _202 + case uint32(187): + goto _203 + case uint32(188): + goto _204 + case uint32(189): + goto _205 + case uint32(190): + goto _206 + case uint32(191): + goto _207 + case uint32(192): + goto _208 + case uint32(193): + goto _209 + case uint32(194): + goto _210 + case uint32(195): + goto _211 + case uint32(197): + goto _212 + case uint32(196): + goto _213 + case uint32(198): + goto _214 + case uint32(199): + goto _215 + case uint32(200): + goto _216 + case uint32(201): + goto _217 + case uint32(202): + goto _218 + case uint32(203): + goto _219 + case uint32(204): + goto _220 + case uint32(205): + goto _221 + case uint32(206): + goto _222 + case uint32(207): + goto _223 + case uint32(208): + goto _224 + case uint32(209): + goto _225 + case uint32(210): + goto _226 + case uint32(211): + goto _227 + case uint32(213): + goto _228 + case uint32(212): + goto _229 + case uint32(214): + goto _230 + case uint32(215): + goto _231 + case uint32(219): + goto _232 + case uint32(216): + goto _233 + case uint32(218): + goto _234 + case uint32(221): + goto _235 + case uint32(222): + goto _236 + case uint32(223): + goto _237 + case uint32(224): + goto _238 + case uint32(225): + goto _239 + case uint32(226): + goto _240 + case uint32(227): + goto _241 + case uint32(228): + goto _242 + case uint32(233): + goto _243 + case uint32(234): + goto _244 + case uint32(241): + goto _245 + case uint32(236): + goto _246 + case uint32(237): + goto _247 + case uint32(280): + goto _248 + case uint32(238): + goto _249 + case uint32(239): + goto _250 + case uint32(242): + goto _251 + case uint32(243): + goto _252 + case uint32(246): + goto _253 + case uint32(247): + goto _254 + case uint32(248): + goto _255 + case uint32(251): + goto _256 + case uint32(252): + goto _257 + case uint32(253): + goto _258 + case uint32(254): + goto _259 + case uint32(255): + goto _260 + case uint32(258): + goto _261 + case uint32(259): + goto _262 + case uint32(260): + goto _263 + case uint32(261): + goto _264 + case uint32(262): + goto _265 + case uint32(264): + goto _266 + case uint32(263): + goto _267 + case uint32(265): + goto _268 + case uint32(285): + goto _269 + case uint32(266): + goto _270 + case uint32(286): + goto _271 + case uint32(267): + goto _272 + case uint32(268): + goto _273 + case uint32(269): + goto _274 + case uint32(270): + goto _275 + case uint32(271): + goto _276 + case uint32(272): + goto _277 + case uint32(273): + goto _278 + case uint32(274): + goto _279 + case uint32(275): + goto _280 + case uint32(276): + goto _281 + case uint32(277): + goto _282 + case uint32(278): + goto _283 + case uint32(279): + goto _284 + case uint32(281): + goto _285 + case uint32(282): + goto _286 + case uint32(283): + goto _287 + case uint32(284): + goto _288 + case uint32(287): + goto _289 + case uint32(288): + goto _290 + case uint32(289): + goto _291 + case uint32(290): + goto _292 + case uint32(291): + goto _293 + case uint32(292): + goto _294 + case uint32(293): + goto _295 + case uint32(294): + goto _296 + case uint32(295): + goto _297 + case uint32(296): + goto _298 + case uint32(297): + goto _299 + case uint32(298): + goto _300 + case uint32(299): + goto _301 + case uint32(301): + goto _302 + case uint32(300): + goto _303 + case uint32(302): + goto _304 + case uint32(304): + goto _305 + case uint32(303): + goto _306 + case uint32(305): + goto _307 + case uint32(306): + goto _308 + case uint32(307): + goto _309 + case uint32(308): + goto _310 + case uint32(309): + goto _311 + case uint32(310): + goto _312 + case uint32(311): + goto _313 + case uint32(312): + goto _314 + case uint32(313): + goto _315 + case uint32(314): + goto _316 + case uint32(315): + goto _317 + case uint32(316): + goto _318 + case uint32(317): + goto _319 + case uint32(318): + goto _320 + case uint32(319): + goto _321 + case uint32(320): + goto _322 + case uint32(324): + goto _323 + case uint32(322): + goto _324 + case uint32(325): + goto _325 + case uint32(323): + goto _326 + case uint32(327): + goto _327 + case uint32(326): + goto _328 + case uint32(328): + goto _329 + case uint32(329): + goto _330 + case uint32(331): + goto _331 + case uint32(330): + goto _332 + case uint32(332): + goto _333 + case uint32(333): + goto _334 + case uint32(334): + goto _335 + case uint32(335): + goto _336 + case uint32(336): + goto _337 + case uint32(337): + goto _338 + case uint32(338): + goto _339 + case uint32(339): + goto _340 + default: + goto _341 + } + goto _342 +_1: + ; /* explain ::= EXPLAIN */ + if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(1) + } + goto _342 +_2: + ; /* explain ::= EXPLAIN QUERY PLAN */ + if (*TParse)(unsafe.Pointer(pParse)).FpReprepare == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).Fexplain = uint8(2) + } + goto _342 +_3: + ; /* cmdx ::= cmd */ + _sqlite3FinishCoding(tls, pParse) + goto _342 +_4: + ; /* cmd ::= BEGIN transtype trans_opt */ + _sqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_5: + ; /* transtype ::= */ + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_DEFERRED) + goto _342 +_7: + ; /* transtype ::= DEFERRED */ +_6: + ; +_8: + ; +_9: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ + goto _342 +_11: + ; /* cmd ::= COMMIT|END trans_opt */ +_10: + ; + _sqlite3EndTransaction(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor)) + goto _342 +_12: + ; /* cmd ::= SAVEPOINT nm */ + _sqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, yymsp+8) + goto _342 +_13: + ; /* cmd ::= RELEASE savepoint_opt nm */ + _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_RELEASE), yymsp+8) + goto _342 +_14: + ; /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ + _sqlite3Savepoint(tls, pParse, int32(SAVEPOINT_ROLLBACK), yymsp+8) + goto _342 +_15: + ; /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ + _sqlite3StartTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + goto _342 +_16: + ; /* createkw ::= CREATE */ + _disableLookaside(tls, pParse) + goto _342 +_18: + ; /* ifnotexists ::= */ +_17: + ; +_19: + ; +_20: + ; +_21: + ; +_22: + ; +_23: + ; +_24: + ; + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = 0 + goto _342 +_25: + ; /* ifnotexists ::= IF NOT EXISTS */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(1) + goto _342 +_26: + ; /* temp ::= TEMP */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0) + goto _342 +_27: + ; /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ + _sqlite3EndTable(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*Tu32)(unsafe.Pointer(yymsp + 8)), uintptr(0)) + goto _342 +_28: + ; /* create_table_args ::= AS select */ + _sqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint32(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_29: + ; /* table_option_set ::= */ + *(*Tu32)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint32(0) + goto _342 +_30: + ; /* table_option_set ::= table_option_set COMMA table_option */ + *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) | *(*Tu32)(unsafe.Pointer(yymsp + 8)) + *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_31: + ; /* table_option ::= WITHOUT nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(5) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16726, int32(5)) == 0 { + *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(libc.Int32FromInt32(TF_WithoutRowid) | libc.Int32FromInt32(TF_NoVisibleRowid)) + } else { + *(*Tu32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint32(0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23390, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + } + goto _342 +_32: + ; /* table_option ::= nm */ + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) == uint32(6) && Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(yymsp + 8)), __ccgo_ts+16639, int32(6)) == 0 { + *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(TF_Strict) + } else { + *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = uint32(0) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23390, libc.VaList(bp+128, *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)))) + } + *(*Tu32)(unsafe.Pointer(yymsp + 8)) = *(*Tu32)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_33: + ; /* columnname ::= nm typetoken */ + _sqlite3AddColumn(tls, pParse, *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*TToken)(unsafe.Pointer(yymsp + 8))) + goto _342 +_35: + ; /* typetoken ::= */ +_34: + ; +_36: + ; + *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_37: + ; /* typetoken ::= typename LP signed RP */ + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + goto _342 +_38: + ; /* typetoken ::= typename LP signed COMMA signed RP */ + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8 + 8)) = uint32(int32(t__predefined_ptrdiff_t(*(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) - int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))))) + goto _342 +_39: + ; /* typename ::= typename ID|STRING */ + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + goto _342 +_40: + ; /* scanpt ::= */ + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken.Fz + goto _342 +_41: + ; /* scantok ::= */ + *(*TToken)(unsafe.Pointer(yymsp + 1*24 + 8)) = yyLookaheadToken + goto _342 +_43: + ; /* ccons ::= CONSTRAINT nm */ +_42: + ; + (*TParse)(unsafe.Pointer(pParse)).FconstraintName = *(*TToken)(unsafe.Pointer(yymsp + 8)) + goto _342 +_44: + ; /* ccons ::= DEFAULT scantok term */ + _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) + goto _342 +_45: + ; /* ccons ::= DEFAULT LP expr RP */ + _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))+uintptr(1), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_46: + ; /* ccons ::= DEFAULT PLUS scantok term */ + _sqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) + goto _342 +_47: + ; /* ccons ::= DEFAULT MINUS scantok term */ + p = _sqlite3PExpr(tls, pParse, int32(TK_UMINUS), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) + _sqlite3AddDefaultValue(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)))) + goto _342 +_48: + ; /* ccons ::= DEFAULT scantok ID|INDEXED */ + p1 = _tokenExpr(tls, pParse, int32(TK_STRING), *(*TToken)(unsafe.Pointer(yymsp + 8))) + if p1 != 0 { + _sqlite3ExprIdToTrueFalse(tls, p1) + } + _sqlite3AddDefaultValue(tls, pParse, p1, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))+uintptr(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) + goto _342 +_49: + ; /* ccons ::= NOT NULL onconf */ + _sqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_50: + ; /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ + _sqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + goto _342 +_51: + ; /* ccons ::= UNIQUE onconf */ + _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) + goto _342 +_52: + ; /* ccons ::= CHECK LP expr RP */ + _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_53: + ; /* ccons ::= REFERENCES nm eidlist_opt refargs */ + _sqlite3CreateForeignKey(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_54: + ; /* ccons ::= defer_subclause */ + _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_55: + ; /* ccons ::= COLLATE ID|STRING */ + _sqlite3AddCollateType(tls, pParse, yymsp+8) + goto _342 +_56: + ; /* generated ::= LP expr RP */ + _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) + goto _342 +_57: + ; /* generated ::= LP expr RP ID */ + _sqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) + goto _342 +_58: + ; /* autoinc ::= AUTOINCR */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(1) + goto _342 +_59: + ; /* refargs ::= */ + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = libc.Int32FromInt32(OE_None) * libc.Int32FromInt32(0x0101) /* EV: R-19803-45884 */ + goto _342 +_60: + ; /* refargs ::= refargs refarg */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) & ^*(*int32)(unsafe.Pointer(yymsp + 8 + 4)) | *(*int32)(unsafe.Pointer(yymsp + 8)) + goto _342 +_61: + ; /* refarg ::= MATCH nm */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 4)) = 0x000000 + goto _342 +_62: + ; /* refarg ::= ON INSERT refact */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = 0x000000 + goto _342 +_63: + ; /* refarg ::= ON DELETE refact */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x0000ff) + goto _342 +_64: + ; /* refarg ::= ON UPDATE refact */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) << int32(8) + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 4)) = int32(0x00ff00) + goto _342 +_65: + ; /* refact ::= SET NULL */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetNull) /* EV: R-33326-45252 */ + goto _342 +_66: + ; /* refact ::= SET DEFAULT */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(OE_SetDflt) /* EV: R-33326-45252 */ + goto _342 +_67: + ; /* refact ::= CASCADE */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Cascade) /* EV: R-33326-45252 */ + goto _342 +_68: + ; /* refact ::= RESTRICT */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Restrict) /* EV: R-33326-45252 */ + goto _342 +_69: + ; /* refact ::= NO ACTION */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = OE_None /* EV: R-33326-45252 */ + goto _342 +_70: + ; /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = 0 + goto _342 +_72: + ; /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ +_71: + ; +_73: + ; + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) + goto _342 +_75: + ; /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ +_74: + ; +_76: + ; +_77: + ; +_78: + ; + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(1) + goto _342 +_79: + ; /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = 0 + goto _342 +_80: + ; /* tconscomma ::= COMMA */ + (*TParse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) + goto _342 +_81: + ; /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + _sqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), 0) + goto _342 +_82: + ; /* tcons ::= UNIQUE LP sortlist RP onconf */ + _sqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), 0, 0, uint8(SQLITE_IDXTYPE_UNIQUE)) + goto _342 +_83: + ; /* tcons ::= CHECK LP expr RP onconf */ + _sqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_84: + ; /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + _sqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + _sqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_86: + ; /* onconf ::= */ +_85: + ; + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(OE_Default) + goto _342 +_87: + ; /* onconf ::= ON CONFLICT resolvetype */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*int32)(unsafe.Pointer(yymsp + 8)) + goto _342 +_88: + ; /* resolvetype ::= IGNORE */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Ignore) + goto _342 +_90: + ; /* resolvetype ::= REPLACE */ +_89: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Replace) + goto _342 +_91: + ; /* cmd ::= DROP TABLE ifexists fullname */ + _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), 0, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_92: + ; /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + _sqlite3CreateView(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) + goto _342 +_93: + ; /* cmd ::= DROP VIEW ifexists fullname */ + _sqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), int32(1), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_94: + ; /* cmd ::= select */ + *(*TSelectDest)(unsafe.Pointer(bp + 16)) = TSelectDest{ + FeDest: uint8(SRT_Output), + } + _sqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), bp+16) + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_95: + ; /* select ::= WITH wqlist selectnowith */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_96: + ; /* select ::= WITH RECURSIVE wqlist selectnowith */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_97: + ; /* select ::= selectnowith */ + p2 = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + if p2 != 0 { + _parserDoubleLinkSelect(tls, pParse, p2) + } + goto _342 +_98: + ; /* selectnowith ::= selectnowith multiselect_op oneselect */ + pRhs = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + pLhs = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + if pRhs != 0 && (*TSelect)(unsafe.Pointer(pRhs)).FpPrior != 0 { + (*(*TToken)(unsafe.Pointer(bp + 56))).Fn = uint32(0) + _parserDoubleLinkSelect(tls, pParse, pRhs) + pFrom = _sqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp+56, pRhs, uintptr(0)) + pRhs = _sqlite3SelectNew(tls, pParse, uintptr(0), pFrom, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + } + if pRhs != 0 { + (*TSelect)(unsafe.Pointer(pRhs)).Fop = uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + (*TSelect)(unsafe.Pointer(pRhs)).FpPrior = pLhs + if pLhs != 0 { + *(*Tu32)(unsafe.Pointer(pLhs + 4)) &= uint32(^libc.Int32FromInt32(SF_MultiValue)) + } + *(*Tu32)(unsafe.Pointer(pRhs + 4)) &= uint32(^libc.Int32FromInt32(SF_MultiValue)) + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != int32(TK_ALL) { + (*TParse)(unsafe.Pointer(pParse)).FhasCompound = uint8(1) + } + } else { + _sqlite3SelectDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pLhs) + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = pRhs + goto _342 +_100: + ; /* multiselect_op ::= UNION */ +_99: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-OP*/ + goto _342 +_101: + ; /* multiselect_op ::= UNION ALL */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_ALL) + goto _342 +_102: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_103: + ; /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint32(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)) != 0 { + (*TSelect)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(9))*24 + 8)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + } else { + _sqlite3WindowListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + } + goto _342 +_104: + ; /* values ::= VALUES LP nexprlist RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) + goto _342 +_105: + ; /* values ::= values COMMA LP nexprlist RP */ + pLeft = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + pRight = _sqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(libc.Int32FromInt32(SF_Values)|libc.Int32FromInt32(SF_MultiValue)), uintptr(0)) + if pLeft != 0 { + *(*Tu32)(unsafe.Pointer(pLeft + 4)) &= uint32(^libc.Int32FromInt32(SF_MultiValue)) + } + if pRight != 0 { + (*TSelect)(unsafe.Pointer(pRight)).Fop = uint8(TK_ALL) + (*TSelect)(unsafe.Pointer(pRight)).FpPrior = pLeft + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pRight + } else { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = pLeft + } + goto _342 +_106: + ; /* distinct ::= DISTINCT */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_Distinct) + goto _342 +_107: + ; /* distinct ::= ALL */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SF_All) + goto _342 +_109: + ; /* sclp ::= */ +_108: + ; +_110: + ; +_111: + ; +_112: + ; +_113: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_114: + ; /* selcollist ::= sclp scanpt expr scanpt as */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + if *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) > uint32(0) { + _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+8, int32(1)) + } + _sqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_115: + ; /* selcollist ::= sclp scanpt STAR */ + p3 = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_ASTERISK), uintptr(0)) + _sqlite3ExprSetErrorOffset(tls, p3, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), p3) + goto _342 +_116: + ; /* selcollist ::= sclp scanpt nm DOT STAR */ + pRight1 = _sqlite3PExpr(tls, pParse, int32(TK_ASTERISK), uintptr(0), uintptr(0)) + _sqlite3ExprSetErrorOffset(tls, pRight1, int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64((*TParse)(unsafe.Pointer(pParse)).FzTail))) + pLeft1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + pDot = _sqlite3PExpr(tls, pParse, int32(TK_DOT), pLeft1, pRight1) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pDot) + goto _342 +_118: + ; /* as ::= AS nm */ +_117: + ; +_119: + ; +_120: + ; + *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) + goto _342 +_122: + ; /* from ::= */ +_121: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_123: + ; /* from ::= FROM seltablist */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_124: + ; /* stl_prefix ::= seltablist joinop */ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc > 0 { + (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnSrc-int32(1))*104))).Ffg.Fjointype = uint8(*(*int32)(unsafe.Pointer(yymsp + 8))) + } + goto _342 +_125: + ; /* seltablist ::= stl_prefix nm dbnm as on_using */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) + goto _342 +_126: + ; /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0), yymsp+8) + _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + goto _342 +_127: + ; /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) + _sqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) + goto _342 +_128: + ; /* seltablist ::= stl_prefix LP select RP as on_using */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) + goto _342 +_129: + ; /* seltablist ::= stl_prefix LP seltablist RP as on_using */ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) == uintptr(0) && *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) == uint32(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8)) == uintptr(0) && *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) + } else { + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != uintptr(0) && (*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FnSrc == int32(1) { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), yymsp+8) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { + pNew = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) + 8 + uintptr((*TSrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FnSrc-int32(1))*104 + pOld = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) + 8 + (*TSrcItem)(unsafe.Pointer(pNew)).FzName = (*TSrcItem)(unsafe.Pointer(pOld)).FzName + (*TSrcItem)(unsafe.Pointer(pNew)).FzDatabase = (*TSrcItem)(unsafe.Pointer(pOld)).FzDatabase + (*TSrcItem)(unsafe.Pointer(pNew)).FpSelect = (*TSrcItem)(unsafe.Pointer(pOld)).FpSelect + if (*TSrcItem)(unsafe.Pointer(pNew)).FpSelect != 0 && (*TSelect)(unsafe.Pointer((*TSrcItem)(unsafe.Pointer(pNew)).FpSelect)).FselFlags&uint32(SF_NestedFrom) != uint32(0) { + libc.SetBitFieldPtr16Uint32(pNew+60+4, libc.Uint32FromInt32(1), 13, 0x2000) + } + if int32(uint32(*(*uint16)(unsafe.Pointer(pOld + 60 + 4))&0x4>>2)) != 0 { + *(*uintptr)(unsafe.Pointer(pNew + 88)) = *(*uintptr)(unsafe.Pointer(pOld + 88)) + *(*uintptr)(unsafe.Pointer(pOld + 88)) = uintptr(0) + libc.SetBitFieldPtr16Uint32(pOld+60+4, libc.Uint32FromInt32(0), 2, 0x4) + libc.SetBitFieldPtr16Uint32(pNew+60+4, libc.Uint32FromInt32(1), 2, 0x4) + } + v343 = libc.UintptrFromInt32(0) + (*TSrcItem)(unsafe.Pointer(pOld)).FzDatabase = v343 + (*TSrcItem)(unsafe.Pointer(pOld)).FzName = v343 + (*TSrcItem)(unsafe.Pointer(pOld)).FpSelect = uintptr(0) + } + _sqlite3SrcListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) + } else { + _sqlite3SrcListShiftJoinType(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) + pSubquery = _sqlite3SelectNew(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_NestedFrom), uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, pSubquery, yymsp+8) + } + } + goto _342 +_131: + ; /* dbnm ::= */ +_130: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + *(*uint32)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uint32(0) + goto _342 +_132: + ; /* fullname ::= nm */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { + _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_133: + ; /* fullname ::= nm DOT nm */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { + _sqlite3RenameTokenMap(tls, pParse, (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 8))).FzName, yymsp+8) + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_134: + ; /* xfullname ::= nm */ + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+8, uintptr(0)) /*A-overwrites-X*/ + goto _342 +_135: + ; /* xfullname ::= nm DOT nm */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) /*A-overwrites-X*/ + goto _342 +_136: + ; /* xfullname ::= nm DOT nm AS nm */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8) /*A-overwrites-X*/ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) + } + goto _342 +_137: + ; /* xfullname ::= nm AS nm */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, uintptr(0)) /*A-overwrites-X*/ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { + (*(*TSrcItem)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 8))).FzAlias = _sqlite3NameFromToken(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, yymsp+8) + } + goto _342 +_138: + ; /* joinop ::= COMMA|JOIN */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(JT_INNER) + goto _342 +_139: + ; /* joinop ::= JOIN_KW JOIN */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0), uintptr(0)) /*X-overwrites-A*/ + goto _342 +_140: + ; /* joinop ::= JOIN_KW nm JOIN */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, uintptr(0)) /*X-overwrites-A*/ + goto _342 +_141: + ; /* joinop ::= JOIN_KW nm nm JOIN */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3JoinType(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) /*X-overwrites-A*/ + goto _342 +_142: + ; /* on_using ::= ON expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uintptr(0) + goto _342 +_143: + ; /* on_using ::= USING LP idlist RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_144: + ; /* on_using ::= */ + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 + 8)) = uintptr(0) + goto _342 +_145: + ; /* indexed_by ::= INDEXED BY nm */ + *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) + goto _342 +_146: + ; /* indexed_by ::= NOT INDEXED */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(1) + goto _342 +_148: + ; /* orderby_opt ::= ORDER BY sortlist */ +_147: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + goto _342 +_149: + ; /* sortlist ::= sortlist COMMA expr sortorder nulls */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_150: + ; /* sortlist ::= expr sortorder nulls */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) /*A-overwrites-Y*/ + _sqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_151: + ; /* sortorder ::= ASC */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = SQLITE_SO_ASC + goto _342 +_152: + ; /* sortorder ::= DESC */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(SQLITE_SO_DESC) + goto _342 +_154: + ; /* sortorder ::= */ +_153: + ; + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = -int32(1) + goto _342 +_155: + ; /* nulls ::= NULLS FIRST */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = SQLITE_SO_ASC + goto _342 +_156: + ; /* nulls ::= NULLS LAST */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(SQLITE_SO_DESC) + goto _342 +_158: + ; /* having_opt ::= */ +_157: + ; +_159: + ; +_160: + ; +_161: + ; +_162: + ; +_163: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_165: + ; /* having_opt ::= HAVING expr */ +_164: + ; +_166: + ; +_167: + ; +_168: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + goto _342 +_169: + ; /* limit_opt ::= LIMIT expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) + goto _342 +_170: + ; /* limit_opt ::= LIMIT expr OFFSET expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_171: + ; /* limit_opt ::= LIMIT expr COMMA expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_LIMIT), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + goto _342 +_172: + ; /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + _sqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0)) + goto _342 +_173: + ; /* where_opt_ret ::= RETURNING selcollist */ + _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) + goto _342 +_174: + ; /* where_opt_ret ::= WHERE expr RETURNING selcollist */ + _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + goto _342 +_175: + ; /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + _sqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) + _sqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), __ccgo_ts+23417) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { + pFromClause = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + if (*TSrcList)(unsafe.Pointer(pFromClause)).FnSrc > int32(1) { + pSubquery1 = _sqlite3SelectNew(tls, pParse, uintptr(0), pFromClause, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_NestedFrom), uintptr(0)) + (*(*TToken)(unsafe.Pointer(bp + 72))).Fn = uint32(0) + (*(*TToken)(unsafe.Pointer(bp + 72))).Fz = uintptr(0) + pFromClause = _sqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp+72, pSubquery1, uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), pFromClause) + } + _sqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0), uintptr(0), uintptr(0)) + goto _342 +_176: + ; /* setlist ::= setlist COMMA nm EQ expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) + goto _342 +_177: + ; /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_178: + ; /* setlist ::= nm EQ expr */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _sqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, int32(1)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_179: + ; /* setlist ::= LP idlist RP EQ expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_180: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_181: + ; /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + _sqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), uintptr(0)) + goto _342 +_182: + ; /* upsert ::= */ + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_183: + ; /* upsert ::= RETURNING selcollist */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uintptr(0) + _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_184: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(11))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_185: + ; /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_186: + ; /* upsert ::= ON CONFLICT DO NOTHING returning */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + goto _342 +_187: + ; /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = _sqlite3UpsertNew(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) + goto _342 +_188: + ; /* returning ::= RETURNING selcollist */ + _sqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_189: + ; /* idlist_opt ::= */ + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_190: + ; /* idlist_opt ::= LP idlist RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_191: + ; /* idlist ::= idlist COMMA nm */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8) + goto _342 +_192: + ; /* idlist ::= nm */ + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3IdListAppend(tls, pParse, uintptr(0), yymsp+8) /*A-overwrites-Y*/ + goto _342 +_193: + ; /* expr ::= LP expr RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_194: + ; /* expr ::= ID|INDEXED|JOIN_KW */ + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ + goto _342 +_195: + ; /* expr ::= nm DOT nm */ + temp1 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + temp2 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp1, temp2) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_196: + ; /* expr ::= nm DOT nm DOT nm */ + temp11 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + temp21 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + temp3 = _tokenExpr(tls, pParse, int32(TK_ID), *(*TToken)(unsafe.Pointer(yymsp + 8))) + temp4 = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp21, temp3) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) { + _sqlite3RenameTokenRemap(tls, pParse, uintptr(0), temp11) + } + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3PExpr(tls, pParse, int32(TK_DOT), temp11, temp4) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_198: + ; /* term ::= NULL|FLOAT|BLOB */ +_197: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*TToken)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ + goto _342 +_199: + ; /* term ::= INTEGER */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_INTEGER), yymsp+8, int32(1)) + if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { + *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + 52)) = int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8))) - int64((*TParse)(unsafe.Pointer(pParse)).FzTail)) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_200: + ; /* expr ::= VARIABLE */ + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8))))) == int32('#') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)) + 1)))])&int32(0x04) != 0) { + n = *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _tokenExpr(tls, pParse, int32(TK_VARIABLE), *(*TToken)(unsafe.Pointer(yymsp + 8))) + _sqlite3ExprAssignVarNumber(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), n) + } else { + /* When doing a nested parse, one can include terms in an expression + ** that look like this: #1 #2 ... These terms refer to registers + ** in the virtual machine. #N is the N-th register. */ + *(*TToken)(unsafe.Pointer(bp + 88)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) /*A-overwrites-X*/ + if int32((*TParse)(unsafe.Pointer(pParse)).Fnested) == 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23426, libc.VaList(bp+128, bp+88)) + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = uintptr(0) + } else { + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_REGISTER), uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { + _sqlite3GetInt32(tls, (*(*TToken)(unsafe.Pointer(bp + 88))).Fz+1, *(*uintptr)(unsafe.Pointer(yymsp + 8))+44) + } + } + } + goto _342 +_201: + ; /* expr ::= expr COLLATE ID|STRING */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+8, int32(1)) + goto _342 +_202: + ; /* expr ::= CAST LP expr AS typetoken RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_CAST), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) + _sqlite3ExprAttachSubtrees(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) + goto _342 +_203: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_204: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8))) + _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_205: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_206: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) + _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_207: + ; /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(8))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))) + _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _sqlite3ExprAddFunctionOrderBy(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_208: + ; /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, 0) + _sqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_209: + ; /* term ::= CTIME_KW */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, uintptr(0), yymsp+8, 0) + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_210: + ; /* expr ::= LP nexprlist COMMA expr RP */ + pList = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_VECTOR), uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 32)) = pList + if (*TExprList)(unsafe.Pointer(pList)).FnExpr != 0 { + *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= (*TExpr)(unsafe.Pointer((*(*TExprList_item)(unsafe.Pointer(pList + 8))).FpExpr)).Fflags & uint32(libc.Int32FromInt32(EP_Collate)|libc.Int32FromInt32(EP_Subquery)|libc.Int32FromInt32(EP_HasFunc)) + } + } else { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList) + } + goto _342 +_211: + ; /* expr ::= expr AND expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_213: + ; /* expr ::= expr OR expr */ +_212: + ; +_214: + ; +_215: + ; +_216: + ; +_217: + ; +_218: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_219: + ; /* likeop ::= NOT LIKE_KW|MATCH */ + *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) |= uint32(0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ + goto _342 +_220: + ; /* expr ::= expr likeop expr */ + bNot = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) & uint32(0x80000000)) + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) &= uint32(0x7fffffff) + pList1 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + pList1 = _sqlite3ExprListAppend(tls, pParse, pList1, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprFunction(tls, pParse, pList1, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) + if bNot != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) + } + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) != 0 { + *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) + } + goto _342 +_221: + ; /* expr ::= expr likeop expr ESCAPE expr */ + bNot1 = int32(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) & uint32(0x80000000)) + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)) &= uint32(0x7fffffff) + pList2 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + pList2 = _sqlite3ExprListAppend(tls, pParse, pList2, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + pList2 = _sqlite3ExprListAppend(tls, pParse, pList2, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprFunction(tls, pParse, pList2, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, 0) + if bNot1 != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + } + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 4)) |= uint32(EP_InfixFunc) + } + goto _342 +_222: + ; /* expr ::= expr ISNULL|NOTNULL */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) + goto _342 +_223: + ; /* expr ::= expr NOT NULL */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOTNULL), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uintptr(0)) + goto _342 +_224: + ; /* expr ::= expr IS expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), int32(TK_ISNULL)) + goto _342 +_225: + ; /* expr ::= expr IS NOT expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), int32(TK_NOTNULL)) + goto _342 +_226: + ; /* expr ::= expr IS NOT DISTINCT FROM expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IS), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), int32(TK_ISNULL)) + goto _342 +_227: + ; /* expr ::= expr IS DISTINCT FROM expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_ISNOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + _binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), int32(TK_NOTNULL)) + goto _342 +_229: + ; /* expr ::= NOT expr */ +_228: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) /*A-overwrites-B*/ + goto _342 +_230: + ; /* expr ::= PLUS|MINUS expr */ + if int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) == int32(TK_PLUS) { + v344 = int32(TK_UPLUS) + } else { + v344 = int32(TK_UMINUS) + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3PExpr(tls, pParse, v344, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0)) + /*A-overwrites-B*/ + goto _342 +_231: + ; /* expr ::= expr PTR expr */ + pList3 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + pList3 = _sqlite3ExprListAppend(tls, pParse, pList3, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3ExprFunction(tls, pParse, pList3, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_233: + ; /* between_op ::= BETWEEN */ +_232: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = 0 + goto _342 +_234: + ; /* expr ::= expr between_op expr AND expr */ + pList4 = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + pList4 = _sqlite3ExprListAppend(tls, pParse, pList4, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_BETWEEN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 32)) = pList4 + } else { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pList4) + } + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + } + goto _342 +_235: + ; /* expr ::= expr in_op LP exprlist RP */ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) == uintptr(0) { + /* Expressions of the form + ** + ** expr1 IN () + ** expr1 NOT IN () + ** + ** simplify to constants 0 (false) and 1 (true), respectively, + ** regardless of the value of expr1. + */ + _sqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + v345 = __ccgo_ts + 7918 + } else { + v345 = __ccgo_ts + 7923 + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3Expr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_STRING), v345) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + _sqlite3ExprIdToTrueFalse(tls, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + } + } else { + pRHS = (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8))).FpExpr + if (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnExpr == int32(1) && _sqlite3ExprIsConstant(tls, pRHS) != 0 && int32((*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)))).Fop) != int32(TK_VECTOR) { + (*(*TExprList_item)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + 8))).FpExpr = uintptr(0) + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + pRHS = _sqlite3PExpr(tls, pParse, int32(TK_UPLUS), pRHS, uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_EQ), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pRHS) + } else { + if (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FnExpr == int32(1) && int32((*TExpr)(unsafe.Pointer(pRHS)).Fop) == int32(TK_SELECT) { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(pRHS + 32))) + *(*uintptr)(unsafe.Pointer(pRHS + 32)) = uintptr(0) + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + } else { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) == uintptr(0) { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + } else { + if int32((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)))).FpLeft)).Fop) == int32(TK_VECTOR) { + nExpr = (*TExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)))).FpLeft + 32)))).FnExpr + pSelectRHS = _sqlite3ExprListToValues(tls, pParse, nExpr, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + if pSelectRHS != 0 { + _parserDoubleLinkSelect(tls, pParse, pSelectRHS) + _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pSelectRHS) + } + } else { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 32)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + _sqlite3ExprSetHeightAndFlags(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + } + } + } + } + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + } + } + goto _342 +_236: + ; /* expr ::= LP select RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) + _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_237: + ; /* expr ::= expr in_op LP select RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + } + goto _342 +_238: + ; /* expr ::= expr in_op nm dbnm paren_exprlist */ + pSrc = _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + pSelect = _sqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { + if pSelect != 0 { + v346 = pSrc + } else { + v346 = uintptr(0) + } + _sqlite3SrcListFuncArgs(tls, pParse, v346, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + } + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_IN), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + _sqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), pSelect) + if *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_NOT), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uintptr(0)) + } + goto _342 +_239: + ; /* expr ::= EXISTS LP select RP */ + v347 = _sqlite3PExpr(tls, pParse, int32(TK_EXISTS), uintptr(0), uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = v347 + p4 = v347 + _sqlite3PExprAddSelect(tls, pParse, p4, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_240: + ; /* expr ::= CASE case_operand case_exprlist case_else END */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_CASE), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) != 0 { + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { + v348 = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + } else { + v348 = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + } + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) + 32)) = v348 + _sqlite3ExprSetHeightAndFlags(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + } else { + _sqlite3ExprListDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + } + goto _342 +_241: + ; /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_242: + ; /* case_exprlist ::= WHEN expr THEN expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_243: + ; /* nexprlist ::= nexprlist COMMA expr */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_244: + ; /* nexprlist ::= expr */ + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ + goto _342 +_246: + ; /* paren_exprlist ::= LP exprlist RP */ +_245: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_247: + ; /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + _sqlite3CreateIndex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, _sqlite3SrcListAppend(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(11))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), uint8(SQLITE_IDXTYPE_APPDEF)) + if int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= int32(PARSE_MODE_RENAME) && (*TParse)(unsafe.Pointer(pParse)).FpNewIndex != 0 { + _sqlite3RenameTokenMap(tls, pParse, (*TIndex)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) + } + goto _342 +_249: + ; /* uniqueflag ::= UNIQUE */ +_248: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Abort) + goto _342 +_250: + ; /* uniqueflag ::= */ + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = OE_None + goto _342 +_251: + ; /* eidlist ::= eidlist COMMA nm collate sortorder */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) + goto _342 +_252: + ; /* eidlist ::= nm collate sortorder */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _parserAddExprIdListTerm(tls, pParse, uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-Y*/ + goto _342 +_253: + ; /* cmd ::= DROP INDEX ifexists fullname */ + _sqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_254: + ; /* cmd ::= VACUUM vinto */ + _sqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_255: + ; /* cmd ::= VACUUM nm vinto */ + _sqlite3Vacuum(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_256: + ; /* cmd ::= PRAGMA nm dbnm */ + _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8, uintptr(0), 0) + goto _342 +_257: + ; /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, 0) + goto _342 +_258: + ; /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, 0) + goto _342 +_259: + ; /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, int32(1)) + goto _342 +_260: + ; /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + _sqlite3Pragma(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) + goto _342 +_261: + ; /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + (*(*TToken)(unsafe.Pointer(bp + 104))).Fz = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) + (*(*TToken)(unsafe.Pointer(bp + 104))).Fn = uint32(int32(int64(*(*uintptr)(unsafe.Pointer(yymsp + 8)))-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))))) + *(*uint32)(unsafe.Pointer(yymsp + 8 + 8)) + _sqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), bp+104) + goto _342 +_262: + ; /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + _sqlite3BeginTrigger(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(7))*24+8, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8))) + if *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8 + 8)) == uint32(0) { + v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) + } else { + v349 = *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8)) + } + *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(10))*24 + 8)) = v349 /*A-overwrites-T*/ + goto _342 +_263: + ; /* trigger_time ::= BEFORE|AFTER */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ + goto _342 +_264: + ; /* trigger_time ::= INSTEAD OF */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = int32(TK_INSTEAD) + goto _342 +_265: + ; /* trigger_time ::= */ + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8)) = int32(TK_BEFORE) + goto _342 +_267: + ; /* trigger_event ::= DELETE|INSERT */ +_266: + ; + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ + *(*uintptr)(unsafe.Pointer(yymsp + 8 + 8)) = uintptr(0) + goto _342 +_268: + ; /* trigger_event ::= UPDATE OF idlist */ + *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = int32(TK_UPDATE) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + goto _342 +_270: + ; /* when_clause ::= */ +_269: + ; + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = uintptr(0) + goto _342 +_272: + ; /* when_clause ::= WHEN expr */ +_271: + ; + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + goto _342 +_273: + ; /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + (*TTriggerStep)(unsafe.Pointer((*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_274: + ; /* trigger_cmd_list ::= trigger_cmd SEMI */ + (*TTriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_275: + ; /* trnm ::= nm DOT nm */ + *(*TToken)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*TToken)(unsafe.Pointer(yymsp + 8)) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23450, 0) + goto _342 +_276: + ; /* tridxby ::= INDEXED BY nm */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23545, 0) + goto _342 +_277: + ; /* tridxby ::= NOT INDEXED */ + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23629, 0) + goto _342 +_278: + ; /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerUpdateStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(6))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(8))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_279: + ; /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerInsertStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(4))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), uint8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(6))*24 + 8))), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(7))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_280: + ; /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerDeleteStep(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_281: + ; /* trigger_cmd ::= scanpt select scanpt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3TriggerSelectStep(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_282: + ; /* expr ::= RAISE LP IGNORE RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3PExpr(tls, pParse, int32(TK_RAISE), uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) != 0 { + (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)))).FaffExpr = int8(OE_Ignore) + } + goto _342 +_283: + ; /* expr ::= RAISE LP raisetype COMMA nm RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3ExprAlloc(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, int32(TK_RAISE), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, int32(1)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) != 0 { + (*TExpr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) + } + goto _342 +_284: + ; /* raisetype ::= ROLLBACK */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Rollback) + goto _342 +_285: + ; /* raisetype ::= FAIL */ + *(*int32)(unsafe.Pointer(yymsp + 8)) = int32(OE_Fail) + goto _342 +_286: + ; /* cmd ::= DROP TRIGGER ifexists fullname */ + _sqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _342 +_287: + ; /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + _sqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_288: + ; /* cmd ::= DETACH database_kw_opt expr */ + _sqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_289: + ; /* cmd ::= REINDEX */ + _sqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) + goto _342 +_290: + ; /* cmd ::= REINDEX nm dbnm */ + _sqlite3Reindex(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) + goto _342 +_291: + ; /* cmd ::= ANALYZE */ + _sqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) + goto _342 +_292: + ; /* cmd ::= ANALYZE nm dbnm */ + _sqlite3Analyze(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, yymsp+8) + goto _342 +_293: + ; /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + _sqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) + goto _342 +_294: + ; /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + *(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)) = uint32(int32(int64((*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz)-int64(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))))) + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn + _sqlite3AlterFinishAddColumn(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + goto _342 +_295: + ; /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + _sqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), yymsp+8) + goto _342 +_296: + ; /* add_column_fullname ::= fullname */ + _disableLookaside(tls, pParse) + _sqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_297: + ; /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + _sqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8) + goto _342 +_298: + ; /* cmd ::= create_vtab */ + _sqlite3VtabFinishParse(tls, pParse, uintptr(0)) + goto _342 +_299: + ; /* cmd ::= create_vtab LP vtabarglist RP */ + _sqlite3VtabFinishParse(tls, pParse, yymsp+8) + goto _342 +_300: + ; /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + _sqlite3VtabBeginParse(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(3))*24+8, yymsp+uintptr(-libc.Int32FromInt32(2))*24+8, yymsp+8, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + goto _342 +_301: + ; /* vtabarg ::= */ + _sqlite3VtabArgInit(tls, pParse) + goto _342 +_303: + ; /* vtabargtoken ::= ANY */ +_302: + ; +_304: + ; + _sqlite3VtabArgExtend(tls, pParse, yymsp+8) + goto _342 +_306: + ; /* with ::= WITH wqlist */ +_305: + ; + _sqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint8(1)) + goto _342 +_307: + ; /* wqas ::= AS */ + *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8(M10d_Any) + goto _342 +_308: + ; /* wqas ::= AS MATERIALIZED */ + *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8(M10d_Yes) + goto _342 +_309: + ; /* wqas ::= AS NOT MATERIALIZED */ + *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = uint8(M10d_No) + goto _342 +_310: + ; /* wqitem ::= nm eidlist_opt wqas LP select RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = _sqlite3CteNew(tls, pParse, yymsp+uintptr(-libc.Int32FromInt32(5))*24+8, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8))) /*A-overwrites-X*/ + goto _342 +_311: + ; /* wqlist ::= wqitem */ + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = _sqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8))) /*A-overwrites-X*/ + goto _342 +_312: + ; /* wqlist ::= wqlist COMMA wqitem */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = _sqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + 8))) + goto _342 +_313: + ; /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ + _sqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_314: + ; /* windowdefn ::= nm AS LP window RP */ + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8 + 8)))) + } + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_315: + ; /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) + goto _342 +_316: + ; /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(5))*24+8) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_317: + ; /* window ::= ORDER BY sortlist frame_opt */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), uintptr(0)) + goto _342 +_318: + ; /* window ::= nm ORDER BY sortlist frame_opt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_319: + ; /* window ::= nm frame_opt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uintptr(0), uintptr(0), yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_320: + ; /* frame_opt ::= */ + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8)) = _sqlite3WindowAlloc(tls, pParse, 0, int32(TK_UNBOUNDED), uintptr(0), int32(TK_CURRENT), uintptr(0), uint8(0)) + goto _342 +_321: + ; /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), int32(TK_CURRENT), uintptr(0), *(*Tu8)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_322: + ; /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8 + 8)), *(*int32)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8 + 8)), *(*Tu8)(unsafe.Pointer(yymsp + 8))) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(5))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_324: + ; /* frame_bound_s ::= frame_bound */ +_323: + ; + *(*TFrameBound)(unsafe.Pointer(bp)) = *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) + *(*TFrameBound)(unsafe.Pointer(yymsp + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) + goto _342 +_326: + ; /* frame_bound_s ::= UNBOUNDED PRECEDING */ +_325: + ; +_327: + ; + (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) + (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = uintptr(0) + *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) + goto _342 +_328: + ; /* frame_bound ::= expr PRECEDING|FOLLOWING */ + (*(*TFrameBound)(unsafe.Pointer(bp))).FeType = int32((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) + (*(*TFrameBound)(unsafe.Pointer(bp))).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + *(*TFrameBound)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFrameBound)(unsafe.Pointer(bp)) + goto _342 +_329: + ; /* frame_exclude_opt ::= */ + *(*Tu8)(unsafe.Pointer(yymsp + 1*24 + 8)) = uint8(0) + goto _342 +_330: + ; /* frame_exclude_opt ::= EXCLUDE frame_exclude */ + *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*Tu8)(unsafe.Pointer(yymsp + 8)) + goto _342 +_332: + ; /* frame_exclude ::= NO OTHERS */ +_331: + ; + *(*Tu8)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24))).Fmajor) /*A-overwrites-X*/ + goto _342 +_333: + ; /* frame_exclude ::= GROUP|TIES */ + *(*Tu8)(unsafe.Pointer(yymsp + 8)) = uint8((*(*TyyStackEntry)(unsafe.Pointer(yymsp))).Fmajor) /*A-overwrites-X*/ + goto _342 +_334: + ; /* window_clause ::= WINDOW windowdefn_list */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + goto _342 +_335: + ; /* filter_over ::= filter_clause over_clause */ + if *(*uintptr)(unsafe.Pointer(yymsp + 8)) != 0 { + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + } else { + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + } + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_336: + ; /* filter_over ::= over_clause */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_337: + ; /* filter_over ::= filter_clause */ + *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) + if *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) != 0 { + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FeFrmType = uint8(TK_FILTER) + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + 8)) + } else { + _sqlite3ExprDelete(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8))) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&*(*TYYMINORTYPE)(unsafe.Pointer(bp)))) + goto _342 +_338: + ; /* over_clause ::= OVER LP window RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_339: + ; /* over_clause ::= OVER nm */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(144)) + if *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) != 0 { + (*TWindow)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)))).FzName = _sqlite3DbStrNDup(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8)), uint64(*(*uint32)(unsafe.Pointer(yymsp + 8 + 8)))) + } + goto _342 +_340: + ; /* filter_clause ::= FILTER LP WHERE expr RP */ + *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _342 +_341: + ; + goto _342 + /********** End reduce actions ************************************************/ +_342: + ; + yygoto = int32(_yyRuleInfoLhs[yyruleno]) + yysize = int32(_yyRuleInfoNRhs[yyruleno]) + yyact = _yy_find_reduce_action(tls, (*(*TyyStackEntry)(unsafe.Pointer(yymsp + uintptr(yysize)*24))).Fstateno, uint16(yygoto)) + /* There are no SHIFTREDUCE actions on nonterminals because the table + ** generator has simplified them to pure REDUCE actions. */ + /* It is not possible for a REDUCE to be followed by an error */ + yymsp += uintptr(yysize+int32(1)) * 24 + (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos = yymsp + (*TyyStackEntry)(unsafe.Pointer(yymsp)).Fstateno = yyact + (*TyyStackEntry)(unsafe.Pointer(yymsp)).Fmajor = uint16(yygoto) + return yyact +} + +/* +** The following code executes when the parse fails + */ + +// C documentation +// +// /* +// ** The following code executes when a syntax error first occurs. +// */ +func _yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, _yyminor TToken) { + bp := tls.Alloc(32) + defer tls.Free(32) + *(*TToken)(unsafe.Pointer(bp)) = _yyminor + var pParse uintptr + _ = pParse + pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse + /************ Begin %syntax_error code ****************************************/ + _ = yymajor /* Silence some compiler warnings */ + if *(*int8)(unsafe.Pointer((*(*TToken)(unsafe.Pointer(bp))).Fz)) != 0 { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23426, libc.VaList(bp+24, bp)) + } else { + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23714, 0) + } + /************ End %syntax_error code ******************************************/ + /* Suppress warning about unused %extra_argument variable */ + (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +// C documentation +// +// /* +// ** The following is executed when the parser accepts +// */ +func _yy_accept(tls *libc.TLS, yypParser uintptr) { + var pParse uintptr + _ = pParse + pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + /*********** Begin %parse_accept code *****************************************/ + /*********** End %parse_accept code *******************************************/ + /* Suppress warning about unused %extra_argument variable */ + (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +// C documentation +// +// /* The main parser program. +// ** The first argument is a pointer to a structure obtained from +// ** "sqlite3ParserAlloc" which describes the current state of the parser. +// ** The second argument is the major token number. The third is +// ** the minor token. The fourth optional argument is whatever the +// ** user wants (and specified in the grammar) and is available for +// ** use by the action routines. +// ** +// ** Inputs: +// **
      +// **
    • A pointer to the parser (an opaque structure.) +// **
    • The major token number. +// **
    • The minor token number. +// **
    • An option argument of a grammar-specified type. +// **
    +// ** +// ** Outputs: +// ** None. +// */ +func _sqlite3Parser(tls *libc.TLS, yyp uintptr, yymajor int32, yyminor TToken) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pParse, yypParser uintptr + var yyact uint16 + var yyruleno uint32 + var _ /* yyminorunion at bp+0 */ TYYMINORTYPE + _, _, _, _ = pParse, yyact, yypParser, yyruleno /* The parser action. */ + yypParser = yyp /* The parser */ + pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse + yyact = (*TyyStackEntry)(unsafe.Pointer((*TyyParser)(unsafe.Pointer(yypParser)).Fyytos)).Fstateno + for int32(1) != 0 { /* Exit by "break" */ + yyact = _yy_find_shift_action(tls, uint16(yymajor), yyact) + if int32(yyact) >= int32(YY_MIN_REDUCE) { + yyruleno = uint32(int32(yyact) - int32(YY_MIN_REDUCE)) /* Reduce by this rule */ + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if int32(_yyRuleInfoNRhs[yyruleno]) == 0 { + if (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos >= (*TyyParser)(unsafe.Pointer(yypParser)).FyystackEnd { + _yyStackOverflow(tls, yypParser) + break + } + } + yyact = _yy_reduce(tls, yypParser, yyruleno, yymajor, yyminor, pParse) + } else { + if int32(yyact) <= int32(YY_MAX_SHIFTREDUCE) { + _yy_shift(tls, yypParser, yyact, uint16(yymajor), yyminor) + break + } else { + if int32(yyact) == int32(YY_ACCEPT_ACTION) { + (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos -= 24 + _yy_accept(tls, yypParser) + return + } else { + *(*TToken)(unsafe.Pointer(bp)) = yyminor + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + _yy_syntax_error(tls, yypParser, yymajor, yyminor) + _yy_destructor(tls, yypParser, uint16(yymajor), bp) + break + } + } + } + } + return +} + +// C documentation +// +// /* +// ** Return the fallback token corresponding to canonical token iToken, or +// ** 0 if iToken has no fallback. +// */ +func _sqlite3ParserFallback(tls *libc.TLS, iToken int32) (r int32) { + return int32(_yyFallback[iToken]) +} + +/************** End of parse.c ***********************************************/ +/************** Begin file tokenize.c ****************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** An tokenizer for SQL +** +** This file contains C code that splits an SQL input string up into +** individual tokens and sends those tokens one-by-one over to the +** parser for analysis. + */ +/* #include "sqliteInt.h" */ +/* #include */ + +/* Character classes for tokenizing +** +** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented +** using a lookup table, whereas a switch() directly on c uses a binary search. +** The lookup table is much faster. To maximize speed, and to ensure that +** a lookup table is used, all of the classes need to be small integers and +** all of them need to be used within the switch. + */ + +var _aiClass = [256]uint8{ + 0: uint8(29), + 1: uint8(28), + 2: uint8(28), + 3: uint8(28), + 4: uint8(28), + 5: uint8(28), + 6: uint8(28), + 7: uint8(28), + 8: uint8(28), + 9: uint8(7), + 10: uint8(7), + 11: uint8(28), + 12: uint8(7), + 13: uint8(7), + 14: uint8(28), + 15: uint8(28), + 16: uint8(28), + 17: uint8(28), + 18: uint8(28), + 19: uint8(28), + 20: uint8(28), + 21: uint8(28), + 22: uint8(28), + 23: uint8(28), + 24: uint8(28), + 25: uint8(28), + 26: uint8(28), + 27: uint8(28), + 28: uint8(28), + 29: uint8(28), + 30: uint8(28), + 31: uint8(28), + 32: uint8(7), + 33: uint8(15), + 34: uint8(8), + 35: uint8(5), + 36: uint8(4), + 37: uint8(22), + 38: uint8(24), + 39: uint8(8), + 40: uint8(17), + 41: uint8(18), + 42: uint8(21), + 43: uint8(20), + 44: uint8(23), + 45: uint8(11), + 46: uint8(26), + 47: uint8(16), + 48: uint8(3), + 49: uint8(3), + 50: uint8(3), + 51: uint8(3), + 52: uint8(3), + 53: uint8(3), + 54: uint8(3), + 55: uint8(3), + 56: uint8(3), + 57: uint8(3), + 58: uint8(5), + 59: uint8(19), + 60: uint8(12), + 61: uint8(14), + 62: uint8(13), + 63: uint8(6), + 64: uint8(5), + 65: uint8(1), + 66: uint8(1), + 67: uint8(1), + 68: uint8(1), + 69: uint8(1), + 70: uint8(1), + 71: uint8(1), + 72: uint8(1), + 73: uint8(1), + 74: uint8(1), + 75: uint8(1), + 76: uint8(1), + 77: uint8(1), + 78: uint8(1), + 79: uint8(1), + 80: uint8(1), + 81: uint8(1), + 82: uint8(1), + 83: uint8(1), + 84: uint8(1), + 85: uint8(1), + 86: uint8(1), + 87: uint8(1), + 89: uint8(2), + 90: uint8(2), + 91: uint8(9), + 92: uint8(28), + 93: uint8(28), + 94: uint8(28), + 95: uint8(2), + 96: uint8(8), + 97: uint8(1), + 98: uint8(1), + 99: uint8(1), + 100: uint8(1), + 101: uint8(1), + 102: uint8(1), + 103: uint8(1), + 104: uint8(1), + 105: uint8(1), + 106: uint8(1), + 107: uint8(1), + 108: uint8(1), + 109: uint8(1), + 110: uint8(1), + 111: uint8(1), + 112: uint8(1), + 113: uint8(1), + 114: uint8(1), + 115: uint8(1), + 116: uint8(1), + 117: uint8(1), + 118: uint8(1), + 119: uint8(1), + 121: uint8(2), + 122: uint8(2), + 123: uint8(28), + 124: uint8(10), + 125: uint8(28), + 126: uint8(25), + 127: uint8(28), + 128: uint8(27), + 129: uint8(27), + 130: uint8(27), + 131: uint8(27), + 132: uint8(27), + 133: uint8(27), + 134: uint8(27), + 135: uint8(27), + 136: uint8(27), + 137: uint8(27), + 138: uint8(27), + 139: uint8(27), + 140: uint8(27), + 141: uint8(27), + 142: uint8(27), + 143: uint8(27), + 144: uint8(27), + 145: uint8(27), + 146: uint8(27), + 147: uint8(27), + 148: uint8(27), + 149: uint8(27), + 150: uint8(27), + 151: uint8(27), + 152: uint8(27), + 153: uint8(27), + 154: uint8(27), + 155: uint8(27), + 156: uint8(27), + 157: uint8(27), + 158: uint8(27), + 159: uint8(27), + 160: uint8(27), + 161: uint8(27), + 162: uint8(27), + 163: uint8(27), + 164: uint8(27), + 165: uint8(27), + 166: uint8(27), + 167: uint8(27), + 168: uint8(27), + 169: uint8(27), + 170: uint8(27), + 171: uint8(27), + 172: uint8(27), + 173: uint8(27), + 174: uint8(27), + 175: uint8(27), + 176: uint8(27), + 177: uint8(27), + 178: uint8(27), + 179: uint8(27), + 180: uint8(27), + 181: uint8(27), + 182: uint8(27), + 183: uint8(27), + 184: uint8(27), + 185: uint8(27), + 186: uint8(27), + 187: uint8(27), + 188: uint8(27), + 189: uint8(27), + 190: uint8(27), + 191: uint8(27), + 192: uint8(27), + 193: uint8(27), + 194: uint8(27), + 195: uint8(27), + 196: uint8(27), + 197: uint8(27), + 198: uint8(27), + 199: uint8(27), + 200: uint8(27), + 201: uint8(27), + 202: uint8(27), + 203: uint8(27), + 204: uint8(27), + 205: uint8(27), + 206: uint8(27), + 207: uint8(27), + 208: uint8(27), + 209: uint8(27), + 210: uint8(27), + 211: uint8(27), + 212: uint8(27), + 213: uint8(27), + 214: uint8(27), + 215: uint8(27), + 216: uint8(27), + 217: uint8(27), + 218: uint8(27), + 219: uint8(27), + 220: uint8(27), + 221: uint8(27), + 222: uint8(27), + 223: uint8(27), + 224: uint8(27), + 225: uint8(27), + 226: uint8(27), + 227: uint8(27), + 228: uint8(27), + 229: uint8(27), + 230: uint8(27), + 231: uint8(27), + 232: uint8(27), + 233: uint8(27), + 234: uint8(27), + 235: uint8(27), + 236: uint8(27), + 237: uint8(27), + 238: uint8(27), + 239: uint8(30), + 240: uint8(27), + 241: uint8(27), + 242: uint8(27), + 243: uint8(27), + 244: uint8(27), + 245: uint8(27), + 246: uint8(27), + 247: uint8(27), + 248: uint8(27), + 249: uint8(27), + 250: uint8(27), + 251: uint8(27), + 252: uint8(27), + 253: uint8(27), + 254: uint8(27), + 255: uint8(27), +} + +/* +** The charMap() macro maps alphabetic characters (only) into their +** lower-case ASCII equivalent. On ASCII machines, this is just +** an upper-to-lower case map. On EBCDIC machines we also need +** to adjust the encoding. The mapping is only valid for alphabetics +** which are the only characters for which this feature is used. +** +** Used by keywordhash.h + */ + +// C documentation +// +// /* +// ** The sqlite3KeywordCode function looks up an identifier to determine if +// ** it is a keyword. If it is a keyword, the token code of that keyword is +// ** returned. If the input is not a keyword, TK_ID is returned. +// ** +// ** The implementation of this routine was generated by a program, +// ** mkkeywordhash.c, located in the tool subdirectory of the distribution. +// ** The output of the mkkeywordhash.c program is written into a file +// ** named keywordhash.h and then included into this source file by +// ** the #include below. +// */ +// /************** Include keywordhash.h in the middle of tokenize.c ************/ +// /************** Begin file keywordhash.h *************************************/ +// /***** This file contains automatically generated code ****** +// ** +// ** The code in this file has been automatically generated by +// ** +// ** sqlite/tool/mkkeywordhash.c +// ** +// ** The code in this file implements a function that determines whether +// ** or not a given identifier is really an SQL keyword. The same thing +// ** might be implemented more directly using a hand-written hash table. +// ** But by using this automatically generated code, the size of the code +// ** is substantially reduced. This is important for embedded applications +// ** on platforms with limited memory. +// */ +// /* Hash score: 231 */ +// /* zKWText[] encodes 1007 bytes of keyword text in 667 bytes */ +// /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ +// /* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */ +// /* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */ +// /* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */ +// /* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */ +// /* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */ +// /* PRAGMATERIALIZEDEFERREDISTINCTUPDATEVALUESVIRTUALWAYSWHENWHERE */ +// /* CURSIVEABORTAFTERENAMEANDROPARTITIONAUTOINCREMENTCASTCOLUMN */ +// /* COMMITCONFLICTCROSSCURRENT_TIMESTAMPRECEDINGFAILASTFILTER */ +// /* EPLACEFIRSTFOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVER */ +// /* ETURNINGRIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBY */ +// /* INITIALLYPRIMARY */ +var _zKWText = [666]int8{ + 0: int8('R'), + 1: int8('E'), + 2: int8('I'), + 3: int8('N'), + 4: int8('D'), + 5: int8('E'), + 6: int8('X'), + 7: int8('E'), + 8: int8('D'), + 9: int8('E'), + 10: int8('S'), + 11: int8('C'), + 12: int8('A'), + 13: int8('P'), + 14: int8('E'), + 15: int8('A'), + 16: int8('C'), + 17: int8('H'), + 18: int8('E'), + 19: int8('C'), + 20: int8('K'), + 21: int8('E'), + 22: int8('Y'), + 23: int8('B'), + 24: int8('E'), + 25: int8('F'), + 26: int8('O'), + 27: int8('R'), + 28: int8('E'), + 29: int8('I'), + 30: int8('G'), + 31: int8('N'), + 32: int8('O'), + 33: int8('R'), + 34: int8('E'), + 35: int8('G'), + 36: int8('E'), + 37: int8('X'), + 38: int8('P'), + 39: int8('L'), + 40: int8('A'), + 41: int8('I'), + 42: int8('N'), + 43: int8('S'), + 44: int8('T'), + 45: int8('E'), + 46: int8('A'), + 47: int8('D'), + 48: int8('D'), + 49: int8('A'), + 50: int8('T'), + 51: int8('A'), + 52: int8('B'), + 53: int8('A'), + 54: int8('S'), + 55: int8('E'), + 56: int8('L'), + 57: int8('E'), + 58: int8('C'), + 59: int8('T'), + 60: int8('A'), + 61: int8('B'), + 62: int8('L'), + 63: int8('E'), + 64: int8('F'), + 65: int8('T'), + 66: int8('H'), + 67: int8('E'), + 68: int8('N'), + 69: int8('D'), + 70: int8('E'), + 71: int8('F'), + 72: int8('E'), + 73: int8('R'), + 74: int8('R'), + 75: int8('A'), + 76: int8('B'), + 77: int8('L'), + 78: int8('E'), + 79: int8('L'), + 80: int8('S'), + 81: int8('E'), + 82: int8('X'), + 83: int8('C'), + 84: int8('L'), + 85: int8('U'), + 86: int8('D'), + 87: int8('E'), + 88: int8('L'), + 89: int8('E'), + 90: int8('T'), + 91: int8('E'), + 92: int8('M'), + 93: int8('P'), + 94: int8('O'), + 95: int8('R'), + 96: int8('A'), + 97: int8('R'), + 98: int8('Y'), + 99: int8('I'), + 100: int8('S'), + 101: int8('N'), + 102: int8('U'), + 103: int8('L'), + 104: int8('L'), + 105: int8('S'), + 106: int8('A'), + 107: int8('V'), + 108: int8('E'), + 109: int8('P'), + 110: int8('O'), + 111: int8('I'), + 112: int8('N'), + 113: int8('T'), + 114: int8('E'), + 115: int8('R'), + 116: int8('S'), + 117: int8('E'), + 118: int8('C'), + 119: int8('T'), + 120: int8('I'), + 121: int8('E'), + 122: int8('S'), + 123: int8('N'), + 124: int8('O'), + 125: int8('T'), + 126: int8('N'), + 127: int8('U'), + 128: int8('L'), + 129: int8('L'), + 130: int8('I'), + 131: int8('K'), + 132: int8('E'), + 133: int8('X'), + 134: int8('C'), + 135: int8('E'), + 136: int8('P'), + 137: int8('T'), + 138: int8('R'), + 139: int8('A'), + 140: int8('N'), + 141: int8('S'), + 142: int8('A'), + 143: int8('C'), + 144: int8('T'), + 145: int8('I'), + 146: int8('O'), + 147: int8('N'), + 148: int8('A'), + 149: int8('T'), + 150: int8('U'), + 151: int8('R'), + 152: int8('A'), + 153: int8('L'), + 154: int8('T'), + 155: int8('E'), + 156: int8('R'), + 157: int8('A'), + 158: int8('I'), + 159: int8('S'), + 160: int8('E'), + 161: int8('X'), + 162: int8('C'), + 163: int8('L'), + 164: int8('U'), + 165: int8('S'), + 166: int8('I'), + 167: int8('V'), + 168: int8('E'), + 169: int8('X'), + 170: int8('I'), + 171: int8('S'), + 172: int8('T'), + 173: int8('S'), + 174: int8('C'), + 175: int8('O'), + 176: int8('N'), + 177: int8('S'), + 178: int8('T'), + 179: int8('R'), + 180: int8('A'), + 181: int8('I'), + 182: int8('N'), + 183: int8('T'), + 184: int8('O'), + 185: int8('F'), + 186: int8('F'), + 187: int8('S'), + 188: int8('E'), + 189: int8('T'), + 190: int8('R'), + 191: int8('I'), + 192: int8('G'), + 193: int8('G'), + 194: int8('E'), + 195: int8('R'), + 196: int8('A'), + 197: int8('N'), + 198: int8('G'), + 199: int8('E'), + 200: int8('N'), + 201: int8('E'), + 202: int8('R'), + 203: int8('A'), + 204: int8('T'), + 205: int8('E'), + 206: int8('D'), + 207: int8('E'), + 208: int8('T'), + 209: int8('A'), + 210: int8('C'), + 211: int8('H'), + 212: int8('A'), + 213: int8('V'), + 214: int8('I'), + 215: int8('N'), + 216: int8('G'), + 217: int8('L'), + 218: int8('O'), + 219: int8('B'), + 220: int8('E'), + 221: int8('G'), + 222: int8('I'), + 223: int8('N'), + 224: int8('N'), + 225: int8('E'), + 226: int8('R'), + 227: int8('E'), + 228: int8('F'), + 229: int8('E'), + 230: int8('R'), + 231: int8('E'), + 232: int8('N'), + 233: int8('C'), + 234: int8('E'), + 235: int8('S'), + 236: int8('U'), + 237: int8('N'), + 238: int8('I'), + 239: int8('Q'), + 240: int8('U'), + 241: int8('E'), + 242: int8('R'), + 243: int8('Y'), + 244: int8('W'), + 245: int8('I'), + 246: int8('T'), + 247: int8('H'), + 248: int8('O'), + 249: int8('U'), + 250: int8('T'), + 251: int8('E'), + 252: int8('R'), + 253: int8('E'), + 254: int8('L'), + 255: int8('E'), + 256: int8('A'), + 257: int8('S'), + 258: int8('E'), + 259: int8('A'), + 260: int8('T'), + 261: int8('T'), + 262: int8('A'), + 263: int8('C'), + 264: int8('H'), + 265: int8('B'), + 266: int8('E'), + 267: int8('T'), + 268: int8('W'), + 269: int8('E'), + 270: int8('E'), + 271: int8('N'), + 272: int8('O'), + 273: int8('T'), + 274: int8('H'), + 275: int8('I'), + 276: int8('N'), + 277: int8('G'), + 278: int8('R'), + 279: int8('O'), + 280: int8('U'), + 281: int8('P'), + 282: int8('S'), + 283: int8('C'), + 284: int8('A'), + 285: int8('S'), + 286: int8('C'), + 287: int8('A'), + 288: int8('D'), + 289: int8('E'), + 290: int8('F'), + 291: int8('A'), + 292: int8('U'), + 293: int8('L'), + 294: int8('T'), + 295: int8('C'), + 296: int8('A'), + 297: int8('S'), + 298: int8('E'), + 299: int8('C'), + 300: int8('O'), + 301: int8('L'), + 302: int8('L'), + 303: int8('A'), + 304: int8('T'), + 305: int8('E'), + 306: int8('C'), + 307: int8('R'), + 308: int8('E'), + 309: int8('A'), + 310: int8('T'), + 311: int8('E'), + 312: int8('C'), + 313: int8('U'), + 314: int8('R'), + 315: int8('R'), + 316: int8('E'), + 317: int8('N'), + 318: int8('T'), + 319: int8('_'), + 320: int8('D'), + 321: int8('A'), + 322: int8('T'), + 323: int8('E'), + 324: int8('I'), + 325: int8('M'), + 326: int8('M'), + 327: int8('E'), + 328: int8('D'), + 329: int8('I'), + 330: int8('A'), + 331: int8('T'), + 332: int8('E'), + 333: int8('J'), + 334: int8('O'), + 335: int8('I'), + 336: int8('N'), + 337: int8('S'), + 338: int8('E'), + 339: int8('R'), + 340: int8('T'), + 341: int8('M'), + 342: int8('A'), + 343: int8('T'), + 344: int8('C'), + 345: int8('H'), + 346: int8('P'), + 347: int8('L'), + 348: int8('A'), + 349: int8('N'), + 350: int8('A'), + 351: int8('L'), + 352: int8('Y'), + 353: int8('Z'), + 354: int8('E'), + 355: int8('P'), + 356: int8('R'), + 357: int8('A'), + 358: int8('G'), + 359: int8('M'), + 360: int8('A'), + 361: int8('T'), + 362: int8('E'), + 363: int8('R'), + 364: int8('I'), + 365: int8('A'), + 366: int8('L'), + 367: int8('I'), + 368: int8('Z'), + 369: int8('E'), + 370: int8('D'), + 371: int8('E'), + 372: int8('F'), + 373: int8('E'), + 374: int8('R'), + 375: int8('R'), + 376: int8('E'), + 377: int8('D'), + 378: int8('I'), + 379: int8('S'), + 380: int8('T'), + 381: int8('I'), + 382: int8('N'), + 383: int8('C'), + 384: int8('T'), + 385: int8('U'), + 386: int8('P'), + 387: int8('D'), + 388: int8('A'), + 389: int8('T'), + 390: int8('E'), + 391: int8('V'), + 392: int8('A'), + 393: int8('L'), + 394: int8('U'), + 395: int8('E'), + 396: int8('S'), + 397: int8('V'), + 398: int8('I'), + 399: int8('R'), + 400: int8('T'), + 401: int8('U'), + 402: int8('A'), + 403: int8('L'), + 404: int8('W'), + 405: int8('A'), + 406: int8('Y'), + 407: int8('S'), + 408: int8('W'), + 409: int8('H'), + 410: int8('E'), + 411: int8('N'), + 412: int8('W'), + 413: int8('H'), + 414: int8('E'), + 415: int8('R'), + 416: int8('E'), + 417: int8('C'), + 418: int8('U'), + 419: int8('R'), + 420: int8('S'), + 421: int8('I'), + 422: int8('V'), + 423: int8('E'), + 424: int8('A'), + 425: int8('B'), + 426: int8('O'), + 427: int8('R'), + 428: int8('T'), + 429: int8('A'), + 430: int8('F'), + 431: int8('T'), + 432: int8('E'), + 433: int8('R'), + 434: int8('E'), + 435: int8('N'), + 436: int8('A'), + 437: int8('M'), + 438: int8('E'), + 439: int8('A'), + 440: int8('N'), + 441: int8('D'), + 442: int8('R'), + 443: int8('O'), + 444: int8('P'), + 445: int8('A'), + 446: int8('R'), + 447: int8('T'), + 448: int8('I'), + 449: int8('T'), + 450: int8('I'), + 451: int8('O'), + 452: int8('N'), + 453: int8('A'), + 454: int8('U'), + 455: int8('T'), + 456: int8('O'), + 457: int8('I'), + 458: int8('N'), + 459: int8('C'), + 460: int8('R'), + 461: int8('E'), + 462: int8('M'), + 463: int8('E'), + 464: int8('N'), + 465: int8('T'), + 466: int8('C'), + 467: int8('A'), + 468: int8('S'), + 469: int8('T'), + 470: int8('C'), + 471: int8('O'), + 472: int8('L'), + 473: int8('U'), + 474: int8('M'), + 475: int8('N'), + 476: int8('C'), + 477: int8('O'), + 478: int8('M'), + 479: int8('M'), + 480: int8('I'), + 481: int8('T'), + 482: int8('C'), + 483: int8('O'), + 484: int8('N'), + 485: int8('F'), + 486: int8('L'), + 487: int8('I'), + 488: int8('C'), + 489: int8('T'), + 490: int8('C'), + 491: int8('R'), + 492: int8('O'), + 493: int8('S'), + 494: int8('S'), + 495: int8('C'), + 496: int8('U'), + 497: int8('R'), + 498: int8('R'), + 499: int8('E'), + 500: int8('N'), + 501: int8('T'), + 502: int8('_'), + 503: int8('T'), + 504: int8('I'), + 505: int8('M'), + 506: int8('E'), + 507: int8('S'), + 508: int8('T'), + 509: int8('A'), + 510: int8('M'), + 511: int8('P'), + 512: int8('R'), + 513: int8('E'), + 514: int8('C'), + 515: int8('E'), + 516: int8('D'), + 517: int8('I'), + 518: int8('N'), + 519: int8('G'), + 520: int8('F'), + 521: int8('A'), + 522: int8('I'), + 523: int8('L'), + 524: int8('A'), + 525: int8('S'), + 526: int8('T'), + 527: int8('F'), + 528: int8('I'), + 529: int8('L'), + 530: int8('T'), + 531: int8('E'), + 532: int8('R'), + 533: int8('E'), + 534: int8('P'), + 535: int8('L'), + 536: int8('A'), + 537: int8('C'), + 538: int8('E'), + 539: int8('F'), + 540: int8('I'), + 541: int8('R'), + 542: int8('S'), + 543: int8('T'), + 544: int8('F'), + 545: int8('O'), + 546: int8('L'), + 547: int8('L'), + 548: int8('O'), + 549: int8('W'), + 550: int8('I'), + 551: int8('N'), + 552: int8('G'), + 553: int8('F'), + 554: int8('R'), + 555: int8('O'), + 556: int8('M'), + 557: int8('F'), + 558: int8('U'), + 559: int8('L'), + 560: int8('L'), + 561: int8('I'), + 562: int8('M'), + 563: int8('I'), + 564: int8('T'), + 565: int8('I'), + 566: int8('F'), + 567: int8('O'), + 568: int8('R'), + 569: int8('D'), + 570: int8('E'), + 571: int8('R'), + 572: int8('E'), + 573: int8('S'), + 574: int8('T'), + 575: int8('R'), + 576: int8('I'), + 577: int8('C'), + 578: int8('T'), + 579: int8('O'), + 580: int8('T'), + 581: int8('H'), + 582: int8('E'), + 583: int8('R'), + 584: int8('S'), + 585: int8('O'), + 586: int8('V'), + 587: int8('E'), + 588: int8('R'), + 589: int8('E'), + 590: int8('T'), + 591: int8('U'), + 592: int8('R'), + 593: int8('N'), + 594: int8('I'), + 595: int8('N'), + 596: int8('G'), + 597: int8('R'), + 598: int8('I'), + 599: int8('G'), + 600: int8('H'), + 601: int8('T'), + 602: int8('R'), + 603: int8('O'), + 604: int8('L'), + 605: int8('L'), + 606: int8('B'), + 607: int8('A'), + 608: int8('C'), + 609: int8('K'), + 610: int8('R'), + 611: int8('O'), + 612: int8('W'), + 613: int8('S'), + 614: int8('U'), + 615: int8('N'), + 616: int8('B'), + 617: int8('O'), + 618: int8('U'), + 619: int8('N'), + 620: int8('D'), + 621: int8('E'), + 622: int8('D'), + 623: int8('U'), + 624: int8('N'), + 625: int8('I'), + 626: int8('O'), + 627: int8('N'), + 628: int8('U'), + 629: int8('S'), + 630: int8('I'), + 631: int8('N'), + 632: int8('G'), + 633: int8('V'), + 634: int8('A'), + 635: int8('C'), + 636: int8('U'), + 637: int8('U'), + 638: int8('M'), + 639: int8('V'), + 640: int8('I'), + 641: int8('E'), + 642: int8('W'), + 643: int8('I'), + 644: int8('N'), + 645: int8('D'), + 646: int8('O'), + 647: int8('W'), + 648: int8('B'), + 649: int8('Y'), + 650: int8('I'), + 651: int8('N'), + 652: int8('I'), + 653: int8('T'), + 654: int8('I'), + 655: int8('A'), + 656: int8('L'), + 657: int8('L'), + 658: int8('Y'), + 659: int8('P'), + 660: int8('R'), + 661: int8('I'), + 662: int8('M'), + 663: int8('A'), + 664: int8('R'), + 665: int8('Y'), +} + +// C documentation +// +// /* aKWHash[i] is the hash value for the i-th keyword */ +var _aKWHash = [127]uint8{ + 0: uint8(84), + 1: uint8(92), + 2: uint8(134), + 3: uint8(82), + 4: uint8(105), + 5: uint8(29), + 8: uint8(94), + 10: uint8(85), + 11: uint8(72), + 13: uint8(53), + 14: uint8(35), + 15: uint8(86), + 16: uint8(15), + 18: uint8(42), + 19: uint8(97), + 20: uint8(54), + 21: uint8(89), + 22: uint8(135), + 23: uint8(19), + 26: uint8(140), + 28: uint8(40), + 29: uint8(129), + 31: uint8(22), + 32: uint8(107), + 34: uint8(9), + 37: uint8(123), + 38: uint8(80), + 40: uint8(78), + 41: uint8(6), + 43: uint8(65), + 44: uint8(103), + 45: uint8(147), + 47: uint8(136), + 48: uint8(115), + 51: uint8(48), + 53: uint8(90), + 54: uint8(24), + 56: uint8(17), + 58: uint8(27), + 59: uint8(70), + 60: uint8(23), + 61: uint8(26), + 62: uint8(5), + 63: uint8(60), + 64: uint8(142), + 65: uint8(110), + 66: uint8(122), + 68: uint8(73), + 69: uint8(91), + 70: uint8(71), + 71: uint8(145), + 72: uint8(61), + 73: uint8(120), + 74: uint8(74), + 76: uint8(49), + 78: uint8(11), + 79: uint8(41), + 81: uint8(113), + 85: uint8(109), + 86: uint8(10), + 87: uint8(111), + 88: uint8(116), + 89: uint8(125), + 90: uint8(14), + 91: uint8(50), + 92: uint8(124), + 94: uint8(100), + 96: uint8(18), + 97: uint8(121), + 98: uint8(144), + 99: uint8(56), + 100: uint8(130), + 101: uint8(139), + 102: uint8(88), + 103: uint8(83), + 104: uint8(37), + 105: uint8(30), + 106: uint8(126), + 109: uint8(108), + 110: uint8(51), + 111: uint8(131), + 112: uint8(128), + 114: uint8(34), + 117: uint8(132), + 119: uint8(98), + 120: uint8(38), + 121: uint8(39), + 123: uint8(20), + 124: uint8(45), + 125: uint8(117), + 126: uint8(93), +} + +// C documentation +// +// /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0 +// ** then the i-th keyword has no more hash collisions. Otherwise, +// ** the next keyword with the same hash is aKWHash[i]-1. */ +var _aKWNext = [148]uint8{ + 5: uint8(4), + 7: uint8(43), + 10: uint8(106), + 11: uint8(114), + 15: uint8(2), + 18: uint8(143), + 22: uint8(13), + 27: uint8(141), + 30: uint8(119), + 31: uint8(52), + 34: uint8(137), + 35: uint8(12), + 38: uint8(62), + 40: uint8(138), + 42: uint8(133), + 45: uint8(36), + 48: uint8(28), + 49: uint8(77), + 54: uint8(59), + 56: uint8(47), + 67: uint8(69), + 73: uint8(146), + 74: uint8(3), + 76: uint8(58), + 78: uint8(1), + 79: uint8(75), + 83: uint8(31), + 89: uint8(127), + 91: uint8(104), + 93: uint8(64), + 94: uint8(66), + 95: uint8(63), + 101: uint8(46), + 103: uint8(16), + 104: uint8(8), + 115: uint8(81), + 116: uint8(101), + 118: uint8(112), + 119: uint8(21), + 120: uint8(7), + 121: uint8(67), + 123: uint8(79), + 124: uint8(96), + 125: uint8(118), + 128: uint8(68), + 131: uint8(99), + 132: uint8(44), + 134: uint8(55), + 136: uint8(76), + 138: uint8(95), + 139: uint8(32), + 140: uint8(33), + 141: uint8(57), + 142: uint8(25), + 144: uint8(102), + 147: uint8(87), +} + +// C documentation +// +// /* aKWLen[i] is the length (in bytes) of the i-th keyword */ +var _aKWLen = [148]uint8{ + 1: uint8(7), + 2: uint8(7), + 3: uint8(5), + 4: uint8(4), + 5: uint8(6), + 6: uint8(4), + 7: uint8(5), + 8: uint8(3), + 9: uint8(6), + 10: uint8(7), + 11: uint8(3), + 12: uint8(6), + 13: uint8(6), + 14: uint8(7), + 15: uint8(7), + 16: uint8(3), + 17: uint8(8), + 18: uint8(2), + 19: uint8(6), + 20: uint8(5), + 21: uint8(4), + 22: uint8(4), + 23: uint8(3), + 24: uint8(10), + 25: uint8(4), + 26: uint8(7), + 27: uint8(6), + 28: uint8(9), + 29: uint8(4), + 30: uint8(2), + 31: uint8(6), + 32: uint8(5), + 33: uint8(9), + 34: uint8(9), + 35: uint8(4), + 36: uint8(7), + 37: uint8(3), + 38: uint8(2), + 39: uint8(4), + 40: uint8(4), + 41: uint8(6), + 42: uint8(11), + 43: uint8(6), + 44: uint8(2), + 45: uint8(7), + 46: uint8(5), + 47: uint8(5), + 48: uint8(9), + 49: uint8(6), + 50: uint8(10), + 51: uint8(4), + 52: uint8(6), + 53: uint8(2), + 54: uint8(3), + 55: uint8(7), + 56: uint8(5), + 57: uint8(9), + 58: uint8(6), + 59: uint8(6), + 60: uint8(4), + 61: uint8(5), + 62: uint8(5), + 63: uint8(10), + 64: uint8(6), + 65: uint8(5), + 66: uint8(7), + 67: uint8(4), + 68: uint8(5), + 69: uint8(7), + 70: uint8(6), + 71: uint8(7), + 72: uint8(7), + 73: uint8(6), + 74: uint8(5), + 75: uint8(7), + 76: uint8(3), + 77: uint8(7), + 78: uint8(4), + 79: uint8(7), + 80: uint8(6), + 81: uint8(12), + 82: uint8(9), + 83: uint8(4), + 84: uint8(6), + 85: uint8(5), + 86: uint8(4), + 87: uint8(7), + 88: uint8(6), + 89: uint8(12), + 90: uint8(8), + 91: uint8(8), + 92: uint8(2), + 93: uint8(6), + 94: uint8(6), + 95: uint8(7), + 96: uint8(6), + 97: uint8(4), + 98: uint8(5), + 99: uint8(9), + 100: uint8(5), + 101: uint8(5), + 102: uint8(6), + 103: uint8(3), + 104: uint8(4), + 105: uint8(9), + 106: uint8(13), + 107: uint8(2), + 108: uint8(2), + 109: uint8(4), + 110: uint8(6), + 111: uint8(6), + 112: uint8(8), + 113: uint8(5), + 114: uint8(17), + 115: uint8(12), + 116: uint8(7), + 117: uint8(9), + 118: uint8(4), + 119: uint8(4), + 120: uint8(6), + 121: uint8(7), + 122: uint8(5), + 123: uint8(9), + 124: uint8(4), + 125: uint8(4), + 126: uint8(5), + 127: uint8(2), + 128: uint8(5), + 129: uint8(8), + 130: uint8(6), + 131: uint8(4), + 132: uint8(9), + 133: uint8(5), + 134: uint8(8), + 135: uint8(4), + 136: uint8(3), + 137: uint8(9), + 138: uint8(5), + 139: uint8(5), + 140: uint8(6), + 141: uint8(4), + 142: uint8(6), + 143: uint8(2), + 144: uint8(2), + 145: uint8(9), + 146: uint8(3), + 147: uint8(7), +} + +// C documentation +// +// /* aKWOffset[i] is the index into zKWText[] of the start of +// ** the text for the i-th keyword. */ +var _aKWOffset = [148]uint16{ + 2: uint16(2), + 3: uint16(2), + 4: uint16(8), + 5: uint16(9), + 6: uint16(14), + 7: uint16(16), + 8: uint16(20), + 9: uint16(23), + 10: uint16(25), + 11: uint16(25), + 12: uint16(29), + 13: uint16(33), + 14: uint16(36), + 15: uint16(41), + 16: uint16(46), + 17: uint16(48), + 18: uint16(53), + 19: uint16(54), + 20: uint16(59), + 21: uint16(62), + 22: uint16(65), + 23: uint16(67), + 24: uint16(69), + 25: uint16(78), + 26: uint16(81), + 27: uint16(86), + 28: uint16(90), + 29: uint16(90), + 30: uint16(94), + 31: uint16(99), + 32: uint16(101), + 33: uint16(105), + 34: uint16(111), + 35: uint16(119), + 36: uint16(123), + 37: uint16(123), + 38: uint16(123), + 39: uint16(126), + 40: uint16(129), + 41: uint16(132), + 42: uint16(137), + 43: uint16(142), + 44: uint16(146), + 45: uint16(147), + 46: uint16(152), + 47: uint16(156), + 48: uint16(160), + 49: uint16(168), + 50: uint16(174), + 51: uint16(181), + 52: uint16(184), + 53: uint16(184), + 54: uint16(187), + 55: uint16(189), + 56: uint16(195), + 57: uint16(198), + 58: uint16(206), + 59: uint16(211), + 60: uint16(216), + 61: uint16(219), + 62: uint16(222), + 63: uint16(226), + 64: uint16(236), + 65: uint16(239), + 66: uint16(244), + 67: uint16(244), + 68: uint16(248), + 69: uint16(252), + 70: uint16(259), + 71: uint16(265), + 72: uint16(271), + 73: uint16(277), + 74: uint16(277), + 75: uint16(283), + 76: uint16(284), + 77: uint16(288), + 78: uint16(295), + 79: uint16(299), + 80: uint16(306), + 81: uint16(312), + 82: uint16(324), + 83: uint16(333), + 84: uint16(335), + 85: uint16(341), + 86: uint16(346), + 87: uint16(348), + 88: uint16(355), + 89: uint16(359), + 90: uint16(370), + 91: uint16(377), + 92: uint16(378), + 93: uint16(385), + 94: uint16(391), + 95: uint16(397), + 96: uint16(402), + 97: uint16(408), + 98: uint16(412), + 99: uint16(415), + 100: uint16(424), + 101: uint16(429), + 102: uint16(433), + 103: uint16(439), + 104: uint16(441), + 105: uint16(444), + 106: uint16(453), + 107: uint16(455), + 108: uint16(457), + 109: uint16(466), + 110: uint16(470), + 111: uint16(476), + 112: uint16(482), + 113: uint16(490), + 114: uint16(495), + 115: uint16(495), + 116: uint16(495), + 117: uint16(511), + 118: uint16(520), + 119: uint16(523), + 120: uint16(527), + 121: uint16(532), + 122: uint16(539), + 123: uint16(544), + 124: uint16(553), + 125: uint16(557), + 126: uint16(560), + 127: uint16(565), + 128: uint16(567), + 129: uint16(571), + 130: uint16(579), + 131: uint16(585), + 132: uint16(588), + 133: uint16(597), + 134: uint16(602), + 135: uint16(610), + 136: uint16(610), + 137: uint16(614), + 138: uint16(623), + 139: uint16(628), + 140: uint16(633), + 141: uint16(639), + 142: uint16(642), + 143: uint16(645), + 144: uint16(648), + 145: uint16(650), + 146: uint16(655), + 147: uint16(659), +} + +// C documentation +// +// /* aKWCode[i] is the parser symbol code for the i-th keyword */ +var _aKWCode = [148]uint8{ + 1: uint8(TK_REINDEX), + 2: uint8(TK_INDEXED), + 3: uint8(TK_INDEX), + 4: uint8(TK_DESC), + 5: uint8(TK_ESCAPE), + 6: uint8(TK_EACH), + 7: uint8(TK_CHECK), + 8: uint8(TK_KEY), + 9: uint8(TK_BEFORE), + 10: uint8(TK_FOREIGN), + 11: uint8(TK_FOR), + 12: uint8(TK_IGNORE), + 13: uint8(TK_LIKE_KW), + 14: uint8(TK_EXPLAIN), + 15: uint8(TK_INSTEAD), + 16: uint8(TK_ADD), + 17: uint8(TK_DATABASE), + 18: uint8(TK_AS), + 19: uint8(TK_SELECT), + 20: uint8(TK_TABLE), + 21: uint8(TK_JOIN_KW), + 22: uint8(TK_THEN), + 23: uint8(TK_END), + 24: uint8(TK_DEFERRABLE), + 25: uint8(TK_ELSE), + 26: uint8(TK_EXCLUDE), + 27: uint8(TK_DELETE), + 28: uint8(TK_TEMP), + 29: uint8(TK_TEMP), + 30: uint8(TK_OR), + 31: uint8(TK_ISNULL), + 32: uint8(TK_NULLS), + 33: uint8(TK_SAVEPOINT), + 34: uint8(TK_INTERSECT), + 35: uint8(TK_TIES), + 36: uint8(TK_NOTNULL), + 37: uint8(TK_NOT), + 38: uint8(TK_NO), + 39: uint8(TK_NULL), + 40: uint8(TK_LIKE_KW), + 41: uint8(TK_EXCEPT), + 42: uint8(TK_TRANSACTION), + 43: uint8(TK_ACTION), + 44: uint8(TK_ON), + 45: uint8(TK_JOIN_KW), + 46: uint8(TK_ALTER), + 47: uint8(TK_RAISE), + 48: uint8(TK_EXCLUSIVE), + 49: uint8(TK_EXISTS), + 50: uint8(TK_CONSTRAINT), + 51: uint8(TK_INTO), + 52: uint8(TK_OFFSET), + 53: uint8(TK_OF), + 54: uint8(TK_SET), + 55: uint8(TK_TRIGGER), + 56: uint8(TK_RANGE), + 57: uint8(TK_GENERATED), + 58: uint8(TK_DETACH), + 59: uint8(TK_HAVING), + 60: uint8(TK_LIKE_KW), + 61: uint8(TK_BEGIN), + 62: uint8(TK_JOIN_KW), + 63: uint8(TK_REFERENCES), + 64: uint8(TK_UNIQUE), + 65: uint8(TK_QUERY), + 66: uint8(TK_WITHOUT), + 67: uint8(TK_WITH), + 68: uint8(TK_JOIN_KW), + 69: uint8(TK_RELEASE), + 70: uint8(TK_ATTACH), + 71: uint8(TK_BETWEEN), + 72: uint8(TK_NOTHING), + 73: uint8(TK_GROUPS), + 74: uint8(TK_GROUP), + 75: uint8(TK_CASCADE), + 76: uint8(TK_ASC), + 77: uint8(TK_DEFAULT), + 78: uint8(TK_CASE), + 79: uint8(TK_COLLATE), + 80: uint8(TK_CREATE), + 81: uint8(TK_CTIME_KW), + 82: uint8(TK_IMMEDIATE), + 83: uint8(TK_JOIN), + 84: uint8(TK_INSERT), + 85: uint8(TK_MATCH), + 86: uint8(TK_PLAN), + 87: uint8(TK_ANALYZE), + 88: uint8(TK_PRAGMA), + 89: uint8(TK_MATERIALIZED), + 90: uint8(TK_DEFERRED), + 91: uint8(TK_DISTINCT), + 92: uint8(TK_IS), + 93: uint8(TK_UPDATE), + 94: uint8(TK_VALUES), + 95: uint8(TK_VIRTUAL), + 96: uint8(TK_ALWAYS), + 97: uint8(TK_WHEN), + 98: uint8(TK_WHERE), + 99: uint8(TK_RECURSIVE), + 100: uint8(TK_ABORT), + 101: uint8(TK_AFTER), + 102: uint8(TK_RENAME), + 103: uint8(TK_AND), + 104: uint8(TK_DROP), + 105: uint8(TK_PARTITION), + 106: uint8(TK_AUTOINCR), + 107: uint8(TK_TO), + 108: uint8(TK_IN), + 109: uint8(TK_CAST), + 110: uint8(TK_COLUMNKW), + 111: uint8(TK_COMMIT), + 112: uint8(TK_CONFLICT), + 113: uint8(TK_JOIN_KW), + 114: uint8(TK_CTIME_KW), + 115: uint8(TK_CTIME_KW), + 116: uint8(TK_CURRENT), + 117: uint8(TK_PRECEDING), + 118: uint8(TK_FAIL), + 119: uint8(TK_LAST), + 120: uint8(TK_FILTER), + 121: uint8(TK_REPLACE), + 122: uint8(TK_FIRST), + 123: uint8(TK_FOLLOWING), + 124: uint8(TK_FROM), + 125: uint8(TK_JOIN_KW), + 126: uint8(TK_LIMIT), + 127: uint8(TK_IF), + 128: uint8(TK_ORDER), + 129: uint8(TK_RESTRICT), + 130: uint8(TK_OTHERS), + 131: uint8(TK_OVER), + 132: uint8(TK_RETURNING), + 133: uint8(TK_JOIN_KW), + 134: uint8(TK_ROLLBACK), + 135: uint8(TK_ROWS), + 136: uint8(TK_ROW), + 137: uint8(TK_UNBOUNDED), + 138: uint8(TK_UNION), + 139: uint8(TK_USING), + 140: uint8(TK_VACUUM), + 141: uint8(TK_VIEW), + 142: uint8(TK_WINDOW), + 143: uint8(TK_DO), + 144: uint8(TK_BY), + 145: uint8(TK_INITIALLY), + 146: uint8(TK_ALL), + 147: uint8(TK_PRIMARY), +} + +// C documentation +// +// /* Hash table decoded: +// ** 0: INSERT +// ** 1: IS +// ** 2: ROLLBACK TRIGGER +// ** 3: IMMEDIATE +// ** 4: PARTITION +// ** 5: TEMP +// ** 6: +// ** 7: +// ** 8: VALUES WITHOUT +// ** 9: +// ** 10: MATCH +// ** 11: NOTHING +// ** 12: +// ** 13: OF +// ** 14: TIES IGNORE +// ** 15: PLAN +// ** 16: INSTEAD INDEXED +// ** 17: +// ** 18: TRANSACTION RIGHT +// ** 19: WHEN +// ** 20: SET HAVING +// ** 21: MATERIALIZED IF +// ** 22: ROWS +// ** 23: SELECT +// ** 24: +// ** 25: +// ** 26: VACUUM SAVEPOINT +// ** 27: +// ** 28: LIKE UNION VIRTUAL REFERENCES +// ** 29: RESTRICT +// ** 30: +// ** 31: THEN REGEXP +// ** 32: TO +// ** 33: +// ** 34: BEFORE +// ** 35: +// ** 36: +// ** 37: FOLLOWING COLLATE CASCADE +// ** 38: CREATE +// ** 39: +// ** 40: CASE REINDEX +// ** 41: EACH +// ** 42: +// ** 43: QUERY +// ** 44: AND ADD +// ** 45: PRIMARY ANALYZE +// ** 46: +// ** 47: ROW ASC DETACH +// ** 48: CURRENT_TIME CURRENT_DATE +// ** 49: +// ** 50: +// ** 51: EXCLUSIVE TEMPORARY +// ** 52: +// ** 53: DEFERRED +// ** 54: DEFERRABLE +// ** 55: +// ** 56: DATABASE +// ** 57: +// ** 58: DELETE VIEW GENERATED +// ** 59: ATTACH +// ** 60: END +// ** 61: EXCLUDE +// ** 62: ESCAPE DESC +// ** 63: GLOB +// ** 64: WINDOW ELSE +// ** 65: COLUMN +// ** 66: FIRST +// ** 67: +// ** 68: GROUPS ALL +// ** 69: DISTINCT DROP KEY +// ** 70: BETWEEN +// ** 71: INITIALLY +// ** 72: BEGIN +// ** 73: FILTER CHECK ACTION +// ** 74: GROUP INDEX +// ** 75: +// ** 76: EXISTS DEFAULT +// ** 77: +// ** 78: FOR CURRENT_TIMESTAMP +// ** 79: EXCEPT +// ** 80: +// ** 81: CROSS +// ** 82: +// ** 83: +// ** 84: +// ** 85: CAST +// ** 86: FOREIGN AUTOINCREMENT +// ** 87: COMMIT +// ** 88: CURRENT AFTER ALTER +// ** 89: FULL FAIL CONFLICT +// ** 90: EXPLAIN +// ** 91: CONSTRAINT +// ** 92: FROM ALWAYS +// ** 93: +// ** 94: ABORT +// ** 95: +// ** 96: AS DO +// ** 97: REPLACE WITH RELEASE +// ** 98: BY RENAME +// ** 99: RANGE RAISE +// ** 100: OTHERS +// ** 101: USING NULLS +// ** 102: PRAGMA +// ** 103: JOIN ISNULL OFFSET +// ** 104: NOT +// ** 105: OR LAST LEFT +// ** 106: LIMIT +// ** 107: +// ** 108: +// ** 109: IN +// ** 110: INTO +// ** 111: OVER RECURSIVE +// ** 112: ORDER OUTER +// ** 113: +// ** 114: INTERSECT UNBOUNDED +// ** 115: +// ** 116: +// ** 117: RETURNING ON +// ** 118: +// ** 119: WHERE +// ** 120: NO INNER +// ** 121: NULL +// ** 122: +// ** 123: TABLE +// ** 124: NATURAL NOTNULL +// ** 125: PRECEDING +// ** 126: UPDATE UNIQUE +// */ +// /* Check to see if z[0..n-1] is a keyword. If it is, write the +// ** parser symbol code for that keyword into *pType. Always +// ** return the integer n (the length of the token). */ +func _keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) (r int32) { + var i, j int32 + var zKW uintptr + _, _, _ = i, j, zKW + i = (int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))])*int32(4) ^ int32(_sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n-int32(1)))))])*int32(3) ^ n*int32(1)) % int32(127) + i = int32(_aKWHash[i]) + for { + if !(i > 0) { + break + } + if int32(_aKWLen[i]) != n { + goto _1 + } + zKW = uintptr(unsafe.Pointer(&_zKWText)) + uintptr(_aKWOffset[i]) + if int32(*(*int8)(unsafe.Pointer(z))) & ^libc.Int32FromInt32(0x20) != int32(*(*int8)(unsafe.Pointer(zKW))) { + goto _1 + } + if int32(*(*int8)(unsafe.Pointer(z + 1))) & ^libc.Int32FromInt32(0x20) != int32(*(*int8)(unsafe.Pointer(zKW + 1))) { + goto _1 + } + j = int32(2) + for j < n && int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) & ^libc.Int32FromInt32(0x20) == int32(*(*int8)(unsafe.Pointer(zKW + uintptr(j)))) { + j++ + } + if j < n { + goto _1 + } + /* REINDEX */ + /* INDEXED */ + /* INDEX */ + /* DESC */ + /* ESCAPE */ + /* EACH */ + /* CHECK */ + /* KEY */ + /* BEFORE */ + /* FOREIGN */ + /* FOR */ + /* IGNORE */ + /* REGEXP */ + /* EXPLAIN */ + /* INSTEAD */ + /* ADD */ + /* DATABASE */ + /* AS */ + /* SELECT */ + /* TABLE */ + /* LEFT */ + /* THEN */ + /* END */ + /* DEFERRABLE */ + /* ELSE */ + /* EXCLUDE */ + /* DELETE */ + /* TEMPORARY */ + /* TEMP */ + /* OR */ + /* ISNULL */ + /* NULLS */ + /* SAVEPOINT */ + /* INTERSECT */ + /* TIES */ + /* NOTNULL */ + /* NOT */ + /* NO */ + /* NULL */ + /* LIKE */ + /* EXCEPT */ + /* TRANSACTION */ + /* ACTION */ + /* ON */ + /* NATURAL */ + /* ALTER */ + /* RAISE */ + /* EXCLUSIVE */ + /* EXISTS */ + /* CONSTRAINT */ + /* INTO */ + /* OFFSET */ + /* OF */ + /* SET */ + /* TRIGGER */ + /* RANGE */ + /* GENERATED */ + /* DETACH */ + /* HAVING */ + /* GLOB */ + /* BEGIN */ + /* INNER */ + /* REFERENCES */ + /* UNIQUE */ + /* QUERY */ + /* WITHOUT */ + /* WITH */ + /* OUTER */ + /* RELEASE */ + /* ATTACH */ + /* BETWEEN */ + /* NOTHING */ + /* GROUPS */ + /* GROUP */ + /* CASCADE */ + /* ASC */ + /* DEFAULT */ + /* CASE */ + /* COLLATE */ + /* CREATE */ + /* CURRENT_DATE */ + /* IMMEDIATE */ + /* JOIN */ + /* INSERT */ + /* MATCH */ + /* PLAN */ + /* ANALYZE */ + /* PRAGMA */ + /* MATERIALIZED */ + /* DEFERRED */ + /* DISTINCT */ + /* IS */ + /* UPDATE */ + /* VALUES */ + /* VIRTUAL */ + /* ALWAYS */ + /* WHEN */ + /* WHERE */ + /* RECURSIVE */ + /* ABORT */ + /* AFTER */ + /* RENAME */ + /* AND */ + /* DROP */ + /* PARTITION */ + /* AUTOINCREMENT */ + /* TO */ + /* IN */ + /* CAST */ + /* COLUMN */ + /* COMMIT */ + /* CONFLICT */ + /* CROSS */ + /* CURRENT_TIMESTAMP */ + /* CURRENT_TIME */ + /* CURRENT */ + /* PRECEDING */ + /* FAIL */ + /* LAST */ + /* FILTER */ + /* REPLACE */ + /* FIRST */ + /* FOLLOWING */ + /* FROM */ + /* FULL */ + /* LIMIT */ + /* IF */ + /* ORDER */ + /* RESTRICT */ + /* OTHERS */ + /* OVER */ + /* RETURNING */ + /* RIGHT */ + /* ROLLBACK */ + /* ROWS */ + /* ROW */ + /* UNBOUNDED */ + /* UNION */ + /* USING */ + /* VACUUM */ + /* VIEW */ + /* WINDOW */ + /* DO */ + /* BY */ + /* INITIALLY */ + /* ALL */ + /* PRIMARY */ + *(*int32)(unsafe.Pointer(pType)) = int32(_aKWCode[i]) + break + goto _1 + _1: + ; + i = int32(_aKWNext[i]) + } + return n +} + +func _sqlite3KeywordCode(tls *libc.TLS, z uintptr, n int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* id at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = int32(TK_ID) + if n >= int32(2) { + _keywordCode(tls, z, n, bp) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +func Xsqlite3_keyword_name(tls *libc.TLS, i int32, pzName uintptr, pnName uintptr) (r int32) { + if i < 0 || i >= int32(SQLITE_N_KEYWORD) { + return int32(SQLITE_ERROR) + } + i++ + *(*uintptr)(unsafe.Pointer(pzName)) = uintptr(unsafe.Pointer(&_zKWText)) + uintptr(_aKWOffset[i]) + *(*int32)(unsafe.Pointer(pnName)) = int32(_aKWLen[i]) + return SQLITE_OK +} + +func Xsqlite3_keyword_count(tls *libc.TLS) (r int32) { + return int32(SQLITE_N_KEYWORD) +} + +func Xsqlite3_keyword_check(tls *libc.TLS, zName uintptr, nName int32) (r int32) { + return libc.BoolInt32(int32(TK_ID) != _sqlite3KeywordCode(tls, zName, nName)) +} + +/************** End of keywordhash.h *****************************************/ +/************** Continuing where we left off in tokenize.c *******************/ + +/* +** If X is a character that can be used in an identifier then +** IdChar(X) will be true. Otherwise it is false. +** +** For ASCII, any character with the high-order bit set is +** allowed in an identifier. For 7-bit characters, +** sqlite3IsIdChar[X] must be 1. +** +** For EBCDIC, the rules are more complex but have the same +** end result. +** +** Ticket #1066. the SQL standard does not allow '$' in the +** middle of identifiers. But many SQL implementations do. +** SQLite will allow '$' in identifiers for compatibility. +** But the feature is undocumented. + */ + +// C documentation +// +// /* Make the IdChar function accessible from ctime.c and alter.c */ +func _sqlite3IsIdChar(tls *libc.TLS, c Tu8) (r int32) { + return libc.BoolInt32(int32(_sqlite3CtypeMap[c])&int32(0x46) != 0) +} + +// C documentation +// +// /* +// ** Return the id of the next token in string (*pz). Before returning, set +// ** (*pz) to point to the byte following the parsed token. +// */ +func _getToken(tls *libc.TLS, pz uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var z uintptr + var _ /* t at bp+0 */ int32 + _ = z + z = *(*uintptr)(unsafe.Pointer(pz)) /* Token type to return */ + for cond := true; cond; cond = *(*int32)(unsafe.Pointer(bp)) == int32(TK_SPACE) { + z += uintptr(_sqlite3GetToken(tls, z, bp)) + } + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_ID) || *(*int32)(unsafe.Pointer(bp)) == int32(TK_STRING) || *(*int32)(unsafe.Pointer(bp)) == int32(TK_JOIN_KW) || *(*int32)(unsafe.Pointer(bp)) == int32(TK_WINDOW) || *(*int32)(unsafe.Pointer(bp)) == int32(TK_OVER) || _sqlite3ParserFallback(tls, *(*int32)(unsafe.Pointer(bp))) == int32(TK_ID) { + *(*int32)(unsafe.Pointer(bp)) = int32(TK_ID) + } + *(*uintptr)(unsafe.Pointer(pz)) = z + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** The following three functions are called immediately after the tokenizer +// ** reads the keywords WINDOW, OVER and FILTER, respectively, to determine +// ** whether the token should be treated as a keyword or an SQL identifier. +// ** This cannot be handled by the usual lemon %fallback method, due to +// ** the ambiguity in some constructions. e.g. +// ** +// ** SELECT sum(x) OVER ... +// ** +// ** In the above, "OVER" might be a keyword, or it might be an alias for the +// ** sum(x) expression. If a "%fallback ID OVER" directive were added to +// ** grammar, then SQLite would always treat "OVER" as an alias, making it +// ** impossible to call a window-function without a FILTER clause. +// ** +// ** WINDOW is treated as a keyword if: +// ** +// ** * the following token is an identifier, or a keyword that can fallback +// ** to being an identifier, and +// ** * the token after than one is TK_AS. +// ** +// ** OVER is a keyword if: +// ** +// ** * the previous token was TK_RP, and +// ** * the next token is either TK_LP or an identifier. +// ** +// ** FILTER is a keyword if: +// ** +// ** * the previous token was TK_RP, and +// ** * the next token is TK_LP. +// */ +func _analyzeWindowKeyword(tls *libc.TLS, _z uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _z + var t int32 + _ = t + t = _getToken(tls, bp) + if t != int32(TK_ID) { + return int32(TK_ID) + } + t = _getToken(tls, bp) + if t != int32(TK_AS) { + return int32(TK_ID) + } + return int32(TK_WINDOW) +} + +func _analyzeOverKeyword(tls *libc.TLS, _z uintptr, lastToken int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _z + var t int32 + _ = t + if lastToken == int32(TK_RP) { + t = _getToken(tls, bp) + if t == int32(TK_LP) || t == int32(TK_ID) { + return int32(TK_OVER) + } + } + return int32(TK_ID) +} + +func _analyzeFilterKeyword(tls *libc.TLS, _z uintptr, lastToken int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _z + if lastToken == int32(TK_RP) && _getToken(tls, bp) == int32(TK_LP) { + return int32(TK_FILTER) + } + return int32(TK_ID) +} + +// C documentation +// +// /* +// ** Return the length (in bytes) of the token that begins at z[0]. +// ** Store the token type in *tokenType before returning. +// */ +func _sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) (r int32) { + var c, delim, i, n, v10, v14, v16, v19, v20, v3, v5, v7, v8 int32 + var v15, v6 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, delim, i, n, v10, v14, v15, v16, v19, v20, v3, v5, v6, v7, v8 + switch int32(_aiClass[*(*uint8)(unsafe.Pointer(z))]) { /* Switch on the character-class of the first byte + ** of the token. See the comment on the CC_ defines + ** above. */ + case int32(CC_SPACE): + i = int32(1) + for { + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x01) != 0) { + break + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) + return i + case int32(CC_MINUS): + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('-') { + i = int32(2) + for { + v3 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v3 + if !(v3 != 0 && c != int32('\n')) { + break + } + goto _2 + _2: + ; + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ + return i + } else { + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('>') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_PTR) + return int32(2) + libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(z + 2))) == int32('>')) + } + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_MINUS) + return int32(1) + case int32(CC_LP): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_LP) + return int32(1) + case int32(CC_RP): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_RP) + return int32(1) + case int32(CC_SEMI): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SEMI) + return int32(1) + case int32(CC_PLUS): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_PLUS) + return int32(1) + case int32(CC_STAR): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_STAR) + return int32(1) + case int32(CC_SLASH): + if int32(*(*uint8)(unsafe.Pointer(z + 1))) != int32('*') || int32(*(*uint8)(unsafe.Pointer(z + 2))) == 0 { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SLASH) + return int32(1) + } + i = int32(3) + c = int32(*(*uint8)(unsafe.Pointer(z + 2))) + for { + if v6 = c != int32('*') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('/'); v6 { + v5 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v5 + } + if !(v6 && v5 != 0) { + break + } + goto _4 + _4: + ; + i++ + } + if c != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) /* IMP: R-22934-25134 */ + return i + case int32(CC_PERCENT): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_REM) + return int32(1) + case int32(CC_EQ): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_EQ) + return int32(1) + libc.BoolInt32(int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('=')) + case int32(CC_LT): + v7 = int32(*(*uint8)(unsafe.Pointer(z + 1))) + c = v7 + if v7 == int32('=') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_LE) + return int32(2) + } else { + if c == int32('>') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_NE) + return int32(2) + } else { + if c == int32('<') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_LSHIFT) + return int32(2) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_LT) + return int32(1) + } + } + } + fallthrough + case int32(CC_GT): + v8 = int32(*(*uint8)(unsafe.Pointer(z + 1))) + c = v8 + if v8 == int32('=') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_GE) + return int32(2) + } else { + if c == int32('>') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_RSHIFT) + return int32(2) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_GT) + return int32(1) + } + } + fallthrough + case int32(CC_BANG): + if int32(*(*uint8)(unsafe.Pointer(z + 1))) != int32('=') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + return int32(1) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_NE) + return int32(2) + } + fallthrough + case int32(CC_PIPE): + if int32(*(*uint8)(unsafe.Pointer(z + 1))) != int32('|') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_BITOR) + return int32(1) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_CONCAT) + return int32(2) + } + fallthrough + case int32(CC_COMMA): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_COMMA) + return int32(1) + case int32(CC_AND): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_BITAND) + return int32(1) + case int32(CC_TILDA): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_BITNOT) + return int32(1) + case int32(CC_QUOTE): + delim = int32(*(*uint8)(unsafe.Pointer(z))) + i = int32(1) + for { + v10 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v10 + if !(v10 != 0) { + break + } + if c == delim { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == delim { + i++ + } else { + break + } + } + goto _9 + _9: + ; + i++ + } + if c == int32('\'') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_STRING) + return i + int32(1) + } else { + if c != 0 { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ID) + return i + int32(1) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + return i + } + } + fallthrough + case int32(CC_DOT): + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 1))])&libc.Int32FromInt32(0x04) != 0) { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_DOT) + return int32(1) + } + fallthrough + case int32(CC_DIGIT): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_INTEGER) + if int32(*(*uint8)(unsafe.Pointer(z))) == int32('0') && (int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('x') || int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('X')) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 2))])&int32(0x08) != 0 { + i = int32(3) + for { + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x08) != 0) { + break + } + goto _11 + _11: + ; + i++ + } + return i + } + i = 0 + for { + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x04) != 0) { + break + } + goto _12 + _12: + ; + i++ + } + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('.') { + i++ + for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x04) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_FLOAT) + } + if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('e') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == int32('E')) && (int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(1))))])&int32(0x04) != 0 || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == int32('+') || int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == int32('-')) && int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(2))))])&int32(0x04) != 0) { + i += int32(2) + for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x04) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_FLOAT) + } + for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + i++ + } + return i + case int32(CC_QUOTE2): + i = int32(1) + c = int32(*(*uint8)(unsafe.Pointer(z))) + for { + if v15 = c != int32(']'); v15 { + v14 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v14 + } + if !(v15 && v14 != 0) { + break + } + goto _13 + _13: + ; + i++ + } + if c == int32(']') { + v16 = int32(TK_ID) + } else { + v16 = int32(TK_ILLEGAL) + } + *(*int32)(unsafe.Pointer(tokenType)) = v16 + return i + case int32(CC_VARNUM): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_VARIABLE) + i = int32(1) + for { + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x04) != 0) { + break + } + goto _17 + _17: + ; + i++ + } + return i + case int32(CC_DOLLAR): + fallthrough + case int32(CC_VARALPHA): + n = 0 + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_VARIABLE) + i = int32(1) + for { + v19 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v19 + if !(v19 != 0) { + break + } + if int32(_sqlite3CtypeMap[uint8(c)])&int32(0x46) != 0 { + n++ + } else { + if c == int32('(') && n > 0 { + for { + i++ + goto _21 + _21: + ; + v20 = int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) + c = v20 + if !(v20 != 0 && !(int32(_sqlite3CtypeMap[uint8(c)])&libc.Int32FromInt32(0x01) != 0) && c != int32(')')) { + break + } + } + if c == int32(')') { + i++ + } else { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + } + break + } else { + if c == int32(':') && int32(*(*uint8)(unsafe.Pointer(z + uintptr(i+int32(1))))) == int32(':') { + i++ + } else { + break + } + } + } + goto _18 + _18: + ; + i++ + } + if n == 0 { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + } + return i + case int32(CC_KYWD0): + if int32(_aiClass[*(*uint8)(unsafe.Pointer(z + 1))]) > int32(CC_KYWD) { + i = int32(1) + break + } + i = int32(2) + for { + if !(int32(_aiClass[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) <= int32(CC_KYWD)) { + break + } + goto _22 + _22: + ; + i++ + } + if int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { + /* This token started out using characters that can appear in keywords, + ** but z[i] is a character not allowed within keywords, so this must + ** be an identifier instead */ + i++ + break + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ID) + return _keywordCode(tls, z, i, tokenType) + case CC_X: + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32('\'') { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_BLOB) + i = int32(2) + for { + if !(int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x08) != 0) { + break + } + goto _23 + _23: + ; + i++ + } + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') || i%int32(2) != 0 { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + for *(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0 && int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != int32('\'') { + i++ + } + } + if *(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0 { + i++ + } + return i + } + fallthrough + case int32(CC_KYWD): + fallthrough + case int32(CC_ID): + i = int32(1) + case int32(CC_BOM): + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == int32(0xbb) && int32(*(*uint8)(unsafe.Pointer(z + 2))) == int32(0xbf) { + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_SPACE) + return int32(3) + } + i = int32(1) + case int32(CC_NUL): + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + return 0 + default: + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ILLEGAL) + return int32(1) + } + for int32(_sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))])&int32(0x46) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = int32(TK_ID) + return i +} + +// C documentation +// +// /* +// ** Run the parser on the given SQL string. +// */ +func _sqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr) (r int32) { + bp := tls.Alloc(2480) + defer tls.Free(2480) + var db, pEngine, pParentParse uintptr + var lastTokenParsed, mxSqlLen, n, nErr int32 + var _ /* sEngine at bp+8 */ TyyParser + var _ /* tokenType at bp+0 */ int32 + var _ /* x at bp+2432 */ TToken + _, _, _, _, _, _, _ = db, lastTokenParsed, mxSqlLen, n, nErr, pEngine, pParentParse + nErr = 0 /* The LEMON-generated LALR(1) parser */ + n = 0 /* type of the next token */ + lastTokenParsed = -int32(1) /* type of the previous token */ + db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Max length of an SQL string */ + pParentParse = uintptr(0) /* Space to hold the Lemon-generated Parser object */ + mxSqlLen = *(*int32)(unsafe.Pointer(db + 136 + 1*4)) + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + (*TParse)(unsafe.Pointer(pParse)).Frc = SQLITE_OK + (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql + pEngine = bp + 8 + _sqlite3ParserInit(tls, pEngine, pParse) + pParentParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse + (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParse + for int32(1) != 0 { + n = _sqlite3GetToken(tls, zSql, bp) + mxSqlLen -= n + if mxSqlLen < 0 { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_TOOBIG) + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + break + } + if *(*int32)(unsafe.Pointer(bp)) >= int32(TK_WINDOW) { + if libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0 { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_INTERRUPT) + (*TParse)(unsafe.Pointer(pParse)).FnErr++ + break + } + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_SPACE) { + zSql += uintptr(n) + continue + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + /* Upon reaching the end of input, call the parser two more times + ** with tokens TK_SEMI and 0, in that order. */ + if lastTokenParsed == int32(TK_SEMI) { + *(*int32)(unsafe.Pointer(bp)) = 0 + } else { + if lastTokenParsed == 0 { + break + } else { + *(*int32)(unsafe.Pointer(bp)) = int32(TK_SEMI) + } + } + n = 0 + } else { + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_WINDOW) { + *(*int32)(unsafe.Pointer(bp)) = _analyzeWindowKeyword(tls, zSql+6) + } else { + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_OVER) { + *(*int32)(unsafe.Pointer(bp)) = _analyzeOverKeyword(tls, zSql+4, lastTokenParsed) + } else { + if *(*int32)(unsafe.Pointer(bp)) == int32(TK_FILTER) { + *(*int32)(unsafe.Pointer(bp)) = _analyzeFilterKeyword(tls, zSql+6, lastTokenParsed) + } else { + (*(*TToken)(unsafe.Pointer(bp + 2432))).Fz = zSql + (*(*TToken)(unsafe.Pointer(bp + 2432))).Fn = uint32(n) + _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+23731, libc.VaList(bp+2456, bp+2432)) + break + } + } + } + } + } + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fz = zSql + (*TParse)(unsafe.Pointer(pParse)).FsLastToken.Fn = uint32(n) + _sqlite3Parser(tls, pEngine, *(*int32)(unsafe.Pointer(bp)), (*TParse)(unsafe.Pointer(pParse)).FsLastToken) + lastTokenParsed = *(*int32)(unsafe.Pointer(bp)) + zSql += uintptr(n) + if (*TParse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK { + break + } + } + _sqlite3ParserFinalize(tls, pEngine) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } + if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg != 0 || (*TParse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK && (*TParse)(unsafe.Pointer(pParse)).Frc != int32(SQLITE_DONE) { + if (*TParse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0) { + (*TParse)(unsafe.Pointer(pParse)).FzErrMsg = _sqlite3MPrintf(tls, db, __ccgo_ts+3827, libc.VaList(bp+2456, _sqlite3ErrStr(tls, (*TParse)(unsafe.Pointer(pParse)).Frc))) + } + Xsqlite3_log(tls, (*TParse)(unsafe.Pointer(pParse)).Frc, __ccgo_ts+23756, libc.VaList(bp+2456, (*TParse)(unsafe.Pointer(pParse)).FzErrMsg, (*TParse)(unsafe.Pointer(pParse)).FzTail)) + nErr++ + } + (*TParse)(unsafe.Pointer(pParse)).FzTail = zSql + Xsqlite3_free(tls, (*TParse)(unsafe.Pointer(pParse)).FapVtabLock) + if (*TParse)(unsafe.Pointer(pParse)).FpNewTable != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != libc.Int32FromInt32(PARSE_MODE_NORMAL)) { + /* If the pParse->declareVtab flag is set, do not delete any table + ** structure built up in pParse->pNewTable. The calling code (see vtab.c) + ** will take responsibility for freeing the Table structure. + */ + _sqlite3DeleteTable(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpNewTable) + } + if (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 && !(int32((*TParse)(unsafe.Pointer(pParse)).FeParseMode) >= libc.Int32FromInt32(PARSE_MODE_RENAME)) { + _sqlite3DeleteTrigger(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpNewTrigger) + } + if (*TParse)(unsafe.Pointer(pParse)).FpVList != 0 { + _sqlite3DbNNFreeNN(tls, db, (*TParse)(unsafe.Pointer(pParse)).FpVList) + } + (*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParentParse + return nErr +} + +/************** End of tokenize.c ********************************************/ +/************** Begin file complete.c ****************************************/ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** An tokenizer for SQL +** +** This file contains C code that implements the sqlite3_complete() API. +** This code used to be part of the tokenizer.c source file. But by +** separating it out, the code will be automatically omitted from +** static links that do not use it. + */ +/* #include "sqliteInt.h" */ + +/* +** This is defined in tokenize.c. We just have to import the definition. + */ + +/* +** Token types used by the sqlite3_complete() routine. See the header +** comments on that procedure for additional information. + */ + +// C documentation +// +// /* +// ** Return TRUE if the given SQL string ends in a semicolon. +// ** +// ** Special handling is require for CREATE TRIGGER statements. +// ** Whenever the CREATE TRIGGER keywords are seen, the statement +// ** must end with ";END;". +// ** +// ** This implementation uses a state machine with 8 states: +// ** +// ** (0) INVALID We have not yet seen a non-whitespace character. +// ** +// ** (1) START At the beginning or end of an SQL statement. This routine +// ** returns 1 if it ends in the START state and 0 if it ends +// ** in any other state. +// ** +// ** (2) NORMAL We are in the middle of statement which ends with a single +// ** semicolon. +// ** +// ** (3) EXPLAIN The keyword EXPLAIN has been seen at the beginning of +// ** a statement. +// ** +// ** (4) CREATE The keyword CREATE has been seen at the beginning of a +// ** statement, possibly preceded by EXPLAIN and/or followed by +// ** TEMP or TEMPORARY +// ** +// ** (5) TRIGGER We are in the middle of a trigger definition that must be +// ** ended by a semicolon, the keyword END, and another semicolon. +// ** +// ** (6) SEMI We've seen the first semicolon in the ";END;" that occurs at +// ** the end of a trigger definition. +// ** +// ** (7) END We've seen the ";END" of the ";END;" that occurs at the end +// ** of a trigger definition. +// ** +// ** Transitions between states above are determined by tokens extracted +// ** from the input. The following tokens are significant: +// ** +// ** (0) tkSEMI A semicolon. +// ** (1) tkWS Whitespace. +// ** (2) tkOTHER Any other SQL token. +// ** (3) tkEXPLAIN The "explain" keyword. +// ** (4) tkCREATE The "create" keyword. +// ** (5) tkTEMP The "temp" or "temporary" keyword. +// ** (6) tkTRIGGER The "trigger" keyword. +// ** (7) tkEND The "end" keyword. +// ** +// ** Whitespace never causes a state transition and is always ignored. +// ** This means that a SQL string of all whitespace is invalid. +// ** +// ** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed +// ** to recognize the end of a trigger can be omitted. All we have to do +// ** is look for a semicolon that is not part of an string or comment. +// */ +func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) (r int32) { + var c, nId int32 + var state, token Tu8 + _, _, _, _ = c, nId, state, token + state = uint8(0) /* Value of the next token */ + for *(*int8)(unsafe.Pointer(zSql)) != 0 { + switch int32(*(*int8)(unsafe.Pointer(zSql))) { + case int32(';'): /* A semicolon */ + token = uint8(tkSEMI) + case int32(' '): + fallthrough + case int32('\r'): + fallthrough + case int32('\t'): + fallthrough + case int32('\n'): + fallthrough + case int32('\f'): /* White space is ignored */ + token = uint8(tkWS) + case int32('/'): /* C-style comments */ + if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('*') { + token = uint8(tkOTHER) + break + } + zSql += uintptr(2) + for *(*int8)(unsafe.Pointer(zSql)) != 0 && (int32(*(*int8)(unsafe.Pointer(zSql))) != int32('*') || int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('/')) { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + zSql++ + token = uint8(tkWS) + case int32('-'): /* SQL-style comments from "--" to end of line */ + if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != int32('-') { + token = uint8(tkOTHER) + break + } + for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32('\n') { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return libc.BoolInt32(int32(state) == int32(1)) + } + token = uint8(tkWS) + case int32('['): /* Microsoft-style identifiers in [...] */ + zSql++ + for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != int32(']') { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + token = uint8(tkOTHER) + case int32('`'): /* Grave-accent quoted symbols used by MySQL */ + fallthrough + case int32('"'): /* single- and double-quoted strings */ + fallthrough + case int32('\''): + c = int32(*(*int8)(unsafe.Pointer(zSql))) + zSql++ + for *(*int8)(unsafe.Pointer(zSql)) != 0 && int32(*(*int8)(unsafe.Pointer(zSql))) != c { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + token = uint8(tkOTHER) + default: + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql)))])&int32(0x46) != 0 { + nId = int32(1) + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql + uintptr(nId))))])&int32(0x46) != 0) { + break + } + goto _1 + _1: + ; + nId++ + } + switch int32(*(*int8)(unsafe.Pointer(zSql))) { + case int32('c'): + fallthrough + case int32('C'): + if nId == int32(6) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23767, int32(6)) == 0 { + token = uint8(tkCREATE) + } else { + token = uint8(tkOTHER) + } + case int32('t'): + fallthrough + case int32('T'): + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+20411, int32(7)) == 0 { + token = uint8(tkTRIGGER) + } else { + if nId == int32(4) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23774, int32(4)) == 0 { + token = uint8(tkTEMP) + } else { + if nId == int32(9) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23779, int32(9)) == 0 { + token = uint8(tkTEMP) + } else { + token = uint8(tkOTHER) + } + } + } + case int32('e'): + fallthrough + case int32('E'): + if nId == int32(3) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23789, int32(3)) == 0 { + token = uint8(tkEND) + } else { + if nId == int32(7) && Xsqlite3_strnicmp(tls, zSql, __ccgo_ts+23793, int32(7)) == 0 { + token = uint8(tkEXPLAIN) + } else { + token = uint8(tkOTHER) + } + } + default: + token = uint8(tkOTHER) + break + } + zSql += uintptr(nId - int32(1)) + } else { + /* Operators and special symbols */ + token = uint8(tkOTHER) + } + break + } + state = *(*Tu8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_trans)) + uintptr(state)*8 + uintptr(token))) + zSql++ + } + return libc.BoolInt32(int32(state) == int32(1)) +} + +/* A complex statement machine used to detect the end of a CREATE TRIGGER + ** statement. This is the normal case. + */ +var _trans = [8][8]Tu8{ + 0: { + 0: uint8(1), + 2: uint8(2), + 3: uint8(3), + 4: uint8(4), + 5: uint8(2), + 6: uint8(2), + 7: uint8(2), + }, + 1: { + 0: uint8(1), + 1: uint8(1), + 2: uint8(2), + 3: uint8(3), + 4: uint8(4), + 5: uint8(2), + 6: uint8(2), + 7: uint8(2), + }, + 2: { + 0: uint8(1), + 1: uint8(2), + 2: uint8(2), + 3: uint8(2), + 4: uint8(2), + 5: uint8(2), + 6: uint8(2), + 7: uint8(2), + }, + 3: { + 0: uint8(1), + 1: uint8(3), + 2: uint8(3), + 3: uint8(2), + 4: uint8(4), + 5: uint8(2), + 6: uint8(2), + 7: uint8(2), + }, + 4: { + 0: uint8(1), + 1: uint8(4), + 2: uint8(2), + 3: uint8(2), + 4: uint8(2), + 5: uint8(4), + 6: uint8(5), + 7: uint8(2), + }, + 5: { + 0: uint8(6), + 1: uint8(5), + 2: uint8(5), + 3: uint8(5), + 4: uint8(5), + 5: uint8(5), + 6: uint8(5), + 7: uint8(5), + }, + 6: { + 0: uint8(6), + 1: uint8(6), + 2: uint8(5), + 3: uint8(5), + 4: uint8(5), + 5: uint8(5), + 6: uint8(5), + 7: uint8(7), + }, + 7: { + 0: uint8(1), + 1: uint8(7), + 2: uint8(5), + 3: uint8(5), + 4: uint8(5), + 5: uint8(5), + 6: uint8(5), + 7: uint8(5), + }, +} + +// C documentation +// +// /* +// ** This routine is the same as the sqlite3_complete() routine described +// ** above, except that the parameter is required to be UTF-16 encoded, not +// ** UTF-8. +// */ +func Xsqlite3_complete16(tls *libc.TLS, zSql uintptr) (r int32) { + var pVal, zSql8 uintptr + var rc int32 + _, _, _ = pVal, rc, zSql8 + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + pVal = _sqlite3ValueNew(tls, uintptr(0)) + _sqlite3ValueSetStr(tls, pVal, -int32(1), zSql, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0)) + zSql8 = _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) + if zSql8 != 0 { + rc = Xsqlite3_complete(tls, zSql8) + } else { + rc = int32(SQLITE_NOMEM) + } + _sqlite3ValueFree(tls, pVal) + return rc & int32(0xff) +} + +/************** End of rtree.h ***********************************************/ +/************** Continuing where we left off in main.c ***********************/ + +// C documentation +// +// /* +// ** This is an extension initializer that is a no-op and always +// ** succeeds, except that it fails if the fault-simulation is set +// ** to 500. +// */ +func _sqlite3TestExtInit(tls *libc.TLS, db uintptr) (r int32) { + _ = db + return _sqlite3FaultSim(tls, int32(500)) +} + +// C documentation +// +// /* +// ** An array of pointers to extension initializer functions for +// ** built-in extensions. +// */ +var _sqlite3BuiltinExtensions = [5]uintptr{} + +func init() { + p := unsafe.Pointer(&_sqlite3BuiltinExtensions) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_sqlite3Fts5Init) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_sqlite3RtreeInit) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_sqlite3DbstatRegister) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_sqlite3TestExtInit) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_sqlite3JsonTableFunctions) +} + +// C documentation +// +// /* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns +// ** a pointer to the to the sqlite3_version[] string constant. +// */ +func Xsqlite3_libversion(tls *libc.TLS) (r uintptr) { + return uintptr(unsafe.Pointer(&Xsqlite3_version)) +} + +/* IMPLEMENTATION-OF: R-25063-23286 The sqlite3_sourceid() function returns a +** pointer to a string constant whose value is the same as the +** SQLITE_SOURCE_ID C preprocessor macro. Except if SQLite is built using +** an edited copy of the amalgamation, then the last four characters of +** the hash might be different from SQLITE_SOURCE_ID. + */ +/* SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } */ + +// C documentation +// +// /* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function +// ** returns an integer equal to SQLITE_VERSION_NUMBER. +// */ +func Xsqlite3_libversion_number(tls *libc.TLS) (r int32) { + return int32(SQLITE_VERSION_NUMBER) +} + +// C documentation +// +// /* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns +// ** zero if and only if SQLite was compiled with mutexing code omitted due to +// ** the SQLITE_THREADSAFE compile-time option being set to 0. +// */ +func Xsqlite3_threadsafe(tls *libc.TLS) (r int32) { + return int32(SQLITE_THREADSAFE) +} + +// C documentation +// +// /* +// ** Determine whether or not high-precision (long double) floating point +// ** math works correctly on CPU currently running. +// */ +func _hasHighPrecisionDouble(tls *libc.TLS, rc int32) (r int32) { + var a, b, c float64 + _, _, _ = a, b, c + if uint64(8) <= uint64(8) { + /* If the size of "long double" is not more than 8, then + ** high-precision math is not possible. */ + return 0 + } else { + rc++ + a = float64(1) + float64(rc)*float64(0.1) + b = float64(1e+18) + float64(rc)*float64(25) + c = a + b + return libc.BoolInt32(b != c) + } + return r +} + +// C documentation +// +// /* +// ** Initialize SQLite. +// ** +// ** This routine must be called to initialize the memory allocation, +// ** VFS, and mutex subsystems prior to doing any serious work with +// ** SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT +// ** this routine will be called automatically by key routines such as +// ** sqlite3_open(). +// ** +// ** This routine is a no-op except on its very first call for the process, +// ** or for the first call after a call to sqlite3_shutdown. +// ** +// ** The first thread to call this routine runs the initialization to +// ** completion. If subsequent threads call this routine before the first +// ** thread has finished the initialization process, then the subsequent +// ** threads must block until the first thread finishes with the initialization. +// ** +// ** The first thread might call this routine recursively. Recursive +// ** calls to this routine should not block, of course. Otherwise the +// ** initialization process would never complete. +// ** +// ** Let X be the first thread to enter this routine. Let Y be some other +// ** thread. Then while the initial invocation of this routine by X is +// ** incomplete, it is required that: +// ** +// ** * Calls to this routine from Y must block until the outer-most +// ** call by X completes. +// ** +// ** * Recursive calls to this routine from thread X return immediately +// ** without blocking. +// */ +func Xsqlite3_initialize(tls *libc.TLS) (r int32) { + ng := runtime.GOMAXPROCS(1) + defer func() { runtime.GOMAXPROCS(ng) }() + var pMainMtx uintptr + var rc int32 + _, _ = pMainMtx, rc /* Result code */ + /* If the following assert() fails on some obscure processor/compiler + ** combination, the work-around is to set the correct pointer + ** size at compile-time using -DSQLITE_PTRSIZE=n compile-time option */ + /* If SQLite is already completely initialized, then this call + ** to sqlite3_initialize() should be a no-op. But the initialization + ** must be complete. So isInit must not be set until the very end + ** of this routine. + */ + if _sqlite3Config.FisInit != 0 { + _sqlite3MemoryBarrier(tls) + return SQLITE_OK + } + /* Make sure the mutex subsystem is initialized. If unable to + ** initialize the mutex subsystem, return early with the error. + ** If the system is so sick that we are unable to allocate a mutex, + ** there is not much SQLite is going to be able to do. + ** + ** The mutex subsystem must take care of serializing its own + ** initialization. + */ + rc = _sqlite3MutexInit(tls) + if rc != 0 { + return rc + } + /* Initialize the malloc() system and the recursive pInitMutex mutex. + ** This operation is protected by the STATIC_MAIN mutex. Note that + ** MutexAlloc() is called for a static mutex prior to initializing the + ** malloc subsystem - this implies that the allocation of a static + ** mutex must not require support from the malloc subsystem. + */ + pMainMtx = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN)) + Xsqlite3_mutex_enter(tls, pMainMtx) + _sqlite3Config.FisMutexInit = int32(1) + if !(_sqlite3Config.FisMallocInit != 0) { + rc = _sqlite3MallocInit(tls) + } + if rc == SQLITE_OK { + _sqlite3Config.FisMallocInit = int32(1) + if !(_sqlite3Config.FpInitMutex != 0) { + _sqlite3Config.FpInitMutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_RECURSIVE)) + if _sqlite3Config.FbCoreMutex != 0 && !(_sqlite3Config.FpInitMutex != 0) { + rc = int32(SQLITE_NOMEM) + } + } + } + if rc == SQLITE_OK { + _sqlite3Config.FnRefInitMutex++ + } + Xsqlite3_mutex_leave(tls, pMainMtx) + /* If rc is not SQLITE_OK at this point, then either the malloc + ** subsystem could not be initialized or the system failed to allocate + ** the pInitMutex mutex. Return an error in either case. */ + if rc != SQLITE_OK { + return rc + } + /* Do the rest of the initialization under the recursive mutex so + ** that we will be able to handle recursive calls into + ** sqlite3_initialize(). The recursive calls normally come through + ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other + ** recursive calls might also be possible. + ** + ** IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls + ** to the xInit method, so the xInit method need not be threadsafe. + ** + ** The following mutex is what serializes access to the appdef pcache xInit + ** methods. The sqlite3_pcache_methods.xInit() all is embedded in the + ** call to sqlite3PcacheInitialize(). + */ + Xsqlite3_mutex_enter(tls, _sqlite3Config.FpInitMutex) + if _sqlite3Config.FisInit == 0 && _sqlite3Config.FinProgress == 0 { + _sqlite3Config.FinProgress = int32(1) + libc.Xmemset(tls, uintptr(unsafe.Pointer(&_sqlite3BuiltinFunctions)), 0, uint64(184)) + _sqlite3RegisterBuiltinFunctions(tls) + if _sqlite3Config.FisPCacheInit == 0 { + rc = _sqlite3PcacheInitialize(tls) + } + if rc == SQLITE_OK { + _sqlite3Config.FisPCacheInit = int32(1) + rc = _sqlite3OsInit(tls) + } + if rc == SQLITE_OK { + rc = _sqlite3MemdbInit(tls) + } + if rc == SQLITE_OK { + _sqlite3PCacheBufferSetup(tls, _sqlite3Config.FpPage, _sqlite3Config.FszPage, _sqlite3Config.FnPage) + _sqlite3MemoryBarrier(tls) + _sqlite3Config.FisInit = int32(1) + } + _sqlite3Config.FinProgress = 0 + } + Xsqlite3_mutex_leave(tls, _sqlite3Config.FpInitMutex) + /* Go back under the static mutex and clean up the recursive + ** mutex to prevent a resource leak. + */ + Xsqlite3_mutex_enter(tls, pMainMtx) + _sqlite3Config.FnRefInitMutex-- + if _sqlite3Config.FnRefInitMutex <= 0 { + Xsqlite3_mutex_free(tls, _sqlite3Config.FpInitMutex) + _sqlite3Config.FpInitMutex = uintptr(0) + } + Xsqlite3_mutex_leave(tls, pMainMtx) + /* The following is just a sanity check to make sure SQLite has + ** been compiled correctly. It is important to run this code, but + ** we don't want to run it too often and soak up CPU cycles for no + ** reason. So we run it once during initialization. + */ + /* Do extra initialization steps requested by the SQLITE_EXTRA_INIT + ** compile-time option. + */ + /* Experimentally determine if high-precision floating point is + ** available. */ + _sqlite3Config.FbUseLongDouble = uint8(_hasHighPrecisionDouble(tls, rc)) + return rc +} + +// C documentation +// +// /* +// ** Undo the effects of sqlite3_initialize(). Must not be called while +// ** there are outstanding database connections or memory allocations or +// ** while any part of SQLite is otherwise in use in any thread. This +// ** routine is not threadsafe. But it is safe to invoke this routine +// ** on when SQLite is already shut down. If SQLite is already shut down +// ** when this routine is invoked, then this routine is a harmless no-op. +// */ +func Xsqlite3_shutdown(tls *libc.TLS) (r int32) { + if _sqlite3Config.FisInit != 0 { + Xsqlite3_os_end(tls) + Xsqlite3_reset_auto_extension(tls) + _sqlite3Config.FisInit = 0 + } + if _sqlite3Config.FisPCacheInit != 0 { + _sqlite3PcacheShutdown(tls) + _sqlite3Config.FisPCacheInit = 0 + } + if _sqlite3Config.FisMallocInit != 0 { + _sqlite3MallocEnd(tls) + _sqlite3Config.FisMallocInit = 0 + /* The heap subsystem has now been shutdown and these values are supposed + ** to be NULL or point to memory that was obtained from sqlite3_malloc(), + ** which would rely on that heap subsystem; therefore, make sure these + ** values cannot refer to heap memory that was just invalidated when the + ** heap subsystem was shutdown. This is only done if the current call to + ** this function resulted in the heap subsystem actually being shutdown. + */ + Xsqlite3_data_directory = uintptr(0) + Xsqlite3_temp_directory = uintptr(0) + } + if _sqlite3Config.FisMutexInit != 0 { + _sqlite3MutexEnd(tls) + _sqlite3Config.FisMutexInit = 0 + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This API allows applications to modify the global configuration of +// ** the SQLite library at run-time. +// ** +// ** This routine should only be called when there are no outstanding +// ** database connections or memory allocations. This routine is not +// ** threadsafe. Failure to heed these warnings can lead to unpredictable +// ** behavior. +// */ +func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) (r int32) { + var ap Tva_list + var bOpenUri, rc int32 + var mxMmap, szMmap Tsqlite3_int64 + var pLogArg, pVal, xLog uintptr + _, _, _, _, _, _, _, _ = ap, bOpenUri, mxMmap, pLogArg, pVal, rc, szMmap, xLog + rc = SQLITE_OK + /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while + ** the SQLite library is in use. Except, a few selected opcodes + ** are allowed. + */ + if _sqlite3Config.FisInit != 0 { + if op < 0 || op > int32(63) || libc.Uint64FromInt32(1)< int64(SQLITE_MAX_MMAP_SIZE) { + mxMmap = int64(SQLITE_MAX_MMAP_SIZE) + } + if szMmap < 0 { + szMmap = SQLITE_DEFAULT_MMAP_SIZE + } + if szMmap > mxMmap { + szMmap = mxMmap + } + _sqlite3Config.FmxMmap = mxMmap + _sqlite3Config.FszMmap = szMmap + case int32(SQLITE_CONFIG_PMASZ): + _sqlite3Config.FszPma = libc.VaUint32(&ap) + case int32(SQLITE_CONFIG_STMTJRNL_SPILL): + _sqlite3Config.FnStmtSpill = libc.VaInt32(&ap) + case int32(SQLITE_CONFIG_MEMDB_MAXSIZE): + _sqlite3Config.FmxMemdbSize = libc.VaInt64(&ap) + case int32(SQLITE_CONFIG_ROWID_IN_VIEW): + pVal = libc.VaUintptr(&ap) + *(*int32)(unsafe.Pointer(pVal)) = 0 + default: + rc = int32(SQLITE_ERROR) + break + } + _ = ap + return rc +} + +var _mAnytimeConfigOption = libc.Uint64FromInt32(0) | libc.Uint64FromInt32(1)< 0 { + return int32(SQLITE_BUSY) + } + /* Free any existing lookaside buffer for this handle before + ** allocating a new one so we don't have to have space for + ** both at the same time. + */ + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced != 0 { + Xsqlite3_free(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) + } + /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger + ** than a pointer to be useful. + */ + sz = sz & ^libc.Int32FromInt32(7) /* IMP: R-33038-09382 */ + if sz <= libc.Int32FromInt64(8) { + sz = 0 + } + if cnt < 0 { + cnt = 0 + } + if sz == 0 || cnt == 0 { + sz = 0 + pStart = uintptr(0) + } else { + if pBuf == uintptr(0) { + _sqlite3BeginBenignMalloc(tls) + pStart = _sqlite3Malloc(tls, uint64(szAlloc)) /* IMP: R-61949-35727 */ + _sqlite3EndBenignMalloc(tls) + if pStart != 0 { + szAlloc = int64(_sqlite3MallocSize(tls, pStart)) + } + } else { + pStart = pBuf + } + } + if sz >= libc.Int32FromInt32(LOOKASIDE_SMALL)*libc.Int32FromInt32(3) { + nBig = int32(szAlloc / int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(LOOKASIDE_SMALL)+sz)) + nSm = int32((szAlloc - int64(sz*nBig)) / int64(LOOKASIDE_SMALL)) + } else { + if sz >= libc.Int32FromInt32(LOOKASIDE_SMALL)*libc.Int32FromInt32(2) { + nBig = int32(szAlloc / int64(libc.Int32FromInt32(LOOKASIDE_SMALL)+sz)) + nSm = int32((szAlloc - int64(sz*nBig)) / int64(LOOKASIDE_SMALL)) + } else { + if sz > 0 { + nBig = int32(szAlloc / int64(sz)) + nSm = 0 + } else { + v1 = libc.Int32FromInt32(0) + nSm = v1 + nBig = v1 + } + } + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart = pStart + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(sz) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue = uint16(sz) + if pStart != 0 { + p = pStart + i = 0 + for { + if !(i < nBig) { + break + } + (*TLookasideSlot)(unsafe.Pointer(p)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = p + p = p + uintptr(sz) + goto _2 + _2: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle = p + i = 0 + for { + if !(i < nSm) { + break + } + (*TLookasideSlot)(unsafe.Pointer(p)).FpNext = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = p + p = p + 128 + goto _3 + _3: + ; + i++ + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = p + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = uint32(0) + if pBuf == uintptr(0) { + v4 = int32(1) + } else { + v4 = 0 + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced = uint8(v4) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot = uint32(nBig + nSm) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = uint32(1) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced = uint8(0) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot = uint32(0) + } + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpTrueEnd = (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the mutex associated with a database connection. +// */ +func Xsqlite3_db_mutex(tls *libc.TLS, db uintptr) (r uintptr) { + return (*Tsqlite3)(unsafe.Pointer(db)).Fmutex +} + +// C documentation +// +// /* +// ** Free up as much memory as we can from the given database +// ** connection. +// */ +func Xsqlite3_db_release_memory(tls *libc.TLS, db uintptr) (r int32) { + var i int32 + var pBt, pPager uintptr + _, _, _ = i, pBt, pPager + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3BtreeEnterAll(tls, db) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 { + pPager = _sqlite3BtreePager(tls, pBt) + _sqlite3PagerShrink(tls, pPager) + } + goto _1 + _1: + ; + i++ + } + _sqlite3BtreeLeaveAll(tls, db) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Flush any dirty pages in the pager-cache for any attached database +// ** to disk. +// */ +func Xsqlite3_db_cacheflush(tls *libc.TLS, db uintptr) (r int32) { + var bSeenBusy, i, rc, v2 int32 + var pBt, pPager uintptr + _, _, _, _, _, _ = bSeenBusy, i, pBt, pPager, rc, v2 + rc = SQLITE_OK + bSeenBusy = 0 + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _sqlite3BtreeEnterAll(tls, db) + i = 0 + for { + if !(rc == SQLITE_OK && i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if pBt != 0 && _sqlite3BtreeTxnState(tls, pBt) == int32(SQLITE_TXN_WRITE) { + pPager = _sqlite3BtreePager(tls, pBt) + rc = _sqlite3PagerFlush(tls, pPager) + if rc == int32(SQLITE_BUSY) { + bSeenBusy = int32(1) + rc = SQLITE_OK + } + } + goto _1 + _1: + ; + i++ + } + _sqlite3BtreeLeaveAll(tls, db) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if rc == SQLITE_OK && bSeenBusy != 0 { + v2 = int32(SQLITE_BUSY) + } else { + v2 = rc + } + return v2 +} + +// C documentation +// +// /* +// ** Configuration settings for an individual database connection +// */ +func Xsqlite3_db_config(tls *libc.TLS, db uintptr, op int32, va uintptr) (r int32) { + var ap Tva_list + var cnt, onoff, rc, sz int32 + var i uint32 + var oldFlags Tu64 + var pBuf, pRes uintptr + _, _, _, _, _, _, _, _, _ = ap, cnt, i, oldFlags, onoff, pBuf, pRes, rc, sz + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + ap = va + switch op { + case int32(SQLITE_DBCONFIG_MAINDBNAME): + /* IMP: R-06824-28531 */ + /* IMP: R-36257-52125 */ + (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName = libc.VaUintptr(&ap) + rc = SQLITE_OK + case int32(SQLITE_DBCONFIG_LOOKASIDE): + pBuf = libc.VaUintptr(&ap) /* IMP: R-26835-10964 */ + sz = libc.VaInt32(&ap) /* IMP: R-47871-25994 */ + cnt = libc.VaInt32(&ap) /* IMP: R-04460-53386 */ + rc = _setupLookaside(tls, db, pBuf, sz, cnt) + default: + rc = int32(SQLITE_ERROR) /* IMP: R-42790-23372 */ + i = uint32(0) + for { + if !(i < uint32(int32(libc.Uint64FromInt64(144)/libc.Uint64FromInt64(8)))) { + break + } + if _aFlagOp[i].Fop == op { + onoff = libc.VaInt32(&ap) + pRes = libc.VaUintptr(&ap) + oldFlags = (*Tsqlite3)(unsafe.Pointer(db)).Fflags + if onoff > 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(_aFlagOp[i].Fmask) + } else { + if onoff == 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^uint64(_aFlagOp[i].Fmask) + } + } + if oldFlags != (*Tsqlite3)(unsafe.Pointer(db)).Fflags { + _sqlite3ExpirePreparedStatements(tls, db, 0) + } + if pRes != 0 { + *(*int32)(unsafe.Pointer(pRes)) = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(_aFlagOp[i].Fmask) != uint64(0)) + } + rc = SQLITE_OK + break + } + goto _1 + _1: + ; + i++ + } + break + } + _ = ap + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +var _aFlagOp = [18]struct { + Fop int32 + Fmask Tu32 +}{ + 0: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_FKEY), + Fmask: uint32(SQLITE_ForeignKeys), + }, + 1: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_TRIGGER), + Fmask: uint32(SQLITE_EnableTrigger), + }, + 2: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_VIEW), + Fmask: uint32(SQLITE_EnableView), + }, + 3: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER), + Fmask: uint32(SQLITE_Fts3Tokenizer), + }, + 4: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION), + Fmask: uint32(SQLITE_LoadExtension), + }, + 5: { + Fop: int32(SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE), + Fmask: uint32(SQLITE_NoCkptOnClose), + }, + 6: { + Fop: int32(SQLITE_DBCONFIG_ENABLE_QPSG), + Fmask: uint32(SQLITE_EnableQPSG), + }, + 7: { + Fop: int32(SQLITE_DBCONFIG_TRIGGER_EQP), + Fmask: uint32(SQLITE_TriggerEQP), + }, + 8: { + Fop: int32(SQLITE_DBCONFIG_RESET_DATABASE), + Fmask: uint32(SQLITE_ResetDatabase), + }, + 9: { + Fop: int32(SQLITE_DBCONFIG_DEFENSIVE), + Fmask: uint32(SQLITE_Defensive), + }, + 10: { + Fop: int32(SQLITE_DBCONFIG_WRITABLE_SCHEMA), + Fmask: uint32(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), + }, + 11: { + Fop: int32(SQLITE_DBCONFIG_LEGACY_ALTER_TABLE), + Fmask: uint32(SQLITE_LegacyAlter), + }, + 12: { + Fop: int32(SQLITE_DBCONFIG_DQS_DDL), + Fmask: uint32(SQLITE_DqsDDL), + }, + 13: { + Fop: int32(SQLITE_DBCONFIG_DQS_DML), + Fmask: uint32(SQLITE_DqsDML), + }, + 14: { + Fop: int32(SQLITE_DBCONFIG_LEGACY_FILE_FORMAT), + Fmask: uint32(SQLITE_LegacyFileFmt), + }, + 15: { + Fop: int32(SQLITE_DBCONFIG_TRUSTED_SCHEMA), + Fmask: uint32(SQLITE_TrustedSchema), + }, + 16: { + Fop: int32(SQLITE_DBCONFIG_STMT_SCANSTATUS), + Fmask: uint32(SQLITE_StmtScanStatus), + }, + 17: { + Fop: int32(SQLITE_DBCONFIG_REVERSE_SCANORDER), + Fmask: uint32(SQLITE_ReverseOrder), + }, +} + +// C documentation +// +// /* +// ** This is the default collating function named "BINARY" which is always +// ** available. +// */ +func _binCollFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) (r int32) { + var n, rc, v1 int32 + _, _, _ = n, rc, v1 + _ = NotUsed + if nKey1 < nKey2 { + v1 = nKey1 + } else { + v1 = nKey2 + } + n = v1 + /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares + ** strings byte by byte using the memcmp() function from the standard C + ** library. */ + rc = libc.Xmemcmp(tls, pKey1, pKey2, uint64(n)) + if rc == 0 { + rc = nKey1 - nKey2 + } + return rc +} + +// C documentation +// +// /* +// ** This is the collating function named "RTRIM" which is always +// ** available. Ignore trailing spaces. +// */ +func _rtrimCollFunc(tls *libc.TLS, pUser uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) (r int32) { + var pK1, pK2 uintptr + _, _ = pK1, pK2 + pK1 = pKey1 + pK2 = pKey2 + for nKey1 != 0 && int32(*(*Tu8)(unsafe.Pointer(pK1 + uintptr(nKey1-int32(1))))) == int32(' ') { + nKey1-- + } + for nKey2 != 0 && int32(*(*Tu8)(unsafe.Pointer(pK2 + uintptr(nKey2-int32(1))))) == int32(' ') { + nKey2-- + } + return _binCollFunc(tls, pUser, nKey1, pKey1, nKey2, pKey2) +} + +// C documentation +// +// /* +// ** Return true if CollSeq is the default built-in BINARY. +// */ +func _sqlite3IsBinary(tls *libc.TLS, p uintptr) (r int32) { + return libc.BoolInt32(p == uintptr(0) || (*TCollSeq)(unsafe.Pointer(p)).FxCmp == __ccgo_fp(_binCollFunc)) +} + +// C documentation +// +// /* +// ** Another built-in collating sequence: NOCASE. +// ** +// ** This collating sequence is intended to be used for "case independent +// ** comparison". SQLite's knowledge of upper and lower case equivalents +// ** extends only to the 26 characters used in the English language. +// ** +// ** At the moment there is only a UTF-8 implementation. +// */ +func _nocaseCollatingFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) (r1 int32) { + var r, v1 int32 + _, _ = r, v1 + if nKey1 < nKey2 { + v1 = nKey1 + } else { + v1 = nKey2 + } + r = Xsqlite3_strnicmp(tls, pKey1, pKey2, v1) + _ = NotUsed + if 0 == r { + r = nKey1 - nKey2 + } + return r +} + +// C documentation +// +// /* +// ** Return the ROWID of the most recent insert +// */ +func Xsqlite3_last_insert_rowid(tls *libc.TLS, db uintptr) (r Tsqlite_int64) { + return (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid +} + +// C documentation +// +// /* +// ** Set the value returned by the sqlite3_last_insert_rowid() API function. +// */ +func Xsqlite3_set_last_insert_rowid(tls *libc.TLS, db uintptr, iRowid Tsqlite3_int64) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + (*Tsqlite3)(unsafe.Pointer(db)).FlastRowid = iRowid + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) +} + +// C documentation +// +// /* +// ** Return the number of changes in the most recent call to sqlite3_exec(). +// */ +func Xsqlite3_changes64(tls *libc.TLS, db uintptr) (r Tsqlite3_int64) { + return (*Tsqlite3)(unsafe.Pointer(db)).FnChange +} + +func Xsqlite3_changes(tls *libc.TLS, db uintptr) (r int32) { + return int32(Xsqlite3_changes64(tls, db)) +} + +// C documentation +// +// /* +// ** Return the number of changes since the database handle was opened. +// */ +func Xsqlite3_total_changes64(tls *libc.TLS, db uintptr) (r Tsqlite3_int64) { + return (*Tsqlite3)(unsafe.Pointer(db)).FnTotalChange +} + +func Xsqlite3_total_changes(tls *libc.TLS, db uintptr) (r int32) { + return int32(Xsqlite3_total_changes64(tls, db)) +} + +// C documentation +// +// /* +// ** Close all open savepoints. This function only manipulates fields of the +// ** database handle object, it does not close any savepoints that may be open +// ** at the b-tree/pager level. +// */ +func _sqlite3CloseSavepoints(tls *libc.TLS, db uintptr) { + var pTmp uintptr + _ = pTmp + for (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint != 0 { + pTmp = (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint + (*Tsqlite3)(unsafe.Pointer(db)).FpSavepoint = (*TSavepoint)(unsafe.Pointer(pTmp)).FpNext + _sqlite3DbFree(tls, db, pTmp) + } + (*Tsqlite3)(unsafe.Pointer(db)).FnSavepoint = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FnStatement = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = uint8(0) +} + +// C documentation +// +// /* +// ** Invoke the destructor function associated with FuncDef p, if any. Except, +// ** if this is not the last copy of the function, do not invoke it. Multiple +// ** copies of a single function are created when create_function() is called +// ** with SQLITE_ANY as the encoding. +// */ +func _functionDestroy(tls *libc.TLS, db uintptr, p uintptr) { + var pDestructor uintptr + _ = pDestructor + pDestructor = *(*uintptr)(unsafe.Pointer(p + 64)) + if pDestructor != 0 { + (*TFuncDestructor)(unsafe.Pointer(pDestructor)).FnRef-- + if (*TFuncDestructor)(unsafe.Pointer(pDestructor)).FnRef == 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFuncDestructor)(unsafe.Pointer(pDestructor)).FxDestroy})))(tls, (*TFuncDestructor)(unsafe.Pointer(pDestructor)).FpUserData) + _sqlite3DbFree(tls, db, pDestructor) + } + } +} + +// C documentation +// +// /* +// ** Disconnect all sqlite3_vtab objects that belong to database connection +// ** db. This is called when db is being closed. +// */ +func _disconnectAllVtab(tls *libc.TLS, db uintptr) { + var i int32 + var p, pMod, pSchema, pTab uintptr + _, _, _, _, _ = i, p, pMod, pSchema, pTab + _sqlite3BtreeEnterAll(tls, db) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pSchema = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpSchema + if pSchema != 0 { + p = (*THash)(unsafe.Pointer(pSchema + 8)).Ffirst + for { + if !(p != 0) { + break + } + pTab = (*THashElem)(unsafe.Pointer(p)).Fdata + if int32((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { + _sqlite3VtabDisconnect(tls, db, pTab) + } + goto _2 + _2: + ; + p = (*THashElem)(unsafe.Pointer(p)).Fnext + } + } + goto _1 + _1: + ; + i++ + } + p = (*THash)(unsafe.Pointer(db + 576)).Ffirst + for { + if !(p != 0) { + break + } + pMod = (*THashElem)(unsafe.Pointer(p)).Fdata + if (*TModule)(unsafe.Pointer(pMod)).FpEpoTab != 0 { + _sqlite3VtabDisconnect(tls, db, (*TModule)(unsafe.Pointer(pMod)).FpEpoTab) + } + goto _3 + _3: + ; + p = (*THashElem)(unsafe.Pointer(p)).Fnext + } + _sqlite3VtabUnlockList(tls, db) + _sqlite3BtreeLeaveAll(tls, db) +} + +// C documentation +// +// /* +// ** Return TRUE if database connection db has unfinalized prepared +// ** statements or unfinished sqlite3_backup objects. +// */ +func _connectionIsBusy(tls *libc.TLS, db uintptr) (r int32) { + var j int32 + var pBt uintptr + _, _ = j, pBt + if (*Tsqlite3)(unsafe.Pointer(db)).FpVdbe != 0 { + return int32(1) + } + j = 0 + for { + if !(j < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32))).FpBt + if pBt != 0 && _sqlite3BtreeIsInBackup(tls, pBt) != 0 { + return int32(1) + } + goto _1 + _1: + ; + j++ + } + return 0 +} + +// C documentation +// +// /* +// ** Close an existing SQLite database +// */ +func _sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) (r int32) { + var p uintptr + _ = p + if !(db != 0) { + /* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or + ** sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */ + return SQLITE_OK + } + if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return _sqlite3MisuseError(tls, int32(179589)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_CLOSE) != 0 { + (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_CLOSE), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, db, uintptr(0)) + } + /* Force xDisconnect calls on all virtual tables */ + _disconnectAllVtab(tls, db) + /* If a transaction is open, the disconnectAllVtab() call above + ** will not have called the xDisconnect() method on any virtual + ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback() + ** call will do so. We need to do this before the check for active + ** SQL statements below, as the v-table implementation may be storing + ** some prepared statements internally. + */ + _sqlite3VtabRollback(tls, db) + /* Legacy behavior (sqlite3_close() behavior) is to return + ** SQLITE_BUSY if the connection can not be closed immediately. + */ + if !(forceZombie != 0) && _connectionIsBusy(tls, db) != 0 { + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+23801, 0) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return int32(SQLITE_BUSY) + } + for (*Tsqlite3)(unsafe.Pointer(db)).FpDbData != 0 { + p = (*Tsqlite3)(unsafe.Pointer(db)).FpDbData + (*Tsqlite3)(unsafe.Pointer(db)).FpDbData = (*TDbClientData)(unsafe.Pointer(p)).FpNext + if (*TDbClientData)(unsafe.Pointer(p)).FxDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TDbClientData)(unsafe.Pointer(p)).FxDestructor})))(tls, (*TDbClientData)(unsafe.Pointer(p)).FpData) + } + Xsqlite3_free(tls, p) + } + /* Convert the connection into a zombie and then close it. + */ + (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_ZOMBIE) + _sqlite3LeaveMutexAndCloseZombie(tls, db) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return the transaction state for a single databse, or the maximum +// ** transaction state over all attached databases if zSchema is null. +// */ +func Xsqlite3_txn_state(tls *libc.TLS, db uintptr, zSchema uintptr) (r int32) { + var iDb, iTxn, nDb, x, v1, v3 int32 + var pBt uintptr + _, _, _, _, _, _, _ = iDb, iTxn, nDb, pBt, x, v1, v3 + iTxn = -int32(1) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if zSchema != 0 { + v1 = _sqlite3FindDbName(tls, db, zSchema) + iDb = v1 + nDb = v1 + if iDb < 0 { + nDb-- + } + } else { + iDb = 0 + nDb = (*Tsqlite3)(unsafe.Pointer(db)).FnDb - int32(1) + } + for { + if !(iDb <= nDb) { + break + } + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if pBt != uintptr(0) { + v3 = _sqlite3BtreeTxnState(tls, pBt) + } else { + v3 = SQLITE_TXN_NONE + } + x = v3 + if x > iTxn { + iTxn = x + } + goto _2 + _2: + ; + iDb++ + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return iTxn +} + +// C documentation +// +// /* +// ** Two variations on the public interface for closing a database +// ** connection. The sqlite3_close() version returns SQLITE_BUSY and +// ** leaves the connection open if there are unfinalized prepared +// ** statements or unfinished sqlite3_backups. The sqlite3_close_v2() +// ** version forces the connection to become a zombie if there are +// ** unclosed resources, and arranges for deallocation when the last +// ** prepare statement or sqlite3_backup closes. +// */ +func Xsqlite3_close(tls *libc.TLS, db uintptr) (r int32) { + return _sqlite3Close(tls, db, 0) +} + +func Xsqlite3_close_v2(tls *libc.TLS, db uintptr) (r int32) { + return _sqlite3Close(tls, db, int32(1)) +} + +// C documentation +// +// /* +// ** Close the mutex on database connection db. +// ** +// ** Furthermore, if database connection db is a zombie (meaning that there +// ** has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and +// ** every sqlite3_stmt has now been finalized and every sqlite3_backup has +// ** finished, then free all resources. +// */ +func _sqlite3LeaveMutexAndCloseZombie(tls *libc.TLS, db uintptr) { + var i, p, pColl, pDb, pMod, pNext uintptr + var j int32 + _, _, _, _, _, _, _ = i, j, p, pColl, pDb, pMod, pNext + /* If there are outstanding sqlite3_stmt or sqlite3_backup objects + ** or if the connection has not yet been closed by sqlite3_close_v2(), + ** then just leave the mutex and return. + */ + if int32((*Tsqlite3)(unsafe.Pointer(db)).FeOpenState) != int32(SQLITE_STATE_ZOMBIE) || _connectionIsBusy(tls, db) != 0 { + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return + } + /* If we reach this point, it means that the database connection has + ** closed all sqlite3_stmt and sqlite3_backup objects and has been + ** passed to sqlite3_close (meaning that it is a zombie). Therefore, + ** go ahead and free all resources. + */ + /* If a transaction is open, roll it back. This also ensures that if + ** any database schemas have been modified by an uncommitted transaction + ** they are reset. And that the required b-tree mutex is held to make + ** the pager rollback and schema reset an atomic operation. */ + _sqlite3RollbackAll(tls, db, SQLITE_OK) + /* Free any outstanding Savepoint structures. */ + _sqlite3CloseSavepoints(tls, db) + /* Close all database connections */ + j = 0 + for { + if !(j < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + pDb = (*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32 + if (*TDb1)(unsafe.Pointer(pDb)).FpBt != 0 { + _sqlite3BtreeClose(tls, (*TDb1)(unsafe.Pointer(pDb)).FpBt) + (*TDb1)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + if j != int32(1) { + (*TDb1)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) + } + } + goto _1 + _1: + ; + j++ + } + /* Clear the TEMP schema separately and last */ + if (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema != 0 { + _sqlite3SchemaClear(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema) + } + _sqlite3VtabUnlockList(tls, db) + /* Free up the array of auxiliary databases */ + _sqlite3CollapseDatabaseArray(tls, db) + /* Tell the code in notify.c that the connection no longer holds any + ** locks and does not require any further unlock-notify callbacks. + */ + _sqlite3ConnectionClosed(tls, db) + i = (*THash)(unsafe.Pointer(db + 624)).Ffirst + for { + if !(i != 0) { + break + } + p = (*THashElem)(unsafe.Pointer(i)).Fdata + for cond := true; cond; cond = p != 0 { + _functionDestroy(tls, db, p) + pNext = (*TFuncDef)(unsafe.Pointer(p)).FpNext + _sqlite3DbFree(tls, db, p) + p = pNext + } + goto _2 + _2: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + _sqlite3HashClear(tls, db+624) + i = (*THash)(unsafe.Pointer(db + 648)).Ffirst + for { + if !(i != 0) { + break + } + pColl = (*THashElem)(unsafe.Pointer(i)).Fdata + /* Invoke any destructors registered for collation sequence user data. */ + j = 0 + for { + if !(j < int32(3)) { + break + } + if (*(*TCollSeq)(unsafe.Pointer(pColl + uintptr(j)*40))).FxDel != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TCollSeq)(unsafe.Pointer(pColl + uintptr(j)*40))).FxDel})))(tls, (*(*TCollSeq)(unsafe.Pointer(pColl + uintptr(j)*40))).FpUser) + } + goto _4 + _4: + ; + j++ + } + _sqlite3DbFree(tls, db, pColl) + goto _3 + _3: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + _sqlite3HashClear(tls, db+648) + i = (*THash)(unsafe.Pointer(db + 576)).Ffirst + for { + if !(i != 0) { + break + } + pMod = (*THashElem)(unsafe.Pointer(i)).Fdata + _sqlite3VtabEponymousTableClear(tls, db, pMod) + _sqlite3VtabModuleUnref(tls, db, pMod) + goto _5 + _5: + ; + i = (*THashElem)(unsafe.Pointer(i)).Fnext + } + _sqlite3HashClear(tls, db+576) + _sqlite3Error(tls, db, SQLITE_OK) /* Deallocates any cached error strings. */ + _sqlite3ValueFree(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + _sqlite3CloseExtensions(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_ERROR) + /* The temp-database schema is allocated differently from the other schema + ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). + ** So it needs to be freed here. Todo: Why not roll the temp schema into + ** the same sqliteMalloc() as the one that allocates the database + ** structure? + */ + _sqlite3DbFree(tls, db, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + 1*32))).FpSchema) + if (*Tsqlite3)(unsafe.Pointer(db)).FxAutovacDestr != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacDestr})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_CLOSED) + Xsqlite3_mutex_free(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced != 0 { + Xsqlite3_free(tls, (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) + } + Xsqlite3_free(tls, db) +} + +// C documentation +// +// /* +// ** Rollback all database files. If tripCode is not SQLITE_OK, then +// ** any write cursors are invalidated ("tripped" - as in "tripping a circuit +// ** breaker") and made to return tripCode if there are any further +// ** attempts to use that cursor. Read cursors remain open and valid +// ** but are "saved" in case the table pages are moved around. +// */ +func _sqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { + var i, inTrans, schemaChange int32 + var p uintptr + _, _, _, _ = i, inTrans, p, schemaChange + inTrans = 0 + _sqlite3BeginBenignMalloc(tls) + /* Obtain all b-tree mutexes before making any calls to BtreeRollback(). + ** This is important in case the transaction being rolled back has + ** modified the database schema. If the b-tree mutexes are not taken + ** here, then another shared-cache connection might sneak in between + ** the database rollback and schema reset, which can cause false + ** corruption reports in some cases. */ + _sqlite3BtreeEnterAll(tls, db) + schemaChange = libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).FmDbFlags&uint32(DBFLAG_SchemaChange) != uint32(0) && int32((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) == 0) + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb) { + break + } + p = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt + if p != 0 { + if _sqlite3BtreeTxnState(tls, p) == int32(SQLITE_TXN_WRITE) { + inTrans = int32(1) + } + _sqlite3BtreeRollback(tls, p, tripCode, libc.BoolInt32(!(schemaChange != 0))) + } + goto _1 + _1: + ; + i++ + } + _sqlite3VtabRollback(tls, db) + _sqlite3EndBenignMalloc(tls) + if schemaChange != 0 { + _sqlite3ExpirePreparedStatements(tls, db, 0) + _sqlite3ResetAllSchemasOfConnection(tls, db) + } + _sqlite3BtreeLeaveAll(tls, db) + /* Any deferred constraint violations have now been resolved. */ + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredCons = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = 0 + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^(libc.Uint64FromInt32(SQLITE_DeferFKs) | uint64(libc.Int32FromInt32(0x00002))<= 0 && rc < int32(libc.Uint64FromInt64(232)/libc.Uint64FromInt64(8)) && _aMsg[rc] != uintptr(0) { + zErr = _aMsg[rc] + } + break + } + return zErr +} + +var _aMsg = [29]uintptr{ + 0: __ccgo_ts + 23869, + 1: __ccgo_ts + 23882, + 3: __ccgo_ts + 23898, + 4: __ccgo_ts + 23923, + 5: __ccgo_ts + 23937, + 6: __ccgo_ts + 23956, + 7: __ccgo_ts + 1650, + 8: __ccgo_ts + 23981, + 9: __ccgo_ts + 24018, + 10: __ccgo_ts + 24030, + 11: __ccgo_ts + 24045, + 12: __ccgo_ts + 24078, + 13: __ccgo_ts + 24096, + 14: __ccgo_ts + 24121, + 15: __ccgo_ts + 24150, + 17: __ccgo_ts + 6053, + 18: __ccgo_ts + 5455, + 19: __ccgo_ts + 24167, + 20: __ccgo_ts + 24185, + 21: __ccgo_ts + 24203, + 23: __ccgo_ts + 24237, + 25: __ccgo_ts + 24258, + 26: __ccgo_ts + 24284, + 27: __ccgo_ts + 24307, + 28: __ccgo_ts + 24328, +} + +// C documentation +// +// /* +// ** This routine implements a busy callback that sleeps and tries +// ** again until a timeout value is reached. The timeout value is +// ** an integer number of milliseconds passed in as the first +// ** argument. +// ** +// ** Return non-zero to retry the lock. Return zero to stop trying +// ** and cause SQLite to return SQLITE_BUSY. +// */ +func _sqliteDefaultBusyCallback(tls *libc.TLS, ptr uintptr, count int32) (r int32) { + var db uintptr + var delay, prior, tmout int32 + _, _, _, _ = db, delay, prior, tmout + db = ptr + tmout = (*Tsqlite3)(unsafe.Pointer(db)).FbusyTimeout + if count < int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(1)) { + delay = int32(_delays[count]) + prior = int32(_totals[count]) + } else { + delay = int32(_delays[int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(1))-libc.Int32FromInt32(1)]) + prior = int32(_totals[int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(1))-libc.Int32FromInt32(1)]) + delay*(count-(int32(libc.Uint64FromInt64(12)/libc.Uint64FromInt64(1))-libc.Int32FromInt32(1))) + } + if prior+delay > tmout { + delay = tmout - prior + if delay <= 0 { + return 0 + } + } + _sqlite3OsSleep(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, delay*int32(1000)) + return int32(1) +} + +/* This case is for systems that have support for sleeping for fractions of + ** a second. Examples: All windows systems, unix systems with nanosleep() */ +var _delays = [12]Tu8{ + 0: uint8(1), + 1: uint8(2), + 2: uint8(5), + 3: uint8(10), + 4: uint8(15), + 5: uint8(20), + 6: uint8(25), + 7: uint8(25), + 8: uint8(25), + 9: uint8(50), + 10: uint8(50), + 11: uint8(100), +} + +var _totals = [12]Tu8{ + 1: uint8(1), + 2: uint8(3), + 3: uint8(8), + 4: uint8(18), + 5: uint8(33), + 6: uint8(53), + 7: uint8(78), + 8: uint8(103), + 9: uint8(128), + 10: uint8(178), + 11: uint8(228), +} + +// C documentation +// +// /* +// ** Invoke the given busy handler. +// ** +// ** This routine is called when an operation failed to acquire a +// ** lock on VFS file pFile. +// ** +// ** If this routine returns non-zero, the lock is retried. If it +// ** returns 0, the operation aborts with an SQLITE_BUSY error. +// */ +func _sqlite3InvokeBusyHandler(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + if (*TBusyHandler)(unsafe.Pointer(p)).FxBusyHandler == uintptr(0) || (*TBusyHandler)(unsafe.Pointer(p)).FnBusy < 0 { + return 0 + } + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TBusyHandler)(unsafe.Pointer(p)).FxBusyHandler})))(tls, (*TBusyHandler)(unsafe.Pointer(p)).FpBusyArg, (*TBusyHandler)(unsafe.Pointer(p)).FnBusy) + if rc == 0 { + (*TBusyHandler)(unsafe.Pointer(p)).FnBusy = -int32(1) + } else { + (*TBusyHandler)(unsafe.Pointer(p)).FnBusy++ + } + return rc +} + +// C documentation +// +// /* +// ** This routine sets the busy callback for an Sqlite database to the +// ** given callback function with the given argument. +// */ +func Xsqlite3_busy_handler(tls *libc.TLS, db uintptr, xBusy uintptr, pArg uintptr) (r int32) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FxBusyHandler = xBusy + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FpBusyArg = pArg + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + (*Tsqlite3)(unsafe.Pointer(db)).FbusyTimeout = 0 + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This routine sets the progress callback for an Sqlite database to the +// ** given callback function with the given argument. The progress callback will +// ** be invoked every nOps opcodes. +// */ +func Xsqlite3_progress_handler(tls *libc.TLS, db uintptr, nOps int32, xProgress uintptr, pArg uintptr) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if nOps > 0 { + (*Tsqlite3)(unsafe.Pointer(db)).FxProgress = xProgress + (*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps = uint32(nOps) + (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg = pArg + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FxProgress = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FnProgressOps = uint32(0) + (*Tsqlite3)(unsafe.Pointer(db)).FpProgressArg = uintptr(0) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) +} + +// C documentation +// +// /* +// ** This routine installs a default busy handler that waits for the +// ** specified number of milliseconds before returning 0. +// */ +func Xsqlite3_busy_timeout(tls *libc.TLS, db uintptr, ms int32) (r int32) { + if ms > 0 { + Xsqlite3_busy_handler(tls, db, __ccgo_fp(_sqliteDefaultBusyCallback), db) + (*Tsqlite3)(unsafe.Pointer(db)).FbusyTimeout = ms + } else { + Xsqlite3_busy_handler(tls, db, uintptr(0), uintptr(0)) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Cause any pending operation to stop at its earliest opportunity. +// */ +func Xsqlite3_interrupt(tls *libc.TLS, db uintptr) { + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(1), libc.Int32FromInt32(__ATOMIC_RELAXED)) +} + +// C documentation +// +// /* +// ** Return true or false depending on whether or not an interrupt is +// ** pending on connection db. +// */ +func Xsqlite3_is_interrupted(tls *libc.TLS, db uintptr) (r int32) { + return libc.BoolInt32(libc.AtomicLoadNInt32(db+432, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) +} + +// C documentation +// +// /* +// ** This function is exactly the same as sqlite3_create_function(), except +// ** that it is designed to be called by internal code. The difference is +// ** that if a malloc() fails in sqlite3_create_function(), an error code +// ** is returned and the mallocFailed flag cleared. +// */ +func _sqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, enc int32, pUserData uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, pDestructor uintptr) (r int32) { + var extraFlags, rc int32 + var p, v1 uintptr + _, _, _, _ = extraFlags, p, rc, v1 + if zFunctionName == uintptr(0) || xSFunc != uintptr(0) && xFinal != uintptr(0) || libc.BoolInt32(xFinal == uintptr(0)) != libc.BoolInt32(xStep == uintptr(0)) || libc.BoolInt32(xValue == uintptr(0)) != libc.BoolInt32(xInverse == uintptr(0)) || (nArg < -int32(1) || nArg > int32(SQLITE_MAX_FUNCTION_ARG)) || int32(255) < _sqlite3Strlen30(tls, zFunctionName) { + return _sqlite3MisuseError(tls, int32(180244)) + } + extraFlags = enc & (libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)) + enc &= libc.Int32FromInt32(SQLITE_FUNC_ENCMASK) | libc.Int32FromInt32(SQLITE_ANY) + /* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But + ** the meaning is inverted. So flip the bit. */ + extraFlags ^= int32(SQLITE_FUNC_UNSAFE) /* tag-20230109-1 */ + /* If SQLITE_UTF16 is specified as the encoding type, transform this + ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the + ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. + ** + ** If SQLITE_ANY is specified, add three versions of the function + ** to the hash table. + */ + switch enc { + case int32(SQLITE_UTF16): + enc = int32(SQLITE_UTF16LE) + case int32(SQLITE_ANY): + rc = _sqlite3CreateFunc(tls, db, zFunctionName, nArg, int32(SQLITE_UTF8)|extraFlags^int32(SQLITE_FUNC_UNSAFE), pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor) + if rc == SQLITE_OK { + rc = _sqlite3CreateFunc(tls, db, zFunctionName, nArg, int32(SQLITE_UTF16LE)|extraFlags^int32(SQLITE_FUNC_UNSAFE), pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor) + } + if rc != SQLITE_OK { + return rc + } + enc = int32(SQLITE_UTF16BE) + case int32(SQLITE_UTF8): + fallthrough + case int32(SQLITE_UTF16LE): + fallthrough + case int32(SQLITE_UTF16BE): + default: + enc = int32(SQLITE_UTF8) + break + } + /* Check if an existing function is being overridden or deleted. If so, + ** and there are active VMs, then return SQLITE_BUSY. If a function + ** is being overridden/deleted but there are no active VMs, allow the + ** operation to continue but invalidate all precompiled statements. + */ + p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(0)) + if p != 0 && (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) == uint32(enc) && int32((*TFuncDef)(unsafe.Pointer(p)).FnArg) == nArg { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24425, 0) + return int32(SQLITE_BUSY) + } else { + _sqlite3ExpirePreparedStatements(tls, db, 0) + } + } else { + if xSFunc == uintptr(0) && xFinal == uintptr(0) { + /* Trying to delete a function that does not exist. This is a no-op. + ** https://sqlite.org/forum/forumpost/726219164b */ + return SQLITE_OK + } + } + p = _sqlite3FindFunction(tls, db, zFunctionName, nArg, uint8(enc), uint8(1)) + if !(p != 0) { + return int32(SQLITE_NOMEM) + } + /* If an older version of the function with a configured destructor is + ** being replaced invoke the destructor function here. */ + _functionDestroy(tls, db, p) + if pDestructor != 0 { + (*TFuncDestructor)(unsafe.Pointer(pDestructor)).FnRef++ + } + *(*uintptr)(unsafe.Pointer(p + 64)) = pDestructor + (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags = (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK) | uint32(extraFlags) + if xSFunc != 0 { + v1 = xSFunc + } else { + v1 = xStep + } + (*TFuncDef)(unsafe.Pointer(p)).FxSFunc = v1 + (*TFuncDef)(unsafe.Pointer(p)).FxFinalize = xFinal + (*TFuncDef)(unsafe.Pointer(p)).FxValue = xValue + (*TFuncDef)(unsafe.Pointer(p)).FxInverse = xInverse + (*TFuncDef)(unsafe.Pointer(p)).FpUserData = pUserData + (*TFuncDef)(unsafe.Pointer(p)).FnArg = int8(uint16(nArg)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Worker function used by utf-8 APIs that create new functions: +// ** +// ** sqlite3_create_function() +// ** sqlite3_create_function_v2() +// ** sqlite3_create_window_function() +// */ +func _createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, xDestroy uintptr) (r int32) { + var pArg uintptr + var rc int32 + _, _ = pArg, rc + rc = int32(SQLITE_ERROR) + pArg = uintptr(0) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if xDestroy != 0 { + pArg = _sqlite3Malloc(tls, uint64(24)) + if !(pArg != 0) { + _sqlite3OomFault(tls, db) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, p) + goto out + } + (*TFuncDestructor)(unsafe.Pointer(pArg)).FnRef = 0 + (*TFuncDestructor)(unsafe.Pointer(pArg)).FxDestroy = xDestroy + (*TFuncDestructor)(unsafe.Pointer(pArg)).FpUserData = p + } + rc = _sqlite3CreateFunc(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, xValue, xInverse, pArg) + if pArg != 0 && (*TFuncDestructor)(unsafe.Pointer(pArg)).FnRef == 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestroy})))(tls, p) + Xsqlite3_free(tls, pArg) + } +out: + ; + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Create new user functions. +// */ +func Xsqlite3_create_function(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr) (r int32) { + return _createFunctionApi(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, uintptr(0), uintptr(0), uintptr(0)) +} + +func Xsqlite3_create_function_v2(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xDestroy uintptr) (r int32) { + return _createFunctionApi(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, uintptr(0), uintptr(0), xDestroy) +} + +func Xsqlite3_create_window_function(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, xDestroy uintptr) (r int32) { + return _createFunctionApi(tls, db, zFunc, nArg, enc, p, uintptr(0), xStep, xFinal, xValue, xInverse, xDestroy) +} + +func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, eTextRep int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr) (r int32) { + var rc int32 + var zFunc8 uintptr + _, _ = rc, zFunc8 + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + zFunc8 = _sqlite3Utf16to8(tls, db, zFunctionName, -int32(1), uint8(SQLITE_UTF16LE)) + rc = _sqlite3CreateFunc(tls, db, zFunc8, nArg, eTextRep, p, xSFunc, xStep, xFinal, uintptr(0), uintptr(0), uintptr(0)) + _sqlite3DbFree(tls, db, zFunc8) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** The following is the implementation of an SQL function that always +// ** fails with an error message stating that the function is used in the +// ** wrong context. The sqlite3_overload_function() API might construct +// ** SQL function that use this routine so that the functions will exist +// ** for name resolution but are actually overloaded by the xFindFunction +// ** method of virtual tables. +// */ +func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var zErr, zName uintptr + _, _ = zErr, zName + zName = Xsqlite3_user_data(tls, context) + _ = NotUsed + _ = NotUsed2 + zErr = Xsqlite3_mprintf(tls, __ccgo_ts+24488, libc.VaList(bp+8, zName)) + Xsqlite3_result_error(tls, context, zErr, -int32(1)) + Xsqlite3_free(tls, zErr) +} + +// C documentation +// +// /* +// ** Declare that a function has been overloaded by a virtual table. +// ** +// ** If the function already exists as a regular global function, then +// ** this routine is a no-op. If the function does not exist, then create +// ** a new one that always throws a run-time error. +// ** +// ** When virtual tables intend to provide an overloaded function, they +// ** should call this routine to make sure the global function exists. +// ** A global function must exist in order for name resolution to work +// ** properly. +// */ +func Xsqlite3_overload_function(tls *libc.TLS, db uintptr, zName uintptr, nArg int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var zCopy uintptr + _, _ = rc, zCopy + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + rc = libc.BoolInt32(_sqlite3FindFunction(tls, db, zName, nArg, uint8(SQLITE_UTF8), uint8(0)) != uintptr(0)) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if rc != 0 { + return SQLITE_OK + } + zCopy = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, zName)) + if zCopy == uintptr(0) { + return int32(SQLITE_NOMEM) + } + return Xsqlite3_create_function_v2(tls, db, zName, nArg, int32(SQLITE_UTF8), zCopy, __ccgo_fp(_sqlite3InvalidFunction), uintptr(0), uintptr(0), __ccgo_fp(Xsqlite3_free)) +} + +// C documentation +// +// /* +// ** Register a trace function. The pArg from the previously registered trace +// ** is returned. +// ** +// ** A NULL trace function means that no tracing is executes. A non-NULL +// ** trace is a pointer to a function that is invoked at the start of each +// ** SQL statement. +// */ +func Xsqlite3_trace(tls *libc.TLS, db uintptr, xTrace uintptr, pArg uintptr) (r uintptr) { + var pOld uintptr + var v1 int32 + _, _ = pOld, v1 + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg + if xTrace != 0 { + v1 = int32(SQLITE_TRACE_LEGACY) + } else { + v1 = 0 + } + (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = uint8(v1) + *(*uintptr)(unsafe.Pointer(db + 248)) = xTrace + (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// C documentation +// +// /* Register a trace callback using the version-2 interface. +// */ +func Xsqlite3_trace_v2(tls *libc.TLS, db uintptr, mTrace uint32, xTrace uintptr, pArg uintptr) (r int32) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if mTrace == uint32(0) { + xTrace = uintptr(0) + } + if xTrace == uintptr(0) { + mTrace = uint32(0) + } + (*Tsqlite3)(unsafe.Pointer(db)).FmTrace = uint8(mTrace) + *(*uintptr)(unsafe.Pointer(db + 248)) = xTrace + (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Register a profile function. The pArg from the previously registered +// ** profile function is returned. +// ** +// ** A NULL profile function means that no profiling is executes. A non-NULL +// ** profile is a pointer to a function that is invoked at the conclusion of +// ** each SQL statement that is run. +// */ +func Xsqlite3_profile(tls *libc.TLS, db uintptr, xProfile uintptr, pArg uintptr) (r uintptr) { + var pOld, p1, p2 uintptr + _, _, _ = pOld, p1, p2 + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Tsqlite3)(unsafe.Pointer(db)).FpProfileArg + (*Tsqlite3)(unsafe.Pointer(db)).FxProfile = xProfile + (*Tsqlite3)(unsafe.Pointer(db)).FpProfileArg = pArg + p1 = db + 110 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) & libc.Int32FromInt32(SQLITE_TRACE_NONLEGACY_MASK)) + if (*Tsqlite3)(unsafe.Pointer(db)).FxProfile != 0 { + p2 = db + 110 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) | libc.Int32FromInt32(SQLITE_TRACE_XPROFILE)) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// C documentation +// +// /* +// ** Register a function to be invoked when a transaction commits. +// ** If the invoked function returns non-zero, then the commit becomes a +// ** rollback. +// */ +func Xsqlite3_commit_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) (r uintptr) { + var pOld uintptr + _ = pOld + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Tsqlite3)(unsafe.Pointer(db)).FpCommitArg + (*Tsqlite3)(unsafe.Pointer(db)).FxCommitCallback = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpCommitArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// C documentation +// +// /* +// ** Register a callback to be invoked each time a row is updated, +// ** inserted or deleted using this database connection. +// */ +func Xsqlite3_update_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) (r uintptr) { + var pRet uintptr + _ = pRet + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg + (*Tsqlite3)(unsafe.Pointer(db)).FxUpdateCallback = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpUpdateArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// C documentation +// +// /* +// ** Register a callback to be invoked each time a transaction is rolled +// ** back by this database connection. +// */ +func Xsqlite3_rollback_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) (r uintptr) { + var pRet uintptr + _ = pRet + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Tsqlite3)(unsafe.Pointer(db)).FpRollbackArg + (*Tsqlite3)(unsafe.Pointer(db)).FxRollbackCallback = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpRollbackArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// C documentation +// +// /* +// ** Register a callback to be invoked each time a row is updated, +// ** inserted or deleted using this database connection. +// */ +func Xsqlite3_preupdate_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) (r uintptr) { + var pRet uintptr + _ = pRet + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdateArg + (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpPreUpdateArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// C documentation +// +// /* +// ** Register a function to be invoked prior to each autovacuum that +// ** determines the number of pages to vacuum. +// */ +func Xsqlite3_autovacuum_pages(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr, xDestructor uintptr) (r int32) { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Tsqlite3)(unsafe.Pointer(db)).FxAutovacDestr != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAutovacDestr})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg) + } + (*Tsqlite3)(unsafe.Pointer(db)).FxAutovacPages = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpAutovacPagesArg = pArg + (*Tsqlite3)(unsafe.Pointer(db)).FxAutovacDestr = xDestructor + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). +// ** Invoke sqlite3_wal_checkpoint if the number of frames in the log file +// ** is greater than sqlite3.pWalArg cast to an integer (the value configured by +// ** wal_autocheckpoint()). +// */ +func _sqlite3WalDefaultHook(tls *libc.TLS, pClientData uintptr, db uintptr, zDb uintptr, nFrame int32) (r int32) { + if nFrame >= int32(int64(pClientData)) { + _sqlite3BeginBenignMalloc(tls) + Xsqlite3_wal_checkpoint(tls, db, zDb) + _sqlite3EndBenignMalloc(tls) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Configure an sqlite3_wal_hook() callback to automatically checkpoint +// ** a database after committing a transaction if there are nFrame or +// ** more frames in the log file. Passing zero or a negative value as the +// ** nFrame parameter disables automatic checkpoints entirely. +// ** +// ** The callback registered by this function replaces any existing callback +// ** registered using sqlite3_wal_hook(). Likewise, registering a callback +// ** using sqlite3_wal_hook() disables the automatic checkpoint mechanism +// ** configured by this function. +// */ +func Xsqlite3_wal_autocheckpoint(tls *libc.TLS, db uintptr, nFrame int32) (r int32) { + if nFrame > 0 { + Xsqlite3_wal_hook(tls, db, __ccgo_fp(_sqlite3WalDefaultHook), uintptr(int64(nFrame))) + } else { + Xsqlite3_wal_hook(tls, db, uintptr(0), uintptr(0)) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Register a callback to be invoked each time a transaction is written +// ** into the write-ahead-log by this database connection. +// */ +func Xsqlite3_wal_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) (r uintptr) { + var pRet uintptr + _ = pRet + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Tsqlite3)(unsafe.Pointer(db)).FpWalArg + (*Tsqlite3)(unsafe.Pointer(db)).FxWalCallback = xCallback + (*Tsqlite3)(unsafe.Pointer(db)).FpWalArg = pArg + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// C documentation +// +// /* +// ** Checkpoint database zDb. +// */ +func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iDb, rc int32 + _, _ = iDb, rc /* Schema to checkpoint */ + /* Initialize the output variables to -1 in case an error occurs. */ + if pnLog != 0 { + *(*int32)(unsafe.Pointer(pnLog)) = -int32(1) + } + if pnCkpt != 0 { + *(*int32)(unsafe.Pointer(pnCkpt)) = -int32(1) + } + if eMode < SQLITE_CHECKPOINT_PASSIVE || eMode > int32(SQLITE_CHECKPOINT_TRUNCATE) { + /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint + ** mode: */ + return _sqlite3MisuseError(tls, int32(180859)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if zDb != 0 && *(*int8)(unsafe.Pointer(zDb)) != 0 { + iDb = _sqlite3FindDbName(tls, db, zDb) + } else { + iDb = libc.Int32FromInt32(SQLITE_MAX_ATTACHED) + libc.Int32FromInt32(2) /* This means process all schemas */ + } + if iDb < 0 { + rc = int32(SQLITE_ERROR) + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+24539, libc.VaList(bp+8, zDb)) + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + rc = _sqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) + _sqlite3Error(tls, db, rc) + } + rc = _sqlite3ApiExit(tls, db, rc) + /* If there are no active statements, clear the interrupt flag at this + ** point. */ + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + libc.AtomicStoreNInt32(db+432, libc.Int32FromInt32(0), libc.Int32FromInt32(__ATOMIC_RELAXED)) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points +// ** to contains a zero-length string, all attached databases are +// ** checkpointed. +// */ +func Xsqlite3_wal_checkpoint(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { + /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to + ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */ + return Xsqlite3_wal_checkpoint_v2(tls, db, zDb, SQLITE_CHECKPOINT_PASSIVE, uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** Run a checkpoint on database iDb. This is a no-op if database iDb is +// ** not currently open in WAL mode. +// ** +// ** If a transaction is open on the database being checkpointed, this +// ** function returns SQLITE_LOCKED and a checkpoint is not attempted. If +// ** an error occurs while running the checkpoint, an SQLite error code is +// ** returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK. +// ** +// ** The mutex on database handle db should be held by the caller. The mutex +// ** associated with the specific b-tree being checkpointed is taken by +// ** this function while the checkpoint is running. +// ** +// ** If iDb is passed SQLITE_MAX_DB then all attached databases are +// ** checkpointed. If an error is encountered it is returned immediately - +// ** no attempt is made to checkpoint any remaining databases. +// ** +// ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART +// ** or TRUNCATE. +// */ +func _sqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog uintptr, pnCkpt uintptr) (r int32) { + var bBusy, i, rc, v2 int32 + _, _, _, _ = bBusy, i, rc, v2 + rc = SQLITE_OK /* Used to iterate through attached dbs */ + bBusy = 0 /* True if SQLITE_BUSY has been encountered */ + /* See forum post a006d86f72 */ + i = 0 + for { + if !(i < (*Tsqlite3)(unsafe.Pointer(db)).FnDb && rc == SQLITE_OK) { + break + } + if i == iDb || iDb == libc.Int32FromInt32(SQLITE_MAX_ATTACHED)+libc.Int32FromInt32(2) { + rc = _sqlite3BtreeCheckpoint(tls, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32))).FpBt, eMode, pnLog, pnCkpt) + pnLog = uintptr(0) + pnCkpt = uintptr(0) + if rc == int32(SQLITE_BUSY) { + bBusy = int32(1) + rc = SQLITE_OK + } + } + goto _1 + _1: + ; + i++ + } + if rc == SQLITE_OK && bBusy != 0 { + v2 = int32(SQLITE_BUSY) + } else { + v2 = rc + } + return v2 +} + +// C documentation +// +// /* +// ** This function returns true if main-memory should be used instead of +// ** a temporary file for transient pager files and statement journals. +// ** The value returned depends on the value of db->temp_store (runtime +// ** parameter) and the compile time value of SQLITE_TEMP_STORE. The +// ** following table describes the relationship between these two values +// ** and this functions return value. +// ** +// ** SQLITE_TEMP_STORE db->temp_store Location of temporary database +// ** ----------------- -------------- ------------------------------ +// ** 0 any file (return 0) +// ** 1 1 file (return 0) +// ** 1 2 memory (return 1) +// ** 1 0 file (return 0) +// ** 2 1 file (return 0) +// ** 2 2 memory (return 1) +// ** 2 0 memory (return 1) +// ** 3 any memory (return 1) +// */ +func _sqlite3TempInMemory(tls *libc.TLS, db uintptr) (r int32) { + return libc.BoolInt32(int32((*Tsqlite3)(unsafe.Pointer(db)).Ftemp_store) == int32(2)) +} + +// C documentation +// +// /* +// ** Return UTF-8 encoded English language explanation of the most recent +// ** error. +// */ +func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) (r uintptr) { + var z, v1 uintptr + _, _ = z, v1 + if !(db != 0) { + return _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) + } + if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return _sqlite3ErrStr(tls, _sqlite3MisuseError(tls, int32(180995))) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + z = _sqlite3ErrStr(tls, int32(SQLITE_NOMEM)) + } else { + if (*Tsqlite3)(unsafe.Pointer(db)).FerrCode != 0 { + v1 = Xsqlite3_value_text(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + } else { + v1 = uintptr(0) + } + z = v1 + if z == uintptr(0) { + z = _sqlite3ErrStr(tls, (*Tsqlite3)(unsafe.Pointer(db)).FerrCode) + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return z +} + +// C documentation +// +// /* +// ** Return the byte offset of the most recent error +// */ +func Xsqlite3_error_offset(tls *libc.TLS, db uintptr) (r int32) { + var iOffset int32 + _ = iOffset + iOffset = -int32(1) + if db != 0 && _sqlite3SafetyCheckSickOrOk(tls, db) != 0 && (*Tsqlite3)(unsafe.Pointer(db)).FerrCode != 0 { + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + iOffset = (*Tsqlite3)(unsafe.Pointer(db)).FerrByteOffset + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + } + return iOffset +} + +// C documentation +// +// /* +// ** Return UTF-16 encoded English language explanation of the most recent +// ** error. +// */ +func Xsqlite3_errmsg16(tls *libc.TLS, db uintptr) (r uintptr) { + var z uintptr + _ = z + if !(db != 0) { + return uintptr(unsafe.Pointer(&_outOfMem)) + } + if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return uintptr(unsafe.Pointer(&_misuse)) + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + z = uintptr(unsafe.Pointer(&_outOfMem)) + } else { + z = Xsqlite3_value_text16(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + if z == uintptr(0) { + _sqlite3ErrorWithMsg(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FerrCode, _sqlite3ErrStr(tls, (*Tsqlite3)(unsafe.Pointer(db)).FerrCode), 0) + z = Xsqlite3_value_text16(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpErr) + } + /* A malloc() may have failed within the call to sqlite3_value_text16() + ** above. If this is the case, then the db->mallocFailed flag needs to + ** be cleared before returning. Do this directly, instead of via + ** sqlite3ApiExit(), to avoid setting the database handle error message. + */ + _sqlite3OomClear(tls, db) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return z +} + +var _outOfMem = [14]Tu16{ + 0: uint16('o'), + 1: uint16('u'), + 2: uint16('t'), + 3: uint16(' '), + 4: uint16('o'), + 5: uint16('f'), + 6: uint16(' '), + 7: uint16('m'), + 8: uint16('e'), + 9: uint16('m'), + 10: uint16('o'), + 11: uint16('r'), + 12: uint16('y'), +} + +var _misuse = [34]Tu16{ + 0: uint16('b'), + 1: uint16('a'), + 2: uint16('d'), + 3: uint16(' '), + 4: uint16('p'), + 5: uint16('a'), + 6: uint16('r'), + 7: uint16('a'), + 8: uint16('m'), + 9: uint16('e'), + 10: uint16('t'), + 11: uint16('e'), + 12: uint16('r'), + 13: uint16(' '), + 14: uint16('o'), + 15: uint16('r'), + 16: uint16(' '), + 17: uint16('o'), + 18: uint16('t'), + 19: uint16('h'), + 20: uint16('e'), + 21: uint16('r'), + 22: uint16(' '), + 23: uint16('A'), + 24: uint16('P'), + 25: uint16('I'), + 26: uint16(' '), + 27: uint16('m'), + 28: uint16('i'), + 29: uint16('s'), + 30: uint16('u'), + 31: uint16('s'), + 32: uint16('e'), +} + +// C documentation +// +// /* +// ** Return the most recent error code generated by an SQLite routine. If NULL is +// ** passed to this function, we assume a malloc() failed during sqlite3_open(). +// */ +func Xsqlite3_errcode(tls *libc.TLS, db uintptr) (r int32) { + if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return _sqlite3MisuseError(tls, int32(181074)) + } + if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(SQLITE_NOMEM) + } + return (*Tsqlite3)(unsafe.Pointer(db)).FerrCode & (*Tsqlite3)(unsafe.Pointer(db)).FerrMask +} + +func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) (r int32) { + if db != 0 && !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return _sqlite3MisuseError(tls, int32(181083)) + } + if !(db != 0) || (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return int32(SQLITE_NOMEM) + } + return (*Tsqlite3)(unsafe.Pointer(db)).FerrCode +} + +func Xsqlite3_system_errno(tls *libc.TLS, db uintptr) (r int32) { + var v1 int32 + _ = v1 + if db != 0 { + v1 = (*Tsqlite3)(unsafe.Pointer(db)).FiSysErrno + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Return a string that describes the kind of error specified in the +// ** argument. For now, this simply calls the internal sqlite3ErrStr() +// ** function. +// */ +func Xsqlite3_errstr(tls *libc.TLS, rc int32) (r uintptr) { + return _sqlite3ErrStr(tls, rc) +} + +// C documentation +// +// /* +// ** Create a new collating function for database "db". The name is zName +// ** and the encoding is enc. +// */ +func _createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc Tu8, pCtx uintptr, xCompare uintptr, xDel uintptr) (r int32) { + var aColl, p, pColl uintptr + var enc2, j int32 + _, _, _, _, _ = aColl, enc2, j, p, pColl + /* If SQLITE_UTF16 is specified as the encoding type, transform this + ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the + ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. + */ + enc2 = int32(enc) + if enc2 == int32(SQLITE_UTF16) || enc2 == int32(SQLITE_UTF16_ALIGNED) { + enc2 = int32(SQLITE_UTF16LE) + } + if enc2 < int32(SQLITE_UTF8) || enc2 > int32(SQLITE_UTF16BE) { + return _sqlite3MisuseError(tls, int32(181131)) + } + /* Check if this call is removing or replacing an existing collation + ** sequence. If so, and there are active VMs, return busy. If there + ** are no active VMs, invalidate any pre-compiled statements. + */ + pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, 0) + if pColl != 0 && (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp != 0 { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { + _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+24560, 0) + return int32(SQLITE_BUSY) + } + _sqlite3ExpirePreparedStatements(tls, db, 0) + /* If collation sequence pColl was created directly by a call to + ** sqlite3_create_collation, and not generated by synthCollSeq(), + ** then any copies made by synthCollSeq() need to be invalidated. + ** Also, collation destructor - CollSeq.xDel() - function may need + ** to be called. + */ + if int32((*TCollSeq)(unsafe.Pointer(pColl)).Fenc) & ^libc.Int32FromInt32(SQLITE_UTF16_ALIGNED) == enc2 { + aColl = _sqlite3HashFind(tls, db+648, zName) + j = 0 + for { + if !(j < int32(3)) { + break + } + p = aColl + uintptr(j)*40 + if int32((*TCollSeq)(unsafe.Pointer(p)).Fenc) == int32((*TCollSeq)(unsafe.Pointer(pColl)).Fenc) { + if (*TCollSeq)(unsafe.Pointer(p)).FxDel != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TCollSeq)(unsafe.Pointer(p)).FxDel})))(tls, (*TCollSeq)(unsafe.Pointer(p)).FpUser) + } + (*TCollSeq)(unsafe.Pointer(p)).FxCmp = uintptr(0) + } + goto _1 + _1: + ; + j++ + } + } + } + pColl = _sqlite3FindCollSeq(tls, db, uint8(enc2), zName, int32(1)) + if pColl == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TCollSeq)(unsafe.Pointer(pColl)).FxCmp = xCompare + (*TCollSeq)(unsafe.Pointer(pColl)).FpUser = pCtx + (*TCollSeq)(unsafe.Pointer(pColl)).FxDel = xDel + (*TCollSeq)(unsafe.Pointer(pColl)).Fenc = uint8(enc2 | int32(enc)&libc.Int32FromInt32(SQLITE_UTF16_ALIGNED)) + _sqlite3Error(tls, db, SQLITE_OK) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This array defines hard upper bounds on limit values. The +// ** initializer must be kept in sync with the SQLITE_LIMIT_* +// ** #defines in sqlite3.h. +// */ +var _aHardLimit = [12]int32{ + 0: int32(SQLITE_MAX_LENGTH), + 1: int32(SQLITE_MAX_SQL_LENGTH), + 2: int32(SQLITE_MAX_COLUMN), + 3: int32(SQLITE_MAX_EXPR_DEPTH), + 4: int32(SQLITE_MAX_COMPOUND_SELECT), + 5: int32(SQLITE_MAX_VDBE_OP), + 6: int32(SQLITE_MAX_FUNCTION_ARG), + 7: int32(SQLITE_MAX_ATTACHED), + 8: int32(SQLITE_MAX_LIKE_PATTERN_LENGTH), + 9: int32(SQLITE_MAX_VARIABLE_NUMBER), + 10: int32(SQLITE_MAX_TRIGGER_DEPTH), + 11: int32(SQLITE_MAX_WORKER_THREADS), +} + +/* +** Make sure the hard limits are set to reasonable values + */ + +// C documentation +// +// /* +// ** Change the value of a limit. Report the old value. +// ** If an invalid limit index is supplied, report -1. +// ** Make no changes but still report the old value if the +// ** new limit is negative. +// ** +// ** A new lower limit does not shrink existing constructs. +// ** It merely prevents new constructs that exceed the limit +// ** from forming. +// */ +func Xsqlite3_limit(tls *libc.TLS, db uintptr, limitId int32, newLimit int32) (r int32) { + var oldLimit int32 + _ = oldLimit + /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME + ** there is a hard upper bound set at compile-time by a C preprocessor + ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to + ** "_MAX_".) + */ + if limitId < 0 || limitId >= libc.Int32FromInt32(SQLITE_LIMIT_WORKER_THREADS)+libc.Int32FromInt32(1) { + return -int32(1) + } + oldLimit = *(*int32)(unsafe.Pointer(db + 136 + uintptr(limitId)*4)) + if newLimit >= 0 { /* IMP: R-52476-28732 */ + if newLimit > _aHardLimit[limitId] { + newLimit = _aHardLimit[limitId] /* IMP: R-51463-25634 */ + } else { + if newLimit < int32(1) && limitId == SQLITE_LIMIT_LENGTH { + newLimit = int32(1) + } + } + *(*int32)(unsafe.Pointer(db + 136 + uintptr(limitId)*4)) = newLimit + } + return oldLimit /* IMP: R-53341-35419 */ +} + +// C documentation +// +// /* +// ** This function is used to parse both URIs and non-URI filenames passed by the +// ** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database +// ** URIs specified as part of ATTACH statements. +// ** +// ** The first argument to this function is the name of the VFS to use (or +// ** a NULL to signify the default VFS) if the URI does not contain a "vfs=xxx" +// ** query parameter. The second argument contains the URI (or non-URI filename) +// ** itself. When this function is called the *pFlags variable should contain +// ** the default flags to open the database handle with. The value stored in +// ** *pFlags may be updated before returning if the URI filename contains +// ** "cache=xxx" or "mode=xxx" query parameters. +// ** +// ** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to +// ** the VFS that should be used to open the database file. *pzFile is set to +// ** point to a buffer containing the name of the file to open. The value +// ** stored in *pzFile is a database name acceptable to sqlite3_uri_parameter() +// ** and is in the same format as names created using sqlite3_create_filename(). +// ** The caller must invoke sqlite3_free_filename() (not sqlite3_free()!) on +// ** the value returned in *pzFile to avoid a memory leak. +// ** +// ** If an error occurs, then an SQLite error code is returned and *pzErrMsg +// ** may be set to point to a buffer containing an English language error +// ** message. It is the responsibility of the caller to eventually release +// ** this buffer by calling sqlite3_free(). +// */ +func _sqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags uintptr, ppVfs uintptr, pzFile uintptr, pzErrMsg uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aMode, z, zFile, zModeType, zOpt, zVal, zVfs uintptr + var c, v2, v5 int8 + var eState, i, iIn, iOut, limit, mask, mode, nOpt, nUri, nVal, octet, rc, v3, v4, v6, v7, v8 int32 + var flags uint32 + var nByte Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aMode, c, eState, flags, i, iIn, iOut, limit, mask, mode, nByte, nOpt, nUri, nVal, octet, rc, z, zFile, zModeType, zOpt, zVal, zVfs, v2, v3, v4, v5, v6, v7, v8 + rc = SQLITE_OK + flags = *(*uint32)(unsafe.Pointer(pFlags)) + zVfs = zDefaultVfs + nUri = _sqlite3Strlen30(tls, zUri) + if (flags&uint32(SQLITE_OPEN_URI) != 0 || libc.AtomicLoadNUint8(uintptr(unsafe.Pointer(&_sqlite3Config))+6, libc.Int32FromInt32(__ATOMIC_RELAXED)) != 0) && nUri >= int32(5) && libc.Xmemcmp(tls, zUri, __ccgo_ts+24628, uint64(5)) == 0 { /* Input character index */ + iOut = 0 /* Output character index */ + nByte = uint64(nUri + int32(8)) /* Bytes of space to allocate */ + /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen + ** method that there may be extra parameters following the file-name. */ + flags |= uint32(SQLITE_OPEN_URI) + iIn = 0 + for { + if !(iIn < nUri) { + break + } + nByte += libc.BoolUint64(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == libc.Int32FromUint8('&')) + goto _1 + _1: + ; + iIn++ + } + zFile = Xsqlite3_malloc64(tls, nByte) + if !(zFile != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, zFile, 0, uint64(4)) /* 4-byte of 0x00 is the start of DB name marker */ + zFile += uintptr(4) + iIn = int32(5) + /* Discard the scheme and authority segments of the URI. */ + if int32(*(*int8)(unsafe.Pointer(zUri + 5))) == int32('/') && int32(*(*int8)(unsafe.Pointer(zUri + 6))) == int32('/') { + iIn = int32(7) + for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('/') { + iIn++ + } + if iIn != int32(7) && (iIn != int32(16) || libc.Xmemcmp(tls, __ccgo_ts+24634, zUri+7, uint64(9)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24644, libc.VaList(bp+8, iIn-int32(7), zUri+7)) + rc = int32(SQLITE_ERROR) + goto parse_uri_out + } + } + /* Copy the filename and any query parameters into the zFile buffer. + ** Decode %HH escape codes along the way. + ** + ** Within this loop, variable eState may be set to 0, 1 or 2, depending + ** on the parsing context. As follows: + ** + ** 0: Parsing file-name. + ** 1: Parsing name section of a name=value query parameter. + ** 2: Parsing value section of a name=value query parameter. + */ + eState = 0 + for { + v2 = *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) + c = v2 + if !(int32(v2) != 0 && int32(c) != int32('#')) { + break + } + iIn++ + if int32(c) == int32('%') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn))))])&int32(0x08) != 0 && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn+int32(1)))))])&int32(0x08) != 0 { + v3 = iIn + iIn++ + octet = int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zUri + uintptr(v3)))))) << int32(4) + v4 = iIn + iIn++ + octet += int32(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zUri + uintptr(v4)))))) + if octet == 0 { + /* This branch is taken when "%00" appears within the URI. In this + ** case we ignore all text in the remainder of the path, name or + ** value currently being parsed. So ignore the current character + ** and skip to the next "?", "=" or "&", as appropriate. */ + for { + v5 = *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) + c = v5 + if !(int32(v5) != 0 && int32(c) != int32('#') && (eState != 0 || int32(c) != int32('?')) && (eState != int32(1) || int32(c) != int32('=') && int32(c) != int32('&')) && (eState != int32(2) || int32(c) != int32('&'))) { + break + } + iIn++ + } + continue + } + c = int8(octet) + } else { + if eState == int32(1) && (int32(c) == int32('&') || int32(c) == int32('=')) { + if int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iOut-int32(1))))) == 0 { + /* An empty option name. Ignore this option altogether. */ + for *(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0 && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != int32('#') && int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn-int32(1))))) != int32('&') { + iIn++ + } + continue + } + if int32(c) == int32('&') { + v6 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zFile + uintptr(v6))) = int8('\000') + } else { + eState = int32(2) + } + c = 0 + } else { + if eState == 0 && int32(c) == int32('?') || eState == int32(2) && int32(c) == int32('&') { + c = 0 + eState = int32(1) + } + } + } + v7 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zFile + uintptr(v7))) = c + } + if eState == int32(1) { + v8 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zFile + uintptr(v8))) = int8('\000') + } + libc.Xmemset(tls, zFile+uintptr(iOut), 0, uint64(4)) /* end-of-options + empty journal filenames */ + /* Check if there were any options specified that should be interpreted + ** here. Options that are interpreted here include "vfs" and those that + ** correspond to flags that may be passed to the sqlite3_open_v2() + ** method. */ + zOpt = zFile + uintptr(_sqlite3Strlen30(tls, zFile)+int32(1)) + for *(*int8)(unsafe.Pointer(zOpt)) != 0 { + nOpt = _sqlite3Strlen30(tls, zOpt) + zVal = zOpt + uintptr(nOpt+int32(1)) + nVal = _sqlite3Strlen30(tls, zVal) + if nOpt == int32(3) && libc.Xmemcmp(tls, __ccgo_ts+24672, zOpt, uint64(3)) == 0 { + zVfs = zVal + } else { + aMode = uintptr(0) + zModeType = uintptr(0) + mask = 0 + limit = 0 + if nOpt == int32(5) && libc.Xmemcmp(tls, __ccgo_ts+24676, zOpt, uint64(5)) == 0 { + mask = libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE) | libc.Int32FromInt32(SQLITE_OPEN_PRIVATECACHE) + aMode = uintptr(unsafe.Pointer(&_aCacheMode)) + limit = mask + zModeType = __ccgo_ts + 24676 + } + if nOpt == int32(4) && libc.Xmemcmp(tls, __ccgo_ts+24697, zOpt, uint64(4)) == 0 { + mask = libc.Int32FromInt32(SQLITE_OPEN_READONLY) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_MEMORY) + aMode = uintptr(unsafe.Pointer(&_aOpenMode)) + limit = int32(uint32(mask) & flags) + zModeType = __ccgo_ts + 3436 + } + if aMode != 0 { + mode = 0 + i = 0 + for { + if !((*(*struct { + Fz uintptr + Fmode int32 + })(unsafe.Pointer(aMode + uintptr(i)*16))).Fz != 0) { + break + } + z = (*(*struct { + Fz uintptr + Fmode int32 + })(unsafe.Pointer(aMode + uintptr(i)*16))).Fz + if nVal == _sqlite3Strlen30(tls, z) && 0 == libc.Xmemcmp(tls, zVal, z, uint64(nVal)) { + mode = (*(*struct { + Fz uintptr + Fmode int32 + })(unsafe.Pointer(aMode + uintptr(i)*16))).Fmode + break + } + goto _9 + _9: + ; + i++ + } + if mode == 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24712, libc.VaList(bp+8, zModeType, zVal)) + rc = int32(SQLITE_ERROR) + goto parse_uri_out + } + if mode & ^libc.Int32FromInt32(SQLITE_OPEN_MEMORY) > limit { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24732, libc.VaList(bp+8, zModeType, zVal)) + rc = int32(SQLITE_PERM) + goto parse_uri_out + } + flags = flags&uint32(^mask) | uint32(mode) + } + } + zOpt = zVal + uintptr(nVal+int32(1)) + } + } else { + zFile = Xsqlite3_malloc64(tls, uint64(nUri+int32(8))) + if !(zFile != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, zFile, 0, uint64(4)) + zFile += uintptr(4) + if nUri != 0 { + libc.Xmemcpy(tls, zFile, zUri, uint64(nUri)) + } + libc.Xmemset(tls, zFile+uintptr(nUri), 0, uint64(4)) + flags &= uint32(^libc.Int32FromInt32(SQLITE_OPEN_URI)) + } + *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) + if *(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+24756, libc.VaList(bp+8, zVfs)) + rc = int32(SQLITE_ERROR) + } +parse_uri_out: + ; + if rc != SQLITE_OK { + Xsqlite3_free_filename(tls, zFile) + zFile = uintptr(0) + } + *(*uint32)(unsafe.Pointer(pFlags)) = flags + *(*uintptr)(unsafe.Pointer(pzFile)) = zFile + return rc +} + +var _aCacheMode = [3]struct { + Fz uintptr + Fmode int32 +}{ + 0: { + Fz: __ccgo_ts + 24682, + Fmode: int32(SQLITE_OPEN_SHAREDCACHE), + }, + 1: { + Fz: __ccgo_ts + 24689, + Fmode: int32(SQLITE_OPEN_PRIVATECACHE), + }, + 2: {}, +} + +var _aOpenMode = [5]struct { + Fz uintptr + Fmode int32 +}{ + 0: { + Fz: __ccgo_ts + 24702, + Fmode: int32(SQLITE_OPEN_READONLY), + }, + 1: { + Fz: __ccgo_ts + 24705, + Fmode: int32(SQLITE_OPEN_READWRITE), + }, + 2: { + Fz: __ccgo_ts + 24708, + Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), + }, + 3: { + Fz: __ccgo_ts + 17796, + Fmode: int32(SQLITE_OPEN_MEMORY), + }, + 4: {}, +} + +// C documentation +// +// /* +// ** This routine does the core work of extracting URI parameters from a +// ** database filename for the sqlite3_uri_parameter() interface. +// */ +func _uriParameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) (r uintptr) { + var x int32 + _ = x + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + for zFilename != uintptr(0) && *(*int8)(unsafe.Pointer(zFilename)) != 0 { + x = libc.Xstrcmp(tls, zFilename, zParam) + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + if x == 0 { + return zFilename + } + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + } + return uintptr(0) +} + +// C documentation +// +// /* +// ** This routine does the work of opening a database on behalf of +// ** sqlite3_open() and sqlite3_open16(). The database filename "zFilename" +// ** is UTF-8 encoded. +// */ +func _openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, _flags uint32, zVfs uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + *(*uint32)(unsafe.Pointer(bp)) = _flags + var db, v2 uintptr + var i, isThreadsafe, rc int32 + var v1 uint32 + var _ /* zErrMsg at bp+16 */ uintptr + var _ /* zOpen at bp+8 */ uintptr + _, _, _, _, _, _ = db, i, isThreadsafe, rc, v1, v2 /* True for threadsafe connections */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Filename argument to pass to BtreeOpen() */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) /* Loop counter */ + *(*uintptr)(unsafe.Pointer(ppDb)) = uintptr(0) + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + if int32(_sqlite3Config.FbCoreMutex) == 0 { + isThreadsafe = 0 + } else { + if *(*uint32)(unsafe.Pointer(bp))&uint32(SQLITE_OPEN_NOMUTEX) != 0 { + isThreadsafe = 0 + } else { + if *(*uint32)(unsafe.Pointer(bp))&uint32(SQLITE_OPEN_FULLMUTEX) != 0 { + isThreadsafe = int32(1) + } else { + isThreadsafe = int32(_sqlite3Config.FbFullMutex) + } + } + } + if *(*uint32)(unsafe.Pointer(bp))&uint32(SQLITE_OPEN_PRIVATECACHE) != 0 { + *(*uint32)(unsafe.Pointer(bp)) &= uint32(^libc.Int32FromInt32(SQLITE_OPEN_SHAREDCACHE)) + } else { + if _sqlite3Config.FsharedCacheEnabled != 0 { + *(*uint32)(unsafe.Pointer(bp)) |= uint32(SQLITE_OPEN_SHAREDCACHE) + } + } + /* Remove harmful bits from the flags parameter + ** + ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were + ** dealt with in the previous code block. Besides these, the only + ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY, + ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, + ** SQLITE_OPEN_PRIVATECACHE, SQLITE_OPEN_EXRESCODE, and some reserved + ** bits. Silently mask off all other flags. + */ + *(*uint32)(unsafe.Pointer(bp)) &= uint32(^(libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_MAIN_DB) | libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_TRANSIENT_DB) | libc.Int32FromInt32(SQLITE_OPEN_MAIN_JOURNAL) | libc.Int32FromInt32(SQLITE_OPEN_TEMP_JOURNAL) | libc.Int32FromInt32(SQLITE_OPEN_SUBJOURNAL) | libc.Int32FromInt32(SQLITE_OPEN_SUPER_JOURNAL) | libc.Int32FromInt32(SQLITE_OPEN_NOMUTEX) | libc.Int32FromInt32(SQLITE_OPEN_FULLMUTEX) | libc.Int32FromInt32(SQLITE_OPEN_WAL))) + /* Allocate the sqlite data structure */ + db = _sqlite3MallocZero(tls, uint64(856)) + if db == uintptr(0) { + goto opendb_out + } + if isThreadsafe != 0 { + (*Tsqlite3)(unsafe.Pointer(db)).Fmutex = _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_RECURSIVE)) + if (*Tsqlite3)(unsafe.Pointer(db)).Fmutex == uintptr(0) { + Xsqlite3_free(tls, db) + db = uintptr(0) + goto opendb_out + } + if isThreadsafe == 0 { + } + } + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if *(*uint32)(unsafe.Pointer(bp))&uint32(SQLITE_OPEN_EXRESCODE) != uint32(0) { + v1 = uint32(0xffffffff) + } else { + v1 = uint32(0xff) + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrMask = int32(v1) + (*Tsqlite3)(unsafe.Pointer(db)).FnDb = int32(2) + (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_BUSY) + (*Tsqlite3)(unsafe.Pointer(db)).FaDb = db + 696 + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = uint32(1) + (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) + libc.Xmemcpy(tls, db+136, uintptr(unsafe.Pointer(&_aHardLimit)), uint64(48)) + *(*int32)(unsafe.Pointer(db + 136 + 11*4)) = SQLITE_DEFAULT_WORKER_THREADS + (*Tsqlite3)(unsafe.Pointer(db)).FautoCommit = uint8(1) + (*Tsqlite3)(unsafe.Pointer(db)).FnextAutovac = int8(-int32(1)) + (*Tsqlite3)(unsafe.Pointer(db)).FszMmap = _sqlite3Config.FszMmap + (*Tsqlite3)(unsafe.Pointer(db)).FnextPagesize = 0 + (*Tsqlite3)(unsafe.Pointer(db)).Finit1.FazInit = uintptr(unsafe.Pointer(&_sqlite3StdType)) /* Any array of string ptrs will do */ + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(uint32(libc.Int32FromInt32(SQLITE_ShortColNames)|libc.Int32FromInt32(SQLITE_EnableTrigger)) | libc.Uint32FromUint32(SQLITE_EnableView) | libc.Uint32FromInt32(SQLITE_CacheSpill) | libc.Uint32FromInt32(SQLITE_TrustedSchema) | libc.Uint32FromInt32(SQLITE_DqsDML) | libc.Uint32FromInt32(SQLITE_DqsDDL) | libc.Uint32FromInt32(SQLITE_AutoIndex)) + _sqlite3HashInit(tls, db+648) + _sqlite3HashInit(tls, db+576) + /* Add the default collation sequence BINARY. BINARY works for both UTF-8 + ** and UTF-16, so add a version for each to avoid any unnecessary + ** conversions. The only error that can occur here is a malloc() failure. + ** + ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating + ** functions: + */ + _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) + _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) + _createCollation(tls, db, uintptr(unsafe.Pointer(&_sqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), __ccgo_fp(_binCollFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+22383, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_nocaseCollatingFunc), uintptr(0)) + _createCollation(tls, db, __ccgo_ts+24772, uint8(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rtrimCollFunc), uintptr(0)) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto opendb_out + } + /* Parse the filename/URI argument + ** + ** Only allow sensible combinations of bits in the flags argument. + ** Throw an error if any non-sense combination is used. If we + ** do not block illegal combinations here, it could trigger + ** assert() statements in deeper layers. Sensible combinations + ** are: + ** + ** 1: SQLITE_OPEN_READONLY + ** 2: SQLITE_OPEN_READWRITE + ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE + */ + (*Tsqlite3)(unsafe.Pointer(db)).FopenFlags = *(*uint32)(unsafe.Pointer(bp)) + /* READONLY */ + /* READWRITE */ + /* READWRITE | CREATE */ + if int32(1)<<(*(*uint32)(unsafe.Pointer(bp))&uint32(7))&int32(0x46) == 0 { + rc = _sqlite3MisuseError(tls, int32(181803)) /* IMP: R-18321-05872 */ + } else { + rc = _sqlite3ParseUri(tls, zVfs, zFilename, bp, db, bp+8, bp+16) + } + if rc != SQLITE_OK { + if rc == int32(SQLITE_NOMEM) { + _sqlite3OomFault(tls, db) + } + if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { + v2 = __ccgo_ts + 3827 + } else { + v2 = uintptr(0) + } + _sqlite3ErrorWithMsg(tls, db, rc, v2, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 16)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + goto opendb_out + } + /* Open the backend database driver */ + rc = _sqlite3BtreeOpen(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer(bp + 8)), db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb+8, 0, int32(*(*uint32)(unsafe.Pointer(bp))|uint32(SQLITE_OPEN_MAIN_DB))) + if rc != SQLITE_OK { + if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 { + v2 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*16 + } else { + v2 = uintptr(0) + } + pCol = v2 + } else { + pTab = uintptr(0) + goto error_out + } + } + } + /* The following block stores the meta information that will be returned + ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey + ** and autoinc. At this point there are two possibilities: + ** + ** 1. The specified column name was rowid", "oid" or "_rowid_" + ** and there is no explicitly declared IPK column. + ** + ** 2. The table is not a view and the column name identified an + ** explicitly declared column. Copy meta information from *pCol. + */ + if pCol != 0 { + zDataType = _sqlite3ColumnType(tls, pCol, uintptr(0)) + zCollSeq = _sqlite3ColumnColl(tls, pCol) + notnull = libc.BoolInt32(int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 8))&0xf>>0)) != 0) + primarykey = libc.BoolInt32(int32((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0) + autoinc = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) == iCol && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != uint32(0)) + } else { + zDataType = __ccgo_ts + 1168 + primarykey = int32(1) + } + if !(zCollSeq != 0) { + zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) + } +error_out: + ; + _sqlite3BtreeLeaveAll(tls, db) + /* Whether the function call succeeded or failed, set the output parameters + ** to whatever their local counterparts contain. If an error did occur, + ** this has the effect of zeroing all output parameters. + */ + if pzDataType != 0 { + *(*uintptr)(unsafe.Pointer(pzDataType)) = zDataType + } + if pzCollSeq != 0 { + *(*uintptr)(unsafe.Pointer(pzCollSeq)) = zCollSeq + } + if pNotNull != 0 { + *(*int32)(unsafe.Pointer(pNotNull)) = notnull + } + if pPrimaryKey != 0 { + *(*int32)(unsafe.Pointer(pPrimaryKey)) = primarykey + } + if pAutoinc != 0 { + *(*int32)(unsafe.Pointer(pAutoinc)) = autoinc + } + if SQLITE_OK == rc && !(pTab != 0) { + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+24850, libc.VaList(bp+16, zTableName, zColumnName)) + rc = int32(SQLITE_ERROR) + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v3 = __ccgo_ts + 3827 + } else { + v3 = uintptr(0) + } + _sqlite3ErrorWithMsg(tls, db, rc, v3, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp)))) + _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp))) + rc = _sqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Sleep for a little while. Return the amount of time slept. +// */ +func Xsqlite3_sleep(tls *libc.TLS, ms int32) (r int32) { + var pVfs uintptr + var rc, v1 int32 + _, _, _ = pVfs, rc, v1 + pVfs = Xsqlite3_vfs_find(tls, uintptr(0)) + if pVfs == uintptr(0) { + return 0 + } + /* This function works in milliseconds, but the underlying OsSleep() + ** API uses microseconds. Hence the 1000's. + */ + if ms < 0 { + v1 = 0 + } else { + v1 = int32(1000) * ms + } + rc = _sqlite3OsSleep(tls, pVfs, v1) / int32(1000) + return rc +} + +// C documentation +// +// /* +// ** Enable or disable the extended result codes. +// */ +func Xsqlite3_extended_result_codes(tls *libc.TLS, db uintptr, onoff int32) (r int32) { + var v1 uint32 + _ = v1 + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if onoff != 0 { + v1 = uint32(0xffffffff) + } else { + v1 = uint32(0xff) + } + (*Tsqlite3)(unsafe.Pointer(db)).FerrMask = int32(v1) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Invoke the xFileControl method on a particular database. +// */ +func Xsqlite3_file_control(tls *libc.TLS, db uintptr, zDbName uintptr, op int32, pArg uintptr) (r int32) { + var fd, pBtree, pPager uintptr + var iNew, nSave, rc int32 + _, _, _, _, _, _ = fd, iNew, nSave, pBtree, pPager, rc + rc = int32(SQLITE_ERROR) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + pBtree = _sqlite3DbNameToBtree(tls, db, zDbName) + if pBtree != 0 { + _sqlite3BtreeEnter(tls, pBtree) + pPager = _sqlite3BtreePager(tls, pBtree) + fd = _sqlite3PagerFile(tls, pPager) + if op == int32(SQLITE_FCNTL_FILE_POINTER) { + *(*uintptr)(unsafe.Pointer(pArg)) = fd + rc = SQLITE_OK + } else { + if op == int32(SQLITE_FCNTL_VFS_POINTER) { + *(*uintptr)(unsafe.Pointer(pArg)) = _sqlite3PagerVfs(tls, pPager) + rc = SQLITE_OK + } else { + if op == int32(SQLITE_FCNTL_JOURNAL_POINTER) { + *(*uintptr)(unsafe.Pointer(pArg)) = _sqlite3PagerJrnlFile(tls, pPager) + rc = SQLITE_OK + } else { + if op == int32(SQLITE_FCNTL_DATA_VERSION) { + *(*uint32)(unsafe.Pointer(pArg)) = _sqlite3PagerDataVersion(tls, pPager) + rc = SQLITE_OK + } else { + if op == int32(SQLITE_FCNTL_RESERVE_BYTES) { + iNew = *(*int32)(unsafe.Pointer(pArg)) + *(*int32)(unsafe.Pointer(pArg)) = _sqlite3BtreeGetRequestedReserve(tls, pBtree) + if iNew >= 0 && iNew <= int32(255) { + _sqlite3BtreeSetPageSize(tls, pBtree, 0, iNew, 0) + } + rc = SQLITE_OK + } else { + if op == int32(SQLITE_FCNTL_RESET_CACHE) { + _sqlite3BtreeClearCache(tls, pBtree) + rc = SQLITE_OK + } else { + nSave = (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy + rc = _sqlite3OsFileControl(tls, fd, op, pArg) + (*Tsqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = nSave + } + } + } + } + } + } + _sqlite3BtreeLeave(tls, pBtree) + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Interface to the testing logic. +// */ +func Xsqlite3_test_control(tls *libc.TLS, op int32, va uintptr) (r int32) { + var aProg, db, db1, db2, db3, db4, db5, db6, pCtx, pI1, pI2, pU64, pn, ptr, xBenignBegin, xBenignEnd uintptr + var ap Tva_list + var b, b1, iDb, opTrace, rc, sz, x, x1, x2, y, v1, v3 int32 + var newVal uint32 + var rIn float64 + var rLogEst TLogEst + var v2 bool + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aProg, ap, b, b1, db, db1, db2, db3, db4, db5, db6, iDb, newVal, opTrace, pCtx, pI1, pI2, pU64, pn, ptr, rIn, rLogEst, rc, sz, x, x1, x2, xBenignBegin, xBenignEnd, y, v1, v2, v3 + rc = 0 + ap = va + switch op { + /* + ** Save the current state of the PRNG. + */ + case int32(SQLITE_TESTCTRL_PRNG_SAVE): + _sqlite3PrngSaveState(tls) + break + /* + ** Restore the state of the PRNG to the last state saved using + ** PRNG_SAVE. If PRNG_SAVE has never before been called, then + ** this verb acts like PRNG_RESET. + */ + fallthrough + case int32(SQLITE_TESTCTRL_PRNG_RESTORE): + _sqlite3PrngRestoreState(tls) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, int x, sqlite3 *db); + ** + ** Control the seed for the pseudo-random number generator (PRNG) that + ** is built into SQLite. Cases: + ** + ** x!=0 && db!=0 Seed the PRNG to the current value of the + ** schema cookie in the main database for db, or + ** x if the schema cookie is zero. This case + ** is convenient to use with database fuzzers + ** as it allows the fuzzer some control over the + ** the PRNG seed. + ** + ** x!=0 && db==0 Seed the PRNG to the value of x. + ** + ** x==0 && db==0 Revert to default behavior of using the + ** xRandomness method on the primary VFS. + ** + ** This test-control also resets the PRNG so that the new seed will + ** be used for the next call to sqlite3_randomness(). + */ + fallthrough + case int32(SQLITE_TESTCTRL_PRNG_SEED): + x = libc.VaInt32(&ap) + db = libc.VaUintptr(&ap) + if v2 = db != 0; v2 { + v1 = (*TSchema)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)).Fschema_cookie + y = v1 + } + if v2 && v1 != 0 { + x = y + } + _sqlite3Config.FiPrngSeed = uint32(x) + Xsqlite3_randomness(tls, 0, uintptr(0)) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_FK_NO_ACTION, sqlite3 *db, int b); + ** + ** If b is true, then activate the SQLITE_FkNoAction setting. If b is + ** false then clearn that setting. If the SQLITE_FkNoAction setting is + ** abled, all foreign key ON DELETE and ON UPDATE actions behave as if + ** they were NO ACTION, regardless of how they are defined. + ** + ** NB: One must usually run "PRAGMA writable_schema=RESET" after + ** using this test-control, before it will take full effect. failing + ** to reset the schema can result in some unexpected behavior. + */ + fallthrough + case int32(SQLITE_TESTCTRL_FK_NO_ACTION): + db1 = libc.VaUintptr(&ap) + b = libc.VaInt32(&ap) + if b != 0 { + *(*Tu64)(unsafe.Pointer(db1 + 48)) |= uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32) + } else { + *(*Tu64)(unsafe.Pointer(db1 + 48)) &= ^(uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32)) + } + break + /* + ** sqlite3_test_control(BITVEC_TEST, size, program) + ** + ** Run a test against a Bitvec object of size. The program argument + ** is an array of integers that defines the test. Return -1 on a + ** memory allocation error, 0 on success, or non-zero for an error. + ** See the sqlite3BitvecBuiltinTest() for additional information. + */ + fallthrough + case int32(SQLITE_TESTCTRL_BITVEC_TEST): + sz = libc.VaInt32(&ap) + aProg = libc.VaUintptr(&ap) + rc = _sqlite3BitvecBuiltinTest(tls, sz, aProg) + break + /* + ** sqlite3_test_control(FAULT_INSTALL, xCallback) + ** + ** Arrange to invoke xCallback() whenever sqlite3FaultSim() is called, + ** if xCallback is not NULL. + ** + ** As a test of the fault simulator mechanism itself, sqlite3FaultSim(0) + ** is called immediately after installing the new callback and the return + ** value from sqlite3FaultSim(0) becomes the return from + ** sqlite3_test_control(). + */ + fallthrough + case int32(SQLITE_TESTCTRL_FAULT_INSTALL): + _sqlite3Config.FxTestCallback = libc.VaUintptr(&ap) + rc = _sqlite3FaultSim(tls, 0) + break + /* + ** sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd) + ** + ** Register hooks to call to indicate which malloc() failures + ** are benign. + */ + fallthrough + case int32(SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS): + xBenignBegin = libc.VaUintptr(&ap) + xBenignEnd = libc.VaUintptr(&ap) + _sqlite3BenignMallocHooks(tls, xBenignBegin, xBenignEnd) + break + /* + ** sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X) + ** + ** Set the PENDING byte to the value in the argument, if X>0. + ** Make no changes if X==0. Return the value of the pending byte + ** as it existing before this routine was called. + ** + ** IMPORTANT: Changing the PENDING byte from 0x40000000 results in + ** an incompatible database file format. Changing the PENDING byte + ** while any database connection is open results in undefined and + ** deleterious behavior. + */ + fallthrough + case int32(SQLITE_TESTCTRL_PENDING_BYTE): + rc = _sqlite3PendingByte + newVal = libc.VaUint32(&ap) + if newVal != 0 { + _sqlite3PendingByte = int32(newVal) + } + break + /* + ** sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X) + ** + ** This action provides a run-time test to see whether or not + ** assert() was enabled at compile-time. If X is true and assert() + ** is enabled, then the return value is true. If X is true and + ** assert() is disabled, then the return value is zero. If X is + ** false and assert() is enabled, then the assertion fires and the + ** process aborts. If X is false and assert() is disabled, then the + ** return value is zero. + */ + fallthrough + case int32(SQLITE_TESTCTRL_ASSERT): + x1 = 0 + rc = x1 + break + /* + ** sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X) + ** + ** This action provides a run-time test to see how the ALWAYS and + ** NEVER macros were defined at compile-time. + ** + ** The return value is ALWAYS(X) if X is true, or 0 if X is false. + ** + ** The recommended test is X==2. If the return value is 2, that means + ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the + ** default setting. If the return value is 1, then ALWAYS() is either + ** hard-coded to true or else it asserts if its argument is false. + ** The first behavior (hard-coded to true) is the case if + ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second + ** behavior (assert if the argument to ALWAYS() is false) is the case if + ** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled. + ** + ** The run-time test procedure might look something like this: + ** + ** if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){ + ** // ALWAYS() and NEVER() are no-op pass-through macros + ** }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){ + ** // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false. + ** }else{ + ** // ALWAYS(x) is a constant 1. NEVER(x) is a constant 0. + ** } + */ + fallthrough + case int32(SQLITE_TESTCTRL_ALWAYS): + x2 = libc.VaInt32(&ap) + if x2 != 0 { + v3 = x2 + } else { + v3 = 0 + } + rc = v3 + break + /* + ** sqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER); + ** + ** The integer returned reveals the byte-order of the computer on which + ** SQLite is running: + ** + ** 1 big-endian, determined at run-time + ** 10 little-endian, determined at run-time + ** 432101 big-endian, determined at compile-time + ** 123410 little-endian, determined at compile-time + */ + fallthrough + case int32(SQLITE_TESTCTRL_BYTEORDER): + rc = libc.Int32FromInt32(SQLITE_BYTEORDER)*libc.Int32FromInt32(100) + libc.Int32FromInt32(SQLITE_LITTLEENDIAN)*libc.Int32FromInt32(10) + libc.Int32FromInt32(SQLITE_BIGENDIAN) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N) + ** + ** Enable or disable various optimizations for testing purposes. The + ** argument N is a bitmask of optimizations to be disabled. For normal + ** operation N should be 0. The idea is that a test program (like the + ** SQL Logic Test or SLT test module) can run the same SQL multiple times + ** with various optimizations disabled to verify that the same answer + ** is obtained in every case. + */ + fallthrough + case int32(SQLITE_TESTCTRL_OPTIMIZATIONS): + db2 = libc.VaUintptr(&ap) + (*Tsqlite3)(unsafe.Pointer(db2)).FdbOptFlags = libc.VaUint32(&ap) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, onoff, xAlt); + ** + ** If parameter onoff is 1, subsequent calls to localtime() fail. + ** If 2, then invoke xAlt() instead of localtime(). If 0, normal + ** processing. + ** + ** xAlt arguments are void pointers, but they really want to be: + ** + ** int xAlt(const time_t*, struct tm*); + ** + ** xAlt should write results in to struct tm object of its 2nd argument + ** and return zero on success, or return non-zero on failure. + */ + fallthrough + case int32(SQLITE_TESTCTRL_LOCALTIME_FAULT): + _sqlite3Config.FbLocaltimeFault = libc.VaInt32(&ap) + if _sqlite3Config.FbLocaltimeFault == int32(2) { + _sqlite3Config.FxAltLocaltime = libc.VaUintptr(&ap) + } else { + _sqlite3Config.FxAltLocaltime = uintptr(0) + } + break + /* sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, sqlite3*); + ** + ** Toggle the ability to use internal functions on or off for + ** the database connection given in the argument. + */ + fallthrough + case int32(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS): + db3 = libc.VaUintptr(&ap) + *(*Tu32)(unsafe.Pointer(db3 + 44)) ^= uint32(DBFLAG_InternalFunc) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); + ** + ** Set or clear a flag that indicates that the database file is always well- + ** formed and never corrupt. This flag is clear by default, indicating that + ** database files might have arbitrary corruption. Setting the flag during + ** testing causes certain assert() statements in the code to be activated + ** that demonstrate invariants on well-formed database files. + */ + fallthrough + case int32(SQLITE_TESTCTRL_NEVER_CORRUPT): + _sqlite3Config.FneverCorrupt = libc.VaInt32(&ap) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int); + ** + ** Set or clear a flag that causes SQLite to verify that type, name, + ** and tbl_name fields of the sqlite_schema table. This is normally + ** on, but it is sometimes useful to turn it off for testing. + ** + ** 2020-07-22: Disabling EXTRA_SCHEMA_CHECKS also disables the + ** verification of rootpage numbers when parsing the schema. This + ** is useful to make it easier to reach strange internal error states + ** during testing. The EXTRA_SCHEMA_CHECKS setting is always enabled + ** in production. + */ + fallthrough + case int32(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS): + _sqlite3Config.FbExtraSchemaChecks = uint8(libc.VaInt32(&ap)) + break + /* Set the threshold at which OP_Once counters reset back to zero. + ** By default this is 0x7ffffffe (over 2 billion), but that value is + ** too big to test in a reasonable amount of time, so this control is + ** provided to set a small and easily reachable reset value. + */ + fallthrough + case int32(SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD): + _sqlite3Config.FiOnceResetThreshold = libc.VaInt32(&ap) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr); + ** + ** Set the VDBE coverage callback function to xCallback with context + ** pointer ptr. + */ + fallthrough + case int32(SQLITE_TESTCTRL_VDBE_COVERAGE): + break + /* sqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); */ + fallthrough + case int32(SQLITE_TESTCTRL_SORTER_MMAP): + db4 = libc.VaUintptr(&ap) + (*Tsqlite3)(unsafe.Pointer(db4)).FnMaxSorterMmap = libc.VaInt32(&ap) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_ISINIT); + ** + ** Return SQLITE_OK if SQLite has been initialized and SQLITE_ERROR if + ** not. + */ + fallthrough + case int32(SQLITE_TESTCTRL_ISINIT): + if _sqlite3Config.FisInit == 0 { + rc = int32(SQLITE_ERROR) + } + break + /* sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum); + ** + ** This test control is used to create imposter tables. "db" is a pointer + ** to the database connection. dbName is the database name (ex: "main" or + ** "temp") which will receive the imposter. "onOff" turns imposter mode on + ** or off. "tnum" is the root page of the b-tree to which the imposter + ** table should connect. + ** + ** Enable imposter mode only when the schema has already been parsed. Then + ** run a single CREATE TABLE statement to construct the imposter table in + ** the parsed schema. Then turn imposter mode back off again. + ** + ** If onOff==0 and tnum>0 then reset the schema for all databases, causing + ** the schema to be reparsed the next time it is needed. This has the + ** effect of erasing all imposter tables. + */ + fallthrough + case int32(SQLITE_TESTCTRL_IMPOSTER): + db5 = libc.VaUintptr(&ap) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db5)).Fmutex) + iDb = _sqlite3FindDbName(tls, db5, libc.VaUintptr(&ap)) + if iDb >= 0 { + (*Tsqlite3)(unsafe.Pointer(db5)).Finit1.FiDb = uint8(iDb) + (*Tsqlite3)(unsafe.Pointer(db5)).Finit1.Fbusy = uint8(libc.AssignBitFieldPtr8Uint32(db5+192+8, uint32(libc.VaInt32(&ap)), 1, 1, 0x2)) + (*Tsqlite3)(unsafe.Pointer(db5)).Finit1.FnewTnum = uint32(libc.VaInt32(&ap)) + if int32((*Tsqlite3)(unsafe.Pointer(db5)).Finit1.Fbusy) == 0 && (*Tsqlite3)(unsafe.Pointer(db5)).Finit1.FnewTnum > uint32(0) { + _sqlite3ResetAllSchemasOfConnection(tls, db5) + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db5)).Fmutex) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, sqlite3_context*); + ** + ** This test-control causes the most recent sqlite3_result_int64() value + ** to be interpreted as a MEM_IntReal instead of as an MEM_Int. Normally, + ** MEM_IntReal values only arise during an INSERT operation of integer + ** values into a REAL column, so they can be challenging to test. This + ** test-control enables us to write an intreal() SQL function that can + ** inject an intreal() value at arbitrary places in an SQL statement, + ** for testing purposes. + */ + fallthrough + case int32(SQLITE_TESTCTRL_RESULT_INTREAL): + pCtx = libc.VaUintptr(&ap) + _sqlite3ResultIntReal(tls, pCtx) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT, + ** sqlite3 *db, // Database connection + ** u64 *pnSeek // Write seek count here + ** ); + ** + ** This test-control queries the seek-counter on the "main" database + ** file. The seek-counter is written into *pnSeek and is then reset. + ** The seek-count is only available if compiled with SQLITE_DEBUG. + */ + fallthrough + case int32(SQLITE_TESTCTRL_SEEK_COUNT): + db6 = libc.VaUintptr(&ap) + pn = libc.VaUintptr(&ap) + *(*Tu64)(unsafe.Pointer(pn)) = uint64(0) + _ = db6 /* Silence harmless unused variable warning */ + break + /* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr) + ** + ** "ptr" is a pointer to a u32. + ** + ** op==0 Store the current sqlite3TreeTrace in *ptr + ** op==1 Set sqlite3TreeTrace to the value *ptr + ** op==2 Store the current sqlite3WhereTrace in *ptr + ** op==3 Set sqlite3WhereTrace to the value *ptr + */ + fallthrough + case int32(SQLITE_TESTCTRL_TRACEFLAGS): + opTrace = libc.VaInt32(&ap) + ptr = libc.VaUintptr(&ap) + switch opTrace { + case 0: + *(*Tu32)(unsafe.Pointer(ptr)) = _sqlite3TreeTrace + case int32(1): + _sqlite3TreeTrace = *(*Tu32)(unsafe.Pointer(ptr)) + case int32(2): + *(*Tu32)(unsafe.Pointer(ptr)) = _sqlite3WhereTrace + case int32(3): + _sqlite3WhereTrace = *(*Tu32)(unsafe.Pointer(ptr)) + break + } + break + /* sqlite3_test_control(SQLITE_TESTCTRL_LOGEST, + ** double fIn, // Input value + ** int *pLogEst, // sqlite3LogEstFromDouble(fIn) + ** u64 *pInt, // sqlite3LogEstToInt(*pLogEst) + ** int *pLogEst2 // sqlite3LogEst(*pInt) + ** ); + ** + ** Test access for the LogEst conversion routines. + */ + fallthrough + case int32(SQLITE_TESTCTRL_LOGEST): + rIn = libc.VaFloat64(&ap) + rLogEst = _sqlite3LogEstFromDouble(tls, rIn) + pI1 = libc.VaUintptr(&ap) + pU64 = libc.VaUintptr(&ap) + pI2 = libc.VaUintptr(&ap) + *(*int32)(unsafe.Pointer(pI1)) = int32(rLogEst) + *(*Tu64)(unsafe.Pointer(pU64)) = _sqlite3LogEstToInt(tls, rLogEst) + *(*int32)(unsafe.Pointer(pI2)) = int32(_sqlite3LogEst(tls, *(*Tu64)(unsafe.Pointer(pU64)))) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_USELONGDOUBLE, int X); + ** + ** X<0 Make no changes to the bUseLongDouble. Just report value. + ** X==0 Disable bUseLongDouble + ** X==1 Enable bUseLongDouble + ** X>=2 Set bUseLongDouble to its default value for this platform + */ + fallthrough + case int32(SQLITE_TESTCTRL_USELONGDOUBLE): + b1 = libc.VaInt32(&ap) + if b1 >= int32(2) { + b1 = _hasHighPrecisionDouble(tls, b1) + } + if b1 >= 0 { + _sqlite3Config.FbUseLongDouble = libc.BoolUint8(b1 > 0) + } + rc = libc.BoolInt32(int32(_sqlite3Config.FbUseLongDouble) != 0) + break + /* sqlite3_test_control(SQLITE_TESTCTRL_JSON_SELFCHECK, &onOff); + ** + ** Activate or deactivate validation of JSONB that is generated from + ** text. Off by default, as the validation is slow. Validation is + ** only available if compiled using SQLITE_DEBUG. + ** + ** If onOff is initially 1, then turn it on. If onOff is initially + ** off, turn it off. If onOff is initially -1, then change onOff + ** to be the current setting. + */ + fallthrough + case int32(SQLITE_TESTCTRL_JSON_SELFCHECK): + break + } + _ = ap + return rc +} + +// C documentation +// +// /* +// ** The Pager stores the Database filename, Journal filename, and WAL filename +// ** consecutively in memory, in that order. The database filename is prefixed +// ** by four zero bytes. Locate the start of the database filename by searching +// ** backwards for the first byte following four consecutive zero bytes. +// ** +// ** This only works if the filename passed in was obtained from the Pager. +// */ +func _databaseName(tls *libc.TLS, zName uintptr) (r uintptr) { + for int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(1))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(2))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(3))))) != 0 || int32(*(*int8)(unsafe.Pointer(zName + uintptr(-libc.Int32FromInt32(4))))) != 0 { + zName-- + } + return zName +} + +// C documentation +// +// /* +// ** Append text z[] to the end of p[]. Return a pointer to the first +// ** character after then zero terminator on the new text in p[]. +// */ +func _appendText(tls *libc.TLS, p uintptr, z uintptr) (r uintptr) { + var n Tsize_t + _ = n + n = libc.Xstrlen(tls, z) + libc.Xmemcpy(tls, p, z, n+uint64(1)) + return p + uintptr(n) + uintptr(1) +} + +// C documentation +// +// /* +// ** Allocate memory to hold names for a database, journal file, WAL file, +// ** and query parameters. The pointer returned is valid for use by +// ** sqlite3_filename_database() and sqlite3_uri_parameter() and related +// ** functions. +// ** +// ** Memory layout must be compatible with that generated by the pager +// ** and expected by sqlite3_uri_parameter() and databaseName(). +// */ +func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr, zWal uintptr, nParam int32, azParam uintptr) (r uintptr) { + var i int32 + var nByte Tsqlite3_int64 + var p, pResult, v2, v4, v5, v6 uintptr + _, _, _, _, _, _, _, _ = i, nByte, p, pResult, v2, v4, v5, v6 + nByte = int64(libc.Xstrlen(tls, zDatabase) + libc.Xstrlen(tls, zJournal) + libc.Xstrlen(tls, zWal) + uint64(10)) + i = 0 + for { + if !(i < nParam*int32(2)) { + break + } + nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) + goto _1 + _1: + ; + i++ + } + v2 = Xsqlite3_malloc64(tls, uint64(nByte)) + p = v2 + pResult = v2 + if p == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, p, 0, uint64(4)) + p += uintptr(4) + p = _appendText(tls, p, zDatabase) + i = 0 + for { + if !(i < nParam*int32(2)) { + break + } + p = _appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + goto _3 + _3: + ; + i++ + } + v4 = p + p++ + *(*int8)(unsafe.Pointer(v4)) = 0 + p = _appendText(tls, p, zJournal) + p = _appendText(tls, p, zWal) + v5 = p + p++ + *(*int8)(unsafe.Pointer(v5)) = 0 + v6 = p + p++ + *(*int8)(unsafe.Pointer(v6)) = 0 + return pResult + uintptr(4) +} + +// C documentation +// +// /* +// ** Free memory obtained from sqlite3_create_filename(). It is a severe +// ** error to call this routine with any parameter other than a pointer +// ** previously obtained from sqlite3_create_filename() or a NULL pointer. +// */ +func Xsqlite3_free_filename(tls *libc.TLS, p uintptr) { + if p == uintptr(0) { + return + } + p = _databaseName(tls, p) + Xsqlite3_free(tls, p-uintptr(4)) +} + +// C documentation +// +// /* +// ** This is a utility routine, useful to VFS implementations, that checks +// ** to see if a database file was a URI that contained a specific query +// ** parameter, and if so obtains the value of the query parameter. +// ** +// ** The zFilename argument is the filename pointer passed into the xOpen() +// ** method of a VFS implementation. The zParam argument is the name of the +// ** query parameter we seek. This routine returns the value of the zParam +// ** parameter if it exists. If the parameter does not exist, this routine +// ** returns a NULL pointer. +// */ +func Xsqlite3_uri_parameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) (r uintptr) { + if zFilename == uintptr(0) || zParam == uintptr(0) { + return uintptr(0) + } + zFilename = _databaseName(tls, zFilename) + return _uriParameter(tls, zFilename, zParam) +} + +// C documentation +// +// /* +// ** Return a pointer to the name of Nth query parameter of the filename. +// */ +func Xsqlite3_uri_key(tls *libc.TLS, zFilename uintptr, N int32) (r uintptr) { + var v1 int32 + var v2 bool + var v3 uintptr + _, _, _ = v1, v2, v3 + if zFilename == uintptr(0) || N < 0 { + return uintptr(0) + } + zFilename = _databaseName(tls, zFilename) + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + for { + if v2 = zFilename != 0 && *(*int8)(unsafe.Pointer(zFilename)) != 0; v2 { + v1 = N + N-- + } + if !(v2 && v1 > 0) { + break + } + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + } + if *(*int8)(unsafe.Pointer(zFilename)) != 0 { + v3 = zFilename + } else { + v3 = uintptr(0) + } + return v3 +} + +// C documentation +// +// /* +// ** Return a boolean value for a query parameter. +// */ +func Xsqlite3_uri_boolean(tls *libc.TLS, zFilename uintptr, zParam uintptr, bDflt int32) (r int32) { + var z uintptr + var v1 int32 + _, _ = z, v1 + z = Xsqlite3_uri_parameter(tls, zFilename, zParam) + bDflt = libc.BoolInt32(bDflt != 0) + if z != 0 { + v1 = int32(_sqlite3GetBoolean(tls, z, uint8(bDflt))) + } else { + v1 = bDflt + } + return v1 +} + +// C documentation +// +// /* +// ** Return a 64-bit integer value for a query parameter. +// */ +func Xsqlite3_uri_int64(tls *libc.TLS, zFilename uintptr, zParam uintptr, bDflt Tsqlite3_int64) (r Tsqlite3_int64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var z uintptr + var _ /* v at bp+0 */ Tsqlite3_int64 + _ = z + z = Xsqlite3_uri_parameter(tls, zFilename, zParam) + if z != 0 && _sqlite3DecOrHexToI64(tls, z, bp) == 0 { + bDflt = *(*Tsqlite3_int64)(unsafe.Pointer(bp)) + } + return bDflt +} + +// C documentation +// +// /* +// ** Translate a filename that was handed to a VFS routine into the corresponding +// ** database, journal, or WAL file. +// ** +// ** It is an error to pass this routine a filename string that was not +// ** passed into the VFS from the SQLite core. Doing so is similar to +// ** passing free() a pointer that was not obtained from malloc() - it is +// ** an error that we cannot easily detect but that will likely cause memory +// ** corruption. +// */ +func Xsqlite3_filename_database(tls *libc.TLS, zFilename uintptr) (r uintptr) { + if zFilename == uintptr(0) { + return uintptr(0) + } + return _databaseName(tls, zFilename) +} + +func Xsqlite3_filename_journal(tls *libc.TLS, zFilename uintptr) (r uintptr) { + if zFilename == uintptr(0) { + return uintptr(0) + } + zFilename = _databaseName(tls, zFilename) + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + for zFilename != 0 && *(*int8)(unsafe.Pointer(zFilename)) != 0 { + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + } + return zFilename + uintptr(1) +} + +func Xsqlite3_filename_wal(tls *libc.TLS, zFilename uintptr) (r uintptr) { + zFilename = Xsqlite3_filename_journal(tls, zFilename) + if zFilename != 0 { + zFilename += uintptr(_sqlite3Strlen30(tls, zFilename) + int32(1)) + } + return zFilename +} + +// C documentation +// +// /* +// ** Return the Btree pointer identified by zDbName. Return NULL if not found. +// */ +func _sqlite3DbNameToBtree(tls *libc.TLS, db uintptr, zDbName uintptr) (r uintptr) { + var iDb, v1 int32 + var v2 uintptr + _, _, _ = iDb, v1, v2 + if zDbName != 0 { + v1 = _sqlite3FindDbName(tls, db, zDbName) + } else { + v1 = 0 + } + iDb = v1 + if iDb < 0 { + v2 = uintptr(0) + } else { + v2 = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + } + return v2 +} + +// C documentation +// +// /* +// ** Return the name of the N-th database schema. Return NULL if N is out +// ** of range. +// */ +func Xsqlite3_db_name(tls *libc.TLS, db uintptr, N int32) (r uintptr) { + if N < 0 || N >= (*Tsqlite3)(unsafe.Pointer(db)).FnDb { + return uintptr(0) + } else { + return (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(N)*32))).FzDbSName + } + return r +} + +// C documentation +// +// /* +// ** Return the filename of the database associated with a database +// ** connection. +// */ +func Xsqlite3_db_filename(tls *libc.TLS, db uintptr, zDbName uintptr) (r uintptr) { + var pBt, v1 uintptr + _, _ = pBt, v1 + pBt = _sqlite3DbNameToBtree(tls, db, zDbName) + if pBt != 0 { + v1 = _sqlite3BtreeGetFilename(tls, pBt) + } else { + v1 = uintptr(0) + } + return v1 +} + +// C documentation +// +// /* +// ** Return 1 if database is read-only or 0 if read/write. Return -1 if +// ** no such database exists. +// */ +func Xsqlite3_db_readonly(tls *libc.TLS, db uintptr, zDbName uintptr) (r int32) { + var pBt uintptr + var v1 int32 + _, _ = pBt, v1 + pBt = _sqlite3DbNameToBtree(tls, db, zDbName) + if pBt != 0 { + v1 = _sqlite3BtreeIsReadonly(tls, pBt) + } else { + v1 = -int32(1) + } + return v1 +} + +// C documentation +// +// /* +// ** Obtain a snapshot handle for the snapshot of database zDb currently +// ** being read by handle db. +// */ +func Xsqlite3_snapshot_get(tls *libc.TLS, db uintptr, zDb uintptr, ppSnapshot uintptr) (r int32) { + var iDb, rc int32 + var pBt uintptr + _, _, _ = iDb, pBt, rc + rc = int32(SQLITE_ERROR) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 { + iDb = _sqlite3FindDbName(tls, db, zDb) + if iDb == 0 || iDb > int32(1) { + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if int32(SQLITE_TXN_WRITE) != _sqlite3BtreeTxnState(tls, pBt) { + rc = _sqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if rc == SQLITE_OK { + rc = _sqlite3PagerSnapshotGet(tls, _sqlite3BtreePager(tls, pBt), ppSnapshot) + } + } + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Open a read-transaction on the snapshot identified by pSnapshot. +// */ +func Xsqlite3_snapshot_open(tls *libc.TLS, db uintptr, zDb uintptr, pSnapshot uintptr) (r int32) { + var bUnlock, iDb, rc int32 + var pBt, pPager uintptr + _, _, _, _, _ = bUnlock, iDb, pBt, pPager, rc + rc = int32(SQLITE_ERROR) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + if int32((*Tsqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 { + iDb = _sqlite3FindDbName(tls, db, zDb) + if iDb == 0 || iDb > int32(1) { + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if _sqlite3BtreeTxnState(tls, pBt) != int32(SQLITE_TXN_WRITE) { + pPager = _sqlite3BtreePager(tls, pBt) + bUnlock = 0 + if _sqlite3BtreeTxnState(tls, pBt) != SQLITE_TXN_NONE { + if (*Tsqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + rc = _sqlite3PagerSnapshotCheck(tls, pPager, pSnapshot) + if rc == SQLITE_OK { + bUnlock = int32(1) + rc = _sqlite3BtreeCommit(tls, pBt) + } + } + } else { + rc = SQLITE_OK + } + if rc == SQLITE_OK { + rc = _sqlite3PagerSnapshotOpen(tls, pPager, pSnapshot) + } + if rc == SQLITE_OK { + rc = _sqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + _sqlite3PagerSnapshotOpen(tls, pPager, uintptr(0)) + } + if bUnlock != 0 { + _sqlite3PagerSnapshotUnlock(tls, pPager) + } + } + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Recover as many snapshots as possible from the wal file associated with +// ** schema zDb of database db. +// */ +func Xsqlite3_snapshot_recover(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { + var iDb, rc int32 + var pBt uintptr + _, _, _ = iDb, pBt, rc + rc = int32(SQLITE_ERROR) + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + iDb = _sqlite3FindDbName(tls, db, zDb) + if iDb == 0 || iDb > int32(1) { + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FpBt + if SQLITE_TXN_NONE == _sqlite3BtreeTxnState(tls, pBt) { + rc = _sqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if rc == SQLITE_OK { + rc = _sqlite3PagerSnapshotRecover(tls, _sqlite3BtreePager(tls, pBt)) + _sqlite3BtreeCommit(tls, pBt) + } + } + } + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** Free a snapshot handle obtained from sqlite3_snapshot_get(). +// */ +func Xsqlite3_snapshot_free(tls *libc.TLS, pSnapshot uintptr) { + Xsqlite3_free(tls, pSnapshot) +} + +// C documentation +// +// /* +// ** Given the name of a compile-time option, return true if that option +// ** was used and false if not. +// ** +// ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix +// ** is not required for a match. +// */ +func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var azCompileOpt uintptr + var i, n int32 + var _ /* nOpt at bp+0 */ int32 + _, _, _ = azCompileOpt, i, n + azCompileOpt = _sqlite3CompileOptions(tls, bp) + if Xsqlite3_strnicmp(tls, zOptName, __ccgo_ts+24878, int32(7)) == 0 { + zOptName += uintptr(7) + } + n = _sqlite3Strlen30(tls, zOptName) + /* Since nOpt is normally in single digits, a linear search is + ** adequate. No need for a binary search. */ + i = 0 + for { + if !(i < *(*int32)(unsafe.Pointer(bp))) { + break + } + if Xsqlite3_strnicmp(tls, zOptName, *(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(i)*8)), n) == 0 && _sqlite3IsIdChar(tls, uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(i)*8)) + uintptr(n))))) == 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** Return the N-th compile-time option string. If N is out of range, +// ** return a NULL pointer. +// */ +func Xsqlite3_compileoption_get(tls *libc.TLS, N int32) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var azCompileOpt uintptr + var _ /* nOpt at bp+0 */ int32 + _ = azCompileOpt + azCompileOpt = _sqlite3CompileOptions(tls, bp) + if N >= 0 && N < *(*int32)(unsafe.Pointer(bp)) { + return *(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(N)*8)) + } + return uintptr(0) +} + +/************** End of main.c ************************************************/ +/************** Begin file notify.c ******************************************/ +/* +** 2009 March 3 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains the implementation of the sqlite3_unlock_notify() +** API method and its associated functionality. + */ +/* #include "sqliteInt.h" */ +/* #include "btreeInt.h" */ + +/* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */ + +/* +** Public interfaces: +** +** sqlite3ConnectionBlocked() +** sqlite3ConnectionUnlocked() +** sqlite3ConnectionClosed() +** sqlite3_unlock_notify() + */ + +// C documentation +// +// /* +// ** Head of a linked list of all sqlite3 objects created by this process +// ** for which either sqlite3.pBlockingConnection or sqlite3.pUnlockConnection +// ** is not NULL. This variable may only accessed while the STATIC_MAIN +// ** mutex is held. +// */ +var _sqlite3BlockedList = uintptr(0) + +// C documentation +// +// /* +// ** Remove connection db from the blocked connections list. If connection +// ** db is not currently a part of the list, this function is a no-op. +// */ +func _removeFromBlockedList(tls *libc.TLS, db uintptr) { + var pp uintptr + _ = pp + pp = uintptr(unsafe.Pointer(&_sqlite3BlockedList)) + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + if *(*uintptr)(unsafe.Pointer(pp)) == db { + *(*uintptr)(unsafe.Pointer(pp)) = (*Tsqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNextBlocked + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 + } +} + +// C documentation +// +// /* +// ** Add connection db to the blocked connections list. It is assumed +// ** that it is not already a part of the list. +// */ +func _addToBlockedList(tls *libc.TLS, db uintptr) { + var pp uintptr + _ = pp + pp = uintptr(unsafe.Pointer(&_sqlite3BlockedList)) + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0 && (*Tsqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FxUnlockNotify != (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 848 + } + (*Tsqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = db +} + +// C documentation +// +// /* +// ** Obtain the STATIC_MAIN mutex. +// */ +func _enterMutex(tls *libc.TLS) { + Xsqlite3_mutex_enter(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN))) +} + +// C documentation +// +// /* +// ** Release the STATIC_MAIN mutex. +// */ +func _leaveMutex(tls *libc.TLS) { + Xsqlite3_mutex_leave(tls, _sqlite3MutexAlloc(tls, int32(SQLITE_MUTEX_STATIC_MAIN))) +} + +// C documentation +// +// /* +// ** Register an unlock-notify callback. +// ** +// ** This is called after connection "db" has attempted some operation +// ** but has received an SQLITE_LOCKED error because another connection +// ** (call it pOther) in the same process was busy using the same shared +// ** cache. pOther is found by looking at db->pBlockingConnection. +// ** +// ** If there is no blocking connection, the callback is invoked immediately, +// ** before this routine returns. +// ** +// ** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate +// ** a deadlock. +// ** +// ** Otherwise, make arrangements to invoke xNotify when pOther drops +// ** its locks. +// ** +// ** Each call to this routine overrides any prior callbacks registered +// ** on the same "db". If xNotify==0 then any prior callbacks are immediately +// ** cancelled. +// */ +func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, _pArg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _pArg + var p, v2 uintptr + var rc int32 + _, _, _ = p, rc, v2 + rc = SQLITE_OK + Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + _enterMutex(tls) + if xNotify == uintptr(0) { + _removeFromBlockedList(tls, db) + (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = uintptr(0) + } else { + if uintptr(0) == (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection { + /* The blocking transaction has been concluded. Or there never was a + ** blocking transaction. In either case, invoke the notify callback + ** immediately. + */ + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xNotify})))(tls, bp, int32(1)) + } else { + p = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection + for { + if !(p != 0 && p != db) { + break + } + goto _1 + _1: + ; + p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection + } + if p != 0 { + rc = int32(SQLITE_LOCKED) /* Deadlock detected. */ + } else { + (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection + (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = xNotify + (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = *(*uintptr)(unsafe.Pointer(bp)) + _removeFromBlockedList(tls, db) + _addToBlockedList(tls, db) + } + } + } + _leaveMutex(tls) + if rc != 0 { + v2 = __ccgo_ts + 24886 + } else { + v2 = uintptr(0) + } + _sqlite3ErrorWithMsg(tls, db, rc, v2, 0) + Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// C documentation +// +// /* +// ** This function is called while stepping or preparing a statement +// ** associated with connection db. The operation will return SQLITE_LOCKED +// ** to the user because it requires a lock that will not be available +// ** until connection pBlocker concludes its current transaction. +// */ +func _sqlite3ConnectionBlocked(tls *libc.TLS, db uintptr, pBlocker uintptr) { + _enterMutex(tls) + if (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection == uintptr(0) { + _addToBlockedList(tls, db) + } + (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection = pBlocker + _leaveMutex(tls) +} + +// C documentation +// +// /* +// ** This function is called when +// ** the transaction opened by database db has just finished. Locks held +// ** by database connection db have been released. +// ** +// ** This function loops through each entry in the blocked connections +// ** list and does the following: +// ** +// ** 1) If the sqlite3.pBlockingConnection member of a list entry is +// ** set to db, then set pBlockingConnection=0. +// ** +// ** 2) If the sqlite3.pUnlockConnection member of a list entry is +// ** set to db, then invoke the configured unlock-notify callback and +// ** set pUnlockConnection=0. +// ** +// ** 3) If the two steps above mean that pBlockingConnection==0 and +// ** pUnlockConnection==0, remove the entry from the blocked connections +// ** list. +// */ +func _sqlite3ConnectionUnlocked(tls *libc.TLS, db uintptr) { + bp := tls.Alloc(128) + defer tls.Free(128) + var aArg, aDyn, p, pNew, pp, xUnlockNotify, v2 uintptr + var nArg, v3 int32 + var _ /* aStatic at bp+0 */ [16]uintptr + _, _, _, _, _, _, _, _, _ = aArg, aDyn, nArg, p, pNew, pp, xUnlockNotify, v2, v3 + xUnlockNotify = uintptr(0) /* Unlock-notify cb to invoke */ + nArg = 0 /* Arguments to the unlock callback */ + aDyn = uintptr(0) /* Starter space for aArg[]. No malloc required */ + aArg = bp + _enterMutex(tls) /* Enter STATIC_MAIN mutex */ + /* This loop runs once for each entry in the blocked-connections list. */ + pp = uintptr(unsafe.Pointer(&_sqlite3BlockedList)) + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + p = *(*uintptr)(unsafe.Pointer(pp)) + /* Step 1. */ + if (*Tsqlite3)(unsafe.Pointer(p)).FpBlockingConnection == db { + (*Tsqlite3)(unsafe.Pointer(p)).FpBlockingConnection = uintptr(0) + } + /* Step 2. */ + if (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection == db { + if (*Tsqlite3)(unsafe.Pointer(p)).FxUnlockNotify != xUnlockNotify && nArg != 0 { + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xUnlockNotify})))(tls, aArg, nArg) + nArg = 0 + } + _sqlite3BeginBenignMalloc(tls) + if !(aDyn != 0) && nArg == int32(libc.Uint64FromInt64(128)/libc.Uint64FromInt64(8)) || aDyn != 0 && nArg == int32(uint64(_sqlite3MallocSize(tls, aDyn))/libc.Uint64FromInt64(8)) { + /* The aArg[] array needs to grow. */ + pNew = _sqlite3Malloc(tls, uint64(nArg)*uint64(8)*uint64(2)) + if pNew != 0 { + libc.Xmemcpy(tls, pNew, aArg, uint64(nArg)*uint64(8)) + Xsqlite3_free(tls, aDyn) + v2 = pNew + aArg = v2 + aDyn = v2 + } else { + /* This occurs when the array of context pointers that need to + ** be passed to the unlock-notify callback is larger than the + ** aStatic[] array allocated on the stack and the attempt to + ** allocate a larger array from the heap has failed. + ** + ** This is a difficult situation to handle. Returning an error + ** code to the caller is insufficient, as even if an error code + ** is returned the transaction on connection db will still be + ** closed and the unlock-notify callbacks on blocked connections + ** will go unissued. This might cause the application to wait + ** indefinitely for an unlock-notify callback that will never + ** arrive. + ** + ** Instead, invoke the unlock-notify callback with the context + ** array already accumulated. We can then clear the array and + ** begin accumulating any further context pointers without + ** requiring any dynamic allocation. This is sub-optimal because + ** it means that instead of one callback with a large array of + ** context pointers the application will receive two or more + ** callbacks with smaller arrays of context pointers, which will + ** reduce the applications ability to prioritize multiple + ** connections. But it is the best that can be done under the + ** circumstances. + */ + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xUnlockNotify})))(tls, aArg, nArg) + nArg = 0 + } + } + _sqlite3EndBenignMalloc(tls) + v3 = nArg + nArg++ + *(*uintptr)(unsafe.Pointer(aArg + uintptr(v3)*8)) = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockArg + xUnlockNotify = (*Tsqlite3)(unsafe.Pointer(p)).FxUnlockNotify + (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(p)).FxUnlockNotify = uintptr(0) + (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockArg = uintptr(0) + } + /* Step 3. */ + if (*Tsqlite3)(unsafe.Pointer(p)).FpBlockingConnection == uintptr(0) && (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection == uintptr(0) { + /* Remove connection p from the blocked connections list. */ + *(*uintptr)(unsafe.Pointer(pp)) = (*Tsqlite3)(unsafe.Pointer(p)).FpNextBlocked + (*Tsqlite3)(unsafe.Pointer(p)).FpNextBlocked = uintptr(0) + } else { + pp = p + 848 + } + goto _1 + _1: + } + if nArg != 0 { + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xUnlockNotify})))(tls, aArg, nArg) + } + Xsqlite3_free(tls, aDyn) + _leaveMutex(tls) /* Leave STATIC_MAIN mutex */ +} + +// C documentation +// +// /* +// ** This is called when the database connection passed as an argument is +// ** being closed. The connection is removed from the blocked list. +// */ +func _sqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { + _sqlite3ConnectionUnlocked(tls, db) + _enterMutex(tls) + _removeFromBlockedList(tls, db) + _leaveMutex(tls) +} + +/************** End of notify.c **********************************************/ +/************** Begin file fts3.c ********************************************/ +/* +** 2006 Oct 10 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This is an SQLite module implementing full-text search. + */ + +/* +** The code in this file is only compiled if: +** +** * The FTS3 module is being built as an extension +** (in which case SQLITE_CORE is not defined), or +** +** * The FTS3 module is being built into the core of +** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + */ + +/* The full-text index is stored in a series of b+tree (-like) +** structures called segments which map terms to doclists. The +** structures are like b+trees in layout, but are constructed from the +** bottom up in optimal fashion and are not updatable. Since trees +** are built from the bottom up, things will be described from the +** bottom up. +** +** +**** Varints **** +** The basic unit of encoding is a variable-length integer called a +** varint. We encode variable-length integers in little-endian order +** using seven bits * per byte as follows: +** +** KEY: +** A = 0xxxxxxx 7 bits of data and one flag bit +** B = 1xxxxxxx 7 bits of data and one flag bit +** +** 7 bits - A +** 14 bits - BA +** 21 bits - BBA +** and so on. +** +** This is similar in concept to how sqlite encodes "varints" but +** the encoding is not the same. SQLite varints are big-endian +** are are limited to 9 bytes in length whereas FTS3 varints are +** little-endian and can be up to 10 bytes in length (in theory). +** +** Example encodings: +** +** 1: 0x01 +** 127: 0x7f +** 128: 0x81 0x00 +** +** +**** Document lists **** +** A doclist (document list) holds a docid-sorted list of hits for a +** given term. Doclists hold docids and associated token positions. +** A docid is the unique integer identifier for a single document. +** A position is the index of a word within the document. The first +** word of the document has a position of 0. +** +** FTS3 used to optionally store character offsets using a compile-time +** option. But that functionality is no longer supported. +** +** A doclist is stored like this: +** +** array { +** varint docid; (delta from previous doclist) +** array { (position list for column 0) +** varint position; (2 more than the delta from previous position) +** } +** array { +** varint POS_COLUMN; (marks start of position list for new column) +** varint column; (index of new column) +** array { +** varint position; (2 more than the delta from previous position) +** } +** } +** varint POS_END; (marks end of positions for this document. +** } +** +** Here, array { X } means zero or more occurrences of X, adjacent in +** memory. A "position" is an index of a token in the token stream +** generated by the tokenizer. Note that POS_END and POS_COLUMN occur +** in the same logical place as the position element, and act as sentinals +** ending a position list array. POS_END is 0. POS_COLUMN is 1. +** The positions numbers are not stored literally but rather as two more +** than the difference from the prior position, or the just the position plus +** 2 for the first position. Example: +** +** label: A B C D E F G H I J K +** value: 123 5 9 1 1 14 35 0 234 72 0 +** +** The 123 value is the first docid. For column zero in this document +** there are two matches at positions 3 and 10 (5-2 and 9-2+3). The 1 +** at D signals the start of a new column; the 1 at E indicates that the +** new column is column number 1. There are two positions at 12 and 45 +** (14-2 and 35-2+12). The 0 at H indicate the end-of-document. The +** 234 at I is the delta to next docid (357). It has one position 70 +** (72-2) and then terminates with the 0 at K. +** +** A "position-list" is the list of positions for multiple columns for +** a single docid. A "column-list" is the set of positions for a single +** column. Hence, a position-list consists of one or more column-lists, +** a document record consists of a docid followed by a position-list and +** a doclist consists of one or more document records. +** +** A bare doclist omits the position information, becoming an +** array of varint-encoded docids. +** +**** Segment leaf nodes **** +** Segment leaf nodes store terms and doclists, ordered by term. Leaf +** nodes are written using LeafWriter, and read using LeafReader (to +** iterate through a single leaf node's data) and LeavesReader (to +** iterate through a segment's entire leaf layer). Leaf nodes have +** the format: +** +** varint iHeight; (height from leaf level, always 0) +** varint nTerm; (length of first term) +** char pTerm[nTerm]; (content of first term) +** varint nDoclist; (length of term's associated doclist) +** char pDoclist[nDoclist]; (content of doclist) +** array { +** (further terms are delta-encoded) +** varint nPrefix; (length of prefix shared with previous term) +** varint nSuffix; (length of unshared suffix) +** char pTermSuffix[nSuffix];(unshared suffix of next term) +** varint nDoclist; (length of term's associated doclist) +** char pDoclist[nDoclist]; (content of doclist) +** } +** +** Here, array { X } means zero or more occurrences of X, adjacent in +** memory. +** +** Leaf nodes are broken into blocks which are stored contiguously in +** the %_segments table in sorted order. This means that when the end +** of a node is reached, the next term is in the node with the next +** greater node id. +** +** New data is spilled to a new leaf node when the current node +** exceeds LEAF_MAX bytes (default 2048). New data which itself is +** larger than STANDALONE_MIN (default 1024) is placed in a standalone +** node (a leaf node with a single term and doclist). The goal of +** these settings is to pack together groups of small doclists while +** making it efficient to directly access large doclists. The +** assumption is that large doclists represent terms which are more +** likely to be query targets. +** +** TODO(shess) It may be useful for blocking decisions to be more +** dynamic. For instance, it may make more sense to have a 2.5k leaf +** node rather than splitting into 2k and .5k nodes. My intuition is +** that this might extend through 2x or 4x the pagesize. +** +** +**** Segment interior nodes **** +** Segment interior nodes store blockids for subtree nodes and terms +** to describe what data is stored by the each subtree. Interior +** nodes are written using InteriorWriter, and read using +** InteriorReader. InteriorWriters are created as needed when +** SegmentWriter creates new leaf nodes, or when an interior node +** itself grows too big and must be split. The format of interior +** nodes: +** +** varint iHeight; (height from leaf level, always >0) +** varint iBlockid; (block id of node's leftmost subtree) +** optional { +** varint nTerm; (length of first term) +** char pTerm[nTerm]; (content of first term) +** array { +** (further terms are delta-encoded) +** varint nPrefix; (length of shared prefix with previous term) +** varint nSuffix; (length of unshared suffix) +** char pTermSuffix[nSuffix]; (unshared suffix of next term) +** } +** } +** +** Here, optional { X } means an optional element, while array { X } +** means zero or more occurrences of X, adjacent in memory. +** +** An interior node encodes n terms separating n+1 subtrees. The +** subtree blocks are contiguous, so only the first subtree's blockid +** is encoded. The subtree at iBlockid will contain all terms less +** than the first term encoded (or all terms if no term is encoded). +** Otherwise, for terms greater than or equal to pTerm[i] but less +** than pTerm[i+1], the subtree for that term will be rooted at +** iBlockid+i. Interior nodes only store enough term data to +** distinguish adjacent children (if the rightmost term of the left +** child is "something", and the leftmost term of the right child is +** "wicked", only "w" is stored). +** +** New data is spilled to a new interior node at the same height when +** the current node exceeds INTERIOR_MAX bytes (default 2048). +** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing +** interior nodes and making the tree too skinny. The interior nodes +** at a given height are naturally tracked by interior nodes at +** height+1, and so on. +** +** +**** Segment directory **** +** The segment directory in table %_segdir stores meta-information for +** merging and deleting segments, and also the root node of the +** segment's tree. +** +** The root node is the top node of the segment's tree after encoding +** the entire segment, restricted to ROOT_MAX bytes (default 1024). +** This could be either a leaf node or an interior node. If the top +** node requires more than ROOT_MAX bytes, it is flushed to %_segments +** and a new root interior node is generated (which should always fit +** within ROOT_MAX because it only needs space for 2 varints, the +** height and the blockid of the previous root). +** +** The meta-information in the segment directory is: +** level - segment level (see below) +** idx - index within level +** - (level,idx uniquely identify a segment) +** start_block - first leaf node +** leaves_end_block - last leaf node +** end_block - last block (including interior nodes) +** root - contents of root node +** +** If the root node is a leaf node, then start_block, +** leaves_end_block, and end_block are all 0. +** +** +**** Segment merging **** +** To amortize update costs, segments are grouped into levels and +** merged in batches. Each increase in level represents exponentially +** more documents. +** +** New documents (actually, document updates) are tokenized and +** written individually (using LeafWriter) to a level 0 segment, with +** incrementing idx. When idx reaches MERGE_COUNT (default 16), all +** level 0 segments are merged into a single level 1 segment. Level 1 +** is populated like level 0, and eventually MERGE_COUNT level 1 +** segments are merged to a single level 2 segment (representing +** MERGE_COUNT^2 updates), and so on. +** +** A segment merge traverses all segments at a given level in +** parallel, performing a straightforward sorted merge. Since segment +** leaf nodes are written in to the %_segments table in order, this +** merge traverses the underlying sqlite disk structures efficiently. +** After the merge, all segment blocks from the merged level are +** deleted. +** +** MERGE_COUNT controls how often we merge segments. 16 seems to be +** somewhat of a sweet spot for insertion performance. 32 and 64 show +** very similar performance numbers to 16 on insertion, though they're +** a tiny bit slower (perhaps due to more overhead in merge-time +** sorting). 8 is about 20% slower than 16, 4 about 50% slower than +** 16, 2 about 66% slower than 16. +** +** At query time, high MERGE_COUNT increases the number of segments +** which need to be scanned and merged. For instance, with 100k docs +** inserted: +** +** MERGE_COUNT segments +** 16 25 +** 8 12 +** 4 10 +** 2 6 +** +** This appears to have only a moderate impact on queries for very +** frequent terms (which are somewhat dominated by segment merge +** costs), and infrequent and non-existent terms still seem to be fast +** even with many segments. +** +** TODO(shess) That said, it would be nice to have a better query-side +** argument for MERGE_COUNT of 16. Also, it is possible/likely that +** optimizations to things like doclist merging will swing the sweet +** spot around. +** +** +** +**** Handling of deletions and updates **** +** Since we're using a segmented structure, with no docid-oriented +** index into the term index, we clearly cannot simply update the term +** index when a document is deleted or updated. For deletions, we +** write an empty doclist (varint(docid) varint(POS_END)), for updates +** we simply write the new doclist. Segment merges overwrite older +** data for a particular docid with newer data, so deletes or updates +** will eventually overtake the earlier data and knock it out. The +** query logic likewise merges doclists so that newer data knocks out +** older data. + */ + +/************** Include fts3Int.h in the middle of fts3.c ********************/ +/************** Begin file fts3Int.h *****************************************/ +/* +** 2009 Nov 12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** + */ + +/* FTS3/FTS4 require virtual tables */ + +/* +** FTS4 is really an extension for FTS3. It is enabled using the +** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all +** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. + */ + +/************** End of fts3Int.h *********************************************/ +/************** Continuing where we left off in fts3.c ***********************/ + +/************** End of fts3.c ************************************************/ +/************** Begin file fts3_aux.c ****************************************/ +/* +** 2011 Jan 27 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_aux.c ********************************************/ +/************** Begin file fts3_expr.c ***************************************/ +/* +** 2008 Nov 28 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This module contains code that implements a parser for fts3 query strings +** (the right-hand argument to the MATCH operator). Because the supported +** syntax is relatively simple, the whole tokenizer/parser system is +** hand-coded. + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_expr.c *******************************************/ +/************** Begin file fts3_hash.c ***************************************/ +/* +** 2001 September 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This is the implementation of generic hash-tables used in SQLite. +** We've modified it slightly to serve as a standalone hash table +** implementation for the full-text indexing module. + */ + +/* +** The code in this file is only compiled if: +** +** * The FTS3 module is being built as an extension +** (in which case SQLITE_CORE is not defined), or +** +** * The FTS3 module is being built into the core of +** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_hash.c *******************************************/ +/************** Begin file fts3_porter.c *************************************/ +/* +** 2006 September 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Implementation of the full-text-search tokenizer that implements +** a Porter stemmer. + */ + +/* +** The code in this file is only compiled if: +** +** * The FTS3 module is being built as an extension +** (in which case SQLITE_CORE is not defined), or +** +** * The FTS3 module is being built into the core of +** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_porter.c *****************************************/ +/************** Begin file fts3_tokenizer.c **********************************/ +/* +** 2007 June 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This is part of an SQLite module implementing full-text search. +** This particular file implements the generic tokenizer interface. + */ + +/* +** The code in this file is only compiled if: +** +** * The FTS3 module is being built as an extension +** (in which case SQLITE_CORE is not defined), or +** +** * The FTS3 module is being built into the core of +** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_tokenizer.c **************************************/ +/************** Begin file fts3_tokenizer1.c *********************************/ +/* +** 2006 Oct 10 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Implementation of the "simple" full-text-search tokenizer. + */ + +/* +** The code in this file is only compiled if: +** +** * The FTS3 module is being built as an extension +** (in which case SQLITE_CORE is not defined), or +** +** * The FTS3 module is being built into the core of +** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_tokenizer1.c *************************************/ +/************** Begin file fts3_tokenize_vtab.c ******************************/ +/* +** 2013 Apr 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code for the "fts3tokenize" virtual table module. +** An fts3tokenize virtual table is created as follows: +** +** CREATE VIRTUAL TABLE USING fts3tokenize( +** , , ... +** ); +** +** The table created has the following schema: +** +** CREATE TABLE (input, token, start, end, position) +** +** When queried, the query must include a WHERE clause of type: +** +** input = +** +** The virtual table module tokenizes this , using the FTS3 +** tokenizer specified by the arguments to the CREATE VIRTUAL TABLE +** statement and returns one row for each token in the result. With +** fields set as follows: +** +** input: Always set to a copy of +** token: A token from the input. +** start: Byte offset of the token within the input . +** end: Byte offset of the byte immediately following the end of the +** token within the input string. +** pos: Token offset of token within input. +** + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_tokenize_vtab.c **********************************/ +/************** Begin file fts3_write.c **************************************/ +/* +** 2009 Oct 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file is part of the SQLite FTS3 extension module. Specifically, +** this file contains code to insert, update and delete rows from FTS3 +** tables. It also contains code to merge FTS3 b-tree segments. Some +** of the sub-routines used to merge segments are also used by the query +** code in fts3.c. + */ + +/* #include "fts3Int.h" */ + +/************** End of fts3_write.c ******************************************/ +/************** Begin file fts3_snippet.c ************************************/ +/* +** 2009 Oct 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** + */ + +/* #include "fts3Int.h" */ + +/************** End of fts3_snippet.c ****************************************/ +/************** Begin file fts3_unicode.c ************************************/ +/* +** 2012 May 24 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Implementation of the "unicode" full-text-search tokenizer. + */ + +/* #include "fts3Int.h" */ + +/************** End of fts3_unicode.c ****************************************/ +/************** Begin file fts3_unicode2.c ***********************************/ +/* +** 2012-05-25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** + */ + +/* +** DO NOT EDIT THIS MACHINE GENERATED FILE. + */ + +/************** End of fts3_unicode2.c ***************************************/ +/************** Begin file json.c ********************************************/ +/* +** 2015-08-12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** SQLite JSON functions. +** +** This file began as an extension in ext/misc/json1.c in 2015. That +** extension proved so useful that it has now been moved into the core. +** +** The original design stored all JSON as pure text, canonical RFC-8259. +** Support for JSON-5 extensions was added with version 3.42.0 (2023-05-16). +** All generated JSON text still conforms strictly to RFC-8259, but text +** with JSON-5 extensions is accepted as input. +** +** Beginning with version 3.45.0 (circa 2024-01-01), these routines also +** accept BLOB values that have JSON encoded using a binary representation +** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk +** format SQLite JSONB is completely different and incompatible with +** PostgreSQL JSONB. +** +** Decoding and interpreting JSONB is still O(N) where N is the size of +** the input, the same as text JSON. However, the constant of proportionality +** for JSONB is much smaller due to faster parsing. The size of each +** element in JSONB is encoded in its header, so there is no need to search +** for delimiters using persnickety syntax rules. JSONB seems to be about +** 3x faster than text JSON as a result. JSONB is also tends to be slightly +** smaller than text JSON, by 5% or 10%, but there are corner cases where +** JSONB can be slightly larger. So you are not far mistaken to say that +** a JSONB blob is the same size as the equivalent RFC-8259 text. +** +** +** THE JSONB ENCODING: +** +** Every JSON element is encoded in JSONB as a header and a payload. +** The header is between 1 and 9 bytes in size. The payload is zero +** or more bytes. +** +** The lower 4 bits of the first byte of the header determines the +** element type: +** +** 0: NULL +** 1: TRUE +** 2: FALSE +** 3: INT -- RFC-8259 integer literal +** 4: INT5 -- JSON5 integer literal +** 5: FLOAT -- RFC-8259 floating point literal +** 6: FLOAT5 -- JSON5 floating point literal +** 7: TEXT -- Text literal acceptable to both SQL and JSON +** 8: TEXTJ -- Text containing RFC-8259 escapes +** 9: TEXT5 -- Text containing JSON5 and/or RFC-8259 escapes +** 10: TEXTRAW -- Text containing unescaped syntax characters +** 11: ARRAY +** 12: OBJECT +** +** The other three possible values (13-15) are reserved for future +** enhancements. +** +** The upper 4 bits of the first byte determine the size of the header +** and sometimes also the size of the payload. If X is the first byte +** of the element and if X>>4 is between 0 and 11, then the payload +** will be that many bytes in size and the header is exactly one byte +** in size. Other four values for X>>4 (12-15) indicate that the header +** is more than one byte in size and that the payload size is determined +** by the remainder of the header, interpreted as a unsigned big-endian +** integer. +** +** Value of X>>4 Size integer Total header size +** ------------- -------------------- ----------------- +** 12 1 byte (0-255) 2 +** 13 2 byte (0-65535) 3 +** 14 4 byte (0-4294967295) 5 +** 15 8 byte (0-1.8e19) 9 +** +** The payload size need not be expressed in its minimal form. For example, +** if the payload size is 10, the size can be expressed in any of 5 different +** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by on 0x0a byte, +** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by +** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and +** a single byte of 0x0a. The shorter forms are preferred, of course, but +** sometimes when generating JSONB, the payload size is not known in advance +** and it is convenient to reserve sufficient header space to cover the +** largest possible payload size and then come back later and patch up +** the size when it becomes known, resulting in a non-minimal encoding. +** +** The value (X>>4)==15 is not actually used in the current implementation +** (as SQLite is currently unable handle BLOBs larger than about 2GB) +** but is included in the design to allow for future enhancements. +** +** The payload follows the header. NULL, TRUE, and FALSE have no payload and +** their payload size must always be zero. The payload for INT, INT5, +** FLOAT, FLOAT5, TEXT, TEXTJ, TEXT5, and TEXTROW is text. Note that the +** "..." or '...' delimiters are omitted from the various text encodings. +** The payload for ARRAY and OBJECT is a list of additional elements that +** are the content for the array or object. The payload for an OBJECT +** must be an even number of elements. The first element of each pair is +** the label and must be of type TEXT, TEXTJ, TEXT5, or TEXTRAW. +** +** A valid JSONB blob consists of a single element, as described above. +** Usually this will be an ARRAY or OBJECT element which has many more +** elements as its content. But the overall blob is just a single element. +** +** Input validation for JSONB blobs simply checks that the element type +** code is between 0 and 12 and that the total size of the element +** (header plus payload) is the same as the size of the BLOB. If those +** checks are true, the BLOB is assumed to be JSONB and processing continues. +** Errors are only raised if some other miscoding is discovered during +** processing. +** +** Additional information can be found in the doc/jsonb.md file of the +** canonical SQLite source tree. + */ +/* #include "sqliteInt.h" */ + +/* JSONB element types + */ + +// C documentation +// +// /* Human-readable names for the JSONB values. The index for each +// ** string must correspond to the JSONB_* integer above. +// */ +var _jsonbType = [17]uintptr{ + 0: __ccgo_ts + 1666, + 1: __ccgo_ts + 7918, + 2: __ccgo_ts + 7923, + 3: __ccgo_ts + 6338, + 4: __ccgo_ts + 6338, + 5: __ccgo_ts + 6333, + 6: __ccgo_ts + 6333, + 7: __ccgo_ts + 8229, + 8: __ccgo_ts + 8229, + 9: __ccgo_ts + 8229, + 10: __ccgo_ts + 8229, + 11: __ccgo_ts + 24909, + 12: __ccgo_ts + 24915, + 13: __ccgo_ts + 1680, + 14: __ccgo_ts + 1680, + 15: __ccgo_ts + 1680, + 16: __ccgo_ts + 1680, +} + +// C documentation +// +// /* +// ** Growing our own isspace() routine this way is twice as fast as +// ** the library isspace() function, resulting in a 7% overall performance +// ** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os). +// */ +var _jsonIsSpace = [256]int8{ + 9: int8(1), + 10: int8(1), + 13: int8(1), + 32: int8(1), +} + +// C documentation +// +// /* +// ** The set of all space characters recognized by jsonIsspace(). +// ** Useful as the second argument to strspn(). +// */ +var _jsonSpaces = [5]int8{9, 10, 13, ' '} + +// C documentation +// +// /* +// ** Characters that are special to JSON. Control characters, +// ** '"' and '\\' and '\''. Actually, '\'' is not special to +// ** canonical JSON, but it is special in JSON-5, so we include +// ** it in the set of special characters. +// */ +var _jsonIsOk = [256]int8{ + 32: int8(1), + 33: int8(1), + 35: int8(1), + 36: int8(1), + 37: int8(1), + 38: int8(1), + 40: int8(1), + 41: int8(1), + 42: int8(1), + 43: int8(1), + 44: int8(1), + 45: int8(1), + 46: int8(1), + 47: int8(1), + 48: int8(1), + 49: int8(1), + 50: int8(1), + 51: int8(1), + 52: int8(1), + 53: int8(1), + 54: int8(1), + 55: int8(1), + 56: int8(1), + 57: int8(1), + 58: int8(1), + 59: int8(1), + 60: int8(1), + 61: int8(1), + 62: int8(1), + 63: int8(1), + 64: int8(1), + 65: int8(1), + 66: int8(1), + 67: int8(1), + 68: int8(1), + 69: int8(1), + 70: int8(1), + 71: int8(1), + 72: int8(1), + 73: int8(1), + 74: int8(1), + 75: int8(1), + 76: int8(1), + 77: int8(1), + 78: int8(1), + 79: int8(1), + 80: int8(1), + 81: int8(1), + 82: int8(1), + 83: int8(1), + 84: int8(1), + 85: int8(1), + 86: int8(1), + 87: int8(1), + 88: int8(1), + 89: int8(1), + 90: int8(1), + 91: int8(1), + 93: int8(1), + 94: int8(1), + 95: int8(1), + 96: int8(1), + 97: int8(1), + 98: int8(1), + 99: int8(1), + 100: int8(1), + 101: int8(1), + 102: int8(1), + 103: int8(1), + 104: int8(1), + 105: int8(1), + 106: int8(1), + 107: int8(1), + 108: int8(1), + 109: int8(1), + 110: int8(1), + 111: int8(1), + 112: int8(1), + 113: int8(1), + 114: int8(1), + 115: int8(1), + 116: int8(1), + 117: int8(1), + 118: int8(1), + 119: int8(1), + 120: int8(1), + 121: int8(1), + 122: int8(1), + 123: int8(1), + 124: int8(1), + 125: int8(1), + 126: int8(1), + 127: int8(1), + 128: int8(1), + 129: int8(1), + 130: int8(1), + 131: int8(1), + 132: int8(1), + 133: int8(1), + 134: int8(1), + 135: int8(1), + 136: int8(1), + 137: int8(1), + 138: int8(1), + 139: int8(1), + 140: int8(1), + 141: int8(1), + 142: int8(1), + 143: int8(1), + 144: int8(1), + 145: int8(1), + 146: int8(1), + 147: int8(1), + 148: int8(1), + 149: int8(1), + 150: int8(1), + 151: int8(1), + 152: int8(1), + 153: int8(1), + 154: int8(1), + 155: int8(1), + 156: int8(1), + 157: int8(1), + 158: int8(1), + 159: int8(1), + 160: int8(1), + 161: int8(1), + 162: int8(1), + 163: int8(1), + 164: int8(1), + 165: int8(1), + 166: int8(1), + 167: int8(1), + 168: int8(1), + 169: int8(1), + 170: int8(1), + 171: int8(1), + 172: int8(1), + 173: int8(1), + 174: int8(1), + 175: int8(1), + 176: int8(1), + 177: int8(1), + 178: int8(1), + 179: int8(1), + 180: int8(1), + 181: int8(1), + 182: int8(1), + 183: int8(1), + 184: int8(1), + 185: int8(1), + 186: int8(1), + 187: int8(1), + 188: int8(1), + 189: int8(1), + 190: int8(1), + 191: int8(1), + 192: int8(1), + 193: int8(1), + 194: int8(1), + 195: int8(1), + 196: int8(1), + 197: int8(1), + 198: int8(1), + 199: int8(1), + 200: int8(1), + 201: int8(1), + 202: int8(1), + 203: int8(1), + 204: int8(1), + 205: int8(1), + 206: int8(1), + 207: int8(1), + 208: int8(1), + 209: int8(1), + 210: int8(1), + 211: int8(1), + 212: int8(1), + 213: int8(1), + 214: int8(1), + 215: int8(1), + 216: int8(1), + 217: int8(1), + 218: int8(1), + 219: int8(1), + 220: int8(1), + 221: int8(1), + 222: int8(1), + 223: int8(1), + 224: int8(1), + 225: int8(1), + 226: int8(1), + 227: int8(1), + 228: int8(1), + 229: int8(1), + 230: int8(1), + 231: int8(1), + 232: int8(1), + 233: int8(1), + 234: int8(1), + 235: int8(1), + 236: int8(1), + 237: int8(1), + 238: int8(1), + 239: int8(1), + 240: int8(1), + 241: int8(1), + 242: int8(1), + 243: int8(1), + 244: int8(1), + 245: int8(1), + 246: int8(1), + 247: int8(1), + 248: int8(1), + 249: int8(1), + 250: int8(1), + 251: int8(1), + 252: int8(1), + 253: int8(1), + 254: int8(1), + 255: int8(1), +} + +// C documentation +// +// /* Objects */ +type TJsonCache = struct { + Fdb uintptr + FnUsed int32 + Fa [4]uintptr +} + +type JsonCache = TJsonCache + +type TJsonString = struct { + FpCtx uintptr + FzBuf uintptr + FnAlloc Tu64 + FnUsed Tu64 + FbStatic Tu8 + FeErr Tu8 + FzSpace [100]int8 +} + +type JsonString = TJsonString + +type TJsonParse = struct { + FaBlob uintptr + FnBlob Tu32 + FnBlobAlloc Tu32 + FzJson uintptr + Fdb uintptr + FnJson int32 + FnJPRef Tu32 + FiErr Tu32 + FiDepth Tu16 + FnErr Tu8 + Foom Tu8 + FbJsonIsRCStr Tu8 + FhasNonstd Tu8 + FbReadOnly Tu8 + FeEdit Tu8 + Fdelta int32 + FnIns Tu32 + FiLabel Tu32 + FaIns uintptr +} + +type JsonParse = TJsonParse + +/* +** Magic number used for the JSON parse cache in sqlite3_get_auxdata() + */ + +/* +** jsonUnescapeOneChar() returns this invalid code point if it encounters +** a syntax error. + */ + +/* A cache mapping JSON text into JSONB blobs. +** +** Each cache entry is a JsonParse object with the following restrictions: +** +** * The bReadOnly flag must be set +** +** * The aBlob[] array must be owned by the JsonParse object. In other +** words, nBlobAlloc must be non-zero. +** +** * eEdit and delta must be zero. +** +** * zJson must be an RCStr. In other words bJsonIsRCStr must be true. + */ +type TJsonCache1 = struct { + Fdb uintptr + FnUsed int32 + Fa [4]uintptr +} + +type JsonCache1 = TJsonCache1 + +/* An instance of this object represents a JSON string +** under construction. Really, this is a generic string accumulator +** that can be and is used to create strings other than JSON. +** +** If the generated string is longer than will fit into the zSpace[] buffer, +** then it will be an RCStr string. This aids with caching of large +** JSON strings. + */ +type TJsonString1 = struct { + FpCtx uintptr + FzBuf uintptr + FnAlloc Tu64 + FnUsed Tu64 + FbStatic Tu8 + FeErr Tu8 + FzSpace [100]int8 +} + +type JsonString1 = TJsonString1 + +/* Allowed values for JsonString.eErr */ + +/* The "subtype" set for text JSON values passed through using +** sqlite3_result_subtype() and sqlite3_value_subtype(). + */ + +/* +** Bit values for the flags passed into various SQL function implementations +** via the sqlite3_user_data() value. + */ + +/* A parsed JSON value. Lifecycle: +** +** 1. JSON comes in and is parsed into a JSONB value in aBlob. The +** original text is stored in zJson. This step is skipped if the +** input is JSONB instead of text JSON. +** +** 2. The aBlob[] array is searched using the JSON path notation, if needed. +** +** 3. Zero or more changes are made to aBlob[] (via json_remove() or +** json_replace() or json_patch() or similar). +** +** 4. New JSON text is generated from the aBlob[] for output. This step +** is skipped if the function is one of the jsonb_* functions that +** returns JSONB instead of text JSON. + */ +type TJsonParse1 = struct { + FaBlob uintptr + FnBlob Tu32 + FnBlobAlloc Tu32 + FzJson uintptr + Fdb uintptr + FnJson int32 + FnJPRef Tu32 + FiErr Tu32 + FiDepth Tu16 + FnErr Tu8 + Foom Tu8 + FbJsonIsRCStr Tu8 + FhasNonstd Tu8 + FbReadOnly Tu8 + FeEdit Tu8 + Fdelta int32 + FnIns Tu32 + FiLabel Tu32 + FaIns uintptr +} + +type JsonParse1 = TJsonParse1 + +/************************************************************************** +** Utility routines for dealing with JsonCache objects +**************************************************************************/ + +// C documentation +// +// /* +// ** Free a JsonCache object. +// */ +func _jsonCacheDelete(tls *libc.TLS, p uintptr) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TJsonCache)(unsafe.Pointer(p)).FnUsed) { + break + } + _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + _sqlite3DbFree(tls, (*TJsonCache)(unsafe.Pointer(p)).Fdb, p) +} + +func _jsonCacheDeleteGeneric(tls *libc.TLS, p uintptr) { + _jsonCacheDelete(tls, p) +} + +// C documentation +// +// /* +// ** Insert a new entry into the cache. If the cache is full, expel +// ** the least recently used entry. Return SQLITE_OK on success or a +// ** result code otherwise. +// ** +// ** Cache entries are stored in age order, oldest first. +// */ +func _jsonCacheInsert(tls *libc.TLS, ctx uintptr, pParse uintptr) (r int32) { + var db, p uintptr + _, _ = db, p + p = Xsqlite3_get_auxdata(tls, ctx, -int32(429938)) + if p == uintptr(0) { + db = Xsqlite3_context_db_handle(tls, ctx) + p = _sqlite3DbMallocZero(tls, db, uint64(48)) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TJsonCache)(unsafe.Pointer(p)).Fdb = db + Xsqlite3_set_auxdata(tls, ctx, -int32(429938), p, __ccgo_fp(_jsonCacheDeleteGeneric)) + p = Xsqlite3_get_auxdata(tls, ctx, -int32(429938)) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + } + if (*TJsonCache)(unsafe.Pointer(p)).FnUsed >= int32(JSON_CACHE_SIZE) { + _jsonParseFree(tls, *(*uintptr)(unsafe.Pointer(p + 16))) + libc.Xmemmove(tls, p+16, p+16+1*8, uint64(libc.Int32FromInt32(JSON_CACHE_SIZE)-libc.Int32FromInt32(1))*libc.Uint64FromInt64(8)) + (*TJsonCache)(unsafe.Pointer(p)).FnUsed = libc.Int32FromInt32(JSON_CACHE_SIZE) - libc.Int32FromInt32(1) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FeEdit = uint8(0) + (*TJsonParse)(unsafe.Pointer(pParse)).FnJPRef++ + (*TJsonParse)(unsafe.Pointer(pParse)).FbReadOnly = uint8(1) + *(*uintptr)(unsafe.Pointer(p + 16 + uintptr((*TJsonCache)(unsafe.Pointer(p)).FnUsed)*8)) = pParse + (*TJsonCache)(unsafe.Pointer(p)).FnUsed++ + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Search for a cached translation the json text supplied by pArg. Return +// ** the JsonParse object if found. Return NULL if not found. +// ** +// ** When a match if found, the matching entry is moved to become the +// ** most-recently used entry if it isn't so already. +// ** +// ** The JsonParse object returned still belongs to the Cache and might +// ** be deleted at any moment. If the caller whants the JsonParse to +// ** linger, it needs to increment the nPJRef reference counter. +// */ +func _jsonCacheSearch(tls *libc.TLS, ctx uintptr, pArg uintptr) (r uintptr) { + var i, nJson int32 + var p, tmp, zJson uintptr + _, _, _, _, _ = i, nJson, p, tmp, zJson + if Xsqlite3_value_type(tls, pArg) != int32(SQLITE_TEXT) { + return uintptr(0) + } + zJson = Xsqlite3_value_text(tls, pArg) + if zJson == uintptr(0) { + return uintptr(0) + } + nJson = Xsqlite3_value_bytes(tls, pArg) + p = Xsqlite3_get_auxdata(tls, ctx, -int32(429938)) + if p == uintptr(0) { + return uintptr(0) + } + i = 0 + for { + if !(i < (*TJsonCache)(unsafe.Pointer(p)).FnUsed) { + break + } + if (*TJsonParse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)))).FzJson == zJson { + break + } + goto _1 + _1: + ; + i++ + } + if i >= (*TJsonCache)(unsafe.Pointer(p)).FnUsed { + i = 0 + for { + if !(i < (*TJsonCache)(unsafe.Pointer(p)).FnUsed) { + break + } + if (*TJsonParse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)))).FnJson != nJson { + goto _2 + } + if libc.Xmemcmp(tls, (*TJsonParse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)))).FzJson, zJson, uint64(nJson)) == 0 { + break + } + goto _2 + _2: + ; + i++ + } + } + if i < (*TJsonCache)(unsafe.Pointer(p)).FnUsed { + if i < (*TJsonCache)(unsafe.Pointer(p)).FnUsed-int32(1) { + /* Make the matching entry the most recently used entry */ + tmp = *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)) + libc.Xmemmove(tls, p+16+uintptr(i)*8, p+16+uintptr(i+int32(1))*8, uint64((*TJsonCache)(unsafe.Pointer(p)).FnUsed-i-libc.Int32FromInt32(1))*uint64(8)) + *(*uintptr)(unsafe.Pointer(p + 16 + uintptr((*TJsonCache)(unsafe.Pointer(p)).FnUsed-int32(1))*8)) = tmp + i = (*TJsonCache)(unsafe.Pointer(p)).FnUsed - int32(1) + } + return *(*uintptr)(unsafe.Pointer(p + 16 + uintptr(i)*8)) + } else { + return uintptr(0) + } + return r +} + +/************************************************************************** +** Utility routines for dealing with JsonString objects +**************************************************************************/ + +// C documentation +// +// /* Turn uninitialized bulk memory into a valid JsonString object +// ** holding a zero-length string. +// */ +func _jsonStringZero(tls *libc.TLS, p uintptr) { + (*TJsonString)(unsafe.Pointer(p)).FzBuf = p + 34 + (*TJsonString)(unsafe.Pointer(p)).FnAlloc = uint64(100) + (*TJsonString)(unsafe.Pointer(p)).FnUsed = uint64(0) + (*TJsonString)(unsafe.Pointer(p)).FbStatic = uint8(1) +} + +// C documentation +// +// /* Initialize the JsonString object +// */ +func _jsonStringInit(tls *libc.TLS, p uintptr, pCtx uintptr) { + (*TJsonString)(unsafe.Pointer(p)).FpCtx = pCtx + (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(0) + _jsonStringZero(tls, p) +} + +// C documentation +// +// /* Free all allocated memory and reset the JsonString object back to its +// ** initial state. +// */ +func _jsonStringReset(tls *libc.TLS, p uintptr) { + if !((*TJsonString)(unsafe.Pointer(p)).FbStatic != 0) { + _sqlite3RCStrUnref(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf) + } + _jsonStringZero(tls, p) +} + +// C documentation +// +// /* Report an out-of-memory (OOM) condition +// */ +func _jsonStringOom(tls *libc.TLS, p uintptr) { + var p1 uintptr + _ = p1 + p1 = p + 33 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(JSTRING_OOM)) + if (*TJsonString)(unsafe.Pointer(p)).FpCtx != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) + } + _jsonStringReset(tls, p) +} + +// C documentation +// +// /* Enlarge pJson->zBuf so that it can hold at least N more bytes. +// ** Return zero on success. Return non-zero on an OOM error +// */ +func _jsonStringGrow(tls *libc.TLS, p uintptr, N Tu32) (r int32) { + var nTotal Tu64 + var zNew, p2 uintptr + var v1 uint64 + _, _, _, _ = nTotal, zNew, v1, p2 + if uint64(N) < (*TJsonString)(unsafe.Pointer(p)).FnAlloc { + v1 = (*TJsonString)(unsafe.Pointer(p)).FnAlloc * uint64(2) + } else { + v1 = (*TJsonString)(unsafe.Pointer(p)).FnAlloc + uint64(N) + uint64(10) + } + nTotal = v1 + if (*TJsonString)(unsafe.Pointer(p)).FbStatic != 0 { + if (*TJsonString)(unsafe.Pointer(p)).FeErr != 0 { + return int32(1) + } + zNew = _sqlite3RCStrNew(tls, nTotal) + if zNew == uintptr(0) { + _jsonStringOom(tls, p) + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, zNew, (*TJsonString)(unsafe.Pointer(p)).FzBuf, (*TJsonString)(unsafe.Pointer(p)).FnUsed) + (*TJsonString)(unsafe.Pointer(p)).FzBuf = zNew + (*TJsonString)(unsafe.Pointer(p)).FbStatic = uint8(0) + } else { + (*TJsonString)(unsafe.Pointer(p)).FzBuf = _sqlite3RCStrResize(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf, nTotal) + if (*TJsonString)(unsafe.Pointer(p)).FzBuf == uintptr(0) { + p2 = p + 33 + *(*Tu8)(unsafe.Pointer(p2)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p2))) | libc.Int32FromInt32(JSTRING_OOM)) + _jsonStringZero(tls, p) + return int32(SQLITE_NOMEM) + } + } + (*TJsonString)(unsafe.Pointer(p)).FnAlloc = nTotal + return SQLITE_OK +} + +// C documentation +// +// /* Append N bytes from zIn onto the end of the JsonString string. +// */ +func _jsonStringExpandAndAppend(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { + if _jsonStringGrow(tls, p, N) != 0 { + return + } + libc.Xmemcpy(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), zIn, uint64(N)) + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(N) +} + +func _jsonAppendRaw(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { + if N == uint32(0) { + return + } + if uint64(N)+(*TJsonString)(unsafe.Pointer(p)).FnUsed >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc { + _jsonStringExpandAndAppend(tls, p, zIn, N) + } else { + libc.Xmemcpy(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), zIn, uint64(N)) + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(N) + } +} + +func _jsonAppendRawNZ(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { + if uint64(N)+(*TJsonString)(unsafe.Pointer(p)).FnUsed >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc { + _jsonStringExpandAndAppend(tls, p, zIn, N) + } else { + libc.Xmemcpy(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), zIn, uint64(N)) + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(N) + } +} + +// C documentation +// +// /* Append formatted text (not to exceed N bytes) to the JsonString. +// */ +func _jsonPrintf(tls *libc.TLS, N int32, p uintptr, zFormat uintptr, va uintptr) { + var ap Tva_list + _ = ap + if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N) >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, uint32(N)) != 0 { + return + } + ap = va + Xsqlite3_vsnprintf(tls, N, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), zFormat, ap) + _ = ap + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(int32(libc.Xstrlen(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed)))) +} + +// C documentation +// +// /* Append a single character +// */ +func _jsonAppendCharExpand(tls *libc.TLS, p uintptr, c int8) { + var v1 Tu64 + var v2 uintptr + _, _ = v1, v2 + if _jsonStringGrow(tls, p, uint32(1)) != 0 { + return + } + v2 = p + 24 + v1 = *(*Tu64)(unsafe.Pointer(v2)) + *(*Tu64)(unsafe.Pointer(v2))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v1))) = c +} + +func _jsonAppendChar(tls *libc.TLS, p uintptr, c int8) { + var v1 Tu64 + var v2 uintptr + _, _ = v1, v2 + if (*TJsonString)(unsafe.Pointer(p)).FnUsed >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc { + _jsonAppendCharExpand(tls, p, c) + } else { + v2 = p + 24 + v1 = *(*Tu64)(unsafe.Pointer(v2)) + *(*Tu64)(unsafe.Pointer(v2))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v1))) = c + } +} + +// C documentation +// +// /* Remove a single character from the end of the string +// */ +func _jsonStringTrimOneChar(tls *libc.TLS, p uintptr) { + if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { + (*TJsonString)(unsafe.Pointer(p)).FnUsed-- + } +} + +// C documentation +// +// /* Make sure there is a zero terminator on p->zBuf[] +// ** +// ** Return true on success. Return false if an OOM prevents this +// ** from happening. +// */ +func _jsonStringTerminate(tls *libc.TLS, p uintptr) (r int32) { + _jsonAppendChar(tls, p, 0) + _jsonStringTrimOneChar(tls, p) + return libc.BoolInt32(int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0) +} + +// C documentation +// +// /* Append a comma separator to the output buffer, if the previous +// ** character is not '[' or '{'. +// */ +func _jsonAppendSeparator(tls *libc.TLS, p uintptr) { + var c int8 + _ = c + if (*TJsonString)(unsafe.Pointer(p)).FnUsed == uint64(0) { + return + } + c = *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed-uint64(1)))) + if int32(c) == int32('[') || int32(c) == int32('{') { + return + } + _jsonAppendChar(tls, p, int8(',')) +} + +// C documentation +// +// /* Append the N-byte string in zIn to the end of the JsonString string +// ** under construction. Enclose the string in double-quotes ("...") and +// ** escape any double-quotes or backslash characters contained within the +// ** string. +// ** +// ** This routine is a high-runner. There is a measurable performance +// ** increase associated with unwinding the jsonIsOk[] loop. +// */ +func _jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N Tu32) { + var c Tu8 + var k Tu32 + var z, v10, v12, v14, v16, v18, v2, v20, v22, v24, v6, v8 uintptr + var v1, v11, v13, v15, v17, v19, v21, v23, v5, v7, v9 Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, k, z, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v5, v6, v7, v8, v9 + z = zIn + if z == uintptr(0) { + return + } + if uint64(N)+(*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(2) >= (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(2)) != 0 { + return + } + v2 = p + 24 + v1 = *(*Tu64)(unsafe.Pointer(v2)) + *(*Tu64)(unsafe.Pointer(v2))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v1))) = int8('"') + for int32(1) != 0 { + k = uint32(0) + /* The following while() is the 4-way unwound equivalent of + ** + ** while( k= N { + for k < N && _jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(k)))] != 0 { + k++ + } + break + } + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(k)))] != 0) { + break + } + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(k+uint32(1))))] != 0) { + k += uint32(1) + break + } + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(k+uint32(2))))] != 0) { + k += uint32(2) + break + } + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(k+uint32(3))))] != 0) { + k += uint32(3) + break + } else { + k += uint32(4) + } + } + if k >= N { + if k > uint32(0) { + libc.Xmemcpy(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), z, uint64(k)) + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(k) + } + break + } + if k > uint32(0) { + libc.Xmemcpy(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf+uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed), z, uint64(k)) + *(*Tu64)(unsafe.Pointer(p + 24)) += uint64(k) + z += uintptr(k) + N -= k + } + c = *(*Tu8)(unsafe.Pointer(z)) + if !(int32(c) == int32('"') || int32(c) == int32('\\')) { + goto _3 + } + json_simple_escape: + ; + if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(3) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(3)) != 0 { + return + } + v6 = p + 24 + v5 = *(*Tu64)(unsafe.Pointer(v6)) + *(*Tu64)(unsafe.Pointer(v6))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v5))) = int8('\\') + v8 = p + 24 + v7 = *(*Tu64)(unsafe.Pointer(v8)) + *(*Tu64)(unsafe.Pointer(v8))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v7))) = int8(c) + goto _4 + _3: + ; + if int32(c) == int32('\'') { + v10 = p + 24 + v9 = *(*Tu64)(unsafe.Pointer(v10)) + *(*Tu64)(unsafe.Pointer(v10))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v9))) = int8(c) + } else { + if _aSpecial[c] != 0 { + c = uint8(_aSpecial[c]) + goto json_simple_escape + } + if (*TJsonString)(unsafe.Pointer(p)).FnUsed+uint64(N)+uint64(7) > (*TJsonString)(unsafe.Pointer(p)).FnAlloc && _jsonStringGrow(tls, p, N+uint32(7)) != 0 { + return + } + v12 = p + 24 + v11 = *(*Tu64)(unsafe.Pointer(v12)) + *(*Tu64)(unsafe.Pointer(v12))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v11))) = int8('\\') + v14 = p + 24 + v13 = *(*Tu64)(unsafe.Pointer(v14)) + *(*Tu64)(unsafe.Pointer(v14))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v13))) = int8('u') + v16 = p + 24 + v15 = *(*Tu64)(unsafe.Pointer(v16)) + *(*Tu64)(unsafe.Pointer(v16))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v15))) = int8('0') + v18 = p + 24 + v17 = *(*Tu64)(unsafe.Pointer(v18)) + *(*Tu64)(unsafe.Pointer(v18))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v17))) = int8('0') + v20 = p + 24 + v19 = *(*Tu64)(unsafe.Pointer(v20)) + *(*Tu64)(unsafe.Pointer(v20))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v19))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24922 + uintptr(int32(c)>>int32(4)))) + v22 = p + 24 + v21 = *(*Tu64)(unsafe.Pointer(v22)) + *(*Tu64)(unsafe.Pointer(v22))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v21))) = *(*int8)(unsafe.Pointer(__ccgo_ts + 24922 + uintptr(int32(c)&int32(0xf)))) + } + _4: + ; + z++ + N-- + } + v24 = p + 24 + v23 = *(*Tu64)(unsafe.Pointer(v24)) + *(*Tu64)(unsafe.Pointer(v24))++ + *(*int8)(unsafe.Pointer((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr(v23))) = int8('"') +} + +var _aSpecial = [32]int8{ + 8: int8('b'), + 9: int8('t'), + 10: int8('n'), + 12: int8('f'), + 13: int8('r'), +} + +// C documentation +// +// /* +// ** Append an sqlite3_value (such as a function parameter) to the JSON +// ** string under construction in p. +// */ +func _jsonAppendSqlValue(tls *libc.TLS, p uintptr, pValue uintptr) { + bp := tls.Alloc(96) + defer tls.Free(96) + var n, n1 Tu32 + var z, z1 uintptr + var _ /* px at bp+0 */ TJsonParse + _, _, _, _ = n, n1, z, z1 + switch Xsqlite3_value_type(tls, pValue) { + case int32(SQLITE_NULL): + _jsonAppendRawNZ(tls, p, __ccgo_ts+1666, uint32(4)) + case int32(SQLITE_FLOAT): + _jsonPrintf(tls, int32(100), p, __ccgo_ts+15355, libc.VaList(bp+80, Xsqlite3_value_double(tls, pValue))) + case int32(SQLITE_INTEGER): + z = Xsqlite3_value_text(tls, pValue) + n = uint32(Xsqlite3_value_bytes(tls, pValue)) + _jsonAppendRaw(tls, p, z, n) + case int32(SQLITE_TEXT): + z1 = Xsqlite3_value_text(tls, pValue) + n1 = uint32(Xsqlite3_value_bytes(tls, pValue)) + if Xsqlite3_value_subtype(tls, pValue) == uint32(JSON_SUBTYPE) { + _jsonAppendRaw(tls, p, z1, n1) + } else { + _jsonAppendString(tls, p, z1, n1) + } + default: + if _jsonFuncArgMightBeBinary(tls, pValue) != 0 { + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob = Xsqlite3_value_blob(tls, pValue) + (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob = uint32(Xsqlite3_value_bytes(tls, pValue)) + _jsonTranslateBlobToText(tls, bp, uint32(0), p) + } else { + if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24939, -int32(1)) + (*TJsonString)(unsafe.Pointer(p)).FeErr = uint8(JSTRING_ERR) + _jsonStringReset(tls, p) + } + } + break + } +} + +// C documentation +// +// /* Make the text in p (which is probably a generated JSON text string) +// ** the result of the SQL function. +// ** +// ** The JsonString is reset. +// ** +// ** If pParse and ctx are both non-NULL, then the SQL string in p is +// ** loaded into the zJson field of the pParse object as a RCStr and the +// ** pParse is added to the cache. +// */ +func _jsonReturnString(tls *libc.TLS, p uintptr, pParse uintptr, ctx uintptr) { + var flags, rc int32 + _, _ = flags, rc + if int32((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0 { + flags = int32(int64(Xsqlite3_user_data(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx))) + if flags&int32(JSON_BLOB) != 0 { + _jsonReturnStringAsBlob(tls, p) + } else { + if (*TJsonString)(unsafe.Pointer(p)).FbStatic != 0 { + Xsqlite3_result_text64(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, (*TJsonString)(unsafe.Pointer(p)).FzBuf, (*TJsonString)(unsafe.Pointer(p)).FnUsed, uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) + } else { + if _jsonStringTerminate(tls, p) != 0 { + if pParse != 0 && int32((*TJsonParse)(unsafe.Pointer(pParse)).FbJsonIsRCStr) == 0 && (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc > uint32(0) { + (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = _sqlite3RCStrRef(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf) + (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = int32((*TJsonString)(unsafe.Pointer(p)).FnUsed) + (*TJsonParse)(unsafe.Pointer(pParse)).FbJsonIsRCStr = uint8(1) + rc = _jsonCacheInsert(tls, ctx, pParse) + if rc == int32(SQLITE_NOMEM) { + Xsqlite3_result_error_nomem(tls, ctx) + _jsonStringReset(tls, p) + return + } + } + Xsqlite3_result_text64(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, _sqlite3RCStrRef(tls, (*TJsonString)(unsafe.Pointer(p)).FzBuf), (*TJsonString)(unsafe.Pointer(p)).FnUsed, __ccgo_fp(_sqlite3RCStrUnref), uint8(SQLITE_UTF8)) + } else { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) + } + } + } + } else { + if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_OOM) != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx) + } else { + if int32((*TJsonString)(unsafe.Pointer(p)).FeErr)&int32(JSTRING_MALFORMED) != 0 { + Xsqlite3_result_error(tls, (*TJsonString)(unsafe.Pointer(p)).FpCtx, __ccgo_ts+24968, -int32(1)) + } + } + } + _jsonStringReset(tls, p) +} + +/************************************************************************** +** Utility routines for dealing with JsonParse objects +**************************************************************************/ + +// C documentation +// +// /* +// ** Reclaim all memory allocated by a JsonParse object. But do not +// ** delete the JsonParse object itself. +// */ +func _jsonParseReset(tls *libc.TLS, pParse uintptr) { + if (*TJsonParse)(unsafe.Pointer(pParse)).FbJsonIsRCStr != 0 { + _sqlite3RCStrUnref(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FzJson) + (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = uintptr(0) + (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = 0 + (*TJsonParse)(unsafe.Pointer(pParse)).FbJsonIsRCStr = uint8(0) + } + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc != 0 { + _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) + (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = uintptr(0) + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(0) + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc = uint32(0) + } +} + +// C documentation +// +// /* +// ** Decrement the reference count on the JsonParse object. When the +// ** count reaches zero, free the object. +// */ +func _jsonParseFree(tls *libc.TLS, pParse uintptr) { + if pParse != 0 { + if (*TJsonParse)(unsafe.Pointer(pParse)).FnJPRef > uint32(1) { + (*TJsonParse)(unsafe.Pointer(pParse)).FnJPRef-- + } else { + _jsonParseReset(tls, pParse) + _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, pParse) + } + } +} + +/************************************************************************** +** Utility routines for the JSON text parser +**************************************************************************/ + +// C documentation +// +// /* +// ** Translate a single byte of Hex into an integer. +// ** This routine only gives a correct answer if h really is a valid hexadecimal +// ** character: 0..9a..fA..F. But unlike sqlite3HexToInt(), it does not +// ** assert() if the digit is not hex. +// */ +func _jsonHexToInt(tls *libc.TLS, h int32) (r Tu8) { + h += int32(9) * (int32(1) & (h >> int32(6))) + return uint8(h & libc.Int32FromInt32(0xf)) +} + +// C documentation +// +// /* +// ** Convert a 4-byte hex string into an integer +// */ +func _jsonHexToInt4(tls *libc.TLS, z uintptr) (r Tu32) { + var v Tu32 + _ = v + v = uint32(int32(_jsonHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z)))))<aBlob so that it holds at least N bytes. +// ** +// ** Return the number of errors. +// */ +func _jsonBlobExpand(tls *libc.TLS, pParse uintptr, N Tu32) (r int32) { + var aNew uintptr + var t Tu32 + _, _ = aNew, t + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc == uint32(0) { + t = uint32(100) + } else { + t = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc * uint32(2) + } + if t < N { + t = N + uint32(100) + } + aNew = _sqlite3DbRealloc(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob, uint64(t)) + if aNew == uintptr(0) { + (*TJsonParse)(unsafe.Pointer(pParse)).Foom = uint8(1) + return int32(1) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = aNew + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc = t + return 0 +} + +// C documentation +// +// /* +// ** If pParse->aBlob is not previously editable (because it is taken +// ** from sqlite3_value_blob(), as indicated by the fact that +// ** pParse->nBlobAlloc==0 and pParse->nBlob>0) then make it editable +// ** by making a copy into space obtained from malloc. +// ** +// ** Return true on success. Return false on OOM. +// */ +func _jsonBlobMakeEditable(tls *libc.TLS, pParse uintptr, nExtra Tu32) (r int32) { + var aOld uintptr + var nSize Tu32 + _, _ = aOld, nSize + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return 0 + } + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc > uint32(0) { + return int32(1) + } + aOld = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + nSize = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + nExtra + (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = uintptr(0) + if _jsonBlobExpand(tls, pParse, nSize) != 0 { + return 0 + } + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob, aOld, uint64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob)) + return int32(1) +} + +// C documentation +// +// /* Expand pParse->aBlob and append one bytes. +// */ +func _jsonBlobExpandAndAppendOneByte(tls *libc.TLS, pParse uintptr, c Tu8) { + var v1 Tu32 + var v2 uintptr + _, _ = v1, v2 + _jsonBlobExpand(tls, pParse, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob+uint32(1)) + if int32((*TJsonParse)(unsafe.Pointer(pParse)).Foom) == 0 { + v2 = pParse + 8 + v1 = *(*Tu32)(unsafe.Pointer(v2)) + *(*Tu32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(v1))) = c + } +} + +// C documentation +// +// /* Append a single character. +// */ +func _jsonBlobAppendOneByte(tls *libc.TLS, pParse uintptr, c Tu8) { + var v1 Tu32 + var v2 uintptr + _, _ = v1, v2 + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob >= (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc { + _jsonBlobExpandAndAppendOneByte(tls, pParse, c) + } else { + v2 = pParse + 8 + v1 = *(*Tu32)(unsafe.Pointer(v2)) + *(*Tu32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(v1))) = c + } +} + +func _jsonBlobExpandAndAppendNode(tls *libc.TLS, pParse uintptr, eType Tu8, szPayload Tu32, aPayload uintptr) { + if _jsonBlobExpand(tls, pParse, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob+szPayload+uint32(9)) != 0 { + return + } + _jsonBlobAppendNode(tls, pParse, eType, szPayload, aPayload) +} + +// C documentation +// +// /* Append an node type byte together with the payload size and +// ** possibly also the payload. +// ** +// ** If aPayload is not NULL, then it is a pointer to the payload which +// ** is also appended. If aPayload is NULL, the pParse->aBlob[] array +// ** is resized (if necessary) so that it is big enough to hold the +// ** payload, but the payload is not appended and pParse->nBlob is left +// ** pointing to where the first byte of payload will eventually be. +// */ +func _jsonBlobAppendNode(tls *libc.TLS, pParse uintptr, eType Tu8, szPayload Tu32, aPayload uintptr) { + var a uintptr + _ = a + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob+szPayload+uint32(9) > (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc { + _jsonBlobExpandAndAppendNode(tls, pParse, eType, szPayload, aPayload) + return + } + a = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob) + if szPayload <= uint32(11) { + *(*Tu8)(unsafe.Pointer(a)) = uint8(uint32(eType) | szPayload<> libc.Int32FromInt32(8) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(szPayload & uint32(0xff)) + *(*Tu32)(unsafe.Pointer(pParse + 8)) += uint32(3) + } else { + *(*Tu8)(unsafe.Pointer(a)) = uint8(int32(eType) | int32(0xe0)) + *(*Tu8)(unsafe.Pointer(a + 1)) = uint8(szPayload >> libc.Int32FromInt32(24) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(szPayload >> libc.Int32FromInt32(16) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 3)) = uint8(szPayload >> libc.Int32FromInt32(8) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 4)) = uint8(szPayload & uint32(0xff)) + *(*Tu32)(unsafe.Pointer(pParse + 8)) += uint32(5) + } + } + } + if aPayload != 0 { + *(*Tu32)(unsafe.Pointer(pParse + 8)) += szPayload + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-szPayload), aPayload, uint64(szPayload)) + } +} + +// C documentation +// +// /* Change the payload size for the node at index i to be szPayload. +// */ +func _jsonBlobChangePayloadSize(tls *libc.TLS, pParse uintptr, i Tu32, szPayload Tu32) (r int32) { + var a uintptr + var delta int32 + var nExtra, nNeeded, szType Tu8 + var newSize Tu32 + _, _, _, _, _, _ = a, delta, nExtra, nNeeded, newSize, szType + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return 0 + } + a = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i) + szType = uint8(int32(*(*Tu8)(unsafe.Pointer(a))) >> int32(4)) + if int32(szType) <= int32(11) { + nExtra = uint8(0) + } else { + if int32(szType) == int32(12) { + nExtra = uint8(1) + } else { + if int32(szType) == int32(13) { + nExtra = uint8(2) + } else { + nExtra = uint8(4) + } + } + } + if szPayload <= uint32(11) { + nNeeded = uint8(0) + } else { + if szPayload <= uint32(0xff) { + nNeeded = uint8(1) + } else { + if szPayload <= uint32(0xffff) { + nNeeded = uint8(2) + } else { + nNeeded = uint8(4) + } + } + } + delta = int32(nNeeded) - int32(nExtra) + if delta != 0 { + newSize = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + uint32(delta) + if delta > 0 { + if newSize > (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc && _jsonBlobExpand(tls, pParse, newSize) != 0 { + return 0 /* OOM error. Error state recorded in pParse->oom. */ + } + a = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i) + libc.Xmemmove(tls, a+uintptr(int32(1)+delta), a+1, uint64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-(i+uint32(1)))) + } else { + libc.Xmemmove(tls, a+1, a+uintptr(int32(1)-delta), uint64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-(i+uint32(1)-uint32(delta)))) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = newSize + } + if int32(nNeeded) == 0 { + *(*Tu8)(unsafe.Pointer(a)) = uint8(uint32(int32(*(*Tu8)(unsafe.Pointer(a)))&libc.Int32FromInt32(0x0f)) | szPayload<> libc.Int32FromInt32(8) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(szPayload & uint32(0xff)) + } else { + *(*Tu8)(unsafe.Pointer(a)) = uint8(int32(*(*Tu8)(unsafe.Pointer(a)))&int32(0x0f) | int32(0xe0)) + *(*Tu8)(unsafe.Pointer(a + 1)) = uint8(szPayload >> libc.Int32FromInt32(24) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(szPayload >> libc.Int32FromInt32(16) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 3)) = uint8(szPayload >> libc.Int32FromInt32(8) & uint32(0xff)) + *(*Tu8)(unsafe.Pointer(a + 4)) = uint8(szPayload & uint32(0xff)) + } + } + } + return delta +} + +// C documentation +// +// /* +// ** If z[0] is 'u' and is followed by exactly 4 hexadecimal character, +// ** then set *pOp to JSONB_TEXTJ and return true. If not, do not make +// ** any changes to *pOp and return false. +// */ +func _jsonIs4HexB(tls *libc.TLS, z uintptr, pOp uintptr) (r int32) { + if int32(*(*int8)(unsafe.Pointer(z))) != int32('u') { + return 0 + } + if !(_jsonIs4Hex(tls, z+1) != 0) { + return 0 + } + *(*int32)(unsafe.Pointer(pOp)) = int32(JSONB_TEXTJ) + return int32(1) +} + +// C documentation +// +// /* +// ** Check a single element of the JSONB in pParse for validity. +// ** +// ** The element to be checked starts at offset i and must end at on the +// ** last byte before iEnd. +// ** +// ** Return 0 if everything is correct. Return the 1-based byte offset of the +// ** error if a problem is detected. (In other words, if the error is at offset +// ** 0, return 1). +// */ +func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDepth Tu32) (r Tu32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var cnt, j, k, n, sub, sub1, szC Tu32 + var seen, x Tu8 + var z uintptr + var v1 uint32 + var _ /* c at bp+4 */ Tu32 + var _ /* sz at bp+0 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _ = cnt, j, k, n, seen, sub, sub1, szC, x, z, v1 + if iDepth > uint32(JSON_MAX_DEPTH) { + return i + uint32(1) + } + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + n = _jsonbPayloadSize(tls, pParse, i, bp) + if n == uint32(0) { + return i + uint32(1) + } /* Checked by caller */ + if i+n+*(*Tu32)(unsafe.Pointer(bp)) != iEnd { + return i + uint32(1) + } /* Checked by caller */ + z = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + x = uint8(int32(*(*Tu8)(unsafe.Pointer(z + uintptr(i)))) & int32(0x0f)) + switch int32(x) { + case JSONB_NULL: + fallthrough + case int32(JSONB_TRUE): + fallthrough + case int32(JSONB_FALSE): + if n+*(*Tu32)(unsafe.Pointer(bp)) == uint32(1) { + v1 = uint32(0) + } else { + v1 = i + uint32(1) + } + return v1 + case int32(JSONB_INT): + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(1) { + return i + uint32(1) + } + j = i + n + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('-') { + j++ + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(2) { + return i + uint32(1) + } + } + k = i + n + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + if int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(z + uintptr(j)))])&int32(0x04) != 0 { + j++ + } else { + return j + uint32(1) + } + } + return uint32(0) + case int32(JSONB_INT5): + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(3) { + return i + uint32(1) + } + j = i + n + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('-') { + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(4) { + return i + uint32(1) + } + j++ + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('0') { + return i + uint32(1) + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) != int32('x') && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) != int32('X') { + return j + uint32(2) + } + j += uint32(2) + k = i + n + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + if int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(z + uintptr(j)))])&int32(0x08) != 0 { + j++ + } else { + return j + uint32(1) + } + } + return uint32(0) + case int32(JSONB_FLOAT): + fallthrough + case int32(JSONB_FLOAT5): + seen = uint8(0) /* 0: initial. 1: '.' seen 2: 'e' seen */ + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(2) { + return i + uint32(1) + } + j = i + n + k = j + *(*Tu32)(unsafe.Pointer(bp)) + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('-') { + j++ + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(3) { + return i + uint32(1) + } + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('.') { + if int32(x) == int32(JSONB_FLOAT) { + return j + uint32(1) + } + if !(int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0) { + return j + uint32(1) + } + j += uint32(2) + seen = uint8(1) + } else { + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('0') && int32(x) == int32(JSONB_FLOAT) { + if j+uint32(3) > k { + return j + uint32(1) + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) != int32('.') && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) != int32('e') && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) != int32('E') { + return j + uint32(1) + } + j++ + } + } + for { + if !(j < k) { + break + } + if int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(z + uintptr(j)))])&int32(0x04) != 0 { + goto _2 + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('.') { + if int32(seen) > 0 { + return j + uint32(1) + } + if int32(x) == int32(JSONB_FLOAT) && (j == k-uint32(1) || !(int32(_sqlite3CtypeMap[*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0)) { + return j + uint32(1) + } + seen = uint8(1) + goto _2 + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('e') || int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('E') { + if int32(seen) == int32(2) { + return j + uint32(1) + } + if j == k-uint32(1) { + return j + uint32(1) + } + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('+') || int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('-') { + j++ + if j == k-uint32(1) { + return j + uint32(1) + } + } + seen = uint8(2) + goto _2 + } + return j + uint32(1) + goto _2 + _2: + ; + j++ + } + if int32(seen) == 0 { + return i + uint32(1) + } + return uint32(0) + case int32(JSONB_TEXT): + j = i + n + k = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(j)))] != 0) && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\'') { + return j + uint32(1) + } + j++ + } + return uint32(0) + case int32(JSONB_TEXTJ): + fallthrough + case int32(JSONB_TEXT5): + j = i + n + k = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + if !(_jsonIsOk[*(*Tu8)(unsafe.Pointer(z + uintptr(j)))] != 0) && int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\'') { + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) == int32('"') { + if int32(x) == int32(JSONB_TEXTJ) { + return j + uint32(1) + } + } else { + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { + return j + uint32(1) + } else { + if libc.Xstrchr(tls, __ccgo_ts+25057, int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) != uintptr(0) { + j++ + } else { + if int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('u') { + if j+uint32(5) >= k { + return j + uint32(1) + } + if !(_jsonIs4Hex(tls, z+uintptr(j+uint32(2))) != 0) { + return j + uint32(1) + } + j++ + } else { + if int32(x) != int32(JSONB_TEXT5) { + return j + uint32(1) + } else { + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) + szC = _jsonUnescapeOneChar(tls, z+uintptr(j), k-j, bp+4) + if *(*Tu32)(unsafe.Pointer(bp + 4)) == uint32(JSON_INVALID_CHAR) { + return j + uint32(1) + } + j += szC - uint32(1) + } + } + } + } + } + } + j++ + } + return uint32(0) + case int32(JSONB_TEXTRAW): + return uint32(0) + case int32(JSONB_ARRAY): + j = i + n + k = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + n = _jsonbPayloadSize(tls, pParse, j, bp) + if n == uint32(0) { + return j + uint32(1) + } + if j+n+*(*Tu32)(unsafe.Pointer(bp)) > k { + return j + uint32(1) + } + sub = _jsonbValidityCheck(tls, pParse, j, j+n+*(*Tu32)(unsafe.Pointer(bp)), iDepth+uint32(1)) + if sub != 0 { + return sub + } + j += n + *(*Tu32)(unsafe.Pointer(bp)) + } + return uint32(0) + case int32(JSONB_OBJECT): + cnt = uint32(0) + j = i + n + k = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < k { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + n = _jsonbPayloadSize(tls, pParse, j, bp) + if n == uint32(0) { + return j + uint32(1) + } + if j+n+*(*Tu32)(unsafe.Pointer(bp)) > k { + return j + uint32(1) + } + if cnt&uint32(1) == uint32(0) { + x = uint8(int32(*(*Tu8)(unsafe.Pointer(z + uintptr(j)))) & int32(0x0f)) + if int32(x) < int32(JSONB_TEXT) || int32(x) > int32(JSONB_TEXTRAW) { + return j + uint32(1) + } + } + sub1 = _jsonbValidityCheck(tls, pParse, j, j+n+*(*Tu32)(unsafe.Pointer(bp)), iDepth+uint32(1)) + if sub1 != 0 { + return sub1 + } + cnt++ + j += n + *(*Tu32)(unsafe.Pointer(bp)) + } + if cnt&uint32(1) != uint32(0) { + return j + uint32(1) + } + return uint32(0) + default: + return i + uint32(1) + } + return r +} + +// C documentation +// +// /* +// ** Translate a single element of JSON text at pParse->zJson[i] into +// ** its equivalent binary JSONB representation. Append the translation into +// ** pParse->aBlob[] beginning at pParse->nBlob. The size of +// ** pParse->aBlob[] is increased as necessary. +// ** +// ** Return the index of the first character past the end of the element parsed, +// ** or one of the following special result codes: +// ** +// ** 0 End of input +// ** -1 Syntax error or OOM +// ** -2 '}' seen ** -3 ']' seen \___ For these returns, pParse->iErr is set to +// ** -4 ',' seen / the index in zJson[] of the seen character +// ** -5 ':' seen / +// */ +func _jsonTranslateTextToBlob(tls *libc.TLS, pParse uintptr, i Tu32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c, cDelim int8 + var iBlob, iStart, iThis, j, k1, v46 Tu32 + var k, nn, x, v48 int32 + var opcode, seenE, t Tu8 + var z, v41, v44 uintptr + var v40, v43 Tu16 + var _ /* op at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, cDelim, iBlob, iStart, iThis, j, k, k1, nn, opcode, seenE, t, x, z, v40, v41, v43, v44, v46, v48 + z = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson +json_parse_restart: + ; + switch int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))) { + case int32('{'): + goto _1 + case int32('['): + goto _2 + case int32('"'): + goto _3 + case int32('\''): + goto _4 + case int32('t'): + goto _5 + case int32('f'): + goto _6 + case int32('.'): + goto _7 + case int32('9'): + goto _8 + case int32('8'): + goto _9 + case int32('7'): + goto _10 + case int32('6'): + goto _11 + case int32('5'): + goto _12 + case int32('4'): + goto _13 + case int32('3'): + goto _14 + case int32('2'): + goto _15 + case int32('1'): + goto _16 + case int32('0'): + goto _17 + case int32('-'): + goto _18 + case int32('+'): + goto _19 + case int32('}'): + goto _20 + case int32(']'): + goto _21 + case int32(','): + goto _22 + case int32(':'): + goto _23 + case 0: + goto _24 + case int32(0x20): + goto _25 + case int32(0x0d): + goto _26 + case int32(0x0a): + goto _27 + case int32(0x09): + goto _28 + case int32(0xef): + goto _29 + case int32(0xe3): + goto _30 + case int32(0xe2): + goto _31 + case int32(0xe1): + goto _32 + case int32(0xc2): + goto _33 + case int32('/'): + goto _34 + case int32(0x0c): + goto _35 + case int32(0x0b): + goto _36 + case int32('n'): + goto _37 + default: + goto _38 + } + goto _39 +_1: + ; + /* Parse object */ + iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_OBJECT), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) + v41 = pParse + 44 + *(*Tu16)(unsafe.Pointer(v41))++ + v40 = *(*Tu16)(unsafe.Pointer(v41)) + if int32(v40) > int32(JSON_MAX_DEPTH) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) + } + iStart = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + j = i + uint32(1) + for { + iBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x <= 0 { + if x == -int32(2) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob != iStart { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + } + break + } + j += uint32(_json5Whitespace(tls, z+uintptr(j))) + *(*int32)(unsafe.Pointer(bp)) = int32(JSONB_TEXT) + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))])&int32(0x42) != 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32('\\') && _jsonIs4HexB(tls, z+uintptr(j+uint32(1)), bp) != 0 { + k = int32(j + uint32(1)) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(k))))])&int32(0x46) != 0 && _json5Whitespace(tls, z+uintptr(k)) == 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(k)))) == int32('\\') && _jsonIs4HexB(tls, z+uintptr(k+int32(1)), bp) != 0 { + k++ + } + _jsonBlobAppendNode(tls, pParse, uint8(*(*int32)(unsafe.Pointer(bp))), uint32(k)-j, z+uintptr(j)) + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + x = k + } else { + if x != -int32(1) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + } + return -int32(1) + } + } + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return -int32(1) + } + t = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(iBlob)))) & int32(0x0f)) + if int32(t) < int32(JSONB_TEXT) || int32(t) > int32(JSONB_TEXTRAW) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + j = uint32(x) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(':') { + j++ + } else { + if _jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + /* strspn() is not helpful here */ + for cond := true; cond; cond = _jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(':') { + j++ + goto parse_object_value + } + } + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x != -int32(5) { + if x != -int32(1) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + } + return -int32(1) + } + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + uint32(1) + } + parse_object_value: + ; + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x <= 0 { + if x != -int32(1) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + } + return -int32(1) + } + j = uint32(x) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(',') { + goto _42 + } else { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32('}') { + break + } else { + if _jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(j+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(',') { + goto _42 + } else { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32('}') { + break + } + } + } + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x == -int32(4) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + goto _42 + } + if x == -int32(2) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + break + } + } + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + goto _42 + _42: + ; + j++ + } + _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) + (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- + return int32(j + uint32(1)) +_2: + ; + /* Parse array */ + iThis = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_ARRAY), uint32((*TJsonParse)(unsafe.Pointer(pParse)).FnJson)-i, uintptr(0)) + iStart = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return -int32(1) + } + v44 = pParse + 44 + *(*Tu16)(unsafe.Pointer(v44))++ + v43 = *(*Tu16)(unsafe.Pointer(v44)) + if int32(v43) > int32(JSON_MAX_DEPTH) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) + } + j = i + uint32(1) + for { + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x <= 0 { + if x == -int32(3) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + if (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob != iStart { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + } + break + } + if x != -int32(1) { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + } + return -int32(1) + } + j = uint32(x) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(',') { + goto _45 + } else { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(']') { + break + } else { + if _jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(j+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(',') { + goto _45 + } else { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == int32(']') { + break + } + } + } + x = _jsonTranslateTextToBlob(tls, pParse, j) + if x == -int32(4) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + goto _45 + } + if x == -int32(3) { + j = (*TJsonParse)(unsafe.Pointer(pParse)).FiErr + break + } + } + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + goto _45 + _45: + ; + j++ + } + _jsonBlobChangePayloadSize(tls, pParse, iThis, (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-iStart) + (*TJsonParse)(unsafe.Pointer(pParse)).FiDepth-- + return int32(j + uint32(1)) +_4: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + opcode = uint8(JSONB_TEXT) + goto parse_string +_3: + ; + /* Parse string */ + opcode = uint8(JSONB_TEXT) +parse_string: + ; + cDelim = *(*int8)(unsafe.Pointer(z + uintptr(i))) + j = i + uint32(1) + for int32(1) != 0 { + if _jsonIsOk[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + if !(_jsonIsOk[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))] != 0) { + j += uint32(1) + } else { + if !(_jsonIsOk[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(2)))))] != 0) { + j += uint32(2) + } else { + j += uint32(3) + continue + } + } + } + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if int32(c) == int32(cDelim) { + break + } else { + if int32(c) == int32('\\') { + j++ + v46 = j + c = *(*int8)(unsafe.Pointer(z + uintptr(v46))) + if int32(c) == int32('"') || int32(c) == int32('\\') || int32(c) == int32('/') || int32(c) == int32('b') || int32(c) == int32('f') || int32(c) == int32('n') || int32(c) == int32('r') || int32(c) == int32('t') || int32(c) == int32('u') && _jsonIs4Hex(tls, z+uintptr(j+uint32(1))) != 0 { + if int32(opcode) == int32(JSONB_TEXT) { + opcode = uint8(JSONB_TEXTJ) + } + } else { + if int32(c) == int32('\'') || int32(c) == int32('0') || int32(c) == int32('v') || int32(c) == int32('\n') || int32(0xe2) == int32(uint8(c)) && int32(0x80) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(1)))))) && (int32(0xa8) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(2)))))) || int32(0xa9) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(2))))))) || int32(c) == int32('x') && _jsonIs2Hex(tls, z+uintptr(j+uint32(1))) != 0 { + opcode = uint8(JSONB_TEXT5) + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + } else { + if int32(c) == int32('\r') { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j+uint32(1))))) == int32('\n') { + j++ + } + opcode = uint8(JSONB_TEXT5) + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + } else { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + } + } + } else { + if int32(c) <= int32(0x1f) { + /* Control characters are not allowed in strings */ + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } else { + if int32(c) == int32('"') { + opcode = uint8(JSONB_TEXT5) + } + } + } + } + j++ + } + _jsonBlobAppendNode(tls, pParse, opcode, j-uint32(1)-i, z+uintptr(i+uint32(1))) + return int32(j + uint32(1)) +_5: + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7918, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_TRUE)) + return int32(i + uint32(4)) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) +_6: + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+7923, uint64(5)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(5)))))])&libc.Int32FromInt32(0x06) != 0) { + _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_FALSE)) + return int32(i + uint32(5)) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) +_19: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ + goto parse_number +_7: + ; + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = uint8(0x03) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ + seenE = uint8(0) + goto parse_number_2 + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) +_18: + ; +_17: + ; +_16: + ; +_15: + ; +_14: + ; +_13: + ; +_12: + ; +_11: + ; +_10: + ; +_9: + ; +_8: + ; + /* Parse number */ + t = uint8(0x00) /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ +parse_number: + ; + seenE = uint8(0) + c = *(*int8)(unsafe.Pointer(z + uintptr(i))) + if int32(c) <= int32('0') { + if int32(c) == int32('0') { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('x') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('X')) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2)))))])&int32(0x08) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = uint8(0x01) + j = i + uint32(3) + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))])&int32(0x08) != 0) { + break + } + goto _47 + _47: + ; + j++ + } + goto parse_number_finish + } else { + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&int32(0x04) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + uint32(1) + return -int32(1) + } + } + } else { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))])&libc.Int32FromInt32(0x04) != 0) { + /* JSON5 allows for "+Infinity" and "-Infinity" using exactly + ** that case. SQLite also allows these in any case and it allows + ** "+inf" and "-inf". */ + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('I') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('i')) && Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(1)), __ccgo_ts+24983, int32(3)) == 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('-') { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25066) + } else { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25073) + } + if Xsqlite3_strnicmp(tls, z+uintptr(i+uint32(4)), __ccgo_ts+25079, int32(5)) == 0 { + v48 = int32(9) + } else { + v48 = int32(4) + } + return int32(i + uint32(v48)) + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('.') { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = Tu8(int32(t) | libc.Int32FromInt32(0x01)) + goto parse_number_2 + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('0') { + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2)))))])&int32(0x04) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + uint32(1) + return -int32(1) + } else { + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2))))) == int32('x') || int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2))))) == int32('X')) && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(3)))))])&int32(0x08) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = Tu8(int32(t) | libc.Int32FromInt32(0x01)) + j = i + uint32(4) + for { + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))])&int32(0x08) != 0) { + break + } + goto _49 + _49: + ; + j++ + } + goto parse_number_finish + } + } + } + } + } +parse_number_2: + ; + j = i + uint32(1) + for { + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if int32(_sqlite3CtypeMap[uint8(c)])&int32(0x04) != 0 { + goto _50 + } + if int32(c) == int32('.') { + if int32(t)&int32(0x02) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + t = Tu8(int32(t) | libc.Int32FromInt32(0x02)) + goto _50 + } + if int32(c) == int32('e') || int32(c) == int32('E') { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) == int32('.') && j-uint32(2) >= i && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(2)))))])&int32(0x04) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = Tu8(int32(t) | libc.Int32FromInt32(0x01)) + } else { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + } + if seenE != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + t = Tu8(int32(t) | libc.Int32FromInt32(0x02)) + seenE = uint8(1) + c = *(*int8)(unsafe.Pointer(z + uintptr(j+uint32(1)))) + if int32(c) == int32('+') || int32(c) == int32('-') { + j++ + c = *(*int8)(unsafe.Pointer(z + uintptr(j+uint32(1)))) + } + if int32(c) < int32('0') || int32(c) > int32('9') { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + goto _50 + } + break + goto _50 + _50: + ; + j++ + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) < int32('0') { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(1))))) == int32('.') && j-uint32(2) >= i && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j-uint32(2)))))])&int32(0x04) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + t = Tu8(int32(t) | libc.Int32FromInt32(0x01)) + } else { + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = j + return -int32(1) + } + } +parse_number_finish: + ; + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('+') { + i++ + } + _jsonBlobAppendNode(tls, pParse, uint8(int32(JSONB_INT)+int32(t)), j-i, z+uintptr(i)) + return int32(j) +_20: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(2) /* End of {...} */ +_21: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(3) /* End of [...] */ +_22: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(4) /* List separator */ +_23: + ; + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(5) /* Object label/value separator */ +_24: + ; + return 0 /* End of file */ +_28: + ; +_27: + ; +_26: + ; +_25: + ; + i += uint32(1) + uint32(libc.Xstrspn(tls, z+uintptr(i+uint32(1)), uintptr(unsafe.Pointer(&_jsonSpaces)))) + goto json_parse_restart +_36: + ; +_35: + ; +_34: + ; +_33: + ; +_32: + ; +_31: + ; +_30: + ; +_29: + ; + j = uint32(_json5Whitespace(tls, z+uintptr(i))) + if j > uint32(0) { + i += j + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + goto json_parse_restart + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) +_37: + ; + if libc.Xstrncmp(tls, z+uintptr(i), __ccgo_ts+1666, uint64(4)) == 0 && !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(4)))))])&libc.Int32FromInt32(0x06) != 0) { + _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) + return int32(i + uint32(4)) + } + /* fall-through into the default case that checks for NaN */ +_38: + ; + c = *(*int8)(unsafe.Pointer(z + uintptr(i))) + k1 = uint32(0) + for { + if !(uint64(k1) < libc.Uint64FromInt64(120)/libc.Uint64FromInt64(24)) { + break + } + if int32(c) != int32(_aNanInfName[k1].Fc1) && int32(c) != int32(_aNanInfName[k1].Fc2) { + goto _51 + } + nn = int32(_aNanInfName[k1].Fn) + if Xsqlite3_strnicmp(tls, z+uintptr(i), _aNanInfName[k1].FzMatch, nn) != 0 { + goto _51 + } + if int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(nn)))))])&int32(0x06) != 0 { + goto _51 + } + if int32(_aNanInfName[k1].FeType) == int32(JSONB_FLOAT) { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25073) + } else { + _jsonBlobAppendOneByte(tls, pParse, uint8(JSONB_NULL)) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + return int32(i + uint32(nn)) + goto _51 + _51: + ; + k1++ + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiErr = i + return -int32(1) /* Syntax error */ +_39: + ; /* End switch(z[i]) */ + return r +} + +// C documentation +// +// /* +// ** Parse a complete JSON string. Return 0 on success or non-zero if there +// ** are any errors. If an error occurs, free all memory held by pParse, +// ** but not pParse itself. +// ** +// ** pParse must be initialized to an empty parse object prior to calling +// ** this routine. +// */ +func _jsonConvertTextToBlob(tls *libc.TLS, pParse uintptr, pCtx uintptr) (r int32) { + var i int32 + var zJson uintptr + _, _ = i, zJson + zJson = (*TJsonParse)(unsafe.Pointer(pParse)).FzJson + i = _jsonTranslateTextToBlob(tls, pParse, uint32(0)) + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + i = -int32(1) + } + if i > 0 { + for _jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(zJson + uintptr(i))))] != 0 { + i++ + } + if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { + i += _json5Whitespace(tls, zJson+uintptr(i)) + if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { + if pCtx != 0 { + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24968, -int32(1)) + } + _jsonParseReset(tls, pParse) + return int32(1) + } + (*TJsonParse)(unsafe.Pointer(pParse)).FhasNonstd = uint8(1) + } + } + if i <= 0 { + if pCtx != uintptr(0) { + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + Xsqlite3_result_error_nomem(tls, pCtx) + } else { + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24968, -int32(1)) + } + } + _jsonParseReset(tls, pParse) + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** The input string pStr is a well-formed JSON text string. Convert +// ** this into the JSONB format and make it the return value of the +// ** SQL function. +// */ +func _jsonReturnStringAsBlob(tls *libc.TLS, pStr uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var _ /* px at bp+0 */ TJsonParse + libc.Xmemset(tls, bp, 0, uint64(72)) + _jsonStringTerminate(tls, pStr) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + return + } + (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf + (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed) + (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + _jsonTranslateTextToBlob(tls, bp, uint32(0)) + if (*(*TJsonParse)(unsafe.Pointer(bp))).Foom != 0 { + _sqlite3DbFree(tls, (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb, (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob) + Xsqlite3_result_error_nomem(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx) + } else { + Xsqlite3_result_blob(tls, (*TJsonString)(unsafe.Pointer(pStr)).FpCtx, (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob, int32((*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob), __ccgo_fp(_sqlite3OomClear)) + } +} + +// C documentation +// +// /* The byte at index i is a node type-code. This routine +// ** determines the payload size for that node and writes that +// ** payload size in to *pSz. It returns the offset from i to the +// ** beginning of the payload. Return 0 on error. +// */ +func _jsonbPayloadSize(tls *libc.TLS, pParse uintptr, i Tu32, pSz uintptr) (r Tu32) { + var n, sz Tu32 + var x Tu8 + _, _, _ = n, sz, x + if i > (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob { + *(*Tu32)(unsafe.Pointer(pSz)) = uint32(0) + return uint32(0) + } + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) >> int32(4)) + if int32(x) <= int32(11) { + sz = uint32(x) + n = uint32(1) + } else { + if int32(x) == int32(12) { + if i+uint32(1) >= (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob { + *(*Tu32)(unsafe.Pointer(pSz)) = uint32(0) + return uint32(0) + } + sz = uint32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(1))))) + n = uint32(2) + } else { + if int32(x) == int32(13) { + if i+uint32(2) >= (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob { + *(*Tu32)(unsafe.Pointer(pSz)) = uint32(0) + return uint32(0) + } + sz = uint32(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(1)))))<= (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob { + *(*Tu32)(unsafe.Pointer(pSz)) = uint32(0) + return uint32(0) + } + sz = uint32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(1)))))<= (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob || int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(1))))) != 0 || int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(2))))) != 0 || int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(3))))) != 0 || int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(4))))) != 0 { + *(*Tu32)(unsafe.Pointer(pSz)) = uint32(0) + return uint32(0) + } + sz = uint32(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+uint32(5)))))< int64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob) && int64(i)+int64(sz)+int64(n) > int64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-uint32((*TJsonParse)(unsafe.Pointer(pParse)).Fdelta)) { + sz = uint32(0) + n = uint32(0) + } + *(*Tu32)(unsafe.Pointer(pSz)) = sz + return n +} + +// C documentation +// +// /* +// ** Translate the binary JSONB representation of JSON beginning at +// ** pParse->aBlob[i] into a JSON text string. Append the JSON +// ** text onto the end of pOut. Return the index in pParse->aBlob[] +// ** of the first byte past the end of the element that is translated. +// ** +// ** If an error is detected in the BLOB input, the pOut->eErr flag +// ** might get set to JSTRING_MALFORMED. But not all BLOB input errors +// ** are detected. So a malformed JSONB input might either result +// ** in an error, or in incorrect JSON. +// ** +// ** The pOut->eErr JSTRING_OOM flag is set on a OOM. +// */ +func _jsonTranslateBlobToText(tls *libc.TLS, pParse uintptr, i Tu32, pOut uintptr) (r Tu32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bOverflow, x, v26, v27 int32 + var iEnd, j, k, k1, k2, n, sz2 Tu32 + var u Tsqlite3_uint64 + var zIn, zIn1, zIn2, v19, p1, p18, p22, p23, p24, p25, p28, p29 uintptr + var _ /* sz at bp+0 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bOverflow, iEnd, j, k, k1, k2, n, sz2, u, x, zIn, zIn1, zIn2, v19, v26, v27, p1, p18, p22, p23, p24, p25, p28, p29 + n = _jsonbPayloadSize(tls, pParse, i, bp) + if n == uint32(0) { + p1 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + return (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + uint32(1) + } + switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { + case JSONB_NULL: + goto _2 + case int32(JSONB_TRUE): + goto _3 + case int32(JSONB_FALSE): + goto _4 + case int32(JSONB_FLOAT): + goto _5 + case int32(JSONB_INT): + goto _6 + case int32(JSONB_INT5): + goto _7 + case int32(JSONB_FLOAT5): + goto _8 + case int32(JSONB_TEXTJ): + goto _9 + case int32(JSONB_TEXT): + goto _10 + case int32(JSONB_TEXT5): + goto _11 + case int32(JSONB_TEXTRAW): + goto _12 + case int32(JSONB_ARRAY): + goto _13 + case int32(JSONB_OBJECT): + goto _14 + default: + goto _15 + } + goto _16 +_2: + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+1666, uint32(4)) + return i + uint32(1) +_3: + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7918, uint32(4)) + return i + uint32(1) +_4: + ; + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+7923, uint32(5)) + return i + uint32(1) +_6: + ; +_5: + ; + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + goto malformed_jsonb + } + _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) + goto _16 +_7: + ; /* Integer literal in hexadecimal notation */ + k = uint32(2) + u = uint64(0) + zIn = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) + bOverflow = 0 + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + goto malformed_jsonb + } + if int32(*(*int8)(unsafe.Pointer(zIn))) == int32('-') { + _jsonAppendChar(tls, pOut, int8('-')) + k++ + } else { + if int32(*(*int8)(unsafe.Pointer(zIn))) == int32('+') { + k++ + } + } + for { + if !(k < *(*Tu32)(unsafe.Pointer(bp))) { + break + } + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + uintptr(k))))])&libc.Int32FromInt32(0x08) != 0) { + p18 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p18)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p18))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + break + } else { + if u>>libc.Int32FromInt32(60) != uint64(0) { + bOverflow = int32(1) + } else { + u = u*uint64(16) + uint64(_sqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zIn + uintptr(k)))))) + } + } + goto _17 + _17: + ; + k++ + } + if bOverflow != 0 { + v19 = __ccgo_ts + 24987 + } else { + v19 = __ccgo_ts + 11785 + } + _jsonPrintf(tls, int32(100), pOut, v19, libc.VaList(bp+16, u)) + goto _16 +_8: + ; /* Float literal missing digits beside "." */ + k1 = uint32(0) + zIn1 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + goto malformed_jsonb + } + if int32(*(*int8)(unsafe.Pointer(zIn1))) == int32('-') { + _jsonAppendChar(tls, pOut, int8('-')) + k1++ + } + if int32(*(*int8)(unsafe.Pointer(zIn1 + uintptr(k1)))) == int32('.') { + _jsonAppendChar(tls, pOut, int8('0')) + } + for { + if !(k1 < *(*Tu32)(unsafe.Pointer(bp))) { + break + } + _jsonAppendChar(tls, pOut, *(*int8)(unsafe.Pointer(zIn1 + uintptr(k1)))) + if int32(*(*int8)(unsafe.Pointer(zIn1 + uintptr(k1)))) == int32('.') && (k1+uint32(1) == *(*Tu32)(unsafe.Pointer(bp)) || !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn1 + uintptr(k1+uint32(1)))))])&libc.Int32FromInt32(0x04) != 0)) { + _jsonAppendChar(tls, pOut, int8('0')) + } + goto _20 + _20: + ; + k1++ + } + goto _16 +_10: + ; +_9: + ; + _jsonAppendChar(tls, pOut, int8('"')) + _jsonAppendRaw(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) + _jsonAppendChar(tls, pOut, int8('"')) + goto _16 +_11: + ; + sz2 = *(*Tu32)(unsafe.Pointer(bp)) + zIn2 = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n) + _jsonAppendChar(tls, pOut, int8('"')) + for sz2 > uint32(0) { + k2 = uint32(0) + for { + if !(k2 < sz2 && int32(*(*int8)(unsafe.Pointer(zIn2 + uintptr(k2)))) != int32('\\') && int32(*(*int8)(unsafe.Pointer(zIn2 + uintptr(k2)))) != int32('"')) { + break + } + goto _21 + _21: + ; + k2++ + } + if k2 > uint32(0) { + _jsonAppendRawNZ(tls, pOut, zIn2, k2) + if k2 >= sz2 { + break + } + zIn2 += uintptr(k2) + sz2 -= k2 + } + if int32(*(*int8)(unsafe.Pointer(zIn2))) == int32('"') { + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25085, uint32(2)) + zIn2++ + sz2-- + continue + } + if sz2 < uint32(2) { + p22 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p22)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p22))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + break + } + switch int32(uint8(*(*int8)(unsafe.Pointer(zIn2 + 1)))) { + case int32('\''): + _jsonAppendChar(tls, pOut, int8('\'')) + case int32('v'): + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25088, uint32(6)) + case int32('x'): + if sz2 < uint32(4) { + p23 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p23)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p23))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + sz2 = uint32(2) + break + } + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25095, uint32(4)) + _jsonAppendRawNZ(tls, pOut, zIn2+2, uint32(2)) + zIn2 += uintptr(2) + sz2 -= uint32(2) + case int32('0'): + _jsonAppendRawNZ(tls, pOut, __ccgo_ts+25100, uint32(6)) + case int32('\r'): + if sz2 > uint32(2) && int32(*(*int8)(unsafe.Pointer(zIn2 + 2))) == int32('\n') { + zIn2++ + sz2-- + } + case int32('\n'): + case int32(0xe2): + /* '\' followed by either U+2028 or U+2029 is ignored as + ** whitespace. Not that in UTF8, U+2028 is 0xe2 0x80 0x29. + ** U+2029 is the same except for the last byte */ + if sz2 < uint32(4) || int32(0x80) != int32(uint8(*(*int8)(unsafe.Pointer(zIn2 + 2)))) || int32(0xa8) != int32(uint8(*(*int8)(unsafe.Pointer(zIn2 + 3)))) && int32(0xa9) != int32(uint8(*(*int8)(unsafe.Pointer(zIn2 + 3)))) { + p24 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p24)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p24))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + sz2 = uint32(2) + break + } + zIn2 += uintptr(2) + sz2 -= uint32(2) + default: + _jsonAppendRawNZ(tls, pOut, zIn2, uint32(2)) + break + } + zIn2 += uintptr(2) + sz2 -= uint32(2) + } + _jsonAppendChar(tls, pOut, int8('"')) + goto _16 +_12: + ; + _jsonAppendString(tls, pOut, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), *(*Tu32)(unsafe.Pointer(bp))) + goto _16 +_13: + ; + _jsonAppendChar(tls, pOut, int8('[')) + j = i + n + iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < iEnd && int32((*TJsonString)(unsafe.Pointer(pOut)).FeErr) == 0 { + j = _jsonTranslateBlobToText(tls, pParse, j, pOut) + _jsonAppendChar(tls, pOut, int8(',')) + } + if j > iEnd { + p25 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p25)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p25))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + } + if *(*Tu32)(unsafe.Pointer(bp)) > uint32(0) { + _jsonStringTrimOneChar(tls, pOut) + } + _jsonAppendChar(tls, pOut, int8(']')) + goto _16 +_14: + ; + x = 0 + _jsonAppendChar(tls, pOut, int8('{')) + j = i + n + iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < iEnd && int32((*TJsonString)(unsafe.Pointer(pOut)).FeErr) == 0 { + j = _jsonTranslateBlobToText(tls, pParse, j, pOut) + v27 = x + x++ + if v27&int32(1) != 0 { + v26 = int32(',') + } else { + v26 = int32(':') + } + _jsonAppendChar(tls, pOut, int8(v26)) + } + if x&int32(1) != 0 || j > iEnd { + p28 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p28)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p28))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + } + if *(*Tu32)(unsafe.Pointer(bp)) > uint32(0) { + _jsonStringTrimOneChar(tls, pOut) + } + _jsonAppendChar(tls, pOut, int8('}')) + goto _16 +_15: + ; +malformed_jsonb: + ; + p29 = pOut + 33 + *(*Tu8)(unsafe.Pointer(p29)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p29))) | libc.Int32FromInt32(JSTRING_MALFORMED)) + goto _16 +_16: + ; + return i + n + *(*Tu32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* Return true if the input pJson +// ** +// ** For performance reasons, this routine does not do a detailed check of the +// ** input BLOB to ensure that it is well-formed. Hence, false positives are +// ** possible. False negatives should never occur, however. +// */ +func _jsonFuncArgMightBeBinary(tls *libc.TLS, pJson uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var aBlob uintptr + var n Tu32 + var nBlob int32 + var _ /* s at bp+8 */ TJsonParse + var _ /* sz at bp+0 */ Tu32 + _, _, _ = aBlob, n, nBlob + if Xsqlite3_value_type(tls, pJson) != int32(SQLITE_BLOB) { + return 0 + } + aBlob = Xsqlite3_value_blob(tls, pJson) + nBlob = Xsqlite3_value_bytes(tls, pJson) + if nBlob < int32(1) { + return 0 + } + if aBlob == uintptr(0) || int32(*(*Tu8)(unsafe.Pointer(aBlob)))&int32(0x0f) > int32(JSONB_OBJECT) { + return 0 + } + libc.Xmemset(tls, bp+8, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp + 8))).FaBlob = aBlob + (*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob = uint32(nBlob) + n = _jsonbPayloadSize(tls, bp+8, uint32(0), bp) + if n == uint32(0) { + return 0 + } + if *(*Tu32)(unsafe.Pointer(bp))+n != uint32(nBlob) { + return 0 + } + if int32(*(*Tu8)(unsafe.Pointer(aBlob)))&int32(0x0f) <= int32(JSONB_FALSE) && *(*Tu32)(unsafe.Pointer(bp)) > uint32(0) { + return 0 + } + return libc.BoolInt32(*(*Tu32)(unsafe.Pointer(bp))+n == uint32(nBlob)) +} + +// C documentation +// +// /* +// ** Given that a JSONB_ARRAY object starts at offset i, return +// ** the number of entries in that array. +// */ +func _jsonbArrayCount(tls *libc.TLS, pParse uintptr, iRoot Tu32) (r Tu32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iEnd, k, n Tu32 + var _ /* sz at bp+0 */ Tu32 + _, _, _, _ = i, iEnd, k, n + k = uint32(0) + n = _jsonbPayloadSize(tls, pParse, iRoot, bp) + iEnd = iRoot + n + *(*Tu32)(unsafe.Pointer(bp)) + i = iRoot + n + for { + if !(n > uint32(0) && i < iEnd) { + break + } + n = _jsonbPayloadSize(tls, pParse, i, bp) + goto _1 + _1: + ; + i += *(*Tu32)(unsafe.Pointer(bp)) + n + k++ + } + return k +} + +// C documentation +// +// /* +// ** Edit the payload size of the element at iRoot by the amount in +// ** pParse->delta. +// */ +func _jsonAfterEditSizeAdjust(tls *libc.TLS, pParse uintptr, iRoot Tu32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nBlob Tu32 + var _ /* sz at bp+0 */ Tu32 + _ = nBlob + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + nBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc + _jsonbPayloadSize(tls, pParse, iRoot, bp) + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = nBlob + *(*Tu32)(unsafe.Pointer(bp)) += uint32((*TJsonParse)(unsafe.Pointer(pParse)).Fdelta) + *(*int32)(unsafe.Pointer(pParse + 52)) += _jsonBlobChangePayloadSize(tls, pParse, iRoot, *(*Tu32)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of +// ** content beginning at iDel, and replacing them with nIns bytes of +// ** content given by aIns. +// ** +// ** nDel may be zero, in which case no bytes are removed. But iDel is +// ** still important as new bytes will be insert beginning at iDel. +// ** +// ** aIns may be zero, in which case space is created to hold nIns bytes +// ** beginning at iDel, but that space is uninitialized. +// ** +// ** Set pParse->oom if an OOM occurs. +// */ +func _jsonBlobEdit(tls *libc.TLS, pParse uintptr, iDel Tu32, nDel Tu32, aIns uintptr, nIns Tu32) { + var d Ti64 + var p1, p2 uintptr + _, _, _ = d, p1, p2 + d = int64(nIns) - int64(nDel) + if d != 0 { + if int64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob)+d > int64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlobAlloc) { + _jsonBlobExpand(tls, pParse, uint32(int64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob)+d)) + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return + } + } + libc.Xmemmove(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(iDel+nIns), (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(iDel+nDel), uint64((*TJsonParse)(unsafe.Pointer(pParse)).FnBlob-(iDel+nDel))) + p1 = pParse + 8 + *(*Tu32)(unsafe.Pointer(p1)) = Tu32(int64(*(*Tu32)(unsafe.Pointer(p1))) + d) + p2 = pParse + 52 + *(*int32)(unsafe.Pointer(p2)) = int32(int64(*(*int32)(unsafe.Pointer(p2))) + d) + } + if nIns != 0 && aIns != 0 { + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(iDel), aIns, uint64(nIns)) + } +} + +// C documentation +// +// /* +// ** Return the number of escaped newlines to be ignored. +// ** An escaped newline is a one of the following byte sequences: +// ** +// ** 0x5c 0x0a +// ** 0x5c 0x0d +// ** 0x5c 0x0d 0x0a +// ** 0x5c 0xe2 0x80 0xa8 +// ** 0x5c 0xe2 0x80 0xa9 +// */ +func _jsonBytesToBypass(tls *libc.TLS, z uintptr, n Tu32) (r Tu32) { + var i Tu32 + _ = i + i = uint32(0) + for i+uint32(1) < n { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != int32('\\') { + return i + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('\n') { + i += uint32(2) + continue + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1))))) == int32('\r') { + if i+uint32(2) < n && int32(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2))))) == int32('\n') { + i += uint32(3) + } else { + i += uint32(2) + } + continue + } + if int32(0xe2) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(1)))))) && i+uint32(3) < n && int32(0x80) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(2)))))) && (int32(0xa8) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(3)))))) || int32(0xa9) == int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i+uint32(3))))))) { + i += uint32(4) + continue + } + break + } + return i +} + +// C documentation +// +// /* +// ** Input z[0..n] defines JSON escape sequence including the leading '\\'. +// ** Decode that escape sequence into a single character. Write that +// ** character into *piOut. Return the number of bytes in the escape sequence. +// ** +// ** If there is a syntax error of some kind (for example too few characters +// ** after the '\\' to complete the encoding) then *piOut is set to +// ** JSON_INVALID_CHAR. +// */ +func _jsonUnescapeOneChar(tls *libc.TLS, z uintptr, n Tu32, piOut uintptr) (r Tu32) { + var nSkip, v, vlo, v1 Tu32 + var sz int32 + var v2 bool + _, _, _, _, _, _ = nSkip, sz, v, vlo, v1, v2 + if n < uint32(2) { + *(*Tu32)(unsafe.Pointer(piOut)) = uint32(JSON_INVALID_CHAR) + return n + } + switch int32(uint8(*(*int8)(unsafe.Pointer(z + 1)))) { + case int32('u'): + if n < uint32(6) { + *(*Tu32)(unsafe.Pointer(piOut)) = uint32(JSON_INVALID_CHAR) + return n + } + v = _jsonHexToInt4(tls, z+2) + if v2 = v&uint32(0xfc00) == uint32(0xd800) && n >= uint32(12) && int32(*(*int8)(unsafe.Pointer(z + 6))) == int32('\\') && int32(*(*int8)(unsafe.Pointer(z + 7))) == int32('u'); v2 { + v1 = _jsonHexToInt4(tls, z+8) + vlo = v1 + } + if v2 && v1&uint32(0xfc00) == uint32(0xdc00) { + *(*Tu32)(unsafe.Pointer(piOut)) = v&uint32(0x3ff)<= uint32(0xc0) { + sz = _sqlite3Utf8ReadLimited(tls, zLeft, int32(nLeft), bp) + zLeft += uintptr(sz) + nLeft -= uint32(sz) + } else { + zLeft++ + nLeft-- + } + } else { + n = _jsonUnescapeOneChar(tls, zLeft, nLeft, bp) + zLeft += uintptr(n) + nLeft -= n + } + } + if nRight == uint32(0) { + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) + } else { + if rawRight != 0 || int32(*(*int8)(unsafe.Pointer(zRight))) != int32('\\') { + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(*(*Tu8)(unsafe.Pointer(zRight))) + if *(*Tu32)(unsafe.Pointer(bp + 4)) >= uint32(0xc0) { + sz1 = _sqlite3Utf8ReadLimited(tls, zRight, int32(nRight), bp+4) + zRight += uintptr(sz1) + nRight -= uint32(sz1) + } else { + zRight++ + nRight-- + } + } else { + n1 = _jsonUnescapeOneChar(tls, zRight, nRight, bp+4) + zRight += uintptr(n1) + nRight -= n1 + } + } + if *(*Tu32)(unsafe.Pointer(bp)) != *(*Tu32)(unsafe.Pointer(bp + 4)) { + return 0 + } + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + return int32(1) + } + } + return r +} + +// C documentation +// +// /* +// ** Compare two object labels. Return 1 if they are equal and +// ** 0 if they differ. Return -1 if an OOM occurs. +// */ +func _jsonLabelCompare(tls *libc.TLS, zLeft uintptr, nLeft Tu32, rawLeft int32, zRight uintptr, nRight Tu32, rawRight int32) (r int32) { + if rawLeft != 0 && rawRight != 0 { + /* Simpliest case: Neither label contains escapes. A simple + ** memcmp() is sufficient. */ + if nLeft != nRight { + return 0 + } + return libc.BoolInt32(libc.Xmemcmp(tls, zLeft, zRight, uint64(nLeft)) == 0) + } else { + return _jsonLabelCompareEscaped(tls, zLeft, nLeft, rawLeft, zRight, nRight, rawRight) + } + return r +} + +// C documentation +// +// /* This helper routine for jsonLookupStep() populates pIns with +// ** binary data that is to be inserted into pParse. +// ** +// ** In the common case, pIns just points to pParse->aIns and pParse->nIns. +// ** But if the zPath of the original edit operation includes path elements +// ** that go deeper, additional substructure must be created. +// ** +// ** For example: +// ** +// ** json_insert('{}', '$.a.b.c', 123); +// ** +// ** The search stops at '$.a' But additional substructure must be +// ** created for the ".b.c" part of the patch so that the final result +// ** is: {"a":{"b":{"c"::123}}}. This routine populates pIns with +// ** the binary equivalent of {"b":{"c":123}} so that it can be inserted. +// ** +// ** The caller is responsible for resetting pIns when it has finished +// ** using the substructure. +// */ +func _jsonCreateEditSubstructure(tls *libc.TLS, pParse uintptr, pIns uintptr, zTail uintptr) (r Tu32) { + var rc int32 + var p1 uintptr + _, _ = rc, p1 + libc.Xmemset(tls, pIns, 0, uint64(72)) + (*TJsonParse)(unsafe.Pointer(pIns)).Fdb = (*TJsonParse)(unsafe.Pointer(pParse)).Fdb + if int32(*(*int8)(unsafe.Pointer(zTail))) == 0 { + /* No substructure. Just insert what is given in pParse. */ + (*TJsonParse)(unsafe.Pointer(pIns)).FaBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FaIns + (*TJsonParse)(unsafe.Pointer(pIns)).FnBlob = (*TJsonParse)(unsafe.Pointer(pParse)).FnIns + rc = 0 + } else { + /* Construct the binary substructure */ + (*TJsonParse)(unsafe.Pointer(pIns)).FnBlob = uint32(1) + (*TJsonParse)(unsafe.Pointer(pIns)).FaBlob = uintptr(unsafe.Pointer(&_emptyObject)) + libc.BoolUintptr(int32(*(*int8)(unsafe.Pointer(zTail))) == int32('.')) + (*TJsonParse)(unsafe.Pointer(pIns)).FeEdit = (*TJsonParse)(unsafe.Pointer(pParse)).FeEdit + (*TJsonParse)(unsafe.Pointer(pIns)).FnIns = (*TJsonParse)(unsafe.Pointer(pParse)).FnIns + (*TJsonParse)(unsafe.Pointer(pIns)).FaIns = (*TJsonParse)(unsafe.Pointer(pParse)).FaIns + rc = int32(_jsonLookupStep(tls, pIns, uint32(0), zTail, uint32(0))) + p1 = pParse + 47 + *(*Tu8)(unsafe.Pointer(p1)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p1))) | int32((*TJsonParse)(unsafe.Pointer(pIns)).Foom)) + } + return uint32(rc) /* Error code only */ +} + +var _emptyObject = [2]Tu8{ + 0: uint8(JSONB_ARRAY), + 1: uint8(JSONB_OBJECT), +} + +// C documentation +// +// /* +// ** Search along zPath to find the Json element specified. Return an +// ** index into pParse->aBlob[] for the start of that element's value. +// ** +// ** If the value found by this routine is the value half of label/value pair +// ** within an object, then set pPath->iLabel to the start of the corresponding +// ** label, before returning. +// ** +// ** Return one of the JSON_LOOKUP error codes if problems are seen. +// ** +// ** This routine will also modify the blob. If pParse->eEdit is one of +// ** JEDIT_DEL, JEDIT_REPL, JEDIT_INS, or JEDIT_SET, then changes might be +// ** made to the selected value. If an edit is performed, then the return +// ** value does not necessarily point to the select element. If an edit +// ** is performed, the return value is only useful for detecting error +// ** conditions. +// */ +func _jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot Tu32, zPath uintptr, iLabel Tu32) (r Tu32) { + bp := tls.Alloc(224) + defer tls.Free(224) + var i, iEnd, j, k, n, nIns, nKey, rc, v Tu32 + var nn uint32 + var rawKey, rawLabel, v3 int32 + var x Tu8 + var zKey, zLabel, p4 uintptr + var _ /* ix at bp+80 */ TJsonParse + var _ /* sz at bp+0 */ Tu32 + var _ /* v at bp+152 */ TJsonParse + var _ /* v at bp+8 */ TJsonParse + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, iEnd, j, k, n, nIns, nKey, nn, rawKey, rawLabel, rc, v, x, zKey, zLabel, v3, p4 + if int32(*(*int8)(unsafe.Pointer(zPath))) == 0 { + if (*TJsonParse)(unsafe.Pointer(pParse)).FeEdit != 0 && _jsonBlobMakeEditable(tls, pParse, (*TJsonParse)(unsafe.Pointer(pParse)).FnIns) != 0 { + n = _jsonbPayloadSize(tls, pParse, iRoot, bp) + *(*Tu32)(unsafe.Pointer(bp)) += n + if int32((*TJsonParse)(unsafe.Pointer(pParse)).FeEdit) == int32(JEDIT_DEL) { + if iLabel > uint32(0) { + *(*Tu32)(unsafe.Pointer(bp)) += iRoot - iLabel + iRoot = iLabel + } + _jsonBlobEdit(tls, pParse, iRoot, *(*Tu32)(unsafe.Pointer(bp)), uintptr(0), uint32(0)) + } else { + if int32((*TJsonParse)(unsafe.Pointer(pParse)).FeEdit) == int32(JEDIT_INS) { + /* Already exists, so json_insert() is a no-op */ + } else { + /* json_set() or json_replace() */ + _jsonBlobEdit(tls, pParse, iRoot, *(*Tu32)(unsafe.Pointer(bp)), (*TJsonParse)(unsafe.Pointer(pParse)).FaIns, (*TJsonParse)(unsafe.Pointer(pParse)).FnIns) + } + } + } + (*TJsonParse)(unsafe.Pointer(pParse)).FiLabel = iLabel + return iRoot + } + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('.') { + rawKey = int32(1) + x = *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(iRoot))) + zPath++ + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('"') { + zKey = zPath + uintptr(1) + i = uint32(1) + for { + if !(*(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0 && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32('"')) { + break + } + goto _1 + _1: + ; + i++ + } + nKey = i - uint32(1) + if *(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0 { + i++ + } else { + return uint32(JSON_LOOKUP_PATHERROR) + } + rawKey = libc.BoolInt32(libc.Xmemchr(tls, zKey, int32('\\'), uint64(nKey)) == uintptr(0)) + } else { + zKey = zPath + i = uint32(0) + for { + if !(*(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0 && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32('.') && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32('[')) { + break + } + goto _2 + _2: + ; + i++ + } + nKey = i + if nKey == uint32(0) { + return uint32(JSON_LOOKUP_PATHERROR) + } + } + if int32(x)&int32(0x0f) != int32(JSONB_OBJECT) { + return uint32(JSON_LOOKUP_NOTFOUND) + } + n = _jsonbPayloadSize(tls, pParse, iRoot, bp) + j = iRoot + n /* j is the index of a label */ + iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < iEnd { + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(j)))) & int32(0x0f)) + if int32(x) < int32(JSONB_TEXT) || int32(x) > int32(JSONB_TEXTRAW) { + return uint32(JSON_LOOKUP_ERROR) + } + n = _jsonbPayloadSize(tls, pParse, j, bp) + if n == uint32(0) { + return uint32(JSON_LOOKUP_ERROR) + } + k = j + n /* k is the index of the label text */ + if k+*(*Tu32)(unsafe.Pointer(bp)) >= iEnd { + return uint32(JSON_LOOKUP_ERROR) + } + zLabel = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(k) + rawLabel = libc.BoolInt32(int32(x) == int32(JSONB_TEXT) || int32(x) == int32(JSONB_TEXTRAW)) + if _jsonLabelCompare(tls, zKey, nKey, rawKey, zLabel, *(*Tu32)(unsafe.Pointer(bp)), rawLabel) != 0 { + v = k + *(*Tu32)(unsafe.Pointer(bp)) /* v is the index of the value */ + if int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(v))))&int32(0x0f) > int32(JSONB_OBJECT) { + return uint32(JSON_LOOKUP_ERROR) + } + n = _jsonbPayloadSize(tls, pParse, v, bp) + if n == uint32(0) || v+n+*(*Tu32)(unsafe.Pointer(bp)) > iEnd { + return uint32(JSON_LOOKUP_ERROR) + } + rc = _jsonLookupStep(tls, pParse, v, zPath+uintptr(i), j) + if (*TJsonParse)(unsafe.Pointer(pParse)).Fdelta != 0 { + _jsonAfterEditSizeAdjust(tls, pParse, iRoot) + } + return rc + } + j = k + *(*Tu32)(unsafe.Pointer(bp)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(j))))&int32(0x0f) > int32(JSONB_OBJECT) { + return uint32(JSON_LOOKUP_ERROR) + } + n = _jsonbPayloadSize(tls, pParse, j, bp) + if n == uint32(0) { + return uint32(JSON_LOOKUP_ERROR) + } + j += n + *(*Tu32)(unsafe.Pointer(bp)) + } + if j > iEnd { + return uint32(JSON_LOOKUP_ERROR) + } + if int32((*TJsonParse)(unsafe.Pointer(pParse)).FeEdit) >= int32(JEDIT_INS) { /* Header of the label to be inserted */ + libc.Xmemset(tls, bp+80, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp + 80))).Fdb = (*TJsonParse)(unsafe.Pointer(pParse)).Fdb + if rawKey != 0 { + v3 = int32(JSONB_TEXTRAW) + } else { + v3 = int32(JSONB_TEXT5) + } + _jsonBlobAppendNode(tls, bp+80, uint8(v3), nKey, uintptr(0)) + p4 = pParse + 47 + *(*Tu8)(unsafe.Pointer(p4)) = Tu8(int32(*(*Tu8)(unsafe.Pointer(p4))) | int32((*(*TJsonParse)(unsafe.Pointer(bp + 80))).Foom)) + rc = _jsonCreateEditSubstructure(tls, pParse, bp+8, zPath+uintptr(i)) + if !(rc >= libc.Uint32FromUint32(JSON_LOOKUP_PATHERROR)) && _jsonBlobMakeEditable(tls, pParse, (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob+nKey+(*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob) != 0 { + nIns = (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob + nKey + (*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob + _jsonBlobEdit(tls, pParse, j, uint32(0), uintptr(0), nIns) + if !((*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0) { + /* Because pParse->oom!=0 */ + /* Because pPasre->oom!=0 */ + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(j), (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FaBlob, uint64((*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob)) + k = j + (*(*TJsonParse)(unsafe.Pointer(bp + 80))).FnBlob + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(k), zKey, uint64(nKey)) + k += nKey + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(k), (*(*TJsonParse)(unsafe.Pointer(bp + 8))).FaBlob, uint64((*(*TJsonParse)(unsafe.Pointer(bp + 8))).FnBlob)) + if (*TJsonParse)(unsafe.Pointer(pParse)).Fdelta != 0 { + _jsonAfterEditSizeAdjust(tls, pParse, iRoot) + } + } + } + _jsonParseReset(tls, bp+8) + _jsonParseReset(tls, bp+80) + return rc + } + } else { + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') { + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(iRoot)))) & int32(0x0f)) + if int32(x) != int32(JSONB_ARRAY) { + return uint32(JSON_LOOKUP_NOTFOUND) + } + n = _jsonbPayloadSize(tls, pParse, iRoot, bp) + k = uint32(0) + i = uint32(1) + for int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + uintptr(i))))])&int32(0x04) != 0 { + k = k*uint32(10) + uint32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) - uint32('0') + i++ + } + if i < uint32(2) || int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32(']') { + if int32(*(*int8)(unsafe.Pointer(zPath + 1))) == int32('#') { + k = _jsonbArrayCount(tls, pParse, iRoot) + i = uint32(2) + if int32(*(*int8)(unsafe.Pointer(zPath + 2))) == int32('-') && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + 3)))])&int32(0x04) != 0 { + nn = uint32(0) + i = uint32(3) + for cond := true; cond; cond = int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + uintptr(i))))])&int32(0x04) != 0 { + nn = nn*uint32(10) + uint32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) - uint32('0') + i++ + } + if nn > k { + return uint32(JSON_LOOKUP_NOTFOUND) + } + k -= nn + } + if int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != int32(']') { + return uint32(JSON_LOOKUP_PATHERROR) + } + } else { + return uint32(JSON_LOOKUP_PATHERROR) + } + } + j = iRoot + n + iEnd = j + *(*Tu32)(unsafe.Pointer(bp)) + for j < iEnd { + if k == uint32(0) { + rc = _jsonLookupStep(tls, pParse, j, zPath+uintptr(i+uint32(1)), uint32(0)) + if (*TJsonParse)(unsafe.Pointer(pParse)).Fdelta != 0 { + _jsonAfterEditSizeAdjust(tls, pParse, iRoot) + } + return rc + } + k-- + n = _jsonbPayloadSize(tls, pParse, j, bp) + if n == uint32(0) { + return uint32(JSON_LOOKUP_ERROR) + } + j += n + *(*Tu32)(unsafe.Pointer(bp)) + } + if j > iEnd { + return uint32(JSON_LOOKUP_ERROR) + } + if k > uint32(0) { + return uint32(JSON_LOOKUP_NOTFOUND) + } + if int32((*TJsonParse)(unsafe.Pointer(pParse)).FeEdit) >= int32(JEDIT_INS) { + rc = _jsonCreateEditSubstructure(tls, pParse, bp+152, zPath+uintptr(i+uint32(1))) + if !(rc >= libc.Uint32FromUint32(JSON_LOOKUP_PATHERROR)) && _jsonBlobMakeEditable(tls, pParse, (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FnBlob) != 0 { + _jsonBlobEdit(tls, pParse, j, uint32(0), (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FaBlob, (*(*TJsonParse)(unsafe.Pointer(bp + 152))).FnBlob) + } + _jsonParseReset(tls, bp+152) + if (*TJsonParse)(unsafe.Pointer(pParse)).Fdelta != 0 { + _jsonAfterEditSizeAdjust(tls, pParse, iRoot) + } + return rc + } + } else { + return uint32(JSON_LOOKUP_PATHERROR) + } + } + return uint32(JSON_LOOKUP_NOTFOUND) +} + +// C documentation +// +// /* +// ** Convert a JSON BLOB into text and make that text the return value +// ** of an SQL function. +// */ +func _jsonReturnTextJsonFromBlob(tls *libc.TLS, ctx uintptr, aBlob uintptr, nBlob Tu32) { + bp := tls.Alloc(208) + defer tls.Free(208) + var _ /* s at bp+72 */ TJsonString + var _ /* x at bp+0 */ TJsonParse + if aBlob == uintptr(0) { + return + } + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob = aBlob + (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob = nBlob + _jsonStringInit(tls, bp+72, ctx) + _jsonTranslateBlobToText(tls, bp, uint32(0), bp+72) + _jsonReturnString(tls, bp+72, uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** Return the value of the BLOB node at index i. +// ** +// ** If the value is a primitive, return it as an SQL value. +// ** If the value is an array or object, return it as either +// ** JSON text or the BLOB encoding, depending on the JSON_B flag +// ** on the userdata. +// */ +func _jsonReturnFromBlob(tls *libc.TLS, pParse uintptr, i Tu32, pCtx uintptr, textOnly int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bNeg, flags, rc, v30 int32 + var c, x int8 + var db, z, z1, z2, zOut uintptr + var iIn, iOut, n, nOut, szEscape, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 Tu32 + var v16 int64 + var _ /* iRes at bp+8 */ Tsqlite3_int64 + var _ /* r at bp+16 */ float64 + var _ /* sz at bp+0 */ Tu32 + var _ /* v at bp+24 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bNeg, c, db, flags, iIn, iOut, n, nOut, rc, szEscape, x, z, z1, z2, zOut, v16, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30 + db = Xsqlite3_context_db_handle(tls, pCtx) + n = _jsonbPayloadSize(tls, pParse, i, bp) + if n == uint32(0) { + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24968, -int32(1)) + return + } + switch int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i)))) & libc.Int32FromInt32(0x0f) { + case JSONB_NULL: + goto _1 + case int32(JSONB_TRUE): + goto _2 + case int32(JSONB_FALSE): + goto _3 + case int32(JSONB_INT): + goto _4 + case int32(JSONB_INT5): + goto _5 + case int32(JSONB_FLOAT): + goto _6 + case int32(JSONB_FLOAT5): + goto _7 + case int32(JSONB_TEXT): + goto _8 + case int32(JSONB_TEXTRAW): + goto _9 + case int32(JSONB_TEXTJ): + goto _10 + case int32(JSONB_TEXT5): + goto _11 + case int32(JSONB_OBJECT): + goto _12 + case int32(JSONB_ARRAY): + goto _13 + default: + goto _14 + } + goto _15 +_1: + ; + if *(*Tu32)(unsafe.Pointer(bp)) != 0 { + goto returnfromblob_malformed + } + Xsqlite3_result_null(tls, pCtx) + goto _15 +_2: + ; + if *(*Tu32)(unsafe.Pointer(bp)) != 0 { + goto returnfromblob_malformed + } + Xsqlite3_result_int(tls, pCtx, int32(1)) + goto _15 +_3: + ; + if *(*Tu32)(unsafe.Pointer(bp)) != 0 { + goto returnfromblob_malformed + } + Xsqlite3_result_int(tls, pCtx, 0) + goto _15 +_5: + ; +_4: + ; + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 + bNeg = 0 + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + goto returnfromblob_malformed + } + x = int8(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pParse)).FaBlob + uintptr(i+n)))) + if int32(x) == int32('-') { + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(2) { + goto returnfromblob_malformed + } + n++ + *(*Tu32)(unsafe.Pointer(bp))-- + bNeg = int32(1) + } + z = _sqlite3DbStrNDup(tls, db, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i+n), uint64(int32(*(*Tu32)(unsafe.Pointer(bp))))) + if z == uintptr(0) { + goto returnfromblob_oom + } + rc = _sqlite3DecOrHexToI64(tls, z, bp+8) + _sqlite3DbFree(tls, db, z) + if rc == 0 { + if bNeg != 0 { + v16 = -*(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) + } else { + v16 = *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) + } + Xsqlite3_result_int64(tls, pCtx, v16) + } else { + if rc == int32(3) && bNeg != 0 { + Xsqlite3_result_int64(tls, pCtx, int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<>libc.Int32FromInt32(6)) + v21 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v21))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))&uint32(0x3f)) + } else { + if *(*Tu32)(unsafe.Pointer(bp + 24)) < uint32(0x10000) { + v22 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v22))) = int8(uint32(0xe0) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(12)) + v23 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v23))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(6)&uint32(0x3f)) + v24 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v24))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))&uint32(0x3f)) + } else { + if *(*Tu32)(unsafe.Pointer(bp + 24)) == uint32(JSON_INVALID_CHAR) { + /* Silently ignore illegal unicode */ + } else { + v25 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v25))) = int8(uint32(0xf0) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(18)) + v26 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v26))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(12)&uint32(0x3f)) + v27 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v27))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))>>libc.Int32FromInt32(6)&uint32(0x3f)) + v28 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v28))) = int8(uint32(0x80) | *(*Tu32)(unsafe.Pointer(bp + 24))&uint32(0x3f)) + } + } + } + } + iIn += szEscape - uint32(1) + } else { + v29 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zOut + uintptr(v29))) = c + } + goto _17 + _17: + ; + iIn++ + } /* end for() */ + *(*int8)(unsafe.Pointer(zOut + uintptr(iOut))) = 0 + Xsqlite3_result_text(tls, pCtx, zOut, int32(iOut), __ccgo_fp(_sqlite3OomClear)) + goto _15 +_13: + ; +_12: + ; + if textOnly != 0 { + v30 = 0 + } else { + v30 = int32(int64(Xsqlite3_user_data(tls, pCtx))) + } + flags = v30 + if flags&int32(JSON_BLOB) != 0 { + Xsqlite3_result_blob(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i), int32(*(*Tu32)(unsafe.Pointer(bp))+n), uintptr(-libc.Int32FromInt32(1))) + } else { + _jsonReturnTextJsonFromBlob(tls, pCtx, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob+uintptr(i), *(*Tu32)(unsafe.Pointer(bp))+n) + } + goto _15 +_14: + ; + goto returnfromblob_malformed +_15: + ; + return +returnfromblob_oom: + ; + Xsqlite3_result_error_nomem(tls, pCtx) + return +returnfromblob_malformed: + ; + Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24968, -int32(1)) + return +} + +// C documentation +// +// /* +// ** pArg is a function argument that might be an SQL value or a JSON +// ** value. Figure out what it is and encode it as a JSONB blob. +// ** Return the results in pParse. +// ** +// ** pParse is uninitialized upon entry. This routine will handle the +// ** initialization of pParse. The result will be contained in +// ** pParse->aBlob and pParse->nBlob. pParse->aBlob might be dynamically +// ** allocated (if pParse->nBlobAlloc is greater than zero) in which case +// ** the caller is responsible for freeing the space allocated to pParse->aBlob +// ** when it has finished with it. Or pParse->aBlob might be a static string +// ** or a value obtained from sqlite3_value_blob(pArg). +// ** +// ** If the argument is a BLOB that is clearly not a JSONB, then this +// ** function might set an error message in ctx and return non-zero. +// ** It might also set an error message and return non-zero on an OOM error. +// */ +func _jsonFunctionArgToBlob(tls *libc.TLS, ctx uintptr, pArg uintptr, pParse uintptr) (r1 int32) { + var eType, n, n1, nJson int32 + var r float64 + var z, z1, zJson uintptr + _, _, _, _, _, _, _, _ = eType, n, n1, nJson, r, z, z1, zJson + eType = Xsqlite3_value_type(tls, pArg) + libc.Xmemset(tls, pParse, 0, uint64(72)) + (*TJsonParse)(unsafe.Pointer(pParse)).Fdb = Xsqlite3_context_db_handle(tls, ctx) + switch eType { + default: + (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = uintptr(unsafe.Pointer(&_aNull)) + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(1) + return 0 + case int32(SQLITE_BLOB): + if _jsonFuncArgMightBeBinary(tls, pArg) != 0 { + (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob = Xsqlite3_value_blob(tls, pArg) + (*TJsonParse)(unsafe.Pointer(pParse)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) + } else { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24939, -int32(1)) + return int32(1) + } + case int32(SQLITE_TEXT): + zJson = Xsqlite3_value_text(tls, pArg) + nJson = Xsqlite3_value_bytes(tls, pArg) + if zJson == uintptr(0) { + return int32(1) + } + if Xsqlite3_value_subtype(tls, pArg) == uint32(JSON_SUBTYPE) { + (*TJsonParse)(unsafe.Pointer(pParse)).FzJson = zJson + (*TJsonParse)(unsafe.Pointer(pParse)).FnJson = nJson + if _jsonConvertTextToBlob(tls, pParse, ctx) != 0 { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + _sqlite3DbFree(tls, (*TJsonParse)(unsafe.Pointer(pParse)).Fdb, (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob) + libc.Xmemset(tls, pParse, 0, uint64(72)) + return int32(1) + } + } else { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_TEXTRAW), uint32(nJson), zJson) + } + case int32(SQLITE_FLOAT): + r = Xsqlite3_value_double(tls, pArg) + if _sqlite3IsNaN(tls, r) != 0 { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_NULL), uint32(0), uintptr(0)) + } else { + n = Xsqlite3_value_bytes(tls, pArg) + z = Xsqlite3_value_text(tls, pArg) + if z == uintptr(0) { + return int32(1) + } + if int32(*(*int8)(unsafe.Pointer(z))) == int32('I') { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(5), __ccgo_ts+25073) + } else { + if int32(*(*int8)(unsafe.Pointer(z))) == int32('-') && int32(*(*int8)(unsafe.Pointer(z + 1))) == int32('I') { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(6), __ccgo_ts+25066) + } else { + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_FLOAT), uint32(n), z) + } + } + } + case int32(SQLITE_INTEGER): + n1 = Xsqlite3_value_bytes(tls, pArg) + z1 = Xsqlite3_value_text(tls, pArg) + if z1 == uintptr(0) { + return int32(1) + } + _jsonBlobAppendNode(tls, pParse, uint8(JSONB_INT), uint32(n1), z1) + break + } + if (*TJsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + Xsqlite3_result_error_nomem(tls, ctx) + return int32(1) + } else { + return 0 + } + return r1 +} + +var _aNull = [1]Tu8{} + +// C documentation +// +// /* +// ** Generate a bad path error. +// ** +// ** If ctx is not NULL then push the error message into ctx and return NULL. +// ** If ctx is NULL, then return the text of the error message. +// */ +func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var zMsg uintptr + _ = zMsg + zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25107, libc.VaList(bp+8, zPath)) + if ctx == uintptr(0) { + return zMsg + } + if zMsg != 0 { + Xsqlite3_result_error(tls, ctx, zMsg, -int32(1)) + Xsqlite3_free(tls, zMsg) + } else { + Xsqlite3_result_error_nomem(tls, ctx) + } + return uintptr(0) +} + +// C documentation +// +// /* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent +// ** arguments come in parse where each pair contains a JSON path and +// ** content to insert or set at that patch. Do the updates +// ** and return the result. +// ** +// ** The specific operation is determined by eEdit, which can be one +// ** of JEDIT_INS, JEDIT_REPL, or JEDIT_SET. +// */ +func _jsonInsertIntoBlob(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr, eEdit int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var flgs, i, v1 int32 + var p, zPath uintptr + var rc Tu32 + var _ /* ax at bp+0 */ TJsonParse + _, _, _, _, _, _ = flgs, i, p, rc, zPath, v1 + rc = uint32(0) + zPath = uintptr(0) + if argc == int32(1) { + v1 = 0 + } else { + v1 = int32(JSON_EDITABLE) + } + flgs = v1 + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(flgs)) + if p == uintptr(0) { + return + } + i = int32(1) + for { + if !(i < argc-int32(1)) { + break + } + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) == int32(SQLITE_NULL) { + goto _2 + } + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if zPath == uintptr(0) { + Xsqlite3_result_error_nomem(tls, ctx) + _jsonParseFree(tls, p) + return + } + if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('$') { + goto jsonInsertIntoBlob_patherror + } + if _jsonFunctionArgToBlob(tls, ctx, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8)), bp) != 0 { + _jsonParseReset(tls, bp) + _jsonParseFree(tls, p) + return + } + if int32(*(*int8)(unsafe.Pointer(zPath + 1))) == 0 { + if eEdit == int32(JEDIT_REPL) || eEdit == int32(JEDIT_SET) { + _jsonBlobEdit(tls, p, uint32(0), (*TJsonParse)(unsafe.Pointer(p)).FnBlob, (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob, (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob) + } + rc = uint32(0) + } else { + (*TJsonParse)(unsafe.Pointer(p)).FeEdit = uint8(eEdit) + (*TJsonParse)(unsafe.Pointer(p)).FnIns = (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob + (*TJsonParse)(unsafe.Pointer(p)).FaIns = (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob + (*TJsonParse)(unsafe.Pointer(p)).Fdelta = 0 + rc = _jsonLookupStep(tls, p, uint32(0), zPath+uintptr(1), uint32(0)) + } + _jsonParseReset(tls, bp) + if rc == uint32(JSON_LOOKUP_NOTFOUND) { + goto _2 + } + if rc >= uint32(JSON_LOOKUP_PATHERROR) { + goto jsonInsertIntoBlob_patherror + } + goto _2 + _2: + ; + i += int32(2) + } + _jsonReturnParse(tls, ctx, p) + _jsonParseFree(tls, p) + return +jsonInsertIntoBlob_patherror: + ; + _jsonParseFree(tls, p) + if rc == uint32(JSON_LOOKUP_ERROR) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + } else { + _jsonBadPathError(tls, ctx, zPath) + } + return +} + +// C documentation +// +// /* +// ** If pArg is a blob that seems like a JSONB blob, then initialize +// ** p to point to that JSONB and return TRUE. If pArg does not seem like +// ** a JSONB blob, then return FALSE; +// ** +// ** This routine is only called if it is already known that pArg is a +// ** blob. The only open question is whether or not the blob appears +// ** to be a JSONB blob. +// */ +func _jsonArgIsJsonb(tls *libc.TLS, pArg uintptr, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var n, v1 Tu32 + var v2 bool + var _ /* sz at bp+0 */ Tu32 + _, _, _ = n, v1, v2 + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + (*TJsonParse)(unsafe.Pointer(p)).FaBlob = Xsqlite3_value_blob(tls, pArg) + (*TJsonParse)(unsafe.Pointer(p)).FnBlob = uint32(Xsqlite3_value_bytes(tls, pArg)) + if (*TJsonParse)(unsafe.Pointer(p)).FnBlob == uint32(0) { + (*TJsonParse)(unsafe.Pointer(p)).FaBlob = uintptr(0) + return 0 + } + if (*TJsonParse)(unsafe.Pointer(p)).FaBlob == uintptr(0) { + return 0 + } + if v2 = int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob)))&int32(0x0f) <= int32(JSONB_OBJECT); v2 { + v1 = _jsonbPayloadSize(tls, p, uint32(0), bp) + n = v1 + } + if v2 && v1 > uint32(0) && *(*Tu32)(unsafe.Pointer(bp))+n == (*TJsonParse)(unsafe.Pointer(p)).FnBlob && (int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob)))&int32(0x0f) > int32(JSONB_FALSE) || *(*Tu32)(unsafe.Pointer(bp)) == uint32(0)) { + return int32(1) + } + (*TJsonParse)(unsafe.Pointer(p)).FaBlob = uintptr(0) + (*TJsonParse)(unsafe.Pointer(p)).FnBlob = uint32(0) + return 0 +} + +// C documentation +// +// /* +// ** Generate a JsonParse object, containing valid JSONB in aBlob and nBlob, +// ** from the SQL function argument pArg. Return a pointer to the new +// ** JsonParse object. +// ** +// ** Ownership of the new JsonParse object is passed to the caller. The +// ** caller should invoke jsonParseFree() on the return value when it +// ** has finished using it. +// ** +// ** If any errors are detected, an appropriate error messages is set +// ** using sqlite3_result_error() or the equivalent and this routine +// ** returns NULL. This routine also returns NULL if the pArg argument +// ** is an SQL NULL value, but no error message is set in that case. This +// ** is so that SQL functions that are given NULL arguments will return +// ** a NULL value. +// */ +func _jsonParseFuncArg(tls *libc.TLS, ctx uintptr, pArg uintptr, flgs Tu32) (r uintptr) { + var db, p, pFromCache, zNew, v2 uintptr + var eType, isRCStr, rc int32 + var nBlob, v1 Tu32 + _, _, _, _, _, _, _, _, _, _ = db, eType, isRCStr, nBlob, p, pFromCache, rc, zNew, v1, v2 /* Datatype of pArg */ + p = uintptr(0) /* Value to be returned */ + pFromCache = uintptr(0) /* The database connection */ + eType = Xsqlite3_value_type(tls, pArg) + if eType == int32(SQLITE_NULL) { + return uintptr(0) + } + pFromCache = _jsonCacheSearch(tls, ctx, pArg) + if pFromCache != 0 { + (*TJsonParse)(unsafe.Pointer(pFromCache)).FnJPRef++ + if flgs&uint32(JSON_EDITABLE) == uint32(0) { + return pFromCache + } + } + db = Xsqlite3_context_db_handle(tls, ctx) +rebuild_from_cache: + ; + p = _sqlite3DbMallocZero(tls, db, uint64(72)) + if p == uintptr(0) { + goto json_pfa_oom + } + libc.Xmemset(tls, p, 0, uint64(72)) + (*TJsonParse)(unsafe.Pointer(p)).Fdb = db + (*TJsonParse)(unsafe.Pointer(p)).FnJPRef = uint32(1) + if pFromCache != uintptr(0) { + nBlob = (*TJsonParse)(unsafe.Pointer(pFromCache)).FnBlob + (*TJsonParse)(unsafe.Pointer(p)).FaBlob = _sqlite3DbMallocRaw(tls, db, uint64(nBlob)) + if (*TJsonParse)(unsafe.Pointer(p)).FaBlob == uintptr(0) { + goto json_pfa_oom + } + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(p)).FaBlob, (*TJsonParse)(unsafe.Pointer(pFromCache)).FaBlob, uint64(nBlob)) + v1 = nBlob + (*TJsonParse)(unsafe.Pointer(p)).FnBlob = v1 + (*TJsonParse)(unsafe.Pointer(p)).FnBlobAlloc = v1 + (*TJsonParse)(unsafe.Pointer(p)).FhasNonstd = (*TJsonParse)(unsafe.Pointer(pFromCache)).FhasNonstd + _jsonParseFree(tls, pFromCache) + return p + } + if eType == int32(SQLITE_BLOB) { + if _jsonArgIsJsonb(tls, pArg, p) != 0 { + if flgs&uint32(JSON_EDITABLE) != uint32(0) && _jsonBlobMakeEditable(tls, p, uint32(0)) == 0 { + goto json_pfa_oom + } + return p + } + /* If the blob is not valid JSONB, fall through into trying to cast + ** the blob into text which is then interpreted as JSON. (tag-20240123-a) + ** + ** This goes against all historical documentation about how the SQLite + ** JSON functions were suppose to work. From the beginning, blob was + ** reserved for expansion and a blob value should have raised an error. + ** But it did not, due to a bug. And many applications came to depend + ** upon this buggy behavior, espeically when using the CLI and reading + ** JSON text using readfile(), which returns a blob. For this reason + ** we will continue to support the bug moving forward. + ** See for example https://sqlite.org/forum/forumpost/012136abd5292b8d + */ + } + (*TJsonParse)(unsafe.Pointer(p)).FzJson = Xsqlite3_value_text(tls, pArg) + (*TJsonParse)(unsafe.Pointer(p)).FnJson = Xsqlite3_value_bytes(tls, pArg) + if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto json_pfa_oom + } + if (*TJsonParse)(unsafe.Pointer(p)).FnJson == 0 { + goto json_pfa_malformed + } + if flgs&uint32(JSON_KEEPERROR) != 0 { + v2 = uintptr(0) + } else { + v2 = ctx + } + if _jsonConvertTextToBlob(tls, p, v2) != 0 { + if flgs&uint32(JSON_KEEPERROR) != 0 { + (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) + return p + } else { + _jsonParseFree(tls, p) + return uintptr(0) + } + } else { + isRCStr = _sqlite3ValueIsOfClass(tls, pArg, __ccgo_fp(_sqlite3RCStrUnref)) + if !(isRCStr != 0) { + zNew = _sqlite3RCStrNew(tls, uint64((*TJsonParse)(unsafe.Pointer(p)).FnJson)) + if zNew == uintptr(0) { + goto json_pfa_oom + } + libc.Xmemcpy(tls, zNew, (*TJsonParse)(unsafe.Pointer(p)).FzJson, uint64((*TJsonParse)(unsafe.Pointer(p)).FnJson)) + (*TJsonParse)(unsafe.Pointer(p)).FzJson = zNew + *(*int8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FzJson + uintptr((*TJsonParse)(unsafe.Pointer(p)).FnJson))) = 0 + } else { + _sqlite3RCStrRef(tls, (*TJsonParse)(unsafe.Pointer(p)).FzJson) + } + (*TJsonParse)(unsafe.Pointer(p)).FbJsonIsRCStr = uint8(1) + rc = _jsonCacheInsert(tls, ctx, p) + if rc == int32(SQLITE_NOMEM) { + goto json_pfa_oom + } + if flgs&uint32(JSON_EDITABLE) != 0 { + pFromCache = p + p = uintptr(0) + goto rebuild_from_cache + } + } + return p +json_pfa_malformed: + ; + if flgs&uint32(JSON_KEEPERROR) != 0 { + (*TJsonParse)(unsafe.Pointer(p)).FnErr = uint8(1) + return p + } else { + _jsonParseFree(tls, p) + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + return uintptr(0) + } +json_pfa_oom: + ; + _jsonParseFree(tls, pFromCache) + _jsonParseFree(tls, p) + Xsqlite3_result_error_nomem(tls, ctx) + return uintptr(0) +} + +// C documentation +// +// /* +// ** Make the return value of a JSON function either the raw JSONB blob +// ** or make it JSON text, depending on whether the JSON_BLOB flag is +// ** set on the function. +// */ +func _jsonReturnParse(tls *libc.TLS, ctx uintptr, p uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var flgs int32 + var _ /* s at bp+0 */ TJsonString + _ = flgs + if (*TJsonParse)(unsafe.Pointer(p)).Foom != 0 { + Xsqlite3_result_error_nomem(tls, ctx) + return + } + flgs = int32(int64(Xsqlite3_user_data(tls, ctx))) + if flgs&int32(JSON_BLOB) != 0 { + if (*TJsonParse)(unsafe.Pointer(p)).FnBlobAlloc > uint32(0) && !((*TJsonParse)(unsafe.Pointer(p)).FbReadOnly != 0) { + Xsqlite3_result_blob(tls, ctx, (*TJsonParse)(unsafe.Pointer(p)).FaBlob, int32((*TJsonParse)(unsafe.Pointer(p)).FnBlob), __ccgo_fp(_sqlite3OomClear)) + (*TJsonParse)(unsafe.Pointer(p)).FnBlobAlloc = uint32(0) + } else { + Xsqlite3_result_blob(tls, ctx, (*TJsonParse)(unsafe.Pointer(p)).FaBlob, int32((*TJsonParse)(unsafe.Pointer(p)).FnBlob), uintptr(-libc.Int32FromInt32(1))) + } + } else { + _jsonStringInit(tls, bp, ctx) + (*TJsonParse)(unsafe.Pointer(p)).Fdelta = 0 + _jsonTranslateBlobToText(tls, p, uint32(0), bp) + _jsonReturnString(tls, bp, p, ctx) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } +} + +/**************************************************************************** +** SQL functions used for testing and debugging +****************************************************************************/ + +/**************************************************************************** +** Scalar SQL function implementations +****************************************************************************/ + +// C documentation +// +// /* +// ** Implementation of the json_quote(VALUE) function. Return a JSON value +// ** corresponding to the SQL value input. Mostly this means putting +// ** double-quotes around strings and returning the unquoted string "null" +// ** when given a NULL input. +// */ +func _jsonQuoteFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var _ /* jx at bp+0 */ TJsonString + _ = argc + _jsonStringInit(tls, bp, ctx) + _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv))) + _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// C documentation +// +// /* +// ** Implementation of the json_array(VALUE,...) function. Return a JSON +// ** array that contains all values given in arguments. Or if any argument +// ** is a BLOB, throw an error. +// */ +func _jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var i int32 + var _ /* jx at bp+0 */ TJsonString + _ = i + _jsonStringInit(tls, bp, ctx) + _jsonAppendChar(tls, bp, int8('[')) + i = 0 + for { + if !(i < argc) { + break + } + _jsonAppendSeparator(tls, bp) + _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + _jsonAppendChar(tls, bp, int8(']')) + _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// C documentation +// +// /* +// ** json_array_length(JSON) +// ** json_array_length(JSON, PATH) +// ** +// ** Return the number of elements in the top-level JSON array. +// ** Return 0 if the input is not a well-formed JSON array. +// */ +func _jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var cnt Tsqlite3_int64 + var eErr Tu8 + var i Tu32 + var p, zPath, v1 uintptr + _, _, _, _, _, _ = cnt, eErr, i, p, zPath, v1 /* The parse */ + cnt = 0 + eErr = uint8(0) + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(0)) + if p == uintptr(0) { + return + } + if argc == int32(2) { + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zPath == uintptr(0) { + _jsonParseFree(tls, p) + return + } + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { + v1 = zPath + uintptr(1) + } else { + v1 = __ccgo_ts + 25125 + } + i = _jsonLookupStep(tls, p, uint32(0), v1, uint32(0)) + if i >= uint32(JSON_LOOKUP_PATHERROR) { + if i == uint32(JSON_LOOKUP_NOTFOUND) { + /* no-op */ + } else { + if i == uint32(JSON_LOOKUP_PATHERROR) { + _jsonBadPathError(tls, ctx, zPath) + } else { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + } + } + eErr = uint8(1) + i = uint32(0) + } + } else { + i = uint32(0) + } + if int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f) == int32(JSONB_ARRAY) { + cnt = int64(_jsonbArrayCount(tls, p, i)) + } + if !(eErr != 0) { + Xsqlite3_result_int64(tls, ctx, cnt) + } + _jsonParseFree(tls, p) +} + +// C documentation +// +// /* True if the string is all digits */ +func _jsonAllDigits(tls *libc.TLS, z uintptr, n int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < n && int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))])&int32(0x04) != 0) { + break + } + goto _1 + _1: + ; + i++ + } + return libc.BoolInt32(i == n) +} + +// C documentation +// +// /* True if the string is all alphanumerics and underscores */ +func _jsonAllAlphanum(tls *libc.TLS, z uintptr, n int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < n && (int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))])&int32(0x06) != 0 || int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32('_'))) { + break + } + goto _1 + _1: + ; + i++ + } + return libc.BoolInt32(i == n) +} + +// C documentation +// +// /* +// ** json_extract(JSON, PATH, ...) +// ** "->"(JSON,PATH) +// ** "->>"(JSON,PATH) +// ** +// ** Return the element described by PATH. Return NULL if that PATH element +// ** is not found. +// ** +// ** If JSON_JSON is set or if more that one PATH argument is supplied then +// ** always return a JSON representation of the result. If JSON_SQL is set, +// ** then always return an SQL representation of the result. If neither flag +// ** is present and argc==2, then return JSON for objects and arrays and SQL +// ** for all other values. +// ** +// ** When multiple PATH arguments are supplied, the result is a JSON array +// ** containing the result of each PATH. +// ** +// ** Abbreviated JSON path expressions are allows if JSON_ABPATH, for +// ** compatibility with PG. +// */ +func _jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var flags, i, nPath int32 + var j Tu32 + var p, zPath uintptr + var _ /* jx at bp+0 */ TJsonString + _, _, _, _, _, _ = flags, i, j, nPath, p, zPath + p = uintptr(0) /* String for array result */ + if argc < int32(2) { + return + } + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(0)) + if p == uintptr(0) { + return + } + flags = int32(int64(Xsqlite3_user_data(tls, ctx))) + _jsonStringInit(tls, bp, ctx) + if argc > int32(2) { + _jsonAppendChar(tls, bp, int8('[')) + } + i = int32(1) + for { + if !(i < argc) { + break + } + /* With a single PATH argument */ + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if zPath == uintptr(0) { + goto json_extract_error + } + nPath = _sqlite3Strlen30(tls, zPath) + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('$') { + j = _jsonLookupStep(tls, p, uint32(0), zPath+uintptr(1), uint32(0)) + } else { + if flags&int32(JSON_ABPATH) != 0 { + /* The -> and ->> operators accept abbreviated PATH arguments. This + ** is mostly for compatibility with PostgreSQL, but also for + ** convenience. + ** + ** NUMBER ==> $[NUMBER] // PG compatible + ** LABEL ==> $.LABEL // PG compatible + ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience + */ + _jsonStringInit(tls, bp, ctx) + if _jsonAllDigits(tls, zPath, nPath) != 0 { + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25127, uint32(1)) + _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+5193, uint32(2)) + } else { + if _jsonAllAlphanum(tls, zPath, nPath) != 0 { + _jsonAppendRawNZ(tls, bp, __ccgo_ts+1693, uint32(1)) + _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) + } else { + if int32(*(*int8)(unsafe.Pointer(zPath))) == int32('[') && nPath >= int32(3) && int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nPath-int32(1))))) == int32(']') { + _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) + } else { + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25129, uint32(2)) + _jsonAppendRaw(tls, bp, zPath, uint32(nPath)) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+25132, uint32(1)) + } + } + } + _jsonStringTerminate(tls, bp) + j = _jsonLookupStep(tls, p, uint32(0), (*(*TJsonString)(unsafe.Pointer(bp))).FzBuf, uint32(0)) + _jsonStringReset(tls, bp) + } else { + _jsonBadPathError(tls, ctx, zPath) + goto json_extract_error + } + } + if j < (*TJsonParse)(unsafe.Pointer(p)).FnBlob { + if argc == int32(2) { + if flags&int32(JSON_JSON) != 0 { + _jsonStringInit(tls, bp, ctx) + _jsonTranslateBlobToText(tls, p, j, bp) + _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) + _jsonStringReset(tls, bp) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } else { + _jsonReturnFromBlob(tls, p, j, ctx, 0) + if flags&(libc.Int32FromInt32(JSON_SQL)|libc.Int32FromInt32(JSON_BLOB)) == 0 && int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(j))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } + } + } else { + _jsonAppendSeparator(tls, bp) + _jsonTranslateBlobToText(tls, p, j, bp) + } + } else { + if j == uint32(JSON_LOOKUP_NOTFOUND) { + if argc == int32(2) { + goto json_extract_error /* Return NULL if not found */ + } else { + _jsonAppendSeparator(tls, bp) + _jsonAppendRawNZ(tls, bp, __ccgo_ts+1666, uint32(4)) + } + } else { + if j == uint32(JSON_LOOKUP_ERROR) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + goto json_extract_error + } else { + _jsonBadPathError(tls, ctx, zPath) + goto json_extract_error + } + } + } + goto _1 + _1: + ; + i++ + } + if argc > int32(2) { + _jsonAppendChar(tls, bp, int8(']')) + _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) + if flags&int32(JSON_BLOB) == 0 { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } + } +json_extract_error: + ; + _jsonStringReset(tls, bp) + _jsonParseFree(tls, p) + return +} + +/* +** Return codes for jsonMergePatch() + */ + +// C documentation +// +// /* +// ** RFC-7396 MergePatch for two JSONB blobs. +// ** +// ** pTarget is the target. pPatch is the patch. The target is updated +// ** in place. The patch is read-only. +// ** +// ** The original RFC-7396 algorithm is this: +// ** +// ** define MergePatch(Target, Patch): +// ** if Patch is an Object: +// ** if Target is not an Object: +// ** Target = {} # Ignore the contents and set it to an empty Object +// ** for each Name/Value pair in Patch: +// ** if Value is null: +// ** if Name exists in Target: +// ** remove the Name/Value pair from Target +// ** else: +// ** Target[Name] = MergePatch(Target[Name], Value) +// ** return Target +// ** else: +// ** return Patch +// ** +// ** Here is an equivalent algorithm restructured to show the actual +// ** implementation: +// ** +// ** 01 define MergePatch(Target, Patch): +// ** 02 if Patch is not an Object: +// ** 03 return Patch +// ** 04 else: // if Patch is an Object +// ** 05 if Target is not an Object: +// ** 06 Target = {} +// ** 07 for each Name/Value pair in Patch: +// ** 08 if Name exists in Target: +// ** 09 if Value is null: +// ** 10 remove the Name/Value pair from Target +// ** 11 else +// ** 12 Target[name] = MergePatch(Target[Name], Value) +// ** 13 else if Value is not NULL: +// ** 14 if Value is not an Object: +// ** 15 Target[name] = Value +// ** 16 else: +// ** 17 Target[name] = MergePatch('{}',value) +// ** 18 return Target +// ** | +// ** ^---- Line numbers referenced in comments in the implementation +// */ +func _jsonMergePatch(tls *libc.TLS, pTarget uintptr, iTarget Tu32, pPatch uintptr, iPatch Tu32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ePLabel, eTLabel, x Tu8 + var iPCursor, iPEnd, iPLabel, iPValue, iTCursor, iTEnd, iTEndBE, iTLabel, iTStart, iTValue, n, nPLabel, nPValue, nTLabel, nTValue, szNew, szPatch, szTarget Tu32 + var isEqual, rc, rc1, savedDelta, savedDelta1, v1, v2 int32 + var _ /* sz at bp+0 */ Tu32 + var _ /* szPLabel at bp+12 */ Tu32 + var _ /* szPValue at bp+16 */ Tu32 + var _ /* szTLabel at bp+4 */ Tu32 + var _ /* szTValue at bp+8 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ePLabel, eTLabel, iPCursor, iPEnd, iPLabel, iPValue, iTCursor, iTEnd, iTEndBE, iTLabel, iTStart, iTValue, isEqual, n, nPLabel, nPValue, nTLabel, nTValue, rc, rc1, savedDelta, savedDelta1, szNew, szPatch, szTarget, x, v1, v2 + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) /* Node type of the target label */ + iTLabel = uint32(0) /* Index of the label */ + nTLabel = uint32(0) /* Header size in bytes for the target label */ + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) /* Size of the target label payload */ + iTValue = uint32(0) /* Index of the target value */ + nTValue = uint32(0) /* Header size of the target value */ + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Payload size of the patch value */ + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob + uintptr(iPatch)))) & int32(0x0f)) + if int32(x) != int32(JSONB_OBJECT) { /* Total size of the target, header+payload */ + n = _jsonbPayloadSize(tls, pPatch, iPatch, bp) + szPatch = n + *(*Tu32)(unsafe.Pointer(bp)) + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + n = _jsonbPayloadSize(tls, pTarget, iTarget, bp) + szTarget = n + *(*Tu32)(unsafe.Pointer(bp)) + _jsonBlobEdit(tls, pTarget, iTarget, szTarget, (*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob+uintptr(iPatch), szPatch) + if (*TJsonParse)(unsafe.Pointer(pTarget)).Foom != 0 { + v1 = int32(JSON_MERGE_OOM) + } else { + v1 = JSON_MERGE_OK + } + return v1 /* Line 03 */ + } + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob + uintptr(iTarget)))) & int32(0x0f)) + if int32(x) != int32(JSONB_OBJECT) { /* Algorithm line 05 */ + n = _jsonbPayloadSize(tls, pTarget, iTarget, bp) + _jsonBlobEdit(tls, pTarget, iTarget+n, *(*Tu32)(unsafe.Pointer(bp)), uintptr(0), uint32(0)) + x = *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob + uintptr(iTarget))) + *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob + uintptr(iTarget))) = uint8(int32(x)&int32(0xf0) | int32(JSONB_OBJECT)) + } + n = _jsonbPayloadSize(tls, pPatch, iPatch, bp) + if n == uint32(0) { + return int32(JSON_MERGE_BADPATCH) + } + iPCursor = iPatch + n + iPEnd = iPCursor + *(*Tu32)(unsafe.Pointer(bp)) + n = _jsonbPayloadSize(tls, pTarget, iTarget, bp) + if n == uint32(0) { + return int32(JSON_MERGE_BADTARGET) + } + iTStart = iTarget + n + iTEndBE = iTStart + *(*Tu32)(unsafe.Pointer(bp)) + for iPCursor < iPEnd { /* Algorithm line 07 */ + iPLabel = iPCursor + ePLabel = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob + uintptr(iPCursor)))) & int32(0x0f)) + if int32(ePLabel) < int32(JSONB_TEXT) || int32(ePLabel) > int32(JSONB_TEXTRAW) { + return int32(JSON_MERGE_BADPATCH) + } + nPLabel = _jsonbPayloadSize(tls, pPatch, iPCursor, bp+12) + if nPLabel == uint32(0) { + return int32(JSON_MERGE_BADPATCH) + } + iPValue = iPCursor + nPLabel + *(*Tu32)(unsafe.Pointer(bp + 12)) + if iPValue >= iPEnd { + return int32(JSON_MERGE_BADPATCH) + } + nPValue = _jsonbPayloadSize(tls, pPatch, iPValue, bp+16) + if nPValue == uint32(0) { + return int32(JSON_MERGE_BADPATCH) + } + iPCursor = iPValue + nPValue + *(*Tu32)(unsafe.Pointer(bp + 16)) + if iPCursor > iPEnd { + return int32(JSON_MERGE_BADPATCH) + } + iTCursor = iTStart + iTEnd = iTEndBE + uint32((*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta) + for iTCursor < iTEnd { /* true if the patch and target labels match */ + iTLabel = iTCursor + eTLabel = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob + uintptr(iTCursor)))) & int32(0x0f)) + if int32(eTLabel) < int32(JSONB_TEXT) || int32(eTLabel) > int32(JSONB_TEXTRAW) { + return int32(JSON_MERGE_BADTARGET) + } + nTLabel = _jsonbPayloadSize(tls, pTarget, iTCursor, bp+4) + if nTLabel == uint32(0) { + return int32(JSON_MERGE_BADTARGET) + } + iTValue = iTLabel + nTLabel + *(*Tu32)(unsafe.Pointer(bp + 4)) + if iTValue >= iTEnd { + return int32(JSON_MERGE_BADTARGET) + } + nTValue = _jsonbPayloadSize(tls, pTarget, iTValue, bp+8) + if nTValue == uint32(0) { + return int32(JSON_MERGE_BADTARGET) + } + if iTValue+nTValue+*(*Tu32)(unsafe.Pointer(bp + 8)) > iTEnd { + return int32(JSON_MERGE_BADTARGET) + } + isEqual = _jsonLabelCompare(tls, (*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob+uintptr(iPLabel+nPLabel), *(*Tu32)(unsafe.Pointer(bp + 12)), libc.BoolInt32(int32(ePLabel) == int32(JSONB_TEXT) || int32(ePLabel) == int32(JSONB_TEXTRAW)), (*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob+uintptr(iTLabel+nTLabel), *(*Tu32)(unsafe.Pointer(bp + 4)), libc.BoolInt32(int32(eTLabel) == int32(JSONB_TEXT) || int32(eTLabel) == int32(JSONB_TEXTRAW))) + if isEqual != 0 { + break + } + iTCursor = iTValue + nTValue + *(*Tu32)(unsafe.Pointer(bp + 8)) + } + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob + uintptr(iPValue)))) & int32(0x0f)) + if iTCursor < iTEnd { + /* A match was found. Algorithm line 08 */ + if int32(x) == 0 { + /* Patch value is NULL. Algorithm line 09 */ + _jsonBlobEdit(tls, pTarget, iTLabel, nTLabel+*(*Tu32)(unsafe.Pointer(bp + 4))+nTValue+*(*Tu32)(unsafe.Pointer(bp + 8)), uintptr(0), uint32(0)) + /* vvvvvv----- No OOM on a delete-only edit */ + if (*TJsonParse)(unsafe.Pointer(pTarget)).Foom != 0 { + return int32(JSON_MERGE_OOM) + } + } else { + savedDelta = (*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta + (*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta = 0 + rc = _jsonMergePatch(tls, pTarget, iTValue, pPatch, iPValue) + if rc != 0 { + return rc + } + *(*int32)(unsafe.Pointer(pTarget + 52)) += savedDelta + } + } else { + if int32(x) > 0 { /* Algorithm line 13 */ + /* No match and patch value is not NULL */ + szNew = *(*Tu32)(unsafe.Pointer(bp + 12)) + nPLabel + if int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob + uintptr(iPValue))))&int32(0x0f) != int32(JSONB_OBJECT) { /* Line 14 */ + _jsonBlobEdit(tls, pTarget, iTEnd, uint32(0), uintptr(0), *(*Tu32)(unsafe.Pointer(bp + 16))+nPValue+szNew) + if (*TJsonParse)(unsafe.Pointer(pTarget)).Foom != 0 { + return int32(JSON_MERGE_OOM) + } + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob+uintptr(iTEnd), (*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob+uintptr(iPLabel), uint64(szNew)) + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob+uintptr(iTEnd+szNew), (*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob+uintptr(iPValue), uint64(*(*Tu32)(unsafe.Pointer(bp + 16))+nPValue)) + } else { + _jsonBlobEdit(tls, pTarget, iTEnd, uint32(0), uintptr(0), szNew+uint32(1)) + if (*TJsonParse)(unsafe.Pointer(pTarget)).Foom != 0 { + return int32(JSON_MERGE_OOM) + } + libc.Xmemcpy(tls, (*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob+uintptr(iTEnd), (*TJsonParse)(unsafe.Pointer(pPatch)).FaBlob+uintptr(iPLabel), uint64(szNew)) + *(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(pTarget)).FaBlob + uintptr(iTEnd+szNew))) = uint8(0x00) + savedDelta1 = (*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta + (*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta = 0 + rc1 = _jsonMergePatch(tls, pTarget, iTEnd+szNew, pPatch, iPValue) + if rc1 != 0 { + return rc1 + } + *(*int32)(unsafe.Pointer(pTarget + 52)) += savedDelta1 + } + } + } + } + if (*TJsonParse)(unsafe.Pointer(pTarget)).Fdelta != 0 { + _jsonAfterEditSizeAdjust(tls, pTarget, iTarget) + } + if (*TJsonParse)(unsafe.Pointer(pTarget)).Foom != 0 { + v2 = int32(JSON_MERGE_OOM) + } else { + v2 = JSON_MERGE_OK + } + return v2 +} + +// C documentation +// +// /* +// ** Implementation of the json_mergepatch(JSON1,JSON2) function. Return a JSON +// ** object that is the result of running the RFC 7396 MergePatch() algorithm +// ** on the two arguments. +// */ +func _jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var pPatch, pTarget uintptr + var rc int32 + _, _, _ = pPatch, pTarget, rc /* Result code */ + _ = argc + pTarget = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(JSON_EDITABLE)) + if pTarget == uintptr(0) { + return + } + pPatch = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint32(0)) + if pPatch != 0 { + rc = _jsonMergePatch(tls, pTarget, uint32(0), pPatch, uint32(0)) + if rc == JSON_MERGE_OK { + _jsonReturnParse(tls, ctx, pTarget) + } else { + if rc == int32(JSON_MERGE_OOM) { + Xsqlite3_result_error_nomem(tls, ctx) + } else { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + } + } + _jsonParseFree(tls, pPatch) + } + _jsonParseFree(tls, pTarget) +} + +// C documentation +// +// /* +// ** Implementation of the json_object(NAME,VALUE,...) function. Return a JSON +// ** object that contains all name/value given in arguments. Or if any name +// ** is not a string or if any value is a BLOB, throw an error. +// */ +func _jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var i int32 + var n Tu32 + var z uintptr + var _ /* jx at bp+0 */ TJsonString + _, _, _ = i, n, z + if argc&int32(1) != 0 { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25134, -int32(1)) + return + } + _jsonStringInit(tls, bp, ctx) + _jsonAppendChar(tls, bp, int8('{')) + i = 0 + for { + if !(i < argc) { + break + } + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != int32(SQLITE_TEXT) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25185, -int32(1)) + _jsonStringReset(tls, bp) + return + } + _jsonAppendSeparator(tls, bp) + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + n = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + _jsonAppendString(tls, bp, z, n) + _jsonAppendChar(tls, bp, int8(':')) + _jsonAppendSqlValue(tls, bp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i+int32(1))*8))) + goto _1 + _1: + ; + i += int32(2) + } + _jsonAppendChar(tls, bp, int8('}')) + _jsonReturnString(tls, bp, uintptr(0), uintptr(0)) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// C documentation +// +// /* +// ** json_remove(JSON, PATH, ...) +// ** +// ** Remove the named elements from JSON and return the result. malformed +// ** JSON or PATH arguments result in an error. +// */ +func _jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var i, v1 int32 + var p, zPath uintptr + var rc Tu32 + _, _, _, _, _ = i, p, rc, zPath, v1 /* The parse */ + zPath = uintptr(0) /* Subroutine return code */ + if argc < int32(1) { + return + } + if argc > int32(1) { + v1 = int32(JSON_EDITABLE) + } else { + v1 = 0 + } + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(v1)) + if p == uintptr(0) { + return + } + i = int32(1) + for { + if !(i < argc) { + break + } + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if zPath == uintptr(0) { + goto json_remove_done + } + if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('$') { + goto json_remove_patherror + } + if int32(*(*int8)(unsafe.Pointer(zPath + 1))) == 0 { + /* json_remove(j,'$') returns NULL */ + goto json_remove_done + } + (*TJsonParse)(unsafe.Pointer(p)).FeEdit = uint8(JEDIT_DEL) + (*TJsonParse)(unsafe.Pointer(p)).Fdelta = 0 + rc = _jsonLookupStep(tls, p, uint32(0), zPath+uintptr(1), uint32(0)) + if rc >= uint32(JSON_LOOKUP_PATHERROR) { + if rc == uint32(JSON_LOOKUP_NOTFOUND) { + goto _2 /* No-op */ + } else { + if rc == uint32(JSON_LOOKUP_PATHERROR) { + _jsonBadPathError(tls, ctx, zPath) + } else { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + } + } + goto json_remove_done + } + goto _2 + _2: + ; + i++ + } + _jsonReturnParse(tls, ctx, p) + _jsonParseFree(tls, p) + return +json_remove_patherror: + ; + _jsonBadPathError(tls, ctx, zPath) +json_remove_done: + ; + _jsonParseFree(tls, p) + return +} + +// C documentation +// +// /* +// ** json_replace(JSON, PATH, VALUE, ...) +// ** +// ** Replace the value at PATH with VALUE. If PATH does not already exist, +// ** this routine is a no-op. If JSON or PATH is malformed, throw an error. +// */ +func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + if argc < int32(1) { + return + } + if argc&int32(1) == 0 { + _jsonWrongNumArgs(tls, ctx, __ccgo_ts+15828) + return + } + _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) +} + +// C documentation +// +// /* +// ** json_set(JSON, PATH, VALUE, ...) +// ** +// ** Set the value at PATH to VALUE. Create the PATH if it does not already +// ** exist. Overwrite existing values that do exist. +// ** If JSON or PATH is malformed, throw an error. +// ** +// ** json_insert(JSON, PATH, VALUE, ...) +// ** +// ** Create PATH and initialize it to VALUE. If PATH already exists, this +// ** routine is a no-op. If JSON or PATH is malformed, throw an error. +// */ +func _jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var bIsSet, flags, v2 int32 + var v1 uintptr + _, _, _, _ = bIsSet, flags, v1, v2 + flags = int32(int64(Xsqlite3_user_data(tls, ctx))) + bIsSet = libc.BoolInt32(flags&int32(JSON_ISSET) != 0) + if argc < int32(1) { + return + } + if argc&int32(1) == 0 { + if bIsSet != 0 { + v1 = __ccgo_ts + 25219 + } else { + v1 = __ccgo_ts + 25223 + } + _jsonWrongNumArgs(tls, ctx, v1) + return + } + if bIsSet != 0 { + v2 = int32(JEDIT_SET) + } else { + v2 = int32(JEDIT_INS) + } + _jsonInsertIntoBlob(tls, ctx, argc, argv, v2) +} + +// C documentation +// +// /* +// ** json_type(JSON) +// ** json_type(JSON, PATH) +// ** +// ** Return the top-level "type" of a JSON string. json_type() raises an +// ** error if either the JSON or PATH inputs are not well-formed. +// */ +func _jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var i Tu32 + var p, zPath uintptr + _, _, _ = i, p, zPath /* The parse */ + zPath = uintptr(0) + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(0)) + if p == uintptr(0) { + return + } + if argc == int32(2) { + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zPath == uintptr(0) { + goto json_type_done + } + if int32(*(*int8)(unsafe.Pointer(zPath))) != int32('$') { + _jsonBadPathError(tls, ctx, zPath) + goto json_type_done + } + i = _jsonLookupStep(tls, p, uint32(0), zPath+uintptr(1), uint32(0)) + if i >= uint32(JSON_LOOKUP_PATHERROR) { + if i == uint32(JSON_LOOKUP_NOTFOUND) { + /* no-op */ + } else { + if i == uint32(JSON_LOOKUP_PATHERROR) { + _jsonBadPathError(tls, ctx, zPath) + } else { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+24968, -int32(1)) + } + } + goto json_type_done + } + } else { + i = uint32(0) + } + Xsqlite3_result_text(tls, ctx, _jsonbType[int32(*(*Tu8)(unsafe.Pointer((*TJsonParse)(unsafe.Pointer(p)).FaBlob + uintptr(i))))&int32(0x0f)], -int32(1), libc.UintptrFromInt32(0)) +json_type_done: + ; + _jsonParseFree(tls, p) +} + +// C documentation +// +// /* +// ** json_valid(JSON) +// ** json_valid(JSON, FLAGS) +// ** +// ** Check the JSON argument to see if it is well-formed. The FLAGS argument +// ** encodes the various constraints on what is meant by "well-formed": +// ** +// ** 0x01 Canonical RFC-8259 JSON text +// ** 0x02 JSON text with optional JSON-5 extensions +// ** 0x04 Superficially appears to be JSONB +// ** 0x08 Strictly well-formed JSONB +// ** +// ** If the FLAGS argument is omitted, it defaults to 1. Useful values for +// ** FLAGS include: +// ** +// ** 1 Strict canonical JSON text +// ** 2 JSON text perhaps with JSON-5 extensions +// ** 4 Superficially appears to be JSONB +// ** 5 Canonical JSON text or superficial JSONB +// ** 6 JSON-5 text or superficial JSONB +// ** 8 Strict JSONB +// ** 9 Canonical JSON text or strict JSONB +// ** 10 JSON-5 text or strict JSONB +// ** +// ** Other flag combinations are redundant. For example, every canonical +// ** JSON text is also well-formed JSON-5 text, so FLAG values 2 and 3 +// ** are the same. Similarly, any input that passes a strict JSONB validation +// ** will also pass the superficial validation so 12 through 15 are the same +// ** as 8 through 11 respectively. +// ** +// ** This routine runs in linear time to validate text and when doing strict +// ** JSONB validation. Superficial JSONB validation is constant time, +// ** assuming the BLOB is already in memory. The performance advantage +// ** of superficial JSONB validation is why that option is provided. +// ** Application developers can choose to do fast superficial validation or +// ** slower strict validation, according to their specific needs. +// ** +// ** Only the lower four bits of the FLAGS argument are currently used. +// ** Higher bits are reserved for future expansion. To facilitate +// ** compatibility, the current implementation raises an error if any bit +// ** in FLAGS is set other than the lower four bits. +// ** +// ** The original circa 2015 implementation of the JSON routines in +// ** SQLite only supported canonical RFC-8259 JSON text and the json_valid() +// ** function only accepted one argument. That is why the default value +// ** for the FLAGS argument is 1, since FLAGS=1 causes this routine to only +// ** recognize canonical RFC-8259 JSON text as valid. The extra FLAGS +// ** argument was added when the JSON routines were extended to support +// ** JSON5-like extensions and binary JSONB stored in BLOBs. +// ** +// ** Return Values: +// ** +// ** * Raise an error if FLAGS is outside the range of 1 to 15. +// ** * Return NULL if the input is NULL +// ** * Return 1 if the input is well-formed. +// ** * Return 0 if the input is not well-formed. +// */ +func _jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(144) + defer tls.Free(144) + var f Ti64 + var flags, res Tu8 + var iErr Tu32 + var p uintptr + var _ /* px at bp+0 */ TJsonParse + var _ /* px at bp+72 */ TJsonParse + _, _, _, _, _ = f, flags, iErr, p, res /* The parse */ + flags = uint8(1) + res = uint8(0) + if argc == int32(2) { + f = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if f < int64(1) || f > int64(15) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+25230, -int32(1)) + return + } + flags = uint8(f & int64(0x0f)) + } + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case int32(SQLITE_NULL): + return + case int32(SQLITE_BLOB): + if _jsonFuncArgMightBeBinary(tls, *(*uintptr)(unsafe.Pointer(argv))) != 0 { + if int32(flags)&int32(0x04) != 0 { + /* Superficial checking only - accomplished by the + ** jsonFuncArgMightBeBinary() call above. */ + res = uint8(1) + } else { + if int32(flags)&int32(0x08) != 0 { + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + iErr = _jsonbValidityCheck(tls, bp, uint32(0), (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob, uint32(1)) + res = libc.BoolUint8(iErr == uint32(0)) + } + } + break + } + fallthrough + default: + if int32(flags)&int32(0x3) == 0 { + break + } + libc.Xmemset(tls, bp+72, 0, uint64(72)) + p = _jsonParseFuncArg(tls, ctx, *(*uintptr)(unsafe.Pointer(argv)), uint32(JSON_KEEPERROR)) + if p != 0 { + if (*TJsonParse)(unsafe.Pointer(p)).Foom != 0 { + Xsqlite3_result_error_nomem(tls, ctx) + } else { + if (*TJsonParse)(unsafe.Pointer(p)).FnErr != 0 { + /* no-op */ + } else { + if int32(flags)&int32(0x02) != 0 || int32((*TJsonParse)(unsafe.Pointer(p)).FhasNonstd) == 0 { + res = uint8(1) + } + } + } + _jsonParseFree(tls, p) + } else { + Xsqlite3_result_error_nomem(tls, ctx) + } + break + } + Xsqlite3_result_int(tls, ctx, int32(res)) +} + +// C documentation +// +// /* +// ** json_error_position(JSON) +// ** +// ** If the argument is NULL, return NULL +// ** +// ** If the argument is BLOB, do a full validity check and return non-zero +// ** if the check fails. The return value is the approximate 1-based offset +// ** to the byte of the element that contains the first error. +// ** +// ** Otherwise interpret the argument is TEXT (even if it is numeric) and +// ** return the 1-based character position for where the parser first recognized +// ** that the input was not valid JSON, or return 0 if the input text looks +// ** ok. JSON-5 extensions are accepted. +// */ +func _jsonErrorFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var iErrPos Ti64 + var k Tu32 + var _ /* s at bp+0 */ TJsonParse + _, _ = iErrPos, k + iErrPos = 0 + _ = argc + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TJsonParse)(unsafe.Pointer(bp))).Fdb = Xsqlite3_context_db_handle(tls, ctx) + if _jsonFuncArgMightBeBinary(tls, *(*uintptr)(unsafe.Pointer(argv))) != 0 { + (*(*TJsonParse)(unsafe.Pointer(bp))).FaBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + iErrPos = int64(_jsonbValidityCheck(tls, bp, uint32(0), (*(*TJsonParse)(unsafe.Pointer(bp))).FnBlob, uint32(1))) + } else { + (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (*(*TJsonParse)(unsafe.Pointer(bp))).FzJson == uintptr(0) { + return + } /* NULL input or OOM */ + (*(*TJsonParse)(unsafe.Pointer(bp))).FnJson = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if _jsonConvertTextToBlob(tls, bp, uintptr(0)) != 0 { + if (*(*TJsonParse)(unsafe.Pointer(bp))).Foom != 0 { + iErrPos = int64(-int32(1)) + } else { + /* Because s.oom is false */ + k = uint32(0) + for { + if !(k < (*(*TJsonParse)(unsafe.Pointer(bp))).FiErr && *(*int8)(unsafe.Pointer((*(*TJsonParse)(unsafe.Pointer(bp))).FzJson + uintptr(k))) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer((*(*TJsonParse)(unsafe.Pointer(bp))).FzJson + uintptr(k))))&int32(0xc0) != int32(0x80) { + iErrPos++ + } + goto _1 + _1: + ; + k++ + } + iErrPos++ + } + } + } + _jsonParseReset(tls, bp) + if iErrPos < 0 { + Xsqlite3_result_error_nomem(tls, ctx) + } else { + Xsqlite3_result_int64(tls, ctx, iErrPos) + } +} + +// C documentation +// +// /**************************************************************************** +// ** Aggregate SQL function implementations +// ****************************************************************************/ +// /* +// ** json_group_array(VALUE) +// ** +// ** Return a JSON array composed of all values in the aggregate. +// */ +func _jsonArrayStep(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var pStr uintptr + _ = pStr + _ = argc + pStr = Xsqlite3_aggregate_context(tls, ctx, int32(136)) + if pStr != 0 { + if (*TJsonString)(unsafe.Pointer(pStr)).FzBuf == uintptr(0) { + _jsonStringInit(tls, pStr, ctx) + _jsonAppendChar(tls, pStr, int8('[')) + } else { + if (*TJsonString)(unsafe.Pointer(pStr)).FnUsed > uint64(1) { + _jsonAppendChar(tls, pStr, int8(',')) + } + } + (*TJsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + _jsonAppendSqlValue(tls, pStr, *(*uintptr)(unsafe.Pointer(argv))) + } +} + +func _jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { + var flags int32 + var pStr uintptr + var v1 Tsqlite3_destructor_type + _, _, _ = flags, pStr, v1 + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + if pStr != 0 { + (*TJsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + _jsonAppendChar(tls, pStr, int8(']')) + flags = int32(int64(Xsqlite3_user_data(tls, ctx))) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + _jsonReturnString(tls, pStr, uintptr(0), uintptr(0)) + return + } else { + if flags&int32(JSON_BLOB) != 0 { + _jsonReturnStringAsBlob(tls, pStr) + if isFinal != 0 { + if !((*TJsonString)(unsafe.Pointer(pStr)).FbStatic != 0) { + _sqlite3RCStrUnref(tls, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf) + } + } else { + _jsonStringTrimOneChar(tls, pStr) + } + return + } else { + if isFinal != 0 { + if (*TJsonString)(unsafe.Pointer(pStr)).FbStatic != 0 { + v1 = uintptr(-libc.Int32FromInt32(1)) + } else { + v1 = __ccgo_fp(_sqlite3RCStrUnref) + } + Xsqlite3_result_text(tls, ctx, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed), v1) + (*TJsonString)(unsafe.Pointer(pStr)).FbStatic = uint8(1) + } else { + Xsqlite3_result_text(tls, ctx, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed), uintptr(-libc.Int32FromInt32(1))) + _jsonStringTrimOneChar(tls, pStr) + } + } + } + } else { + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25287, int32(2), libc.UintptrFromInt32(0)) + } + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +func _jsonArrayValue(tls *libc.TLS, ctx uintptr) { + _jsonArrayCompute(tls, ctx, 0) +} + +func _jsonArrayFinal(tls *libc.TLS, ctx uintptr) { + _jsonArrayCompute(tls, ctx, int32(1)) +} + +// C documentation +// +// /* +// ** This method works for both json_group_array() and json_group_object(). +// ** It works by removing the first element of the group by searching forward +// ** to the first comma (",") that is not within a string and deleting all +// ** text through that comma. +// */ +func _jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var c, v2 int8 + var i uint32 + var inStr, nNest int32 + var pStr, z uintptr + var v3 bool + _, _, _, _, _, _, _, _ = c, i, inStr, nNest, pStr, z, v2, v3 + inStr = 0 + nNest = 0 + _ = argc + _ = argv + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will + ** always have been called to initialize it */ + if !(pStr != 0) { + return + } + z = (*TJsonString)(unsafe.Pointer(pStr)).FzBuf + i = uint32(1) + for { + if v3 = uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed; v3 { + v2 = *(*int8)(unsafe.Pointer(z + uintptr(i))) + c = v2 + } + if !(v3 && (int32(v2) != int32(',') || inStr != 0 || nNest != 0)) { + break + } + if int32(c) == int32('"') { + inStr = libc.BoolInt32(!(inStr != 0)) + } else { + if int32(c) == int32('\\') { + i++ + } else { + if !(inStr != 0) { + if int32(c) == int32('{') || int32(c) == int32('[') { + nNest++ + } + if int32(c) == int32('}') || int32(c) == int32(']') { + nNest-- + } + } + } + } + goto _1 + _1: + ; + i++ + } + if uint64(i) < (*TJsonString)(unsafe.Pointer(pStr)).FnUsed { + *(*Tu64)(unsafe.Pointer(pStr + 24)) -= uint64(i) + libc.Xmemmove(tls, z+1, z+uintptr(i+uint32(1)), (*TJsonString)(unsafe.Pointer(pStr)).FnUsed-uint64(1)) + *(*int8)(unsafe.Pointer(z + uintptr((*TJsonString)(unsafe.Pointer(pStr)).FnUsed))) = 0 + } else { + (*TJsonString)(unsafe.Pointer(pStr)).FnUsed = uint64(1) + } +} + +// C documentation +// +// /* +// ** json_group_obj(NAME,VALUE) +// ** +// ** Return a JSON object composed of all names and values in the aggregate. +// */ +func _jsonObjectStep(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { + var n Tu32 + var pStr, z uintptr + _, _, _ = n, pStr, z + _ = argc + pStr = Xsqlite3_aggregate_context(tls, ctx, int32(136)) + if pStr != 0 { + if (*TJsonString)(unsafe.Pointer(pStr)).FzBuf == uintptr(0) { + _jsonStringInit(tls, pStr, ctx) + _jsonAppendChar(tls, pStr, int8('{')) + } else { + if (*TJsonString)(unsafe.Pointer(pStr)).FnUsed > uint64(1) { + _jsonAppendChar(tls, pStr, int8(',')) + } + } + (*TJsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = uint32(_sqlite3Strlen30(tls, z)) + _jsonAppendString(tls, pStr, z, n) + _jsonAppendChar(tls, pStr, int8(':')) + _jsonAppendSqlValue(tls, pStr, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } +} + +func _jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { + var flags int32 + var pStr uintptr + var v1 Tsqlite3_destructor_type + _, _, _ = flags, pStr, v1 + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + if pStr != 0 { + _jsonAppendChar(tls, pStr, int8('}')) + (*TJsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + flags = int32(int64(Xsqlite3_user_data(tls, ctx))) + if (*TJsonString)(unsafe.Pointer(pStr)).FeErr != 0 { + _jsonReturnString(tls, pStr, uintptr(0), uintptr(0)) + return + } else { + if flags&int32(JSON_BLOB) != 0 { + _jsonReturnStringAsBlob(tls, pStr) + if isFinal != 0 { + if !((*TJsonString)(unsafe.Pointer(pStr)).FbStatic != 0) { + _sqlite3RCStrUnref(tls, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf) + } + } else { + _jsonStringTrimOneChar(tls, pStr) + } + return + } else { + if isFinal != 0 { + if (*TJsonString)(unsafe.Pointer(pStr)).FbStatic != 0 { + v1 = uintptr(-libc.Int32FromInt32(1)) + } else { + v1 = __ccgo_fp(_sqlite3RCStrUnref) + } + Xsqlite3_result_text(tls, ctx, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed), v1) + (*TJsonString)(unsafe.Pointer(pStr)).FbStatic = uint8(1) + } else { + Xsqlite3_result_text(tls, ctx, (*TJsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*TJsonString)(unsafe.Pointer(pStr)).FnUsed), uintptr(-libc.Int32FromInt32(1))) + _jsonStringTrimOneChar(tls, pStr) + } + } + } + } else { + Xsqlite3_result_text(tls, ctx, __ccgo_ts+25290, int32(2), libc.UintptrFromInt32(0)) + } + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +func _jsonObjectValue(tls *libc.TLS, ctx uintptr) { + _jsonObjectCompute(tls, ctx, 0) +} + +func _jsonObjectFinal(tls *libc.TLS, ctx uintptr) { + _jsonObjectCompute(tls, ctx, int32(1)) +} + +// C documentation +// +// /**************************************************************************** +// ** The json_each virtual table +// ****************************************************************************/ +type TJsonParent = struct { + FiHead Tu32 + FiValue Tu32 + FiEnd Tu32 + FnPath Tu32 + FiKey Ti64 +} + +type JsonParent = TJsonParent + +type TJsonParent1 = struct { + FiHead Tu32 + FiValue Tu32 + FiEnd Tu32 + FnPath Tu32 + FiKey Ti64 +} + +type JsonParent1 = TJsonParent1 + +type TJsonEachCursor = struct { + Fbase Tsqlite3_vtab_cursor + FiRowid Tu32 + Fi Tu32 + FiEnd Tu32 + FnRoot Tu32 + FeType Tu8 + FbRecursive Tu8 + FnParent Tu32 + FnParentAlloc Tu32 + FaParent uintptr + Fdb uintptr + Fpath TJsonString + FsParse TJsonParse +} + +type JsonEachCursor = TJsonEachCursor + +type TJsonEachCursor1 = struct { + Fbase Tsqlite3_vtab_cursor + FiRowid Tu32 + Fi Tu32 + FiEnd Tu32 + FnRoot Tu32 + FeType Tu8 + FbRecursive Tu8 + FnParent Tu32 + FnParentAlloc Tu32 + FaParent uintptr + Fdb uintptr + Fpath TJsonString + FsParse TJsonParse +} + +type JsonEachCursor1 = TJsonEachCursor1 + +type TJsonEachConnection = struct { + Fbase Tsqlite3_vtab + Fdb uintptr +} + +type JsonEachConnection = TJsonEachConnection + +type TJsonEachConnection1 = struct { + Fbase Tsqlite3_vtab + Fdb uintptr +} + +type JsonEachConnection1 = TJsonEachConnection1 + +// C documentation +// +// /* Constructor for the json_each virtual table */ +func _jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + var pNew uintptr + var rc int32 + _, _ = pNew, rc + /* Column numbers */ + /* The xBestIndex method assumes that the JSON and ROOT columns are + ** the last two columns in the table. Should this ever changes, be + ** sure to update the xBestIndex method. */ + _ = pzErr + _ = argv + _ = argc + _ = pAux + rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+25293) + if rc == SQLITE_OK { + pNew = _sqlite3DbMallocZero(tls, db, uint64(32)) + *(*uintptr)(unsafe.Pointer(ppVtab)) = pNew + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_INNOCUOUS), 0) + (*TJsonEachConnection)(unsafe.Pointer(pNew)).Fdb = db + } + return rc +} + +// C documentation +// +// /* destructor for json_each virtual table */ +func _jsonEachDisconnect(tls *libc.TLS, pVtab uintptr) (r int32) { + var p uintptr + _ = p + p = pVtab + _sqlite3DbFree(tls, (*TJsonEachConnection)(unsafe.Pointer(p)).Fdb, pVtab) + return SQLITE_OK +} + +// C documentation +// +// /* constructor for a JsonEachCursor object for json_each(). */ +func _jsonEachOpenEach(tls *libc.TLS, p uintptr, ppCursor uintptr) (r int32) { + var pCur, pVtab uintptr + _, _ = pCur, pVtab + pVtab = p + _ = p + pCur = _sqlite3DbMallocZero(tls, (*TJsonEachConnection)(unsafe.Pointer(pVtab)).Fdb, uint64(264)) + if pCur == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TJsonEachCursor)(unsafe.Pointer(pCur)).Fdb = (*TJsonEachConnection)(unsafe.Pointer(pVtab)).Fdb + _jsonStringZero(tls, pCur+56) + *(*uintptr)(unsafe.Pointer(ppCursor)) = pCur + return SQLITE_OK +} + +// C documentation +// +// /* constructor for a JsonEachCursor object for json_tree(). */ +func _jsonEachOpenTree(tls *libc.TLS, p uintptr, ppCursor uintptr) (r int32) { + var pCur uintptr + var rc int32 + _, _ = pCur, rc + rc = _jsonEachOpenEach(tls, p, ppCursor) + if rc == SQLITE_OK { + pCur = *(*uintptr)(unsafe.Pointer(ppCursor)) + (*TJsonEachCursor)(unsafe.Pointer(pCur)).FbRecursive = uint8(1) + } + return rc +} + +// C documentation +// +// /* Reset a JsonEachCursor back to its original state. Free any memory +// ** held. */ +func _jsonEachCursorReset(tls *libc.TLS, p uintptr) { + _jsonParseReset(tls, p+192) + _jsonStringReset(tls, p+56) + _sqlite3DbFree(tls, (*TJsonEachCursor)(unsafe.Pointer(p)).Fdb, (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent) + (*TJsonEachCursor)(unsafe.Pointer(p)).FiRowid = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent = uintptr(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParentAlloc = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) +} + +// C documentation +// +// /* Destructor for a jsonEachCursor object */ +func _jsonEachClose(tls *libc.TLS, cur uintptr) (r int32) { + var p uintptr + _ = p + p = cur + _jsonEachCursorReset(tls, p) + _sqlite3DbFree(tls, (*TJsonEachCursor)(unsafe.Pointer(p)).Fdb, cur) + return SQLITE_OK +} + +// C documentation +// +// /* Return TRUE if the jsonEachCursor object has been advanced off the end +// ** of the JSON object */ +func _jsonEachEof(tls *libc.TLS, cur uintptr) (r int32) { + var p uintptr + _ = p + p = cur + return libc.BoolInt32((*TJsonEachCursor)(unsafe.Pointer(p)).Fi >= (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd) +} + +// C documentation +// +// /* +// ** If the cursor is currently pointing at the label of a object entry, +// ** then return the index of the value. For all other cases, return the +// ** current pointer position, which is the value. +// */ +func _jsonSkipLabel(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var n Tu32 + var _ /* sz at bp+0 */ Tu32 + _ = n + if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_OBJECT) { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + n = _jsonbPayloadSize(tls, p+192, (*TJsonEachCursor)(unsafe.Pointer(p)).Fi, bp) + return int32((*TJsonEachCursor)(unsafe.Pointer(p)).Fi + n + *(*Tu32)(unsafe.Pointer(bp))) + } else { + return int32((*TJsonEachCursor)(unsafe.Pointer(p)).Fi) + } + return r +} + +// C documentation +// +// /* +// ** Append the path name for the current element. +// */ +func _jsonAppendPathName(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, k, n Tu32 + var needQuote int32 + var z uintptr + var _ /* sz at bp+0 */ Tu32 + _, _, _, _, _ = i, k, n, needQuote, z + if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) { + _jsonPrintf(tls, int32(30), p+56, __ccgo_ts+25376, libc.VaList(bp+16, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey)) + } else { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + needQuote = 0 + n = _jsonbPayloadSize(tls, p+192, (*TJsonEachCursor)(unsafe.Pointer(p)).Fi, bp) + k = (*TJsonEachCursor)(unsafe.Pointer(p)).Fi + n + z = (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(k) + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) || !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))])&libc.Int32FromInt32(0x02) != 0) { + needQuote = int32(1) + } else { + i = uint32(0) + for { + if !(i < *(*Tu32)(unsafe.Pointer(bp))) { + break + } + if !(int32(_sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))])&libc.Int32FromInt32(0x06) != 0) { + needQuote = int32(1) + break + } + goto _1 + _1: + ; + i++ + } + } + if needQuote != 0 { + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(4)), p+56, __ccgo_ts+25383, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + } else { + _jsonPrintf(tls, int32(*(*Tu32)(unsafe.Pointer(bp))+uint32(2)), p+56, __ccgo_ts+25391, libc.VaList(bp+16, *(*Tu32)(unsafe.Pointer(bp)), z)) + } + } +} + +// C documentation +// +// /* Advance the cursor to the next element for json_tree() */ +func _jsonEachNext(tls *libc.TLS, cur uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, i1, iVal, n, n1 Tu32 + var levelChange, x Tu8 + var nNew Tu64 + var p, pNew, pParent, pParent1 uintptr + var rc int32 + var _ /* sz at bp+0 */ Tu32 + var _ /* sz at bp+4 */ Tu32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = i, i1, iVal, levelChange, n, n1, nNew, p, pNew, pParent, pParent1, rc, x + p = cur + rc = SQLITE_OK + if (*TJsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + levelChange = uint8(0) + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + i = uint32(_jsonSkipLabel(tls, p)) + x = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i)))) & int32(0x0f)) + n = _jsonbPayloadSize(tls, p+192, i, bp) + if int32(x) == int32(JSONB_OBJECT) || int32(x) == int32(JSONB_ARRAY) { + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent >= (*TJsonEachCursor)(unsafe.Pointer(p)).FnParentAlloc { + nNew = uint64((*TJsonEachCursor)(unsafe.Pointer(p)).FnParentAlloc*uint32(2) + uint32(3)) + pNew = _sqlite3DbRealloc(tls, (*TJsonEachCursor)(unsafe.Pointer(p)).Fdb, (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent, uint64(24)*nNew) + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParentAlloc = uint32(nNew) + (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent = pNew + } + levelChange = uint8(1) + pParent = (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent)*24 + (*TJsonParent)(unsafe.Pointer(pParent)).FiHead = (*TJsonEachCursor)(unsafe.Pointer(p)).Fi + (*TJsonParent)(unsafe.Pointer(pParent)).FiValue = i + (*TJsonParent)(unsafe.Pointer(pParent)).FiEnd = i + n + *(*Tu32)(unsafe.Pointer(bp)) + (*TJsonParent)(unsafe.Pointer(pParent)).FiKey = int64(-int32(1)) + (*TJsonParent)(unsafe.Pointer(pParent)).FnPath = uint32((*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed) + if (*TJsonEachCursor)(unsafe.Pointer(p)).FeType != 0 && (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent != 0 { + _jsonAppendPathName(tls, p) + if (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FeErr != 0 { + rc = int32(SQLITE_NOMEM) + } + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent++ + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = i + n + } else { + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = i + n + *(*Tu32)(unsafe.Pointer(bp)) + } + for (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent > uint32(0) && (*TJsonEachCursor)(unsafe.Pointer(p)).Fi >= (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiEnd { + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-- + (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed = uint64((*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent)*24))).FnPath) + levelChange = uint8(1) + } + if levelChange != 0 { + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent > uint32(0) { + pParent1 = (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24 + iVal = (*TJsonParent)(unsafe.Pointer(pParent1)).FiValue + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(iVal)))) & int32(0x0f)) + } else { + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) + } + } + } else { + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) + i1 = uint32(_jsonSkipLabel(tls, p)) + n1 = _jsonbPayloadSize(tls, p+192, i1, bp+4) + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = i1 + n1 + *(*Tu32)(unsafe.Pointer(bp + 4)) + } + if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_ARRAY) && (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent != 0 { + (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey++ + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FiRowid++ + return rc +} + +// C documentation +// +// /* Length of the path for rowid==0 in bRecursive mode. +// */ +func _jsonEachPathLength(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var cSaved int8 + var n, x Tu32 + var z uintptr + var _ /* sz at bp+0 */ Tu32 + _, _, _, _ = cSaved, n, x, z + n = uint32((*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed) + z = (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf + if (*TJsonEachCursor)(unsafe.Pointer(p)).FiRowid == uint32(0) && (*TJsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 && n >= uint32(2) { + for n > uint32(1) { + n-- + if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('[') || int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == int32('.') { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(0) + cSaved = *(*int8)(unsafe.Pointer(z + uintptr(n))) + *(*int8)(unsafe.Pointer(z + uintptr(n))) = 0 + x = _jsonLookupStep(tls, p+192, uint32(0), z+uintptr(1), uint32(0)) + *(*int8)(unsafe.Pointer(z + uintptr(n))) = cSaved + if x >= uint32(JSON_LOOKUP_PATHERROR) { + continue + } + if x+_jsonbPayloadSize(tls, p+192, x, bp) == (*TJsonEachCursor)(unsafe.Pointer(p)).Fi { + break + } + } + } + } + return int32(n) +} + +// C documentation +// +// /* Return the value of a column */ +func _jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, iColumn int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType Tu8 + var i, i1, i2, j, n, n1 Tu32 + var nBase Tu64 + var p uintptr + var _ /* x at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _ = eType, i, i1, i2, j, n, n1, nBase, p + p = cur + switch iColumn { + case JEACH_KEY: + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent == uint32(0) { + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot == uint32(1) { + break + } + j = uint32(_jsonEachPathLength(tls, p)) + n = (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot - j + if n == uint32(0) { + break + } else { + if int32(*(*int8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf + uintptr(j)))) == int32('[') { + _sqlite3Atoi64(tls, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf+uintptr(j+uint32(1)), bp, int32(n-uint32(1)), uint8(SQLITE_UTF8)) + Xsqlite3_result_int64(tls, ctx, *(*Ti64)(unsafe.Pointer(bp))) + } else { + if int32(*(*int8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf + uintptr(j+uint32(1))))) == int32('"') { + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf+uintptr(j+uint32(2)), int32(n-uint32(3)), uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf+uintptr(j+uint32(1)), int32(n-uint32(1)), uintptr(-libc.Int32FromInt32(1))) + } + } + } + break + } + if int32((*TJsonEachCursor)(unsafe.Pointer(p)).FeType) == int32(JSONB_OBJECT) { + _jsonReturnFromBlob(tls, p+192, (*TJsonEachCursor)(unsafe.Pointer(p)).Fi, ctx, int32(1)) + } else { + Xsqlite3_result_int64(tls, ctx, (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiKey) + } + case int32(JEACH_VALUE): + i = uint32(_jsonSkipLabel(tls, p)) + _jsonReturnFromBlob(tls, p+192, i, ctx, int32(1)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) { + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } + case int32(JEACH_TYPE): + i1 = uint32(_jsonSkipLabel(tls, p)) + eType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i1)))) & int32(0x0f)) + Xsqlite3_result_text(tls, ctx, _jsonbType[eType], -int32(1), libc.UintptrFromInt32(0)) + case int32(JEACH_ATOM): + i2 = uint32(_jsonSkipLabel(tls, p)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i2))))&int32(0x0f) < int32(JSONB_ARRAY) { + _jsonReturnFromBlob(tls, p+192, i2, ctx, int32(1)) + } + case int32(JEACH_ID): + Xsqlite3_result_int64(tls, ctx, int64((*TJsonEachCursor)(unsafe.Pointer(p)).Fi)) + case int32(JEACH_PARENT): + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent > uint32(0) && (*TJsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + Xsqlite3_result_int64(tls, ctx, int64((*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent + uintptr((*TJsonEachCursor)(unsafe.Pointer(p)).FnParent-uint32(1))*24))).FiHead)) + } + case int32(JEACH_FULLKEY): + nBase = (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed + if (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent != 0 { + _jsonAppendPathName(tls, p) + } + Xsqlite3_result_text64(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed, uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) + (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FnUsed = nBase + case int32(JEACH_PATH): + n1 = uint32(_jsonEachPathLength(tls, p)) + Xsqlite3_result_text64(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, uint64(n1), uintptr(-libc.Int32FromInt32(1)), uint8(SQLITE_UTF8)) + default: + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).Fpath.FzBuf, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot), libc.UintptrFromInt32(0)) + case int32(JEACH_JSON): + if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { + Xsqlite3_result_blob(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob, int32((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob), uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_text(tls, ctx, (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -int32(1), uintptr(-libc.Int32FromInt32(1))) + } + break + } + return SQLITE_OK +} + +// C documentation +// +// /* Return the current rowid value */ +func _jsonEachRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) (r int32) { + var p uintptr + _ = p + p = cur + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = int64((*TJsonEachCursor)(unsafe.Pointer(p)).FiRowid) + return SQLITE_OK +} + +// C documentation +// +// /* The query strategy is to look for an equality constraint on the json +// ** column. Without such a constraint, the table cannot operate. idxNum is +// ** 1 if the constraint is found, 3 if the constraint and zRoot are found, +// ** and 0 otherwise. +// */ +func _jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { + var aIdx [2]int32 + var i, iCol, iMask, idxMask, unusableMask, v1 int32 + var pConstraint uintptr + _, _, _, _, _, _, _, _ = aIdx, i, iCol, iMask, idxMask, pConstraint, unusableMask, v1 /* Index of constraints for JSON and ROOT */ + unusableMask = 0 /* Mask of unusable JSON and ROOT constraints */ + idxMask = 0 + /* This implementation assumes that JSON and ROOT are the last two + ** columns in the table */ + _ = tab + v1 = -libc.Int32FromInt32(1) + aIdx[int32(1)] = v1 + aIdx[0] = v1 + pConstraint = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + i = 0 + for { + if !(i < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + break + } + if (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < int32(JEACH_JSON) { + goto _2 + } + iCol = (*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - int32(JEACH_JSON) + iMask = int32(1) << iCol + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 { + unusableMask |= iMask + } else { + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) { + aIdx[iCol] = i + idxMask |= iMask + } + } + goto _2 + _2: + ; + i++ + pConstraint += 12 + } + if (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy > 0 && (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).FiColumn < 0 && int32((*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).Fdesc) == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = int32(1) + } + if unusableMask & ^idxMask != 0 { + /* If there are any unusable constraints on JSON or ROOT, then reject + ** this entire plan */ + return int32(SQLITE_CONSTRAINT) + } + if aIdx[0] < 0 { + /* No JSON input. Leave estimatedCost at the huge value that it was + ** initialized to to discourage the query planner from selecting this + ** plan. */ + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0 + } else { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1) + i = aIdx[0] + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8))).Fomit = uint8(1) + if aIdx[int32(1)] < 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) /* Only JSON supplied. Plan 1 */ + } else { + i = aIdx[int32(1)] + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = int32(2) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8))).Fomit = uint8(1) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(3) /* Both JSON and ROOT are supplied. Plan 3 */ + } + } + return SQLITE_OK +} + +// C documentation +// +// /* Start a search on a new JSON string */ +func _jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, n, v1, v3, v5 Tu32 + var p, zRoot uintptr + var v2, v4, v6 int32 + var _ /* sz at bp+0 */ Tu32 + _, _, _, _, _, _, _, _, _, _ = i, n, p, zRoot, v1, v2, v3, v4, v5, v6 + p = cur + zRoot = uintptr(0) + _ = idxStr + _ = argc + _jsonEachCursorReset(tls, p) + if idxNum == 0 { + return SQLITE_OK + } + libc.Xmemset(tls, p+192, 0, uint64(72)) + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnJPRef = uint32(1) + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.Fdb = (*TJsonEachCursor)(unsafe.Pointer(p)).Fdb + if _jsonFuncArgMightBeBinary(tls, *(*uintptr)(unsafe.Pointer(argv))) != 0 { + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnBlob = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + } else { + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FnJson = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson == uintptr(0) { + v1 = libc.Uint32FromInt32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd = v1 + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = v1 + return SQLITE_OK + } + if _jsonConvertTextToBlob(tls, p+192, uintptr(0)) != 0 { + if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom != 0 { + return int32(SQLITE_NOMEM) + } + goto json_each_malformed_input + } + } + if idxNum == int32(3) { + zRoot = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zRoot == uintptr(0) { + return SQLITE_OK + } + if int32(*(*int8)(unsafe.Pointer(zRoot))) != int32('$') { + Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = _jsonBadPathError(tls, uintptr(0), zRoot) + _jsonEachCursorReset(tls, p) + if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { + v2 = int32(SQLITE_ERROR) + } else { + v2 = int32(SQLITE_NOMEM) + } + return v2 + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(_sqlite3Strlen30(tls, zRoot)) + if int32(*(*int8)(unsafe.Pointer(zRoot + 1))) == 0 { + v3 = libc.Uint32FromInt32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = v3 + i = v3 + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) + } else { + i = _jsonLookupStep(tls, p+192, uint32(0), zRoot+uintptr(1), uint32(0)) + if i >= uint32(JSON_LOOKUP_PATHERROR) { + if i == uint32(JSON_LOOKUP_NOTFOUND) { + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = uint32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd = uint32(0) + return SQLITE_OK + } + Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = _jsonBadPathError(tls, uintptr(0), zRoot) + _jsonEachCursorReset(tls, p) + if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { + v4 = int32(SQLITE_ERROR) + } else { + v4 = int32(SQLITE_NOMEM) + } + return v4 + } + if (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FiLabel != 0 { + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = (*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FiLabel + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(JSONB_OBJECT) + } else { + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = i + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(JSONB_ARRAY) + } + } + _jsonAppendRaw(tls, p+56, zRoot, (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot) + } else { + v5 = libc.Uint32FromInt32(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = v5 + i = v5 + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(0) + (*TJsonEachCursor)(unsafe.Pointer(p)).FnRoot = uint32(1) + _jsonAppendRaw(tls, p+56, __ccgo_ts+25397, uint32(1)) + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(0) + n = _jsonbPayloadSize(tls, p+192, i, bp) + (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd = i + n + *(*Tu32)(unsafe.Pointer(bp)) + if int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i))))&int32(0x0f) >= int32(JSONB_ARRAY) && !((*TJsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0) { + (*TJsonEachCursor)(unsafe.Pointer(p)).Fi = i + n + (*TJsonEachCursor)(unsafe.Pointer(p)).FeType = uint8(int32(*(*Tu8)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FsParse.FaBlob + uintptr(i)))) & int32(0x0f)) + (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent = _sqlite3DbMallocZero(tls, (*TJsonEachCursor)(unsafe.Pointer(p)).Fdb, uint64(24)) + if (*TJsonEachCursor)(unsafe.Pointer(p)).FaParent == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParent = uint32(1) + (*TJsonEachCursor)(unsafe.Pointer(p)).FnParentAlloc = uint32(1) + (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent))).FiKey = 0 + (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent))).FiEnd = (*TJsonEachCursor)(unsafe.Pointer(p)).FiEnd + (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent))).FiHead = (*TJsonEachCursor)(unsafe.Pointer(p)).Fi + (*(*TJsonParent)(unsafe.Pointer((*TJsonEachCursor)(unsafe.Pointer(p)).FaParent))).FiValue = i + } + return SQLITE_OK +json_each_malformed_input: + ; + Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+24968, 0) + _jsonEachCursorReset(tls, p) + if (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { + v6 = int32(SQLITE_ERROR) + } else { + v6 = int32(SQLITE_NOMEM) + } + return v6 +} + +// C documentation +// +// /* The methods of the json_each virtual table */ +var _jsonEachModule = Tsqlite3_module{} + +func init() { + p := unsafe.Pointer(&_jsonEachModule) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_jsonEachConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_jsonEachBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_jsonEachDisconnect) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_jsonEachOpenEach) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_jsonEachClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_jsonEachFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_jsonEachNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_jsonEachEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_jsonEachColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_jsonEachRowid) +} + +// C documentation +// +// /* The methods of the json_tree virtual table. */ +var _jsonTreeModule = Tsqlite3_module{} + +func init() { + p := unsafe.Pointer(&_jsonTreeModule) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_jsonEachConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_jsonEachBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_jsonEachDisconnect) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_jsonEachOpenTree) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_jsonEachClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_jsonEachFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_jsonEachNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_jsonEachEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_jsonEachColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_jsonEachRowid) +} + +// C documentation +// +// /* +// ** Register JSON functions. +// */ +func _sqlite3RegisterJsonFunctions(tls *libc.TLS) { + _sqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&_aJsonFunc)), int32(libc.Uint64FromInt64(2304)/libc.Uint64FromInt64(72))) +} + +var _aJsonFunc = [32]TFuncDef{ + 0: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25399, + }, + 1: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25404, + }, + 2: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25410, + }, + 3: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25421, + }, + 4: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25433, + }, + 5: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25433, + }, + 6: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25451, + }, + 7: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25471, + }, + 8: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25484, + }, + 9: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25498, + }, + 10: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25501, + }, + 11: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25505, + }, + 12: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25517, + }, + 13: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25530, + }, + 14: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25542, + }, + 15: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25555, + }, + 16: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25566, + }, + 17: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25578, + }, + 18: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25589, + }, + 19: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25601, + }, + 20: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25614, + }, + 21: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25627, + }, + 22: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25641, + }, + 23: { + FnArg: int8(-int32(1)), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25650, + }, + 24: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25660, + }, + 25: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25660, + }, + 26: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25670, + }, + 27: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), + FzName: __ccgo_ts + 25670, + }, + 28: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), + FzName: __ccgo_ts + 25681, + }, + 29: { + FnArg: int8(1), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25698, + }, + 30: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), + FzName: __ccgo_ts + 25716, + }, + 31: { + FnArg: int8(2), + FfuncFlags: uint32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), + FpUserData: uintptr(int64(libc.Int32FromInt32(JSON_BLOB))), + FzName: __ccgo_ts + 25734, + }, +} + +func init() { + p := unsafe.Pointer(&_aJsonFunc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_jsonRemoveFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_jsonRemoveFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_jsonArrayFunc) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_jsonArrayFunc) + *(*uintptr)(unsafe.Add(p, 312)) = __ccgo_fp(_jsonArrayLengthFunc) + *(*uintptr)(unsafe.Add(p, 384)) = __ccgo_fp(_jsonArrayLengthFunc) + *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_jsonErrorFunc) + *(*uintptr)(unsafe.Add(p, 528)) = __ccgo_fp(_jsonExtractFunc) + *(*uintptr)(unsafe.Add(p, 600)) = __ccgo_fp(_jsonExtractFunc) + *(*uintptr)(unsafe.Add(p, 672)) = __ccgo_fp(_jsonExtractFunc) + *(*uintptr)(unsafe.Add(p, 744)) = __ccgo_fp(_jsonExtractFunc) + *(*uintptr)(unsafe.Add(p, 816)) = __ccgo_fp(_jsonSetFunc) + *(*uintptr)(unsafe.Add(p, 888)) = __ccgo_fp(_jsonSetFunc) + *(*uintptr)(unsafe.Add(p, 960)) = __ccgo_fp(_jsonObjectFunc) + *(*uintptr)(unsafe.Add(p, 1032)) = __ccgo_fp(_jsonObjectFunc) + *(*uintptr)(unsafe.Add(p, 1104)) = __ccgo_fp(_jsonPatchFunc) + *(*uintptr)(unsafe.Add(p, 1176)) = __ccgo_fp(_jsonPatchFunc) + *(*uintptr)(unsafe.Add(p, 1248)) = __ccgo_fp(_jsonQuoteFunc) + *(*uintptr)(unsafe.Add(p, 1320)) = __ccgo_fp(_jsonRemoveFunc) + *(*uintptr)(unsafe.Add(p, 1392)) = __ccgo_fp(_jsonRemoveFunc) + *(*uintptr)(unsafe.Add(p, 1464)) = __ccgo_fp(_jsonReplaceFunc) + *(*uintptr)(unsafe.Add(p, 1536)) = __ccgo_fp(_jsonReplaceFunc) + *(*uintptr)(unsafe.Add(p, 1608)) = __ccgo_fp(_jsonSetFunc) + *(*uintptr)(unsafe.Add(p, 1680)) = __ccgo_fp(_jsonSetFunc) + *(*uintptr)(unsafe.Add(p, 1752)) = __ccgo_fp(_jsonTypeFunc) + *(*uintptr)(unsafe.Add(p, 1824)) = __ccgo_fp(_jsonTypeFunc) + *(*uintptr)(unsafe.Add(p, 1896)) = __ccgo_fp(_jsonValidFunc) + *(*uintptr)(unsafe.Add(p, 1968)) = __ccgo_fp(_jsonValidFunc) + *(*uintptr)(unsafe.Add(p, 2040)) = __ccgo_fp(_jsonArrayStep) + *(*uintptr)(unsafe.Add(p, 2048)) = __ccgo_fp(_jsonArrayFinal) + *(*uintptr)(unsafe.Add(p, 2056)) = __ccgo_fp(_jsonArrayValue) + *(*uintptr)(unsafe.Add(p, 2064)) = __ccgo_fp(_jsonGroupInverse) + *(*uintptr)(unsafe.Add(p, 2112)) = __ccgo_fp(_jsonArrayStep) + *(*uintptr)(unsafe.Add(p, 2120)) = __ccgo_fp(_jsonArrayFinal) + *(*uintptr)(unsafe.Add(p, 2128)) = __ccgo_fp(_jsonArrayValue) + *(*uintptr)(unsafe.Add(p, 2136)) = __ccgo_fp(_jsonGroupInverse) + *(*uintptr)(unsafe.Add(p, 2184)) = __ccgo_fp(_jsonObjectStep) + *(*uintptr)(unsafe.Add(p, 2192)) = __ccgo_fp(_jsonObjectFinal) + *(*uintptr)(unsafe.Add(p, 2200)) = __ccgo_fp(_jsonObjectValue) + *(*uintptr)(unsafe.Add(p, 2208)) = __ccgo_fp(_jsonGroupInverse) + *(*uintptr)(unsafe.Add(p, 2256)) = __ccgo_fp(_jsonObjectStep) + *(*uintptr)(unsafe.Add(p, 2264)) = __ccgo_fp(_jsonObjectFinal) + *(*uintptr)(unsafe.Add(p, 2272)) = __ccgo_fp(_jsonObjectValue) + *(*uintptr)(unsafe.Add(p, 2280)) = __ccgo_fp(_jsonGroupInverse) +} + +// C documentation +// +// /* +// ** Register the JSON table-valued functions +// */ +func _sqlite3JsonTableFunctions(tls *libc.TLS, db uintptr) (r int32) { + var i uint32 + var rc int32 + _, _ = i, rc + rc = SQLITE_OK + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(16) && rc == SQLITE_OK) { + break + } + rc = Xsqlite3_create_module(tls, db, _aMod[i].FzName, _aMod[i].FpModule, uintptr(0)) + goto _1 + _1: + ; + i++ + } + return rc +} + +var _aMod = [2]struct { + FzName uintptr + FpModule uintptr +}{ + 0: { + FzName: __ccgo_ts + 25753, + FpModule: uintptr(unsafe.Pointer(&_jsonEachModule)), + }, + 1: { + FzName: __ccgo_ts + 25763, + FpModule: uintptr(unsafe.Pointer(&_jsonTreeModule)), + }, +} + +/* In the SQLite core */ + +/* +** If building separately, we will need some setup that is normally +** found in sqliteInt.h + */ + +/* Macro to check for 4-byte alignment. Only used inside of assert() */ + +/* #include */ +/* #include */ +/* #include */ +/* #include */ + +/* The following macro is used to suppress compiler warnings. + */ + +type TRtree = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FiNodeSize int32 + FnDim Tu8 + FnDim2 Tu8 + FeCoordType Tu8 + FnBytesPerCell Tu8 + FinWrTrans Tu8 + FnAux Tu8 + FnAuxNotNull Tu8 + FiDepth int32 + FzDb uintptr + FzName uintptr + FzNodeName uintptr + FnBusy Tu32 + FnRowEst Ti64 + FnCursor Tu32 + FnNodeRef Tu32 + FzReadAuxSql uintptr + FpDeleted uintptr + FpNodeBlob uintptr + FpWriteNode uintptr + FpDeleteNode uintptr + FpReadRowid uintptr + FpWriteRowid uintptr + FpDeleteRowid uintptr + FpReadParent uintptr + FpWriteParent uintptr + FpDeleteParent uintptr + FpWriteAux uintptr + FaHash [97]uintptr +} + +type Rtree = TRtree + +type TRtreeCursor = struct { + Fbase Tsqlite3_vtab_cursor + FatEOF Tu8 + FbPoint Tu8 + FbAuxValid Tu8 + FiStrategy int32 + FnConstraint int32 + FaConstraint uintptr + FnPointAlloc int32 + FnPoint int32 + FmxLevel int32 + FaPoint uintptr + FpReadAux uintptr + FsPoint TRtreeSearchPoint + FaNode [5]uintptr + FanQueue [41]Tu32 +} + +type RtreeCursor = TRtreeCursor + +type TRtreeNode = struct { + FpParent uintptr + FiNode Ti64 + FnRef int32 + FisDirty int32 + FzData uintptr + FpNext uintptr +} + +type RtreeNode = TRtreeNode + +type TRtreeCell = struct { + FiRowid Ti64 + FaCoord [10]TRtreeCoord +} + +type RtreeCell = TRtreeCell + +type TRtreeConstraint = struct { + FiCoord int32 + Fop int32 + Fu struct { + FxGeom [0]uintptr + FxQueryFunc [0]uintptr + FrValue TRtreeDValue + } + FpInfo uintptr +} + +type RtreeConstraint = TRtreeConstraint + +type TRtreeMatchArg = struct { + FiSize Tu32 + Fcb TRtreeGeomCallback + FnParam int32 + FapSqlParam uintptr + FaParam [1]TRtreeDValue +} + +type RtreeMatchArg = TRtreeMatchArg + +type TRtreeGeomCallback = struct { + FxGeom uintptr + FxQueryFunc uintptr + FxDestructor uintptr + FpContext uintptr +} + +type RtreeGeomCallback = TRtreeGeomCallback + +type TRtreeCoord = struct { + Fi [0]int32 + Fu [0]Tu32 + Ff TRtreeValue +} + +type RtreeCoord = TRtreeCoord + +type TRtreeSearchPoint = struct { + FrScore TRtreeDValue + Fid Tsqlite3_int64 + FiLevel Tu8 + FeWithin Tu8 + FiCell Tu8 +} + +type RtreeSearchPoint = TRtreeSearchPoint + +/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */ + +/* Maximum number of auxiliary columns */ + +/* Size of hash table Rtree.aHash. This hash table is not expected to +** ever contain very many entries, so a fixed number of buckets is +** used. + */ + +/* The xBestIndex method of this virtual table requires an estimate of +** the number of rows in the virtual table to calculate the costs of +** various strategies. If possible, this estimate is loaded from the +** sqlite_stat1 table (with RTREE_MIN_ROWEST as a hard-coded minimum). +** Otherwise, if no sqlite_stat1 entry is available, use +** RTREE_DEFAULT_ROWEST. + */ + +/* +** An rtree virtual-table object. + */ +type TRtree1 = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FiNodeSize int32 + FnDim Tu8 + FnDim2 Tu8 + FeCoordType Tu8 + FnBytesPerCell Tu8 + FinWrTrans Tu8 + FnAux Tu8 + FnAuxNotNull Tu8 + FiDepth int32 + FzDb uintptr + FzName uintptr + FzNodeName uintptr + FnBusy Tu32 + FnRowEst Ti64 + FnCursor Tu32 + FnNodeRef Tu32 + FzReadAuxSql uintptr + FpDeleted uintptr + FpNodeBlob uintptr + FpWriteNode uintptr + FpDeleteNode uintptr + FpReadRowid uintptr + FpWriteRowid uintptr + FpDeleteRowid uintptr + FpReadParent uintptr + FpWriteParent uintptr + FpDeleteParent uintptr + FpWriteAux uintptr + FaHash [97]uintptr +} + +type Rtree1 = TRtree1 + +/* Possible values for Rtree.eCoordType: */ + +// C documentation +// +// /* +// ** If SQLITE_RTREE_INT_ONLY is defined, then this virtual table will +// ** only deal with integer coordinates. No floating point operations +// ** will be done. +// */ +type TRtreeDValue = float64 + +type RtreeDValue = TRtreeDValue + +/* High accuracy coordinate */ + +type TRtreeValue = float32 + +type RtreeValue = TRtreeValue + +/* Low accuracy coordinate */ + +/* +** Set the Rtree.bCorrupt flag + */ + +/* +** When doing a search of an r-tree, instances of the following structure +** record intermediate results from the tree walk. +** +** The id is always a node-id. For iLevel>=1 the id is the node-id of +** the node that the RtreeSearchPoint represents. When iLevel==0, however, +** the id is of the parent node and the cell that RtreeSearchPoint +** represents is the iCell-th entry in the parent node. + */ +type TRtreeSearchPoint1 = struct { + FrScore TRtreeDValue + Fid Tsqlite3_int64 + FiLevel Tu8 + FeWithin Tu8 + FiCell Tu8 +} + +type RtreeSearchPoint1 = TRtreeSearchPoint1 + +/* +** The minimum number of cells allowed for a node is a third of the +** maximum. In Gutman's notation: +** +** m = M/3 +** +** If an R*-tree "Reinsert" operation is required, the same number of +** cells are removed from the overfull node and reinserted into the tree. + */ + +/* +** The smallest possible node-size is (512-64)==448 bytes. And the largest +** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates). +** Therefore all non-root nodes must contain at least 3 entries. Since +** 3^40 is greater than 2^64, an r-tree structure always has a depth of +** 40 or less. + */ + +/* +** Number of entries in the cursor RtreeNode cache. The first entry is +** used to cache the RtreeNode for RtreeCursor.sPoint. The remaining +** entries cache the RtreeNode for the first elements of the priority queue. + */ + +/* +** An rtree cursor object. + */ +type TRtreeCursor1 = struct { + Fbase Tsqlite3_vtab_cursor + FatEOF Tu8 + FbPoint Tu8 + FbAuxValid Tu8 + FiStrategy int32 + FnConstraint int32 + FaConstraint uintptr + FnPointAlloc int32 + FnPoint int32 + FmxLevel int32 + FaPoint uintptr + FpReadAux uintptr + FsPoint TRtreeSearchPoint + FaNode [5]uintptr + FanQueue [41]Tu32 +} + +type RtreeCursor1 = TRtreeCursor1 + +/* Return the Rtree of a RtreeCursor */ + +/* +** A coordinate can be either a floating point number or a integer. All +** coordinates within a single R-Tree are always of the same time. + */ +type TRtreeCoord1 = struct { + Fi [0]int32 + Fu [0]Tu32 + Ff TRtreeValue +} + +type RtreeCoord1 = TRtreeCoord1 + +/* +** The argument is an RtreeCoord. Return the value stored within the RtreeCoord +** formatted as a RtreeDValue (double or int64). This macro assumes that local +** variable pRtree points to the Rtree structure associated with the +** RtreeCoord. + */ + +/* +** A search constraint. + */ +type TRtreeConstraint1 = struct { + FiCoord int32 + Fop int32 + Fu struct { + FxGeom [0]uintptr + FxQueryFunc [0]uintptr + FrValue TRtreeDValue + } + FpInfo uintptr +} + +type RtreeConstraint1 = TRtreeConstraint1 + +/* Possible values for RtreeConstraint.op */ + +/* Special operators available only on cursors. Needs to be consecutive +** with the normal values above, but must be less than RTREE_MATCH. These +** are used in the cursor for contraints such as x=NULL (RTREE_FALSE) or +** x<'xyz' (RTREE_TRUE) */ + +/* +** An rtree structure node. + */ +type TRtreeNode1 = struct { + FpParent uintptr + FiNode Ti64 + FnRef int32 + FisDirty int32 + FzData uintptr + FpNext uintptr +} + +type RtreeNode1 = TRtreeNode1 + +/* Return the number of cells in a node */ + +/* +** A single cell from a node, deserialized + */ +type TRtreeCell1 = struct { + FiRowid Ti64 + FaCoord [10]TRtreeCoord +} + +type RtreeCell1 = TRtreeCell1 + +/* +** This object becomes the sqlite3_user_data() for the SQL functions +** that are created by sqlite3_rtree_geometry_callback() and +** sqlite3_rtree_query_callback() and which appear on the right of MATCH +** operators in order to constrain a search. +** +** xGeom and xQueryFunc are the callback functions. Exactly one of +** xGeom and xQueryFunc fields is non-NULL, depending on whether the +** SQL function was created using sqlite3_rtree_geometry_callback() or +** sqlite3_rtree_query_callback(). +** +** This object is deleted automatically by the destructor mechanism in +** sqlite3_create_function_v2(). + */ +type TRtreeGeomCallback1 = struct { + FxGeom uintptr + FxQueryFunc uintptr + FxDestructor uintptr + FpContext uintptr +} + +type RtreeGeomCallback1 = TRtreeGeomCallback1 + +/* +** An instance of this structure (in the form of a BLOB) is returned by +** the SQL functions that sqlite3_rtree_geometry_callback() and +** sqlite3_rtree_query_callback() create, and is read as the right-hand +** operand to the MATCH operator of an R-Tree. + */ +type TRtreeMatchArg1 = struct { + FiSize Tu32 + Fcb TRtreeGeomCallback + FnParam int32 + FapSqlParam uintptr + FaParam [1]TRtreeDValue +} + +type RtreeMatchArg1 = TRtreeMatchArg1 + +/* What version of GCC is being used. 0 means GCC is not being used . +** Note that the GCC_VERSION macro will also be set correctly when using +** clang, since clang works hard to be gcc compatible. So the gcc +** optimizations will also work when compiling with clang. + */ + +/* The testcase() macro should already be defined in the amalgamation. If +** it is not, make it a no-op. + */ + +/* +** Make sure that the compiler intrinsics we desire are enabled when +** compiling with an appropriate version of MSVC unless prevented by +** the SQLITE_DISABLE_INTRINSIC define. + */ + +/* +** Macros to determine whether the machine is big or little endian, +** and whether or not that determination is run-time or compile-time. +** +** For best performance, an attempt is made to guess at the byte-order +** using C-preprocessor macros. If that is unsuccessful, or if +** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined +** at run-time. + */ + +/* What version of MSVC is being used. 0 means MSVC is not being used */ + +// C documentation +// +// /* +// ** Functions to deserialize a 16 bit integer, 32 bit real number and +// ** 64 bit integer. The deserialized value is returned. +// */ +func _readInt16(tls *libc.TLS, p uintptr) (r int32) { + return int32(*(*Tu8)(unsafe.Pointer(p)))<> int32(8) & int32(0xFF)) + *(*Tu8)(unsafe.Pointer(p + 1)) = uint8(i >> 0 & int32(0xFF)) +} + +func _writeCoord(tls *libc.TLS, p uintptr, pCoord uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* i at bp+0 */ Tu32 + *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCoord))) + libc.Xmemcpy(tls, p, bp, uint64(4)) + return int32(4) +} + +func _writeInt64(tls *libc.TLS, p uintptr, _i Ti64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*Ti64)(unsafe.Pointer(bp)) = _i + *(*Ti64)(unsafe.Pointer(bp)) = int64(libc.X__builtin_bswap64(tls, uint64(*(*Ti64)(unsafe.Pointer(bp))))) + libc.Xmemcpy(tls, p, bp, uint64(8)) + return int32(8) +} + +// C documentation +// +// /* +// ** Increment the reference count of node p. +// */ +func _nodeReference(tls *libc.TLS, p uintptr) { + if p != 0 { + (*TRtreeNode)(unsafe.Pointer(p)).FnRef++ + } +} + +// C documentation +// +// /* +// ** Clear the content of node p (set all bytes to 0x00). +// */ +func _nodeZero(tls *libc.TLS, pRtree uintptr, p uintptr) { + libc.Xmemset(tls, (*TRtreeNode)(unsafe.Pointer(p)).FzData+2, 0, uint64((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize-int32(2))) + (*TRtreeNode)(unsafe.Pointer(p)).FisDirty = int32(1) +} + +// C documentation +// +// /* +// ** Given a node number iNode, return the corresponding key to use +// ** in the Rtree.aHash table. +// */ +func _nodeHash(tls *libc.TLS, iNode Ti64) (r uint32) { + return uint32(iNode) % uint32(HASHSIZE) +} + +// C documentation +// +// /* +// ** Search the node hash table for node iNode. If found, return a pointer +// ** to it. Otherwise, return 0. +// */ +func _nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode Ti64) (r uintptr) { + var p uintptr + _ = p + p = *(*uintptr)(unsafe.Pointer(pRtree + 192 + uintptr(_nodeHash(tls, iNode))*8)) + for { + if !(p != 0 && (*TRtreeNode)(unsafe.Pointer(p)).FiNode != iNode) { + break + } + goto _1 + _1: + ; + p = (*TRtreeNode)(unsafe.Pointer(p)).FpNext + } + return p +} + +// C documentation +// +// /* +// ** Add node pNode to the node hash table. +// */ +func _nodeHashInsert(tls *libc.TLS, pRtree uintptr, pNode uintptr) { + var iHash int32 + _ = iHash + iHash = int32(_nodeHash(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode)) + (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext = *(*uintptr)(unsafe.Pointer(pRtree + 192 + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(pRtree + 192 + uintptr(iHash)*8)) = pNode +} + +// C documentation +// +// /* +// ** Remove node pNode from the node hash table. +// */ +func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { + var pp uintptr + _ = pp + if (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode != 0 { + pp = pRtree + 192 + uintptr(_nodeHash(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode))*8 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != pNode) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 32 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext + (*TRtreeNode)(unsafe.Pointer(pNode)).FpNext = uintptr(0) + } +} + +// C documentation +// +// /* +// ** Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0), +// ** indicating that node has not yet been assigned a node number. It is +// ** assigned a node number when nodeWrite() is called to write the +// ** node contents out to the database. +// */ +func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { + var pNode uintptr + _ = pNode + pNode = Xsqlite3_malloc64(tls, uint64(40)+uint64((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + if pNode != 0 { + libc.Xmemset(tls, pNode, 0, uint64(40)+uint64((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + (*TRtreeNode)(unsafe.Pointer(pNode)).FzData = pNode + 1*40 + (*TRtreeNode)(unsafe.Pointer(pNode)).FnRef = int32(1) + (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef++ + (*TRtreeNode)(unsafe.Pointer(pNode)).FpParent = pParent + (*TRtreeNode)(unsafe.Pointer(pNode)).FisDirty = int32(1) + _nodeReference(tls, pParent) + } + return pNode +} + +// C documentation +// +// /* +// ** Clear the Rtree.pNodeBlob object +// */ +func _nodeBlobReset(tls *libc.TLS, pRtree uintptr) { + var pBlob uintptr + _ = pBlob + pBlob = (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) +} + +// C documentation +// +// /* +// ** Obtain a reference to an r-tree node. +// */ +func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, ppNode uintptr) (r int32) { + var pBlob, pNode, v1 uintptr + var rc int32 + _, _, _, _ = pBlob, pNode, rc, v1 + rc = SQLITE_OK + pNode = uintptr(0) + /* Check if the requested node is already in the hash table. If so, + ** increase its reference count and return it. + */ + v1 = _nodeHashLookup(tls, pRtree, iNode) + pNode = v1 + if v1 != uintptr(0) { + if pParent != 0 && pParent != (*TRtreeNode)(unsafe.Pointer(pNode)).FpParent { + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<iDepth to the height + ** of the r-tree structure. A height of zero means all data is stored on + ** the root node. A height of one means the children of the root node + ** are the leaves, and so on. If the depth as specified on the root node + ** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt. + */ + if rc == SQLITE_OK && pNode != 0 && iNode == int64(1) { + (*TRtree)(unsafe.Pointer(pRtree)).FiDepth = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData) + if (*TRtree)(unsafe.Pointer(pRtree)).FiDepth > int32(RTREE_MAX_DEPTH) { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< ((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize-int32(4))/int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<iCoord might point to either a lower or upper bound coordinate + ** in a coordinate pair. But make pCellData point to the lower bound. + */ + pCellData += uintptr(int32(8) + int32(4)*((*TRtreeConstraint)(unsafe.Pointer(p)).FiCoord&int32(0xfe))) + switch (*TRtreeConstraint)(unsafe.Pointer(p)).Fop { + case int32(RTREE_TRUE): + return /* Always satisfied */ + case int32(RTREE_FALSE): + case int32(RTREE_EQ): + /* Coordinate decoded */ *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + v1 = float64(*(*int32)(unsafe.Pointer(bp))) + } else { + v1 = float64(*(*TRtreeValue)(unsafe.Pointer(bp))) + } + val = v1 + /* val now holds the lower bound of the coordinate pair */ + if *(*TRtreeDValue)(unsafe.Pointer(p + 8)) >= val { + pCellData += uintptr(4) + /* Coordinate decoded */ *(*Tu32)(unsafe.Pointer(bp + 4)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + v2 = float64(*(*int32)(unsafe.Pointer(bp + 4))) + } else { + v2 = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 4))) + } + val = v2 + /* val now holds the upper bound of the coordinate pair */ + if *(*TRtreeDValue)(unsafe.Pointer(p + 8)) <= val { + return + } + } + case int32(RTREE_LE): + fallthrough + case int32(RTREE_LT): + /* Coordinate decoded */ *(*Tu32)(unsafe.Pointer(bp + 8)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + v3 = float64(*(*int32)(unsafe.Pointer(bp + 8))) + } else { + v3 = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 8))) + } + val = v3 + /* val now holds the lower bound of the coordinate pair */ + if *(*TRtreeDValue)(unsafe.Pointer(p + 8)) >= val { + return + } + default: + pCellData += uintptr(4) + /* Coordinate decoded */ *(*Tu32)(unsafe.Pointer(bp + 12)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + v4 = float64(*(*int32)(unsafe.Pointer(bp + 12))) + } else { + v4 = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 12))) + } + val = v4 + /* val now holds the upper bound of the coordinate pair */ + if *(*TRtreeDValue)(unsafe.Pointer(p + 8)) <= val { + return + } + break + } + *(*int32)(unsafe.Pointer(peWithin)) = NOT_WITHIN +} + +// C documentation +// +// /* +// ** Check the leaf RTree cell given by pCellData against constraint p. +// ** If this constraint is not satisfied, set *peWithin to NOT_WITHIN. +// ** If the constraint is satisfied, leave *peWithin unchanged. +// ** +// ** The constraint is of the form: xN op $val +// ** +// ** The op is given by p->op. The xN is p->iCoord-th coordinate in +// ** pCellData. $val is given by p->u.rValue. +// */ +func _rtreeLeafConstraint(tls *libc.TLS, p uintptr, eInt int32, pCellData uintptr, peWithin uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var xN TRtreeDValue + var v1 Tsqlite3_rtree_dbl + var _ /* c at bp+0 */ TRtreeCoord + _, _ = xN, v1 /* Coordinate value converted to a double */ + pCellData += uintptr(int32(8) + (*TRtreeConstraint)(unsafe.Pointer(p)).FiCoord*int32(4)) + /* Coordinate decoded */ + *(*Tu32)(unsafe.Pointer(bp)) = libc.X__builtin_bswap32(tls, *(*Tu32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + v1 = float64(*(*int32)(unsafe.Pointer(bp))) + } else { + v1 = float64(*(*TRtreeValue)(unsafe.Pointer(bp))) + } + xN = v1 + switch (*TRtreeConstraint)(unsafe.Pointer(p)).Fop { + case int32(RTREE_TRUE): + return /* Always satisfied */ + case int32(RTREE_FALSE): + case int32(RTREE_LE): + if xN <= *(*TRtreeDValue)(unsafe.Pointer(p + 8)) { + return + } + case int32(RTREE_LT): + if xN < *(*TRtreeDValue)(unsafe.Pointer(p + 8)) { + return + } + case int32(RTREE_GE): + if xN >= *(*TRtreeDValue)(unsafe.Pointer(p + 8)) { + return + } + case int32(RTREE_GT): + if xN > *(*TRtreeDValue)(unsafe.Pointer(p + 8)) { + return + } + default: + if xN == *(*TRtreeDValue)(unsafe.Pointer(p + 8)) { + return + } + break + } + *(*int32)(unsafe.Pointer(peWithin)) = NOT_WITHIN +} + +// C documentation +// +// /* +// ** One of the cells in node pNode is guaranteed to have a 64-bit +// ** integer value equal to iRowid. Return the index of this cell. +// */ +func _nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid Ti64, piIndex uintptr) (r int32) { + var ii, nCell int32 + _, _ = ii, nCell + nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) + ii = 0 + for { + if !(ii < nCell) { + break + } + if _nodeGetRowid(tls, pRtree, pNode, ii) == iRowid { + *(*int32)(unsafe.Pointer(piIndex)) = ii + return SQLITE_OK + } + goto _1 + _1: + ; + ii++ + } + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*TRtreeSearchPoint)(unsafe.Pointer(pB)).FrScore { + return +libc.Int32FromInt32(1) + } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(pA)).FiLevel) < int32((*TRtreeSearchPoint)(unsafe.Pointer(pB)).FiLevel) { + return -int32(1) + } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(pA)).FiLevel) > int32((*TRtreeSearchPoint)(unsafe.Pointer(pB)).FiLevel) { + return +libc.Int32FromInt32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Interchange two search points in a cursor. +// */ +func _rtreeSearchPointSwap(tls *libc.TLS, p uintptr, i int32, j int32) { + var pTemp uintptr + var t TRtreeSearchPoint + _, _ = pTemp, t + t = *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(i)*24)) + *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(i)*24)) = *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(j)*24)) + *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(j)*24)) = t + i++ + j++ + if i < int32(RTREE_CACHE_SZ) { + if j >= int32(RTREE_CACHE_SZ) { + _nodeRelease(tls, (*TRtreeCursor)(unsafe.Pointer(p)).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) = uintptr(0) + } else { + pTemp = *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(j)*8)) + *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(j)*8)) = pTemp + } + } +} + +// C documentation +// +// /* +// ** Return the search point with the lowest current score. +// */ +func _rtreeSearchPointFirst(tls *libc.TLS, pCur uintptr) (r uintptr) { + var v1, v2 uintptr + _, _ = v1, v2 + if (*TRtreeCursor)(unsafe.Pointer(pCur)).FbPoint != 0 { + v1 = pCur + 64 + } else { + if (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPoint != 0 { + v2 = (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint + } else { + v2 = uintptr(0) + } + v1 = v2 + } + return v1 +} + +// C documentation +// +// /* +// ** Get the RtreeNode for the search point with the lowest score. +// */ +func _rtreeNodeOfFirstSearchPoint(tls *libc.TLS, pCur uintptr, pRC uintptr) (r uintptr) { + var id Tsqlite3_int64 + var ii int32 + var v1 int64 + _, _, _ = id, ii, v1 + ii = int32(1) - int32((*TRtreeCursor)(unsafe.Pointer(pCur)).FbPoint) + if *(*uintptr)(unsafe.Pointer(pCur + 88 + uintptr(ii)*8)) == uintptr(0) { + if ii != 0 { + v1 = (*(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint))).Fid + } else { + v1 = (*TRtreeCursor)(unsafe.Pointer(pCur)).FsPoint.Fid + } + id = v1 + *(*int32)(unsafe.Pointer(pRC)) = _nodeAcquire(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab, id, uintptr(0), pCur+88+uintptr(ii)*8) + } + return *(*uintptr)(unsafe.Pointer(pCur + 88 + uintptr(ii)*8)) +} + +// C documentation +// +// /* +// ** Push a new element onto the priority queue +// */ +func _rtreeEnqueue(tls *libc.TLS, pCur uintptr, rScore TRtreeDValue, iLevel Tu8) (r uintptr) { + var i, j, nNew, v1 int32 + var pNew, pParent, v2 uintptr + _, _, _, _, _, _, _ = i, j, nNew, pNew, pParent, v1, v2 + if (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPoint >= (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc { + nNew = (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc*int32(2) + int32(8) + pNew = Xsqlite3_realloc64(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint, uint64(nNew)*uint64(24)) + if pNew == uintptr(0) { + return uintptr(0) + } + (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint = pNew + (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc = nNew + } + v2 = pCur + 36 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + i = v1 + pNew = (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(i)*24 + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FrScore = rScore + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FiLevel = iLevel + for i > 0 { + j = (i - int32(1)) / int32(2) + pParent = (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(j)*24 + if _rtreeSearchPointCompare(tls, pNew, pParent) >= 0 { + break + } + _rtreeSearchPointSwap(tls, pCur, j, i) + i = j + pNew = pParent + } + return pNew +} + +// C documentation +// +// /* +// ** Allocate a new RtreeSearchPoint and return a pointer to it. Return +// ** NULL if malloc fails. +// */ +func _rtreeSearchPointNew(tls *libc.TLS, pCur uintptr, rScore TRtreeDValue, iLevel Tu8) (r uintptr) { + var ii int32 + var pFirst, pNew uintptr + _, _, _ = ii, pFirst, pNew + pFirst = _rtreeSearchPointFirst(tls, pCur) + *(*Tu32)(unsafe.Pointer(pCur + 128 + uintptr(iLevel)*4))++ + if pFirst == uintptr(0) || (*TRtreeSearchPoint)(unsafe.Pointer(pFirst)).FrScore > rScore || (*TRtreeSearchPoint)(unsafe.Pointer(pFirst)).FrScore == rScore && int32((*TRtreeSearchPoint)(unsafe.Pointer(pFirst)).FiLevel) > int32(iLevel) { + if (*TRtreeCursor)(unsafe.Pointer(pCur)).FbPoint != 0 { + pNew = _rtreeEnqueue(tls, pCur, rScore, iLevel) + if pNew == uintptr(0) { + return uintptr(0) + } + ii = int32((int64(pNew)-int64((*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint))/24) + int32(1) + if ii < int32(RTREE_CACHE_SZ) { + *(*uintptr)(unsafe.Pointer(pCur + 88 + uintptr(ii)*8)) = *(*uintptr)(unsafe.Pointer(pCur + 88)) + } else { + _nodeRelease(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer(pCur + 88))) + } + *(*uintptr)(unsafe.Pointer(pCur + 88)) = uintptr(0) + *(*TRtreeSearchPoint)(unsafe.Pointer(pNew)) = (*TRtreeCursor)(unsafe.Pointer(pCur)).FsPoint + } + (*TRtreeCursor)(unsafe.Pointer(pCur)).FsPoint.FrScore = rScore + (*TRtreeCursor)(unsafe.Pointer(pCur)).FsPoint.FiLevel = iLevel + (*TRtreeCursor)(unsafe.Pointer(pCur)).FbPoint = uint8(1) + return pCur + 64 + } else { + return _rtreeEnqueue(tls, pCur, rScore, iLevel) + } + return r +} + +// C documentation +// +// /* Remove the search point with the lowest current score. +// */ +func _rtreeSearchPointPop(tls *libc.TLS, p uintptr) { + var i, j, k, n, v1, v3 int32 + var v2 uintptr + _, _, _, _, _, _, _ = i, j, k, n, v1, v2, v3 + i = int32(1) - int32((*TRtreeCursor)(unsafe.Pointer(p)).FbPoint) + if *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) != 0 { + _nodeRelease(tls, (*TRtreeCursor)(unsafe.Pointer(p)).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(i)*8)) = uintptr(0) + } + if (*TRtreeCursor)(unsafe.Pointer(p)).FbPoint != 0 { + *(*Tu32)(unsafe.Pointer(p + 128 + uintptr((*TRtreeCursor)(unsafe.Pointer(p)).FsPoint.FiLevel)*4))-- + (*TRtreeCursor)(unsafe.Pointer(p)).FbPoint = uint8(0) + } else { + if (*TRtreeCursor)(unsafe.Pointer(p)).FnPoint != 0 { + *(*Tu32)(unsafe.Pointer(p + 128 + uintptr((*(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint))).FiLevel)*4))-- + v2 = p + 36 + *(*int32)(unsafe.Pointer(v2))-- + v1 = *(*int32)(unsafe.Pointer(v2)) + n = v1 + *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint)) = *(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(n)*24)) + if n < libc.Int32FromInt32(RTREE_CACHE_SZ)-libc.Int32FromInt32(1) { + *(*uintptr)(unsafe.Pointer(p + 88 + 1*8)) = *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(n+int32(1))*8)) + *(*uintptr)(unsafe.Pointer(p + 88 + uintptr(n+int32(1))*8)) = uintptr(0) + } + i = 0 + for { + v3 = i*libc.Int32FromInt32(2) + libc.Int32FromInt32(1) + j = v3 + if !(v3 < n) { + break + } + k = j + int32(1) + if k < n && _rtreeSearchPointCompare(tls, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(k)*24, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(j)*24) < 0 { + if _rtreeSearchPointCompare(tls, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(k)*24, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(i)*24) < 0 { + _rtreeSearchPointSwap(tls, p, i, k) + i = k + } else { + break + } + } else { + if _rtreeSearchPointCompare(tls, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(j)*24, (*TRtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(i)*24) < 0 { + _rtreeSearchPointSwap(tls, p, i, j) + i = j + } else { + break + } + } + } + } + } +} + +// C documentation +// +// /* +// ** Continue the search on cursor pCur until the front of the queue +// ** contains an entry suitable for returning as a result-set row, +// ** or until the RtreeSearchPoint queue is empty, indicating that the +// ** query has completed. +// */ +func _rtreeStepToLeaf(tls *libc.TLS, pCur uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eInt, ii, nCell, nConstraint int32 + var p, pCellData, pConstraint, pNode, pRtree, v1 uintptr + var x TRtreeSearchPoint + var _ /* eWithin at bp+0 */ int32 + var _ /* rScore at bp+8 */ Tsqlite3_rtree_dbl + var _ /* rc at bp+4 */ int32 + _, _, _, _, _, _, _, _, _, _, _ = eInt, ii, nCell, nConstraint, p, pCellData, pConstraint, pNode, pRtree, x, v1 + pRtree = (*TRtreeCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab + *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK + nConstraint = (*TRtreeCursor)(unsafe.Pointer(pCur)).FnConstraint + eInt = libc.BoolInt32(int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == int32(RTREE_COORD_INT32)) + for { + v1 = _rtreeSearchPointFirst(tls, pCur) + p = v1 + if !(v1 != uintptr(0) && int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) > 0) { + break + } + pNode = _rtreeNodeOfFirstSearchPoint(tls, pCur, bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) + pCellData = (*TRtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr(libc.Int32FromInt32(4)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + for int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) < nCell { + *(*Tsqlite3_rtree_dbl)(unsafe.Pointer(bp + 8)) = float64(-libc.Int32FromInt32(1)) + *(*int32)(unsafe.Pointer(bp)) = int32(FULLY_WITHIN) + ii = 0 + for { + if !(ii < nConstraint) { + break + } + pConstraint = (*TRtreeCursor)(unsafe.Pointer(pCur)).FaConstraint + uintptr(ii)*24 + if (*TRtreeConstraint)(unsafe.Pointer(pConstraint)).Fop >= int32(RTREE_MATCH) { + *(*int32)(unsafe.Pointer(bp + 4)) = _rtreeCallbackConstraint(tls, pConstraint, eInt, pCellData, p, bp+8, bp) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + } else { + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) == int32(1) { + _rtreeLeafConstraint(tls, pConstraint, eInt, pCellData, bp) + } else { + _rtreeNonleafConstraint(tls, pConstraint, eInt, pCellData, bp) + } + } + if *(*int32)(unsafe.Pointer(bp)) == NOT_WITHIN { + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell++ + pCellData += uintptr((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) + break + } + goto _2 + _2: + ; + ii++ + } + if *(*int32)(unsafe.Pointer(bp)) == NOT_WITHIN { + continue + } + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell++ + x.FiLevel = uint8(int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) - int32(1)) + if x.FiLevel != 0 { + x.Fid = _readInt64(tls, pCellData) + ii = 0 + for { + if !(ii < (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPoint) { + break + } + if (*(*TRtreeSearchPoint)(unsafe.Pointer((*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(ii)*24))).Fid == x.Fid { + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= nCell { + _rtreeSearchPointPop(tls, pCur) + } + if *(*Tsqlite3_rtree_dbl)(unsafe.Pointer(bp + 8)) < float64(0) { + *(*Tsqlite3_rtree_dbl)(unsafe.Pointer(bp + 8)) = float64(0) + } + p = _rtreeSearchPointNew(tls, pCur, *(*Tsqlite3_rtree_dbl)(unsafe.Pointer(bp + 8)), x.FiLevel) + if p == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = uint8(*(*int32)(unsafe.Pointer(bp))) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).Fid = x.Fid + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell = x.FiCell + break + } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= nCell { + _rtreeSearchPointPop(tls, pCur) + } + } + (*TRtreeCursor)(unsafe.Pointer(pCur)).FatEOF = libc.BoolUint8(p == uintptr(0)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Rtree virtual table module xNext method. +// */ +func _rtreeNext(tls *libc.TLS, pVtabCursor uintptr) (r int32) { + var pCsr uintptr + var rc int32 + _, _ = pCsr, rc + pCsr = pVtabCursor + rc = SQLITE_OK + /* Move to the next entry that matches the configured constraints. */ + if (*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid != 0 { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = uint8(0) + Xsqlite3_reset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + } + _rtreeSearchPointPop(tls, pCsr) + rc = _rtreeStepToLeaf(tls, pCsr) + return rc +} + +// C documentation +// +// /* +// ** Rtree virtual table module xRowid method. +// */ +func _rtreeRowid(tls *libc.TLS, pVtabCursor uintptr, pRowid uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pCsr, pNode uintptr + var _ /* rc at bp+0 */ int32 + _, _, _ = p, pCsr, pNode + pCsr = pVtabCursor + p = _rtreeSearchPointFirst(tls, pCsr) + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + pNode = _rtreeNodeOfFirstSearchPoint(tls, pCsr, bp) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && p != 0 { + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + } else { + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _nodeGetRowid(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Rtree virtual table module xColumn method. +// */ +func _rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pCsr, pNode, pRtree uintptr + var _ /* c at bp+0 */ TRtreeCoord + var _ /* rc at bp+4 */ int32 + _, _, _, _ = p, pCsr, pNode, pRtree + pRtree = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab + pCsr = cur + p = _rtreeSearchPointFirst(tls, pCsr) + *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK + pNode = _rtreeNodeOfFirstSearchPoint(tls, pCsr, bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + if p == uintptr(0) { + return SQLITE_OK + } + if int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) { + return int32(SQLITE_ABORT) + } + if i == 0 { + Xsqlite3_result_int64(tls, ctx, _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + } else { + if i <= int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) { + _nodeGetCoord(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell), i-int32(1), bp) + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + Xsqlite3_result_double(tls, ctx, float64(*(*TRtreeValue)(unsafe.Pointer(bp)))) + } else { + Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(bp))) + } + } else { + if !((*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid != 0) { + if (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 4)) = Xsqlite3_prepare_v3(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql, -int32(1), uint32(0), pCsr+56, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 4)) + } + } + Xsqlite3_bind_int64(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, int32(1), _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + *(*int32)(unsafe.Pointer(bp + 4)) = Xsqlite3_step(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp + 4)) == int32(SQLITE_ROW) { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = uint8(1) + } else { + Xsqlite3_reset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp + 4)) == int32(SQLITE_DONE) { + *(*int32)(unsafe.Pointer(bp + 4)) = SQLITE_OK + } + return *(*int32)(unsafe.Pointer(bp + 4)) + } + } + Xsqlite3_result_value(tls, ctx, Xsqlite3_column_value(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, i-int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(1))) + } + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Use nodeAcquire() to obtain the leaf node containing the record with +// ** rowid iRowid. If successful, set *ppLeaf to point to the node and +// ** return SQLITE_OK. If there is no such record in the table, set +// ** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf +// ** to zero and return an SQLite error code. +// */ +func _findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid Ti64, ppLeaf uintptr, piNode uintptr) (r int32) { + var iNode Ti64 + var rc int32 + _, _ = iNode, rc + *(*uintptr)(unsafe.Pointer(ppLeaf)) = uintptr(0) + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), iRowid) + if Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) == int32(SQLITE_ROW) { + iNode = Xsqlite3_column_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, 0) + if piNode != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(piNode)) = iNode + } + rc = _nodeAcquire(tls, pRtree, iNode, uintptr(0), ppLeaf) + Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + } else { + rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + } + return rc +} + +// C documentation +// +// /* +// ** This function is called to configure the RtreeConstraint object passed +// ** as the second argument for a MATCH constraint. The value passed as the +// ** first argument to this function is the right-hand operand to the MATCH +// ** operator. +// */ +func _deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) (r int32) { + var pBlob, pInfo, pSrc uintptr + _, _, _ = pBlob, pInfo, pSrc /* Callback information */ + pSrc = Xsqlite3_value_pointer(tls, pValue, __ccgo_ts+25860) + if pSrc == uintptr(0) { + return int32(SQLITE_ERROR) + } + pInfo = Xsqlite3_malloc64(tls, uint64(112)+uint64((*TRtreeMatchArg)(unsafe.Pointer(pSrc)).FiSize)) + if !(pInfo != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pInfo, 0, uint64(112)) + pBlob = pInfo + 1*112 + libc.Xmemcpy(tls, pBlob, pSrc, uint64((*TRtreeMatchArg)(unsafe.Pointer(pSrc)).FiSize)) + (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FpContext = (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FpContext + (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FnParam = (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FnParam + (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FaParam = pBlob + 56 + (*Tsqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FapSqlParam = (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + if (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxGeom != 0 { + *(*uintptr)(unsafe.Pointer(pCons + 8)) = (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxGeom + } else { + (*TRtreeConstraint)(unsafe.Pointer(pCons)).Fop = int32(RTREE_QUERY) + *(*uintptr)(unsafe.Pointer(pCons + 8)) = (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxQueryFunc + } + (*TRtreeConstraint)(unsafe.Pointer(pCons)).FpInfo = pInfo + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Rtree virtual table module xFilter method. +// */ +func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var eType, eType1, ii, rc int32 + var iRowid Ti64 + var iVal Tsqlite3_int64 + var p, p1, pCsr, pNew, pRtree uintptr + var _ /* iCell at bp+8 */ int32 + var _ /* iNode at bp+24 */ Ti64 + var _ /* pLeaf at bp+16 */ uintptr + var _ /* pRoot at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _ = eType, eType1, iRowid, iVal, ii, p, p1, pCsr, pNew, pRtree, rc + pRtree = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + pCsr = pVtabCursor + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + _rtreeReference(tls, pRtree) + /* Reset the cursor to the same state as rtreeOpen() leaves it in. */ + _resetCursor(tls, pCsr) + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FiStrategy = idxNum + if idxNum == int32(1) { /* Search point for the leaf */ + iRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*Ti64)(unsafe.Pointer(bp + 24)) = 0 + eType = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) && Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) == float64(iRowid) { + rc = _findLeafNode(tls, pRtree, iRowid, bp+16, bp+24) + } else { + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + } + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 16)) != uintptr(0) { + p = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8(0)) + /* Always returns pCsr->sPoint */ + *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp + 16)) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*Ti64)(unsafe.Pointer(bp + 24)) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = uint8(PARTLY_WITHIN) + rc = _nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 16)), iRowid, bp+8) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell = uint8(*(*int32)(unsafe.Pointer(bp + 8))) + } else { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FatEOF = uint8(1) + } + } else { + /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array + ** with the configured constraints. + */ + rc = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp) + if rc == SQLITE_OK && argc > 0 { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = Xsqlite3_malloc64(tls, uint64(24)*uint64(argc)) + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint = argc + if !((*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint != 0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint, 0, uint64(24)*uint64(argc)) + libc.Xmemset(tls, pCsr+128, 0, uint64(4)*uint64((*TRtree)(unsafe.Pointer(pRtree)).FiDepth+libc.Int32FromInt32(1))) + ii = 0 + for { + if !(ii < argc) { + break + } + p1 = (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint + uintptr(ii)*24 + eType1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8))) + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(ii*int32(2))))) + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(ii*int32(2)+int32(1))))) - int32('0') + if (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop >= int32(RTREE_MATCH) { + /* A MATCH operator. The right-hand-side must be a blob that + ** can be cast into an RtreeMatchArg object. One created using + ** an sqlite3_rtree_geometry_callback() SQL user function. + */ + rc = _deserializeGeometry(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)), p1) + if rc != SQLITE_OK { + break + } + (*Tsqlite3_rtree_query_info)(unsafe.Pointer((*TRtreeConstraint)(unsafe.Pointer(p1)).FpInfo)).FnCoord = int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) + (*Tsqlite3_rtree_query_info)(unsafe.Pointer((*TRtreeConstraint)(unsafe.Pointer(p1)).FpInfo)).FanQueue = pCsr + 128 + (*Tsqlite3_rtree_query_info)(unsafe.Pointer((*TRtreeConstraint)(unsafe.Pointer(p1)).FpInfo)).FmxLevel = (*TRtree)(unsafe.Pointer(pRtree)).FiDepth + int32(1) + } else { + if eType1 == int32(SQLITE_INTEGER) { + iVal = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8))) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(iVal) + if iVal >= libc.Int64FromInt32(1)<bPoint was FALSE */ + return int32(SQLITE_NOMEM) + } + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = uint8(0) + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = uint8(PARTLY_WITHIN) + *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = _rtreeStepToLeaf(tls, pCsr) + } + } + _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + _rtreeRelease(tls, pRtree) + return rc +} + +// C documentation +// +// /* +// ** Rtree virtual table module xBestIndex method. There are three +// ** table scan strategies to choose from (in order from most to +// ** least desirable): +// ** +// ** idxNum idxStr Strategy +// ** ------------------------------------------------ +// ** 1 Unused Direct lookup by rowid. +// ** 2 See below R-tree query or full-table scan. +// ** ------------------------------------------------ +// ** +// ** If strategy 1 is used, then idxStr is not meaningful. If strategy +// ** 2 is used, idxStr is formatted to contain 2 bytes for each +// ** constraint used. The first two bytes of idxStr correspond to +// ** the constraint in sqlite3_index_info.aConstraintUsage[] with +// ** (argvIndex==1) etc. +// ** +// ** The first of each pair of bytes in idxStr identifies the constraint +// ** operator as follows: +// ** +// ** Operator Byte Value +// ** ---------------------- +// ** = 0x41 ('A') +// ** <= 0x42 ('B') +// ** < 0x43 ('C') +// ** >= 0x44 ('D') +// ** > 0x45 ('E') +// ** MATCH 0x46 ('F') +// ** ---------------------- +// ** +// ** The second of each pair of bytes identifies the coordinate column +// ** to which the constraint applies. The leftmost coordinate column +// ** is 'a', the second from the left 'b' etc. +// */ +func _rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bMatch, iIdx, ii, jj, rc, v4, v5 int32 + var doOmit, op Tu8 + var nRow Ti64 + var p, pRtree uintptr + var _ /* zIdxStr at bp+0 */ [41]int8 + _, _, _, _, _, _, _, _, _, _, _, _ = bMatch, doOmit, iIdx, ii, jj, nRow, op, p, pRtree, rc, v4, v5 + pRtree = tab + rc = SQLITE_OK + bMatch = 0 /* Estimated rows returned by this scan */ + iIdx = 0 + libc.Xmemset(tls, bp, 0, uint64(41)) + /* Check if there exists a MATCH constraint - even an unusable one. If there + ** is, do not consider the lookup-by-rowid plan as using such a plan would + ** require the VDBE to evaluate the MATCH constraint, which is not currently + ** possible. */ + ii = 0 + for { + if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + break + } + if int32((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12))).Fop) == int32(SQLITE_INDEX_CONSTRAINT_MATCH) { + bMatch = int32(1) + } + goto _1 + _1: + ; + ii++ + } + ii = 0 + for { + if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint && iIdx < int32(libc.Uint64FromInt64(41)-libc.Uint64FromInt32(1))) { + break + } + p = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12 + if bMatch == 0 && (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0 && (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn <= 0 && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) { + jj = 0 + for { + if !(jj < ii) { + break + } + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).FargvIndex = 0 + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(0) + goto _3 + _3: + ; + jj++ + } + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8))).FargvIndex = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8))).Fomit = uint8(1) + /* This strategy involves a two rowid lookups on an B-Tree structures + ** and then a linear search of an R-Tree node. This should be + ** considered almost as quick as a direct rowid lookup (for which + ** sqlite uses an internal cost of 0.0). It is expected to return + ** a single row. + */ + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = int32(SQLITE_INDEX_SCAN_UNIQUE) + return SQLITE_OK + } + if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0 && ((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn > 0 && (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn <= int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_MATCH)) { + doOmit = uint8(1) + switch int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) { + case int32(SQLITE_INDEX_CONSTRAINT_EQ): + op = uint8(RTREE_EQ) + doOmit = uint8(0) + case int32(SQLITE_INDEX_CONSTRAINT_GT): + op = uint8(RTREE_GT) + doOmit = uint8(0) + case int32(SQLITE_INDEX_CONSTRAINT_LE): + op = uint8(RTREE_LE) + case int32(SQLITE_INDEX_CONSTRAINT_LT): + op = uint8(RTREE_LT) + doOmit = uint8(0) + case int32(SQLITE_INDEX_CONSTRAINT_GE): + op = uint8(RTREE_GE) + case int32(SQLITE_INDEX_CONSTRAINT_MATCH): + op = uint8(RTREE_MATCH) + default: + op = uint8(0) + break + } + if op != 0 { + v4 = iIdx + iIdx++ + (*(*[41]int8)(unsafe.Pointer(bp)))[v4] = int8(op) + v5 = iIdx + iIdx++ + (*(*[41]int8)(unsafe.Pointer(bp)))[v5] = int8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn - libc.Int32FromInt32(1) + libc.Int32FromUint8('0')) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8))).FargvIndex = iIdx / int32(2) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8))).Fomit = doOmit + } + } + goto _2 + _2: + ; + ii++ + } + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(2) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = int32(1) + if iIdx > 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = Xsqlite3_malloc(tls, iIdx+int32(1)) + if (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr, bp, uint64(iIdx+int32(1))) + } + nRow = (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst >> (iIdx / int32(2)) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = libc.Float64FromFloat64(6) * float64(nRow) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = nRow + return rc +} + +// C documentation +// +// /* +// ** Return the N-dimensional volumn of the cell stored in *p. +// */ +func _cellArea(tls *libc.TLS, pRtree uintptr, p uintptr) (r TRtreeDValue) { + var area TRtreeDValue + _ = area + area = libc.Float64FromInt32(1) + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + switch int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim) { + case int32(5): + area = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + 9*4)) - *(*TRtreeValue)(unsafe.Pointer(p + 8 + 8*4))) + fallthrough + case int32(4): + area *= float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + 7*4)) - *(*TRtreeValue)(unsafe.Pointer(p + 8 + 6*4))) + fallthrough + case int32(3): + area *= float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + 5*4)) - *(*TRtreeValue)(unsafe.Pointer(p + 8 + 4*4))) + fallthrough + case int32(2): + area *= float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + 3*4)) - *(*TRtreeValue)(unsafe.Pointer(p + 8 + 2*4))) + fallthrough + default: + area *= float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + 1*4)) - *(*TRtreeValue)(unsafe.Pointer(p + 8))) + } + } else { + switch int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim) { + case int32(5): + area = float64(int64(*(*int32)(unsafe.Pointer(p + 8 + 9*4))) - int64(*(*int32)(unsafe.Pointer(p + 8 + 8*4)))) + fallthrough + case int32(4): + area *= float64(int64(*(*int32)(unsafe.Pointer(p + 8 + 7*4))) - int64(*(*int32)(unsafe.Pointer(p + 8 + 6*4)))) + fallthrough + case int32(3): + area *= float64(int64(*(*int32)(unsafe.Pointer(p + 8 + 5*4))) - int64(*(*int32)(unsafe.Pointer(p + 8 + 4*4)))) + fallthrough + case int32(2): + area *= float64(int64(*(*int32)(unsafe.Pointer(p + 8 + 3*4))) - int64(*(*int32)(unsafe.Pointer(p + 8 + 2*4)))) + fallthrough + default: + area *= float64(int64(*(*int32)(unsafe.Pointer(p + 8 + 1*4))) - int64(*(*int32)(unsafe.Pointer(p + 8)))) + } + } + return area +} + +// C documentation +// +// /* +// ** Return the margin length of cell p. The margin length is the sum +// ** of the objects size in each dimension. +// */ +func _cellMargin(tls *libc.TLS, pRtree uintptr, p uintptr) (r TRtreeDValue) { + var ii int32 + var margin TRtreeDValue + var v1, v2 float64 + _, _, _, _ = ii, margin, v1, v2 + margin = libc.Float64FromInt32(0) + ii = int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) - int32(2) + for cond := true; cond; cond = ii >= 0 { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v1 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(ii+int32(1))*4))) + } else { + v1 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(ii+int32(1))*4))) + } + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v2 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(ii)*4))) + } else { + v2 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(ii)*4))) + } + margin += v1 - v2 + ii -= int32(2) + } + return margin +} + +// C documentation +// +// /* +// ** Store the union of cells p1 and p2 in p1. +// */ +func _cellUnion(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) { + var ii, v3, v4 int32 + var v1, v2 TRtreeValue + _, _, _, _, _ = ii, v1, v2, v3, v4 + ii = 0 + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + for cond := true; cond; cond = ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) { + if *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) < *(*TRtreeValue)(unsafe.Pointer(p2 + 8 + uintptr(ii)*4)) { + v1 = *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) + } else { + v1 = *(*TRtreeValue)(unsafe.Pointer(p2 + 8 + uintptr(ii)*4)) + } + *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) = v1 + if *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) > *(*TRtreeValue)(unsafe.Pointer(p2 + 8 + uintptr(ii+int32(1))*4)) { + v2 = *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) + } else { + v2 = *(*TRtreeValue)(unsafe.Pointer(p2 + 8 + uintptr(ii+int32(1))*4)) + } + *(*TRtreeValue)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) = v2 + ii += int32(2) + } + } else { + for cond := true; cond; cond = ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) { + if *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) < *(*int32)(unsafe.Pointer(p2 + 8 + uintptr(ii)*4)) { + v3 = *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) + } else { + v3 = *(*int32)(unsafe.Pointer(p2 + 8 + uintptr(ii)*4)) + } + *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii)*4)) = v3 + if *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) > *(*int32)(unsafe.Pointer(p2 + 8 + uintptr(ii+int32(1))*4)) { + v4 = *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) + } else { + v4 = *(*int32)(unsafe.Pointer(p2 + 8 + uintptr(ii+int32(1))*4)) + } + *(*int32)(unsafe.Pointer(p1 + 8 + uintptr(ii+int32(1))*4)) = v4 + ii += int32(2) + } + } +} + +// C documentation +// +// /* +// ** Return true if the area covered by p2 is a subset of the area covered +// ** by p1. False otherwise. +// */ +func _cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) (r int32) { + var a1, a11, a2, a21 uintptr + var ii int32 + _, _, _, _, _ = a1, a11, a2, a21, ii + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == int32(RTREE_COORD_INT32) { + ii = 0 + for { + if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)) { + break + } + a1 = p1 + 8 + uintptr(ii)*4 + a2 = p2 + 8 + uintptr(ii)*4 + if *(*int32)(unsafe.Pointer(a2)) < *(*int32)(unsafe.Pointer(a1)) || *(*int32)(unsafe.Pointer(a2 + 1*4)) > *(*int32)(unsafe.Pointer(a1 + 1*4)) { + return 0 + } + goto _1 + _1: + ; + ii += int32(2) + } + } else { + ii = 0 + for { + if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)) { + break + } + a11 = p1 + 8 + uintptr(ii)*4 + a21 = p2 + 8 + uintptr(ii)*4 + if *(*TRtreeValue)(unsafe.Pointer(a21)) < *(*TRtreeValue)(unsafe.Pointer(a11)) || *(*TRtreeValue)(unsafe.Pointer(a21 + 1*4)) > *(*TRtreeValue)(unsafe.Pointer(a11 + 1*4)) { + return 0 + } + goto _2 + _2: + ; + ii += int32(2) + } + } + return int32(1) +} + +func _cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell int32) (r TRtreeDValue) { + var ii, jj int32 + var o, overlap, x1, x2 TRtreeDValue + var v10, v11, v12, v3, v4, v5, v6, v7, v8, v9 float64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ii, jj, o, overlap, x1, x2, v10, v11, v12, v3, v4, v5, v6, v7, v8, v9 + overlap = float64(0) + ii = 0 + for { + if !(ii < nCell) { + break + } + o = libc.Float64FromInt32(1) + jj = 0 + for { + if !(jj < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)) { + break + } + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v4 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(jj)*4))) + } else { + v4 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(jj)*4))) + } + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v5 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj)*4))) + } else { + v5 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj)*4))) + } + if v4 > v5 { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v6 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(jj)*4))) + } else { + v6 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(jj)*4))) + } + v3 = v6 + } else { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v7 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj)*4))) + } else { + v7 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj)*4))) + } + v3 = v7 + } + x1 = v3 + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v9 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(jj+int32(1))*4))) + } else { + v9 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(jj+int32(1))*4))) + } + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v10 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj+int32(1))*4))) + } else { + v10 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj+int32(1))*4))) + } + if v9 < v10 { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v11 = float64(*(*TRtreeValue)(unsafe.Pointer(p + 8 + uintptr(jj+int32(1))*4))) + } else { + v11 = float64(*(*int32)(unsafe.Pointer(p + 8 + uintptr(jj+int32(1))*4))) + } + v8 = v11 + } else { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v12 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj+int32(1))*4))) + } else { + v12 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(ii)*48 + 8 + uintptr(jj+int32(1))*4))) + } + v8 = v12 + } + x2 = v8 + if x2 < x1 { + o = libc.Float64FromInt32(0) + break + } else { + o = o * (x2 - x1) + } + goto _2 + _2: + ; + jj += int32(2) + } + overlap += o + goto _1 + _1: + ; + ii++ + } + return overlap +} + +// C documentation +// +// /* +// ** This function implements the ChooseLeaf algorithm from Gutman[84]. +// ** ChooseSubTree in r*tree terminology. +// */ +func _ChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, ppLeaf uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var area, area1, fMinArea, fMinGrowth, growth TRtreeDValue + var bFound, iCell, ii, nCell, rc int32 + var iBest Tsqlite3_int64 + var _ /* cell at bp+16 */ TRtreeCell + var _ /* cell at bp+64 */ TRtreeCell + var _ /* pChild at bp+8 */ uintptr + var _ /* pNode at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _ = area, area1, bFound, fMinArea, fMinGrowth, growth, iBest, iCell, ii, nCell, rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp) + ii = 0 + for { + if !(rc == SQLITE_OK && ii < (*TRtree)(unsafe.Pointer(pRtree)).FiDepth-iHeight) { + break + } + iBest = 0 + bFound = 0 + fMinGrowth = float64(0) + fMinArea = float64(0) + nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FzData+2) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + /* First check to see if there is are any cells in pNode that completely + ** contains pCell. If two or more cells in pNode completely contain pCell + ** then pick the smallest. + */ + iCell = 0 + for { + if !(iCell < nCell) { + break + } + _nodeGetCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), iCell, bp+16) + if _cellContains(tls, pRtree, bp+16, pCell) != 0 { + area = _cellArea(tls, pRtree, bp+16) + if bFound == 0 || area < fMinArea { + iBest = (*(*TRtreeCell)(unsafe.Pointer(bp + 16))).FiRowid + fMinArea = area + bFound = int32(1) + } + } + goto _2 + _2: + ; + iCell++ + } + if !(bFound != 0) { + /* No cells of pNode will completely contain pCell. So pick the + ** cell of pNode that grows by the least amount when pCell is added. + ** Break ties by selecting the smaller cell. + */ + iCell = 0 + for { + if !(iCell < nCell) { + break + } + _nodeGetCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), iCell, bp+64) + area1 = _cellArea(tls, pRtree, bp+64) + _cellUnion(tls, pRtree, bp+64, pCell) + growth = _cellArea(tls, pRtree, bp+64) - area1 + if iCell == 0 || growth < fMinGrowth || growth == fMinGrowth && area1 < fMinArea { + fMinGrowth = growth + fMinArea = area1 + iBest = (*(*TRtreeCell)(unsafe.Pointer(bp + 64))).FiRowid + } + goto _3 + _3: + ; + iCell++ + } + } + rc = _nodeAcquire(tls, pRtree, iBest, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + goto _1 + _1: + ; + ii++ + } + *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp)) + return rc +} + +// C documentation +// +// /* +// ** A cell with the same content as pCell has just been inserted into +// ** the node pNode. This function updates the bounding box cells in +// ** all ancestor elements. +// */ +func _AdjustTree(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var cnt, rc int32 + var p, pParent uintptr + var _ /* cell at bp+0 */ TRtreeCell + var _ /* iCell at bp+48 */ int32 + _, _, _, _ = cnt, p, pParent, rc + p = pNode + cnt = 0 + for (*TRtreeNode)(unsafe.Pointer(p)).FpParent != 0 { + pParent = (*TRtreeNode)(unsafe.Pointer(p)).FpParent + cnt++ + if cnt > int32(100) { + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<iNode) to the _rowid table. +// */ +func _rowidWrite(tls *libc.TLS, pRtree uintptr, iRowid Tsqlite3_int64, iNode Tsqlite3_int64) (r int32) { + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid, int32(1), iRowid) + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid, int32(2), iNode) + Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + return Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid) +} + +// C documentation +// +// /* +// ** Write mapping (iNode->iPar) to the _parent table. +// */ +func _parentWrite(tls *libc.TLS, pRtree uintptr, iNode Tsqlite3_int64, iPar Tsqlite3_int64) (r int32) { + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteParent, int32(1), iNode) + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteParent, int32(2), iPar) + Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteParent) + return Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteParent) +} + +// C documentation +// +// /* +// ** Arguments aIdx, aCell and aSpare all point to arrays of size +// ** nIdx. The aIdx array contains the set of integers from 0 to +// ** (nIdx-1) in no particular order. This function sorts the values +// ** in aIdx according to dimension iDim of the cells in aCell. The +// ** minimum value of dimension iDim is considered first, the +// ** maximum used to break ties. +// ** +// ** The aSpare array is used as temporary working space by the +// ** sorting algorithm. +// */ +func _SortByDimension(tls *libc.TLS, pRtree uintptr, aIdx uintptr, nIdx int32, iDim int32, aCell uintptr, aSpare uintptr) { + var aLeft, aRight uintptr + var iLeft, iRight, nLeft, nRight int32 + var xleft1, xleft2, xright1, xright2 TRtreeDValue + var v1, v2, v3, v4 float64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aLeft, aRight, iLeft, iRight, nLeft, nRight, xleft1, xleft2, xright1, xright2, v1, v2, v3, v4 + if nIdx > int32(1) { + iLeft = 0 + iRight = 0 + nLeft = nIdx / int32(2) + nRight = nIdx - nLeft + aLeft = aIdx + aRight = aIdx + uintptr(nLeft)*4 + _SortByDimension(tls, pRtree, aLeft, nLeft, iDim, aCell, aSpare) + _SortByDimension(tls, pRtree, aRight, nRight, iDim, aCell, aSpare) + libc.Xmemcpy(tls, aSpare, aLeft, uint64(4)*uint64(nLeft)) + aLeft = aSpare + for iLeft < nLeft || iRight < nRight { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v1 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 + uintptr(iDim*int32(2))*4))) + } else { + v1 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 + uintptr(iDim*int32(2))*4))) + } + xleft1 = v1 + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v2 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 + uintptr(iDim*int32(2)+int32(1))*4))) + } else { + v2 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 + uintptr(iDim*int32(2)+int32(1))*4))) + } + xleft2 = v2 + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v3 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 + uintptr(iDim*int32(2))*4))) + } else { + v3 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 + uintptr(iDim*int32(2))*4))) + } + xright1 = v3 + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + v4 = float64(*(*TRtreeValue)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 + uintptr(iDim*int32(2)+int32(1))*4))) + } else { + v4 = float64(*(*int32)(unsafe.Pointer(aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 + uintptr(iDim*int32(2)+int32(1))*4))) + } + xright2 = v4 + if iLeft != nLeft && (iRight == nRight || xleft1 < xright1 || xleft1 == xright1 && xleft2 < xright2) { + *(*int32)(unsafe.Pointer(aIdx + uintptr(iLeft+iRight)*4)) = *(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)) + iLeft++ + } else { + *(*int32)(unsafe.Pointer(aIdx + uintptr(iLeft+iRight)*4)) = *(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)) + iRight++ + } + } + } +} + +// C documentation +// +// /* +// ** Implementation of the R*-tree variant of SplitNode from Beckman[1990]. +// */ +func _splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int32, pLeft uintptr, pRight uintptr, pBboxLeft uintptr, pBboxRight uintptr) (r int32) { + bp := tls.Alloc(96) + defer tls.Free(96) + var aSpare, aaSorted, pBbox, pCell, pTarget, v7, v8 uintptr + var area, fBestArea, fBestMargin, fBestOverlap, margin, overlap TRtreeDValue + var iBestDim, iBestLeft, iBestSplit, ii, jj, kk, nLeft int32 + var nByte Tsqlite3_int64 + var _ /* left at bp+0 */ TRtreeCell + var _ /* right at bp+48 */ TRtreeCell + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aSpare, aaSorted, area, fBestArea, fBestMargin, fBestOverlap, iBestDim, iBestLeft, iBestSplit, ii, jj, kk, margin, nByte, nLeft, overlap, pBbox, pCell, pTarget, v7, v8 + iBestDim = 0 + iBestSplit = 0 + fBestMargin = float64(0) + nByte = int64(uint64(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim)+libc.Int32FromInt32(1)) * (uint64(8) + uint64(nCell)*uint64(4))) + aaSorted = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(aaSorted != 0) { + return int32(SQLITE_NOMEM) + } + aSpare = aaSorted + uintptr((*TRtree)(unsafe.Pointer(pRtree)).FnDim)*8 + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim)*nCell)*4 + libc.Xmemset(tls, aaSorted, 0, uint64(nByte)) + ii = 0 + for { + if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim)) { + break + } + *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) = aaSorted + uintptr((*TRtree)(unsafe.Pointer(pRtree)).FnDim)*8 + uintptr(ii*nCell)*4 + jj = 0 + for { + if !(jj < nCell) { + break + } + *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj + goto _2 + _2: + ; + jj++ + } + _SortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) + goto _1 + _1: + ; + ii++ + } + ii = 0 + for { + if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim)) { + break + } + margin = float64(0) + fBestOverlap = float64(0) + fBestArea = float64(0) + iBestLeft = 0 + nLeft = ((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize - int32(4)) / int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) / int32(3) + for { + if !(nLeft <= nCell-((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize-int32(4))/int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)/int32(3)) { + break + } + libc.Xmemcpy(tls, bp, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)))))*48, uint64(48)) + libc.Xmemcpy(tls, bp+48, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(nCell-int32(1))*4)))*48, uint64(48)) + kk = int32(1) + for { + if !(kk < nCell-int32(1)) { + break + } + if kk < nLeft { + _cellUnion(tls, pRtree, bp, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(kk)*4)))*48) + } else { + _cellUnion(tls, pRtree, bp+48, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(kk)*4)))*48) + } + goto _5 + _5: + ; + kk++ + } + margin += _cellMargin(tls, pRtree, bp) + margin += _cellMargin(tls, pRtree, bp+48) + overlap = _cellOverlap(tls, pRtree, bp, bp+48, int32(1)) + area = _cellArea(tls, pRtree, bp) + _cellArea(tls, pRtree, bp+48) + if nLeft == ((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize-int32(4))/int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)/int32(3) || overlap < fBestOverlap || overlap == fBestOverlap && area < fBestArea { + iBestLeft = nLeft + fBestOverlap = overlap + fBestArea = area + } + goto _4 + _4: + ; + nLeft++ + } + if ii == 0 || margin < fBestMargin { + iBestDim = ii + fBestMargin = margin + iBestSplit = iBestLeft + } + goto _3 + _3: + ; + ii++ + } + libc.Xmemcpy(tls, pBboxLeft, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48, uint64(48)) + libc.Xmemcpy(tls, pBboxRight, aCell+uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)) + uintptr(iBestSplit)*4)))*48, uint64(48)) + ii = 0 + for { + if !(ii < nCell) { + break + } + if ii < iBestSplit { + v7 = pLeft + } else { + v7 = pRight + } + pTarget = v7 + if ii < iBestSplit { + v8 = pBboxLeft + } else { + v8 = pBboxRight + } + pBbox = v8 + pCell = aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)) + uintptr(ii)*4)))*48 + _nodeInsertCell(tls, pRtree, pTarget, pCell) + _cellUnion(tls, pRtree, pBbox, pCell) + goto _6 + _6: + ; + ii++ + } + Xsqlite3_free(tls, aaSorted) + return SQLITE_OK +} + +func _updateMapping(tls *libc.TLS, pRtree uintptr, iRowid Ti64, pNode uintptr, iHeight int32) (r int32) { + var p, pChild, xSetMapping, v1 uintptr + _, _, _, _ = p, pChild, xSetMapping, v1 + if iHeight == 0 { + v1 = __ccgo_fp(_rowidWrite) + } else { + v1 = __ccgo_fp(_parentWrite) + } + xSetMapping = v1 + if iHeight > 0 { + pChild = _nodeHashLookup(tls, pRtree, iRowid) + p = pNode + for { + if !(p != 0) { + break + } + if p == pChild { + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<pParent chain all the way up to the root node. +// ** +// ** This operation is required when a row is deleted (or updated - an update +// ** is implemented as a delete followed by an insert). SQLite provides the +// ** rowid of the row to delete, which can be used to find the leaf on which +// ** the entry resides (argument pLeaf). Once the leaf is located, this +// ** function is called to determine its ancestry. +// */ +func _fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) (r int32) { + var iNode Ti64 + var pChild, pTest uintptr + var rc, rc2 int32 + _, _, _, _, _ = iNode, pChild, pTest, rc, rc2 + rc = SQLITE_OK + pChild = pLeaf + for rc == SQLITE_OK && (*TRtreeNode)(unsafe.Pointer(pChild)).FiNode != int64(1) && (*TRtreeNode)(unsafe.Pointer(pChild)).FpParent == uintptr(0) { + rc2 = SQLITE_OK /* sqlite3_reset() return code */ + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadParent, int32(1), (*TRtreeNode)(unsafe.Pointer(pChild)).FiNode) + rc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadParent) + if rc == int32(SQLITE_ROW) { /* Node number of parent node */ + /* Before setting pChild->pParent, test that we are not creating a + ** loop of references (as we would if, say, pChild==pParent). We don't + ** want to do this as it leads to a memory leak when trying to delete + ** the referenced counted node structures. + */ + iNode = Xsqlite3_column_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadParent, 0) + pTest = pLeaf + for { + if !(pTest != 0 && (*TRtreeNode)(unsafe.Pointer(pTest)).FiNode != iNode) { + break + } + goto _1 + _1: + ; + pTest = (*TRtreeNode)(unsafe.Pointer(pTest)).FpParent + } + if pTest == uintptr(0) { + rc2 = _nodeAcquire(tls, pRtree, iNode, uintptr(0), pChild) + } + } + rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadParent) + if rc == SQLITE_OK { + rc = rc2 + } + if rc == SQLITE_OK && !((*TRtreeNode)(unsafe.Pointer(pChild)).FpParent != 0) { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + pChild = _nodeHashLookup(tls, pRtree, (*TRtreeCell)(unsafe.Pointer(pCell)).FiRowid) + if pChild != 0 { + _nodeRelease(tls, pRtree, (*TRtreeNode)(unsafe.Pointer(pChild)).FpParent) + _nodeReference(tls, pNode) + (*TRtreeNode)(unsafe.Pointer(pChild)).FpParent = pNode + } + } + if _nodeInsertCell(tls, pRtree, pNode, pCell) != 0 { + rc = _SplitNode(tls, pRtree, pNode, pCell, iHeight) + } else { + rc = _AdjustTree(tls, pRtree, pNode, pCell) + if rc == SQLITE_OK { + if iHeight == 0 { + rc = _rowidWrite(tls, pRtree, (*TRtreeCell)(unsafe.Pointer(pCell)).FiRowid, (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode) + } else { + rc = _parentWrite(tls, pRtree, (*TRtreeCell)(unsafe.Pointer(pCell)).FiRowid, (*TRtreeNode)(unsafe.Pointer(pNode)).FiNode) + } + } + } + return rc +} + +func _reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var ii, nCell, rc, rc2 int32 + var _ /* cell at bp+8 */ TRtreeCell + var _ /* pInsert at bp+0 */ uintptr + _, _, _, _ = ii, nCell, rc, rc2 + rc = SQLITE_OK + nCell = _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(pNode)).FzData+2) + ii = 0 + for { + if !(rc == SQLITE_OK && ii < nCell) { + break + } + _nodeGetCell(tls, pRtree, pNode, ii, bp+8) + /* Find a node to store this cell in. pNode->iNode currently contains + ** the height of the sub-tree headed by the cell. + */ + rc = _ChooseLeaf(tls, pRtree, bp+8, int32((*TRtreeNode)(unsafe.Pointer(pNode)).FiNode), bp) + if rc == SQLITE_OK { + rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), bp+8, int32((*TRtreeNode)(unsafe.Pointer(pNode)).FiNode)) + rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + rc = rc2 + } + } + goto _1 + _1: + ; + ii++ + } + return rc +} + +// C documentation +// +// /* +// ** Select a currently unused rowid for a new r-tree record. +// */ +func _rtreeNewRowid(tls *libc.TLS, pRtree uintptr, piRowid uintptr) (r int32) { + var rc int32 + _ = rc + Xsqlite3_bind_null(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid, int32(1)) + Xsqlite3_bind_null(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid, int32(2)) + Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + *(*Ti64)(unsafe.Pointer(piRowid)) = Xsqlite3_last_insert_rowid(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) + return rc +} + +// C documentation +// +// /* +// ** Remove the entry with rowid=iDelete from the r-tree structure. +// */ +func _rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Tsqlite3_int64) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iChild Ti64 + var rc, rc2, rc21 int32 + var _ /* iCell at bp+8 */ int32 + var _ /* pChild at bp+24 */ uintptr + var _ /* pLeaf at bp+0 */ uintptr + var _ /* pRoot at bp+16 */ uintptr + _, _, _, _ = iChild, rc, rc2, rc21 /* Return code */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Index of iDelete cell in pLeaf */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) /* Root node of rtree structure */ + /* Obtain a reference to the root node to initialize Rtree.iDepth */ + rc = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp+16) + /* Obtain a reference to the leaf node that contains the entry + ** about to be deleted. + */ + if rc == SQLITE_OK { + rc = _findLeafNode(tls, pRtree, iDelete, bp, uintptr(0)) + } + /* Delete the cell in question from the leaf node. */ + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp)) != 0 { + rc = _nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), iDelete, bp+8) + if rc == SQLITE_OK { + rc = _deleteCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), 0) + } + rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + rc = rc2 + } + } + /* Delete the corresponding entry in the _rowid table. */ + if rc == SQLITE_OK { + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpDeleteRowid, int32(1), iDelete) + Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpDeleteRowid) + rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpDeleteRowid) + } + /* Check if the root node now has exactly one child. If so, remove + ** it, schedule the contents of the child for reinsertion and + ** reduce the tree height by one. + ** + ** This is equivalent to copying the contents of the child into + ** the root node (the operation that Gutman's paper says to perform + ** in this scenario). + */ + if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FiDepth > 0 && _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FzData+2) == int32(1) { + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + iChild = _nodeGetRowid(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 16)), 0) + rc = _nodeAcquire(tls, pRtree, iChild, *(*uintptr)(unsafe.Pointer(bp + 16)), bp+24) /* tag-20210916a */ + if rc == SQLITE_OK { + rc = _removeNode(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24)), (*TRtree)(unsafe.Pointer(pRtree)).FiDepth-int32(1)) + } + rc21 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24))) + if rc == SQLITE_OK { + rc = rc21 + } + if rc == SQLITE_OK { + (*TRtree)(unsafe.Pointer(pRtree)).FiDepth-- + _writeInt16(tls, (*TRtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FzData, (*TRtree)(unsafe.Pointer(pRtree)).FiDepth) + (*TRtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FisDirty = int32(1) + } + } + /* Re-insert the contents of any underfull nodes removed from the tree. */ + *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted + for { + if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) { + break + } + if rc == SQLITE_OK { + rc = _reinsertNodeContent(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + } + (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted = (*TRtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FpNext + (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef-- + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + goto _1 + _1: + ; + *(*uintptr)(unsafe.Pointer(bp)) = (*TRtree)(unsafe.Pointer(pRtree)).FpDeleted + } + /* Release the reference to the root node. */ + if rc == SQLITE_OK { + rc = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 16))) + } else { + _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 16))) + } + return rc +} + +/* +** Rounding constants for float->double conversion. + */ + +// C documentation +// +// /* +// ** Convert an sqlite3_value into an RtreeValue (presumably a float) +// ** while taking care to round toward negative or positive, respectively. +// */ +func _rtreeValueDown(tls *libc.TLS, v uintptr) (r TRtreeValue) { + var d, v1 float64 + var f float32 + _, _, _ = d, f, v1 + d = Xsqlite3_value_double(tls, v) + f = float32(d) + if float64(f) > d { + if d < libc.Float64FromInt32(0) { + v1 = float64(1) + libc.Float64FromFloat64(1)/libc.Float64FromFloat64(8.388608e+06) + } else { + v1 = float64(1) - libc.Float64FromFloat64(1)/libc.Float64FromFloat64(8.388608e+06) + } + f = float32(d * v1) + } + return f +} + +func _rtreeValueUp(tls *libc.TLS, v uintptr) (r TRtreeValue) { + var d, v1 float64 + var f float32 + _, _, _ = d, f, v1 + d = Xsqlite3_value_double(tls, v) + f = float32(d) + if float64(f) < d { + if d < libc.Float64FromInt32(0) { + v1 = float64(1) - libc.Float64FromFloat64(1)/libc.Float64FromFloat64(8.388608e+06) + } else { + v1 = float64(1) + libc.Float64FromFloat64(1)/libc.Float64FromFloat64(8.388608e+06) + } + f = float32(d * v1) + } + return f +} + +// C documentation +// +// /* +// ** A constraint has failed while inserting a row into an rtree table. +// ** Assuming no OOM error occurs, this function sets the error message +// ** (at pRtree->base.zErrMsg) to an appropriate value and returns +// ** SQLITE_CONSTRAINT. +// ** +// ** Parameter iCol is the index of the leftmost column involved in the +// ** constraint failure. If it is 0, then the constraint that failed is +// ** the unique constraint on the id column. Otherwise, it is the rtree +// ** (c1<=c2) constraint on columns iCol and iCol+1 that has failed. +// ** +// ** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. +// */ +func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var rc, v1 int32 + var zCol, zCol1, zCol2, zSql uintptr + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25874, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + if zSql != 0 { + rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) + } else { + rc = int32(SQLITE_NOMEM) + } + Xsqlite3_free(tls, zSql) + if rc == SQLITE_OK { + if iCol == 0 { + zCol = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25894, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + } else { + zCol1 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol) + zCol2 = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), iCol+int32(1)) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+25926, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + } + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + v1 = int32(SQLITE_CONSTRAINT) + } else { + v1 = rc + } + return v1 +} + +// C documentation +// +// /* +// ** The xUpdate method for rtree module virtual tables. +// */ +func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32 + var pRtree, pUp uintptr + var _ /* cell at bp+0 */ TRtreeCell + var _ /* pLeaf at bp+48 */ uintptr + _, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc + pRtree = pVtab + rc = SQLITE_OK /* New cell to insert if nData>1 */ + bHaveRowid = 0 /* Set to 1 after new rowid is determined */ + if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 { + /* Unable to write to the btree while another cursor is reading from it, + ** since the write might do a rebalance which would disrupt the read + ** cursor. */ + return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<=x1" constraint. + ** + ** In the first case, if the conflict-handling mode is REPLACE, then + ** the conflicting row can be removed before proceeding. In the second + ** case, SQLITE_CONSTRAINT must be returned regardless of the + ** conflict-handling mode specified by the user. + */ + if nData > int32(1) { + nn = nData - int32(4) + if nn > int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) { + nn = int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) + } + /* Populate the cell.aCoord[] array. The first coordinate is aData[3]. + ** + ** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared + ** with "column" that are interpreted as table constraints. + ** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5)); + ** This problem was discovered after years of use, so we silently ignore + ** these kinds of misdeclared tables to avoid breaking any legacy. + */ + if int32((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + ii = 0 + for { + if !(ii < nn) { + break + } + *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8))) + *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8))) + if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) { + rc = _rtreeConstraintError(tls, pRtree, ii+int32(1)) + goto constraint + } + goto _1 + _1: + ; + ii += int32(2) + } + } else { + ii = 0 + for { + if !(ii < nn) { + break + } + *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8))) + *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8))) + if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) { + rc = _rtreeConstraintError(tls, pRtree, ii+int32(1)) + goto constraint + } + goto _2 + _2: + ; + ii += int32(2) + } + } + /* If a rowid value was supplied, check if it is already present in + ** the table. If so, the constraint has failed. */ + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) { + (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid { + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid) + steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + if int32(SQLITE_ROW) == steprc { + if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) { + rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid) + } else { + rc = _rtreeConstraintError(tls, pRtree, 0) + goto constraint + } + } + } + bHaveRowid = int32(1) + } + } + /* If aData[0] is not an SQL NULL value, it is the rowid of a + ** record to delete from the r-tree table. The following block does + ** just that. + */ + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) { + rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData)))) + } + /* If the aData[] array contains more than one element, elements + ** (aData[2]..aData[argc-1]) contain a new record to insert into + ** the r-tree structure. + */ + if rc == SQLITE_OK && nData > int32(1) { + /* Insert the new record into the r-tree */ + *(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0) + /* Figure out the rowid of the new row. */ + if bHaveRowid == 0 { + rc = _rtreeNewRowid(tls, pRtree, bp) + } + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid + if rc == SQLITE_OK { + rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48) + } + if rc == SQLITE_OK { + rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0) + rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48))) + if rc == SQLITE_OK { + rc = rc2 + } + } + if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 { + pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux + Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid))) + jj = 0 + for { + if !(jj < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { + break + } + Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8))) + goto _3 + _3: + ; + jj++ + } + Xsqlite3_step(tls, pUp) + rc = Xsqlite3_reset(tls, pUp) + } + } +constraint: + ; + _rtreeRelease(tls, pRtree) + return rc +} + +// C documentation +// +// /* +// ** Called when a transaction starts. +// */ +func _rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { + var pRtree uintptr + _ = pRtree + pRtree = pVtab + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(1) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Called when a transaction completes (either by COMMIT or ROLLBACK). +// ** The sqlite3_blob object should be released at this point. +// */ +func _rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) (r int32) { + var pRtree uintptr + _ = pRtree + pRtree = pVtab + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(0) + _nodeBlobReset(tls, pRtree) + return SQLITE_OK +} + +func _rtreeRollback(tls *libc.TLS, pVtab uintptr) (r int32) { + return _rtreeEndTransaction(tls, pVtab) +} + +// C documentation +// +// /* +// ** The xRename method for rtree module virtual tables. +// */ +func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var pRtree, zSql uintptr + var rc int32 + _, _, _ = pRtree, rc, zSql + pRtree = pVtab + rc = int32(SQLITE_NOMEM) + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+25963, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + if zSql != 0 { + _nodeBlobReset(tls, pRtree) + rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_free(tls, zSql) + } + return rc +} + +// C documentation +// +// /* +// ** The xSavepoint method. +// ** +// ** This module does not need to do anything to support savepoints. However, +// ** it uses this hook to close any open blob handle. This is done because a +// ** DROP TABLE command - which fortunately always opens a savepoint - cannot +// ** succeed if there are any open blob handles. i.e. if the blob handle were +// ** not closed here, the following would fail: +// ** +// ** BEGIN; +// ** INSERT INTO rtree... +// ** DROP TABLE ; -- Would fail with SQLITE_LOCKED +// ** COMMIT; +// */ +func _rtreeSavepoint(tls *libc.TLS, pVtab uintptr, iSavepoint int32) (r int32) { + var iwt Tu8 + var pRtree uintptr + _, _ = iwt, pRtree + pRtree = pVtab + iwt = (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans + _ = iSavepoint + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = uint8(0) + _nodeBlobReset(tls, pRtree) + (*TRtree)(unsafe.Pointer(pRtree)).FinWrTrans = iwt + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function populates the pRtree->nRowEst variable with an estimate +// ** of the number of rows in the virtual table. If possible, this is based +// ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. +// */ +func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var nRow Ti64 + var rc, v1 int32 + var zFmt, zSql uintptr + var v2 int64 + var _ /* p at bp+0 */ uintptr + _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 + zFmt = __ccgo_ts + 26108 + nRow = int64(RTREE_MIN_ROWEST) + rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+11614, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc != SQLITE_OK { + (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) + if rc == int32(SQLITE_ERROR) { + v1 = SQLITE_OK + } else { + v1 = rc + } + return v1 + } + zSql = Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) + if rc == SQLITE_OK { + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { + nRow = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + Xsqlite3_free(tls, zSql) + } + if nRow > int64(libc.Int32FromInt32(RTREE_MIN_ROWEST)) { + v2 = nRow + } else { + v2 = int64(libc.Int32FromInt32(RTREE_MIN_ROWEST)) + } + (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = v2 + return rc +} + +// C documentation +// +// /* +// ** Return true if zName is the extension on one of the shadow tables used +// ** by this module. +// */ +func _rtreeShadowName(tls *libc.TLS, zName uintptr) (r int32) { + var i uint32 + _ = i + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(8)) { + break + } + if Xsqlite3_stricmp(tls, zName, _azName1[i]) == 0 { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +var _azName1 = [3]uintptr{ + 0: __ccgo_ts + 26164, + 1: __ccgo_ts + 5516, + 2: __ccgo_ts + 16726, +} + +var _rtreeModule = Tsqlite3_module{ + FiVersion: int32(4), +} + +func init() { + p := unsafe.Pointer(&_rtreeModule) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_rtreeCreate) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_rtreeConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_rtreeBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_rtreeDisconnect) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_rtreeDestroy) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_rtreeOpen) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rtreeClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rtreeFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_rtreeNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rtreeEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_rtreeColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_rtreeRowid) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_rtreeUpdate) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeRollback) + *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) + *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) + *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) + *(*uintptr)(unsafe.Add(p, 192)) = __ccgo_fp(_rtreeIntegrity) +} + +func _rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefix uintptr, isCreate int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var appStmt [8]uintptr + var f, i, ii, ii1, rc int32 + var p, p1, zCreate, zFormat, zSql, zSql1 uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = appStmt, f, i, ii, ii1, p, p1, rc, zCreate, zFormat, zSql, zSql1 + rc = SQLITE_OK + f = libc.Int32FromInt32(SQLITE_PREPARE_PERSISTENT) | libc.Int32FromInt32(SQLITE_PREPARE_NO_VTAB) + (*TRtree)(unsafe.Pointer(pRtree)).Fdb = db + if isCreate != 0 { + p = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26578, libc.VaList(bp+8, zDb, zPrefix)) + ii = 0 + for { + if !(ii < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { + break + } + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26640, libc.VaList(bp+8, ii)) + goto _1 + _1: + ; + ii++ + } + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26645, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26709, libc.VaList(bp+8, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, __ccgo_ts+26779, libc.VaList(bp+8, zDb, zPrefix, (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + zCreate = Xsqlite3_str_finish(tls, p) + if !(zCreate != 0) { + return int32(SQLITE_NOMEM) + } + rc = Xsqlite3_exec(tls, db, zCreate, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_free(tls, zCreate) + if rc != SQLITE_OK { + return rc + } + } + appStmt[0] = pRtree + 120 + appStmt[int32(1)] = pRtree + 128 + appStmt[int32(2)] = pRtree + 136 + appStmt[int32(3)] = pRtree + 144 + appStmt[int32(4)] = pRtree + 152 + appStmt[int32(5)] = pRtree + 160 + appStmt[int32(6)] = pRtree + 168 + appStmt[int32(7)] = pRtree + 176 + rc = _rtreeQueryStat1(tls, db, pRtree) + i = 0 + for { + if !(i < int32(N_STATEMENT) && rc == SQLITE_OK) { + break + } + if i != int32(3) || int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) == 0 { + zFormat = _azSql[i] + } else { + /* An UPSERT is very slightly slower than REPLACE, but it is needed + ** if there are auxiliary columns */ + zFormat = __ccgo_ts + 26828 + } + zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+8, zDb, zPrefix)) + if zSql != 0 { + rc = Xsqlite3_prepare_v3(tls, db, zSql, -int32(1), uint32(f), appStmt[i], uintptr(0)) + } else { + rc = int32(SQLITE_NOMEM) + } + Xsqlite3_free(tls, zSql) + goto _2 + _2: + ; + i++ + } + if (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 && rc != int32(SQLITE_NOMEM) { + (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, __ccgo_ts+26936, libc.VaList(bp+8, zDb, zPrefix)) + if (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + p1 = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+26981, libc.VaList(bp+8, zDb, zPrefix)) + ii1 = 0 + for { + if !(ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) { + break + } + if ii1 != 0 { + Xsqlite3_str_append(tls, p1, __ccgo_ts+13122, int32(1)) + } + if ii1 < int32((*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27008, libc.VaList(bp+8, ii1, ii1+int32(2), ii1)) + } else { + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27030, libc.VaList(bp+8, ii1, ii1+int32(2))) + } + goto _3 + _3: + ; + ii1++ + } + Xsqlite3_str_appendf(tls, p1, __ccgo_ts+27038, 0) + zSql1 = Xsqlite3_str_finish(tls, p1) + if zSql1 == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare_v3(tls, db, zSql1, -int32(1), uint32(f), pRtree+184, uintptr(0)) + Xsqlite3_free(tls, zSql1) + } + } + } + return rc +} + +var _azSql = [8]uintptr{ + 0: __ccgo_ts + 26169, + 1: __ccgo_ts + 26222, + 2: __ccgo_ts + 26267, + 3: __ccgo_ts + 26319, + 4: __ccgo_ts + 26373, + 5: __ccgo_ts + 26418, + 6: __ccgo_ts + 26476, + 7: __ccgo_ts + 26531, +} + +// C documentation +// +// /* +// ** The second argument to this function contains the text of an SQL statement +// ** that returns a single integer value. The statement is compiled and executed +// ** using database connection db. If successful, the integer value returned +// ** is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error +// ** code is returned and the value of *piVal after returning is not defined. +// */ +func _getIntFromStmt(tls *libc.TLS, db uintptr, zSql uintptr, piVal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pStmt at bp+0 */ uintptr + _ = rc + rc = int32(SQLITE_NOMEM) + if zSql != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) + if rc == SQLITE_OK { + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + *(*int32)(unsafe.Pointer(piVal)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + return rc +} + +// C documentation +// +// /* +// ** This function is called from within the xConnect() or xCreate() method to +// ** determine the node-size used by the rtree table being created or connected +// ** to. If successful, pRtree->iNodeSize is populated and SQLITE_OK returned. +// ** Otherwise, an SQLite error code is returned. +// ** +// ** If this function is being called as part of an xConnect(), then the rtree +// ** table already exists. In this case the node-size is determined by inspecting +// ** the root node of the tree. +// ** +// ** Otherwise, for an xCreate(), use 64 bytes less than the database page-size. +// ** This ensures that each node is stored on a single database page. If the +// ** database page-size is so large that more than RTREE_MAXCELLS entries +// ** would fit in a single node, use a smaller node-size. +// */ +func _getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzErr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var rc int32 + var zSql uintptr + var _ /* iPageSize at bp+0 */ int32 + _, _ = rc, zSql + if isCreate != 0 { + *(*int32)(unsafe.Pointer(bp)) = 0 + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27054, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb)) + rc = _getIntFromStmt(tls, db, zSql, bp) + if rc == SQLITE_OK { + (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = *(*int32)(unsafe.Pointer(bp)) - int32(64) + if int32(4)+int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*int32(RTREE_MAXCELLS) < (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize { + (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize = int32(4) + int32((*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)*int32(RTREE_MAXCELLS) + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + } + } else { + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27074, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) + rc = _getIntFromStmt(tls, db, zSql, pRtree+32) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + } else { + if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize < libc.Int32FromInt32(512)-libc.Int32FromInt32(64) { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< module name +// ** argv[1] -> database name +// ** argv[2] -> table name +// ** argv[...] -> column names... +// */ +func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aErrMsg [5]uintptr + var eCoordType, iErr, ii, nDb, nName, rc, v1, v3 int32 + var pRtree, pSql, zArg, zSql uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _ = aErrMsg, eCoordType, iErr, ii, nDb, nName, pRtree, pSql, rc, zArg, zSql, v1, v3 + rc = SQLITE_OK + if pAux != 0 { + v1 = int32(RTREE_COORD_INT32) + } else { + v1 = RTREE_COORD_REAL32 + } /* Length of string argv[2] */ + eCoordType = v1 + ii = int32(4) + aErrMsg = [5]uintptr{ + 1: __ccgo_ts + 27166, + 2: __ccgo_ts + 27209, + 3: __ccgo_ts + 27244, + 4: __ccgo_ts + 27280, + } + /* Aux columns counted by a u8 */ + if argc < int32(6) || argc > libc.Int32FromInt32(RTREE_MAX_AUX_COLUMN)+libc.Int32FromInt32(3) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, aErrMsg[int32(2)+libc.BoolInt32(argc >= int32(6))])) + return int32(SQLITE_ERROR) + } + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_CONSTRAINT_SUPPORT), libc.VaList(bp+8, int32(1))) + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_INNOCUOUS), 0) + /* Allocate the sqlite3_vtab structure */ + nDb = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + nName = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + pRtree = Xsqlite3_malloc64(tls, uint64(968)+uint64(nDb)+uint64(nName*int32(2))+uint64(8)) + if !(pRtree != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pRtree, 0, uint64(968)+uint64(nDb)+uint64(nName*int32(2))+uint64(8)) + (*TRtree)(unsafe.Pointer(pRtree)).FnBusy = uint32(1) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FpModule = uintptr(unsafe.Pointer(&_rtreeModule)) + (*TRtree)(unsafe.Pointer(pRtree)).FzDb = pRtree + 1*968 + (*TRtree)(unsafe.Pointer(pRtree)).FzName = (*TRtree)(unsafe.Pointer(pRtree)).FzDb + uintptr(nDb+int32(1)) + (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName = (*TRtree)(unsafe.Pointer(pRtree)).FzName + uintptr(nName+int32(1)) + (*TRtree)(unsafe.Pointer(pRtree)).FeCoordType = uint8(eCoordType) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27317, uint64(6)) + /* Create/Connect to the underlying relational database schema. If + ** that is successful, call sqlite3_declare_vtab() to configure + ** the r-tree table schema. + */ + pSql = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27323, libc.VaList(bp+8, _rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + ii = int32(4) + for { + if !(ii < argc) { + break + } + zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) + if int32(*(*int8)(unsafe.Pointer(zArg))) == int32('+') { + (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27347, libc.VaList(bp+8, _rtreeTokenLength(tls, zArg+uintptr(1)), zArg+uintptr(1))) + } else { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) > 0 { + break + } else { + (*TRtree)(unsafe.Pointer(pRtree)).FnDim2++ + Xsqlite3_str_appendf(tls, pSql, _azFormat[eCoordType], libc.VaList(bp+8, _rtreeTokenLength(tls, zArg), zArg)) + } + } + goto _2 + _2: + ; + ii++ + } + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27374, 0) + zSql = Xsqlite3_str_finish(tls, pSql) + if !(zSql != 0) { + rc = int32(SQLITE_NOMEM) + } else { + if ii < argc { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, aErrMsg[int32(4)])) + rc = int32(SQLITE_ERROR) + } else { + v3 = Xsqlite3_declare_vtab(tls, db, zSql) + rc = v3 + if SQLITE_OK != v3 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + } + } + } + Xsqlite3_free(tls, zSql) + if rc != 0 { + goto rtreeInit_fail + } + (*TRtree)(unsafe.Pointer(pRtree)).FnDim = uint8(int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) / int32(2)) + if int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim) < int32(1) { + iErr = int32(2) + } else { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) > libc.Int32FromInt32(RTREE_MAX_DIMENSIONS)*libc.Int32FromInt32(2) { + iErr = int32(3) + } else { + if int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)%int32(2) != 0 { + iErr = int32(1) + } else { + iErr = 0 + } + } + } + if iErr != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, aErrMsg[iErr])) + goto rtreeInit_fail + } + (*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell = uint8(int32(8) + int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)*int32(4)) + /* Figure out the node size to use. */ + rc = _getNodeSize(tls, db, pRtree, isCreate, pzErr) + if rc != 0 { + goto rtreeInit_fail + } + rc = _rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) + if rc != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + goto rtreeInit_fail + } + *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree + return SQLITE_OK +rtreeInit_fail: + ; + if rc == SQLITE_OK { + rc = int32(SQLITE_ERROR) + } + _rtreeRelease(tls, pRtree) + return rc +} + +var _azFormat = [2]uintptr{ + 0: __ccgo_ts + 27353, + 1: __ccgo_ts + 27364, +} + +// C documentation +// +// /* +// ** Implementation of a scalar function that decodes r-tree nodes to +// ** human readable strings. This can be used for debugging and analysis. +// ** +// ** The scalar function takes two arguments: (1) the number of dimensions +// ** to the rtree (between 1 and 5, inclusive) and (2) a blob of data containing +// ** an r-tree node. For a two-dimensional r-tree structure called "rt", to +// ** deserialize all nodes, a statement like: +// ** +// ** SELECT rtreenode(2, data) FROM rt_node; +// ** +// ** The human readable string takes the form of a Tcl list with one +// ** entry for each cell in the r-tree node. Each entry is itself a +// ** list, containing the 8-byte rowid/pageno followed by the +// ** *2 coordinates. +// */ +func _rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { + bp := tls.Alloc(1072) + defer tls.Free(1072) + var errCode, ii, jj, nData int32 + var pOut uintptr + var _ /* cell at bp+1008 */ TRtreeCell + var _ /* node at bp+0 */ TRtreeNode + var _ /* tree at bp+40 */ TRtree + _, _, _, _, _ = errCode, ii, jj, nData, pOut + _ = nArg + libc.Xmemset(tls, bp, 0, uint64(40)) + libc.Xmemset(tls, bp+40, 0, uint64(968)) + (*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim = uint8(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apArg)))) + if int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim) < int32(1) || int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim) > int32(5) { + return + } + (*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2 = uint8(int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim) * int32(2)) + (*(*TRtree)(unsafe.Pointer(bp + 40))).FnBytesPerCell = uint8(int32(8) + int32(8)*int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim)) + (*(*TRtreeNode)(unsafe.Pointer(bp))).FzData = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + if (*(*TRtreeNode)(unsafe.Pointer(bp))).FzData == uintptr(0) { + return + } + nData = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + if nData < int32(4) { + return + } + if nData < _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(bp)).FzData+2)*int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnBytesPerCell) { + return + } + pOut = Xsqlite3_str_new(tls, uintptr(0)) + ii = 0 + for { + if !(ii < _readInt16(tls, (*TRtreeNode)(unsafe.Pointer(bp)).FzData+2)) { + break + } + _nodeGetCell(tls, bp+40, bp, ii, bp+1008) + if ii > 0 { + Xsqlite3_str_append(tls, pOut, __ccgo_ts+11234, int32(1)) + } + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27377, libc.VaList(bp+1064, (*(*TRtreeCell)(unsafe.Pointer(bp + 1008))).FiRowid)) + jj = 0 + for { + if !(jj < int32((*(*TRtree)(unsafe.Pointer(bp + 40))).FnDim2)) { + break + } + Xsqlite3_str_appendf(tls, pOut, __ccgo_ts+27383, libc.VaList(bp+1064, float64(*(*TRtreeValue)(unsafe.Pointer(bp + 1008 + 8 + uintptr(jj)*4))))) + goto _2 + _2: + ; + jj++ + } + Xsqlite3_str_append(tls, pOut, __ccgo_ts+27387, int32(1)) + goto _1 + _1: + ; + ii++ + } + errCode = Xsqlite3_str_errcode(tls, pOut) + Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -int32(1), __ccgo_fp(Xsqlite3_free)) + Xsqlite3_result_error_code(tls, ctx, errCode) +} + +// C documentation +// +// /* This routine implements an SQL function that returns the "depth" parameter +// ** from the front of a blob that is an r-tree node. For example: +// ** +// ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1; +// ** +// ** The depth value is 0 for all nodes other than the root node, and the root +// ** node always has nodeno=1, so the example above is the primary use for this +// ** routine. This routine is intended for testing and analysis only. +// */ +func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { + var zBlob uintptr + _ = zBlob + _ = nArg + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < int32(2) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+27389, -int32(1)) + } else { + zBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if zBlob != 0 { + Xsqlite3_result_int(tls, ctx, _readInt16(tls, zBlob)) + } else { + Xsqlite3_result_error_nomem(tls, ctx) + } + } +} + +// C documentation +// +// /* +// ** Context object passed between the various routines that make up the +// ** implementation of integrity-check function rtreecheck(). +// */ +type TRtreeCheck = struct { + Fdb uintptr + FzDb uintptr + FzTab uintptr + FbInt int32 + FnDim int32 + FpGetNode uintptr + FaCheckMapping [2]uintptr + FnLeaf int32 + FnNonLeaf int32 + Frc int32 + FzReport uintptr + FnErr int32 +} + +type RtreeCheck = TRtreeCheck + +type TRtreeCheck1 = struct { + Fdb uintptr + FzDb uintptr + FzTab uintptr + FbInt int32 + FnDim int32 + FpGetNode uintptr + FaCheckMapping [2]uintptr + FnLeaf int32 + FnNonLeaf int32 + Frc int32 + FzReport uintptr + FnErr int32 +} + +type RtreeCheck1 = TRtreeCheck1 + +// C documentation +// +// /* +// ** Reset SQL statement pStmt. If the sqlite3_reset() call returns an error, +// ** and RtreeCheck.rc==SQLITE_OK, set RtreeCheck.rc to the error code. +// */ +func _rtreeCheckReset(tls *libc.TLS, pCheck uintptr, pStmt uintptr) { + var rc int32 + _ = rc + rc = Xsqlite3_reset(tls, pStmt) + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = rc + } +} + +// C documentation +// +// /* +// ** The second and subsequent arguments to this function are a format string +// ** and printf style arguments. This function formats the string and attempts +// ** to compile it as an SQL statement. +// ** +// ** If successful, a pointer to the new SQL statement is returned. Otherwise, +// ** NULL is returned and an error code left in RtreeCheck.rc. +// */ +func _rtreeCheckPrepare(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var ap Tva_list + var z uintptr + var _ /* pRet at bp+0 */ uintptr + _, _ = ap, z + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + ap = va + z = Xsqlite3_vmprintf(tls, zFmt, ap) + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + if z == uintptr(0) { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) + } else { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_prepare_v2(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).Fdb, z, -int32(1), bp, uintptr(0)) + } + } + Xsqlite3_free(tls, z) + _ = ap + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** The second and subsequent arguments to this function are a printf() +// ** style format string and arguments. This function formats the string and +// ** appends it to the report being accumuated in pCheck. +// */ +func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ap Tva_list + var z, v1 uintptr + _, _, _ = ap, z, v1 + ap = va + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnErr < int32(RTREE_CHECK_MAX_ERROR) { + z = Xsqlite3_vmprintf(tls, zFmt, ap) + if z == uintptr(0) { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) + } else { + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { + v1 = __ccgo_ts + 4235 + } else { + v1 = __ccgo_ts + 1680 + } + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+27422, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z)) + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) + } + } + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnErr++ + } + _ = ap +} + +// C documentation +// +// /* +// ** This function is a no-op if there is already an error code stored +// ** in the RtreeCheck object indicated by the first argument. NULL is +// ** returned in this case. +// ** +// ** Otherwise, the contents of rtree table node iNode are loaded from +// ** the database and copied into a buffer obtained from sqlite3_malloc(). +// ** If no error occurs, a pointer to the buffer is returned and (*pnNode) +// ** is set to the size of the buffer in bytes. +// ** +// ** Or, if an error does occur, NULL is returned and an error code left +// ** in the RtreeCheck object. The final value of *pnNode is undefined in +// ** this case. +// */ +func _rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode Ti64, pnNode uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var nNode int32 + var pNode, pRet uintptr + _, _, _ = nNode, pNode, pRet + pRet = uintptr(0) /* Return value */ + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0) { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27429, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + } + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + Xsqlite3_bind_int64(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, int32(1), iNode) + if Xsqlite3_step(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) == int32(SQLITE_ROW) { + nNode = Xsqlite3_column_bytes(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, 0) + pNode = Xsqlite3_column_blob(tls, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, 0) + pRet = Xsqlite3_malloc64(tls, uint64(nNode)) + if pRet == uintptr(0) { + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, pRet, pNode, uint64(nNode)) + *(*int32)(unsafe.Pointer(pnNode)) = nNode + } + } + _rtreeCheckReset(tls, pCheck, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && pRet == uintptr(0) { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27474, libc.VaList(bp+8, iNode)) + } + } + return pRet +} + +// C documentation +// +// /* +// ** This function is used to check that the %_parent (if bLeaf==0) or %_rowid +// ** (if bLeaf==1) table contains a specified entry. The schemas of the +// ** two tables are: +// ** +// ** CREATE TABLE %_parent(nodeno INTEGER PRIMARY KEY, parentnode INTEGER) +// ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...) +// ** +// ** In both cases, this function checks that there exists an entry with +// ** IPK value iKey and the second column set to iVal. +// ** +// */ +func _rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey Ti64, iVal Ti64) { + bp := tls.Alloc(48) + defer tls.Free(48) + var azSql [2]uintptr + var ii Ti64 + var pStmt, v1, v2 uintptr + var rc int32 + _, _, _, _, _, _ = azSql, ii, pStmt, rc, v1, v2 + azSql = [2]uintptr{ + 0: __ccgo_ts + 27506, + 1: __ccgo_ts + 27560, + } + if *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) = _rtreeCheckPrepare(tls, pCheck, azSql[bLeaf], libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + } + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc != SQLITE_OK { + return + } + pStmt = *(*uintptr)(unsafe.Pointer(pCheck + 40 + uintptr(bLeaf)*8)) + Xsqlite3_bind_int64(tls, pStmt, int32(1), iKey) + rc = Xsqlite3_step(tls, pStmt) + if rc == int32(SQLITE_DONE) { + if bLeaf != 0 { + v1 = __ccgo_ts + 27608 + } else { + v1 = __ccgo_ts + 27616 + } + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27625, libc.VaList(bp+8, iKey, iVal, v1)) + } else { + if rc == int32(SQLITE_ROW) { + ii = Xsqlite3_column_int64(tls, pStmt, 0) + if ii != iVal { + if bLeaf != 0 { + v2 = __ccgo_ts + 27608 + } else { + v2 = __ccgo_ts + 27616 + } + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27670, libc.VaList(bp+8, iKey, ii, v2, iKey, iVal)) + } + } + } + _rtreeCheckReset(tls, pCheck, pStmt) +} + +// C documentation +// +// /* +// ** Argument pCell points to an array of coordinates stored on an rtree page. +// ** This function checks that the coordinates are internally consistent (no +// ** x1>x2 conditions) and adds an error message to the RtreeCheck object +// ** if they are not. +// ** +// ** Additionally, if pParent is not NULL, then it is assumed to point to +// ** the array of coordinates on the parent page that bound the page +// ** containing pCell. In this case it is also verified that the two +// ** sets of coordinates are mutually consistent and an error message added +// ** to the RtreeCheck object if they are not. +// */ +func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32, pCell uintptr, pParent uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, v2, v3, v4 int32 + var v5 bool + var _ /* c1 at bp+0 */ TRtreeCoord + var _ /* c2 at bp+4 */ TRtreeCoord + var _ /* p1 at bp+8 */ TRtreeCoord + var _ /* p2 at bp+12 */ TRtreeCoord + _, _, _, _, _ = i, v2, v3, v4, v5 + i = 0 + for { + if !(i < (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim) { + break + } + _readCoord(tls, pCell+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp) + _readCoord(tls, pCell+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+4) + /* printf("%e, %e\n", c1.u.f, c2.u.f); */ + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + v2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) > *(*int32)(unsafe.Pointer(bp + 4))) + } else { + v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) + } + if v2 != 0 { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27728, libc.VaList(bp+24, i, iCell, iNode)) + } + if pParent != 0 { + _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) + _readCoord(tls, pParent+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+12) + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + v3 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) < *(*int32)(unsafe.Pointer(bp + 8))) + } else { + v3 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) < *(*TRtreeValue)(unsafe.Pointer(bp + 8))) + } + if v5 = v3 != 0; !v5 { + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + v4 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 4)) > *(*int32)(unsafe.Pointer(bp + 12))) + } else { + v4 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp + 4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 12))) + } + } + if v5 || v4 != 0 { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27776, libc.VaList(bp+24, i, iCell, iNode)) + } + } + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** Run rtreecheck() checks on node iNode, which is at depth iDepth within +// ** the r-tree structure. Argument aParent points to the array of coordinates +// ** that bound node iNode on the parent node. +// ** +// ** If any problems are discovered, an error message is appended to the +// ** report accumulated in the RtreeCheck object. +// */ +func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr, iNode Ti64) { + bp := tls.Alloc(48) + defer tls.Free(48) + var aNode, pCell uintptr + var i, nCell int32 + var iVal Ti64 + var _ /* nNode at bp+0 */ int32 + _, _, _, _, _ = aNode, i, iVal, nCell, pCell + aNode = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = 0 + aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) + if aNode != 0 { + if *(*int32)(unsafe.Pointer(bp)) < int32(4) { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27843, libc.VaList(bp+16, iNode, *(*int32)(unsafe.Pointer(bp)))) + } else { /* Used to iterate through cells */ + if aParent == uintptr(0) { + iDepth = _readInt16(tls, aNode) + if iDepth > int32(RTREE_MAX_DEPTH) { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27877, libc.VaList(bp+16, iDepth)) + Xsqlite3_free(tls, aNode) + return + } + } + nCell = _readInt16(tls, aNode+2) + if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > *(*int32)(unsafe.Pointer(bp)) { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27907, libc.VaList(bp+16, iNode, nCell, *(*int32)(unsafe.Pointer(bp)))) + } else { + i = 0 + for { + if !(i < nCell) { + break + } + pCell = aNode + uintptr(int32(4)+i*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4))) + iVal = _readInt64(tls, pCell) + _rtreeCheckCellCoord(tls, pCheck, iNode, i, pCell+8, aParent) + if iDepth > 0 { + _rtreeCheckMapping(tls, pCheck, 0, iVal, iNode) + _rtreeCheckNode(tls, pCheck, iDepth-int32(1), pCell+8, iVal) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf++ + } else { + _rtreeCheckMapping(tls, pCheck, int32(1), iVal, iNode) + (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf++ + } + goto _1 + _1: + ; + i++ + } + } + } + Xsqlite3_free(tls, aNode) + } +} + +// C documentation +// +// /* +// ** The second argument to this function must be either "_rowid" or +// ** "_parent". This function checks that the number of entries in the +// ** %_rowid or %_parent table is exactly nExpect. If not, it adds +// ** an error message to the report in the RtreeCheck object indicated +// ** by the first argument. +// */ +func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) { + bp := tls.Alloc(32) + defer tls.Free(32) + var nActual Ti64 + var pCount uintptr + _, _ = nActual, pCount + if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+27962, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + if pCount != 0 { + if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { + nActual = Xsqlite3_column_int64(tls, pCount, 0) + if nActual != nExpect { + _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+27993, libc.VaList(bp+8, zTbl, nExpect, nActual)) + } + } + (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) + } + } +} + +// C documentation +// +// /* +// ** This function does the bulk of the work for the rtree integrity-check. +// ** It is called by rtreecheck(), which is the SQL function implementation. +// */ +func _rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzReport uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var nAux, rc int32 + var pStmt uintptr + var _ /* check at bp+0 */ TRtreeCheck + _, _, _ = nAux, pStmt, rc /* Common context for various routines */ + pStmt = uintptr(0) /* Used to find column count of rtree table */ + nAux = 0 /* Number of extra columns. */ + /* Initialize the context object */ + libc.Xmemset(tls, bp, 0, uint64(88)) + (*(*TRtreeCheck)(unsafe.Pointer(bp))).Fdb = db + (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzDb = zDb + (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzTab = zTab + /* Find the number of auxiliary columns */ + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+28060, libc.VaList(bp+96, zDb, zTab)) + if pStmt != 0 { + nAux = Xsqlite3_column_count(tls, pStmt) - int32(2) + Xsqlite3_finalize(tls, pStmt) + } else { + if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc != int32(SQLITE_NOMEM) { + (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc = SQLITE_OK + } + } + /* Find number of dimensions in the rtree table. */ + pStmt = _rtreeCheckPrepare(tls, bp, __ccgo_ts+25874, libc.VaList(bp+96, zDb, zTab)) + if pStmt != 0 { + (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim = (Xsqlite3_column_count(tls, pStmt) - int32(1) - nAux) / int32(2) + if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim < int32(1) { + _rtreeCheckAppendMsg(tls, bp, __ccgo_ts+28088, 0) + } else { + if int32(SQLITE_ROW) == Xsqlite3_step(tls, pStmt) { + (*(*TRtreeCheck)(unsafe.Pointer(bp))).FbInt = libc.BoolInt32(Xsqlite3_column_type(tls, pStmt, int32(1)) == int32(SQLITE_INTEGER)) + } + } + rc = Xsqlite3_finalize(tls, pStmt) + if rc != int32(SQLITE_CORRUPT) { + (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc = rc + } + } + /* Do the actual integrity-check */ + if (*(*TRtreeCheck)(unsafe.Pointer(bp))).FnDim >= int32(1) { + if (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc == SQLITE_OK { + _rtreeCheckNode(tls, bp, 0, uintptr(0), int64(1)) + } + _rtreeCheckCount(tls, bp, __ccgo_ts+28119, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnLeaf)) + _rtreeCheckCount(tls, bp, __ccgo_ts+28126, int64((*(*TRtreeCheck)(unsafe.Pointer(bp))).FnNonLeaf)) + } + /* Finalize SQL statements used by the integrity-check */ + Xsqlite3_finalize(tls, (*(*TRtreeCheck)(unsafe.Pointer(bp))).FpGetNode) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 + 1*8))) + *(*uintptr)(unsafe.Pointer(pzReport)) = (*(*TRtreeCheck)(unsafe.Pointer(bp))).FzReport + return (*(*TRtreeCheck)(unsafe.Pointer(bp))).Frc +} + +// C documentation +// +// /* +// ** Implementation of the xIntegrity method for Rtree. +// */ +func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintptr, isQuick int32, pzErr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pRtree uintptr + var rc int32 + _, _ = pRtree, rc + pRtree = pVtab + _ = zSchema + _ = zName + _ = isQuick + rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) + if rc == SQLITE_OK && *(*uintptr)(unsafe.Pointer(pzErr)) != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+28134, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(pzErr)))) + if *(*uintptr)(unsafe.Pointer(pzErr)) == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + return rc +} + +// C documentation +// +// /* +// ** Usage: +// ** +// ** rtreecheck(); +// ** rtreecheck(, ); +// ** +// ** Invoking this SQL function runs an integrity-check on the named rtree +// ** table. The integrity-check verifies the following: +// ** +// ** 1. For each cell in the r-tree structure (%_node table), that: +// ** +// ** a) for each dimension, (coord1 <= coord2). +// ** +// ** b) unless the cell is on the root node, that the cell is bounded +// ** by the parent cell on the parent node. +// ** +// ** c) for leaf nodes, that there is an entry in the %_rowid +// ** table corresponding to the cell's rowid value that +// ** points to the correct node. +// ** +// ** d) for cells on non-leaf nodes, that there is an entry in the +// ** %_parent table mapping from the cell's child node to the +// ** node that it resides on. +// ** +// ** 2. That there are the same number of entries in the %_rowid table +// ** as there are leaf cells in the r-tree structure, and that there +// ** is a leaf cell that corresponds to each entry in the %_rowid table. +// ** +// ** 3. That there are the same number of entries in the %_parent table +// ** as there are non-leaf cells in the r-tree structure, and that +// ** there is a non-leaf cell that corresponds to each entry in the +// ** %_parent table. +// */ +func _rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var zDb, zTab, v1 uintptr + var _ /* zReport at bp+0 */ uintptr + _, _, _, _ = rc, zDb, zTab, v1 + if nArg != int32(1) && nArg != int32(2) { + Xsqlite3_result_error(tls, ctx, __ccgo_ts+28153, -int32(1)) + } else { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if nArg == int32(1) { + zTab = zDb + zDb = __ccgo_ts + 6617 + } else { + zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + } + rc = _rtreeCheckTable(tls, Xsqlite3_context_db_handle(tls, ctx), zDb, zTab, bp) + if rc == SQLITE_OK { + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + v1 = *(*uintptr)(unsafe.Pointer(bp)) + } else { + v1 = __ccgo_ts + 18493 + } + Xsqlite3_result_text(tls, ctx, v1, -int32(1), uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_error_code(tls, ctx, rc) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + } +} + +/* Conditionally include the geopoly code */ +/************** Include geopoly.c in the middle of rtree.c *******************/ +/************** Begin file geopoly.c *****************************************/ +/* +** 2018-05-25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file implements an alternative R-Tree virtual table that +** uses polygons to express the boundaries of 2-dimensional objects. +** +** This file is #include-ed onto the end of "rtree.c" so that it has +** access to all of the R-Tree internals. + */ +/* #include */ + +/* Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities */ + +/* Character class routines */ +/* Use the SQLite core versions if this routine is part of the + ** SQLite amalgamation */ + +// C documentation +// +// /* +// ** Growing our own isspace() routine this way is twice as fast as +// ** the library isspace() function. +// */ +var _geopolyIsSpace = [256]int8{ + 9: int8(1), + 10: int8(1), + 13: int8(1), + 32: int8(1), +} + +/* Compiler and version */ + +// C documentation +// +// /* Datatype for coordinates +// */ +type TGeoCoord = float32 + +type GeoCoord = TGeoCoord + +// C documentation +// +// /* +// ** Internal representation of a polygon. +// ** +// ** The polygon consists of a sequence of vertexes. There is a line +// ** segment between each pair of vertexes, and one final segment from +// ** the last vertex back to the first. (This differs from the GeoJSON +// ** standard in which the final vertex is a repeat of the first.) +// ** +// ** The polygon follows the right-hand rule. The area to the right of +// ** each segment is "outside" and the area to the left is "inside". +// ** +// ** The on-disk representation consists of a 4-byte header followed by +// ** the values. The 4-byte header is: +// ** +// ** encoding (1 byte) 0=big-endian, 1=little-endian +// ** nvertex (3 bytes) Number of vertexes as a big-endian integer +// ** +// ** Enough space is allocated for 4 coordinates, to work around over-zealous +// ** warnings coming from some compiler (notably, clang). In reality, the size +// ** of each GeoPoly memory allocate is adjusted as necessary so that the +// ** GeoPoly.a[] array at the end is the appropriate size. +// */ +type TGeoPoly = struct { + FnVertex int32 + Fhdr [4]uint8 + Fa [8]TGeoCoord +} + +type GeoPoly = TGeoPoly + +type TGeoPoly1 = struct { + FnVertex int32 + Fhdr [4]uint8 + Fa [8]TGeoCoord +} + +type GeoPoly1 = TGeoPoly1 + +/* The size of a memory allocation needed for a GeoPoly object sufficient +** to hold N coordinate pairs. + */ + +/* Macros to access coordinates of a GeoPoly. +** We have to use these macros, rather than just say p->a[i] in order +** to silence (incorrect) UBSAN warnings if the array index is too large. + */ + +// C documentation +// +// /* +// ** State of a parse of a GeoJSON input. +// */ +type TGeoParse = struct { + Fz uintptr + FnVertex int32 + FnAlloc int32 + FnErr int32 + Fa uintptr +} + +type GeoParse = TGeoParse + +type TGeoParse1 = struct { + Fz uintptr + FnVertex int32 + FnAlloc int32 + FnErr int32 + Fa uintptr +} + +type GeoParse1 = TGeoParse1 + +// C documentation +// +// /* Do a 4-byte byte swap */ +func _geopolySwab32(tls *libc.TLS, a uintptr) { + var t uint8 + _ = t + t = *(*uint8)(unsafe.Pointer(a)) + *(*uint8)(unsafe.Pointer(a)) = *(*uint8)(unsafe.Pointer(a + 3)) + *(*uint8)(unsafe.Pointer(a + 3)) = t + t = *(*uint8)(unsafe.Pointer(a + 1)) + *(*uint8)(unsafe.Pointer(a + 1)) = *(*uint8)(unsafe.Pointer(a + 2)) + *(*uint8)(unsafe.Pointer(a + 2)) = t +} + +// C documentation +// +// /* Skip whitespace. Return the next non-whitespace character. */ +func _geopolySkipSpace(tls *libc.TLS, p uintptr) (r int8) { + for _geopolyIsSpace[*(*uint8)(unsafe.Pointer((*TGeoParse)(unsafe.Pointer(p)).Fz))] != 0 { + (*TGeoParse)(unsafe.Pointer(p)).Fz++ + } + return int8(*(*uint8)(unsafe.Pointer((*TGeoParse)(unsafe.Pointer(p)).Fz))) +} + +// C documentation +// +// /* Parse out a number. Write the value into *pVal if pVal!=0. +// ** return non-zero on success and zero if the next token is not a number. +// */ +func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c int8 + var j, seenDP, seenE, v2 int32 + var z uintptr + var _ /* r at bp+0 */ float64 + _, _, _, _, _, _ = c, j, seenDP, seenE, z, v2 + c = _geopolySkipSpace(tls, p) + z = (*TGeoParse)(unsafe.Pointer(p)).Fz + j = 0 + seenDP = 0 + seenE = 0 + if int32(c) == int32('-') { + j = int32(1) + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j)))) + } + if int32(c) == int32('0') && int32(*(*uint8)(unsafe.Pointer(z + uintptr(j+int32(1))))) >= int32('0') && int32(*(*uint8)(unsafe.Pointer(z + uintptr(j+int32(1))))) <= int32('9') { + return 0 + } + for { + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j)))) + if int32(_sqlite3CtypeMap[uint8(c)])&int32(0x04) != 0 { + goto _1 + } + if int32(c) == int32('.') { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) == int32('-') { + return 0 + } + if seenDP != 0 { + return 0 + } + seenDP = int32(1) + goto _1 + } + if int32(c) == int32('e') || int32(c) == int32('E') { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { + return 0 + } + if seenE != 0 { + return -int32(1) + } + v2 = libc.Int32FromInt32(1) + seenE = v2 + seenDP = v2 + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j+int32(1))))) + if int32(c) == int32('+') || int32(c) == int32('-') { + j++ + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j+int32(1))))) + } + if int32(c) < int32('0') || int32(c) > int32('9') { + return 0 + } + goto _1 + } + break + goto _1 + _1: + ; + j++ + } + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(j-int32(1))))) < int32('0') { + return 0 + } + if pVal != 0 { + _sqlite3AtoF(tls, (*TGeoParse)(unsafe.Pointer(p)).Fz, bp, j, uint8(SQLITE_UTF8)) + *(*TGeoCoord)(unsafe.Pointer(pVal)) = float32(*(*float64)(unsafe.Pointer(bp))) + } + *(*uintptr)(unsafe.Pointer(p)) += uintptr(j) + return int32(1) +} + +// C documentation +// +// /* +// ** If the input is a well-formed JSON array of coordinates with at least +// ** four coordinates and where each coordinate is itself a two-value array, +// ** then convert the JSON into a GeoPoly object and return a pointer to +// ** that object. +// ** +// ** If any error occurs, return NULL. +// */ +func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var aNew, pOut, v1 uintptr + var c int8 + var ii, rc int32 + var v2 bool + var _ /* s at bp+0 */ TGeoParse + var _ /* x at bp+32 */ int32 + _, _, _, _, _, _, _ = aNew, c, ii, pOut, rc, v1, v2 + rc = SQLITE_OK + libc.Xmemset(tls, bp, 0, uint64(32)) + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz = z + if int32(_geopolySkipSpace(tls, bp)) == int32('[') { + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ + for int32(_geopolySkipSpace(tls, bp)) == int32('[') { + ii = 0 + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ + if (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex >= (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc { + (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc = (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc*int32(2) + int32(16) + aNew = Xsqlite3_realloc64(tls, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa, uint64((*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc)*uint64(4)*uint64(2)) + if aNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + (*(*TGeoParse)(unsafe.Pointer(bp))).FnErr++ + break + } + (*(*TGeoParse)(unsafe.Pointer(bp))).Fa = aNew + } + for { + if ii <= int32(1) { + v1 = (*(*TGeoParse)(unsafe.Pointer(bp))).Fa + uintptr((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex*int32(2)+ii)*4 + } else { + v1 = uintptr(0) + } + if !(_geopolyParseNumber(tls, bp, v1) != 0) { + break + } + ii++ + if ii == int32(2) { + (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex++ + } + c = _geopolySkipSpace(tls, bp) + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ + if int32(c) == int32(',') { + continue + } + if int32(c) == int32(']') && ii >= int32(2) { + break + } + (*(*TGeoParse)(unsafe.Pointer(bp))).FnErr++ + rc = int32(SQLITE_ERROR) + goto parse_json_err + } + if int32(_geopolySkipSpace(tls, bp)) == int32(',') { + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ + continue + } + break + } + if v2 = int32(_geopolySkipSpace(tls, bp)) == int32(']') && (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex >= int32(4) && *(*TGeoCoord)(unsafe.Pointer((*(*TGeoParse)(unsafe.Pointer(bp))).Fa)) == *(*TGeoCoord)(unsafe.Pointer((*(*TGeoParse)(unsafe.Pointer(bp))).Fa + uintptr((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex*int32(2)-int32(2))*4)) && *(*TGeoCoord)(unsafe.Pointer((*(*TGeoParse)(unsafe.Pointer(bp))).Fa + 1*4)) == *(*TGeoCoord)(unsafe.Pointer((*(*TGeoParse)(unsafe.Pointer(bp))).Fa + uintptr((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex*int32(2)-int32(1))*4)); v2 { + (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ + } + if v2 && int32(_geopolySkipSpace(tls, bp)) == libc.Int32FromInt32(0) { + *(*int32)(unsafe.Pointer(bp + 32)) = int32(1) + (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex-- /* Remove the redundant vertex at the end */ + pOut = Xsqlite3_malloc64(tls, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(int64((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex)-libc.Int64FromInt32(4))) + *(*int32)(unsafe.Pointer(bp + 32)) = int32(1) + if pOut == uintptr(0) { + goto parse_json_err + } + (*TGeoPoly)(unsafe.Pointer(pOut)).FnVertex = (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex + libc.Xmemcpy(tls, pOut+8, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa, uint64((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex*int32(2))*uint64(4)) + *(*uint8)(unsafe.Pointer(pOut + 4)) = *(*uint8)(unsafe.Pointer(bp + 32)) + *(*uint8)(unsafe.Pointer(pOut + 4 + 1)) = uint8((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex >> int32(16) & int32(0xff)) + *(*uint8)(unsafe.Pointer(pOut + 4 + 2)) = uint8((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex >> int32(8) & int32(0xff)) + *(*uint8)(unsafe.Pointer(pOut + 4 + 3)) = uint8((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex & int32(0xff)) + Xsqlite3_free(tls, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa) + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK + } + return pOut + } else { + (*(*TGeoParse)(unsafe.Pointer(bp))).FnErr++ + rc = int32(SQLITE_ERROR) + } + } +parse_json_err: + ; + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = rc + } + Xsqlite3_free(tls, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa) + return uintptr(0) +} + +// C documentation +// +// /* +// ** Given a function parameter, try to interpret it as a polygon, either +// ** in the binary format or JSON text. Compute a GeoPoly object and +// ** return a pointer to that object. Or if the input is not a well-formed +// ** polygon, put an error message in sqlite3_context and return NULL. +// */ +func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, p, zJson, p4 uintptr + var ii, nByte, nVertex, v1 int32 + var v2 bool + var _ /* x at bp+0 */ int32 + _, _, _, _, _, _, _, _, _ = a, ii, nByte, nVertex, p, zJson, v1, v2, p4 + p = uintptr(0) + if v2 = Xsqlite3_value_type(tls, pVal) == int32(SQLITE_BLOB); v2 { + v1 = Xsqlite3_value_bytes(tls, pVal) + nByte = v1 + } + if v2 && v1 >= int32(libc.Uint64FromInt32(4)+libc.Uint64FromInt32(6)*libc.Uint64FromInt64(4)) { + a = Xsqlite3_value_blob(tls, pVal) + if a == uintptr(0) { + if pCtx != 0 { + Xsqlite3_result_error_nomem(tls, pCtx) + } + return uintptr(0) + } + nVertex = int32(*(*uint8)(unsafe.Pointer(a + 1)))<. +// ** Additional arguments are added as attributes to the . +// */ +func _geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var cSep int8 + var db, p, x, z uintptr + var i int32 + _, _, _, _, _, _ = cSep, db, i, p, x, z + if argc < int32(1) { + return + } + p = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + db = Xsqlite3_context_db_handle(tls, context) + x = Xsqlite3_str_new(tls, db) + cSep = int8('\'') + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28226, 0) + i = 0 + for { + if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { + break + } + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28244, libc.VaList(bp+8, int32(cSep), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) + cSep = int8(' ') + goto _1 + _1: + ; + i++ + } + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28252, libc.VaList(bp+8, float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) + i = int32(1) + for { + if !(i < argc) { + break + } + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28260, libc.VaList(bp+8, z)) + } + goto _2 + _2: + ; + i++ + } + Xsqlite3_str_appendf(tls, x, __ccgo_ts+28264, 0) + Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** SQL Function: geopoly_xform(poly, A, B, C, D, E, F) +// ** +// ** Transform and/or translate a polygon as follows: +// ** +// ** x1 = A*x0 + B*y0 + E +// ** y1 = C*x0 + D*y0 + F +// ** +// ** For a translation: +// ** +// ** geopoly_xform(poly, 1, 0, 0, 1, x-offset, y-offset) +// ** +// ** Rotate by R around the point (0,0): +// ** +// ** geopoly_xform(poly, cos(R), sin(R), -sin(R), cos(R), 0, 0) +// */ +func _geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var A, B, C, D, E, F float64 + var ii int32 + var p uintptr + var x0, x1, y0, y1 TGeoCoord + _, _, _, _, _, _, _, _, _, _, _, _ = A, B, C, D, E, F, ii, p, x0, x1, y0, y1 + p = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + A = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + B = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + C = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + D = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + E = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + F = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + _ = argc + if p != 0 { + ii = 0 + for { + if !(ii < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { + break + } + x0 = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4)) + y0 = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) + x1 = float32(A*float64(x0) + B*float64(y0) + E) + y1 = float32(C*float64(x0) + D*float64(y0) + F) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4)) = x1 + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = y1 + goto _1 + _1: + ; + ii++ + } + Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Compute the area enclosed by the polygon. +// ** +// ** This routine can also be used to detect polygons that rotate in +// ** the wrong direction. Polygons are suppose to be counter-clockwise (CCW). +// ** This routine returns a negative value for clockwise (CW) polygons. +// */ +func _geopolyArea(tls *libc.TLS, p uintptr) (r float64) { + var ii int32 + var rArea float64 + _, _ = ii, rArea + rArea = float64(0) + ii = 0 + for { + if !(ii < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex-int32(1)) { + break + } + rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) * float64(0.5) + goto _1 + _1: + ; + ii++ + } + rArea += float64((*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4))-*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)))*(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4))+*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) * float64(0.5) + return rArea +} + +// C documentation +// +// /* +// ** Implementation of the geopoly_area(X) function. +// ** +// ** If the input is a well-formed Geopoly BLOB then return the area +// ** enclosed by the polygon. If the polygon circulates clockwise instead +// ** of counterclockwise (as it should) then return the negative of the +// ** enclosed area. Otherwise return NULL. +// */ +func _geopolyAreaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var p uintptr + _ = p + p = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + _ = argc + if p != 0 { + Xsqlite3_result_double(tls, context, _geopolyArea(tls, p)) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Implementation of the geopoly_ccw(X) function. +// ** +// ** If the rotation of polygon X is clockwise (incorrect) instead of +// ** counter-clockwise (the correct winding order according to RFC7946) +// ** then reverse the order of the vertexes in polygon X. +// ** +// ** In other words, this routine returns a CCW polygon regardless of the +// ** winding order of its input. +// ** +// ** Use this routine to sanitize historical inputs that that sometimes +// ** contain polygons that wind in the wrong direction. +// */ +func _geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var ii, jj int32 + var p uintptr + var t TGeoCoord + _, _, _, _ = ii, jj, p, t + p = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + _ = argc + if p != 0 { + if _geopolyArea(tls, p) < float64(0) { + ii = int32(1) + jj = (*TGeoPoly)(unsafe.Pointer(p)).FnVertex - libc.Int32FromInt32(1) + for { + if !(ii < jj) { + break + } + t = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4)) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2))*4)) = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2))*4)) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2))*4)) = t + t = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(ii*int32(2)+int32(1))*4)) = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(jj*int32(2)+int32(1))*4)) = t + goto _1 + _1: + ; + ii++ + jj-- + } + } + Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* Fast approximation for sine(X) for X between -0.5*pi and 2*pi +// */ +func _geopolySine(tls *libc.TLS, r float64) (r1 float64) { + var r2, r3, r5 float64 + _, _, _ = r2, r3, r5 + if r >= libc.Float64FromFloat64(1.5)*libc.Float64FromFloat64(3.141592653589793) { + r -= libc.Float64FromFloat64(2) * libc.Float64FromFloat64(3.141592653589793) + } + if r >= libc.Float64FromFloat64(0.5)*libc.Float64FromFloat64(3.141592653589793) { + return -_geopolySine(tls, r-float64(3.141592653589793)) + } else { + r2 = r * r + r3 = r2 * r + r5 = r3 * r2 + return float64(0.9996949)*r - float64(0.16567)*r3 + float64(0.0075134)*r5 + } + return r1 +} + +// C documentation +// +// /* +// ** Function: geopoly_regular(X,Y,R,N) +// ** +// ** Construct a simple, convex, regular polygon centered at X, Y +// ** with circumradius R and with N sides. +// */ +func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var n int32 + var p uintptr + var r, rAngle, x, y float64 + var _ /* i at bp+0 */ int32 + _, _, _, _, _, _ = n, p, r, rAngle, x, y + x = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + y = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + r = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + n = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + _ = argc + if n < int32(3) || r <= float64(0) { + return + } + if n > int32(1000) { + n = int32(1000) + } + p = Xsqlite3_malloc64(tls, uint64(40)+uint64((n-int32(1))*int32(2))*uint64(4)) + if p == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + *(*int32)(unsafe.Pointer(bp)) = int32(1) + *(*uint8)(unsafe.Pointer(p + 4)) = *(*uint8)(unsafe.Pointer(bp)) + *(*uint8)(unsafe.Pointer(p + 4 + 1)) = uint8(0) + *(*uint8)(unsafe.Pointer(p + 4 + 2)) = uint8(n >> int32(8) & int32(0xff)) + *(*uint8)(unsafe.Pointer(p + 4 + 3)) = uint8(n & int32(0xff)) + *(*int32)(unsafe.Pointer(bp)) = 0 + for { + if !(*(*int32)(unsafe.Pointer(bp)) < n) { + break + } + rAngle = libc.Float64FromFloat64(2) * libc.Float64FromFloat64(3.141592653589793) * float64(*(*int32)(unsafe.Pointer(bp))) / float64(n) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2))*4)) = float32(x - r*_geopolySine(tls, rAngle-libc.Float64FromFloat64(0.5)*libc.Float64FromFloat64(3.141592653589793))) + *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4)) = float32(y + r*_geopolySine(tls, rAngle)) + goto _1 + _1: + ; + *(*int32)(unsafe.Pointer(bp))++ + } + Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** If pPoly is a polygon, compute its bounding box. Then: +// ** +// ** (1) if aCoord!=0 store the bounding box in aCoord, returning NULL +// ** (2) otherwise, compute a GeoPoly for the bounding box and return the +// ** new GeoPoly +// ** +// ** If pPoly is NULL but aCoord is not NULL, then compute a new GeoPoly from +// ** the bounding box in aCoord and return a pointer to that GeoPoly. +// */ +func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, pRc uintptr) (r1 uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var mnX, mnY, mxX, mxY, v3, v4 float32 + var p, pOut uintptr + var r float64 + var _ /* ii at bp+0 */ int32 + _, _, _, _, _, _, _, _, _ = mnX, mnY, mxX, mxY, p, pOut, r, v3, v4 + pOut = uintptr(0) + if pPoly == uintptr(0) && aCoord != uintptr(0) { + p = uintptr(0) + mnX = *(*TRtreeValue)(unsafe.Pointer(aCoord)) + mxX = *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) + mnY = *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) + mxY = *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) + goto geopolyBboxFill + } else { + p = _geopolyFuncParam(tls, context, pPoly, pRc) + } + if !(p != 0) { + goto _1 + } + v3 = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)) + mxX = v3 + mnX = v3 + v4 = *(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) + mxY = v4 + mnY = v4 + *(*int32)(unsafe.Pointer(bp)) = int32(1) + for { + if !(*(*int32)(unsafe.Pointer(bp)) < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { + break + } + r = float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2))*4))) + if r < float64(mnX) { + mnX = float32(r) + } else { + if r > float64(mxX) { + mxX = float32(r) + } + } + r = float64(*(*TGeoCoord)(unsafe.Pointer(p + 8 + uintptr(*(*int32)(unsafe.Pointer(bp))*int32(2)+int32(1))*4))) + if r < float64(mnY) { + mnY = float32(r) + } else { + if r > float64(mxY) { + mxY = float32(r) + } + } + goto _5 + _5: + ; + *(*int32)(unsafe.Pointer(bp))++ + } + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK + } + if !(aCoord == uintptr(0)) { + goto _6 + } +geopolyBboxFill: + ; + pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*uint64(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) + if pOut == uintptr(0) { + Xsqlite3_free(tls, p) + if context != 0 { + Xsqlite3_result_error_nomem(tls, context) + } + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + return uintptr(0) + } + (*TGeoPoly)(unsafe.Pointer(pOut)).FnVertex = int32(4) + *(*int32)(unsafe.Pointer(bp)) = int32(1) + *(*uint8)(unsafe.Pointer(pOut + 4)) = *(*uint8)(unsafe.Pointer(bp)) + *(*uint8)(unsafe.Pointer(pOut + 4 + 1)) = uint8(0) + *(*uint8)(unsafe.Pointer(pOut + 4 + 2)) = uint8(0) + *(*uint8)(unsafe.Pointer(pOut + 4 + 3)) = uint8(4) + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4)) = mnX + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mnY + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))*4)) = mxX + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mnY + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))*4)) = mxX + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2))*4)) = mnX + *(*TGeoCoord)(unsafe.Pointer(pOut + 8 + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)) = mxY + goto _7 +_6: + ; + Xsqlite3_free(tls, p) + *(*TRtreeValue)(unsafe.Pointer(aCoord)) = mnX + *(*TRtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX + *(*TRtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY + *(*TRtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY +_7: + ; + goto _2 +_1: + ; + if aCoord != 0 { + libc.Xmemset(tls, aCoord, 0, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) + } +_2: + ; + return pOut +} + +// C documentation +// +// /* +// ** Implementation of the geopoly_bbox(X) SQL function. +// */ +func _geopolyBBoxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var p uintptr + _ = p + p = _geopolyBBox(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0), uintptr(0)) + _ = argc + if p != 0 { + Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** State vector for the geopoly_group_bbox() aggregate function. +// */ +type TGeoBBox = struct { + FisInit int32 + Fa [4]TRtreeCoord +} + +type GeoBBox = TGeoBBox + +type TGeoBBox1 = struct { + FisInit int32 + Fa [4]TRtreeCoord +} + +type GeoBBox1 = TGeoBBox1 + +// C documentation +// +// /* +// ** Implementation of the geopoly_group_bbox(X) aggregate SQL function. +// */ +func _geopolyBBoxStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pBBox uintptr + var _ /* a at bp+0 */ [4]TRtreeCoord + var _ /* rc at bp+16 */ int32 + _ = pBBox + *(*int32)(unsafe.Pointer(bp + 16)) = SQLITE_OK + _ = argc + _geopolyBBox(tls, context, *(*uintptr)(unsafe.Pointer(argv)), bp, bp+16) + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + pBBox = Xsqlite3_aggregate_context(tls, context, int32(20)) + if pBBox == uintptr(0) { + return + } + if (*TGeoBBox)(unsafe.Pointer(pBBox)).FisInit == 0 { + (*TGeoBBox)(unsafe.Pointer(pBBox)).FisInit = int32(1) + libc.Xmemcpy(tls, pBBox+4, bp, libc.Uint64FromInt64(4)*libc.Uint64FromInt32(4)) + } else { + if *(*TRtreeValue)(unsafe.Pointer(bp)) < *(*TRtreeValue)(unsafe.Pointer(pBBox + 4)) { + *(*TRtreeCoord)(unsafe.Pointer(pBBox + 4)) = (*(*[4]TRtreeCoord)(unsafe.Pointer(bp)))[0] + } + if *(*TRtreeValue)(unsafe.Pointer(bp + 1*4)) > *(*TRtreeValue)(unsafe.Pointer(pBBox + 4 + 1*4)) { + *(*TRtreeCoord)(unsafe.Pointer(pBBox + 4 + 1*4)) = (*(*[4]TRtreeCoord)(unsafe.Pointer(bp)))[int32(1)] + } + if *(*TRtreeValue)(unsafe.Pointer(bp + 2*4)) < *(*TRtreeValue)(unsafe.Pointer(pBBox + 4 + 2*4)) { + *(*TRtreeCoord)(unsafe.Pointer(pBBox + 4 + 2*4)) = (*(*[4]TRtreeCoord)(unsafe.Pointer(bp)))[int32(2)] + } + if *(*TRtreeValue)(unsafe.Pointer(bp + 3*4)) > *(*TRtreeValue)(unsafe.Pointer(pBBox + 4 + 3*4)) { + *(*TRtreeCoord)(unsafe.Pointer(pBBox + 4 + 3*4)) = (*(*[4]TRtreeCoord)(unsafe.Pointer(bp)))[int32(3)] + } + } + } +} + +func _geopolyBBoxFinal(tls *libc.TLS, context uintptr) { + var p, pBBox uintptr + _, _ = p, pBBox + pBBox = Xsqlite3_aggregate_context(tls, context, 0) + if pBBox == uintptr(0) { + return + } + p = _geopolyBBox(tls, context, uintptr(0), pBBox+4, uintptr(0)) + if p != 0 { + Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Determine if point (x0,y0) is beneath line segment (x1,y1)->(x2,y2). +// ** Returns: +// ** +// ** +2 x0,y0 is on the line segement +// ** +// ** +1 x0,y0 is beneath line segment +// ** +// ** 0 x0,y0 is not on or beneath the line segment or the line segment +// ** is vertical and x0,y0 is not on the line segment +// ** +// ** The left-most coordinate min(x1,x2) is not considered to be part of +// ** the line segment for the purposes of this analysis. +// */ +func _pointBeneathLine(tls *libc.TLS, x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64) (r int32) { + var y float64 + _ = y + if x0 == x1 && y0 == y1 { + return int32(2) + } + if x1 < x2 { + if x0 <= x1 || x0 > x2 { + return 0 + } + } else { + if x1 > x2 { + if x0 <= x2 || x0 > x1 { + return 0 + } + } else { + /* Vertical line segment */ + if x0 != x1 { + return 0 + } + if y0 < y1 && y0 < y2 { + return 0 + } + if y0 > y1 && y0 > y2 { + return 0 + } + return int32(2) + } + } + y = y1 + (y2-y1)*(x0-x1)/(x2-x1) + if y0 == y { + return int32(2) + } + if y0 < y { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** SQL function: geopoly_contains_point(P,X,Y) +// ** +// ** Return +2 if point X,Y is within polygon P. +// ** Return +1 if point X,Y is on the polygon boundary. +// ** Return 0 if point X,Y is outside the polygon +// */ +func _geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var cnt, ii, v int32 + var p1 uintptr + var x0, y0 float64 + _, _, _, _, _, _ = cnt, ii, p1, v, x0, y0 + p1 = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + x0 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + y0 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + v = 0 + cnt = 0 + _ = argc + if p1 == uintptr(0) { + return + } + ii = 0 + for { + if !(ii < (*TGeoPoly)(unsafe.Pointer(p1)).FnVertex-int32(1)) { + break + } + v = _pointBeneathLine(tls, x0, y0, float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(ii*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(ii*int32(2)+int32(1))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr((ii+int32(1))*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr((ii+int32(1))*int32(2)+int32(1))*4)))) + if v == int32(2) { + break + } + cnt += v + goto _1 + _1: + ; + ii++ + } + if v != int32(2) { + v = _pointBeneathLine(tls, x0, y0, float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(ii*int32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(ii*int32(2)+int32(1))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(*(*TGeoCoord)(unsafe.Pointer(p1 + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))) + } + if v == int32(2) { + Xsqlite3_result_int(tls, context, int32(1)) + } else { + if (v+cnt)&int32(1) == 0 { + Xsqlite3_result_int(tls, context, 0) + } else { + Xsqlite3_result_int(tls, context, int32(2)) + } + } + Xsqlite3_free(tls, p1) +} + +// C documentation +// +// /* +// ** SQL function: geopoly_within(P1,P2) +// ** +// ** Return +2 if P1 and P2 are the same polygon +// ** Return +1 if P2 is contained within P1 +// ** Return 0 if any part of P2 is on the outside of P1 +// ** +// */ +func _geopolyWithinFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var p1, p2 uintptr + var x, v1, v2 int32 + _, _, _, _, _ = p1, p2, x, v1, v2 + p1 = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + p2 = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uintptr(0)) + _ = argc + if p1 != 0 && p2 != 0 { + x = _geopolyOverlap(tls, p1, p2) + if x < 0 { + Xsqlite3_result_error_nomem(tls, context) + } else { + if x == int32(2) { + v1 = int32(1) + } else { + if x == int32(4) { + v2 = int32(2) + } else { + v2 = 0 + } + v1 = v2 + } + Xsqlite3_result_int(tls, context, v1) + } + } + Xsqlite3_free(tls, p1) + Xsqlite3_free(tls, p2) +} + +// C documentation +// +// /* Objects used by the overlap algorihm. */ +type TGeoEvent = struct { + Fx float64 + FeType int32 + FpSeg uintptr + FpNext uintptr +} + +type GeoEvent = TGeoEvent + +type TGeoSegment = struct { + FC float64 + FB float64 + Fy float64 + Fy0 float32 + Fside uint8 + Fidx uint32 + FpNext uintptr +} + +type GeoSegment = TGeoSegment + +type TGeoOverlap = struct { + FaEvent uintptr + FaSegment uintptr + FnEvent int32 + FnSegment int32 +} + +type GeoOverlap = TGeoOverlap + +type TGeoEvent1 = struct { + Fx float64 + FeType int32 + FpSeg uintptr + FpNext uintptr +} + +type GeoEvent1 = TGeoEvent1 + +type TGeoSegment1 = struct { + FC float64 + FB float64 + Fy float64 + Fy0 float32 + Fside uint8 + Fidx uint32 + FpNext uintptr +} + +type GeoSegment1 = TGeoSegment1 + +type TGeoOverlap1 = struct { + FaEvent uintptr + FaSegment uintptr + FnEvent int32 + FnSegment int32 +} + +type GeoOverlap1 = TGeoOverlap1 + +// C documentation +// +// /* +// ** Add a single segment and its associated events. +// */ +func _geopolyAddOneSegment(tls *libc.TLS, p uintptr, x0 TGeoCoord, y0 TGeoCoord, x1 TGeoCoord, y1 TGeoCoord, side uint8, idx uint32) { + var pEvent, pSeg uintptr + var t TGeoCoord + _, _, _ = pEvent, pSeg, t + if x0 == x1 { + return + } /* Ignore vertical segments */ + if x0 > x1 { + t = x0 + x0 = x1 + x1 = t + t = y0 + y0 = y1 + y1 = t + } + pSeg = (*TGeoOverlap)(unsafe.Pointer(p)).FaSegment + uintptr((*TGeoOverlap)(unsafe.Pointer(p)).FnSegment)*48 + (*TGeoOverlap)(unsafe.Pointer(p)).FnSegment++ + (*TGeoSegment)(unsafe.Pointer(pSeg)).FC = float64((y1 - y0) / (x1 - x0)) + (*TGeoSegment)(unsafe.Pointer(pSeg)).FB = float64(y1) - float64(x1)*(*TGeoSegment)(unsafe.Pointer(pSeg)).FC + (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy0 = y0 + (*TGeoSegment)(unsafe.Pointer(pSeg)).Fside = side + (*TGeoSegment)(unsafe.Pointer(pSeg)).Fidx = idx + pEvent = (*TGeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*TGeoOverlap)(unsafe.Pointer(p)).FnEvent)*32 + (*TGeoOverlap)(unsafe.Pointer(p)).FnEvent++ + (*TGeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x0) + (*TGeoEvent)(unsafe.Pointer(pEvent)).FeType = 0 + (*TGeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg + pEvent = (*TGeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*TGeoOverlap)(unsafe.Pointer(p)).FnEvent)*32 + (*TGeoOverlap)(unsafe.Pointer(p)).FnEvent++ + (*TGeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x1) + (*TGeoEvent)(unsafe.Pointer(pEvent)).FeType = int32(1) + (*TGeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg +} + +// C documentation +// +// /* +// ** Insert all segments and events for polygon pPoly. +// */ +func _geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { + var i uint32 + var x uintptr + _, _ = i, x + i = uint32(0) + for { + if !(i < uint32((*TGeoPoly)(unsafe.Pointer(pPoly)).FnVertex)-uint32(1)) { + break + } + x = pPoly + 8 + uintptr(i*uint32(2))*4 + _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(x + 2*4)), *(*TGeoCoord)(unsafe.Pointer(x + 3*4)), side, i) + goto _1 + _1: + ; + i++ + } + x = pPoly + 8 + uintptr(i*uint32(2))*4 + _geopolyAddOneSegment(tls, p, *(*TGeoCoord)(unsafe.Pointer(x)), *(*TGeoCoord)(unsafe.Pointer(x + 1*4)), *(*TGeoCoord)(unsafe.Pointer(pPoly + 8)), *(*TGeoCoord)(unsafe.Pointer(pPoly + 8 + 1*4)), side, i) +} + +// C documentation +// +// /* +// ** Merge two lists of sorted events by X coordinate +// */ +func _geopolyEventMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pLast, v1 uintptr + var _ /* head at bp+0 */ TGeoEvent + _, _ = pLast, v1 + (*(*TGeoEvent)(unsafe.Pointer(bp))).FpNext = uintptr(0) + pLast = bp + for pRight != 0 && pLeft != 0 { + if (*TGeoEvent)(unsafe.Pointer(pRight)).Fx <= (*TGeoEvent)(unsafe.Pointer(pLeft)).Fx { + (*TGeoEvent)(unsafe.Pointer(pLast)).FpNext = pRight + pLast = pRight + pRight = (*TGeoEvent)(unsafe.Pointer(pRight)).FpNext + } else { + (*TGeoEvent)(unsafe.Pointer(pLast)).FpNext = pLeft + pLast = pLeft + pLeft = (*TGeoEvent)(unsafe.Pointer(pLeft)).FpNext + } + } + if pRight != 0 { + v1 = pRight + } else { + v1 = pLeft + } + (*TGeoEvent)(unsafe.Pointer(pLast)).FpNext = v1 + return (*(*TGeoEvent)(unsafe.Pointer(bp))).FpNext +} + +// C documentation +// +// /* +// ** Sort an array of nEvent event objects into a list. +// */ +func _geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) (r uintptr) { + var a [50]uintptr + var i, j, mx int32 + var p uintptr + _, _, _, _, _ = a, i, j, mx, p + mx = 0 + i = 0 + for { + if !(i < nEvent) { + break + } + p = aEvent + uintptr(i)*32 + (*TGeoEvent)(unsafe.Pointer(p)).FpNext = uintptr(0) + j = 0 + for { + if !(j < mx && a[j] != 0) { + break + } + p = _geopolyEventMerge(tls, a[j], p) + a[j] = uintptr(0) + goto _2 + _2: + ; + j++ + } + a[j] = p + if j >= mx { + mx = j + int32(1) + } + goto _1 + _1: + ; + i++ + } + p = uintptr(0) + i = 0 + for { + if !(i < mx) { + break + } + p = _geopolyEventMerge(tls, a[i], p) + goto _3 + _3: + ; + i++ + } + return p +} + +// C documentation +// +// /* +// ** Merge two lists of sorted segments by Y, and then by C. +// */ +func _geopolySegmentMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) (r1 uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var pLast, v1 uintptr + var r float64 + var _ /* head at bp+0 */ TGeoSegment + _, _, _ = pLast, r, v1 + (*(*TGeoSegment)(unsafe.Pointer(bp))).FpNext = uintptr(0) + pLast = bp + for pRight != 0 && pLeft != 0 { + r = (*TGeoSegment)(unsafe.Pointer(pRight)).Fy - (*TGeoSegment)(unsafe.Pointer(pLeft)).Fy + if r == float64(0) { + r = (*TGeoSegment)(unsafe.Pointer(pRight)).FC - (*TGeoSegment)(unsafe.Pointer(pLeft)).FC + } + if r < float64(0) { + (*TGeoSegment)(unsafe.Pointer(pLast)).FpNext = pRight + pLast = pRight + pRight = (*TGeoSegment)(unsafe.Pointer(pRight)).FpNext + } else { + (*TGeoSegment)(unsafe.Pointer(pLast)).FpNext = pLeft + pLast = pLeft + pLeft = (*TGeoSegment)(unsafe.Pointer(pLeft)).FpNext + } + } + if pRight != 0 { + v1 = pRight + } else { + v1 = pLeft + } + (*TGeoSegment)(unsafe.Pointer(pLast)).FpNext = v1 + return (*(*TGeoSegment)(unsafe.Pointer(bp))).FpNext +} + +// C documentation +// +// /* +// ** Sort a list of GeoSegments in order of increasing Y and in the event of +// ** a tie, increasing C (slope). +// */ +func _geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) (r uintptr) { + var a [50]uintptr + var i, mx int32 + var p uintptr + _, _, _, _ = a, i, mx, p + mx = 0 + for pList != 0 { + p = pList + pList = (*TGeoSegment)(unsafe.Pointer(pList)).FpNext + (*TGeoSegment)(unsafe.Pointer(p)).FpNext = uintptr(0) + i = 0 + for { + if !(i < mx && a[i] != 0) { + break + } + p = _geopolySegmentMerge(tls, a[i], p) + a[i] = uintptr(0) + goto _1 + _1: + ; + i++ + } + a[i] = p + if i >= mx { + mx = i + int32(1) + } + } + p = uintptr(0) + i = 0 + for { + if !(i < mx) { + break + } + p = _geopolySegmentMerge(tls, a[i], p) + goto _2 + _2: + ; + i++ + } + return p +} + +// C documentation +// +// /* +// ** Determine the overlap between two polygons +// */ +func _geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iMask, needSort, rc, v1 int32 + var nByte, nVertex Tsqlite3_int64 + var p, pActive, pPrev, pSeg, pThisEvent, v5, v7 uintptr + var rX, y, v2 float64 + var _ /* aOverlap at bp+0 */ [4]uint8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iMask, nByte, nVertex, needSort, p, pActive, pPrev, pSeg, pThisEvent, rX, rc, y, v1, v2, v5, v7 + nVertex = int64((*TGeoPoly)(unsafe.Pointer(p1)).FnVertex + (*TGeoPoly)(unsafe.Pointer(p2)).FnVertex + int32(2)) + rc = 0 + needSort = 0 + pActive = uintptr(0) + nByte = int64(uint64(32)*uint64(nVertex)*uint64(2) + uint64(48)*uint64(nVertex) + uint64(24)) + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if p == uintptr(0) { + return -int32(1) + } + (*TGeoOverlap)(unsafe.Pointer(p)).FaEvent = p + 1*24 + (*TGeoOverlap)(unsafe.Pointer(p)).FaSegment = (*TGeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr(nVertex*int64(2))*32 + v1 = libc.Int32FromInt32(0) + (*TGeoOverlap)(unsafe.Pointer(p)).FnSegment = v1 + (*TGeoOverlap)(unsafe.Pointer(p)).FnEvent = v1 + _geopolyAddSegments(tls, p, p1, uint8(1)) + _geopolyAddSegments(tls, p, p2, uint8(2)) + pThisEvent = _geopolySortEventsByX(tls, (*TGeoOverlap)(unsafe.Pointer(p)).FaEvent, (*TGeoOverlap)(unsafe.Pointer(p)).FnEvent) + if pThisEvent != 0 && (*TGeoEvent)(unsafe.Pointer(pThisEvent)).Fx == float64(0) { + v2 = -libc.Float64FromFloat64(1) + } else { + v2 = float64(0) + } + rX = v2 + libc.Xmemset(tls, bp, 0, uint64(4)) + for pThisEvent != 0 { + if (*TGeoEvent)(unsafe.Pointer(pThisEvent)).Fx != rX { + pPrev = uintptr(0) + iMask = 0 + rX = (*TGeoEvent)(unsafe.Pointer(pThisEvent)).Fx + if needSort != 0 { + pActive = _geopolySortSegmentsByYAndC(tls, pActive) + needSort = 0 + } + pSeg = pActive + for { + if !(pSeg != 0) { + break + } + if pPrev != 0 { + if (*TGeoSegment)(unsafe.Pointer(pPrev)).Fy != (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy { + (*(*[4]uint8)(unsafe.Pointer(bp)))[iMask] = uint8(1) + } + } + iMask ^= int32((*TGeoSegment)(unsafe.Pointer(pSeg)).Fside) + pPrev = pSeg + goto _3 + _3: + ; + pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext + } + pPrev = uintptr(0) + pSeg = pActive + for { + if !(pSeg != 0) { + break + } + y = (*TGeoSegment)(unsafe.Pointer(pSeg)).FC*rX + (*TGeoSegment)(unsafe.Pointer(pSeg)).FB + (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy = y + if pPrev != 0 { + if (*TGeoSegment)(unsafe.Pointer(pPrev)).Fy > (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy && int32((*TGeoSegment)(unsafe.Pointer(pPrev)).Fside) != int32((*TGeoSegment)(unsafe.Pointer(pSeg)).Fside) { + rc = int32(1) + goto geopolyOverlapDone + } else { + if (*TGeoSegment)(unsafe.Pointer(pPrev)).Fy != (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy { + (*(*[4]uint8)(unsafe.Pointer(bp)))[iMask] = uint8(1) + } + } + } + iMask ^= int32((*TGeoSegment)(unsafe.Pointer(pSeg)).Fside) + pPrev = pSeg + goto _4 + _4: + ; + pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext + } + } + if (*TGeoEvent)(unsafe.Pointer(pThisEvent)).FeType == 0 { + /* Add a segment */ + pSeg = (*TGeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg + (*TGeoSegment)(unsafe.Pointer(pSeg)).Fy = float64((*TGeoSegment)(unsafe.Pointer(pSeg)).Fy0) + (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext = pActive + pActive = pSeg + needSort = int32(1) + } else { + /* Remove a segment */ + if pActive == (*TGeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg { + if pActive != 0 { + v5 = (*TGeoSegment)(unsafe.Pointer(pActive)).FpNext + } else { + v5 = uintptr(0) + } + pActive = v5 + } else { + pSeg = pActive + for { + if !(pSeg != 0) { + break + } + if (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext == (*TGeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg { + if (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext != 0 { + v7 = (*TGeoSegment)(unsafe.Pointer((*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext)).FpNext + } else { + v7 = uintptr(0) + } + (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext = v7 + break + } + goto _6 + _6: + ; + pSeg = (*TGeoSegment)(unsafe.Pointer(pSeg)).FpNext + } + } + } + pThisEvent = (*TGeoEvent)(unsafe.Pointer(pThisEvent)).FpNext + } + if int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(3)]) == 0 { + rc = 0 + } else { + if int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)]) != 0 && int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(2)]) == 0 { + rc = int32(3) + } else { + if int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)]) == 0 && int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(2)]) != 0 { + rc = int32(2) + } else { + if int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)]) == 0 && int32((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(2)]) == 0 { + rc = int32(4) + } else { + rc = int32(1) + } + } + } + } +geopolyOverlapDone: + ; + Xsqlite3_free(tls, p) + return rc +} + +// C documentation +// +// /* +// ** SQL function: geopoly_overlap(P1,P2) +// ** +// ** Determine whether or not P1 and P2 overlap. Return value: +// ** +// ** 0 The two polygons are disjoint +// ** 1 They overlap +// ** 2 P1 is completely contained within P2 +// ** 3 P2 is completely contained within P1 +// ** 4 P1 and P2 are the same polygon +// ** NULL Either P1 or P2 or both are not valid polygons +// */ +func _geopolyOverlapFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var p1, p2 uintptr + var x int32 + _, _, _ = p1, p2, x + p1 = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + p2 = _geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uintptr(0)) + _ = argc + if p1 != 0 && p2 != 0 { + x = _geopolyOverlap(tls, p1, p2) + if x < 0 { + Xsqlite3_result_error_nomem(tls, context) + } else { + Xsqlite3_result_int(tls, context, x) + } + } + Xsqlite3_free(tls, p1) + Xsqlite3_free(tls, p2) +} + +// C documentation +// +// /* +// ** Enable or disable debugging output +// */ +func _geopolyDebugFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + _ = context + _ = argc + _ = argv +} + +// C documentation +// +// /* +// ** This function is the implementation of both the xConnect and xCreate +// ** methods of the geopoly virtual table. +// ** +// ** argv[0] -> module name +// ** argv[1] -> database name +// ** argv[2] -> table name +// ** argv[...] -> column names... +// */ +func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var ii, rc, v2 int32 + var nDb, nName Tsqlite3_int64 + var pRtree, pSql, zSql uintptr + _, _, _, _, _, _, _, _ = ii, nDb, nName, pRtree, pSql, rc, zSql, v2 + rc = SQLITE_OK + _ = pAux + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_CONSTRAINT_SUPPORT), libc.VaList(bp+8, int32(1))) + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_INNOCUOUS), 0) + /* Allocate the sqlite3_vtab structure */ + nDb = int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + nName = int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + pRtree = Xsqlite3_malloc64(tls, uint64(968)+uint64(nDb)+uint64(nName*int64(2))+uint64(8)) + if !(pRtree != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pRtree, 0, uint64(968)+uint64(nDb)+uint64(nName*int64(2))+uint64(8)) + (*TRtree)(unsafe.Pointer(pRtree)).FnBusy = uint32(1) + (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FpModule = uintptr(unsafe.Pointer(&_rtreeModule)) + (*TRtree)(unsafe.Pointer(pRtree)).FzDb = pRtree + 1*968 + (*TRtree)(unsafe.Pointer(pRtree)).FzName = (*TRtree)(unsafe.Pointer(pRtree)).FzDb + uintptr(nDb+int64(1)) + (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName = (*TRtree)(unsafe.Pointer(pRtree)).FzName + uintptr(nName+int64(1)) + (*TRtree)(unsafe.Pointer(pRtree)).FeCoordType = uint8(RTREE_COORD_REAL32) + (*TRtree)(unsafe.Pointer(pRtree)).FnDim = uint8(2) + (*TRtree)(unsafe.Pointer(pRtree)).FnDim2 = uint8(4) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + libc.Xmemcpy(tls, (*TRtree)(unsafe.Pointer(pRtree)).FzNodeName+uintptr(nName), __ccgo_ts+27317, uint64(6)) + /* Create/Connect to the underlying relational database schema. If + ** that is successful, call sqlite3_declare_vtab() to configure + ** the r-tree table schema. + */ + pSql = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28277, 0) + (*TRtree)(unsafe.Pointer(pRtree)).FnAux = uint8(1) /* Add one for _shape */ + (*TRtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = uint8(1) /* The _shape column is always not-null */ + ii = int32(3) + for { + if !(ii < argc) { + break + } + (*TRtree)(unsafe.Pointer(pRtree)).FnAux++ + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+28299, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + goto _1 + _1: + ; + ii++ + } + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+27374, 0) + zSql = Xsqlite3_str_finish(tls, pSql) + if !(zSql != 0) { + rc = int32(SQLITE_NOMEM) + } else { + v2 = Xsqlite3_declare_vtab(tls, db, zSql) + rc = v2 + if SQLITE_OK != v2 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + } + } + Xsqlite3_free(tls, zSql) + if rc != 0 { + goto geopolyInit_fail + } + (*TRtree)(unsafe.Pointer(pRtree)).FnBytesPerCell = uint8(int32(8) + int32((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)*int32(4)) + /* Figure out the node size to use. */ + rc = _getNodeSize(tls, db, pRtree, isCreate, pzErr) + if rc != 0 { + goto geopolyInit_fail + } + rc = _rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) + if rc != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + goto geopolyInit_fail + } + *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree + return SQLITE_OK +geopolyInit_fail: + ; + if rc == SQLITE_OK { + rc = int32(SQLITE_ERROR) + } + _rtreeRelease(tls, pRtree) + return rc +} + +// C documentation +// +// /* +// ** GEOPOLY virtual table module xCreate method. +// */ +func _geopolyCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + return _geopolyInit(tls, db, pAux, argc, argv, ppVtab, pzErr, int32(1)) +} + +// C documentation +// +// /* +// ** GEOPOLY virtual table module xConnect method. +// */ +func _geopolyConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + return _geopolyInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 0) +} + +// C documentation +// +// /* +// ** GEOPOLY virtual table module xFilter method. +// ** +// ** Query plans: +// ** +// ** 1 rowid lookup +// ** 2 search for objects overlapping the same bounding box +// ** that contains polygon argv[0] +// ** 3 search for objects overlapping the same bounding box +// ** that contains polygon argv[0] +// ** 4 full table scan +// */ +func _geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iRowid Ti64 + var p, p1, pCsr, pNew, pRtree, v1 uintptr + var _ /* bbox at bp+32 */ [4]TRtreeCoord + var _ /* iCell at bp+12 */ int32 + var _ /* iNode at bp+24 */ Ti64 + var _ /* pLeaf at bp+16 */ uintptr + var _ /* pRoot at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _, _, _, _, _, _ = iRowid, p, p1, pCsr, pNew, pRtree, v1 + pRtree = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + pCsr = pVtabCursor + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 12)) = 0 + _ = idxStr + _rtreeReference(tls, pRtree) + /* Reset the cursor to the same state as rtreeOpen() leaves it in. */ + _resetCursor(tls, pCsr) + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FiStrategy = idxNum + if idxNum == int32(1) { /* Search point for the leaf */ + iRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*Ti64)(unsafe.Pointer(bp + 24)) = 0 + *(*int32)(unsafe.Pointer(bp + 8)) = _findLeafNode(tls, pRtree, iRowid, bp+16, bp+24) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && *(*uintptr)(unsafe.Pointer(bp + 16)) != uintptr(0) { + p = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8(0)) + /* Always returns pCsr->sPoint */ + *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp + 16)) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*Ti64)(unsafe.Pointer(bp + 24)) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = uint8(PARTLY_WITHIN) + *(*int32)(unsafe.Pointer(bp + 8)) = _nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 16)), iRowid, bp+12) + (*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell = uint8(*(*int32)(unsafe.Pointer(bp + 12))) + } else { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FatEOF = uint8(1) + } + } else { + /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array + ** with the configured constraints. + */ + *(*int32)(unsafe.Pointer(bp + 8)) = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && idxNum <= int32(3) { + _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(argv)), bp+32, bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) != 0 { + goto geopoly_filter_end + } + v1 = Xsqlite3_malloc(tls, int32(libc.Uint64FromInt64(24)*libc.Uint64FromInt32(4))) + p1 = v1 + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = v1 + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint = int32(4) + if p1 == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint, 0, libc.Uint64FromInt64(24)*libc.Uint64FromInt32(4)) + libc.Xmemset(tls, pCsr+128, 0, uint64(4)*uint64((*TRtree)(unsafe.Pointer(pRtree)).FiDepth+libc.Int32FromInt32(1))) + if idxNum == int32(2) { + /* Overlap query */ + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('B') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 0 + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 1*4))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('D') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(1) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('B') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(2) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 3*4))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('D') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(3) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 2*4))) + } else { + /* Within query */ + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('D') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 0 + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('B') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(1) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 1*4))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('D') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(2) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 2*4))) + p1 += 24 + (*TRtreeConstraint)(unsafe.Pointer(p1)).Fop = int32('B') + (*TRtreeConstraint)(unsafe.Pointer(p1)).FiCoord = int32(3) + *(*TRtreeDValue)(unsafe.Pointer(p1 + 8)) = float64(*(*TRtreeValue)(unsafe.Pointer(bp + 32 + 3*4))) + } + } + } + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + pNew = _rtreeSearchPointNew(tls, pCsr, float64(0), uint8((*TRtree)(unsafe.Pointer(pRtree)).FiDepth+libc.Int32FromInt32(1))) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_NOMEM) + goto geopoly_filter_end + } + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = uint8(0) + (*TRtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = uint8(PARTLY_WITHIN) + *(*uintptr)(unsafe.Pointer(pCsr + 88)) = *(*uintptr)(unsafe.Pointer(bp)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = _rtreeStepToLeaf(tls, pCsr) + } + } +geopoly_filter_end: + ; + _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp))) + _rtreeRelease(tls, pRtree) + return *(*int32)(unsafe.Pointer(bp + 8)) +} + +// C documentation +// +// /* +// ** Rtree virtual table module xBestIndex method. There are three +// ** table scan strategies to choose from (in order from most to +// ** least desirable): +// ** +// ** idxNum idxStr Strategy +// ** ------------------------------------------------ +// ** 1 "rowid" Direct lookup by rowid. +// ** 2 "rtree" R-tree overlap query using geopoly_overlap() +// ** 3 "rtree" R-tree within query using geopoly_within() +// ** 4 "fullscan" full-table scan. +// ** ------------------------------------------------ +// */ +func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { + var iFuncTerm, iRowidTerm, idxNum, ii int32 + var p uintptr + _, _, _, _, _ = iFuncTerm, iRowidTerm, idxNum, ii, p + iRowidTerm = -int32(1) + iFuncTerm = -int32(1) + idxNum = 0 + _ = tab + ii = 0 + for { + if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + break + } + p = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12 + if !((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) { + goto _1 + } + if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0 && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) { + iRowidTerm = ii + break + } + if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0 && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) >= int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) { + /* p->op==SQLITE_INDEX_CONSTRAINT_FUNCTION for geopoly_overlap() + ** p->op==(SQLITE_INDEX_CONTRAINT_FUNCTION+1) for geopoly_within(). + ** See geopolyFindFunction() */ + iFuncTerm = ii + idxNum = int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) - int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + int32(2) + } + goto _1 + _1: + ; + ii++ + } + if iRowidTerm >= 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 16726 + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = int32(SQLITE_INDEX_SCAN_UNIQUE) + return SQLITE_OK + } + if iFuncTerm >= 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28303 + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10) + return SQLITE_OK + } + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 28309 + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** GEOPOLY virtual table module xColumn method. +// */ +func _geopolyColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pCsr, pNode, pRtree uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _ = p, pCsr, pNode, pRtree + pRtree = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab + pCsr = cur + p = _rtreeSearchPointFirst(tls, pCsr) + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + pNode = _rtreeNodeOfFirstSearchPoint(tls, pCsr, bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + if p == uintptr(0) { + return SQLITE_OK + } + if i == 0 && Xsqlite3_vtab_nochange(tls, ctx) != 0 { + return SQLITE_OK + } + if i <= int32((*TRtree)(unsafe.Pointer(pRtree)).FnAux) { + if !((*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid != 0) { + if (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzReadAuxSql, -int32(1), uint32(0), pCsr+56, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + Xsqlite3_bind_int64(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, int32(1), _nodeGetRowid(tls, pRtree, pNode, int32((*TRtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_step(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ROW) { + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = uint8(1) + } else { + Xsqlite3_reset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_DONE) { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + return *(*int32)(unsafe.Pointer(bp)) + } + } + Xsqlite3_result_value(tls, ctx, Xsqlite3_column_value(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, i+int32(2))) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The xUpdate method for GEOPOLY module virtual tables. +// ** +// ** For DELETE: +// ** +// ** argv[0] = the rowid to be deleted +// ** +// ** For INSERT: +// ** +// ** argv[0] = SQL NULL +// ** argv[1] = rowid to insert, or an SQL NULL to select automatically +// ** argv[2] = _shape column +// ** argv[3] = first application-defined column.... +// ** +// ** For UPDATE: +// ** +// ** argv[0] = rowid to modify. Never NULL +// ** argv[1] = rowid after the change. Never NULL +// ** argv[2] = new value for _shape +// ** argv[3] = new value for first application-defined column.... +// */ +func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var coordChange, jj, nChange, newRowidValid, oldRowidValid, rc2, steprc int32 + var newRowid, oldRowid Ti64 + var p, pRtree, pUp, v3 uintptr + var v1, v2 int64 + var v4 bool + var _ /* cell at bp+8 */ TRtreeCell + var _ /* pLeaf at bp+56 */ uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = coordChange, jj, nChange, newRowid, newRowidValid, oldRowid, oldRowidValid, p, pRtree, pUp, rc2, steprc, v1, v2, v3, v4 + pRtree = pVtab + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* True if newRowid is valid */ + coordChange = 0 /* Change in coordinates */ + if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 { + /* Unable to write to the btree while another cursor is reading from it, + ** since the write might do a rebalance which would disrupt the read + ** cursor. */ + return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)< int32(1) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8))) != int32(SQLITE_NULL)) + if newRowidValid != 0 { + v2 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8))) + } else { + v2 = 0 + } + newRowid = v2 + (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = newRowid + if nData > int32(1) && (!(oldRowidValid != 0) || !(Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0) || oldRowid != newRowid) { + _geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) { + (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28318, 0) + } + goto geopoly_update_end + } + coordChange = int32(1) + /* If a rowid value was supplied, check if it is already present in + ** the table. If so, the constraint has failed. */ + if newRowidValid != 0 && (!(oldRowidValid != 0) || oldRowid != newRowid) { + Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid) + steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid) + if int32(SQLITE_ROW) == steprc { + if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) { + *(*int32)(unsafe.Pointer(bp)) = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid) + } else { + *(*int32)(unsafe.Pointer(bp)) = _rtreeConstraintError(tls, pRtree, 0) + } + } + } + } + /* If aData[0] is not an SQL NULL value, it is the rowid of a + ** record to delete from the r-tree table. The following block does + ** just that. + */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (nData == int32(1) || coordChange != 0 && oldRowidValid != 0) { + *(*int32)(unsafe.Pointer(bp)) = _rtreeDeleteRowid(tls, pRtree, oldRowid) + } + /* If the aData[] array contains more than one element, elements + ** (aData[2]..aData[argc-1]) contain a new record to insert into + ** the r-tree structure. + */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nData > int32(1) && coordChange != 0 { + /* Insert the new record into the r-tree */ + *(*uintptr)(unsafe.Pointer(bp + 56)) = uintptr(0) + if !(newRowidValid != 0) { + *(*int32)(unsafe.Pointer(bp)) = _rtreeNewRowid(tls, pRtree, bp+8) + } + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _ChooseLeaf(tls, pRtree, bp+8, 0, bp+56) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56)), bp+8, 0) + rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56))) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = rc2 + } + } + } + /* Change the data */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nData > int32(1) { + pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux + nChange = 0 + Xsqlite3_bind_int64(tls, pUp, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid) + if Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0 { + Xsqlite3_bind_null(tls, pUp, int32(2)) + } else { + p = uintptr(0) + if v4 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) == int32(SQLITE_TEXT); v4 { + v3 = _geopolyFuncParam(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp) + p = v3 + } + if v4 && v3 != uintptr(0) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + Xsqlite3_bind_blob(tls, pUp, int32(2), p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_bind_value(tls, pUp, int32(2), *(*uintptr)(unsafe.Pointer(aData + 2*8))) + } + Xsqlite3_free(tls, p) + nChange = int32(1) + } + jj = int32(1) + for { + if !(jj < nData-int32(2)) { + break + } + nChange++ + Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8))) + goto _5 + _5: + ; + jj++ + } + if nChange != 0 { + Xsqlite3_step(tls, pUp) + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_reset(tls, pUp) + } + } +geopoly_update_end: + ; + _rtreeRelease(tls, pRtree) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Report that geopoly_overlap() is an overloaded function suitable +// ** for use in xBestIndex. +// */ +func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) (r int32) { + _ = pVtab + _ = nArg + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28358) == 0 { + *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) + *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) + return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + } + if Xsqlite3_stricmp(tls, zName, __ccgo_ts+28374) == 0 { + *(*uintptr)(unsafe.Pointer(pxFunc)) = __ccgo_fp(_geopolyWithinFunc) + *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) + return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) + } + return 0 +} + +var _geopolyModule = Tsqlite3_module{ + FiVersion: int32(3), +} + +func init() { + p := unsafe.Pointer(&_geopolyModule) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_geopolyCreate) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_geopolyConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_geopolyBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_rtreeDisconnect) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_rtreeDestroy) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_rtreeOpen) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rtreeClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_geopolyFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_rtreeNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rtreeEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_geopolyColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_rtreeRowid) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_geopolyUpdate) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rtreeBeginTransaction) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 136)) = __ccgo_fp(_rtreeEndTransaction) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_geopolyFindFunction) + *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_rtreeRename) + *(*uintptr)(unsafe.Add(p, 160)) = __ccgo_fp(_rtreeSavepoint) + *(*uintptr)(unsafe.Add(p, 184)) = __ccgo_fp(_rtreeShadowName) + *(*uintptr)(unsafe.Add(p, 192)) = __ccgo_fp(_rtreeIntegrity) +} + +func _sqlite3_geopoly_init(tls *libc.TLS, db uintptr) (r int32) { + var enc, rc int32 + var i uint32 + _, _, _ = enc, i, rc + rc = SQLITE_OK + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(288)/libc.Uint64FromInt64(24) && rc == SQLITE_OK) { + break + } + if _aFunc[i].FbPure != 0 { + enc = libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_INNOCUOUS) + } else { + enc = libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) + } + rc = Xsqlite3_create_function(tls, db, _aFunc[i].FzName, int32(_aFunc[i].FnArg), enc, uintptr(0), _aFunc[i].FxFunc, uintptr(0), uintptr(0)) + goto _1 + _1: + ; + i++ + } + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(24)/libc.Uint64FromInt64(24) && rc == SQLITE_OK) { + break + } + rc = Xsqlite3_create_function(tls, db, _aAgg[i].FzName, int32(1), libc.Int32FromInt32(SQLITE_UTF8)|libc.Int32FromInt32(SQLITE_DETERMINISTIC)|libc.Int32FromInt32(SQLITE_INNOCUOUS), uintptr(0), uintptr(0), _aAgg[i].FxStep, _aAgg[i].FxFinal) + goto _2 + _2: + ; + i++ + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28551, uintptr(unsafe.Pointer(&_geopolyModule)), uintptr(0), uintptr(0)) + } + return rc +} + +var _aFunc = [12]struct { + FxFunc uintptr + FnArg int8 + FbPure uint8 + FzName uintptr +}{ + 0: { + FnArg: int8(1), + FbPure: uint8(1), + FzName: __ccgo_ts + 28389, + }, + 1: { + FnArg: int8(1), + FbPure: uint8(1), + FzName: __ccgo_ts + 28402, + }, + 2: { + FnArg: int8(1), + FbPure: uint8(1), + FzName: __ccgo_ts + 28415, + }, + 3: { + FnArg: int8(-int32(1)), + FbPure: uint8(1), + FzName: __ccgo_ts + 28428, + }, + 4: { + FnArg: int8(2), + FbPure: uint8(1), + FzName: __ccgo_ts + 28374, + }, + 5: { + FnArg: int8(3), + FbPure: uint8(1), + FzName: __ccgo_ts + 28440, + }, + 6: { + FnArg: int8(2), + FbPure: uint8(1), + FzName: __ccgo_ts + 28358, + }, + 7: { + FnArg: int8(1), + FzName: __ccgo_ts + 28463, + }, + 8: { + FnArg: int8(1), + FbPure: uint8(1), + FzName: __ccgo_ts + 28477, + }, + 9: { + FnArg: int8(7), + FbPure: uint8(1), + FzName: __ccgo_ts + 28490, + }, + 10: { + FnArg: int8(4), + FbPure: uint8(1), + FzName: __ccgo_ts + 28504, + }, + 11: { + FnArg: int8(1), + FbPure: uint8(1), + FzName: __ccgo_ts + 28520, + }, +} + +func init() { + p := unsafe.Pointer(&_aFunc) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_geopolyAreaFunc) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_geopolyBlobFunc) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_geopolyJsonFunc) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_geopolySvgFunc) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_geopolyWithinFunc) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_geopolyContainsPointFunc) + *(*uintptr)(unsafe.Add(p, 144)) = __ccgo_fp(_geopolyOverlapFunc) + *(*uintptr)(unsafe.Add(p, 168)) = __ccgo_fp(_geopolyDebugFunc) + *(*uintptr)(unsafe.Add(p, 192)) = __ccgo_fp(_geopolyBBoxFunc) + *(*uintptr)(unsafe.Add(p, 216)) = __ccgo_fp(_geopolyXformFunc) + *(*uintptr)(unsafe.Add(p, 240)) = __ccgo_fp(_geopolyRegularFunc) + *(*uintptr)(unsafe.Add(p, 264)) = __ccgo_fp(_geopolyCcwFunc) +} + +var _aAgg = [1]struct { + FxStep uintptr + FxFinal uintptr + FzName uintptr +}{ + 0: { + FzName: __ccgo_ts + 28532, + }, +} + +func init() { + p := unsafe.Pointer(&_aAgg) + *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_geopolyBBoxStep) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_geopolyBBoxFinal) +} + +/************** End of geopoly.c *********************************************/ +/************** Continuing where we left off in rtree.c **********************/ + +// C documentation +// +// /* +// ** Register the r-tree module with database handle db. This creates the +// ** virtual table module "rtree" and the debugging/analysis scalar +// ** function "rtreenode". +// */ +func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { + var c, c1 uintptr + var rc, utf8 int32 + _, _, _, _ = c, c1, rc, utf8 + utf8 = int32(SQLITE_UTF8) + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28559, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28569, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, db, __ccgo_ts+28580, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + c = libc.UintptrFromInt32(RTREE_COORD_REAL32) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28303, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) + } + if rc == SQLITE_OK { + c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) + rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+28591, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) + } + if rc == SQLITE_OK { + rc = _sqlite3_geopoly_init(tls, db) + } + return rc +} + +// C documentation +// +// /* +// ** This routine deletes the RtreeGeomCallback object that was attached +// ** one of the SQL functions create by sqlite3_rtree_geometry_callback() +// ** or sqlite3_rtree_query_callback(). In other words, this routine is the +// ** destructor for an RtreeGeomCallback objecct. This routine is called when +// ** the corresponding SQL function is deleted. +// */ +func _rtreeFreeCallback(tls *libc.TLS, p uintptr) { + var pInfo uintptr + _ = pInfo + pInfo = p + if (*TRtreeGeomCallback)(unsafe.Pointer(pInfo)).FxDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TRtreeGeomCallback)(unsafe.Pointer(pInfo)).FxDestructor})))(tls, (*TRtreeGeomCallback)(unsafe.Pointer(pInfo)).FpContext) + } + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** This routine frees the BLOB that is returned by geomCallback(). +// */ +func _rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { + var i int32 + var p uintptr + _, _ = i, p + p = pArg + i = 0 + for { + if !(i < (*TRtreeMatchArg)(unsafe.Pointer(p)).FnParam) { + break + } + Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, p) +} + +// C documentation +// +// /* +// ** Each call to sqlite3_rtree_geometry_callback() or +// ** sqlite3_rtree_query_callback() creates an ordinary SQLite +// ** scalar function that is implemented by this routine. +// ** +// ** All this function does is construct an RtreeMatchArg object that +// ** contains the geometry-checking callback routines and a list of +// ** parameters to this function, then return that RtreeMatchArg object +// ** as a BLOB. +// ** +// ** The R-Tree MATCH operator will read the returned BLOB, deserialize +// ** the RtreeMatchArg object, and use the RtreeMatchArg object to figure +// ** out which elements of the R-Tree should be returned by the query. +// */ +func _geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { + var i, memErr int32 + var nBlob Tsqlite3_int64 + var pBlob, pGeomCtx uintptr + _, _, _, _, _ = i, memErr, nBlob, pBlob, pGeomCtx + pGeomCtx = Xsqlite3_user_data(tls, ctx) + memErr = 0 + nBlob = int64(uint64(64) + uint64(nArg-libc.Int32FromInt32(1))*uint64(8) + uint64(nArg)*uint64(8)) + pBlob = Xsqlite3_malloc64(tls, uint64(nBlob)) + if !(pBlob != 0) { + Xsqlite3_result_error_nomem(tls, ctx) + } else { + (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FiSize = uint32(nBlob) + (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb = *(*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)) + (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam = pBlob + 56 + uintptr(nArg)*8 + (*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FnParam = nArg + i = 0 + for { + if !(i < nArg) { + break + } + *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + uintptr(i)*8)) = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) + if *(*uintptr)(unsafe.Pointer((*TRtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + uintptr(i)*8)) == uintptr(0) { + memErr = int32(1) + } + *(*TRtreeDValue)(unsafe.Pointer(pBlob + 56 + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + if memErr != 0 { + Xsqlite3_result_error_nomem(tls, ctx) + _rtreeMatchArgFree(tls, pBlob) + } else { + Xsqlite3_result_pointer(tls, ctx, pBlob, __ccgo_ts+25860, __ccgo_fp(_rtreeMatchArgFree)) + } + } +} + +// C documentation +// +// /* +// ** Register a new geometry function for use with the r-tree MATCH operator. +// */ +func Xsqlite3_rtree_geometry_callback(tls *libc.TLS, db uintptr, zGeom uintptr, xGeom uintptr, pContext uintptr) (r int32) { + var pGeomCtx uintptr + _ = pGeomCtx /* Context object for new user-function */ + /* Allocate and populate the context object. */ + pGeomCtx = Xsqlite3_malloc(tls, int32(32)) + if !(pGeomCtx != 0) { + return int32(SQLITE_NOMEM) + } + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxGeom = xGeom + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxQueryFunc = uintptr(0) + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxDestructor = uintptr(0) + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FpContext = pContext + return Xsqlite3_create_function_v2(tls, db, zGeom, -int32(1), int32(SQLITE_ANY), pGeomCtx, __ccgo_fp(_geomCallback), uintptr(0), uintptr(0), __ccgo_fp(_rtreeFreeCallback)) +} + +// C documentation +// +// /* +// ** Register a new 2nd-generation geometry function for use with the +// ** r-tree MATCH operator. +// */ +func Xsqlite3_rtree_query_callback(tls *libc.TLS, db uintptr, zQueryFunc uintptr, xQueryFunc uintptr, pContext uintptr, xDestructor uintptr) (r int32) { + var pGeomCtx uintptr + _ = pGeomCtx /* Context object for new user-function */ + /* Allocate and populate the context object. */ + pGeomCtx = Xsqlite3_malloc(tls, int32(32)) + if !(pGeomCtx != 0) { + if xDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{xDestructor})))(tls, pContext) + } + return int32(SQLITE_NOMEM) + } + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxGeom = uintptr(0) + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxQueryFunc = xQueryFunc + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxDestructor = xDestructor + (*TRtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FpContext = pContext + return Xsqlite3_create_function_v2(tls, db, zQueryFunc, -int32(1), int32(SQLITE_ANY), pGeomCtx, __ccgo_fp(_geomCallback), uintptr(0), uintptr(0), __ccgo_fp(_rtreeFreeCallback)) +} + +/************** End of rtree.c ***********************************************/ +/************** Begin file icu.c *********************************************/ +/* +** 2007 May 6 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $ +** +** This file implements an integration between the ICU library +** ("International Components for Unicode", an open-source library +** for handling unicode data) and SQLite. The integration uses +** ICU to provide the following to SQLite: +** +** * An implementation of the SQL regexp() function (and hence REGEXP +** operator) using the ICU uregex_XX() APIs. +** +** * Implementations of the SQL scalar upper() and lower() functions +** for case mapping. +** +** * Integration of ICU and SQLite collation sequences. +** +** * An implementation of the LIKE operator that uses ICU to +** provide case-independent matching. + */ + +/************** End of icu.c *************************************************/ +/************** Begin file fts3_icu.c ****************************************/ +/* +** 2007 June 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file implements a tokenizer for fts3 based on the ICU library. + */ +/* #include "fts3Int.h" */ + +/************** End of fts3_icu.c ********************************************/ +/************** Begin file sqlite3rbu.c **************************************/ +/* +** 2014 August 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** +** OVERVIEW +** +** The RBU extension requires that the RBU update be packaged as an +** SQLite database. The tables it expects to find are described in +** sqlite3rbu.h. Essentially, for each table xyz in the target database +** that the user wishes to write to, a corresponding data_xyz table is +** created in the RBU database and populated with one row for each row to +** update, insert or delete from the target table. +** +** The update proceeds in three stages: +** +** 1) The database is updated. The modified database pages are written +** to a *-oal file. A *-oal file is just like a *-wal file, except +** that it is named "-oal" instead of "-wal". +** Because regular SQLite clients do not look for file named +** "-oal", they go on using the original database in +** rollback mode while the *-oal file is being generated. +** +** During this stage RBU does not update the database by writing +** directly to the target tables. Instead it creates "imposter" +** tables using the SQLITE_TESTCTRL_IMPOSTER interface that it uses +** to update each b-tree individually. All updates required by each +** b-tree are completed before moving on to the next, and all +** updates are done in sorted key order. +** +** 2) The "-oal" file is moved to the equivalent "-wal" +** location using a call to rename(2). Before doing this the RBU +** module takes an EXCLUSIVE lock on the database file, ensuring +** that there are no other active readers. +** +** Once the EXCLUSIVE lock is released, any other database readers +** detect the new *-wal file and read the database in wal mode. At +** this point they see the new version of the database - including +** the updates made as part of the RBU update. +** +** 3) The new *-wal file is checkpointed. This proceeds in the same way +** as a regular database checkpoint, except that a single frame is +** checkpointed each time sqlite3rbu_step() is called. If the RBU +** handle is closed before the entire *-wal file is checkpointed, +** the checkpoint progress is saved in the RBU database and the +** checkpoint can be resumed by another RBU client at some point in +** the future. +** +** POTENTIAL PROBLEMS +** +** The rename() call might not be portable. And RBU is not currently +** syncing the directory after renaming the file. +** +** When state is saved, any commit to the *-oal file and the commit to +** the RBU update database are not atomic. So if the power fails at the +** wrong moment they might get out of sync. As the main database will be +** committed before the RBU update database this will likely either just +** pass unnoticed, or result in SQLITE_CONSTRAINT errors (due to UNIQUE +** constraint violations). +** +** If some client does modify the target database mid RBU update, or some +** other error occurs, the RBU extension will keep throwing errors. It's +** not really clear how to get out of this state. The system could just +** by delete the RBU update database and *-oal file and have the device +** download the update again and start over. +** +** At present, for an UPDATE, both the new.* and old.* records are +** collected in the rbu_xyz table. And for both UPDATEs and DELETEs all +** fields are collected. This means we're probably writing a lot more +** data to disk when saving the state of an ongoing update to the RBU +** update database than is strictly necessary. +** + */ + +/* #include */ +/* #include */ +/* #include */ + +/* #include "sqlite3.h" */ + +/************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/ +/************** Begin file sqlite3rbu.h **************************************/ +/* +** 2014 August 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains the public interface for the RBU extension. + */ + +/* +** SUMMARY +** +** Writing a transaction containing a large number of operations on +** b-tree indexes that are collectively larger than the available cache +** memory can be very inefficient. +** +** The problem is that in order to update a b-tree, the leaf page (at least) +** containing the entry being inserted or deleted must be modified. If the +** working set of leaves is larger than the available cache memory, then a +** single leaf that is modified more than once as part of the transaction +** may be loaded from or written to the persistent media multiple times. +** Additionally, because the index updates are likely to be applied in +** random order, access to pages within the database is also likely to be in +** random order, which is itself quite inefficient. +** +** One way to improve the situation is to sort the operations on each index +** by index key before applying them to the b-tree. This leads to an IO +** pattern that resembles a single linear scan through the index b-tree, +** and all but guarantees each modified leaf page is loaded and stored +** exactly once. SQLite uses this trick to improve the performance of +** CREATE INDEX commands. This extension allows it to be used to improve +** the performance of large transactions on existing databases. +** +** Additionally, this extension allows the work involved in writing the +** large transaction to be broken down into sub-transactions performed +** sequentially by separate processes. This is useful if the system cannot +** guarantee that a single update process will run for long enough to apply +** the entire update, for example because the update is being applied on a +** mobile device that is frequently rebooted. Even after the writer process +** has committed one or more sub-transactions, other database clients continue +** to read from the original database snapshot. In other words, partially +** applied transactions are not visible to other clients. +** +** "RBU" stands for "Resumable Bulk Update". As in a large database update +** transmitted via a wireless network to a mobile device. A transaction +** applied using this extension is hence refered to as an "RBU update". +** +** +** LIMITATIONS +** +** An "RBU update" transaction is subject to the following limitations: +** +** * The transaction must consist of INSERT, UPDATE and DELETE operations +** only. +** +** * INSERT statements may not use any default values. +** +** * UPDATE and DELETE statements must identify their target rows by +** non-NULL PRIMARY KEY values. Rows with NULL values stored in PRIMARY +** KEY fields may not be updated or deleted. If the table being written +** has no PRIMARY KEY, affected rows must be identified by rowid. +** +** * UPDATE statements may not modify PRIMARY KEY columns. +** +** * No triggers will be fired. +** +** * No foreign key violations are detected or reported. +** +** * CHECK constraints are not enforced. +** +** * No constraint handling mode except for "OR ROLLBACK" is supported. +** +** +** PREPARATION +** +** An "RBU update" is stored as a separate SQLite database. A database +** containing an RBU update is an "RBU database". For each table in the +** target database to be updated, the RBU database should contain a table +** named "data_" containing the same set of columns as the +** target table, and one more - "rbu_control". The data_% table should +** have no PRIMARY KEY or UNIQUE constraints, but each column should have +** the same type as the corresponding column in the target database. +** The "rbu_control" column should have no type at all. For example, if +** the target database contains: +** +** CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE); +** +** Then the RBU database should contain: +** +** CREATE TABLE data_t1(a INTEGER, b TEXT, c, rbu_control); +** +** The order of the columns in the data_% table does not matter. +** +** Instead of a regular table, the RBU database may also contain virtual +** tables or views named using the data_ naming scheme. +** +** Instead of the plain data_ naming scheme, RBU database tables +** may also be named data_, where is any sequence +** of zero or more numeric characters (0-9). This can be significant because +** tables within the RBU database are always processed in order sorted by +** name. By judicious selection of the portion of the names +** of the RBU tables the user can therefore control the order in which they +** are processed. This can be useful, for example, to ensure that "external +** content" FTS4 tables are updated before their underlying content tables. +** +** If the target database table is a virtual table or a table that has no +** PRIMARY KEY declaration, the data_% table must also contain a column +** named "rbu_rowid". This column is mapped to the table's implicit primary +** key column - "rowid". Virtual tables for which the "rowid" column does +** not function like a primary key value cannot be updated using RBU. For +** example, if the target db contains either of the following: +** +** CREATE VIRTUAL TABLE x1 USING fts3(a, b); +** CREATE TABLE x1(a, b) +** +** then the RBU database should contain: +** +** CREATE TABLE data_x1(a, b, rbu_rowid, rbu_control); +** +** All non-hidden columns (i.e. all columns matched by "SELECT *") of the +** target table must be present in the input table. For virtual tables, +** hidden columns are optional - they are updated by RBU if present in +** the input table, or not otherwise. For example, to write to an fts4 +** table with a hidden languageid column such as: +** +** CREATE VIRTUAL TABLE ft1 USING fts4(a, b, languageid='langid'); +** +** Either of the following input table schemas may be used: +** +** CREATE TABLE data_ft1(a, b, langid, rbu_rowid, rbu_control); +** CREATE TABLE data_ft1(a, b, rbu_rowid, rbu_control); +** +** For each row to INSERT into the target database as part of the RBU +** update, the corresponding data_% table should contain a single record +** with the "rbu_control" column set to contain integer value 0. The +** other columns should be set to the values that make up the new record +** to insert. +** +** If the target database table has an INTEGER PRIMARY KEY, it is not +** possible to insert a NULL value into the IPK column. Attempting to +** do so results in an SQLITE_MISMATCH error. +** +** For each row to DELETE from the target database as part of the RBU +** update, the corresponding data_% table should contain a single record +** with the "rbu_control" column set to contain integer value 1. The +** real primary key values of the row to delete should be stored in the +** corresponding columns of the data_% table. The values stored in the +** other columns are not used. +** +** For each row to UPDATE from the target database as part of the RBU +** update, the corresponding data_% table should contain a single record +** with the "rbu_control" column set to contain a value of type text. +** The real primary key values identifying the row to update should be +** stored in the corresponding columns of the data_% table row, as should +** the new values of all columns being update. The text value in the +** "rbu_control" column must contain the same number of characters as +** there are columns in the target database table, and must consist entirely +** of 'x' and '.' characters (or in some special cases 'd' - see below). For +** each column that is being updated, the corresponding character is set to +** 'x'. For those that remain as they are, the corresponding character of the +** rbu_control value should be set to '.'. For example, given the tables +** above, the update statement: +** +** UPDATE t1 SET c = 'usa' WHERE a = 4; +** +** is represented by the data_t1 row created by: +** +** INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..x'); +** +** Instead of an 'x' character, characters of the rbu_control value specified +** for UPDATEs may also be set to 'd'. In this case, instead of updating the +** target table with the value stored in the corresponding data_% column, the +** user-defined SQL function "rbu_delta()" is invoked and the result stored in +** the target table column. rbu_delta() is invoked with two arguments - the +** original value currently stored in the target table column and the +** value specified in the data_xxx table. +** +** For example, this row: +** +** INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..d'); +** +** is similar to an UPDATE statement such as: +** +** UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4; +** +** Finally, if an 'f' character appears in place of a 'd' or 's' in an +** ota_control string, the contents of the data_xxx table column is assumed +** to be a "fossil delta" - a patch to be applied to a blob value in the +** format used by the fossil source-code management system. In this case +** the existing value within the target database table must be of type BLOB. +** It is replaced by the result of applying the specified fossil delta to +** itself. +** +** If the target database table is a virtual table or a table with no PRIMARY +** KEY, the rbu_control value should not include a character corresponding +** to the rbu_rowid value. For example, this: +** +** INSERT INTO data_ft1(a, b, rbu_rowid, rbu_control) +** VALUES(NULL, 'usa', 12, '.x'); +** +** causes a result similar to: +** +** UPDATE ft1 SET b = 'usa' WHERE rowid = 12; +** +** The data_xxx tables themselves should have no PRIMARY KEY declarations. +** However, RBU is more efficient if reading the rows in from each data_xxx +** table in "rowid" order is roughly the same as reading them sorted by +** the PRIMARY KEY of the corresponding target database table. In other +** words, rows should be sorted using the destination table PRIMARY KEY +** fields before they are inserted into the data_xxx tables. +** +** USAGE +** +** The API declared below allows an application to apply an RBU update +** stored on disk to an existing target database. Essentially, the +** application: +** +** 1) Opens an RBU handle using the sqlite3rbu_open() function. +** +** 2) Registers any required virtual table modules with the database +** handle returned by sqlite3rbu_db(). Also, if required, register +** the rbu_delta() implementation. +** +** 3) Calls the sqlite3rbu_step() function one or more times on +** the new handle. Each call to sqlite3rbu_step() performs a single +** b-tree operation, so thousands of calls may be required to apply +** a complete update. +** +** 4) Calls sqlite3rbu_close() to close the RBU update handle. If +** sqlite3rbu_step() has been called enough times to completely +** apply the update to the target database, then the RBU database +** is marked as fully applied. Otherwise, the state of the RBU +** update application is saved in the RBU database for later +** resumption. +** +** See comments below for more detail on APIs. +** +** If an update is only partially applied to the target database by the +** time sqlite3rbu_close() is called, various state information is saved +** within the RBU database. This allows subsequent processes to automatically +** resume the RBU update from where it left off. +** +** To remove all RBU extension state information, returning an RBU database +** to its original contents, it is sufficient to drop all tables that begin +** with the prefix "rbu_" +** +** DATABASE LOCKING +** +** An RBU update may not be applied to a database in WAL mode. Attempting +** to do so is an error (SQLITE_ERROR). +** +** While an RBU handle is open, a SHARED lock may be held on the target +** database file. This means it is possible for other clients to read the +** database, but not to write it. +** +** If an RBU update is started and then suspended before it is completed, +** then an external client writes to the database, then attempting to resume +** the suspended RBU update is also an error (SQLITE_BUSY). + */ + +/* #include "sqlite3.h" ** Required for error code definitions ** */ + +type Tsqlite3rbu = struct { + FeStage int32 + FdbMain uintptr + FdbRbu uintptr + FzTarget uintptr + FzRbu uintptr + FzState uintptr + FzStateDb [5]int8 + Frc int32 + FzErrmsg uintptr + FnStep int32 + FnProgress int32 + Fobjiter TRbuObjIter + FzVfsName uintptr + FpTargetFd uintptr + FnPagePerSector int32 + FiOalSz Ti64 + FnPhaseOneStep Ti64 + FpRenameArg uintptr + FxRename uintptr + FiMaxFrame Tu32 + FmLock Tu32 + FnFrame int32 + FnFrameAlloc int32 + FaFrame uintptr + Fpgsz int32 + FaBuf uintptr + FiWalCksum Ti64 + FszTemp Ti64 + FszTempLimit Ti64 + FnRbu int32 + FpRbuFd uintptr +} + +type sqlite3rbu = Tsqlite3rbu + +/************** End of sqlite3rbu.h ******************************************/ +/************** Continuing where we left off in sqlite3rbu.c *****************/ + +/* Maximum number of prepared UPDATE statements held by this module */ + +/* Delta checksums disabled by default. Compile with -DRBU_ENABLE_DELTA_CKSUM +** to enable checksum verification. + */ + +/* +** Swap two objects of type TYPE. + */ + +/* +** Name of the URI option that causes RBU to take an exclusive lock as +** part of the incremental checkpoint operation. + */ + +/* +** The rbu_state table is used to save the state of a partially applied +** update so that it can be resumed later. The table consists of integer +** keys mapped to values as follows: +** +** RBU_STATE_STAGE: +** May be set to integer values 1, 2, 4 or 5. As follows: +** 1: the *-rbu file is currently under construction. +** 2: the *-rbu file has been constructed, but not yet moved +** to the *-wal path. +** 4: the checkpoint is underway. +** 5: the rbu update has been checkpointed. +** +** RBU_STATE_TBL: +** Only valid if STAGE==1. The target database name of the table +** currently being written. +** +** RBU_STATE_IDX: +** Only valid if STAGE==1. The target database name of the index +** currently being written, or NULL if the main table is currently being +** updated. +** +** RBU_STATE_ROW: +** Only valid if STAGE==1. Number of rows already processed for the current +** table/index. +** +** RBU_STATE_PROGRESS: +** Trbul number of sqlite3rbu_step() calls made so far as part of this +** rbu update. +** +** RBU_STATE_CKPT: +** Valid if STAGE==4. The 64-bit checksum associated with the wal-index +** header created by recovering the *-wal file. This is used to detect +** cases when another client appends frames to the *-wal file in the +** middle of an incremental checkpoint (an incremental checkpoint cannot +** be continued if this happens). +** +** RBU_STATE_COOKIE: +** Valid if STAGE==1. The current change-counter cookie value in the +** target db file. +** +** RBU_STATE_OALSZ: +** Valid if STAGE==1. The size in bytes of the *-oal file. +** +** RBU_STATE_DATATBL: +** Only valid if STAGE==1. The RBU database name of the table +** currently being read. + */ + +type TRbuFrame = struct { + FiDbPage Tu32 + FiWalFrame Tu32 +} + +type RbuFrame = TRbuFrame + +type TRbuObjIter = struct { + FpTblIter uintptr + FpIdxIter uintptr + FnTblCol int32 + FazTblCol uintptr + FazTblType uintptr + FaiSrcOrder uintptr + FabTblPk uintptr + FabNotNull uintptr + FabIndexed uintptr + FeType int32 + FbCleanup int32 + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiTnum int32 + FiPkTnum int32 + FbUnique int32 + FnIndex int32 + FnCol int32 + FpSelect uintptr + FpInsert uintptr + FpDelete uintptr + FpTmpInsert uintptr + FnIdxCol int32 + FaIdxCol uintptr + FzIdxSql uintptr + FpRbuUpdate uintptr +} + +type RbuObjIter = TRbuObjIter + +type TRbuState = struct { + FeStage int32 + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiWalCksum Ti64 + FnRow int32 + FnProgress Ti64 + FiCookie Tu32 + FiOalSz Ti64 + FnPhaseOneStep Ti64 +} + +type RbuState = TRbuState + +type TRbuSpan = struct { + FzSpan uintptr + FnSpan int32 +} + +type RbuSpan = TRbuSpan + +type Trbu_vfs = struct { + Fbase Tsqlite3_vfs + FpRealVfs uintptr + Fmutex uintptr + FpRbu uintptr + FpMain uintptr + FpMainRbu uintptr +} + +type rbu_vfs = Trbu_vfs + +type Trbu_file = struct { + Fbase Tsqlite3_file + FpReal uintptr + FpRbuVfs uintptr + FpRbu uintptr + Fsz Ti64 + FopenFlags int32 + FiCookie Tu32 + FiWriteVer Tu8 + FbNolock Tu8 + FnShm int32 + FapShm uintptr + FzDel uintptr + FzWal uintptr + FpWalFd uintptr + FpMainNext uintptr + FpMainRbuNext uintptr +} + +type rbu_file = Trbu_file + +type TRbuUpdateStmt = struct { + FzMask uintptr + FpUpdate uintptr + FpNext uintptr +} + +type RbuUpdateStmt = TRbuUpdateStmt + +/* +** These values must match the values defined in wal.c for the equivalent +** locks. These are not magic numbers as they are part of the SQLite file +** format. + */ + +/* +** A structure to store values read from the rbu_state table in memory. + */ +type TRbuState1 = struct { + FeStage int32 + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiWalCksum Ti64 + FnRow int32 + FnProgress Ti64 + FiCookie Tu32 + FiOalSz Ti64 + FnPhaseOneStep Ti64 +} + +type RbuState1 = TRbuState1 + +type TRbuUpdateStmt1 = struct { + FzMask uintptr + FpUpdate uintptr + FpNext uintptr +} + +type RbuUpdateStmt1 = TRbuUpdateStmt1 + +type TRbuSpan1 = struct { + FzSpan uintptr + FnSpan int32 +} + +type RbuSpan1 = TRbuSpan1 + +/* +** An iterator of this type is used to iterate through all objects in +** the target database that require updating. For each such table, the +** iterator visits, in order: +** +** * the table itself, +** * each index of the table (zero or more points to visit), and +** * a special "cleanup table" state. +** +** abIndexed: +** If the table has no indexes on it, abIndexed is set to NULL. Otherwise, +** it points to an array of flags nTblCol elements in size. The flag is +** set for each column that is either a part of the PK or a part of an +** index. Or clear otherwise. +** +** If there are one or more partial indexes on the table, all fields of +** this array set set to 1. This is because in that case, the module has +** no way to tell which fields will be required to add and remove entries +** from the partial indexes. +** + */ +type TRbuObjIter1 = struct { + FpTblIter uintptr + FpIdxIter uintptr + FnTblCol int32 + FazTblCol uintptr + FazTblType uintptr + FaiSrcOrder uintptr + FabTblPk uintptr + FabNotNull uintptr + FabIndexed uintptr + FeType int32 + FbCleanup int32 + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiTnum int32 + FiPkTnum int32 + FbUnique int32 + FnIndex int32 + FnCol int32 + FpSelect uintptr + FpInsert uintptr + FpDelete uintptr + FpTmpInsert uintptr + FnIdxCol int32 + FaIdxCol uintptr + FzIdxSql uintptr + FpRbuUpdate uintptr +} + +type RbuObjIter1 = TRbuObjIter1 + +/* +** Values for RbuObjIter.eType +** +** 0: Table does not exist (error) +** 1: Table has an implicit rowid. +** 2: Table has an explicit IPK column. +** 3: Table has an external PK index. +** 4: Table is WITHOUT ROWID. +** 5: Table is a virtual table. + */ + +/* +** Within the RBU_STAGE_OAL stage, each call to sqlite3rbu_step() performs +** one of the following operations. + */ + +/* +** A single step of an incremental checkpoint - frame iWalFrame of the wal +** file should be copied to page iDbPage of the database file. + */ +type TRbuFrame1 = struct { + FiDbPage Tu32 + FiWalFrame Tu32 +} + +type RbuFrame1 = TRbuFrame1 + +/* +** RBU handle. +** +** nPhaseOneStep: +** If the RBU database contains an rbu_count table, this value is set to +** a running estimate of the number of b-tree operations required to +** finish populating the *-oal file. This allows the sqlite3_bp_progress() +** API to calculate the permyriadage progress of populating the *-oal file +** using the formula: +** +** permyriadage = (10000 * nProgress) / nPhaseOneStep +** +** nPhaseOneStep is initialized to the sum of: +** +** nRow * (nIndex + 1) +** +** for all source tables in the RBU database, where nRow is the number +** of rows in the source table and nIndex the number of indexes on the +** corresponding target database table. +** +** This estimate is accurate if the RBU update consists entirely of +** INSERT operations. However, it is inaccurate if: +** +** * the RBU update contains any UPDATE operations. If the PK specified +** for an UPDATE operation does not exist in the target table, then +** no b-tree operations are required on index b-trees. Or if the +** specified PK does exist, then (nIndex*2) such operations are +** required (one delete and one insert on each index b-tree). +** +** * the RBU update contains any DELETE operations for which the specified +** PK does not exist. In this case no operations are required on index +** b-trees. +** +** * the RBU update contains REPLACE operations. These are similar to +** UPDATE operations. +** +** nPhaseOneStep is updated to account for the conditions above during the +** first pass of each source table. The updated nPhaseOneStep value is +** stored in the rbu_state table if the RBU update is suspended. + */ +type Tsqlite3rbu1 = struct { + FeStage int32 + FdbMain uintptr + FdbRbu uintptr + FzTarget uintptr + FzRbu uintptr + FzState uintptr + FzStateDb [5]int8 + Frc int32 + FzErrmsg uintptr + FnStep int32 + FnProgress int32 + Fobjiter TRbuObjIter + FzVfsName uintptr + FpTargetFd uintptr + FnPagePerSector int32 + FiOalSz Ti64 + FnPhaseOneStep Ti64 + FpRenameArg uintptr + FxRename uintptr + FiMaxFrame Tu32 + FmLock Tu32 + FnFrame int32 + FnFrameAlloc int32 + FaFrame uintptr + Fpgsz int32 + FaBuf uintptr + FiWalCksum Ti64 + FszTemp Ti64 + FszTempLimit Ti64 + FnRbu int32 + FpRbuFd uintptr +} + +type sqlite3rbu1 = Tsqlite3rbu1 + +/* +** An rbu VFS is implemented using an instance of this structure. +** +** Variable pRbu is only non-NULL for automatically created RBU VFS objects. +** It is NULL for RBU VFS objects created explicitly using +** sqlite3rbu_create_vfs(). It is used to track the total amount of temp +** space used by the RBU handle. + */ +type Trbu_vfs1 = struct { + Fbase Tsqlite3_vfs + FpRealVfs uintptr + Fmutex uintptr + FpRbu uintptr + FpMain uintptr + FpMainRbu uintptr +} + +type rbu_vfs1 = Trbu_vfs1 + +/* +** Each file opened by an rbu VFS is represented by an instance of +** the following structure. +** +** If this is a temporary file (pRbu!=0 && flags&DELETE_ON_CLOSE), variable +** "sz" is set to the current size of the database file. + */ +type Trbu_file1 = struct { + Fbase Tsqlite3_file + FpReal uintptr + FpRbuVfs uintptr + FpRbu uintptr + Fsz Ti64 + FopenFlags int32 + FiCookie Tu32 + FiWriteVer Tu8 + FbNolock Tu8 + FnShm int32 + FapShm uintptr + FzDel uintptr + FzWal uintptr + FpWalFd uintptr + FpMainNext uintptr + FpMainRbuNext uintptr +} + +type rbu_file1 = Trbu_file1 + +/* +** True for an RBU vacuum handle, or false otherwise. + */ + +/************************************************************************* +** The following three functions, found below: +** +** rbuDeltaGetInt() +** rbuDeltaChecksum() +** rbuDeltaApply() +** +** are lifted from the fossil source code (http://fossil-scm.org). They +** are used to implement the scalar SQL function rbu_fossil_delta(). + */ + +// C documentation +// +// /* +// ** Read bytes from *pz and convert them into a positive integer. When +// ** finished, leave *pz pointing to the first character past the end of +// ** the integer. The *pLen parameter holds the length of the string +// ** in *pz and is decremented once for each character in the integer. +// */ +func _rbuDeltaGetInt(tls *libc.TLS, pz uintptr, pLen uintptr) (r uint32) { + var c, v1 int32 + var v uint32 + var z, zStart, v2, p3 uintptr + _, _, _, _, _, _, _ = c, v, z, zStart, v1, v2, p3 + v = uint32(0) + z = *(*uintptr)(unsafe.Pointer(pz)) + zStart = z + for { + v2 = z + z++ + v1 = int32(_zValue[int32(0x7f)&int32(*(*uint8)(unsafe.Pointer(v2)))]) + c = v1 + if !(v1 >= 0) { + break + } + v = v< 0 { + cnt = _rbuDeltaGetInt(tls, bp, bp+8) + switch int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) { + case int32('@'): + *(*uintptr)(unsafe.Pointer(bp))++ + *(*int32)(unsafe.Pointer(bp + 8))-- + ofst = _rbuDeltaGetInt(tls, bp, bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) > 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32(',') { + /* ERROR: copy command not terminated by ',' */ + return -int32(1) + } + *(*uintptr)(unsafe.Pointer(bp))++ + *(*int32)(unsafe.Pointer(bp + 8))-- + total += cnt + if total > limit { + /* ERROR: copy exceeds output file size */ + return -int32(1) + } + if int32(ofst+cnt) > lenSrc { + /* ERROR: copy extends past end of input */ + return -int32(1) + } + libc.Xmemcpy(tls, zOut, zSrc+uintptr(ofst), uint64(cnt)) + zOut += uintptr(cnt) + case int32(':'): + *(*uintptr)(unsafe.Pointer(bp))++ + *(*int32)(unsafe.Pointer(bp + 8))-- + total += cnt + if total > limit { + /* ERROR: insert command gives an output larger than predicted */ + return -int32(1) + } + if int32(cnt) > *(*int32)(unsafe.Pointer(bp + 8)) { + /* ERROR: insert count exceeds size of delta */ + return -int32(1) + } + libc.Xmemcpy(tls, zOut, *(*uintptr)(unsafe.Pointer(bp)), uint64(cnt)) + zOut += uintptr(cnt) + *(*uintptr)(unsafe.Pointer(bp)) += uintptr(cnt) + *(*int32)(unsafe.Pointer(bp + 8)) = int32(uint32(*(*int32)(unsafe.Pointer(bp + 8))) - cnt) + case int32(';'): + *(*uintptr)(unsafe.Pointer(bp))++ + *(*int32)(unsafe.Pointer(bp + 8))-- + *(*int8)(unsafe.Pointer(zOut)) = 0 + if total != limit { + /* ERROR: generated size does not match predicted size */ + return -int32(1) + } + return int32(total) + default: + /* ERROR: unknown delta operator */ + return -int32(1) + } + } + /* ERROR: unterminated delta */ + return -int32(1) +} + +func _rbuDeltaOutputSize(tls *libc.TLS, _zDelta uintptr, _lenDelta int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + *(*uintptr)(unsafe.Pointer(bp)) = _zDelta + *(*int32)(unsafe.Pointer(bp + 8)) = _lenDelta + var size int32 + _ = size + size = int32(_rbuDeltaGetInt(tls, bp, bp+8)) + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\n') { + /* ERROR: size integer not terminated by "\n" */ + return -int32(1) + } + return size +} + +/* +** End of code taken from fossil. +*************************************************************************/ + +// C documentation +// +// /* +// ** Implementation of SQL scalar function rbu_fossil_delta(). +// ** +// ** This function applies a fossil delta patch to a blob. Exactly two +// ** arguments must be passed to this function. The first is the blob to +// ** patch and the second the patch to apply. If no error occurs, this +// ** function returns the patched blob. +// */ +func _rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { + var aDelta, aOrig, aOut uintptr + var nDelta, nOrig, nOut, nOut2 int32 + _, _, _, _, _, _, _ = aDelta, aOrig, aOut, nDelta, nOrig, nOut, nOut2 + nOrig = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + aOrig = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + nDelta = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + aDelta = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + /* Figure out the size of the output */ + nOut = _rbuDeltaOutputSize(tls, aDelta, nDelta) + if nOut < 0 { + Xsqlite3_result_error(tls, context, __ccgo_ts+28601, -int32(1)) + return + } + aOut = Xsqlite3_malloc(tls, nOut+int32(1)) + if aOut == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + } else { + nOut2 = _rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) + if nOut2 != nOut { + Xsqlite3_free(tls, aOut) + Xsqlite3_result_error(tls, context, __ccgo_ts+28601, -int32(1)) + } else { + Xsqlite3_result_blob(tls, context, aOut, nOut, __ccgo_fp(Xsqlite3_free)) + } + } +} + +// C documentation +// +// /* +// ** Prepare the SQL statement in buffer zSql against database handle db. +// ** If successful, set *ppStmt to point to the new statement and return +// ** SQLITE_OK. +// ** +// ** Otherwise, if an error does occur, set *ppStmt to NULL and return +// ** an SQLite error code. Additionally, set output variable *pzErrmsg to +// ** point to a buffer containing an error message. It is the responsibility +// ** of the caller to (eventually) free this buffer using sqlite3_free(). +// */ +func _prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + _ = rc + rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), ppStmt, uintptr(0)) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return rc +} + +// C documentation +// +// /* +// ** Reset the SQL statement passed as the first argument. Return a copy +// ** of the value returned by sqlite3_reset(). +// ** +// ** If an error has occurred, then set *pzErrmsg to point to a buffer +// ** containing an error message. It is the responsibility of the caller +// ** to eventually free this buffer using sqlite3_free(). +// */ +func _resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + _ = rc + rc = Xsqlite3_reset(tls, pStmt) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + } + return rc +} + +// C documentation +// +// /* +// ** Unless it is NULL, argument zSql points to a buffer allocated using +// ** sqlite3_malloc containing an SQL statement. This function prepares the SQL +// ** statement against database db and frees the buffer. If statement +// ** compilation is successful, *ppStmt is set to point to the new statement +// ** handle and SQLITE_OK is returned. +// ** +// ** Otherwise, if an error occurs, *ppStmt is set to NULL and an error code +// ** returned. In this case, *pzErrmsg may also be set to point to an error +// ** message. It is the responsibility of the caller to free this error message +// ** buffer using sqlite3_free(). +// ** +// ** If argument zSql is NULL, this function assumes that an OOM has occurred. +// ** In this case SQLITE_NOMEM is returned and *ppStmt set to NULL. +// */ +func _prepareFreeAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) (r int32) { + var rc int32 + _ = rc + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } else { + rc = _prepareAndCollectError(tls, db, ppStmt, pzErrmsg, zSql) + Xsqlite3_free(tls, zSql) + } + return rc +} + +// C documentation +// +// /* +// ** Free the RbuObjIter.azTblCol[] and RbuObjIter.abTblPk[] arrays allocated +// ** by an earlier call to rbuObjIterCacheTableInfo(). +// */ +func _rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol = 0 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType = 0 /* Invalid value */ +} + +// C documentation +// +// /* +// ** Finalize all statements and free all allocations that are specific to +// ** the current object (table/index pair). +// */ +func _rbuObjIterClearStatements(tls *libc.TLS, pIter uintptr) { + var pTmp, pUp uintptr + _, _ = pTmp, pUp + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpInsert) + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpDelete) + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTmpInsert) + pUp = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + for pUp != 0 { + pTmp = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate) + Xsqlite3_free(tls, pUp) + pUp = pTmp + } + Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol) + Xsqlite3_free(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpInsert = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpDelete = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTmpInsert = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = 0 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIdxCol = 0 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol = uintptr(0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql = uintptr(0) +} + +// C documentation +// +// /* +// ** Clean up any resources allocated as part of the iterator object passed +// ** as the only argument. +// */ +func _rbuObjIterFinalize(tls *libc.TLS, pIter uintptr) { + _rbuObjIterClearStatements(tls, pIter) + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTblIter) + Xsqlite3_finalize(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter) + _rbuObjIterFreeCols(tls, pIter) + libc.Xmemset(tls, pIter, 0, uint64(192)) +} + +// C documentation +// +// /* +// ** Advance the iterator to the next position. +// ** +// ** If no error occurs, SQLITE_OK is returned and the iterator is left +// ** pointing to the next entry. Otherwise, an error code and message is +// ** left in the RBU handle passed as the first argument. A copy of the +// ** error code is returned. +// */ +func _rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { + var pIdx uintptr + var rc, v1, v2 int32 + _, _, _, _ = pIdx, rc, v1, v2 + rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + if rc == SQLITE_OK { + /* Free any SQLite statements used while processing the previous object */ + _rbuObjIterClearStatements(tls, pIter) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+28622, uintptr(0), uintptr(0), p+64) + } + if rc == SQLITE_OK { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { + _rbuObjIterFreeCols(tls, pIter) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 0 + rc = Xsqlite3_step(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTblIter) + if rc != int32(SQLITE_ROW) { + rc = _resetAndCollectError(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, p+64) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl = uintptr(0) + } else { + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl = Xsqlite3_column_text(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, 0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl = Xsqlite3_column_text(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, int32(1)) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl != 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { + v1 = SQLITE_OK + } else { + v1 = int32(SQLITE_NOMEM) + } + rc = v1 + } + } else { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + pIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter + rc = Xsqlite3_bind_text(tls, pIdx, int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, -int32(1), libc.UintptrFromInt32(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter) + if rc != int32(SQLITE_ROW) { + rc = _resetAndCollectError(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, p+64) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx = uintptr(0) + } else { + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx = Xsqlite3_column_text(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, 0) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum = Xsqlite3_column_int(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, int32(1)) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique = Xsqlite3_column_int(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, int32(2)) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx != 0 { + v2 = SQLITE_OK + } else { + v2 = int32(SQLITE_NOMEM) + } + rc = v2 + } + } + } + } + } + if rc != SQLITE_OK { + _rbuObjIterFinalize(tls, pIter) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + return rc +} + +// C documentation +// +// /* +// ** The implementation of the rbu_target_name() SQL function. This function +// ** accepts one or two arguments. The first argument is the name of a table - +// ** the name of a table in the RBU database. The second, if it is present, is 1 +// ** for a view or 0 for a table. +// ** +// ** For a non-vacuum RBU handle, if the table name matches the pattern: +// ** +// ** data[0-9]_ +// ** +// ** where is any sequence of 1 or more characters, is returned. +// ** Otherwise, if the only argument does not match the above pattern, an SQL +// ** NULL is returned. +// ** +// ** "data_t1" -> "t1" +// ** "data0123_t2" -> "t2" +// ** "dataAB_t3" -> NULL +// ** +// ** For an rbu vacuum handle, a copy of the first argument is returned if +// ** the second argument is either missing or 0 (not a view). +// */ +func _rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { + var i int32 + var p, zIn uintptr + _, _, _ = i, p, zIn + p = Xsqlite3_user_data(tls, pCtx) + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn != 0 { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + if argc == int32(1) || 0 == Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) { + Xsqlite3_result_text(tls, pCtx, zIn, -int32(1), libc.UintptrFromInt32(0)) + } + } else { + if libc.Xstrlen(tls, zIn) > uint64(4) && libc.Xmemcmp(tls, __ccgo_ts+25773, zIn, uint64(4)) == 0 { + i = int32(4) + for { + if !(int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= int32('9')) { + break + } + goto _1 + _1: + ; + i++ + } + if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == int32('_') && *(*int8)(unsafe.Pointer(zIn + uintptr(i+int32(1)))) != 0 { + Xsqlite3_result_text(tls, pCtx, zIn+uintptr(i+int32(1)), -int32(1), libc.UintptrFromInt32(0)) + } + } + } + } +} + +// C documentation +// +// /* +// ** Initialize the iterator structure passed as the second argument. +// ** +// ** If no error occurs, SQLITE_OK is returned and the iterator is left +// ** pointing to the first entry. Otherwise, an error code and message is +// ** left in the RBU handle passed as the first argument. A copy of the +// ** error code is returned. +// */ +func _rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var v1 uintptr + _, _ = rc, v1 + libc.Xmemset(tls, pIter, 0, uint64(192)) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v1 = __ccgo_ts + 28793 + } else { + v1 = __ccgo_ts + 1680 + } + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+28834, libc.VaList(bp+8, v1))) + if rc == SQLITE_OK { + rc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+8, p+64, __ccgo_ts+28984) + } + (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = int32(1) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + return _rbuObjIterNext(tls, p, pIter) +} + +// C documentation +// +// /* +// ** This is a wrapper around "sqlite3_mprintf(zFmt, ...)". If an OOM occurs, +// ** an error code is stored in the RBU handle passed as the first argument. +// ** +// ** If an error has already occurred (p->rc is already set to something other +// ** than SQLITE_OK), then this function returns NULL without modifying the +// ** stored error code. In this case it still calls sqlite3_free() on any +// ** printf() parameters associated with %z conversions. +// */ +func _rbuMPrintf(tls *libc.TLS, p uintptr, zFmt uintptr, va uintptr) (r uintptr) { + var ap Tva_list + var zSql uintptr + _, _ = ap, zSql + zSql = uintptr(0) + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if zSql == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } + } else { + Xsqlite3_free(tls, zSql) + zSql = uintptr(0) + } + _ = ap + return zSql +} + +// C documentation +// +// /* +// ** Argument zFmt is a sqlite3_mprintf() style format string. The trailing +// ** arguments are the usual subsitution values. This function performs +// ** the printf() style substitutions and executes the result as an SQL +// ** statement on the RBU handles database. +// ** +// ** If an error occurs, an error code and error message is stored in the +// ** RBU handle. If an error has already occurred when this function is +// ** called, it is a no-op. +// */ +func _rbuMPrintfExec(tls *libc.TLS, p uintptr, db uintptr, zFmt uintptr, va uintptr) (r int32) { + var ap Tva_list + var zSql uintptr + _, _ = ap, zSql + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if zSql == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), p+64) + } + } + Xsqlite3_free(tls, zSql) + _ = ap + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// C documentation +// +// /* +// ** Attempt to allocate and return a pointer to a zeroed block of nByte +// ** bytes. +// ** +// ** If an error (i.e. an OOM condition) occurs, return NULL and leave an +// ** error code in the rbu handle passed as the first argument. Or, if an +// ** error has already occurred when this function is called, return NULL +// ** immediately without attempting the allocation or modifying the stored +// ** error code. +// */ +func _rbuMalloc(tls *libc.TLS, p uintptr, nByte Tsqlite3_int64) (r uintptr) { + var pRet uintptr + _ = pRet + pRet = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pRet, 0, uint64(nByte)) + } + } + return pRet +} + +// C documentation +// +// /* +// ** Allocate and zero the pIter->azTblCol[] and abTblPk[] arrays so that +// ** there is room for at least nCol elements. If an OOM occurs, store an +// ** error code in the RBU handle passed as the first argument. +// */ +func _rbuAllocateIterArrays(tls *libc.TLS, p uintptr, pIter uintptr, nCol int32) { + var azNew uintptr + var nByte Tsqlite3_int64 + _, _ = azNew, nByte + nByte = int64((libc.Uint64FromInt32(2)*libc.Uint64FromInt64(8) + libc.Uint64FromInt64(4) + libc.Uint64FromInt32(3)*libc.Uint64FromInt64(1)) * uint64(nCol)) + azNew = _rbuMalloc(tls, p, nByte) + if azNew != 0 { + (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol = azNew + (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType = azNew + uintptr(nCol)*8 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder = (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(nCol)*8 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk = (*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(nCol)*4 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull = (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(nCol) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed = (*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(nCol) + } +} + +// C documentation +// +// /* +// ** The first argument must be a nul-terminated string. This function +// ** returns a copy of the string in memory obtained from sqlite3_malloc(). +// ** It is the responsibility of the caller to eventually free this memory +// ** using sqlite3_free(). +// ** +// ** If an OOM condition is encountered when attempting to allocate memory, +// ** output variable (*pRc) is set to SQLITE_NOMEM before returning. Otherwise, +// ** if the allocation succeeds, (*pRc) is left unchanged. +// */ +func _rbuStrndup(tls *libc.TLS, zStr uintptr, pRc uintptr) (r uintptr) { + var nCopy Tsize_t + var zRet uintptr + _, _ = nCopy, zRet + zRet = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + if zStr != 0 { + nCopy = libc.Xstrlen(tls, zStr) + uint64(1) + zRet = Xsqlite3_malloc64(tls, nCopy) + if zRet != 0 { + libc.Xmemcpy(tls, zRet, zStr, nCopy) + } else { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } + } + return zRet +} + +// C documentation +// +// /* +// ** Finalize the statement passed as the second argument. +// ** +// ** If the sqlite3_finalize() call indicates that an error occurs, and the +// ** rbu handle error code is not already set, set the error code and error +// ** message accordingly. +// */ +func _rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db uintptr + var rc int32 + _, _ = db, rc + db = Xsqlite3_db_handle(tls, pStmt) + rc = Xsqlite3_finalize(tls, pStmt) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && rc != SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + } +} + +// C documentation +// +// /* Determine the type of a table. +// ** +// ** peType is of type (int*), a pointer to an output parameter of type +// ** (int). This call sets the output parameter as follows, depending +// ** on the type of the table specified by parameters dbName and zTbl. +// ** +// ** RBU_PK_NOTABLE: No such table. +// ** RBU_PK_NONE: Table has an implicit rowid. +// ** RBU_PK_IPK: Table has an explicit IPK column. +// ** RBU_PK_EXTERNAL: Table has an external PK index. +// ** RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID. +// ** RBU_PK_VTAB: Table is a virtual table. +// ** +// ** Argument *piPk is also of type (int*), and also points to an output +// ** parameter. Unless the table has an external primary key index +// ** (i.e. unless *peType is set to 3), then *piPk is set to zero. Or, +// ** if the table does have an external primary key index, then *piPk +// ** is set to the root page number of the primary key index before +// ** returning. +// ** +// ** ALGORITHM: +// ** +// ** if( no entry exists in sqlite_schema ){ +// ** return RBU_PK_NOTABLE +// ** }else if( sql for the entry starts with "CREATE VIRTUAL" ){ +// ** return RBU_PK_VTAB +// ** }else if( "PRAGMA index_list()" for the table contains a "pk" index ){ +// ** if( the index that is the pk exists in sqlite_schema ){ +// ** *piPK = rootpage of that index. +// ** return RBU_PK_EXTERNAL +// ** }else{ +// ** return RBU_PK_WITHOUT_ROWID +// ** } +// ** }else if( "PRAGMA table_info()" lists one or more "pk" columns ){ +// ** return RBU_PK_IPK +// ** }else{ +// ** return RBU_PK_NONE +// ** } +// */ +func _rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum uintptr, piPk uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i uint32 + var zIdx, zOrig uintptr + var _ /* aStmt at bp+0 */ [4]uintptr + _, _, _ = i, zIdx, zOrig + /* + ** 0) SELECT count(*) FROM sqlite_schema where name=%Q AND IsVirtual(%Q) + ** 1) PRAGMA index_list = ? + ** 2) SELECT count(*) FROM sqlite_schema where name=%Q + ** 3) PRAGMA table_info = ? + */ + *(*[4]uintptr)(unsafe.Pointer(bp)) = [4]uintptr{} + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE + *(*int32)(unsafe.Pointer(piPk)) = 0 + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29109, libc.VaList(bp+40, zTab))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0]) != int32(SQLITE_ROW) { + /* Either an error, or no such table. */ + goto rbuTableType_end + } + if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], 0) != 0 { + *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_VTAB) /* virtual table */ + goto rbuTableType_end + } + *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[0], int32(1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+1*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29228, libc.VaList(bp+40, zTab))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + goto rbuTableType_end + } + for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)]) == int32(SQLITE_ROW) { + zOrig = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(3)) + zIdx = Xsqlite3_column_text(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(1)], int32(1)) + if zOrig != 0 && zIdx != 0 && int32(*(*Tu8)(unsafe.Pointer(zOrig))) == int32('p') { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+2*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29249, libc.VaList(bp+40, zIdx))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)]) == int32(SQLITE_ROW) { + *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(2)], 0) + *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_EXTERNAL) + } else { + *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_WITHOUT_ROWID) + } + } + goto rbuTableType_end + } + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+3*8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29300, libc.VaList(bp+40, zTab))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + for Xsqlite3_step(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)]) == int32(SQLITE_ROW) { + if Xsqlite3_column_int(tls, (*(*[4]uintptr)(unsafe.Pointer(bp)))[int32(3)], int32(5)) > 0 { + *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_IPK) /* explicit IPK column */ + goto rbuTableType_end + } + } + *(*int32)(unsafe.Pointer(peType)) = int32(RBU_PK_NONE) + } +rbuTableType_end: + ; + i = uint32(0) + for { + if !(uint64(i) < libc.Uint64FromInt64(32)/libc.Uint64FromInt64(8)) { + break + } + _rbuFinalize(tls, p, (*(*[4]uintptr)(unsafe.Pointer(bp)))[i]) + goto _1 + _1: + ; + i++ + } +} + +// C documentation +// +// /* +// ** This is a helper function for rbuObjIterCacheTableInfo(). It populates +// ** the pIter->abIndexed[] array. +// */ +func _rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bIndex, bPartial, iCid int32 + var zIdx uintptr + var _ /* pList at bp+0 */ uintptr + var _ /* pXInfo at bp+8 */ uintptr + _, _, _, _ = bIndex, bPartial, iCid, zIdx + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + bIndex = 0 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + libc.Xmemcpy(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + } + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + bPartial = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + if zIdx == uintptr(0) { + break + } + if bPartial != 0 { + libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29349, libc.VaList(bp+24, zIdx))) + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) + if iCid >= 0 { + *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(iCid))) = uint8(1) + } + if iCid == -int32(2) { + libc.Xmemset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, int32(0x01), uint64(1)*uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + } + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) + bIndex = int32(1) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex++ + } + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { + /* "PRAGMA index_list" includes the main PK b-tree */ + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIndex-- + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + if bIndex == 0 { + (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed = uintptr(0) + } +} + +// C documentation +// +// /* +// ** If they are not already populated, populate the pIter->azTblCol[], +// ** pIter->abTblPk[], pIter->nTblCol and pIter->bRowid variables according to +// ** the table (not index) that the iterator currently points to. +// ** +// ** Return SQLITE_OK if successful, or an SQLite error code otherwise. If +// ** an error does occur, an error code and error message are also left in +// ** the RBU handle. +// */ +func _rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bNotNull, bRbuRowid, i, iOrder, iPk, nCol, t, v2 int32 + var t1, zCopy, zName, zName1, zType, v3, v4 uintptr + var _ /* iTnum at bp+8 */ int32 + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bNotNull, bRbuRowid, i, iOrder, iPk, nCol, t, t1, zCopy, zName, zName1, zType, v2, v3, v4 + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + nCol = 0 /* for() loop iterator variable */ + bRbuRowid = 0 /* If input table has column "rbu_rowid" */ + iOrder = 0 + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + /* Figure out the type of table this step will deal with. */ + _rbuTableType(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, pIter+72, bp+8, pIter+108) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+19936, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + } + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum = *(*int32)(unsafe.Pointer(bp + 8)) + } + /* Populate the azTblCol[] and nTblCol variables based on the columns + ** of the input table. Ignore any input table columns that begin with + ** "rbu_". */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29378, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp))) + _rbuAllocateIterArrays(tls, p, pIter, nCol) + } + i = 0 + for { + if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && i < nCol) { + break + } + zName = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp)), i) + if Xsqlite3_strnicmp(tls, __ccgo_ts+29397, zName, int32(4)) != 0 { + zCopy = _rbuStrndup(tls, zName, p+56) + *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + v3 = pIter + 16 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(v2)*8)) = zCopy + } else { + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+29402, zName) { + bRbuRowid = int32(1) + } + } + goto _1 + _1: + ; + i++ + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && bRbuRowid != libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + if bRbuRowid != 0 { + v4 = __ccgo_ts + 29412 + } else { + v4 = __ccgo_ts + 29425 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29434, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v4)) + } + /* Check that all non-HIDDEN columns in the destination table are also + ** present in the input table. Populate the abTblPk[], azTblType[] and + ** aiTblOrder[] arrays at the same time. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29463, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + } + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zName1 = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + if zName1 == uintptr(0) { + break + } /* An OOM - finalize() below returns S_NOMEM */ + i = iOrder + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + if 0 == libc.Xstrcmp(tls, zName1, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8))) { + break + } + goto _5 + _5: + ; + i++ + } + if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+29485, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName1)) + } else { + iPk = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) + bNotNull = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) + zType = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(2)) + if i != iOrder { + t = *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4)) + *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4)) = *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(iOrder)*4)) + *(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(iOrder)*4)) = t + t1 = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iOrder)*8)) + *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iOrder)*8)) = t1 + } + *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iOrder)*8)) = _rbuStrndup(tls, zType, p+56) + *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iOrder))) = uint8(iPk) + *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iOrder))) = libc.BoolUint8(uint8(bNotNull) != 0 || iPk != 0) + iOrder++ + } + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + _rbuObjIterCacheIndexedCols(tls, p, pIter) + } + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// C documentation +// +// /* +// ** This function constructs and returns a pointer to a nul-terminated +// ** string containing some SQL clause or list based on one or more of the +// ** column names currently stored in the pIter->azTblCol[] array. +// */ +func _rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var z, zList, zSep uintptr + _, _, _, _ = i, z, zList, zSep + zList = uintptr(0) + zSep = __ccgo_ts + 1680 + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + z = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+29512, libc.VaList(bp+8, zList, zSep, z)) + zSep = __ccgo_ts + 15022 + goto _1 + _1: + ; + i++ + } + return zList +} + +// C documentation +// +// /* +// ** Return a comma separated list of the quoted PRIMARY KEY column names, +// ** in order, for the current table. Before each column name, add the text +// ** zPre. After each column name, add the zPost text. Use zSeparator as +// ** the separator text (usually ", "). +// */ +func _rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, zSeparator uintptr, zPost uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, iPk int32 + var zCol, zRet, zSep uintptr + _, _, _, _, _ = i, iPk, zCol, zRet, zSep + iPk = int32(1) + zRet = uintptr(0) + zSep = __ccgo_ts + 1680 + for int32(1) != 0 { + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + if int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29521, libc.VaList(bp+8, zRet, zSep, zPre, zCol, zPost)) + zSep = zSeparator + break + } + goto _1 + _1: + ; + i++ + } + if i == (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + break + } + iPk++ + } + return zRet +} + +// C documentation +// +// /* +// ** This function is called as part of restarting an RBU vacuum within +// ** stage 1 of the process (while the *-oal file is being built) while +// ** updating a table (not an index). The table may be a rowid table or +// ** a WITHOUT ROWID table. It queries the target database to find the +// ** largest key that has already been written to the target table and +// ** constructs a WHERE clause that can be used to extract the remaining +// ** rows from the source table. For a rowid table, the WHERE clause +// ** is of the form: +// ** +// ** "WHERE _rowid_ > ?" +// ** +// ** and for WITHOUT ROWID tables: +// ** +// ** "WHERE (key1, key2) > (?, ?)" +// ** +// ** Instead of "?" placeholders, the actual WHERE clauses created by +// ** this function contain literal SQL values. +// */ +func _rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, zWrite uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iMax Tsqlite3_int64 + var zList, zOrder, zRet, zSelect, zVal uintptr + var _ /* pMax at bp+0 */ uintptr + _, _, _, _, _, _ = iMax, zList, zOrder, zRet, zSelect, zVal + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + zRet = uintptr(0) + if bRowid != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29534, libc.VaList(bp+16, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + iMax = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29566, libc.VaList(bp+16, iMax)) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + } else { + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1680, __ccgo_ts+15022, __ccgo_ts+29589) + zSelect = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+29595, __ccgo_ts+29602, __ccgo_ts+5138) + zList = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1680, __ccgo_ts+15022, __ccgo_ts+1680) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29610, libc.VaList(bp+16, zSelect, zWrite, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zVal = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29652, libc.VaList(bp+16, zList, zVal)) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + } + Xsqlite3_free(tls, zOrder) + Xsqlite3_free(tls, zSelect) + Xsqlite3_free(tls, zList) + } + return zRet +} + +// C documentation +// +// /* +// ** This function is called as part of restating an RBU vacuum when the +// ** current operation is writing content to an index. If possible, it +// ** queries the target index b-tree for the largest key already written to +// ** it, then composes and returns an expression that can be used in a WHERE +// ** clause to select the remaining required rows from the source table. +// ** It is only possible to return such an expression if: +// ** +// ** * The index contains no DESC columns, and +// ** * The last key written to the index before the operation was +// ** suspended does not contain any NULL values. +// ** +// ** The expression is of the form: +// ** +// ** (index-field1, index-field2, ...) > (?, ?, ...) +// ** +// ** except that the "?" placeholders are replaced with literal values. +// ** +// ** If the expression cannot be created, NULL is returned. In this case, +// ** the caller has to use an OFFSET clause to extract only the required +// ** rows from the sourct table, just as it does for an RBU update operation. +// */ +func _rbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var bFailed, i, iCid, iCol int32 + var zCol, zCollate, zLhs, zOrder, zQuoted, zRet, zSelect, zSep, zVector uintptr + var _ /* pSel at bp+8 */ uintptr + var _ /* pXInfo at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _ = bFailed, i, iCid, iCol, zCol, zCollate, zLhs, zOrder, zQuoted, zRet, zSelect, zSep, zVector + zOrder = uintptr(0) + zLhs = uintptr(0) + zSelect = uintptr(0) + zVector = uintptr(0) + zRet = uintptr(0) + bFailed = 0 + zSep = __ccgo_ts + 1680 + iCol = 0 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29349, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) != 0 { + bFailed = int32(1) + break + } + if iCid < 0 { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) { + i = 0 + for { + if !(int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0) { + break + } + goto _1 + _1: + ; + i++ + } + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + } else { + zCol = __ccgo_ts + 29672 + } + } else { + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) + } + zLhs = _rbuMPrintf(tls, p, __ccgo_ts+29680, libc.VaList(bp+24, zLhs, zSep, zCol, zCollate)) + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29701, libc.VaList(bp+24, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = _rbuMPrintf(tls, p, __ccgo_ts+29737, libc.VaList(bp+24, zSelect, zSep, iCol, zCol)) + zSep = __ccgo_ts + 15022 + iCol++ + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + if bFailed != 0 { + goto index_start_out + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29764, libc.VaList(bp+24, zSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + zSep = __ccgo_ts + 1680 + iCol = 0 + for { + if !(iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol) { + break + } + zQuoted = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), iCol) + if zQuoted == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + if int32(*(*int8)(unsafe.Pointer(zQuoted))) == int32('N') { + bFailed = int32(1) + break + } + } + zVector = _rbuMPrintf(tls, p, __ccgo_ts+29812, libc.VaList(bp+24, zVector, zSep, zQuoted)) + zSep = __ccgo_ts + 15022 + goto _2 + _2: + ; + iCol++ + } + if !(bFailed != 0) { + zRet = _rbuMPrintf(tls, p, __ccgo_ts+29819, libc.VaList(bp+24, zLhs, zVector)) + } + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) + } +index_start_out: + ; + Xsqlite3_free(tls, zOrder) + Xsqlite3_free(tls, zSelect) + Xsqlite3_free(tls, zVector) + Xsqlite3_free(tls, zLhs) + return zRet +} + +// C documentation +// +// /* +// ** This function is used to create a SELECT list (the list of SQL +// ** expressions that follows a SELECT keyword) for a SELECT statement +// ** used to read from an data_xxx or rbu_tmp_xxx table while updating the +// ** index object currently indicated by the iterator object passed as the +// ** second argument. A "PRAGMA index_xinfo = " statement is used +// ** to obtain the required information. +// ** +// ** If the index is of the following form: +// ** +// ** CREATE INDEX i1 ON t1(c, b COLLATE nocase); +// ** +// ** and "t1" is a table with an explicit INTEGER PRIMARY KEY column +// ** "ipk", the returned string is: +// ** +// ** "`c` COLLATE 'BINARY', `b` COLLATE 'NOCASE', `ipk` COLLATE 'BINARY'" +// ** +// ** As well as the returned string, three other malloc'd strings are +// ** returned via output parameters. As follows: +// ** +// ** pzImposterCols: ... +// ** pzImposterPk: ... +// ** pzWhere: ... +// */ +func _rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterCols uintptr, pzImposterPk uintptr, pzWhere uintptr, pnBind uintptr) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var bDesc, i, iCid, iSeq, nBind, rc, rc2 int32 + var zAnd, zCol, zCollate, zCom, zImpCols, zImpPK, zOrder, zRet, zType, zWhere, v2 uintptr + var _ /* pXInfo at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bDesc, i, iCid, iSeq, nBind, rc, rc2, zAnd, zCol, zCollate, zCom, zImpCols, zImpPK, zOrder, zRet, zType, zWhere, v2 + rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc /* sqlite3_finalize() return code */ + zRet = uintptr(0) /* String to return */ + zImpCols = uintptr(0) /* String to return via *pzImposterCols */ + zImpPK = uintptr(0) /* String to return via *pzImposterPK */ + zWhere = uintptr(0) /* String to return via *pzWhere */ + nBind = 0 /* Value to return via *pnBind */ + zCom = __ccgo_ts + 1680 /* Set to ", " later on */ + zAnd = __ccgo_ts + 1680 /* Set to " AND " later on */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_xinfo = ? */ + if rc == SQLITE_OK { + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29349, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + } + for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) + zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + zCol = uintptr(0) + if iCid == -int32(2) { + iSeq = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29831, libc.VaList(bp+16, zRet, zCom, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FnSpan, (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iSeq)*16))).FzSpan, zCollate)) + zType = __ccgo_ts + 1680 + } else { + if iCid < 0 { + /* An integer primary key. If the table has an explicit IPK, use + ** its name. Otherwise, use "rbu_rowid". */ + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) { + i = 0 + for { + if !(int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0) { + break + } + goto _1 + _1: + ; + i++ + } + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + zCol = __ccgo_ts + 29672 + } else { + zCol = __ccgo_ts + 29402 + } + } + zType = __ccgo_ts + 1168 + } else { + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) + zType = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) + } + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+29853, libc.VaList(bp+16, zRet, zCom, zCol, zCollate)) + } + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0 || Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { + if bDesc != 0 { + v2 = __ccgo_ts + 29589 + } else { + v2 = __ccgo_ts + 1680 + } + zOrder = v2 + zImpPK = Xsqlite3_mprintf(tls, __ccgo_ts+29873, libc.VaList(bp+16, zImpPK, zCom, nBind, zCol, zOrder)) + } + zImpCols = Xsqlite3_mprintf(tls, __ccgo_ts+29894, libc.VaList(bp+16, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, __ccgo_ts+29927, libc.VaList(bp+16, zWhere, zAnd, nBind, zCol)) + if zRet == uintptr(0) || zImpPK == uintptr(0) || zImpCols == uintptr(0) || zWhere == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + zCom = __ccgo_ts + 15022 + zAnd = __ccgo_ts + 22045 + nBind++ + } + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + rc = rc2 + } + if rc != SQLITE_OK { + Xsqlite3_free(tls, zRet) + Xsqlite3_free(tls, zImpCols) + Xsqlite3_free(tls, zImpPK) + Xsqlite3_free(tls, zWhere) + zRet = uintptr(0) + zImpCols = uintptr(0) + zImpPK = uintptr(0) + zWhere = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + *(*uintptr)(unsafe.Pointer(pzImposterCols)) = zImpCols + *(*uintptr)(unsafe.Pointer(pzImposterPk)) = zImpPK + *(*uintptr)(unsafe.Pointer(pzWhere)) = zWhere + *(*int32)(unsafe.Pointer(pnBind)) = nBind + return zRet +} + +// C documentation +// +// /* +// ** Assuming the current table columns are "a", "b" and "c", and the zObj +// ** paramter is passed "old", return a string of the form: +// ** +// ** "old.a, old.b, old.b" +// ** +// ** With the column names escaped. +// ** +// ** For tables with implicit rowids - RBU_PK_EXTERNAL and RBU_PK_NONE, append +// ** the text ", old._rowid_" to the returned value. +// */ +func _rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i int32 + var zCol, zList, zS uintptr + _, _, _, _ = i, zCol, zList, zS + zList = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { + zS = __ccgo_ts + 1680 + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29951, libc.VaList(bp+8, zList, zS, zObj, zCol)) + } else { + zList = Xsqlite3_mprintf(tls, __ccgo_ts+29963, libc.VaList(bp+8, zList, zS)) + } + zS = __ccgo_ts + 15022 + if zList == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + break + } + goto _1 + _1: + ; + i++ + } + /* For a table with implicit rowids, append "old._rowid_" to the list. */ + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { + zList = _rbuMPrintf(tls, p, __ccgo_ts+29972, libc.VaList(bp+8, zList, zObj)) + } + } + return zList +} + +// C documentation +// +// /* +// ** Return an expression that can be used in a WHERE clause to match the +// ** primary key of the current table. For example, if the table is: +// ** +// ** CREATE TABLE t1(a, b, c, PRIMARY KEY(b, c)); +// ** +// ** Return the string: +// ** +// ** "b = ?1 AND c = ?2" +// */ +func _rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, i1 int32 + var zCol, zList, zSep, zSep1 uintptr + _, _, _, _, _, _ = i, i1, zCol, zList, zSep, zSep1 + zList = uintptr(0) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { + zList = _rbuMPrintf(tls, p, __ccgo_ts+29987, libc.VaList(bp+8, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1))) + } else { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { + zSep = __ccgo_ts + 1680 + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { + zList = _rbuMPrintf(tls, p, __ccgo_ts+30001, libc.VaList(bp+8, zList, zSep, i, i+int32(1))) + zSep = __ccgo_ts + 22045 + } + goto _1 + _1: + ; + i++ + } + zList = _rbuMPrintf(tls, p, __ccgo_ts+30013, libc.VaList(bp+8, zList)) + } else { + zSep1 = __ccgo_ts + 1680 + i1 = 0 + for { + if !(i1 < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i1))) != 0 { + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i1)*8)) + zList = _rbuMPrintf(tls, p, __ccgo_ts+30063, libc.VaList(bp+8, zList, zSep1, zCol, i1+int32(1))) + zSep1 = __ccgo_ts + 22045 + } + goto _2 + _2: + ; + i1++ + } + } + } + return zList +} + +// C documentation +// +// /* +// ** The SELECT statement iterating through the keys for the current object +// ** (p->objiter.pSelect) currently points to a valid row. However, there +// ** is something wrong with the rbu_control value in the rbu_control value +// ** stored in the (p->nCol+1)'th column. Set the error code and error message +// ** of the RBU handle to something reflecting this. +// */ +func _rbuBadControlError(tls *libc.TLS, p uintptr) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+30076, 0) +} + +// C documentation +// +// /* +// ** Return a nul-terminated string containing the comma separated list of +// ** assignments that should be included following the "SET" keyword of +// ** an UPDATE statement used to update the table object that the iterator +// ** passed as the second argument currently points to if the rbu_control +// ** column of the data_xxx table entry is set to zMask. +// ** +// ** The memory for the returned string is obtained from sqlite3_malloc(). +// ** It is the responsibility of the caller to eventually free it using +// ** sqlite3_free(). +// ** +// ** If an OOM error is encountered when allocating space for the new +// ** string, an error code is left in the rbu handle passed as the first +// ** argument and NULL is returned. Or, if an error has already occurred +// ** when this function is called, NULL is returned immediately, without +// ** attempting the allocation or modifying the stored error code. +// */ +func _rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var c int8 + var i int32 + var zList, zSep uintptr + _, _, _, _ = c, i, zList, zSep + zList = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if int32(libc.Xstrlen(tls, zMask)) != (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + _rbuBadControlError(tls, p) + } else { + zSep = __ccgo_ts + 1680 + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + c = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) + if int32(c) == int32('x') { + zList = _rbuMPrintf(tls, p, __ccgo_ts+30063, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15022 + } else { + if int32(c) == int32('d') { + zList = _rbuMPrintf(tls, p, __ccgo_ts+30102, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15022 + } else { + if int32(c) == int32('f') { + zList = _rbuMPrintf(tls, p, __ccgo_ts+30132, libc.VaList(bp+8, zList, zSep, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), i+int32(1))) + zSep = __ccgo_ts + 15022 + } + } + } + goto _1 + _1: + ; + i++ + } + } + } + return zList +} + +// C documentation +// +// /* +// ** Return a nul-terminated string consisting of nByte comma separated +// ** "?" expressions. For example, if nByte is 3, return a pointer to +// ** a buffer containing the string "?,?,?". +// ** +// ** The memory for the returned string is obtained from sqlite3_malloc(). +// ** It is the responsibility of the caller to eventually free it using +// ** sqlite3_free(). +// ** +// ** If an OOM error is encountered when allocating space for the new +// ** string, an error code is left in the rbu handle passed as the first +// ** argument and NULL is returned. Or, if an error has already occurred +// ** when this function is called, NULL is returned immediately, without +// ** attempting the allocation or modifying the stored error code. +// */ +func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { + var i, v2 int32 + var nByte Tsqlite3_int64 + var zRet uintptr + _, _, _, _ = i, nByte, zRet, v2 + zRet = uintptr(0) + nByte = int64(2)*int64(nBind) + int64(1) + zRet = _rbuMalloc(tls, p, nByte) + if zRet != 0 { + i = 0 + for { + if !(i < nBind) { + break + } + *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)))) = int8('?') + if i+int32(1) == nBind { + v2 = int32('\000') + } else { + v2 = int32(',') + } + *(*int8)(unsafe.Pointer(zRet + uintptr(i*int32(2)+int32(1)))) = int8(v2) + goto _1 + _1: + ; + i++ + } + } + return zRet +} + +// C documentation +// +// /* +// ** The iterator currently points to a table (not index) of type +// ** RBU_PK_WITHOUT_ROWID. This function creates the PRIMARY KEY +// ** declaration for the corresponding imposter table. For example, +// ** if the iterator points to a table created as: +// ** +// ** CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID +// ** +// ** this function returns: +// ** +// ** PRIMARY KEY("b", "a" DESC) +// */ +func _rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var z, zCol, zDesc, zIdx, zOrig, zSep, v1 uintptr + var _ /* pXInfo at bp+8 */ uintptr + var _ /* pXList at bp+0 */ uintptr + _, _, _, _, _, _, _ = z, zCol, zDesc, zIdx, zOrig, zSep, v1 + z = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + zSep = __ccgo_ts + 30169 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* PRAGMA index_list = (pIter->zTbl) */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA index_xinfo = */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29321, libc.VaList(bp+24, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(3)) + if zOrig != 0 && libc.Xstrcmp(tls, zOrig, __ccgo_ts+16614) == 0 { + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + if zIdx != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29349, libc.VaList(bp+24, zIdx))) + } + break + } + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(5)) != 0 { + /* int iCid = sqlite3_column_int(pXInfo, 0); */ + zCol = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(2)) + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) != 0 { + v1 = __ccgo_ts + 29589 + } else { + v1 = __ccgo_ts + 1680 + } + zDesc = v1 + z = _rbuMPrintf(tls, p, __ccgo_ts+30182, libc.VaList(bp+24, z, zSep, zCol, zDesc)) + zSep = __ccgo_ts + 15022 + } + } + z = _rbuMPrintf(tls, p, __ccgo_ts+30193, libc.VaList(bp+24, z)) + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + return z +} + +// C documentation +// +// /* +// ** This function creates the second imposter table used when writing to +// ** a table b-tree where the table has an external primary key. If the +// ** iterator passed as the second argument does not currently point to +// ** a table (not index) with an external primary key, this function is a +// ** no-op. +// ** +// ** Assuming the iterator does point to a table with an external PK, this +// ** function creates a WITHOUT ROWID imposter table named "rbu_imposter2" +// ** used to access that PK index. For example, if the target table is +// ** declared as follows: +// ** +// ** CREATE TABLE t1(a, b TEXT, c REAL, PRIMARY KEY(b, c)); +// ** +// ** then the imposter table schema is: +// ** +// ** CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID; +// ** +// */ +func _rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var bDesc, bKey, iCid, tnum int32 + var zCollate, zCols, zComma, zIdx, zPk, v1 uintptr + var _ /* pQuery at bp+0 */ uintptr + var _ /* pXInfo at bp+8 */ uintptr + _, _, _, _, _, _, _, _, _, _ = bDesc, bKey, iCid, tnum, zCollate, zCols, zComma, zIdx, zPk, v1 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { + tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiPkTnum /* Root page of PK index */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* SELECT name ... WHERE rootpage = $tnum */ + zIdx = uintptr(0) /* Name of PK index */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* PRAGMA main.index_xinfo = $zIdx */ + zComma = __ccgo_ts + 1680 + zCols = uintptr(0) /* Used to build up list of table cols */ + zPk = uintptr(0) /* Used to build up table PK declaration */ + /* Figure out the name of the primary key index for the current table. + ** This is needed for the argument to "PRAGMA index_xinfo". Set + ** zIdx to point to a nul-terminated string containing this name. */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30197) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), tnum) + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + } + if zIdx != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+29349, libc.VaList(bp+24, zIdx))) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + bKey = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(5)) + if bKey != 0 { + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(1)) + bDesc = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(3)) + zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4)) + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30247, libc.VaList(bp+24, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + if bDesc != 0 { + v1 = __ccgo_ts + 29589 + } else { + v1 = __ccgo_ts + 1680 + } + zPk = _rbuMPrintf(tls, p, __ccgo_ts+30269, libc.VaList(bp+24, zPk, zComma, iCid, v1)) + zComma = __ccgo_ts + 15022 + } + } + zCols = _rbuMPrintf(tls, p, __ccgo_ts+30279, libc.VaList(bp+24, zCols)) + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30294, libc.VaList(bp+24, zCols, zPk)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+24, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, 0, 0)) + } +} + +// C documentation +// +// /* +// ** If an error has already occurred when this function is called, it +// ** immediately returns zero (without doing any work). Or, if an error +// ** occurs during the execution of this function, it sets the error code +// ** in the sqlite3rbu object indicated by the first argument and returns +// ** zero. +// ** +// ** The iterator passed as the second argument is guaranteed to point to +// ** a table (not an index) when this function is called. This function +// ** attempts to create any imposter table required to write to the main +// ** table b-tree of the table before returning. Non-zero is returned if +// ** an imposter table are created, or zero otherwise. +// ** +// ** An imposter table is required in all cases except RBU_PK_VTAB. Only +// ** virtual tables are written to directly. The imposter table has the +// ** same schema as the actual target table (less any UNIQUE constraints). +// ** More precisely, the "same schema" means the same columns, types, +// ** collation sequences. For tables that do not have an external PRIMARY +// ** KEY, it also means the same PRIMARY KEY declaration. +// */ +func _rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var iCol, tnum int32 + var zCol, zComma, zPk, zPk1, zSql, v2, v3 uintptr + var _ /* zColl at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = iCol, tnum, zCol, zComma, zPk, zPk1, zSql, v2, v3 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { + tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum + zComma = __ccgo_ts + 1680 + zSql = uintptr(0) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, 0, int32(1))) + iCol = 0 + for { + if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && iCol < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol) { + break + } + zPk = __ccgo_ts + 1680 + zCol = *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp, uintptr(0), uintptr(0), uintptr(0)) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0 { + /* If the target table column is an "INTEGER PRIMARY KEY", add + ** "PRIMARY KEY" to the imposter table column declaration. */ + zPk = __ccgo_ts + 30356 + } + if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { + v2 = __ccgo_ts + 30369 + } else { + v2 = __ccgo_ts + 1680 + } + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30379, libc.VaList(bp+16, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp)), v2)) + zComma = __ccgo_ts + 15022 + goto _1 + _1: + ; + iCol++ + } + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { + zPk1 = _rbuWithoutRowidPK(tls, p, pIter) + if zPk1 != 0 { + zSql = _rbuMPrintf(tls, p, __ccgo_ts+30406, libc.VaList(bp+16, zSql, zPk1)) + } + } + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(1), tnum)) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_WITHOUT_ROWID) { + v3 = __ccgo_ts + 30413 + } else { + v3 = __ccgo_ts + 1680 + } + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30428, libc.VaList(bp+16, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, v3)) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, 0, 0)) + } +} + +// C documentation +// +// /* +// ** Prepare a statement used to insert rows into the "rbu_tmp_xxx" table. +// ** Specifically a statement of the form: +// ** +// ** INSERT INTO rbu_tmp_xxx VALUES(?, ?, ? ...); +// ** +// ** The number of bound variables is equal to the number of columns in +// ** the target table, plus one (for the rbu_control column), plus one more +// ** (for the rbu_rowid column) if the target table is an implicit IPK or +// ** virtual table. +// */ +func _rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollist uintptr, zRbuRowid uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bRbuRowid int32 + var zBind uintptr + _, _ = bRbuRowid, zBind + bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) + zBind = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+int32(1)+bRbuRowid) + if zBind != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+152, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30460, libc.VaList(bp+8, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + } +} + +func _rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { + var i, rc int32 + var p uintptr + _, _, _ = i, p, rc + p = Xsqlite3_user_data(tls, pCtx) + rc = SQLITE_OK + if Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) != 0 { + *(*Ti64)(unsafe.Pointer(p + 304)) += int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) + } + i = 0 + for { + if !(rc == SQLITE_OK && i < nVal) { + break + } + rc = Xsqlite3_bind_value(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, i+int32(1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert) + rc = Xsqlite3_reset(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert) + } + if rc != SQLITE_OK { + Xsqlite3_result_error_code(tls, pCtx, rc) + } +} + +func _rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aIdxCol, zRet, zSql, v1 uintptr + var c int8 + var i, iIdxCol, nIdxAlloc, nParen, nSpan, nSpan1, rc2, v3, v4 int32 + var _ /* pStmt at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aIdxCol, c, i, iIdxCol, nIdxAlloc, nParen, nSpan, nSpan1, rc2, zRet, zSql, v1, v3, v4 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + zRet = uintptr(0) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp, p+64, __ccgo_ts+30517) + } + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1), (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -int32(1), libc.UintptrFromInt32(0)) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + if zSql != 0 { + v1 = _rbuStrndup(tls, zSql, bp+8) + zSql = v1 + (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql = v1 + } + if zSql != 0 { + nParen = 0 + iIdxCol = 0 + nIdxAlloc = 0 + i = 0 + for { + if !(*(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0) { + break + } + c = *(*int8)(unsafe.Pointer(zSql + uintptr(i))) + /* If necessary, grow the pIter->aIdxCol[] array */ + if iIdxCol == nIdxAlloc { + aIdxCol = Xsqlite3_realloc(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol, int32(uint64(nIdxAlloc+libc.Int32FromInt32(16))*uint64(16))) + if aIdxCol == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_NOMEM) + break + } + (*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol = aIdxCol + nIdxAlloc += int32(16) + } + if int32(c) == int32('(') { + if nParen == 0 { + (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol))).FzSpan = zSql + uintptr(i+int32(1)) + } + nParen++ + } else { + if int32(c) == int32(')') { + nParen-- + if nParen == 0 { + nSpan = int32(t__predefined_ptrdiff_t(zSql+uintptr(i)) - int64((*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iIdxCol)*16))).FzSpan)) + v3 = iIdxCol + iIdxCol++ + (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(v3)*16))).FnSpan = nSpan + i++ + break + } + } else { + if int32(c) == int32(',') && nParen == int32(1) { + nSpan1 = int32(t__predefined_ptrdiff_t(zSql+uintptr(i)) - int64((*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iIdxCol)*16))).FzSpan)) + v4 = iIdxCol + iIdxCol++ + (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(v4)*16))).FnSpan = nSpan1 + (*(*TRbuSpan)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iIdxCol)*16))).FzSpan = zSql + uintptr(i+int32(1)) + } else { + if int32(c) == int32('"') || int32(c) == int32('\'') || int32(c) == int32('`') { + i++ + for { + if !(int32(1) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32(c) { + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i+int32(1))))) != int32(c) { + break + } + i++ + } + goto _5 + _5: + ; + i++ + } + } else { + if int32(c) == int32('[') { + i++ + for { + if !(int32(1) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32(']') { + break + } + goto _6 + _6: + ; + i++ + } + } else { + if int32(c) == int32('-') && int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i+int32(1))))) == int32('-') { + i = i + int32(2) + for { + if !(*(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 && int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) != int32('\n')) { + break + } + goto _7 + _7: + ; + i++ + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { + break + } + } else { + if int32(c) == int32('/') && int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i+int32(1))))) == int32('*') { + i = i + int32(2) + for { + if !(*(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 && (int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) != int32('*') || int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i+int32(1))))) != int32('/'))) { + break + } + goto _8 + _8: + ; + i++ + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32('\000') { + break + } + i++ + } + } + } + } + } + } + } + goto _2 + _2: + ; + i++ + } + if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { + zRet = _rbuStrndup(tls, zSql+uintptr(i), bp+8) + } + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnIdxCol = iIdxCol + } + } + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8)) = rc2 + } + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 8)) + return zRet +} + +// C documentation +// +// /* +// ** Ensure that the SQLite statement handles required to update the +// ** target database object currently indicated by the iterator passed +// ** as the second argument are available. +// */ +func _rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32) (r int32) { + bp := tls.Alloc(128) + defer tls.Free(128) + var bRbuRowid, tnum int32 + var pz, zBind, zBindings, zCollist, zIdx, zLimit, zNewlist, zOldlist, zOrder, zPart, zRbuRowid, zRbuRowid1, zSql, zStart, zStart1, zTbl, zTbl1, zWhere1, zWrite, v1, v10, v2, v3, v4, v5, v6, v7, v8, v9 uintptr + var _ /* nBind at bp+24 */ int32 + var _ /* zImposterCols at bp+0 */ uintptr + var _ /* zImposterPK at bp+8 */ uintptr + var _ /* zWhere at bp+16 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bRbuRowid, pz, tnum, zBind, zBindings, zCollist, zIdx, zLimit, zNewlist, zOldlist, zOrder, zPart, zRbuRowid, zRbuRowid1, zSql, zStart, zStart1, zTbl, zTbl1, zWhere1, zWrite, v1, v10, v2, v3, v4, v5, v6, v7, v8, v9 + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect == uintptr(0) && _rbuObjIterCacheTableInfo(tls, p, pIter) == SQLITE_OK { + tnum = (*TRbuObjIter)(unsafe.Pointer(pIter)).FiTnum + zCollist = uintptr(0) /* List of indexed columns */ + pz = p + 64 + zIdx = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx + zLimit = uintptr(0) + if nOffset != 0 { + zLimit = Xsqlite3_mprintf(tls, __ccgo_ts+30583, libc.VaList(bp+40, nOffset)) + if !(zLimit != 0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } + } + if zIdx != 0 { + zTbl = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Columns for imposter table */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Primary key declaration for imposter */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) /* WHERE clause on PK columns */ + zBind = uintptr(0) + zPart = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 24)) = 0 + zPart = _rbuObjIterGetIndexWhere(tls, p, pIter) + zCollist = _rbuObjIterGetIndexCols(tls, p, pIter, bp, bp+8, bp+16, bp+24) + zBind = _rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 24))) + /* Create the imposter table used to write to this index. */ + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, 0, int32(1))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(1), tnum)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+30603, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))) + Xsqlite3_test_control(tls, int32(SQLITE_TESTCTRL_IMPOSTER), libc.VaList(bp+40, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, 0, 0)) + /* Create the statement to insert index entries */ + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 24)) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30668, libc.VaList(bp+40, zTbl, zBind))) + } + /* And to delete index entries */ + if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+30704, libc.VaList(bp+40, zTbl, *(*uintptr)(unsafe.Pointer(bp + 16))))) + } + /* Create the SELECT statement to read keys in sorted order */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + zStart = uintptr(0) + if nOffset != 0 { + zStart = _rbuVacuumIndexStart(tls, p, pIter) + if zStart != 0 { + Xsqlite3_free(tls, zLimit) + zLimit = uintptr(0) + } + } + if zStart != 0 { + if zPart != 0 { + v2 = __ccgo_ts + 30738 + } else { + v2 = __ccgo_ts + 30742 + } + v1 = v2 + } else { + v1 = __ccgo_ts + 1680 + } + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30748, libc.VaList(bp+40, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v1, zStart, zCollist, zLimit)) + Xsqlite3_free(tls, zStart) + } else { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30809, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) + } else { + if zPart != 0 { + v3 = __ccgo_ts + 30738 + } else { + v3 = __ccgo_ts + 30742 + } + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+30870, libc.VaList(bp+40, zCollist, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, v3, zCollist, zLimit)) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, zSql) + } else { + Xsqlite3_free(tls, zSql) + } + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + Xsqlite3_free(tls, zBind) + Xsqlite3_free(tls, zPart) + } else { + bRbuRowid = libc.BoolInt32((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) + zTbl1 = (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl /* Imposter table name */ + zBindings = _rbuObjIterGetBindlist(tls, p, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+bRbuRowid) + zWhere1 = _rbuObjIterGetWhere(tls, p, pIter) + zOldlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6628) + zNewlist = _rbuObjIterGetOldlist(tls, p, pIter, __ccgo_ts+6624) + zCollist = _rbuObjIterGetCollist(tls, p, pIter) + (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + /* Create the imposter table or tables (if required). */ + _rbuCreateImposterTable(tls, p, pIter) + _rbuCreateImposterTable2(tls, p, pIter) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) { + v4 = __ccgo_ts + 1680 + } else { + v4 = __ccgo_ts + 31029 + } + zWrite = v4 + /* Create the INSERT statement to write to the target PK b-tree */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if bRbuRowid != 0 { + v5 = __ccgo_ts + 31038 + } else { + v5 = __ccgo_ts + 1680 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+136, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31048, libc.VaList(bp+40, zWrite, zTbl1, zCollist, v5, zBindings))) + } + /* Create the DELETE statement to write to the target PK b-tree. + ** Because it only performs INSERT operations, this is not required for + ** an rbu vacuum handle. */ + if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pIter+144, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31084, libc.VaList(bp+40, zWrite, zTbl1, zWhere1))) + } + if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { + zRbuRowid = __ccgo_ts + 1680 + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { + zRbuRowid = __ccgo_ts + 31112 + } + /* Create the rbu_tmp_xxx table and the triggers to populate it. */ + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) { + v6 = __ccgo_ts + 31124 + } else { + v6 = __ccgo_ts + 1680 + } + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31141, libc.VaList(bp+40, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v6, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31217, libc.VaList(bp+40, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zOldlist, zWrite, zTbl1, zNewlist)) + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) { + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31516, libc.VaList(bp+40, zWrite, zTbl1, zNewlist)) + } + _rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) + } + /* Create the SELECT statement to read keys from data_xxx */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + zRbuRowid1 = __ccgo_ts + 1680 + zStart1 = uintptr(0) + zOrder = uintptr(0) + if bRbuRowid != 0 { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v7 = __ccgo_ts + 31615 + } else { + v7 = __ccgo_ts + 31625 + } + zRbuRowid1 = v7 + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + if nOffset != 0 { + zStart1 = _rbuVacuumTableStart(tls, p, pIter, bRbuRowid, zWrite) + if zStart1 != 0 { + Xsqlite3_free(tls, zLimit) + zLimit = uintptr(0) + } + } + if bRbuRowid != 0 { + zOrder = _rbuMPrintf(tls, p, __ccgo_ts+29672, 0) + } else { + zOrder = _rbuObjIterGetPkList(tls, p, pIter, __ccgo_ts+1680, __ccgo_ts+15022, __ccgo_ts+1680) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v8 = __ccgo_ts + 31636 + } else { + v8 = __ccgo_ts + 1680 + } + if zStart1 != 0 { + v9 = zStart1 + } else { + v9 = __ccgo_ts + 1680 + } + if zOrder != 0 { + v10 = __ccgo_ts + 23239 + } else { + v10 = __ccgo_ts + 1680 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, pIter+128, pz, Xsqlite3_mprintf(tls, __ccgo_ts+31642, libc.VaList(bp+40, zCollist, v8, zRbuRowid1, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, v9, v10, zOrder, zLimit))) + } + Xsqlite3_free(tls, zStart1) + Xsqlite3_free(tls, zOrder) + } + Xsqlite3_free(tls, zWhere1) + Xsqlite3_free(tls, zOldlist) + Xsqlite3_free(tls, zNewlist) + Xsqlite3_free(tls, zBindings) + } + Xsqlite3_free(tls, zCollist) + Xsqlite3_free(tls, zLimit) + } + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// C documentation +// +// /* +// ** Set output variable *ppStmt to point to an UPDATE statement that may +// ** be used to update the imposter table for the main table b-tree of the +// ** table object that pIter currently points to, assuming that the +// ** rbu_control column of the data_xyz table contains zMask. +// ** +// ** If the zMask string does not specify any columns to update, then this +// ** is not an error. Output variable *ppStmt is set to NULL in this case. +// */ +func _rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, ppStmt uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var nUp int32 + var pUp, pp, zPrefix, zSet, zUpdate, zWhere uintptr + _, _, _, _, _, _, _ = nUp, pUp, pp, zPrefix, zSet, zUpdate, zWhere + pUp = uintptr(0) + nUp = 0 + /* In case an error occurs */ + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + /* Search for an existing statement. If one is found, shift it to the front + ** of the LRU queue and return immediately. Otherwise, leave nUp pointing + ** to the number of statements currently in the cache and pUp to the + ** last object in the list. */ + pp = pIter + 184 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + pUp = *(*uintptr)(unsafe.Pointer(pp)) + if libc.Xstrcmp(tls, (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask, zMask) == 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext + (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate + return SQLITE_OK + } + nUp++ + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 + } + if nUp >= int32(SQLITE_RBU_UPDATE_CACHESIZE) { + pp = pIter + 184 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != pUp) { + break + } + goto _2 + _2: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 + } + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + Xsqlite3_finalize(tls, (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate) + (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate = uintptr(0) + } else { + pUp = _rbuMalloc(tls, p, int64(uint64(24)+uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)+uint64(1))) + } + if pUp != 0 { + zWhere = _rbuObjIterGetWhere(tls, p, pIter) + zSet = _rbuObjIterGetSetlist(tls, p, pIter, zMask) + zUpdate = uintptr(0) + (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask = pUp + 1*24 + libc.Xmemcpy(tls, (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask, zMask, uint64((*TRbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + (*TRbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp + if zSet != 0 { + zPrefix = __ccgo_ts + 1680 + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType != int32(RBU_PK_VTAB) { + zPrefix = __ccgo_ts + 31029 + } + zUpdate = Xsqlite3_mprintf(tls, __ccgo_ts+31690, libc.VaList(bp+8, zPrefix, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, pUp+8, p+64, zUpdate) + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TRbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate + } + Xsqlite3_free(tls, zWhere) + Xsqlite3_free(tls, zSet) + } + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc +} + +func _rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var flags int32 + var v1 uintptr + var _ /* db at bp+0 */ uintptr + _, _ = flags, v1 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + flags = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_URI) + if bUseVfs != 0 { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName + } else { + v1 = uintptr(0) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp, flags, v1) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp))))) + Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + } + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Free an RbuState object allocated by rbuLoadState(). +// */ +func _rbuFreeState(tls *libc.TLS, p uintptr) { + if p != 0 { + Xsqlite3_free(tls, (*TRbuState)(unsafe.Pointer(p)).FzTbl) + Xsqlite3_free(tls, (*TRbuState)(unsafe.Pointer(p)).FzDataTbl) + Xsqlite3_free(tls, (*TRbuState)(unsafe.Pointer(p)).FzIdx) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Allocate an RbuState object and load the contents of the rbu_state +// ** table into it. Return a pointer to the new object. It is the +// ** responsibility of the caller to eventually free the object using +// ** sqlite3_free(). +// ** +// ** If an error occurs, leave an error code and message in the rbu handle +// ** and return NULL. +// */ +func _rbuLoadState(tls *libc.TLS, p uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pRet uintptr + var rc2 int32 + var _ /* pStmt at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _ = pRet, rc2 + pRet = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + pRet = _rbuMalloc(tls, p, int64(80)) + if pRet == uintptr(0) { + return uintptr(0) + } + *(*int32)(unsafe.Pointer(bp + 8)) = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+31720, libc.VaList(bp+24, p+48))) + for *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) { + case int32(RBU_STATE_STAGE): + (*TRbuState)(unsafe.Pointer(pRet)).FeStage = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + if (*TRbuState)(unsafe.Pointer(pRet)).FeStage != int32(RBU_STAGE_OAL) && (*TRbuState)(unsafe.Pointer(pRet)).FeStage != int32(RBU_STAGE_MOVE) && (*TRbuState)(unsafe.Pointer(pRet)).FeStage != int32(RBU_STAGE_CKPT) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_CORRUPT) + } + case int32(RBU_STATE_TBL): + (*TRbuState)(unsafe.Pointer(pRet)).FzTbl = _rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)), bp+8) + case int32(RBU_STATE_IDX): + (*TRbuState)(unsafe.Pointer(pRet)).FzIdx = _rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)), bp+8) + case int32(RBU_STATE_ROW): + (*TRbuState)(unsafe.Pointer(pRet)).FnRow = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + case int32(RBU_STATE_PROGRESS): + (*TRbuState)(unsafe.Pointer(pRet)).FnProgress = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + case int32(RBU_STATE_CKPT): + (*TRbuState)(unsafe.Pointer(pRet)).FiWalCksum = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + case int32(RBU_STATE_COOKIE): + (*TRbuState)(unsafe.Pointer(pRet)).FiCookie = uint32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1))) + case int32(RBU_STATE_OALSZ): + (*TRbuState)(unsafe.Pointer(pRet)).FiOalSz = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + case int32(RBU_STATE_PHASEONESTEP): + (*TRbuState)(unsafe.Pointer(pRet)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + case int32(RBU_STATE_DATATBL): + (*TRbuState)(unsafe.Pointer(pRet)).FzDataTbl = _rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)), bp+8) + default: + *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_CORRUPT) + break + } + } + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8)) = rc2 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 8)) + return pRet +} + +// C documentation +// +// /* +// ** Open the database handle and attach the RBU database as "rbu". If an +// ** error occurs, leave an error code and message in the RBU handle. +// ** +// ** If argument dbMain is not NULL, then it is a database handle already +// ** open on the target database. Use this handle instead of opening a new +// ** one. +// */ +func _rbuOpenDatabase(tls *libc.TLS, p uintptr, dbMain uintptr, pbRetry uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bOpen, rc int32 + var pState, zExtra, zFile, zTarget, v1, v2, v3 uintptr + _, _, _, _, _, _, _, _, _ = bOpen, pState, rc, zExtra, zFile, zTarget, v1, v2, v3 + /* Open the RBU database */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, int32(1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = dbMain + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6617, int32(SQLITE_FCNTL_RBUCNT), p) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { + zFile = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6617) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+31750, libc.VaList(bp+8, zFile, zFile)) + } + } + /* If using separate RBU and state databases, attach the state database to + ** the RBU db handle now. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31778, libc.VaList(bp+8, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48, __ccgo_ts+3450, uint64(4)) + } else { + libc.Xmemcpy(tls, p+48, __ccgo_ts+6617, uint64(4)) + } + /* If it has not already been created, create the rbu_state table */ + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31796, libc.VaList(bp+8, p+48)) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + bOpen = 0 + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 + (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) + rc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6617, int32(SQLITE_FCNTL_RBUCNT), p) + if rc != int32(SQLITE_NOTFOUND) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage >= int32(RBU_STAGE_MOVE) { + bOpen = int32(1) + } else { + pState = _rbuLoadState(tls, p) + if pState != 0 { + bOpen = libc.BoolInt32((*TRbuState)(unsafe.Pointer(pState)).FeStage >= int32(RBU_STAGE_MOVE)) + _rbuFreeState(tls, pState) + } + } + if bOpen != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu <= int32(1))) + } + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain == uintptr(0) { + if !((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == libc.UintptrFromInt32(0)) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget, int32(1)) + } else { + if (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd)).FpWalFd != 0 { + if pbRetry != 0 { + (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd)).FbNolock = uint8(0) + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = uintptr(0) + *(*int32)(unsafe.Pointer(pbRetry)) = int32(1) + return + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31862, 0) + } else { + zExtra = uintptr(0) + if libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5) && 0 == libc.Xmemcmp(tls, __ccgo_ts+24628, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5)) { + zExtra = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5 + for *(*int8)(unsafe.Pointer(zExtra)) != 0 { + v1 = zExtra + zExtra++ + if int32(*(*int8)(unsafe.Pointer(v1))) == int32('?') { + break + } + } + if int32(*(*int8)(unsafe.Pointer(zExtra))) == int32('\000') { + zExtra = uintptr(0) + } + } + if zExtra == uintptr(0) { + v2 = __ccgo_ts + 1680 + } else { + v2 = __ccgo_ts + 31894 + } + if zExtra == uintptr(0) { + v3 = __ccgo_ts + 1680 + } else { + v3 = zExtra + } + zTarget = Xsqlite3_mprintf(tls, __ccgo_ts+31896, libc.VaList(bp+8, Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+6617), v2, v3)) + if zTarget == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + return + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = _rbuOpenDbhandle(tls, p, zTarget, libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FnRbu <= int32(1))) + Xsqlite3_free(tls, zTarget) + } + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31928, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTmpInsertFunc), uintptr(0), uintptr(0)) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31943, int32(2), int32(SQLITE_UTF8), uintptr(0), __ccgo_fp(_rbuFossilDeltaFunc), uintptr(0), uintptr(0)) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+31960, -int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuTargetNameFunc), uintptr(0), uintptr(0)) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(SQLITE_FCNTL_RBU), p) + } + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31976, 0) + /* Mark the database file just opened as an RBU target database. If + ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. + ** This is an error. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(SQLITE_FCNTL_RBU), p) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_NOTFOUND) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32004, 0) + } +} + +// C documentation +// +// /* +// ** This routine is a copy of the sqlite3FileSuffix3() routine from the core. +// ** It is a no-op unless SQLITE_ENABLE_8_3_NAMES is defined. +// ** +// ** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database +// ** filename in zBaseFilename is a URI with the "8_3_names=1" parameter and +// ** if filename in z[] has a suffix (a.k.a. "extension") that is longer than +// ** three characters, then shorten the suffix on z[] to be the last three +// ** characters of the original suffix. +// ** +// ** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always +// ** do the suffix shortening regardless of URI parameter. +// ** +// ** Examples: +// ** +// ** test.db-journal => test.nal +// ** test.db-wal => test.wal +// ** test.db-shm => test.shm +// ** test.db-mj7f3319fa => test.9fa +// */ +func _rbuFileSuffix3(tls *libc.TLS, zBase uintptr, z uintptr) { +} + +// C documentation +// +// /* +// ** Return the current wal-index header checksum for the target database +// ** as a 64-bit integer. +// ** +// ** The checksum is store in the first page of xShmMap memory as an 8-byte +// ** blob starting at byte offset 40. +// */ +func _rbuShmChecksum(tls *libc.TLS, p uintptr) (r Ti64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iRet Ti64 + var pDb uintptr + var _ /* ptr at bp+0 */ uintptr + _, _ = iRet, pDb + iRet = 0 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxShmMap})))(tls, pDb, 0, libc.Int32FromInt32(32)*libc.Int32FromInt32(1024), 0, bp) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + iRet = int64(libc.AtomicLoadPUint32(*(*uintptr)(unsafe.Pointer(bp))+libc.UintptrFromInt32(10)*4))< db page) copy operations required to checkpoint the +// ** current wal file, and obtains the set of shm locks required to safely +// ** perform the copy operations directly on the file-system. +// ** +// ** If argument pState is not NULL, then the incremental checkpoint is +// ** being resumed. In this case, if the checksum of the wal-index-header +// ** following recovery is not the same as the checksum saved in the RbuState +// ** object, then the rbu handle is set to DONE state. This occurs if some +// ** other client appends a transaction to the wal file in the middle of +// ** an incremental checkpoint. +// */ +func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { + var nSectorSize, rc2, v1 int32 + var pDb, pWal uintptr + _, _, _, _, _ = nSectorSize, pDb, pWal, rc2, v1 + /* If pState is NULL, then the wal file may not have been opened and + ** recovered. Running a read-statement here to ensure that doing so + ** does not interfere with the "capture" process below. */ + if pState == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+31976, uintptr(0), uintptr(0), uintptr(0)) + } + } + /* Assuming no error has occurred, run a "restart" checkpoint with the + ** sqlite3rbu.eStage variable set to CAPTURE. This turns on the following + ** special behaviour in the rbu VFS: + ** + ** * If the exclusive shm WRITER or READ0 lock cannot be obtained, + ** the checkpoint fails with SQLITE_BUSY (normally SQLite would + ** proceed with running a passive checkpoint instead of failing). + ** + ** * Attempts to read from the *-wal file or write to the database file + ** do not perform any IO. Instead, the frame/page combinations that + ** would be read/written are recorded in the sqlite3rbu.aFrame[] + ** array. + ** + ** * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER, + ** READ0 and CHECKPOINT locks taken as part of the checkpoint are + ** no-ops. These locks will not be released until the connection + ** is closed. + ** + ** * Attempting to xSync() the database file causes an SQLITE_NOTICE + ** error. + ** + ** As a result, unless an error (i.e. OOM or SQLITE_BUSY) occurs, the + ** checkpoint below fails with SQLITE_NOTICE, and leaves the aFrame[] + ** array populated with a set of (frame -> page) mappings. Because the + ** WRITER, CHECKPOINT and READ0 locks are still held, it is safe to copy + ** data from the wal file into the database file according to the + ** contents of aFrame[]. + */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32022, uintptr(0), uintptr(0), uintptr(0)) + if rc2 != int32(SQLITE_NOTICE) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame > 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) + if pState != 0 { + v1 = (*TRbuState)(unsafe.Pointer(pState)).FnRow + } else { + v1 = 0 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = v1 + (*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf = _rbuMalloc(tls, p, int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum = _rbuShmChecksum(tls, p) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame == 0 || pState != 0 && (*TRbuState)(unsafe.Pointer(pState)).FiWalCksum != (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) + } else { + pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + pWal = (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal + nSectorSize = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSectorSize})))(tls, pDb) + if nSectorSize > (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = nSectorSize / (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz + } else { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = int32(1) + } + /* Call xSync() on the wal file. This causes SQLite to sync the + ** directory in which the target database and the wal file reside, in + ** case it has not been synced since the rename() call in + ** rbuMoveOalFile(). */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pWal)).FpMethods)).FxSync})))(tls, pWal, int32(SQLITE_SYNC_NORMAL)) + } + } +} + +// C documentation +// +// /* +// ** Called when iAmt bytes are read from offset iOff of the wal file while +// ** the rbu object is in capture mode. Record the frame number of the frame +// ** being read in the aFrame[] array. +// */ +func _rbuCaptureWalRead(tls *libc.TLS, pRbu uintptr, iOff Ti64, iAmt int32) (r int32) { + var aNew uintptr + var iFrame, mReq Tu32 + var nNew, v1 int32 + _, _, _, _, _ = aNew, iFrame, mReq, nNew, v1 + mReq = uint32(libc.Int32FromInt32(1)<db is + ** holding a SHARED lock on the target database file (because it is + ** in WAL mode). So no other connection may be writing the db. + ** + ** In order to ensure that there are no database readers, an EXCLUSIVE + ** lock is obtained here before the *-oal is moved to *-wal. + */ + dbMain = uintptr(0) + _rbuFileSuffix3(tls, zBase, zWal) + _rbuFileSuffix3(tls, zBase, zOal) + /* Re-open the databases. */ + _rbuObjIterFinalize(tls, p+80) + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu = uintptr(0) + dbMain = _rbuOpenDbhandle(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget, int32(1)) + if dbMain != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuLockDatabase(tls, dbMain) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3rbu)(unsafe.Pointer(p)).FxRename})))(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRenameArg, zOal, zWal) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK || (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) || _rbuExclusiveCheckpoint(tls, dbMain) == 0 { + Xsqlite3_close(tls, dbMain) + dbMain = uintptr(0) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuOpenDatabase(tls, p, dbMain, uintptr(0)) + _rbuSetupCheckpoint(tls, p, uintptr(0)) + } + } + Xsqlite3_free(tls, zWal) + Xsqlite3_free(tls, zOal) +} + +// C documentation +// +// /* +// ** The SELECT statement iterating through the keys for the current object +// ** (p->objiter.pSelect) currently points to a valid row. This function +// ** determines the type of operation requested by this row and returns +// ** one of the following values to indicate the result: +// ** +// ** * RBU_INSERT +// ** * RBU_DELETE +// ** * RBU_IDX_DELETE +// ** * RBU_UPDATE +// ** +// ** If RBU_UPDATE is returned, then output variable *pzMask is set to +// ** point to the text value indicating the columns to update. +// ** +// ** If the rbu_control field contains an invalid value, an error code and +// ** message are left in the RBU handle and zero returned. +// */ +func _rbuStepType(tls *libc.TLS, p uintptr, pzMask uintptr) (r int32) { + var iCol, iVal, res int32 + var z uintptr + _, _, _, _ = iCol, iVal, res, z + iCol = (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnCol /* Index of rbu_control column */ + res = 0 /* Return value */ + switch Xsqlite3_column_type(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) { + case int32(SQLITE_INTEGER): + iVal = Xsqlite3_column_int(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) + switch iVal { + case 0: + res = int32(RBU_INSERT) + case int32(1): + res = int32(RBU_DELETE) + case int32(2): + res = int32(RBU_REPLACE) + case int32(3): + res = int32(RBU_IDX_DELETE) + case int32(4): + res = int32(RBU_IDX_INSERT) + break + } + case int32(SQLITE_TEXT): + z = Xsqlite3_column_text(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) + if z == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + *(*uintptr)(unsafe.Pointer(pzMask)) = z + } + res = int32(RBU_UPDATE) + default: + break + } + if res == 0 { + _rbuBadControlError(tls, p) + } + return res +} + +// C documentation +// +// /* +// ** Argument eType must be one of RBU_INSERT, RBU_DELETE, RBU_IDX_INSERT or +// ** RBU_IDX_DELETE. This function performs the work of a single +// ** sqlite3rbu_step() call for the type of operation specified by eType. +// */ +func _rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { + var i int32 + var pIter, pVal, pWriter uintptr + _, _, _, _ = i, pIter, pVal, pWriter + pIter = p + 80 + /* If this is a delete, decrement nPhaseOneStep by nIndex. If the DELETE + ** statement below does actually delete a row, nPhaseOneStep will be + ** incremented by the same amount when SQL function rbu_tmp_insert() + ** is invoked by the trigger. */ + if eType == int32(RBU_DELETE) { + *(*Ti64)(unsafe.Pointer(p + 304)) -= int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) + } + if eType == int32(RBU_IDX_DELETE) || eType == int32(RBU_DELETE) { + pWriter = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpDelete + } else { + pWriter = (*TRbuObjIter)(unsafe.Pointer(pIter)).FpInsert + } + i = 0 + for { + if !(i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol) { + break + } + /* If this is an INSERT into a table b-tree and the table has an + ** explicit INTEGER PRIMARY KEY, check that this is not an attempt + ** to write a NULL into the IPK column. That is not permitted. */ + if eType == int32(RBU_INSERT) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_IPK) && *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 && Xsqlite3_column_type(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == int32(SQLITE_NULL) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_MISMATCH) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+24185, 0) + return + } + if eType == int32(RBU_DELETE) && int32(*(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0 { + goto _1 + } + pVal = Xsqlite3_column_value(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, pWriter, i+int32(1), pVal) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + return + } + goto _1 + _1: + ; + i++ + } + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_EXTERNAL) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + /* For a virtual table, or a table with no primary key, the + ** SELECT statement is: + ** + ** SELECT , rbu_control, rbu_rowid FROM .... + ** + ** Hence column_value(pIter->nCol+1). + */ + pVal = Xsqlite3_column_value(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol+int32(1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, pWriter, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol+int32(1), pVal) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_step(tls, pWriter) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _resetAndCollectError(tls, pWriter, p+64) + } +} + +// C documentation +// +// /* +// ** This function does the work for an sqlite3rbu_step() call. +// ** +// ** The object-iterator (p->objiter) currently points to a valid object, +// ** and the input cursor (p->objiter.pSelect) currently points to a valid +// ** input row. Perform whatever processing is required and return. +// ** +// ** If no error occurs, SQLITE_OK is returned. Otherwise, an error code +// ** and message is left in the RBU handle and a copy of the error code +// ** returned. +// */ +func _rbuStep(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var c int8 + var eType, i int32 + var pIter, pVal uintptr + var _ /* pUpdate at bp+8 */ uintptr + var _ /* zMask at bp+0 */ uintptr + _, _, _, _, _ = c, eType, i, pIter, pVal + pIter = p + 80 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + eType = _rbuStepType(tls, p, bp) + if eType != 0 { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) && (eType == int32(RBU_IDX_DELETE) || eType == int32(RBU_IDX_INSERT)) { + _rbuBadControlError(tls, p) + } else { + if eType == int32(RBU_REPLACE) { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + *(*Ti64)(unsafe.Pointer(p + 304)) += int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) + _rbuStepOneOp(tls, p, int32(RBU_DELETE)) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuStepOneOp(tls, p, int32(RBU_INSERT)) + } + } else { + if eType != int32(RBU_UPDATE) { + _rbuStepOneOp(tls, p, eType) + } else { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*Ti64)(unsafe.Pointer(p + 304)) -= int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex) + _rbuGetUpdateStmt(tls, p, pIter, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + i = 0 + for { + if !((*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && i < (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol) { + break + } + c = *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + uintptr(*(*int32)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) + pVal = Xsqlite3_column_value(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) + if *(*Tu8)(unsafe.Pointer((*TRbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 || int32(c) != int32('.') { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), pVal) + } + goto _1 + _1: + ; + i++ + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_VTAB) || (*TRbuObjIter)(unsafe.Pointer(pIter)).FeType == int32(RBU_PK_NONE)) { + /* Bind the rbu_rowid value to column _rowid_ */ + pVal = Xsqlite3_column_value(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect, (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol+int32(1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), (*TRbuObjIter)(unsafe.Pointer(pIter)).FnCol+int32(1), pVal) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _resetAndCollectError(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), p+64) + } + } + } + } + } + } + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// C documentation +// +// /* +// ** Increment the schema cookie of the main database opened by p->dbMain. +// ** +// ** Or, if this is an RBU vacuum, set the schema cookie of the main db +// ** opened by p->dbMain to one more than the schema cookie of the main +// ** db opened by p->dbRbu. +// */ +func _rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var dbread, v1 uintptr + var iCookie int32 + var _ /* pStmt at bp+0 */ uintptr + _, _, _ = dbread, iCookie, v1 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu + } else { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain + } + dbread = v1 + iCookie = int32(1000000) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, dbread, bp, p+64, __ccgo_ts+32096) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + /* Coverage: it may be that this sqlite3_step() cannot fail. There + ** is already a transaction open, so the prepared statement cannot + ** throw an SQLITE_SCHEMA exception. The only database page the + ** statement reads is page 1, which is guaranteed to be in the cache. + ** And no memory allocations are required. */ + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + iCookie = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32118, libc.VaList(bp+16, iCookie+int32(1))) + } + } +} + +// C documentation +// +// /* +// ** Update the contents of the rbu_state table within the rbu database. The +// ** value stored in the RBU_STATE_STAGE column is eStage. All other values +// ** are determined by inspecting the rbu handle passed as the first argument. +// */ +func _rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { + bp := tls.Alloc(192) + defer tls.Free(192) + var pFd, v1 uintptr + var rc int32 + var _ /* pInsert at bp+0 */ uintptr + _, _, _ = pFd, rc, v1 + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK || (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd + } else { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd + } + pFd = v1 + rc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32145, libc.VaList(bp+16, p+48, int32(RBU_STATE_STAGE), eStage, int32(RBU_STATE_TBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, int32(RBU_STATE_IDX), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, int32(RBU_STATE_ROW), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep, int32(RBU_STATE_PROGRESS), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress, int32(RBU_STATE_CKPT), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, int32(RBU_STATE_COOKIE), int64((*Trbu_file)(unsafe.Pointer(pFd)).FiCookie), int32(RBU_STATE_OALSZ), (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz, int32(RBU_STATE_PHASEONESTEP), (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, int32(RBU_STATE_DATATBL), (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + if rc == SQLITE_OK { + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if rc != SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + } +} + +// C documentation +// +// /* +// ** The second argument passed to this function is the name of a PRAGMA +// ** setting - "page_size", "auto_vacuum", "user_version" or "application_id". +// ** This function executes the following on sqlite3rbu.dbRbu: +// ** +// ** "PRAGMA main.$zPragma" +// ** +// ** where $zPragma is the string passed as the second argument, then +// ** on sqlite3rbu.dbMain: +// ** +// ** "PRAGMA main.$zPragma = $val" +// ** +// ** where $val is the value returned by the first PRAGMA invocation. +// ** +// ** In short, it copies the value of the specified PRAGMA setting from +// ** dbRbu to dbMain. +// */ +func _rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var _ /* pPragma at bp+0 */ uintptr + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareFreeAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, Xsqlite3_mprintf(tls, __ccgo_ts+32303, libc.VaList(bp+16, zPragma))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32318, libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0))) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + } +} + +// C documentation +// +// /* +// ** The RBU handle passed as the only argument has just been opened and +// ** the state database is empty. If this RBU handle was opened for an +// ** RBU vacuum operation, create the schema in the target db. +// */ +func _rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var zSql uintptr + var _ /* pInsert at bp+8 */ uintptr + var _ /* pSql at bp+0 */ uintptr + _, _ = i, zSql + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32338, uintptr(0), uintptr(0), p+64) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32363) + } + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { + zSql = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, zSql, uintptr(0), uintptr(0), p+64) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32471) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8, p+64, __ccgo_ts+32536) + } + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_ROW) { + i = 0 + for { + if !(i < int32(5)) { + break + } + Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i+int32(1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), i)) + goto _1 + _1: + ; + i++ + } + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32580, uintptr(0), uintptr(0), p+64) + } + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + _rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) +} + +// C documentation +// +// /* +// ** Step the RBU object. +// */ +func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iSector Tu32 + var pDb, pFrame, pIter uintptr + var rc int32 + var _ /* ptr at bp+0 */ uintptr + _, _, _, _, _ = iSector, pDb, pFrame, pIter, rc + if p != 0 { + switch (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage { + case int32(RBU_STAGE_OAL): + pIter = p + 80 + /* If this is an RBU vacuum operation and the state table was empty + ** when this handle was opened, create the target database schema. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuCreateTargetSchema(tls, p) + _rbuCopyPragma(tls, p, __ccgo_ts+17699) + _rbuCopyPragma(tls, p, __ccgo_ts+16810) + } + for (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 { + if (*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { + /* Clean up the rbu_tmp_xxx table for the previous table. It + ** cannot be dropped as there are currently active SQL statements. + ** But the contents can be deleted. */ + if libc.BoolInt32((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0)) == 0 && (*TRbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0 { + _rbuMPrintfExec(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32605, libc.VaList(bp+16, p+48, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + } + } else { + _rbuObjIterPrepareAll(tls, p, pIter, 0) + /* Advance to the next row to process. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rc = Xsqlite3_step(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + if rc == int32(SQLITE_ROW) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep++ + return _rbuStep(tls, p) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 + } + } + _rbuObjIterNext(tls, p, pIter) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuSaveState(tls, p, int32(RBU_STAGE_MOVE)) + _rbuIncrSchemaCookie(tls, p) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14926, uintptr(0), uintptr(0), p+64) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14926, uintptr(0), uintptr(0), p+64) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_MOVE) + } + case int32(RBU_STAGE_MOVE): + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuMoveOalFile(tls, p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + } + case int32(RBU_STAGE_CKPT): + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep >= (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame { + pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + /* Sync the db file */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSync})))(tls, pDb, int32(SQLITE_SYNC_NORMAL)) + /* Update nBackfill */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxShmMap})))(tls, pDb, 0, libc.Int32FromInt32(32)*libc.Int32FromInt32(1024), 0, bp) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*Tu32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 24*4)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).FiMaxFrame + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE) + } + } else { + for cond := true; cond; cond = (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep < (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame && iSector == ((*(*TRbuFrame)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FaFrame + uintptr((*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep)*8))).FiDbPage-uint32(1))/uint32((*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pFrame = (*Tsqlite3rbu)(unsafe.Pointer(p)).FaFrame + uintptr((*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep)*8 + iSector = ((*TRbuFrame)(unsafe.Pointer(pFrame)).FiDbPage - uint32(1)) / uint32((*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector) + _rbuCheckpointFrame(tls, p, pFrame) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep++ + } + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + } + default: + break + } + return (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + } else { + return int32(SQLITE_NOMEM) + } + return r +} + +// C documentation +// +// /* +// ** Compare strings z1 and z2, returning 0 if they are identical, or non-zero +// ** otherwise. Either or both argument may be NULL. Two NULL values are +// ** considered equal, and NULL is considered distinct from all other values. +// */ +func _rbuStrCompare(tls *libc.TLS, z1 uintptr, z2 uintptr) (r int32) { + if z1 == uintptr(0) && z2 == uintptr(0) { + return 0 + } + if z1 == uintptr(0) || z2 == uintptr(0) { + return int32(1) + } + return libc.BoolInt32(Xsqlite3_stricmp(tls, z1, z2) != 0) +} + +// C documentation +// +// /* +// ** This function is called as part of sqlite3rbu_open() when initializing +// ** an rbu handle in OAL stage. If the rbu update has not started (i.e. +// ** the rbu_state table was empty) it is a no-op. Otherwise, it arranges +// ** things so that the next call to sqlite3rbu_step() continues on from +// ** where the previous rbu handle left off. +// ** +// ** If an error occurs, an error code and error message are left in the +// ** rbu handle passed as the first argument. +// */ +func _rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { + var pIter uintptr + var rc int32 + _, _ = pIter, rc + if (*TRbuState)(unsafe.Pointer(pState)).FzTbl != 0 { + pIter = p + 80 + rc = SQLITE_OK + for rc == SQLITE_OK && (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0 && ((*TRbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 || _rbuStrCompare(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzIdx, (*TRbuState)(unsafe.Pointer(pState)).FzIdx) != 0 || (*TRbuState)(unsafe.Pointer(pState)).FzDataTbl == uintptr(0) && _rbuStrCompare(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (*TRbuState)(unsafe.Pointer(pState)).FzTbl) != 0 || (*TRbuState)(unsafe.Pointer(pState)).FzDataTbl != 0 && _rbuStrCompare(tls, (*TRbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, (*TRbuState)(unsafe.Pointer(pState)).FzDataTbl) != 0) { + rc = _rbuObjIterNext(tls, p, pIter) + } + if rc == SQLITE_OK && !((*TRbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { + rc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32633, 0) + } + if rc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = (*TRbuState)(unsafe.Pointer(pState)).FnRow + rc = _rbuObjIterPrepareAll(tls, p, p+80, (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } +} + +// C documentation +// +// /* +// ** If there is a "*-oal" file in the file-system corresponding to the +// ** target database in the file-system, delete it. If an error occurs, +// ** leave an error code and error message in the rbu handle. +// */ +func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var zOal uintptr + var _ /* pVfs at bp+0 */ uintptr + _ = zOal + zOal = _rbuMPrintf(tls, p, __ccgo_ts+32082, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + if zOal != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6617, int32(SQLITE_FCNTL_VFS_POINTER), bp) + (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxDelete})))(tls, *(*uintptr)(unsafe.Pointer(bp)), zOal, 0) + Xsqlite3_free(tls, zOal) + } +} + +// C documentation +// +// /* +// ** Allocate a private rbu VFS for the rbu handle passed as the only +// ** argument. This VFS will be used unless the call to sqlite3rbu_open() +// ** specified a URI with a vfs=? option in place of a target database +// ** file name. +// */ +func _rbuCreateVfs(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(96) + defer tls.Free(96) + var pVfs uintptr + var _ /* rnd at bp+0 */ int32 + var _ /* zRnd at bp+4 */ [64]int8 + _ = pVfs + Xsqlite3_randomness(tls, int32(4), bp) + Xsqlite3_snprintf(tls, int32(64), bp+4, __ccgo_ts+32658, libc.VaList(bp+80, *(*int32)(unsafe.Pointer(bp)))) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+4, uintptr(0)) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pVfs = Xsqlite3_vfs_find(tls, bp+4) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName = (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName + (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRbu = p + } +} + +// C documentation +// +// /* +// ** Destroy the private VFS created for the rbu handle passed as the only +// ** argument by an earlier call to rbuCreateVfs(). +// */ +func _rbuDeleteVfs(tls *libc.TLS, p uintptr) { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName != 0 { + Xsqlite3rbu_destroy_vfs(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName = uintptr(0) + } +} + +// C documentation +// +// /* +// ** This user-defined SQL function is invoked with a single argument - the +// ** name of a table expected to appear in the target database. It returns +// ** the number of auxilliary indexes on the table. +// */ +func _rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, v1 uintptr + var nIndex, rc int32 + var _ /* pStmt at bp+0 */ uintptr + var _ /* zErrmsg at bp+8 */ uintptr + _, _, _, _, _ = db, nIndex, p, rc, v1 + p = Xsqlite3_user_data(tls, pCtx) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu + } else { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain + } + db = v1 + rc = _prepareFreeAndCollectError(tls, db, bp, bp+8, Xsqlite3_mprintf(tls, __ccgo_ts+32669, libc.VaList(bp+24, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + if rc != SQLITE_OK { + Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 8)), -int32(1)) + } else { + nIndex = 0 + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + nIndex = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + Xsqlite3_result_int(tls, pCtx, nIndex) + } else { + Xsqlite3_result_error(tls, pCtx, Xsqlite3_errmsg(tls, db), -int32(1)) + } + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) +} + +// C documentation +// +// /* +// ** If the RBU database contains the rbu_count table, use it to initialize +// ** the sqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table +// ** is assumed to contain the same columns as: +// ** +// ** CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID; +// ** +// ** There should be one row in the table for each data_xxx table in the +// ** database. The 'tbl' column should contain the name of a data_xxx table, +// ** and the cnt column the number of rows it contains. +// ** +// ** sqlite3rbu.nPhaseOneStep is initialized to the sum of (1 + nIndex) * cnt +// ** for all rows in the rbu_count table, where nIndex is the number of +// ** indexes on the corresponding target database table. +// */ +func _rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bExists int32 + var _ /* pStmt at bp+0 */ uintptr + _ = bExists + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + bExists = 0 /* True if rbu_count exists */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-int32(1)) + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+32741, int32(1), int32(SQLITE_UTF8), p, __ccgo_fp(_rbuIndexCntFunc), uintptr(0), uintptr(0)) + /* Check for the rbu_count table. If it does not exist, or if an error + ** occurs, nPhaseOneStep will be left set to -1. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32755) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + bExists = int32(1) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && bExists != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _prepareAndCollectError(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp, p+64, __ccgo_ts+32812) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + } +} + +func _openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, pCsr, pFd, pState, v2, v3 uintptr + var frc int32 + var nByte, nRbu, nTarget Tsize_t + var v1 uint64 + var _ /* bRetry at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _ = db, frc, nByte, nRbu, nTarget, p, pCsr, pFd, pState, v1, v2, v3 + if zTarget != 0 { + v1 = libc.Xstrlen(tls, zTarget) + } else { + v1 = uint64(0) + } + nTarget = v1 + nRbu = libc.Xstrlen(tls, zRbu) + nByte = uint64(408) + nTarget + uint64(1) + nRbu + uint64(1) + p = Xsqlite3_malloc64(tls, nByte) + if p != 0 { + pState = uintptr(0) + /* Create the custom VFS. */ + libc.Xmemset(tls, p, 0, uint64(408)) + Xsqlite3rbu_rename_handler(tls, p, uintptr(0), uintptr(0)) + _rbuCreateVfs(tls, p) + /* Open the target, RBU and state databases */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pCsr = p + 1*408 + *(*int32)(unsafe.Pointer(bp)) = 0 + if zTarget != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget = pCsr + libc.Xmemcpy(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget, zTarget, nTarget+uint64(1)) + pCsr += uintptr(nTarget + uint64(1)) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu = pCsr + libc.Xmemcpy(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, nRbu+uint64(1)) + pCsr += uintptr(nRbu + uint64(1)) + if zState != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState = _rbuMPrintf(tls, p, __ccgo_ts+3827, libc.VaList(bp+16, zState)) + } + /* If the first attempt to open the database file fails and the bRetry + ** flag it set, this means that the db was not opened because it seemed + ** to be a wal-mode db. But, this may have happened due to an earlier + ** RBU vacuum operation leaving an old wal file in the directory. + ** If this is the case, it will have been checkpointed and deleted + ** when the handle was closed and a second attempt to open the + ** database may succeed. */ + _rbuOpenDatabase(tls, p, uintptr(0), bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + _rbuOpenDatabase(tls, p, uintptr(0), uintptr(0)) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pState = _rbuLoadState(tls, p) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 { + _rbuDeleteOalFile(tls, p) + _rbuInitPhaseOneSteps(tls, p) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_OAL) + } else { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = (*TRbuState)(unsafe.Pointer(pState)).FeStage + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = (*TRbuState)(unsafe.Pointer(pState)).FnPhaseOneStep + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress = int32((*TRbuState)(unsafe.Pointer(pState)).FnProgress) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FiOalSz = (*TRbuState)(unsafe.Pointer(pState)).FiOalSz + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0 { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32886, 0) + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 + } + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && ((*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) || (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE)) && (*TRbuState)(unsafe.Pointer(pState)).FeStage != 0 { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v2 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpRbuFd + } else { + v2 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd + } + pFd = v2 + if (*Trbu_file)(unsafe.Pointer(pFd)).FiCookie != (*TRbuState)(unsafe.Pointer(pState)).FiCookie { + /* At this point (pTargetFd->iCookie) contains the value of the + ** change-counter cookie (the thing that gets incremented when a + ** transaction is committed in rollback mode) currently stored on + ** page 1 of the database file. */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_BUSY) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v3 = __ccgo_ts + 32918 + } else { + v3 = __ccgo_ts + 32925 + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+32932, libc.VaList(bp+16, v3)) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + db = (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14911, uintptr(0), uintptr(0), p+64) + /* Point the object iterator at the first object */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = _rbuObjIterFirst(tls, p, p+80) + } + /* If the RBU database contains no data_xxx tables, declare the RBU + ** update finished. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl == uintptr(0) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TRbuState)(unsafe.Pointer(pState)).FeStage == 0 && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + _rbuCopyPragma(tls, p, __ccgo_ts+17413) + _rbuCopyPragma(tls, p, __ccgo_ts+16825) + } + /* Open transactions both databases. The *-oal file is opened or + ** created at this point. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32964, uintptr(0), uintptr(0), p+64) + } + /* Check if the main database is a zipvfs db. If it is, set the upper + ** level pager to use "journal_mode=off". This prevents it from + ** generating a large journal using a temp file. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + frc = Xsqlite3_file_control(tls, db, __ccgo_ts+6617, int32(SQLITE_FCNTL_ZIPVFS), uintptr(0)) + if frc == SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, __ccgo_ts+32980, uintptr(0), uintptr(0), p+64) + } + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _rbuSetupOal(tls, p, pState) + } + } + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_MOVE) { + /* no-op */ + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { + if !((*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == libc.UintptrFromInt32(0)) && _rbuExclusiveCheckpoint(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) != 0 { + /* If the rbu_exclusive_checkpoint=1 URI parameter was specified + ** and an incremental checkpoint is being resumed, attempt an + ** exclusive lock on the db file. If this fails, so be it. */ + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) + _rbuLockDatabase(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) + (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) + } + _rbuSetupCheckpoint(tls, p, pState) + } else { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_DONE) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE) + } else { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_CORRUPT) + } + } + } + } + } + _rbuFreeState(tls, pState) + } + return p +} + +// C documentation +// +// /* +// ** Allocate and return an RBU handle with all fields zeroed except for the +// ** error code, which is set to SQLITE_MISUSE. +// */ +func _rbuMisuseError(tls *libc.TLS) (r uintptr) { + var pRet uintptr + _ = pRet + pRet = Xsqlite3_malloc64(tls, uint64(408)) + if pRet != 0 { + libc.Xmemset(tls, pRet, 0, uint64(408)) + (*Tsqlite3rbu)(unsafe.Pointer(pRet)).Frc = int32(SQLITE_MISUSE) + } + return pRet +} + +// C documentation +// +// /* +// ** Open and return a new RBU handle. +// */ +func Xsqlite3rbu_open(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (r uintptr) { + if zTarget == uintptr(0) || zRbu == uintptr(0) { + return _rbuMisuseError(tls) + } + return _openRbuHandle(tls, zTarget, zRbu, zState) +} + +// C documentation +// +// /* +// ** Open a handle to begin or resume an RBU VACUUM operation. +// */ +func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintptr) { + var n int32 + _ = n + if zTarget == uintptr(0) { + return _rbuMisuseError(tls) + } + if zState != 0 { + n = int32(libc.Xstrlen(tls, zState)) + if n >= int32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+33004, zState+uintptr(n-int32(7)), uint64(7)) { + return _rbuMisuseError(tls) + } + } + /* TODO: Check that both arguments are non-NULL */ + return _openRbuHandle(tls, uintptr(0), zTarget, zState) +} + +// C documentation +// +// /* +// ** Return the database handle used by pRbu. +// */ +func Xsqlite3rbu_db(tls *libc.TLS, pRbu uintptr, bRbu int32) (r uintptr) { + var db, v1 uintptr + _, _ = db, v1 + db = uintptr(0) + if pRbu != 0 { + if bRbu != 0 { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FdbRbu + } else { + v1 = (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FdbMain + } + db = v1 + } + return db +} + +// C documentation +// +// /* +// ** If the error code currently stored in the RBU handle is SQLITE_CONSTRAINT, +// ** then edit any error message string so as to remove all occurrences of +// ** the pattern "rbu_imp_[0-9]*". +// */ +func _rbuEditErrmsg(tls *libc.TLS, p uintptr) { + var i uint32 + var nDel int32 + var nErrmsg Tsize_t + _, _, _ = i, nDel, nErrmsg + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_CONSTRAINT) && (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg != 0 { + nErrmsg = libc.Xstrlen(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) + i = uint32(0) + for { + if !(uint64(i) < nErrmsg-uint64(8)) { + break + } + if libc.Xmemcmp(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), __ccgo_ts+31029, uint64(8)) == 0 { + nDel = int32(8) + for int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) >= int32('0') && int32(*(*int8)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i+uint32(nDel))))) <= int32('9') { + nDel++ + } + libc.Xmemmove(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i), (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i+uint32(nDel)), nErrmsg+uint64(1)-uint64(i)-uint64(nDel)) + nErrmsg -= uint64(nDel) + } + goto _1 + _1: + ; + i++ + } + } +} + +// C documentation +// +// /* +// ** Close the RBU handle. +// */ +func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) (r int32) { + var pDb uintptr + var rc, rc2 int32 + _, _, _ = pDb, rc, rc2 + if p != 0 { + /* Commit the transaction to the *-oal file. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14926, uintptr(0), uintptr(0), p+64) + } + /* Sync the db file if currently doing an incremental checkpoint */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { + pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSync})))(tls, pDb, int32(SQLITE_SYNC_NORMAL)) + } + _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14926, uintptr(0), uintptr(0), p+64) + } + /* Close any open statement handles. */ + _rbuObjIterFinalize(tls, p+80) + /* If this is an RBU vacuum handle and the vacuum has either finished + ** successfully or encountered an error, delete the contents of the + ** state table. This causes the next call to sqlite3rbu_vacuum() + ** specifying the current target and state databases to start a new + ** vacuum from scratch. */ + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0 { + rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+33012, uintptr(0), uintptr(0), uintptr(0)) + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == int32(SQLITE_DONE) && rc2 != SQLITE_OK { + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 + } + } + /* Close the open database handle and VFS object. */ + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain) + _rbuDeleteVfs(tls, p) + Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf) + Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FaFrame) + _rbuEditErrmsg(tls, p) + rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + if pzErrmsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + } else { + Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) + } + Xsqlite3_free(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzState) + Xsqlite3_free(tls, p) + } else { + rc = int32(SQLITE_NOMEM) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = uintptr(0) + } + return rc +} + +// C documentation +// +// /* +// ** Return the total number of key-value operations (inserts, deletes or +// ** updates) that have been performed on the target database since the +// ** current RBU update was started. +// */ +func Xsqlite3rbu_progress(tls *libc.TLS, pRbu uintptr) (r Tsqlite3_int64) { + return int64((*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FnProgress) +} + +// C documentation +// +// /* +// ** Return permyriadage progress indications for the two main stages of +// ** an RBU update. +// */ +func Xsqlite3rbu_bp_progress(tls *libc.TLS, p uintptr, pnOne uintptr, pnTwo uintptr) { + var MAX_PROGRESS int32 + _ = MAX_PROGRESS + MAX_PROGRESS = int32(10000) + switch (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage { + case int32(RBU_STAGE_OAL): + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep > 0 { + *(*int32)(unsafe.Pointer(pnOne)) = int32(int64(MAX_PROGRESS) * int64((*Tsqlite3rbu)(unsafe.Pointer(p)).FnProgress) / (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep) + } else { + *(*int32)(unsafe.Pointer(pnOne)) = -int32(1) + } + *(*int32)(unsafe.Pointer(pnTwo)) = 0 + case int32(RBU_STAGE_MOVE): + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = 0 + case int32(RBU_STAGE_CKPT): + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = int32(int64(MAX_PROGRESS) * int64((*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep) / int64((*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame)) + case int32(RBU_STAGE_DONE): + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = MAX_PROGRESS + default: + } +} + +// C documentation +// +// /* +// ** Return the current state of the RBU vacuum or update operation. +// */ +func Xsqlite3rbu_state(tls *libc.TLS, p uintptr) (r int32) { + var aRes [6]int32 + _ = aRes + aRes = [6]int32{ + 1: int32(SQLITE_RBU_STATE_OAL), + 2: int32(SQLITE_RBU_STATE_MOVE), + 4: int32(SQLITE_RBU_STATE_CHECKPOINT), + 5: int32(SQLITE_RBU_STATE_DONE), + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != int32(SQLITE_DONE) { + return int32(SQLITE_RBU_STATE_ERROR) + } else { + return aRes[(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage] + } + return r +} + +func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { + var pDb, zBegin, v1 uintptr + var rc int32 + _, _, _, _ = pDb, rc, zBegin, v1 + rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + if rc == int32(SQLITE_DONE) { + return SQLITE_OK + } + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+14926, uintptr(0), uintptr(0), uintptr(0)) + } + } + /* Sync the db file */ + if rc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { + pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSync})))(tls, pDb, int32(SQLITE_SYNC_NORMAL)) + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) + rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+14926, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { + v1 = __ccgo_ts + 14911 + } else { + v1 = __ccgo_ts + 32964 + } + zBegin = v1 + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+32964, uintptr(0), uintptr(0), uintptr(0)) + } + } + (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc + return rc +} + +// C documentation +// +// /* +// ** Default xRename callback for RBU. +// */ +func _xDefaultRename(tls *libc.TLS, pArg uintptr, zOld uintptr, zNew uintptr) (r int32) { + var rc, v1 int32 + _, _ = rc, v1 + rc = SQLITE_OK + if libc.Xrename(tls, zOld, zNew) != 0 { + v1 = int32(SQLITE_IOERR) + } else { + v1 = SQLITE_OK + } + rc = v1 + return rc +} + +func Xsqlite3rbu_rename_handler(tls *libc.TLS, pRbu uintptr, pArg uintptr, xRename uintptr) { + if xRename != 0 { + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FxRename = xRename + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpRenameArg = pArg + } else { + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FxRename = __ccgo_fp(_xDefaultRename) + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpRenameArg = uintptr(0) + } +} + +/************************************************************************** +** Beginning of RBU VFS shim methods. The VFS shim modifies the behaviour +** of a standard VFS in the following ways: +** +** 1. Whenever the first page of a main database file is read or +** written, the value of the change-counter cookie is stored in +** rbu_file.iCookie. Similarly, the value of the "write-version" +** database header field is stored in rbu_file.iWriteVer. This ensures +** that the values are always trustworthy within an open transaction. +** +** 2. Whenever an SQLITE_OPEN_WAL file is opened, the (rbu_file.pWalFd) +** member variable of the associated database file descriptor is set +** to point to the new file. A mutex protected linked list of all main +** db fds opened using a particular RBU VFS is maintained at +** rbu_vfs.pMain to facilitate this. +** +** 3. Using a new file-control "SQLITE_FCNTL_RBU", a main db rbu_file +** object can be marked as the target database of an RBU update. This +** turns on the following extra special behaviour: +** +** 3a. If xAccess() is called to check if there exists a *-wal file +** associated with an RBU target database currently in RBU_STAGE_OAL +** stage (preparing the *-oal file), the following special handling +** applies: +** +** * if the *-wal file does exist, return SQLITE_CANTOPEN. An RBU +** target database may not be in wal mode already. +** +** * if the *-wal file does not exist, set the output parameter to +** non-zero (to tell SQLite that it does exist) anyway. +** +** Then, when xOpen() is called to open the *-wal file associated with +** the RBU target in RBU_STAGE_OAL stage, instead of opening the *-wal +** file, the rbu vfs opens the corresponding *-oal file instead. +** +** 3b. The *-shm pages returned by xShmMap() for a target db file in +** RBU_STAGE_OAL mode are actually stored in heap memory. This is to +** avoid creating a *-shm file on disk. Additionally, xShmLock() calls +** are no-ops on target database files in RBU_STAGE_OAL mode. This is +** because assert() statements in some VFS implementations fail if +** xShmLock() is called before xShmMap(). +** +** 3c. If an EXCLUSIVE lock is attempted on a target database file in any +** mode except RBU_STAGE_DONE (all work completed and checkpointed), it +** fails with an SQLITE_BUSY error. This is to stop RBU connections +** from automatically checkpointing a *-wal (or *-oal) file from within +** sqlite3_close(). +** +** 3d. In RBU_STAGE_CAPTURE mode, all xRead() calls on the wal file, and +** all xWrite() calls on the target database file perform no IO. +** Instead the frame and page numbers that would be read and written +** are recorded. Additionally, successful attempts to obtain exclusive +** xShmLock() WRITER, CHECKPOINTER and READ0 locks on the target +** database file are recorded. xShmLock() calls to unlock the same +** locks are no-ops (so that once obtained, these locks are never +** relinquished). Finally, calls to xSync() on the target database +** file fail with SQLITE_NOTICE errors. + */ + +func _rbuUnlockShm(tls *libc.TLS, p uintptr) { + var i int32 + var xShmLock uintptr + _, _ = i, xShmLock + if (*Trbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + xShmLock = (*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxShmLock + i = 0 + for { + if !(i < int32(SQLITE_SHM_NLOCK)) { + break + } + if uint32(libc.Int32FromInt32(1)< (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit { + return int32(SQLITE_FULL) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Add an item to the main-db lists, if it is not already present. +// ** +// ** There are two main-db lists. One for all file descriptors, and one +// ** for all file descriptors with rbu_file.pDb!=0. If the argument has +// ** rbu_file.pDb!=0, then it is assumed to already be present on the +// ** main list and is only added to the pDb!=0 list. +// */ +func _rbuMainlistAdd(tls *libc.TLS, p uintptr) { + var pIter, pRbuVfs uintptr + _, _ = pIter, pRbuVfs + pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs + Xsqlite3_mutex_enter(tls, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + if (*Trbu_file)(unsafe.Pointer(p)).FpRbu == uintptr(0) { + pIter = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain + for { + if !(pIter != 0) { + break + } + goto _1 + _1: + ; + pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainNext + } + (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain + (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain = p + } else { + pIter = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu + for { + if !(pIter != 0 && pIter != p) { + break + } + goto _2 + _2: + ; + pIter = (*Trbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext + } + if pIter == uintptr(0) { + (*Trbu_file)(unsafe.Pointer(p)).FpMainRbuNext = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu + (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu = p + } + } + Xsqlite3_mutex_leave(tls, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) +} + +// C documentation +// +// /* +// ** Remove an item from the main-db lists. +// */ +func _rbuMainlistRemove(tls *libc.TLS, p uintptr) { + var pp uintptr + _ = pp + Xsqlite3_mutex_enter(tls, (*Trbu_vfs)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs)).Fmutex) + pp = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs + 192 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0 && *(*uintptr)(unsafe.Pointer(pp)) != p) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 88 + } + if *(*uintptr)(unsafe.Pointer(pp)) != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*Trbu_file)(unsafe.Pointer(p)).FpMainNext + } + (*Trbu_file)(unsafe.Pointer(p)).FpMainNext = uintptr(0) + pp = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs + 200 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0 && *(*uintptr)(unsafe.Pointer(pp)) != p) { + break + } + goto _2 + _2: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 96 + } + if *(*uintptr)(unsafe.Pointer(pp)) != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*Trbu_file)(unsafe.Pointer(p)).FpMainRbuNext + } + (*Trbu_file)(unsafe.Pointer(p)).FpMainRbuNext = uintptr(0) + Xsqlite3_mutex_leave(tls, (*Trbu_vfs)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs)).Fmutex) +} + +// C documentation +// +// /* +// ** Given that zWal points to a buffer containing a wal file name passed to +// ** either the xOpen() or xAccess() VFS method, search the main-db list for +// ** a file-handle opened by the same database connection on the corresponding +// ** database file. +// ** +// ** If parameter bRbu is true, only search for file-descriptors with +// ** rbu_file.pDb!=0. +// */ +func _rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) (r uintptr) { + var pDb uintptr + _ = pDb + Xsqlite3_mutex_enter(tls, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + if bRbu != 0 { + pDb = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu + for { + if !(pDb != 0 && (*Trbu_file)(unsafe.Pointer(pDb)).FzWal != zWal) { + break + } + goto _1 + _1: + ; + pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext + } + } else { + pDb = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain + for { + if !(pDb != 0 && (*Trbu_file)(unsafe.Pointer(pDb)).FzWal != zWal) { + break + } + goto _2 + _2: + ; + pDb = (*Trbu_file)(unsafe.Pointer(pDb)).FpMainNext + } + } + Xsqlite3_mutex_leave(tls, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + return pDb +} + +// C documentation +// +// /* +// ** Close an rbu file. +// */ +func _rbuVfsClose(tls *libc.TLS, pFile uintptr) (r int32) { + var i, rc int32 + var p, pMeth uintptr + _, _, _, _ = i, p, pMeth, rc + p = pFile + /* Free the contents of the apShm[] array. And the array itself. */ + i = 0 + for { + if !(i < (*Trbu_file)(unsafe.Pointer(p)).FnShm) { + break + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FapShm) + (*Trbu_file)(unsafe.Pointer(p)).FapShm = uintptr(0) + Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(p)).FzDel) + if (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_MAIN_DB) != 0 { + pMeth = (*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + _rbuMainlistRemove(tls, p) + _rbuUnlockShm(tls, p) + if (*Tsqlite3_io_methods)(unsafe.Pointer(pMeth)).FiVersion > int32(1) && (*Tsqlite3_io_methods)(unsafe.Pointer(pMeth)).FxShmUnmap != 0 { + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer(pMeth)).FxShmUnmap})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, 0) + } + } else { + if (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_DELETEONCLOSE) != 0 && (*Trbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + _rbuUpdateTempSize(tls, p, 0) + } + } + /* Close the underlying file handle */ + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxClose})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal) + return rc +} + +// C documentation +// +// /* +// ** Read and return an unsigned 32-bit big-endian integer from the buffer +// ** passed as the only argument. +// */ +func _rbuGetU32(tls *libc.TLS, aBuf uintptr) (r Tu32) { + return uint32(*(*Tu8)(unsafe.Pointer(aBuf)))<> libc.Int32FromInt32(24) & uint32(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 1)) = uint8(iVal >> libc.Int32FromInt32(16) & uint32(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 2)) = uint8(iVal >> libc.Int32FromInt32(8) & uint32(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 3)) = uint8(iVal >> libc.Int32FromInt32(0) & uint32(0xFF)) +} + +func _rbuPutU16(tls *libc.TLS, aBuf uintptr, iVal Tu16) { + *(*Tu8)(unsafe.Pointer(aBuf)) = uint8(int32(iVal) >> int32(8) & int32(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 1)) = uint8(int32(iVal) >> 0 & int32(0xFF)) +} + +// C documentation +// +// /* +// ** Read data from an rbuVfs-file. +// */ +func _rbuVfsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Tsqlite_int64) (r int32) { + var aBuf, p, pBuf, pFd, pRbu uintptr + var iRoot Tu32 + var rc, v1 int32 + _, _, _, _, _, _, _, _ = aBuf, iRoot, p, pBuf, pFd, pRbu, rc, v1 + p = pFile + pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu + if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_CAPTURE) { + rc = _rbuCaptureWalRead(tls, (*Trbu_file)(unsafe.Pointer(p)).FpRbu, iOfst, iAmt) + } else { + if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_OAL) && (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_WAL) != 0 && iOfst >= (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz { + rc = SQLITE_OK + libc.Xmemset(tls, zBuf, 0, uint64(iAmt)) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxRead})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst) + /* If this is being called to read the first page of the target + ** database as part of an rbu vacuum operation, synthesize the + ** contents of the first page if it does not yet exist. Otherwise, + ** SQLite will not check for a *-wal file. */ + if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzTarget == uintptr(0) && rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(2)< int32(100) { + libc.Xmemset(tls, aBuf+100, 0, uint64(iAmt-int32(100))) + _rbuPutU16(tls, aBuf+105, uint16(iAmt&int32(0xFFFF))) + *(*Tu8)(unsafe.Pointer(aBuf + 100)) = uint8(0x0D) + } + } + } + } + if rc == SQLITE_OK && iOfst == 0 && (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_MAIN_DB) != 0 { + /* These look like magic numbers. But they are stable, as they are part + ** of the definition of the SQLite file format, which may not change. */ + pBuf = zBuf + (*Trbu_file)(unsafe.Pointer(p)).FiCookie = _rbuGetU32(tls, pBuf+24) + (*Trbu_file)(unsafe.Pointer(p)).FiWriteVer = *(*Tu8)(unsafe.Pointer(pBuf + 19)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Write data to an rbuVfs-file. +// */ +func _rbuVfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Tsqlite_int64) (r int32) { + var p, pBuf, pRbu uintptr + var rc int32 + var szNew Ti64 + _, _, _, _, _ = p, pBuf, pRbu, rc, szNew + p = pFile + pRbu = (*Trbu_file)(unsafe.Pointer(p)).FpRbu + if pRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_CAPTURE) { + rc = _rbuCaptureDbWrite(tls, (*Trbu_file)(unsafe.Pointer(p)).FpRbu, iOfst) + } else { + if pRbu != 0 { + if (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == int32(RBU_STAGE_OAL) && (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_WAL) != 0 && iOfst >= (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz { + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz = int64(iAmt) + iOfst + } else { + if (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_DELETEONCLOSE) != 0 { + szNew = int64(iAmt) + iOfst + if szNew > (*Trbu_file)(unsafe.Pointer(p)).Fsz { + rc = _rbuUpdateTempSize(tls, p, szNew) + if rc != SQLITE_OK { + return rc + } + } + } + } + } + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxWrite})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst) + if rc == SQLITE_OK && iOfst == 0 && (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_MAIN_DB) != 0 { + /* These look like magic numbers. But they are stable, as they are part + ** of the definition of the SQLite file format, which may not change. */ + pBuf = zBuf + (*Trbu_file)(unsafe.Pointer(p)).FiCookie = _rbuGetU32(tls, pBuf+24) + (*Trbu_file)(unsafe.Pointer(p)).FiWriteVer = *(*Tu8)(unsafe.Pointer(pBuf + 19)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Truncate an rbuVfs-file. +// */ +func _rbuVfsTruncate(tls *libc.TLS, pFile uintptr, size Tsqlite_int64) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + p = pFile + if (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_DELETEONCLOSE) != 0 && (*Trbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + rc = _rbuUpdateTempSize(tls, p, size) + if rc != SQLITE_OK { + return rc + } + } + return (*(*func(*libc.TLS, uintptr, Tsqlite3_int64) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods1)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxTruncate})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, size) +} + +// C documentation +// +// /* +// ** Sync an rbuVfs-file. +// */ +func _rbuVfsSync(tls *libc.TLS, pFile uintptr, flags int32) (r int32) { + var p uintptr + _ = p + p = pFile + if (*Trbu_file)(unsafe.Pointer(p)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpRbu)).FeStage == int32(RBU_STAGE_CAPTURE) { + if (*Trbu_file)(unsafe.Pointer(p)).FopenFlags&int32(SQLITE_OPEN_MAIN_DB) != 0 { + return libc.Int32FromInt32(SQLITE_NOTICE) | libc.Int32FromInt32(3)<zWal) to point to a buffer owned by SQLite that contains + ** the name of the *-wal file this db connection will use. SQLite + ** happens to pass a pointer to this buffer when using xAccess() + ** or xOpen() to operate on the *-wal file. */ + (*Trbu_file)(unsafe.Pointer(pFd)).FzWal = Xsqlite3_filename_wal(tls, zName) + } else { + if flags&int32(SQLITE_OPEN_WAL) != 0 { + pDb = _rbuFindMaindb(tls, pRbuVfs, zName, 0) + if pDb != 0 { + if (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { + if (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FzTarget == uintptr(0) { + zOpen = Xsqlite3_db_filename(tls, (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, __ccgo_ts+6617) + zOpen = Xsqlite3_filename_wal(tls, zOpen) + } + nOpen = libc.Xstrlen(tls, zOpen) + *(*int8)(unsafe.Pointer(zOpen + uintptr(nOpen-uint64(3)))) = int8('o') + (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_file)(unsafe.Pointer(pDb)).FpRbu + } + (*Trbu_file)(unsafe.Pointer(pDb)).FpWalFd = pFd + } + } + } + } else { + (*Trbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu + } + if oflags&int32(SQLITE_OPEN_MAIN_DB) != 0 && Xsqlite3_uri_boolean(tls, zName, __ccgo_ts+33073, 0) != 0 { + oflags = libc.Int32FromInt32(SQLITE_OPEN_TEMP_DB) | libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_EXCLUSIVE) | libc.Int32FromInt32(SQLITE_OPEN_DELETEONCLOSE) + zOpen = uintptr(0) + } + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, Tsqlite3_filename, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxOpen})))(tls, pRealVfs, zOpen, (*Trbu_file)(unsafe.Pointer(pFd)).FpReal, oflags, pOutFlags) + } + if (*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pFd)).FpReal)).FpMethods != 0 { + pMeth = (*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pFd)).FpReal)).FpMethods + /* The xOpen() operation has succeeded. Set the sqlite3_file.pMethods + ** pointer and, if the file is a main database file, link it into the + ** mutex protected linked list of all such files. */ + if (*Tsqlite3_io_methods)(unsafe.Pointer(pMeth)).FiVersion < int32(2) || (*Tsqlite3_io_methods)(unsafe.Pointer(pMeth)).FxShmLock == uintptr(0) { + (*Tsqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&_rbuvfs_io_methods1)) + } else { + (*Tsqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&_rbuvfs_io_methods)) + } + if flags&int32(SQLITE_OPEN_MAIN_DB) != 0 { + _rbuMainlistAdd(tls, pFd) + } + } else { + Xsqlite3_free(tls, (*Trbu_file)(unsafe.Pointer(pFd)).FzDel) + } + return rc +} + +var _rbuvfs_io_methods = Tsqlite3_io_methods{ + FiVersion: int32(2), +} + +func init() { + p := unsafe.Pointer(&_rbuvfs_io_methods) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_rbuVfsClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_rbuVfsRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_rbuVfsWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_rbuVfsTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_rbuVfsSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_rbuVfsFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rbuVfsLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rbuVfsUnlock) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_rbuVfsCheckReservedLock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rbuVfsFileControl) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_rbuVfsSectorSize) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_rbuVfsDeviceCharacteristics) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_rbuVfsShmMap) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rbuVfsShmLock) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rbuVfsShmBarrier) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rbuVfsShmUnmap) +} + +var _rbuvfs_io_methods1 = Tsqlite3_io_methods{ + FiVersion: int32(1), +} + +func init() { + p := unsafe.Pointer(&_rbuvfs_io_methods1) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_rbuVfsClose) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_rbuVfsRead) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_rbuVfsWrite) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_rbuVfsTruncate) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_rbuVfsSync) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_rbuVfsFileSize) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rbuVfsLock) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rbuVfsUnlock) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_rbuVfsCheckReservedLock) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rbuVfsFileControl) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_rbuVfsSectorSize) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_rbuVfsDeviceCharacteristics) +} + +// C documentation +// +// /* +// ** Delete the file located at zPath. +// */ +func _rbuVfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) (r int32) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxDelete})))(tls, pRealVfs, zPath, dirSync) +} + +// C documentation +// +// /* +// ** Test for access permissions. Return true if the requested permission +// ** is available, or false otherwise. +// */ +func _rbuVfsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var pDb, pRbuVfs, pRealVfs uintptr + var rc int32 + var _ /* sz at bp+0 */ Tsqlite3_int64 + _, _, _, _ = pDb, pRbuVfs, pRealVfs, rc + pRbuVfs = pVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRealVfs + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxAccess})))(tls, pRealVfs, zPath, flags, pResOut) + /* If this call is to check if a *-wal file associated with an RBU target + ** database connection exists, and the RBU update is in RBU_STAGE_OAL, + ** the following special handling is activated: + ** + ** a) if the *-wal file does exist, return SQLITE_CANTOPEN. This + ** ensures that the RBU extension never tries to update a database + ** in wal mode, even if the first page of the database file has + ** been damaged. + ** + ** b) if the *-wal file does not exist, claim that it does anyway, + ** causing SQLite to call xOpen() to open it. This call will also + ** be intercepted (see the rbuVfsOpen() function) and the *-oal + ** file opened instead. + */ + if rc == SQLITE_OK && flags == SQLITE_ACCESS_EXISTS { + pDb = _rbuFindMaindb(tls, pRbuVfs, zPath, int32(1)) + if pDb != 0 && (*Tsqlite3rbu)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == int32(RBU_STAGE_OAL) { + if *(*int32)(unsafe.Pointer(pResOut)) != 0 { + rc = int32(SQLITE_CANTOPEN) + } else { + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = 0 + rc = _rbuVfsFileSize(tls, pDb, bp) + *(*int32)(unsafe.Pointer(pResOut)) = libc.BoolInt32(*(*Tsqlite3_int64)(unsafe.Pointer(bp)) > 0) + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Populate buffer zOut with the full canonical pathname corresponding +// ** to the pathname in zPath. zOut is guaranteed to point to a buffer +// ** of at least (DEVSYM_MAX_PATHNAME+1) bytes. +// */ +func _rbuVfsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) (r int32) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxFullPathname})))(tls, pRealVfs, zPath, nOut, zOut) +} + +// C documentation +// +// /* +// ** Open the dynamic library located at zPath and return a handle. +// */ +func _rbuVfsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) (r uintptr) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxDlOpen})))(tls, pRealVfs, zPath) +} + +// C documentation +// +// /* +// ** Populate the buffer zErrMsg (size nByte bytes) with a human readable +// ** utf-8 string describing the most recent error encountered associated +// ** with dynamic libraries. +// */ +func _rbuVfsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxDlError})))(tls, pRealVfs, nByte, zErrMsg) +} + +// C documentation +// +// /* +// ** Return a pointer to the symbol zSymbol in the dynamic library pHandle. +// */ +func _rbuVfsDlSym(tls *libc.TLS, pVfs uintptr, pArg uintptr, zSym uintptr) (r uintptr) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxDlSym})))(tls, pRealVfs, pArg, zSym) +} + +// C documentation +// +// /* +// ** Close the dynamic library handle pHandle. +// */ +func _rbuVfsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxDlClose})))(tls, pRealVfs, pHandle) +} + +// C documentation +// +// /* +// ** Populate the buffer pointed to by zBufOut with nByte bytes of +// ** random data. +// */ +func _rbuVfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) (r int32) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxRandomness})))(tls, pRealVfs, nByte, zBufOut) +} + +// C documentation +// +// /* +// ** Sleep for nMicro microseconds. Return the number of microseconds +// ** actually slept. +// */ +func _rbuVfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) (r int32) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxSleep})))(tls, pRealVfs, nMicro) +} + +// C documentation +// +// /* +// ** Return the current time as a Julian Day number in *pTimeOut. +// */ +func _rbuVfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) (r int32) { + var pRealVfs uintptr + _ = pRealVfs + pRealVfs = (*Trbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pRealVfs)).FxCurrentTime})))(tls, pRealVfs, pTimeOut) +} + +// C documentation +// +// /* +// ** No-op. +// */ +func _rbuVfsGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) (r int32) { + return 0 +} + +// C documentation +// +// /* +// ** Deregister and destroy an RBU vfs created by an earlier call to +// ** sqlite3rbu_create_vfs(). +// */ +func Xsqlite3rbu_destroy_vfs(tls *libc.TLS, zName uintptr) { + var pVfs uintptr + _ = pVfs + pVfs = Xsqlite3_vfs_find(tls, zName) + if pVfs != 0 && (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen == __ccgo_fp(_rbuVfsOpen) { + Xsqlite3_mutex_free(tls, (*Trbu_vfs)(unsafe.Pointer(pVfs)).Fmutex) + Xsqlite3_vfs_unregister(tls, pVfs) + Xsqlite3_free(tls, pVfs) + } +} + +// C documentation +// +// /* +// ** Create an RBU VFS named zName that accesses the underlying file-system +// ** via existing VFS zParent. The new object is registered as a non-default +// ** VFS with SQLite before returning. +// */ +func Xsqlite3rbu_create_vfs(tls *libc.TLS, zName uintptr, zParent uintptr) (r int32) { + var nByte, nName Tsize_t + var pNew, pParent, zSpace, v1 uintptr + var rc int32 + _, _, _, _, _, _, _ = nByte, nName, pNew, pParent, rc, zSpace, v1 + pNew = uintptr(0) /* Newly allocated VFS */ + rc = SQLITE_OK + nName = libc.Xstrlen(tls, zName) + nByte = uint64(208) + nName + uint64(1) + pNew = Xsqlite3_malloc64(tls, nByte) + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { /* Parent VFS */ + libc.Xmemset(tls, pNew, 0, nByte) + pParent = Xsqlite3_vfs_find(tls, zParent) + if pParent == uintptr(0) { + rc = int32(SQLITE_NOTFOUND) + } else { + libc.Xmemcpy(tls, pNew, uintptr(unsafe.Pointer(&_vfs_template)), uint64(168)) + (*Trbu_vfs)(unsafe.Pointer(pNew)).Fbase.FmxPathname = (*Tsqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname + (*Trbu_vfs)(unsafe.Pointer(pNew)).Fbase.FszOsFile = int32(uint64(104) + uint64((*Tsqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)) + (*Trbu_vfs)(unsafe.Pointer(pNew)).FpRealVfs = pParent + v1 = pNew + 1*208 + zSpace = v1 + (*Trbu_vfs)(unsafe.Pointer(pNew)).Fbase.FzName = v1 + libc.Xmemcpy(tls, zSpace, zName, nName) + /* Allocate the mutex and register the new VFS (not as the default) */ + (*Trbu_vfs)(unsafe.Pointer(pNew)).Fmutex = Xsqlite3_mutex_alloc(tls, int32(SQLITE_MUTEX_RECURSIVE)) + if (*Trbu_vfs)(unsafe.Pointer(pNew)).Fmutex == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_vfs_register(tls, pNew, 0) + } + } + if rc != SQLITE_OK { + Xsqlite3_mutex_free(tls, (*Trbu_vfs)(unsafe.Pointer(pNew)).Fmutex) + Xsqlite3_free(tls, pNew) + } + } + return rc +} + +/* Template for VFS */ +var _vfs_template = Tsqlite3_vfs{ + FiVersion: int32(1), +} + +func init() { + p := unsafe.Pointer(&_vfs_template) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_rbuVfsOpen) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_rbuVfsDelete) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_rbuVfsAccess) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_rbuVfsFullPathname) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_rbuVfsDlOpen) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_rbuVfsDlError) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_rbuVfsDlSym) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_rbuVfsDlClose) + *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_rbuVfsRandomness) + *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_rbuVfsSleep) + *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_rbuVfsCurrentTime) + *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(_rbuVfsGetLastError) +} + +// C documentation +// +// /* +// ** Configure the aggregate temp file size limit for this RBU handle. +// */ +func Xsqlite3rbu_temp_size_limit(tls *libc.TLS, pRbu uintptr, n Tsqlite3_int64) (r Tsqlite3_int64) { + if n >= 0 { + (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit = n + } + return (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit +} + +func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) (r Tsqlite3_int64) { + return (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FszTemp +} + +/**************************************************************************/ + +/************** End of sqlite3rbu.c ******************************************/ +/************** Begin file dbstat.c ******************************************/ +/* +** 2010 July 12 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains an implementation of the "dbstat" virtual table. +** +** The dbstat virtual table is used to extract low-level storage +** information from an SQLite database in order to implement the +** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +** for an example implementation. +** +** Additional information is available on the "dbstat.html" page of the +** official SQLite documentation. + */ + +/* #include "sqliteInt.h" ** Requires access to internal data structures ** */ + +/* +** The pager and btree modules arrange objects in memory so that there are +** always approximately 200 bytes of addressable memory following each page +** buffer. This way small buffer overreads caused by corrupt database pages +** do not cause undefined behaviour. This module pads each page buffer +** by the following number of bytes for the same purpose. + */ + +// C documentation +// +// /* +// ** Page paths: +// ** +// ** The value of the 'path' column describes the path taken from the +// ** root-node of the b-tree structure to each page. The value of the +// ** root-node path is '/'. +// ** +// ** The value of the path for the left-most child page of the root of +// ** a b-tree is '/000/'. (Btrees store content ordered from left to right +// ** so the pages to the left have smaller keys than the pages to the right.) +// ** The next to left-most child of the root page is +// ** '/001', and so on, each sibling page identified by a 3-digit hex +// ** value. The children of the 451st left-most sibling have paths such +// ** as '/1c2/000/, '/1c2/001/' etc. +// ** +// ** Overflow pages are specified by appending a '+' character and a +// ** six-digit hexadecimal value to the path to the cell they are linked +// ** from. For example, the three overflow pages in a chain linked from +// ** the left-most cell of the 450th child of the root page are identified +// ** by the paths: +// ** +// ** '/1c2/000+000000' // First page in overflow chain +// ** '/1c2/000+000001' // Second page in overflow chain +// ** '/1c2/000+000002' // Third page in overflow chain +// ** +// ** If the paths are sorted using the BINARY collation sequence, then +// ** the overflow pages associated with a cell will appear earlier in the +// ** sort-order than its child page: +// ** +// ** '/1c2/000/' // Left-most child of 451st child of root +// */ +var _zDbstatSchema = [258]int8{'C', 'R', 'E', 'A', 'T', 'E', ' ', 'T', 'A', 'B', 'L', 'E', ' ', 'x', '(', ' ', 'n', 'a', 'm', 'e', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'p', 'a', 't', 'h', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'p', 'a', 'g', 'e', 'n', 'o', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'a', 'g', 'e', 't', 'y', 'p', 'e', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'n', 'c', 'e', 'l', 'l', ' ', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'a', 'y', 'l', 'o', 'a', 'd', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'u', 'n', 'u', 's', 'e', 'd', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'm', 'x', '_', 'p', 'a', 'y', 'l', 'o', 'a', 'd', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'g', 'o', 'f', 'f', 's', 'e', 't', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'g', 's', 'i', 'z', 'e', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 's', 'c', 'h', 'e', 'm', 'a', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ' ', 'H', 'I', 'D', 'D', 'E', 'N', ',', ' ', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', ' ', ' ', 'B', 'O', 'O', 'L', 'E', 'A', 'N', ' ', 'H', 'I', 'D', 'D', 'E', 'N', ')'} + +// C documentation +// +// /* Forward reference to data structured used in this module */ +type TStatTable = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FiDb int32 +} + +type StatTable = TStatTable + +type TStatCursor = struct { + Fbase Tsqlite3_vtab_cursor + FpStmt uintptr + FisEof Tu8 + FisAgg Tu8 + FiDb int32 + FaPage [32]TStatPage + FiPage int32 + FiPageno Tu32 + FzName uintptr + FzPath uintptr + FzPagetype uintptr + FnPage int32 + FnCell int32 + FnMxPayload int32 + FnUnused Ti64 + FnPayload Ti64 + FiOffset Ti64 + FszPage Ti64 +} + +type StatCursor = TStatCursor + +type TStatPage = struct { + FiPgno Tu32 + FaPg uintptr + FiCell int32 + FzPath uintptr + Fflags Tu8 + FnCell int32 + FnUnused int32 + FaCell uintptr + FiRightChildPg Tu32 + FnMxPayload int32 +} + +type StatPage = TStatPage + +type TStatCell = struct { + FnLocal int32 + FiChildPg Tu32 + FnOvfl int32 + FaOvfl uintptr + FnLastOvfl int32 + FiOvfl int32 +} + +type StatCell = TStatCell + +/* Size information for a single cell within a btree page */ +type TStatCell1 = struct { + FnLocal int32 + FiChildPg Tu32 + FnOvfl int32 + FaOvfl uintptr + FnLastOvfl int32 + FiOvfl int32 +} + +type StatCell1 = TStatCell1 + +/* Size information for a single btree page */ +type TStatPage1 = struct { + FiPgno Tu32 + FaPg uintptr + FiCell int32 + FzPath uintptr + Fflags Tu8 + FnCell int32 + FnUnused int32 + FaCell uintptr + FiRightChildPg Tu32 + FnMxPayload int32 +} + +type StatPage1 = TStatPage1 + +/* The cursor for scanning the dbstat virtual table */ +type TStatCursor1 = struct { + Fbase Tsqlite3_vtab_cursor + FpStmt uintptr + FisEof Tu8 + FisAgg Tu8 + FiDb int32 + FaPage [32]TStatPage + FiPage int32 + FiPageno Tu32 + FzName uintptr + FzPath uintptr + FzPagetype uintptr + FnPage int32 + FnCell int32 + FnMxPayload int32 + FnUnused Ti64 + FnPayload Ti64 + FiOffset Ti64 + FszPage Ti64 +} + +type StatCursor1 = TStatCursor1 + +/* An instance of the DBSTAT virtual table */ +type TStatTable1 = struct { + Fbase Tsqlite3_vtab + Fdb uintptr + FiDb int32 +} + +type StatTable1 = TStatTable1 + +// C documentation +// +// /* +// ** Connect to or create a new DBSTAT virtual table. +// */ +func _statConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var iDb, rc int32 + var pTab uintptr + var _ /* nm at bp+0 */ TToken + _, _, _ = iDb, pTab, rc + pTab = uintptr(0) + rc = SQLITE_OK + _ = pAux + if argc >= int32(4) { + _sqlite3TokenInit(tls, bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + iDb = _sqlite3FindDb(tls, db, bp) + if iDb < 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+12223, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + return int32(SQLITE_ERROR) + } + } else { + iDb = 0 + } + Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_DIRECTONLY), 0) + rc = Xsqlite3_declare_vtab(tls, db, uintptr(unsafe.Pointer(&_zDbstatSchema))) + if rc == SQLITE_OK { + pTab = Xsqlite3_malloc64(tls, uint64(40)) + if pTab == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + if rc == SQLITE_OK { + libc.Xmemset(tls, pTab, 0, uint64(40)) + (*TStatTable)(unsafe.Pointer(pTab)).Fdb = db + (*TStatTable)(unsafe.Pointer(pTab)).FiDb = iDb + } + *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab + return rc +} + +// C documentation +// +// /* +// ** Disconnect from or destroy the DBSTAT virtual table. +// */ +func _statDisconnect(tls *libc.TLS, pVtab uintptr) (r int32) { + Xsqlite3_free(tls, pVtab) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Compute the best query strategy and return the result in idxNum. +// ** +// ** idxNum-Bit Meaning +// ** ---------- ---------------------------------------------- +// ** 0x01 There is a schema=? term in the WHERE clause +// ** 0x02 There is a name=? term in the WHERE clause +// ** 0x04 There is an aggregate=? term in the WHERE clause +// ** 0x08 Output should be ordered by name and path +// */ +func _statBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { + var i, iAgg, iName, iSchema, v2, v3, v4 int32 + _, _, _, _, _, _, _ = i, iAgg, iName, iSchema, v2, v3, v4 + iSchema = -int32(1) + iName = -int32(1) + iAgg = -int32(1) + _ = tab + /* Look for a valid schema=? constraint. If found, change the idxNum to + ** 1 and request the value of that constraint be sent to xFilter. And + ** lower the cost estimate to encourage the constrained version to be + ** used. + */ + i = 0 + for { + if !(i < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + break + } + if int32((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).Fop) != int32(SQLITE_INDEX_CONSTRAINT_EQ) { + goto _1 + } + if int32((*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).Fusable) == 0 { + /* Force DBSTAT table should always be the right-most table in a join */ + return int32(SQLITE_CONSTRAINT) + } + switch (*(*Tsqlite3_index_constraint)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12))).FiColumn { + case 0: /* name */ + iName = i + case int32(10): /* schema */ + iSchema = i + case int32(11): /* aggregate */ + iAgg = i + break + } + goto _1 + _1: + ; + i++ + } + i = 0 + if iSchema >= 0 { + i++ + v2 = i + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iSchema)*8))).FargvIndex = v2 + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iSchema)*8))).Fomit = uint8(1) + *(*int32)(unsafe.Pointer(pIdxInfo + 40)) |= int32(0x01) + } + if iName >= 0 { + i++ + v3 = i + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iName)*8))).FargvIndex = v3 + *(*int32)(unsafe.Pointer(pIdxInfo + 40)) |= int32(0x02) + } + if iAgg >= 0 { + i++ + v4 = i + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iAgg)*8))).FargvIndex = v4 + *(*int32)(unsafe.Pointer(pIdxInfo + 40)) |= int32(0x04) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1) + /* Records are always returned in ascending order of (name, path). + ** If this will satisfy the client, set the orderByConsumed flag so that + ** SQLite does not do an external sort. + */ + if (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == int32(1) && (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).FiColumn == 0 && int32((*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).Fdesc) == 0 || (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == int32(2) && (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).FiColumn == 0 && int32((*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy))).Fdesc) == 0 && (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + 1*8))).FiColumn == int32(1) && int32((*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + 1*8))).Fdesc) == 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = int32(1) + *(*int32)(unsafe.Pointer(pIdxInfo + 40)) |= int32(0x08) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Open a new DBSTAT cursor. +// */ +func _statOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) (r int32) { + var pCsr, pTab uintptr + _, _ = pCsr, pTab + pTab = pVTab + pCsr = Xsqlite3_malloc64(tls, uint64(2152)) + if pCsr == uintptr(0) { + return int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pCsr, 0, uint64(2152)) + (*TStatCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab = pVTab + (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb = (*TStatTable)(unsafe.Pointer(pTab)).FiDb + } + *(*uintptr)(unsafe.Pointer(ppCursor)) = pCsr + return SQLITE_OK +} + +func _statClearCells(tls *libc.TLS, p uintptr) { + var i int32 + _ = i + if (*TStatPage)(unsafe.Pointer(p)).FaCell != 0 { + i = 0 + for { + if !(i < (*TStatPage)(unsafe.Pointer(p)).FnCell) { + break + } + Xsqlite3_free(tls, (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32))).FaOvfl) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell) + } + (*TStatPage)(unsafe.Pointer(p)).FnCell = 0 + (*TStatPage)(unsafe.Pointer(p)).FaCell = uintptr(0) +} + +func _statClearPage(tls *libc.TLS, p uintptr) { + var aPg uintptr + _ = aPg + aPg = (*TStatPage)(unsafe.Pointer(p)).FaPg + _statClearCells(tls, p) + Xsqlite3_free(tls, (*TStatPage)(unsafe.Pointer(p)).FzPath) + libc.Xmemset(tls, p, 0, uint64(64)) + (*TStatPage)(unsafe.Pointer(p)).FaPg = aPg +} + +func _statResetCsr(tls *libc.TLS, pCsr uintptr) { + var i int32 + _ = i + /* In some circumstances, specifically if an OOM has occurred, the call + ** to sqlite3_reset() may cause the pager to be reset (emptied). It is + ** important that statClearPage() is called to free any page refs before + ** this happens. dbsqlfuzz 9ed3e4e3816219d3509d711636c38542bf3f40b1. */ + i = 0 + for { + if !(i < int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64))) { + break + } + _statClearPage(tls, pCsr+24+uintptr(i)*64) + Xsqlite3_free(tls, (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg) + (*(*TStatPage)(unsafe.Pointer(pCsr + 24 + uintptr(i)*64))).FaPg = uintptr(0) + goto _1 + _1: + ; + i++ + } + Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage = 0 + Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) + (*TStatCursor)(unsafe.Pointer(pCsr)).FisEof = uint8(0) +} + +// C documentation +// +// /* Resize the space-used counters inside of the cursor */ +func _statResetCounts(tls *libc.TLS, pCsr uintptr) { + (*TStatCursor)(unsafe.Pointer(pCsr)).FnCell = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage = 0 +} + +// C documentation +// +// /* +// ** Close a DBSTAT cursor. +// */ +func _statClose(tls *libc.TLS, pCursor uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = pCursor + _statResetCsr(tls, pCsr) + Xsqlite3_finalize(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + Xsqlite3_free(tls, pCsr) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** For a single cell on a btree page, compute the number of bytes of +// ** content (payload) stored on that page. That is to say, compute the +// ** number of bytes of content not found on overflow pages. +// */ +func _getLocalPayload(tls *libc.TLS, nUsable int32, flags Tu8, nTotal int32) (r int32) { + var nLocal, nMaxLocal, nMinLocal int32 + _, _, _ = nLocal, nMaxLocal, nMinLocal + if int32(flags) == int32(0x0D) { /* Table leaf node */ + nMinLocal = (nUsable-int32(12))*int32(32)/int32(255) - int32(23) + nMaxLocal = nUsable - int32(35) + } else { /* Index interior and leaf nodes */ + nMinLocal = (nUsable-int32(12))*int32(32)/int32(255) - int32(23) + nMaxLocal = (nUsable-int32(12))*int32(64)/int32(255) - int32(23) + } + nLocal = nMinLocal + (nTotal-nMinLocal)%(nUsable-int32(4)) + if nLocal > nMaxLocal { + nLocal = nMinLocal + } + return nLocal +} + +// C documentation +// +// /* Populate the StatPage object with information about the all +// ** cells found on the page currently under analysis. +// */ +func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aData, aHdr, pCell uintptr + var i, iNext, iOff, isLeaf, j, nHdr, nLocal, nOvfl, nUnused, nUsable, rc, szPage, v1, v4 int32 + var iPrev Tu32 + var v2 uint32 + var _ /* dummy at bp+8 */ Tu64 + var _ /* nPayload at bp+0 */ Tu32 + var _ /* pPg at bp+16 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aData, aHdr, i, iNext, iOff, iPrev, isLeaf, j, nHdr, nLocal, nOvfl, nUnused, nUsable, pCell, rc, szPage, v1, v2, v4 + aData = (*TStatPage)(unsafe.Pointer(p)).FaPg + if (*TStatPage)(unsafe.Pointer(p)).FiPgno == uint32(1) { + v1 = int32(100) + } else { + v1 = 0 + } + aHdr = aData + uintptr(v1) + (*TStatPage)(unsafe.Pointer(p)).Fflags = *(*Tu8)(unsafe.Pointer(aHdr)) + if int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x0A) || int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x0D) { + isLeaf = int32(1) + nHdr = int32(8) + } else { + if int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x05) || int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x02) { + isLeaf = 0 + nHdr = int32(12) + } else { + goto statPageIsCorrupt + } + } + if (*TStatPage)(unsafe.Pointer(p)).FiPgno == uint32(1) { + nHdr += int32(100) + } + (*TStatPage)(unsafe.Pointer(p)).FnCell = int32(*(*Tu8)(unsafe.Pointer(aHdr + 3)))<= szPage { + goto statPageIsCorrupt + } + nUnused += int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(iOff+int32(2)))))< 0 { + goto statPageIsCorrupt + } + iOff = iNext + } + (*TStatPage)(unsafe.Pointer(p)).FnUnused = nUnused + if isLeaf != 0 { + v2 = uint32(0) + } else { + v2 = _sqlite3Get4byte(tls, aHdr+8) + } + (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg = v2 + if (*TStatPage)(unsafe.Pointer(p)).FnCell != 0 { /* Usable bytes per page */ + _sqlite3BtreeEnter(tls, pBt) + nUsable = szPage - _sqlite3BtreeGetReserveNoMutex(tls, pBt) + _sqlite3BtreeLeave(tls, pBt) + (*TStatPage)(unsafe.Pointer(p)).FaCell = Xsqlite3_malloc64(tls, uint64((*TStatPage)(unsafe.Pointer(p)).FnCell+libc.Int32FromInt32(1))*uint64(32)) + if (*TStatPage)(unsafe.Pointer(p)).FaCell == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, (*TStatPage)(unsafe.Pointer(p)).FaCell, 0, uint64((*TStatPage)(unsafe.Pointer(p)).FnCell+libc.Int32FromInt32(1))*uint64(32)) + i = 0 + for { + if !(i < (*TStatPage)(unsafe.Pointer(p)).FnCell) { + break + } + pCell = (*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr(i)*32 + iOff = int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(nHdr+i*int32(2)))))<= szPage { + goto statPageIsCorrupt + } + if !(isLeaf != 0) { + (*TStatCell)(unsafe.Pointer(pCell)).FiChildPg = _sqlite3Get4byte(tls, aData+uintptr(iOff)) + iOff += int32(4) + } + if int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x05) { + /* A table interior node. nPayload==0. */ + } else { /* Bytes of payload stored locally */ + if int32(*(*Tu8)(unsafe.Pointer(aData + uintptr(iOff)))) < int32(libc.Uint8FromInt32(0x80)) { + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(aData + uintptr(iOff)))) + v4 = libc.Int32FromInt32(1) + } else { + v4 = int32(_sqlite3GetVarint32(tls, aData+uintptr(iOff), bp)) + } + iOff += int32(uint8(v4)) + if int32((*TStatPage)(unsafe.Pointer(p)).Fflags) == int32(0x0D) { + iOff += int32(_sqlite3GetVarint(tls, aData+uintptr(iOff), bp+8)) + } + if *(*Tu32)(unsafe.Pointer(bp)) > uint32((*TStatPage)(unsafe.Pointer(p)).FnMxPayload) { + (*TStatPage)(unsafe.Pointer(p)).FnMxPayload = int32(*(*Tu32)(unsafe.Pointer(bp))) + } + nLocal = _getLocalPayload(tls, nUsable, (*TStatPage)(unsafe.Pointer(p)).Fflags, int32(*(*Tu32)(unsafe.Pointer(bp)))) + if nLocal < 0 { + goto statPageIsCorrupt + } + (*TStatCell)(unsafe.Pointer(pCell)).FnLocal = nLocal + if *(*Tu32)(unsafe.Pointer(bp)) > uint32(nLocal) { + nOvfl = int32((*(*Tu32)(unsafe.Pointer(bp)) - uint32(nLocal) + uint32(nUsable) - uint32(4) - uint32(1)) / uint32(nUsable-libc.Int32FromInt32(4))) + if iOff+nLocal+int32(4) > nUsable || *(*Tu32)(unsafe.Pointer(bp)) > uint32(0x7fffffff) { + goto statPageIsCorrupt + } + (*TStatCell)(unsafe.Pointer(pCell)).FnLastOvfl = int32(*(*Tu32)(unsafe.Pointer(bp)) - uint32(nLocal) - uint32((nOvfl-int32(1))*(nUsable-int32(4)))) + (*TStatCell)(unsafe.Pointer(pCell)).FnOvfl = nOvfl + (*TStatCell)(unsafe.Pointer(pCell)).FaOvfl = Xsqlite3_malloc64(tls, uint64(4)*uint64(nOvfl)) + if (*TStatCell)(unsafe.Pointer(pCell)).FaOvfl == uintptr(0) { + return int32(SQLITE_NOMEM) + } + *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl)) = _sqlite3Get4byte(tls, aData+uintptr(iOff+nLocal)) + j = int32(1) + for { + if !(j < nOvfl) { + break + } + iPrev = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(j-int32(1))*4)) + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + rc = _sqlite3PagerGet(tls, _sqlite3BtreePager(tls, pBt), iPrev, bp+16, 0) + if rc != SQLITE_OK { + return rc + } + *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(j)*4)) = _sqlite3Get4byte(tls, _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 16)))) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + goto _5 + _5: + ; + j++ + } + } + } + goto _3 + _3: + ; + i++ + } + } + return SQLITE_OK +statPageIsCorrupt: + ; + (*TStatPage)(unsafe.Pointer(p)).Fflags = uint8(0) + _statClearCells(tls, p) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on +// ** the current value of pCsr->iPageno. +// */ +func _statSizeAndOffset(tls *libc.TLS, pCsr uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var fd, pBt, pPager, pTab uintptr + var _ /* x at bp+0 */ [2]Tsqlite3_int64 + _, _, _, _ = fd, pBt, pPager, pTab + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCsr)).FpVtab + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatTable)(unsafe.Pointer(pTab)).FiDb)*32))).FpBt + pPager = _sqlite3BtreePager(tls, pBt) + /* If connected to a ZIPVFS backend, find the page size and + ** offset from ZIPVFS. + */ + fd = _sqlite3PagerFile(tls, pPager) + (*(*[2]Tsqlite3_int64)(unsafe.Pointer(bp)))[0] = int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno) + if _sqlite3OsFileControl(tls, fd, int32(230440), bp) == SQLITE_OK { + (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset = (*(*[2]Tsqlite3_int64)(unsafe.Pointer(bp)))[0] + *(*Ti64)(unsafe.Pointer(pCsr + 2144)) += (*(*[2]Tsqlite3_int64)(unsafe.Pointer(bp)))[int32(1)] + } else { + /* Not ZIPVFS: The default page size and offset */ + *(*Ti64)(unsafe.Pointer(pCsr + 2144)) += int64(_sqlite3BtreeGetPageSize(tls, pBt)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset = (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage * int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno-libc.Uint32FromInt32(1)) + } +} + +// C documentation +// +// /* +// ** Load a copy of the page data for page iPg into the buffer belonging +// ** to page object pPg. Allocate the buffer if necessary. Return SQLITE_OK +// ** if successful, or an SQLite error code otherwise. +// */ +func _statGetPage(tls *libc.TLS, pBt uintptr, iPg Tu32, pPg uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a uintptr + var pgsz, rc int32 + var _ /* pDbPage at bp+0 */ uintptr + _, _, _ = a, pgsz, rc + pgsz = _sqlite3BtreeGetPageSize(tls, pBt) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if (*TStatPage)(unsafe.Pointer(pPg)).FaPg == uintptr(0) { + (*TStatPage)(unsafe.Pointer(pPg)).FaPg = Xsqlite3_malloc(tls, pgsz+int32(DBSTAT_PAGE_PADDING_BYTES)) + if (*TStatPage)(unsafe.Pointer(pPg)).FaPg == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, (*TStatPage)(unsafe.Pointer(pPg)).FaPg+uintptr(pgsz), 0, uint64(DBSTAT_PAGE_PADDING_BYTES)) + } + rc = _sqlite3PagerGet(tls, _sqlite3BtreePager(tls, pBt), iPg, bp, 0) + if rc == SQLITE_OK { + a = _sqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp))) + libc.Xmemcpy(tls, (*TStatPage)(unsafe.Pointer(pPg)).FaPg, a, uint64(pgsz)) + _sqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Move a DBSTAT cursor to the next entry. Normally, the next +// ** entry will be the next page, but in aggregated mode (pCsr->isAgg!=0), +// ** the next entry is the next btree. +// */ +func _statNext(tls *libc.TLS, pCursor uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i, iOvfl, nPayload, nUsable, rc, v3 int32 + var iRoot Tu32 + var p, p1, pBt, pCell, pCsr, pPager, pTab, z, v1, v2, v4, v5 uintptr + var _ /* nPage at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = i, iOvfl, iRoot, nPayload, nUsable, p, p1, pBt, pCell, pCsr, pPager, pTab, rc, z, v1, v2, v3, v4, v5 + pCsr = pCursor + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + pBt = (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FpBt + pPager = _sqlite3BtreePager(tls, pBt) + Xsqlite3_free(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = uintptr(0) +statNextRestart: + ; + if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { + /* Start measuring space on the next btree */ + _statResetCounts(tls, pCsr) + rc = Xsqlite3_step(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + if rc == int32(SQLITE_ROW) { + iRoot = uint32(Xsqlite3_column_int64(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1))) + _sqlite3PagerPagecount(tls, pPager, bp) + if *(*int32)(unsafe.Pointer(bp)) == 0 { + (*TStatCursor)(unsafe.Pointer(pCsr)).FisEof = uint8(1) + return Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + } + rc = _statGetPage(tls, pBt, iRoot, pCsr+24) + (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiPgno = iRoot + (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FiCell = 0 + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + v1 = Xsqlite3_mprintf(tls, __ccgo_ts+33084, 0) + z = v1 + (*(*TStatPage)(unsafe.Pointer(pCsr + 24))).FzPath = v1 + if z == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage = int32(1) + } else { + (*TStatCursor)(unsafe.Pointer(pCsr)).FisEof = uint8(1) + return Xsqlite3_reset(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + } + } else { + /* Continue analyzing the btree previously started */ + p = pCsr + 24 + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiPage)*64 + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + _statResetCounts(tls, pCsr) + } + for (*TStatPage)(unsafe.Pointer(p)).FiCell < (*TStatPage)(unsafe.Pointer(p)).FnCell { + pCell = (*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr((*TStatPage)(unsafe.Pointer(p)).FiCell)*32 + for (*TStatCell)(unsafe.Pointer(pCell)).FiOvfl < (*TStatCell)(unsafe.Pointer(pCell)).FnOvfl { + _sqlite3BtreeEnter(tls, pBt) + nUsable = _sqlite3BtreeGetPageSize(tls, pBt) - _sqlite3BtreeGetReserveNoMutex(tls, pBt) + _sqlite3BtreeLeave(tls, pBt) + (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ + _statSizeAndOffset(tls, pCsr) + if (*TStatCell)(unsafe.Pointer(pCell)).FiOvfl < (*TStatCell)(unsafe.Pointer(pCell)).FnOvfl-int32(1) { + *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nUsable - int32(4)) + } else { + *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64((*TStatCell)(unsafe.Pointer(pCell)).FnLastOvfl) + *(*Ti64)(unsafe.Pointer(pCsr + 2120)) += int64(nUsable - int32(4) - (*TStatCell)(unsafe.Pointer(pCell)).FnLastOvfl) + } + iOvfl = (*TStatCell)(unsafe.Pointer(pCell)).FiOvfl + (*TStatCell)(unsafe.Pointer(pCell)).FiOvfl++ + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = *(*Tu32)(unsafe.Pointer((*TStatCell)(unsafe.Pointer(pCell)).FaOvfl + uintptr(iOvfl)*4)) + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33086 + v2 = Xsqlite3_mprintf(tls, __ccgo_ts+33095, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell, iOvfl)) + z = v2 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v2 + if z == uintptr(0) { + v3 = int32(SQLITE_NOMEM) + } else { + v3 = SQLITE_OK + } + return v3 + } + } + if (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg != 0 { + break + } + (*TStatPage)(unsafe.Pointer(p)).FiCell++ + } + if !((*TStatPage)(unsafe.Pointer(p)).FiRightChildPg != 0) || (*TStatPage)(unsafe.Pointer(p)).FiCell > (*TStatPage)(unsafe.Pointer(p)).FnCell { + _statClearPage(tls, p) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage-- + if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 && (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage < 0 { + /* label-statNext-done: When computing aggregate space usage over + ** an entire btree, this is the exit point from this function */ + return SQLITE_OK + } + goto statNextRestart /* Tail recursion */ + } + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage++ + if (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage >= int32(libc.Uint64FromInt64(2048)/libc.Uint64FromInt64(64)) { + _statResetCsr(tls, pCsr) + return _sqlite3CorruptError(tls, int32(222551)) + } + if (*TStatPage)(unsafe.Pointer(p)).FiCell == (*TStatPage)(unsafe.Pointer(p)).FnCell { + (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*TStatPage)(unsafe.Pointer(p)).FiRightChildPg + } else { + (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno = (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p)).FaCell + uintptr((*TStatPage)(unsafe.Pointer(p)).FiCell)*32))).FiChildPg + } + rc = _statGetPage(tls, pBt, (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiPgno, p+1*64) + (*TStatCursor)(unsafe.Pointer(pCsr)).FnPage++ + (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FiCell = 0 + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + v4 = Xsqlite3_mprintf(tls, __ccgo_ts+33107, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p)).FzPath, (*TStatPage)(unsafe.Pointer(p)).FiCell)) + z = v4 + (*(*TStatPage)(unsafe.Pointer(p + 1*64))).FzPath = v4 + if z == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + (*TStatPage)(unsafe.Pointer(p)).FiCell++ + } + /* Populate the StatCursor fields with the values to be returned + ** by the xColumn() and xRowid() methods. + */ + if rc == SQLITE_OK { + p1 = pCsr + 24 + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiPage)*64 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzName = Xsqlite3_column_text(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt, 0) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno = (*TStatPage)(unsafe.Pointer(p1)).FiPgno + rc = _statDecodePage(tls, pBt, p1) + if rc == SQLITE_OK { + _statSizeAndOffset(tls, pCsr) + switch int32((*TStatPage)(unsafe.Pointer(p1)).Fflags) { + case int32(0x05): /* table internal */ + fallthrough + case int32(0x02): /* index internal */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33115 + case int32(0x0D): /* table leaf */ + fallthrough + case int32(0x0A): /* index leaf */ + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33124 + default: + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype = __ccgo_ts + 33129 + break + } + *(*int32)(unsafe.Pointer(pCsr + 2108)) += (*TStatPage)(unsafe.Pointer(p1)).FnCell + *(*Ti64)(unsafe.Pointer(pCsr + 2120)) += int64((*TStatPage)(unsafe.Pointer(p1)).FnUnused) + if (*TStatPage)(unsafe.Pointer(p1)).FnMxPayload > (*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload { + (*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload = (*TStatPage)(unsafe.Pointer(p1)).FnMxPayload + } + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + v5 = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, (*TStatPage)(unsafe.Pointer(p1)).FzPath)) + z = v5 + (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath = v5 + if z == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } + } + nPayload = 0 + i = 0 + for { + if !(i < (*TStatPage)(unsafe.Pointer(p1)).FnCell) { + break + } + nPayload += (*(*TStatCell)(unsafe.Pointer((*TStatPage)(unsafe.Pointer(p1)).FaCell + uintptr(i)*32))).FnLocal + goto _6 + _6: + ; + i++ + } + *(*Ti64)(unsafe.Pointer(pCsr + 2128)) += int64(nPayload) + /* If computing aggregate space usage by btree, continue with the + ** next page. The loop will exit via the return at label-statNext-done + */ + if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { + goto statNextRestart + } + } + } + return rc +} + +func _statEof(tls *libc.TLS, pCursor uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = pCursor + return int32((*TStatCursor)(unsafe.Pointer(pCsr)).FisEof) +} + +// C documentation +// +// /* Initialize a cursor according to the query plan idxNum using the +// ** arguments in argv[0]. See statBestIndex() for a description of the +// ** meaning of the bits in idxNum. +// */ +func _statFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iArg, rc, v1, v2, v3 int32 + var pCsr, pSql, pTab, zDbase, zName, zSql uintptr + _, _, _, _, _, _, _, _, _, _, _ = iArg, pCsr, pSql, pTab, rc, zDbase, zName, zSql, v1, v2, v3 + pCsr = pCursor + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab /* String value of pSql */ + iArg = 0 /* Count of argv[] parameters used so far */ + rc = SQLITE_OK /* Result of this operation */ + zName = uintptr(0) /* Only provide analysis of this table */ + _ = argc + _ = idxStr + _statResetCsr(tls, pCsr) + Xsqlite3_finalize(tls, (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt) + (*TStatCursor)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0) + if idxNum&int32(0x01) != 0 { + v1 = iArg + iArg++ + /* schema=? constraint is present. Get its value */ + zDbase = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(v1)*8))) + (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb = _sqlite3FindDbName(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb, zDbase) + if (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb < 0 { + (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb = 0 + (*TStatCursor)(unsafe.Pointer(pCsr)).FisEof = uint8(1) + return SQLITE_OK + } + } else { + (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb = (*TStatTable)(unsafe.Pointer(pTab)).FiDb + } + if idxNum&int32(0x02) != 0 { + /* name=? constraint is present */ + v2 = iArg + iArg++ + zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(v2)*8))) + } + if idxNum&int32(0x04) != 0 { + /* aggregate=? constraint is present */ + v3 = iArg + iArg++ + (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = libc.BoolUint8(Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(v3)*8))) != float64(0)) + } else { + (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg = uint8(0) + } + pSql = Xsqlite3_str_new(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb) + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33139, libc.VaList(bp+8, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer((*TStatTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr((*TStatCursor)(unsafe.Pointer(pCsr)).FiDb)*32))).FzDbSName)) + if zName != 0 { + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33294, libc.VaList(bp+8, zName)) + } + if idxNum&int32(0x08) != 0 { + Xsqlite3_str_appendf(tls, pSql, __ccgo_ts+33308, 0) + } + zSql = Xsqlite3_str_finish(tls, pSql) + if zSql == uintptr(0) { + return int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare_v2(tls, (*TStatTable)(unsafe.Pointer(pTab)).Fdb, zSql, -int32(1), pCsr+8, uintptr(0)) + Xsqlite3_free(tls, zSql) + } + if rc == SQLITE_OK { + (*TStatCursor)(unsafe.Pointer(pCsr)).FiPage = -int32(1) + rc = _statNext(tls, pCursor) + } + return rc +} + +func _statColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) (r int32) { + var db, pCsr uintptr + var iDb int32 + _, _, _ = db, iDb, pCsr + pCsr = pCursor + switch i { + case 0: /* name */ + Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzName, -int32(1), uintptr(-libc.Int32FromInt32(1))) + case int32(1): /* path */ + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPath, -int32(1), uintptr(-libc.Int32FromInt32(1))) + } + case int32(2): /* pageno */ + if (*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0 { + Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnPage)) + } else { + Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno)) + } + case int32(3): /* pagetype */ + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + Xsqlite3_result_text(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FzPagetype, -int32(1), libc.UintptrFromInt32(0)) + } + case int32(4): /* ncell */ + Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnCell)) + case int32(5): /* payload */ + Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnPayload) + case int32(6): /* unused */ + Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FnUnused) + case int32(7): /* mx_payload */ + Xsqlite3_result_int64(tls, ctx, int64((*TStatCursor)(unsafe.Pointer(pCsr)).FnMxPayload)) + case int32(8): /* pgoffset */ + if !((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg != 0) { + Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FiOffset) + } + case int32(9): /* pgsize */ + Xsqlite3_result_int64(tls, ctx, (*TStatCursor)(unsafe.Pointer(pCsr)).FszPage) + case int32(10): /* schema */ + db = Xsqlite3_context_db_handle(tls, ctx) + iDb = (*TStatCursor)(unsafe.Pointer(pCsr)).FiDb + Xsqlite3_result_text(tls, ctx, (*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32))).FzDbSName, -int32(1), libc.UintptrFromInt32(0)) + default: /* aggregate */ + Xsqlite3_result_int(tls, ctx, int32((*TStatCursor)(unsafe.Pointer(pCsr)).FisAgg)) + break + } + return SQLITE_OK +} + +func _statRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = pCursor + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = int64((*TStatCursor)(unsafe.Pointer(pCsr)).FiPageno) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Invoke this routine to register the "dbstat" virtual table module +// */ +func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { + return Xsqlite3_create_module(tls, db, __ccgo_ts+33323, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) +} + +var _dbstat_module = Tsqlite3_module{} + +func init() { + p := unsafe.Pointer(&_dbstat_module) + *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_statConnect) + *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_statConnect) + *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_statBestIndex) + *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_statDisconnect) + *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_statDisconnect) + *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_statOpen) + *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_statClose) + *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_statFilter) + *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_statNext) + *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_statEof) + *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_statColumn) + *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_statRowid) +} + +/************** End of dbstat.c **********************************************/ +/************** Begin file dbpage.c ******************************************/ +/* +** 2017-10-11 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains an implementation of the "sqlite_dbpage" virtual table. +** +** The sqlite_dbpage virtual table is used to read or write whole raw +** pages of the database file. The pager interface is used so that +** uncommitted changes and changes recorded in the WAL file are correctly +** retrieved. +** +** Usage example: +** +** SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +** +** This is an eponymous virtual table so it does not need to be created before +** use. The optional argument to the sqlite_dbpage() table name is the +** schema for the database file that is to be read. The default schema is +** "main". +** +** The data field of sqlite_dbpage table can be updated. The new +** value must be a BLOB which is the correct page size, otherwise the +** update fails. Rows may not be deleted or inserted. + */ + +/* #include "sqliteInt.h" ** Requires access to internal data structures ** */ + +/************** End of dbpage.c **********************************************/ +/************** Begin file sqlite3session.c **********************************/ + +/* #include "sqlite3session.h" */ +/* #include */ +/* #include */ + +type TSessionTable = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FbRowid int32 + FazCol uintptr + FazDflt uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr + FpDfltStmt uintptr +} + +type SessionTable = TSessionTable + +type TSessionChange = struct { + Fop Tu8 + FbIndirect Tu8 + FnRecordField Tu16 + FnMaxSize int32 + FnRecord int32 + FaRecord uintptr + FpNext uintptr +} + +type SessionChange = TSessionChange + +type TSessionBuffer = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} + +type SessionBuffer = TSessionBuffer + +type TSessionInput = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + FaData uintptr + FnData int32 + Fbuf TSessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 +} + +type SessionInput = TSessionInput + +/* +** Minimum chunk size used by streaming versions of functions. + */ + +var _sessions_strm_chunk_size = int32(SESSIONS_STRM_CHUNK_SIZE) + +type TSessionHook = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} + +type SessionHook = TSessionHook + +type TSessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} + +type SessionHook1 = TSessionHook1 + +/* +** Session handle structure. + */ +type Tsqlite3_session1 = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + FbImplicitPK int32 + Frc int32 + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc Ti64 + FnMaxChangesetSize Ti64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook TSessionHook +} + +type sqlite3_session1 = Tsqlite3_session1 + +/* +** Instances of this structure are used to build strings or binary records. + */ +type TSessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} + +type SessionBuffer1 = TSessionBuffer1 + +/* +** An object of this type is used internally as an abstraction for +** input data. Input data may be supplied either as a single large buffer +** (e.g. sqlite3changeset_start()) or using a stream function (e.g. +** sqlite3changeset_start_strm()). + */ +type TSessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + FaData uintptr + FnData int32 + Fbuf TSessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 +} + +type SessionInput1 = TSessionInput1 + +/* +** Structure for changeset iterators. + */ +type Tsqlite3_changeset_iter1 = struct { + Fin TSessionInput + Ftblhdr TSessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + FabPK uintptr + FapValue uintptr +} + +type sqlite3_changeset_iter1 = Tsqlite3_changeset_iter1 + +/* +** Each session object maintains a set of the following structures, one +** for each table the session object is monitoring. The structures are +** stored in a linked list starting at sqlite3_session.pTable. +** +** The keys of the SessionTable.aChange[] hash table are all rows that have +** been modified in any way since the session object was attached to the +** table. +** +** The data associated with each hash-table entry is a structure containing +** a subset of the initial values that the modified row contained at the +** start of the session. Or no initial values if the row was inserted. +** +** pDfltStmt: +** This is only used by the sqlite3changegroup_xxx() APIs, not by +** regular sqlite3_session objects. It is a SELECT statement that +** selects the default value for each table column. For example, +** if the table is +** +** CREATE TABLE xx(a DEFAULT 1, b, c DEFAULT 'abc') +** +** then this variable is the compiled version of: +** +** SELECT 1, NULL, 'abc' + */ +type TSessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FbRowid int32 + FazCol uintptr + FazDflt uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr + FpDfltStmt uintptr +} + +type SessionTable1 = TSessionTable1 + +/* +** RECORD FORMAT: +** +** The following record format is similar to (but not compatible with) that +** used in SQLite database files. This format is used as part of the +** change-set binary format, and so must be architecture independent. +** +** Unlike the SQLite database record format, each field is self-contained - +** there is no separation of header and data. Each field begins with a +** single byte describing its type, as follows: +** +** 0x00: Undefined value. +** 0x01: Integer value. +** 0x02: Real value. +** 0x03: Text value. +** 0x04: Blob value. +** 0x05: SQL NULL value. +** +** Note that the above match the definitions of SQLITE_INTEGER, SQLITE_TEXT +** and so on in sqlite3.h. For undefined and NULL values, the field consists +** only of the single type byte. For other types of values, the type byte +** is followed by: +** +** Text values: +** A varint containing the number of bytes in the value (encoded using +** UTF-8). Followed by a buffer containing the UTF-8 representation +** of the text value. There is no nul terminator. +** +** Blob values: +** A varint containing the number of bytes in the value, followed by +** a buffer containing the value itself. +** +** Integer values: +** An 8-byte big-endian integer value. +** +** Real values: +** An 8-byte big-endian IEEE 754-2008 real value. +** +** Varint values are encoded in the same way as varints in the SQLite +** record format. +** +** CHANGESET FORMAT: +** +** A changeset is a collection of DELETE, UPDATE and INSERT operations on +** one or more tables. Operations on a single table are grouped together, +** but may occur in any order (i.e. deletes, updates and inserts are all +** mixed together). +** +** Each group of changes begins with a table header: +** +** 1 byte: Constant 0x54 (capital 'T') +** Varint: Number of columns in the table. +** nCol bytes: 0x01 for PK columns, 0x00 otherwise. +** N bytes: Unqualified table name (encoded using UTF-8). Nul-terminated. +** +** Followed by one or more changes to the table. +** +** 1 byte: Either SQLITE_INSERT (0x12), UPDATE (0x17) or DELETE (0x09). +** 1 byte: The "indirect-change" flag. +** old.* record: (delete and update only) +** new.* record: (insert and update only) +** +** The "old.*" and "new.*" records, if present, are N field records in the +** format described above under "RECORD FORMAT", where N is the number of +** columns in the table. The i'th field of each record is associated with +** the i'th column of the table, counting from left to right in the order +** in which columns were declared in the CREATE TABLE statement. +** +** The new.* record that is part of each INSERT change contains the values +** that make up the new row. Similarly, the old.* record that is part of each +** DELETE change contains the values that made up the row that was deleted +** from the database. In the changeset format, the records that are part +** of INSERT or DELETE changes never contain any undefined (type byte 0x00) +** fields. +** +** Within the old.* record associated with an UPDATE change, all fields +** associated with table columns that are not PRIMARY KEY columns and are +** not modified by the UPDATE change are set to "undefined". Other fields +** are set to the values that made up the row before the UPDATE that the +** change records took place. Within the new.* record, fields associated +** with table columns modified by the UPDATE change contain the new +** values. Fields associated with table columns that are not modified +** are set to "undefined". +** +** PATCHSET FORMAT: +** +** A patchset is also a collection of changes. It is similar to a changeset, +** but leaves undefined those fields that are not useful if no conflict +** resolution is required when applying the changeset. +** +** Each group of changes begins with a table header: +** +** 1 byte: Constant 0x50 (capital 'P') +** Varint: Number of columns in the table. +** nCol bytes: 0x01 for PK columns, 0x00 otherwise. +** N bytes: Unqualified table name (encoded using UTF-8). Nul-terminated. +** +** Followed by one or more changes to the table. +** +** 1 byte: Either SQLITE_INSERT (0x12), UPDATE (0x17) or DELETE (0x09). +** 1 byte: The "indirect-change" flag. +** single record: (PK fields for DELETE, PK and modified fields for UPDATE, +** full record for INSERT). +** +** As in the changeset format, each field of the single record that is part +** of a patchset change is associated with the correspondingly positioned +** table column, counting from left to right within the CREATE TABLE +** statement. +** +** For a DELETE change, all fields within the record except those associated +** with PRIMARY KEY columns are omitted. The PRIMARY KEY fields contain the +** values identifying the row to delete. +** +** For an UPDATE change, all fields except those associated with PRIMARY KEY +** columns and columns that are modified by the UPDATE are set to "undefined". +** PRIMARY KEY fields contain the values identifying the table row to update, +** and fields associated with modified columns contain the new column values. +** +** The records associated with INSERT changes are in the same format as for +** changesets. It is not possible for a record associated with an INSERT +** change to contain a field set to "undefined". +** +** REBASE BLOB FORMAT: +** +** A rebase blob may be output by sqlite3changeset_apply_v2() and its +** streaming equivalent for use with the sqlite3_rebaser APIs to rebase +** existing changesets. A rebase blob contains one entry for each conflict +** resolved using either the OMIT or REPLACE strategies within the apply_v2() +** call. +** +** The format used for a rebase blob is very similar to that used for +** changesets. All entries related to a single table are grouped together. +** +** Each group of entries begins with a table header in changeset format: +** +** 1 byte: Constant 0x54 (capital 'T') +** Varint: Number of columns in the table. +** nCol bytes: 0x01 for PK columns, 0x00 otherwise. +** N bytes: Unqualified table name (encoded using UTF-8). Nul-terminated. +** +** Followed by one or more entries associated with the table. +** +** 1 byte: Either SQLITE_INSERT (0x12), DELETE (0x09). +** 1 byte: Flag. 0x01 for REPLACE, 0x00 for OMIT. +** record: (in the record format defined above). +** +** In a rebase blob, the first field is set to SQLITE_INSERT if the change +** that caused the conflict was an INSERT or UPDATE, or to SQLITE_DELETE if +** it was a DELETE. The second field is set to 0x01 if the conflict +** resolution strategy was REPLACE, or 0x00 if it was OMIT. +** +** If the change that caused the conflict was a DELETE, then the single +** record is a copy of the old.* record from the original changeset. If it +** was an INSERT, then the single record is a copy of the new.* record. If +** the conflicting change was an UPDATE, then the single record is a copy +** of the new.* record with the PK fields filled in based on the original +** old.* record. + */ + +/* +** For each row modified during a session, there exists a single instance of +** this structure stored in a SessionTable.aChange[] hash table. + */ +type TSessionChange1 = struct { + Fop Tu8 + FbIndirect Tu8 + FnRecordField Tu16 + FnMaxSize int32 + FnRecord int32 + FaRecord uintptr + FpNext uintptr +} + +type SessionChange1 = TSessionChange1 + +// C documentation +// +// /* +// ** Write a varint with value iVal into the buffer at aBuf. Return the +// ** number of bytes written. +// */ +func _sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) (r int32) { + var v1 int32 + _ = v1 + if uint32(iVal) < libc.Uint32FromInt32(0x80) { + *(*Tu8)(unsafe.Pointer(aBuf)) = uint8(iVal) + v1 = libc.Int32FromInt32(1) + } else { + v1 = _sqlite3PutVarint(tls, aBuf, uint64(iVal)) + } + return int32(uint8(v1)) +} + +// C documentation +// +// /* +// ** Return the number of bytes required to store value iVal as a varint. +// */ +func _sessionVarintLen(tls *libc.TLS, iVal int32) (r int32) { + return _sqlite3VarintLen(tls, uint64(iVal)) +} + +// C documentation +// +// /* +// ** Read a varint value from aBuf[] into *piVal. Return the number of +// ** bytes read. +// */ +func _sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) (r int32) { + var v1 int32 + _ = v1 + if int32(*(*Tu8)(unsafe.Pointer(aBuf))) < int32(libc.Uint8FromInt32(0x80)) { + *(*int32)(unsafe.Pointer(piVal)) = int32(uint32(*(*Tu8)(unsafe.Pointer(aBuf)))) + v1 = libc.Int32FromInt32(1) + } else { + v1 = int32(_sqlite3GetVarint32(tls, aBuf, piVal)) + } + return int32(uint8(v1)) +} + +/* Load an unaligned and unsigned 32-bit integer */ + +// C documentation +// +// /* +// ** Read a 64-bit big-endian integer value from buffer aRec[]. Return +// ** the value read. +// */ +func _sessionGetI64(tls *libc.TLS, aRec uintptr) (r Tsqlite3_int64) { + var x Tu64 + var y Tu32 + _, _ = x, y + x = uint64(uint32(*(*Tu8)(unsafe.Pointer(aRec)))<> libc.Int32FromInt32(56) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 1)) = uint8(i >> libc.Int32FromInt32(48) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 2)) = uint8(i >> libc.Int32FromInt32(40) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 3)) = uint8(i >> libc.Int32FromInt32(32) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 4)) = uint8(i >> libc.Int32FromInt32(24) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 5)) = uint8(i >> libc.Int32FromInt32(16) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 6)) = uint8(i >> libc.Int32FromInt32(8) & int64(0xFF)) + *(*Tu8)(unsafe.Pointer(aBuf + 7)) = uint8(i >> libc.Int32FromInt32(0) & int64(0xFF)) +} + +// C documentation +// +// /* +// ** This function is used to serialize the contents of value pValue (see +// ** comment titled "RECORD FORMAT" above). +// ** +// ** If it is non-NULL, the serialized form of the value is written to +// ** buffer aBuf. *pnWrite is set to the number of bytes written before +// ** returning. Or, if aBuf is NULL, the only thing this function does is +// ** set *pnWrite. +// ** +// ** If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// ** within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// ** SQLITE_NOMEM is returned. +// */ +func _sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType, n, nByte, nVarint int32 + var z uintptr + var _ /* i at bp+0 */ Tu64 + var _ /* r at bp+8 */ float64 + _, _, _, _, _ = eType, n, nByte, nVarint, z /* Size of serialized value in bytes */ + if pValue != 0 { /* Value type (SQLITE_NULL, TEXT etc.) */ + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*Tu8)(unsafe.Pointer(aBuf)) = uint8(eType) + } + switch eType { + case int32(SQLITE_NULL): + nByte = int32(1) + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + if aBuf != 0 { + if eType == int32(SQLITE_INTEGER) { + *(*Tu64)(unsafe.Pointer(bp)) = uint64(Xsqlite3_value_int64(tls, pValue)) + } else { + *(*float64)(unsafe.Pointer(bp + 8)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp, bp+8, uint64(8)) + } + _sessionPutI64(tls, aBuf+1, int64(*(*Tu64)(unsafe.Pointer(bp)))) + } + nByte = int32(9) + default: + if eType == int32(SQLITE_TEXT) { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if z == uintptr(0) && (eType != int32(SQLITE_BLOB) || n > 0) { + return int32(SQLITE_NOMEM) + } + nVarint = _sessionVarintLen(tls, n) + if aBuf != 0 { + _sessionVarintPut(tls, aBuf+1, n) + if n > 0 { + libc.Xmemcpy(tls, aBuf+uintptr(nVarint+int32(1)), z, uint64(n)) + } + } + nByte = int32(1) + nVarint + n + break + } + } else { + nByte = int32(1) + if aBuf != 0 { + *(*Tu8)(unsafe.Pointer(aBuf)) = uint8('\000') + } + } + if pnWrite != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(pnWrite)) += int64(nByte) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Allocate and return a pointer to a buffer nByte bytes in size. If +// ** pSession is not NULL, increase the sqlite3_session.nMalloc variable +// ** by the number of bytes allocated. +// */ +func _sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte Ti64) (r uintptr) { + var pRet, p1 uintptr + _, _ = pRet, p1 + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + p1 = pSession + 56 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + Xsqlite3_msize(tls, pRet)) + } + return pRet +} + +// C documentation +// +// /* +// ** Free buffer pFree, which must have been allocated by an earlier +// ** call to sessionMalloc64(). If pSession is not NULL, decrease the +// ** sqlite3_session.nMalloc counter by the number of bytes freed. +// */ +func _sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { + var p1 uintptr + _ = p1 + if pSession != 0 { + p1 = pSession + 56 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) - Xsqlite3_msize(tls, pFree)) + } + Xsqlite3_free(tls, pFree) +} + +/* +** This macro is used to calculate hash key values for data structures. In +** order to use this macro, the entire data structure must be represented +** as a series of unsigned integers. In order to calculate a hash-key value +** for a data structure represented as three such integers, the macro may +** then be used as follows: +** +** int hash_key_value; +** hash_key_value = HASH_APPEND(0, ); +** hash_key_value = HASH_APPEND(hash_key_value, ); +** hash_key_value = HASH_APPEND(hash_key_value, ); +** +** In practice, the data structures this macro is used for are the primary +** key values of modified rows. + */ + +// C documentation +// +// /* +// ** Append the hash of the 64-bit integer passed as the second argument to the +// ** hash-key value passed as the first. Return the new hash-key value. +// */ +func _sessionHashAppendI64(tls *libc.TLS, h uint32, i Ti64) (r uint32) { + h = h<>libc.Int32FromInt32(32)&libc.Int64FromUint32(0xFFFFFFFF)) +} + +// C documentation +// +// /* +// ** Append the hash of the blob passed via the second and third arguments to +// ** the hash-key value passed as the first. Return the new hash-key value. +// */ +func _sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) (r uint32) { + var i int32 + _ = i + i = 0 + for { + if !(i < n) { + break + } + h = h< 0) { + return int32(SQLITE_NOMEM) + } + h = _sessionHashAppendBlob(tls, h, n, z) + } else { + *(*int32)(unsafe.Pointer(pbNullPK)) = int32(1) + } + } + } + goto _1 + _1: + ; + i++ + } + } + *(*int32)(unsafe.Pointer(piHash)) = int32(h % uint32((*TSessionTable)(unsafe.Pointer(pTab)).FnChange)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The buffer that the argument points to contains a serialized SQL value. +// ** Return the number of bytes of space occupied by the value (including +// ** the type byte). +// */ +func _sessionSerialLen(tls *libc.TLS, a uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var e int32 + var _ /* n at bp+0 */ int32 + _ = e + e = int32(*(*Tu8)(unsafe.Pointer(a))) + if e == 0 || e == int32(0xFF) { + return int32(1) + } + if e == int32(SQLITE_NULL) { + return int32(1) + } + if e == int32(SQLITE_INTEGER) || e == int32(SQLITE_FLOAT) { + return int32(9) + } + return _sessionVarintGet(tls, a+1, bp) + int32(1) + *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Based on the primary key values stored in change aRecord, calculate a +// ** hash key. Assume the has table has nBucket buckets. The hash keys +// ** calculated by this function are compatible with those calculated by +// ** sessionPreupdateHash(). +// ** +// ** The bPkOnly argument is non-zero if the record at aRecord[] is from +// ** a patchset DELETE. In this case the non-PK fields are omitted entirely. +// */ +func _sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) (r uint32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a uintptr + var eType, i, isPK int32 + var h uint32 + var _ /* n at bp+0 */ int32 + _, _, _, _, _ = a, eType, h, i, isPK + h = uint32(0) /* Used to iterate through columns */ + a = aRecord /* Used to iterate through change record */ + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + eType = int32(*(*Tu8)(unsafe.Pointer(a))) + isPK = int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if bPkOnly != 0 && isPK == 0 { + goto _1 + } + /* It is not possible for eType to be SQLITE_NULL here. The session + ** module does not record changes for rows with NULL values stored in + ** primary key columns. */ + if isPK != 0 { + a++ + h = _sessionHashAppendType(tls, h, eType) + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + h = _sessionHashAppendI64(tls, h, _sessionGetI64(tls, a)) + a += uintptr(8) + } else { + a += uintptr(_sessionVarintGet(tls, a, bp)) + h = _sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp))) + } + } else { + a += uintptr(_sessionSerialLen(tls, a)) + } + goto _1 + _1: + ; + i++ + } + return h % uint32(nBucket) +} + +// C documentation +// +// /* +// ** Arguments aLeft and aRight are pointers to change records for table pTab. +// ** This function returns true if the two records apply to the same row (i.e. +// ** have the same values stored in the primary key columns), or false +// ** otherwise. +// */ +func _sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) (r int32) { + var a1, a2 uintptr + var iCol, n1, n2 int32 + _, _, _, _, _ = a1, a2, iCol, n1, n2 + a1 = aLeft /* Cursor to iterate through aLeft */ + a2 = aRight /* Used to iterate through table columns */ + iCol = 0 + for { + if !(iCol < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + n1 = _sessionSerialLen(tls, a1) + n2 = _sessionSerialLen(tls, a2) + if n1 != n2 || libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0 { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(_sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(_sessionSerialLen(tls, a2)) + } + } + goto _1 + _1: + ; + iCol++ + } + return int32(1) +} + +// C documentation +// +// /* +// ** Arguments aLeft and aRight both point to buffers containing change +// ** records with nCol columns. This function "merges" the two records into +// ** a single records which is written to the buffer at *paOut. *paOut is +// ** then set to point to one byte after the last byte written before +// ** returning. +// ** +// ** The merging of records is done as follows: For each column, if the +// ** aRight record contains a value for the column, copy the value from +// ** their. Otherwise, if aLeft contains a value, copy it. If neither +// ** record contains a value for a given column, then neither does the +// ** output record. +// */ +func _sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { + var a1, a2, aOut uintptr + var iCol, n1, n2 int32 + _, _, _, _, _, _ = a1, a2, aOut, iCol, n1, n2 + a1 = aLeft /* Cursor used to iterate through aLeft */ + a2 = aRight /* Cursor used to iterate through aRight */ + aOut = *(*uintptr)(unsafe.Pointer(paOut)) /* Used to iterate from 0 to nCol */ + iCol = 0 + for { + if !(iCol < nCol) { + break + } + n1 = _sessionSerialLen(tls, a1) + n2 = _sessionSerialLen(tls, a2) + if *(*Tu8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint64(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint64(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + goto _1 + _1: + ; + iCol++ + } + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// C documentation +// +// /* +// ** This is a helper function used by sessionMergeUpdate(). +// ** +// ** When this function is called, both *paOne and *paTwo point to a value +// ** within a change record. Before it returns, both have been advanced so +// ** as to point to the next value in the record. +// ** +// ** If, when this function is called, *paTwo points to a valid value (i.e. +// ** *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// ** pointer is returned and *pnVal is set to the number of bytes in the +// ** serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// ** set to the number of bytes in the value at *paOne. If *paOne points +// ** to the "no value" placeholder, *pnVal is set to 1. In other words: +// ** +// ** if( *paTwo is valid ) return *paTwo; +// ** return *paOne; +// ** +// */ +func _sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) (r uintptr) { + var a1, a2, pRet uintptr + var n1, n2 int32 + _, _, _, _, _ = a1, a2, n1, n2, pRet + a1 = *(*uintptr)(unsafe.Pointer(paOne)) + a2 = *(*uintptr)(unsafe.Pointer(paTwo)) + pRet = uintptr(0) + if a2 != 0 { + n2 = _sessionSerialLen(tls, a2) + if *(*Tu8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = a2 + uintptr(n2) + } + n1 = _sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = a1 + uintptr(n1) + return pRet +} + +// C documentation +// +// /* +// ** This function is used by changeset_concat() to merge two UPDATE changes +// ** on the same row. +// */ +func _sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var aNew, aNew1, aOld, aOld1, aOut, v2, v4 uintptr + var bRequired, i int32 + var _ /* aNew1 at bp+16 */ uintptr + var _ /* aNew2 at bp+24 */ uintptr + var _ /* aOld1 at bp+0 */ uintptr + var _ /* aOld2 at bp+8 */ uintptr + var _ /* nNew at bp+36 */ int32 + var _ /* nNew at bp+44 */ int32 + var _ /* nOld at bp+32 */ int32 + var _ /* nOld at bp+40 */ int32 + _, _, _, _, _, _, _, _, _ = aNew, aNew1, aOld, aOld1, aOut, bRequired, i, v2, v4 + *(*uintptr)(unsafe.Pointer(bp)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 16)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 24)) = aNewRecord2 + aOut = *(*uintptr)(unsafe.Pointer(paOut)) + if bPatchset == 0 { + bRequired = 0 + /* Write the old.* vector first. */ + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + aOld = _sessionMergeValue(tls, bp, bp+8, bp+32) + aNew = _sessionMergeValue(tls, bp+16, bp+24, bp+36) + if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 || *(*int32)(unsafe.Pointer(bp + 32)) != *(*int32)(unsafe.Pointer(bp + 36)) || libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 36)))) != 0 { + if int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = int32(1) + } + libc.Xmemcpy(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 32)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 32))) + } else { + v2 = aOut + aOut++ + *(*Tu8)(unsafe.Pointer(v2)) = uint8('\000') + } + goto _1 + _1: + ; + i++ + } + if !(bRequired != 0) { + return 0 + } + } + /* Write the new.* vector */ + *(*uintptr)(unsafe.Pointer(bp)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 16)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 24)) = aNewRecord2 + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + aOld1 = _sessionMergeValue(tls, bp, bp+8, bp+40) + aNew1 = _sessionMergeValue(tls, bp+16, bp+24, bp+44) + if bPatchset == 0 && (*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 || *(*int32)(unsafe.Pointer(bp + 40)) == *(*int32)(unsafe.Pointer(bp + 44)) && 0 == libc.Xmemcmp(tls, aOld1, aNew1, uint64(*(*int32)(unsafe.Pointer(bp + 44))))) { + v4 = aOut + aOut++ + *(*Tu8)(unsafe.Pointer(v4)) = uint8('\000') + } else { + libc.Xmemcpy(tls, aOut, aNew1, uint64(*(*int32)(unsafe.Pointer(bp + 44)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 44))) + } + goto _3 + _3: + ; + i++ + } + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return int32(1) +} + +// C documentation +// +// /* +// ** This function is only called from within a pre-update-hook callback. +// ** It determines if the current pre-update-hook change affects the same row +// ** as the change stored in argument pChange. If so, it returns true. Otherwise +// ** if the pre-update-hook does not affect the same row as pChange, it returns +// ** false. +// */ +func _sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, iRowid Ti64, pTab uintptr, pChange uintptr, op int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var a, z, v2 uintptr + var eType, iCol, rc int32 + var _ /* iVal at bp+8 */ Ti64 + var _ /* n at bp+24 */ int32 + var _ /* pVal at bp+0 */ uintptr + var _ /* rVal at bp+16 */ float64 + _, _, _, _, _, _ = a, eType, iCol, rc, z, v2 /* Used to iterate through columns */ + a = (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord /* Cursor used to scan change record */ + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + if int32(*(*Tu8)(unsafe.Pointer(a))) != int32(SQLITE_INTEGER) { + return 0 + } + return libc.BoolInt32(_sessionGetI64(tls, a+1) == iRowid) + } + iCol = 0 + for { + if !(iCol < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if !(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0) { + a += uintptr(_sessionSerialLen(tls, a)) + } else { + v2 = a + a++ /* Error code from preupdate_new/old */ + eType = int32(*(*Tu8)(unsafe.Pointer(v2))) /* Type of value from change record */ + /* The following calls to preupdate_new() and preupdate_old() can not + ** fail. This is because they cache their return values, and by the + ** time control flows to here they have already been called once from + ** within sessionPreupdateHash(). The first two asserts below verify + ** this (that the method has already been called). */ + if op == int32(SQLITE_INSERT) { + /* assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); */ + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp) + } else { + /* assert( db->pPreUpdate->pUnpacked ); */ + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp) + } + _ = rc /* Suppress warning about unused variable */ + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp))) != eType { + return 0 + } + /* A SessionChange object never has a NULL value in a PK column */ + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + *(*Ti64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, a) + a += uintptr(8) + if eType == int32(SQLITE_INTEGER) { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp))) != *(*Ti64)(unsafe.Pointer(bp + 8)) { + return 0 + } + } else { + libc.Xmemcpy(tls, bp+16, bp+8, uint64(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp))) != *(*float64)(unsafe.Pointer(bp + 16)) { + return 0 + } + } + } else { + a += uintptr(_sessionVarintGet(tls, a, bp+24)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp))) != *(*int32)(unsafe.Pointer(bp + 24)) { + return 0 + } + if eType == int32(SQLITE_TEXT) { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if *(*int32)(unsafe.Pointer(bp + 24)) > 0 && libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24)))) != 0 { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24))) + } + } + goto _1 + _1: + ; + iCol++ + } + return int32(1) +} + +// C documentation +// +// /* +// ** If required, grow the hash table used to store changes on table pTab +// ** (part of the session pSession). If a fatal OOM error occurs, set the +// ** session object to failed and return SQLITE_ERROR. Otherwise, return +// ** SQLITE_OK. +// ** +// ** It is possible that a non-fatal OOM error occurs in this function. In +// ** that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// ** Growing the hash table in this case is a performance optimization only, +// ** it is not required for correct operation. +// */ +func _sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) (r int32) { + var apNew, p, pNext uintptr + var bPkOnly, i, iHash, v1 int32 + var nNew Tsqlite3_int64 + _, _, _, _, _, _, _, _ = apNew, bPkOnly, i, iHash, nNew, p, pNext, v1 + if (*TSessionTable)(unsafe.Pointer(pTab)).FnChange == 0 || (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry >= (*TSessionTable)(unsafe.Pointer(pTab)).FnChange/int32(2) { + if (*TSessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + v1 = (*TSessionTable)(unsafe.Pointer(pTab)).FnChange + } else { + v1 = int32(128) + } + nNew = int64(2) * int64(v1) + apNew = _sessionMalloc64(tls, pSession, int64(uint64(8)*uint64(nNew))) + if apNew == uintptr(0) { + if (*TSessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return int32(SQLITE_ERROR) + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, uint64(8)*uint64(nNew)) + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange) { + break + } + p = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)) + for { + if !(p != 0) { + break + } + bPkOnly = libc.BoolInt32(int32((*TSessionChange)(unsafe.Pointer(p)).Fop) == int32(SQLITE_DELETE) && bPatchset != 0) + iHash = int32(_sessionChangeHash(tls, pTab, bPkOnly, (*TSessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*TSessionChange)(unsafe.Pointer(p)).FpNext + (*TSessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + goto _3 + _3: + ; + p = pNext + } + goto _2 + _2: + ; + i++ + } + _sessionFree(tls, pSession, (*TSessionTable)(unsafe.Pointer(pTab)).FapChange) + (*TSessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*TSessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function queries the database for the names of the columns of table +// ** zThis, in schema zDb. +// ** +// ** Otherwise, if they are not NULL, variable *pnCol is set to the number +// ** of columns in the database table and variable *pzTab is set to point to a +// ** nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// ** point to an array of pointers to column names. And *pabPK (again, if not +// ** NULL) is set to point to an array of booleans - true if the corresponding +// ** column is part of the primary key. +// ** +// ** For example, if the table is declared as: +// ** +// ** CREATE TABLE tbl1(w, x DEFAULT 'abc', y, z, PRIMARY KEY(w, z)); +// ** +// ** Then the five output variables are populated as follows: +// ** +// ** *pnCol = 4 +// ** *pzTab = "tbl1" +// ** *pazCol = {"w", "x", "y", "z"} +// ** *pazDflt = {NULL, 'abc', NULL, NULL} +// ** *pabPK = {1, 0, 0, 1} +// ** +// ** All returned buffers are part of the same single allocation, which must +// ** be freed using sqlite3_free() by the caller +// */ +func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pazDflt uintptr, pabPK uintptr, pbRowid uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var abPK, azCol, azDflt, pAlloc, zDflt, zName, zPragma uintptr + var bRowid, i, nDbCol, nDflt, nName1, nThis, rc int32 + var nByte Tsqlite3_int64 + var nName Tsize_t + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = abPK, azCol, azDflt, bRowid, i, nByte, nDbCol, nDflt, nName, nName1, nThis, pAlloc, rc, zDflt, zName, zPragma + nDbCol = 0 + pAlloc = uintptr(0) + azCol = uintptr(0) + azDflt = uintptr(0) + abPK = uintptr(0) + bRowid = 0 /* Set to true to use rowid as PK */ + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + if pazDflt != 0 { + *(*uintptr)(unsafe.Pointer(pazDflt)) = uintptr(0) + } + nThis = _sqlite3Strlen30(tls, zThis) + if nThis == int32(12) && 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11614, zThis) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + /* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */ + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33330, 0) + } else { + if rc == int32(SQLITE_ERROR) { + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+1680, 0) + } else { + return rc + } + } + } else { + zPragma = Xsqlite3_mprintf(tls, __ccgo_ts+33451, libc.VaList(bp+16, zDb, zThis)) + } + if !(zPragma != 0) { + return int32(SQLITE_NOMEM) + } + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -int32(1), bp, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + nByte = int64(nThis + int32(1)) + bRowid = libc.BoolInt32(pbRowid != uintptr(0)) + for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + nByte += int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1))) /* name */ + nByte += int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4))) /* dflt_value */ + nDbCol++ + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5)) != 0 { + bRowid = 0 + } /* pk */ + } + if nDbCol == 0 { + bRowid = 0 + } + nDbCol += bRowid + nByte = Tsqlite3_int64(uint64(nByte) + libc.Xstrlen(tls, __ccgo_ts+29672)) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + nByte = Tsqlite3_int64(uint64(nByte) + uint64(nDbCol)*(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(1)+libc.Uint64FromInt32(1)+libc.Uint64FromInt32(1))) + pAlloc = _sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pAlloc, 0, uint64(nByte)) + } + } + if rc == SQLITE_OK { + azCol = pAlloc + azDflt = azCol + uintptr(nDbCol)*8 + pAlloc = azDflt + uintptr(nDbCol)*8 + abPK = pAlloc + pAlloc = abPK + uintptr(nDbCol) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, uint64(nThis+int32(1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += uintptr(nThis + int32(1)) + } + i = 0 + if bRowid != 0 { + nName = libc.Xstrlen(tls, __ccgo_ts+29672) + libc.Xmemcpy(tls, pAlloc, __ccgo_ts+29672, nName+uint64(1)) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += uintptr(nName + uint64(1)) + *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) = uint8(1) + i++ + } + for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + nName1 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + nDflt = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + zName = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + zDflt = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(4)) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, uint64(nName1+int32(1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += uintptr(nName1 + int32(1)) + if zDflt != 0 { + libc.Xmemcpy(tls, pAlloc, zDflt, uint64(nDflt+int32(1))) + *(*uintptr)(unsafe.Pointer(azDflt + uintptr(i)*8)) = pAlloc + pAlloc += uintptr(nDflt + int32(1)) + } else { + *(*uintptr)(unsafe.Pointer(azDflt + uintptr(i)*8)) = uintptr(0) + } + *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) = uint8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(5))) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + /* If successful, populate the output variables. Otherwise, zero them and + ** free any allocation made. An error code will be returned in this case. + */ + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + if pazDflt != 0 { + *(*uintptr)(unsafe.Pointer(pazDflt)) = azDflt + } + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + _sessionFree(tls, pSession, azCol) + } + if pbRowid != 0 { + *(*int32)(unsafe.Pointer(pbRowid)) = bRowid + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** This function is called to initialize the SessionTable.nCol, azCol[] +// ** abPK[] and azDflt[] members of SessionTable object pTab. If these +// ** fields are already initilialized, this function is a no-op. +// ** +// ** If an error occurs, an error code is stored in sqlite3_session.rc and +// ** non-zero returned. Or, if no error occurs but the table has no primary +// ** key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// ** indicate that updates on this table should be ignored. SessionTable.abPK +// ** is set to NULL in this case. +// */ +func _sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr, db uintptr, zDb uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, rc int32 + var v1, p3 uintptr + var _ /* abPK at bp+0 */ uintptr + _, _, _, _ = i, rc, v1, p3 + rc = SQLITE_OK + if (*TSessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + if pSession == uintptr(0) || (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { + v1 = pTab + 24 + } else { + v1 = uintptr(0) + } + rc = _sessionTableInfo(tls, pSession, db, zDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, pTab+16, uintptr(0), pTab+32, pTab+40, bp, v1) + if rc == SQLITE_OK { + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + uintptr(i))) != 0 { + (*TSessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp)) + break + } + goto _2 + _2: + ; + i++ + } + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11614, (*TSessionTable)(unsafe.Pointer(pTab)).FzName) { + (*TSessionTable)(unsafe.Pointer(pTab)).FbStat1 = int32(1) + } + if pSession != 0 && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + p3 = pSession + 64 + *(*Ti64)(unsafe.Pointer(p3)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p3))) + (uint64(libc.Int32FromInt32(1)+_sessionVarintLen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol)+(*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + libc.Xstrlen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName) + libc.Uint64FromInt32(1))) + } + } + } + if pSession != 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = rc + return libc.BoolInt32(rc != 0 || (*TSessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)) + } + return rc +} + +// C documentation +// +// /* +// ** Re-initialize table object pTab. +// */ +func _sessionReinitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var a, v1 uintptr + var ii, nOldCol int32 + var _ /* abPK at bp+24 */ uintptr + var _ /* azCol at bp+8 */ uintptr + var _ /* azDflt at bp+16 */ uintptr + var _ /* bRowid at bp+32 */ int32 + var _ /* nCol at bp+0 */ int32 + _, _, _, _ = a, ii, nOldCol, v1 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32)) = 0 + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { + v1 = bp + 32 + } else { + v1 = uintptr(0) + } + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = _sessionTableInfo(tls, pSession, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, bp, uintptr(0), bp+8, bp+16, bp+24, v1) + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + if (*TSessionTable)(unsafe.Pointer(pTab)).FnCol > *(*int32)(unsafe.Pointer(bp)) || (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != *(*int32)(unsafe.Pointer(bp + 32)) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = int32(SQLITE_SCHEMA) + } else { + nOldCol = (*TSessionTable)(unsafe.Pointer(pTab)).FnCol + ii = 0 + for { + if !(ii < *(*int32)(unsafe.Pointer(bp))) { + break + } + if ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol { + if int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii)))) != int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)) + uintptr(ii)))) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = int32(SQLITE_SCHEMA) + } + } else { + if *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)) + uintptr(ii))) != 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = int32(SQLITE_SCHEMA) + } + } + goto _2 + _2: + ; + ii++ + } + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + a = (*TSessionTable)(unsafe.Pointer(pTab)).FazCol + (*TSessionTable)(unsafe.Pointer(pTab)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 8)) + (*TSessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp)) + (*TSessionTable)(unsafe.Pointer(pTab)).FazDflt = *(*uintptr)(unsafe.Pointer(bp + 16)) + (*TSessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp + 24)) + *(*uintptr)(unsafe.Pointer(bp + 8)) = a + } + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*Ti64)(unsafe.Pointer(pSession + 64)) += int64(*(*int32)(unsafe.Pointer(bp)) - nOldCol) + *(*Ti64)(unsafe.Pointer(pSession + 64)) += int64(_sessionVarintLen(tls, *(*int32)(unsafe.Pointer(bp)))) + *(*Ti64)(unsafe.Pointer(pSession + 64)) -= int64(_sessionVarintLen(tls, nOldCol)) + } + } + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + return (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc +} + +// C documentation +// +// /* +// ** Session-change object (*pp) contains an old.* record with fewer than +// ** nCol fields. This function updates it with the default values for +// ** the missing fields. +// */ +func _sessionUpdateOneChange(tls *libc.TLS, pSession uintptr, pRc uintptr, pp uintptr, nCol int32, pDflt uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType, iField, n, n1, n2, nByte, nIncr, v1 int32 + var iVal Ti64 + var pNew, pOld, z, z1, v2, v3 uintptr + var _ /* iVal at bp+8 */ Ti64 + var _ /* rVal at bp+0 */ float64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = eType, iField, iVal, n, n1, n2, nByte, nIncr, pNew, pOld, z, z1, v1, v2, v3 + pOld = *(*uintptr)(unsafe.Pointer(pp)) + for int32((*TSessionChange)(unsafe.Pointer(pOld)).FnRecordField) < nCol { + pNew = uintptr(0) + nByte = 0 + nIncr = 0 + iField = int32((*TSessionChange)(unsafe.Pointer(pOld)).FnRecordField) + eType = Xsqlite3_column_type(tls, pDflt, iField) + switch eType { + case int32(SQLITE_NULL): + nIncr = int32(1) + case int32(SQLITE_INTEGER): + fallthrough + case int32(SQLITE_FLOAT): + nIncr = int32(9) + default: + n = Xsqlite3_column_bytes(tls, pDflt, iField) + nIncr = int32(1) + _sessionVarintLen(tls, n) + n + break + } + nByte = int32(uint64(nIncr) + (uint64(32) + uint64((*TSessionChange)(unsafe.Pointer(pOld)).FnRecord))) + pNew = _sessionMalloc64(tls, pSession, int64(nByte)) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + return + } else { + libc.Xmemcpy(tls, pNew, pOld, uint64(32)) + (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord = pNew + 1*32 + libc.Xmemcpy(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord, (*TSessionChange)(unsafe.Pointer(pOld)).FaRecord, uint64((*TSessionChange)(unsafe.Pointer(pOld)).FnRecord)) + v2 = pNew + 8 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord + uintptr(v1))) = uint8(eType) + switch eType { + case int32(SQLITE_INTEGER): + iVal = Xsqlite3_column_int64(tls, pDflt, iField) + _sessionPutI64(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), iVal) + *(*int32)(unsafe.Pointer(pNew + 8)) += int32(8) + case int32(SQLITE_FLOAT): + *(*float64)(unsafe.Pointer(bp)) = Xsqlite3_column_double(tls, pDflt, iField) + *(*Ti64)(unsafe.Pointer(bp + 8)) = 0 + libc.Xmemcpy(tls, bp+8, bp, uint64(8)) + _sessionPutI64(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), *(*Ti64)(unsafe.Pointer(bp + 8))) + *(*int32)(unsafe.Pointer(pNew + 8)) += int32(8) + case int32(SQLITE_TEXT): + n1 = Xsqlite3_column_bytes(tls, pDflt, iField) + z = Xsqlite3_column_text(tls, pDflt, iField) + *(*int32)(unsafe.Pointer(pNew + 8)) += _sessionVarintPut(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), n1) + libc.Xmemcpy(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), z, uint64(n1)) + *(*int32)(unsafe.Pointer(pNew + 8)) += n1 + case int32(SQLITE_BLOB): + n2 = Xsqlite3_column_bytes(tls, pDflt, iField) + z1 = Xsqlite3_column_blob(tls, pDflt, iField) + *(*int32)(unsafe.Pointer(pNew + 8)) += _sessionVarintPut(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), n2) + libc.Xmemcpy(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord+uintptr((*TSessionChange)(unsafe.Pointer(pNew)).FnRecord), z1, uint64(n2)) + *(*int32)(unsafe.Pointer(pNew + 8)) += n2 + default: + break + } + _sessionFree(tls, pSession, pOld) + v3 = pNew + pOld = v3 + *(*uintptr)(unsafe.Pointer(pp)) = v3 + (*TSessionChange)(unsafe.Pointer(pNew)).FnRecordField++ + *(*int32)(unsafe.Pointer(pNew + 4)) += nIncr + if pSession != 0 { + *(*Ti64)(unsafe.Pointer(pSession + 64)) += int64(nIncr) + } + } + } +} + +// C documentation +// +// /* +// ** Ensure that there is room in the buffer to append nByte bytes of data. +// ** If not, use sqlite3_realloc() to grow the buffer so that there is. +// ** +// ** If successful, return zero. Otherwise, if an OOM condition is encountered, +// ** set *pRc to SQLITE_NOMEM and return non-zero. +// */ +func _sessionBufferGrow(tls *libc.TLS, p uintptr, nByte Ti64, pRc uintptr) (r int32) { + var aNew uintptr + var nNew, nReq Ti64 + var v1 int32 + _, _, _, _ = aNew, nNew, nReq, v1 + nReq = int64((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK && nReq > int64((*TSessionBuffer)(unsafe.Pointer(p)).FnAlloc) { + if (*TSessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + v1 = (*TSessionBuffer)(unsafe.Pointer(p)).FnAlloc + } else { + v1 = int32(128) + } + nNew = int64(v1) + for cond := true; cond; cond = nNew < nReq { + nNew = nNew * int64(2) + } + /* The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + ** of sqlite3_realloc64(). Allocations greater than this size in bytes + ** always fail. It is used here to ensure that this routine can always + ** allocate up to this limit - instead of up to the largest power of + ** two smaller than the limit. */ + if nNew > int64(libc.Int32FromInt32(0x7FFFFF00)-libc.Int32FromInt32(1)) { + nNew = int64(libc.Int32FromInt32(0x7FFFFF00) - libc.Int32FromInt32(1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + return int32(1) + } + } + aNew = Xsqlite3_realloc64(tls, (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } else { + (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*TSessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return libc.BoolInt32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK) +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append a string to the buffer. All bytes in the string +// ** up to (but not including) the nul-terminator are written to the buffer. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { + var nStr int32 + _ = nStr + nStr = _sqlite3Strlen30(tls, zStr) + if 0 == _sessionBufferGrow(tls, p, int64(nStr+int32(1)), pRc) { + libc.Xmemcpy(tls, (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf), zStr, uint64(nStr)) + *(*int32)(unsafe.Pointer(p + 8)) += nStr + *(*Tu8)(unsafe.Pointer((*TSessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf))) = uint8(0x00) + } +} + +// C documentation +// +// /* +// ** Format a string using printf() style formatting and then append it to the +// ** buffer using sessionAppendString(). +// */ +func _sessionAppendPrintf(tls *libc.TLS, p uintptr, pRc uintptr, zFmt uintptr, va uintptr) { + var ap Tva_list + var zApp uintptr + _, _ = ap, zApp + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + zApp = uintptr(0) + ap = va + zApp = Xsqlite3_vmprintf(tls, zFmt, ap) + if zApp == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } else { + _sessionAppendStr(tls, p, zApp, pRc) + } + _ = ap + Xsqlite3_free(tls, zApp) + } +} + +// C documentation +// +// /* +// ** Prepare a statement against database handle db that SELECTs a single +// ** row containing the default values for each column in table pTab. For +// ** example, if pTab is declared as: +// ** +// ** CREATE TABLE pTab(a PRIMARY KEY, b DEFAULT 123, c DEFAULT 'abcd'); +// ** +// ** Then this function prepares and returns the SQL statement: +// ** +// ** SELECT NULL, 123, 'abcd'; +// */ +func _sessionPrepareDfltStmt(tls *libc.TLS, db uintptr, pTab uintptr, ppStmt uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var ii int32 + var zDflt, zSep, v2 uintptr + var _ /* rc at bp+16 */ int32 + var _ /* sql at bp+0 */ TSessionBuffer + _, _, _, _ = ii, zDflt, zSep, v2 + *(*TSessionBuffer)(unsafe.Pointer(bp)) = TSessionBuffer{} + *(*int32)(unsafe.Pointer(bp + 16)) = SQLITE_OK + zSep = __ccgo_ts + 11234 + ii = 0 + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+33480, 0) + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazDflt + uintptr(ii)*8)) != 0 { + v2 = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazDflt + uintptr(ii)*8)) + } else { + v2 = __ccgo_ts + 1681 + } + zDflt = v2 + _sessionAppendPrintf(tls, bp, bp+16, __ccgo_ts+5108, libc.VaList(bp+32, zSep, zDflt)) + zSep = __ccgo_ts + 15022 + goto _1 + _1: + ; + ii++ + } + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf, -int32(1), ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16)) +} + +// C documentation +// +// /* +// ** Table pTab has one or more existing change-records with old.* records +// ** with fewer than pTab->nCol columns. This function updates all such +// ** change-records with the default values for the missing columns. +// */ +func _sessionUpdateChanges(tls *libc.TLS, pSession uintptr, pTab uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var ii int32 + var pp uintptr + var _ /* pStmt at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _ = ii, pp + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc + *(*int32)(unsafe.Pointer(bp + 8)) = _sessionPrepareDfltStmt(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, pTab, bp) + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + ii = 0 + pp = uintptr(0) + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange) { + break + } + pp = (*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(ii)*8 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + if int32((*TSessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FnRecordField) != (*TSessionTable)(unsafe.Pointer(pTab)).FnCol { + _sessionUpdateOneChange(tls, pSession, bp+8, pp, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, *(*uintptr)(unsafe.Pointer(bp))) + } + goto _2 + _2: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + goto _1 + _1: + ; + ii++ + } + } + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = *(*int32)(unsafe.Pointer(bp + 8)) + *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = *(*int32)(unsafe.Pointer(bp + 8)) + } + return (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc +} + +// C documentation +// +// /* +// ** Versions of the four methods in object SessionHook for use with the +// ** sqlite_stat1 table. The purpose of this is to substitute a zero-length +// ** blob each time a NULL value is read from the "idx" column of the +// ** sqlite_stat1 table. +// */ +type TSessionStat1Ctx = struct { + Fhook TSessionHook + FpSession uintptr +} + +type SessionStat1Ctx = TSessionStat1Ctx + +type TSessionStat1Ctx1 = struct { + Fhook TSessionHook + FpSession uintptr +} + +type SessionStat1Ctx1 = TSessionStat1Ctx1 + +func _sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var rc int32 + var _ /* pVal at bp+0 */ uintptr + _, _ = p, rc + p = pCtx + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FxOld})))(tls, (*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp) + if rc == SQLITE_OK && iCol == int32(1) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp)) = (*Tsqlite3_session)(unsafe.Pointer((*TSessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp)) + return rc +} + +func _sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var rc int32 + var _ /* pVal at bp+0 */ uintptr + _, _ = p, rc + p = pCtx + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FxNew})))(tls, (*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp) + if rc == SQLITE_OK && iCol == int32(1) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp))) == int32(SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp)) = (*Tsqlite3_session)(unsafe.Pointer((*TSessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp)) + return rc +} + +func _sessionStat1Count(tls *libc.TLS, pCtx uintptr) (r int32) { + var p uintptr + _ = p + p = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FxCount})))(tls, (*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func _sessionStat1Depth(tls *libc.TLS, pCtx uintptr) (r int32) { + var p uintptr + _ = p + p = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FxDepth})))(tls, (*TSessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func _sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bChanged, eType, ii, ii1, nIncr, nOld int32 + var pCsr, v3 uintptr + var _ /* dVal at bp+32 */ float64 + var _ /* iVal at bp+24 */ Tsqlite3_int64 + var _ /* nByte at bp+40 */ int32 + var _ /* nNew at bp+0 */ Ti64 + var _ /* p at bp+16 */ uintptr + var _ /* p at bp+8 */ uintptr + _, _, _, _, _, _, _, _ = bChanged, eType, ii, ii1, nIncr, nOld, pCsr, v3 + *(*Ti64)(unsafe.Pointer(bp)) = int64(2) + if int32((*TSessionChange)(unsafe.Pointer(pC)).Fop) == int32(SQLITE_INSERT) { + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + *(*Ti64)(unsafe.Pointer(bp)) += int64(9) + } + if op != int32(SQLITE_DELETE) { + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+8) + _sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 8)), bp) + goto _1 + _1: + ; + ii++ + } + } + } else { + if op == int32(SQLITE_DELETE) { + *(*Ti64)(unsafe.Pointer(bp)) += int64((*TSessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*Ti64)(unsafe.Pointer(bp)) += int64((*TSessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + pCsr = (*TSessionChange)(unsafe.Pointer(pC)).FaRecord + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + *(*Ti64)(unsafe.Pointer(bp)) += int64(libc.Int32FromInt32(9) + libc.Int32FromInt32(1)) + pCsr += uintptr(9) + } + ii1 = (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid + for { + if !(ii1 < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + bChanged = int32(1) + nOld = 0 + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii1-(*TSessionTable)(unsafe.Pointer(pTab)).FbRowid, bp+16) + if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { + return int32(SQLITE_NOMEM) + } + v3 = pCsr + pCsr++ + eType = int32(*(*Tu8)(unsafe.Pointer(v3))) + switch eType { + case int32(SQLITE_NULL): + bChanged = libc.BoolInt32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) != int32(SQLITE_NULL)) + case int32(SQLITE_FLOAT): + fallthrough + case int32(SQLITE_INTEGER): + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 24)) = _sessionGetI64(tls, pCsr) + if eType == int32(SQLITE_INTEGER) { + bChanged = libc.BoolInt32(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 24)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16)))) + } else { + libc.Xmemcpy(tls, bp+32, bp+24, uint64(8)) + bChanged = libc.BoolInt32(*(*float64)(unsafe.Pointer(bp + 32)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16)))) + } + } + nOld = int32(8) + pCsr += uintptr(8) + default: + nOld = _sessionVarintGet(tls, pCsr, bp+40) + pCsr += uintptr(nOld) + nOld += *(*int32)(unsafe.Pointer(bp + 40)) + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) && *(*int32)(unsafe.Pointer(bp + 40)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) && (*(*int32)(unsafe.Pointer(bp + 40)) == 0 || 0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16))), uint64(*(*int32)(unsafe.Pointer(bp + 40))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40))) + break + } + if bChanged != 0 && *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii1))) != 0 { + *(*Ti64)(unsafe.Pointer(bp)) = int64((*TSessionChange)(unsafe.Pointer(pC)).FnRecord + int32(2)) + break + } + if bChanged != 0 { + *(*Ti64)(unsafe.Pointer(bp)) += int64(int32(1) + nOld) + _sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16)), bp) + } else { + if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii1))) != 0 { + *(*Ti64)(unsafe.Pointer(bp)) += int64(int32(2) + nOld) + } else { + *(*Ti64)(unsafe.Pointer(bp)) += int64(2) + } + } + goto _2 + _2: + ; + ii1++ + } + } + } + if *(*Ti64)(unsafe.Pointer(bp)) > int64((*TSessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + nIncr = int32(*(*Ti64)(unsafe.Pointer(bp)) - int64((*TSessionChange)(unsafe.Pointer(pC)).FnMaxSize)) + (*TSessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*Ti64)(unsafe.Pointer(bp))) + *(*Ti64)(unsafe.Pointer(pSession + 64)) += int64(nIncr) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function is only called from with a pre-update-hook reporting a +// ** change on table pTab (attached to session pSession). The type of change +// ** (UPDATE, INSERT, DELETE) is specified by the first argument. +// ** +// ** Unless one is already present or an error occurs, an entry is added +// ** to the changed-rows hash table associated with table pTab. +// */ +func _sessionPreupdateOneChange(tls *libc.TLS, op int32, iRowid Ti64, pSession uintptr, pTab uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var i, nExpect, rc int32 + var p, pC uintptr + var _ /* bNull at bp+4 */ int32 + var _ /* iHash at bp+0 */ int32 + var _ /* nByte at bp+56 */ Tsqlite3_int64 + var _ /* p at bp+64 */ uintptr + var _ /* p at bp+72 */ uintptr + var _ /* stat1 at bp+8 */ TSessionStat1Ctx + _, _, _, _, _ = i, nExpect, p, pC, rc + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + rc = SQLITE_OK + nExpect = 0 + *(*TSessionStat1Ctx)(unsafe.Pointer(bp + 8)) = TSessionStat1Ctx{} + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return + } + /* Load table details if required */ + if _sessionInitTable(tls, pSession, pTab, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb) != 0 { + return + } + /* Check the number of columns in this xPreUpdate call matches the + ** number of columns in the table. */ + nExpect = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) + if (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-(*TSessionTable)(unsafe.Pointer(pTab)).FbRowid < nExpect { + if _sessionReinitTable(tls, pSession, pTab) != 0 { + return + } + if _sessionUpdateChanges(tls, pSession, pTab) != 0 { + return + } + } + if (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-(*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != nExpect { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = int32(SQLITE_SCHEMA) + return + } + /* Grow the hash table if required */ + if _sessionGrowHash(tls, pSession, 0, pTab) != 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = int32(SQLITE_NOMEM) + return + } + if (*TSessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0 { + (*(*TSessionStat1Ctx)(unsafe.Pointer(bp + 8))).Fhook = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*(*TSessionStat1Ctx)(unsafe.Pointer(bp + 8))).FpSession = pSession + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp + 8 + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = __ccgo_fp(_sessionStat1New) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = __ccgo_fp(_sessionStat1Old) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = __ccgo_fp(_sessionStat1Count) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = __ccgo_fp(_sessionStat1Depth) + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0) { + p = _sqlite3ValueNew(tls, uintptr(0)) + if p == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto error_out + } + _sqlite3ValueSetStr(tls, p, 0, __ccgo_ts+1680, uint8(0), libc.UintptrFromInt32(0)) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p + } + } + /* Calculate the hash-key for this change. If the primary key of the row + ** includes a NULL value, exit early. Such changes are ignored by the + ** session module. */ + rc = _sessionPreupdateHash(tls, pSession, iRowid, pTab, libc.BoolInt32(op == int32(SQLITE_INSERT)), bp, bp+4) + if rc != SQLITE_OK { + goto error_out + } + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + pC = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp)))*8)) + for { + if !(pC != 0) { + break + } + if _sessionPreupdateEqual(tls, pSession, iRowid, pTab, pC, op) != 0 { + break + } + goto _1 + _1: + ; + pC = (*TSessionChange)(unsafe.Pointer(pC)).FpNext + } + if pC == uintptr(0) { /* Used to iterate through columns */ + (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry++ + /* Figure out how large an allocation is required */ + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56)) = int64(32) + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-(*TSessionTable)(unsafe.Pointer(pTab)).FbRowid) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 64)) = uintptr(0) + if op != int32(SQLITE_INSERT) { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+64) + } else { + if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+64) + } + } + /* This may fail if SQLite value p contains a utf-16 string that must + ** be converted to utf-8 and an OOM error occurs while doing so. */ + rc = _sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 64)), bp+56) + if rc != SQLITE_OK { + goto error_out + } + goto _2 + _2: + ; + i++ + } + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56)) += int64(9) /* Size of rowid field - an integer */ + } + /* Allocate the change object */ + pC = _sessionMalloc64(tls, pSession, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56))) + if !(pC != 0) { + rc = int32(SQLITE_NOMEM) + goto error_out + } else { + libc.Xmemset(tls, pC, 0, uint64(32)) + (*TSessionChange)(unsafe.Pointer(pC)).FaRecord = pC + 1*32 + } + /* Populate the change object. None of the preupdate_old(), + ** preupdate_new() or SerializeValue() calls below may fail as all + ** required values and encodings have already been cached in memory. + ** It is not possible for an OOM to occur in this block. */ + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56)) = 0 + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + *(*Tu8)(unsafe.Pointer((*TSessionChange)(unsafe.Pointer(pC)).FaRecord)) = uint8(SQLITE_INTEGER) + _sessionPutI64(tls, (*TSessionChange)(unsafe.Pointer(pC)).FaRecord+1, iRowid) + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 56)) = int64(9) + } + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-(*TSessionTable)(unsafe.Pointer(pTab)).FbRowid) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 72)) = uintptr(0) + if op != int32(SQLITE_INSERT) { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72) + } else { + if *(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72) + } + } + _sessionSerializeValue(tls, (*TSessionChange)(unsafe.Pointer(pC)).FaRecord+uintptr(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 56))), *(*uintptr)(unsafe.Pointer(bp + 72)), bp+56) + goto _3 + _3: + ; + i++ + } + /* Add the change to the hash-table */ + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0 || (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0 { + (*TSessionChange)(unsafe.Pointer(pC)).FbIndirect = uint8(1) + } + (*TSessionChange)(unsafe.Pointer(pC)).FnRecordField = uint16((*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + (*TSessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 56))) + (*TSessionChange)(unsafe.Pointer(pC)).Fop = uint8(op) + (*TSessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp)))*8)) + *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp)))*8)) = pC + } else { + if (*TSessionChange)(unsafe.Pointer(pC)).FbIndirect != 0 { + /* If the existing change is considered "indirect", but this current + ** change is "direct", mark the change object as direct. */ + if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0 && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0 { + (*TSessionChange)(unsafe.Pointer(pC)).FbIndirect = uint8(0) + } + } + } + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + rc = _sessionUpdateMaxSize(tls, op, pSession, pTab, pC) + } + } + /* If an error has occurred, mark the session object as failed. */ +error_out: + ; + if (*TSessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*(*TSessionStat1Ctx)(unsafe.Pointer(bp + 8))).Fhook + } + if rc != SQLITE_OK { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = rc + } +} + +func _sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) (r int32) { + var nName, rc int32 + var pRet uintptr + _, _, _ = nName, pRet, rc + rc = SQLITE_OK + nName = _sqlite3Strlen30(tls, zName) + /* Search for an existing table */ + pRet = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable + for { + if !(pRet != 0) { + break + } + if 0 == Xsqlite3_strnicmp(tls, (*TSessionTable)(unsafe.Pointer(pRet)).FzName, zName, nName+int32(1)) { + break + } + goto _1 + _1: + ; + pRet = (*TSessionTable)(unsafe.Pointer(pRet)).FpNext + } + if pRet == uintptr(0) && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0 { + /* If there is a table-filter configured, invoke it. If it returns 0, + ** do not automatically add the new table. */ + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter})))(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0 { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + pRet = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable + for pRet != 0 && (*TSessionTable)(unsafe.Pointer(pRet)).FpNext != 0 { + pRet = (*TSessionTable)(unsafe.Pointer(pRet)).FpNext + } + } + } + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// C documentation +// +// /* +// ** The 'pre-update' hook registered by this module with SQLite databases. +// */ +func _xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Tsqlite3_int64, iKey2 Tsqlite3_int64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nDb int32 + var pSession uintptr + var _ /* pTab at bp+0 */ uintptr + _, _ = nDb, pSession + nDb = _sqlite3Strlen30(tls, zDb) + _ = iKey1 + _ = iKey2 + pSession = pCtx + for { + if !(pSession != 0) { + break + } + /* If this session is attached to a different database ("main", "temp" + ** etc.), or if it is not currently enabled, there is nothing to do. Skip + ** to the next session object attached to this database. */ + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + goto _1 + } + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + goto _1 + } + if Xsqlite3_strnicmp(tls, zDb, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, nDb+int32(1)) != 0 { + goto _1 + } + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc = _sessionFindTable(tls, pSession, zName, bp) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + _sessionPreupdateOneChange(tls, op, iKey1, pSession, *(*uintptr)(unsafe.Pointer(bp))) + if op == int32(SQLITE_UPDATE) { + _sessionPreupdateOneChange(tls, int32(SQLITE_INSERT), iKey2, pSession, *(*uintptr)(unsafe.Pointer(bp))) + } + } + goto _1 + _1: + ; + pSession = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpNext + } +} + +// C documentation +// +// /* +// ** The pre-update hook implementations. +// */ +func _sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) (r int32) { + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func _sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) (r int32) { + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func _sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) (r int32) { + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func _sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) (r int32) { + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// C documentation +// +// /* +// ** Install the pre-update hooks on the session object passed as the only +// ** argument. +// */ +func _sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = __ccgo_fp(_sessionPreupdateOld) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = __ccgo_fp(_sessionPreupdateNew) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = __ccgo_fp(_sessionPreupdateCount) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = __ccgo_fp(_sessionPreupdateDepth) +} + +type TSessionDiffCtx = struct { + FpStmt uintptr + FbRowid int32 + FnOldOff int32 +} + +type SessionDiffCtx = TSessionDiffCtx + +type TSessionDiffCtx1 = struct { + FpStmt uintptr + FbRowid int32 + FnOldOff int32 +} + +type SessionDiffCtx1 = TSessionDiffCtx1 + +// C documentation +// +// /* +// ** The diff hook implementations. +// */ +func _sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) (r int32) { + var p uintptr + _ = p + p = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*TSessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal+(*TSessionDiffCtx)(unsafe.Pointer(p)).FnOldOff+(*TSessionDiffCtx)(unsafe.Pointer(p)).FbRowid) + return SQLITE_OK +} + +func _sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) (r int32) { + var p uintptr + _ = p + p = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*TSessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal+(*TSessionDiffCtx)(unsafe.Pointer(p)).FbRowid) + return SQLITE_OK +} + +func _sessionDiffCount(tls *libc.TLS, pCtx uintptr) (r int32) { + var p uintptr + var v1 int32 + _, _ = p, v1 + p = pCtx + if (*TSessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + v1 = (*TSessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } else { + v1 = Xsqlite3_column_count(tls, (*TSessionDiffCtx)(unsafe.Pointer(p)).FpStmt) + } + return v1 - (*TSessionDiffCtx)(unsafe.Pointer(p)).FbRowid +} + +func _sessionDiffDepth(tls *libc.TLS, pCtx uintptr) (r int32) { + _ = pCtx + return 0 +} + +// C documentation +// +// /* +// ** Install the diff hooks on the session object passed as the only +// ** argument. +// */ +func _sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = __ccgo_fp(_sessionDiffOld) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = __ccgo_fp(_sessionDiffNew) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = __ccgo_fp(_sessionDiffCount) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = __ccgo_fp(_sessionDiffDepth) +} + +func _sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) (r uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var i int32 + var zRet, zSep uintptr + _, _, _ = i, zRet, zSep + zSep = __ccgo_ts + 1680 + zRet = uintptr(0) + i = 0 + for { + if !(i < nCol) { + break + } + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33487, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = __ccgo_ts + 22045 + if zRet == uintptr(0) { + break + } + } + goto _1 + _1: + ; + i++ + } + return zRet +} + +func _sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) (r uintptr) { + bp := tls.Alloc(80) + defer tls.Free(80) + var bHave, i int32 + var zRet, zSep uintptr + _, _, _, _ = bHave, i, zRet, zSep + zSep = __ccgo_ts + 1680 + zRet = uintptr(0) + bHave = 0 + i = 0 + for { + if !(i < nCol) { + break + } + if int32(*(*Tu8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = int32(1) + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33521, libc.VaList(bp+8, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = __ccgo_ts + 33562 + if zRet == uintptr(0) { + break + } + } + goto _1 + _1: + ; + i++ + } + if bHave == 0 { + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+1754, 0) + } + return zRet +} + +func _sessionSelectFindNew(tls *libc.TLS, zDb1 uintptr, zDb2 uintptr, bRowid int32, zTbl uintptr, zExpr uintptr) (r uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var zRet, zSel, v1 uintptr + _, _, _ = zRet, zSel, v1 + if bRowid != 0 { + v1 = __ccgo_ts + 33567 + } else { + v1 = __ccgo_ts + 6622 + } + zSel = v1 + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33578, libc.VaList(bp+8, zSel, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func _sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iRowid Ti64 + var pDiffCtx, zStmt uintptr + var rc int32 + var v1 int64 + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _ = iRowid, pDiffCtx, rc, zStmt, v1 + rc = SQLITE_OK + zStmt = _sessionSelectFindNew(tls, zDb1, zDb2, (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + if zStmt == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -int32(1), bp, uintptr(0)) + if rc == SQLITE_OK { + pDiffCtx = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp)) + (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FbRowid = (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid + for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + v1 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } else { + v1 = 0 + } + iRowid = v1 + _sessionPreupdateOneChange(tls, op, iRowid, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + Xsqlite3_free(tls, zStmt) + } + return rc +} + +// C documentation +// +// /* +// ** Return a comma-separated list of the fully-qualified (with both database +// ** and table name) column names from table pTab. e.g. +// ** +// ** "main"."t1"."a", "main"."t1"."b", "main"."t1"."c" +// */ +func _sessionAllCols(tls *libc.TLS, zDb uintptr, pTab uintptr) (r uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var ii int32 + var zRet, v2 uintptr + _, _, _ = ii, zRet, v2 + zRet = uintptr(0) + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if zRet != 0 { + v2 = __ccgo_ts + 15022 + } else { + v2 = __ccgo_ts + 1680 + } + zRet = Xsqlite3_mprintf(tls, __ccgo_ts+33657, libc.VaList(bp+8, zRet, v2, zDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FazCol + uintptr(ii)*8)))) + if !(zRet != 0) { + break + } + goto _1 + _1: + ; + ii++ + } + return zRet +} + +func _sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var iRowid Ti64 + var pDiffCtx, z1, z2, zExpr2, zStmt uintptr + var rc int32 + var v1 int64 + var _ /* pStmt at bp+0 */ uintptr + _, _, _, _, _, _, _, _ = iRowid, pDiffCtx, rc, z1, z2, zExpr2, zStmt, v1 + rc = SQLITE_OK + zExpr2 = _sessionExprCompareOther(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, (*TSessionTable)(unsafe.Pointer(pTab)).FazCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + z1 = _sessionAllCols(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, pTab) + z2 = _sessionAllCols(tls, zFrom, pTab) + zStmt = Xsqlite3_mprintf(tls, __ccgo_ts+33676, libc.VaList(bp+16, z1, z2, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) || z1 == uintptr(0) || z2 == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -int32(1), bp, uintptr(0)) + if rc == SQLITE_OK { + pDiffCtx = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp)) + (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*TSessionTable)(unsafe.Pointer(pTab)).FnCol + for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { + v1 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + } else { + v1 = 0 + } + iRowid = v1 + _sessionPreupdateOneChange(tls, int32(SQLITE_UPDATE), iRowid, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + Xsqlite3_free(tls, zStmt) + Xsqlite3_free(tls, z1) + Xsqlite3_free(tls, z2) + } + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bHasPk, bMismatch, i, rc int32 + var db, zDb, zExpr, v1 uintptr + var _ /* abPK at bp+32 */ uintptr + var _ /* azCol at bp+40 */ uintptr + var _ /* bRowid at bp+28 */ int32 + var _ /* d at bp+0 */ TSessionDiffCtx + var _ /* nCol at bp+24 */ int32 + var _ /* pTo at bp+16 */ uintptr + _, _, _, _, _, _, _, _ = bHasPk, bMismatch, db, i, rc, zDb, zExpr, v1 + zDb = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc + libc.Xmemset(tls, bp, 0, uint64(16)) + _sessionDiffHooks(tls, pSession, bp) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) + } + if rc == SQLITE_OK { + zExpr = uintptr(0) + db = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb /* Table zTbl */ + /* Locate and if necessary initialize the target table object */ + rc = _sessionFindTable(tls, pSession, zTbl, bp+16) + if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { + goto diff_out + } + if _sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16)), (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb) != 0 { + rc = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out + } + /* Check the table schemas match */ + if rc == SQLITE_OK { + bHasPk = 0 + bMismatch = 0 /* Columns in zFrom.zTbl */ + *(*int32)(unsafe.Pointer(bp + 28)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 40)) = uintptr(0) + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { + v1 = bp + 28 + } else { + v1 = uintptr(0) + } + rc = _sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24, uintptr(0), bp+40, uintptr(0), bp+32, v1) + if rc == SQLITE_OK { + if (*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24)) { + bMismatch = int32(1) + } else { + i = 0 + for { + if !(i < *(*int32)(unsafe.Pointer(bp + 24))) { + break + } + if int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FabPK + uintptr(i)))) != int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(i)))) { + bMismatch = int32(1) + } + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FazCol + uintptr(i)*8))) != 0 { + bMismatch = int32(1) + } + if *(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(i))) != 0 { + bHasPk = int32(1) + } + goto _2 + _2: + ; + i++ + } + } + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 40))) + if bMismatch != 0 { + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+33733, 0) + } + rc = int32(SQLITE_SCHEMA) + } + if bHasPk == 0 { + /* Ignore tables with no primary keys */ + goto diff_out + } + } + if rc == SQLITE_OK { + zExpr = _sessionExprComparePK(tls, (*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FnCol, zDb, zFrom, (*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FzName, (*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FazCol, (*TSessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))).FabPK) + } + /* Find new rows */ + if rc == SQLITE_OK { + rc = _sessionDiffFindNew(tls, int32(SQLITE_INSERT), pSession, *(*uintptr)(unsafe.Pointer(bp + 16)), zDb, zFrom, zExpr) + } + /* Find old rows */ + if rc == SQLITE_OK { + rc = _sessionDiffFindNew(tls, int32(SQLITE_DELETE), pSession, *(*uintptr)(unsafe.Pointer(bp + 16)), zFrom, zDb, zExpr) + } + /* Find modified rows */ + if rc == SQLITE_OK { + rc = _sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16)), zFrom, zExpr) + } + Xsqlite3_free(tls, zExpr) + } +diff_out: + ; + _sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// C documentation +// +// /* +// ** Create a session object. This session object will record changes to +// ** database zDb attached to connection db. +// */ +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) (r int32) { + var nDb int32 + var pNew, pOld uintptr + _, _, _ = nDb, pNew, pOld /* Session object already attached to db */ + nDb = _sqlite3Strlen30(tls, zDb) /* Length of zDb in bytes */ + /* Zero the output value in case an error occurs. */ + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + /* Allocate and populate the new session object. */ + pNew = Xsqlite3_malloc64(tls, uint64(136)+uint64(nDb)+uint64(1)) + if !(pNew != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pNew, 0, uint64(136)) + (*Tsqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Tsqlite3_session)(unsafe.Pointer(pNew)).FzDb = pNew + 1*136 + (*Tsqlite3_session)(unsafe.Pointer(pNew)).FbEnable = int32(1) + libc.Xmemcpy(tls, (*Tsqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, uint64(nDb+int32(1))) + _sessionPreupdateHooks(tls, pNew) + /* Add the new session object to the linked list of session objects + ** attached to database handle $db. Do this under the cover of the db + ** handle mutex. */ + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, __ccgo_fp(_xPreUpdate), pNew) + (*Tsqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Free the list of table objects passed as the first argument. The contents +// ** of the changed-rows hash tables are also deleted. +// */ +func _sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { + var i int32 + var p, pNext, pNextChange, pTab uintptr + _, _, _, _, _ = i, p, pNext, pNextChange, pTab + pTab = pList + for { + if !(pTab != 0) { + break + } + pNext = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange) { + break + } + p = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)) + for { + if !(p != 0) { + break + } + pNextChange = (*TSessionChange)(unsafe.Pointer(p)).FpNext + _sessionFree(tls, pSession, p) + goto _3 + _3: + ; + p = pNextChange + } + goto _2 + _2: + ; + i++ + } + Xsqlite3_finalize(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt) + _sessionFree(tls, pSession, (*TSessionTable)(unsafe.Pointer(pTab)).FazCol) /* cast works around VC++ bug */ + _sessionFree(tls, pSession, (*TSessionTable)(unsafe.Pointer(pTab)).FapChange) + _sessionFree(tls, pSession, pTab) + goto _1 + _1: + ; + pTab = pNext + } +} + +// C documentation +// +// /* +// ** Delete a session object previously allocated using sqlite3session_create(). +// */ +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var db, pp uintptr + var _ /* pHead at bp+0 */ uintptr + _, _ = db, pp + db = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb + /* Unlink the session from the linked list of sessions attached to the + ** database handle. Hold the db mutex while doing so. */ + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + pp = bp + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != uintptr(0)) { + break + } + if *(*uintptr)(unsafe.Pointer(pp)) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Tsqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + Xsqlite3_preupdate_hook(tls, db, __ccgo_fp(_xPreUpdate), *(*uintptr)(unsafe.Pointer(bp))) + } + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 80 + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + _sqlite3ValueFree(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + /* Delete all attached table objects. And the contents of their + ** associated hash-tables. */ + _sessionDeleteTable(tls, pSession, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable) + /* Free the session object. */ + Xsqlite3_free(tls, pSession) +} + +// C documentation +// +// /* +// ** Set a table filter on a Session Object. +// */ +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = int32(1) + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// C documentation +// +// /* +// ** Attach a table to a session. All subsequent changes made to the table +// ** while the session object is enabled will be recorded. +// ** +// ** Only tables that have a PRIMARY KEY defined may be attached. It does +// ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// ** or not. +// */ +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) (r int32) { + var nByte, nName, rc int32 + var pTab, ppTab uintptr + _, _, _, _, _ = nByte, nName, pTab, ppTab, rc + rc = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(zName != 0) { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = int32(1) + } else { /* Number of bytes in string zName */ + /* First search for an existing entry. If one is found, this call is + ** a no-op. Return early. */ + nName = _sqlite3Strlen30(tls, zName) + pTab = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable + for { + if !(pTab != 0) { + break + } + if 0 == Xsqlite3_strnicmp(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zName, nName+int32(1)) { + break + } + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + if !(pTab != 0) { + /* Allocate new SessionTable object. */ + nByte = int32(uint64(80) + uint64(nName) + uint64(1)) + pTab = _sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pTab, 0, uint64(80)) + (*TSessionTable)(unsafe.Pointer(pTab)).FzName = pTab + 1*80 + libc.Xmemcpy(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zName, uint64(nName+int32(1))) + ppTab = pSession + 88 + for { + if !(*(*uintptr)(unsafe.Pointer(ppTab)) != 0) { + break + } + goto _2 + _2: + ; + ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// C documentation +// +// /* +// ** Append the value passed as the second argument to the buffer passed +// ** as the first. +// ** +// ** This function is a no-op if *pRc is non-zero when it is called. +// ** Otherwise, if an error occurs, *pRc is set to an SQLite error code +// ** before returning. +// */ +func _sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p1 uintptr + var _ /* nByte at bp+8 */ Tsqlite3_int64 + var _ /* rc at bp+0 */ int32 + _ = p1 + *(*int32)(unsafe.Pointer(bp)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 + *(*int32)(unsafe.Pointer(bp)) = _sessionSerializeValue(tls, uintptr(0), pVal, bp+8) + _sessionBufferGrow(tls, p, *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)), bp) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sessionSerializeValue(tls, (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf), pVal, uintptr(0)) + p1 = p + 8 + *(*int32)(unsafe.Pointer(p1)) = int32(int64(*(*int32)(unsafe.Pointer(p1))) + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) + } + } +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append a single byte to the buffer. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendByte(tls *libc.TLS, p uintptr, v Tu8, pRc uintptr) { + var v1 int32 + var v2 uintptr + _, _ = v1, v2 + if 0 == _sessionBufferGrow(tls, p, int64(1), pRc) { + v2 = p + 8 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TSessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(v1))) = v + } +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append a single varint to the buffer. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { + if 0 == _sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8)) += _sessionVarintPut(tls, (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf), v) + } +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append a blob of data to the buffer. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { + if nBlob > 0 && 0 == _sessionBufferGrow(tls, p, int64(nBlob), pRc) { + libc.Xmemcpy(tls, (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf), aBlob, uint64(nBlob)) + *(*int32)(unsafe.Pointer(p + 8)) += nBlob + } +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append the string representation of integer iVal +// ** to the buffer. No nul-terminator is written. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* aBuf at bp+0 */ [24]int8 + Xsqlite3_snprintf(tls, int32(libc.Uint64FromInt64(24)-libc.Uint64FromInt32(1)), bp, __ccgo_ts+5170, libc.VaList(bp+32, iVal)) + _sessionAppendStr(tls, p, bp, pRc) +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwise, append the string zStr enclosed in quotes (") and +// ** with any embedded quote characters escaped to the buffer. No +// ** nul-terminator byte is written. +// ** +// ** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// ** returning. +// */ +func _sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { + var nStr int32 + var zIn, zOut, v1, v2, v3, v4, v5 uintptr + _, _, _, _, _, _, _, _ = nStr, zIn, zOut, v1, v2, v3, v4, v5 + nStr = _sqlite3Strlen30(tls, zStr)*int32(2) + int32(2) + int32(2) + if 0 == _sessionBufferGrow(tls, p, int64(nStr), pRc) { + zOut = (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf) + zIn = zStr + v1 = zOut + zOut++ + *(*int8)(unsafe.Pointer(v1)) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == int32('"') { + v2 = zOut + zOut++ + *(*int8)(unsafe.Pointer(v2)) = int8('"') + } + v3 = zOut + zOut++ + v4 = zIn + zIn++ + *(*int8)(unsafe.Pointer(v3)) = *(*int8)(unsafe.Pointer(v4)) + } + v5 = zOut + zOut++ + *(*int8)(unsafe.Pointer(v5)) = int8('"') + (*TSessionBuffer)(unsafe.Pointer(p)).FnBuf = int32(int64(zOut) - int64((*TSessionBuffer)(unsafe.Pointer(p)).FaBuf)) + *(*Tu8)(unsafe.Pointer((*TSessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf))) = uint8(0x00) + } +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. Otherwse, it appends the serialized version of the value stored +// ** in column iCol of the row that SQL statement pStmt currently points +// ** to to the buffer. +// */ +func _sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var eType, nByte int32 + var z uintptr + var _ /* aBuf at bp+8 */ [8]Tu8 + var _ /* i at bp+0 */ Tsqlite3_int64 + var _ /* r at bp+16 */ float64 + _, _, _ = eType, nByte, z + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + eType = Xsqlite3_column_type(tls, pStmt, iCol) + _sessionAppendByte(tls, p, uint8(eType), pRc) + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + if eType == int32(SQLITE_INTEGER) { + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 16)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp, bp+16, uint64(8)) + } + _sessionPutI64(tls, bp+8, *(*Tsqlite3_int64)(unsafe.Pointer(bp))) + _sessionAppendBlob(tls, p, bp+8, int32(8), pRc) + } + if eType == int32(SQLITE_BLOB) || eType == int32(SQLITE_TEXT) { + if eType == int32(SQLITE_BLOB) { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if z != 0 || eType == int32(SQLITE_BLOB) && nByte == 0 { + _sessionAppendVarint(tls, p, nByte, pRc) + _sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } + } +} + +// C documentation +// +// /* +// ** +// ** This function appends an update change to the buffer (see the comments +// ** under "CHANGESET FORMAT" at the top of the file). An update change +// ** consists of: +// ** +// ** 1 byte: SQLITE_UPDATE (0x17) +// ** n bytes: old.* record (see RECORD FORMAT) +// ** m bytes: new.* record (see RECORD FORMAT) +// ** +// ** The SessionChange object passed as the third argument contains the +// ** values that were stored in the row when the session began (the old.* +// ** values). The statement handle passed as the second argument points +// ** at the current version of the row (the new.* values). +// ** +// ** If all of the old.* values are equal to their corresponding new.* value +// ** (i.e. nothing has changed), then no data at all is appended to the buffer. +// ** +// ** Otherwise, the old.* record contains all primary key values and the +// ** original values of any fields that have been modified. The new.* record +// ** contains the new values of only those fields that have been modified. +// */ +func _sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bChanged, bNoop, eType, i, nAdvance, nHdr, nRewind int32 + var pCsr uintptr + var _ /* buf2 at bp+8 */ TSessionBuffer + var _ /* dVal at bp+32 */ float64 + var _ /* iVal at bp+24 */ Tsqlite3_int64 + var _ /* n at bp+40 */ int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _ = bChanged, bNoop, eType, i, nAdvance, nHdr, nRewind, pCsr + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} /* Buffer to accumulate new.* record in */ + bNoop = int32(1) /* Set to zero if any values are modified */ + nRewind = (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf /* Used to iterate through columns */ + pCsr = (*TSessionChange)(unsafe.Pointer(p)).FaRecord /* Used to iterate through old.* values */ + _sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp) + _sessionAppendByte(tls, pBuf, (*TSessionChange)(unsafe.Pointer(p)).FbIndirect, bp) + i = 0 + for { + if !(i < Xsqlite3_column_count(tls, pStmt)) { + break + } + bChanged = 0 + eType = int32(*(*Tu8)(unsafe.Pointer(pCsr))) + switch eType { + case int32(SQLITE_NULL): + nAdvance = int32(1) + if Xsqlite3_column_type(tls, pStmt, i) != int32(SQLITE_NULL) { + bChanged = int32(1) + } + case int32(SQLITE_FLOAT): + fallthrough + case int32(SQLITE_INTEGER): + nAdvance = int32(9) + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 24)) = _sessionGetI64(tls, pCsr+1) + if eType == int32(SQLITE_INTEGER) { + if *(*Tsqlite3_int64)(unsafe.Pointer(bp + 24)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + libc.Xmemcpy(tls, bp+32, bp+24, uint64(8)) + if *(*float64)(unsafe.Pointer(bp + 32)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = int32(1) + default: + nHdr = int32(1) + _sessionVarintGet(tls, pCsr+1, bp+40) + nAdvance = nHdr + *(*int32)(unsafe.Pointer(bp + 40)) + if eType == Xsqlite3_column_type(tls, pStmt, i) && *(*int32)(unsafe.Pointer(bp + 40)) == Xsqlite3_column_bytes(tls, pStmt, i) && (*(*int32)(unsafe.Pointer(bp + 40)) == 0 || 0 == libc.Xmemcmp(tls, pCsr+uintptr(nHdr), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 40))))) { + break + } + bChanged = int32(1) + } + /* If at least one field has been modified, this is not a no-op. */ + if bChanged != 0 { + bNoop = 0 + } + /* Add a field to the old.* record. This is omitted if this module is + ** currently generating a patchset. */ + if bPatchset == 0 { + if bChanged != 0 || *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + _sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp) + } else { + _sessionAppendByte(tls, pBuf, uint8(0), bp) + } + } + /* Add a field to the new.* record. Or the only record if currently + ** generating a patchset. */ + if bChanged != 0 || bPatchset != 0 && *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + _sessionAppendCol(tls, bp+8, pStmt, i, bp) + } else { + _sessionAppendByte(tls, bp+8, uint8(0), bp) + } + pCsr += uintptr(nAdvance) + goto _1 + _1: + ; + i++ + } + if bNoop != 0 { + (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + _sessionAppendBlob(tls, pBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, bp) + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Append a DELETE change to the buffer passed as the first argument. Use +// ** the changeset format if argument bPatchset is zero, or the patchset +// ** format otherwise. +// */ +func _sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, pStart, v2 uintptr + var eType, i int32 + var _ /* n at bp+4 */ int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _ = a, eType, i, pStart, v2 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + _sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp) + _sessionAppendByte(tls, pBuf, (*TSessionChange)(unsafe.Pointer(p)).FbIndirect, bp) + if bPatchset == 0 { + _sessionAppendBlob(tls, pBuf, (*TSessionChange)(unsafe.Pointer(p)).FaRecord, (*TSessionChange)(unsafe.Pointer(p)).FnRecord, bp) + } else { + a = (*TSessionChange)(unsafe.Pointer(p)).FaRecord + i = 0 + for { + if !(i < nCol) { + break + } + pStart = a + v2 = a + a++ + eType = int32(*(*Tu8)(unsafe.Pointer(v2))) + switch eType { + case 0: + fallthrough + case int32(SQLITE_NULL): + case int32(SQLITE_FLOAT): + fallthrough + case int32(SQLITE_INTEGER): + a += uintptr(8) + default: + a += uintptr(_sessionVarintGet(tls, a, bp+4)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4))) + break + } + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + _sessionAppendBlob(tls, pBuf, pStart, int32(int64(a)-int64(pStart)), bp) + } + goto _1 + _1: + ; + i++ + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Formulate and prepare a SELECT statement to retrieve a row from table +// ** zTab in database zDb based on its primary key. i.e. +// ** +// ** SELECT *, FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...) +// ** +// ** where is: +// ** +// ** 1 AND (?A OR ?1 IS ) AND ... +// ** +// ** for each non-pk . +// */ +func _sessionSelectStmt(tls *libc.TLS, db uintptr, bIgnoreNoop int32, zDb uintptr, zTab uintptr, bRowid int32, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) (r int32) { + bp := tls.Alloc(112) + defer tls.Free(112) + var i, nSql int32 + var zCols, zSep, zSql, v1, v3 uintptr + var _ /* nooptest at bp+8 */ TSessionBuffer + var _ /* pkfield at bp+24 */ TSessionBuffer + var _ /* pkvar at bp+40 */ TSessionBuffer + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _ = i, nSql, zCols, zSep, zSql, v1, v3 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + zSql = uintptr(0) + zSep = __ccgo_ts + 1680 + if bRowid != 0 { + v1 = __ccgo_ts + 33567 + } else { + v1 = __ccgo_ts + 6622 + } + zCols = v1 + nSql = -int32(1) + *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} + *(*TSessionBuffer)(unsafe.Pointer(bp + 24)) = TSessionBuffer{} + *(*TSessionBuffer)(unsafe.Pointer(bp + 40)) = TSessionBuffer{} + _sessionAppendStr(tls, bp+8, __ccgo_ts+33760, bp) + if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+11614, zTab) { + _sessionAppendStr(tls, bp+8, __ccgo_ts+33764, bp) + _sessionAppendStr(tls, bp+24, __ccgo_ts+33788, bp) + _sessionAppendStr(tls, bp+40, __ccgo_ts+33797, bp) + zCols = __ccgo_ts + 33842 + } else { + i = 0 + for { + if !(i < nCol) { + break + } + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + _sessionAppendStr(tls, bp+24, zSep, bp) + _sessionAppendStr(tls, bp+40, zSep, bp) + zSep = __ccgo_ts + 15022 + _sessionAppendIdent(tls, bp+24, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp) + _sessionAppendPrintf(tls, bp+40, bp, __ccgo_ts+33856, libc.VaList(bp+64, i+int32(1))) + } else { + _sessionAppendPrintf(tls, bp+8, bp, __ccgo_ts+33860, libc.VaList(bp+64, i+int32(1)+nCol, i+int32(1), zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + } + goto _2 + _2: + ; + i++ + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if bIgnoreNoop != 0 { + v3 = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf + } else { + v3 = __ccgo_ts + 1680 + } + zSql = Xsqlite3_mprintf(tls, __ccgo_ts+33887, libc.VaList(bp+64, zCols, v3, zDb, zTab, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 40))).FaBuf)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf) + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 40))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Bind the PRIMARY KEY values from the change passed in argument pChange +// ** to the SELECT statement passed as the first argument. The SELECT statement +// ** is as prepared by function sessionSelectStmt(). +// ** +// ** Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// ** error code (e.g. SQLITE_NOMEM) otherwise. +// */ +func _sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var a, v2 uintptr + var eType, i, rc int32 + var iVal Ti64 + var _ /* iVal at bp+8 */ Ti64 + var _ /* n at bp+16 */ int32 + var _ /* n at bp+20 */ int32 + var _ /* rVal at bp+0 */ float64 + _, _, _, _, _, _ = a, eType, i, iVal, rc, v2 + rc = SQLITE_OK + a = (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord + i = 0 + for { + if !(i < nCol && rc == SQLITE_OK) { + break + } + v2 = a + a++ + eType = int32(*(*Tu8)(unsafe.Pointer(v2))) + switch eType { + case 0: + fallthrough + case int32(SQLITE_NULL): + case int32(SQLITE_INTEGER): + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + iVal = _sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, i+int32(1), iVal) + } + a += uintptr(8) + case int32(SQLITE_FLOAT): + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + *(*Ti64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp, bp+8, uint64(8)) + rc = Xsqlite3_bind_double(tls, pSelect, i+int32(1), *(*float64)(unsafe.Pointer(bp))) + } + a += uintptr(8) + case int32(SQLITE_TEXT): + a += uintptr(_sessionVarintGet(tls, a, bp+16)) + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, i+int32(1), a, *(*int32)(unsafe.Pointer(bp + 16)), uintptr(-libc.Int32FromInt32(1))) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16))) + default: + a += uintptr(_sessionVarintGet(tls, a, bp+20)) + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, i+int32(1), a, *(*int32)(unsafe.Pointer(bp + 20)), uintptr(-libc.Int32FromInt32(1))) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20))) + break + } + goto _1 + _1: + ; + i++ + } + return rc +} + +// C documentation +// +// /* +// ** This function is a no-op if *pRc is set to other than SQLITE_OK when it +// ** is called. Otherwise, append a serialized table header (part of the binary +// ** changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// ** SQLite error code before returning. +// */ +func _sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { + var v1 int32 + _ = v1 + /* Write a table header */ + if bPatchset != 0 { + v1 = int32('P') + } else { + v1 = int32('T') + } + _sessionAppendByte(tls, pBuf, uint8(v1), pRc) + _sessionAppendVarint(tls, pBuf, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + _sessionAppendBlob(tls, pBuf, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + _sessionAppendBlob(tls, pBuf, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, int32(libc.Xstrlen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName))+int32(1), pRc) +} + +// C documentation +// +// /* +// ** Generate either a changeset (if argument bPatchset is zero) or a patchset +// ** (if it is non-zero) based on the current contents of the session object +// ** passed as the first argument. +// ** +// ** If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// ** stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// ** occurs, an SQLite error code is returned and both output variables set +// ** to 0. +// */ +func _sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var db, p, pTab, zName uintptr + var i, iCol, nNoop, nOldCol, nRewind int32 + var _ /* buf at bp+0 */ TSessionBuffer + var _ /* pSel at bp+24 */ uintptr + var _ /* rc at bp+16 */ int32 + _, _, _, _, _, _, _, _, _ = db, i, iCol, nNoop, nOldCol, nRewind, p, pTab, zName + db = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb /* Used to iterate through attached tables */ + *(*TSessionBuffer)(unsafe.Pointer(bp)) = TSessionBuffer{} /* Return code */ + /* Zero the output variables in case an error occurs. If this session + ** object is already in the error state (sqlite3_session.rc != SQLITE_OK), + ** this call will be a no-op. */ + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 16)) = Xsqlite3_exec(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, __ccgo_ts+33929, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 16)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 16)) + } + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pTab = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable + for { + if !(*(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK && pTab != 0) { + break + } + if (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + zName = (*TSessionTable)(unsafe.Pointer(pTab)).FzName /* Used to iterate through hash buckets */ + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) /* SELECT statement to query table pTab */ + nRewind = (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf /* Size of buffer after writing tbl header */ + nOldCol = (*TSessionTable)(unsafe.Pointer(pTab)).FnCol + /* Check the table schema is still Ok. */ + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionReinitTable(tls, pSession, pTab) + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK && (*TSessionTable)(unsafe.Pointer(pTab)).FnCol != nOldCol { + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionUpdateChanges(tls, pSession, pTab) + } + /* Write a table header */ + _sessionAppendTableHdr(tls, bp, bPatchset, pTab, bp+16) + /* Build and compile a statement to execute: */ + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionSelectStmt(tls, db, 0, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*TSessionTable)(unsafe.Pointer(pTab)).FazCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK, bp+24) + } + nNoop = (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange && *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK) { + break + } /* Used to iterate through changes */ + p = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)) + for { + if !(*(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK && p != 0) { + break + } + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 24)), (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK, p) + if *(*int32)(unsafe.Pointer(bp + 16)) != SQLITE_OK { + goto _3 + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) == int32(SQLITE_ROW) { + if int32((*TSessionChange)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INSERT) { + _sessionAppendByte(tls, bp, uint8(SQLITE_INSERT), bp+16) + _sessionAppendByte(tls, bp, (*TSessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16) + iCol = 0 + for { + if !(iCol < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + _sessionAppendCol(tls, bp, *(*uintptr)(unsafe.Pointer(bp + 24)), iCol, bp+16) + goto _4 + _4: + ; + iCol++ + } + } else { + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionAppendUpdate(tls, bp, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 24)), p, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK) + } + } else { + if int32((*TSessionChange)(unsafe.Pointer(p)).Fop) != int32(SQLITE_INSERT) { + *(*int32)(unsafe.Pointer(bp + 16)) = _sessionAppendDelete(tls, bp, bPatchset, p, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK) + } + } + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + } + /* If the buffer is now larger than sessions_strm_chunk_size, pass + ** its contents to the xOutput() callback. */ + if xOutput != 0 && *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK && (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf > nNoop && (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf > _sessions_strm_chunk_size { + *(*int32)(unsafe.Pointer(bp + 16)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf) + nNoop = -int32(1) + (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf = 0 + } + goto _3 + _3: + ; + p = (*TSessionChange)(unsafe.Pointer(p)).FpNext + } + goto _2 + _2: + ; + i++ + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + if (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf == nNoop { + (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf = nRewind + } + } + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + if *(*int32)(unsafe.Pointer(bp + 16)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf + (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf = uintptr(0) + } else { + if (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FnBuf) + } + } + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp))).FaBuf) + Xsqlite3_exec(tls, db, __ccgo_ts+33949, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 16)) +} + +// C documentation +// +// /* +// ** Obtain a changeset object containing all changes recorded by the +// ** session object passed as the first argument. +// ** +// ** It is the responsibility of the caller to eventually free the buffer +// ** using sqlite3_free(). +// */ +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) (r int32) { + var rc int32 + _ = rc + if pnChangeset == uintptr(0) || ppChangeset == uintptr(0) { + return int32(SQLITE_MISUSE) + } + rc = _sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + return rc +} + +// C documentation +// +// /* +// ** Streaming version of sqlite3session_changeset(). +// */ +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) (r int32) { + if xOutput == uintptr(0) { + return int32(SQLITE_MISUSE) + } + return _sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** Streaming version of sqlite3session_patchset(). +// */ +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) (r int32) { + if xOutput == uintptr(0) { + return int32(SQLITE_MISUSE) + } + return _sessionGenerateChangeset(tls, pSession, int32(1), xOutput, pOut, uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** Obtain a patchset object containing all changes recorded by the +// ** session object passed as the first argument. +// ** +// ** It is the responsibility of the caller to eventually free the buffer +// ** using sqlite3_free(). +// */ +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) (r int32) { + if pnPatchset == uintptr(0) || ppPatchset == uintptr(0) { + return int32(SQLITE_MISUSE) + } + return _sessionGenerateChangeset(tls, pSession, int32(1), uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// C documentation +// +// /* +// ** Enable or disable the session object passed as the first argument. +// */ +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) (r int32) { + var ret int32 + _ = ret + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// C documentation +// +// /* +// ** Enable or disable the session object passed as the first argument. +// */ +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) (r int32) { + var ret int32 + _ = ret + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// C documentation +// +// /* +// ** Return true if there have been no changes to monitored tables recorded +// ** by the session object passed as the only argument. +// */ +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) (r int32) { + var pTab uintptr + var ret int32 + _, _ = pTab, ret + ret = 0 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + pTab = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable + for { + if !(pTab != 0 && ret == 0) { + break + } + ret = libc.BoolInt32((*TSessionTable)(unsafe.Pointer(pTab)).FnEntry > 0) + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return libc.BoolInt32(ret == 0) +} + +// C documentation +// +// /* +// ** Return the amount of heap memory in use. +// */ +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) (r Tsqlite3_int64) { + return (*Tsqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// C documentation +// +// /* +// ** Configure the session object passed as the first argument. +// */ +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) (r int32) { + var iArg, iArg1, rc int32 + _, _, _ = iArg, iArg1, rc + rc = SQLITE_OK + switch op { + case int32(SQLITE_SESSION_OBJCONFIG_SIZE): + iArg = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = int32(SQLITE_MISUSE) + } else { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = libc.BoolInt32(iArg != 0) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + case int32(SQLITE_SESSION_OBJCONFIG_ROWID): + iArg1 = *(*int32)(unsafe.Pointer(pArg)) + if iArg1 >= 0 { + if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = int32(SQLITE_MISUSE) + } else { + (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK = libc.BoolInt32(iArg1 != 0) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK + default: + rc = int32(SQLITE_MISUSE) + } + return rc +} + +// C documentation +// +// /* +// ** Return the maximum size of sqlite3session_changeset() output. +// */ +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) (r Tsqlite3_int64) { + return (*Tsqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// C documentation +// +// /* +// ** Do the work for either sqlite3changeset_start() or start_strm(). +// */ +func _sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) (r int32) { + var nByte, v1 int32 + var pRet uintptr + _, _, _ = nByte, pRet, v1 /* Number of bytes to allocate for iterator */ + /* Zero the output variable in case an error occurs. */ + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + /* Allocate and initialize the iterator structure. */ + nByte = int32(152) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pRet, 0, uint64(152)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + if xInput != 0 { + v1 = 0 + } else { + v1 = int32(1) + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = v1 + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + /* Populate the output variable and return success. */ + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Create an iterator used to iterate through the contents of a changeset. +// */ +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) (r int32) { + return _sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) (r int32) { + var bInvert int32 + _ = bInvert + bInvert = libc.BoolInt32(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETSTART_INVERT) != 0)) + return _sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// C documentation +// +// /* +// ** Streaming version of sqlite3changeset_start(). +// */ +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) (r int32) { + return _sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) (r int32) { + var bInvert int32 + _ = bInvert + bInvert = libc.BoolInt32(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETSTART_INVERT) != 0)) + return _sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// C documentation +// +// /* +// ** If the SessionInput object passed as the only argument is a streaming +// ** object and the buffer is full, discard some data to free up space. +// */ +func _sessionDiscardData(tls *libc.TLS, pIn uintptr) { + var nMove int32 + _ = nMove + if (*TSessionInput)(unsafe.Pointer(pIn)).FxInput != 0 && (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= _sessions_strm_chunk_size { + nMove = (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*TSessionInput)(unsafe.Pointer(pIn)).FiNext + if nMove > 0 { + libc.Xmemmove(tls, (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext), uint64(nMove)) + } + (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf -= (*TSessionInput)(unsafe.Pointer(pIn)).FiNext + (*TSessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*TSessionInput)(unsafe.Pointer(pIn)).FnData = (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// C documentation +// +// /* +// ** Ensure that there are at least nByte bytes available in the buffer. Or, +// ** if there are not nByte bytes remaining in the input, that all available +// ** data is in the buffer. +// ** +// ** Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +// */ +func _sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* nNew at bp+4 */ int32 + var _ /* rc at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + if (*TSessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for !((*TSessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nByte >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 4)) = _sessions_strm_chunk_size + if (*TSessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + _sessionDiscardData(tls, pIn) + } + if SQLITE_OK == _sessionBufferGrow(tls, pIn+32, int64(*(*int32)(unsafe.Pointer(bp + 4))), bp) { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TSessionInput)(unsafe.Pointer(pIn)).FxInput})))(tls, (*TSessionInput)(unsafe.Pointer(pIn)).FpIn, (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf), bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + (*TSessionInput)(unsafe.Pointer(pIn)).FbEof = int32(1) + } else { + (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf += *(*int32)(unsafe.Pointer(bp + 4)) + } + } + (*TSessionInput)(unsafe.Pointer(pIn)).FaData = (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*TSessionInput)(unsafe.Pointer(pIn)).FnData = (*TSessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** When this function is called, *ppRec points to the start of a record +// ** that contains nCol values. This function advances the pointer *ppRec +// ** until it points to the byte immediately following that record. +// */ +func _sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aRec, v2 uintptr + var eType, i int32 + var _ /* nByte at bp+0 */ int32 + _, _, _, _ = aRec, eType, i, v2 + aRec = *(*uintptr)(unsafe.Pointer(ppRec)) + i = 0 + for { + if !(i < nCol) { + break + } + v2 = aRec + aRec++ + eType = int32(*(*Tu8)(unsafe.Pointer(v2))) + if eType == int32(SQLITE_TEXT) || eType == int32(SQLITE_BLOB) { + aRec += uintptr(_sessionVarintGet(tls, aRec, bp)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp))) + } else { + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + goto _1 + _1: + ; + i++ + } + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// C documentation +// +// /* +// ** This function sets the value of the sqlite3_value object passed as the +// ** first argument to a copy of the string or blob held in the aData[] +// ** buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// ** error occurs. +// */ +func _sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc Tu8) (r int32) { + var aCopy uintptr + _ = aCopy + /* In theory this code could just pass SQLITE_TRANSIENT as the final + ** argument to sqlite3ValueSetStr() and have the copy created + ** automatically. But doing so makes it difficult to detect any OOM + ** error. Hence the code to create the copy externally. */ + aCopy = Xsqlite3_malloc64(tls, uint64(int64(nData)+int64(1))) + if aCopy == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemcpy(tls, aCopy, aData, uint64(nData)) + _sqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, __ccgo_fp(Xsqlite3_free)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// ** for details. +// ** +// ** When this function is called, *paChange points to the start of the record +// ** to deserialize. Assuming no error occurs, *paChange is set to point to +// ** one byte after the end of the same record before this function returns. +// ** If the argument abPK is NULL, then the record contains nCol values. Or, +// ** if abPK is other than NULL, then the record contains only the PK fields +// ** (in other words, it is a patchset DELETE record). +// ** +// ** If successful, each element of the apOut[] array (allocated by the caller) +// ** is set to point to an sqlite3_value object containing the value read +// ** from the corresponding position in the record. If that value is not +// ** included in the record (i.e. because the record is part of an UPDATE change +// ** and the field was not modified), the corresponding element of apOut[] is +// ** set to NULL. +// ** +// ** It is the responsibility of the caller to free all sqlite_value structures +// ** using sqlite3_free(). +// ** +// ** If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// ** The apOut[] array may have been partially populated in this case. +// */ +func _sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aVal, v3 uintptr + var eType, i, rc, v2, v4 int32 + var enc Tu8 + var _ /* d at bp+16 */ float64 + var _ /* nByte at bp+0 */ int32 + var _ /* v at bp+8 */ Tsqlite3_int64 + _, _, _, _, _, _, _, _ = aVal, eType, enc, i, rc, v2, v3, v4 /* Used to iterate through columns */ + rc = SQLITE_OK + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = int32(1) + } + i = 0 + for { + if !(i < nCol && rc == SQLITE_OK) { + break + } + eType = 0 /* Type of value (SQLITE_NULL, TEXT etc.) */ + if abPK != 0 && int32(*(*Tu8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + goto _1 + } + rc = _sessionInputBuffer(tls, pIn, int32(9)) + if rc == SQLITE_OK { + if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext >= (*TSessionInput)(unsafe.Pointer(pIn)).FnData { + rc = _sqlite3CorruptError(tls, int32(226700)) + } else { + v3 = pIn + 8 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + eType = int32(*(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(v2)))) + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = _sqlite3ValueNew(tls, uintptr(0)) + if !(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) != 0) { + rc = int32(SQLITE_NOMEM) + } + } + } + } + if rc == SQLITE_OK { + aVal = (*TSessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext) + if eType == int32(SQLITE_TEXT) || eType == int32(SQLITE_BLOB) { + *(*int32)(unsafe.Pointer(pIn + 8)) += _sessionVarintGet(tls, aVal, bp) + rc = _sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp))) + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext { + rc = _sqlite3CorruptError(tls, int32(226720)) + } else { + if eType == int32(SQLITE_TEXT) { + v4 = int32(SQLITE_UTF8) + } else { + v4 = 0 + } + enc = uint8(v4) + rc = _sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), (*TSessionInput)(unsafe.Pointer(pIn)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext), *(*int32)(unsafe.Pointer(bp)), enc) + *(*int32)(unsafe.Pointer(pIn + 8)) += *(*int32)(unsafe.Pointer(bp)) + } + } + } + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + if (*TSessionInput)(unsafe.Pointer(pIn)).FnData-(*TSessionInput)(unsafe.Pointer(pIn)).FiNext < int32(8) { + rc = _sqlite3CorruptError(tls, int32(226730)) + } else { + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = _sessionGetI64(tls, aVal) + if eType == int32(SQLITE_INTEGER) { + _sqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8))) + } else { + libc.Xmemcpy(tls, bp+16, bp+8, uint64(8)) + _sqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 16))) + } + *(*int32)(unsafe.Pointer(pIn + 8)) += int32(8) + } + } + } + goto _1 + _1: + ; + i++ + } + return rc +} + +// C documentation +// +// /* +// ** The input pointer currently points to the second byte of a table-header. +// ** Specifically, to the following: +// ** +// ** + number of columns in table (varint) +// ** + array of PK flags (1 byte per column), +// ** + table name (nul terminated). +// ** +// ** This function ensures that all of the above is present in the input +// ** buffer (i.e. that it can be accessed without any calls to xInput()). +// ** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// ** The input pointer is not moved. +// */ +func _sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nRead, rc int32 + var _ /* nCol at bp+0 */ int32 + _, _ = nRead, rc + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp)) = 0 + nRead = 0 + rc = _sessionInputBuffer(tls, pIn, int32(9)) + if rc == SQLITE_OK { + nRead += _sessionVarintGet(tls, (*TSessionInput)(unsafe.Pointer(pIn)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nRead), bp) + /* The hard upper limit for the number of columns in an SQLite + ** database table is, according to sqliteLimit.h, 32676. So + ** consider any table-header that purports to have more than 65536 + ** columns to be corrupt. This is convenient because otherwise, + ** if the (nCol>65536) condition below were omitted, a sufficiently + ** large value for nCol may cause nRead to wrap around and become + ** negative. Leading to a crash. */ + if *(*int32)(unsafe.Pointer(bp)) < 0 || *(*int32)(unsafe.Pointer(bp)) > int32(65536) { + rc = _sqlite3CorruptError(tls, int32(226778)) + } else { + rc = _sessionInputBuffer(tls, pIn, nRead+*(*int32)(unsafe.Pointer(bp))+int32(100)) + nRead += *(*int32)(unsafe.Pointer(bp)) + } + } + for rc == SQLITE_OK { + for (*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nRead < (*TSessionInput)(unsafe.Pointer(pIn)).FnData && *(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nRead))) != 0 { + nRead++ + } + if (*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nRead < (*TSessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = _sessionInputBuffer(tls, pIn, nRead+int32(100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = nRead + int32(1) + return rc +} + +// C documentation +// +// /* +// ** The input pointer currently points to the first byte of the first field +// ** of a record consisting of nCol columns. This function ensures the entire +// ** record is buffered. It does not move the input pointer. +// ** +// ** If successful, SQLITE_OK is returned and *pnByte is set to the size of +// ** the record in bytes. Otherwise, an SQLite error code is returned. The +// ** final value of *pnByte is undefined in this case. +// */ +func _sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eType, i, nByte, rc, v2 int32 + var _ /* n at bp+0 */ int32 + _, _, _, _, _ = eType, i, nByte, rc, v2 + rc = SQLITE_OK + nByte = 0 + i = 0 + for { + if !(rc == SQLITE_OK && i < nCol) { + break + } + rc = _sessionInputBuffer(tls, pIn, nByte+int32(10)) + if rc == SQLITE_OK { + v2 = nByte + nByte++ + eType = int32(*(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext+v2)))) + if eType == int32(SQLITE_TEXT) || eType == int32(SQLITE_BLOB) { + nByte += _sessionVarintGet(tls, (*TSessionInput)(unsafe.Pointer(pIn)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pIn)).FiNext+nByte), bp) + nByte += *(*int32)(unsafe.Pointer(bp)) + rc = _sessionInputBuffer(tls, pIn, nByte) + } else { + if eType == int32(SQLITE_INTEGER) || eType == int32(SQLITE_FLOAT) { + nByte += int32(8) + } + } + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// C documentation +// +// /* +// ** The input pointer currently points to the second byte of a table-header. +// ** Specifically, to the following: +// ** +// ** + number of columns in table (varint) +// ** + array of PK flags (1 byte per column), +// ** + table name (nul terminated). +// ** +// ** This function decodes the table-header and populates the p->nCol, +// ** p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// ** also allocated or resized according to the new value of p->nCol. The +// ** input pointer is left pointing to the byte following the table header. +// ** +// ** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// ** is returned and the final values of the various fields enumerated above +// ** are undefined. +// */ +func _sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPK Tsize_t + var nByte, nVarint, v2 int32 + var v1 uintptr + var _ /* nCopy at bp+4 */ int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _ = iPK, nByte, nVarint, v1, v2 + *(*int32)(unsafe.Pointer(bp)) = _sessionChangesetBufferTblhdr(tls, p, bp+4) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + nVarint = _sessionVarintGet(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData+uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext), p+120) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp + 4)) -= nVarint + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext += nVarint + nByte = int32(uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(8)*uint64(2) + uint64(*(*int32)(unsafe.Pointer(bp + 4)))) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + _sessionBufferGrow(tls, p+72, int64(nByte), bp) + } else { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(226866)) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + iPK = uint64(8) * uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(2) + libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf+uintptr(iPK), (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData+uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext), uint64(*(*int32)(unsafe.Pointer(bp + 4)))) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext += *(*int32)(unsafe.Pointer(bp + 4)) + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*int32(2))*8 + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + v1 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) + } else { + v1 = uintptr(0) + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = v1 + } + v2 = *(*int32)(unsafe.Pointer(bp)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v2 + return v2 +} + +// C documentation +// +// /* +// ** Advance the changeset iterator to the next change. The differences between +// ** this function and sessionChangesetNext() are that +// ** +// ** * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// ** that modifies no columns), this function sets (*pbEmpty) to 1. +// ** +// ** * If the iterator is configured to skip no-op UPDATEs, +// ** sessionChangesetNext() does that. This function does not. +// */ +func _sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) (r int32) { + var abPK, apNew, apOld, v12, v13, v14, v3, v6, v9 uintptr + var i, nVal, v10, v16, v2, v4, v5, v7, v8 int32 + var op Tu8 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = abPK, apNew, apOld, i, nVal, op, v10, v12, v13, v14, v16, v2, v3, v4, v5, v6, v7, v8, v9 + /* If the iterator is in the error-state, return immediately. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + /* Free the current contents of p->apValue[], if any. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*int32(2)) { + break + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, uint64(8)*uint64((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*uint64(2)) + } + /* Make sure the buffer contains at least 10 bytes of input data, or all + ** remaining data if there are less than 10 bytes available. This is + ** sufficient either for the 'T' or 'P' byte and the varint that follows + ** it, or for the two single byte values otherwise. */ + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = _sessionInputBuffer(tls, p, int32(2)) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + /* If the iterator is already at the end of the changeset, return DONE. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return int32(SQLITE_DONE) + } + _sessionDiscardData(tls, p) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + v3 = p + 8 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + op = *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v2))) + for int32(op) == int32('T') || int32(op) == int32('P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = int32(1) + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = libc.BoolInt32(int32(op) == int32('P')) + if _sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + v4 = _sessionInputBuffer(tls, p, int32(2)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v4 + if v4 != 0 { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return int32(SQLITE_DONE) + } + v6 = p + 8 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + op = *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v5))) + } + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + /* The first record in the changeset is not a table header. Must be a + ** corrupt changeset. */ + v7 = _sqlite3CorruptError(tls, int32(226952)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v7 + return v7 + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + v9 = p + 8 + v8 = *(*int32)(unsafe.Pointer(v9)) + *(*int32)(unsafe.Pointer(v9))++ + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(v8)))) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) { + v10 = _sqlite3CorruptError(tls, int32(226958)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v10 + return v10 + } + if paRec != 0 { /* Number of values to buffer */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0 && int32(op) == int32(SQLITE_UPDATE) { + nVal = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * int32(2) + } else { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 && int32(op) == int32(SQLITE_DELETE) { + nVal = 0 + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + goto _11 + _11: + ; + i++ + } + } else { + nVal = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + } + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = _sessionChangesetBufferRecord(tls, p, nVal, pnRec) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext += *(*int32)(unsafe.Pointer(pnRec)) + } else { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + v12 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8 + } else { + v12 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + apOld = v12 + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + v13 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } else { + v13 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8 + } + apNew = v13 + /* If this is an UPDATE or DELETE, read the old.* record. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_INSERT) && ((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0 || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE)) { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + v14 = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + v14 = uintptr(0) + } + abPK = v14 + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = _sessionReadRecord(tls, p, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + /* If this is an INSERT or UPDATE, read the new.* record. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != int32(SQLITE_DELETE) { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = _sessionReadRecord(tls, p, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + if ((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 || (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == int32(SQLITE_UPDATE) { + /* If this is an UPDATE that is part of a patchset, then all PK and + ** modified fields are present in the new.* record. The old.* record + ** is currently completely empty. This block shifts the PK fields from + ** new.* to old.*, to accommodate the code that reads these arrays. */ + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) + if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + v16 = _sqlite3CorruptError(tls, int32(227002)) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = v16 + return v16 + } + *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) = uintptr(0) + } + goto _15 + _15: + ; + i++ + } + } else { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == int32(SQLITE_INSERT) { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(SQLITE_DELETE) + } else { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == int32(SQLITE_DELETE) { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(SQLITE_INSERT) + } + } + } + } + /* If this is an UPDATE that is part of a changeset, then check that + ** there are no fields in the old.* record that are not (a) PK fields, + ** or (b) also present in the new.* record. + ** + ** Such records are technically corrupt, but the rebaser was at one + ** point generating them. Under most circumstances this is benign, but + ** can cause spurious SQLITE_RANGE errors when applying the changeset. */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0 && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == int32(SQLITE_UPDATE) { + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) { + break + } + if int32(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i+(*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8)) == uintptr(0) { + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = uintptr(0) + } + goto _17 + _17: + ; + i++ + } + } + } + return int32(SQLITE_ROW) +} + +// C documentation +// +// /* +// ** Advance the changeset iterator to the next change. +// ** +// ** If both paRec and pnRec are NULL, then this function works like the public +// ** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// ** sqlite3changeset_new() and old() APIs may be used to query for values. +// ** +// ** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// ** record is written to *paRec before returning and the number of bytes in +// ** the record to *pnRec. +// ** +// ** Either way, this function returns SQLITE_ROW if the iterator is +// ** successfully advanced to the next change in the changeset, an SQLite +// ** error code if an error occurs, or SQLITE_DONE if there are no further +// ** changes in the changeset. +// */ +func _sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* bEmpty at bp+0 */ int32 + _ = rc + for cond := true; cond; cond = rc == int32(SQLITE_ROW) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0 && *(*int32)(unsafe.Pointer(bp)) != 0 { + *(*int32)(unsafe.Pointer(bp)) = 0 + rc = _sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp) + } + return rc +} + +// C documentation +// +// /* +// ** Advance an iterator created by sqlite3changeset_start() to the next +// ** change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// ** or SQLITE_CORRUPT. +// ** +// ** This function may not be called on iterators passed to a conflict handler +// ** callback by changeset_apply(). +// */ +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) (r int32) { + return _sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** The following function extracts information on the current change +// ** from a changeset iterator. It may only be called after changeset_next() +// ** has returned SQLITE_ROW. +// */ +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) (r int32) { + *(*int32)(unsafe.Pointer(pOp)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Return information regarding the PRIMARY KEY and number of columns in +// ** the database table affected by the change that pIter currently points +// ** to. This function may only be called after changeset_next() returns +// ** SQLITE_ROW. +// */ +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) (r int32) { + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function may only be called while the iterator is pointing to an +// ** SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// ** Otherwise, SQLITE_MISUSE is returned. +// ** +// ** It sets *ppValue to point to an sqlite3_value structure containing the +// ** iVal'th value in the old.* record. Or, if that particular value is not +// ** included in the record (because the change is an UPDATE and the field +// ** was not modified and is not a PK column), set *ppValue to NULL. +// ** +// ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// ** not modified. Otherwise, SQLITE_OK. +// */ +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) (r int32) { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != int32(SQLITE_DELETE) { + return int32(SQLITE_MISUSE) + } + if iVal < 0 || iVal >= (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol { + return int32(SQLITE_RANGE) + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function may only be called while the iterator is pointing to an +// ** SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// ** Otherwise, SQLITE_MISUSE is returned. +// ** +// ** It sets *ppValue to point to an sqlite3_value structure containing the +// ** iVal'th value in the new.* record. Or, if that particular value is not +// ** included in the record (because the change is an UPDATE and the field +// ** was not modified), set *ppValue to NULL. +// ** +// ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// ** not modified. Otherwise, SQLITE_OK. +// */ +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) (r int32) { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != int32(SQLITE_UPDATE) && (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != int32(SQLITE_INSERT) { + return int32(SQLITE_MISUSE) + } + if iVal < 0 || iVal >= (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol { + return int32(SQLITE_RANGE) + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal)*8)) + return SQLITE_OK +} + +/* +** The following two macros are used internally. They are similar to the +** sqlite3changeset_new() and sqlite3changeset_old() functions, except that +** they omit all error checking and return a pointer to the requested value. + */ + +// C documentation +// +// /* +// ** This function may only be called with a changeset iterator that has been +// ** passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// ** conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// ** +// ** If successful, *ppValue is set to point to an sqlite3_value structure +// ** containing the iVal'th value of the conflicting record. +// ** +// ** If value iVal is out-of-range or some other error occurs, an SQLite error +// ** code is returned. Otherwise, SQLITE_OK. +// */ +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) (r int32) { + if !((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) { + return int32(SQLITE_MISUSE) + } + if iVal < 0 || iVal >= (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol { + return int32(SQLITE_RANGE) + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function may only be called with an iterator passed to an +// ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// ** it sets the output variable to the total number of known foreign key +// ** violations in the destination database and returns SQLITE_OK. +// ** +// ** In all other cases this function returns SQLITE_MISUSE. +// */ +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) (r int32) { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0 || (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0 { + return int32(SQLITE_MISUSE) + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Finalize an iterator allocated with sqlite3changeset_start(). +// ** +// ** This function may not be called on iterators passed to a conflict handler +// ** callback by changeset_apply(). +// */ +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) (r int32) { + var i, rc int32 + _, _ = i, rc + rc = SQLITE_OK + if p != 0 { /* Used to iterate through p->apValue[] */ + rc = (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*int32(2)) { + break + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + } + Xsqlite3_free(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var abPK, apVal, pVal, pVal1, v7 uintptr + var bIndirect, eType2, iCol, nVar, v1, v2, v3, v5 int32 + var eType Tu8 + var _ /* nByte at bp+48 */ int32 + var _ /* nByte at bp+52 */ int32 + var _ /* nCol at bp+24 */ int32 + var _ /* rc at bp+0 */ int32 + var _ /* sOut at bp+8 */ TSessionBuffer + var _ /* sPK at bp+32 */ TSessionBuffer + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = abPK, apVal, bIndirect, eType, eType2, iCol, nVar, pVal, pVal1, v1, v2, v3, v5, v7 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* Output buffer */ + *(*int32)(unsafe.Pointer(bp + 24)) = 0 /* Number of cols in current table */ + abPK = uintptr(0) /* PK array for current table */ + apVal = uintptr(0) /* Space for values for UPDATE inversion */ + *(*TSessionBuffer)(unsafe.Pointer(bp + 32)) = TSessionBuffer{} /* PK array for current table */ + /* Initialize the output buffer */ + libc.Xmemset(tls, bp+8, 0, uint64(16)) + /* Zero the output variables in case an error occurs. */ + if ppInverted != 0 { + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 + } + for int32(1) != 0 { + /* Test for EOF. */ + v1 = _sessionInputBuffer(tls, pInput, int32(2)) + *(*int32)(unsafe.Pointer(bp)) = v1 + if v1 != 0 { + goto finished_invert + } + if (*TSessionInput)(unsafe.Pointer(pInput)).FiNext >= (*TSessionInput)(unsafe.Pointer(pInput)).FnData { + break + } + eType = *(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext))) + switch int32(eType) { + case int32('T'): + (*TSessionInput)(unsafe.Pointer(pInput)).FiNext++ + v2 = _sessionChangesetBufferTblhdr(tls, pInput, bp+48) + *(*int32)(unsafe.Pointer(bp)) = v2 + if v2 != 0 { + goto finished_invert + } + nVar = _sessionVarintGet(tls, (*TSessionInput)(unsafe.Pointer(pInput)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext), bp+24) + (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FnBuf = 0 + _sessionAppendBlob(tls, bp+32, (*TSessionInput)(unsafe.Pointer(pInput)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext+nVar), *(*int32)(unsafe.Pointer(bp + 24)), bp) + _sessionAppendByte(tls, bp+8, eType, bp) + _sessionAppendBlob(tls, bp+8, (*TSessionInput)(unsafe.Pointer(pInput)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext), *(*int32)(unsafe.Pointer(bp + 48)), bp) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto finished_invert + } + *(*int32)(unsafe.Pointer(pInput + 8)) += *(*int32)(unsafe.Pointer(bp + 48)) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf + case int32(SQLITE_INSERT): + fallthrough + case int32(SQLITE_DELETE): + bIndirect = int32(*(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext+int32(1))))) + if int32(eType) == int32(SQLITE_DELETE) { + v3 = int32(SQLITE_INSERT) + } else { + v3 = int32(SQLITE_DELETE) + } + eType2 = v3 + *(*int32)(unsafe.Pointer(pInput + 8)) += int32(2) + *(*int32)(unsafe.Pointer(bp)) = _sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 24)), bp+52) + _sessionAppendByte(tls, bp+8, uint8(eType2), bp) + _sessionAppendByte(tls, bp+8, uint8(bIndirect), bp) + _sessionAppendBlob(tls, bp+8, (*TSessionInput)(unsafe.Pointer(pInput)).FaData+uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext), *(*int32)(unsafe.Pointer(bp + 52)), bp) + *(*int32)(unsafe.Pointer(pInput + 8)) += *(*int32)(unsafe.Pointer(bp + 52)) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + goto finished_invert + } + case int32(SQLITE_UPDATE): + if uintptr(0) == apVal { + apVal = Xsqlite3_malloc64(tls, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) + if uintptr(0) == apVal { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + goto finished_invert + } + libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) + } + /* Write the header for the new UPDATE change. Same as the original. */ + _sessionAppendByte(tls, bp+8, eType, bp) + _sessionAppendByte(tls, bp+8, *(*Tu8)(unsafe.Pointer((*TSessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*TSessionInput)(unsafe.Pointer(pInput)).FiNext+int32(1)))), bp) + /* Read the old.* and new.* records for the update change. */ + *(*int32)(unsafe.Pointer(pInput + 8)) += int32(2) + *(*int32)(unsafe.Pointer(bp)) = _sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 24)), uintptr(0), apVal, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 24)), uintptr(0), apVal+uintptr(*(*int32)(unsafe.Pointer(bp + 24)))*8, uintptr(0)) + } + /* Write the new old.* record. Consists of the PK columns from the + ** original old.* record, and the other values from the original + ** new.* record. */ + iCol = 0 + for { + if !(iCol < *(*int32)(unsafe.Pointer(bp + 24))) { + break + } + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + v5 = 0 + } else { + v5 = *(*int32)(unsafe.Pointer(bp + 24)) + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol+v5)*8)) + _sessionAppendValue(tls, bp+8, pVal, bp) + goto _4 + _4: + ; + iCol++ + } + /* Write the new new.* record. Consists of a copy of all values + ** from the original old.* record, except for the PK columns, which + ** are set to "undefined". */ + iCol = 0 + for { + if !(iCol < *(*int32)(unsafe.Pointer(bp + 24))) { + break + } + if *(*Tu8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + v7 = uintptr(0) + } else { + v7 = *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + } + pVal1 = v7 + _sessionAppendValue(tls, bp+8, pVal1, bp) + goto _6 + _6: + ; + iCol++ + } + iCol = 0 + for { + if !(iCol < *(*int32)(unsafe.Pointer(bp + 24))*int32(2)) { + break + } + _sqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto _8 + _8: + ; + iCol++ + } + libc.Xmemset(tls, apVal, 0, uint64(8)*uint64(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + goto finished_invert + } + default: + *(*int32)(unsafe.Pointer(bp)) = _sqlite3CorruptError(tls, int32(227367)) + goto finished_invert + } + if xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf) + (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf = 0 + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + goto finished_invert + } + } + } + if pnInverted != 0 && ppInverted != 0 { + *(*int32)(unsafe.Pointer(pnInverted)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf + (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf = uintptr(0) + } else { + if (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf > 0 && xOutput != uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf) + } + } +finished_invert: + ; + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 32))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Invert a changeset object. +// */ +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var _ /* sInput at bp+0 */ TSessionInput + /* Set up the input stream */ + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TSessionInput)(unsafe.Pointer(bp))).FnData = nChangeset + (*(*TSessionInput)(unsafe.Pointer(bp))).FaData = pChangeset + return _sessionChangesetInvert(tls, bp, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// C documentation +// +// /* +// ** Streaming version of sqlite3changeset_invert(). +// */ +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var rc int32 + var _ /* sInput at bp+0 */ TSessionInput + _ = rc + /* Set up the input stream */ + libc.Xmemset(tls, bp, 0, uint64(72)) + (*(*TSessionInput)(unsafe.Pointer(bp))).FxInput = xInput + (*(*TSessionInput)(unsafe.Pointer(bp))).FpIn = pIn + rc = _sessionChangesetInvert(tls, bp, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*(*TSessionInput)(unsafe.Pointer(bp))).Fbuf.FaBuf) + return rc +} + +type TSessionUpdate = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} + +type SessionUpdate = TSessionUpdate + +type TSessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} + +type SessionUpdate1 = TSessionUpdate1 + +type TSessionApplyCtx = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + Fconstraints TSessionBuffer + Frebase TSessionBuffer + FbRebaseStarted Tu8 + FbRebase Tu8 + FbIgnoreNoop Tu8 + FbRowid int32 +} + +type SessionApplyCtx = TSessionApplyCtx + +type TSessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + Fconstraints TSessionBuffer + Frebase TSessionBuffer + FbRebaseStarted Tu8 + FbRebase Tu8 + FbIgnoreNoop Tu8 + FbRowid int32 +} + +type SessionApplyCtx1 = TSessionApplyCtx1 + +/* Number of prepared UPDATE statements to cache. */ + +// C documentation +// +// /* +// ** Find a prepared UPDATE statement suitable for the UPDATE step currently +// ** being visited by the iterator. The UPDATE is of the form: +// ** +// ** UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +// */ +func _sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bStat1, ii, nByte, nCol, nU32, nUp int32 + var pUp, pp, zSep, zSql uintptr + var _ /* buf at bp+8 */ TSessionBuffer + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = bStat1, ii, nByte, nCol, nU32, nUp, pUp, pp, zSep, zSql + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + pUp = uintptr(0) + nCol = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + nU32 = ((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + int32(33)) / int32(32) + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, int32(uint64(nU32)*uint64(4))) + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + libc.Xmemset(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, uint64(nU32)*uint64(4)) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_CORRUPT) + ii = 0 + for { + if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + break + } + if *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { + *(*Tu32)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr(ii/int32(32))*4)) |= uint32(libc.Int32FromInt32(1) << (ii % libc.Int32FromInt32(32))) + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + goto _1 + _1: + ; + ii++ + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if bPatchset != 0 { + *(*Tu32)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr(nCol/int32(32))*4)) |= uint32(libc.Int32FromInt32(1) << (nCol % libc.Int32FromInt32(32))) + } + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + nUp = 0 + pp = p + 64 + for int32(1) != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*TSessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, uint64(nU32)*uint64(4)) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*TSessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*TSessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + if (*TSessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = *(*uintptr)(unsafe.Pointer(pp)) + 16 + } else { + if nUp >= int32(SESSION_UPDATE_CACHE_SZ) { + Xsqlite3_finalize(tls, (*TSessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + if pUp == uintptr(0) { + nByte = int32(uint64(24) * uint64(nU32) * uint64(4)) + bStat1 = libc.BoolInt32(Xsqlite3_stricmp(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, __ccgo_ts+11614) == 0) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } else { + zSep = __ccgo_ts + 1680 + libc.Xmemset(tls, bp+8, 0, uint64(16)) + (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask = pUp + 1*24 + libc.Xmemcpy(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, uint64(nU32)*uint64(4)) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33967, bp) + _sessionAppendIdent(tls, bp+8, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33980, bp) + /* Create the assignments part of the UPDATE */ + ii = 0 + for { + if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + break + } + if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+ii)*8)) != 0 { + _sessionAppendStr(tls, bp+8, zSep, bp) + _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33986, bp) + _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(1), bp) + zSep = __ccgo_ts + 15022 + } + goto _2 + _2: + ; + ii++ + } + /* Create the WHERE clause part of the UPDATE */ + zSep = __ccgo_ts + 1680 + _sessionAppendStr(tls, bp+8, __ccgo_ts+33991, bp) + ii = 0 + for { + if !(ii < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0 || bPatchset == 0 && *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(ii)*8)) != 0 { + _sessionAppendStr(tls, bp+8, zSep, bp) + if bStat1 != 0 && ii == int32(1) { + _sessionAppendStr(tls, bp+8, __ccgo_ts+33999, bp) + } else { + _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34074, bp) + _sessionAppendInteger(tls, bp+8, ii*int32(2)+int32(2), bp) + } + zSep = __ccgo_ts + 22045 + } + goto _3 + _3: + ; + ii++ + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + zSql = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, pUp, uintptr(0)) + } + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*TSessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + } + } + } + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*TSessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Free all cached UPDATE statements. +// */ +func _sessionUpdateFree(tls *libc.TLS, p uintptr) { + var pNext, pUp uintptr + _, _ = pNext, pUp + pUp = (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp + for { + if !(pUp != 0) { + break + } + pNext = (*TSessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*TSessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + goto _1 + _1: + ; + pUp = pNext + } + (*TSessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*TSessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// C documentation +// +// /* +// ** Formulate a statement to DELETE a row from database db. Assuming a table +// ** structure like this: +// ** +// ** CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// ** +// ** The DELETE statement looks like this: +// ** +// ** DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// ** +// ** Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// ** matching b and d values, or 1 otherwise. The second case comes up if the +// ** conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// ** +// ** If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// ** pointing to the prepared version of the SQL statement. +// */ +func _sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, nPk int32 + var zSep uintptr + var _ /* buf at bp+8 */ TSessionBuffer + var _ /* rc at bp+0 */ int32 + _, _, _ = i, nPk, zSep + zSep = __ccgo_ts + 1680 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} + nPk = 0 + _sessionAppendStr(tls, bp+8, __ccgo_ts+34080, bp) + _sessionAppendIdent(tls, bp+8, zTab, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33991, bp) + i = 0 + for { + if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + _sessionAppendStr(tls, bp+8, zSep, bp) + _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33986, bp) + _sessionAppendInteger(tls, bp+8, i+int32(1), bp) + zSep = __ccgo_ts + 22045 + } + goto _1 + _1: + ; + i++ + } + if nPk < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol { + _sessionAppendStr(tls, bp+8, __ccgo_ts+34098, bp) + _sessionAppendInteger(tls, bp+8, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol+int32(1), bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+33562, bp) + zSep = __ccgo_ts + 1680 + i = 0 + for { + if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { + break + } + if !(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) { + _sessionAppendStr(tls, bp+8, zSep, bp) + _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+34074, bp) + _sessionAppendInteger(tls, bp+8, i+int32(1), bp) + zSep = __ccgo_ts + 34106 + } + goto _2 + _2: + ; + i++ + } + _sessionAppendStr(tls, bp+8, __ccgo_ts+5138, bp) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+8, uintptr(0)) + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Formulate and prepare an SQL statement to query table zTab by primary +// ** key. Assuming the following table structure: +// ** +// ** CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// ** +// ** The SELECT statement looks like this: +// ** +// ** SELECT * FROM x WHERE a = ?1 AND c = ?3 +// ** +// ** If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// ** pointing to the prepared version of the SQL statement. +// */ +func _sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { + /* TODO */ + return _sessionSelectStmt(tls, db, int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop), __ccgo_ts+6617, zTab, (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRowid, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, p+24) +} + +// C documentation +// +// /* +// ** Formulate and prepare an INSERT statement to add a record to table zTab. +// ** For example: +// ** +// ** INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// ** +// ** If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// ** pointing to the prepared version of the SQL statement. +// */ +func _sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var _ /* buf at bp+8 */ TSessionBuffer + var _ /* rc at bp+0 */ int32 + _ = i + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} + _sessionAppendStr(tls, bp+8, __ccgo_ts+34111, bp) + _sessionAppendIdent(tls, bp+8, zTab, bp) + _sessionAppendStr(tls, bp+8, __ccgo_ts+22051, bp) + i = 0 + for { + if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { + break + } + if i != 0 { + _sessionAppendStr(tls, bp+8, __ccgo_ts+15022, bp) + } + _sessionAppendIdent(tls, bp+8, *(*uintptr)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp) + goto _1 + _1: + ; + i++ + } + _sessionAppendStr(tls, bp+8, __ccgo_ts+34129, bp) + i = int32(1) + for { + if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { + break + } + _sessionAppendStr(tls, bp+8, __ccgo_ts+34140, bp) + goto _2 + _2: + ; + i++ + } + _sessionAppendStr(tls, bp+8, __ccgo_ts+5138, bp) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v2(tls, db, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf, p+16, uintptr(0)) + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) (r int32) { + return Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), pp, uintptr(0)) +} + +// C documentation +// +// /* +// ** Prepare statements for applying changes to the sqlite_stat1 table. +// ** These are similar to those created by sessionSelectRow(), +// ** sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// ** other tables. +// */ +func _sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = _sessionSelectRow(tls, db, __ccgo_ts+11614, p) + if rc == SQLITE_OK { + rc = _sessionPrepare(tls, db, p+16, __ccgo_ts+34144) + } + if rc == SQLITE_OK { + rc = _sessionPrepare(tls, db, p+8, __ccgo_ts+34257) + } + return rc +} + +// C documentation +// +// /* +// ** A wrapper around sqlite3_bind_value() that detects an extra problem. +// ** See comments in the body of this function for details. +// */ +func _sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) (r int32) { + var eType int32 + _ = eType + eType = Xsqlite3_value_type(tls, pVal) + /* COVERAGE: The (pVal->z==0) branch is never true using current versions + ** of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + ** the (pVal->z) variable remains as it was or the type of the value is + ** set to SQLITE_NULL. */ + if (eType == int32(SQLITE_TEXT) || eType == int32(SQLITE_BLOB)) && (*Tsqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0) { + /* This condition occurs when an earlier OOM in a call to + ** sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + ** a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. */ + return int32(SQLITE_NOMEM) + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// C documentation +// +// /* +// ** Iterator pIter must point to an SQLITE_INSERT entry. This function +// ** transfers new.* values from the current iterator entry to statement +// ** pStmt. The table being inserted into has nCol columns. +// ** +// ** New.* value $i from the iterator is bound to variable ($i+1) of +// ** statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// ** are transfered to the statement. Otherwise, if abPK is not NULL, it points +// ** to an array nCol elements in size. In this case only those values for +// ** which abPK[$i] is true are read from the iterator and bound to the +// ** statement. +// ** +// ** An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +// */ +func _sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, rc int32 + var _ /* pVal at bp+0 */ uintptr + _, _ = i, rc + rc = SQLITE_OK + /* Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + ** argument iterator points to a suitable entry. Make sure that xValue + ** is one of these to guarantee that it is safe to ignore the return + ** in the code below. */ + i = 0 + for { + if !(rc == SQLITE_OK && i < nCol) { + break + } + if !(abPK != 0) || *(*Tu8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xValue})))(tls, pIter, i, bp) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + /* The value in the changeset was "undefined". This indicates a + ** corrupt changeset blob. */ + rc = _sqlite3CorruptError(tls, int32(227849)) + } else { + rc = _sessionBindValue(tls, pStmt, i+int32(1), *(*uintptr)(unsafe.Pointer(bp))) + } + } + goto _1 + _1: + ; + i++ + } + return rc +} + +// C documentation +// +// /* +// ** SQL statement pSelect is as generated by the sessionSelectRow() function. +// ** This function binds the primary key values from the change that changeset +// ** iterator pIter points to to the SELECT and attempts to seek to the table +// ** entry. If a row is found, the SELECT statement left pointing at the row +// ** and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// ** has occured, the statement is reset and SQLITE_OK is returned. If an +// ** error occurs, the statement is reset and an SQLite error code is returned. +// ** +// ** If this function returns SQLITE_ROW, the caller must eventually reset() +// ** statement pSelect. If any other value is returned, the statement does +// ** not require a reset(). +// ** +// ** If the iterator currently points to an INSERT record, bind values from the +// ** new.* record to the SELECT statement. Or, if it points to a DELETE or +// ** UPDATE, bind values from the old.* record. +// */ +func _sessionSeekToRow(tls *libc.TLS, pIter uintptr, p uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ii, rc int32 + var pSelect, v1 uintptr + var _ /* nCol at bp+0 */ int32 + var _ /* op at bp+4 */ int32 + var _ /* pVal at bp+16 */ uintptr + var _ /* zDummy at bp+8 */ uintptr + _, _, _, _ = ii, pSelect, rc, v1 + pSelect = (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect /* Unused */ + Xsqlite3_clear_bindings(tls, pSelect) + Xsqlite3changeset_op(tls, pIter, bp+8, bp, bp+4, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 4)) == int32(SQLITE_INSERT) { + v1 = __ccgo_fp(Xsqlite3changeset_new) + } else { + v1 = __ccgo_fp(Xsqlite3changeset_old) + } + rc = _sessionBindRow(tls, pIter, v1, *(*int32)(unsafe.Pointer(bp)), (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, pSelect) + if *(*int32)(unsafe.Pointer(bp + 4)) != int32(SQLITE_DELETE) && (*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop != 0 { + ii = 0 + for { + if !(rc == SQLITE_OK && ii < *(*int32)(unsafe.Pointer(bp))) { + break + } + if int32(*(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + Xsqlite3changeset_new(tls, pIter, ii, bp+16) + Xsqlite3_bind_int(tls, pSelect, ii+int32(1)+*(*int32)(unsafe.Pointer(bp)), libc.BoolInt32(*(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0))) + if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { + rc = _sessionBindValue(tls, pSelect, ii+int32(1), *(*uintptr)(unsafe.Pointer(bp + 16))) + } + } + goto _2 + _2: + ; + ii++ + } + } + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != int32(SQLITE_ROW) { + rc = Xsqlite3_reset(tls, pSelect) + } + } + return rc +} + +// C documentation +// +// /* +// ** This function is called from within sqlite3changeset_apply_v2() when +// ** a conflict is encountered and resolved using conflict resolution +// ** mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// ** It adds a conflict resolution record to the buffer in +// ** SessionApplyCtx.rebase, which will eventually be returned to the caller +// ** of apply_v2() as the "rebase" buffer. +// ** +// ** Return SQLITE_OK if successful, or an SQLite error code otherwise. +// */ +func _sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eOp, i, v1 int32 + var zTab uintptr + var _ /* pVal at bp+8 */ uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _ = eOp, i, zTab, v1 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + eOp = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + /* Append a table-header to the rebase buffer */ + zTab = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + _sessionAppendByte(tls, p+104, uint8('T'), bp) + _sessionAppendVarint(tls, p+104, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp) + _sessionAppendBlob(tls, p+104, (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp) + _sessionAppendBlob(tls, p+104, zTab, int32(libc.Xstrlen(tls, zTab))+int32(1), bp) + (*TSessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = uint8(1) + } + if eOp == int32(SQLITE_DELETE) { + v1 = int32(SQLITE_DELETE) + } else { + v1 = int32(SQLITE_INSERT) + } + _sessionAppendByte(tls, p+104, uint8(v1), bp) + _sessionAppendByte(tls, p+104, libc.BoolUint8(eType == libc.Int32FromInt32(SQLITE_CHANGESET_REPLACE)), bp) + i = 0 + for { + if !(i < (*TSessionApplyCtx)(unsafe.Pointer(p)).FnCol) { + break + } + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + if eOp == int32(SQLITE_DELETE) || eOp == int32(SQLITE_UPDATE) && *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + Xsqlite3changeset_old(tls, pIter, i, bp+8) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8) + } + _sessionAppendValue(tls, p+104, *(*uintptr)(unsafe.Pointer(bp + 8)), bp) + goto _2 + _2: + ; + i++ + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Invoke the conflict handler for the change that the changeset iterator +// ** currently points to. +// ** +// ** Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// ** If argument pbReplace is NULL, then the type of conflict handler invoked +// ** depends solely on eType, as follows: +// ** +// ** eType value Value passed to xConflict +// ** ------------------------------------------------- +// ** CHANGESET_DATA CHANGESET_NOTFOUND +// ** CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// ** +// ** Or, if pbReplace is not NULL, then an attempt is made to find an existing +// ** record with the same primary key as the record about to be deleted, updated +// ** or inserted. If such a record can be found, it is available to the conflict +// ** handler as the "conflicting" record. In this case the type of conflict +// ** handler invoked is as follows: +// ** +// ** eType value PK Record found? Value passed to xConflict +// ** ---------------------------------------------------------------- +// ** CHANGESET_DATA Yes CHANGESET_DATA +// ** CHANGESET_DATA No CHANGESET_NOTFOUND +// ** CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// ** CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// ** +// ** If pbReplace is not NULL, and a record with a matching PK is found, and +// ** the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// ** is set to non-zero before returning SQLITE_OK. +// ** +// ** If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// ** returned. Or, if the conflict handler returns an invalid value, +// ** SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// ** this function returns SQLITE_OK. +// */ +func _sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aBlob uintptr + var nBlob, res int32 + var _ /* nCol at bp+4 */ int32 + var _ /* op at bp+8 */ int32 + var _ /* rc at bp+0 */ int32 + var _ /* zDummy at bp+16 */ uintptr + _, _, _ = aBlob, nBlob, res + res = 0 + Xsqlite3changeset_op(tls, pIter, bp+16, bp+4, bp+8, uintptr(0)) + /* Bind the new.* PRIMARY KEY values to the SELECT statement. */ + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp)) = _sessionSeekToRow(tls, pIter, p) + } else { + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + } + if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ROW) { + /* There exists another row with the new.* primary key. */ + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop != 0 && Xsqlite3_column_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect, Xsqlite3_column_count(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect)-int32(1)) != 0 { + res = SQLITE_CHANGESET_OMIT + } else { + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xConflict})))(tls, pCtx, eType, pIter) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + } + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0 && eType == int32(SQLITE_CHANGESET_CONFLICT) { + /* Instead of invoking the conflict handler, append the change blob + ** to the SessionApplyCtx.constraints buffer. */ + aBlob = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + nBlob = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent + _sessionAppendBlob(tls, p+88, aBlob, nBlob, bp) + return SQLITE_OK + } else { + /* No other row with the new.* primary key. */ + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xConflict})))(tls, pCtx, eType+int32(1), pIter) + if res == int32(SQLITE_CHANGESET_REPLACE) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_MISUSE) + } + } + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + switch res { + case int32(SQLITE_CHANGESET_REPLACE): + *(*int32)(unsafe.Pointer(pbReplace)) = int32(1) + case SQLITE_CHANGESET_OMIT: + case int32(SQLITE_CHANGESET_ABORT): + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ABORT) + default: + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_MISUSE) + break + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sessionRebaseAdd(tls, p, res, pIter) + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Attempt to apply the change that the iterator passed as the first argument +// ** currently points to to the database. If a conflict is encountered, invoke +// ** the conflict handler callback. +// ** +// ** If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// ** one is encountered, update or delete the row with the matching primary key +// ** instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// ** invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// ** to true before returning. In this case the caller will invoke this function +// ** again, this time with pbRetry set to NULL. +// ** +// ** If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// ** encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// ** Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// ** an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// ** before retrying. In this case the caller attempts to remove the conflicting +// ** row before invoking this function again, this time with pbReplace set +// ** to NULL. +// ** +// ** If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// ** returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// ** returned. +// */ +func _sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var abPK, pNew, pOld, v1 uintptr + var bPatchset, i, rc int32 + var _ /* nCol at bp+12 */ int32 + var _ /* op at bp+8 */ int32 + var _ /* pUp at bp+16 */ uintptr + var _ /* zDummy at bp+0 */ uintptr + _, _, _, _, _, _, _ = abPK, bPatchset, i, pNew, pOld, rc, v1 + rc = SQLITE_OK + Xsqlite3changeset_op(tls, pIter, bp, bp+12, bp+8, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 8)) == int32(SQLITE_DELETE) { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + v1 = (*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + } else { + v1 = uintptr(0) + } + /* Bind values to the DELETE statement. If conflict handling is required, + ** bind values for all columns and set bound variable (nCol+1) to true. + ** Or, if conflict handling is not required, bind just the PK column + ** values and, if it exists, set (nCol+1) to false. Conflict handling + ** is not required if: + ** + ** * this is a patchset, or + ** * (pbRetry==0), or + ** * all columns of the table are PK columns (in this case there is + ** no (nCol+1) variable to bind to). + */ + abPK = v1 + rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_old), *(*int32)(unsafe.Pointer(bp + 12)), abPK, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if rc == SQLITE_OK && Xsqlite3_bind_parameter_count(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 12)) { + rc = Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpDelete, *(*int32)(unsafe.Pointer(bp + 12))+int32(1), libc.BoolInt32(pbRetry == uintptr(0) || abPK != 0)) + } + if rc != SQLITE_OK { + return rc + } + Xsqlite3_step(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if rc == SQLITE_OK && Xsqlite3_changes(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0 && int32((*TSessionApplyCtx)(unsafe.Pointer(p)).FbIgnoreNoop) == 0 { + rc = _sessionConflictHandler(tls, int32(SQLITE_CHANGESET_DATA), p, pIter, xConflict, pCtx, pbRetry) + } else { + if rc&int32(0xff) == int32(SQLITE_CONSTRAINT) { + rc = _sessionConflictHandler(tls, int32(SQLITE_CHANGESET_CONFLICT), p, pIter, xConflict, pCtx, uintptr(0)) + } + } + } else { + if *(*int32)(unsafe.Pointer(bp + 8)) == int32(SQLITE_UPDATE) { + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + bPatchset = libc.BoolInt32(pbRetry == uintptr(0) || (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) + rc = _sessionUpdateFind(tls, pIter, p, bPatchset, bp+16) + /* Bind values to the UPDATE statement. */ + i = 0 + for { + if !(rc == SQLITE_OK && i < *(*int32)(unsafe.Pointer(bp + 12))) { + break + } + pOld = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(i)*8)) + pNew = *(*uintptr)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+i)*8)) + if *(*Tu8)(unsafe.Pointer((*TSessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 || bPatchset == 0 && pOld != 0 { + rc = _sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), i*int32(2)+int32(2), pOld) + } + if rc == SQLITE_OK && pNew != 0 { + rc = _sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), i*int32(2)+int32(1), pNew) + } + goto _2 + _2: + ; + i++ + } + if rc != SQLITE_OK { + return rc + } + /* Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + ** the result will be SQLITE_OK with 0 rows modified. */ + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + if rc == SQLITE_OK && Xsqlite3_changes(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0 { + /* A NOTFOUND or DATA error. Search the table to see if it contains + ** a row with a matching primary key. If so, this is a DATA conflict. + ** Otherwise, if there is no primary key match, it is a NOTFOUND. */ + rc = _sessionConflictHandler(tls, int32(SQLITE_CHANGESET_DATA), p, pIter, xConflict, pCtx, pbRetry) + } else { + if rc&int32(0xff) == int32(SQLITE_CONSTRAINT) { + /* This is always a CONSTRAINT conflict. */ + rc = _sessionConflictHandler(tls, int32(SQLITE_CHANGESET_CONFLICT), p, pIter, xConflict, pCtx, uintptr(0)) + } + } + } else { + if (*TSessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + /* Check if there is a conflicting row. For sqlite_stat1, this needs + ** to be done using a SELECT, as there is no PRIMARY KEY in the + ** database schema to throw an exception if a duplicate is inserted. */ + rc = _sessionSeekToRow(tls, pIter, p) + if rc == int32(SQLITE_ROW) { + rc = int32(SQLITE_CONSTRAINT) + Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + if rc == SQLITE_OK { + rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), *(*int32)(unsafe.Pointer(bp + 12)), uintptr(0), (*TSessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + Xsqlite3_step(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + if rc&int32(0xff) == int32(SQLITE_CONSTRAINT) { + rc = _sessionConflictHandler(tls, int32(SQLITE_CHANGESET_CONFLICT), p, pIter, xConflict, pCtx, pbReplace) + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Attempt to apply the change that the iterator passed as the first argument +// ** currently points to to the database. If a conflict is encountered, invoke +// ** the conflict handler callback. +// ** +// ** The difference between this function and sessionApplyOne() is that this +// ** function handles the case where the conflict-handler is invoked and +// ** returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// ** retried in some manner. +// */ +func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* bReplace at bp+0 */ int32 + var _ /* bRetry at bp+4 */ int32 + _ = rc + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp, bp+4) + if rc == SQLITE_OK { + /* If the bRetry flag is set, the change has not been applied due to an + ** SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + ** a row with the correct PK is present in the db, but one or more other + ** fields do not contain the expected values) and the conflict handler + ** returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + ** but pass NULL as the final argument so that sessionApplyOneOp() ignores + ** the SQLITE_CHANGESET_DATA problem. */ + if *(*int32)(unsafe.Pointer(bp + 4)) != 0 { + rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else { + if *(*int32)(unsafe.Pointer(bp)) != 0 { + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34401, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = _sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34422, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Retry the changes accumulated in the pApply->constraints buffer. +// */ +func _sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var cons TSessionBuffer + var nByte Tsize_t + var rc2 int32 + var _ /* pIter2 at bp+8 */ uintptr + var _ /* rc at bp+0 */ int32 + _, _, _ = cons, nByte, rc2 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + for (*TSessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + cons = (*TSessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, pApply+88, 0, uint64(16)) + *(*int32)(unsafe.Pointer(bp)) = _sessionChangesetStart(tls, bp+8, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, int32(1)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + nByte = uint64(int32(2)*(*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol) * uint64(8) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FbPatchset = bPatchset + (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FzTab = zTab + (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FnCol = (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FabPK = (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + _sessionBufferGrow(tls, *(*uintptr)(unsafe.Pointer(bp + 8))+72, int64(nByte), bp) + (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FapValue = (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + libc.Xmemset(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FapValue, 0, nByte) + } + for *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + *(*int32)(unsafe.Pointer(bp)) = _sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8)), pApply, xConflict, pCtx) + } + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = rc2 + } + } + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + break + } + if (*TSessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + /* No progress was made on the last round. */ + (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Argument pIter is a changeset iterator that has been initialized, but +// ** not yet passed to sqlite3changeset_next(). This function applies the +// ** changeset to the main database attached to handle "db". The supplied +// ** conflict handler callback is invoked to resolve any conflicts encountered +// ** while applying the change. +// */ +func _sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) (r int32) { + bp := tls.Alloc(352) + defer tls.Free(352) + var bPatchset, i, nMinCol, nTab, rc, res, schemaMismatch, v2, v3, v4, v6 int32 + var v5, v7 bool + var _ /* abPK at bp+152 */ uintptr + var _ /* nCol at bp+136 */ int32 + var _ /* nFk at bp+160 */ int32 + var _ /* notUsed at bp+164 */ int32 + var _ /* op at bp+140 */ int32 + var _ /* sApply at bp+8 */ TSessionApplyCtx + var _ /* sIter at bp+168 */ Tsqlite3_changeset_iter + var _ /* zNew at bp+144 */ uintptr + var _ /* zTab at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _ = bPatchset, i, nMinCol, nTab, rc, res, schemaMismatch, v2, v3, v4, v5, v6, v7 + schemaMismatch = 0 + rc = SQLITE_OK /* Return code */ + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Name of current table */ + nTab = 0 + (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = int32(1) + libc.Xmemset(tls, bp+8, 0, uint64(128)) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase = libc.BoolUint8(ppRebase != 0 && pnRebase != 0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbInvertConstraints = libc.BoolInt32(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_INVERT) != 0)) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbIgnoreNoop = libc.BoolUint8(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_IGNORENOOP) != 0)) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34441, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34467, uintptr(0), uintptr(0), uintptr(0)) + } + for rc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3changeset_next(tls, pIter) { + Xsqlite3changeset_op(tls, pIter, bp+144, bp+136, bp+140, uintptr(0)) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) || Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 144)), *(*uintptr)(unsafe.Pointer(bp)), nTab+int32(1)) != 0 { + rc = _sessionRetryConstraints(tls, db, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp)), bp+8, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + _sessionUpdateFree(tls, bp+8) + Xsqlite3_free(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FazCol) /* cast works around VC++ bug */ + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpDelete) + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpInsert) + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpSelect) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Fdb = db + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpDelete = uintptr(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpInsert = uintptr(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpSelect = uintptr(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = 0 + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FazCol = uintptr(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK = uintptr(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbStat1 = 0 + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbDeferConstraints = int32(1) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebaseStarted = uint8(0) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRowid = 0 + libc.Xmemset(tls, bp+8+88, 0, uint64(16)) + /* If an xFilter() callback was specified, invoke it now. If the + ** xFilter callback returns zero, skip this table. If it returns + ** non-zero, proceed. */ + schemaMismatch = libc.BoolInt32(xFilter != 0 && 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xFilter})))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 144)))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp + 144)))) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + rc = int32(SQLITE_NOMEM) + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp)))) + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FazCol = *(*uintptr)(unsafe.Pointer(bp)) + } else { + nMinCol = 0 + Xsqlite3changeset_pk(tls, pIter, bp+152, uintptr(0)) + rc = _sessionTableInfo(tls, uintptr(0), db, __ccgo_ts+6617, *(*uintptr)(unsafe.Pointer(bp + 144)), bp+8+32, bp, bp+8+40, uintptr(0), bp+8+48, bp+8+124) + if rc != SQLITE_OK { + break + } + i = 0 + for { + if !(i < (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol) { + break + } + if *(*Tu8)(unsafe.Pointer((*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK + uintptr(i))) != 0 { + nMinCol = i + int32(1) + } + goto _1 + _1: + ; + i++ + } + if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol == 0 { + schemaMismatch = int32(1) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34497, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + } else { + if (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol < *(*int32)(unsafe.Pointer(bp + 136)) { + schemaMismatch = int32(1) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34541, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)), (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol, *(*int32)(unsafe.Pointer(bp + 136)))) + } else { + if *(*int32)(unsafe.Pointer(bp + 136)) < nMinCol || libc.Xmemcmp(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FabPK, *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 136)))) != 0 { + schemaMismatch = int32(1) + Xsqlite3_log(tls, int32(SQLITE_SCHEMA), __ccgo_ts+34612, libc.VaList(bp+328, *(*uintptr)(unsafe.Pointer(bp)))) + } else { + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FnCol = *(*int32)(unsafe.Pointer(bp + 136)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp)), __ccgo_ts+11614) { + v2 = _sessionStat1Sql(tls, db, bp+8) + rc = v2 + if v2 != 0 { + break + } + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbStat1 = int32(1) + } else { + v3 = _sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + rc = v3 + if v5 = v3 != 0; !v5 { + v4 = _sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + rc = v4 + } + if v7 = v5 || v4 != 0; !v7 { + v6 = _sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp)), bp+8) + rc = v6 + } + if v7 || v6 != 0 { + break + } + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbStat1 = 0 + } + } + } + } + nTab = _sqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + } + /* If there is a schema mismatch on the current table, proceed to the + ** next change. A log message has already been issued. */ + if schemaMismatch != 0 { + continue + } + rc = _sessionApplyOneWithRetry(tls, db, pIter, bp+8, xConflict, pCtx) + } + bPatchset = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + if rc == SQLITE_OK { + rc = _sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp)), bp+8, xConflict, pCtx) + } + if rc == SQLITE_OK { + Xsqlite3_db_status(tls, db, int32(SQLITE_DBSTATUS_DEFERRED_FKS), bp+160, bp+164, 0) + if *(*int32)(unsafe.Pointer(bp + 160)) != 0 { + res = int32(SQLITE_CHANGESET_ABORT) + libc.Xmemset(tls, bp+168, 0, uint64(152)) + (*(*Tsqlite3_changeset_iter)(unsafe.Pointer(bp + 168))).FnCol = *(*int32)(unsafe.Pointer(bp + 160)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xConflict})))(tls, pCtx, int32(SQLITE_CHANGESET_FOREIGN_KEY), bp+168) + if res != SQLITE_CHANGESET_OMIT { + rc = int32(SQLITE_CONSTRAINT) + } + } + } + Xsqlite3_exec(tls, db, __ccgo_ts+34672, uintptr(0), uintptr(0), uintptr(0)) + if flags&int32(SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, __ccgo_ts+34702, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, __ccgo_ts+34726, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, __ccgo_ts+34702, uintptr(0), uintptr(0), uintptr(0)) + } + } + if rc == SQLITE_OK && bPatchset == 0 && (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FbRebase != 0 { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FnBuf + (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FaBuf = uintptr(0) + } + _sessionUpdateFree(tls, bp+8) + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpInsert) + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpDelete) + Xsqlite3_finalize(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FpSelect) + Xsqlite3_free(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).FazCol) /* cast works around VC++ bug */ + Xsqlite3_free(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*(*TSessionApplyCtx)(unsafe.Pointer(bp + 8))).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// C documentation +// +// /* +// ** Apply the changeset passed via pChangeset/nChangeset to the main +// ** database attached to handle "db". +// */ +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bInv, rc int32 + var savedFlag Tu64 + var _ /* pIter at bp+0 */ uintptr + _, _, _ = bInv, rc, savedFlag /* Iterator to skip through changeset */ + bInv = libc.BoolInt32(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_INVERT) != 0)) + rc = _sessionChangesetStart(tls, bp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, int32(1)) + savedFlag = (*Tsqlite3)(unsafe.Pointer(db)).Fflags & (uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32)) + if flags&int32(SQLITE_CHANGESETAPPLY_FKNOACTION) != 0 { + *(*Tu64)(unsafe.Pointer(db + 48)) |= uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32) + *(*int32)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)) -= int32(32) + } + if rc == SQLITE_OK { + rc = _sessionChangesetApply(tls, db, *(*uintptr)(unsafe.Pointer(bp)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + if flags&int32(SQLITE_CHANGESETAPPLY_FKNOACTION) != 0 && savedFlag == uint64(0) { + *(*Tu64)(unsafe.Pointer(db + 48)) &= ^(uint64(libc.Int32FromInt32(0x00008)) << libc.Int32FromInt32(32)) + *(*int32)(unsafe.Pointer((*(*TDb)(unsafe.Pointer((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FpSchema)) -= int32(32) + } + return rc +} + +// C documentation +// +// /* +// ** Apply the changeset passed via pChangeset/nChangeset to the main database +// ** attached to handle "db". Invoke the supplied conflict handler callback +// ** to resolve any conflicts encountered while applying the change. +// */ +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) (r int32) { + return Xsqlite3changeset_apply_v2(tls, db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// C documentation +// +// /* +// ** Apply the changeset passed via xInput/pIn to the main database +// ** attached to handle "db". Invoke the supplied conflict handler callback +// ** to resolve any conflicts encountered while applying the change. +// */ +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bInverse, rc int32 + var _ /* pIter at bp+0 */ uintptr + _, _ = bInverse, rc /* Iterator to skip through changeset */ + bInverse = libc.BoolInt32(!!(flags&libc.Int32FromInt32(SQLITE_CHANGESETAPPLY_INVERT) != 0)) + rc = _sessionChangesetStart(tls, bp, xInput, pIn, 0, uintptr(0), bInverse, int32(1)) + if rc == SQLITE_OK { + rc = _sessionChangesetApply(tls, db, *(*uintptr)(unsafe.Pointer(bp)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) (r int32) { + return Xsqlite3changeset_apply_v2_strm(tls, db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +/* +** sqlite3_changegroup handle. + */ +type Tsqlite3_changegroup1 = struct { + Frc int32 + FbPatch int32 + FpList uintptr + Fdb uintptr + FzDb uintptr +} + +type sqlite3_changegroup1 = Tsqlite3_changegroup1 + +// C documentation +// +// /* +// ** This function is called to merge two changes to the same row together as +// ** part of an sqlite3changeset_concat() operation. A new change object is +// ** allocated and a pointer to it stored in *ppNew. +// */ +func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var a1, a2, aExist, pIn, pNew, pOut, pOut1, v2, v3, v4, v6, v7 uintptr + var i, i1, n1, n2, nIn, op1, rc int32 + var nByte, nByte1 Tsqlite3_int64 + var _ /* a1 at bp+16 */ uintptr + var _ /* a1 at bp+8 */ uintptr + var _ /* a2 at bp+24 */ uintptr + var _ /* aCsr at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, aExist, i, i1, n1, n2, nByte, nByte1, nIn, op1, pIn, pNew, pOut, pOut1, rc, v2, v3, v4, v6, v7 + pNew = uintptr(0) + rc = SQLITE_OK + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, uint64(32)+uint64(nRec)) + if !(pNew != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pNew, 0, uint64(32)) + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(op2) + (*TSessionChange)(unsafe.Pointer(pNew)).FbIndirect = uint8(bIndirect) + (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord = pNew + 1*32 + if bIndirect == 0 || bRebase == 0 { + (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec)) + } else { + pIn = aRec + pOut = (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + nIn = _sessionSerialLen(tls, pIn) + if int32(*(*Tu8)(unsafe.Pointer(pIn))) == 0 { + v2 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v2)) = uint8(0) + } else { + if int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + v3 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v3)) = uint8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint64(nIn)) + pOut += uintptr(nIn) + } + } + pIn += uintptr(nIn) + goto _1 + _1: + ; + i++ + } + (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) + } + } else { + if bRebase != 0 { + if int32((*TSessionChange)(unsafe.Pointer(pExist)).Fop) == int32(SQLITE_DELETE) && (*TSessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0 { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + nByte = int64(uint64(nRec+(*TSessionChange)(unsafe.Pointer(pExist)).FnRecord) + uint64(32)) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + a1 = (*TSessionChange)(unsafe.Pointer(pExist)).FaRecord + a2 = aRec + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + (*TSessionChange)(unsafe.Pointer(pNew)).FbIndirect = libc.BoolUint8(bIndirect != 0 || (*TSessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(op2) + v4 = pNew + 1*32 + (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord = v4 + pOut1 = v4 + i1 = 0 + for { + if !(i1 < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + n1 = _sessionSerialLen(tls, a1) + n2 = _sessionSerialLen(tls, a2) + if int32(*(*Tu8)(unsafe.Pointer(a1))) == int32(0xFF) || int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i1)))) == 0 && bIndirect != 0 { + v6 = pOut1 + pOut1++ + *(*Tu8)(unsafe.Pointer(v6)) = uint8(0xFF) + } else { + if int32(*(*Tu8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut1, a1, uint64(n1)) + pOut1 += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut1, a2, uint64(n2)) + pOut1 += uintptr(n2) + } + } + a1 += uintptr(n1) + a2 += uintptr(n2) + goto _5 + _5: + ; + i1++ + } + (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(pOut1) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) + } + Xsqlite3_free(tls, pExist) + } + } else { + op1 = int32((*TSessionChange)(unsafe.Pointer(pExist)).Fop) + /* + ** op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + ** op1=INSERT, op2=UPDATE -> INSERT. + ** op1=INSERT, op2=DELETE -> (none) + ** + ** op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + ** op1=UPDATE, op2=UPDATE -> UPDATE. + ** op1=UPDATE, op2=DELETE -> DELETE. + ** + ** op1=DELETE, op2=INSERT -> UPDATE. + ** op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + ** op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + */ + if op1 == int32(SQLITE_INSERT) && op2 == int32(SQLITE_INSERT) || op1 == int32(SQLITE_UPDATE) && op2 == int32(SQLITE_INSERT) || op1 == int32(SQLITE_DELETE) && op2 == int32(SQLITE_UPDATE) || op1 == int32(SQLITE_DELETE) && op2 == int32(SQLITE_DELETE) { + pNew = pExist + } else { + if op1 == int32(SQLITE_INSERT) && op2 == int32(SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + } else { + aExist = (*TSessionChange)(unsafe.Pointer(pExist)).FaRecord + /* Allocate a new SessionChange object. Ensure that the aRecord[] + ** buffer of the new object is large enough to hold any record that + ** may be generated by combining the input records. */ + nByte1 = int64(uint64(32) + uint64((*TSessionChange)(unsafe.Pointer(pExist)).FnRecord) + uint64(nRec)) + pNew = Xsqlite3_malloc64(tls, uint64(nByte1)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pNew, 0, uint64(32)) + (*TSessionChange)(unsafe.Pointer(pNew)).FbIndirect = libc.BoolUint8(bIndirect != 0 && (*TSessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) + v7 = pNew + 1*32 + (*TSessionChange)(unsafe.Pointer(pNew)).FaRecord = v7 + *(*uintptr)(unsafe.Pointer(bp)) = v7 + if op1 == int32(SQLITE_INSERT) { /* INSERT + UPDATE */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = aRec + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_INSERT) + if bPatchset == 0 { + _sessionSkipRecord(tls, bp+8, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + } + _sessionMergeRecord(tls, bp, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp + 8))) + } else { + if op1 == int32(SQLITE_DELETE) { /* DELETE + INSERT */ + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp)) += uintptr(nRec) + } else { + if 0 == _sessionMergeUpdate(tls, bp, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else { + if op2 == int32(SQLITE_UPDATE) { /* UPDATE + UPDATE */ + *(*uintptr)(unsafe.Pointer(bp + 16)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24)) = aRec + if bPatchset == 0 { + _sessionSkipRecord(tls, bp+16, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + _sessionSkipRecord(tls, bp+24, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_UPDATE) + if 0 == _sessionMergeUpdate(tls, bp, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { /* UPDATE + DELETE */ + (*TSessionChange)(unsafe.Pointer(pNew)).Fop = uint8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp)) += uintptr(nRec) + } else { + _sessionMergeRecord(tls, bp, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + } + } + if pNew != 0 { + (*TSessionChange)(unsafe.Pointer(pNew)).FnRecord = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TSessionChange)(unsafe.Pointer(pNew)).FaRecord)) + } + Xsqlite3_free(tls, pExist) + } + } + } + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// C documentation +// +// /* +// ** Check if a changeset entry with nCol columns and the PK array passed +// ** as the final argument to this function is compatible with SessionTable +// ** pTab. If so, return 1. Otherwise, if they are incompatible in some way, +// ** return 0. +// */ +func _sessionChangesetCheckCompat(tls *libc.TLS, pTab uintptr, nCol int32, abPK uintptr) (r int32) { + var bPK Tu8 + var ii, v2 int32 + _, _, _ = bPK, ii, v2 + if (*TSessionTable)(unsafe.Pointer(pTab)).FazCol != 0 && nCol < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol { + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + if ii < nCol { + v2 = int32(*(*Tu8)(unsafe.Pointer(abPK + uintptr(ii)))) + } else { + v2 = 0 + } + bPK = uint8(v2) + if int32(*(*Tu8)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii)))) != int32(bPK) { + return 0 + } + goto _1 + _1: + ; + ii++ + } + return int32(1) + } + return libc.BoolInt32((*TSessionTable)(unsafe.Pointer(pTab)).FnCol == nCol && 0 == libc.Xmemcmp(tls, abPK, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(nCol))) +} + +func _sessionChangesetExtendRecord(tls *libc.TLS, pGrp uintptr, pTab uintptr, nCol int32, op int32, aRec uintptr, nRec int32, pOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var eType, iOff, ii, n int32 + var z, z1 uintptr + var _ /* iVal at bp+8 */ Ti64 + var _ /* rVal at bp+16 */ float64 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _ = eType, iOff, ii, n, z, z1 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + ii = 0 + (*TSessionBuffer)(unsafe.Pointer(pOut)).FnBuf = 0 + if op == int32(SQLITE_INSERT) || op == int32(SQLITE_DELETE) && (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 { + /* Append the missing default column values to the record. */ + _sessionAppendBlob(tls, pOut, aRec, nRec, bp) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = _sessionPrepareDfltStmt(tls, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb, pTab, pTab+72) + } + ii = nCol + for { + if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol) { + break + } + eType = Xsqlite3_column_type(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii) + _sessionAppendByte(tls, pOut, uint8(eType), bp) + switch eType { + case int32(SQLITE_FLOAT): + fallthrough + case int32(SQLITE_INTEGER): + if eType == int32(SQLITE_INTEGER) { + *(*Ti64)(unsafe.Pointer(bp + 8)) = Xsqlite3_column_int64(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii) + } else { + *(*float64)(unsafe.Pointer(bp + 16)) = float64(Xsqlite3_column_int64(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii)) + libc.Xmemcpy(tls, bp+8, bp+16, uint64(8)) + } + if SQLITE_OK == _sessionBufferGrow(tls, pOut, int64(8), bp) { + _sessionPutI64(tls, (*TSessionBuffer)(unsafe.Pointer(pOut)).FaBuf+uintptr((*TSessionBuffer)(unsafe.Pointer(pOut)).FnBuf), *(*Ti64)(unsafe.Pointer(bp + 8))) + } + case int32(SQLITE_BLOB): + fallthrough + case int32(SQLITE_TEXT): + n = Xsqlite3_column_bytes(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii) + _sessionAppendVarint(tls, pOut, n, bp) + if eType == int32(SQLITE_TEXT) { + z = Xsqlite3_column_text(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii) + _sessionAppendBlob(tls, pOut, z, n, bp) + } else { + z1 = Xsqlite3_column_blob(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FpDfltStmt, ii) + _sessionAppendBlob(tls, pOut, z1, n, bp) + } + default: + break + } + goto _1 + _1: + ; + ii++ + } + } else { + if op == int32(SQLITE_UPDATE) { + /* Append missing "undefined" entries to the old.* record. And, if this + ** is an UPDATE, to the new.* record as well. */ + iOff = 0 + if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 { + ii = 0 + for { + if !(ii < nCol) { + break + } + iOff += _sessionSerialLen(tls, aRec+uintptr(iOff)) + goto _2 + _2: + ; + ii++ + } + _sessionAppendBlob(tls, pOut, aRec, iOff, bp) + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-nCol) { + break + } + _sessionAppendByte(tls, pOut, uint8(0x00), bp) + goto _3 + _3: + ; + ii++ + } + } + _sessionAppendBlob(tls, pOut, aRec+uintptr(iOff), nRec-iOff, bp) + ii = 0 + for { + if !(ii < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol-nCol) { + break + } + _sessionAppendByte(tls, pOut, uint8(0x00), bp) + goto _4 + _4: + ; + ii++ + } + } else { + _sessionAppendBlob(tls, pOut, aRec, nRec, bp) + } + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Add all changes in the changeset traversed by the iterator passed as +// ** the first argument to the changegroup hash tables. +// */ +func _sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var bPkOnly1, bPkOnly2, iHash, nNew, rc int32 + var pExist, pTab, pp, ppTab uintptr + var _ /* aRec at bp+0 */ uintptr + var _ /* abPK at bp+64 */ uintptr + var _ /* bIndirect at bp+48 */ int32 + var _ /* nCol at bp+40 */ int32 + var _ /* nRec at bp+8 */ int32 + var _ /* op at bp+44 */ int32 + var _ /* pChange at bp+56 */ uintptr + var _ /* rec at bp+16 */ TSessionBuffer + var _ /* zNew at bp+32 */ uintptr + _, _, _, _, _, _, _, _, _ = bPkOnly1, bPkOnly2, iHash, nNew, pExist, pTab, pp, ppTab, rc + rc = SQLITE_OK + pTab = uintptr(0) + *(*TSessionBuffer)(unsafe.Pointer(bp + 16)) = TSessionBuffer{} + for int32(SQLITE_ROW) == _sessionChangesetNext(tls, pIter, bp, bp+8, uintptr(0)) { + pExist = uintptr(0) + /* Ensure that only changesets, or only patchsets, but not a mixture + ** of both, are being combined. It is an error to try to combine a + ** changeset and a patchset. */ + if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else { + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = int32(SQLITE_ERROR) + break + } + } + Xsqlite3changeset_op(tls, pIter, bp+32, bp+40, bp+44, bp+48) + if !(pTab != 0) || Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 32)), (*TSessionTable)(unsafe.Pointer(pTab)).FzName) != 0 { + /* Search the list for a matching table */ + nNew = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 32)))) + Xsqlite3changeset_pk(tls, pIter, bp+64, uintptr(0)) + pTab = (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList + for { + if !(pTab != 0) { + break + } + if 0 == Xsqlite3_strnicmp(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 32)), nNew+int32(1)) { + break + } + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + if !(pTab != 0) { + pTab = Xsqlite3_malloc64(tls, uint64(80)+uint64(*(*int32)(unsafe.Pointer(bp + 40)))+uint64(nNew)+uint64(1)) + if !(pTab != 0) { + rc = int32(SQLITE_NOMEM) + break + } + libc.Xmemset(tls, pTab, 0, uint64(80)) + (*TSessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 40)) + (*TSessionTable)(unsafe.Pointer(pTab)).FabPK = pTab + 1*80 + libc.Xmemcpy(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 64)), uint64(*(*int32)(unsafe.Pointer(bp + 40)))) + (*TSessionTable)(unsafe.Pointer(pTab)).FzName = (*TSessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 40))) + libc.Xmemcpy(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 32)), uint64(nNew+int32(1))) + if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb != 0 { + (*TSessionTable)(unsafe.Pointer(pTab)).FnCol = 0 + rc = _sessionInitTable(tls, uintptr(0), pTab, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb) + if rc != 0 { + Xsqlite3_free(tls, pTab) + break + } + } + /* The new object must be linked on to the end of the list, not + ** simply added to the start of it. This is to ensure that the + ** tables within the output of sqlite3changegroup_output() are in + ** the right order. */ + ppTab = pGrp + 8 + for { + if !(*(*uintptr)(unsafe.Pointer(ppTab)) != 0) { + break + } + goto _2 + _2: + ; + ppTab = *(*uintptr)(unsafe.Pointer(ppTab)) + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + if !(_sessionChangesetCheckCompat(tls, pTab, *(*int32)(unsafe.Pointer(bp + 40)), *(*uintptr)(unsafe.Pointer(bp + 64))) != 0) { + rc = int32(SQLITE_SCHEMA) + break + } + } + if *(*int32)(unsafe.Pointer(bp + 40)) < (*TSessionTable)(unsafe.Pointer(pTab)).FnCol { + rc = _sessionChangesetExtendRecord(tls, pGrp, pTab, *(*int32)(unsafe.Pointer(bp + 40)), *(*int32)(unsafe.Pointer(bp + 44)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+16) + if rc != 0 { + break + } + *(*uintptr)(unsafe.Pointer(bp)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 16))).FaBuf + *(*int32)(unsafe.Pointer(bp + 8)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 16))).FnBuf + } + if _sessionGrowHash(tls, uintptr(0), (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = int32(SQLITE_NOMEM) + break + } + iHash = int32(_sessionChangeHash(tls, pTab, libc.BoolInt32((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 && *(*int32)(unsafe.Pointer(bp + 44)) == int32(SQLITE_DELETE)), *(*uintptr)(unsafe.Pointer(bp)), (*TSessionTable)(unsafe.Pointer(pTab)).FnChange)) + /* Search for existing entry. If found, remove it from the hash table. + ** Code below may link it back in. + */ + pp = (*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != 0) { + break + } + bPkOnly1 = 0 + bPkOnly2 = 0 + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = libc.BoolInt32(int32((*TSessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).Fop) == int32(SQLITE_DELETE)) + bPkOnly2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 44)) == int32(SQLITE_DELETE)) + } + if _sessionChangeEqual(tls, pTab, bPkOnly1, (*TSessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*TSessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + goto _3 + _3: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 24 + } + rc = _sessionChangeMerge(tls, pTab, bRebase, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 44)), *(*int32)(unsafe.Pointer(bp + 48)), *(*uintptr)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 8)), bp+56) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 56)) != 0 { + (*TSessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 56)))).FpNext = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 56)) + (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 16))).FaBuf) + if rc == SQLITE_OK { + rc = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// C documentation +// +// /* +// ** Serialize a changeset (or patchset) based on all changesets (or patchsets) +// ** added to the changegroup object passed as the first argument. +// ** +// ** If xOutput is not NULL, then the changeset/patchset is returned to the +// ** user via one or more calls to xOutput, as with the other streaming +// ** interfaces. +// ** +// ** Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// ** buffer containing the output changeset before this function returns. In +// ** this case (*pnOut) is set to the size of the output buffer in bytes. It +// ** is the responsibility of the caller to free the output buffer using +// ** sqlite3_free() when it is no longer required. +// ** +// ** If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// ** error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// ** are both set to 0 before returning. +// */ +func _sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var p, pTab uintptr + var _ /* buf at bp+8 */ TSessionBuffer + var _ /* rc at bp+0 */ int32 + _, _, _ = i, p, pTab + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*TSessionBuffer)(unsafe.Pointer(bp + 8)) = TSessionBuffer{} + /* Create the serialized output changeset based on the contents of the + ** hash tables attached to the SessionTable objects in list p->pList. + */ + pTab = (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList + for { + if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && pTab != 0) { + break + } + if (*TSessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + goto _1 + } + _sessionAppendTableHdr(tls, bp+8, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp) + i = 0 + for { + if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange) { + break + } + p = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)) + for { + if !(p != 0) { + break + } + _sessionAppendByte(tls, bp+8, (*TSessionChange)(unsafe.Pointer(p)).Fop, bp) + _sessionAppendByte(tls, bp+8, (*TSessionChange)(unsafe.Pointer(p)).FbIndirect, bp) + _sessionAppendBlob(tls, bp+8, (*TSessionChange)(unsafe.Pointer(p)).FaRecord, (*TSessionChange)(unsafe.Pointer(p)).FnRecord, bp) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf >= _sessions_strm_chunk_size { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf) + (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf = 0 + } + goto _3 + _3: + ; + p = (*TSessionChange)(unsafe.Pointer(p)).FpNext + } + goto _2 + _2: + ; + i++ + } + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if xOutput != 0 { + if (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf) + } + } else { + if ppOut != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf + if pnOut != 0 { + *(*int32)(unsafe.Pointer(pnOut)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FnBuf + } + (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf = uintptr(0) + } + } + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 8))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Allocate a new, empty, sqlite3_changegroup. +// */ +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) (r int32) { + var p uintptr + var rc int32 + _, _ = p, rc + rc = SQLITE_OK /* New object */ + p = Xsqlite3_malloc(tls, int32(32)) + if p == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, p, 0, uint64(32)) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// C documentation +// +// /* +// ** Provide a database schema to the changegroup object. +// */ +func Xsqlite3changegroup_schema(tls *libc.TLS, pGrp uintptr, db uintptr, zDb uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + _ = rc + rc = SQLITE_OK + if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList != 0 || (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb != 0 { + /* Cannot add a schema after one or more calls to sqlite3changegroup_add(), + ** or after sqlite3changegroup_schema() has already been called. */ + rc = int32(SQLITE_MISUSE) + } else { + (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+8, zDb)) + if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb = db + } + } + return rc +} + +// C documentation +// +// /* +// ** Add the changeset currently stored in buffer pData, size nData bytes, +// ** to changeset-group p. +// */ +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pIter at bp+0 */ uintptr + _ = rc /* Return code */ + rc = Xsqlite3changeset_start(tls, bp, nData, pData) + if rc == SQLITE_OK { + rc = _sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** Obtain a buffer containing a changeset representing the concatenation +// ** of all changesets added to the group so far. +// */ +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) (r int32) { + return _sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// C documentation +// +// /* +// ** Streaming versions of changegroup_add(). +// */ +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pIter at bp+0 */ uintptr + _ = rc /* Return code */ + rc = Xsqlite3changeset_start_strm(tls, bp, xInput, pIn) + if rc == SQLITE_OK { + rc = _sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** Streaming versions of changegroup_output(). +// */ +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) (r int32) { + return _sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// C documentation +// +// /* +// ** Delete a changegroup object. +// */ +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { + if pGrp != 0 { + Xsqlite3_free(tls, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb) + _sessionDeleteTable(tls, uintptr(0), (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// C documentation +// +// /* +// ** Combine two changesets together. +// */ +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pGrp at bp+0 */ uintptr + _ = rc + rc = Xsqlite3changegroup_new(tls, bp) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** Streaming version of sqlite3changeset_concat(). +// */ +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pGrp at bp+0 */ uintptr + _ = rc + rc = Xsqlite3changegroup_new(tls, bp) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +/* +** Changeset rebaser handle. + */ +type Tsqlite3_rebaser1 = struct { + Fgrp Tsqlite3_changegroup +} + +type sqlite3_rebaser1 = Tsqlite3_rebaser1 + +// C documentation +// +// /* +// ** Buffers a1 and a2 must both contain a sessions module record nCol +// ** fields in size. This function appends an nCol sessions module +// ** record to buffer pBuf that is a copy of a1, except that for +// ** each field that is undefined in a1[], swap in the field from a2[]. +// */ +func _sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { + var i, nn1, nn2 int32 + var pOut uintptr + _, _, _, _ = i, nn1, nn2, pOut + _sessionBufferGrow(tls, pBuf, int64(n1+n2), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + pOut = (*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf) + i = 0 + for { + if !(i < nCol) { + break + } + nn1 = _sessionSerialLen(tls, a1) + nn2 = _sessionSerialLen(tls, a2) + if int32(*(*Tu8)(unsafe.Pointer(a1))) == 0 || int32(*(*Tu8)(unsafe.Pointer(a1))) == int32(0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint64(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint64(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + goto _1 + _1: + ; + i++ + } + (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) + } +} + +// C documentation +// +// /* +// ** This function is called when rebasing a local UPDATE change against one +// ** or more remote UPDATE changes. The aRec/nRec buffer contains the current +// ** old.* and new.* records for the change. The rebase buffer (a single +// ** record) is in aChange/nChange. The rebased change is appended to buffer +// ** pBuf. +// ** +// ** Rebasing the UPDATE involves: +// ** +// ** * Removing any changes to fields for which the corresponding field +// ** in the rebase buffer is set to "replaced" (type 0xFF). If this +// ** means the UPDATE change updates no fields, nothing is appended +// ** to the output buffer. +// ** +// ** * For each field modified by the local change for which the +// ** corresponding field in the rebase buffer is not "undefined" (0x00) +// ** or "replaced" (0xFF), the old.* value is replaced by the value +// ** in the rebase buffer. +// */ +func _sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { + var a1, a2, pOut, v1, v2, v4, v6 uintptr + var bData, i, n1, n11, n2, n21 int32 + _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, bData, i, n1, n11, n2, n21, pOut, v1, v2, v4, v6 + _sessionBufferGrow(tls, pBuf, int64(int32(2)+nRec+nChange), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + bData = 0 + pOut = (*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf) + a1 = aRec + a2 = aChange + v1 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v1)) = uint8(SQLITE_UPDATE) + v2 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v2)) = uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + break + } + n1 = _sessionSerialLen(tls, a1) + n2 = _sessionSerialLen(tls, a2) + if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0 || int32(*(*Tu8)(unsafe.Pointer(a2))) == 0 { + if !(*(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) && *(*Tu8)(unsafe.Pointer(a1)) != 0 { + bData = int32(1) + } + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + if int32(*(*Tu8)(unsafe.Pointer(a2))) != int32(0xFF) && *(*Tu8)(unsafe.Pointer(a1)) != 0 { + bData = int32(1) + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } else { + v4 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v4)) = uint8('\000') + } + } + a1 += uintptr(n1) + a2 += uintptr(n2) + goto _3 + _3: + ; + i++ + } + if bData != 0 { + a2 = aChange + i = 0 + for { + if !(i < (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + break + } + n11 = _sessionSerialLen(tls, a1) + n21 = _sessionSerialLen(tls, a2) + if *(*Tu8)(unsafe.Pointer((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0 || int32(*(*Tu8)(unsafe.Pointer(a2))) != int32(0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint64(n11)) + pOut += uintptr(n11) + } else { + v6 = pOut + pOut++ + *(*Tu8)(unsafe.Pointer(v6)) = uint8('\000') + } + a1 += uintptr(n11) + a2 += uintptr(n21) + goto _5 + _5: + ; + i++ + } + (*TSessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = int32(int64(pOut) - int64((*TSessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) + } + } +} + +// C documentation +// +// /* +// ** pIter is configured to iterate through a changeset. This function rebases +// ** that changeset according to the current configuration of the rebaser +// ** object passed as the first argument. If no error occurs and argument xOutput +// ** is not NULL, then the changeset is returned to the caller by invoking +// ** xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// ** then (*ppOut) is set to point to a buffer containing the rebased changeset +// ** before this function returns. In this case (*pnOut) is set to the size of +// ** the buffer in bytes. It is the responsibility of the caller to eventually +// ** free the (*ppOut) buffer using sqlite3_free(). +// ** +// ** If an error occurs, an SQLite error code is returned. If ppOut and +// ** pnOut are not NULL, then the two output parameters are set to 0 before +// ** returning. +// */ +func _sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var bDone, iHash, v2 int32 + var pChange, pTab, zTab uintptr + var _ /* aRec at bp+8 */ uintptr + var _ /* bNew at bp+20 */ int32 + var _ /* nRec at bp+16 */ int32 + var _ /* pCsr at bp+40 */ uintptr + var _ /* rc at bp+0 */ int32 + var _ /* sOut at bp+24 */ TSessionBuffer + _, _, _, _, _, _ = bDone, iHash, pChange, pTab, zTab, v2 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16)) = 0 + *(*int32)(unsafe.Pointer(bp + 20)) = 0 + pTab = uintptr(0) + *(*TSessionBuffer)(unsafe.Pointer(bp + 24)) = TSessionBuffer{} + for int32(SQLITE_ROW) == _sessionChangesetNext(tls, pIter, bp+8, bp+16, bp+20) { + pChange = uintptr(0) + bDone = 0 + if *(*int32)(unsafe.Pointer(bp + 20)) != 0 { + zTab = (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + pTab = (*Tsqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList + for { + if !(pTab != 0) { + break + } + if 0 == Xsqlite3_stricmp(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + goto _1 + _1: + ; + pTab = (*TSessionTable)(unsafe.Pointer(pTab)).FpNext + } + *(*int32)(unsafe.Pointer(bp + 20)) = 0 + /* A patchset may not be rebased */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + /* Append a table header to the output for this new table */ + if (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + v2 = int32('P') + } else { + v2 = int32('T') + } + _sessionAppendByte(tls, bp+24, uint8(v2), bp) + _sessionAppendVarint(tls, bp+24, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp) + _sessionAppendBlob(tls, bp+24, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp) + _sessionAppendBlob(tls, bp+24, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, int32(libc.Xstrlen(tls, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab))+int32(1), bp) + } + if pTab != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + iHash = int32(_sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp + 8)), (*TSessionTable)(unsafe.Pointer(pTab)).FnChange)) + pChange = *(*uintptr)(unsafe.Pointer((*TSessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + for { + if !(pChange != 0) { + break + } + if _sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp + 8)), 0, (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + goto _3 + _3: + ; + pChange = (*TSessionChange)(unsafe.Pointer(pChange)).FpNext + } + } + if pChange != 0 { + switch (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case int32(SQLITE_INSERT): + if int32((*TSessionChange)(unsafe.Pointer(pChange)).Fop) == int32(SQLITE_INSERT) { + bDone = int32(1) + if int32((*TSessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + _sessionAppendByte(tls, bp+24, uint8(SQLITE_UPDATE), bp) + _sessionAppendByte(tls, bp+24, uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp) + _sessionAppendBlob(tls, bp+24, (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord, (*TSessionChange)(unsafe.Pointer(pChange)).FnRecord, bp) + _sessionAppendBlob(tls, bp+24, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 16)), bp) + } + } + case int32(SQLITE_UPDATE): + bDone = int32(1) + if int32((*TSessionChange)(unsafe.Pointer(pChange)).Fop) == int32(SQLITE_DELETE) { + if int32((*TSessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + _sessionSkipRecord(tls, bp+40, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + _sessionAppendByte(tls, bp+24, uint8(SQLITE_INSERT), bp) + _sessionAppendByte(tls, bp+24, uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp) + _sessionAppendRecordMerge(tls, bp+24, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, *(*uintptr)(unsafe.Pointer(bp + 40)), int32(int64(*(*int32)(unsafe.Pointer(bp + 16)))-(int64(*(*uintptr)(unsafe.Pointer(bp + 40)))-int64(*(*uintptr)(unsafe.Pointer(bp + 8))))), (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord, (*TSessionChange)(unsafe.Pointer(pChange)).FnRecord, bp) + } + } else { + _sessionAppendPartialUpdate(tls, bp+24, pIter, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 16)), (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord, (*TSessionChange)(unsafe.Pointer(pChange)).FnRecord, bp) + } + default: + bDone = int32(1) + if int32((*TSessionChange)(unsafe.Pointer(pChange)).Fop) == int32(SQLITE_INSERT) { + _sessionAppendByte(tls, bp+24, uint8(SQLITE_DELETE), bp) + _sessionAppendByte(tls, bp+24, uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp) + _sessionAppendRecordMerge(tls, bp+24, (*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, (*TSessionChange)(unsafe.Pointer(pChange)).FaRecord, (*TSessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 16)), bp) + } + break + } + } + if bDone == 0 { + _sessionAppendByte(tls, bp+24, uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp) + _sessionAppendByte(tls, bp+24, uint8((*Tsqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp) + _sessionAppendBlob(tls, bp+24, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 16)), bp) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && xOutput != 0 && (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf > _sessions_strm_chunk_size { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf) + (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + break + } + } + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf) + libc.Xmemset(tls, bp+24, 0, uint64(16)) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if xOutput != 0 { + if (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{xOutput})))(tls, pOut, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf) + } + } else { + if ppOut != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FnBuf + (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf = uintptr(0) + } + } + } + Xsqlite3_free(tls, (*(*TSessionBuffer)(unsafe.Pointer(bp + 24))).FaBuf) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Create a new rebaser object. +// */ +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) (r int32) { + var pNew uintptr + var rc int32 + _, _ = pNew, rc + rc = SQLITE_OK + pNew = Xsqlite3_malloc(tls, int32(32)) + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pNew, 0, uint64(32)) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// C documentation +// +// /* +// ** Call this one or more times to configure a rebaser. +// */ +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pIter at bp+0 */ uintptr + _ = rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Return code */ + rc = Xsqlite3changeset_start(tls, bp, nRebase, pRebase) + if rc == SQLITE_OK { + rc = _sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp)), p, int32(1)) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + return rc +} + +// C documentation +// +// /* +// ** Rebase a changeset according to current rebaser configuration +// */ +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pIter at bp+0 */ uintptr + _ = rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Iterator to skip through input */ + rc = Xsqlite3changeset_start(tls, bp, nIn, pIn) + if rc == SQLITE_OK { + rc = _sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Rebase a changeset according to current rebaser configuration +// */ +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc int32 + var _ /* pIter at bp+0 */ uintptr + _ = rc + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) /* Iterator to skip through input */ + rc = Xsqlite3changeset_start_strm(tls, bp, xInput, pIn) + if rc == SQLITE_OK { + rc = _sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return rc +} + +// C documentation +// +// /* +// ** Destroy a rebaser object +// */ +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { + if p != 0 { + _sessionDeleteTable(tls, uintptr(0), (*Tsqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Global configuration +// */ +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) (r int32) { + var pInt uintptr + var rc int32 + _, _ = pInt, rc + rc = SQLITE_OK + switch op { + case int32(SQLITE_SESSION_CONFIG_STRMSIZE): + pInt = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + _sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = _sessions_strm_chunk_size + default: + rc = int32(SQLITE_MISUSE) + break + } + return rc +} + +/************** End of sqlite3session.c **************************************/ +/************** Begin file fts5.c ********************************************/ + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Interfaces to extend FTS5. Using the interfaces defined in this file, +** FTS5 may be extended with: +** +** * custom tokenizers, and +** * custom auxiliary functions. + */ + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** + */ + +/* #include "fts5.h" */ +/* #include "sqlite3ext.h" */ + +/* #include */ +/* #include */ + +/* Truncate very long tokens to this many bytes. Hard limit is +** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset +** field that occurs at the start of each leaf page (see fts5_index.c). */ + +/* +** Maximum number of prefix indexes on single FTS5 table. This must be +** less than 32. If it is set to anything large than that, an #error +** directive in fts5_index.c will cause the build to fail. + */ + +/* +** Maximum segments permitted in a single index + */ + +/* Name of rank and rowid columns */ + +/* +** The assert_nc() macro is similar to the assert() macro, except that it +** is used for assert() conditions that are true only if it can be +** guranteed that the database is not corrupt. + */ + +/* +** A version of memcmp() that does not cause asan errors if one of the pointer +** parameters is NULL and the number of bytes to compare is zero. + */ + +/* Mark a function parameter as unused, to suppress nuisance compiler +** warnings. */ + +type TFts5Global = struct { + Fapi Tfts5_api + Fdb uintptr + FiNextId Ti64 + FpAux uintptr + FpTok uintptr + FpDfltTok uintptr + FpCsr uintptr +} + +type Fts5Global = TFts5Global + +type TFts5Colset = struct { + FnCol int32 + FaiCol [1]int32 +} + +type Fts5Colset = TFts5Colset + +/* If a NEAR() clump or phrase may only match a specific set of columns, +** then an object of the following type is used to record the set of columns. +** Each entry in the aiCol[] array is a column that may be matched. +** +** This object is used by fts5_expr.c and fts5_index.c. + */ +type TFts5Colset1 = struct { + FnCol int32 + FaiCol [1]int32 +} + +type Fts5Colset1 = TFts5Colset1 + +/************************************************************************** +** Interface to code in fts5_config.c. fts5_config.c contains contains code +** to parse the arguments passed to the CREATE VIRTUAL TABLE statement. + */ + +type TFts5Config = struct { + Fdb uintptr + FzDb uintptr + FzName uintptr + FnCol int32 + FazCol uintptr + FabUnindexed uintptr + FnPrefix int32 + FaPrefix uintptr + FeContent int32 + FbContentlessDelete int32 + FzContent uintptr + FzContentRowid uintptr + FbColumnsize int32 + FbTokendata int32 + FeDetail int32 + FzContentExprlist uintptr + FpTok uintptr + FpTokApi uintptr + FbLock int32 + FePattern int32 + FiVersion int32 + FiCookie int32 + Fpgsz int32 + FnAutomerge int32 + FnCrisisMerge int32 + FnUsermerge int32 + FnHashSize int32 + FzRank uintptr + FzRankArgs uintptr + FbSecureDelete int32 + FnDeleteMerge int32 + FpzErrmsg uintptr +} + +type Fts5Config = TFts5Config + +/* +** An instance of the following structure encodes all information that can +** be gleaned from the CREATE VIRTUAL TABLE statement. +** +** And all information loaded from the %_config table. +** +** nAutomerge: +** The minimum number of segments that an auto-merge operation should +** attempt to merge together. A value of 1 sets the object to use the +** compile time default. Zero disables auto-merge altogether. +** +** bContentlessDelete: +** True if the contentless_delete option was present in the CREATE +** VIRTUAL TABLE statement. +** +** zContent: +** +** zContentRowid: +** The value of the content_rowid= option, if one was specified. Or +** the string "rowid" otherwise. This text is not quoted - if it is +** used as part of an SQL statement it needs to be quoted appropriately. +** +** zContentExprlist: +** +** pzErrmsg: +** This exists in order to allow the fts5_index.c module to return a +** decent error message if it encounters a file-format version it does +** not understand. +** +** bColumnsize: +** True if the %_docsize table is created. +** +** bPrefixIndex: +** This is only used for debugging. If set to false, any prefix indexes +** are ignored. This value is configured using: +** +** INSERT INTO tbl(tbl, rank) VALUES('prefix-index', $bPrefixIndex); +** + */ +type TFts5Config1 = struct { + Fdb uintptr + FzDb uintptr + FzName uintptr + FnCol int32 + FazCol uintptr + FabUnindexed uintptr + FnPrefix int32 + FaPrefix uintptr + FeContent int32 + FbContentlessDelete int32 + FzContent uintptr + FzContentRowid uintptr + FbColumnsize int32 + FbTokendata int32 + FeDetail int32 + FzContentExprlist uintptr + FpTok uintptr + FpTokApi uintptr + FbLock int32 + FePattern int32 + FiVersion int32 + FiCookie int32 + Fpgsz int32 + FnAutomerge int32 + FnCrisisMerge int32 + FnUsermerge int32 + FnHashSize int32 + FzRank uintptr + FzRankArgs uintptr + FbSecureDelete int32 + FnDeleteMerge int32 + FpzErrmsg uintptr +} + +type Fts5Config1 = TFts5Config1 + +/* +** End of interface to code in fts5_config.c. +**************************************************************************/ + +/************************************************************************** +** Interface to code in fts5_buffer.c. + */ + +// C documentation +// +// /* +// ** Buffer object for the incremental building of string data. +// */ +type TFts5Buffer = struct { + Fp uintptr + Fn int32 + FnSpace int32 +} + +type Fts5Buffer = TFts5Buffer + +type TFts5Buffer1 = struct { + Fp uintptr + Fn int32 + FnSpace int32 +} + +type Fts5Buffer1 = TFts5Buffer1 + +type TFts5PoslistReader = struct { + Fa uintptr + Fn int32 + Fi int32 + FbFlag Tu8 + FbEof Tu8 + FiPos Ti64 +} + +type Fts5PoslistReader = TFts5PoslistReader + +type TFts5PoslistReader1 = struct { + Fa uintptr + Fn int32 + Fi int32 + FbFlag Tu8 + FbEof Tu8 + FiPos Ti64 +} + +type Fts5PoslistReader1 = TFts5PoslistReader1 + +type TFts5PoslistWriter = struct { + FiPrev Ti64 +} + +type Fts5PoslistWriter = TFts5PoslistWriter + +type TFts5PoslistWriter1 = struct { + FiPrev Ti64 +} + +type Fts5PoslistWriter1 = TFts5PoslistWriter1 + +// C documentation +// +// /* Bucket of terms object used by the integrity-check in offsets=0 mode. */ +type TFts5Termset = struct { + FapHash [512]uintptr +} + +type Fts5Termset = TFts5Termset + +/* +** End of interface to code in fts5_buffer.c. +**************************************************************************/ + +/************************************************************************** +** Interface to code in fts5_index.c. fts5_index.c contains contains code +** to access the data stored in the %_data table. + */ + +type TFts5Index = struct { + FpConfig uintptr + FzDataTbl uintptr + FnWorkUnit int32 + FpHash uintptr + FnPendingData int32 + FiWriteRowid Ti64 + FbDelete int32 + FnContentlessDelete int32 + FnPendingRow int32 + Frc int32 + FflushRc int32 + FpReader uintptr + FpWriter uintptr + FpDeleter uintptr + FpIdxWriter uintptr + FpIdxDeleter uintptr + FpIdxSelect uintptr + FpIdxNextSelect uintptr + FnRead int32 + FpDeleteFromIdx uintptr + FpDataVersion uintptr + FiStructVersion Ti64 + FpStruct uintptr +} + +type Fts5Index = TFts5Index + +type TFts5IndexIter = struct { + FiRowid Ti64 + FpData uintptr + FnData int32 + FbEof Tu8 +} + +type Fts5IndexIter = TFts5IndexIter + +type TFts5IndexIter1 = struct { + FiRowid Ti64 + FpData uintptr + FnData int32 + FbEof Tu8 +} + +type Fts5IndexIter1 = TFts5IndexIter1 + +/* +** End of interface to code in fts5_varint.c. +**************************************************************************/ + +/************************************************************************** +** Interface to code in fts5_main.c. + */ + +// C documentation +// +// /* +// ** Virtual-table object. +// */ +type TFts5Table = struct { + Fbase Tsqlite3_vtab + FpConfig uintptr + FpIndex uintptr +} + +type Fts5Table = TFts5Table + +type TFts5Table1 = struct { + Fbase Tsqlite3_vtab + FpConfig uintptr + FpIndex uintptr +} + +type Fts5Table1 = TFts5Table1 + +/* +** End of interface to code in fts5.c. +**************************************************************************/ + +// C documentation +// +// /************************************************************************** +// ** Interface to code in fts5_hash.c. +// */ +type TFts5Hash = struct { + FeDetail int32 + FpnByte uintptr + FnEntry int32 + FnSlot int32 + FpScan uintptr + FaSlot uintptr +} + +type Fts5Hash = TFts5Hash + +/* +** End of interface to code in fts5_hash.c. +**************************************************************************/ + +/************************************************************************** +** Interface to code in fts5_storage.c. fts5_storage.c contains contains +** code to access the data stored in the %_content and %_docsize tables. + */ + +type TFts5Storage = struct { + FpConfig uintptr + FpIndex uintptr + FbTotalsValid int32 + FnTotalRow Ti64 + FaTotalSize uintptr + FaStmt [11]uintptr +} + +type Fts5Storage = TFts5Storage + +/* +** End of interface to code in fts5_storage.c. +**************************************************************************/ + +// C documentation +// +// /************************************************************************** +// ** Interface to code in fts5_expr.c. +// */ +type TFts5Expr = struct { + FpIndex uintptr + FpConfig uintptr + FpRoot uintptr + FbDesc int32 + FnPhrase int32 + FapExprPhrase uintptr +} + +type Fts5Expr = TFts5Expr + +type TFts5ExprNode = struct { + FeType int32 + FbEof int32 + FbNomatch int32 + FiHeight int32 + FxNext uintptr + FiRowid Ti64 + FpNear uintptr + FnChild int32 + FapChild [1]uintptr +} + +type Fts5ExprNode = TFts5ExprNode + +type TFts5Parse = struct { + FpConfig uintptr + FzErr uintptr + Frc int32 + FnPhrase int32 + FapPhrase uintptr + FpExpr uintptr + FbPhraseToAnd int32 +} + +type Fts5Parse = TFts5Parse + +type TFts5Token = struct { + Fp uintptr + Fn int32 +} + +type Fts5Token = TFts5Token + +type TFts5ExprPhrase = struct { + FpNode uintptr + Fposlist TFts5Buffer + FnTerm int32 + FaTerm [1]TFts5ExprTerm +} + +type Fts5ExprPhrase = TFts5ExprPhrase + +type TFts5ExprNearset = struct { + FnNear int32 + FpColset uintptr + FnPhrase int32 + FapPhrase [1]uintptr +} + +type Fts5ExprNearset = TFts5ExprNearset + +type TFts5Token1 = struct { + Fp uintptr + Fn int32 +} + +type Fts5Token1 = TFts5Token1 + +type TFts5PoslistPopulator = struct { + Fwriter TFts5PoslistWriter + FbOk int32 + FbMiss int32 +} + +type Fts5PoslistPopulator = TFts5PoslistPopulator + +/* +** End of interface to code in fts5_unicode2.c. +**************************************************************************/ + +/* This file is automatically generated by Lemon from input grammar +** source file "fts5parse.y". + */ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: + */ +/************ Begin %include sections from the grammar ************************/ + +/* #include "fts5Int.h" */ +/* #include "fts5parse.h" */ + +/* +** Disable all error recovery processing in the parser push-down +** automaton. + */ + +/* +** Make fts5yytestcase() the same as testcase() + */ + +/* +** Indicate that sqlite3ParserFree() will never be called with a null +** pointer. + */ + +/* +** Alternative datatype for the argument to the malloc() routine passed +** into sqlite3ParserAlloc(). The default is size_t. + */ + +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +/**************** End token definitions ***************************************/ + +// C documentation +// +// /* The next sections is a series of control #defines. +// ** various aspects of the generated parser. +// ** fts5YYCODETYPE is the data type used to store the integer codes +// ** that represent terminal and non-terminal symbols. +// ** "unsigned char" is used if there are fewer than +// ** 256 symbols. Larger types otherwise. +// ** fts5YYNOCODE is a number of type fts5YYCODETYPE that is not used for +// ** any terminal or nonterminal symbol. +// ** fts5YYFALLBACK If defined, this indicates that one or more tokens +// ** (also known as: "terminal symbols") have fall-back +// ** values which should be used if the original symbol +// ** would not parse. This permits keywords to sometimes +// ** be used as identifiers, for example. +// ** fts5YYACTIONTYPE is the data type used for "action codes" - numbers +// ** that indicate what to do in response to the next +// ** token. +// ** sqlite3Fts5ParserFTS5TOKENTYPE is the data type used for minor type for terminal +// ** symbols. Background: A "minor type" is a semantic +// ** value associated with a terminal or non-terminal +// ** symbols. For example, for an "ID" terminal symbol, +// ** the minor type might be the name of the identifier. +// ** Each non-terminal can have a different minor type. +// ** Terminal symbols all have the same minor type, though. +// ** This macros defines the minor type for terminal +// ** symbols. +// ** fts5YYMINORTYPE is the data type used for all minor types. +// ** This is typically a union of many types, one of +// ** which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union +// ** for terminal symbols is called "fts5yy0". +// ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If +// ** zero the stack is dynamically sized using realloc() +// ** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument +// ** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument +// ** sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +// ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser +// ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser +// ** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context +// ** fts5YYERRORSYMBOL is the code number of the error symbol. If not +// ** defined, then do no error processing. +// ** fts5YYNSTATE the combined number of states. +// ** fts5YYNRULE the number of rules in the grammar +// ** fts5YYNFTS5TOKEN Number of terminal symbols +// ** fts5YY_MAX_SHIFT Maximum value for shift actions +// ** fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +// ** fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +// ** fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error +// ** fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept +// ** fts5YY_NO_ACTION The fts5yy_action[] code for no-op +// ** fts5YY_MIN_REDUCE Minimum value for reduce actions +// ** fts5YY_MAX_REDUCE Maximum value for reduce actions +// */ +// /************* Begin control #defines *****************************************/ +type Tfts5YYMINORTYPE = struct { + Ffts5yy0 [0]TFts5Token + Ffts5yy4 [0]int32 + Ffts5yy11 [0]uintptr + Ffts5yy24 [0]uintptr + Ffts5yy46 [0]uintptr + Ffts5yy53 [0]uintptr + Ffts5yyinit int32 + F__ccgo_pad7 [12]byte +} + +type fts5YYMINORTYPE = Tfts5YYMINORTYPE + +/************* End control #defines *******************************************/ + +/* Define the fts5yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define fts5yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the fts5yytestcase() macro should be turned off. But it is useful +** for testing. + */ + +// C documentation +// +// /* Next are the tables used to determine what action to take based on the +// ** current state and lookahead token. These tables are used to implement +// ** functions that take a state number and lookahead value and return an +// ** action integer. +// ** +// ** Suppose the action integer is N. Then the action is determined as +// ** follows +// ** +// ** 0 <= N <= fts5YY_MAX_SHIFT Shift N. That is, push the lookahead +// ** token onto the stack and goto state N. +// ** +// ** N between fts5YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +// ** and fts5YY_MAX_SHIFTREDUCE reduce by rule N-fts5YY_MIN_SHIFTREDUCE. +// ** +// ** N == fts5YY_ERROR_ACTION A syntax error has occurred. +// ** +// ** N == fts5YY_ACCEPT_ACTION The parser accepts its input. +// ** +// ** N == fts5YY_NO_ACTION No such action. Denotes unused +// ** slots in the fts5yy_action[] table. +// ** +// ** N between fts5YY_MIN_REDUCE Reduce by rule N-fts5YY_MIN_REDUCE +// ** and fts5YY_MAX_REDUCE +// ** +// ** The action table is constructed as a single large table named fts5yy_action[]. +// ** Given state S and lookahead X, the action is computed as either: +// ** +// ** (A) N = fts5yy_action[ fts5yy_shift_ofst[S] + X ] +// ** (B) N = fts5yy_default[S] +// ** +// ** The (A) formula is preferred. The B formula is used instead if +// ** fts5yy_lookahead[fts5yy_shift_ofst[S]+X] is not equal to X. +// ** +// ** The formulas above are for computing the action when the lookahead is +// ** a terminal symbol. If the lookahead is a non-terminal (as occurs after +// ** a reduce action) then the fts5yy_reduce_ofst[] array is used in place of +// ** the fts5yy_shift_ofst[] array. +// ** +// ** The following are the tables generated in this section: +// ** +// ** fts5yy_action[] A single table containing all actions. +// ** fts5yy_lookahead[] A table containing the lookahead for each entry in +// ** fts5yy_action. Used to detect hash collisions. +// ** fts5yy_shift_ofst[] For each state, the offset into fts5yy_action for +// ** shifting terminals. +// ** fts5yy_reduce_ofst[] For each state, the offset into fts5yy_action for +// ** shifting non-terminals after a reduce. +// ** fts5yy_default[] Default action for each state. +// ** +// *********** Begin parsing tables **********************************************/ +var _fts5yy_action = [105]uint8{ + 0: uint8(81), + 1: uint8(20), + 2: uint8(96), + 3: uint8(6), + 4: uint8(28), + 5: uint8(99), + 6: uint8(98), + 7: uint8(26), + 8: uint8(26), + 9: uint8(18), + 10: uint8(96), + 11: uint8(6), + 12: uint8(28), + 13: uint8(17), + 14: uint8(98), + 15: uint8(56), + 16: uint8(26), + 17: uint8(19), + 18: uint8(96), + 19: uint8(6), + 20: uint8(28), + 21: uint8(14), + 22: uint8(98), + 23: uint8(14), + 24: uint8(26), + 25: uint8(31), + 26: uint8(92), + 27: uint8(96), + 28: uint8(6), + 29: uint8(28), + 30: uint8(108), + 31: uint8(98), + 32: uint8(25), + 33: uint8(26), + 34: uint8(21), + 35: uint8(96), + 36: uint8(6), + 37: uint8(28), + 38: uint8(78), + 39: uint8(98), + 40: uint8(58), + 41: uint8(26), + 42: uint8(29), + 43: uint8(96), + 44: uint8(6), + 45: uint8(28), + 46: uint8(107), + 47: uint8(98), + 48: uint8(22), + 49: uint8(26), + 50: uint8(24), + 51: uint8(16), + 52: uint8(12), + 53: uint8(11), + 54: uint8(1), + 55: uint8(13), + 56: uint8(13), + 57: uint8(24), + 58: uint8(16), + 59: uint8(23), + 60: uint8(11), + 61: uint8(33), + 62: uint8(34), + 63: uint8(13), + 64: uint8(97), + 65: uint8(8), + 66: uint8(27), + 67: uint8(32), + 68: uint8(98), + 69: uint8(7), + 70: uint8(26), + 71: uint8(3), + 72: uint8(4), + 73: uint8(5), + 74: uint8(3), + 75: uint8(4), + 76: uint8(5), + 77: uint8(3), + 78: uint8(83), + 79: uint8(4), + 80: uint8(5), + 81: uint8(3), + 82: uint8(63), + 83: uint8(5), + 84: uint8(3), + 85: uint8(62), + 86: uint8(12), + 87: uint8(2), + 88: uint8(86), + 89: uint8(13), + 90: uint8(9), + 91: uint8(30), + 92: uint8(10), + 93: uint8(10), + 94: uint8(54), + 95: uint8(57), + 96: uint8(75), + 97: uint8(78), + 98: uint8(78), + 99: uint8(53), + 100: uint8(57), + 101: uint8(15), + 102: uint8(82), + 103: uint8(82), + 104: uint8(71), +} +var _fts5yy_lookahead = [121]uint8{ + 0: uint8(16), + 1: uint8(17), + 2: uint8(18), + 3: uint8(19), + 4: uint8(20), + 5: uint8(22), + 6: uint8(22), + 7: uint8(24), + 8: uint8(24), + 9: uint8(17), + 10: uint8(18), + 11: uint8(19), + 12: uint8(20), + 13: uint8(7), + 14: uint8(22), + 15: uint8(9), + 16: uint8(24), + 17: uint8(17), + 18: uint8(18), + 19: uint8(19), + 20: uint8(20), + 21: uint8(9), + 22: uint8(22), + 23: uint8(9), + 24: uint8(24), + 25: uint8(13), + 26: uint8(17), + 27: uint8(18), + 28: uint8(19), + 29: uint8(20), + 30: uint8(26), + 31: uint8(22), + 32: uint8(24), + 33: uint8(24), + 34: uint8(17), + 35: uint8(18), + 36: uint8(19), + 37: uint8(20), + 38: uint8(15), + 39: uint8(22), + 40: uint8(9), + 41: uint8(24), + 42: uint8(17), + 43: uint8(18), + 44: uint8(19), + 45: uint8(20), + 46: uint8(26), + 47: uint8(22), + 48: uint8(21), + 49: uint8(24), + 50: uint8(6), + 51: uint8(7), + 52: uint8(9), + 53: uint8(9), + 54: uint8(10), + 55: uint8(12), + 56: uint8(12), + 57: uint8(6), + 58: uint8(7), + 59: uint8(21), + 60: uint8(9), + 61: uint8(24), + 62: uint8(25), + 63: uint8(12), + 64: uint8(18), + 65: uint8(5), + 66: uint8(20), + 67: uint8(14), + 68: uint8(22), + 69: uint8(5), + 70: uint8(24), + 71: uint8(3), + 72: uint8(1), + 73: uint8(2), + 74: uint8(3), + 75: uint8(1), + 76: uint8(2), + 77: uint8(3), + 79: uint8(1), + 80: uint8(2), + 81: uint8(3), + 82: uint8(11), + 83: uint8(2), + 84: uint8(3), + 85: uint8(11), + 86: uint8(9), + 87: uint8(10), + 88: uint8(5), + 89: uint8(12), + 90: uint8(23), + 91: uint8(24), + 92: uint8(10), + 93: uint8(10), + 94: uint8(8), + 95: uint8(9), + 96: uint8(9), + 97: uint8(15), + 98: uint8(15), + 99: uint8(8), + 100: uint8(9), + 101: uint8(9), + 102: uint8(27), + 103: uint8(27), + 104: uint8(11), + 105: uint8(27), + 106: uint8(27), + 107: uint8(27), + 108: uint8(27), + 109: uint8(27), + 110: uint8(27), + 111: uint8(27), + 112: uint8(27), + 113: uint8(27), + 114: uint8(27), + 115: uint8(27), + 116: uint8(27), + 117: uint8(27), + 118: uint8(27), + 119: uint8(27), + 120: uint8(27), +} +var _fts5yy_shift_ofst = [35]uint8{ + 0: uint8(44), + 1: uint8(44), + 2: uint8(44), + 3: uint8(44), + 4: uint8(44), + 5: uint8(44), + 6: uint8(51), + 7: uint8(77), + 8: uint8(43), + 9: uint8(12), + 10: uint8(14), + 11: uint8(83), + 12: uint8(82), + 13: uint8(14), + 14: uint8(23), + 15: uint8(23), + 16: uint8(31), + 17: uint8(31), + 18: uint8(71), + 19: uint8(74), + 20: uint8(78), + 21: uint8(81), + 22: uint8(86), + 23: uint8(91), + 24: uint8(6), + 25: uint8(53), + 26: uint8(53), + 27: uint8(60), + 28: uint8(64), + 29: uint8(68), + 30: uint8(53), + 31: uint8(87), + 32: uint8(92), + 33: uint8(53), + 34: uint8(93), +} +var _fts5yy_reduce_ofst = [18]int8{ + 0: int8(-int32(16)), + 1: int8(-int32(8)), + 3: int8(9), + 4: int8(17), + 5: int8(25), + 6: int8(46), + 7: int8(-int32(17)), + 8: int8(-int32(17)), + 9: int8(37), + 10: int8(67), + 11: int8(4), + 12: int8(4), + 13: int8(8), + 14: int8(4), + 15: int8(20), + 16: int8(27), + 17: int8(38), +} +var _fts5yy_default = [35]uint8{ + 0: uint8(80), + 1: uint8(80), + 2: uint8(80), + 3: uint8(80), + 4: uint8(80), + 5: uint8(80), + 6: uint8(95), + 7: uint8(80), + 8: uint8(80), + 9: uint8(105), + 10: uint8(80), + 11: uint8(110), + 12: uint8(110), + 13: uint8(80), + 14: uint8(110), + 15: uint8(110), + 16: uint8(80), + 17: uint8(80), + 18: uint8(80), + 19: uint8(80), + 20: uint8(80), + 21: uint8(91), + 22: uint8(80), + 23: uint8(80), + 24: uint8(80), + 25: uint8(101), + 26: uint8(100), + 27: uint8(80), + 28: uint8(80), + 29: uint8(90), + 30: uint8(103), + 31: uint8(80), + 32: uint8(80), + 33: uint8(104), + 34: uint8(80), +} + +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. + */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. + */ +type Tfts5yyStackEntry1 = struct { + Fstateno uint8 + Fmajor uint8 + Fminor Tfts5YYMINORTYPE +} + +type fts5yyStackEntry1 = Tfts5yyStackEntry1 + +type Tfts5yyStackEntry = struct { + Fstateno uint8 + Fmajor uint8 + Fminor Tfts5YYMINORTYPE +} + +type fts5yyStackEntry = Tfts5yyStackEntry + +/* The state of the parser is completely contained in an instance of +** the following structure */ +type Tfts5yyParser1 = struct { + Ffts5yytos uintptr + FpParse uintptr + Ffts5yystack [100]Tfts5yyStackEntry + Ffts5yystackEnd uintptr +} + +type fts5yyParser1 = Tfts5yyParser1 + +type Tfts5yyParser = struct { + Ffts5yytos uintptr + FpParse uintptr + Ffts5yystack [100]Tfts5yyStackEntry + Ffts5yystackEnd uintptr +} + +type fts5yyParser = Tfts5yyParser + +/* #include */ + +/* Datatype of the argument to the memory allocated passed as the +** second argument to sqlite3Fts5ParserAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. + */ + +// C documentation +// +// /* Initialize a new parser that has already been allocated. +// */ +func _sqlite3Fts5ParserInit(tls *libc.TLS, fts5yypRawParser uintptr) { + var fts5yypParser uintptr + _ = fts5yypParser + fts5yypParser = fts5yypRawParser + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos = fts5yypParser + 16 + (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yypParser + 16))).Fstateno = uint8(0) + (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yypParser + 16))).Fmajor = uint8(0) + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd = fts5yypParser + 16 + uintptr(libc.Int32FromInt32(fts5YYSTACKDEPTH)-libc.Int32FromInt32(1))*24 +} + +// C documentation +// +// /* +// ** This function allocates a new parser. +// ** The only argument is a pointer to a function which works like +// ** malloc. +// ** +// ** Inputs: +// ** A pointer to the function used to allocate memory. +// ** +// ** Outputs: +// ** A pointer to a parser. This pointer is used in subsequent calls +// ** to sqlite3Fts5Parser and sqlite3Fts5ParserFree. +// */ +func _sqlite3Fts5ParserAlloc(tls *libc.TLS, mallocProc uintptr) (r uintptr) { + var fts5yypParser uintptr + _ = fts5yypParser + fts5yypParser = (*(*func(*libc.TLS, Tu64) uintptr)(unsafe.Pointer(&struct{ uintptr }{mallocProc})))(tls, libc.Uint64FromInt64(2424)) + if fts5yypParser != 0 { + _sqlite3Fts5ParserInit(tls, fts5yypParser) + } + return fts5yypParser +} + +// C documentation +// +// /* The following function deletes the "minor type" or semantic value +// ** associated with a symbol. The symbol can be either a terminal +// ** or nonterminal. "fts5yymajor" is the symbol code, and "fts5yypminor" is +// ** a pointer to the value to be deleted. The code used to do the +// ** deletions is derived from the %destructor and/or %token_destructor +// ** directives of the input grammar. +// */ +func _fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, fts5yypminor uintptr) { + var pParse uintptr + _ = pParse + pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + switch int32(fts5yymajor) { + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ + /********* Begin destructor definitions ***************************************/ + case int32(16): /* input */ + _ = pParse + case int32(17): /* expr */ + fallthrough + case int32(18): /* cnearset */ + fallthrough + case int32(19): /* exprlist */ + _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) + case int32(20): /* colset */ + fallthrough + case int32(21): /* colsetlist */ + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) + case int32(22): /* nearset */ + fallthrough + case int32(23): /* nearphrases */ + _sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) + case int32(24): /* phrase */ + _sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor))) + break + /********* End destructor definitions *****************************************/ + fallthrough + default: + break /* If no destructor action specified: do nothing */ + } +} + +// C documentation +// +// /* +// ** Pop the parser's stack once. +// ** +// ** If there is a destructor routine associated with the token which +// ** is popped from the stack, then call it. +// */ +func _fts5yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { + var fts5yytos, v1, v2 uintptr + _, _, _ = fts5yytos, v1, v2 + v2 = pParser + v1 = *(*uintptr)(unsafe.Pointer(v2)) + *(*uintptr)(unsafe.Pointer(v2)) -= 24 + fts5yytos = v1 + _fts5yy_destructor(tls, pParser, (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fmajor, fts5yytos+8) +} + +// C documentation +// +// /* +// ** Clear all secondary memory allocations from the parser +// */ +func _sqlite3Fts5ParserFinalize(tls *libc.TLS, p uintptr) { + var pParser uintptr + _ = pParser + pParser = p + for (*Tfts5yyParser)(unsafe.Pointer(pParser)).Ffts5yytos > pParser+16 { + _fts5yy_pop_parser_stack(tls, pParser) + } +} + +// C documentation +// +// /* +// ** Deallocate and destroy a parser. Destructors are called for +// ** all stack elements before shutting the parser down. +// ** +// ** If the fts5YYPARSEFREENEVERNULL macro exists (for example because it +// ** is defined in a %include section of the input grammar) then it is +// ** assumed that the input pointer is never NULL. +// */ +func _sqlite3Fts5ParserFree(tls *libc.TLS, p uintptr, freeProc uintptr) { + if p == uintptr(0) { + return + } + _sqlite3Fts5ParserFinalize(tls, p) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{freeProc})))(tls, p) +} + +/* +** Return the peak depth of the stack for a parser. + */ + +/* This array of booleans keeps track of the parser statement +** coverage. The element fts5yycoverage[X][Y] is set when the parser +** is in state X and has a lookahead token Y. In a well-tested +** systems, every element of this matrix should end up being set. + */ + +/* +** Write into out a description of every state/lookahead combination that +** +** (1) has not been used by the parser, and +** (2) is not a syntax error. +** +** Return the number of missed state/lookahead combinations. + */ + +// C documentation +// +// /* +// ** Find the appropriate action for a parser given the terminal +// ** look-ahead token iLookAhead. +// */ +func _fts5yy_find_shift_action(tls *libc.TLS, iLookAhead uint8, stateno uint8) (r uint8) { + var i int32 + _ = i + if int32(stateno) > int32(fts5YY_MAX_SHIFT) { + return stateno + } + for cond := true; cond; cond = int32(1) != 0 { + i = int32(_fts5yy_shift_ofst[stateno]) + i += int32(iLookAhead) + if int32(_fts5yy_lookahead[i]) != int32(iLookAhead) { + return _fts5yy_default[stateno] + } else { + return _fts5yy_action[i] + } + } + return r +} + +// C documentation +// +// /* +// ** Find the appropriate action for a parser given the non-terminal +// ** look-ahead token iLookAhead. +// */ +func _fts5yy_find_reduce_action(tls *libc.TLS, stateno uint8, iLookAhead uint8) (r uint8) { + var i int32 + _ = i + i = int32(_fts5yy_reduce_ofst[stateno]) + i += int32(iLookAhead) + return _fts5yy_action[i] +} + +// C documentation +// +// /* +// ** The following routine is called if the stack overflows. +// */ +func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { + var pParse uintptr + _ = pParse + pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + for (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos > fts5yypParser+16 { + _fts5yy_pop_parser_stack(tls, fts5yypParser) + } + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + /******** Begin %stack_overflow code ******************************************/ + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34754, 0) + /******** End %stack_overflow code ********************************************/ + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ +} + +/* +** Print tracing information for a SHIFT action + */ + +// C documentation +// +// /* +// ** Perform a shift action. +// */ +func _fts5yy_shift(tls *libc.TLS, fts5yypParser uintptr, fts5yyNewState uint8, fts5yyMajor uint8, fts5yyMinor TFts5Token) { + var fts5yytos uintptr + _ = fts5yytos + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos += 24 + if (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos > (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd { + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos -= 24 + _fts5yyStackOverflow(tls, fts5yypParser) + return + } + if int32(fts5yyNewState) > int32(fts5YY_MAX_SHIFT) { + fts5yyNewState = uint8(int32(fts5yyNewState) + (libc.Int32FromInt32(fts5YY_MIN_REDUCE) - libc.Int32FromInt32(fts5YY_MIN_SHIFTREDUCE))) + } + fts5yytos = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos + (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fstateno = fts5yyNewState + (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fmajor = fts5yyMajor + *(*TFts5Token)(unsafe.Pointer(fts5yytos + 8)) = fts5yyMinor +} + +// C documentation +// +// /* For rule J, fts5yyRuleInfoLhs[J] contains the symbol on the left-hand side +// ** of that rule */ +var _fts5yyRuleInfoLhs = [28]uint8{ + 0: uint8(16), + 1: uint8(20), + 2: uint8(20), + 3: uint8(20), + 4: uint8(20), + 5: uint8(21), + 6: uint8(21), + 7: uint8(17), + 8: uint8(17), + 9: uint8(17), + 10: uint8(17), + 11: uint8(17), + 12: uint8(17), + 13: uint8(19), + 14: uint8(19), + 15: uint8(18), + 16: uint8(18), + 17: uint8(22), + 18: uint8(22), + 19: uint8(22), + 20: uint8(23), + 21: uint8(23), + 22: uint8(25), + 23: uint8(25), + 24: uint8(24), + 25: uint8(24), + 26: uint8(26), + 27: uint8(26), +} + +// C documentation +// +// /* For rule J, fts5yyRuleInfoNRhs[J] contains the negative of the number +// ** of symbols on the right-hand side of that rule. */ +var _fts5yyRuleInfoNRhs = [28]int8{ + 0: int8(-int32(1)), + 1: int8(-int32(4)), + 2: int8(-int32(3)), + 3: int8(-int32(1)), + 4: int8(-int32(2)), + 5: int8(-int32(2)), + 6: int8(-int32(1)), + 7: int8(-int32(3)), + 8: int8(-int32(3)), + 9: int8(-int32(3)), + 10: int8(-int32(5)), + 11: int8(-int32(3)), + 12: int8(-int32(1)), + 13: int8(-int32(1)), + 14: int8(-int32(2)), + 15: int8(-int32(1)), + 16: int8(-int32(3)), + 17: int8(-int32(1)), + 18: int8(-int32(2)), + 19: int8(-int32(5)), + 20: int8(-int32(1)), + 21: int8(-int32(2)), + 23: int8(-int32(2)), + 24: int8(-int32(4)), + 25: int8(-int32(2)), + 26: int8(-int32(1)), +} + +// C documentation +// +// /* +// ** Perform a reduce action and the shift that must immediately +// ** follow the reduce. +// ** +// ** The fts5yyLookahead and fts5yyLookaheadToken parameters provide reduce actions +// ** access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE +// ** if the lookahead token has already been consumed. As this procedure is +// ** only called from one place, optimizing compilers will in-line it, which +// ** means that the extra parameters have no performance impact. +// */ +func _fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, fts5yyLookahead int32, fts5yyLookaheadToken TFts5Token) (r uint8) { + var fts5yyact uint8 + var fts5yygoto, fts5yysize int32 + var fts5yylhsminor Tfts5YYMINORTYPE + var fts5yymsp, pParse uintptr + _, _, _, _, _, _ = fts5yyact, fts5yygoto, fts5yylhsminor, fts5yymsp, fts5yysize, pParse /* Amount to pop the stack */ + pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + _ = fts5yyLookahead + _ = fts5yyLookaheadToken + fts5yymsp = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos + switch fts5yyruleno { + case uint32(0): + goto _1 + case uint32(1): + goto _2 + case uint32(2): + goto _3 + case uint32(3): + goto _4 + case uint32(4): + goto _5 + case uint32(5): + goto _6 + case uint32(6): + goto _7 + case uint32(7): + goto _8 + case uint32(8): + goto _9 + case uint32(9): + goto _10 + case uint32(10): + goto _11 + case uint32(11): + goto _12 + case uint32(13): + goto _13 + case uint32(12): + goto _14 + case uint32(14): + goto _15 + case uint32(15): + goto _16 + case uint32(16): + goto _17 + case uint32(17): + goto _18 + case uint32(18): + goto _19 + case uint32(19): + goto _20 + case uint32(20): + goto _21 + case uint32(21): + goto _22 + case uint32(22): + goto _23 + case uint32(23): + goto _24 + case uint32(24): + goto _25 + case uint32(25): + goto _26 + case uint32(26): + goto _27 + case uint32(27): + goto _28 + default: + goto _29 + } + goto _30 +_1: + ; /* input ::= expr */ + _sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + goto _30 +_2: + ; /* colset ::= MINUS LCP colsetlist RCP */ + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _30 +_3: + ; /* colset ::= LCP colsetlist RCP */ + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _30 +_4: + ; /* colset ::= STRING */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_5: + ; /* colset ::= MINUS STRING */ + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8))) + goto _30 +_6: + ; /* colsetlist ::= colsetlist STRING */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), fts5yymsp+8) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_7: + ; /* colsetlist ::= STRING */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseColset(tls, pParse, uintptr(0), fts5yymsp+8) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_8: + ; /* expr ::= expr AND expr */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_9: + ; /* expr ::= expr OR expr */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_OR), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_10: + ; /* expr ::= expr NOT expr */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_NOT), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)), uintptr(0)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_11: + ; /* expr ::= colset COLON LP expr RP */ + _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8))) + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_12: + ; /* expr ::= LP expr RP */ + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) + goto _30 +_14: + ; /* expr ::= exprlist */ +_13: + ; + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_15: + ; /* exprlist ::= exprlist cnearset */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_16: + ; /* cnearset ::= nearset */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_17: + ; /* cnearset ::= colset COLON nearset */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + _sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)), *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_18: + ; /* nearset ::= phrase */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_19: + ; /* nearset ::= CARET phrase */ + _sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + goto _30 +_20: + ; /* nearset ::= STRING LP nearphrases neardist_opt RP */ + _sqlite3Fts5ParseNear(tls, pParse, fts5yymsp+uintptr(-libc.Int32FromInt32(4))*24+8) + _sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8) + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(2))*24 + 8)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(4))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_21: + ; /* nearphrases ::= phrase */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_22: + ; /* nearphrases ::= nearphrases phrase */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_23: + ; /* neardist_opt ::= */ + *(*uintptr)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 + 8)) = 0 + goto _30 +_24: + ; /* neardist_opt ::= COMMA STRING */ + *(*TFts5Token)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*TFts5Token)(unsafe.Pointer(fts5yymsp + 8)) + goto _30 +_25: + ; /* phrase ::= phrase PLUS STRING star_opt */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(3))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_26: + ; /* phrase ::= STRING star_opt */ + *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) = _sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), fts5yymsp+uintptr(-libc.Int32FromInt32(1))*24+8, *(*int32)(unsafe.Pointer(fts5yymsp + 8))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + uintptr(-libc.Int32FromInt32(1))*24 + 8)) = *(*uintptr)(unsafe.Pointer(&fts5yylhsminor)) + goto _30 +_27: + ; /* star_opt ::= STAR */ + *(*int32)(unsafe.Pointer(fts5yymsp + 8)) = int32(1) + goto _30 +_28: + ; /* star_opt ::= */ + *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8)) = 0 + goto _30 +_29: + ; + goto _30 + /********** End reduce actions ************************************************/ +_30: + ; + fts5yygoto = int32(_fts5yyRuleInfoLhs[fts5yyruleno]) + fts5yysize = int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) + fts5yyact = _fts5yy_find_reduce_action(tls, (*(*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp + uintptr(fts5yysize)*24))).Fstateno, uint8(fts5yygoto)) + /* There are no SHIFTREDUCE actions on nonterminals because the table + ** generator has simplified them to pure REDUCE actions. */ + /* It is not possible for a REDUCE to be followed by an error */ + fts5yymsp += uintptr(fts5yysize+int32(1)) * 24 + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos = fts5yymsp + (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp)).Fstateno = fts5yyact + (*Tfts5yyStackEntry)(unsafe.Pointer(fts5yymsp)).Fmajor = uint8(fts5yygoto) + return fts5yyact +} + +/* +** The following code executes when the parse fails + */ + +// C documentation +// +// /* +// ** The following code executes when a syntax error first occurs. +// */ +func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32, fts5yyminor TFts5Token) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pParse uintptr + _ = pParse + pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + /************ Begin %syntax_error code ****************************************/ + _ = fts5yymajor /* Silence a compiler warning */ + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34782, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) + /************ End %syntax_error code ******************************************/ + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ +} + +// C documentation +// +// /* +// ** The following is executed when the parser accepts +// */ +func _fts5yy_accept(tls *libc.TLS, fts5yypParser uintptr) { + var pParse uintptr + _ = pParse + pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + /*********** Begin %parse_accept code *****************************************/ + /*********** End %parse_accept code *******************************************/ + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ +} + +// C documentation +// +// /* The main parser program. +// ** The first argument is a pointer to a structure obtained from +// ** "sqlite3Fts5ParserAlloc" which describes the current state of the parser. +// ** The second argument is the major token number. The third is +// ** the minor token. The fourth optional argument is whatever the +// ** user wants (and specified in the grammar) and is available for +// ** use by the action routines. +// ** +// ** Inputs: +// **
      +// **
    • A pointer to the parser (an opaque structure.) +// **
    • The major token number. +// **
    • The minor token number. +// **
    • An option argument of a grammar-specified type. +// **
    +// ** +// ** Outputs: +// ** None. +// */ +func _sqlite3Fts5Parser(tls *libc.TLS, fts5yyp uintptr, fts5yymajor int32, fts5yyminor TFts5Token, pParse uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var fts5yyact uint8 + var fts5yypParser uintptr + var fts5yyruleno uint32 + var _ /* fts5yyminorunion at bp+0 */ Tfts5YYMINORTYPE + _, _, _ = fts5yyact, fts5yypParser, fts5yyruleno /* The parser action. */ + fts5yypParser = fts5yyp /* The parser */ + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse + fts5yyact = (*Tfts5yyStackEntry)(unsafe.Pointer((*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos)).Fstateno + for int32(1) != 0 { /* Exit by "break" */ + fts5yyact = _fts5yy_find_shift_action(tls, uint8(fts5yymajor), fts5yyact) + if int32(fts5yyact) >= int32(fts5YY_MIN_REDUCE) { + fts5yyruleno = uint32(int32(fts5yyact) - int32(fts5YY_MIN_REDUCE)) /* Reduce by this rule */ + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if int32(_fts5yyRuleInfoNRhs[fts5yyruleno]) == 0 { + if (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos >= (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd { + _fts5yyStackOverflow(tls, fts5yypParser) + break + } + } + fts5yyact = _fts5yy_reduce(tls, fts5yypParser, fts5yyruleno, fts5yymajor, fts5yyminor) + } else { + if int32(fts5yyact) <= int32(fts5YY_MAX_SHIFTREDUCE) { + _fts5yy_shift(tls, fts5yypParser, fts5yyact, uint8(fts5yymajor), fts5yyminor) + break + } else { + if int32(fts5yyact) == int32(fts5YY_ACCEPT_ACTION) { + (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos -= 24 + _fts5yy_accept(tls, fts5yypParser) + return + } else { + *(*TFts5Token)(unsafe.Pointer(bp)) = fts5yyminor + /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + _fts5yy_syntax_error(tls, fts5yypParser, fts5yymajor, fts5yyminor) + _fts5yy_destructor(tls, fts5yypParser, uint8(fts5yymajor), bp) + break + } + } + } + } + return +} + +// C documentation +// +// /* +// ** Return the fallback token corresponding to canonical token iToken, or +// ** 0 if iToken has no fallback. +// */ +func _sqlite3Fts5ParserFallback(tls *libc.TLS, iToken int32) (r int32) { + _ = iToken + return 0 +} + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** + */ + +/* #include "fts5Int.h" */ + +// C documentation +// +// /* +// ** Object used to iterate through all "coalesced phrase instances" in +// ** a single column of the current row. If the phrase instances in the +// ** column being considered do not overlap, this object simply iterates +// ** through them. Or, if they do overlap (share one or more tokens in +// ** common), each set of overlapping instances is treated as a single +// ** match. See documentation for the highlight() auxiliary function for +// ** details. +// ** +// ** Usage is: +// ** +// ** for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter); +// ** (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter); +// ** rc = fts5CInstIterNext(&iter) +// ** ){ +// ** printf("instance starts at %d, ends at %d\n", iter.iStart, iter.iEnd); +// ** } +// ** +// */ +type TCInstIter = struct { + FpApi uintptr + FpFts uintptr + FiCol int32 + FiInst int32 + FnInst int32 + FiStart int32 + FiEnd int32 +} + +type CInstIter = TCInstIter + +type TCInstIter1 = struct { + FpApi uintptr + FpFts uintptr + FiCol int32 + FiInst int32 + FnInst int32 + FiStart int32 + FiEnd int32 +} + +type CInstIter1 = TCInstIter1 + +// C documentation +// +// /* +// ** Advance the iterator to the next coalesced phrase instance. Return +// ** an SQLite error code if an error occurs, or SQLITE_OK otherwise. +// */ +func _fts5CInstIterNext(tls *libc.TLS, pIter uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iEnd, rc int32 + var _ /* ic at bp+4 */ int32 + var _ /* io at bp+8 */ int32 + var _ /* ip at bp+0 */ int32 + _, _ = iEnd, rc + rc = SQLITE_OK + (*TCInstIter)(unsafe.Pointer(pIter)).FiStart = -int32(1) + (*TCInstIter)(unsafe.Pointer(pIter)).FiEnd = -int32(1) + for rc == SQLITE_OK && (*TCInstIter)(unsafe.Pointer(pIter)).FiInst < (*TCInstIter)(unsafe.Pointer(pIter)).FnInst { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer((*TCInstIter)(unsafe.Pointer(pIter)).FpApi)).FxInst})))(tls, (*TCInstIter)(unsafe.Pointer(pIter)).FpFts, (*TCInstIter)(unsafe.Pointer(pIter)).FiInst, bp, bp+4, bp+8) + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 4)) == (*TCInstIter)(unsafe.Pointer(pIter)).FiCol { + iEnd = *(*int32)(unsafe.Pointer(bp + 8)) - int32(1) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer((*TCInstIter)(unsafe.Pointer(pIter)).FpApi)).FxPhraseSize})))(tls, (*TCInstIter)(unsafe.Pointer(pIter)).FpFts, *(*int32)(unsafe.Pointer(bp))) + if (*TCInstIter)(unsafe.Pointer(pIter)).FiStart < 0 { + (*TCInstIter)(unsafe.Pointer(pIter)).FiStart = *(*int32)(unsafe.Pointer(bp + 8)) + (*TCInstIter)(unsafe.Pointer(pIter)).FiEnd = iEnd + } else { + if *(*int32)(unsafe.Pointer(bp + 8)) <= (*TCInstIter)(unsafe.Pointer(pIter)).FiEnd { + if iEnd > (*TCInstIter)(unsafe.Pointer(pIter)).FiEnd { + (*TCInstIter)(unsafe.Pointer(pIter)).FiEnd = iEnd + } + } else { + break + } + } + } + (*TCInstIter)(unsafe.Pointer(pIter)).FiInst++ + } + } + return rc +} + +// C documentation +// +// /* +// ** Initialize the iterator object indicated by the final parameter to +// ** iterate through coalesced phrase instances in column iCol. +// */ +func _fts5CInstIterInit(tls *libc.TLS, pApi uintptr, pFts uintptr, iCol int32, pIter uintptr) (r int32) { + var rc int32 + _ = rc + libc.Xmemset(tls, pIter, 0, uint64(40)) + (*TCInstIter)(unsafe.Pointer(pIter)).FpApi = pApi + (*TCInstIter)(unsafe.Pointer(pIter)).FpFts = pFts + (*TCInstIter)(unsafe.Pointer(pIter)).FiCol = iCol + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInstCount})))(tls, pFts, pIter+24) + if rc == SQLITE_OK { + rc = _fts5CInstIterNext(tls, pIter) + } + return rc +} + +// C documentation +// +// /************************************************************************* +// ** Start of highlight() implementation. +// */ +type THighlightContext = struct { + FiRangeStart int32 + FiRangeEnd int32 + FzOpen uintptr + FzClose uintptr + FzIn uintptr + FnIn int32 + Fiter TCInstIter + FiPos int32 + FiOff int32 + FbOpen int32 + FzOut uintptr +} + +type HighlightContext = THighlightContext + +type THighlightContext1 = struct { + FiRangeStart int32 + FiRangeEnd int32 + FzOpen uintptr + FzClose uintptr + FzIn uintptr + FnIn int32 + Fiter TCInstIter + FiPos int32 + FiOff int32 + FbOpen int32 + FzOut uintptr +} + +type HighlightContext1 = THighlightContext1 + +// C documentation +// +// /* +// ** Append text to the HighlightContext output string - p->zOut. Argument +// ** z points to a buffer containing n bytes of text to append. If n is +// ** negative, everything up until the first '\0' is appended to the output. +// ** +// ** If *pRc is set to any value other than SQLITE_OK when this function is +// ** called, it is a no-op. If an error (i.e. an OOM condition) is encountered, +// ** *pRc is set to an error code before returning. +// */ +func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK && z != 0 { + if n < 0 { + n = int32(libc.Xstrlen(tls, z)) + } + (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+34813, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } +} + +// C documentation +// +// /* +// ** Tokenizer callback used by implementation of highlight() function. +// */ +func _fts5HighlightCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iStartOff int32, iEndOff int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPos, v1 int32 + var p, v2 uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _ = iPos, p, v1, v2 + p = pContext + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + _ = pToken + _ = nToken + if tflags&int32(FTS5_TOKEN_COLOCATED) != 0 { + return SQLITE_OK + } + v2 = p + 80 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + iPos = v1 + if (*THighlightContext)(unsafe.Pointer(p)).FiRangeEnd >= 0 { + if iPos < (*THighlightContext)(unsafe.Pointer(p)).FiRangeStart || iPos > (*THighlightContext)(unsafe.Pointer(p)).FiRangeEnd { + return SQLITE_OK + } + if (*THighlightContext)(unsafe.Pointer(p)).FiRangeStart != 0 && iPos == (*THighlightContext)(unsafe.Pointer(p)).FiRangeStart { + (*THighlightContext)(unsafe.Pointer(p)).FiOff = iStartOff + } + } + /* If the parenthesis is open, and this token is not part of the current + ** phrase, and the starting byte offset of this token is past the point + ** that has currently been copied into the output buffer, close the + ** parenthesis. */ + if (*THighlightContext)(unsafe.Pointer(p)).FbOpen != 0 && (iPos <= (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiStart || (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiStart < 0) && iStartOff > (*THighlightContext)(unsafe.Pointer(p)).FiOff { + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzClose, -int32(1)) + (*THighlightContext)(unsafe.Pointer(p)).FbOpen = 0 + } + /* If this is the start of a new phrase, and the highlight is not open: + ** + ** * copy text from the input up to the start of the phrase, and + ** * open the highlight. + */ + if iPos == (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiStart && (*THighlightContext)(unsafe.Pointer(p)).FbOpen == 0 { + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzIn+uintptr((*THighlightContext)(unsafe.Pointer(p)).FiOff), iStartOff-(*THighlightContext)(unsafe.Pointer(p)).FiOff) + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzOpen, -int32(1)) + (*THighlightContext)(unsafe.Pointer(p)).FiOff = iStartOff + (*THighlightContext)(unsafe.Pointer(p)).FbOpen = int32(1) + } + if iPos == (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiEnd { + if (*THighlightContext)(unsafe.Pointer(p)).FbOpen == 0 { + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzOpen, -int32(1)) + (*THighlightContext)(unsafe.Pointer(p)).FbOpen = int32(1) + } + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzIn+uintptr((*THighlightContext)(unsafe.Pointer(p)).FiOff), iEndOff-(*THighlightContext)(unsafe.Pointer(p)).FiOff) + (*THighlightContext)(unsafe.Pointer(p)).FiOff = iEndOff + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _fts5CInstIterNext(tls, p+40) + } + } + if iPos == (*THighlightContext)(unsafe.Pointer(p)).FiRangeEnd { + if (*THighlightContext)(unsafe.Pointer(p)).FbOpen != 0 { + if (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiStart >= 0 && iPos >= (*THighlightContext)(unsafe.Pointer(p)).Fiter.FiStart { + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzIn+uintptr((*THighlightContext)(unsafe.Pointer(p)).FiOff), iEndOff-(*THighlightContext)(unsafe.Pointer(p)).FiOff) + (*THighlightContext)(unsafe.Pointer(p)).FiOff = iEndOff + } + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzClose, -int32(1)) + (*THighlightContext)(unsafe.Pointer(p)).FbOpen = 0 + } + _fts5HighlightAppend(tls, bp, p, (*THighlightContext)(unsafe.Pointer(p)).FzIn+uintptr((*THighlightContext)(unsafe.Pointer(p)).FiOff), iEndOff-(*THighlightContext)(unsafe.Pointer(p)).FiOff) + (*THighlightContext)(unsafe.Pointer(p)).FiOff = iEndOff + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Implementation of highlight() function. +// */ +func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { + bp := tls.Alloc(112) + defer tls.Free(112) + var iCol int32 + var zErr uintptr + var _ /* ctx at bp+0 */ THighlightContext + var _ /* rc at bp+104 */ int32 + _, _ = iCol, zErr + if nVal != int32(3) { + zErr = __ccgo_ts + 34820 + Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) + return + } + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) + libc.Xmemset(tls, bp, 0, uint64(104)) + (*(*THighlightContext)(unsafe.Pointer(bp))).FzOpen = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + (*(*THighlightContext)(unsafe.Pointer(bp))).FzClose = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*8))) + (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeEnd = -int32(1) + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, iCol, bp+24, bp+32) + if *(*int32)(unsafe.Pointer(bp + 104)) == int32(SQLITE_RANGE) { + Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1680, -int32(1), libc.UintptrFromInt32(0)) + *(*int32)(unsafe.Pointer(bp + 104)) = SQLITE_OK + } else { + if (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn != 0 { + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = _fts5CInstIterInit(tls, pApi, pFts, iCol, bp+40) + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize})))(tls, pFts, (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn, (*(*THighlightContext)(unsafe.Pointer(bp))).FnIn, bp, __ccgo_fp(_fts5HighlightCb)) + } + if (*(*THighlightContext)(unsafe.Pointer(bp))).FbOpen != 0 { + _fts5HighlightAppend(tls, bp+104, bp, (*(*THighlightContext)(unsafe.Pointer(bp))).FzClose, -int32(1)) + } + _fts5HighlightAppend(tls, bp+104, bp, (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn+uintptr((*(*THighlightContext)(unsafe.Pointer(bp))).FiOff), (*(*THighlightContext)(unsafe.Pointer(bp))).FnIn-(*(*THighlightContext)(unsafe.Pointer(bp))).FiOff) + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + Xsqlite3_result_text(tls, pCtx, (*(*THighlightContext)(unsafe.Pointer(bp))).FzOut, -int32(1), uintptr(-libc.Int32FromInt32(1))) + } + Xsqlite3_free(tls, (*(*THighlightContext)(unsafe.Pointer(bp))).FzOut) + } + } + if *(*int32)(unsafe.Pointer(bp + 104)) != SQLITE_OK { + Xsqlite3_result_error_code(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 104))) + } +} + +/* +** End of highlight() implementation. +**************************************************************************/ + +// C documentation +// +// /* +// ** Context object passed to the fts5SentenceFinderCb() function. +// */ +type TFts5SFinder = struct { + FiPos int32 + FnFirstAlloc int32 + FnFirst int32 + FaFirst uintptr + FzDoc uintptr +} + +type Fts5SFinder = TFts5SFinder + +type TFts5SFinder1 = struct { + FiPos int32 + FnFirstAlloc int32 + FnFirst int32 + FaFirst uintptr + FzDoc uintptr +} + +type Fts5SFinder1 = TFts5SFinder1 + +// C documentation +// +// /* +// ** Add an entry to the Fts5SFinder.aFirst[] array. Grow the array if +// ** necessary. Return SQLITE_OK if successful, or SQLITE_NOMEM if an +// ** error occurs. +// */ +func _fts5SentenceFinderAdd(tls *libc.TLS, p uintptr, iAdd int32) (r int32) { + var aNew, v3 uintptr + var nNew, v1, v2 int32 + _, _, _, _, _ = aNew, nNew, v1, v2, v3 + if (*TFts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc == (*TFts5SFinder)(unsafe.Pointer(p)).FnFirst { + if (*TFts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc != 0 { + v1 = (*TFts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc * int32(2) + } else { + v1 = int32(64) + } + nNew = v1 + aNew = Xsqlite3_realloc64(tls, (*TFts5SFinder)(unsafe.Pointer(p)).FaFirst, uint64(nNew)*uint64(4)) + if aNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TFts5SFinder)(unsafe.Pointer(p)).FaFirst = aNew + (*TFts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc = nNew + } + v3 = p + 8 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*int32)(unsafe.Pointer((*TFts5SFinder)(unsafe.Pointer(p)).FaFirst + uintptr(v2)*4)) = iAdd + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function is an xTokenize() callback used by the auxiliary snippet() +// ** function. Its job is to identify tokens that are the first in a sentence. +// ** For each such token, an entry is added to the SFinder.aFirst[] array. +// */ +func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iStartOff int32, iEndOff int32) (r int32) { + var c int8 + var i, rc int32 + var p uintptr + _, _, _, _ = c, i, p, rc + rc = SQLITE_OK + _ = pToken + _ = nToken + _ = iEndOff + if tflags&int32(FTS5_TOKEN_COLOCATED) == 0 { + p = pContext + if (*TFts5SFinder)(unsafe.Pointer(p)).FiPos > 0 { + c = 0 + i = iStartOff - int32(1) + for { + if !(i >= 0) { + break + } + c = *(*int8)(unsafe.Pointer((*TFts5SFinder)(unsafe.Pointer(p)).FzDoc + uintptr(i))) + if int32(c) != int32(' ') && int32(c) != int32('\t') && int32(c) != int32('\n') && int32(c) != int32('\r') { + break + } + goto _1 + _1: + ; + i-- + } + if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(c) == int32(':')) { + rc = _fts5SentenceFinderAdd(tls, p, (*TFts5SFinder)(unsafe.Pointer(p)).FiPos) + } + } else { + rc = _fts5SentenceFinderAdd(tls, p, 0) + } + (*TFts5SFinder)(unsafe.Pointer(p)).FiPos++ + } + return rc +} + +func _fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32, aSeen uintptr, iCol int32, iPos int32, nToken int32, pnScore uintptr, piPos uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iFirst, iLast, nScore, rc, v2 int32 + var iAdj, iEnd Tsqlite3_int64 + var _ /* iOff at bp+8 */ int32 + var _ /* ic at bp+4 */ int32 + var _ /* ip at bp+0 */ int32 + var _ /* nInst at bp+12 */ int32 + _, _, _, _, _, _, _, _ = i, iAdj, iEnd, iFirst, iLast, nScore, rc, v2 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + iFirst = -int32(1) + nScore = 0 + iLast = 0 + iEnd = int64(iPos) + int64(nToken) + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInstCount})))(tls, pFts, bp+12) + i = 0 + for { + if !(i < *(*int32)(unsafe.Pointer(bp + 12)) && rc == SQLITE_OK) { + break + } + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInst})))(tls, pFts, i, bp, bp+4, bp+8) + if rc == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 4)) == iCol && *(*int32)(unsafe.Pointer(bp + 8)) >= iPos && int64(*(*int32)(unsafe.Pointer(bp + 8))) < iEnd { + if *(*uint8)(unsafe.Pointer(aSeen + uintptr(*(*int32)(unsafe.Pointer(bp))))) != 0 { + v2 = int32(1) + } else { + v2 = int32(1000) + } + nScore += v2 + *(*uint8)(unsafe.Pointer(aSeen + uintptr(*(*int32)(unsafe.Pointer(bp))))) = uint8(1) + if iFirst < 0 { + iFirst = *(*int32)(unsafe.Pointer(bp + 8)) + } + iLast = *(*int32)(unsafe.Pointer(bp + 8)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxPhraseSize})))(tls, pFts, *(*int32)(unsafe.Pointer(bp))) + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(pnScore)) = nScore + if piPos != 0 { + iAdj = int64(iFirst - (nToken-(iLast-iFirst))/int32(2)) + if iAdj+int64(nToken) > int64(nDocsize) { + iAdj = int64(nDocsize - nToken) + } + if iAdj < 0 { + iAdj = 0 + } + *(*int32)(unsafe.Pointer(piPos)) = int32(iAdj) + } + return rc +} + +// C documentation +// +// /* +// ** Return the value in pVal interpreted as utf-8 text. Except, if pVal +// ** contains a NULL value, return a pointer to a static string zero +// ** bytes in length instead of a NULL pointer. +// */ +func _fts5ValueToText(tls *libc.TLS, pVal uintptr) (r uintptr) { + var zRet, v1 uintptr + _, _ = zRet, v1 + zRet = Xsqlite3_value_text(tls, pVal) + if zRet != 0 { + v1 = zRet + } else { + v1 = __ccgo_ts + 1680 + } + return v1 +} + +// C documentation +// +// /* +// ** Implementation of snippet() function. +// */ +func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { + bp := tls.Alloc(192) + defer tls.Free(192) + var aSeen, zEllips, zErr uintptr + var i, iBestCol, iBestStart, iCol, ii, jj, nBestScore, nCol, nPhrase, nToken, v1, v5 int32 + var _ /* ctx at bp+0 */ THighlightContext + var _ /* iAdj at bp+172 */ int32 + var _ /* ic at bp+164 */ int32 + var _ /* io at bp+168 */ int32 + var _ /* ip at bp+160 */ int32 + var _ /* nColSize at bp+112 */ int32 + var _ /* nDoc at bp+152 */ int32 + var _ /* nDocsize at bp+156 */ int32 + var _ /* nInst at bp+108 */ int32 + var _ /* nScore at bp+176 */ int32 + var _ /* rc at bp+104 */ int32 + var _ /* sFinder at bp+120 */ TFts5SFinder + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aSeen, i, iBestCol, iBestStart, iCol, ii, jj, nBestScore, nCol, nPhrase, nToken, zEllips, zErr, v1, v5 + *(*int32)(unsafe.Pointer(bp + 104)) = SQLITE_OK /* 5th argument to snippet() */ + *(*int32)(unsafe.Pointer(bp + 108)) = 0 /* Column containing best snippet */ + iBestStart = 0 /* First token of best snippet */ + nBestScore = 0 /* Score of best snippet */ + *(*int32)(unsafe.Pointer(bp + 112)) = 0 + if nVal != int32(5) { + zErr = __ccgo_ts + 34870 + Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) + return + } + nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnCount})))(tls, pFts) + libc.Xmemset(tls, bp, 0, uint64(104)) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) + (*(*THighlightContext)(unsafe.Pointer(bp))).FzOpen = _fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + (*(*THighlightContext)(unsafe.Pointer(bp))).FzClose = _fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*8))) + (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeEnd = -int32(1) + zEllips = _fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 3*8))) + nToken = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal + 4*8))) + if iCol >= 0 { + v1 = iCol + } else { + v1 = 0 + } + iBestCol = v1 + nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxPhraseCount})))(tls, pFts) + aSeen = Xsqlite3_malloc(tls, nPhrase) + if aSeen == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 104)) = int32(SQLITE_NOMEM) + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInstCount})))(tls, pFts, bp+108) + } + libc.Xmemset(tls, bp+120, 0, uint64(32)) + i = 0 + for { + if !(i < nCol) { + break + } + if iCol < 0 || iCol == i { + (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FiPos = 0 + (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FnFirst = 0 + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, i, bp+120+24, bp+152) + if *(*int32)(unsafe.Pointer(bp + 104)) != SQLITE_OK { + break + } + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize})))(tls, pFts, (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FzDoc, *(*int32)(unsafe.Pointer(bp + 152)), bp+120, __ccgo_fp(_fts5SentenceFinderCb)) + if *(*int32)(unsafe.Pointer(bp + 104)) != SQLITE_OK { + break + } + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnSize})))(tls, pFts, i, bp+156) + if *(*int32)(unsafe.Pointer(bp + 104)) != SQLITE_OK { + break + } + ii = 0 + for { + if !(*(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK && ii < *(*int32)(unsafe.Pointer(bp + 108))) { + break + } + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInst})))(tls, pFts, ii, bp+160, bp+164, bp+168) + if *(*int32)(unsafe.Pointer(bp + 164)) != i { + goto _3 + } + if *(*int32)(unsafe.Pointer(bp + 168)) > *(*int32)(unsafe.Pointer(bp + 156)) { + *(*int32)(unsafe.Pointer(bp + 104)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< nBestScore { + nBestScore = *(*int32)(unsafe.Pointer(bp + 176)) + iBestCol = i + iBestStart = *(*int32)(unsafe.Pointer(bp + 172)) + *(*int32)(unsafe.Pointer(bp + 112)) = *(*int32)(unsafe.Pointer(bp + 156)) + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK && (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FnFirst != 0 && *(*int32)(unsafe.Pointer(bp + 156)) > nToken { + jj = 0 + for { + if !(jj < (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FnFirst-int32(1)) { + break + } + if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj+int32(1))*4)) > *(*int32)(unsafe.Pointer(bp + 168)) { + break + } + goto _4 + _4: + ; + jj++ + } + if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 168)) { + libc.Xmemset(tls, aSeen, 0, uint64(nPhrase)) + *(*int32)(unsafe.Pointer(bp + 104)) = _fts5SnippetScore(tls, pApi, pFts, *(*int32)(unsafe.Pointer(bp + 156)), aSeen, i, *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)), nToken, bp+176, uintptr(0)) + if *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) == 0 { + v5 = int32(120) + } else { + v5 = int32(100) + } + *(*int32)(unsafe.Pointer(bp + 176)) += v5 + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 176)) > nBestScore { + nBestScore = *(*int32)(unsafe.Pointer(bp + 176)) + iBestCol = i + iBestStart = *(*int32)(unsafe.Pointer((*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst + uintptr(jj)*4)) + *(*int32)(unsafe.Pointer(bp + 112)) = *(*int32)(unsafe.Pointer(bp + 156)) + } + } + } + goto _3 + _3: + ; + ii++ + } + } + goto _2 + _2: + ; + i++ + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, iBestCol, bp+24, bp+32) + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK && *(*int32)(unsafe.Pointer(bp + 112)) == 0 { + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnSize})))(tls, pFts, iBestCol, bp+112) + } + if (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn != 0 { + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = _fts5CInstIterInit(tls, pApi, pFts, iBestCol, bp+40) + } + (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeStart = iBestStart + (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeEnd = iBestStart + nToken - int32(1) + if iBestStart > 0 { + _fts5HighlightAppend(tls, bp+104, bp, zEllips, -int32(1)) + } + /* Advance iterator ctx.iter so that it points to the first coalesced + ** phrase instance at or following position iBestStart. */ + for (*(*THighlightContext)(unsafe.Pointer(bp))).Fiter.FiStart >= 0 && (*(*THighlightContext)(unsafe.Pointer(bp))).Fiter.FiStart < iBestStart && *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = _fts5CInstIterNext(tls, bp+40) + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 104)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize})))(tls, pFts, (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn, (*(*THighlightContext)(unsafe.Pointer(bp))).FnIn, bp, __ccgo_fp(_fts5HighlightCb)) + } + if (*(*THighlightContext)(unsafe.Pointer(bp))).FbOpen != 0 { + _fts5HighlightAppend(tls, bp+104, bp, (*(*THighlightContext)(unsafe.Pointer(bp))).FzClose, -int32(1)) + } + if (*(*THighlightContext)(unsafe.Pointer(bp))).FiRangeEnd >= *(*int32)(unsafe.Pointer(bp + 112))-int32(1) { + _fts5HighlightAppend(tls, bp+104, bp, (*(*THighlightContext)(unsafe.Pointer(bp))).FzIn+uintptr((*(*THighlightContext)(unsafe.Pointer(bp))).FiOff), (*(*THighlightContext)(unsafe.Pointer(bp))).FnIn-(*(*THighlightContext)(unsafe.Pointer(bp))).FiOff) + } else { + _fts5HighlightAppend(tls, bp+104, bp, zEllips, -int32(1)) + } + } + if *(*int32)(unsafe.Pointer(bp + 104)) == SQLITE_OK { + Xsqlite3_result_text(tls, pCtx, (*(*THighlightContext)(unsafe.Pointer(bp))).FzOut, -int32(1), uintptr(-libc.Int32FromInt32(1))) + } else { + Xsqlite3_result_error_code(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 104))) + } + Xsqlite3_free(tls, (*(*THighlightContext)(unsafe.Pointer(bp))).FzOut) + Xsqlite3_free(tls, aSeen) + Xsqlite3_free(tls, (*(*TFts5SFinder)(unsafe.Pointer(bp + 120))).FaFirst) +} + +/************************************************************************/ + +// C documentation +// +// /* +// ** The first time the bm25() function is called for a query, an instance +// ** of the following structure is allocated and populated. +// */ +type TFts5Bm25Data = struct { + FnPhrase int32 + Favgdl float64 + FaIDF uintptr + FaFreq uintptr +} + +type Fts5Bm25Data = TFts5Bm25Data + +type TFts5Bm25Data1 = struct { + FnPhrase int32 + Favgdl float64 + FaIDF uintptr + FaFreq uintptr +} + +type Fts5Bm25Data1 = TFts5Bm25Data1 + +// C documentation +// +// /* +// ** Callback used by fts5Bm25GetData() to count the number of rows in the +// ** table matched by each individual phrase within the query. +// */ +func _fts5CountCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pUserData uintptr) (r int32) { + var pn uintptr + _ = pn + pn = pUserData + _ = pApi + _ = pFts + *(*Tsqlite3_int64)(unsafe.Pointer(pn))++ + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Set *ppData to point to the Fts5Bm25Data object for the current query. +// ** If the object has not already been allocated, allocate and populate it +// ** now. +// */ +func _fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, nPhrase, rc int32 + var idf float64 + var nByte Tsqlite3_int64 + var p uintptr + var _ /* nHit at bp+16 */ Tsqlite3_int64 + var _ /* nRow at bp+0 */ Tsqlite3_int64 + var _ /* nToken at bp+8 */ Tsqlite3_int64 + _, _, _, _, _, _ = i, idf, nByte, nPhrase, p, rc + rc = SQLITE_OK /* Object to return */ + p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxGetAuxdata})))(tls, pFts, 0) + if p == uintptr(0) { /* Number of phrases in query */ + *(*Tsqlite3_int64)(unsafe.Pointer(bp)) = 0 /* Number of rows in table */ + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 8)) = 0 + /* Allocate the Fts5Bm25Data object */ + nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxPhraseCount})))(tls, pFts) + nByte = int64(uint64(32) + uint64(nPhrase*int32(2))*uint64(8)) + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if p == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, p, 0, uint64(nByte)) + (*TFts5Bm25Data)(unsafe.Pointer(p)).FnPhrase = nPhrase + (*TFts5Bm25Data)(unsafe.Pointer(p)).FaIDF = p + 1*32 + (*TFts5Bm25Data)(unsafe.Pointer(p)).FaFreq = (*TFts5Bm25Data)(unsafe.Pointer(p)).FaIDF + uintptr(nPhrase)*8 + } + /* Calculate the average document length for this FTS5 table */ + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxRowCount})))(tls, pFts, bp) + } + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnTotalSize})))(tls, pFts, -int32(1), bp+8) + } + if rc == SQLITE_OK { + (*TFts5Bm25Data)(unsafe.Pointer(p)).Favgdl = float64(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 8))) / float64(*(*Tsqlite3_int64)(unsafe.Pointer(bp))) + } + /* Calculate an IDF for each phrase in the query */ + i = 0 + for { + if !(rc == SQLITE_OK && i < nPhrase) { + break + } + *(*Tsqlite3_int64)(unsafe.Pointer(bp + 16)) = 0 + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxQueryPhrase})))(tls, pFts, i, bp+16, __ccgo_fp(_fts5CountCb)) + if rc == SQLITE_OK { + /* Calculate the IDF (Inverse Document Frequency) for phrase i. + ** This is done using the standard BM25 formula as found on wikipedia: + ** + ** IDF = log( (N - nHit + 0.5) / (nHit + 0.5) ) + ** + ** where "N" is the total number of documents in the set and nHit + ** is the number that contain at least one instance of the phrase + ** under consideration. + ** + ** The problem with this is that if (N < 2*nHit), the IDF is + ** negative. Which is undesirable. So the mimimum allowable IDF is + ** (1e-6) - roughly the same as a term that appears in just over + ** half of set of 5,000,000 documents. */ + idf = libc.Xlog(tls, (float64(*(*Tsqlite3_int64)(unsafe.Pointer(bp))-*(*Tsqlite3_int64)(unsafe.Pointer(bp + 16)))+float64(0.5))/(float64(*(*Tsqlite3_int64)(unsafe.Pointer(bp + 16)))+float64(0.5))) + if idf <= float64(0) { + idf = float64(1e-06) + } + *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(p)).FaIDF + uintptr(i)*8)) = idf + } + goto _1 + _1: + ; + i++ + } + if rc != SQLITE_OK { + Xsqlite3_free(tls, p) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxSetAuxdata})))(tls, pFts, p, __ccgo_fp(Xsqlite3_free)) + } + if rc != SQLITE_OK { + p = uintptr(0) + } + } + *(*uintptr)(unsafe.Pointer(ppData)) = p + return rc +} + +// C documentation +// +// /* +// ** Implementation of bm25() function. +// */ +func _fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var D, b, k1, score, w, v2 float64 + var aFreq uintptr + var i, rc int32 + var _ /* ic at bp+16 */ int32 + var _ /* io at bp+20 */ int32 + var _ /* ip at bp+12 */ int32 + var _ /* nInst at bp+8 */ int32 + var _ /* nTok at bp+24 */ int32 + var _ /* pData at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = D, aFreq, b, i, k1, rc, score, w, v2 + k1 = float64(1.2) /* Constant "k1" from BM25 formula */ + b = float64(0.75) /* Error code */ + score = float64(0) /* Iterator variable */ + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* Value returned by xInstCount() */ + D = float64(0) /* Total number of tokens in row */ + aFreq = uintptr(0) /* Array of phrase freq. for current row */ + /* Calculate the phrase frequency (symbol "f(qi,D)" in the documentation) + ** for each phrase in the query for the current row. */ + rc = _fts5Bm25GetData(tls, pApi, pFts, bp) + if rc == SQLITE_OK { + aFreq = (*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFreq + libc.Xmemset(tls, aFreq, 0, uint64(8)*uint64((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnPhrase)) + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInstCount})))(tls, pFts, bp+8) + } + i = 0 + for { + if !(rc == SQLITE_OK && i < *(*int32)(unsafe.Pointer(bp + 8))) { + break + } + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInst})))(tls, pFts, i, bp+12, bp+16, bp+20) + if rc == SQLITE_OK { + if nVal > *(*int32)(unsafe.Pointer(bp + 16)) { + v2 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 16)))*8))) + } else { + v2 = float64(1) + } + w = v2 + *(*float64)(unsafe.Pointer(aFreq + uintptr(*(*int32)(unsafe.Pointer(bp + 12)))*8)) += w + } + goto _1 + _1: + ; + i++ + } + /* Figure out the total size of the current row in tokens. */ + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnSize})))(tls, pFts, -int32(1), bp+24) + D = float64(*(*int32)(unsafe.Pointer(bp + 24))) + } + /* Determine and return the BM25 score for the current row. Or, if an + ** error has occurred, throw an exception. */ + if rc == SQLITE_OK { + i = 0 + for { + if !(i < (*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnPhrase) { + break + } + score += *(*float64)(unsafe.Pointer((*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaIDF + uintptr(i)*8)) * (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + libc.Float64FromFloat64(1)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + k1*(libc.Float64FromInt32(1)-b+b*D/(*TFts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Favgdl))) + goto _3 + _3: + ; + i++ + } + Xsqlite3_result_double(tls, pCtx, -libc.Float64FromFloat64(1)*score) + } else { + Xsqlite3_result_error_code(tls, pCtx, rc) + } +} + +func _sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) (r int32) { + var aBuiltin [3]struct { + FzFunc uintptr + FpUserData uintptr + FxFunc Tfts5_extension_function + FxDestroy uintptr + } + var i, rc int32 + _, _, _ = aBuiltin, i, rc + aBuiltin = [3]struct { + FzFunc uintptr + FpUserData uintptr + FxFunc Tfts5_extension_function + FxDestroy uintptr + }{ + 0: { + FzFunc: __ccgo_ts + 34918, + FxFunc: __ccgo_fp(_fts5SnippetFunction), + }, + 1: { + FzFunc: __ccgo_ts + 34926, + FxFunc: __ccgo_fp(_fts5HighlightFunction), + }, + 2: { + FzFunc: __ccgo_ts + 34936, + FxFunc: __ccgo_fp(_fts5Bm25Function), + }, + } + rc = SQLITE_OK /* To iterate through builtin functions */ + i = 0 + for { + if !(rc == SQLITE_OK && i < int32(libc.Uint64FromInt64(96)/libc.Uint64FromInt64(32))) { + break + } + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tfts5_extension_function, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxCreateFunction})))(tls, pApi, aBuiltin[i].FzFunc, aBuiltin[i].FpUserData, aBuiltin[i].FxFunc, aBuiltin[i].FxDestroy) + goto _1 + _1: + ; + i++ + } + return rc +} + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** + */ + +/* #include "fts5Int.h" */ + +func _sqlite3Fts5BufferSize(tls *libc.TLS, pRc uintptr, pBuf uintptr, nByte Tu32) (r int32) { + var nNew Tu64 + var pNew uintptr + var v1 int32 + _, _, _ = nNew, pNew, v1 + if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) < nByte { + if (*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace != 0 { + v1 = (*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace + } else { + v1 = int32(64) + } + nNew = uint64(v1) + for nNew < uint64(nByte) { + nNew = nNew * uint64(2) + } + pNew = Xsqlite3_realloc64(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp, nNew) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + return int32(1) + } else { + (*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace = int32(nNew) + (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp = pNew + } + } + return 0 +} + +// C documentation +// +// /* +// ** Encode value iVal as an SQLite varint and append it to the buffer object +// ** pBuf. If an OOM error occurs, set the error code in p. +// */ +func _sqlite3Fts5BufferAppendVarint(tls *libc.TLS, pRc uintptr, pBuf uintptr, iVal Ti64) { + var v1 int32 + _ = v1 + if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)+uint32(libc.Int32FromInt32(9)) <= uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) { + v1 = 0 + } else { + v1 = _sqlite3Fts5BufferSize(tls, pRc, pBuf, uint32(int32(9)+(*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + } + if v1 != 0 { + return + } + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(iVal)) +} + +func _sqlite3Fts5Put32(tls *libc.TLS, aBuf uintptr, iVal int32) { + *(*Tu8)(unsafe.Pointer(aBuf)) = uint8(iVal >> int32(24) & int32(0x00FF)) + *(*Tu8)(unsafe.Pointer(aBuf + 1)) = uint8(iVal >> int32(16) & int32(0x00FF)) + *(*Tu8)(unsafe.Pointer(aBuf + 2)) = uint8(iVal >> int32(8) & int32(0x00FF)) + *(*Tu8)(unsafe.Pointer(aBuf + 3)) = uint8(iVal >> 0 & int32(0x00FF)) +} + +func _sqlite3Fts5Get32(tls *libc.TLS, aBuf uintptr) (r int32) { + return int32(uint32(*(*Tu8)(unsafe.Pointer(aBuf)))<n count. +// */ +func _sqlite3Fts5BufferAppendString(tls *libc.TLS, pRc uintptr, pBuf uintptr, zStr uintptr) { + var nStr int32 + _ = nStr + nStr = int32(libc.Xstrlen(tls, zStr)) + _sqlite3Fts5BufferAppendBlob(tls, pRc, pBuf, uint32(nStr+int32(1)), zStr) + (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn-- +} + +// C documentation +// +// /* +// ** Argument zFmt is a printf() style format string. This function performs +// ** the printf() style processing, then appends the results to buffer pBuf. +// ** +// ** Like sqlite3Fts5BufferAppendString(), this function ensures that the byte +// ** following the buffer data is set to 0x00, even though this byte is not +// ** included in the pBuf->n count. +// */ +func _sqlite3Fts5BufferAppendPrintf(tls *libc.TLS, pRc uintptr, pBuf uintptr, zFmt uintptr, va uintptr) { + var ap Tva_list + var zTmp uintptr + _, _ = ap, zTmp + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + ap = va + zTmp = Xsqlite3_vmprintf(tls, zFmt, ap) + _ = ap + if zTmp == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } else { + _sqlite3Fts5BufferAppendString(tls, pRc, pBuf, zTmp) + Xsqlite3_free(tls, zTmp) + } + } +} + +func _sqlite3Fts5Mprintf(tls *libc.TLS, pRc uintptr, zFmt uintptr, va uintptr) (r uintptr) { + var ap Tva_list + var zRet uintptr + _, _ = ap, zRet + zRet = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + ap = va + zRet = Xsqlite3_vmprintf(tls, zFmt, ap) + _ = ap + if zRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } + return zRet +} + +// C documentation +// +// /* +// ** Free any buffer allocated by pBuf. Zero the structure before returning. +// */ +func _sqlite3Fts5BufferFree(tls *libc.TLS, pBuf uintptr) { + Xsqlite3_free(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp) + libc.Xmemset(tls, pBuf, 0, uint64(16)) +} + +// C documentation +// +// /* +// ** Zero the contents of the buffer object. But do not free the associated +// ** memory allocation. +// */ +func _sqlite3Fts5BufferZero(tls *libc.TLS, pBuf uintptr) { + (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 +} + +// C documentation +// +// /* +// ** Set the buffer to contain nData/pData. If an OOM error occurs, leave an +// ** the error code in p. If an error has already occurred when this function +// ** is called, it is a no-op. +// */ +func _sqlite3Fts5BufferSet(tls *libc.TLS, pRc uintptr, pBuf uintptr, nData int32, pData uintptr) { + (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 + _sqlite3Fts5BufferAppendBlob(tls, pRc, pBuf, uint32(nData), pData) +} + +func _sqlite3Fts5PoslistNext64(tls *libc.TLS, a uintptr, n int32, pi uintptr, piOff uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, v1, v2, v3 int32 + var iOff Ti64 + var _ /* iVal at bp+0 */ Tu32 + _, _, _, _, _ = i, iOff, v1, v2, v3 + i = *(*int32)(unsafe.Pointer(pi)) + if i >= n { + /* EOF */ + *(*Ti64)(unsafe.Pointer(piOff)) = int64(-int32(1)) + return int32(1) + } else { + iOff = *(*Ti64)(unsafe.Pointer(piOff)) + v1 = i + i++ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(v1)))) + if *(*Tu32)(unsafe.Pointer(bp))&uint32(0x80) != 0 { + i-- + i += _sqlite3Fts5GetVarint32(tls, a+uintptr(i), bp) + } + if *(*Tu32)(unsafe.Pointer(bp)) <= uint32(1) { + if *(*Tu32)(unsafe.Pointer(bp)) == uint32(0) { + *(*int32)(unsafe.Pointer(pi)) = i + return 0 + } + v2 = i + i++ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(v2)))) + if *(*Tu32)(unsafe.Pointer(bp))&uint32(0x80) != 0 { + i-- + i += _sqlite3Fts5GetVarint32(tls, a+uintptr(i), bp) + } + iOff = int64(*(*Tu32)(unsafe.Pointer(bp))) << int32(32) + v3 = i + i++ + *(*Tu32)(unsafe.Pointer(bp)) = uint32(*(*Tu8)(unsafe.Pointer(a + uintptr(v3)))) + if *(*Tu32)(unsafe.Pointer(bp))&uint32(0x80) != 0 { + i-- + i += _sqlite3Fts5GetVarint32(tls, a+uintptr(i), bp) + } + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(2) { + /* This is a corrupt record. So stop parsing it here. */ + *(*Ti64)(unsafe.Pointer(piOff)) = int64(-int32(1)) + return int32(1) + } + *(*Ti64)(unsafe.Pointer(piOff)) = iOff + int64((*(*Tu32)(unsafe.Pointer(bp))-libc.Uint32FromInt32(2))&libc.Uint32FromInt32(0x7FFFFFFF)) + } else { + *(*Ti64)(unsafe.Pointer(piOff)) = iOff&(libc.Int64FromInt32(0x7FFFFFFF)<= *(*Ti64)(unsafe.Pointer(piPrev)) { + if iPos&_colmask != *(*Ti64)(unsafe.Pointer(piPrev))&_colmask { + v2 = pBuf + 8 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(v1))) = uint8(1) + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(iPos>>libc.Int32FromInt32(32))) + *(*Ti64)(unsafe.Pointer(piPrev)) = iPos & _colmask + } + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(iPos-*(*Ti64)(unsafe.Pointer(piPrev))+int64(2))) + *(*Ti64)(unsafe.Pointer(piPrev)) = iPos + } +} + +var _colmask = int64(libc.Int32FromInt32(0x7FFFFFFF)) << libc.Int32FromInt32(32) + +func _sqlite3Fts5PoslistWriterAppend(tls *libc.TLS, pBuf uintptr, pWriter uintptr, iPos Ti64) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var v1 int32 + var _ /* rc at bp+0 */ int32 + _ = v1 + *(*int32)(unsafe.Pointer(bp)) = 0 /* Initialized only to suppress erroneous warning from Clang */ + if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)+uint32(libc.Int32FromInt32(5)+libc.Int32FromInt32(5)+libc.Int32FromInt32(5)) <= uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) { + v1 = 0 + } else { + v1 = _sqlite3Fts5BufferSize(tls, bp, pBuf, uint32(libc.Int32FromInt32(5)+libc.Int32FromInt32(5)+libc.Int32FromInt32(5)+(*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + } + if v1 != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + _sqlite3Fts5PoslistSafeAppend(tls, pBuf, pWriter, iPos) + return SQLITE_OK +} + +func _sqlite3Fts5MallocZero(tls *libc.TLS, pRc uintptr, nByte Tsqlite3_int64) (r uintptr) { + var pRet uintptr + _ = pRet + pRet = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + if nByte > 0 { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } else { + libc.Xmemset(tls, pRet, 0, uint64(nByte)) + } + } + return pRet +} + +// C documentation +// +// /* +// ** Return a nul-terminated copy of the string indicated by pIn. If nIn +// ** is non-negative, then it is the length of the string in bytes. Otherwise, +// ** the length of the string is determined using strlen(). +// ** +// ** It is the responsibility of the caller to eventually free the returned +// ** buffer using sqlite3_free(). If an OOM error occurs, NULL is returned. +// */ +func _sqlite3Fts5Strndup(tls *libc.TLS, pRc uintptr, pIn uintptr, nIn int32) (r uintptr) { + var zRet uintptr + _ = zRet + zRet = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + if nIn < 0 { + nIn = int32(libc.Xstrlen(tls, pIn)) + } + zRet = Xsqlite3_malloc(tls, nIn+int32(1)) + if zRet != 0 { + libc.Xmemcpy(tls, zRet, pIn, uint64(nIn)) + *(*int8)(unsafe.Pointer(zRet + uintptr(nIn))) = int8('\000') + } else { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } + } + return zRet +} + +// C documentation +// +// /* +// ** Return true if character 't' may be part of an FTS5 bareword, or false +// ** otherwise. Characters that may be part of barewords: +// ** +// ** * All non-ASCII characters, +// ** * The 52 upper and lower case ASCII characters, and +// ** * The 10 integer ASCII characters. +// ** * The underscore character "_" (0x5F). +// ** * The unicode "subsitute" character (0x1A). +// */ +func _sqlite3Fts5IsBareword(tls *libc.TLS, t int8) (r int32) { + var aBareword [128]Tu8 + _ = aBareword + aBareword = [128]Tu8{ + 26: uint8(1), + 48: uint8(1), + 49: uint8(1), + 50: uint8(1), + 51: uint8(1), + 52: uint8(1), + 53: uint8(1), + 54: uint8(1), + 55: uint8(1), + 56: uint8(1), + 57: uint8(1), + 65: uint8(1), + 66: uint8(1), + 67: uint8(1), + 68: uint8(1), + 69: uint8(1), + 70: uint8(1), + 71: uint8(1), + 72: uint8(1), + 73: uint8(1), + 74: uint8(1), + 75: uint8(1), + 76: uint8(1), + 77: uint8(1), + 78: uint8(1), + 79: uint8(1), + 80: uint8(1), + 81: uint8(1), + 82: uint8(1), + 83: uint8(1), + 84: uint8(1), + 85: uint8(1), + 86: uint8(1), + 87: uint8(1), + 88: uint8(1), + 89: uint8(1), + 90: uint8(1), + 95: uint8(1), + 97: uint8(1), + 98: uint8(1), + 99: uint8(1), + 100: uint8(1), + 101: uint8(1), + 102: uint8(1), + 103: uint8(1), + 104: uint8(1), + 105: uint8(1), + 106: uint8(1), + 107: uint8(1), + 108: uint8(1), + 109: uint8(1), + 110: uint8(1), + 111: uint8(1), + 112: uint8(1), + 113: uint8(1), + 114: uint8(1), + 115: uint8(1), + 116: uint8(1), + 117: uint8(1), + 118: uint8(1), + 119: uint8(1), + 120: uint8(1), + 121: uint8(1), + 122: uint8(1), + } + return libc.BoolInt32(int32(t)&int32(0x80) != 0 || aBareword[int32(t)] != 0) +} + +// C documentation +// +// /************************************************************************* +// */ +type TFts5TermsetEntry = struct { + FpTerm uintptr + FnTerm int32 + FiIdx int32 + FpNext uintptr +} + +type Fts5TermsetEntry = TFts5TermsetEntry + +type TFts5TermsetEntry1 = struct { + FpTerm uintptr + FnTerm int32 + FiIdx int32 + FpNext uintptr +} + +type Fts5TermsetEntry1 = TFts5TermsetEntry1 + +type TFts5Termset1 = struct { + FapHash [512]uintptr +} + +type Fts5Termset1 = TFts5Termset1 + +func _sqlite3Fts5TermsetNew(tls *libc.TLS, pp uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* rc at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(pp)) = _sqlite3Fts5MallocZero(tls, bp, int64(4096)) + return *(*int32)(unsafe.Pointer(bp)) +} + +func _sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, nTerm int32, pbPresent uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var hash Tu32 + var i int32 + var pEntry uintptr + var _ /* rc at bp+0 */ int32 + _, _, _ = hash, i, pEntry + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*int32)(unsafe.Pointer(pbPresent)) = 0 + if p != 0 { + hash = uint32(13) + /* Calculate a hash value for this term. This is the same hash checksum + ** used by the fts5_hash.c module. This is not important for correct + ** operation of the module, but is necessary to ensure that some tests + ** designed to produce hash table collisions really do work. */ + i = nTerm - int32(1) + for { + if !(i >= 0) { + break + } + hash = hash<= int32('0') && int32(a) <= int32('9')) +} + +func _fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) (r uintptr) { + var p uintptr + _ = p + p = pIn + switch int32(*(*int8)(unsafe.Pointer(p))) { + case int32('n'): + fallthrough + case int32('N'): + if Xsqlite3_strnicmp(tls, __ccgo_ts+1666, p, int32(4)) == 0 { + p = p + 4 + } else { + p = uintptr(0) + } + case int32('x'): + fallthrough + case int32('X'): + p++ + if int32(*(*int8)(unsafe.Pointer(p))) == int32('\'') { + p++ + for int32(*(*int8)(unsafe.Pointer(p))) >= int32('a') && int32(*(*int8)(unsafe.Pointer(p))) <= int32('f') || int32(*(*int8)(unsafe.Pointer(p))) >= int32('A') && int32(*(*int8)(unsafe.Pointer(p))) <= int32('F') || int32(*(*int8)(unsafe.Pointer(p))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(p))) <= int32('9') { + p++ + } + if int32(*(*int8)(unsafe.Pointer(p))) == int32('\'') && 0 == (int64(p)-int64(pIn))%int64(2) { + p++ + } else { + p = uintptr(0) + } + } else { + p = uintptr(0) + } + case int32('\''): + p++ + for p != 0 { + if int32(*(*int8)(unsafe.Pointer(p))) == int32('\'') { + p++ + if int32(*(*int8)(unsafe.Pointer(p))) != int32('\'') { + break + } + } + p++ + if int32(*(*int8)(unsafe.Pointer(p))) == 0 { + p = uintptr(0) + } + } + default: + /* maybe a number */ + if int32(*(*int8)(unsafe.Pointer(p))) == int32('+') || int32(*(*int8)(unsafe.Pointer(p))) == int32('-') { + p++ + } + for _fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + /* At this point, if the literal was an integer, the parse is + ** finished. Or, if it is a floating point value, it may continue + ** with either a decimal point or an 'E' character. */ + if int32(*(*int8)(unsafe.Pointer(p))) == int32('.') && _fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p + 1))) != 0 { + p += uintptr(2) + for _fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + } + if p == pIn { + p = uintptr(0) + } + break + } + return p +} + +// C documentation +// +// /* +// ** The first character of the string pointed to by argument z is guaranteed +// ** to be an open-quote character (see function fts5_isopenquote()). +// ** +// ** This function searches for the corresponding close-quote character within +// ** the string and, if found, dequotes the string in place and adds a new +// ** nul-terminator byte. +// ** +// ** If the close-quote is found, the value returned is the byte offset of +// ** the character immediately following it. Or, if the close-quote is not +// ** found, -1 is returned. If -1 is returned, the buffer is left in an +// ** undefined state. +// */ +func _fts5Dequote(tls *libc.TLS, z uintptr) (r int32) { + var iIn, iOut, v1, v2, v3 int32 + var q int8 + _, _, _, _, _, _ = iIn, iOut, q, v1, v2, v3 + iIn = int32(1) + iOut = 0 + q = *(*int8)(unsafe.Pointer(z)) + /* Set stack variable q to the close-quote character */ + if int32(q) == int32('[') { + q = int8(']') + } + for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn+int32(1))))) != int32(q) { + /* Character iIn was the close quote. */ + iIn++ + break + } else { + /* Character iIn and iIn+1 form an escaped quote character. Skip + ** the input cursor past both and copy a single quote character + ** to the output buffer. */ + iIn += int32(2) + v1 = iOut + iOut++ + *(*int8)(unsafe.Pointer(z + uintptr(v1))) = q + } + } else { + v2 = iOut + iOut++ + v3 = iIn + iIn++ + *(*int8)(unsafe.Pointer(z + uintptr(v2))) = *(*int8)(unsafe.Pointer(z + uintptr(v3))) + } + } + *(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8('\000') + return iIn +} + +// C documentation +// +// /* +// ** Convert an SQL-style quoted string into a normal string by removing +// ** the quote characters. The conversion is done in-place. If the +// ** input does not begin with a quote character, then this routine +// ** is a no-op. +// ** +// ** Examples: +// ** +// ** "abc" becomes abc +// ** 'xyz' becomes xyz +// ** [pqr] becomes pqr +// ** `mno` becomes mno +// */ +func _sqlite3Fts5Dequote(tls *libc.TLS, z uintptr) { + var quote int8 + _ = quote /* Quote character (if any ) */ + quote = *(*int8)(unsafe.Pointer(z)) + if int32(quote) == int32('[') || int32(quote) == int32('\'') || int32(quote) == int32('"') || int32(quote) == int32('`') { + _fts5Dequote(tls, z) + } +} + +type TFts5Enum1 = struct { + FzName uintptr + FeVal int32 +} + +type Fts5Enum1 = TFts5Enum1 + +type TFts5Enum = struct { + FzName uintptr + FeVal int32 +} + +type Fts5Enum = TFts5Enum + +func _fts5ConfigSetEnum(tls *libc.TLS, aEnum uintptr, zEnum uintptr, peVal uintptr) (r int32) { + var i, iVal, nEnum, v2 int32 + _, _, _, _ = i, iVal, nEnum, v2 + nEnum = int32(libc.Xstrlen(tls, zEnum)) + iVal = -int32(1) + i = 0 + for { + if !((*(*TFts5Enum)(unsafe.Pointer(aEnum + uintptr(i)*16))).FzName != 0) { + break + } + if Xsqlite3_strnicmp(tls, (*(*TFts5Enum)(unsafe.Pointer(aEnum + uintptr(i)*16))).FzName, zEnum, nEnum) == 0 { + if iVal >= 0 { + return int32(SQLITE_ERROR) + } + iVal = (*(*TFts5Enum)(unsafe.Pointer(aEnum + uintptr(i)*16))).FeVal + } + goto _1 + _1: + ; + i++ + } + *(*int32)(unsafe.Pointer(peVal)) = iVal + if iVal < 0 { + v2 = int32(SQLITE_ERROR) + } else { + v2 = SQLITE_OK + } + return v2 +} + +// C documentation +// +// /* +// ** Parse a "special" CREATE VIRTUAL TABLE directive and update +// ** configuration object pConfig as appropriate. +// ** +// ** If successful, object pConfig is updated and SQLITE_OK returned. If +// ** an error occurs, an SQLite error code is returned and an error message +// ** may be left in *pzErr. It is the responsibility of the caller to +// ** eventually free any such error message using sqlite3_free(). +// */ +func _fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCmd uintptr, zArg uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(96) + defer tls.Free(96) + var azArg, p, p1, p2, pDel, pSpace uintptr + var bFirst, nByte, nCmd, nPre, v2 int32 + var nArg Tsqlite3_int64 + var _ /* aDetail at bp+8 */ [4]TFts5Enum + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _ = azArg, bFirst, nArg, nByte, nCmd, nPre, p, p1, p2, pDel, pSpace, v2 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + nCmd = int32(libc.Xstrlen(tls, zCmd)) + if Xsqlite3_strnicmp(tls, __ccgo_ts+34941, zCmd, nCmd) == 0 { + nByte = int32(libc.Uint64FromInt64(4) * libc.Uint64FromInt32(FTS5_MAX_PREFIX_INDEXES)) + bFirst = int32(1) + if (*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix == uintptr(0) { + (*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix = _sqlite3Fts5MallocZero(tls, bp, int64(nByte)) + if *(*int32)(unsafe.Pointer(bp)) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + p = zArg + for int32(1) != 0 { + nPre = 0 + for int32(*(*int8)(unsafe.Pointer(p))) == int32(' ') { + p++ + } + if bFirst == 0 && int32(*(*int8)(unsafe.Pointer(p))) == int32(',') { + p++ + for int32(*(*int8)(unsafe.Pointer(p))) == int32(' ') { + p++ + } + } else { + if int32(*(*int8)(unsafe.Pointer(p))) == int32('\000') { + break + } + } + if int32(*(*int8)(unsafe.Pointer(p))) < int32('0') || int32(*(*int8)(unsafe.Pointer(p))) > int32('9') { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34948, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + break + } + if (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix == int32(FTS5_MAX_PREFIX_INDEXES) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+34979, libc.VaList(bp+80, int32(FTS5_MAX_PREFIX_INDEXES))) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + break + } + for int32(*(*int8)(unsafe.Pointer(p))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(p))) <= int32('9') && nPre < int32(1000) { + nPre = nPre*int32(10) + (int32(*(*int8)(unsafe.Pointer(p))) - int32('0')) + p++ + } + if nPre <= 0 || nPre >= int32(1000) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35012, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + break + } + *(*int32)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr((*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix)*4)) = nPre + (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix++ + bFirst = 0 + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35049, zCmd, nCmd) == 0 { + p1 = zArg + nArg = int64(libc.Xstrlen(tls, zArg) + uint64(1)) + azArg = _sqlite3Fts5MallocZero(tls, bp, int64(uint64(8)*uint64(nArg))) + pDel = _sqlite3Fts5MallocZero(tls, bp, nArg*int64(2)) + pSpace = pDel + if azArg != 0 && pSpace != 0 { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35058, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + nArg = 0 + for { + if !(p1 != 0 && *(*int8)(unsafe.Pointer(p1)) != 0) { + break + } + p2 = _fts5ConfigSkipWhitespace(tls, p1) + if int32(*(*int8)(unsafe.Pointer(p2))) == int32('\'') { + p1 = _fts5ConfigSkipLiteral(tls, p2) + } else { + p1 = _fts5ConfigSkipBareword(tls, p2) + } + if p1 != 0 { + libc.Xmemcpy(tls, pSpace, p2, uint64(int64(p1)-int64(p2))) + *(*uintptr)(unsafe.Pointer(azArg + uintptr(nArg)*8)) = pSpace + _sqlite3Fts5Dequote(tls, pSpace) + pSpace += uintptr(int64(p1) - int64(p2) + int64(1)) + p1 = _fts5ConfigSkipWhitespace(tls, p1) + } + goto _1 + _1: + ; + nArg++ + } + if p1 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35091, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) + } + } + } + Xsqlite3_free(tls, azArg) + Xsqlite3_free(tls, pDel) + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35125, zCmd, nCmd) == 0 { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35133, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + if *(*int8)(unsafe.Pointer(zArg)) != 0 { + (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_EXTERNAL) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35165, libc.VaList(bp+80, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent = int32(FTS5_CONTENT_NONE) + } + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35171, zCmd, nCmd) == 0 { + if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35190, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35233, zCmd, nCmd) == 0 { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35247, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, zArg, -int32(1)) + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35285, zCmd, nCmd) == 0 { + if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35296, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+5531, zCmd, nCmd) == 0 { + *(*[4]TFts5Enum)(unsafe.Pointer(bp + 8)) = [4]TFts5Enum{ + 0: { + FzName: __ccgo_ts + 8250, + FeVal: int32(FTS5_DETAIL_NONE), + }, + 1: { + FzName: __ccgo_ts + 17779, + }, + 2: { + FzName: __ccgo_ts + 35331, + FeVal: int32(FTS5_DETAIL_COLUMNS), + }, + 3: {}, + } + v2 = _fts5ConfigSetEnum(tls, bp+8, zArg, pConfig+96) + *(*int32)(unsafe.Pointer(bp)) = v2 + if v2 != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35339, 0) + } + return *(*int32)(unsafe.Pointer(bp)) + } + if Xsqlite3_strnicmp(tls, __ccgo_ts+35370, zCmd, nCmd) == 0 { + if int32(*(*int8)(unsafe.Pointer(zArg))) != int32('0') && int32(*(*int8)(unsafe.Pointer(zArg))) != int32('1') || int32(*(*int8)(unsafe.Pointer(zArg + 1))) != int32('\000') { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35380, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(zArg))) == int32('1')) + } + return *(*int32)(unsafe.Pointer(bp)) + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35414, libc.VaList(bp+80, nCmd, zCmd)) + return int32(SQLITE_ERROR) +} + +// C documentation +// +// /* +// ** Allocate an instance of the default tokenizer ("simple") at +// ** Fts5Config.pTokenizer. Return SQLITE_OK if successful, or an SQLite error +// ** code if an error occurs. +// */ +func _fts5ConfigDefaultTokenizer(tls *libc.TLS, pGlobal uintptr, pConfig uintptr) (r int32) { + return _sqlite3Fts5GetTokenizer(tls, pGlobal, uintptr(0), 0, pConfig, uintptr(0)) +} + +// C documentation +// +// /* +// ** Gobble up the first bareword or quoted word from the input buffer zIn. +// ** Return a pointer to the character immediately following the last in +// ** the gobbled word if successful, or a NULL pointer otherwise (failed +// ** to find close-quote character). +// ** +// ** Before returning, set pzOut to point to a new buffer containing a +// ** nul-terminated, dequoted copy of the gobbled word. If the word was +// ** quoted, *pbQuoted is also set to 1 before returning. +// ** +// ** If *pRc is other than SQLITE_OK when this function is called, it is +// ** a no-op (NULL is returned). Otherwise, if an OOM occurs within this +// ** function, *pRc is set to SQLITE_NOMEM before returning. *pRc is *not* +// ** set if a parse error (failed to find close quote) occurs. +// */ +func _fts5ConfigGobbleWord(tls *libc.TLS, pRc uintptr, zIn uintptr, pzOut uintptr, pbQuoted uintptr) (r uintptr) { + var ii int32 + var nIn Tsqlite3_int64 + var zOut, zRet uintptr + _, _, _, _ = ii, nIn, zOut, zRet + zRet = uintptr(0) + nIn = int64(libc.Xstrlen(tls, zIn)) + zOut = Xsqlite3_malloc64(tls, uint64(nIn+int64(1))) + *(*int32)(unsafe.Pointer(pbQuoted)) = 0 + *(*uintptr)(unsafe.Pointer(pzOut)) = uintptr(0) + if zOut == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = int32(SQLITE_NOMEM) + } else { + libc.Xmemcpy(tls, zOut, zIn, uint64(nIn+libc.Int64FromInt32(1))) + if _fts5_isopenquote(tls, *(*int8)(unsafe.Pointer(zOut))) != 0 { + ii = _fts5Dequote(tls, zOut) + zRet = zIn + uintptr(ii) + *(*int32)(unsafe.Pointer(pbQuoted)) = int32(1) + } else { + zRet = _fts5ConfigSkipBareword(tls, zIn) + if zRet != 0 { + *(*int8)(unsafe.Pointer(zOut + uintptr(int64(zRet)-int64(zIn)))) = int8('\000') + } + } + } + if zRet == uintptr(0) { + Xsqlite3_free(tls, zOut) + } else { + *(*uintptr)(unsafe.Pointer(pzOut)) = zOut + } + return zRet +} + +func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var rc, v1 int32 + var v2 uintptr + _, _, _ = rc, v1, v2 + rc = SQLITE_OK + if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+35442) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+16726) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35447, libc.VaList(bp+8, zCol)) + rc = int32(SQLITE_ERROR) + } else { + if zArg != 0 { + if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+35477) { + *(*Tu8)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35487, libc.VaList(bp+8, zArg)) + rc = int32(SQLITE_ERROR) + } + } + } + v2 = p + 24 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(v1)*8)) = zCol + return rc +} + +// C documentation +// +// /* +// ** Populate the Fts5Config.zContentExprlist string. +// */ +func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i int32 + var _ /* buf at bp+8 */ TFts5Buffer + var _ /* rc at bp+0 */ int32 + _ = i + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35518, libc.VaList(bp+32, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) + if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { + i = 0 + for { + if !(i < (*TFts5Config)(unsafe.Pointer(p)).FnCol) { + break + } + if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35523, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + } else { + _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+8, __ccgo_ts+35530, libc.VaList(bp+32, i)) + } + goto _1 + _1: + ; + i++ + } + } + (*TFts5Config)(unsafe.Pointer(p)).FzContentExprlist = (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Arguments nArg/azArg contain the string arguments passed to the xCreate +// ** or xConnect method of the virtual table. This function attempts to +// ** allocate an instance of Fts5Config containing the results of parsing +// ** those arguments. +// ** +// ** If successful, SQLITE_OK is returned and *ppOut is set to point to the +// ** new Fts5Config object. If an error occurs, an SQLite error code is +// ** returned, *ppOut is set to NULL and an error message may be left in +// ** *pzErr. It is the responsibility of the caller to eventually free any +// ** such error message using sqlite3_free(). +// */ +func _sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int32, azArg uintptr, ppOut uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var bOption, i int32 + var nByte Tsqlite3_int64 + var pRet, z, zOrig, zTail, v1, v2, v4, v5 uintptr + var _ /* bDummy at bp+28 */ int32 + var _ /* bMustBeCol at bp+24 */ int32 + var _ /* rc at bp+0 */ int32 + var _ /* zOne at bp+8 */ uintptr + var _ /* zTwo at bp+16 */ uintptr + _, _, _, _, _, _, _, _, _, _, _ = bOption, i, nByte, pRet, z, zOrig, zTail, v1, v2, v4, v5 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + v1 = Xsqlite3_malloc(tls, int32(200)) + pRet = v1 + *(*uintptr)(unsafe.Pointer(ppOut)) = v1 + if pRet == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pRet, 0, uint64(200)) + (*TFts5Config)(unsafe.Pointer(pRet)).Fdb = db + (*TFts5Config)(unsafe.Pointer(pRet)).FiCookie = -int32(1) + nByte = int64(uint64(nArg) * (libc.Uint64FromInt64(8) + libc.Uint64FromInt64(1))) + (*TFts5Config)(unsafe.Pointer(pRet)).FazCol = _sqlite3Fts5MallocZero(tls, bp, nByte) + if (*TFts5Config)(unsafe.Pointer(pRet)).FazCol != 0 { + v2 = (*TFts5Config)(unsafe.Pointer(pRet)).FazCol + uintptr(nArg)*8 + } else { + v2 = uintptr(0) + } + (*TFts5Config)(unsafe.Pointer(pRet)).FabUnindexed = v2 + (*TFts5Config)(unsafe.Pointer(pRet)).FzDb = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FzName = _sqlite3Fts5Strndup(tls, bp, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -int32(1)) + (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize = int32(1) + (*TFts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && Xsqlite3_stricmp(tls, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, __ccgo_ts+35442) == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35538, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzName)) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + i = int32(3) + for { + if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && i < nArg) { + break + } + zOrig = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + bOption = 0 + *(*int32)(unsafe.Pointer(bp + 24)) = 0 + z = _fts5ConfigGobbleWord(tls, bp, zOrig, bp+8, bp+24) + z = _fts5ConfigSkipWhitespace(tls, z) + if z != 0 && int32(*(*int8)(unsafe.Pointer(z))) == int32('=') { + bOption = int32(1) + z++ + if *(*int32)(unsafe.Pointer(bp + 24)) != 0 { + z = uintptr(0) + } + } + z = _fts5ConfigSkipWhitespace(tls, z) + if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { + z = _fts5ConfigGobbleWord(tls, bp, z, bp+16, bp+28) + if z != 0 && *(*int8)(unsafe.Pointer(z)) != 0 { + z = uintptr(0) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if z == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35567, libc.VaList(bp+40, zOrig)) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + if bOption != 0 { + if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 { + v4 = *(*uintptr)(unsafe.Pointer(bp + 8)) + } else { + v4 = __ccgo_ts + 1680 + } + if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 { + v5 = *(*uintptr)(unsafe.Pointer(bp + 16)) + } else { + v5 = __ccgo_ts + 1680 + } + *(*int32)(unsafe.Pointer(bp)) = _fts5ConfigParseSpecial(tls, pGlobal, pRet, v4, v5, pzErr) + } else { + *(*int32)(unsafe.Pointer(bp)) = _fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp + 16)), pzErr) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + } + } + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + goto _3 + _3: + ; + i++ + } + /* We only allow contentless_delete=1 if the table is indeed contentless. */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FeContent != int32(FTS5_CONTENT_NONE) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35587, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + /* We only allow contentless_delete=1 if columnsize=0 is not present. + ** + ** This restriction may be removed at some point. + */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize == 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+35637, 0) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + /* If a tokenizer= option was successfully parsed, the tokenizer has + ** already been allocated. Otherwise, allocate an instance of the default + ** tokenizer (unicode61) now. */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FpTok == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = _fts5ConfigDefaultTokenizer(tls, pGlobal, pRet) + } + /* If no zContent option was specified, fill in the default values. */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0) { + zTail = uintptr(0) + if (*TFts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { + zTail = __ccgo_ts + 35125 + } else { + if (*TFts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { + zTail = __ccgo_ts + 35692 + } + } + if zTail != 0 { + (*TFts5Config)(unsafe.Pointer(pRet)).FzContent = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35700, libc.VaList(bp+40, (*TFts5Config)(unsafe.Pointer(pRet)).FzDb, (*TFts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0) { + (*TFts5Config)(unsafe.Pointer(pRet)).FzContentRowid = _sqlite3Fts5Strndup(tls, bp, __ccgo_ts+16726, -int32(1)) + } + /* Formulate the zContentExprlist text */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _fts5ConfigMakeExprlist(tls, pRet) + } + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + _sqlite3Fts5ConfigFree(tls, pRet) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Free the configuration object passed as the only argument. +// */ +func _sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { + var i int32 + _ = i + if pConfig != 0 { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_tokenizer)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi)).FxDelete})))(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok) + } + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName) + i = 0 + for { + if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { + break + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FazCol) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentRowid) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzContentExprlist) + Xsqlite3_free(tls, pConfig) + } +} + +// C documentation +// +// /* +// ** Call sqlite3_declare_vtab() based on the contents of the configuration +// ** object passed as the only argument. Return SQLITE_OK if successful, or +// ** an SQLite error code if an error occurs. +// */ +func _sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var i int32 + var zSep, zSql, v2 uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _ = i, zSep, zSql, v2 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35711, 0) + i = 0 + for { + if !(zSql != 0 && i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { + break + } + if i == 0 { + v2 = __ccgo_ts + 1680 + } else { + v2 = __ccgo_ts + 15022 + } + zSep = v2 + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35727, libc.VaList(bp+16, zSql, zSep, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + goto _1 + _1: + ; + i++ + } + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+35734, libc.VaList(bp+16, zSql, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, __ccgo_ts+35442)) + if zSql != 0 { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_declare_vtab(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) + Xsqlite3_free(tls, zSql) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Tokenize the text passed via the second and third arguments. +// ** +// ** The callback is invoked once for each token in the input text. The +// ** arguments passed to it are, in order: +// ** +// ** void *pCtx // Copy of 4th argument to sqlite3Fts5Tokenize() +// ** const char *pToken // Pointer to buffer containing token +// ** int nToken // Size of token in bytes +// ** int iStart // Byte offset of start of token within input text +// ** int iEnd // Byte offset of end of token within input text +// ** int iPos // Position of token in input (first token is 0) +// ** +// ** If the callback returns a non-zero value the tokenization is abandoned +// ** and no further callbacks are issued. +// ** +// ** This function returns SQLITE_OK if successful or an SQLite error code +// ** if an error occurs. If the tokenization was abandoned early because +// ** the callback returned SQLITE_DONE, this is not an error and this function +// ** still returns SQLITE_OK. Or, if the tokenization was abandoned early +// ** because the callback returned another non-zero value, it is assumed +// ** to be an SQLite error code and returned to the caller. +// */ +func _sqlite3Fts5Tokenize(tls *libc.TLS, pConfig uintptr, flags int32, pText uintptr, nText int32, pCtx uintptr, xToken uintptr) (r int32) { + if pText == uintptr(0) { + return SQLITE_OK + } + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_tokenizer)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpTokApi)).FxTokenize})))(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FpTok, pCtx, flags, pText, nText, xToken) +} + +// C documentation +// +// /* +// ** Argument pIn points to the first character in what is expected to be +// ** a comma-separated list of SQL literals followed by a ')' character. +// ** If it actually is this, return a pointer to the ')'. Otherwise, return +// ** NULL to indicate a parse error. +// */ +func _fts5ConfigSkipArgs(tls *libc.TLS, pIn uintptr) (r uintptr) { + var p uintptr + _ = p + p = pIn + for int32(1) != 0 { + p = _fts5ConfigSkipWhitespace(tls, p) + p = _fts5ConfigSkipLiteral(tls, p) + p = _fts5ConfigSkipWhitespace(tls, p) + if p == uintptr(0) || int32(*(*int8)(unsafe.Pointer(p))) == int32(')') { + break + } + if int32(*(*int8)(unsafe.Pointer(p))) != int32(',') { + p = uintptr(0) + break + } + p++ + } + return p +} + +// C documentation +// +// /* +// ** Parameter zIn contains a rank() function specification. The format of +// ** this is: +// ** +// ** + Bareword (function name) +// ** + Open parenthesis - "(" +// ** + Zero or more SQL literals in a comma separated list +// ** + Close parenthesis - ")" +// */ +func _sqlite3Fts5ConfigParseRank(tls *libc.TLS, zIn uintptr, pzRank uintptr, pzRankArgs uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p, pArgs, pRank, zRank, zRankArgs uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _, _ = p, pArgs, pRank, zRank, zRankArgs + p = zIn + zRank = uintptr(0) + zRankArgs = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(pzRank)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pzRankArgs)) = uintptr(0) + if p == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + p = _fts5ConfigSkipWhitespace(tls, p) + pRank = p + p = _fts5ConfigSkipBareword(tls, p) + if p != 0 { + zRank = _sqlite3Fts5MallocZero(tls, bp, int64(uintptr(1)+p)-int64(pRank)) + if zRank != 0 { + libc.Xmemcpy(tls, zRank, pRank, uint64(int64(p)-int64(pRank))) + } + } else { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + p = _fts5ConfigSkipWhitespace(tls, p) + if int32(*(*int8)(unsafe.Pointer(p))) != int32('(') { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + p++ + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + p = _fts5ConfigSkipWhitespace(tls, p) + pArgs = p + if int32(*(*int8)(unsafe.Pointer(p))) != int32(')') { + p = _fts5ConfigSkipArgs(tls, p) + if p == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } else { + zRankArgs = _sqlite3Fts5MallocZero(tls, bp, int64(uintptr(1)+p)-int64(pArgs)) + if zRankArgs != 0 { + libc.Xmemcpy(tls, zRankArgs, pArgs, uint64(int64(p)-int64(pArgs))) + } + } + } + } + } + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + Xsqlite3_free(tls, zRank) + } else { + *(*uintptr)(unsafe.Pointer(pzRank)) = zRank + *(*uintptr)(unsafe.Pointer(pzRankArgs)) = zRankArgs + } + return *(*int32)(unsafe.Pointer(bp)) +} + +func _sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVal uintptr, pbBadkey uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, v1 int32 + var zIn uintptr + var _ /* zRank at bp+0 */ uintptr + var _ /* zRankArgs at bp+8 */ uintptr + _, _, _, _, _, _, _, _, _, _ = bVal, nAutomerge, nCrisisMerge, nHashSize, nUsermerge, nVal, pgsz, rc, zIn, v1 + rc = SQLITE_OK + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35760) { + pgsz = 0 + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + pgsz = Xsqlite3_value_int(tls, pVal) + } + if pgsz < int32(32) || pgsz > libc.Int32FromInt32(64)*libc.Int32FromInt32(1024) { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35765) { + nHashSize = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + nHashSize = Xsqlite3_value_int(tls, pVal) + } + if nHashSize <= 0 { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35774) { + nAutomerge = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + nAutomerge = Xsqlite3_value_int(tls, pVal) + } + if nAutomerge < 0 || nAutomerge > int32(64) { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + if nAutomerge == int32(1) { + nAutomerge = int32(FTS5_DEFAULT_AUTOMERGE) + } + (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35784) { + nUsermerge = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + nUsermerge = Xsqlite3_value_int(tls, pVal) + } + if nUsermerge < int32(2) || nUsermerge > int32(16) { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35794) { + nCrisisMerge = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + nCrisisMerge = Xsqlite3_value_int(tls, pVal) + } + if nCrisisMerge < 0 { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + if nCrisisMerge <= int32(1) { + nCrisisMerge = int32(FTS5_DEFAULT_CRISISMERGE) + } + if nCrisisMerge >= int32(FTS5_MAX_SEGMENT) { + nCrisisMerge = libc.Int32FromInt32(FTS5_MAX_SEGMENT) - libc.Int32FromInt32(1) + } + (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35806) { + nVal = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + nVal = Xsqlite3_value_int(tls, pVal) + } else { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } + if nVal < 0 { + nVal = int32(FTS5_DEFAULT_DELETE_AUTOMERGE) + } + if nVal > int32(100) { + nVal = 0 + } + (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = nVal + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35442) { + zIn = Xsqlite3_value_text(tls, pVal) + rc = _sqlite3Fts5ConfigParseRank(tls, zIn, bp, bp+8) + if rc == SQLITE_OK { + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank) + Xsqlite3_free(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank = *(*uintptr)(unsafe.Pointer(bp)) + (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 8)) + } else { + if rc == int32(SQLITE_ERROR) { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } + } + } else { + if 0 == Xsqlite3_stricmp(tls, zKey, __ccgo_ts+35818) { + bVal = -int32(1) + if int32(SQLITE_INTEGER) == Xsqlite3_value_numeric_type(tls, pVal) { + bVal = Xsqlite3_value_int(tls, pVal) + } + if bVal < 0 { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } else { + if bVal != 0 { + v1 = int32(1) + } else { + v1 = 0 + } + (*TFts5Config)(unsafe.Pointer(pConfig)).FbSecureDelete = v1 + } + } else { + *(*int32)(unsafe.Pointer(pbBadkey)) = int32(1) + } + } + } + } + } + } + } + } + return rc +} + +// C documentation +// +// /* +// ** Load the contents of the %_config table into memory. +// */ +func _sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iVersion int32 + var pVal, zK, zSelect, zSql uintptr + var _ /* bDummy at bp+12 */ int32 + var _ /* p at bp+0 */ uintptr + var _ /* rc at bp+8 */ int32 + _, _, _, _, _ = iVersion, pVal, zK, zSelect, zSql + zSelect = __ccgo_ts + 35832 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = SQLITE_OK + iVersion = 0 + /* Set default values */ + (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz = int32(FTS5_DEFAULT_PAGE_SIZE) + (*TFts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = int32(FTS5_DEFAULT_AUTOMERGE) + (*TFts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = int32(FTS5_DEFAULT_USERMERGE) + (*TFts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = int32(FTS5_DEFAULT_CRISISMERGE) + (*TFts5Config)(unsafe.Pointer(pConfig)).FnHashSize = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) + (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge = int32(FTS5_DEFAULT_DELETE_AUTOMERGE) + zSql = _sqlite3Fts5Mprintf(tls, bp+8, zSelect, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + if zSql != 0 { + *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_prepare_v2(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), bp, uintptr(0)) + Xsqlite3_free(tls, zSql) + } + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + for int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp))) { + zK = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp)), 0) + pVal = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp)), int32(1)) + if 0 == Xsqlite3_stricmp(tls, zK, __ccgo_ts+35864) { + iVersion = Xsqlite3_value_int(tls, pVal) + } else { + *(*int32)(unsafe.Pointer(bp + 12)) = 0 + _sqlite3Fts5ConfigSetValue(tls, pConfig, zK, pVal, bp+12) + } + } + *(*int32)(unsafe.Pointer(bp + 8)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK && iVersion != int32(FTS5_CURRENT_VERSION) && iVersion != int32(FTS5_CURRENT_VERSION_SECUREDELETE) { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(SQLITE_ERROR) + if (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35872, libc.VaList(bp+24, iVersion, int32(FTS5_CURRENT_VERSION), int32(FTS5_CURRENT_VERSION_SECUREDELETE))) + } + } else { + (*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion = iVersion + } + if *(*int32)(unsafe.Pointer(bp + 8)) == SQLITE_OK { + (*TFts5Config)(unsafe.Pointer(pConfig)).FiCookie = iCookie + } + return *(*int32)(unsafe.Pointer(bp + 8)) +} + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** + */ + +/* #include "fts5Int.h" */ +/* #include "fts5parse.h" */ + +/* +** All token types in the generated fts5parse.h file are greater than 0. + */ + +type TFts5ExprTerm = struct { + FbPrefix Tu8 + FbFirst Tu8 + FpTerm uintptr + FnQueryTerm int32 + FnFullTerm int32 + FpIter uintptr + FpSynonym uintptr +} + +type Fts5ExprTerm = TFts5ExprTerm + +type TFts5Expr1 = struct { + FpIndex uintptr + FpConfig uintptr + FpRoot uintptr + FbDesc int32 + FnPhrase int32 + FapExprPhrase uintptr +} + +type Fts5Expr1 = TFts5Expr1 + +/* +** eType: +** Expression node type. Always one of: +** +** FTS5_AND (nChild, apChild valid) +** FTS5_OR (nChild, apChild valid) +** FTS5_NOT (nChild, apChild valid) +** FTS5_STRING (pNear valid) +** FTS5_TERM (pNear valid) +** +** iHeight: +** Distance from this node to furthest leaf. This is always 0 for nodes +** of type FTS5_STRING and FTS5_TERM. For all other nodes it is one +** greater than the largest child value. + */ +type TFts5ExprNode1 = struct { + FeType int32 + FbEof int32 + FbNomatch int32 + FiHeight int32 + FxNext uintptr + FiRowid Ti64 + FpNear uintptr + FnChild int32 + FapChild [1]uintptr +} + +type Fts5ExprNode1 = TFts5ExprNode1 + +/* +** Invoke the xNext method of an Fts5ExprNode object. This macro should be +** used as if it has the same signature as the xNext() methods themselves. + */ + +/* +** An instance of the following structure represents a single search term +** or term prefix. + */ +type TFts5ExprTerm1 = struct { + FbPrefix Tu8 + FbFirst Tu8 + FpTerm uintptr + FnQueryTerm int32 + FnFullTerm int32 + FpIter uintptr + FpSynonym uintptr +} + +type Fts5ExprTerm1 = TFts5ExprTerm1 + +/* +** A phrase. One or more terms that must appear in a contiguous sequence +** within a document for it to match. + */ +type TFts5ExprPhrase1 = struct { + FpNode uintptr + Fposlist TFts5Buffer + FnTerm int32 + FaTerm [1]TFts5ExprTerm +} + +type Fts5ExprPhrase1 = TFts5ExprPhrase1 + +/* +** One or more phrases that must appear within a certain token distance of +** each other within each matching document. + */ +type TFts5ExprNearset1 = struct { + FnNear int32 + FpColset uintptr + FnPhrase int32 + FapPhrase [1]uintptr +} + +type Fts5ExprNearset1 = TFts5ExprNearset1 + +/* +** Parse context. + */ +type TFts5Parse1 = struct { + FpConfig uintptr + FzErr uintptr + Frc int32 + FnPhrase int32 + FapPhrase uintptr + FpExpr uintptr + FbPhraseToAnd int32 +} + +type Fts5Parse1 = TFts5Parse1 + +/* +** Check that the Fts5ExprNode.iHeight variables are set correctly in +** the expression tree passed as the only argument. + */ + +func _sqlite3Fts5ParseError(tls *libc.TLS, pParse uintptr, zFmt uintptr, va uintptr) { + var ap Tva_list + _ = ap + ap = va + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + (*TFts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_vmprintf(tls, zFmt, ap) + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) + } + _ = ap +} + +func _fts5ExprIsspace(tls *libc.TLS, t int8) (r int32) { + return libc.BoolInt32(int32(t) == int32(' ') || int32(t) == int32('\t') || int32(t) == int32('\n') || int32(t) == int32('\r')) +} + +// C documentation +// +// /* +// ** Read the first token from the nul-terminated string at *pz. +// */ +func _fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var tok int32 + var z, z2, z21 uintptr + _, _, _, _ = tok, z, z2, z21 + z = *(*uintptr)(unsafe.Pointer(pz)) + /* Skip past any whitespace */ + for _fts5ExprIsspace(tls, *(*int8)(unsafe.Pointer(z))) != 0 { + z++ + } + (*TFts5Token)(unsafe.Pointer(pToken)).Fp = z + (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(1) + switch int32(*(*int8)(unsafe.Pointer(z))) { + case int32('('): + tok = int32(FTS5_LP) + case int32(')'): + tok = int32(FTS5_RP) + case int32('{'): + tok = int32(FTS5_LCP) + case int32('}'): + tok = int32(FTS5_RCP) + case int32(':'): + tok = int32(FTS5_COLON) + case int32(','): + tok = int32(FTS5_COMMA) + case int32('+'): + tok = int32(FTS5_PLUS) + case int32('*'): + tok = int32(FTS5_STAR) + case int32('-'): + tok = int32(FTS5_MINUS) + case int32('^'): + tok = int32(FTS5_CARET) + case int32('\000'): + tok = FTS5_EOF + case int32('"'): + tok = int32(FTS5_STRING) + z2 = z + 1 + for { + if !(int32(1) != 0) { + break + } + if int32(*(*int8)(unsafe.Pointer(z2))) == int32('"') { + z2++ + if int32(*(*int8)(unsafe.Pointer(z2))) != int32('"') { + break + } + } + if int32(*(*int8)(unsafe.Pointer(z2))) == int32('\000') { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35943, 0) + return FTS5_EOF + } + goto _1 + _1: + ; + z2++ + } + (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z2) - int64(z)) + default: + if _sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+35963, libc.VaList(bp+8, z)) + return FTS5_EOF + } + tok = int32(FTS5_STRING) + z21 = z + 1 + for { + if !(_sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z21))) != 0) { + break + } + goto _2 + _2: + ; + z21++ + } + (*TFts5Token)(unsafe.Pointer(pToken)).Fn = int32(int64(z21) - int64(z)) + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(2) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35994, uint64(2)) == 0 { + tok = int32(FTS5_OR) + } + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+35997, uint64(3)) == 0 { + tok = int32(FTS5_NOT) + } + if (*TFts5Token)(unsafe.Pointer(pToken)).Fn == int32(3) && libc.Xmemcmp(tls, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, __ccgo_ts+30738, uint64(3)) == 0 { + tok = int32(FTS5_AND) + } + break + } + *(*uintptr)(unsafe.Pointer(pz)) = (*TFts5Token)(unsafe.Pointer(pToken)).Fp + uintptr((*TFts5Token)(unsafe.Pointer(pToken)).Fn) + return tok +} + +func _fts5ParseAlloc(tls *libc.TLS, t Tu64) (r uintptr) { + return Xsqlite3_malloc64(tls, uint64(int64(t))) +} + +func _fts5ParseFree(tls *libc.TLS, p uintptr) { + Xsqlite3_free(tls, p) +} + +func _sqlite3Fts5ExprNew(tls *libc.TLS, pConfig uintptr, bPhraseToAnd int32, iCol int32, zExpr uintptr, ppNew uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(80) + defer tls.Free(80) + var n, nByte, t int32 + var pColset, pEngine, pNew, v1 uintptr + var _ /* sParse at bp+0 */ TFts5Parse + var _ /* token at bp+48 */ TFts5Token + var _ /* z at bp+64 */ uintptr + _, _, _, _, _, _, _ = n, nByte, pColset, pEngine, pNew, t, v1 + *(*uintptr)(unsafe.Pointer(bp + 64)) = zExpr + *(*uintptr)(unsafe.Pointer(ppNew)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pzErr)) = uintptr(0) + libc.Xmemset(tls, bp, 0, uint64(48)) + (*(*TFts5Parse)(unsafe.Pointer(bp))).FbPhraseToAnd = bPhraseToAnd + pEngine = _sqlite3Fts5ParserAlloc(tls, __ccgo_fp(_fts5ParseAlloc)) + if pEngine == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*(*TFts5Parse)(unsafe.Pointer(bp))).FpConfig = pConfig + for cond := true; cond; cond = (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc == SQLITE_OK && t != FTS5_EOF { + t = _fts5ExprGetToken(tls, bp, bp+64, bp+48) + _sqlite3Fts5Parser(tls, pEngine, t, *(*TFts5Token)(unsafe.Pointer(bp + 48)), bp) + } + _sqlite3Fts5ParserFree(tls, pEngine, __ccgo_fp(_fts5ParseFree)) + /* If the LHS of the MATCH expression was a user column, apply the + ** implicit column-filter. */ + if iCol < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol && (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr != 0 && (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc == SQLITE_OK { + n = int32(8) + pColset = _sqlite3Fts5MallocZero(tls, bp+16, int64(n)) + if pColset != 0 { + (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol = int32(1) + *(*int32)(unsafe.Pointer(pColset + 4)) = iCol + _sqlite3Fts5ParseSetColset(tls, bp, (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr, pColset) + } + } + if (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc == SQLITE_OK { + v1 = Xsqlite3_malloc(tls, int32(40)) + pNew = v1 + *(*uintptr)(unsafe.Pointer(ppNew)) = v1 + if pNew == uintptr(0) { + (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc = int32(SQLITE_NOMEM) + _sqlite3Fts5ParseNodeFree(tls, (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr) + } else { + if !((*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr != 0) { + nByte = int32(56) + (*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot = _sqlite3Fts5MallocZero(tls, bp+16, int64(nByte)) + if (*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot != 0 { + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FbEof = int32(1) + } + } else { + (*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot = (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr + } + (*TFts5Expr)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) + (*TFts5Expr)(unsafe.Pointer(pNew)).FpConfig = pConfig + (*TFts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase = (*(*TFts5Parse)(unsafe.Pointer(bp))).FapPhrase + (*TFts5Expr)(unsafe.Pointer(pNew)).FnPhrase = (*(*TFts5Parse)(unsafe.Pointer(bp))).FnPhrase + (*TFts5Expr)(unsafe.Pointer(pNew)).FbDesc = 0 + (*(*TFts5Parse)(unsafe.Pointer(bp))).FapPhrase = uintptr(0) + } + } else { + _sqlite3Fts5ParseNodeFree(tls, (*(*TFts5Parse)(unsafe.Pointer(bp))).FpExpr) + } + Xsqlite3_free(tls, (*(*TFts5Parse)(unsafe.Pointer(bp))).FapPhrase) + *(*uintptr)(unsafe.Pointer(pzErr)) = (*(*TFts5Parse)(unsafe.Pointer(bp))).FzErr + return (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc +} + +// C documentation +// +// /* +// ** Assuming that buffer z is at least nByte bytes in size and contains a +// ** valid utf-8 string, return the number of characters in the string. +// */ +func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { + var ii, nRet int32 + _, _ = ii, nRet + nRet = 0 + ii = 0 + for { + if !(ii < nByte) { + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(ii))))&int32(0xC0) != int32(0x80) { + nRet++ + } + goto _1 + _1: + ; + ii++ + } + return nRet +} + +// C documentation +// +// /* +// ** This function is only called when using the special 'trigram' tokenizer. +// ** Argument zText contains the text of a LIKE or GLOB pattern matched +// ** against column iCol. This function creates and compiles an FTS5 MATCH +// ** expression that will match a superset of the rows matched by the LIKE or +// ** GLOB. If successful, SQLITE_OK is returned. Otherwise, an SQLite error +// ** code. +// */ +func _sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol int32, zText uintptr, pp uintptr) (r int32) { + var aSpec [3]int8 + var bAnd, i, iFirst, iOut, jj, rc, v1, v3, v4, v5, v6 int32 + var nText Ti64 + var zExpr uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aSpec, bAnd, i, iFirst, iOut, jj, nText, rc, zExpr, v1, v3, v4, v5, v6 + nText = int64(libc.Xstrlen(tls, zText)) + zExpr = Xsqlite3_malloc64(tls, uint64(nText*int64(4)+int64(1))) + rc = SQLITE_OK + if zExpr == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + iOut = 0 + i = 0 + iFirst = 0 + if bGlob == 0 { + aSpec[0] = int8('_') + aSpec[int32(1)] = int8('%') + aSpec[int32(2)] = 0 + } else { + aSpec[0] = int8('*') + aSpec[int32(1)] = int8('?') + aSpec[int32(2)] = int8('[') + } + for int64(i) <= nText { + if int64(i) == nText || int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(aSpec[0]) || int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(aSpec[int32(1)]) || int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(aSpec[int32(2)]) { + if _fts5ExprCountChar(tls, zText+uintptr(iFirst), i-iFirst) >= int32(3) { + v1 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zExpr + uintptr(v1))) = int8('"') + jj = iFirst + for { + if !(jj < i) { + break + } + v3 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zExpr + uintptr(v3))) = *(*int8)(unsafe.Pointer(zText + uintptr(jj))) + if int32(*(*int8)(unsafe.Pointer(zText + uintptr(jj)))) == int32('"') { + v4 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zExpr + uintptr(v4))) = int8('"') + } + goto _2 + _2: + ; + jj++ + } + v5 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zExpr + uintptr(v5))) = int8('"') + v6 = iOut + iOut++ + *(*int8)(unsafe.Pointer(zExpr + uintptr(v6))) = int8(' ') + } + if int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(aSpec[int32(2)]) { + i += int32(2) + if int32(*(*int8)(unsafe.Pointer(zText + uintptr(i-int32(1))))) == int32('^') { + i++ + } + for int64(i) < nText && int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) != int32(']') { + i++ + } + } + iFirst = i + int32(1) + } + i++ + } + if iOut > 0 { + bAnd = 0 + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail != FTS5_DETAIL_FULL { + bAnd = int32(1) + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + iCol = (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol + } + } + *(*int8)(unsafe.Pointer(zExpr + uintptr(iOut))) = int8('\000') + rc = _sqlite3Fts5ExprNew(tls, pConfig, bAnd, iCol, zExpr, pp, (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg) + } else { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + Xsqlite3_free(tls, zExpr) + } + return rc +} + +// C documentation +// +// /* +// ** Free the expression node object passed as the only argument. +// */ +func _sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { + var i int32 + _ = i + if p != 0 { + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(p)).FnChild) { + break + } + _sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + _sqlite3Fts5ParseNearsetFree(tls, (*TFts5ExprNode)(unsafe.Pointer(p)).FpNear) + Xsqlite3_free(tls, p) + } +} + +// C documentation +// +// /* +// ** Free the expression object passed as the only argument. +// */ +func _sqlite3Fts5ExprFree(tls *libc.TLS, p uintptr) { + if p != 0 { + _sqlite3Fts5ParseNodeFree(tls, (*TFts5Expr)(unsafe.Pointer(p)).FpRoot) + Xsqlite3_free(tls, (*TFts5Expr)(unsafe.Pointer(p)).FapExprPhrase) + Xsqlite3_free(tls, p) + } +} + +func _sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var ap, p1 uintptr + var i, nPhrase int32 + var _ /* sParse at bp+0 */ TFts5Parse + _, _, _, _ = ap, i, nPhrase, p1 + libc.Xmemset(tls, bp, 0, uint64(48)) + if *(*uintptr)(unsafe.Pointer(pp1)) != 0 && p2 != 0 { + p1 = *(*uintptr)(unsafe.Pointer(pp1)) + nPhrase = (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase + (*TFts5Expr)(unsafe.Pointer(p2)).FnPhrase + (*TFts5Expr)(unsafe.Pointer(p1)).FpRoot = _sqlite3Fts5ParseNode(tls, bp, int32(FTS5_AND), (*TFts5Expr)(unsafe.Pointer(p1)).FpRoot, (*TFts5Expr)(unsafe.Pointer(p2)).FpRoot, uintptr(0)) + (*TFts5Expr)(unsafe.Pointer(p2)).FpRoot = uintptr(0) + if (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc == SQLITE_OK { + ap = Xsqlite3_realloc(tls, (*TFts5Expr)(unsafe.Pointer(p1)).FapExprPhrase, int32(uint64(nPhrase)*uint64(8))) + if ap == uintptr(0) { + (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc = int32(SQLITE_NOMEM) + } else { + libc.Xmemmove(tls, ap+uintptr((*TFts5Expr)(unsafe.Pointer(p2)).FnPhrase)*8, ap, uint64((*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase)*uint64(8)) + i = 0 + for { + if !(i < (*TFts5Expr)(unsafe.Pointer(p2)).FnPhrase) { + break + } + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) + goto _1 + _1: + ; + i++ + } + (*TFts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase + (*TFts5Expr)(unsafe.Pointer(p1)).FapExprPhrase = ap + } + } + Xsqlite3_free(tls, (*TFts5Expr)(unsafe.Pointer(p2)).FapExprPhrase) + Xsqlite3_free(tls, p2) + } else { + if p2 != 0 { + *(*uintptr)(unsafe.Pointer(pp1)) = p2 + } + } + return (*(*TFts5Parse)(unsafe.Pointer(bp))).Frc +} + +// C documentation +// +// /* +// ** Argument pTerm must be a synonym iterator. Return the current rowid +// ** that it points to. +// */ +func _fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uintptr) (r Ti64) { + var bRetValid int32 + var iRet, iRowid Ti64 + var p uintptr + _, _, _, _ = bRetValid, iRet, iRowid, p + iRet = 0 + bRetValid = 0 + p = pTerm + for { + if !(p != 0) { + break + } + if 0 == int32((*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof) { + iRowid = (*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if bRetValid == 0 || bDesc != libc.BoolInt32(iRowid < iRet) { + iRet = iRowid + bRetValid = int32(1) + } + } + goto _1 + _1: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + if pbEof != 0 && bRetValid == 0 { + *(*int32)(unsafe.Pointer(pbEof)) = int32(1) + } + return iRet +} + +// C documentation +// +// /* +// ** Argument pTerm must be a synonym iterator. +// */ +func _fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid Ti64, pBuf uintptr, pa uintptr, pn uintptr) (r int32) { + bp := tls.Alloc(144) + defer tls.Free(144) + var aIter, aNew, p, pIter uintptr + var i, nAlloc, nIter, rc int32 + var iMin, iPrev Ti64 + var nByte Tsqlite3_int64 + var _ /* aStatic at bp+0 */ [4]TFts5PoslistReader + var _ /* writer at bp+128 */ TFts5PoslistWriter + _, _, _, _, _, _, _, _, _, _, _ = aIter, aNew, i, iMin, iPrev, nAlloc, nByte, nIter, p, pIter, rc + aIter = bp + nIter = 0 + nAlloc = int32(4) + rc = SQLITE_OK + p = pTerm + for { + if !(p != 0) { + break + } + pIter = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter + if int32((*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof) == 0 && (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == iRowid { + if (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData == 0 { + goto _1 + } + if nIter == nAlloc { + nByte = int64(uint64(32) * uint64(nAlloc) * uint64(2)) + aNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if aNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + goto synonym_poslist_out + } + libc.Xmemcpy(tls, aNew, aIter, uint64(32)*uint64(nIter)) + nAlloc = nAlloc * int32(2) + if aIter != bp { + Xsqlite3_free(tls, aIter) + } + aIter = aNew + } + _sqlite3Fts5PoslistReaderInit(tls, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FpData, (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData, aIter+uintptr(nIter)*32) + nIter++ + } + goto _1 + _1: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + if nIter == int32(1) { + *(*uintptr)(unsafe.Pointer(pa)) = (*(*TFts5PoslistReader)(unsafe.Pointer(aIter))).Fa + *(*int32)(unsafe.Pointer(pn)) = (*(*TFts5PoslistReader)(unsafe.Pointer(aIter))).Fn + } else { + *(*TFts5PoslistWriter)(unsafe.Pointer(bp + 128)) = TFts5PoslistWriter{} + iPrev = int64(-int32(1)) + _sqlite3Fts5BufferZero(tls, pBuf) + for int32(1) != 0 { + iMin = libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)<poslist buffer accordingly. Output parameter *pbMatch +// ** is set to true if this is really a match, or false otherwise. +// ** +// ** SQLITE_OK is returned if an error occurs, or an SQLite error code +// ** otherwise. It is not considered an error code if the current rowid is +// ** not a match. +// */ +func _fts5ExprPhraseIsMatch(tls *libc.TLS, pNode uintptr, pPhrase uintptr, pbMatch uintptr) (r int32) { + bp := tls.Alloc(176) + defer tls.Free(176) + var aIter, pPos, pTerm uintptr + var bFirst, bFlag, bMatch, i, rc int32 + var iAdj, iPos Ti64 + var nByte Tsqlite3_int64 + var _ /* a at bp+144 */ uintptr + var _ /* aStatic at bp+8 */ [4]TFts5PoslistReader + var _ /* buf at bp+152 */ TFts5Buffer + var _ /* n at bp+136 */ int32 + var _ /* writer at bp+0 */ TFts5PoslistWriter + _, _, _, _, _, _, _, _, _, _, _ = aIter, bFirst, bFlag, bMatch, i, iAdj, iPos, nByte, pPos, pTerm, rc + *(*TFts5PoslistWriter)(unsafe.Pointer(bp)) = TFts5PoslistWriter{} + aIter = bp + 8 + rc = SQLITE_OK + bFirst = int32((*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst) + _sqlite3Fts5BufferZero(tls, pPhrase+8) + /* If the aStatic[] array is not large enough, allocate a large array + ** using sqlite3_malloc(). This approach could be improved upon. */ + if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(libc.Uint64FromInt64(128)/libc.Uint64FromInt64(32)) { + nByte = int64(uint64(32) * uint64((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm)) + aIter = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(aIter != 0) { + return int32(SQLITE_NOMEM) + } + } + libc.Xmemset(tls, aIter, 0, uint64(32)*uint64((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm)) + /* Initialize a term iterator for each term in the phrase */ + i = 0 + for { + if !(i < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + pTerm = pPhrase + 32 + uintptr(i)*40 + *(*int32)(unsafe.Pointer(bp + 136)) = 0 + bFlag = 0 + *(*uintptr)(unsafe.Pointer(bp + 144)) = uintptr(0) + if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + *(*TFts5Buffer)(unsafe.Pointer(bp + 152)) = TFts5Buffer{} + rc = _fts5ExprSynonymList(tls, pTerm, (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid, bp+152, bp+144, bp+136) + if rc != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 144))) + goto ismatch_out + } + if *(*uintptr)(unsafe.Pointer(bp + 144)) == (*(*TFts5Buffer)(unsafe.Pointer(bp + 152))).Fp { + bFlag = int32(1) + } + } else { + *(*uintptr)(unsafe.Pointer(bp + 144)) = (*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter)).FpData + *(*int32)(unsafe.Pointer(bp + 136)) = (*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter)).FnData + } + _sqlite3Fts5PoslistReaderInit(tls, *(*uintptr)(unsafe.Pointer(bp + 144)), *(*int32)(unsafe.Pointer(bp + 136)), aIter+uintptr(i)*32) + (*(*TFts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32))).FbFlag = uint8(bFlag) + if (*(*TFts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32))).FbEof != 0 { + goto ismatch_out + } + goto _1 + _1: + ; + i++ + } + for int32(1) != 0 { + iPos = (*(*TFts5PoslistReader)(unsafe.Pointer(aIter))).FiPos + for cond := true; cond; cond = bMatch == 0 { + bMatch = int32(1) + i = 0 + for { + if !(i < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + pPos = aIter + uintptr(i)*32 + iAdj = iPos + int64(i) + if (*TFts5PoslistReader)(unsafe.Pointer(pPos)).FiPos != iAdj { + bMatch = 0 + for (*TFts5PoslistReader)(unsafe.Pointer(pPos)).FiPos < iAdj { + if _sqlite3Fts5PoslistReaderNext(tls, pPos) != 0 { + goto ismatch_out + } + } + if (*TFts5PoslistReader)(unsafe.Pointer(pPos)).FiPos > iAdj { + iPos = (*TFts5PoslistReader)(unsafe.Pointer(pPos)).FiPos - int64(i) + } + } + goto _2 + _2: + ; + i++ + } + } + /* Append position iPos to the output */ + if bFirst == 0 || int32(iPos&libc.Int64FromInt32(0x7FFFFFFF)) == 0 { + rc = _sqlite3Fts5PoslistWriterAppend(tls, pPhrase+8, bp, iPos) + if rc != SQLITE_OK { + goto ismatch_out + } + } + i = 0 + for { + if !(i < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + if _sqlite3Fts5PoslistReaderNext(tls, aIter+uintptr(i)*32) != 0 { + goto ismatch_out + } + goto _3 + _3: + ; + i++ + } + } +ismatch_out: + ; + *(*int32)(unsafe.Pointer(pbMatch)) = libc.BoolInt32((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn > 0) + i = 0 + for { + if !(i < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + if (*(*TFts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32))).FbFlag != 0 { + Xsqlite3_free(tls, (*(*TFts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32))).Fa) + } + goto _4 + _4: + ; + i++ + } + if aIter != bp+8 { + Xsqlite3_free(tls, aIter) + } + return rc +} + +type TFts5LookaheadReader = struct { + Fa uintptr + Fn int32 + Fi int32 + FiPos Ti64 + FiLookahead Ti64 +} + +type Fts5LookaheadReader = TFts5LookaheadReader + +type TFts5LookaheadReader1 = struct { + Fa uintptr + Fn int32 + Fi int32 + FiPos Ti64 + FiLookahead Ti64 +} + +type Fts5LookaheadReader1 = TFts5LookaheadReader1 + +func _fts5LookaheadReaderNext(tls *libc.TLS, p uintptr) (r int32) { + (*TFts5LookaheadReader)(unsafe.Pointer(p)).FiPos = (*TFts5LookaheadReader)(unsafe.Pointer(p)).FiLookahead + if _sqlite3Fts5PoslistNext64(tls, (*TFts5LookaheadReader)(unsafe.Pointer(p)).Fa, (*TFts5LookaheadReader)(unsafe.Pointer(p)).Fn, p+12, p+24) != 0 { + (*TFts5LookaheadReader)(unsafe.Pointer(p)).FiLookahead = libc.Int64FromInt32(1) << libc.Int32FromInt32(62) + } + return libc.BoolInt32((*TFts5LookaheadReader)(unsafe.Pointer(p)).FiPos == libc.Int64FromInt32(1)< int32(libc.Uint64FromInt64(192)/libc.Uint64FromInt64(48)) { + nByte = int64(uint64(48) * uint64((*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase)) + a = _sqlite3Fts5MallocZero(tls, bp+192, nByte) + } else { + libc.Xmemset(tls, bp, 0, uint64(192)) + } + if *(*int32)(unsafe.Pointer(bp + 192)) != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) + return 0 + } + /* Initialize a lookahead iterator for each phrase. After passing the + ** buffer and buffer size to the lookaside-reader init function, zero + ** the phrase poslist buffer. The new poslist for the phrase (containing + ** the same entries as the original with some entries removed on account + ** of the NEAR constraint) is written over the original even as it is + ** being read. This is safe as the entries for the new poslist are a + ** subset of the old, so it is not possible for data yet to be read to + ** be overwritten. */ + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPoslist = *(*uintptr)(unsafe.Pointer(apPhrase + uintptr(i)*8)) + 8 + _fts5LookaheadReaderInit(tls, (*TFts5Buffer)(unsafe.Pointer(pPoslist)).Fp, (*TFts5Buffer)(unsafe.Pointer(pPoslist)).Fn, a+uintptr(i)*48) + (*TFts5Buffer)(unsafe.Pointer(pPoslist)).Fn = 0 + (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut = pPoslist + goto _1 + _1: + ; + i++ + } + for int32(1) != 0 { + /* This block advances the phrase iterators until they point to a set of + ** entries that together comprise a match. */ + iMax = (*(*TFts5NearTrimmer)(unsafe.Pointer(a))).Freader.FiPos + for cond := true; cond; cond = bMatch == 0 { + bMatch = int32(1) + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPos = a + uintptr(i)*48 + iMin = iMax - int64((*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8)))).FnTerm) - int64((*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnNear) + if (*TFts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos < iMin || (*TFts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos > iMax { + bMatch = 0 + for (*TFts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos < iMin { + if _fts5LookaheadReaderNext(tls, pPos) != 0 { + goto ismatch_out + } + } + if (*TFts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos > iMax { + iMax = (*TFts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos + } + } + goto _2 + _2: + ; + i++ + } + } + /* Add an entry to each output position list */ + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + iPos = (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).Freader.FiPos + pWriter = a + uintptr(i)*48 + 32 + if (*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut)).Fn == 0 || iPos != (*TFts5PoslistWriter)(unsafe.Pointer(pWriter)).FiPrev { + _sqlite3Fts5PoslistWriterAppend(tls, (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).FpOut, pWriter, iPos) + } + goto _3 + _3: + ; + i++ + } + iAdv = 0 + iMin = (*(*TFts5NearTrimmer)(unsafe.Pointer(a))).Freader.FiLookahead + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + if (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).Freader.FiLookahead < iMin { + iMin = (*(*TFts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48))).Freader.FiLookahead + iAdv = i + } + goto _4 + _4: + ; + i++ + } + if _fts5LookaheadReaderNext(tls, a+uintptr(iAdv)*48) != 0 { + goto ismatch_out + } + } +ismatch_out: + ; + bRet = libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer((*(*TFts5NearTrimmer)(unsafe.Pointer(a))).FpOut)).Fn > 0) + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192)) + if a != bp { + Xsqlite3_free(tls, a) + } + return bRet + return r +} + +// C documentation +// +// /* +// ** Advance iterator pIter until it points to a value equal to or laster +// ** than the initial value of *piLast. If this means the iterator points +// ** to a value laster than *piLast, update *piLast to the new lastest value. +// ** +// ** If the iterator reaches EOF, set *pbEof to true before returning. If +// ** an error occurs, set *pRc to an error code. If either *pbEof or *pRc +// ** are set, return a non-zero value. Otherwise, return zero. +// */ +func _fts5ExprAdvanceto(tls *libc.TLS, pIter uintptr, bDesc int32, piLast uintptr, pRc uintptr, pbEof uintptr) (r int32) { + var iLast, iRowid Ti64 + var rc int32 + _, _, _ = iLast, iRowid, rc + iLast = *(*Ti64)(unsafe.Pointer(piLast)) + iRowid = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + if bDesc == 0 && iLast > iRowid || bDesc != 0 && iLast < iRowid { + rc = _sqlite3Fts5IterNextFrom(tls, pIter, iLast) + if rc != 0 || (*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0 { + *(*int32)(unsafe.Pointer(pRc)) = rc + *(*int32)(unsafe.Pointer(pbEof)) = int32(1) + return int32(1) + } + iRowid = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + } + *(*Ti64)(unsafe.Pointer(piLast)) = iRowid + return 0 +} + +func _fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast uintptr, pRc uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iLast, iRowid Ti64 + var p uintptr + var rc int32 + var _ /* bEof at bp+0 */ int32 + _, _, _, _ = iLast, iRowid, p, rc + rc = SQLITE_OK + iLast = *(*Ti64)(unsafe.Pointer(piLast)) + *(*int32)(unsafe.Pointer(bp)) = 0 + p = pTerm + for { + if !(rc == SQLITE_OK && p != 0) { + break + } + if int32((*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof) == 0 { + iRowid = (*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if bDesc == 0 && iLast > iRowid || bDesc != 0 && iLast < iRowid { + rc = _sqlite3Fts5IterNextFrom(tls, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter, iLast) + } + } + goto _1 + _1: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + if rc != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRc)) = rc + *(*int32)(unsafe.Pointer(bp)) = int32(1) + } else { + *(*Ti64)(unsafe.Pointer(piLast)) = _fts5ExprSynonymRowid(tls, pTerm, bDesc, bp) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +func _fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var pIter, pIter1, pNear, pPhrase, pPhrase1, pTerm uintptr + var _ /* bMatch at bp+4 */ int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _ = i, pIter, pIter1, pNear, pPhrase, pPhrase1, pTerm + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + *(*int32)(unsafe.Pointer(bp)) = *(*int32)(unsafe.Pointer(pRc)) + if (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { + pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 + pTerm = pPhrase + 32 + for { + if !(pTerm != 0) { + break + } + pIter = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter + if int32((*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof) == 0 { + if (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid && (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData > 0 { + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = int32(1) + } + } + goto _1 + _1: + ; + pTerm = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym + } + return (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn + } else { + /* Check that each phrase in the nearset matches the current row. + ** Populate the pPhrase->poslist buffers at the same time. If any + ** phrase is not a match, break out of the loop early. */ + i = 0 + for { + if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPhrase1 = *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8)) + if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase1)).FnTerm > int32(1) || (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase1 + 32))).FpSynonym != 0 || (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset != 0 || (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase1 + 32))).FbFirst != 0 { + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + *(*int32)(unsafe.Pointer(bp)) = _fts5ExprPhraseIsMatch(tls, pNode, pPhrase1, bp+4) + if *(*int32)(unsafe.Pointer(bp + 4)) == 0 { + break + } + } else { + pIter1 = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase1 + 32))).FpIter + _sqlite3Fts5BufferSet(tls, bp, pPhrase1+8, (*TFts5IndexIter)(unsafe.Pointer(pIter1)).FnData, (*TFts5IndexIter)(unsafe.Pointer(pIter1)).FpData) + } + goto _2 + _2: + ; + i++ + } + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp)) + if i == (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase && (i == int32(1) || _fts5ExprNearIsMatch(tls, pRc, pNear) != 0) { + return int32(1) + } + return 0 + } + return r +} + +// C documentation +// +// /* +// ** Initialize all term iterators in the pNear object. If any term is found +// ** to match no documents at all, return immediately without initializing any +// ** further iterators. +// ** +// ** If an error occurs, return an SQLite error code. Otherwise, return +// ** SQLITE_OK. It is not considered an error if some term matches zero +// ** documents. +// */ +func _fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + var bHit, i, j, rc, v4, v5 int32 + var p, pNear, pPhrase, pTerm uintptr + _, _, _, _, _, _, _, _, _, _ = bHit, i, j, p, pNear, pPhrase, pTerm, rc, v4, v5 + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8)) + if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + return SQLITE_OK + } else { + j = 0 + for { + if !(j < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + pTerm = pPhrase + 32 + uintptr(j)*40 + bHit = 0 + p = pTerm + for { + if !(p != 0) { + break + } + if (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter != 0 { + _sqlite3Fts5IterClose(tls, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter) + (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter = uintptr(0) + } + if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FbPrefix != 0 { + v4 = int32(FTS5INDEX_QUERY_PREFIX) + } else { + v4 = 0 + } + if (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc != 0 { + v5 = int32(FTS5INDEX_QUERY_DESC) + } else { + v5 = 0 + } + rc = _sqlite3Fts5IndexQuery(tls, (*TFts5Expr)(unsafe.Pointer(pExpr)).FpIndex, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpTerm, (*TFts5ExprTerm)(unsafe.Pointer(p)).FnQueryTerm, v4|v5, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset, p+24) + if rc != SQLITE_OK { + return rc + } + if 0 == int32((*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof) { + bHit = int32(1) + } + goto _3 + _3: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + if bHit == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + return SQLITE_OK + } + goto _2 + _2: + ; + j++ + } + } + goto _1 + _1: + ; + i++ + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If pExpr is an ASC iterator, this function returns a value with the +// ** same sign as: +// ** +// ** (iLhs - iRhs) +// ** +// ** Otherwise, if this is a DESC iterator, the opposite is returned: +// ** +// ** (iRhs - iLhs) +// */ +func _fts5RowidCmp(tls *libc.TLS, pExpr uintptr, iLhs Ti64, iRhs Ti64) (r int32) { + if (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc == 0 { + if iLhs < iRhs { + return -int32(1) + } + return libc.BoolInt32(iLhs > iRhs) + } else { + if iLhs > iRhs { + return -int32(1) + } + return libc.BoolInt32(iLhs < iRhs) + } + return r +} + +func _fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { + var i int32 + _ = i + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + _fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } +} + +func _fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { + var i, i1 int32 + var pNear, pPhrase uintptr + _, _, _, _ = i, i1, pNear, pPhrase + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_STRING) || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_TERM) { + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8)) + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 + goto _1 + _1: + ; + i++ + } + } else { + i1 = 0 + for { + if !(i1 < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + _fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8))) + goto _2 + _2: + ; + i1++ + } + } +} + +// C documentation +// +// /* +// ** Compare the values currently indicated by the two nodes as follows: +// ** +// ** res = (*p1) - (*p2) +// ** +// ** Nodes that point to values that come later in the iteration order are +// ** considered to be larger. Nodes at EOF are the largest of all. +// ** +// ** This means that if the iteration order is ASC, then numerically larger +// ** rowids are considered larger. Or if it is the default DESC, numerically +// ** smaller rowids are larger. +// */ +func _fts5NodeCompare(tls *libc.TLS, pExpr uintptr, p1 uintptr, p2 uintptr) (r int32) { + if (*TFts5ExprNode)(unsafe.Pointer(p2)).FbEof != 0 { + return -int32(1) + } + if (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof != 0 { + return +libc.Int32FromInt32(1) + } + return _fts5RowidCmp(tls, pExpr, (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid, (*TFts5ExprNode)(unsafe.Pointer(p2)).FiRowid) +} + +// C documentation +// +// /* +// ** All individual term iterators in pNear are guaranteed to be valid when +// ** this function is called. This function checks if all term iterators +// ** point to the same rowid, and if not, advances them until they do. +// ** If an EOF is reached before this happens, *pbEof is set to true before +// ** returning. +// ** +// ** SQLITE_OK is returned if an error occurs, or an SQLite error code +// ** otherwise. It is not considered an error code if an iterator reaches +// ** EOF. +// */ +func _fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bDesc, bMatch, i, j int32 + var iRowid Ti64 + var pIter, pLeft, pNear, pPhrase, pTerm uintptr + var _ /* iLast at bp+8 */ Ti64 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = bDesc, bMatch, i, iRowid, j, pIter, pLeft, pNear, pPhrase, pTerm + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + pLeft = *(*uintptr)(unsafe.Pointer(pNear + 24)) + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* True if all terms are at the same rowid */ + bDesc = (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc + /* Check that this node should not be FTS5_TERM */ + /* Initialize iLast, the "lastest" rowid any iterator points to. If the + ** iterator skips through rowids in the default ascending order, this means + ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it + ** means the minimum rowid. */ + if (*(*TFts5ExprTerm)(unsafe.Pointer(pLeft + 32))).FpSynonym != 0 { + *(*Ti64)(unsafe.Pointer(bp + 8)) = _fts5ExprSynonymRowid(tls, pLeft+32, bDesc, uintptr(0)) + } else { + *(*Ti64)(unsafe.Pointer(bp + 8)) = (*TFts5IndexIter)(unsafe.Pointer((*(*TFts5ExprTerm)(unsafe.Pointer(pLeft + 32))).FpIter)).FiRowid + } + for cond := true; cond; cond = bMatch == 0 { + bMatch = int32(1) + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8)) + j = 0 + for { + if !(j < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + pTerm = pPhrase + 32 + uintptr(j)*40 + if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + iRowid = _fts5ExprSynonymRowid(tls, pTerm, bDesc, uintptr(0)) + if iRowid == *(*Ti64)(unsafe.Pointer(bp + 8)) { + goto _2 + } + bMatch = 0 + if _fts5ExprSynonymAdvanceto(tls, pTerm, bDesc, bp+8, bp) != 0 { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + return *(*int32)(unsafe.Pointer(bp)) + } + } else { + pIter = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32 + uintptr(j)*40))).FpIter + if (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == *(*Ti64)(unsafe.Pointer(bp + 8)) || (*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0 { + goto _2 + } + bMatch = 0 + if _fts5ExprAdvanceto(tls, pIter, bDesc, bp+8, bp, pNode+4) != 0 { + return *(*int32)(unsafe.Pointer(bp)) + } + } + goto _2 + _2: + ; + j++ + } + goto _1 + _1: + ; + i++ + } + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = *(*Ti64)(unsafe.Pointer(bp + 8)) + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = libc.BoolInt32(0 == _fts5ExprNearTest(tls, bp, pExpr, pNode) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Advance the first term iterator in the first phrase of pNear. Set output +// ** variable *pbEof to true if it reaches EOF or if an error occurs. +// ** +// ** Return SQLITE_OK if successful, or an SQLite error code if an error +// ** occurs. +// */ +func _fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom Ti64) (r int32) { + var bEof, rc int32 + var iRowid, ii Ti64 + var p, pIter, pTerm uintptr + _, _, _, _, _, _, _ = bEof, iRowid, ii, p, pIter, pTerm, rc + pTerm = *(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24)) + 32 + rc = SQLITE_OK + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + bEof = int32(1) + /* Find the firstest rowid any synonym points to. */ + iRowid = _fts5ExprSynonymRowid(tls, pTerm, (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc, uintptr(0)) + /* Advance each iterator that currently points to iRowid. Or, if iFrom + ** is valid - each iterator that points to a rowid before iFrom. */ + p = pTerm + for { + if !(p != 0) { + break + } + if int32((*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof) == 0 { + ii = (*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if ii == iRowid || bFromValid != 0 && ii != iFrom && libc.BoolInt32(ii > iFrom) == (*TFts5Expr)(unsafe.Pointer(pExpr)).FbDesc { + if bFromValid != 0 { + rc = _sqlite3Fts5IterNextFrom(tls, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter, iFrom) + } else { + rc = _sqlite3Fts5IterNext(tls, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter) + } + if rc != SQLITE_OK { + break + } + if int32((*TFts5IndexIter)(unsafe.Pointer((*TFts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof) == 0 { + bEof = 0 + } + } else { + bEof = 0 + } + } + goto _1 + _1: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + /* Set the EOF flag if either all synonym iterators are at EOF or an + ** error has occurred. */ + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = libc.BoolInt32(rc != 0 || bEof != 0) + } else { + pIter = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter + if bFromValid != 0 { + rc = _sqlite3Fts5IterNextFrom(tls, pIter, iFrom) + } else { + rc = _sqlite3Fts5IterNext(tls, pIter) + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = libc.BoolInt32(rc != 0 || (*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0) + } + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 { + rc = _fts5ExprNodeTest_STRING(tls, pExpr, pNode) + } + return rc +} + +func _fts5ExprNodeTest_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + var pIter, pPhrase uintptr + _, _ = pIter, pPhrase + /* As this "NEAR" object is actually a single phrase that consists + ** of a single term only, grab pointers into the poslist managed by the + ** fts5_index.c iterator object. This is much faster than synthesizing + ** a new poslist the way we have to for more complicated phrase or NEAR + ** expressions. */ + pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24)) + pIter = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FpIter + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FnData + if (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FeDetail == FTS5_DETAIL_FULL { + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fp = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FpData + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = libc.BoolInt32((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn == 0) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** xNext() method for a node of type FTS5_TERM. +// */ +func _fts5ExprNodeNext_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom Ti64) (r int32) { + var pIter uintptr + var rc int32 + _, _ = pIter, rc + pIter = (*(*TFts5ExprTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24)) + 32))).FpIter + if bFromValid != 0 { + rc = _sqlite3Fts5IterNextFrom(tls, pIter, iFrom) + } else { + rc = _sqlite3Fts5IterNext(tls, pIter) + } + if rc == SQLITE_OK && int32((*TFts5IndexIter)(unsafe.Pointer(pIter)).FbEof) == 0 { + rc = _fts5ExprNodeTest_TERM(tls, pExpr, pNode) + } else { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +func _fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { + var cmp, i int32 + var pChild, pNext uintptr + _, _, _, _ = cmp, i, pChild, pNext + pNext = *(*uintptr)(unsafe.Pointer(pNode + 48)) + i = int32(1) + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + pChild = *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)) + cmp = _fts5NodeCompare(tls, pExpr, pNext, pChild) + if cmp > 0 || cmp == 0 && (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbNomatch == 0 { + pNext = pChild + } + goto _1 + _1: + ; + i++ + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FiRowid + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FbEof + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (*TFts5ExprNode)(unsafe.Pointer(pNext)).FbNomatch +} + +func _fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom Ti64) (r int32) { + var i, rc int32 + var iLast Ti64 + var p1 uintptr + _, _, _, _ = i, iLast, p1, rc + iLast = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + p1 = *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)) + if (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0 { + if (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid == iLast || bFromValid != 0 && _fts5RowidCmp(tls, pExpr, (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid, iFrom) < 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(p1)).FxNext})))(tls, pExpr, p1, bFromValid, iFrom) + if rc != SQLITE_OK { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + return rc + } + } + } + goto _1 + _1: + ; + i++ + } + _fts5ExprNodeTest_OR(tls, pExpr, pNode) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Argument pNode is an FTS5_AND node. +// */ +func _fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) (r int32) { + var bMatch, cmp, iChild, rc int32 + var iLast Ti64 + var pChild uintptr + _, _, _, _, _, _ = bMatch, cmp, iChild, iLast, pChild, rc + iLast = (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FiRowid + rc = SQLITE_OK + for cond := true; cond; cond = bMatch == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 0 + bMatch = int32(1) + iChild = 0 + for { + if !(iChild < (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FnChild) { + break + } + pChild = *(*uintptr)(unsafe.Pointer(pAnd + 48 + uintptr(iChild)*8)) + cmp = _fts5RowidCmp(tls, pExpr, iLast, (*TFts5ExprNode)(unsafe.Pointer(pChild)).FiRowid) + if cmp > 0 { + /* Advance pChild until it points to iLast or laster */ + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pChild)).FxNext})))(tls, pExpr, pChild, int32(1), iLast) + if rc != SQLITE_OK { + (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 0 + return rc + } + } + /* If the child node is now at EOF, so is the parent AND node. Otherwise, + ** the child node is guaranteed to have advanced at least as far as + ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the + ** new lastest rowid seen so far. */ + if (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof != 0 { + _fts5ExprSetEof(tls, pAnd) + bMatch = int32(1) + break + } else { + if iLast != (*TFts5ExprNode)(unsafe.Pointer(pChild)).FiRowid { + bMatch = 0 + iLast = (*TFts5ExprNode)(unsafe.Pointer(pChild)).FiRowid + } + } + if (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbNomatch != 0 { + (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = int32(1) + } + goto _1 + _1: + ; + iChild++ + } + } + if (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch != 0 && pAnd != (*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot { + _fts5ExprNodeZeroPoslist(tls, pAnd) + } + (*TFts5ExprNode)(unsafe.Pointer(pAnd)).FiRowid = iLast + return SQLITE_OK +} + +func _fts5ExprNodeNext_AND(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom Ti64) (r int32) { + var rc int32 + _ = rc + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FxNext})))(tls, pExpr, *(*uintptr)(unsafe.Pointer(pNode + 48)), bFromValid, iFrom) + if rc == SQLITE_OK { + rc = _fts5ExprNodeTest_AND(tls, pExpr, pNode) + } else { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +func _fts5ExprNodeTest_NOT(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + var cmp, rc int32 + var p1, p2 uintptr + _, _, _, _ = cmp, p1, p2, rc + rc = SQLITE_OK + p1 = *(*uintptr)(unsafe.Pointer(pNode + 48)) + p2 = *(*uintptr)(unsafe.Pointer(pNode + 48 + 1*8)) + for rc == SQLITE_OK && (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0 { + cmp = _fts5NodeCompare(tls, pExpr, p1, p2) + if cmp > 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(p2)).FxNext})))(tls, pExpr, p2, int32(1), (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid) + cmp = _fts5NodeCompare(tls, pExpr, p1, p2) + } + if cmp != 0 || (*TFts5ExprNode)(unsafe.Pointer(p2)).FbNomatch != 0 { + break + } + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(p1)).FxNext})))(tls, pExpr, p1, 0, int64(libc.Int32FromInt32(0))) + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (*TFts5ExprNode)(unsafe.Pointer(p1)).FbNomatch + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(p1)).FiRowid + if (*TFts5ExprNode)(unsafe.Pointer(p1)).FbEof != 0 { + _fts5ExprNodeZeroPoslist(tls, p2) + } + return rc +} + +func _fts5ExprNodeNext_NOT(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom Ti64) (r int32) { + var rc int32 + _ = rc + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FxNext})))(tls, pExpr, *(*uintptr)(unsafe.Pointer(pNode + 48)), bFromValid, iFrom) + if rc == SQLITE_OK { + rc = _fts5ExprNodeTest_NOT(tls, pExpr, pNode) + } + if rc != SQLITE_OK { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +// C documentation +// +// /* +// ** If pNode currently points to a match, this function returns SQLITE_OK +// ** without modifying it. Otherwise, pNode is advanced until it does point +// ** to a match or EOF is reached. +// */ +func _fts5ExprNodeTest(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 { + switch (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case int32(FTS5_STRING): + rc = _fts5ExprNodeTest_STRING(tls, pExpr, pNode) + case int32(FTS5_TERM): + rc = _fts5ExprNodeTest_TERM(tls, pExpr, pNode) + case int32(FTS5_AND): + rc = _fts5ExprNodeTest_AND(tls, pExpr, pNode) + case int32(FTS5_OR): + _fts5ExprNodeTest_OR(tls, pExpr, pNode) + default: + rc = _fts5ExprNodeTest_NOT(tls, pExpr, pNode) + break + } + } + return rc +} + +// C documentation +// +// /* +// ** Set node pNode, which is part of expression pExpr, to point to the first +// ** match. If there are no matches, set the Node.bEof flag to indicate EOF. +// ** +// ** Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +// ** It is not an error if there are no matches. +// */ +func _fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) (r int32) { + var i, nEof, rc int32 + var pChild uintptr + _, _, _, _ = i, nEof, pChild, rc + rc = SQLITE_OK + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_TERM) || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_STRING) { + /* Initialize all term iterators in the NEAR object. */ + rc = _fts5ExprNearInitAll(tls, pExpr, pNode) + } else { + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext == uintptr(0) { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = int32(1) + } else { + nEof = 0 + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild && rc == SQLITE_OK) { + break + } + pChild = *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)) + rc = _fts5ExprNodeFirst(tls, pExpr, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8))) + nEof += (*TFts5ExprNode)(unsafe.Pointer(pChild)).FbEof + goto _1 + _1: + ; + i++ + } + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FiRowid + switch (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case int32(FTS5_AND): + if nEof > 0 { + _fts5ExprSetEof(tls, pNode) + } + case int32(FTS5_OR): + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild == nEof { + _fts5ExprSetEof(tls, pNode) + } + default: + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 48)))).FbEof + break + } + } + } + if rc == SQLITE_OK { + rc = _fts5ExprNodeTest(tls, pExpr, pNode) + } + return rc +} + +// C documentation +// +// /* +// ** Begin iterating through the set of documents in index pIdx matched by +// ** the MATCH expression passed as the first argument. If the "bDesc" +// ** parameter is passed a non-zero value, iteration is in descending rowid +// ** order. Or, if it is zero, in ascending order. +// ** +// ** If iterating in ascending rowid order (bDesc==0), the first document +// ** visited is that with the smallest rowid that is larger than or equal +// ** to parameter iFirst. Or, if iterating in ascending order (bDesc==1), +// ** then the first document visited must have a rowid smaller than or +// ** equal to iFirst. +// ** +// ** Return SQLITE_OK if successful, or an SQLite error code otherwise. It +// ** is not considered an error if the query does not match any documents. +// */ +func _sqlite3Fts5ExprFirst(tls *libc.TLS, p uintptr, pIdx uintptr, iFirst Ti64, bDesc int32) (r int32) { + var pRoot uintptr + var rc int32 + _, _ = pRoot, rc + pRoot = (*TFts5Expr)(unsafe.Pointer(p)).FpRoot /* Return code */ + (*TFts5Expr)(unsafe.Pointer(p)).FpIndex = pIdx + (*TFts5Expr)(unsafe.Pointer(p)).FbDesc = bDesc + rc = _fts5ExprNodeFirst(tls, p, pRoot) + /* If not at EOF but the current rowid occurs earlier than iFirst in + ** the iteration order, move to document iFirst or later. */ + if rc == SQLITE_OK && 0 == (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbEof && _fts5RowidCmp(tls, p, (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FiRowid, iFirst) < 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pRoot)).FxNext})))(tls, p, pRoot, int32(1), iFirst) + } + /* If the iterator is not at a real match, skip forward until it is. */ + for (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0 && rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pRoot)).FxNext})))(tls, p, pRoot, 0, int64(libc.Int32FromInt32(0))) + } + return rc +} + +// C documentation +// +// /* +// ** Move to the next document +// ** +// ** Return SQLITE_OK if successful, or an SQLite error code otherwise. It +// ** is not considered an error if the query does not match any documents. +// */ +func _sqlite3Fts5ExprNext(tls *libc.TLS, p uintptr, iLast Ti64) (r int32) { + var pRoot uintptr + var rc int32 + _, _ = pRoot, rc + pRoot = (*TFts5Expr)(unsafe.Pointer(p)).FpRoot + for cond := true; cond; cond = (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Ti64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExprNode)(unsafe.Pointer(pRoot)).FxNext})))(tls, p, pRoot, 0, int64(libc.Int32FromInt32(0))) + } + if _fts5RowidCmp(tls, p, (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FiRowid, iLast) > 0 { + (*TFts5ExprNode)(unsafe.Pointer(pRoot)).FbEof = int32(1) + } + return rc +} + +func _sqlite3Fts5ExprEof(tls *libc.TLS, p uintptr) (r int32) { + return (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p)).FpRoot)).FbEof +} + +func _sqlite3Fts5ExprRowid(tls *libc.TLS, p uintptr) (r Ti64) { + return (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(p)).FpRoot)).FiRowid +} + +func _fts5ParseStringFromToken(tls *libc.TLS, pToken uintptr, pz uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* rc at bp+0 */ int32 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(pz)) = _sqlite3Fts5Strndup(tls, bp, (*TFts5Token)(unsafe.Pointer(pToken)).Fp, (*TFts5Token)(unsafe.Pointer(pToken)).Fn) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Free the phrase object passed as the only argument. +// */ +func _fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { + var i int32 + var pNext, pSyn, pTerm uintptr + _, _, _, _ = i, pNext, pSyn, pTerm + if pPhrase != 0 { + i = 0 + for { + if !(i < (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + break + } + pTerm = pPhrase + 32 + uintptr(i)*40 + Xsqlite3_free(tls, (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpTerm) + _sqlite3Fts5IterClose(tls, (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter) + pSyn = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym + for { + if !(pSyn != 0) { + break + } + pNext = (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpSynonym + _sqlite3Fts5IterClose(tls, (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpIter) + _sqlite3Fts5BufferFree(tls, pSyn+1*40) + Xsqlite3_free(tls, pSyn) + goto _2 + _2: + ; + pSyn = pNext + } + goto _1 + _1: + ; + i++ + } + if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { + _sqlite3Fts5BufferFree(tls, pPhrase+8) + } + Xsqlite3_free(tls, pPhrase) + } +} + +// C documentation +// +// /* +// ** Set the "bFirst" flag on the first token of the phrase passed as the +// ** only argument. +// */ +func _sqlite3Fts5ParseSetCaret(tls *libc.TLS, pPhrase uintptr) { + if pPhrase != 0 && (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm != 0 { + (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst = uint8(1) + } +} + +// C documentation +// +// /* +// ** If argument pNear is NULL, then a new Fts5ExprNearset object is allocated +// ** and populated with pPhrase. Or, if pNear is not NULL, phrase pPhrase is +// ** appended to it and the results returned. +// ** +// ** If an OOM error occurs, both the pNear and pPhrase objects are freed and +// ** NULL returned. +// */ +func _sqlite3Fts5ParseNearset(tls *libc.TLS, pParse uintptr, pNear uintptr, pPhrase uintptr) (r uintptr) { + var SZALLOC, nNew, v1 int32 + var nByte, nByte1 Tsqlite3_int64 + var pLast, pRet, v2 uintptr + _, _, _, _, _, _, _, _ = SZALLOC, nByte, nByte1, nNew, pLast, pRet, v1, v2 + SZALLOC = int32(8) + pRet = uintptr(0) + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + if pPhrase == uintptr(0) { + return pNear + } + if pNear == uintptr(0) { + nByte = int64(uint64(32) + uint64(SZALLOC)*uint64(8)) + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pRet, 0, uint64(nByte)) + } + } else { + if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase%SZALLOC == 0 { + nNew = (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase + SZALLOC + nByte1 = int64(uint64(32) + uint64(nNew)*uint64(8)) + pRet = Xsqlite3_realloc64(tls, pNear, uint64(nByte1)) + if pRet == uintptr(0) { + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } + } else { + pRet = pNear + } + } + } + if pRet == uintptr(0) { + _sqlite3Fts5ParseNearsetFree(tls, pNear) + _sqlite3Fts5ParsePhraseFree(tls, pPhrase) + } else { + if (*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase > 0 { + pLast = *(*uintptr)(unsafe.Pointer(pRet + 24 + uintptr((*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-int32(1))*8)) + if (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm == 0 { + _fts5ExprPhraseFree(tls, pPhrase) + (*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-- + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + pPhrase = pLast + } else { + if (*TFts5ExprPhrase)(unsafe.Pointer(pLast)).FnTerm == 0 { + _fts5ExprPhraseFree(tls, pLast) + *(*uintptr)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr((*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-int32(2))*8)) = pPhrase + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + (*TFts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-- + } + } + } + v2 = pRet + 16 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*uintptr)(unsafe.Pointer(pRet + 24 + uintptr(v1)*8)) = pPhrase + } + return pRet +} + +type TTokenCtx = struct { + FpPhrase uintptr + FpConfig uintptr + Frc int32 +} + +type TokenCtx = TTokenCtx + +type TTokenCtx1 = struct { + FpPhrase uintptr + FpConfig uintptr + Frc int32 +} + +type TokenCtx1 = TTokenCtx1 + +// C documentation +// +// /* +// ** Callback for tokenizing terms used by ParseTerm(). +// */ +func _fts5ParseTokenize(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var SZALLOC, nNew, v1, v2, v4, v6 int32 + var nByte Tsqlite3_int64 + var pCtx, pNew, pPhrase, pSyn, pTerm, v3, v5 uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = SZALLOC, nByte, nNew, pCtx, pNew, pPhrase, pSyn, pTerm, v1, v2, v3, v4, v5, v6 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + SZALLOC = int32(8) + pCtx = pContext + pPhrase = (*TTokenCtx)(unsafe.Pointer(pCtx)).FpPhrase + _ = iUnused1 + _ = iUnused2 + /* If an error has already occurred, this is a no-op */ + if (*TTokenCtx)(unsafe.Pointer(pCtx)).Frc != SQLITE_OK { + return (*TTokenCtx)(unsafe.Pointer(pCtx)).Frc + } + if nToken > int32(FTS5_MAX_TOKEN_SIZE) { + nToken = int32(FTS5_MAX_TOKEN_SIZE) + } + if pPhrase != 0 && (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && tflags&int32(FTS5_TOKEN_COLOCATED) != 0 { + nByte = int64(libc.Uint64FromInt64(40) + libc.Uint64FromInt64(16) + uint64(nToken) + uint64(1)) + pSyn = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSyn == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pSyn, 0, uint64(nByte)) + (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpTerm = pSyn + uintptr(40) + uintptr(16) + v1 = nToken + (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FnQueryTerm = v1 + (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FnFullTerm = v1 + if (*TFts5Config)(unsafe.Pointer((*TTokenCtx)(unsafe.Pointer(pCtx)).FpConfig)).FbTokendata != 0 { + (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FnQueryTerm = int32(libc.Xstrlen(tls, (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpTerm)) + } + libc.Xmemcpy(tls, (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpTerm, pToken, uint64(nToken)) + (*TFts5ExprTerm)(unsafe.Pointer(pSyn)).FpSynonym = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32 + uintptr((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm-int32(1))*40))).FpSynonym + (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32 + uintptr((*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm-int32(1))*40))).FpSynonym = pSyn + } + } else { + if pPhrase == uintptr(0) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm%SZALLOC == 0 { + if pPhrase != 0 { + v2 = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm + } else { + v2 = 0 + } + nNew = SZALLOC + v2 + pNew = Xsqlite3_realloc64(tls, pPhrase, uint64(72)+uint64(40)*uint64(nNew)) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) + } else { + if pPhrase == uintptr(0) { + libc.Xmemset(tls, pNew, 0, uint64(72)) + } + v3 = pNew + pPhrase = v3 + (*TTokenCtx)(unsafe.Pointer(pCtx)).FpPhrase = v3 + (*TFts5ExprPhrase)(unsafe.Pointer(pNew)).FnTerm = nNew - SZALLOC + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + v5 = pPhrase + 24 + v4 = *(*int32)(unsafe.Pointer(v5)) + *(*int32)(unsafe.Pointer(v5))++ + pTerm = pPhrase + 32 + uintptr(v4)*40 + libc.Xmemset(tls, pTerm, 0, uint64(40)) + (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpTerm = _sqlite3Fts5Strndup(tls, bp, pToken, nToken) + v6 = nToken + (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FnQueryTerm = v6 + (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FnFullTerm = v6 + if (*TFts5Config)(unsafe.Pointer((*TTokenCtx)(unsafe.Pointer(pCtx)).FpConfig)).FbTokendata != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FnQueryTerm = int32(libc.Xstrlen(tls, (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpTerm)) + } + } + } + (*TTokenCtx)(unsafe.Pointer(pCtx)).Frc = *(*int32)(unsafe.Pointer(bp)) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Free the phrase object passed as the only argument. +// */ +func _sqlite3Fts5ParsePhraseFree(tls *libc.TLS, pPhrase uintptr) { + _fts5ExprPhraseFree(tls, pPhrase) +} + +// C documentation +// +// /* +// ** Free the phrase object passed as the second argument. +// */ +func _sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { + var i int32 + _ = i + if pNear != 0 { + i = 0 + for { + if !(i < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + _fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(i)*8))) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) + Xsqlite3_free(tls, pNear) + } +} + +func _sqlite3Fts5ParseFinished(tls *libc.TLS, pParse uintptr, p uintptr) { + (*TFts5Parse)(unsafe.Pointer(pParse)).FpExpr = p +} + +func _parseGrowPhraseArray(tls *libc.TLS, pParse uintptr) (r int32) { + var apNew uintptr + var nByte Tsqlite3_int64 + _, _ = apNew, nByte + if (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase%int32(8) == 0 { + nByte = int64(uint64(8) * uint64((*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase+libc.Int32FromInt32(8))) + apNew = Xsqlite3_realloc64(tls, (*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase, uint64(nByte)) + if apNew == uintptr(0) { + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + return int32(SQLITE_NOMEM) + } + (*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase = apNew + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** This function is called by the parser to process a string token. The +// ** string may or may not be quoted. In any case it is tokenized and a +// ** phrase object consisting of all tokens returned. +// */ +func _sqlite3Fts5ParseTerm(tls *libc.TLS, pParse uintptr, pAppend uintptr, pToken uintptr, bPrefix int32) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var flags, n, rc, v1, v2 int32 + var pConfig uintptr + var v3 bool + var _ /* sCtx at bp+0 */ TTokenCtx + var _ /* z at bp+24 */ uintptr + _, _, _, _, _, _, _ = flags, n, pConfig, rc, v1, v2, v3 + pConfig = (*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig /* Tokenize return code */ + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + libc.Xmemset(tls, bp, 0, uint64(24)) + (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase = pAppend + (*(*TTokenCtx)(unsafe.Pointer(bp))).FpConfig = pConfig + rc = _fts5ParseStringFromToken(tls, pToken, bp+24) + if rc == SQLITE_OK { + if bPrefix != 0 { + v1 = int32(FTS5_TOKENIZE_PREFIX) + } else { + v1 = 0 + } + flags = int32(FTS5_TOKENIZE_QUERY) | v1 + _sqlite3Fts5Dequote(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + n = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 24)))) + rc = _sqlite3Fts5Tokenize(tls, pConfig, flags, *(*uintptr)(unsafe.Pointer(bp + 24)), n, bp, __ccgo_fp(_fts5ParseTokenize)) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24))) + if v3 = rc != 0; !v3 { + v2 = (*(*TTokenCtx)(unsafe.Pointer(bp))).Frc + rc = v2 + } + if v3 || v2 != 0 { + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = rc + _fts5ExprPhraseFree(tls, (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase) + (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase = uintptr(0) + } else { + if pAppend == uintptr(0) { + if _parseGrowPhraseArray(tls, pParse) != 0 { + _fts5ExprPhraseFree(tls, (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase) + return uintptr(0) + } + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase++ + } + if (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase == uintptr(0) { + /* This happens when parsing a token or quoted phrase that contains + ** no token characters at all. (e.g ... MATCH '""'). */ + (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase = _sqlite3Fts5MallocZero(tls, pParse+16, int64(72)) + } else { + if (*TFts5ExprPhrase)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase)).FnTerm != 0 { + (*(*TFts5ExprTerm)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase + 32 + uintptr((*TFts5ExprPhrase)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase)).FnTerm-int32(1))*40))).FbPrefix = uint8(bPrefix) + } + } + *(*uintptr)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr((*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-int32(1))*8)) = (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase + } + return (*(*TTokenCtx)(unsafe.Pointer(bp))).FpPhrase +} + +// C documentation +// +// /* +// ** Create a new FTS5 expression by cloning phrase iPhrase of the +// ** expression passed as the second argument. +// */ +func _sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, ppNew uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, tflags int32 + var nByte Tsqlite3_int64 + var p, pColset, pColsetOrig, pNew, pOrig uintptr + var _ /* rc at bp+0 */ int32 + var _ /* sCtx at bp+8 */ TTokenCtx + _, _, _, _, _, _, _, _ = i, nByte, p, pColset, pColsetOrig, pNew, pOrig, tflags + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* Return code */ + pOrig = uintptr(0) /* The phrase extracted from pExpr */ + pNew = uintptr(0) /* Expression to return via *ppNew */ + *(*TTokenCtx)(unsafe.Pointer(bp + 8)) = TTokenCtx{} /* Context object for fts5ParseTokenize */ + if iPhrase < 0 || iPhrase >= (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase { + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_RANGE) + } else { + pOrig = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + pNew = _sqlite3Fts5MallocZero(tls, bp, int64(40)) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase = _sqlite3Fts5MallocZero(tls, bp, int64(8)) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot = _sqlite3Fts5MallocZero(tls, bp, int64(56)) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear = _sqlite3Fts5MallocZero(tls, bp, int64(libc.Uint64FromInt64(32)+libc.Uint64FromInt64(8))) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && pOrig != uintptr(0) { + pColsetOrig = (*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer((*TFts5ExprPhrase)(unsafe.Pointer(pOrig)).FpNode)).FpNear)).FpColset + if pColsetOrig != 0 { + nByte = int64(uint64(8) + uint64((*TFts5Colset)(unsafe.Pointer(pColsetOrig)).FnCol-libc.Int32FromInt32(1))*uint64(4)) + pColset = _sqlite3Fts5MallocZero(tls, bp, nByte) + if pColset != 0 { + libc.Xmemcpy(tls, pColset, pColsetOrig, uint64(nByte)) + } + (*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear)).FpColset = pColset + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if (*TFts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm != 0 { /* Used to iterate through phrase terms */ + (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpConfig = (*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig + i = 0 + for { + if !(*(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && i < (*TFts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm) { + break + } + tflags = 0 + p = pOrig + 32 + uintptr(i)*40 + for { + if !(p != 0 && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK) { + break + } + *(*int32)(unsafe.Pointer(bp)) = _fts5ParseTokenize(tls, bp+8, tflags, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpTerm, (*TFts5ExprTerm)(unsafe.Pointer(p)).FnFullTerm, 0, 0) + tflags = int32(FTS5_TOKEN_COLOCATED) + goto _2 + _2: + ; + p = (*TFts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*(*TFts5ExprTerm)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase + 32 + uintptr(i)*40))).FbPrefix = (*(*TFts5ExprTerm)(unsafe.Pointer(pOrig + 32 + uintptr(i)*40))).FbPrefix + (*(*TFts5ExprTerm)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase + 32 + uintptr(i)*40))).FbFirst = (*(*TFts5ExprTerm)(unsafe.Pointer(pOrig + 32 + uintptr(i)*40))).FbFirst + } + goto _1 + _1: + ; + i++ + } + } else { + /* This happens when parsing a token or quoted phrase that contains + ** no token characters at all. (e.g ... MATCH '""'). */ + (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase = _sqlite3Fts5MallocZero(tls, bp, int64(72)) + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase != 0 { + /* All the allocations succeeded. Put the expression object together. */ + (*TFts5Expr)(unsafe.Pointer(pNew)).FpIndex = (*TFts5Expr)(unsafe.Pointer(pExpr)).FpIndex + (*TFts5Expr)(unsafe.Pointer(pNew)).FpConfig = (*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig + (*TFts5Expr)(unsafe.Pointer(pNew)).FnPhrase = int32(1) + *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase)) = (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase + *(*uintptr)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear + 24)) = (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase + (*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear)).FnPhrase = int32(1) + (*TFts5ExprPhrase)(unsafe.Pointer((*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase)).FpNode = (*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot + if (*TFts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm == int32(1) && (*(*TFts5ExprTerm)(unsafe.Pointer(pOrig + 32))).FpSynonym == uintptr(0) && int32((*(*TFts5ExprTerm)(unsafe.Pointer(pOrig + 32))).FbFirst) == 0 { + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FeType = int32(FTS5_TERM) + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FxNext = __ccgo_fp(_fts5ExprNodeNext_TERM) + } else { + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FeType = int32(FTS5_STRING) + (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FxNext = __ccgo_fp(_fts5ExprNodeNext_STRING) + } + } else { + _sqlite3Fts5ExprFree(tls, pNew) + _fts5ExprPhraseFree(tls, (*(*TTokenCtx)(unsafe.Pointer(bp + 8))).FpPhrase) + pNew = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Token pTok has appeared in a MATCH expression where the NEAR operator +// ** is expected. If token pTok does not contain "NEAR", store an error +// ** in the pParse object. +// */ +func _sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + if (*TFts5Token)(unsafe.Pointer(pTok)).Fn != int32(4) || libc.Xmemcmp(tls, __ccgo_ts+36001, (*TFts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0 { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+34782, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(pTok)).Fn, (*TFts5Token)(unsafe.Pointer(pTok)).Fp)) + } +} + +func _sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var c int8 + var i, nNear int32 + _, _, _ = c, i, nNear + if pNear != 0 { + nNear = 0 + if (*TFts5Token)(unsafe.Pointer(p)).Fn != 0 { + i = 0 + for { + if !(i < (*TFts5Token)(unsafe.Pointer(p)).Fn) { + break + } + c = *(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) + if int32(c) < int32('0') || int32(c) > int32('9') { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36006, libc.VaList(bp+8, (*TFts5Token)(unsafe.Pointer(p)).Fn, (*TFts5Token)(unsafe.Pointer(p)).Fp)) + return + } + nNear = nNear*int32(10) + (int32(*(*int8)(unsafe.Pointer((*TFts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - int32('0')) + goto _1 + _1: + ; + i++ + } + } else { + nNear = int32(FTS5_DEFAULT_NEARDIST) + } + (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnNear = nNear + } +} + +// C documentation +// +// /* +// ** The second argument passed to this function may be NULL, or it may be +// ** an existing Fts5Colset object. This function returns a pointer to +// ** a new colset object containing the contents of (p) with new value column +// ** number iCol appended. +// ** +// ** If an OOM error occurs, store an error code in pParse and return NULL. +// ** The old colset object (if any) is not freed in this case. +// */ +func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r uintptr) { + var aiCol, pNew uintptr + var i, j, nCol, v1 int32 + _, _, _, _, _, _ = aiCol, i, j, nCol, pNew, v1 + if p != 0 { + v1 = (*TFts5Colset)(unsafe.Pointer(p)).FnCol + } else { + v1 = 0 + } + nCol = v1 /* New colset object to return */ + pNew = Xsqlite3_realloc64(tls, p, uint64(8)+uint64(4)*uint64(nCol)) + if pNew == uintptr(0) { + (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) + } else { + aiCol = pNew + 4 + i = 0 + for { + if !(i < nCol) { + break + } + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) == iCol { + return pNew + } + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) > iCol { + break + } + goto _2 + _2: + ; + i++ + } + j = nCol + for { + if !(j > i) { + break + } + *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr(j-int32(1))*4)) + goto _3 + _3: + ; + j-- + } + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol + (*TFts5Colset)(unsafe.Pointer(pNew)).FnCol = nCol + int32(1) + } + return pNew +} + +// C documentation +// +// /* +// ** Allocate and return an Fts5Colset object specifying the inverse of +// ** the colset passed as the second argument. Free the colset passed +// ** as the second argument before returning. +// */ +func _sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) (r uintptr) { + var i, iOld, nCol, v2 int32 + var pRet, v3 uintptr + _, _, _, _, _, _ = i, iOld, nCol, pRet, v2, v3 + nCol = (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FnCol + pRet = _sqlite3Fts5MallocZero(tls, pParse+16, int64(uint64(8)+uint64(4)*uint64(nCol))) + if pRet != 0 { + iOld = 0 + i = 0 + for { + if !(i < nCol) { + break + } + if iOld >= (*TFts5Colset)(unsafe.Pointer(p)).FnCol || *(*int32)(unsafe.Pointer(p + 4 + uintptr(iOld)*4)) != i { + v3 = pRet + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*int32)(unsafe.Pointer(pRet + 4 + uintptr(v2)*4)) = i + } else { + iOld++ + } + goto _1 + _1: + ; + i++ + } + } + Xsqlite3_free(tls, p) + return pRet +} + +func _sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iCol int32 + var pConfig, pRet, z uintptr + _, _, _, _ = iCol, pConfig, pRet, z + pRet = uintptr(0) /* Dequoted copy of token p */ + z = _sqlite3Fts5Strndup(tls, pParse+16, (*TFts5Token)(unsafe.Pointer(p)).Fp, (*TFts5Token)(unsafe.Pointer(p)).Fn) + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + pConfig = (*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig + _sqlite3Fts5Dequote(tls, z) + iCol = 0 + for { + if !(iCol < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { + break + } + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(iCol)*8)), z) { + break + } + goto _1 + _1: + ; + iCol++ + } + if iCol == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+21048, libc.VaList(bp+8, z)) + } else { + pRet = _fts5ParseColset(tls, pParse, pColset, iCol) + } + Xsqlite3_free(tls, z) + } + if pRet == uintptr(0) { + Xsqlite3_free(tls, pColset) + } + return pRet +} + +// C documentation +// +// /* +// ** If argument pOrig is NULL, or if (*pRc) is set to anything other than +// ** SQLITE_OK when this function is called, NULL is returned. +// ** +// ** Otherwise, a copy of (*pOrig) is made into memory obtained from +// ** sqlite3Fts5MallocZero() and a pointer to it returned. If the allocation +// ** fails, (*pRc) is set to SQLITE_NOMEM and NULL is returned. +// */ +func _fts5CloneColset(tls *libc.TLS, pRc uintptr, pOrig uintptr) (r uintptr) { + var nByte Tsqlite3_int64 + var pRet uintptr + _, _ = nByte, pRet + if pOrig != 0 { + nByte = int64(uint64(8) + uint64((*TFts5Colset)(unsafe.Pointer(pOrig)).FnCol-libc.Int32FromInt32(1))*uint64(4)) + pRet = _sqlite3Fts5MallocZero(tls, pRc, nByte) + if pRet != 0 { + libc.Xmemcpy(tls, pRet, pOrig, uint64(nByte)) + } + } else { + pRet = uintptr(0) + } + return pRet +} + +// C documentation +// +// /* +// ** Remove from colset pColset any columns that are not also in colset pMerge. +// */ +func _fts5MergeColset(tls *libc.TLS, pColset uintptr, pMerge uintptr) { + var iDiff, iIn, iMerge, iOut, v1 int32 + _, _, _, _, _ = iDiff, iIn, iMerge, iOut, v1 + iIn = 0 /* Next input in pColset */ + iMerge = 0 /* Next input in pMerge */ + iOut = 0 /* Next output slot in pColset */ + for iIn < (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol && iMerge < (*TFts5Colset)(unsafe.Pointer(pMerge)).FnCol { + iDiff = *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(iIn)*4)) - *(*int32)(unsafe.Pointer(pMerge + 4 + uintptr(iMerge)*4)) + if iDiff == 0 { + v1 = iOut + iOut++ + *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(v1)*4)) = *(*int32)(unsafe.Pointer(pMerge + 4 + uintptr(iMerge)*4)) + iMerge++ + iIn++ + } else { + if iDiff > 0 { + iMerge++ + } else { + iIn++ + } + } + } + (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol = iOut +} + +// C documentation +// +// /* +// ** Recursively apply colset pColset to expression node pNode and all of +// ** its decendents. If (*ppFree) is not NULL, it contains a spare copy +// ** of pColset. This function may use the spare copy and set (*ppFree) to +// ** zero, or it may create copies of pColset using fts5CloneColset(). +// */ +func _fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset uintptr, ppFree uintptr) { + var i int32 + var pNear uintptr + _, _ = i, pNear + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_STRING) || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType == int32(FTS5_TERM) { + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset != 0 { + _fts5MergeColset(tls, (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset, pColset) + if (*TFts5Colset)(unsafe.Pointer((*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset)).FnCol == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType = FTS5_EOF + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = uintptr(0) + } + } else { + if *(*uintptr)(unsafe.Pointer(ppFree)) != 0 { + (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset = pColset + *(*uintptr)(unsafe.Pointer(ppFree)) = uintptr(0) + } else { + (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FpColset = _fts5CloneColset(tls, pParse+16, pColset) + } + } + } else { + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + _fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), pColset, ppFree) + goto _1 + _1: + ; + i++ + } + } + } +} + +// C documentation +// +// /* +// ** Apply colset pColset to expression node pExpr and all of its descendents. +// */ +func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pColset uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* pFree at bp+0 */ uintptr + *(*uintptr)(unsafe.Pointer(bp)) = pColset + if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36035, 0) + } else { + _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp))) +} + +func _fts5ExprAssignXNext(tls *libc.TLS, pNode uintptr) { + var pNear uintptr + _ = pNear + switch (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case int32(FTS5_STRING): + pNear = (*TFts5ExprNode)(unsafe.Pointer(pNode)).FpNear + if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) && (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)))).FnTerm == int32(1) && (*(*TFts5ExprTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)) + 32))).FpSynonym == uintptr(0) && int32((*(*TFts5ExprTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)) + 32))).FbFirst) == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FeType = int32(FTS5_TERM) + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_TERM) + } else { + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_STRING) + } + case int32(FTS5_OR): + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_OR) + case int32(FTS5_AND): + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_AND) + default: + (*TFts5ExprNode)(unsafe.Pointer(pNode)).FxNext = __ccgo_fp(_fts5ExprNodeNext_NOT) + break + } +} + +func _fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { + var ii, nByte, v1, v4 int32 + var v2 uintptr + _, _, _, _, _ = ii, nByte, v1, v2, v4 + ii = (*TFts5ExprNode)(unsafe.Pointer(p)).FnChild + if (*TFts5ExprNode)(unsafe.Pointer(p)).FeType != int32(FTS5_NOT) && (*TFts5ExprNode)(unsafe.Pointer(pSub)).FeType == (*TFts5ExprNode)(unsafe.Pointer(p)).FeType { + nByte = int32(uint64(8) * uint64((*TFts5ExprNode)(unsafe.Pointer(pSub)).FnChild)) + libc.Xmemcpy(tls, p+48+uintptr((*TFts5ExprNode)(unsafe.Pointer(p)).FnChild)*8, pSub+48, uint64(nByte)) + *(*int32)(unsafe.Pointer(p + 40)) += (*TFts5ExprNode)(unsafe.Pointer(pSub)).FnChild + Xsqlite3_free(tls, pSub) + } else { + v2 = p + 40 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*uintptr)(unsafe.Pointer(p + 48 + uintptr(v1)*8)) = pSub + } + for { + if !(ii < (*TFts5ExprNode)(unsafe.Pointer(p)).FnChild) { + break + } + if (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight > (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 48 + uintptr(ii)*8)))).FiHeight+int32(1) { + v4 = (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight + } else { + v4 = (*TFts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 48 + uintptr(ii)*8)))).FiHeight + int32(1) + } + (*TFts5ExprNode)(unsafe.Pointer(p)).FiHeight = v4 + goto _3 + _3: + ; + ii++ + } +} + +// C documentation +// +// /* +// ** This function is used when parsing LIKE or GLOB patterns against +// ** trigram indexes that specify either detail=column or detail=none. +// ** It converts a phrase: +// ** +// ** abc + def + ghi +// ** +// ** into an AND tree: +// ** +// ** abc AND def AND ghi +// */ +func _fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) (r uintptr) { + var ii, nByte, nTerm, v2 int32 + var p, pPhrase, pRet, pTo, v3 uintptr + _, _, _, _, _, _, _, _, _ = ii, nByte, nTerm, p, pPhrase, pRet, pTo, v2, v3 + nTerm = (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)))).FnTerm + nByte = int32(uint64(56) + uint64(nTerm)*uint64(8)) + pRet = _sqlite3Fts5MallocZero(tls, pParse+16, int64(nByte)) + if pRet != 0 { + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FeType = int32(FTS5_AND) + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FnChild = nTerm + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight = int32(1) + _fts5ExprAssignXNext(tls, pRet) + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + ii = 0 + for { + if !(ii < nTerm) { + break + } + pPhrase = _sqlite3Fts5MallocZero(tls, pParse+16, int64(72)) + if pPhrase != 0 { + if _parseGrowPhraseArray(tls, pParse) != 0 { + _fts5ExprPhraseFree(tls, pPhrase) + } else { + p = *(*uintptr)(unsafe.Pointer(pNear + 24)) + 32 + uintptr(ii)*40 + pTo = pPhrase + 32 + v3 = pParse + 20 + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*uintptr)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr(v2)*8)) = pPhrase + (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm = int32(1) + (*TFts5ExprTerm)(unsafe.Pointer(pTo)).FpTerm = _sqlite3Fts5Strndup(tls, pParse+16, (*TFts5ExprTerm)(unsafe.Pointer(p)).FpTerm, (*TFts5ExprTerm)(unsafe.Pointer(p)).FnFullTerm) + (*TFts5ExprTerm)(unsafe.Pointer(pTo)).FnQueryTerm = (*TFts5ExprTerm)(unsafe.Pointer(p)).FnQueryTerm + (*TFts5ExprTerm)(unsafe.Pointer(pTo)).FnFullTerm = (*TFts5ExprTerm)(unsafe.Pointer(p)).FnFullTerm + *(*uintptr)(unsafe.Pointer(pRet + 48 + uintptr(ii)*8)) = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_STRING), uintptr(0), uintptr(0), _sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), pPhrase)) + } + } + goto _1 + _1: + ; + ii++ + } + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { + _sqlite3Fts5ParseNodeFree(tls, pRet) + pRet = uintptr(0) + } else { + _sqlite3Fts5ParseNearsetFree(tls, pNear) + } + } + return pRet +} + +// C documentation +// +// /* +// ** Allocate and return a new expression object. If anything goes wrong (i.e. +// ** OOM error), leave an error code in pParse and return NULL. +// */ +func _sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uintptr, pRight uintptr, pNear uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPhrase, nChild int32 + var nByte Tsqlite3_int64 + var pPhrase, pRet, v2 uintptr + _, _, _, _, _, _ = iPhrase, nByte, nChild, pPhrase, pRet, v2 + pRet = uintptr(0) + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + nChild = 0 /* Bytes of space to allocate for this node */ + if eType == int32(FTS5_STRING) && pNear == uintptr(0) { + return uintptr(0) + } + if eType != int32(FTS5_STRING) && pLeft == uintptr(0) { + return pRight + } + if eType != int32(FTS5_STRING) && pRight == uintptr(0) { + return pLeft + } + if eType == int32(FTS5_STRING) && (*TFts5Parse)(unsafe.Pointer(pParse)).FbPhraseToAnd != 0 && (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24)))).FnTerm > int32(1) { + pRet = _fts5ParsePhraseToAnd(tls, pParse, pNear) + } else { + if eType == int32(FTS5_NOT) { + nChild = int32(2) + } else { + if eType == int32(FTS5_AND) || eType == int32(FTS5_OR) { + nChild = int32(2) + if (*TFts5ExprNode)(unsafe.Pointer(pLeft)).FeType == eType { + nChild += (*TFts5ExprNode)(unsafe.Pointer(pLeft)).FnChild - int32(1) + } + if (*TFts5ExprNode)(unsafe.Pointer(pRight)).FeType == eType { + nChild += (*TFts5ExprNode)(unsafe.Pointer(pRight)).FnChild - int32(1) + } + } + } + nByte = int64(uint64(56) + uint64(8)*uint64(nChild-libc.Int32FromInt32(1))) + pRet = _sqlite3Fts5MallocZero(tls, pParse+16, nByte) + if pRet != 0 { + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FeType = eType + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FpNear = pNear + _fts5ExprAssignXNext(tls, pRet) + if eType == int32(FTS5_STRING) { + iPhrase = 0 + for { + if !(iPhrase < (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + break + } + (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(iPhrase)*8)))).FpNode = pRet + if (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNear + 24 + uintptr(iPhrase)*8)))).FnTerm == 0 { + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FxNext = uintptr(0) + (*TFts5ExprNode)(unsafe.Pointer(pRet)).FeType = FTS5_EOF + } + goto _1 + _1: + ; + iPhrase++ + } + if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { + pPhrase = *(*uintptr)(unsafe.Pointer(pNear + 24)) + if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > int32(1) || (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0 && (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FbFirst != 0 { + if (*TFts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == int32(1) { + v2 = __ccgo_ts + 36088 + } else { + v2 = __ccgo_ts + 36001 + } + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36095, libc.VaList(bp+8, v2)) + Xsqlite3_free(tls, pRet) + pRet = uintptr(0) + } + } + } else { + _fts5ExprAddChildren(tls, pRet, pLeft) + _fts5ExprAddChildren(tls, pRet, pRight) + if (*TFts5ExprNode)(unsafe.Pointer(pRet)).FiHeight > int32(SQLITE_FTS5_MAX_EXPR_DEPTH) { + _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+36145, libc.VaList(bp+8, int32(SQLITE_FTS5_MAX_EXPR_DEPTH))) + Xsqlite3_free(tls, pRet) + pRet = uintptr(0) + } + } + } + } + } + if pRet == uintptr(0) { + _sqlite3Fts5ParseNodeFree(tls, pLeft) + _sqlite3Fts5ParseNodeFree(tls, pRight) + _sqlite3Fts5ParseNearsetFree(tls, pNear) + } + return pRet +} + +func _sqlite3Fts5ParseImplicitAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) (r uintptr) { + var ap, pPrev, pRet uintptr + _, _, _ = ap, pPrev, pRet + pRet = uintptr(0) + if (*TFts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { + _sqlite3Fts5ParseNodeFree(tls, pLeft) + _sqlite3Fts5ParseNodeFree(tls, pRight) + } else { + if (*TFts5ExprNode)(unsafe.Pointer(pLeft)).FeType == int32(FTS5_AND) { + pPrev = *(*uintptr)(unsafe.Pointer(pLeft + 48 + uintptr((*TFts5ExprNode)(unsafe.Pointer(pLeft)).FnChild-int32(1))*8)) + } else { + pPrev = pLeft + } + if (*TFts5ExprNode)(unsafe.Pointer(pRight)).FeType == FTS5_EOF { + _sqlite3Fts5ParseNodeFree(tls, pRight) + pRet = pLeft + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + } else { + if (*TFts5ExprNode)(unsafe.Pointer(pPrev)).FeType == FTS5_EOF { + if pPrev == pLeft { + pRet = pRight + } else { + *(*uintptr)(unsafe.Pointer(pLeft + 48 + uintptr((*TFts5ExprNode)(unsafe.Pointer(pLeft)).FnChild-int32(1))*8)) = pRight + pRet = pLeft + } + ap = (*TFts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr((*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-int32(1)-(*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase)*8 + libc.Xmemmove(tls, ap, ap+1*8, uint64(8)*uint64((*TFts5ExprNearset)(unsafe.Pointer((*TFts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase)) + (*TFts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + _sqlite3Fts5ParseNodeFree(tls, pPrev) + } else { + pRet = _sqlite3Fts5ParseNode(tls, pParse, int32(FTS5_AND), pLeft, pRight, uintptr(0)) + } + } + } + return pRet +} + +// C documentation +// +// /* +// ** This is called during initialization to register the fts5_expr() scalar +// ** UDF with the SQLite handle passed as the only argument. +// */ +func _sqlite3Fts5ExprInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + _ = pGlobal + _ = db + /* Avoid warnings indicating that sqlite3Fts5ParserTrace() and + ** sqlite3Fts5ParserFallback() are unused */ + _ = __ccgo_fp(_sqlite3Fts5ParserFallback) + return rc +} + +// C documentation +// +// /* +// ** Return the number of phrases in expression pExpr. +// */ +func _sqlite3Fts5ExprPhraseCount(tls *libc.TLS, pExpr uintptr) (r int32) { + var v1 int32 + _ = v1 + if pExpr != 0 { + v1 = (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Return the number of terms in the iPhrase'th phrase in pExpr. +// */ +func _sqlite3Fts5ExprPhraseSize(tls *libc.TLS, pExpr uintptr, iPhrase int32) (r int32) { + if iPhrase < 0 || iPhrase >= (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase { + return 0 + } + return (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)))).FnTerm +} + +// C documentation +// +// /* +// ** This function is used to access the current position list for phrase +// ** iPhrase. +// */ +func _sqlite3Fts5ExprPoslist(tls *libc.TLS, pExpr uintptr, iPhrase int32, pa uintptr) (r int32) { + var nRet int32 + var pNode, pPhrase uintptr + _, _, _ = nRet, pNode, pPhrase + pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + pNode = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FpNode + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 && (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid == (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid { + *(*uintptr)(unsafe.Pointer(pa)) = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fp + nRet = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn + } else { + *(*uintptr)(unsafe.Pointer(pa)) = uintptr(0) + nRet = 0 + } + return nRet +} + +type TFts5PoslistPopulator1 = struct { + Fwriter TFts5PoslistWriter + FbOk int32 + FbMiss int32 +} + +type Fts5PoslistPopulator1 = TFts5PoslistPopulator1 + +// C documentation +// +// /* +// ** Clear the position lists associated with all phrases in the expression +// ** passed as the first argument. Argument bLive is true if the expression +// ** might be pointing to a real entry, otherwise it has just been reset. +// ** +// ** At present this function is only used for detail=col and detail=none +// ** fts5 tables. This implies that all phrases must be at most 1 token +// ** in size, as phrase matches are not supported without detail=full. +// */ +func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r uintptr) { + var i int32 + var pBuf, pNode, pRet uintptr + _, _, _, _ = i, pBuf, pNode, pRet + pRet = Xsqlite3_malloc64(tls, uint64(16)*uint64((*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase)) + if pRet != 0 { + libc.Xmemset(tls, pRet, 0, uint64(16)*uint64((*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase)) + i = 0 + for { + if !(i < (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase) { + break + } + pBuf = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 8 + pNode = (*TFts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)))).FpNode + if bLive != 0 && ((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn == 0 || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid != (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid || (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof != 0) { + (*(*TFts5PoslistPopulator)(unsafe.Pointer(pRet + uintptr(i)*16))).FbMiss = int32(1) + } else { + (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 + } + goto _1 + _1: + ; + i++ + } + } + return pRet +} + +type TFts5ExprCtx1 = struct { + FpExpr uintptr + FaPopulator uintptr + FiOff Ti64 +} + +type Fts5ExprCtx1 = TFts5ExprCtx1 + +type TFts5ExprCtx = struct { + FpExpr uintptr + FaPopulator uintptr + FiOff Ti64 +} + +type Fts5ExprCtx = TFts5ExprCtx + +// C documentation +// +// /* +// ** TODO: Make this more efficient! +// */ +func _fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol) { + break + } + if *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(i)*4)) == iCol { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +// C documentation +// +// /* +// ** pToken is a buffer nToken bytes in size that may or may not contain +// ** an embedded 0x00 byte. If it does, return the number of bytes in +// ** the buffer before the 0x00. If it does not, return nToken. +// */ +func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { + var ii int32 + _ = ii + ii = 0 + for { + if !(ii < nToken && *(*int8)(unsafe.Pointer(pToken + uintptr(ii))) != 0) { + break + } + goto _1 + _1: + ; + ii++ + } + return ii +} + +func _fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) (r int32) { + var i, iCol, iTokOff, nQuery, rc int32 + var iRowid Ti64 + var p, pExpr, pT uintptr + _, _, _, _, _, _, _, _, _ = i, iCol, iRowid, iTokOff, nQuery, p, pExpr, pT, rc + p = pCtx + pExpr = (*TFts5ExprCtx)(unsafe.Pointer(p)).FpExpr + nQuery = nToken + iRowid = (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid + _ = iUnused1 + _ = iUnused2 + if nQuery > int32(FTS5_MAX_TOKEN_SIZE) { + nQuery = int32(FTS5_MAX_TOKEN_SIZE) + } + if (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FbTokendata != 0 { + nQuery = _fts5QueryTerm(tls, pToken, nQuery) + } + if tflags&int32(FTS5_TOKEN_COLOCATED) == 0 { + (*TFts5ExprCtx)(unsafe.Pointer(p)).FiOff++ + } + i = 0 + for { + if !(i < (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase) { + break + } + if (*(*TFts5PoslistPopulator)(unsafe.Pointer((*TFts5ExprCtx)(unsafe.Pointer(p)).FaPopulator + uintptr(i)*16))).FbOk == 0 { + goto _1 + } + pT = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 32 + for { + if !(pT != 0) { + break + } + if ((*TFts5ExprTerm)(unsafe.Pointer(pT)).FnQueryTerm == nQuery || (*TFts5ExprTerm)(unsafe.Pointer(pT)).FnQueryTerm < nQuery && (*TFts5ExprTerm)(unsafe.Pointer(pT)).FbPrefix != 0) && libc.Xmemcmp(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpTerm, pToken, uint64((*TFts5ExprTerm)(unsafe.Pointer(pT)).FnQueryTerm)) == 0 { + rc = _sqlite3Fts5PoslistWriterAppend(tls, *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8))+8, (*TFts5ExprCtx)(unsafe.Pointer(p)).FaPopulator+uintptr(i)*16, (*TFts5ExprCtx)(unsafe.Pointer(p)).FiOff) + if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FbTokendata != 0 && !((*TFts5ExprTerm)(unsafe.Pointer(pT)).FbPrefix != 0) { + iCol = int32((*TFts5ExprCtx)(unsafe.Pointer(p)).FiOff >> int32(32)) + iTokOff = int32((*TFts5ExprCtx)(unsafe.Pointer(p)).FiOff & int64(0x7FFFFFFF)) + rc = _sqlite3Fts5IndexIterWriteTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter, pToken, nToken, iRowid, iCol, iTokOff) + } + if rc != 0 { + return rc + } + break + } + goto _2 + _2: + ; + pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym + } + goto _1 + _1: + ; + i++ + } + return SQLITE_OK +} + +func _sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uintptr, aPopulator uintptr, iCol int32, z uintptr, n int32) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var pColset, pNode uintptr + var _ /* sCtx at bp+0 */ TFts5ExprCtx + _, _, _ = i, pColset, pNode + (*(*TFts5ExprCtx)(unsafe.Pointer(bp))).FpExpr = pExpr + (*(*TFts5ExprCtx)(unsafe.Pointer(bp))).FaPopulator = aPopulator + (*(*TFts5ExprCtx)(unsafe.Pointer(bp))).FiOff = int64(iCol)< 0) + case int32(FTS5_AND): + i = 0 + for { + if !(i < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + if _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i)*8)), iRowid) == 0 { + _fts5ExprClearPoslists(tls, pNode) + return 0 + } + goto _1 + _1: + ; + i++ + } + case int32(FTS5_OR): + bRet = 0 + i1 = 0 + for { + if !(i1 < (*TFts5ExprNode)(unsafe.Pointer(pNode)).FnChild) { + break + } + if _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + uintptr(i1)*8)), iRowid) != 0 { + bRet = int32(1) + } + goto _2 + _2: + ; + i1++ + } + return bRet + default: + if 0 == _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48)), iRowid) || 0 != _fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer(pNode + 48 + 1*8)), iRowid) { + _fts5ExprClearPoslists(tls, pNode) + return 0 + } + break + } + return int32(1) +} + +func _sqlite3Fts5ExprCheckPoslists(tls *libc.TLS, pExpr uintptr, iRowid Ti64) { + _fts5ExprCheckPoslists(tls, (*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot, iRowid) +} + +// C documentation +// +// /* +// ** This function is only called for detail=columns tables. +// */ +func _sqlite3Fts5ExprPhraseCollist(tls *libc.TLS, pExpr uintptr, iPhrase int32, ppCollist uintptr, pnCollist uintptr) (r int32) { + var pBuf, pNode, pPhrase, pTerm uintptr + var rc int32 + _, _, _, _, _ = pBuf, pNode, pPhrase, pTerm, rc + pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + pNode = (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FpNode + rc = SQLITE_OK + if (*TFts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 && (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid == (*TFts5ExprNode)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid && (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn > 0 { + pTerm = pPhrase + 32 + if (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + pBuf = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym + 1*40 + rc = _fts5ExprSynonymList(tls, pTerm, (*TFts5ExprNode)(unsafe.Pointer(pNode)).FiRowid, pBuf, ppCollist, pnCollist) + } else { + *(*uintptr)(unsafe.Pointer(ppCollist)) = (*TFts5IndexIter)(unsafe.Pointer((*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FpIter)).FpData + *(*int32)(unsafe.Pointer(pnCollist)) = (*TFts5IndexIter)(unsafe.Pointer((*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32))).FpIter)).FnData + } + } else { + *(*uintptr)(unsafe.Pointer(ppCollist)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCollist)) = 0 + } + return rc +} + +// C documentation +// +// /* +// ** Does the work of the fts5_api.xQueryToken() API method. +// */ +func _sqlite3Fts5ExprQueryToken(tls *libc.TLS, pExpr uintptr, iPhrase int32, iToken int32, ppOut uintptr, pnOut uintptr) (r int32) { + var pPhrase uintptr + _ = pPhrase + pPhrase = uintptr(0) + if iPhrase < 0 || iPhrase >= (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase { + return int32(SQLITE_RANGE) + } + pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + if iToken < 0 || iToken >= (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm { + return int32(SQLITE_RANGE) + } + *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32 + uintptr(iToken)*40))).FpTerm + *(*int32)(unsafe.Pointer(pnOut)) = (*(*TFts5ExprTerm)(unsafe.Pointer(pPhrase + 32 + uintptr(iToken)*40))).FnFullTerm + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Does the work of the fts5_api.xInstToken() API method. +// */ +func _sqlite3Fts5ExprInstToken(tls *libc.TLS, pExpr uintptr, iRowid Ti64, iPhrase int32, iCol int32, iOff int32, iToken int32, ppOut uintptr, pnOut uintptr) (r int32) { + var pPhrase, pTerm uintptr + var rc int32 + _, _, _ = pPhrase, pTerm, rc + pPhrase = uintptr(0) + pTerm = uintptr(0) + rc = SQLITE_OK + if iPhrase < 0 || iPhrase >= (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase { + return int32(SQLITE_RANGE) + } + pPhrase = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + if iToken < 0 || iToken >= (*TFts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm { + return int32(SQLITE_RANGE) + } + pTerm = pPhrase + 32 + uintptr(iToken)*40 + if int32((*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FbPrefix) == 0 { + if (*TFts5Config)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FbTokendata != 0 { + rc = _sqlite3Fts5IterToken(tls, (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter, iRowid, iCol, iOff+iToken, ppOut, pnOut) + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FpTerm + *(*int32)(unsafe.Pointer(pnOut)) = (*TFts5ExprTerm)(unsafe.Pointer(pTerm)).FnFullTerm + } + } + return rc +} + +// C documentation +// +// /* +// ** Clear the token mappings for all Fts5IndexIter objects mannaged by +// ** the expression passed as the only argument. +// */ +func _sqlite3Fts5ExprClearTokens(tls *libc.TLS, pExpr uintptr) { + var ii int32 + var pT uintptr + _, _ = ii, pT + ii = 0 + for { + if !(ii < (*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase) { + break + } + pT = *(*uintptr)(unsafe.Pointer((*TFts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(ii)*8)) + 32 + for { + if !(pT != 0) { + break + } + _sqlite3Fts5IndexIterClearTokendata(tls, (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpIter) + goto _2 + _2: + ; + pT = (*TFts5ExprTerm)(unsafe.Pointer(pT)).FpSynonym + } + goto _1 + _1: + ; + ii++ + } +} + +/* +** 2014 August 11 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** + */ + +/* #include "fts5Int.h" */ + +type TFts5HashEntry = struct { + FpHashNext uintptr + FpScanNext uintptr + FnAlloc int32 + FiSzPoslist int32 + FnData int32 + FnKey int32 + FbDel Tu8 + FbContent Tu8 + FiCol Ti16 + FiPos int32 + FiRowid Ti64 +} + +type Fts5HashEntry = TFts5HashEntry + +/* +** This file contains the implementation of an in-memory hash table used +** to accumuluate "term -> doclist" content before it is flused to a level-0 +** segment. + */ + +type TFts5Hash1 = struct { + FeDetail int32 + FpnByte uintptr + FnEntry int32 + FnSlot int32 + FpScan uintptr + FaSlot uintptr +} + +type Fts5Hash1 = TFts5Hash1 + +/* +** Each entry in the hash table is represented by an object of the +** following type. Each object, its key, and its current data are stored +** in a single memory allocation. The key immediately follows the object +** in memory. The position list data immediately follows the key data +** in memory. +** +** The key is Fts5HashEntry.nKey bytes in size. It consists of a single +** byte identifying the index (either the main term index or a prefix-index), +** followed by the term data. For example: "0token". There is no +** nul-terminator - in this case nKey=6. +** +** The data that follows the key is in a similar, but not identical format +** to the doclist data stored in the database. It is: +** +** * Rowid, as a varint +** * Position list, without 0x00 terminator. +** * Size of previous position list and rowid, as a 4 byte +** big-endian integer. +** +** iRowidOff: +** Offset of last rowid written to data area. Relative to first byte of +** structure. +** +** nData: +** Bytes of data written since iRowidOff. + */ +type TFts5HashEntry1 = struct { + FpHashNext uintptr + FpScanNext uintptr + FnAlloc int32 + FiSzPoslist int32 + FnData int32 + FnKey int32 + FbDel Tu8 + FbContent Tu8 + FiCol Ti16 + FiPos int32 + FiRowid Ti64 +} + +type Fts5HashEntry1 = TFts5HashEntry1 + +/* +** Eqivalent to: +** +** char *fts5EntryKey(Fts5HashEntry *pEntry){ return zKey; } + */ + +// C documentation +// +// /* +// ** Allocate a new hash table. +// */ +func _sqlite3Fts5HashNew(tls *libc.TLS, pConfig uintptr, ppNew uintptr, pnByte uintptr) (r int32) { + var nByte Tsqlite3_int64 + var pNew, v1 uintptr + var rc int32 + _, _, _, _ = nByte, pNew, rc, v1 + rc = SQLITE_OK + v1 = Xsqlite3_malloc(tls, int32(40)) + pNew = v1 + *(*uintptr)(unsafe.Pointer(ppNew)) = v1 + if pNew == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, pNew, 0, uint64(40)) + (*TFts5Hash)(unsafe.Pointer(pNew)).FpnByte = pnByte + (*TFts5Hash)(unsafe.Pointer(pNew)).FeDetail = (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail + (*TFts5Hash)(unsafe.Pointer(pNew)).FnSlot = int32(1024) + nByte = int64(uint64(8) * uint64((*TFts5Hash)(unsafe.Pointer(pNew)).FnSlot)) + (*TFts5Hash)(unsafe.Pointer(pNew)).FaSlot = Xsqlite3_malloc64(tls, uint64(nByte)) + if (*TFts5Hash)(unsafe.Pointer(pNew)).FaSlot == uintptr(0) { + Xsqlite3_free(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppNew)) = uintptr(0) + rc = int32(SQLITE_NOMEM) + } else { + libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pNew)).FaSlot, 0, uint64(nByte)) + } + } + return rc +} + +// C documentation +// +// /* +// ** Free a hash table object. +// */ +func _sqlite3Fts5HashFree(tls *libc.TLS, pHash uintptr) { + if pHash != 0 { + _sqlite3Fts5HashClear(tls, pHash) + Xsqlite3_free(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot) + Xsqlite3_free(tls, pHash) + } +} + +// C documentation +// +// /* +// ** Empty (but do not delete) a hash table. +// */ +func _sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { + var i int32 + var pNext, pSlot uintptr + _, _, _ = i, pNext, pSlot + i = 0 + for { + if !(i < (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot) { + break + } + pSlot = *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(i)*8)) + for { + if !(pSlot != 0) { + break + } + pNext = (*TFts5HashEntry)(unsafe.Pointer(pSlot)).FpHashNext + Xsqlite3_free(tls, pSlot) + goto _2 + _2: + ; + pSlot = pNext + } + goto _1 + _1: + ; + i++ + } + libc.Xmemset(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, uint64((*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot)*uint64(8)) + (*TFts5Hash)(unsafe.Pointer(pHash)).FnEntry = 0 +} + +func _fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) (r uint32) { + var h uint32 + var i int32 + _, _ = h, i + h = uint32(13) + i = n - int32(1) + for { + if !(i >= 0) { + break + } + h = h<= 0) { + break + } + h = h< (iRowid,iCol,iPos) +// ** +// ** Or, if iCol is negative, then the value is a delete marker. +// */ +func _sqlite3Fts5HashWrite(tls *libc.TLS, pHash uintptr, iRowid Ti64, iCol int32, iPos int32, bByte int8, pToken uintptr, nToken int32) (r int32) { + var bNew, nIncr, rc, v2, v4, v5, v7 int32 + var iDiff Tu64 + var iHash uint32 + var nByte, nNew Tsqlite3_int64 + var p, pNew, pPtr, pp, zKey, zKey1, v6 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bNew, iDiff, iHash, nByte, nIncr, nNew, p, pNew, pPtr, pp, rc, zKey, zKey1, v2, v4, v5, v6, v7 + nIncr = 0 /* If non-delete entry should be written */ + bNew = libc.BoolInt32((*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL) + /* Attempt to locate an existing hash entry */ + iHash = _fts5HashKey2(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot, uint8(bByte), pToken, nToken) + p = *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) + for { + if !(p != 0) { + break + } + zKey = p + 1*48 + if int32(*(*int8)(unsafe.Pointer(zKey))) == int32(bByte) && (*TFts5HashEntry)(unsafe.Pointer(p)).FnKey == nToken+int32(1) && libc.Xmemcmp(tls, zKey+1, pToken, uint64(nToken)) == 0 { + break + } + goto _1 + _1: + ; + p = (*TFts5HashEntry)(unsafe.Pointer(p)).FpHashNext + } + /* If an existing hash entry cannot be found, create a new one. */ + if p == uintptr(0) { + nByte = int64(uint64(48) + uint64(nToken+libc.Int32FromInt32(1)) + uint64(1) + uint64(64)) + if nByte < int64(128) { + nByte = int64(128) + } + /* Grow the Fts5Hash.aSlot[] array if necessary. */ + if (*TFts5Hash)(unsafe.Pointer(pHash)).FnEntry*int32(2) >= (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot { + rc = _fts5HashResize(tls, pHash) + if rc != SQLITE_OK { + return rc + } + iHash = _fts5HashKey2(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot, uint8(bByte), pToken, nToken) + } + /* Allocate new Fts5HashEntry and add it to the hash table. */ + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(p != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, p, 0, uint64(48)) + (*TFts5HashEntry)(unsafe.Pointer(p)).FnAlloc = int32(nByte) + zKey1 = p + 1*48 + *(*int8)(unsafe.Pointer(zKey1)) = bByte + libc.Xmemcpy(tls, zKey1+1, pToken, uint64(nToken)) + (*TFts5HashEntry)(unsafe.Pointer(p)).FnKey = nToken + int32(1) + *(*int8)(unsafe.Pointer(zKey1 + uintptr(nToken+int32(1)))) = int8('\000') + (*TFts5HashEntry)(unsafe.Pointer(p)).FnData = int32(uint64(nToken+int32(1)) + uint64(48)) + (*TFts5HashEntry)(unsafe.Pointer(p)).FpHashNext = *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) = p + (*TFts5Hash)(unsafe.Pointer(pHash)).FnEntry++ + /* Add the first rowid field to the hash-entry */ + *(*int32)(unsafe.Pointer(p + 24)) += _sqlite3Fts5PutVarint(tls, p+uintptr((*TFts5HashEntry)(unsafe.Pointer(p)).FnData), uint64(iRowid)) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiRowid = iRowid + (*TFts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist = (*TFts5HashEntry)(unsafe.Pointer(p)).FnData + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail != int32(FTS5_DETAIL_NONE) { + *(*int32)(unsafe.Pointer(p + 24)) += int32(1) + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + v2 = 0 + } else { + v2 = -int32(1) + } + (*TFts5HashEntry)(unsafe.Pointer(p)).FiCol = int16(v2) + } + } else { + /* Appending to an existing hash-entry. Check that there is enough + ** space to append the largest possible new entry. Worst case scenario + ** is: + ** + ** + 9 bytes for a new rowid, + ** + 4 byte reserved for the "poslist size" varint. + ** + 1 byte for a "new column" byte, + ** + 3 bytes for a new column number (16-bit max) as a varint, + ** + 5 bytes for the new position offset (32-bit max). + */ + if (*TFts5HashEntry)(unsafe.Pointer(p)).FnAlloc-(*TFts5HashEntry)(unsafe.Pointer(p)).FnData < libc.Int32FromInt32(9)+libc.Int32FromInt32(4)+libc.Int32FromInt32(1)+libc.Int32FromInt32(3)+libc.Int32FromInt32(5) { + nNew = int64((*TFts5HashEntry)(unsafe.Pointer(p)).FnAlloc * int32(2)) + pNew = Xsqlite3_realloc64(tls, p, uint64(nNew)) + if pNew == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*TFts5HashEntry)(unsafe.Pointer(pNew)).FnAlloc = int32(nNew) + pp = (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != p) { + break + } + goto _3 + _3: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + } + *(*uintptr)(unsafe.Pointer(pp)) = pNew + p = pNew + } + nIncr -= (*TFts5HashEntry)(unsafe.Pointer(p)).FnData + } + pPtr = p + /* If this is a new rowid, append the 4-byte size field for the previous + ** entry, and the new rowid for this entry. */ + if iRowid != (*TFts5HashEntry)(unsafe.Pointer(p)).FiRowid { + iDiff = uint64(iRowid) - uint64((*TFts5HashEntry)(unsafe.Pointer(p)).FiRowid) + _fts5HashAddPoslistSize(tls, pHash, p, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 24)) += _sqlite3Fts5PutVarint(tls, pPtr+uintptr((*TFts5HashEntry)(unsafe.Pointer(p)).FnData), iDiff) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiRowid = iRowid + bNew = int32(1) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist = (*TFts5HashEntry)(unsafe.Pointer(p)).FnData + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail != int32(FTS5_DETAIL_NONE) { + *(*int32)(unsafe.Pointer(p + 24)) += int32(1) + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + v4 = 0 + } else { + v4 = -int32(1) + } + (*TFts5HashEntry)(unsafe.Pointer(p)).FiCol = int16(v4) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiPos = 0 + } + } + if iCol >= 0 { + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail == int32(FTS5_DETAIL_NONE) { + (*TFts5HashEntry)(unsafe.Pointer(p)).FbContent = uint8(1) + } else { + /* Append a new column value, if necessary */ + if iCol != int32((*TFts5HashEntry)(unsafe.Pointer(p)).FiCol) { + if (*TFts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + v6 = p + 24 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + *(*Tu8)(unsafe.Pointer(pPtr + uintptr(v5))) = uint8(0x01) + *(*int32)(unsafe.Pointer(p + 24)) += _sqlite3Fts5PutVarint(tls, pPtr+uintptr((*TFts5HashEntry)(unsafe.Pointer(p)).FnData), uint64(iCol)) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiCol = int16(iCol) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiPos = 0 + } else { + bNew = int32(1) + v7 = iCol + iPos = v7 + (*TFts5HashEntry)(unsafe.Pointer(p)).FiCol = int16(v7) + } + } + /* Append the new position offset, if necessary */ + if bNew != 0 { + *(*int32)(unsafe.Pointer(p + 24)) += _sqlite3Fts5PutVarint(tls, pPtr+uintptr((*TFts5HashEntry)(unsafe.Pointer(p)).FnData), uint64(iPos-(*TFts5HashEntry)(unsafe.Pointer(p)).FiPos+int32(2))) + (*TFts5HashEntry)(unsafe.Pointer(p)).FiPos = iPos + } + } + } else { + /* This is a delete. Set the delete flag. */ + (*TFts5HashEntry)(unsafe.Pointer(p)).FbDel = uint8(1) + } + nIncr += (*TFts5HashEntry)(unsafe.Pointer(p)).FnData + *(*int32)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FpnByte)) += nIncr + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Arguments pLeft and pRight point to linked-lists of hash-entry objects, +// ** each sorted in key order. This function merges the two lists into a +// ** single list and returns a pointer to its first element. +// */ +func _fts5HashEntryMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var cmp, nMin, v1 int32 + var p1, p2, ppOut, zKey1, zKey2 uintptr + var _ /* pRet at bp+0 */ uintptr + _, _, _, _, _, _, _, _ = cmp, nMin, p1, p2, ppOut, zKey1, zKey2, v1 + p1 = pLeft + p2 = pRight + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + ppOut = bp + for p1 != 0 || p2 != 0 { + if p1 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(ppOut)) = p2 + p2 = uintptr(0) + } else { + if p2 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(ppOut)) = p1 + p1 = uintptr(0) + } else { + zKey1 = p1 + 1*48 + zKey2 = p2 + 1*48 + if (*TFts5HashEntry)(unsafe.Pointer(p1)).FnKey < (*TFts5HashEntry)(unsafe.Pointer(p2)).FnKey { + v1 = (*TFts5HashEntry)(unsafe.Pointer(p1)).FnKey + } else { + v1 = (*TFts5HashEntry)(unsafe.Pointer(p2)).FnKey + } + nMin = v1 + cmp = libc.Xmemcmp(tls, zKey1, zKey2, uint64(nMin)) + if cmp == 0 { + cmp = (*TFts5HashEntry)(unsafe.Pointer(p1)).FnKey - (*TFts5HashEntry)(unsafe.Pointer(p2)).FnKey + } + if cmp > 0 { + /* p2 is smaller */ + *(*uintptr)(unsafe.Pointer(ppOut)) = p2 + ppOut = p2 + 8 + p2 = (*TFts5HashEntry)(unsafe.Pointer(p2)).FpScanNext + } else { + /* p1 is smaller */ + *(*uintptr)(unsafe.Pointer(ppOut)) = p1 + ppOut = p1 + 8 + p1 = (*TFts5HashEntry)(unsafe.Pointer(p1)).FpScanNext + } + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + } + } + return *(*uintptr)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Link all tokens from hash table iHash into a list in sorted order. The +// ** tokens are not removed from the hash table. +// */ +func _fts5HashEntrySort(tls *libc.TLS, pHash uintptr, pTerm uintptr, nTerm int32, ppSorted uintptr) (r int32) { + var ap, pEntry, pIter, pList uintptr + var i, iSlot, nMergeSlot int32 + _, _, _, _, _, _, _ = ap, i, iSlot, nMergeSlot, pEntry, pIter, pList + nMergeSlot = int32(32) + *(*uintptr)(unsafe.Pointer(ppSorted)) = uintptr(0) + ap = Xsqlite3_malloc64(tls, uint64(8)*uint64(nMergeSlot)) + if !(ap != 0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, ap, 0, uint64(8)*uint64(nMergeSlot)) + iSlot = 0 + for { + if !(iSlot < (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot) { + break + } + pIter = *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iSlot)*8)) + for { + if !(pIter != 0) { + break + } + if pTerm == uintptr(0) || (*TFts5HashEntry)(unsafe.Pointer(pIter)).FnKey >= nTerm && 0 == libc.Xmemcmp(tls, pIter+1*48, pTerm, uint64(nTerm)) { + pEntry = pIter + (*TFts5HashEntry)(unsafe.Pointer(pEntry)).FpScanNext = uintptr(0) + i = 0 + for { + if !(*(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) != 0) { + break + } + pEntry = _fts5HashEntryMerge(tls, pEntry, *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = uintptr(0) + goto _3 + _3: + ; + i++ + } + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = pEntry + } + goto _2 + _2: + ; + pIter = (*TFts5HashEntry)(unsafe.Pointer(pIter)).FpHashNext + } + goto _1 + _1: + ; + iSlot++ + } + pList = uintptr(0) + i = 0 + for { + if !(i < nMergeSlot) { + break + } + pList = _fts5HashEntryMerge(tls, pList, *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8))) + goto _4 + _4: + ; + i++ + } + Xsqlite3_free(tls, ap) + *(*uintptr)(unsafe.Pointer(ppSorted)) = pList + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Query the hash table for a doclist associated with term pTerm/nTerm. +// */ +func _sqlite3Fts5HashQuery(tls *libc.TLS, pHash uintptr, nPre int32, pTerm uintptr, nTerm int32, ppOut uintptr, pnDoclist uintptr) (r int32) { + var iHash uint32 + var nHashPre, nList int32 + var p, pFaux, pRet, zKey, v2 uintptr + _, _, _, _, _, _, _, _ = iHash, nHashPre, nList, p, pFaux, pRet, zKey, v2 + iHash = _fts5HashKey(tls, (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot, pTerm, nTerm) + zKey = uintptr(0) + p = *(*uintptr)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) + for { + if !(p != 0) { + break + } + zKey = p + 1*48 + if nTerm == (*TFts5HashEntry)(unsafe.Pointer(p)).FnKey && libc.Xmemcmp(tls, zKey, pTerm, uint64(nTerm)) == 0 { + break + } + goto _1 + _1: + ; + p = (*TFts5HashEntry)(unsafe.Pointer(p)).FpHashNext + } + if p != 0 { + nHashPre = int32(uint64(48) + uint64(nTerm)) + nList = (*TFts5HashEntry)(unsafe.Pointer(p)).FnData - nHashPre + v2 = Xsqlite3_malloc64(tls, uint64(nPre+nList+int32(10))) + *(*uintptr)(unsafe.Pointer(ppOut)) = v2 + pRet = v2 + if pRet != 0 { + pFaux = pRet + uintptr(nPre-nHashPre) + libc.Xmemcpy(tls, pRet+uintptr(nPre), p+uintptr(nHashPre), uint64(nList)) + nList += _fts5HashAddPoslistSize(tls, pHash, p, pFaux) + *(*int32)(unsafe.Pointer(pnDoclist)) = nList + } else { + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + return int32(SQLITE_NOMEM) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + } + return SQLITE_OK +} + +func _sqlite3Fts5HashScanInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32) (r int32) { + return _fts5HashEntrySort(tls, p, pTerm, nTerm, p+24) +} + +// C documentation +// +// /* +// ** Return true if the hash table is empty, false otherwise. +// */ +func _sqlite3Fts5HashIsEmpty(tls *libc.TLS, pHash uintptr) (r int32) { + return libc.BoolInt32((*TFts5Hash)(unsafe.Pointer(pHash)).FnEntry == 0) +} + +func _sqlite3Fts5HashScanNext(tls *libc.TLS, p uintptr) { + (*TFts5Hash)(unsafe.Pointer(p)).FpScan = (*TFts5HashEntry)(unsafe.Pointer((*TFts5Hash)(unsafe.Pointer(p)).FpScan)).FpScanNext +} + +func _sqlite3Fts5HashScanEof(tls *libc.TLS, p uintptr) (r int32) { + return libc.BoolInt32((*TFts5Hash)(unsafe.Pointer(p)).FpScan == uintptr(0)) +} + +func _sqlite3Fts5HashScanEntry(tls *libc.TLS, pHash uintptr, pzTerm uintptr, pnTerm uintptr, ppDoclist uintptr, pnDoclist uintptr) { + var nTerm int32 + var p, zKey, v1 uintptr + _, _, _, _ = nTerm, p, zKey, v1 + v1 = (*TFts5Hash)(unsafe.Pointer(pHash)).FpScan + p = v1 + if v1 != 0 { + zKey = p + 1*48 + nTerm = (*TFts5HashEntry)(unsafe.Pointer(p)).FnKey + _fts5HashAddPoslistSize(tls, pHash, p, uintptr(0)) + *(*uintptr)(unsafe.Pointer(pzTerm)) = zKey + *(*int32)(unsafe.Pointer(pnTerm)) = nTerm + *(*uintptr)(unsafe.Pointer(ppDoclist)) = zKey + uintptr(nTerm) + *(*int32)(unsafe.Pointer(pnDoclist)) = int32(uint64((*TFts5HashEntry)(unsafe.Pointer(p)).FnData) - (uint64(48) + uint64(nTerm))) + } else { + *(*uintptr)(unsafe.Pointer(pzTerm)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnTerm)) = 0 + *(*uintptr)(unsafe.Pointer(ppDoclist)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + } +} + +/* +** 2014 May 31 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** Low level access to the FTS index stored in the database file. The +** routines in this file file implement all read and write access to the +** %_data table. Other parts of the system access this functionality via +** the interface defined in fts5Int.h. + */ + +/* #include "fts5Int.h" */ + +/* +** Overview: +** +** The %_data table contains all the FTS indexes for an FTS5 virtual table. +** As well as the main term index, there may be up to 31 prefix indexes. +** The format is similar to FTS3/4, except that: +** +** * all segment b-tree leaf data is stored in fixed size page records +** (e.g. 1000 bytes). A single doclist may span multiple pages. Care is +** taken to ensure it is possible to iterate in either direction through +** the entries in a doclist, or to seek to a specific entry within a +** doclist, without loading it into memory. +** +** * large doclists that span many pages have associated "doclist index" +** records that contain a copy of the first rowid on each page spanned by +** the doclist. This is used to speed up seek operations, and merges of +** large doclists with very small doclists. +** +** * extra fields in the "structure record" record the state of ongoing +** incremental merge operations. +** + */ + +/* +** There are two versions of the format used for the structure record: +** +** 1. the legacy format, that may be read by all fts5 versions, and +** +** 2. the V2 format, which is used by contentless_delete=1 databases. +** +** Both begin with a 4-byte "configuration cookie" value. Then, a legacy +** format structure record contains a varint - the number of levels in +** the structure. Whereas a V2 structure record contains the constant +** 4 bytes [0xff 0x00 0x00 0x01]. This is unambiguous as the value of a +** varint has to be at least 16256 to begin with "0xFF". And the default +** maximum number of levels is 64. +** +** See below for more on structure record formats. + */ + +/* +** Details: +** +** The %_data table managed by this module, +** +** CREATE TABLE %_data(id INTEGER PRIMARY KEY, block BLOB); +** +** , contains the following 6 types of records. See the comments surrounding +** the FTS5_*_ROWID macros below for a description of how %_data rowids are +** assigned to each fo them. +** +** 1. Structure Records: +** +** The set of segments that make up an index - the index structure - are +** recorded in a single record within the %_data table. The record consists +** of a single 32-bit configuration cookie value followed by a list of +** SQLite varints. +** +** If the structure record is a V2 record, the configuration cookie is +** followed by the following 4 bytes: [0xFF 0x00 0x00 0x01]. +** +** Next, the record continues with three varints: +** +** + number of levels, +** + total number of segments on all levels, +** + value of write counter. +** +** Then, for each level from 0 to nMax: +** +** + number of input segments in ongoing merge. +** + total number of segments in level. +** + for each segment from oldest to newest: +** + segment id (always > 0) +** + first leaf page number (often 1, always greater than 0) +** + final leaf page number +** +** Then, for V2 structures only: +** +** + lower origin counter value, +** + upper origin counter value, +** + the number of tombstone hash pages. +** +** 2. The Averages Record: +** +** A single record within the %_data table. The data is a list of varints. +** The first value is the number of rows in the index. Then, for each column +** from left to right, the total number of tokens in the column for all +** rows of the table. +** +** 3. Segment leaves: +** +** TERM/DOCLIST FORMAT: +** +** Most of each segment leaf is taken up by term/doclist data. The +** general format of term/doclist, starting with the first term +** on the leaf page, is: +** +** varint : size of first term +** blob: first term data +** doclist: first doclist +** zero-or-more { +** varint: number of bytes in common with previous term +** varint: number of bytes of new term data (nNew) +** blob: nNew bytes of new term data +** doclist: next doclist +** } +** +** doclist format: +** +** varint: first rowid +** poslist: first poslist +** zero-or-more { +** varint: rowid delta (always > 0) +** poslist: next poslist +** } +** +** poslist format: +** +** varint: size of poslist in bytes multiplied by 2, not including +** this field. Plus 1 if this entry carries the "delete" flag. +** collist: collist for column 0 +** zero-or-more { +** 0x01 byte +** varint: column number (I) +** collist: collist for column I +** } +** +** collist format: +** +** varint: first offset + 2 +** zero-or-more { +** varint: offset delta + 2 +** } +** +** PAGE FORMAT +** +** Each leaf page begins with a 4-byte header containing 2 16-bit +** unsigned integer fields in big-endian format. They are: +** +** * The byte offset of the first rowid on the page, if it exists +** and occurs before the first term (otherwise 0). +** +** * The byte offset of the start of the page footer. If the page +** footer is 0 bytes in size, then this field is the same as the +** size of the leaf page in bytes. +** +** The page footer consists of a single varint for each term located +** on the page. Each varint is the byte offset of the current term +** within the page, delta-compressed against the previous value. In +** other words, the first varint in the footer is the byte offset of +** the first term, the second is the byte offset of the second less that +** of the first, and so on. +** +** The term/doclist format described above is accurate if the entire +** term/doclist data fits on a single leaf page. If this is not the case, +** the format is changed in two ways: +** +** + if the first rowid on a page occurs before the first term, it +** is stored as a literal value: +** +** varint: first rowid +** +** + the first term on each page is stored in the same way as the +** very first term of the segment: +** +** varint : size of first term +** blob: first term data +** +** 5. Segment doclist indexes: +** +** Doclist indexes are themselves b-trees, however they usually consist of +** a single leaf record only. The format of each doclist index leaf page +** is: +** +** * Flags byte. Bits are: +** 0x01: Clear if leaf is also the root page, otherwise set. +** +** * Page number of fts index leaf page. As a varint. +** +** * First rowid on page indicated by previous field. As a varint. +** +** * A list of varints, one for each subsequent termless page. A +** positive delta if the termless page contains at least one rowid, +** or an 0x00 byte otherwise. +** +** Internal doclist index nodes are: +** +** * Flags byte. Bits are: +** 0x01: Clear for root page, otherwise set. +** +** * Page number of first child page. As a varint. +** +** * Copy of first rowid on page indicated by previous field. As a varint. +** +** * A list of delta-encoded varints - the first rowid on each subsequent +** child page. +** +** 6. Tombstone Hash Page +** +** These records are only ever present in contentless_delete=1 tables. +** There are zero or more of these associated with each segment. They +** are used to store the tombstone rowids for rows contained in the +** associated segments. +** +** The set of nHashPg tombstone hash pages associated with a single +** segment together form a single hash table containing tombstone rowids. +** To find the page of the hash on which a key might be stored: +** +** iPg = (rowid % nHashPg) +** +** Then, within page iPg, which has nSlot slots: +** +** iSlot = (rowid / nHashPg) % nSlot +** +** Each tombstone hash page begins with an 8 byte header: +** +** 1-byte: Key-size (the size in bytes of each slot). Either 4 or 8. +** 1-byte: rowid-0-tombstone flag. This flag is only valid on the +** first tombstone hash page for each segment (iPg=0). If set, +** the hash table contains rowid 0. If clear, it does not. +** Rowid 0 is handled specially. +** 2-bytes: unused. +** 4-bytes: Big-endian integer containing number of entries on page. +** +** Following this are nSlot 4 or 8 byte slots (depending on the key-size +** in the first byte of the page header). The number of slots may be +** determined based on the size of the page record and the key-size: +** +** nSlot = (nByte - 8) / key-size + */ + +/* +** Rowids for the averages and structure records in the %_data table. + */ + +/* +** Macros determining the rowids used by segment leaves and dlidx leaves +** and nodes. All nodes and leaves are stored in the %_data table with large +** positive rowids. +** +** Each segment has a unique non-zero 16-bit id. +** +** The rowid for each segment leaf is found by passing the segment id and +** the leaf page number to the FTS5_SEGMENT_ROWID macro. Leaves are numbered +** sequentially starting from 1. + */ + +/* +** Each time a blob is read from the %_data table, it is padded with this +** many zero bytes. This makes it easier to decode the various record formats +** without overreading if the records are corrupt. + */ + +type TFts5Data = struct { + Fp uintptr + Fnn int32 + FszLeaf int32 +} + +type Fts5Data = TFts5Data + +type TFts5DlidxIter = struct { + FnLvl int32 + FiSegid int32 + FaLvl [1]TFts5DlidxLvl +} + +type Fts5DlidxIter = TFts5DlidxIter + +type TFts5DlidxLvl = struct { + FpData uintptr + FiOff int32 + FbEof int32 + FiFirstOff int32 + FiLeafPgno int32 + FiRowid Ti64 +} + +type Fts5DlidxLvl = TFts5DlidxLvl + +type TFts5DlidxWriter = struct { + Fpgno int32 + FbPrevValid int32 + FiPrev Ti64 + Fbuf TFts5Buffer +} + +type Fts5DlidxWriter = TFts5DlidxWriter + +type TFts5Iter = struct { + Fbase TFts5IndexIter + FpTokenDataIter uintptr + FpIndex uintptr + Fposlist TFts5Buffer + FpColset uintptr + FxSetOutputs uintptr + FnSeg int32 + FbRev int32 + FbSkipEmpty Tu8 + FiSwitchRowid Ti64 + FaFirst uintptr + FaSeg [1]TFts5SegIter +} + +type Fts5Iter = TFts5Iter + +type TFts5PageWriter = struct { + Fpgno int32 + FiPrevPgidx int32 + Fbuf TFts5Buffer + Fpgidx TFts5Buffer + Fterm TFts5Buffer +} + +type Fts5PageWriter = TFts5PageWriter + +type TFts5SegIter = struct { + FpSeg uintptr + Fflags int32 + FiLeafPgno int32 + FpLeaf uintptr + FpNextLeaf uintptr + FiLeafOffset Ti64 + FpTombArray uintptr + FxNext uintptr + FiTermLeafPgno int32 + FiTermLeafOffset int32 + FiPgidxOff int32 + FiEndofDoclist int32 + FiRowidOffset int32 + FnRowidOffset int32 + FaRowidOffset uintptr + FpDlidx uintptr + Fterm TFts5Buffer + FiRowid Ti64 + FnPos int32 + FbDel Tu8 +} + +type Fts5SegIter = TFts5SegIter + +type TFts5DoclistIter = struct { + FaEof uintptr + FiRowid Ti64 + FaPoslist uintptr + FnPoslist int32 + FnSize int32 +} + +type Fts5DoclistIter = TFts5DoclistIter + +type TFts5SegWriter = struct { + FiSegid int32 + Fwriter TFts5PageWriter + FiPrevRowid Ti64 + FbFirstRowidInDoclist Tu8 + FbFirstRowidInPage Tu8 + FbFirstTermInPage Tu8 + FnLeafWritten int32 + FnEmpty int32 + FnDlidx int32 + FaDlidx uintptr + Fbtterm TFts5Buffer + FiBtPage int32 +} + +type Fts5SegWriter = TFts5SegWriter + +type TFts5Structure = struct { + FnRef int32 + FnWriteCounter Tu64 + FnOriginCntr Tu64 + FnSegment int32 + FnLevel int32 + FaLevel [1]TFts5StructureLevel +} + +type Fts5Structure = TFts5Structure + +type TFts5StructureLevel = struct { + FnMerge int32 + FnSeg int32 + FaSeg uintptr +} + +type Fts5StructureLevel = TFts5StructureLevel + +type TFts5StructureSegment = struct { + FiSegid int32 + FpgnoFirst int32 + FpgnoLast int32 + FiOrigin1 Tu64 + FiOrigin2 Tu64 + FnPgTombstone int32 + FnEntryTombstone Tu64 + FnEntry Tu64 +} + +type Fts5StructureSegment = TFts5StructureSegment + +type TFts5TokenDataIter = struct { + FnIter int32 + FnIterAlloc int32 + FnMap int32 + FnMapAlloc int32 + FaMap uintptr + FaPoslistReader uintptr + FaPoslistToIter uintptr + FapIter [1]uintptr +} + +type Fts5TokenDataIter = TFts5TokenDataIter + +type TFts5TokenDataMap = struct { + FiRowid Ti64 + FiPos Ti64 + FiIter int32 +} + +type Fts5TokenDataMap = TFts5TokenDataMap + +type TFts5TombstoneArray = struct { + FnRef int32 + FnTombstone int32 + FapTombstone [1]uintptr +} + +type Fts5TombstoneArray = TFts5TombstoneArray + +type TFts5Data1 = struct { + Fp uintptr + Fnn int32 + FszLeaf int32 +} + +type Fts5Data1 = TFts5Data1 + +/* +** One object per %_data table. +** +** nContentlessDelete: +** The number of contentless delete operations since the most recent +** call to fts5IndexFlush() or fts5IndexDiscardData(). This is tracked +** so that extra auto-merge work can be done by fts5IndexFlush() to +** account for the delete operations. + */ +type TFts5Index1 = struct { + FpConfig uintptr + FzDataTbl uintptr + FnWorkUnit int32 + FpHash uintptr + FnPendingData int32 + FiWriteRowid Ti64 + FbDelete int32 + FnContentlessDelete int32 + FnPendingRow int32 + Frc int32 + FflushRc int32 + FpReader uintptr + FpWriter uintptr + FpDeleter uintptr + FpIdxWriter uintptr + FpIdxDeleter uintptr + FpIdxSelect uintptr + FpIdxNextSelect uintptr + FnRead int32 + FpDeleteFromIdx uintptr + FpDataVersion uintptr + FiStructVersion Ti64 + FpStruct uintptr +} + +type Fts5Index1 = TFts5Index1 + +type TFts5DoclistIter1 = struct { + FaEof uintptr + FiRowid Ti64 + FaPoslist uintptr + FnPoslist int32 + FnSize int32 +} + +type Fts5DoclistIter1 = TFts5DoclistIter1 + +/* +** The contents of the "structure" record for each index are represented +** using an Fts5Structure record in memory. Which uses instances of the +** other Fts5StructureXXX types as components. +** +** nOriginCntr: +** This value is set to non-zero for structure records created for +** contentlessdelete=1 tables only. In that case it represents the +** origin value to apply to the next top-level segment created. + */ +type TFts5StructureSegment1 = struct { + FiSegid int32 + FpgnoFirst int32 + FpgnoLast int32 + FiOrigin1 Tu64 + FiOrigin2 Tu64 + FnPgTombstone int32 + FnEntryTombstone Tu64 + FnEntry Tu64 +} + +type Fts5StructureSegment1 = TFts5StructureSegment1 + +type TFts5StructureLevel1 = struct { + FnMerge int32 + FnSeg int32 + FaSeg uintptr +} + +type Fts5StructureLevel1 = TFts5StructureLevel1 + +type TFts5Structure1 = struct { + FnRef int32 + FnWriteCounter Tu64 + FnOriginCntr Tu64 + FnSegment int32 + FnLevel int32 + FaLevel [1]TFts5StructureLevel +} + +type Fts5Structure1 = TFts5Structure1 + +/* +** An object of type Fts5SegWriter is used to write to segments. + */ +type TFts5PageWriter1 = struct { + Fpgno int32 + FiPrevPgidx int32 + Fbuf TFts5Buffer + Fpgidx TFts5Buffer + Fterm TFts5Buffer +} + +type Fts5PageWriter1 = TFts5PageWriter1 + +type TFts5DlidxWriter1 = struct { + Fpgno int32 + FbPrevValid int32 + FiPrev Ti64 + Fbuf TFts5Buffer +} + +type Fts5DlidxWriter1 = TFts5DlidxWriter1 + +type TFts5SegWriter1 = struct { + FiSegid int32 + Fwriter TFts5PageWriter + FiPrevRowid Ti64 + FbFirstRowidInDoclist Tu8 + FbFirstRowidInPage Tu8 + FbFirstTermInPage Tu8 + FnLeafWritten int32 + FnEmpty int32 + FnDlidx int32 + FaDlidx uintptr + Fbtterm TFts5Buffer + FiBtPage int32 +} + +type Fts5SegWriter1 = TFts5SegWriter1 + +type TFts5CResult = struct { + FiFirst Tu16 + FbTermEq Tu8 +} + +type Fts5CResult = TFts5CResult + +type TFts5CResult1 = struct { + FiFirst Tu16 + FbTermEq Tu8 +} + +type Fts5CResult1 = TFts5CResult1 + +/* +** Object for iterating through a single segment, visiting each term/rowid +** pair in the segment. +** +** pSeg: +** The segment to iterate through. +** +** iLeafPgno: +** Current leaf page number within segment. +** +** iLeafOffset: +** Byte offset within the current leaf that is the first byte of the +** position list data (one byte passed the position-list size field). +** +** pLeaf: +** Buffer containing current leaf page data. Set to NULL at EOF. +** +** iTermLeafPgno, iTermLeafOffset: +** Leaf page number containing the last term read from the segment. And +** the offset immediately following the term data. +** +** flags: +** Mask of FTS5_SEGITER_XXX values. Interpreted as follows: +** +** FTS5_SEGITER_ONETERM: +** If set, set the iterator to point to EOF after the current doclist +** has been exhausted. Do not proceed to the next term in the segment. +** +** FTS5_SEGITER_REVERSE: +** This flag is only ever set if FTS5_SEGITER_ONETERM is also set. If +** it is set, iterate through rowid in descending order instead of the +** default ascending order. +** +** iRowidOffset/nRowidOffset/aRowidOffset: +** These are used if the FTS5_SEGITER_REVERSE flag is set. +** +** For each rowid on the page corresponding to the current term, the +** corresponding aRowidOffset[] entry is set to the byte offset of the +** start of the "position-list-size" field within the page. +** +** iTermIdx: +** Index of current term on iTermLeafPgno. +** +** apTombstone/nTombstone: +** These are used for contentless_delete=1 tables only. When the cursor +** is first allocated, the apTombstone[] array is allocated so that it +** is large enough for all tombstones hash pages associated with the +** segment. The pages themselves are loaded lazily from the database as +** they are required. + */ +type TFts5SegIter1 = struct { + FpSeg uintptr + Fflags int32 + FiLeafPgno int32 + FpLeaf uintptr + FpNextLeaf uintptr + FiLeafOffset Ti64 + FpTombArray uintptr + FxNext uintptr + FiTermLeafPgno int32 + FiTermLeafOffset int32 + FiPgidxOff int32 + FiEndofDoclist int32 + FiRowidOffset int32 + FnRowidOffset int32 + FaRowidOffset uintptr + FpDlidx uintptr + Fterm TFts5Buffer + FiRowid Ti64 + FnPos int32 + FbDel Tu8 +} + +type Fts5SegIter1 = TFts5SegIter1 + +/* +** Array of tombstone pages. Reference counted. + */ +type TFts5TombstoneArray1 = struct { + FnRef int32 + FnTombstone int32 + FapTombstone [1]uintptr +} + +type Fts5TombstoneArray1 = TFts5TombstoneArray1 + +/* +** Argument is a pointer to an Fts5Data structure that contains a +** leaf page. + */ + +/* +** Argument is a pointer to an Fts5Data structure that contains a leaf +** page. This macro evaluates to true if the leaf contains no terms, or +** false if it contains at least one term. + */ + +/* +** Object for iterating through the merged results of one or more segments, +** visiting each term/rowid pair in the merged data. +** +** nSeg is always a power of two greater than or equal to the number of +** segments that this object is merging data from. Both the aSeg[] and +** aFirst[] arrays are sized at nSeg entries. The aSeg[] array is padded +** with zeroed objects - these are handled as if they were iterators opened +** on empty segments. +** +** The results of comparing segments aSeg[N] and aSeg[N+1], where N is an +** even number, is stored in aFirst[(nSeg+N)/2]. The "result" of the +** comparison in this context is the index of the iterator that currently +** points to the smaller term/rowid combination. Iterators at EOF are +** considered to be greater than all other iterators. +** +** aFirst[1] contains the index in aSeg[] of the iterator that points to +** the smallest key overall. aFirst[0] is unused. +** +** poslist: +** Used by sqlite3Fts5IterPoslist() when the poslist needs to be buffered. +** There is no way to tell if this is populated or not. +** +** pColset: +** If not NULL, points to an object containing a set of column indices. +** Only matches that occur in one of these columns will be returned. +** The Fts5Iter does not own the Fts5Colset object, and so it is not +** freed when the iterator is closed - it is owned by the upper layer. + */ +type TFts5Iter1 = struct { + Fbase TFts5IndexIter + FpTokenDataIter uintptr + FpIndex uintptr + Fposlist TFts5Buffer + FpColset uintptr + FxSetOutputs uintptr + FnSeg int32 + FbRev int32 + FbSkipEmpty Tu8 + FiSwitchRowid Ti64 + FaFirst uintptr + FaSeg [1]TFts5SegIter +} + +type Fts5Iter1 = TFts5Iter1 + +/* +** An instance of the following type is used to iterate through the contents +** of a doclist-index record. +** +** pData: +** Record containing the doclist-index data. +** +** bEof: +** Set to true once iterator has reached EOF. +** +** iOff: +** Set to the current offset within record pData. + */ +type TFts5DlidxLvl1 = struct { + FpData uintptr + FiOff int32 + FbEof int32 + FiFirstOff int32 + FiLeafPgno int32 + FiRowid Ti64 +} + +type Fts5DlidxLvl1 = TFts5DlidxLvl1 + +type TFts5DlidxIter1 = struct { + FnLvl int32 + FiSegid int32 + FaLvl [1]TFts5DlidxLvl +} + +type Fts5DlidxIter1 = TFts5DlidxIter1 + +func _fts5PutU16(tls *libc.TLS, aOut uintptr, iVal Tu16) { + *(*Tu8)(unsafe.Pointer(aOut)) = uint8(int32(iVal) >> libc.Int32FromInt32(8)) + *(*Tu8)(unsafe.Pointer(aOut + 1)) = uint8(int32(iVal) & libc.Int32FromInt32(0xFF)) +} + +func _fts5GetU16(tls *libc.TLS, aIn uintptr) (r Tu16) { + return uint16(int32(uint16(*(*Tu8)(unsafe.Pointer(aIn))))<> libc.Int32FromInt32(56) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 1)) = uint8(iVal >> libc.Int32FromInt32(48) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(iVal >> libc.Int32FromInt32(40) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 3)) = uint8(iVal >> libc.Int32FromInt32(32) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 4)) = uint8(iVal >> libc.Int32FromInt32(24) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 5)) = uint8(iVal >> libc.Int32FromInt32(16) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 6)) = uint8(iVal >> libc.Int32FromInt32(8) & libc.Uint64FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 7)) = uint8(iVal >> libc.Int32FromInt32(0) & libc.Uint64FromInt32(0xFF)) +} + +// C documentation +// +// /* +// ** Write iVal, formated as a 32-bit big-endian unsigned integer, to the +// ** buffer indicated by the first argument. +// */ +func _fts5PutU32(tls *libc.TLS, a uintptr, iVal Tu32) { + *(*Tu8)(unsafe.Pointer(a)) = uint8(iVal >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 1)) = uint8(iVal >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 2)) = uint8(iVal >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xFF)) + *(*Tu8)(unsafe.Pointer(a + 3)) = uint8(iVal >> libc.Int32FromInt32(0) & libc.Uint32FromInt32(0xFF)) +} + +// C documentation +// +// /* +// ** Allocate and return a buffer at least nByte bytes in size. +// ** +// ** If an OOM error is encountered, return NULL and set the error code in +// ** the Fts5Index handle passed as the first argument. +// */ +func _fts5IdxMalloc(tls *libc.TLS, p uintptr, nByte Tsqlite3_int64) (r uintptr) { + return _sqlite3Fts5MallocZero(tls, p+60, nByte) +} + +/* +** Compare the contents of the pLeft buffer with the pRight/nRight blob. +** +** Return -ve if pLeft is smaller than pRight, 0 if they are equal or +** +ve if pRight is smaller than pLeft. In other words: +** +** res = *pLeft - *pRight + */ + +// C documentation +// +// /* +// ** Compare the contents of the two buffers using memcmp(). If one buffer +// ** is a prefix of the other, it is considered the lesser. +// ** +// ** Return -ve if pLeft is smaller than pRight, 0 if they are equal or +// ** +ve if pRight is smaller than pLeft. In other words: +// ** +// ** res = *pLeft - *pRight +// */ +func _fts5BufferCompare(tls *libc.TLS, pLeft uintptr, pRight uintptr) (r int32) { + var nCmp, res, v1, v2, v3 int32 + _, _, _, _, _ = nCmp, res, v1, v2, v3 + if (*TFts5Buffer)(unsafe.Pointer(pLeft)).Fn < (*TFts5Buffer)(unsafe.Pointer(pRight)).Fn { + v1 = (*TFts5Buffer)(unsafe.Pointer(pLeft)).Fn + } else { + v1 = (*TFts5Buffer)(unsafe.Pointer(pRight)).Fn + } + nCmp = v1 + if nCmp <= 0 { + v2 = 0 + } else { + v2 = libc.Xmemcmp(tls, (*TFts5Buffer)(unsafe.Pointer(pLeft)).Fp, (*TFts5Buffer)(unsafe.Pointer(pRight)).Fp, uint64(nCmp)) + } + res = v2 + if res == 0 { + v3 = (*TFts5Buffer)(unsafe.Pointer(pLeft)).Fn - (*TFts5Buffer)(unsafe.Pointer(pRight)).Fn + } else { + v3 = res + } + return v3 +} + +func _fts5LeafFirstTermOff(tls *libc.TLS, pLeaf uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var _ /* ret at bp+0 */ int32 + _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf), bp) + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Close the read-only blob handle, if it is open. +// */ +func _sqlite3Fts5IndexCloseReader(tls *libc.TLS, p uintptr) { + var pReader uintptr + _ = pReader + if (*TFts5Index)(unsafe.Pointer(p)).FpReader != 0 { + pReader = (*TFts5Index)(unsafe.Pointer(p)).FpReader + (*TFts5Index)(unsafe.Pointer(p)).FpReader = uintptr(0) + Xsqlite3_blob_close(tls, pReader) + } +} + +// C documentation +// +// /* +// ** Retrieve a record from the %_data table. +// ** +// ** If an error occurs, NULL is returned and an error left in the +// ** Fts5Index object. +// */ +func _fts5DataRead(tls *libc.TLS, p uintptr, iRowid Ti64) (r uintptr) { + var aOut, pBlob, pConfig, pRet, v1 uintptr + var nAlloc Tsqlite3_int64 + var nByte, rc int32 + _, _, _, _, _, _, _, _ = aOut, nAlloc, nByte, pBlob, pConfig, pRet, rc, v1 + pRet = uintptr(0) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rc = SQLITE_OK + if (*TFts5Index)(unsafe.Pointer(p)).FpReader != 0 { + /* This call may return SQLITE_ABORT if there has been a savepoint + ** rollback since it was last used. In this case a new blob handle + ** is required. */ + pBlob = (*TFts5Index)(unsafe.Pointer(p)).FpReader + (*TFts5Index)(unsafe.Pointer(p)).FpReader = uintptr(0) + rc = Xsqlite3_blob_reopen(tls, pBlob, iRowid) + (*TFts5Index)(unsafe.Pointer(p)).FpReader = pBlob + if rc != SQLITE_OK { + _sqlite3Fts5IndexCloseReader(tls, p) + } + if rc == int32(SQLITE_ABORT) { + rc = SQLITE_OK + } + } + /* If the blob handle is not open at this point, open it and seek + ** to the requested entry. */ + if (*TFts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0) && rc == SQLITE_OK { + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + rc = Xsqlite3_blob_open(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl, __ccgo_ts+36198, iRowid, 0, p+72) + } + /* If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls + ** above returned SQLITE_ERROR, return SQLITE_CORRUPT_VTAB instead. + ** All the reasons those functions might return SQLITE_ERROR - missing + ** table, missing row, non-blob/text in block column - indicate + ** backing store corruption. */ + if rc == int32(SQLITE_ERROR) { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*TFts5Data)(unsafe.Pointer(pRet)).Fnn { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= v1 { + i = 0 + for { + if !(i < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + Xsqlite3_free(tls, (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(i)*16))).FaSeg) + goto _4 + _4: + ; + i++ + } + Xsqlite3_free(tls, pStruct) + } +} + +func _fts5StructureRef(tls *libc.TLS, pStruct uintptr) { + (*TFts5Structure)(unsafe.Pointer(pStruct)).FnRef++ +} + +func _sqlite3Fts5StructureRef(tls *libc.TLS, p uintptr) (r uintptr) { + _fts5StructureRef(tls, (*TFts5Index)(unsafe.Pointer(p)).FpStruct) + return (*TFts5Index)(unsafe.Pointer(p)).FpStruct +} + +func _sqlite3Fts5StructureRelease(tls *libc.TLS, p uintptr) { + if p != 0 { + _fts5StructureRelease(tls, p) + } +} + +func _sqlite3Fts5StructureTest(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { + if (*TFts5Index)(unsafe.Pointer(p)).FpStruct != pStruct { + return int32(SQLITE_ABORT) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Ensure that structure object (*pp) is writable. +// ** +// ** This function is a no-op if (*pRc) is not SQLITE_OK when it is called. If +// ** an error occurs, (*pRc) is set to an SQLite error code before returning. +// */ +func _fts5StructureMakeWritable(tls *libc.TLS, pRc uintptr, pp uintptr) { + var i int32 + var nByte Ti64 + var p, pLvl, pNew uintptr + _, _, _, _, _ = i, nByte, p, pLvl, pNew + p = *(*uintptr)(unsafe.Pointer(pp)) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK && (*TFts5Structure)(unsafe.Pointer(p)).FnRef > int32(1) { + nByte = int64(uint64(48) + uint64((*TFts5Structure)(unsafe.Pointer(p)).FnLevel-libc.Int32FromInt32(1))*uint64(16)) + pNew = _sqlite3Fts5MallocZero(tls, pRc, nByte) + if pNew != 0 { + libc.Xmemcpy(tls, pNew, p, uint64(nByte)) + i = 0 + for { + if !(i < (*TFts5Structure)(unsafe.Pointer(p)).FnLevel) { + break + } + (*(*TFts5StructureLevel)(unsafe.Pointer(pNew + 32 + uintptr(i)*16))).FaSeg = uintptr(0) + goto _1 + _1: + ; + i++ + } + i = 0 + for { + if !(i < (*TFts5Structure)(unsafe.Pointer(p)).FnLevel) { + break + } + pLvl = pNew + 32 + uintptr(i)*16 + nByte = int64(uint64(56) * uint64((*(*TFts5StructureLevel)(unsafe.Pointer(pNew + 32 + uintptr(i)*16))).FnSeg)) + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg = _sqlite3Fts5MallocZero(tls, pRc, nByte) + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg == uintptr(0) { + i = 0 + for { + if !(i < (*TFts5Structure)(unsafe.Pointer(p)).FnLevel) { + break + } + Xsqlite3_free(tls, (*(*TFts5StructureLevel)(unsafe.Pointer(pNew + 32 + uintptr(i)*16))).FaSeg) + goto _3 + _3: + ; + i++ + } + Xsqlite3_free(tls, pNew) + return + } + libc.Xmemcpy(tls, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg, (*(*TFts5StructureLevel)(unsafe.Pointer(p + 32 + uintptr(i)*16))).FaSeg, uint64(nByte)) + goto _2 + _2: + ; + i++ + } + (*TFts5Structure)(unsafe.Pointer(p)).FnRef-- + (*TFts5Structure)(unsafe.Pointer(pNew)).FnRef = int32(1) + } + *(*uintptr)(unsafe.Pointer(pp)) = pNew + } +} + +// C documentation +// +// /* +// ** Deserialize and return the structure record currently stored in serialized +// ** form within buffer pData/nData. +// ** +// ** The Fts5Structure.aLevel[] and each Fts5StructureLevel.aSeg[] array +// ** are over-allocated by one slot. This allows the structure contents +// ** to be more easily edited. +// ** +// ** If an error occurs, *ppOut is set to NULL and an SQLite error code +// ** returned. Otherwise, *ppOut is set to point to the new object and +// ** SQLITE_OK returned. +// */ +func _fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie uintptr, ppOut uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bStructureV2, i, iLvl, iSeg int32 + var nByte Tsqlite3_int64 + var nOriginCntr Tu64 + var pLvl, pRet, pSeg uintptr + var v3 uint64 + var _ /* nLevel at bp+4 */ int32 + var _ /* nSegment at bp+8 */ int32 + var _ /* nTotal at bp+12 */ int32 + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _ = bStructureV2, i, iLvl, iSeg, nByte, nOriginCntr, pLvl, pRet, pSeg, v3 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + i = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + *(*int32)(unsafe.Pointer(bp + 8)) = 0 /* Bytes of space to allocate at pRet */ + pRet = uintptr(0) /* Structure object to return */ + bStructureV2 = 0 /* True for FTS5_STRUCTURE_V2 */ + nOriginCntr = uint64(0) /* Largest origin value seen so far */ + /* Grab the cookie value */ + if piCookie != 0 { + *(*int32)(unsafe.Pointer(piCookie)) = _sqlite3Fts5Get32(tls, pData) + } + i = int32(4) + /* Check if this is a V2 structure record. Set bStructureV2 if it is. */ + if 0 == libc.Xmemcmp(tls, pData+uintptr(i), __ccgo_ts+36344, uint64(4)) { + i += int32(4) + bStructureV2 = int32(1) + } + /* Read the total number of levels and segments from the start of the + ** structure record. */ + i += _sqlite3Fts5GetVarint32(tls, pData+uintptr(i), bp+4) + i += _sqlite3Fts5GetVarint32(tls, pData+uintptr(i), bp+8) + if *(*int32)(unsafe.Pointer(bp + 4)) > int32(FTS5_MAX_SEGMENT) || *(*int32)(unsafe.Pointer(bp + 4)) < 0 || *(*int32)(unsafe.Pointer(bp + 8)) > int32(FTS5_MAX_SEGMENT) || *(*int32)(unsafe.Pointer(bp + 8)) < 0 { + return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= nData { + *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= nData { + *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2 { + v3 = nOriginCntr + } else { + v3 = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2 + } + nOriginCntr = v3 + } + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast < (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { + *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pLvl + uintptr(-libc.Int32FromInt32(1))*16))).FnMerge != 0 && *(*int32)(unsafe.Pointer(bp + 12)) == 0 { + *(*int32)(unsafe.Pointer(bp)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< uint64(0) { + v1 = libc.Int32FromInt32(4) + libc.Int32FromInt32(4) + libc.Int32FromInt32(9) + libc.Int32FromInt32(9) + libc.Int32FromInt32(9) + } else { + v1 = libc.Int32FromInt32(4) + libc.Int32FromInt32(9) + libc.Int32FromInt32(9) + } /* Cookie value to store */ + nHdr = v1 + libc.Xmemset(tls, bp, 0, uint64(16)) + /* Append the current configuration cookie */ + iCookie = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FiCookie + if iCookie < 0 { + iCookie = 0 + } + if 0 == _sqlite3Fts5BufferSize(tls, p+60, bp, uint32(nHdr)) { + _sqlite3Fts5Put32(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, iCookie) + (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn = int32(4) + if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), __ccgo_ts+36344, uint64(4)) + *(*int32)(unsafe.Pointer(bp + 8)) += int32(4) + } + *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)) + *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment)) + *(*int32)(unsafe.Pointer(bp + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp)).Fn), uint64(int64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter))) + } + iLvl = 0 + for { + if !(iLvl < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } /* Used to iterate through segments */ + pLvl = pStruct + 32 + uintptr(iLvl)*16 + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg)) + iSeg = 0 + for { + if !(iSeg < (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg) { + break + } + pSeg = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*56 + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast)) + if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr > uint64(0) { + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin1)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnEntryTombstone)) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnEntry)) + } + goto _3 + _3: + ; + iSeg++ + } + goto _2 + _2: + ; + iLvl++ + } + _fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn) + _sqlite3Fts5BufferFree(tls, bp) + } +} + +func _fts5SegmentSize(tls *libc.TLS, pSeg uintptr) (r int32) { + return int32(1) + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast - (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst +} + +// C documentation +// +// /* +// ** Return a copy of index structure pStruct. Except, promote as many +// ** segments as possible to level iPromote. If an OOM occurs, NULL is +// ** returned. +// */ +func _fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote int32, pStruct uintptr) { + var il, is, sz int32 + var pLvl, pOut uintptr + _, _, _, _, _ = il, is, pLvl, pOut, sz + pOut = pStruct + 32 + uintptr(iPromote)*16 + if (*TFts5StructureLevel)(unsafe.Pointer(pOut)).FnMerge == 0 { + il = iPromote + int32(1) + for { + if !(il < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + pLvl = pStruct + 32 + uintptr(il)*16 + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { + return + } + is = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg - int32(1) + for { + if !(is >= 0) { + break + } + sz = _fts5SegmentSize(tls, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(is)*56) + if sz > szPromote { + return + } + _fts5StructureExtendLevel(tls, p+60, pStruct, iPromote, int32(1), int32(1)) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + libc.Xmemcpy(tls, (*TFts5StructureLevel)(unsafe.Pointer(pOut)).FaSeg, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(is)*56, uint64(56)) + (*TFts5StructureLevel)(unsafe.Pointer(pOut)).FnSeg++ + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- + goto _2 + _2: + ; + is-- + } + goto _1 + _1: + ; + il++ + } + } +} + +// C documentation +// +// /* +// ** A new segment has just been written to level iLvl of index structure +// ** pStruct. This function determines if any segments should be promoted +// ** as a result. Segments are promoted in two scenarios: +// ** +// ** a) If the segment just written is smaller than one or more segments +// ** within the previous populated level, it is promoted to the previous +// ** populated level. +// ** +// ** b) If the segment just written is larger than the newest segment on +// ** the next populated level, then that segment, and any other adjacent +// ** segments that are also smaller than the one just written, are +// ** promoted. +// ** +// ** If one or more segments are promoted, the structure object is updated +// ** to reflect this. +// */ +func _fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr) { + var i, iPromote, iTst, nSeg, sz, szMax, szPromote, szSeg int32 + var pSeg, pTst uintptr + _, _, _, _, _, _, _, _, _, _ = i, iPromote, iTst, nSeg, pSeg, pTst, sz, szMax, szPromote, szSeg + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + iPromote = -int32(1) + szPromote = 0 /* Size of segment just written */ + nSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg + if nSeg == 0 { + return + } + pSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FaSeg + uintptr((*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg-int32(1))*56 + szSeg = int32(1) + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast - (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst + /* Check for condition (a) */ + iTst = iLvl - int32(1) + for { + if !(iTst >= 0 && (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iTst)*16))).FnSeg == 0) { + break + } + goto _1 + _1: + ; + iTst-- + } + if iTst >= 0 { + szMax = 0 + pTst = pStruct + 32 + uintptr(iTst)*16 + i = 0 + for { + if !(i < (*TFts5StructureLevel)(unsafe.Pointer(pTst)).FnSeg) { + break + } + sz = (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pTst)).FaSeg + uintptr(i)*56))).FpgnoLast - (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pTst)).FaSeg + uintptr(i)*56))).FpgnoFirst + int32(1) + if sz > szMax { + szMax = sz + } + goto _2 + _2: + ; + i++ + } + if szMax >= szSeg { + /* Condition (a) is true. Promote the newest segment on level + ** iLvl to level iTst. */ + iPromote = iTst + szPromote = szMax + } + } + /* If condition (a) is not met, assume (b) is true. StructurePromoteTo() + ** is a no-op if it is not. */ + if iPromote < 0 { + iPromote = iLvl + szPromote = szSeg + } + _fts5StructurePromoteTo(tls, p, iPromote, szPromote, pStruct) + } +} + +// C documentation +// +// /* +// ** Advance the iterator passed as the only argument. If the end of the +// ** doclist-index page is reached, return non-zero. +// */ +func _fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iOff int32 + var pData, p2 uintptr + var _ /* iVal at bp+0 */ Tu64 + _, _, _ = iOff, pData, p2 + pData = (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData + if (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff == 0 { + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = int32(1) + *(*int32)(unsafe.Pointer(pLvl + 8)) += _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+1, pLvl+20) + *(*int32)(unsafe.Pointer(pLvl + 8)) += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr((*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff), pLvl+24)) + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff = (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff + } else { + iOff = (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff + for { + if !(iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn) { + break + } + if *(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pData)).Fp + uintptr(iOff))) != 0 { + break + } + goto _1 + _1: + ; + iOff++ + } + if iOff < (*TFts5Data)(unsafe.Pointer(pData)).Fnn { + *(*int32)(unsafe.Pointer(pLvl + 20)) += iOff - (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff + int32(1) + iOff += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr(iOff), bp)) + p2 = pLvl + 24 + *(*Ti64)(unsafe.Pointer(p2)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p2))) + *(*Tu64)(unsafe.Pointer(bp))) + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = iOff + } else { + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = int32(1) + } + } + return (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof +} + +// C documentation +// +// /* +// ** Advance the iterator passed as the only argument. +// */ +func _fts5DlidxIterNextR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) (r int32) { + var pLvl uintptr + _ = pLvl + pLvl = pIter + 8 + uintptr(iLvl)*32 + if _fts5DlidxLvlNext(tls, pLvl) != 0 { + if iLvl+int32(1) < (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { + _fts5DlidxIterNextR(tls, p, pIter, iLvl+int32(1)) + if (*(*TFts5DlidxLvl)(unsafe.Pointer(pLvl + 1*32))).FbEof == 0 { + _fts5DataRelease(tls, (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData) + libc.Xmemset(tls, pLvl, 0, uint64(32)) + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData = _fts5DataRead(tls, p, int64((*TFts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(iLvl)<iLeafPgno is the page number the +// ** doclist is associated with (the one featuring the term). +// */ +func _fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl) { + break + } + _fts5DlidxLvlNext(tls, pIter+8+uintptr(i)*32) + goto _1 + _1: + ; + i++ + } + return (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof +} + +func _fts5DlidxIterEof(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { + return libc.BoolInt32((*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK || (*(*TFts5DlidxLvl)(unsafe.Pointer(pIter + 8))).FbEof != 0) +} + +func _fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { + var i int32 + var pChild, pLvl uintptr + _, _, _ = i, pChild, pLvl + /* Advance each level to the last entry on the last page */ + i = (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl - int32(1) + for { + if !((*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && i >= 0) { + break + } + pLvl = pIter + 8 + uintptr(i)*32 + for _fts5DlidxLvlNext(tls, pLvl) == 0 { + } + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = 0 + if i > 0 { + pChild = pLvl + uintptr(-libc.Int32FromInt32(1))*32 + _fts5DataRelease(tls, (*TFts5DlidxLvl)(unsafe.Pointer(pChild)).FpData) + libc.Xmemset(tls, pChild, 0, uint64(32)) + (*TFts5DlidxLvl)(unsafe.Pointer(pChild)).FpData = _fts5DataRead(tls, p, int64((*TFts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(i-libc.Int32FromInt32(1))<= iOff { + break + } + *(*int32)(unsafe.Pointer(pLvl + 20)) += nZero + int32(1) + p1 = pLvl + 24 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp))) + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = ii + } + } + return (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof +} + +func _fts5DlidxIterPrevR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) (r int32) { + var pLvl uintptr + _ = pLvl + pLvl = pIter + 8 + uintptr(iLvl)*32 + if _fts5DlidxLvlPrev(tls, pLvl) != 0 { + if iLvl+int32(1) < (*TFts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { + _fts5DlidxIterPrevR(tls, p, pIter, iLvl+int32(1)) + if (*(*TFts5DlidxLvl)(unsafe.Pointer(pLvl + 1*32))).FbEof == 0 { + _fts5DataRelease(tls, (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData) + libc.Xmemset(tls, pLvl, 0, uint64(32)) + (*TFts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData = _fts5DataRead(tls, p, int64((*TFts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(iLvl)<= (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn + int32(1) + } else { + *(*int32)(unsafe.Pointer(pIter + 64)) += _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff), pIter+68) + } + } +} + +// C documentation +// +// /* +// ** Argument p points to a buffer containing a varint to be interpreted as a +// ** position list size field. Read the varint and return the number of bytes +// ** read. Before returning, set *pnSz to the number of bytes in the position +// ** list, and *pbDel to true if the delete flag is set, or false otherwise. +// */ +func _fts5GetPoslistSize(tls *libc.TLS, p uintptr, pnSz uintptr, pbDel uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var n, v1 int32 + var _ /* nSz at bp+0 */ int32 + _, _ = n, v1 + n = 0 + v1 = n + n++ + *(*int32)(unsafe.Pointer(bp)) = int32(*(*Tu8)(unsafe.Pointer(p + uintptr(v1)))) + if *(*int32)(unsafe.Pointer(bp))&int32(0x80) != 0 { + n-- + n += _sqlite3Fts5GetVarint32(tls, p+uintptr(n), bp) + } + *(*int32)(unsafe.Pointer(pnSz)) = *(*int32)(unsafe.Pointer(bp)) / int32(2) + *(*int32)(unsafe.Pointer(pbDel)) = *(*int32)(unsafe.Pointer(bp)) & int32(0x0001) + return n +} + +// C documentation +// +// /* +// ** Fts5SegIter.iLeafOffset currently points to the first byte of a +// ** position-list size field. Read the value of the field and store it +// ** in the following variables: +// ** +// ** Fts5SegIter.nPos +// ** Fts5SegIter.bDel +// ** +// ** Leave Fts5SegIter.iLeafOffset pointing to the first byte of the +// ** position list content (if any). +// */ +func _fts5SegIterLoadNPos(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iEod, iOff, v1, v2 int32 + var _ /* nSz at bp+0 */ int32 + _, _, _, _ = iEod, iOff, v1, v2 + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + iOff = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) /* Offset to read at */ + if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist < (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf { + v1 = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist + } else { + v1 = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + } + iEod = v1 + (*TFts5SegIter)(unsafe.Pointer(pIter)).FbDel = uint8(0) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos = int32(1) + if iOff < iEod && int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)))) == 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FbDel = uint8(1) + iOff++ + if iOff < iEod && int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)))) == 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos = int32(1) + iOff++ + } else { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos = 0 + } + } + } else { + v2 = iOff + iOff++ + *(*int32)(unsafe.Pointer(bp)) = int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(v2)))) + if *(*int32)(unsafe.Pointer(bp))&int32(0x80) != 0 { + iOff-- + iOff += _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp+uintptr(iOff), bp) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FbDel = uint8(*(*int32)(unsafe.Pointer(bp)) & libc.Int32FromInt32(0x0001)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos = *(*int32)(unsafe.Pointer(bp)) >> int32(1) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(iOff) + } +} + +func _fts5SegIterLoadRowid(tls *libc.TLS, p uintptr, pIter uintptr) { + var a uintptr + var iOff Ti64 + _, _ = a, iOff + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp /* Buffer to read data from */ + iOff = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset + for iOff >= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) { + _fts5SegIterNextPage(tls, p, pIter) + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) || nKeep > (*TFts5SegIter)(unsafe.Pointer(pIter)).Fterm.Fn || *(*int32)(unsafe.Pointer(bp)) == 0 { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + int32(1) + } else { + *(*int32)(unsafe.Pointer(pIter + 64)) += _sqlite3Fts5GetVarint32(tls, a+uintptr((*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff), bp+4) + *(*int32)(unsafe.Pointer(pIter + 68)) += *(*int32)(unsafe.Pointer(bp + 4)) + } + _fts5SegIterLoadRowid(tls, p, pIter) +} + +func _fts5SegIterSetNext(tls *libc.TLS, p uintptr, pIter uintptr) { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags&int32(FTS5_SEGITER_REVERSE) != 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FxNext = __ccgo_fp(_fts5SegIterNext_Reverse) + } else { + if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FxNext = __ccgo_fp(_fts5SegIterNext_None) + } else { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FxNext = __ccgo_fp(_fts5SegIterNext) + } + } +} + +// C documentation +// +// /* +// ** Allocate a tombstone hash page array object (pIter->pTombArray) for +// ** the iterator passed as the second argument. If an OOM error occurs, +// ** leave an error in the Fts5Index object. +// */ +func _fts5SegIterAllocTombstone(tls *libc.TLS, p uintptr, pIter uintptr) { + var nByte, nTomb int32 + var pNew uintptr + _, _, _ = nByte, nTomb, pNew + nTomb = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FnPgTombstone + if nTomb > 0 { + nByte = int32(uint64(nTomb)*uint64(8) + uint64(16)) + pNew = _sqlite3Fts5MallocZero(tls, p+60, int64(nByte)) + if pNew != 0 { + (*TFts5TombstoneArray)(unsafe.Pointer(pNew)).FnTombstone = nTomb + (*TFts5TombstoneArray)(unsafe.Pointer(pNew)).FnRef = int32(1) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpTombArray = pNew + } + } +} + +// C documentation +// +// /* +// ** Initialize the iterator object pIter to iterate through the entries in +// ** segment pSeg. The iterator is left pointing to the first entry when +// ** this function returns. +// ** +// ** If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// ** an error has already occurred when this function is called, it is a no-op. +// */ +func _fts5SegIterInit(tls *libc.TLS, p uintptr, pSeg uintptr, pIter uintptr) { + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst == 0 { + /* This happens if the segment is being used as an input to an incremental + ** merge and all data has already been "trimmed". See function + ** fts5TrimSegments() for details. In this case leave the iterator empty. + ** The caller will see the (pIter->pLeaf==0) and assume the iterator is + ** at EOF already. */ + return + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + libc.Xmemset(tls, pIter, 0, uint64(128)) + _fts5SegIterSetNext(tls, p, pIter) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg = pSeg + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst - int32(1) + for cond := true; cond; cond = (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 && (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn == int32(4) { + _fts5SegIterNextPage(tls, p, pIter) + } + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(4) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + int32(1) + _fts5SegIterLoadTerm(tls, p, pIter, 0) + _fts5SegIterLoadNPos(tls, p, pIter) + _fts5SegIterAllocTombstone(tls, p, pIter) + } +} + +// C documentation +// +// /* +// ** This function is only ever called on iterators created by calls to +// ** Fts5IndexQuery() with the FTS5INDEX_QUERY_DESC flag set. +// ** +// ** The iterator is in an unusual state when this function is called: the +// ** Fts5SegIter.iLeafOffset variable is set to the offset of the start of +// ** the position-list size field for the first relevant rowid on the page. +// ** Fts5SegIter.rowid is set, but nPos and bDel are not. +// ** +// ** This function advances the iterator so that it points to the last +// ** relevant rowid on the page and, if necessary, initializes the +// ** aRowidOffset[] and iRowidOffset variables. At this point the iterator +// ** is in its regular state - Fts5SegIter.iLeafOffset points to the first +// ** byte of the position list content associated with said rowid. +// */ +func _fts5SegIterReverseInitPage(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, aNew, p1 uintptr + var eDetail, i, iRowidOffset, n, nNew, v2 int32 + var _ /* bDummy at bp+12 */ int32 + var _ /* iDelta at bp+0 */ Tu64 + var _ /* nPos at bp+8 */ int32 + _, _, _, _, _, _, _, _, _ = a, aNew, eDetail, i, iRowidOffset, n, nNew, v2, p1 + eDetail = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail + n = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + i = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + iRowidOffset = 0 + if n > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { + n = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist + } + for int32(1) != 0 { + *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) + if eDetail == int32(FTS5_DETAIL_NONE) { + /* todo */ + if i < n && int32(*(*Tu8)(unsafe.Pointer(a + uintptr(i)))) == 0 { + i++ + if i < n && int32(*(*Tu8)(unsafe.Pointer(a + uintptr(i)))) == 0 { + i++ + } + } + } else { + i += _fts5GetPoslistSize(tls, a+uintptr(i), bp+8, bp+12) + i += *(*int32)(unsafe.Pointer(bp + 8)) + } + if i >= n { + break + } + i += int32(_sqlite3Fts5GetVarint(tls, a+uintptr(i), bp)) + p1 = pIter + 112 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp))) + /* If necessary, grow the pIter->aRowidOffset[] array. */ + if iRowidOffset >= (*TFts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset { + nNew = (*TFts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset + int32(8) + aNew = Xsqlite3_realloc64(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset, uint64(nNew)*uint64(4)) + if aNew == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + break + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset = aNew + (*TFts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset = nNew + } + v2 = iRowidOffset + iRowidOffset++ + *(*int32)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset + uintptr(v2)*4)) = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(i) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset = iRowidOffset + _fts5SegIterLoadNPos(tls, p, pIter) +} + +// C documentation +// +// /* +// ** +// */ +func _fts5SegIterReverseNewPage(tls *libc.TLS, p uintptr, pIter uintptr) { + var a, pNew uintptr + var iRowidOff int32 + _, _, _ = a, iRowidOff, pNew + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno-- + pNew = _fts5DataRead(tls, p, int64((*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(libc.Int32FromInt32(0))<pLeaf==0, this iterator is at EOF. */ + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno == (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset < (*TFts5Data)(unsafe.Pointer(pNew)).FszLeaf { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pNew + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64((*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset) + } + } else { + iRowidOff = int32(_fts5GetU16(tls, (*TFts5Data)(unsafe.Pointer(pNew)).Fp)) + if iRowidOff != 0 { + if iRowidOff >= (*TFts5Data)(unsafe.Pointer(pNew)).FszLeaf { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset-- + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset + uintptr((*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset)*4))) + _fts5SegIterLoadNPos(tls, p, pIter) + iOff = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail != int32(FTS5_DETAIL_NONE) { + iOff += (*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos + } + _sqlite3Fts5GetVarint(tls, a+uintptr(iOff), bp) + p1 = pIter + 112 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) - *(*Tu64)(unsafe.Pointer(bp))) + } else { + _fts5SegIterReverseNewPage(tls, p, pIter) + } +} + +// C documentation +// +// /* +// ** Advance iterator pIter to the next entry. +// ** +// ** This version of fts5SegIterNext() is only used if detail=none and the +// ** iterator is not a reverse direction iterator. +// */ +func _fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iOff int32 + var _ /* iDelta at bp+0 */ Ti64 + var _ /* nKeep at bp+8 */ int32 + var _ /* nList at bp+36 */ int32 + var _ /* nTerm at bp+32 */ int32 + var _ /* pList at bp+16 */ uintptr + var _ /* zTerm at bp+24 */ uintptr + _ = iOff + iOff = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + /* Next entry is on the next page */ + for (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg != 0 && iOff >= (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf { + _fts5SegIterNextPage(tls, p, pIter) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 || (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { + return + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowid = 0 + iOff = int32(4) + } + if iOff < (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { + iOff += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp+uintptr(iOff), bp)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(iOff) + *(*Ti64)(unsafe.Pointer(pIter + 112)) += *(*Ti64)(unsafe.Pointer(bp)) + } else { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags&int32(FTS5_SEGITER_ONETERM) == 0 { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg != 0 { + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + if iOff != _fts5LeafFirstTermOff(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) { + iOff += _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp+uintptr(iOff), bp+8) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(iOff) + _fts5SegIterLoadTerm(tls, p, pIter, *(*int32)(unsafe.Pointer(bp + 8))) + } else { + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32)) = 0 + _sqlite3Fts5HashScanNext(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) + _sqlite3Fts5HashScanEntry(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, bp+24, bp+32, bp+16, bp+36) + if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { + goto next_none_eof + } + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp = *(*uintptr)(unsafe.Pointer(bp + 16)) + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn = *(*int32)(unsafe.Pointer(bp + 36)) + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf = *(*int32)(unsafe.Pointer(bp + 36)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = *(*int32)(unsafe.Pointer(bp + 36)) + _sqlite3Fts5BufferSet(tls, p+60, pIter+96, *(*int32)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp + 24))) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(_sqlite3Fts5GetVarint(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), pIter+112)) + } + if pbNewTerm != 0 { + *(*int32)(unsafe.Pointer(pbNewTerm)) = int32(1) + } + } else { + goto next_none_eof + } + } + _fts5SegIterLoadNPos(tls, p, pIter) + return +next_none_eof: + ; + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) +} + +// C documentation +// +// /* +// ** Advance iterator pIter to the next entry. +// ** +// ** If an error occurs, Fts5Index.rc is set to an appropriate error code. It +// ** is not considered an error if the iterator reaches EOF. If an error has +// ** already occurred when this function is called, it is a no-op. +// */ +func _fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var a, pLeaf, v4, p1 uintptr + var bNewTerm, n, v2 int32 + var v3 Ti64 + var _ /* iDelta at bp+8 */ Tu64 + var _ /* iOff at bp+0 */ int32 + var _ /* nKeep at bp+4 */ int32 + var _ /* nList at bp+36 */ int32 + var _ /* nSz at bp+40 */ int32 + var _ /* nTerm at bp+32 */ int32 + var _ /* pList at bp+16 */ uintptr + var _ /* zTerm at bp+24 */ uintptr + _, _, _, _, _, _, _, _ = a, bNewTerm, n, pLeaf, v2, v3, v4, p1 + pLeaf = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf + bNewTerm = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + /* Search for the end of the position list within the current page. */ + a = (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp + n = (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + *(*int32)(unsafe.Pointer(bp)) = int32((*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset + int64((*TFts5SegIter)(unsafe.Pointer(pIter)).FnPos)) + if *(*int32)(unsafe.Pointer(bp)) < n { + /* The next entry is on the current page. */ + if *(*int32)(unsafe.Pointer(bp)) >= (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { + bNewTerm = int32(1) + if *(*int32)(unsafe.Pointer(bp)) != _fts5LeafFirstTermOff(tls, pLeaf) { + *(*int32)(unsafe.Pointer(bp)) += _sqlite3Fts5GetVarint32(tls, a+uintptr(*(*int32)(unsafe.Pointer(bp))), bp+4) + } + } else { + *(*int32)(unsafe.Pointer(bp)) += int32(_sqlite3Fts5GetVarint(tls, a+uintptr(*(*int32)(unsafe.Pointer(bp))), bp+8)) + p1 = pIter + 112 + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp + 8))) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer(bp))) + } else { + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 16)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32)) = 0 + *(*int32)(unsafe.Pointer(bp + 36)) = 0 + if 0 == (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags&int32(FTS5_SEGITER_ONETERM) { + _sqlite3Fts5HashScanNext(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) + _sqlite3Fts5HashScanEntry(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, bp+24, bp+32, bp+16, bp+36) + } + if *(*uintptr)(unsafe.Pointer(bp + 16)) == uintptr(0) { + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + } else { + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp = *(*uintptr)(unsafe.Pointer(bp + 16)) + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn = *(*int32)(unsafe.Pointer(bp + 36)) + (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf = *(*int32)(unsafe.Pointer(bp + 36)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = *(*int32)(unsafe.Pointer(bp + 36)) + int32(1) + _sqlite3Fts5BufferSet(tls, p+60, pIter+96, *(*int32)(unsafe.Pointer(bp + 32)), *(*uintptr)(unsafe.Pointer(bp + 24))) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(_sqlite3Fts5GetVarint(tls, *(*uintptr)(unsafe.Pointer(bp + 16)), pIter+112)) + *(*int32)(unsafe.Pointer(pbNewTerm)) = int32(1) + } + } else { + *(*int32)(unsafe.Pointer(bp)) = 0 + /* Next entry is not on the current page */ + for *(*int32)(unsafe.Pointer(bp)) == 0 { + _fts5SegIterNextPage(tls, p, pIter) + pLeaf = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf + if pLeaf == uintptr(0) { + break + } + v2 = int32(_fts5GetU16(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp)) + *(*int32)(unsafe.Pointer(bp)) = v2 + if v2 != 0 && *(*int32)(unsafe.Pointer(bp)) < (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + *(*int32)(unsafe.Pointer(bp)) += int32(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr(*(*int32)(unsafe.Pointer(bp))), pIter+112)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer(bp))) + if (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn > (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf), pIter+68) + } + } else { + if (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn > (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf), bp) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer(bp))) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = *(*int32)(unsafe.Pointer(bp)) + bNewTerm = int32(1) + } + } + if *(*int32)(unsafe.Pointer(bp)) > (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<> int32(1) + } + } +} + +// C documentation +// +// /* +// ** Iterator pIter currently points to the first rowid in a doclist. This +// ** function sets the iterator up so that iterates in reverse order through +// ** the doclist. +// */ +func _fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { + var bTermless, iEnd, iOff, iPoslist, iRowid, iSegid, pgno, pgnoLast, v1 int32 + var iAbs Ti64 + var pDlidx, pLast, pLeaf, pNew, pSeg, tmp uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bTermless, iAbs, iEnd, iOff, iPoslist, iRowid, iSegid, pDlidx, pLast, pLeaf, pNew, pSeg, pgno, pgnoLast, tmp, v1 + pDlidx = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpDlidx + pLast = uintptr(0) + pgnoLast = 0 + if pDlidx != 0 && (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FiVersion == int32(FTS5_CURRENT_VERSION) { + iSegid = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid + pgnoLast = _fts5DlidxIterPgno(tls, pDlidx) + pLast = _fts5LeafRead(tls, p, int64(iSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(libc.Int32FromInt32(0))<= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + pSeg = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg + /* The last rowid in the doclist may not be on the current page. Search + ** forward to find the page containing the last rowid. */ + pgno = (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno + int32(1) + for { + if !(!((*TFts5Index)(unsafe.Pointer(p)).Frc != 0) && pgno <= (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast) { + break + } + iAbs = int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B)) + int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)) + int64(libc.Int32FromInt32(0))<= (*TFts5Data)(unsafe.Pointer(pNew)).Fnn) + if iRowid != 0 { + tmp = pNew + pNew = pLast + pLast = tmp + pgnoLast = pgno + } + _fts5DataRelease(tls, pNew) + if bTermless == 0 { + break + } + } + goto _2 + _2: + ; + pgno++ + } + } + } + /* If pLast is NULL at this point, then the last rowid for this doclist + ** lies on the page currently indicated by the iterator. In this case + ** pIter->iLeafOffset is already set to point to the position-list size + ** field associated with the first relevant rowid on the page. + ** + ** Or, if pLast is non-NULL, then it is the page that contains the last + ** rowid. In this case configure the iterator so that it points to the + ** first rowid on this page. + */ + if pLast != 0 { + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pLast + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = pgnoLast + iOff = int32(_fts5GetU16(tls, (*TFts5Data)(unsafe.Pointer(pLast)).Fp)) + if iOff > (*TFts5Data)(unsafe.Pointer(pLast)).FszLeaf { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= (*TFts5Data)(unsafe.Pointer(pLast)).Fnn { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer(pLast)).Fnn + int32(1) + } else { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = _fts5LeafFirstTermOff(tls, pLast) + } + } + _fts5SegIterReverseInitPage(tls, p, pIter) +} + +// C documentation +// +// /* +// ** Iterator pIter currently points to the first rowid of a doclist. +// ** There is a doclist-index associated with the final term on the current +// ** page. If the current term is the last term on the page, load the +// ** doclist-index from disk and initialize an iterator at (pIter->pDlidx). +// */ +func _fts5SegIterLoadDlidx(tls *libc.TLS, p uintptr, pIter uintptr) { + var bRev, iSeg int32 + var pLeaf uintptr + _, _, _ = bRev, iSeg, pLeaf + iSeg = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid + bRev = (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags & int32(FTS5_SEGITER_REVERSE) + pLeaf = (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf /* Current leaf data */ + /* Check if the current doclist ends on this page. If it does, return + ** early without loading the doclist-index (as it belongs to a different + ** term. */ + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno == (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno && (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist < (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + return + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpDlidx = _fts5DlidxIterInit(tls, p, bRev, iSeg, (*TFts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno) +} + +// C documentation +// +// /* +// ** The iterator object passed as the second argument currently contains +// ** no valid values except for the Fts5SegIter.pLeaf member variable. This +// ** function searches the leaf page for a term matching (pTerm/nTerm). +// ** +// ** If the specified term is found on the page, then the iterator is left +// ** pointing to it. If argument bGe is zero and the term is not found, +// ** the iterator is left pointing at EOF. +// ** +// ** If bGe is non-zero and the specified term is not found, then the +// ** iterator is left pointing to the smallest term in the segment that +// ** is larger than the specified term, even if this term is not on the +// ** current page. +// */ +func _fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uintptr, nTerm int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var a uintptr + var bEndOfPage int32 + var i, iPgidx, n, nCmp, nMatch, v1, v4 Tu32 + var v2 uint32 + var _ /* iOff at bp+0 */ Tu32 + var _ /* iTermOff at bp+12 */ Tu32 + var _ /* nExtra at bp+16 */ int32 + var _ /* nKeep at bp+4 */ Tu32 + var _ /* nNew at bp+8 */ Tu32 + _, _, _, _, _, _, _, _, _, _ = a, bEndOfPage, i, iPgidx, n, nCmp, nMatch, v1, v2, v4 + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + n = uint32((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn) + nMatch = uint32(0) + *(*Tu32)(unsafe.Pointer(bp + 4)) = uint32(0) + *(*Tu32)(unsafe.Pointer(bp + 8)) = uint32(0) /* Current offset in pgidx */ + bEndOfPage = 0 + iPgidx = uint32((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) + iPgidx += uint32(_sqlite3Fts5GetVarint32(tls, a+uintptr(iPgidx), bp+12)) + *(*Tu32)(unsafe.Pointer(bp)) = *(*Tu32)(unsafe.Pointer(bp + 12)) + if *(*Tu32)(unsafe.Pointer(bp)) > n { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< int32(*(*Tu8)(unsafe.Pointer(pTerm + uintptr(nMatch)))) { + goto search_failed + } + } + } + if iPgidx >= n { + bEndOfPage = int32(1) + break + } + iPgidx += uint32(_sqlite3Fts5GetVarint32(tls, a+uintptr(iPgidx), bp+4)) + *(*Tu32)(unsafe.Pointer(bp + 12)) += *(*Tu32)(unsafe.Pointer(bp + 4)) + *(*Tu32)(unsafe.Pointer(bp)) = *(*Tu32)(unsafe.Pointer(bp + 12)) + if *(*Tu32)(unsafe.Pointer(bp)) >= n { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn) == 0 { + iPgidx = uint32((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) + iPgidx += uint32(_sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp+uintptr(iPgidx), bp)) + if *(*Tu32)(unsafe.Pointer(bp)) < uint32(4) || int64(*(*Tu32)(unsafe.Pointer(bp))) >= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< int64(n) || *(*Tu32)(unsafe.Pointer(bp + 8)) < uint32(1) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= n { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + int32(1) + } else { + iPgidx += uint32(_sqlite3Fts5GetVarint32(tls, a+uintptr(iPgidx), bp+16)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = int32(*(*Tu32)(unsafe.Pointer(bp + 12)) + uint32(*(*int32)(unsafe.Pointer(bp + 16)))) + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = int32(iPgidx) + _fts5SegIterLoadRowid(tls, p, pIter) + _fts5SegIterLoadNPos(tls, p, pIter) +} + +func _fts5IdxSelectStmt(tls *libc.TLS, p uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pConfig uintptr + _ = pConfig + if (*TFts5Index)(unsafe.Pointer(p)).FpIdxSelect == uintptr(0) { + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + _fts5IndexPrepareStmt(tls, p, p+112, Xsqlite3_mprintf(tls, __ccgo_ts+36372, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + return (*TFts5Index)(unsafe.Pointer(p)).FpIdxSelect +} + +// C documentation +// +// /* +// ** Initialize the object pIter to point to term pTerm/nTerm within segment +// ** pSeg. If there is no such term in the index, the iterator is set to EOF. +// ** +// ** If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// ** an error has already occurred when this function is called, it is a no-op. +// */ +func _fts5SegIterSeekInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32, flags int32, pSeg uintptr, pIter uintptr) { + var bDlidx, bGe, iPg int32 + var pIdxSelect uintptr + var val Ti64 + _, _, _, _, _ = bDlidx, bGe, iPg, pIdxSelect, val + iPg = int32(1) + bGe = flags & int32(FTS5INDEX_QUERY_SCAN) + bDlidx = 0 /* True if there is a doclist-index */ + pIdxSelect = uintptr(0) + libc.Xmemset(tls, pIter, 0, uint64(128)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg = pSeg + /* This block sets stack variable iPg to the leaf page number that may + ** contain term (pTerm/nTerm), if it is present in the segment. */ + pIdxSelect = _fts5IdxSelectStmt(tls, p) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + Xsqlite3_bind_int(tls, pIdxSelect, int32(1), (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid) + Xsqlite3_bind_blob(tls, pIdxSelect, int32(2), pTerm, nTerm, libc.UintptrFromInt32(0)) + if int32(SQLITE_ROW) == Xsqlite3_step(tls, pIdxSelect) { + val = int64(Xsqlite3_column_int(tls, pIdxSelect, 0)) + iPg = int32(val >> libc.Int32FromInt32(1)) + bDlidx = int32(val & libc.Int64FromInt32(0x0001)) + } + (*TFts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, pIdxSelect) + Xsqlite3_bind_null(tls, pIdxSelect, int32(2)) + if iPg < (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { + iPg = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst + bDlidx = 0 + } + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = iPg - int32(1) + _fts5SegIterNextPage(tls, p, pIter) + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + _fts5LeafSeek(tls, p, bGe, pIter, pTerm, nTerm) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (bGe == 0 || flags&int32(FTS5INDEX_QUERY_SCANONETERM) != 0) { + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_ONETERM) + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + if flags&int32(FTS5INDEX_QUERY_DESC) != 0 { + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_REVERSE) + } + if bDlidx != 0 { + _fts5SegIterLoadDlidx(tls, p, pIter) + } + if flags&int32(FTS5INDEX_QUERY_DESC) != 0 { + _fts5SegIterReverse(tls, p, pIter) + } + } + } + _fts5SegIterSetNext(tls, p, pIter) + if 0 == flags&int32(FTS5INDEX_QUERY_SCANONETERM) { + _fts5SegIterAllocTombstone(tls, p, pIter) + } + /* Either: + ** + ** 1) an error has occurred, or + ** 2) the iterator points to EOF, or + ** 3) the iterator points to an entry with term (pTerm/nTerm), or + ** 4) the FTS5INDEX_QUERY_SCAN flag was set and the iterator points + ** to an entry with a term greater than or equal to (pTerm/nTerm). + */ +} + +// C documentation +// +// /* +// ** SQL used by fts5SegIterNextInit() to find the page to open. +// */ +func _fts5IdxNextStmt(tls *libc.TLS, p uintptr) (r uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pConfig uintptr + _ = pConfig + if (*TFts5Index)(unsafe.Pointer(p)).FpIdxNextSelect == uintptr(0) { + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + _fts5IndexPrepareStmt(tls, p, p+120, Xsqlite3_mprintf(tls, __ccgo_ts+36456, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + return (*TFts5Index)(unsafe.Pointer(p)).FpIdxNextSelect +} + +// C documentation +// +// /* +// ** This is similar to fts5SegIterSeekInit(), except that it initializes +// ** the segment iterator to point to the first term following the page +// ** with pToken/nToken on it. +// */ +func _fts5SegIterNextInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32, pSeg uintptr, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, pSel uintptr + var bDlidx, iPg int32 + var val Ti64 + var _ /* iTermOff at bp+0 */ int32 + _, _, _, _, _ = a, bDlidx, iPg, pSel, val + iPg = -int32(1) /* Page of segment to open */ + bDlidx = 0 + pSel = uintptr(0) /* SELECT to find iPg */ + pSel = _fts5IdxNextStmt(tls, p) + if pSel != 0 { + Xsqlite3_bind_int(tls, pSel, int32(1), (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid) + Xsqlite3_bind_blob(tls, pSel, int32(2), pTerm, nTerm, libc.UintptrFromInt32(0)) + if Xsqlite3_step(tls, pSel) == int32(SQLITE_ROW) { + val = Xsqlite3_column_int64(tls, pSel, 0) + iPg = int32(val >> libc.Int32FromInt32(1)) + bDlidx = int32(val & libc.Int64FromInt32(0x0001)) + } + (*TFts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, pSel) + Xsqlite3_bind_null(tls, pSel, int32(2)) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + } + libc.Xmemset(tls, pIter, 0, uint64(128)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg = pSeg + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_ONETERM) + if iPg >= 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = iPg - int32(1) + _fts5SegIterNextPage(tls, p, pIter) + _fts5SegIterSetNext(tls, p, pIter) + } + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + *(*int32)(unsafe.Pointer(bp)) = 0 + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + *(*int32)(unsafe.Pointer(pIter + 64)) += _sqlite3Fts5GetVarint32(tls, a+uintptr((*TFts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff), bp) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(*(*int32)(unsafe.Pointer(bp))) + _fts5SegIterLoadTerm(tls, p, pIter, 0) + _fts5SegIterLoadNPos(tls, p, pIter) + if bDlidx != 0 { + _fts5SegIterLoadDlidx(tls, p, pIter) + } + } +} + +// C documentation +// +// /* +// ** Initialize the object pIter to point to term pTerm/nTerm within the +// ** in-memory hash table. If there is no such term in the hash-table, the +// ** iterator is set to EOF. +// ** +// ** If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// ** an error has already occurred when this function is called, it is a no-op. +// */ +func _fts5SegIterHashInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32, flags int32, pIter uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var v1 int32 + var _ /* n at bp+16 */ int32 + var _ /* nList at bp+0 */ int32 + var _ /* pLeaf at bp+24 */ uintptr + var _ /* pList at bp+32 */ uintptr + var _ /* z at bp+8 */ uintptr + _ = v1 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 24)) = uintptr(0) + if pTerm == uintptr(0) || flags&int32(FTS5INDEX_QUERY_SCAN) != 0 { + *(*uintptr)(unsafe.Pointer(bp + 32)) = uintptr(0) + (*TFts5Index)(unsafe.Pointer(p)).Frc = _sqlite3Fts5HashScanInit(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, pTerm, nTerm) + _sqlite3Fts5HashScanEntry(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, bp+8, bp+16, bp+32, bp) + if *(*uintptr)(unsafe.Pointer(bp + 32)) != 0 { + *(*uintptr)(unsafe.Pointer(bp + 24)) = _fts5IdxMalloc(tls, p, int64(16)) + if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { + (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).Fp = *(*uintptr)(unsafe.Pointer(bp + 32)) + } + } + /* The call to sqlite3Fts5HashScanInit() causes the hash table to + ** fill the size field of all existing position lists. This means they + ** can no longer be appended to. Since the only scenario in which they + ** can be appended to is if the previous operation on this table was + ** a DELETE, by clearing the Fts5Index.bDelete flag we can avoid this + ** possibility altogether. */ + (*TFts5Index)(unsafe.Pointer(p)).FbDelete = 0 + } else { + (*TFts5Index)(unsafe.Pointer(p)).Frc = _sqlite3Fts5HashQuery(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, int32(16), pTerm, nTerm, bp+24, bp) + if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { + (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).Fp = *(*uintptr)(unsafe.Pointer(bp + 24)) + 1*16 + } + *(*uintptr)(unsafe.Pointer(bp + 8)) = pTerm + *(*int32)(unsafe.Pointer(bp + 16)) = nTerm + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_ONETERM) + } + if *(*uintptr)(unsafe.Pointer(bp + 24)) != 0 { + _sqlite3Fts5BufferSet(tls, p+60, pIter+96, *(*int32)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 8))) + v1 = *(*int32)(unsafe.Pointer(bp)) + (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).FszLeaf = v1 + (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).Fnn = v1 + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = *(*uintptr)(unsafe.Pointer(bp + 24)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).Fp, pIter+112)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))).Fnn + if flags&int32(FTS5INDEX_QUERY_DESC) != 0 { + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_REVERSE) + _fts5SegIterReverseInitPage(tls, p, pIter) + } else { + _fts5SegIterLoadNPos(tls, p, pIter) + } + } + _fts5SegIterSetNext(tls, p, pIter) +} + +// C documentation +// +// /* +// ** Array ap[] contains n elements. Release each of these elements using +// ** fts5DataRelease(). Then free the array itself using sqlite3_free(). +// */ +func _fts5IndexFreeArray(tls *libc.TLS, ap uintptr, n int32) { + var ii int32 + _ = ii + if ap != 0 { + ii = 0 + for { + if !(ii < n) { + break + } + _fts5DataRelease(tls, *(*uintptr)(unsafe.Pointer(ap + uintptr(ii)*8))) + goto _1 + _1: + ; + ii++ + } + Xsqlite3_free(tls, ap) + } +} + +// C documentation +// +// /* +// ** Decrement the ref-count of the object passed as the only argument. If it +// ** reaches 0, free it and its contents. +// */ +func _fts5TombstoneArrayDelete(tls *libc.TLS, p uintptr) { + var ii int32 + _ = ii + if p != 0 { + (*TFts5TombstoneArray)(unsafe.Pointer(p)).FnRef-- + if (*TFts5TombstoneArray)(unsafe.Pointer(p)).FnRef <= 0 { + ii = 0 + for { + if !(ii < (*TFts5TombstoneArray)(unsafe.Pointer(p)).FnTombstone) { + break + } + _fts5DataRelease(tls, *(*uintptr)(unsafe.Pointer(p + 8 + uintptr(ii)*8))) + goto _1 + _1: + ; + ii++ + } + Xsqlite3_free(tls, p) + } + } +} + +// C documentation +// +// /* +// ** Zero the iterator passed as the only argument. +// */ +func _fts5SegIterClear(tls *libc.TLS, pIter uintptr) { + _sqlite3Fts5BufferFree(tls, pIter+96) + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf) + _fts5TombstoneArrayDelete(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpTombArray) + _fts5DlidxIterFree(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FpDlidx) + Xsqlite3_free(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset) + libc.Xmemset(tls, pIter, 0, uint64(128)) +} + +// C documentation +// +// /* +// ** Do the comparison necessary to populate pIter->aFirst[iOut]. +// ** +// ** If the returned value is non-zero, then it is the index of an entry +// ** in the pIter->aSeg[] array that is (a) not at EOF, and (b) pointing +// ** to a key that is a duplicate of another, higher priority, +// ** segment-iterator in the pSeg->aSeg[] array. +// */ +func _fts5MultiIterDoCompare(tls *libc.TLS, pIter uintptr, iOut int32) (r int32) { + var i1, i2, iRes, res, v1 int32 + var p1, p2, pRes uintptr + _, _, _, _, _, _, _, _ = i1, i2, iRes, p1, p2, pRes, res, v1 /* Right-hand Fts5SegIter */ + pRes = (*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(iOut)*4 + if iOut >= (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg/int32(2) { + i1 = (iOut - (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg/int32(2)) * int32(2) + i2 = i1 + int32(1) + } else { + i1 = int32((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(iOut*int32(2))*4))).FiFirst) + i2 = int32((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(iOut*int32(2)+int32(1))*4))).FiFirst) + } + p1 = pIter + 104 + uintptr(i1)*128 + p2 = pIter + 104 + uintptr(i2)*128 + (*TFts5CResult)(unsafe.Pointer(pRes)).FbTermEq = uint8(0) + if (*TFts5SegIter)(unsafe.Pointer(p1)).FpLeaf == uintptr(0) { /* If p1 is at EOF */ + iRes = i2 + } else { + if (*TFts5SegIter)(unsafe.Pointer(p2)).FpLeaf == uintptr(0) { /* If p2 is at EOF */ + iRes = i1 + } else { + res = _fts5BufferCompare(tls, p1+96, p2+96) + if res == 0 { + (*TFts5CResult)(unsafe.Pointer(pRes)).FbTermEq = uint8(1) + if (*TFts5SegIter)(unsafe.Pointer(p1)).FiRowid == (*TFts5SegIter)(unsafe.Pointer(p2)).FiRowid { + return i2 + } + if libc.BoolInt32((*TFts5SegIter)(unsafe.Pointer(p1)).FiRowid > (*TFts5SegIter)(unsafe.Pointer(p2)).FiRowid) == (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev { + v1 = -int32(1) + } else { + v1 = +libc.Int32FromInt32(1) + } + res = v1 + } + if res < 0 { + iRes = i1 + } else { + iRes = i2 + } + } + } + (*TFts5CResult)(unsafe.Pointer(pRes)).FiFirst = uint16(iRes) + return 0 +} + +// C documentation +// +// /* +// ** Move the seg-iter so that it points to the first rowid on page iLeafPgno. +// ** It is an error if leaf iLeafPgno does not exist. Unless the db is +// ** a 'secure-delete' db, if it contains no rowids then this is also an error. +// */ +func _fts5SegIterGotoPage(tls *libc.TLS, p uintptr, pIter uintptr, iLeafPgno int32) { + var a uintptr + var iOff, n int32 + _, _, _ = a, iOff, n + if iLeafPgno > (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FpgnoLast { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + n = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + if iOff < int32(4) || iOff >= n { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< _fts5DlidxIterRowid(tls, pDlidx) { + iLeafPgno = _fts5DlidxIterPgno(tls, pDlidx) + _fts5DlidxIterNext(tls, p, pDlidx) + } + if iLeafPgno > (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { + _fts5SegIterGotoPage(tls, p, pIter, iLeafPgno) + bMove = 0 + } + } else { + for !(_fts5DlidxIterEof(tls, p, pDlidx) != 0) && iMatch < _fts5DlidxIterRowid(tls, pDlidx) { + _fts5DlidxIterPrev(tls, p, pDlidx) + } + iLeafPgno = _fts5DlidxIterPgno(tls, pDlidx) + if iLeafPgno < (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = iLeafPgno + int32(1) + _fts5SegIterReverseNewPage(tls, p, pIter) + bMove = 0 + } + } + for cond := true; cond; cond = (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if bMove != 0 && (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5SegIter)(unsafe.Pointer(pIter)).FxNext})))(tls, p, pIter, uintptr(0)) + } + if (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { + break + } + if bRev == 0 && (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowid >= iMatch { + break + } + if bRev != 0 && (*TFts5SegIter)(unsafe.Pointer(pIter)).FiRowid <= iMatch { + break + } + bMove = int32(1) + } +} + +// C documentation +// +// /* +// ** Free the iterator object passed as the second argument. +// */ +func _fts5MultiIterFree(tls *libc.TLS, pIter uintptr) { + var i int32 + _ = i + if pIter != 0 { + i = 0 + for { + if !(i < (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg) { + break + } + _fts5SegIterClear(tls, pIter+104+uintptr(i)*128) + goto _1 + _1: + ; + i++ + } + _sqlite3Fts5BufferFree(tls, pIter+40) + Xsqlite3_free(tls, pIter) + } +} + +func _fts5MultiIterAdvanced(tls *libc.TLS, p uintptr, pIter uintptr, iChanged int32, iMinset int32) { + var i, iEq, v2 int32 + var pSeg uintptr + _, _, _, _ = i, iEq, pSeg, v2 + i = ((*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg + iChanged) / int32(2) + for { + if !(i >= iMinset && (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + break + } + v2 = _fts5MultiIterDoCompare(tls, pIter, i) + iEq = v2 + if v2 != 0 { + pSeg = pIter + 104 + uintptr(iEq)*128 + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5SegIter)(unsafe.Pointer(pSeg)).FxNext})))(tls, p, pSeg, uintptr(0)) + i = (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg + iEq + } + goto _1 + _1: + ; + i = i / int32(2) + } +} + +// C documentation +// +// /* +// ** Sub-iterator iChanged of iterator pIter has just been advanced. It still +// ** points to the same term though - just a different rowid. This function +// ** attempts to update the contents of the pIter->aFirst[] accordingly. +// ** If it does so successfully, 0 is returned. Otherwise 1. +// ** +// ** If non-zero is returned, the caller should call fts5MultiIterAdvanced() +// ** on the iterator instead. That function does the same as this one, except +// ** that it deals with more complicated cases as well. +// */ +func _fts5MultiIterAdvanceRowid(tls *libc.TLS, pIter uintptr, iChanged int32, ppFirst uintptr) (r int32) { + var i int32 + var pNew, pOther, pRes uintptr + var v1 int64 + _, _, _, _, _ = i, pNew, pOther, pRes, v1 + pNew = pIter + 104 + uintptr(iChanged)*128 + if (*TFts5SegIter)(unsafe.Pointer(pNew)).FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid || libc.BoolInt32((*TFts5SegIter)(unsafe.Pointer(pNew)).FiRowid < (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid) == (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev { + pOther = pIter + 104 + uintptr(iChanged^int32(0x0001))*128 + if (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev != 0 { + v1 = int64(-libc.Int32FromInt32(1)) - (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)< (*TFts5SegIter)(unsafe.Pointer(pNew)).FiRowid) == (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev { + (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*TFts5SegIter)(unsafe.Pointer(pOther)).FiRowid + pNew = pOther + } else { + if libc.BoolInt32((*TFts5SegIter)(unsafe.Pointer(pOther)).FiRowid > (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid) == (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev { + (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*TFts5SegIter)(unsafe.Pointer(pOther)).FiRowid + } + } + } + } + (*TFts5CResult)(unsafe.Pointer(pRes)).FiFirst = uint16((int64(pNew) - t__predefined_ptrdiff_t(pIter+104)) / 128) + if i == int32(1) { + break + } + pOther = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(i^int32(0x0001))*4))).FiFirst)*128 + goto _2 + _2: + ; + i = i / int32(2) + } + } + *(*uintptr)(unsafe.Pointer(ppFirst)) = pNew + return 0 +} + +// C documentation +// +// /* +// ** Set the pIter->bEof variable based on the state of the sub-iterators. +// */ +func _fts5MultiIterSetEof(tls *libc.TLS, pIter uintptr) { + var pSeg uintptr + _ = pSeg + pSeg = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128 + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof = libc.BoolUint8((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf == uintptr(0)) + (*TFts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid +} + +/* +** The argument to this macro must be an Fts5Data structure containing a +** tombstone hash page. This macro returns the key-size of the hash-page. + */ + +// C documentation +// +// /* +// ** Query a single tombstone hash table for rowid iRowid. Return true if +// ** it is found or false otherwise. The tombstone hash table is one of +// ** nHashTable tables. +// */ +func _fts5IndexTombstoneQuery(tls *libc.TLS, pHash uintptr, nHashTable int32, iRowid Tu64) (r int32) { + var aSlot, aSlot1 uintptr + var iSlot, nCollide, nSlot, szKey, v1, v2, v3, v4, v5 int32 + _, _, _, _, _, _, _, _, _, _, _ = aSlot, aSlot1, iSlot, nCollide, nSlot, szKey, v1, v2, v3, v4, v5 + if int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pHash)).Fp))) == int32(4) { + v1 = int32(4) + } else { + v1 = int32(8) + } + szKey = v1 + if (*TFts5Data)(unsafe.Pointer(pHash)).Fnn > int32(16) { + if int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pHash)).Fp))) == int32(4) { + v3 = int32(4) + } else { + v3 = int32(8) + } + v2 = ((*TFts5Data)(unsafe.Pointer(pHash)).Fnn - int32(8)) / v3 + } else { + v2 = int32(1) + } + nSlot = v2 + iSlot = int32(iRowid / uint64(nHashTable) % uint64(nSlot)) + nCollide = nSlot + if iRowid == uint64(0) { + return int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pHash)).Fp + 1))) + } else { + if szKey == int32(4) { + aSlot = (*TFts5Data)(unsafe.Pointer(pHash)).Fp + 8 + for *(*Tu32)(unsafe.Pointer(aSlot + uintptr(iSlot)*4)) != 0 { + if uint64(_fts5GetU32(tls, aSlot+uintptr(iSlot)*4)) == iRowid { + return int32(1) + } + v4 = nCollide + nCollide-- + if v4 == 0 { + break + } + iSlot = (iSlot + int32(1)) % nSlot + } + } else { + aSlot1 = (*TFts5Data)(unsafe.Pointer(pHash)).Fp + 8 + for *(*Tu64)(unsafe.Pointer(aSlot1 + uintptr(iSlot)*8)) != 0 { + if _fts5GetU64(tls, aSlot1+uintptr(iSlot)*8) == iRowid { + return int32(1) + } + v5 = nCollide + nCollide-- + if v5 == 0 { + break + } + iSlot = (iSlot + int32(1)) % nSlot + } + } + } + return 0 +} + +// C documentation +// +// /* +// ** Return true if the iterator passed as the only argument points +// ** to an segment entry for which there is a tombstone. Return false +// ** if there is no tombstone or if the iterator is already at EOF. +// */ +func _fts5MultiIterIsDeleted(tls *libc.TLS, pIter uintptr) (r int32) { + var iFirst, iPg int32 + var pArray, pSeg uintptr + _, _, _, _ = iFirst, iPg, pArray, pSeg + iFirst = int32((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst) + pSeg = pIter + 104 + uintptr(iFirst)*128 + pArray = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpTombArray + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0 && pArray != 0 { + /* Figure out which page the rowid might be present on. */ + iPg = int32(uint64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid) % uint64((*TFts5TombstoneArray)(unsafe.Pointer(pArray)).FnTombstone)) + /* If tombstone hash page iPg has not yet been loaded from the + ** database, load it now. */ + if *(*uintptr)(unsafe.Pointer(pArray + 8 + uintptr(iPg)*8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pArray + 8 + uintptr(iPg)*8)) = _fts5DataRead(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, int64((*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FiSegid+libc.Int32FromInt32(1)<= nSeg */ + nSlot = int64(2) + for { + if !(nSlot < int64(nSeg)) { + break + } + goto _1 + _1: + ; + nSlot = nSlot * int64(2) + } + pNew = _fts5IdxMalloc(tls, p, int64(uint64(232)+uint64(128)*uint64(nSlot-libc.Int64FromInt32(1))+uint64(4)*uint64(nSlot))) + if pNew != 0 { + (*TFts5Iter)(unsafe.Pointer(pNew)).FnSeg = int32(nSlot) + (*TFts5Iter)(unsafe.Pointer(pNew)).FaFirst = pNew + 104 + uintptr(nSlot)*128 + (*TFts5Iter)(unsafe.Pointer(pNew)).FpIndex = p + (*TFts5Iter)(unsafe.Pointer(pNew)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Noop) + } + return pNew +} + +func _fts5PoslistCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { + _ = pUnused + if nChunk > 0 { + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pContext)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pContext)).Fn), pChunk, uint64(nChunk)) + *(*int32)(unsafe.Pointer(pContext + 8)) += nChunk + } +} + +type TPoslistCallbackCtx = struct { + FpBuf uintptr + FpColset uintptr + FeState int32 +} + +type PoslistCallbackCtx = TPoslistCallbackCtx + +type TPoslistCallbackCtx1 = struct { + FpBuf uintptr + FpColset uintptr + FeState int32 +} + +type PoslistCallbackCtx1 = TPoslistCallbackCtx1 + +type TPoslistOffsetsCtx = struct { + FpBuf uintptr + FpColset uintptr + FiRead int32 + FiWrite int32 +} + +type PoslistOffsetsCtx = TPoslistOffsetsCtx + +type TPoslistOffsetsCtx1 = struct { + FpBuf uintptr + FpColset uintptr + FiRead int32 + FiWrite int32 +} + +type PoslistOffsetsCtx1 = TPoslistOffsetsCtx1 + +// C documentation +// +// /* +// ** TODO: Make this more efficient! +// */ +func _fts5IndexColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol) { + break + } + if *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(i)*4)) == iCol { + return int32(1) + } + goto _1 + _1: + ; + i++ + } + return 0 +} + +func _fts5PoslistOffsetsCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var pCtx uintptr + var _ /* iVal at bp+0 */ int32 + _, _ = i, pCtx + pCtx = pContext + _ = pUnused + if nChunk > 0 { + i = 0 + for i < nChunk { + i += _sqlite3Fts5GetVarint32(tls, pChunk+uintptr(i), bp) + *(*int32)(unsafe.Pointer(bp)) += (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiRead - int32(2) + (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiRead = *(*int32)(unsafe.Pointer(bp)) + if _fts5IndexColsetTest(tls, (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp))) != 0 { + *(*int32)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), uint64(*(*int32)(unsafe.Pointer(bp))+libc.Int32FromInt32(2)-(*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite)) + (*TPoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite = *(*int32)(unsafe.Pointer(bp)) + } + } + } +} + +func _fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, iStart, v1, v2 int32 + var pCtx uintptr + var _ /* iCol at bp+0 */ int32 + var _ /* iCol at bp+4 */ int32 + _, _, _, _, _ = i, iStart, pCtx, v1, v2 + pCtx = pContext + _ = pUnused + if nChunk > 0 { + /* Search through to find the first varint with value 1. This is the + ** start of the next columns hits. */ + i = 0 + iStart = 0 + if (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState == int32(2) { + v1 = i + i++ + *(*int32)(unsafe.Pointer(bp)) = int32(*(*Tu8)(unsafe.Pointer(pChunk + uintptr(v1)))) + if *(*int32)(unsafe.Pointer(bp))&int32(0x80) != 0 { + i-- + i += _sqlite3Fts5GetVarint32(tls, pChunk+uintptr(i), bp) + } + if _fts5IndexColsetTest(tls, (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp))) != 0 { + (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = int32(1) + *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), uint64(libc.Int32FromInt32(1))) + } else { + (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = 0 + } + } + for cond := true; cond; cond = i < nChunk { + for i < nChunk && int32(*(*Tu8)(unsafe.Pointer(pChunk + uintptr(i)))) != int32(0x01) { + for int32(*(*Tu8)(unsafe.Pointer(pChunk + uintptr(i))))&int32(0x80) != 0 { + i++ + } + i++ + } + if (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), pChunk+uintptr(iStart), uint64(i-iStart)) + *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += i - iStart + } + if i < nChunk { + iStart = i + i++ + if i >= nChunk { + (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = int32(2) + } else { + v2 = i + i++ + *(*int32)(unsafe.Pointer(bp + 4)) = int32(*(*Tu8)(unsafe.Pointer(pChunk + uintptr(v2)))) + if *(*int32)(unsafe.Pointer(bp + 4))&int32(0x80) != 0 { + i-- + i += _sqlite3Fts5GetVarint32(tls, pChunk+uintptr(i), bp+4) + } + (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = _fts5IndexColsetTest(tls, (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp + 4))) + if (*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf)).Fn), pChunk+uintptr(iStart), uint64(i-iStart)) + *(*int32)(unsafe.Pointer((*TPoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8)) += i - iStart + iStart = i + } + } + } + } + } +} + +func _fts5ChunkIterate(tls *libc.TLS, p uintptr, pSeg uintptr, pCtx uintptr, xChunk uintptr) { + var nChunk, nRem, pgno, pgnoSave, v2 int32 + var pChunk, pData uintptr + var v1 int64 + _, _, _, _, _, _, _, _ = nChunk, nRem, pChunk, pData, pgno, pgnoSave, v1, v2 + nRem = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos /* Number of bytes still to come */ + pData = uintptr(0) + pChunk = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset) + if int64(nRem) < int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf)-(*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset { + v1 = int64(nRem) + } else { + v1 = int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) - (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + } + nChunk = int32(v1) + pgno = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno + pgnoSave = 0 + /* This function does not work with detail=none databases. */ + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).Fflags&int32(FTS5_SEGITER_REVERSE) == 0 { + pgnoSave = pgno + int32(1) + } + for int32(1) != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{xChunk})))(tls, p, pCtx, pChunk, nChunk) + nRem -= nChunk + _fts5DataRelease(tls, pData) + if nRem <= 0 { + break + } else { + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<base.pData/nData to point to the new position list. +// ** If memory is required for the new position list, use buffer pIter->poslist. +// ** Or, if the new position list is a contiguous subset of the input, set +// ** pIter->base.pData/nData to point directly to it. +// ** +// ** This function is a no-op if *pRc is other than SQLITE_OK when it is +// ** called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM +// ** before returning. +// */ +func _fts5IndexExtractColset(tls *libc.TLS, pRc uintptr, pColset uintptr, pPos uintptr, nPos int32, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aCopy, p, pEnd, v1, v3, v4, p2 uintptr + var i int32 + var _ /* iCurrent at bp+0 */ int32 + _, _, _, _, _, _, _, _ = aCopy, i, p, pEnd, v1, v3, v4, p2 + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + p = pPos + aCopy = p + pEnd = p + uintptr(nPos) /* One byte past end of position list */ + i = 0 + *(*int32)(unsafe.Pointer(bp)) = 0 + if (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol > int32(1) && _sqlite3Fts5BufferSize(tls, pRc, pIter+40, uint32(nPos)) != 0 { + return + } + for int32(1) != 0 { + for *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(i)*4)) < *(*int32)(unsafe.Pointer(bp)) { + i++ + if i == (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol { + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + return + } + } + /* Advance pointer p until it points to pEnd or an 0x01 byte that is + ** not part of a varint */ + for p < pEnd && int32(*(*Tu8)(unsafe.Pointer(p))) != int32(0x01) { + for { + v1 = p + p++ + if !(int32(*(*Tu8)(unsafe.Pointer(v1)))&int32(0x80) != 0) { + break + } + } + } + if *(*int32)(unsafe.Pointer(pColset + 4 + uintptr(i)*4)) == *(*int32)(unsafe.Pointer(bp)) { + if (*TFts5Colset)(unsafe.Pointer(pColset)).FnCol == int32(1) { + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = aCopy + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = int32(int64(p) - int64(aCopy)) + return + } + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fn), aCopy, uint64(int64(p)-int64(aCopy))) + p2 = pIter + 40 + 8 + *(*int32)(unsafe.Pointer(p2)) = int32(int64(*(*int32)(unsafe.Pointer(p2))) + (int64(p) - int64(aCopy))) + } + if p >= pEnd { + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + return + } + v3 = p + p++ + aCopy = v3 + v4 = p + p++ + *(*int32)(unsafe.Pointer(bp)) = int32(*(*Tu8)(unsafe.Pointer(v4))) + if *(*int32)(unsafe.Pointer(bp))&int32(0x80) != 0 { + p-- + p += uintptr(_sqlite3Fts5GetVarint32(tls, p, bp)) + } + } + } +} + +// C documentation +// +// /* +// ** xSetOutputs callback used by detail=none tables. +// */ +func _fts5IterSetOutputs_None(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos +} + +// C documentation +// +// /* +// ** xSetOutputs callback used by detail=full and detail=col tables when no +// ** column filters are specified. +// */ +func _fts5IterSetOutputs_Nocolset(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) <= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { + /* All data is stored on the current page. Populate the output + ** variables to point into the body of the page object. */ + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset) + } else { + /* The data is distributed over two or more pages. Copy it into the + ** Fts5Iter.poslist buffer and then set the output pointer to point + ** to this buffer. */ + _sqlite3Fts5BufferZero(tls, pIter+40) + _fts5SegiterPoslist(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, uintptr(0), pIter+40) + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + } +} + +// C documentation +// +// /* +// ** xSetOutputs callback used when the Fts5Colset object has nCol==0 (match +// ** against no columns at all). +// */ +func _fts5IterSetOutputs_ZeroColset(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + _ = pSeg + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = 0 +} + +// C documentation +// +// /* +// ** xSetOutputs callback used by detail=col when there is a column filter +// ** and there are 100 or more columns. Also called as a fallback from +// ** fts5IterSetOutputs_Col100 if the column-list spans more than one page. +// */ +func _fts5IterSetOutputs_Col(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + _sqlite3Fts5BufferZero(tls, pIter+40) + _fts5SegiterPoslist(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, (*TFts5Iter)(unsafe.Pointer(pIter)).FpColset, pIter+40) + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn +} + +// C documentation +// +// /* +// ** xSetOutputs callback used when: +// ** +// ** * detail=col, +// ** * there is a column filter, and +// ** * the table contains 100 or fewer columns. +// ** +// ** The last point is to ensure all column numbers are stored as +// ** single-byte varints. +// */ +func _fts5IterSetOutputs_Col100(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + var a, aOut, aiCol, aiColEnd, pEnd, v1, v2 uintptr + var iPrev, iPrevOut int32 + _, _, _, _, _, _, _, _, _ = a, aOut, aiCol, aiColEnd, iPrev, iPrevOut, pEnd, v1, v2 + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) > int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { + _fts5IterSetOutputs_Col(tls, pIter, pSeg) + } else { + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset) + pEnd = a + uintptr((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) + iPrev = 0 + aiCol = (*TFts5Iter)(unsafe.Pointer(pIter)).FpColset + 4 + aiColEnd = aiCol + uintptr((*TFts5Colset)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpColset)).FnCol)*4 + aOut = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + iPrevOut = 0 + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + for a < pEnd { + v1 = a + a++ + iPrev += int32(*(*Tu8)(unsafe.Pointer(v1))) - int32(2) + for *(*int32)(unsafe.Pointer(aiCol)) < iPrev { + aiCol += 4 + if aiCol == aiColEnd { + goto setoutputs_col_out + } + } + if *(*int32)(unsafe.Pointer(aiCol)) == iPrev { + v2 = aOut + aOut++ + *(*Tu8)(unsafe.Pointer(v2)) = uint8(iPrev - iPrevOut + libc.Int32FromInt32(2)) + iPrevOut = iPrev + } + } + setoutputs_col_out: + ; + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = int32(int64(aOut) - int64((*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp)) + } +} + +// C documentation +// +// /* +// ** xSetOutputs callback used by detail=full when there is a column filter. +// */ +func _fts5IterSetOutputs_Full(tls *libc.TLS, pIter uintptr, pSeg uintptr) { + var a, pColset, pRc uintptr + _, _, _ = a, pColset, pRc + pColset = (*TFts5Iter)(unsafe.Pointer(pIter)).FpColset + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset+int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos) <= int64((*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { + /* All data is stored on the current page. Populate the output + ** variables to point into the body of the page object. */ + a = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset) + pRc = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex + 60 + _sqlite3Fts5BufferZero(tls, pIter+40) + _fts5IndexExtractColset(tls, pRc, pColset, a, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos, pIter) + } else { + /* The data is distributed over two or more pages. Copy it into the + ** Fts5Iter.poslist buffer and then set the output pointer to point + ** to this buffer. */ + _sqlite3Fts5BufferZero(tls, pIter+40) + _fts5SegiterPoslist(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, pColset, pIter+40) + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + } +} + +func _fts5IterSetOutputCb(tls *libc.TLS, pRc uintptr, pIter uintptr) { + var pConfig uintptr + _ = pConfig + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + pConfig = (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex)).FpConfig + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_None) + } else { + if (*TFts5Iter)(unsafe.Pointer(pIter)).FpColset == uintptr(0) { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Nocolset) + } else { + if (*TFts5Colset)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpColset)).FnCol == 0 { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_ZeroColset) + } else { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_FULL { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Full) + } else { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol <= int32(100) { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Col100) + _sqlite3Fts5BufferSize(tls, pRc, pIter+40, uint32((*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)) + } else { + (*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = __ccgo_fp(_fts5IterSetOutputs_Col) + } + } + } + } + } + } +} + +// C documentation +// +// /* +// ** All the component segment-iterators of pIter have been set up. This +// ** functions finishes setup for iterator pIter itself. +// */ +func _fts5MultiIterFinishSetup(tls *libc.TLS, p uintptr, pIter uintptr) { + var iEq, iIter, v2 int32 + var pSeg, pSeg1 uintptr + _, _, _, _, _ = iEq, iIter, pSeg, pSeg1, v2 + iIter = (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg - int32(1) + for { + if !(iIter > 0) { + break + } + v2 = _fts5MultiIterDoCompare(tls, pIter, iIter) + iEq = v2 + if v2 != 0 { + pSeg = pIter + 104 + uintptr(iEq)*128 + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5SegIter)(unsafe.Pointer(pSeg)).FxNext})))(tls, p, pSeg, uintptr(0)) + } + _fts5MultiIterAdvanced(tls, p, pIter, iEq, iIter) + } + goto _1 + _1: + ; + iIter-- + } + _fts5MultiIterSetEof(tls, pIter) + if (*TFts5Iter)(unsafe.Pointer(pIter)).FbSkipEmpty != 0 && _fts5MultiIterIsEmpty(tls, p, pIter) != 0 || _fts5MultiIterIsDeleted(tls, pIter) != 0 { + _fts5MultiIterNext(tls, p, pIter, 0, 0) + } else { + if int32((*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof) == 0 { + pSeg1 = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128 + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs})))(tls, pIter, pSeg1) + } + } +} + +// C documentation +// +// /* +// ** Allocate a new Fts5Iter object. +// ** +// ** The new object will be used to iterate through data in structure pStruct. +// ** If iLevel is -ve, then all data in all segments is merged. Or, if iLevel +// ** is zero or greater, data from the first nSegment segments on level iLevel +// ** is merged. +// ** +// ** The iterator initially points to the first term/rowid entry in the +// ** iterated data. +// */ +func _fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, pColset uintptr, pTerm uintptr, nTerm int32, iLevel int32, nSegment int32, ppOut uintptr) { + var iIter, iSeg, nSeg, v1, v3, v6, v8 int32 + var pEnd, pIter, pIter1, pLvl, pNew, pSeg, v2 uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iIter, iSeg, nSeg, pEnd, pIter, pIter1, pLvl, pNew, pSeg, v1, v2, v3, v6, v8 + nSeg = 0 /* Number of segment-iters in use */ + iIter = 0 + /* Allocate space for the new multi-seg-iterator. */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if iLevel < 0 { + nSeg = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment + nSeg += libc.BoolInt32((*TFts5Index)(unsafe.Pointer(p)).FpHash != 0 && 0 == flags&int32(FTS5INDEX_QUERY_SKIPHASH)) + } else { + if (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLevel)*16))).FnSeg < nSegment { + v1 = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLevel)*16))).FnSeg + } else { + v1 = nSegment + } + nSeg = v1 + } + } + v2 = _fts5MultiIterAlloc(tls, p, nSeg) + pNew = v2 + *(*uintptr)(unsafe.Pointer(ppOut)) = v2 + if pNew == uintptr(0) { + goto fts5MultiIterNew_post_check + } + (*TFts5Iter)(unsafe.Pointer(pNew)).FbRev = libc.BoolInt32(0 != flags&int32(FTS5INDEX_QUERY_DESC)) + (*TFts5Iter)(unsafe.Pointer(pNew)).FbSkipEmpty = libc.BoolUint8(libc.Int32FromInt32(0) != flags&libc.Int32FromInt32(FTS5INDEX_QUERY_SKIPEMPTY)) + (*TFts5Iter)(unsafe.Pointer(pNew)).FpColset = pColset + if flags&int32(FTS5INDEX_QUERY_NOOUTPUT) == 0 { + _fts5IterSetOutputCb(tls, p+60, pNew) + } + /* Initialize each of the component segment iterators. */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if iLevel < 0 { + pEnd = pStruct + 32 + uintptr((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel)*16 + if (*TFts5Index)(unsafe.Pointer(p)).FpHash != 0 && 0 == flags&int32(FTS5INDEX_QUERY_SKIPHASH) { + v3 = iIter + iIter++ + /* Add a segment iterator for the current contents of the hash table. */ + pIter = pNew + 104 + uintptr(v3)*128 + _fts5SegIterHashInit(tls, p, pTerm, nTerm, flags, pIter) + } + pLvl = pStruct + 32 + for { + if !(pLvl < pEnd) { + break + } + iSeg = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg - int32(1) + for { + if !(iSeg >= 0) { + break + } + pSeg = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*56 + v6 = iIter + iIter++ + pIter1 = pNew + 104 + uintptr(v6)*128 + if pTerm == uintptr(0) { + _fts5SegIterInit(tls, p, pSeg, pIter1) + } else { + _fts5SegIterSeekInit(tls, p, pTerm, nTerm, flags, pSeg, pIter1) + } + goto _5 + _5: + ; + iSeg-- + } + goto _4 + _4: + ; + pLvl += 16 + } + } else { + pLvl = pStruct + 32 + uintptr(iLevel)*16 + iSeg = nSeg - int32(1) + for { + if !(iSeg >= 0) { + break + } + v8 = iIter + iIter++ + _fts5SegIterInit(tls, p, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(iSeg)*56, pNew+104+uintptr(v8)*128) + goto _7 + _7: + ; + iSeg-- + } + } + } + /* If the above was successful, each component iterator now points + ** to the first entry in its segment. In this case initialize the + ** aFirst[] array. Or, if an error has occurred, free the iterator + ** object and set the output variable to NULL. */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _fts5MultiIterFinishSetup(tls, p, pNew) + } else { + _fts5MultiIterFree(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } +fts5MultiIterNew_post_check: + ; + return +} + +// C documentation +// +// /* +// ** Create an Fts5Iter that iterates through the doclist provided +// ** as the second argument. +// */ +func _fts5MultiIterNew2(tls *libc.TLS, p uintptr, pData uintptr, bDesc int32, ppOut uintptr) { + var pIter, pNew uintptr + _, _ = pIter, pNew + pNew = _fts5MultiIterAlloc(tls, p, int32(2)) + if pNew != 0 { + pIter = pNew + 104 + 1*128 + (*TFts5SegIter)(unsafe.Pointer(pIter)).Fflags = int32(FTS5_SEGITER_ONETERM) + if (*TFts5Data)(unsafe.Pointer(pData)).FszLeaf > 0 { + (*TFts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pData + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(_sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp, pIter+112)) + (*TFts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*TFts5Data)(unsafe.Pointer(pData)).Fnn + (*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pNew)).FaFirst + 1*4))).FiFirst = uint16(1) + if bDesc != 0 { + (*TFts5Iter)(unsafe.Pointer(pNew)).FbRev = int32(1) + *(*int32)(unsafe.Pointer(pIter + 8)) |= int32(FTS5_SEGITER_REVERSE) + _fts5SegIterReverseInitPage(tls, p, pIter) + } else { + _fts5SegIterLoadNPos(tls, p, pIter) + } + pData = uintptr(0) + } else { + (*TFts5Iter)(unsafe.Pointer(pNew)).Fbase.FbEof = uint8(1) + } + _fts5SegIterSetNext(tls, p, pIter) + *(*uintptr)(unsafe.Pointer(ppOut)) = pNew + } + _fts5DataRelease(tls, pData) +} + +// C documentation +// +// /* +// ** Return true if the iterator is at EOF or if an error has occurred. +// ** False otherwise. +// */ +func _fts5MultiIterEof(tls *libc.TLS, p uintptr, pIter uintptr) (r int32) { + return libc.BoolInt32((*TFts5Index)(unsafe.Pointer(p)).Frc != 0 || (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof != 0) +} + +// C documentation +// +// /* +// ** Return the rowid of the entry that the iterator currently points +// ** to. If the iterator points to EOF when this function is called the +// ** results are undefined. +// */ +func _fts5MultiIterRowid(tls *libc.TLS, pIter uintptr) (r Ti64) { + return (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128))).FiRowid +} + +// C documentation +// +// /* +// ** Move the iterator to the next entry at or following iMatch. +// */ +func _fts5MultiIterNextFrom(tls *libc.TLS, p uintptr, pIter uintptr, iMatch Ti64) { + var iRowid Ti64 + _ = iRowid + for int32(1) != 0 { + _fts5MultiIterNext(tls, p, pIter, int32(1), iMatch) + if _fts5MultiIterEof(tls, p, pIter) != 0 { + break + } + iRowid = _fts5MultiIterRowid(tls, pIter) + if (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev == 0 && iRowid >= iMatch { + break + } + if (*TFts5Iter)(unsafe.Pointer(pIter)).FbRev != 0 && iRowid <= iMatch { + break + } + } +} + +// C documentation +// +// /* +// ** Return a pointer to a buffer containing the term associated with the +// ** entry that the iterator currently points to. +// */ +func _fts5MultiIterTerm(tls *libc.TLS, pIter uintptr, pn uintptr) (r uintptr) { + var p uintptr + _ = p + p = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128 + *(*int32)(unsafe.Pointer(pn)) = (*TFts5SegIter)(unsafe.Pointer(p)).Fterm.Fn + return (*TFts5SegIter)(unsafe.Pointer(p)).Fterm.Fp +} + +// C documentation +// +// /* +// ** Allocate a new segment-id for the structure pStruct. The new segment +// ** id must be between 1 and 65335 inclusive, and must not be used by +// ** any currently existing segment. If a free segment id cannot be found, +// ** SQLITE_FULL is returned. +// ** +// ** If an error has already occurred, this function is a no-op. 0 is +// ** returned in this case. +// */ +func _fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { + bp := tls.Alloc(256) + defer tls.Free(256) + var i, iId, iLvl, iSeg, iSegid int32 + var mask Tu32 + var _ /* aUsed at bp+0 */ [63]Tu32 + _, _, _, _, _, _ = i, iId, iLvl, iSeg, iSegid, mask + iSegid = 0 + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment >= int32(FTS5_MAX_SEGMENT) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_FULL) + } else { + libc.Xmemset(tls, bp, 0, uint64(252)) + iLvl = 0 + for { + if !(iLvl < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + iSeg = 0 + for { + if !(iSeg < (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg) { + break + } + iId = (*(*TFts5StructureSegment)(unsafe.Pointer((*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FaSeg + uintptr(iSeg)*56))).FiSegid + if iId <= int32(FTS5_MAX_SEGMENT) && iId > 0 { + *(*Tu32)(unsafe.Pointer(bp + uintptr((iId-int32(1))/int32(32))*4)) |= libc.Uint32FromInt32(1) << ((iId - int32(1)) % int32(32)) + } + goto _2 + _2: + ; + iSeg++ + } + goto _1 + _1: + ; + iLvl++ + } + i = 0 + for { + if !((*(*[63]Tu32)(unsafe.Pointer(bp)))[i] == uint32(0xFFFFFFFF)) { + break + } + goto _3 + _3: + ; + i++ + } + mask = (*(*[63]Tu32)(unsafe.Pointer(bp)))[i] + iSegid = 0 + for { + if !(mask&(libc.Uint32FromInt32(1)<) shares with buffer (pOld/nOld). +// ** +// ** Buffer (pNew/) is guaranteed to be greater +// ** than buffer (pOld/nOld). +// */ +func _fts5PrefixCompress(tls *libc.TLS, nOld int32, pOld uintptr, pNew uintptr) (r int32) { + var i int32 + _ = i + i = 0 + for { + if !(i < nOld) { + break + } + if int32(*(*Tu8)(unsafe.Pointer(pOld + uintptr(i)))) != int32(*(*Tu8)(unsafe.Pointer(pNew + uintptr(i)))) { + break + } + goto _1 + _1: + ; + i++ + } + return i +} + +func _fts5WriteDlidxClear(tls *libc.TLS, p uintptr, pWriter uintptr, bFlush int32) { + var i int32 + var pDlidx uintptr + _, _ = i, pDlidx + i = 0 + for { + if !(i < (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx) { + break + } + pDlidx = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32 + if (*TFts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn == 0 { + break + } + if bFlush != 0 { + _fts5DataWrite(tls, p, int64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(i)<aDlidx[] array to at least nLvl elements in size. +// ** Any new array elements are zeroed before returning. +// */ +func _fts5WriteDlidxGrow(tls *libc.TLS, p uintptr, pWriter uintptr, nLvl int32) (r int32) { + var aDlidx uintptr + var nByte Tsize_t + _, _ = aDlidx, nByte + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && nLvl >= (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx { + aDlidx = Xsqlite3_realloc64(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx, uint64(32)*uint64(nLvl)) + if aDlidx == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + nByte = uint64(32) * uint64(nLvl-(*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx) + libc.Xmemset(tls, aDlidx+uintptr((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx)*32, 0, nByte) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx = aDlidx + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx = nLvl + } + } + return (*TFts5Index)(unsafe.Pointer(p)).Frc +} + +// C documentation +// +// /* +// ** If the current doclist-index accumulating in pWriter->aDlidx[] is large +// ** enough, flush it to disk and return 1. Otherwise discard it and return +// ** zero. +// */ +func _fts5WriteFlushDlidx(tls *libc.TLS, p uintptr, pWriter uintptr) (r int32) { + var bFlag int32 + _ = bFlag + bFlag = 0 + /* If there were FTS5_MIN_DLIDX_SIZE or more empty leaf pages written + ** to the database, also write the doclist-index to disk. */ + if (*(*TFts5DlidxWriter)(unsafe.Pointer((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx))).Fbuf.Fn > 0 && (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty >= int32(FTS5_MIN_DLIDX_SIZE) { + bFlag = int32(1) + } + _fts5WriteDlidxClear(tls, p, pWriter, bFlag) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty = 0 + return bFlag +} + +// C documentation +// +// /* +// ** This function is called whenever processing of the doclist for the +// ** last term on leaf page (pWriter->iBtPage) is completed. +// ** +// ** The doclist-index for that term is currently stored in-memory within the +// ** Fts5SegWriter.aDlidx[] array. If it is large enough, this function +// ** writes it out to disk. Or, if it is too small to bother with, discards +// ** it. +// ** +// ** Fts5SegWriter.btterm currently contains the first term on page iBtPage. +// */ +func _fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { + var bFlag int32 + var z, v1 uintptr + _, _, _ = bFlag, z, v1 + if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage == 0 { + return + } + bFlag = _fts5WriteFlushDlidx(tls, p, pWriter) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { + v1 = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp + } else { + v1 = __ccgo_ts + 1680 + } + z = v1 + /* The following was already done in fts5WriteInit(): */ + /* sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */ + Xsqlite3_bind_blob(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter, int32(2), z, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn, libc.UintptrFromInt32(0)) + Xsqlite3_bind_int64(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter, int32(3), int64(bFlag)+int64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage)< 0 { + pDlidx = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + _sqlite3Fts5BufferAppendVarint(tls, p+60, pDlidx+16, 0) + } + /* Increment the "number of sequential leaves without a term" counter. */ + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty++ +} + +func _fts5DlidxExtractFirstRowid(tls *libc.TLS, pBuf uintptr) (r Ti64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iOff int32 + var _ /* iRowid at bp+0 */ Ti64 + _ = iOff + iOff = int32(1) + int32(_sqlite3Fts5GetVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+1, bp)) + _sqlite3Fts5GetVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr(iOff), bp) + return *(*Ti64)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Rowid iRowid has just been appended to the current leaf page. It is the +// ** first on the page. This function appends an appropriate entry to the current +// ** doclist-index. +// */ +func _fts5WriteDlidxAppend(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid Ti64) { + var bDone, i, v2 int32 + var iFirst, iPgno, iVal Ti64 + var pDlidx uintptr + _, _, _, _, _, _, _ = bDone, i, iFirst, iPgno, iVal, pDlidx, v2 + bDone = 0 + i = 0 + for { + if !((*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && bDone == 0) { + break + } + pDlidx = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32 + if (*TFts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn >= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + /* The current doclist-index page is full. Write it to disk and push + ** a copy of iRowid (which will become the first rowid on the next + ** doclist-index leaf page) up into the next level of the b-tree + ** hierarchy. If the node being flushed is currently the root node, + ** also push its first rowid upwards. */ + *(*Tu8)(unsafe.Pointer((*TFts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fp)) = uint8(0x01) /* Not the root node */ + _fts5DataWrite(tls, p, int64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(1))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(i)<= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn > int32(4) { + _fts5WriteFlushLeaf(tls, p, pWriter) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + } + if !(uint32((*TFts5Buffer)(unsafe.Pointer(pPage+8)).Fn)+uint32(nTerm+libc.Int32FromInt32(FTS5_DATA_PADDING)) <= uint32((*TFts5Buffer)(unsafe.Pointer(pPage+8)).FnSpace)) { + _sqlite3Fts5BufferSize(tls, p+60, pPage+8, uint32(nTerm+int32(FTS5_DATA_PADDING)+(*TFts5Buffer)(unsafe.Pointer(pPage+8)).Fn)) + } + } + /* TODO1: Updating pgidx here. */ + *(*int32)(unsafe.Pointer(pPgidx + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn), uint64((*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn-(*TFts5PageWriter)(unsafe.Pointer(pPage)).FiPrevPgidx)) + (*TFts5PageWriter)(unsafe.Pointer(pPage)).FiPrevPgidx = (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn + if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage != 0 { + nPrefix = 0 + if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgno != int32(1) { + /* This is the first term on a leaf that is not the leftmost leaf in + ** the segment b-tree. In this case it is necessary to add a term to + ** the b-tree hierarchy that is (a) larger than the largest term + ** already written to the segment and (b) smaller than or equal to + ** this term. In other words, a prefix of (pTerm/nTerm) that is one + ** byte longer than the longest prefix (pTerm/nTerm) shares with the + ** previous term. + ** + ** Usually, the previous term is available in pPage->term. The exception + ** is if this is the first term written in an incremental-merge step. + ** In this case the previous term is not available, so just write a + ** copy of (pTerm/nTerm) into the parent node. This is slightly + ** inefficient, but still correct. */ + n = nTerm + if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fn != 0 { + n = int32(1) + _fts5PrefixCompress(tls, nMin, (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fp, pTerm) + } + _fts5WriteBtreeTerm(tls, p, pWriter, n, pTerm) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + pPage = pWriter + 8 + } + } else { + nPrefix = _fts5PrefixCompress(tls, nMin, (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fp, pTerm) + _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, int64(nPrefix)) + } + /* Append the number of bytes of new data, then the term data itself + ** to the page. */ + _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, int64(nTerm)-int64(nPrefix)) + _sqlite3Fts5BufferAppendBlob(tls, p+60, pPage+8, uint32(nTerm-nPrefix), pTerm+uintptr(nPrefix)) + /* Update the Fts5PageWriter.term field. */ + _sqlite3Fts5BufferSet(tls, p+60, pPage+40, nTerm, pTerm) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = uint8(0) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = uint8(0) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist = uint8(1) + (*(*TFts5DlidxWriter)(unsafe.Pointer((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx))).Fpgno = (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgno +} + +// C documentation +// +// /* +// ** Append a rowid and position-list size field to the writers output. +// */ +func _fts5WriteAppendRowid(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid Ti64) { + var pPage uintptr + _ = pPage + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pPage = pWriter + 8 + if (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn+(*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn >= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + _fts5WriteFlushLeaf(tls, p, pWriter) + } + /* If this is to be the first rowid written to the page, set the + ** rowid-pointer in the page-header. Also append a value to the dlidx + ** buffer, in case a doclist-index is required. */ + if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0 { + _fts5PutU16(tls, (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fp, uint16((*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn)) + _fts5WriteDlidxAppend(tls, p, pWriter, iRowid) + } + /* Write the rowid. */ + if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist != 0 || (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0 { + _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, iRowid) + } else { + _sqlite3Fts5BufferAppendVarint(tls, p+60, pPage+8, int64(uint64(int64(uint64(iRowid)))-uint64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid))) + } + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid = iRowid + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist = uint8(0) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = uint8(0) + } +} + +func _fts5WriteAppendPoslistData(tls *libc.TLS, p uintptr, pWriter uintptr, aData uintptr, nData int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, pPage uintptr + var n, nCopy, nReq int32 + var _ /* dummy at bp+0 */ Ti64 + _, _, _, _, _ = a, n, nCopy, nReq, pPage + pPage = pWriter + 8 + a = aData + n = nData + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn+(*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn+n >= (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + nReq = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz - (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn - (*TFts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn + nCopy = 0 + for nCopy < nReq { + nCopy += int32(_sqlite3Fts5GetVarint(tls, a+uintptr(nCopy), bp)) + } + _sqlite3Fts5BufferAppendBlob(tls, p+60, pPage+8, uint32(nCopy), a) + a += uintptr(nCopy) + n -= nCopy + _fts5WriteFlushLeaf(tls, p, pWriter) + } + if n > 0 { + _sqlite3Fts5BufferAppendBlob(tls, p+60, pPage+8, uint32(n), a) + } +} + +// C documentation +// +// /* +// ** Flush any data cached by the writer object to the database. Free any +// ** allocations associated with the writer. +// */ +func _fts5WriteFinish(tls *libc.TLS, p uintptr, pWriter uintptr, pnLeaf uintptr) { + var i int32 + var pLeaf uintptr + _, _ = i, pLeaf + pLeaf = pWriter + 8 + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*TFts5PageWriter)(unsafe.Pointer(pLeaf)).Fbuf.Fn > int32(4) { + _fts5WriteFlushLeaf(tls, p, pWriter) + } + *(*int32)(unsafe.Pointer(pnLeaf)) = (*TFts5PageWriter)(unsafe.Pointer(pLeaf)).Fpgno - int32(1) + if (*TFts5PageWriter)(unsafe.Pointer(pLeaf)).Fpgno > int32(1) { + _fts5WriteFlushBtree(tls, p, pWriter) + } + } + _sqlite3Fts5BufferFree(tls, pLeaf+40) + _sqlite3Fts5BufferFree(tls, pLeaf+8) + _sqlite3Fts5BufferFree(tls, pLeaf+24) + _sqlite3Fts5BufferFree(tls, pWriter+96) + i = 0 + for { + if !(i < (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx) { + break + } + _sqlite3Fts5BufferFree(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx+uintptr(i)*32+16) + goto _1 + _1: + ; + i++ + } + Xsqlite3_free(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx) +} + +func _fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var nBuffer int32 + var pConfig uintptr + _, _ = nBuffer, pConfig + nBuffer = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz + int32(FTS5_DATA_PADDING) + libc.Xmemset(tls, pWriter, 0, uint64(120)) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid = iSegid + _fts5WriteDlidxGrow(tls, p, pWriter, int32(1)) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fpgno = int32(1) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = uint8(1) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage = int32(1) + /* Grow the two buffers to pgsz + padding bytes in size. */ + _sqlite3Fts5BufferSize(tls, p+60, pWriter+8+24, uint32(nBuffer)) + _sqlite3Fts5BufferSize(tls, p+60, pWriter+8+8, uint32(nBuffer)) + if (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + _fts5IndexPrepareStmt(tls, p, p+96, Xsqlite3_mprintf(tls, __ccgo_ts+36538, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + /* Initialize the 4-byte leaf-page header to 0x00. */ + libc.Xmemset(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fbuf.Fp, 0, uint64(4)) + (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fbuf.Fn = int32(4) + /* Bind the current output segment id to the index-writer. This is an + ** optimization over binding the same value over and over as rows are + ** inserted into %_idx by the current writer. */ + Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter, int32(1), (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid) + } +} + +// C documentation +// +// /* +// ** Iterator pIter was used to iterate through the input segments of on an +// ** incremental merge operation. This function is called if the incremental +// ** merge step has finished but the input has not been completely exhausted. +// */ +func _fts5TrimSegments(tls *libc.TLS, p uintptr, pIter uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i, iId, iOff, nDiff int32 + var iLeafRowid Ti64 + var pData, pSeg uintptr + var _ /* aHdr at bp+16 */ [4]Tu8 + var _ /* buf at bp+0 */ TFts5Buffer + _, _, _, _, _, _, _ = i, iId, iLeafRowid, iOff, nDiff, pData, pSeg + libc.Xmemset(tls, bp, 0, uint64(16)) + i = 0 + for { + if !(i < (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg && (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + break + } + pSeg = pIter + 104 + uintptr(i)*128 + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg == uintptr(0) { + /* no-op */ + } else { + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf == uintptr(0) { + /* All keys from this input segment have been transfered to the output. + ** Set both the first and last page-numbers to 0 to indicate that the + ** segment is now empty. */ + (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FpgnoLast = 0 + (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FpgnoFirst = 0 + } else { + iOff = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafOffset + iId = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FiSegid + *(*[4]Tu8)(unsafe.Pointer(bp + 16)) = [4]Tu8{} + iLeafRowid = int64(iId)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B)) + int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)) + int64(libc.Int32FromInt32(0))< (*TFts5Data)(unsafe.Pointer(pData)).FszLeaf { + /* This can occur if the pages that the segments occupy overlap - if + ** a single page has been assigned to more than one segment. In + ** this case a prior iteration of this loop may have corrupted the + ** segment currently being trimmed. */ + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< uint64(0) { + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin1 = (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg))).FiOrigin1 + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2 = (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-int32(1))*56))).FiOrigin2 + } + } + bOldest = libc.BoolInt32((*TFts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg == int32(1) && (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel == iLvl+int32(2)) + _fts5MultiIterNew(tls, p, pStruct, flags, uintptr(0), uintptr(0), 0, iLvl, nInput, bp) + for { + if !(_fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) == 0) { + break + } + pSegIter = *(*uintptr)(unsafe.Pointer(bp)) + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFirst + 1*4))).FiFirst)*128 + pTerm = _fts5MultiIterTerm(tls, *(*uintptr)(unsafe.Pointer(bp)), bp+144) + if v4 = *(*int32)(unsafe.Pointer(bp + 144)) != (*(*TFts5Buffer)(unsafe.Pointer(bp + 128))).Fn; !v4 { + if *(*int32)(unsafe.Pointer(bp + 144)) <= 0 { + v3 = 0 + } else { + v3 = libc.Xmemcmp(tls, pTerm, (*(*TFts5Buffer)(unsafe.Pointer(bp + 128))).Fp, uint64(*(*int32)(unsafe.Pointer(bp + 144)))) + } + } + if v4 || v3 != 0 { + if pnRem != 0 && (*(*TFts5SegWriter)(unsafe.Pointer(bp + 8))).FnLeafWritten > nRem { + break + } + _sqlite3Fts5BufferSet(tls, p+60, bp+128, *(*int32)(unsafe.Pointer(bp + 144)), pTerm) + bTermWritten = 0 + } + /* Check for key annihilation. */ + if (*TFts5SegIter)(unsafe.Pointer(pSegIter)).FnPos == 0 && (bOldest != 0 || int32((*TFts5SegIter)(unsafe.Pointer(pSegIter)).FbDel) == 0) { + goto _2 + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && bTermWritten == 0 { + /* This is a new term. Append a term to the output segment. */ + _fts5WriteAppendTerm(tls, p, bp+8, *(*int32)(unsafe.Pointer(bp + 144)), pTerm) + bTermWritten = int32(1) + } + /* Append the rowid to the output */ + /* WRITEPOSLISTSIZE */ + _fts5WriteAppendRowid(tls, p, bp+8, _fts5MultiIterRowid(tls, *(*uintptr)(unsafe.Pointer(bp)))) + if eDetail == int32(FTS5_DETAIL_NONE) { + if (*TFts5SegIter)(unsafe.Pointer(pSegIter)).FbDel != 0 { + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp+8+8+8, libc.Int64FromInt32(0)) + if (*TFts5SegIter)(unsafe.Pointer(pSegIter)).FnPos > 0 { + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp+8+8+8, libc.Int64FromInt32(0)) + } + } + } else { + /* Append the position-list data to the output */ + nPos = (*TFts5SegIter)(unsafe.Pointer(pSegIter)).FnPos*int32(2) + int32((*TFts5SegIter)(unsafe.Pointer(pSegIter)).FbDel) + _sqlite3Fts5BufferAppendVarint(tls, p+60, bp+8+8+8, int64(nPos)) + _fts5ChunkIterate(tls, p, pSegIter, bp+8, __ccgo_fp(_fts5MergeChunkCallback)) + } + goto _2 + _2: + ; + _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp)), 0, 0) + } + /* Flush the last leaf page to disk. Set the output segment b-tree height + ** and last leaf page number at the same time. */ + _fts5WriteFinish(tls, p, bp+8, pSeg+8) + if _fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) != 0 { + /* Remove the redundant segments from the %_data table */ + i = 0 + for { + if !(i < nInput) { + break + } + pOld = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(i)*56 + *(*Tu64)(unsafe.Pointer(pSeg + 48)) += (*TFts5StructureSegment)(unsafe.Pointer(pOld)).FnEntry - (*TFts5StructureSegment)(unsafe.Pointer(pOld)).FnEntryTombstone + _fts5DataRemoveSegment(tls, p, pOld) + goto _5 + _5: + ; + i++ + } + /* Remove the redundant segments from the input level */ + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg != nInput { + nMove = int32(uint64((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-nInput) * uint64(56)) + libc.Xmemmove(tls, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg, (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(nInput)*56, uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pStruct + 24)) -= nInput + *(*int32)(unsafe.Pointer(pLvl + 4)) -= nInput + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge = 0 + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast == 0 { + (*TFts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg-- + (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment-- + } + } else { + _fts5TrimSegments(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge = nInput + } + _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + _sqlite3Fts5BufferFree(tls, bp+128) + if pnRem != 0 { + *(*int32)(unsafe.Pointer(pnRem)) -= (*(*TFts5SegWriter)(unsafe.Pointer(bp + 8))).FnLeafWritten + } +} + +// C documentation +// +// /* +// ** If this is not a contentless_delete=1 table, or if the 'deletemerge' +// ** configuration option is set to 0, then this function always returns -1. +// ** Otherwise, it searches the structure object passed as the second argument +// ** for a level suitable for merging due to having a large number of +// ** tombstones in the tombstone hash. If one is found, its index is returned. +// ** Otherwise, if there is no suitable level, -1. +// */ +func _fts5IndexFindDeleteMerge(tls *libc.TLS, p uintptr, pStruct uintptr) (r int32) { + var iRet, iSeg, ii, nBest, nPercent int32 + var nEntry, nTomb Ti64 + var pConfig, pLvl uintptr + _, _, _, _, _, _, _, _, _ = iRet, iSeg, ii, nBest, nEntry, nPercent, nTomb, pConfig, pLvl + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + iRet = -int32(1) + if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 && (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge > 0 { + nBest = 0 + ii = 0 + for { + if !(ii < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + pLvl = pStruct + 32 + uintptr(ii)*16 + nEntry = 0 + nTomb = 0 + iSeg = 0 + for { + if !(iSeg < (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg) { + break + } + nEntry = Ti64(uint64(nEntry) + (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*56))).FnEntry) + nTomb = Ti64(uint64(nTomb) + (*(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*56))).FnEntryTombstone) + goto _2 + _2: + ; + iSeg++ + } + if nEntry > 0 { + nPercent = int32(nTomb * int64(100) / nEntry) + if nPercent >= (*TFts5Config)(unsafe.Pointer(pConfig)).FnDeleteMerge && nPercent > nBest { + iRet = ii + nBest = nPercent + } + } + goto _1 + _1: + ; + ii++ + } + } + return iRet +} + +// C documentation +// +// /* +// ** Do up to nPg pages of automerge work on the index. +// ** +// ** Return true if any changes were actually made, or false otherwise. +// */ +func _fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bRet, iBestLvl, iLvl, nBest int32 + var pLvl uintptr + var _ /* nRem at bp+0 */ int32 + var _ /* pStruct at bp+8 */ uintptr + _, _, _, _, _ = bRet, iBestLvl, iLvl, nBest, pLvl + *(*int32)(unsafe.Pointer(bp)) = nPg + bRet = 0 + *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(ppStruct)) + for *(*int32)(unsafe.Pointer(bp)) > 0 && (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* To iterate through levels */ + iBestLvl = 0 /* Level offering the most input segments */ + nBest = 0 /* Number of input segments on best level */ + /* Set iBestLvl to the level to read input segments from. Or to -1 if + ** there is no level suitable to merge segments from. */ + iLvl = 0 + for { + if !(iLvl < (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FnLevel) { + break + } + pLvl = *(*uintptr)(unsafe.Pointer(bp + 8)) + 32 + uintptr(iLvl)*16 + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge > nBest { + iBestLvl = iLvl + nBest = nMin + } + break + } + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg > nBest { + nBest = (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg + iBestLvl = iLvl + } + goto _1 + _1: + ; + iLvl++ + } + if nBest < nMin { + iBestLvl = _fts5IndexFindDeleteMerge(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + if iBestLvl < 0 { + break + } + bRet = int32(1) + _fts5IndexMergeLevel(tls, p, bp+8, iBestLvl, bp) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + 32 + uintptr(iBestLvl)*16))).FnMerge == 0 { + _fts5StructurePromote(tls, p, iBestLvl+int32(1), *(*uintptr)(unsafe.Pointer(bp + 8))) + } + if nMin == int32(1) { + nMin = int32(2) + } + } + *(*uintptr)(unsafe.Pointer(ppStruct)) = *(*uintptr)(unsafe.Pointer(bp + 8)) + return bRet +} + +// C documentation +// +// /* +// ** A total of nLeaf leaf pages of data has just been flushed to a level-0 +// ** segment. This function updates the write-counter accordingly and, if +// ** necessary, performs incremental merge work. +// ** +// ** If an error occurs, set the Fts5Index.rc error code. If an error has +// ** already occurred, this function is a no-op. +// */ +func _fts5IndexAutomerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nLeaf int32) { + var nRem, nWork int32 + var nWrite Tu64 + var pStruct uintptr + _, _, _, _ = nRem, nWork, nWrite, pStruct + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FnAutomerge > 0 && *(*uintptr)(unsafe.Pointer(ppStruct)) != uintptr(0) { + pStruct = *(*uintptr)(unsafe.Pointer(ppStruct)) /* Number of leaf pages left to write */ + /* Update the write-counter. While doing so, set nWork. */ + nWrite = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter + nWork = int32((nWrite+uint64(nLeaf))/uint64((*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit) - nWrite/uint64((*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit)) + *(*Tu64)(unsafe.Pointer(pStruct + 8)) += uint64(nLeaf) + nRem = (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit * nWork * (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel + _fts5IndexMerge(tls, p, ppStruct, nRem, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FnAutomerge) + } +} + +func _fts5IndexCrisismerge(tls *libc.TLS, p uintptr, ppStruct uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iLvl, nCrisis int32 + var _ /* pStruct at bp+0 */ uintptr + _, _ = iLvl, nCrisis + nCrisis = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FnCrisisMerge + *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(ppStruct)) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 && (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnLevel > 0 { + iLvl = 0 + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg >= nCrisis { + _fts5IndexMergeLevel(tls, p, bp, iLvl, uintptr(0)) + _fts5StructurePromote(tls, p, iLvl+int32(1), *(*uintptr)(unsafe.Pointer(bp))) + iLvl++ + } + *(*uintptr)(unsafe.Pointer(ppStruct)) = *(*uintptr)(unsafe.Pointer(bp)) + } +} + +func _fts5IndexReturn(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = (*TFts5Index)(unsafe.Pointer(p)).Frc + (*TFts5Index)(unsafe.Pointer(p)).Frc = SQLITE_OK + return rc +} + +type TFts5FlushCtx = struct { + FpIdx uintptr + Fwriter TFts5SegWriter +} + +type Fts5FlushCtx = TFts5FlushCtx + +type TFts5FlushCtx1 = struct { + FpIdx uintptr + Fwriter TFts5SegWriter +} + +type Fts5FlushCtx1 = TFts5FlushCtx1 + +// C documentation +// +// /* +// ** Buffer aBuf[] contains a list of varints, all small enough to fit +// ** in a 32-bit integer. Return the size of the largest prefix of this +// ** list nMax bytes or less in size. +// */ +func _fts5PoslistPrefix(tls *libc.TLS, aBuf uintptr, nMax int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i, ret int32 + var _ /* dummy at bp+0 */ Tu32 + _, _ = i, ret + ret = _sqlite3Fts5GetVarint32(tls, aBuf, bp) + if ret < nMax { + for int32(1) != 0 { + i = _sqlite3Fts5GetVarint32(tls, aBuf+uintptr(ret), bp) + if ret+i > nMax { + break + } + ret += i + } + } + return ret +} + +// C documentation +// +// /* +// ** Execute the SQL statement: +// ** +// ** DELETE FROM %_idx WHERE (segid, (pgno/2)) = ($iSegid, $iPgno); +// ** +// ** This is used when a secure-delete operation removes the last term +// ** from a segment leaf page. In that case the %_idx entry is removed +// ** too. This is done to ensure that if all instances of a token are +// ** removed from an fts5 database in secure-delete mode, no trace of +// ** the token itself remains in the database. +// */ +func _fts5SecureDeleteIdxEntry(tls *libc.TLS, p uintptr, iSegid int32, iPgno int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + if iPgno != int32(1) { + if (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx == uintptr(0) { + _fts5IndexPrepareStmt(tls, p, p+136, Xsqlite3_mprintf(tls, __ccgo_ts+36595, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FzName))) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(1), iSegid) + Xsqlite3_bind_int(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx, int32(2), iPgno) + Xsqlite3_step(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx) + (*TFts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx) + } + } +} + +// C documentation +// +// /* +// ** This is called when a secure-delete operation removes a position-list +// ** that overflows onto segment page iPgno of segment pSeg. This function +// ** rewrites node iPgno, and possibly one or more of its right-hand peers, +// ** to remove this portion of the position list. +// ** +// ** Output variable (*pbLastInDoclist) is set to true if the position-list +// ** removed is followed by a new term or the end-of-segment, or false if +// ** it is followed by another rowid/position list. +// */ +func _fts5SecureDeleteOverflow(tls *libc.TLS, p uintptr, pSeg uintptr, iPgno int32, pbLastInDoclist uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aIdx, aPg, pLeaf uintptr + var bDetailNone, i1, i2, nIdx, nPg, nShift, pgno int32 + var iRowid Ti64 + var _ /* aEmpty at bp+4 */ [4]Tu8 + var _ /* iFirst at bp+8 */ int32 + var _ /* iNext at bp+0 */ int32 + _, _, _, _, _, _, _, _, _, _, _ = aIdx, aPg, bDetailNone, i1, i2, iRowid, nIdx, nPg, nShift, pLeaf, pgno + bDetailNone = libc.BoolInt32((*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == libc.Int32FromInt32(FTS5_DETAIL_NONE)) + pLeaf = uintptr(0) + *(*int32)(unsafe.Pointer(pbLastInDoclist)) = int32(1) + pgno = iPgno + for { + if !((*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && pgno <= (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast) { + break + } + iRowid = int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B)) + int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)) + int64(libc.Int32FromInt32(0))<= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf || (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn < (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf || *(*int32)(unsafe.Pointer(bp)) < int32(4) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + i1 = (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + i2 = 0 + i1 += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(i1), bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) < *(*int32)(unsafe.Pointer(bp)) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + libc.Xmemcpy(tls, aPg+uintptr(nPg), aIdx, uint64(nIdx)) + nPg += nIdx + } + Xsqlite3_free(tls, aIdx) + /* Write the new page to disk and exit the loop */ + _fts5DataWrite(tls, p, iRowid, aPg, nPg) + break + } + } + } + goto _1 + _1: + ; + pgno++ + } + _fts5DataRelease(tls, pLeaf) +} + +// C documentation +// +// /* +// ** Completely remove the entry that pSeg currently points to from +// ** the database. +// */ +func _fts5DoSecureDelete(tls *libc.TLS, p uintptr, pSeg uintptr) { + bp := tls.Alloc(64) + defer tls.Free(64) + var aIdx, aPg, aTermIdx, pPg, pTerm uintptr + var bDetailNone, bEmpty, iDelKeyOff, iIdx, iKey, iKeyIn, iKeyOff, iKeyOff1, iKeyOut, iNextOff, iOff, iPgIdx, iPgno, iPrevKeyOut, iSOP, iSegid, iStart, iTermIdx, iTermOff, nByte, nIdx, nMove, nPg, nShift, nTermIdx, pgno, v2, v4, v5, v8 int32 + var iId Ti64 + var _ /* bLastInDoclist at bp+8 */ int32 + var _ /* iDelta at bp+0 */ Tu64 + var _ /* iNextDelta at bp+24 */ Tu64 + var _ /* iVal at bp+16 */ Tu32 + var _ /* iVal at bp+32 */ Tu32 + var _ /* iVal at bp+52 */ Tu32 + var _ /* iVal at bp+56 */ Tu32 + var _ /* nPos at bp+12 */ int32 + var _ /* nPrefix at bp+36 */ int32 + var _ /* nPrefix2 at bp+44 */ int32 + var _ /* nSuffix at bp+40 */ int32 + var _ /* nSuffix2 at bp+48 */ int32 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aIdx, aPg, aTermIdx, bDetailNone, bEmpty, iDelKeyOff, iId, iIdx, iKey, iKeyIn, iKeyOff, iKeyOff1, iKeyOut, iNextOff, iOff, iPgIdx, iPgno, iPrevKeyOut, iSOP, iSegid, iStart, iTermIdx, iTermOff, nByte, nIdx, nMove, nPg, nShift, nTermIdx, pPg, pTerm, pgno, v2, v4, v5, v8 + bDetailNone = libc.BoolInt32((*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == libc.Int32FromInt32(FTS5_DETAIL_NONE)) + iSegid = (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FiSegid + aPg = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + nPg = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fnn + iPgIdx = (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf + *(*Tu64)(unsafe.Pointer(bp)) = uint64(0) + iNextOff = 0 + iOff = 0 + nIdx = 0 + aIdx = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8)) = 0 + iIdx = 0 + iStart = 0 + iDelKeyOff = 0 /* Offset of deleted key, if any */ + nIdx = nPg - iPgIdx + aIdx = _sqlite3Fts5MallocZero(tls, p+60, int64(nIdx+int32(16))) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + libc.Xmemcpy(tls, aIdx, aPg+uintptr(iPgIdx), uint64(nIdx)) + /* At this point segment iterator pSeg points to the entry + ** this function should remove from the b-tree segment. + ** + ** In detail=full or detail=column mode, pSeg->iLeafOffset is the + ** offset of the first byte in the position-list for the entry to + ** remove. Immediately before this comes two varints that will also + ** need to be removed: + ** + ** + the rowid or delta rowid value for the entry, and + ** + the size of the position list in bytes. + ** + ** Or, in detail=none mode, there is a single varint prior to + ** pSeg->iLeafOffset - the rowid or delta rowid value. + ** + ** This block sets the following variables: + ** + ** iStart: + ** The offset of the first byte of the rowid or delta-rowid + ** value for the doclist entry being removed. + ** + ** iDelta: + ** The value of the rowid or delta-rowid value for the doclist + ** entry being removed. + ** + ** iNextOff: + ** The offset of the next entry following the position list + ** for the one being removed. If the position list for this + ** entry overflows onto the next leaf page, this value will be + ** greater than pLeaf->szLeaf. + */ + /* Start-Of-Position-list */ + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno { + iStart = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafOffset + } else { + iStart = int32(_fts5GetU16(tls, aPg)) + } + iSOP = iStart + int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iStart), bp)) + if bDetailNone != 0 { + for int64(iSOP) < (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset { + if int32(*(*Tu8)(unsafe.Pointer(aPg + uintptr(iSOP)))) == 0x00 { + iSOP++ + } + if int32(*(*Tu8)(unsafe.Pointer(aPg + uintptr(iSOP)))) == 0x00 { + iSOP++ + } + iStart = iSOP + iSOP = iStart + int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iStart), bp)) + } + iNextOff = iSOP + if iNextOff < (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiEndofDoclist && int32(*(*Tu8)(unsafe.Pointer(aPg + uintptr(iNextOff)))) == 0x00 { + iNextOff++ + } + if iNextOff < (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiEndofDoclist && int32(*(*Tu8)(unsafe.Pointer(aPg + uintptr(iNextOff)))) == 0x00 { + iNextOff++ + } + } else { + *(*int32)(unsafe.Pointer(bp + 12)) = 0 + iSOP += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iSOP), bp+12) + for int64(iSOP) < (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset { + iStart = iSOP + *(*int32)(unsafe.Pointer(bp + 12))/int32(2) + iSOP = iStart + int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iStart), bp)) + iSOP += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iSOP), bp+12) + } + iNextOff = int32((*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + int64((*TFts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) + } + iOff = iStart + /* If the position-list for the entry being removed flows over past + ** the end of this page, delete the portion of the position-list on the + ** next page and beyond. + ** + ** Set variable bLastInDoclist to true if this entry happens + ** to be the last rowid in the doclist for its term. */ + if iNextOff >= iPgIdx { + pgno = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno + int32(1) + _fts5SecureDeleteOverflow(tls, p, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpSeg, pgno, bp+8) + iNextOff = iPgIdx + } + if int32((*TFts5SegIter)(unsafe.Pointer(pSeg)).FbDel) == 0 { + if iNextOff != iPgIdx { + /* Loop through the page-footer. If iNextOff (offset of the + ** entry following the one we are removing) is equal to the + ** offset of a key on this page, then the entry is the last + ** in its doclist. */ + iKeyOff = 0 + iIdx = 0 + for { + if !(iIdx < nIdx) { + break + } + *(*Tu32)(unsafe.Pointer(bp + 16)) = uint32(0) + iIdx += _sqlite3Fts5GetVarint32(tls, aIdx+uintptr(iIdx), bp+16) + iKeyOff = int32(uint32(iKeyOff) + *(*Tu32)(unsafe.Pointer(bp + 16))) + if iKeyOff == iNextOff { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(1) + } + goto _1 + _1: + } + } + /* If this is (a) the first rowid on a page and (b) is not followed by + ** another position list on the same page, set the "first-rowid" field + ** of the header to 0. */ + if int32(_fts5GetU16(tls, aPg)) == iStart && (*(*int32)(unsafe.Pointer(bp + 8)) != 0 || iNextOff == iPgIdx) { + _fts5PutU16(tls, aPg, uint16(0)) + } + } + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FbDel != 0 { + iOff += _sqlite3Fts5PutVarint(tls, aPg+uintptr(iOff), *(*Tu64)(unsafe.Pointer(bp))) + v2 = iOff + iOff++ + *(*Tu8)(unsafe.Pointer(aPg + uintptr(v2))) = uint8(0x01) + } else { + if *(*int32)(unsafe.Pointer(bp + 8)) == 0 { + if iNextOff != iPgIdx { + *(*Tu64)(unsafe.Pointer(bp + 24)) = uint64(0) + iNextOff += int32(_sqlite3Fts5GetVarint(tls, aPg+uintptr(iNextOff), bp+24)) + iOff += _sqlite3Fts5PutVarint(tls, aPg+uintptr(iOff), *(*Tu64)(unsafe.Pointer(bp))+*(*Tu64)(unsafe.Pointer(bp + 24))) + } + } else { + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno && iStart == (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafOffset { + /* The entry being removed was the only position list in its + ** doclist. Therefore the term needs to be removed as well. */ + iKey = 0 + iKeyOff1 = 0 + /* Set iKeyOff to the offset of the term that will be removed - the + ** last offset in the footer that is not greater than iStart. */ + iIdx = 0 + for { + if !(iIdx < nIdx) { + break + } + *(*Tu32)(unsafe.Pointer(bp + 32)) = uint32(0) + iIdx += _sqlite3Fts5GetVarint32(tls, aIdx+uintptr(iIdx), bp+32) + if uint32(iKeyOff1)+*(*Tu32)(unsafe.Pointer(bp + 32)) > uint32(iStart) { + break + } + iKeyOff1 = int32(uint32(iKeyOff1) + *(*Tu32)(unsafe.Pointer(bp + 32))) + goto _3 + _3: + ; + iKey++ + } + /* Set iDelKeyOff to the value of the footer entry to remove from + ** the page. */ + v4 = iKeyOff1 + iOff = v4 + iDelKeyOff = v4 + if iNextOff != iPgIdx { + /* This is the only position-list associated with the term, and there + ** is another term following it on this page. So the subsequent term + ** needs to be moved to replace the term associated with the entry + ** being removed. */ + *(*int32)(unsafe.Pointer(bp + 36)) = 0 + *(*int32)(unsafe.Pointer(bp + 40)) = 0 + *(*int32)(unsafe.Pointer(bp + 44)) = 0 + *(*int32)(unsafe.Pointer(bp + 48)) = 0 + iDelKeyOff = iNextOff + iNextOff += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iNextOff), bp+44) + iNextOff += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iNextOff), bp+48) + if iKey != int32(1) { + iKeyOff1 += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iKeyOff1), bp+36) + } + iKeyOff1 += _sqlite3Fts5GetVarint32(tls, aPg+uintptr(iKeyOff1), bp+40) + if *(*int32)(unsafe.Pointer(bp + 36)) < *(*int32)(unsafe.Pointer(bp + 44)) { + v5 = *(*int32)(unsafe.Pointer(bp + 36)) + } else { + v5 = *(*int32)(unsafe.Pointer(bp + 44)) + } + *(*int32)(unsafe.Pointer(bp + 36)) = v5 + *(*int32)(unsafe.Pointer(bp + 40)) = *(*int32)(unsafe.Pointer(bp + 44)) + *(*int32)(unsafe.Pointer(bp + 48)) - *(*int32)(unsafe.Pointer(bp + 36)) + if iKeyOff1+*(*int32)(unsafe.Pointer(bp + 40)) > iPgIdx || iNextOff+*(*int32)(unsafe.Pointer(bp + 48)) > iPgIdx { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*TFts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fn { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp + 36)) { + libc.Xmemcpy(tls, aPg+uintptr(iOff), (*TFts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fp+uintptr(*(*int32)(unsafe.Pointer(bp + 36))), uint64(*(*int32)(unsafe.Pointer(bp + 44))-*(*int32)(unsafe.Pointer(bp + 36)))) + iOff += *(*int32)(unsafe.Pointer(bp + 44)) - *(*int32)(unsafe.Pointer(bp + 36)) + } + } + libc.Xmemmove(tls, aPg+uintptr(iOff), aPg+uintptr(iNextOff), uint64(*(*int32)(unsafe.Pointer(bp + 48)))) + iOff += *(*int32)(unsafe.Pointer(bp + 48)) + iNextOff += *(*int32)(unsafe.Pointer(bp + 48)) + } + } + } else { + if iStart == int32(4) { + /* The entry being removed may be the only position list in + ** its doclist. */ + iPgno = (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno - int32(1) + for { + if !(iPgno > (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno) { + break + } + pPg = _fts5DataRead(tls, p, int64(iSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(libc.Int32FromInt32(0))<= nTermIdx { + break + } + iTermIdx += nByte + } + nTermIdx = iTermIdx + libc.Xmemmove(tls, (*TFts5Data)(unsafe.Pointer(pTerm)).Fp+uintptr(iTermOff), (*TFts5Data)(unsafe.Pointer(pTerm)).Fp+uintptr((*TFts5Data)(unsafe.Pointer(pTerm)).FszLeaf), uint64(nTermIdx)) + _fts5PutU16(tls, (*TFts5Data)(unsafe.Pointer(pTerm)).Fp+2, uint16(iTermOff)) + _fts5DataWrite(tls, p, iId, (*TFts5Data)(unsafe.Pointer(pTerm)).Fp, iTermOff+nTermIdx) + if nTermIdx == 0 { + _fts5SecureDeleteIdxEntry(tls, p, iSegid, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno) + } + } + _fts5DataRelease(tls, pTerm) + } + } + } + } + } + /* Assuming no error has occurred, this block does final edits to the + ** leaf page before writing it back to disk. Input variables are: + ** + ** nPg: Total initial size of leaf page. + ** iPgIdx: Initial offset of page footer. + ** + ** iOff: Offset to move data to + ** iNextOff: Offset to move data from + */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + nMove = nPg - iNextOff /* Number of bytes to move */ + nShift = iNextOff - iOff /* Distance to move them */ + iPrevKeyOut = 0 + iKeyIn = 0 + libc.Xmemmove(tls, aPg+uintptr(iOff), aPg+uintptr(iNextOff), uint64(nMove)) + iPgIdx -= nShift + nPg = iPgIdx + _fts5PutU16(tls, aPg+2, uint16(iPgIdx)) + iIdx = 0 + for { + if !(iIdx < nIdx) { + break + } + *(*Tu32)(unsafe.Pointer(bp + 56)) = uint32(0) + iIdx += _sqlite3Fts5GetVarint32(tls, aIdx+uintptr(iIdx), bp+56) + iKeyIn = int32(uint32(iKeyIn) + *(*Tu32)(unsafe.Pointer(bp + 56))) + if iKeyIn != iDelKeyOff { + if iKeyIn > iOff { + v8 = nShift + } else { + v8 = 0 + } + iKeyOut = iKeyIn - v8 + nPg += _sqlite3Fts5PutVarint(tls, aPg+uintptr(nPg), uint64(iKeyOut-iPrevKeyOut)) + iPrevKeyOut = iKeyOut + } + goto _7 + _7: + } + if iPgIdx == nPg && nIdx > 0 && (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno != int32(1) { + _fts5SecureDeleteIdxEntry(tls, p, iSegid, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno) + } + _fts5DataWrite(tls, p, int64(iSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B))+int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B))+int64(libc.Int32FromInt32(0))<= (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn+*(*int32)(unsafe.Pointer(bp + 160))+int32(1) { + /* The entire doclist will fit on the current leaf. */ + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), *(*uintptr)(unsafe.Pointer(bp + 152)), uint64(*(*int32)(unsafe.Pointer(bp + 160)))) + *(*int32)(unsafe.Pointer(pBuf + 8)) += *(*int32)(unsafe.Pointer(bp + 160)) + } else { + bTermWritten = libc.BoolInt32(!(bSecureDelete != 0)) + iRowid = 0 + iPrev = 0 + iOff = 0 + /* The entire doclist will not fit on this leaf. The following + ** loop iterates through the poslists that make up the current + ** doclist. */ + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && iOff < *(*int32)(unsafe.Pointer(bp + 160)) { + *(*Tu64)(unsafe.Pointer(bp + 168)) = uint64(0) + iOff += int32(_sqlite3Fts5GetVarint(tls, *(*uintptr)(unsafe.Pointer(bp + 152))+uintptr(iOff), bp+168)) + iRowid = Ti64(uint64(iRowid) + *(*Tu64)(unsafe.Pointer(bp + 168))) + /* If in secure delete mode, and if this entry in the poslist is + ** in fact a delete, then edit the existing segments directly + ** using fts5FlushSecureDelete(). */ + if bSecureDelete != 0 { + if eDetail == int32(FTS5_DETAIL_NONE) { + if iOff < *(*int32)(unsafe.Pointer(bp + 160)) && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == 0x00 { + _fts5FlushSecureDelete(tls, p, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 136)), *(*int32)(unsafe.Pointer(bp + 144)), iRowid) + iOff++ + if iOff < *(*int32)(unsafe.Pointer(bp + 160)) && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == 0x00 { + iOff++ + *(*int32)(unsafe.Pointer(bp + 160)) = 0 + } else { + continue + } + } + } else { + if int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff))))&int32(0x01) != 0 { + _fts5FlushSecureDelete(tls, p, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 136)), *(*int32)(unsafe.Pointer(bp + 144)), iRowid) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK || int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == int32(0x01) { + iOff++ + continue + } + } + } + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && bTermWritten == 0 { + _fts5WriteAppendTerm(tls, p, bp+16, *(*int32)(unsafe.Pointer(bp + 144)), *(*uintptr)(unsafe.Pointer(bp + 136))) + bTermWritten = int32(1) + } + if (*(*TFts5SegWriter)(unsafe.Pointer(bp + 16))).FbFirstRowidInPage != 0 { + _fts5PutU16(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp, uint16((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) /* first rowid on page */ + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(iRowid)) + (*(*TFts5SegWriter)(unsafe.Pointer(bp + 16))).FbFirstRowidInPage = uint8(0) + _fts5WriteDlidxAppend(tls, p, bp+16, iRowid) + } else { + iRowidDelta = uint64(iRowid) - uint64(iPrev) + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), iRowidDelta) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + break + } + iPrev = iRowid + if eDetail == int32(FTS5_DETAIL_NONE) { + if iOff < *(*int32)(unsafe.Pointer(bp + 160)) && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == 0 { + v2 = pBuf + 8 + v1 = *(*int32)(unsafe.Pointer(v2)) + *(*int32)(unsafe.Pointer(v2))++ + *(*Tu8)(unsafe.Pointer((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(v1))) = uint8(0) + iOff++ + if iOff < *(*int32)(unsafe.Pointer(bp + 160)) && int32(*(*Tu8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff)))) == 0 { + v4 = pBuf + 8 + v3 = *(*int32)(unsafe.Pointer(v4)) + *(*int32)(unsafe.Pointer(v4))++ + *(*Tu8)(unsafe.Pointer((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(v3))) = uint8(0) + iOff++ + } + } + if (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn >= pgsz { + _fts5WriteFlushLeaf(tls, p, bp+16) + } + } else { + *(*int32)(unsafe.Pointer(bp + 176)) = 0 + *(*int32)(unsafe.Pointer(bp + 180)) = 0 + nCopy = _fts5GetPoslistSize(tls, *(*uintptr)(unsafe.Pointer(bp + 152))+uintptr(iOff), bp+180, bp+176) + if *(*int32)(unsafe.Pointer(bp + 176)) != 0 && bSecureDelete != 0 { + _sqlite3Fts5BufferAppendVarint(tls, p+60, pBuf, int64(*(*int32)(unsafe.Pointer(bp + 180)))*int64(2)) + iOff += nCopy + nCopy = *(*int32)(unsafe.Pointer(bp + 180)) + } else { + nCopy += *(*int32)(unsafe.Pointer(bp + 180)) + } + if (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn+nCopy <= pgsz { + /* The entire poslist will fit on the current leaf. So copy + ** it in one go. */ + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), *(*uintptr)(unsafe.Pointer(bp + 152))+uintptr(iOff), uint64(nCopy)) + *(*int32)(unsafe.Pointer(pBuf + 8)) += nCopy + } else { + /* The entire poslist will not fit on this leaf. So it needs + ** to be broken into sections. The only qualification being + ** that each varint must be stored contiguously. */ + pPoslist = *(*uintptr)(unsafe.Pointer(bp + 152)) + uintptr(iOff) + iPos = 0 + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + nSpace = pgsz - (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn - (*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn + n = 0 + if nCopy-iPos <= nSpace { + n = nCopy - iPos + } else { + n = _fts5PoslistPrefix(tls, pPoslist+uintptr(iPos), nSpace) + } + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), pPoslist+uintptr(iPos), uint64(n)) + *(*int32)(unsafe.Pointer(pBuf + 8)) += n + iPos += n + if (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn+(*TFts5Buffer)(unsafe.Pointer(pPgidx)).Fn >= pgsz { + _fts5WriteFlushLeaf(tls, p, bp+16) + } + if iPos >= nCopy { + break + } + } + } + iOff += nCopy + } + } + } + /* TODO2: Doclist terminator written here. */ + /* pBuf->p[pBuf->n++] = '\0'; */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _sqlite3Fts5HashScanNext(tls, pHash) + } + } + _fts5WriteFinish(tls, p, bp+16, bp+8) + if *(*int32)(unsafe.Pointer(bp + 8)) > 0 { + /* Update the Fts5Structure. It is written back to the database by the + ** fts5StructureRelease() call below. */ + if (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnLevel == 0 { + _fts5StructureAddLevel(tls, p+60, bp) + } + _fts5StructureExtendLevel(tls, p+60, *(*uintptr)(unsafe.Pointer(bp)), 0, int32(1), 0) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + v6 = *(*uintptr)(unsafe.Pointer(bp)) + 32 + 4 + v5 = *(*int32)(unsafe.Pointer(v6)) + *(*int32)(unsafe.Pointer(v6))++ + pSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32))).FaSeg + uintptr(v5)*56 + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid = iSegid + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst = int32(1) + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast = *(*int32)(unsafe.Pointer(bp + 8)) + if (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnOriginCntr > uint64(0) { + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin1 = (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnOriginCntr + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2 = (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnOriginCntr + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnEntry = uint64((*TFts5Index)(unsafe.Pointer(p)).FnPendingRow) + (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnOriginCntr++ + } + (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnSegment++ + } + _fts5StructurePromote(tls, p, 0, *(*uintptr)(unsafe.Pointer(bp))) + } + } + } + _fts5IndexAutomerge(tls, p, bp, *(*int32)(unsafe.Pointer(bp + 8))+(*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete) + _fts5IndexCrisismerge(tls, p, bp) + _fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + _fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp))) +} + +// C documentation +// +// /* +// ** Flush any data stored in the in-memory hash tables to the database. +// */ +func _fts5IndexFlush(tls *libc.TLS, p uintptr) { + /* Unless it is empty, flush the hash table to disk */ + if (*TFts5Index)(unsafe.Pointer(p)).FflushRc != 0 { + (*TFts5Index)(unsafe.Pointer(p)).Frc = (*TFts5Index)(unsafe.Pointer(p)).FflushRc + return + } + if (*TFts5Index)(unsafe.Pointer(p)).FnPendingData != 0 || (*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete != 0 { + _fts5FlushOneHash(tls, p) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + _sqlite3Fts5HashClear(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) + (*TFts5Index)(unsafe.Pointer(p)).FnPendingData = 0 + (*TFts5Index)(unsafe.Pointer(p)).FnPendingRow = 0 + (*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete = 0 + } else { + if (*TFts5Index)(unsafe.Pointer(p)).FnPendingData != 0 || (*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete != 0 { + (*TFts5Index)(unsafe.Pointer(p)).FflushRc = (*TFts5Index)(unsafe.Pointer(p)).Frc + } + } + } +} + +func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uintptr) { + var i, iLvl, iSeg, iSegOut, nMerge, nSeg, nThis, v2, v5 int32 + var nByte Tsqlite3_int64 + var pLvl, pNew uintptr + _, _, _, _, _, _, _, _, _, _, _, _ = i, iLvl, iSeg, iSegOut, nByte, nMerge, nSeg, nThis, pLvl, pNew, v2, v5 + pNew = uintptr(0) + nByte = int64(48) + nSeg = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment + /* Figure out if this structure requires optimization. A structure does + ** not require optimization if either: + ** + ** 1. it consists of fewer than two segments, or + ** 2. all segments are on the same level, or + ** 3. all segments except one are currently inputs to a merge operation. + ** + ** In the first case, if there are no tombstone hash pages, return NULL. In + ** the second, increment the ref-count on *pStruct and return a copy of the + ** pointer to it. + */ + if nSeg == 0 { + return uintptr(0) + } + i = 0 + for { + if !(i < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + nThis = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(i)*16))).FnSeg + nMerge = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(i)*16))).FnMerge + if nThis > 0 && (nThis == nSeg || nThis == nSeg-int32(1) && nMerge == nThis) { + if nSeg == int32(1) && nThis == int32(1) && (*(*TFts5StructureSegment)(unsafe.Pointer((*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(i)*16))).FaSeg))).FnPgTombstone == 0 { + return uintptr(0) + } + _fts5StructureRef(tls, pStruct) + return pStruct + } + goto _1 + _1: + ; + i++ + } + nByte = Tsqlite3_int64(uint64(nByte) + uint64((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) + pNew = _sqlite3Fts5MallocZero(tls, p+60, nByte) + if pNew != 0 { + nByte = int64(uint64(nSeg) * uint64(56)) + if (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+int32(1) < int32(FTS5_MAX_LEVEL) { + v2 = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel + int32(1) + } else { + v2 = int32(FTS5_MAX_LEVEL) + } + (*TFts5Structure)(unsafe.Pointer(pNew)).FnLevel = v2 + (*TFts5Structure)(unsafe.Pointer(pNew)).FnRef = int32(1) + (*TFts5Structure)(unsafe.Pointer(pNew)).FnWriteCounter = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter + (*TFts5Structure)(unsafe.Pointer(pNew)).FnOriginCntr = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnOriginCntr + pLvl = pNew + 32 + uintptr((*TFts5Structure)(unsafe.Pointer(pNew)).FnLevel-int32(1))*16 + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg = _sqlite3Fts5MallocZero(tls, p+60, nByte) + if (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg != 0 { + iSegOut = 0 + /* Iterate through all segments, from oldest to newest. Add them to + ** the new Fts5Level object so that pLvl->aSeg[0] is the oldest + ** segment in the data structure. */ + iLvl = (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel - int32(1) + for { + if !(iLvl >= 0) { + break + } + iSeg = 0 + for { + if !(iSeg < (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg) { + break + } + *(*TFts5StructureSegment)(unsafe.Pointer((*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSegOut)*56)) = *(*TFts5StructureSegment)(unsafe.Pointer((*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FaSeg + uintptr(iSeg)*56)) + iSegOut++ + goto _4 + _4: + ; + iSeg++ + } + goto _3 + _3: + ; + iLvl-- + } + v5 = nSeg + (*TFts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg = v5 + (*TFts5Structure)(unsafe.Pointer(pNew)).FnSegment = v5 + } else { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + return pNew +} + +func _sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iLvl int32 + var pStruct uintptr + var _ /* nRem at bp+8 */ int32 + var _ /* pNew at bp+0 */ uintptr + _, _ = iLvl, pStruct + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _fts5IndexFlush(tls, p) + pStruct = _fts5StructureRead(tls, p) + _fts5StructureInvalidate(tls, p) + if pStruct != 0 { + *(*uintptr)(unsafe.Pointer(bp)) = _fts5IndexOptimizeStruct(tls, p, pStruct) + } + _fts5StructureRelease(tls, pStruct) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + iLvl = 0 + for { + if !((*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg == 0) { + break + } + goto _1 + _1: + ; + iLvl++ + } + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5StructureLevel)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 32 + uintptr(iLvl)*16))).FnSeg > 0 { + *(*int32)(unsafe.Pointer(bp + 8)) = int32(FTS5_OPT_WORK_UNIT) + _fts5IndexMergeLevel(tls, p, bp, iLvl, bp+8) + } + _fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + _fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return _fts5IndexReturn(tls, p) +} + +// C documentation +// +// /* +// ** This is called to implement the special "VALUES('merge', $nMerge)" +// ** INSERT command. +// */ +func _sqlite3Fts5IndexMerge(tls *libc.TLS, p uintptr, nMerge int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var nMin int32 + var pNew uintptr + var _ /* pStruct at bp+0 */ uintptr + _, _ = nMin, pNew + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _fts5IndexFlush(tls, p) + *(*uintptr)(unsafe.Pointer(bp)) = _fts5StructureRead(tls, p) + if *(*uintptr)(unsafe.Pointer(bp)) != 0 { + nMin = (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FnUsermerge + _fts5StructureInvalidate(tls, p) + if nMerge < 0 { + pNew = _fts5IndexOptimizeStruct(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + _fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = pNew + nMin = int32(1) + nMerge = nMerge * -int32(1) + } + if *(*uintptr)(unsafe.Pointer(bp)) != 0 && (*TFts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FnLevel != 0 { + if _fts5IndexMerge(tls, p, bp, nMerge, nMin) != 0 { + _fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp))) + } + } + _fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + return _fts5IndexReturn(tls, p) +} + +func _fts5AppendRowid(tls *libc.TLS, p uintptr, iDelta Tu64, pUnused uintptr, pBuf uintptr) { + _ = pUnused + _sqlite3Fts5BufferAppendVarint(tls, p+60, pBuf, int64(iDelta)) +} + +func _fts5AppendPoslist(tls *libc.TLS, p uintptr, iDelta Tu64, pMulti uintptr, pBuf uintptr) { + var nByte, nData, v1 int32 + var v2 bool + _, _, _, _ = nByte, nData, v1, v2 + nData = (*TFts5Iter)(unsafe.Pointer(pMulti)).Fbase.FnData + nByte = nData + int32(9) + int32(9) + int32(FTS5_DATA_ZERO_PADDING) + if v2 = (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK; v2 { + if uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)+uint32(nByte) <= uint32((*TFts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) { + v1 = 0 + } else { + v1 = _sqlite3Fts5BufferSize(tls, p+60, pBuf, uint32(nByte+(*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + } + } + if v2 && 0 == v1 { + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), iDelta) + *(*int32)(unsafe.Pointer(pBuf + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), uint64(nData*libc.Int32FromInt32(2))) + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), (*TFts5Iter)(unsafe.Pointer(pMulti)).Fbase.FpData, uint64(nData)) + *(*int32)(unsafe.Pointer(pBuf + 8)) += nData + libc.Xmemset(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn), 0, uint64(FTS5_DATA_ZERO_PADDING)) + } +} + +func _fts5DoclistIterNext(tls *libc.TLS, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var p uintptr + var _ /* iDelta at bp+0 */ Ti64 + var _ /* nPos at bp+8 */ int32 + _ = p + p = (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist + uintptr((*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnSize) + uintptr((*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist) + if p >= (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaEof { + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = uintptr(0) + } else { + p += uintptr(_sqlite3Fts5GetVarint(tls, p, bp)) + *(*Ti64)(unsafe.Pointer(pIter + 8)) += *(*Ti64)(unsafe.Pointer(bp)) + /* Read position list size */ + if int32(*(*Tu8)(unsafe.Pointer(p)))&int32(0x80) != 0 { + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnSize = _sqlite3Fts5GetVarint32(tls, p, bp+8) + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist = *(*int32)(unsafe.Pointer(bp + 8)) >> int32(1) + } else { + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist = int32(*(*Tu8)(unsafe.Pointer(p))) >> int32(1) + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnSize = int32(1) + } + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = p + if (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist+uintptr((*TFts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist) > (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaEof { + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = uintptr(0) + } + } +} + +func _fts5DoclistIterInit(tls *libc.TLS, pBuf uintptr, pIter uintptr) { + libc.Xmemset(tls, pIter, 0, uint64(32)) + if (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn > 0 { + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + (*TFts5DoclistIter)(unsafe.Pointer(pIter)).FaEof = (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn) + _fts5DoclistIterNext(tls, pIter) + } +} + +// C documentation +// +// /* +// ** Swap the contents of buffer *p1 with that of *p2. +// */ +func _fts5BufferSwap(tls *libc.TLS, p1 uintptr, p2 uintptr) { + var tmp TFts5Buffer + _ = tmp + tmp = *(*TFts5Buffer)(unsafe.Pointer(p1)) + *(*TFts5Buffer)(unsafe.Pointer(p1)) = *(*TFts5Buffer)(unsafe.Pointer(p2)) + *(*TFts5Buffer)(unsafe.Pointer(p2)) = tmp +} + +func _fts5NextRowid(tls *libc.TLS, pBuf uintptr, piOff uintptr, piRowid uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var i int32 + var p1 uintptr + var _ /* iVal at bp+0 */ Tu64 + _, _ = i, p1 + i = *(*int32)(unsafe.Pointer(piOff)) + if i >= (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn { + *(*int32)(unsafe.Pointer(piOff)) = -int32(1) + } else { + *(*int32)(unsafe.Pointer(piOff)) = i + int32(_sqlite3Fts5GetVarint(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr(i), bp)) + p1 = piRowid + *(*Ti64)(unsafe.Pointer(p1)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p1))) + *(*Tu64)(unsafe.Pointer(bp))) + } +} + +// C documentation +// +// /* +// ** This is the equivalent of fts5MergePrefixLists() for detail=none mode. +// ** In this case the buffers consist of a delta-encoded list of rowids only. +// */ +func _fts5MergeRowidLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf uintptr) { + bp := tls.Alloc(48) + defer tls.Free(48) + var iOut Ti64 + var p2 uintptr + var _ /* i1 at bp+0 */ int32 + var _ /* i2 at bp+4 */ int32 + var _ /* iRowid1 at bp+8 */ Ti64 + var _ /* iRowid2 at bp+16 */ Ti64 + var _ /* out at bp+24 */ TFts5Buffer + _, _ = iOut, p2 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*int32)(unsafe.Pointer(bp + 4)) = 0 + *(*Ti64)(unsafe.Pointer(bp + 8)) = 0 + *(*Ti64)(unsafe.Pointer(bp + 16)) = 0 + iOut = 0 + p2 = aBuf + _ = nBuf + libc.Xmemset(tls, bp+24, 0, uint64(16)) + _sqlite3Fts5BufferSize(tls, p+60, bp+24, uint32((*TFts5Buffer)(unsafe.Pointer(p1)).Fn+(*TFts5Buffer)(unsafe.Pointer(p2)).Fn)) + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + _fts5NextRowid(tls, p1, bp, bp+8) + _fts5NextRowid(tls, p2, bp+4, bp+16) + for *(*int32)(unsafe.Pointer(bp)) >= 0 || *(*int32)(unsafe.Pointer(bp + 4)) >= 0 { + if *(*int32)(unsafe.Pointer(bp)) >= 0 && (*(*int32)(unsafe.Pointer(bp + 4)) < 0 || *(*Ti64)(unsafe.Pointer(bp + 8)) < *(*Ti64)(unsafe.Pointer(bp + 16))) { + *(*int32)(unsafe.Pointer(bp + 24 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+24)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+24)).Fn), uint64(*(*Ti64)(unsafe.Pointer(bp + 8))-iOut)) + iOut = *(*Ti64)(unsafe.Pointer(bp + 8)) + _fts5NextRowid(tls, p1, bp, bp+8) + } else { + *(*int32)(unsafe.Pointer(bp + 24 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+24)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+24)).Fn), uint64(*(*Ti64)(unsafe.Pointer(bp + 16))-iOut)) + iOut = *(*Ti64)(unsafe.Pointer(bp + 16)) + if *(*int32)(unsafe.Pointer(bp)) >= 0 && *(*Ti64)(unsafe.Pointer(bp + 8)) == *(*Ti64)(unsafe.Pointer(bp + 16)) { + _fts5NextRowid(tls, p1, bp, bp+8) + } + _fts5NextRowid(tls, p2, bp+4, bp+16) + } + } + _fts5BufferSwap(tls, bp+24, p1) + _sqlite3Fts5BufferFree(tls, bp+24) +} + +type TPrefixMerger = struct { + Fiter TFts5DoclistIter + FiPos Ti64 + FiOff int32 + FaPos uintptr + FpNext uintptr +} + +type PrefixMerger = TPrefixMerger + +type TPrefixMerger1 = struct { + Fiter TFts5DoclistIter + FiPos Ti64 + FiOff int32 + FaPos uintptr + FpNext uintptr +} + +type PrefixMerger1 = TPrefixMerger1 + +func _fts5PrefixMergerInsertByRowid(tls *libc.TLS, ppHead uintptr, p uintptr) { + var pp uintptr + _ = pp + if (*TPrefixMerger)(unsafe.Pointer(p)).Fiter.FaPoslist != 0 { + pp = ppHead + for *(*uintptr)(unsafe.Pointer(pp)) != 0 && (*TPrefixMerger)(unsafe.Pointer(p)).Fiter.FiRowid > (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).Fiter.FiRowid { + pp = *(*uintptr)(unsafe.Pointer(pp)) + 56 + } + (*TPrefixMerger)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + } +} + +func _fts5PrefixMergerInsertByPosition(tls *libc.TLS, ppHead uintptr, p uintptr) { + var pp uintptr + _ = pp + if (*TPrefixMerger)(unsafe.Pointer(p)).FiPos >= 0 { + pp = ppHead + for *(*uintptr)(unsafe.Pointer(pp)) != 0 && (*TPrefixMerger)(unsafe.Pointer(p)).FiPos > (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FiPos { + pp = *(*uintptr)(unsafe.Pointer(pp)) + 56 + } + (*TPrefixMerger)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + } +} + +// C documentation +// +// /* +// ** Array aBuf[] contains nBuf doclists. These are all merged in with the +// ** doclist in buffer p1. +// */ +func _fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf uintptr) { + bp := tls.Alloc(1072) + defer tls.Free(1072) + var i, nMerge, nOut, nTail, nTmp int32 + var iLastRowid Ti64 + var pI, pNext, pSave, pThis, pThis1, pX uintptr + var _ /* aMerger at bp+0 */ [16]TPrefixMerger + var _ /* iPrev at bp+1064 */ Ti64 + var _ /* out at bp+1032 */ TFts5Buffer + var _ /* pHead at bp+1024 */ uintptr + var _ /* tmp at bp+1048 */ TFts5Buffer + _, _, _, _, _, _, _, _, _, _, _, _ = i, iLastRowid, nMerge, nOut, nTail, nTmp, pI, pNext, pSave, pThis, pThis1, pX + *(*uintptr)(unsafe.Pointer(bp + 1024)) = uintptr(0) + nOut = 0 + *(*TFts5Buffer)(unsafe.Pointer(bp + 1032)) = TFts5Buffer{} + *(*TFts5Buffer)(unsafe.Pointer(bp + 1048)) = TFts5Buffer{} + iLastRowid = 0 + /* Initialize a doclist-iterator for each input buffer. Arrange them in + ** a linked-list starting at pHead in ascending order of rowid. Avoid + ** linking any iterators already at EOF into the linked list at all. */ + libc.Xmemset(tls, bp, 0, uint64(64)*uint64(nBuf+libc.Int32FromInt32(1))) + *(*uintptr)(unsafe.Pointer(bp + 1024)) = bp + uintptr(nBuf)*64 + _fts5DoclistIterInit(tls, p1, *(*uintptr)(unsafe.Pointer(bp + 1024))) + i = 0 + for { + if !(i < nBuf) { + break + } + _fts5DoclistIterInit(tls, aBuf+uintptr(i)*16, bp+uintptr(i)*64) + _fts5PrefixMergerInsertByRowid(tls, bp+1024, bp+uintptr(i)*64) + nOut += (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16))).Fn + goto _1 + _1: + ; + i++ + } + if nOut == 0 { + return + } + nOut += (*TFts5Buffer)(unsafe.Pointer(p1)).Fn + int32(9) + int32(10)*nBuf + /* The maximum size of the output is equal to the sum of the + ** input sizes + 1 varint (9 bytes). The extra varint is because if the + ** first rowid in one input is a large negative number, and the first in + ** the other a non-negative number, the delta for the non-negative + ** number will be larger on disk than the literal integer value + ** was. + ** + ** Or, if the input position-lists are corrupt, then the output might + ** include up to (nBuf+1) extra 10-byte positions created by interpreting -1 + ** (the value PoslistNext64() uses for EOF) as a position and appending + ** it to the output. This can happen at most once for each input + ** position-list, hence (nBuf+1) 10 byte paddings. */ + if _sqlite3Fts5BufferSize(tls, p+60, bp+1032, uint32(nOut)) != 0 { + return + } + for *(*uintptr)(unsafe.Pointer(bp + 1024)) != 0 { + *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += _sqlite3Fts5PutVarint(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), uint64((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).Fiter.FiRowid)-uint64(iLastRowid)) + iLastRowid = (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).Fiter.FiRowid + if (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FpNext != 0 && iLastRowid == (*TPrefixMerger)(unsafe.Pointer((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FpNext)).Fiter.FiRowid { + /* Merge data from two or more poslists */ + *(*Ti64)(unsafe.Pointer(bp + 1064)) = 0 + nTmp = int32(FTS5_DATA_ZERO_PADDING) + nMerge = 0 + pSave = *(*uintptr)(unsafe.Pointer(bp + 1024)) + pThis = uintptr(0) + nTail = 0 + *(*uintptr)(unsafe.Pointer(bp + 1024)) = uintptr(0) + for pSave != 0 && (*TPrefixMerger)(unsafe.Pointer(pSave)).Fiter.FiRowid == iLastRowid { + pNext = (*TPrefixMerger)(unsafe.Pointer(pSave)).FpNext + (*TPrefixMerger)(unsafe.Pointer(pSave)).FiOff = 0 + (*TPrefixMerger)(unsafe.Pointer(pSave)).FiPos = 0 + (*TPrefixMerger)(unsafe.Pointer(pSave)).FaPos = (*TPrefixMerger)(unsafe.Pointer(pSave)).Fiter.FaPoslist + uintptr((*TPrefixMerger)(unsafe.Pointer(pSave)).Fiter.FnSize) + _sqlite3Fts5PoslistNext64(tls, (*TPrefixMerger)(unsafe.Pointer(pSave)).FaPos, (*TPrefixMerger)(unsafe.Pointer(pSave)).Fiter.FnPoslist, pSave+40, pSave+32) + nTmp += (*TPrefixMerger)(unsafe.Pointer(pSave)).Fiter.FnPoslist + int32(10) + nMerge++ + _fts5PrefixMergerInsertByPosition(tls, bp+1024, pSave) + pSave = pNext + } + if *(*uintptr)(unsafe.Pointer(bp + 1024)) == uintptr(0) || (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FpNext == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< nTmp-int32(FTS5_DATA_ZERO_PADDING) { + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), (*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FaPos+uintptr((*TPrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024)))).FiOff), uint64(nTail)) + *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += nTail + } + *(*uintptr)(unsafe.Pointer(bp + 1024)) = pSave + i = 0 + for { + if !(i < nBuf+int32(1)) { + break + } + pX = bp + uintptr(i)*64 + if (*TPrefixMerger)(unsafe.Pointer(pX)).Fiter.FaPoslist != 0 && (*TPrefixMerger)(unsafe.Pointer(pX)).Fiter.FiRowid == iLastRowid { + _fts5DoclistIterNext(tls, pX) + _fts5PrefixMergerInsertByRowid(tls, bp+1024, pX) + } + goto _2 + _2: + ; + i++ + } + } else { + /* Copy poslist from pHead to output */ + pThis1 = *(*uintptr)(unsafe.Pointer(bp + 1024)) + pI = pThis1 + libc.Xmemcpy(tls, (*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fp+uintptr((*TFts5Buffer)(unsafe.Pointer(bp+1032)).Fn), (*TFts5DoclistIter)(unsafe.Pointer(pI)).FaPoslist, uint64((*TFts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist+(*TFts5DoclistIter)(unsafe.Pointer(pI)).FnSize)) + *(*int32)(unsafe.Pointer(bp + 1032 + 8)) += (*TFts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist + (*TFts5DoclistIter)(unsafe.Pointer(pI)).FnSize + _fts5DoclistIterNext(tls, pI) + *(*uintptr)(unsafe.Pointer(bp + 1024)) = (*TPrefixMerger)(unsafe.Pointer(pThis1)).FpNext + _fts5PrefixMergerInsertByRowid(tls, bp+1024, pThis1) + } + } + _sqlite3Fts5BufferFree(tls, p1) + _sqlite3Fts5BufferFree(tls, bp+1048) + libc.Xmemset(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp + 1032))).Fp+uintptr((*(*TFts5Buffer)(unsafe.Pointer(bp + 1032))).Fn), 0, uint64(FTS5_DATA_ZERO_PADDING)) + *(*TFts5Buffer)(unsafe.Pointer(p1)) = *(*TFts5Buffer)(unsafe.Pointer(bp + 1032)) +} + +func _fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pToken uintptr, nToken int32, pColset uintptr, ppIter uintptr) { + bp := tls.Alloc(32) + defer tls.Free(32) + var aBuf, pData, pSeg, pSeg1, pStruct, pTerm, xAppend, xMerge uintptr + var f2, flags, i, i1, iFree, iStore, nBuf, nMerge, nTerm, v8 int32 + var iLastRowid Ti64 + var _ /* bNewTerm at bp+24 */ int32 + var _ /* doclist at bp+8 */ TFts5Buffer + var _ /* dummy at bp+28 */ int32 + var _ /* p1 at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aBuf, f2, flags, i, i1, iFree, iLastRowid, iStore, nBuf, nMerge, nTerm, pData, pSeg, pSeg1, pStruct, pTerm, xAppend, xMerge, v8 + nBuf = int32(32) + nMerge = int32(1) + if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { + xMerge = __ccgo_fp(_fts5MergeRowidLists) + xAppend = __ccgo_fp(_fts5AppendRowid) + } else { + nMerge = libc.Int32FromInt32(FTS5_MERGE_NLIST) - libc.Int32FromInt32(1) + nBuf = nMerge * int32(8) /* Sufficient to merge (16^8)==(2^32) lists */ + xMerge = __ccgo_fp(_fts5MergePrefixLists) + xAppend = __ccgo_fp(_fts5AppendPoslist) + } + aBuf = _fts5IdxMalloc(tls, p, int64(uint64(16)*uint64(nBuf))) + pStruct = _fts5StructureRead(tls, p) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + flags = libc.Int32FromInt32(FTS5INDEX_QUERY_SCAN) | libc.Int32FromInt32(FTS5INDEX_QUERY_SKIPEMPTY) | libc.Int32FromInt32(FTS5INDEX_QUERY_NOOUTPUT) + iLastRowid = 0 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 24)) = int32(1) + libc.Xmemset(tls, bp+8, 0, uint64(16)) + /* If iIdx is non-zero, then it is the number of a prefix-index for + ** prefixes 1 character longer than the prefix being queried for. That + ** index contains all the doclists required, except for the one + ** corresponding to the prefix itself. That one is extracted from the + ** main term index here. */ + if iIdx != 0 { + *(*int32)(unsafe.Pointer(bp + 28)) = 0 + f2 = libc.Int32FromInt32(FTS5INDEX_QUERY_SKIPEMPTY) | libc.Int32FromInt32(FTS5INDEX_QUERY_NOOUTPUT) + *(*Tu8)(unsafe.Pointer(pToken)) = uint8('0') + _fts5MultiIterNew(tls, p, pStruct, f2, pColset, pToken, nToken, -int32(1), 0, bp) + _fts5IterSetOutputCb(tls, p+60, *(*uintptr)(unsafe.Pointer(bp))) + for { + if !(_fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) == 0) { + break + } + pSeg = *(*uintptr)(unsafe.Pointer(bp)) + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFirst + 1*4))).FiFirst)*128 + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxSetOutputs})))(tls, *(*uintptr)(unsafe.Pointer(bp)), pSeg) + if (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FnData != 0 { + (*(*func(*libc.TLS, uintptr, Tu64, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{xAppend})))(tls, p, uint64((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid)-uint64(iLastRowid), *(*uintptr)(unsafe.Pointer(bp)), bp+8) + iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid + } + goto _1 + _1: + ; + _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+28) + } + _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + } + *(*Tu8)(unsafe.Pointer(pToken)) = uint8(int32('0') + iIdx) + _fts5MultiIterNew(tls, p, pStruct, flags, pColset, pToken, nToken, -int32(1), 0, bp) + _fts5IterSetOutputCb(tls, p+60, *(*uintptr)(unsafe.Pointer(bp))) + for { + if !(_fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp))) == 0) { + break + } + pSeg1 = *(*uintptr)(unsafe.Pointer(bp)) + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFirst + 1*4))).FiFirst)*128 + nTerm = (*TFts5SegIter)(unsafe.Pointer(pSeg1)).Fterm.Fn + pTerm = (*TFts5SegIter)(unsafe.Pointer(pSeg1)).Fterm.Fp + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxSetOutputs})))(tls, *(*uintptr)(unsafe.Pointer(bp)), pSeg1) + if *(*int32)(unsafe.Pointer(bp + 24)) != 0 { + if nTerm < nToken || libc.Xmemcmp(tls, pToken, pTerm, uint64(nToken)) != 0 { + break + } + } + if (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FnData == 0 { + goto _2 + } + if (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid <= iLastRowid && (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn > 0 { + i = 0 + for { + if !((*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn != 0) { + break + } + i1 = i * nMerge + iStore = i1 + for { + if !(iStore < i1+nMerge) { + break + } + if (*(*TFts5Buffer)(unsafe.Pointer(aBuf + uintptr(iStore)*16))).Fn == 0 { + _fts5BufferSwap(tls, bp+8, aBuf+uintptr(iStore)*16) + _sqlite3Fts5BufferZero(tls, bp+8) + break + } + goto _4 + _4: + ; + iStore++ + } + if iStore == i1+nMerge { + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{xMerge})))(tls, p, bp+8, nMerge, aBuf+uintptr(i1)*16) + iStore = i1 + for { + if !(iStore < i1+nMerge) { + break + } + _sqlite3Fts5BufferZero(tls, aBuf+uintptr(iStore)*16) + goto _5 + _5: + ; + iStore++ + } + } + goto _3 + _3: + ; + i++ + } + iLastRowid = 0 + } + (*(*func(*libc.TLS, uintptr, Tu64, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{xAppend})))(tls, p, uint64((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid)-uint64(iLastRowid), *(*uintptr)(unsafe.Pointer(bp)), bp+8) + iLastRowid = (*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).Fbase.FiRowid + goto _2 + _2: + ; + _fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp)), bp+24) + } + i = 0 + for { + if !(i < nBuf) { + break + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(&struct{ uintptr }{xMerge})))(tls, p, bp+8, nMerge, aBuf+uintptr(i)*16) + } + iFree = i + for { + if !(iFree < i+nMerge) { + break + } + _sqlite3Fts5BufferFree(tls, aBuf+uintptr(iFree)*16) + goto _7 + _7: + ; + iFree++ + } + goto _6 + _6: + ; + i += nMerge + } + _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + pData = _fts5IdxMalloc(tls, p, int64(uint64(16)+uint64((*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn)+uint64(FTS5_DATA_ZERO_PADDING))) + if pData != 0 { + (*TFts5Data)(unsafe.Pointer(pData)).Fp = pData + 1*16 + v8 = (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn + (*TFts5Data)(unsafe.Pointer(pData)).FszLeaf = v8 + (*TFts5Data)(unsafe.Pointer(pData)).Fnn = v8 + if (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn != 0 { + libc.Xmemcpy(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, uint64((*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fn)) + } + _fts5MultiIterNew2(tls, p, pData, bDesc, ppIter) + } + _sqlite3Fts5BufferFree(tls, bp+8) + } + _fts5StructureRelease(tls, pStruct) + Xsqlite3_free(tls, aBuf) +} + +// C documentation +// +// /* +// ** Indicate that all subsequent calls to sqlite3Fts5IndexWrite() pertain +// ** to the document with rowid iRowid. +// */ +func _sqlite3Fts5IndexBeginWrite(tls *libc.TLS, p uintptr, bDelete int32, iRowid Ti64) (r int32) { + /* Allocate the hash table if it has not already been allocated */ + if (*TFts5Index)(unsafe.Pointer(p)).FpHash == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = _sqlite3Fts5HashNew(tls, (*TFts5Index)(unsafe.Pointer(p)).FpConfig, p+24, p+32) + } + /* Flush the hash table to disk if required */ + if iRowid < (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid || iRowid == (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid && (*TFts5Index)(unsafe.Pointer(p)).FbDelete == 0 || (*TFts5Index)(unsafe.Pointer(p)).FnPendingData > (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FnHashSize { + _fts5IndexFlush(tls, p) + } + (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid = iRowid + (*TFts5Index)(unsafe.Pointer(p)).FbDelete = bDelete + if bDelete == 0 { + (*TFts5Index)(unsafe.Pointer(p)).FnPendingRow++ + } + return _fts5IndexReturn(tls, p) +} + +// C documentation +// +// /* +// ** Commit data to disk. +// */ +func _sqlite3Fts5IndexSync(tls *libc.TLS, p uintptr) (r int32) { + _fts5IndexFlush(tls, p) + _sqlite3Fts5IndexCloseReader(tls, p) + return _fts5IndexReturn(tls, p) +} + +// C documentation +// +// /* +// ** Discard any data stored in the in-memory hash tables. Do not write it +// ** to the database. Additionally, assume that the contents of the %_data +// ** table may have changed on disk. So any in-memory caches of %_data +// ** records must be invalidated. +// */ +func _sqlite3Fts5IndexRollback(tls *libc.TLS, p uintptr) (r int32) { + _sqlite3Fts5IndexCloseReader(tls, p) + _fts5IndexDiscardData(tls, p) + _fts5StructureInvalidate(tls, p) + /* assert( p->rc==SQLITE_OK ); */ + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The %_data table is completely empty when this function is called. This +// ** function populates it with the initial structure objects for each index, +// ** and the initial version of the "averages" record (a zero-byte blob). +// */ +func _sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) (r int32) { + bp := tls.Alloc(48) + defer tls.Free(48) + var _ /* s at bp+0 */ TFts5Structure + _fts5StructureInvalidate(tls, p) + _fts5IndexDiscardData(tls, p) + libc.Xmemset(tls, bp, 0, uint64(48)) + if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FbContentlessDelete != 0 { + (*(*TFts5Structure)(unsafe.Pointer(bp))).FnOriginCntr = uint64(1) + } + _fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), __ccgo_ts+1680, 0) + _fts5StructureWrite(tls, p, bp) + return _fts5IndexReturn(tls, p) +} + +// C documentation +// +// /* +// ** Open a new Fts5Index handle. If the bCreate argument is true, create +// ** and initialize the underlying %_data table. +// ** +// ** If successful, set *pp to point to the new object and return SQLITE_OK. +// ** Otherwise, set *pp to NULL and return an SQLite error code. +// */ +func _sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var p, v1 uintptr + var _ /* rc at bp+0 */ int32 + _, _ = p, v1 + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* New object */ + v1 = _sqlite3Fts5MallocZero(tls, bp, int64(168)) + p = v1 + *(*uintptr)(unsafe.Pointer(pp)) = v1 + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5Index)(unsafe.Pointer(p)).FpConfig = pConfig + (*TFts5Index)(unsafe.Pointer(p)).FnWorkUnit = int32(FTS5_WORK_UNIT) + (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36656, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + if (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl != 0 && bCreate != 0 { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+25773, __ccgo_ts+36664, 0, pzErr) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5CreateTable(tls, pConfig, __ccgo_ts+11825, __ccgo_ts+36699, int32(1), pzErr) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexReinit(tls, p) + } + } + } + if *(*int32)(unsafe.Pointer(bp)) != 0 { + _sqlite3Fts5IndexClose(tls, p) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** Close a handle opened by an earlier call to sqlite3Fts5IndexOpen(). +// */ +func _sqlite3Fts5IndexClose(tls *libc.TLS, p uintptr) (r int32) { + var rc int32 + _ = rc + rc = SQLITE_OK + if p != 0 { + _fts5StructureInvalidate(tls, p) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpWriter) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleter) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxDeleter) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxSelect) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxNextSelect) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDataVersion) + Xsqlite3_finalize(tls, (*TFts5Index)(unsafe.Pointer(p)).FpDeleteFromIdx) + _sqlite3Fts5HashFree(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash) + Xsqlite3_free(tls, (*TFts5Index)(unsafe.Pointer(p)).FzDataTbl) + Xsqlite3_free(tls, p) + } + return rc +} + +// C documentation +// +// /* +// ** Argument p points to a buffer containing utf-8 text that is n bytes in +// ** size. Return the number of bytes in the nChar character prefix of the +// ** buffer, or 0 if there are less than nChar characters in total. +// */ +func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nChar int32) (r int32) { + var i, n, v2 int32 + _, _, _ = i, n, v2 + n = 0 + i = 0 + for { + if !(i < nChar) { + break + } + if n >= nByte { + return 0 + } /* Input contains fewer than nChar chars */ + v2 = n + n++ + if int32(uint8(*(*int8)(unsafe.Pointer(p + uintptr(v2))))) >= int32(0xc0) { + if n >= nByte { + return 0 + } + for int32(*(*int8)(unsafe.Pointer(p + uintptr(n))))&int32(0xc0) == int32(0x80) { + n++ + if n >= nByte { + if i+int32(1) == nChar { + break + } + return 0 + } + } + } + goto _1 + _1: + ; + i++ + } + return n +} + +// C documentation +// +// /* +// ** pIn is a UTF-8 encoded string, nIn bytes in size. Return the number of +// ** unicode characters in the string. +// */ +func _fts5IndexCharlen(tls *libc.TLS, pIn uintptr, nIn int32) (r int32) { + var i, nChar, v1 int32 + _, _, _ = i, nChar, v1 + nChar = 0 + i = 0 + for i < nIn { + v1 = i + i++ + if int32(uint8(*(*int8)(unsafe.Pointer(pIn + uintptr(v1))))) >= int32(0xc0) { + for i < nIn && int32(*(*int8)(unsafe.Pointer(pIn + uintptr(i))))&int32(0xc0) == int32(0x80) { + i++ + } + } + nChar++ + } + return nChar +} + +// C documentation +// +// /* +// ** Insert or remove data to or from the index. Each time a document is +// ** added to or removed from the index, this function is called one or more +// ** times. +// ** +// ** For an insert, it must be called once for each token in the new document. +// ** If the operation is a delete, it must be called (at least) once for each +// ** unique token in the document with an iCol value less than zero. The iPos +// ** argument is ignored for a delete. +// */ +func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pToken uintptr, nToken int32) (r int32) { + var i, nByte, nChar, rc int32 + var pConfig uintptr + _, _, _, _, _ = i, nByte, nChar, pConfig, rc /* Used to iterate through indexes */ + rc = SQLITE_OK /* Return code */ + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + /* Add the entry to the main terms index. */ + rc = _sqlite3Fts5HashWrite(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8('0'), pToken, nToken) + i = 0 + for { + if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix && rc == SQLITE_OK) { + break + } + nChar = *(*int32)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr(i)*4)) + nByte = _sqlite3Fts5IndexCharlenToBytelen(tls, pToken, nToken, nChar) + if nByte != 0 { + rc = _sqlite3Fts5HashWrite(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8(libc.Int32FromUint8('0')+i+libc.Int32FromInt32(1)), pToken, nByte) + } + goto _1 + _1: + ; + i++ + } + return rc +} + +// C documentation +// +// /* +// ** pToken points to a buffer of size nToken bytes containing a search +// ** term, including the index number at the start, used on a tokendata=1 +// ** table. This function returns true if the term in buffer pBuf matches +// ** token pToken/nToken. +// */ +func _fts5IsTokendataPrefix(tls *libc.TLS, pBuf uintptr, pToken uintptr, nToken int32) (r int32) { + return libc.BoolInt32((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn >= nToken && 0 == libc.Xmemcmp(tls, (*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp, pToken, uint64(nToken)) && ((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fn == nToken || int32(*(*Tu8)(unsafe.Pointer((*TFts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(nToken)))) == 0x00)) +} + +// C documentation +// +// /* +// ** Ensure the segment-iterator passed as the only argument points to EOF. +// */ +func _fts5SegIterSetEOF(tls *libc.TLS, pSeg uintptr) { + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf = uintptr(0) +} + +/* +** Usually, a tokendata=1 iterator (struct Fts5TokenDataIter) accumulates an +** array of these for each row it visits. Or, for an iterator used by an +** "ORDER BY rank" query, it accumulates an array of these for the entire +** query. +** +** Each instance in the array indicates the iterator (and therefore term) +** associated with position iPos of rowid iRowid. This is used by the +** xInstToken() API. + */ +type TFts5TokenDataMap1 = struct { + FiRowid Ti64 + FiPos Ti64 + FiIter int32 +} + +type Fts5TokenDataMap1 = TFts5TokenDataMap1 + +/* +** An object used to supplement Fts5Iter for tokendata=1 iterators. + */ +type TFts5TokenDataIter1 = struct { + FnIter int32 + FnIterAlloc int32 + FnMap int32 + FnMapAlloc int32 + FaMap uintptr + FaPoslistReader uintptr + FaPoslistToIter uintptr + FapIter [1]uintptr +} + +type Fts5TokenDataIter1 = TFts5TokenDataIter1 + +// C documentation +// +// /* +// ** This function appends iterator pAppend to Fts5TokenDataIter pIn and +// ** returns the result. +// */ +func _fts5AppendTokendataIter(tls *libc.TLS, p uintptr, pIn uintptr, pAppend uintptr) (r uintptr) { + var nAlloc, nByte, v1, v2 int32 + var pNew, pRet, v3 uintptr + _, _, _, _, _, _, _ = nAlloc, nByte, pNew, pRet, v1, v2, v3 + pRet = pIn + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if pIn == uintptr(0) || (*TFts5TokenDataIter)(unsafe.Pointer(pIn)).FnIter == (*TFts5TokenDataIter)(unsafe.Pointer(pIn)).FnIterAlloc { + if pIn != 0 { + v1 = (*TFts5TokenDataIter)(unsafe.Pointer(pIn)).FnIterAlloc * int32(2) + } else { + v1 = int32(16) + } + nAlloc = v1 + nByte = int32(uint64(nAlloc)*uint64(8) + uint64(48)) + pNew = Xsqlite3_realloc(tls, pIn, nByte) + if pNew == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + } else { + if pIn == uintptr(0) { + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + } + pRet = pNew + (*TFts5TokenDataIter)(unsafe.Pointer(pNew)).FnIterAlloc = nAlloc + } + } + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + _sqlite3Fts5IterClose(tls, pAppend) + } else { + v3 = pRet + v2 = *(*int32)(unsafe.Pointer(v3)) + *(*int32)(unsafe.Pointer(v3))++ + *(*uintptr)(unsafe.Pointer(pRet + 40 + uintptr(v2)*8)) = pAppend + } + return pRet +} + +// C documentation +// +// /* +// ** Delete an Fts5TokenDataIter structure and its contents. +// */ +func _fts5TokendataIterDelete(tls *libc.TLS, pSet uintptr) { + var ii int32 + _ = ii + if pSet != 0 { + ii = 0 + for { + if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FnIter) { + break + } + _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii)*8))) + goto _1 + _1: + ; + ii++ + } + Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaPoslistReader) + Xsqlite3_free(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FaMap) + Xsqlite3_free(tls, pSet) + } +} + +// C documentation +// +// /* +// ** Append a mapping to the token-map belonging to object pT. +// */ +func _fts5TokendataIterAppendMap(tls *libc.TLS, p uintptr, pT uintptr, iIter int32, iRowid Ti64, iPos Ti64) { + var aNew uintptr + var nByte, nNew, v1 int32 + _, _, _, _ = aNew, nByte, nNew, v1 + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap == (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc { + if (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc != 0 { + v1 = (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc * int32(2) + } else { + v1 = int32(64) + } + nNew = v1 + nByte = int32(uint64(nNew) * uint64(24)) + aNew = Xsqlite3_realloc(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap, nByte) + if aNew == uintptr(0) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) + return + } + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap = aNew + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc = nNew + } + (*(*TFts5TokenDataMap)(unsafe.Pointer((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap + uintptr((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap)*24))).FiRowid = iRowid + (*(*TFts5TokenDataMap)(unsafe.Pointer((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap + uintptr((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap)*24))).FiPos = iPos + (*(*TFts5TokenDataMap)(unsafe.Pointer((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap + uintptr((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap)*24))).FiIter = iIter + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap++ + } +} + +// C documentation +// +// /* +// ** The iterator passed as the only argument must be a tokendata=1 iterator +// ** (pIter->pTokenDataIter!=0). This function sets the iterator output +// ** variables (pIter->base.*) according to the contents of the current +// ** row. +// */ +func _fts5IterSetOutputsTokendata(tls *libc.TLS, pIter uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var aNew, p, p1, pReader, pT uintptr + var eDetail, iMin, ii, nByte, nHit, nNew, nReader, v3, v4 int32 + var iMinPos, iRowid Ti64 + var _ /* iPrev at bp+0 */ Ti64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aNew, eDetail, iMin, iMinPos, iRowid, ii, nByte, nHit, nNew, nReader, p, p1, pReader, pT, v3, v4 + nHit = 0 + iRowid = int64(-libc.Int32FromInt32(1)) - (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)< int32(1) && eDetail != int32(FTS5_DETAIL_NONE) { + nReader = 0 + nByte = 0 + *(*Ti64)(unsafe.Pointer(bp)) = 0 + /* Allocate array of iterators if they are not already allocated. */ + if (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistReader == uintptr(0) { + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistReader = _sqlite3Fts5MallocZero(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex+60, int64(uint64((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter)*(libc.Uint64FromInt64(32)+libc.Uint64FromInt64(4)))) + if (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistReader == uintptr(0) { + return + } + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistToIter = (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistReader + uintptr((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter)*32 + } + /* Populate an iterator for each poslist that will be merged */ + ii = 0 + for { + if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { + break + } + p1 = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) + if iRowid == (*TFts5Iter)(unsafe.Pointer(p1)).Fbase.FiRowid { + *(*int32)(unsafe.Pointer((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistToIter + uintptr(nReader)*4)) = ii + v3 = nReader + nReader++ + _sqlite3Fts5PoslistReaderInit(tls, (*TFts5Iter)(unsafe.Pointer(p1)).Fbase.FpData, (*TFts5Iter)(unsafe.Pointer(p1)).Fbase.FnData, (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaPoslistReader+uintptr(v3)*32) + nByte += (*TFts5Iter)(unsafe.Pointer(p1)).Fbase.FnData + } + goto _2 + _2: + ; + ii++ + } + /* Ensure the output buffer is large enough */ + if uint32((*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fn)+uint32(nByte+nHit*libc.Int32FromInt32(10)) <= uint32((*TFts5Buffer)(unsafe.Pointer(pIter+40)).FnSpace) { + v4 = 0 + } else { + v4 = _sqlite3Fts5BufferSize(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex+60, pIter+40, uint32(nByte+nHit*int32(10)+(*TFts5Buffer)(unsafe.Pointer(pIter+40)).Fn)) + } + if v4 != 0 { + return + } + /* Ensure the token-mapping is large enough */ + if eDetail == FTS5_DETAIL_FULL && (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMap+nByte { + nNew = ((*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc + nByte) * int32(2) + aNew = Xsqlite3_realloc(tls, (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap, int32(uint64(nNew)*uint64(24))) + if aNew == uintptr(0) { + (*TFts5Index)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex)).Frc = int32(SQLITE_NOMEM) + return + } + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap = aNew + (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnMapAlloc = nNew + } + (*TFts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn = 0 + for int32(1) != 0 { + iMinPos = libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)<pTokenDataIter!=0). This function advances the iterator. If +// ** argument bFrom is false, then the iterator is advanced to the next +// ** entry. Or, if bFrom is true, it is advanced to the first entry with +// ** a rowid of iFrom or greater. +// */ +func _fts5TokendataIterNext(tls *libc.TLS, pIter uintptr, bFrom int32, iFrom Ti64) { + var ii int32 + var p, pIndex, pT uintptr + _, _, _, _ = ii, p, pIndex, pT + pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + pIndex = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex + ii = 0 + for { + if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { + break + } + p = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) + if int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && ((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid == (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid || bFrom != 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom) { + _fts5MultiIterNext(tls, pIndex, p, bFrom, iFrom) + for bFrom != 0 && int32((*TFts5Iter)(unsafe.Pointer(p)).Fbase.FbEof) == 0 && (*TFts5Iter)(unsafe.Pointer(p)).Fbase.FiRowid < iFrom && (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5MultiIterNext(tls, pIndex, p, 0, 0) + } + } + goto _1 + _1: + ; + ii++ + } + if (*TFts5Index)(unsafe.Pointer(pIndex)).Frc == SQLITE_OK { + _fts5IterSetOutputsTokendata(tls, pIter) + } +} + +// C documentation +// +// /* +// ** If the segment-iterator passed as the first argument is at EOF, then +// ** set pIter->term to a copy of buffer pTerm. +// */ +func _fts5TokendataSetTermIfEof(tls *libc.TLS, pIter uintptr, pTerm uintptr) { + if pIter != 0 && (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104))).FpLeaf == uintptr(0) { + _sqlite3Fts5BufferSet(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex+60, pIter+104+96, (*TFts5Buffer)(unsafe.Pointer(pTerm)).Fn, (*TFts5Buffer)(unsafe.Pointer(pTerm)).Fp) + } +} + +// C documentation +// +// /* +// ** This function sets up an iterator to use for a non-prefix query on a +// ** tokendata=1 table. +// */ +func _fts5SetupTokendataIter(tls *libc.TLS, p uintptr, pToken uintptr, nToken int32, pColset uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bDone, flags, iLvl, iSeg, iSeg1, ii, ii1 int32 + var pII, pIter, pNew, pNewIter, pPrev, pPrevIter, pRet, pSeg, pSet, pSmall, pStruct, v1, v2 uintptr + var _ /* bSeek at bp+0 */ TFts5Buffer + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bDone, flags, iLvl, iSeg, iSeg1, ii, ii1, pII, pIter, pNew, pNewIter, pPrev, pPrevIter, pRet, pSeg, pSet, pSmall, pStruct, v1, v2 + pRet = uintptr(0) + pSet = uintptr(0) + pStruct = uintptr(0) + flags = libc.Int32FromInt32(FTS5INDEX_QUERY_SCANONETERM) | libc.Int32FromInt32(FTS5INDEX_QUERY_SCAN) + *(*TFts5Buffer)(unsafe.Pointer(bp)) = TFts5Buffer{} + pSmall = uintptr(0) + _fts5IndexFlush(tls, p) + pStruct = _fts5StructureRead(tls, p) + for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if pSet != 0 { + v1 = *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr((*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FnIter-int32(1))*8)) + } else { + v1 = uintptr(0) + } + pPrev = v1 + pNew = uintptr(0) + pNewIter = uintptr(0) + pPrevIter = uintptr(0) + pNew = _fts5MultiIterAlloc(tls, p, (*TFts5Structure)(unsafe.Pointer(pStruct)).FnSegment) + if pSmall != 0 { + _sqlite3Fts5BufferSet(tls, p+60, bp, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fn, (*TFts5Buffer)(unsafe.Pointer(pSmall)).Fp) + _sqlite3Fts5BufferAppendBlob(tls, p+60, bp, uint32(1), __ccgo_ts+36743) + } else { + _sqlite3Fts5BufferSet(tls, p+60, bp, nToken, pToken) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + _sqlite3Fts5IterClose(tls, pNew) + break + } + pNewIter = pNew + 104 + if pPrev != 0 { + v2 = pPrev + 104 + } else { + v2 = uintptr(0) + } + pPrevIter = v2 + iLvl = 0 + for { + if !(iLvl < (*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel) { + break + } + iSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg - int32(1) + for { + if !(iSeg >= 0) { + break + } + pSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FaSeg + uintptr(iSeg)*56 + bDone = 0 + if pPrevIter != 0 { + if _fts5BufferCompare(tls, pSmall, pPrevIter+96) != 0 { + libc.Xmemcpy(tls, pNewIter, pPrevIter, uint64(128)) + libc.Xmemset(tls, pPrevIter, 0, uint64(128)) + bDone = int32(1) + } else { + if (*TFts5SegIter)(unsafe.Pointer(pPrevIter)).FiEndofDoclist > (*TFts5Data)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pPrevIter)).FpLeaf)).FszLeaf { + _fts5SegIterNextInit(tls, p, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn-int32(1), pSeg, pNewIter) + bDone = int32(1) + } + } + } + if bDone == 0 { + _fts5SegIterSeekInit(tls, p, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fp, (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn, flags, pSeg, pNewIter) + } + if pPrevIter != 0 { + if (*TFts5SegIter)(unsafe.Pointer(pPrevIter)).FpTombArray != 0 { + (*TFts5SegIter)(unsafe.Pointer(pNewIter)).FpTombArray = (*TFts5SegIter)(unsafe.Pointer(pPrevIter)).FpTombArray + (*TFts5TombstoneArray)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pNewIter)).FpTombArray)).FnRef++ + } + } else { + _fts5SegIterAllocTombstone(tls, p, pNewIter) + } + pNewIter += 128 + if pPrevIter != 0 { + pPrevIter += 128 + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + break + } + goto _4 + _4: + ; + iSeg-- + } + goto _3 + _3: + ; + iLvl++ + } + _fts5TokendataSetTermIfEof(tls, pPrev, pSmall) + (*TFts5Iter)(unsafe.Pointer(pNew)).FbSkipEmpty = uint8(1) + (*TFts5Iter)(unsafe.Pointer(pNew)).FpColset = pColset + _fts5IterSetOutputCb(tls, p+60, pNew) + /* Loop through all segments in the new iterator. Find the smallest + ** term that any segment-iterator points to. Iterator pNew will be + ** used for this term. Also, set any iterator that points to a term that + ** does not match pToken/nToken to point to EOF */ + pSmall = uintptr(0) + ii = 0 + for { + if !(ii < (*TFts5Iter)(unsafe.Pointer(pNew)).FnSeg) { + break + } + pII = pNew + 104 + uintptr(ii)*128 + if 0 == _fts5IsTokendataPrefix(tls, pII+96, pToken, nToken) { + _fts5SegIterSetEOF(tls, pII) + } + if (*TFts5SegIter)(unsafe.Pointer(pII)).FpLeaf != 0 && (!(pSmall != 0) || _fts5BufferCompare(tls, pSmall, pII+96) > 0) { + pSmall = pII + 96 + } + goto _5 + _5: + ; + ii++ + } + /* If pSmall is still NULL at this point, then the new iterator does + ** not point to any terms that match the query. So delete it and break + ** out of the loop - all required iterators have been collected. */ + if pSmall == uintptr(0) { + _sqlite3Fts5IterClose(tls, pNew) + break + } + /* Append this iterator to the set and continue. */ + pSet = _fts5AppendTokendataIter(tls, p, pSet, pNew) + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && pSet != 0 { + ii1 = 0 + for { + if !(ii1 < (*TFts5TokenDataIter)(unsafe.Pointer(pSet)).FnIter) { + break + } + pIter = *(*uintptr)(unsafe.Pointer(pSet + 40 + uintptr(ii1)*8)) + iSeg1 = 0 + for { + if !(iSeg1 < (*TFts5Iter)(unsafe.Pointer(pIter)).FnSeg) { + break + } + (*(*TFts5SegIter)(unsafe.Pointer(pIter + 104 + uintptr(iSeg1)*128))).Fflags |= int32(FTS5_SEGITER_ONETERM) + goto _7 + _7: + ; + iSeg1++ + } + _fts5MultiIterFinishSetup(tls, p, pIter) + goto _6 + _6: + ; + ii1++ + } + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pRet = _fts5MultiIterAlloc(tls, p, 0) + } + if pRet != 0 { + (*TFts5Iter)(unsafe.Pointer(pRet)).FpTokenDataIter = pSet + if pSet != 0 { + _fts5IterSetOutputsTokendata(tls, pRet) + } else { + (*TFts5Iter)(unsafe.Pointer(pRet)).Fbase.FbEof = uint8(1) + } + } else { + _fts5TokendataIterDelete(tls, pSet) + } + _fts5StructureRelease(tls, pStruct) + _sqlite3Fts5BufferFree(tls, bp) + return pRet +} + +// C documentation +// +// /* +// ** Open a new iterator to iterate though all rowid that match the +// ** specified token or token prefix. +// */ +func _sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int32, flags int32, pColset uintptr, ppIter uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bDesc, bTokendata, iIdx, iPrefixIdx, nChar, nIdxChar int32 + var pConfig, pSeg, pStruct uintptr + var _ /* buf at bp+8 */ TFts5Buffer + var _ /* pRet at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _ = bDesc, bTokendata, iIdx, iPrefixIdx, nChar, nIdxChar, pConfig, pSeg, pStruct + pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*TFts5Buffer)(unsafe.Pointer(bp + 8)) = TFts5Buffer{} + /* If the QUERY_SCAN flag is set, all other flags must be clear. */ + if _sqlite3Fts5BufferSize(tls, p+60, bp+8, uint32(nToken+int32(1))) == 0 { + iIdx = 0 /* Index to search */ + iPrefixIdx = 0 /* +1 prefix index */ + bTokendata = (*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata + if nToken > 0 { + libc.Xmemcpy(tls, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp+1, pToken, uint64(nToken)) + } + if flags&(libc.Int32FromInt32(FTS5INDEX_QUERY_NOTOKENDATA)|libc.Int32FromInt32(FTS5INDEX_QUERY_SCAN)) != 0 { + bTokendata = 0 + } + /* Figure out which index to search and set iIdx accordingly. If this + ** is a prefix query for which there is no prefix index, set iIdx to + ** greater than pConfig->nPrefix to indicate that the query will be + ** satisfied by scanning multiple terms in the main index. + ** + ** If the QUERY_TEST_NOIDX flag was specified, then this must be a + ** prefix-query. Instead of using a prefix-index (if one exists), + ** evaluate the prefix query using the main FTS index. This is used + ** for internal sanity checking by the integrity-check in debug + ** mode only. */ + if flags&int32(FTS5INDEX_QUERY_PREFIX) != 0 { + nChar = _fts5IndexCharlen(tls, pToken, nToken) + iIdx = int32(1) + for { + if !(iIdx <= (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix) { + break + } + nIdxChar = *(*int32)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr(iIdx-int32(1))*4)) + if nIdxChar == nChar { + break + } + if nIdxChar == nChar+int32(1) { + iPrefixIdx = iIdx + } + goto _1 + _1: + ; + iIdx++ + } + } + if bTokendata != 0 && iIdx == 0 { + *(*Tu8)(unsafe.Pointer((*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp)) = uint8('0') + *(*uintptr)(unsafe.Pointer(bp)) = _fts5SetupTokendataIter(tls, p, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, nToken+int32(1), pColset) + } else { + if iIdx <= (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix { + /* Straight index lookup */ + pStruct = _fts5StructureRead(tls, p) + *(*Tu8)(unsafe.Pointer((*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp)) = uint8(libc.Int32FromUint8('0') + iIdx) + if pStruct != 0 { + _fts5MultiIterNew(tls, p, pStruct, flags|int32(FTS5INDEX_QUERY_SKIPEMPTY), pColset, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, nToken+int32(1), -int32(1), 0, bp) + _fts5StructureRelease(tls, pStruct) + } + } else { + /* Scan multiple terms in the main index */ + bDesc = libc.BoolInt32(flags&int32(FTS5INDEX_QUERY_DESC) != 0) + _fts5SetupPrefixIter(tls, p, bDesc, iPrefixIdx, (*(*TFts5Buffer)(unsafe.Pointer(bp + 8))).Fp, nToken+int32(1), pColset, bp) + if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { + } else { + _fts5IterSetOutputCb(tls, p+60, *(*uintptr)(unsafe.Pointer(bp))) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pSeg = *(*uintptr)(unsafe.Pointer(bp)) + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FaFirst + 1*4))).FiFirst)*128 + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0 { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))).FxSetOutputs})))(tls, *(*uintptr)(unsafe.Pointer(bp)), pSeg) + } + } + } + } + } + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + _sqlite3Fts5IterClose(tls, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + _sqlite3Fts5IndexCloseReader(tls, p) + } + *(*uintptr)(unsafe.Pointer(ppIter)) = *(*uintptr)(unsafe.Pointer(bp)) + _sqlite3Fts5BufferFree(tls, bp+8) + } + return _fts5IndexReturn(tls, p) +} + +// C documentation +// +// /* +// ** Return true if the iterator passed as the only argument is at EOF. +// */ +// /* +// ** Move to the next matching rowid. +// */ +func _sqlite3Fts5IterNext(tls *libc.TLS, pIndexIter uintptr) (r int32) { + var pIter uintptr + _ = pIter + pIter = pIndexIter + if (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter != 0 { + _fts5TokendataIterNext(tls, pIter, 0, 0) + } else { + _fts5MultiIterNext(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, pIter, 0, 0) + } + return _fts5IndexReturn(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// C documentation +// +// /* +// ** Move to the next matching term/rowid. Used by the fts5vocab module. +// */ +func _sqlite3Fts5IterNextScan(tls *libc.TLS, pIndexIter uintptr) (r int32) { + var p, pIter, pSeg uintptr + _, _, _ = p, pIter, pSeg + pIter = pIndexIter + p = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex + _fts5MultiIterNext(tls, p, pIter, 0, 0) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pSeg = pIter + 104 + uintptr((*(*TFts5CResult)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4))).FiFirst)*128 + if (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0 && int32(*(*Tu8)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fp))) != int32('0') { + _fts5DataRelease(tls, (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf) + (*TFts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf = uintptr(0) + (*TFts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof = uint8(1) + } + } + return _fts5IndexReturn(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// C documentation +// +// /* +// ** Move to the next matching rowid that occurs at or after iMatch. The +// ** definition of "at or after" depends on whether this iterator iterates +// ** in ascending or descending rowid order. +// */ +func _sqlite3Fts5IterNextFrom(tls *libc.TLS, pIndexIter uintptr, iMatch Ti64) (r int32) { + var pIter uintptr + _ = pIter + pIter = pIndexIter + if (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter != 0 { + _fts5TokendataIterNext(tls, pIter, int32(1), iMatch) + } else { + _fts5MultiIterNextFrom(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex, pIter, iMatch) + } + return _fts5IndexReturn(tls, (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// C documentation +// +// /* +// ** Return the current term. +// */ +func _sqlite3Fts5IterTerm(tls *libc.TLS, pIndexIter uintptr, pn uintptr) (r uintptr) { + bp := tls.Alloc(16) + defer tls.Free(16) + var z, v1 uintptr + var _ /* n at bp+0 */ int32 + _, _ = z, v1 + z = _fts5MultiIterTerm(tls, pIndexIter, bp) + *(*int32)(unsafe.Pointer(pn)) = *(*int32)(unsafe.Pointer(bp)) - int32(1) + if z != 0 { + v1 = z + 1 + } else { + v1 = uintptr(0) + } + return v1 +} + +// C documentation +// +// /* +// ** This is used by xInstToken() to access the token at offset iOff, column +// ** iCol of row iRowid. The token is returned via output variables *ppOut +// ** and *pnOut. The iterator passed as the first argument must be a tokendata=1 +// ** iterator (pIter->pTokenDataIter!=0). +// */ +func _sqlite3Fts5IterToken(tls *libc.TLS, pIndexIter uintptr, iRowid Ti64, iCol int32, iOff int32, ppOut uintptr, pnOut uintptr) (r int32) { + var aMap, pIter, pMap, pT uintptr + var i1, i2, iTest int32 + var iPos Ti64 + _, _, _, _, _, _, _, _ = aMap, i1, i2, iPos, iTest, pIter, pMap, pT + pIter = pIndexIter + pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + aMap = (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FaMap + iPos = int64(iCol)< i1 { + iTest = (i1 + i2) / int32(2) + if (*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiRowid < iRowid { + i1 = iTest + int32(1) + } else { + if (*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiRowid > iRowid { + i2 = iTest + } else { + if (*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiPos < iPos { + if (*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiPos < 0 { + break + } + i1 = iTest + int32(1) + } else { + if (*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiPos > iPos { + i2 = iTest + } else { + break + } + } + } + } + } + if i2 > i1 { + pMap = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr((*(*TFts5TokenDataMap)(unsafe.Pointer(aMap + uintptr(iTest)*24))).FiIter)*8)) + *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*TFts5SegIter)(unsafe.Pointer(pMap + 104))).Fterm.Fp + uintptr(1) + *(*int32)(unsafe.Pointer(pnOut)) = (*(*TFts5SegIter)(unsafe.Pointer(pMap + 104))).Fterm.Fn - int32(1) + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** Clear any existing entries from the token-map associated with the +// ** iterator passed as the only argument. +// */ +func _sqlite3Fts5IndexIterClearTokendata(tls *libc.TLS, pIndexIter uintptr) { + var pIter uintptr + _ = pIter + pIter = pIndexIter + if pIter != 0 && (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter != 0 { + (*TFts5TokenDataIter)(unsafe.Pointer((*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter)).FnMap = 0 + } +} + +// C documentation +// +// /* +// ** Set a token-mapping for the iterator passed as the first argument. This +// ** is used in detail=column or detail=none mode when a token is requested +// ** using the xInstToken() API. In this case the caller tokenizers the +// ** current row and configures the token-mapping via multiple calls to this +// ** function. +// */ +func _sqlite3Fts5IndexIterWriteTokendata(tls *libc.TLS, pIndexIter uintptr, pToken uintptr, nToken int32, iRowid Ti64, iCol int32, iOff int32) (r int32) { + var ii int32 + var p, pIter, pT, pTerm uintptr + _, _, _, _, _ = ii, p, pIter, pT, pTerm + pIter = pIndexIter + pT = (*TFts5Iter)(unsafe.Pointer(pIter)).FpTokenDataIter + p = (*TFts5Iter)(unsafe.Pointer(pIter)).FpIndex + ii = 0 + for { + if !(ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter) { + break + } + pTerm = *(*uintptr)(unsafe.Pointer(pT + 40 + uintptr(ii)*8)) + 104 + 96 + if nToken == (*TFts5Buffer)(unsafe.Pointer(pTerm)).Fn-int32(1) && libc.Xmemcmp(tls, pToken, (*TFts5Buffer)(unsafe.Pointer(pTerm)).Fp+uintptr(1), uint64(nToken)) == 0 { + break + } + goto _1 + _1: + ; + ii++ + } + if ii < (*TFts5TokenDataIter)(unsafe.Pointer(pT)).FnIter { + _fts5TokendataIterAppendMap(tls, p, pT, ii, iRowid, int64(iCol)< int32(16) { + if int32(*(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pPg)).Fp))) == int32(4) { + v3 = int32(4) + } else { + v3 = int32(8) + } + v2 = ((*TFts5Data)(unsafe.Pointer(pPg)).Fnn - int32(8)) / v3 + } else { + v2 = int32(1) + } + nSlot = v2 + nElem = int32(_fts5GetU32(tls, (*TFts5Data)(unsafe.Pointer(pPg)).Fp+4)) + iSlot = int32(iRowid / uint64(nPg) % uint64(nSlot)) + nCollide = nSlot + if szKey == int32(4) && iRowid > uint64(0xFFFFFFFF) { + return int32(2) + } + if iRowid == uint64(0) { + *(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(pPg)).Fp + 1)) = uint8(0x01) + return 0 + } + if bForce == 0 && nElem >= nSlot/int32(2) { + return int32(1) + } + _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(pPg)).Fp+4, uint32(nElem+int32(1))) + if szKey == int32(4) { + aSlot = (*TFts5Data)(unsafe.Pointer(pPg)).Fp + 8 + for *(*Tu32)(unsafe.Pointer(aSlot + uintptr(iSlot)*4)) != 0 { + iSlot = (iSlot + int32(1)) % nSlot + v4 = nCollide + nCollide-- + if v4 == 0 { + return 0 + } + } + _fts5PutU32(tls, aSlot+uintptr(iSlot)*4, uint32(iRowid)) + } else { + aSlot1 = (*TFts5Data)(unsafe.Pointer(pPg)).Fp + 8 + for *(*Tu64)(unsafe.Pointer(aSlot1 + uintptr(iSlot)*8)) != 0 { + iSlot = (iSlot + int32(1)) % nSlot + v5 = nCollide + nCollide-- + if v5 == 0 { + return 0 + } + } + _fts5PutU64(tls, aSlot1+uintptr(iSlot)*8, iRowid) + } + return 0 +} + +// C documentation +// +// /* +// ** This function attempts to build a new hash containing all the keys +// ** currently in the tombstone hash table for segment pSeg. The new +// ** hash will be stored in the nOut buffers passed in array apOut[]. +// ** All pages of the new hash use key-size szKey (4 or 8). +// ** +// ** Return 0 if the hash is successfully rebuilt into the nOut pages. +// ** Or non-zero if it is not (because one page became overfull). In this +// ** case the caller should retry with a larger nOut parameter. +// ** +// ** Parameter pData1 is page iPg1 of the hash table being rebuilt. +// */ +func _fts5IndexTombstoneRehash(tls *libc.TLS, p uintptr, pSeg uintptr, pData1 uintptr, iPg1 int32, szKey int32, nOut int32, apOut uintptr) (r int32) { + var aSlot, aSlot1, pData, pFree, pPg, v3 uintptr + var iIn, ii, nSlotIn, res, szKeyIn, v4 int32 + var iVal Tu64 + _, _, _, _, _, _, _, _, _, _, _, _, _ = aSlot, aSlot1, iIn, iVal, ii, nSlotIn, pData, pFree, pPg, res, szKeyIn, v3, v4 + res = 0 + /* Initialize the headers of all the output pages */ + ii = 0 + for { + if !(ii < nOut) { + break + } + *(*Tu8)(unsafe.Pointer((*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp)) = uint8(szKey) + _fts5PutU32(tls, (*TFts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)))).Fp+4, uint32(0)) + goto _1 + _1: + ; + ii++ + } + /* Loop through the current pages of the hash table. */ + ii = 0 + for { + if !(res == 0 && ii < (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone) { + break + } + pData = uintptr(0) /* Page ii of the current hash table */ + pFree = uintptr(0) /* Free this at the end of the loop */ + if iPg1 == ii { + pData = pData1 + } else { + v3 = _fts5DataRead(tls, p, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid+libc.Int32FromInt32(1)< ((*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz-int32(8))/szKey { + v1 = MINSLOT + } else { + v1 = ((*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz - int32(8)) / szKey + } + nSlotPerPage = v1 + nSlot = 0 /* Number of slots in each output page */ + nOut = 0 + /* Figure out how many output pages (nOut) and how many slots per + ** page (nSlot). There are three possibilities: + ** + ** 1. The hash table does not yet exist. In this case the new hash + ** table will consist of a single page with MINSLOT slots. + ** + ** 2. The hash table exists but is currently a single page. In this + ** case an attempt is made to grow the page to accommodate the new + ** entry. The page is allowed to grow up to nSlotPerPage (see above) + ** slots. + ** + ** 3. The hash table already consists of more than one page, or of + ** a single page already so large that it cannot be grown. In this + ** case the new hash consists of (nPg*2+1) pages of nSlotPerPage + ** slots each, where nPg is the current number of pages in the + ** hash table. + */ + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone == 0 { + /* Case 1. */ + nOut = int32(1) + nSlot = MINSLOT + } else { + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone == int32(1) { + /* Case 2. */ + nElem = int32(_fts5GetU32(tls, (*TFts5Data)(unsafe.Pointer(pData1)).Fp+4)) + nOut = int32(1) + if nElem*int32(4) > MINSLOT { + v2 = nElem * int32(4) + } else { + v2 = MINSLOT + } + nSlot = v2 + if nSlot > nSlotPerPage { + nOut = 0 + } + } + } + if nOut == 0 { + /* Case 3. */ + nOut = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone*int32(2) + int32(1) + nSlot = nSlotPerPage + } + /* Allocate the required array and output pages */ + for int32(1) != 0 { + res = 0 + ii = 0 + szPage = 0 + apOut = uintptr(0) + /* Allocate space for the new hash table */ + apOut = _sqlite3Fts5MallocZero(tls, p+60, int64(uint64(8)*uint64(nOut))) + szPage = int32(8) + nSlot*szKey + ii = 0 + for { + if !(ii < nOut) { + break + } + pNew = _sqlite3Fts5MallocZero(tls, p+60, int64(uint64(16)+uint64(szPage))) + if pNew != 0 { + (*TFts5Data)(unsafe.Pointer(pNew)).Fnn = szPage + (*TFts5Data)(unsafe.Pointer(pNew)).Fp = pNew + 1*16 + *(*uintptr)(unsafe.Pointer(apOut + uintptr(ii)*8)) = pNew + } + goto _3 + _3: + ; + ii++ + } + /* Rebuild the hash table. */ + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + res = _fts5IndexTombstoneRehash(tls, p, pSeg, pData1, iPg1, szKey, nOut, apOut) + } + if res == 0 { + if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { + _fts5IndexFreeArray(tls, apOut, nOut) + apOut = uintptr(0) + nOut = 0 + } + *(*int32)(unsafe.Pointer(pnOut)) = nOut + *(*uintptr)(unsafe.Pointer(papOut)) = apOut + break + } + /* If control flows to here, it was not possible to rebuild the hash + ** table. Free all buffers and then try again with more pages. */ + _fts5IndexFreeArray(tls, apOut, nOut) + nSlot = nSlotPerPage + nOut = nOut*int32(2) + int32(1) + } +} + +// C documentation +// +// /* +// ** Add a tombstone for rowid iRowid to segment pSeg. +// */ +func _fts5IndexTombstoneAdd(tls *libc.TLS, p uintptr, pSeg uintptr, iRowid Tu64) { + bp := tls.Alloc(16) + defer tls.Free(16) + var iPg, ii, szKey, v1, v2 int32 + var iTombstoneRowid Ti64 + var pPg uintptr + var _ /* apHash at bp+8 */ uintptr + var _ /* nHash at bp+0 */ int32 + _, _, _, _, _, _, _ = iPg, iTombstoneRowid, ii, pPg, szKey, v1, v2 + pPg = uintptr(0) + iPg = -int32(1) + szKey = 0 + *(*int32)(unsafe.Pointer(bp)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + (*TFts5Index)(unsafe.Pointer(p)).FnContentlessDelete++ + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone > 0 { + iPg = int32(iRowid % uint64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnPgTombstone)) + pPg = _fts5DataRead(tls, p, int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid+libc.Int32FromInt32(1)< uint64(0xFFFFFFFF) { + szKey = int32(8) + } + /* Rebuild the hash table */ + _fts5IndexTombstoneRebuild(tls, p, pSeg, pPg, iPg, szKey, bp, bp+8) + /* If all has succeeded, write the new rowid into one of the new hash + ** table pages, then write them all out to disk. */ + if *(*int32)(unsafe.Pointer(bp)) != 0 { + ii = 0 + _fts5IndexTombstoneAddToPage(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(iRowid%uint64(*(*int32)(unsafe.Pointer(bp))))*8)), int32(1), *(*int32)(unsafe.Pointer(bp)), iRowid) + ii = 0 + for { + if !(ii < *(*int32)(unsafe.Pointer(bp))) { + break + } + iTombstoneRowid = int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid+libc.Int32FromInt32(1)<= 0) { + break + } + iSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FnSeg - int32(1) + for { + if !(iSeg >= 0) { + break + } + pSeg = (*(*TFts5StructureLevel)(unsafe.Pointer(pStruct + 32 + uintptr(iLvl)*16))).FaSeg + uintptr(iSeg)*56 + if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin1 <= uint64(iOrigin) && (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiOrigin2 >= uint64(iOrigin) { + if bFound == 0 { + (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FnEntryTombstone++ + bFound = int32(1) + } + _fts5IndexTombstoneAdd(tls, p, pSeg, uint64(iRowid)) + } + goto _2 + _2: + ; + iSeg-- + } + goto _1 + _1: + ; + iLvl-- + } + _fts5StructureRelease(tls, pStruct) + } + return _fts5IndexReturn(tls, p) +} + +/************************************************************************* +************************************************************************** +** Below this point is the implementation of the integrity-check +** functionality. + */ + +// C documentation +// +// /* +// ** Return a simple checksum value based on the arguments. +// */ +func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos int32, iIdx int32, pTerm uintptr, nTerm int32) (r Tu64) { + var i int32 + var ret Tu64 + _, _ = i, ret + ret = uint64(iRowid) + ret += ret<= 0 { + ret += ret<= (*TFts5Data)(unsafe.Pointer(pLeaf)).Fnn) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= iNoRowid && 0 != int32(_fts5GetU16(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp)) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= int64((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< int64((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< (*(*TFts5Buffer)(unsafe.Pointer(bp))).Fn || iOff+int64(*(*int32)(unsafe.Pointer(bp + 44))) > int64((*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= iOff || iOff >= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< 0 { + iDlRowid = _fts5DlidxIterRowid(tls, pDlidx) + _sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr(iRowidOff1), bp+16) + if *(*Ti64)(unsafe.Pointer(bp + 16)) < iDlRowid || bSecureDelete == 0 && *(*Ti64)(unsafe.Pointer(bp + 16)) != iDlRowid { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<> libc.Int32FromInt32(32)) + iTokOff = int32(*(*Ti64)(unsafe.Pointer(bp + 32)) & libc.Int64FromInt32(0x7FFFFFFF)) + cksum2 ^= _sqlite3Fts5IndexEntryCksum(tls, iRowid, iCol, iTokOff, -int32(1), z, *(*int32)(unsafe.Pointer(bp + 24))) + } + } + goto _3 + _3: + ; + _fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16)), 0, 0) + } + _fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16))) + if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && bUseCksum != 0 && cksum != cksum2 { + (*TFts5Index)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< FROM ORDER BY +rank; +** +** aIdx[]: +** There is one entry in the aIdx[] array for each phrase in the query, +** the value of which is the offset within aPoslist[] following the last +** byte of the position list for the corresponding phrase. + */ +type TFts5Sorter1 = struct { + FpStmt uintptr + FiRowid Ti64 + FaPoslist uintptr + FnIdx int32 + FaIdx [1]int32 +} + +type Fts5Sorter1 = TFts5Sorter1 + +/* +** Virtual-table cursor object. +** +** iSpecial: +** If this is a 'special' query (refer to function fts5SpecialMatch()), +** then this variable contains the result of the query. +** +** iFirstRowid, iLastRowid: +** These variables are only used for FTS5_PLAN_MATCH cursors. Assuming the +** cursor iterates in ascending order of rowids, iFirstRowid is the lower +** limit of rowids to return, and iLastRowid the upper. In other words, the +** WHERE clause in the user's query might have been: +** +** MATCH AND rowid BETWEEN $iFirstRowid AND $iLastRowid +** +** If the cursor iterates in descending order of rowid, iFirstRowid +** is the upper limit (i.e. the "first" rowid visited) and iLastRowid +** the lower. + */ +type TFts5Cursor1 = struct { + Fbase Tsqlite3_vtab_cursor + FpNext uintptr + FaColumnSize uintptr + FiCsrId Ti64 + FePlan int32 + FbDesc int32 + FiFirstRowid Ti64 + FiLastRowid Ti64 + FpStmt uintptr + FpExpr uintptr + FpSorter uintptr + Fcsrflags int32 + FiSpecial Ti64 + FzRank uintptr + FzRankArgs uintptr + FpRank uintptr + FnRankArg int32 + FapRankArg uintptr + FpRankArgStmt uintptr + FpAux uintptr + FpAuxdata uintptr + FaInstIter uintptr + FnInstAlloc int32 + FnInstCount int32 + FaInst uintptr +} + +type Fts5Cursor1 = TFts5Cursor1 + +/* +** Bits that make up the "idxNum" parameter passed indirectly by +** xBestIndex() to xFilter(). + */ + +/* +** Values for Fts5Cursor.csrflags + */ + +/* +** Macros to Set(), Clear() and Test() cursor flags. + */ + +type TFts5Auxdata1 = struct { + FpAux uintptr + FpPtr uintptr + FxDelete uintptr + FpNext uintptr +} + +type Fts5Auxdata1 = TFts5Auxdata1 + +// C documentation +// +// /* +// ** Return true if pTab is a contentless table. +// */ +func _fts5IsContentless(tls *libc.TLS, pTab uintptr) (r int32) { + return libc.BoolInt32((*TFts5Config)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FeContent == int32(FTS5_CONTENT_NONE)) +} + +// C documentation +// +// /* +// ** Delete a virtual table handle allocated by fts5InitVtab(). +// */ +func _fts5FreeVtab(tls *libc.TLS, pTab uintptr) { + if pTab != 0 { + _sqlite3Fts5IndexClose(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + _sqlite3Fts5StorageClose(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + _sqlite3Fts5ConfigFree(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig) + Xsqlite3_free(tls, pTab) + } +} + +// C documentation +// +// /* +// ** The xDisconnect() virtual table method. +// */ +func _fts5DisconnectMethod(tls *libc.TLS, pVtab uintptr) (r int32) { + _fts5FreeVtab(tls, pVtab) + return SQLITE_OK +} + +// C documentation +// +// /* +// ** The xDestroy() virtual table method. +// */ +func _fts5DestroyMethod(tls *libc.TLS, pVtab uintptr) (r int32) { + var pTab uintptr + var rc int32 + _, _ = pTab, rc + pTab = pVtab + rc = _sqlite3Fts5DropAll(tls, (*TFts5Table)(unsafe.Pointer(pTab)).FpConfig) + if rc == SQLITE_OK { + _fts5FreeVtab(tls, pVtab) + } + return rc +} + +// C documentation +// +// /* +// ** This function is the implementation of both the xConnect and xCreate +// ** methods of the FTS3 virtual table. +// ** +// ** The argv[] array contains the following: +// ** +// ** argv[0] -> module name ("fts5") +// ** argv[1] -> database name +// ** argv[2] -> table name +// ** argv[...] -> "column name" and other module argument fields. +// */ +func _fts5InitVtab(tls *libc.TLS, bCreate int32, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var azConfig, pGlobal, pTab uintptr + var _ /* pConfig at bp+8 */ uintptr + var _ /* rc at bp+0 */ int32 + _, _, _ = azConfig, pGlobal, pTab + pGlobal = pAux + azConfig = argv + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* Return code */ + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) /* Results of parsing argc/argv */ + pTab = uintptr(0) /* New virtual table object */ + /* Allocate the new vtab object and parse the configuration */ + pTab = _sqlite3Fts5MallocZero(tls, bp, int64(72)) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5ConfigParse(tls, pGlobal, db, argc, azConfig, bp+8, pzErr) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig = *(*uintptr)(unsafe.Pointer(bp + 8)) + (*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal = pGlobal + } + /* Open the index sub-system */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), bCreate, pTab+32, pzErr) + } + /* Open the storage sub-system */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5StorageOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, bCreate, pTab+40, pzErr) + } + /* Call sqlite3_declare_vtab() */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5ConfigDeclareVtab(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + /* Load the initial configuration */ + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + (*TFts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpzErrmsg = pzErr + *(*int32)(unsafe.Pointer(bp)) = _sqlite3Fts5IndexLoadConfig(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + _sqlite3Fts5IndexRollback(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + (*TFts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FpzErrmsg = uintptr(0) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FeContent == FTS5_CONTENT_NORMAL { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_CONSTRAINT_SUPPORT), libc.VaList(bp+24, libc.Int32FromInt32(1))) + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_INNOCUOUS), 0) + } + if *(*int32)(unsafe.Pointer(bp)) != SQLITE_OK { + _fts5FreeVtab(tls, pTab) + pTab = uintptr(0) + } else { + if bCreate != 0 { + } + } + *(*uintptr)(unsafe.Pointer(ppVTab)) = pTab + return *(*int32)(unsafe.Pointer(bp)) +} + +// C documentation +// +// /* +// ** The xConnect() and xCreate() methods for the virtual table. All the +// ** work is done in function fts5InitVtab(). +// */ +func _fts5ConnectMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + return _fts5InitVtab(tls, 0, db, pAux, argc, argv, ppVtab, pzErr) +} + +func _fts5CreateMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { + return _fts5InitVtab(tls, int32(1), db, pAux, argc, argv, ppVtab, pzErr) +} + +/* +** The different query plans. + */ + +// C documentation +// +// /* +// ** Set the SQLITE_INDEX_SCAN_UNIQUE flag in pIdxInfo->flags. Unless this +// ** extension is currently being used by a version of SQLite too old to +// ** support index-info flags. In that case this function is a no-op. +// */ +func _fts5SetUniqueFlag(tls *libc.TLS, pIdxInfo uintptr) { + *(*int32)(unsafe.Pointer(pIdxInfo + 80)) |= int32(SQLITE_INDEX_SCAN_UNIQUE) +} + +func _fts5UsePatternMatch(tls *libc.TLS, pConfig uintptr, p uintptr) (r int32) { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern == int32(FTS5_PATTERN_GLOB) && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_GLOB) { + return int32(1) + } + if (*TFts5Config)(unsafe.Pointer(pConfig)).FePattern == int32(FTS5_PATTERN_LIKE) && (int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_LIKE) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_GLOB)) { + return int32(1) + } + return 0 +} + +// C documentation +// +// /* +// ** Implementation of the xBestIndex method for FTS5 tables. Within the +// ** WHERE constraint, it searches for the following: +// ** +// ** 1. A MATCH constraint against the table column. +// ** 2. A MATCH constraint against the "rank" column. +// ** 3. A MATCH constraint against some other column. +// ** 4. An == constraint against the rowid column. +// ** 5. A < or <= constraint against the rowid column. +// ** 6. A > or >= constraint against the rowid column. +// ** +// ** Within the ORDER BY, the following are supported: +// ** +// ** 5. ORDER BY rank [ASC|DESC] +// ** 6. ORDER BY rowid [ASC|DESC] +// ** +// ** Information for the xFilter call is passed via both the idxNum and +// ** idxStr variables. Specifically, idxNum is a bitmask of the following +// ** flags used to encode the ORDER BY clause: +// ** +// ** FTS5_BI_ORDER_RANK +// ** FTS5_BI_ORDER_ROWID +// ** FTS5_BI_ORDER_DESC +// ** +// ** idxStr is used to encode data from the WHERE clause. For each argument +// ** passed to the xFilter method, the following is appended to idxStr: +// ** +// ** Match against table column: "m" +// ** Match against rank column: "r" +// ** Match against other column: "M" +// ** LIKE against other column: "L" +// ** GLOB against other column: "G" +// ** Equality constraint against the rowid: "=" +// ** A < or <= against the rowid: "<" +// ** A > or >= against the rowid: ">" +// ** +// ** This function ensures that there is at most one "r" or "=". And that if +// ** there exists an "=" then there is no "<" or ">". +// ** +// ** Costs are assigned as follows: +// ** +// ** a) If an unusable MATCH operator is present in the WHERE clause, the +// ** cost is unconditionally set to 1e50 (a really big number). +// ** +// ** a) If a MATCH operator is present, the cost depends on the other +// ** constraints also present. As follows: +// ** +// ** * No other constraints: cost=1000.0 +// ** * One rowid range constraint: cost=750.0 +// ** * Both rowid range constraints: cost=500.0 +// ** * An == rowid constraint: cost=100.0 +// ** +// ** b) Otherwise, if there is no MATCH: +// ** +// ** * No other constraints: cost=1000000.0 +// ** * One rowid range constraint: cost=750000.0 +// ** * Both rowid range constraints: cost=250000.0 +// ** * An == rowid constraint: cost=10.0 +// ** +// ** Costs are not modified by the ORDER BY clause. +// */ +func _fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var bSeenEq, bSeenGt, bSeenLt, bSeenMatch, bSeenRank, i, iCol, iCons, iIdxStr, iSort, idxFlags, nCol, op, v11, v12, v13, v14, v2, v3, v4, v5, v6, v7, v8, v9 int32 + var idxStr, p, p1, pConfig, pTab uintptr + var v15, v16, v17, v18 float64 + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bSeenEq, bSeenGt, bSeenLt, bSeenMatch, bSeenRank, i, iCol, iCons, iIdxStr, iSort, idxFlags, idxStr, nCol, op, p, p1, pConfig, pTab, v11, v12, v13, v14, v15, v16, v17, v18, v2, v3, v4, v5, v6, v7, v8, v9 + pTab = pVTab + pConfig = (*TFts5Table)(unsafe.Pointer(pTab)).FpConfig + nCol = (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol + idxFlags = 0 + iIdxStr = 0 + iCons = 0 + bSeenEq = 0 + bSeenGt = 0 + bSeenLt = 0 + bSeenMatch = 0 + bSeenRank = 0 + if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { + (*TFts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36836, 0) + return int32(SQLITE_ERROR) + } + idxStr = Xsqlite3_malloc(tls, (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint*int32(8)+int32(1)) + if idxStr == uintptr(0) { + return int32(SQLITE_NOMEM) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FidxStr = idxStr + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FneedToFreeIdxStr = int32(1) + i = 0 + for { + if !(i < (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint) { + break + } + p = (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint + uintptr(i)*12 + iCol = (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_MATCH) || int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) && iCol >= nCol { + /* A MATCH operator or equivalent */ + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) == 0 || iCol < 0 { + /* As there exists an unusable MATCH constraint this is an + ** unusable plan. Set a prohibitively high cost. */ + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(1e+50) + *(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr))) = 0 + return SQLITE_OK + } else { + if iCol == nCol+int32(1) { + if bSeenRank != 0 { + goto _1 + } + v2 = iIdxStr + iIdxStr++ + *(*int8)(unsafe.Pointer(idxStr + uintptr(v2))) = int8('r') + bSeenRank = int32(1) + } else { + if iCol >= 0 { + bSeenMatch = int32(1) + v3 = iIdxStr + iIdxStr++ + *(*int8)(unsafe.Pointer(idxStr + uintptr(v3))) = int8('M') + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5170, libc.VaList(bp+8, iCol)) + idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) + } + } + iCons++ + v4 = iCons + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v4 + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).Fomit = uint8(1) + } + } else { + if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0 { + if iCol >= 0 && iCol < nCol && _fts5UsePatternMatch(tls, pConfig, p) != 0 { + v5 = iIdxStr + iIdxStr++ + if int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(FTS5_PATTERN_LIKE) { + v6 = int32('L') + } else { + v6 = int32('G') + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(v5))) = int8(v6) + Xsqlite3_snprintf(tls, int32(6), idxStr+uintptr(iIdxStr), __ccgo_ts+5170, libc.VaList(bp+8, iCol)) + idxStr += uintptr(libc.Xstrlen(tls, idxStr+uintptr(iIdxStr))) + iCons++ + v7 = iCons + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v7 + } else { + if bSeenEq == 0 && int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) && iCol < 0 { + v8 = iIdxStr + iIdxStr++ + *(*int8)(unsafe.Pointer(idxStr + uintptr(v8))) = int8('=') + bSeenEq = int32(1) + iCons++ + v9 = iCons + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v9 + } + } + } + } + goto _1 + _1: + ; + i++ + } + if bSeenEq == 0 { + i = 0 + for { + if !(i < (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint) { + break + } + p1 = (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint + uintptr(i)*12 + if (*Tsqlite3_index_constraint)(unsafe.Pointer(p1)).FiColumn < 0 && (*Tsqlite3_index_constraint)(unsafe.Pointer(p1)).Fusable != 0 { + op = int32((*Tsqlite3_index_constraint)(unsafe.Pointer(p1)).Fop) + if op == int32(SQLITE_INDEX_CONSTRAINT_LT) || op == int32(SQLITE_INDEX_CONSTRAINT_LE) { + if bSeenLt != 0 { + goto _10 + } + v11 = iIdxStr + iIdxStr++ + *(*int8)(unsafe.Pointer(idxStr + uintptr(v11))) = int8('<') + iCons++ + v12 = iCons + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v12 + bSeenLt = int32(1) + } else { + if op == int32(SQLITE_INDEX_CONSTRAINT_GT) || op == int32(SQLITE_INDEX_CONSTRAINT_GE) { + if bSeenGt != 0 { + goto _10 + } + v13 = iIdxStr + iIdxStr++ + *(*int8)(unsafe.Pointer(idxStr + uintptr(v13))) = int8('>') + iCons++ + v14 = iCons + (*(*Tsqlite3_index_constraint_usage)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8))).FargvIndex = v14 + bSeenGt = int32(1) + } + } + } + goto _10 + _10: + ; + i++ + } + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr))) = int8('\000') + /* Set idxFlags flags for the ORDER BY clause + ** + ** Note that tokendata=1 tables cannot currently handle "ORDER BY rowid DESC". + */ + if (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FnOrderBy == int32(1) { + iSort = (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy))).FiColumn + if iSort == (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol+int32(1) && bSeenMatch != 0 { + idxFlags |= int32(FTS5_BI_ORDER_RANK) + } else { + if iSort == -int32(1) && (!((*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy))).Fdesc != 0) || !((*TFts5Config)(unsafe.Pointer(pConfig)).FbTokendata != 0)) { + idxFlags |= int32(FTS5_BI_ORDER_ROWID) + } + } + if idxFlags&(libc.Int32FromInt32(FTS5_BI_ORDER_RANK)|libc.Int32FromInt32(FTS5_BI_ORDER_ROWID)) != 0 { + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).ForderByConsumed = int32(1) + if (*(*Tsqlite3_index_orderby)(unsafe.Pointer((*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy))).Fdesc != 0 { + idxFlags |= int32(FTS5_BI_ORDER_DESC) + } + } + } + /* Calculate the estimated cost based on the flags set in idxFlags. */ + if bSeenEq != 0 { + if bSeenMatch != 0 { + v15 = float64(100) + } else { + v15 = float64(10) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = v15 + if bSeenMatch == 0 { + _fts5SetUniqueFlag(tls, pInfo) + } + } else { + if bSeenLt != 0 && bSeenGt != 0 { + if bSeenMatch != 0 { + v16 = float64(500) + } else { + v16 = float64(250000) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = v16 + } else { + if bSeenLt != 0 || bSeenGt != 0 { + if bSeenMatch != 0 { + v17 = float64(750) + } else { + v17 = float64(750000) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = v17 + } else { + if bSeenMatch != 0 { + v18 = float64(1000) + } else { + v18 = float64(1e+06) + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = v18 + } + } + } + (*Tsqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = idxFlags + return SQLITE_OK +} + +func _fts5NewTransaction(tls *libc.TLS, pTab uintptr) (r int32) { + var pCsr uintptr + _ = pCsr + pCsr = (*TFts5Global)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpCsr + for { + if !(pCsr != 0) { + break + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab == pTab { + return SQLITE_OK + } + goto _1 + _1: + ; + pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext + } + return _sqlite3Fts5StorageReset(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage) +} + +// C documentation +// +// /* +// ** Implementation of xOpen method. +// */ +func _fts5OpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) (r int32) { + var nByte Tsqlite3_int64 + var pConfig, pCsr, pGlobal, pTab, v2 uintptr + var rc int32 + var v1 Ti64 + _, _, _, _, _, _, _, _ = nByte, pConfig, pCsr, pGlobal, pTab, rc, v1, v2 + pTab = pVTab + pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + pCsr = uintptr(0) /* Return code */ + rc = _fts5NewTransaction(tls, pTab) + if rc == SQLITE_OK { + nByte = int64(uint64(184) + uint64((*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*uint64(4)) + pCsr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pCsr != 0 { + pGlobal = (*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal + libc.Xmemset(tls, pCsr, 0, uint64(nByte)) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize = pCsr + 1*184 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext = (*TFts5Global)(unsafe.Pointer(pGlobal)).FpCsr + (*TFts5Global)(unsafe.Pointer(pGlobal)).FpCsr = pCsr + v2 = pGlobal + 40 + *(*Ti64)(unsafe.Pointer(v2))++ + v1 = *(*Ti64)(unsafe.Pointer(v2)) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId = v1 + } else { + rc = int32(SQLITE_NOMEM) + } + } + *(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr + return rc +} + +func _fts5StmtType(tls *libc.TLS, pCsr uintptr) (r int32) { + var v1 int32 + _ = v1 + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == int32(FTS5_PLAN_SCAN) { + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FbDesc != 0 { + v1 = int32(FTS5_STMT_SCAN_DESC) + } else { + v1 = FTS5_STMT_SCAN_ASC + } + return v1 + } + return int32(FTS5_STMT_LOOKUP) +} + +// C documentation +// +// /* +// ** This function is called after the cursor passed as the only argument +// ** is moved to point at a different row. It clears all cached data +// ** specific to the previous row stored by the cursor object. +// */ +func _fts5CsrNewrow(tls *libc.TLS, pCsr uintptr) { + *(*int32)(unsafe.Pointer(pCsr + 80)) |= libc.Int32FromInt32(FTS5CSR_REQUIRE_CONTENT) | libc.Int32FromInt32(FTS5CSR_REQUIRE_DOCSIZE) | libc.Int32FromInt32(FTS5CSR_REQUIRE_INST) | libc.Int32FromInt32(FTS5CSR_REQUIRE_POSLIST) +} + +func _fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { + var eStmt int32 + var pData, pNext, pSorter, pTab uintptr + _, _, _, _, _ = eStmt, pData, pNext, pSorter, pTab + pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + Xsqlite3_free(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaInstIter) + Xsqlite3_free(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaInst) + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt != 0 { + eStmt = _fts5StmtType(tls, pCsr) + _sqlite3Fts5StorageStmtRelease(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, eStmt, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { + pSorter = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + Xsqlite3_finalize(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + Xsqlite3_free(tls, pSorter) + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != int32(FTS5_PLAN_SOURCE) { + _sqlite3Fts5ExprFree(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + } + pData = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata + for { + if !(pData != 0) { + break + } + pNext = (*TFts5Auxdata)(unsafe.Pointer(pData)).FpNext + if (*TFts5Auxdata)(unsafe.Pointer(pData)).FxDelete != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TFts5Auxdata)(unsafe.Pointer(pData)).FxDelete})))(tls, (*TFts5Auxdata)(unsafe.Pointer(pData)).FpPtr) + } + Xsqlite3_free(tls, pData) + goto _1 + _1: + ; + pData = pNext + } + Xsqlite3_finalize(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) + Xsqlite3_free(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg) + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_FREE_ZRANK) != 0 { + Xsqlite3_free(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank) + Xsqlite3_free(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs) + } + _sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + libc.Xmemset(tls, pCsr+32, 0, uint64(184)-uint64(int64(pCsr+32)-int64(pCsr))) +} + +// C documentation +// +// /* +// ** Close the cursor. For additional information see the documentation +// ** on the xClose method of the virtual table interface. +// */ +func _fts5CloseMethod(tls *libc.TLS, pCursor uintptr) (r int32) { + var pCsr, pTab, pp uintptr + _, _, _ = pCsr, pTab, pp + if pCursor != 0 { + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + pCsr = pCursor + _fts5FreeCursorComponents(tls, pCsr) + /* Remove the cursor from the Fts5Global.pCsr list */ + pp = (*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal + 72 + for { + if !(*(*uintptr)(unsafe.Pointer(pp)) != pCsr) { + break + } + goto _1 + _1: + ; + pp = *(*uintptr)(unsafe.Pointer(pp)) + 8 + } + *(*uintptr)(unsafe.Pointer(pp)) = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext + Xsqlite3_free(tls, pCsr) + } + return SQLITE_OK +} + +func _fts5SorterNext(tls *libc.TLS, pCsr uintptr) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var a, aBlob, pSorter, v1 uintptr + var i, iOff, nBlob, rc int32 + var _ /* iVal at bp+0 */ int32 + _, _, _, _, _, _, _, _ = a, aBlob, i, iOff, nBlob, pSorter, rc, v1 + pSorter = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + rc = Xsqlite3_step(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + if rc == int32(SQLITE_DONE) { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pCsr + 80)) |= libc.Int32FromInt32(FTS5CSR_EOF) | libc.Int32FromInt32(FTS5CSR_REQUIRE_CONTENT) + } else { + if rc == int32(SQLITE_ROW) { + iOff = 0 + rc = SQLITE_OK + (*TFts5Sorter)(unsafe.Pointer(pSorter)).FiRowid = Xsqlite3_column_int64(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, 0) + nBlob = Xsqlite3_column_bytes(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, int32(1)) + v1 = Xsqlite3_column_blob(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, int32(1)) + a = v1 + aBlob = v1 + /* nBlob==0 in detail=none mode. */ + if nBlob > 0 { + i = 0 + for { + if !(i < (*TFts5Sorter)(unsafe.Pointer(pSorter)).FnIdx-int32(1)) { + break + } + a += uintptr(_sqlite3Fts5GetVarint32(tls, a, bp)) + iOff += *(*int32)(unsafe.Pointer(bp)) + *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = iOff + goto _2 + _2: + ; + i++ + } + *(*int32)(unsafe.Pointer(pSorter + 28 + uintptr(i)*4)) = int32(t__predefined_ptrdiff_t(aBlob+uintptr(nBlob)) - int64(a)) + (*TFts5Sorter)(unsafe.Pointer(pSorter)).FaPoslist = a + } + _fts5CsrNewrow(tls, pCsr) + } + } + return rc +} + +// C documentation +// +// /* +// ** Set the FTS5CSR_REQUIRE_RESEEK flag on all FTS5_PLAN_MATCH cursors +// ** open on table pTab. +// */ +func _fts5TripCursors(tls *libc.TLS, pTab uintptr) { + var pCsr uintptr + _ = pCsr + pCsr = (*TFts5Global)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpCsr + for { + if !(pCsr != 0) { + break + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == int32(FTS5_PLAN_MATCH) && (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab == pTab { + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_REQUIRE_RESEEK) + } + goto _1 + _1: + ; + pCsr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpNext + } +} + +// C documentation +// +// /* +// ** If the REQUIRE_RESEEK flag is set on the cursor passed as the first +// ** argument, close and reopen all Fts5IndexIter iterators that the cursor +// ** is using. Then attempt to move the cursor to a rowid equal to or laster +// ** (in the cursors sort order - ASC or DESC) than the current rowid. +// ** +// ** If the new rowid is not equal to the old, set output parameter *pbSkip +// ** to 1 before returning. Otherwise, leave it unchanged. +// ** +// ** Return SQLITE_OK if successful or if no reseek was required, or an +// ** error code if an error occurred. +// */ +func _fts5CursorReseek(tls *libc.TLS, pCsr uintptr, pbSkip uintptr) (r int32) { + var bDesc, rc int32 + var iRowid Ti64 + var pTab uintptr + _, _, _, _ = bDesc, iRowid, pTab, rc + rc = SQLITE_OK + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_REQUIRE_RESEEK) != 0 { + pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + bDesc = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FbDesc + iRowid = _sqlite3Fts5ExprRowid(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + rc = _sqlite3Fts5ExprFirst(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, iRowid, bDesc) + if rc == SQLITE_OK && iRowid != _sqlite3Fts5ExprRowid(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) { + *(*int32)(unsafe.Pointer(pbSkip)) = int32(1) + } + *(*int32)(unsafe.Pointer(pCsr + 80)) &= ^libc.Int32FromInt32(FTS5CSR_REQUIRE_RESEEK) + _fts5CsrNewrow(tls, pCsr) + if _sqlite3Fts5ExprEof(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) != 0 { + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_EOF) + *(*int32)(unsafe.Pointer(pbSkip)) = int32(1) + } + } + return rc +} + +// C documentation +// +// /* +// ** Advance the cursor to the next row in the table that matches the +// ** search criteria. +// ** +// ** Return SQLITE_OK if nothing goes wrong. SQLITE_OK is returned +// ** even if we reach end-of-file. The fts5EofMethod() will be called +// ** subsequently to determine whether or not an EOF was hit. +// */ +func _fts5NextMethod(tls *libc.TLS, pCursor uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var pConfig, pCsr uintptr + var rc, v1 int32 + var _ /* bSkip at bp+0 */ int32 + _, _, _, _ = pConfig, pCsr, rc, v1 + pCsr = pCursor + /* If this cursor uses FTS5_PLAN_MATCH and this is a tokendata=1 table, + ** clear any token mappings accumulated at the fts5_index.c level. In + ** other cases, specifically FTS5_PLAN_SOURCE and FTS5_PLAN_SORTED_MATCH, + ** we need to retain the mappings for the entire query. */ + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == int32(FTS5_PLAN_MATCH) && (*TFts5Config)(unsafe.Pointer((*TFts5Table)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FpConfig)).FbTokendata != 0 { + _sqlite3Fts5ExprClearTokens(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan < int32(3) { + *(*int32)(unsafe.Pointer(bp)) = 0 + v1 = _fts5CursorReseek(tls, pCsr, bp) + rc = v1 + if v1 != 0 || *(*int32)(unsafe.Pointer(bp)) != 0 { + return rc + } + rc = _sqlite3Fts5ExprNext(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid) + *(*int32)(unsafe.Pointer(pCsr + 80)) |= _sqlite3Fts5ExprEof(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + _fts5CsrNewrow(tls, pCsr) + } else { + switch (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan { + case int32(FTS5_PLAN_SPECIAL): + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_EOF) + rc = SQLITE_OK + case int32(FTS5_PLAN_SORTED_MATCH): + rc = _fts5SorterNext(tls, pCsr) + default: + pConfig = (*TFts5Table)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FpConfig + (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock++ + rc = Xsqlite3_step(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock-- + if rc != int32(SQLITE_ROW) { + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_EOF) + rc = Xsqlite3_reset(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + if rc != SQLITE_OK { + (*Tsqlite3_vtab)(unsafe.Pointer((*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) + } + } else { + rc = SQLITE_OK + } + break + } + } + return rc +} + +func _fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt uintptr, va uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var ap Tva_list + var rc int32 + var zSql uintptr + var _ /* pRet at bp+0 */ uintptr + _, _, _ = ap, rc, zSql + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if zSql == uintptr(0) { + rc = int32(SQLITE_NOMEM) + } else { + rc = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp, uintptr(0)) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3827, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb))) + } + Xsqlite3_free(tls, zSql) + } + _ = ap + *(*uintptr)(unsafe.Pointer(ppStmt)) = *(*uintptr)(unsafe.Pointer(bp)) + return rc +} + +func _fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) (r int32) { + bp := tls.Alloc(64) + defer tls.Free(64) + var nByte Tsqlite3_int64 + var nPhrase, rc int32 + var pConfig, pSorter, zRank, zRankArgs, v1, v2, v3 uintptr + _, _, _, _, _, _, _, _, _, _ = nByte, nPhrase, pConfig, pSorter, rc, zRank, zRankArgs, v1, v2, v3 + pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank + zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs + nPhrase = _sqlite3Fts5ExprPhraseCount(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + nByte = int64(uint64(32) + uint64(4)*uint64(nPhrase-libc.Int32FromInt32(1))) + pSorter = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSorter == uintptr(0) { + return int32(SQLITE_NOMEM) + } + libc.Xmemset(tls, pSorter, 0, uint64(nByte)) + (*TFts5Sorter)(unsafe.Pointer(pSorter)).FnIdx = nPhrase + /* TODO: It would be better to have some system for reusing statement + ** handles here, rather than preparing a new one for each query. But that + ** is not possible as SQLite reference counts the virtual table objects. + ** And since the statement required here reads from this very virtual + ** table, saving it creates a circular reference. + ** + ** If SQLite a built-in statement cache, this wouldn't be a problem. */ + if zRankArgs != 0 { + v1 = __ccgo_ts + 15022 + } else { + v1 = __ccgo_ts + 1680 + } + if zRankArgs != 0 { + v2 = zRankArgs + } else { + v2 = __ccgo_ts + 1680 + } + if bDesc != 0 { + v3 = __ccgo_ts + 36875 + } else { + v3 = __ccgo_ts + 36880 + } + rc = _fts5PrepareStatement(tls, pSorter, pConfig, __ccgo_ts+36884, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, v1, v2, v3)) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter + if rc == SQLITE_OK { + (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr + rc = _fts5SorterNext(tls, pCsr) + (*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = uintptr(0) + } + if rc != SQLITE_OK { + Xsqlite3_finalize(tls, (*TFts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + Xsqlite3_free(tls, pSorter) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = uintptr(0) + } + return rc +} + +func _fts5CursorFirst(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) (r int32) { + var pExpr uintptr + var rc int32 + _, _ = pExpr, rc + pExpr = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr + rc = _sqlite3Fts5ExprFirst(tls, pExpr, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid, bDesc) + if _sqlite3Fts5ExprEof(tls, pExpr) != 0 { + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_EOF) + } + _fts5CsrNewrow(tls, pCsr) + return rc +} + +// C documentation +// +// /* +// ** Process a "special" query. A special query is identified as one with a +// ** MATCH expression that begins with a '*' character. The remainder of +// ** the text passed to the MATCH operator are used as the special query +// ** parameters. +// */ +func _fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var n, rc int32 + var z uintptr + _, _, _ = n, rc, z + rc = SQLITE_OK /* Return code */ + z = zQuery /* Number of bytes in text at z */ + for int32(*(*int8)(unsafe.Pointer(z))) == int32(' ') { + z++ + } + n = 0 + for { + if !(*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0 && int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) != int32(' ')) { + break + } + goto _1 + _1: + ; + n++ + } + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SPECIAL) + if n == int32(5) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+36939, z, n) { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = int64(_sqlite3Fts5IndexReads(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) + } else { + if n == int32(2) && 0 == Xsqlite3_strnicmp(tls, __ccgo_ts+5513, z, n) { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId + } else { + /* An unrecognized directive. Return an error message. */ + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36945, libc.VaList(bp+8, n, z)) + rc = int32(SQLITE_ERROR) + } + } + return rc +} + +// C documentation +// +// /* +// ** Search for an auxiliary function named zName that can be used with table +// ** pTab. If one is found, return a pointer to the corresponding Fts5Auxiliary +// ** structure. Otherwise, if no such function exists, return NULL. +// */ +func _fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) (r uintptr) { + var pAux uintptr + _ = pAux + pAux = (*TFts5Global)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpAux + for { + if !(pAux != 0) { + break + } + if Xsqlite3_stricmp(tls, zName, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FzFunc) == 0 { + return pAux + } + goto _1 + _1: + ; + pAux = (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpNext + } + /* No function of the specified name was found. Return 0. */ + return uintptr(0) +} + +func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var i int32 + var nByte Tsqlite3_int64 + var pAux, pConfig, pTab, zRank, zRankArgs, zSql uintptr + var _ /* pStmt at bp+8 */ uintptr + var _ /* rc at bp+0 */ int32 + _, _, _, _, _, _, _, _ = i, nByte, pAux, pConfig, pTab, zRank, zRankArgs, zSql + pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + *(*int32)(unsafe.Pointer(bp)) = SQLITE_OK + pAux = uintptr(0) + zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank + zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs + if zRankArgs != 0 { + zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+36973, libc.VaList(bp+24, zRankArgs)) + if zSql != 0 { + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+8, uintptr(0)) + Xsqlite3_free(tls, zSql) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + if int32(SQLITE_ROW) == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + nByte = int64(uint64(8) * uint64((*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg)) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg = _sqlite3Fts5MallocZero(tls, bp, nByte) + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + i = 0 + for { + if !(i < (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg) { + break + } + *(*uintptr)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8)), i) + goto _1 + _1: + ; + i++ + } + } + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = *(*uintptr)(unsafe.Pointer(bp + 8)) + } else { + *(*int32)(unsafe.Pointer(bp)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) + } + } + } + } + if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK { + pAux = _fts5FindAuxiliary(tls, pTab, zRank) + if pAux == uintptr(0) { + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36983, libc.VaList(bp+24, zRank)) + *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_ERROR) + } + } + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRank = pAux + return *(*int32)(unsafe.Pointer(bp)) +} + +func _fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var rc int32 + var z uintptr + var _ /* zRank at bp+0 */ uintptr + var _ /* zRankArgs at bp+8 */ uintptr + _, _ = rc, z + rc = SQLITE_OK + if pRank != 0 { + z = Xsqlite3_value_text(tls, pRank) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8)) = uintptr(0) + if z == uintptr(0) { + if Xsqlite3_value_type(tls, pRank) == int32(SQLITE_NULL) { + rc = int32(SQLITE_ERROR) + } + } else { + rc = _sqlite3Fts5ConfigParseRank(tls, z, bp, bp+8) + } + if rc == SQLITE_OK { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = *(*uintptr)(unsafe.Pointer(bp)) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 8)) + *(*int32)(unsafe.Pointer(pCsr + 80)) |= int32(FTS5CSR_FREE_ZRANK) + } else { + if rc == int32(SQLITE_ERROR) { + (*Tsqlite3_vtab)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+37004, libc.VaList(bp+24, z)) + } + } + } else { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRank + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*TFts5Config)(unsafe.Pointer(pConfig)).FzRankArgs + } else { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank = __ccgo_ts + 34936 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) + } + } + return rc +} + +func _fts5GetRowidLimit(tls *libc.TLS, pVal uintptr, iDefault Ti64) (r Ti64) { + var eType int32 + _ = eType + if pVal != 0 { + eType = Xsqlite3_value_numeric_type(tls, pVal) + if eType == int32(SQLITE_INTEGER) { + return Xsqlite3_value_int64(tls, pVal) + } + } + return iDefault +} + +// C documentation +// +// /* +// ** This is the xFilter interface for the virtual table. See +// ** the virtual table xFilter method documentation for additional +// ** information. +// ** +// ** There are three possible query strategies: +// ** +// ** 1. Full-text search using a MATCH operator. +// ** 2. A by-rowid lookup. +// ** 3. A full-table scan. +// */ +func _fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, nVal int32, apVal uintptr) (r int32) { + bp := tls.Alloc(32) + defer tls.Free(32) + var bDesc, bGlob, bOrderByRank, i, iCol, iIdxStr, rc, v2, v3, v4, v5, v7 int32 + var pConfig, pCsr, pRank, pRowidEq, pRowidGe, pRowidLe, pTab, pzErr, pzErrmsg, zText, zText1, v6 uintptr + var _ /* pExpr at bp+0 */ uintptr + _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bDesc, bGlob, bOrderByRank, i, iCol, iIdxStr, pConfig, pCsr, pRank, pRowidEq, pRowidGe, pRowidLe, pTab, pzErr, pzErrmsg, rc, zText, zText1, v2, v3, v4, v5, v6, v7 + pTab = (*Tsqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + pCsr = pCursor + rc = SQLITE_OK /* True if ORDER BY rank */ + pRank = uintptr(0) /* rank MATCH ? expression (or NULL) */ + pRowidEq = uintptr(0) /* rowid = ? expression (or NULL) */ + pRowidLe = uintptr(0) /* rowid <= ? expression (or NULL) */ + pRowidGe = uintptr(0) /* Column on LHS of MATCH operator */ + pzErrmsg = (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg + iIdxStr = 0 + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + if (*TFts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { + (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+36836, 0) + return int32(SQLITE_ERROR) + } + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0 { + _fts5FreeCursorComponents(tls, pCsr) + libc.Xmemset(tls, pCsr+32, 0, uint64(184)-uint64(int64(pCsr+32)-int64(pCsr))) + } + (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pTab + 16 + /* Decode the arguments passed through to this function. */ + i = 0 + for { + if !(i < nVal) { + break + } + v2 = iIdxStr + iIdxStr++ + switch int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(v2)))) { + case int32('r'): + pRank = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + case int32('M'): + zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + if zText == uintptr(0) { + zText = __ccgo_ts + 1680 + } + iCol = 0 + for cond := true; cond; cond = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) <= int32('9') { + iCol = iCol*int32(10) + (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) - int32('0')) + iIdxStr++ + } + if int32(*(*int8)(unsafe.Pointer(zText))) == int32('*') { + /* The user has issued a query of the form "MATCH '*...'". This + ** indicates that the MATCH expression is not a full text query, + ** but a request for an internal parameter. */ + rc = _fts5SpecialMatch(tls, pTab, pCsr, zText+1) + goto filter_out + } else { + pzErr = pTab + 16 + rc = _sqlite3Fts5ExprNew(tls, pConfig, 0, iCol, zText, bp, pzErr) + if rc == SQLITE_OK { + rc = _sqlite3Fts5ExprAnd(tls, pCsr+64, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + if rc != SQLITE_OK { + goto filter_out + } + } + case int32('L'): + fallthrough + case int32('G'): + bGlob = libc.BoolInt32(int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr-int32(1))))) == int32('G')) + zText1 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + iCol = 0 + for cond := true; cond; cond = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) >= int32('0') && int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) <= int32('9') { + iCol = iCol*int32(10) + (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) - int32('0')) + iIdxStr++ + } + if zText1 != 0 { + rc = _sqlite3Fts5ExprPattern(tls, pConfig, bGlob, iCol, zText1, bp) + } + if rc == SQLITE_OK { + rc = _sqlite3Fts5ExprAnd(tls, pCsr+64, *(*uintptr)(unsafe.Pointer(bp))) + *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) + } + if rc != SQLITE_OK { + goto filter_out + } + case int32('='): + pRowidEq = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + case int32('<'): + pRowidLe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + default: + pRowidGe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + break + } + goto _1 + _1: + ; + i++ + } + if idxNum&int32(FTS5_BI_ORDER_RANK) != 0 { + v3 = int32(1) + } else { + v3 = 0 + } + bOrderByRank = v3 + if idxNum&int32(FTS5_BI_ORDER_DESC) != 0 { + v5 = int32(1) + } else { + v5 = 0 + } + v4 = v5 + bDesc = v4 + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FbDesc = v4 + /* Set the cursor upper and lower rowid limits. Only some strategies + ** actually use them. This is ok, as the xBestIndex() method leaves the + ** sqlite3_index_constraint.omit flag clear for range constraints + ** on the rowid field. */ + if pRowidEq != 0 { + v6 = pRowidEq + pRowidGe = v6 + pRowidLe = v6 + } + if bDesc != 0 { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = _fts5GetRowidLimit(tls, pRowidLe, libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< ORDER BY rank" query (ePlan is + ** set to FTS5_PLAN_SORTED_MATCH). pSortCsr is the cursor that will + ** return results to the user for this query. The current cursor + ** (pCursor) is used to execute the query issued by function + ** fts5CursorFirstSorted() above. */ + if (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FbDesc != 0 { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiFirstRowid + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiLastRowid + } else { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiLastRowid + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiFirstRowid + } + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SOURCE) + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr = (*TFts5Cursor)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FpExpr + rc = _fts5CursorFirst(tls, pTab, pCsr, bDesc) + } else { + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr != 0 { + rc = _fts5CursorParseRank(tls, pConfig, pCsr, pRank) + if rc == SQLITE_OK { + if bOrderByRank != 0 { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_SORTED_MATCH) + rc = _fts5CursorFirstSorted(tls, pTab, pCsr, bDesc) + } else { + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = int32(FTS5_PLAN_MATCH) + rc = _fts5CursorFirst(tls, pTab, pCsr, bDesc) + } + } + } else { + if (*TFts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { + *(*uintptr)(unsafe.Pointer((*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+37037, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = int32(SQLITE_ERROR) + } else { + /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup + ** by rowid (ePlan==FTS5_PLAN_ROWID). */ + if pRowidEq != 0 { + v7 = int32(FTS5_PLAN_ROWID) + } else { + v7 = int32(FTS5_PLAN_SCAN) + } + (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan = v7 + rc = _sqlite3Fts5StorageStmt(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, _fts5StmtType(tls, pCsr), pCsr+56, pTab+16) + if rc == SQLITE_OK { + if pRowidEq != uintptr(0) { + Xsqlite3_bind_value(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), pRowidEq) + } else { + Xsqlite3_bind_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid) + Xsqlite3_bind_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(2), (*TFts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid) + } + rc = _fts5NextMethod(tls, pCursor) + } + } + } + } +filter_out: + ; + _sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp))) + (*TFts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg + return rc +} + +// C documentation +// +// /* +// ** This is the xEof method of the virtual table. SQLite calls this +// ** routine to find out if it has reached the end of a result set. +// */ +func _fts5EofMethod(tls *libc.TLS, pCursor uintptr) (r int32) { + var pCsr uintptr + var v1 int32 + _, _ = pCsr, v1 + pCsr = pCursor + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_EOF) != 0 { + v1 = int32(1) + } else { + v1 = 0 + } + return v1 +} + +// C documentation +// +// /* +// ** Return the rowid that the cursor currently points to. +// */ +func _fts5CursorRowid(tls *libc.TLS, pCsr uintptr) (r Ti64) { + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { + return (*TFts5Sorter)(unsafe.Pointer((*TFts5Cursor)(unsafe.Pointer(pCsr)).FpSorter)).FiRowid + } else { + return _sqlite3Fts5ExprRowid(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + } + return r +} + +// C documentation +// +// /* +// ** This is the xRowid method. The SQLite core calls this routine to +// ** retrieve the rowid for the current row of the result set. fts5 +// ** exposes %_content.rowid as the rowid for the virtual table. The +// ** rowid should be written to *pRowid. +// */ +func _fts5RowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) (r int32) { + var ePlan int32 + var pCsr uintptr + _, _ = ePlan, pCsr + pCsr = pCursor + ePlan = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan + switch ePlan { + case int32(FTS5_PLAN_SPECIAL): + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = 0 + case int32(FTS5_PLAN_SOURCE): + fallthrough + case int32(FTS5_PLAN_MATCH): + fallthrough + case int32(FTS5_PLAN_SORTED_MATCH): + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = _fts5CursorRowid(tls, pCsr) + default: + *(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = Xsqlite3_column_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 0) + break + } + return SQLITE_OK +} + +// C documentation +// +// /* +// ** If the cursor requires seeking (bSeekRequired flag is set), seek it. +// ** Return SQLITE_OK if no error occurs, or an SQLite error code otherwise. +// ** +// ** If argument bErrormsg is true and an error occurs, an error message may +// ** be left in sqlite3_vtab.zErrMsg. +// */ +func _fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) (r int32) { + bp := tls.Alloc(16) + defer tls.Free(16) + var eStmt, rc int32 + var pTab, pTab1, v1 uintptr + _, _, _, _, _ = eStmt, pTab, pTab1, rc, v1 + rc = SQLITE_OK + /* If the cursor does not yet have a statement handle, obtain one now. */ + if (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0) { + pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + eStmt = _fts5StmtType(tls, pCsr) + if bErrormsg != 0 { + v1 = pTab + 16 + } else { + v1 = uintptr(0) + } + rc = _sqlite3Fts5StorageStmt(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, eStmt, pCsr+56, v1) + } + if rc == SQLITE_OK && (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fcsrflags&int32(FTS5CSR_REQUIRE_CONTENT) != 0 { + pTab1 = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + Xsqlite3_reset(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + Xsqlite3_bind_int64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, int32(1), _fts5CursorRowid(tls, pCsr)) + (*TFts5Config)(unsafe.Pointer((*TFts5Table)(unsafe.Pointer(pTab1)).FpConfig)).FbLock++ + rc = Xsqlite3_step(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + (*TFts5Config)(unsafe.Pointer((*TFts5Table)(unsafe.Pointer(pTab1)).FpConfig)).FbLock-- + if rc == int32(SQLITE_ROW) { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pCsr + 80)) &= ^libc.Int32FromInt32(FTS5CSR_REQUIRE_CONTENT) + } else { + rc = Xsqlite3_reset(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + if rc == SQLITE_OK { + rc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<